@composio/core 0.1.12 → 0.1.13
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 +685 -273
- package/dist/index.d.cts +28138 -91
- package/dist/index.d.ts +28138 -91
- package/dist/index.js +761 -349
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -177,7 +177,7 @@ var ToolProxyParamsSchema = import_zod.z.object({
|
|
|
177
177
|
name: import_zod.z.string(),
|
|
178
178
|
value: import_zod.z.union([import_zod.z.string(), import_zod.z.number()])
|
|
179
179
|
})
|
|
180
|
-
),
|
|
180
|
+
).optional(),
|
|
181
181
|
connectedAccountId: import_zod.z.string().optional()
|
|
182
182
|
});
|
|
183
183
|
|
|
@@ -936,7 +936,411 @@ var TelemetryService = class {
|
|
|
936
936
|
var telemetry = new TelemetryService();
|
|
937
937
|
|
|
938
938
|
// src/types/connectedAccounts.types.ts
|
|
939
|
+
var import_zod4 = require("zod");
|
|
940
|
+
|
|
941
|
+
// src/types/connectedAccountAuthStates.types.ts
|
|
939
942
|
var import_zod3 = require("zod");
|
|
943
|
+
var AUTH_MODES_ENUM = {
|
|
944
|
+
OAUTH2: "OAUTH2",
|
|
945
|
+
OAUTH1: "OAUTH1",
|
|
946
|
+
API_KEY: "API_KEY",
|
|
947
|
+
BASIC: "BASIC",
|
|
948
|
+
BILLCOM_AUTH: "BILLCOM_AUTH",
|
|
949
|
+
BEARER_TOKEN: "BEARER_TOKEN",
|
|
950
|
+
GOOGLE_SERVICE_ACCOUNT: "GOOGLE_SERVICE_ACCOUNT",
|
|
951
|
+
NO_AUTH: "NO_AUTH",
|
|
952
|
+
BASIC_WITH_JWT: "BASIC_WITH_JWT",
|
|
953
|
+
COMPOSIO_LINK_AUTH: "COMPOSIO_LINK",
|
|
954
|
+
CALCOM_AUTH: "CALCOM_AUTH",
|
|
955
|
+
SNOWFLAKE: "SNOWFLAKE"
|
|
956
|
+
};
|
|
957
|
+
var RedirectableAuthSchemeSchema = import_zod3.z.enum([
|
|
958
|
+
AUTH_MODES_ENUM.OAUTH1,
|
|
959
|
+
AUTH_MODES_ENUM.OAUTH2,
|
|
960
|
+
AUTH_MODES_ENUM.COMPOSIO_LINK_AUTH
|
|
961
|
+
]);
|
|
962
|
+
var BaseSchemeRaw = import_zod3.z.object({
|
|
963
|
+
// for posthog, freshdesk, zendesk, clickup and others
|
|
964
|
+
subdomain: import_zod3.z.string().optional(),
|
|
965
|
+
// for atlassian
|
|
966
|
+
["your-domain"]: import_zod3.z.string().optional(),
|
|
967
|
+
// for mixpanel
|
|
968
|
+
region: import_zod3.z.string().optional(),
|
|
969
|
+
// for shopify
|
|
970
|
+
shop: import_zod3.z.string().optional(),
|
|
971
|
+
// for snowflake
|
|
972
|
+
account_url: import_zod3.z.string().optional(),
|
|
973
|
+
// likely pipedrive
|
|
974
|
+
COMPANYDOMAIN: import_zod3.z.string().optional(),
|
|
975
|
+
// likely zoho
|
|
976
|
+
extension: import_zod3.z.string().optional(),
|
|
977
|
+
// likely formsite
|
|
978
|
+
form_api_base_url: import_zod3.z.string().optional(),
|
|
979
|
+
// likely salesforce
|
|
980
|
+
instanceEndpoint: import_zod3.z.string().optional(),
|
|
981
|
+
// likely active campaign
|
|
982
|
+
api_url: import_zod3.z.string().optional(),
|
|
983
|
+
// for borneo
|
|
984
|
+
borneo_dashboard_url: import_zod3.z.string().optional(),
|
|
985
|
+
// for zenrows proxy
|
|
986
|
+
proxy_username: import_zod3.z.string().optional(),
|
|
987
|
+
proxy_password: import_zod3.z.string().optional(),
|
|
988
|
+
// for d2l
|
|
989
|
+
domain: import_zod3.z.string().optional(),
|
|
990
|
+
version: import_zod3.z.string().optional(),
|
|
991
|
+
// for mailchimp
|
|
992
|
+
dc: import_zod3.z.string().optional(),
|
|
993
|
+
// for sharepoint
|
|
994
|
+
site_name: import_zod3.z.string().optional(),
|
|
995
|
+
// for servicenow
|
|
996
|
+
instanceName: import_zod3.z.string().optional(),
|
|
997
|
+
// for netsuite
|
|
998
|
+
account_id: import_zod3.z.string().optional(),
|
|
999
|
+
// for custom servers
|
|
1000
|
+
your_server: import_zod3.z.string().optional(),
|
|
1001
|
+
// for ragic
|
|
1002
|
+
server_location: import_zod3.z.string().optional(),
|
|
1003
|
+
// base_url only
|
|
1004
|
+
base_url: import_zod3.z.string().optional()
|
|
1005
|
+
});
|
|
1006
|
+
var Oauth2InitiatingConnectionDataSchema = BaseSchemeRaw.extend({
|
|
1007
|
+
status: import_zod3.z.literal("INITIALIZING" /* INITIALIZING */)
|
|
1008
|
+
}).catchall(import_zod3.z.unknown());
|
|
1009
|
+
var Oauth2InitiatedConnectionDataSchema = Oauth2InitiatingConnectionDataSchema.extend({
|
|
1010
|
+
status: import_zod3.z.literal("INITIATED" /* INITIATED */),
|
|
1011
|
+
code_verifier: import_zod3.z.string().optional(),
|
|
1012
|
+
redirectUrl: import_zod3.z.string(),
|
|
1013
|
+
callback_url: import_zod3.z.string().optional(),
|
|
1014
|
+
finalRedirectUri: import_zod3.z.string().optional(),
|
|
1015
|
+
// previously verification_token, will be sent as verification_token to slack
|
|
1016
|
+
webhook_signature: import_zod3.z.string().optional()
|
|
1017
|
+
}).catchall(import_zod3.z.unknown());
|
|
1018
|
+
var Oauth2ActiveConnectionDataSchema = Oauth2InitiatingConnectionDataSchema.extend({
|
|
1019
|
+
status: import_zod3.z.literal("ACTIVE" /* ACTIVE */),
|
|
1020
|
+
access_token: import_zod3.z.string(),
|
|
1021
|
+
id_token: import_zod3.z.string().optional(),
|
|
1022
|
+
token_type: import_zod3.z.string(),
|
|
1023
|
+
refresh_token: import_zod3.z.string().optional(),
|
|
1024
|
+
expires_in: import_zod3.z.number().optional(),
|
|
1025
|
+
scope: import_zod3.z.string().optional(),
|
|
1026
|
+
// previously verification_token, will be sent as verification_token to slack
|
|
1027
|
+
webhook_signature: import_zod3.z.string().optional(),
|
|
1028
|
+
authed_user: import_zod3.z.object({
|
|
1029
|
+
access_token: import_zod3.z.string().optional(),
|
|
1030
|
+
scope: import_zod3.z.string().optional()
|
|
1031
|
+
}).optional().describe("for slack user scopes")
|
|
1032
|
+
}).catchall(import_zod3.z.unknown());
|
|
1033
|
+
var Oauth2FailedConnectionDataSchema = Oauth2InitiatingConnectionDataSchema.extend({
|
|
1034
|
+
status: import_zod3.z.literal("FAILED" /* FAILED */),
|
|
1035
|
+
error: import_zod3.z.string().optional(),
|
|
1036
|
+
error_description: import_zod3.z.string().optional()
|
|
1037
|
+
}).catchall(import_zod3.z.unknown());
|
|
1038
|
+
var Oauth2ExpiredConnectionDataSchema = Oauth2InitiatingConnectionDataSchema.extend({
|
|
1039
|
+
status: import_zod3.z.literal("EXPIRED" /* EXPIRED */),
|
|
1040
|
+
expired_at: import_zod3.z.string().optional()
|
|
1041
|
+
}).catchall(import_zod3.z.unknown());
|
|
1042
|
+
var Oauth2ConnectionDataSchema = import_zod3.z.discriminatedUnion("status", [
|
|
1043
|
+
Oauth2InitiatingConnectionDataSchema,
|
|
1044
|
+
Oauth2InitiatedConnectionDataSchema,
|
|
1045
|
+
Oauth2ActiveConnectionDataSchema,
|
|
1046
|
+
Oauth2FailedConnectionDataSchema,
|
|
1047
|
+
Oauth2ExpiredConnectionDataSchema
|
|
1048
|
+
]);
|
|
1049
|
+
var Oauth1InitiatingConnectionDataSchema = BaseSchemeRaw.extend({
|
|
1050
|
+
status: import_zod3.z.literal("INITIALIZING" /* INITIALIZING */)
|
|
1051
|
+
}).catchall(import_zod3.z.unknown());
|
|
1052
|
+
var Oauth1InitiatedConnectionDataSchema = Oauth1InitiatingConnectionDataSchema.extend({
|
|
1053
|
+
status: import_zod3.z.literal("INITIATED" /* INITIATED */),
|
|
1054
|
+
oauth_token: import_zod3.z.string(),
|
|
1055
|
+
authUri: import_zod3.z.string(),
|
|
1056
|
+
oauth_token_secret: import_zod3.z.string(),
|
|
1057
|
+
redirectUrl: import_zod3.z.string(),
|
|
1058
|
+
callbackUrl: import_zod3.z.string().optional()
|
|
1059
|
+
}).catchall(import_zod3.z.unknown());
|
|
1060
|
+
var Oauth1ActiveConnectionDataSchema = Oauth1InitiatingConnectionDataSchema.extend({
|
|
1061
|
+
status: import_zod3.z.literal("ACTIVE" /* ACTIVE */),
|
|
1062
|
+
oauth_token: import_zod3.z.string(),
|
|
1063
|
+
consumer_key: import_zod3.z.string().optional(),
|
|
1064
|
+
redirectUrl: import_zod3.z.string().optional(),
|
|
1065
|
+
callback_url: import_zod3.z.string().optional()
|
|
1066
|
+
}).catchall(import_zod3.z.unknown());
|
|
1067
|
+
var Oauth1FailedConnectionDataSchema = Oauth1InitiatingConnectionDataSchema.extend({
|
|
1068
|
+
status: import_zod3.z.literal("FAILED" /* FAILED */),
|
|
1069
|
+
error: import_zod3.z.string().optional(),
|
|
1070
|
+
error_description: import_zod3.z.string().optional()
|
|
1071
|
+
}).catchall(import_zod3.z.unknown());
|
|
1072
|
+
var Oauth1ExpiredConnectionDataSchema = Oauth1InitiatingConnectionDataSchema.extend({
|
|
1073
|
+
status: import_zod3.z.literal("EXPIRED" /* EXPIRED */),
|
|
1074
|
+
expired_at: import_zod3.z.string().optional()
|
|
1075
|
+
}).catchall(import_zod3.z.unknown());
|
|
1076
|
+
var Oauth1ConnectionDataSchema = import_zod3.z.discriminatedUnion("status", [
|
|
1077
|
+
Oauth1InitiatingConnectionDataSchema,
|
|
1078
|
+
Oauth1InitiatedConnectionDataSchema,
|
|
1079
|
+
Oauth1ActiveConnectionDataSchema,
|
|
1080
|
+
Oauth1FailedConnectionDataSchema,
|
|
1081
|
+
Oauth1ExpiredConnectionDataSchema
|
|
1082
|
+
]);
|
|
1083
|
+
var ComposioLinkInitiatingSchema = BaseSchemeRaw.extend({
|
|
1084
|
+
status: import_zod3.z.literal("INITIALIZING" /* INITIALIZING */)
|
|
1085
|
+
}).catchall(import_zod3.z.unknown());
|
|
1086
|
+
var ComposioLinkConnectionDataSchema = import_zod3.z.discriminatedUnion("status", [
|
|
1087
|
+
ComposioLinkInitiatingSchema,
|
|
1088
|
+
ComposioLinkInitiatingSchema.extend({
|
|
1089
|
+
status: import_zod3.z.literal("INITIATED" /* INITIATED */),
|
|
1090
|
+
redirectUrl: import_zod3.z.string()
|
|
1091
|
+
}).catchall(import_zod3.z.unknown()),
|
|
1092
|
+
ComposioLinkInitiatingSchema.extend({
|
|
1093
|
+
status: import_zod3.z.literal("ACTIVE" /* ACTIVE */)
|
|
1094
|
+
}).catchall(import_zod3.z.unknown()),
|
|
1095
|
+
ComposioLinkInitiatingSchema.extend({
|
|
1096
|
+
status: import_zod3.z.literal("FAILED" /* FAILED */),
|
|
1097
|
+
error: import_zod3.z.string().optional(),
|
|
1098
|
+
error_description: import_zod3.z.string().optional()
|
|
1099
|
+
}).catchall(import_zod3.z.unknown()),
|
|
1100
|
+
ComposioLinkInitiatingSchema.extend({
|
|
1101
|
+
status: import_zod3.z.literal("EXPIRED" /* EXPIRED */),
|
|
1102
|
+
expired_at: import_zod3.z.string().optional()
|
|
1103
|
+
}).catchall(import_zod3.z.unknown())
|
|
1104
|
+
]);
|
|
1105
|
+
var BillcomAuthInitiatingSchema = BaseSchemeRaw.extend({
|
|
1106
|
+
status: import_zod3.z.literal("INITIALIZING" /* INITIALIZING */)
|
|
1107
|
+
}).catchall(import_zod3.z.unknown());
|
|
1108
|
+
var BillcomAuthConnectionDataSchema = import_zod3.z.discriminatedUnion("status", [
|
|
1109
|
+
BillcomAuthInitiatingSchema,
|
|
1110
|
+
BillcomAuthInitiatingSchema.extend({
|
|
1111
|
+
status: import_zod3.z.literal("INITIATED" /* INITIATED */),
|
|
1112
|
+
redirectUrl: import_zod3.z.string()
|
|
1113
|
+
}).catchall(import_zod3.z.unknown()),
|
|
1114
|
+
BillcomAuthInitiatingSchema.extend({
|
|
1115
|
+
status: import_zod3.z.literal("ACTIVE" /* ACTIVE */),
|
|
1116
|
+
sessionId: import_zod3.z.string(),
|
|
1117
|
+
devKey: import_zod3.z.string()
|
|
1118
|
+
}).catchall(import_zod3.z.unknown()),
|
|
1119
|
+
BillcomAuthInitiatingSchema.extend({
|
|
1120
|
+
status: import_zod3.z.literal("FAILED" /* FAILED */),
|
|
1121
|
+
error: import_zod3.z.string().optional(),
|
|
1122
|
+
error_description: import_zod3.z.string().optional()
|
|
1123
|
+
}).catchall(import_zod3.z.unknown()),
|
|
1124
|
+
BillcomAuthInitiatingSchema.extend({
|
|
1125
|
+
status: import_zod3.z.literal("EXPIRED" /* EXPIRED */),
|
|
1126
|
+
expired_at: import_zod3.z.string().optional()
|
|
1127
|
+
}).catchall(import_zod3.z.unknown())
|
|
1128
|
+
]);
|
|
1129
|
+
var BasicWithJwtInitiatingSchema = BaseSchemeRaw.extend({
|
|
1130
|
+
status: import_zod3.z.literal("ACTIVE" /* ACTIVE */),
|
|
1131
|
+
username: import_zod3.z.string(),
|
|
1132
|
+
password: import_zod3.z.string()
|
|
1133
|
+
}).catchall(import_zod3.z.unknown());
|
|
1134
|
+
var BasicWithJwtConnectionDataSchema = import_zod3.z.discriminatedUnion("status", [
|
|
1135
|
+
BasicWithJwtInitiatingSchema,
|
|
1136
|
+
BasicWithJwtInitiatingSchema.extend({
|
|
1137
|
+
status: import_zod3.z.literal("FAILED" /* FAILED */),
|
|
1138
|
+
error: import_zod3.z.string().optional(),
|
|
1139
|
+
error_description: import_zod3.z.string().optional()
|
|
1140
|
+
}).catchall(import_zod3.z.unknown()),
|
|
1141
|
+
BasicWithJwtInitiatingSchema.extend({
|
|
1142
|
+
status: import_zod3.z.literal("EXPIRED" /* EXPIRED */),
|
|
1143
|
+
expired_at: import_zod3.z.string().optional()
|
|
1144
|
+
}).catchall(import_zod3.z.unknown())
|
|
1145
|
+
]);
|
|
1146
|
+
var ApiKeyInitiatingSchema = BaseSchemeRaw.extend({
|
|
1147
|
+
status: import_zod3.z.literal("ACTIVE" /* ACTIVE */),
|
|
1148
|
+
api_key: import_zod3.z.string()
|
|
1149
|
+
}).catchall(import_zod3.z.unknown());
|
|
1150
|
+
var ApiKeyConnectionDataSchema = import_zod3.z.discriminatedUnion("status", [
|
|
1151
|
+
ApiKeyInitiatingSchema,
|
|
1152
|
+
ApiKeyInitiatingSchema.extend({
|
|
1153
|
+
status: import_zod3.z.literal("FAILED" /* FAILED */),
|
|
1154
|
+
error: import_zod3.z.string().optional(),
|
|
1155
|
+
error_description: import_zod3.z.string().optional()
|
|
1156
|
+
}).catchall(import_zod3.z.unknown()),
|
|
1157
|
+
ApiKeyInitiatingSchema.extend({
|
|
1158
|
+
status: import_zod3.z.literal("EXPIRED" /* EXPIRED */),
|
|
1159
|
+
expired_at: import_zod3.z.string().optional()
|
|
1160
|
+
}).catchall(import_zod3.z.unknown())
|
|
1161
|
+
]);
|
|
1162
|
+
var BasicInitiatingSchema = BaseSchemeRaw.extend({
|
|
1163
|
+
status: import_zod3.z.literal("ACTIVE" /* ACTIVE */),
|
|
1164
|
+
username: import_zod3.z.string(),
|
|
1165
|
+
password: import_zod3.z.string()
|
|
1166
|
+
}).catchall(import_zod3.z.unknown());
|
|
1167
|
+
var BasicConnectionDataSchema = import_zod3.z.discriminatedUnion("status", [
|
|
1168
|
+
BasicInitiatingSchema,
|
|
1169
|
+
BasicInitiatingSchema.extend({
|
|
1170
|
+
status: import_zod3.z.literal("FAILED" /* FAILED */),
|
|
1171
|
+
error: import_zod3.z.string().optional(),
|
|
1172
|
+
error_description: import_zod3.z.string().optional()
|
|
1173
|
+
}).catchall(import_zod3.z.unknown()),
|
|
1174
|
+
BasicInitiatingSchema.extend({
|
|
1175
|
+
status: import_zod3.z.literal("EXPIRED" /* EXPIRED */),
|
|
1176
|
+
expired_at: import_zod3.z.string().optional()
|
|
1177
|
+
}).catchall(import_zod3.z.unknown())
|
|
1178
|
+
]);
|
|
1179
|
+
var BearerTokenInitiatingSchema = BaseSchemeRaw.extend({
|
|
1180
|
+
status: import_zod3.z.literal("ACTIVE" /* ACTIVE */),
|
|
1181
|
+
token: import_zod3.z.string()
|
|
1182
|
+
}).catchall(import_zod3.z.unknown());
|
|
1183
|
+
var BearerTokenConnectionDataSchema = import_zod3.z.discriminatedUnion("status", [
|
|
1184
|
+
BearerTokenInitiatingSchema,
|
|
1185
|
+
BearerTokenInitiatingSchema.extend({
|
|
1186
|
+
status: import_zod3.z.literal("FAILED" /* FAILED */),
|
|
1187
|
+
error: import_zod3.z.string().optional(),
|
|
1188
|
+
error_description: import_zod3.z.string().optional()
|
|
1189
|
+
}).catchall(import_zod3.z.unknown()),
|
|
1190
|
+
BearerTokenInitiatingSchema.extend({
|
|
1191
|
+
status: import_zod3.z.literal("EXPIRED" /* EXPIRED */),
|
|
1192
|
+
expired_at: import_zod3.z.string().optional()
|
|
1193
|
+
}).catchall(import_zod3.z.unknown())
|
|
1194
|
+
]);
|
|
1195
|
+
var GoogleServiceAccountInitiatingSchema = BaseSchemeRaw.extend({
|
|
1196
|
+
status: import_zod3.z.literal("ACTIVE" /* ACTIVE */),
|
|
1197
|
+
credentials_json: import_zod3.z.string()
|
|
1198
|
+
}).catchall(import_zod3.z.unknown());
|
|
1199
|
+
var GoogleServiceAccountConnectionDataSchema = import_zod3.z.discriminatedUnion("status", [
|
|
1200
|
+
GoogleServiceAccountInitiatingSchema,
|
|
1201
|
+
GoogleServiceAccountInitiatingSchema.extend({
|
|
1202
|
+
status: import_zod3.z.literal("FAILED" /* FAILED */),
|
|
1203
|
+
error: import_zod3.z.string().optional(),
|
|
1204
|
+
error_description: import_zod3.z.string().optional()
|
|
1205
|
+
}).catchall(import_zod3.z.unknown()),
|
|
1206
|
+
GoogleServiceAccountInitiatingSchema.extend({
|
|
1207
|
+
status: import_zod3.z.literal("EXPIRED" /* EXPIRED */),
|
|
1208
|
+
expired_at: import_zod3.z.string().optional()
|
|
1209
|
+
}).catchall(import_zod3.z.unknown())
|
|
1210
|
+
]);
|
|
1211
|
+
var NoAuthInitiatingSchema = BaseSchemeRaw.extend({
|
|
1212
|
+
status: import_zod3.z.literal("ACTIVE" /* ACTIVE */)
|
|
1213
|
+
}).catchall(import_zod3.z.unknown());
|
|
1214
|
+
var NoAuthConnectionDataSchema = import_zod3.z.discriminatedUnion("status", [
|
|
1215
|
+
NoAuthInitiatingSchema,
|
|
1216
|
+
NoAuthInitiatingSchema.extend({
|
|
1217
|
+
status: import_zod3.z.literal("FAILED" /* FAILED */),
|
|
1218
|
+
error: import_zod3.z.string().optional(),
|
|
1219
|
+
error_description: import_zod3.z.string().optional()
|
|
1220
|
+
}).catchall(import_zod3.z.unknown()),
|
|
1221
|
+
NoAuthInitiatingSchema.extend({
|
|
1222
|
+
status: import_zod3.z.literal("EXPIRED" /* EXPIRED */),
|
|
1223
|
+
expired_at: import_zod3.z.string().optional()
|
|
1224
|
+
}).catchall(import_zod3.z.unknown())
|
|
1225
|
+
]);
|
|
1226
|
+
var CalcomAuthInitiatingSchema = BaseSchemeRaw.extend({
|
|
1227
|
+
status: import_zod3.z.literal("ACTIVE" /* ACTIVE */)
|
|
1228
|
+
}).catchall(import_zod3.z.unknown());
|
|
1229
|
+
var CalcomAuthConnectionDataSchema = import_zod3.z.discriminatedUnion("status", [
|
|
1230
|
+
CalcomAuthInitiatingSchema,
|
|
1231
|
+
CalcomAuthInitiatingSchema.extend({
|
|
1232
|
+
status: import_zod3.z.literal("FAILED" /* FAILED */),
|
|
1233
|
+
error: import_zod3.z.string().optional(),
|
|
1234
|
+
error_description: import_zod3.z.string().optional()
|
|
1235
|
+
}).catchall(import_zod3.z.unknown()),
|
|
1236
|
+
CalcomAuthInitiatingSchema.extend({
|
|
1237
|
+
status: import_zod3.z.literal("EXPIRED" /* EXPIRED */),
|
|
1238
|
+
expired_at: import_zod3.z.string().optional()
|
|
1239
|
+
}).catchall(import_zod3.z.unknown())
|
|
1240
|
+
]);
|
|
1241
|
+
var SnowflakeInitiatingSchema = BaseSchemeRaw.extend({
|
|
1242
|
+
status: import_zod3.z.literal("ACTIVE" /* ACTIVE */)
|
|
1243
|
+
}).catchall(import_zod3.z.unknown());
|
|
1244
|
+
var SnowflakeConnectionDataSchema = import_zod3.z.discriminatedUnion("status", [
|
|
1245
|
+
SnowflakeInitiatingSchema,
|
|
1246
|
+
SnowflakeInitiatingSchema.extend({
|
|
1247
|
+
status: import_zod3.z.literal("FAILED" /* FAILED */),
|
|
1248
|
+
error: import_zod3.z.string().optional(),
|
|
1249
|
+
error_description: import_zod3.z.string().optional()
|
|
1250
|
+
}).catchall(import_zod3.z.unknown()),
|
|
1251
|
+
SnowflakeInitiatingSchema.extend({
|
|
1252
|
+
status: import_zod3.z.literal("EXPIRED" /* EXPIRED */),
|
|
1253
|
+
expired_at: import_zod3.z.string().optional()
|
|
1254
|
+
}).catchall(import_zod3.z.unknown())
|
|
1255
|
+
]);
|
|
1256
|
+
var ConnectionDataSchema = import_zod3.z.discriminatedUnion("authScheme", [
|
|
1257
|
+
import_zod3.z.object({
|
|
1258
|
+
authScheme: import_zod3.z.literal(AUTH_MODES_ENUM.OAUTH1),
|
|
1259
|
+
/**
|
|
1260
|
+
* the main connection data discriminated by auth scheme
|
|
1261
|
+
*/
|
|
1262
|
+
val: Oauth1ConnectionDataSchema
|
|
1263
|
+
}),
|
|
1264
|
+
import_zod3.z.object({
|
|
1265
|
+
authScheme: import_zod3.z.literal(AUTH_MODES_ENUM.OAUTH2),
|
|
1266
|
+
/**
|
|
1267
|
+
* the main connection data discriminated by auth scheme
|
|
1268
|
+
*/
|
|
1269
|
+
val: Oauth2ConnectionDataSchema
|
|
1270
|
+
}),
|
|
1271
|
+
import_zod3.z.object({
|
|
1272
|
+
authScheme: import_zod3.z.literal(AUTH_MODES_ENUM.COMPOSIO_LINK_AUTH),
|
|
1273
|
+
/**
|
|
1274
|
+
* the main connection data discriminated by auth scheme
|
|
1275
|
+
*/
|
|
1276
|
+
val: ComposioLinkConnectionDataSchema
|
|
1277
|
+
}),
|
|
1278
|
+
import_zod3.z.object({
|
|
1279
|
+
authScheme: import_zod3.z.literal(AUTH_MODES_ENUM.API_KEY),
|
|
1280
|
+
/**
|
|
1281
|
+
* the main connection data discriminated by auth scheme
|
|
1282
|
+
*/
|
|
1283
|
+
val: ApiKeyConnectionDataSchema
|
|
1284
|
+
}),
|
|
1285
|
+
import_zod3.z.object({
|
|
1286
|
+
authScheme: import_zod3.z.literal(AUTH_MODES_ENUM.BASIC),
|
|
1287
|
+
/**
|
|
1288
|
+
* the main connection data discriminated by auth scheme
|
|
1289
|
+
*/
|
|
1290
|
+
val: BasicConnectionDataSchema
|
|
1291
|
+
}),
|
|
1292
|
+
import_zod3.z.object({
|
|
1293
|
+
authScheme: import_zod3.z.literal(AUTH_MODES_ENUM.BEARER_TOKEN),
|
|
1294
|
+
/**
|
|
1295
|
+
* the main connection data discriminated by auth scheme
|
|
1296
|
+
*/
|
|
1297
|
+
val: BearerTokenConnectionDataSchema
|
|
1298
|
+
}),
|
|
1299
|
+
import_zod3.z.object({
|
|
1300
|
+
authScheme: import_zod3.z.literal(AUTH_MODES_ENUM.GOOGLE_SERVICE_ACCOUNT),
|
|
1301
|
+
/**
|
|
1302
|
+
* the main connection data discriminated by auth scheme
|
|
1303
|
+
*/
|
|
1304
|
+
val: GoogleServiceAccountConnectionDataSchema
|
|
1305
|
+
}),
|
|
1306
|
+
import_zod3.z.object({
|
|
1307
|
+
authScheme: import_zod3.z.literal(AUTH_MODES_ENUM.NO_AUTH),
|
|
1308
|
+
/**
|
|
1309
|
+
* the main connection data discriminated by auth scheme
|
|
1310
|
+
*/
|
|
1311
|
+
val: NoAuthConnectionDataSchema
|
|
1312
|
+
}),
|
|
1313
|
+
import_zod3.z.object({
|
|
1314
|
+
authScheme: import_zod3.z.literal(AUTH_MODES_ENUM.CALCOM_AUTH),
|
|
1315
|
+
/**
|
|
1316
|
+
* the main connection data discriminated by auth scheme
|
|
1317
|
+
*/
|
|
1318
|
+
val: CalcomAuthConnectionDataSchema
|
|
1319
|
+
}),
|
|
1320
|
+
import_zod3.z.object({
|
|
1321
|
+
authScheme: import_zod3.z.literal(AUTH_MODES_ENUM.SNOWFLAKE),
|
|
1322
|
+
/**
|
|
1323
|
+
* the main connection data discriminated by auth scheme
|
|
1324
|
+
*/
|
|
1325
|
+
val: SnowflakeConnectionDataSchema
|
|
1326
|
+
}),
|
|
1327
|
+
import_zod3.z.object({
|
|
1328
|
+
authScheme: import_zod3.z.literal(AUTH_MODES_ENUM.BILLCOM_AUTH),
|
|
1329
|
+
/**
|
|
1330
|
+
* the main connection data discriminated by auth scheme
|
|
1331
|
+
*/
|
|
1332
|
+
val: BillcomAuthConnectionDataSchema
|
|
1333
|
+
}),
|
|
1334
|
+
import_zod3.z.object({
|
|
1335
|
+
authScheme: import_zod3.z.literal(AUTH_MODES_ENUM.BASIC_WITH_JWT),
|
|
1336
|
+
/**
|
|
1337
|
+
* the main connection data discriminated by auth scheme
|
|
1338
|
+
*/
|
|
1339
|
+
val: BasicWithJwtConnectionDataSchema
|
|
1340
|
+
})
|
|
1341
|
+
]);
|
|
1342
|
+
|
|
1343
|
+
// src/types/connectedAccounts.types.ts
|
|
940
1344
|
var ConnectedAccountStatuses = {
|
|
941
1345
|
INITIALIZING: "INITIALIZING",
|
|
942
1346
|
INITIATED: "INITIATED",
|
|
@@ -944,41 +1348,42 @@ var ConnectedAccountStatuses = {
|
|
|
944
1348
|
FAILED: "FAILED",
|
|
945
1349
|
EXPIRED: "EXPIRED"
|
|
946
1350
|
};
|
|
947
|
-
var ConnectedAccountStatusSchema =
|
|
1351
|
+
var ConnectedAccountStatusSchema = import_zod4.z.enum([
|
|
948
1352
|
ConnectedAccountStatuses.INITIALIZING,
|
|
949
1353
|
ConnectedAccountStatuses.INITIATED,
|
|
950
1354
|
ConnectedAccountStatuses.ACTIVE,
|
|
951
1355
|
ConnectedAccountStatuses.FAILED,
|
|
952
1356
|
ConnectedAccountStatuses.EXPIRED
|
|
953
1357
|
]);
|
|
954
|
-
var CreateConnectedAccountParamsSchema =
|
|
955
|
-
authConfig:
|
|
956
|
-
id:
|
|
1358
|
+
var CreateConnectedAccountParamsSchema = import_zod4.z.object({
|
|
1359
|
+
authConfig: import_zod4.z.object({
|
|
1360
|
+
id: import_zod4.z.string()
|
|
957
1361
|
}),
|
|
958
|
-
connection:
|
|
959
|
-
data:
|
|
960
|
-
callbackUrl:
|
|
961
|
-
userId:
|
|
1362
|
+
connection: import_zod4.z.object({
|
|
1363
|
+
data: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()).optional(),
|
|
1364
|
+
callbackUrl: import_zod4.z.string().optional(),
|
|
1365
|
+
userId: import_zod4.z.string().optional()
|
|
962
1366
|
})
|
|
963
1367
|
});
|
|
964
|
-
var DefaultCreateConnectedAccountParamsSchema =
|
|
965
|
-
auth_config:
|
|
966
|
-
id:
|
|
1368
|
+
var DefaultCreateConnectedAccountParamsSchema = import_zod4.z.object({
|
|
1369
|
+
auth_config: import_zod4.z.object({
|
|
1370
|
+
id: import_zod4.z.string()
|
|
967
1371
|
}),
|
|
968
|
-
connection:
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
1372
|
+
connection: import_zod4.z.object({
|
|
1373
|
+
state: ConnectionDataSchema.optional(),
|
|
1374
|
+
data: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()).optional(),
|
|
1375
|
+
callback_url: import_zod4.z.string().optional(),
|
|
1376
|
+
user_id: import_zod4.z.string().optional()
|
|
972
1377
|
})
|
|
973
1378
|
});
|
|
974
|
-
var CreateConnectedAccountOptionsSchema =
|
|
975
|
-
callbackUrl:
|
|
976
|
-
|
|
1379
|
+
var CreateConnectedAccountOptionsSchema = import_zod4.z.object({
|
|
1380
|
+
callbackUrl: import_zod4.z.string().optional(),
|
|
1381
|
+
state: ConnectionDataSchema.optional()
|
|
977
1382
|
});
|
|
978
|
-
var CreateConnectedAccountResponseSchema =
|
|
979
|
-
id:
|
|
1383
|
+
var CreateConnectedAccountResponseSchema = import_zod4.z.object({
|
|
1384
|
+
id: import_zod4.z.string(),
|
|
980
1385
|
status: ConnectedAccountStatusSchema,
|
|
981
|
-
redirectUrl:
|
|
1386
|
+
redirectUrl: import_zod4.z.string().nullable()
|
|
982
1387
|
});
|
|
983
1388
|
var ConnectedAccountAuthSchemes = {
|
|
984
1389
|
OAUTH2: "OAUTH2",
|
|
@@ -995,7 +1400,7 @@ var ConnectedAccountAuthSchemes = {
|
|
|
995
1400
|
CALCOM_AUTH: "CALCOM_AUTH",
|
|
996
1401
|
SNOWFLAKE: "SNOWFLAKE"
|
|
997
1402
|
};
|
|
998
|
-
var ConnectedAccountAuthSchemesSchema =
|
|
1403
|
+
var ConnectedAccountAuthSchemesSchema = import_zod4.z.enum([
|
|
999
1404
|
ConnectedAccountAuthSchemes.OAUTH2,
|
|
1000
1405
|
ConnectedAccountAuthSchemes.OAUTH1,
|
|
1001
1406
|
ConnectedAccountAuthSchemes.OAUTH1A,
|
|
@@ -1010,42 +1415,41 @@ var ConnectedAccountAuthSchemesSchema = import_zod3.z.enum([
|
|
|
1010
1415
|
ConnectedAccountAuthSchemes.CALCOM_AUTH,
|
|
1011
1416
|
ConnectedAccountAuthSchemes.SNOWFLAKE
|
|
1012
1417
|
]);
|
|
1013
|
-
var ConnectedAccountAuthConfigSchema =
|
|
1014
|
-
id:
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
isDisabled: import_zod3.z.boolean()
|
|
1418
|
+
var ConnectedAccountAuthConfigSchema = import_zod4.z.object({
|
|
1419
|
+
id: import_zod4.z.string(),
|
|
1420
|
+
isComposioManaged: import_zod4.z.boolean(),
|
|
1421
|
+
isDisabled: import_zod4.z.boolean()
|
|
1018
1422
|
});
|
|
1019
|
-
var ConnectedAccountRetrieveResponseSchema =
|
|
1020
|
-
id:
|
|
1423
|
+
var ConnectedAccountRetrieveResponseSchema = import_zod4.z.object({
|
|
1424
|
+
id: import_zod4.z.string(),
|
|
1021
1425
|
authConfig: ConnectedAccountAuthConfigSchema,
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
params: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()).optional(),
|
|
1426
|
+
data: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()),
|
|
1427
|
+
params: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()).optional(),
|
|
1025
1428
|
status: ConnectedAccountStatusSchema,
|
|
1026
|
-
statusReason:
|
|
1027
|
-
toolkit:
|
|
1028
|
-
slug:
|
|
1429
|
+
statusReason: import_zod4.z.string().nullable(),
|
|
1430
|
+
toolkit: import_zod4.z.object({
|
|
1431
|
+
slug: import_zod4.z.string()
|
|
1029
1432
|
}),
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1433
|
+
state: ConnectionDataSchema.optional(),
|
|
1434
|
+
testRequestEndpoint: import_zod4.z.string().optional(),
|
|
1435
|
+
isDisabled: import_zod4.z.boolean(),
|
|
1436
|
+
createdAt: import_zod4.z.string(),
|
|
1437
|
+
updatedAt: import_zod4.z.string()
|
|
1034
1438
|
});
|
|
1035
|
-
var ConnectedAccountListParamsSchema =
|
|
1036
|
-
authConfigIds:
|
|
1037
|
-
cursor:
|
|
1038
|
-
labels:
|
|
1039
|
-
limit:
|
|
1040
|
-
orderBy:
|
|
1041
|
-
statuses:
|
|
1042
|
-
toolkitSlugs:
|
|
1043
|
-
userIds:
|
|
1439
|
+
var ConnectedAccountListParamsSchema = import_zod4.z.object({
|
|
1440
|
+
authConfigIds: import_zod4.z.array(import_zod4.z.string()).nullable().optional().describe("The auth config ids of the connected accounts"),
|
|
1441
|
+
cursor: import_zod4.z.number().nullable().optional().describe("The cursor to paginate through the connected accounts"),
|
|
1442
|
+
labels: import_zod4.z.array(import_zod4.z.string()).nullable().optional().describe("The labels of the connected accounts"),
|
|
1443
|
+
limit: import_zod4.z.number().nullable().optional().describe("The limit of the connected accounts to return"),
|
|
1444
|
+
orderBy: import_zod4.z.enum(["created_at", "updated_at"]).optional().describe("The order by of the connected accounts"),
|
|
1445
|
+
statuses: import_zod4.z.array(ConnectedAccountStatusSchema).nullable().optional().describe("The statuses of the connected accounts"),
|
|
1446
|
+
toolkitSlugs: import_zod4.z.array(import_zod4.z.string()).nullable().optional().describe("The toolkit slugs of the connected accounts"),
|
|
1447
|
+
userIds: import_zod4.z.array(import_zod4.z.string()).nullable().optional().describe("The user ids of the connected accounts")
|
|
1044
1448
|
});
|
|
1045
|
-
var ConnectedAccountListResponseSchema =
|
|
1046
|
-
items:
|
|
1047
|
-
nextCursor:
|
|
1048
|
-
totalPages:
|
|
1449
|
+
var ConnectedAccountListResponseSchema = import_zod4.z.object({
|
|
1450
|
+
items: import_zod4.z.array(ConnectedAccountRetrieveResponseSchema).describe("The list of connected accounts"),
|
|
1451
|
+
nextCursor: import_zod4.z.string().nullable().describe("The next cursor to paginate through the connected accounts"),
|
|
1452
|
+
totalPages: import_zod4.z.number().describe("The total number of pages of connected accounts")
|
|
1049
1453
|
});
|
|
1050
1454
|
|
|
1051
1455
|
// src/errors/AuthConfigErrors.ts
|
|
@@ -1123,7 +1527,7 @@ var ComposioToolkitFetchError = class extends ComposioError {
|
|
|
1123
1527
|
};
|
|
1124
1528
|
|
|
1125
1529
|
// src/errors/ValidationErrors.ts
|
|
1126
|
-
var
|
|
1530
|
+
var import_zod5 = require("zod");
|
|
1127
1531
|
var ValidationErrorCodes = {
|
|
1128
1532
|
VALIDATION_ERROR: "VALIDATION_ERROR"
|
|
1129
1533
|
};
|
|
@@ -1131,10 +1535,10 @@ var ValidationError = class extends ComposioError {
|
|
|
1131
1535
|
constructor(message = "Input validation failed", options = {}) {
|
|
1132
1536
|
const { cause: providedZodError, ...restOptions } = options;
|
|
1133
1537
|
let zodErrorInstance;
|
|
1134
|
-
if (providedZodError instanceof
|
|
1538
|
+
if (providedZodError instanceof import_zod5.ZodError) {
|
|
1135
1539
|
zodErrorInstance = providedZodError;
|
|
1136
1540
|
} else {
|
|
1137
|
-
zodErrorInstance = new
|
|
1541
|
+
zodErrorInstance = new import_zod5.ZodError([
|
|
1138
1542
|
{
|
|
1139
1543
|
path: [],
|
|
1140
1544
|
message: "Invalid input",
|
|
@@ -1156,7 +1560,7 @@ var ValidationError = class extends ComposioError {
|
|
|
1156
1560
|
this.message = `${message}: ${userFriendlyMessage}`;
|
|
1157
1561
|
}
|
|
1158
1562
|
generateUserFriendlyMessage() {
|
|
1159
|
-
if (this.cause instanceof
|
|
1563
|
+
if (this.cause instanceof import_zod5.ZodError && this.cause.issues.length > 0) {
|
|
1160
1564
|
const issue = this.cause.issues[0];
|
|
1161
1565
|
const path = issue.path.join(".");
|
|
1162
1566
|
const param = path || "parameter";
|
|
@@ -1814,7 +2218,7 @@ var Tools = class {
|
|
|
1814
2218
|
connected_account_id: body.connectedAccountId,
|
|
1815
2219
|
custom_auth_params: body.customAuthParams,
|
|
1816
2220
|
arguments: body.arguments,
|
|
1817
|
-
|
|
2221
|
+
user_id: body.userId,
|
|
1818
2222
|
version: body.version,
|
|
1819
2223
|
text: body.text
|
|
1820
2224
|
});
|
|
@@ -2036,87 +2440,87 @@ var Tools = class {
|
|
|
2036
2440
|
var import_client4 = __toESM(require("@composio/client"), 1);
|
|
2037
2441
|
|
|
2038
2442
|
// src/types/toolkit.types.ts
|
|
2039
|
-
var
|
|
2040
|
-
var ToolkitMangedByEnumSchema =
|
|
2041
|
-
var ToolkitSortByEnumSchema =
|
|
2042
|
-
var ToolkitsListParamsSchema =
|
|
2043
|
-
category:
|
|
2044
|
-
isLocal:
|
|
2443
|
+
var import_zod6 = require("zod");
|
|
2444
|
+
var ToolkitMangedByEnumSchema = import_zod6.z.enum(["all", "composio", "project"]);
|
|
2445
|
+
var ToolkitSortByEnumSchema = import_zod6.z.enum(["usage", "alphabetically"]);
|
|
2446
|
+
var ToolkitsListParamsSchema = import_zod6.z.object({
|
|
2447
|
+
category: import_zod6.z.string().optional(),
|
|
2448
|
+
isLocal: import_zod6.z.boolean().optional(),
|
|
2045
2449
|
managedBy: ToolkitMangedByEnumSchema.optional(),
|
|
2046
2450
|
sortBy: ToolkitSortByEnumSchema.optional()
|
|
2047
2451
|
});
|
|
2048
|
-
var ToolKitMetaSchema =
|
|
2049
|
-
categories:
|
|
2050
|
-
|
|
2051
|
-
slug:
|
|
2052
|
-
name:
|
|
2452
|
+
var ToolKitMetaSchema = import_zod6.z.object({
|
|
2453
|
+
categories: import_zod6.z.array(
|
|
2454
|
+
import_zod6.z.object({
|
|
2455
|
+
slug: import_zod6.z.string(),
|
|
2456
|
+
name: import_zod6.z.string()
|
|
2053
2457
|
})
|
|
2054
2458
|
).optional(),
|
|
2055
|
-
appUrl:
|
|
2056
|
-
createdAt:
|
|
2057
|
-
description:
|
|
2058
|
-
logo:
|
|
2059
|
-
toolsCount:
|
|
2060
|
-
triggersCount:
|
|
2061
|
-
updatedAt:
|
|
2459
|
+
appUrl: import_zod6.z.string().optional(),
|
|
2460
|
+
createdAt: import_zod6.z.string().optional(),
|
|
2461
|
+
description: import_zod6.z.string().optional(),
|
|
2462
|
+
logo: import_zod6.z.string().optional(),
|
|
2463
|
+
toolsCount: import_zod6.z.number().optional(),
|
|
2464
|
+
triggersCount: import_zod6.z.number().optional(),
|
|
2465
|
+
updatedAt: import_zod6.z.string().optional()
|
|
2062
2466
|
});
|
|
2063
|
-
var ToolKitItemSchema =
|
|
2064
|
-
name:
|
|
2065
|
-
slug:
|
|
2467
|
+
var ToolKitItemSchema = import_zod6.z.object({
|
|
2468
|
+
name: import_zod6.z.string(),
|
|
2469
|
+
slug: import_zod6.z.string(),
|
|
2066
2470
|
meta: ToolKitMetaSchema,
|
|
2067
|
-
isLocalToolkit:
|
|
2068
|
-
authSchemes:
|
|
2069
|
-
composioManagedAuthSchemes:
|
|
2070
|
-
noAuth:
|
|
2471
|
+
isLocalToolkit: import_zod6.z.boolean(),
|
|
2472
|
+
authSchemes: import_zod6.z.array(import_zod6.z.string()).optional(),
|
|
2473
|
+
composioManagedAuthSchemes: import_zod6.z.array(import_zod6.z.string()).optional(),
|
|
2474
|
+
noAuth: import_zod6.z.boolean().optional()
|
|
2071
2475
|
});
|
|
2072
|
-
var ToolKitListResponseSchema =
|
|
2073
|
-
items:
|
|
2074
|
-
nextCursor:
|
|
2075
|
-
totalPages:
|
|
2476
|
+
var ToolKitListResponseSchema = import_zod6.z.object({
|
|
2477
|
+
items: import_zod6.z.array(ToolKitItemSchema),
|
|
2478
|
+
nextCursor: import_zod6.z.string().nullable(),
|
|
2479
|
+
totalPages: import_zod6.z.number()
|
|
2076
2480
|
});
|
|
2077
|
-
var ToolkitAuthFieldSchema =
|
|
2078
|
-
name:
|
|
2079
|
-
displayName:
|
|
2080
|
-
type:
|
|
2081
|
-
default:
|
|
2481
|
+
var ToolkitAuthFieldSchema = import_zod6.z.object({
|
|
2482
|
+
name: import_zod6.z.string(),
|
|
2483
|
+
displayName: import_zod6.z.string(),
|
|
2484
|
+
type: import_zod6.z.string(),
|
|
2485
|
+
default: import_zod6.z.string().nullable().optional()
|
|
2082
2486
|
});
|
|
2083
|
-
var ToolkitAuthConfigDetailsSchema =
|
|
2084
|
-
name:
|
|
2085
|
-
mode:
|
|
2086
|
-
fields:
|
|
2087
|
-
authConfigCreation:
|
|
2088
|
-
optional:
|
|
2089
|
-
required:
|
|
2487
|
+
var ToolkitAuthConfigDetailsSchema = import_zod6.z.object({
|
|
2488
|
+
name: import_zod6.z.string(),
|
|
2489
|
+
mode: import_zod6.z.string(),
|
|
2490
|
+
fields: import_zod6.z.object({
|
|
2491
|
+
authConfigCreation: import_zod6.z.object({
|
|
2492
|
+
optional: import_zod6.z.array(ToolkitAuthFieldSchema),
|
|
2493
|
+
required: import_zod6.z.array(ToolkitAuthFieldSchema)
|
|
2090
2494
|
}),
|
|
2091
|
-
connectedAccountInitiation:
|
|
2092
|
-
optional:
|
|
2093
|
-
required:
|
|
2495
|
+
connectedAccountInitiation: import_zod6.z.object({
|
|
2496
|
+
optional: import_zod6.z.array(ToolkitAuthFieldSchema),
|
|
2497
|
+
required: import_zod6.z.array(ToolkitAuthFieldSchema)
|
|
2094
2498
|
})
|
|
2095
2499
|
}),
|
|
2096
|
-
proxy:
|
|
2097
|
-
baseUrl:
|
|
2500
|
+
proxy: import_zod6.z.object({
|
|
2501
|
+
baseUrl: import_zod6.z.string().optional()
|
|
2098
2502
|
}).optional()
|
|
2099
2503
|
});
|
|
2100
|
-
var ToolkitRetrieveResponseSchema =
|
|
2101
|
-
name:
|
|
2102
|
-
slug:
|
|
2504
|
+
var ToolkitRetrieveResponseSchema = import_zod6.z.object({
|
|
2505
|
+
name: import_zod6.z.string(),
|
|
2506
|
+
slug: import_zod6.z.string(),
|
|
2103
2507
|
meta: ToolKitMetaSchema,
|
|
2104
|
-
isLocalToolkit:
|
|
2105
|
-
composioManagedAuthSchemes:
|
|
2106
|
-
authConfigDetails:
|
|
2508
|
+
isLocalToolkit: import_zod6.z.boolean(),
|
|
2509
|
+
composioManagedAuthSchemes: import_zod6.z.array(import_zod6.z.string()).optional(),
|
|
2510
|
+
authConfigDetails: import_zod6.z.array(ToolkitAuthConfigDetailsSchema).optional()
|
|
2107
2511
|
});
|
|
2108
|
-
var ToolkitCategorySchema =
|
|
2109
|
-
id:
|
|
2110
|
-
name:
|
|
2512
|
+
var ToolkitCategorySchema = import_zod6.z.object({
|
|
2513
|
+
id: import_zod6.z.string(),
|
|
2514
|
+
name: import_zod6.z.string()
|
|
2111
2515
|
});
|
|
2112
|
-
var ToolkitRetrieveCategoriesResponseSchema =
|
|
2113
|
-
items:
|
|
2114
|
-
nextCursor:
|
|
2115
|
-
totalPages:
|
|
2516
|
+
var ToolkitRetrieveCategoriesResponseSchema = import_zod6.z.object({
|
|
2517
|
+
items: import_zod6.z.array(ToolkitCategorySchema),
|
|
2518
|
+
nextCursor: import_zod6.z.string().nullable(),
|
|
2519
|
+
totalPages: import_zod6.z.number()
|
|
2116
2520
|
});
|
|
2117
2521
|
|
|
2118
2522
|
// src/types/authConfigs.types.ts
|
|
2119
|
-
var
|
|
2523
|
+
var import_zod7 = require("zod");
|
|
2120
2524
|
var AuthConfigTypes = {
|
|
2121
2525
|
CUSTOM: "use_custom_auth",
|
|
2122
2526
|
COMPOSIO_MANAGED: "use_composio_managed_auth"
|
|
@@ -2136,10 +2540,9 @@ var AuthSchemeTypes = {
|
|
|
2136
2540
|
CALCOM_AUTH: "CALCOM_AUTH",
|
|
2137
2541
|
SNOWFLAKE: "SNOWFLAKE"
|
|
2138
2542
|
};
|
|
2139
|
-
var AuthSchemeEnum =
|
|
2543
|
+
var AuthSchemeEnum = import_zod7.z.enum([
|
|
2140
2544
|
"OAUTH2",
|
|
2141
2545
|
"OAUTH1",
|
|
2142
|
-
"OAUTH1A",
|
|
2143
2546
|
"API_KEY",
|
|
2144
2547
|
"BASIC",
|
|
2145
2548
|
"BILLCOM_AUTH",
|
|
@@ -2151,67 +2554,69 @@ var AuthSchemeEnum = import_zod6.z.enum([
|
|
|
2151
2554
|
"CALCOM_AUTH",
|
|
2152
2555
|
"SNOWFLAKE"
|
|
2153
2556
|
]);
|
|
2154
|
-
var CreateCustomAuthConfigParamsSchema =
|
|
2155
|
-
type:
|
|
2156
|
-
name:
|
|
2157
|
-
credentials:
|
|
2158
|
-
authScheme: AuthSchemeEnum
|
|
2557
|
+
var CreateCustomAuthConfigParamsSchema = import_zod7.z.object({
|
|
2558
|
+
type: import_zod7.z.literal("use_custom_auth"),
|
|
2559
|
+
name: import_zod7.z.string().optional(),
|
|
2560
|
+
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()])),
|
|
2561
|
+
authScheme: AuthSchemeEnum,
|
|
2562
|
+
restrictToFollowingTools: import_zod7.z.array(import_zod7.z.string()).optional()
|
|
2159
2563
|
});
|
|
2160
|
-
var CreateComposioManagedAuthConfigParamsSchema =
|
|
2161
|
-
type:
|
|
2162
|
-
name:
|
|
2163
|
-
credentials:
|
|
2564
|
+
var CreateComposioManagedAuthConfigParamsSchema = import_zod7.z.object({
|
|
2565
|
+
type: import_zod7.z.literal("use_composio_managed_auth"),
|
|
2566
|
+
name: import_zod7.z.string().optional(),
|
|
2567
|
+
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(),
|
|
2568
|
+
restrictToFollowingTools: import_zod7.z.array(import_zod7.z.string()).optional()
|
|
2164
2569
|
});
|
|
2165
|
-
var CreateAuthConfigParamsSchema =
|
|
2570
|
+
var CreateAuthConfigParamsSchema = import_zod7.z.discriminatedUnion("type", [
|
|
2166
2571
|
CreateCustomAuthConfigParamsSchema,
|
|
2167
2572
|
CreateComposioManagedAuthConfigParamsSchema
|
|
2168
2573
|
]);
|
|
2169
|
-
var CreateAuthConfigResponseSchema =
|
|
2170
|
-
id:
|
|
2171
|
-
authScheme:
|
|
2172
|
-
isComposioManaged:
|
|
2173
|
-
toolkit:
|
|
2574
|
+
var CreateAuthConfigResponseSchema = import_zod7.z.object({
|
|
2575
|
+
id: import_zod7.z.string(),
|
|
2576
|
+
authScheme: import_zod7.z.string(),
|
|
2577
|
+
isComposioManaged: import_zod7.z.boolean(),
|
|
2578
|
+
toolkit: import_zod7.z.string()
|
|
2174
2579
|
});
|
|
2175
|
-
var AuthConfigRetrieveResponseSchema =
|
|
2176
|
-
id:
|
|
2177
|
-
name:
|
|
2178
|
-
toolkit:
|
|
2179
|
-
logo:
|
|
2180
|
-
slug:
|
|
2580
|
+
var AuthConfigRetrieveResponseSchema = import_zod7.z.object({
|
|
2581
|
+
id: import_zod7.z.string(),
|
|
2582
|
+
name: import_zod7.z.string(),
|
|
2583
|
+
toolkit: import_zod7.z.object({
|
|
2584
|
+
logo: import_zod7.z.string(),
|
|
2585
|
+
slug: import_zod7.z.string()
|
|
2181
2586
|
}),
|
|
2182
|
-
noOfConnections:
|
|
2183
|
-
status:
|
|
2184
|
-
uuid:
|
|
2587
|
+
noOfConnections: import_zod7.z.number(),
|
|
2588
|
+
status: import_zod7.z.enum(["ENABLED", "DISABLED"]),
|
|
2589
|
+
uuid: import_zod7.z.string(),
|
|
2185
2590
|
authScheme: AuthSchemeEnum.optional(),
|
|
2186
|
-
credentials:
|
|
2187
|
-
expectedInputFields:
|
|
2188
|
-
isComposioManaged:
|
|
2189
|
-
createdBy:
|
|
2190
|
-
createdAt:
|
|
2191
|
-
lastUpdatedAt:
|
|
2591
|
+
credentials: import_zod7.z.record(import_zod7.z.string(), import_zod7.z.unknown()).optional(),
|
|
2592
|
+
expectedInputFields: import_zod7.z.array(import_zod7.z.unknown()).optional(),
|
|
2593
|
+
isComposioManaged: import_zod7.z.boolean().optional(),
|
|
2594
|
+
createdBy: import_zod7.z.string().optional(),
|
|
2595
|
+
createdAt: import_zod7.z.string().optional(),
|
|
2596
|
+
lastUpdatedAt: import_zod7.z.string().optional()
|
|
2192
2597
|
});
|
|
2193
|
-
var AuthConfigListParamsSchema =
|
|
2194
|
-
cursor:
|
|
2195
|
-
isComposioManaged:
|
|
2196
|
-
limit:
|
|
2197
|
-
toolkit:
|
|
2598
|
+
var AuthConfigListParamsSchema = import_zod7.z.object({
|
|
2599
|
+
cursor: import_zod7.z.string().optional(),
|
|
2600
|
+
isComposioManaged: import_zod7.z.boolean().optional(),
|
|
2601
|
+
limit: import_zod7.z.number().optional(),
|
|
2602
|
+
toolkit: import_zod7.z.string().optional()
|
|
2198
2603
|
});
|
|
2199
|
-
var AuthConfigListResponseSchema =
|
|
2200
|
-
items:
|
|
2201
|
-
nextCursor:
|
|
2202
|
-
totalPages:
|
|
2604
|
+
var AuthConfigListResponseSchema = import_zod7.z.object({
|
|
2605
|
+
items: import_zod7.z.array(AuthConfigRetrieveResponseSchema),
|
|
2606
|
+
nextCursor: import_zod7.z.string().nullable(),
|
|
2607
|
+
totalPages: import_zod7.z.number()
|
|
2203
2608
|
});
|
|
2204
|
-
var AuthCustomConfigUpdateParamsSchema =
|
|
2205
|
-
credentials:
|
|
2206
|
-
type:
|
|
2207
|
-
restrictToFollowingTools:
|
|
2609
|
+
var AuthCustomConfigUpdateParamsSchema = import_zod7.z.object({
|
|
2610
|
+
credentials: import_zod7.z.record(import_zod7.z.string(), import_zod7.z.union([import_zod7.z.string(), import_zod7.z.unknown()])),
|
|
2611
|
+
type: import_zod7.z.literal("custom"),
|
|
2612
|
+
restrictToFollowingTools: import_zod7.z.array(import_zod7.z.string()).optional()
|
|
2208
2613
|
});
|
|
2209
|
-
var AuthDefaultConfigUpdateParamsSchema =
|
|
2210
|
-
scopes:
|
|
2211
|
-
type:
|
|
2212
|
-
restrictToFollowingTools:
|
|
2614
|
+
var AuthDefaultConfigUpdateParamsSchema = import_zod7.z.object({
|
|
2615
|
+
scopes: import_zod7.z.string(),
|
|
2616
|
+
type: import_zod7.z.literal("default"),
|
|
2617
|
+
restrictToFollowingTools: import_zod7.z.array(import_zod7.z.string()).optional()
|
|
2213
2618
|
});
|
|
2214
|
-
var AuthConfigUpdateParamsSchema =
|
|
2619
|
+
var AuthConfigUpdateParamsSchema = import_zod7.z.discriminatedUnion("type", [
|
|
2215
2620
|
AuthCustomConfigUpdateParamsSchema,
|
|
2216
2621
|
AuthDefaultConfigUpdateParamsSchema
|
|
2217
2622
|
]);
|
|
@@ -2344,7 +2749,18 @@ var AuthConfigs = class {
|
|
|
2344
2749
|
toolkit: {
|
|
2345
2750
|
slug: toolkit
|
|
2346
2751
|
},
|
|
2347
|
-
auth_config: parsedOptions.data
|
|
2752
|
+
auth_config: parsedOptions.data.type === "use_custom_auth" ? {
|
|
2753
|
+
type: parsedOptions.data.type,
|
|
2754
|
+
name: parsedOptions.data.name,
|
|
2755
|
+
authScheme: parsedOptions.data.authScheme,
|
|
2756
|
+
credentials: parsedOptions.data.credentials,
|
|
2757
|
+
restrict_to_following_tools: parsedOptions.data.restrictToFollowingTools
|
|
2758
|
+
} : {
|
|
2759
|
+
type: parsedOptions.data.type,
|
|
2760
|
+
credentials: parsedOptions.data.credentials,
|
|
2761
|
+
name: parsedOptions.data.name,
|
|
2762
|
+
restrict_to_following_tools: parsedOptions.data.restrictToFollowingTools
|
|
2763
|
+
}
|
|
2348
2764
|
});
|
|
2349
2765
|
const parsedResult = CreateAuthConfigResponseSchema.safeParse({
|
|
2350
2766
|
id: result.auth_config.id,
|
|
@@ -2520,7 +2936,34 @@ var AuthConfigs = class {
|
|
|
2520
2936
|
|
|
2521
2937
|
// src/models/ConnectionRequest.ts
|
|
2522
2938
|
var import_client3 = __toESM(require("@composio/client"), 1);
|
|
2523
|
-
|
|
2939
|
+
|
|
2940
|
+
// src/utils/transformers/connectedAccounts.ts
|
|
2941
|
+
function transformConnectedAccountResponse(response) {
|
|
2942
|
+
const result = ConnectedAccountRetrieveResponseSchema.safeParse({
|
|
2943
|
+
...response,
|
|
2944
|
+
authConfig: {
|
|
2945
|
+
...response.auth_config,
|
|
2946
|
+
id: response.auth_config.id,
|
|
2947
|
+
isComposioManaged: response.auth_config.is_composio_managed,
|
|
2948
|
+
isDisabled: response.auth_config.is_disabled
|
|
2949
|
+
},
|
|
2950
|
+
state: response.state,
|
|
2951
|
+
status: response.status,
|
|
2952
|
+
statusReason: response.status_reason,
|
|
2953
|
+
isDisabled: response.is_disabled,
|
|
2954
|
+
createdAt: response.created_at,
|
|
2955
|
+
updatedAt: response.updated_at,
|
|
2956
|
+
testRequestEndpoint: response.test_request_endpoint
|
|
2957
|
+
});
|
|
2958
|
+
if (!result.success) {
|
|
2959
|
+
throw new ValidationError("Failed to parse connected account retrieve response", {
|
|
2960
|
+
cause: result.error
|
|
2961
|
+
});
|
|
2962
|
+
}
|
|
2963
|
+
return result.data;
|
|
2964
|
+
}
|
|
2965
|
+
|
|
2966
|
+
// src/models/ConnectionRequest.ts
|
|
2524
2967
|
var ConnectionRequest = class {
|
|
2525
2968
|
client;
|
|
2526
2969
|
id;
|
|
@@ -2533,45 +2976,6 @@ var ConnectionRequest = class {
|
|
|
2533
2976
|
this.redirectUrl = redirectUrl;
|
|
2534
2977
|
telemetry.instrument(this);
|
|
2535
2978
|
}
|
|
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
2979
|
/**
|
|
2576
2980
|
* Waits for the connection request to complete and become active.
|
|
2577
2981
|
*
|
|
@@ -2603,7 +3007,7 @@ var ConnectionRequest = class {
|
|
|
2603
3007
|
const response = await this.client.connectedAccounts.retrieve(this.id);
|
|
2604
3008
|
if (response.status === ConnectedAccountStatuses.ACTIVE) {
|
|
2605
3009
|
this.status = ConnectedAccountStatuses.ACTIVE;
|
|
2606
|
-
return
|
|
3010
|
+
return transformConnectedAccountResponse(response);
|
|
2607
3011
|
}
|
|
2608
3012
|
} catch (error) {
|
|
2609
3013
|
if (error instanceof import_client3.default.NotFoundError) {
|
|
@@ -2630,14 +3034,13 @@ var ConnectionRequest = class {
|
|
|
2630
3034
|
const response = await this.client.connectedAccounts.retrieve(this.id);
|
|
2631
3035
|
this.status = response.status;
|
|
2632
3036
|
if (response.status === ConnectedAccountStatuses.ACTIVE) {
|
|
2633
|
-
return
|
|
3037
|
+
return transformConnectedAccountResponse(response);
|
|
2634
3038
|
}
|
|
2635
3039
|
if (terminalErrorStates.includes(response.status)) {
|
|
2636
3040
|
throw new ConnectionRequestFailedError(
|
|
2637
3041
|
`Connection request failed with status: ${response.status}${response.status_reason ? `, reason: ${response.status_reason}` : ""}`,
|
|
2638
3042
|
{
|
|
2639
3043
|
meta: {
|
|
2640
|
-
userId: response.user_id,
|
|
2641
3044
|
connectedAccountId: this.id,
|
|
2642
3045
|
status: response.status,
|
|
2643
3046
|
statusReason: response.status_reason
|
|
@@ -2678,30 +3081,6 @@ var ConnectedAccounts = class {
|
|
|
2678
3081
|
this.client = client;
|
|
2679
3082
|
telemetry.instrument(this);
|
|
2680
3083
|
}
|
|
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
3084
|
/**
|
|
2706
3085
|
* Lists all connected accounts based on provided filter criteria.
|
|
2707
3086
|
*
|
|
@@ -2748,7 +3127,7 @@ var ConnectedAccounts = class {
|
|
|
2748
3127
|
}
|
|
2749
3128
|
const result = await this.client.connectedAccounts.list(rawQuery);
|
|
2750
3129
|
const parsedResponse = ConnectedAccountListResponseSchema.safeParse({
|
|
2751
|
-
items: result.items.map(
|
|
3130
|
+
items: result.items.map(transformConnectedAccountResponse),
|
|
2752
3131
|
nextCursor: result.next_cursor,
|
|
2753
3132
|
totalPages: result.total_pages
|
|
2754
3133
|
});
|
|
@@ -2759,21 +3138,6 @@ var ConnectedAccounts = class {
|
|
|
2759
3138
|
}
|
|
2760
3139
|
return parsedResponse.data;
|
|
2761
3140
|
}
|
|
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
3141
|
/**
|
|
2778
3142
|
* Compound function to create a new connected account.
|
|
2779
3143
|
* This function creates a new connected account and returns a connection request.
|
|
@@ -2798,12 +3162,18 @@ var ConnectedAccounts = class {
|
|
|
2798
3162
|
id: authConfigId
|
|
2799
3163
|
},
|
|
2800
3164
|
connection: {
|
|
2801
|
-
|
|
3165
|
+
state: options?.state,
|
|
2802
3166
|
callback_url: options?.callbackUrl,
|
|
2803
3167
|
user_id: userId
|
|
2804
3168
|
}
|
|
2805
3169
|
});
|
|
2806
|
-
|
|
3170
|
+
const redirectUrl = typeof response.connectionData?.val?.redirectUrl === "string" ? response.connectionData.val.redirectUrl : null;
|
|
3171
|
+
return new ConnectionRequest(
|
|
3172
|
+
this.client,
|
|
3173
|
+
response.id,
|
|
3174
|
+
response.connectionData.val.status,
|
|
3175
|
+
redirectUrl
|
|
3176
|
+
);
|
|
2807
3177
|
}
|
|
2808
3178
|
/**
|
|
2809
3179
|
* Waits for a connection request to complete and become active.
|
|
@@ -2851,7 +3221,7 @@ var ConnectedAccounts = class {
|
|
|
2851
3221
|
*/
|
|
2852
3222
|
async get(nanoid) {
|
|
2853
3223
|
const response = await this.client.connectedAccounts.retrieve(nanoid);
|
|
2854
|
-
return
|
|
3224
|
+
return transformConnectedAccountResponse(response);
|
|
2855
3225
|
}
|
|
2856
3226
|
/**
|
|
2857
3227
|
* Deletes a connected account.
|
|
@@ -2896,14 +3266,14 @@ var ConnectedAccounts = class {
|
|
|
2896
3266
|
* @param {string} nanoid - Unique identifier of the connected account
|
|
2897
3267
|
* @param {ConnectedAccountUpdateStatusParams} params - Parameters for updating the status
|
|
2898
3268
|
* @returns {Promise<ConnectedAccountUpdateStatusResponse>} Updated connected account details
|
|
2899
|
-
*
|
|
3269
|
+
*
|
|
2900
3270
|
* @example
|
|
2901
3271
|
* ```typescript
|
|
2902
3272
|
* // Enable a connected account
|
|
2903
3273
|
* const updatedAccount = await composio.connectedAccounts.updateStatus('conn_abc123', {
|
|
2904
3274
|
* enabled: true
|
|
2905
3275
|
* });
|
|
2906
|
-
*
|
|
3276
|
+
*
|
|
2907
3277
|
* // Disable a connected account with a reason
|
|
2908
3278
|
* const disabledAccount = await composio.connectedAccounts.updateStatus('conn_abc123', {
|
|
2909
3279
|
* enabled: false,
|
|
@@ -2918,7 +3288,7 @@ var ConnectedAccounts = class {
|
|
|
2918
3288
|
* Enable a connected account
|
|
2919
3289
|
* @param {string} nanoid - Unique identifier of the connected account
|
|
2920
3290
|
* @returns {Promise<ConnectedAccountUpdateStatusResponse>} Updated connected account details
|
|
2921
|
-
*
|
|
3291
|
+
*
|
|
2922
3292
|
* @example
|
|
2923
3293
|
* ```typescript
|
|
2924
3294
|
* // Enable a previously disabled connected account
|
|
@@ -2933,13 +3303,13 @@ var ConnectedAccounts = class {
|
|
|
2933
3303
|
* Disable a connected account
|
|
2934
3304
|
* @param {string} nanoid - Unique identifier of the connected account
|
|
2935
3305
|
* @returns {Promise<ConnectedAccountUpdateStatusResponse>} Updated connected account details
|
|
2936
|
-
*
|
|
3306
|
+
*
|
|
2937
3307
|
* @example
|
|
2938
3308
|
* ```typescript
|
|
2939
3309
|
* // Disable a connected account
|
|
2940
3310
|
* const disabledAccount = await composio.connectedAccounts.disable('conn_abc123');
|
|
2941
3311
|
* console.log(disabledAccount.isDisabled); // true
|
|
2942
|
-
*
|
|
3312
|
+
*
|
|
2943
3313
|
* // You can also use updateStatus with a reason
|
|
2944
3314
|
* // const disabledAccount = await composio.connectedAccounts.updateStatus('conn_abc123', {
|
|
2945
3315
|
* // enabled: false,
|
|
@@ -3607,12 +3977,12 @@ var Triggers = class {
|
|
|
3607
3977
|
/**
|
|
3608
3978
|
* Update an existing trigger instance
|
|
3609
3979
|
*
|
|
3610
|
-
* @param {string}
|
|
3611
|
-
* @param {TriggerInstanceManageUpdateParams} body - The parameters to
|
|
3612
|
-
* @returns {Promise<
|
|
3980
|
+
* @param {string} triggerId - The Id of the trigger instance
|
|
3981
|
+
* @param {TriggerInstanceManageUpdateParams} body - The parameters to update the trigger instance
|
|
3982
|
+
* @returns {Promise<TriggerInstanceManageUpdateResponse>} The updated trigger instance response
|
|
3613
3983
|
*/
|
|
3614
|
-
async update(
|
|
3615
|
-
return this.client.triggerInstances.manage.update(
|
|
3984
|
+
async update(triggerId, body) {
|
|
3985
|
+
return this.client.triggerInstances.manage.update(triggerId, body);
|
|
3616
3986
|
}
|
|
3617
3987
|
/**
|
|
3618
3988
|
* Delete a trigger instance
|
|
@@ -4334,10 +4704,10 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
4334
4704
|
};
|
|
4335
4705
|
|
|
4336
4706
|
// package.json
|
|
4337
|
-
var version = "0.1.
|
|
4707
|
+
var version = "0.1.13";
|
|
4338
4708
|
|
|
4339
4709
|
// src/composio.ts
|
|
4340
|
-
var Composio = class {
|
|
4710
|
+
var Composio = class _Composio {
|
|
4341
4711
|
/**
|
|
4342
4712
|
* The Composio API client.
|
|
4343
4713
|
* @type {ComposioClient}
|
|
@@ -4361,10 +4731,10 @@ var Composio = class {
|
|
|
4361
4731
|
connectedAccounts;
|
|
4362
4732
|
/**
|
|
4363
4733
|
* Creates a new instance of the Composio SDK.
|
|
4364
|
-
*
|
|
4734
|
+
*
|
|
4365
4735
|
* The constructor initializes the SDK with the provided configuration options,
|
|
4366
4736
|
* sets up the API client, and initializes all core models (tools, toolkits, etc.).
|
|
4367
|
-
*
|
|
4737
|
+
*
|
|
4368
4738
|
* @param {ComposioConfig<TProvider>} config - Configuration options for the Composio SDK
|
|
4369
4739
|
* @param {string} [config.apiKey] - The API key for authenticating with the Composio API
|
|
4370
4740
|
* @param {string} [config.baseURL] - The base URL for the Composio API (defaults to production URL)
|
|
@@ -4372,18 +4742,18 @@ var Composio = class {
|
|
|
4372
4742
|
* @param {boolean} [config.allowTracing=true] - Whether to allow request tracing for debugging
|
|
4373
4743
|
* @param {TProvider} [config.provider] - The provider to use for this Composio instance (defaults to OpenAIProvider)
|
|
4374
4744
|
* @param {BaseTelemetryTransport} [config.telemetryTransport] - Custom telemetry transport implementation
|
|
4375
|
-
*
|
|
4745
|
+
*
|
|
4376
4746
|
* @example
|
|
4377
4747
|
* ```typescript
|
|
4378
4748
|
* // Initialize with default configuration
|
|
4379
4749
|
* const composio = new Composio();
|
|
4380
|
-
*
|
|
4750
|
+
*
|
|
4381
4751
|
* // Initialize with custom API key and base URL
|
|
4382
4752
|
* const composio = new Composio({
|
|
4383
4753
|
* apiKey: 'your-api-key',
|
|
4384
4754
|
* baseURL: 'https://api.composio.dev'
|
|
4385
4755
|
* });
|
|
4386
|
-
*
|
|
4756
|
+
*
|
|
4387
4757
|
* // Initialize with custom provider
|
|
4388
4758
|
* const composio = new Composio({
|
|
4389
4759
|
* apiKey: 'your-api-key',
|
|
@@ -4401,7 +4771,9 @@ var Composio = class {
|
|
|
4401
4771
|
}
|
|
4402
4772
|
this.client = new import_client6.default({
|
|
4403
4773
|
apiKey: apiKeyParsed,
|
|
4404
|
-
baseURL: baseURLParsed
|
|
4774
|
+
baseURL: baseURLParsed,
|
|
4775
|
+
defaultHeaders: config?.defaultHeaders,
|
|
4776
|
+
logLevel: process.env.COMPOSIO_LOG_LEVEL ?? void 0
|
|
4405
4777
|
});
|
|
4406
4778
|
this.config = {
|
|
4407
4779
|
...config,
|
|
@@ -4447,6 +4819,46 @@ var Composio = class {
|
|
|
4447
4819
|
}
|
|
4448
4820
|
return this.client;
|
|
4449
4821
|
}
|
|
4822
|
+
/**
|
|
4823
|
+
* Creates a new instance of the Composio SDK with custom request options while preserving the existing configuration.
|
|
4824
|
+
* This method is particularly useful when you need to:
|
|
4825
|
+
* - Add custom headers for specific requests
|
|
4826
|
+
* - Track request contexts with unique identifiers
|
|
4827
|
+
* - Override default request behavior for a subset of operations
|
|
4828
|
+
*
|
|
4829
|
+
* The new instance inherits all configuration from the parent instance (apiKey, baseURL, provider, etc.)
|
|
4830
|
+
* but allows you to specify custom request options that will be used for all API calls made through this session.
|
|
4831
|
+
*
|
|
4832
|
+
* @param {MergedRequestInit} fetchOptions - Custom request options to be used for all API calls in this session.
|
|
4833
|
+
* This follows the Fetch API RequestInit interface with additional options.
|
|
4834
|
+
* @returns {Composio<TProvider>} A new Composio instance with the custom request options applied.
|
|
4835
|
+
*
|
|
4836
|
+
* @example
|
|
4837
|
+
* ```typescript
|
|
4838
|
+
* // Create a base Composio instance
|
|
4839
|
+
* const composio = new Composio({
|
|
4840
|
+
* apiKey: 'your-api-key'
|
|
4841
|
+
* });
|
|
4842
|
+
*
|
|
4843
|
+
* // Create a session with request tracking headers
|
|
4844
|
+
* const composioWithCustomHeaders = composio.createSession({
|
|
4845
|
+
* headers: {
|
|
4846
|
+
* 'x-request-id': '1234567890',
|
|
4847
|
+
* 'x-correlation-id': 'session-abc-123',
|
|
4848
|
+
* 'x-custom-header': 'custom-value'
|
|
4849
|
+
* }
|
|
4850
|
+
* });
|
|
4851
|
+
*
|
|
4852
|
+
* // Use the session for making API calls with the custom headers
|
|
4853
|
+
* await composioWithCustomHeaders.tools.list();
|
|
4854
|
+
* ```
|
|
4855
|
+
*/
|
|
4856
|
+
createSession(options) {
|
|
4857
|
+
return new _Composio({
|
|
4858
|
+
...this.config,
|
|
4859
|
+
defaultHeaders: options?.headers
|
|
4860
|
+
});
|
|
4861
|
+
}
|
|
4450
4862
|
};
|
|
4451
4863
|
|
|
4452
4864
|
// src/provider/ComposioProvider.ts
|