@composio/core 0.1.36-next.8 → 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 +1340 -939
- package/dist/index.d.cts +43534 -11955
- package/dist/index.d.ts +43534 -11955
- package/dist/index.js +1328 -933
- 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(),
|
|
@@ -1706,7 +1893,7 @@ var ConnectedAccountRetrieveResponseSchema = import_zod6.z.object({
|
|
|
1706
1893
|
});
|
|
1707
1894
|
var ConnectedAccountListParamsSchema = import_zod6.z.object({
|
|
1708
1895
|
authConfigIds: import_zod6.z.array(import_zod6.z.string()).nullable().optional().describe("The auth config ids of the connected accounts"),
|
|
1709
|
-
cursor: import_zod6.z.
|
|
1896
|
+
cursor: import_zod6.z.string().nullish().describe("The cursor to paginate through the connected accounts"),
|
|
1710
1897
|
labels: import_zod6.z.array(import_zod6.z.string()).nullable().optional().describe("The labels of the connected accounts"),
|
|
1711
1898
|
limit: import_zod6.z.number().nullable().optional().describe("The limit of the connected accounts to return"),
|
|
1712
1899
|
orderBy: import_zod6.z.enum(["created_at", "updated_at"]).optional().describe("The order by of the connected accounts"),
|
|
@@ -1716,36 +1903,55 @@ var ConnectedAccountListParamsSchema = import_zod6.z.object({
|
|
|
1716
1903
|
});
|
|
1717
1904
|
var ConnectedAccountListResponseSchema = import_zod6.z.object({
|
|
1718
1905
|
items: import_zod6.z.array(ConnectedAccountRetrieveResponseSchema).describe("The list of connected accounts"),
|
|
1719
|
-
nextCursor: import_zod6.z.string().
|
|
1906
|
+
nextCursor: import_zod6.z.string().nullish().describe("The next cursor to paginate through the connected accounts"),
|
|
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,45 +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 result = AuthConfigRetrieveResponseSchema.safeParse({
|
|
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
|
-
if (result.error) {
|
|
3156
|
-
throw new ValidationError("Failed to parse auth config response", {
|
|
3157
|
-
cause: result.error
|
|
3158
|
-
});
|
|
3159
|
-
}
|
|
3160
|
-
return result.data;
|
|
3161
|
-
}
|
|
3162
3370
|
/**
|
|
3163
3371
|
* Lists authentication configurations based on provided filter criteria.
|
|
3164
3372
|
*
|
|
@@ -3193,17 +3401,7 @@ var AuthConfigs = class {
|
|
|
3193
3401
|
limit: parsedQuery?.limit,
|
|
3194
3402
|
toolkit_slug: parsedQuery?.toolkit
|
|
3195
3403
|
});
|
|
3196
|
-
|
|
3197
|
-
items: result.items.map((item) => this.parseAuthConfigRetrieveResponse(item)),
|
|
3198
|
-
nextCursor: result.next_cursor,
|
|
3199
|
-
totalPages: result.total_pages
|
|
3200
|
-
});
|
|
3201
|
-
if (parsedResult.error) {
|
|
3202
|
-
throw new ValidationError("Failed to parse auth config list response", {
|
|
3203
|
-
cause: parsedResult.error
|
|
3204
|
-
});
|
|
3205
|
-
}
|
|
3206
|
-
return parsedResult.data;
|
|
3404
|
+
return transformAuthConfigListResponse(result);
|
|
3207
3405
|
}
|
|
3208
3406
|
/**
|
|
3209
3407
|
* Create a new auth config
|
|
@@ -3239,26 +3437,19 @@ var AuthConfigs = class {
|
|
|
3239
3437
|
name: parsedOptions.data.name,
|
|
3240
3438
|
authScheme: parsedOptions.data.authScheme,
|
|
3241
3439
|
credentials: parsedOptions.data.credentials,
|
|
3242
|
-
|
|
3440
|
+
tool_access_config: {
|
|
3441
|
+
tools_for_connected_account_creation: parsedOptions.data.restrictToFollowingTools
|
|
3442
|
+
}
|
|
3243
3443
|
} : {
|
|
3244
3444
|
type: parsedOptions.data.type,
|
|
3245
3445
|
credentials: parsedOptions.data.credentials,
|
|
3246
3446
|
name: parsedOptions.data.name,
|
|
3247
|
-
|
|
3447
|
+
tool_access_config: {
|
|
3448
|
+
tools_for_connected_account_creation: parsedOptions.data.restrictToFollowingTools
|
|
3449
|
+
}
|
|
3248
3450
|
}
|
|
3249
3451
|
});
|
|
3250
|
-
|
|
3251
|
-
id: result.auth_config.id,
|
|
3252
|
-
authScheme: result.auth_config.auth_scheme,
|
|
3253
|
-
isComposioManaged: result.auth_config.is_composio_managed,
|
|
3254
|
-
toolkit: result.toolkit.slug
|
|
3255
|
-
});
|
|
3256
|
-
if (parsedResult.error) {
|
|
3257
|
-
throw new ValidationError("Failed to parse auth config create response", {
|
|
3258
|
-
cause: parsedResult.error
|
|
3259
|
-
});
|
|
3260
|
-
}
|
|
3261
|
-
return parsedResult.data;
|
|
3452
|
+
return transformCreateAuthConfigResponse(result);
|
|
3262
3453
|
}
|
|
3263
3454
|
/**
|
|
3264
3455
|
* Retrieves a specific authentication configuration by its ID.
|
|
@@ -3281,7 +3472,7 @@ var AuthConfigs = class {
|
|
|
3281
3472
|
*/
|
|
3282
3473
|
async get(nanoid) {
|
|
3283
3474
|
const result = await this.client.authConfigs.retrieve(nanoid);
|
|
3284
|
-
return
|
|
3475
|
+
return transformAuthConfigRetrieveResponse(result);
|
|
3285
3476
|
}
|
|
3286
3477
|
/**
|
|
3287
3478
|
* Updates an existing authentication configuration.
|
|
@@ -3325,11 +3516,15 @@ var AuthConfigs = class {
|
|
|
3325
3516
|
parsedData.data.type === "custom" ? {
|
|
3326
3517
|
type: "custom",
|
|
3327
3518
|
credentials: parsedData.data.credentials,
|
|
3328
|
-
|
|
3519
|
+
tool_access_config: {
|
|
3520
|
+
tools_for_connected_account_creation: parsedData.data.restrictToFollowingTools
|
|
3521
|
+
}
|
|
3329
3522
|
} : {
|
|
3330
3523
|
type: "default",
|
|
3331
3524
|
scopes: parsedData.data.scopes,
|
|
3332
|
-
|
|
3525
|
+
tool_access_config: {
|
|
3526
|
+
tools_for_connected_account_creation: parsedData.data.restrictToFollowingTools
|
|
3527
|
+
}
|
|
3333
3528
|
}
|
|
3334
3529
|
);
|
|
3335
3530
|
}
|
|
@@ -3541,17 +3736,7 @@ var ConnectedAccounts = class {
|
|
|
3541
3736
|
};
|
|
3542
3737
|
}
|
|
3543
3738
|
const result = await this.client.connectedAccounts.list(rawQuery);
|
|
3544
|
-
|
|
3545
|
-
items: result.items.map(transformConnectedAccountResponse),
|
|
3546
|
-
nextCursor: result.next_cursor,
|
|
3547
|
-
totalPages: result.total_pages
|
|
3548
|
-
});
|
|
3549
|
-
if (!parsedResponse.success) {
|
|
3550
|
-
throw new ValidationError("Failed to parse connected account list response", {
|
|
3551
|
-
cause: parsedResponse.error
|
|
3552
|
-
});
|
|
3553
|
-
}
|
|
3554
|
-
return parsedResponse.data;
|
|
3739
|
+
return transformConnectedAccountListResponse(result);
|
|
3555
3740
|
}
|
|
3556
3741
|
/**
|
|
3557
3742
|
* Compound function to create a new connected account.
|
|
@@ -3787,6 +3972,77 @@ var ConnectedAccounts = class {
|
|
|
3787
3972
|
|
|
3788
3973
|
// src/models/Toolkits.ts
|
|
3789
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
|
|
3790
4046
|
var Toolkits = class {
|
|
3791
4047
|
client;
|
|
3792
4048
|
constructor(client) {
|
|
@@ -3819,40 +4075,7 @@ var Toolkits = class {
|
|
|
3819
4075
|
managed_by: parsedQuery.data.managedBy,
|
|
3820
4076
|
sort_by: parsedQuery.data.sortBy
|
|
3821
4077
|
});
|
|
3822
|
-
|
|
3823
|
-
result.items.map((item) => {
|
|
3824
|
-
const parsedItem = ToolKitItemSchema.safeParse({
|
|
3825
|
-
name: item.name,
|
|
3826
|
-
slug: item.slug,
|
|
3827
|
-
meta: {
|
|
3828
|
-
...item.meta,
|
|
3829
|
-
createdAt: item.meta.created_at,
|
|
3830
|
-
updatedAt: item.meta.updated_at,
|
|
3831
|
-
toolsCount: item.meta.tools_count,
|
|
3832
|
-
triggersCount: item.meta.triggers_count,
|
|
3833
|
-
categories: item.meta.categories,
|
|
3834
|
-
appUrl: item.meta.app_url,
|
|
3835
|
-
logo: item.meta.logo
|
|
3836
|
-
},
|
|
3837
|
-
isLocalToolkit: item.is_local_toolkit,
|
|
3838
|
-
authSchemes: item.auth_schemes,
|
|
3839
|
-
composioManagedAuthSchemes: item.composio_managed_auth_schemes,
|
|
3840
|
-
noAuth: item.no_auth
|
|
3841
|
-
});
|
|
3842
|
-
if (!parsedItem.success) {
|
|
3843
|
-
throw new ValidationError("Failed to parse toolkit response", {
|
|
3844
|
-
cause: parsedItem.error
|
|
3845
|
-
});
|
|
3846
|
-
}
|
|
3847
|
-
return parsedItem.data;
|
|
3848
|
-
})
|
|
3849
|
-
);
|
|
3850
|
-
if (!parsedResult.success) {
|
|
3851
|
-
throw new ValidationError("Failed to parse toolkit list response", {
|
|
3852
|
-
cause: parsedResult.error
|
|
3853
|
-
});
|
|
3854
|
-
}
|
|
3855
|
-
return parsedResult.data;
|
|
4078
|
+
return transformToolkitListResponse(result);
|
|
3856
4079
|
} catch (error) {
|
|
3857
4080
|
throw new ComposioToolkitFetchError("Failed to fetch toolkits", {
|
|
3858
4081
|
cause: error
|
|
@@ -3875,37 +4098,7 @@ var Toolkits = class {
|
|
|
3875
4098
|
async getToolkitBySlug(slug) {
|
|
3876
4099
|
try {
|
|
3877
4100
|
const result = await this.client.toolkits.retrieve(slug);
|
|
3878
|
-
|
|
3879
|
-
name: result.name,
|
|
3880
|
-
slug: result.slug,
|
|
3881
|
-
meta: {
|
|
3882
|
-
...result.meta,
|
|
3883
|
-
createdAt: result.meta.created_at,
|
|
3884
|
-
updatedAt: result.meta.updated_at,
|
|
3885
|
-
toolsCount: result.meta.tools_count,
|
|
3886
|
-
triggersCount: result.meta.triggers_count
|
|
3887
|
-
// appUrl: result.meta.app_url, @TODO Update the client type to include this
|
|
3888
|
-
},
|
|
3889
|
-
isLocalToolkit: result.is_local_toolkit,
|
|
3890
|
-
composioManagedAuthSchemes: result.composio_managed_auth_schemes,
|
|
3891
|
-
authConfigDetails: result.auth_config_details?.map((authConfig) => ({
|
|
3892
|
-
name: authConfig.name,
|
|
3893
|
-
mode: authConfig.mode,
|
|
3894
|
-
fields: {
|
|
3895
|
-
authConfigCreation: authConfig.fields.auth_config_creation,
|
|
3896
|
-
connectedAccountInitiation: authConfig.fields.connected_account_initiation
|
|
3897
|
-
},
|
|
3898
|
-
proxy: {
|
|
3899
|
-
baseUrl: authConfig.proxy?.base_url
|
|
3900
|
-
}
|
|
3901
|
-
}))
|
|
3902
|
-
});
|
|
3903
|
-
if (!parsedResult.success) {
|
|
3904
|
-
throw new ValidationError("Failed to parse toolkit response", {
|
|
3905
|
-
cause: parsedResult.error
|
|
3906
|
-
});
|
|
3907
|
-
}
|
|
3908
|
-
return parsedResult.data;
|
|
4101
|
+
return transformToolkitRetrieveResponse(result);
|
|
3909
4102
|
} catch (error) {
|
|
3910
4103
|
if (error instanceof import_openai.APIError && (error.status === 404 || error.status === 400)) {
|
|
3911
4104
|
throw new ComposioToolkitNotFoundError(`Toolkit with slug ${slug} not found`, {
|
|
@@ -3933,7 +4126,7 @@ var Toolkits = class {
|
|
|
3933
4126
|
if (typeof arg === "string") {
|
|
3934
4127
|
return this.getToolkitBySlug(arg);
|
|
3935
4128
|
}
|
|
3936
|
-
return this.getToolkits(arg);
|
|
4129
|
+
return this.getToolkits(arg ?? {});
|
|
3937
4130
|
}
|
|
3938
4131
|
async getAuthConfigFields(toolkitSlug, authScheme, authConfigType, requiredOnly) {
|
|
3939
4132
|
const toolkit = await this.getToolkitBySlug(toolkitSlug);
|
|
@@ -4026,23 +4219,7 @@ var Toolkits = class {
|
|
|
4026
4219
|
*/
|
|
4027
4220
|
async listCategories() {
|
|
4028
4221
|
const result = await this.client.toolkits.retrieveCategories();
|
|
4029
|
-
|
|
4030
|
-
items: result.items.map((item) => {
|
|
4031
|
-
const parsedItem = ToolkitCategorySchema.parse({
|
|
4032
|
-
id: item.id,
|
|
4033
|
-
name: item.name
|
|
4034
|
-
});
|
|
4035
|
-
return parsedItem;
|
|
4036
|
-
}),
|
|
4037
|
-
nextCursor: result.next_cursor,
|
|
4038
|
-
totalPages: result.total_pages
|
|
4039
|
-
});
|
|
4040
|
-
if (!parsedResult.success) {
|
|
4041
|
-
throw new ValidationError("Failed to parse toolkit categories response", {
|
|
4042
|
-
cause: parsedResult.error
|
|
4043
|
-
});
|
|
4044
|
-
}
|
|
4045
|
-
return parsedResult.data;
|
|
4222
|
+
return transformToolkitRetrieveCategoriesResponse(result);
|
|
4046
4223
|
}
|
|
4047
4224
|
/**
|
|
4048
4225
|
* Authorizes a user to use a toolkit.
|
|
@@ -4056,22 +4233,24 @@ var Toolkits = class {
|
|
|
4056
4233
|
* const connectionRequest = await composio.toolkits.authorize(userId, 'github');
|
|
4057
4234
|
* ```
|
|
4058
4235
|
*/
|
|
4059
|
-
async authorize(userId, toolkitSlug) {
|
|
4236
|
+
async authorize(userId, toolkitSlug, authConfigId) {
|
|
4060
4237
|
const toolkit = await this.getToolkitBySlug(toolkitSlug);
|
|
4061
4238
|
const composioAuthConfig = new AuthConfigs(this.client);
|
|
4062
|
-
let authConfigIdToUse;
|
|
4063
|
-
|
|
4064
|
-
|
|
4065
|
-
|
|
4066
|
-
|
|
4239
|
+
let authConfigIdToUse = authConfigId;
|
|
4240
|
+
if (!authConfigIdToUse) {
|
|
4241
|
+
const authConfig = await composioAuthConfig.list({
|
|
4242
|
+
toolkit: toolkitSlug
|
|
4243
|
+
});
|
|
4244
|
+
authConfigIdToUse = authConfig.items[0]?.id;
|
|
4245
|
+
}
|
|
4067
4246
|
if (!authConfigIdToUse) {
|
|
4068
4247
|
if (toolkit.authConfigDetails && toolkit.authConfigDetails.length > 0) {
|
|
4069
4248
|
try {
|
|
4070
|
-
const
|
|
4249
|
+
const authConfig = await composioAuthConfig.create(toolkitSlug, {
|
|
4071
4250
|
type: "use_composio_managed_auth",
|
|
4072
4251
|
name: `${toolkit.name} Auth Config`
|
|
4073
4252
|
});
|
|
4074
|
-
authConfigIdToUse =
|
|
4253
|
+
authConfigIdToUse = authConfig.id;
|
|
4075
4254
|
} catch (error) {
|
|
4076
4255
|
if (error instanceof import_client4.default.APIError && error.status === 400) {
|
|
4077
4256
|
throw new ComposioAuthConfigNotFoundError(
|
|
@@ -4213,7 +4392,7 @@ var TriggerTypeSchema = import_zod8.z.object({
|
|
|
4213
4392
|
});
|
|
4214
4393
|
var TriggersTypeListResponseSchema = import_zod8.z.object({
|
|
4215
4394
|
items: import_zod8.z.array(TriggerTypeSchema),
|
|
4216
|
-
nextCursor: import_zod8.z.string().
|
|
4395
|
+
nextCursor: import_zod8.z.string().nullish(),
|
|
4217
4396
|
totalPages: import_zod8.z.number()
|
|
4218
4397
|
});
|
|
4219
4398
|
|
|
@@ -4486,27 +4665,75 @@ var PusherService = class {
|
|
|
4486
4665
|
}
|
|
4487
4666
|
};
|
|
4488
4667
|
|
|
4489
|
-
// src/utils/
|
|
4490
|
-
function
|
|
4491
|
-
return {
|
|
4492
|
-
|
|
4493
|
-
|
|
4494
|
-
|
|
4495
|
-
|
|
4496
|
-
|
|
4497
|
-
|
|
4498
|
-
|
|
4499
|
-
|
|
4500
|
-
|
|
4501
|
-
|
|
4502
|
-
|
|
4503
|
-
|
|
4504
|
-
|
|
4505
|
-
|
|
4506
|
-
|
|
4507
|
-
|
|
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
|
+
}
|
|
4508
4693
|
}
|
|
4509
|
-
};
|
|
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
|
+
}));
|
|
4510
4737
|
}
|
|
4511
4738
|
|
|
4512
4739
|
// src/models/Triggers.ts
|
|
@@ -4518,31 +4745,6 @@ var Triggers = class {
|
|
|
4518
4745
|
this.pusherService = new PusherService(client);
|
|
4519
4746
|
telemetry.instrument(this);
|
|
4520
4747
|
}
|
|
4521
|
-
/**
|
|
4522
|
-
* Parse the trigger instance list active item
|
|
4523
|
-
*
|
|
4524
|
-
* @param response - The response from the composio client
|
|
4525
|
-
* @returns The parsed trigger instance list active item
|
|
4526
|
-
*/
|
|
4527
|
-
parseTriggerInstanceListActiveItem(response) {
|
|
4528
|
-
const parsed = TriggerInstanceListActiveResponseItemSchema.safeParse({
|
|
4529
|
-
id: response.id,
|
|
4530
|
-
connectedAccountId: response.connected_account_id,
|
|
4531
|
-
disabledAt: response.disabled_at,
|
|
4532
|
-
state: response.state,
|
|
4533
|
-
triggerConfig: response.trigger_config,
|
|
4534
|
-
triggerName: response.trigger_name,
|
|
4535
|
-
updatedAt: response.updated_at,
|
|
4536
|
-
triggerData: response.trigger_data,
|
|
4537
|
-
uuid: response.uuid
|
|
4538
|
-
});
|
|
4539
|
-
if (!parsed.success) {
|
|
4540
|
-
throw new ValidationError(`Invalid trigger instance list active item`, {
|
|
4541
|
-
cause: parsed.error
|
|
4542
|
-
});
|
|
4543
|
-
}
|
|
4544
|
-
return parsed.data;
|
|
4545
|
-
}
|
|
4546
4748
|
/**
|
|
4547
4749
|
* Fetch list of all the active triggers
|
|
4548
4750
|
*
|
|
@@ -4578,17 +4780,7 @@ var Triggers = class {
|
|
|
4578
4780
|
trigger_names: parsedParams.data.triggerNames
|
|
4579
4781
|
} : void 0
|
|
4580
4782
|
);
|
|
4581
|
-
|
|
4582
|
-
items: result.items.map((item) => this.parseTriggerInstanceListActiveItem(item)),
|
|
4583
|
-
nextCursor: result.next_cursor,
|
|
4584
|
-
totalPages: result.total_pages
|
|
4585
|
-
});
|
|
4586
|
-
if (!parsedResult.success) {
|
|
4587
|
-
throw new ValidationError(`Invalid trigger instance list active response`, {
|
|
4588
|
-
cause: parsedResult.error
|
|
4589
|
-
});
|
|
4590
|
-
}
|
|
4591
|
-
return parsedResult.data;
|
|
4783
|
+
return transformTriggerInstanceListActiveResponse(result);
|
|
4592
4784
|
}
|
|
4593
4785
|
/**
|
|
4594
4786
|
* Create a new trigger instance for a user
|
|
@@ -4676,15 +4868,9 @@ var Triggers = class {
|
|
|
4676
4868
|
connected_account_id: connectedAccountId,
|
|
4677
4869
|
trigger_config: parsedBody.data.triggerConfig
|
|
4678
4870
|
});
|
|
4679
|
-
|
|
4871
|
+
return {
|
|
4680
4872
|
triggerId: result.trigger_id
|
|
4681
|
-
}
|
|
4682
|
-
if (!parsedResult.success) {
|
|
4683
|
-
throw new ValidationError(`Invalid trigger instance upsert response`, {
|
|
4684
|
-
cause: parsedResult.error
|
|
4685
|
-
});
|
|
4686
|
-
}
|
|
4687
|
-
return parsedResult.data;
|
|
4873
|
+
};
|
|
4688
4874
|
}
|
|
4689
4875
|
/**
|
|
4690
4876
|
* Update an existing trigger instance
|
|
@@ -4704,15 +4890,9 @@ var Triggers = class {
|
|
|
4704
4890
|
*/
|
|
4705
4891
|
async delete(triggerId) {
|
|
4706
4892
|
const result = await this.client.triggerInstances.manage.delete(triggerId);
|
|
4707
|
-
|
|
4893
|
+
return {
|
|
4708
4894
|
triggerId: result.trigger_id
|
|
4709
|
-
}
|
|
4710
|
-
if (!parsedResult.success) {
|
|
4711
|
-
throw new ValidationError(`Invalid trigger instance manage delete response`, {
|
|
4712
|
-
cause: parsedResult.error
|
|
4713
|
-
});
|
|
4714
|
-
}
|
|
4715
|
-
return parsedResult.data;
|
|
4895
|
+
};
|
|
4716
4896
|
}
|
|
4717
4897
|
/**
|
|
4718
4898
|
* Disable a trigger instance
|
|
@@ -4753,12 +4933,7 @@ var Triggers = class {
|
|
|
4753
4933
|
limit: parsedQuery.limit,
|
|
4754
4934
|
toolkit_slugs: parsedQuery.toolkits
|
|
4755
4935
|
});
|
|
4756
|
-
|
|
4757
|
-
items: raw.items,
|
|
4758
|
-
nextCursor: raw.next_cursor ?? null,
|
|
4759
|
-
totalPages: raw.total_pages
|
|
4760
|
-
}));
|
|
4761
|
-
return parsedResult;
|
|
4936
|
+
return transformTriggerTypeListResponse(result);
|
|
4762
4937
|
}
|
|
4763
4938
|
/**
|
|
4764
4939
|
* Retrieve a trigger type by its slug
|
|
@@ -4769,20 +4944,7 @@ var Triggers = class {
|
|
|
4769
4944
|
*/
|
|
4770
4945
|
async getType(slug) {
|
|
4771
4946
|
const result = await this.client.triggersTypes.retrieve(slug);
|
|
4772
|
-
|
|
4773
|
-
slug: raw.slug,
|
|
4774
|
-
name: raw.name,
|
|
4775
|
-
description: raw.description,
|
|
4776
|
-
instructions: raw.instructions,
|
|
4777
|
-
toolkit: {
|
|
4778
|
-
logo: raw.toolkit.logo,
|
|
4779
|
-
slug: raw.toolkit.slug,
|
|
4780
|
-
name: raw.toolkit.name
|
|
4781
|
-
},
|
|
4782
|
-
payload: raw.payload,
|
|
4783
|
-
config: raw.config
|
|
4784
|
-
}));
|
|
4785
|
-
return parsedResult;
|
|
4947
|
+
return transformTriggerTypeRetrieveResponse(result);
|
|
4786
4948
|
}
|
|
4787
4949
|
/**
|
|
4788
4950
|
* Fetches the list of all the available trigger enums
|
|
@@ -4868,40 +5030,10 @@ var Triggers = class {
|
|
|
4868
5030
|
await this.pusherService.subscribe((_data) => {
|
|
4869
5031
|
logger_default.debug("Received raw trigger data", JSON.stringify(_data, null, 2));
|
|
4870
5032
|
const data = _data;
|
|
4871
|
-
const parsedData =
|
|
4872
|
-
|
|
4873
|
-
uuid: data.metadata.id,
|
|
4874
|
-
triggerSlug: data.metadata.triggerName,
|
|
4875
|
-
toolkitSlug: data.appName,
|
|
4876
|
-
userId: data.metadata.connection?.clientUniqueUserId,
|
|
4877
|
-
payload: data.payload,
|
|
4878
|
-
originalPayload: data.originalPayload,
|
|
4879
|
-
metadata: {
|
|
4880
|
-
id: data.metadata.nanoId,
|
|
4881
|
-
uuid: data.metadata.id,
|
|
4882
|
-
triggerConfig: data.metadata.triggerConfig,
|
|
4883
|
-
triggerSlug: data.metadata.triggerName,
|
|
4884
|
-
toolkitSlug: data.appName,
|
|
4885
|
-
triggerData: data.metadata.triggerData,
|
|
4886
|
-
connectedAccount: {
|
|
4887
|
-
id: data.metadata.connection?.connectedAccountNanoId,
|
|
4888
|
-
uuid: data.metadata.connection?.id,
|
|
4889
|
-
authConfigId: data.metadata.connection?.authConfigNanoId,
|
|
4890
|
-
authConfigUUID: data.metadata.connection?.integrationId,
|
|
4891
|
-
userId: data.metadata.connection?.clientUniqueUserId,
|
|
4892
|
-
status: data.metadata.connection?.status
|
|
4893
|
-
}
|
|
4894
|
-
}
|
|
4895
|
-
});
|
|
4896
|
-
logger_default.debug("Parsed trigger data", JSON.stringify(parsedData.data, null, 2));
|
|
4897
|
-
if (parsedData.error) {
|
|
4898
|
-
throw new ValidationError(`Invalid trigger payload`, {
|
|
4899
|
-
cause: parsedData.error
|
|
4900
|
-
});
|
|
4901
|
-
}
|
|
4902
|
-
if (this.shouldSendTriggerAfterFilters(parsedFilters.data, parsedData.data)) {
|
|
5033
|
+
const parsedData = transformIncomingTriggerPayload(data);
|
|
5034
|
+
if (this.shouldSendTriggerAfterFilters(parsedFilters.data, parsedData)) {
|
|
4903
5035
|
try {
|
|
4904
|
-
fn(parsedData
|
|
5036
|
+
fn(parsedData);
|
|
4905
5037
|
} catch (error) {
|
|
4906
5038
|
logger_default.error("\u274C Error in trigger callback:", error);
|
|
4907
5039
|
}
|
|
@@ -4942,7 +5074,7 @@ var MCPToolkitConfigsArraySchema = import_zod10.z.array(MCPToolkitConfigSchema).
|
|
|
4942
5074
|
return uniqueToolkits.size === toolkits.length;
|
|
4943
5075
|
}, "Duplicate toolkits are not allowed. Each toolkit must be unique.");
|
|
4944
5076
|
var MCPAuthOptionsSchema = import_zod10.z.object({
|
|
4945
|
-
|
|
5077
|
+
isChatAuth: import_zod10.z.boolean().optional()
|
|
4946
5078
|
});
|
|
4947
5079
|
var MCPGetServerParamsSchema = import_zod10.z.object({
|
|
4948
5080
|
userId: import_zod10.z.string().min(1, "User ID cannot be empty").optional(),
|
|
@@ -4960,7 +5092,7 @@ var MCPGetServerParamsSchema = import_zod10.z.object({
|
|
|
4960
5092
|
var MCPGenerateURLParamsSchema = import_zod10.z.object({
|
|
4961
5093
|
userIds: import_zod10.z.array(import_zod10.z.string()).optional(),
|
|
4962
5094
|
connectedAccountIds: import_zod10.z.array(import_zod10.z.string()).optional(),
|
|
4963
|
-
|
|
5095
|
+
isChatAuth: import_zod10.z.boolean().optional()
|
|
4964
5096
|
});
|
|
4965
5097
|
var ComposioGenerateURLParamsSchema = import_zod10.z.object({
|
|
4966
5098
|
user_ids: import_zod10.z.array(import_zod10.z.string()).optional(),
|
|
@@ -5014,6 +5146,11 @@ var MCPServerUpdateParamsSchema = import_zod10.z.object({
|
|
|
5014
5146
|
allowedTools: import_zod10.z.array(import_zod10.z.string()).optional().describe("Updated list of allowed tools")
|
|
5015
5147
|
});
|
|
5016
5148
|
var MCPServerCreateResponseSchema = MCPServerSchema;
|
|
5149
|
+
var ConnectionStatus = /* @__PURE__ */ ((ConnectionStatus2) => {
|
|
5150
|
+
ConnectionStatus2["CONNECTED"] = "CONNECTED";
|
|
5151
|
+
ConnectionStatus2["DISCONNECTED"] = "DISCONNECTED";
|
|
5152
|
+
return ConnectionStatus2;
|
|
5153
|
+
})(ConnectionStatus || {});
|
|
5017
5154
|
var CustomCreateResponseSchema = import_zod10.z.object({
|
|
5018
5155
|
id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
|
|
5019
5156
|
name: import_zod10.z.string().min(1, "Server name cannot be empty"),
|
|
@@ -5058,7 +5195,14 @@ var McpRetrieveResponseSchema = import_zod10.z.object({
|
|
|
5058
5195
|
status: import_zod10.z.string().optional(),
|
|
5059
5196
|
toolkits: import_zod10.z.array(import_zod10.z.string()).optional(),
|
|
5060
5197
|
tools: import_zod10.z.array(import_zod10.z.string()).optional(),
|
|
5061
|
-
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
|
+
})
|
|
5062
5206
|
});
|
|
5063
5207
|
var ComposioMcpRetrieveResponseSchema = import_zod10.z.object({
|
|
5064
5208
|
id: import_zod10.z.string().min(1, "Server ID cannot be empty"),
|
|
@@ -5141,8 +5285,11 @@ function transformMcpRetrieveResponse(response) {
|
|
|
5141
5285
|
updatedAt: response.updated_at,
|
|
5142
5286
|
status: response.status,
|
|
5143
5287
|
toolkits: response.toolkits,
|
|
5144
|
-
tools: response.
|
|
5145
|
-
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
|
|
5146
5293
|
});
|
|
5147
5294
|
if (!result.success) {
|
|
5148
5295
|
throw new ValidationError("Failed to parse MCP retrieve response", {
|
|
@@ -5199,9 +5346,11 @@ function transformMcpGenerateUrlResponse(response) {
|
|
|
5199
5346
|
var MCP = class {
|
|
5200
5347
|
client;
|
|
5201
5348
|
provider;
|
|
5349
|
+
toolkits;
|
|
5202
5350
|
constructor(client, provider) {
|
|
5203
5351
|
this.client = client;
|
|
5204
5352
|
this.provider = provider;
|
|
5353
|
+
this.toolkits = new Toolkits(client);
|
|
5205
5354
|
telemetry.instrument(this);
|
|
5206
5355
|
}
|
|
5207
5356
|
/**
|
|
@@ -5229,47 +5378,100 @@ var MCP = class {
|
|
|
5229
5378
|
}
|
|
5230
5379
|
/**
|
|
5231
5380
|
* Create a new MCP server
|
|
5232
|
-
* @param {
|
|
5233
|
-
* @param {
|
|
5234
|
-
* @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
|
|
5235
5386
|
* @returns {Promise<McpServerCreateResponse<T>>} Created server details with instance getter
|
|
5236
5387
|
*
|
|
5237
5388
|
* @example
|
|
5238
5389
|
* ```typescript
|
|
5239
|
-
* const server = await composio.mcp.create(
|
|
5240
|
-
* "personal-mcp-server",
|
|
5241
|
-
* [
|
|
5390
|
+
* const server = await composio.mcp.create("personal-mcp-server", [
|
|
5242
5391
|
* {
|
|
5243
|
-
*
|
|
5244
|
-
*
|
|
5245
|
-
*
|
|
5246
|
-
* },
|
|
5392
|
+
* authConfigId: "ac_xyz",
|
|
5393
|
+
* allowedTools: ["GMAIL_FETCH_EMAILS", "SLACK_SEND_MESSAGE"]
|
|
5394
|
+
* }
|
|
5247
5395
|
* ],
|
|
5248
|
-
* {
|
|
5249
|
-
*
|
|
5250
|
-
*
|
|
5251
|
-
* // Option 1: Use convenience method on response
|
|
5252
|
-
* const urls = await server.getServer({
|
|
5253
|
-
* connectedAccountIds: { gmail: "account_id" }
|
|
5396
|
+
* {
|
|
5397
|
+
* isChatAuth: true
|
|
5398
|
+
* }
|
|
5254
5399
|
* });
|
|
5255
5400
|
*
|
|
5256
|
-
* //
|
|
5257
|
-
* const
|
|
5258
|
-
*
|
|
5401
|
+
* // Use convenience method on response
|
|
5402
|
+
* const urls = await server.getServer({
|
|
5403
|
+
* userId: "user123"
|
|
5259
5404
|
* });
|
|
5260
5405
|
* ```
|
|
5261
5406
|
*/
|
|
5262
|
-
async create(name,
|
|
5263
|
-
|
|
5264
|
-
|
|
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);
|
|
5265
5467
|
let mcpServerCreatedResponse;
|
|
5266
5468
|
try {
|
|
5267
5469
|
mcpServerCreatedResponse = await this.client.mcp.custom.create({
|
|
5268
5470
|
name,
|
|
5269
5471
|
toolkits,
|
|
5270
|
-
custom_tools:
|
|
5271
|
-
managed_auth_via_composio:
|
|
5272
|
-
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)
|
|
5273
5475
|
});
|
|
5274
5476
|
} catch (error) {
|
|
5275
5477
|
throw new ValidationError("Failed to create MCP server", {
|
|
@@ -5287,53 +5489,200 @@ var MCP = class {
|
|
|
5287
5489
|
...camelCaseResponse,
|
|
5288
5490
|
toolkits,
|
|
5289
5491
|
getServer: async (params) => {
|
|
5290
|
-
return this.getServer(camelCaseResponse.id, params,
|
|
5492
|
+
return this.getServer(camelCaseResponse.id, params.userId || "", {
|
|
5493
|
+
isChatAuth: options.isChatAuth
|
|
5494
|
+
});
|
|
5291
5495
|
}
|
|
5292
5496
|
};
|
|
5293
5497
|
}
|
|
5294
5498
|
/**
|
|
5295
|
-
* Get
|
|
5296
|
-
*
|
|
5297
|
-
*
|
|
5298
|
-
*
|
|
5299
|
-
*
|
|
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
|
+
* ```
|
|
5300
5534
|
*
|
|
5301
5535
|
* @example
|
|
5302
5536
|
* ```typescript
|
|
5303
|
-
* //
|
|
5304
|
-
*
|
|
5305
|
-
*
|
|
5306
|
-
*
|
|
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
|
+
* }
|
|
5307
5553
|
* }
|
|
5308
|
-
* }
|
|
5554
|
+
* }
|
|
5309
5555
|
* ```
|
|
5310
5556
|
*/
|
|
5311
|
-
async
|
|
5312
|
-
const serverDetails = await this.get(
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
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 }
|
|
5317
5562
|
});
|
|
5318
5563
|
}
|
|
5319
|
-
const
|
|
5320
|
-
|
|
5321
|
-
|
|
5322
|
-
|
|
5323
|
-
|
|
5324
|
-
|
|
5325
|
-
|
|
5326
|
-
|
|
5327
|
-
|
|
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;
|
|
5328
5591
|
}
|
|
5329
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);
|
|
5330
5678
|
let data;
|
|
5331
5679
|
try {
|
|
5332
5680
|
data = await this.client.mcp.generate.url({
|
|
5333
|
-
user_ids:
|
|
5334
|
-
|
|
5335
|
-
|
|
5336
|
-
|
|
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
|
|
5337
5686
|
});
|
|
5338
5687
|
} catch (error) {
|
|
5339
5688
|
throw new ValidationError("Failed to generate MCP server URL", {
|
|
@@ -5350,9 +5699,9 @@ var MCP = class {
|
|
|
5350
5699
|
return this.wrapMcpServerResponse(
|
|
5351
5700
|
camelCaseData,
|
|
5352
5701
|
serverDetails.name,
|
|
5353
|
-
|
|
5354
|
-
|
|
5355
|
-
|
|
5702
|
+
connectedAccountIds,
|
|
5703
|
+
[userId],
|
|
5704
|
+
toolkits
|
|
5356
5705
|
);
|
|
5357
5706
|
}
|
|
5358
5707
|
/**
|
|
@@ -5387,8 +5736,8 @@ var MCP = class {
|
|
|
5387
5736
|
listResponse = await this.client.mcp.list({
|
|
5388
5737
|
page_no: options.page || 1,
|
|
5389
5738
|
limit: options.limit || 10,
|
|
5390
|
-
toolkits: options?.toolkits?.join(",") ||
|
|
5391
|
-
auth_config_ids: options?.authConfigs?.join(",") ||
|
|
5739
|
+
toolkits: options?.toolkits?.join(",") || void 0,
|
|
5740
|
+
auth_config_ids: options?.authConfigs?.join(",") || void 0,
|
|
5392
5741
|
name: options?.name
|
|
5393
5742
|
});
|
|
5394
5743
|
} catch (error) {
|
|
@@ -5406,7 +5755,7 @@ var MCP = class {
|
|
|
5406
5755
|
}
|
|
5407
5756
|
/**
|
|
5408
5757
|
* Get details of a specific MCP server
|
|
5409
|
-
* @param {string}
|
|
5758
|
+
* @param {string} serverId - Server UUID
|
|
5410
5759
|
* @returns {Promise<McpRetrieveResponse>} Server details
|
|
5411
5760
|
*
|
|
5412
5761
|
* @example
|
|
@@ -5414,16 +5763,19 @@ var MCP = class {
|
|
|
5414
5763
|
* const serverDetails = await composio.mcp.get('server-uuid');
|
|
5415
5764
|
* ```
|
|
5416
5765
|
*/
|
|
5417
|
-
async get(
|
|
5766
|
+
async get(serverId) {
|
|
5418
5767
|
let retrieveResponse;
|
|
5419
5768
|
try {
|
|
5420
|
-
retrieveResponse = await this.client.mcp.retrieve(
|
|
5769
|
+
retrieveResponse = await this.client.mcp.retrieve(serverId);
|
|
5421
5770
|
} catch (error) {
|
|
5422
5771
|
throw new ValidationError("Failed to retrieve MCP server", {
|
|
5423
5772
|
cause: error
|
|
5424
5773
|
});
|
|
5425
5774
|
}
|
|
5426
|
-
const retrieveResponseResult = McpRetrieveResponseSchema.safeParse(
|
|
5775
|
+
const retrieveResponseResult = McpRetrieveResponseSchema.safeParse({
|
|
5776
|
+
...retrieveResponse,
|
|
5777
|
+
mcpUrl: retrieveResponse.mcp_url
|
|
5778
|
+
});
|
|
5427
5779
|
if (retrieveResponseResult.error) {
|
|
5428
5780
|
throw new ValidationError("Failed to parse MCP server retrieve response", {
|
|
5429
5781
|
cause: retrieveResponseResult.error
|
|
@@ -5433,7 +5785,7 @@ var MCP = class {
|
|
|
5433
5785
|
}
|
|
5434
5786
|
/**
|
|
5435
5787
|
* Delete an MCP server
|
|
5436
|
-
* @param {string}
|
|
5788
|
+
* @param {string} serverId - Server UUID
|
|
5437
5789
|
* @returns {Promise<McpDeleteResponse>} Deletion response
|
|
5438
5790
|
*
|
|
5439
5791
|
* @example
|
|
@@ -5441,10 +5793,10 @@ var MCP = class {
|
|
|
5441
5793
|
* const result = await composio.mcp.delete('server-uuid');
|
|
5442
5794
|
* ```
|
|
5443
5795
|
*/
|
|
5444
|
-
async delete(
|
|
5796
|
+
async delete(serverId) {
|
|
5445
5797
|
let deleteResponse;
|
|
5446
5798
|
try {
|
|
5447
|
-
deleteResponse = await this.client.mcp.delete(
|
|
5799
|
+
deleteResponse = await this.client.mcp.delete(serverId);
|
|
5448
5800
|
} catch (error) {
|
|
5449
5801
|
throw new ValidationError("Failed to delete MCP server", {
|
|
5450
5802
|
cause: error
|
|
@@ -5479,21 +5831,21 @@ var MCP = class {
|
|
|
5479
5831
|
* },
|
|
5480
5832
|
* ],
|
|
5481
5833
|
* {
|
|
5482
|
-
*
|
|
5834
|
+
* isChatAuth: true,
|
|
5483
5835
|
* }
|
|
5484
5836
|
* );
|
|
5485
5837
|
* ```
|
|
5486
5838
|
*/
|
|
5487
|
-
async update(
|
|
5839
|
+
async update(serverId, name, toolkitConfigs, authOptions) {
|
|
5488
5840
|
this.validateInputs(toolkitConfigs, authOptions);
|
|
5489
5841
|
const toolkits = toolkitConfigs.map((config) => config.toolkit);
|
|
5490
5842
|
let updateResponse;
|
|
5491
5843
|
try {
|
|
5492
|
-
updateResponse = await this.client.mcp.update(
|
|
5844
|
+
updateResponse = await this.client.mcp.update(serverId, {
|
|
5493
5845
|
name,
|
|
5494
5846
|
toolkits,
|
|
5495
5847
|
allowed_tools: toolkitConfigs.flatMap((config) => config.allowedTools),
|
|
5496
|
-
managed_auth_via_composio: authOptions?.
|
|
5848
|
+
managed_auth_via_composio: authOptions?.isChatAuth || false
|
|
5497
5849
|
});
|
|
5498
5850
|
} catch (error) {
|
|
5499
5851
|
throw new ValidationError("Failed to update MCP server", {
|
|
@@ -5510,20 +5862,20 @@ var MCP = class {
|
|
|
5510
5862
|
}
|
|
5511
5863
|
/**
|
|
5512
5864
|
* Generate URL for an MCP server
|
|
5865
|
+
* @param {string} serverId - Server UUID
|
|
5513
5866
|
* @param {GenerateURLParams} params - Parameters for URL generation
|
|
5514
5867
|
* @returns {Promise<GenerateURLResponse>} Generated URL response
|
|
5515
5868
|
*
|
|
5516
5869
|
* @example
|
|
5517
5870
|
* ```typescript
|
|
5518
|
-
* const urlResponse = await composio.mcp.generateUrl({
|
|
5871
|
+
* const urlResponse = await composio.mcp.generateUrl('server-uuid', {
|
|
5519
5872
|
* userIds: ['user123'],
|
|
5520
5873
|
* connectedAccountIds: ['account456'],
|
|
5521
|
-
*
|
|
5522
|
-
* composioManagedAuth: true
|
|
5874
|
+
* isChatAuth: true
|
|
5523
5875
|
* });
|
|
5524
5876
|
* ```
|
|
5525
5877
|
*/
|
|
5526
|
-
async generateUrl(params) {
|
|
5878
|
+
async generateUrl(serverId, params) {
|
|
5527
5879
|
const paramsResult = GenerateURLParamsSchema.safeParse(params);
|
|
5528
5880
|
if (paramsResult.error) {
|
|
5529
5881
|
throw new ValidationError("Failed to parse generateUrl parameters", {
|
|
@@ -5533,7 +5885,7 @@ var MCP = class {
|
|
|
5533
5885
|
let urlResponse;
|
|
5534
5886
|
try {
|
|
5535
5887
|
urlResponse = await this.client.mcp.generate.url({
|
|
5536
|
-
mcp_server_id:
|
|
5888
|
+
mcp_server_id: serverId,
|
|
5537
5889
|
user_ids: params.userIds,
|
|
5538
5890
|
connected_account_ids: params.connectedAccountIds,
|
|
5539
5891
|
managed_auth_by_composio: params.composioManagedAuth
|
|
@@ -5603,6 +5955,48 @@ var MCP = class {
|
|
|
5603
5955
|
name: serverName
|
|
5604
5956
|
};
|
|
5605
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
|
+
}
|
|
5606
6000
|
};
|
|
5607
6001
|
|
|
5608
6002
|
// src/utils/sdk.ts
|
|
@@ -5861,6 +6255,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
5861
6255
|
arguments: JSON.parse(tool.function.arguments),
|
|
5862
6256
|
connectedAccountId: options?.connectedAccountId,
|
|
5863
6257
|
customAuthParams: options?.customAuthParams,
|
|
6258
|
+
customConnectionData: options?.customConnectionData,
|
|
5864
6259
|
userId
|
|
5865
6260
|
};
|
|
5866
6261
|
const result = await this.executeTool(tool.function.name, payload, modifiers);
|
|
@@ -6142,7 +6537,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
6142
6537
|
};
|
|
6143
6538
|
|
|
6144
6539
|
// package.json
|
|
6145
|
-
var version = "0.1.36
|
|
6540
|
+
var version = "0.1.36";
|
|
6146
6541
|
|
|
6147
6542
|
// src/models/Files.ts
|
|
6148
6543
|
var Files = class {
|
|
@@ -6585,6 +6980,7 @@ var AuthScheme = class {
|
|
|
6585
6980
|
ConnectionRequestErrorCodes,
|
|
6586
6981
|
ConnectionRequestFailedError,
|
|
6587
6982
|
ConnectionRequestTimeoutError,
|
|
6983
|
+
ConnectionStatus,
|
|
6588
6984
|
ConnectionStatuses,
|
|
6589
6985
|
CreateAuthConfigParamsSchema,
|
|
6590
6986
|
CreateAuthConfigResponseSchema,
|
|
@@ -6594,7 +6990,10 @@ var AuthScheme = class {
|
|
|
6594
6990
|
CreateConnectedAccountResponseSchema,
|
|
6595
6991
|
CreateCustomAuthConfigParamsSchema,
|
|
6596
6992
|
CustomAuthParamsSchema,
|
|
6993
|
+
CustomConnectionDataSchema,
|
|
6597
6994
|
CustomCreateResponseSchema,
|
|
6995
|
+
CustomOauth1ConnectionDataSchema,
|
|
6996
|
+
CustomOauth2ConnectionDataSchema,
|
|
6598
6997
|
DefaultCreateConnectedAccountParamsSchema,
|
|
6599
6998
|
GenerateURLParamsSchema,
|
|
6600
6999
|
GenerateURLResponseSchema,
|
|
@@ -6621,12 +7020,14 @@ var AuthScheme = class {
|
|
|
6621
7020
|
Oauth1ConnectionDataSchema,
|
|
6622
7021
|
Oauth1ExpiredConnectionDataSchema,
|
|
6623
7022
|
Oauth1FailedConnectionDataSchema,
|
|
7023
|
+
Oauth1InactiveConnectionDataSchema,
|
|
6624
7024
|
Oauth1InitiatedConnectionDataSchema,
|
|
6625
7025
|
Oauth1InitiatingConnectionDataSchema,
|
|
6626
7026
|
Oauth2ActiveConnectionDataSchema,
|
|
6627
7027
|
Oauth2ConnectionDataSchema,
|
|
6628
7028
|
Oauth2ExpiredConnectionDataSchema,
|
|
6629
7029
|
Oauth2FailedConnectionDataSchema,
|
|
7030
|
+
Oauth2InactiveConnectionDataSchema,
|
|
6630
7031
|
Oauth2InitiatedConnectionDataSchema,
|
|
6631
7032
|
Oauth2InitiatingConnectionDataSchema,
|
|
6632
7033
|
OpenAIProvider,
|