@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.js
CHANGED
|
@@ -977,30 +977,174 @@ var Triggers = class {
|
|
|
977
977
|
}
|
|
978
978
|
};
|
|
979
979
|
|
|
980
|
+
// src/types/authConfigs.types.ts
|
|
981
|
+
import { z as z3 } from "zod";
|
|
982
|
+
var AuthConfigTypes = {
|
|
983
|
+
CUSTOM: "use_custom_auth",
|
|
984
|
+
COMPOSIO_MANAGED: "use_composio_managed_auth"
|
|
985
|
+
};
|
|
986
|
+
var AuthSchemeTypes = {
|
|
987
|
+
OAUTH2: "OAUTH2",
|
|
988
|
+
OAUTH1: "OAUTH1",
|
|
989
|
+
OAUTH1A: "OAUTH1A",
|
|
990
|
+
API_KEY: "API_KEY",
|
|
991
|
+
BASIC: "BASIC",
|
|
992
|
+
BILLCOM_AUTH: "BILLCOM_AUTH",
|
|
993
|
+
BEARER_TOKEN: "BEARER_TOKEN",
|
|
994
|
+
GOOGLE_SERVICE_ACCOUNT: "GOOGLE_SERVICE_ACCOUNT",
|
|
995
|
+
NO_AUTH: "NO_AUTH",
|
|
996
|
+
BASIC_WITH_JWT: "BASIC_WITH_JWT",
|
|
997
|
+
COMPOSIO_LINK: "COMPOSIO_LINK",
|
|
998
|
+
CALCOM_AUTH: "CALCOM_AUTH",
|
|
999
|
+
SNOWFLAKE: "SNOWFLAKE"
|
|
1000
|
+
};
|
|
1001
|
+
var AuthSchemeEnum = z3.enum([
|
|
1002
|
+
"OAUTH2",
|
|
1003
|
+
"OAUTH1",
|
|
1004
|
+
"OAUTH1A",
|
|
1005
|
+
"API_KEY",
|
|
1006
|
+
"BASIC",
|
|
1007
|
+
"BILLCOM_AUTH",
|
|
1008
|
+
"BEARER_TOKEN",
|
|
1009
|
+
"GOOGLE_SERVICE_ACCOUNT",
|
|
1010
|
+
"NO_AUTH",
|
|
1011
|
+
"BASIC_WITH_JWT",
|
|
1012
|
+
"COMPOSIO_LINK",
|
|
1013
|
+
"CALCOM_AUTH",
|
|
1014
|
+
"SNOWFLAKE"
|
|
1015
|
+
]);
|
|
1016
|
+
var CreateCustomAuthConfigParamsSchema = z3.object({
|
|
1017
|
+
type: z3.literal("use_custom_auth"),
|
|
1018
|
+
name: z3.string().optional(),
|
|
1019
|
+
credentials: z3.record(z3.string(), z3.union([z3.string(), z3.number(), z3.boolean()])),
|
|
1020
|
+
authScheme: AuthSchemeEnum
|
|
1021
|
+
});
|
|
1022
|
+
var CreateComposioManagedAuthConfigParamsSchema = z3.object({
|
|
1023
|
+
type: z3.literal("use_composio_managed_auth"),
|
|
1024
|
+
name: z3.string().optional(),
|
|
1025
|
+
credentials: z3.record(z3.string(), z3.union([z3.string(), z3.number(), z3.boolean()])).optional()
|
|
1026
|
+
});
|
|
1027
|
+
var CreateAuthConfigParamsSchema = z3.discriminatedUnion("type", [
|
|
1028
|
+
CreateCustomAuthConfigParamsSchema,
|
|
1029
|
+
CreateComposioManagedAuthConfigParamsSchema
|
|
1030
|
+
]);
|
|
1031
|
+
var CreateAuthConfigResponseSchema = z3.object({
|
|
1032
|
+
id: z3.string(),
|
|
1033
|
+
authScheme: z3.string(),
|
|
1034
|
+
isComposioManaged: z3.boolean(),
|
|
1035
|
+
toolkit: z3.string()
|
|
1036
|
+
});
|
|
1037
|
+
var AuthConfigRetrieveResponseSchema = z3.object({
|
|
1038
|
+
id: z3.string(),
|
|
1039
|
+
name: z3.string(),
|
|
1040
|
+
toolkit: z3.object({
|
|
1041
|
+
logo: z3.string(),
|
|
1042
|
+
slug: z3.string()
|
|
1043
|
+
}),
|
|
1044
|
+
noOfConnections: z3.number(),
|
|
1045
|
+
status: z3.enum(["ENABLED", "DISABLED"]),
|
|
1046
|
+
uuid: z3.string(),
|
|
1047
|
+
authScheme: AuthSchemeEnum.optional(),
|
|
1048
|
+
credentials: z3.record(z3.string(), z3.union([z3.string(), z3.number(), z3.boolean()])),
|
|
1049
|
+
expectedInputFields: z3.array(z3.unknown()).optional(),
|
|
1050
|
+
isComposioManaged: z3.boolean().optional(),
|
|
1051
|
+
createdBy: z3.string().optional(),
|
|
1052
|
+
createdAt: z3.string().optional(),
|
|
1053
|
+
lastUpdatedAt: z3.string().optional()
|
|
1054
|
+
});
|
|
1055
|
+
var AuthConfigListParamsSchema = z3.object({
|
|
1056
|
+
cursor: z3.string().optional(),
|
|
1057
|
+
isComposioManaged: z3.boolean().optional(),
|
|
1058
|
+
limit: z3.number().optional(),
|
|
1059
|
+
toolkitSlug: z3.string().optional()
|
|
1060
|
+
});
|
|
1061
|
+
var AuthConfigListResponseSchema = z3.object({
|
|
1062
|
+
items: z3.array(AuthConfigRetrieveResponseSchema),
|
|
1063
|
+
nextCursor: z3.string().optional(),
|
|
1064
|
+
totalPages: z3.number()
|
|
1065
|
+
});
|
|
1066
|
+
var AuthConfigUpdateParamsSchema = z3.object({
|
|
1067
|
+
credentials: z3.record(z3.string(), z3.union([z3.string(), z3.number(), z3.boolean()]))
|
|
1068
|
+
});
|
|
1069
|
+
|
|
980
1070
|
// src/models/AuthConfigs.ts
|
|
981
1071
|
var AuthConfigs = class {
|
|
982
|
-
FILE_NAME = "core/models/AuthConfigs.ts";
|
|
983
1072
|
client;
|
|
984
1073
|
constructor(client) {
|
|
985
1074
|
this.client = client;
|
|
986
1075
|
}
|
|
1076
|
+
parseAuthConfigRetrieveResponse(authConfig) {
|
|
1077
|
+
return AuthConfigRetrieveResponseSchema.parse({
|
|
1078
|
+
id: authConfig.id,
|
|
1079
|
+
name: authConfig.name,
|
|
1080
|
+
noOfConnections: authConfig.no_of_connections,
|
|
1081
|
+
status: authConfig.status,
|
|
1082
|
+
toolkit: {
|
|
1083
|
+
logo: authConfig.toolkit.logo,
|
|
1084
|
+
slug: authConfig.toolkit.slug
|
|
1085
|
+
},
|
|
1086
|
+
uuid: authConfig.uuid,
|
|
1087
|
+
authScheme: authConfig.auth_scheme,
|
|
1088
|
+
credentials: authConfig.credentials,
|
|
1089
|
+
expectedInputFields: authConfig.expected_input_fields,
|
|
1090
|
+
isComposioManaged: authConfig.is_composio_managed,
|
|
1091
|
+
createdBy: authConfig.created_by,
|
|
1092
|
+
createdAt: authConfig.created_at,
|
|
1093
|
+
lastUpdatedAt: authConfig.last_updated_at
|
|
1094
|
+
});
|
|
1095
|
+
}
|
|
987
1096
|
/**
|
|
988
1097
|
* List all auth configs
|
|
989
1098
|
* @param {AuthConfigListParams} query - Query parameters for filtering auth configs
|
|
990
1099
|
* @param {RequestOptions} options - Request options
|
|
991
1100
|
* @returns {Promise<AuthConfigListResponse>} List of auth configs
|
|
992
1101
|
*/
|
|
993
|
-
async list(query
|
|
994
|
-
|
|
1102
|
+
async list(query) {
|
|
1103
|
+
const parsedQuery = query ? AuthConfigListParamsSchema.parse(query) : void 0;
|
|
1104
|
+
const result = await this.client.authConfigs.list({
|
|
1105
|
+
cursor: parsedQuery?.cursor,
|
|
1106
|
+
is_composio_managed: parsedQuery?.isComposioManaged,
|
|
1107
|
+
limit: parsedQuery?.limit?.toString(),
|
|
1108
|
+
toolkit_slug: parsedQuery?.toolkitSlug
|
|
1109
|
+
});
|
|
1110
|
+
return AuthConfigListResponseSchema.parse({
|
|
1111
|
+
items: result.items.map((item) => this.parseAuthConfigRetrieveResponse(item)),
|
|
1112
|
+
nextCursor: result.next_cursor,
|
|
1113
|
+
totalPages: result.total_pages
|
|
1114
|
+
});
|
|
995
1115
|
}
|
|
996
1116
|
/**
|
|
997
1117
|
* Create a new auth config
|
|
998
|
-
* @param {
|
|
999
|
-
* @param {
|
|
1000
|
-
* @returns {Promise<
|
|
1118
|
+
* @param {string} toolkit - Unique identifier of the toolkit
|
|
1119
|
+
* @param {CreateAuthConfigParams} options - Options for creating a new auth config
|
|
1120
|
+
* @returns {Promise<CreateAuthConfigResponse>} Created auth config
|
|
1121
|
+
*
|
|
1122
|
+
* @example
|
|
1123
|
+
* const authConfig = await authConfigs.create('my-toolkit', {
|
|
1124
|
+
* type: AuthConfigTypes.CUSTOM,
|
|
1125
|
+
* name: 'My Custom Auth Config',
|
|
1126
|
+
* authScheme: AuthSchemeTypes.API_KEY,
|
|
1127
|
+
* credentials: {
|
|
1128
|
+
* apiKey: '1234567890',
|
|
1129
|
+
* },
|
|
1130
|
+
* });
|
|
1131
|
+
*
|
|
1132
|
+
* @link https://docs.composio.dev/reference/auth-configs/create-auth-config
|
|
1001
1133
|
*/
|
|
1002
|
-
async create(
|
|
1003
|
-
|
|
1134
|
+
async create(toolkit, options) {
|
|
1135
|
+
const parsedOptions = CreateAuthConfigParamsSchema.parse(options);
|
|
1136
|
+
const result = await this.client.authConfigs.create({
|
|
1137
|
+
toolkit: {
|
|
1138
|
+
slug: toolkit
|
|
1139
|
+
},
|
|
1140
|
+
auth_config: parsedOptions
|
|
1141
|
+
});
|
|
1142
|
+
return CreateAuthConfigResponseSchema.parse({
|
|
1143
|
+
id: result.auth_config.id,
|
|
1144
|
+
authScheme: result.auth_config.auth_scheme,
|
|
1145
|
+
isComposioManaged: result.auth_config.is_composio_managed,
|
|
1146
|
+
toolkit: result.toolkit.slug
|
|
1147
|
+
});
|
|
1004
1148
|
}
|
|
1005
1149
|
/**
|
|
1006
1150
|
* Get an auth config by nanoid
|
|
@@ -1008,8 +1152,9 @@ var AuthConfigs = class {
|
|
|
1008
1152
|
* @param {RequestOptions} options - Request options
|
|
1009
1153
|
* @returns {Promise<AuthConfigRetrieveResponse>} Auth config details
|
|
1010
1154
|
*/
|
|
1011
|
-
async get(nanoid
|
|
1012
|
-
|
|
1155
|
+
async get(nanoid) {
|
|
1156
|
+
const result = await this.client.authConfigs.retrieve(nanoid);
|
|
1157
|
+
return this.parseAuthConfigRetrieveResponse(result);
|
|
1013
1158
|
}
|
|
1014
1159
|
/**
|
|
1015
1160
|
* Update an auth config
|
|
@@ -1018,8 +1163,12 @@ var AuthConfigs = class {
|
|
|
1018
1163
|
* @param {RequestOptions} options - Request options
|
|
1019
1164
|
* @returns {Promise<AuthConfigUpdateResponse>} Updated auth config
|
|
1020
1165
|
*/
|
|
1021
|
-
async update(nanoid, data
|
|
1022
|
-
return this.client.authConfigs.update(nanoid,
|
|
1166
|
+
async update(nanoid, data) {
|
|
1167
|
+
return this.client.authConfigs.update(nanoid, {
|
|
1168
|
+
auth_config: {
|
|
1169
|
+
credentials: data.credentials
|
|
1170
|
+
}
|
|
1171
|
+
});
|
|
1023
1172
|
}
|
|
1024
1173
|
/**
|
|
1025
1174
|
* Delete an auth config
|
|
@@ -1027,8 +1176,8 @@ var AuthConfigs = class {
|
|
|
1027
1176
|
* @param {RequestOptions} options - Request options
|
|
1028
1177
|
* @returns {Promise<AuthConfigDeleteResponse>} Response from deletion
|
|
1029
1178
|
*/
|
|
1030
|
-
async delete(nanoid
|
|
1031
|
-
return this.client.authConfigs.delete(nanoid
|
|
1179
|
+
async delete(nanoid) {
|
|
1180
|
+
return this.client.authConfigs.delete(nanoid);
|
|
1032
1181
|
}
|
|
1033
1182
|
/**
|
|
1034
1183
|
* Update the status of an auth config
|
|
@@ -1037,8 +1186,8 @@ var AuthConfigs = class {
|
|
|
1037
1186
|
* @param {RequestOptions} options - Request options
|
|
1038
1187
|
* @returns {Promise<AuthConfigUpdateStatusResponse>} Updated auth config details
|
|
1039
1188
|
*/
|
|
1040
|
-
async updateStatus(status, nanoid
|
|
1041
|
-
return this.client.authConfigs.updateStatus(status, { nanoid }
|
|
1189
|
+
async updateStatus(status, nanoid) {
|
|
1190
|
+
return this.client.authConfigs.updateStatus(status, { nanoid });
|
|
1042
1191
|
}
|
|
1043
1192
|
/**
|
|
1044
1193
|
* Enable an auth config
|
|
@@ -1046,8 +1195,8 @@ var AuthConfigs = class {
|
|
|
1046
1195
|
* @param {RequestOptions} options - Request options
|
|
1047
1196
|
* @returns {Promise<AuthConfigUpdateStatusResponse>} Updated auth config details
|
|
1048
1197
|
*/
|
|
1049
|
-
async enable(nanoid
|
|
1050
|
-
return this.client.authConfigs.updateStatus("ENABLED", { nanoid }
|
|
1198
|
+
async enable(nanoid) {
|
|
1199
|
+
return this.client.authConfigs.updateStatus("ENABLED", { nanoid });
|
|
1051
1200
|
}
|
|
1052
1201
|
/**
|
|
1053
1202
|
* Disable an auth config
|
|
@@ -1055,13 +1204,13 @@ var AuthConfigs = class {
|
|
|
1055
1204
|
* @param {RequestOptions} options - Request options
|
|
1056
1205
|
* @returns {Promise<AuthConfigUpdateStatusResponse>} Updated auth config details
|
|
1057
1206
|
*/
|
|
1058
|
-
async disable(nanoid
|
|
1059
|
-
return this.client.authConfigs.updateStatus("DISABLED", { nanoid }
|
|
1207
|
+
async disable(nanoid) {
|
|
1208
|
+
return this.client.authConfigs.updateStatus("DISABLED", { nanoid });
|
|
1060
1209
|
}
|
|
1061
1210
|
};
|
|
1062
1211
|
|
|
1063
1212
|
// src/types/connectedAccounts.types.ts
|
|
1064
|
-
import { z as
|
|
1213
|
+
import { z as z4 } from "zod";
|
|
1065
1214
|
var ConnectedAccountStatuses = {
|
|
1066
1215
|
ACTIVE: "ACTIVE",
|
|
1067
1216
|
INACTIVE: "INACTIVE",
|
|
@@ -1070,7 +1219,7 @@ var ConnectedAccountStatuses = {
|
|
|
1070
1219
|
EXPIRED: "EXPIRED",
|
|
1071
1220
|
FAILED: "FAILED"
|
|
1072
1221
|
};
|
|
1073
|
-
var ConnectedAccountStatusSchema =
|
|
1222
|
+
var ConnectedAccountStatusSchema = z4.enum([
|
|
1074
1223
|
ConnectedAccountStatuses.ACTIVE,
|
|
1075
1224
|
ConnectedAccountStatuses.INACTIVE,
|
|
1076
1225
|
ConnectedAccountStatuses.PENDING,
|
|
@@ -1078,34 +1227,34 @@ var ConnectedAccountStatusSchema = z3.enum([
|
|
|
1078
1227
|
ConnectedAccountStatuses.EXPIRED,
|
|
1079
1228
|
ConnectedAccountStatuses.FAILED
|
|
1080
1229
|
]);
|
|
1081
|
-
var CreateConnectedAccountParamsSchema =
|
|
1082
|
-
authConfig:
|
|
1083
|
-
id:
|
|
1230
|
+
var CreateConnectedAccountParamsSchema = z4.object({
|
|
1231
|
+
authConfig: z4.object({
|
|
1232
|
+
id: z4.string()
|
|
1084
1233
|
}),
|
|
1085
|
-
connection:
|
|
1086
|
-
data:
|
|
1087
|
-
redirectUrl:
|
|
1088
|
-
userId:
|
|
1234
|
+
connection: z4.object({
|
|
1235
|
+
data: z4.record(z4.string(), z4.unknown()).optional(),
|
|
1236
|
+
redirectUrl: z4.string().optional(),
|
|
1237
|
+
userId: z4.string().optional()
|
|
1089
1238
|
})
|
|
1090
1239
|
});
|
|
1091
|
-
var DefaultCreateConnectedAccountParamsSchema =
|
|
1092
|
-
auth_config:
|
|
1093
|
-
id:
|
|
1240
|
+
var DefaultCreateConnectedAccountParamsSchema = z4.object({
|
|
1241
|
+
auth_config: z4.object({
|
|
1242
|
+
id: z4.string()
|
|
1094
1243
|
}),
|
|
1095
|
-
connection:
|
|
1096
|
-
data:
|
|
1097
|
-
redirect_uri:
|
|
1098
|
-
user_id:
|
|
1244
|
+
connection: z4.object({
|
|
1245
|
+
data: z4.record(z4.string(), z4.unknown()).optional(),
|
|
1246
|
+
redirect_uri: z4.string().optional(),
|
|
1247
|
+
user_id: z4.string().optional()
|
|
1099
1248
|
})
|
|
1100
1249
|
});
|
|
1101
|
-
var CreateConnectedAccountOptionsSchema =
|
|
1102
|
-
redirectUrl:
|
|
1103
|
-
data:
|
|
1250
|
+
var CreateConnectedAccountOptionsSchema = z4.object({
|
|
1251
|
+
redirectUrl: z4.string().optional(),
|
|
1252
|
+
data: z4.record(z4.string(), z4.unknown()).optional()
|
|
1104
1253
|
});
|
|
1105
|
-
var CreateConnectedAccountResponseSchema =
|
|
1106
|
-
id:
|
|
1254
|
+
var CreateConnectedAccountResponseSchema = z4.object({
|
|
1255
|
+
id: z4.string(),
|
|
1107
1256
|
status: ConnectedAccountStatusSchema,
|
|
1108
|
-
redirectUrl:
|
|
1257
|
+
redirectUrl: z4.string().nullable()
|
|
1109
1258
|
});
|
|
1110
1259
|
var ConnectedAccountAuthSchemes = {
|
|
1111
1260
|
OAUTH2: "OAUTH2",
|
|
@@ -1122,7 +1271,7 @@ var ConnectedAccountAuthSchemes = {
|
|
|
1122
1271
|
CALCOM_AUTH: "CALCOM_AUTH",
|
|
1123
1272
|
SNOWFLAKE: "SNOWFLAKE"
|
|
1124
1273
|
};
|
|
1125
|
-
var ConnectedAccountAuthSchemesSchema =
|
|
1274
|
+
var ConnectedAccountAuthSchemesSchema = z4.enum([
|
|
1126
1275
|
ConnectedAccountAuthSchemes.OAUTH2,
|
|
1127
1276
|
ConnectedAccountAuthSchemes.OAUTH1,
|
|
1128
1277
|
ConnectedAccountAuthSchemes.OAUTH1A,
|
|
@@ -1137,27 +1286,27 @@ var ConnectedAccountAuthSchemesSchema = z3.enum([
|
|
|
1137
1286
|
ConnectedAccountAuthSchemes.CALCOM_AUTH,
|
|
1138
1287
|
ConnectedAccountAuthSchemes.SNOWFLAKE
|
|
1139
1288
|
]);
|
|
1140
|
-
var ConnectedAccountAuthConfigSchema =
|
|
1141
|
-
id:
|
|
1289
|
+
var ConnectedAccountAuthConfigSchema = z4.object({
|
|
1290
|
+
id: z4.string(),
|
|
1142
1291
|
authScheme: ConnectedAccountAuthSchemesSchema,
|
|
1143
|
-
isComposioManaged:
|
|
1144
|
-
isDisabled:
|
|
1292
|
+
isComposioManaged: z4.boolean(),
|
|
1293
|
+
isDisabled: z4.boolean()
|
|
1145
1294
|
});
|
|
1146
|
-
var ConnectedAccountRetrieveResponseSchema =
|
|
1147
|
-
id:
|
|
1295
|
+
var ConnectedAccountRetrieveResponseSchema = z4.object({
|
|
1296
|
+
id: z4.string(),
|
|
1148
1297
|
authConfig: ConnectedAccountAuthConfigSchema,
|
|
1149
|
-
userId:
|
|
1150
|
-
data:
|
|
1151
|
-
params:
|
|
1298
|
+
userId: z4.string(),
|
|
1299
|
+
data: z4.record(z4.string(), z4.unknown()),
|
|
1300
|
+
params: z4.record(z4.string(), z4.unknown()),
|
|
1152
1301
|
status: ConnectedAccountStatusSchema,
|
|
1153
|
-
statusReason:
|
|
1154
|
-
toolkit:
|
|
1155
|
-
slug:
|
|
1302
|
+
statusReason: z4.string().nullable(),
|
|
1303
|
+
toolkit: z4.object({
|
|
1304
|
+
slug: z4.string()
|
|
1156
1305
|
}),
|
|
1157
|
-
testRequestEndpoint:
|
|
1158
|
-
isDisabled:
|
|
1159
|
-
createdAt:
|
|
1160
|
-
updatedAt:
|
|
1306
|
+
testRequestEndpoint: z4.string().optional(),
|
|
1307
|
+
isDisabled: z4.boolean(),
|
|
1308
|
+
createdAt: z4.string(),
|
|
1309
|
+
updatedAt: z4.string()
|
|
1161
1310
|
});
|
|
1162
1311
|
|
|
1163
1312
|
// src/models/ConnectionRequest.ts
|
|
@@ -1251,13 +1400,35 @@ var ConnectedAccounts = class {
|
|
|
1251
1400
|
return this.client.connectedAccounts.list(query);
|
|
1252
1401
|
}
|
|
1253
1402
|
/**
|
|
1254
|
-
*
|
|
1255
|
-
*
|
|
1256
|
-
*
|
|
1257
|
-
* @
|
|
1403
|
+
* Compound function to create a new connected account.
|
|
1404
|
+
* This function creates a new connected account and returns a connection request.
|
|
1405
|
+
* Users can then wait for the connection to be established using the `waitForConnection` method.
|
|
1406
|
+
* @param {string} userId - User ID of the connected account
|
|
1407
|
+
* @param {string} authConfigId - Auth config ID of the connected account
|
|
1408
|
+
* @param {CreateConnectedAccountOptions} data - Data for creating a new connected account
|
|
1409
|
+
* @returns {Promise<ConnectionRequest>} Connection request object
|
|
1410
|
+
*
|
|
1411
|
+
* @example
|
|
1412
|
+
* const connectionRequest = await composio.createConnectedAccount('user_123', 'auth_config_123', {
|
|
1413
|
+
* data: {
|
|
1414
|
+
* name: 'My Connected Account',
|
|
1415
|
+
* },
|
|
1416
|
+
* });
|
|
1417
|
+
*
|
|
1418
|
+
* @link https://docs.composio.dev/reference/connected-accounts/create-connected-account
|
|
1258
1419
|
*/
|
|
1259
|
-
async create(
|
|
1260
|
-
|
|
1420
|
+
async create(userId, authConfigId, options) {
|
|
1421
|
+
const response = await this.client.connectedAccounts.create({
|
|
1422
|
+
auth_config: {
|
|
1423
|
+
id: authConfigId
|
|
1424
|
+
},
|
|
1425
|
+
connection: {
|
|
1426
|
+
data: options?.data,
|
|
1427
|
+
redirect_uri: options?.redirectUrl,
|
|
1428
|
+
user_id: userId
|
|
1429
|
+
}
|
|
1430
|
+
});
|
|
1431
|
+
return new ConnectionRequest(this.client, response.id, response.status);
|
|
1261
1432
|
}
|
|
1262
1433
|
/**
|
|
1263
1434
|
* Get a connected account by nanoid
|
|
@@ -1314,26 +1485,6 @@ var ConnectedAccounts = class {
|
|
|
1314
1485
|
async disable(nanoid) {
|
|
1315
1486
|
return this.client.connectedAccounts.updateStatus(nanoid, { enabled: false });
|
|
1316
1487
|
}
|
|
1317
|
-
/**
|
|
1318
|
-
* Compound function to create a new connected account.
|
|
1319
|
-
* This function creates a new connected account and returns a connection request.
|
|
1320
|
-
* Users can then wait for the connection to be established using the `waitForConnection` method.
|
|
1321
|
-
* @param {CreateConnectedAccountParams} data - Data for creating a new connected account
|
|
1322
|
-
* @returns {Promise<ConnectionRequest>} Connection request object
|
|
1323
|
-
*/
|
|
1324
|
-
async createConnectedAccount(userId, authConfigId, options) {
|
|
1325
|
-
const response = await this.create({
|
|
1326
|
-
auth_config: {
|
|
1327
|
-
id: authConfigId
|
|
1328
|
-
},
|
|
1329
|
-
connection: {
|
|
1330
|
-
data: options?.data,
|
|
1331
|
-
redirect_uri: options?.redirectUrl,
|
|
1332
|
-
user_id: userId
|
|
1333
|
-
}
|
|
1334
|
-
});
|
|
1335
|
-
return new ConnectionRequest(this.client, response.id, response.status);
|
|
1336
|
-
}
|
|
1337
1488
|
};
|
|
1338
1489
|
|
|
1339
1490
|
// src/types/telemetry.types.ts
|
|
@@ -1820,7 +1971,7 @@ var OpenAIToolset = class extends BaseNonAgenticToolset {
|
|
|
1820
1971
|
};
|
|
1821
1972
|
|
|
1822
1973
|
// package.json
|
|
1823
|
-
var version = "0.1.
|
|
1974
|
+
var version = "0.1.8-alpha.0";
|
|
1824
1975
|
|
|
1825
1976
|
// src/utils/uuid.ts
|
|
1826
1977
|
import { v4 as uuidv4 } from "uuid";
|
|
@@ -1848,7 +1999,9 @@ var Composio = class {
|
|
|
1848
1999
|
toolkits;
|
|
1849
2000
|
triggers;
|
|
1850
2001
|
toolset;
|
|
2002
|
+
// auth configs
|
|
1851
2003
|
authConfigs;
|
|
2004
|
+
createAuthConfig;
|
|
1852
2005
|
// connected accounts
|
|
1853
2006
|
connectedAccounts;
|
|
1854
2007
|
createConnectedAccount;
|
|
@@ -1883,10 +2036,9 @@ var Composio = class {
|
|
|
1883
2036
|
this.toolkits = new Toolkits(this.client);
|
|
1884
2037
|
this.triggers = new Triggers(this.client);
|
|
1885
2038
|
this.authConfigs = new AuthConfigs(this.client);
|
|
2039
|
+
this.createAuthConfig = this.authConfigs.create.bind(this.authConfigs);
|
|
1886
2040
|
this.connectedAccounts = new ConnectedAccounts(this.client);
|
|
1887
|
-
this.createConnectedAccount = this.connectedAccounts.
|
|
1888
|
-
this.connectedAccounts
|
|
1889
|
-
);
|
|
2041
|
+
this.createConnectedAccount = this.connectedAccounts.create.bind(this.connectedAccounts);
|
|
1890
2042
|
if (this.config.allowTracking ?? true) {
|
|
1891
2043
|
this.initializeTelemetry(
|
|
1892
2044
|
{
|
|
@@ -1966,39 +2118,39 @@ var BaseTelemetryTransport = class {
|
|
|
1966
2118
|
};
|
|
1967
2119
|
|
|
1968
2120
|
// src/utils/jsonSchema.ts
|
|
1969
|
-
import { z as
|
|
2121
|
+
import { z as z5 } from "zod";
|
|
1970
2122
|
function jsonSchemaPropertiesToTSTypes(value) {
|
|
1971
2123
|
if (!value.type) {
|
|
1972
|
-
return
|
|
2124
|
+
return z5.object({});
|
|
1973
2125
|
}
|
|
1974
2126
|
let zodType;
|
|
1975
2127
|
switch (value.type) {
|
|
1976
2128
|
case "string":
|
|
1977
|
-
zodType =
|
|
2129
|
+
zodType = z5.string().describe(
|
|
1978
2130
|
(value.description || "") + (value.examples ? `
|
|
1979
2131
|
Examples: ${value.examples.join(", ")}` : "")
|
|
1980
2132
|
);
|
|
1981
2133
|
break;
|
|
1982
2134
|
case "number":
|
|
1983
|
-
zodType =
|
|
2135
|
+
zodType = z5.number().describe(
|
|
1984
2136
|
(value.description || "") + (value.examples ? `
|
|
1985
2137
|
Examples: ${value.examples.join(", ")}` : "")
|
|
1986
2138
|
);
|
|
1987
2139
|
break;
|
|
1988
2140
|
case "integer":
|
|
1989
|
-
zodType =
|
|
2141
|
+
zodType = z5.number().int().describe(
|
|
1990
2142
|
(value.description || "") + (value.examples ? `
|
|
1991
2143
|
Examples: ${value.examples.join(", ")}` : "")
|
|
1992
2144
|
);
|
|
1993
2145
|
break;
|
|
1994
2146
|
case "boolean":
|
|
1995
|
-
zodType =
|
|
2147
|
+
zodType = z5.boolean().describe(
|
|
1996
2148
|
(value.description || "") + (value.examples ? `
|
|
1997
2149
|
Examples: ${value.examples.join(", ")}` : "")
|
|
1998
2150
|
);
|
|
1999
2151
|
break;
|
|
2000
2152
|
case "array":
|
|
2001
|
-
zodType =
|
|
2153
|
+
zodType = z5.array(
|
|
2002
2154
|
jsonSchemaPropertiesToTSTypes(
|
|
2003
2155
|
value.items
|
|
2004
2156
|
)
|
|
@@ -2014,7 +2166,7 @@ Examples: ${value.examples.join(", ")}` : "")
|
|
|
2014
2166
|
);
|
|
2015
2167
|
break;
|
|
2016
2168
|
case "null":
|
|
2017
|
-
zodType =
|
|
2169
|
+
zodType = z5.null().describe(value.description || "");
|
|
2018
2170
|
break;
|
|
2019
2171
|
default:
|
|
2020
2172
|
throw new Error(`Unsupported JSON schema type: ${value.type}`);
|
|
@@ -2025,7 +2177,7 @@ function jsonSchemaToModel(jsonSchema) {
|
|
|
2025
2177
|
const properties = jsonSchema.properties;
|
|
2026
2178
|
const requiredFields = jsonSchema.required || [];
|
|
2027
2179
|
if (!properties) {
|
|
2028
|
-
return
|
|
2180
|
+
return z5.object({});
|
|
2029
2181
|
}
|
|
2030
2182
|
const zodSchema = {};
|
|
2031
2183
|
for (const [key, _] of Object.entries(properties)) {
|
|
@@ -2037,7 +2189,7 @@ function jsonSchemaToModel(jsonSchema) {
|
|
|
2037
2189
|
schema
|
|
2038
2190
|
)
|
|
2039
2191
|
);
|
|
2040
|
-
zodType =
|
|
2192
|
+
zodType = z5.union(anyOfTypes).describe(
|
|
2041
2193
|
(value.description || "") + (value.examples ? `
|
|
2042
2194
|
Examples: ${value.examples.join(", ")}` : "")
|
|
2043
2195
|
);
|
|
@@ -2047,7 +2199,7 @@ Examples: ${value.examples.join(", ")}` : "")
|
|
|
2047
2199
|
schema
|
|
2048
2200
|
)
|
|
2049
2201
|
);
|
|
2050
|
-
zodType =
|
|
2202
|
+
zodType = z5.intersection(
|
|
2051
2203
|
allOfTypes[0],
|
|
2052
2204
|
allOfTypes.slice(1).reduce((acc, schema) => acc.and(schema), allOfTypes[0])
|
|
2053
2205
|
).describe(
|
|
@@ -2071,9 +2223,11 @@ Examples: ${value.examples.join(", ")}` : "")
|
|
|
2071
2223
|
zodSchema[key] = zodType.optional();
|
|
2072
2224
|
}
|
|
2073
2225
|
}
|
|
2074
|
-
return
|
|
2226
|
+
return z5.object(zodSchema);
|
|
2075
2227
|
}
|
|
2076
2228
|
export {
|
|
2229
|
+
AuthConfigTypes,
|
|
2230
|
+
AuthSchemeTypes,
|
|
2077
2231
|
BaseAgenticToolset,
|
|
2078
2232
|
BaseNonAgenticToolset,
|
|
2079
2233
|
BaseTelemetryTransport,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@composio/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.8-alpha.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -28,9 +28,6 @@
|
|
|
28
28
|
"author": "",
|
|
29
29
|
"license": "ISC",
|
|
30
30
|
"packageManager": "pnpm@10.8.0",
|
|
31
|
-
"peerDependencies": {
|
|
32
|
-
"openai": "^4.94.0"
|
|
33
|
-
},
|
|
34
31
|
"devDependencies": {
|
|
35
32
|
"tsup": "^8.4.0",
|
|
36
33
|
"tsx": "^4.19.3",
|
|
@@ -38,10 +35,11 @@
|
|
|
38
35
|
},
|
|
39
36
|
"dependencies": {
|
|
40
37
|
"@composio/client": "0.1.0-alpha.9",
|
|
38
|
+
"openai": "^4.94.0",
|
|
41
39
|
"pusher-js": "^8.4.0",
|
|
42
40
|
"uuid": "^11.1.0",
|
|
43
41
|
"zod": "^3.24.2",
|
|
44
42
|
"zod-to-json-schema": "^3.24.5"
|
|
45
43
|
},
|
|
46
|
-
"gitHead": "
|
|
44
|
+
"gitHead": "5d9df8854dde996024639b4fbe5940c00167baf0"
|
|
47
45
|
}
|