@composio/core 0.1.15 → 0.1.17
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 +619 -496
- package/dist/index.d.cts +9939 -223
- package/dist/index.d.ts +9939 -223
- package/dist/index.js +285 -225
- package/package.json +6 -6
package/dist/index.js
CHANGED
|
@@ -27,6 +27,7 @@ var JSONSchemaType = z.enum([
|
|
|
27
27
|
var JSONSchemaProperty = z.object({
|
|
28
28
|
type: JSONSchemaType.optional(),
|
|
29
29
|
description: z.string().optional(),
|
|
30
|
+
anyOf: z.lazy(() => z.array(JSONSchemaProperty)).optional(),
|
|
30
31
|
title: z.string().optional(),
|
|
31
32
|
default: z.any().optional(),
|
|
32
33
|
properties: z.lazy(() => z.record(z.string(), JSONSchemaProperty)).optional(),
|
|
@@ -35,6 +36,7 @@ var JSONSchemaProperty = z.object({
|
|
|
35
36
|
});
|
|
36
37
|
var ParametersSchema = z.object({
|
|
37
38
|
type: z.literal("object"),
|
|
39
|
+
anyOf: z.array(JSONSchemaProperty).optional(),
|
|
38
40
|
properties: z.record(z.string(), JSONSchemaProperty),
|
|
39
41
|
required: z.array(z.string()).optional(),
|
|
40
42
|
title: z.string().optional(),
|
|
@@ -878,11 +880,171 @@ var TelemetryService = class {
|
|
|
878
880
|
};
|
|
879
881
|
var telemetry = new TelemetryService();
|
|
880
882
|
|
|
883
|
+
// src/errors/AuthConfigErrors.ts
|
|
884
|
+
var AuthConfigErrorCodes = {
|
|
885
|
+
AUTH_CONFIG_NOT_FOUND: "AUTH_CONFIG_NOT_FOUND"
|
|
886
|
+
};
|
|
887
|
+
var ComposioAuthConfigNotFoundError = class extends ComposioError {
|
|
888
|
+
constructor(message = "Auth config not found", options = {}) {
|
|
889
|
+
super(message, {
|
|
890
|
+
...options,
|
|
891
|
+
code: AuthConfigErrorCodes.AUTH_CONFIG_NOT_FOUND,
|
|
892
|
+
possibleFixes: options.possibleFixes || [
|
|
893
|
+
"Check if the auth config exists",
|
|
894
|
+
"Check if the auth config id is correct",
|
|
895
|
+
"Check if the auth config is enabled"
|
|
896
|
+
]
|
|
897
|
+
});
|
|
898
|
+
this.name = "ComposioAuthConfigNotFoundError";
|
|
899
|
+
}
|
|
900
|
+
};
|
|
901
|
+
|
|
902
|
+
// src/errors/ConnectionRequestErrors.ts
|
|
903
|
+
var ConnectionRequestErrorCodes = {
|
|
904
|
+
CONNECTION_REQUEST_TIMEOUT: "CONNECTION_REQUEST_TIMEOUT",
|
|
905
|
+
CONNECTION_REQUEST_FAILED: "CONNECTION_REQUEST_FAILED"
|
|
906
|
+
};
|
|
907
|
+
var ConnectionRequestTimeoutError = class extends ComposioError {
|
|
908
|
+
constructor(message = "Connection request timed out", options = {}) {
|
|
909
|
+
super(message, {
|
|
910
|
+
...options,
|
|
911
|
+
code: ConnectionRequestErrorCodes.CONNECTION_REQUEST_TIMEOUT
|
|
912
|
+
});
|
|
913
|
+
this.name = "ConnectionRequestTimeoutError";
|
|
914
|
+
}
|
|
915
|
+
};
|
|
916
|
+
var ConnectionRequestFailedError = class extends ComposioError {
|
|
917
|
+
constructor(message = "Connection request failed", options = {}) {
|
|
918
|
+
super(message, {
|
|
919
|
+
...options,
|
|
920
|
+
code: ConnectionRequestErrorCodes.CONNECTION_REQUEST_FAILED
|
|
921
|
+
});
|
|
922
|
+
this.name = "ConnectionRequestFailedError";
|
|
923
|
+
}
|
|
924
|
+
};
|
|
925
|
+
|
|
926
|
+
// src/errors/ToolkitErrors.ts
|
|
927
|
+
var ToolkitErrorCodes = {
|
|
928
|
+
TOOLKIT_NOT_FOUND: "TOOLKIT_NOT_FOUND"
|
|
929
|
+
};
|
|
930
|
+
var ComposioToolkitNotFoundError = class extends ComposioError {
|
|
931
|
+
constructor(message = "Toolkit not found", options = {}) {
|
|
932
|
+
super(message, {
|
|
933
|
+
...options,
|
|
934
|
+
code: "TOOLKIT_NOT_FOUND",
|
|
935
|
+
possibleFixes: options.possibleFixes || [
|
|
936
|
+
"Ensure the toolkit is correctly configured and the slug is valid"
|
|
937
|
+
]
|
|
938
|
+
});
|
|
939
|
+
this.name = "ComposioToolkitNotFoundError";
|
|
940
|
+
}
|
|
941
|
+
};
|
|
942
|
+
var ComposioToolkitFetchError = class extends ComposioError {
|
|
943
|
+
constructor(message = "Failed to fetch toolkit", options = {}) {
|
|
944
|
+
super(message, {
|
|
945
|
+
...options,
|
|
946
|
+
code: "TOOLKIT_FETCH_ERROR",
|
|
947
|
+
possibleFixes: options.possibleFixes || [
|
|
948
|
+
"Ensure the toolkit slug is valid",
|
|
949
|
+
"Ensure you are using the correct API key",
|
|
950
|
+
"Ensure you are using the correct API endpoint / Base URL and it is working"
|
|
951
|
+
]
|
|
952
|
+
});
|
|
953
|
+
this.name = "ComposioToolkitFetchError";
|
|
954
|
+
}
|
|
955
|
+
};
|
|
956
|
+
|
|
957
|
+
// src/errors/ValidationErrors.ts
|
|
958
|
+
import { ZodError as ZodError2 } from "zod";
|
|
959
|
+
var ValidationErrorCodes = {
|
|
960
|
+
VALIDATION_ERROR: "VALIDATION_ERROR",
|
|
961
|
+
JSON_SCHEMA_TO_ZOD_ERROR: "JSON_SCHEMA_TO_ZOD_ERROR"
|
|
962
|
+
};
|
|
963
|
+
var ValidationError = class extends ComposioError {
|
|
964
|
+
constructor(message = "Input validation failed", options = {}) {
|
|
965
|
+
const { cause: providedZodError, ...restOptions } = options;
|
|
966
|
+
let zodErrorInstance;
|
|
967
|
+
if (providedZodError instanceof ZodError2) {
|
|
968
|
+
zodErrorInstance = providedZodError;
|
|
969
|
+
} else {
|
|
970
|
+
zodErrorInstance = new ZodError2([
|
|
971
|
+
{
|
|
972
|
+
path: [],
|
|
973
|
+
message: "Invalid input",
|
|
974
|
+
code: "custom"
|
|
975
|
+
}
|
|
976
|
+
]);
|
|
977
|
+
}
|
|
978
|
+
const issues = zodErrorInstance.issues.map(
|
|
979
|
+
(issue) => `[${issue.code}] ${issue.path.join(".")} - ${issue.message}`
|
|
980
|
+
);
|
|
981
|
+
super(message, {
|
|
982
|
+
...restOptions,
|
|
983
|
+
code: options.code || ValidationErrorCodes.VALIDATION_ERROR,
|
|
984
|
+
possibleFixes: issues,
|
|
985
|
+
cause: zodErrorInstance
|
|
986
|
+
});
|
|
987
|
+
this.name = "ValidationError";
|
|
988
|
+
const userFriendlyMessage = this.generateUserFriendlyMessage();
|
|
989
|
+
this.message = `${message}: ${userFriendlyMessage}`;
|
|
990
|
+
}
|
|
991
|
+
generateUserFriendlyMessage() {
|
|
992
|
+
if (this.cause instanceof ZodError2 && this.cause.issues.length > 0) {
|
|
993
|
+
const issue = this.cause.issues[0];
|
|
994
|
+
const path = issue.path.join(".");
|
|
995
|
+
const param = path || "parameter";
|
|
996
|
+
if (issue.code === "invalid_type") {
|
|
997
|
+
return `The ${param} should be a ${issue.expected}, but you provided a ${issue.received}`;
|
|
998
|
+
}
|
|
999
|
+
return issue.message;
|
|
1000
|
+
}
|
|
1001
|
+
return "Please check your input parameters";
|
|
1002
|
+
}
|
|
1003
|
+
};
|
|
1004
|
+
var JsonSchemaToZodError = class extends ComposioError {
|
|
1005
|
+
constructor(message = "Failed to convert JSON schema to Zod schema", options = {}) {
|
|
1006
|
+
super(message, {
|
|
1007
|
+
...options,
|
|
1008
|
+
code: options.code || ValidationErrorCodes.JSON_SCHEMA_TO_ZOD_ERROR
|
|
1009
|
+
});
|
|
1010
|
+
}
|
|
1011
|
+
};
|
|
1012
|
+
|
|
1013
|
+
// src/errors/SDKErrors.ts
|
|
1014
|
+
var SDKErrorCodes = {
|
|
1015
|
+
NO_API_KEY_PROVIDED: "NO_API_KEY_PROVIDED"
|
|
1016
|
+
};
|
|
1017
|
+
var ComposioNoAPIKeyError = class extends ComposioError {
|
|
1018
|
+
constructor(message = "No Composio API key provided", options = {}) {
|
|
1019
|
+
const defaultCause = "Couldn't find an API key in the params, environment variables or in the user config file";
|
|
1020
|
+
super(message, {
|
|
1021
|
+
...options,
|
|
1022
|
+
code: "NO_API_KEY",
|
|
1023
|
+
cause: options.cause || defaultCause,
|
|
1024
|
+
possibleFixes: options.possibleFixes || [
|
|
1025
|
+
"Ensure you have an API key passed in the params, or in environment variable (COMPOSIO_API_KEY) or in the user config file",
|
|
1026
|
+
"To get an API key, please sign up at https://composio.dev/signup",
|
|
1027
|
+
"You can also use the Composio CLI to create a project and get an API key"
|
|
1028
|
+
],
|
|
1029
|
+
statusCode: 401
|
|
1030
|
+
});
|
|
1031
|
+
this.name = "ComposioNoAPIKeyError";
|
|
1032
|
+
}
|
|
1033
|
+
};
|
|
1034
|
+
|
|
881
1035
|
// src/types/connectedAccounts.types.ts
|
|
882
1036
|
import { z as z3 } from "zod";
|
|
883
1037
|
|
|
884
1038
|
// src/types/connectedAccountAuthStates.types.ts
|
|
885
1039
|
import { z as z2 } from "zod";
|
|
1040
|
+
var ConnectionStatusEnum = /* @__PURE__ */ ((ConnectionStatusEnum2) => {
|
|
1041
|
+
ConnectionStatusEnum2["INITIALIZING"] = "INITIALIZING";
|
|
1042
|
+
ConnectionStatusEnum2["INITIATED"] = "INITIATED";
|
|
1043
|
+
ConnectionStatusEnum2["ACTIVE"] = "ACTIVE";
|
|
1044
|
+
ConnectionStatusEnum2["FAILED"] = "FAILED";
|
|
1045
|
+
ConnectionStatusEnum2["EXPIRED"] = "EXPIRED";
|
|
1046
|
+
return ConnectionStatusEnum2;
|
|
1047
|
+
})(ConnectionStatusEnum || {});
|
|
886
1048
|
var AUTH_MODES_ENUM = {
|
|
887
1049
|
OAUTH2: "OAUTH2",
|
|
888
1050
|
OAUTH1: "OAUTH1",
|
|
@@ -1395,157 +1557,31 @@ var ConnectedAccountListResponseSchema = z3.object({
|
|
|
1395
1557
|
totalPages: z3.number().describe("The total number of pages of connected accounts")
|
|
1396
1558
|
});
|
|
1397
1559
|
|
|
1398
|
-
// src/
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
};
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
CONNECTION_REQUEST_TIMEOUT: "CONNECTION_REQUEST_TIMEOUT",
|
|
1420
|
-
CONNECTION_REQUEST_FAILED: "CONNECTION_REQUEST_FAILED"
|
|
1421
|
-
};
|
|
1422
|
-
var ConnectionRequestTimeoutError = class extends ComposioError {
|
|
1423
|
-
constructor(message = "Connection request timed out", options = {}) {
|
|
1424
|
-
super(message, {
|
|
1425
|
-
...options,
|
|
1426
|
-
code: ConnectionRequestErrorCodes.CONNECTION_REQUEST_TIMEOUT
|
|
1427
|
-
});
|
|
1428
|
-
this.name = "ConnectionRequestTimeoutError";
|
|
1429
|
-
}
|
|
1430
|
-
};
|
|
1431
|
-
var ConnectionRequestFailedError = class extends ComposioError {
|
|
1432
|
-
constructor(message = "Connection request failed", options = {}) {
|
|
1433
|
-
super(message, {
|
|
1434
|
-
...options,
|
|
1435
|
-
code: ConnectionRequestErrorCodes.CONNECTION_REQUEST_FAILED
|
|
1436
|
-
});
|
|
1437
|
-
this.name = "ConnectionRequestFailedError";
|
|
1438
|
-
}
|
|
1439
|
-
};
|
|
1440
|
-
|
|
1441
|
-
// src/errors/ToolkitErrors.ts
|
|
1442
|
-
var ToolkitErrorCodes = {
|
|
1443
|
-
TOOLKIT_NOT_FOUND: "TOOLKIT_NOT_FOUND"
|
|
1444
|
-
};
|
|
1445
|
-
var ComposioToolkitNotFoundError = class extends ComposioError {
|
|
1446
|
-
constructor(message = "Toolkit not found", options = {}) {
|
|
1447
|
-
super(message, {
|
|
1448
|
-
...options,
|
|
1449
|
-
code: "TOOLKIT_NOT_FOUND",
|
|
1450
|
-
possibleFixes: options.possibleFixes || [
|
|
1451
|
-
"Ensure the toolkit is correctly configured and the slug is valid"
|
|
1452
|
-
]
|
|
1453
|
-
});
|
|
1454
|
-
this.name = "ComposioToolkitNotFoundError";
|
|
1455
|
-
}
|
|
1456
|
-
};
|
|
1457
|
-
var ComposioToolkitFetchError = class extends ComposioError {
|
|
1458
|
-
constructor(message = "Failed to fetch toolkit", options = {}) {
|
|
1459
|
-
super(message, {
|
|
1460
|
-
...options,
|
|
1461
|
-
code: "TOOLKIT_FETCH_ERROR",
|
|
1462
|
-
possibleFixes: options.possibleFixes || [
|
|
1463
|
-
"Ensure the toolkit slug is valid",
|
|
1464
|
-
"Ensure you are using the correct API key",
|
|
1465
|
-
"Ensure you are using the correct API endpoint / Base URL and it is working"
|
|
1466
|
-
]
|
|
1467
|
-
});
|
|
1468
|
-
this.name = "ComposioToolkitFetchError";
|
|
1469
|
-
}
|
|
1470
|
-
};
|
|
1471
|
-
|
|
1472
|
-
// src/errors/ValidationErrors.ts
|
|
1473
|
-
import { ZodError as ZodError2 } from "zod";
|
|
1474
|
-
var ValidationErrorCodes = {
|
|
1475
|
-
VALIDATION_ERROR: "VALIDATION_ERROR",
|
|
1476
|
-
JSON_SCHEMA_TO_ZOD_ERROR: "JSON_SCHEMA_TO_ZOD_ERROR"
|
|
1477
|
-
};
|
|
1478
|
-
var ValidationError = class extends ComposioError {
|
|
1479
|
-
constructor(message = "Input validation failed", options = {}) {
|
|
1480
|
-
const { cause: providedZodError, ...restOptions } = options;
|
|
1481
|
-
let zodErrorInstance;
|
|
1482
|
-
if (providedZodError instanceof ZodError2) {
|
|
1483
|
-
zodErrorInstance = providedZodError;
|
|
1484
|
-
} else {
|
|
1485
|
-
zodErrorInstance = new ZodError2([
|
|
1486
|
-
{
|
|
1487
|
-
path: [],
|
|
1488
|
-
message: "Invalid input",
|
|
1489
|
-
code: "custom"
|
|
1490
|
-
}
|
|
1491
|
-
]);
|
|
1492
|
-
}
|
|
1493
|
-
const issues = zodErrorInstance.issues.map(
|
|
1494
|
-
(issue) => `[${issue.code}] ${issue.path.join(".")} - ${issue.message}`
|
|
1495
|
-
);
|
|
1496
|
-
super(message, {
|
|
1497
|
-
...restOptions,
|
|
1498
|
-
code: options.code || ValidationErrorCodes.VALIDATION_ERROR,
|
|
1499
|
-
possibleFixes: issues,
|
|
1500
|
-
cause: zodErrorInstance
|
|
1501
|
-
});
|
|
1502
|
-
this.name = "ValidationError";
|
|
1503
|
-
const userFriendlyMessage = this.generateUserFriendlyMessage();
|
|
1504
|
-
this.message = `${message}: ${userFriendlyMessage}`;
|
|
1505
|
-
}
|
|
1506
|
-
generateUserFriendlyMessage() {
|
|
1507
|
-
if (this.cause instanceof ZodError2 && this.cause.issues.length > 0) {
|
|
1508
|
-
const issue = this.cause.issues[0];
|
|
1509
|
-
const path = issue.path.join(".");
|
|
1510
|
-
const param = path || "parameter";
|
|
1511
|
-
if (issue.code === "invalid_type") {
|
|
1512
|
-
return `The ${param} should be a ${issue.expected}, but you provided a ${issue.received}`;
|
|
1513
|
-
}
|
|
1514
|
-
return issue.message;
|
|
1515
|
-
}
|
|
1516
|
-
return "Please check your input parameters";
|
|
1517
|
-
}
|
|
1518
|
-
};
|
|
1519
|
-
var JsonSchemaToZodError = class extends ComposioError {
|
|
1520
|
-
constructor(message = "Failed to convert JSON schema to Zod schema", options = {}) {
|
|
1521
|
-
super(message, {
|
|
1522
|
-
...options,
|
|
1523
|
-
code: options.code || ValidationErrorCodes.JSON_SCHEMA_TO_ZOD_ERROR
|
|
1524
|
-
});
|
|
1525
|
-
}
|
|
1526
|
-
};
|
|
1527
|
-
|
|
1528
|
-
// src/errors/SDKErrors.ts
|
|
1529
|
-
var SDKErrorCodes = {
|
|
1530
|
-
NO_API_KEY_PROVIDED: "NO_API_KEY_PROVIDED"
|
|
1531
|
-
};
|
|
1532
|
-
var ComposioNoAPIKeyError = class extends ComposioError {
|
|
1533
|
-
constructor(message = "No Composio API key provided", options = {}) {
|
|
1534
|
-
const defaultCause = "Couldn't find an API key in the params, environment variables or in the user config file";
|
|
1535
|
-
super(message, {
|
|
1536
|
-
...options,
|
|
1537
|
-
code: "NO_API_KEY",
|
|
1538
|
-
cause: options.cause || defaultCause,
|
|
1539
|
-
possibleFixes: options.possibleFixes || [
|
|
1540
|
-
"Ensure you have an API key passed in the params, or in environment variable (COMPOSIO_API_KEY) or in the user config file",
|
|
1541
|
-
"To get an API key, please sign up at https://composio.dev/signup",
|
|
1542
|
-
"You can also use the Composio CLI to create a project and get an API key"
|
|
1543
|
-
],
|
|
1544
|
-
statusCode: 401
|
|
1560
|
+
// src/utils/transformers/connectedAccounts.ts
|
|
1561
|
+
function transformConnectedAccountResponse(response) {
|
|
1562
|
+
const result = ConnectedAccountRetrieveResponseSchema.safeParse({
|
|
1563
|
+
...response,
|
|
1564
|
+
authConfig: {
|
|
1565
|
+
...response.auth_config,
|
|
1566
|
+
id: response.auth_config.id,
|
|
1567
|
+
isComposioManaged: response.auth_config.is_composio_managed,
|
|
1568
|
+
isDisabled: response.auth_config.is_disabled
|
|
1569
|
+
},
|
|
1570
|
+
state: response.state,
|
|
1571
|
+
status: response.status,
|
|
1572
|
+
statusReason: response.status_reason,
|
|
1573
|
+
isDisabled: response.is_disabled,
|
|
1574
|
+
createdAt: response.created_at,
|
|
1575
|
+
updatedAt: response.updated_at,
|
|
1576
|
+
testRequestEndpoint: response.test_request_endpoint
|
|
1577
|
+
});
|
|
1578
|
+
if (!result.success) {
|
|
1579
|
+
throw new ValidationError("Failed to parse connected account retrieve response", {
|
|
1580
|
+
cause: result.error
|
|
1545
1581
|
});
|
|
1546
|
-
this.name = "ComposioNoAPIKeyError";
|
|
1547
1582
|
}
|
|
1548
|
-
|
|
1583
|
+
return result.data;
|
|
1584
|
+
}
|
|
1549
1585
|
|
|
1550
1586
|
// src/models/CustomTools.ts
|
|
1551
1587
|
var CustomTools = class {
|
|
@@ -1709,35 +1745,7 @@ var CustomTools = class {
|
|
|
1709
1745
|
`Connected account not found for toolkit ${toolkitSlug} for user ${userId}`
|
|
1710
1746
|
);
|
|
1711
1747
|
}
|
|
1712
|
-
|
|
1713
|
-
id: connectedAccount.id,
|
|
1714
|
-
authConfig: {
|
|
1715
|
-
id: connectedAccount.auth_config.id,
|
|
1716
|
-
authScheme: connectedAccount.auth_config.auth_scheme,
|
|
1717
|
-
isComposioManaged: connectedAccount.auth_config.is_composio_managed,
|
|
1718
|
-
isDisabled: connectedAccount.auth_config.is_disabled
|
|
1719
|
-
},
|
|
1720
|
-
userId: connectedAccount.user_id,
|
|
1721
|
-
data: connectedAccount.data || {},
|
|
1722
|
-
status: connectedAccount.status,
|
|
1723
|
-
statusReason: connectedAccount.status_reason,
|
|
1724
|
-
toolkit: {
|
|
1725
|
-
slug: connectedAccount.toolkit.slug
|
|
1726
|
-
},
|
|
1727
|
-
testRequestEndpoint: connectedAccount.test_request_endpoint,
|
|
1728
|
-
isDisabled: connectedAccount.is_disabled,
|
|
1729
|
-
createdAt: connectedAccount.created_at,
|
|
1730
|
-
updatedAt: connectedAccount.updated_at
|
|
1731
|
-
});
|
|
1732
|
-
if (!connectedAccountResponse.success) {
|
|
1733
|
-
throw new ValidationError(
|
|
1734
|
-
`Validation error for connected account of ${toolkitSlug} for user ${userId}`,
|
|
1735
|
-
{
|
|
1736
|
-
cause: connectedAccountResponse.error
|
|
1737
|
-
}
|
|
1738
|
-
);
|
|
1739
|
-
}
|
|
1740
|
-
return connectedAccountResponse.data;
|
|
1748
|
+
return transformConnectedAccountResponse(connectedAccount);
|
|
1741
1749
|
}
|
|
1742
1750
|
/**
|
|
1743
1751
|
* Execute a custom tool
|
|
@@ -1756,7 +1764,7 @@ var CustomTools = class {
|
|
|
1756
1764
|
if (!tool) {
|
|
1757
1765
|
throw new ComposioToolNotFoundError(`Tool with slug ${slug} not found`);
|
|
1758
1766
|
}
|
|
1759
|
-
let authCredentials =
|
|
1767
|
+
let authCredentials = null;
|
|
1760
1768
|
const { toolkitSlug, execute, inputParams } = tool.options;
|
|
1761
1769
|
let connectedAccountId = body.connectedAccountId;
|
|
1762
1770
|
if (toolkitSlug && toolkitSlug !== "custom") {
|
|
@@ -1780,7 +1788,7 @@ var CustomTools = class {
|
|
|
1780
1788
|
}
|
|
1781
1789
|
);
|
|
1782
1790
|
}
|
|
1783
|
-
authCredentials = connectedAccount.
|
|
1791
|
+
authCredentials = connectedAccount.state ?? null;
|
|
1784
1792
|
connectedAccountId = connectedAccount.id;
|
|
1785
1793
|
}
|
|
1786
1794
|
if (typeof execute !== "function") {
|
|
@@ -2462,11 +2470,7 @@ var ToolKitItemSchema = z4.object({
|
|
|
2462
2470
|
composioManagedAuthSchemes: z4.array(z4.string()).optional(),
|
|
2463
2471
|
noAuth: z4.boolean().optional()
|
|
2464
2472
|
});
|
|
2465
|
-
var ToolKitListResponseSchema = z4.
|
|
2466
|
-
items: z4.array(ToolKitItemSchema),
|
|
2467
|
-
nextCursor: z4.string().nullable(),
|
|
2468
|
-
totalPages: z4.number()
|
|
2469
|
-
});
|
|
2473
|
+
var ToolKitListResponseSchema = z4.array(ToolKitItemSchema);
|
|
2470
2474
|
var ToolkitAuthFieldSchema = z4.object({
|
|
2471
2475
|
name: z4.string(),
|
|
2472
2476
|
displayName: z4.string(),
|
|
@@ -2925,34 +2929,6 @@ var AuthConfigs = class {
|
|
|
2925
2929
|
|
|
2926
2930
|
// src/models/ConnectionRequest.ts
|
|
2927
2931
|
import ComposioClient from "@composio/client";
|
|
2928
|
-
|
|
2929
|
-
// src/utils/transformers/connectedAccounts.ts
|
|
2930
|
-
function transformConnectedAccountResponse(response) {
|
|
2931
|
-
const result = ConnectedAccountRetrieveResponseSchema.safeParse({
|
|
2932
|
-
...response,
|
|
2933
|
-
authConfig: {
|
|
2934
|
-
...response.auth_config,
|
|
2935
|
-
id: response.auth_config.id,
|
|
2936
|
-
isComposioManaged: response.auth_config.is_composio_managed,
|
|
2937
|
-
isDisabled: response.auth_config.is_disabled
|
|
2938
|
-
},
|
|
2939
|
-
state: response.state,
|
|
2940
|
-
status: response.status,
|
|
2941
|
-
statusReason: response.status_reason,
|
|
2942
|
-
isDisabled: response.is_disabled,
|
|
2943
|
-
createdAt: response.created_at,
|
|
2944
|
-
updatedAt: response.updated_at,
|
|
2945
|
-
testRequestEndpoint: response.test_request_endpoint
|
|
2946
|
-
});
|
|
2947
|
-
if (!result.success) {
|
|
2948
|
-
throw new ValidationError("Failed to parse connected account retrieve response", {
|
|
2949
|
-
cause: result.error
|
|
2950
|
-
});
|
|
2951
|
-
}
|
|
2952
|
-
return result.data;
|
|
2953
|
-
}
|
|
2954
|
-
|
|
2955
|
-
// src/models/ConnectionRequest.ts
|
|
2956
2932
|
var ConnectionRequest = class {
|
|
2957
2933
|
client;
|
|
2958
2934
|
id;
|
|
@@ -3344,22 +3320,34 @@ var Toolkits = class {
|
|
|
3344
3320
|
managed_by: parsedQuery.data.managedBy,
|
|
3345
3321
|
sort_by: parsedQuery.data.sortBy
|
|
3346
3322
|
});
|
|
3347
|
-
const parsedResult = ToolKitListResponseSchema.safeParse(
|
|
3348
|
-
|
|
3349
|
-
const parsedItem = ToolKitItemSchema.
|
|
3323
|
+
const parsedResult = ToolKitListResponseSchema.safeParse(
|
|
3324
|
+
result.items.map((item) => {
|
|
3325
|
+
const parsedItem = ToolKitItemSchema.safeParse({
|
|
3350
3326
|
name: item.name,
|
|
3351
3327
|
slug: item.slug,
|
|
3352
|
-
meta:
|
|
3328
|
+
meta: {
|
|
3329
|
+
...item.meta,
|
|
3330
|
+
createdAt: item.meta.created_at,
|
|
3331
|
+
updatedAt: item.meta.updated_at,
|
|
3332
|
+
toolsCount: item.meta.tools_count,
|
|
3333
|
+
triggersCount: item.meta.triggers_count,
|
|
3334
|
+
categories: item.meta.categories,
|
|
3335
|
+
appUrl: item.meta.app_url,
|
|
3336
|
+
logo: item.meta.logo
|
|
3337
|
+
},
|
|
3353
3338
|
isLocalToolkit: item.is_local_toolkit,
|
|
3354
3339
|
authSchemes: item.auth_schemes,
|
|
3355
3340
|
composioManagedAuthSchemes: item.composio_managed_auth_schemes,
|
|
3356
3341
|
noAuth: item.no_auth
|
|
3357
3342
|
});
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3343
|
+
if (!parsedItem.success) {
|
|
3344
|
+
throw new ValidationError("Failed to parse toolkit response", {
|
|
3345
|
+
cause: parsedItem.error
|
|
3346
|
+
});
|
|
3347
|
+
}
|
|
3348
|
+
return parsedItem.data;
|
|
3349
|
+
})
|
|
3350
|
+
);
|
|
3363
3351
|
if (!parsedResult.success) {
|
|
3364
3352
|
throw new ValidationError("Failed to parse toolkit list response", {
|
|
3365
3353
|
cause: parsedResult.error
|
|
@@ -3465,7 +3453,7 @@ var Toolkits = class {
|
|
|
3465
3453
|
*/
|
|
3466
3454
|
async listCategories() {
|
|
3467
3455
|
const result = await this.client.toolkits.retrieveCategories();
|
|
3468
|
-
const parsedResult = ToolkitRetrieveCategoriesResponseSchema.
|
|
3456
|
+
const parsedResult = ToolkitRetrieveCategoriesResponseSchema.safeParse({
|
|
3469
3457
|
items: result.items.map((item) => {
|
|
3470
3458
|
const parsedItem = ToolkitCategorySchema.parse({
|
|
3471
3459
|
id: item.id,
|
|
@@ -3476,7 +3464,12 @@ var Toolkits = class {
|
|
|
3476
3464
|
nextCursor: result.next_cursor,
|
|
3477
3465
|
totalPages: result.total_pages
|
|
3478
3466
|
});
|
|
3479
|
-
|
|
3467
|
+
if (!parsedResult.success) {
|
|
3468
|
+
throw new ValidationError("Failed to parse toolkit categories response", {
|
|
3469
|
+
cause: parsedResult.error
|
|
3470
|
+
});
|
|
3471
|
+
}
|
|
3472
|
+
return parsedResult.data;
|
|
3480
3473
|
}
|
|
3481
3474
|
/**
|
|
3482
3475
|
* Authorizes a user to use a toolkit.
|
|
@@ -3520,6 +3513,10 @@ var Toolkits = class {
|
|
|
3520
3513
|
|
|
3521
3514
|
// src/types/triggers.types.ts
|
|
3522
3515
|
import { z as z6 } from "zod";
|
|
3516
|
+
var TriggerStatuses = {
|
|
3517
|
+
ENABLE: "enable",
|
|
3518
|
+
DISABLE: "disable"
|
|
3519
|
+
};
|
|
3523
3520
|
var TriggerStatusEnum = z6.enum(["enable", "disable"]);
|
|
3524
3521
|
var TriggerSubscribeParamSchema = z6.object({
|
|
3525
3522
|
toolkits: z6.array(z6.string()).optional(),
|
|
@@ -4693,7 +4690,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
4693
4690
|
};
|
|
4694
4691
|
|
|
4695
4692
|
// package.json
|
|
4696
|
-
var version = "0.1.
|
|
4693
|
+
var version = "0.1.17";
|
|
4697
4694
|
|
|
4698
4695
|
// src/composio.ts
|
|
4699
4696
|
var Composio = class _Composio {
|
|
@@ -4872,12 +4869,22 @@ var ConsoleTelemetryTransport = class {
|
|
|
4872
4869
|
}
|
|
4873
4870
|
};
|
|
4874
4871
|
export {
|
|
4872
|
+
AUTH_MODES_ENUM,
|
|
4875
4873
|
AuthConfigErrorCodes,
|
|
4874
|
+
AuthConfigListParamsSchema,
|
|
4875
|
+
AuthConfigListResponseSchema,
|
|
4876
|
+
AuthConfigRetrieveResponseSchema,
|
|
4876
4877
|
AuthConfigTypes,
|
|
4878
|
+
AuthConfigUpdateParamsSchema,
|
|
4879
|
+
AuthCustomConfigUpdateParamsSchema,
|
|
4880
|
+
AuthDefaultConfigUpdateParamsSchema,
|
|
4881
|
+
AuthSchemeEnum,
|
|
4877
4882
|
AuthSchemeTypes,
|
|
4878
4883
|
BaseAgenticProvider,
|
|
4879
4884
|
BaseNonAgenticProvider,
|
|
4880
4885
|
BaseTelemetryTransport,
|
|
4886
|
+
BasicWithJwtConnectionDataSchema,
|
|
4887
|
+
BillcomAuthConnectionDataSchema,
|
|
4881
4888
|
Composio,
|
|
4882
4889
|
ComposioAuthConfigNotFoundError,
|
|
4883
4890
|
ComposioConnectedAccountNotFoundError,
|
|
@@ -4886,6 +4893,7 @@ export {
|
|
|
4886
4893
|
ComposioGlobalExecuteToolFnNotSetError,
|
|
4887
4894
|
ComposioInvalidExecuteFunctionError,
|
|
4888
4895
|
ComposioInvalidModifierError,
|
|
4896
|
+
ComposioLinkConnectionDataSchema,
|
|
4889
4897
|
ComposioNoAPIKeyError,
|
|
4890
4898
|
ComposioProvider,
|
|
4891
4899
|
ComposioProviderNotDefinedError,
|
|
@@ -4894,16 +4902,68 @@ export {
|
|
|
4894
4902
|
ComposioToolkitFetchError,
|
|
4895
4903
|
ComposioToolkitNotFoundError,
|
|
4896
4904
|
ConnectedAccountErrorCodes,
|
|
4905
|
+
ConnectionDataSchema,
|
|
4897
4906
|
ConnectionRequestErrorCodes,
|
|
4898
4907
|
ConnectionRequestFailedError,
|
|
4899
4908
|
ConnectionRequestTimeoutError,
|
|
4909
|
+
ConnectionStatusEnum,
|
|
4900
4910
|
ConsoleTelemetryTransport,
|
|
4911
|
+
CreateAuthConfigParamsSchema,
|
|
4912
|
+
CreateAuthConfigResponseSchema,
|
|
4913
|
+
CreateComposioManagedAuthConfigParamsSchema,
|
|
4914
|
+
CreateCustomAuthConfigParamsSchema,
|
|
4915
|
+
CustomAuthParamsSchema,
|
|
4916
|
+
IncomingTriggerPayloadSchema,
|
|
4901
4917
|
JsonSchemaToZodError,
|
|
4918
|
+
Oauth1ActiveConnectionDataSchema,
|
|
4919
|
+
Oauth1ConnectionDataSchema,
|
|
4920
|
+
Oauth1ExpiredConnectionDataSchema,
|
|
4921
|
+
Oauth1FailedConnectionDataSchema,
|
|
4922
|
+
Oauth1InitiatedConnectionDataSchema,
|
|
4923
|
+
Oauth1InitiatingConnectionDataSchema,
|
|
4924
|
+
Oauth2ActiveConnectionDataSchema,
|
|
4925
|
+
Oauth2ConnectionDataSchema,
|
|
4926
|
+
Oauth2ExpiredConnectionDataSchema,
|
|
4927
|
+
Oauth2FailedConnectionDataSchema,
|
|
4928
|
+
Oauth2InitiatedConnectionDataSchema,
|
|
4929
|
+
Oauth2InitiatingConnectionDataSchema,
|
|
4902
4930
|
OpenAIProvider,
|
|
4931
|
+
RedirectableAuthSchemeSchema,
|
|
4903
4932
|
SDKErrorCodes,
|
|
4904
4933
|
ToolErrorCodes,
|
|
4934
|
+
ToolExecuteParamsSchema,
|
|
4935
|
+
ToolExecuteResponseSchema,
|
|
4936
|
+
ToolKitItemSchema,
|
|
4937
|
+
ToolKitListResponseSchema,
|
|
4938
|
+
ToolKitMetaSchema,
|
|
4939
|
+
ToolListFilterBySearchSchema,
|
|
4940
|
+
ToolListFilterByToolkitsSchema,
|
|
4941
|
+
ToolListFilterByToolsSchema,
|
|
4905
4942
|
ToolListParamsSchema,
|
|
4943
|
+
ToolListResponseSchema,
|
|
4944
|
+
ToolProxyParamsSchema,
|
|
4945
|
+
ToolSchema,
|
|
4946
|
+
ToolkitAuthConfigDetailsSchema,
|
|
4947
|
+
ToolkitAuthFieldSchema,
|
|
4948
|
+
ToolkitCategorySchema,
|
|
4906
4949
|
ToolkitErrorCodes,
|
|
4950
|
+
ToolkitMangedByEnumSchema,
|
|
4951
|
+
ToolkitRetrieveCategoriesResponseSchema,
|
|
4952
|
+
ToolkitRetrieveResponseSchema,
|
|
4953
|
+
ToolkitSchema,
|
|
4954
|
+
ToolkitSortByEnumSchema,
|
|
4955
|
+
ToolkitsListParamsSchema,
|
|
4956
|
+
TriggerInstanceListActiveParamsSchema,
|
|
4957
|
+
TriggerInstanceListActiveResponseItemSchema,
|
|
4958
|
+
TriggerInstanceListActiveResponseSchema,
|
|
4959
|
+
TriggerInstanceManageDeleteResponseSchema,
|
|
4960
|
+
TriggerInstanceManageUpdateParamsSchema,
|
|
4961
|
+
TriggerInstanceManageUpdateResponseSchema,
|
|
4962
|
+
TriggerInstanceUpsertParamsSchema,
|
|
4963
|
+
TriggerInstanceUpsertResponseSchema,
|
|
4964
|
+
TriggerStatusEnum,
|
|
4965
|
+
TriggerStatuses,
|
|
4966
|
+
TriggerSubscribeParamSchema,
|
|
4907
4967
|
ValidationError,
|
|
4908
4968
|
ValidationErrorCodes,
|
|
4909
4969
|
jsonSchemaToZodSchema,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@composio/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.17",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -27,18 +27,18 @@
|
|
|
27
27
|
"tsx": "^4.19.3",
|
|
28
28
|
"typescript": "^5.8.3",
|
|
29
29
|
"vitest": "^3.1.4",
|
|
30
|
-
"@composio/json-schema-to-zod": "0.1.
|
|
30
|
+
"@composio/json-schema-to-zod": "0.1.5"
|
|
31
31
|
},
|
|
32
32
|
"dependencies": {
|
|
33
|
-
"@composio/client": "0.1.0-alpha.
|
|
34
|
-
"@composio/json-schema-to-zod": "0.1.
|
|
33
|
+
"@composio/client": "0.1.0-alpha.17",
|
|
34
|
+
"@composio/json-schema-to-zod": "0.1.5",
|
|
35
|
+
"zod-to-json-schema": "^3.24.5",
|
|
35
36
|
"chalk": "^5.4.1",
|
|
36
37
|
"openai": "^4.94.0",
|
|
37
38
|
"pusher-js": "^8.4.0",
|
|
38
39
|
"semver": "^7.7.2",
|
|
39
40
|
"uuid": "^11.1.0",
|
|
40
|
-
"zod": "^3.24.2"
|
|
41
|
-
"zod-to-json-schema": "^3.24.5"
|
|
41
|
+
"zod": "^3.24.2"
|
|
42
42
|
},
|
|
43
43
|
"gitHead": "4fae6e54d5c150fba955cc5fa314281da5a1e064",
|
|
44
44
|
"scripts": {
|