@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/bin/mcp.js
CHANGED
|
@@ -5804,7 +5804,7 @@ var package_default;
|
|
|
5804
5804
|
var init_package = __esm(() => {
|
|
5805
5805
|
package_default = {
|
|
5806
5806
|
name: "@hasna/connectors",
|
|
5807
|
-
version: "1.3.
|
|
5807
|
+
version: "1.3.37",
|
|
5808
5808
|
description: "Open source connector library - Install API connectors with a single command",
|
|
5809
5809
|
type: "module",
|
|
5810
5810
|
bin: {
|
|
@@ -5823,16 +5823,20 @@ var init_package = __esm(() => {
|
|
|
5823
5823
|
".": {
|
|
5824
5824
|
import: "./dist/index.js",
|
|
5825
5825
|
types: "./dist/index.d.ts"
|
|
5826
|
+
},
|
|
5827
|
+
"./social": {
|
|
5828
|
+
import: "./dist/social/index.js",
|
|
5829
|
+
types: "./dist/.types/src/social/index.d.ts"
|
|
5826
5830
|
}
|
|
5827
5831
|
},
|
|
5828
5832
|
main: "./dist/index.js",
|
|
5829
5833
|
types: "./dist/index.d.ts",
|
|
5830
5834
|
scripts: {
|
|
5831
|
-
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",
|
|
5835
|
+
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",
|
|
5832
5836
|
"build:dashboard": "cd dashboard && bun run build",
|
|
5833
5837
|
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)',
|
|
5834
5838
|
dev: "bun run ./src/cli/index.tsx",
|
|
5835
|
-
typecheck: "tsc --noEmit",
|
|
5839
|
+
typecheck: "tsc --noEmit && tsc -p tsconfig.social.json --noEmit",
|
|
5836
5840
|
test: "bun test",
|
|
5837
5841
|
"sdk:build": "cd sdk && bun run build",
|
|
5838
5842
|
prepublishOnly: "bun run build && bun test"
|
|
@@ -5860,7 +5864,7 @@ var init_package = __esm(() => {
|
|
|
5860
5864
|
},
|
|
5861
5865
|
dependencies: {
|
|
5862
5866
|
"@hasna/cloud": "0.1.24",
|
|
5863
|
-
"@hasna/events": "^0.1.
|
|
5867
|
+
"@hasna/events": "^0.1.7",
|
|
5864
5868
|
"@modelcontextprotocol/sdk": "^1.26.0",
|
|
5865
5869
|
chalk: "^5.3.0",
|
|
5866
5870
|
commander: "^12.1.0",
|
|
@@ -5906,14 +5910,14 @@ import { join as join4, relative } from "path";
|
|
|
5906
5910
|
import { existsSync as existsSync22, mkdirSync as mkdirSync22, readFileSync as readFileSync3, writeFileSync as writeFileSync3 } from "fs";
|
|
5907
5911
|
import { homedir as homedir22 } from "os";
|
|
5908
5912
|
import { join as join22 } from "path";
|
|
5909
|
-
import { readdirSync as
|
|
5910
|
-
import { join as join6 } from "path";
|
|
5911
|
-
import { homedir as homedir5 } from "os";
|
|
5912
|
-
import { hostname as hostname2 } from "os";
|
|
5913
|
-
import { homedir as homedir32 } from "os";
|
|
5913
|
+
import { readdirSync as readdirSync22, existsSync as existsSync32 } from "fs";
|
|
5914
5914
|
import { join as join32 } from "path";
|
|
5915
|
-
import {
|
|
5916
|
-
import {
|
|
5915
|
+
import { homedir as homedir32 } from "os";
|
|
5916
|
+
import { hostname as hostname2 } from "os";
|
|
5917
|
+
import { homedir as homedir4 } from "os";
|
|
5918
|
+
import { join as join42 } from "path";
|
|
5919
|
+
import { join as join6, dirname as dirname2 } from "path";
|
|
5920
|
+
import { homedir as homedir5, platform } from "os";
|
|
5917
5921
|
function __accessProp2(key) {
|
|
5918
5922
|
return this[key];
|
|
5919
5923
|
}
|
|
@@ -6841,11 +6845,11 @@ function isSyncExcludedTable(table) {
|
|
|
6841
6845
|
return SYNC_EXCLUDED_TABLE_PATTERNS.some((p) => p.test(table));
|
|
6842
6846
|
}
|
|
6843
6847
|
function discoverServices() {
|
|
6844
|
-
const dataDir =
|
|
6845
|
-
if (!
|
|
6848
|
+
const dataDir = join32(homedir32(), ".hasna");
|
|
6849
|
+
if (!existsSync32(dataDir))
|
|
6846
6850
|
return [];
|
|
6847
6851
|
try {
|
|
6848
|
-
const entries =
|
|
6852
|
+
const entries = readdirSync22(dataDir, { withFileTypes: true });
|
|
6849
6853
|
return entries.filter((e) => {
|
|
6850
6854
|
if (!e.isDirectory())
|
|
6851
6855
|
return false;
|
|
@@ -6857,30 +6861,30 @@ function discoverServices() {
|
|
|
6857
6861
|
return [];
|
|
6858
6862
|
}
|
|
6859
6863
|
}
|
|
6860
|
-
function
|
|
6864
|
+
function discoverSyncableServices() {
|
|
6861
6865
|
const local = discoverServices();
|
|
6862
6866
|
const pgSet = new Set(KNOWN_PG_SERVICES);
|
|
6863
6867
|
return local.filter((s) => pgSet.has(s));
|
|
6864
6868
|
}
|
|
6865
6869
|
function getServiceDbPath(service) {
|
|
6866
|
-
const dataDir =
|
|
6867
|
-
if (!
|
|
6870
|
+
const dataDir = join32(homedir32(), ".hasna", service);
|
|
6871
|
+
if (!existsSync32(dataDir))
|
|
6868
6872
|
return null;
|
|
6869
6873
|
const candidates = [
|
|
6870
|
-
|
|
6871
|
-
|
|
6872
|
-
|
|
6874
|
+
join32(dataDir, `${service}.db`),
|
|
6875
|
+
join32(dataDir, "data.db"),
|
|
6876
|
+
join32(dataDir, "database.db")
|
|
6873
6877
|
];
|
|
6874
6878
|
try {
|
|
6875
|
-
const files =
|
|
6879
|
+
const files = readdirSync22(dataDir);
|
|
6876
6880
|
for (const f of files) {
|
|
6877
6881
|
if (f.endsWith(".db") && !f.endsWith("-wal") && !f.endsWith("-shm")) {
|
|
6878
|
-
candidates.push(
|
|
6882
|
+
candidates.push(join32(dataDir, f));
|
|
6879
6883
|
}
|
|
6880
6884
|
}
|
|
6881
6885
|
} catch {}
|
|
6882
6886
|
for (const p of candidates) {
|
|
6883
|
-
if (
|
|
6887
|
+
if (existsSync32(p))
|
|
6884
6888
|
return p;
|
|
6885
6889
|
}
|
|
6886
6890
|
return null;
|
|
@@ -15845,7 +15849,7 @@ See https://www.postgresql.org/docs/current/libpq-ssl.html for libpq SSL mode de
|
|
|
15845
15849
|
__export2(exports_discover, {
|
|
15846
15850
|
isSyncExcludedTable: () => isSyncExcludedTable,
|
|
15847
15851
|
getServiceDbPath: () => getServiceDbPath,
|
|
15848
|
-
discoverSyncableServices: () =>
|
|
15852
|
+
discoverSyncableServices: () => discoverSyncableServices,
|
|
15849
15853
|
discoverServices: () => discoverServices,
|
|
15850
15854
|
SYNC_EXCLUDED_TABLE_PATTERNS: () => SYNC_EXCLUDED_TABLE_PATTERNS,
|
|
15851
15855
|
KNOWN_PG_SERVICES: () => KNOWN_PG_SERVICES
|
|
@@ -15900,13 +15904,15 @@ See https://www.postgresql.org/docs/current/libpq-ssl.html for libpq SSL mode de
|
|
|
15900
15904
|
init_config();
|
|
15901
15905
|
init_config();
|
|
15902
15906
|
init_dotfile();
|
|
15907
|
+
init_adapter();
|
|
15903
15908
|
init_config();
|
|
15904
|
-
|
|
15909
|
+
init_discover();
|
|
15910
|
+
AUTO_SYNC_CONFIG_PATH = join42(homedir4(), ".hasna", "cloud", "config.json");
|
|
15905
15911
|
init_config();
|
|
15906
15912
|
init_adapter();
|
|
15907
15913
|
init_dotfile();
|
|
15908
15914
|
init_config();
|
|
15909
|
-
CONFIG_DIR2 =
|
|
15915
|
+
CONFIG_DIR2 = join6(homedir5(), ".hasna", "cloud");
|
|
15910
15916
|
init_adapter();
|
|
15911
15917
|
init_config();
|
|
15912
15918
|
init_discover();
|
|
@@ -15928,7 +15934,7 @@ __export(exports_database, {
|
|
|
15928
15934
|
getConnectorsHome: () => getConnectorsHome,
|
|
15929
15935
|
closeDatabase: () => closeDatabase
|
|
15930
15936
|
});
|
|
15931
|
-
import { dirname as dirname3, join as
|
|
15937
|
+
import { dirname as dirname3, join as join5 } from "path";
|
|
15932
15938
|
import { homedir as homedir6 } from "os";
|
|
15933
15939
|
import { mkdirSync as mkdirSync4, existsSync as existsSync5, readdirSync as readdirSync4, copyFileSync as copyFileSync2, statSync } from "fs";
|
|
15934
15940
|
function mergeDirectoryContents(sourceDir, targetDir) {
|
|
@@ -15937,8 +15943,8 @@ function mergeDirectoryContents(sourceDir, targetDir) {
|
|
|
15937
15943
|
}
|
|
15938
15944
|
mkdirSync4(targetDir, { recursive: true });
|
|
15939
15945
|
for (const entry of readdirSync4(sourceDir)) {
|
|
15940
|
-
const sourcePath =
|
|
15941
|
-
const targetPath =
|
|
15946
|
+
const sourcePath = join5(sourceDir, entry);
|
|
15947
|
+
const targetPath = join5(targetDir, entry);
|
|
15942
15948
|
try {
|
|
15943
15949
|
const sourceStat = statSync(sourcePath);
|
|
15944
15950
|
if (sourceStat.isDirectory()) {
|
|
@@ -15953,8 +15959,8 @@ function mergeDirectoryContents(sourceDir, targetDir) {
|
|
|
15953
15959
|
}
|
|
15954
15960
|
function getConnectorsHome() {
|
|
15955
15961
|
const home = process.env["HOME"] || process.env["USERPROFILE"] || homedir6();
|
|
15956
|
-
const newDir =
|
|
15957
|
-
const legacyDirs = [
|
|
15962
|
+
const newDir = join5(home, ".hasna", "connectors");
|
|
15963
|
+
const legacyDirs = [join5(home, ".connectors"), join5(home, ".connect")];
|
|
15958
15964
|
mkdirSync4(newDir, { recursive: true });
|
|
15959
15965
|
for (const legacyDir of legacyDirs) {
|
|
15960
15966
|
try {
|
|
@@ -16102,12 +16108,12 @@ var DB_DIR, DB_PATH, _db = null, _dbPath = null;
|
|
|
16102
16108
|
var init_database = __esm(() => {
|
|
16103
16109
|
init_dist();
|
|
16104
16110
|
DB_DIR = getConnectorsHome();
|
|
16105
|
-
DB_PATH =
|
|
16111
|
+
DB_PATH = join5(DB_DIR, "connectors.db");
|
|
16106
16112
|
});
|
|
16107
16113
|
|
|
16108
16114
|
// src/lib/connector-resolver.ts
|
|
16109
|
-
import { existsSync as
|
|
16110
|
-
import { join as
|
|
16115
|
+
import { existsSync as existsSync6, readdirSync as readdirSync5, statSync as statSync2 } from "fs";
|
|
16116
|
+
import { join as join7 } from "path";
|
|
16111
16117
|
function normalizeConnectorName(name) {
|
|
16112
16118
|
const trimmed = name.trim().toLowerCase();
|
|
16113
16119
|
return trimmed.startsWith(LEGACY_CONNECTOR_PREFIX) ? trimmed.slice(LEGACY_CONNECTOR_PREFIX.length) : trimmed;
|
|
@@ -16141,8 +16147,8 @@ function connectorPackageDirNames(name) {
|
|
|
16141
16147
|
function resolveConnectorPackagePath(connectorsDir, name) {
|
|
16142
16148
|
const resolution = resolveConnectorName(name);
|
|
16143
16149
|
const dirNames = connectorPackageDirNames(name);
|
|
16144
|
-
const checkedPaths = dirNames.map((dirName) =>
|
|
16145
|
-
const existingPath = checkedPaths.find((path) =>
|
|
16150
|
+
const checkedPaths = dirNames.map((dirName) => join7(connectorsDir, dirName));
|
|
16151
|
+
const existingPath = checkedPaths.find((path) => existsSync6(path)) ?? null;
|
|
16146
16152
|
const existingDirName = existingPath ? dirNames[checkedPaths.indexOf(existingPath)] : null;
|
|
16147
16153
|
return {
|
|
16148
16154
|
...resolution,
|
|
@@ -16161,10 +16167,10 @@ function getConnectorPackagePath(connectorsDir, name) {
|
|
|
16161
16167
|
function resolveConnectorConfigPaths(name, connectorsHome = getConnectorsHome()) {
|
|
16162
16168
|
const resolution = resolveConnectorName(name);
|
|
16163
16169
|
const preferredDirName = resolution.canonicalName || resolution.legacyName;
|
|
16164
|
-
const preferredPath =
|
|
16165
|
-
const legacyPath =
|
|
16170
|
+
const preferredPath = join7(connectorsHome, preferredDirName);
|
|
16171
|
+
const legacyPath = join7(connectorsHome, resolution.legacyName);
|
|
16166
16172
|
const paths = preferredPath === legacyPath ? [preferredPath] : [preferredPath, legacyPath];
|
|
16167
|
-
const existingPaths = paths.filter((path) =>
|
|
16173
|
+
const existingPaths = paths.filter((path) => existsSync6(path));
|
|
16168
16174
|
return {
|
|
16169
16175
|
...resolution,
|
|
16170
16176
|
connectorsHome,
|
|
@@ -16189,7 +16195,7 @@ var init_connector_resolver = __esm(() => {
|
|
|
16189
16195
|
|
|
16190
16196
|
// src/core/connectors/imessage.ts
|
|
16191
16197
|
import {
|
|
16192
|
-
existsSync as
|
|
16198
|
+
existsSync as existsSync7,
|
|
16193
16199
|
mkdirSync as mkdirSync5,
|
|
16194
16200
|
readFileSync as readFileSync4,
|
|
16195
16201
|
readdirSync as readdirSync6,
|
|
@@ -16197,7 +16203,7 @@ import {
|
|
|
16197
16203
|
statSync as statSync3,
|
|
16198
16204
|
writeFileSync as writeFileSync4
|
|
16199
16205
|
} from "fs";
|
|
16200
|
-
import { join as
|
|
16206
|
+
import { join as join9 } from "path";
|
|
16201
16207
|
function buildRootHelp(specs) {
|
|
16202
16208
|
const lines = [
|
|
16203
16209
|
"Usage: connect-imessage [options] [command]",
|
|
@@ -16248,12 +16254,12 @@ function getConfigReadDirs() {
|
|
|
16248
16254
|
return getConnectorConfigReadDirs(CONNECTOR_NAME);
|
|
16249
16255
|
}
|
|
16250
16256
|
function getProfilesDir() {
|
|
16251
|
-
return
|
|
16257
|
+
return join9(getConfigDir2(), "profiles");
|
|
16252
16258
|
}
|
|
16253
16259
|
function getCurrentProfile() {
|
|
16254
16260
|
for (const configDir of getConfigReadDirs()) {
|
|
16255
|
-
const currentProfileFile =
|
|
16256
|
-
if (!
|
|
16261
|
+
const currentProfileFile = join9(configDir, "current_profile");
|
|
16262
|
+
if (!existsSync7(currentProfileFile))
|
|
16257
16263
|
continue;
|
|
16258
16264
|
try {
|
|
16259
16265
|
return readFileSync4(currentProfileFile, "utf-8").trim() || "default";
|
|
@@ -16266,16 +16272,16 @@ function getCurrentProfile() {
|
|
|
16266
16272
|
function setCurrentProfile(profile) {
|
|
16267
16273
|
const configDir = getConfigDir2();
|
|
16268
16274
|
mkdirSync5(configDir, { recursive: true });
|
|
16269
|
-
writeFileSync4(
|
|
16275
|
+
writeFileSync4(join9(configDir, "current_profile"), profile);
|
|
16270
16276
|
}
|
|
16271
16277
|
function getFlatProfilePath(profile) {
|
|
16272
|
-
return
|
|
16278
|
+
return join9(getProfilesDir(), `${profile}.json`);
|
|
16273
16279
|
}
|
|
16274
16280
|
function getFlatProfileReadPaths(profile) {
|
|
16275
|
-
return getConfigReadDirs().map((dir) =>
|
|
16281
|
+
return getConfigReadDirs().map((dir) => join9(dir, "profiles", `${profile}.json`));
|
|
16276
16282
|
}
|
|
16277
16283
|
function getDirectoryProfileReadPaths(profile) {
|
|
16278
|
-
return getConfigReadDirs().map((dir) =>
|
|
16284
|
+
return getConfigReadDirs().map((dir) => join9(dir, "profiles", profile, "config.json"));
|
|
16279
16285
|
}
|
|
16280
16286
|
function loadJsonFile(path) {
|
|
16281
16287
|
try {
|
|
@@ -16295,8 +16301,8 @@ function sanitizeProfileConfig(config2) {
|
|
|
16295
16301
|
};
|
|
16296
16302
|
}
|
|
16297
16303
|
function loadProfile(profile = getCurrentProfile()) {
|
|
16298
|
-
const flatConfig = getFlatProfileReadPaths(profile).reverse().reduce((config2, path) => ({ ...config2, ...
|
|
16299
|
-
const directoryConfig = getDirectoryProfileReadPaths(profile).reverse().reduce((config2, path) => ({ ...config2, ...
|
|
16304
|
+
const flatConfig = getFlatProfileReadPaths(profile).reverse().reduce((config2, path) => ({ ...config2, ...existsSync7(path) ? loadJsonFile(path) : {} }), {});
|
|
16305
|
+
const directoryConfig = getDirectoryProfileReadPaths(profile).reverse().reduce((config2, path) => ({ ...config2, ...existsSync7(path) ? loadJsonFile(path) : {} }), {});
|
|
16300
16306
|
return sanitizeProfileConfig({
|
|
16301
16307
|
...flatConfig,
|
|
16302
16308
|
...directoryConfig
|
|
@@ -16312,17 +16318,17 @@ function profileExists(profile) {
|
|
|
16312
16318
|
if (profile === "default") {
|
|
16313
16319
|
return true;
|
|
16314
16320
|
}
|
|
16315
|
-
return getFlatProfileReadPaths(profile).some((path) =>
|
|
16321
|
+
return getFlatProfileReadPaths(profile).some((path) => existsSync7(path)) || getConfigReadDirs().some((dir) => existsSync7(join9(dir, "profiles", profile)));
|
|
16316
16322
|
}
|
|
16317
16323
|
function listProfiles3() {
|
|
16318
16324
|
const seen = new Set(["default"]);
|
|
16319
16325
|
for (const configDir of getConfigReadDirs()) {
|
|
16320
|
-
const profilesDir =
|
|
16321
|
-
if (!
|
|
16326
|
+
const profilesDir = join9(configDir, "profiles");
|
|
16327
|
+
if (!existsSync7(profilesDir))
|
|
16322
16328
|
continue;
|
|
16323
16329
|
try {
|
|
16324
16330
|
for (const entry of readdirSync6(profilesDir)) {
|
|
16325
|
-
const fullPath =
|
|
16331
|
+
const fullPath = join9(profilesDir, entry);
|
|
16326
16332
|
const stat = statSync3(fullPath);
|
|
16327
16333
|
if (stat.isDirectory()) {
|
|
16328
16334
|
seen.add(entry);
|
|
@@ -16344,11 +16350,11 @@ function createProfile(profile, config2 = {}) {
|
|
|
16344
16350
|
}
|
|
16345
16351
|
function clearProfile(profile = getCurrentProfile()) {
|
|
16346
16352
|
const flatPath = getFlatProfilePath(profile);
|
|
16347
|
-
const directoryPath =
|
|
16348
|
-
if (
|
|
16353
|
+
const directoryPath = join9(getProfilesDir(), profile);
|
|
16354
|
+
if (existsSync7(flatPath)) {
|
|
16349
16355
|
rmSync(flatPath);
|
|
16350
16356
|
}
|
|
16351
|
-
if (
|
|
16357
|
+
if (existsSync7(directoryPath)) {
|
|
16352
16358
|
rmSync(directoryPath, { recursive: true, force: true });
|
|
16353
16359
|
}
|
|
16354
16360
|
}
|
|
@@ -17274,18 +17280,18 @@ var init_imessage = __esm(() => {
|
|
|
17274
17280
|
});
|
|
17275
17281
|
|
|
17276
17282
|
// src/core/connectors/stripe.ts
|
|
17277
|
-
import { existsSync as
|
|
17278
|
-
import { dirname as dirname4, join as
|
|
17283
|
+
import { existsSync as existsSync8 } from "fs";
|
|
17284
|
+
import { dirname as dirname4, join as join10 } from "path";
|
|
17279
17285
|
import { fileURLToPath as fileURLToPath2, pathToFileURL as pathToFileURL2 } from "url";
|
|
17280
17286
|
function resolveStripeConnectorDir() {
|
|
17281
17287
|
const candidates = [
|
|
17282
|
-
|
|
17283
|
-
|
|
17284
|
-
|
|
17285
|
-
|
|
17288
|
+
join10(__dirname3, "..", "..", "..", "connectors", "stripe"),
|
|
17289
|
+
join10(__dirname3, "..", "..", "connectors", "stripe"),
|
|
17290
|
+
join10(__dirname3, "..", "connectors", "stripe"),
|
|
17291
|
+
join10(process.cwd(), "connectors", "stripe")
|
|
17286
17292
|
];
|
|
17287
17293
|
for (const candidate of candidates) {
|
|
17288
|
-
if (
|
|
17294
|
+
if (existsSync8(candidate)) {
|
|
17289
17295
|
return candidate;
|
|
17290
17296
|
}
|
|
17291
17297
|
}
|
|
@@ -17333,10 +17339,10 @@ function buildCommandHelp2(spec) {
|
|
|
17333
17339
|
`);
|
|
17334
17340
|
}
|
|
17335
17341
|
async function loadStripeApiModule() {
|
|
17336
|
-
return await import(pathToFileURL2(
|
|
17342
|
+
return await import(pathToFileURL2(join10(CONNECTOR_DIR2, "src", "api", "index.ts")).href);
|
|
17337
17343
|
}
|
|
17338
17344
|
async function loadStripeConfigModule() {
|
|
17339
|
-
return await import(pathToFileURL2(
|
|
17345
|
+
return await import(pathToFileURL2(join10(CONNECTOR_DIR2, "src", "utils", "config.ts")).href);
|
|
17340
17346
|
}
|
|
17341
17347
|
function extractGlobalArgs3(args) {
|
|
17342
17348
|
const remaining = [];
|
|
@@ -21177,9 +21183,6 @@ var require_data = __commonJS((exports, module) => {
|
|
|
21177
21183
|
var require_utils3 = __commonJS((exports, module) => {
|
|
21178
21184
|
var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
|
|
21179
21185
|
var isIPv4 = RegExp.prototype.test.bind(/^(?:(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)\.){3}(?:25[0-5]|2[0-4]\d|1\d{2}|[1-9]\d|\d)$/u);
|
|
21180
|
-
var isHexPair = RegExp.prototype.test.bind(/^[\da-f]{2}$/iu);
|
|
21181
|
-
var isUnreserved = RegExp.prototype.test.bind(/^[\da-z\-._~]$/iu);
|
|
21182
|
-
var isPathCharacter = RegExp.prototype.test.bind(/^[\da-z\-._~!$&'()*+,;=:@/]$/iu);
|
|
21183
21186
|
function stringArrayToHexStripped(input) {
|
|
21184
21187
|
let acc = "";
|
|
21185
21188
|
let code = 0;
|
|
@@ -21373,77 +21376,27 @@ var require_utils3 = __commonJS((exports, module) => {
|
|
|
21373
21376
|
}
|
|
21374
21377
|
return output.join("");
|
|
21375
21378
|
}
|
|
21376
|
-
|
|
21377
|
-
|
|
21378
|
-
|
|
21379
|
-
|
|
21380
|
-
const re = isIP ? HOST_DELIM_NO_COLON_RE : HOST_DELIM_RE;
|
|
21381
|
-
re.lastIndex = 0;
|
|
21382
|
-
return host.replace(re, (ch) => HOST_DELIMS[ch]);
|
|
21383
|
-
}
|
|
21384
|
-
function normalizePercentEncoding(input, decodeUnreserved = false) {
|
|
21385
|
-
if (input.indexOf("%") === -1) {
|
|
21386
|
-
return input;
|
|
21379
|
+
function normalizeComponentEncoding(component, esc2) {
|
|
21380
|
+
const func = esc2 !== true ? escape : unescape;
|
|
21381
|
+
if (component.scheme !== undefined) {
|
|
21382
|
+
component.scheme = func(component.scheme);
|
|
21387
21383
|
}
|
|
21388
|
-
|
|
21389
|
-
|
|
21390
|
-
if (input[i] === "%" && i + 2 < input.length) {
|
|
21391
|
-
const hex = input.slice(i + 1, i + 3);
|
|
21392
|
-
if (isHexPair(hex)) {
|
|
21393
|
-
const normalizedHex = hex.toUpperCase();
|
|
21394
|
-
const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
|
|
21395
|
-
if (decodeUnreserved && isUnreserved(decoded)) {
|
|
21396
|
-
output += decoded;
|
|
21397
|
-
} else {
|
|
21398
|
-
output += "%" + normalizedHex;
|
|
21399
|
-
}
|
|
21400
|
-
i += 2;
|
|
21401
|
-
continue;
|
|
21402
|
-
}
|
|
21403
|
-
}
|
|
21404
|
-
output += input[i];
|
|
21384
|
+
if (component.userinfo !== undefined) {
|
|
21385
|
+
component.userinfo = func(component.userinfo);
|
|
21405
21386
|
}
|
|
21406
|
-
|
|
21407
|
-
|
|
21408
|
-
function normalizePathEncoding(input) {
|
|
21409
|
-
let output = "";
|
|
21410
|
-
for (let i = 0;i < input.length; i++) {
|
|
21411
|
-
if (input[i] === "%" && i + 2 < input.length) {
|
|
21412
|
-
const hex = input.slice(i + 1, i + 3);
|
|
21413
|
-
if (isHexPair(hex)) {
|
|
21414
|
-
const normalizedHex = hex.toUpperCase();
|
|
21415
|
-
const decoded = String.fromCharCode(parseInt(normalizedHex, 16));
|
|
21416
|
-
if (decoded !== "." && isUnreserved(decoded)) {
|
|
21417
|
-
output += decoded;
|
|
21418
|
-
} else {
|
|
21419
|
-
output += "%" + normalizedHex;
|
|
21420
|
-
}
|
|
21421
|
-
i += 2;
|
|
21422
|
-
continue;
|
|
21423
|
-
}
|
|
21424
|
-
}
|
|
21425
|
-
if (isPathCharacter(input[i])) {
|
|
21426
|
-
output += input[i];
|
|
21427
|
-
} else {
|
|
21428
|
-
output += escape(input[i]);
|
|
21429
|
-
}
|
|
21387
|
+
if (component.host !== undefined) {
|
|
21388
|
+
component.host = func(component.host);
|
|
21430
21389
|
}
|
|
21431
|
-
|
|
21432
|
-
|
|
21433
|
-
function escapePreservingEscapes(input) {
|
|
21434
|
-
let output = "";
|
|
21435
|
-
for (let i = 0;i < input.length; i++) {
|
|
21436
|
-
if (input[i] === "%" && i + 2 < input.length) {
|
|
21437
|
-
const hex = input.slice(i + 1, i + 3);
|
|
21438
|
-
if (isHexPair(hex)) {
|
|
21439
|
-
output += "%" + hex.toUpperCase();
|
|
21440
|
-
i += 2;
|
|
21441
|
-
continue;
|
|
21442
|
-
}
|
|
21443
|
-
}
|
|
21444
|
-
output += escape(input[i]);
|
|
21390
|
+
if (component.path !== undefined) {
|
|
21391
|
+
component.path = func(component.path);
|
|
21445
21392
|
}
|
|
21446
|
-
|
|
21393
|
+
if (component.query !== undefined) {
|
|
21394
|
+
component.query = func(component.query);
|
|
21395
|
+
}
|
|
21396
|
+
if (component.fragment !== undefined) {
|
|
21397
|
+
component.fragment = func(component.fragment);
|
|
21398
|
+
}
|
|
21399
|
+
return component;
|
|
21447
21400
|
}
|
|
21448
21401
|
function recomposeAuthority(component) {
|
|
21449
21402
|
const uriTokens = [];
|
|
@@ -21458,7 +21411,7 @@ var require_utils3 = __commonJS((exports, module) => {
|
|
|
21458
21411
|
if (ipV6res.isIPV6 === true) {
|
|
21459
21412
|
host = `[${ipV6res.escapedHost}]`;
|
|
21460
21413
|
} else {
|
|
21461
|
-
host =
|
|
21414
|
+
host = component.host;
|
|
21462
21415
|
}
|
|
21463
21416
|
}
|
|
21464
21417
|
uriTokens.push(host);
|
|
@@ -21472,10 +21425,7 @@ var require_utils3 = __commonJS((exports, module) => {
|
|
|
21472
21425
|
module.exports = {
|
|
21473
21426
|
nonSimpleDomain,
|
|
21474
21427
|
recomposeAuthority,
|
|
21475
|
-
|
|
21476
|
-
normalizePercentEncoding,
|
|
21477
|
-
normalizePathEncoding,
|
|
21478
|
-
escapePreservingEscapes,
|
|
21428
|
+
normalizeComponentEncoding,
|
|
21479
21429
|
removeDotSegments,
|
|
21480
21430
|
isIPv4,
|
|
21481
21431
|
isUUID,
|
|
@@ -21660,11 +21610,11 @@ var require_schemes = __commonJS((exports, module) => {
|
|
|
21660
21610
|
|
|
21661
21611
|
// node_modules/fast-uri/index.js
|
|
21662
21612
|
var require_fast_uri = __commonJS((exports, module) => {
|
|
21663
|
-
var { normalizeIPv6, removeDotSegments, recomposeAuthority,
|
|
21613
|
+
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = require_utils3();
|
|
21664
21614
|
var { SCHEMES, getSchemeHandler } = require_schemes();
|
|
21665
21615
|
function normalize(uri, options) {
|
|
21666
21616
|
if (typeof uri === "string") {
|
|
21667
|
-
uri =
|
|
21617
|
+
uri = serialize(parse6(uri, options), options);
|
|
21668
21618
|
} else if (typeof uri === "object") {
|
|
21669
21619
|
uri = parse6(serialize(uri, options), options);
|
|
21670
21620
|
}
|
|
@@ -21730,9 +21680,19 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
21730
21680
|
return target;
|
|
21731
21681
|
}
|
|
21732
21682
|
function equal(uriA, uriB, options) {
|
|
21733
|
-
|
|
21734
|
-
|
|
21735
|
-
|
|
21683
|
+
if (typeof uriA === "string") {
|
|
21684
|
+
uriA = unescape(uriA);
|
|
21685
|
+
uriA = serialize(normalizeComponentEncoding(parse6(uriA, options), true), { ...options, skipEscape: true });
|
|
21686
|
+
} else if (typeof uriA === "object") {
|
|
21687
|
+
uriA = serialize(normalizeComponentEncoding(uriA, true), { ...options, skipEscape: true });
|
|
21688
|
+
}
|
|
21689
|
+
if (typeof uriB === "string") {
|
|
21690
|
+
uriB = unescape(uriB);
|
|
21691
|
+
uriB = serialize(normalizeComponentEncoding(parse6(uriB, options), true), { ...options, skipEscape: true });
|
|
21692
|
+
} else if (typeof uriB === "object") {
|
|
21693
|
+
uriB = serialize(normalizeComponentEncoding(uriB, true), { ...options, skipEscape: true });
|
|
21694
|
+
}
|
|
21695
|
+
return uriA.toLowerCase() === uriB.toLowerCase();
|
|
21736
21696
|
}
|
|
21737
21697
|
function serialize(cmpts, opts) {
|
|
21738
21698
|
const component = {
|
|
@@ -21758,12 +21718,12 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
21758
21718
|
schemeHandler.serialize(component, options);
|
|
21759
21719
|
if (component.path !== undefined) {
|
|
21760
21720
|
if (!options.skipEscape) {
|
|
21761
|
-
component.path =
|
|
21721
|
+
component.path = escape(component.path);
|
|
21762
21722
|
if (component.scheme !== undefined) {
|
|
21763
21723
|
component.path = component.path.split("%3A").join(":");
|
|
21764
21724
|
}
|
|
21765
21725
|
} else {
|
|
21766
|
-
component.path =
|
|
21726
|
+
component.path = unescape(component.path);
|
|
21767
21727
|
}
|
|
21768
21728
|
}
|
|
21769
21729
|
if (options.reference !== "suffix" && component.scheme) {
|
|
@@ -21798,16 +21758,7 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
21798
21758
|
return uriTokens.join("");
|
|
21799
21759
|
}
|
|
21800
21760
|
var URI_PARSE = /^(?:([^#/:?]+):)?(?:\/\/((?:([^#/?@]*)@)?(\[[^#/?\]]+\]|[^#/:?]*)(?::(\d*))?))?([^#?]*)(?:\?([^#]*))?(?:#((?:.|[\n\r])*))?/u;
|
|
21801
|
-
function
|
|
21802
|
-
if (matches[2] !== undefined && parsed.path && parsed.path[0] !== "/") {
|
|
21803
|
-
return 'URI path must start with "/" when authority is present.';
|
|
21804
|
-
}
|
|
21805
|
-
if (typeof parsed.port === "number" && (parsed.port < 0 || parsed.port > 65535)) {
|
|
21806
|
-
return "URI port is malformed.";
|
|
21807
|
-
}
|
|
21808
|
-
return;
|
|
21809
|
-
}
|
|
21810
|
-
function parseWithStatus(uri, opts) {
|
|
21761
|
+
function parse6(uri, opts) {
|
|
21811
21762
|
const options = Object.assign({}, opts);
|
|
21812
21763
|
const parsed = {
|
|
21813
21764
|
scheme: undefined,
|
|
@@ -21818,7 +21769,6 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
21818
21769
|
query: undefined,
|
|
21819
21770
|
fragment: undefined
|
|
21820
21771
|
};
|
|
21821
|
-
let malformedAuthorityOrPort = false;
|
|
21822
21772
|
let isIP = false;
|
|
21823
21773
|
if (options.reference === "suffix") {
|
|
21824
21774
|
if (options.scheme) {
|
|
@@ -21839,11 +21789,6 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
21839
21789
|
if (isNaN(parsed.port)) {
|
|
21840
21790
|
parsed.port = matches[5];
|
|
21841
21791
|
}
|
|
21842
|
-
const parseError = getParseError(parsed, matches);
|
|
21843
|
-
if (parseError !== undefined) {
|
|
21844
|
-
parsed.error = parsed.error || parseError;
|
|
21845
|
-
malformedAuthorityOrPort = true;
|
|
21846
|
-
}
|
|
21847
21792
|
if (parsed.host) {
|
|
21848
21793
|
const ipv4result = isIPv4(parsed.host);
|
|
21849
21794
|
if (ipv4result === false) {
|
|
@@ -21882,18 +21827,14 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
21882
21827
|
parsed.scheme = unescape(parsed.scheme);
|
|
21883
21828
|
}
|
|
21884
21829
|
if (parsed.host !== undefined) {
|
|
21885
|
-
parsed.host =
|
|
21830
|
+
parsed.host = unescape(parsed.host);
|
|
21886
21831
|
}
|
|
21887
21832
|
}
|
|
21888
21833
|
if (parsed.path) {
|
|
21889
|
-
parsed.path =
|
|
21834
|
+
parsed.path = escape(unescape(parsed.path));
|
|
21890
21835
|
}
|
|
21891
21836
|
if (parsed.fragment) {
|
|
21892
|
-
|
|
21893
|
-
parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
|
|
21894
|
-
} catch {
|
|
21895
|
-
parsed.error = parsed.error || "URI malformed";
|
|
21896
|
-
}
|
|
21837
|
+
parsed.fragment = encodeURI(decodeURIComponent(parsed.fragment));
|
|
21897
21838
|
}
|
|
21898
21839
|
}
|
|
21899
21840
|
if (schemeHandler && schemeHandler.parse) {
|
|
@@ -21902,29 +21843,7 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
21902
21843
|
} else {
|
|
21903
21844
|
parsed.error = parsed.error || "URI can not be parsed.";
|
|
21904
21845
|
}
|
|
21905
|
-
return
|
|
21906
|
-
}
|
|
21907
|
-
function parse6(uri, opts) {
|
|
21908
|
-
return parseWithStatus(uri, opts).parsed;
|
|
21909
|
-
}
|
|
21910
|
-
function normalizeString(uri, opts) {
|
|
21911
|
-
return normalizeStringWithStatus(uri, opts).normalized;
|
|
21912
|
-
}
|
|
21913
|
-
function normalizeStringWithStatus(uri, opts) {
|
|
21914
|
-
const { parsed, malformedAuthorityOrPort } = parseWithStatus(uri, opts);
|
|
21915
|
-
return {
|
|
21916
|
-
normalized: malformedAuthorityOrPort ? uri : serialize(parsed, opts),
|
|
21917
|
-
malformedAuthorityOrPort
|
|
21918
|
-
};
|
|
21919
|
-
}
|
|
21920
|
-
function normalizeComparableURI(uri, opts) {
|
|
21921
|
-
if (typeof uri === "string") {
|
|
21922
|
-
const { normalized, malformedAuthorityOrPort } = normalizeStringWithStatus(uri, opts);
|
|
21923
|
-
return malformedAuthorityOrPort ? undefined : normalized;
|
|
21924
|
-
}
|
|
21925
|
-
if (typeof uri === "object") {
|
|
21926
|
-
return serialize(uri, opts);
|
|
21927
|
-
}
|
|
21846
|
+
return parsed;
|
|
21928
21847
|
}
|
|
21929
21848
|
var fastUri = {
|
|
21930
21849
|
SCHEMES,
|
|
@@ -22059,7 +21978,7 @@ var require_core = __commonJS((exports) => {
|
|
|
22059
21978
|
constructor(opts = {}) {
|
|
22060
21979
|
this.schemas = {};
|
|
22061
21980
|
this.refs = {};
|
|
22062
|
-
this.formats =
|
|
21981
|
+
this.formats = {};
|
|
22063
21982
|
this._compilations = new Set;
|
|
22064
21983
|
this._loading = {};
|
|
22065
21984
|
this._cache = new Map;
|
|
@@ -24741,14 +24660,14 @@ __export(exports_llm, {
|
|
|
24741
24660
|
PROVIDER_DEFAULTS: () => PROVIDER_DEFAULTS,
|
|
24742
24661
|
LLMClient: () => LLMClient
|
|
24743
24662
|
});
|
|
24744
|
-
import { existsSync as
|
|
24745
|
-
import { join as
|
|
24663
|
+
import { existsSync as existsSync10, readFileSync as readFileSync6, writeFileSync as writeFileSync5, mkdirSync as mkdirSync6 } from "fs";
|
|
24664
|
+
import { join as join12 } from "path";
|
|
24746
24665
|
function getLlmConfigPath() {
|
|
24747
|
-
return
|
|
24666
|
+
return join12(getConnectorsHome(), "llm.json");
|
|
24748
24667
|
}
|
|
24749
24668
|
function getLlmConfig() {
|
|
24750
24669
|
const path = getLlmConfigPath();
|
|
24751
|
-
if (!
|
|
24670
|
+
if (!existsSync10(path))
|
|
24752
24671
|
return null;
|
|
24753
24672
|
try {
|
|
24754
24673
|
return JSON.parse(readFileSync6(path, "utf-8"));
|
|
@@ -24878,30 +24797,30 @@ __export(exports_installer, {
|
|
|
24878
24797
|
getConnectorDocs: () => getConnectorDocs,
|
|
24879
24798
|
connectorExists: () => connectorExists
|
|
24880
24799
|
});
|
|
24881
|
-
import { existsSync as
|
|
24882
|
-
import { join as
|
|
24800
|
+
import { existsSync as existsSync11, mkdirSync as mkdirSync7, readFileSync as readFileSync7, writeFileSync as writeFileSync6, readdirSync as readdirSync7, statSync as statSync4, rmSync as rmSync2 } from "fs";
|
|
24801
|
+
import { join as join13, dirname as dirname6 } from "path";
|
|
24883
24802
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
24884
24803
|
function resolveConnectorsDir() {
|
|
24885
|
-
const fromBin =
|
|
24886
|
-
if (
|
|
24804
|
+
const fromBin = join13(__dirname4, "..", "connectors");
|
|
24805
|
+
if (existsSync11(fromBin))
|
|
24887
24806
|
return fromBin;
|
|
24888
|
-
const fromSrc =
|
|
24889
|
-
if (
|
|
24807
|
+
const fromSrc = join13(__dirname4, "..", "..", "connectors");
|
|
24808
|
+
if (existsSync11(fromSrc))
|
|
24890
24809
|
return fromSrc;
|
|
24891
24810
|
return fromBin;
|
|
24892
24811
|
}
|
|
24893
24812
|
function getProjectConnectorsDir(targetDir) {
|
|
24894
|
-
return
|
|
24813
|
+
return join13(targetDir, PROJECT_CONNECTORS_DIRNAME);
|
|
24895
24814
|
}
|
|
24896
24815
|
function getEnablementManifestPath(targetDir) {
|
|
24897
|
-
return
|
|
24816
|
+
return join13(getProjectConnectorsDir(targetDir), ENABLEMENT_MANIFEST_FILENAME);
|
|
24898
24817
|
}
|
|
24899
24818
|
function getLegacyInstallPath(targetDir, name) {
|
|
24900
|
-
return
|
|
24819
|
+
return join13(getProjectConnectorsDir(targetDir), legacyConnectorName(name));
|
|
24901
24820
|
}
|
|
24902
24821
|
function loadEnablementManifest(targetDir) {
|
|
24903
24822
|
const manifestPath = getEnablementManifestPath(targetDir);
|
|
24904
|
-
if (!
|
|
24823
|
+
if (!existsSync11(manifestPath)) {
|
|
24905
24824
|
return null;
|
|
24906
24825
|
}
|
|
24907
24826
|
try {
|
|
@@ -24921,11 +24840,11 @@ function loadEnablementManifest(targetDir) {
|
|
|
24921
24840
|
}
|
|
24922
24841
|
function getLegacyInstalledConnectors(targetDir) {
|
|
24923
24842
|
const connectorsDir = getProjectConnectorsDir(targetDir);
|
|
24924
|
-
if (!
|
|
24843
|
+
if (!existsSync11(connectorsDir)) {
|
|
24925
24844
|
return [];
|
|
24926
24845
|
}
|
|
24927
24846
|
return readdirSync7(connectorsDir).filter((entry) => {
|
|
24928
|
-
const fullPath =
|
|
24847
|
+
const fullPath = join13(connectorsDir, entry);
|
|
24929
24848
|
return entry.startsWith("connect-") && statSync4(fullPath).isDirectory();
|
|
24930
24849
|
}).map((entry) => entry.replace("connect-", "")).sort();
|
|
24931
24850
|
}
|
|
@@ -24934,7 +24853,7 @@ function getEnabledConnectors(targetDir) {
|
|
|
24934
24853
|
return [...new Set([...manifestConnectors, ...getLegacyInstalledConnectors(targetDir)])].sort();
|
|
24935
24854
|
}
|
|
24936
24855
|
function updateConnectorsIndex(connectorsDir, connectors18) {
|
|
24937
|
-
const indexPath =
|
|
24856
|
+
const indexPath = join13(connectorsDir, ENABLEMENT_INDEX_FILENAME);
|
|
24938
24857
|
const connectorList = connectors18.map((connector) => ` "${connector}",`).join(`
|
|
24939
24858
|
`);
|
|
24940
24859
|
const content = `/**
|
|
@@ -24970,7 +24889,7 @@ function getConnectorPath(name) {
|
|
|
24970
24889
|
}
|
|
24971
24890
|
function connectorExists(name) {
|
|
24972
24891
|
const normalizedName = normalizeConnectorName(name);
|
|
24973
|
-
return hasInternalConnectorDefinition(normalizedName) ||
|
|
24892
|
+
return hasInternalConnectorDefinition(normalizedName) || existsSync11(getConnectorPath(normalizedName));
|
|
24974
24893
|
}
|
|
24975
24894
|
function installConnector(name, options = {}) {
|
|
24976
24895
|
const { targetDir = process.cwd(), overwrite = false } = options;
|
|
@@ -25003,7 +24922,7 @@ function installConnector(name, options = {}) {
|
|
|
25003
24922
|
try {
|
|
25004
24923
|
const nextEnabled = [...new Set([...installed, normalizedName])].sort();
|
|
25005
24924
|
writeEnablementManifest(targetDir, nextEnabled);
|
|
25006
|
-
if (overwrite &&
|
|
24925
|
+
if (overwrite && existsSync11(legacyInstallPath)) {
|
|
25007
24926
|
rmSync2(legacyInstallPath, { recursive: true });
|
|
25008
24927
|
}
|
|
25009
24928
|
return {
|
|
@@ -25038,8 +24957,8 @@ function parseConnectorDocs(raw) {
|
|
|
25038
24957
|
function getConnectorDocs(name) {
|
|
25039
24958
|
const normalizedName = normalizeConnectorName(name);
|
|
25040
24959
|
const connectorPath = getConnectorPath(normalizedName);
|
|
25041
|
-
const claudeMdPath =
|
|
25042
|
-
if (
|
|
24960
|
+
const claudeMdPath = join13(connectorPath, "CLAUDE.md");
|
|
24961
|
+
if (existsSync11(claudeMdPath)) {
|
|
25043
24962
|
return parseConnectorDocs(readFileSync7(claudeMdPath, "utf-8"));
|
|
25044
24963
|
}
|
|
25045
24964
|
const internalDocs = getInternalConnectorDefinition(normalizedName)?.docsMarkdown;
|
|
@@ -25084,7 +25003,7 @@ function removeConnector(name, targetDir = process.cwd()) {
|
|
|
25084
25003
|
const nextEnabled = installed.filter((connector) => connector !== normalizedName);
|
|
25085
25004
|
writeEnablementManifest(targetDir, nextEnabled);
|
|
25086
25005
|
const legacyInstallPath = getLegacyInstallPath(targetDir, normalizedName);
|
|
25087
|
-
if (
|
|
25006
|
+
if (existsSync11(legacyInstallPath)) {
|
|
25088
25007
|
rmSync2(legacyInstallPath, { recursive: true });
|
|
25089
25008
|
}
|
|
25090
25009
|
return true;
|
|
@@ -25167,7 +25086,7 @@ var init_usage = __esm(() => {
|
|
|
25167
25086
|
});
|
|
25168
25087
|
|
|
25169
25088
|
// src/lib/lock.ts
|
|
25170
|
-
import { openSync, closeSync, unlinkSync, existsSync as
|
|
25089
|
+
import { openSync, closeSync, unlinkSync, existsSync as existsSync12, statSync as statSync5 } from "fs";
|
|
25171
25090
|
import { mkdirSync as mkdirSync8 } from "fs";
|
|
25172
25091
|
function lockPath(connector) {
|
|
25173
25092
|
const dir = getConnectorConfigDir(connector);
|
|
@@ -25183,7 +25102,7 @@ function isStale(path) {
|
|
|
25183
25102
|
}
|
|
25184
25103
|
}
|
|
25185
25104
|
function tryAcquire(path) {
|
|
25186
|
-
if (
|
|
25105
|
+
if (existsSync12(path) && isStale(path)) {
|
|
25187
25106
|
try {
|
|
25188
25107
|
unlinkSync(path);
|
|
25189
25108
|
} catch {}
|
|
@@ -25233,8 +25152,8 @@ var init_lock = __esm(() => {
|
|
|
25233
25152
|
});
|
|
25234
25153
|
|
|
25235
25154
|
// src/server/auth.ts
|
|
25236
|
-
import { existsSync as
|
|
25237
|
-
import { join as
|
|
25155
|
+
import { existsSync as existsSync13, readFileSync as readFileSync8, writeFileSync as writeFileSync7, mkdirSync as mkdirSync9, readdirSync as readdirSync8, rmSync as rmSync3, statSync as statSync6 } from "fs";
|
|
25156
|
+
import { join as join14 } from "path";
|
|
25238
25157
|
function getAuthType(name) {
|
|
25239
25158
|
name = normalizeConnectorName(name);
|
|
25240
25159
|
const docs = getConnectorDocs(name);
|
|
@@ -25258,8 +25177,8 @@ function getConnectorConfigReadDirs2(name) {
|
|
|
25258
25177
|
function getCurrentProfile2(name) {
|
|
25259
25178
|
name = normalizeConnectorName(name);
|
|
25260
25179
|
for (const configDir of getConnectorConfigReadDirs2(name)) {
|
|
25261
|
-
const currentProfileFile =
|
|
25262
|
-
if (
|
|
25180
|
+
const currentProfileFile = join14(configDir, "current_profile");
|
|
25181
|
+
if (existsSync13(currentProfileFile)) {
|
|
25263
25182
|
try {
|
|
25264
25183
|
return readFileSync8(currentProfileFile, "utf-8").trim() || "default";
|
|
25265
25184
|
} catch {
|
|
@@ -25272,14 +25191,14 @@ function getCurrentProfile2(name) {
|
|
|
25272
25191
|
function loadProfileConfigFromDir(configDir, profile) {
|
|
25273
25192
|
let flatConfig = {};
|
|
25274
25193
|
let dirConfig = {};
|
|
25275
|
-
const profileFile =
|
|
25276
|
-
if (
|
|
25194
|
+
const profileFile = join14(configDir, "profiles", `${profile}.json`);
|
|
25195
|
+
if (existsSync13(profileFile)) {
|
|
25277
25196
|
try {
|
|
25278
25197
|
flatConfig = JSON.parse(readFileSync8(profileFile, "utf-8"));
|
|
25279
25198
|
} catch {}
|
|
25280
25199
|
}
|
|
25281
|
-
const profileDirConfig =
|
|
25282
|
-
if (
|
|
25200
|
+
const profileDirConfig = join14(configDir, "profiles", profile, "config.json");
|
|
25201
|
+
if (existsSync13(profileDirConfig)) {
|
|
25283
25202
|
try {
|
|
25284
25203
|
dirConfig = JSON.parse(readFileSync8(profileDirConfig, "utf-8"));
|
|
25285
25204
|
} catch {}
|
|
@@ -25299,8 +25218,8 @@ function loadTokens3(name) {
|
|
|
25299
25218
|
name = normalizeConnectorName(name);
|
|
25300
25219
|
const profile = getCurrentProfile2(name);
|
|
25301
25220
|
for (const configDir of getConnectorConfigReadDirs2(name)) {
|
|
25302
|
-
const tokensFile =
|
|
25303
|
-
if (
|
|
25221
|
+
const tokensFile = join14(configDir, "profiles", profile, "tokens.json");
|
|
25222
|
+
if (existsSync13(tokensFile)) {
|
|
25304
25223
|
try {
|
|
25305
25224
|
return JSON.parse(readFileSync8(tokensFile, "utf-8"));
|
|
25306
25225
|
} catch {
|
|
@@ -25395,10 +25314,10 @@ function _saveApiKey(name, key, field) {
|
|
|
25395
25314
|
const profile = getCurrentProfile2(name);
|
|
25396
25315
|
const keyField = field || guessKeyField(name);
|
|
25397
25316
|
if (keyField === "clientId" || keyField === "clientSecret") {
|
|
25398
|
-
const credentialsFile =
|
|
25317
|
+
const credentialsFile = join14(configDir, "credentials.json");
|
|
25399
25318
|
mkdirSync9(configDir, { recursive: true });
|
|
25400
25319
|
let creds = {};
|
|
25401
|
-
if (
|
|
25320
|
+
if (existsSync13(credentialsFile)) {
|
|
25402
25321
|
try {
|
|
25403
25322
|
creds = JSON.parse(readFileSync8(credentialsFile, "utf-8"));
|
|
25404
25323
|
} catch {}
|
|
@@ -25407,9 +25326,9 @@ function _saveApiKey(name, key, field) {
|
|
|
25407
25326
|
writeFileSync7(credentialsFile, JSON.stringify(creds, null, 2));
|
|
25408
25327
|
return;
|
|
25409
25328
|
}
|
|
25410
|
-
const profileFile =
|
|
25411
|
-
const profileDir =
|
|
25412
|
-
if (
|
|
25329
|
+
const profileFile = join14(configDir, "profiles", `${profile}.json`);
|
|
25330
|
+
const profileDir = join14(configDir, "profiles", profile);
|
|
25331
|
+
if (existsSync13(profileFile)) {
|
|
25413
25332
|
let config2 = {};
|
|
25414
25333
|
try {
|
|
25415
25334
|
config2 = JSON.parse(readFileSync8(profileFile, "utf-8"));
|
|
@@ -25418,10 +25337,10 @@ function _saveApiKey(name, key, field) {
|
|
|
25418
25337
|
writeFileSync7(profileFile, JSON.stringify(config2, null, 2));
|
|
25419
25338
|
return;
|
|
25420
25339
|
}
|
|
25421
|
-
if (
|
|
25422
|
-
const configFile =
|
|
25340
|
+
if (existsSync13(profileDir)) {
|
|
25341
|
+
const configFile = join14(profileDir, "config.json");
|
|
25423
25342
|
let config2 = {};
|
|
25424
|
-
if (
|
|
25343
|
+
if (existsSync13(configFile)) {
|
|
25425
25344
|
try {
|
|
25426
25345
|
config2 = JSON.parse(readFileSync8(configFile, "utf-8"));
|
|
25427
25346
|
} catch {}
|
|
@@ -25431,7 +25350,7 @@ function _saveApiKey(name, key, field) {
|
|
|
25431
25350
|
return;
|
|
25432
25351
|
}
|
|
25433
25352
|
mkdirSync9(profileDir, { recursive: true });
|
|
25434
|
-
writeFileSync7(
|
|
25353
|
+
writeFileSync7(join14(profileDir, "config.json"), JSON.stringify({ [keyField]: key }, null, 2));
|
|
25435
25354
|
}
|
|
25436
25355
|
function guessKeyField(name) {
|
|
25437
25356
|
name = normalizeConnectorName(name);
|
|
@@ -25451,8 +25370,8 @@ function guessKeyField(name) {
|
|
|
25451
25370
|
function getOAuthConfig(name) {
|
|
25452
25371
|
name = normalizeConnectorName(name);
|
|
25453
25372
|
for (const configDir of getConnectorConfigReadDirs2(name)) {
|
|
25454
|
-
const credentialsFile =
|
|
25455
|
-
if (
|
|
25373
|
+
const credentialsFile = join14(configDir, "credentials.json");
|
|
25374
|
+
if (existsSync13(credentialsFile)) {
|
|
25456
25375
|
try {
|
|
25457
25376
|
const creds = JSON.parse(readFileSync8(credentialsFile, "utf-8"));
|
|
25458
25377
|
return { clientId: creds.clientId, clientSecret: creds.clientSecret };
|
|
@@ -25469,9 +25388,9 @@ function saveOAuthTokens(name, tokens) {
|
|
|
25469
25388
|
name = normalizeConnectorName(name);
|
|
25470
25389
|
const configDir = getConnectorConfigDir2(name);
|
|
25471
25390
|
const profile = getCurrentProfile2(name);
|
|
25472
|
-
const profileDir =
|
|
25391
|
+
const profileDir = join14(configDir, "profiles", profile);
|
|
25473
25392
|
mkdirSync9(profileDir, { recursive: true });
|
|
25474
|
-
const tokensFile =
|
|
25393
|
+
const tokensFile = join14(profileDir, "tokens.json");
|
|
25475
25394
|
writeFileSync7(tokensFile, JSON.stringify(tokens, null, 2), { mode: 384 });
|
|
25476
25395
|
}
|
|
25477
25396
|
async function refreshOAuthToken(name) {
|
|
@@ -25574,16 +25493,16 @@ __export(exports_runner, {
|
|
|
25574
25493
|
buildEnvWithCredentials: () => buildEnvWithCredentials,
|
|
25575
25494
|
buildConnectorOperationArgs: () => buildConnectorOperationArgs
|
|
25576
25495
|
});
|
|
25577
|
-
import { existsSync as
|
|
25578
|
-
import { join as
|
|
25496
|
+
import { existsSync as existsSync15, readdirSync as readdirSync9 } from "fs";
|
|
25497
|
+
import { join as join16, dirname as dirname7 } from "path";
|
|
25579
25498
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
25580
25499
|
import { spawn as spawn2 } from "child_process";
|
|
25581
25500
|
function resolveConnectorsDir2() {
|
|
25582
|
-
const fromBin =
|
|
25583
|
-
if (
|
|
25501
|
+
const fromBin = join16(__dirname5, "..", "connectors");
|
|
25502
|
+
if (existsSync15(fromBin))
|
|
25584
25503
|
return fromBin;
|
|
25585
|
-
const fromSrc =
|
|
25586
|
-
if (
|
|
25504
|
+
const fromSrc = join16(__dirname5, "..", "..", "connectors");
|
|
25505
|
+
if (existsSync15(fromSrc))
|
|
25587
25506
|
return fromSrc;
|
|
25588
25507
|
return fromBin;
|
|
25589
25508
|
}
|
|
@@ -25651,8 +25570,8 @@ function buildEnvWithCredentials(connectorName, baseEnv) {
|
|
|
25651
25570
|
function getConnectorCliPath(name) {
|
|
25652
25571
|
const safeName = normalizeConnectorName(name).replace(/[^a-z0-9-]/g, "");
|
|
25653
25572
|
const connectorDir = getConnectorPackagePath(CONNECTORS_DIR2, safeName);
|
|
25654
|
-
const cliPath =
|
|
25655
|
-
if (
|
|
25573
|
+
const cliPath = join16(connectorDir, "src", "cli", "index.ts");
|
|
25574
|
+
if (existsSync15(cliPath))
|
|
25656
25575
|
return cliPath;
|
|
25657
25576
|
return null;
|
|
25658
25577
|
}
|
|
@@ -30430,7 +30349,7 @@ var AssertObjectSchema = custom((v) => v !== null && (typeof v === "object" || t
|
|
|
30430
30349
|
var ProgressTokenSchema = union([string2(), number2().int()]);
|
|
30431
30350
|
var CursorSchema = string2();
|
|
30432
30351
|
var TaskCreationParamsSchema = looseObject({
|
|
30433
|
-
ttl: number2().optional(),
|
|
30352
|
+
ttl: union([number2(), _null3()]).optional(),
|
|
30434
30353
|
pollInterval: number2().optional()
|
|
30435
30354
|
});
|
|
30436
30355
|
var TaskMetadataSchema = object({
|
|
@@ -30584,8 +30503,7 @@ var ClientCapabilitiesSchema = object({
|
|
|
30584
30503
|
roots: object({
|
|
30585
30504
|
listChanged: boolean2().optional()
|
|
30586
30505
|
}).optional(),
|
|
30587
|
-
tasks: ClientTasksCapabilitySchema.optional()
|
|
30588
|
-
extensions: record(string2(), AssertObjectSchema).optional()
|
|
30506
|
+
tasks: ClientTasksCapabilitySchema.optional()
|
|
30589
30507
|
});
|
|
30590
30508
|
var InitializeRequestParamsSchema = BaseRequestParamsSchema.extend({
|
|
30591
30509
|
protocolVersion: string2(),
|
|
@@ -30611,8 +30529,7 @@ var ServerCapabilitiesSchema = object({
|
|
|
30611
30529
|
tools: object({
|
|
30612
30530
|
listChanged: boolean2().optional()
|
|
30613
30531
|
}).optional(),
|
|
30614
|
-
tasks: ServerTasksCapabilitySchema.optional()
|
|
30615
|
-
extensions: record(string2(), AssertObjectSchema).optional()
|
|
30532
|
+
tasks: ServerTasksCapabilitySchema.optional()
|
|
30616
30533
|
});
|
|
30617
30534
|
var InitializeResultSchema = ResultSchema.extend({
|
|
30618
30535
|
protocolVersion: string2(),
|
|
@@ -30727,7 +30644,6 @@ var ResourceSchema = object({
|
|
|
30727
30644
|
uri: string2(),
|
|
30728
30645
|
description: optional(string2()),
|
|
30729
30646
|
mimeType: optional(string2()),
|
|
30730
|
-
size: optional(number2()),
|
|
30731
30647
|
annotations: AnnotationsSchema.optional(),
|
|
30732
30648
|
_meta: optional(looseObject({}))
|
|
30733
30649
|
});
|
|
@@ -31357,8 +31273,8 @@ class StdioServerTransport {
|
|
|
31357
31273
|
|
|
31358
31274
|
// src/lib/registry.ts
|
|
31359
31275
|
init_builtins();
|
|
31360
|
-
import { existsSync as
|
|
31361
|
-
import { join as
|
|
31276
|
+
import { existsSync as existsSync9, readFileSync as readFileSync5 } from "fs";
|
|
31277
|
+
import { join as join11, dirname as dirname5 } from "path";
|
|
31362
31278
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
31363
31279
|
|
|
31364
31280
|
// src/lib/fuzzy.ts
|
|
@@ -37403,6 +37319,13 @@ var connectors17 = [
|
|
|
37403
37319
|
category: "Social Media",
|
|
37404
37320
|
tags: ["social", "fediverse", "decentralized"]
|
|
37405
37321
|
},
|
|
37322
|
+
{
|
|
37323
|
+
name: "bluesky",
|
|
37324
|
+
displayName: "Bluesky",
|
|
37325
|
+
description: "AT Protocol social network - posts, threads, mentions",
|
|
37326
|
+
category: "Social Media",
|
|
37327
|
+
tags: ["social", "atproto", "decentralized"]
|
|
37328
|
+
},
|
|
37406
37329
|
{
|
|
37407
37330
|
name: "brandblast",
|
|
37408
37331
|
displayName: "BrandBlast",
|
|
@@ -37635,16 +37558,16 @@ function loadConnectorVersions() {
|
|
|
37635
37558
|
versionsLoaded = true;
|
|
37636
37559
|
const thisDir = dirname5(fileURLToPath3(import.meta.url));
|
|
37637
37560
|
const candidates = [
|
|
37638
|
-
|
|
37639
|
-
|
|
37561
|
+
join11(thisDir, "..", "connectors"),
|
|
37562
|
+
join11(thisDir, "..", "..", "connectors")
|
|
37640
37563
|
];
|
|
37641
|
-
const connectorsDir = candidates.find((d) =>
|
|
37564
|
+
const connectorsDir = candidates.find((d) => existsSync9(d));
|
|
37642
37565
|
if (!connectorsDir)
|
|
37643
37566
|
return;
|
|
37644
37567
|
for (const connector of CONNECTORS) {
|
|
37645
37568
|
try {
|
|
37646
|
-
const pkgPath =
|
|
37647
|
-
if (
|
|
37569
|
+
const pkgPath = join11(getConnectorPackagePath(connectorsDir, connector.name), "package.json");
|
|
37570
|
+
if (existsSync9(pkgPath)) {
|
|
37648
37571
|
const pkg = JSON.parse(readFileSync5(pkgPath, "utf-8"));
|
|
37649
37572
|
connector.version = pkg.version || "0.0.0";
|
|
37650
37573
|
continue;
|
|
@@ -41583,8 +41506,8 @@ init_zod();
|
|
|
41583
41506
|
init_auth();
|
|
41584
41507
|
init_database();
|
|
41585
41508
|
init_connector_resolver();
|
|
41586
|
-
import { existsSync as
|
|
41587
|
-
import { join as
|
|
41509
|
+
import { existsSync as existsSync14, readFileSync as readFileSync9 } from "fs";
|
|
41510
|
+
import { join as join15 } from "path";
|
|
41588
41511
|
import { spawn } from "child_process";
|
|
41589
41512
|
function registerAuthTools(server, stripped) {
|
|
41590
41513
|
server.registerTool("connector_auth_status", {
|
|
@@ -41720,7 +41643,7 @@ function registerAuthTools(server, stripped) {
|
|
|
41720
41643
|
const oauthUrl = `http://localhost:${serverPort}/oauth/${name}/start`;
|
|
41721
41644
|
if (noBrowser) {
|
|
41722
41645
|
const connectorsHome = getConnectorsHome();
|
|
41723
|
-
const tokenPaths = getConnectorConfigReadDirs(name, connectorsHome).map((dir) =>
|
|
41646
|
+
const tokenPaths = getConnectorConfigReadDirs(name, connectorsHome).map((dir) => join15(dir, "profiles", "default", "tokens.json"));
|
|
41724
41647
|
let serverRunning = false;
|
|
41725
41648
|
try {
|
|
41726
41649
|
await fetch(`http://localhost:${serverPort}/api/connectors`);
|
|
@@ -41739,7 +41662,7 @@ function registerAuthTools(server, stripped) {
|
|
|
41739
41662
|
const maxAttempts = 120;
|
|
41740
41663
|
while (attempts < maxAttempts) {
|
|
41741
41664
|
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
41742
|
-
if (tokenPaths.some((tokensPath) =>
|
|
41665
|
+
if (tokenPaths.some((tokensPath) => existsSync14(tokensPath))) {
|
|
41743
41666
|
break;
|
|
41744
41667
|
}
|
|
41745
41668
|
attempts++;
|
|
@@ -41758,7 +41681,7 @@ function registerAuthTools(server, stripped) {
|
|
|
41758
41681
|
};
|
|
41759
41682
|
}
|
|
41760
41683
|
try {
|
|
41761
|
-
const tokensPath = tokenPaths.find((path) =>
|
|
41684
|
+
const tokensPath = tokenPaths.find((path) => existsSync14(path)) ?? tokenPaths[0];
|
|
41762
41685
|
const tokenData = JSON.parse(readFileSync9(tokensPath, "utf-8"));
|
|
41763
41686
|
return {
|
|
41764
41687
|
content: [{
|