@composio/core 0.1.36-next.9 → 0.1.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +1348 -941
- package/dist/index.d.cts +43280 -11701
- package/dist/index.d.ts +43280 -11701
- package/dist/index.js +1336 -935
- package/package.json +6 -5
- 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 -14
- package/generated/gmail.js +0 -14
- package/generated/gmail.ts +0 -34
- 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 -57
- package/generated/index.js +0 -32
- package/generated/index.ts +0 -988
- 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 -8
- package/generated/slack.js +0 -8
- package/generated/slack.ts +0 -205
- 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
|
@@ -14,13 +14,603 @@ var __export = (target, all) => {
|
|
|
14
14
|
import ComposioClient4 from "@composio/client";
|
|
15
15
|
|
|
16
16
|
// src/types/tool.types.ts
|
|
17
|
+
import { z as z3 } from "zod";
|
|
18
|
+
|
|
19
|
+
// src/types/connectedAccountAuthStates.types.ts
|
|
20
|
+
import { z as z2 } from "zod";
|
|
21
|
+
|
|
22
|
+
// src/types/authConfigs.types.ts
|
|
17
23
|
import { z } from "zod";
|
|
18
|
-
var
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
24
|
+
var AuthConfigTypes = {
|
|
25
|
+
CUSTOM: "use_custom_auth",
|
|
26
|
+
COMPOSIO_MANAGED: "use_composio_managed_auth"
|
|
27
|
+
};
|
|
28
|
+
var AuthSchemeTypes = {
|
|
29
|
+
OAUTH1: "OAUTH1",
|
|
30
|
+
OAUTH2: "OAUTH2",
|
|
31
|
+
API_KEY: "API_KEY",
|
|
32
|
+
BASIC: "BASIC",
|
|
33
|
+
BEARER_TOKEN: "BEARER_TOKEN",
|
|
34
|
+
BILLCOM_AUTH: "BILLCOM_AUTH",
|
|
35
|
+
GOOGLE_SERVICE_ACCOUNT: "GOOGLE_SERVICE_ACCOUNT",
|
|
36
|
+
NO_AUTH: "NO_AUTH",
|
|
37
|
+
BASIC_WITH_JWT: "BASIC_WITH_JWT",
|
|
38
|
+
COMPOSIO_LINK: "COMPOSIO_LINK",
|
|
39
|
+
CALCOM_AUTH: "CALCOM_AUTH"
|
|
40
|
+
};
|
|
41
|
+
var AuthSchemeEnum = z.enum([
|
|
42
|
+
"OAUTH2",
|
|
43
|
+
"OAUTH1",
|
|
44
|
+
"API_KEY",
|
|
45
|
+
"BASIC",
|
|
46
|
+
"BILLCOM_AUTH",
|
|
47
|
+
"BEARER_TOKEN",
|
|
48
|
+
"GOOGLE_SERVICE_ACCOUNT",
|
|
49
|
+
"NO_AUTH",
|
|
50
|
+
"BASIC_WITH_JWT",
|
|
51
|
+
"COMPOSIO_LINK",
|
|
52
|
+
"CALCOM_AUTH"
|
|
53
|
+
]);
|
|
54
|
+
var CreateCustomAuthConfigParamsSchema = z.object({
|
|
55
|
+
type: z.literal("use_custom_auth"),
|
|
56
|
+
name: z.string().optional(),
|
|
57
|
+
credentials: z.record(z.string(), z.union([z.string(), z.number(), z.boolean()])),
|
|
58
|
+
authScheme: AuthSchemeEnum,
|
|
59
|
+
restrictToFollowingTools: z.array(z.string()).optional()
|
|
60
|
+
});
|
|
61
|
+
var CreateComposioManagedAuthConfigParamsSchema = z.object({
|
|
62
|
+
type: z.literal("use_composio_managed_auth"),
|
|
63
|
+
name: z.string().optional(),
|
|
64
|
+
credentials: z.record(z.string(), z.union([z.string(), z.number(), z.boolean()])).optional(),
|
|
65
|
+
restrictToFollowingTools: z.array(z.string()).optional()
|
|
66
|
+
});
|
|
67
|
+
var CreateAuthConfigParamsSchema = z.discriminatedUnion("type", [
|
|
68
|
+
CreateCustomAuthConfigParamsSchema,
|
|
69
|
+
CreateComposioManagedAuthConfigParamsSchema
|
|
70
|
+
]);
|
|
71
|
+
var CreateAuthConfigResponseSchema = z.object({
|
|
72
|
+
id: z.string(),
|
|
73
|
+
authScheme: z.string(),
|
|
74
|
+
isComposioManaged: z.boolean(),
|
|
75
|
+
toolkit: z.string()
|
|
76
|
+
});
|
|
77
|
+
var AuthConfigRetrieveResponseSchema = z.object({
|
|
78
|
+
id: z.string(),
|
|
79
|
+
name: z.string(),
|
|
80
|
+
toolkit: z.object({
|
|
81
|
+
logo: z.string(),
|
|
82
|
+
slug: z.string()
|
|
83
|
+
}),
|
|
84
|
+
noOfConnections: z.number(),
|
|
85
|
+
status: z.enum(["ENABLED", "DISABLED"]),
|
|
86
|
+
uuid: z.string(),
|
|
87
|
+
authScheme: AuthSchemeEnum.optional(),
|
|
88
|
+
credentials: z.record(z.string(), z.unknown()).optional(),
|
|
89
|
+
expectedInputFields: z.array(z.unknown()).optional(),
|
|
90
|
+
restrictToFollowingTools: z.array(z.string()).optional(),
|
|
91
|
+
isComposioManaged: z.boolean().optional(),
|
|
92
|
+
createdBy: z.string().optional(),
|
|
93
|
+
createdAt: z.string().optional(),
|
|
94
|
+
lastUpdatedAt: z.string().optional()
|
|
95
|
+
});
|
|
96
|
+
var AuthConfigListParamsSchema = z.object({
|
|
97
|
+
cursor: z.string().optional(),
|
|
98
|
+
isComposioManaged: z.boolean().optional(),
|
|
99
|
+
limit: z.number().optional(),
|
|
100
|
+
toolkit: z.string().optional()
|
|
101
|
+
});
|
|
102
|
+
var AuthConfigListResponseSchema = z.object({
|
|
103
|
+
items: z.array(AuthConfigRetrieveResponseSchema),
|
|
104
|
+
nextCursor: z.string().nullable(),
|
|
105
|
+
totalPages: z.number()
|
|
106
|
+
});
|
|
107
|
+
var AuthCustomConfigUpdateParamsSchema = z.object({
|
|
108
|
+
credentials: z.record(z.string(), z.union([z.string(), z.unknown()])),
|
|
109
|
+
type: z.literal("custom"),
|
|
110
|
+
restrictToFollowingTools: z.array(z.string()).optional()
|
|
111
|
+
});
|
|
112
|
+
var AuthDefaultConfigUpdateParamsSchema = z.object({
|
|
113
|
+
scopes: z.string(),
|
|
114
|
+
type: z.literal("default"),
|
|
115
|
+
restrictToFollowingTools: z.array(z.string()).optional()
|
|
116
|
+
});
|
|
117
|
+
var AuthConfigUpdateParamsSchema = z.discriminatedUnion("type", [
|
|
118
|
+
AuthCustomConfigUpdateParamsSchema,
|
|
119
|
+
AuthDefaultConfigUpdateParamsSchema
|
|
120
|
+
]);
|
|
121
|
+
|
|
122
|
+
// src/types/connectedAccountAuthStates.types.ts
|
|
123
|
+
var ConnectionStatuses = {
|
|
124
|
+
INITIALIZING: "INITIALIZING",
|
|
125
|
+
INITIATED: "INITIATED",
|
|
126
|
+
ACTIVE: "ACTIVE",
|
|
127
|
+
FAILED: "FAILED",
|
|
128
|
+
EXPIRED: "EXPIRED",
|
|
129
|
+
INACTIVE: "INACTIVE"
|
|
130
|
+
};
|
|
131
|
+
var RedirectableAuthSchemeSchema = z2.enum([
|
|
132
|
+
AuthSchemeTypes.OAUTH1,
|
|
133
|
+
AuthSchemeTypes.OAUTH2,
|
|
134
|
+
AuthSchemeTypes.COMPOSIO_LINK
|
|
135
|
+
]);
|
|
136
|
+
var BaseSchemeRaw = z2.object({
|
|
137
|
+
// for posthog, freshdesk, zendesk, clickup and others
|
|
138
|
+
subdomain: z2.string().optional(),
|
|
139
|
+
// for atlassian
|
|
140
|
+
["your-domain"]: z2.string().optional(),
|
|
141
|
+
// for mixpanel
|
|
142
|
+
region: z2.string().optional(),
|
|
143
|
+
// for shopify
|
|
144
|
+
shop: z2.string().optional(),
|
|
145
|
+
// for snowflake
|
|
146
|
+
account_url: z2.string().optional(),
|
|
147
|
+
// likely pipedrive
|
|
148
|
+
COMPANYDOMAIN: z2.string().optional(),
|
|
149
|
+
// likely zoho
|
|
150
|
+
extension: z2.string().optional(),
|
|
151
|
+
// likely formsite
|
|
152
|
+
form_api_base_url: z2.string().optional(),
|
|
153
|
+
// likely salesforce
|
|
154
|
+
instanceEndpoint: z2.string().optional(),
|
|
155
|
+
// likely active campaign
|
|
156
|
+
api_url: z2.string().optional(),
|
|
157
|
+
// for borneo
|
|
158
|
+
borneo_dashboard_url: z2.string().optional(),
|
|
159
|
+
// for zenrows proxy
|
|
160
|
+
proxy_username: z2.string().optional(),
|
|
161
|
+
proxy_password: z2.string().optional(),
|
|
162
|
+
// for d2l
|
|
163
|
+
domain: z2.string().optional(),
|
|
164
|
+
version: z2.string().optional(),
|
|
165
|
+
// for mailchimp
|
|
166
|
+
dc: z2.string().optional(),
|
|
167
|
+
// for sharepoint
|
|
168
|
+
site_name: z2.string().optional(),
|
|
169
|
+
// for servicenow
|
|
170
|
+
instanceName: z2.string().optional(),
|
|
171
|
+
// for netsuite
|
|
172
|
+
account_id: z2.string().optional(),
|
|
173
|
+
// for custom servers
|
|
174
|
+
your_server: z2.string().optional(),
|
|
175
|
+
// for ragic
|
|
176
|
+
server_location: z2.string().optional(),
|
|
177
|
+
// base_url only
|
|
178
|
+
base_url: z2.string().optional(),
|
|
179
|
+
// for api key
|
|
180
|
+
api_key: z2.string().optional(),
|
|
181
|
+
// for generic api key
|
|
182
|
+
generic_api_key: z2.string().optional()
|
|
183
|
+
}).catchall(z2.unknown());
|
|
184
|
+
var Oauth2InitiatingConnectionDataSchema = BaseSchemeRaw.extend({
|
|
185
|
+
status: z2.literal(ConnectionStatuses.INITIALIZING)
|
|
186
|
+
}).catchall(z2.unknown());
|
|
187
|
+
var Oauth2InitiatedConnectionDataSchema = Oauth2InitiatingConnectionDataSchema.extend({
|
|
188
|
+
status: z2.literal(ConnectionStatuses.INITIATED),
|
|
189
|
+
code_verifier: z2.string().optional(),
|
|
190
|
+
redirectUrl: z2.string(),
|
|
191
|
+
callback_url: z2.string().optional(),
|
|
192
|
+
finalRedirectUri: z2.string().optional(),
|
|
193
|
+
// previously verification_token, will be sent as verification_token to slack
|
|
194
|
+
webhook_signature: z2.string().optional()
|
|
195
|
+
}).catchall(z2.unknown());
|
|
196
|
+
var Oauth2ActiveConnectionDataSchema = Oauth2InitiatingConnectionDataSchema.extend({
|
|
197
|
+
status: z2.literal(ConnectionStatuses.ACTIVE),
|
|
198
|
+
access_token: z2.string().optional(),
|
|
199
|
+
id_token: z2.string().optional(),
|
|
200
|
+
token_type: z2.string().optional(),
|
|
201
|
+
refresh_token: z2.string().nullish(),
|
|
202
|
+
expires_in: z2.union([z2.string(), z2.number(), z2.null()]).optional(),
|
|
203
|
+
scope: z2.union([z2.string(), z2.array(z2.string())]).optional(),
|
|
204
|
+
// previously verification_token, will be sent as verification_token to slack
|
|
205
|
+
webhook_signature: z2.string().optional(),
|
|
206
|
+
authed_user: z2.object({
|
|
207
|
+
access_token: z2.string().optional(),
|
|
208
|
+
scope: z2.string().optional()
|
|
209
|
+
}).optional().describe("for slack user scopes")
|
|
210
|
+
}).catchall(z2.unknown());
|
|
211
|
+
var Oauth2FailedConnectionDataSchema = Oauth2InitiatingConnectionDataSchema.extend({
|
|
212
|
+
status: z2.literal(ConnectionStatuses.FAILED),
|
|
213
|
+
error: z2.string().optional(),
|
|
214
|
+
error_description: z2.string().optional()
|
|
215
|
+
}).catchall(z2.unknown());
|
|
216
|
+
var Oauth2ExpiredConnectionDataSchema = Oauth2InitiatingConnectionDataSchema.extend({
|
|
217
|
+
status: z2.literal(ConnectionStatuses.EXPIRED),
|
|
218
|
+
expired_at: z2.string().optional()
|
|
219
|
+
}).catchall(z2.unknown());
|
|
220
|
+
var Oauth2InactiveConnectionDataSchema = Oauth2InitiatingConnectionDataSchema.extend({
|
|
221
|
+
status: z2.literal(ConnectionStatuses.INACTIVE)
|
|
222
|
+
}).catchall(z2.unknown());
|
|
223
|
+
var Oauth2ConnectionDataSchema = z2.discriminatedUnion("status", [
|
|
224
|
+
Oauth2InitiatingConnectionDataSchema,
|
|
225
|
+
Oauth2InitiatedConnectionDataSchema,
|
|
226
|
+
Oauth2ActiveConnectionDataSchema,
|
|
227
|
+
Oauth2FailedConnectionDataSchema,
|
|
228
|
+
Oauth2ExpiredConnectionDataSchema,
|
|
229
|
+
Oauth2InactiveConnectionDataSchema
|
|
230
|
+
]);
|
|
231
|
+
var CustomOauth2ConnectionDataSchema = Oauth2ActiveConnectionDataSchema.omit({
|
|
232
|
+
status: true,
|
|
233
|
+
access_token: true
|
|
234
|
+
}).extend({
|
|
235
|
+
access_token: z2.string()
|
|
236
|
+
});
|
|
237
|
+
var Oauth1InitiatingConnectionDataSchema = BaseSchemeRaw.extend({
|
|
238
|
+
status: z2.literal(ConnectionStatuses.INITIALIZING)
|
|
239
|
+
}).catchall(z2.unknown());
|
|
240
|
+
var Oauth1InitiatedConnectionDataSchema = Oauth1InitiatingConnectionDataSchema.extend({
|
|
241
|
+
status: z2.literal(ConnectionStatuses.INITIATED),
|
|
242
|
+
oauth_token: z2.string().optional(),
|
|
243
|
+
authUri: z2.string().optional(),
|
|
244
|
+
oauth_token_secret: z2.string().optional(),
|
|
245
|
+
redirectUrl: z2.string().optional(),
|
|
246
|
+
callbackUrl: z2.string().optional()
|
|
247
|
+
}).catchall(z2.unknown());
|
|
248
|
+
var Oauth1ActiveConnectionDataSchema = Oauth1InitiatingConnectionDataSchema.extend({
|
|
249
|
+
status: z2.literal(ConnectionStatuses.ACTIVE),
|
|
250
|
+
oauth_token: z2.string().optional(),
|
|
251
|
+
consumer_key: z2.string().optional(),
|
|
252
|
+
redirectUrl: z2.string().optional(),
|
|
253
|
+
callback_url: z2.string().optional()
|
|
254
|
+
}).catchall(z2.unknown());
|
|
255
|
+
var Oauth1FailedConnectionDataSchema = Oauth1InitiatingConnectionDataSchema.extend({
|
|
256
|
+
status: z2.literal(ConnectionStatuses.FAILED),
|
|
257
|
+
error: z2.string().optional(),
|
|
258
|
+
error_description: z2.string().optional()
|
|
259
|
+
}).catchall(z2.unknown());
|
|
260
|
+
var Oauth1ExpiredConnectionDataSchema = Oauth1InitiatingConnectionDataSchema.extend({
|
|
261
|
+
status: z2.literal(ConnectionStatuses.EXPIRED),
|
|
262
|
+
expired_at: z2.string().optional()
|
|
263
|
+
}).catchall(z2.unknown());
|
|
264
|
+
var Oauth1InactiveConnectionDataSchema = Oauth1InitiatingConnectionDataSchema.extend({
|
|
265
|
+
status: z2.literal(ConnectionStatuses.INACTIVE)
|
|
266
|
+
}).catchall(z2.unknown());
|
|
267
|
+
var Oauth1ConnectionDataSchema = z2.discriminatedUnion("status", [
|
|
268
|
+
Oauth1InitiatingConnectionDataSchema,
|
|
269
|
+
Oauth1InitiatedConnectionDataSchema,
|
|
270
|
+
Oauth1ActiveConnectionDataSchema,
|
|
271
|
+
Oauth1FailedConnectionDataSchema,
|
|
272
|
+
Oauth1ExpiredConnectionDataSchema,
|
|
273
|
+
Oauth1InactiveConnectionDataSchema
|
|
274
|
+
]);
|
|
275
|
+
var CustomOauth1ConnectionDataSchema = Oauth1ActiveConnectionDataSchema.omit({
|
|
276
|
+
status: true,
|
|
277
|
+
oauth_token: true
|
|
278
|
+
}).extend({
|
|
279
|
+
oauth_token_secret: z2.string(),
|
|
280
|
+
oauth_token: z2.string()
|
|
281
|
+
});
|
|
282
|
+
var ComposioLinkInitiatingSchema = BaseSchemeRaw.extend({
|
|
283
|
+
status: z2.literal(ConnectionStatuses.INITIALIZING)
|
|
284
|
+
}).catchall(z2.unknown());
|
|
285
|
+
var ComposioLinkConnectionDataSchema = z2.discriminatedUnion("status", [
|
|
286
|
+
ComposioLinkInitiatingSchema,
|
|
287
|
+
ComposioLinkInitiatingSchema.extend({
|
|
288
|
+
status: z2.literal(ConnectionStatuses.INITIATED),
|
|
289
|
+
redirectUrl: z2.string()
|
|
290
|
+
}).catchall(z2.unknown()),
|
|
291
|
+
ComposioLinkInitiatingSchema.extend({
|
|
292
|
+
status: z2.literal(ConnectionStatuses.ACTIVE)
|
|
293
|
+
}).catchall(z2.unknown()),
|
|
294
|
+
ComposioLinkInitiatingSchema.extend({
|
|
295
|
+
status: z2.literal(ConnectionStatuses.FAILED),
|
|
296
|
+
error: z2.string().optional(),
|
|
297
|
+
error_description: z2.string().optional()
|
|
298
|
+
}).catchall(z2.unknown()),
|
|
299
|
+
ComposioLinkInitiatingSchema.extend({
|
|
300
|
+
status: z2.literal(ConnectionStatuses.EXPIRED),
|
|
301
|
+
expired_at: z2.string().optional()
|
|
302
|
+
}).catchall(z2.unknown()),
|
|
303
|
+
ComposioLinkInitiatingSchema.extend({
|
|
304
|
+
status: z2.literal(ConnectionStatuses.INACTIVE)
|
|
305
|
+
}).catchall(z2.unknown())
|
|
306
|
+
]);
|
|
307
|
+
var BillcomAuthInitiatingSchema = BaseSchemeRaw.extend({
|
|
308
|
+
status: z2.literal(ConnectionStatuses.INITIALIZING)
|
|
309
|
+
}).catchall(z2.unknown());
|
|
310
|
+
var BillcomAuthConnectionDataSchema = z2.discriminatedUnion("status", [
|
|
311
|
+
BillcomAuthInitiatingSchema,
|
|
312
|
+
BillcomAuthInitiatingSchema.extend({
|
|
313
|
+
status: z2.literal(ConnectionStatuses.INITIATED),
|
|
314
|
+
redirectUrl: z2.string()
|
|
315
|
+
}).catchall(z2.unknown()),
|
|
316
|
+
BillcomAuthInitiatingSchema.extend({
|
|
317
|
+
status: z2.literal(ConnectionStatuses.ACTIVE),
|
|
318
|
+
sessionId: z2.string(),
|
|
319
|
+
devKey: z2.string()
|
|
320
|
+
}).catchall(z2.unknown()),
|
|
321
|
+
BillcomAuthInitiatingSchema.extend({
|
|
322
|
+
status: z2.literal(ConnectionStatuses.FAILED),
|
|
323
|
+
error: z2.string().optional(),
|
|
324
|
+
error_description: z2.string().optional()
|
|
325
|
+
}).catchall(z2.unknown()),
|
|
326
|
+
BillcomAuthInitiatingSchema.extend({
|
|
327
|
+
status: z2.literal(ConnectionStatuses.EXPIRED),
|
|
328
|
+
expired_at: z2.string().optional()
|
|
329
|
+
}).catchall(z2.unknown()),
|
|
330
|
+
BillcomAuthInitiatingSchema.extend({
|
|
331
|
+
status: z2.literal(ConnectionStatuses.INACTIVE)
|
|
332
|
+
}).catchall(z2.unknown())
|
|
333
|
+
]);
|
|
334
|
+
var BasicInitiatingSchema = BaseSchemeRaw.extend({
|
|
335
|
+
status: z2.literal(ConnectionStatuses.ACTIVE),
|
|
336
|
+
username: z2.string(),
|
|
337
|
+
password: z2.string()
|
|
338
|
+
}).catchall(z2.unknown());
|
|
339
|
+
var BasicConnectionDataSchema = z2.discriminatedUnion("status", [
|
|
340
|
+
BasicInitiatingSchema,
|
|
341
|
+
BasicInitiatingSchema.extend({
|
|
342
|
+
status: z2.literal(ConnectionStatuses.INACTIVE)
|
|
343
|
+
}).catchall(z2.unknown()),
|
|
344
|
+
BasicInitiatingSchema.extend({
|
|
345
|
+
status: z2.literal(ConnectionStatuses.FAILED),
|
|
346
|
+
error: z2.string().optional(),
|
|
347
|
+
error_description: z2.string().optional()
|
|
348
|
+
}).catchall(z2.unknown()),
|
|
349
|
+
BasicInitiatingSchema.extend({
|
|
350
|
+
status: z2.literal(ConnectionStatuses.EXPIRED),
|
|
351
|
+
expired_at: z2.string().optional()
|
|
352
|
+
}).catchall(z2.unknown())
|
|
353
|
+
]);
|
|
354
|
+
var CustomBasicConnectionDataSchema = BasicInitiatingSchema.omit({
|
|
355
|
+
status: true
|
|
356
|
+
});
|
|
357
|
+
var ApiKeyInitiatingSchema = BaseSchemeRaw.extend({
|
|
358
|
+
status: z2.literal(ConnectionStatuses.ACTIVE),
|
|
359
|
+
api_key: z2.string().optional(),
|
|
360
|
+
generic_api_key: z2.string().optional()
|
|
361
|
+
}).catchall(z2.unknown());
|
|
362
|
+
var ApiKeyConnectionDataSchema = z2.discriminatedUnion("status", [
|
|
363
|
+
ApiKeyInitiatingSchema,
|
|
364
|
+
ApiKeyInitiatingSchema.extend({
|
|
365
|
+
status: z2.literal(ConnectionStatuses.INACTIVE)
|
|
366
|
+
}).catchall(z2.unknown()),
|
|
367
|
+
ApiKeyInitiatingSchema.extend({
|
|
368
|
+
status: z2.literal(ConnectionStatuses.FAILED),
|
|
369
|
+
error: z2.string().optional(),
|
|
370
|
+
error_description: z2.string().optional()
|
|
371
|
+
}).catchall(z2.unknown()),
|
|
372
|
+
ApiKeyInitiatingSchema.extend({
|
|
373
|
+
status: z2.literal(ConnectionStatuses.EXPIRED),
|
|
374
|
+
expired_at: z2.string().optional()
|
|
375
|
+
}).catchall(z2.unknown())
|
|
376
|
+
]);
|
|
377
|
+
var CustomApiKeyConnectionDataSchema = ApiKeyInitiatingSchema.omit({
|
|
378
|
+
status: true
|
|
379
|
+
});
|
|
380
|
+
var BearerTokenInitiatingSchema = BaseSchemeRaw.extend({
|
|
381
|
+
status: z2.literal(ConnectionStatuses.ACTIVE),
|
|
382
|
+
token: z2.string()
|
|
383
|
+
}).catchall(z2.unknown());
|
|
384
|
+
var BearerTokenConnectionDataSchema = z2.discriminatedUnion("status", [
|
|
385
|
+
BearerTokenInitiatingSchema,
|
|
386
|
+
BearerTokenInitiatingSchema.extend({
|
|
387
|
+
status: z2.literal(ConnectionStatuses.INACTIVE)
|
|
388
|
+
}).catchall(z2.unknown()),
|
|
389
|
+
BearerTokenInitiatingSchema.extend({
|
|
390
|
+
status: z2.literal(ConnectionStatuses.FAILED),
|
|
391
|
+
error: z2.string().optional(),
|
|
392
|
+
error_description: z2.string().optional()
|
|
393
|
+
}).catchall(z2.unknown()),
|
|
394
|
+
BearerTokenInitiatingSchema.extend({
|
|
395
|
+
status: z2.literal(ConnectionStatuses.EXPIRED),
|
|
396
|
+
expired_at: z2.string().optional()
|
|
397
|
+
}).catchall(z2.unknown())
|
|
398
|
+
]);
|
|
399
|
+
var CustomBearerTokenConnectionDataSchema = BearerTokenInitiatingSchema.omit({
|
|
400
|
+
status: true
|
|
401
|
+
});
|
|
402
|
+
var GoogleServiceAccountInitiatingSchema = BaseSchemeRaw.extend({
|
|
403
|
+
status: z2.literal(ConnectionStatuses.ACTIVE),
|
|
404
|
+
credentials_json: z2.string()
|
|
405
|
+
}).catchall(z2.unknown());
|
|
406
|
+
var GoogleServiceAccountConnectionDataSchema = z2.discriminatedUnion("status", [
|
|
407
|
+
GoogleServiceAccountInitiatingSchema,
|
|
408
|
+
GoogleServiceAccountInitiatingSchema.extend({
|
|
409
|
+
status: z2.literal(ConnectionStatuses.INACTIVE)
|
|
410
|
+
}).catchall(z2.unknown()),
|
|
411
|
+
GoogleServiceAccountInitiatingSchema.extend({
|
|
412
|
+
status: z2.literal(ConnectionStatuses.FAILED),
|
|
413
|
+
error: z2.string().optional(),
|
|
414
|
+
error_description: z2.string().optional()
|
|
415
|
+
}).catchall(z2.unknown()),
|
|
416
|
+
GoogleServiceAccountInitiatingSchema.extend({
|
|
417
|
+
status: z2.literal(ConnectionStatuses.EXPIRED),
|
|
418
|
+
expired_at: z2.string().optional()
|
|
419
|
+
}).catchall(z2.unknown())
|
|
420
|
+
]);
|
|
421
|
+
var NoAuthInitiatingSchema = BaseSchemeRaw.extend({
|
|
422
|
+
status: z2.literal(ConnectionStatuses.ACTIVE)
|
|
423
|
+
}).catchall(z2.unknown());
|
|
424
|
+
var NoAuthConnectionDataSchema = z2.discriminatedUnion("status", [
|
|
425
|
+
NoAuthInitiatingSchema,
|
|
426
|
+
NoAuthInitiatingSchema.extend({
|
|
427
|
+
status: z2.literal(ConnectionStatuses.INACTIVE)
|
|
428
|
+
}).catchall(z2.unknown()),
|
|
429
|
+
NoAuthInitiatingSchema.extend({
|
|
430
|
+
status: z2.literal(ConnectionStatuses.FAILED),
|
|
431
|
+
error: z2.string().optional(),
|
|
432
|
+
error_description: z2.string().optional()
|
|
433
|
+
}).catchall(z2.unknown()),
|
|
434
|
+
NoAuthInitiatingSchema.extend({
|
|
435
|
+
status: z2.literal(ConnectionStatuses.EXPIRED),
|
|
436
|
+
expired_at: z2.string().optional()
|
|
437
|
+
}).catchall(z2.unknown())
|
|
438
|
+
]);
|
|
439
|
+
var CustomNoAuthConnectionDataSchema = NoAuthInitiatingSchema.omit({
|
|
440
|
+
status: true
|
|
441
|
+
});
|
|
442
|
+
var CalcomAuthInitiatingSchema = BaseSchemeRaw.extend({
|
|
443
|
+
status: z2.literal(ConnectionStatuses.ACTIVE)
|
|
444
|
+
}).catchall(z2.unknown());
|
|
445
|
+
var CalcomAuthConnectionDataSchema = z2.discriminatedUnion("status", [
|
|
446
|
+
CalcomAuthInitiatingSchema,
|
|
447
|
+
CalcomAuthInitiatingSchema.extend({
|
|
448
|
+
status: z2.literal(ConnectionStatuses.INACTIVE)
|
|
449
|
+
}).catchall(z2.unknown()),
|
|
450
|
+
CalcomAuthInitiatingSchema.extend({
|
|
451
|
+
status: z2.literal(ConnectionStatuses.FAILED),
|
|
452
|
+
error: z2.string().optional(),
|
|
453
|
+
error_description: z2.string().optional()
|
|
454
|
+
}).catchall(z2.unknown()),
|
|
455
|
+
CalcomAuthInitiatingSchema.extend({
|
|
456
|
+
status: z2.literal(ConnectionStatuses.EXPIRED),
|
|
457
|
+
expired_at: z2.string().optional()
|
|
458
|
+
}).catchall(z2.unknown())
|
|
459
|
+
]);
|
|
460
|
+
var BasicWithJwtInitiatingSchema = BaseSchemeRaw.extend({
|
|
461
|
+
status: z2.literal(ConnectionStatuses.ACTIVE),
|
|
462
|
+
username: z2.string(),
|
|
463
|
+
password: z2.string()
|
|
464
|
+
}).catchall(z2.unknown());
|
|
465
|
+
var BasicWithJwtConnectionDataSchema = z2.discriminatedUnion("status", [
|
|
466
|
+
BasicWithJwtInitiatingSchema,
|
|
467
|
+
BasicWithJwtInitiatingSchema.extend({
|
|
468
|
+
status: z2.literal(ConnectionStatuses.INACTIVE)
|
|
469
|
+
}).catchall(z2.unknown()),
|
|
470
|
+
BasicWithJwtInitiatingSchema.extend({
|
|
471
|
+
status: z2.literal(ConnectionStatuses.FAILED),
|
|
472
|
+
error: z2.string().optional(),
|
|
473
|
+
error_description: z2.string().optional()
|
|
474
|
+
}).catchall(z2.unknown()),
|
|
475
|
+
BasicWithJwtInitiatingSchema.extend({
|
|
476
|
+
status: z2.literal(ConnectionStatuses.EXPIRED),
|
|
477
|
+
expired_at: z2.string().optional()
|
|
478
|
+
}).catchall(z2.unknown())
|
|
479
|
+
]);
|
|
480
|
+
var CustomBasicWithJwtConnectionDataSchema = BasicWithJwtInitiatingSchema.omit({
|
|
481
|
+
status: true
|
|
22
482
|
});
|
|
23
|
-
var
|
|
483
|
+
var ConnectionDataSchema = z2.discriminatedUnion("authScheme", [
|
|
484
|
+
z2.object({
|
|
485
|
+
authScheme: z2.literal(AuthSchemeTypes.OAUTH1),
|
|
486
|
+
/**
|
|
487
|
+
* the main connection data discriminated by auth scheme
|
|
488
|
+
*/
|
|
489
|
+
val: Oauth1ConnectionDataSchema
|
|
490
|
+
}),
|
|
491
|
+
z2.object({
|
|
492
|
+
authScheme: z2.literal(AuthSchemeTypes.OAUTH2),
|
|
493
|
+
/**
|
|
494
|
+
* the main connection data discriminated by auth scheme
|
|
495
|
+
*/
|
|
496
|
+
val: Oauth2ConnectionDataSchema
|
|
497
|
+
}),
|
|
498
|
+
z2.object({
|
|
499
|
+
authScheme: z2.literal(AuthSchemeTypes.COMPOSIO_LINK),
|
|
500
|
+
/**
|
|
501
|
+
* the main connection data discriminated by auth scheme
|
|
502
|
+
*/
|
|
503
|
+
val: ComposioLinkConnectionDataSchema
|
|
504
|
+
}),
|
|
505
|
+
z2.object({
|
|
506
|
+
authScheme: z2.literal(AuthSchemeTypes.API_KEY),
|
|
507
|
+
/**
|
|
508
|
+
* the main connection data discriminated by auth scheme
|
|
509
|
+
*/
|
|
510
|
+
val: ApiKeyConnectionDataSchema
|
|
511
|
+
}),
|
|
512
|
+
z2.object({
|
|
513
|
+
authScheme: z2.literal(AuthSchemeTypes.BASIC),
|
|
514
|
+
/**
|
|
515
|
+
* the main connection data discriminated by auth scheme
|
|
516
|
+
*/
|
|
517
|
+
val: BasicConnectionDataSchema
|
|
518
|
+
}),
|
|
519
|
+
z2.object({
|
|
520
|
+
authScheme: z2.literal(AuthSchemeTypes.BEARER_TOKEN),
|
|
521
|
+
/**
|
|
522
|
+
* the main connection data discriminated by auth scheme
|
|
523
|
+
*/
|
|
524
|
+
val: BearerTokenConnectionDataSchema
|
|
525
|
+
}),
|
|
526
|
+
z2.object({
|
|
527
|
+
authScheme: z2.literal(AuthSchemeTypes.GOOGLE_SERVICE_ACCOUNT),
|
|
528
|
+
/**
|
|
529
|
+
* the main connection data discriminated by auth scheme
|
|
530
|
+
*/
|
|
531
|
+
val: GoogleServiceAccountConnectionDataSchema
|
|
532
|
+
}),
|
|
533
|
+
z2.object({
|
|
534
|
+
authScheme: z2.literal(AuthSchemeTypes.NO_AUTH),
|
|
535
|
+
/**
|
|
536
|
+
* the main connection data discriminated by auth scheme
|
|
537
|
+
*/
|
|
538
|
+
val: NoAuthConnectionDataSchema
|
|
539
|
+
}),
|
|
540
|
+
z2.object({
|
|
541
|
+
authScheme: z2.literal(AuthSchemeTypes.CALCOM_AUTH),
|
|
542
|
+
/**
|
|
543
|
+
* the main connection data discriminated by auth scheme
|
|
544
|
+
*/
|
|
545
|
+
val: CalcomAuthConnectionDataSchema
|
|
546
|
+
}),
|
|
547
|
+
// z.object({
|
|
548
|
+
// authScheme: z.literal(AuthSchemeTypes.SNOWFLAKE),
|
|
549
|
+
// /**
|
|
550
|
+
// * the main connection data discriminated by auth scheme
|
|
551
|
+
// */
|
|
552
|
+
// val: SnowflakeConnectionDataSchema,
|
|
553
|
+
// }),
|
|
554
|
+
z2.object({
|
|
555
|
+
authScheme: z2.literal(AuthSchemeTypes.BILLCOM_AUTH),
|
|
556
|
+
/**
|
|
557
|
+
* the main connection data discriminated by auth scheme
|
|
558
|
+
*/
|
|
559
|
+
val: BillcomAuthConnectionDataSchema
|
|
560
|
+
}),
|
|
561
|
+
z2.object({
|
|
562
|
+
authScheme: z2.literal(AuthSchemeTypes.BASIC_WITH_JWT),
|
|
563
|
+
/**
|
|
564
|
+
* the main connection data discriminated by auth scheme
|
|
565
|
+
*/
|
|
566
|
+
val: BasicWithJwtConnectionDataSchema
|
|
567
|
+
})
|
|
568
|
+
]);
|
|
569
|
+
var CustomConnectionDataSchema = z2.discriminatedUnion("authScheme", [
|
|
570
|
+
z2.object({
|
|
571
|
+
authScheme: z2.literal(AuthSchemeTypes.OAUTH2),
|
|
572
|
+
toolkitSlug: z2.string(),
|
|
573
|
+
val: CustomOauth2ConnectionDataSchema
|
|
574
|
+
}),
|
|
575
|
+
z2.object({
|
|
576
|
+
authScheme: z2.literal(AuthSchemeTypes.API_KEY),
|
|
577
|
+
toolkitSlug: z2.string(),
|
|
578
|
+
val: CustomApiKeyConnectionDataSchema
|
|
579
|
+
}),
|
|
580
|
+
z2.object({
|
|
581
|
+
authScheme: z2.literal(AuthSchemeTypes.BASIC_WITH_JWT),
|
|
582
|
+
toolkitSlug: z2.string(),
|
|
583
|
+
val: CustomBasicWithJwtConnectionDataSchema
|
|
584
|
+
}),
|
|
585
|
+
z2.object({
|
|
586
|
+
authScheme: z2.literal(AuthSchemeTypes.BASIC),
|
|
587
|
+
toolkitSlug: z2.string(),
|
|
588
|
+
val: CustomBasicConnectionDataSchema
|
|
589
|
+
}),
|
|
590
|
+
z2.object({
|
|
591
|
+
authScheme: z2.literal(AuthSchemeTypes.BEARER_TOKEN),
|
|
592
|
+
toolkitSlug: z2.string(),
|
|
593
|
+
val: CustomBearerTokenConnectionDataSchema
|
|
594
|
+
}),
|
|
595
|
+
z2.object({
|
|
596
|
+
authScheme: z2.literal(AuthSchemeTypes.OAUTH1),
|
|
597
|
+
toolkitSlug: z2.string(),
|
|
598
|
+
val: CustomOauth1ConnectionDataSchema
|
|
599
|
+
}),
|
|
600
|
+
z2.object({
|
|
601
|
+
authScheme: z2.literal(AuthSchemeTypes.NO_AUTH),
|
|
602
|
+
toolkitSlug: z2.string(),
|
|
603
|
+
val: CustomNoAuthConnectionDataSchema
|
|
604
|
+
})
|
|
605
|
+
]);
|
|
606
|
+
|
|
607
|
+
// src/types/tool.types.ts
|
|
608
|
+
var ToolkitSchema = z3.object({
|
|
609
|
+
slug: z3.string().describe("The slug of the toolkit"),
|
|
610
|
+
name: z3.string().describe("The name of the toolkit"),
|
|
611
|
+
logo: z3.string().describe("The logo of the toolkit").optional()
|
|
612
|
+
});
|
|
613
|
+
var JSONSchemaType = z3.enum([
|
|
24
614
|
"string",
|
|
25
615
|
"number",
|
|
26
616
|
"integer",
|
|
@@ -29,133 +619,136 @@ var JSONSchemaType = z.enum([
|
|
|
29
619
|
"array",
|
|
30
620
|
"null"
|
|
31
621
|
]);
|
|
32
|
-
var JSONSchemaPropertySchema =
|
|
33
|
-
type:
|
|
34
|
-
description:
|
|
35
|
-
anyOf:
|
|
36
|
-
oneOf:
|
|
37
|
-
allOf:
|
|
38
|
-
not:
|
|
39
|
-
title:
|
|
40
|
-
default:
|
|
41
|
-
nullable:
|
|
42
|
-
properties:
|
|
43
|
-
required:
|
|
44
|
-
file_uploadable:
|
|
45
|
-
file_downloadable:
|
|
46
|
-
items:
|
|
47
|
-
enum:
|
|
48
|
-
const:
|
|
49
|
-
minimum:
|
|
50
|
-
maximum:
|
|
51
|
-
exclusiveMinimum:
|
|
52
|
-
exclusiveMaximum:
|
|
53
|
-
multipleOf:
|
|
54
|
-
minLength:
|
|
55
|
-
maxLength:
|
|
56
|
-
pattern:
|
|
57
|
-
format:
|
|
58
|
-
minItems:
|
|
59
|
-
maxItems:
|
|
60
|
-
uniqueItems:
|
|
61
|
-
minProperties:
|
|
62
|
-
maxProperties:
|
|
63
|
-
patternProperties:
|
|
64
|
-
additionalProperties:
|
|
65
|
-
examples:
|
|
66
|
-
readOnly:
|
|
67
|
-
writeOnly:
|
|
68
|
-
if:
|
|
69
|
-
then:
|
|
70
|
-
else:
|
|
71
|
-
$ref:
|
|
72
|
-
definitions:
|
|
73
|
-
|
|
74
|
-
|
|
622
|
+
var JSONSchemaPropertySchema = z3.object({
|
|
623
|
+
type: z3.union([JSONSchemaType, z3.array(JSONSchemaType)]).optional(),
|
|
624
|
+
description: z3.string().optional(),
|
|
625
|
+
anyOf: z3.lazy(() => z3.array(JSONSchemaPropertySchema)).optional(),
|
|
626
|
+
oneOf: z3.lazy(() => z3.array(JSONSchemaPropertySchema)).optional(),
|
|
627
|
+
allOf: z3.lazy(() => z3.array(JSONSchemaPropertySchema)).optional(),
|
|
628
|
+
not: z3.lazy(() => JSONSchemaPropertySchema).optional(),
|
|
629
|
+
title: z3.string().optional(),
|
|
630
|
+
default: z3.any().optional(),
|
|
631
|
+
nullable: z3.boolean().optional(),
|
|
632
|
+
properties: z3.lazy(() => z3.record(z3.string(), JSONSchemaPropertySchema)).optional(),
|
|
633
|
+
required: z3.array(z3.string()).optional(),
|
|
634
|
+
file_uploadable: z3.boolean().optional(),
|
|
635
|
+
file_downloadable: z3.boolean().optional(),
|
|
636
|
+
items: z3.lazy(() => z3.union([JSONSchemaPropertySchema, z3.array(JSONSchemaPropertySchema)])).optional(),
|
|
637
|
+
enum: z3.array(z3.any()).optional(),
|
|
638
|
+
const: z3.any().optional(),
|
|
639
|
+
minimum: z3.number().optional(),
|
|
640
|
+
maximum: z3.number().optional(),
|
|
641
|
+
exclusiveMinimum: z3.number().optional(),
|
|
642
|
+
exclusiveMaximum: z3.number().optional(),
|
|
643
|
+
multipleOf: z3.number().optional(),
|
|
644
|
+
minLength: z3.number().optional(),
|
|
645
|
+
maxLength: z3.number().optional(),
|
|
646
|
+
pattern: z3.string().optional(),
|
|
647
|
+
format: z3.string().optional(),
|
|
648
|
+
minItems: z3.number().optional(),
|
|
649
|
+
maxItems: z3.number().optional(),
|
|
650
|
+
uniqueItems: z3.boolean().optional(),
|
|
651
|
+
minProperties: z3.number().optional(),
|
|
652
|
+
maxProperties: z3.number().optional(),
|
|
653
|
+
patternProperties: z3.lazy(() => z3.record(z3.string(), JSONSchemaPropertySchema)).optional(),
|
|
654
|
+
additionalProperties: z3.union([z3.boolean(), z3.lazy(() => JSONSchemaPropertySchema)]).optional(),
|
|
655
|
+
examples: z3.array(z3.any()).optional(),
|
|
656
|
+
readOnly: z3.boolean().optional(),
|
|
657
|
+
writeOnly: z3.boolean().optional(),
|
|
658
|
+
if: z3.lazy(() => JSONSchemaPropertySchema).optional(),
|
|
659
|
+
then: z3.lazy(() => JSONSchemaPropertySchema).optional(),
|
|
660
|
+
else: z3.lazy(() => JSONSchemaPropertySchema).optional(),
|
|
661
|
+
$ref: z3.string().optional(),
|
|
662
|
+
definitions: z3.record(
|
|
663
|
+
z3.string(),
|
|
664
|
+
z3.lazy(() => JSONSchemaPropertySchema)
|
|
75
665
|
).optional(),
|
|
76
|
-
$defs:
|
|
77
|
-
|
|
78
|
-
|
|
666
|
+
$defs: z3.record(
|
|
667
|
+
z3.string(),
|
|
668
|
+
z3.lazy(() => JSONSchemaPropertySchema)
|
|
79
669
|
).optional()
|
|
80
670
|
});
|
|
81
|
-
var ParametersSchema =
|
|
82
|
-
type:
|
|
83
|
-
anyOf:
|
|
84
|
-
oneOf:
|
|
85
|
-
allOf:
|
|
671
|
+
var ParametersSchema = z3.object({
|
|
672
|
+
type: z3.literal("object"),
|
|
673
|
+
anyOf: z3.array(JSONSchemaPropertySchema).optional(),
|
|
674
|
+
oneOf: z3.array(JSONSchemaPropertySchema).optional(),
|
|
675
|
+
allOf: z3.array(JSONSchemaPropertySchema).optional(),
|
|
86
676
|
not: JSONSchemaPropertySchema.optional(),
|
|
87
|
-
properties:
|
|
88
|
-
required:
|
|
89
|
-
title:
|
|
90
|
-
default:
|
|
91
|
-
nullable:
|
|
92
|
-
description:
|
|
93
|
-
additionalProperties:
|
|
677
|
+
properties: z3.record(z3.string(), JSONSchemaPropertySchema),
|
|
678
|
+
required: z3.array(z3.string()).optional(),
|
|
679
|
+
title: z3.string().optional(),
|
|
680
|
+
default: z3.any().optional(),
|
|
681
|
+
nullable: z3.boolean().optional(),
|
|
682
|
+
description: z3.string().optional(),
|
|
683
|
+
additionalProperties: z3.boolean().default(false).optional()
|
|
94
684
|
});
|
|
95
|
-
var ToolSchema =
|
|
96
|
-
slug:
|
|
97
|
-
name:
|
|
98
|
-
description:
|
|
685
|
+
var ToolSchema = z3.object({
|
|
686
|
+
slug: z3.string().describe('The slug of the tool. eg. "GOOGLE_SEARCH"'),
|
|
687
|
+
name: z3.string().describe(`The name of the tool. eg. "Google Search"`),
|
|
688
|
+
description: z3.string().optional().describe("The description of the tool"),
|
|
99
689
|
inputParameters: ParametersSchema.optional().describe("The input parameters of the tool"),
|
|
100
690
|
outputParameters: ParametersSchema.optional().describe("The output parameters of the tool"),
|
|
101
|
-
tags:
|
|
102
|
-
toolkit:
|
|
103
|
-
version:
|
|
104
|
-
scopes:
|
|
691
|
+
tags: z3.optional(z3.array(z3.string())).describe("The tags of the tool. eg: Important").default([]),
|
|
692
|
+
toolkit: z3.optional(ToolkitSchema).describe("The toolkit of the tool"),
|
|
693
|
+
version: z3.optional(z3.string()).describe('The version of the tool, e.g. "1.0.0"'),
|
|
694
|
+
scopes: z3.optional(z3.array(z3.string())).describe('The scopes of the tool. eg: ["task:add"]')
|
|
105
695
|
});
|
|
106
|
-
var ToolListResponseSchema =
|
|
107
|
-
items:
|
|
108
|
-
nextCursor:
|
|
109
|
-
totalPages:
|
|
696
|
+
var ToolListResponseSchema = z3.object({
|
|
697
|
+
items: z3.array(ToolSchema),
|
|
698
|
+
nextCursor: z3.string().nullable().optional(),
|
|
699
|
+
totalPages: z3.number()
|
|
110
700
|
});
|
|
111
|
-
var ToolListParamsSchema =
|
|
112
|
-
tools:
|
|
113
|
-
toolkits:
|
|
114
|
-
scopes:
|
|
115
|
-
tags:
|
|
116
|
-
limit:
|
|
117
|
-
search:
|
|
118
|
-
authConfigIds:
|
|
701
|
+
var ToolListParamsSchema = z3.object({
|
|
702
|
+
tools: z3.array(z3.string()).optional(),
|
|
703
|
+
toolkits: z3.array(z3.string()).optional(),
|
|
704
|
+
scopes: z3.array(z3.string()).optional(),
|
|
705
|
+
tags: z3.array(z3.string()).optional(),
|
|
706
|
+
limit: z3.number().optional(),
|
|
707
|
+
search: z3.string().optional(),
|
|
708
|
+
authConfigIds: z3.array(z3.string()).optional()
|
|
119
709
|
});
|
|
120
|
-
var CustomAuthParamsSchema =
|
|
121
|
-
baseURL:
|
|
122
|
-
body:
|
|
123
|
-
parameters:
|
|
124
|
-
|
|
125
|
-
in:
|
|
126
|
-
name:
|
|
127
|
-
value:
|
|
710
|
+
var CustomAuthParamsSchema = z3.object({
|
|
711
|
+
baseURL: z3.string().optional(),
|
|
712
|
+
body: z3.record(z3.string(), z3.unknown()).optional(),
|
|
713
|
+
parameters: z3.array(
|
|
714
|
+
z3.object({
|
|
715
|
+
in: z3.enum(["query", "header"]),
|
|
716
|
+
name: z3.string(),
|
|
717
|
+
value: z3.union([z3.string(), z3.number()])
|
|
128
718
|
})
|
|
129
719
|
)
|
|
130
720
|
});
|
|
131
|
-
var ToolExecuteParamsSchema =
|
|
132
|
-
allowTracing:
|
|
133
|
-
connectedAccountId:
|
|
721
|
+
var ToolExecuteParamsSchema = z3.object({
|
|
722
|
+
allowTracing: z3.boolean().optional(),
|
|
723
|
+
connectedAccountId: z3.string().optional(),
|
|
134
724
|
customAuthParams: CustomAuthParamsSchema.optional(),
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
725
|
+
customConnectionData: CustomConnectionDataSchema.optional(),
|
|
726
|
+
arguments: z3.record(z3.string(), z3.unknown()).optional(),
|
|
727
|
+
userId: z3.string().optional(),
|
|
728
|
+
//
|
|
729
|
+
version: z3.string().optional(),
|
|
730
|
+
text: z3.string().optional()
|
|
139
731
|
});
|
|
140
|
-
var ToolExecuteResponseSchema =
|
|
141
|
-
data:
|
|
142
|
-
error:
|
|
143
|
-
successful:
|
|
144
|
-
logId:
|
|
145
|
-
sessionInfo:
|
|
732
|
+
var ToolExecuteResponseSchema = z3.object({
|
|
733
|
+
data: z3.record(z3.string(), z3.unknown()),
|
|
734
|
+
error: z3.string().nullable(),
|
|
735
|
+
successful: z3.boolean(),
|
|
736
|
+
logId: z3.string().optional(),
|
|
737
|
+
sessionInfo: z3.unknown().optional()
|
|
146
738
|
});
|
|
147
|
-
var ToolProxyParamsSchema =
|
|
148
|
-
endpoint:
|
|
149
|
-
method:
|
|
150
|
-
body:
|
|
151
|
-
parameters:
|
|
152
|
-
|
|
153
|
-
in:
|
|
154
|
-
name:
|
|
155
|
-
value:
|
|
739
|
+
var ToolProxyParamsSchema = z3.object({
|
|
740
|
+
endpoint: z3.string(),
|
|
741
|
+
method: z3.enum(["GET", "POST", "PUT", "DELETE", "PATCH"]),
|
|
742
|
+
body: z3.unknown().optional(),
|
|
743
|
+
parameters: z3.array(
|
|
744
|
+
z3.object({
|
|
745
|
+
in: z3.enum(["query", "header"]),
|
|
746
|
+
name: z3.string(),
|
|
747
|
+
value: z3.union([z3.string(), z3.number()])
|
|
156
748
|
})
|
|
157
749
|
).optional(),
|
|
158
|
-
connectedAccountId:
|
|
750
|
+
connectedAccountId: z3.string().optional(),
|
|
751
|
+
customConnectionData: CustomConnectionDataSchema.optional()
|
|
159
752
|
});
|
|
160
753
|
|
|
161
754
|
// src/models/CustomTools.ts
|
|
@@ -1064,418 +1657,6 @@ var ComposioNoAPIKeyError = class extends ComposioError {
|
|
|
1064
1657
|
|
|
1065
1658
|
// src/types/connectedAccounts.types.ts
|
|
1066
1659
|
import { z as z4 } from "zod";
|
|
1067
|
-
|
|
1068
|
-
// src/types/connectedAccountAuthStates.types.ts
|
|
1069
|
-
import { z as z3 } from "zod";
|
|
1070
|
-
|
|
1071
|
-
// src/types/authConfigs.types.ts
|
|
1072
|
-
import { z as z2 } from "zod";
|
|
1073
|
-
var AuthConfigTypes = {
|
|
1074
|
-
CUSTOM: "use_custom_auth",
|
|
1075
|
-
COMPOSIO_MANAGED: "use_composio_managed_auth"
|
|
1076
|
-
};
|
|
1077
|
-
var AuthSchemeTypes = {
|
|
1078
|
-
OAUTH1: "OAUTH1",
|
|
1079
|
-
OAUTH2: "OAUTH2",
|
|
1080
|
-
API_KEY: "API_KEY",
|
|
1081
|
-
BASIC: "BASIC",
|
|
1082
|
-
BEARER_TOKEN: "BEARER_TOKEN",
|
|
1083
|
-
BILLCOM_AUTH: "BILLCOM_AUTH",
|
|
1084
|
-
GOOGLE_SERVICE_ACCOUNT: "GOOGLE_SERVICE_ACCOUNT",
|
|
1085
|
-
NO_AUTH: "NO_AUTH",
|
|
1086
|
-
BASIC_WITH_JWT: "BASIC_WITH_JWT",
|
|
1087
|
-
COMPOSIO_LINK: "COMPOSIO_LINK",
|
|
1088
|
-
CALCOM_AUTH: "CALCOM_AUTH"
|
|
1089
|
-
};
|
|
1090
|
-
var AuthSchemeEnum = z2.enum([
|
|
1091
|
-
"OAUTH2",
|
|
1092
|
-
"OAUTH1",
|
|
1093
|
-
"API_KEY",
|
|
1094
|
-
"BASIC",
|
|
1095
|
-
"BILLCOM_AUTH",
|
|
1096
|
-
"BEARER_TOKEN",
|
|
1097
|
-
"GOOGLE_SERVICE_ACCOUNT",
|
|
1098
|
-
"NO_AUTH",
|
|
1099
|
-
"BASIC_WITH_JWT",
|
|
1100
|
-
"COMPOSIO_LINK",
|
|
1101
|
-
"CALCOM_AUTH"
|
|
1102
|
-
]);
|
|
1103
|
-
var CreateCustomAuthConfigParamsSchema = z2.object({
|
|
1104
|
-
type: z2.literal("use_custom_auth"),
|
|
1105
|
-
name: z2.string().optional(),
|
|
1106
|
-
credentials: z2.record(z2.string(), z2.union([z2.string(), z2.number(), z2.boolean()])),
|
|
1107
|
-
authScheme: AuthSchemeEnum,
|
|
1108
|
-
restrictToFollowingTools: z2.array(z2.string()).optional()
|
|
1109
|
-
});
|
|
1110
|
-
var CreateComposioManagedAuthConfigParamsSchema = z2.object({
|
|
1111
|
-
type: z2.literal("use_composio_managed_auth"),
|
|
1112
|
-
name: z2.string().optional(),
|
|
1113
|
-
credentials: z2.record(z2.string(), z2.union([z2.string(), z2.number(), z2.boolean()])).optional(),
|
|
1114
|
-
restrictToFollowingTools: z2.array(z2.string()).optional()
|
|
1115
|
-
});
|
|
1116
|
-
var CreateAuthConfigParamsSchema = z2.discriminatedUnion("type", [
|
|
1117
|
-
CreateCustomAuthConfigParamsSchema,
|
|
1118
|
-
CreateComposioManagedAuthConfigParamsSchema
|
|
1119
|
-
]);
|
|
1120
|
-
var CreateAuthConfigResponseSchema = z2.object({
|
|
1121
|
-
id: z2.string(),
|
|
1122
|
-
authScheme: z2.string(),
|
|
1123
|
-
isComposioManaged: z2.boolean(),
|
|
1124
|
-
toolkit: z2.string()
|
|
1125
|
-
});
|
|
1126
|
-
var AuthConfigRetrieveResponseSchema = z2.object({
|
|
1127
|
-
id: z2.string(),
|
|
1128
|
-
name: z2.string(),
|
|
1129
|
-
toolkit: z2.object({
|
|
1130
|
-
logo: z2.string(),
|
|
1131
|
-
slug: z2.string()
|
|
1132
|
-
}),
|
|
1133
|
-
noOfConnections: z2.number(),
|
|
1134
|
-
status: z2.enum(["ENABLED", "DISABLED"]),
|
|
1135
|
-
uuid: z2.string(),
|
|
1136
|
-
authScheme: AuthSchemeEnum.optional(),
|
|
1137
|
-
credentials: z2.record(z2.string(), z2.unknown()).optional(),
|
|
1138
|
-
expectedInputFields: z2.array(z2.unknown()).optional(),
|
|
1139
|
-
restrictToFollowingTools: z2.array(z2.string()).optional(),
|
|
1140
|
-
isComposioManaged: z2.boolean().optional(),
|
|
1141
|
-
createdBy: z2.string().optional(),
|
|
1142
|
-
createdAt: z2.string().optional(),
|
|
1143
|
-
lastUpdatedAt: z2.string().optional()
|
|
1144
|
-
});
|
|
1145
|
-
var AuthConfigListParamsSchema = z2.object({
|
|
1146
|
-
cursor: z2.string().optional(),
|
|
1147
|
-
isComposioManaged: z2.boolean().optional(),
|
|
1148
|
-
limit: z2.number().optional(),
|
|
1149
|
-
toolkit: z2.string().optional()
|
|
1150
|
-
});
|
|
1151
|
-
var AuthConfigListResponseSchema = z2.object({
|
|
1152
|
-
items: z2.array(AuthConfigRetrieveResponseSchema),
|
|
1153
|
-
nextCursor: z2.string().nullable(),
|
|
1154
|
-
totalPages: z2.number()
|
|
1155
|
-
});
|
|
1156
|
-
var AuthCustomConfigUpdateParamsSchema = z2.object({
|
|
1157
|
-
credentials: z2.record(z2.string(), z2.union([z2.string(), z2.unknown()])),
|
|
1158
|
-
type: z2.literal("custom"),
|
|
1159
|
-
restrictToFollowingTools: z2.array(z2.string()).optional()
|
|
1160
|
-
});
|
|
1161
|
-
var AuthDefaultConfigUpdateParamsSchema = z2.object({
|
|
1162
|
-
scopes: z2.string(),
|
|
1163
|
-
type: z2.literal("default"),
|
|
1164
|
-
restrictToFollowingTools: z2.array(z2.string()).optional()
|
|
1165
|
-
});
|
|
1166
|
-
var AuthConfigUpdateParamsSchema = z2.discriminatedUnion("type", [
|
|
1167
|
-
AuthCustomConfigUpdateParamsSchema,
|
|
1168
|
-
AuthDefaultConfigUpdateParamsSchema
|
|
1169
|
-
]);
|
|
1170
|
-
|
|
1171
|
-
// src/types/connectedAccountAuthStates.types.ts
|
|
1172
|
-
var ConnectionStatuses = {
|
|
1173
|
-
INITIALIZING: "INITIALIZING",
|
|
1174
|
-
INITIATED: "INITIATED",
|
|
1175
|
-
ACTIVE: "ACTIVE",
|
|
1176
|
-
FAILED: "FAILED",
|
|
1177
|
-
EXPIRED: "EXPIRED"
|
|
1178
|
-
};
|
|
1179
|
-
var RedirectableAuthSchemeSchema = z3.enum([
|
|
1180
|
-
AuthSchemeTypes.OAUTH1,
|
|
1181
|
-
AuthSchemeTypes.OAUTH2,
|
|
1182
|
-
AuthSchemeTypes.COMPOSIO_LINK
|
|
1183
|
-
]);
|
|
1184
|
-
var BaseSchemeRaw = z3.object({
|
|
1185
|
-
// for posthog, freshdesk, zendesk, clickup and others
|
|
1186
|
-
subdomain: z3.string().optional(),
|
|
1187
|
-
// for atlassian
|
|
1188
|
-
["your-domain"]: z3.string().optional(),
|
|
1189
|
-
// for mixpanel
|
|
1190
|
-
region: z3.string().optional(),
|
|
1191
|
-
// for shopify
|
|
1192
|
-
shop: z3.string().optional(),
|
|
1193
|
-
// for snowflake
|
|
1194
|
-
account_url: z3.string().optional(),
|
|
1195
|
-
// likely pipedrive
|
|
1196
|
-
COMPANYDOMAIN: z3.string().optional(),
|
|
1197
|
-
// likely zoho
|
|
1198
|
-
extension: z3.string().optional(),
|
|
1199
|
-
// likely formsite
|
|
1200
|
-
form_api_base_url: z3.string().optional(),
|
|
1201
|
-
// likely salesforce
|
|
1202
|
-
instanceEndpoint: z3.string().optional(),
|
|
1203
|
-
// likely active campaign
|
|
1204
|
-
api_url: z3.string().optional(),
|
|
1205
|
-
// for borneo
|
|
1206
|
-
borneo_dashboard_url: z3.string().optional(),
|
|
1207
|
-
// for zenrows proxy
|
|
1208
|
-
proxy_username: z3.string().optional(),
|
|
1209
|
-
proxy_password: z3.string().optional(),
|
|
1210
|
-
// for d2l
|
|
1211
|
-
domain: z3.string().optional(),
|
|
1212
|
-
version: z3.string().optional(),
|
|
1213
|
-
// for mailchimp
|
|
1214
|
-
dc: z3.string().optional(),
|
|
1215
|
-
// for sharepoint
|
|
1216
|
-
site_name: z3.string().optional(),
|
|
1217
|
-
// for servicenow
|
|
1218
|
-
instanceName: z3.string().optional(),
|
|
1219
|
-
// for netsuite
|
|
1220
|
-
account_id: z3.string().optional(),
|
|
1221
|
-
// for custom servers
|
|
1222
|
-
your_server: z3.string().optional(),
|
|
1223
|
-
// for ragic
|
|
1224
|
-
server_location: z3.string().optional(),
|
|
1225
|
-
// base_url only
|
|
1226
|
-
base_url: z3.string().optional(),
|
|
1227
|
-
// for api key
|
|
1228
|
-
api_key: z3.string().optional(),
|
|
1229
|
-
// for generic api key
|
|
1230
|
-
generic_api_key: z3.string().optional()
|
|
1231
|
-
}).catchall(z3.unknown());
|
|
1232
|
-
var Oauth2InitiatingConnectionDataSchema = BaseSchemeRaw.extend({
|
|
1233
|
-
status: z3.literal(ConnectionStatuses.INITIALIZING)
|
|
1234
|
-
}).catchall(z3.unknown());
|
|
1235
|
-
var Oauth2InitiatedConnectionDataSchema = Oauth2InitiatingConnectionDataSchema.extend({
|
|
1236
|
-
status: z3.literal(ConnectionStatuses.INITIATED),
|
|
1237
|
-
code_verifier: z3.string().optional(),
|
|
1238
|
-
redirectUrl: z3.string(),
|
|
1239
|
-
callback_url: z3.string().optional(),
|
|
1240
|
-
finalRedirectUri: z3.string().optional(),
|
|
1241
|
-
// previously verification_token, will be sent as verification_token to slack
|
|
1242
|
-
webhook_signature: z3.string().optional()
|
|
1243
|
-
}).catchall(z3.unknown());
|
|
1244
|
-
var Oauth2ActiveConnectionDataSchema = Oauth2InitiatingConnectionDataSchema.extend({
|
|
1245
|
-
status: z3.literal(ConnectionStatuses.ACTIVE),
|
|
1246
|
-
access_token: z3.string(),
|
|
1247
|
-
id_token: z3.string().optional(),
|
|
1248
|
-
token_type: z3.string(),
|
|
1249
|
-
refresh_token: z3.string().optional(),
|
|
1250
|
-
expires_in: z3.number().optional(),
|
|
1251
|
-
scope: z3.string().optional(),
|
|
1252
|
-
// previously verification_token, will be sent as verification_token to slack
|
|
1253
|
-
webhook_signature: z3.string().optional(),
|
|
1254
|
-
authed_user: z3.object({
|
|
1255
|
-
access_token: z3.string().optional(),
|
|
1256
|
-
scope: z3.string().optional()
|
|
1257
|
-
}).optional().describe("for slack user scopes")
|
|
1258
|
-
}).catchall(z3.unknown());
|
|
1259
|
-
var Oauth2FailedConnectionDataSchema = Oauth2InitiatingConnectionDataSchema.extend({
|
|
1260
|
-
status: z3.literal(ConnectionStatuses.FAILED),
|
|
1261
|
-
error: z3.string().optional(),
|
|
1262
|
-
error_description: z3.string().optional()
|
|
1263
|
-
}).catchall(z3.unknown());
|
|
1264
|
-
var Oauth2ExpiredConnectionDataSchema = Oauth2InitiatingConnectionDataSchema.extend({
|
|
1265
|
-
status: z3.literal(ConnectionStatuses.EXPIRED),
|
|
1266
|
-
expired_at: z3.string().optional()
|
|
1267
|
-
}).catchall(z3.unknown());
|
|
1268
|
-
var Oauth2ConnectionDataSchema = z3.discriminatedUnion("status", [
|
|
1269
|
-
Oauth2InitiatingConnectionDataSchema,
|
|
1270
|
-
Oauth2InitiatedConnectionDataSchema,
|
|
1271
|
-
Oauth2ActiveConnectionDataSchema,
|
|
1272
|
-
Oauth2FailedConnectionDataSchema,
|
|
1273
|
-
Oauth2ExpiredConnectionDataSchema
|
|
1274
|
-
]);
|
|
1275
|
-
var Oauth1InitiatingConnectionDataSchema = BaseSchemeRaw.extend({
|
|
1276
|
-
status: z3.literal(ConnectionStatuses.INITIALIZING)
|
|
1277
|
-
}).catchall(z3.unknown());
|
|
1278
|
-
var Oauth1InitiatedConnectionDataSchema = Oauth1InitiatingConnectionDataSchema.extend({
|
|
1279
|
-
status: z3.literal(ConnectionStatuses.INITIATED),
|
|
1280
|
-
oauth_token: z3.string(),
|
|
1281
|
-
authUri: z3.string(),
|
|
1282
|
-
oauth_token_secret: z3.string(),
|
|
1283
|
-
redirectUrl: z3.string(),
|
|
1284
|
-
callbackUrl: z3.string().optional()
|
|
1285
|
-
}).catchall(z3.unknown());
|
|
1286
|
-
var Oauth1ActiveConnectionDataSchema = Oauth1InitiatingConnectionDataSchema.extend({
|
|
1287
|
-
status: z3.literal(ConnectionStatuses.ACTIVE),
|
|
1288
|
-
oauth_token: z3.string(),
|
|
1289
|
-
consumer_key: z3.string().optional(),
|
|
1290
|
-
redirectUrl: z3.string().optional(),
|
|
1291
|
-
callback_url: z3.string().optional()
|
|
1292
|
-
}).catchall(z3.unknown());
|
|
1293
|
-
var Oauth1FailedConnectionDataSchema = Oauth1InitiatingConnectionDataSchema.extend({
|
|
1294
|
-
status: z3.literal(ConnectionStatuses.FAILED),
|
|
1295
|
-
error: z3.string().optional(),
|
|
1296
|
-
error_description: z3.string().optional()
|
|
1297
|
-
}).catchall(z3.unknown());
|
|
1298
|
-
var Oauth1ExpiredConnectionDataSchema = Oauth1InitiatingConnectionDataSchema.extend({
|
|
1299
|
-
status: z3.literal(ConnectionStatuses.EXPIRED),
|
|
1300
|
-
expired_at: z3.string().optional()
|
|
1301
|
-
}).catchall(z3.unknown());
|
|
1302
|
-
var Oauth1ConnectionDataSchema = z3.discriminatedUnion("status", [
|
|
1303
|
-
Oauth1InitiatingConnectionDataSchema,
|
|
1304
|
-
Oauth1InitiatedConnectionDataSchema,
|
|
1305
|
-
Oauth1ActiveConnectionDataSchema,
|
|
1306
|
-
Oauth1FailedConnectionDataSchema,
|
|
1307
|
-
Oauth1ExpiredConnectionDataSchema
|
|
1308
|
-
]);
|
|
1309
|
-
var ComposioLinkInitiatingSchema = BaseSchemeRaw.extend({
|
|
1310
|
-
status: z3.literal(ConnectionStatuses.INITIALIZING)
|
|
1311
|
-
}).catchall(z3.unknown());
|
|
1312
|
-
var ComposioLinkConnectionDataSchema = z3.discriminatedUnion("status", [
|
|
1313
|
-
ComposioLinkInitiatingSchema,
|
|
1314
|
-
ComposioLinkInitiatingSchema.extend({
|
|
1315
|
-
status: z3.literal(ConnectionStatuses.INITIATED),
|
|
1316
|
-
redirectUrl: z3.string()
|
|
1317
|
-
}).catchall(z3.unknown()),
|
|
1318
|
-
ComposioLinkInitiatingSchema.extend({
|
|
1319
|
-
status: z3.literal(ConnectionStatuses.ACTIVE)
|
|
1320
|
-
}).catchall(z3.unknown()),
|
|
1321
|
-
ComposioLinkInitiatingSchema.extend({
|
|
1322
|
-
status: z3.literal(ConnectionStatuses.FAILED),
|
|
1323
|
-
error: z3.string().optional(),
|
|
1324
|
-
error_description: z3.string().optional()
|
|
1325
|
-
}).catchall(z3.unknown()),
|
|
1326
|
-
ComposioLinkInitiatingSchema.extend({
|
|
1327
|
-
status: z3.literal(ConnectionStatuses.EXPIRED),
|
|
1328
|
-
expired_at: z3.string().optional()
|
|
1329
|
-
}).catchall(z3.unknown())
|
|
1330
|
-
]);
|
|
1331
|
-
var BillcomAuthInitiatingSchema = BaseSchemeRaw.extend({
|
|
1332
|
-
status: z3.literal(ConnectionStatuses.INITIALIZING)
|
|
1333
|
-
}).catchall(z3.unknown());
|
|
1334
|
-
var BillcomAuthConnectionDataSchema = z3.discriminatedUnion("status", [
|
|
1335
|
-
BillcomAuthInitiatingSchema,
|
|
1336
|
-
BillcomAuthInitiatingSchema.extend({
|
|
1337
|
-
status: z3.literal(ConnectionStatuses.INITIATED),
|
|
1338
|
-
redirectUrl: z3.string()
|
|
1339
|
-
}).catchall(z3.unknown()),
|
|
1340
|
-
BillcomAuthInitiatingSchema.extend({
|
|
1341
|
-
status: z3.literal(ConnectionStatuses.ACTIVE),
|
|
1342
|
-
sessionId: z3.string(),
|
|
1343
|
-
devKey: z3.string()
|
|
1344
|
-
}).catchall(z3.unknown()),
|
|
1345
|
-
BillcomAuthInitiatingSchema.extend({
|
|
1346
|
-
status: z3.literal(ConnectionStatuses.FAILED),
|
|
1347
|
-
error: z3.string().optional(),
|
|
1348
|
-
error_description: z3.string().optional()
|
|
1349
|
-
}).catchall(z3.unknown()),
|
|
1350
|
-
BillcomAuthInitiatingSchema.extend({
|
|
1351
|
-
status: z3.literal(ConnectionStatuses.EXPIRED),
|
|
1352
|
-
expired_at: z3.string().optional()
|
|
1353
|
-
}).catchall(z3.unknown())
|
|
1354
|
-
]);
|
|
1355
|
-
var BasicInitiatingSchema = BaseSchemeRaw.extend({
|
|
1356
|
-
status: z3.literal(ConnectionStatuses.ACTIVE),
|
|
1357
|
-
username: z3.string(),
|
|
1358
|
-
password: z3.string()
|
|
1359
|
-
}).catchall(z3.unknown());
|
|
1360
|
-
var BasicConnectionDataSchema = BasicInitiatingSchema;
|
|
1361
|
-
var ApiKeyInitiatingSchema = BaseSchemeRaw.extend({
|
|
1362
|
-
status: z3.literal(ConnectionStatuses.ACTIVE),
|
|
1363
|
-
api_key: z3.string().optional(),
|
|
1364
|
-
generic_api_key: z3.string().optional()
|
|
1365
|
-
}).catchall(z3.unknown());
|
|
1366
|
-
var ApiKeyConnectionDataSchema = ApiKeyInitiatingSchema;
|
|
1367
|
-
var BearerTokenInitiatingSchema = BaseSchemeRaw.extend({
|
|
1368
|
-
status: z3.literal(ConnectionStatuses.ACTIVE),
|
|
1369
|
-
token: z3.string()
|
|
1370
|
-
}).catchall(z3.unknown());
|
|
1371
|
-
var BearerTokenConnectionDataSchema = BearerTokenInitiatingSchema;
|
|
1372
|
-
var GoogleServiceAccountInitiatingSchema = BaseSchemeRaw.extend({
|
|
1373
|
-
status: z3.literal(ConnectionStatuses.ACTIVE),
|
|
1374
|
-
credentials_json: z3.string()
|
|
1375
|
-
}).catchall(z3.unknown());
|
|
1376
|
-
var GoogleServiceAccountConnectionDataSchema = GoogleServiceAccountInitiatingSchema;
|
|
1377
|
-
var NoAuthInitiatingSchema = BaseSchemeRaw.extend({
|
|
1378
|
-
status: z3.literal(ConnectionStatuses.ACTIVE)
|
|
1379
|
-
}).catchall(z3.unknown());
|
|
1380
|
-
var NoAuthConnectionDataSchema = NoAuthInitiatingSchema;
|
|
1381
|
-
var CalcomAuthInitiatingSchema = BaseSchemeRaw.extend({
|
|
1382
|
-
status: z3.literal(ConnectionStatuses.ACTIVE)
|
|
1383
|
-
}).catchall(z3.unknown());
|
|
1384
|
-
var CalcomAuthConnectionDataSchema = CalcomAuthInitiatingSchema;
|
|
1385
|
-
var BasicWithJwtInitiatingSchema = BaseSchemeRaw.extend({
|
|
1386
|
-
status: z3.literal(ConnectionStatuses.ACTIVE),
|
|
1387
|
-
username: z3.string(),
|
|
1388
|
-
password: z3.string()
|
|
1389
|
-
}).catchall(z3.unknown());
|
|
1390
|
-
var BasicWithJwtConnectionDataSchema = BasicWithJwtInitiatingSchema;
|
|
1391
|
-
var ConnectionDataSchema = z3.discriminatedUnion("authScheme", [
|
|
1392
|
-
z3.object({
|
|
1393
|
-
authScheme: z3.literal(AuthSchemeTypes.OAUTH1),
|
|
1394
|
-
/**
|
|
1395
|
-
* the main connection data discriminated by auth scheme
|
|
1396
|
-
*/
|
|
1397
|
-
val: Oauth1ConnectionDataSchema
|
|
1398
|
-
}),
|
|
1399
|
-
z3.object({
|
|
1400
|
-
authScheme: z3.literal(AuthSchemeTypes.OAUTH2),
|
|
1401
|
-
/**
|
|
1402
|
-
* the main connection data discriminated by auth scheme
|
|
1403
|
-
*/
|
|
1404
|
-
val: Oauth2ConnectionDataSchema
|
|
1405
|
-
}),
|
|
1406
|
-
z3.object({
|
|
1407
|
-
authScheme: z3.literal(AuthSchemeTypes.COMPOSIO_LINK),
|
|
1408
|
-
/**
|
|
1409
|
-
* the main connection data discriminated by auth scheme
|
|
1410
|
-
*/
|
|
1411
|
-
val: ComposioLinkConnectionDataSchema
|
|
1412
|
-
}),
|
|
1413
|
-
z3.object({
|
|
1414
|
-
authScheme: z3.literal(AuthSchemeTypes.API_KEY),
|
|
1415
|
-
/**
|
|
1416
|
-
* the main connection data discriminated by auth scheme
|
|
1417
|
-
*/
|
|
1418
|
-
val: ApiKeyConnectionDataSchema
|
|
1419
|
-
}),
|
|
1420
|
-
z3.object({
|
|
1421
|
-
authScheme: z3.literal(AuthSchemeTypes.BASIC),
|
|
1422
|
-
/**
|
|
1423
|
-
* the main connection data discriminated by auth scheme
|
|
1424
|
-
*/
|
|
1425
|
-
val: BasicConnectionDataSchema
|
|
1426
|
-
}),
|
|
1427
|
-
z3.object({
|
|
1428
|
-
authScheme: z3.literal(AuthSchemeTypes.BEARER_TOKEN),
|
|
1429
|
-
/**
|
|
1430
|
-
* the main connection data discriminated by auth scheme
|
|
1431
|
-
*/
|
|
1432
|
-
val: BearerTokenConnectionDataSchema
|
|
1433
|
-
}),
|
|
1434
|
-
z3.object({
|
|
1435
|
-
authScheme: z3.literal(AuthSchemeTypes.GOOGLE_SERVICE_ACCOUNT),
|
|
1436
|
-
/**
|
|
1437
|
-
* the main connection data discriminated by auth scheme
|
|
1438
|
-
*/
|
|
1439
|
-
val: GoogleServiceAccountConnectionDataSchema
|
|
1440
|
-
}),
|
|
1441
|
-
z3.object({
|
|
1442
|
-
authScheme: z3.literal(AuthSchemeTypes.NO_AUTH),
|
|
1443
|
-
/**
|
|
1444
|
-
* the main connection data discriminated by auth scheme
|
|
1445
|
-
*/
|
|
1446
|
-
val: NoAuthConnectionDataSchema
|
|
1447
|
-
}),
|
|
1448
|
-
z3.object({
|
|
1449
|
-
authScheme: z3.literal(AuthSchemeTypes.CALCOM_AUTH),
|
|
1450
|
-
/**
|
|
1451
|
-
* the main connection data discriminated by auth scheme
|
|
1452
|
-
*/
|
|
1453
|
-
val: CalcomAuthConnectionDataSchema
|
|
1454
|
-
}),
|
|
1455
|
-
// z.object({
|
|
1456
|
-
// authScheme: z.literal(AuthSchemeTypes.SNOWFLAKE),
|
|
1457
|
-
// /**
|
|
1458
|
-
// * the main connection data discriminated by auth scheme
|
|
1459
|
-
// */
|
|
1460
|
-
// val: SnowflakeConnectionDataSchema,
|
|
1461
|
-
// }),
|
|
1462
|
-
z3.object({
|
|
1463
|
-
authScheme: z3.literal(AuthSchemeTypes.BILLCOM_AUTH),
|
|
1464
|
-
/**
|
|
1465
|
-
* the main connection data discriminated by auth scheme
|
|
1466
|
-
*/
|
|
1467
|
-
val: BillcomAuthConnectionDataSchema
|
|
1468
|
-
}),
|
|
1469
|
-
z3.object({
|
|
1470
|
-
authScheme: z3.literal(AuthSchemeTypes.BASIC_WITH_JWT),
|
|
1471
|
-
/**
|
|
1472
|
-
* the main connection data discriminated by auth scheme
|
|
1473
|
-
*/
|
|
1474
|
-
val: BasicWithJwtConnectionDataSchema
|
|
1475
|
-
})
|
|
1476
|
-
]);
|
|
1477
|
-
|
|
1478
|
-
// src/types/connectedAccounts.types.ts
|
|
1479
1660
|
var ConnectedAccountStatuses = {
|
|
1480
1661
|
INITIALIZING: "INITIALIZING",
|
|
1481
1662
|
INITIATED: "INITIATED",
|
|
@@ -1489,7 +1670,8 @@ var ConnectedAccountStatusSchema = z4.enum([
|
|
|
1489
1670
|
ConnectedAccountStatuses.INITIATED,
|
|
1490
1671
|
ConnectedAccountStatuses.ACTIVE,
|
|
1491
1672
|
ConnectedAccountStatuses.FAILED,
|
|
1492
|
-
ConnectedAccountStatuses.EXPIRED
|
|
1673
|
+
ConnectedAccountStatuses.EXPIRED,
|
|
1674
|
+
ConnectedAccountStatuses.INACTIVE
|
|
1493
1675
|
]);
|
|
1494
1676
|
var CreateConnectedAccountParamsSchema = z4.object({
|
|
1495
1677
|
authConfig: z4.object({
|
|
@@ -1530,7 +1712,7 @@ var ConnectedAccountAuthConfigSchema = z4.object({
|
|
|
1530
1712
|
var ConnectedAccountRetrieveResponseSchema = z4.object({
|
|
1531
1713
|
id: z4.string(),
|
|
1532
1714
|
authConfig: ConnectedAccountAuthConfigSchema,
|
|
1533
|
-
data: z4.record(z4.string(), z4.unknown()),
|
|
1715
|
+
data: z4.record(z4.string(), z4.unknown()).optional(),
|
|
1534
1716
|
params: z4.record(z4.string(), z4.unknown()).optional(),
|
|
1535
1717
|
status: ConnectedAccountStatusSchema,
|
|
1536
1718
|
statusReason: z4.string().nullable(),
|
|
@@ -1559,32 +1741,51 @@ var ConnectedAccountListResponseSchema = z4.object({
|
|
|
1559
1741
|
totalPages: z4.number().describe("The total number of pages of connected accounts")
|
|
1560
1742
|
});
|
|
1561
1743
|
|
|
1744
|
+
// src/utils/transform.ts
|
|
1745
|
+
function transform(raw) {
|
|
1746
|
+
return {
|
|
1747
|
+
with(schema) {
|
|
1748
|
+
return {
|
|
1749
|
+
using(transformer, options) {
|
|
1750
|
+
const transformed = transformer(raw);
|
|
1751
|
+
const result = schema.safeParse(transformed);
|
|
1752
|
+
if (!result.success) {
|
|
1753
|
+
logger_default.error(result.error);
|
|
1754
|
+
return transformed;
|
|
1755
|
+
}
|
|
1756
|
+
return result.data;
|
|
1757
|
+
}
|
|
1758
|
+
};
|
|
1759
|
+
}
|
|
1760
|
+
};
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1562
1763
|
// src/utils/transformers/connectedAccounts.ts
|
|
1563
1764
|
function transformConnectedAccountResponse(response) {
|
|
1564
|
-
|
|
1565
|
-
...
|
|
1765
|
+
return transform(response).with(ConnectedAccountRetrieveResponseSchema).using((response2) => ({
|
|
1766
|
+
...response2,
|
|
1566
1767
|
authConfig: {
|
|
1567
|
-
...
|
|
1568
|
-
id:
|
|
1569
|
-
isComposioManaged:
|
|
1570
|
-
isDisabled:
|
|
1768
|
+
...response2.auth_config,
|
|
1769
|
+
id: response2.auth_config.id,
|
|
1770
|
+
isComposioManaged: response2.auth_config.is_composio_managed,
|
|
1771
|
+
isDisabled: response2.auth_config.is_disabled
|
|
1571
1772
|
},
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1773
|
+
data: response2.data ?? void 0,
|
|
1774
|
+
state: response2.state,
|
|
1775
|
+
status: response2.status,
|
|
1776
|
+
statusReason: response2.status_reason,
|
|
1777
|
+
isDisabled: response2.is_disabled,
|
|
1778
|
+
createdAt: response2.created_at,
|
|
1779
|
+
updatedAt: response2.updated_at,
|
|
1780
|
+
testRequestEndpoint: response2.test_request_endpoint
|
|
1781
|
+
}));
|
|
1782
|
+
}
|
|
1783
|
+
function transformConnectedAccountListResponse(response) {
|
|
1784
|
+
return transform(response).with(ConnectedAccountListResponseSchema).using((response2) => ({
|
|
1785
|
+
items: response2.items.map(transformConnectedAccountResponse),
|
|
1786
|
+
nextCursor: response2.next_cursor ?? null,
|
|
1787
|
+
totalPages: response2.total_pages
|
|
1788
|
+
}));
|
|
1588
1789
|
}
|
|
1589
1790
|
|
|
1590
1791
|
// src/models/CustomTools.ts
|
|
@@ -1729,6 +1930,13 @@ var CustomTools = class {
|
|
|
1729
1930
|
async getConnectedAccountForToolkit(toolkitSlug, userId, connectedAccountId) {
|
|
1730
1931
|
try {
|
|
1731
1932
|
await this.client.toolkits.retrieve(toolkitSlug);
|
|
1933
|
+
const toolkit = await this.client.toolkits.retrieve(toolkitSlug);
|
|
1934
|
+
const isNoAuthToolkit = toolkit.auth_config_details?.some(
|
|
1935
|
+
(details) => details.mode === AuthSchemeTypes.NO_AUTH
|
|
1936
|
+
);
|
|
1937
|
+
if (isNoAuthToolkit) {
|
|
1938
|
+
return null;
|
|
1939
|
+
}
|
|
1732
1940
|
} catch (error) {
|
|
1733
1941
|
throw new ComposioToolNotFoundError(`Toolkit with slug ${toolkitSlug} not found`, {
|
|
1734
1942
|
cause: error
|
|
@@ -1771,7 +1979,7 @@ var CustomTools = class {
|
|
|
1771
1979
|
let connectionConfig = null;
|
|
1772
1980
|
const { toolkitSlug, execute, inputParams } = tool.options;
|
|
1773
1981
|
let connectedAccountId = body.connectedAccountId;
|
|
1774
|
-
if (toolkitSlug && toolkitSlug !== "custom") {
|
|
1982
|
+
if (toolkitSlug && toolkitSlug !== "custom" && body.userId) {
|
|
1775
1983
|
const connectedAccount = await this.getConnectedAccountForToolkit(
|
|
1776
1984
|
toolkitSlug,
|
|
1777
1985
|
body.userId,
|
|
@@ -1824,7 +2032,8 @@ var CustomTools = class {
|
|
|
1824
2032
|
method: data.method,
|
|
1825
2033
|
parameters,
|
|
1826
2034
|
body: data.body,
|
|
1827
|
-
connected_account_id:
|
|
2035
|
+
connected_account_id: connectedAccountId,
|
|
2036
|
+
custom_connection_data: data.customConnectionData
|
|
1828
2037
|
});
|
|
1829
2038
|
return {
|
|
1830
2039
|
data: response.data,
|
|
@@ -2303,7 +2512,7 @@ var Tools = class {
|
|
|
2303
2512
|
throw new Error(`Unable to find toolkit for tool ${toolSlug}`);
|
|
2304
2513
|
}
|
|
2305
2514
|
const isNoAuthApp = toolkit.auth_config_details?.some(
|
|
2306
|
-
(authConfigDetails) => authConfigDetails.mode ===
|
|
2515
|
+
(authConfigDetails) => authConfigDetails.mode === AuthSchemeTypes.NO_AUTH
|
|
2307
2516
|
);
|
|
2308
2517
|
if (!isNoAuthApp) {
|
|
2309
2518
|
const connectedAccounts = await this.client.connectedAccounts.list({
|
|
@@ -2632,13 +2841,14 @@ var Tools = class {
|
|
|
2632
2841
|
modifiers?.beforeExecute
|
|
2633
2842
|
);
|
|
2634
2843
|
let connectedAccountId = body.connectedAccountId;
|
|
2635
|
-
if (!connectedAccountId) {
|
|
2844
|
+
if (!connectedAccountId && body.userId) {
|
|
2636
2845
|
connectedAccountId = await this.getConnectedAccountIdForTool(body.userId, tool.slug) || void 0;
|
|
2637
2846
|
}
|
|
2638
2847
|
let result = await this.client.tools.execute(tool.slug, {
|
|
2639
2848
|
allow_tracing: body.allowTracing,
|
|
2640
2849
|
connected_account_id: body.connectedAccountId,
|
|
2641
2850
|
custom_auth_params: body.customAuthParams,
|
|
2851
|
+
custom_connection_data: body.customConnectionData,
|
|
2642
2852
|
arguments: body.arguments,
|
|
2643
2853
|
user_id: body.userId,
|
|
2644
2854
|
version: body.version,
|
|
@@ -2795,8 +3005,8 @@ var Tools = class {
|
|
|
2795
3005
|
};
|
|
2796
3006
|
if (toolProxyParams.data.parameters) {
|
|
2797
3007
|
parameters.push(
|
|
2798
|
-
...
|
|
2799
|
-
name:
|
|
3008
|
+
...(toolProxyParams.data.parameters ?? []).map((value) => ({
|
|
3009
|
+
name: value.name,
|
|
2800
3010
|
type: value.in === "header" ? parameterTypes.header : parameterTypes.query,
|
|
2801
3011
|
value: value.value.toString()
|
|
2802
3012
|
}))
|
|
@@ -2807,7 +3017,8 @@ var Tools = class {
|
|
|
2807
3017
|
method: toolProxyParams.data.method,
|
|
2808
3018
|
body: toolProxyParams.data.body,
|
|
2809
3019
|
connected_account_id: toolProxyParams.data.connectedAccountId,
|
|
2810
|
-
parameters
|
|
3020
|
+
parameters,
|
|
3021
|
+
custom_connection_data: toolProxyParams.data.customConnectionData
|
|
2811
3022
|
});
|
|
2812
3023
|
}
|
|
2813
3024
|
/**
|
|
@@ -2944,6 +3155,44 @@ var ToolkitAuthFieldsResponseSchema = z5.array(
|
|
|
2944
3155
|
})
|
|
2945
3156
|
);
|
|
2946
3157
|
|
|
3158
|
+
// src/utils/transformers/authConfigs.ts
|
|
3159
|
+
function transformAuthConfigRetrieveResponse(authConfig) {
|
|
3160
|
+
return transform(authConfig).with(AuthConfigRetrieveResponseSchema).using((authConfig2) => ({
|
|
3161
|
+
id: authConfig2.id,
|
|
3162
|
+
name: authConfig2.name,
|
|
3163
|
+
noOfConnections: authConfig2.no_of_connections,
|
|
3164
|
+
status: authConfig2.status,
|
|
3165
|
+
toolkit: {
|
|
3166
|
+
logo: authConfig2.toolkit.logo,
|
|
3167
|
+
slug: authConfig2.toolkit.slug
|
|
3168
|
+
},
|
|
3169
|
+
uuid: authConfig2.uuid,
|
|
3170
|
+
authScheme: authConfig2.auth_scheme,
|
|
3171
|
+
credentials: authConfig2.credentials,
|
|
3172
|
+
expectedInputFields: authConfig2.expected_input_fields,
|
|
3173
|
+
isComposioManaged: authConfig2.is_composio_managed,
|
|
3174
|
+
createdBy: authConfig2.created_by,
|
|
3175
|
+
createdAt: authConfig2.created_at,
|
|
3176
|
+
lastUpdatedAt: authConfig2.last_updated_at,
|
|
3177
|
+
restrictToFollowingTools: authConfig2.tool_access_config?.tools_for_connected_account_creation
|
|
3178
|
+
}));
|
|
3179
|
+
}
|
|
3180
|
+
function transformAuthConfigListResponse(response) {
|
|
3181
|
+
return transform(response).with(AuthConfigListResponseSchema).using((response2) => ({
|
|
3182
|
+
items: response2.items.map(transformAuthConfigRetrieveResponse),
|
|
3183
|
+
nextCursor: response2.next_cursor ?? null,
|
|
3184
|
+
totalPages: response2.total_pages
|
|
3185
|
+
}));
|
|
3186
|
+
}
|
|
3187
|
+
function transformCreateAuthConfigResponse(response) {
|
|
3188
|
+
return transform(response).with(CreateAuthConfigResponseSchema).using((response2) => ({
|
|
3189
|
+
id: response2.auth_config.id,
|
|
3190
|
+
authScheme: response2.auth_config.auth_scheme,
|
|
3191
|
+
isComposioManaged: response2.auth_config.is_composio_managed,
|
|
3192
|
+
toolkit: response2.toolkit.slug
|
|
3193
|
+
}));
|
|
3194
|
+
}
|
|
3195
|
+
|
|
2947
3196
|
// src/models/AuthConfigs.ts
|
|
2948
3197
|
var AuthConfigs = class {
|
|
2949
3198
|
client;
|
|
@@ -2959,47 +3208,6 @@ var AuthConfigs = class {
|
|
|
2959
3208
|
getClient() {
|
|
2960
3209
|
return this.client;
|
|
2961
3210
|
}
|
|
2962
|
-
/**
|
|
2963
|
-
* Transforms an auth config response from API format to SDK format.
|
|
2964
|
-
*
|
|
2965
|
-
* This method converts property names from snake_case to camelCase and reorganizes
|
|
2966
|
-
* the data structure to match the SDK's standardized format for auth configurations.
|
|
2967
|
-
*
|
|
2968
|
-
* @param {ComposioAuthConfigRetrieveResponse} authConfig - The raw API response to transform
|
|
2969
|
-
* @returns {AuthConfigRetrieveResponse} The transformed auth config data
|
|
2970
|
-
* @throws {ValidationError} If the response fails validation against the expected schema
|
|
2971
|
-
*
|
|
2972
|
-
* @private
|
|
2973
|
-
*/
|
|
2974
|
-
parseAuthConfigRetrieveResponse(authConfig) {
|
|
2975
|
-
const responseToParse = {
|
|
2976
|
-
id: authConfig.id,
|
|
2977
|
-
name: authConfig.name,
|
|
2978
|
-
noOfConnections: authConfig.no_of_connections,
|
|
2979
|
-
status: authConfig.status,
|
|
2980
|
-
toolkit: {
|
|
2981
|
-
logo: authConfig.toolkit.logo,
|
|
2982
|
-
slug: authConfig.toolkit.slug
|
|
2983
|
-
},
|
|
2984
|
-
uuid: authConfig.uuid,
|
|
2985
|
-
authScheme: authConfig.auth_scheme,
|
|
2986
|
-
credentials: authConfig.credentials,
|
|
2987
|
-
expectedInputFields: authConfig.expected_input_fields,
|
|
2988
|
-
isComposioManaged: authConfig.is_composio_managed,
|
|
2989
|
-
createdBy: authConfig.created_by,
|
|
2990
|
-
createdAt: authConfig.created_at,
|
|
2991
|
-
lastUpdatedAt: authConfig.last_updated_at,
|
|
2992
|
-
restrictToFollowingTools: authConfig.restrict_to_following_tools
|
|
2993
|
-
};
|
|
2994
|
-
const result = AuthConfigRetrieveResponseSchema.safeParse(responseToParse);
|
|
2995
|
-
if (result.error) {
|
|
2996
|
-
logger_default.error("Failed to parse auth config response", {
|
|
2997
|
-
cause: result.error
|
|
2998
|
-
});
|
|
2999
|
-
return responseToParse;
|
|
3000
|
-
}
|
|
3001
|
-
return result.data;
|
|
3002
|
-
}
|
|
3003
3211
|
/**
|
|
3004
3212
|
* Lists authentication configurations based on provided filter criteria.
|
|
3005
3213
|
*
|
|
@@ -3034,17 +3242,7 @@ var AuthConfigs = class {
|
|
|
3034
3242
|
limit: parsedQuery?.limit,
|
|
3035
3243
|
toolkit_slug: parsedQuery?.toolkit
|
|
3036
3244
|
});
|
|
3037
|
-
|
|
3038
|
-
items: result.items.map((item) => this.parseAuthConfigRetrieveResponse(item)),
|
|
3039
|
-
nextCursor: result.next_cursor,
|
|
3040
|
-
totalPages: result.total_pages
|
|
3041
|
-
});
|
|
3042
|
-
if (parsedResult.error) {
|
|
3043
|
-
throw new ValidationError("Failed to parse auth config list response", {
|
|
3044
|
-
cause: parsedResult.error
|
|
3045
|
-
});
|
|
3046
|
-
}
|
|
3047
|
-
return parsedResult.data;
|
|
3245
|
+
return transformAuthConfigListResponse(result);
|
|
3048
3246
|
}
|
|
3049
3247
|
/**
|
|
3050
3248
|
* Create a new auth config
|
|
@@ -3080,26 +3278,19 @@ var AuthConfigs = class {
|
|
|
3080
3278
|
name: parsedOptions.data.name,
|
|
3081
3279
|
authScheme: parsedOptions.data.authScheme,
|
|
3082
3280
|
credentials: parsedOptions.data.credentials,
|
|
3083
|
-
|
|
3281
|
+
tool_access_config: {
|
|
3282
|
+
tools_for_connected_account_creation: parsedOptions.data.restrictToFollowingTools
|
|
3283
|
+
}
|
|
3084
3284
|
} : {
|
|
3085
3285
|
type: parsedOptions.data.type,
|
|
3086
3286
|
credentials: parsedOptions.data.credentials,
|
|
3087
3287
|
name: parsedOptions.data.name,
|
|
3088
|
-
|
|
3288
|
+
tool_access_config: {
|
|
3289
|
+
tools_for_connected_account_creation: parsedOptions.data.restrictToFollowingTools
|
|
3290
|
+
}
|
|
3089
3291
|
}
|
|
3090
3292
|
});
|
|
3091
|
-
|
|
3092
|
-
id: result.auth_config.id,
|
|
3093
|
-
authScheme: result.auth_config.auth_scheme,
|
|
3094
|
-
isComposioManaged: result.auth_config.is_composio_managed,
|
|
3095
|
-
toolkit: result.toolkit.slug
|
|
3096
|
-
});
|
|
3097
|
-
if (parsedResult.error) {
|
|
3098
|
-
throw new ValidationError("Failed to parse auth config create response", {
|
|
3099
|
-
cause: parsedResult.error
|
|
3100
|
-
});
|
|
3101
|
-
}
|
|
3102
|
-
return parsedResult.data;
|
|
3293
|
+
return transformCreateAuthConfigResponse(result);
|
|
3103
3294
|
}
|
|
3104
3295
|
/**
|
|
3105
3296
|
* Retrieves a specific authentication configuration by its ID.
|
|
@@ -3122,7 +3313,7 @@ var AuthConfigs = class {
|
|
|
3122
3313
|
*/
|
|
3123
3314
|
async get(nanoid) {
|
|
3124
3315
|
const result = await this.client.authConfigs.retrieve(nanoid);
|
|
3125
|
-
return
|
|
3316
|
+
return transformAuthConfigRetrieveResponse(result);
|
|
3126
3317
|
}
|
|
3127
3318
|
/**
|
|
3128
3319
|
* Updates an existing authentication configuration.
|
|
@@ -3166,11 +3357,15 @@ var AuthConfigs = class {
|
|
|
3166
3357
|
parsedData.data.type === "custom" ? {
|
|
3167
3358
|
type: "custom",
|
|
3168
3359
|
credentials: parsedData.data.credentials,
|
|
3169
|
-
|
|
3360
|
+
tool_access_config: {
|
|
3361
|
+
tools_for_connected_account_creation: parsedData.data.restrictToFollowingTools
|
|
3362
|
+
}
|
|
3170
3363
|
} : {
|
|
3171
3364
|
type: "default",
|
|
3172
3365
|
scopes: parsedData.data.scopes,
|
|
3173
|
-
|
|
3366
|
+
tool_access_config: {
|
|
3367
|
+
tools_for_connected_account_creation: parsedData.data.restrictToFollowingTools
|
|
3368
|
+
}
|
|
3174
3369
|
}
|
|
3175
3370
|
);
|
|
3176
3371
|
}
|
|
@@ -3382,17 +3577,7 @@ var ConnectedAccounts = class {
|
|
|
3382
3577
|
};
|
|
3383
3578
|
}
|
|
3384
3579
|
const result = await this.client.connectedAccounts.list(rawQuery);
|
|
3385
|
-
|
|
3386
|
-
items: result.items.map(transformConnectedAccountResponse),
|
|
3387
|
-
nextCursor: result.next_cursor,
|
|
3388
|
-
totalPages: result.total_pages
|
|
3389
|
-
});
|
|
3390
|
-
if (!parsedResponse.success) {
|
|
3391
|
-
throw new ValidationError("Failed to parse connected account list response", {
|
|
3392
|
-
cause: parsedResponse.error
|
|
3393
|
-
});
|
|
3394
|
-
}
|
|
3395
|
-
return parsedResponse.data;
|
|
3580
|
+
return transformConnectedAccountListResponse(result);
|
|
3396
3581
|
}
|
|
3397
3582
|
/**
|
|
3398
3583
|
* Compound function to create a new connected account.
|
|
@@ -3628,6 +3813,77 @@ var ConnectedAccounts = class {
|
|
|
3628
3813
|
|
|
3629
3814
|
// src/models/Toolkits.ts
|
|
3630
3815
|
import { APIError } from "openai";
|
|
3816
|
+
|
|
3817
|
+
// src/utils/transformers/toolkits.ts
|
|
3818
|
+
var transformToolkitListResponse = (response) => {
|
|
3819
|
+
return transform(response).with(ToolKitListResponseSchema).using(
|
|
3820
|
+
(response2) => response2.items.map((item) => ({
|
|
3821
|
+
name: item.name,
|
|
3822
|
+
slug: item.slug,
|
|
3823
|
+
meta: {
|
|
3824
|
+
...item.meta,
|
|
3825
|
+
categories: item.meta.categories?.map((category) => ({
|
|
3826
|
+
slug: category.id,
|
|
3827
|
+
name: category.name
|
|
3828
|
+
})),
|
|
3829
|
+
createdAt: item.meta.created_at,
|
|
3830
|
+
description: item.meta.description,
|
|
3831
|
+
logo: item.meta.logo,
|
|
3832
|
+
toolsCount: item.meta.tools_count,
|
|
3833
|
+
triggersCount: item.meta.triggers_count,
|
|
3834
|
+
updatedAt: item.meta.updated_at,
|
|
3835
|
+
appUrl: item.meta.app_url ?? void 0
|
|
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
|
+
);
|
|
3843
|
+
};
|
|
3844
|
+
var transformToolkitRetrieveResponse = (response) => {
|
|
3845
|
+
return transform(response).with(ToolkitRetrieveResponseSchema).using((response2) => ({
|
|
3846
|
+
name: response2.name,
|
|
3847
|
+
slug: response2.slug,
|
|
3848
|
+
meta: {
|
|
3849
|
+
...response2.meta,
|
|
3850
|
+
createdAt: response2.meta.created_at,
|
|
3851
|
+
updatedAt: response2.meta.updated_at,
|
|
3852
|
+
toolsCount: response2.meta.tools_count,
|
|
3853
|
+
triggersCount: response2.meta.triggers_count,
|
|
3854
|
+
categories: response2.meta.categories?.map((category) => ({
|
|
3855
|
+
slug: category.slug,
|
|
3856
|
+
name: category.name
|
|
3857
|
+
}))
|
|
3858
|
+
// appUrl: response.meta.app_url, @TODO Update the client type to include this
|
|
3859
|
+
},
|
|
3860
|
+
isLocalToolkit: response2.is_local_toolkit,
|
|
3861
|
+
composioManagedAuthSchemes: response2.composio_managed_auth_schemes,
|
|
3862
|
+
authConfigDetails: response2.auth_config_details?.map((authConfig) => ({
|
|
3863
|
+
name: authConfig.name,
|
|
3864
|
+
mode: authConfig.mode,
|
|
3865
|
+
fields: {
|
|
3866
|
+
authConfigCreation: authConfig.fields.auth_config_creation,
|
|
3867
|
+
connectedAccountInitiation: authConfig.fields.connected_account_initiation
|
|
3868
|
+
},
|
|
3869
|
+
proxy: {
|
|
3870
|
+
baseUrl: authConfig.proxy?.base_url
|
|
3871
|
+
}
|
|
3872
|
+
}))
|
|
3873
|
+
}));
|
|
3874
|
+
};
|
|
3875
|
+
var transformToolkitRetrieveCategoriesResponse = (response) => {
|
|
3876
|
+
return transform(response).with(ToolkitRetrieveCategoriesResponseSchema).using((response2) => ({
|
|
3877
|
+
items: response2.items.map((item) => ({
|
|
3878
|
+
id: item.id,
|
|
3879
|
+
name: item.name
|
|
3880
|
+
})),
|
|
3881
|
+
nextCursor: response2.next_cursor ?? null,
|
|
3882
|
+
totalPages: response2.total_pages
|
|
3883
|
+
}));
|
|
3884
|
+
};
|
|
3885
|
+
|
|
3886
|
+
// src/models/Toolkits.ts
|
|
3631
3887
|
var Toolkits = class {
|
|
3632
3888
|
client;
|
|
3633
3889
|
constructor(client) {
|
|
@@ -3660,40 +3916,7 @@ var Toolkits = class {
|
|
|
3660
3916
|
managed_by: parsedQuery.data.managedBy,
|
|
3661
3917
|
sort_by: parsedQuery.data.sortBy
|
|
3662
3918
|
});
|
|
3663
|
-
|
|
3664
|
-
result.items.map((item) => {
|
|
3665
|
-
const parsedItem = ToolKitItemSchema.safeParse({
|
|
3666
|
-
name: item.name,
|
|
3667
|
-
slug: item.slug,
|
|
3668
|
-
meta: {
|
|
3669
|
-
...item.meta,
|
|
3670
|
-
createdAt: item.meta.created_at,
|
|
3671
|
-
updatedAt: item.meta.updated_at,
|
|
3672
|
-
toolsCount: item.meta.tools_count,
|
|
3673
|
-
triggersCount: item.meta.triggers_count,
|
|
3674
|
-
categories: item.meta.categories,
|
|
3675
|
-
appUrl: item.meta.app_url,
|
|
3676
|
-
logo: item.meta.logo
|
|
3677
|
-
},
|
|
3678
|
-
isLocalToolkit: item.is_local_toolkit,
|
|
3679
|
-
authSchemes: item.auth_schemes,
|
|
3680
|
-
composioManagedAuthSchemes: item.composio_managed_auth_schemes,
|
|
3681
|
-
noAuth: item.no_auth
|
|
3682
|
-
});
|
|
3683
|
-
if (!parsedItem.success) {
|
|
3684
|
-
throw new ValidationError("Failed to parse toolkit response", {
|
|
3685
|
-
cause: parsedItem.error
|
|
3686
|
-
});
|
|
3687
|
-
}
|
|
3688
|
-
return parsedItem.data;
|
|
3689
|
-
})
|
|
3690
|
-
);
|
|
3691
|
-
if (!parsedResult.success) {
|
|
3692
|
-
throw new ValidationError("Failed to parse toolkit list response", {
|
|
3693
|
-
cause: parsedResult.error
|
|
3694
|
-
});
|
|
3695
|
-
}
|
|
3696
|
-
return parsedResult.data;
|
|
3919
|
+
return transformToolkitListResponse(result);
|
|
3697
3920
|
} catch (error) {
|
|
3698
3921
|
throw new ComposioToolkitFetchError("Failed to fetch toolkits", {
|
|
3699
3922
|
cause: error
|
|
@@ -3716,37 +3939,7 @@ var Toolkits = class {
|
|
|
3716
3939
|
async getToolkitBySlug(slug) {
|
|
3717
3940
|
try {
|
|
3718
3941
|
const result = await this.client.toolkits.retrieve(slug);
|
|
3719
|
-
|
|
3720
|
-
name: result.name,
|
|
3721
|
-
slug: result.slug,
|
|
3722
|
-
meta: {
|
|
3723
|
-
...result.meta,
|
|
3724
|
-
createdAt: result.meta.created_at,
|
|
3725
|
-
updatedAt: result.meta.updated_at,
|
|
3726
|
-
toolsCount: result.meta.tools_count,
|
|
3727
|
-
triggersCount: result.meta.triggers_count
|
|
3728
|
-
// appUrl: result.meta.app_url, @TODO Update the client type to include this
|
|
3729
|
-
},
|
|
3730
|
-
isLocalToolkit: result.is_local_toolkit,
|
|
3731
|
-
composioManagedAuthSchemes: result.composio_managed_auth_schemes,
|
|
3732
|
-
authConfigDetails: result.auth_config_details?.map((authConfig) => ({
|
|
3733
|
-
name: authConfig.name,
|
|
3734
|
-
mode: authConfig.mode,
|
|
3735
|
-
fields: {
|
|
3736
|
-
authConfigCreation: authConfig.fields.auth_config_creation,
|
|
3737
|
-
connectedAccountInitiation: authConfig.fields.connected_account_initiation
|
|
3738
|
-
},
|
|
3739
|
-
proxy: {
|
|
3740
|
-
baseUrl: authConfig.proxy?.base_url
|
|
3741
|
-
}
|
|
3742
|
-
}))
|
|
3743
|
-
});
|
|
3744
|
-
if (!parsedResult.success) {
|
|
3745
|
-
throw new ValidationError("Failed to parse toolkit response", {
|
|
3746
|
-
cause: parsedResult.error
|
|
3747
|
-
});
|
|
3748
|
-
}
|
|
3749
|
-
return parsedResult.data;
|
|
3942
|
+
return transformToolkitRetrieveResponse(result);
|
|
3750
3943
|
} catch (error) {
|
|
3751
3944
|
if (error instanceof APIError && (error.status === 404 || error.status === 400)) {
|
|
3752
3945
|
throw new ComposioToolkitNotFoundError(`Toolkit with slug ${slug} not found`, {
|
|
@@ -3774,7 +3967,7 @@ var Toolkits = class {
|
|
|
3774
3967
|
if (typeof arg === "string") {
|
|
3775
3968
|
return this.getToolkitBySlug(arg);
|
|
3776
3969
|
}
|
|
3777
|
-
return this.getToolkits(arg);
|
|
3970
|
+
return this.getToolkits(arg ?? {});
|
|
3778
3971
|
}
|
|
3779
3972
|
async getAuthConfigFields(toolkitSlug, authScheme, authConfigType, requiredOnly) {
|
|
3780
3973
|
const toolkit = await this.getToolkitBySlug(toolkitSlug);
|
|
@@ -3867,23 +4060,7 @@ var Toolkits = class {
|
|
|
3867
4060
|
*/
|
|
3868
4061
|
async listCategories() {
|
|
3869
4062
|
const result = await this.client.toolkits.retrieveCategories();
|
|
3870
|
-
|
|
3871
|
-
items: result.items.map((item) => {
|
|
3872
|
-
const parsedItem = ToolkitCategorySchema.parse({
|
|
3873
|
-
id: item.id,
|
|
3874
|
-
name: item.name
|
|
3875
|
-
});
|
|
3876
|
-
return parsedItem;
|
|
3877
|
-
}),
|
|
3878
|
-
nextCursor: result.next_cursor,
|
|
3879
|
-
totalPages: result.total_pages
|
|
3880
|
-
});
|
|
3881
|
-
if (!parsedResult.success) {
|
|
3882
|
-
throw new ValidationError("Failed to parse toolkit categories response", {
|
|
3883
|
-
cause: parsedResult.error
|
|
3884
|
-
});
|
|
3885
|
-
}
|
|
3886
|
-
return parsedResult.data;
|
|
4063
|
+
return transformToolkitRetrieveCategoriesResponse(result);
|
|
3887
4064
|
}
|
|
3888
4065
|
/**
|
|
3889
4066
|
* Authorizes a user to use a toolkit.
|
|
@@ -3897,22 +4074,24 @@ var Toolkits = class {
|
|
|
3897
4074
|
* const connectionRequest = await composio.toolkits.authorize(userId, 'github');
|
|
3898
4075
|
* ```
|
|
3899
4076
|
*/
|
|
3900
|
-
async authorize(userId, toolkitSlug) {
|
|
4077
|
+
async authorize(userId, toolkitSlug, authConfigId) {
|
|
3901
4078
|
const toolkit = await this.getToolkitBySlug(toolkitSlug);
|
|
3902
4079
|
const composioAuthConfig = new AuthConfigs(this.client);
|
|
3903
|
-
let authConfigIdToUse;
|
|
3904
|
-
|
|
3905
|
-
|
|
3906
|
-
|
|
3907
|
-
|
|
4080
|
+
let authConfigIdToUse = authConfigId;
|
|
4081
|
+
if (!authConfigIdToUse) {
|
|
4082
|
+
const authConfig = await composioAuthConfig.list({
|
|
4083
|
+
toolkit: toolkitSlug
|
|
4084
|
+
});
|
|
4085
|
+
authConfigIdToUse = authConfig.items[0]?.id;
|
|
4086
|
+
}
|
|
3908
4087
|
if (!authConfigIdToUse) {
|
|
3909
4088
|
if (toolkit.authConfigDetails && toolkit.authConfigDetails.length > 0) {
|
|
3910
4089
|
try {
|
|
3911
|
-
const
|
|
4090
|
+
const authConfig = await composioAuthConfig.create(toolkitSlug, {
|
|
3912
4091
|
type: "use_composio_managed_auth",
|
|
3913
4092
|
name: `${toolkit.name} Auth Config`
|
|
3914
4093
|
});
|
|
3915
|
-
authConfigIdToUse =
|
|
4094
|
+
authConfigIdToUse = authConfig.id;
|
|
3916
4095
|
} catch (error) {
|
|
3917
4096
|
if (error instanceof ComposioClient2.APIError && error.status === 400) {
|
|
3918
4097
|
throw new ComposioAuthConfigNotFoundError(
|
|
@@ -4327,27 +4506,75 @@ var PusherService = class {
|
|
|
4327
4506
|
}
|
|
4328
4507
|
};
|
|
4329
4508
|
|
|
4330
|
-
// src/utils/
|
|
4331
|
-
function
|
|
4332
|
-
return {
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
|
|
4339
|
-
|
|
4340
|
-
|
|
4341
|
-
|
|
4342
|
-
|
|
4343
|
-
|
|
4344
|
-
|
|
4345
|
-
|
|
4346
|
-
|
|
4347
|
-
|
|
4348
|
-
|
|
4509
|
+
// src/utils/transformers/triggers.ts
|
|
4510
|
+
function transformIncomingTriggerPayload(response) {
|
|
4511
|
+
return transform(response).with(IncomingTriggerPayloadSchema).using((response2) => ({
|
|
4512
|
+
id: response2.metadata.nanoId,
|
|
4513
|
+
uuid: response2.metadata.id,
|
|
4514
|
+
triggerSlug: response2.metadata.triggerName,
|
|
4515
|
+
toolkitSlug: response2.appName,
|
|
4516
|
+
userId: response2.metadata.connection?.clientUniqueUserId,
|
|
4517
|
+
payload: response2.payload,
|
|
4518
|
+
originalPayload: response2.originalPayload,
|
|
4519
|
+
metadata: {
|
|
4520
|
+
id: response2.metadata.nanoId,
|
|
4521
|
+
uuid: response2.metadata.id,
|
|
4522
|
+
triggerConfig: response2.metadata.triggerConfig,
|
|
4523
|
+
triggerSlug: response2.metadata.triggerName,
|
|
4524
|
+
toolkitSlug: response2.appName,
|
|
4525
|
+
triggerData: response2.metadata.triggerData,
|
|
4526
|
+
connectedAccount: {
|
|
4527
|
+
id: response2.metadata.connection?.connectedAccountNanoId,
|
|
4528
|
+
uuid: response2.metadata.connection?.id,
|
|
4529
|
+
authConfigId: response2.metadata.connection?.authConfigNanoId,
|
|
4530
|
+
authConfigUUID: response2.metadata.connection?.integrationId,
|
|
4531
|
+
userId: response2.metadata.connection?.clientUniqueUserId,
|
|
4532
|
+
status: response2.metadata.connection?.status
|
|
4533
|
+
}
|
|
4349
4534
|
}
|
|
4350
|
-
};
|
|
4535
|
+
}));
|
|
4536
|
+
}
|
|
4537
|
+
function transformTriggerTypeRetrieveResponse(response) {
|
|
4538
|
+
return transform(response).with(TriggerTypeSchema).using((response2) => ({
|
|
4539
|
+
slug: response2.slug,
|
|
4540
|
+
name: response2.name,
|
|
4541
|
+
description: response2.description,
|
|
4542
|
+
instructions: response2.instructions,
|
|
4543
|
+
toolkit: {
|
|
4544
|
+
logo: response2.toolkit.logo,
|
|
4545
|
+
slug: response2.toolkit.slug,
|
|
4546
|
+
name: response2.toolkit.name
|
|
4547
|
+
},
|
|
4548
|
+
payload: response2.payload,
|
|
4549
|
+
config: response2.config
|
|
4550
|
+
}));
|
|
4551
|
+
}
|
|
4552
|
+
function transformTriggerTypeListResponse(response) {
|
|
4553
|
+
return transform(response).with(TriggersTypeListResponseSchema).using((response2) => ({
|
|
4554
|
+
items: response2.items,
|
|
4555
|
+
nextCursor: response2.next_cursor ?? null,
|
|
4556
|
+
totalPages: response2.total_pages
|
|
4557
|
+
}));
|
|
4558
|
+
}
|
|
4559
|
+
function transformTriggerInstanceListActiveItem(response) {
|
|
4560
|
+
return transform(response).with(TriggerInstanceListActiveResponseItemSchema).using((response2) => ({
|
|
4561
|
+
id: response2.id,
|
|
4562
|
+
connectedAccountId: response2.connected_account_id,
|
|
4563
|
+
disabledAt: response2.disabled_at,
|
|
4564
|
+
state: response2.state,
|
|
4565
|
+
triggerConfig: response2.trigger_config,
|
|
4566
|
+
triggerName: response2.trigger_name,
|
|
4567
|
+
updatedAt: response2.updated_at,
|
|
4568
|
+
triggerData: response2.trigger_data,
|
|
4569
|
+
uuid: response2.uuid
|
|
4570
|
+
}));
|
|
4571
|
+
}
|
|
4572
|
+
function transformTriggerInstanceListActiveResponse(response) {
|
|
4573
|
+
return transform(response).with(TriggerInstanceListActiveResponseSchema).using((response2) => ({
|
|
4574
|
+
items: response2.items.map((item) => transformTriggerInstanceListActiveItem(item)),
|
|
4575
|
+
nextCursor: response2.next_cursor ?? null,
|
|
4576
|
+
totalPages: response2.total_pages
|
|
4577
|
+
}));
|
|
4351
4578
|
}
|
|
4352
4579
|
|
|
4353
4580
|
// src/models/Triggers.ts
|
|
@@ -4359,31 +4586,6 @@ var Triggers = class {
|
|
|
4359
4586
|
this.pusherService = new PusherService(client);
|
|
4360
4587
|
telemetry.instrument(this);
|
|
4361
4588
|
}
|
|
4362
|
-
/**
|
|
4363
|
-
* Parse the trigger instance list active item
|
|
4364
|
-
*
|
|
4365
|
-
* @param response - The response from the composio client
|
|
4366
|
-
* @returns The parsed trigger instance list active item
|
|
4367
|
-
*/
|
|
4368
|
-
parseTriggerInstanceListActiveItem(response) {
|
|
4369
|
-
const parsed = TriggerInstanceListActiveResponseItemSchema.safeParse({
|
|
4370
|
-
id: response.id,
|
|
4371
|
-
connectedAccountId: response.connected_account_id,
|
|
4372
|
-
disabledAt: response.disabled_at,
|
|
4373
|
-
state: response.state,
|
|
4374
|
-
triggerConfig: response.trigger_config,
|
|
4375
|
-
triggerName: response.trigger_name,
|
|
4376
|
-
updatedAt: response.updated_at,
|
|
4377
|
-
triggerData: response.trigger_data,
|
|
4378
|
-
uuid: response.uuid
|
|
4379
|
-
});
|
|
4380
|
-
if (!parsed.success) {
|
|
4381
|
-
throw new ValidationError(`Invalid trigger instance list active item`, {
|
|
4382
|
-
cause: parsed.error
|
|
4383
|
-
});
|
|
4384
|
-
}
|
|
4385
|
-
return parsed.data;
|
|
4386
|
-
}
|
|
4387
4589
|
/**
|
|
4388
4590
|
* Fetch list of all the active triggers
|
|
4389
4591
|
*
|
|
@@ -4419,17 +4621,7 @@ var Triggers = class {
|
|
|
4419
4621
|
trigger_names: parsedParams.data.triggerNames
|
|
4420
4622
|
} : void 0
|
|
4421
4623
|
);
|
|
4422
|
-
|
|
4423
|
-
items: result.items.map((item) => this.parseTriggerInstanceListActiveItem(item)),
|
|
4424
|
-
nextCursor: result.next_cursor,
|
|
4425
|
-
totalPages: result.total_pages
|
|
4426
|
-
});
|
|
4427
|
-
if (!parsedResult.success) {
|
|
4428
|
-
throw new ValidationError(`Invalid trigger instance list active response`, {
|
|
4429
|
-
cause: parsedResult.error
|
|
4430
|
-
});
|
|
4431
|
-
}
|
|
4432
|
-
return parsedResult.data;
|
|
4624
|
+
return transformTriggerInstanceListActiveResponse(result);
|
|
4433
4625
|
}
|
|
4434
4626
|
/**
|
|
4435
4627
|
* Create a new trigger instance for a user
|
|
@@ -4517,15 +4709,9 @@ var Triggers = class {
|
|
|
4517
4709
|
connected_account_id: connectedAccountId,
|
|
4518
4710
|
trigger_config: parsedBody.data.triggerConfig
|
|
4519
4711
|
});
|
|
4520
|
-
|
|
4712
|
+
return {
|
|
4521
4713
|
triggerId: result.trigger_id
|
|
4522
|
-
}
|
|
4523
|
-
if (!parsedResult.success) {
|
|
4524
|
-
throw new ValidationError(`Invalid trigger instance upsert response`, {
|
|
4525
|
-
cause: parsedResult.error
|
|
4526
|
-
});
|
|
4527
|
-
}
|
|
4528
|
-
return parsedResult.data;
|
|
4714
|
+
};
|
|
4529
4715
|
}
|
|
4530
4716
|
/**
|
|
4531
4717
|
* Update an existing trigger instance
|
|
@@ -4545,15 +4731,9 @@ var Triggers = class {
|
|
|
4545
4731
|
*/
|
|
4546
4732
|
async delete(triggerId) {
|
|
4547
4733
|
const result = await this.client.triggerInstances.manage.delete(triggerId);
|
|
4548
|
-
|
|
4734
|
+
return {
|
|
4549
4735
|
triggerId: result.trigger_id
|
|
4550
|
-
}
|
|
4551
|
-
if (!parsedResult.success) {
|
|
4552
|
-
throw new ValidationError(`Invalid trigger instance manage delete response`, {
|
|
4553
|
-
cause: parsedResult.error
|
|
4554
|
-
});
|
|
4555
|
-
}
|
|
4556
|
-
return parsedResult.data;
|
|
4736
|
+
};
|
|
4557
4737
|
}
|
|
4558
4738
|
/**
|
|
4559
4739
|
* Disable a trigger instance
|
|
@@ -4594,12 +4774,7 @@ var Triggers = class {
|
|
|
4594
4774
|
limit: parsedQuery.limit,
|
|
4595
4775
|
toolkit_slugs: parsedQuery.toolkits
|
|
4596
4776
|
});
|
|
4597
|
-
|
|
4598
|
-
items: raw.items,
|
|
4599
|
-
nextCursor: raw.next_cursor ?? null,
|
|
4600
|
-
totalPages: raw.total_pages
|
|
4601
|
-
}));
|
|
4602
|
-
return parsedResult;
|
|
4777
|
+
return transformTriggerTypeListResponse(result);
|
|
4603
4778
|
}
|
|
4604
4779
|
/**
|
|
4605
4780
|
* Retrieve a trigger type by its slug
|
|
@@ -4610,20 +4785,7 @@ var Triggers = class {
|
|
|
4610
4785
|
*/
|
|
4611
4786
|
async getType(slug) {
|
|
4612
4787
|
const result = await this.client.triggersTypes.retrieve(slug);
|
|
4613
|
-
|
|
4614
|
-
slug: raw.slug,
|
|
4615
|
-
name: raw.name,
|
|
4616
|
-
description: raw.description,
|
|
4617
|
-
instructions: raw.instructions,
|
|
4618
|
-
toolkit: {
|
|
4619
|
-
logo: raw.toolkit.logo,
|
|
4620
|
-
slug: raw.toolkit.slug,
|
|
4621
|
-
name: raw.toolkit.name
|
|
4622
|
-
},
|
|
4623
|
-
payload: raw.payload,
|
|
4624
|
-
config: raw.config
|
|
4625
|
-
}));
|
|
4626
|
-
return parsedResult;
|
|
4788
|
+
return transformTriggerTypeRetrieveResponse(result);
|
|
4627
4789
|
}
|
|
4628
4790
|
/**
|
|
4629
4791
|
* Fetches the list of all the available trigger enums
|
|
@@ -4709,40 +4871,10 @@ var Triggers = class {
|
|
|
4709
4871
|
await this.pusherService.subscribe((_data) => {
|
|
4710
4872
|
logger_default.debug("Received raw trigger data", JSON.stringify(_data, null, 2));
|
|
4711
4873
|
const data = _data;
|
|
4712
|
-
const parsedData =
|
|
4713
|
-
|
|
4714
|
-
uuid: data.metadata.id,
|
|
4715
|
-
triggerSlug: data.metadata.triggerName,
|
|
4716
|
-
toolkitSlug: data.appName,
|
|
4717
|
-
userId: data.metadata.connection?.clientUniqueUserId,
|
|
4718
|
-
payload: data.payload,
|
|
4719
|
-
originalPayload: data.originalPayload,
|
|
4720
|
-
metadata: {
|
|
4721
|
-
id: data.metadata.nanoId,
|
|
4722
|
-
uuid: data.metadata.id,
|
|
4723
|
-
triggerConfig: data.metadata.triggerConfig,
|
|
4724
|
-
triggerSlug: data.metadata.triggerName,
|
|
4725
|
-
toolkitSlug: data.appName,
|
|
4726
|
-
triggerData: data.metadata.triggerData,
|
|
4727
|
-
connectedAccount: {
|
|
4728
|
-
id: data.metadata.connection?.connectedAccountNanoId,
|
|
4729
|
-
uuid: data.metadata.connection?.id,
|
|
4730
|
-
authConfigId: data.metadata.connection?.authConfigNanoId,
|
|
4731
|
-
authConfigUUID: data.metadata.connection?.integrationId,
|
|
4732
|
-
userId: data.metadata.connection?.clientUniqueUserId,
|
|
4733
|
-
status: data.metadata.connection?.status
|
|
4734
|
-
}
|
|
4735
|
-
}
|
|
4736
|
-
});
|
|
4737
|
-
logger_default.debug("Parsed trigger data", JSON.stringify(parsedData.data, null, 2));
|
|
4738
|
-
if (parsedData.error) {
|
|
4739
|
-
throw new ValidationError(`Invalid trigger payload`, {
|
|
4740
|
-
cause: parsedData.error
|
|
4741
|
-
});
|
|
4742
|
-
}
|
|
4743
|
-
if (this.shouldSendTriggerAfterFilters(parsedFilters.data, parsedData.data)) {
|
|
4874
|
+
const parsedData = transformIncomingTriggerPayload(data);
|
|
4875
|
+
if (this.shouldSendTriggerAfterFilters(parsedFilters.data, parsedData)) {
|
|
4744
4876
|
try {
|
|
4745
|
-
fn(parsedData
|
|
4877
|
+
fn(parsedData);
|
|
4746
4878
|
} catch (error) {
|
|
4747
4879
|
logger_default.error("\u274C Error in trigger callback:", error);
|
|
4748
4880
|
}
|
|
@@ -4783,7 +4915,7 @@ var MCPToolkitConfigsArraySchema = z8.array(MCPToolkitConfigSchema).min(1, "At l
|
|
|
4783
4915
|
return uniqueToolkits.size === toolkits.length;
|
|
4784
4916
|
}, "Duplicate toolkits are not allowed. Each toolkit must be unique.");
|
|
4785
4917
|
var MCPAuthOptionsSchema = z8.object({
|
|
4786
|
-
|
|
4918
|
+
isChatAuth: z8.boolean().optional()
|
|
4787
4919
|
});
|
|
4788
4920
|
var MCPGetServerParamsSchema = z8.object({
|
|
4789
4921
|
userId: z8.string().min(1, "User ID cannot be empty").optional(),
|
|
@@ -4801,7 +4933,7 @@ var MCPGetServerParamsSchema = z8.object({
|
|
|
4801
4933
|
var MCPGenerateURLParamsSchema = z8.object({
|
|
4802
4934
|
userIds: z8.array(z8.string()).optional(),
|
|
4803
4935
|
connectedAccountIds: z8.array(z8.string()).optional(),
|
|
4804
|
-
|
|
4936
|
+
isChatAuth: z8.boolean().optional()
|
|
4805
4937
|
});
|
|
4806
4938
|
var ComposioGenerateURLParamsSchema = z8.object({
|
|
4807
4939
|
user_ids: z8.array(z8.string()).optional(),
|
|
@@ -4855,6 +4987,11 @@ var MCPServerUpdateParamsSchema = z8.object({
|
|
|
4855
4987
|
allowedTools: z8.array(z8.string()).optional().describe("Updated list of allowed tools")
|
|
4856
4988
|
});
|
|
4857
4989
|
var MCPServerCreateResponseSchema = MCPServerSchema;
|
|
4990
|
+
var ConnectionStatus = /* @__PURE__ */ ((ConnectionStatus2) => {
|
|
4991
|
+
ConnectionStatus2["CONNECTED"] = "CONNECTED";
|
|
4992
|
+
ConnectionStatus2["DISCONNECTED"] = "DISCONNECTED";
|
|
4993
|
+
return ConnectionStatus2;
|
|
4994
|
+
})(ConnectionStatus || {});
|
|
4858
4995
|
var CustomCreateResponseSchema = z8.object({
|
|
4859
4996
|
id: z8.string().min(1, "Server ID cannot be empty"),
|
|
4860
4997
|
name: z8.string().min(1, "Server name cannot be empty"),
|
|
@@ -4899,7 +5036,14 @@ var McpRetrieveResponseSchema = z8.object({
|
|
|
4899
5036
|
status: z8.string().optional(),
|
|
4900
5037
|
toolkits: z8.array(z8.string()).optional(),
|
|
4901
5038
|
tools: z8.array(z8.string()).optional(),
|
|
4902
|
-
managedAuthViaComposio: z8.boolean().optional()
|
|
5039
|
+
managedAuthViaComposio: z8.boolean().optional(),
|
|
5040
|
+
authConfigIds: z8.array(z8.string()).optional(),
|
|
5041
|
+
mcpUrl: z8.string(),
|
|
5042
|
+
commands: z8.object({
|
|
5043
|
+
claude: z8.string(),
|
|
5044
|
+
cursor: z8.string(),
|
|
5045
|
+
windsurf: z8.string()
|
|
5046
|
+
})
|
|
4903
5047
|
});
|
|
4904
5048
|
var ComposioMcpRetrieveResponseSchema = z8.object({
|
|
4905
5049
|
id: z8.string().min(1, "Server ID cannot be empty"),
|
|
@@ -4982,8 +5126,11 @@ function transformMcpRetrieveResponse(response) {
|
|
|
4982
5126
|
updatedAt: response.updated_at,
|
|
4983
5127
|
status: response.status,
|
|
4984
5128
|
toolkits: response.toolkits,
|
|
4985
|
-
tools: response.
|
|
4986
|
-
managedAuthViaComposio: response.managed_auth_via_composio
|
|
5129
|
+
tools: response.allowed_tools,
|
|
5130
|
+
managedAuthViaComposio: response.managed_auth_via_composio,
|
|
5131
|
+
authConfigIds: response.auth_config_ids,
|
|
5132
|
+
mcpUrl: response.mcp_url,
|
|
5133
|
+
commands: response.commands
|
|
4987
5134
|
});
|
|
4988
5135
|
if (!result.success) {
|
|
4989
5136
|
throw new ValidationError("Failed to parse MCP retrieve response", {
|
|
@@ -5040,9 +5187,11 @@ function transformMcpGenerateUrlResponse(response) {
|
|
|
5040
5187
|
var MCP = class {
|
|
5041
5188
|
client;
|
|
5042
5189
|
provider;
|
|
5190
|
+
toolkits;
|
|
5043
5191
|
constructor(client, provider) {
|
|
5044
5192
|
this.client = client;
|
|
5045
5193
|
this.provider = provider;
|
|
5194
|
+
this.toolkits = new Toolkits(client);
|
|
5046
5195
|
telemetry.instrument(this);
|
|
5047
5196
|
}
|
|
5048
5197
|
/**
|
|
@@ -5070,47 +5219,100 @@ var MCP = class {
|
|
|
5070
5219
|
}
|
|
5071
5220
|
/**
|
|
5072
5221
|
* Create a new MCP server
|
|
5073
|
-
* @param {
|
|
5074
|
-
* @param {
|
|
5075
|
-
* @param {
|
|
5222
|
+
* @param {Object} params - Parameters for creating the MCP server
|
|
5223
|
+
* @param {Array} params.authConfig - Array of auth configurations with id and allowed tools
|
|
5224
|
+
* @param {Object} params.options - Server creation options
|
|
5225
|
+
* @param {string} params.options.name - Unique name for the MCP server
|
|
5226
|
+
* @param {boolean} [params.options.isChatAuth] - Whether to use chat-based authentication
|
|
5076
5227
|
* @returns {Promise<McpServerCreateResponse<T>>} Created server details with instance getter
|
|
5077
5228
|
*
|
|
5078
5229
|
* @example
|
|
5079
5230
|
* ```typescript
|
|
5080
|
-
* const server = await composio.mcp.create(
|
|
5081
|
-
* "personal-mcp-server",
|
|
5082
|
-
* [
|
|
5231
|
+
* const server = await composio.mcp.create("personal-mcp-server", [
|
|
5083
5232
|
* {
|
|
5084
|
-
*
|
|
5085
|
-
*
|
|
5086
|
-
*
|
|
5087
|
-
* },
|
|
5233
|
+
* authConfigId: "ac_xyz",
|
|
5234
|
+
* allowedTools: ["GMAIL_FETCH_EMAILS", "SLACK_SEND_MESSAGE"]
|
|
5235
|
+
* }
|
|
5088
5236
|
* ],
|
|
5089
|
-
* {
|
|
5090
|
-
*
|
|
5091
|
-
*
|
|
5092
|
-
* // Option 1: Use convenience method on response
|
|
5093
|
-
* const urls = await server.getServer({
|
|
5094
|
-
* connectedAccountIds: { gmail: "account_id" }
|
|
5237
|
+
* {
|
|
5238
|
+
* isChatAuth: true
|
|
5239
|
+
* }
|
|
5095
5240
|
* });
|
|
5096
5241
|
*
|
|
5097
|
-
* //
|
|
5098
|
-
* const
|
|
5099
|
-
*
|
|
5242
|
+
* // Use convenience method on response
|
|
5243
|
+
* const urls = await server.getServer({
|
|
5244
|
+
* userId: "user123"
|
|
5100
5245
|
* });
|
|
5101
5246
|
* ```
|
|
5102
5247
|
*/
|
|
5103
|
-
async create(name,
|
|
5104
|
-
|
|
5105
|
-
|
|
5248
|
+
async create(name, serverConfig, options) {
|
|
5249
|
+
if (!serverConfig || serverConfig.length === 0) {
|
|
5250
|
+
throw new ValidationError("At least one auth config is required", {});
|
|
5251
|
+
}
|
|
5252
|
+
if (!name) {
|
|
5253
|
+
throw new ValidationError("Server name is required", {});
|
|
5254
|
+
}
|
|
5255
|
+
try {
|
|
5256
|
+
const mcpServer = await this.getByName(name);
|
|
5257
|
+
const authConfigs = mcpServer.authConfigIds?.sort();
|
|
5258
|
+
const sortedCurrentAuthConfigs = serverConfig.map((config) => config.authConfigId).sort();
|
|
5259
|
+
if (authConfigs.length > 0 && !authConfigs.every((config, index) => config === sortedCurrentAuthConfigs[index])) {
|
|
5260
|
+
throw new ValidationError(
|
|
5261
|
+
"MCP server with this name already exists with different auth configs",
|
|
5262
|
+
{
|
|
5263
|
+
meta: { serverName: name }
|
|
5264
|
+
}
|
|
5265
|
+
);
|
|
5266
|
+
}
|
|
5267
|
+
const tools = mcpServer.tools?.sort();
|
|
5268
|
+
const sortedCurrentTools = serverConfig.flatMap((config) => config.allowedTools).sort();
|
|
5269
|
+
console.log(tools, sortedCurrentTools, "tools");
|
|
5270
|
+
if (tools?.length > 0 && !tools.every((tool, index) => tool === sortedCurrentTools[index])) {
|
|
5271
|
+
throw new ValidationError("MCP server with this name already exists with different tools", {
|
|
5272
|
+
meta: { serverName: name }
|
|
5273
|
+
});
|
|
5274
|
+
}
|
|
5275
|
+
const authConfigDetails2 = await Promise.all(
|
|
5276
|
+
serverConfig.map((config) => this.client.authConfigs.retrieve(config.authConfigId))
|
|
5277
|
+
);
|
|
5278
|
+
const toolkits2 = authConfigDetails2.map((config) => config.toolkit.slug);
|
|
5279
|
+
const camelCaseResponse2 = transformMcpCreateResponse({
|
|
5280
|
+
id: mcpServer.id,
|
|
5281
|
+
name: mcpServer.name,
|
|
5282
|
+
auth_config_ids: serverConfig.map((config) => config.authConfigId),
|
|
5283
|
+
allowed_tools: serverConfig.flatMap((config) => config.allowedTools),
|
|
5284
|
+
managed_auth_via_composio: options.isChatAuth || false,
|
|
5285
|
+
commands: mcpServer.commands,
|
|
5286
|
+
created_at: mcpServer.createdAt,
|
|
5287
|
+
updated_at: mcpServer.updatedAt,
|
|
5288
|
+
mcp_url: mcpServer.mcpUrl
|
|
5289
|
+
});
|
|
5290
|
+
return {
|
|
5291
|
+
...camelCaseResponse2,
|
|
5292
|
+
toolkits: toolkits2,
|
|
5293
|
+
getServer: async (params) => {
|
|
5294
|
+
return this.getServer(camelCaseResponse2.id, params.userId || "", {
|
|
5295
|
+
isChatAuth: options.isChatAuth
|
|
5296
|
+
});
|
|
5297
|
+
}
|
|
5298
|
+
};
|
|
5299
|
+
} catch (error) {
|
|
5300
|
+
if (error instanceof ValidationError && !error.message.includes("not found")) {
|
|
5301
|
+
throw error;
|
|
5302
|
+
}
|
|
5303
|
+
}
|
|
5304
|
+
const authConfigDetails = await Promise.all(
|
|
5305
|
+
serverConfig.map((config) => this.client.authConfigs.retrieve(config.authConfigId))
|
|
5306
|
+
);
|
|
5307
|
+
const toolkits = authConfigDetails.map((config) => config.toolkit.slug);
|
|
5106
5308
|
let mcpServerCreatedResponse;
|
|
5107
5309
|
try {
|
|
5108
5310
|
mcpServerCreatedResponse = await this.client.mcp.custom.create({
|
|
5109
5311
|
name,
|
|
5110
5312
|
toolkits,
|
|
5111
|
-
custom_tools:
|
|
5112
|
-
managed_auth_via_composio:
|
|
5113
|
-
auth_config_ids:
|
|
5313
|
+
custom_tools: serverConfig.flatMap((config) => config.allowedTools),
|
|
5314
|
+
managed_auth_via_composio: options.isChatAuth || false,
|
|
5315
|
+
auth_config_ids: serverConfig.map((config) => config.authConfigId)
|
|
5114
5316
|
});
|
|
5115
5317
|
} catch (error) {
|
|
5116
5318
|
throw new ValidationError("Failed to create MCP server", {
|
|
@@ -5128,53 +5330,200 @@ var MCP = class {
|
|
|
5128
5330
|
...camelCaseResponse,
|
|
5129
5331
|
toolkits,
|
|
5130
5332
|
getServer: async (params) => {
|
|
5131
|
-
return this.getServer(camelCaseResponse.id, params,
|
|
5333
|
+
return this.getServer(camelCaseResponse.id, params.userId || "", {
|
|
5334
|
+
isChatAuth: options.isChatAuth
|
|
5335
|
+
});
|
|
5132
5336
|
}
|
|
5133
5337
|
};
|
|
5134
5338
|
}
|
|
5135
5339
|
/**
|
|
5136
|
-
* Get
|
|
5137
|
-
*
|
|
5138
|
-
*
|
|
5139
|
-
*
|
|
5140
|
-
*
|
|
5340
|
+
* Get the connection status of a user for an MCP server
|
|
5341
|
+
*
|
|
5342
|
+
* Checks whether a user has the necessary connected accounts to use all toolkits
|
|
5343
|
+
* configured in the specified MCP server. Returns both overall connection status
|
|
5344
|
+
* and individual status for each toolkit.
|
|
5345
|
+
*
|
|
5346
|
+
* @param {Object} params - Parameters for checking connection status
|
|
5347
|
+
* @param {string} params.id - The UUID of the MCP server to check
|
|
5348
|
+
* @param {string} params.userId - The ID of the user to check connection status for
|
|
5349
|
+
* @returns {Promise<McpUserConnectionStatus>} Complete connection status including:
|
|
5350
|
+
* - `type`: Overall status (CONNECTED if all toolkits are connected, DISCONNECTED otherwise)
|
|
5351
|
+
* - `connected`: Boolean indicating if user can use the MCP server
|
|
5352
|
+
* - `connectedToolkits`: Record mapping each toolkit name to its individual connection status
|
|
5353
|
+
*
|
|
5354
|
+
* @throws {ValidationError} When MCP server has no toolkits configured
|
|
5355
|
+
* @throws {ValidationError} When MCP server retrieval fails
|
|
5356
|
+
*
|
|
5357
|
+
* @example
|
|
5358
|
+
* ```typescript
|
|
5359
|
+
* // Check if user can access an MCP server with Gmail and Slack toolkits
|
|
5360
|
+
* const connectionStatus = await composio.mcp.getUserConnectionStatus('user123', 'mcp-server-uuid');
|
|
5361
|
+
*
|
|
5362
|
+
* if (connectionStatus.connected) {
|
|
5363
|
+
* console.log('User can access all required toolkits');
|
|
5364
|
+
* // connectionStatus.type === ConnectionStatus.CONNECTED
|
|
5365
|
+
* } else {
|
|
5366
|
+
* console.log('User is missing some toolkit connections');
|
|
5367
|
+
* // Check individual toolkit statuses
|
|
5368
|
+
* Object.entries(connectionStatus.connectedToolkits).forEach(([toolkit, status]) => {
|
|
5369
|
+
* if (!status.connected) {
|
|
5370
|
+
* console.log(`Missing connection for toolkit: ${toolkit}`);
|
|
5371
|
+
* }
|
|
5372
|
+
* });
|
|
5373
|
+
* }
|
|
5374
|
+
* ```
|
|
5141
5375
|
*
|
|
5142
5376
|
* @example
|
|
5143
5377
|
* ```typescript
|
|
5144
|
-
* //
|
|
5145
|
-
*
|
|
5146
|
-
*
|
|
5147
|
-
*
|
|
5378
|
+
* // Example response when user has Gmail connected but missing Slack
|
|
5379
|
+
* {
|
|
5380
|
+
* type: ConnectionStatus.DISCONNECTED,
|
|
5381
|
+
* connected: false,
|
|
5382
|
+
* connectedToolkits: {
|
|
5383
|
+
* GMAIL: {
|
|
5384
|
+
* type: ConnectionStatus.CONNECTED,
|
|
5385
|
+
* connected: true,
|
|
5386
|
+
* toolkit: 'GMAIL',
|
|
5387
|
+
* connectedAccountId: 'conn_gmail_123'
|
|
5388
|
+
* },
|
|
5389
|
+
* SLACK: {
|
|
5390
|
+
* type: ConnectionStatus.DISCONNECTED,
|
|
5391
|
+
* connected: false,
|
|
5392
|
+
* toolkit: 'SLACK'
|
|
5393
|
+
* }
|
|
5148
5394
|
* }
|
|
5149
|
-
* }
|
|
5395
|
+
* }
|
|
5150
5396
|
* ```
|
|
5151
5397
|
*/
|
|
5152
|
-
async
|
|
5153
|
-
const serverDetails = await this.get(
|
|
5154
|
-
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
cause: paramsResult.error
|
|
5398
|
+
async getUserConnectionStatus(userId, serverId) {
|
|
5399
|
+
const serverDetails = await this.get(serverId);
|
|
5400
|
+
if (!serverDetails.toolkits || serverDetails.toolkits.length === 0) {
|
|
5401
|
+
throw new ValidationError("MCP server has no toolkits configured", {
|
|
5402
|
+
meta: { serverId }
|
|
5158
5403
|
});
|
|
5159
5404
|
}
|
|
5160
|
-
const
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5405
|
+
const connectedAccounts = await this.client.connectedAccounts.list({
|
|
5406
|
+
user_ids: [userId],
|
|
5407
|
+
toolkit_slugs: serverDetails.toolkits.map((toolkit) => toolkit.toLowerCase()),
|
|
5408
|
+
statuses: ["ACTIVE"]
|
|
5409
|
+
});
|
|
5410
|
+
const connectedAccountsByToolkit = /* @__PURE__ */ new Map();
|
|
5411
|
+
connectedAccounts.items?.forEach((account) => {
|
|
5412
|
+
connectedAccountsByToolkit.set(account.toolkit.slug.toLowerCase(), account.id);
|
|
5413
|
+
});
|
|
5414
|
+
const connectedToolkits = {};
|
|
5415
|
+
let allToolkitsConnected = true;
|
|
5416
|
+
for (const toolkit of serverDetails.toolkits) {
|
|
5417
|
+
const connectedAccountId = connectedAccountsByToolkit.get(toolkit.toLowerCase());
|
|
5418
|
+
if (connectedAccountId) {
|
|
5419
|
+
connectedToolkits[toolkit] = {
|
|
5420
|
+
type: "CONNECTED" /* CONNECTED */,
|
|
5421
|
+
connected: true,
|
|
5422
|
+
toolkit,
|
|
5423
|
+
connectedAccountId
|
|
5424
|
+
};
|
|
5425
|
+
} else {
|
|
5426
|
+
connectedToolkits[toolkit] = {
|
|
5427
|
+
type: "DISCONNECTED" /* DISCONNECTED */,
|
|
5428
|
+
connected: false,
|
|
5429
|
+
toolkit
|
|
5430
|
+
};
|
|
5431
|
+
allToolkitsConnected = false;
|
|
5169
5432
|
}
|
|
5170
5433
|
}
|
|
5434
|
+
if (allToolkitsConnected) {
|
|
5435
|
+
return {
|
|
5436
|
+
type: "CONNECTED" /* CONNECTED */,
|
|
5437
|
+
connected: true,
|
|
5438
|
+
connectedToolkits
|
|
5439
|
+
};
|
|
5440
|
+
} else {
|
|
5441
|
+
return {
|
|
5442
|
+
type: "DISCONNECTED" /* DISCONNECTED */,
|
|
5443
|
+
connected: false,
|
|
5444
|
+
connectedToolkits
|
|
5445
|
+
};
|
|
5446
|
+
}
|
|
5447
|
+
}
|
|
5448
|
+
/**
|
|
5449
|
+
* Get the connection parameters for a toolkit
|
|
5450
|
+
* @param {string} serverId - The UUID of the MCP server
|
|
5451
|
+
* @param {string} toolkit - The toolkit to get connection parameters for
|
|
5452
|
+
* @returns {Promise<ToolkitAuthFieldsResponse>} Connection parameters for the toolkit
|
|
5453
|
+
*/
|
|
5454
|
+
async getConnectionParams(serverId, toolkit) {
|
|
5455
|
+
const mcpServerDetails = await this.get(serverId);
|
|
5456
|
+
const authConfigs = mcpServerDetails.authConfigIds ? await Promise.all(
|
|
5457
|
+
mcpServerDetails.authConfigIds.map((id) => this.client.authConfigs.retrieve(id))
|
|
5458
|
+
) : [];
|
|
5459
|
+
const authConfig = authConfigs.find((config) => config.toolkit.slug === toolkit);
|
|
5460
|
+
if (!authConfig) {
|
|
5461
|
+
throw new ValidationError("Auth config not found", {
|
|
5462
|
+
meta: { serverId, toolkit }
|
|
5463
|
+
});
|
|
5464
|
+
}
|
|
5465
|
+
const connectionParams = await this.toolkits.getConnectedAccountInitiationFields(
|
|
5466
|
+
toolkit,
|
|
5467
|
+
authConfig.auth_scheme
|
|
5468
|
+
);
|
|
5469
|
+
return connectionParams;
|
|
5470
|
+
}
|
|
5471
|
+
/**
|
|
5472
|
+
* Authorize a user for a toolkit
|
|
5473
|
+
* @param {string} serverId - The UUID of the MCP server
|
|
5474
|
+
* @param {string} userId - The ID of the user to authorize
|
|
5475
|
+
* @param {string} toolkit - The toolkit to authorize
|
|
5476
|
+
* @returns {Promise<ConnectionRequest>} Connection request for the toolkit
|
|
5477
|
+
*/
|
|
5478
|
+
async authorize(userId, serverId, toolkit) {
|
|
5479
|
+
const mcpServerDetails = await this.get(serverId);
|
|
5480
|
+
const authConfigId = mcpServerDetails.authConfigIds?.[0];
|
|
5481
|
+
return this.toolkits.authorize(userId, toolkit, authConfigId);
|
|
5482
|
+
}
|
|
5483
|
+
/**
|
|
5484
|
+
* Get server URLs for an existing MCP server
|
|
5485
|
+
* @param {string} serverId - Server UUID
|
|
5486
|
+
* @param {string} userId - User ID to get server URLs for
|
|
5487
|
+
* @param {Object} [options] - Additional options for server configuration
|
|
5488
|
+
* @param {string[]} [options.limitTools] - Subset of tools to limit (from MCP config)
|
|
5489
|
+
* @param {boolean} [options.isChatAuth] - Whether to use chat-based authentication
|
|
5490
|
+
* @returns {Promise<T>} Transformed server URLs in provider-specific format
|
|
5491
|
+
*
|
|
5492
|
+
* @example
|
|
5493
|
+
* ```typescript
|
|
5494
|
+
* // Get URLs for an existing server with basic user ID
|
|
5495
|
+
* const urls = await composio.mcp.getServer("mcp_xyz", "hey@example.com");
|
|
5496
|
+
*
|
|
5497
|
+
* // Get URLs with additional options
|
|
5498
|
+
* const urls = await composio.mcp.getServer("mcp_xyz", "hey@example.com", {
|
|
5499
|
+
* limitTools: ["GMAIL_FETCH_EMAILS", "SLACK_SEND_MESSAGE"],
|
|
5500
|
+
* isChatAuth: true
|
|
5501
|
+
* });
|
|
5502
|
+
* ```
|
|
5503
|
+
*/
|
|
5504
|
+
async getServer(serverId, userId, options) {
|
|
5505
|
+
const serverDetails = await this.get(serverId);
|
|
5506
|
+
if (!userId) {
|
|
5507
|
+
throw new ValidationError("User ID is required", {});
|
|
5508
|
+
}
|
|
5509
|
+
const toolkits = serverDetails.toolkits || [];
|
|
5510
|
+
const connectedAccountIds = (await Promise.all(
|
|
5511
|
+
toolkits.map(
|
|
5512
|
+
(toolkit) => this.client.connectedAccounts.list({
|
|
5513
|
+
user_ids: [userId],
|
|
5514
|
+
toolkit_slugs: [toolkit],
|
|
5515
|
+
statuses: ["ACTIVE"]
|
|
5516
|
+
}).then((res) => res.items?.[0]?.id)
|
|
5517
|
+
)
|
|
5518
|
+
)).filter(Boolean);
|
|
5171
5519
|
let data;
|
|
5172
5520
|
try {
|
|
5173
5521
|
data = await this.client.mcp.generate.url({
|
|
5174
|
-
user_ids:
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5522
|
+
user_ids: [userId],
|
|
5523
|
+
// @TODO(utkarsh-dixit): Add support for this later
|
|
5524
|
+
connected_account_ids: [],
|
|
5525
|
+
mcp_server_id: serverId,
|
|
5526
|
+
managed_auth_by_composio: options?.isChatAuth ?? serverDetails.managedAuthViaComposio ?? false
|
|
5178
5527
|
});
|
|
5179
5528
|
} catch (error) {
|
|
5180
5529
|
throw new ValidationError("Failed to generate MCP server URL", {
|
|
@@ -5191,9 +5540,9 @@ var MCP = class {
|
|
|
5191
5540
|
return this.wrapMcpServerResponse(
|
|
5192
5541
|
camelCaseData,
|
|
5193
5542
|
serverDetails.name,
|
|
5194
|
-
|
|
5195
|
-
|
|
5196
|
-
|
|
5543
|
+
connectedAccountIds,
|
|
5544
|
+
[userId],
|
|
5545
|
+
toolkits
|
|
5197
5546
|
);
|
|
5198
5547
|
}
|
|
5199
5548
|
/**
|
|
@@ -5228,8 +5577,8 @@ var MCP = class {
|
|
|
5228
5577
|
listResponse = await this.client.mcp.list({
|
|
5229
5578
|
page_no: options.page || 1,
|
|
5230
5579
|
limit: options.limit || 10,
|
|
5231
|
-
toolkits: options?.toolkits?.join(",") ||
|
|
5232
|
-
auth_config_ids: options?.authConfigs?.join(",") ||
|
|
5580
|
+
toolkits: options?.toolkits?.join(",") || void 0,
|
|
5581
|
+
auth_config_ids: options?.authConfigs?.join(",") || void 0,
|
|
5233
5582
|
name: options?.name
|
|
5234
5583
|
});
|
|
5235
5584
|
} catch (error) {
|
|
@@ -5247,7 +5596,7 @@ var MCP = class {
|
|
|
5247
5596
|
}
|
|
5248
5597
|
/**
|
|
5249
5598
|
* Get details of a specific MCP server
|
|
5250
|
-
* @param {string}
|
|
5599
|
+
* @param {string} serverId - Server UUID
|
|
5251
5600
|
* @returns {Promise<McpRetrieveResponse>} Server details
|
|
5252
5601
|
*
|
|
5253
5602
|
* @example
|
|
@@ -5255,16 +5604,19 @@ var MCP = class {
|
|
|
5255
5604
|
* const serverDetails = await composio.mcp.get('server-uuid');
|
|
5256
5605
|
* ```
|
|
5257
5606
|
*/
|
|
5258
|
-
async get(
|
|
5607
|
+
async get(serverId) {
|
|
5259
5608
|
let retrieveResponse;
|
|
5260
5609
|
try {
|
|
5261
|
-
retrieveResponse = await this.client.mcp.retrieve(
|
|
5610
|
+
retrieveResponse = await this.client.mcp.retrieve(serverId);
|
|
5262
5611
|
} catch (error) {
|
|
5263
5612
|
throw new ValidationError("Failed to retrieve MCP server", {
|
|
5264
5613
|
cause: error
|
|
5265
5614
|
});
|
|
5266
5615
|
}
|
|
5267
|
-
const retrieveResponseResult = McpRetrieveResponseSchema.safeParse(
|
|
5616
|
+
const retrieveResponseResult = McpRetrieveResponseSchema.safeParse({
|
|
5617
|
+
...retrieveResponse,
|
|
5618
|
+
mcpUrl: retrieveResponse.mcp_url
|
|
5619
|
+
});
|
|
5268
5620
|
if (retrieveResponseResult.error) {
|
|
5269
5621
|
throw new ValidationError("Failed to parse MCP server retrieve response", {
|
|
5270
5622
|
cause: retrieveResponseResult.error
|
|
@@ -5274,7 +5626,7 @@ var MCP = class {
|
|
|
5274
5626
|
}
|
|
5275
5627
|
/**
|
|
5276
5628
|
* Delete an MCP server
|
|
5277
|
-
* @param {string}
|
|
5629
|
+
* @param {string} serverId - Server UUID
|
|
5278
5630
|
* @returns {Promise<McpDeleteResponse>} Deletion response
|
|
5279
5631
|
*
|
|
5280
5632
|
* @example
|
|
@@ -5282,10 +5634,10 @@ var MCP = class {
|
|
|
5282
5634
|
* const result = await composio.mcp.delete('server-uuid');
|
|
5283
5635
|
* ```
|
|
5284
5636
|
*/
|
|
5285
|
-
async delete(
|
|
5637
|
+
async delete(serverId) {
|
|
5286
5638
|
let deleteResponse;
|
|
5287
5639
|
try {
|
|
5288
|
-
deleteResponse = await this.client.mcp.delete(
|
|
5640
|
+
deleteResponse = await this.client.mcp.delete(serverId);
|
|
5289
5641
|
} catch (error) {
|
|
5290
5642
|
throw new ValidationError("Failed to delete MCP server", {
|
|
5291
5643
|
cause: error
|
|
@@ -5320,21 +5672,21 @@ var MCP = class {
|
|
|
5320
5672
|
* },
|
|
5321
5673
|
* ],
|
|
5322
5674
|
* {
|
|
5323
|
-
*
|
|
5675
|
+
* isChatAuth: true,
|
|
5324
5676
|
* }
|
|
5325
5677
|
* );
|
|
5326
5678
|
* ```
|
|
5327
5679
|
*/
|
|
5328
|
-
async update(
|
|
5680
|
+
async update(serverId, name, toolkitConfigs, authOptions) {
|
|
5329
5681
|
this.validateInputs(toolkitConfigs, authOptions);
|
|
5330
5682
|
const toolkits = toolkitConfigs.map((config) => config.toolkit);
|
|
5331
5683
|
let updateResponse;
|
|
5332
5684
|
try {
|
|
5333
|
-
updateResponse = await this.client.mcp.update(
|
|
5685
|
+
updateResponse = await this.client.mcp.update(serverId, {
|
|
5334
5686
|
name,
|
|
5335
5687
|
toolkits,
|
|
5336
5688
|
allowed_tools: toolkitConfigs.flatMap((config) => config.allowedTools),
|
|
5337
|
-
managed_auth_via_composio: authOptions?.
|
|
5689
|
+
managed_auth_via_composio: authOptions?.isChatAuth || false
|
|
5338
5690
|
});
|
|
5339
5691
|
} catch (error) {
|
|
5340
5692
|
throw new ValidationError("Failed to update MCP server", {
|
|
@@ -5351,20 +5703,20 @@ var MCP = class {
|
|
|
5351
5703
|
}
|
|
5352
5704
|
/**
|
|
5353
5705
|
* Generate URL for an MCP server
|
|
5706
|
+
* @param {string} serverId - Server UUID
|
|
5354
5707
|
* @param {GenerateURLParams} params - Parameters for URL generation
|
|
5355
5708
|
* @returns {Promise<GenerateURLResponse>} Generated URL response
|
|
5356
5709
|
*
|
|
5357
5710
|
* @example
|
|
5358
5711
|
* ```typescript
|
|
5359
|
-
* const urlResponse = await composio.mcp.generateUrl({
|
|
5712
|
+
* const urlResponse = await composio.mcp.generateUrl('server-uuid', {
|
|
5360
5713
|
* userIds: ['user123'],
|
|
5361
5714
|
* connectedAccountIds: ['account456'],
|
|
5362
|
-
*
|
|
5363
|
-
* composioManagedAuth: true
|
|
5715
|
+
* isChatAuth: true
|
|
5364
5716
|
* });
|
|
5365
5717
|
* ```
|
|
5366
5718
|
*/
|
|
5367
|
-
async generateUrl(params) {
|
|
5719
|
+
async generateUrl(serverId, params) {
|
|
5368
5720
|
const paramsResult = GenerateURLParamsSchema.safeParse(params);
|
|
5369
5721
|
if (paramsResult.error) {
|
|
5370
5722
|
throw new ValidationError("Failed to parse generateUrl parameters", {
|
|
@@ -5374,7 +5726,7 @@ var MCP = class {
|
|
|
5374
5726
|
let urlResponse;
|
|
5375
5727
|
try {
|
|
5376
5728
|
urlResponse = await this.client.mcp.generate.url({
|
|
5377
|
-
mcp_server_id:
|
|
5729
|
+
mcp_server_id: serverId,
|
|
5378
5730
|
user_ids: params.userIds,
|
|
5379
5731
|
connected_account_ids: params.connectedAccountIds,
|
|
5380
5732
|
managed_auth_by_composio: params.composioManagedAuth
|
|
@@ -5444,6 +5796,48 @@ var MCP = class {
|
|
|
5444
5796
|
name: serverName
|
|
5445
5797
|
};
|
|
5446
5798
|
}
|
|
5799
|
+
/**
|
|
5800
|
+
* Get details of a specific MCP server by name
|
|
5801
|
+
* @param {string} name - Server name
|
|
5802
|
+
* @returns {Promise<McpRetrieveResponse>} Server details
|
|
5803
|
+
* @throws {ValidationError} If no server found with the given name
|
|
5804
|
+
* @throws {ValidationError} If multiple servers found with the same name
|
|
5805
|
+
*
|
|
5806
|
+
* @example
|
|
5807
|
+
* ```typescript
|
|
5808
|
+
* const serverDetails = await composio.mcp.getByName('my-gmail-server');
|
|
5809
|
+
* ```
|
|
5810
|
+
*/
|
|
5811
|
+
async getByName(serverName) {
|
|
5812
|
+
if (!serverName) {
|
|
5813
|
+
throw new ValidationError("Server name is required", {});
|
|
5814
|
+
}
|
|
5815
|
+
let listResponse;
|
|
5816
|
+
try {
|
|
5817
|
+
listResponse = await this.client.mcp.list({
|
|
5818
|
+
name: serverName,
|
|
5819
|
+
limit: 10
|
|
5820
|
+
});
|
|
5821
|
+
} catch (error) {
|
|
5822
|
+
console.error(error);
|
|
5823
|
+
throw new ValidationError("Failed to search MCP servers by name", {
|
|
5824
|
+
cause: error
|
|
5825
|
+
});
|
|
5826
|
+
}
|
|
5827
|
+
const listResponseResult = ComposioMcpListResponseSchema.safeParse(listResponse);
|
|
5828
|
+
if (listResponseResult.error) {
|
|
5829
|
+
throw new ValidationError("Failed to parse MCP server list response", {
|
|
5830
|
+
cause: listResponseResult.error
|
|
5831
|
+
});
|
|
5832
|
+
}
|
|
5833
|
+
const servers = listResponse.items || [];
|
|
5834
|
+
if (servers.length === 0) {
|
|
5835
|
+
throw new ValidationError(`MCP server with name '${serverName}' not found`, {
|
|
5836
|
+
meta: { serverName }
|
|
5837
|
+
});
|
|
5838
|
+
}
|
|
5839
|
+
return this.get(servers[0].id);
|
|
5840
|
+
}
|
|
5447
5841
|
};
|
|
5448
5842
|
|
|
5449
5843
|
// src/utils/sdk.ts
|
|
@@ -5702,6 +6096,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
5702
6096
|
arguments: JSON.parse(tool.function.arguments),
|
|
5703
6097
|
connectedAccountId: options?.connectedAccountId,
|
|
5704
6098
|
customAuthParams: options?.customAuthParams,
|
|
6099
|
+
customConnectionData: options?.customConnectionData,
|
|
5705
6100
|
userId
|
|
5706
6101
|
};
|
|
5707
6102
|
const result = await this.executeTool(tool.function.name, payload, modifiers);
|
|
@@ -5983,7 +6378,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
5983
6378
|
};
|
|
5984
6379
|
|
|
5985
6380
|
// package.json
|
|
5986
|
-
var version = "0.1.
|
|
6381
|
+
var version = "0.1.37";
|
|
5987
6382
|
|
|
5988
6383
|
// src/models/Files.ts
|
|
5989
6384
|
var Files = class {
|
|
@@ -6425,6 +6820,7 @@ export {
|
|
|
6425
6820
|
ConnectionRequestErrorCodes,
|
|
6426
6821
|
ConnectionRequestFailedError,
|
|
6427
6822
|
ConnectionRequestTimeoutError,
|
|
6823
|
+
ConnectionStatus,
|
|
6428
6824
|
ConnectionStatuses,
|
|
6429
6825
|
CreateAuthConfigParamsSchema,
|
|
6430
6826
|
CreateAuthConfigResponseSchema,
|
|
@@ -6434,7 +6830,10 @@ export {
|
|
|
6434
6830
|
CreateConnectedAccountResponseSchema,
|
|
6435
6831
|
CreateCustomAuthConfigParamsSchema,
|
|
6436
6832
|
CustomAuthParamsSchema,
|
|
6833
|
+
CustomConnectionDataSchema,
|
|
6437
6834
|
CustomCreateResponseSchema,
|
|
6835
|
+
CustomOauth1ConnectionDataSchema,
|
|
6836
|
+
CustomOauth2ConnectionDataSchema,
|
|
6438
6837
|
DefaultCreateConnectedAccountParamsSchema,
|
|
6439
6838
|
GenerateURLParamsSchema,
|
|
6440
6839
|
GenerateURLResponseSchema,
|
|
@@ -6461,12 +6860,14 @@ export {
|
|
|
6461
6860
|
Oauth1ConnectionDataSchema,
|
|
6462
6861
|
Oauth1ExpiredConnectionDataSchema,
|
|
6463
6862
|
Oauth1FailedConnectionDataSchema,
|
|
6863
|
+
Oauth1InactiveConnectionDataSchema,
|
|
6464
6864
|
Oauth1InitiatedConnectionDataSchema,
|
|
6465
6865
|
Oauth1InitiatingConnectionDataSchema,
|
|
6466
6866
|
Oauth2ActiveConnectionDataSchema,
|
|
6467
6867
|
Oauth2ConnectionDataSchema,
|
|
6468
6868
|
Oauth2ExpiredConnectionDataSchema,
|
|
6469
6869
|
Oauth2FailedConnectionDataSchema,
|
|
6870
|
+
Oauth2InactiveConnectionDataSchema,
|
|
6470
6871
|
Oauth2InitiatedConnectionDataSchema,
|
|
6471
6872
|
Oauth2InitiatingConnectionDataSchema,
|
|
6472
6873
|
OpenAIProvider,
|