@composio/core 0.1.6-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 +259 -103
- package/dist/index.d.cts +306 -29
- package/dist/index.d.ts +306 -29
- package/dist/index.js +255 -101
- 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,
|
|
@@ -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,31 +1324,31 @@ 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:
|
|
1333
|
+
var ConnectedAccountRetrieveResponseSchema = import_zod4.z.object({
|
|
1334
|
+
id: import_zod4.z.string(),
|
|
1184
1335
|
authConfig: ConnectedAccountAuthConfigSchema,
|
|
1185
|
-
userId:
|
|
1186
|
-
data:
|
|
1187
|
-
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()),
|
|
1188
1339
|
status: ConnectedAccountStatusSchema,
|
|
1189
|
-
statusReason:
|
|
1190
|
-
toolkit:
|
|
1191
|
-
slug:
|
|
1340
|
+
statusReason: import_zod4.z.string().nullable(),
|
|
1341
|
+
toolkit: import_zod4.z.object({
|
|
1342
|
+
slug: import_zod4.z.string()
|
|
1192
1343
|
}),
|
|
1193
|
-
testRequestEndpoint:
|
|
1194
|
-
isDisabled:
|
|
1195
|
-
createdAt:
|
|
1196
|
-
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()
|
|
1197
1348
|
});
|
|
1198
1349
|
|
|
1199
1350
|
// src/models/ConnectionRequest.ts
|
|
1200
|
-
var
|
|
1351
|
+
var import_zod5 = require("zod");
|
|
1201
1352
|
var ConnectionRequest = class {
|
|
1202
1353
|
client;
|
|
1203
1354
|
connectedAccountId;
|
|
@@ -1233,7 +1384,7 @@ var ConnectionRequest = class {
|
|
|
1233
1384
|
return parsedResponse;
|
|
1234
1385
|
} catch (error) {
|
|
1235
1386
|
logger_default.error("Error transforming response", error);
|
|
1236
|
-
if (error instanceof
|
|
1387
|
+
if (error instanceof import_zod5.ZodError) {
|
|
1237
1388
|
logger_default.error(JSON.stringify(error.errors, null, 2));
|
|
1238
1389
|
}
|
|
1239
1390
|
throw error;
|
|
@@ -1287,13 +1438,35 @@ var ConnectedAccounts = class {
|
|
|
1287
1438
|
return this.client.connectedAccounts.list(query);
|
|
1288
1439
|
}
|
|
1289
1440
|
/**
|
|
1290
|
-
*
|
|
1291
|
-
*
|
|
1292
|
-
*
|
|
1293
|
-
* @
|
|
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
|
|
1294
1457
|
*/
|
|
1295
|
-
async create(
|
|
1296
|
-
|
|
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);
|
|
1297
1470
|
}
|
|
1298
1471
|
/**
|
|
1299
1472
|
* Get a connected account by nanoid
|
|
@@ -1350,26 +1523,6 @@ var ConnectedAccounts = class {
|
|
|
1350
1523
|
async disable(nanoid) {
|
|
1351
1524
|
return this.client.connectedAccounts.updateStatus(nanoid, { enabled: false });
|
|
1352
1525
|
}
|
|
1353
|
-
/**
|
|
1354
|
-
* Compound function to create a new connected account.
|
|
1355
|
-
* This function creates a new connected account and returns a connection request.
|
|
1356
|
-
* Users can then wait for the connection to be established using the `waitForConnection` method.
|
|
1357
|
-
* @param {CreateConnectedAccountParams} data - Data for creating a new connected account
|
|
1358
|
-
* @returns {Promise<ConnectionRequest>} Connection request object
|
|
1359
|
-
*/
|
|
1360
|
-
async createConnectedAccount(userId, authConfigId, options) {
|
|
1361
|
-
const response = await this.create({
|
|
1362
|
-
auth_config: {
|
|
1363
|
-
id: authConfigId
|
|
1364
|
-
},
|
|
1365
|
-
connection: {
|
|
1366
|
-
data: options?.data,
|
|
1367
|
-
redirect_uri: options?.redirectUrl,
|
|
1368
|
-
user_id: userId
|
|
1369
|
-
}
|
|
1370
|
-
});
|
|
1371
|
-
return new ConnectionRequest(this.client, response.id, response.status);
|
|
1372
|
-
}
|
|
1373
1526
|
};
|
|
1374
1527
|
|
|
1375
1528
|
// src/types/telemetry.types.ts
|
|
@@ -1856,7 +2009,7 @@ var OpenAIToolset = class extends BaseNonAgenticToolset {
|
|
|
1856
2009
|
};
|
|
1857
2010
|
|
|
1858
2011
|
// package.json
|
|
1859
|
-
var version = "0.1.
|
|
2012
|
+
var version = "0.1.8-alpha.0";
|
|
1860
2013
|
|
|
1861
2014
|
// src/utils/uuid.ts
|
|
1862
2015
|
var import_uuid = require("uuid");
|
|
@@ -1884,7 +2037,9 @@ var Composio = class {
|
|
|
1884
2037
|
toolkits;
|
|
1885
2038
|
triggers;
|
|
1886
2039
|
toolset;
|
|
2040
|
+
// auth configs
|
|
1887
2041
|
authConfigs;
|
|
2042
|
+
createAuthConfig;
|
|
1888
2043
|
// connected accounts
|
|
1889
2044
|
connectedAccounts;
|
|
1890
2045
|
createConnectedAccount;
|
|
@@ -1919,10 +2074,9 @@ var Composio = class {
|
|
|
1919
2074
|
this.toolkits = new Toolkits(this.client);
|
|
1920
2075
|
this.triggers = new Triggers(this.client);
|
|
1921
2076
|
this.authConfigs = new AuthConfigs(this.client);
|
|
2077
|
+
this.createAuthConfig = this.authConfigs.create.bind(this.authConfigs);
|
|
1922
2078
|
this.connectedAccounts = new ConnectedAccounts(this.client);
|
|
1923
|
-
this.createConnectedAccount = this.connectedAccounts.
|
|
1924
|
-
this.connectedAccounts
|
|
1925
|
-
);
|
|
2079
|
+
this.createConnectedAccount = this.connectedAccounts.create.bind(this.connectedAccounts);
|
|
1926
2080
|
if (this.config.allowTracking ?? true) {
|
|
1927
2081
|
this.initializeTelemetry(
|
|
1928
2082
|
{
|
|
@@ -2002,39 +2156,39 @@ var BaseTelemetryTransport = class {
|
|
|
2002
2156
|
};
|
|
2003
2157
|
|
|
2004
2158
|
// src/utils/jsonSchema.ts
|
|
2005
|
-
var
|
|
2159
|
+
var import_zod6 = require("zod");
|
|
2006
2160
|
function jsonSchemaPropertiesToTSTypes(value) {
|
|
2007
2161
|
if (!value.type) {
|
|
2008
|
-
return
|
|
2162
|
+
return import_zod6.z.object({});
|
|
2009
2163
|
}
|
|
2010
2164
|
let zodType;
|
|
2011
2165
|
switch (value.type) {
|
|
2012
2166
|
case "string":
|
|
2013
|
-
zodType =
|
|
2167
|
+
zodType = import_zod6.z.string().describe(
|
|
2014
2168
|
(value.description || "") + (value.examples ? `
|
|
2015
2169
|
Examples: ${value.examples.join(", ")}` : "")
|
|
2016
2170
|
);
|
|
2017
2171
|
break;
|
|
2018
2172
|
case "number":
|
|
2019
|
-
zodType =
|
|
2173
|
+
zodType = import_zod6.z.number().describe(
|
|
2020
2174
|
(value.description || "") + (value.examples ? `
|
|
2021
2175
|
Examples: ${value.examples.join(", ")}` : "")
|
|
2022
2176
|
);
|
|
2023
2177
|
break;
|
|
2024
2178
|
case "integer":
|
|
2025
|
-
zodType =
|
|
2179
|
+
zodType = import_zod6.z.number().int().describe(
|
|
2026
2180
|
(value.description || "") + (value.examples ? `
|
|
2027
2181
|
Examples: ${value.examples.join(", ")}` : "")
|
|
2028
2182
|
);
|
|
2029
2183
|
break;
|
|
2030
2184
|
case "boolean":
|
|
2031
|
-
zodType =
|
|
2185
|
+
zodType = import_zod6.z.boolean().describe(
|
|
2032
2186
|
(value.description || "") + (value.examples ? `
|
|
2033
2187
|
Examples: ${value.examples.join(", ")}` : "")
|
|
2034
2188
|
);
|
|
2035
2189
|
break;
|
|
2036
2190
|
case "array":
|
|
2037
|
-
zodType =
|
|
2191
|
+
zodType = import_zod6.z.array(
|
|
2038
2192
|
jsonSchemaPropertiesToTSTypes(
|
|
2039
2193
|
value.items
|
|
2040
2194
|
)
|
|
@@ -2050,7 +2204,7 @@ Examples: ${value.examples.join(", ")}` : "")
|
|
|
2050
2204
|
);
|
|
2051
2205
|
break;
|
|
2052
2206
|
case "null":
|
|
2053
|
-
zodType =
|
|
2207
|
+
zodType = import_zod6.z.null().describe(value.description || "");
|
|
2054
2208
|
break;
|
|
2055
2209
|
default:
|
|
2056
2210
|
throw new Error(`Unsupported JSON schema type: ${value.type}`);
|
|
@@ -2061,7 +2215,7 @@ function jsonSchemaToModel(jsonSchema) {
|
|
|
2061
2215
|
const properties = jsonSchema.properties;
|
|
2062
2216
|
const requiredFields = jsonSchema.required || [];
|
|
2063
2217
|
if (!properties) {
|
|
2064
|
-
return
|
|
2218
|
+
return import_zod6.z.object({});
|
|
2065
2219
|
}
|
|
2066
2220
|
const zodSchema = {};
|
|
2067
2221
|
for (const [key, _] of Object.entries(properties)) {
|
|
@@ -2073,7 +2227,7 @@ function jsonSchemaToModel(jsonSchema) {
|
|
|
2073
2227
|
schema
|
|
2074
2228
|
)
|
|
2075
2229
|
);
|
|
2076
|
-
zodType =
|
|
2230
|
+
zodType = import_zod6.z.union(anyOfTypes).describe(
|
|
2077
2231
|
(value.description || "") + (value.examples ? `
|
|
2078
2232
|
Examples: ${value.examples.join(", ")}` : "")
|
|
2079
2233
|
);
|
|
@@ -2083,7 +2237,7 @@ Examples: ${value.examples.join(", ")}` : "")
|
|
|
2083
2237
|
schema
|
|
2084
2238
|
)
|
|
2085
2239
|
);
|
|
2086
|
-
zodType =
|
|
2240
|
+
zodType = import_zod6.z.intersection(
|
|
2087
2241
|
allOfTypes[0],
|
|
2088
2242
|
allOfTypes.slice(1).reduce((acc, schema) => acc.and(schema), allOfTypes[0])
|
|
2089
2243
|
).describe(
|
|
@@ -2107,10 +2261,12 @@ Examples: ${value.examples.join(", ")}` : "")
|
|
|
2107
2261
|
zodSchema[key] = zodType.optional();
|
|
2108
2262
|
}
|
|
2109
2263
|
}
|
|
2110
|
-
return
|
|
2264
|
+
return import_zod6.z.object(zodSchema);
|
|
2111
2265
|
}
|
|
2112
2266
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2113
2267
|
0 && (module.exports = {
|
|
2268
|
+
AuthConfigTypes,
|
|
2269
|
+
AuthSchemeTypes,
|
|
2114
2270
|
BaseAgenticToolset,
|
|
2115
2271
|
BaseNonAgenticToolset,
|
|
2116
2272
|
BaseTelemetryTransport,
|