@composio/core 0.1.36-next.9 → 0.1.36
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/dist/index.cjs +1337 -938
- package/dist/index.d.cts +43280 -11701
- package/dist/index.d.ts +43280 -11701
- package/dist/index.js +1325 -932
- package/generated/gmail.ts +0 -20
- package/generated/index.ts +26 -961
- package/generated/slack.ts +2 -199
- package/package.json +6 -5
package/dist/index.cjs
CHANGED
|
@@ -79,6 +79,7 @@ __export(index_exports, {
|
|
|
79
79
|
ConnectionRequestErrorCodes: () => ConnectionRequestErrorCodes,
|
|
80
80
|
ConnectionRequestFailedError: () => ConnectionRequestFailedError,
|
|
81
81
|
ConnectionRequestTimeoutError: () => ConnectionRequestTimeoutError,
|
|
82
|
+
ConnectionStatus: () => ConnectionStatus,
|
|
82
83
|
ConnectionStatuses: () => ConnectionStatuses,
|
|
83
84
|
CreateAuthConfigParamsSchema: () => CreateAuthConfigParamsSchema,
|
|
84
85
|
CreateAuthConfigResponseSchema: () => CreateAuthConfigResponseSchema,
|
|
@@ -88,7 +89,10 @@ __export(index_exports, {
|
|
|
88
89
|
CreateConnectedAccountResponseSchema: () => CreateConnectedAccountResponseSchema,
|
|
89
90
|
CreateCustomAuthConfigParamsSchema: () => CreateCustomAuthConfigParamsSchema,
|
|
90
91
|
CustomAuthParamsSchema: () => CustomAuthParamsSchema,
|
|
92
|
+
CustomConnectionDataSchema: () => CustomConnectionDataSchema,
|
|
91
93
|
CustomCreateResponseSchema: () => CustomCreateResponseSchema,
|
|
94
|
+
CustomOauth1ConnectionDataSchema: () => CustomOauth1ConnectionDataSchema,
|
|
95
|
+
CustomOauth2ConnectionDataSchema: () => CustomOauth2ConnectionDataSchema,
|
|
92
96
|
DefaultCreateConnectedAccountParamsSchema: () => DefaultCreateConnectedAccountParamsSchema,
|
|
93
97
|
GenerateURLParamsSchema: () => GenerateURLParamsSchema,
|
|
94
98
|
GenerateURLResponseSchema: () => GenerateURLResponseSchema,
|
|
@@ -115,12 +119,14 @@ __export(index_exports, {
|
|
|
115
119
|
Oauth1ConnectionDataSchema: () => Oauth1ConnectionDataSchema,
|
|
116
120
|
Oauth1ExpiredConnectionDataSchema: () => Oauth1ExpiredConnectionDataSchema,
|
|
117
121
|
Oauth1FailedConnectionDataSchema: () => Oauth1FailedConnectionDataSchema,
|
|
122
|
+
Oauth1InactiveConnectionDataSchema: () => Oauth1InactiveConnectionDataSchema,
|
|
118
123
|
Oauth1InitiatedConnectionDataSchema: () => Oauth1InitiatedConnectionDataSchema,
|
|
119
124
|
Oauth1InitiatingConnectionDataSchema: () => Oauth1InitiatingConnectionDataSchema,
|
|
120
125
|
Oauth2ActiveConnectionDataSchema: () => Oauth2ActiveConnectionDataSchema,
|
|
121
126
|
Oauth2ConnectionDataSchema: () => Oauth2ConnectionDataSchema,
|
|
122
127
|
Oauth2ExpiredConnectionDataSchema: () => Oauth2ExpiredConnectionDataSchema,
|
|
123
128
|
Oauth2FailedConnectionDataSchema: () => Oauth2FailedConnectionDataSchema,
|
|
129
|
+
Oauth2InactiveConnectionDataSchema: () => Oauth2InactiveConnectionDataSchema,
|
|
124
130
|
Oauth2InitiatedConnectionDataSchema: () => Oauth2InitiatedConnectionDataSchema,
|
|
125
131
|
Oauth2InitiatingConnectionDataSchema: () => Oauth2InitiatingConnectionDataSchema,
|
|
126
132
|
OpenAIProvider: () => OpenAIProvider,
|
|
@@ -175,13 +181,603 @@ module.exports = __toCommonJS(index_exports);
|
|
|
175
181
|
var import_client7 = __toESM(require("@composio/client"), 1);
|
|
176
182
|
|
|
177
183
|
// src/types/tool.types.ts
|
|
184
|
+
var import_zod3 = require("zod");
|
|
185
|
+
|
|
186
|
+
// src/types/connectedAccountAuthStates.types.ts
|
|
187
|
+
var import_zod2 = require("zod");
|
|
188
|
+
|
|
189
|
+
// src/types/authConfigs.types.ts
|
|
178
190
|
var import_zod = require("zod");
|
|
179
|
-
var
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
191
|
+
var AuthConfigTypes = {
|
|
192
|
+
CUSTOM: "use_custom_auth",
|
|
193
|
+
COMPOSIO_MANAGED: "use_composio_managed_auth"
|
|
194
|
+
};
|
|
195
|
+
var AuthSchemeTypes = {
|
|
196
|
+
OAUTH1: "OAUTH1",
|
|
197
|
+
OAUTH2: "OAUTH2",
|
|
198
|
+
API_KEY: "API_KEY",
|
|
199
|
+
BASIC: "BASIC",
|
|
200
|
+
BEARER_TOKEN: "BEARER_TOKEN",
|
|
201
|
+
BILLCOM_AUTH: "BILLCOM_AUTH",
|
|
202
|
+
GOOGLE_SERVICE_ACCOUNT: "GOOGLE_SERVICE_ACCOUNT",
|
|
203
|
+
NO_AUTH: "NO_AUTH",
|
|
204
|
+
BASIC_WITH_JWT: "BASIC_WITH_JWT",
|
|
205
|
+
COMPOSIO_LINK: "COMPOSIO_LINK",
|
|
206
|
+
CALCOM_AUTH: "CALCOM_AUTH"
|
|
207
|
+
};
|
|
208
|
+
var AuthSchemeEnum = import_zod.z.enum([
|
|
209
|
+
"OAUTH2",
|
|
210
|
+
"OAUTH1",
|
|
211
|
+
"API_KEY",
|
|
212
|
+
"BASIC",
|
|
213
|
+
"BILLCOM_AUTH",
|
|
214
|
+
"BEARER_TOKEN",
|
|
215
|
+
"GOOGLE_SERVICE_ACCOUNT",
|
|
216
|
+
"NO_AUTH",
|
|
217
|
+
"BASIC_WITH_JWT",
|
|
218
|
+
"COMPOSIO_LINK",
|
|
219
|
+
"CALCOM_AUTH"
|
|
220
|
+
]);
|
|
221
|
+
var CreateCustomAuthConfigParamsSchema = import_zod.z.object({
|
|
222
|
+
type: import_zod.z.literal("use_custom_auth"),
|
|
223
|
+
name: import_zod.z.string().optional(),
|
|
224
|
+
credentials: import_zod.z.record(import_zod.z.string(), import_zod.z.union([import_zod.z.string(), import_zod.z.number(), import_zod.z.boolean()])),
|
|
225
|
+
authScheme: AuthSchemeEnum,
|
|
226
|
+
restrictToFollowingTools: import_zod.z.array(import_zod.z.string()).optional()
|
|
227
|
+
});
|
|
228
|
+
var CreateComposioManagedAuthConfigParamsSchema = import_zod.z.object({
|
|
229
|
+
type: import_zod.z.literal("use_composio_managed_auth"),
|
|
230
|
+
name: import_zod.z.string().optional(),
|
|
231
|
+
credentials: import_zod.z.record(import_zod.z.string(), import_zod.z.union([import_zod.z.string(), import_zod.z.number(), import_zod.z.boolean()])).optional(),
|
|
232
|
+
restrictToFollowingTools: import_zod.z.array(import_zod.z.string()).optional()
|
|
233
|
+
});
|
|
234
|
+
var CreateAuthConfigParamsSchema = import_zod.z.discriminatedUnion("type", [
|
|
235
|
+
CreateCustomAuthConfigParamsSchema,
|
|
236
|
+
CreateComposioManagedAuthConfigParamsSchema
|
|
237
|
+
]);
|
|
238
|
+
var CreateAuthConfigResponseSchema = import_zod.z.object({
|
|
239
|
+
id: import_zod.z.string(),
|
|
240
|
+
authScheme: import_zod.z.string(),
|
|
241
|
+
isComposioManaged: import_zod.z.boolean(),
|
|
242
|
+
toolkit: import_zod.z.string()
|
|
243
|
+
});
|
|
244
|
+
var AuthConfigRetrieveResponseSchema = import_zod.z.object({
|
|
245
|
+
id: import_zod.z.string(),
|
|
246
|
+
name: import_zod.z.string(),
|
|
247
|
+
toolkit: import_zod.z.object({
|
|
248
|
+
logo: import_zod.z.string(),
|
|
249
|
+
slug: import_zod.z.string()
|
|
250
|
+
}),
|
|
251
|
+
noOfConnections: import_zod.z.number(),
|
|
252
|
+
status: import_zod.z.enum(["ENABLED", "DISABLED"]),
|
|
253
|
+
uuid: import_zod.z.string(),
|
|
254
|
+
authScheme: AuthSchemeEnum.optional(),
|
|
255
|
+
credentials: import_zod.z.record(import_zod.z.string(), import_zod.z.unknown()).optional(),
|
|
256
|
+
expectedInputFields: import_zod.z.array(import_zod.z.unknown()).optional(),
|
|
257
|
+
restrictToFollowingTools: import_zod.z.array(import_zod.z.string()).optional(),
|
|
258
|
+
isComposioManaged: import_zod.z.boolean().optional(),
|
|
259
|
+
createdBy: import_zod.z.string().optional(),
|
|
260
|
+
createdAt: import_zod.z.string().optional(),
|
|
261
|
+
lastUpdatedAt: import_zod.z.string().optional()
|
|
262
|
+
});
|
|
263
|
+
var AuthConfigListParamsSchema = import_zod.z.object({
|
|
264
|
+
cursor: import_zod.z.string().optional(),
|
|
265
|
+
isComposioManaged: import_zod.z.boolean().optional(),
|
|
266
|
+
limit: import_zod.z.number().optional(),
|
|
267
|
+
toolkit: import_zod.z.string().optional()
|
|
268
|
+
});
|
|
269
|
+
var AuthConfigListResponseSchema = import_zod.z.object({
|
|
270
|
+
items: import_zod.z.array(AuthConfigRetrieveResponseSchema),
|
|
271
|
+
nextCursor: import_zod.z.string().nullable(),
|
|
272
|
+
totalPages: import_zod.z.number()
|
|
273
|
+
});
|
|
274
|
+
var AuthCustomConfigUpdateParamsSchema = import_zod.z.object({
|
|
275
|
+
credentials: import_zod.z.record(import_zod.z.string(), import_zod.z.union([import_zod.z.string(), import_zod.z.unknown()])),
|
|
276
|
+
type: import_zod.z.literal("custom"),
|
|
277
|
+
restrictToFollowingTools: import_zod.z.array(import_zod.z.string()).optional()
|
|
278
|
+
});
|
|
279
|
+
var AuthDefaultConfigUpdateParamsSchema = import_zod.z.object({
|
|
280
|
+
scopes: import_zod.z.string(),
|
|
281
|
+
type: import_zod.z.literal("default"),
|
|
282
|
+
restrictToFollowingTools: import_zod.z.array(import_zod.z.string()).optional()
|
|
283
|
+
});
|
|
284
|
+
var AuthConfigUpdateParamsSchema = import_zod.z.discriminatedUnion("type", [
|
|
285
|
+
AuthCustomConfigUpdateParamsSchema,
|
|
286
|
+
AuthDefaultConfigUpdateParamsSchema
|
|
287
|
+
]);
|
|
288
|
+
|
|
289
|
+
// src/types/connectedAccountAuthStates.types.ts
|
|
290
|
+
var ConnectionStatuses = {
|
|
291
|
+
INITIALIZING: "INITIALIZING",
|
|
292
|
+
INITIATED: "INITIATED",
|
|
293
|
+
ACTIVE: "ACTIVE",
|
|
294
|
+
FAILED: "FAILED",
|
|
295
|
+
EXPIRED: "EXPIRED",
|
|
296
|
+
INACTIVE: "INACTIVE"
|
|
297
|
+
};
|
|
298
|
+
var RedirectableAuthSchemeSchema = import_zod2.z.enum([
|
|
299
|
+
AuthSchemeTypes.OAUTH1,
|
|
300
|
+
AuthSchemeTypes.OAUTH2,
|
|
301
|
+
AuthSchemeTypes.COMPOSIO_LINK
|
|
302
|
+
]);
|
|
303
|
+
var BaseSchemeRaw = import_zod2.z.object({
|
|
304
|
+
// for posthog, freshdesk, zendesk, clickup and others
|
|
305
|
+
subdomain: import_zod2.z.string().optional(),
|
|
306
|
+
// for atlassian
|
|
307
|
+
["your-domain"]: import_zod2.z.string().optional(),
|
|
308
|
+
// for mixpanel
|
|
309
|
+
region: import_zod2.z.string().optional(),
|
|
310
|
+
// for shopify
|
|
311
|
+
shop: import_zod2.z.string().optional(),
|
|
312
|
+
// for snowflake
|
|
313
|
+
account_url: import_zod2.z.string().optional(),
|
|
314
|
+
// likely pipedrive
|
|
315
|
+
COMPANYDOMAIN: import_zod2.z.string().optional(),
|
|
316
|
+
// likely zoho
|
|
317
|
+
extension: import_zod2.z.string().optional(),
|
|
318
|
+
// likely formsite
|
|
319
|
+
form_api_base_url: import_zod2.z.string().optional(),
|
|
320
|
+
// likely salesforce
|
|
321
|
+
instanceEndpoint: import_zod2.z.string().optional(),
|
|
322
|
+
// likely active campaign
|
|
323
|
+
api_url: import_zod2.z.string().optional(),
|
|
324
|
+
// for borneo
|
|
325
|
+
borneo_dashboard_url: import_zod2.z.string().optional(),
|
|
326
|
+
// for zenrows proxy
|
|
327
|
+
proxy_username: import_zod2.z.string().optional(),
|
|
328
|
+
proxy_password: import_zod2.z.string().optional(),
|
|
329
|
+
// for d2l
|
|
330
|
+
domain: import_zod2.z.string().optional(),
|
|
331
|
+
version: import_zod2.z.string().optional(),
|
|
332
|
+
// for mailchimp
|
|
333
|
+
dc: import_zod2.z.string().optional(),
|
|
334
|
+
// for sharepoint
|
|
335
|
+
site_name: import_zod2.z.string().optional(),
|
|
336
|
+
// for servicenow
|
|
337
|
+
instanceName: import_zod2.z.string().optional(),
|
|
338
|
+
// for netsuite
|
|
339
|
+
account_id: import_zod2.z.string().optional(),
|
|
340
|
+
// for custom servers
|
|
341
|
+
your_server: import_zod2.z.string().optional(),
|
|
342
|
+
// for ragic
|
|
343
|
+
server_location: import_zod2.z.string().optional(),
|
|
344
|
+
// base_url only
|
|
345
|
+
base_url: import_zod2.z.string().optional(),
|
|
346
|
+
// for api key
|
|
347
|
+
api_key: import_zod2.z.string().optional(),
|
|
348
|
+
// for generic api key
|
|
349
|
+
generic_api_key: import_zod2.z.string().optional()
|
|
350
|
+
}).catchall(import_zod2.z.unknown());
|
|
351
|
+
var Oauth2InitiatingConnectionDataSchema = BaseSchemeRaw.extend({
|
|
352
|
+
status: import_zod2.z.literal(ConnectionStatuses.INITIALIZING)
|
|
353
|
+
}).catchall(import_zod2.z.unknown());
|
|
354
|
+
var Oauth2InitiatedConnectionDataSchema = Oauth2InitiatingConnectionDataSchema.extend({
|
|
355
|
+
status: import_zod2.z.literal(ConnectionStatuses.INITIATED),
|
|
356
|
+
code_verifier: import_zod2.z.string().optional(),
|
|
357
|
+
redirectUrl: import_zod2.z.string(),
|
|
358
|
+
callback_url: import_zod2.z.string().optional(),
|
|
359
|
+
finalRedirectUri: import_zod2.z.string().optional(),
|
|
360
|
+
// previously verification_token, will be sent as verification_token to slack
|
|
361
|
+
webhook_signature: import_zod2.z.string().optional()
|
|
362
|
+
}).catchall(import_zod2.z.unknown());
|
|
363
|
+
var Oauth2ActiveConnectionDataSchema = Oauth2InitiatingConnectionDataSchema.extend({
|
|
364
|
+
status: import_zod2.z.literal(ConnectionStatuses.ACTIVE),
|
|
365
|
+
access_token: import_zod2.z.string().optional(),
|
|
366
|
+
id_token: import_zod2.z.string().optional(),
|
|
367
|
+
token_type: import_zod2.z.string().optional(),
|
|
368
|
+
refresh_token: import_zod2.z.string().nullish(),
|
|
369
|
+
expires_in: import_zod2.z.union([import_zod2.z.string(), import_zod2.z.number(), import_zod2.z.null()]).optional(),
|
|
370
|
+
scope: import_zod2.z.union([import_zod2.z.string(), import_zod2.z.array(import_zod2.z.string())]).optional(),
|
|
371
|
+
// previously verification_token, will be sent as verification_token to slack
|
|
372
|
+
webhook_signature: import_zod2.z.string().optional(),
|
|
373
|
+
authed_user: import_zod2.z.object({
|
|
374
|
+
access_token: import_zod2.z.string().optional(),
|
|
375
|
+
scope: import_zod2.z.string().optional()
|
|
376
|
+
}).optional().describe("for slack user scopes")
|
|
377
|
+
}).catchall(import_zod2.z.unknown());
|
|
378
|
+
var Oauth2FailedConnectionDataSchema = Oauth2InitiatingConnectionDataSchema.extend({
|
|
379
|
+
status: import_zod2.z.literal(ConnectionStatuses.FAILED),
|
|
380
|
+
error: import_zod2.z.string().optional(),
|
|
381
|
+
error_description: import_zod2.z.string().optional()
|
|
382
|
+
}).catchall(import_zod2.z.unknown());
|
|
383
|
+
var Oauth2ExpiredConnectionDataSchema = Oauth2InitiatingConnectionDataSchema.extend({
|
|
384
|
+
status: import_zod2.z.literal(ConnectionStatuses.EXPIRED),
|
|
385
|
+
expired_at: import_zod2.z.string().optional()
|
|
386
|
+
}).catchall(import_zod2.z.unknown());
|
|
387
|
+
var Oauth2InactiveConnectionDataSchema = Oauth2InitiatingConnectionDataSchema.extend({
|
|
388
|
+
status: import_zod2.z.literal(ConnectionStatuses.INACTIVE)
|
|
389
|
+
}).catchall(import_zod2.z.unknown());
|
|
390
|
+
var Oauth2ConnectionDataSchema = import_zod2.z.discriminatedUnion("status", [
|
|
391
|
+
Oauth2InitiatingConnectionDataSchema,
|
|
392
|
+
Oauth2InitiatedConnectionDataSchema,
|
|
393
|
+
Oauth2ActiveConnectionDataSchema,
|
|
394
|
+
Oauth2FailedConnectionDataSchema,
|
|
395
|
+
Oauth2ExpiredConnectionDataSchema,
|
|
396
|
+
Oauth2InactiveConnectionDataSchema
|
|
397
|
+
]);
|
|
398
|
+
var CustomOauth2ConnectionDataSchema = Oauth2ActiveConnectionDataSchema.omit({
|
|
399
|
+
status: true,
|
|
400
|
+
access_token: true
|
|
401
|
+
}).extend({
|
|
402
|
+
access_token: import_zod2.z.string()
|
|
403
|
+
});
|
|
404
|
+
var Oauth1InitiatingConnectionDataSchema = BaseSchemeRaw.extend({
|
|
405
|
+
status: import_zod2.z.literal(ConnectionStatuses.INITIALIZING)
|
|
406
|
+
}).catchall(import_zod2.z.unknown());
|
|
407
|
+
var Oauth1InitiatedConnectionDataSchema = Oauth1InitiatingConnectionDataSchema.extend({
|
|
408
|
+
status: import_zod2.z.literal(ConnectionStatuses.INITIATED),
|
|
409
|
+
oauth_token: import_zod2.z.string().optional(),
|
|
410
|
+
authUri: import_zod2.z.string().optional(),
|
|
411
|
+
oauth_token_secret: import_zod2.z.string().optional(),
|
|
412
|
+
redirectUrl: import_zod2.z.string().optional(),
|
|
413
|
+
callbackUrl: import_zod2.z.string().optional()
|
|
414
|
+
}).catchall(import_zod2.z.unknown());
|
|
415
|
+
var Oauth1ActiveConnectionDataSchema = Oauth1InitiatingConnectionDataSchema.extend({
|
|
416
|
+
status: import_zod2.z.literal(ConnectionStatuses.ACTIVE),
|
|
417
|
+
oauth_token: import_zod2.z.string().optional(),
|
|
418
|
+
consumer_key: import_zod2.z.string().optional(),
|
|
419
|
+
redirectUrl: import_zod2.z.string().optional(),
|
|
420
|
+
callback_url: import_zod2.z.string().optional()
|
|
421
|
+
}).catchall(import_zod2.z.unknown());
|
|
422
|
+
var Oauth1FailedConnectionDataSchema = Oauth1InitiatingConnectionDataSchema.extend({
|
|
423
|
+
status: import_zod2.z.literal(ConnectionStatuses.FAILED),
|
|
424
|
+
error: import_zod2.z.string().optional(),
|
|
425
|
+
error_description: import_zod2.z.string().optional()
|
|
426
|
+
}).catchall(import_zod2.z.unknown());
|
|
427
|
+
var Oauth1ExpiredConnectionDataSchema = Oauth1InitiatingConnectionDataSchema.extend({
|
|
428
|
+
status: import_zod2.z.literal(ConnectionStatuses.EXPIRED),
|
|
429
|
+
expired_at: import_zod2.z.string().optional()
|
|
430
|
+
}).catchall(import_zod2.z.unknown());
|
|
431
|
+
var Oauth1InactiveConnectionDataSchema = Oauth1InitiatingConnectionDataSchema.extend({
|
|
432
|
+
status: import_zod2.z.literal(ConnectionStatuses.INACTIVE)
|
|
433
|
+
}).catchall(import_zod2.z.unknown());
|
|
434
|
+
var Oauth1ConnectionDataSchema = import_zod2.z.discriminatedUnion("status", [
|
|
435
|
+
Oauth1InitiatingConnectionDataSchema,
|
|
436
|
+
Oauth1InitiatedConnectionDataSchema,
|
|
437
|
+
Oauth1ActiveConnectionDataSchema,
|
|
438
|
+
Oauth1FailedConnectionDataSchema,
|
|
439
|
+
Oauth1ExpiredConnectionDataSchema,
|
|
440
|
+
Oauth1InactiveConnectionDataSchema
|
|
441
|
+
]);
|
|
442
|
+
var CustomOauth1ConnectionDataSchema = Oauth1ActiveConnectionDataSchema.omit({
|
|
443
|
+
status: true,
|
|
444
|
+
oauth_token: true
|
|
445
|
+
}).extend({
|
|
446
|
+
oauth_token_secret: import_zod2.z.string(),
|
|
447
|
+
oauth_token: import_zod2.z.string()
|
|
448
|
+
});
|
|
449
|
+
var ComposioLinkInitiatingSchema = BaseSchemeRaw.extend({
|
|
450
|
+
status: import_zod2.z.literal(ConnectionStatuses.INITIALIZING)
|
|
451
|
+
}).catchall(import_zod2.z.unknown());
|
|
452
|
+
var ComposioLinkConnectionDataSchema = import_zod2.z.discriminatedUnion("status", [
|
|
453
|
+
ComposioLinkInitiatingSchema,
|
|
454
|
+
ComposioLinkInitiatingSchema.extend({
|
|
455
|
+
status: import_zod2.z.literal(ConnectionStatuses.INITIATED),
|
|
456
|
+
redirectUrl: import_zod2.z.string()
|
|
457
|
+
}).catchall(import_zod2.z.unknown()),
|
|
458
|
+
ComposioLinkInitiatingSchema.extend({
|
|
459
|
+
status: import_zod2.z.literal(ConnectionStatuses.ACTIVE)
|
|
460
|
+
}).catchall(import_zod2.z.unknown()),
|
|
461
|
+
ComposioLinkInitiatingSchema.extend({
|
|
462
|
+
status: import_zod2.z.literal(ConnectionStatuses.FAILED),
|
|
463
|
+
error: import_zod2.z.string().optional(),
|
|
464
|
+
error_description: import_zod2.z.string().optional()
|
|
465
|
+
}).catchall(import_zod2.z.unknown()),
|
|
466
|
+
ComposioLinkInitiatingSchema.extend({
|
|
467
|
+
status: import_zod2.z.literal(ConnectionStatuses.EXPIRED),
|
|
468
|
+
expired_at: import_zod2.z.string().optional()
|
|
469
|
+
}).catchall(import_zod2.z.unknown()),
|
|
470
|
+
ComposioLinkInitiatingSchema.extend({
|
|
471
|
+
status: import_zod2.z.literal(ConnectionStatuses.INACTIVE)
|
|
472
|
+
}).catchall(import_zod2.z.unknown())
|
|
473
|
+
]);
|
|
474
|
+
var BillcomAuthInitiatingSchema = BaseSchemeRaw.extend({
|
|
475
|
+
status: import_zod2.z.literal(ConnectionStatuses.INITIALIZING)
|
|
476
|
+
}).catchall(import_zod2.z.unknown());
|
|
477
|
+
var BillcomAuthConnectionDataSchema = import_zod2.z.discriminatedUnion("status", [
|
|
478
|
+
BillcomAuthInitiatingSchema,
|
|
479
|
+
BillcomAuthInitiatingSchema.extend({
|
|
480
|
+
status: import_zod2.z.literal(ConnectionStatuses.INITIATED),
|
|
481
|
+
redirectUrl: import_zod2.z.string()
|
|
482
|
+
}).catchall(import_zod2.z.unknown()),
|
|
483
|
+
BillcomAuthInitiatingSchema.extend({
|
|
484
|
+
status: import_zod2.z.literal(ConnectionStatuses.ACTIVE),
|
|
485
|
+
sessionId: import_zod2.z.string(),
|
|
486
|
+
devKey: import_zod2.z.string()
|
|
487
|
+
}).catchall(import_zod2.z.unknown()),
|
|
488
|
+
BillcomAuthInitiatingSchema.extend({
|
|
489
|
+
status: import_zod2.z.literal(ConnectionStatuses.FAILED),
|
|
490
|
+
error: import_zod2.z.string().optional(),
|
|
491
|
+
error_description: import_zod2.z.string().optional()
|
|
492
|
+
}).catchall(import_zod2.z.unknown()),
|
|
493
|
+
BillcomAuthInitiatingSchema.extend({
|
|
494
|
+
status: import_zod2.z.literal(ConnectionStatuses.EXPIRED),
|
|
495
|
+
expired_at: import_zod2.z.string().optional()
|
|
496
|
+
}).catchall(import_zod2.z.unknown()),
|
|
497
|
+
BillcomAuthInitiatingSchema.extend({
|
|
498
|
+
status: import_zod2.z.literal(ConnectionStatuses.INACTIVE)
|
|
499
|
+
}).catchall(import_zod2.z.unknown())
|
|
500
|
+
]);
|
|
501
|
+
var BasicInitiatingSchema = BaseSchemeRaw.extend({
|
|
502
|
+
status: import_zod2.z.literal(ConnectionStatuses.ACTIVE),
|
|
503
|
+
username: import_zod2.z.string(),
|
|
504
|
+
password: import_zod2.z.string()
|
|
505
|
+
}).catchall(import_zod2.z.unknown());
|
|
506
|
+
var BasicConnectionDataSchema = import_zod2.z.discriminatedUnion("status", [
|
|
507
|
+
BasicInitiatingSchema,
|
|
508
|
+
BasicInitiatingSchema.extend({
|
|
509
|
+
status: import_zod2.z.literal(ConnectionStatuses.INACTIVE)
|
|
510
|
+
}).catchall(import_zod2.z.unknown()),
|
|
511
|
+
BasicInitiatingSchema.extend({
|
|
512
|
+
status: import_zod2.z.literal(ConnectionStatuses.FAILED),
|
|
513
|
+
error: import_zod2.z.string().optional(),
|
|
514
|
+
error_description: import_zod2.z.string().optional()
|
|
515
|
+
}).catchall(import_zod2.z.unknown()),
|
|
516
|
+
BasicInitiatingSchema.extend({
|
|
517
|
+
status: import_zod2.z.literal(ConnectionStatuses.EXPIRED),
|
|
518
|
+
expired_at: import_zod2.z.string().optional()
|
|
519
|
+
}).catchall(import_zod2.z.unknown())
|
|
520
|
+
]);
|
|
521
|
+
var CustomBasicConnectionDataSchema = BasicInitiatingSchema.omit({
|
|
522
|
+
status: true
|
|
523
|
+
});
|
|
524
|
+
var ApiKeyInitiatingSchema = BaseSchemeRaw.extend({
|
|
525
|
+
status: import_zod2.z.literal(ConnectionStatuses.ACTIVE),
|
|
526
|
+
api_key: import_zod2.z.string().optional(),
|
|
527
|
+
generic_api_key: import_zod2.z.string().optional()
|
|
528
|
+
}).catchall(import_zod2.z.unknown());
|
|
529
|
+
var ApiKeyConnectionDataSchema = import_zod2.z.discriminatedUnion("status", [
|
|
530
|
+
ApiKeyInitiatingSchema,
|
|
531
|
+
ApiKeyInitiatingSchema.extend({
|
|
532
|
+
status: import_zod2.z.literal(ConnectionStatuses.INACTIVE)
|
|
533
|
+
}).catchall(import_zod2.z.unknown()),
|
|
534
|
+
ApiKeyInitiatingSchema.extend({
|
|
535
|
+
status: import_zod2.z.literal(ConnectionStatuses.FAILED),
|
|
536
|
+
error: import_zod2.z.string().optional(),
|
|
537
|
+
error_description: import_zod2.z.string().optional()
|
|
538
|
+
}).catchall(import_zod2.z.unknown()),
|
|
539
|
+
ApiKeyInitiatingSchema.extend({
|
|
540
|
+
status: import_zod2.z.literal(ConnectionStatuses.EXPIRED),
|
|
541
|
+
expired_at: import_zod2.z.string().optional()
|
|
542
|
+
}).catchall(import_zod2.z.unknown())
|
|
543
|
+
]);
|
|
544
|
+
var CustomApiKeyConnectionDataSchema = ApiKeyInitiatingSchema.omit({
|
|
545
|
+
status: true
|
|
546
|
+
});
|
|
547
|
+
var BearerTokenInitiatingSchema = BaseSchemeRaw.extend({
|
|
548
|
+
status: import_zod2.z.literal(ConnectionStatuses.ACTIVE),
|
|
549
|
+
token: import_zod2.z.string()
|
|
550
|
+
}).catchall(import_zod2.z.unknown());
|
|
551
|
+
var BearerTokenConnectionDataSchema = import_zod2.z.discriminatedUnion("status", [
|
|
552
|
+
BearerTokenInitiatingSchema,
|
|
553
|
+
BearerTokenInitiatingSchema.extend({
|
|
554
|
+
status: import_zod2.z.literal(ConnectionStatuses.INACTIVE)
|
|
555
|
+
}).catchall(import_zod2.z.unknown()),
|
|
556
|
+
BearerTokenInitiatingSchema.extend({
|
|
557
|
+
status: import_zod2.z.literal(ConnectionStatuses.FAILED),
|
|
558
|
+
error: import_zod2.z.string().optional(),
|
|
559
|
+
error_description: import_zod2.z.string().optional()
|
|
560
|
+
}).catchall(import_zod2.z.unknown()),
|
|
561
|
+
BearerTokenInitiatingSchema.extend({
|
|
562
|
+
status: import_zod2.z.literal(ConnectionStatuses.EXPIRED),
|
|
563
|
+
expired_at: import_zod2.z.string().optional()
|
|
564
|
+
}).catchall(import_zod2.z.unknown())
|
|
565
|
+
]);
|
|
566
|
+
var CustomBearerTokenConnectionDataSchema = BearerTokenInitiatingSchema.omit({
|
|
567
|
+
status: true
|
|
568
|
+
});
|
|
569
|
+
var GoogleServiceAccountInitiatingSchema = BaseSchemeRaw.extend({
|
|
570
|
+
status: import_zod2.z.literal(ConnectionStatuses.ACTIVE),
|
|
571
|
+
credentials_json: import_zod2.z.string()
|
|
572
|
+
}).catchall(import_zod2.z.unknown());
|
|
573
|
+
var GoogleServiceAccountConnectionDataSchema = import_zod2.z.discriminatedUnion("status", [
|
|
574
|
+
GoogleServiceAccountInitiatingSchema,
|
|
575
|
+
GoogleServiceAccountInitiatingSchema.extend({
|
|
576
|
+
status: import_zod2.z.literal(ConnectionStatuses.INACTIVE)
|
|
577
|
+
}).catchall(import_zod2.z.unknown()),
|
|
578
|
+
GoogleServiceAccountInitiatingSchema.extend({
|
|
579
|
+
status: import_zod2.z.literal(ConnectionStatuses.FAILED),
|
|
580
|
+
error: import_zod2.z.string().optional(),
|
|
581
|
+
error_description: import_zod2.z.string().optional()
|
|
582
|
+
}).catchall(import_zod2.z.unknown()),
|
|
583
|
+
GoogleServiceAccountInitiatingSchema.extend({
|
|
584
|
+
status: import_zod2.z.literal(ConnectionStatuses.EXPIRED),
|
|
585
|
+
expired_at: import_zod2.z.string().optional()
|
|
586
|
+
}).catchall(import_zod2.z.unknown())
|
|
587
|
+
]);
|
|
588
|
+
var NoAuthInitiatingSchema = BaseSchemeRaw.extend({
|
|
589
|
+
status: import_zod2.z.literal(ConnectionStatuses.ACTIVE)
|
|
590
|
+
}).catchall(import_zod2.z.unknown());
|
|
591
|
+
var NoAuthConnectionDataSchema = import_zod2.z.discriminatedUnion("status", [
|
|
592
|
+
NoAuthInitiatingSchema,
|
|
593
|
+
NoAuthInitiatingSchema.extend({
|
|
594
|
+
status: import_zod2.z.literal(ConnectionStatuses.INACTIVE)
|
|
595
|
+
}).catchall(import_zod2.z.unknown()),
|
|
596
|
+
NoAuthInitiatingSchema.extend({
|
|
597
|
+
status: import_zod2.z.literal(ConnectionStatuses.FAILED),
|
|
598
|
+
error: import_zod2.z.string().optional(),
|
|
599
|
+
error_description: import_zod2.z.string().optional()
|
|
600
|
+
}).catchall(import_zod2.z.unknown()),
|
|
601
|
+
NoAuthInitiatingSchema.extend({
|
|
602
|
+
status: import_zod2.z.literal(ConnectionStatuses.EXPIRED),
|
|
603
|
+
expired_at: import_zod2.z.string().optional()
|
|
604
|
+
}).catchall(import_zod2.z.unknown())
|
|
605
|
+
]);
|
|
606
|
+
var CustomNoAuthConnectionDataSchema = NoAuthInitiatingSchema.omit({
|
|
607
|
+
status: true
|
|
608
|
+
});
|
|
609
|
+
var CalcomAuthInitiatingSchema = BaseSchemeRaw.extend({
|
|
610
|
+
status: import_zod2.z.literal(ConnectionStatuses.ACTIVE)
|
|
611
|
+
}).catchall(import_zod2.z.unknown());
|
|
612
|
+
var CalcomAuthConnectionDataSchema = import_zod2.z.discriminatedUnion("status", [
|
|
613
|
+
CalcomAuthInitiatingSchema,
|
|
614
|
+
CalcomAuthInitiatingSchema.extend({
|
|
615
|
+
status: import_zod2.z.literal(ConnectionStatuses.INACTIVE)
|
|
616
|
+
}).catchall(import_zod2.z.unknown()),
|
|
617
|
+
CalcomAuthInitiatingSchema.extend({
|
|
618
|
+
status: import_zod2.z.literal(ConnectionStatuses.FAILED),
|
|
619
|
+
error: import_zod2.z.string().optional(),
|
|
620
|
+
error_description: import_zod2.z.string().optional()
|
|
621
|
+
}).catchall(import_zod2.z.unknown()),
|
|
622
|
+
CalcomAuthInitiatingSchema.extend({
|
|
623
|
+
status: import_zod2.z.literal(ConnectionStatuses.EXPIRED),
|
|
624
|
+
expired_at: import_zod2.z.string().optional()
|
|
625
|
+
}).catchall(import_zod2.z.unknown())
|
|
626
|
+
]);
|
|
627
|
+
var BasicWithJwtInitiatingSchema = BaseSchemeRaw.extend({
|
|
628
|
+
status: import_zod2.z.literal(ConnectionStatuses.ACTIVE),
|
|
629
|
+
username: import_zod2.z.string(),
|
|
630
|
+
password: import_zod2.z.string()
|
|
631
|
+
}).catchall(import_zod2.z.unknown());
|
|
632
|
+
var BasicWithJwtConnectionDataSchema = import_zod2.z.discriminatedUnion("status", [
|
|
633
|
+
BasicWithJwtInitiatingSchema,
|
|
634
|
+
BasicWithJwtInitiatingSchema.extend({
|
|
635
|
+
status: import_zod2.z.literal(ConnectionStatuses.INACTIVE)
|
|
636
|
+
}).catchall(import_zod2.z.unknown()),
|
|
637
|
+
BasicWithJwtInitiatingSchema.extend({
|
|
638
|
+
status: import_zod2.z.literal(ConnectionStatuses.FAILED),
|
|
639
|
+
error: import_zod2.z.string().optional(),
|
|
640
|
+
error_description: import_zod2.z.string().optional()
|
|
641
|
+
}).catchall(import_zod2.z.unknown()),
|
|
642
|
+
BasicWithJwtInitiatingSchema.extend({
|
|
643
|
+
status: import_zod2.z.literal(ConnectionStatuses.EXPIRED),
|
|
644
|
+
expired_at: import_zod2.z.string().optional()
|
|
645
|
+
}).catchall(import_zod2.z.unknown())
|
|
646
|
+
]);
|
|
647
|
+
var CustomBasicWithJwtConnectionDataSchema = BasicWithJwtInitiatingSchema.omit({
|
|
648
|
+
status: true
|
|
183
649
|
});
|
|
184
|
-
var
|
|
650
|
+
var ConnectionDataSchema = import_zod2.z.discriminatedUnion("authScheme", [
|
|
651
|
+
import_zod2.z.object({
|
|
652
|
+
authScheme: import_zod2.z.literal(AuthSchemeTypes.OAUTH1),
|
|
653
|
+
/**
|
|
654
|
+
* the main connection data discriminated by auth scheme
|
|
655
|
+
*/
|
|
656
|
+
val: Oauth1ConnectionDataSchema
|
|
657
|
+
}),
|
|
658
|
+
import_zod2.z.object({
|
|
659
|
+
authScheme: import_zod2.z.literal(AuthSchemeTypes.OAUTH2),
|
|
660
|
+
/**
|
|
661
|
+
* the main connection data discriminated by auth scheme
|
|
662
|
+
*/
|
|
663
|
+
val: Oauth2ConnectionDataSchema
|
|
664
|
+
}),
|
|
665
|
+
import_zod2.z.object({
|
|
666
|
+
authScheme: import_zod2.z.literal(AuthSchemeTypes.COMPOSIO_LINK),
|
|
667
|
+
/**
|
|
668
|
+
* the main connection data discriminated by auth scheme
|
|
669
|
+
*/
|
|
670
|
+
val: ComposioLinkConnectionDataSchema
|
|
671
|
+
}),
|
|
672
|
+
import_zod2.z.object({
|
|
673
|
+
authScheme: import_zod2.z.literal(AuthSchemeTypes.API_KEY),
|
|
674
|
+
/**
|
|
675
|
+
* the main connection data discriminated by auth scheme
|
|
676
|
+
*/
|
|
677
|
+
val: ApiKeyConnectionDataSchema
|
|
678
|
+
}),
|
|
679
|
+
import_zod2.z.object({
|
|
680
|
+
authScheme: import_zod2.z.literal(AuthSchemeTypes.BASIC),
|
|
681
|
+
/**
|
|
682
|
+
* the main connection data discriminated by auth scheme
|
|
683
|
+
*/
|
|
684
|
+
val: BasicConnectionDataSchema
|
|
685
|
+
}),
|
|
686
|
+
import_zod2.z.object({
|
|
687
|
+
authScheme: import_zod2.z.literal(AuthSchemeTypes.BEARER_TOKEN),
|
|
688
|
+
/**
|
|
689
|
+
* the main connection data discriminated by auth scheme
|
|
690
|
+
*/
|
|
691
|
+
val: BearerTokenConnectionDataSchema
|
|
692
|
+
}),
|
|
693
|
+
import_zod2.z.object({
|
|
694
|
+
authScheme: import_zod2.z.literal(AuthSchemeTypes.GOOGLE_SERVICE_ACCOUNT),
|
|
695
|
+
/**
|
|
696
|
+
* the main connection data discriminated by auth scheme
|
|
697
|
+
*/
|
|
698
|
+
val: GoogleServiceAccountConnectionDataSchema
|
|
699
|
+
}),
|
|
700
|
+
import_zod2.z.object({
|
|
701
|
+
authScheme: import_zod2.z.literal(AuthSchemeTypes.NO_AUTH),
|
|
702
|
+
/**
|
|
703
|
+
* the main connection data discriminated by auth scheme
|
|
704
|
+
*/
|
|
705
|
+
val: NoAuthConnectionDataSchema
|
|
706
|
+
}),
|
|
707
|
+
import_zod2.z.object({
|
|
708
|
+
authScheme: import_zod2.z.literal(AuthSchemeTypes.CALCOM_AUTH),
|
|
709
|
+
/**
|
|
710
|
+
* the main connection data discriminated by auth scheme
|
|
711
|
+
*/
|
|
712
|
+
val: CalcomAuthConnectionDataSchema
|
|
713
|
+
}),
|
|
714
|
+
// z.object({
|
|
715
|
+
// authScheme: z.literal(AuthSchemeTypes.SNOWFLAKE),
|
|
716
|
+
// /**
|
|
717
|
+
// * the main connection data discriminated by auth scheme
|
|
718
|
+
// */
|
|
719
|
+
// val: SnowflakeConnectionDataSchema,
|
|
720
|
+
// }),
|
|
721
|
+
import_zod2.z.object({
|
|
722
|
+
authScheme: import_zod2.z.literal(AuthSchemeTypes.BILLCOM_AUTH),
|
|
723
|
+
/**
|
|
724
|
+
* the main connection data discriminated by auth scheme
|
|
725
|
+
*/
|
|
726
|
+
val: BillcomAuthConnectionDataSchema
|
|
727
|
+
}),
|
|
728
|
+
import_zod2.z.object({
|
|
729
|
+
authScheme: import_zod2.z.literal(AuthSchemeTypes.BASIC_WITH_JWT),
|
|
730
|
+
/**
|
|
731
|
+
* the main connection data discriminated by auth scheme
|
|
732
|
+
*/
|
|
733
|
+
val: BasicWithJwtConnectionDataSchema
|
|
734
|
+
})
|
|
735
|
+
]);
|
|
736
|
+
var CustomConnectionDataSchema = import_zod2.z.discriminatedUnion("authScheme", [
|
|
737
|
+
import_zod2.z.object({
|
|
738
|
+
authScheme: import_zod2.z.literal(AuthSchemeTypes.OAUTH2),
|
|
739
|
+
toolkitSlug: import_zod2.z.string(),
|
|
740
|
+
val: CustomOauth2ConnectionDataSchema
|
|
741
|
+
}),
|
|
742
|
+
import_zod2.z.object({
|
|
743
|
+
authScheme: import_zod2.z.literal(AuthSchemeTypes.API_KEY),
|
|
744
|
+
toolkitSlug: import_zod2.z.string(),
|
|
745
|
+
val: CustomApiKeyConnectionDataSchema
|
|
746
|
+
}),
|
|
747
|
+
import_zod2.z.object({
|
|
748
|
+
authScheme: import_zod2.z.literal(AuthSchemeTypes.BASIC_WITH_JWT),
|
|
749
|
+
toolkitSlug: import_zod2.z.string(),
|
|
750
|
+
val: CustomBasicWithJwtConnectionDataSchema
|
|
751
|
+
}),
|
|
752
|
+
import_zod2.z.object({
|
|
753
|
+
authScheme: import_zod2.z.literal(AuthSchemeTypes.BASIC),
|
|
754
|
+
toolkitSlug: import_zod2.z.string(),
|
|
755
|
+
val: CustomBasicConnectionDataSchema
|
|
756
|
+
}),
|
|
757
|
+
import_zod2.z.object({
|
|
758
|
+
authScheme: import_zod2.z.literal(AuthSchemeTypes.BEARER_TOKEN),
|
|
759
|
+
toolkitSlug: import_zod2.z.string(),
|
|
760
|
+
val: CustomBearerTokenConnectionDataSchema
|
|
761
|
+
}),
|
|
762
|
+
import_zod2.z.object({
|
|
763
|
+
authScheme: import_zod2.z.literal(AuthSchemeTypes.OAUTH1),
|
|
764
|
+
toolkitSlug: import_zod2.z.string(),
|
|
765
|
+
val: CustomOauth1ConnectionDataSchema
|
|
766
|
+
}),
|
|
767
|
+
import_zod2.z.object({
|
|
768
|
+
authScheme: import_zod2.z.literal(AuthSchemeTypes.NO_AUTH),
|
|
769
|
+
toolkitSlug: import_zod2.z.string(),
|
|
770
|
+
val: CustomNoAuthConnectionDataSchema
|
|
771
|
+
})
|
|
772
|
+
]);
|
|
773
|
+
|
|
774
|
+
// src/types/tool.types.ts
|
|
775
|
+
var ToolkitSchema = import_zod3.z.object({
|
|
776
|
+
slug: import_zod3.z.string().describe("The slug of the toolkit"),
|
|
777
|
+
name: import_zod3.z.string().describe("The name of the toolkit"),
|
|
778
|
+
logo: import_zod3.z.string().describe("The logo of the toolkit").optional()
|
|
779
|
+
});
|
|
780
|
+
var JSONSchemaType = import_zod3.z.enum([
|
|
185
781
|
"string",
|
|
186
782
|
"number",
|
|
187
783
|
"integer",
|
|
@@ -190,133 +786,135 @@ var JSONSchemaType = import_zod.z.enum([
|
|
|
190
786
|
"array",
|
|
191
787
|
"null"
|
|
192
788
|
]);
|
|
193
|
-
var JSONSchemaPropertySchema =
|
|
194
|
-
type:
|
|
195
|
-
description:
|
|
196
|
-
anyOf:
|
|
197
|
-
oneOf:
|
|
198
|
-
allOf:
|
|
199
|
-
not:
|
|
200
|
-
title:
|
|
201
|
-
default:
|
|
202
|
-
nullable:
|
|
203
|
-
properties:
|
|
204
|
-
required:
|
|
205
|
-
file_uploadable:
|
|
206
|
-
file_downloadable:
|
|
207
|
-
items:
|
|
208
|
-
enum:
|
|
209
|
-
const:
|
|
210
|
-
minimum:
|
|
211
|
-
maximum:
|
|
212
|
-
exclusiveMinimum:
|
|
213
|
-
exclusiveMaximum:
|
|
214
|
-
multipleOf:
|
|
215
|
-
minLength:
|
|
216
|
-
maxLength:
|
|
217
|
-
pattern:
|
|
218
|
-
format:
|
|
219
|
-
minItems:
|
|
220
|
-
maxItems:
|
|
221
|
-
uniqueItems:
|
|
222
|
-
minProperties:
|
|
223
|
-
maxProperties:
|
|
224
|
-
patternProperties:
|
|
225
|
-
additionalProperties:
|
|
226
|
-
examples:
|
|
227
|
-
readOnly:
|
|
228
|
-
writeOnly:
|
|
229
|
-
if:
|
|
230
|
-
then:
|
|
231
|
-
else:
|
|
232
|
-
$ref:
|
|
233
|
-
definitions:
|
|
234
|
-
|
|
235
|
-
|
|
789
|
+
var JSONSchemaPropertySchema = import_zod3.z.object({
|
|
790
|
+
type: import_zod3.z.union([JSONSchemaType, import_zod3.z.array(JSONSchemaType)]).optional(),
|
|
791
|
+
description: import_zod3.z.string().optional(),
|
|
792
|
+
anyOf: import_zod3.z.lazy(() => import_zod3.z.array(JSONSchemaPropertySchema)).optional(),
|
|
793
|
+
oneOf: import_zod3.z.lazy(() => import_zod3.z.array(JSONSchemaPropertySchema)).optional(),
|
|
794
|
+
allOf: import_zod3.z.lazy(() => import_zod3.z.array(JSONSchemaPropertySchema)).optional(),
|
|
795
|
+
not: import_zod3.z.lazy(() => JSONSchemaPropertySchema).optional(),
|
|
796
|
+
title: import_zod3.z.string().optional(),
|
|
797
|
+
default: import_zod3.z.any().optional(),
|
|
798
|
+
nullable: import_zod3.z.boolean().optional(),
|
|
799
|
+
properties: import_zod3.z.lazy(() => import_zod3.z.record(import_zod3.z.string(), JSONSchemaPropertySchema)).optional(),
|
|
800
|
+
required: import_zod3.z.array(import_zod3.z.string()).optional(),
|
|
801
|
+
file_uploadable: import_zod3.z.boolean().optional(),
|
|
802
|
+
file_downloadable: import_zod3.z.boolean().optional(),
|
|
803
|
+
items: import_zod3.z.lazy(() => import_zod3.z.union([JSONSchemaPropertySchema, import_zod3.z.array(JSONSchemaPropertySchema)])).optional(),
|
|
804
|
+
enum: import_zod3.z.array(import_zod3.z.any()).optional(),
|
|
805
|
+
const: import_zod3.z.any().optional(),
|
|
806
|
+
minimum: import_zod3.z.number().optional(),
|
|
807
|
+
maximum: import_zod3.z.number().optional(),
|
|
808
|
+
exclusiveMinimum: import_zod3.z.number().optional(),
|
|
809
|
+
exclusiveMaximum: import_zod3.z.number().optional(),
|
|
810
|
+
multipleOf: import_zod3.z.number().optional(),
|
|
811
|
+
minLength: import_zod3.z.number().optional(),
|
|
812
|
+
maxLength: import_zod3.z.number().optional(),
|
|
813
|
+
pattern: import_zod3.z.string().optional(),
|
|
814
|
+
format: import_zod3.z.string().optional(),
|
|
815
|
+
minItems: import_zod3.z.number().optional(),
|
|
816
|
+
maxItems: import_zod3.z.number().optional(),
|
|
817
|
+
uniqueItems: import_zod3.z.boolean().optional(),
|
|
818
|
+
minProperties: import_zod3.z.number().optional(),
|
|
819
|
+
maxProperties: import_zod3.z.number().optional(),
|
|
820
|
+
patternProperties: import_zod3.z.lazy(() => import_zod3.z.record(import_zod3.z.string(), JSONSchemaPropertySchema)).optional(),
|
|
821
|
+
additionalProperties: import_zod3.z.union([import_zod3.z.boolean(), import_zod3.z.lazy(() => JSONSchemaPropertySchema)]).optional(),
|
|
822
|
+
examples: import_zod3.z.array(import_zod3.z.any()).optional(),
|
|
823
|
+
readOnly: import_zod3.z.boolean().optional(),
|
|
824
|
+
writeOnly: import_zod3.z.boolean().optional(),
|
|
825
|
+
if: import_zod3.z.lazy(() => JSONSchemaPropertySchema).optional(),
|
|
826
|
+
then: import_zod3.z.lazy(() => JSONSchemaPropertySchema).optional(),
|
|
827
|
+
else: import_zod3.z.lazy(() => JSONSchemaPropertySchema).optional(),
|
|
828
|
+
$ref: import_zod3.z.string().optional(),
|
|
829
|
+
definitions: import_zod3.z.record(
|
|
830
|
+
import_zod3.z.string(),
|
|
831
|
+
import_zod3.z.lazy(() => JSONSchemaPropertySchema)
|
|
236
832
|
).optional(),
|
|
237
|
-
$defs:
|
|
238
|
-
|
|
239
|
-
|
|
833
|
+
$defs: import_zod3.z.record(
|
|
834
|
+
import_zod3.z.string(),
|
|
835
|
+
import_zod3.z.lazy(() => JSONSchemaPropertySchema)
|
|
240
836
|
).optional()
|
|
241
837
|
});
|
|
242
|
-
var ParametersSchema =
|
|
243
|
-
type:
|
|
244
|
-
anyOf:
|
|
245
|
-
oneOf:
|
|
246
|
-
allOf:
|
|
838
|
+
var ParametersSchema = import_zod3.z.object({
|
|
839
|
+
type: import_zod3.z.literal("object"),
|
|
840
|
+
anyOf: import_zod3.z.array(JSONSchemaPropertySchema).optional(),
|
|
841
|
+
oneOf: import_zod3.z.array(JSONSchemaPropertySchema).optional(),
|
|
842
|
+
allOf: import_zod3.z.array(JSONSchemaPropertySchema).optional(),
|
|
247
843
|
not: JSONSchemaPropertySchema.optional(),
|
|
248
|
-
properties:
|
|
249
|
-
required:
|
|
250
|
-
title:
|
|
251
|
-
default:
|
|
252
|
-
nullable:
|
|
253
|
-
description:
|
|
254
|
-
additionalProperties:
|
|
844
|
+
properties: import_zod3.z.record(import_zod3.z.string(), JSONSchemaPropertySchema),
|
|
845
|
+
required: import_zod3.z.array(import_zod3.z.string()).optional(),
|
|
846
|
+
title: import_zod3.z.string().optional(),
|
|
847
|
+
default: import_zod3.z.any().optional(),
|
|
848
|
+
nullable: import_zod3.z.boolean().optional(),
|
|
849
|
+
description: import_zod3.z.string().optional(),
|
|
850
|
+
additionalProperties: import_zod3.z.boolean().default(false).optional()
|
|
255
851
|
});
|
|
256
|
-
var ToolSchema =
|
|
257
|
-
slug:
|
|
258
|
-
name:
|
|
259
|
-
description:
|
|
852
|
+
var ToolSchema = import_zod3.z.object({
|
|
853
|
+
slug: import_zod3.z.string().describe('The slug of the tool. eg. "GOOGLE_SEARCH"'),
|
|
854
|
+
name: import_zod3.z.string().describe(`The name of the tool. eg. "Google Search"`),
|
|
855
|
+
description: import_zod3.z.string().optional().describe("The description of the tool"),
|
|
260
856
|
inputParameters: ParametersSchema.optional().describe("The input parameters of the tool"),
|
|
261
857
|
outputParameters: ParametersSchema.optional().describe("The output parameters of the tool"),
|
|
262
|
-
tags:
|
|
263
|
-
toolkit:
|
|
264
|
-
version:
|
|
265
|
-
scopes:
|
|
858
|
+
tags: import_zod3.z.optional(import_zod3.z.array(import_zod3.z.string())).describe("The tags of the tool. eg: Important").default([]),
|
|
859
|
+
toolkit: import_zod3.z.optional(ToolkitSchema).describe("The toolkit of the tool"),
|
|
860
|
+
version: import_zod3.z.optional(import_zod3.z.string()).describe('The version of the tool, e.g. "1.0.0"'),
|
|
861
|
+
scopes: import_zod3.z.optional(import_zod3.z.array(import_zod3.z.string())).describe('The scopes of the tool. eg: ["task:add"]')
|
|
266
862
|
});
|
|
267
|
-
var ToolListResponseSchema =
|
|
268
|
-
items:
|
|
269
|
-
nextCursor:
|
|
270
|
-
totalPages:
|
|
863
|
+
var ToolListResponseSchema = import_zod3.z.object({
|
|
864
|
+
items: import_zod3.z.array(ToolSchema),
|
|
865
|
+
nextCursor: import_zod3.z.string().nullable().optional(),
|
|
866
|
+
totalPages: import_zod3.z.number()
|
|
271
867
|
});
|
|
272
|
-
var ToolListParamsSchema =
|
|
273
|
-
tools:
|
|
274
|
-
toolkits:
|
|
275
|
-
scopes:
|
|
276
|
-
tags:
|
|
277
|
-
limit:
|
|
278
|
-
search:
|
|
279
|
-
authConfigIds:
|
|
868
|
+
var ToolListParamsSchema = import_zod3.z.object({
|
|
869
|
+
tools: import_zod3.z.array(import_zod3.z.string()).optional(),
|
|
870
|
+
toolkits: import_zod3.z.array(import_zod3.z.string()).optional(),
|
|
871
|
+
scopes: import_zod3.z.array(import_zod3.z.string()).optional(),
|
|
872
|
+
tags: import_zod3.z.array(import_zod3.z.string()).optional(),
|
|
873
|
+
limit: import_zod3.z.number().optional(),
|
|
874
|
+
search: import_zod3.z.string().optional(),
|
|
875
|
+
authConfigIds: import_zod3.z.array(import_zod3.z.string()).optional()
|
|
280
876
|
});
|
|
281
|
-
var CustomAuthParamsSchema =
|
|
282
|
-
baseURL:
|
|
283
|
-
body:
|
|
284
|
-
parameters:
|
|
285
|
-
|
|
286
|
-
in:
|
|
287
|
-
name:
|
|
288
|
-
value:
|
|
877
|
+
var CustomAuthParamsSchema = import_zod3.z.object({
|
|
878
|
+
baseURL: import_zod3.z.string().optional(),
|
|
879
|
+
body: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()).optional(),
|
|
880
|
+
parameters: import_zod3.z.array(
|
|
881
|
+
import_zod3.z.object({
|
|
882
|
+
in: import_zod3.z.enum(["query", "header"]),
|
|
883
|
+
name: import_zod3.z.string(),
|
|
884
|
+
value: import_zod3.z.union([import_zod3.z.string(), import_zod3.z.number()])
|
|
289
885
|
})
|
|
290
886
|
)
|
|
291
887
|
});
|
|
292
|
-
var ToolExecuteParamsSchema =
|
|
293
|
-
allowTracing:
|
|
294
|
-
connectedAccountId:
|
|
888
|
+
var ToolExecuteParamsSchema = import_zod3.z.object({
|
|
889
|
+
allowTracing: import_zod3.z.boolean().optional(),
|
|
890
|
+
connectedAccountId: import_zod3.z.string().optional(),
|
|
295
891
|
customAuthParams: CustomAuthParamsSchema.optional(),
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
892
|
+
customConnectionData: CustomConnectionDataSchema.optional(),
|
|
893
|
+
arguments: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()).optional(),
|
|
894
|
+
userId: import_zod3.z.string(),
|
|
895
|
+
version: import_zod3.z.string().optional(),
|
|
896
|
+
text: import_zod3.z.string().optional()
|
|
300
897
|
});
|
|
301
|
-
var ToolExecuteResponseSchema =
|
|
302
|
-
data:
|
|
303
|
-
error:
|
|
304
|
-
successful:
|
|
305
|
-
logId:
|
|
306
|
-
sessionInfo:
|
|
898
|
+
var ToolExecuteResponseSchema = import_zod3.z.object({
|
|
899
|
+
data: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()),
|
|
900
|
+
error: import_zod3.z.string().nullable(),
|
|
901
|
+
successful: import_zod3.z.boolean(),
|
|
902
|
+
logId: import_zod3.z.string().optional(),
|
|
903
|
+
sessionInfo: import_zod3.z.unknown().optional()
|
|
307
904
|
});
|
|
308
|
-
var ToolProxyParamsSchema =
|
|
309
|
-
endpoint:
|
|
310
|
-
method:
|
|
311
|
-
body:
|
|
312
|
-
parameters:
|
|
313
|
-
|
|
314
|
-
in:
|
|
315
|
-
name:
|
|
316
|
-
value:
|
|
905
|
+
var ToolProxyParamsSchema = import_zod3.z.object({
|
|
906
|
+
endpoint: import_zod3.z.string(),
|
|
907
|
+
method: import_zod3.z.enum(["GET", "POST", "PUT", "DELETE", "PATCH"]),
|
|
908
|
+
body: import_zod3.z.unknown().optional(),
|
|
909
|
+
parameters: import_zod3.z.array(
|
|
910
|
+
import_zod3.z.object({
|
|
911
|
+
in: import_zod3.z.enum(["query", "header"]),
|
|
912
|
+
name: import_zod3.z.string(),
|
|
913
|
+
value: import_zod3.z.union([import_zod3.z.string(), import_zod3.z.number()])
|
|
317
914
|
})
|
|
318
915
|
).optional(),
|
|
319
|
-
connectedAccountId:
|
|
916
|
+
connectedAccountId: import_zod3.z.string().optional(),
|
|
917
|
+
customConnectionData: CustomConnectionDataSchema.optional()
|
|
320
918
|
});
|
|
321
919
|
|
|
322
920
|
// src/models/CustomTools.ts
|
|
@@ -433,7 +1031,7 @@ var logger_default = logger;
|
|
|
433
1031
|
|
|
434
1032
|
// src/errors/ComposioError.ts
|
|
435
1033
|
var import_chalk2 = __toESM(require("chalk"), 1);
|
|
436
|
-
var
|
|
1034
|
+
var import_zod4 = require("zod");
|
|
437
1035
|
var import_client = require("@composio/client");
|
|
438
1036
|
var ComposioError = class _ComposioError extends Error {
|
|
439
1037
|
/** @readonly Error name */
|
|
@@ -594,7 +1192,7 @@ ${originalStackBody}`;
|
|
|
594
1192
|
const { includeStack = false, exitProcess = false, exitCode = 1 } = options;
|
|
595
1193
|
if (error instanceof _ComposioError) {
|
|
596
1194
|
error.prettyPrint(includeStack);
|
|
597
|
-
} else if (error instanceof
|
|
1195
|
+
} else if (error instanceof import_zod4.ZodError) {
|
|
598
1196
|
this.handleZodError(error, includeStack);
|
|
599
1197
|
} else if (error instanceof Error) {
|
|
600
1198
|
this.handleStandardError(error, includeStack);
|
|
@@ -1146,7 +1744,7 @@ var ComposioToolkitFetchError = class extends ComposioError {
|
|
|
1146
1744
|
};
|
|
1147
1745
|
|
|
1148
1746
|
// src/errors/ValidationErrors.ts
|
|
1149
|
-
var
|
|
1747
|
+
var import_zod5 = require("zod");
|
|
1150
1748
|
var ValidationErrorCodes = {
|
|
1151
1749
|
VALIDATION_ERROR: "VALIDATION_ERROR",
|
|
1152
1750
|
JSON_SCHEMA_TO_ZOD_ERROR: "JSON_SCHEMA_TO_ZOD_ERROR"
|
|
@@ -1155,10 +1753,10 @@ var ValidationError = class extends ComposioError {
|
|
|
1155
1753
|
constructor(message = "Input validation failed", options = {}) {
|
|
1156
1754
|
const { cause: providedZodError, ...restOptions } = options;
|
|
1157
1755
|
let zodErrorInstance;
|
|
1158
|
-
if (providedZodError instanceof
|
|
1756
|
+
if (providedZodError instanceof import_zod5.ZodError) {
|
|
1159
1757
|
zodErrorInstance = providedZodError;
|
|
1160
1758
|
} else {
|
|
1161
|
-
zodErrorInstance = new
|
|
1759
|
+
zodErrorInstance = new import_zod5.ZodError([
|
|
1162
1760
|
{
|
|
1163
1761
|
path: [],
|
|
1164
1762
|
message: "Invalid input",
|
|
@@ -1180,7 +1778,7 @@ var ValidationError = class extends ComposioError {
|
|
|
1180
1778
|
this.message = `${message}: ${userFriendlyMessage}`;
|
|
1181
1779
|
}
|
|
1182
1780
|
generateUserFriendlyMessage() {
|
|
1183
|
-
if (this.cause instanceof
|
|
1781
|
+
if (this.cause instanceof import_zod5.ZodError && this.cause.issues.length > 0) {
|
|
1184
1782
|
const issue = this.cause.issues[0];
|
|
1185
1783
|
const path = issue.path.join(".");
|
|
1186
1784
|
const param = path || "parameter";
|
|
@@ -1225,418 +1823,6 @@ var ComposioNoAPIKeyError = class extends ComposioError {
|
|
|
1225
1823
|
|
|
1226
1824
|
// src/types/connectedAccounts.types.ts
|
|
1227
1825
|
var import_zod6 = require("zod");
|
|
1228
|
-
|
|
1229
|
-
// src/types/connectedAccountAuthStates.types.ts
|
|
1230
|
-
var import_zod5 = require("zod");
|
|
1231
|
-
|
|
1232
|
-
// src/types/authConfigs.types.ts
|
|
1233
|
-
var import_zod4 = require("zod");
|
|
1234
|
-
var AuthConfigTypes = {
|
|
1235
|
-
CUSTOM: "use_custom_auth",
|
|
1236
|
-
COMPOSIO_MANAGED: "use_composio_managed_auth"
|
|
1237
|
-
};
|
|
1238
|
-
var AuthSchemeTypes = {
|
|
1239
|
-
OAUTH1: "OAUTH1",
|
|
1240
|
-
OAUTH2: "OAUTH2",
|
|
1241
|
-
API_KEY: "API_KEY",
|
|
1242
|
-
BASIC: "BASIC",
|
|
1243
|
-
BEARER_TOKEN: "BEARER_TOKEN",
|
|
1244
|
-
BILLCOM_AUTH: "BILLCOM_AUTH",
|
|
1245
|
-
GOOGLE_SERVICE_ACCOUNT: "GOOGLE_SERVICE_ACCOUNT",
|
|
1246
|
-
NO_AUTH: "NO_AUTH",
|
|
1247
|
-
BASIC_WITH_JWT: "BASIC_WITH_JWT",
|
|
1248
|
-
COMPOSIO_LINK: "COMPOSIO_LINK",
|
|
1249
|
-
CALCOM_AUTH: "CALCOM_AUTH"
|
|
1250
|
-
};
|
|
1251
|
-
var AuthSchemeEnum = import_zod4.z.enum([
|
|
1252
|
-
"OAUTH2",
|
|
1253
|
-
"OAUTH1",
|
|
1254
|
-
"API_KEY",
|
|
1255
|
-
"BASIC",
|
|
1256
|
-
"BILLCOM_AUTH",
|
|
1257
|
-
"BEARER_TOKEN",
|
|
1258
|
-
"GOOGLE_SERVICE_ACCOUNT",
|
|
1259
|
-
"NO_AUTH",
|
|
1260
|
-
"BASIC_WITH_JWT",
|
|
1261
|
-
"COMPOSIO_LINK",
|
|
1262
|
-
"CALCOM_AUTH"
|
|
1263
|
-
]);
|
|
1264
|
-
var CreateCustomAuthConfigParamsSchema = import_zod4.z.object({
|
|
1265
|
-
type: import_zod4.z.literal("use_custom_auth"),
|
|
1266
|
-
name: import_zod4.z.string().optional(),
|
|
1267
|
-
credentials: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.union([import_zod4.z.string(), import_zod4.z.number(), import_zod4.z.boolean()])),
|
|
1268
|
-
authScheme: AuthSchemeEnum,
|
|
1269
|
-
restrictToFollowingTools: import_zod4.z.array(import_zod4.z.string()).optional()
|
|
1270
|
-
});
|
|
1271
|
-
var CreateComposioManagedAuthConfigParamsSchema = import_zod4.z.object({
|
|
1272
|
-
type: import_zod4.z.literal("use_composio_managed_auth"),
|
|
1273
|
-
name: import_zod4.z.string().optional(),
|
|
1274
|
-
credentials: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.union([import_zod4.z.string(), import_zod4.z.number(), import_zod4.z.boolean()])).optional(),
|
|
1275
|
-
restrictToFollowingTools: import_zod4.z.array(import_zod4.z.string()).optional()
|
|
1276
|
-
});
|
|
1277
|
-
var CreateAuthConfigParamsSchema = import_zod4.z.discriminatedUnion("type", [
|
|
1278
|
-
CreateCustomAuthConfigParamsSchema,
|
|
1279
|
-
CreateComposioManagedAuthConfigParamsSchema
|
|
1280
|
-
]);
|
|
1281
|
-
var CreateAuthConfigResponseSchema = import_zod4.z.object({
|
|
1282
|
-
id: import_zod4.z.string(),
|
|
1283
|
-
authScheme: import_zod4.z.string(),
|
|
1284
|
-
isComposioManaged: import_zod4.z.boolean(),
|
|
1285
|
-
toolkit: import_zod4.z.string()
|
|
1286
|
-
});
|
|
1287
|
-
var AuthConfigRetrieveResponseSchema = import_zod4.z.object({
|
|
1288
|
-
id: import_zod4.z.string(),
|
|
1289
|
-
name: import_zod4.z.string(),
|
|
1290
|
-
toolkit: import_zod4.z.object({
|
|
1291
|
-
logo: import_zod4.z.string(),
|
|
1292
|
-
slug: import_zod4.z.string()
|
|
1293
|
-
}),
|
|
1294
|
-
noOfConnections: import_zod4.z.number(),
|
|
1295
|
-
status: import_zod4.z.enum(["ENABLED", "DISABLED"]),
|
|
1296
|
-
uuid: import_zod4.z.string(),
|
|
1297
|
-
authScheme: AuthSchemeEnum.optional(),
|
|
1298
|
-
credentials: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()).optional(),
|
|
1299
|
-
expectedInputFields: import_zod4.z.array(import_zod4.z.unknown()).optional(),
|
|
1300
|
-
restrictToFollowingTools: import_zod4.z.array(import_zod4.z.string()).optional(),
|
|
1301
|
-
isComposioManaged: import_zod4.z.boolean().optional(),
|
|
1302
|
-
createdBy: import_zod4.z.string().optional(),
|
|
1303
|
-
createdAt: import_zod4.z.string().optional(),
|
|
1304
|
-
lastUpdatedAt: import_zod4.z.string().optional()
|
|
1305
|
-
});
|
|
1306
|
-
var AuthConfigListParamsSchema = import_zod4.z.object({
|
|
1307
|
-
cursor: import_zod4.z.string().optional(),
|
|
1308
|
-
isComposioManaged: import_zod4.z.boolean().optional(),
|
|
1309
|
-
limit: import_zod4.z.number().optional(),
|
|
1310
|
-
toolkit: import_zod4.z.string().optional()
|
|
1311
|
-
});
|
|
1312
|
-
var AuthConfigListResponseSchema = import_zod4.z.object({
|
|
1313
|
-
items: import_zod4.z.array(AuthConfigRetrieveResponseSchema),
|
|
1314
|
-
nextCursor: import_zod4.z.string().nullable(),
|
|
1315
|
-
totalPages: import_zod4.z.number()
|
|
1316
|
-
});
|
|
1317
|
-
var AuthCustomConfigUpdateParamsSchema = import_zod4.z.object({
|
|
1318
|
-
credentials: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.union([import_zod4.z.string(), import_zod4.z.unknown()])),
|
|
1319
|
-
type: import_zod4.z.literal("custom"),
|
|
1320
|
-
restrictToFollowingTools: import_zod4.z.array(import_zod4.z.string()).optional()
|
|
1321
|
-
});
|
|
1322
|
-
var AuthDefaultConfigUpdateParamsSchema = import_zod4.z.object({
|
|
1323
|
-
scopes: import_zod4.z.string(),
|
|
1324
|
-
type: import_zod4.z.literal("default"),
|
|
1325
|
-
restrictToFollowingTools: import_zod4.z.array(import_zod4.z.string()).optional()
|
|
1326
|
-
});
|
|
1327
|
-
var AuthConfigUpdateParamsSchema = import_zod4.z.discriminatedUnion("type", [
|
|
1328
|
-
AuthCustomConfigUpdateParamsSchema,
|
|
1329
|
-
AuthDefaultConfigUpdateParamsSchema
|
|
1330
|
-
]);
|
|
1331
|
-
|
|
1332
|
-
// src/types/connectedAccountAuthStates.types.ts
|
|
1333
|
-
var ConnectionStatuses = {
|
|
1334
|
-
INITIALIZING: "INITIALIZING",
|
|
1335
|
-
INITIATED: "INITIATED",
|
|
1336
|
-
ACTIVE: "ACTIVE",
|
|
1337
|
-
FAILED: "FAILED",
|
|
1338
|
-
EXPIRED: "EXPIRED"
|
|
1339
|
-
};
|
|
1340
|
-
var RedirectableAuthSchemeSchema = import_zod5.z.enum([
|
|
1341
|
-
AuthSchemeTypes.OAUTH1,
|
|
1342
|
-
AuthSchemeTypes.OAUTH2,
|
|
1343
|
-
AuthSchemeTypes.COMPOSIO_LINK
|
|
1344
|
-
]);
|
|
1345
|
-
var BaseSchemeRaw = import_zod5.z.object({
|
|
1346
|
-
// for posthog, freshdesk, zendesk, clickup and others
|
|
1347
|
-
subdomain: import_zod5.z.string().optional(),
|
|
1348
|
-
// for atlassian
|
|
1349
|
-
["your-domain"]: import_zod5.z.string().optional(),
|
|
1350
|
-
// for mixpanel
|
|
1351
|
-
region: import_zod5.z.string().optional(),
|
|
1352
|
-
// for shopify
|
|
1353
|
-
shop: import_zod5.z.string().optional(),
|
|
1354
|
-
// for snowflake
|
|
1355
|
-
account_url: import_zod5.z.string().optional(),
|
|
1356
|
-
// likely pipedrive
|
|
1357
|
-
COMPANYDOMAIN: import_zod5.z.string().optional(),
|
|
1358
|
-
// likely zoho
|
|
1359
|
-
extension: import_zod5.z.string().optional(),
|
|
1360
|
-
// likely formsite
|
|
1361
|
-
form_api_base_url: import_zod5.z.string().optional(),
|
|
1362
|
-
// likely salesforce
|
|
1363
|
-
instanceEndpoint: import_zod5.z.string().optional(),
|
|
1364
|
-
// likely active campaign
|
|
1365
|
-
api_url: import_zod5.z.string().optional(),
|
|
1366
|
-
// for borneo
|
|
1367
|
-
borneo_dashboard_url: import_zod5.z.string().optional(),
|
|
1368
|
-
// for zenrows proxy
|
|
1369
|
-
proxy_username: import_zod5.z.string().optional(),
|
|
1370
|
-
proxy_password: import_zod5.z.string().optional(),
|
|
1371
|
-
// for d2l
|
|
1372
|
-
domain: import_zod5.z.string().optional(),
|
|
1373
|
-
version: import_zod5.z.string().optional(),
|
|
1374
|
-
// for mailchimp
|
|
1375
|
-
dc: import_zod5.z.string().optional(),
|
|
1376
|
-
// for sharepoint
|
|
1377
|
-
site_name: import_zod5.z.string().optional(),
|
|
1378
|
-
// for servicenow
|
|
1379
|
-
instanceName: import_zod5.z.string().optional(),
|
|
1380
|
-
// for netsuite
|
|
1381
|
-
account_id: import_zod5.z.string().optional(),
|
|
1382
|
-
// for custom servers
|
|
1383
|
-
your_server: import_zod5.z.string().optional(),
|
|
1384
|
-
// for ragic
|
|
1385
|
-
server_location: import_zod5.z.string().optional(),
|
|
1386
|
-
// base_url only
|
|
1387
|
-
base_url: import_zod5.z.string().optional(),
|
|
1388
|
-
// for api key
|
|
1389
|
-
api_key: import_zod5.z.string().optional(),
|
|
1390
|
-
// for generic api key
|
|
1391
|
-
generic_api_key: import_zod5.z.string().optional()
|
|
1392
|
-
}).catchall(import_zod5.z.unknown());
|
|
1393
|
-
var Oauth2InitiatingConnectionDataSchema = BaseSchemeRaw.extend({
|
|
1394
|
-
status: import_zod5.z.literal(ConnectionStatuses.INITIALIZING)
|
|
1395
|
-
}).catchall(import_zod5.z.unknown());
|
|
1396
|
-
var Oauth2InitiatedConnectionDataSchema = Oauth2InitiatingConnectionDataSchema.extend({
|
|
1397
|
-
status: import_zod5.z.literal(ConnectionStatuses.INITIATED),
|
|
1398
|
-
code_verifier: import_zod5.z.string().optional(),
|
|
1399
|
-
redirectUrl: import_zod5.z.string(),
|
|
1400
|
-
callback_url: import_zod5.z.string().optional(),
|
|
1401
|
-
finalRedirectUri: import_zod5.z.string().optional(),
|
|
1402
|
-
// previously verification_token, will be sent as verification_token to slack
|
|
1403
|
-
webhook_signature: import_zod5.z.string().optional()
|
|
1404
|
-
}).catchall(import_zod5.z.unknown());
|
|
1405
|
-
var Oauth2ActiveConnectionDataSchema = Oauth2InitiatingConnectionDataSchema.extend({
|
|
1406
|
-
status: import_zod5.z.literal(ConnectionStatuses.ACTIVE),
|
|
1407
|
-
access_token: import_zod5.z.string(),
|
|
1408
|
-
id_token: import_zod5.z.string().optional(),
|
|
1409
|
-
token_type: import_zod5.z.string(),
|
|
1410
|
-
refresh_token: import_zod5.z.string().optional(),
|
|
1411
|
-
expires_in: import_zod5.z.number().optional(),
|
|
1412
|
-
scope: import_zod5.z.string().optional(),
|
|
1413
|
-
// previously verification_token, will be sent as verification_token to slack
|
|
1414
|
-
webhook_signature: import_zod5.z.string().optional(),
|
|
1415
|
-
authed_user: import_zod5.z.object({
|
|
1416
|
-
access_token: import_zod5.z.string().optional(),
|
|
1417
|
-
scope: import_zod5.z.string().optional()
|
|
1418
|
-
}).optional().describe("for slack user scopes")
|
|
1419
|
-
}).catchall(import_zod5.z.unknown());
|
|
1420
|
-
var Oauth2FailedConnectionDataSchema = Oauth2InitiatingConnectionDataSchema.extend({
|
|
1421
|
-
status: import_zod5.z.literal(ConnectionStatuses.FAILED),
|
|
1422
|
-
error: import_zod5.z.string().optional(),
|
|
1423
|
-
error_description: import_zod5.z.string().optional()
|
|
1424
|
-
}).catchall(import_zod5.z.unknown());
|
|
1425
|
-
var Oauth2ExpiredConnectionDataSchema = Oauth2InitiatingConnectionDataSchema.extend({
|
|
1426
|
-
status: import_zod5.z.literal(ConnectionStatuses.EXPIRED),
|
|
1427
|
-
expired_at: import_zod5.z.string().optional()
|
|
1428
|
-
}).catchall(import_zod5.z.unknown());
|
|
1429
|
-
var Oauth2ConnectionDataSchema = import_zod5.z.discriminatedUnion("status", [
|
|
1430
|
-
Oauth2InitiatingConnectionDataSchema,
|
|
1431
|
-
Oauth2InitiatedConnectionDataSchema,
|
|
1432
|
-
Oauth2ActiveConnectionDataSchema,
|
|
1433
|
-
Oauth2FailedConnectionDataSchema,
|
|
1434
|
-
Oauth2ExpiredConnectionDataSchema
|
|
1435
|
-
]);
|
|
1436
|
-
var Oauth1InitiatingConnectionDataSchema = BaseSchemeRaw.extend({
|
|
1437
|
-
status: import_zod5.z.literal(ConnectionStatuses.INITIALIZING)
|
|
1438
|
-
}).catchall(import_zod5.z.unknown());
|
|
1439
|
-
var Oauth1InitiatedConnectionDataSchema = Oauth1InitiatingConnectionDataSchema.extend({
|
|
1440
|
-
status: import_zod5.z.literal(ConnectionStatuses.INITIATED),
|
|
1441
|
-
oauth_token: import_zod5.z.string(),
|
|
1442
|
-
authUri: import_zod5.z.string(),
|
|
1443
|
-
oauth_token_secret: import_zod5.z.string(),
|
|
1444
|
-
redirectUrl: import_zod5.z.string(),
|
|
1445
|
-
callbackUrl: import_zod5.z.string().optional()
|
|
1446
|
-
}).catchall(import_zod5.z.unknown());
|
|
1447
|
-
var Oauth1ActiveConnectionDataSchema = Oauth1InitiatingConnectionDataSchema.extend({
|
|
1448
|
-
status: import_zod5.z.literal(ConnectionStatuses.ACTIVE),
|
|
1449
|
-
oauth_token: import_zod5.z.string(),
|
|
1450
|
-
consumer_key: import_zod5.z.string().optional(),
|
|
1451
|
-
redirectUrl: import_zod5.z.string().optional(),
|
|
1452
|
-
callback_url: import_zod5.z.string().optional()
|
|
1453
|
-
}).catchall(import_zod5.z.unknown());
|
|
1454
|
-
var Oauth1FailedConnectionDataSchema = Oauth1InitiatingConnectionDataSchema.extend({
|
|
1455
|
-
status: import_zod5.z.literal(ConnectionStatuses.FAILED),
|
|
1456
|
-
error: import_zod5.z.string().optional(),
|
|
1457
|
-
error_description: import_zod5.z.string().optional()
|
|
1458
|
-
}).catchall(import_zod5.z.unknown());
|
|
1459
|
-
var Oauth1ExpiredConnectionDataSchema = Oauth1InitiatingConnectionDataSchema.extend({
|
|
1460
|
-
status: import_zod5.z.literal(ConnectionStatuses.EXPIRED),
|
|
1461
|
-
expired_at: import_zod5.z.string().optional()
|
|
1462
|
-
}).catchall(import_zod5.z.unknown());
|
|
1463
|
-
var Oauth1ConnectionDataSchema = import_zod5.z.discriminatedUnion("status", [
|
|
1464
|
-
Oauth1InitiatingConnectionDataSchema,
|
|
1465
|
-
Oauth1InitiatedConnectionDataSchema,
|
|
1466
|
-
Oauth1ActiveConnectionDataSchema,
|
|
1467
|
-
Oauth1FailedConnectionDataSchema,
|
|
1468
|
-
Oauth1ExpiredConnectionDataSchema
|
|
1469
|
-
]);
|
|
1470
|
-
var ComposioLinkInitiatingSchema = BaseSchemeRaw.extend({
|
|
1471
|
-
status: import_zod5.z.literal(ConnectionStatuses.INITIALIZING)
|
|
1472
|
-
}).catchall(import_zod5.z.unknown());
|
|
1473
|
-
var ComposioLinkConnectionDataSchema = import_zod5.z.discriminatedUnion("status", [
|
|
1474
|
-
ComposioLinkInitiatingSchema,
|
|
1475
|
-
ComposioLinkInitiatingSchema.extend({
|
|
1476
|
-
status: import_zod5.z.literal(ConnectionStatuses.INITIATED),
|
|
1477
|
-
redirectUrl: import_zod5.z.string()
|
|
1478
|
-
}).catchall(import_zod5.z.unknown()),
|
|
1479
|
-
ComposioLinkInitiatingSchema.extend({
|
|
1480
|
-
status: import_zod5.z.literal(ConnectionStatuses.ACTIVE)
|
|
1481
|
-
}).catchall(import_zod5.z.unknown()),
|
|
1482
|
-
ComposioLinkInitiatingSchema.extend({
|
|
1483
|
-
status: import_zod5.z.literal(ConnectionStatuses.FAILED),
|
|
1484
|
-
error: import_zod5.z.string().optional(),
|
|
1485
|
-
error_description: import_zod5.z.string().optional()
|
|
1486
|
-
}).catchall(import_zod5.z.unknown()),
|
|
1487
|
-
ComposioLinkInitiatingSchema.extend({
|
|
1488
|
-
status: import_zod5.z.literal(ConnectionStatuses.EXPIRED),
|
|
1489
|
-
expired_at: import_zod5.z.string().optional()
|
|
1490
|
-
}).catchall(import_zod5.z.unknown())
|
|
1491
|
-
]);
|
|
1492
|
-
var BillcomAuthInitiatingSchema = BaseSchemeRaw.extend({
|
|
1493
|
-
status: import_zod5.z.literal(ConnectionStatuses.INITIALIZING)
|
|
1494
|
-
}).catchall(import_zod5.z.unknown());
|
|
1495
|
-
var BillcomAuthConnectionDataSchema = import_zod5.z.discriminatedUnion("status", [
|
|
1496
|
-
BillcomAuthInitiatingSchema,
|
|
1497
|
-
BillcomAuthInitiatingSchema.extend({
|
|
1498
|
-
status: import_zod5.z.literal(ConnectionStatuses.INITIATED),
|
|
1499
|
-
redirectUrl: import_zod5.z.string()
|
|
1500
|
-
}).catchall(import_zod5.z.unknown()),
|
|
1501
|
-
BillcomAuthInitiatingSchema.extend({
|
|
1502
|
-
status: import_zod5.z.literal(ConnectionStatuses.ACTIVE),
|
|
1503
|
-
sessionId: import_zod5.z.string(),
|
|
1504
|
-
devKey: import_zod5.z.string()
|
|
1505
|
-
}).catchall(import_zod5.z.unknown()),
|
|
1506
|
-
BillcomAuthInitiatingSchema.extend({
|
|
1507
|
-
status: import_zod5.z.literal(ConnectionStatuses.FAILED),
|
|
1508
|
-
error: import_zod5.z.string().optional(),
|
|
1509
|
-
error_description: import_zod5.z.string().optional()
|
|
1510
|
-
}).catchall(import_zod5.z.unknown()),
|
|
1511
|
-
BillcomAuthInitiatingSchema.extend({
|
|
1512
|
-
status: import_zod5.z.literal(ConnectionStatuses.EXPIRED),
|
|
1513
|
-
expired_at: import_zod5.z.string().optional()
|
|
1514
|
-
}).catchall(import_zod5.z.unknown())
|
|
1515
|
-
]);
|
|
1516
|
-
var BasicInitiatingSchema = BaseSchemeRaw.extend({
|
|
1517
|
-
status: import_zod5.z.literal(ConnectionStatuses.ACTIVE),
|
|
1518
|
-
username: import_zod5.z.string(),
|
|
1519
|
-
password: import_zod5.z.string()
|
|
1520
|
-
}).catchall(import_zod5.z.unknown());
|
|
1521
|
-
var BasicConnectionDataSchema = BasicInitiatingSchema;
|
|
1522
|
-
var ApiKeyInitiatingSchema = BaseSchemeRaw.extend({
|
|
1523
|
-
status: import_zod5.z.literal(ConnectionStatuses.ACTIVE),
|
|
1524
|
-
api_key: import_zod5.z.string().optional(),
|
|
1525
|
-
generic_api_key: import_zod5.z.string().optional()
|
|
1526
|
-
}).catchall(import_zod5.z.unknown());
|
|
1527
|
-
var ApiKeyConnectionDataSchema = ApiKeyInitiatingSchema;
|
|
1528
|
-
var BearerTokenInitiatingSchema = BaseSchemeRaw.extend({
|
|
1529
|
-
status: import_zod5.z.literal(ConnectionStatuses.ACTIVE),
|
|
1530
|
-
token: import_zod5.z.string()
|
|
1531
|
-
}).catchall(import_zod5.z.unknown());
|
|
1532
|
-
var BearerTokenConnectionDataSchema = BearerTokenInitiatingSchema;
|
|
1533
|
-
var GoogleServiceAccountInitiatingSchema = BaseSchemeRaw.extend({
|
|
1534
|
-
status: import_zod5.z.literal(ConnectionStatuses.ACTIVE),
|
|
1535
|
-
credentials_json: import_zod5.z.string()
|
|
1536
|
-
}).catchall(import_zod5.z.unknown());
|
|
1537
|
-
var GoogleServiceAccountConnectionDataSchema = GoogleServiceAccountInitiatingSchema;
|
|
1538
|
-
var NoAuthInitiatingSchema = BaseSchemeRaw.extend({
|
|
1539
|
-
status: import_zod5.z.literal(ConnectionStatuses.ACTIVE)
|
|
1540
|
-
}).catchall(import_zod5.z.unknown());
|
|
1541
|
-
var NoAuthConnectionDataSchema = NoAuthInitiatingSchema;
|
|
1542
|
-
var CalcomAuthInitiatingSchema = BaseSchemeRaw.extend({
|
|
1543
|
-
status: import_zod5.z.literal(ConnectionStatuses.ACTIVE)
|
|
1544
|
-
}).catchall(import_zod5.z.unknown());
|
|
1545
|
-
var CalcomAuthConnectionDataSchema = CalcomAuthInitiatingSchema;
|
|
1546
|
-
var BasicWithJwtInitiatingSchema = BaseSchemeRaw.extend({
|
|
1547
|
-
status: import_zod5.z.literal(ConnectionStatuses.ACTIVE),
|
|
1548
|
-
username: import_zod5.z.string(),
|
|
1549
|
-
password: import_zod5.z.string()
|
|
1550
|
-
}).catchall(import_zod5.z.unknown());
|
|
1551
|
-
var BasicWithJwtConnectionDataSchema = BasicWithJwtInitiatingSchema;
|
|
1552
|
-
var ConnectionDataSchema = import_zod5.z.discriminatedUnion("authScheme", [
|
|
1553
|
-
import_zod5.z.object({
|
|
1554
|
-
authScheme: import_zod5.z.literal(AuthSchemeTypes.OAUTH1),
|
|
1555
|
-
/**
|
|
1556
|
-
* the main connection data discriminated by auth scheme
|
|
1557
|
-
*/
|
|
1558
|
-
val: Oauth1ConnectionDataSchema
|
|
1559
|
-
}),
|
|
1560
|
-
import_zod5.z.object({
|
|
1561
|
-
authScheme: import_zod5.z.literal(AuthSchemeTypes.OAUTH2),
|
|
1562
|
-
/**
|
|
1563
|
-
* the main connection data discriminated by auth scheme
|
|
1564
|
-
*/
|
|
1565
|
-
val: Oauth2ConnectionDataSchema
|
|
1566
|
-
}),
|
|
1567
|
-
import_zod5.z.object({
|
|
1568
|
-
authScheme: import_zod5.z.literal(AuthSchemeTypes.COMPOSIO_LINK),
|
|
1569
|
-
/**
|
|
1570
|
-
* the main connection data discriminated by auth scheme
|
|
1571
|
-
*/
|
|
1572
|
-
val: ComposioLinkConnectionDataSchema
|
|
1573
|
-
}),
|
|
1574
|
-
import_zod5.z.object({
|
|
1575
|
-
authScheme: import_zod5.z.literal(AuthSchemeTypes.API_KEY),
|
|
1576
|
-
/**
|
|
1577
|
-
* the main connection data discriminated by auth scheme
|
|
1578
|
-
*/
|
|
1579
|
-
val: ApiKeyConnectionDataSchema
|
|
1580
|
-
}),
|
|
1581
|
-
import_zod5.z.object({
|
|
1582
|
-
authScheme: import_zod5.z.literal(AuthSchemeTypes.BASIC),
|
|
1583
|
-
/**
|
|
1584
|
-
* the main connection data discriminated by auth scheme
|
|
1585
|
-
*/
|
|
1586
|
-
val: BasicConnectionDataSchema
|
|
1587
|
-
}),
|
|
1588
|
-
import_zod5.z.object({
|
|
1589
|
-
authScheme: import_zod5.z.literal(AuthSchemeTypes.BEARER_TOKEN),
|
|
1590
|
-
/**
|
|
1591
|
-
* the main connection data discriminated by auth scheme
|
|
1592
|
-
*/
|
|
1593
|
-
val: BearerTokenConnectionDataSchema
|
|
1594
|
-
}),
|
|
1595
|
-
import_zod5.z.object({
|
|
1596
|
-
authScheme: import_zod5.z.literal(AuthSchemeTypes.GOOGLE_SERVICE_ACCOUNT),
|
|
1597
|
-
/**
|
|
1598
|
-
* the main connection data discriminated by auth scheme
|
|
1599
|
-
*/
|
|
1600
|
-
val: GoogleServiceAccountConnectionDataSchema
|
|
1601
|
-
}),
|
|
1602
|
-
import_zod5.z.object({
|
|
1603
|
-
authScheme: import_zod5.z.literal(AuthSchemeTypes.NO_AUTH),
|
|
1604
|
-
/**
|
|
1605
|
-
* the main connection data discriminated by auth scheme
|
|
1606
|
-
*/
|
|
1607
|
-
val: NoAuthConnectionDataSchema
|
|
1608
|
-
}),
|
|
1609
|
-
import_zod5.z.object({
|
|
1610
|
-
authScheme: import_zod5.z.literal(AuthSchemeTypes.CALCOM_AUTH),
|
|
1611
|
-
/**
|
|
1612
|
-
* the main connection data discriminated by auth scheme
|
|
1613
|
-
*/
|
|
1614
|
-
val: CalcomAuthConnectionDataSchema
|
|
1615
|
-
}),
|
|
1616
|
-
// z.object({
|
|
1617
|
-
// authScheme: z.literal(AuthSchemeTypes.SNOWFLAKE),
|
|
1618
|
-
// /**
|
|
1619
|
-
// * the main connection data discriminated by auth scheme
|
|
1620
|
-
// */
|
|
1621
|
-
// val: SnowflakeConnectionDataSchema,
|
|
1622
|
-
// }),
|
|
1623
|
-
import_zod5.z.object({
|
|
1624
|
-
authScheme: import_zod5.z.literal(AuthSchemeTypes.BILLCOM_AUTH),
|
|
1625
|
-
/**
|
|
1626
|
-
* the main connection data discriminated by auth scheme
|
|
1627
|
-
*/
|
|
1628
|
-
val: BillcomAuthConnectionDataSchema
|
|
1629
|
-
}),
|
|
1630
|
-
import_zod5.z.object({
|
|
1631
|
-
authScheme: import_zod5.z.literal(AuthSchemeTypes.BASIC_WITH_JWT),
|
|
1632
|
-
/**
|
|
1633
|
-
* the main connection data discriminated by auth scheme
|
|
1634
|
-
*/
|
|
1635
|
-
val: BasicWithJwtConnectionDataSchema
|
|
1636
|
-
})
|
|
1637
|
-
]);
|
|
1638
|
-
|
|
1639
|
-
// src/types/connectedAccounts.types.ts
|
|
1640
1826
|
var ConnectedAccountStatuses = {
|
|
1641
1827
|
INITIALIZING: "INITIALIZING",
|
|
1642
1828
|
INITIATED: "INITIATED",
|
|
@@ -1650,7 +1836,8 @@ var ConnectedAccountStatusSchema = import_zod6.z.enum([
|
|
|
1650
1836
|
ConnectedAccountStatuses.INITIATED,
|
|
1651
1837
|
ConnectedAccountStatuses.ACTIVE,
|
|
1652
1838
|
ConnectedAccountStatuses.FAILED,
|
|
1653
|
-
ConnectedAccountStatuses.EXPIRED
|
|
1839
|
+
ConnectedAccountStatuses.EXPIRED,
|
|
1840
|
+
ConnectedAccountStatuses.INACTIVE
|
|
1654
1841
|
]);
|
|
1655
1842
|
var CreateConnectedAccountParamsSchema = import_zod6.z.object({
|
|
1656
1843
|
authConfig: import_zod6.z.object({
|
|
@@ -1691,7 +1878,7 @@ var ConnectedAccountAuthConfigSchema = import_zod6.z.object({
|
|
|
1691
1878
|
var ConnectedAccountRetrieveResponseSchema = import_zod6.z.object({
|
|
1692
1879
|
id: import_zod6.z.string(),
|
|
1693
1880
|
authConfig: ConnectedAccountAuthConfigSchema,
|
|
1694
|
-
data: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.unknown()),
|
|
1881
|
+
data: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.unknown()).optional(),
|
|
1695
1882
|
params: import_zod6.z.record(import_zod6.z.string(), import_zod6.z.unknown()).optional(),
|
|
1696
1883
|
status: ConnectedAccountStatusSchema,
|
|
1697
1884
|
statusReason: import_zod6.z.string().nullable(),
|
|
@@ -1720,32 +1907,51 @@ var ConnectedAccountListResponseSchema = import_zod6.z.object({
|
|
|
1720
1907
|
totalPages: import_zod6.z.number().describe("The total number of pages of connected accounts")
|
|
1721
1908
|
});
|
|
1722
1909
|
|
|
1910
|
+
// src/utils/transform.ts
|
|
1911
|
+
function transform(raw) {
|
|
1912
|
+
return {
|
|
1913
|
+
with(schema) {
|
|
1914
|
+
return {
|
|
1915
|
+
using(transformer, options) {
|
|
1916
|
+
const transformed = transformer(raw);
|
|
1917
|
+
const result = schema.safeParse(transformed);
|
|
1918
|
+
if (!result.success) {
|
|
1919
|
+
logger_default.error(result.error);
|
|
1920
|
+
return transformed;
|
|
1921
|
+
}
|
|
1922
|
+
return result.data;
|
|
1923
|
+
}
|
|
1924
|
+
};
|
|
1925
|
+
}
|
|
1926
|
+
};
|
|
1927
|
+
}
|
|
1928
|
+
|
|
1723
1929
|
// src/utils/transformers/connectedAccounts.ts
|
|
1724
1930
|
function transformConnectedAccountResponse(response) {
|
|
1725
|
-
|
|
1726
|
-
...
|
|
1931
|
+
return transform(response).with(ConnectedAccountRetrieveResponseSchema).using((response2) => ({
|
|
1932
|
+
...response2,
|
|
1727
1933
|
authConfig: {
|
|
1728
|
-
...
|
|
1729
|
-
id:
|
|
1730
|
-
isComposioManaged:
|
|
1731
|
-
isDisabled:
|
|
1934
|
+
...response2.auth_config,
|
|
1935
|
+
id: response2.auth_config.id,
|
|
1936
|
+
isComposioManaged: response2.auth_config.is_composio_managed,
|
|
1937
|
+
isDisabled: response2.auth_config.is_disabled
|
|
1732
1938
|
},
|
|
1733
|
-
|
|
1734
|
-
|
|
1735
|
-
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1939
|
+
data: response2.data ?? void 0,
|
|
1940
|
+
state: response2.state,
|
|
1941
|
+
status: response2.status,
|
|
1942
|
+
statusReason: response2.status_reason,
|
|
1943
|
+
isDisabled: response2.is_disabled,
|
|
1944
|
+
createdAt: response2.created_at,
|
|
1945
|
+
updatedAt: response2.updated_at,
|
|
1946
|
+
testRequestEndpoint: response2.test_request_endpoint
|
|
1947
|
+
}));
|
|
1948
|
+
}
|
|
1949
|
+
function transformConnectedAccountListResponse(response) {
|
|
1950
|
+
return transform(response).with(ConnectedAccountListResponseSchema).using((response2) => ({
|
|
1951
|
+
items: response2.items.map(transformConnectedAccountResponse),
|
|
1952
|
+
nextCursor: response2.next_cursor ?? null,
|
|
1953
|
+
totalPages: response2.total_pages
|
|
1954
|
+
}));
|
|
1749
1955
|
}
|
|
1750
1956
|
|
|
1751
1957
|
// src/models/CustomTools.ts
|
|
@@ -1985,7 +2191,8 @@ var CustomTools = class {
|
|
|
1985
2191
|
method: data.method,
|
|
1986
2192
|
parameters,
|
|
1987
2193
|
body: data.body,
|
|
1988
|
-
connected_account_id: data.connectedAccountId ?? connectedAccountId
|
|
2194
|
+
connected_account_id: data.connectedAccountId ?? connectedAccountId,
|
|
2195
|
+
custom_connection_data: data.customConnectionData
|
|
1989
2196
|
});
|
|
1990
2197
|
return {
|
|
1991
2198
|
data: response.data,
|
|
@@ -2800,6 +3007,7 @@ var Tools = class {
|
|
|
2800
3007
|
allow_tracing: body.allowTracing,
|
|
2801
3008
|
connected_account_id: body.connectedAccountId,
|
|
2802
3009
|
custom_auth_params: body.customAuthParams,
|
|
3010
|
+
custom_connection_data: body.customConnectionData,
|
|
2803
3011
|
arguments: body.arguments,
|
|
2804
3012
|
user_id: body.userId,
|
|
2805
3013
|
version: body.version,
|
|
@@ -2956,8 +3164,8 @@ var Tools = class {
|
|
|
2956
3164
|
};
|
|
2957
3165
|
if (toolProxyParams.data.parameters) {
|
|
2958
3166
|
parameters.push(
|
|
2959
|
-
...
|
|
2960
|
-
name:
|
|
3167
|
+
...(toolProxyParams.data.parameters ?? []).map((value) => ({
|
|
3168
|
+
name: value.name,
|
|
2961
3169
|
type: value.in === "header" ? parameterTypes.header : parameterTypes.query,
|
|
2962
3170
|
value: value.value.toString()
|
|
2963
3171
|
}))
|
|
@@ -2968,7 +3176,8 @@ var Tools = class {
|
|
|
2968
3176
|
method: toolProxyParams.data.method,
|
|
2969
3177
|
body: toolProxyParams.data.body,
|
|
2970
3178
|
connected_account_id: toolProxyParams.data.connectedAccountId,
|
|
2971
|
-
parameters
|
|
3179
|
+
parameters,
|
|
3180
|
+
custom_connection_data: toolProxyParams.data.customConnectionData
|
|
2972
3181
|
});
|
|
2973
3182
|
}
|
|
2974
3183
|
/**
|
|
@@ -3105,6 +3314,44 @@ var ToolkitAuthFieldsResponseSchema = import_zod7.z.array(
|
|
|
3105
3314
|
})
|
|
3106
3315
|
);
|
|
3107
3316
|
|
|
3317
|
+
// src/utils/transformers/authConfigs.ts
|
|
3318
|
+
function transformAuthConfigRetrieveResponse(authConfig) {
|
|
3319
|
+
return transform(authConfig).with(AuthConfigRetrieveResponseSchema).using((authConfig2) => ({
|
|
3320
|
+
id: authConfig2.id,
|
|
3321
|
+
name: authConfig2.name,
|
|
3322
|
+
noOfConnections: authConfig2.no_of_connections,
|
|
3323
|
+
status: authConfig2.status,
|
|
3324
|
+
toolkit: {
|
|
3325
|
+
logo: authConfig2.toolkit.logo,
|
|
3326
|
+
slug: authConfig2.toolkit.slug
|
|
3327
|
+
},
|
|
3328
|
+
uuid: authConfig2.uuid,
|
|
3329
|
+
authScheme: authConfig2.auth_scheme,
|
|
3330
|
+
credentials: authConfig2.credentials,
|
|
3331
|
+
expectedInputFields: authConfig2.expected_input_fields,
|
|
3332
|
+
isComposioManaged: authConfig2.is_composio_managed,
|
|
3333
|
+
createdBy: authConfig2.created_by,
|
|
3334
|
+
createdAt: authConfig2.created_at,
|
|
3335
|
+
lastUpdatedAt: authConfig2.last_updated_at,
|
|
3336
|
+
restrictToFollowingTools: authConfig2.tool_access_config?.tools_for_connected_account_creation
|
|
3337
|
+
}));
|
|
3338
|
+
}
|
|
3339
|
+
function transformAuthConfigListResponse(response) {
|
|
3340
|
+
return transform(response).with(AuthConfigListResponseSchema).using((response2) => ({
|
|
3341
|
+
items: response2.items.map(transformAuthConfigRetrieveResponse),
|
|
3342
|
+
nextCursor: response2.next_cursor ?? null,
|
|
3343
|
+
totalPages: response2.total_pages
|
|
3344
|
+
}));
|
|
3345
|
+
}
|
|
3346
|
+
function transformCreateAuthConfigResponse(response) {
|
|
3347
|
+
return transform(response).with(CreateAuthConfigResponseSchema).using((response2) => ({
|
|
3348
|
+
id: response2.auth_config.id,
|
|
3349
|
+
authScheme: response2.auth_config.auth_scheme,
|
|
3350
|
+
isComposioManaged: response2.auth_config.is_composio_managed,
|
|
3351
|
+
toolkit: response2.toolkit.slug
|
|
3352
|
+
}));
|
|
3353
|
+
}
|
|
3354
|
+
|
|
3108
3355
|
// src/models/AuthConfigs.ts
|
|
3109
3356
|
var AuthConfigs = class {
|
|
3110
3357
|
client;
|
|
@@ -3120,47 +3367,6 @@ var AuthConfigs = class {
|
|
|
3120
3367
|
getClient() {
|
|
3121
3368
|
return this.client;
|
|
3122
3369
|
}
|
|
3123
|
-
/**
|
|
3124
|
-
* Transforms an auth config response from API format to SDK format.
|
|
3125
|
-
*
|
|
3126
|
-
* This method converts property names from snake_case to camelCase and reorganizes
|
|
3127
|
-
* the data structure to match the SDK's standardized format for auth configurations.
|
|
3128
|
-
*
|
|
3129
|
-
* @param {ComposioAuthConfigRetrieveResponse} authConfig - The raw API response to transform
|
|
3130
|
-
* @returns {AuthConfigRetrieveResponse} The transformed auth config data
|
|
3131
|
-
* @throws {ValidationError} If the response fails validation against the expected schema
|
|
3132
|
-
*
|
|
3133
|
-
* @private
|
|
3134
|
-
*/
|
|
3135
|
-
parseAuthConfigRetrieveResponse(authConfig) {
|
|
3136
|
-
const responseToParse = {
|
|
3137
|
-
id: authConfig.id,
|
|
3138
|
-
name: authConfig.name,
|
|
3139
|
-
noOfConnections: authConfig.no_of_connections,
|
|
3140
|
-
status: authConfig.status,
|
|
3141
|
-
toolkit: {
|
|
3142
|
-
logo: authConfig.toolkit.logo,
|
|
3143
|
-
slug: authConfig.toolkit.slug
|
|
3144
|
-
},
|
|
3145
|
-
uuid: authConfig.uuid,
|
|
3146
|
-
authScheme: authConfig.auth_scheme,
|
|
3147
|
-
credentials: authConfig.credentials,
|
|
3148
|
-
expectedInputFields: authConfig.expected_input_fields,
|
|
3149
|
-
isComposioManaged: authConfig.is_composio_managed,
|
|
3150
|
-
createdBy: authConfig.created_by,
|
|
3151
|
-
createdAt: authConfig.created_at,
|
|
3152
|
-
lastUpdatedAt: authConfig.last_updated_at,
|
|
3153
|
-
restrictToFollowingTools: authConfig.restrict_to_following_tools
|
|
3154
|
-
};
|
|
3155
|
-
const result = AuthConfigRetrieveResponseSchema.safeParse(responseToParse);
|
|
3156
|
-
if (result.error) {
|
|
3157
|
-
logger_default.error("Failed to parse auth config response", {
|
|
3158
|
-
cause: result.error
|
|
3159
|
-
});
|
|
3160
|
-
return responseToParse;
|
|
3161
|
-
}
|
|
3162
|
-
return result.data;
|
|
3163
|
-
}
|
|
3164
3370
|
/**
|
|
3165
3371
|
* Lists authentication configurations based on provided filter criteria.
|
|
3166
3372
|
*
|
|
@@ -3195,17 +3401,7 @@ var AuthConfigs = class {
|
|
|
3195
3401
|
limit: parsedQuery?.limit,
|
|
3196
3402
|
toolkit_slug: parsedQuery?.toolkit
|
|
3197
3403
|
});
|
|
3198
|
-
|
|
3199
|
-
items: result.items.map((item) => this.parseAuthConfigRetrieveResponse(item)),
|
|
3200
|
-
nextCursor: result.next_cursor,
|
|
3201
|
-
totalPages: result.total_pages
|
|
3202
|
-
});
|
|
3203
|
-
if (parsedResult.error) {
|
|
3204
|
-
throw new ValidationError("Failed to parse auth config list response", {
|
|
3205
|
-
cause: parsedResult.error
|
|
3206
|
-
});
|
|
3207
|
-
}
|
|
3208
|
-
return parsedResult.data;
|
|
3404
|
+
return transformAuthConfigListResponse(result);
|
|
3209
3405
|
}
|
|
3210
3406
|
/**
|
|
3211
3407
|
* Create a new auth config
|
|
@@ -3241,26 +3437,19 @@ var AuthConfigs = class {
|
|
|
3241
3437
|
name: parsedOptions.data.name,
|
|
3242
3438
|
authScheme: parsedOptions.data.authScheme,
|
|
3243
3439
|
credentials: parsedOptions.data.credentials,
|
|
3244
|
-
|
|
3440
|
+
tool_access_config: {
|
|
3441
|
+
tools_for_connected_account_creation: parsedOptions.data.restrictToFollowingTools
|
|
3442
|
+
}
|
|
3245
3443
|
} : {
|
|
3246
3444
|
type: parsedOptions.data.type,
|
|
3247
3445
|
credentials: parsedOptions.data.credentials,
|
|
3248
3446
|
name: parsedOptions.data.name,
|
|
3249
|
-
|
|
3447
|
+
tool_access_config: {
|
|
3448
|
+
tools_for_connected_account_creation: parsedOptions.data.restrictToFollowingTools
|
|
3449
|
+
}
|
|
3250
3450
|
}
|
|
3251
3451
|
});
|
|
3252
|
-
|
|
3253
|
-
id: result.auth_config.id,
|
|
3254
|
-
authScheme: result.auth_config.auth_scheme,
|
|
3255
|
-
isComposioManaged: result.auth_config.is_composio_managed,
|
|
3256
|
-
toolkit: result.toolkit.slug
|
|
3257
|
-
});
|
|
3258
|
-
if (parsedResult.error) {
|
|
3259
|
-
throw new ValidationError("Failed to parse auth config create response", {
|
|
3260
|
-
cause: parsedResult.error
|
|
3261
|
-
});
|
|
3262
|
-
}
|
|
3263
|
-
return parsedResult.data;
|
|
3452
|
+
return transformCreateAuthConfigResponse(result);
|
|
3264
3453
|
}
|
|
3265
3454
|
/**
|
|
3266
3455
|
* Retrieves a specific authentication configuration by its ID.
|
|
@@ -3283,7 +3472,7 @@ var AuthConfigs = class {
|
|
|
3283
3472
|
*/
|
|
3284
3473
|
async get(nanoid) {
|
|
3285
3474
|
const result = await this.client.authConfigs.retrieve(nanoid);
|
|
3286
|
-
return
|
|
3475
|
+
return transformAuthConfigRetrieveResponse(result);
|
|
3287
3476
|
}
|
|
3288
3477
|
/**
|
|
3289
3478
|
* Updates an existing authentication configuration.
|
|
@@ -3327,11 +3516,15 @@ var AuthConfigs = class {
|
|
|
3327
3516
|
parsedData.data.type === "custom" ? {
|
|
3328
3517
|
type: "custom",
|
|
3329
3518
|
credentials: parsedData.data.credentials,
|
|
3330
|
-
|
|
3519
|
+
tool_access_config: {
|
|
3520
|
+
tools_for_connected_account_creation: parsedData.data.restrictToFollowingTools
|
|
3521
|
+
}
|
|
3331
3522
|
} : {
|
|
3332
3523
|
type: "default",
|
|
3333
3524
|
scopes: parsedData.data.scopes,
|
|
3334
|
-
|
|
3525
|
+
tool_access_config: {
|
|
3526
|
+
tools_for_connected_account_creation: parsedData.data.restrictToFollowingTools
|
|
3527
|
+
}
|
|
3335
3528
|
}
|
|
3336
3529
|
);
|
|
3337
3530
|
}
|
|
@@ -3543,17 +3736,7 @@ var ConnectedAccounts = class {
|
|
|
3543
3736
|
};
|
|
3544
3737
|
}
|
|
3545
3738
|
const result = await this.client.connectedAccounts.list(rawQuery);
|
|
3546
|
-
|
|
3547
|
-
items: result.items.map(transformConnectedAccountResponse),
|
|
3548
|
-
nextCursor: result.next_cursor,
|
|
3549
|
-
totalPages: result.total_pages
|
|
3550
|
-
});
|
|
3551
|
-
if (!parsedResponse.success) {
|
|
3552
|
-
throw new ValidationError("Failed to parse connected account list response", {
|
|
3553
|
-
cause: parsedResponse.error
|
|
3554
|
-
});
|
|
3555
|
-
}
|
|
3556
|
-
return parsedResponse.data;
|
|
3739
|
+
return transformConnectedAccountListResponse(result);
|
|
3557
3740
|
}
|
|
3558
3741
|
/**
|
|
3559
3742
|
* Compound function to create a new connected account.
|
|
@@ -3789,6 +3972,77 @@ var ConnectedAccounts = class {
|
|
|
3789
3972
|
|
|
3790
3973
|
// src/models/Toolkits.ts
|
|
3791
3974
|
var import_openai = require("openai");
|
|
3975
|
+
|
|
3976
|
+
// src/utils/transformers/toolkits.ts
|
|
3977
|
+
var transformToolkitListResponse = (response) => {
|
|
3978
|
+
return transform(response).with(ToolKitListResponseSchema).using(
|
|
3979
|
+
(response2) => response2.items.map((item) => ({
|
|
3980
|
+
name: item.name,
|
|
3981
|
+
slug: item.slug,
|
|
3982
|
+
meta: {
|
|
3983
|
+
...item.meta,
|
|
3984
|
+
categories: item.meta.categories?.map((category) => ({
|
|
3985
|
+
slug: category.id,
|
|
3986
|
+
name: category.name
|
|
3987
|
+
})),
|
|
3988
|
+
createdAt: item.meta.created_at,
|
|
3989
|
+
description: item.meta.description,
|
|
3990
|
+
logo: item.meta.logo,
|
|
3991
|
+
toolsCount: item.meta.tools_count,
|
|
3992
|
+
triggersCount: item.meta.triggers_count,
|
|
3993
|
+
updatedAt: item.meta.updated_at,
|
|
3994
|
+
appUrl: item.meta.app_url ?? void 0
|
|
3995
|
+
},
|
|
3996
|
+
isLocalToolkit: item.is_local_toolkit,
|
|
3997
|
+
authSchemes: item.auth_schemes,
|
|
3998
|
+
composioManagedAuthSchemes: item.composio_managed_auth_schemes,
|
|
3999
|
+
noAuth: item.no_auth
|
|
4000
|
+
}))
|
|
4001
|
+
);
|
|
4002
|
+
};
|
|
4003
|
+
var transformToolkitRetrieveResponse = (response) => {
|
|
4004
|
+
return transform(response).with(ToolkitRetrieveResponseSchema).using((response2) => ({
|
|
4005
|
+
name: response2.name,
|
|
4006
|
+
slug: response2.slug,
|
|
4007
|
+
meta: {
|
|
4008
|
+
...response2.meta,
|
|
4009
|
+
createdAt: response2.meta.created_at,
|
|
4010
|
+
updatedAt: response2.meta.updated_at,
|
|
4011
|
+
toolsCount: response2.meta.tools_count,
|
|
4012
|
+
triggersCount: response2.meta.triggers_count,
|
|
4013
|
+
categories: response2.meta.categories?.map((category) => ({
|
|
4014
|
+
slug: category.slug,
|
|
4015
|
+
name: category.name
|
|
4016
|
+
}))
|
|
4017
|
+
// appUrl: response.meta.app_url, @TODO Update the client type to include this
|
|
4018
|
+
},
|
|
4019
|
+
isLocalToolkit: response2.is_local_toolkit,
|
|
4020
|
+
composioManagedAuthSchemes: response2.composio_managed_auth_schemes,
|
|
4021
|
+
authConfigDetails: response2.auth_config_details?.map((authConfig) => ({
|
|
4022
|
+
name: authConfig.name,
|
|
4023
|
+
mode: authConfig.mode,
|
|
4024
|
+
fields: {
|
|
4025
|
+
authConfigCreation: authConfig.fields.auth_config_creation,
|
|
4026
|
+
connectedAccountInitiation: authConfig.fields.connected_account_initiation
|
|
4027
|
+
},
|
|
4028
|
+
proxy: {
|
|
4029
|
+
baseUrl: authConfig.proxy?.base_url
|
|
4030
|
+
}
|
|
4031
|
+
}))
|
|
4032
|
+
}));
|
|
4033
|
+
};
|
|
4034
|
+
var transformToolkitRetrieveCategoriesResponse = (response) => {
|
|
4035
|
+
return transform(response).with(ToolkitRetrieveCategoriesResponseSchema).using((response2) => ({
|
|
4036
|
+
items: response2.items.map((item) => ({
|
|
4037
|
+
id: item.id,
|
|
4038
|
+
name: item.name
|
|
4039
|
+
})),
|
|
4040
|
+
nextCursor: response2.next_cursor ?? null,
|
|
4041
|
+
totalPages: response2.total_pages
|
|
4042
|
+
}));
|
|
4043
|
+
};
|
|
4044
|
+
|
|
4045
|
+
// src/models/Toolkits.ts
|
|
3792
4046
|
var Toolkits = class {
|
|
3793
4047
|
client;
|
|
3794
4048
|
constructor(client) {
|
|
@@ -3821,40 +4075,7 @@ var Toolkits = class {
|
|
|
3821
4075
|
managed_by: parsedQuery.data.managedBy,
|
|
3822
4076
|
sort_by: parsedQuery.data.sortBy
|
|
3823
4077
|
});
|
|
3824
|
-
|
|
3825
|
-
result.items.map((item) => {
|
|
3826
|
-
const parsedItem = ToolKitItemSchema.safeParse({
|
|
3827
|
-
name: item.name,
|
|
3828
|
-
slug: item.slug,
|
|
3829
|
-
meta: {
|
|
3830
|
-
...item.meta,
|
|
3831
|
-
createdAt: item.meta.created_at,
|
|
3832
|
-
updatedAt: item.meta.updated_at,
|
|
3833
|
-
toolsCount: item.meta.tools_count,
|
|
3834
|
-
triggersCount: item.meta.triggers_count,
|
|
3835
|
-
categories: item.meta.categories,
|
|
3836
|
-
appUrl: item.meta.app_url,
|
|
3837
|
-
logo: item.meta.logo
|
|
3838
|
-
},
|
|
3839
|
-
isLocalToolkit: item.is_local_toolkit,
|
|
3840
|
-
authSchemes: item.auth_schemes,
|
|
3841
|
-
composioManagedAuthSchemes: item.composio_managed_auth_schemes,
|
|
3842
|
-
noAuth: item.no_auth
|
|
3843
|
-
});
|
|
3844
|
-
if (!parsedItem.success) {
|
|
3845
|
-
throw new ValidationError("Failed to parse toolkit response", {
|
|
3846
|
-
cause: parsedItem.error
|
|
3847
|
-
});
|
|
3848
|
-
}
|
|
3849
|
-
return parsedItem.data;
|
|
3850
|
-
})
|
|
3851
|
-
);
|
|
3852
|
-
if (!parsedResult.success) {
|
|
3853
|
-
throw new ValidationError("Failed to parse toolkit list response", {
|
|
3854
|
-
cause: parsedResult.error
|
|
3855
|
-
});
|
|
3856
|
-
}
|
|
3857
|
-
return parsedResult.data;
|
|
4078
|
+
return transformToolkitListResponse(result);
|
|
3858
4079
|
} catch (error) {
|
|
3859
4080
|
throw new ComposioToolkitFetchError("Failed to fetch toolkits", {
|
|
3860
4081
|
cause: error
|
|
@@ -3877,37 +4098,7 @@ var Toolkits = class {
|
|
|
3877
4098
|
async getToolkitBySlug(slug) {
|
|
3878
4099
|
try {
|
|
3879
4100
|
const result = await this.client.toolkits.retrieve(slug);
|
|
3880
|
-
|
|
3881
|
-
name: result.name,
|
|
3882
|
-
slug: result.slug,
|
|
3883
|
-
meta: {
|
|
3884
|
-
...result.meta,
|
|
3885
|
-
createdAt: result.meta.created_at,
|
|
3886
|
-
updatedAt: result.meta.updated_at,
|
|
3887
|
-
toolsCount: result.meta.tools_count,
|
|
3888
|
-
triggersCount: result.meta.triggers_count
|
|
3889
|
-
// appUrl: result.meta.app_url, @TODO Update the client type to include this
|
|
3890
|
-
},
|
|
3891
|
-
isLocalToolkit: result.is_local_toolkit,
|
|
3892
|
-
composioManagedAuthSchemes: result.composio_managed_auth_schemes,
|
|
3893
|
-
authConfigDetails: result.auth_config_details?.map((authConfig) => ({
|
|
3894
|
-
name: authConfig.name,
|
|
3895
|
-
mode: authConfig.mode,
|
|
3896
|
-
fields: {
|
|
3897
|
-
authConfigCreation: authConfig.fields.auth_config_creation,
|
|
3898
|
-
connectedAccountInitiation: authConfig.fields.connected_account_initiation
|
|
3899
|
-
},
|
|
3900
|
-
proxy: {
|
|
3901
|
-
baseUrl: authConfig.proxy?.base_url
|
|
3902
|
-
}
|
|
3903
|
-
}))
|
|
3904
|
-
});
|
|
3905
|
-
if (!parsedResult.success) {
|
|
3906
|
-
throw new ValidationError("Failed to parse toolkit response", {
|
|
3907
|
-
cause: parsedResult.error
|
|
3908
|
-
});
|
|
3909
|
-
}
|
|
3910
|
-
return parsedResult.data;
|
|
4101
|
+
return transformToolkitRetrieveResponse(result);
|
|
3911
4102
|
} catch (error) {
|
|
3912
4103
|
if (error instanceof import_openai.APIError && (error.status === 404 || error.status === 400)) {
|
|
3913
4104
|
throw new ComposioToolkitNotFoundError(`Toolkit with slug ${slug} not found`, {
|
|
@@ -3935,7 +4126,7 @@ var Toolkits = class {
|
|
|
3935
4126
|
if (typeof arg === "string") {
|
|
3936
4127
|
return this.getToolkitBySlug(arg);
|
|
3937
4128
|
}
|
|
3938
|
-
return this.getToolkits(arg);
|
|
4129
|
+
return this.getToolkits(arg ?? {});
|
|
3939
4130
|
}
|
|
3940
4131
|
async getAuthConfigFields(toolkitSlug, authScheme, authConfigType, requiredOnly) {
|
|
3941
4132
|
const toolkit = await this.getToolkitBySlug(toolkitSlug);
|
|
@@ -4028,23 +4219,7 @@ var Toolkits = class {
|
|
|
4028
4219
|
*/
|
|
4029
4220
|
async listCategories() {
|
|
4030
4221
|
const result = await this.client.toolkits.retrieveCategories();
|
|
4031
|
-
|
|
4032
|
-
items: result.items.map((item) => {
|
|
4033
|
-
const parsedItem = ToolkitCategorySchema.parse({
|
|
4034
|
-
id: item.id,
|
|
4035
|
-
name: item.name
|
|
4036
|
-
});
|
|
4037
|
-
return parsedItem;
|
|
4038
|
-
}),
|
|
4039
|
-
nextCursor: result.next_cursor,
|
|
4040
|
-
totalPages: result.total_pages
|
|
4041
|
-
});
|
|
4042
|
-
if (!parsedResult.success) {
|
|
4043
|
-
throw new ValidationError("Failed to parse toolkit categories response", {
|
|
4044
|
-
cause: parsedResult.error
|
|
4045
|
-
});
|
|
4046
|
-
}
|
|
4047
|
-
return parsedResult.data;
|
|
4222
|
+
return transformToolkitRetrieveCategoriesResponse(result);
|
|
4048
4223
|
}
|
|
4049
4224
|
/**
|
|
4050
4225
|
* Authorizes a user to use a toolkit.
|
|
@@ -4058,22 +4233,24 @@ var Toolkits = class {
|
|
|
4058
4233
|
* const connectionRequest = await composio.toolkits.authorize(userId, 'github');
|
|
4059
4234
|
* ```
|
|
4060
4235
|
*/
|
|
4061
|
-
async authorize(userId, toolkitSlug) {
|
|
4236
|
+
async authorize(userId, toolkitSlug, authConfigId) {
|
|
4062
4237
|
const toolkit = await this.getToolkitBySlug(toolkitSlug);
|
|
4063
4238
|
const composioAuthConfig = new AuthConfigs(this.client);
|
|
4064
|
-
let authConfigIdToUse;
|
|
4065
|
-
|
|
4066
|
-
|
|
4067
|
-
|
|
4068
|
-
|
|
4239
|
+
let authConfigIdToUse = authConfigId;
|
|
4240
|
+
if (!authConfigIdToUse) {
|
|
4241
|
+
const authConfig = await composioAuthConfig.list({
|
|
4242
|
+
toolkit: toolkitSlug
|
|
4243
|
+
});
|
|
4244
|
+
authConfigIdToUse = authConfig.items[0]?.id;
|
|
4245
|
+
}
|
|
4069
4246
|
if (!authConfigIdToUse) {
|
|
4070
4247
|
if (toolkit.authConfigDetails && toolkit.authConfigDetails.length > 0) {
|
|
4071
4248
|
try {
|
|
4072
|
-
const
|
|
4249
|
+
const authConfig = await composioAuthConfig.create(toolkitSlug, {
|
|
4073
4250
|
type: "use_composio_managed_auth",
|
|
4074
4251
|
name: `${toolkit.name} Auth Config`
|
|
4075
4252
|
});
|
|
4076
|
-
authConfigIdToUse =
|
|
4253
|
+
authConfigIdToUse = authConfig.id;
|
|
4077
4254
|
} catch (error) {
|
|
4078
4255
|
if (error instanceof import_client4.default.APIError && error.status === 400) {
|
|
4079
4256
|
throw new ComposioAuthConfigNotFoundError(
|
|
@@ -4488,27 +4665,75 @@ var PusherService = class {
|
|
|
4488
4665
|
}
|
|
4489
4666
|
};
|
|
4490
4667
|
|
|
4491
|
-
// src/utils/
|
|
4492
|
-
function
|
|
4493
|
-
return {
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
|
|
4509
|
-
|
|
4668
|
+
// src/utils/transformers/triggers.ts
|
|
4669
|
+
function transformIncomingTriggerPayload(response) {
|
|
4670
|
+
return transform(response).with(IncomingTriggerPayloadSchema).using((response2) => ({
|
|
4671
|
+
id: response2.metadata.nanoId,
|
|
4672
|
+
uuid: response2.metadata.id,
|
|
4673
|
+
triggerSlug: response2.metadata.triggerName,
|
|
4674
|
+
toolkitSlug: response2.appName,
|
|
4675
|
+
userId: response2.metadata.connection?.clientUniqueUserId,
|
|
4676
|
+
payload: response2.payload,
|
|
4677
|
+
originalPayload: response2.originalPayload,
|
|
4678
|
+
metadata: {
|
|
4679
|
+
id: response2.metadata.nanoId,
|
|
4680
|
+
uuid: response2.metadata.id,
|
|
4681
|
+
triggerConfig: response2.metadata.triggerConfig,
|
|
4682
|
+
triggerSlug: response2.metadata.triggerName,
|
|
4683
|
+
toolkitSlug: response2.appName,
|
|
4684
|
+
triggerData: response2.metadata.triggerData,
|
|
4685
|
+
connectedAccount: {
|
|
4686
|
+
id: response2.metadata.connection?.connectedAccountNanoId,
|
|
4687
|
+
uuid: response2.metadata.connection?.id,
|
|
4688
|
+
authConfigId: response2.metadata.connection?.authConfigNanoId,
|
|
4689
|
+
authConfigUUID: response2.metadata.connection?.integrationId,
|
|
4690
|
+
userId: response2.metadata.connection?.clientUniqueUserId,
|
|
4691
|
+
status: response2.metadata.connection?.status
|
|
4692
|
+
}
|
|
4510
4693
|
}
|
|
4511
|
-
};
|
|
4694
|
+
}));
|
|
4695
|
+
}
|
|
4696
|
+
function transformTriggerTypeRetrieveResponse(response) {
|
|
4697
|
+
return transform(response).with(TriggerTypeSchema).using((response2) => ({
|
|
4698
|
+
slug: response2.slug,
|
|
4699
|
+
name: response2.name,
|
|
4700
|
+
description: response2.description,
|
|
4701
|
+
instructions: response2.instructions,
|
|
4702
|
+
toolkit: {
|
|
4703
|
+
logo: response2.toolkit.logo,
|
|
4704
|
+
slug: response2.toolkit.slug,
|
|
4705
|
+
name: response2.toolkit.name
|
|
4706
|
+
},
|
|
4707
|
+
payload: response2.payload,
|
|
4708
|
+
config: response2.config
|
|
4709
|
+
}));
|
|
4710
|
+
}
|
|
4711
|
+
function transformTriggerTypeListResponse(response) {
|
|
4712
|
+
return transform(response).with(TriggersTypeListResponseSchema).using((response2) => ({
|
|
4713
|
+
items: response2.items,
|
|
4714
|
+
nextCursor: response2.next_cursor ?? null,
|
|
4715
|
+
totalPages: response2.total_pages
|
|
4716
|
+
}));
|
|
4717
|
+
}
|
|
4718
|
+
function transformTriggerInstanceListActiveItem(response) {
|
|
4719
|
+
return transform(response).with(TriggerInstanceListActiveResponseItemSchema).using((response2) => ({
|
|
4720
|
+
id: response2.id,
|
|
4721
|
+
connectedAccountId: response2.connected_account_id,
|
|
4722
|
+
disabledAt: response2.disabled_at,
|
|
4723
|
+
state: response2.state,
|
|
4724
|
+
triggerConfig: response2.trigger_config,
|
|
4725
|
+
triggerName: response2.trigger_name,
|
|
4726
|
+
updatedAt: response2.updated_at,
|
|
4727
|
+
triggerData: response2.trigger_data,
|
|
4728
|
+
uuid: response2.uuid
|
|
4729
|
+
}));
|
|
4730
|
+
}
|
|
4731
|
+
function transformTriggerInstanceListActiveResponse(response) {
|
|
4732
|
+
return transform(response).with(TriggerInstanceListActiveResponseSchema).using((response2) => ({
|
|
4733
|
+
items: response2.items.map((item) => transformTriggerInstanceListActiveItem(item)),
|
|
4734
|
+
nextCursor: response2.next_cursor ?? null,
|
|
4735
|
+
totalPages: response2.total_pages
|
|
4736
|
+
}));
|
|
4512
4737
|
}
|
|
4513
4738
|
|
|
4514
4739
|
// src/models/Triggers.ts
|
|
@@ -4520,31 +4745,6 @@ var Triggers = class {
|
|
|
4520
4745
|
this.pusherService = new PusherService(client);
|
|
4521
4746
|
telemetry.instrument(this);
|
|
4522
4747
|
}
|
|
4523
|
-
/**
|
|
4524
|
-
* Parse the trigger instance list active item
|
|
4525
|
-
*
|
|
4526
|
-
* @param response - The response from the composio client
|
|
4527
|
-
* @returns The parsed trigger instance list active item
|
|
4528
|
-
*/
|
|
4529
|
-
parseTriggerInstanceListActiveItem(response) {
|
|
4530
|
-
const parsed = TriggerInstanceListActiveResponseItemSchema.safeParse({
|
|
4531
|
-
id: response.id,
|
|
4532
|
-
connectedAccountId: response.connected_account_id,
|
|
4533
|
-
disabledAt: response.disabled_at,
|
|
4534
|
-
state: response.state,
|
|
4535
|
-
triggerConfig: response.trigger_config,
|
|
4536
|
-
triggerName: response.trigger_name,
|
|
4537
|
-
updatedAt: response.updated_at,
|
|
4538
|
-
triggerData: response.trigger_data,
|
|
4539
|
-
uuid: response.uuid
|
|
4540
|
-
});
|
|
4541
|
-
if (!parsed.success) {
|
|
4542
|
-
throw new ValidationError(`Invalid trigger instance list active item`, {
|
|
4543
|
-
cause: parsed.error
|
|
4544
|
-
});
|
|
4545
|
-
}
|
|
4546
|
-
return parsed.data;
|
|
4547
|
-
}
|
|
4548
4748
|
/**
|
|
4549
4749
|
* Fetch list of all the active triggers
|
|
4550
4750
|
*
|
|
@@ -4580,17 +4780,7 @@ var Triggers = class {
|
|
|
4580
4780
|
trigger_names: parsedParams.data.triggerNames
|
|
4581
4781
|
} : void 0
|
|
4582
4782
|
);
|
|
4583
|
-
|
|
4584
|
-
items: result.items.map((item) => this.parseTriggerInstanceListActiveItem(item)),
|
|
4585
|
-
nextCursor: result.next_cursor,
|
|
4586
|
-
totalPages: result.total_pages
|
|
4587
|
-
});
|
|
4588
|
-
if (!parsedResult.success) {
|
|
4589
|
-
throw new ValidationError(`Invalid trigger instance list active response`, {
|
|
4590
|
-
cause: parsedResult.error
|
|
4591
|
-
});
|
|
4592
|
-
}
|
|
4593
|
-
return parsedResult.data;
|
|
4783
|
+
return transformTriggerInstanceListActiveResponse(result);
|
|
4594
4784
|
}
|
|
4595
4785
|
/**
|
|
4596
4786
|
* Create a new trigger instance for a user
|
|
@@ -4678,15 +4868,9 @@ var Triggers = class {
|
|
|
4678
4868
|
connected_account_id: connectedAccountId,
|
|
4679
4869
|
trigger_config: parsedBody.data.triggerConfig
|
|
4680
4870
|
});
|
|
4681
|
-
|
|
4871
|
+
return {
|
|
4682
4872
|
triggerId: result.trigger_id
|
|
4683
|
-
}
|
|
4684
|
-
if (!parsedResult.success) {
|
|
4685
|
-
throw new ValidationError(`Invalid trigger instance upsert response`, {
|
|
4686
|
-
cause: parsedResult.error
|
|
4687
|
-
});
|
|
4688
|
-
}
|
|
4689
|
-
return parsedResult.data;
|
|
4873
|
+
};
|
|
4690
4874
|
}
|
|
4691
4875
|
/**
|
|
4692
4876
|
* Update an existing trigger instance
|
|
@@ -4706,15 +4890,9 @@ var Triggers = class {
|
|
|
4706
4890
|
*/
|
|
4707
4891
|
async delete(triggerId) {
|
|
4708
4892
|
const result = await this.client.triggerInstances.manage.delete(triggerId);
|
|
4709
|
-
|
|
4893
|
+
return {
|
|
4710
4894
|
triggerId: result.trigger_id
|
|
4711
|
-
}
|
|
4712
|
-
if (!parsedResult.success) {
|
|
4713
|
-
throw new ValidationError(`Invalid trigger instance manage delete response`, {
|
|
4714
|
-
cause: parsedResult.error
|
|
4715
|
-
});
|
|
4716
|
-
}
|
|
4717
|
-
return parsedResult.data;
|
|
4895
|
+
};
|
|
4718
4896
|
}
|
|
4719
4897
|
/**
|
|
4720
4898
|
* Disable a trigger instance
|
|
@@ -4755,12 +4933,7 @@ var Triggers = class {
|
|
|
4755
4933
|
limit: parsedQuery.limit,
|
|
4756
4934
|
toolkit_slugs: parsedQuery.toolkits
|
|
4757
4935
|
});
|
|
4758
|
-
|
|
4759
|
-
items: raw.items,
|
|
4760
|
-
nextCursor: raw.next_cursor ?? null,
|
|
4761
|
-
totalPages: raw.total_pages
|
|
4762
|
-
}));
|
|
4763
|
-
return parsedResult;
|
|
4936
|
+
return transformTriggerTypeListResponse(result);
|
|
4764
4937
|
}
|
|
4765
4938
|
/**
|
|
4766
4939
|
* Retrieve a trigger type by its slug
|
|
@@ -4771,20 +4944,7 @@ var Triggers = class {
|
|
|
4771
4944
|
*/
|
|
4772
4945
|
async getType(slug) {
|
|
4773
4946
|
const result = await this.client.triggersTypes.retrieve(slug);
|
|
4774
|
-
|
|
4775
|
-
slug: raw.slug,
|
|
4776
|
-
name: raw.name,
|
|
4777
|
-
description: raw.description,
|
|
4778
|
-
instructions: raw.instructions,
|
|
4779
|
-
toolkit: {
|
|
4780
|
-
logo: raw.toolkit.logo,
|
|
4781
|
-
slug: raw.toolkit.slug,
|
|
4782
|
-
name: raw.toolkit.name
|
|
4783
|
-
},
|
|
4784
|
-
payload: raw.payload,
|
|
4785
|
-
config: raw.config
|
|
4786
|
-
}));
|
|
4787
|
-
return parsedResult;
|
|
4947
|
+
return transformTriggerTypeRetrieveResponse(result);
|
|
4788
4948
|
}
|
|
4789
4949
|
/**
|
|
4790
4950
|
* Fetches the list of all the available trigger enums
|
|
@@ -4870,40 +5030,10 @@ var Triggers = class {
|
|
|
4870
5030
|
await this.pusherService.subscribe((_data) => {
|
|
4871
5031
|
logger_default.debug("Received raw trigger data", JSON.stringify(_data, null, 2));
|
|
4872
5032
|
const data = _data;
|
|
4873
|
-
const parsedData =
|
|
4874
|
-
|
|
4875
|
-
uuid: data.metadata.id,
|
|
4876
|
-
triggerSlug: data.metadata.triggerName,
|
|
4877
|
-
toolkitSlug: data.appName,
|
|
4878
|
-
userId: data.metadata.connection?.clientUniqueUserId,
|
|
4879
|
-
payload: data.payload,
|
|
4880
|
-
originalPayload: data.originalPayload,
|
|
4881
|
-
metadata: {
|
|
4882
|
-
id: data.metadata.nanoId,
|
|
4883
|
-
uuid: data.metadata.id,
|
|
4884
|
-
triggerConfig: data.metadata.triggerConfig,
|
|
4885
|
-
triggerSlug: data.metadata.triggerName,
|
|
4886
|
-
toolkitSlug: data.appName,
|
|
4887
|
-
triggerData: data.metadata.triggerData,
|
|
4888
|
-
connectedAccount: {
|
|
4889
|
-
id: data.metadata.connection?.connectedAccountNanoId,
|
|
4890
|
-
uuid: data.metadata.connection?.id,
|
|
4891
|
-
authConfigId: data.metadata.connection?.authConfigNanoId,
|
|
4892
|
-
authConfigUUID: data.metadata.connection?.integrationId,
|
|
4893
|
-
userId: data.metadata.connection?.clientUniqueUserId,
|
|
4894
|
-
status: data.metadata.connection?.status
|
|
4895
|
-
}
|
|
4896
|
-
}
|
|
4897
|
-
});
|
|
4898
|
-
logger_default.debug("Parsed trigger data", JSON.stringify(parsedData.data, null, 2));
|
|
4899
|
-
if (parsedData.error) {
|
|
4900
|
-
throw new ValidationError(`Invalid trigger payload`, {
|
|
4901
|
-
cause: parsedData.error
|
|
4902
|
-
});
|
|
4903
|
-
}
|
|
4904
|
-
if (this.shouldSendTriggerAfterFilters(parsedFilters.data, parsedData.data)) {
|
|
5033
|
+
const parsedData = transformIncomingTriggerPayload(data);
|
|
5034
|
+
if (this.shouldSendTriggerAfterFilters(parsedFilters.data, parsedData)) {
|
|
4905
5035
|
try {
|
|
4906
|
-
fn(parsedData
|
|
5036
|
+
fn(parsedData);
|
|
4907
5037
|
} catch (error) {
|
|
4908
5038
|
logger_default.error("\u274C Error in trigger callback:", error);
|
|
4909
5039
|
}
|
|
@@ -4944,7 +5074,7 @@ var MCPToolkitConfigsArraySchema = import_zod10.z.array(MCPToolkitConfigSchema).
|
|
|
4944
5074
|
return uniqueToolkits.size === toolkits.length;
|
|
4945
5075
|
}, "Duplicate toolkits are not allowed. Each toolkit must be unique.");
|
|
4946
5076
|
var MCPAuthOptionsSchema = import_zod10.z.object({
|
|
4947
|
-
|
|
5077
|
+
isChatAuth: import_zod10.z.boolean().optional()
|
|
4948
5078
|
});
|
|
4949
5079
|
var MCPGetServerParamsSchema = import_zod10.z.object({
|
|
4950
5080
|
userId: import_zod10.z.string().min(1, "User ID cannot be empty").optional(),
|
|
@@ -4962,7 +5092,7 @@ var MCPGetServerParamsSchema = import_zod10.z.object({
|
|
|
4962
5092
|
var MCPGenerateURLParamsSchema = import_zod10.z.object({
|
|
4963
5093
|
userIds: import_zod10.z.array(import_zod10.z.string()).optional(),
|
|
4964
5094
|
connectedAccountIds: import_zod10.z.array(import_zod10.z.string()).optional(),
|
|
4965
|
-
|
|
5095
|
+
isChatAuth: import_zod10.z.boolean().optional()
|
|
4966
5096
|
});
|
|
4967
5097
|
var ComposioGenerateURLParamsSchema = import_zod10.z.object({
|
|
4968
5098
|
user_ids: import_zod10.z.array(import_zod10.z.string()).optional(),
|
|
@@ -5016,6 +5146,11 @@ var MCPServerUpdateParamsSchema = import_zod10.z.object({
|
|
|
5016
5146
|
allowedTools: import_zod10.z.array(import_zod10.z.string()).optional().describe("Updated list of allowed tools")
|
|
5017
5147
|
});
|
|
5018
5148
|
var MCPServerCreateResponseSchema = MCPServerSchema;
|
|
5149
|
+
var ConnectionStatus = /* @__PURE__ */ ((ConnectionStatus2) => {
|
|
5150
|
+
ConnectionStatus2["CONNECTED"] = "CONNECTED";
|
|
5151
|
+
ConnectionStatus2["DISCONNECTED"] = "DISCONNECTED";
|
|
5152
|
+
return ConnectionStatus2;
|
|
5153
|
+
})(ConnectionStatus || {});
|
|
5019
5154
|
var CustomCreateResponseSchema = import_zod10.z.object({
|
|
5020
5155
|
id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
|
|
5021
5156
|
name: import_zod10.z.string().min(1, "Server name cannot be empty"),
|
|
@@ -5060,7 +5195,14 @@ var McpRetrieveResponseSchema = import_zod10.z.object({
|
|
|
5060
5195
|
status: import_zod10.z.string().optional(),
|
|
5061
5196
|
toolkits: import_zod10.z.array(import_zod10.z.string()).optional(),
|
|
5062
5197
|
tools: import_zod10.z.array(import_zod10.z.string()).optional(),
|
|
5063
|
-
managedAuthViaComposio: import_zod10.z.boolean().optional()
|
|
5198
|
+
managedAuthViaComposio: import_zod10.z.boolean().optional(),
|
|
5199
|
+
authConfigIds: import_zod10.z.array(import_zod10.z.string()).optional(),
|
|
5200
|
+
mcpUrl: import_zod10.z.string(),
|
|
5201
|
+
commands: import_zod10.z.object({
|
|
5202
|
+
claude: import_zod10.z.string(),
|
|
5203
|
+
cursor: import_zod10.z.string(),
|
|
5204
|
+
windsurf: import_zod10.z.string()
|
|
5205
|
+
})
|
|
5064
5206
|
});
|
|
5065
5207
|
var ComposioMcpRetrieveResponseSchema = import_zod10.z.object({
|
|
5066
5208
|
id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
|
|
@@ -5143,8 +5285,11 @@ function transformMcpRetrieveResponse(response) {
|
|
|
5143
5285
|
updatedAt: response.updated_at,
|
|
5144
5286
|
status: response.status,
|
|
5145
5287
|
toolkits: response.toolkits,
|
|
5146
|
-
tools: response.
|
|
5147
|
-
managedAuthViaComposio: response.managed_auth_via_composio
|
|
5288
|
+
tools: response.allowed_tools,
|
|
5289
|
+
managedAuthViaComposio: response.managed_auth_via_composio,
|
|
5290
|
+
authConfigIds: response.auth_config_ids,
|
|
5291
|
+
mcpUrl: response.mcp_url,
|
|
5292
|
+
commands: response.commands
|
|
5148
5293
|
});
|
|
5149
5294
|
if (!result.success) {
|
|
5150
5295
|
throw new ValidationError("Failed to parse MCP retrieve response", {
|
|
@@ -5201,9 +5346,11 @@ function transformMcpGenerateUrlResponse(response) {
|
|
|
5201
5346
|
var MCP = class {
|
|
5202
5347
|
client;
|
|
5203
5348
|
provider;
|
|
5349
|
+
toolkits;
|
|
5204
5350
|
constructor(client, provider) {
|
|
5205
5351
|
this.client = client;
|
|
5206
5352
|
this.provider = provider;
|
|
5353
|
+
this.toolkits = new Toolkits(client);
|
|
5207
5354
|
telemetry.instrument(this);
|
|
5208
5355
|
}
|
|
5209
5356
|
/**
|
|
@@ -5231,47 +5378,100 @@ var MCP = class {
|
|
|
5231
5378
|
}
|
|
5232
5379
|
/**
|
|
5233
5380
|
* Create a new MCP server
|
|
5234
|
-
* @param {
|
|
5235
|
-
* @param {
|
|
5236
|
-
* @param {
|
|
5381
|
+
* @param {Object} params - Parameters for creating the MCP server
|
|
5382
|
+
* @param {Array} params.authConfig - Array of auth configurations with id and allowed tools
|
|
5383
|
+
* @param {Object} params.options - Server creation options
|
|
5384
|
+
* @param {string} params.options.name - Unique name for the MCP server
|
|
5385
|
+
* @param {boolean} [params.options.isChatAuth] - Whether to use chat-based authentication
|
|
5237
5386
|
* @returns {Promise<McpServerCreateResponse<T>>} Created server details with instance getter
|
|
5238
5387
|
*
|
|
5239
5388
|
* @example
|
|
5240
5389
|
* ```typescript
|
|
5241
|
-
* const server = await composio.mcp.create(
|
|
5242
|
-
* "personal-mcp-server",
|
|
5243
|
-
* [
|
|
5390
|
+
* const server = await composio.mcp.create("personal-mcp-server", [
|
|
5244
5391
|
* {
|
|
5245
|
-
*
|
|
5246
|
-
*
|
|
5247
|
-
*
|
|
5248
|
-
* },
|
|
5392
|
+
* authConfigId: "ac_xyz",
|
|
5393
|
+
* allowedTools: ["GMAIL_FETCH_EMAILS", "SLACK_SEND_MESSAGE"]
|
|
5394
|
+
* }
|
|
5249
5395
|
* ],
|
|
5250
|
-
* {
|
|
5251
|
-
*
|
|
5252
|
-
*
|
|
5253
|
-
* // Option 1: Use convenience method on response
|
|
5254
|
-
* const urls = await server.getServer({
|
|
5255
|
-
* connectedAccountIds: { gmail: "account_id" }
|
|
5396
|
+
* {
|
|
5397
|
+
* isChatAuth: true
|
|
5398
|
+
* }
|
|
5256
5399
|
* });
|
|
5257
5400
|
*
|
|
5258
|
-
* //
|
|
5259
|
-
* const
|
|
5260
|
-
*
|
|
5401
|
+
* // Use convenience method on response
|
|
5402
|
+
* const urls = await server.getServer({
|
|
5403
|
+
* userId: "user123"
|
|
5261
5404
|
* });
|
|
5262
5405
|
* ```
|
|
5263
5406
|
*/
|
|
5264
|
-
async create(name,
|
|
5265
|
-
|
|
5266
|
-
|
|
5407
|
+
async create(name, serverConfig, options) {
|
|
5408
|
+
if (!serverConfig || serverConfig.length === 0) {
|
|
5409
|
+
throw new ValidationError("At least one auth config is required", {});
|
|
5410
|
+
}
|
|
5411
|
+
if (!name) {
|
|
5412
|
+
throw new ValidationError("Server name is required", {});
|
|
5413
|
+
}
|
|
5414
|
+
try {
|
|
5415
|
+
const mcpServer = await this.getByName(name);
|
|
5416
|
+
const authConfigs = mcpServer.authConfigIds?.sort();
|
|
5417
|
+
const sortedCurrentAuthConfigs = serverConfig.map((config) => config.authConfigId).sort();
|
|
5418
|
+
if (authConfigs.length > 0 && !authConfigs.every((config, index) => config === sortedCurrentAuthConfigs[index])) {
|
|
5419
|
+
throw new ValidationError(
|
|
5420
|
+
"MCP server with this name already exists with different auth configs",
|
|
5421
|
+
{
|
|
5422
|
+
meta: { serverName: name }
|
|
5423
|
+
}
|
|
5424
|
+
);
|
|
5425
|
+
}
|
|
5426
|
+
const tools = mcpServer.tools?.sort();
|
|
5427
|
+
const sortedCurrentTools = serverConfig.flatMap((config) => config.allowedTools).sort();
|
|
5428
|
+
console.log(tools, sortedCurrentTools, "tools");
|
|
5429
|
+
if (tools?.length > 0 && !tools.every((tool, index) => tool === sortedCurrentTools[index])) {
|
|
5430
|
+
throw new ValidationError("MCP server with this name already exists with different tools", {
|
|
5431
|
+
meta: { serverName: name }
|
|
5432
|
+
});
|
|
5433
|
+
}
|
|
5434
|
+
const authConfigDetails2 = await Promise.all(
|
|
5435
|
+
serverConfig.map((config) => this.client.authConfigs.retrieve(config.authConfigId))
|
|
5436
|
+
);
|
|
5437
|
+
const toolkits2 = authConfigDetails2.map((config) => config.toolkit.slug);
|
|
5438
|
+
const camelCaseResponse2 = transformMcpCreateResponse({
|
|
5439
|
+
id: mcpServer.id,
|
|
5440
|
+
name: mcpServer.name,
|
|
5441
|
+
auth_config_ids: serverConfig.map((config) => config.authConfigId),
|
|
5442
|
+
allowed_tools: serverConfig.flatMap((config) => config.allowedTools),
|
|
5443
|
+
managed_auth_via_composio: options.isChatAuth || false,
|
|
5444
|
+
commands: mcpServer.commands,
|
|
5445
|
+
created_at: mcpServer.createdAt,
|
|
5446
|
+
updated_at: mcpServer.updatedAt,
|
|
5447
|
+
mcp_url: mcpServer.mcpUrl
|
|
5448
|
+
});
|
|
5449
|
+
return {
|
|
5450
|
+
...camelCaseResponse2,
|
|
5451
|
+
toolkits: toolkits2,
|
|
5452
|
+
getServer: async (params) => {
|
|
5453
|
+
return this.getServer(camelCaseResponse2.id, params.userId || "", {
|
|
5454
|
+
isChatAuth: options.isChatAuth
|
|
5455
|
+
});
|
|
5456
|
+
}
|
|
5457
|
+
};
|
|
5458
|
+
} catch (error) {
|
|
5459
|
+
if (error instanceof ValidationError && !error.message.includes("not found")) {
|
|
5460
|
+
throw error;
|
|
5461
|
+
}
|
|
5462
|
+
}
|
|
5463
|
+
const authConfigDetails = await Promise.all(
|
|
5464
|
+
serverConfig.map((config) => this.client.authConfigs.retrieve(config.authConfigId))
|
|
5465
|
+
);
|
|
5466
|
+
const toolkits = authConfigDetails.map((config) => config.toolkit.slug);
|
|
5267
5467
|
let mcpServerCreatedResponse;
|
|
5268
5468
|
try {
|
|
5269
5469
|
mcpServerCreatedResponse = await this.client.mcp.custom.create({
|
|
5270
5470
|
name,
|
|
5271
5471
|
toolkits,
|
|
5272
|
-
custom_tools:
|
|
5273
|
-
managed_auth_via_composio:
|
|
5274
|
-
auth_config_ids:
|
|
5472
|
+
custom_tools: serverConfig.flatMap((config) => config.allowedTools),
|
|
5473
|
+
managed_auth_via_composio: options.isChatAuth || false,
|
|
5474
|
+
auth_config_ids: serverConfig.map((config) => config.authConfigId)
|
|
5275
5475
|
});
|
|
5276
5476
|
} catch (error) {
|
|
5277
5477
|
throw new ValidationError("Failed to create MCP server", {
|
|
@@ -5289,53 +5489,200 @@ var MCP = class {
|
|
|
5289
5489
|
...camelCaseResponse,
|
|
5290
5490
|
toolkits,
|
|
5291
5491
|
getServer: async (params) => {
|
|
5292
|
-
return this.getServer(camelCaseResponse.id, params,
|
|
5492
|
+
return this.getServer(camelCaseResponse.id, params.userId || "", {
|
|
5493
|
+
isChatAuth: options.isChatAuth
|
|
5494
|
+
});
|
|
5293
5495
|
}
|
|
5294
5496
|
};
|
|
5295
5497
|
}
|
|
5296
5498
|
/**
|
|
5297
|
-
* Get
|
|
5298
|
-
*
|
|
5299
|
-
*
|
|
5300
|
-
*
|
|
5301
|
-
*
|
|
5499
|
+
* Get the connection status of a user for an MCP server
|
|
5500
|
+
*
|
|
5501
|
+
* Checks whether a user has the necessary connected accounts to use all toolkits
|
|
5502
|
+
* configured in the specified MCP server. Returns both overall connection status
|
|
5503
|
+
* and individual status for each toolkit.
|
|
5504
|
+
*
|
|
5505
|
+
* @param {Object} params - Parameters for checking connection status
|
|
5506
|
+
* @param {string} params.id - The UUID of the MCP server to check
|
|
5507
|
+
* @param {string} params.userId - The ID of the user to check connection status for
|
|
5508
|
+
* @returns {Promise<McpUserConnectionStatus>} Complete connection status including:
|
|
5509
|
+
* - `type`: Overall status (CONNECTED if all toolkits are connected, DISCONNECTED otherwise)
|
|
5510
|
+
* - `connected`: Boolean indicating if user can use the MCP server
|
|
5511
|
+
* - `connectedToolkits`: Record mapping each toolkit name to its individual connection status
|
|
5512
|
+
*
|
|
5513
|
+
* @throws {ValidationError} When MCP server has no toolkits configured
|
|
5514
|
+
* @throws {ValidationError} When MCP server retrieval fails
|
|
5515
|
+
*
|
|
5516
|
+
* @example
|
|
5517
|
+
* ```typescript
|
|
5518
|
+
* // Check if user can access an MCP server with Gmail and Slack toolkits
|
|
5519
|
+
* const connectionStatus = await composio.mcp.getUserConnectionStatus('user123', 'mcp-server-uuid');
|
|
5520
|
+
*
|
|
5521
|
+
* if (connectionStatus.connected) {
|
|
5522
|
+
* console.log('User can access all required toolkits');
|
|
5523
|
+
* // connectionStatus.type === ConnectionStatus.CONNECTED
|
|
5524
|
+
* } else {
|
|
5525
|
+
* console.log('User is missing some toolkit connections');
|
|
5526
|
+
* // Check individual toolkit statuses
|
|
5527
|
+
* Object.entries(connectionStatus.connectedToolkits).forEach(([toolkit, status]) => {
|
|
5528
|
+
* if (!status.connected) {
|
|
5529
|
+
* console.log(`Missing connection for toolkit: ${toolkit}`);
|
|
5530
|
+
* }
|
|
5531
|
+
* });
|
|
5532
|
+
* }
|
|
5533
|
+
* ```
|
|
5302
5534
|
*
|
|
5303
5535
|
* @example
|
|
5304
5536
|
* ```typescript
|
|
5305
|
-
* //
|
|
5306
|
-
*
|
|
5307
|
-
*
|
|
5308
|
-
*
|
|
5537
|
+
* // Example response when user has Gmail connected but missing Slack
|
|
5538
|
+
* {
|
|
5539
|
+
* type: ConnectionStatus.DISCONNECTED,
|
|
5540
|
+
* connected: false,
|
|
5541
|
+
* connectedToolkits: {
|
|
5542
|
+
* GMAIL: {
|
|
5543
|
+
* type: ConnectionStatus.CONNECTED,
|
|
5544
|
+
* connected: true,
|
|
5545
|
+
* toolkit: 'GMAIL',
|
|
5546
|
+
* connectedAccountId: 'conn_gmail_123'
|
|
5547
|
+
* },
|
|
5548
|
+
* SLACK: {
|
|
5549
|
+
* type: ConnectionStatus.DISCONNECTED,
|
|
5550
|
+
* connected: false,
|
|
5551
|
+
* toolkit: 'SLACK'
|
|
5552
|
+
* }
|
|
5309
5553
|
* }
|
|
5310
|
-
* }
|
|
5554
|
+
* }
|
|
5311
5555
|
* ```
|
|
5312
5556
|
*/
|
|
5313
|
-
async
|
|
5314
|
-
const serverDetails = await this.get(
|
|
5315
|
-
|
|
5316
|
-
|
|
5317
|
-
|
|
5318
|
-
cause: paramsResult.error
|
|
5557
|
+
async getUserConnectionStatus(userId, serverId) {
|
|
5558
|
+
const serverDetails = await this.get(serverId);
|
|
5559
|
+
if (!serverDetails.toolkits || serverDetails.toolkits.length === 0) {
|
|
5560
|
+
throw new ValidationError("MCP server has no toolkits configured", {
|
|
5561
|
+
meta: { serverId }
|
|
5319
5562
|
});
|
|
5320
5563
|
}
|
|
5321
|
-
const
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
5328
|
-
|
|
5329
|
-
|
|
5564
|
+
const connectedAccounts = await this.client.connectedAccounts.list({
|
|
5565
|
+
user_ids: [userId],
|
|
5566
|
+
toolkit_slugs: serverDetails.toolkits.map((toolkit) => toolkit.toLowerCase()),
|
|
5567
|
+
statuses: ["ACTIVE"]
|
|
5568
|
+
});
|
|
5569
|
+
const connectedAccountsByToolkit = /* @__PURE__ */ new Map();
|
|
5570
|
+
connectedAccounts.items?.forEach((account) => {
|
|
5571
|
+
connectedAccountsByToolkit.set(account.toolkit.slug.toLowerCase(), account.id);
|
|
5572
|
+
});
|
|
5573
|
+
const connectedToolkits = {};
|
|
5574
|
+
let allToolkitsConnected = true;
|
|
5575
|
+
for (const toolkit of serverDetails.toolkits) {
|
|
5576
|
+
const connectedAccountId = connectedAccountsByToolkit.get(toolkit.toLowerCase());
|
|
5577
|
+
if (connectedAccountId) {
|
|
5578
|
+
connectedToolkits[toolkit] = {
|
|
5579
|
+
type: "CONNECTED" /* CONNECTED */,
|
|
5580
|
+
connected: true,
|
|
5581
|
+
toolkit,
|
|
5582
|
+
connectedAccountId
|
|
5583
|
+
};
|
|
5584
|
+
} else {
|
|
5585
|
+
connectedToolkits[toolkit] = {
|
|
5586
|
+
type: "DISCONNECTED" /* DISCONNECTED */,
|
|
5587
|
+
connected: false,
|
|
5588
|
+
toolkit
|
|
5589
|
+
};
|
|
5590
|
+
allToolkitsConnected = false;
|
|
5330
5591
|
}
|
|
5331
5592
|
}
|
|
5593
|
+
if (allToolkitsConnected) {
|
|
5594
|
+
return {
|
|
5595
|
+
type: "CONNECTED" /* CONNECTED */,
|
|
5596
|
+
connected: true,
|
|
5597
|
+
connectedToolkits
|
|
5598
|
+
};
|
|
5599
|
+
} else {
|
|
5600
|
+
return {
|
|
5601
|
+
type: "DISCONNECTED" /* DISCONNECTED */,
|
|
5602
|
+
connected: false,
|
|
5603
|
+
connectedToolkits
|
|
5604
|
+
};
|
|
5605
|
+
}
|
|
5606
|
+
}
|
|
5607
|
+
/**
|
|
5608
|
+
* Get the connection parameters for a toolkit
|
|
5609
|
+
* @param {string} serverId - The UUID of the MCP server
|
|
5610
|
+
* @param {string} toolkit - The toolkit to get connection parameters for
|
|
5611
|
+
* @returns {Promise<ToolkitAuthFieldsResponse>} Connection parameters for the toolkit
|
|
5612
|
+
*/
|
|
5613
|
+
async getConnectionParams(serverId, toolkit) {
|
|
5614
|
+
const mcpServerDetails = await this.get(serverId);
|
|
5615
|
+
const authConfigs = mcpServerDetails.authConfigIds ? await Promise.all(
|
|
5616
|
+
mcpServerDetails.authConfigIds.map((id) => this.client.authConfigs.retrieve(id))
|
|
5617
|
+
) : [];
|
|
5618
|
+
const authConfig = authConfigs.find((config) => config.toolkit.slug === toolkit);
|
|
5619
|
+
if (!authConfig) {
|
|
5620
|
+
throw new ValidationError("Auth config not found", {
|
|
5621
|
+
meta: { serverId, toolkit }
|
|
5622
|
+
});
|
|
5623
|
+
}
|
|
5624
|
+
const connectionParams = await this.toolkits.getConnectedAccountInitiationFields(
|
|
5625
|
+
toolkit,
|
|
5626
|
+
authConfig.auth_scheme
|
|
5627
|
+
);
|
|
5628
|
+
return connectionParams;
|
|
5629
|
+
}
|
|
5630
|
+
/**
|
|
5631
|
+
* Authorize a user for a toolkit
|
|
5632
|
+
* @param {string} serverId - The UUID of the MCP server
|
|
5633
|
+
* @param {string} userId - The ID of the user to authorize
|
|
5634
|
+
* @param {string} toolkit - The toolkit to authorize
|
|
5635
|
+
* @returns {Promise<ConnectionRequest>} Connection request for the toolkit
|
|
5636
|
+
*/
|
|
5637
|
+
async authorize(userId, serverId, toolkit) {
|
|
5638
|
+
const mcpServerDetails = await this.get(serverId);
|
|
5639
|
+
const authConfigId = mcpServerDetails.authConfigIds?.[0];
|
|
5640
|
+
return this.toolkits.authorize(userId, toolkit, authConfigId);
|
|
5641
|
+
}
|
|
5642
|
+
/**
|
|
5643
|
+
* Get server URLs for an existing MCP server
|
|
5644
|
+
* @param {string} serverId - Server UUID
|
|
5645
|
+
* @param {string} userId - User ID to get server URLs for
|
|
5646
|
+
* @param {Object} [options] - Additional options for server configuration
|
|
5647
|
+
* @param {string[]} [options.limitTools] - Subset of tools to limit (from MCP config)
|
|
5648
|
+
* @param {boolean} [options.isChatAuth] - Whether to use chat-based authentication
|
|
5649
|
+
* @returns {Promise<T>} Transformed server URLs in provider-specific format
|
|
5650
|
+
*
|
|
5651
|
+
* @example
|
|
5652
|
+
* ```typescript
|
|
5653
|
+
* // Get URLs for an existing server with basic user ID
|
|
5654
|
+
* const urls = await composio.mcp.getServer("mcp_xyz", "hey@example.com");
|
|
5655
|
+
*
|
|
5656
|
+
* // Get URLs with additional options
|
|
5657
|
+
* const urls = await composio.mcp.getServer("mcp_xyz", "hey@example.com", {
|
|
5658
|
+
* limitTools: ["GMAIL_FETCH_EMAILS", "SLACK_SEND_MESSAGE"],
|
|
5659
|
+
* isChatAuth: true
|
|
5660
|
+
* });
|
|
5661
|
+
* ```
|
|
5662
|
+
*/
|
|
5663
|
+
async getServer(serverId, userId, options) {
|
|
5664
|
+
const serverDetails = await this.get(serverId);
|
|
5665
|
+
if (!userId) {
|
|
5666
|
+
throw new ValidationError("User ID is required", {});
|
|
5667
|
+
}
|
|
5668
|
+
const toolkits = serverDetails.toolkits || [];
|
|
5669
|
+
const connectedAccountIds = (await Promise.all(
|
|
5670
|
+
toolkits.map(
|
|
5671
|
+
(toolkit) => this.client.connectedAccounts.list({
|
|
5672
|
+
user_ids: [userId],
|
|
5673
|
+
toolkit_slugs: [toolkit],
|
|
5674
|
+
statuses: ["ACTIVE"]
|
|
5675
|
+
}).then((res) => res.items?.[0]?.id)
|
|
5676
|
+
)
|
|
5677
|
+
)).filter(Boolean);
|
|
5332
5678
|
let data;
|
|
5333
5679
|
try {
|
|
5334
5680
|
data = await this.client.mcp.generate.url({
|
|
5335
|
-
user_ids:
|
|
5336
|
-
|
|
5337
|
-
|
|
5338
|
-
|
|
5681
|
+
user_ids: [userId],
|
|
5682
|
+
// @TODO(utkarsh-dixit): Add support for this later
|
|
5683
|
+
connected_account_ids: [],
|
|
5684
|
+
mcp_server_id: serverId,
|
|
5685
|
+
managed_auth_by_composio: options?.isChatAuth ?? serverDetails.managedAuthViaComposio ?? false
|
|
5339
5686
|
});
|
|
5340
5687
|
} catch (error) {
|
|
5341
5688
|
throw new ValidationError("Failed to generate MCP server URL", {
|
|
@@ -5352,9 +5699,9 @@ var MCP = class {
|
|
|
5352
5699
|
return this.wrapMcpServerResponse(
|
|
5353
5700
|
camelCaseData,
|
|
5354
5701
|
serverDetails.name,
|
|
5355
|
-
|
|
5356
|
-
|
|
5357
|
-
|
|
5702
|
+
connectedAccountIds,
|
|
5703
|
+
[userId],
|
|
5704
|
+
toolkits
|
|
5358
5705
|
);
|
|
5359
5706
|
}
|
|
5360
5707
|
/**
|
|
@@ -5389,8 +5736,8 @@ var MCP = class {
|
|
|
5389
5736
|
listResponse = await this.client.mcp.list({
|
|
5390
5737
|
page_no: options.page || 1,
|
|
5391
5738
|
limit: options.limit || 10,
|
|
5392
|
-
toolkits: options?.toolkits?.join(",") ||
|
|
5393
|
-
auth_config_ids: options?.authConfigs?.join(",") ||
|
|
5739
|
+
toolkits: options?.toolkits?.join(",") || void 0,
|
|
5740
|
+
auth_config_ids: options?.authConfigs?.join(",") || void 0,
|
|
5394
5741
|
name: options?.name
|
|
5395
5742
|
});
|
|
5396
5743
|
} catch (error) {
|
|
@@ -5408,7 +5755,7 @@ var MCP = class {
|
|
|
5408
5755
|
}
|
|
5409
5756
|
/**
|
|
5410
5757
|
* Get details of a specific MCP server
|
|
5411
|
-
* @param {string}
|
|
5758
|
+
* @param {string} serverId - Server UUID
|
|
5412
5759
|
* @returns {Promise<McpRetrieveResponse>} Server details
|
|
5413
5760
|
*
|
|
5414
5761
|
* @example
|
|
@@ -5416,16 +5763,19 @@ var MCP = class {
|
|
|
5416
5763
|
* const serverDetails = await composio.mcp.get('server-uuid');
|
|
5417
5764
|
* ```
|
|
5418
5765
|
*/
|
|
5419
|
-
async get(
|
|
5766
|
+
async get(serverId) {
|
|
5420
5767
|
let retrieveResponse;
|
|
5421
5768
|
try {
|
|
5422
|
-
retrieveResponse = await this.client.mcp.retrieve(
|
|
5769
|
+
retrieveResponse = await this.client.mcp.retrieve(serverId);
|
|
5423
5770
|
} catch (error) {
|
|
5424
5771
|
throw new ValidationError("Failed to retrieve MCP server", {
|
|
5425
5772
|
cause: error
|
|
5426
5773
|
});
|
|
5427
5774
|
}
|
|
5428
|
-
const retrieveResponseResult = McpRetrieveResponseSchema.safeParse(
|
|
5775
|
+
const retrieveResponseResult = McpRetrieveResponseSchema.safeParse({
|
|
5776
|
+
...retrieveResponse,
|
|
5777
|
+
mcpUrl: retrieveResponse.mcp_url
|
|
5778
|
+
});
|
|
5429
5779
|
if (retrieveResponseResult.error) {
|
|
5430
5780
|
throw new ValidationError("Failed to parse MCP server retrieve response", {
|
|
5431
5781
|
cause: retrieveResponseResult.error
|
|
@@ -5435,7 +5785,7 @@ var MCP = class {
|
|
|
5435
5785
|
}
|
|
5436
5786
|
/**
|
|
5437
5787
|
* Delete an MCP server
|
|
5438
|
-
* @param {string}
|
|
5788
|
+
* @param {string} serverId - Server UUID
|
|
5439
5789
|
* @returns {Promise<McpDeleteResponse>} Deletion response
|
|
5440
5790
|
*
|
|
5441
5791
|
* @example
|
|
@@ -5443,10 +5793,10 @@ var MCP = class {
|
|
|
5443
5793
|
* const result = await composio.mcp.delete('server-uuid');
|
|
5444
5794
|
* ```
|
|
5445
5795
|
*/
|
|
5446
|
-
async delete(
|
|
5796
|
+
async delete(serverId) {
|
|
5447
5797
|
let deleteResponse;
|
|
5448
5798
|
try {
|
|
5449
|
-
deleteResponse = await this.client.mcp.delete(
|
|
5799
|
+
deleteResponse = await this.client.mcp.delete(serverId);
|
|
5450
5800
|
} catch (error) {
|
|
5451
5801
|
throw new ValidationError("Failed to delete MCP server", {
|
|
5452
5802
|
cause: error
|
|
@@ -5481,21 +5831,21 @@ var MCP = class {
|
|
|
5481
5831
|
* },
|
|
5482
5832
|
* ],
|
|
5483
5833
|
* {
|
|
5484
|
-
*
|
|
5834
|
+
* isChatAuth: true,
|
|
5485
5835
|
* }
|
|
5486
5836
|
* );
|
|
5487
5837
|
* ```
|
|
5488
5838
|
*/
|
|
5489
|
-
async update(
|
|
5839
|
+
async update(serverId, name, toolkitConfigs, authOptions) {
|
|
5490
5840
|
this.validateInputs(toolkitConfigs, authOptions);
|
|
5491
5841
|
const toolkits = toolkitConfigs.map((config) => config.toolkit);
|
|
5492
5842
|
let updateResponse;
|
|
5493
5843
|
try {
|
|
5494
|
-
updateResponse = await this.client.mcp.update(
|
|
5844
|
+
updateResponse = await this.client.mcp.update(serverId, {
|
|
5495
5845
|
name,
|
|
5496
5846
|
toolkits,
|
|
5497
5847
|
allowed_tools: toolkitConfigs.flatMap((config) => config.allowedTools),
|
|
5498
|
-
managed_auth_via_composio: authOptions?.
|
|
5848
|
+
managed_auth_via_composio: authOptions?.isChatAuth || false
|
|
5499
5849
|
});
|
|
5500
5850
|
} catch (error) {
|
|
5501
5851
|
throw new ValidationError("Failed to update MCP server", {
|
|
@@ -5512,20 +5862,20 @@ var MCP = class {
|
|
|
5512
5862
|
}
|
|
5513
5863
|
/**
|
|
5514
5864
|
* Generate URL for an MCP server
|
|
5865
|
+
* @param {string} serverId - Server UUID
|
|
5515
5866
|
* @param {GenerateURLParams} params - Parameters for URL generation
|
|
5516
5867
|
* @returns {Promise<GenerateURLResponse>} Generated URL response
|
|
5517
5868
|
*
|
|
5518
5869
|
* @example
|
|
5519
5870
|
* ```typescript
|
|
5520
|
-
* const urlResponse = await composio.mcp.generateUrl({
|
|
5871
|
+
* const urlResponse = await composio.mcp.generateUrl('server-uuid', {
|
|
5521
5872
|
* userIds: ['user123'],
|
|
5522
5873
|
* connectedAccountIds: ['account456'],
|
|
5523
|
-
*
|
|
5524
|
-
* composioManagedAuth: true
|
|
5874
|
+
* isChatAuth: true
|
|
5525
5875
|
* });
|
|
5526
5876
|
* ```
|
|
5527
5877
|
*/
|
|
5528
|
-
async generateUrl(params) {
|
|
5878
|
+
async generateUrl(serverId, params) {
|
|
5529
5879
|
const paramsResult = GenerateURLParamsSchema.safeParse(params);
|
|
5530
5880
|
if (paramsResult.error) {
|
|
5531
5881
|
throw new ValidationError("Failed to parse generateUrl parameters", {
|
|
@@ -5535,7 +5885,7 @@ var MCP = class {
|
|
|
5535
5885
|
let urlResponse;
|
|
5536
5886
|
try {
|
|
5537
5887
|
urlResponse = await this.client.mcp.generate.url({
|
|
5538
|
-
mcp_server_id:
|
|
5888
|
+
mcp_server_id: serverId,
|
|
5539
5889
|
user_ids: params.userIds,
|
|
5540
5890
|
connected_account_ids: params.connectedAccountIds,
|
|
5541
5891
|
managed_auth_by_composio: params.composioManagedAuth
|
|
@@ -5605,6 +5955,48 @@ var MCP = class {
|
|
|
5605
5955
|
name: serverName
|
|
5606
5956
|
};
|
|
5607
5957
|
}
|
|
5958
|
+
/**
|
|
5959
|
+
* Get details of a specific MCP server by name
|
|
5960
|
+
* @param {string} name - Server name
|
|
5961
|
+
* @returns {Promise<McpRetrieveResponse>} Server details
|
|
5962
|
+
* @throws {ValidationError} If no server found with the given name
|
|
5963
|
+
* @throws {ValidationError} If multiple servers found with the same name
|
|
5964
|
+
*
|
|
5965
|
+
* @example
|
|
5966
|
+
* ```typescript
|
|
5967
|
+
* const serverDetails = await composio.mcp.getByName('my-gmail-server');
|
|
5968
|
+
* ```
|
|
5969
|
+
*/
|
|
5970
|
+
async getByName(serverName) {
|
|
5971
|
+
if (!serverName) {
|
|
5972
|
+
throw new ValidationError("Server name is required", {});
|
|
5973
|
+
}
|
|
5974
|
+
let listResponse;
|
|
5975
|
+
try {
|
|
5976
|
+
listResponse = await this.client.mcp.list({
|
|
5977
|
+
name: serverName,
|
|
5978
|
+
limit: 10
|
|
5979
|
+
});
|
|
5980
|
+
} catch (error) {
|
|
5981
|
+
console.error(error);
|
|
5982
|
+
throw new ValidationError("Failed to search MCP servers by name", {
|
|
5983
|
+
cause: error
|
|
5984
|
+
});
|
|
5985
|
+
}
|
|
5986
|
+
const listResponseResult = ComposioMcpListResponseSchema.safeParse(listResponse);
|
|
5987
|
+
if (listResponseResult.error) {
|
|
5988
|
+
throw new ValidationError("Failed to parse MCP server list response", {
|
|
5989
|
+
cause: listResponseResult.error
|
|
5990
|
+
});
|
|
5991
|
+
}
|
|
5992
|
+
const servers = listResponse.items || [];
|
|
5993
|
+
if (servers.length === 0) {
|
|
5994
|
+
throw new ValidationError(`MCP server with name '${serverName}' not found`, {
|
|
5995
|
+
meta: { serverName }
|
|
5996
|
+
});
|
|
5997
|
+
}
|
|
5998
|
+
return this.get(servers[0].id);
|
|
5999
|
+
}
|
|
5608
6000
|
};
|
|
5609
6001
|
|
|
5610
6002
|
// src/utils/sdk.ts
|
|
@@ -5863,6 +6255,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
5863
6255
|
arguments: JSON.parse(tool.function.arguments),
|
|
5864
6256
|
connectedAccountId: options?.connectedAccountId,
|
|
5865
6257
|
customAuthParams: options?.customAuthParams,
|
|
6258
|
+
customConnectionData: options?.customConnectionData,
|
|
5866
6259
|
userId
|
|
5867
6260
|
};
|
|
5868
6261
|
const result = await this.executeTool(tool.function.name, payload, modifiers);
|
|
@@ -6144,7 +6537,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
6144
6537
|
};
|
|
6145
6538
|
|
|
6146
6539
|
// package.json
|
|
6147
|
-
var version = "0.1.36
|
|
6540
|
+
var version = "0.1.36";
|
|
6148
6541
|
|
|
6149
6542
|
// src/models/Files.ts
|
|
6150
6543
|
var Files = class {
|
|
@@ -6587,6 +6980,7 @@ var AuthScheme = class {
|
|
|
6587
6980
|
ConnectionRequestErrorCodes,
|
|
6588
6981
|
ConnectionRequestFailedError,
|
|
6589
6982
|
ConnectionRequestTimeoutError,
|
|
6983
|
+
ConnectionStatus,
|
|
6590
6984
|
ConnectionStatuses,
|
|
6591
6985
|
CreateAuthConfigParamsSchema,
|
|
6592
6986
|
CreateAuthConfigResponseSchema,
|
|
@@ -6596,7 +6990,10 @@ var AuthScheme = class {
|
|
|
6596
6990
|
CreateConnectedAccountResponseSchema,
|
|
6597
6991
|
CreateCustomAuthConfigParamsSchema,
|
|
6598
6992
|
CustomAuthParamsSchema,
|
|
6993
|
+
CustomConnectionDataSchema,
|
|
6599
6994
|
CustomCreateResponseSchema,
|
|
6995
|
+
CustomOauth1ConnectionDataSchema,
|
|
6996
|
+
CustomOauth2ConnectionDataSchema,
|
|
6600
6997
|
DefaultCreateConnectedAccountParamsSchema,
|
|
6601
6998
|
GenerateURLParamsSchema,
|
|
6602
6999
|
GenerateURLResponseSchema,
|
|
@@ -6623,12 +7020,14 @@ var AuthScheme = class {
|
|
|
6623
7020
|
Oauth1ConnectionDataSchema,
|
|
6624
7021
|
Oauth1ExpiredConnectionDataSchema,
|
|
6625
7022
|
Oauth1FailedConnectionDataSchema,
|
|
7023
|
+
Oauth1InactiveConnectionDataSchema,
|
|
6626
7024
|
Oauth1InitiatedConnectionDataSchema,
|
|
6627
7025
|
Oauth1InitiatingConnectionDataSchema,
|
|
6628
7026
|
Oauth2ActiveConnectionDataSchema,
|
|
6629
7027
|
Oauth2ConnectionDataSchema,
|
|
6630
7028
|
Oauth2ExpiredConnectionDataSchema,
|
|
6631
7029
|
Oauth2FailedConnectionDataSchema,
|
|
7030
|
+
Oauth2InactiveConnectionDataSchema,
|
|
6632
7031
|
Oauth2InitiatedConnectionDataSchema,
|
|
6633
7032
|
Oauth2InitiatingConnectionDataSchema,
|
|
6634
7033
|
OpenAIProvider,
|