@composio/core 0.1.50 → 0.1.52
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/README.md +1 -0
- package/dist/index.cjs +308 -143
- package/dist/index.d.cts +6648 -13446
- package/dist/index.d.ts +6648 -13446
- package/dist/index.js +305 -142
- package/package.json +3 -3
- package/generated/ably.ts +0 -20
- package/generated/accelo.ts +0 -8
- package/generated/acculynx.ts +0 -17
- package/generated/active_campaign.ts +0 -30
- package/generated/adobe.ts +0 -8
- package/generated/adyntel.ts +0 -12
- package/generated/aero_workflow.ts +0 -8
- package/generated/affinity.ts +0 -29
- package/generated/agencyzoom.ts +0 -108
- package/generated/ahrefs.ts +0 -49
- package/generated/airtable.ts +0 -26
- package/generated/alchemy.ts +0 -16
- package/generated/algolia.ts +0 -39
- package/generated/altoviz.ts +0 -18
- package/generated/amazon.ts +0 -8
- package/generated/amcards.ts +0 -11
- package/generated/amplitude.ts +0 -25
- package/generated/anthropic_administrator.ts +0 -13
- package/generated/apaleo.ts +0 -38
- package/generated/apollo.ts +0 -40
- package/generated/appdrag.ts +0 -8
- package/generated/appsflyer.ts +0 -8
- package/generated/asana.ts +0 -95
- package/generated/ashby.ts +0 -8
- package/generated/atlassian.ts +0 -8
- package/generated/attio.ts +0 -20
- package/generated/auth0.ts +0 -8
- package/generated/axonaut.ts +0 -8
- package/generated/bamboohr.ts +0 -168
- package/generated/bannerbear.ts +0 -17
- package/generated/baserow.ts +0 -11
- package/generated/battlenet.ts +0 -8
- package/generated/beeminder.ts +0 -14
- package/generated/bigmailer.ts +0 -12
- package/generated/bigml.ts +0 -15
- package/generated/bill.ts +0 -218
- package/generated/bitbucket.ts +0 -25
- package/generated/bitwarden.ts +0 -8
- package/generated/blackbaud.ts +0 -8
- package/generated/blackboard.ts +0 -323
- package/generated/boldsign.ts +0 -8
- package/generated/bolna.ts +0 -24
- package/generated/borneo.ts +0 -162
- package/generated/botbaba.ts +0 -8
- package/generated/box.ts +0 -282
- package/generated/braintree.ts +0 -8
- package/generated/brandfetch.ts +0 -15
- package/generated/breezy_hr.ts +0 -8
- package/generated/brevo.ts +0 -28
- package/generated/brex.ts +0 -8
- package/generated/brex_staging.ts +0 -8
- package/generated/brightpearl.ts +0 -8
- package/generated/brilliant_directories.ts +0 -15
- package/generated/browseai.ts +0 -18
- package/generated/browserbase_tool.ts +0 -10
- package/generated/browserhub.ts +0 -8
- package/generated/browserless.ts +0 -16
- package/generated/bubble.ts +0 -8
- package/generated/bugbug.ts +0 -13
- package/generated/builtwith.ts +0 -21
- package/generated/cal.ts +0 -150
- package/generated/calendly.ts +0 -51
- package/generated/canva.ts +0 -41
- package/generated/canvas.ts +0 -100
- package/generated/chatwork.ts +0 -17
- package/generated/chmeetings.ts +0 -8
- package/generated/clickup.ts +0 -153
- package/generated/clockify.ts +0 -23
- package/generated/close.ts +0 -15
- package/generated/cloudflare.ts +0 -10
- package/generated/coda.ts +0 -115
- package/generated/codeinterpreter.ts +0 -14
- package/generated/coinbase.ts +0 -15
- package/generated/coinmarketcal.ts +0 -8
- package/generated/composio.ts +0 -34
- package/generated/composio_search.ts +0 -22
- package/generated/confluence.ts +0 -199
- package/generated/contentful.ts +0 -12
- package/generated/crustdata.ts +0 -23
- package/generated/customer_io.ts +0 -8
- package/generated/cutt_ly.ts +0 -10
- package/generated/d2lbrightspace.ts +0 -54
- package/generated/dailybot.ts +0 -15
- package/generated/datadog.ts +0 -47
- package/generated/datagma.ts +0 -8
- package/generated/datarobot.ts +0 -8
- package/generated/deel.ts +0 -8
- package/generated/demio.ts +0 -8
- package/generated/dialpad.ts +0 -201
- package/generated/digicert.ts +0 -15
- package/generated/discord.ts +0 -17
- package/generated/discordbot.ts +0 -173
- package/generated/docmosis.ts +0 -8
- package/generated/docusign.ts +0 -351
- package/generated/dropbox.ts +0 -20
- package/generated/dropbox_sign.ts +0 -8
- package/generated/dynamics365.ts +0 -25
- package/generated/echtpost.ts +0 -10
- package/generated/elevenlabs.ts +0 -70
- package/generated/emailoctopus.ts +0 -16
- package/generated/enigma.ts +0 -11
- package/generated/entelligence.ts +0 -11
- package/generated/epic_games.ts +0 -8
- package/generated/eventbrite.ts +0 -12
- package/generated/exa.ts +0 -13
- package/generated/excel.ts +0 -34
- package/generated/exist.ts +0 -8
- package/generated/facebook.ts +0 -8
- package/generated/factorial.ts +0 -8
- package/generated/figma.ts +0 -59
- package/generated/finage.ts +0 -19
- package/generated/firecrawl.ts +0 -16
- package/generated/fireflies.ts +0 -21
- package/generated/fitbit.ts +0 -8
- package/generated/flutterwave.ts +0 -33
- package/generated/fomo.ts +0 -10
- package/generated/formcarry.ts +0 -10
- package/generated/formsite.ts +0 -14
- package/generated/foursquare.ts +0 -14
- package/generated/freshbooks.ts +0 -11
- package/generated/freshdesk.ts +0 -16
- package/generated/front.ts +0 -8
- package/generated/github.ts +0 -967
- package/generated/gitlab.ts +0 -82
- package/generated/gmail.d.ts +0 -205
- package/generated/gmail.js +0 -150
- package/generated/gmail.ts +0 -223
- package/generated/go_to_webinar.ts +0 -8
- package/generated/gong.ts +0 -63
- package/generated/google_analytics.ts +0 -13
- package/generated/google_maps.ts +0 -16
- package/generated/googleads.ts +0 -14
- package/generated/googlebigquery.ts +0 -10
- package/generated/googlecalendar.ts +0 -39
- package/generated/googledocs.ts +0 -41
- package/generated/googledrive.ts +0 -62
- package/generated/googlemeet.ts +0 -18
- package/generated/googlephotos.ts +0 -22
- package/generated/googlesheets.ts +0 -40
- package/generated/googleslides.ts +0 -8
- package/generated/googlesuper.ts +0 -230
- package/generated/googletasks.ts +0 -23
- package/generated/gorgias.ts +0 -41
- package/generated/gumroad.ts +0 -14
- package/generated/guru.ts +0 -8
- package/generated/hackernews.ts +0 -15
- package/generated/hackerrank_work.ts +0 -8
- package/generated/harvest.ts +0 -56
- package/generated/helcim.ts +0 -8
- package/generated/heygen.ts +0 -44
- package/generated/highlevel.ts +0 -8
- package/generated/hubspot.ts +0 -252
- package/generated/humanloop.ts +0 -13
- package/generated/icims_talent_cloud.ts +0 -8
- package/generated/idea_scale.ts +0 -8
- package/generated/index.d.ts +0 -377
- package/generated/index.js +0 -168
- package/generated/index.ts +0 -273
- package/generated/insighto_ai.ts +0 -19
- package/generated/intercom.ts +0 -52
- package/generated/interzoid.ts +0 -8
- package/generated/jira.ts +0 -59
- package/generated/jotform.ts +0 -15
- package/generated/junglescout.ts +0 -15
- package/generated/keap.ts +0 -8
- package/generated/kibana.ts +0 -58
- package/generated/kit.ts +0 -38
- package/generated/klaviyo.ts +0 -240
- package/generated/klipfolio.ts +0 -20
- package/generated/kommo.ts +0 -24
- package/generated/lastpass.ts +0 -8
- package/generated/launch_darkly.ts +0 -16
- package/generated/leadfeeder.ts +0 -13
- package/generated/leadoku.ts +0 -10
- package/generated/lever.ts +0 -8
- package/generated/lever_sandbox.ts +0 -8
- package/generated/lexoffice.ts +0 -8
- package/generated/linear.ts +0 -31
- package/generated/linkedin.ts +0 -13
- package/generated/linkhut.ts +0 -14
- package/generated/linkup.ts +0 -11
- package/generated/listennotes.ts +0 -35
- package/generated/lmnt.ts +0 -16
- package/generated/lodgify.ts +0 -10
- package/generated/mailchimp.ts +0 -285
- package/generated/mailerlite.ts +0 -8
- package/generated/maintainx.ts +0 -20
- package/generated/make.ts +0 -12
- package/generated/mboum.ts +0 -8
- package/generated/mem0.ts +0 -52
- package/generated/metaads.ts +0 -25
- package/generated/metatextai.ts +0 -8
- package/generated/microsoft_clarity.ts +0 -10
- package/generated/microsoft_teams.ts +0 -22
- package/generated/microsoft_tenant.ts +0 -8
- package/generated/miro.ts +0 -23
- package/generated/mixpanel.ts +0 -30
- package/generated/mocean.ts +0 -8
- package/generated/monday.ts +0 -30
- package/generated/mopinion.ts +0 -8
- package/generated/more_trees.ts +0 -10
- package/generated/moxie.ts +0 -8
- package/generated/moz.ts +0 -8
- package/generated/mural.ts +0 -14
- package/generated/nasdaq.ts +0 -15
- package/generated/ncscale.ts +0 -8
- package/generated/neon.ts +0 -78
- package/generated/netsuite.ts +0 -8
- package/generated/nextdns.ts +0 -11
- package/generated/ngrok.ts +0 -18
- package/generated/notion.ts +0 -40
- package/generated/oncehub.ts +0 -8
- package/generated/one_drive.ts +0 -49
- package/generated/onepage.ts +0 -11
- package/generated/open_sea.ts +0 -33
- package/generated/outlook.ts +0 -37
- package/generated/pagerduty.ts +0 -362
- package/generated/pandadoc.ts +0 -23
- package/generated/peopledatalabs.ts +0 -24
- package/generated/perplexityai.ts +0 -10
- package/generated/piggy.ts +0 -8
- package/generated/pipedrive.ts +0 -288
- package/generated/placekey.ts +0 -12
- package/generated/posthog.ts +0 -367
- package/generated/precoro.ts +0 -8
- package/generated/printnode.ts +0 -8
- package/generated/process_street.ts +0 -14
- package/generated/productboard.ts +0 -8
- package/generated/qualaroo.ts +0 -8
- package/generated/quickbooks.ts +0 -22
- package/generated/rafflys.ts +0 -8
- package/generated/ragic.ts +0 -10
- package/generated/ramp.ts +0 -17
- package/generated/ravenseotools.ts +0 -8
- package/generated/recallai.ts +0 -17
- package/generated/reddit.ts +0 -19
- package/generated/resend.ts +0 -27
- package/generated/retellai.ts +0 -19
- package/generated/retently.ts +0 -24
- package/generated/ring_central.ts +0 -8
- package/generated/rippling.ts +0 -8
- package/generated/rocket_reach.ts +0 -8
- package/generated/rocketlane.ts +0 -42
- package/generated/rootly.ts +0 -12
- package/generated/rosette_text_analytics.ts +0 -12
- package/generated/sage.ts +0 -8
- package/generated/salesforce.ts +0 -46
- package/generated/scrape_do.ts +0 -28
- package/generated/scrapingant.ts +0 -14
- package/generated/screenshotone.ts +0 -10
- package/generated/seismic.ts +0 -8
- package/generated/semanticscholar.ts +0 -23
- package/generated/semrush.ts +0 -45
- package/generated/sendgrid.ts +0 -384
- package/generated/sentry.ts +0 -185
- package/generated/serpapi.ts +0 -32
- package/generated/servicem8.ts +0 -37
- package/generated/servicenow.ts +0 -14
- package/generated/share_point.ts +0 -15
- package/generated/shopify.ts +0 -37
- package/generated/shortcut.ts +0 -131
- package/generated/simplesat.ts +0 -11
- package/generated/slack.d.ts +0 -16
- package/generated/slack.js +0 -8
- package/generated/slack.ts +0 -18
- package/generated/slackbot.ts +0 -205
- package/generated/smartrecruiters.ts +0 -8
- package/generated/smugmug.ts +0 -14
- package/generated/snowflake.ts +0 -15
- package/generated/sourcegraph.ts +0 -16
- package/generated/square.ts +0 -8
- package/generated/stack_exchange.ts +0 -17
- package/generated/starton.ts +0 -11
- package/generated/storeganise.ts +0 -12
- package/generated/stripe.ts +0 -50
- package/generated/supabase.ts +0 -86
- package/generated/survey_monkey.ts +0 -8
- package/generated/tally.ts +0 -25
- package/generated/tapfiliate.ts +0 -11
- package/generated/tapform.ts +0 -8
- package/generated/tavily.ts +0 -10
- package/generated/terminus.ts +0 -8
- package/generated/text_to_pdf.ts +0 -10
- package/generated/textrazor.ts +0 -22
- package/generated/timecamp.ts +0 -10
- package/generated/timekit.ts +0 -8
- package/generated/timely.ts +0 -11
- package/generated/tinypng.ts +0 -15
- package/generated/tinyurl.ts +0 -10
- package/generated/tisane.ts +0 -15
- package/generated/todoist.ts +0 -19
- package/generated/toneden.ts +0 -8
- package/generated/tpscheck.ts +0 -10
- package/generated/trello.ts +0 -360
- package/generated/twitch.ts +0 -8
- package/generated/twitter.ts +0 -82
- package/generated/twitter_media.ts +0 -10
- package/generated/typefully.ts +0 -14
- package/generated/venly.ts +0 -8
- package/generated/vero.ts +0 -8
- package/generated/visme.ts +0 -8
- package/generated/waboxapp.ts +0 -8
- package/generated/wakatime.ts +0 -8
- package/generated/wave_accounting.ts +0 -8
- package/generated/weathermap.ts +0 -10
- package/generated/webex.ts +0 -37
- package/generated/webflow.ts +0 -30
- package/generated/whatsapp.ts +0 -14
- package/generated/wiz.ts +0 -8
- package/generated/workiom.ts +0 -12
- package/generated/wrike.ts +0 -47
- package/generated/xero.ts +0 -13
- package/generated/yandex.ts +0 -13
- package/generated/ynab.ts +0 -8
- package/generated/yousearch.ts +0 -10
- package/generated/youtube.ts +0 -26
- package/generated/zendesk.ts +0 -23
- package/generated/zenrows.ts +0 -25
- package/generated/zenserp.ts +0 -20
- package/generated/zoho.ts +0 -33
- package/generated/zoho_bigin.ts +0 -21
- package/generated/zoho_books.ts +0 -8
- package/generated/zoho_desk.ts +0 -8
- package/generated/zoho_inventory.ts +0 -8
- package/generated/zoho_invoice.ts +0 -15
- package/generated/zoho_mail.ts +0 -8
- package/generated/zoom.ts +0 -181
- package/generated/zoominfo.ts +0 -26
package/dist/index.js
CHANGED
|
@@ -35,7 +35,6 @@ var AuthSchemeTypes = {
|
|
|
35
35
|
GOOGLE_SERVICE_ACCOUNT: "GOOGLE_SERVICE_ACCOUNT",
|
|
36
36
|
NO_AUTH: "NO_AUTH",
|
|
37
37
|
BASIC_WITH_JWT: "BASIC_WITH_JWT",
|
|
38
|
-
COMPOSIO_LINK: "COMPOSIO_LINK",
|
|
39
38
|
CALCOM_AUTH: "CALCOM_AUTH"
|
|
40
39
|
};
|
|
41
40
|
var AuthConfigCreationToolAccessConfigSchema = z.object({
|
|
@@ -55,7 +54,6 @@ var AuthSchemeEnum = z.enum([
|
|
|
55
54
|
"GOOGLE_SERVICE_ACCOUNT",
|
|
56
55
|
"NO_AUTH",
|
|
57
56
|
"BASIC_WITH_JWT",
|
|
58
|
-
"COMPOSIO_LINK",
|
|
59
57
|
"CALCOM_AUTH"
|
|
60
58
|
]);
|
|
61
59
|
var CreateCustomAuthConfigParamsSchema = z.object({
|
|
@@ -153,8 +151,7 @@ var ConnectionStatuses = {
|
|
|
153
151
|
};
|
|
154
152
|
var RedirectableAuthSchemeSchema = z2.enum([
|
|
155
153
|
AuthSchemeTypes.OAUTH1,
|
|
156
|
-
AuthSchemeTypes.OAUTH2
|
|
157
|
-
AuthSchemeTypes.COMPOSIO_LINK
|
|
154
|
+
AuthSchemeTypes.OAUTH2
|
|
158
155
|
]);
|
|
159
156
|
var BaseSchemeRaw = z2.object({
|
|
160
157
|
// for posthog, freshdesk, zendesk, clickup and others
|
|
@@ -304,31 +301,6 @@ var CustomOauth1ConnectionDataSchema = Oauth1ActiveConnectionDataSchema.omit({
|
|
|
304
301
|
oauth_token_secret: z2.string(),
|
|
305
302
|
oauth_token: z2.string()
|
|
306
303
|
});
|
|
307
|
-
var ComposioLinkInitiatingSchema = BaseSchemeRaw.extend({
|
|
308
|
-
status: z2.literal(ConnectionStatuses.INITIALIZING)
|
|
309
|
-
}).catchall(z2.unknown());
|
|
310
|
-
var ComposioLinkConnectionDataSchema = z2.discriminatedUnion("status", [
|
|
311
|
-
ComposioLinkInitiatingSchema,
|
|
312
|
-
ComposioLinkInitiatingSchema.extend({
|
|
313
|
-
status: z2.literal(ConnectionStatuses.INITIATED),
|
|
314
|
-
redirectUrl: z2.string()
|
|
315
|
-
}).catchall(z2.unknown()),
|
|
316
|
-
ComposioLinkInitiatingSchema.extend({
|
|
317
|
-
status: z2.literal(ConnectionStatuses.ACTIVE)
|
|
318
|
-
}).catchall(z2.unknown()),
|
|
319
|
-
ComposioLinkInitiatingSchema.extend({
|
|
320
|
-
status: z2.literal(ConnectionStatuses.FAILED),
|
|
321
|
-
error: z2.string().optional(),
|
|
322
|
-
error_description: z2.string().optional()
|
|
323
|
-
}).catchall(z2.unknown()),
|
|
324
|
-
ComposioLinkInitiatingSchema.extend({
|
|
325
|
-
status: z2.literal(ConnectionStatuses.EXPIRED),
|
|
326
|
-
expired_at: z2.string().optional()
|
|
327
|
-
}).catchall(z2.unknown()),
|
|
328
|
-
ComposioLinkInitiatingSchema.extend({
|
|
329
|
-
status: z2.literal(ConnectionStatuses.INACTIVE)
|
|
330
|
-
}).catchall(z2.unknown())
|
|
331
|
-
]);
|
|
332
304
|
var BillcomAuthInitiatingSchema = BaseSchemeRaw.extend({
|
|
333
305
|
status: z2.literal(ConnectionStatuses.INITIALIZING)
|
|
334
306
|
}).catchall(z2.unknown());
|
|
@@ -520,13 +492,6 @@ var ConnectionDataSchema = z2.discriminatedUnion("authScheme", [
|
|
|
520
492
|
*/
|
|
521
493
|
val: Oauth2ConnectionDataSchema
|
|
522
494
|
}),
|
|
523
|
-
z2.object({
|
|
524
|
-
authScheme: z2.literal(AuthSchemeTypes.COMPOSIO_LINK),
|
|
525
|
-
/**
|
|
526
|
-
* the main connection data discriminated by auth scheme
|
|
527
|
-
*/
|
|
528
|
-
val: ComposioLinkConnectionDataSchema
|
|
529
|
-
}),
|
|
530
495
|
z2.object({
|
|
531
496
|
authScheme: z2.literal(AuthSchemeTypes.API_KEY),
|
|
532
497
|
/**
|
|
@@ -713,10 +678,11 @@ var ToolSchema = z3.object({
|
|
|
713
678
|
description: z3.string().optional().describe("The description of the tool"),
|
|
714
679
|
inputParameters: ParametersSchema.optional().describe("The input parameters of the tool"),
|
|
715
680
|
outputParameters: ParametersSchema.optional().describe("The output parameters of the tool"),
|
|
716
|
-
tags: z3.
|
|
717
|
-
toolkit:
|
|
718
|
-
version: z3.
|
|
719
|
-
|
|
681
|
+
tags: z3.array(z3.string()).describe("The tags of the tool. eg: Important").default([]).optional(),
|
|
682
|
+
toolkit: ToolkitSchema.describe("The toolkit of the tool").optional(),
|
|
683
|
+
version: z3.string().describe('The version of the tool, e.g. "20250909_00"').optional(),
|
|
684
|
+
availableVersions: z3.array(z3.string()).describe("Available versions of the tool.").default([]).optional(),
|
|
685
|
+
scopes: z3.array(z3.string()).describe('The scopes of the tool. eg: ["task:add"]').optional()
|
|
720
686
|
});
|
|
721
687
|
var ToolListResponseSchema = z3.object({
|
|
722
688
|
items: z3.array(ToolSchema),
|
|
@@ -750,8 +716,8 @@ var ToolExecuteParamsSchema = z3.object({
|
|
|
750
716
|
customConnectionData: CustomConnectionDataSchema.optional(),
|
|
751
717
|
arguments: z3.record(z3.string(), z3.unknown()).optional(),
|
|
752
718
|
userId: z3.string().optional(),
|
|
753
|
-
//
|
|
754
|
-
version: z3.string().optional(),
|
|
719
|
+
// we have no auth apps which can be execute
|
|
720
|
+
version: z3.union([z3.literal("latest"), z3.string()]).optional(),
|
|
755
721
|
text: z3.string().optional()
|
|
756
722
|
});
|
|
757
723
|
var ToolExecuteResponseSchema = z3.object({
|
|
@@ -804,6 +770,19 @@ var getEnvVariable = (name, defaultValue = void 0) => {
|
|
|
804
770
|
return defaultValue;
|
|
805
771
|
}
|
|
806
772
|
};
|
|
773
|
+
var getEnvsWithPrefix = (prefix) => {
|
|
774
|
+
try {
|
|
775
|
+
if (process && process.env) {
|
|
776
|
+
return Object.fromEntries(
|
|
777
|
+
Object.entries(process.env).filter(([key]) => key.startsWith(prefix))
|
|
778
|
+
);
|
|
779
|
+
} else {
|
|
780
|
+
return {};
|
|
781
|
+
}
|
|
782
|
+
} catch (error) {
|
|
783
|
+
return {};
|
|
784
|
+
}
|
|
785
|
+
};
|
|
807
786
|
|
|
808
787
|
// src/utils/constants.ts
|
|
809
788
|
var COMPOSIO_DIR = ".composio";
|
|
@@ -1230,7 +1209,8 @@ var ComposioGlobalExecuteToolFnNotSetError = class extends ComposioError {
|
|
|
1230
1209
|
// src/errors/ConnectedAccountsErrors.ts
|
|
1231
1210
|
var ConnectedAccountErrorCodes = {
|
|
1232
1211
|
CONNECTED_ACCOUNT_NOT_FOUND: "CONNECTED_ACCOUNT_NOT_FOUND",
|
|
1233
|
-
MULTIPLE_CONNECTED_ACCOUNTS: "MULTIPLE_CONNECTED_ACCOUNTS"
|
|
1212
|
+
MULTIPLE_CONNECTED_ACCOUNTS: "MULTIPLE_CONNECTED_ACCOUNTS",
|
|
1213
|
+
FAILED_TO_CREATE_CONNECTED_ACCOUNT_LINK: "FAILED_TO_CREATE_CONNECTED_ACCOUNT_LINK"
|
|
1234
1214
|
};
|
|
1235
1215
|
var ComposioConnectedAccountNotFoundError = class extends ComposioError {
|
|
1236
1216
|
constructor(message = "Connected account not found", options = {}) {
|
|
@@ -1256,6 +1236,15 @@ var ComposioMultipleConnectedAccountsError = class extends ComposioError {
|
|
|
1256
1236
|
this.name = "ComposioMultipleConnectedAccountsError";
|
|
1257
1237
|
}
|
|
1258
1238
|
};
|
|
1239
|
+
var ComposioFailedToCreateConnectedAccountLink = class extends ComposioError {
|
|
1240
|
+
constructor(message = "Failed to create connected account link", options = {}) {
|
|
1241
|
+
super(message, {
|
|
1242
|
+
...options,
|
|
1243
|
+
code: ConnectedAccountErrorCodes.FAILED_TO_CREATE_CONNECTED_ACCOUNT_LINK
|
|
1244
|
+
});
|
|
1245
|
+
this.name = "ComposioFailedToCreateConnectedAccountLink";
|
|
1246
|
+
}
|
|
1247
|
+
};
|
|
1259
1248
|
|
|
1260
1249
|
// src/telemetry/Telemetry.ts
|
|
1261
1250
|
import { ComposioError as ComposioClientError } from "@composio/client";
|
|
@@ -1774,6 +1763,21 @@ var ConnectedAccountListResponseSchema = z4.object({
|
|
|
1774
1763
|
nextCursor: z4.string().nullish().describe("The next cursor to paginate through the connected accounts"),
|
|
1775
1764
|
totalPages: z4.number().describe("The total number of pages of connected accounts")
|
|
1776
1765
|
});
|
|
1766
|
+
var CreateConnectedAccountLinkOptionsSchema = z4.object({
|
|
1767
|
+
/**
|
|
1768
|
+
* The url to redirect the user to post connecting their account.
|
|
1769
|
+
*
|
|
1770
|
+
* For sucessfull connections, you will get a query param called status=success
|
|
1771
|
+
* And for failed connections you will get a query param called satus=failed
|
|
1772
|
+
*
|
|
1773
|
+
* @example https://your-app.com/callback
|
|
1774
|
+
*
|
|
1775
|
+
*/
|
|
1776
|
+
callbackUrl: z4.string().optional()
|
|
1777
|
+
});
|
|
1778
|
+
var CreateConnectedAccountLinkResponseSchema = z4.object({
|
|
1779
|
+
redirectUrl: z4.string()
|
|
1780
|
+
});
|
|
1777
1781
|
|
|
1778
1782
|
// src/utils/transform.ts
|
|
1779
1783
|
function transform(raw) {
|
|
@@ -1796,6 +1800,16 @@ function transform(raw) {
|
|
|
1796
1800
|
|
|
1797
1801
|
// src/utils/transformers/connectedAccounts.ts
|
|
1798
1802
|
function transformConnectedAccountResponse(response) {
|
|
1803
|
+
const parseState = (state) => {
|
|
1804
|
+
try {
|
|
1805
|
+
return state ? ConnectionDataSchema.parse(state) : void 0;
|
|
1806
|
+
} catch (error) {
|
|
1807
|
+
logger_default.warn("Unsupported auth scheme in connected account state, ignoring state field", {
|
|
1808
|
+
error
|
|
1809
|
+
});
|
|
1810
|
+
return void 0;
|
|
1811
|
+
}
|
|
1812
|
+
};
|
|
1799
1813
|
return transform(response).with(ConnectedAccountRetrieveResponseSchema).using((response2) => ({
|
|
1800
1814
|
...response2,
|
|
1801
1815
|
authConfig: {
|
|
@@ -1805,7 +1819,7 @@ function transformConnectedAccountResponse(response) {
|
|
|
1805
1819
|
isDisabled: response2.auth_config.is_disabled
|
|
1806
1820
|
},
|
|
1807
1821
|
data: response2.data ?? void 0,
|
|
1808
|
-
state: response2.state,
|
|
1822
|
+
state: parseState(response2.state),
|
|
1809
1823
|
status: response2.status,
|
|
1810
1824
|
statusReason: response2.status_reason,
|
|
1811
1825
|
isDisabled: response2.is_disabled,
|
|
@@ -2508,13 +2522,26 @@ var FileToolModifier = class {
|
|
|
2508
2522
|
}
|
|
2509
2523
|
};
|
|
2510
2524
|
|
|
2525
|
+
// src/utils/toolkitVersion.ts
|
|
2526
|
+
var getToolkitVersion = (toolkitSlug, toolkitVersions) => {
|
|
2527
|
+
if (typeof toolkitVersions === "string") {
|
|
2528
|
+
return toolkitVersions;
|
|
2529
|
+
}
|
|
2530
|
+
const hasToolkitVersion = toolkitVersions && Object.keys(toolkitVersions).length > 0;
|
|
2531
|
+
if (hasToolkitVersion) {
|
|
2532
|
+
return toolkitVersions[toolkitSlug] ?? "latest";
|
|
2533
|
+
}
|
|
2534
|
+
return "latest";
|
|
2535
|
+
};
|
|
2536
|
+
|
|
2511
2537
|
// src/models/Tools.ts
|
|
2512
2538
|
var Tools = class {
|
|
2513
2539
|
client;
|
|
2514
2540
|
customTools;
|
|
2515
2541
|
provider;
|
|
2516
2542
|
autoUploadDownloadFiles;
|
|
2517
|
-
|
|
2543
|
+
toolkitVersions;
|
|
2544
|
+
constructor(client, provider, config) {
|
|
2518
2545
|
if (!client) {
|
|
2519
2546
|
throw new Error("ComposioClient is required");
|
|
2520
2547
|
}
|
|
@@ -2524,7 +2551,8 @@ var Tools = class {
|
|
|
2524
2551
|
this.client = client;
|
|
2525
2552
|
this.customTools = new CustomTools(client);
|
|
2526
2553
|
this.provider = provider;
|
|
2527
|
-
this.autoUploadDownloadFiles =
|
|
2554
|
+
this.autoUploadDownloadFiles = config?.autoUploadDownloadFiles ?? true;
|
|
2555
|
+
this.toolkitVersions = config?.toolkitVersions ?? "latest";
|
|
2528
2556
|
this.execute = this.execute.bind(this);
|
|
2529
2557
|
this.provider._setExecuteToolFn(this.execute);
|
|
2530
2558
|
this.getRawComposioToolBySlug = this.getRawComposioToolBySlug.bind(this);
|
|
@@ -2546,7 +2574,8 @@ var Tools = class {
|
|
|
2546
2574
|
return ToolSchema.parse({
|
|
2547
2575
|
...tool,
|
|
2548
2576
|
inputParameters: tool.input_parameters,
|
|
2549
|
-
outputParameters: tool.output_parameters
|
|
2577
|
+
outputParameters: tool.output_parameters,
|
|
2578
|
+
availableVersions: tool.available_versions
|
|
2550
2579
|
});
|
|
2551
2580
|
}
|
|
2552
2581
|
/**
|
|
@@ -2569,46 +2598,6 @@ var Tools = class {
|
|
|
2569
2598
|
sessionInfo: response.session_info
|
|
2570
2599
|
});
|
|
2571
2600
|
}
|
|
2572
|
-
/**
|
|
2573
|
-
* Check if the connected account exists for the given tools.
|
|
2574
|
-
* @param {string} userId - The user id.
|
|
2575
|
-
* @param {ToolList} tools - The tools to check.
|
|
2576
|
-
* @returns {Promise<boolean>} True if the connected account exists for the given tools, false otherwise.
|
|
2577
|
-
*/
|
|
2578
|
-
async checkIfConnectedAccountExistsForTools(userIds, tools) {
|
|
2579
|
-
if (!tools.length) {
|
|
2580
|
-
return true;
|
|
2581
|
-
}
|
|
2582
|
-
const connectedAccounts = await this.client.connectedAccounts.list({
|
|
2583
|
-
user_ids: userIds
|
|
2584
|
-
});
|
|
2585
|
-
if (connectedAccounts.items.length === 0) {
|
|
2586
|
-
return false;
|
|
2587
|
-
}
|
|
2588
|
-
const connectedToolkitSlugs = connectedAccounts.items.reduce(
|
|
2589
|
-
(acc, account) => {
|
|
2590
|
-
if (account.toolkit.slug) {
|
|
2591
|
-
acc[account.toolkit.slug] = true;
|
|
2592
|
-
}
|
|
2593
|
-
return acc;
|
|
2594
|
-
},
|
|
2595
|
-
{}
|
|
2596
|
-
);
|
|
2597
|
-
const toolSlugs = tools.reduce(
|
|
2598
|
-
(acc, tool) => {
|
|
2599
|
-
acc[tool.slug] = true;
|
|
2600
|
-
return acc;
|
|
2601
|
-
},
|
|
2602
|
-
{}
|
|
2603
|
-
);
|
|
2604
|
-
for (const tool of Object.keys(toolSlugs)) {
|
|
2605
|
-
if (!connectedToolkitSlugs[tool]) {
|
|
2606
|
-
logger_default.warn(`Tool ${tool} requires a connected account but no connected account was found`);
|
|
2607
|
-
return false;
|
|
2608
|
-
}
|
|
2609
|
-
}
|
|
2610
|
-
return true;
|
|
2611
|
-
}
|
|
2612
2601
|
/**
|
|
2613
2602
|
* Get the connected account id for a given tool
|
|
2614
2603
|
* @param {string} userId - The user id
|
|
@@ -2734,32 +2723,59 @@ var Tools = class {
|
|
|
2734
2723
|
*
|
|
2735
2724
|
* This method fetches tools from the Composio API in raw format and combines them with
|
|
2736
2725
|
* any registered custom tools. The response can be filtered and modified as needed.
|
|
2726
|
+
* It provides access to the underlying tool data without provider-specific wrapping.
|
|
2737
2727
|
*
|
|
2738
|
-
* @param {ToolListParams}
|
|
2739
|
-
* @param {
|
|
2728
|
+
* @param {ToolListParams} query - Query parameters to filter the tools (required)
|
|
2729
|
+
* @param {GetRawComposioToolsOptions} [options] - Optional configuration for tool retrieval
|
|
2730
|
+
* @param {TransformToolSchemaModifier} [options.modifySchema] - Function to transform tool schemas
|
|
2740
2731
|
* @returns {Promise<ToolList>} List of tools matching the query criteria
|
|
2741
2732
|
*
|
|
2742
2733
|
* @example
|
|
2743
2734
|
* ```typescript
|
|
2744
|
-
* // Get
|
|
2745
|
-
* const
|
|
2735
|
+
* // Get tools from specific toolkits
|
|
2736
|
+
* const githubTools = await composio.tools.getRawComposioTools({
|
|
2737
|
+
* toolkits: ['github'],
|
|
2738
|
+
* limit: 10
|
|
2739
|
+
* });
|
|
2740
|
+
*
|
|
2741
|
+
* // Get specific tools by slug
|
|
2742
|
+
* const specificTools = await composio.tools.getRawComposioTools({
|
|
2743
|
+
* tools: ['GITHUB_GET_REPOS', 'HACKERNEWS_GET_USER']
|
|
2744
|
+
* });
|
|
2746
2745
|
*
|
|
2747
|
-
* // Get tools
|
|
2746
|
+
* // Get tools from specific toolkits
|
|
2748
2747
|
* const githubTools = await composio.tools.getRawComposioTools({
|
|
2749
2748
|
* toolkits: ['github'],
|
|
2750
2749
|
* limit: 10
|
|
2751
2750
|
* });
|
|
2752
2751
|
*
|
|
2753
2752
|
* // Get tools with schema transformation
|
|
2754
|
-
* const
|
|
2755
|
-
*
|
|
2753
|
+
* const customizedTools = await composio.tools.getRawComposioTools({
|
|
2754
|
+
* toolkits: ['github'],
|
|
2755
|
+
* limit: 5
|
|
2756
|
+
* }, {
|
|
2757
|
+
* modifySchema: ({ toolSlug, toolkitSlug, schema }) => {
|
|
2756
2758
|
* // Add custom properties to tool schema
|
|
2757
|
-
* return {
|
|
2759
|
+
* return {
|
|
2760
|
+
* ...schema,
|
|
2761
|
+
* customProperty: `Modified ${toolSlug} from ${toolkitSlug}`,
|
|
2762
|
+
* tags: [...(schema.tags || []), 'customized']
|
|
2763
|
+
* };
|
|
2758
2764
|
* }
|
|
2759
|
-
* );
|
|
2765
|
+
* });
|
|
2766
|
+
*
|
|
2767
|
+
* // Search for tools
|
|
2768
|
+
* const searchResults = await composio.tools.getRawComposioTools({
|
|
2769
|
+
* search: 'user management'
|
|
2770
|
+
* });
|
|
2771
|
+
*
|
|
2772
|
+
* // Get tools by authentication config
|
|
2773
|
+
* const authSpecificTools = await composio.tools.getRawComposioTools({
|
|
2774
|
+
* authConfigIds: ['auth_config_123']
|
|
2775
|
+
* });
|
|
2760
2776
|
* ```
|
|
2761
2777
|
*/
|
|
2762
|
-
async getRawComposioTools(query,
|
|
2778
|
+
async getRawComposioTools(query, options) {
|
|
2763
2779
|
if ("tools" in query && "toolkits" in query) {
|
|
2764
2780
|
throw new ValidationError(
|
|
2765
2781
|
"Invalid tool list parameters. You should not use tools and toolkits filter together."
|
|
@@ -2787,7 +2803,8 @@ var Tools = class {
|
|
|
2787
2803
|
..."tags" in queryParams.data ? { tags: queryParams.data.tags } : {},
|
|
2788
2804
|
..."scopes" in queryParams.data ? { scopes: queryParams.data.scopes } : {},
|
|
2789
2805
|
..."search" in queryParams.data ? { search: queryParams.data.search } : {},
|
|
2790
|
-
..."authConfigIds" in queryParams.data ? { auth_config_ids: queryParams.data.authConfigIds } : {}
|
|
2806
|
+
..."authConfigIds" in queryParams.data ? { auth_config_ids: queryParams.data.authConfigIds } : {},
|
|
2807
|
+
...{ toolkit_versions: this.toolkitVersions }
|
|
2791
2808
|
};
|
|
2792
2809
|
logger_default.debug(`Fetching tools with filters: ${JSON.stringify(filters, null, 2)}`);
|
|
2793
2810
|
const tools = await this.client.tools.list(filters);
|
|
@@ -2802,7 +2819,8 @@ var Tools = class {
|
|
|
2802
2819
|
...caseTransformedTools,
|
|
2803
2820
|
...customTools
|
|
2804
2821
|
]);
|
|
2805
|
-
if (
|
|
2822
|
+
if (options?.modifySchema) {
|
|
2823
|
+
const modifier = options.modifySchema;
|
|
2806
2824
|
if (typeof modifier === "function") {
|
|
2807
2825
|
const modifiedPromises = modifiedTools.map(
|
|
2808
2826
|
(tool) => modifier({
|
|
@@ -2819,17 +2837,56 @@ var Tools = class {
|
|
|
2819
2837
|
return modifiedTools;
|
|
2820
2838
|
}
|
|
2821
2839
|
/**
|
|
2822
|
-
* Retrieves a tool by its
|
|
2823
|
-
*
|
|
2824
|
-
*
|
|
2825
|
-
*
|
|
2840
|
+
* Retrieves a specific tool by its slug from the Composio API.
|
|
2841
|
+
*
|
|
2842
|
+
* This method fetches a single tool in raw format without provider-specific wrapping,
|
|
2843
|
+
* providing direct access to the tool's schema and metadata. Tool versions are controlled
|
|
2844
|
+
* at the Composio SDK initialization level through the `toolkitVersions` configuration.
|
|
2845
|
+
*
|
|
2846
|
+
* @param {string} slug - The unique identifier of the tool (e.g., 'GITHUB_GET_REPOS')
|
|
2847
|
+
* @param {GetRawComposioToolBySlugOptions} [options] - Optional configuration for tool retrieval
|
|
2848
|
+
* @param {TransformToolSchemaModifier} [options.modifySchema] - Function to transform the tool schema
|
|
2849
|
+
* @returns {Promise<Tool>} The requested tool with its complete schema and metadata
|
|
2826
2850
|
*
|
|
2827
2851
|
* @example
|
|
2828
|
-
* ```
|
|
2829
|
-
*
|
|
2852
|
+
* ```typescript
|
|
2853
|
+
* // Get a tool by slug
|
|
2854
|
+
* const tool = await composio.tools.getRawComposioToolBySlug('GITHUB_GET_REPOS');
|
|
2855
|
+
* console.log(tool.name, tool.description);
|
|
2856
|
+
*
|
|
2857
|
+
* // Get a tool with schema transformation
|
|
2858
|
+
* const customizedTool = await composio.tools.getRawComposioToolBySlug(
|
|
2859
|
+
* 'SLACK_SEND_MESSAGE',
|
|
2860
|
+
* {
|
|
2861
|
+
* modifySchema: ({ toolSlug, toolkitSlug, schema }) => {
|
|
2862
|
+
* return {
|
|
2863
|
+
* ...schema,
|
|
2864
|
+
* description: `Enhanced ${schema.description} with custom modifications`,
|
|
2865
|
+
* customMetadata: {
|
|
2866
|
+
* lastModified: new Date().toISOString(),
|
|
2867
|
+
* toolkit: toolkitSlug
|
|
2868
|
+
* }
|
|
2869
|
+
* };
|
|
2870
|
+
* }
|
|
2871
|
+
* }
|
|
2872
|
+
* );
|
|
2873
|
+
*
|
|
2874
|
+
* // Get a custom tool (will check custom tools first)
|
|
2875
|
+
* const customTool = await composio.tools.getRawComposioToolBySlug('MY_CUSTOM_TOOL');
|
|
2876
|
+
*
|
|
2877
|
+
* // Access tool properties
|
|
2878
|
+
* const githubTool = await composio.tools.getRawComposioToolBySlug('GITHUB_CREATE_ISSUE');
|
|
2879
|
+
* console.log({
|
|
2880
|
+
* slug: githubTool.slug,
|
|
2881
|
+
* name: githubTool.name,
|
|
2882
|
+
* toolkit: githubTool.toolkit?.name,
|
|
2883
|
+
* version: githubTool.version,
|
|
2884
|
+
* availableVersions: githubTool.availableVersions,
|
|
2885
|
+
* inputParameters: githubTool.inputParameters
|
|
2886
|
+
* });
|
|
2830
2887
|
* ```
|
|
2831
2888
|
*/
|
|
2832
|
-
async getRawComposioToolBySlug(slug,
|
|
2889
|
+
async getRawComposioToolBySlug(slug, options) {
|
|
2833
2890
|
const customTool = await this.customTools.getCustomToolBySlug(slug);
|
|
2834
2891
|
if (customTool) {
|
|
2835
2892
|
logger_default.debug(`Found ${slug} to be a custom tool`, JSON.stringify(customTool, null, 2));
|
|
@@ -2839,14 +2896,17 @@ var Tools = class {
|
|
|
2839
2896
|
}
|
|
2840
2897
|
let tool;
|
|
2841
2898
|
try {
|
|
2842
|
-
tool = await this.client.tools.retrieve(slug
|
|
2899
|
+
tool = await this.client.tools.retrieve(slug, {
|
|
2900
|
+
toolkit_versions: this.toolkitVersions
|
|
2901
|
+
});
|
|
2843
2902
|
} catch (error) {
|
|
2844
2903
|
throw new ComposioToolNotFoundError(`Unable to retrieve tool with slug ${slug}`, {
|
|
2845
2904
|
cause: error
|
|
2846
2905
|
});
|
|
2847
2906
|
}
|
|
2848
2907
|
let [modifiedTool] = await this.applyDefaultSchemaModifiers([this.transformToolCases(tool)]);
|
|
2849
|
-
if (
|
|
2908
|
+
if (options?.modifySchema) {
|
|
2909
|
+
const modifier = options.modifySchema;
|
|
2850
2910
|
if (typeof modifier === "function") {
|
|
2851
2911
|
modifiedTool = await modifier({
|
|
2852
2912
|
toolSlug: slug,
|
|
@@ -2861,20 +2921,26 @@ var Tools = class {
|
|
|
2861
2921
|
}
|
|
2862
2922
|
/**
|
|
2863
2923
|
* Get a tool or list of tools based on the provided arguments.
|
|
2864
|
-
* This is an implementation method that handles
|
|
2924
|
+
* This is an implementation method that handles all overloads.
|
|
2865
2925
|
*
|
|
2866
2926
|
* @param {string} userId - The user id to get the tool(s) for
|
|
2867
2927
|
* @param {ToolListParams | string} arg2 - Either a slug string or filters object
|
|
2868
|
-
* @param {ProviderOptions<TProvider>} [
|
|
2928
|
+
* @param {ProviderOptions<TProvider> | ToolkitVersion} [arg3] - Optional provider options or version string
|
|
2929
|
+
* @param {ProviderOptions<TProvider>} [arg4] - Optional provider options (when arg3 is version)
|
|
2869
2930
|
* @returns {Promise<TToolCollection>} The tool collection
|
|
2870
2931
|
*/
|
|
2871
|
-
async get(userId, arg2,
|
|
2932
|
+
async get(userId, arg2, arg3) {
|
|
2933
|
+
const options = arg3;
|
|
2872
2934
|
const executeToolFn = this.createExecuteToolFn(userId, options);
|
|
2873
2935
|
if (typeof arg2 === "string") {
|
|
2874
|
-
const tool = await this.getRawComposioToolBySlug(arg2,
|
|
2936
|
+
const tool = await this.getRawComposioToolBySlug(arg2, {
|
|
2937
|
+
modifySchema: options?.modifySchema
|
|
2938
|
+
});
|
|
2875
2939
|
return this.provider.wrapTools([tool], executeToolFn);
|
|
2876
2940
|
} else {
|
|
2877
|
-
const tools = await this.getRawComposioTools(arg2,
|
|
2941
|
+
const tools = await this.getRawComposioTools(arg2, {
|
|
2942
|
+
modifySchema: options?.modifySchema
|
|
2943
|
+
});
|
|
2878
2944
|
return this.provider.wrapTools(tools, executeToolFn);
|
|
2879
2945
|
}
|
|
2880
2946
|
}
|
|
@@ -2964,7 +3030,7 @@ var Tools = class {
|
|
|
2964
3030
|
custom_connection_data: body.customConnectionData,
|
|
2965
3031
|
arguments: body.arguments,
|
|
2966
3032
|
user_id: body.userId,
|
|
2967
|
-
version: body.version,
|
|
3033
|
+
version: body.version ?? getToolkitVersion(tool.toolkit?.slug ?? "unknown", this.toolkitVersions),
|
|
2968
3034
|
text: body.text
|
|
2969
3035
|
});
|
|
2970
3036
|
result = this.transformToolExecuteResponse(result);
|
|
@@ -3024,25 +3090,34 @@ var Tools = class {
|
|
|
3024
3090
|
"CustomTools not initialized. Make sure Tools class is properly constructed."
|
|
3025
3091
|
);
|
|
3026
3092
|
}
|
|
3093
|
+
const executeParams = ToolExecuteParamsSchema.safeParse(body);
|
|
3094
|
+
if (!executeParams.success) {
|
|
3095
|
+
throw new ValidationError("Invalid tool execute parameters", { cause: executeParams.error });
|
|
3096
|
+
}
|
|
3027
3097
|
try {
|
|
3028
3098
|
const customTool = await this.customTools.getCustomToolBySlug(slug);
|
|
3029
3099
|
if (customTool) {
|
|
3030
|
-
return this.handleCustomToolExecution(customTool,
|
|
3100
|
+
return this.handleCustomToolExecution(customTool, executeParams.data, modifiers);
|
|
3031
3101
|
} else {
|
|
3032
3102
|
const composioTool = await this.getRawComposioToolBySlug(slug);
|
|
3033
3103
|
if (!composioTool) {
|
|
3034
|
-
throw new ComposioToolNotFoundError(
|
|
3104
|
+
throw new ComposioToolNotFoundError(
|
|
3105
|
+
`Tool with slug ${slug} version:${executeParams.data.version} not found`
|
|
3106
|
+
);
|
|
3035
3107
|
}
|
|
3036
|
-
return this.handleComposioToolExecution(composioTool,
|
|
3108
|
+
return this.handleComposioToolExecution(composioTool, executeParams.data, modifiers);
|
|
3037
3109
|
}
|
|
3038
3110
|
} catch (error) {
|
|
3039
|
-
throw new ComposioToolExecutionError(
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3111
|
+
throw new ComposioToolExecutionError(
|
|
3112
|
+
`Error executing tool ${slug} version:${executeParams.data.version}`,
|
|
3113
|
+
{
|
|
3114
|
+
originalError: error,
|
|
3115
|
+
meta: {
|
|
3116
|
+
toolSlug: slug,
|
|
3117
|
+
body
|
|
3118
|
+
}
|
|
3044
3119
|
}
|
|
3045
|
-
|
|
3120
|
+
);
|
|
3046
3121
|
}
|
|
3047
3122
|
}
|
|
3048
3123
|
/**
|
|
@@ -3789,6 +3864,70 @@ var ConnectedAccounts = class {
|
|
|
3789
3864
|
redirectUrl
|
|
3790
3865
|
);
|
|
3791
3866
|
}
|
|
3867
|
+
/**
|
|
3868
|
+
* @description Create a Composio Connect Link for a user to connect their account to a given auth config. This method will return an external link which you can use the user to connect their account.
|
|
3869
|
+
*
|
|
3870
|
+
* @docs https://docs.composio.dev/reference/connected-accounts/create-connected-account#create-a-composio-connect-link
|
|
3871
|
+
*
|
|
3872
|
+
* @param userId {string} - The external user ID to create the connected account for.
|
|
3873
|
+
* @param authConfigId {string} - The auth config ID to create the connected account for.
|
|
3874
|
+
* @param options {CreateConnectedAccountOptions} - Options for creating a new connected account.
|
|
3875
|
+
* @param options.callbackUrl {string} - The url to redirect the user to post connecting their account.
|
|
3876
|
+
* @returns {ConnectionRequest} Connection request object
|
|
3877
|
+
*
|
|
3878
|
+
* @example
|
|
3879
|
+
* ```typescript
|
|
3880
|
+
* // create a connection request and redirect the user to the redirect url
|
|
3881
|
+
* const connectionRequest = await composio.connectedAccounts.link('user_123', 'auth_config_123');
|
|
3882
|
+
* const redirectUrl = connectionRequest.redirectUrl;
|
|
3883
|
+
* console.log(`Visit: ${redirectUrl} to authenticate your account`);
|
|
3884
|
+
*
|
|
3885
|
+
* // Wait for the connection to be established
|
|
3886
|
+
* const connectedAccount = await connectionRequest.waitForConnection()
|
|
3887
|
+
* ```
|
|
3888
|
+
*
|
|
3889
|
+
* @example
|
|
3890
|
+
* ```typescript
|
|
3891
|
+
* // create a connection request and redirect the user to the redirect url
|
|
3892
|
+
* const connectionRequest = await composio.connectedAccounts.link('user_123', 'auth_config_123', {
|
|
3893
|
+
* callbackUrl: 'https://your-app.com/callback'
|
|
3894
|
+
* });
|
|
3895
|
+
* const redirectUrl = connectionRequest.redirectUrl;
|
|
3896
|
+
* console.log(`Visit: ${redirectUrl} to authenticate your account`);
|
|
3897
|
+
*
|
|
3898
|
+
* // Wait for the connection to be established
|
|
3899
|
+
* const connectedAccount = await composio.connectedAccounts.waitForConnection(connectionRequest.id);
|
|
3900
|
+
* ```
|
|
3901
|
+
*/
|
|
3902
|
+
async link(userId, authConfigId, options) {
|
|
3903
|
+
const requestOptions = await CreateConnectedAccountLinkOptionsSchema.safeParse(options || {});
|
|
3904
|
+
if (!requestOptions.success) {
|
|
3905
|
+
throw new ValidationError("Failed to parse create connected account link options", {
|
|
3906
|
+
cause: requestOptions.error
|
|
3907
|
+
});
|
|
3908
|
+
}
|
|
3909
|
+
try {
|
|
3910
|
+
const response = await this.client.link.create({
|
|
3911
|
+
auth_config_id: authConfigId,
|
|
3912
|
+
user_id: userId,
|
|
3913
|
+
...requestOptions?.data.callbackUrl && { callback_url: requestOptions.data.callbackUrl }
|
|
3914
|
+
});
|
|
3915
|
+
const connectionRequest = createConnectionRequest(
|
|
3916
|
+
this.client,
|
|
3917
|
+
response.connected_account_id,
|
|
3918
|
+
ConnectedAccountStatuses.INITIATED,
|
|
3919
|
+
response.redirect_url
|
|
3920
|
+
);
|
|
3921
|
+
return connectionRequest;
|
|
3922
|
+
} catch (error) {
|
|
3923
|
+
throw new ComposioFailedToCreateConnectedAccountLink(
|
|
3924
|
+
"Failed to create connected account link",
|
|
3925
|
+
{
|
|
3926
|
+
cause: error
|
|
3927
|
+
}
|
|
3928
|
+
);
|
|
3929
|
+
}
|
|
3930
|
+
}
|
|
3792
3931
|
/**
|
|
3793
3932
|
* Waits for a connection request to complete and become active.
|
|
3794
3933
|
*
|
|
@@ -4200,6 +4339,7 @@ var Toolkits = class {
|
|
|
4200
4339
|
* ```typescript
|
|
4201
4340
|
* const connectionRequest = await composio.toolkits.authorize(userId, 'github');
|
|
4202
4341
|
* ```
|
|
4342
|
+
*
|
|
4203
4343
|
*/
|
|
4204
4344
|
async authorize(userId, toolkitSlug, authConfigId) {
|
|
4205
4345
|
const toolkit = await this.getToolkitBySlug(toolkitSlug);
|
|
@@ -6002,6 +6142,31 @@ function getSDKConfig(baseUrl, apiKey) {
|
|
|
6002
6142
|
logger_default.debug("Environment", `Base URL: ${baseURLParsed}`);
|
|
6003
6143
|
return { baseURL: baseURLParsed, apiKey: apiKeyParsed };
|
|
6004
6144
|
}
|
|
6145
|
+
function getToolkitVersionsFromEnv(defaultVersions) {
|
|
6146
|
+
if (defaultVersions && typeof defaultVersions === "string") {
|
|
6147
|
+
return defaultVersions;
|
|
6148
|
+
}
|
|
6149
|
+
const envPrefixedVersions = getEnvsWithPrefix(`COMPOSIO_TOOLKIT_VERSION_`);
|
|
6150
|
+
const toolkitVersionsFromEnv = Object.entries(envPrefixedVersions).reduce((acc, [key, value]) => {
|
|
6151
|
+
const toolkitName = key.replace("COMPOSIO_TOOLKIT_VERSION_", "");
|
|
6152
|
+
acc[toolkitName.toLowerCase()] = value;
|
|
6153
|
+
return acc;
|
|
6154
|
+
}, {});
|
|
6155
|
+
let userProvidedToolkitVersions = {};
|
|
6156
|
+
if (defaultVersions && typeof defaultVersions === "object") {
|
|
6157
|
+
userProvidedToolkitVersions = Object.fromEntries(
|
|
6158
|
+
Object.entries(defaultVersions).map(([key, value]) => [key.toLowerCase(), value])
|
|
6159
|
+
);
|
|
6160
|
+
}
|
|
6161
|
+
const toolkitVersions = {
|
|
6162
|
+
...toolkitVersionsFromEnv,
|
|
6163
|
+
...userProvidedToolkitVersions
|
|
6164
|
+
};
|
|
6165
|
+
if (Object.keys(toolkitVersions).length === 0) {
|
|
6166
|
+
return "latest";
|
|
6167
|
+
}
|
|
6168
|
+
return toolkitVersions;
|
|
6169
|
+
}
|
|
6005
6170
|
|
|
6006
6171
|
// src/utils/version.ts
|
|
6007
6172
|
import semver from "semver";
|
|
@@ -6523,7 +6688,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
6523
6688
|
};
|
|
6524
6689
|
|
|
6525
6690
|
// package.json
|
|
6526
|
-
var version = "0.1.
|
|
6691
|
+
var version = "0.1.52";
|
|
6527
6692
|
|
|
6528
6693
|
// src/models/Files.ts
|
|
6529
6694
|
var Files = class {
|
|
@@ -6646,7 +6811,11 @@ var Composio = class _Composio {
|
|
|
6646
6811
|
}
|
|
6647
6812
|
this.config = {
|
|
6648
6813
|
...config,
|
|
6649
|
-
|
|
6814
|
+
baseURL: baseURLParsed,
|
|
6815
|
+
apiKey: apiKeyParsed,
|
|
6816
|
+
toolkitVersions: getToolkitVersionsFromEnv(config?.toolkitVersions),
|
|
6817
|
+
allowTracking: config?.allowTracking ?? true,
|
|
6818
|
+
autoUploadDownloadFiles: config?.autoUploadDownloadFiles ?? true
|
|
6650
6819
|
};
|
|
6651
6820
|
this.provider = config?.provider ?? new OpenAIProvider();
|
|
6652
6821
|
const defaultHeaders = getDefaultHeaders(this.config.defaultHeaders, this.provider);
|
|
@@ -6656,9 +6825,7 @@ var Composio = class _Composio {
|
|
|
6656
6825
|
defaultHeaders,
|
|
6657
6826
|
logLevel: COMPOSIO_LOG_LEVEL
|
|
6658
6827
|
});
|
|
6659
|
-
this.tools = new Tools(this.client, this.provider,
|
|
6660
|
-
autoUploadDownloadFiles: config?.autoUploadDownloadFiles ?? true
|
|
6661
|
-
});
|
|
6828
|
+
this.tools = new Tools(this.client, this.provider, this.config);
|
|
6662
6829
|
this.mcp = new MCP(this.client, this.provider);
|
|
6663
6830
|
this.toolkits = new Toolkits(this.client);
|
|
6664
6831
|
this.triggers = new Triggers(this.client);
|
|
@@ -6692,6 +6859,13 @@ var Composio = class _Composio {
|
|
|
6692
6859
|
}
|
|
6693
6860
|
return this.client;
|
|
6694
6861
|
}
|
|
6862
|
+
/**
|
|
6863
|
+
* Get the configuration SDK is initialized with
|
|
6864
|
+
* @returns {ComposioConfig<TProvider>} The configuration SDK is initialized with
|
|
6865
|
+
*/
|
|
6866
|
+
getConfig() {
|
|
6867
|
+
return this.config;
|
|
6868
|
+
}
|
|
6695
6869
|
/**
|
|
6696
6870
|
* Creates a new instance of the Composio SDK with custom request options while preserving the existing configuration.
|
|
6697
6871
|
* This method is particularly useful when you need to:
|
|
@@ -6811,19 +6985,6 @@ var AuthScheme = class {
|
|
|
6811
6985
|
}
|
|
6812
6986
|
};
|
|
6813
6987
|
}
|
|
6814
|
-
/**
|
|
6815
|
-
* Creates a ConnectionData object for Composio Link authentication
|
|
6816
|
-
* @returns ConnectionData object
|
|
6817
|
-
*/
|
|
6818
|
-
static ComposioLink(params) {
|
|
6819
|
-
return {
|
|
6820
|
-
authScheme: AuthSchemeTypes.COMPOSIO_LINK,
|
|
6821
|
-
val: {
|
|
6822
|
-
status: ConnectionStatuses.INITIALIZING,
|
|
6823
|
-
...params ?? {}
|
|
6824
|
-
}
|
|
6825
|
-
};
|
|
6826
|
-
}
|
|
6827
6988
|
/**
|
|
6828
6989
|
* Creates a ConnectionData object for API Key authentication
|
|
6829
6990
|
* @param params The API key parameters
|
|
@@ -6958,12 +7119,12 @@ export {
|
|
|
6958
7119
|
ComposioCustomCreateResponseSchema,
|
|
6959
7120
|
ComposioCustomToolsNotInitializedError,
|
|
6960
7121
|
ComposioError,
|
|
7122
|
+
ComposioFailedToCreateConnectedAccountLink,
|
|
6961
7123
|
ComposioGenerateURLParamsSchema,
|
|
6962
7124
|
ComposioGenerateURLResponseSchema,
|
|
6963
7125
|
ComposioGlobalExecuteToolFnNotSetError,
|
|
6964
7126
|
ComposioInvalidExecuteFunctionError,
|
|
6965
7127
|
ComposioInvalidModifierError,
|
|
6966
|
-
ComposioLinkConnectionDataSchema,
|
|
6967
7128
|
ComposioMcpDeleteResponseSchema,
|
|
6968
7129
|
ComposioMcpListResponseSchema,
|
|
6969
7130
|
ComposioMcpRetrieveResponseSchema,
|
|
@@ -6992,6 +7153,8 @@ export {
|
|
|
6992
7153
|
CreateAuthConfigParamsSchema,
|
|
6993
7154
|
CreateAuthConfigResponseSchema,
|
|
6994
7155
|
CreateComposioManagedAuthConfigParamsSchema,
|
|
7156
|
+
CreateConnectedAccountLinkOptionsSchema,
|
|
7157
|
+
CreateConnectedAccountLinkResponseSchema,
|
|
6995
7158
|
CreateConnectedAccountOptionsSchema,
|
|
6996
7159
|
CreateConnectedAccountParamsSchema,
|
|
6997
7160
|
CreateConnectedAccountResponseSchema,
|