@composio/core 0.1.12 → 0.1.14
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 +705 -379
- package/dist/index.d.cts +28150 -97
- package/dist/index.d.ts +28150 -97
- package/dist/index.js +768 -443
- package/package.json +5 -3
package/dist/index.cjs
CHANGED
|
@@ -56,6 +56,7 @@ __export(index_exports, {
|
|
|
56
56
|
ConnectionRequestFailedError: () => ConnectionRequestFailedError,
|
|
57
57
|
ConnectionRequestTimeoutError: () => ConnectionRequestTimeoutError,
|
|
58
58
|
ConsoleTelemetryTransport: () => ConsoleTelemetryTransport,
|
|
59
|
+
JsonSchemaToZodError: () => JsonSchemaToZodError,
|
|
59
60
|
OpenAIProvider: () => OpenAIProvider,
|
|
60
61
|
SDKErrorCodes: () => SDKErrorCodes,
|
|
61
62
|
ToolErrorCodes: () => ToolErrorCodes,
|
|
@@ -102,7 +103,7 @@ var ParametersSchema = import_zod.z.object({
|
|
|
102
103
|
required: import_zod.z.array(import_zod.z.string()).optional(),
|
|
103
104
|
title: import_zod.z.string().optional(),
|
|
104
105
|
description: import_zod.z.string().optional(),
|
|
105
|
-
additionalProperties: import_zod.z.boolean().optional()
|
|
106
|
+
additionalProperties: import_zod.z.boolean().default(false).optional()
|
|
106
107
|
});
|
|
107
108
|
var ToolSchema = import_zod.z.object({
|
|
108
109
|
slug: import_zod.z.string().describe('The slug of the tool. eg. "GOOGLE_SEARCH"'),
|
|
@@ -177,7 +178,7 @@ var ToolProxyParamsSchema = import_zod.z.object({
|
|
|
177
178
|
name: import_zod.z.string(),
|
|
178
179
|
value: import_zod.z.union([import_zod.z.string(), import_zod.z.number()])
|
|
179
180
|
})
|
|
180
|
-
),
|
|
181
|
+
).optional(),
|
|
181
182
|
connectedAccountId: import_zod.z.string().optional()
|
|
182
183
|
});
|
|
183
184
|
|
|
@@ -936,7 +937,411 @@ var TelemetryService = class {
|
|
|
936
937
|
var telemetry = new TelemetryService();
|
|
937
938
|
|
|
938
939
|
// src/types/connectedAccounts.types.ts
|
|
940
|
+
var import_zod4 = require("zod");
|
|
941
|
+
|
|
942
|
+
// src/types/connectedAccountAuthStates.types.ts
|
|
939
943
|
var import_zod3 = require("zod");
|
|
944
|
+
var AUTH_MODES_ENUM = {
|
|
945
|
+
OAUTH2: "OAUTH2",
|
|
946
|
+
OAUTH1: "OAUTH1",
|
|
947
|
+
API_KEY: "API_KEY",
|
|
948
|
+
BASIC: "BASIC",
|
|
949
|
+
BILLCOM_AUTH: "BILLCOM_AUTH",
|
|
950
|
+
BEARER_TOKEN: "BEARER_TOKEN",
|
|
951
|
+
GOOGLE_SERVICE_ACCOUNT: "GOOGLE_SERVICE_ACCOUNT",
|
|
952
|
+
NO_AUTH: "NO_AUTH",
|
|
953
|
+
BASIC_WITH_JWT: "BASIC_WITH_JWT",
|
|
954
|
+
COMPOSIO_LINK_AUTH: "COMPOSIO_LINK",
|
|
955
|
+
CALCOM_AUTH: "CALCOM_AUTH",
|
|
956
|
+
SNOWFLAKE: "SNOWFLAKE"
|
|
957
|
+
};
|
|
958
|
+
var RedirectableAuthSchemeSchema = import_zod3.z.enum([
|
|
959
|
+
AUTH_MODES_ENUM.OAUTH1,
|
|
960
|
+
AUTH_MODES_ENUM.OAUTH2,
|
|
961
|
+
AUTH_MODES_ENUM.COMPOSIO_LINK_AUTH
|
|
962
|
+
]);
|
|
963
|
+
var BaseSchemeRaw = import_zod3.z.object({
|
|
964
|
+
// for posthog, freshdesk, zendesk, clickup and others
|
|
965
|
+
subdomain: import_zod3.z.string().optional(),
|
|
966
|
+
// for atlassian
|
|
967
|
+
["your-domain"]: import_zod3.z.string().optional(),
|
|
968
|
+
// for mixpanel
|
|
969
|
+
region: import_zod3.z.string().optional(),
|
|
970
|
+
// for shopify
|
|
971
|
+
shop: import_zod3.z.string().optional(),
|
|
972
|
+
// for snowflake
|
|
973
|
+
account_url: import_zod3.z.string().optional(),
|
|
974
|
+
// likely pipedrive
|
|
975
|
+
COMPANYDOMAIN: import_zod3.z.string().optional(),
|
|
976
|
+
// likely zoho
|
|
977
|
+
extension: import_zod3.z.string().optional(),
|
|
978
|
+
// likely formsite
|
|
979
|
+
form_api_base_url: import_zod3.z.string().optional(),
|
|
980
|
+
// likely salesforce
|
|
981
|
+
instanceEndpoint: import_zod3.z.string().optional(),
|
|
982
|
+
// likely active campaign
|
|
983
|
+
api_url: import_zod3.z.string().optional(),
|
|
984
|
+
// for borneo
|
|
985
|
+
borneo_dashboard_url: import_zod3.z.string().optional(),
|
|
986
|
+
// for zenrows proxy
|
|
987
|
+
proxy_username: import_zod3.z.string().optional(),
|
|
988
|
+
proxy_password: import_zod3.z.string().optional(),
|
|
989
|
+
// for d2l
|
|
990
|
+
domain: import_zod3.z.string().optional(),
|
|
991
|
+
version: import_zod3.z.string().optional(),
|
|
992
|
+
// for mailchimp
|
|
993
|
+
dc: import_zod3.z.string().optional(),
|
|
994
|
+
// for sharepoint
|
|
995
|
+
site_name: import_zod3.z.string().optional(),
|
|
996
|
+
// for servicenow
|
|
997
|
+
instanceName: import_zod3.z.string().optional(),
|
|
998
|
+
// for netsuite
|
|
999
|
+
account_id: import_zod3.z.string().optional(),
|
|
1000
|
+
// for custom servers
|
|
1001
|
+
your_server: import_zod3.z.string().optional(),
|
|
1002
|
+
// for ragic
|
|
1003
|
+
server_location: import_zod3.z.string().optional(),
|
|
1004
|
+
// base_url only
|
|
1005
|
+
base_url: import_zod3.z.string().optional()
|
|
1006
|
+
});
|
|
1007
|
+
var Oauth2InitiatingConnectionDataSchema = BaseSchemeRaw.extend({
|
|
1008
|
+
status: import_zod3.z.literal("INITIALIZING" /* INITIALIZING */)
|
|
1009
|
+
}).catchall(import_zod3.z.unknown());
|
|
1010
|
+
var Oauth2InitiatedConnectionDataSchema = Oauth2InitiatingConnectionDataSchema.extend({
|
|
1011
|
+
status: import_zod3.z.literal("INITIATED" /* INITIATED */),
|
|
1012
|
+
code_verifier: import_zod3.z.string().optional(),
|
|
1013
|
+
redirectUrl: import_zod3.z.string(),
|
|
1014
|
+
callback_url: import_zod3.z.string().optional(),
|
|
1015
|
+
finalRedirectUri: import_zod3.z.string().optional(),
|
|
1016
|
+
// previously verification_token, will be sent as verification_token to slack
|
|
1017
|
+
webhook_signature: import_zod3.z.string().optional()
|
|
1018
|
+
}).catchall(import_zod3.z.unknown());
|
|
1019
|
+
var Oauth2ActiveConnectionDataSchema = Oauth2InitiatingConnectionDataSchema.extend({
|
|
1020
|
+
status: import_zod3.z.literal("ACTIVE" /* ACTIVE */),
|
|
1021
|
+
access_token: import_zod3.z.string(),
|
|
1022
|
+
id_token: import_zod3.z.string().optional(),
|
|
1023
|
+
token_type: import_zod3.z.string(),
|
|
1024
|
+
refresh_token: import_zod3.z.string().optional(),
|
|
1025
|
+
expires_in: import_zod3.z.number().optional(),
|
|
1026
|
+
scope: import_zod3.z.string().optional(),
|
|
1027
|
+
// previously verification_token, will be sent as verification_token to slack
|
|
1028
|
+
webhook_signature: import_zod3.z.string().optional(),
|
|
1029
|
+
authed_user: import_zod3.z.object({
|
|
1030
|
+
access_token: import_zod3.z.string().optional(),
|
|
1031
|
+
scope: import_zod3.z.string().optional()
|
|
1032
|
+
}).optional().describe("for slack user scopes")
|
|
1033
|
+
}).catchall(import_zod3.z.unknown());
|
|
1034
|
+
var Oauth2FailedConnectionDataSchema = Oauth2InitiatingConnectionDataSchema.extend({
|
|
1035
|
+
status: import_zod3.z.literal("FAILED" /* FAILED */),
|
|
1036
|
+
error: import_zod3.z.string().optional(),
|
|
1037
|
+
error_description: import_zod3.z.string().optional()
|
|
1038
|
+
}).catchall(import_zod3.z.unknown());
|
|
1039
|
+
var Oauth2ExpiredConnectionDataSchema = Oauth2InitiatingConnectionDataSchema.extend({
|
|
1040
|
+
status: import_zod3.z.literal("EXPIRED" /* EXPIRED */),
|
|
1041
|
+
expired_at: import_zod3.z.string().optional()
|
|
1042
|
+
}).catchall(import_zod3.z.unknown());
|
|
1043
|
+
var Oauth2ConnectionDataSchema = import_zod3.z.discriminatedUnion("status", [
|
|
1044
|
+
Oauth2InitiatingConnectionDataSchema,
|
|
1045
|
+
Oauth2InitiatedConnectionDataSchema,
|
|
1046
|
+
Oauth2ActiveConnectionDataSchema,
|
|
1047
|
+
Oauth2FailedConnectionDataSchema,
|
|
1048
|
+
Oauth2ExpiredConnectionDataSchema
|
|
1049
|
+
]);
|
|
1050
|
+
var Oauth1InitiatingConnectionDataSchema = BaseSchemeRaw.extend({
|
|
1051
|
+
status: import_zod3.z.literal("INITIALIZING" /* INITIALIZING */)
|
|
1052
|
+
}).catchall(import_zod3.z.unknown());
|
|
1053
|
+
var Oauth1InitiatedConnectionDataSchema = Oauth1InitiatingConnectionDataSchema.extend({
|
|
1054
|
+
status: import_zod3.z.literal("INITIATED" /* INITIATED */),
|
|
1055
|
+
oauth_token: import_zod3.z.string(),
|
|
1056
|
+
authUri: import_zod3.z.string(),
|
|
1057
|
+
oauth_token_secret: import_zod3.z.string(),
|
|
1058
|
+
redirectUrl: import_zod3.z.string(),
|
|
1059
|
+
callbackUrl: import_zod3.z.string().optional()
|
|
1060
|
+
}).catchall(import_zod3.z.unknown());
|
|
1061
|
+
var Oauth1ActiveConnectionDataSchema = Oauth1InitiatingConnectionDataSchema.extend({
|
|
1062
|
+
status: import_zod3.z.literal("ACTIVE" /* ACTIVE */),
|
|
1063
|
+
oauth_token: import_zod3.z.string(),
|
|
1064
|
+
consumer_key: import_zod3.z.string().optional(),
|
|
1065
|
+
redirectUrl: import_zod3.z.string().optional(),
|
|
1066
|
+
callback_url: import_zod3.z.string().optional()
|
|
1067
|
+
}).catchall(import_zod3.z.unknown());
|
|
1068
|
+
var Oauth1FailedConnectionDataSchema = Oauth1InitiatingConnectionDataSchema.extend({
|
|
1069
|
+
status: import_zod3.z.literal("FAILED" /* FAILED */),
|
|
1070
|
+
error: import_zod3.z.string().optional(),
|
|
1071
|
+
error_description: import_zod3.z.string().optional()
|
|
1072
|
+
}).catchall(import_zod3.z.unknown());
|
|
1073
|
+
var Oauth1ExpiredConnectionDataSchema = Oauth1InitiatingConnectionDataSchema.extend({
|
|
1074
|
+
status: import_zod3.z.literal("EXPIRED" /* EXPIRED */),
|
|
1075
|
+
expired_at: import_zod3.z.string().optional()
|
|
1076
|
+
}).catchall(import_zod3.z.unknown());
|
|
1077
|
+
var Oauth1ConnectionDataSchema = import_zod3.z.discriminatedUnion("status", [
|
|
1078
|
+
Oauth1InitiatingConnectionDataSchema,
|
|
1079
|
+
Oauth1InitiatedConnectionDataSchema,
|
|
1080
|
+
Oauth1ActiveConnectionDataSchema,
|
|
1081
|
+
Oauth1FailedConnectionDataSchema,
|
|
1082
|
+
Oauth1ExpiredConnectionDataSchema
|
|
1083
|
+
]);
|
|
1084
|
+
var ComposioLinkInitiatingSchema = BaseSchemeRaw.extend({
|
|
1085
|
+
status: import_zod3.z.literal("INITIALIZING" /* INITIALIZING */)
|
|
1086
|
+
}).catchall(import_zod3.z.unknown());
|
|
1087
|
+
var ComposioLinkConnectionDataSchema = import_zod3.z.discriminatedUnion("status", [
|
|
1088
|
+
ComposioLinkInitiatingSchema,
|
|
1089
|
+
ComposioLinkInitiatingSchema.extend({
|
|
1090
|
+
status: import_zod3.z.literal("INITIATED" /* INITIATED */),
|
|
1091
|
+
redirectUrl: import_zod3.z.string()
|
|
1092
|
+
}).catchall(import_zod3.z.unknown()),
|
|
1093
|
+
ComposioLinkInitiatingSchema.extend({
|
|
1094
|
+
status: import_zod3.z.literal("ACTIVE" /* ACTIVE */)
|
|
1095
|
+
}).catchall(import_zod3.z.unknown()),
|
|
1096
|
+
ComposioLinkInitiatingSchema.extend({
|
|
1097
|
+
status: import_zod3.z.literal("FAILED" /* FAILED */),
|
|
1098
|
+
error: import_zod3.z.string().optional(),
|
|
1099
|
+
error_description: import_zod3.z.string().optional()
|
|
1100
|
+
}).catchall(import_zod3.z.unknown()),
|
|
1101
|
+
ComposioLinkInitiatingSchema.extend({
|
|
1102
|
+
status: import_zod3.z.literal("EXPIRED" /* EXPIRED */),
|
|
1103
|
+
expired_at: import_zod3.z.string().optional()
|
|
1104
|
+
}).catchall(import_zod3.z.unknown())
|
|
1105
|
+
]);
|
|
1106
|
+
var BillcomAuthInitiatingSchema = BaseSchemeRaw.extend({
|
|
1107
|
+
status: import_zod3.z.literal("INITIALIZING" /* INITIALIZING */)
|
|
1108
|
+
}).catchall(import_zod3.z.unknown());
|
|
1109
|
+
var BillcomAuthConnectionDataSchema = import_zod3.z.discriminatedUnion("status", [
|
|
1110
|
+
BillcomAuthInitiatingSchema,
|
|
1111
|
+
BillcomAuthInitiatingSchema.extend({
|
|
1112
|
+
status: import_zod3.z.literal("INITIATED" /* INITIATED */),
|
|
1113
|
+
redirectUrl: import_zod3.z.string()
|
|
1114
|
+
}).catchall(import_zod3.z.unknown()),
|
|
1115
|
+
BillcomAuthInitiatingSchema.extend({
|
|
1116
|
+
status: import_zod3.z.literal("ACTIVE" /* ACTIVE */),
|
|
1117
|
+
sessionId: import_zod3.z.string(),
|
|
1118
|
+
devKey: import_zod3.z.string()
|
|
1119
|
+
}).catchall(import_zod3.z.unknown()),
|
|
1120
|
+
BillcomAuthInitiatingSchema.extend({
|
|
1121
|
+
status: import_zod3.z.literal("FAILED" /* FAILED */),
|
|
1122
|
+
error: import_zod3.z.string().optional(),
|
|
1123
|
+
error_description: import_zod3.z.string().optional()
|
|
1124
|
+
}).catchall(import_zod3.z.unknown()),
|
|
1125
|
+
BillcomAuthInitiatingSchema.extend({
|
|
1126
|
+
status: import_zod3.z.literal("EXPIRED" /* EXPIRED */),
|
|
1127
|
+
expired_at: import_zod3.z.string().optional()
|
|
1128
|
+
}).catchall(import_zod3.z.unknown())
|
|
1129
|
+
]);
|
|
1130
|
+
var BasicWithJwtInitiatingSchema = BaseSchemeRaw.extend({
|
|
1131
|
+
status: import_zod3.z.literal("ACTIVE" /* ACTIVE */),
|
|
1132
|
+
username: import_zod3.z.string(),
|
|
1133
|
+
password: import_zod3.z.string()
|
|
1134
|
+
}).catchall(import_zod3.z.unknown());
|
|
1135
|
+
var BasicWithJwtConnectionDataSchema = import_zod3.z.discriminatedUnion("status", [
|
|
1136
|
+
BasicWithJwtInitiatingSchema,
|
|
1137
|
+
BasicWithJwtInitiatingSchema.extend({
|
|
1138
|
+
status: import_zod3.z.literal("FAILED" /* FAILED */),
|
|
1139
|
+
error: import_zod3.z.string().optional(),
|
|
1140
|
+
error_description: import_zod3.z.string().optional()
|
|
1141
|
+
}).catchall(import_zod3.z.unknown()),
|
|
1142
|
+
BasicWithJwtInitiatingSchema.extend({
|
|
1143
|
+
status: import_zod3.z.literal("EXPIRED" /* EXPIRED */),
|
|
1144
|
+
expired_at: import_zod3.z.string().optional()
|
|
1145
|
+
}).catchall(import_zod3.z.unknown())
|
|
1146
|
+
]);
|
|
1147
|
+
var ApiKeyInitiatingSchema = BaseSchemeRaw.extend({
|
|
1148
|
+
status: import_zod3.z.literal("ACTIVE" /* ACTIVE */),
|
|
1149
|
+
api_key: import_zod3.z.string()
|
|
1150
|
+
}).catchall(import_zod3.z.unknown());
|
|
1151
|
+
var ApiKeyConnectionDataSchema = import_zod3.z.discriminatedUnion("status", [
|
|
1152
|
+
ApiKeyInitiatingSchema,
|
|
1153
|
+
ApiKeyInitiatingSchema.extend({
|
|
1154
|
+
status: import_zod3.z.literal("FAILED" /* FAILED */),
|
|
1155
|
+
error: import_zod3.z.string().optional(),
|
|
1156
|
+
error_description: import_zod3.z.string().optional()
|
|
1157
|
+
}).catchall(import_zod3.z.unknown()),
|
|
1158
|
+
ApiKeyInitiatingSchema.extend({
|
|
1159
|
+
status: import_zod3.z.literal("EXPIRED" /* EXPIRED */),
|
|
1160
|
+
expired_at: import_zod3.z.string().optional()
|
|
1161
|
+
}).catchall(import_zod3.z.unknown())
|
|
1162
|
+
]);
|
|
1163
|
+
var BasicInitiatingSchema = BaseSchemeRaw.extend({
|
|
1164
|
+
status: import_zod3.z.literal("ACTIVE" /* ACTIVE */),
|
|
1165
|
+
username: import_zod3.z.string(),
|
|
1166
|
+
password: import_zod3.z.string()
|
|
1167
|
+
}).catchall(import_zod3.z.unknown());
|
|
1168
|
+
var BasicConnectionDataSchema = import_zod3.z.discriminatedUnion("status", [
|
|
1169
|
+
BasicInitiatingSchema,
|
|
1170
|
+
BasicInitiatingSchema.extend({
|
|
1171
|
+
status: import_zod3.z.literal("FAILED" /* FAILED */),
|
|
1172
|
+
error: import_zod3.z.string().optional(),
|
|
1173
|
+
error_description: import_zod3.z.string().optional()
|
|
1174
|
+
}).catchall(import_zod3.z.unknown()),
|
|
1175
|
+
BasicInitiatingSchema.extend({
|
|
1176
|
+
status: import_zod3.z.literal("EXPIRED" /* EXPIRED */),
|
|
1177
|
+
expired_at: import_zod3.z.string().optional()
|
|
1178
|
+
}).catchall(import_zod3.z.unknown())
|
|
1179
|
+
]);
|
|
1180
|
+
var BearerTokenInitiatingSchema = BaseSchemeRaw.extend({
|
|
1181
|
+
status: import_zod3.z.literal("ACTIVE" /* ACTIVE */),
|
|
1182
|
+
token: import_zod3.z.string()
|
|
1183
|
+
}).catchall(import_zod3.z.unknown());
|
|
1184
|
+
var BearerTokenConnectionDataSchema = import_zod3.z.discriminatedUnion("status", [
|
|
1185
|
+
BearerTokenInitiatingSchema,
|
|
1186
|
+
BearerTokenInitiatingSchema.extend({
|
|
1187
|
+
status: import_zod3.z.literal("FAILED" /* FAILED */),
|
|
1188
|
+
error: import_zod3.z.string().optional(),
|
|
1189
|
+
error_description: import_zod3.z.string().optional()
|
|
1190
|
+
}).catchall(import_zod3.z.unknown()),
|
|
1191
|
+
BearerTokenInitiatingSchema.extend({
|
|
1192
|
+
status: import_zod3.z.literal("EXPIRED" /* EXPIRED */),
|
|
1193
|
+
expired_at: import_zod3.z.string().optional()
|
|
1194
|
+
}).catchall(import_zod3.z.unknown())
|
|
1195
|
+
]);
|
|
1196
|
+
var GoogleServiceAccountInitiatingSchema = BaseSchemeRaw.extend({
|
|
1197
|
+
status: import_zod3.z.literal("ACTIVE" /* ACTIVE */),
|
|
1198
|
+
credentials_json: import_zod3.z.string()
|
|
1199
|
+
}).catchall(import_zod3.z.unknown());
|
|
1200
|
+
var GoogleServiceAccountConnectionDataSchema = import_zod3.z.discriminatedUnion("status", [
|
|
1201
|
+
GoogleServiceAccountInitiatingSchema,
|
|
1202
|
+
GoogleServiceAccountInitiatingSchema.extend({
|
|
1203
|
+
status: import_zod3.z.literal("FAILED" /* FAILED */),
|
|
1204
|
+
error: import_zod3.z.string().optional(),
|
|
1205
|
+
error_description: import_zod3.z.string().optional()
|
|
1206
|
+
}).catchall(import_zod3.z.unknown()),
|
|
1207
|
+
GoogleServiceAccountInitiatingSchema.extend({
|
|
1208
|
+
status: import_zod3.z.literal("EXPIRED" /* EXPIRED */),
|
|
1209
|
+
expired_at: import_zod3.z.string().optional()
|
|
1210
|
+
}).catchall(import_zod3.z.unknown())
|
|
1211
|
+
]);
|
|
1212
|
+
var NoAuthInitiatingSchema = BaseSchemeRaw.extend({
|
|
1213
|
+
status: import_zod3.z.literal("ACTIVE" /* ACTIVE */)
|
|
1214
|
+
}).catchall(import_zod3.z.unknown());
|
|
1215
|
+
var NoAuthConnectionDataSchema = import_zod3.z.discriminatedUnion("status", [
|
|
1216
|
+
NoAuthInitiatingSchema,
|
|
1217
|
+
NoAuthInitiatingSchema.extend({
|
|
1218
|
+
status: import_zod3.z.literal("FAILED" /* FAILED */),
|
|
1219
|
+
error: import_zod3.z.string().optional(),
|
|
1220
|
+
error_description: import_zod3.z.string().optional()
|
|
1221
|
+
}).catchall(import_zod3.z.unknown()),
|
|
1222
|
+
NoAuthInitiatingSchema.extend({
|
|
1223
|
+
status: import_zod3.z.literal("EXPIRED" /* EXPIRED */),
|
|
1224
|
+
expired_at: import_zod3.z.string().optional()
|
|
1225
|
+
}).catchall(import_zod3.z.unknown())
|
|
1226
|
+
]);
|
|
1227
|
+
var CalcomAuthInitiatingSchema = BaseSchemeRaw.extend({
|
|
1228
|
+
status: import_zod3.z.literal("ACTIVE" /* ACTIVE */)
|
|
1229
|
+
}).catchall(import_zod3.z.unknown());
|
|
1230
|
+
var CalcomAuthConnectionDataSchema = import_zod3.z.discriminatedUnion("status", [
|
|
1231
|
+
CalcomAuthInitiatingSchema,
|
|
1232
|
+
CalcomAuthInitiatingSchema.extend({
|
|
1233
|
+
status: import_zod3.z.literal("FAILED" /* FAILED */),
|
|
1234
|
+
error: import_zod3.z.string().optional(),
|
|
1235
|
+
error_description: import_zod3.z.string().optional()
|
|
1236
|
+
}).catchall(import_zod3.z.unknown()),
|
|
1237
|
+
CalcomAuthInitiatingSchema.extend({
|
|
1238
|
+
status: import_zod3.z.literal("EXPIRED" /* EXPIRED */),
|
|
1239
|
+
expired_at: import_zod3.z.string().optional()
|
|
1240
|
+
}).catchall(import_zod3.z.unknown())
|
|
1241
|
+
]);
|
|
1242
|
+
var SnowflakeInitiatingSchema = BaseSchemeRaw.extend({
|
|
1243
|
+
status: import_zod3.z.literal("ACTIVE" /* ACTIVE */)
|
|
1244
|
+
}).catchall(import_zod3.z.unknown());
|
|
1245
|
+
var SnowflakeConnectionDataSchema = import_zod3.z.discriminatedUnion("status", [
|
|
1246
|
+
SnowflakeInitiatingSchema,
|
|
1247
|
+
SnowflakeInitiatingSchema.extend({
|
|
1248
|
+
status: import_zod3.z.literal("FAILED" /* FAILED */),
|
|
1249
|
+
error: import_zod3.z.string().optional(),
|
|
1250
|
+
error_description: import_zod3.z.string().optional()
|
|
1251
|
+
}).catchall(import_zod3.z.unknown()),
|
|
1252
|
+
SnowflakeInitiatingSchema.extend({
|
|
1253
|
+
status: import_zod3.z.literal("EXPIRED" /* EXPIRED */),
|
|
1254
|
+
expired_at: import_zod3.z.string().optional()
|
|
1255
|
+
}).catchall(import_zod3.z.unknown())
|
|
1256
|
+
]);
|
|
1257
|
+
var ConnectionDataSchema = import_zod3.z.discriminatedUnion("authScheme", [
|
|
1258
|
+
import_zod3.z.object({
|
|
1259
|
+
authScheme: import_zod3.z.literal(AUTH_MODES_ENUM.OAUTH1),
|
|
1260
|
+
/**
|
|
1261
|
+
* the main connection data discriminated by auth scheme
|
|
1262
|
+
*/
|
|
1263
|
+
val: Oauth1ConnectionDataSchema
|
|
1264
|
+
}),
|
|
1265
|
+
import_zod3.z.object({
|
|
1266
|
+
authScheme: import_zod3.z.literal(AUTH_MODES_ENUM.OAUTH2),
|
|
1267
|
+
/**
|
|
1268
|
+
* the main connection data discriminated by auth scheme
|
|
1269
|
+
*/
|
|
1270
|
+
val: Oauth2ConnectionDataSchema
|
|
1271
|
+
}),
|
|
1272
|
+
import_zod3.z.object({
|
|
1273
|
+
authScheme: import_zod3.z.literal(AUTH_MODES_ENUM.COMPOSIO_LINK_AUTH),
|
|
1274
|
+
/**
|
|
1275
|
+
* the main connection data discriminated by auth scheme
|
|
1276
|
+
*/
|
|
1277
|
+
val: ComposioLinkConnectionDataSchema
|
|
1278
|
+
}),
|
|
1279
|
+
import_zod3.z.object({
|
|
1280
|
+
authScheme: import_zod3.z.literal(AUTH_MODES_ENUM.API_KEY),
|
|
1281
|
+
/**
|
|
1282
|
+
* the main connection data discriminated by auth scheme
|
|
1283
|
+
*/
|
|
1284
|
+
val: ApiKeyConnectionDataSchema
|
|
1285
|
+
}),
|
|
1286
|
+
import_zod3.z.object({
|
|
1287
|
+
authScheme: import_zod3.z.literal(AUTH_MODES_ENUM.BASIC),
|
|
1288
|
+
/**
|
|
1289
|
+
* the main connection data discriminated by auth scheme
|
|
1290
|
+
*/
|
|
1291
|
+
val: BasicConnectionDataSchema
|
|
1292
|
+
}),
|
|
1293
|
+
import_zod3.z.object({
|
|
1294
|
+
authScheme: import_zod3.z.literal(AUTH_MODES_ENUM.BEARER_TOKEN),
|
|
1295
|
+
/**
|
|
1296
|
+
* the main connection data discriminated by auth scheme
|
|
1297
|
+
*/
|
|
1298
|
+
val: BearerTokenConnectionDataSchema
|
|
1299
|
+
}),
|
|
1300
|
+
import_zod3.z.object({
|
|
1301
|
+
authScheme: import_zod3.z.literal(AUTH_MODES_ENUM.GOOGLE_SERVICE_ACCOUNT),
|
|
1302
|
+
/**
|
|
1303
|
+
* the main connection data discriminated by auth scheme
|
|
1304
|
+
*/
|
|
1305
|
+
val: GoogleServiceAccountConnectionDataSchema
|
|
1306
|
+
}),
|
|
1307
|
+
import_zod3.z.object({
|
|
1308
|
+
authScheme: import_zod3.z.literal(AUTH_MODES_ENUM.NO_AUTH),
|
|
1309
|
+
/**
|
|
1310
|
+
* the main connection data discriminated by auth scheme
|
|
1311
|
+
*/
|
|
1312
|
+
val: NoAuthConnectionDataSchema
|
|
1313
|
+
}),
|
|
1314
|
+
import_zod3.z.object({
|
|
1315
|
+
authScheme: import_zod3.z.literal(AUTH_MODES_ENUM.CALCOM_AUTH),
|
|
1316
|
+
/**
|
|
1317
|
+
* the main connection data discriminated by auth scheme
|
|
1318
|
+
*/
|
|
1319
|
+
val: CalcomAuthConnectionDataSchema
|
|
1320
|
+
}),
|
|
1321
|
+
import_zod3.z.object({
|
|
1322
|
+
authScheme: import_zod3.z.literal(AUTH_MODES_ENUM.SNOWFLAKE),
|
|
1323
|
+
/**
|
|
1324
|
+
* the main connection data discriminated by auth scheme
|
|
1325
|
+
*/
|
|
1326
|
+
val: SnowflakeConnectionDataSchema
|
|
1327
|
+
}),
|
|
1328
|
+
import_zod3.z.object({
|
|
1329
|
+
authScheme: import_zod3.z.literal(AUTH_MODES_ENUM.BILLCOM_AUTH),
|
|
1330
|
+
/**
|
|
1331
|
+
* the main connection data discriminated by auth scheme
|
|
1332
|
+
*/
|
|
1333
|
+
val: BillcomAuthConnectionDataSchema
|
|
1334
|
+
}),
|
|
1335
|
+
import_zod3.z.object({
|
|
1336
|
+
authScheme: import_zod3.z.literal(AUTH_MODES_ENUM.BASIC_WITH_JWT),
|
|
1337
|
+
/**
|
|
1338
|
+
* the main connection data discriminated by auth scheme
|
|
1339
|
+
*/
|
|
1340
|
+
val: BasicWithJwtConnectionDataSchema
|
|
1341
|
+
})
|
|
1342
|
+
]);
|
|
1343
|
+
|
|
1344
|
+
// src/types/connectedAccounts.types.ts
|
|
940
1345
|
var ConnectedAccountStatuses = {
|
|
941
1346
|
INITIALIZING: "INITIALIZING",
|
|
942
1347
|
INITIATED: "INITIATED",
|
|
@@ -944,41 +1349,42 @@ var ConnectedAccountStatuses = {
|
|
|
944
1349
|
FAILED: "FAILED",
|
|
945
1350
|
EXPIRED: "EXPIRED"
|
|
946
1351
|
};
|
|
947
|
-
var ConnectedAccountStatusSchema =
|
|
1352
|
+
var ConnectedAccountStatusSchema = import_zod4.z.enum([
|
|
948
1353
|
ConnectedAccountStatuses.INITIALIZING,
|
|
949
1354
|
ConnectedAccountStatuses.INITIATED,
|
|
950
1355
|
ConnectedAccountStatuses.ACTIVE,
|
|
951
1356
|
ConnectedAccountStatuses.FAILED,
|
|
952
1357
|
ConnectedAccountStatuses.EXPIRED
|
|
953
1358
|
]);
|
|
954
|
-
var CreateConnectedAccountParamsSchema =
|
|
955
|
-
authConfig:
|
|
956
|
-
id:
|
|
1359
|
+
var CreateConnectedAccountParamsSchema = import_zod4.z.object({
|
|
1360
|
+
authConfig: import_zod4.z.object({
|
|
1361
|
+
id: import_zod4.z.string()
|
|
957
1362
|
}),
|
|
958
|
-
connection:
|
|
959
|
-
data:
|
|
960
|
-
callbackUrl:
|
|
961
|
-
userId:
|
|
1363
|
+
connection: import_zod4.z.object({
|
|
1364
|
+
data: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()).optional(),
|
|
1365
|
+
callbackUrl: import_zod4.z.string().optional(),
|
|
1366
|
+
userId: import_zod4.z.string().optional()
|
|
962
1367
|
})
|
|
963
1368
|
});
|
|
964
|
-
var DefaultCreateConnectedAccountParamsSchema =
|
|
965
|
-
auth_config:
|
|
966
|
-
id:
|
|
1369
|
+
var DefaultCreateConnectedAccountParamsSchema = import_zod4.z.object({
|
|
1370
|
+
auth_config: import_zod4.z.object({
|
|
1371
|
+
id: import_zod4.z.string()
|
|
967
1372
|
}),
|
|
968
|
-
connection:
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
1373
|
+
connection: import_zod4.z.object({
|
|
1374
|
+
state: ConnectionDataSchema.optional(),
|
|
1375
|
+
data: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()).optional(),
|
|
1376
|
+
callback_url: import_zod4.z.string().optional(),
|
|
1377
|
+
user_id: import_zod4.z.string().optional()
|
|
972
1378
|
})
|
|
973
1379
|
});
|
|
974
|
-
var CreateConnectedAccountOptionsSchema =
|
|
975
|
-
callbackUrl:
|
|
976
|
-
|
|
1380
|
+
var CreateConnectedAccountOptionsSchema = import_zod4.z.object({
|
|
1381
|
+
callbackUrl: import_zod4.z.string().optional(),
|
|
1382
|
+
state: ConnectionDataSchema.optional()
|
|
977
1383
|
});
|
|
978
|
-
var CreateConnectedAccountResponseSchema =
|
|
979
|
-
id:
|
|
1384
|
+
var CreateConnectedAccountResponseSchema = import_zod4.z.object({
|
|
1385
|
+
id: import_zod4.z.string(),
|
|
980
1386
|
status: ConnectedAccountStatusSchema,
|
|
981
|
-
redirectUrl:
|
|
1387
|
+
redirectUrl: import_zod4.z.string().nullable()
|
|
982
1388
|
});
|
|
983
1389
|
var ConnectedAccountAuthSchemes = {
|
|
984
1390
|
OAUTH2: "OAUTH2",
|
|
@@ -995,7 +1401,7 @@ var ConnectedAccountAuthSchemes = {
|
|
|
995
1401
|
CALCOM_AUTH: "CALCOM_AUTH",
|
|
996
1402
|
SNOWFLAKE: "SNOWFLAKE"
|
|
997
1403
|
};
|
|
998
|
-
var ConnectedAccountAuthSchemesSchema =
|
|
1404
|
+
var ConnectedAccountAuthSchemesSchema = import_zod4.z.enum([
|
|
999
1405
|
ConnectedAccountAuthSchemes.OAUTH2,
|
|
1000
1406
|
ConnectedAccountAuthSchemes.OAUTH1,
|
|
1001
1407
|
ConnectedAccountAuthSchemes.OAUTH1A,
|
|
@@ -1010,42 +1416,41 @@ var ConnectedAccountAuthSchemesSchema = import_zod3.z.enum([
|
|
|
1010
1416
|
ConnectedAccountAuthSchemes.CALCOM_AUTH,
|
|
1011
1417
|
ConnectedAccountAuthSchemes.SNOWFLAKE
|
|
1012
1418
|
]);
|
|
1013
|
-
var ConnectedAccountAuthConfigSchema =
|
|
1014
|
-
id:
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
isDisabled: import_zod3.z.boolean()
|
|
1419
|
+
var ConnectedAccountAuthConfigSchema = import_zod4.z.object({
|
|
1420
|
+
id: import_zod4.z.string(),
|
|
1421
|
+
isComposioManaged: import_zod4.z.boolean(),
|
|
1422
|
+
isDisabled: import_zod4.z.boolean()
|
|
1018
1423
|
});
|
|
1019
|
-
var ConnectedAccountRetrieveResponseSchema =
|
|
1020
|
-
id:
|
|
1424
|
+
var ConnectedAccountRetrieveResponseSchema = import_zod4.z.object({
|
|
1425
|
+
id: import_zod4.z.string(),
|
|
1021
1426
|
authConfig: ConnectedAccountAuthConfigSchema,
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
params: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()).optional(),
|
|
1427
|
+
data: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()),
|
|
1428
|
+
params: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()).optional(),
|
|
1025
1429
|
status: ConnectedAccountStatusSchema,
|
|
1026
|
-
statusReason:
|
|
1027
|
-
toolkit:
|
|
1028
|
-
slug:
|
|
1430
|
+
statusReason: import_zod4.z.string().nullable(),
|
|
1431
|
+
toolkit: import_zod4.z.object({
|
|
1432
|
+
slug: import_zod4.z.string()
|
|
1029
1433
|
}),
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1434
|
+
state: ConnectionDataSchema.optional(),
|
|
1435
|
+
testRequestEndpoint: import_zod4.z.string().optional(),
|
|
1436
|
+
isDisabled: import_zod4.z.boolean(),
|
|
1437
|
+
createdAt: import_zod4.z.string(),
|
|
1438
|
+
updatedAt: import_zod4.z.string()
|
|
1034
1439
|
});
|
|
1035
|
-
var ConnectedAccountListParamsSchema =
|
|
1036
|
-
authConfigIds:
|
|
1037
|
-
cursor:
|
|
1038
|
-
labels:
|
|
1039
|
-
limit:
|
|
1040
|
-
orderBy:
|
|
1041
|
-
statuses:
|
|
1042
|
-
toolkitSlugs:
|
|
1043
|
-
userIds:
|
|
1440
|
+
var ConnectedAccountListParamsSchema = import_zod4.z.object({
|
|
1441
|
+
authConfigIds: import_zod4.z.array(import_zod4.z.string()).nullable().optional().describe("The auth config ids of the connected accounts"),
|
|
1442
|
+
cursor: import_zod4.z.number().nullable().optional().describe("The cursor to paginate through the connected accounts"),
|
|
1443
|
+
labels: import_zod4.z.array(import_zod4.z.string()).nullable().optional().describe("The labels of the connected accounts"),
|
|
1444
|
+
limit: import_zod4.z.number().nullable().optional().describe("The limit of the connected accounts to return"),
|
|
1445
|
+
orderBy: import_zod4.z.enum(["created_at", "updated_at"]).optional().describe("The order by of the connected accounts"),
|
|
1446
|
+
statuses: import_zod4.z.array(ConnectedAccountStatusSchema).nullable().optional().describe("The statuses of the connected accounts"),
|
|
1447
|
+
toolkitSlugs: import_zod4.z.array(import_zod4.z.string()).nullable().optional().describe("The toolkit slugs of the connected accounts"),
|
|
1448
|
+
userIds: import_zod4.z.array(import_zod4.z.string()).nullable().optional().describe("The user ids of the connected accounts")
|
|
1044
1449
|
});
|
|
1045
|
-
var ConnectedAccountListResponseSchema =
|
|
1046
|
-
items:
|
|
1047
|
-
nextCursor:
|
|
1048
|
-
totalPages:
|
|
1450
|
+
var ConnectedAccountListResponseSchema = import_zod4.z.object({
|
|
1451
|
+
items: import_zod4.z.array(ConnectedAccountRetrieveResponseSchema).describe("The list of connected accounts"),
|
|
1452
|
+
nextCursor: import_zod4.z.string().nullable().describe("The next cursor to paginate through the connected accounts"),
|
|
1453
|
+
totalPages: import_zod4.z.number().describe("The total number of pages of connected accounts")
|
|
1049
1454
|
});
|
|
1050
1455
|
|
|
1051
1456
|
// src/errors/AuthConfigErrors.ts
|
|
@@ -1123,18 +1528,19 @@ var ComposioToolkitFetchError = class extends ComposioError {
|
|
|
1123
1528
|
};
|
|
1124
1529
|
|
|
1125
1530
|
// src/errors/ValidationErrors.ts
|
|
1126
|
-
var
|
|
1531
|
+
var import_zod5 = require("zod");
|
|
1127
1532
|
var ValidationErrorCodes = {
|
|
1128
|
-
VALIDATION_ERROR: "VALIDATION_ERROR"
|
|
1533
|
+
VALIDATION_ERROR: "VALIDATION_ERROR",
|
|
1534
|
+
JSON_SCHEMA_TO_ZOD_ERROR: "JSON_SCHEMA_TO_ZOD_ERROR"
|
|
1129
1535
|
};
|
|
1130
1536
|
var ValidationError = class extends ComposioError {
|
|
1131
1537
|
constructor(message = "Input validation failed", options = {}) {
|
|
1132
1538
|
const { cause: providedZodError, ...restOptions } = options;
|
|
1133
1539
|
let zodErrorInstance;
|
|
1134
|
-
if (providedZodError instanceof
|
|
1540
|
+
if (providedZodError instanceof import_zod5.ZodError) {
|
|
1135
1541
|
zodErrorInstance = providedZodError;
|
|
1136
1542
|
} else {
|
|
1137
|
-
zodErrorInstance = new
|
|
1543
|
+
zodErrorInstance = new import_zod5.ZodError([
|
|
1138
1544
|
{
|
|
1139
1545
|
path: [],
|
|
1140
1546
|
message: "Invalid input",
|
|
@@ -1156,7 +1562,7 @@ var ValidationError = class extends ComposioError {
|
|
|
1156
1562
|
this.message = `${message}: ${userFriendlyMessage}`;
|
|
1157
1563
|
}
|
|
1158
1564
|
generateUserFriendlyMessage() {
|
|
1159
|
-
if (this.cause instanceof
|
|
1565
|
+
if (this.cause instanceof import_zod5.ZodError && this.cause.issues.length > 0) {
|
|
1160
1566
|
const issue = this.cause.issues[0];
|
|
1161
1567
|
const path = issue.path.join(".");
|
|
1162
1568
|
const param = path || "parameter";
|
|
@@ -1168,6 +1574,14 @@ var ValidationError = class extends ComposioError {
|
|
|
1168
1574
|
return "Please check your input parameters";
|
|
1169
1575
|
}
|
|
1170
1576
|
};
|
|
1577
|
+
var JsonSchemaToZodError = class extends ComposioError {
|
|
1578
|
+
constructor(message = "Failed to convert JSON schema to Zod schema", options = {}) {
|
|
1579
|
+
super(message, {
|
|
1580
|
+
...options,
|
|
1581
|
+
code: options.code || ValidationErrorCodes.JSON_SCHEMA_TO_ZOD_ERROR
|
|
1582
|
+
});
|
|
1583
|
+
}
|
|
1584
|
+
};
|
|
1171
1585
|
|
|
1172
1586
|
// src/errors/SDKErrors.ts
|
|
1173
1587
|
var SDKErrorCodes = {
|
|
@@ -1814,7 +2228,7 @@ var Tools = class {
|
|
|
1814
2228
|
connected_account_id: body.connectedAccountId,
|
|
1815
2229
|
custom_auth_params: body.customAuthParams,
|
|
1816
2230
|
arguments: body.arguments,
|
|
1817
|
-
|
|
2231
|
+
user_id: body.userId,
|
|
1818
2232
|
version: body.version,
|
|
1819
2233
|
text: body.text
|
|
1820
2234
|
});
|
|
@@ -2036,87 +2450,87 @@ var Tools = class {
|
|
|
2036
2450
|
var import_client4 = __toESM(require("@composio/client"), 1);
|
|
2037
2451
|
|
|
2038
2452
|
// src/types/toolkit.types.ts
|
|
2039
|
-
var
|
|
2040
|
-
var ToolkitMangedByEnumSchema =
|
|
2041
|
-
var ToolkitSortByEnumSchema =
|
|
2042
|
-
var ToolkitsListParamsSchema =
|
|
2043
|
-
category:
|
|
2044
|
-
isLocal:
|
|
2453
|
+
var import_zod6 = require("zod");
|
|
2454
|
+
var ToolkitMangedByEnumSchema = import_zod6.z.enum(["all", "composio", "project"]);
|
|
2455
|
+
var ToolkitSortByEnumSchema = import_zod6.z.enum(["usage", "alphabetically"]);
|
|
2456
|
+
var ToolkitsListParamsSchema = import_zod6.z.object({
|
|
2457
|
+
category: import_zod6.z.string().optional(),
|
|
2458
|
+
isLocal: import_zod6.z.boolean().optional(),
|
|
2045
2459
|
managedBy: ToolkitMangedByEnumSchema.optional(),
|
|
2046
2460
|
sortBy: ToolkitSortByEnumSchema.optional()
|
|
2047
2461
|
});
|
|
2048
|
-
var ToolKitMetaSchema =
|
|
2049
|
-
categories:
|
|
2050
|
-
|
|
2051
|
-
slug:
|
|
2052
|
-
name:
|
|
2462
|
+
var ToolKitMetaSchema = import_zod6.z.object({
|
|
2463
|
+
categories: import_zod6.z.array(
|
|
2464
|
+
import_zod6.z.object({
|
|
2465
|
+
slug: import_zod6.z.string(),
|
|
2466
|
+
name: import_zod6.z.string()
|
|
2053
2467
|
})
|
|
2054
2468
|
).optional(),
|
|
2055
|
-
appUrl:
|
|
2056
|
-
createdAt:
|
|
2057
|
-
description:
|
|
2058
|
-
logo:
|
|
2059
|
-
toolsCount:
|
|
2060
|
-
triggersCount:
|
|
2061
|
-
updatedAt:
|
|
2469
|
+
appUrl: import_zod6.z.string().optional(),
|
|
2470
|
+
createdAt: import_zod6.z.string().optional(),
|
|
2471
|
+
description: import_zod6.z.string().optional(),
|
|
2472
|
+
logo: import_zod6.z.string().optional(),
|
|
2473
|
+
toolsCount: import_zod6.z.number().optional(),
|
|
2474
|
+
triggersCount: import_zod6.z.number().optional(),
|
|
2475
|
+
updatedAt: import_zod6.z.string().optional()
|
|
2062
2476
|
});
|
|
2063
|
-
var ToolKitItemSchema =
|
|
2064
|
-
name:
|
|
2065
|
-
slug:
|
|
2477
|
+
var ToolKitItemSchema = import_zod6.z.object({
|
|
2478
|
+
name: import_zod6.z.string(),
|
|
2479
|
+
slug: import_zod6.z.string(),
|
|
2066
2480
|
meta: ToolKitMetaSchema,
|
|
2067
|
-
isLocalToolkit:
|
|
2068
|
-
authSchemes:
|
|
2069
|
-
composioManagedAuthSchemes:
|
|
2070
|
-
noAuth:
|
|
2481
|
+
isLocalToolkit: import_zod6.z.boolean(),
|
|
2482
|
+
authSchemes: import_zod6.z.array(import_zod6.z.string()).optional(),
|
|
2483
|
+
composioManagedAuthSchemes: import_zod6.z.array(import_zod6.z.string()).optional(),
|
|
2484
|
+
noAuth: import_zod6.z.boolean().optional()
|
|
2071
2485
|
});
|
|
2072
|
-
var ToolKitListResponseSchema =
|
|
2073
|
-
items:
|
|
2074
|
-
nextCursor:
|
|
2075
|
-
totalPages:
|
|
2486
|
+
var ToolKitListResponseSchema = import_zod6.z.object({
|
|
2487
|
+
items: import_zod6.z.array(ToolKitItemSchema),
|
|
2488
|
+
nextCursor: import_zod6.z.string().nullable(),
|
|
2489
|
+
totalPages: import_zod6.z.number()
|
|
2076
2490
|
});
|
|
2077
|
-
var ToolkitAuthFieldSchema =
|
|
2078
|
-
name:
|
|
2079
|
-
displayName:
|
|
2080
|
-
type:
|
|
2081
|
-
default:
|
|
2491
|
+
var ToolkitAuthFieldSchema = import_zod6.z.object({
|
|
2492
|
+
name: import_zod6.z.string(),
|
|
2493
|
+
displayName: import_zod6.z.string(),
|
|
2494
|
+
type: import_zod6.z.string(),
|
|
2495
|
+
default: import_zod6.z.string().nullable().optional()
|
|
2082
2496
|
});
|
|
2083
|
-
var ToolkitAuthConfigDetailsSchema =
|
|
2084
|
-
name:
|
|
2085
|
-
mode:
|
|
2086
|
-
fields:
|
|
2087
|
-
authConfigCreation:
|
|
2088
|
-
optional:
|
|
2089
|
-
required:
|
|
2497
|
+
var ToolkitAuthConfigDetailsSchema = import_zod6.z.object({
|
|
2498
|
+
name: import_zod6.z.string(),
|
|
2499
|
+
mode: import_zod6.z.string(),
|
|
2500
|
+
fields: import_zod6.z.object({
|
|
2501
|
+
authConfigCreation: import_zod6.z.object({
|
|
2502
|
+
optional: import_zod6.z.array(ToolkitAuthFieldSchema),
|
|
2503
|
+
required: import_zod6.z.array(ToolkitAuthFieldSchema)
|
|
2090
2504
|
}),
|
|
2091
|
-
connectedAccountInitiation:
|
|
2092
|
-
optional:
|
|
2093
|
-
required:
|
|
2505
|
+
connectedAccountInitiation: import_zod6.z.object({
|
|
2506
|
+
optional: import_zod6.z.array(ToolkitAuthFieldSchema),
|
|
2507
|
+
required: import_zod6.z.array(ToolkitAuthFieldSchema)
|
|
2094
2508
|
})
|
|
2095
2509
|
}),
|
|
2096
|
-
proxy:
|
|
2097
|
-
baseUrl:
|
|
2510
|
+
proxy: import_zod6.z.object({
|
|
2511
|
+
baseUrl: import_zod6.z.string().optional()
|
|
2098
2512
|
}).optional()
|
|
2099
2513
|
});
|
|
2100
|
-
var ToolkitRetrieveResponseSchema =
|
|
2101
|
-
name:
|
|
2102
|
-
slug:
|
|
2514
|
+
var ToolkitRetrieveResponseSchema = import_zod6.z.object({
|
|
2515
|
+
name: import_zod6.z.string(),
|
|
2516
|
+
slug: import_zod6.z.string(),
|
|
2103
2517
|
meta: ToolKitMetaSchema,
|
|
2104
|
-
isLocalToolkit:
|
|
2105
|
-
composioManagedAuthSchemes:
|
|
2106
|
-
authConfigDetails:
|
|
2518
|
+
isLocalToolkit: import_zod6.z.boolean(),
|
|
2519
|
+
composioManagedAuthSchemes: import_zod6.z.array(import_zod6.z.string()).optional(),
|
|
2520
|
+
authConfigDetails: import_zod6.z.array(ToolkitAuthConfigDetailsSchema).optional()
|
|
2107
2521
|
});
|
|
2108
|
-
var ToolkitCategorySchema =
|
|
2109
|
-
id:
|
|
2110
|
-
name:
|
|
2522
|
+
var ToolkitCategorySchema = import_zod6.z.object({
|
|
2523
|
+
id: import_zod6.z.string(),
|
|
2524
|
+
name: import_zod6.z.string()
|
|
2111
2525
|
});
|
|
2112
|
-
var ToolkitRetrieveCategoriesResponseSchema =
|
|
2113
|
-
items:
|
|
2114
|
-
nextCursor:
|
|
2115
|
-
totalPages:
|
|
2526
|
+
var ToolkitRetrieveCategoriesResponseSchema = import_zod6.z.object({
|
|
2527
|
+
items: import_zod6.z.array(ToolkitCategorySchema),
|
|
2528
|
+
nextCursor: import_zod6.z.string().nullable(),
|
|
2529
|
+
totalPages: import_zod6.z.number()
|
|
2116
2530
|
});
|
|
2117
2531
|
|
|
2118
2532
|
// src/types/authConfigs.types.ts
|
|
2119
|
-
var
|
|
2533
|
+
var import_zod7 = require("zod");
|
|
2120
2534
|
var AuthConfigTypes = {
|
|
2121
2535
|
CUSTOM: "use_custom_auth",
|
|
2122
2536
|
COMPOSIO_MANAGED: "use_composio_managed_auth"
|
|
@@ -2136,10 +2550,9 @@ var AuthSchemeTypes = {
|
|
|
2136
2550
|
CALCOM_AUTH: "CALCOM_AUTH",
|
|
2137
2551
|
SNOWFLAKE: "SNOWFLAKE"
|
|
2138
2552
|
};
|
|
2139
|
-
var AuthSchemeEnum =
|
|
2553
|
+
var AuthSchemeEnum = import_zod7.z.enum([
|
|
2140
2554
|
"OAUTH2",
|
|
2141
2555
|
"OAUTH1",
|
|
2142
|
-
"OAUTH1A",
|
|
2143
2556
|
"API_KEY",
|
|
2144
2557
|
"BASIC",
|
|
2145
2558
|
"BILLCOM_AUTH",
|
|
@@ -2151,67 +2564,69 @@ var AuthSchemeEnum = import_zod6.z.enum([
|
|
|
2151
2564
|
"CALCOM_AUTH",
|
|
2152
2565
|
"SNOWFLAKE"
|
|
2153
2566
|
]);
|
|
2154
|
-
var CreateCustomAuthConfigParamsSchema =
|
|
2155
|
-
type:
|
|
2156
|
-
name:
|
|
2157
|
-
credentials:
|
|
2158
|
-
authScheme: AuthSchemeEnum
|
|
2567
|
+
var CreateCustomAuthConfigParamsSchema = import_zod7.z.object({
|
|
2568
|
+
type: import_zod7.z.literal("use_custom_auth"),
|
|
2569
|
+
name: import_zod7.z.string().optional(),
|
|
2570
|
+
credentials: import_zod7.z.record(import_zod7.z.string(), import_zod7.z.union([import_zod7.z.string(), import_zod7.z.number(), import_zod7.z.boolean()])),
|
|
2571
|
+
authScheme: AuthSchemeEnum,
|
|
2572
|
+
restrictToFollowingTools: import_zod7.z.array(import_zod7.z.string()).optional()
|
|
2159
2573
|
});
|
|
2160
|
-
var CreateComposioManagedAuthConfigParamsSchema =
|
|
2161
|
-
type:
|
|
2162
|
-
name:
|
|
2163
|
-
credentials:
|
|
2574
|
+
var CreateComposioManagedAuthConfigParamsSchema = import_zod7.z.object({
|
|
2575
|
+
type: import_zod7.z.literal("use_composio_managed_auth"),
|
|
2576
|
+
name: import_zod7.z.string().optional(),
|
|
2577
|
+
credentials: import_zod7.z.record(import_zod7.z.string(), import_zod7.z.union([import_zod7.z.string(), import_zod7.z.number(), import_zod7.z.boolean()])).optional(),
|
|
2578
|
+
restrictToFollowingTools: import_zod7.z.array(import_zod7.z.string()).optional()
|
|
2164
2579
|
});
|
|
2165
|
-
var CreateAuthConfigParamsSchema =
|
|
2580
|
+
var CreateAuthConfigParamsSchema = import_zod7.z.discriminatedUnion("type", [
|
|
2166
2581
|
CreateCustomAuthConfigParamsSchema,
|
|
2167
2582
|
CreateComposioManagedAuthConfigParamsSchema
|
|
2168
2583
|
]);
|
|
2169
|
-
var CreateAuthConfigResponseSchema =
|
|
2170
|
-
id:
|
|
2171
|
-
authScheme:
|
|
2172
|
-
isComposioManaged:
|
|
2173
|
-
toolkit:
|
|
2584
|
+
var CreateAuthConfigResponseSchema = import_zod7.z.object({
|
|
2585
|
+
id: import_zod7.z.string(),
|
|
2586
|
+
authScheme: import_zod7.z.string(),
|
|
2587
|
+
isComposioManaged: import_zod7.z.boolean(),
|
|
2588
|
+
toolkit: import_zod7.z.string()
|
|
2174
2589
|
});
|
|
2175
|
-
var AuthConfigRetrieveResponseSchema =
|
|
2176
|
-
id:
|
|
2177
|
-
name:
|
|
2178
|
-
toolkit:
|
|
2179
|
-
logo:
|
|
2180
|
-
slug:
|
|
2590
|
+
var AuthConfigRetrieveResponseSchema = import_zod7.z.object({
|
|
2591
|
+
id: import_zod7.z.string(),
|
|
2592
|
+
name: import_zod7.z.string(),
|
|
2593
|
+
toolkit: import_zod7.z.object({
|
|
2594
|
+
logo: import_zod7.z.string(),
|
|
2595
|
+
slug: import_zod7.z.string()
|
|
2181
2596
|
}),
|
|
2182
|
-
noOfConnections:
|
|
2183
|
-
status:
|
|
2184
|
-
uuid:
|
|
2597
|
+
noOfConnections: import_zod7.z.number(),
|
|
2598
|
+
status: import_zod7.z.enum(["ENABLED", "DISABLED"]),
|
|
2599
|
+
uuid: import_zod7.z.string(),
|
|
2185
2600
|
authScheme: AuthSchemeEnum.optional(),
|
|
2186
|
-
credentials:
|
|
2187
|
-
expectedInputFields:
|
|
2188
|
-
isComposioManaged:
|
|
2189
|
-
createdBy:
|
|
2190
|
-
createdAt:
|
|
2191
|
-
lastUpdatedAt:
|
|
2601
|
+
credentials: import_zod7.z.record(import_zod7.z.string(), import_zod7.z.unknown()).optional(),
|
|
2602
|
+
expectedInputFields: import_zod7.z.array(import_zod7.z.unknown()).optional(),
|
|
2603
|
+
isComposioManaged: import_zod7.z.boolean().optional(),
|
|
2604
|
+
createdBy: import_zod7.z.string().optional(),
|
|
2605
|
+
createdAt: import_zod7.z.string().optional(),
|
|
2606
|
+
lastUpdatedAt: import_zod7.z.string().optional()
|
|
2192
2607
|
});
|
|
2193
|
-
var AuthConfigListParamsSchema =
|
|
2194
|
-
cursor:
|
|
2195
|
-
isComposioManaged:
|
|
2196
|
-
limit:
|
|
2197
|
-
toolkit:
|
|
2608
|
+
var AuthConfigListParamsSchema = import_zod7.z.object({
|
|
2609
|
+
cursor: import_zod7.z.string().optional(),
|
|
2610
|
+
isComposioManaged: import_zod7.z.boolean().optional(),
|
|
2611
|
+
limit: import_zod7.z.number().optional(),
|
|
2612
|
+
toolkit: import_zod7.z.string().optional()
|
|
2198
2613
|
});
|
|
2199
|
-
var AuthConfigListResponseSchema =
|
|
2200
|
-
items:
|
|
2201
|
-
nextCursor:
|
|
2202
|
-
totalPages:
|
|
2614
|
+
var AuthConfigListResponseSchema = import_zod7.z.object({
|
|
2615
|
+
items: import_zod7.z.array(AuthConfigRetrieveResponseSchema),
|
|
2616
|
+
nextCursor: import_zod7.z.string().nullable(),
|
|
2617
|
+
totalPages: import_zod7.z.number()
|
|
2203
2618
|
});
|
|
2204
|
-
var AuthCustomConfigUpdateParamsSchema =
|
|
2205
|
-
credentials:
|
|
2206
|
-
type:
|
|
2207
|
-
restrictToFollowingTools:
|
|
2619
|
+
var AuthCustomConfigUpdateParamsSchema = import_zod7.z.object({
|
|
2620
|
+
credentials: import_zod7.z.record(import_zod7.z.string(), import_zod7.z.union([import_zod7.z.string(), import_zod7.z.unknown()])),
|
|
2621
|
+
type: import_zod7.z.literal("custom"),
|
|
2622
|
+
restrictToFollowingTools: import_zod7.z.array(import_zod7.z.string()).optional()
|
|
2208
2623
|
});
|
|
2209
|
-
var AuthDefaultConfigUpdateParamsSchema =
|
|
2210
|
-
scopes:
|
|
2211
|
-
type:
|
|
2212
|
-
restrictToFollowingTools:
|
|
2624
|
+
var AuthDefaultConfigUpdateParamsSchema = import_zod7.z.object({
|
|
2625
|
+
scopes: import_zod7.z.string(),
|
|
2626
|
+
type: import_zod7.z.literal("default"),
|
|
2627
|
+
restrictToFollowingTools: import_zod7.z.array(import_zod7.z.string()).optional()
|
|
2213
2628
|
});
|
|
2214
|
-
var AuthConfigUpdateParamsSchema =
|
|
2629
|
+
var AuthConfigUpdateParamsSchema = import_zod7.z.discriminatedUnion("type", [
|
|
2215
2630
|
AuthCustomConfigUpdateParamsSchema,
|
|
2216
2631
|
AuthDefaultConfigUpdateParamsSchema
|
|
2217
2632
|
]);
|
|
@@ -2344,7 +2759,18 @@ var AuthConfigs = class {
|
|
|
2344
2759
|
toolkit: {
|
|
2345
2760
|
slug: toolkit
|
|
2346
2761
|
},
|
|
2347
|
-
auth_config: parsedOptions.data
|
|
2762
|
+
auth_config: parsedOptions.data.type === "use_custom_auth" ? {
|
|
2763
|
+
type: parsedOptions.data.type,
|
|
2764
|
+
name: parsedOptions.data.name,
|
|
2765
|
+
authScheme: parsedOptions.data.authScheme,
|
|
2766
|
+
credentials: parsedOptions.data.credentials,
|
|
2767
|
+
restrict_to_following_tools: parsedOptions.data.restrictToFollowingTools
|
|
2768
|
+
} : {
|
|
2769
|
+
type: parsedOptions.data.type,
|
|
2770
|
+
credentials: parsedOptions.data.credentials,
|
|
2771
|
+
name: parsedOptions.data.name,
|
|
2772
|
+
restrict_to_following_tools: parsedOptions.data.restrictToFollowingTools
|
|
2773
|
+
}
|
|
2348
2774
|
});
|
|
2349
2775
|
const parsedResult = CreateAuthConfigResponseSchema.safeParse({
|
|
2350
2776
|
id: result.auth_config.id,
|
|
@@ -2520,7 +2946,34 @@ var AuthConfigs = class {
|
|
|
2520
2946
|
|
|
2521
2947
|
// src/models/ConnectionRequest.ts
|
|
2522
2948
|
var import_client3 = __toESM(require("@composio/client"), 1);
|
|
2523
|
-
|
|
2949
|
+
|
|
2950
|
+
// src/utils/transformers/connectedAccounts.ts
|
|
2951
|
+
function transformConnectedAccountResponse(response) {
|
|
2952
|
+
const result = ConnectedAccountRetrieveResponseSchema.safeParse({
|
|
2953
|
+
...response,
|
|
2954
|
+
authConfig: {
|
|
2955
|
+
...response.auth_config,
|
|
2956
|
+
id: response.auth_config.id,
|
|
2957
|
+
isComposioManaged: response.auth_config.is_composio_managed,
|
|
2958
|
+
isDisabled: response.auth_config.is_disabled
|
|
2959
|
+
},
|
|
2960
|
+
state: response.state,
|
|
2961
|
+
status: response.status,
|
|
2962
|
+
statusReason: response.status_reason,
|
|
2963
|
+
isDisabled: response.is_disabled,
|
|
2964
|
+
createdAt: response.created_at,
|
|
2965
|
+
updatedAt: response.updated_at,
|
|
2966
|
+
testRequestEndpoint: response.test_request_endpoint
|
|
2967
|
+
});
|
|
2968
|
+
if (!result.success) {
|
|
2969
|
+
throw new ValidationError("Failed to parse connected account retrieve response", {
|
|
2970
|
+
cause: result.error
|
|
2971
|
+
});
|
|
2972
|
+
}
|
|
2973
|
+
return result.data;
|
|
2974
|
+
}
|
|
2975
|
+
|
|
2976
|
+
// src/models/ConnectionRequest.ts
|
|
2524
2977
|
var ConnectionRequest = class {
|
|
2525
2978
|
client;
|
|
2526
2979
|
id;
|
|
@@ -2533,45 +2986,6 @@ var ConnectionRequest = class {
|
|
|
2533
2986
|
this.redirectUrl = redirectUrl;
|
|
2534
2987
|
telemetry.instrument(this);
|
|
2535
2988
|
}
|
|
2536
|
-
/**
|
|
2537
|
-
* Transforms the raw connected account response from the Composio API to the SDK format.
|
|
2538
|
-
*
|
|
2539
|
-
* This method converts property names from snake_case to camelCase and reorganizes
|
|
2540
|
-
* the data structure to match the SDK's standardized format.
|
|
2541
|
-
*
|
|
2542
|
-
* @param {OriginalConnectedAccountResponse} response - The raw API response to transform
|
|
2543
|
-
* @returns {Promise<ConnectedAccountRetrieveResponse>} The transformed response
|
|
2544
|
-
* @throws {ZodError} If the response fails validation against the expected schema
|
|
2545
|
-
*
|
|
2546
|
-
* @private
|
|
2547
|
-
*/
|
|
2548
|
-
async transformResponse(response) {
|
|
2549
|
-
try {
|
|
2550
|
-
const parsedResponse = ConnectedAccountRetrieveResponseSchema.parse({
|
|
2551
|
-
...response,
|
|
2552
|
-
userId: response.user_id,
|
|
2553
|
-
// Add the missing userId property
|
|
2554
|
-
authConfig: {
|
|
2555
|
-
...response.auth_config,
|
|
2556
|
-
authScheme: response.auth_config.auth_scheme,
|
|
2557
|
-
isComposioManaged: response.auth_config.is_composio_managed,
|
|
2558
|
-
isDisabled: response.auth_config.is_disabled
|
|
2559
|
-
},
|
|
2560
|
-
statusReason: response.status_reason,
|
|
2561
|
-
isDisabled: response.is_disabled,
|
|
2562
|
-
createdAt: response.created_at,
|
|
2563
|
-
updatedAt: response.updated_at,
|
|
2564
|
-
testRequestEndpoint: response.test_request_endpoint
|
|
2565
|
-
});
|
|
2566
|
-
return parsedResponse;
|
|
2567
|
-
} catch (error) {
|
|
2568
|
-
logger_default.error("Error transforming response", error);
|
|
2569
|
-
if (error instanceof import_zod7.ZodError) {
|
|
2570
|
-
logger_default.error(JSON.stringify(error.errors, null, 2));
|
|
2571
|
-
}
|
|
2572
|
-
throw error;
|
|
2573
|
-
}
|
|
2574
|
-
}
|
|
2575
2989
|
/**
|
|
2576
2990
|
* Waits for the connection request to complete and become active.
|
|
2577
2991
|
*
|
|
@@ -2603,7 +3017,7 @@ var ConnectionRequest = class {
|
|
|
2603
3017
|
const response = await this.client.connectedAccounts.retrieve(this.id);
|
|
2604
3018
|
if (response.status === ConnectedAccountStatuses.ACTIVE) {
|
|
2605
3019
|
this.status = ConnectedAccountStatuses.ACTIVE;
|
|
2606
|
-
return
|
|
3020
|
+
return transformConnectedAccountResponse(response);
|
|
2607
3021
|
}
|
|
2608
3022
|
} catch (error) {
|
|
2609
3023
|
if (error instanceof import_client3.default.NotFoundError) {
|
|
@@ -2630,14 +3044,13 @@ var ConnectionRequest = class {
|
|
|
2630
3044
|
const response = await this.client.connectedAccounts.retrieve(this.id);
|
|
2631
3045
|
this.status = response.status;
|
|
2632
3046
|
if (response.status === ConnectedAccountStatuses.ACTIVE) {
|
|
2633
|
-
return
|
|
3047
|
+
return transformConnectedAccountResponse(response);
|
|
2634
3048
|
}
|
|
2635
3049
|
if (terminalErrorStates.includes(response.status)) {
|
|
2636
3050
|
throw new ConnectionRequestFailedError(
|
|
2637
3051
|
`Connection request failed with status: ${response.status}${response.status_reason ? `, reason: ${response.status_reason}` : ""}`,
|
|
2638
3052
|
{
|
|
2639
3053
|
meta: {
|
|
2640
|
-
userId: response.user_id,
|
|
2641
3054
|
connectedAccountId: this.id,
|
|
2642
3055
|
status: response.status,
|
|
2643
3056
|
statusReason: response.status_reason
|
|
@@ -2678,30 +3091,6 @@ var ConnectedAccounts = class {
|
|
|
2678
3091
|
this.client = client;
|
|
2679
3092
|
telemetry.instrument(this);
|
|
2680
3093
|
}
|
|
2681
|
-
transformConnectedAccountRetrieveResponse(response) {
|
|
2682
|
-
const result = ConnectedAccountRetrieveResponseSchema.safeParse({
|
|
2683
|
-
...response,
|
|
2684
|
-
userId: response.user_id,
|
|
2685
|
-
// Add the missing userId property
|
|
2686
|
-
authConfig: {
|
|
2687
|
-
...response.auth_config,
|
|
2688
|
-
authScheme: response.auth_config.auth_scheme,
|
|
2689
|
-
isComposioManaged: response.auth_config.is_composio_managed,
|
|
2690
|
-
isDisabled: response.auth_config.is_disabled
|
|
2691
|
-
},
|
|
2692
|
-
statusReason: response.status_reason,
|
|
2693
|
-
isDisabled: response.is_disabled,
|
|
2694
|
-
createdAt: response.created_at,
|
|
2695
|
-
updatedAt: response.updated_at,
|
|
2696
|
-
testRequestEndpoint: response.test_request_endpoint
|
|
2697
|
-
});
|
|
2698
|
-
if (!result.success) {
|
|
2699
|
-
throw new ValidationError("Failed to parse connected account retrieve response", {
|
|
2700
|
-
cause: result.error
|
|
2701
|
-
});
|
|
2702
|
-
}
|
|
2703
|
-
return result.data;
|
|
2704
|
-
}
|
|
2705
3094
|
/**
|
|
2706
3095
|
* Lists all connected accounts based on provided filter criteria.
|
|
2707
3096
|
*
|
|
@@ -2748,7 +3137,7 @@ var ConnectedAccounts = class {
|
|
|
2748
3137
|
}
|
|
2749
3138
|
const result = await this.client.connectedAccounts.list(rawQuery);
|
|
2750
3139
|
const parsedResponse = ConnectedAccountListResponseSchema.safeParse({
|
|
2751
|
-
items: result.items.map(
|
|
3140
|
+
items: result.items.map(transformConnectedAccountResponse),
|
|
2752
3141
|
nextCursor: result.next_cursor,
|
|
2753
3142
|
totalPages: result.total_pages
|
|
2754
3143
|
});
|
|
@@ -2759,21 +3148,6 @@ var ConnectedAccounts = class {
|
|
|
2759
3148
|
}
|
|
2760
3149
|
return parsedResponse.data;
|
|
2761
3150
|
}
|
|
2762
|
-
/**
|
|
2763
|
-
* Transforms connected account data from API format to SDK format.
|
|
2764
|
-
*
|
|
2765
|
-
* This method converts property names from snake_case to camelCase and reorganizes
|
|
2766
|
-
* the data structure to match the SDK's standardized format for connected accounts.
|
|
2767
|
-
*
|
|
2768
|
-
* @param {ConnectedAccountRetrieveResponseRaw} response - The raw API response to transform
|
|
2769
|
-
* @returns {ConnectedAccountRetrieveResponse} The transformed connected account data
|
|
2770
|
-
* @throws {ValidationError} If the response fails validation against the expected schema
|
|
2771
|
-
*
|
|
2772
|
-
* @private
|
|
2773
|
-
*/
|
|
2774
|
-
transformConnectedAccountResponse(response) {
|
|
2775
|
-
return this.transformConnectedAccountRetrieveResponse(response);
|
|
2776
|
-
}
|
|
2777
3151
|
/**
|
|
2778
3152
|
* Compound function to create a new connected account.
|
|
2779
3153
|
* This function creates a new connected account and returns a connection request.
|
|
@@ -2798,12 +3172,18 @@ var ConnectedAccounts = class {
|
|
|
2798
3172
|
id: authConfigId
|
|
2799
3173
|
},
|
|
2800
3174
|
connection: {
|
|
2801
|
-
|
|
3175
|
+
state: options?.state,
|
|
2802
3176
|
callback_url: options?.callbackUrl,
|
|
2803
3177
|
user_id: userId
|
|
2804
3178
|
}
|
|
2805
3179
|
});
|
|
2806
|
-
|
|
3180
|
+
const redirectUrl = typeof response.connectionData?.val?.redirectUrl === "string" ? response.connectionData.val.redirectUrl : null;
|
|
3181
|
+
return new ConnectionRequest(
|
|
3182
|
+
this.client,
|
|
3183
|
+
response.id,
|
|
3184
|
+
response.connectionData.val.status,
|
|
3185
|
+
redirectUrl
|
|
3186
|
+
);
|
|
2807
3187
|
}
|
|
2808
3188
|
/**
|
|
2809
3189
|
* Waits for a connection request to complete and become active.
|
|
@@ -2851,7 +3231,7 @@ var ConnectedAccounts = class {
|
|
|
2851
3231
|
*/
|
|
2852
3232
|
async get(nanoid) {
|
|
2853
3233
|
const response = await this.client.connectedAccounts.retrieve(nanoid);
|
|
2854
|
-
return
|
|
3234
|
+
return transformConnectedAccountResponse(response);
|
|
2855
3235
|
}
|
|
2856
3236
|
/**
|
|
2857
3237
|
* Deletes a connected account.
|
|
@@ -2896,14 +3276,14 @@ var ConnectedAccounts = class {
|
|
|
2896
3276
|
* @param {string} nanoid - Unique identifier of the connected account
|
|
2897
3277
|
* @param {ConnectedAccountUpdateStatusParams} params - Parameters for updating the status
|
|
2898
3278
|
* @returns {Promise<ConnectedAccountUpdateStatusResponse>} Updated connected account details
|
|
2899
|
-
*
|
|
3279
|
+
*
|
|
2900
3280
|
* @example
|
|
2901
3281
|
* ```typescript
|
|
2902
3282
|
* // Enable a connected account
|
|
2903
3283
|
* const updatedAccount = await composio.connectedAccounts.updateStatus('conn_abc123', {
|
|
2904
3284
|
* enabled: true
|
|
2905
3285
|
* });
|
|
2906
|
-
*
|
|
3286
|
+
*
|
|
2907
3287
|
* // Disable a connected account with a reason
|
|
2908
3288
|
* const disabledAccount = await composio.connectedAccounts.updateStatus('conn_abc123', {
|
|
2909
3289
|
* enabled: false,
|
|
@@ -2918,7 +3298,7 @@ var ConnectedAccounts = class {
|
|
|
2918
3298
|
* Enable a connected account
|
|
2919
3299
|
* @param {string} nanoid - Unique identifier of the connected account
|
|
2920
3300
|
* @returns {Promise<ConnectedAccountUpdateStatusResponse>} Updated connected account details
|
|
2921
|
-
*
|
|
3301
|
+
*
|
|
2922
3302
|
* @example
|
|
2923
3303
|
* ```typescript
|
|
2924
3304
|
* // Enable a previously disabled connected account
|
|
@@ -2933,13 +3313,13 @@ var ConnectedAccounts = class {
|
|
|
2933
3313
|
* Disable a connected account
|
|
2934
3314
|
* @param {string} nanoid - Unique identifier of the connected account
|
|
2935
3315
|
* @returns {Promise<ConnectedAccountUpdateStatusResponse>} Updated connected account details
|
|
2936
|
-
*
|
|
3316
|
+
*
|
|
2937
3317
|
* @example
|
|
2938
3318
|
* ```typescript
|
|
2939
3319
|
* // Disable a connected account
|
|
2940
3320
|
* const disabledAccount = await composio.connectedAccounts.disable('conn_abc123');
|
|
2941
3321
|
* console.log(disabledAccount.isDisabled); // true
|
|
2942
|
-
*
|
|
3322
|
+
*
|
|
2943
3323
|
* // You can also use updateStatus with a reason
|
|
2944
3324
|
* // const disabledAccount = await composio.connectedAccounts.updateStatus('conn_abc123', {
|
|
2945
3325
|
* // enabled: false,
|
|
@@ -3607,12 +3987,12 @@ var Triggers = class {
|
|
|
3607
3987
|
/**
|
|
3608
3988
|
* Update an existing trigger instance
|
|
3609
3989
|
*
|
|
3610
|
-
* @param {string}
|
|
3611
|
-
* @param {TriggerInstanceManageUpdateParams} body - The parameters to
|
|
3612
|
-
* @returns {Promise<
|
|
3990
|
+
* @param {string} triggerId - The Id of the trigger instance
|
|
3991
|
+
* @param {TriggerInstanceManageUpdateParams} body - The parameters to update the trigger instance
|
|
3992
|
+
* @returns {Promise<TriggerInstanceManageUpdateResponse>} The updated trigger instance response
|
|
3613
3993
|
*/
|
|
3614
|
-
async update(
|
|
3615
|
-
return this.client.triggerInstances.manage.update(
|
|
3994
|
+
async update(triggerId, body) {
|
|
3995
|
+
return this.client.triggerInstances.manage.update(triggerId, body);
|
|
3616
3996
|
}
|
|
3617
3997
|
/**
|
|
3618
3998
|
* Delete a trigger instance
|
|
@@ -4334,10 +4714,10 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
4334
4714
|
};
|
|
4335
4715
|
|
|
4336
4716
|
// package.json
|
|
4337
|
-
var version = "0.1.
|
|
4717
|
+
var version = "0.1.14";
|
|
4338
4718
|
|
|
4339
4719
|
// src/composio.ts
|
|
4340
|
-
var Composio = class {
|
|
4720
|
+
var Composio = class _Composio {
|
|
4341
4721
|
/**
|
|
4342
4722
|
* The Composio API client.
|
|
4343
4723
|
* @type {ComposioClient}
|
|
@@ -4361,10 +4741,10 @@ var Composio = class {
|
|
|
4361
4741
|
connectedAccounts;
|
|
4362
4742
|
/**
|
|
4363
4743
|
* Creates a new instance of the Composio SDK.
|
|
4364
|
-
*
|
|
4744
|
+
*
|
|
4365
4745
|
* The constructor initializes the SDK with the provided configuration options,
|
|
4366
4746
|
* sets up the API client, and initializes all core models (tools, toolkits, etc.).
|
|
4367
|
-
*
|
|
4747
|
+
*
|
|
4368
4748
|
* @param {ComposioConfig<TProvider>} config - Configuration options for the Composio SDK
|
|
4369
4749
|
* @param {string} [config.apiKey] - The API key for authenticating with the Composio API
|
|
4370
4750
|
* @param {string} [config.baseURL] - The base URL for the Composio API (defaults to production URL)
|
|
@@ -4372,18 +4752,18 @@ var Composio = class {
|
|
|
4372
4752
|
* @param {boolean} [config.allowTracing=true] - Whether to allow request tracing for debugging
|
|
4373
4753
|
* @param {TProvider} [config.provider] - The provider to use for this Composio instance (defaults to OpenAIProvider)
|
|
4374
4754
|
* @param {BaseTelemetryTransport} [config.telemetryTransport] - Custom telemetry transport implementation
|
|
4375
|
-
*
|
|
4755
|
+
*
|
|
4376
4756
|
* @example
|
|
4377
4757
|
* ```typescript
|
|
4378
4758
|
* // Initialize with default configuration
|
|
4379
4759
|
* const composio = new Composio();
|
|
4380
|
-
*
|
|
4760
|
+
*
|
|
4381
4761
|
* // Initialize with custom API key and base URL
|
|
4382
4762
|
* const composio = new Composio({
|
|
4383
4763
|
* apiKey: 'your-api-key',
|
|
4384
4764
|
* baseURL: 'https://api.composio.dev'
|
|
4385
4765
|
* });
|
|
4386
|
-
*
|
|
4766
|
+
*
|
|
4387
4767
|
* // Initialize with custom provider
|
|
4388
4768
|
* const composio = new Composio({
|
|
4389
4769
|
* apiKey: 'your-api-key',
|
|
@@ -4401,7 +4781,9 @@ var Composio = class {
|
|
|
4401
4781
|
}
|
|
4402
4782
|
this.client = new import_client6.default({
|
|
4403
4783
|
apiKey: apiKeyParsed,
|
|
4404
|
-
baseURL: baseURLParsed
|
|
4784
|
+
baseURL: baseURLParsed,
|
|
4785
|
+
defaultHeaders: config?.defaultHeaders,
|
|
4786
|
+
logLevel: process.env.COMPOSIO_LOG_LEVEL ?? void 0
|
|
4405
4787
|
});
|
|
4406
4788
|
this.config = {
|
|
4407
4789
|
...config,
|
|
@@ -4447,6 +4829,46 @@ var Composio = class {
|
|
|
4447
4829
|
}
|
|
4448
4830
|
return this.client;
|
|
4449
4831
|
}
|
|
4832
|
+
/**
|
|
4833
|
+
* Creates a new instance of the Composio SDK with custom request options while preserving the existing configuration.
|
|
4834
|
+
* This method is particularly useful when you need to:
|
|
4835
|
+
* - Add custom headers for specific requests
|
|
4836
|
+
* - Track request contexts with unique identifiers
|
|
4837
|
+
* - Override default request behavior for a subset of operations
|
|
4838
|
+
*
|
|
4839
|
+
* The new instance inherits all configuration from the parent instance (apiKey, baseURL, provider, etc.)
|
|
4840
|
+
* but allows you to specify custom request options that will be used for all API calls made through this session.
|
|
4841
|
+
*
|
|
4842
|
+
* @param {MergedRequestInit} fetchOptions - Custom request options to be used for all API calls in this session.
|
|
4843
|
+
* This follows the Fetch API RequestInit interface with additional options.
|
|
4844
|
+
* @returns {Composio<TProvider>} A new Composio instance with the custom request options applied.
|
|
4845
|
+
*
|
|
4846
|
+
* @example
|
|
4847
|
+
* ```typescript
|
|
4848
|
+
* // Create a base Composio instance
|
|
4849
|
+
* const composio = new Composio({
|
|
4850
|
+
* apiKey: 'your-api-key'
|
|
4851
|
+
* });
|
|
4852
|
+
*
|
|
4853
|
+
* // Create a session with request tracking headers
|
|
4854
|
+
* const composioWithCustomHeaders = composio.createSession({
|
|
4855
|
+
* headers: {
|
|
4856
|
+
* 'x-request-id': '1234567890',
|
|
4857
|
+
* 'x-correlation-id': 'session-abc-123',
|
|
4858
|
+
* 'x-custom-header': 'custom-value'
|
|
4859
|
+
* }
|
|
4860
|
+
* });
|
|
4861
|
+
*
|
|
4862
|
+
* // Use the session for making API calls with the custom headers
|
|
4863
|
+
* await composioWithCustomHeaders.tools.list();
|
|
4864
|
+
* ```
|
|
4865
|
+
*/
|
|
4866
|
+
createSession(options) {
|
|
4867
|
+
return new _Composio({
|
|
4868
|
+
...this.config,
|
|
4869
|
+
defaultHeaders: options?.headers
|
|
4870
|
+
});
|
|
4871
|
+
}
|
|
4450
4872
|
};
|
|
4451
4873
|
|
|
4452
4874
|
// src/provider/ComposioProvider.ts
|
|
@@ -4472,112 +4894,15 @@ var ConsoleTelemetryTransport = class {
|
|
|
4472
4894
|
};
|
|
4473
4895
|
|
|
4474
4896
|
// src/utils/jsonSchema.ts
|
|
4475
|
-
var
|
|
4476
|
-
function jsonSchemaPropertiesToTSTypes(value) {
|
|
4477
|
-
if (!value.type) {
|
|
4478
|
-
return import_zod10.z.object({});
|
|
4479
|
-
}
|
|
4480
|
-
let zodType;
|
|
4481
|
-
switch (value.type) {
|
|
4482
|
-
case "string":
|
|
4483
|
-
zodType = import_zod10.z.string().describe(
|
|
4484
|
-
(value.description || "") + (value.examples ? `
|
|
4485
|
-
Examples: ${value.examples.join(", ")}` : "")
|
|
4486
|
-
);
|
|
4487
|
-
break;
|
|
4488
|
-
case "number":
|
|
4489
|
-
zodType = import_zod10.z.number().describe(
|
|
4490
|
-
(value.description || "") + (value.examples ? `
|
|
4491
|
-
Examples: ${value.examples.join(", ")}` : "")
|
|
4492
|
-
);
|
|
4493
|
-
break;
|
|
4494
|
-
case "integer":
|
|
4495
|
-
zodType = import_zod10.z.number().int().describe(
|
|
4496
|
-
(value.description || "") + (value.examples ? `
|
|
4497
|
-
Examples: ${value.examples.join(", ")}` : "")
|
|
4498
|
-
);
|
|
4499
|
-
break;
|
|
4500
|
-
case "boolean":
|
|
4501
|
-
zodType = import_zod10.z.boolean().describe(
|
|
4502
|
-
(value.description || "") + (value.examples ? `
|
|
4503
|
-
Examples: ${value.examples.join(", ")}` : "")
|
|
4504
|
-
);
|
|
4505
|
-
break;
|
|
4506
|
-
case "array":
|
|
4507
|
-
zodType = import_zod10.z.array(
|
|
4508
|
-
jsonSchemaPropertiesToTSTypes(
|
|
4509
|
-
value.items
|
|
4510
|
-
)
|
|
4511
|
-
).describe(
|
|
4512
|
-
(value.description || "") + (value.examples ? `
|
|
4513
|
-
Examples: ${value.examples.join(", ")}` : "")
|
|
4514
|
-
);
|
|
4515
|
-
break;
|
|
4516
|
-
case "object":
|
|
4517
|
-
zodType = jsonSchemaToZodSchema(value).describe(
|
|
4518
|
-
(value.description || "") + (value.examples ? `
|
|
4519
|
-
Examples: ${value.examples.join(", ")}` : "")
|
|
4520
|
-
);
|
|
4521
|
-
break;
|
|
4522
|
-
case "null":
|
|
4523
|
-
zodType = import_zod10.z.null().describe(value.description || "");
|
|
4524
|
-
break;
|
|
4525
|
-
default:
|
|
4526
|
-
throw new Error(`Unsupported JSON schema type: ${value.type}`);
|
|
4527
|
-
}
|
|
4528
|
-
return zodType;
|
|
4529
|
-
}
|
|
4897
|
+
var import_json_schema_to_zod = require("@composio/json-schema-to-zod");
|
|
4530
4898
|
function jsonSchemaToZodSchema(jsonSchema) {
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
for (const [key, _] of Object.entries(properties)) {
|
|
4538
|
-
const value = _;
|
|
4539
|
-
let zodType;
|
|
4540
|
-
if (value.anyOf) {
|
|
4541
|
-
const anyOfTypes = value.anyOf.map(
|
|
4542
|
-
(schema) => jsonSchemaPropertiesToTSTypes(
|
|
4543
|
-
schema
|
|
4544
|
-
)
|
|
4545
|
-
);
|
|
4546
|
-
zodType = import_zod10.z.union(anyOfTypes).describe(
|
|
4547
|
-
(value.description || "") + (value.examples ? `
|
|
4548
|
-
Examples: ${value.examples.join(", ")}` : "")
|
|
4549
|
-
);
|
|
4550
|
-
} else if (value.allOf) {
|
|
4551
|
-
const allOfTypes = value.allOf.map(
|
|
4552
|
-
(schema) => jsonSchemaPropertiesToTSTypes(
|
|
4553
|
-
schema
|
|
4554
|
-
)
|
|
4555
|
-
);
|
|
4556
|
-
zodType = import_zod10.z.intersection(
|
|
4557
|
-
allOfTypes[0],
|
|
4558
|
-
allOfTypes.slice(1).reduce((acc, schema) => acc.and(schema), allOfTypes[0])
|
|
4559
|
-
).describe(
|
|
4560
|
-
(value.description || "") + (value.examples ? `
|
|
4561
|
-
Examples: ${value.examples.join(", ")}` : "")
|
|
4562
|
-
);
|
|
4563
|
-
} else {
|
|
4564
|
-
if (!value.type) {
|
|
4565
|
-
value.type = "string";
|
|
4566
|
-
}
|
|
4567
|
-
zodType = jsonSchemaPropertiesToTSTypes(
|
|
4568
|
-
value
|
|
4569
|
-
);
|
|
4570
|
-
}
|
|
4571
|
-
if (value.description) {
|
|
4572
|
-
zodType = zodType.describe(value.description);
|
|
4573
|
-
}
|
|
4574
|
-
if (requiredFields.includes(key)) {
|
|
4575
|
-
zodSchema[key] = zodType;
|
|
4576
|
-
} else {
|
|
4577
|
-
zodSchema[key] = zodType.optional();
|
|
4578
|
-
}
|
|
4899
|
+
try {
|
|
4900
|
+
return (0, import_json_schema_to_zod.jsonSchemaToZod)(jsonSchema);
|
|
4901
|
+
} catch (error) {
|
|
4902
|
+
throw new JsonSchemaToZodError("Failed to convert JSON Schema to Zod Schema", {
|
|
4903
|
+
cause: error
|
|
4904
|
+
});
|
|
4579
4905
|
}
|
|
4580
|
-
return import_zod10.z.object(zodSchema);
|
|
4581
4906
|
}
|
|
4582
4907
|
// Annotate the CommonJS export names for ESM import in node:
|
|
4583
4908
|
0 && (module.exports = {
|
|
@@ -4607,6 +4932,7 @@ Examples: ${value.examples.join(", ")}` : "")
|
|
|
4607
4932
|
ConnectionRequestFailedError,
|
|
4608
4933
|
ConnectionRequestTimeoutError,
|
|
4609
4934
|
ConsoleTelemetryTransport,
|
|
4935
|
+
JsonSchemaToZodError,
|
|
4610
4936
|
OpenAIProvider,
|
|
4611
4937
|
SDKErrorCodes,
|
|
4612
4938
|
ToolErrorCodes,
|