@hasna/connectors 1.3.35 → 1.3.37
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 +154 -222
- package/bin/mcp.js +191 -268
- package/bin/serve.js +265 -342
- package/connectors/bluesky/README.md +34 -0
- package/connectors/bluesky/package.json +41 -0
- package/connectors/bluesky/src/api/client.test.ts +122 -0
- package/connectors/bluesky/src/api/client.ts +194 -0
- package/connectors/bluesky/src/api/index.ts +108 -0
- package/connectors/bluesky/src/index.ts +17 -0
- package/connectors/bluesky/src/types/index.ts +46 -0
- package/connectors/bluesky/tsconfig.json +16 -0
- package/connectors/x/src/api/media.ts +4 -3
- package/dashboard/dist/assets/index-ClBXkNbL.css +1 -0
- package/dashboard/dist/assets/index-DvfmyAO4.js +284 -0
- package/dashboard/dist/index.html +2 -2
- package/dist/.types/connectors/bluesky/src/api/client.d.ts +73 -0
- package/dist/.types/connectors/bluesky/src/api/index.d.ts +76 -0
- package/dist/.types/connectors/bluesky/src/index.d.ts +11 -0
- package/dist/.types/connectors/bluesky/src/types/index.d.ts +33 -0
- package/dist/.types/connectors/x/src/api/client.d.ts +96 -0
- package/dist/.types/connectors/x/src/api/index.d.ts +80 -0
- package/dist/.types/connectors/x/src/api/media.d.ts +54 -0
- package/dist/.types/connectors/x/src/api/oauth.d.ts +82 -0
- package/dist/.types/connectors/x/src/api/oauth1.d.ts +68 -0
- package/dist/.types/connectors/x/src/api/tweets.d.ts +175 -0
- package/dist/.types/connectors/x/src/api/users.d.ts +127 -0
- package/dist/.types/connectors/x/src/cli/index.d.ts +2 -0
- package/dist/.types/connectors/x/src/index.d.ts +6 -0
- package/dist/.types/connectors/x/src/types/index.d.ts +156 -0
- package/dist/.types/connectors/x/src/utils/config.d.ts +99 -0
- package/dist/.types/connectors/x/src/utils/output.d.ts +8 -0
- package/dist/.types/src/social/bluesky.d.ts +65 -0
- package/dist/.types/src/social/errors.d.ts +9 -0
- package/dist/.types/src/social/index.d.ts +16 -0
- package/dist/.types/src/social/mastodon.d.ts +32 -0
- package/dist/.types/src/social/types.d.ts +73 -0
- package/dist/.types/src/social/util.d.ts +5 -0
- package/dist/.types/src/social/x.d.ts +82 -0
- package/dist/cli/components/App.d.ts +1 -2
- package/dist/cli/components/CategorySelect.d.ts +1 -2
- package/dist/cli/components/ConnectorSelect.d.ts +1 -2
- package/dist/cli/components/Header.d.ts +1 -2
- package/dist/cli/components/InstallProgress.d.ts +1 -2
- package/dist/cli/components/SearchView.d.ts +1 -2
- package/dist/index.js +123 -110
- package/dist/social/index.js +1531 -0
- package/package.json +8 -4
- package/dashboard/dist/assets/index-DJjxFlTl.css +0 -1
- package/dashboard/dist/assets/index-DNPZ58_i.js +0 -284
package/dist/index.js
CHANGED
|
@@ -15,8 +15,8 @@ var __export = (target, all) => {
|
|
|
15
15
|
};
|
|
16
16
|
|
|
17
17
|
// src/lib/registry.ts
|
|
18
|
-
import { existsSync as
|
|
19
|
-
import { join as
|
|
18
|
+
import { existsSync as existsSync9, readFileSync as readFileSync5 } from "fs";
|
|
19
|
+
import { join as join11, dirname as dirname5 } from "path";
|
|
20
20
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
21
21
|
|
|
22
22
|
// src/core/errors.ts
|
|
@@ -5764,7 +5764,7 @@ function extractGoogleError(body) {
|
|
|
5764
5764
|
// package.json
|
|
5765
5765
|
var package_default = {
|
|
5766
5766
|
name: "@hasna/connectors",
|
|
5767
|
-
version: "1.3.
|
|
5767
|
+
version: "1.3.37",
|
|
5768
5768
|
description: "Open source connector library - Install API connectors with a single command",
|
|
5769
5769
|
type: "module",
|
|
5770
5770
|
bin: {
|
|
@@ -5783,16 +5783,20 @@ var package_default = {
|
|
|
5783
5783
|
".": {
|
|
5784
5784
|
import: "./dist/index.js",
|
|
5785
5785
|
types: "./dist/index.d.ts"
|
|
5786
|
+
},
|
|
5787
|
+
"./social": {
|
|
5788
|
+
import: "./dist/social/index.js",
|
|
5789
|
+
types: "./dist/.types/src/social/index.d.ts"
|
|
5786
5790
|
}
|
|
5787
5791
|
},
|
|
5788
5792
|
main: "./dist/index.js",
|
|
5789
5793
|
types: "./dist/index.d.ts",
|
|
5790
5794
|
scripts: {
|
|
5791
|
-
build: "cd dashboard && bun run build && cd .. && bun build ./src/cli/index.tsx --outdir ./bin --target bun --external ink --external react --external chalk --external conf && bun build ./src/mcp/index.ts --outfile ./bin/mcp.js --target bun && bun build ./src/server/index.ts --outfile ./bin/serve.js --target bun && bun build ./src/index.ts --outdir ./dist --target bun && tsc --emitDeclarationOnly --outDir ./dist",
|
|
5795
|
+
build: "cd dashboard && bun run build && cd .. && bun build ./src/cli/index.tsx --outdir ./bin --target bun --external ink --external react --external chalk --external conf && bun build ./src/mcp/index.ts --outfile ./bin/mcp.js --target bun && bun build ./src/server/index.ts --outfile ./bin/serve.js --target bun && bun build ./src/index.ts --outdir ./dist --target bun && bun build ./src/social/index.ts --outfile ./dist/social/index.js --target bun && tsc --emitDeclarationOnly --outDir ./dist && tsc -p tsconfig.social.json",
|
|
5792
5796
|
"build:dashboard": "cd dashboard && bun run build",
|
|
5793
5797
|
postinstall: 'mkdir -p $HOME/.hasna/connectors 2>/dev/null || true; [ "$SKIP_DASHBOARD" = "1" ] || [ ! -f dashboard/package.json ] || [ -d dashboard/node_modules ] || (cd dashboard && bun install)',
|
|
5794
5798
|
dev: "bun run ./src/cli/index.tsx",
|
|
5795
|
-
typecheck: "tsc --noEmit",
|
|
5799
|
+
typecheck: "tsc --noEmit && tsc -p tsconfig.social.json --noEmit",
|
|
5796
5800
|
test: "bun test",
|
|
5797
5801
|
"sdk:build": "cd sdk && bun run build",
|
|
5798
5802
|
prepublishOnly: "bun run build && bun test"
|
|
@@ -5820,7 +5824,7 @@ var package_default = {
|
|
|
5820
5824
|
},
|
|
5821
5825
|
dependencies: {
|
|
5822
5826
|
"@hasna/cloud": "0.1.24",
|
|
5823
|
-
"@hasna/events": "^0.1.
|
|
5827
|
+
"@hasna/events": "^0.1.7",
|
|
5824
5828
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
5825
5829
|
chalk: "^5.3.0",
|
|
5826
5830
|
commander: "^12.1.0",
|
|
@@ -5853,7 +5857,7 @@ var package_default = {
|
|
|
5853
5857
|
|
|
5854
5858
|
// src/core/connectors/imessage.ts
|
|
5855
5859
|
import {
|
|
5856
|
-
existsSync as
|
|
5860
|
+
existsSync as existsSync7,
|
|
5857
5861
|
mkdirSync as mkdirSync5,
|
|
5858
5862
|
readFileSync as readFileSync4,
|
|
5859
5863
|
readdirSync as readdirSync6,
|
|
@@ -5861,11 +5865,11 @@ import {
|
|
|
5861
5865
|
statSync as statSync3,
|
|
5862
5866
|
writeFileSync as writeFileSync4
|
|
5863
5867
|
} from "fs";
|
|
5864
|
-
import { join as
|
|
5868
|
+
import { join as join9 } from "path";
|
|
5865
5869
|
|
|
5866
5870
|
// src/lib/connector-resolver.ts
|
|
5867
|
-
import { existsSync as
|
|
5868
|
-
import { join as
|
|
5871
|
+
import { existsSync as existsSync6, readdirSync as readdirSync5, statSync as statSync2 } from "fs";
|
|
5872
|
+
import { join as join7 } from "path";
|
|
5869
5873
|
|
|
5870
5874
|
// node_modules/@hasna/cloud/dist/index.js
|
|
5871
5875
|
import { createRequire } from "module";
|
|
@@ -5881,13 +5885,13 @@ import { join as join4, relative } from "path";
|
|
|
5881
5885
|
import { existsSync as existsSync22, mkdirSync as mkdirSync22, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
5882
5886
|
import { homedir as homedir22 } from "os";
|
|
5883
5887
|
import { join as join22 } from "path";
|
|
5884
|
-
import { readdirSync as
|
|
5885
|
-
import { join as join6 } from "path";
|
|
5886
|
-
import { homedir as homedir5 } from "os";
|
|
5887
|
-
import { homedir as homedir32 } from "os";
|
|
5888
|
+
import { readdirSync as readdirSync22, existsSync as existsSync32 } from "fs";
|
|
5888
5889
|
import { join as join32 } from "path";
|
|
5889
|
-
import {
|
|
5890
|
-
import { homedir as homedir4
|
|
5890
|
+
import { homedir as homedir32 } from "os";
|
|
5891
|
+
import { homedir as homedir4 } from "os";
|
|
5892
|
+
import { join as join42 } from "path";
|
|
5893
|
+
import { join as join6, dirname as dirname2 } from "path";
|
|
5894
|
+
import { homedir as homedir5, platform } from "os";
|
|
5891
5895
|
var __create = Object.create;
|
|
5892
5896
|
var __getProtoOf = Object.getPrototypeOf;
|
|
5893
5897
|
var __defProp2 = Object.defineProperty;
|
|
@@ -15147,7 +15151,7 @@ var exports_discover = {};
|
|
|
15147
15151
|
__export2(exports_discover, {
|
|
15148
15152
|
isSyncExcludedTable: () => isSyncExcludedTable,
|
|
15149
15153
|
getServiceDbPath: () => getServiceDbPath,
|
|
15150
|
-
discoverSyncableServices: () =>
|
|
15154
|
+
discoverSyncableServices: () => discoverSyncableServices,
|
|
15151
15155
|
discoverServices: () => discoverServices,
|
|
15152
15156
|
SYNC_EXCLUDED_TABLE_PATTERNS: () => SYNC_EXCLUDED_TABLE_PATTERNS,
|
|
15153
15157
|
KNOWN_PG_SERVICES: () => KNOWN_PG_SERVICES
|
|
@@ -15156,11 +15160,11 @@ function isSyncExcludedTable(table) {
|
|
|
15156
15160
|
return SYNC_EXCLUDED_TABLE_PATTERNS.some((p) => p.test(table));
|
|
15157
15161
|
}
|
|
15158
15162
|
function discoverServices() {
|
|
15159
|
-
const dataDir =
|
|
15160
|
-
if (!
|
|
15163
|
+
const dataDir = join32(homedir32(), ".hasna");
|
|
15164
|
+
if (!existsSync32(dataDir))
|
|
15161
15165
|
return [];
|
|
15162
15166
|
try {
|
|
15163
|
-
const entries =
|
|
15167
|
+
const entries = readdirSync22(dataDir, { withFileTypes: true });
|
|
15164
15168
|
return entries.filter((e) => {
|
|
15165
15169
|
if (!e.isDirectory())
|
|
15166
15170
|
return false;
|
|
@@ -15172,30 +15176,30 @@ function discoverServices() {
|
|
|
15172
15176
|
return [];
|
|
15173
15177
|
}
|
|
15174
15178
|
}
|
|
15175
|
-
function
|
|
15179
|
+
function discoverSyncableServices() {
|
|
15176
15180
|
const local = discoverServices();
|
|
15177
15181
|
const pgSet = new Set(KNOWN_PG_SERVICES);
|
|
15178
15182
|
return local.filter((s) => pgSet.has(s));
|
|
15179
15183
|
}
|
|
15180
15184
|
function getServiceDbPath(service) {
|
|
15181
|
-
const dataDir =
|
|
15182
|
-
if (!
|
|
15185
|
+
const dataDir = join32(homedir32(), ".hasna", service);
|
|
15186
|
+
if (!existsSync32(dataDir))
|
|
15183
15187
|
return null;
|
|
15184
15188
|
const candidates = [
|
|
15185
|
-
|
|
15186
|
-
|
|
15187
|
-
|
|
15189
|
+
join32(dataDir, `${service}.db`),
|
|
15190
|
+
join32(dataDir, "data.db"),
|
|
15191
|
+
join32(dataDir, "database.db")
|
|
15188
15192
|
];
|
|
15189
15193
|
try {
|
|
15190
|
-
const files =
|
|
15194
|
+
const files = readdirSync22(dataDir);
|
|
15191
15195
|
for (const f of files) {
|
|
15192
15196
|
if (f.endsWith(".db") && !f.endsWith("-wal") && !f.endsWith("-shm")) {
|
|
15193
|
-
candidates.push(
|
|
15197
|
+
candidates.push(join32(dataDir, f));
|
|
15194
15198
|
}
|
|
15195
15199
|
}
|
|
15196
15200
|
} catch {}
|
|
15197
15201
|
for (const p of candidates) {
|
|
15198
|
-
if (
|
|
15202
|
+
if (existsSync32(p))
|
|
15199
15203
|
return p;
|
|
15200
15204
|
}
|
|
15201
15205
|
return null;
|
|
@@ -15372,13 +15376,15 @@ class SyncProgressTracker {
|
|
|
15372
15376
|
}
|
|
15373
15377
|
}
|
|
15374
15378
|
}
|
|
15379
|
+
init_adapter();
|
|
15375
15380
|
init_config();
|
|
15376
|
-
|
|
15381
|
+
init_discover();
|
|
15382
|
+
var AUTO_SYNC_CONFIG_PATH = join42(homedir4(), ".hasna", "cloud", "config.json");
|
|
15377
15383
|
init_config();
|
|
15378
15384
|
init_adapter();
|
|
15379
15385
|
init_dotfile();
|
|
15380
15386
|
init_config();
|
|
15381
|
-
var CONFIG_DIR2 =
|
|
15387
|
+
var CONFIG_DIR2 = join6(homedir5(), ".hasna", "cloud");
|
|
15382
15388
|
init_adapter();
|
|
15383
15389
|
init_config();
|
|
15384
15390
|
init_discover();
|
|
@@ -15391,7 +15397,7 @@ init_dotfile();
|
|
|
15391
15397
|
init_adapter();
|
|
15392
15398
|
|
|
15393
15399
|
// src/db/database.ts
|
|
15394
|
-
import { dirname as dirname3, join as
|
|
15400
|
+
import { dirname as dirname3, join as join5 } from "path";
|
|
15395
15401
|
import { homedir as homedir6 } from "os";
|
|
15396
15402
|
import { mkdirSync as mkdirSync4, existsSync as existsSync5, readdirSync as readdirSync4, copyFileSync as copyFileSync2, statSync } from "fs";
|
|
15397
15403
|
function mergeDirectoryContents(sourceDir, targetDir) {
|
|
@@ -15400,8 +15406,8 @@ function mergeDirectoryContents(sourceDir, targetDir) {
|
|
|
15400
15406
|
}
|
|
15401
15407
|
mkdirSync4(targetDir, { recursive: true });
|
|
15402
15408
|
for (const entry of readdirSync4(sourceDir)) {
|
|
15403
|
-
const sourcePath =
|
|
15404
|
-
const targetPath =
|
|
15409
|
+
const sourcePath = join5(sourceDir, entry);
|
|
15410
|
+
const targetPath = join5(targetDir, entry);
|
|
15405
15411
|
try {
|
|
15406
15412
|
const sourceStat = statSync(sourcePath);
|
|
15407
15413
|
if (sourceStat.isDirectory()) {
|
|
@@ -15416,8 +15422,8 @@ function mergeDirectoryContents(sourceDir, targetDir) {
|
|
|
15416
15422
|
}
|
|
15417
15423
|
function getConnectorsHome() {
|
|
15418
15424
|
const home = process.env["HOME"] || process.env["USERPROFILE"] || homedir6();
|
|
15419
|
-
const newDir =
|
|
15420
|
-
const legacyDirs = [
|
|
15425
|
+
const newDir = join5(home, ".hasna", "connectors");
|
|
15426
|
+
const legacyDirs = [join5(home, ".connectors"), join5(home, ".connect")];
|
|
15421
15427
|
mkdirSync4(newDir, { recursive: true });
|
|
15422
15428
|
for (const legacyDir of legacyDirs) {
|
|
15423
15429
|
try {
|
|
@@ -15427,7 +15433,7 @@ function getConnectorsHome() {
|
|
|
15427
15433
|
return newDir;
|
|
15428
15434
|
}
|
|
15429
15435
|
var DB_DIR = getConnectorsHome();
|
|
15430
|
-
var DB_PATH =
|
|
15436
|
+
var DB_PATH = join5(DB_DIR, "connectors.db");
|
|
15431
15437
|
|
|
15432
15438
|
// src/lib/connector-resolver.ts
|
|
15433
15439
|
var LEGACY_CONNECTOR_PREFIX = "connect-";
|
|
@@ -15465,8 +15471,8 @@ function connectorPackageDirNames(name) {
|
|
|
15465
15471
|
function resolveConnectorPackagePath(connectorsDir, name) {
|
|
15466
15472
|
const resolution = resolveConnectorName(name);
|
|
15467
15473
|
const dirNames = connectorPackageDirNames(name);
|
|
15468
|
-
const checkedPaths = dirNames.map((dirName) =>
|
|
15469
|
-
const existingPath = checkedPaths.find((path) =>
|
|
15474
|
+
const checkedPaths = dirNames.map((dirName) => join7(connectorsDir, dirName));
|
|
15475
|
+
const existingPath = checkedPaths.find((path) => existsSync6(path)) ?? null;
|
|
15470
15476
|
const existingDirName = existingPath ? dirNames[checkedPaths.indexOf(existingPath)] : null;
|
|
15471
15477
|
return {
|
|
15472
15478
|
...resolution,
|
|
@@ -15485,10 +15491,10 @@ function getConnectorPackagePath(connectorsDir, name) {
|
|
|
15485
15491
|
function resolveConnectorConfigPaths(name, connectorsHome = getConnectorsHome()) {
|
|
15486
15492
|
const resolution = resolveConnectorName(name);
|
|
15487
15493
|
const preferredDirName = resolution.canonicalName || resolution.legacyName;
|
|
15488
|
-
const preferredPath =
|
|
15489
|
-
const legacyPath =
|
|
15494
|
+
const preferredPath = join7(connectorsHome, preferredDirName);
|
|
15495
|
+
const legacyPath = join7(connectorsHome, resolution.legacyName);
|
|
15490
15496
|
const paths = preferredPath === legacyPath ? [preferredPath] : [preferredPath, legacyPath];
|
|
15491
|
-
const existingPaths = paths.filter((path) =>
|
|
15497
|
+
const existingPaths = paths.filter((path) => existsSync6(path));
|
|
15492
15498
|
return {
|
|
15493
15499
|
...resolution,
|
|
15494
15500
|
connectorsHome,
|
|
@@ -15673,12 +15679,12 @@ function getConfigReadDirs() {
|
|
|
15673
15679
|
return getConnectorConfigReadDirs(CONNECTOR_NAME);
|
|
15674
15680
|
}
|
|
15675
15681
|
function getProfilesDir() {
|
|
15676
|
-
return
|
|
15682
|
+
return join9(getConfigDir2(), "profiles");
|
|
15677
15683
|
}
|
|
15678
15684
|
function getCurrentProfile() {
|
|
15679
15685
|
for (const configDir of getConfigReadDirs()) {
|
|
15680
|
-
const currentProfileFile =
|
|
15681
|
-
if (!
|
|
15686
|
+
const currentProfileFile = join9(configDir, "current_profile");
|
|
15687
|
+
if (!existsSync7(currentProfileFile))
|
|
15682
15688
|
continue;
|
|
15683
15689
|
try {
|
|
15684
15690
|
return readFileSync4(currentProfileFile, "utf-8").trim() || "default";
|
|
@@ -15691,16 +15697,16 @@ function getCurrentProfile() {
|
|
|
15691
15697
|
function setCurrentProfile(profile) {
|
|
15692
15698
|
const configDir = getConfigDir2();
|
|
15693
15699
|
mkdirSync5(configDir, { recursive: true });
|
|
15694
|
-
writeFileSync4(
|
|
15700
|
+
writeFileSync4(join9(configDir, "current_profile"), profile);
|
|
15695
15701
|
}
|
|
15696
15702
|
function getFlatProfilePath(profile) {
|
|
15697
|
-
return
|
|
15703
|
+
return join9(getProfilesDir(), `${profile}.json`);
|
|
15698
15704
|
}
|
|
15699
15705
|
function getFlatProfileReadPaths(profile) {
|
|
15700
|
-
return getConfigReadDirs().map((dir) =>
|
|
15706
|
+
return getConfigReadDirs().map((dir) => join9(dir, "profiles", `${profile}.json`));
|
|
15701
15707
|
}
|
|
15702
15708
|
function getDirectoryProfileReadPaths(profile) {
|
|
15703
|
-
return getConfigReadDirs().map((dir) =>
|
|
15709
|
+
return getConfigReadDirs().map((dir) => join9(dir, "profiles", profile, "config.json"));
|
|
15704
15710
|
}
|
|
15705
15711
|
function loadJsonFile(path) {
|
|
15706
15712
|
try {
|
|
@@ -15720,8 +15726,8 @@ function sanitizeProfileConfig(config) {
|
|
|
15720
15726
|
};
|
|
15721
15727
|
}
|
|
15722
15728
|
function loadProfile(profile = getCurrentProfile()) {
|
|
15723
|
-
const flatConfig = getFlatProfileReadPaths(profile).reverse().reduce((config, path) => ({ ...config, ...
|
|
15724
|
-
const directoryConfig = getDirectoryProfileReadPaths(profile).reverse().reduce((config, path) => ({ ...config, ...
|
|
15729
|
+
const flatConfig = getFlatProfileReadPaths(profile).reverse().reduce((config, path) => ({ ...config, ...existsSync7(path) ? loadJsonFile(path) : {} }), {});
|
|
15730
|
+
const directoryConfig = getDirectoryProfileReadPaths(profile).reverse().reduce((config, path) => ({ ...config, ...existsSync7(path) ? loadJsonFile(path) : {} }), {});
|
|
15725
15731
|
return sanitizeProfileConfig({
|
|
15726
15732
|
...flatConfig,
|
|
15727
15733
|
...directoryConfig
|
|
@@ -15737,17 +15743,17 @@ function profileExists(profile) {
|
|
|
15737
15743
|
if (profile === "default") {
|
|
15738
15744
|
return true;
|
|
15739
15745
|
}
|
|
15740
|
-
return getFlatProfileReadPaths(profile).some((path) =>
|
|
15746
|
+
return getFlatProfileReadPaths(profile).some((path) => existsSync7(path)) || getConfigReadDirs().some((dir) => existsSync7(join9(dir, "profiles", profile)));
|
|
15741
15747
|
}
|
|
15742
15748
|
function listProfiles3() {
|
|
15743
15749
|
const seen = new Set(["default"]);
|
|
15744
15750
|
for (const configDir of getConfigReadDirs()) {
|
|
15745
|
-
const profilesDir =
|
|
15746
|
-
if (!
|
|
15751
|
+
const profilesDir = join9(configDir, "profiles");
|
|
15752
|
+
if (!existsSync7(profilesDir))
|
|
15747
15753
|
continue;
|
|
15748
15754
|
try {
|
|
15749
15755
|
for (const entry of readdirSync6(profilesDir)) {
|
|
15750
|
-
const fullPath =
|
|
15756
|
+
const fullPath = join9(profilesDir, entry);
|
|
15751
15757
|
const stat = statSync3(fullPath);
|
|
15752
15758
|
if (stat.isDirectory()) {
|
|
15753
15759
|
seen.add(entry);
|
|
@@ -15769,11 +15775,11 @@ function createProfile(profile, config = {}) {
|
|
|
15769
15775
|
}
|
|
15770
15776
|
function clearProfile(profile = getCurrentProfile()) {
|
|
15771
15777
|
const flatPath = getFlatProfilePath(profile);
|
|
15772
|
-
const directoryPath =
|
|
15773
|
-
if (
|
|
15778
|
+
const directoryPath = join9(getProfilesDir(), profile);
|
|
15779
|
+
if (existsSync7(flatPath)) {
|
|
15774
15780
|
rmSync(flatPath);
|
|
15775
15781
|
}
|
|
15776
|
-
if (
|
|
15782
|
+
if (existsSync7(directoryPath)) {
|
|
15777
15783
|
rmSync(directoryPath, { recursive: true, force: true });
|
|
15778
15784
|
}
|
|
15779
15785
|
}
|
|
@@ -16578,19 +16584,19 @@ var imessageConnector = defineConnector({
|
|
|
16578
16584
|
});
|
|
16579
16585
|
|
|
16580
16586
|
// src/core/connectors/stripe.ts
|
|
16581
|
-
import { existsSync as
|
|
16582
|
-
import { dirname as dirname4, join as
|
|
16587
|
+
import { existsSync as existsSync8 } from "fs";
|
|
16588
|
+
import { dirname as dirname4, join as join10 } from "path";
|
|
16583
16589
|
import { fileURLToPath as fileURLToPath2, pathToFileURL as pathToFileURL2 } from "url";
|
|
16584
16590
|
var __dirname3 = dirname4(fileURLToPath2(import.meta.url));
|
|
16585
16591
|
function resolveStripeConnectorDir() {
|
|
16586
16592
|
const candidates = [
|
|
16587
|
-
|
|
16588
|
-
|
|
16589
|
-
|
|
16590
|
-
|
|
16593
|
+
join10(__dirname3, "..", "..", "..", "connectors", "stripe"),
|
|
16594
|
+
join10(__dirname3, "..", "..", "connectors", "stripe"),
|
|
16595
|
+
join10(__dirname3, "..", "connectors", "stripe"),
|
|
16596
|
+
join10(process.cwd(), "connectors", "stripe")
|
|
16591
16597
|
];
|
|
16592
16598
|
for (const candidate of candidates) {
|
|
16593
|
-
if (
|
|
16599
|
+
if (existsSync8(candidate)) {
|
|
16594
16600
|
return candidate;
|
|
16595
16601
|
}
|
|
16596
16602
|
}
|
|
@@ -16829,10 +16835,10 @@ function buildCommandHelp2(spec) {
|
|
|
16829
16835
|
var ROOT_HELP3 = buildRootHelp2(COMMAND_SPECS2);
|
|
16830
16836
|
var COMMAND_HELP3 = Object.fromEntries(COMMAND_SPECS2.map((spec) => [spec.name, buildCommandHelp2(spec)]));
|
|
16831
16837
|
async function loadStripeApiModule() {
|
|
16832
|
-
return await import(pathToFileURL2(
|
|
16838
|
+
return await import(pathToFileURL2(join10(CONNECTOR_DIR2, "src", "api", "index.ts")).href);
|
|
16833
16839
|
}
|
|
16834
16840
|
async function loadStripeConfigModule() {
|
|
16835
|
-
return await import(pathToFileURL2(
|
|
16841
|
+
return await import(pathToFileURL2(join10(CONNECTOR_DIR2, "src", "utils", "config.ts")).href);
|
|
16836
16842
|
}
|
|
16837
16843
|
function extractGlobalArgs3(args) {
|
|
16838
16844
|
const remaining = [];
|
|
@@ -23500,6 +23506,13 @@ var connectors17 = [
|
|
|
23500
23506
|
category: "Social Media",
|
|
23501
23507
|
tags: ["social", "fediverse", "decentralized"]
|
|
23502
23508
|
},
|
|
23509
|
+
{
|
|
23510
|
+
name: "bluesky",
|
|
23511
|
+
displayName: "Bluesky",
|
|
23512
|
+
description: "AT Protocol social network - posts, threads, mentions",
|
|
23513
|
+
category: "Social Media",
|
|
23514
|
+
tags: ["social", "atproto", "decentralized"]
|
|
23515
|
+
},
|
|
23503
23516
|
{
|
|
23504
23517
|
name: "brandblast",
|
|
23505
23518
|
displayName: "BrandBlast",
|
|
@@ -23732,16 +23745,16 @@ function loadConnectorVersions() {
|
|
|
23732
23745
|
versionsLoaded = true;
|
|
23733
23746
|
const thisDir = dirname5(fileURLToPath3(import.meta.url));
|
|
23734
23747
|
const candidates = [
|
|
23735
|
-
|
|
23736
|
-
|
|
23748
|
+
join11(thisDir, "..", "connectors"),
|
|
23749
|
+
join11(thisDir, "..", "..", "connectors")
|
|
23737
23750
|
];
|
|
23738
|
-
const connectorsDir = candidates.find((d) =>
|
|
23751
|
+
const connectorsDir = candidates.find((d) => existsSync9(d));
|
|
23739
23752
|
if (!connectorsDir)
|
|
23740
23753
|
return;
|
|
23741
23754
|
for (const connector of CONNECTORS) {
|
|
23742
23755
|
try {
|
|
23743
|
-
const pkgPath =
|
|
23744
|
-
if (
|
|
23756
|
+
const pkgPath = join11(getConnectorPackagePath(connectorsDir, connector.name), "package.json");
|
|
23757
|
+
if (existsSync9(pkgPath)) {
|
|
23745
23758
|
const pkg = JSON.parse(readFileSync5(pkgPath, "utf-8"));
|
|
23746
23759
|
connector.version = pkg.version || "0.0.0";
|
|
23747
23760
|
continue;
|
|
@@ -23754,16 +23767,16 @@ function loadConnectorVersions() {
|
|
|
23754
23767
|
}
|
|
23755
23768
|
}
|
|
23756
23769
|
// src/lib/installer.ts
|
|
23757
|
-
import { existsSync as
|
|
23758
|
-
import { join as
|
|
23770
|
+
import { existsSync as existsSync10, mkdirSync as mkdirSync6, readFileSync as readFileSync6, writeFileSync as writeFileSync5, readdirSync as readdirSync7, statSync as statSync4, rmSync as rmSync2 } from "fs";
|
|
23771
|
+
import { join as join12, dirname as dirname6 } from "path";
|
|
23759
23772
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
23760
23773
|
var __dirname4 = dirname6(fileURLToPath4(import.meta.url));
|
|
23761
23774
|
function resolveConnectorsDir() {
|
|
23762
|
-
const fromBin =
|
|
23763
|
-
if (
|
|
23775
|
+
const fromBin = join12(__dirname4, "..", "connectors");
|
|
23776
|
+
if (existsSync10(fromBin))
|
|
23764
23777
|
return fromBin;
|
|
23765
|
-
const fromSrc =
|
|
23766
|
-
if (
|
|
23778
|
+
const fromSrc = join12(__dirname4, "..", "..", "connectors");
|
|
23779
|
+
if (existsSync10(fromSrc))
|
|
23767
23780
|
return fromSrc;
|
|
23768
23781
|
return fromBin;
|
|
23769
23782
|
}
|
|
@@ -23772,17 +23785,17 @@ var PROJECT_CONNECTORS_DIRNAME = ".connectors";
|
|
|
23772
23785
|
var ENABLEMENT_MANIFEST_FILENAME = "manifest.json";
|
|
23773
23786
|
var ENABLEMENT_INDEX_FILENAME = "index.ts";
|
|
23774
23787
|
function getProjectConnectorsDir(targetDir) {
|
|
23775
|
-
return
|
|
23788
|
+
return join12(targetDir, PROJECT_CONNECTORS_DIRNAME);
|
|
23776
23789
|
}
|
|
23777
23790
|
function getEnablementManifestPath(targetDir) {
|
|
23778
|
-
return
|
|
23791
|
+
return join12(getProjectConnectorsDir(targetDir), ENABLEMENT_MANIFEST_FILENAME);
|
|
23779
23792
|
}
|
|
23780
23793
|
function getLegacyInstallPath(targetDir, name) {
|
|
23781
|
-
return
|
|
23794
|
+
return join12(getProjectConnectorsDir(targetDir), legacyConnectorName(name));
|
|
23782
23795
|
}
|
|
23783
23796
|
function loadEnablementManifest(targetDir) {
|
|
23784
23797
|
const manifestPath = getEnablementManifestPath(targetDir);
|
|
23785
|
-
if (!
|
|
23798
|
+
if (!existsSync10(manifestPath)) {
|
|
23786
23799
|
return null;
|
|
23787
23800
|
}
|
|
23788
23801
|
try {
|
|
@@ -23802,11 +23815,11 @@ function loadEnablementManifest(targetDir) {
|
|
|
23802
23815
|
}
|
|
23803
23816
|
function getLegacyInstalledConnectors(targetDir) {
|
|
23804
23817
|
const connectorsDir = getProjectConnectorsDir(targetDir);
|
|
23805
|
-
if (!
|
|
23818
|
+
if (!existsSync10(connectorsDir)) {
|
|
23806
23819
|
return [];
|
|
23807
23820
|
}
|
|
23808
23821
|
return readdirSync7(connectorsDir).filter((entry) => {
|
|
23809
|
-
const fullPath =
|
|
23822
|
+
const fullPath = join12(connectorsDir, entry);
|
|
23810
23823
|
return entry.startsWith("connect-") && statSync4(fullPath).isDirectory();
|
|
23811
23824
|
}).map((entry) => entry.replace("connect-", "")).sort();
|
|
23812
23825
|
}
|
|
@@ -23815,7 +23828,7 @@ function getEnabledConnectors(targetDir) {
|
|
|
23815
23828
|
return [...new Set([...manifestConnectors, ...getLegacyInstalledConnectors(targetDir)])].sort();
|
|
23816
23829
|
}
|
|
23817
23830
|
function updateConnectorsIndex(connectorsDir, connectors18) {
|
|
23818
|
-
const indexPath =
|
|
23831
|
+
const indexPath = join12(connectorsDir, ENABLEMENT_INDEX_FILENAME);
|
|
23819
23832
|
const connectorList = connectors18.map((connector) => ` "${connector}",`).join(`
|
|
23820
23833
|
`);
|
|
23821
23834
|
const content = `/**
|
|
@@ -23851,7 +23864,7 @@ function getConnectorPath(name) {
|
|
|
23851
23864
|
}
|
|
23852
23865
|
function connectorExists(name) {
|
|
23853
23866
|
const normalizedName = normalizeConnectorName(name);
|
|
23854
|
-
return hasInternalConnectorDefinition(normalizedName) ||
|
|
23867
|
+
return hasInternalConnectorDefinition(normalizedName) || existsSync10(getConnectorPath(normalizedName));
|
|
23855
23868
|
}
|
|
23856
23869
|
function installConnector(name, options = {}) {
|
|
23857
23870
|
const { targetDir = process.cwd(), overwrite = false } = options;
|
|
@@ -23884,7 +23897,7 @@ function installConnector(name, options = {}) {
|
|
|
23884
23897
|
try {
|
|
23885
23898
|
const nextEnabled = [...new Set([...installed, normalizedName])].sort();
|
|
23886
23899
|
writeEnablementManifest(targetDir, nextEnabled);
|
|
23887
|
-
if (overwrite &&
|
|
23900
|
+
if (overwrite && existsSync10(legacyInstallPath)) {
|
|
23888
23901
|
rmSync2(legacyInstallPath, { recursive: true });
|
|
23889
23902
|
}
|
|
23890
23903
|
return {
|
|
@@ -23919,8 +23932,8 @@ function parseConnectorDocs(raw) {
|
|
|
23919
23932
|
function getConnectorDocs(name) {
|
|
23920
23933
|
const normalizedName = normalizeConnectorName(name);
|
|
23921
23934
|
const connectorPath = getConnectorPath(normalizedName);
|
|
23922
|
-
const claudeMdPath =
|
|
23923
|
-
if (
|
|
23935
|
+
const claudeMdPath = join12(connectorPath, "CLAUDE.md");
|
|
23936
|
+
if (existsSync10(claudeMdPath)) {
|
|
23924
23937
|
return parseConnectorDocs(readFileSync6(claudeMdPath, "utf-8"));
|
|
23925
23938
|
}
|
|
23926
23939
|
const internalDocs = getInternalConnectorDefinition(normalizedName)?.docsMarkdown;
|
|
@@ -23965,20 +23978,20 @@ function removeConnector(name, targetDir = process.cwd()) {
|
|
|
23965
23978
|
const nextEnabled = installed.filter((connector) => connector !== normalizedName);
|
|
23966
23979
|
writeEnablementManifest(targetDir, nextEnabled);
|
|
23967
23980
|
const legacyInstallPath = getLegacyInstallPath(targetDir, normalizedName);
|
|
23968
|
-
if (
|
|
23981
|
+
if (existsSync10(legacyInstallPath)) {
|
|
23969
23982
|
rmSync2(legacyInstallPath, { recursive: true });
|
|
23970
23983
|
}
|
|
23971
23984
|
return true;
|
|
23972
23985
|
}
|
|
23973
23986
|
// src/lib/runner.ts
|
|
23974
|
-
import { existsSync as
|
|
23975
|
-
import { join as
|
|
23987
|
+
import { existsSync as existsSync12, readdirSync as readdirSync9 } from "fs";
|
|
23988
|
+
import { join as join14, dirname as dirname7 } from "path";
|
|
23976
23989
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
23977
23990
|
import { spawn } from "child_process";
|
|
23978
23991
|
|
|
23979
23992
|
// src/server/auth.ts
|
|
23980
|
-
import { existsSync as
|
|
23981
|
-
import { join as
|
|
23993
|
+
import { existsSync as existsSync11, readFileSync as readFileSync7, writeFileSync as writeFileSync6, mkdirSync as mkdirSync7, readdirSync as readdirSync8, rmSync as rmSync3, statSync as statSync5 } from "fs";
|
|
23994
|
+
import { join as join13 } from "path";
|
|
23982
23995
|
var oauthStateStore = new Map;
|
|
23983
23996
|
var GOOGLE_SCOPES = {
|
|
23984
23997
|
gmail: [
|
|
@@ -24037,8 +24050,8 @@ function getConnectorConfigReadDirs2(name) {
|
|
|
24037
24050
|
function getCurrentProfile2(name) {
|
|
24038
24051
|
name = normalizeConnectorName(name);
|
|
24039
24052
|
for (const configDir of getConnectorConfigReadDirs2(name)) {
|
|
24040
|
-
const currentProfileFile =
|
|
24041
|
-
if (
|
|
24053
|
+
const currentProfileFile = join13(configDir, "current_profile");
|
|
24054
|
+
if (existsSync11(currentProfileFile)) {
|
|
24042
24055
|
try {
|
|
24043
24056
|
return readFileSync7(currentProfileFile, "utf-8").trim() || "default";
|
|
24044
24057
|
} catch {
|
|
@@ -24051,14 +24064,14 @@ function getCurrentProfile2(name) {
|
|
|
24051
24064
|
function loadProfileConfigFromDir(configDir, profile) {
|
|
24052
24065
|
let flatConfig = {};
|
|
24053
24066
|
let dirConfig = {};
|
|
24054
|
-
const profileFile =
|
|
24055
|
-
if (
|
|
24067
|
+
const profileFile = join13(configDir, "profiles", `${profile}.json`);
|
|
24068
|
+
if (existsSync11(profileFile)) {
|
|
24056
24069
|
try {
|
|
24057
24070
|
flatConfig = JSON.parse(readFileSync7(profileFile, "utf-8"));
|
|
24058
24071
|
} catch {}
|
|
24059
24072
|
}
|
|
24060
|
-
const profileDirConfig =
|
|
24061
|
-
if (
|
|
24073
|
+
const profileDirConfig = join13(configDir, "profiles", profile, "config.json");
|
|
24074
|
+
if (existsSync11(profileDirConfig)) {
|
|
24062
24075
|
try {
|
|
24063
24076
|
dirConfig = JSON.parse(readFileSync7(profileDirConfig, "utf-8"));
|
|
24064
24077
|
} catch {}
|
|
@@ -24078,8 +24091,8 @@ function loadTokens3(name) {
|
|
|
24078
24091
|
name = normalizeConnectorName(name);
|
|
24079
24092
|
const profile = getCurrentProfile2(name);
|
|
24080
24093
|
for (const configDir of getConnectorConfigReadDirs2(name)) {
|
|
24081
|
-
const tokensFile =
|
|
24082
|
-
if (
|
|
24094
|
+
const tokensFile = join13(configDir, "profiles", profile, "tokens.json");
|
|
24095
|
+
if (existsSync11(tokensFile)) {
|
|
24083
24096
|
try {
|
|
24084
24097
|
return JSON.parse(readFileSync7(tokensFile, "utf-8"));
|
|
24085
24098
|
} catch {
|
|
@@ -24107,8 +24120,8 @@ function getEnvVars(name) {
|
|
|
24107
24120
|
function getOAuthConfig(name) {
|
|
24108
24121
|
name = normalizeConnectorName(name);
|
|
24109
24122
|
for (const configDir of getConnectorConfigReadDirs2(name)) {
|
|
24110
|
-
const credentialsFile =
|
|
24111
|
-
if (
|
|
24123
|
+
const credentialsFile = join13(configDir, "credentials.json");
|
|
24124
|
+
if (existsSync11(credentialsFile)) {
|
|
24112
24125
|
try {
|
|
24113
24126
|
const creds = JSON.parse(readFileSync7(credentialsFile, "utf-8"));
|
|
24114
24127
|
return { clientId: creds.clientId, clientSecret: creds.clientSecret };
|
|
@@ -24125,11 +24138,11 @@ function getOAuthConfig(name) {
|
|
|
24125
24138
|
// src/lib/runner.ts
|
|
24126
24139
|
var __dirname5 = dirname7(fileURLToPath5(import.meta.url));
|
|
24127
24140
|
function resolveConnectorsDir2() {
|
|
24128
|
-
const fromBin =
|
|
24129
|
-
if (
|
|
24141
|
+
const fromBin = join14(__dirname5, "..", "connectors");
|
|
24142
|
+
if (existsSync12(fromBin))
|
|
24130
24143
|
return fromBin;
|
|
24131
|
-
const fromSrc =
|
|
24132
|
-
if (
|
|
24144
|
+
const fromSrc = join14(__dirname5, "..", "..", "connectors");
|
|
24145
|
+
if (existsSync12(fromSrc))
|
|
24133
24146
|
return fromSrc;
|
|
24134
24147
|
return fromBin;
|
|
24135
24148
|
}
|
|
@@ -24205,8 +24218,8 @@ function buildEnvWithCredentials(connectorName, baseEnv) {
|
|
|
24205
24218
|
function getConnectorCliPath(name) {
|
|
24206
24219
|
const safeName = normalizeConnectorName(name).replace(/[^a-z0-9-]/g, "");
|
|
24207
24220
|
const connectorDir = getConnectorPackagePath(CONNECTORS_DIR2, safeName);
|
|
24208
|
-
const cliPath =
|
|
24209
|
-
if (
|
|
24221
|
+
const cliPath = join14(connectorDir, "src", "cli", "index.ts");
|
|
24222
|
+
if (existsSync12(cliPath))
|
|
24210
24223
|
return cliPath;
|
|
24211
24224
|
return null;
|
|
24212
24225
|
}
|