@composio/core 0.1.0-rc.4 → 0.1.0-rc.5
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 +74 -126
- package/dist/index.d.cts +9 -9
- package/dist/index.d.ts +9 -9
- package/dist/index.js +63 -116
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -5,9 +5,6 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
-
};
|
|
11
8
|
var __export = (target, all) => {
|
|
12
9
|
for (var name in all)
|
|
13
10
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -30,54 +27,6 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
27
|
));
|
|
31
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
29
|
|
|
33
|
-
// package.json
|
|
34
|
-
var require_package = __commonJS({
|
|
35
|
-
"package.json"(exports2, module2) {
|
|
36
|
-
module2.exports = {
|
|
37
|
-
name: "@composio/core",
|
|
38
|
-
version: "0.1.0-rc.4",
|
|
39
|
-
description: "",
|
|
40
|
-
main: "dist/index.js",
|
|
41
|
-
type: "module",
|
|
42
|
-
publishConfig: {
|
|
43
|
-
access: "public",
|
|
44
|
-
main: "dist/index.js",
|
|
45
|
-
types: "dist/index.d.ts"
|
|
46
|
-
},
|
|
47
|
-
exports: {
|
|
48
|
-
".": {
|
|
49
|
-
import: "./dist/index.js",
|
|
50
|
-
types: "./dist/index.d.ts",
|
|
51
|
-
require: "./dist/index.cjs"
|
|
52
|
-
}
|
|
53
|
-
},
|
|
54
|
-
files: [
|
|
55
|
-
"README.md",
|
|
56
|
-
"dist"
|
|
57
|
-
],
|
|
58
|
-
scripts: {
|
|
59
|
-
build: "tsup",
|
|
60
|
-
test: 'echo "Error: no test specified" && exit 1'
|
|
61
|
-
},
|
|
62
|
-
keywords: [],
|
|
63
|
-
author: "",
|
|
64
|
-
license: "ISC",
|
|
65
|
-
packageManager: "pnpm@10.8.0",
|
|
66
|
-
devDependencies: {
|
|
67
|
-
tsup: "^8.4.0",
|
|
68
|
-
tsx: "^4.19.3",
|
|
69
|
-
typescript: "^5.8.3"
|
|
70
|
-
},
|
|
71
|
-
dependencies: {
|
|
72
|
-
"@composio/client": "0.1.0-alpha.8",
|
|
73
|
-
openai: "^4.94.0",
|
|
74
|
-
"pusher-js": "^8.4.0",
|
|
75
|
-
zod: "^3.24.2"
|
|
76
|
-
}
|
|
77
|
-
};
|
|
78
|
-
}
|
|
79
|
-
});
|
|
80
|
-
|
|
81
30
|
// src/index.ts
|
|
82
31
|
var index_exports = {};
|
|
83
32
|
__export(index_exports, {
|
|
@@ -200,6 +149,7 @@ var getEnvVariable = (name, defaultValue = void 0) => {
|
|
|
200
149
|
try {
|
|
201
150
|
return process.env[name] || defaultValue;
|
|
202
151
|
} catch (_e) {
|
|
152
|
+
logger_default.error(`Error getting environment variable ${name}:`, _e);
|
|
203
153
|
return defaultValue;
|
|
204
154
|
}
|
|
205
155
|
};
|
|
@@ -437,11 +387,7 @@ var Triggers = class {
|
|
|
437
387
|
* @returns {Promise<TriggerInstanceUpsertResponse>} The updated trigger instance
|
|
438
388
|
*/
|
|
439
389
|
async disable(slug, options) {
|
|
440
|
-
return this.client.triggerInstances.updateStatus(
|
|
441
|
-
"disable",
|
|
442
|
-
{ slug },
|
|
443
|
-
options
|
|
444
|
-
);
|
|
390
|
+
return this.client.triggerInstances.updateStatus("disable", { slug }, options);
|
|
445
391
|
}
|
|
446
392
|
/**
|
|
447
393
|
* Enable a trigger instance
|
|
@@ -451,18 +397,14 @@ var Triggers = class {
|
|
|
451
397
|
* @returns {Promise<TriggerInstanceUpsertResponse>} The updated trigger instance
|
|
452
398
|
*/
|
|
453
399
|
async enable(slug, options) {
|
|
454
|
-
return this.client.triggerInstances.updateStatus(
|
|
455
|
-
"enable",
|
|
456
|
-
{ slug },
|
|
457
|
-
options
|
|
458
|
-
);
|
|
400
|
+
return this.client.triggerInstances.updateStatus("enable", { slug }, options);
|
|
459
401
|
}
|
|
460
402
|
/**
|
|
461
403
|
* @TODO Learn about trigger types
|
|
462
404
|
*/
|
|
463
405
|
/**
|
|
464
406
|
* List all the trigger types
|
|
465
|
-
*
|
|
407
|
+
*
|
|
466
408
|
* @param {TriggersTypeListParams} query - The query parameters to filter the trigger types
|
|
467
409
|
* @param {RequestOptions} options - Request options
|
|
468
410
|
* @returns {Promise<TriggersTypeListResponse>} The list of trigger types
|
|
@@ -472,7 +414,7 @@ var Triggers = class {
|
|
|
472
414
|
}
|
|
473
415
|
/**
|
|
474
416
|
* Retrieve a trigger type by its slug
|
|
475
|
-
*
|
|
417
|
+
*
|
|
476
418
|
* @param {string} slug - The slug of the trigger type
|
|
477
419
|
* @param {RequestOptions} options - request options
|
|
478
420
|
* @returns {Promise<TriggersTypeRetrieveResponse>} The trigger type object
|
|
@@ -482,10 +424,10 @@ var Triggers = class {
|
|
|
482
424
|
}
|
|
483
425
|
/**
|
|
484
426
|
* Fetches the list of all the available trigger enums
|
|
485
|
-
*
|
|
427
|
+
*
|
|
486
428
|
* This method is used by the CLI where filters are not required.
|
|
487
|
-
* @param options
|
|
488
|
-
* @returns
|
|
429
|
+
* @param options
|
|
430
|
+
* @returns
|
|
489
431
|
*/
|
|
490
432
|
async listEnum(options) {
|
|
491
433
|
return this.client.triggersTypes.retrieveEnum(options);
|
|
@@ -496,10 +438,7 @@ var Triggers = class {
|
|
|
496
438
|
const sessionInfo = await session.getInfo();
|
|
497
439
|
const clientId = sessionInfo.project?.id;
|
|
498
440
|
if (!clientId) throw new Error("Client ID not found");
|
|
499
|
-
await PusherUtils.getPusherClient(
|
|
500
|
-
this.client.baseURL,
|
|
501
|
-
this.client.apiKey
|
|
502
|
-
);
|
|
441
|
+
await PusherUtils.getPusherClient(this.client.baseURL, this.client.apiKey);
|
|
503
442
|
const shouldSendTrigger = (data) => {
|
|
504
443
|
if (Object.keys(filters).length === 0) return true;
|
|
505
444
|
else {
|
|
@@ -533,7 +472,7 @@ var BaseComposioToolset = class {
|
|
|
533
472
|
setClient(client) {
|
|
534
473
|
this.client = client;
|
|
535
474
|
}
|
|
536
|
-
/**
|
|
475
|
+
/**
|
|
537
476
|
* Get a tool from the client.
|
|
538
477
|
* @param slug - The slug of the tool.
|
|
539
478
|
* @returns The tool.
|
|
@@ -548,7 +487,9 @@ var BaseComposioToolset = class {
|
|
|
548
487
|
*/
|
|
549
488
|
ensureClient() {
|
|
550
489
|
if (!this.client) {
|
|
551
|
-
throw new Error(
|
|
490
|
+
throw new Error(
|
|
491
|
+
"Client not initialized. Make sure the toolset is properly initialized with Composio."
|
|
492
|
+
);
|
|
552
493
|
}
|
|
553
494
|
}
|
|
554
495
|
};
|
|
@@ -784,7 +725,9 @@ var BatchProcessor = class {
|
|
|
784
725
|
var BrowserTelemetryTransport = class {
|
|
785
726
|
send(payload) {
|
|
786
727
|
if (typeof window === "undefined") {
|
|
787
|
-
return Promise.reject(
|
|
728
|
+
return Promise.reject(
|
|
729
|
+
new Error("BrowserTelemetryTransport can only be used in browser environments")
|
|
730
|
+
);
|
|
788
731
|
}
|
|
789
732
|
return new Promise((resolve) => {
|
|
790
733
|
try {
|
|
@@ -799,6 +742,7 @@ var BrowserTelemetryTransport = class {
|
|
|
799
742
|
};
|
|
800
743
|
xhr.send(JSON.stringify(payload.data));
|
|
801
744
|
} catch (error) {
|
|
745
|
+
logger_default.error("Error sending error to telemetry", error);
|
|
802
746
|
resolve();
|
|
803
747
|
}
|
|
804
748
|
});
|
|
@@ -809,7 +753,9 @@ var BrowserTelemetryTransport = class {
|
|
|
809
753
|
var ProcessTelemetryTransport = class {
|
|
810
754
|
send(payload) {
|
|
811
755
|
if (typeof window !== "undefined") {
|
|
812
|
-
return Promise.reject(
|
|
756
|
+
return Promise.reject(
|
|
757
|
+
new Error("ProcessTelemetryTransport can only be used in Node.js environments")
|
|
758
|
+
);
|
|
813
759
|
}
|
|
814
760
|
return new Promise((resolve) => {
|
|
815
761
|
try {
|
|
@@ -843,14 +789,18 @@ var ProcessTelemetryTransport = class {
|
|
|
843
789
|
req.end();
|
|
844
790
|
`
|
|
845
791
|
];
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
792
|
+
import("child_process").then(({ spawn }) => {
|
|
793
|
+
spawn("node", args, {
|
|
794
|
+
stdio: "ignore",
|
|
795
|
+
detached: true,
|
|
796
|
+
shell: false
|
|
797
|
+
}).unref();
|
|
798
|
+
resolve();
|
|
799
|
+
}).catch(() => {
|
|
800
|
+
resolve();
|
|
801
|
+
});
|
|
853
802
|
} catch (error) {
|
|
803
|
+
logger_default.error("Error sending telemetry", error);
|
|
854
804
|
resolve();
|
|
855
805
|
}
|
|
856
806
|
});
|
|
@@ -874,20 +824,22 @@ var Telemetry = class {
|
|
|
874
824
|
} else {
|
|
875
825
|
this.transport = new ProcessTelemetryTransport();
|
|
876
826
|
}
|
|
877
|
-
this.sendTelemetry([
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
827
|
+
this.sendTelemetry([
|
|
828
|
+
{
|
|
829
|
+
eventName: TELEMETRY_EVENTS.SDK_INITIALIZED,
|
|
830
|
+
data: {},
|
|
831
|
+
sdk_meta: this.telemetryMetadata
|
|
832
|
+
}
|
|
833
|
+
]);
|
|
882
834
|
}
|
|
883
835
|
/**
|
|
884
836
|
* Instrument the telemetry for the given instance.
|
|
885
|
-
*
|
|
837
|
+
*
|
|
886
838
|
* You can pass the instance and the file name of the instance to instrument the telemetry.
|
|
887
839
|
* This will instrument all the methods of the instance and log the telemetry for each method call.
|
|
888
840
|
* @param instance - any instance that extends InstrumentedInstance
|
|
889
841
|
* @param fileName - the file name of the instance
|
|
890
|
-
* @returns
|
|
842
|
+
* @returns
|
|
891
843
|
*/
|
|
892
844
|
instrumentTelemetry(instance, fileName) {
|
|
893
845
|
const proto = Object.getPrototypeOf(instance);
|
|
@@ -931,7 +883,7 @@ var Telemetry = class {
|
|
|
931
883
|
/**
|
|
932
884
|
* Send the telemetry payload to the server.
|
|
933
885
|
* @param payload - the telemetry payload to send
|
|
934
|
-
* @returns
|
|
886
|
+
* @returns
|
|
935
887
|
*/
|
|
936
888
|
async sendTelemetry(payload) {
|
|
937
889
|
const isTelemetryDisabled = getEnvVariable("TELEMETRY_DISABLED", "false") === "true";
|
|
@@ -976,6 +928,9 @@ function getSDKConfig(baseUrl, apiKey) {
|
|
|
976
928
|
return { baseURL: baseURLParsed, apiKey: apiKeyParsed };
|
|
977
929
|
}
|
|
978
930
|
|
|
931
|
+
// package.json
|
|
932
|
+
var version = "0.1.0-rc.5";
|
|
933
|
+
|
|
979
934
|
// src/utils/version.ts
|
|
980
935
|
function isNewerVersion(version1, version2) {
|
|
981
936
|
const v1 = version1.split(".").map(Number);
|
|
@@ -989,10 +944,8 @@ function isNewerVersion(version1, version2) {
|
|
|
989
944
|
async function checkForLatestVersionFromNPM() {
|
|
990
945
|
try {
|
|
991
946
|
const packageName = "composio-core";
|
|
992
|
-
const currentVersionFromPackageJson =
|
|
993
|
-
const response = await fetch(
|
|
994
|
-
`https://registry.npmjs.org/${packageName}/latest`
|
|
995
|
-
);
|
|
947
|
+
const currentVersionFromPackageJson = version;
|
|
948
|
+
const response = await fetch(`https://registry.npmjs.org/${packageName}/latest`);
|
|
996
949
|
const data = await response.json();
|
|
997
950
|
const latestVersion = data.version;
|
|
998
951
|
if (isNewerVersion(latestVersion, currentVersionFromPackageJson) && !IS_DEVELOPMENT_OR_CI) {
|
|
@@ -1048,9 +1001,7 @@ var Composio = class {
|
|
|
1048
1001
|
config?.apiKey
|
|
1049
1002
|
);
|
|
1050
1003
|
if (IS_DEVELOPMENT_OR_CI) {
|
|
1051
|
-
logger_default.info(
|
|
1052
|
-
`Initializing Composio w API Key: [REDACTED] and baseURL: ${baseURLParsed}`
|
|
1053
|
-
);
|
|
1004
|
+
logger_default.info(`Initializing Composio w API Key: [REDACTED] and baseURL: ${baseURLParsed}`);
|
|
1054
1005
|
}
|
|
1055
1006
|
if (config.userId && config.connectedAccountIds) {
|
|
1056
1007
|
logger_default.warn(
|
|
@@ -1061,7 +1012,6 @@ var Composio = class {
|
|
|
1061
1012
|
apiKey: apiKeyParsed,
|
|
1062
1013
|
baseURL: baseURLParsed
|
|
1063
1014
|
});
|
|
1064
|
-
this.client;
|
|
1065
1015
|
this.config = {
|
|
1066
1016
|
...config,
|
|
1067
1017
|
allowTracking: config.allowTracking ?? true
|
|
@@ -1076,16 +1026,19 @@ var Composio = class {
|
|
|
1076
1026
|
this.authConfigs = new AuthConfigs(this.client);
|
|
1077
1027
|
this.connectedAccounts = new ConnectedAccounts(this.client);
|
|
1078
1028
|
if (this.config.allowTracking ?? true) {
|
|
1079
|
-
this.initializeTelemetry(
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1029
|
+
this.initializeTelemetry(
|
|
1030
|
+
{
|
|
1031
|
+
apiKey: apiKeyParsed ?? "",
|
|
1032
|
+
baseUrl: baseURLParsed ?? "",
|
|
1033
|
+
frameworkRuntime: "node",
|
|
1034
|
+
source: "node",
|
|
1035
|
+
// @TODO: get the source
|
|
1036
|
+
sessionId: this.userId,
|
|
1037
|
+
composioVersion: version,
|
|
1038
|
+
isBrowser: typeof window !== "undefined"
|
|
1039
|
+
},
|
|
1040
|
+
config.telemetryTransport
|
|
1041
|
+
);
|
|
1089
1042
|
}
|
|
1090
1043
|
checkForLatestVersionFromNPM();
|
|
1091
1044
|
}
|
|
@@ -1118,9 +1071,7 @@ var Composio = class {
|
|
|
1118
1071
|
*/
|
|
1119
1072
|
getClient() {
|
|
1120
1073
|
if (!this.client) {
|
|
1121
|
-
throw new Error(
|
|
1122
|
-
"Composio client is not initialized. Please initialize it first."
|
|
1123
|
-
);
|
|
1074
|
+
throw new Error("Composio client is not initialized. Please initialize it first.");
|
|
1124
1075
|
}
|
|
1125
1076
|
return this.client;
|
|
1126
1077
|
}
|
|
@@ -1142,39 +1093,39 @@ var Composio = class {
|
|
|
1142
1093
|
};
|
|
1143
1094
|
|
|
1144
1095
|
// src/utils/jsonSchema.ts
|
|
1145
|
-
var import_zod =
|
|
1096
|
+
var import_zod = require("zod");
|
|
1146
1097
|
function jsonSchemaPropertiesToTSTypes(value) {
|
|
1147
1098
|
if (!value.type) {
|
|
1148
|
-
return import_zod.
|
|
1099
|
+
return import_zod.z.object({});
|
|
1149
1100
|
}
|
|
1150
1101
|
let zodType;
|
|
1151
1102
|
switch (value.type) {
|
|
1152
1103
|
case "string":
|
|
1153
|
-
zodType = import_zod.
|
|
1104
|
+
zodType = import_zod.z.string().describe(
|
|
1154
1105
|
(value.description || "") + (value.examples ? `
|
|
1155
1106
|
Examples: ${value.examples.join(", ")}` : "")
|
|
1156
1107
|
);
|
|
1157
1108
|
break;
|
|
1158
1109
|
case "number":
|
|
1159
|
-
zodType = import_zod.
|
|
1110
|
+
zodType = import_zod.z.number().describe(
|
|
1160
1111
|
(value.description || "") + (value.examples ? `
|
|
1161
1112
|
Examples: ${value.examples.join(", ")}` : "")
|
|
1162
1113
|
);
|
|
1163
1114
|
break;
|
|
1164
1115
|
case "integer":
|
|
1165
|
-
zodType = import_zod.
|
|
1116
|
+
zodType = import_zod.z.number().int().describe(
|
|
1166
1117
|
(value.description || "") + (value.examples ? `
|
|
1167
1118
|
Examples: ${value.examples.join(", ")}` : "")
|
|
1168
1119
|
);
|
|
1169
1120
|
break;
|
|
1170
1121
|
case "boolean":
|
|
1171
|
-
zodType = import_zod.
|
|
1122
|
+
zodType = import_zod.z.boolean().describe(
|
|
1172
1123
|
(value.description || "") + (value.examples ? `
|
|
1173
1124
|
Examples: ${value.examples.join(", ")}` : "")
|
|
1174
1125
|
);
|
|
1175
1126
|
break;
|
|
1176
1127
|
case "array":
|
|
1177
|
-
zodType = import_zod.
|
|
1128
|
+
zodType = import_zod.z.array(
|
|
1178
1129
|
jsonSchemaPropertiesToTSTypes(
|
|
1179
1130
|
value.items
|
|
1180
1131
|
)
|
|
@@ -1190,7 +1141,7 @@ Examples: ${value.examples.join(", ")}` : "")
|
|
|
1190
1141
|
);
|
|
1191
1142
|
break;
|
|
1192
1143
|
case "null":
|
|
1193
|
-
zodType = import_zod.
|
|
1144
|
+
zodType = import_zod.z.null().describe(value.description || "");
|
|
1194
1145
|
break;
|
|
1195
1146
|
default:
|
|
1196
1147
|
throw new Error(`Unsupported JSON schema type: ${value.type}`);
|
|
@@ -1201,7 +1152,7 @@ function jsonSchemaToModel(jsonSchema) {
|
|
|
1201
1152
|
const properties = jsonSchema.properties;
|
|
1202
1153
|
const requiredFields = jsonSchema.required || [];
|
|
1203
1154
|
if (!properties) {
|
|
1204
|
-
return import_zod.
|
|
1155
|
+
return import_zod.z.object({});
|
|
1205
1156
|
}
|
|
1206
1157
|
const zodSchema = {};
|
|
1207
1158
|
for (const [key, _] of Object.entries(properties)) {
|
|
@@ -1213,7 +1164,7 @@ function jsonSchemaToModel(jsonSchema) {
|
|
|
1213
1164
|
schema
|
|
1214
1165
|
)
|
|
1215
1166
|
);
|
|
1216
|
-
zodType = import_zod.
|
|
1167
|
+
zodType = import_zod.z.union(anyOfTypes).describe(
|
|
1217
1168
|
(value.description || "") + (value.examples ? `
|
|
1218
1169
|
Examples: ${value.examples.join(", ")}` : "")
|
|
1219
1170
|
);
|
|
@@ -1223,12 +1174,9 @@ Examples: ${value.examples.join(", ")}` : "")
|
|
|
1223
1174
|
schema
|
|
1224
1175
|
)
|
|
1225
1176
|
);
|
|
1226
|
-
zodType = import_zod.
|
|
1177
|
+
zodType = import_zod.z.intersection(
|
|
1227
1178
|
allOfTypes[0],
|
|
1228
|
-
allOfTypes.slice(1).reduce(
|
|
1229
|
-
(acc, schema) => acc.and(schema),
|
|
1230
|
-
allOfTypes[0]
|
|
1231
|
-
)
|
|
1179
|
+
allOfTypes.slice(1).reduce((acc, schema) => acc.and(schema), allOfTypes[0])
|
|
1232
1180
|
).describe(
|
|
1233
1181
|
(value.description || "") + (value.examples ? `
|
|
1234
1182
|
Examples: ${value.examples.join(", ")}` : "")
|
|
@@ -1250,7 +1198,7 @@ Examples: ${value.examples.join(", ")}` : "")
|
|
|
1250
1198
|
zodSchema[key] = zodType.optional();
|
|
1251
1199
|
}
|
|
1252
1200
|
}
|
|
1253
|
-
return import_zod.
|
|
1201
|
+
return import_zod.z.object(zodSchema);
|
|
1254
1202
|
}
|
|
1255
1203
|
|
|
1256
1204
|
// src/telemetry/TelemetryTransport.ts
|
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ComposioClient from '@composio/client';
|
|
2
2
|
import { ToolRetrieveResponse, ToolListParams as ToolListParams$1, ToolListResponse, ToolExecuteParams, ToolExecuteResponse, ToolRetrieveEnumResponse, ToolGetInputParams, ToolGetInputResponse } from '@composio/client/resources/tools';
|
|
3
|
-
import
|
|
3
|
+
import { z } from 'zod';
|
|
4
4
|
import { RequestOptions } from '@composio/client/internal/request-options';
|
|
5
5
|
import { ToolkitListParams, ToolkitListResponse, ToolkitRetrieveResponse, ToolkitRetrieveCategoriesResponse } from '@composio/client/resources/toolkits';
|
|
6
6
|
import { TriggerInstanceListActiveParams, TriggerInstanceUpsertParams, TriggerInstanceUpsertResponse, TriggerInstanceRemoveUpsertResponse, TriggerInstanceUpdateStatusParams, TriggersTypeListParams, TriggersTypeListResponse, TriggersTypeRetrieveResponse, TriggersTypeRetrieveEnumResponse } from '@composio/client/resources/index';
|
|
@@ -13,8 +13,8 @@ type Tool = ToolRetrieveResponse;
|
|
|
13
13
|
interface BaseTool {
|
|
14
14
|
name: string;
|
|
15
15
|
description?: string;
|
|
16
|
-
input_parameters?: Record<string,
|
|
17
|
-
output_parameters?: Record<string,
|
|
16
|
+
input_parameters?: Record<string, unknown>;
|
|
17
|
+
output_parameters?: Record<string, unknown>;
|
|
18
18
|
}
|
|
19
19
|
declare const ToolListParamsSchema: z.ZodObject<{
|
|
20
20
|
cursor: z.ZodOptional<z.ZodString>;
|
|
@@ -271,7 +271,7 @@ declare class Triggers implements InstrumentedInstance {
|
|
|
271
271
|
* @returns
|
|
272
272
|
*/
|
|
273
273
|
listEnum(options?: RequestOptions): Promise<TriggersTypeRetrieveEnumResponse>;
|
|
274
|
-
subscribe(fn: (
|
|
274
|
+
subscribe(fn: (_data: TriggerData) => void, filters?: TriggerSubscribeParams): Promise<void>;
|
|
275
275
|
unsubscribe(): Promise<void>;
|
|
276
276
|
}
|
|
277
277
|
|
|
@@ -550,7 +550,7 @@ declare class OpenAIToolset extends BaseComposioToolset<OpenAiToolCollection, Op
|
|
|
550
550
|
waitAndHandleAssistantToolCalls(client: OpenAI, run: OpenAI.Beta.Threads.Run, thread: OpenAI.Beta.Threads.Thread, userId?: string): Promise<OpenAI.Beta.Threads.Runs.Run>;
|
|
551
551
|
}
|
|
552
552
|
|
|
553
|
-
type ComposioConfig<TToolset extends BaseComposioToolset<
|
|
553
|
+
type ComposioConfig<TToolset extends BaseComposioToolset<unknown, unknown> = OpenAIToolset> = {
|
|
554
554
|
apiKey?: string;
|
|
555
555
|
baseURL?: string;
|
|
556
556
|
allowTracking?: boolean;
|
|
@@ -564,7 +564,7 @@ type ComposioConfig<TToolset extends BaseComposioToolset<any, any> = OpenAITools
|
|
|
564
564
|
* This is the core class for Composio.
|
|
565
565
|
* It is used to initialize the Composio SDK and provide a global configuration.
|
|
566
566
|
*/
|
|
567
|
-
declare class Composio<TToolset extends BaseComposioToolset<
|
|
567
|
+
declare class Composio<TToolset extends BaseComposioToolset<unknown, unknown> = OpenAIToolset> {
|
|
568
568
|
private readonly DEFAULT_USER_ID;
|
|
569
569
|
readonly FILE_NAME = "core/composio.ts";
|
|
570
570
|
/**
|
|
@@ -623,13 +623,13 @@ declare class Composio<TToolset extends BaseComposioToolset<any, any> = OpenAITo
|
|
|
623
623
|
* Generic function to get all the tools
|
|
624
624
|
* @returns {Promise<ReturnType<TToolset["getTool"]>>} Promise with list of tools
|
|
625
625
|
*/
|
|
626
|
-
getTool(slug: string): Promise<ReturnType<TToolset[
|
|
626
|
+
getTool(slug: string): Promise<ReturnType<TToolset['getTool']>>;
|
|
627
627
|
/**
|
|
628
628
|
* Generic function to get all the tools
|
|
629
629
|
* @param query - Query parameters for the tools
|
|
630
630
|
* @returns {Promise<ReturnType<TToolset["getTools">} Promise with list/records of tools
|
|
631
631
|
*/
|
|
632
|
-
getTools(query?: ToolListParams$1): Promise<ReturnType<TToolset[
|
|
632
|
+
getTools(query?: ToolListParams$1): Promise<ReturnType<TToolset['getTools']>>;
|
|
633
633
|
}
|
|
634
634
|
|
|
635
635
|
/**
|
|
@@ -648,6 +648,6 @@ declare class ComposioToolset extends BaseComposioToolset<Array<CustomTool>, Cus
|
|
|
648
648
|
test(): Promise<void>;
|
|
649
649
|
}
|
|
650
650
|
|
|
651
|
-
declare function jsonSchemaToModel(jsonSchema: Record<string, unknown>): z
|
|
651
|
+
declare function jsonSchemaToModel(jsonSchema: Record<string, unknown>): z.ZodObject<Record<string, z.ZodTypeAny>>;
|
|
652
652
|
|
|
653
653
|
export { BaseComposioToolset, BaseTelemetryTransport, Composio, ComposioToolset, type InstrumentedInstance, OpenAIToolset, type Tool, type ToolListParams, ToolListParamsSchema, type Toolset, jsonSchemaToModel };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ComposioClient from '@composio/client';
|
|
2
2
|
import { ToolRetrieveResponse, ToolListParams as ToolListParams$1, ToolListResponse, ToolExecuteParams, ToolExecuteResponse, ToolRetrieveEnumResponse, ToolGetInputParams, ToolGetInputResponse } from '@composio/client/resources/tools';
|
|
3
|
-
import
|
|
3
|
+
import { z } from 'zod';
|
|
4
4
|
import { RequestOptions } from '@composio/client/internal/request-options';
|
|
5
5
|
import { ToolkitListParams, ToolkitListResponse, ToolkitRetrieveResponse, ToolkitRetrieveCategoriesResponse } from '@composio/client/resources/toolkits';
|
|
6
6
|
import { TriggerInstanceListActiveParams, TriggerInstanceUpsertParams, TriggerInstanceUpsertResponse, TriggerInstanceRemoveUpsertResponse, TriggerInstanceUpdateStatusParams, TriggersTypeListParams, TriggersTypeListResponse, TriggersTypeRetrieveResponse, TriggersTypeRetrieveEnumResponse } from '@composio/client/resources/index';
|
|
@@ -13,8 +13,8 @@ type Tool = ToolRetrieveResponse;
|
|
|
13
13
|
interface BaseTool {
|
|
14
14
|
name: string;
|
|
15
15
|
description?: string;
|
|
16
|
-
input_parameters?: Record<string,
|
|
17
|
-
output_parameters?: Record<string,
|
|
16
|
+
input_parameters?: Record<string, unknown>;
|
|
17
|
+
output_parameters?: Record<string, unknown>;
|
|
18
18
|
}
|
|
19
19
|
declare const ToolListParamsSchema: z.ZodObject<{
|
|
20
20
|
cursor: z.ZodOptional<z.ZodString>;
|
|
@@ -271,7 +271,7 @@ declare class Triggers implements InstrumentedInstance {
|
|
|
271
271
|
* @returns
|
|
272
272
|
*/
|
|
273
273
|
listEnum(options?: RequestOptions): Promise<TriggersTypeRetrieveEnumResponse>;
|
|
274
|
-
subscribe(fn: (
|
|
274
|
+
subscribe(fn: (_data: TriggerData) => void, filters?: TriggerSubscribeParams): Promise<void>;
|
|
275
275
|
unsubscribe(): Promise<void>;
|
|
276
276
|
}
|
|
277
277
|
|
|
@@ -550,7 +550,7 @@ declare class OpenAIToolset extends BaseComposioToolset<OpenAiToolCollection, Op
|
|
|
550
550
|
waitAndHandleAssistantToolCalls(client: OpenAI, run: OpenAI.Beta.Threads.Run, thread: OpenAI.Beta.Threads.Thread, userId?: string): Promise<OpenAI.Beta.Threads.Runs.Run>;
|
|
551
551
|
}
|
|
552
552
|
|
|
553
|
-
type ComposioConfig<TToolset extends BaseComposioToolset<
|
|
553
|
+
type ComposioConfig<TToolset extends BaseComposioToolset<unknown, unknown> = OpenAIToolset> = {
|
|
554
554
|
apiKey?: string;
|
|
555
555
|
baseURL?: string;
|
|
556
556
|
allowTracking?: boolean;
|
|
@@ -564,7 +564,7 @@ type ComposioConfig<TToolset extends BaseComposioToolset<any, any> = OpenAITools
|
|
|
564
564
|
* This is the core class for Composio.
|
|
565
565
|
* It is used to initialize the Composio SDK and provide a global configuration.
|
|
566
566
|
*/
|
|
567
|
-
declare class Composio<TToolset extends BaseComposioToolset<
|
|
567
|
+
declare class Composio<TToolset extends BaseComposioToolset<unknown, unknown> = OpenAIToolset> {
|
|
568
568
|
private readonly DEFAULT_USER_ID;
|
|
569
569
|
readonly FILE_NAME = "core/composio.ts";
|
|
570
570
|
/**
|
|
@@ -623,13 +623,13 @@ declare class Composio<TToolset extends BaseComposioToolset<any, any> = OpenAITo
|
|
|
623
623
|
* Generic function to get all the tools
|
|
624
624
|
* @returns {Promise<ReturnType<TToolset["getTool"]>>} Promise with list of tools
|
|
625
625
|
*/
|
|
626
|
-
getTool(slug: string): Promise<ReturnType<TToolset[
|
|
626
|
+
getTool(slug: string): Promise<ReturnType<TToolset['getTool']>>;
|
|
627
627
|
/**
|
|
628
628
|
* Generic function to get all the tools
|
|
629
629
|
* @param query - Query parameters for the tools
|
|
630
630
|
* @returns {Promise<ReturnType<TToolset["getTools">} Promise with list/records of tools
|
|
631
631
|
*/
|
|
632
|
-
getTools(query?: ToolListParams$1): Promise<ReturnType<TToolset[
|
|
632
|
+
getTools(query?: ToolListParams$1): Promise<ReturnType<TToolset['getTools']>>;
|
|
633
633
|
}
|
|
634
634
|
|
|
635
635
|
/**
|
|
@@ -648,6 +648,6 @@ declare class ComposioToolset extends BaseComposioToolset<Array<CustomTool>, Cus
|
|
|
648
648
|
test(): Promise<void>;
|
|
649
649
|
}
|
|
650
650
|
|
|
651
|
-
declare function jsonSchemaToModel(jsonSchema: Record<string, unknown>): z
|
|
651
|
+
declare function jsonSchemaToModel(jsonSchema: Record<string, unknown>): z.ZodObject<Record<string, z.ZodTypeAny>>;
|
|
652
652
|
|
|
653
653
|
export { BaseComposioToolset, BaseTelemetryTransport, Composio, ComposioToolset, type InstrumentedInstance, OpenAIToolset, type Tool, type ToolListParams, ToolListParamsSchema, type Toolset, jsonSchemaToModel };
|
package/dist/index.js
CHANGED
|
@@ -1,61 +1,9 @@
|
|
|
1
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
2
1
|
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
3
2
|
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
4
3
|
}) : x)(function(x) {
|
|
5
4
|
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
6
5
|
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
7
6
|
});
|
|
8
|
-
var __commonJS = (cb, mod) => function __require2() {
|
|
9
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
// package.json
|
|
13
|
-
var require_package = __commonJS({
|
|
14
|
-
"package.json"(exports, module) {
|
|
15
|
-
module.exports = {
|
|
16
|
-
name: "@composio/core",
|
|
17
|
-
version: "0.1.0-rc.4",
|
|
18
|
-
description: "",
|
|
19
|
-
main: "dist/index.js",
|
|
20
|
-
type: "module",
|
|
21
|
-
publishConfig: {
|
|
22
|
-
access: "public",
|
|
23
|
-
main: "dist/index.js",
|
|
24
|
-
types: "dist/index.d.ts"
|
|
25
|
-
},
|
|
26
|
-
exports: {
|
|
27
|
-
".": {
|
|
28
|
-
import: "./dist/index.js",
|
|
29
|
-
types: "./dist/index.d.ts",
|
|
30
|
-
require: "./dist/index.cjs"
|
|
31
|
-
}
|
|
32
|
-
},
|
|
33
|
-
files: [
|
|
34
|
-
"README.md",
|
|
35
|
-
"dist"
|
|
36
|
-
],
|
|
37
|
-
scripts: {
|
|
38
|
-
build: "tsup",
|
|
39
|
-
test: 'echo "Error: no test specified" && exit 1'
|
|
40
|
-
},
|
|
41
|
-
keywords: [],
|
|
42
|
-
author: "",
|
|
43
|
-
license: "ISC",
|
|
44
|
-
packageManager: "pnpm@10.8.0",
|
|
45
|
-
devDependencies: {
|
|
46
|
-
tsup: "^8.4.0",
|
|
47
|
-
tsx: "^4.19.3",
|
|
48
|
-
typescript: "^5.8.3"
|
|
49
|
-
},
|
|
50
|
-
dependencies: {
|
|
51
|
-
"@composio/client": "0.1.0-alpha.8",
|
|
52
|
-
openai: "^4.94.0",
|
|
53
|
-
"pusher-js": "^8.4.0",
|
|
54
|
-
zod: "^3.24.2"
|
|
55
|
-
}
|
|
56
|
-
};
|
|
57
|
-
}
|
|
58
|
-
});
|
|
59
7
|
|
|
60
8
|
// src/composio.ts
|
|
61
9
|
import ComposioClient from "@composio/client";
|
|
@@ -167,6 +115,7 @@ var getEnvVariable = (name, defaultValue = void 0) => {
|
|
|
167
115
|
try {
|
|
168
116
|
return process.env[name] || defaultValue;
|
|
169
117
|
} catch (_e) {
|
|
118
|
+
logger_default.error(`Error getting environment variable ${name}:`, _e);
|
|
170
119
|
return defaultValue;
|
|
171
120
|
}
|
|
172
121
|
};
|
|
@@ -404,11 +353,7 @@ var Triggers = class {
|
|
|
404
353
|
* @returns {Promise<TriggerInstanceUpsertResponse>} The updated trigger instance
|
|
405
354
|
*/
|
|
406
355
|
async disable(slug, options) {
|
|
407
|
-
return this.client.triggerInstances.updateStatus(
|
|
408
|
-
"disable",
|
|
409
|
-
{ slug },
|
|
410
|
-
options
|
|
411
|
-
);
|
|
356
|
+
return this.client.triggerInstances.updateStatus("disable", { slug }, options);
|
|
412
357
|
}
|
|
413
358
|
/**
|
|
414
359
|
* Enable a trigger instance
|
|
@@ -418,18 +363,14 @@ var Triggers = class {
|
|
|
418
363
|
* @returns {Promise<TriggerInstanceUpsertResponse>} The updated trigger instance
|
|
419
364
|
*/
|
|
420
365
|
async enable(slug, options) {
|
|
421
|
-
return this.client.triggerInstances.updateStatus(
|
|
422
|
-
"enable",
|
|
423
|
-
{ slug },
|
|
424
|
-
options
|
|
425
|
-
);
|
|
366
|
+
return this.client.triggerInstances.updateStatus("enable", { slug }, options);
|
|
426
367
|
}
|
|
427
368
|
/**
|
|
428
369
|
* @TODO Learn about trigger types
|
|
429
370
|
*/
|
|
430
371
|
/**
|
|
431
372
|
* List all the trigger types
|
|
432
|
-
*
|
|
373
|
+
*
|
|
433
374
|
* @param {TriggersTypeListParams} query - The query parameters to filter the trigger types
|
|
434
375
|
* @param {RequestOptions} options - Request options
|
|
435
376
|
* @returns {Promise<TriggersTypeListResponse>} The list of trigger types
|
|
@@ -439,7 +380,7 @@ var Triggers = class {
|
|
|
439
380
|
}
|
|
440
381
|
/**
|
|
441
382
|
* Retrieve a trigger type by its slug
|
|
442
|
-
*
|
|
383
|
+
*
|
|
443
384
|
* @param {string} slug - The slug of the trigger type
|
|
444
385
|
* @param {RequestOptions} options - request options
|
|
445
386
|
* @returns {Promise<TriggersTypeRetrieveResponse>} The trigger type object
|
|
@@ -449,10 +390,10 @@ var Triggers = class {
|
|
|
449
390
|
}
|
|
450
391
|
/**
|
|
451
392
|
* Fetches the list of all the available trigger enums
|
|
452
|
-
*
|
|
393
|
+
*
|
|
453
394
|
* This method is used by the CLI where filters are not required.
|
|
454
|
-
* @param options
|
|
455
|
-
* @returns
|
|
395
|
+
* @param options
|
|
396
|
+
* @returns
|
|
456
397
|
*/
|
|
457
398
|
async listEnum(options) {
|
|
458
399
|
return this.client.triggersTypes.retrieveEnum(options);
|
|
@@ -463,10 +404,7 @@ var Triggers = class {
|
|
|
463
404
|
const sessionInfo = await session.getInfo();
|
|
464
405
|
const clientId = sessionInfo.project?.id;
|
|
465
406
|
if (!clientId) throw new Error("Client ID not found");
|
|
466
|
-
await PusherUtils.getPusherClient(
|
|
467
|
-
this.client.baseURL,
|
|
468
|
-
this.client.apiKey
|
|
469
|
-
);
|
|
407
|
+
await PusherUtils.getPusherClient(this.client.baseURL, this.client.apiKey);
|
|
470
408
|
const shouldSendTrigger = (data) => {
|
|
471
409
|
if (Object.keys(filters).length === 0) return true;
|
|
472
410
|
else {
|
|
@@ -500,7 +438,7 @@ var BaseComposioToolset = class {
|
|
|
500
438
|
setClient(client) {
|
|
501
439
|
this.client = client;
|
|
502
440
|
}
|
|
503
|
-
/**
|
|
441
|
+
/**
|
|
504
442
|
* Get a tool from the client.
|
|
505
443
|
* @param slug - The slug of the tool.
|
|
506
444
|
* @returns The tool.
|
|
@@ -515,7 +453,9 @@ var BaseComposioToolset = class {
|
|
|
515
453
|
*/
|
|
516
454
|
ensureClient() {
|
|
517
455
|
if (!this.client) {
|
|
518
|
-
throw new Error(
|
|
456
|
+
throw new Error(
|
|
457
|
+
"Client not initialized. Make sure the toolset is properly initialized with Composio."
|
|
458
|
+
);
|
|
519
459
|
}
|
|
520
460
|
}
|
|
521
461
|
};
|
|
@@ -751,7 +691,9 @@ var BatchProcessor = class {
|
|
|
751
691
|
var BrowserTelemetryTransport = class {
|
|
752
692
|
send(payload) {
|
|
753
693
|
if (typeof window === "undefined") {
|
|
754
|
-
return Promise.reject(
|
|
694
|
+
return Promise.reject(
|
|
695
|
+
new Error("BrowserTelemetryTransport can only be used in browser environments")
|
|
696
|
+
);
|
|
755
697
|
}
|
|
756
698
|
return new Promise((resolve) => {
|
|
757
699
|
try {
|
|
@@ -766,6 +708,7 @@ var BrowserTelemetryTransport = class {
|
|
|
766
708
|
};
|
|
767
709
|
xhr.send(JSON.stringify(payload.data));
|
|
768
710
|
} catch (error) {
|
|
711
|
+
logger_default.error("Error sending error to telemetry", error);
|
|
769
712
|
resolve();
|
|
770
713
|
}
|
|
771
714
|
});
|
|
@@ -776,7 +719,9 @@ var BrowserTelemetryTransport = class {
|
|
|
776
719
|
var ProcessTelemetryTransport = class {
|
|
777
720
|
send(payload) {
|
|
778
721
|
if (typeof window !== "undefined") {
|
|
779
|
-
return Promise.reject(
|
|
722
|
+
return Promise.reject(
|
|
723
|
+
new Error("ProcessTelemetryTransport can only be used in Node.js environments")
|
|
724
|
+
);
|
|
780
725
|
}
|
|
781
726
|
return new Promise((resolve) => {
|
|
782
727
|
try {
|
|
@@ -810,14 +755,18 @@ var ProcessTelemetryTransport = class {
|
|
|
810
755
|
req.end();
|
|
811
756
|
`
|
|
812
757
|
];
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
758
|
+
import("child_process").then(({ spawn }) => {
|
|
759
|
+
spawn("node", args, {
|
|
760
|
+
stdio: "ignore",
|
|
761
|
+
detached: true,
|
|
762
|
+
shell: false
|
|
763
|
+
}).unref();
|
|
764
|
+
resolve();
|
|
765
|
+
}).catch(() => {
|
|
766
|
+
resolve();
|
|
767
|
+
});
|
|
820
768
|
} catch (error) {
|
|
769
|
+
logger_default.error("Error sending telemetry", error);
|
|
821
770
|
resolve();
|
|
822
771
|
}
|
|
823
772
|
});
|
|
@@ -841,20 +790,22 @@ var Telemetry = class {
|
|
|
841
790
|
} else {
|
|
842
791
|
this.transport = new ProcessTelemetryTransport();
|
|
843
792
|
}
|
|
844
|
-
this.sendTelemetry([
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
793
|
+
this.sendTelemetry([
|
|
794
|
+
{
|
|
795
|
+
eventName: TELEMETRY_EVENTS.SDK_INITIALIZED,
|
|
796
|
+
data: {},
|
|
797
|
+
sdk_meta: this.telemetryMetadata
|
|
798
|
+
}
|
|
799
|
+
]);
|
|
849
800
|
}
|
|
850
801
|
/**
|
|
851
802
|
* Instrument the telemetry for the given instance.
|
|
852
|
-
*
|
|
803
|
+
*
|
|
853
804
|
* You can pass the instance and the file name of the instance to instrument the telemetry.
|
|
854
805
|
* This will instrument all the methods of the instance and log the telemetry for each method call.
|
|
855
806
|
* @param instance - any instance that extends InstrumentedInstance
|
|
856
807
|
* @param fileName - the file name of the instance
|
|
857
|
-
* @returns
|
|
808
|
+
* @returns
|
|
858
809
|
*/
|
|
859
810
|
instrumentTelemetry(instance, fileName) {
|
|
860
811
|
const proto = Object.getPrototypeOf(instance);
|
|
@@ -898,7 +849,7 @@ var Telemetry = class {
|
|
|
898
849
|
/**
|
|
899
850
|
* Send the telemetry payload to the server.
|
|
900
851
|
* @param payload - the telemetry payload to send
|
|
901
|
-
* @returns
|
|
852
|
+
* @returns
|
|
902
853
|
*/
|
|
903
854
|
async sendTelemetry(payload) {
|
|
904
855
|
const isTelemetryDisabled = getEnvVariable("TELEMETRY_DISABLED", "false") === "true";
|
|
@@ -943,6 +894,9 @@ function getSDKConfig(baseUrl, apiKey) {
|
|
|
943
894
|
return { baseURL: baseURLParsed, apiKey: apiKeyParsed };
|
|
944
895
|
}
|
|
945
896
|
|
|
897
|
+
// package.json
|
|
898
|
+
var version = "0.1.0-rc.5";
|
|
899
|
+
|
|
946
900
|
// src/utils/version.ts
|
|
947
901
|
function isNewerVersion(version1, version2) {
|
|
948
902
|
const v1 = version1.split(".").map(Number);
|
|
@@ -956,10 +910,8 @@ function isNewerVersion(version1, version2) {
|
|
|
956
910
|
async function checkForLatestVersionFromNPM() {
|
|
957
911
|
try {
|
|
958
912
|
const packageName = "composio-core";
|
|
959
|
-
const currentVersionFromPackageJson =
|
|
960
|
-
const response = await fetch(
|
|
961
|
-
`https://registry.npmjs.org/${packageName}/latest`
|
|
962
|
-
);
|
|
913
|
+
const currentVersionFromPackageJson = version;
|
|
914
|
+
const response = await fetch(`https://registry.npmjs.org/${packageName}/latest`);
|
|
963
915
|
const data = await response.json();
|
|
964
916
|
const latestVersion = data.version;
|
|
965
917
|
if (isNewerVersion(latestVersion, currentVersionFromPackageJson) && !IS_DEVELOPMENT_OR_CI) {
|
|
@@ -1015,9 +967,7 @@ var Composio = class {
|
|
|
1015
967
|
config?.apiKey
|
|
1016
968
|
);
|
|
1017
969
|
if (IS_DEVELOPMENT_OR_CI) {
|
|
1018
|
-
logger_default.info(
|
|
1019
|
-
`Initializing Composio w API Key: [REDACTED] and baseURL: ${baseURLParsed}`
|
|
1020
|
-
);
|
|
970
|
+
logger_default.info(`Initializing Composio w API Key: [REDACTED] and baseURL: ${baseURLParsed}`);
|
|
1021
971
|
}
|
|
1022
972
|
if (config.userId && config.connectedAccountIds) {
|
|
1023
973
|
logger_default.warn(
|
|
@@ -1028,7 +978,6 @@ var Composio = class {
|
|
|
1028
978
|
apiKey: apiKeyParsed,
|
|
1029
979
|
baseURL: baseURLParsed
|
|
1030
980
|
});
|
|
1031
|
-
this.client;
|
|
1032
981
|
this.config = {
|
|
1033
982
|
...config,
|
|
1034
983
|
allowTracking: config.allowTracking ?? true
|
|
@@ -1043,16 +992,19 @@ var Composio = class {
|
|
|
1043
992
|
this.authConfigs = new AuthConfigs(this.client);
|
|
1044
993
|
this.connectedAccounts = new ConnectedAccounts(this.client);
|
|
1045
994
|
if (this.config.allowTracking ?? true) {
|
|
1046
|
-
this.initializeTelemetry(
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
995
|
+
this.initializeTelemetry(
|
|
996
|
+
{
|
|
997
|
+
apiKey: apiKeyParsed ?? "",
|
|
998
|
+
baseUrl: baseURLParsed ?? "",
|
|
999
|
+
frameworkRuntime: "node",
|
|
1000
|
+
source: "node",
|
|
1001
|
+
// @TODO: get the source
|
|
1002
|
+
sessionId: this.userId,
|
|
1003
|
+
composioVersion: version,
|
|
1004
|
+
isBrowser: typeof window !== "undefined"
|
|
1005
|
+
},
|
|
1006
|
+
config.telemetryTransport
|
|
1007
|
+
);
|
|
1056
1008
|
}
|
|
1057
1009
|
checkForLatestVersionFromNPM();
|
|
1058
1010
|
}
|
|
@@ -1085,9 +1037,7 @@ var Composio = class {
|
|
|
1085
1037
|
*/
|
|
1086
1038
|
getClient() {
|
|
1087
1039
|
if (!this.client) {
|
|
1088
|
-
throw new Error(
|
|
1089
|
-
"Composio client is not initialized. Please initialize it first."
|
|
1090
|
-
);
|
|
1040
|
+
throw new Error("Composio client is not initialized. Please initialize it first.");
|
|
1091
1041
|
}
|
|
1092
1042
|
return this.client;
|
|
1093
1043
|
}
|
|
@@ -1109,7 +1059,7 @@ var Composio = class {
|
|
|
1109
1059
|
};
|
|
1110
1060
|
|
|
1111
1061
|
// src/utils/jsonSchema.ts
|
|
1112
|
-
import z from "zod";
|
|
1062
|
+
import { z } from "zod";
|
|
1113
1063
|
function jsonSchemaPropertiesToTSTypes(value) {
|
|
1114
1064
|
if (!value.type) {
|
|
1115
1065
|
return z.object({});
|
|
@@ -1192,10 +1142,7 @@ Examples: ${value.examples.join(", ")}` : "")
|
|
|
1192
1142
|
);
|
|
1193
1143
|
zodType = z.intersection(
|
|
1194
1144
|
allOfTypes[0],
|
|
1195
|
-
allOfTypes.slice(1).reduce(
|
|
1196
|
-
(acc, schema) => acc.and(schema),
|
|
1197
|
-
allOfTypes[0]
|
|
1198
|
-
)
|
|
1145
|
+
allOfTypes.slice(1).reduce((acc, schema) => acc.and(schema), allOfTypes[0])
|
|
1199
1146
|
).describe(
|
|
1200
1147
|
(value.description || "") + (value.examples ? `
|
|
1201
1148
|
Examples: ${value.examples.join(", ")}` : "")
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@composio/core",
|
|
3
|
-
"version": "0.1.0-rc.
|
|
3
|
+
"version": "0.1.0-rc.5",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -34,7 +34,7 @@
|
|
|
34
34
|
"typescript": "^5.8.3"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@composio/client": "0.1.0-alpha.
|
|
37
|
+
"@composio/client": "0.1.0-alpha.9",
|
|
38
38
|
"openai": "^4.94.0",
|
|
39
39
|
"pusher-js": "^8.4.0",
|
|
40
40
|
"zod": "^3.24.2"
|