@hasna/connectors 1.3.23 → 1.3.25
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 +492 -153
- package/bin/mcp.js +1078 -595
- package/bin/serve.js +774 -436
- package/connectors/connect-cloudflare/bun.lock +32 -0
- package/connectors/connect-gmail/bin/index.js +7027 -0
- package/connectors/connect-googledrive/bin/index.js +5958 -0
- package/connectors/connect-imessage/bin/.gitkeep +2 -0
- package/connectors/connect-imessage/bin/index.js +3016 -0
- package/connectors/connect-imessage/bun.lock +32 -0
- package/connectors/connect-imessage/package.json +46 -0
- package/connectors/connect-imessage/src/api/client.ts +139 -0
- package/connectors/connect-imessage/src/api/conversations.ts +49 -0
- package/connectors/connect-imessage/src/api/health.ts +16 -0
- package/connectors/connect-imessage/src/api/index.ts +62 -0
- package/connectors/connect-imessage/src/api/messages.ts +119 -0
- package/connectors/connect-imessage/src/cli/index.ts +258 -0
- package/connectors/connect-imessage/src/index.ts +26 -0
- package/connectors/connect-imessage/src/types/index.ts +134 -0
- package/connectors/connect-imessage/src/utils/config.ts +219 -0
- package/connectors/connect-imessage/src/utils/output.ts +121 -0
- package/connectors/connect-imessage/tsconfig.json +16 -0
- package/dist/core/builtins.test.d.ts +1 -0
- package/dist/core/connectors/googledrive.d.ts +6 -0
- package/dist/core/connectors/internal-operations.test.d.ts +1 -0
- package/dist/core/connectors/internal-runtime.test.d.ts +1 -0
- package/dist/core/errors.test.d.ts +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.js +640 -86
- package/dist/lib/runner-auth.test.d.ts +1 -0
- package/dist/lib/runner.d.ts +31 -0
- package/dist/lib/test-endpoints.test.d.ts +1 -0
- package/dist/lib/workflow-runner.d.ts +7 -0
- package/dist/server/auth-exchange.test.d.ts +1 -0
- package/dist/server/auth-refresh.test.d.ts +1 -0
- package/dist/server/auth.d.ts +1 -0
- package/package.json +1 -1
package/bin/mcp.js
CHANGED
|
@@ -46,7 +46,7 @@ var __export = (target, all) => {
|
|
|
46
46
|
};
|
|
47
47
|
var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
|
|
48
48
|
|
|
49
|
-
//
|
|
49
|
+
// node_modules/zod/v3/helpers/util.js
|
|
50
50
|
var util, objectUtil, ZodParsedType, getParsedType = (data) => {
|
|
51
51
|
const t = typeof data;
|
|
52
52
|
switch (t) {
|
|
@@ -177,7 +177,7 @@ var init_util = __esm(() => {
|
|
|
177
177
|
]);
|
|
178
178
|
});
|
|
179
179
|
|
|
180
|
-
//
|
|
180
|
+
// node_modules/zod/v3/ZodError.js
|
|
181
181
|
var ZodIssueCode, quotelessJson = (obj) => {
|
|
182
182
|
const json = JSON.stringify(obj, null, 2);
|
|
183
183
|
return json.replace(/"([^"]+)":/g, "$1:");
|
|
@@ -298,7 +298,7 @@ var init_ZodError = __esm(() => {
|
|
|
298
298
|
};
|
|
299
299
|
});
|
|
300
300
|
|
|
301
|
-
//
|
|
301
|
+
// node_modules/zod/v3/locales/en.js
|
|
302
302
|
var errorMap = (issue, _ctx) => {
|
|
303
303
|
let message;
|
|
304
304
|
switch (issue.code) {
|
|
@@ -405,7 +405,7 @@ var init_en = __esm(() => {
|
|
|
405
405
|
en_default = errorMap;
|
|
406
406
|
});
|
|
407
407
|
|
|
408
|
-
//
|
|
408
|
+
// node_modules/zod/v3/errors.js
|
|
409
409
|
function setErrorMap(map) {
|
|
410
410
|
overrideErrorMap = map;
|
|
411
411
|
}
|
|
@@ -418,7 +418,7 @@ var init_errors = __esm(() => {
|
|
|
418
418
|
overrideErrorMap = en_default;
|
|
419
419
|
});
|
|
420
420
|
|
|
421
|
-
//
|
|
421
|
+
// node_modules/zod/v3/helpers/parseUtil.js
|
|
422
422
|
function addIssueToContext(ctx, issueData) {
|
|
423
423
|
const overrideMap = getErrorMap();
|
|
424
424
|
const issue = makeIssue({
|
|
@@ -523,10 +523,10 @@ var init_parseUtil = __esm(() => {
|
|
|
523
523
|
});
|
|
524
524
|
});
|
|
525
525
|
|
|
526
|
-
//
|
|
526
|
+
// node_modules/zod/v3/helpers/typeAliases.js
|
|
527
527
|
var init_typeAliases = () => {};
|
|
528
528
|
|
|
529
|
-
//
|
|
529
|
+
// node_modules/zod/v3/helpers/errorUtil.js
|
|
530
530
|
var errorUtil;
|
|
531
531
|
var init_errorUtil = __esm(() => {
|
|
532
532
|
(function(errorUtil2) {
|
|
@@ -535,7 +535,7 @@ var init_errorUtil = __esm(() => {
|
|
|
535
535
|
})(errorUtil || (errorUtil = {}));
|
|
536
536
|
});
|
|
537
537
|
|
|
538
|
-
//
|
|
538
|
+
// node_modules/zod/v3/types.js
|
|
539
539
|
class ParseInputLazyPath {
|
|
540
540
|
constructor(parent, value, path, key) {
|
|
541
541
|
this._cachedPath = [];
|
|
@@ -3886,7 +3886,7 @@ var init_types = __esm(() => {
|
|
|
3886
3886
|
NEVER = INVALID;
|
|
3887
3887
|
});
|
|
3888
3888
|
|
|
3889
|
-
//
|
|
3889
|
+
// node_modules/zod/v3/external.js
|
|
3890
3890
|
var exports_external = {};
|
|
3891
3891
|
__export(exports_external, {
|
|
3892
3892
|
void: () => voidType,
|
|
@@ -4006,7 +4006,7 @@ var init_external = __esm(() => {
|
|
|
4006
4006
|
init_ZodError();
|
|
4007
4007
|
});
|
|
4008
4008
|
|
|
4009
|
-
//
|
|
4009
|
+
// node_modules/ajv/dist/compile/codegen/code.js
|
|
4010
4010
|
var require_code = __commonJS((exports) => {
|
|
4011
4011
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4012
4012
|
exports.regexpCode = exports.getEsmExportName = exports.getProperty = exports.safeStringify = exports.stringify = exports.strConcat = exports.addCodeArg = exports.str = exports._ = exports.nil = exports._Code = exports.Name = exports.IDENTIFIER = exports._CodeOrName = undefined;
|
|
@@ -4160,7 +4160,7 @@ var require_code = __commonJS((exports) => {
|
|
|
4160
4160
|
exports.regexpCode = regexpCode;
|
|
4161
4161
|
});
|
|
4162
4162
|
|
|
4163
|
-
//
|
|
4163
|
+
// node_modules/ajv/dist/compile/codegen/scope.js
|
|
4164
4164
|
var require_scope = __commonJS((exports) => {
|
|
4165
4165
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4166
4166
|
exports.ValueScope = exports.ValueScopeName = exports.Scope = exports.varKinds = exports.UsedValueState = undefined;
|
|
@@ -4306,7 +4306,7 @@ var require_scope = __commonJS((exports) => {
|
|
|
4306
4306
|
exports.ValueScope = ValueScope;
|
|
4307
4307
|
});
|
|
4308
4308
|
|
|
4309
|
-
//
|
|
4309
|
+
// node_modules/ajv/dist/compile/codegen/index.js
|
|
4310
4310
|
var require_codegen = __commonJS((exports) => {
|
|
4311
4311
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4312
4312
|
exports.or = exports.and = exports.not = exports.CodeGen = exports.operators = exports.varKinds = exports.ValueScopeName = exports.ValueScope = exports.Scope = exports.Name = exports.regexpCode = exports.stringify = exports.getProperty = exports.nil = exports.strConcat = exports.str = exports._ = undefined;
|
|
@@ -5016,7 +5016,7 @@ var require_codegen = __commonJS((exports) => {
|
|
|
5016
5016
|
}
|
|
5017
5017
|
});
|
|
5018
5018
|
|
|
5019
|
-
//
|
|
5019
|
+
// node_modules/ajv/dist/compile/util.js
|
|
5020
5020
|
var require_util = __commonJS((exports) => {
|
|
5021
5021
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5022
5022
|
exports.checkStrictMode = exports.getErrorPath = exports.Type = exports.useFunc = exports.setEvaluated = exports.evaluatedPropsToName = exports.mergeEvaluated = exports.eachItem = exports.unescapeJsonPointer = exports.escapeJsonPointer = exports.escapeFragment = exports.unescapeFragment = exports.schemaRefOrVal = exports.schemaHasRulesButRef = exports.schemaHasRules = exports.checkUnknownRules = exports.alwaysValidSchema = exports.toHash = undefined;
|
|
@@ -5180,7 +5180,7 @@ var require_util = __commonJS((exports) => {
|
|
|
5180
5180
|
exports.checkStrictMode = checkStrictMode;
|
|
5181
5181
|
});
|
|
5182
5182
|
|
|
5183
|
-
//
|
|
5183
|
+
// node_modules/ajv/dist/compile/names.js
|
|
5184
5184
|
var require_names = __commonJS((exports) => {
|
|
5185
5185
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5186
5186
|
var codegen_1 = require_codegen();
|
|
@@ -5205,7 +5205,7 @@ var require_names = __commonJS((exports) => {
|
|
|
5205
5205
|
exports.default = names;
|
|
5206
5206
|
});
|
|
5207
5207
|
|
|
5208
|
-
//
|
|
5208
|
+
// node_modules/ajv/dist/compile/errors.js
|
|
5209
5209
|
var require_errors = __commonJS((exports) => {
|
|
5210
5210
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5211
5211
|
exports.extendErrors = exports.resetErrorsCount = exports.reportExtraError = exports.reportError = exports.keyword$DataError = exports.keywordError = undefined;
|
|
@@ -5323,7 +5323,7 @@ var require_errors = __commonJS((exports) => {
|
|
|
5323
5323
|
}
|
|
5324
5324
|
});
|
|
5325
5325
|
|
|
5326
|
-
//
|
|
5326
|
+
// node_modules/ajv/dist/compile/validate/boolSchema.js
|
|
5327
5327
|
var require_boolSchema = __commonJS((exports) => {
|
|
5328
5328
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5329
5329
|
exports.boolOrEmptySchema = exports.topBoolOrEmptySchema = undefined;
|
|
@@ -5371,7 +5371,7 @@ var require_boolSchema = __commonJS((exports) => {
|
|
|
5371
5371
|
}
|
|
5372
5372
|
});
|
|
5373
5373
|
|
|
5374
|
-
//
|
|
5374
|
+
// node_modules/ajv/dist/compile/rules.js
|
|
5375
5375
|
var require_rules = __commonJS((exports) => {
|
|
5376
5376
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5377
5377
|
exports.getRules = exports.isJSONType = undefined;
|
|
@@ -5399,7 +5399,7 @@ var require_rules = __commonJS((exports) => {
|
|
|
5399
5399
|
exports.getRules = getRules;
|
|
5400
5400
|
});
|
|
5401
5401
|
|
|
5402
|
-
//
|
|
5402
|
+
// node_modules/ajv/dist/compile/validate/applicability.js
|
|
5403
5403
|
var require_applicability = __commonJS((exports) => {
|
|
5404
5404
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5405
5405
|
exports.shouldUseRule = exports.shouldUseGroup = exports.schemaHasRulesForType = undefined;
|
|
@@ -5419,7 +5419,7 @@ var require_applicability = __commonJS((exports) => {
|
|
|
5419
5419
|
exports.shouldUseRule = shouldUseRule;
|
|
5420
5420
|
});
|
|
5421
5421
|
|
|
5422
|
-
//
|
|
5422
|
+
// node_modules/ajv/dist/compile/validate/dataType.js
|
|
5423
5423
|
var require_dataType = __commonJS((exports) => {
|
|
5424
5424
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5425
5425
|
exports.reportTypeError = exports.checkDataTypes = exports.checkDataType = exports.coerceAndCheckDataType = exports.getJSONTypes = exports.getSchemaTypes = exports.DataType = undefined;
|
|
@@ -5600,7 +5600,7 @@ var require_dataType = __commonJS((exports) => {
|
|
|
5600
5600
|
}
|
|
5601
5601
|
});
|
|
5602
5602
|
|
|
5603
|
-
//
|
|
5603
|
+
// node_modules/ajv/dist/compile/validate/defaults.js
|
|
5604
5604
|
var require_defaults = __commonJS((exports) => {
|
|
5605
5605
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5606
5606
|
exports.assignDefaults = undefined;
|
|
@@ -5634,7 +5634,7 @@ var require_defaults = __commonJS((exports) => {
|
|
|
5634
5634
|
}
|
|
5635
5635
|
});
|
|
5636
5636
|
|
|
5637
|
-
//
|
|
5637
|
+
// node_modules/ajv/dist/vocabularies/code.js
|
|
5638
5638
|
var require_code2 = __commonJS((exports) => {
|
|
5639
5639
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5640
5640
|
exports.validateUnion = exports.validateArray = exports.usePattern = exports.callValidateCode = exports.schemaProperties = exports.allSchemaProperties = exports.noPropertyInData = exports.propertyInData = exports.isOwnProperty = exports.hasPropFunc = exports.reportMissingProp = exports.checkMissingProp = exports.checkReportMissingProp = undefined;
|
|
@@ -5763,7 +5763,7 @@ var require_code2 = __commonJS((exports) => {
|
|
|
5763
5763
|
exports.validateUnion = validateUnion;
|
|
5764
5764
|
});
|
|
5765
5765
|
|
|
5766
|
-
//
|
|
5766
|
+
// node_modules/ajv/dist/compile/validate/keyword.js
|
|
5767
5767
|
var require_keyword = __commonJS((exports) => {
|
|
5768
5768
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5769
5769
|
exports.validateKeywordUsage = exports.validSchemaType = exports.funcKeywordCode = exports.macroKeywordCode = undefined;
|
|
@@ -5878,7 +5878,7 @@ var require_keyword = __commonJS((exports) => {
|
|
|
5878
5878
|
exports.validateKeywordUsage = validateKeywordUsage;
|
|
5879
5879
|
});
|
|
5880
5880
|
|
|
5881
|
-
//
|
|
5881
|
+
// node_modules/ajv/dist/compile/validate/subschema.js
|
|
5882
5882
|
var require_subschema = __commonJS((exports) => {
|
|
5883
5883
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
5884
5884
|
exports.extendSubschemaMode = exports.extendSubschemaData = exports.getSubschema = undefined;
|
|
@@ -5958,7 +5958,7 @@ var require_subschema = __commonJS((exports) => {
|
|
|
5958
5958
|
exports.extendSubschemaMode = extendSubschemaMode;
|
|
5959
5959
|
});
|
|
5960
5960
|
|
|
5961
|
-
//
|
|
5961
|
+
// node_modules/fast-deep-equal/index.js
|
|
5962
5962
|
var require_fast_deep_equal = __commonJS((exports, module) => {
|
|
5963
5963
|
module.exports = function equal(a, b) {
|
|
5964
5964
|
if (a === b)
|
|
@@ -6000,7 +6000,7 @@ var require_fast_deep_equal = __commonJS((exports, module) => {
|
|
|
6000
6000
|
};
|
|
6001
6001
|
});
|
|
6002
6002
|
|
|
6003
|
-
//
|
|
6003
|
+
// node_modules/json-schema-traverse/index.js
|
|
6004
6004
|
var require_json_schema_traverse = __commonJS((exports, module) => {
|
|
6005
6005
|
var traverse = module.exports = function(schema, opts, cb) {
|
|
6006
6006
|
if (typeof opts == "function") {
|
|
@@ -6083,7 +6083,7 @@ var require_json_schema_traverse = __commonJS((exports, module) => {
|
|
|
6083
6083
|
}
|
|
6084
6084
|
});
|
|
6085
6085
|
|
|
6086
|
-
//
|
|
6086
|
+
// node_modules/ajv/dist/compile/resolve.js
|
|
6087
6087
|
var require_resolve = __commonJS((exports) => {
|
|
6088
6088
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6089
6089
|
exports.getSchemaRefs = exports.resolveUrl = exports.normalizeId = exports._getFullPath = exports.getFullPath = exports.inlineRef = undefined;
|
|
@@ -6236,7 +6236,7 @@ var require_resolve = __commonJS((exports) => {
|
|
|
6236
6236
|
exports.getSchemaRefs = getSchemaRefs;
|
|
6237
6237
|
});
|
|
6238
6238
|
|
|
6239
|
-
//
|
|
6239
|
+
// node_modules/ajv/dist/compile/validate/index.js
|
|
6240
6240
|
var require_validate = __commonJS((exports) => {
|
|
6241
6241
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6242
6242
|
exports.getData = exports.KeywordCxt = exports.validateFunctionCode = undefined;
|
|
@@ -6741,7 +6741,7 @@ var require_validate = __commonJS((exports) => {
|
|
|
6741
6741
|
exports.getData = getData;
|
|
6742
6742
|
});
|
|
6743
6743
|
|
|
6744
|
-
//
|
|
6744
|
+
// node_modules/ajv/dist/runtime/validation_error.js
|
|
6745
6745
|
var require_validation_error = __commonJS((exports) => {
|
|
6746
6746
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6747
6747
|
|
|
@@ -6755,7 +6755,7 @@ var require_validation_error = __commonJS((exports) => {
|
|
|
6755
6755
|
exports.default = ValidationError;
|
|
6756
6756
|
});
|
|
6757
6757
|
|
|
6758
|
-
//
|
|
6758
|
+
// node_modules/ajv/dist/compile/ref_error.js
|
|
6759
6759
|
var require_ref_error = __commonJS((exports) => {
|
|
6760
6760
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6761
6761
|
var resolve_1 = require_resolve();
|
|
@@ -6770,7 +6770,7 @@ var require_ref_error = __commonJS((exports) => {
|
|
|
6770
6770
|
exports.default = MissingRefError;
|
|
6771
6771
|
});
|
|
6772
6772
|
|
|
6773
|
-
//
|
|
6773
|
+
// node_modules/ajv/dist/compile/index.js
|
|
6774
6774
|
var require_compile = __commonJS((exports) => {
|
|
6775
6775
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6776
6776
|
exports.resolveSchema = exports.getCompilingSchema = exports.resolveRef = exports.compileSchema = exports.SchemaEnv = undefined;
|
|
@@ -6991,7 +6991,7 @@ var require_compile = __commonJS((exports) => {
|
|
|
6991
6991
|
}
|
|
6992
6992
|
});
|
|
6993
6993
|
|
|
6994
|
-
//
|
|
6994
|
+
// node_modules/ajv/dist/refs/data.json
|
|
6995
6995
|
var require_data = __commonJS((exports, module) => {
|
|
6996
6996
|
module.exports = {
|
|
6997
6997
|
$id: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#",
|
|
@@ -7008,7 +7008,7 @@ var require_data = __commonJS((exports, module) => {
|
|
|
7008
7008
|
};
|
|
7009
7009
|
});
|
|
7010
7010
|
|
|
7011
|
-
//
|
|
7011
|
+
// node_modules/fast-uri/lib/utils.js
|
|
7012
7012
|
var require_utils = __commonJS((exports, module) => {
|
|
7013
7013
|
var isUUID = RegExp.prototype.test.bind(/^[\da-f]{8}-[\da-f]{4}-[\da-f]{4}-[\da-f]{4}-[\da-f]{12}$/iu);
|
|
7014
7014
|
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);
|
|
@@ -7263,7 +7263,7 @@ var require_utils = __commonJS((exports, module) => {
|
|
|
7263
7263
|
};
|
|
7264
7264
|
});
|
|
7265
7265
|
|
|
7266
|
-
//
|
|
7266
|
+
// node_modules/fast-uri/lib/schemes.js
|
|
7267
7267
|
var require_schemes = __commonJS((exports, module) => {
|
|
7268
7268
|
var { isUUID } = require_utils();
|
|
7269
7269
|
var URN_REG = /([\da-z][\d\-a-z]{0,31}):((?:[\w!$'()*+,\-.:;=@]|%[\da-f]{2})+)/iu;
|
|
@@ -7437,7 +7437,7 @@ var require_schemes = __commonJS((exports, module) => {
|
|
|
7437
7437
|
};
|
|
7438
7438
|
});
|
|
7439
7439
|
|
|
7440
|
-
//
|
|
7440
|
+
// node_modules/fast-uri/index.js
|
|
7441
7441
|
var require_fast_uri = __commonJS((exports, module) => {
|
|
7442
7442
|
var { normalizeIPv6, removeDotSegments, recomposeAuthority, normalizeComponentEncoding, isIPv4, nonSimpleDomain } = require_utils();
|
|
7443
7443
|
var { SCHEMES, getSchemeHandler } = require_schemes();
|
|
@@ -7688,7 +7688,7 @@ var require_fast_uri = __commonJS((exports, module) => {
|
|
|
7688
7688
|
module.exports.fastUri = fastUri;
|
|
7689
7689
|
});
|
|
7690
7690
|
|
|
7691
|
-
//
|
|
7691
|
+
// node_modules/ajv/dist/runtime/uri.js
|
|
7692
7692
|
var require_uri = __commonJS((exports) => {
|
|
7693
7693
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7694
7694
|
var uri = require_fast_uri();
|
|
@@ -7696,7 +7696,7 @@ var require_uri = __commonJS((exports) => {
|
|
|
7696
7696
|
exports.default = uri;
|
|
7697
7697
|
});
|
|
7698
7698
|
|
|
7699
|
-
//
|
|
7699
|
+
// node_modules/ajv/dist/core.js
|
|
7700
7700
|
var require_core = __commonJS((exports) => {
|
|
7701
7701
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7702
7702
|
exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = undefined;
|
|
@@ -8289,7 +8289,7 @@ var require_core = __commonJS((exports) => {
|
|
|
8289
8289
|
}
|
|
8290
8290
|
});
|
|
8291
8291
|
|
|
8292
|
-
//
|
|
8292
|
+
// node_modules/ajv/dist/vocabularies/core/id.js
|
|
8293
8293
|
var require_id = __commonJS((exports) => {
|
|
8294
8294
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8295
8295
|
var def = {
|
|
@@ -8301,7 +8301,7 @@ var require_id = __commonJS((exports) => {
|
|
|
8301
8301
|
exports.default = def;
|
|
8302
8302
|
});
|
|
8303
8303
|
|
|
8304
|
-
//
|
|
8304
|
+
// node_modules/ajv/dist/vocabularies/core/ref.js
|
|
8305
8305
|
var require_ref = __commonJS((exports) => {
|
|
8306
8306
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8307
8307
|
exports.callRef = exports.getValidate = undefined;
|
|
@@ -8420,7 +8420,7 @@ var require_ref = __commonJS((exports) => {
|
|
|
8420
8420
|
exports.default = def;
|
|
8421
8421
|
});
|
|
8422
8422
|
|
|
8423
|
-
//
|
|
8423
|
+
// node_modules/ajv/dist/vocabularies/core/index.js
|
|
8424
8424
|
var require_core2 = __commonJS((exports) => {
|
|
8425
8425
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8426
8426
|
var id_1 = require_id();
|
|
@@ -8438,7 +8438,7 @@ var require_core2 = __commonJS((exports) => {
|
|
|
8438
8438
|
exports.default = core2;
|
|
8439
8439
|
});
|
|
8440
8440
|
|
|
8441
|
-
//
|
|
8441
|
+
// node_modules/ajv/dist/vocabularies/validation/limitNumber.js
|
|
8442
8442
|
var require_limitNumber = __commonJS((exports) => {
|
|
8443
8443
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8444
8444
|
var codegen_1 = require_codegen();
|
|
@@ -8467,7 +8467,7 @@ var require_limitNumber = __commonJS((exports) => {
|
|
|
8467
8467
|
exports.default = def;
|
|
8468
8468
|
});
|
|
8469
8469
|
|
|
8470
|
-
//
|
|
8470
|
+
// node_modules/ajv/dist/vocabularies/validation/multipleOf.js
|
|
8471
8471
|
var require_multipleOf = __commonJS((exports) => {
|
|
8472
8472
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8473
8473
|
var codegen_1 = require_codegen();
|
|
@@ -8492,7 +8492,7 @@ var require_multipleOf = __commonJS((exports) => {
|
|
|
8492
8492
|
exports.default = def;
|
|
8493
8493
|
});
|
|
8494
8494
|
|
|
8495
|
-
//
|
|
8495
|
+
// node_modules/ajv/dist/runtime/ucs2length.js
|
|
8496
8496
|
var require_ucs2length = __commonJS((exports) => {
|
|
8497
8497
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8498
8498
|
function ucs2length(str) {
|
|
@@ -8515,7 +8515,7 @@ var require_ucs2length = __commonJS((exports) => {
|
|
|
8515
8515
|
ucs2length.code = 'require("ajv/dist/runtime/ucs2length").default';
|
|
8516
8516
|
});
|
|
8517
8517
|
|
|
8518
|
-
//
|
|
8518
|
+
// node_modules/ajv/dist/vocabularies/validation/limitLength.js
|
|
8519
8519
|
var require_limitLength = __commonJS((exports) => {
|
|
8520
8520
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8521
8521
|
var codegen_1 = require_codegen();
|
|
@@ -8544,7 +8544,7 @@ var require_limitLength = __commonJS((exports) => {
|
|
|
8544
8544
|
exports.default = def;
|
|
8545
8545
|
});
|
|
8546
8546
|
|
|
8547
|
-
//
|
|
8547
|
+
// node_modules/ajv/dist/vocabularies/validation/pattern.js
|
|
8548
8548
|
var require_pattern = __commonJS((exports) => {
|
|
8549
8549
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8550
8550
|
var code_1 = require_code2();
|
|
@@ -8578,7 +8578,7 @@ var require_pattern = __commonJS((exports) => {
|
|
|
8578
8578
|
exports.default = def;
|
|
8579
8579
|
});
|
|
8580
8580
|
|
|
8581
|
-
//
|
|
8581
|
+
// node_modules/ajv/dist/vocabularies/validation/limitProperties.js
|
|
8582
8582
|
var require_limitProperties = __commonJS((exports) => {
|
|
8583
8583
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8584
8584
|
var codegen_1 = require_codegen();
|
|
@@ -8604,7 +8604,7 @@ var require_limitProperties = __commonJS((exports) => {
|
|
|
8604
8604
|
exports.default = def;
|
|
8605
8605
|
});
|
|
8606
8606
|
|
|
8607
|
-
//
|
|
8607
|
+
// node_modules/ajv/dist/vocabularies/validation/required.js
|
|
8608
8608
|
var require_required = __commonJS((exports) => {
|
|
8609
8609
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8610
8610
|
var code_1 = require_code2();
|
|
@@ -8683,7 +8683,7 @@ var require_required = __commonJS((exports) => {
|
|
|
8683
8683
|
exports.default = def;
|
|
8684
8684
|
});
|
|
8685
8685
|
|
|
8686
|
-
//
|
|
8686
|
+
// node_modules/ajv/dist/vocabularies/validation/limitItems.js
|
|
8687
8687
|
var require_limitItems = __commonJS((exports) => {
|
|
8688
8688
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8689
8689
|
var codegen_1 = require_codegen();
|
|
@@ -8709,7 +8709,7 @@ var require_limitItems = __commonJS((exports) => {
|
|
|
8709
8709
|
exports.default = def;
|
|
8710
8710
|
});
|
|
8711
8711
|
|
|
8712
|
-
//
|
|
8712
|
+
// node_modules/ajv/dist/runtime/equal.js
|
|
8713
8713
|
var require_equal = __commonJS((exports) => {
|
|
8714
8714
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8715
8715
|
var equal = require_fast_deep_equal();
|
|
@@ -8717,7 +8717,7 @@ var require_equal = __commonJS((exports) => {
|
|
|
8717
8717
|
exports.default = equal;
|
|
8718
8718
|
});
|
|
8719
8719
|
|
|
8720
|
-
//
|
|
8720
|
+
// node_modules/ajv/dist/vocabularies/validation/uniqueItems.js
|
|
8721
8721
|
var require_uniqueItems = __commonJS((exports) => {
|
|
8722
8722
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8723
8723
|
var dataType_1 = require_dataType();
|
|
@@ -8781,7 +8781,7 @@ var require_uniqueItems = __commonJS((exports) => {
|
|
|
8781
8781
|
exports.default = def;
|
|
8782
8782
|
});
|
|
8783
8783
|
|
|
8784
|
-
//
|
|
8784
|
+
// node_modules/ajv/dist/vocabularies/validation/const.js
|
|
8785
8785
|
var require_const = __commonJS((exports) => {
|
|
8786
8786
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8787
8787
|
var codegen_1 = require_codegen();
|
|
@@ -8807,7 +8807,7 @@ var require_const = __commonJS((exports) => {
|
|
|
8807
8807
|
exports.default = def;
|
|
8808
8808
|
});
|
|
8809
8809
|
|
|
8810
|
-
//
|
|
8810
|
+
// node_modules/ajv/dist/vocabularies/validation/enum.js
|
|
8811
8811
|
var require_enum = __commonJS((exports) => {
|
|
8812
8812
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8813
8813
|
var codegen_1 = require_codegen();
|
|
@@ -8853,7 +8853,7 @@ var require_enum = __commonJS((exports) => {
|
|
|
8853
8853
|
exports.default = def;
|
|
8854
8854
|
});
|
|
8855
8855
|
|
|
8856
|
-
//
|
|
8856
|
+
// node_modules/ajv/dist/vocabularies/validation/index.js
|
|
8857
8857
|
var require_validation = __commonJS((exports) => {
|
|
8858
8858
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8859
8859
|
var limitNumber_1 = require_limitNumber();
|
|
@@ -8883,7 +8883,7 @@ var require_validation = __commonJS((exports) => {
|
|
|
8883
8883
|
exports.default = validation;
|
|
8884
8884
|
});
|
|
8885
8885
|
|
|
8886
|
-
//
|
|
8886
|
+
// node_modules/ajv/dist/vocabularies/applicator/additionalItems.js
|
|
8887
8887
|
var require_additionalItems = __commonJS((exports) => {
|
|
8888
8888
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8889
8889
|
exports.validateAdditionalItems = undefined;
|
|
@@ -8933,7 +8933,7 @@ var require_additionalItems = __commonJS((exports) => {
|
|
|
8933
8933
|
exports.default = def;
|
|
8934
8934
|
});
|
|
8935
8935
|
|
|
8936
|
-
//
|
|
8936
|
+
// node_modules/ajv/dist/vocabularies/applicator/items.js
|
|
8937
8937
|
var require_items = __commonJS((exports) => {
|
|
8938
8938
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8939
8939
|
exports.validateTuple = undefined;
|
|
@@ -8987,7 +8987,7 @@ var require_items = __commonJS((exports) => {
|
|
|
8987
8987
|
exports.default = def;
|
|
8988
8988
|
});
|
|
8989
8989
|
|
|
8990
|
-
//
|
|
8990
|
+
// node_modules/ajv/dist/vocabularies/applicator/prefixItems.js
|
|
8991
8991
|
var require_prefixItems = __commonJS((exports) => {
|
|
8992
8992
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
8993
8993
|
var items_1 = require_items();
|
|
@@ -9001,7 +9001,7 @@ var require_prefixItems = __commonJS((exports) => {
|
|
|
9001
9001
|
exports.default = def;
|
|
9002
9002
|
});
|
|
9003
9003
|
|
|
9004
|
-
//
|
|
9004
|
+
// node_modules/ajv/dist/vocabularies/applicator/items2020.js
|
|
9005
9005
|
var require_items2020 = __commonJS((exports) => {
|
|
9006
9006
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9007
9007
|
var codegen_1 = require_codegen();
|
|
@@ -9033,7 +9033,7 @@ var require_items2020 = __commonJS((exports) => {
|
|
|
9033
9033
|
exports.default = def;
|
|
9034
9034
|
});
|
|
9035
9035
|
|
|
9036
|
-
//
|
|
9036
|
+
// node_modules/ajv/dist/vocabularies/applicator/contains.js
|
|
9037
9037
|
var require_contains = __commonJS((exports) => {
|
|
9038
9038
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9039
9039
|
var codegen_1 = require_codegen();
|
|
@@ -9124,7 +9124,7 @@ var require_contains = __commonJS((exports) => {
|
|
|
9124
9124
|
exports.default = def;
|
|
9125
9125
|
});
|
|
9126
9126
|
|
|
9127
|
-
//
|
|
9127
|
+
// node_modules/ajv/dist/vocabularies/applicator/dependencies.js
|
|
9128
9128
|
var require_dependencies = __commonJS((exports) => {
|
|
9129
9129
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9130
9130
|
exports.validateSchemaDeps = exports.validatePropertyDeps = exports.error = undefined;
|
|
@@ -9209,7 +9209,7 @@ var require_dependencies = __commonJS((exports) => {
|
|
|
9209
9209
|
exports.default = def;
|
|
9210
9210
|
});
|
|
9211
9211
|
|
|
9212
|
-
//
|
|
9212
|
+
// node_modules/ajv/dist/vocabularies/applicator/propertyNames.js
|
|
9213
9213
|
var require_propertyNames = __commonJS((exports) => {
|
|
9214
9214
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9215
9215
|
var codegen_1 = require_codegen();
|
|
@@ -9249,7 +9249,7 @@ var require_propertyNames = __commonJS((exports) => {
|
|
|
9249
9249
|
exports.default = def;
|
|
9250
9250
|
});
|
|
9251
9251
|
|
|
9252
|
-
//
|
|
9252
|
+
// node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js
|
|
9253
9253
|
var require_additionalProperties = __commonJS((exports) => {
|
|
9254
9254
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9255
9255
|
var code_1 = require_code2();
|
|
@@ -9352,7 +9352,7 @@ var require_additionalProperties = __commonJS((exports) => {
|
|
|
9352
9352
|
exports.default = def;
|
|
9353
9353
|
});
|
|
9354
9354
|
|
|
9355
|
-
//
|
|
9355
|
+
// node_modules/ajv/dist/vocabularies/applicator/properties.js
|
|
9356
9356
|
var require_properties = __commonJS((exports) => {
|
|
9357
9357
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9358
9358
|
var validate_1 = require_validate();
|
|
@@ -9407,7 +9407,7 @@ var require_properties = __commonJS((exports) => {
|
|
|
9407
9407
|
exports.default = def;
|
|
9408
9408
|
});
|
|
9409
9409
|
|
|
9410
|
-
//
|
|
9410
|
+
// node_modules/ajv/dist/vocabularies/applicator/patternProperties.js
|
|
9411
9411
|
var require_patternProperties = __commonJS((exports) => {
|
|
9412
9412
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9413
9413
|
var code_1 = require_code2();
|
|
@@ -9478,7 +9478,7 @@ var require_patternProperties = __commonJS((exports) => {
|
|
|
9478
9478
|
exports.default = def;
|
|
9479
9479
|
});
|
|
9480
9480
|
|
|
9481
|
-
//
|
|
9481
|
+
// node_modules/ajv/dist/vocabularies/applicator/not.js
|
|
9482
9482
|
var require_not = __commonJS((exports) => {
|
|
9483
9483
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9484
9484
|
var util_1 = require_util();
|
|
@@ -9506,7 +9506,7 @@ var require_not = __commonJS((exports) => {
|
|
|
9506
9506
|
exports.default = def;
|
|
9507
9507
|
});
|
|
9508
9508
|
|
|
9509
|
-
//
|
|
9509
|
+
// node_modules/ajv/dist/vocabularies/applicator/anyOf.js
|
|
9510
9510
|
var require_anyOf = __commonJS((exports) => {
|
|
9511
9511
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9512
9512
|
var code_1 = require_code2();
|
|
@@ -9520,7 +9520,7 @@ var require_anyOf = __commonJS((exports) => {
|
|
|
9520
9520
|
exports.default = def;
|
|
9521
9521
|
});
|
|
9522
9522
|
|
|
9523
|
-
//
|
|
9523
|
+
// node_modules/ajv/dist/vocabularies/applicator/oneOf.js
|
|
9524
9524
|
var require_oneOf = __commonJS((exports) => {
|
|
9525
9525
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9526
9526
|
var codegen_1 = require_codegen();
|
|
@@ -9575,7 +9575,7 @@ var require_oneOf = __commonJS((exports) => {
|
|
|
9575
9575
|
exports.default = def;
|
|
9576
9576
|
});
|
|
9577
9577
|
|
|
9578
|
-
//
|
|
9578
|
+
// node_modules/ajv/dist/vocabularies/applicator/allOf.js
|
|
9579
9579
|
var require_allOf = __commonJS((exports) => {
|
|
9580
9580
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9581
9581
|
var util_1 = require_util();
|
|
@@ -9599,7 +9599,7 @@ var require_allOf = __commonJS((exports) => {
|
|
|
9599
9599
|
exports.default = def;
|
|
9600
9600
|
});
|
|
9601
9601
|
|
|
9602
|
-
//
|
|
9602
|
+
// node_modules/ajv/dist/vocabularies/applicator/if.js
|
|
9603
9603
|
var require_if = __commonJS((exports) => {
|
|
9604
9604
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9605
9605
|
var codegen_1 = require_codegen();
|
|
@@ -9665,7 +9665,7 @@ var require_if = __commonJS((exports) => {
|
|
|
9665
9665
|
exports.default = def;
|
|
9666
9666
|
});
|
|
9667
9667
|
|
|
9668
|
-
//
|
|
9668
|
+
// node_modules/ajv/dist/vocabularies/applicator/thenElse.js
|
|
9669
9669
|
var require_thenElse = __commonJS((exports) => {
|
|
9670
9670
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9671
9671
|
var util_1 = require_util();
|
|
@@ -9680,7 +9680,7 @@ var require_thenElse = __commonJS((exports) => {
|
|
|
9680
9680
|
exports.default = def;
|
|
9681
9681
|
});
|
|
9682
9682
|
|
|
9683
|
-
//
|
|
9683
|
+
// node_modules/ajv/dist/vocabularies/applicator/index.js
|
|
9684
9684
|
var require_applicator = __commonJS((exports) => {
|
|
9685
9685
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9686
9686
|
var additionalItems_1 = require_additionalItems();
|
|
@@ -9723,7 +9723,7 @@ var require_applicator = __commonJS((exports) => {
|
|
|
9723
9723
|
exports.default = getApplicator;
|
|
9724
9724
|
});
|
|
9725
9725
|
|
|
9726
|
-
//
|
|
9726
|
+
// node_modules/ajv/dist/vocabularies/format/format.js
|
|
9727
9727
|
var require_format = __commonJS((exports) => {
|
|
9728
9728
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9729
9729
|
var codegen_1 = require_codegen();
|
|
@@ -9810,7 +9810,7 @@ var require_format = __commonJS((exports) => {
|
|
|
9810
9810
|
exports.default = def;
|
|
9811
9811
|
});
|
|
9812
9812
|
|
|
9813
|
-
//
|
|
9813
|
+
// node_modules/ajv/dist/vocabularies/format/index.js
|
|
9814
9814
|
var require_format2 = __commonJS((exports) => {
|
|
9815
9815
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9816
9816
|
var format_1 = require_format();
|
|
@@ -9818,7 +9818,7 @@ var require_format2 = __commonJS((exports) => {
|
|
|
9818
9818
|
exports.default = format;
|
|
9819
9819
|
});
|
|
9820
9820
|
|
|
9821
|
-
//
|
|
9821
|
+
// node_modules/ajv/dist/vocabularies/metadata.js
|
|
9822
9822
|
var require_metadata = __commonJS((exports) => {
|
|
9823
9823
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9824
9824
|
exports.contentVocabulary = exports.metadataVocabulary = undefined;
|
|
@@ -9838,7 +9838,7 @@ var require_metadata = __commonJS((exports) => {
|
|
|
9838
9838
|
];
|
|
9839
9839
|
});
|
|
9840
9840
|
|
|
9841
|
-
//
|
|
9841
|
+
// node_modules/ajv/dist/vocabularies/draft7.js
|
|
9842
9842
|
var require_draft7 = __commonJS((exports) => {
|
|
9843
9843
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9844
9844
|
var core_1 = require_core2();
|
|
@@ -9857,7 +9857,7 @@ var require_draft7 = __commonJS((exports) => {
|
|
|
9857
9857
|
exports.default = draft7Vocabularies;
|
|
9858
9858
|
});
|
|
9859
9859
|
|
|
9860
|
-
//
|
|
9860
|
+
// node_modules/ajv/dist/vocabularies/discriminator/types.js
|
|
9861
9861
|
var require_types = __commonJS((exports) => {
|
|
9862
9862
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9863
9863
|
exports.DiscrError = undefined;
|
|
@@ -9868,7 +9868,7 @@ var require_types = __commonJS((exports) => {
|
|
|
9868
9868
|
})(DiscrError || (exports.DiscrError = DiscrError = {}));
|
|
9869
9869
|
});
|
|
9870
9870
|
|
|
9871
|
-
//
|
|
9871
|
+
// node_modules/ajv/dist/vocabularies/discriminator/index.js
|
|
9872
9872
|
var require_discriminator = __commonJS((exports) => {
|
|
9873
9873
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9874
9874
|
var codegen_1 = require_codegen();
|
|
@@ -9970,7 +9970,7 @@ var require_discriminator = __commonJS((exports) => {
|
|
|
9970
9970
|
exports.default = def;
|
|
9971
9971
|
});
|
|
9972
9972
|
|
|
9973
|
-
//
|
|
9973
|
+
// node_modules/ajv/dist/refs/json-schema-draft-07.json
|
|
9974
9974
|
var require_json_schema_draft_07 = __commonJS((exports, module) => {
|
|
9975
9975
|
module.exports = {
|
|
9976
9976
|
$schema: "http://json-schema.org/draft-07/schema#",
|
|
@@ -10125,7 +10125,7 @@ var require_json_schema_draft_07 = __commonJS((exports, module) => {
|
|
|
10125
10125
|
};
|
|
10126
10126
|
});
|
|
10127
10127
|
|
|
10128
|
-
//
|
|
10128
|
+
// node_modules/ajv/dist/ajv.js
|
|
10129
10129
|
var require_ajv = __commonJS((exports, module) => {
|
|
10130
10130
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10131
10131
|
exports.MissingRefError = exports.ValidationError = exports.CodeGen = exports.Name = exports.nil = exports.stringify = exports.str = exports._ = exports.KeywordCxt = exports.Ajv = undefined;
|
|
@@ -10193,7 +10193,7 @@ var require_ajv = __commonJS((exports, module) => {
|
|
|
10193
10193
|
} });
|
|
10194
10194
|
});
|
|
10195
10195
|
|
|
10196
|
-
//
|
|
10196
|
+
// node_modules/ajv-formats/dist/formats.js
|
|
10197
10197
|
var require_formats = __commonJS((exports) => {
|
|
10198
10198
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10199
10199
|
exports.formatNames = exports.fastFormats = exports.fullFormats = undefined;
|
|
@@ -10370,7 +10370,7 @@ var require_formats = __commonJS((exports) => {
|
|
|
10370
10370
|
}
|
|
10371
10371
|
});
|
|
10372
10372
|
|
|
10373
|
-
//
|
|
10373
|
+
// node_modules/ajv-formats/dist/limit.js
|
|
10374
10374
|
var require_limit = __commonJS((exports) => {
|
|
10375
10375
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10376
10376
|
exports.formatLimitDefinition = undefined;
|
|
@@ -10439,7 +10439,7 @@ var require_limit = __commonJS((exports) => {
|
|
|
10439
10439
|
exports.default = formatLimitPlugin;
|
|
10440
10440
|
});
|
|
10441
10441
|
|
|
10442
|
-
//
|
|
10442
|
+
// node_modules/ajv-formats/dist/index.js
|
|
10443
10443
|
var require_dist = __commonJS((exports, module) => {
|
|
10444
10444
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10445
10445
|
var formats_1 = require_formats();
|
|
@@ -10478,14 +10478,14 @@ var require_dist = __commonJS((exports, module) => {
|
|
|
10478
10478
|
exports.default = formatsPlugin;
|
|
10479
10479
|
});
|
|
10480
10480
|
|
|
10481
|
-
//
|
|
10481
|
+
// node_modules/zod/index.js
|
|
10482
10482
|
var init_zod = __esm(() => {
|
|
10483
10483
|
init_external();
|
|
10484
10484
|
init_external();
|
|
10485
10485
|
});
|
|
10486
10486
|
|
|
10487
10487
|
// src/core/errors.ts
|
|
10488
|
-
var ConnectorDefinitionError;
|
|
10488
|
+
var ConnectorDefinitionError, ConnectorOperationNotFoundError;
|
|
10489
10489
|
var init_errors2 = __esm(() => {
|
|
10490
10490
|
ConnectorDefinitionError = class ConnectorDefinitionError extends Error {
|
|
10491
10491
|
code;
|
|
@@ -10495,6 +10495,16 @@ var init_errors2 = __esm(() => {
|
|
|
10495
10495
|
this.code = code;
|
|
10496
10496
|
}
|
|
10497
10497
|
};
|
|
10498
|
+
ConnectorOperationNotFoundError = class ConnectorOperationNotFoundError extends Error {
|
|
10499
|
+
connectorName;
|
|
10500
|
+
operationName;
|
|
10501
|
+
constructor(connectorName, operationName) {
|
|
10502
|
+
super(`Operation '${operationName}' not found on connector '${connectorName}'`);
|
|
10503
|
+
this.name = "ConnectorOperationNotFoundError";
|
|
10504
|
+
this.connectorName = connectorName;
|
|
10505
|
+
this.operationName = operationName;
|
|
10506
|
+
}
|
|
10507
|
+
};
|
|
10498
10508
|
});
|
|
10499
10509
|
|
|
10500
10510
|
// src/core/connector.ts
|
|
@@ -10536,11 +10546,34 @@ function defineConnector(definition) {
|
|
|
10536
10546
|
operations: normalizedOperations
|
|
10537
10547
|
};
|
|
10538
10548
|
}
|
|
10549
|
+
function listConnectorOperations(connector) {
|
|
10550
|
+
return Object.values(connector.operations).sort((a, b) => a.name.localeCompare(b.name));
|
|
10551
|
+
}
|
|
10552
|
+
function getConnectorOperation(connector, name) {
|
|
10553
|
+
return listConnectorOperations(connector).find((operation) => operation.name === name);
|
|
10554
|
+
}
|
|
10555
|
+
async function executeConnectorOperation(connector, args) {
|
|
10556
|
+
const operation = getConnectorOperation(connector, args.operation);
|
|
10557
|
+
if (!operation) {
|
|
10558
|
+
throw new ConnectorOperationNotFoundError(connector.meta.name, args.operation);
|
|
10559
|
+
}
|
|
10560
|
+
const context = connector.createContext ? await connector.createContext({
|
|
10561
|
+
credentials: args.credentials,
|
|
10562
|
+
profile: args.profile
|
|
10563
|
+
}) : undefined;
|
|
10564
|
+
const parsedInput = operation.inputSchema ? operation.inputSchema.parse(args.input ?? {}) : args.input ?? {};
|
|
10565
|
+
return operation.execute({
|
|
10566
|
+
connector,
|
|
10567
|
+
context,
|
|
10568
|
+
profile: args.profile,
|
|
10569
|
+
credentials: args.credentials
|
|
10570
|
+
}, parsedInput);
|
|
10571
|
+
}
|
|
10539
10572
|
var CONNECTOR_NAME_RE, OPERATION_NAME_RE;
|
|
10540
10573
|
var init_connector = __esm(() => {
|
|
10541
10574
|
init_errors2();
|
|
10542
10575
|
CONNECTOR_NAME_RE = /^[a-z0-9-]+$/;
|
|
10543
|
-
OPERATION_NAME_RE = /^[a-z0-9
|
|
10576
|
+
OPERATION_NAME_RE = /^[a-z0-9:._-]+$/;
|
|
10544
10577
|
});
|
|
10545
10578
|
|
|
10546
10579
|
// src/core/registry.ts
|
|
@@ -11438,12 +11471,305 @@ Commands:
|
|
|
11438
11471
|
});
|
|
11439
11472
|
});
|
|
11440
11473
|
|
|
11474
|
+
// src/core/connectors/googledrive.ts
|
|
11475
|
+
import { existsSync as existsSync2, mkdirSync, readFileSync, readdirSync, writeFileSync } from "fs";
|
|
11476
|
+
import { homedir } from "os";
|
|
11477
|
+
import { basename, join as join2 } from "path";
|
|
11478
|
+
async function requestJson(profile, path, params) {
|
|
11479
|
+
const response = await request(profile, path, params);
|
|
11480
|
+
const text = await response.text();
|
|
11481
|
+
return text ? JSON.parse(text) : {};
|
|
11482
|
+
}
|
|
11483
|
+
async function requestBinary(profile, path, params) {
|
|
11484
|
+
return (await request(profile, path, params)).arrayBuffer();
|
|
11485
|
+
}
|
|
11486
|
+
async function request(profile, path, params) {
|
|
11487
|
+
const token = await getValidAccessToken(profile);
|
|
11488
|
+
const url = new URL(`${DRIVE_API_BASE}${path}`);
|
|
11489
|
+
for (const [key, value] of Object.entries(params)) {
|
|
11490
|
+
if (value !== undefined && value !== null && value !== "")
|
|
11491
|
+
url.searchParams.set(key, String(value));
|
|
11492
|
+
}
|
|
11493
|
+
const response = await fetch(url, { headers: { Authorization: `Bearer ${token}`, Accept: "application/json" } });
|
|
11494
|
+
if (!response.ok) {
|
|
11495
|
+
const body = await response.text().catch(() => "");
|
|
11496
|
+
throw new Error(`Google Drive request failed (${response.status}): ${extractGoogleError(body) || response.statusText}`);
|
|
11497
|
+
}
|
|
11498
|
+
return response;
|
|
11499
|
+
}
|
|
11500
|
+
async function getValidAccessToken(profile) {
|
|
11501
|
+
if (process.env.GOOGLE_ACCESS_TOKEN)
|
|
11502
|
+
return process.env.GOOGLE_ACCESS_TOKEN;
|
|
11503
|
+
const tokens = loadTokens(profile);
|
|
11504
|
+
if (!tokens?.accessToken && !tokens?.refreshToken) {
|
|
11505
|
+
throw new Error(`Google Drive profile "${profile}" is not authenticated. Run: connectors auth googledrive`);
|
|
11506
|
+
}
|
|
11507
|
+
if (tokens.accessToken && (!tokens.expiresAt || Date.now() < tokens.expiresAt - REFRESH_BUFFER_MS))
|
|
11508
|
+
return tokens.accessToken;
|
|
11509
|
+
if (!tokens.refreshToken)
|
|
11510
|
+
return tokens.accessToken ?? "";
|
|
11511
|
+
return (await refreshAccessToken(profile, tokens)).accessToken ?? "";
|
|
11512
|
+
}
|
|
11513
|
+
async function refreshAccessToken(profile, currentTokens) {
|
|
11514
|
+
const credentials = loadCredentials(profile);
|
|
11515
|
+
if (!credentials.clientId || !credentials.clientSecret)
|
|
11516
|
+
throw new Error("Google Drive OAuth credentials are not configured. Run: connectors auth googledrive");
|
|
11517
|
+
if (!currentTokens.refreshToken)
|
|
11518
|
+
throw new Error(`Google Drive profile "${profile}" has no refresh token. Run: connectors auth googledrive`);
|
|
11519
|
+
const response = await fetch(TOKEN_URL, {
|
|
11520
|
+
method: "POST",
|
|
11521
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
11522
|
+
body: new URLSearchParams({
|
|
11523
|
+
client_id: credentials.clientId,
|
|
11524
|
+
client_secret: credentials.clientSecret,
|
|
11525
|
+
refresh_token: currentTokens.refreshToken,
|
|
11526
|
+
grant_type: "refresh_token"
|
|
11527
|
+
})
|
|
11528
|
+
});
|
|
11529
|
+
const data = await response.json().catch(() => ({}));
|
|
11530
|
+
if (!response.ok || !data.access_token)
|
|
11531
|
+
throw new Error(`Google Drive token refresh failed: ${data.error_description || data.error || response.statusText}`);
|
|
11532
|
+
const tokens = {
|
|
11533
|
+
accessToken: data.access_token,
|
|
11534
|
+
refreshToken: currentTokens.refreshToken,
|
|
11535
|
+
expiresAt: Date.now() + (data.expires_in ?? 3600) * 1000,
|
|
11536
|
+
tokenType: data.token_type ?? currentTokens.tokenType,
|
|
11537
|
+
scope: data.scope ?? currentTokens.scope
|
|
11538
|
+
};
|
|
11539
|
+
saveTokens(profile, tokens);
|
|
11540
|
+
return tokens;
|
|
11541
|
+
}
|
|
11542
|
+
function listProfiles() {
|
|
11543
|
+
const profiles = new Set;
|
|
11544
|
+
for (const baseDir of configDirs()) {
|
|
11545
|
+
const profilesDir = join2(baseDir, "profiles");
|
|
11546
|
+
if (!existsSync2(profilesDir))
|
|
11547
|
+
continue;
|
|
11548
|
+
for (const entry of readdirSync(profilesDir, { withFileTypes: true })) {
|
|
11549
|
+
if (entry.isDirectory())
|
|
11550
|
+
profiles.add(entry.name);
|
|
11551
|
+
if (entry.isFile() && entry.name.endsWith(".json"))
|
|
11552
|
+
profiles.add(basename(entry.name, ".json"));
|
|
11553
|
+
}
|
|
11554
|
+
}
|
|
11555
|
+
return Array.from(profiles).sort((a, b) => a.localeCompare(b));
|
|
11556
|
+
}
|
|
11557
|
+
function loadCredentials(profile) {
|
|
11558
|
+
const envClientId = process.env.GOOGLE_CLIENT_ID;
|
|
11559
|
+
const envClientSecret = process.env.GOOGLE_CLIENT_SECRET;
|
|
11560
|
+
if (envClientId && envClientSecret)
|
|
11561
|
+
return { clientId: envClientId, clientSecret: envClientSecret };
|
|
11562
|
+
for (const baseDir of configDirs()) {
|
|
11563
|
+
const credentials = {
|
|
11564
|
+
...readJson(join2(baseDir, "credentials.json")),
|
|
11565
|
+
...readJson(join2(baseDir, "profiles", profile, "config.json"))
|
|
11566
|
+
};
|
|
11567
|
+
if (credentials.clientId || credentials.clientSecret)
|
|
11568
|
+
return credentials;
|
|
11569
|
+
}
|
|
11570
|
+
return {};
|
|
11571
|
+
}
|
|
11572
|
+
function loadTokens(profile) {
|
|
11573
|
+
for (const baseDir of configDirs()) {
|
|
11574
|
+
const fromProfile = readJson(join2(baseDir, "profiles", profile, "tokens.json"));
|
|
11575
|
+
if (fromProfile)
|
|
11576
|
+
return fromProfile;
|
|
11577
|
+
const flat = readJson(join2(baseDir, "profiles", `${profile}.json`));
|
|
11578
|
+
if (flat)
|
|
11579
|
+
return flat.tokens ?? (flat.accessToken || flat.refreshToken ? flat : null);
|
|
11580
|
+
}
|
|
11581
|
+
return null;
|
|
11582
|
+
}
|
|
11583
|
+
function saveTokens(profile, tokens) {
|
|
11584
|
+
const baseDir = configDirs().find((dir) => existsSync2(dir)) ?? configDirs()[0];
|
|
11585
|
+
const profileDir = join2(baseDir, "profiles", profile);
|
|
11586
|
+
mkdirSync(profileDir, { recursive: true });
|
|
11587
|
+
writeFileSync(join2(profileDir, "tokens.json"), JSON.stringify(tokens, null, 2), { mode: 384 });
|
|
11588
|
+
}
|
|
11589
|
+
function configDirs() {
|
|
11590
|
+
const explicit = process.env.HASNA_GOOGLE_DRIVE_CONNECTOR_DIR ?? process.env.GOOGLE_DRIVE_CONNECTOR_DIR;
|
|
11591
|
+
if (explicit)
|
|
11592
|
+
return [explicit];
|
|
11593
|
+
const baseDir = process.env.HASNA_CONNECTORS_DIR ?? join2(homedir(), ".hasna", "connectors");
|
|
11594
|
+
return [join2(baseDir, "connect-googledrive"), join2(baseDir, "googledrive")];
|
|
11595
|
+
}
|
|
11596
|
+
function readJson(path) {
|
|
11597
|
+
if (!existsSync2(path))
|
|
11598
|
+
return null;
|
|
11599
|
+
try {
|
|
11600
|
+
return JSON.parse(readFileSync(path, "utf8"));
|
|
11601
|
+
} catch {
|
|
11602
|
+
return null;
|
|
11603
|
+
}
|
|
11604
|
+
}
|
|
11605
|
+
function defaultExportMimeType(googleMimeType) {
|
|
11606
|
+
if (googleMimeType.endsWith(".document"))
|
|
11607
|
+
return DEFAULT_EXPORT_FORMATS.document;
|
|
11608
|
+
if (googleMimeType.endsWith(".spreadsheet"))
|
|
11609
|
+
return DEFAULT_EXPORT_FORMATS.spreadsheet;
|
|
11610
|
+
if (googleMimeType.endsWith(".presentation"))
|
|
11611
|
+
return DEFAULT_EXPORT_FORMATS.presentation;
|
|
11612
|
+
if (googleMimeType.endsWith(".drawing"))
|
|
11613
|
+
return DEFAULT_EXPORT_FORMATS.drawing;
|
|
11614
|
+
throw new Error(`Cannot export Google Workspace file type: ${googleMimeType}`);
|
|
11615
|
+
}
|
|
11616
|
+
function extensionForMimeType(mimeType) {
|
|
11617
|
+
return EXPORT_EXTENSIONS[mimeType] ?? "";
|
|
11618
|
+
}
|
|
11619
|
+
function extractGoogleError(body) {
|
|
11620
|
+
if (!body)
|
|
11621
|
+
return "";
|
|
11622
|
+
try {
|
|
11623
|
+
const parsed = JSON.parse(body);
|
|
11624
|
+
return parsed.error?.message ?? body;
|
|
11625
|
+
} catch {
|
|
11626
|
+
return body;
|
|
11627
|
+
}
|
|
11628
|
+
}
|
|
11629
|
+
var DRIVE_API_BASE = "https://www.googleapis.com/drive/v3", TOKEN_URL = "https://oauth2.googleapis.com/token", REFRESH_BUFFER_MS, DEFAULT_FILE_FIELDS, DEFAULT_EXPORT_FORMATS, EXPORT_EXTENSIONS, listFilesSchema, listDrivesSchema, fileIdSchema, downloadSchema, googleDriveConnector;
|
|
11630
|
+
var init_googledrive = __esm(() => {
|
|
11631
|
+
init_zod();
|
|
11632
|
+
init_connector();
|
|
11633
|
+
REFRESH_BUFFER_MS = 5 * 60 * 1000;
|
|
11634
|
+
DEFAULT_FILE_FIELDS = [
|
|
11635
|
+
"id",
|
|
11636
|
+
"name",
|
|
11637
|
+
"mimeType",
|
|
11638
|
+
"parents",
|
|
11639
|
+
"version",
|
|
11640
|
+
"md5Checksum",
|
|
11641
|
+
"size",
|
|
11642
|
+
"modifiedTime",
|
|
11643
|
+
"createdTime",
|
|
11644
|
+
"trashed",
|
|
11645
|
+
"webViewLink",
|
|
11646
|
+
"webContentLink"
|
|
11647
|
+
].join(",");
|
|
11648
|
+
DEFAULT_EXPORT_FORMATS = {
|
|
11649
|
+
document: "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
|
|
11650
|
+
spreadsheet: "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
|
|
11651
|
+
presentation: "application/vnd.openxmlformats-officedocument.presentationml.presentation",
|
|
11652
|
+
drawing: "image/png"
|
|
11653
|
+
};
|
|
11654
|
+
EXPORT_EXTENSIONS = {
|
|
11655
|
+
"application/vnd.openxmlformats-officedocument.wordprocessingml.document": ".docx",
|
|
11656
|
+
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet": ".xlsx",
|
|
11657
|
+
"application/vnd.openxmlformats-officedocument.presentationml.presentation": ".pptx",
|
|
11658
|
+
"application/pdf": ".pdf",
|
|
11659
|
+
"text/plain": ".txt",
|
|
11660
|
+
"text/csv": ".csv",
|
|
11661
|
+
"image/png": ".png",
|
|
11662
|
+
"image/jpeg": ".jpg",
|
|
11663
|
+
"image/svg+xml": ".svg"
|
|
11664
|
+
};
|
|
11665
|
+
listFilesSchema = exports_external.object({
|
|
11666
|
+
pageSize: exports_external.coerce.number().int().positive().max(1000).optional(),
|
|
11667
|
+
pageToken: exports_external.string().optional(),
|
|
11668
|
+
q: exports_external.string().optional(),
|
|
11669
|
+
fields: exports_external.string().optional(),
|
|
11670
|
+
orderBy: exports_external.string().optional(),
|
|
11671
|
+
corpora: exports_external.enum(["user", "drive", "allDrives"]).optional(),
|
|
11672
|
+
driveId: exports_external.string().optional(),
|
|
11673
|
+
supportsAllDrives: exports_external.boolean().optional(),
|
|
11674
|
+
includeItemsFromAllDrives: exports_external.boolean().optional()
|
|
11675
|
+
});
|
|
11676
|
+
listDrivesSchema = exports_external.object({
|
|
11677
|
+
pageSize: exports_external.coerce.number().int().positive().max(100).optional(),
|
|
11678
|
+
pageToken: exports_external.string().optional(),
|
|
11679
|
+
q: exports_external.string().optional()
|
|
11680
|
+
});
|
|
11681
|
+
fileIdSchema = exports_external.object({
|
|
11682
|
+
fileId: exports_external.string(),
|
|
11683
|
+
fields: exports_external.string().optional()
|
|
11684
|
+
});
|
|
11685
|
+
downloadSchema = exports_external.object({
|
|
11686
|
+
fileId: exports_external.string(),
|
|
11687
|
+
file: exports_external.object({
|
|
11688
|
+
id: exports_external.string(),
|
|
11689
|
+
name: exports_external.string(),
|
|
11690
|
+
mimeType: exports_external.string()
|
|
11691
|
+
}).optional(),
|
|
11692
|
+
exportMimeType: exports_external.string().optional()
|
|
11693
|
+
});
|
|
11694
|
+
googleDriveConnector = defineConnector({
|
|
11695
|
+
meta: {
|
|
11696
|
+
name: "googledrive",
|
|
11697
|
+
displayName: "Google Drive",
|
|
11698
|
+
description: "Profile-aware Google Drive discovery and file download operations.",
|
|
11699
|
+
category: "storage",
|
|
11700
|
+
tags: ["google", "drive", "files", "storage"]
|
|
11701
|
+
},
|
|
11702
|
+
auth: {
|
|
11703
|
+
type: "oauth2",
|
|
11704
|
+
supportsProfiles: true,
|
|
11705
|
+
fields: [
|
|
11706
|
+
{ key: "clientId", env: "GOOGLE_CLIENT_ID", label: "OAuth client ID" },
|
|
11707
|
+
{ key: "clientSecret", env: "GOOGLE_CLIENT_SECRET", label: "OAuth client secret", secret: true }
|
|
11708
|
+
]
|
|
11709
|
+
},
|
|
11710
|
+
createContext: ({ profile }) => ({ profile: profile || "default" }),
|
|
11711
|
+
operations: {
|
|
11712
|
+
"profiles.list": {
|
|
11713
|
+
summary: "List configured Google Drive profiles.",
|
|
11714
|
+
execute: () => ({ profiles: listProfiles() })
|
|
11715
|
+
},
|
|
11716
|
+
"files.list": {
|
|
11717
|
+
summary: "List Google Drive files.",
|
|
11718
|
+
inputSchema: listFilesSchema,
|
|
11719
|
+
execute: async ({ context }, input) => requestJson(context.profile, "/files", {
|
|
11720
|
+
pageSize: input.pageSize ?? 1000,
|
|
11721
|
+
pageToken: input.pageToken,
|
|
11722
|
+
q: input.q,
|
|
11723
|
+
fields: input.fields ?? `nextPageToken,files(${DEFAULT_FILE_FIELDS})`,
|
|
11724
|
+
orderBy: input.orderBy ?? "modifiedTime desc",
|
|
11725
|
+
corpora: input.corpora,
|
|
11726
|
+
driveId: input.driveId,
|
|
11727
|
+
supportsAllDrives: input.supportsAllDrives ?? true,
|
|
11728
|
+
includeItemsFromAllDrives: input.includeItemsFromAllDrives ?? false
|
|
11729
|
+
})
|
|
11730
|
+
},
|
|
11731
|
+
"files.get": {
|
|
11732
|
+
summary: "Get Google Drive file metadata.",
|
|
11733
|
+
inputSchema: fileIdSchema,
|
|
11734
|
+
execute: async ({ context }, input) => requestJson(context.profile, `/files/${encodeURIComponent(input.fileId)}`, {
|
|
11735
|
+
fields: input.fields ?? DEFAULT_FILE_FIELDS,
|
|
11736
|
+
supportsAllDrives: true
|
|
11737
|
+
})
|
|
11738
|
+
},
|
|
11739
|
+
"files.download": {
|
|
11740
|
+
summary: "Download or export a Google Drive file as base64 content.",
|
|
11741
|
+
inputSchema: downloadSchema,
|
|
11742
|
+
execute: async ({ context }, input) => {
|
|
11743
|
+
const file = input.file ?? await requestJson(context.profile, `/files/${encodeURIComponent(input.fileId)}`, { fields: DEFAULT_FILE_FIELDS, supportsAllDrives: true });
|
|
11744
|
+
const exportMimeType = file.mimeType.startsWith("application/vnd.google-apps.") ? input.exportMimeType ?? defaultExportMimeType(file.mimeType) : undefined;
|
|
11745
|
+
const data = await requestBinary(context.profile, exportMimeType ? `/files/${encodeURIComponent(file.id)}/export` : `/files/${encodeURIComponent(file.id)}`, exportMimeType ? { mimeType: exportMimeType, supportsAllDrives: true } : { alt: "media", supportsAllDrives: true });
|
|
11746
|
+
const mimeType = exportMimeType ?? file.mimeType ?? "application/octet-stream";
|
|
11747
|
+
return {
|
|
11748
|
+
dataBase64: Buffer.from(data).toString("base64"),
|
|
11749
|
+
filename: exportMimeType ? `${file.name}${extensionForMimeType(exportMimeType)}` : file.name,
|
|
11750
|
+
mimeType
|
|
11751
|
+
};
|
|
11752
|
+
}
|
|
11753
|
+
},
|
|
11754
|
+
"drives.list": {
|
|
11755
|
+
summary: "List Google shared drives.",
|
|
11756
|
+
inputSchema: listDrivesSchema,
|
|
11757
|
+
execute: async ({ context }, input) => requestJson(context.profile, "/drives", {
|
|
11758
|
+
pageSize: input.pageSize ?? 100,
|
|
11759
|
+
pageToken: input.pageToken,
|
|
11760
|
+
q: input.q
|
|
11761
|
+
})
|
|
11762
|
+
}
|
|
11763
|
+
}
|
|
11764
|
+
});
|
|
11765
|
+
});
|
|
11766
|
+
|
|
11441
11767
|
// package.json
|
|
11442
11768
|
var package_default;
|
|
11443
11769
|
var init_package = __esm(() => {
|
|
11444
11770
|
package_default = {
|
|
11445
11771
|
name: "@hasna/connectors",
|
|
11446
|
-
version: "1.3.
|
|
11772
|
+
version: "1.3.25",
|
|
11447
11773
|
description: "Open source connector library - Install API connectors with a single command",
|
|
11448
11774
|
type: "module",
|
|
11449
11775
|
bin: {
|
|
@@ -11530,22 +11856,22 @@ var init_package = __esm(() => {
|
|
|
11530
11856
|
};
|
|
11531
11857
|
});
|
|
11532
11858
|
|
|
11533
|
-
//
|
|
11859
|
+
// node_modules/@hasna/cloud/dist/index.js
|
|
11534
11860
|
import { createRequire } from "module";
|
|
11535
11861
|
import { Database } from "bun:sqlite";
|
|
11536
11862
|
import {
|
|
11537
|
-
existsSync as
|
|
11538
|
-
mkdirSync,
|
|
11539
|
-
readdirSync,
|
|
11863
|
+
existsSync as existsSync3,
|
|
11864
|
+
mkdirSync as mkdirSync2,
|
|
11865
|
+
readdirSync as readdirSync2,
|
|
11540
11866
|
copyFileSync
|
|
11541
11867
|
} from "fs";
|
|
11542
|
-
import { homedir } from "os";
|
|
11543
|
-
import { join as join2, relative } from "path";
|
|
11544
|
-
import { existsSync as existsSync22, mkdirSync as mkdirSync2, readFileSync, writeFileSync } from "fs";
|
|
11545
11868
|
import { homedir as homedir2 } from "os";
|
|
11869
|
+
import { join as join3, relative } from "path";
|
|
11870
|
+
import { existsSync as existsSync22, mkdirSync as mkdirSync22, readFileSync as readFileSync2, writeFileSync as writeFileSync2 } from "fs";
|
|
11871
|
+
import { homedir as homedir22 } from "os";
|
|
11546
11872
|
import { join as join22 } from "path";
|
|
11547
|
-
import { readdirSync as
|
|
11548
|
-
import { join as
|
|
11873
|
+
import { readdirSync as readdirSync22, existsSync as existsSync32 } from "fs";
|
|
11874
|
+
import { join as join32 } from "path";
|
|
11549
11875
|
import { homedir as homedir3 } from "os";
|
|
11550
11876
|
import { hostname as hostname2 } from "os";
|
|
11551
11877
|
import { homedir as homedir4 } from "os";
|
|
@@ -12422,13 +12748,13 @@ function custom3(check2, _params = {}, fatal) {
|
|
|
12422
12748
|
return ZodAny2.create();
|
|
12423
12749
|
}
|
|
12424
12750
|
function getDataDir(serviceName) {
|
|
12425
|
-
const dir =
|
|
12426
|
-
|
|
12751
|
+
const dir = join3(HASNA_DIR, serviceName);
|
|
12752
|
+
mkdirSync2(dir, { recursive: true });
|
|
12427
12753
|
return dir;
|
|
12428
12754
|
}
|
|
12429
12755
|
function getDbPath(serviceName) {
|
|
12430
12756
|
const dir = getDataDir(serviceName);
|
|
12431
|
-
return
|
|
12757
|
+
return join3(dir, `${serviceName}.db`);
|
|
12432
12758
|
}
|
|
12433
12759
|
function getConfigDir() {
|
|
12434
12760
|
return CONFIG_DIR;
|
|
@@ -12441,15 +12767,15 @@ function getCloudConfig() {
|
|
|
12441
12767
|
return CloudConfigSchema.parse({});
|
|
12442
12768
|
}
|
|
12443
12769
|
try {
|
|
12444
|
-
const raw =
|
|
12770
|
+
const raw = readFileSync2(CONFIG_PATH, "utf-8");
|
|
12445
12771
|
return CloudConfigSchema.parse(JSON.parse(raw));
|
|
12446
12772
|
} catch {
|
|
12447
12773
|
return CloudConfigSchema.parse({});
|
|
12448
12774
|
}
|
|
12449
12775
|
}
|
|
12450
12776
|
function saveCloudConfig(config2) {
|
|
12451
|
-
|
|
12452
|
-
|
|
12777
|
+
mkdirSync22(CONFIG_DIR, { recursive: true });
|
|
12778
|
+
writeFileSync2(CONFIG_PATH, JSON.stringify(config2, null, 2) + `
|
|
12453
12779
|
`, "utf-8");
|
|
12454
12780
|
}
|
|
12455
12781
|
function getConnectionString(dbName) {
|
|
@@ -12479,11 +12805,11 @@ function isSyncExcludedTable(table) {
|
|
|
12479
12805
|
return SYNC_EXCLUDED_TABLE_PATTERNS.some((p) => p.test(table));
|
|
12480
12806
|
}
|
|
12481
12807
|
function discoverServices() {
|
|
12482
|
-
const dataDir =
|
|
12483
|
-
if (!
|
|
12808
|
+
const dataDir = join32(homedir3(), ".hasna");
|
|
12809
|
+
if (!existsSync32(dataDir))
|
|
12484
12810
|
return [];
|
|
12485
12811
|
try {
|
|
12486
|
-
const entries =
|
|
12812
|
+
const entries = readdirSync22(dataDir, { withFileTypes: true });
|
|
12487
12813
|
return entries.filter((e) => {
|
|
12488
12814
|
if (!e.isDirectory())
|
|
12489
12815
|
return false;
|
|
@@ -12501,24 +12827,24 @@ function discoverSyncableServices() {
|
|
|
12501
12827
|
return local.filter((s) => pgSet.has(s));
|
|
12502
12828
|
}
|
|
12503
12829
|
function getServiceDbPath(service) {
|
|
12504
|
-
const dataDir =
|
|
12505
|
-
if (!
|
|
12830
|
+
const dataDir = join32(homedir3(), ".hasna", service);
|
|
12831
|
+
if (!existsSync32(dataDir))
|
|
12506
12832
|
return null;
|
|
12507
12833
|
const candidates = [
|
|
12508
|
-
|
|
12509
|
-
|
|
12510
|
-
|
|
12834
|
+
join32(dataDir, `${service}.db`),
|
|
12835
|
+
join32(dataDir, "data.db"),
|
|
12836
|
+
join32(dataDir, "database.db")
|
|
12511
12837
|
];
|
|
12512
12838
|
try {
|
|
12513
|
-
const files =
|
|
12839
|
+
const files = readdirSync22(dataDir);
|
|
12514
12840
|
for (const f of files) {
|
|
12515
12841
|
if (f.endsWith(".db") && !f.endsWith("-wal") && !f.endsWith("-shm")) {
|
|
12516
|
-
candidates.push(
|
|
12842
|
+
candidates.push(join32(dataDir, f));
|
|
12517
12843
|
}
|
|
12518
12844
|
}
|
|
12519
12845
|
} catch {}
|
|
12520
12846
|
for (const p of candidates) {
|
|
12521
|
-
if (
|
|
12847
|
+
if (existsSync32(p))
|
|
12522
12848
|
return p;
|
|
12523
12849
|
}
|
|
12524
12850
|
return null;
|
|
@@ -21445,7 +21771,7 @@ See https://www.postgresql.org/docs/current/libpq-ssl.html for libpq SSL mode de
|
|
|
21445
21771
|
init_external2();
|
|
21446
21772
|
});
|
|
21447
21773
|
init_dotfile = __esm2(() => {
|
|
21448
|
-
HASNA_DIR =
|
|
21774
|
+
HASNA_DIR = join3(homedir2(), ".hasna");
|
|
21449
21775
|
});
|
|
21450
21776
|
exports_config = {};
|
|
21451
21777
|
__export2(exports_config, {
|
|
@@ -21476,7 +21802,7 @@ See https://www.postgresql.org/docs/current/libpq-ssl.html for libpq SSL mode de
|
|
|
21476
21802
|
schedule_minutes: exports_external2.number().default(0)
|
|
21477
21803
|
}).default({})
|
|
21478
21804
|
});
|
|
21479
|
-
CONFIG_DIR = join22(
|
|
21805
|
+
CONFIG_DIR = join22(homedir22(), ".hasna", "cloud");
|
|
21480
21806
|
CONFIG_PATH = join22(CONFIG_DIR, "config.json");
|
|
21481
21807
|
});
|
|
21482
21808
|
exports_discover = {};
|
|
@@ -21747,13 +22073,13 @@ var init_database = __esm(() => {
|
|
|
21747
22073
|
|
|
21748
22074
|
// src/core/connectors/imessage.ts
|
|
21749
22075
|
import {
|
|
21750
|
-
existsSync as
|
|
21751
|
-
mkdirSync as
|
|
21752
|
-
readFileSync as
|
|
21753
|
-
readdirSync as
|
|
22076
|
+
existsSync as existsSync5,
|
|
22077
|
+
mkdirSync as mkdirSync4,
|
|
22078
|
+
readFileSync as readFileSync3,
|
|
22079
|
+
readdirSync as readdirSync4,
|
|
21754
22080
|
rmSync,
|
|
21755
22081
|
statSync as statSync2,
|
|
21756
|
-
writeFileSync as
|
|
22082
|
+
writeFileSync as writeFileSync3
|
|
21757
22083
|
} from "fs";
|
|
21758
22084
|
import { join as join7 } from "path";
|
|
21759
22085
|
function buildRootHelp(specs) {
|
|
@@ -21807,19 +22133,19 @@ function getProfilesDir() {
|
|
|
21807
22133
|
}
|
|
21808
22134
|
function getCurrentProfile() {
|
|
21809
22135
|
const currentProfileFile = join7(getConfigDir2(), "current_profile");
|
|
21810
|
-
if (!
|
|
22136
|
+
if (!existsSync5(currentProfileFile)) {
|
|
21811
22137
|
return "default";
|
|
21812
22138
|
}
|
|
21813
22139
|
try {
|
|
21814
|
-
return
|
|
22140
|
+
return readFileSync3(currentProfileFile, "utf-8").trim() || "default";
|
|
21815
22141
|
} catch {
|
|
21816
22142
|
return "default";
|
|
21817
22143
|
}
|
|
21818
22144
|
}
|
|
21819
22145
|
function setCurrentProfile(profile) {
|
|
21820
22146
|
const configDir = getConfigDir2();
|
|
21821
|
-
|
|
21822
|
-
|
|
22147
|
+
mkdirSync4(configDir, { recursive: true });
|
|
22148
|
+
writeFileSync3(join7(configDir, "current_profile"), profile);
|
|
21823
22149
|
}
|
|
21824
22150
|
function getFlatProfilePath(profile) {
|
|
21825
22151
|
return join7(getProfilesDir(), `${profile}.json`);
|
|
@@ -21829,7 +22155,7 @@ function getDirectoryProfilePath(profile) {
|
|
|
21829
22155
|
}
|
|
21830
22156
|
function loadJsonFile(path) {
|
|
21831
22157
|
try {
|
|
21832
|
-
return JSON.parse(
|
|
22158
|
+
return JSON.parse(readFileSync3(path, "utf-8"));
|
|
21833
22159
|
} catch {
|
|
21834
22160
|
return {};
|
|
21835
22161
|
}
|
|
@@ -21845,8 +22171,8 @@ function sanitizeProfileConfig(config2) {
|
|
|
21845
22171
|
};
|
|
21846
22172
|
}
|
|
21847
22173
|
function loadProfile(profile = getCurrentProfile()) {
|
|
21848
|
-
const flatConfig =
|
|
21849
|
-
const directoryConfig =
|
|
22174
|
+
const flatConfig = existsSync5(getFlatProfilePath(profile)) ? loadJsonFile(getFlatProfilePath(profile)) : {};
|
|
22175
|
+
const directoryConfig = existsSync5(getDirectoryProfilePath(profile)) ? loadJsonFile(getDirectoryProfilePath(profile)) : {};
|
|
21850
22176
|
return sanitizeProfileConfig({
|
|
21851
22177
|
...flatConfig,
|
|
21852
22178
|
...directoryConfig
|
|
@@ -21854,24 +22180,24 @@ function loadProfile(profile = getCurrentProfile()) {
|
|
|
21854
22180
|
}
|
|
21855
22181
|
function writeProfile(profile, config2) {
|
|
21856
22182
|
const profilesDir = getProfilesDir();
|
|
21857
|
-
|
|
21858
|
-
|
|
22183
|
+
mkdirSync4(profilesDir, { recursive: true });
|
|
22184
|
+
writeFileSync3(getFlatProfilePath(profile), JSON.stringify(config2, null, 2) + `
|
|
21859
22185
|
`);
|
|
21860
22186
|
}
|
|
21861
22187
|
function profileExists(profile) {
|
|
21862
22188
|
if (profile === "default") {
|
|
21863
22189
|
return true;
|
|
21864
22190
|
}
|
|
21865
|
-
return
|
|
22191
|
+
return existsSync5(getFlatProfilePath(profile)) || existsSync5(join7(getProfilesDir(), profile));
|
|
21866
22192
|
}
|
|
21867
|
-
function
|
|
22193
|
+
function listProfiles2() {
|
|
21868
22194
|
const profilesDir = getProfilesDir();
|
|
21869
22195
|
const seen = new Set(["default"]);
|
|
21870
|
-
if (!
|
|
22196
|
+
if (!existsSync5(profilesDir)) {
|
|
21871
22197
|
return [...seen];
|
|
21872
22198
|
}
|
|
21873
22199
|
try {
|
|
21874
|
-
for (const entry of
|
|
22200
|
+
for (const entry of readdirSync4(profilesDir)) {
|
|
21875
22201
|
const fullPath = join7(profilesDir, entry);
|
|
21876
22202
|
const stat = statSync2(fullPath);
|
|
21877
22203
|
if (stat.isDirectory()) {
|
|
@@ -21894,10 +22220,10 @@ function createProfile(profile, config2 = {}) {
|
|
|
21894
22220
|
function clearProfile(profile = getCurrentProfile()) {
|
|
21895
22221
|
const flatPath = getFlatProfilePath(profile);
|
|
21896
22222
|
const directoryPath = join7(getProfilesDir(), profile);
|
|
21897
|
-
if (
|
|
22223
|
+
if (existsSync5(flatPath)) {
|
|
21898
22224
|
rmSync(flatPath);
|
|
21899
22225
|
}
|
|
21900
|
-
if (
|
|
22226
|
+
if (existsSync5(directoryPath)) {
|
|
21901
22227
|
rmSync(directoryPath, { recursive: true, force: true });
|
|
21902
22228
|
}
|
|
21903
22229
|
}
|
|
@@ -22307,7 +22633,7 @@ async function runProfileCommand2(args, context) {
|
|
|
22307
22633
|
switch (subcommand) {
|
|
22308
22634
|
case "list": {
|
|
22309
22635
|
const current = getCurrentProfile();
|
|
22310
|
-
const profiles =
|
|
22636
|
+
const profiles = listProfiles2();
|
|
22311
22637
|
return successOutput({ current, profiles }, context.format, () => profiles.map((profile) => `${profile}${profile === current ? " (active)" : ""}`).join(`
|
|
22312
22638
|
`));
|
|
22313
22639
|
}
|
|
@@ -22823,7 +23149,7 @@ var init_imessage = __esm(() => {
|
|
|
22823
23149
|
});
|
|
22824
23150
|
|
|
22825
23151
|
// src/core/connectors/stripe.ts
|
|
22826
|
-
import { existsSync as
|
|
23152
|
+
import { existsSync as existsSync6 } from "fs";
|
|
22827
23153
|
import { dirname as dirname4, join as join8 } from "path";
|
|
22828
23154
|
import { fileURLToPath as fileURLToPath2, pathToFileURL as pathToFileURL2 } from "url";
|
|
22829
23155
|
function resolveStripeConnectorDir() {
|
|
@@ -22834,7 +23160,7 @@ function resolveStripeConnectorDir() {
|
|
|
22834
23160
|
join8(process.cwd(), "connectors", "connect-stripe")
|
|
22835
23161
|
];
|
|
22836
23162
|
for (const candidate of candidates) {
|
|
22837
|
-
if (
|
|
23163
|
+
if (existsSync6(candidate)) {
|
|
22838
23164
|
return candidate;
|
|
22839
23165
|
}
|
|
22840
23166
|
}
|
|
@@ -23706,10 +24032,12 @@ var INTERNAL_CONNECTOR_DEFINITIONS, INTERNAL_CONNECTOR_REGISTRY;
|
|
|
23706
24032
|
var init_builtins = __esm(() => {
|
|
23707
24033
|
init_registry();
|
|
23708
24034
|
init_github();
|
|
24035
|
+
init_googledrive();
|
|
23709
24036
|
init_imessage();
|
|
23710
24037
|
init_stripe();
|
|
23711
24038
|
INTERNAL_CONNECTOR_DEFINITIONS = [
|
|
23712
24039
|
githubConnector,
|
|
24040
|
+
googleDriveConnector,
|
|
23713
24041
|
imessageConnector,
|
|
23714
24042
|
stripeConnector
|
|
23715
24043
|
];
|
|
@@ -23727,25 +24055,25 @@ __export(exports_llm, {
|
|
|
23727
24055
|
PROVIDER_DEFAULTS: () => PROVIDER_DEFAULTS,
|
|
23728
24056
|
LLMClient: () => LLMClient
|
|
23729
24057
|
});
|
|
23730
|
-
import { existsSync as
|
|
24058
|
+
import { existsSync as existsSync8, readFileSync as readFileSync5, writeFileSync as writeFileSync4, mkdirSync as mkdirSync5 } from "fs";
|
|
23731
24059
|
import { join as join10 } from "path";
|
|
23732
24060
|
function getLlmConfigPath() {
|
|
23733
24061
|
return join10(getConnectorsHome(), "llm.json");
|
|
23734
24062
|
}
|
|
23735
24063
|
function getLlmConfig() {
|
|
23736
24064
|
const path = getLlmConfigPath();
|
|
23737
|
-
if (!
|
|
24065
|
+
if (!existsSync8(path))
|
|
23738
24066
|
return null;
|
|
23739
24067
|
try {
|
|
23740
|
-
return JSON.parse(
|
|
24068
|
+
return JSON.parse(readFileSync5(path, "utf-8"));
|
|
23741
24069
|
} catch {
|
|
23742
24070
|
return null;
|
|
23743
24071
|
}
|
|
23744
24072
|
}
|
|
23745
24073
|
function saveLlmConfig(config2) {
|
|
23746
24074
|
const dir = getConnectorsHome();
|
|
23747
|
-
|
|
23748
|
-
|
|
24075
|
+
mkdirSync5(dir, { recursive: true });
|
|
24076
|
+
writeFileSync4(getLlmConfigPath(), JSON.stringify(config2, null, 2));
|
|
23749
24077
|
}
|
|
23750
24078
|
function setLlmStrip(enabled) {
|
|
23751
24079
|
const config2 = getLlmConfig();
|
|
@@ -23864,15 +24192,15 @@ __export(exports_installer, {
|
|
|
23864
24192
|
getConnectorDocs: () => getConnectorDocs,
|
|
23865
24193
|
connectorExists: () => connectorExists
|
|
23866
24194
|
});
|
|
23867
|
-
import { existsSync as
|
|
24195
|
+
import { existsSync as existsSync9, mkdirSync as mkdirSync6, readFileSync as readFileSync6, writeFileSync as writeFileSync5, readdirSync as readdirSync5, statSync as statSync3, rmSync as rmSync2 } from "fs";
|
|
23868
24196
|
import { join as join11, dirname as dirname6 } from "path";
|
|
23869
24197
|
import { fileURLToPath as fileURLToPath4 } from "url";
|
|
23870
24198
|
function resolveConnectorsDir() {
|
|
23871
24199
|
const fromBin = join11(__dirname4, "..", "connectors");
|
|
23872
|
-
if (
|
|
24200
|
+
if (existsSync9(fromBin))
|
|
23873
24201
|
return fromBin;
|
|
23874
24202
|
const fromSrc = join11(__dirname4, "..", "..", "connectors");
|
|
23875
|
-
if (
|
|
24203
|
+
if (existsSync9(fromSrc))
|
|
23876
24204
|
return fromSrc;
|
|
23877
24205
|
return fromBin;
|
|
23878
24206
|
}
|
|
@@ -23890,11 +24218,11 @@ function getLegacyInstallPath(targetDir, name) {
|
|
|
23890
24218
|
}
|
|
23891
24219
|
function loadEnablementManifest(targetDir) {
|
|
23892
24220
|
const manifestPath = getEnablementManifestPath(targetDir);
|
|
23893
|
-
if (!
|
|
24221
|
+
if (!existsSync9(manifestPath)) {
|
|
23894
24222
|
return null;
|
|
23895
24223
|
}
|
|
23896
24224
|
try {
|
|
23897
|
-
const raw = JSON.parse(
|
|
24225
|
+
const raw = JSON.parse(readFileSync6(manifestPath, "utf-8"));
|
|
23898
24226
|
if (!Array.isArray(raw.connectors)) {
|
|
23899
24227
|
return null;
|
|
23900
24228
|
}
|
|
@@ -23910,10 +24238,10 @@ function loadEnablementManifest(targetDir) {
|
|
|
23910
24238
|
}
|
|
23911
24239
|
function getLegacyInstalledConnectors(targetDir) {
|
|
23912
24240
|
const connectorsDir = getProjectConnectorsDir(targetDir);
|
|
23913
|
-
if (!
|
|
24241
|
+
if (!existsSync9(connectorsDir)) {
|
|
23914
24242
|
return [];
|
|
23915
24243
|
}
|
|
23916
|
-
return
|
|
24244
|
+
return readdirSync5(connectorsDir).filter((entry) => {
|
|
23917
24245
|
const fullPath = join11(connectorsDir, entry);
|
|
23918
24246
|
return entry.startsWith("connect-") && statSync3(fullPath).isDirectory();
|
|
23919
24247
|
}).map((entry) => entry.replace("connect-", "")).sort();
|
|
@@ -23939,18 +24267,18 @@ ${connectorList}
|
|
|
23939
24267
|
|
|
23940
24268
|
export type EnabledConnectorName = typeof enabledConnectors[number];
|
|
23941
24269
|
`;
|
|
23942
|
-
|
|
24270
|
+
writeFileSync5(indexPath, content);
|
|
23943
24271
|
}
|
|
23944
24272
|
function writeEnablementManifest(targetDir, connectors18) {
|
|
23945
24273
|
const connectorsDir = getProjectConnectorsDir(targetDir);
|
|
23946
|
-
|
|
24274
|
+
mkdirSync6(connectorsDir, { recursive: true });
|
|
23947
24275
|
const manifest = {
|
|
23948
24276
|
version: 1,
|
|
23949
24277
|
mode: "internal",
|
|
23950
24278
|
updatedAt: new Date().toISOString(),
|
|
23951
24279
|
connectors: [...new Set(connectors18.map((value) => normalizeConnectorName(value)))].sort()
|
|
23952
24280
|
};
|
|
23953
|
-
|
|
24281
|
+
writeFileSync5(getEnablementManifestPath(targetDir), JSON.stringify(manifest, null, 2) + `
|
|
23954
24282
|
`);
|
|
23955
24283
|
updateConnectorsIndex(connectorsDir, manifest.connectors);
|
|
23956
24284
|
}
|
|
@@ -23960,7 +24288,7 @@ function getConnectorPath(name) {
|
|
|
23960
24288
|
}
|
|
23961
24289
|
function connectorExists(name) {
|
|
23962
24290
|
const normalizedName = normalizeConnectorName(name);
|
|
23963
|
-
return hasInternalConnectorDefinition(normalizedName) ||
|
|
24291
|
+
return hasInternalConnectorDefinition(normalizedName) || existsSync9(getConnectorPath(normalizedName));
|
|
23964
24292
|
}
|
|
23965
24293
|
function installConnector(name, options = {}) {
|
|
23966
24294
|
const { targetDir = process.cwd(), overwrite = false } = options;
|
|
@@ -23993,7 +24321,7 @@ function installConnector(name, options = {}) {
|
|
|
23993
24321
|
try {
|
|
23994
24322
|
const nextEnabled = [...new Set([...installed, normalizedName])].sort();
|
|
23995
24323
|
writeEnablementManifest(targetDir, nextEnabled);
|
|
23996
|
-
if (overwrite &&
|
|
24324
|
+
if (overwrite && existsSync9(legacyInstallPath)) {
|
|
23997
24325
|
rmSync2(legacyInstallPath, { recursive: true });
|
|
23998
24326
|
}
|
|
23999
24327
|
return {
|
|
@@ -24029,8 +24357,8 @@ function getConnectorDocs(name) {
|
|
|
24029
24357
|
const normalizedName = normalizeConnectorName(name);
|
|
24030
24358
|
const connectorPath = getConnectorPath(normalizedName);
|
|
24031
24359
|
const claudeMdPath = join11(connectorPath, "CLAUDE.md");
|
|
24032
|
-
if (
|
|
24033
|
-
return parseConnectorDocs(
|
|
24360
|
+
if (existsSync9(claudeMdPath)) {
|
|
24361
|
+
return parseConnectorDocs(readFileSync6(claudeMdPath, "utf-8"));
|
|
24034
24362
|
}
|
|
24035
24363
|
const internalDocs = getInternalConnectorDefinition(normalizedName)?.docsMarkdown;
|
|
24036
24364
|
if (internalDocs) {
|
|
@@ -24074,7 +24402,7 @@ function removeConnector(name, targetDir = process.cwd()) {
|
|
|
24074
24402
|
const nextEnabled = installed.filter((connector) => connector !== normalizedName);
|
|
24075
24403
|
writeEnablementManifest(targetDir, nextEnabled);
|
|
24076
24404
|
const legacyInstallPath = getLegacyInstallPath(targetDir, normalizedName);
|
|
24077
|
-
if (
|
|
24405
|
+
if (existsSync9(legacyInstallPath)) {
|
|
24078
24406
|
rmSync2(legacyInstallPath, { recursive: true });
|
|
24079
24407
|
}
|
|
24080
24408
|
return true;
|
|
@@ -24155,9 +24483,381 @@ var init_usage = __esm(() => {
|
|
|
24155
24483
|
init_database();
|
|
24156
24484
|
});
|
|
24157
24485
|
|
|
24486
|
+
// src/lib/lock.ts
|
|
24487
|
+
import { openSync, closeSync, unlinkSync, existsSync as existsSync10, statSync as statSync4 } from "fs";
|
|
24488
|
+
import { join as join12 } from "path";
|
|
24489
|
+
import { mkdirSync as mkdirSync7 } from "fs";
|
|
24490
|
+
function lockPath(connector) {
|
|
24491
|
+
const dir = join12(getConnectorsHome(), `connect-${connector}`);
|
|
24492
|
+
mkdirSync7(dir, { recursive: true });
|
|
24493
|
+
return join12(dir, ".write.lock");
|
|
24494
|
+
}
|
|
24495
|
+
function isStale(path) {
|
|
24496
|
+
try {
|
|
24497
|
+
const stat = statSync4(path);
|
|
24498
|
+
return Date.now() - stat.mtimeMs > STALE_LOCK_MS;
|
|
24499
|
+
} catch {
|
|
24500
|
+
return false;
|
|
24501
|
+
}
|
|
24502
|
+
}
|
|
24503
|
+
function tryAcquire(path) {
|
|
24504
|
+
if (existsSync10(path) && isStale(path)) {
|
|
24505
|
+
try {
|
|
24506
|
+
unlinkSync(path);
|
|
24507
|
+
} catch {}
|
|
24508
|
+
}
|
|
24509
|
+
try {
|
|
24510
|
+
const fd = openSync(path, "wx");
|
|
24511
|
+
closeSync(fd);
|
|
24512
|
+
return true;
|
|
24513
|
+
} catch (e) {
|
|
24514
|
+
if (e.code === "EEXIST")
|
|
24515
|
+
return false;
|
|
24516
|
+
throw e;
|
|
24517
|
+
}
|
|
24518
|
+
}
|
|
24519
|
+
function release(path) {
|
|
24520
|
+
try {
|
|
24521
|
+
unlinkSync(path);
|
|
24522
|
+
} catch {}
|
|
24523
|
+
}
|
|
24524
|
+
async function withWriteLock(connector, fn) {
|
|
24525
|
+
const path = lockPath(connector);
|
|
24526
|
+
const deadline = Date.now() + LOCK_TIMEOUT_MS;
|
|
24527
|
+
while (Date.now() < deadline) {
|
|
24528
|
+
if (tryAcquire(path)) {
|
|
24529
|
+
try {
|
|
24530
|
+
return await fn();
|
|
24531
|
+
} finally {
|
|
24532
|
+
release(path);
|
|
24533
|
+
}
|
|
24534
|
+
}
|
|
24535
|
+
await new Promise((resolve) => setTimeout(resolve, LOCK_RETRY_MS));
|
|
24536
|
+
}
|
|
24537
|
+
throw new LockTimeoutError(connector);
|
|
24538
|
+
}
|
|
24539
|
+
var LOCK_TIMEOUT_MS = 5000, LOCK_RETRY_MS = 100, STALE_LOCK_MS = 30000, LockTimeoutError;
|
|
24540
|
+
var init_lock = __esm(() => {
|
|
24541
|
+
init_database();
|
|
24542
|
+
LockTimeoutError = class LockTimeoutError extends Error {
|
|
24543
|
+
connector;
|
|
24544
|
+
constructor(connector) {
|
|
24545
|
+
super(`Could not acquire write lock for connector "${connector}" within ${LOCK_TIMEOUT_MS}ms. Another agent may be writing. Try again shortly.`);
|
|
24546
|
+
this.connector = connector;
|
|
24547
|
+
this.name = "LockTimeoutError";
|
|
24548
|
+
}
|
|
24549
|
+
};
|
|
24550
|
+
});
|
|
24551
|
+
|
|
24552
|
+
// src/server/auth.ts
|
|
24553
|
+
import { existsSync as existsSync11, readFileSync as readFileSync7, writeFileSync as writeFileSync6, mkdirSync as mkdirSync8, readdirSync as readdirSync6, rmSync as rmSync3, statSync as statSync5 } from "fs";
|
|
24554
|
+
import { join as join13 } from "path";
|
|
24555
|
+
function getAuthType(name) {
|
|
24556
|
+
const docs = getConnectorDocs(name);
|
|
24557
|
+
if (!docs?.auth)
|
|
24558
|
+
return "apikey";
|
|
24559
|
+
const authLower = docs.auth.toLowerCase();
|
|
24560
|
+
if (authLower.includes("oauth"))
|
|
24561
|
+
return "oauth";
|
|
24562
|
+
if (authLower.includes("bearer token"))
|
|
24563
|
+
return "bearer";
|
|
24564
|
+
return "apikey";
|
|
24565
|
+
}
|
|
24566
|
+
function getConnectorConfigDir(name) {
|
|
24567
|
+
const connectorName = name.startsWith("connect-") ? name : `connect-${name}`;
|
|
24568
|
+
return join13(getConnectorsHome(), connectorName);
|
|
24569
|
+
}
|
|
24570
|
+
function getCurrentProfile2(name) {
|
|
24571
|
+
const configDir = getConnectorConfigDir(name);
|
|
24572
|
+
const currentProfileFile = join13(configDir, "current_profile");
|
|
24573
|
+
if (existsSync11(currentProfileFile)) {
|
|
24574
|
+
try {
|
|
24575
|
+
return readFileSync7(currentProfileFile, "utf-8").trim() || "default";
|
|
24576
|
+
} catch {
|
|
24577
|
+
return "default";
|
|
24578
|
+
}
|
|
24579
|
+
}
|
|
24580
|
+
return "default";
|
|
24581
|
+
}
|
|
24582
|
+
function loadProfileConfig(name) {
|
|
24583
|
+
const configDir = getConnectorConfigDir(name);
|
|
24584
|
+
const profile = getCurrentProfile2(name);
|
|
24585
|
+
let flatConfig = {};
|
|
24586
|
+
let dirConfig = {};
|
|
24587
|
+
const profileFile = join13(configDir, "profiles", `${profile}.json`);
|
|
24588
|
+
if (existsSync11(profileFile)) {
|
|
24589
|
+
try {
|
|
24590
|
+
flatConfig = JSON.parse(readFileSync7(profileFile, "utf-8"));
|
|
24591
|
+
} catch {}
|
|
24592
|
+
}
|
|
24593
|
+
const profileDirConfig = join13(configDir, "profiles", profile, "config.json");
|
|
24594
|
+
if (existsSync11(profileDirConfig)) {
|
|
24595
|
+
try {
|
|
24596
|
+
dirConfig = JSON.parse(readFileSync7(profileDirConfig, "utf-8"));
|
|
24597
|
+
} catch {}
|
|
24598
|
+
}
|
|
24599
|
+
if (Object.keys(flatConfig).length === 0 && Object.keys(dirConfig).length === 0) {
|
|
24600
|
+
return {};
|
|
24601
|
+
}
|
|
24602
|
+
return { ...flatConfig, ...dirConfig };
|
|
24603
|
+
}
|
|
24604
|
+
function loadTokens2(name) {
|
|
24605
|
+
const configDir = getConnectorConfigDir(name);
|
|
24606
|
+
const profile = getCurrentProfile2(name);
|
|
24607
|
+
const tokensFile = join13(configDir, "profiles", profile, "tokens.json");
|
|
24608
|
+
if (existsSync11(tokensFile)) {
|
|
24609
|
+
try {
|
|
24610
|
+
return JSON.parse(readFileSync7(tokensFile, "utf-8"));
|
|
24611
|
+
} catch {
|
|
24612
|
+
return null;
|
|
24613
|
+
}
|
|
24614
|
+
}
|
|
24615
|
+
const profileConfig = loadProfileConfig(name);
|
|
24616
|
+
if (profileConfig.refreshToken || profileConfig.accessToken) {
|
|
24617
|
+
return {
|
|
24618
|
+
accessToken: profileConfig.accessToken ?? "",
|
|
24619
|
+
refreshToken: profileConfig.refreshToken,
|
|
24620
|
+
expiresAt: profileConfig.expiresAt ?? 0,
|
|
24621
|
+
tokenType: profileConfig.tokenType,
|
|
24622
|
+
scope: profileConfig.scope
|
|
24623
|
+
};
|
|
24624
|
+
}
|
|
24625
|
+
return null;
|
|
24626
|
+
}
|
|
24627
|
+
function isStoredOAuthEnvVarSet(variable, oauthConfig, tokens, profileConfig) {
|
|
24628
|
+
if (variable.endsWith("_CLIENT_ID")) {
|
|
24629
|
+
return Boolean(oauthConfig.clientId || profileConfig.clientId);
|
|
24630
|
+
}
|
|
24631
|
+
if (variable.endsWith("_CLIENT_SECRET")) {
|
|
24632
|
+
return Boolean(oauthConfig.clientSecret || profileConfig.clientSecret);
|
|
24633
|
+
}
|
|
24634
|
+
if (variable.endsWith("_ACCESS_TOKEN")) {
|
|
24635
|
+
return Boolean(tokens?.accessToken || profileConfig.accessToken);
|
|
24636
|
+
}
|
|
24637
|
+
if (variable.endsWith("_REFRESH_TOKEN")) {
|
|
24638
|
+
return Boolean(tokens?.refreshToken || profileConfig.refreshToken);
|
|
24639
|
+
}
|
|
24640
|
+
if (variable.endsWith("_TOKEN_EXPIRES_AT")) {
|
|
24641
|
+
return Boolean(tokens?.expiresAt || profileConfig.expiresAt);
|
|
24642
|
+
}
|
|
24643
|
+
return false;
|
|
24644
|
+
}
|
|
24645
|
+
function getAuthStatus(name) {
|
|
24646
|
+
const authType = getAuthType(name);
|
|
24647
|
+
const docs = getConnectorDocs(name);
|
|
24648
|
+
const oauthConfig = authType === "oauth" ? getOAuthConfig(name) : {};
|
|
24649
|
+
const tokens = authType === "oauth" ? loadTokens2(name) : null;
|
|
24650
|
+
const profileConfig = authType === "oauth" ? loadProfileConfig(name) : {};
|
|
24651
|
+
const envVars = (docs?.envVars || []).map((v) => ({
|
|
24652
|
+
variable: v.variable,
|
|
24653
|
+
description: v.description,
|
|
24654
|
+
set: !!process.env[v.variable] || authType === "oauth" && isStoredOAuthEnvVarSet(v.variable, oauthConfig, tokens, profileConfig)
|
|
24655
|
+
}));
|
|
24656
|
+
const envVarTotalCount = envVars.length;
|
|
24657
|
+
const envVarSetCount = envVars.filter((v) => v.set).length;
|
|
24658
|
+
if (authType === "oauth") {
|
|
24659
|
+
const hasTokens = !!tokens?.accessToken || !!profileConfig.accessToken;
|
|
24660
|
+
const hasRefreshToken = !!tokens?.refreshToken || !!profileConfig.refreshToken;
|
|
24661
|
+
const tokenExpiry = tokens?.expiresAt || profileConfig.expiresAt;
|
|
24662
|
+
const hasOAuthCredentials = Boolean(oauthConfig.clientId && oauthConfig.clientSecret);
|
|
24663
|
+
const hasEnvVar2 = envVars.some((v) => v.set);
|
|
24664
|
+
return {
|
|
24665
|
+
type: "oauth",
|
|
24666
|
+
configured: hasTokens || hasRefreshToken || hasOAuthCredentials || hasEnvVar2,
|
|
24667
|
+
tokenExpiry,
|
|
24668
|
+
hasRefreshToken,
|
|
24669
|
+
hasOAuthCredentials,
|
|
24670
|
+
envVars,
|
|
24671
|
+
envVarSetCount,
|
|
24672
|
+
envVarTotalCount
|
|
24673
|
+
};
|
|
24674
|
+
}
|
|
24675
|
+
const config2 = loadProfileConfig(name);
|
|
24676
|
+
const hasKey = Object.values(config2).some((v) => typeof v === "string" && v.length > 0);
|
|
24677
|
+
const hasEnvVar = envVars.some((v) => v.set);
|
|
24678
|
+
return {
|
|
24679
|
+
type: authType,
|
|
24680
|
+
configured: hasKey || hasEnvVar,
|
|
24681
|
+
envVars,
|
|
24682
|
+
envVarSetCount,
|
|
24683
|
+
envVarTotalCount
|
|
24684
|
+
};
|
|
24685
|
+
}
|
|
24686
|
+
function getEnvVars(name) {
|
|
24687
|
+
const docs = getConnectorDocs(name);
|
|
24688
|
+
return docs?.envVars || [];
|
|
24689
|
+
}
|
|
24690
|
+
async function saveApiKey(name, key, field) {
|
|
24691
|
+
return withWriteLock(name, () => _saveApiKey(name, key, field));
|
|
24692
|
+
}
|
|
24693
|
+
function _saveApiKey(name, key, field) {
|
|
24694
|
+
const configDir = getConnectorConfigDir(name);
|
|
24695
|
+
const profile = getCurrentProfile2(name);
|
|
24696
|
+
const keyField = field || guessKeyField(name);
|
|
24697
|
+
if (keyField === "clientId" || keyField === "clientSecret") {
|
|
24698
|
+
const credentialsFile = join13(configDir, "credentials.json");
|
|
24699
|
+
mkdirSync8(configDir, { recursive: true });
|
|
24700
|
+
let creds = {};
|
|
24701
|
+
if (existsSync11(credentialsFile)) {
|
|
24702
|
+
try {
|
|
24703
|
+
creds = JSON.parse(readFileSync7(credentialsFile, "utf-8"));
|
|
24704
|
+
} catch {}
|
|
24705
|
+
}
|
|
24706
|
+
creds[keyField] = key;
|
|
24707
|
+
writeFileSync6(credentialsFile, JSON.stringify(creds, null, 2));
|
|
24708
|
+
return;
|
|
24709
|
+
}
|
|
24710
|
+
const profileFile = join13(configDir, "profiles", `${profile}.json`);
|
|
24711
|
+
const profileDir = join13(configDir, "profiles", profile);
|
|
24712
|
+
if (existsSync11(profileFile)) {
|
|
24713
|
+
let config2 = {};
|
|
24714
|
+
try {
|
|
24715
|
+
config2 = JSON.parse(readFileSync7(profileFile, "utf-8"));
|
|
24716
|
+
} catch {}
|
|
24717
|
+
config2[keyField] = key;
|
|
24718
|
+
writeFileSync6(profileFile, JSON.stringify(config2, null, 2));
|
|
24719
|
+
return;
|
|
24720
|
+
}
|
|
24721
|
+
if (existsSync11(profileDir)) {
|
|
24722
|
+
const configFile = join13(profileDir, "config.json");
|
|
24723
|
+
let config2 = {};
|
|
24724
|
+
if (existsSync11(configFile)) {
|
|
24725
|
+
try {
|
|
24726
|
+
config2 = JSON.parse(readFileSync7(configFile, "utf-8"));
|
|
24727
|
+
} catch {}
|
|
24728
|
+
}
|
|
24729
|
+
config2[keyField] = key;
|
|
24730
|
+
writeFileSync6(configFile, JSON.stringify(config2, null, 2));
|
|
24731
|
+
return;
|
|
24732
|
+
}
|
|
24733
|
+
mkdirSync8(profileDir, { recursive: true });
|
|
24734
|
+
writeFileSync6(join13(profileDir, "config.json"), JSON.stringify({ [keyField]: key }, null, 2));
|
|
24735
|
+
}
|
|
24736
|
+
function guessKeyField(name) {
|
|
24737
|
+
const docs = getConnectorDocs(name);
|
|
24738
|
+
if (!docs?.envVars.length)
|
|
24739
|
+
return "apiKey";
|
|
24740
|
+
const keyVar = docs.envVars.find((v) => v.variable.includes("API_KEY") || v.variable.includes("API_SECRET") || v.variable.includes("TOKEN") || v.variable.includes("SECRET"));
|
|
24741
|
+
if (keyVar) {
|
|
24742
|
+
const parts = keyVar.variable.toLowerCase().split("_");
|
|
24743
|
+
const withoutPrefix = parts.slice(1);
|
|
24744
|
+
if (withoutPrefix.length > 0) {
|
|
24745
|
+
return withoutPrefix.map((p, i) => i === 0 ? p : p.charAt(0).toUpperCase() + p.slice(1)).join("");
|
|
24746
|
+
}
|
|
24747
|
+
}
|
|
24748
|
+
return "apiKey";
|
|
24749
|
+
}
|
|
24750
|
+
function getOAuthConfig(name) {
|
|
24751
|
+
const configDir = getConnectorConfigDir(name);
|
|
24752
|
+
const credentialsFile = join13(configDir, "credentials.json");
|
|
24753
|
+
if (existsSync11(credentialsFile)) {
|
|
24754
|
+
try {
|
|
24755
|
+
const creds = JSON.parse(readFileSync7(credentialsFile, "utf-8"));
|
|
24756
|
+
return { clientId: creds.clientId, clientSecret: creds.clientSecret };
|
|
24757
|
+
} catch {}
|
|
24758
|
+
}
|
|
24759
|
+
const config2 = loadProfileConfig(name);
|
|
24760
|
+
return {
|
|
24761
|
+
clientId: config2.clientId,
|
|
24762
|
+
clientSecret: config2.clientSecret
|
|
24763
|
+
};
|
|
24764
|
+
}
|
|
24765
|
+
function saveOAuthTokens(name, tokens) {
|
|
24766
|
+
const configDir = getConnectorConfigDir(name);
|
|
24767
|
+
const profile = getCurrentProfile2(name);
|
|
24768
|
+
const profileDir = join13(configDir, "profiles", profile);
|
|
24769
|
+
mkdirSync8(profileDir, { recursive: true });
|
|
24770
|
+
const tokensFile = join13(profileDir, "tokens.json");
|
|
24771
|
+
writeFileSync6(tokensFile, JSON.stringify(tokens, null, 2), { mode: 384 });
|
|
24772
|
+
}
|
|
24773
|
+
async function refreshOAuthToken(name) {
|
|
24774
|
+
return withWriteLock(name, () => _refreshOAuthToken(name));
|
|
24775
|
+
}
|
|
24776
|
+
async function _refreshOAuthToken(name) {
|
|
24777
|
+
const oauthConfig = getOAuthConfig(name);
|
|
24778
|
+
const currentTokens = loadTokens2(name);
|
|
24779
|
+
if (!oauthConfig.clientId || !oauthConfig.clientSecret) {
|
|
24780
|
+
throw new Error("OAuth credentials not configured for " + name);
|
|
24781
|
+
}
|
|
24782
|
+
if (!currentTokens?.refreshToken) {
|
|
24783
|
+
throw new Error("No refresh token available. Please re-authenticate.");
|
|
24784
|
+
}
|
|
24785
|
+
const response = await fetch(GOOGLE_TOKEN_URL, {
|
|
24786
|
+
method: "POST",
|
|
24787
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
24788
|
+
body: new URLSearchParams({
|
|
24789
|
+
client_id: oauthConfig.clientId,
|
|
24790
|
+
client_secret: oauthConfig.clientSecret,
|
|
24791
|
+
refresh_token: currentTokens.refreshToken,
|
|
24792
|
+
grant_type: "refresh_token"
|
|
24793
|
+
}),
|
|
24794
|
+
signal: AbortSignal.timeout(FETCH_TIMEOUT)
|
|
24795
|
+
});
|
|
24796
|
+
if (!response.ok) {
|
|
24797
|
+
const error2 = await response.json().catch(() => ({ error: response.statusText }));
|
|
24798
|
+
throw new Error(`Token refresh failed: ${error2.error_description || error2.error}`);
|
|
24799
|
+
}
|
|
24800
|
+
const data = await response.json();
|
|
24801
|
+
const tokens = {
|
|
24802
|
+
accessToken: data.access_token,
|
|
24803
|
+
refreshToken: currentTokens.refreshToken,
|
|
24804
|
+
expiresAt: Date.now() + data.expires_in * 1000,
|
|
24805
|
+
tokenType: data.token_type,
|
|
24806
|
+
scope: data.scope || currentTokens.scope
|
|
24807
|
+
};
|
|
24808
|
+
saveOAuthTokens(name, tokens);
|
|
24809
|
+
return tokens;
|
|
24810
|
+
}
|
|
24811
|
+
var FETCH_TIMEOUT = 1e4, oauthStateStore, GOOGLE_TOKEN_URL = "https://oauth2.googleapis.com/token", GOOGLE_SCOPES;
|
|
24812
|
+
var init_auth = __esm(() => {
|
|
24813
|
+
init_installer();
|
|
24814
|
+
init_lock();
|
|
24815
|
+
init_database();
|
|
24816
|
+
oauthStateStore = new Map;
|
|
24817
|
+
GOOGLE_SCOPES = {
|
|
24818
|
+
gmail: [
|
|
24819
|
+
"https://www.googleapis.com/auth/gmail.readonly",
|
|
24820
|
+
"https://www.googleapis.com/auth/gmail.send",
|
|
24821
|
+
"https://www.googleapis.com/auth/gmail.compose",
|
|
24822
|
+
"https://www.googleapis.com/auth/gmail.modify",
|
|
24823
|
+
"https://www.googleapis.com/auth/gmail.labels",
|
|
24824
|
+
"https://mail.google.com/"
|
|
24825
|
+
].join(" "),
|
|
24826
|
+
googlecalendar: [
|
|
24827
|
+
"https://www.googleapis.com/auth/calendar",
|
|
24828
|
+
"https://www.googleapis.com/auth/calendar.events"
|
|
24829
|
+
].join(" "),
|
|
24830
|
+
googledrive: [
|
|
24831
|
+
"https://www.googleapis.com/auth/drive",
|
|
24832
|
+
"https://www.googleapis.com/auth/drive.file"
|
|
24833
|
+
].join(" "),
|
|
24834
|
+
googledocs: [
|
|
24835
|
+
"https://www.googleapis.com/auth/documents",
|
|
24836
|
+
"https://www.googleapis.com/auth/drive.file"
|
|
24837
|
+
].join(" "),
|
|
24838
|
+
googlesheets: [
|
|
24839
|
+
"https://www.googleapis.com/auth/spreadsheets",
|
|
24840
|
+
"https://www.googleapis.com/auth/drive.file"
|
|
24841
|
+
].join(" "),
|
|
24842
|
+
googletasks: [
|
|
24843
|
+
"https://www.googleapis.com/auth/tasks"
|
|
24844
|
+
].join(" "),
|
|
24845
|
+
googlecontacts: [
|
|
24846
|
+
"https://www.googleapis.com/auth/contacts",
|
|
24847
|
+
"https://www.googleapis.com/auth/contacts.readonly"
|
|
24848
|
+
].join(" "),
|
|
24849
|
+
google: [
|
|
24850
|
+
"openid",
|
|
24851
|
+
"https://www.googleapis.com/auth/userinfo.email",
|
|
24852
|
+
"https://www.googleapis.com/auth/userinfo.profile"
|
|
24853
|
+
].join(" ")
|
|
24854
|
+
};
|
|
24855
|
+
});
|
|
24856
|
+
|
|
24158
24857
|
// src/lib/runner.ts
|
|
24159
24858
|
var exports_runner = {};
|
|
24160
24859
|
__export(exports_runner, {
|
|
24860
|
+
runConnectorOperation: () => runConnectorOperation,
|
|
24161
24861
|
runConnectorCommand: () => runConnectorCommand,
|
|
24162
24862
|
parseCommanderHelpOperations: () => parseCommanderHelpOperations,
|
|
24163
24863
|
hasConnectorCommandSurface: () => hasConnectorCommandSurface,
|
|
@@ -24165,18 +24865,19 @@ __export(exports_runner, {
|
|
|
24165
24865
|
getConnectorOperations: () => getConnectorOperations,
|
|
24166
24866
|
getConnectorCommandHelp: () => getConnectorCommandHelp,
|
|
24167
24867
|
getConnectorCliPath: () => getConnectorCliPath,
|
|
24168
|
-
buildEnvWithCredentials: () => buildEnvWithCredentials
|
|
24868
|
+
buildEnvWithCredentials: () => buildEnvWithCredentials,
|
|
24869
|
+
buildConnectorOperationArgs: () => buildConnectorOperationArgs
|
|
24169
24870
|
});
|
|
24170
|
-
import { existsSync as
|
|
24871
|
+
import { existsSync as existsSync13, readdirSync as readdirSync7 } from "fs";
|
|
24171
24872
|
import { join as join15, dirname as dirname7 } from "path";
|
|
24172
24873
|
import { fileURLToPath as fileURLToPath5 } from "url";
|
|
24173
24874
|
import { spawn as spawn2 } from "child_process";
|
|
24174
24875
|
function resolveConnectorsDir2() {
|
|
24175
24876
|
const fromBin = join15(__dirname5, "..", "connectors");
|
|
24176
|
-
if (
|
|
24877
|
+
if (existsSync13(fromBin))
|
|
24177
24878
|
return fromBin;
|
|
24178
24879
|
const fromSrc = join15(__dirname5, "..", "..", "connectors");
|
|
24179
|
-
if (
|
|
24880
|
+
if (existsSync13(fromSrc))
|
|
24180
24881
|
return fromSrc;
|
|
24181
24882
|
return fromBin;
|
|
24182
24883
|
}
|
|
@@ -24219,13 +24920,32 @@ function buildEnvWithCredentials(connectorName, baseEnv) {
|
|
|
24219
24920
|
}
|
|
24220
24921
|
}
|
|
24221
24922
|
}
|
|
24923
|
+
if (getAuthType(connectorName) === "oauth") {
|
|
24924
|
+
const oauthConfig = getOAuthConfig(connectorName);
|
|
24925
|
+
const tokens = loadTokens2(connectorName);
|
|
24926
|
+
for (const { variable } of getEnvVars(connectorName)) {
|
|
24927
|
+
if (env[variable])
|
|
24928
|
+
continue;
|
|
24929
|
+
if (variable.endsWith("_CLIENT_ID") && oauthConfig.clientId) {
|
|
24930
|
+
env[variable] = oauthConfig.clientId;
|
|
24931
|
+
} else if (variable.endsWith("_CLIENT_SECRET") && oauthConfig.clientSecret) {
|
|
24932
|
+
env[variable] = oauthConfig.clientSecret;
|
|
24933
|
+
} else if (variable.endsWith("_ACCESS_TOKEN") && tokens?.accessToken) {
|
|
24934
|
+
env[variable] = tokens.accessToken;
|
|
24935
|
+
} else if (variable.endsWith("_REFRESH_TOKEN") && tokens?.refreshToken) {
|
|
24936
|
+
env[variable] = tokens.refreshToken;
|
|
24937
|
+
} else if (variable.endsWith("_TOKEN_EXPIRES_AT") && tokens?.expiresAt) {
|
|
24938
|
+
env[variable] = String(tokens.expiresAt);
|
|
24939
|
+
}
|
|
24940
|
+
}
|
|
24941
|
+
}
|
|
24222
24942
|
return env;
|
|
24223
24943
|
}
|
|
24224
24944
|
function getConnectorCliPath(name) {
|
|
24225
24945
|
const safeName = name.replace(/[^a-z0-9-]/g, "");
|
|
24226
24946
|
const connectorDir = join15(CONNECTORS_DIR2, `connect-${safeName}`);
|
|
24227
24947
|
const cliPath = join15(connectorDir, "src", "cli", "index.ts");
|
|
24228
|
-
if (
|
|
24948
|
+
if (existsSync13(cliPath))
|
|
24229
24949
|
return cliPath;
|
|
24230
24950
|
return null;
|
|
24231
24951
|
}
|
|
@@ -24263,7 +24983,7 @@ function parseCommanderHelpOperations(helpText) {
|
|
|
24263
24983
|
inCommands = false;
|
|
24264
24984
|
continue;
|
|
24265
24985
|
}
|
|
24266
|
-
const row = line.match(/^ {2}(\S.*?)(?: {2,}(.+))?$/);
|
|
24986
|
+
const row = line.match(/^ {2}(?! )(\S.*?)(?: {2,}(.+))?$/);
|
|
24267
24987
|
if (!row)
|
|
24268
24988
|
continue;
|
|
24269
24989
|
const usage = row[1].trim();
|
|
@@ -24300,6 +25020,112 @@ function runConnectorCommand(name, args, timeoutMs = 30000) {
|
|
|
24300
25020
|
}
|
|
24301
25021
|
return runLegacyConnectorCommand(name, args, timeoutMs);
|
|
24302
25022
|
}
|
|
25023
|
+
async function runConnectorOperation(args) {
|
|
25024
|
+
const internal = getInternalConnectorDefinition(args.connector);
|
|
25025
|
+
if (internal?.operations[args.operation]) {
|
|
25026
|
+
try {
|
|
25027
|
+
const operationData = await executeConnectorOperation(internal, {
|
|
25028
|
+
operation: args.operation,
|
|
25029
|
+
input: args.input,
|
|
25030
|
+
profile: args.profile
|
|
25031
|
+
});
|
|
25032
|
+
const commandResult = normalizeOperationReturn(operationData);
|
|
25033
|
+
return {
|
|
25034
|
+
connector: args.connector,
|
|
25035
|
+
operation: args.operation,
|
|
25036
|
+
profile: args.profile,
|
|
25037
|
+
...commandResult
|
|
25038
|
+
};
|
|
25039
|
+
} catch (error2) {
|
|
25040
|
+
return {
|
|
25041
|
+
connector: args.connector,
|
|
25042
|
+
operation: args.operation,
|
|
25043
|
+
profile: args.profile,
|
|
25044
|
+
stdout: "",
|
|
25045
|
+
stderr: error2.message,
|
|
25046
|
+
exitCode: 1,
|
|
25047
|
+
success: false
|
|
25048
|
+
};
|
|
25049
|
+
}
|
|
25050
|
+
}
|
|
25051
|
+
const commandArgs = buildConnectorOperationArgs(args);
|
|
25052
|
+
const result = await runConnectorCommand(args.connector, commandArgs, args.timeoutMs ?? 30000);
|
|
25053
|
+
const response = {
|
|
25054
|
+
...result,
|
|
25055
|
+
connector: args.connector,
|
|
25056
|
+
operation: args.operation,
|
|
25057
|
+
profile: args.profile
|
|
25058
|
+
};
|
|
25059
|
+
if (args.parseJson !== false && result.stdout) {
|
|
25060
|
+
try {
|
|
25061
|
+
response.data = JSON.parse(result.stdout);
|
|
25062
|
+
} catch {}
|
|
25063
|
+
}
|
|
25064
|
+
return response;
|
|
25065
|
+
}
|
|
25066
|
+
function normalizeOperationReturn(value) {
|
|
25067
|
+
if (isRunResult(value)) {
|
|
25068
|
+
const result = value;
|
|
25069
|
+
const response = {
|
|
25070
|
+
...result
|
|
25071
|
+
};
|
|
25072
|
+
if (result.stdout) {
|
|
25073
|
+
try {
|
|
25074
|
+
response.data = JSON.parse(result.stdout);
|
|
25075
|
+
} catch {}
|
|
25076
|
+
}
|
|
25077
|
+
return response;
|
|
25078
|
+
}
|
|
25079
|
+
return {
|
|
25080
|
+
data: value,
|
|
25081
|
+
stdout: JSON.stringify(value),
|
|
25082
|
+
stderr: "",
|
|
25083
|
+
exitCode: 0,
|
|
25084
|
+
success: true
|
|
25085
|
+
};
|
|
25086
|
+
}
|
|
25087
|
+
function isRunResult(value) {
|
|
25088
|
+
if (!value || typeof value !== "object")
|
|
25089
|
+
return false;
|
|
25090
|
+
const candidate = value;
|
|
25091
|
+
return typeof candidate.stdout === "string" && typeof candidate.stderr === "string" && typeof candidate.exitCode === "number" && typeof candidate.success === "boolean";
|
|
25092
|
+
}
|
|
25093
|
+
function buildConnectorOperationArgs(args) {
|
|
25094
|
+
const commandArgs = [];
|
|
25095
|
+
if (args.profile) {
|
|
25096
|
+
commandArgs.push("--profile", args.profile);
|
|
25097
|
+
}
|
|
25098
|
+
commandArgs.push(...args.operation.split(".").filter(Boolean));
|
|
25099
|
+
for (const positional of args.input?.args ?? []) {
|
|
25100
|
+
commandArgs.push(String(positional));
|
|
25101
|
+
}
|
|
25102
|
+
let hasFormat = false;
|
|
25103
|
+
for (const [key, value] of Object.entries(args.input ?? {})) {
|
|
25104
|
+
if (key === "args")
|
|
25105
|
+
continue;
|
|
25106
|
+
if (value === undefined || value === null)
|
|
25107
|
+
continue;
|
|
25108
|
+
const flag = `--${key.replace(/_/g, "-").replace(/[A-Z]/g, (m) => `-${m.toLowerCase()}`)}`;
|
|
25109
|
+
if (flag === "--format" || flag === "--json")
|
|
25110
|
+
hasFormat = true;
|
|
25111
|
+
if (typeof value === "boolean") {
|
|
25112
|
+
if (value)
|
|
25113
|
+
commandArgs.push(flag);
|
|
25114
|
+
continue;
|
|
25115
|
+
}
|
|
25116
|
+
if (Array.isArray(value)) {
|
|
25117
|
+
for (const item of value) {
|
|
25118
|
+
commandArgs.push(flag, String(item));
|
|
25119
|
+
}
|
|
25120
|
+
continue;
|
|
25121
|
+
}
|
|
25122
|
+
commandArgs.push(flag, String(value));
|
|
25123
|
+
}
|
|
25124
|
+
if (args.parseJson !== false && !hasFormat) {
|
|
25125
|
+
commandArgs.push("--format", "json");
|
|
25126
|
+
}
|
|
25127
|
+
return commandArgs;
|
|
25128
|
+
}
|
|
24303
25129
|
function runLegacyConnectorCommand(name, args, timeoutMs = 30000) {
|
|
24304
25130
|
const cliPath = getConnectorCliPath(name);
|
|
24305
25131
|
if (!cliPath) {
|
|
@@ -24391,7 +25217,7 @@ async function getConnectorCommandHelp(name, command) {
|
|
|
24391
25217
|
function getConnectorsWithCli() {
|
|
24392
25218
|
const connectors18 = new Set;
|
|
24393
25219
|
try {
|
|
24394
|
-
const dirs =
|
|
25220
|
+
const dirs = readdirSync7(CONNECTORS_DIR2);
|
|
24395
25221
|
for (const dir of dirs) {
|
|
24396
25222
|
if (!dir.startsWith("connect-"))
|
|
24397
25223
|
continue;
|
|
@@ -24411,7 +25237,9 @@ function getConnectorsWithCli() {
|
|
|
24411
25237
|
var __dirname5, CONNECTORS_DIR2, ENV_VAR_NAME_OVERRIDES;
|
|
24412
25238
|
var init_runner = __esm(() => {
|
|
24413
25239
|
init_builtins();
|
|
25240
|
+
init_connector();
|
|
24414
25241
|
init_database();
|
|
25242
|
+
init_auth();
|
|
24415
25243
|
__dirname5 = dirname7(fileURLToPath5(import.meta.url));
|
|
24416
25244
|
CONNECTORS_DIR2 = resolveConnectorsDir2();
|
|
24417
25245
|
ENV_VAR_NAME_OVERRIDES = {
|
|
@@ -24423,7 +25251,7 @@ var init_runner = __esm(() => {
|
|
|
24423
25251
|
};
|
|
24424
25252
|
});
|
|
24425
25253
|
|
|
24426
|
-
//
|
|
25254
|
+
// node_modules/zod/v4/core/core.js
|
|
24427
25255
|
var NEVER2 = Object.freeze({
|
|
24428
25256
|
status: "aborted"
|
|
24429
25257
|
});
|
|
@@ -24483,7 +25311,7 @@ function config(newConfig) {
|
|
|
24483
25311
|
Object.assign(globalConfig, newConfig);
|
|
24484
25312
|
return globalConfig;
|
|
24485
25313
|
}
|
|
24486
|
-
//
|
|
25314
|
+
// node_modules/zod/v4/core/util.js
|
|
24487
25315
|
var exports_util = {};
|
|
24488
25316
|
__export(exports_util, {
|
|
24489
25317
|
unwrapMessage: () => unwrapMessage,
|
|
@@ -24997,7 +25825,7 @@ class Class {
|
|
|
24997
25825
|
constructor(..._args) {}
|
|
24998
25826
|
}
|
|
24999
25827
|
|
|
25000
|
-
//
|
|
25828
|
+
// node_modules/zod/v4/core/errors.js
|
|
25001
25829
|
var initializer = (inst, def) => {
|
|
25002
25830
|
inst.name = "$ZodError";
|
|
25003
25831
|
Object.defineProperty(inst, "_zod", {
|
|
@@ -25071,7 +25899,7 @@ function formatError(error, _mapper) {
|
|
|
25071
25899
|
return fieldErrors;
|
|
25072
25900
|
}
|
|
25073
25901
|
|
|
25074
|
-
//
|
|
25902
|
+
// node_modules/zod/v4/core/parse.js
|
|
25075
25903
|
var _parse = (_Err) => (schema, value, _ctx, _params) => {
|
|
25076
25904
|
const ctx = _ctx ? Object.assign(_ctx, { async: false }) : { async: false };
|
|
25077
25905
|
const result = schema._zod.run({ value, issues: [] }, ctx);
|
|
@@ -25122,7 +25950,7 @@ var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
|
|
|
25122
25950
|
} : { success: true, data: result.value };
|
|
25123
25951
|
};
|
|
25124
25952
|
var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
|
|
25125
|
-
//
|
|
25953
|
+
// node_modules/zod/v4/core/regexes.js
|
|
25126
25954
|
var cuid = /^[cC][^\s-]{8,}$/;
|
|
25127
25955
|
var cuid2 = /^[0-9a-z]+$/;
|
|
25128
25956
|
var ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
|
|
@@ -25180,7 +26008,7 @@ var _null = /null/i;
|
|
|
25180
26008
|
var lowercase = /^[^A-Z]*$/;
|
|
25181
26009
|
var uppercase = /^[^a-z]*$/;
|
|
25182
26010
|
|
|
25183
|
-
//
|
|
26011
|
+
// node_modules/zod/v4/core/checks.js
|
|
25184
26012
|
var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
|
|
25185
26013
|
var _a;
|
|
25186
26014
|
inst._zod ?? (inst._zod = {});
|
|
@@ -25564,7 +26392,7 @@ var $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (ins
|
|
|
25564
26392
|
};
|
|
25565
26393
|
});
|
|
25566
26394
|
|
|
25567
|
-
//
|
|
26395
|
+
// node_modules/zod/v4/core/doc.js
|
|
25568
26396
|
class Doc {
|
|
25569
26397
|
constructor(args = []) {
|
|
25570
26398
|
this.content = [];
|
|
@@ -25602,14 +26430,14 @@ class Doc {
|
|
|
25602
26430
|
}
|
|
25603
26431
|
}
|
|
25604
26432
|
|
|
25605
|
-
//
|
|
26433
|
+
// node_modules/zod/v4/core/versions.js
|
|
25606
26434
|
var version = {
|
|
25607
26435
|
major: 4,
|
|
25608
26436
|
minor: 0,
|
|
25609
26437
|
patch: 0
|
|
25610
26438
|
};
|
|
25611
26439
|
|
|
25612
|
-
//
|
|
26440
|
+
// node_modules/zod/v4/core/schemas.js
|
|
25613
26441
|
var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
25614
26442
|
var _a;
|
|
25615
26443
|
inst ?? (inst = {});
|
|
@@ -26840,7 +27668,7 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
26840
27668
|
payload.issues.push(issue(_iss));
|
|
26841
27669
|
}
|
|
26842
27670
|
}
|
|
26843
|
-
//
|
|
27671
|
+
// node_modules/zod/v4/locales/en.js
|
|
26844
27672
|
var parsedType = (data) => {
|
|
26845
27673
|
const t = typeof data;
|
|
26846
27674
|
switch (t) {
|
|
@@ -26957,7 +27785,7 @@ function en_default2() {
|
|
|
26957
27785
|
localeError: error()
|
|
26958
27786
|
};
|
|
26959
27787
|
}
|
|
26960
|
-
//
|
|
27788
|
+
// node_modules/zod/v4/core/registries.js
|
|
26961
27789
|
var $output = Symbol("ZodOutput");
|
|
26962
27790
|
var $input = Symbol("ZodInput");
|
|
26963
27791
|
|
|
@@ -27007,7 +27835,7 @@ function registry() {
|
|
|
27007
27835
|
return new $ZodRegistry;
|
|
27008
27836
|
}
|
|
27009
27837
|
var globalRegistry = /* @__PURE__ */ registry();
|
|
27010
|
-
//
|
|
27838
|
+
// node_modules/zod/v4/core/api.js
|
|
27011
27839
|
function _string(Class2, params) {
|
|
27012
27840
|
return new Class2({
|
|
27013
27841
|
type: "string",
|
|
@@ -27442,7 +28270,7 @@ function _refine(Class2, fn, _params) {
|
|
|
27442
28270
|
});
|
|
27443
28271
|
return schema;
|
|
27444
28272
|
}
|
|
27445
|
-
//
|
|
28273
|
+
// node_modules/zod/v4/core/to-json-schema.js
|
|
27446
28274
|
class JSONSchemaGenerator {
|
|
27447
28275
|
constructor(params) {
|
|
27448
28276
|
this.counter = 0;
|
|
@@ -28194,7 +29022,7 @@ function isTransforming(_schema, _ctx) {
|
|
|
28194
29022
|
}
|
|
28195
29023
|
throw new Error(`Unknown schema type: ${def.type}`);
|
|
28196
29024
|
}
|
|
28197
|
-
//
|
|
29025
|
+
// node_modules/zod/v4/mini/schemas.js
|
|
28198
29026
|
var ZodMiniType = /* @__PURE__ */ $constructor("ZodMiniType", (inst, def) => {
|
|
28199
29027
|
if (!inst._zod)
|
|
28200
29028
|
throw new Error("Uninitialized schema in ZodMiniType.");
|
|
@@ -28236,7 +29064,7 @@ function object(shape, params) {
|
|
|
28236
29064
|
};
|
|
28237
29065
|
return new ZodMiniObject(def);
|
|
28238
29066
|
}
|
|
28239
|
-
//
|
|
29067
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
|
|
28240
29068
|
function isZ4Schema(s) {
|
|
28241
29069
|
const schema = s;
|
|
28242
29070
|
return !!schema._zod;
|
|
@@ -28379,7 +29207,7 @@ function getLiteralValue(schema) {
|
|
|
28379
29207
|
return directValue;
|
|
28380
29208
|
return;
|
|
28381
29209
|
}
|
|
28382
|
-
//
|
|
29210
|
+
// node_modules/zod/v4/classic/iso.js
|
|
28383
29211
|
var exports_iso2 = {};
|
|
28384
29212
|
__export(exports_iso2, {
|
|
28385
29213
|
time: () => time2,
|
|
@@ -28420,7 +29248,7 @@ function duration2(params) {
|
|
|
28420
29248
|
return _isoDuration(ZodISODuration, params);
|
|
28421
29249
|
}
|
|
28422
29250
|
|
|
28423
|
-
//
|
|
29251
|
+
// node_modules/zod/v4/classic/errors.js
|
|
28424
29252
|
var initializer2 = (inst, issues) => {
|
|
28425
29253
|
$ZodError.init(inst, issues);
|
|
28426
29254
|
inst.name = "ZodError";
|
|
@@ -28449,13 +29277,13 @@ var ZodRealError = $constructor("ZodError", initializer2, {
|
|
|
28449
29277
|
Parent: Error
|
|
28450
29278
|
});
|
|
28451
29279
|
|
|
28452
|
-
//
|
|
29280
|
+
// node_modules/zod/v4/classic/parse.js
|
|
28453
29281
|
var parse4 = /* @__PURE__ */ _parse(ZodRealError);
|
|
28454
29282
|
var parseAsync2 = /* @__PURE__ */ _parseAsync(ZodRealError);
|
|
28455
29283
|
var safeParse3 = /* @__PURE__ */ _safeParse(ZodRealError);
|
|
28456
29284
|
var safeParseAsync3 = /* @__PURE__ */ _safeParseAsync(ZodRealError);
|
|
28457
29285
|
|
|
28458
|
-
//
|
|
29286
|
+
// node_modules/zod/v4/classic/schemas.js
|
|
28459
29287
|
var ZodType2 = /* @__PURE__ */ $constructor("ZodType", (inst, def) => {
|
|
28460
29288
|
$ZodType.init(inst, def);
|
|
28461
29289
|
inst.def = def;
|
|
@@ -29060,10 +29888,10 @@ function superRefine(fn) {
|
|
|
29060
29888
|
function preprocess(fn, schema) {
|
|
29061
29889
|
return pipe(transform(fn), schema);
|
|
29062
29890
|
}
|
|
29063
|
-
//
|
|
29891
|
+
// node_modules/zod/v4/classic/external.js
|
|
29064
29892
|
config(en_default2());
|
|
29065
29893
|
|
|
29066
|
-
//
|
|
29894
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
|
|
29067
29895
|
var LATEST_PROTOCOL_VERSION = "2025-11-25";
|
|
29068
29896
|
var SUPPORTED_PROTOCOL_VERSIONS = [LATEST_PROTOCOL_VERSION, "2025-06-18", "2025-03-26", "2024-11-05", "2024-10-07"];
|
|
29069
29897
|
var RELATED_TASK_META_KEY = "io.modelcontextprotocol/related-task";
|
|
@@ -29905,12 +30733,12 @@ class UrlElicitationRequiredError extends McpError {
|
|
|
29905
30733
|
}
|
|
29906
30734
|
}
|
|
29907
30735
|
|
|
29908
|
-
//
|
|
30736
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
|
|
29909
30737
|
function isTerminal(status) {
|
|
29910
30738
|
return status === "completed" || status === "failed" || status === "cancelled";
|
|
29911
30739
|
}
|
|
29912
30740
|
|
|
29913
|
-
//
|
|
30741
|
+
// node_modules/zod-to-json-schema/dist/esm/Options.js
|
|
29914
30742
|
var ignoreOverride = Symbol("Let zodToJsonSchema decide on which parser to use");
|
|
29915
30743
|
var defaultOptions = {
|
|
29916
30744
|
name: undefined,
|
|
@@ -29943,7 +30771,7 @@ var getDefaultOptions = (options) => typeof options === "string" ? {
|
|
|
29943
30771
|
...defaultOptions,
|
|
29944
30772
|
...options
|
|
29945
30773
|
};
|
|
29946
|
-
//
|
|
30774
|
+
// node_modules/zod-to-json-schema/dist/esm/Refs.js
|
|
29947
30775
|
var getRefs = (options) => {
|
|
29948
30776
|
const _options = getDefaultOptions(options);
|
|
29949
30777
|
const currentPath = _options.name !== undefined ? [..._options.basePath, _options.definitionPath, _options.name] : _options.basePath;
|
|
@@ -29962,7 +30790,7 @@ var getRefs = (options) => {
|
|
|
29962
30790
|
]))
|
|
29963
30791
|
};
|
|
29964
30792
|
};
|
|
29965
|
-
//
|
|
30793
|
+
// node_modules/zod-to-json-schema/dist/esm/errorMessages.js
|
|
29966
30794
|
function addErrorMessage(res, key, errorMessage, refs) {
|
|
29967
30795
|
if (!refs?.errorMessages)
|
|
29968
30796
|
return;
|
|
@@ -29977,7 +30805,7 @@ function setResponseValueAndErrors(res, key, value, errorMessage, refs) {
|
|
|
29977
30805
|
res[key] = value;
|
|
29978
30806
|
addErrorMessage(res, key, errorMessage, refs);
|
|
29979
30807
|
}
|
|
29980
|
-
//
|
|
30808
|
+
// node_modules/zod-to-json-schema/dist/esm/getRelativePath.js
|
|
29981
30809
|
var getRelativePath = (pathA, pathB) => {
|
|
29982
30810
|
let i = 0;
|
|
29983
30811
|
for (;i < pathA.length && i < pathB.length; i++) {
|
|
@@ -29986,7 +30814,7 @@ var getRelativePath = (pathA, pathB) => {
|
|
|
29986
30814
|
}
|
|
29987
30815
|
return [(pathA.length - i).toString(), ...pathB.slice(i)].join("/");
|
|
29988
30816
|
};
|
|
29989
|
-
//
|
|
30817
|
+
// node_modules/zod-to-json-schema/dist/esm/parsers/any.js
|
|
29990
30818
|
function parseAnyDef(refs) {
|
|
29991
30819
|
if (refs.target !== "openAi") {
|
|
29992
30820
|
return {};
|
|
@@ -30002,7 +30830,7 @@ function parseAnyDef(refs) {
|
|
|
30002
30830
|
};
|
|
30003
30831
|
}
|
|
30004
30832
|
|
|
30005
|
-
//
|
|
30833
|
+
// node_modules/zod-to-json-schema/dist/esm/parsers/array.js
|
|
30006
30834
|
function parseArrayDef(def, refs) {
|
|
30007
30835
|
const res = {
|
|
30008
30836
|
type: "array"
|
|
@@ -30026,7 +30854,7 @@ function parseArrayDef(def, refs) {
|
|
|
30026
30854
|
return res;
|
|
30027
30855
|
}
|
|
30028
30856
|
|
|
30029
|
-
//
|
|
30857
|
+
// node_modules/zod-to-json-schema/dist/esm/parsers/bigint.js
|
|
30030
30858
|
function parseBigintDef(def, refs) {
|
|
30031
30859
|
const res = {
|
|
30032
30860
|
type: "integer",
|
|
@@ -30072,24 +30900,24 @@ function parseBigintDef(def, refs) {
|
|
|
30072
30900
|
return res;
|
|
30073
30901
|
}
|
|
30074
30902
|
|
|
30075
|
-
//
|
|
30903
|
+
// node_modules/zod-to-json-schema/dist/esm/parsers/boolean.js
|
|
30076
30904
|
function parseBooleanDef() {
|
|
30077
30905
|
return {
|
|
30078
30906
|
type: "boolean"
|
|
30079
30907
|
};
|
|
30080
30908
|
}
|
|
30081
30909
|
|
|
30082
|
-
//
|
|
30910
|
+
// node_modules/zod-to-json-schema/dist/esm/parsers/branded.js
|
|
30083
30911
|
function parseBrandedDef(_def, refs) {
|
|
30084
30912
|
return parseDef(_def.type._def, refs);
|
|
30085
30913
|
}
|
|
30086
30914
|
|
|
30087
|
-
//
|
|
30915
|
+
// node_modules/zod-to-json-schema/dist/esm/parsers/catch.js
|
|
30088
30916
|
var parseCatchDef = (def, refs) => {
|
|
30089
30917
|
return parseDef(def.innerType._def, refs);
|
|
30090
30918
|
};
|
|
30091
30919
|
|
|
30092
|
-
//
|
|
30920
|
+
// node_modules/zod-to-json-schema/dist/esm/parsers/date.js
|
|
30093
30921
|
function parseDateDef(def, refs, overrideDateStrategy) {
|
|
30094
30922
|
const strategy = overrideDateStrategy ?? refs.dateStrategy;
|
|
30095
30923
|
if (Array.isArray(strategy)) {
|
|
@@ -30134,7 +30962,7 @@ var integerDateParser = (def, refs) => {
|
|
|
30134
30962
|
return res;
|
|
30135
30963
|
};
|
|
30136
30964
|
|
|
30137
|
-
//
|
|
30965
|
+
// node_modules/zod-to-json-schema/dist/esm/parsers/default.js
|
|
30138
30966
|
function parseDefaultDef(_def, refs) {
|
|
30139
30967
|
return {
|
|
30140
30968
|
...parseDef(_def.innerType._def, refs),
|
|
@@ -30142,12 +30970,12 @@ function parseDefaultDef(_def, refs) {
|
|
|
30142
30970
|
};
|
|
30143
30971
|
}
|
|
30144
30972
|
|
|
30145
|
-
//
|
|
30973
|
+
// node_modules/zod-to-json-schema/dist/esm/parsers/effects.js
|
|
30146
30974
|
function parseEffectsDef(_def, refs) {
|
|
30147
30975
|
return refs.effectStrategy === "input" ? parseDef(_def.schema._def, refs) : parseAnyDef(refs);
|
|
30148
30976
|
}
|
|
30149
30977
|
|
|
30150
|
-
//
|
|
30978
|
+
// node_modules/zod-to-json-schema/dist/esm/parsers/enum.js
|
|
30151
30979
|
function parseEnumDef(def) {
|
|
30152
30980
|
return {
|
|
30153
30981
|
type: "string",
|
|
@@ -30155,7 +30983,7 @@ function parseEnumDef(def) {
|
|
|
30155
30983
|
};
|
|
30156
30984
|
}
|
|
30157
30985
|
|
|
30158
|
-
//
|
|
30986
|
+
// node_modules/zod-to-json-schema/dist/esm/parsers/intersection.js
|
|
30159
30987
|
var isJsonSchema7AllOfType = (type) => {
|
|
30160
30988
|
if ("type" in type && type.type === "string")
|
|
30161
30989
|
return false;
|
|
@@ -30197,7 +31025,7 @@ function parseIntersectionDef(def, refs) {
|
|
|
30197
31025
|
} : undefined;
|
|
30198
31026
|
}
|
|
30199
31027
|
|
|
30200
|
-
//
|
|
31028
|
+
// node_modules/zod-to-json-schema/dist/esm/parsers/literal.js
|
|
30201
31029
|
function parseLiteralDef(def, refs) {
|
|
30202
31030
|
const parsedType2 = typeof def.value;
|
|
30203
31031
|
if (parsedType2 !== "bigint" && parsedType2 !== "number" && parsedType2 !== "boolean" && parsedType2 !== "string") {
|
|
@@ -30217,7 +31045,7 @@ function parseLiteralDef(def, refs) {
|
|
|
30217
31045
|
};
|
|
30218
31046
|
}
|
|
30219
31047
|
|
|
30220
|
-
//
|
|
31048
|
+
// node_modules/zod-to-json-schema/dist/esm/parsers/string.js
|
|
30221
31049
|
var emojiRegex2 = undefined;
|
|
30222
31050
|
var zodPatterns = {
|
|
30223
31051
|
cuid: /^[cC][^\s-]{8,}$/,
|
|
@@ -30514,7 +31342,7 @@ function stringifyRegExpWithFlags(regex, refs) {
|
|
|
30514
31342
|
return pattern;
|
|
30515
31343
|
}
|
|
30516
31344
|
|
|
30517
|
-
//
|
|
31345
|
+
// node_modules/zod-to-json-schema/dist/esm/parsers/record.js
|
|
30518
31346
|
function parseRecordDef(def, refs) {
|
|
30519
31347
|
if (refs.target === "openAi") {
|
|
30520
31348
|
console.warn("Warning: OpenAI may not support records in schemas! Try an array of key-value pairs instead.");
|
|
@@ -30566,7 +31394,7 @@ function parseRecordDef(def, refs) {
|
|
|
30566
31394
|
return schema;
|
|
30567
31395
|
}
|
|
30568
31396
|
|
|
30569
|
-
//
|
|
31397
|
+
// node_modules/zod-to-json-schema/dist/esm/parsers/map.js
|
|
30570
31398
|
function parseMapDef(def, refs) {
|
|
30571
31399
|
if (refs.mapStrategy === "record") {
|
|
30572
31400
|
return parseRecordDef(def, refs);
|
|
@@ -30591,7 +31419,7 @@ function parseMapDef(def, refs) {
|
|
|
30591
31419
|
};
|
|
30592
31420
|
}
|
|
30593
31421
|
|
|
30594
|
-
//
|
|
31422
|
+
// node_modules/zod-to-json-schema/dist/esm/parsers/nativeEnum.js
|
|
30595
31423
|
function parseNativeEnumDef(def) {
|
|
30596
31424
|
const object3 = def.values;
|
|
30597
31425
|
const actualKeys = Object.keys(def.values).filter((key) => {
|
|
@@ -30605,7 +31433,7 @@ function parseNativeEnumDef(def) {
|
|
|
30605
31433
|
};
|
|
30606
31434
|
}
|
|
30607
31435
|
|
|
30608
|
-
//
|
|
31436
|
+
// node_modules/zod-to-json-schema/dist/esm/parsers/never.js
|
|
30609
31437
|
function parseNeverDef(refs) {
|
|
30610
31438
|
return refs.target === "openAi" ? undefined : {
|
|
30611
31439
|
not: parseAnyDef({
|
|
@@ -30615,7 +31443,7 @@ function parseNeverDef(refs) {
|
|
|
30615
31443
|
};
|
|
30616
31444
|
}
|
|
30617
31445
|
|
|
30618
|
-
//
|
|
31446
|
+
// node_modules/zod-to-json-schema/dist/esm/parsers/null.js
|
|
30619
31447
|
function parseNullDef(refs) {
|
|
30620
31448
|
return refs.target === "openApi3" ? {
|
|
30621
31449
|
enum: ["null"],
|
|
@@ -30625,7 +31453,7 @@ function parseNullDef(refs) {
|
|
|
30625
31453
|
};
|
|
30626
31454
|
}
|
|
30627
31455
|
|
|
30628
|
-
//
|
|
31456
|
+
// node_modules/zod-to-json-schema/dist/esm/parsers/union.js
|
|
30629
31457
|
var primitiveMappings = {
|
|
30630
31458
|
ZodString: "string",
|
|
30631
31459
|
ZodNumber: "number",
|
|
@@ -30693,7 +31521,7 @@ var asAnyOf = (def, refs) => {
|
|
|
30693
31521
|
return anyOf.length ? { anyOf } : undefined;
|
|
30694
31522
|
};
|
|
30695
31523
|
|
|
30696
|
-
//
|
|
31524
|
+
// node_modules/zod-to-json-schema/dist/esm/parsers/nullable.js
|
|
30697
31525
|
function parseNullableDef(def, refs) {
|
|
30698
31526
|
if (["ZodString", "ZodNumber", "ZodBigInt", "ZodBoolean", "ZodNull"].includes(def.innerType._def.typeName) && (!def.innerType._def.checks || !def.innerType._def.checks.length)) {
|
|
30699
31527
|
if (refs.target === "openApi3") {
|
|
@@ -30725,7 +31553,7 @@ function parseNullableDef(def, refs) {
|
|
|
30725
31553
|
return base && { anyOf: [base, { type: "null" }] };
|
|
30726
31554
|
}
|
|
30727
31555
|
|
|
30728
|
-
//
|
|
31556
|
+
// node_modules/zod-to-json-schema/dist/esm/parsers/number.js
|
|
30729
31557
|
function parseNumberDef(def, refs) {
|
|
30730
31558
|
const res = {
|
|
30731
31559
|
type: "number"
|
|
@@ -30774,7 +31602,7 @@ function parseNumberDef(def, refs) {
|
|
|
30774
31602
|
return res;
|
|
30775
31603
|
}
|
|
30776
31604
|
|
|
30777
|
-
//
|
|
31605
|
+
// node_modules/zod-to-json-schema/dist/esm/parsers/object.js
|
|
30778
31606
|
function parseObjectDef(def, refs) {
|
|
30779
31607
|
const forceOptionalIntoNullable = refs.target === "openAi";
|
|
30780
31608
|
const result = {
|
|
@@ -30844,7 +31672,7 @@ function safeIsOptional(schema) {
|
|
|
30844
31672
|
}
|
|
30845
31673
|
}
|
|
30846
31674
|
|
|
30847
|
-
//
|
|
31675
|
+
// node_modules/zod-to-json-schema/dist/esm/parsers/optional.js
|
|
30848
31676
|
var parseOptionalDef = (def, refs) => {
|
|
30849
31677
|
if (refs.currentPath.toString() === refs.propertyPath?.toString()) {
|
|
30850
31678
|
return parseDef(def.innerType._def, refs);
|
|
@@ -30863,7 +31691,7 @@ var parseOptionalDef = (def, refs) => {
|
|
|
30863
31691
|
} : parseAnyDef(refs);
|
|
30864
31692
|
};
|
|
30865
31693
|
|
|
30866
|
-
//
|
|
31694
|
+
// node_modules/zod-to-json-schema/dist/esm/parsers/pipeline.js
|
|
30867
31695
|
var parsePipelineDef = (def, refs) => {
|
|
30868
31696
|
if (refs.pipeStrategy === "input") {
|
|
30869
31697
|
return parseDef(def.in._def, refs);
|
|
@@ -30883,12 +31711,12 @@ var parsePipelineDef = (def, refs) => {
|
|
|
30883
31711
|
};
|
|
30884
31712
|
};
|
|
30885
31713
|
|
|
30886
|
-
//
|
|
31714
|
+
// node_modules/zod-to-json-schema/dist/esm/parsers/promise.js
|
|
30887
31715
|
function parsePromiseDef(def, refs) {
|
|
30888
31716
|
return parseDef(def.type._def, refs);
|
|
30889
31717
|
}
|
|
30890
31718
|
|
|
30891
|
-
//
|
|
31719
|
+
// node_modules/zod-to-json-schema/dist/esm/parsers/set.js
|
|
30892
31720
|
function parseSetDef(def, refs) {
|
|
30893
31721
|
const items = parseDef(def.valueType._def, {
|
|
30894
31722
|
...refs,
|
|
@@ -30908,7 +31736,7 @@ function parseSetDef(def, refs) {
|
|
|
30908
31736
|
return schema;
|
|
30909
31737
|
}
|
|
30910
31738
|
|
|
30911
|
-
//
|
|
31739
|
+
// node_modules/zod-to-json-schema/dist/esm/parsers/tuple.js
|
|
30912
31740
|
function parseTupleDef(def, refs) {
|
|
30913
31741
|
if (def.rest) {
|
|
30914
31742
|
return {
|
|
@@ -30936,24 +31764,24 @@ function parseTupleDef(def, refs) {
|
|
|
30936
31764
|
}
|
|
30937
31765
|
}
|
|
30938
31766
|
|
|
30939
|
-
//
|
|
31767
|
+
// node_modules/zod-to-json-schema/dist/esm/parsers/undefined.js
|
|
30940
31768
|
function parseUndefinedDef(refs) {
|
|
30941
31769
|
return {
|
|
30942
31770
|
not: parseAnyDef(refs)
|
|
30943
31771
|
};
|
|
30944
31772
|
}
|
|
30945
31773
|
|
|
30946
|
-
//
|
|
31774
|
+
// node_modules/zod-to-json-schema/dist/esm/parsers/unknown.js
|
|
30947
31775
|
function parseUnknownDef(refs) {
|
|
30948
31776
|
return parseAnyDef(refs);
|
|
30949
31777
|
}
|
|
30950
31778
|
|
|
30951
|
-
//
|
|
31779
|
+
// node_modules/zod-to-json-schema/dist/esm/parsers/readonly.js
|
|
30952
31780
|
var parseReadonlyDef = (def, refs) => {
|
|
30953
31781
|
return parseDef(def.innerType._def, refs);
|
|
30954
31782
|
};
|
|
30955
31783
|
|
|
30956
|
-
//
|
|
31784
|
+
// node_modules/zod-to-json-schema/dist/esm/selectParser.js
|
|
30957
31785
|
var selectParser = (def, typeName, refs) => {
|
|
30958
31786
|
switch (typeName) {
|
|
30959
31787
|
case ZodFirstPartyTypeKind.ZodString:
|
|
@@ -31031,7 +31859,7 @@ var selectParser = (def, typeName, refs) => {
|
|
|
31031
31859
|
}
|
|
31032
31860
|
};
|
|
31033
31861
|
|
|
31034
|
-
//
|
|
31862
|
+
// node_modules/zod-to-json-schema/dist/esm/parseDef.js
|
|
31035
31863
|
function parseDef(def, refs, forceResolution = false) {
|
|
31036
31864
|
const seenItem = refs.seen.get(def);
|
|
31037
31865
|
if (refs.override) {
|
|
@@ -31086,7 +31914,7 @@ var addMeta = (def, refs, jsonSchema) => {
|
|
|
31086
31914
|
}
|
|
31087
31915
|
return jsonSchema;
|
|
31088
31916
|
};
|
|
31089
|
-
//
|
|
31917
|
+
// node_modules/zod-to-json-schema/dist/esm/zodToJsonSchema.js
|
|
31090
31918
|
var zodToJsonSchema = (schema, options) => {
|
|
31091
31919
|
const refs = getRefs(options);
|
|
31092
31920
|
let definitions = typeof options === "object" && options.definitions ? Object.entries(options.definitions).reduce((acc, [name2, schema2]) => ({
|
|
@@ -31146,7 +31974,7 @@ var zodToJsonSchema = (schema, options) => {
|
|
|
31146
31974
|
}
|
|
31147
31975
|
return combined;
|
|
31148
31976
|
};
|
|
31149
|
-
//
|
|
31977
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
|
|
31150
31978
|
function mapMiniTarget(t) {
|
|
31151
31979
|
if (!t)
|
|
31152
31980
|
return "draft-7";
|
|
@@ -31188,7 +32016,7 @@ function parseWithCompat(schema, data) {
|
|
|
31188
32016
|
return result.data;
|
|
31189
32017
|
}
|
|
31190
32018
|
|
|
31191
|
-
//
|
|
32019
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js
|
|
31192
32020
|
var DEFAULT_REQUEST_TIMEOUT_MSEC = 60000;
|
|
31193
32021
|
|
|
31194
32022
|
class Protocol {
|
|
@@ -32029,7 +32857,7 @@ function mergeCapabilities(base, additional) {
|
|
|
32029
32857
|
return result;
|
|
32030
32858
|
}
|
|
32031
32859
|
|
|
32032
|
-
//
|
|
32860
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
|
|
32033
32861
|
var import_ajv = __toESM(require_ajv(), 1);
|
|
32034
32862
|
var import_ajv_formats = __toESM(require_dist(), 1);
|
|
32035
32863
|
function createDefaultAjvInstance() {
|
|
@@ -32069,7 +32897,7 @@ class AjvJsonSchemaValidator {
|
|
|
32069
32897
|
}
|
|
32070
32898
|
}
|
|
32071
32899
|
|
|
32072
|
-
//
|
|
32900
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
|
|
32073
32901
|
class ExperimentalServerTasks {
|
|
32074
32902
|
constructor(_server) {
|
|
32075
32903
|
this._server = _server;
|
|
@@ -32147,7 +32975,7 @@ class ExperimentalServerTasks {
|
|
|
32147
32975
|
}
|
|
32148
32976
|
}
|
|
32149
32977
|
|
|
32150
|
-
//
|
|
32978
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
|
|
32151
32979
|
function assertToolsCallTaskCapability(requests, method, entityName) {
|
|
32152
32980
|
if (!requests) {
|
|
32153
32981
|
throw new Error(`${entityName} does not support task creation (required for ${method})`);
|
|
@@ -32182,7 +33010,7 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
|
|
|
32182
33010
|
}
|
|
32183
33011
|
}
|
|
32184
33012
|
|
|
32185
|
-
//
|
|
33013
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
|
|
32186
33014
|
class Server extends Protocol {
|
|
32187
33015
|
constructor(_serverInfo, options) {
|
|
32188
33016
|
super(options);
|
|
@@ -32515,7 +33343,7 @@ class Server extends Protocol {
|
|
|
32515
33343
|
}
|
|
32516
33344
|
}
|
|
32517
33345
|
|
|
32518
|
-
//
|
|
33346
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
|
|
32519
33347
|
var COMPLETABLE_SYMBOL = Symbol.for("mcp.completable");
|
|
32520
33348
|
function isCompletable(schema) {
|
|
32521
33349
|
return !!schema && typeof schema === "object" && COMPLETABLE_SYMBOL in schema;
|
|
@@ -32529,7 +33357,7 @@ var McpZodTypeKind;
|
|
|
32529
33357
|
McpZodTypeKind2["Completable"] = "McpCompletable";
|
|
32530
33358
|
})(McpZodTypeKind || (McpZodTypeKind = {}));
|
|
32531
33359
|
|
|
32532
|
-
//
|
|
33360
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
|
|
32533
33361
|
var TOOL_NAME_REGEX = /^[A-Za-z0-9._-]{1,128}$/;
|
|
32534
33362
|
function validateToolName(name) {
|
|
32535
33363
|
const warnings = [];
|
|
@@ -32587,7 +33415,7 @@ function validateAndWarnToolName(name) {
|
|
|
32587
33415
|
return result.isValid;
|
|
32588
33416
|
}
|
|
32589
33417
|
|
|
32590
|
-
//
|
|
33418
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
|
|
32591
33419
|
class ExperimentalMcpServerTasks {
|
|
32592
33420
|
constructor(_mcpServer) {
|
|
32593
33421
|
this._mcpServer = _mcpServer;
|
|
@@ -32602,7 +33430,7 @@ class ExperimentalMcpServerTasks {
|
|
|
32602
33430
|
}
|
|
32603
33431
|
}
|
|
32604
33432
|
|
|
32605
|
-
//
|
|
33433
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
|
|
32606
33434
|
init_zod();
|
|
32607
33435
|
|
|
32608
33436
|
class McpServer {
|
|
@@ -33330,10 +34158,10 @@ var EMPTY_COMPLETION_RESULT = {
|
|
|
33330
34158
|
}
|
|
33331
34159
|
};
|
|
33332
34160
|
|
|
33333
|
-
//
|
|
34161
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
33334
34162
|
import process2 from "process";
|
|
33335
34163
|
|
|
33336
|
-
//
|
|
34164
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/shared/stdio.js
|
|
33337
34165
|
class ReadBuffer {
|
|
33338
34166
|
append(chunk) {
|
|
33339
34167
|
this._buffer = this._buffer ? Buffer.concat([this._buffer, chunk]) : chunk;
|
|
@@ -33363,7 +34191,7 @@ function serializeMessage(message) {
|
|
|
33363
34191
|
`;
|
|
33364
34192
|
}
|
|
33365
34193
|
|
|
33366
|
-
//
|
|
34194
|
+
// node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
|
|
33367
34195
|
class StdioServerTransport {
|
|
33368
34196
|
constructor(_stdin = process2.stdin, _stdout = process2.stdout) {
|
|
33369
34197
|
this._stdin = _stdin;
|
|
@@ -33423,7 +34251,7 @@ class StdioServerTransport {
|
|
|
33423
34251
|
|
|
33424
34252
|
// src/lib/registry.ts
|
|
33425
34253
|
init_builtins();
|
|
33426
|
-
import { existsSync as
|
|
34254
|
+
import { existsSync as existsSync7, readFileSync as readFileSync4 } from "fs";
|
|
33427
34255
|
import { join as join9, dirname as dirname5 } from "path";
|
|
33428
34256
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
33429
34257
|
|
|
@@ -39698,14 +40526,14 @@ function loadConnectorVersions() {
|
|
|
39698
40526
|
join9(thisDir, "..", "connectors"),
|
|
39699
40527
|
join9(thisDir, "..", "..", "connectors")
|
|
39700
40528
|
];
|
|
39701
|
-
const connectorsDir = candidates.find((d) =>
|
|
40529
|
+
const connectorsDir = candidates.find((d) => existsSync7(d));
|
|
39702
40530
|
if (!connectorsDir)
|
|
39703
40531
|
return;
|
|
39704
40532
|
for (const connector of CONNECTORS) {
|
|
39705
40533
|
try {
|
|
39706
40534
|
const pkgPath = join9(connectorsDir, `connect-${connector.name}`, "package.json");
|
|
39707
|
-
if (
|
|
39708
|
-
const pkg = JSON.parse(
|
|
40535
|
+
if (existsSync7(pkgPath)) {
|
|
40536
|
+
const pkg = JSON.parse(readFileSync4(pkgPath, "utf-8"));
|
|
39709
40537
|
connector.version = pkg.version || "0.0.0";
|
|
39710
40538
|
continue;
|
|
39711
40539
|
}
|
|
@@ -39884,355 +40712,7 @@ function registerDiscoveryTools(server, stripped) {
|
|
|
39884
40712
|
// src/mcp/tools/management.ts
|
|
39885
40713
|
init_zod();
|
|
39886
40714
|
init_installer();
|
|
39887
|
-
|
|
39888
|
-
// src/server/auth.ts
|
|
39889
|
-
import { existsSync as existsSync12, readFileSync as readFileSync6, writeFileSync as writeFileSync5, mkdirSync as mkdirSync9, readdirSync as readdirSync7, rmSync as rmSync3, statSync as statSync5 } from "fs";
|
|
39890
|
-
init_installer();
|
|
39891
|
-
import { join as join13 } from "path";
|
|
39892
|
-
|
|
39893
|
-
// src/lib/lock.ts
|
|
39894
|
-
init_database();
|
|
39895
|
-
import { openSync, closeSync, unlinkSync, existsSync as existsSync11, statSync as statSync4 } from "fs";
|
|
39896
|
-
import { join as join12 } from "path";
|
|
39897
|
-
import { mkdirSync as mkdirSync8 } from "fs";
|
|
39898
|
-
var LOCK_TIMEOUT_MS = 5000;
|
|
39899
|
-
var LOCK_RETRY_MS = 100;
|
|
39900
|
-
var STALE_LOCK_MS = 30000;
|
|
39901
|
-
|
|
39902
|
-
class LockTimeoutError extends Error {
|
|
39903
|
-
connector;
|
|
39904
|
-
constructor(connector) {
|
|
39905
|
-
super(`Could not acquire write lock for connector "${connector}" within ${LOCK_TIMEOUT_MS}ms. Another agent may be writing. Try again shortly.`);
|
|
39906
|
-
this.connector = connector;
|
|
39907
|
-
this.name = "LockTimeoutError";
|
|
39908
|
-
}
|
|
39909
|
-
}
|
|
39910
|
-
function lockPath(connector) {
|
|
39911
|
-
const dir = join12(getConnectorsHome(), `connect-${connector}`);
|
|
39912
|
-
mkdirSync8(dir, { recursive: true });
|
|
39913
|
-
return join12(dir, ".write.lock");
|
|
39914
|
-
}
|
|
39915
|
-
function isStale(path) {
|
|
39916
|
-
try {
|
|
39917
|
-
const stat = statSync4(path);
|
|
39918
|
-
return Date.now() - stat.mtimeMs > STALE_LOCK_MS;
|
|
39919
|
-
} catch {
|
|
39920
|
-
return false;
|
|
39921
|
-
}
|
|
39922
|
-
}
|
|
39923
|
-
function tryAcquire(path) {
|
|
39924
|
-
if (existsSync11(path) && isStale(path)) {
|
|
39925
|
-
try {
|
|
39926
|
-
unlinkSync(path);
|
|
39927
|
-
} catch {}
|
|
39928
|
-
}
|
|
39929
|
-
try {
|
|
39930
|
-
const fd = openSync(path, "wx");
|
|
39931
|
-
closeSync(fd);
|
|
39932
|
-
return true;
|
|
39933
|
-
} catch (e) {
|
|
39934
|
-
if (e.code === "EEXIST")
|
|
39935
|
-
return false;
|
|
39936
|
-
throw e;
|
|
39937
|
-
}
|
|
39938
|
-
}
|
|
39939
|
-
function release(path) {
|
|
39940
|
-
try {
|
|
39941
|
-
unlinkSync(path);
|
|
39942
|
-
} catch {}
|
|
39943
|
-
}
|
|
39944
|
-
async function withWriteLock(connector, fn) {
|
|
39945
|
-
const path = lockPath(connector);
|
|
39946
|
-
const deadline = Date.now() + LOCK_TIMEOUT_MS;
|
|
39947
|
-
while (Date.now() < deadline) {
|
|
39948
|
-
if (tryAcquire(path)) {
|
|
39949
|
-
try {
|
|
39950
|
-
return await fn();
|
|
39951
|
-
} finally {
|
|
39952
|
-
release(path);
|
|
39953
|
-
}
|
|
39954
|
-
}
|
|
39955
|
-
await new Promise((resolve) => setTimeout(resolve, LOCK_RETRY_MS));
|
|
39956
|
-
}
|
|
39957
|
-
throw new LockTimeoutError(connector);
|
|
39958
|
-
}
|
|
39959
|
-
|
|
39960
|
-
// src/server/auth.ts
|
|
39961
|
-
init_database();
|
|
39962
|
-
var FETCH_TIMEOUT = 1e4;
|
|
39963
|
-
var oauthStateStore = new Map;
|
|
39964
|
-
var GOOGLE_TOKEN_URL = "https://oauth2.googleapis.com/token";
|
|
39965
|
-
var GOOGLE_SCOPES = {
|
|
39966
|
-
gmail: [
|
|
39967
|
-
"https://www.googleapis.com/auth/gmail.readonly",
|
|
39968
|
-
"https://www.googleapis.com/auth/gmail.send",
|
|
39969
|
-
"https://www.googleapis.com/auth/gmail.compose",
|
|
39970
|
-
"https://www.googleapis.com/auth/gmail.modify",
|
|
39971
|
-
"https://www.googleapis.com/auth/gmail.labels",
|
|
39972
|
-
"https://mail.google.com/"
|
|
39973
|
-
].join(" "),
|
|
39974
|
-
googlecalendar: [
|
|
39975
|
-
"https://www.googleapis.com/auth/calendar",
|
|
39976
|
-
"https://www.googleapis.com/auth/calendar.events"
|
|
39977
|
-
].join(" "),
|
|
39978
|
-
googledrive: [
|
|
39979
|
-
"https://www.googleapis.com/auth/drive",
|
|
39980
|
-
"https://www.googleapis.com/auth/drive.file"
|
|
39981
|
-
].join(" "),
|
|
39982
|
-
googledocs: [
|
|
39983
|
-
"https://www.googleapis.com/auth/documents",
|
|
39984
|
-
"https://www.googleapis.com/auth/drive.file"
|
|
39985
|
-
].join(" "),
|
|
39986
|
-
googlesheets: [
|
|
39987
|
-
"https://www.googleapis.com/auth/spreadsheets",
|
|
39988
|
-
"https://www.googleapis.com/auth/drive.file"
|
|
39989
|
-
].join(" "),
|
|
39990
|
-
googletasks: [
|
|
39991
|
-
"https://www.googleapis.com/auth/tasks"
|
|
39992
|
-
].join(" "),
|
|
39993
|
-
googlecontacts: [
|
|
39994
|
-
"https://www.googleapis.com/auth/contacts",
|
|
39995
|
-
"https://www.googleapis.com/auth/contacts.readonly"
|
|
39996
|
-
].join(" "),
|
|
39997
|
-
google: [
|
|
39998
|
-
"openid",
|
|
39999
|
-
"https://www.googleapis.com/auth/userinfo.email",
|
|
40000
|
-
"https://www.googleapis.com/auth/userinfo.profile"
|
|
40001
|
-
].join(" ")
|
|
40002
|
-
};
|
|
40003
|
-
function getAuthType(name) {
|
|
40004
|
-
const docs = getConnectorDocs(name);
|
|
40005
|
-
if (!docs?.auth)
|
|
40006
|
-
return "apikey";
|
|
40007
|
-
const authLower = docs.auth.toLowerCase();
|
|
40008
|
-
if (authLower.includes("oauth"))
|
|
40009
|
-
return "oauth";
|
|
40010
|
-
if (authLower.includes("bearer token"))
|
|
40011
|
-
return "bearer";
|
|
40012
|
-
return "apikey";
|
|
40013
|
-
}
|
|
40014
|
-
function getConnectorConfigDir(name) {
|
|
40015
|
-
const connectorName = name.startsWith("connect-") ? name : `connect-${name}`;
|
|
40016
|
-
return join13(getConnectorsHome(), connectorName);
|
|
40017
|
-
}
|
|
40018
|
-
function getCurrentProfile2(name) {
|
|
40019
|
-
const configDir = getConnectorConfigDir(name);
|
|
40020
|
-
const currentProfileFile = join13(configDir, "current_profile");
|
|
40021
|
-
if (existsSync12(currentProfileFile)) {
|
|
40022
|
-
try {
|
|
40023
|
-
return readFileSync6(currentProfileFile, "utf-8").trim() || "default";
|
|
40024
|
-
} catch {
|
|
40025
|
-
return "default";
|
|
40026
|
-
}
|
|
40027
|
-
}
|
|
40028
|
-
return "default";
|
|
40029
|
-
}
|
|
40030
|
-
function loadProfileConfig(name) {
|
|
40031
|
-
const configDir = getConnectorConfigDir(name);
|
|
40032
|
-
const profile = getCurrentProfile2(name);
|
|
40033
|
-
let flatConfig = {};
|
|
40034
|
-
let dirConfig = {};
|
|
40035
|
-
const profileFile = join13(configDir, "profiles", `${profile}.json`);
|
|
40036
|
-
if (existsSync12(profileFile)) {
|
|
40037
|
-
try {
|
|
40038
|
-
flatConfig = JSON.parse(readFileSync6(profileFile, "utf-8"));
|
|
40039
|
-
} catch {}
|
|
40040
|
-
}
|
|
40041
|
-
const profileDirConfig = join13(configDir, "profiles", profile, "config.json");
|
|
40042
|
-
if (existsSync12(profileDirConfig)) {
|
|
40043
|
-
try {
|
|
40044
|
-
dirConfig = JSON.parse(readFileSync6(profileDirConfig, "utf-8"));
|
|
40045
|
-
} catch {}
|
|
40046
|
-
}
|
|
40047
|
-
if (Object.keys(flatConfig).length === 0 && Object.keys(dirConfig).length === 0) {
|
|
40048
|
-
return {};
|
|
40049
|
-
}
|
|
40050
|
-
return { ...flatConfig, ...dirConfig };
|
|
40051
|
-
}
|
|
40052
|
-
function loadTokens(name) {
|
|
40053
|
-
const configDir = getConnectorConfigDir(name);
|
|
40054
|
-
const profile = getCurrentProfile2(name);
|
|
40055
|
-
const tokensFile = join13(configDir, "profiles", profile, "tokens.json");
|
|
40056
|
-
if (existsSync12(tokensFile)) {
|
|
40057
|
-
try {
|
|
40058
|
-
return JSON.parse(readFileSync6(tokensFile, "utf-8"));
|
|
40059
|
-
} catch {
|
|
40060
|
-
return null;
|
|
40061
|
-
}
|
|
40062
|
-
}
|
|
40063
|
-
const profileConfig = loadProfileConfig(name);
|
|
40064
|
-
if (profileConfig.refreshToken || profileConfig.accessToken) {
|
|
40065
|
-
return {
|
|
40066
|
-
accessToken: profileConfig.accessToken ?? "",
|
|
40067
|
-
refreshToken: profileConfig.refreshToken,
|
|
40068
|
-
expiresAt: profileConfig.expiresAt ?? 0,
|
|
40069
|
-
tokenType: profileConfig.tokenType,
|
|
40070
|
-
scope: profileConfig.scope
|
|
40071
|
-
};
|
|
40072
|
-
}
|
|
40073
|
-
return null;
|
|
40074
|
-
}
|
|
40075
|
-
function getAuthStatus(name) {
|
|
40076
|
-
const authType = getAuthType(name);
|
|
40077
|
-
const docs = getConnectorDocs(name);
|
|
40078
|
-
const envVars = (docs?.envVars || []).map((v) => ({
|
|
40079
|
-
variable: v.variable,
|
|
40080
|
-
description: v.description,
|
|
40081
|
-
set: !!process.env[v.variable]
|
|
40082
|
-
}));
|
|
40083
|
-
const envVarTotalCount = envVars.length;
|
|
40084
|
-
const envVarSetCount = envVars.filter((v) => v.set).length;
|
|
40085
|
-
if (authType === "oauth") {
|
|
40086
|
-
const tokens = loadTokens(name);
|
|
40087
|
-
const config3 = loadProfileConfig(name);
|
|
40088
|
-
const hasTokens = !!tokens?.accessToken || !!config3.accessToken;
|
|
40089
|
-
const hasRefreshToken = !!tokens?.refreshToken || !!config3.refreshToken;
|
|
40090
|
-
const tokenExpiry = tokens?.expiresAt || config3.expiresAt;
|
|
40091
|
-
const hasEnvVar2 = envVars.some((v) => v.set);
|
|
40092
|
-
return {
|
|
40093
|
-
type: "oauth",
|
|
40094
|
-
configured: hasTokens || hasRefreshToken || hasEnvVar2,
|
|
40095
|
-
tokenExpiry,
|
|
40096
|
-
hasRefreshToken,
|
|
40097
|
-
envVars,
|
|
40098
|
-
envVarSetCount,
|
|
40099
|
-
envVarTotalCount
|
|
40100
|
-
};
|
|
40101
|
-
}
|
|
40102
|
-
const config2 = loadProfileConfig(name);
|
|
40103
|
-
const hasKey = Object.values(config2).some((v) => typeof v === "string" && v.length > 0);
|
|
40104
|
-
const hasEnvVar = envVars.some((v) => v.set);
|
|
40105
|
-
return {
|
|
40106
|
-
type: authType,
|
|
40107
|
-
configured: hasKey || hasEnvVar,
|
|
40108
|
-
envVars,
|
|
40109
|
-
envVarSetCount,
|
|
40110
|
-
envVarTotalCount
|
|
40111
|
-
};
|
|
40112
|
-
}
|
|
40113
|
-
async function saveApiKey(name, key, field) {
|
|
40114
|
-
return withWriteLock(name, () => _saveApiKey(name, key, field));
|
|
40115
|
-
}
|
|
40116
|
-
function _saveApiKey(name, key, field) {
|
|
40117
|
-
const configDir = getConnectorConfigDir(name);
|
|
40118
|
-
const profile = getCurrentProfile2(name);
|
|
40119
|
-
const keyField = field || guessKeyField(name);
|
|
40120
|
-
if (keyField === "clientId" || keyField === "clientSecret") {
|
|
40121
|
-
const credentialsFile = join13(configDir, "credentials.json");
|
|
40122
|
-
mkdirSync9(configDir, { recursive: true });
|
|
40123
|
-
let creds = {};
|
|
40124
|
-
if (existsSync12(credentialsFile)) {
|
|
40125
|
-
try {
|
|
40126
|
-
creds = JSON.parse(readFileSync6(credentialsFile, "utf-8"));
|
|
40127
|
-
} catch {}
|
|
40128
|
-
}
|
|
40129
|
-
creds[keyField] = key;
|
|
40130
|
-
writeFileSync5(credentialsFile, JSON.stringify(creds, null, 2));
|
|
40131
|
-
return;
|
|
40132
|
-
}
|
|
40133
|
-
const profileFile = join13(configDir, "profiles", `${profile}.json`);
|
|
40134
|
-
const profileDir = join13(configDir, "profiles", profile);
|
|
40135
|
-
if (existsSync12(profileFile)) {
|
|
40136
|
-
let config2 = {};
|
|
40137
|
-
try {
|
|
40138
|
-
config2 = JSON.parse(readFileSync6(profileFile, "utf-8"));
|
|
40139
|
-
} catch {}
|
|
40140
|
-
config2[keyField] = key;
|
|
40141
|
-
writeFileSync5(profileFile, JSON.stringify(config2, null, 2));
|
|
40142
|
-
return;
|
|
40143
|
-
}
|
|
40144
|
-
if (existsSync12(profileDir)) {
|
|
40145
|
-
const configFile = join13(profileDir, "config.json");
|
|
40146
|
-
let config2 = {};
|
|
40147
|
-
if (existsSync12(configFile)) {
|
|
40148
|
-
try {
|
|
40149
|
-
config2 = JSON.parse(readFileSync6(configFile, "utf-8"));
|
|
40150
|
-
} catch {}
|
|
40151
|
-
}
|
|
40152
|
-
config2[keyField] = key;
|
|
40153
|
-
writeFileSync5(configFile, JSON.stringify(config2, null, 2));
|
|
40154
|
-
return;
|
|
40155
|
-
}
|
|
40156
|
-
mkdirSync9(profileDir, { recursive: true });
|
|
40157
|
-
writeFileSync5(join13(profileDir, "config.json"), JSON.stringify({ [keyField]: key }, null, 2));
|
|
40158
|
-
}
|
|
40159
|
-
function guessKeyField(name) {
|
|
40160
|
-
const docs = getConnectorDocs(name);
|
|
40161
|
-
if (!docs?.envVars.length)
|
|
40162
|
-
return "apiKey";
|
|
40163
|
-
const keyVar = docs.envVars.find((v) => v.variable.includes("API_KEY") || v.variable.includes("API_SECRET") || v.variable.includes("TOKEN") || v.variable.includes("SECRET"));
|
|
40164
|
-
if (keyVar) {
|
|
40165
|
-
const parts = keyVar.variable.toLowerCase().split("_");
|
|
40166
|
-
const withoutPrefix = parts.slice(1);
|
|
40167
|
-
if (withoutPrefix.length > 0) {
|
|
40168
|
-
return withoutPrefix.map((p, i) => i === 0 ? p : p.charAt(0).toUpperCase() + p.slice(1)).join("");
|
|
40169
|
-
}
|
|
40170
|
-
}
|
|
40171
|
-
return "apiKey";
|
|
40172
|
-
}
|
|
40173
|
-
function getOAuthConfig(name) {
|
|
40174
|
-
const configDir = getConnectorConfigDir(name);
|
|
40175
|
-
const credentialsFile = join13(configDir, "credentials.json");
|
|
40176
|
-
if (existsSync12(credentialsFile)) {
|
|
40177
|
-
try {
|
|
40178
|
-
const creds = JSON.parse(readFileSync6(credentialsFile, "utf-8"));
|
|
40179
|
-
return { clientId: creds.clientId, clientSecret: creds.clientSecret };
|
|
40180
|
-
} catch {}
|
|
40181
|
-
}
|
|
40182
|
-
const config2 = loadProfileConfig(name);
|
|
40183
|
-
return {
|
|
40184
|
-
clientId: config2.clientId,
|
|
40185
|
-
clientSecret: config2.clientSecret
|
|
40186
|
-
};
|
|
40187
|
-
}
|
|
40188
|
-
function saveOAuthTokens(name, tokens) {
|
|
40189
|
-
const configDir = getConnectorConfigDir(name);
|
|
40190
|
-
const profile = getCurrentProfile2(name);
|
|
40191
|
-
const profileDir = join13(configDir, "profiles", profile);
|
|
40192
|
-
mkdirSync9(profileDir, { recursive: true });
|
|
40193
|
-
const tokensFile = join13(profileDir, "tokens.json");
|
|
40194
|
-
writeFileSync5(tokensFile, JSON.stringify(tokens, null, 2), { mode: 384 });
|
|
40195
|
-
}
|
|
40196
|
-
async function refreshOAuthToken(name) {
|
|
40197
|
-
return withWriteLock(name, () => _refreshOAuthToken(name));
|
|
40198
|
-
}
|
|
40199
|
-
async function _refreshOAuthToken(name) {
|
|
40200
|
-
const oauthConfig = getOAuthConfig(name);
|
|
40201
|
-
const currentTokens = loadTokens(name);
|
|
40202
|
-
if (!oauthConfig.clientId || !oauthConfig.clientSecret) {
|
|
40203
|
-
throw new Error("OAuth credentials not configured for " + name);
|
|
40204
|
-
}
|
|
40205
|
-
if (!currentTokens?.refreshToken) {
|
|
40206
|
-
throw new Error("No refresh token available. Please re-authenticate.");
|
|
40207
|
-
}
|
|
40208
|
-
const response = await fetch(GOOGLE_TOKEN_URL, {
|
|
40209
|
-
method: "POST",
|
|
40210
|
-
headers: { "Content-Type": "application/x-www-form-urlencoded" },
|
|
40211
|
-
body: new URLSearchParams({
|
|
40212
|
-
client_id: oauthConfig.clientId,
|
|
40213
|
-
client_secret: oauthConfig.clientSecret,
|
|
40214
|
-
refresh_token: currentTokens.refreshToken,
|
|
40215
|
-
grant_type: "refresh_token"
|
|
40216
|
-
}),
|
|
40217
|
-
signal: AbortSignal.timeout(FETCH_TIMEOUT)
|
|
40218
|
-
});
|
|
40219
|
-
if (!response.ok) {
|
|
40220
|
-
const error2 = await response.json().catch(() => ({ error: response.statusText }));
|
|
40221
|
-
throw new Error(`Token refresh failed: ${error2.error_description || error2.error}`);
|
|
40222
|
-
}
|
|
40223
|
-
const data = await response.json();
|
|
40224
|
-
const tokens = {
|
|
40225
|
-
accessToken: data.access_token,
|
|
40226
|
-
refreshToken: currentTokens.refreshToken,
|
|
40227
|
-
expiresAt: Date.now() + data.expires_in * 1000,
|
|
40228
|
-
tokenType: data.token_type,
|
|
40229
|
-
scope: data.scope || currentTokens.scope
|
|
40230
|
-
};
|
|
40231
|
-
saveOAuthTokens(name, tokens);
|
|
40232
|
-
return tokens;
|
|
40233
|
-
}
|
|
40234
|
-
|
|
40235
|
-
// src/mcp/tools/management.ts
|
|
40715
|
+
init_auth();
|
|
40236
40716
|
function registerManagementTools(server, stripped) {
|
|
40237
40717
|
server.registerTool("install_connector", {
|
|
40238
40718
|
title: "Install Connector",
|
|
@@ -40375,8 +40855,9 @@ function registerManagementTools(server, stripped) {
|
|
|
40375
40855
|
}
|
|
40376
40856
|
// src/mcp/tools/auth.ts
|
|
40377
40857
|
init_zod();
|
|
40858
|
+
init_auth();
|
|
40378
40859
|
init_database();
|
|
40379
|
-
import { existsSync as
|
|
40860
|
+
import { existsSync as existsSync12, readFileSync as readFileSync8 } from "fs";
|
|
40380
40861
|
import { join as join14 } from "path";
|
|
40381
40862
|
import { spawn } from "child_process";
|
|
40382
40863
|
function registerAuthTools(server, stripped) {
|
|
@@ -40496,7 +40977,7 @@ function registerAuthTools(server, stripped) {
|
|
|
40496
40977
|
};
|
|
40497
40978
|
}
|
|
40498
40979
|
}
|
|
40499
|
-
const tokens =
|
|
40980
|
+
const tokens = loadTokens2(name);
|
|
40500
40981
|
if (tokens?.accessToken && tokens?.refreshToken) {
|
|
40501
40982
|
if (tokens.expiresAt && Date.now() < tokens.expiresAt - 60000) {
|
|
40502
40983
|
const mins = Math.floor((tokens.expiresAt - Date.now()) / 60000);
|
|
@@ -40533,7 +41014,7 @@ function registerAuthTools(server, stripped) {
|
|
|
40533
41014
|
const maxAttempts = 120;
|
|
40534
41015
|
while (attempts < maxAttempts) {
|
|
40535
41016
|
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
40536
|
-
if (
|
|
41017
|
+
if (existsSync12(tokensPath)) {
|
|
40537
41018
|
break;
|
|
40538
41019
|
}
|
|
40539
41020
|
attempts++;
|
|
@@ -40552,7 +41033,7 @@ function registerAuthTools(server, stripped) {
|
|
|
40552
41033
|
};
|
|
40553
41034
|
}
|
|
40554
41035
|
try {
|
|
40555
|
-
const tokenData = JSON.parse(
|
|
41036
|
+
const tokenData = JSON.parse(readFileSync8(tokensPath, "utf-8"));
|
|
40556
41037
|
return {
|
|
40557
41038
|
content: [{
|
|
40558
41039
|
type: "text",
|
|
@@ -40596,6 +41077,7 @@ function registerAuthTools(server, stripped) {
|
|
|
40596
41077
|
}
|
|
40597
41078
|
// src/mcp/tools/operations.ts
|
|
40598
41079
|
init_zod();
|
|
41080
|
+
init_auth();
|
|
40599
41081
|
init_runner();
|
|
40600
41082
|
function registerOperationsTools(server, stripped) {
|
|
40601
41083
|
server.registerTool("list_connector_operations", {
|
|
@@ -40882,7 +41364,8 @@ function listWorkflows(db) {
|
|
|
40882
41364
|
}
|
|
40883
41365
|
|
|
40884
41366
|
// src/lib/workflow-runner.ts
|
|
40885
|
-
import { spawn as
|
|
41367
|
+
import { spawn as nodeSpawn } from "child_process";
|
|
41368
|
+
var spawnImpl = nodeSpawn;
|
|
40886
41369
|
async function runStep(step, previousOutput) {
|
|
40887
41370
|
return new Promise((resolve) => {
|
|
40888
41371
|
const args = [...step.args ?? []];
|
|
@@ -40890,7 +41373,7 @@ async function runStep(step, previousOutput) {
|
|
|
40890
41373
|
args.push("--input", previousOutput.trim().slice(0, 4096));
|
|
40891
41374
|
}
|
|
40892
41375
|
const cmdArgs = ["run", step.connector, step.command, ...args, "--format", "json"];
|
|
40893
|
-
const proc =
|
|
41376
|
+
const proc = spawnImpl("connectors", cmdArgs, { shell: false });
|
|
40894
41377
|
let output = "";
|
|
40895
41378
|
proc.stdout.on("data", (d) => {
|
|
40896
41379
|
output += d.toString();
|
|
@@ -40932,11 +41415,11 @@ async function runWorkflow(workflow) {
|
|
|
40932
41415
|
}
|
|
40933
41416
|
|
|
40934
41417
|
// src/lib/scheduler.ts
|
|
40935
|
-
import { spawn as
|
|
41418
|
+
import { spawn as spawn3 } from "child_process";
|
|
40936
41419
|
async function runConnectorCommand2(connector, command, args) {
|
|
40937
41420
|
return new Promise((resolve) => {
|
|
40938
41421
|
const cmdArgs = [connector, command, ...args, "--format", "json"];
|
|
40939
|
-
const proc =
|
|
41422
|
+
const proc = spawn3("connectors", ["run", ...cmdArgs], { shell: false });
|
|
40940
41423
|
let output = "";
|
|
40941
41424
|
proc.stdout.on("data", (d) => {
|
|
40942
41425
|
output += d.toString();
|