@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.js
CHANGED
|
@@ -114,7 +114,7 @@ var ToolProxyParamsSchema = z.object({
|
|
|
114
114
|
name: z.string(),
|
|
115
115
|
value: z.union([z.string(), z.number()])
|
|
116
116
|
})
|
|
117
|
-
),
|
|
117
|
+
).optional(),
|
|
118
118
|
connectedAccountId: z.string().optional()
|
|
119
119
|
});
|
|
120
120
|
|
|
@@ -873,7 +873,411 @@ var TelemetryService = class {
|
|
|
873
873
|
var telemetry = new TelemetryService();
|
|
874
874
|
|
|
875
875
|
// src/types/connectedAccounts.types.ts
|
|
876
|
+
import { z as z3 } from "zod";
|
|
877
|
+
|
|
878
|
+
// src/types/connectedAccountAuthStates.types.ts
|
|
876
879
|
import { z as z2 } from "zod";
|
|
880
|
+
var AUTH_MODES_ENUM = {
|
|
881
|
+
OAUTH2: "OAUTH2",
|
|
882
|
+
OAUTH1: "OAUTH1",
|
|
883
|
+
API_KEY: "API_KEY",
|
|
884
|
+
BASIC: "BASIC",
|
|
885
|
+
BILLCOM_AUTH: "BILLCOM_AUTH",
|
|
886
|
+
BEARER_TOKEN: "BEARER_TOKEN",
|
|
887
|
+
GOOGLE_SERVICE_ACCOUNT: "GOOGLE_SERVICE_ACCOUNT",
|
|
888
|
+
NO_AUTH: "NO_AUTH",
|
|
889
|
+
BASIC_WITH_JWT: "BASIC_WITH_JWT",
|
|
890
|
+
COMPOSIO_LINK_AUTH: "COMPOSIO_LINK",
|
|
891
|
+
CALCOM_AUTH: "CALCOM_AUTH",
|
|
892
|
+
SNOWFLAKE: "SNOWFLAKE"
|
|
893
|
+
};
|
|
894
|
+
var RedirectableAuthSchemeSchema = z2.enum([
|
|
895
|
+
AUTH_MODES_ENUM.OAUTH1,
|
|
896
|
+
AUTH_MODES_ENUM.OAUTH2,
|
|
897
|
+
AUTH_MODES_ENUM.COMPOSIO_LINK_AUTH
|
|
898
|
+
]);
|
|
899
|
+
var BaseSchemeRaw = z2.object({
|
|
900
|
+
// for posthog, freshdesk, zendesk, clickup and others
|
|
901
|
+
subdomain: z2.string().optional(),
|
|
902
|
+
// for atlassian
|
|
903
|
+
["your-domain"]: z2.string().optional(),
|
|
904
|
+
// for mixpanel
|
|
905
|
+
region: z2.string().optional(),
|
|
906
|
+
// for shopify
|
|
907
|
+
shop: z2.string().optional(),
|
|
908
|
+
// for snowflake
|
|
909
|
+
account_url: z2.string().optional(),
|
|
910
|
+
// likely pipedrive
|
|
911
|
+
COMPANYDOMAIN: z2.string().optional(),
|
|
912
|
+
// likely zoho
|
|
913
|
+
extension: z2.string().optional(),
|
|
914
|
+
// likely formsite
|
|
915
|
+
form_api_base_url: z2.string().optional(),
|
|
916
|
+
// likely salesforce
|
|
917
|
+
instanceEndpoint: z2.string().optional(),
|
|
918
|
+
// likely active campaign
|
|
919
|
+
api_url: z2.string().optional(),
|
|
920
|
+
// for borneo
|
|
921
|
+
borneo_dashboard_url: z2.string().optional(),
|
|
922
|
+
// for zenrows proxy
|
|
923
|
+
proxy_username: z2.string().optional(),
|
|
924
|
+
proxy_password: z2.string().optional(),
|
|
925
|
+
// for d2l
|
|
926
|
+
domain: z2.string().optional(),
|
|
927
|
+
version: z2.string().optional(),
|
|
928
|
+
// for mailchimp
|
|
929
|
+
dc: z2.string().optional(),
|
|
930
|
+
// for sharepoint
|
|
931
|
+
site_name: z2.string().optional(),
|
|
932
|
+
// for servicenow
|
|
933
|
+
instanceName: z2.string().optional(),
|
|
934
|
+
// for netsuite
|
|
935
|
+
account_id: z2.string().optional(),
|
|
936
|
+
// for custom servers
|
|
937
|
+
your_server: z2.string().optional(),
|
|
938
|
+
// for ragic
|
|
939
|
+
server_location: z2.string().optional(),
|
|
940
|
+
// base_url only
|
|
941
|
+
base_url: z2.string().optional()
|
|
942
|
+
});
|
|
943
|
+
var Oauth2InitiatingConnectionDataSchema = BaseSchemeRaw.extend({
|
|
944
|
+
status: z2.literal("INITIALIZING" /* INITIALIZING */)
|
|
945
|
+
}).catchall(z2.unknown());
|
|
946
|
+
var Oauth2InitiatedConnectionDataSchema = Oauth2InitiatingConnectionDataSchema.extend({
|
|
947
|
+
status: z2.literal("INITIATED" /* INITIATED */),
|
|
948
|
+
code_verifier: z2.string().optional(),
|
|
949
|
+
redirectUrl: z2.string(),
|
|
950
|
+
callback_url: z2.string().optional(),
|
|
951
|
+
finalRedirectUri: z2.string().optional(),
|
|
952
|
+
// previously verification_token, will be sent as verification_token to slack
|
|
953
|
+
webhook_signature: z2.string().optional()
|
|
954
|
+
}).catchall(z2.unknown());
|
|
955
|
+
var Oauth2ActiveConnectionDataSchema = Oauth2InitiatingConnectionDataSchema.extend({
|
|
956
|
+
status: z2.literal("ACTIVE" /* ACTIVE */),
|
|
957
|
+
access_token: z2.string(),
|
|
958
|
+
id_token: z2.string().optional(),
|
|
959
|
+
token_type: z2.string(),
|
|
960
|
+
refresh_token: z2.string().optional(),
|
|
961
|
+
expires_in: z2.number().optional(),
|
|
962
|
+
scope: z2.string().optional(),
|
|
963
|
+
// previously verification_token, will be sent as verification_token to slack
|
|
964
|
+
webhook_signature: z2.string().optional(),
|
|
965
|
+
authed_user: z2.object({
|
|
966
|
+
access_token: z2.string().optional(),
|
|
967
|
+
scope: z2.string().optional()
|
|
968
|
+
}).optional().describe("for slack user scopes")
|
|
969
|
+
}).catchall(z2.unknown());
|
|
970
|
+
var Oauth2FailedConnectionDataSchema = Oauth2InitiatingConnectionDataSchema.extend({
|
|
971
|
+
status: z2.literal("FAILED" /* FAILED */),
|
|
972
|
+
error: z2.string().optional(),
|
|
973
|
+
error_description: z2.string().optional()
|
|
974
|
+
}).catchall(z2.unknown());
|
|
975
|
+
var Oauth2ExpiredConnectionDataSchema = Oauth2InitiatingConnectionDataSchema.extend({
|
|
976
|
+
status: z2.literal("EXPIRED" /* EXPIRED */),
|
|
977
|
+
expired_at: z2.string().optional()
|
|
978
|
+
}).catchall(z2.unknown());
|
|
979
|
+
var Oauth2ConnectionDataSchema = z2.discriminatedUnion("status", [
|
|
980
|
+
Oauth2InitiatingConnectionDataSchema,
|
|
981
|
+
Oauth2InitiatedConnectionDataSchema,
|
|
982
|
+
Oauth2ActiveConnectionDataSchema,
|
|
983
|
+
Oauth2FailedConnectionDataSchema,
|
|
984
|
+
Oauth2ExpiredConnectionDataSchema
|
|
985
|
+
]);
|
|
986
|
+
var Oauth1InitiatingConnectionDataSchema = BaseSchemeRaw.extend({
|
|
987
|
+
status: z2.literal("INITIALIZING" /* INITIALIZING */)
|
|
988
|
+
}).catchall(z2.unknown());
|
|
989
|
+
var Oauth1InitiatedConnectionDataSchema = Oauth1InitiatingConnectionDataSchema.extend({
|
|
990
|
+
status: z2.literal("INITIATED" /* INITIATED */),
|
|
991
|
+
oauth_token: z2.string(),
|
|
992
|
+
authUri: z2.string(),
|
|
993
|
+
oauth_token_secret: z2.string(),
|
|
994
|
+
redirectUrl: z2.string(),
|
|
995
|
+
callbackUrl: z2.string().optional()
|
|
996
|
+
}).catchall(z2.unknown());
|
|
997
|
+
var Oauth1ActiveConnectionDataSchema = Oauth1InitiatingConnectionDataSchema.extend({
|
|
998
|
+
status: z2.literal("ACTIVE" /* ACTIVE */),
|
|
999
|
+
oauth_token: z2.string(),
|
|
1000
|
+
consumer_key: z2.string().optional(),
|
|
1001
|
+
redirectUrl: z2.string().optional(),
|
|
1002
|
+
callback_url: z2.string().optional()
|
|
1003
|
+
}).catchall(z2.unknown());
|
|
1004
|
+
var Oauth1FailedConnectionDataSchema = Oauth1InitiatingConnectionDataSchema.extend({
|
|
1005
|
+
status: z2.literal("FAILED" /* FAILED */),
|
|
1006
|
+
error: z2.string().optional(),
|
|
1007
|
+
error_description: z2.string().optional()
|
|
1008
|
+
}).catchall(z2.unknown());
|
|
1009
|
+
var Oauth1ExpiredConnectionDataSchema = Oauth1InitiatingConnectionDataSchema.extend({
|
|
1010
|
+
status: z2.literal("EXPIRED" /* EXPIRED */),
|
|
1011
|
+
expired_at: z2.string().optional()
|
|
1012
|
+
}).catchall(z2.unknown());
|
|
1013
|
+
var Oauth1ConnectionDataSchema = z2.discriminatedUnion("status", [
|
|
1014
|
+
Oauth1InitiatingConnectionDataSchema,
|
|
1015
|
+
Oauth1InitiatedConnectionDataSchema,
|
|
1016
|
+
Oauth1ActiveConnectionDataSchema,
|
|
1017
|
+
Oauth1FailedConnectionDataSchema,
|
|
1018
|
+
Oauth1ExpiredConnectionDataSchema
|
|
1019
|
+
]);
|
|
1020
|
+
var ComposioLinkInitiatingSchema = BaseSchemeRaw.extend({
|
|
1021
|
+
status: z2.literal("INITIALIZING" /* INITIALIZING */)
|
|
1022
|
+
}).catchall(z2.unknown());
|
|
1023
|
+
var ComposioLinkConnectionDataSchema = z2.discriminatedUnion("status", [
|
|
1024
|
+
ComposioLinkInitiatingSchema,
|
|
1025
|
+
ComposioLinkInitiatingSchema.extend({
|
|
1026
|
+
status: z2.literal("INITIATED" /* INITIATED */),
|
|
1027
|
+
redirectUrl: z2.string()
|
|
1028
|
+
}).catchall(z2.unknown()),
|
|
1029
|
+
ComposioLinkInitiatingSchema.extend({
|
|
1030
|
+
status: z2.literal("ACTIVE" /* ACTIVE */)
|
|
1031
|
+
}).catchall(z2.unknown()),
|
|
1032
|
+
ComposioLinkInitiatingSchema.extend({
|
|
1033
|
+
status: z2.literal("FAILED" /* FAILED */),
|
|
1034
|
+
error: z2.string().optional(),
|
|
1035
|
+
error_description: z2.string().optional()
|
|
1036
|
+
}).catchall(z2.unknown()),
|
|
1037
|
+
ComposioLinkInitiatingSchema.extend({
|
|
1038
|
+
status: z2.literal("EXPIRED" /* EXPIRED */),
|
|
1039
|
+
expired_at: z2.string().optional()
|
|
1040
|
+
}).catchall(z2.unknown())
|
|
1041
|
+
]);
|
|
1042
|
+
var BillcomAuthInitiatingSchema = BaseSchemeRaw.extend({
|
|
1043
|
+
status: z2.literal("INITIALIZING" /* INITIALIZING */)
|
|
1044
|
+
}).catchall(z2.unknown());
|
|
1045
|
+
var BillcomAuthConnectionDataSchema = z2.discriminatedUnion("status", [
|
|
1046
|
+
BillcomAuthInitiatingSchema,
|
|
1047
|
+
BillcomAuthInitiatingSchema.extend({
|
|
1048
|
+
status: z2.literal("INITIATED" /* INITIATED */),
|
|
1049
|
+
redirectUrl: z2.string()
|
|
1050
|
+
}).catchall(z2.unknown()),
|
|
1051
|
+
BillcomAuthInitiatingSchema.extend({
|
|
1052
|
+
status: z2.literal("ACTIVE" /* ACTIVE */),
|
|
1053
|
+
sessionId: z2.string(),
|
|
1054
|
+
devKey: z2.string()
|
|
1055
|
+
}).catchall(z2.unknown()),
|
|
1056
|
+
BillcomAuthInitiatingSchema.extend({
|
|
1057
|
+
status: z2.literal("FAILED" /* FAILED */),
|
|
1058
|
+
error: z2.string().optional(),
|
|
1059
|
+
error_description: z2.string().optional()
|
|
1060
|
+
}).catchall(z2.unknown()),
|
|
1061
|
+
BillcomAuthInitiatingSchema.extend({
|
|
1062
|
+
status: z2.literal("EXPIRED" /* EXPIRED */),
|
|
1063
|
+
expired_at: z2.string().optional()
|
|
1064
|
+
}).catchall(z2.unknown())
|
|
1065
|
+
]);
|
|
1066
|
+
var BasicWithJwtInitiatingSchema = BaseSchemeRaw.extend({
|
|
1067
|
+
status: z2.literal("ACTIVE" /* ACTIVE */),
|
|
1068
|
+
username: z2.string(),
|
|
1069
|
+
password: z2.string()
|
|
1070
|
+
}).catchall(z2.unknown());
|
|
1071
|
+
var BasicWithJwtConnectionDataSchema = z2.discriminatedUnion("status", [
|
|
1072
|
+
BasicWithJwtInitiatingSchema,
|
|
1073
|
+
BasicWithJwtInitiatingSchema.extend({
|
|
1074
|
+
status: z2.literal("FAILED" /* FAILED */),
|
|
1075
|
+
error: z2.string().optional(),
|
|
1076
|
+
error_description: z2.string().optional()
|
|
1077
|
+
}).catchall(z2.unknown()),
|
|
1078
|
+
BasicWithJwtInitiatingSchema.extend({
|
|
1079
|
+
status: z2.literal("EXPIRED" /* EXPIRED */),
|
|
1080
|
+
expired_at: z2.string().optional()
|
|
1081
|
+
}).catchall(z2.unknown())
|
|
1082
|
+
]);
|
|
1083
|
+
var ApiKeyInitiatingSchema = BaseSchemeRaw.extend({
|
|
1084
|
+
status: z2.literal("ACTIVE" /* ACTIVE */),
|
|
1085
|
+
api_key: z2.string()
|
|
1086
|
+
}).catchall(z2.unknown());
|
|
1087
|
+
var ApiKeyConnectionDataSchema = z2.discriminatedUnion("status", [
|
|
1088
|
+
ApiKeyInitiatingSchema,
|
|
1089
|
+
ApiKeyInitiatingSchema.extend({
|
|
1090
|
+
status: z2.literal("FAILED" /* FAILED */),
|
|
1091
|
+
error: z2.string().optional(),
|
|
1092
|
+
error_description: z2.string().optional()
|
|
1093
|
+
}).catchall(z2.unknown()),
|
|
1094
|
+
ApiKeyInitiatingSchema.extend({
|
|
1095
|
+
status: z2.literal("EXPIRED" /* EXPIRED */),
|
|
1096
|
+
expired_at: z2.string().optional()
|
|
1097
|
+
}).catchall(z2.unknown())
|
|
1098
|
+
]);
|
|
1099
|
+
var BasicInitiatingSchema = BaseSchemeRaw.extend({
|
|
1100
|
+
status: z2.literal("ACTIVE" /* ACTIVE */),
|
|
1101
|
+
username: z2.string(),
|
|
1102
|
+
password: z2.string()
|
|
1103
|
+
}).catchall(z2.unknown());
|
|
1104
|
+
var BasicConnectionDataSchema = z2.discriminatedUnion("status", [
|
|
1105
|
+
BasicInitiatingSchema,
|
|
1106
|
+
BasicInitiatingSchema.extend({
|
|
1107
|
+
status: z2.literal("FAILED" /* FAILED */),
|
|
1108
|
+
error: z2.string().optional(),
|
|
1109
|
+
error_description: z2.string().optional()
|
|
1110
|
+
}).catchall(z2.unknown()),
|
|
1111
|
+
BasicInitiatingSchema.extend({
|
|
1112
|
+
status: z2.literal("EXPIRED" /* EXPIRED */),
|
|
1113
|
+
expired_at: z2.string().optional()
|
|
1114
|
+
}).catchall(z2.unknown())
|
|
1115
|
+
]);
|
|
1116
|
+
var BearerTokenInitiatingSchema = BaseSchemeRaw.extend({
|
|
1117
|
+
status: z2.literal("ACTIVE" /* ACTIVE */),
|
|
1118
|
+
token: z2.string()
|
|
1119
|
+
}).catchall(z2.unknown());
|
|
1120
|
+
var BearerTokenConnectionDataSchema = z2.discriminatedUnion("status", [
|
|
1121
|
+
BearerTokenInitiatingSchema,
|
|
1122
|
+
BearerTokenInitiatingSchema.extend({
|
|
1123
|
+
status: z2.literal("FAILED" /* FAILED */),
|
|
1124
|
+
error: z2.string().optional(),
|
|
1125
|
+
error_description: z2.string().optional()
|
|
1126
|
+
}).catchall(z2.unknown()),
|
|
1127
|
+
BearerTokenInitiatingSchema.extend({
|
|
1128
|
+
status: z2.literal("EXPIRED" /* EXPIRED */),
|
|
1129
|
+
expired_at: z2.string().optional()
|
|
1130
|
+
}).catchall(z2.unknown())
|
|
1131
|
+
]);
|
|
1132
|
+
var GoogleServiceAccountInitiatingSchema = BaseSchemeRaw.extend({
|
|
1133
|
+
status: z2.literal("ACTIVE" /* ACTIVE */),
|
|
1134
|
+
credentials_json: z2.string()
|
|
1135
|
+
}).catchall(z2.unknown());
|
|
1136
|
+
var GoogleServiceAccountConnectionDataSchema = z2.discriminatedUnion("status", [
|
|
1137
|
+
GoogleServiceAccountInitiatingSchema,
|
|
1138
|
+
GoogleServiceAccountInitiatingSchema.extend({
|
|
1139
|
+
status: z2.literal("FAILED" /* FAILED */),
|
|
1140
|
+
error: z2.string().optional(),
|
|
1141
|
+
error_description: z2.string().optional()
|
|
1142
|
+
}).catchall(z2.unknown()),
|
|
1143
|
+
GoogleServiceAccountInitiatingSchema.extend({
|
|
1144
|
+
status: z2.literal("EXPIRED" /* EXPIRED */),
|
|
1145
|
+
expired_at: z2.string().optional()
|
|
1146
|
+
}).catchall(z2.unknown())
|
|
1147
|
+
]);
|
|
1148
|
+
var NoAuthInitiatingSchema = BaseSchemeRaw.extend({
|
|
1149
|
+
status: z2.literal("ACTIVE" /* ACTIVE */)
|
|
1150
|
+
}).catchall(z2.unknown());
|
|
1151
|
+
var NoAuthConnectionDataSchema = z2.discriminatedUnion("status", [
|
|
1152
|
+
NoAuthInitiatingSchema,
|
|
1153
|
+
NoAuthInitiatingSchema.extend({
|
|
1154
|
+
status: z2.literal("FAILED" /* FAILED */),
|
|
1155
|
+
error: z2.string().optional(),
|
|
1156
|
+
error_description: z2.string().optional()
|
|
1157
|
+
}).catchall(z2.unknown()),
|
|
1158
|
+
NoAuthInitiatingSchema.extend({
|
|
1159
|
+
status: z2.literal("EXPIRED" /* EXPIRED */),
|
|
1160
|
+
expired_at: z2.string().optional()
|
|
1161
|
+
}).catchall(z2.unknown())
|
|
1162
|
+
]);
|
|
1163
|
+
var CalcomAuthInitiatingSchema = BaseSchemeRaw.extend({
|
|
1164
|
+
status: z2.literal("ACTIVE" /* ACTIVE */)
|
|
1165
|
+
}).catchall(z2.unknown());
|
|
1166
|
+
var CalcomAuthConnectionDataSchema = z2.discriminatedUnion("status", [
|
|
1167
|
+
CalcomAuthInitiatingSchema,
|
|
1168
|
+
CalcomAuthInitiatingSchema.extend({
|
|
1169
|
+
status: z2.literal("FAILED" /* FAILED */),
|
|
1170
|
+
error: z2.string().optional(),
|
|
1171
|
+
error_description: z2.string().optional()
|
|
1172
|
+
}).catchall(z2.unknown()),
|
|
1173
|
+
CalcomAuthInitiatingSchema.extend({
|
|
1174
|
+
status: z2.literal("EXPIRED" /* EXPIRED */),
|
|
1175
|
+
expired_at: z2.string().optional()
|
|
1176
|
+
}).catchall(z2.unknown())
|
|
1177
|
+
]);
|
|
1178
|
+
var SnowflakeInitiatingSchema = BaseSchemeRaw.extend({
|
|
1179
|
+
status: z2.literal("ACTIVE" /* ACTIVE */)
|
|
1180
|
+
}).catchall(z2.unknown());
|
|
1181
|
+
var SnowflakeConnectionDataSchema = z2.discriminatedUnion("status", [
|
|
1182
|
+
SnowflakeInitiatingSchema,
|
|
1183
|
+
SnowflakeInitiatingSchema.extend({
|
|
1184
|
+
status: z2.literal("FAILED" /* FAILED */),
|
|
1185
|
+
error: z2.string().optional(),
|
|
1186
|
+
error_description: z2.string().optional()
|
|
1187
|
+
}).catchall(z2.unknown()),
|
|
1188
|
+
SnowflakeInitiatingSchema.extend({
|
|
1189
|
+
status: z2.literal("EXPIRED" /* EXPIRED */),
|
|
1190
|
+
expired_at: z2.string().optional()
|
|
1191
|
+
}).catchall(z2.unknown())
|
|
1192
|
+
]);
|
|
1193
|
+
var ConnectionDataSchema = z2.discriminatedUnion("authScheme", [
|
|
1194
|
+
z2.object({
|
|
1195
|
+
authScheme: z2.literal(AUTH_MODES_ENUM.OAUTH1),
|
|
1196
|
+
/**
|
|
1197
|
+
* the main connection data discriminated by auth scheme
|
|
1198
|
+
*/
|
|
1199
|
+
val: Oauth1ConnectionDataSchema
|
|
1200
|
+
}),
|
|
1201
|
+
z2.object({
|
|
1202
|
+
authScheme: z2.literal(AUTH_MODES_ENUM.OAUTH2),
|
|
1203
|
+
/**
|
|
1204
|
+
* the main connection data discriminated by auth scheme
|
|
1205
|
+
*/
|
|
1206
|
+
val: Oauth2ConnectionDataSchema
|
|
1207
|
+
}),
|
|
1208
|
+
z2.object({
|
|
1209
|
+
authScheme: z2.literal(AUTH_MODES_ENUM.COMPOSIO_LINK_AUTH),
|
|
1210
|
+
/**
|
|
1211
|
+
* the main connection data discriminated by auth scheme
|
|
1212
|
+
*/
|
|
1213
|
+
val: ComposioLinkConnectionDataSchema
|
|
1214
|
+
}),
|
|
1215
|
+
z2.object({
|
|
1216
|
+
authScheme: z2.literal(AUTH_MODES_ENUM.API_KEY),
|
|
1217
|
+
/**
|
|
1218
|
+
* the main connection data discriminated by auth scheme
|
|
1219
|
+
*/
|
|
1220
|
+
val: ApiKeyConnectionDataSchema
|
|
1221
|
+
}),
|
|
1222
|
+
z2.object({
|
|
1223
|
+
authScheme: z2.literal(AUTH_MODES_ENUM.BASIC),
|
|
1224
|
+
/**
|
|
1225
|
+
* the main connection data discriminated by auth scheme
|
|
1226
|
+
*/
|
|
1227
|
+
val: BasicConnectionDataSchema
|
|
1228
|
+
}),
|
|
1229
|
+
z2.object({
|
|
1230
|
+
authScheme: z2.literal(AUTH_MODES_ENUM.BEARER_TOKEN),
|
|
1231
|
+
/**
|
|
1232
|
+
* the main connection data discriminated by auth scheme
|
|
1233
|
+
*/
|
|
1234
|
+
val: BearerTokenConnectionDataSchema
|
|
1235
|
+
}),
|
|
1236
|
+
z2.object({
|
|
1237
|
+
authScheme: z2.literal(AUTH_MODES_ENUM.GOOGLE_SERVICE_ACCOUNT),
|
|
1238
|
+
/**
|
|
1239
|
+
* the main connection data discriminated by auth scheme
|
|
1240
|
+
*/
|
|
1241
|
+
val: GoogleServiceAccountConnectionDataSchema
|
|
1242
|
+
}),
|
|
1243
|
+
z2.object({
|
|
1244
|
+
authScheme: z2.literal(AUTH_MODES_ENUM.NO_AUTH),
|
|
1245
|
+
/**
|
|
1246
|
+
* the main connection data discriminated by auth scheme
|
|
1247
|
+
*/
|
|
1248
|
+
val: NoAuthConnectionDataSchema
|
|
1249
|
+
}),
|
|
1250
|
+
z2.object({
|
|
1251
|
+
authScheme: z2.literal(AUTH_MODES_ENUM.CALCOM_AUTH),
|
|
1252
|
+
/**
|
|
1253
|
+
* the main connection data discriminated by auth scheme
|
|
1254
|
+
*/
|
|
1255
|
+
val: CalcomAuthConnectionDataSchema
|
|
1256
|
+
}),
|
|
1257
|
+
z2.object({
|
|
1258
|
+
authScheme: z2.literal(AUTH_MODES_ENUM.SNOWFLAKE),
|
|
1259
|
+
/**
|
|
1260
|
+
* the main connection data discriminated by auth scheme
|
|
1261
|
+
*/
|
|
1262
|
+
val: SnowflakeConnectionDataSchema
|
|
1263
|
+
}),
|
|
1264
|
+
z2.object({
|
|
1265
|
+
authScheme: z2.literal(AUTH_MODES_ENUM.BILLCOM_AUTH),
|
|
1266
|
+
/**
|
|
1267
|
+
* the main connection data discriminated by auth scheme
|
|
1268
|
+
*/
|
|
1269
|
+
val: BillcomAuthConnectionDataSchema
|
|
1270
|
+
}),
|
|
1271
|
+
z2.object({
|
|
1272
|
+
authScheme: z2.literal(AUTH_MODES_ENUM.BASIC_WITH_JWT),
|
|
1273
|
+
/**
|
|
1274
|
+
* the main connection data discriminated by auth scheme
|
|
1275
|
+
*/
|
|
1276
|
+
val: BasicWithJwtConnectionDataSchema
|
|
1277
|
+
})
|
|
1278
|
+
]);
|
|
1279
|
+
|
|
1280
|
+
// src/types/connectedAccounts.types.ts
|
|
877
1281
|
var ConnectedAccountStatuses = {
|
|
878
1282
|
INITIALIZING: "INITIALIZING",
|
|
879
1283
|
INITIATED: "INITIATED",
|
|
@@ -881,41 +1285,42 @@ var ConnectedAccountStatuses = {
|
|
|
881
1285
|
FAILED: "FAILED",
|
|
882
1286
|
EXPIRED: "EXPIRED"
|
|
883
1287
|
};
|
|
884
|
-
var ConnectedAccountStatusSchema =
|
|
1288
|
+
var ConnectedAccountStatusSchema = z3.enum([
|
|
885
1289
|
ConnectedAccountStatuses.INITIALIZING,
|
|
886
1290
|
ConnectedAccountStatuses.INITIATED,
|
|
887
1291
|
ConnectedAccountStatuses.ACTIVE,
|
|
888
1292
|
ConnectedAccountStatuses.FAILED,
|
|
889
1293
|
ConnectedAccountStatuses.EXPIRED
|
|
890
1294
|
]);
|
|
891
|
-
var CreateConnectedAccountParamsSchema =
|
|
892
|
-
authConfig:
|
|
893
|
-
id:
|
|
1295
|
+
var CreateConnectedAccountParamsSchema = z3.object({
|
|
1296
|
+
authConfig: z3.object({
|
|
1297
|
+
id: z3.string()
|
|
894
1298
|
}),
|
|
895
|
-
connection:
|
|
896
|
-
data:
|
|
897
|
-
callbackUrl:
|
|
898
|
-
userId:
|
|
1299
|
+
connection: z3.object({
|
|
1300
|
+
data: z3.record(z3.string(), z3.unknown()).optional(),
|
|
1301
|
+
callbackUrl: z3.string().optional(),
|
|
1302
|
+
userId: z3.string().optional()
|
|
899
1303
|
})
|
|
900
1304
|
});
|
|
901
|
-
var DefaultCreateConnectedAccountParamsSchema =
|
|
902
|
-
auth_config:
|
|
903
|
-
id:
|
|
1305
|
+
var DefaultCreateConnectedAccountParamsSchema = z3.object({
|
|
1306
|
+
auth_config: z3.object({
|
|
1307
|
+
id: z3.string()
|
|
904
1308
|
}),
|
|
905
|
-
connection:
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
1309
|
+
connection: z3.object({
|
|
1310
|
+
state: ConnectionDataSchema.optional(),
|
|
1311
|
+
data: z3.record(z3.string(), z3.unknown()).optional(),
|
|
1312
|
+
callback_url: z3.string().optional(),
|
|
1313
|
+
user_id: z3.string().optional()
|
|
909
1314
|
})
|
|
910
1315
|
});
|
|
911
|
-
var CreateConnectedAccountOptionsSchema =
|
|
912
|
-
callbackUrl:
|
|
913
|
-
|
|
1316
|
+
var CreateConnectedAccountOptionsSchema = z3.object({
|
|
1317
|
+
callbackUrl: z3.string().optional(),
|
|
1318
|
+
state: ConnectionDataSchema.optional()
|
|
914
1319
|
});
|
|
915
|
-
var CreateConnectedAccountResponseSchema =
|
|
916
|
-
id:
|
|
1320
|
+
var CreateConnectedAccountResponseSchema = z3.object({
|
|
1321
|
+
id: z3.string(),
|
|
917
1322
|
status: ConnectedAccountStatusSchema,
|
|
918
|
-
redirectUrl:
|
|
1323
|
+
redirectUrl: z3.string().nullable()
|
|
919
1324
|
});
|
|
920
1325
|
var ConnectedAccountAuthSchemes = {
|
|
921
1326
|
OAUTH2: "OAUTH2",
|
|
@@ -932,7 +1337,7 @@ var ConnectedAccountAuthSchemes = {
|
|
|
932
1337
|
CALCOM_AUTH: "CALCOM_AUTH",
|
|
933
1338
|
SNOWFLAKE: "SNOWFLAKE"
|
|
934
1339
|
};
|
|
935
|
-
var ConnectedAccountAuthSchemesSchema =
|
|
1340
|
+
var ConnectedAccountAuthSchemesSchema = z3.enum([
|
|
936
1341
|
ConnectedAccountAuthSchemes.OAUTH2,
|
|
937
1342
|
ConnectedAccountAuthSchemes.OAUTH1,
|
|
938
1343
|
ConnectedAccountAuthSchemes.OAUTH1A,
|
|
@@ -947,42 +1352,41 @@ var ConnectedAccountAuthSchemesSchema = z2.enum([
|
|
|
947
1352
|
ConnectedAccountAuthSchemes.CALCOM_AUTH,
|
|
948
1353
|
ConnectedAccountAuthSchemes.SNOWFLAKE
|
|
949
1354
|
]);
|
|
950
|
-
var ConnectedAccountAuthConfigSchema =
|
|
951
|
-
id:
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
isDisabled: z2.boolean()
|
|
1355
|
+
var ConnectedAccountAuthConfigSchema = z3.object({
|
|
1356
|
+
id: z3.string(),
|
|
1357
|
+
isComposioManaged: z3.boolean(),
|
|
1358
|
+
isDisabled: z3.boolean()
|
|
955
1359
|
});
|
|
956
|
-
var ConnectedAccountRetrieveResponseSchema =
|
|
957
|
-
id:
|
|
1360
|
+
var ConnectedAccountRetrieveResponseSchema = z3.object({
|
|
1361
|
+
id: z3.string(),
|
|
958
1362
|
authConfig: ConnectedAccountAuthConfigSchema,
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
params: z2.record(z2.string(), z2.unknown()).optional(),
|
|
1363
|
+
data: z3.record(z3.string(), z3.unknown()),
|
|
1364
|
+
params: z3.record(z3.string(), z3.unknown()).optional(),
|
|
962
1365
|
status: ConnectedAccountStatusSchema,
|
|
963
|
-
statusReason:
|
|
964
|
-
toolkit:
|
|
965
|
-
slug:
|
|
1366
|
+
statusReason: z3.string().nullable(),
|
|
1367
|
+
toolkit: z3.object({
|
|
1368
|
+
slug: z3.string()
|
|
966
1369
|
}),
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
1370
|
+
state: ConnectionDataSchema.optional(),
|
|
1371
|
+
testRequestEndpoint: z3.string().optional(),
|
|
1372
|
+
isDisabled: z3.boolean(),
|
|
1373
|
+
createdAt: z3.string(),
|
|
1374
|
+
updatedAt: z3.string()
|
|
971
1375
|
});
|
|
972
|
-
var ConnectedAccountListParamsSchema =
|
|
973
|
-
authConfigIds:
|
|
974
|
-
cursor:
|
|
975
|
-
labels:
|
|
976
|
-
limit:
|
|
977
|
-
orderBy:
|
|
978
|
-
statuses:
|
|
979
|
-
toolkitSlugs:
|
|
980
|
-
userIds:
|
|
1376
|
+
var ConnectedAccountListParamsSchema = z3.object({
|
|
1377
|
+
authConfigIds: z3.array(z3.string()).nullable().optional().describe("The auth config ids of the connected accounts"),
|
|
1378
|
+
cursor: z3.number().nullable().optional().describe("The cursor to paginate through the connected accounts"),
|
|
1379
|
+
labels: z3.array(z3.string()).nullable().optional().describe("The labels of the connected accounts"),
|
|
1380
|
+
limit: z3.number().nullable().optional().describe("The limit of the connected accounts to return"),
|
|
1381
|
+
orderBy: z3.enum(["created_at", "updated_at"]).optional().describe("The order by of the connected accounts"),
|
|
1382
|
+
statuses: z3.array(ConnectedAccountStatusSchema).nullable().optional().describe("The statuses of the connected accounts"),
|
|
1383
|
+
toolkitSlugs: z3.array(z3.string()).nullable().optional().describe("The toolkit slugs of the connected accounts"),
|
|
1384
|
+
userIds: z3.array(z3.string()).nullable().optional().describe("The user ids of the connected accounts")
|
|
981
1385
|
});
|
|
982
|
-
var ConnectedAccountListResponseSchema =
|
|
983
|
-
items:
|
|
984
|
-
nextCursor:
|
|
985
|
-
totalPages:
|
|
1386
|
+
var ConnectedAccountListResponseSchema = z3.object({
|
|
1387
|
+
items: z3.array(ConnectedAccountRetrieveResponseSchema).describe("The list of connected accounts"),
|
|
1388
|
+
nextCursor: z3.string().nullable().describe("The next cursor to paginate through the connected accounts"),
|
|
1389
|
+
totalPages: z3.number().describe("The total number of pages of connected accounts")
|
|
986
1390
|
});
|
|
987
1391
|
|
|
988
1392
|
// src/errors/AuthConfigErrors.ts
|
|
@@ -1751,7 +2155,7 @@ var Tools = class {
|
|
|
1751
2155
|
connected_account_id: body.connectedAccountId,
|
|
1752
2156
|
custom_auth_params: body.customAuthParams,
|
|
1753
2157
|
arguments: body.arguments,
|
|
1754
|
-
|
|
2158
|
+
user_id: body.userId,
|
|
1755
2159
|
version: body.version,
|
|
1756
2160
|
text: body.text
|
|
1757
2161
|
});
|
|
@@ -1973,87 +2377,87 @@ var Tools = class {
|
|
|
1973
2377
|
import ComposioClient2 from "@composio/client";
|
|
1974
2378
|
|
|
1975
2379
|
// src/types/toolkit.types.ts
|
|
1976
|
-
import { z as
|
|
1977
|
-
var ToolkitMangedByEnumSchema =
|
|
1978
|
-
var ToolkitSortByEnumSchema =
|
|
1979
|
-
var ToolkitsListParamsSchema =
|
|
1980
|
-
category:
|
|
1981
|
-
isLocal:
|
|
2380
|
+
import { z as z4 } from "zod";
|
|
2381
|
+
var ToolkitMangedByEnumSchema = z4.enum(["all", "composio", "project"]);
|
|
2382
|
+
var ToolkitSortByEnumSchema = z4.enum(["usage", "alphabetically"]);
|
|
2383
|
+
var ToolkitsListParamsSchema = z4.object({
|
|
2384
|
+
category: z4.string().optional(),
|
|
2385
|
+
isLocal: z4.boolean().optional(),
|
|
1982
2386
|
managedBy: ToolkitMangedByEnumSchema.optional(),
|
|
1983
2387
|
sortBy: ToolkitSortByEnumSchema.optional()
|
|
1984
2388
|
});
|
|
1985
|
-
var ToolKitMetaSchema =
|
|
1986
|
-
categories:
|
|
1987
|
-
|
|
1988
|
-
slug:
|
|
1989
|
-
name:
|
|
2389
|
+
var ToolKitMetaSchema = z4.object({
|
|
2390
|
+
categories: z4.array(
|
|
2391
|
+
z4.object({
|
|
2392
|
+
slug: z4.string(),
|
|
2393
|
+
name: z4.string()
|
|
1990
2394
|
})
|
|
1991
2395
|
).optional(),
|
|
1992
|
-
appUrl:
|
|
1993
|
-
createdAt:
|
|
1994
|
-
description:
|
|
1995
|
-
logo:
|
|
1996
|
-
toolsCount:
|
|
1997
|
-
triggersCount:
|
|
1998
|
-
updatedAt:
|
|
2396
|
+
appUrl: z4.string().optional(),
|
|
2397
|
+
createdAt: z4.string().optional(),
|
|
2398
|
+
description: z4.string().optional(),
|
|
2399
|
+
logo: z4.string().optional(),
|
|
2400
|
+
toolsCount: z4.number().optional(),
|
|
2401
|
+
triggersCount: z4.number().optional(),
|
|
2402
|
+
updatedAt: z4.string().optional()
|
|
1999
2403
|
});
|
|
2000
|
-
var ToolKitItemSchema =
|
|
2001
|
-
name:
|
|
2002
|
-
slug:
|
|
2404
|
+
var ToolKitItemSchema = z4.object({
|
|
2405
|
+
name: z4.string(),
|
|
2406
|
+
slug: z4.string(),
|
|
2003
2407
|
meta: ToolKitMetaSchema,
|
|
2004
|
-
isLocalToolkit:
|
|
2005
|
-
authSchemes:
|
|
2006
|
-
composioManagedAuthSchemes:
|
|
2007
|
-
noAuth:
|
|
2408
|
+
isLocalToolkit: z4.boolean(),
|
|
2409
|
+
authSchemes: z4.array(z4.string()).optional(),
|
|
2410
|
+
composioManagedAuthSchemes: z4.array(z4.string()).optional(),
|
|
2411
|
+
noAuth: z4.boolean().optional()
|
|
2008
2412
|
});
|
|
2009
|
-
var ToolKitListResponseSchema =
|
|
2010
|
-
items:
|
|
2011
|
-
nextCursor:
|
|
2012
|
-
totalPages:
|
|
2413
|
+
var ToolKitListResponseSchema = z4.object({
|
|
2414
|
+
items: z4.array(ToolKitItemSchema),
|
|
2415
|
+
nextCursor: z4.string().nullable(),
|
|
2416
|
+
totalPages: z4.number()
|
|
2013
2417
|
});
|
|
2014
|
-
var ToolkitAuthFieldSchema =
|
|
2015
|
-
name:
|
|
2016
|
-
displayName:
|
|
2017
|
-
type:
|
|
2018
|
-
default:
|
|
2418
|
+
var ToolkitAuthFieldSchema = z4.object({
|
|
2419
|
+
name: z4.string(),
|
|
2420
|
+
displayName: z4.string(),
|
|
2421
|
+
type: z4.string(),
|
|
2422
|
+
default: z4.string().nullable().optional()
|
|
2019
2423
|
});
|
|
2020
|
-
var ToolkitAuthConfigDetailsSchema =
|
|
2021
|
-
name:
|
|
2022
|
-
mode:
|
|
2023
|
-
fields:
|
|
2024
|
-
authConfigCreation:
|
|
2025
|
-
optional:
|
|
2026
|
-
required:
|
|
2424
|
+
var ToolkitAuthConfigDetailsSchema = z4.object({
|
|
2425
|
+
name: z4.string(),
|
|
2426
|
+
mode: z4.string(),
|
|
2427
|
+
fields: z4.object({
|
|
2428
|
+
authConfigCreation: z4.object({
|
|
2429
|
+
optional: z4.array(ToolkitAuthFieldSchema),
|
|
2430
|
+
required: z4.array(ToolkitAuthFieldSchema)
|
|
2027
2431
|
}),
|
|
2028
|
-
connectedAccountInitiation:
|
|
2029
|
-
optional:
|
|
2030
|
-
required:
|
|
2432
|
+
connectedAccountInitiation: z4.object({
|
|
2433
|
+
optional: z4.array(ToolkitAuthFieldSchema),
|
|
2434
|
+
required: z4.array(ToolkitAuthFieldSchema)
|
|
2031
2435
|
})
|
|
2032
2436
|
}),
|
|
2033
|
-
proxy:
|
|
2034
|
-
baseUrl:
|
|
2437
|
+
proxy: z4.object({
|
|
2438
|
+
baseUrl: z4.string().optional()
|
|
2035
2439
|
}).optional()
|
|
2036
2440
|
});
|
|
2037
|
-
var ToolkitRetrieveResponseSchema =
|
|
2038
|
-
name:
|
|
2039
|
-
slug:
|
|
2441
|
+
var ToolkitRetrieveResponseSchema = z4.object({
|
|
2442
|
+
name: z4.string(),
|
|
2443
|
+
slug: z4.string(),
|
|
2040
2444
|
meta: ToolKitMetaSchema,
|
|
2041
|
-
isLocalToolkit:
|
|
2042
|
-
composioManagedAuthSchemes:
|
|
2043
|
-
authConfigDetails:
|
|
2445
|
+
isLocalToolkit: z4.boolean(),
|
|
2446
|
+
composioManagedAuthSchemes: z4.array(z4.string()).optional(),
|
|
2447
|
+
authConfigDetails: z4.array(ToolkitAuthConfigDetailsSchema).optional()
|
|
2044
2448
|
});
|
|
2045
|
-
var ToolkitCategorySchema =
|
|
2046
|
-
id:
|
|
2047
|
-
name:
|
|
2449
|
+
var ToolkitCategorySchema = z4.object({
|
|
2450
|
+
id: z4.string(),
|
|
2451
|
+
name: z4.string()
|
|
2048
2452
|
});
|
|
2049
|
-
var ToolkitRetrieveCategoriesResponseSchema =
|
|
2050
|
-
items:
|
|
2051
|
-
nextCursor:
|
|
2052
|
-
totalPages:
|
|
2453
|
+
var ToolkitRetrieveCategoriesResponseSchema = z4.object({
|
|
2454
|
+
items: z4.array(ToolkitCategorySchema),
|
|
2455
|
+
nextCursor: z4.string().nullable(),
|
|
2456
|
+
totalPages: z4.number()
|
|
2053
2457
|
});
|
|
2054
2458
|
|
|
2055
2459
|
// src/types/authConfigs.types.ts
|
|
2056
|
-
import { z as
|
|
2460
|
+
import { z as z5 } from "zod";
|
|
2057
2461
|
var AuthConfigTypes = {
|
|
2058
2462
|
CUSTOM: "use_custom_auth",
|
|
2059
2463
|
COMPOSIO_MANAGED: "use_composio_managed_auth"
|
|
@@ -2073,10 +2477,9 @@ var AuthSchemeTypes = {
|
|
|
2073
2477
|
CALCOM_AUTH: "CALCOM_AUTH",
|
|
2074
2478
|
SNOWFLAKE: "SNOWFLAKE"
|
|
2075
2479
|
};
|
|
2076
|
-
var AuthSchemeEnum =
|
|
2480
|
+
var AuthSchemeEnum = z5.enum([
|
|
2077
2481
|
"OAUTH2",
|
|
2078
2482
|
"OAUTH1",
|
|
2079
|
-
"OAUTH1A",
|
|
2080
2483
|
"API_KEY",
|
|
2081
2484
|
"BASIC",
|
|
2082
2485
|
"BILLCOM_AUTH",
|
|
@@ -2088,67 +2491,69 @@ var AuthSchemeEnum = z4.enum([
|
|
|
2088
2491
|
"CALCOM_AUTH",
|
|
2089
2492
|
"SNOWFLAKE"
|
|
2090
2493
|
]);
|
|
2091
|
-
var CreateCustomAuthConfigParamsSchema =
|
|
2092
|
-
type:
|
|
2093
|
-
name:
|
|
2094
|
-
credentials:
|
|
2095
|
-
authScheme: AuthSchemeEnum
|
|
2494
|
+
var CreateCustomAuthConfigParamsSchema = z5.object({
|
|
2495
|
+
type: z5.literal("use_custom_auth"),
|
|
2496
|
+
name: z5.string().optional(),
|
|
2497
|
+
credentials: z5.record(z5.string(), z5.union([z5.string(), z5.number(), z5.boolean()])),
|
|
2498
|
+
authScheme: AuthSchemeEnum,
|
|
2499
|
+
restrictToFollowingTools: z5.array(z5.string()).optional()
|
|
2096
2500
|
});
|
|
2097
|
-
var CreateComposioManagedAuthConfigParamsSchema =
|
|
2098
|
-
type:
|
|
2099
|
-
name:
|
|
2100
|
-
credentials:
|
|
2501
|
+
var CreateComposioManagedAuthConfigParamsSchema = z5.object({
|
|
2502
|
+
type: z5.literal("use_composio_managed_auth"),
|
|
2503
|
+
name: z5.string().optional(),
|
|
2504
|
+
credentials: z5.record(z5.string(), z5.union([z5.string(), z5.number(), z5.boolean()])).optional(),
|
|
2505
|
+
restrictToFollowingTools: z5.array(z5.string()).optional()
|
|
2101
2506
|
});
|
|
2102
|
-
var CreateAuthConfigParamsSchema =
|
|
2507
|
+
var CreateAuthConfigParamsSchema = z5.discriminatedUnion("type", [
|
|
2103
2508
|
CreateCustomAuthConfigParamsSchema,
|
|
2104
2509
|
CreateComposioManagedAuthConfigParamsSchema
|
|
2105
2510
|
]);
|
|
2106
|
-
var CreateAuthConfigResponseSchema =
|
|
2107
|
-
id:
|
|
2108
|
-
authScheme:
|
|
2109
|
-
isComposioManaged:
|
|
2110
|
-
toolkit:
|
|
2511
|
+
var CreateAuthConfigResponseSchema = z5.object({
|
|
2512
|
+
id: z5.string(),
|
|
2513
|
+
authScheme: z5.string(),
|
|
2514
|
+
isComposioManaged: z5.boolean(),
|
|
2515
|
+
toolkit: z5.string()
|
|
2111
2516
|
});
|
|
2112
|
-
var AuthConfigRetrieveResponseSchema =
|
|
2113
|
-
id:
|
|
2114
|
-
name:
|
|
2115
|
-
toolkit:
|
|
2116
|
-
logo:
|
|
2117
|
-
slug:
|
|
2517
|
+
var AuthConfigRetrieveResponseSchema = z5.object({
|
|
2518
|
+
id: z5.string(),
|
|
2519
|
+
name: z5.string(),
|
|
2520
|
+
toolkit: z5.object({
|
|
2521
|
+
logo: z5.string(),
|
|
2522
|
+
slug: z5.string()
|
|
2118
2523
|
}),
|
|
2119
|
-
noOfConnections:
|
|
2120
|
-
status:
|
|
2121
|
-
uuid:
|
|
2524
|
+
noOfConnections: z5.number(),
|
|
2525
|
+
status: z5.enum(["ENABLED", "DISABLED"]),
|
|
2526
|
+
uuid: z5.string(),
|
|
2122
2527
|
authScheme: AuthSchemeEnum.optional(),
|
|
2123
|
-
credentials:
|
|
2124
|
-
expectedInputFields:
|
|
2125
|
-
isComposioManaged:
|
|
2126
|
-
createdBy:
|
|
2127
|
-
createdAt:
|
|
2128
|
-
lastUpdatedAt:
|
|
2528
|
+
credentials: z5.record(z5.string(), z5.unknown()).optional(),
|
|
2529
|
+
expectedInputFields: z5.array(z5.unknown()).optional(),
|
|
2530
|
+
isComposioManaged: z5.boolean().optional(),
|
|
2531
|
+
createdBy: z5.string().optional(),
|
|
2532
|
+
createdAt: z5.string().optional(),
|
|
2533
|
+
lastUpdatedAt: z5.string().optional()
|
|
2129
2534
|
});
|
|
2130
|
-
var AuthConfigListParamsSchema =
|
|
2131
|
-
cursor:
|
|
2132
|
-
isComposioManaged:
|
|
2133
|
-
limit:
|
|
2134
|
-
toolkit:
|
|
2535
|
+
var AuthConfigListParamsSchema = z5.object({
|
|
2536
|
+
cursor: z5.string().optional(),
|
|
2537
|
+
isComposioManaged: z5.boolean().optional(),
|
|
2538
|
+
limit: z5.number().optional(),
|
|
2539
|
+
toolkit: z5.string().optional()
|
|
2135
2540
|
});
|
|
2136
|
-
var AuthConfigListResponseSchema =
|
|
2137
|
-
items:
|
|
2138
|
-
nextCursor:
|
|
2139
|
-
totalPages:
|
|
2541
|
+
var AuthConfigListResponseSchema = z5.object({
|
|
2542
|
+
items: z5.array(AuthConfigRetrieveResponseSchema),
|
|
2543
|
+
nextCursor: z5.string().nullable(),
|
|
2544
|
+
totalPages: z5.number()
|
|
2140
2545
|
});
|
|
2141
|
-
var AuthCustomConfigUpdateParamsSchema =
|
|
2142
|
-
credentials:
|
|
2143
|
-
type:
|
|
2144
|
-
restrictToFollowingTools:
|
|
2546
|
+
var AuthCustomConfigUpdateParamsSchema = z5.object({
|
|
2547
|
+
credentials: z5.record(z5.string(), z5.union([z5.string(), z5.unknown()])),
|
|
2548
|
+
type: z5.literal("custom"),
|
|
2549
|
+
restrictToFollowingTools: z5.array(z5.string()).optional()
|
|
2145
2550
|
});
|
|
2146
|
-
var AuthDefaultConfigUpdateParamsSchema =
|
|
2147
|
-
scopes:
|
|
2148
|
-
type:
|
|
2149
|
-
restrictToFollowingTools:
|
|
2551
|
+
var AuthDefaultConfigUpdateParamsSchema = z5.object({
|
|
2552
|
+
scopes: z5.string(),
|
|
2553
|
+
type: z5.literal("default"),
|
|
2554
|
+
restrictToFollowingTools: z5.array(z5.string()).optional()
|
|
2150
2555
|
});
|
|
2151
|
-
var AuthConfigUpdateParamsSchema =
|
|
2556
|
+
var AuthConfigUpdateParamsSchema = z5.discriminatedUnion("type", [
|
|
2152
2557
|
AuthCustomConfigUpdateParamsSchema,
|
|
2153
2558
|
AuthDefaultConfigUpdateParamsSchema
|
|
2154
2559
|
]);
|
|
@@ -2281,7 +2686,18 @@ var AuthConfigs = class {
|
|
|
2281
2686
|
toolkit: {
|
|
2282
2687
|
slug: toolkit
|
|
2283
2688
|
},
|
|
2284
|
-
auth_config: parsedOptions.data
|
|
2689
|
+
auth_config: parsedOptions.data.type === "use_custom_auth" ? {
|
|
2690
|
+
type: parsedOptions.data.type,
|
|
2691
|
+
name: parsedOptions.data.name,
|
|
2692
|
+
authScheme: parsedOptions.data.authScheme,
|
|
2693
|
+
credentials: parsedOptions.data.credentials,
|
|
2694
|
+
restrict_to_following_tools: parsedOptions.data.restrictToFollowingTools
|
|
2695
|
+
} : {
|
|
2696
|
+
type: parsedOptions.data.type,
|
|
2697
|
+
credentials: parsedOptions.data.credentials,
|
|
2698
|
+
name: parsedOptions.data.name,
|
|
2699
|
+
restrict_to_following_tools: parsedOptions.data.restrictToFollowingTools
|
|
2700
|
+
}
|
|
2285
2701
|
});
|
|
2286
2702
|
const parsedResult = CreateAuthConfigResponseSchema.safeParse({
|
|
2287
2703
|
id: result.auth_config.id,
|
|
@@ -2457,7 +2873,34 @@ var AuthConfigs = class {
|
|
|
2457
2873
|
|
|
2458
2874
|
// src/models/ConnectionRequest.ts
|
|
2459
2875
|
import ComposioClient from "@composio/client";
|
|
2460
|
-
|
|
2876
|
+
|
|
2877
|
+
// src/utils/transformers/connectedAccounts.ts
|
|
2878
|
+
function transformConnectedAccountResponse(response) {
|
|
2879
|
+
const result = ConnectedAccountRetrieveResponseSchema.safeParse({
|
|
2880
|
+
...response,
|
|
2881
|
+
authConfig: {
|
|
2882
|
+
...response.auth_config,
|
|
2883
|
+
id: response.auth_config.id,
|
|
2884
|
+
isComposioManaged: response.auth_config.is_composio_managed,
|
|
2885
|
+
isDisabled: response.auth_config.is_disabled
|
|
2886
|
+
},
|
|
2887
|
+
state: response.state,
|
|
2888
|
+
status: response.status,
|
|
2889
|
+
statusReason: response.status_reason,
|
|
2890
|
+
isDisabled: response.is_disabled,
|
|
2891
|
+
createdAt: response.created_at,
|
|
2892
|
+
updatedAt: response.updated_at,
|
|
2893
|
+
testRequestEndpoint: response.test_request_endpoint
|
|
2894
|
+
});
|
|
2895
|
+
if (!result.success) {
|
|
2896
|
+
throw new ValidationError("Failed to parse connected account retrieve response", {
|
|
2897
|
+
cause: result.error
|
|
2898
|
+
});
|
|
2899
|
+
}
|
|
2900
|
+
return result.data;
|
|
2901
|
+
}
|
|
2902
|
+
|
|
2903
|
+
// src/models/ConnectionRequest.ts
|
|
2461
2904
|
var ConnectionRequest = class {
|
|
2462
2905
|
client;
|
|
2463
2906
|
id;
|
|
@@ -2470,45 +2913,6 @@ var ConnectionRequest = class {
|
|
|
2470
2913
|
this.redirectUrl = redirectUrl;
|
|
2471
2914
|
telemetry.instrument(this);
|
|
2472
2915
|
}
|
|
2473
|
-
/**
|
|
2474
|
-
* Transforms the raw connected account response from the Composio API to the SDK format.
|
|
2475
|
-
*
|
|
2476
|
-
* This method converts property names from snake_case to camelCase and reorganizes
|
|
2477
|
-
* the data structure to match the SDK's standardized format.
|
|
2478
|
-
*
|
|
2479
|
-
* @param {OriginalConnectedAccountResponse} response - The raw API response to transform
|
|
2480
|
-
* @returns {Promise<ConnectedAccountRetrieveResponse>} The transformed response
|
|
2481
|
-
* @throws {ZodError} If the response fails validation against the expected schema
|
|
2482
|
-
*
|
|
2483
|
-
* @private
|
|
2484
|
-
*/
|
|
2485
|
-
async transformResponse(response) {
|
|
2486
|
-
try {
|
|
2487
|
-
const parsedResponse = ConnectedAccountRetrieveResponseSchema.parse({
|
|
2488
|
-
...response,
|
|
2489
|
-
userId: response.user_id,
|
|
2490
|
-
// Add the missing userId property
|
|
2491
|
-
authConfig: {
|
|
2492
|
-
...response.auth_config,
|
|
2493
|
-
authScheme: response.auth_config.auth_scheme,
|
|
2494
|
-
isComposioManaged: response.auth_config.is_composio_managed,
|
|
2495
|
-
isDisabled: response.auth_config.is_disabled
|
|
2496
|
-
},
|
|
2497
|
-
statusReason: response.status_reason,
|
|
2498
|
-
isDisabled: response.is_disabled,
|
|
2499
|
-
createdAt: response.created_at,
|
|
2500
|
-
updatedAt: response.updated_at,
|
|
2501
|
-
testRequestEndpoint: response.test_request_endpoint
|
|
2502
|
-
});
|
|
2503
|
-
return parsedResponse;
|
|
2504
|
-
} catch (error) {
|
|
2505
|
-
logger_default.error("Error transforming response", error);
|
|
2506
|
-
if (error instanceof ZodError3) {
|
|
2507
|
-
logger_default.error(JSON.stringify(error.errors, null, 2));
|
|
2508
|
-
}
|
|
2509
|
-
throw error;
|
|
2510
|
-
}
|
|
2511
|
-
}
|
|
2512
2916
|
/**
|
|
2513
2917
|
* Waits for the connection request to complete and become active.
|
|
2514
2918
|
*
|
|
@@ -2540,7 +2944,7 @@ var ConnectionRequest = class {
|
|
|
2540
2944
|
const response = await this.client.connectedAccounts.retrieve(this.id);
|
|
2541
2945
|
if (response.status === ConnectedAccountStatuses.ACTIVE) {
|
|
2542
2946
|
this.status = ConnectedAccountStatuses.ACTIVE;
|
|
2543
|
-
return
|
|
2947
|
+
return transformConnectedAccountResponse(response);
|
|
2544
2948
|
}
|
|
2545
2949
|
} catch (error) {
|
|
2546
2950
|
if (error instanceof ComposioClient.NotFoundError) {
|
|
@@ -2567,14 +2971,13 @@ var ConnectionRequest = class {
|
|
|
2567
2971
|
const response = await this.client.connectedAccounts.retrieve(this.id);
|
|
2568
2972
|
this.status = response.status;
|
|
2569
2973
|
if (response.status === ConnectedAccountStatuses.ACTIVE) {
|
|
2570
|
-
return
|
|
2974
|
+
return transformConnectedAccountResponse(response);
|
|
2571
2975
|
}
|
|
2572
2976
|
if (terminalErrorStates.includes(response.status)) {
|
|
2573
2977
|
throw new ConnectionRequestFailedError(
|
|
2574
2978
|
`Connection request failed with status: ${response.status}${response.status_reason ? `, reason: ${response.status_reason}` : ""}`,
|
|
2575
2979
|
{
|
|
2576
2980
|
meta: {
|
|
2577
|
-
userId: response.user_id,
|
|
2578
2981
|
connectedAccountId: this.id,
|
|
2579
2982
|
status: response.status,
|
|
2580
2983
|
statusReason: response.status_reason
|
|
@@ -2615,30 +3018,6 @@ var ConnectedAccounts = class {
|
|
|
2615
3018
|
this.client = client;
|
|
2616
3019
|
telemetry.instrument(this);
|
|
2617
3020
|
}
|
|
2618
|
-
transformConnectedAccountRetrieveResponse(response) {
|
|
2619
|
-
const result = ConnectedAccountRetrieveResponseSchema.safeParse({
|
|
2620
|
-
...response,
|
|
2621
|
-
userId: response.user_id,
|
|
2622
|
-
// Add the missing userId property
|
|
2623
|
-
authConfig: {
|
|
2624
|
-
...response.auth_config,
|
|
2625
|
-
authScheme: response.auth_config.auth_scheme,
|
|
2626
|
-
isComposioManaged: response.auth_config.is_composio_managed,
|
|
2627
|
-
isDisabled: response.auth_config.is_disabled
|
|
2628
|
-
},
|
|
2629
|
-
statusReason: response.status_reason,
|
|
2630
|
-
isDisabled: response.is_disabled,
|
|
2631
|
-
createdAt: response.created_at,
|
|
2632
|
-
updatedAt: response.updated_at,
|
|
2633
|
-
testRequestEndpoint: response.test_request_endpoint
|
|
2634
|
-
});
|
|
2635
|
-
if (!result.success) {
|
|
2636
|
-
throw new ValidationError("Failed to parse connected account retrieve response", {
|
|
2637
|
-
cause: result.error
|
|
2638
|
-
});
|
|
2639
|
-
}
|
|
2640
|
-
return result.data;
|
|
2641
|
-
}
|
|
2642
3021
|
/**
|
|
2643
3022
|
* Lists all connected accounts based on provided filter criteria.
|
|
2644
3023
|
*
|
|
@@ -2685,7 +3064,7 @@ var ConnectedAccounts = class {
|
|
|
2685
3064
|
}
|
|
2686
3065
|
const result = await this.client.connectedAccounts.list(rawQuery);
|
|
2687
3066
|
const parsedResponse = ConnectedAccountListResponseSchema.safeParse({
|
|
2688
|
-
items: result.items.map(
|
|
3067
|
+
items: result.items.map(transformConnectedAccountResponse),
|
|
2689
3068
|
nextCursor: result.next_cursor,
|
|
2690
3069
|
totalPages: result.total_pages
|
|
2691
3070
|
});
|
|
@@ -2696,21 +3075,6 @@ var ConnectedAccounts = class {
|
|
|
2696
3075
|
}
|
|
2697
3076
|
return parsedResponse.data;
|
|
2698
3077
|
}
|
|
2699
|
-
/**
|
|
2700
|
-
* Transforms connected account data from API format to SDK format.
|
|
2701
|
-
*
|
|
2702
|
-
* This method converts property names from snake_case to camelCase and reorganizes
|
|
2703
|
-
* the data structure to match the SDK's standardized format for connected accounts.
|
|
2704
|
-
*
|
|
2705
|
-
* @param {ConnectedAccountRetrieveResponseRaw} response - The raw API response to transform
|
|
2706
|
-
* @returns {ConnectedAccountRetrieveResponse} The transformed connected account data
|
|
2707
|
-
* @throws {ValidationError} If the response fails validation against the expected schema
|
|
2708
|
-
*
|
|
2709
|
-
* @private
|
|
2710
|
-
*/
|
|
2711
|
-
transformConnectedAccountResponse(response) {
|
|
2712
|
-
return this.transformConnectedAccountRetrieveResponse(response);
|
|
2713
|
-
}
|
|
2714
3078
|
/**
|
|
2715
3079
|
* Compound function to create a new connected account.
|
|
2716
3080
|
* This function creates a new connected account and returns a connection request.
|
|
@@ -2735,12 +3099,18 @@ var ConnectedAccounts = class {
|
|
|
2735
3099
|
id: authConfigId
|
|
2736
3100
|
},
|
|
2737
3101
|
connection: {
|
|
2738
|
-
|
|
3102
|
+
state: options?.state,
|
|
2739
3103
|
callback_url: options?.callbackUrl,
|
|
2740
3104
|
user_id: userId
|
|
2741
3105
|
}
|
|
2742
3106
|
});
|
|
2743
|
-
|
|
3107
|
+
const redirectUrl = typeof response.connectionData?.val?.redirectUrl === "string" ? response.connectionData.val.redirectUrl : null;
|
|
3108
|
+
return new ConnectionRequest(
|
|
3109
|
+
this.client,
|
|
3110
|
+
response.id,
|
|
3111
|
+
response.connectionData.val.status,
|
|
3112
|
+
redirectUrl
|
|
3113
|
+
);
|
|
2744
3114
|
}
|
|
2745
3115
|
/**
|
|
2746
3116
|
* Waits for a connection request to complete and become active.
|
|
@@ -2788,7 +3158,7 @@ var ConnectedAccounts = class {
|
|
|
2788
3158
|
*/
|
|
2789
3159
|
async get(nanoid) {
|
|
2790
3160
|
const response = await this.client.connectedAccounts.retrieve(nanoid);
|
|
2791
|
-
return
|
|
3161
|
+
return transformConnectedAccountResponse(response);
|
|
2792
3162
|
}
|
|
2793
3163
|
/**
|
|
2794
3164
|
* Deletes a connected account.
|
|
@@ -2833,14 +3203,14 @@ var ConnectedAccounts = class {
|
|
|
2833
3203
|
* @param {string} nanoid - Unique identifier of the connected account
|
|
2834
3204
|
* @param {ConnectedAccountUpdateStatusParams} params - Parameters for updating the status
|
|
2835
3205
|
* @returns {Promise<ConnectedAccountUpdateStatusResponse>} Updated connected account details
|
|
2836
|
-
*
|
|
3206
|
+
*
|
|
2837
3207
|
* @example
|
|
2838
3208
|
* ```typescript
|
|
2839
3209
|
* // Enable a connected account
|
|
2840
3210
|
* const updatedAccount = await composio.connectedAccounts.updateStatus('conn_abc123', {
|
|
2841
3211
|
* enabled: true
|
|
2842
3212
|
* });
|
|
2843
|
-
*
|
|
3213
|
+
*
|
|
2844
3214
|
* // Disable a connected account with a reason
|
|
2845
3215
|
* const disabledAccount = await composio.connectedAccounts.updateStatus('conn_abc123', {
|
|
2846
3216
|
* enabled: false,
|
|
@@ -2855,7 +3225,7 @@ var ConnectedAccounts = class {
|
|
|
2855
3225
|
* Enable a connected account
|
|
2856
3226
|
* @param {string} nanoid - Unique identifier of the connected account
|
|
2857
3227
|
* @returns {Promise<ConnectedAccountUpdateStatusResponse>} Updated connected account details
|
|
2858
|
-
*
|
|
3228
|
+
*
|
|
2859
3229
|
* @example
|
|
2860
3230
|
* ```typescript
|
|
2861
3231
|
* // Enable a previously disabled connected account
|
|
@@ -2870,13 +3240,13 @@ var ConnectedAccounts = class {
|
|
|
2870
3240
|
* Disable a connected account
|
|
2871
3241
|
* @param {string} nanoid - Unique identifier of the connected account
|
|
2872
3242
|
* @returns {Promise<ConnectedAccountUpdateStatusResponse>} Updated connected account details
|
|
2873
|
-
*
|
|
3243
|
+
*
|
|
2874
3244
|
* @example
|
|
2875
3245
|
* ```typescript
|
|
2876
3246
|
* // Disable a connected account
|
|
2877
3247
|
* const disabledAccount = await composio.connectedAccounts.disable('conn_abc123');
|
|
2878
3248
|
* console.log(disabledAccount.isDisabled); // true
|
|
2879
|
-
*
|
|
3249
|
+
*
|
|
2880
3250
|
* // You can also use updateStatus with a reason
|
|
2881
3251
|
* // const disabledAccount = await composio.connectedAccounts.updateStatus('conn_abc123', {
|
|
2882
3252
|
* // enabled: false,
|
|
@@ -3097,88 +3467,88 @@ var Toolkits = class {
|
|
|
3097
3467
|
};
|
|
3098
3468
|
|
|
3099
3469
|
// src/types/triggers.types.ts
|
|
3100
|
-
import { z as
|
|
3101
|
-
var TriggerStatusEnum =
|
|
3102
|
-
var TriggerSubscribeParamSchema =
|
|
3103
|
-
toolkits:
|
|
3104
|
-
triggerId:
|
|
3105
|
-
connectedAccountId:
|
|
3106
|
-
authConfigId:
|
|
3107
|
-
triggerSlug:
|
|
3108
|
-
triggerData:
|
|
3109
|
-
userId:
|
|
3470
|
+
import { z as z6 } from "zod";
|
|
3471
|
+
var TriggerStatusEnum = z6.enum(["enable", "disable"]);
|
|
3472
|
+
var TriggerSubscribeParamSchema = z6.object({
|
|
3473
|
+
toolkits: z6.array(z6.string()).optional(),
|
|
3474
|
+
triggerId: z6.string().optional(),
|
|
3475
|
+
connectedAccountId: z6.string().optional(),
|
|
3476
|
+
authConfigId: z6.string().optional(),
|
|
3477
|
+
triggerSlug: z6.array(z6.string()).optional(),
|
|
3478
|
+
triggerData: z6.string().optional(),
|
|
3479
|
+
userId: z6.string().optional()
|
|
3110
3480
|
});
|
|
3111
|
-
var TriggerInstanceListActiveParamsSchema =
|
|
3112
|
-
authConfigIds:
|
|
3113
|
-
connectedAccountIds:
|
|
3114
|
-
limit:
|
|
3115
|
-
page:
|
|
3116
|
-
showDisabled:
|
|
3117
|
-
triggerIds:
|
|
3118
|
-
triggerNames:
|
|
3481
|
+
var TriggerInstanceListActiveParamsSchema = z6.object({
|
|
3482
|
+
authConfigIds: z6.array(z6.string()).nullable().optional(),
|
|
3483
|
+
connectedAccountIds: z6.array(z6.string()).nullable().optional(),
|
|
3484
|
+
limit: z6.number().optional(),
|
|
3485
|
+
page: z6.number().optional(),
|
|
3486
|
+
showDisabled: z6.boolean().nullable().optional(),
|
|
3487
|
+
triggerIds: z6.array(z6.string()).nullable().optional(),
|
|
3488
|
+
triggerNames: z6.array(z6.string()).nullable().optional()
|
|
3119
3489
|
});
|
|
3120
|
-
var TriggerInstanceListActiveResponseItemSchema =
|
|
3121
|
-
id:
|
|
3122
|
-
connectedAccountId:
|
|
3123
|
-
disabledAt:
|
|
3124
|
-
state:
|
|
3125
|
-
triggerConfig:
|
|
3126
|
-
triggerName:
|
|
3127
|
-
updatedAt:
|
|
3128
|
-
triggerData:
|
|
3129
|
-
uuid:
|
|
3490
|
+
var TriggerInstanceListActiveResponseItemSchema = z6.object({
|
|
3491
|
+
id: z6.string(),
|
|
3492
|
+
connectedAccountId: z6.string(),
|
|
3493
|
+
disabledAt: z6.string().nullable(),
|
|
3494
|
+
state: z6.record(z6.unknown()),
|
|
3495
|
+
triggerConfig: z6.record(z6.unknown()),
|
|
3496
|
+
triggerName: z6.string(),
|
|
3497
|
+
updatedAt: z6.string(),
|
|
3498
|
+
triggerData: z6.string().optional(),
|
|
3499
|
+
uuid: z6.string().optional()
|
|
3130
3500
|
});
|
|
3131
|
-
var TriggerInstanceListActiveResponseSchema =
|
|
3132
|
-
items:
|
|
3133
|
-
nextCursor:
|
|
3134
|
-
totalPages:
|
|
3501
|
+
var TriggerInstanceListActiveResponseSchema = z6.object({
|
|
3502
|
+
items: z6.array(TriggerInstanceListActiveResponseItemSchema),
|
|
3503
|
+
nextCursor: z6.string().nullable(),
|
|
3504
|
+
totalPages: z6.number()
|
|
3135
3505
|
});
|
|
3136
|
-
var TriggerInstanceUpsertParamsSchema =
|
|
3137
|
-
connectedAccountId:
|
|
3138
|
-
triggerConfig:
|
|
3506
|
+
var TriggerInstanceUpsertParamsSchema = z6.object({
|
|
3507
|
+
connectedAccountId: z6.string().optional(),
|
|
3508
|
+
triggerConfig: z6.record(z6.unknown()).optional()
|
|
3139
3509
|
});
|
|
3140
|
-
var TriggerInstanceUpsertResponseSchema =
|
|
3141
|
-
triggerId:
|
|
3510
|
+
var TriggerInstanceUpsertResponseSchema = z6.object({
|
|
3511
|
+
triggerId: z6.string()
|
|
3142
3512
|
});
|
|
3143
|
-
var TriggerInstanceManageUpdateParamsSchema =
|
|
3144
|
-
status:
|
|
3513
|
+
var TriggerInstanceManageUpdateParamsSchema = z6.object({
|
|
3514
|
+
status: z6.enum(["enable", "disable"])
|
|
3145
3515
|
});
|
|
3146
|
-
var TriggerInstanceManageUpdateResponseSchema =
|
|
3147
|
-
status:
|
|
3516
|
+
var TriggerInstanceManageUpdateResponseSchema = z6.object({
|
|
3517
|
+
status: z6.enum(["success"])
|
|
3148
3518
|
});
|
|
3149
|
-
var TriggerInstanceManageDeleteResponseSchema =
|
|
3150
|
-
triggerId:
|
|
3519
|
+
var TriggerInstanceManageDeleteResponseSchema = z6.object({
|
|
3520
|
+
triggerId: z6.string()
|
|
3151
3521
|
});
|
|
3152
|
-
var IncomingTriggerPayloadSchema =
|
|
3153
|
-
id:
|
|
3154
|
-
triggerSlug:
|
|
3155
|
-
toolkitSlug:
|
|
3156
|
-
userId:
|
|
3157
|
-
payload:
|
|
3158
|
-
originalPayload:
|
|
3159
|
-
metadata:
|
|
3160
|
-
id:
|
|
3161
|
-
toolkitSlug:
|
|
3162
|
-
triggerSlug:
|
|
3163
|
-
triggerData:
|
|
3164
|
-
triggerConfig:
|
|
3165
|
-
connectedAccount:
|
|
3166
|
-
id:
|
|
3167
|
-
uuid:
|
|
3168
|
-
authConfigId:
|
|
3169
|
-
authConfigUUID:
|
|
3170
|
-
userId:
|
|
3171
|
-
status:
|
|
3522
|
+
var IncomingTriggerPayloadSchema = z6.object({
|
|
3523
|
+
id: z6.string().describe("The ID of the trigger"),
|
|
3524
|
+
triggerSlug: z6.string().describe("The slug of the trigger that triggered the event"),
|
|
3525
|
+
toolkitSlug: z6.string().describe("The slug of the toolkit that triggered the event"),
|
|
3526
|
+
userId: z6.string().describe("The ID of the user that triggered the event"),
|
|
3527
|
+
payload: z6.record(z6.unknown()).describe("The payload of the trigger").optional(),
|
|
3528
|
+
originalPayload: z6.record(z6.unknown()).describe("The original payload of the trigger").optional(),
|
|
3529
|
+
metadata: z6.object({
|
|
3530
|
+
id: z6.string(),
|
|
3531
|
+
toolkitSlug: z6.string(),
|
|
3532
|
+
triggerSlug: z6.string(),
|
|
3533
|
+
triggerData: z6.string().optional(),
|
|
3534
|
+
triggerConfig: z6.record(z6.unknown()),
|
|
3535
|
+
connectedAccount: z6.object({
|
|
3536
|
+
id: z6.string(),
|
|
3537
|
+
uuid: z6.string(),
|
|
3538
|
+
authConfigId: z6.string(),
|
|
3539
|
+
authConfigUUID: z6.string(),
|
|
3540
|
+
userId: z6.string(),
|
|
3541
|
+
status: z6.enum(["ACTIVE", "INACTIVE"])
|
|
3172
3542
|
})
|
|
3173
3543
|
})
|
|
3174
3544
|
});
|
|
3175
3545
|
|
|
3176
3546
|
// src/services/internal/InternalService.types.ts
|
|
3177
|
-
import { z as
|
|
3178
|
-
var SDKRealtimeCredentialsResponseSchema =
|
|
3179
|
-
projectId:
|
|
3180
|
-
pusherKey:
|
|
3181
|
-
pusherCluster:
|
|
3547
|
+
import { z as z7 } from "zod";
|
|
3548
|
+
var SDKRealtimeCredentialsResponseSchema = z7.object({
|
|
3549
|
+
projectId: z7.string().describe("The project ID"),
|
|
3550
|
+
pusherKey: z7.string().describe("The Pusher key"),
|
|
3551
|
+
pusherCluster: z7.string().describe("The Pusher cluster")
|
|
3182
3552
|
});
|
|
3183
3553
|
|
|
3184
3554
|
// src/services/internal/InternalService.ts
|
|
@@ -3544,12 +3914,12 @@ var Triggers = class {
|
|
|
3544
3914
|
/**
|
|
3545
3915
|
* Update an existing trigger instance
|
|
3546
3916
|
*
|
|
3547
|
-
* @param {string}
|
|
3548
|
-
* @param {TriggerInstanceManageUpdateParams} body - The parameters to
|
|
3549
|
-
* @returns {Promise<
|
|
3917
|
+
* @param {string} triggerId - The Id of the trigger instance
|
|
3918
|
+
* @param {TriggerInstanceManageUpdateParams} body - The parameters to update the trigger instance
|
|
3919
|
+
* @returns {Promise<TriggerInstanceManageUpdateResponse>} The updated trigger instance response
|
|
3550
3920
|
*/
|
|
3551
|
-
async update(
|
|
3552
|
-
return this.client.triggerInstances.manage.update(
|
|
3921
|
+
async update(triggerId, body) {
|
|
3922
|
+
return this.client.triggerInstances.manage.update(triggerId, body);
|
|
3553
3923
|
}
|
|
3554
3924
|
/**
|
|
3555
3925
|
* Delete a trigger instance
|
|
@@ -4271,10 +4641,10 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
4271
4641
|
};
|
|
4272
4642
|
|
|
4273
4643
|
// package.json
|
|
4274
|
-
var version = "0.1.
|
|
4644
|
+
var version = "0.1.13";
|
|
4275
4645
|
|
|
4276
4646
|
// src/composio.ts
|
|
4277
|
-
var Composio = class {
|
|
4647
|
+
var Composio = class _Composio {
|
|
4278
4648
|
/**
|
|
4279
4649
|
* The Composio API client.
|
|
4280
4650
|
* @type {ComposioClient}
|
|
@@ -4298,10 +4668,10 @@ var Composio = class {
|
|
|
4298
4668
|
connectedAccounts;
|
|
4299
4669
|
/**
|
|
4300
4670
|
* Creates a new instance of the Composio SDK.
|
|
4301
|
-
*
|
|
4671
|
+
*
|
|
4302
4672
|
* The constructor initializes the SDK with the provided configuration options,
|
|
4303
4673
|
* sets up the API client, and initializes all core models (tools, toolkits, etc.).
|
|
4304
|
-
*
|
|
4674
|
+
*
|
|
4305
4675
|
* @param {ComposioConfig<TProvider>} config - Configuration options for the Composio SDK
|
|
4306
4676
|
* @param {string} [config.apiKey] - The API key for authenticating with the Composio API
|
|
4307
4677
|
* @param {string} [config.baseURL] - The base URL for the Composio API (defaults to production URL)
|
|
@@ -4309,18 +4679,18 @@ var Composio = class {
|
|
|
4309
4679
|
* @param {boolean} [config.allowTracing=true] - Whether to allow request tracing for debugging
|
|
4310
4680
|
* @param {TProvider} [config.provider] - The provider to use for this Composio instance (defaults to OpenAIProvider)
|
|
4311
4681
|
* @param {BaseTelemetryTransport} [config.telemetryTransport] - Custom telemetry transport implementation
|
|
4312
|
-
*
|
|
4682
|
+
*
|
|
4313
4683
|
* @example
|
|
4314
4684
|
* ```typescript
|
|
4315
4685
|
* // Initialize with default configuration
|
|
4316
4686
|
* const composio = new Composio();
|
|
4317
|
-
*
|
|
4687
|
+
*
|
|
4318
4688
|
* // Initialize with custom API key and base URL
|
|
4319
4689
|
* const composio = new Composio({
|
|
4320
4690
|
* apiKey: 'your-api-key',
|
|
4321
4691
|
* baseURL: 'https://api.composio.dev'
|
|
4322
4692
|
* });
|
|
4323
|
-
*
|
|
4693
|
+
*
|
|
4324
4694
|
* // Initialize with custom provider
|
|
4325
4695
|
* const composio = new Composio({
|
|
4326
4696
|
* apiKey: 'your-api-key',
|
|
@@ -4338,7 +4708,9 @@ var Composio = class {
|
|
|
4338
4708
|
}
|
|
4339
4709
|
this.client = new ComposioClient3({
|
|
4340
4710
|
apiKey: apiKeyParsed,
|
|
4341
|
-
baseURL: baseURLParsed
|
|
4711
|
+
baseURL: baseURLParsed,
|
|
4712
|
+
defaultHeaders: config?.defaultHeaders,
|
|
4713
|
+
logLevel: process.env.COMPOSIO_LOG_LEVEL ?? void 0
|
|
4342
4714
|
});
|
|
4343
4715
|
this.config = {
|
|
4344
4716
|
...config,
|
|
@@ -4384,6 +4756,46 @@ var Composio = class {
|
|
|
4384
4756
|
}
|
|
4385
4757
|
return this.client;
|
|
4386
4758
|
}
|
|
4759
|
+
/**
|
|
4760
|
+
* Creates a new instance of the Composio SDK with custom request options while preserving the existing configuration.
|
|
4761
|
+
* This method is particularly useful when you need to:
|
|
4762
|
+
* - Add custom headers for specific requests
|
|
4763
|
+
* - Track request contexts with unique identifiers
|
|
4764
|
+
* - Override default request behavior for a subset of operations
|
|
4765
|
+
*
|
|
4766
|
+
* The new instance inherits all configuration from the parent instance (apiKey, baseURL, provider, etc.)
|
|
4767
|
+
* but allows you to specify custom request options that will be used for all API calls made through this session.
|
|
4768
|
+
*
|
|
4769
|
+
* @param {MergedRequestInit} fetchOptions - Custom request options to be used for all API calls in this session.
|
|
4770
|
+
* This follows the Fetch API RequestInit interface with additional options.
|
|
4771
|
+
* @returns {Composio<TProvider>} A new Composio instance with the custom request options applied.
|
|
4772
|
+
*
|
|
4773
|
+
* @example
|
|
4774
|
+
* ```typescript
|
|
4775
|
+
* // Create a base Composio instance
|
|
4776
|
+
* const composio = new Composio({
|
|
4777
|
+
* apiKey: 'your-api-key'
|
|
4778
|
+
* });
|
|
4779
|
+
*
|
|
4780
|
+
* // Create a session with request tracking headers
|
|
4781
|
+
* const composioWithCustomHeaders = composio.createSession({
|
|
4782
|
+
* headers: {
|
|
4783
|
+
* 'x-request-id': '1234567890',
|
|
4784
|
+
* 'x-correlation-id': 'session-abc-123',
|
|
4785
|
+
* 'x-custom-header': 'custom-value'
|
|
4786
|
+
* }
|
|
4787
|
+
* });
|
|
4788
|
+
*
|
|
4789
|
+
* // Use the session for making API calls with the custom headers
|
|
4790
|
+
* await composioWithCustomHeaders.tools.list();
|
|
4791
|
+
* ```
|
|
4792
|
+
*/
|
|
4793
|
+
createSession(options) {
|
|
4794
|
+
return new _Composio({
|
|
4795
|
+
...this.config,
|
|
4796
|
+
defaultHeaders: options?.headers
|
|
4797
|
+
});
|
|
4798
|
+
}
|
|
4387
4799
|
};
|
|
4388
4800
|
|
|
4389
4801
|
// src/provider/ComposioProvider.ts
|
|
@@ -4409,39 +4821,39 @@ var ConsoleTelemetryTransport = class {
|
|
|
4409
4821
|
};
|
|
4410
4822
|
|
|
4411
4823
|
// src/utils/jsonSchema.ts
|
|
4412
|
-
import { z as
|
|
4824
|
+
import { z as z8 } from "zod";
|
|
4413
4825
|
function jsonSchemaPropertiesToTSTypes(value) {
|
|
4414
4826
|
if (!value.type) {
|
|
4415
|
-
return
|
|
4827
|
+
return z8.object({});
|
|
4416
4828
|
}
|
|
4417
4829
|
let zodType;
|
|
4418
4830
|
switch (value.type) {
|
|
4419
4831
|
case "string":
|
|
4420
|
-
zodType =
|
|
4832
|
+
zodType = z8.string().describe(
|
|
4421
4833
|
(value.description || "") + (value.examples ? `
|
|
4422
4834
|
Examples: ${value.examples.join(", ")}` : "")
|
|
4423
4835
|
);
|
|
4424
4836
|
break;
|
|
4425
4837
|
case "number":
|
|
4426
|
-
zodType =
|
|
4838
|
+
zodType = z8.number().describe(
|
|
4427
4839
|
(value.description || "") + (value.examples ? `
|
|
4428
4840
|
Examples: ${value.examples.join(", ")}` : "")
|
|
4429
4841
|
);
|
|
4430
4842
|
break;
|
|
4431
4843
|
case "integer":
|
|
4432
|
-
zodType =
|
|
4844
|
+
zodType = z8.number().int().describe(
|
|
4433
4845
|
(value.description || "") + (value.examples ? `
|
|
4434
4846
|
Examples: ${value.examples.join(", ")}` : "")
|
|
4435
4847
|
);
|
|
4436
4848
|
break;
|
|
4437
4849
|
case "boolean":
|
|
4438
|
-
zodType =
|
|
4850
|
+
zodType = z8.boolean().describe(
|
|
4439
4851
|
(value.description || "") + (value.examples ? `
|
|
4440
4852
|
Examples: ${value.examples.join(", ")}` : "")
|
|
4441
4853
|
);
|
|
4442
4854
|
break;
|
|
4443
4855
|
case "array":
|
|
4444
|
-
zodType =
|
|
4856
|
+
zodType = z8.array(
|
|
4445
4857
|
jsonSchemaPropertiesToTSTypes(
|
|
4446
4858
|
value.items
|
|
4447
4859
|
)
|
|
@@ -4457,7 +4869,7 @@ Examples: ${value.examples.join(", ")}` : "")
|
|
|
4457
4869
|
);
|
|
4458
4870
|
break;
|
|
4459
4871
|
case "null":
|
|
4460
|
-
zodType =
|
|
4872
|
+
zodType = z8.null().describe(value.description || "");
|
|
4461
4873
|
break;
|
|
4462
4874
|
default:
|
|
4463
4875
|
throw new Error(`Unsupported JSON schema type: ${value.type}`);
|
|
@@ -4468,7 +4880,7 @@ function jsonSchemaToZodSchema(jsonSchema) {
|
|
|
4468
4880
|
const properties = jsonSchema.properties;
|
|
4469
4881
|
const requiredFields = jsonSchema.required || [];
|
|
4470
4882
|
if (!properties) {
|
|
4471
|
-
return
|
|
4883
|
+
return z8.object({});
|
|
4472
4884
|
}
|
|
4473
4885
|
const zodSchema = {};
|
|
4474
4886
|
for (const [key, _] of Object.entries(properties)) {
|
|
@@ -4480,7 +4892,7 @@ function jsonSchemaToZodSchema(jsonSchema) {
|
|
|
4480
4892
|
schema
|
|
4481
4893
|
)
|
|
4482
4894
|
);
|
|
4483
|
-
zodType =
|
|
4895
|
+
zodType = z8.union(anyOfTypes).describe(
|
|
4484
4896
|
(value.description || "") + (value.examples ? `
|
|
4485
4897
|
Examples: ${value.examples.join(", ")}` : "")
|
|
4486
4898
|
);
|
|
@@ -4490,7 +4902,7 @@ Examples: ${value.examples.join(", ")}` : "")
|
|
|
4490
4902
|
schema
|
|
4491
4903
|
)
|
|
4492
4904
|
);
|
|
4493
|
-
zodType =
|
|
4905
|
+
zodType = z8.intersection(
|
|
4494
4906
|
allOfTypes[0],
|
|
4495
4907
|
allOfTypes.slice(1).reduce((acc, schema) => acc.and(schema), allOfTypes[0])
|
|
4496
4908
|
).describe(
|
|
@@ -4514,7 +4926,7 @@ Examples: ${value.examples.join(", ")}` : "")
|
|
|
4514
4926
|
zodSchema[key] = zodType.optional();
|
|
4515
4927
|
}
|
|
4516
4928
|
}
|
|
4517
|
-
return
|
|
4929
|
+
return z8.object(zodSchema);
|
|
4518
4930
|
}
|
|
4519
4931
|
export {
|
|
4520
4932
|
AuthConfigErrorCodes,
|