@composio/core 0.1.4-alpha.0 → 0.1.8-alpha.0
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 +285 -121
- package/dist/index.d.cts +309 -36
- package/dist/index.d.ts +309 -36
- package/dist/index.js +283 -121
- package/package.json +3 -5
package/dist/index.cjs
CHANGED
|
@@ -30,6 +30,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
AuthConfigTypes: () => AuthConfigTypes,
|
|
34
|
+
AuthSchemeTypes: () => AuthSchemeTypes,
|
|
33
35
|
BaseAgenticToolset: () => BaseAgenticToolset,
|
|
34
36
|
BaseNonAgenticToolset: () => BaseNonAgenticToolset,
|
|
35
37
|
BaseTelemetryTransport: () => BaseTelemetryTransport,
|
|
@@ -71,7 +73,7 @@ var ToolListParamsSchema = import_zod.z.object({
|
|
|
71
73
|
important: import_zod.z.string().optional(),
|
|
72
74
|
limit: import_zod.z.string().optional(),
|
|
73
75
|
search: import_zod.z.string().optional(),
|
|
74
|
-
toolkits: import_zod.z.string().optional(),
|
|
76
|
+
toolkits: import_zod.z.array(import_zod.z.string()).optional(),
|
|
75
77
|
tools: import_zod.z.array(import_zod.z.string()).optional()
|
|
76
78
|
});
|
|
77
79
|
var CustomAuthParamsSchema = import_zod.z.object({
|
|
@@ -436,7 +438,7 @@ var Tools = class {
|
|
|
436
438
|
important: queryParams.data.important,
|
|
437
439
|
limit: queryParams.data.limit,
|
|
438
440
|
search: queryParams.data.search,
|
|
439
|
-
toolkit_slug: queryParams.data.toolkits,
|
|
441
|
+
toolkit_slug: queryParams.data.toolkits?.join(","),
|
|
440
442
|
tool_slugs: queryParams.data.tools?.join(",")
|
|
441
443
|
});
|
|
442
444
|
if (!tools) {
|
|
@@ -1013,30 +1015,174 @@ var Triggers = class {
|
|
|
1013
1015
|
}
|
|
1014
1016
|
};
|
|
1015
1017
|
|
|
1018
|
+
// src/types/authConfigs.types.ts
|
|
1019
|
+
var import_zod3 = require("zod");
|
|
1020
|
+
var AuthConfigTypes = {
|
|
1021
|
+
CUSTOM: "use_custom_auth",
|
|
1022
|
+
COMPOSIO_MANAGED: "use_composio_managed_auth"
|
|
1023
|
+
};
|
|
1024
|
+
var AuthSchemeTypes = {
|
|
1025
|
+
OAUTH2: "OAUTH2",
|
|
1026
|
+
OAUTH1: "OAUTH1",
|
|
1027
|
+
OAUTH1A: "OAUTH1A",
|
|
1028
|
+
API_KEY: "API_KEY",
|
|
1029
|
+
BASIC: "BASIC",
|
|
1030
|
+
BILLCOM_AUTH: "BILLCOM_AUTH",
|
|
1031
|
+
BEARER_TOKEN: "BEARER_TOKEN",
|
|
1032
|
+
GOOGLE_SERVICE_ACCOUNT: "GOOGLE_SERVICE_ACCOUNT",
|
|
1033
|
+
NO_AUTH: "NO_AUTH",
|
|
1034
|
+
BASIC_WITH_JWT: "BASIC_WITH_JWT",
|
|
1035
|
+
COMPOSIO_LINK: "COMPOSIO_LINK",
|
|
1036
|
+
CALCOM_AUTH: "CALCOM_AUTH",
|
|
1037
|
+
SNOWFLAKE: "SNOWFLAKE"
|
|
1038
|
+
};
|
|
1039
|
+
var AuthSchemeEnum = import_zod3.z.enum([
|
|
1040
|
+
"OAUTH2",
|
|
1041
|
+
"OAUTH1",
|
|
1042
|
+
"OAUTH1A",
|
|
1043
|
+
"API_KEY",
|
|
1044
|
+
"BASIC",
|
|
1045
|
+
"BILLCOM_AUTH",
|
|
1046
|
+
"BEARER_TOKEN",
|
|
1047
|
+
"GOOGLE_SERVICE_ACCOUNT",
|
|
1048
|
+
"NO_AUTH",
|
|
1049
|
+
"BASIC_WITH_JWT",
|
|
1050
|
+
"COMPOSIO_LINK",
|
|
1051
|
+
"CALCOM_AUTH",
|
|
1052
|
+
"SNOWFLAKE"
|
|
1053
|
+
]);
|
|
1054
|
+
var CreateCustomAuthConfigParamsSchema = import_zod3.z.object({
|
|
1055
|
+
type: import_zod3.z.literal("use_custom_auth"),
|
|
1056
|
+
name: import_zod3.z.string().optional(),
|
|
1057
|
+
credentials: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.union([import_zod3.z.string(), import_zod3.z.number(), import_zod3.z.boolean()])),
|
|
1058
|
+
authScheme: AuthSchemeEnum
|
|
1059
|
+
});
|
|
1060
|
+
var CreateComposioManagedAuthConfigParamsSchema = import_zod3.z.object({
|
|
1061
|
+
type: import_zod3.z.literal("use_composio_managed_auth"),
|
|
1062
|
+
name: import_zod3.z.string().optional(),
|
|
1063
|
+
credentials: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.union([import_zod3.z.string(), import_zod3.z.number(), import_zod3.z.boolean()])).optional()
|
|
1064
|
+
});
|
|
1065
|
+
var CreateAuthConfigParamsSchema = import_zod3.z.discriminatedUnion("type", [
|
|
1066
|
+
CreateCustomAuthConfigParamsSchema,
|
|
1067
|
+
CreateComposioManagedAuthConfigParamsSchema
|
|
1068
|
+
]);
|
|
1069
|
+
var CreateAuthConfigResponseSchema = import_zod3.z.object({
|
|
1070
|
+
id: import_zod3.z.string(),
|
|
1071
|
+
authScheme: import_zod3.z.string(),
|
|
1072
|
+
isComposioManaged: import_zod3.z.boolean(),
|
|
1073
|
+
toolkit: import_zod3.z.string()
|
|
1074
|
+
});
|
|
1075
|
+
var AuthConfigRetrieveResponseSchema = import_zod3.z.object({
|
|
1076
|
+
id: import_zod3.z.string(),
|
|
1077
|
+
name: import_zod3.z.string(),
|
|
1078
|
+
toolkit: import_zod3.z.object({
|
|
1079
|
+
logo: import_zod3.z.string(),
|
|
1080
|
+
slug: import_zod3.z.string()
|
|
1081
|
+
}),
|
|
1082
|
+
noOfConnections: import_zod3.z.number(),
|
|
1083
|
+
status: import_zod3.z.enum(["ENABLED", "DISABLED"]),
|
|
1084
|
+
uuid: import_zod3.z.string(),
|
|
1085
|
+
authScheme: AuthSchemeEnum.optional(),
|
|
1086
|
+
credentials: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.union([import_zod3.z.string(), import_zod3.z.number(), import_zod3.z.boolean()])),
|
|
1087
|
+
expectedInputFields: import_zod3.z.array(import_zod3.z.unknown()).optional(),
|
|
1088
|
+
isComposioManaged: import_zod3.z.boolean().optional(),
|
|
1089
|
+
createdBy: import_zod3.z.string().optional(),
|
|
1090
|
+
createdAt: import_zod3.z.string().optional(),
|
|
1091
|
+
lastUpdatedAt: import_zod3.z.string().optional()
|
|
1092
|
+
});
|
|
1093
|
+
var AuthConfigListParamsSchema = import_zod3.z.object({
|
|
1094
|
+
cursor: import_zod3.z.string().optional(),
|
|
1095
|
+
isComposioManaged: import_zod3.z.boolean().optional(),
|
|
1096
|
+
limit: import_zod3.z.number().optional(),
|
|
1097
|
+
toolkitSlug: import_zod3.z.string().optional()
|
|
1098
|
+
});
|
|
1099
|
+
var AuthConfigListResponseSchema = import_zod3.z.object({
|
|
1100
|
+
items: import_zod3.z.array(AuthConfigRetrieveResponseSchema),
|
|
1101
|
+
nextCursor: import_zod3.z.string().optional(),
|
|
1102
|
+
totalPages: import_zod3.z.number()
|
|
1103
|
+
});
|
|
1104
|
+
var AuthConfigUpdateParamsSchema = import_zod3.z.object({
|
|
1105
|
+
credentials: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.union([import_zod3.z.string(), import_zod3.z.number(), import_zod3.z.boolean()]))
|
|
1106
|
+
});
|
|
1107
|
+
|
|
1016
1108
|
// src/models/AuthConfigs.ts
|
|
1017
1109
|
var AuthConfigs = class {
|
|
1018
|
-
FILE_NAME = "core/models/AuthConfigs.ts";
|
|
1019
1110
|
client;
|
|
1020
1111
|
constructor(client) {
|
|
1021
1112
|
this.client = client;
|
|
1022
1113
|
}
|
|
1114
|
+
parseAuthConfigRetrieveResponse(authConfig) {
|
|
1115
|
+
return AuthConfigRetrieveResponseSchema.parse({
|
|
1116
|
+
id: authConfig.id,
|
|
1117
|
+
name: authConfig.name,
|
|
1118
|
+
noOfConnections: authConfig.no_of_connections,
|
|
1119
|
+
status: authConfig.status,
|
|
1120
|
+
toolkit: {
|
|
1121
|
+
logo: authConfig.toolkit.logo,
|
|
1122
|
+
slug: authConfig.toolkit.slug
|
|
1123
|
+
},
|
|
1124
|
+
uuid: authConfig.uuid,
|
|
1125
|
+
authScheme: authConfig.auth_scheme,
|
|
1126
|
+
credentials: authConfig.credentials,
|
|
1127
|
+
expectedInputFields: authConfig.expected_input_fields,
|
|
1128
|
+
isComposioManaged: authConfig.is_composio_managed,
|
|
1129
|
+
createdBy: authConfig.created_by,
|
|
1130
|
+
createdAt: authConfig.created_at,
|
|
1131
|
+
lastUpdatedAt: authConfig.last_updated_at
|
|
1132
|
+
});
|
|
1133
|
+
}
|
|
1023
1134
|
/**
|
|
1024
1135
|
* List all auth configs
|
|
1025
1136
|
* @param {AuthConfigListParams} query - Query parameters for filtering auth configs
|
|
1026
1137
|
* @param {RequestOptions} options - Request options
|
|
1027
1138
|
* @returns {Promise<AuthConfigListResponse>} List of auth configs
|
|
1028
1139
|
*/
|
|
1029
|
-
async list(query
|
|
1030
|
-
|
|
1140
|
+
async list(query) {
|
|
1141
|
+
const parsedQuery = query ? AuthConfigListParamsSchema.parse(query) : void 0;
|
|
1142
|
+
const result = await this.client.authConfigs.list({
|
|
1143
|
+
cursor: parsedQuery?.cursor,
|
|
1144
|
+
is_composio_managed: parsedQuery?.isComposioManaged,
|
|
1145
|
+
limit: parsedQuery?.limit?.toString(),
|
|
1146
|
+
toolkit_slug: parsedQuery?.toolkitSlug
|
|
1147
|
+
});
|
|
1148
|
+
return AuthConfigListResponseSchema.parse({
|
|
1149
|
+
items: result.items.map((item) => this.parseAuthConfigRetrieveResponse(item)),
|
|
1150
|
+
nextCursor: result.next_cursor,
|
|
1151
|
+
totalPages: result.total_pages
|
|
1152
|
+
});
|
|
1031
1153
|
}
|
|
1032
1154
|
/**
|
|
1033
1155
|
* Create a new auth config
|
|
1034
|
-
* @param {
|
|
1035
|
-
* @param {
|
|
1036
|
-
* @returns {Promise<
|
|
1156
|
+
* @param {string} toolkit - Unique identifier of the toolkit
|
|
1157
|
+
* @param {CreateAuthConfigParams} options - Options for creating a new auth config
|
|
1158
|
+
* @returns {Promise<CreateAuthConfigResponse>} Created auth config
|
|
1159
|
+
*
|
|
1160
|
+
* @example
|
|
1161
|
+
* const authConfig = await authConfigs.create('my-toolkit', {
|
|
1162
|
+
* type: AuthConfigTypes.CUSTOM,
|
|
1163
|
+
* name: 'My Custom Auth Config',
|
|
1164
|
+
* authScheme: AuthSchemeTypes.API_KEY,
|
|
1165
|
+
* credentials: {
|
|
1166
|
+
* apiKey: '1234567890',
|
|
1167
|
+
* },
|
|
1168
|
+
* });
|
|
1169
|
+
*
|
|
1170
|
+
* @link https://docs.composio.dev/reference/auth-configs/create-auth-config
|
|
1037
1171
|
*/
|
|
1038
|
-
async create(
|
|
1039
|
-
|
|
1172
|
+
async create(toolkit, options) {
|
|
1173
|
+
const parsedOptions = CreateAuthConfigParamsSchema.parse(options);
|
|
1174
|
+
const result = await this.client.authConfigs.create({
|
|
1175
|
+
toolkit: {
|
|
1176
|
+
slug: toolkit
|
|
1177
|
+
},
|
|
1178
|
+
auth_config: parsedOptions
|
|
1179
|
+
});
|
|
1180
|
+
return CreateAuthConfigResponseSchema.parse({
|
|
1181
|
+
id: result.auth_config.id,
|
|
1182
|
+
authScheme: result.auth_config.auth_scheme,
|
|
1183
|
+
isComposioManaged: result.auth_config.is_composio_managed,
|
|
1184
|
+
toolkit: result.toolkit.slug
|
|
1185
|
+
});
|
|
1040
1186
|
}
|
|
1041
1187
|
/**
|
|
1042
1188
|
* Get an auth config by nanoid
|
|
@@ -1044,8 +1190,9 @@ var AuthConfigs = class {
|
|
|
1044
1190
|
* @param {RequestOptions} options - Request options
|
|
1045
1191
|
* @returns {Promise<AuthConfigRetrieveResponse>} Auth config details
|
|
1046
1192
|
*/
|
|
1047
|
-
async get(nanoid
|
|
1048
|
-
|
|
1193
|
+
async get(nanoid) {
|
|
1194
|
+
const result = await this.client.authConfigs.retrieve(nanoid);
|
|
1195
|
+
return this.parseAuthConfigRetrieveResponse(result);
|
|
1049
1196
|
}
|
|
1050
1197
|
/**
|
|
1051
1198
|
* Update an auth config
|
|
@@ -1054,8 +1201,12 @@ var AuthConfigs = class {
|
|
|
1054
1201
|
* @param {RequestOptions} options - Request options
|
|
1055
1202
|
* @returns {Promise<AuthConfigUpdateResponse>} Updated auth config
|
|
1056
1203
|
*/
|
|
1057
|
-
async update(nanoid, data
|
|
1058
|
-
return this.client.authConfigs.update(nanoid,
|
|
1204
|
+
async update(nanoid, data) {
|
|
1205
|
+
return this.client.authConfigs.update(nanoid, {
|
|
1206
|
+
auth_config: {
|
|
1207
|
+
credentials: data.credentials
|
|
1208
|
+
}
|
|
1209
|
+
});
|
|
1059
1210
|
}
|
|
1060
1211
|
/**
|
|
1061
1212
|
* Delete an auth config
|
|
@@ -1063,8 +1214,8 @@ var AuthConfigs = class {
|
|
|
1063
1214
|
* @param {RequestOptions} options - Request options
|
|
1064
1215
|
* @returns {Promise<AuthConfigDeleteResponse>} Response from deletion
|
|
1065
1216
|
*/
|
|
1066
|
-
async delete(nanoid
|
|
1067
|
-
return this.client.authConfigs.delete(nanoid
|
|
1217
|
+
async delete(nanoid) {
|
|
1218
|
+
return this.client.authConfigs.delete(nanoid);
|
|
1068
1219
|
}
|
|
1069
1220
|
/**
|
|
1070
1221
|
* Update the status of an auth config
|
|
@@ -1073,8 +1224,8 @@ var AuthConfigs = class {
|
|
|
1073
1224
|
* @param {RequestOptions} options - Request options
|
|
1074
1225
|
* @returns {Promise<AuthConfigUpdateStatusResponse>} Updated auth config details
|
|
1075
1226
|
*/
|
|
1076
|
-
async updateStatus(status, nanoid
|
|
1077
|
-
return this.client.authConfigs.updateStatus(status, { nanoid }
|
|
1227
|
+
async updateStatus(status, nanoid) {
|
|
1228
|
+
return this.client.authConfigs.updateStatus(status, { nanoid });
|
|
1078
1229
|
}
|
|
1079
1230
|
/**
|
|
1080
1231
|
* Enable an auth config
|
|
@@ -1082,8 +1233,8 @@ var AuthConfigs = class {
|
|
|
1082
1233
|
* @param {RequestOptions} options - Request options
|
|
1083
1234
|
* @returns {Promise<AuthConfigUpdateStatusResponse>} Updated auth config details
|
|
1084
1235
|
*/
|
|
1085
|
-
async enable(nanoid
|
|
1086
|
-
return this.client.authConfigs.updateStatus("ENABLED", { nanoid }
|
|
1236
|
+
async enable(nanoid) {
|
|
1237
|
+
return this.client.authConfigs.updateStatus("ENABLED", { nanoid });
|
|
1087
1238
|
}
|
|
1088
1239
|
/**
|
|
1089
1240
|
* Disable an auth config
|
|
@@ -1091,13 +1242,13 @@ var AuthConfigs = class {
|
|
|
1091
1242
|
* @param {RequestOptions} options - Request options
|
|
1092
1243
|
* @returns {Promise<AuthConfigUpdateStatusResponse>} Updated auth config details
|
|
1093
1244
|
*/
|
|
1094
|
-
async disable(nanoid
|
|
1095
|
-
return this.client.authConfigs.updateStatus("DISABLED", { nanoid }
|
|
1245
|
+
async disable(nanoid) {
|
|
1246
|
+
return this.client.authConfigs.updateStatus("DISABLED", { nanoid });
|
|
1096
1247
|
}
|
|
1097
1248
|
};
|
|
1098
1249
|
|
|
1099
1250
|
// src/types/connectedAccounts.types.ts
|
|
1100
|
-
var
|
|
1251
|
+
var import_zod4 = require("zod");
|
|
1101
1252
|
var ConnectedAccountStatuses = {
|
|
1102
1253
|
ACTIVE: "ACTIVE",
|
|
1103
1254
|
INACTIVE: "INACTIVE",
|
|
@@ -1106,7 +1257,7 @@ var ConnectedAccountStatuses = {
|
|
|
1106
1257
|
EXPIRED: "EXPIRED",
|
|
1107
1258
|
FAILED: "FAILED"
|
|
1108
1259
|
};
|
|
1109
|
-
var ConnectedAccountStatusSchema =
|
|
1260
|
+
var ConnectedAccountStatusSchema = import_zod4.z.enum([
|
|
1110
1261
|
ConnectedAccountStatuses.ACTIVE,
|
|
1111
1262
|
ConnectedAccountStatuses.INACTIVE,
|
|
1112
1263
|
ConnectedAccountStatuses.PENDING,
|
|
@@ -1114,34 +1265,34 @@ var ConnectedAccountStatusSchema = import_zod3.z.enum([
|
|
|
1114
1265
|
ConnectedAccountStatuses.EXPIRED,
|
|
1115
1266
|
ConnectedAccountStatuses.FAILED
|
|
1116
1267
|
]);
|
|
1117
|
-
var CreateConnectedAccountParamsSchema =
|
|
1118
|
-
authConfig:
|
|
1119
|
-
id:
|
|
1268
|
+
var CreateConnectedAccountParamsSchema = import_zod4.z.object({
|
|
1269
|
+
authConfig: import_zod4.z.object({
|
|
1270
|
+
id: import_zod4.z.string()
|
|
1120
1271
|
}),
|
|
1121
|
-
connection:
|
|
1122
|
-
data:
|
|
1123
|
-
redirectUrl:
|
|
1124
|
-
userId:
|
|
1272
|
+
connection: import_zod4.z.object({
|
|
1273
|
+
data: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()).optional(),
|
|
1274
|
+
redirectUrl: import_zod4.z.string().optional(),
|
|
1275
|
+
userId: import_zod4.z.string().optional()
|
|
1125
1276
|
})
|
|
1126
1277
|
});
|
|
1127
|
-
var DefaultCreateConnectedAccountParamsSchema =
|
|
1128
|
-
auth_config:
|
|
1129
|
-
id:
|
|
1278
|
+
var DefaultCreateConnectedAccountParamsSchema = import_zod4.z.object({
|
|
1279
|
+
auth_config: import_zod4.z.object({
|
|
1280
|
+
id: import_zod4.z.string()
|
|
1130
1281
|
}),
|
|
1131
|
-
connection:
|
|
1132
|
-
data:
|
|
1133
|
-
redirect_uri:
|
|
1134
|
-
user_id:
|
|
1282
|
+
connection: import_zod4.z.object({
|
|
1283
|
+
data: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()).optional(),
|
|
1284
|
+
redirect_uri: import_zod4.z.string().optional(),
|
|
1285
|
+
user_id: import_zod4.z.string().optional()
|
|
1135
1286
|
})
|
|
1136
1287
|
});
|
|
1137
|
-
var CreateConnectedAccountOptionsSchema =
|
|
1138
|
-
redirectUrl:
|
|
1139
|
-
data:
|
|
1288
|
+
var CreateConnectedAccountOptionsSchema = import_zod4.z.object({
|
|
1289
|
+
redirectUrl: import_zod4.z.string().optional(),
|
|
1290
|
+
data: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()).optional()
|
|
1140
1291
|
});
|
|
1141
|
-
var CreateConnectedAccountResponseSchema =
|
|
1142
|
-
id:
|
|
1292
|
+
var CreateConnectedAccountResponseSchema = import_zod4.z.object({
|
|
1293
|
+
id: import_zod4.z.string(),
|
|
1143
1294
|
status: ConnectedAccountStatusSchema,
|
|
1144
|
-
redirectUrl:
|
|
1295
|
+
redirectUrl: import_zod4.z.string().nullable()
|
|
1145
1296
|
});
|
|
1146
1297
|
var ConnectedAccountAuthSchemes = {
|
|
1147
1298
|
OAUTH2: "OAUTH2",
|
|
@@ -1158,7 +1309,7 @@ var ConnectedAccountAuthSchemes = {
|
|
|
1158
1309
|
CALCOM_AUTH: "CALCOM_AUTH",
|
|
1159
1310
|
SNOWFLAKE: "SNOWFLAKE"
|
|
1160
1311
|
};
|
|
1161
|
-
var ConnectedAccountAuthSchemesSchema =
|
|
1312
|
+
var ConnectedAccountAuthSchemesSchema = import_zod4.z.enum([
|
|
1162
1313
|
ConnectedAccountAuthSchemes.OAUTH2,
|
|
1163
1314
|
ConnectedAccountAuthSchemes.OAUTH1,
|
|
1164
1315
|
ConnectedAccountAuthSchemes.OAUTH1A,
|
|
@@ -1173,33 +1324,32 @@ var ConnectedAccountAuthSchemesSchema = import_zod3.z.enum([
|
|
|
1173
1324
|
ConnectedAccountAuthSchemes.CALCOM_AUTH,
|
|
1174
1325
|
ConnectedAccountAuthSchemes.SNOWFLAKE
|
|
1175
1326
|
]);
|
|
1176
|
-
var ConnectedAccountAuthConfigSchema =
|
|
1177
|
-
id:
|
|
1327
|
+
var ConnectedAccountAuthConfigSchema = import_zod4.z.object({
|
|
1328
|
+
id: import_zod4.z.string(),
|
|
1178
1329
|
authScheme: ConnectedAccountAuthSchemesSchema,
|
|
1179
|
-
isComposioManaged:
|
|
1180
|
-
isDisabled:
|
|
1330
|
+
isComposioManaged: import_zod4.z.boolean(),
|
|
1331
|
+
isDisabled: import_zod4.z.boolean()
|
|
1181
1332
|
});
|
|
1182
|
-
var ConnectedAccountRetrieveResponseSchema =
|
|
1183
|
-
id:
|
|
1184
|
-
uuid: import_zod3.z.string(),
|
|
1333
|
+
var ConnectedAccountRetrieveResponseSchema = import_zod4.z.object({
|
|
1334
|
+
id: import_zod4.z.string(),
|
|
1185
1335
|
authConfig: ConnectedAccountAuthConfigSchema,
|
|
1186
|
-
userId:
|
|
1187
|
-
data:
|
|
1188
|
-
params:
|
|
1336
|
+
userId: import_zod4.z.string(),
|
|
1337
|
+
data: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()),
|
|
1338
|
+
params: import_zod4.z.record(import_zod4.z.string(), import_zod4.z.unknown()),
|
|
1189
1339
|
status: ConnectedAccountStatusSchema,
|
|
1190
|
-
statusReason:
|
|
1191
|
-
toolkit:
|
|
1192
|
-
slug:
|
|
1340
|
+
statusReason: import_zod4.z.string().nullable(),
|
|
1341
|
+
toolkit: import_zod4.z.object({
|
|
1342
|
+
slug: import_zod4.z.string()
|
|
1193
1343
|
}),
|
|
1194
|
-
testRequestEndpoint:
|
|
1195
|
-
isDisabled:
|
|
1196
|
-
createdAt:
|
|
1197
|
-
updatedAt:
|
|
1344
|
+
testRequestEndpoint: import_zod4.z.string().optional(),
|
|
1345
|
+
isDisabled: import_zod4.z.boolean(),
|
|
1346
|
+
createdAt: import_zod4.z.string(),
|
|
1347
|
+
updatedAt: import_zod4.z.string()
|
|
1198
1348
|
});
|
|
1199
1349
|
|
|
1200
1350
|
// src/models/ConnectionRequest.ts
|
|
1351
|
+
var import_zod5 = require("zod");
|
|
1201
1352
|
var ConnectionRequest = class {
|
|
1202
|
-
FILE_NAME = "core/models/ConnectionRequest.ts";
|
|
1203
1353
|
client;
|
|
1204
1354
|
connectedAccountId;
|
|
1205
1355
|
connectedAccountStatus;
|
|
@@ -1214,23 +1364,31 @@ var ConnectionRequest = class {
|
|
|
1214
1364
|
* @returns
|
|
1215
1365
|
*/
|
|
1216
1366
|
async transformResponse(response) {
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1367
|
+
try {
|
|
1368
|
+
const parsedResponse = ConnectedAccountRetrieveResponseSchema.parse({
|
|
1369
|
+
...response,
|
|
1370
|
+
userId: response.user_id,
|
|
1371
|
+
// Add the missing userId property
|
|
1372
|
+
authConfig: {
|
|
1373
|
+
...response.auth_config,
|
|
1374
|
+
authScheme: response.auth_config.auth_scheme,
|
|
1375
|
+
isComposioManaged: response.auth_config.is_composio_managed,
|
|
1376
|
+
isDisabled: response.auth_config.is_disabled
|
|
1377
|
+
},
|
|
1378
|
+
statusReason: response.status_reason,
|
|
1379
|
+
isDisabled: response.is_disabled,
|
|
1380
|
+
createdAt: response.created_at,
|
|
1381
|
+
updatedAt: response.updated_at,
|
|
1382
|
+
testRequestEndpoint: response.test_request_endpoint
|
|
1383
|
+
});
|
|
1384
|
+
return parsedResponse;
|
|
1385
|
+
} catch (error) {
|
|
1386
|
+
logger_default.error("Error transforming response", error);
|
|
1387
|
+
if (error instanceof import_zod5.ZodError) {
|
|
1388
|
+
logger_default.error(JSON.stringify(error.errors, null, 2));
|
|
1389
|
+
}
|
|
1390
|
+
throw error;
|
|
1391
|
+
}
|
|
1234
1392
|
}
|
|
1235
1393
|
/**
|
|
1236
1394
|
* Wait for the connection to be established.
|
|
@@ -1280,13 +1438,35 @@ var ConnectedAccounts = class {
|
|
|
1280
1438
|
return this.client.connectedAccounts.list(query);
|
|
1281
1439
|
}
|
|
1282
1440
|
/**
|
|
1283
|
-
*
|
|
1284
|
-
*
|
|
1285
|
-
*
|
|
1286
|
-
* @
|
|
1441
|
+
* Compound function to create a new connected account.
|
|
1442
|
+
* This function creates a new connected account and returns a connection request.
|
|
1443
|
+
* Users can then wait for the connection to be established using the `waitForConnection` method.
|
|
1444
|
+
* @param {string} userId - User ID of the connected account
|
|
1445
|
+
* @param {string} authConfigId - Auth config ID of the connected account
|
|
1446
|
+
* @param {CreateConnectedAccountOptions} data - Data for creating a new connected account
|
|
1447
|
+
* @returns {Promise<ConnectionRequest>} Connection request object
|
|
1448
|
+
*
|
|
1449
|
+
* @example
|
|
1450
|
+
* const connectionRequest = await composio.createConnectedAccount('user_123', 'auth_config_123', {
|
|
1451
|
+
* data: {
|
|
1452
|
+
* name: 'My Connected Account',
|
|
1453
|
+
* },
|
|
1454
|
+
* });
|
|
1455
|
+
*
|
|
1456
|
+
* @link https://docs.composio.dev/reference/connected-accounts/create-connected-account
|
|
1287
1457
|
*/
|
|
1288
|
-
async create(
|
|
1289
|
-
|
|
1458
|
+
async create(userId, authConfigId, options) {
|
|
1459
|
+
const response = await this.client.connectedAccounts.create({
|
|
1460
|
+
auth_config: {
|
|
1461
|
+
id: authConfigId
|
|
1462
|
+
},
|
|
1463
|
+
connection: {
|
|
1464
|
+
data: options?.data,
|
|
1465
|
+
redirect_uri: options?.redirectUrl,
|
|
1466
|
+
user_id: userId
|
|
1467
|
+
}
|
|
1468
|
+
});
|
|
1469
|
+
return new ConnectionRequest(this.client, response.id, response.status);
|
|
1290
1470
|
}
|
|
1291
1471
|
/**
|
|
1292
1472
|
* Get a connected account by nanoid
|
|
@@ -1343,27 +1523,6 @@ var ConnectedAccounts = class {
|
|
|
1343
1523
|
async disable(nanoid) {
|
|
1344
1524
|
return this.client.connectedAccounts.updateStatus(nanoid, { enabled: false });
|
|
1345
1525
|
}
|
|
1346
|
-
/**
|
|
1347
|
-
* Compound function to create a new connected account.
|
|
1348
|
-
* This function creates a new connected account and returns a connection request.
|
|
1349
|
-
* Users can then wait for the connection to be established using the `waitForConnection` method.
|
|
1350
|
-
* @param {CreateConnectedAccountParams} data - Data for creating a new connected account
|
|
1351
|
-
* @returns {Promise<ConnectionRequest>} Connection request object
|
|
1352
|
-
*/
|
|
1353
|
-
async createConnectedAccount(userId, authConfigId, options) {
|
|
1354
|
-
const { redirectUrl, data } = options;
|
|
1355
|
-
const response = await this.create({
|
|
1356
|
-
auth_config: {
|
|
1357
|
-
id: authConfigId
|
|
1358
|
-
},
|
|
1359
|
-
connection: {
|
|
1360
|
-
data,
|
|
1361
|
-
redirect_uri: redirectUrl,
|
|
1362
|
-
user_id: userId
|
|
1363
|
-
}
|
|
1364
|
-
});
|
|
1365
|
-
return new ConnectionRequest(this.client, response.id, response.status);
|
|
1366
|
-
}
|
|
1367
1526
|
};
|
|
1368
1527
|
|
|
1369
1528
|
// src/types/telemetry.types.ts
|
|
@@ -1850,7 +2009,7 @@ var OpenAIToolset = class extends BaseNonAgenticToolset {
|
|
|
1850
2009
|
};
|
|
1851
2010
|
|
|
1852
2011
|
// package.json
|
|
1853
|
-
var version = "0.1.
|
|
2012
|
+
var version = "0.1.8-alpha.0";
|
|
1854
2013
|
|
|
1855
2014
|
// src/utils/uuid.ts
|
|
1856
2015
|
var import_uuid = require("uuid");
|
|
@@ -1878,7 +2037,9 @@ var Composio = class {
|
|
|
1878
2037
|
toolkits;
|
|
1879
2038
|
triggers;
|
|
1880
2039
|
toolset;
|
|
2040
|
+
// auth configs
|
|
1881
2041
|
authConfigs;
|
|
2042
|
+
createAuthConfig;
|
|
1882
2043
|
// connected accounts
|
|
1883
2044
|
connectedAccounts;
|
|
1884
2045
|
createConnectedAccount;
|
|
@@ -1913,8 +2074,9 @@ var Composio = class {
|
|
|
1913
2074
|
this.toolkits = new Toolkits(this.client);
|
|
1914
2075
|
this.triggers = new Triggers(this.client);
|
|
1915
2076
|
this.authConfigs = new AuthConfigs(this.client);
|
|
2077
|
+
this.createAuthConfig = this.authConfigs.create.bind(this.authConfigs);
|
|
1916
2078
|
this.connectedAccounts = new ConnectedAccounts(this.client);
|
|
1917
|
-
this.createConnectedAccount = this.connectedAccounts.
|
|
2079
|
+
this.createConnectedAccount = this.connectedAccounts.create.bind(this.connectedAccounts);
|
|
1918
2080
|
if (this.config.allowTracking ?? true) {
|
|
1919
2081
|
this.initializeTelemetry(
|
|
1920
2082
|
{
|
|
@@ -1994,39 +2156,39 @@ var BaseTelemetryTransport = class {
|
|
|
1994
2156
|
};
|
|
1995
2157
|
|
|
1996
2158
|
// src/utils/jsonSchema.ts
|
|
1997
|
-
var
|
|
2159
|
+
var import_zod6 = require("zod");
|
|
1998
2160
|
function jsonSchemaPropertiesToTSTypes(value) {
|
|
1999
2161
|
if (!value.type) {
|
|
2000
|
-
return
|
|
2162
|
+
return import_zod6.z.object({});
|
|
2001
2163
|
}
|
|
2002
2164
|
let zodType;
|
|
2003
2165
|
switch (value.type) {
|
|
2004
2166
|
case "string":
|
|
2005
|
-
zodType =
|
|
2167
|
+
zodType = import_zod6.z.string().describe(
|
|
2006
2168
|
(value.description || "") + (value.examples ? `
|
|
2007
2169
|
Examples: ${value.examples.join(", ")}` : "")
|
|
2008
2170
|
);
|
|
2009
2171
|
break;
|
|
2010
2172
|
case "number":
|
|
2011
|
-
zodType =
|
|
2173
|
+
zodType = import_zod6.z.number().describe(
|
|
2012
2174
|
(value.description || "") + (value.examples ? `
|
|
2013
2175
|
Examples: ${value.examples.join(", ")}` : "")
|
|
2014
2176
|
);
|
|
2015
2177
|
break;
|
|
2016
2178
|
case "integer":
|
|
2017
|
-
zodType =
|
|
2179
|
+
zodType = import_zod6.z.number().int().describe(
|
|
2018
2180
|
(value.description || "") + (value.examples ? `
|
|
2019
2181
|
Examples: ${value.examples.join(", ")}` : "")
|
|
2020
2182
|
);
|
|
2021
2183
|
break;
|
|
2022
2184
|
case "boolean":
|
|
2023
|
-
zodType =
|
|
2185
|
+
zodType = import_zod6.z.boolean().describe(
|
|
2024
2186
|
(value.description || "") + (value.examples ? `
|
|
2025
2187
|
Examples: ${value.examples.join(", ")}` : "")
|
|
2026
2188
|
);
|
|
2027
2189
|
break;
|
|
2028
2190
|
case "array":
|
|
2029
|
-
zodType =
|
|
2191
|
+
zodType = import_zod6.z.array(
|
|
2030
2192
|
jsonSchemaPropertiesToTSTypes(
|
|
2031
2193
|
value.items
|
|
2032
2194
|
)
|
|
@@ -2042,7 +2204,7 @@ Examples: ${value.examples.join(", ")}` : "")
|
|
|
2042
2204
|
);
|
|
2043
2205
|
break;
|
|
2044
2206
|
case "null":
|
|
2045
|
-
zodType =
|
|
2207
|
+
zodType = import_zod6.z.null().describe(value.description || "");
|
|
2046
2208
|
break;
|
|
2047
2209
|
default:
|
|
2048
2210
|
throw new Error(`Unsupported JSON schema type: ${value.type}`);
|
|
@@ -2053,7 +2215,7 @@ function jsonSchemaToModel(jsonSchema) {
|
|
|
2053
2215
|
const properties = jsonSchema.properties;
|
|
2054
2216
|
const requiredFields = jsonSchema.required || [];
|
|
2055
2217
|
if (!properties) {
|
|
2056
|
-
return
|
|
2218
|
+
return import_zod6.z.object({});
|
|
2057
2219
|
}
|
|
2058
2220
|
const zodSchema = {};
|
|
2059
2221
|
for (const [key, _] of Object.entries(properties)) {
|
|
@@ -2065,7 +2227,7 @@ function jsonSchemaToModel(jsonSchema) {
|
|
|
2065
2227
|
schema
|
|
2066
2228
|
)
|
|
2067
2229
|
);
|
|
2068
|
-
zodType =
|
|
2230
|
+
zodType = import_zod6.z.union(anyOfTypes).describe(
|
|
2069
2231
|
(value.description || "") + (value.examples ? `
|
|
2070
2232
|
Examples: ${value.examples.join(", ")}` : "")
|
|
2071
2233
|
);
|
|
@@ -2075,7 +2237,7 @@ Examples: ${value.examples.join(", ")}` : "")
|
|
|
2075
2237
|
schema
|
|
2076
2238
|
)
|
|
2077
2239
|
);
|
|
2078
|
-
zodType =
|
|
2240
|
+
zodType = import_zod6.z.intersection(
|
|
2079
2241
|
allOfTypes[0],
|
|
2080
2242
|
allOfTypes.slice(1).reduce((acc, schema) => acc.and(schema), allOfTypes[0])
|
|
2081
2243
|
).describe(
|
|
@@ -2099,10 +2261,12 @@ Examples: ${value.examples.join(", ")}` : "")
|
|
|
2099
2261
|
zodSchema[key] = zodType.optional();
|
|
2100
2262
|
}
|
|
2101
2263
|
}
|
|
2102
|
-
return
|
|
2264
|
+
return import_zod6.z.object(zodSchema);
|
|
2103
2265
|
}
|
|
2104
2266
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2105
2267
|
0 && (module.exports = {
|
|
2268
|
+
AuthConfigTypes,
|
|
2269
|
+
AuthSchemeTypes,
|
|
2106
2270
|
BaseAgenticToolset,
|
|
2107
2271
|
BaseNonAgenticToolset,
|
|
2108
2272
|
BaseTelemetryTransport,
|