@hasna/connectors 1.3.15 → 1.3.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/index.js +110 -24
- package/bin/mcp.js +19 -10
- package/bin/serve.js +21 -12
- package/dist/index.js +5 -5
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -20991,7 +20991,7 @@ __export(exports_database, {
|
|
|
20991
20991
|
getConnectorsHome: () => getConnectorsHome,
|
|
20992
20992
|
closeDatabase: () => closeDatabase
|
|
20993
20993
|
});
|
|
20994
|
-
import { join as join7 } from "path";
|
|
20994
|
+
import { dirname as dirname3, join as join7 } from "path";
|
|
20995
20995
|
import { homedir as homedir6 } from "os";
|
|
20996
20996
|
import { mkdirSync as mkdirSync4, existsSync as existsSync7, readdirSync as readdirSync4, copyFileSync as copyFileSync2, statSync } from "fs";
|
|
20997
20997
|
function getConnectorsHome() {
|
|
@@ -21016,11 +21016,19 @@ function getConnectorsHome() {
|
|
|
21016
21016
|
return newDir;
|
|
21017
21017
|
}
|
|
21018
21018
|
function getDatabase(path) {
|
|
21019
|
-
if (_db)
|
|
21020
|
-
return _db;
|
|
21021
21019
|
const dbPath = path ?? DB_PATH;
|
|
21022
|
-
|
|
21020
|
+
if (_db) {
|
|
21021
|
+
if (_dbPath === dbPath)
|
|
21022
|
+
return _db;
|
|
21023
|
+
_db.close();
|
|
21024
|
+
_db = null;
|
|
21025
|
+
_dbPath = null;
|
|
21026
|
+
}
|
|
21027
|
+
if (dbPath !== ":memory:") {
|
|
21028
|
+
mkdirSync4(dirname3(dbPath), { recursive: true });
|
|
21029
|
+
}
|
|
21023
21030
|
_db = new SqliteAdapter(dbPath);
|
|
21031
|
+
_dbPath = dbPath;
|
|
21024
21032
|
_db.run("PRAGMA journal_mode = WAL");
|
|
21025
21033
|
migrate(_db);
|
|
21026
21034
|
return _db;
|
|
@@ -21028,6 +21036,7 @@ function getDatabase(path) {
|
|
|
21028
21036
|
function closeDatabase() {
|
|
21029
21037
|
_db?.close();
|
|
21030
21038
|
_db = null;
|
|
21039
|
+
_dbPath = null;
|
|
21031
21040
|
}
|
|
21032
21041
|
function now() {
|
|
21033
21042
|
return new Date().toISOString();
|
|
@@ -21141,7 +21150,7 @@ function migrate(db) {
|
|
|
21141
21150
|
)
|
|
21142
21151
|
`);
|
|
21143
21152
|
}
|
|
21144
|
-
var DB_DIR, DB_PATH, _db = null;
|
|
21153
|
+
var DB_DIR, DB_PATH, _db = null, _dbPath = null;
|
|
21145
21154
|
var init_database2 = __esm(() => {
|
|
21146
21155
|
init_dist();
|
|
21147
21156
|
DB_DIR = getConnectorsHome();
|
|
@@ -21160,7 +21169,7 @@ __export(exports_installer, {
|
|
|
21160
21169
|
connectorExists: () => connectorExists
|
|
21161
21170
|
});
|
|
21162
21171
|
import { existsSync as existsSync9, cpSync, mkdirSync as mkdirSync6, readFileSync as readFileSync3, writeFileSync as writeFileSync3, readdirSync as readdirSync6, statSync as statSync2, rmSync } from "fs";
|
|
21163
|
-
import { join as join9, dirname as
|
|
21172
|
+
import { join as join9, dirname as dirname4 } from "path";
|
|
21164
21173
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
21165
21174
|
function resolveConnectorsDir() {
|
|
21166
21175
|
const fromBin = join9(__dirname2, "..", "connectors");
|
|
@@ -21325,7 +21334,7 @@ function removeConnector(name, targetDir = process.cwd()) {
|
|
|
21325
21334
|
var __dirname2, CONNECTORS_DIR;
|
|
21326
21335
|
var init_installer = __esm(() => {
|
|
21327
21336
|
init_database2();
|
|
21328
|
-
__dirname2 =
|
|
21337
|
+
__dirname2 = dirname4(fileURLToPath2(import.meta.url));
|
|
21329
21338
|
CONNECTORS_DIR = resolveConnectorsDir();
|
|
21330
21339
|
});
|
|
21331
21340
|
|
|
@@ -22451,7 +22460,7 @@ __export(exports_serve, {
|
|
|
22451
22460
|
startServer: () => startServer
|
|
22452
22461
|
});
|
|
22453
22462
|
import { existsSync as existsSync13, readdirSync as readdirSync9, readFileSync as readFileSync6, writeFileSync as writeFileSync7, mkdirSync as mkdirSync10 } from "fs";
|
|
22454
|
-
import { join as join14, dirname as
|
|
22463
|
+
import { join as join14, dirname as dirname5, extname, basename } from "path";
|
|
22455
22464
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
22456
22465
|
function logActivity(action, connector, detail) {
|
|
22457
22466
|
activityLog.unshift({ action, connector, timestamp: Date.now(), detail });
|
|
@@ -22462,12 +22471,12 @@ function logActivity(action, connector, detail) {
|
|
|
22462
22471
|
function resolveDashboardDir() {
|
|
22463
22472
|
const candidates = [];
|
|
22464
22473
|
try {
|
|
22465
|
-
const scriptDir =
|
|
22474
|
+
const scriptDir = dirname5(fileURLToPath3(import.meta.url));
|
|
22466
22475
|
candidates.push(join14(scriptDir, "..", "dashboard", "dist"));
|
|
22467
22476
|
candidates.push(join14(scriptDir, "..", "..", "dashboard", "dist"));
|
|
22468
22477
|
} catch {}
|
|
22469
22478
|
if (process.argv[1]) {
|
|
22470
|
-
const mainDir =
|
|
22479
|
+
const mainDir = dirname5(process.argv[1]);
|
|
22471
22480
|
candidates.push(join14(mainDir, "..", "dashboard", "dist"));
|
|
22472
22481
|
candidates.push(join14(mainDir, "..", "..", "dashboard", "dist"));
|
|
22473
22482
|
}
|
|
@@ -23169,7 +23178,7 @@ var {
|
|
|
23169
23178
|
// package.json
|
|
23170
23179
|
var package_default = {
|
|
23171
23180
|
name: "@hasna/connectors",
|
|
23172
|
-
version: "1.3.
|
|
23181
|
+
version: "1.3.17",
|
|
23173
23182
|
description: "Open source connector library - Install API connectors with a single command",
|
|
23174
23183
|
type: "module",
|
|
23175
23184
|
bin: {
|
|
@@ -24996,11 +25005,38 @@ init_registry();
|
|
|
24996
25005
|
init_installer();
|
|
24997
25006
|
init_auth();
|
|
24998
25007
|
import chalk3 from "chalk";
|
|
25008
|
+
function parseNonNegativeInt(raw, flag) {
|
|
25009
|
+
if (raw === undefined)
|
|
25010
|
+
return { value: undefined };
|
|
25011
|
+
if (!/^\d+$/.test(raw)) {
|
|
25012
|
+
return { value: undefined, error: `Invalid value for ${flag}: '${raw}'. Expected a non-negative integer.` };
|
|
25013
|
+
}
|
|
25014
|
+
return { value: parseInt(raw, 10) };
|
|
25015
|
+
}
|
|
24999
25016
|
function registerCommands2(program2) {
|
|
25000
|
-
program2.command("list").alias("ls").option("-c, --category <category>", "Filter by category").option("-a, --all", "Show all available connectors", false).option("-i, --installed", "Show only installed connectors", false).option("-b, --brief", "Output only connector names", false).option("--json", "Output as JSON", false).description("List available or installed connectors").action((options) => {
|
|
25017
|
+
program2.command("list").alias("ls").option("-c, --category <category>", "Filter by category").option("-a, --all", "Show all available connectors", false).option("-i, --installed", "Show only installed connectors", false).option("-b, --brief", "Output only connector names", false).option("--limit <n>", "Limit results").option("--offset <n>", "Skip first N results").option("--json", "Output as JSON", false).description("List available or installed connectors").action((options) => {
|
|
25018
|
+
const parsedLimit = parseNonNegativeInt(options.limit, "--limit");
|
|
25019
|
+
const parsedOffset = parseNonNegativeInt(options.offset, "--offset");
|
|
25020
|
+
if (parsedLimit.error || parsedOffset.error) {
|
|
25021
|
+
const error = parsedLimit.error || parsedOffset.error || "Invalid pagination options";
|
|
25022
|
+
if (options.json) {
|
|
25023
|
+
console.log(JSON.stringify({ error }));
|
|
25024
|
+
} else {
|
|
25025
|
+
console.log(chalk3.red(error));
|
|
25026
|
+
}
|
|
25027
|
+
process.exit(1);
|
|
25028
|
+
return;
|
|
25029
|
+
}
|
|
25030
|
+
const limit = parsedLimit.value;
|
|
25031
|
+
const offset = parsedOffset.value ?? 0;
|
|
25032
|
+
const page = (items) => {
|
|
25033
|
+
if (limit === undefined)
|
|
25034
|
+
return items.slice(offset);
|
|
25035
|
+
return items.slice(offset, offset + limit);
|
|
25036
|
+
};
|
|
25001
25037
|
if (options.brief) {
|
|
25002
25038
|
if (options.installed) {
|
|
25003
|
-
const installed = getInstalledConnectors();
|
|
25039
|
+
const installed = page(getInstalledConnectors());
|
|
25004
25040
|
if (options.json) {
|
|
25005
25041
|
console.log(JSON.stringify(installed));
|
|
25006
25042
|
} else {
|
|
@@ -25014,7 +25050,7 @@ function registerCommands2(program2) {
|
|
|
25014
25050
|
process.exit(1);
|
|
25015
25051
|
return;
|
|
25016
25052
|
}
|
|
25017
|
-
const names = getConnectorsByCategory(category).map((c) => c.name);
|
|
25053
|
+
const names = page(getConnectorsByCategory(category).map((c) => c.name));
|
|
25018
25054
|
if (options.json) {
|
|
25019
25055
|
console.log(JSON.stringify(names));
|
|
25020
25056
|
} else {
|
|
@@ -25022,7 +25058,7 @@ function registerCommands2(program2) {
|
|
|
25022
25058
|
console.log(n);
|
|
25023
25059
|
}
|
|
25024
25060
|
} else {
|
|
25025
|
-
const names = CONNECTORS.map((c) => c.name);
|
|
25061
|
+
const names = page(CONNECTORS.map((c) => c.name));
|
|
25026
25062
|
if (options.json) {
|
|
25027
25063
|
console.log(JSON.stringify(names));
|
|
25028
25064
|
} else {
|
|
@@ -25033,7 +25069,7 @@ function registerCommands2(program2) {
|
|
|
25033
25069
|
return;
|
|
25034
25070
|
}
|
|
25035
25071
|
if (options.installed) {
|
|
25036
|
-
const installed = getInstalledConnectors();
|
|
25072
|
+
const installed = page(getInstalledConnectors());
|
|
25037
25073
|
if (installed.length === 0) {
|
|
25038
25074
|
if (options.json) {
|
|
25039
25075
|
console.log(JSON.stringify([]));
|
|
@@ -25116,22 +25152,35 @@ Installed connectors (${installed.length}):
|
|
|
25116
25152
|
return;
|
|
25117
25153
|
}
|
|
25118
25154
|
const connectors18 = getConnectorsByCategory(category);
|
|
25155
|
+
const pagedConnectors = page(connectors18);
|
|
25119
25156
|
if (options.json) {
|
|
25120
|
-
console.log(JSON.stringify(
|
|
25157
|
+
console.log(JSON.stringify(pagedConnectors));
|
|
25121
25158
|
return;
|
|
25122
25159
|
}
|
|
25123
25160
|
console.log(chalk3.bold(`
|
|
25124
|
-
${category} (${
|
|
25161
|
+
${category} (${pagedConnectors.length}):
|
|
25125
25162
|
`));
|
|
25126
25163
|
console.log(` ${chalk3.dim("Name".padEnd(20))}${chalk3.dim("Version".padEnd(10))}${chalk3.dim("Description")}`);
|
|
25127
25164
|
console.log(chalk3.dim(` ${"\u2500".repeat(60)}`));
|
|
25128
|
-
for (const c of
|
|
25165
|
+
for (const c of pagedConnectors) {
|
|
25129
25166
|
console.log(` ${chalk3.cyan(c.name.padEnd(20))}${chalk3.dim((c.version || "-").padEnd(10))}${c.description}`);
|
|
25130
25167
|
}
|
|
25131
25168
|
return;
|
|
25132
25169
|
}
|
|
25133
25170
|
if (options.json) {
|
|
25134
|
-
console.log(JSON.stringify(CONNECTORS));
|
|
25171
|
+
console.log(JSON.stringify(page(CONNECTORS)));
|
|
25172
|
+
return;
|
|
25173
|
+
}
|
|
25174
|
+
if (options.limit || options.offset) {
|
|
25175
|
+
const connectors18 = page(CONNECTORS);
|
|
25176
|
+
console.log(chalk3.bold(`
|
|
25177
|
+
Available connectors (${connectors18.length}):
|
|
25178
|
+
`));
|
|
25179
|
+
console.log(` ${chalk3.dim("Name".padEnd(20))}${chalk3.dim("Version".padEnd(10))}${chalk3.dim("Category".padEnd(24))}${chalk3.dim("Description")}`);
|
|
25180
|
+
console.log(chalk3.dim(` ${"\u2500".repeat(96)}`));
|
|
25181
|
+
for (const c of connectors18) {
|
|
25182
|
+
console.log(` ${chalk3.cyan(c.name.padEnd(20))}` + `${chalk3.dim((c.version || "-").padEnd(10))}` + `${chalk3.dim(c.category.padEnd(24))}` + `${c.description}`);
|
|
25183
|
+
}
|
|
25135
25184
|
return;
|
|
25136
25185
|
}
|
|
25137
25186
|
console.log(chalk3.bold(`
|
|
@@ -25149,6 +25198,17 @@ Available connectors (${CONNECTORS.length}):
|
|
|
25149
25198
|
}
|
|
25150
25199
|
});
|
|
25151
25200
|
program2.command("search").argument("<query>", "Search term").option("--json", "Output as JSON", false).option("--limit <n>", "Max results", "20").description("Search for connectors (ranked with fuzzy matching)").action((query, options) => {
|
|
25201
|
+
const parsedLimit = parseNonNegativeInt(options.limit, "--limit");
|
|
25202
|
+
if (parsedLimit.error || parsedLimit.value === undefined) {
|
|
25203
|
+
const error = parsedLimit.error || "Invalid --limit value";
|
|
25204
|
+
if (options.json) {
|
|
25205
|
+
console.log(JSON.stringify({ error }));
|
|
25206
|
+
} else {
|
|
25207
|
+
console.log(chalk3.red(error));
|
|
25208
|
+
}
|
|
25209
|
+
process.exit(1);
|
|
25210
|
+
return;
|
|
25211
|
+
}
|
|
25152
25212
|
const installed = getInstalledConnectors();
|
|
25153
25213
|
const { getPromotedConnectors: getPromotedConnectors2 } = (init_promotions(), __toCommonJS(exports_promotions));
|
|
25154
25214
|
const { getUsageMap: getUsageMap2 } = (init_usage(), __toCommonJS(exports_usage));
|
|
@@ -25156,7 +25216,7 @@ Available connectors (${CONNECTORS.length}):
|
|
|
25156
25216
|
installed,
|
|
25157
25217
|
promoted: getPromotedConnectors2(),
|
|
25158
25218
|
usage: getUsageMap2(),
|
|
25159
|
-
limit:
|
|
25219
|
+
limit: parsedLimit.value
|
|
25160
25220
|
});
|
|
25161
25221
|
if (options.json) {
|
|
25162
25222
|
console.log(JSON.stringify(results.map((c) => ({ name: c.name, displayName: c.displayName, version: c.version, category: c.category, description: c.description, score: c.score, badges: c.badges, matchReasons: c.matchReasons }))));
|
|
@@ -25206,7 +25266,7 @@ ${meta.displayName}`));
|
|
|
25206
25266
|
console.log(` Installed: ${isInstalled ? chalk3.green("yes") : "no"}`);
|
|
25207
25267
|
console.log(` Package: @hasna/connect-${meta.name}`);
|
|
25208
25268
|
});
|
|
25209
|
-
program2.command("docs").argument("<connector>", "Connector name").option("--json", "Output as structured JSON", false).option("--raw", "Output raw markdown", false).description("Show connector documentation (auth, env vars, API, CLI commands)").action((connector, options) => {
|
|
25269
|
+
program2.command("docs").argument("<connector>", "Connector name").option("--json", "Output as structured JSON", false).option("--raw", "Output raw markdown", false).option("--essential", "Show auth and env vars only (no full docs)", false).description("Show connector documentation (auth, env vars, API, CLI commands)").action((connector, options) => {
|
|
25210
25270
|
const meta = getConnector(connector);
|
|
25211
25271
|
if (!meta) {
|
|
25212
25272
|
if (options.json) {
|
|
@@ -25233,6 +25293,32 @@ ${meta.displayName}`));
|
|
|
25233
25293
|
console.log(docs.raw);
|
|
25234
25294
|
return;
|
|
25235
25295
|
}
|
|
25296
|
+
if (options.essential) {
|
|
25297
|
+
if (options.json) {
|
|
25298
|
+
console.log(JSON.stringify({ name: meta.name, auth: docs.auth, envVars: docs.envVars }, null, 2));
|
|
25299
|
+
} else {
|
|
25300
|
+
console.log(chalk3.bold(`
|
|
25301
|
+
${meta.displayName} \u2014 Auth & Env Vars`));
|
|
25302
|
+
console.log(chalk3.dim("\u2500".repeat(50)));
|
|
25303
|
+
if (docs.auth) {
|
|
25304
|
+
console.log(chalk3.bold(`
|
|
25305
|
+
Authentication`));
|
|
25306
|
+
for (const line of docs.auth.split(`
|
|
25307
|
+
`).filter(Boolean)) {
|
|
25308
|
+
console.log(` ${line}`);
|
|
25309
|
+
}
|
|
25310
|
+
}
|
|
25311
|
+
if (docs.envVars.length > 0) {
|
|
25312
|
+
console.log(chalk3.bold(`
|
|
25313
|
+
Environment Variables`));
|
|
25314
|
+
for (const v of docs.envVars) {
|
|
25315
|
+
console.log(` ${chalk3.cyan(v.variable.padEnd(30))}${v.description}`);
|
|
25316
|
+
}
|
|
25317
|
+
}
|
|
25318
|
+
console.log();
|
|
25319
|
+
}
|
|
25320
|
+
return;
|
|
25321
|
+
}
|
|
25236
25322
|
if (options.json) {
|
|
25237
25323
|
console.log(JSON.stringify({
|
|
25238
25324
|
name: meta.name,
|
|
@@ -26836,10 +26922,10 @@ import chalk7 from "chalk";
|
|
|
26836
26922
|
|
|
26837
26923
|
// src/lib/runner.ts
|
|
26838
26924
|
import { existsSync as existsSync17 } from "fs";
|
|
26839
|
-
import { join as join18, dirname as
|
|
26925
|
+
import { join as join18, dirname as dirname6 } from "path";
|
|
26840
26926
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
26841
26927
|
import { spawn as spawn3 } from "child_process";
|
|
26842
|
-
var __dirname3 =
|
|
26928
|
+
var __dirname3 = dirname6(fileURLToPath4(import.meta.url));
|
|
26843
26929
|
function resolveConnectorsDir2() {
|
|
26844
26930
|
const fromBin = join18(__dirname3, "..", "connectors");
|
|
26845
26931
|
if (existsSync17(fromBin))
|
package/bin/mcp.js
CHANGED
|
@@ -16556,7 +16556,7 @@ __export(exports_database, {
|
|
|
16556
16556
|
getConnectorsHome: () => getConnectorsHome,
|
|
16557
16557
|
closeDatabase: () => closeDatabase
|
|
16558
16558
|
});
|
|
16559
|
-
import { join as join5 } from "path";
|
|
16559
|
+
import { dirname as dirname3, join as join5 } from "path";
|
|
16560
16560
|
import { homedir as homedir6 } from "os";
|
|
16561
16561
|
import { mkdirSync as mkdirSync3, existsSync as existsSync4, readdirSync as readdirSync3, copyFileSync as copyFileSync2, statSync } from "fs";
|
|
16562
16562
|
function getConnectorsHome() {
|
|
@@ -16581,11 +16581,19 @@ function getConnectorsHome() {
|
|
|
16581
16581
|
return newDir;
|
|
16582
16582
|
}
|
|
16583
16583
|
function getDatabase(path) {
|
|
16584
|
-
if (_db)
|
|
16585
|
-
return _db;
|
|
16586
16584
|
const dbPath = path ?? DB_PATH;
|
|
16587
|
-
|
|
16585
|
+
if (_db) {
|
|
16586
|
+
if (_dbPath === dbPath)
|
|
16587
|
+
return _db;
|
|
16588
|
+
_db.close();
|
|
16589
|
+
_db = null;
|
|
16590
|
+
_dbPath = null;
|
|
16591
|
+
}
|
|
16592
|
+
if (dbPath !== ":memory:") {
|
|
16593
|
+
mkdirSync3(dirname3(dbPath), { recursive: true });
|
|
16594
|
+
}
|
|
16588
16595
|
_db = new SqliteAdapter(dbPath);
|
|
16596
|
+
_dbPath = dbPath;
|
|
16589
16597
|
_db.run("PRAGMA journal_mode = WAL");
|
|
16590
16598
|
migrate(_db);
|
|
16591
16599
|
return _db;
|
|
@@ -16593,6 +16601,7 @@ function getDatabase(path) {
|
|
|
16593
16601
|
function closeDatabase() {
|
|
16594
16602
|
_db?.close();
|
|
16595
16603
|
_db = null;
|
|
16604
|
+
_dbPath = null;
|
|
16596
16605
|
}
|
|
16597
16606
|
function now() {
|
|
16598
16607
|
return new Date().toISOString();
|
|
@@ -16706,7 +16715,7 @@ function migrate(db) {
|
|
|
16706
16715
|
)
|
|
16707
16716
|
`);
|
|
16708
16717
|
}
|
|
16709
|
-
var DB_DIR, DB_PATH, _db = null;
|
|
16718
|
+
var DB_DIR, DB_PATH, _db = null, _dbPath = null;
|
|
16710
16719
|
var init_database = __esm(() => {
|
|
16711
16720
|
init_dist();
|
|
16712
16721
|
DB_DIR = getConnectorsHome();
|
|
@@ -16725,7 +16734,7 @@ __export(exports_installer, {
|
|
|
16725
16734
|
connectorExists: () => connectorExists
|
|
16726
16735
|
});
|
|
16727
16736
|
import { existsSync as existsSync6, cpSync, mkdirSync as mkdirSync5, readFileSync as readFileSync3, writeFileSync as writeFileSync2, readdirSync as readdirSync5, statSync as statSync2, rmSync } from "fs";
|
|
16728
|
-
import { join as join7, dirname as
|
|
16737
|
+
import { join as join7, dirname as dirname4 } from "path";
|
|
16729
16738
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
16730
16739
|
function resolveConnectorsDir() {
|
|
16731
16740
|
const fromBin = join7(__dirname2, "..", "connectors");
|
|
@@ -16890,7 +16899,7 @@ function removeConnector(name, targetDir = process.cwd()) {
|
|
|
16890
16899
|
var __dirname2, CONNECTORS_DIR;
|
|
16891
16900
|
var init_installer = __esm(() => {
|
|
16892
16901
|
init_database();
|
|
16893
|
-
__dirname2 =
|
|
16902
|
+
__dirname2 = dirname4(fileURLToPath2(import.meta.url));
|
|
16894
16903
|
CONNECTORS_DIR = resolveConnectorsDir();
|
|
16895
16904
|
});
|
|
16896
16905
|
|
|
@@ -37006,10 +37015,10 @@ function guessKeyField(name) {
|
|
|
37006
37015
|
|
|
37007
37016
|
// src/lib/runner.ts
|
|
37008
37017
|
import { existsSync as existsSync9 } from "fs";
|
|
37009
|
-
import { join as join10, dirname as
|
|
37018
|
+
import { join as join10, dirname as dirname5 } from "path";
|
|
37010
37019
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
37011
37020
|
import { spawn } from "child_process";
|
|
37012
|
-
var __dirname3 =
|
|
37021
|
+
var __dirname3 = dirname5(fileURLToPath3(import.meta.url));
|
|
37013
37022
|
function resolveConnectorsDir2() {
|
|
37014
37023
|
const fromBin = join10(__dirname3, "..", "connectors");
|
|
37015
37024
|
if (existsSync9(fromBin))
|
|
@@ -37281,7 +37290,7 @@ init_dist();
|
|
|
37281
37290
|
// package.json
|
|
37282
37291
|
var package_default = {
|
|
37283
37292
|
name: "@hasna/connectors",
|
|
37284
|
-
version: "1.3.
|
|
37293
|
+
version: "1.3.17",
|
|
37285
37294
|
description: "Open source connector library - Install API connectors with a single command",
|
|
37286
37295
|
type: "module",
|
|
37287
37296
|
bin: {
|
package/bin/serve.js
CHANGED
|
@@ -9409,7 +9409,7 @@ __export(exports_database, {
|
|
|
9409
9409
|
getConnectorsHome: () => getConnectorsHome,
|
|
9410
9410
|
closeDatabase: () => closeDatabase
|
|
9411
9411
|
});
|
|
9412
|
-
import { join as join5 } from "path";
|
|
9412
|
+
import { dirname as dirname2, join as join5 } from "path";
|
|
9413
9413
|
import { homedir as homedir6 } from "os";
|
|
9414
9414
|
import { mkdirSync as mkdirSync3, existsSync as existsSync4, readdirSync as readdirSync3, copyFileSync as copyFileSync2, statSync } from "fs";
|
|
9415
9415
|
function getConnectorsHome() {
|
|
@@ -9434,11 +9434,19 @@ function getConnectorsHome() {
|
|
|
9434
9434
|
return newDir;
|
|
9435
9435
|
}
|
|
9436
9436
|
function getDatabase(path) {
|
|
9437
|
-
if (_db)
|
|
9438
|
-
return _db;
|
|
9439
9437
|
const dbPath = path ?? DB_PATH;
|
|
9440
|
-
|
|
9438
|
+
if (_db) {
|
|
9439
|
+
if (_dbPath === dbPath)
|
|
9440
|
+
return _db;
|
|
9441
|
+
_db.close();
|
|
9442
|
+
_db = null;
|
|
9443
|
+
_dbPath = null;
|
|
9444
|
+
}
|
|
9445
|
+
if (dbPath !== ":memory:") {
|
|
9446
|
+
mkdirSync3(dirname2(dbPath), { recursive: true });
|
|
9447
|
+
}
|
|
9441
9448
|
_db = new SqliteAdapter(dbPath);
|
|
9449
|
+
_dbPath = dbPath;
|
|
9442
9450
|
_db.run("PRAGMA journal_mode = WAL");
|
|
9443
9451
|
migrate(_db);
|
|
9444
9452
|
return _db;
|
|
@@ -9446,6 +9454,7 @@ function getDatabase(path) {
|
|
|
9446
9454
|
function closeDatabase() {
|
|
9447
9455
|
_db?.close();
|
|
9448
9456
|
_db = null;
|
|
9457
|
+
_dbPath = null;
|
|
9449
9458
|
}
|
|
9450
9459
|
function now() {
|
|
9451
9460
|
return new Date().toISOString();
|
|
@@ -9559,7 +9568,7 @@ function migrate(db) {
|
|
|
9559
9568
|
)
|
|
9560
9569
|
`);
|
|
9561
9570
|
}
|
|
9562
|
-
var DB_DIR, DB_PATH, _db = null;
|
|
9571
|
+
var DB_DIR, DB_PATH, _db = null, _dbPath = null;
|
|
9563
9572
|
var init_database = __esm(() => {
|
|
9564
9573
|
init_dist();
|
|
9565
9574
|
DB_DIR = getConnectorsHome();
|
|
@@ -10208,12 +10217,12 @@ async function runWorkflow(workflow) {
|
|
|
10208
10217
|
|
|
10209
10218
|
// src/server/serve.ts
|
|
10210
10219
|
init_database();
|
|
10211
|
-
import { join as join12, dirname as
|
|
10220
|
+
import { join as join12, dirname as dirname5, extname, basename } from "path";
|
|
10212
10221
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
10213
10222
|
|
|
10214
10223
|
// src/lib/registry.ts
|
|
10215
10224
|
import { existsSync as existsSync7, readFileSync as readFileSync3 } from "fs";
|
|
10216
|
-
import { join as join8, dirname as
|
|
10225
|
+
import { join as join8, dirname as dirname3 } from "path";
|
|
10217
10226
|
import { fileURLToPath } from "url";
|
|
10218
10227
|
|
|
10219
10228
|
// src/lib/connectors/ai-ml.ts
|
|
@@ -16213,7 +16222,7 @@ function loadConnectorVersions() {
|
|
|
16213
16222
|
if (versionsLoaded)
|
|
16214
16223
|
return;
|
|
16215
16224
|
versionsLoaded = true;
|
|
16216
|
-
const thisDir =
|
|
16225
|
+
const thisDir = dirname3(fileURLToPath(import.meta.url));
|
|
16217
16226
|
const candidates = [
|
|
16218
16227
|
join8(thisDir, "..", "connectors"),
|
|
16219
16228
|
join8(thisDir, "..", "..", "connectors")
|
|
@@ -16235,9 +16244,9 @@ function loadConnectorVersions() {
|
|
|
16235
16244
|
// src/lib/installer.ts
|
|
16236
16245
|
init_database();
|
|
16237
16246
|
import { existsSync as existsSync8, cpSync, mkdirSync as mkdirSync6, readFileSync as readFileSync4, writeFileSync as writeFileSync3, readdirSync as readdirSync5, statSync as statSync2, rmSync } from "fs";
|
|
16238
|
-
import { join as join9, dirname as
|
|
16247
|
+
import { join as join9, dirname as dirname4 } from "path";
|
|
16239
16248
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
16240
|
-
var __dirname2 =
|
|
16249
|
+
var __dirname2 = dirname4(fileURLToPath2(import.meta.url));
|
|
16241
16250
|
function resolveConnectorsDir() {
|
|
16242
16251
|
const fromBin = join9(__dirname2, "..", "connectors");
|
|
16243
16252
|
if (existsSync8(fromBin))
|
|
@@ -16869,12 +16878,12 @@ function logActivity(action, connector, detail) {
|
|
|
16869
16878
|
function resolveDashboardDir() {
|
|
16870
16879
|
const candidates = [];
|
|
16871
16880
|
try {
|
|
16872
|
-
const scriptDir =
|
|
16881
|
+
const scriptDir = dirname5(fileURLToPath3(import.meta.url));
|
|
16873
16882
|
candidates.push(join12(scriptDir, "..", "dashboard", "dist"));
|
|
16874
16883
|
candidates.push(join12(scriptDir, "..", "..", "dashboard", "dist"));
|
|
16875
16884
|
} catch {}
|
|
16876
16885
|
if (process.argv[1]) {
|
|
16877
|
-
const mainDir =
|
|
16886
|
+
const mainDir = dirname5(process.argv[1]);
|
|
16878
16887
|
candidates.push(join12(mainDir, "..", "dashboard", "dist"));
|
|
16879
16888
|
candidates.push(join12(mainDir, "..", "..", "dashboard", "dist"));
|
|
16880
16889
|
}
|
package/dist/index.js
CHANGED
|
@@ -6278,7 +6278,7 @@ function loadConnectorVersions() {
|
|
|
6278
6278
|
}
|
|
6279
6279
|
// src/lib/installer.ts
|
|
6280
6280
|
import { existsSync as existsSync6, cpSync, mkdirSync as mkdirSync5, readFileSync as readFileSync3, writeFileSync as writeFileSync2, readdirSync as readdirSync5, statSync as statSync2, rmSync } from "fs";
|
|
6281
|
-
import { join as join7, dirname as
|
|
6281
|
+
import { join as join7, dirname as dirname4 } from "path";
|
|
6282
6282
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
6283
6283
|
|
|
6284
6284
|
// node_modules/@hasna/cloud/dist/index.js
|
|
@@ -15807,7 +15807,7 @@ init_dotfile();
|
|
|
15807
15807
|
init_adapter();
|
|
15808
15808
|
|
|
15809
15809
|
// src/db/database.ts
|
|
15810
|
-
import { join as join5 } from "path";
|
|
15810
|
+
import { dirname as dirname3, join as join5 } from "path";
|
|
15811
15811
|
import { homedir as homedir6 } from "os";
|
|
15812
15812
|
import { mkdirSync as mkdirSync3, existsSync as existsSync4, readdirSync as readdirSync3, copyFileSync as copyFileSync2, statSync } from "fs";
|
|
15813
15813
|
function getConnectorsHome() {
|
|
@@ -15835,7 +15835,7 @@ var DB_DIR = getConnectorsHome();
|
|
|
15835
15835
|
var DB_PATH = join5(DB_DIR, "connectors.db");
|
|
15836
15836
|
|
|
15837
15837
|
// src/lib/installer.ts
|
|
15838
|
-
var __dirname2 =
|
|
15838
|
+
var __dirname2 = dirname4(fileURLToPath2(import.meta.url));
|
|
15839
15839
|
function resolveConnectorsDir() {
|
|
15840
15840
|
const fromBin = join7(__dirname2, "..", "connectors");
|
|
15841
15841
|
if (existsSync6(fromBin))
|
|
@@ -15999,10 +15999,10 @@ function removeConnector(name, targetDir = process.cwd()) {
|
|
|
15999
15999
|
}
|
|
16000
16000
|
// src/lib/runner.ts
|
|
16001
16001
|
import { existsSync as existsSync7 } from "fs";
|
|
16002
|
-
import { join as join8, dirname as
|
|
16002
|
+
import { join as join8, dirname as dirname5 } from "path";
|
|
16003
16003
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
16004
16004
|
import { spawn } from "child_process";
|
|
16005
|
-
var __dirname3 =
|
|
16005
|
+
var __dirname3 = dirname5(fileURLToPath3(import.meta.url));
|
|
16006
16006
|
function resolveConnectorsDir2() {
|
|
16007
16007
|
const fromBin = join8(__dirname3, "..", "connectors");
|
|
16008
16008
|
if (existsSync7(fromBin))
|