@composio/core 0.1.14 → 0.1.16
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 +632 -493
- package/dist/index.d.cts +9923 -148
- package/dist/index.d.ts +9923 -148
- package/dist/index.js +298 -222
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -64,13 +64,19 @@ var ToolListFilterByToolkitsSchema = z.object({
|
|
|
64
64
|
important: z.boolean().optional(),
|
|
65
65
|
cursor: z.string().optional(),
|
|
66
66
|
limit: z.number().optional(),
|
|
67
|
-
search: z.string().optional()
|
|
67
|
+
search: z.string().optional(),
|
|
68
|
+
strict: z.boolean().optional().describe(
|
|
69
|
+
"If true, all the non-required fields will be removed from the input/output params of the tool"
|
|
70
|
+
)
|
|
68
71
|
});
|
|
69
72
|
var ToolListFilterBySearchSchema = z.object({
|
|
70
73
|
search: z.string(),
|
|
71
74
|
toolkits: z.array(z.string()).optional(),
|
|
72
75
|
cursor: z.string().optional(),
|
|
73
|
-
limit: z.number().optional()
|
|
76
|
+
limit: z.number().optional(),
|
|
77
|
+
strict: z.boolean().optional().describe(
|
|
78
|
+
"If true, all the non-required fields will be removed from the input/output params of the tool"
|
|
79
|
+
)
|
|
74
80
|
});
|
|
75
81
|
var ToolListParamsSchema = z.union([
|
|
76
82
|
ToolListFilterByToolsSchema,
|
|
@@ -872,11 +878,171 @@ var TelemetryService = class {
|
|
|
872
878
|
};
|
|
873
879
|
var telemetry = new TelemetryService();
|
|
874
880
|
|
|
881
|
+
// src/errors/AuthConfigErrors.ts
|
|
882
|
+
var AuthConfigErrorCodes = {
|
|
883
|
+
AUTH_CONFIG_NOT_FOUND: "AUTH_CONFIG_NOT_FOUND"
|
|
884
|
+
};
|
|
885
|
+
var ComposioAuthConfigNotFoundError = class extends ComposioError {
|
|
886
|
+
constructor(message = "Auth config not found", options = {}) {
|
|
887
|
+
super(message, {
|
|
888
|
+
...options,
|
|
889
|
+
code: AuthConfigErrorCodes.AUTH_CONFIG_NOT_FOUND,
|
|
890
|
+
possibleFixes: options.possibleFixes || [
|
|
891
|
+
"Check if the auth config exists",
|
|
892
|
+
"Check if the auth config id is correct",
|
|
893
|
+
"Check if the auth config is enabled"
|
|
894
|
+
]
|
|
895
|
+
});
|
|
896
|
+
this.name = "ComposioAuthConfigNotFoundError";
|
|
897
|
+
}
|
|
898
|
+
};
|
|
899
|
+
|
|
900
|
+
// src/errors/ConnectionRequestErrors.ts
|
|
901
|
+
var ConnectionRequestErrorCodes = {
|
|
902
|
+
CONNECTION_REQUEST_TIMEOUT: "CONNECTION_REQUEST_TIMEOUT",
|
|
903
|
+
CONNECTION_REQUEST_FAILED: "CONNECTION_REQUEST_FAILED"
|
|
904
|
+
};
|
|
905
|
+
var ConnectionRequestTimeoutError = class extends ComposioError {
|
|
906
|
+
constructor(message = "Connection request timed out", options = {}) {
|
|
907
|
+
super(message, {
|
|
908
|
+
...options,
|
|
909
|
+
code: ConnectionRequestErrorCodes.CONNECTION_REQUEST_TIMEOUT
|
|
910
|
+
});
|
|
911
|
+
this.name = "ConnectionRequestTimeoutError";
|
|
912
|
+
}
|
|
913
|
+
};
|
|
914
|
+
var ConnectionRequestFailedError = class extends ComposioError {
|
|
915
|
+
constructor(message = "Connection request failed", options = {}) {
|
|
916
|
+
super(message, {
|
|
917
|
+
...options,
|
|
918
|
+
code: ConnectionRequestErrorCodes.CONNECTION_REQUEST_FAILED
|
|
919
|
+
});
|
|
920
|
+
this.name = "ConnectionRequestFailedError";
|
|
921
|
+
}
|
|
922
|
+
};
|
|
923
|
+
|
|
924
|
+
// src/errors/ToolkitErrors.ts
|
|
925
|
+
var ToolkitErrorCodes = {
|
|
926
|
+
TOOLKIT_NOT_FOUND: "TOOLKIT_NOT_FOUND"
|
|
927
|
+
};
|
|
928
|
+
var ComposioToolkitNotFoundError = class extends ComposioError {
|
|
929
|
+
constructor(message = "Toolkit not found", options = {}) {
|
|
930
|
+
super(message, {
|
|
931
|
+
...options,
|
|
932
|
+
code: "TOOLKIT_NOT_FOUND",
|
|
933
|
+
possibleFixes: options.possibleFixes || [
|
|
934
|
+
"Ensure the toolkit is correctly configured and the slug is valid"
|
|
935
|
+
]
|
|
936
|
+
});
|
|
937
|
+
this.name = "ComposioToolkitNotFoundError";
|
|
938
|
+
}
|
|
939
|
+
};
|
|
940
|
+
var ComposioToolkitFetchError = class extends ComposioError {
|
|
941
|
+
constructor(message = "Failed to fetch toolkit", options = {}) {
|
|
942
|
+
super(message, {
|
|
943
|
+
...options,
|
|
944
|
+
code: "TOOLKIT_FETCH_ERROR",
|
|
945
|
+
possibleFixes: options.possibleFixes || [
|
|
946
|
+
"Ensure the toolkit slug is valid",
|
|
947
|
+
"Ensure you are using the correct API key",
|
|
948
|
+
"Ensure you are using the correct API endpoint / Base URL and it is working"
|
|
949
|
+
]
|
|
950
|
+
});
|
|
951
|
+
this.name = "ComposioToolkitFetchError";
|
|
952
|
+
}
|
|
953
|
+
};
|
|
954
|
+
|
|
955
|
+
// src/errors/ValidationErrors.ts
|
|
956
|
+
import { ZodError as ZodError2 } from "zod";
|
|
957
|
+
var ValidationErrorCodes = {
|
|
958
|
+
VALIDATION_ERROR: "VALIDATION_ERROR",
|
|
959
|
+
JSON_SCHEMA_TO_ZOD_ERROR: "JSON_SCHEMA_TO_ZOD_ERROR"
|
|
960
|
+
};
|
|
961
|
+
var ValidationError = class extends ComposioError {
|
|
962
|
+
constructor(message = "Input validation failed", options = {}) {
|
|
963
|
+
const { cause: providedZodError, ...restOptions } = options;
|
|
964
|
+
let zodErrorInstance;
|
|
965
|
+
if (providedZodError instanceof ZodError2) {
|
|
966
|
+
zodErrorInstance = providedZodError;
|
|
967
|
+
} else {
|
|
968
|
+
zodErrorInstance = new ZodError2([
|
|
969
|
+
{
|
|
970
|
+
path: [],
|
|
971
|
+
message: "Invalid input",
|
|
972
|
+
code: "custom"
|
|
973
|
+
}
|
|
974
|
+
]);
|
|
975
|
+
}
|
|
976
|
+
const issues = zodErrorInstance.issues.map(
|
|
977
|
+
(issue) => `[${issue.code}] ${issue.path.join(".")} - ${issue.message}`
|
|
978
|
+
);
|
|
979
|
+
super(message, {
|
|
980
|
+
...restOptions,
|
|
981
|
+
code: options.code || ValidationErrorCodes.VALIDATION_ERROR,
|
|
982
|
+
possibleFixes: issues,
|
|
983
|
+
cause: zodErrorInstance
|
|
984
|
+
});
|
|
985
|
+
this.name = "ValidationError";
|
|
986
|
+
const userFriendlyMessage = this.generateUserFriendlyMessage();
|
|
987
|
+
this.message = `${message}: ${userFriendlyMessage}`;
|
|
988
|
+
}
|
|
989
|
+
generateUserFriendlyMessage() {
|
|
990
|
+
if (this.cause instanceof ZodError2 && this.cause.issues.length > 0) {
|
|
991
|
+
const issue = this.cause.issues[0];
|
|
992
|
+
const path = issue.path.join(".");
|
|
993
|
+
const param = path || "parameter";
|
|
994
|
+
if (issue.code === "invalid_type") {
|
|
995
|
+
return `The ${param} should be a ${issue.expected}, but you provided a ${issue.received}`;
|
|
996
|
+
}
|
|
997
|
+
return issue.message;
|
|
998
|
+
}
|
|
999
|
+
return "Please check your input parameters";
|
|
1000
|
+
}
|
|
1001
|
+
};
|
|
1002
|
+
var JsonSchemaToZodError = class extends ComposioError {
|
|
1003
|
+
constructor(message = "Failed to convert JSON schema to Zod schema", options = {}) {
|
|
1004
|
+
super(message, {
|
|
1005
|
+
...options,
|
|
1006
|
+
code: options.code || ValidationErrorCodes.JSON_SCHEMA_TO_ZOD_ERROR
|
|
1007
|
+
});
|
|
1008
|
+
}
|
|
1009
|
+
};
|
|
1010
|
+
|
|
1011
|
+
// src/errors/SDKErrors.ts
|
|
1012
|
+
var SDKErrorCodes = {
|
|
1013
|
+
NO_API_KEY_PROVIDED: "NO_API_KEY_PROVIDED"
|
|
1014
|
+
};
|
|
1015
|
+
var ComposioNoAPIKeyError = class extends ComposioError {
|
|
1016
|
+
constructor(message = "No Composio API key provided", options = {}) {
|
|
1017
|
+
const defaultCause = "Couldn't find an API key in the params, environment variables or in the user config file";
|
|
1018
|
+
super(message, {
|
|
1019
|
+
...options,
|
|
1020
|
+
code: "NO_API_KEY",
|
|
1021
|
+
cause: options.cause || defaultCause,
|
|
1022
|
+
possibleFixes: options.possibleFixes || [
|
|
1023
|
+
"Ensure you have an API key passed in the params, or in environment variable (COMPOSIO_API_KEY) or in the user config file",
|
|
1024
|
+
"To get an API key, please sign up at https://composio.dev/signup",
|
|
1025
|
+
"You can also use the Composio CLI to create a project and get an API key"
|
|
1026
|
+
],
|
|
1027
|
+
statusCode: 401
|
|
1028
|
+
});
|
|
1029
|
+
this.name = "ComposioNoAPIKeyError";
|
|
1030
|
+
}
|
|
1031
|
+
};
|
|
1032
|
+
|
|
875
1033
|
// src/types/connectedAccounts.types.ts
|
|
876
1034
|
import { z as z3 } from "zod";
|
|
877
1035
|
|
|
878
1036
|
// src/types/connectedAccountAuthStates.types.ts
|
|
879
1037
|
import { z as z2 } from "zod";
|
|
1038
|
+
var ConnectionStatusEnum = /* @__PURE__ */ ((ConnectionStatusEnum2) => {
|
|
1039
|
+
ConnectionStatusEnum2["INITIALIZING"] = "INITIALIZING";
|
|
1040
|
+
ConnectionStatusEnum2["INITIATED"] = "INITIATED";
|
|
1041
|
+
ConnectionStatusEnum2["ACTIVE"] = "ACTIVE";
|
|
1042
|
+
ConnectionStatusEnum2["FAILED"] = "FAILED";
|
|
1043
|
+
ConnectionStatusEnum2["EXPIRED"] = "EXPIRED";
|
|
1044
|
+
return ConnectionStatusEnum2;
|
|
1045
|
+
})(ConnectionStatusEnum || {});
|
|
880
1046
|
var AUTH_MODES_ENUM = {
|
|
881
1047
|
OAUTH2: "OAUTH2",
|
|
882
1048
|
OAUTH1: "OAUTH1",
|
|
@@ -1389,157 +1555,31 @@ var ConnectedAccountListResponseSchema = z3.object({
|
|
|
1389
1555
|
totalPages: z3.number().describe("The total number of pages of connected accounts")
|
|
1390
1556
|
});
|
|
1391
1557
|
|
|
1392
|
-
// src/
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
};
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
CONNECTION_REQUEST_TIMEOUT: "CONNECTION_REQUEST_TIMEOUT",
|
|
1414
|
-
CONNECTION_REQUEST_FAILED: "CONNECTION_REQUEST_FAILED"
|
|
1415
|
-
};
|
|
1416
|
-
var ConnectionRequestTimeoutError = class extends ComposioError {
|
|
1417
|
-
constructor(message = "Connection request timed out", options = {}) {
|
|
1418
|
-
super(message, {
|
|
1419
|
-
...options,
|
|
1420
|
-
code: ConnectionRequestErrorCodes.CONNECTION_REQUEST_TIMEOUT
|
|
1421
|
-
});
|
|
1422
|
-
this.name = "ConnectionRequestTimeoutError";
|
|
1423
|
-
}
|
|
1424
|
-
};
|
|
1425
|
-
var ConnectionRequestFailedError = class extends ComposioError {
|
|
1426
|
-
constructor(message = "Connection request failed", options = {}) {
|
|
1427
|
-
super(message, {
|
|
1428
|
-
...options,
|
|
1429
|
-
code: ConnectionRequestErrorCodes.CONNECTION_REQUEST_FAILED
|
|
1430
|
-
});
|
|
1431
|
-
this.name = "ConnectionRequestFailedError";
|
|
1432
|
-
}
|
|
1433
|
-
};
|
|
1434
|
-
|
|
1435
|
-
// src/errors/ToolkitErrors.ts
|
|
1436
|
-
var ToolkitErrorCodes = {
|
|
1437
|
-
TOOLKIT_NOT_FOUND: "TOOLKIT_NOT_FOUND"
|
|
1438
|
-
};
|
|
1439
|
-
var ComposioToolkitNotFoundError = class extends ComposioError {
|
|
1440
|
-
constructor(message = "Toolkit not found", options = {}) {
|
|
1441
|
-
super(message, {
|
|
1442
|
-
...options,
|
|
1443
|
-
code: "TOOLKIT_NOT_FOUND",
|
|
1444
|
-
possibleFixes: options.possibleFixes || [
|
|
1445
|
-
"Ensure the toolkit is correctly configured and the slug is valid"
|
|
1446
|
-
]
|
|
1447
|
-
});
|
|
1448
|
-
this.name = "ComposioToolkitNotFoundError";
|
|
1449
|
-
}
|
|
1450
|
-
};
|
|
1451
|
-
var ComposioToolkitFetchError = class extends ComposioError {
|
|
1452
|
-
constructor(message = "Failed to fetch toolkit", options = {}) {
|
|
1453
|
-
super(message, {
|
|
1454
|
-
...options,
|
|
1455
|
-
code: "TOOLKIT_FETCH_ERROR",
|
|
1456
|
-
possibleFixes: options.possibleFixes || [
|
|
1457
|
-
"Ensure the toolkit slug is valid",
|
|
1458
|
-
"Ensure you are using the correct API key",
|
|
1459
|
-
"Ensure you are using the correct API endpoint / Base URL and it is working"
|
|
1460
|
-
]
|
|
1461
|
-
});
|
|
1462
|
-
this.name = "ComposioToolkitFetchError";
|
|
1463
|
-
}
|
|
1464
|
-
};
|
|
1465
|
-
|
|
1466
|
-
// src/errors/ValidationErrors.ts
|
|
1467
|
-
import { ZodError as ZodError2 } from "zod";
|
|
1468
|
-
var ValidationErrorCodes = {
|
|
1469
|
-
VALIDATION_ERROR: "VALIDATION_ERROR",
|
|
1470
|
-
JSON_SCHEMA_TO_ZOD_ERROR: "JSON_SCHEMA_TO_ZOD_ERROR"
|
|
1471
|
-
};
|
|
1472
|
-
var ValidationError = class extends ComposioError {
|
|
1473
|
-
constructor(message = "Input validation failed", options = {}) {
|
|
1474
|
-
const { cause: providedZodError, ...restOptions } = options;
|
|
1475
|
-
let zodErrorInstance;
|
|
1476
|
-
if (providedZodError instanceof ZodError2) {
|
|
1477
|
-
zodErrorInstance = providedZodError;
|
|
1478
|
-
} else {
|
|
1479
|
-
zodErrorInstance = new ZodError2([
|
|
1480
|
-
{
|
|
1481
|
-
path: [],
|
|
1482
|
-
message: "Invalid input",
|
|
1483
|
-
code: "custom"
|
|
1484
|
-
}
|
|
1485
|
-
]);
|
|
1486
|
-
}
|
|
1487
|
-
const issues = zodErrorInstance.issues.map(
|
|
1488
|
-
(issue) => `[${issue.code}] ${issue.path.join(".")} - ${issue.message}`
|
|
1489
|
-
);
|
|
1490
|
-
super(message, {
|
|
1491
|
-
...restOptions,
|
|
1492
|
-
code: options.code || ValidationErrorCodes.VALIDATION_ERROR,
|
|
1493
|
-
possibleFixes: issues,
|
|
1494
|
-
cause: zodErrorInstance
|
|
1495
|
-
});
|
|
1496
|
-
this.name = "ValidationError";
|
|
1497
|
-
const userFriendlyMessage = this.generateUserFriendlyMessage();
|
|
1498
|
-
this.message = `${message}: ${userFriendlyMessage}`;
|
|
1499
|
-
}
|
|
1500
|
-
generateUserFriendlyMessage() {
|
|
1501
|
-
if (this.cause instanceof ZodError2 && this.cause.issues.length > 0) {
|
|
1502
|
-
const issue = this.cause.issues[0];
|
|
1503
|
-
const path = issue.path.join(".");
|
|
1504
|
-
const param = path || "parameter";
|
|
1505
|
-
if (issue.code === "invalid_type") {
|
|
1506
|
-
return `The ${param} should be a ${issue.expected}, but you provided a ${issue.received}`;
|
|
1507
|
-
}
|
|
1508
|
-
return issue.message;
|
|
1509
|
-
}
|
|
1510
|
-
return "Please check your input parameters";
|
|
1511
|
-
}
|
|
1512
|
-
};
|
|
1513
|
-
var JsonSchemaToZodError = class extends ComposioError {
|
|
1514
|
-
constructor(message = "Failed to convert JSON schema to Zod schema", options = {}) {
|
|
1515
|
-
super(message, {
|
|
1516
|
-
...options,
|
|
1517
|
-
code: options.code || ValidationErrorCodes.JSON_SCHEMA_TO_ZOD_ERROR
|
|
1518
|
-
});
|
|
1519
|
-
}
|
|
1520
|
-
};
|
|
1521
|
-
|
|
1522
|
-
// src/errors/SDKErrors.ts
|
|
1523
|
-
var SDKErrorCodes = {
|
|
1524
|
-
NO_API_KEY_PROVIDED: "NO_API_KEY_PROVIDED"
|
|
1525
|
-
};
|
|
1526
|
-
var ComposioNoAPIKeyError = class extends ComposioError {
|
|
1527
|
-
constructor(message = "No Composio API key provided", options = {}) {
|
|
1528
|
-
const defaultCause = "Couldn't find an API key in the params, environment variables or in the user config file";
|
|
1529
|
-
super(message, {
|
|
1530
|
-
...options,
|
|
1531
|
-
code: "NO_API_KEY",
|
|
1532
|
-
cause: options.cause || defaultCause,
|
|
1533
|
-
possibleFixes: options.possibleFixes || [
|
|
1534
|
-
"Ensure you have an API key passed in the params, or in environment variable (COMPOSIO_API_KEY) or in the user config file",
|
|
1535
|
-
"To get an API key, please sign up at https://composio.dev/signup",
|
|
1536
|
-
"You can also use the Composio CLI to create a project and get an API key"
|
|
1537
|
-
],
|
|
1538
|
-
statusCode: 401
|
|
1558
|
+
// src/utils/transformers/connectedAccounts.ts
|
|
1559
|
+
function transformConnectedAccountResponse(response) {
|
|
1560
|
+
const result = ConnectedAccountRetrieveResponseSchema.safeParse({
|
|
1561
|
+
...response,
|
|
1562
|
+
authConfig: {
|
|
1563
|
+
...response.auth_config,
|
|
1564
|
+
id: response.auth_config.id,
|
|
1565
|
+
isComposioManaged: response.auth_config.is_composio_managed,
|
|
1566
|
+
isDisabled: response.auth_config.is_disabled
|
|
1567
|
+
},
|
|
1568
|
+
state: response.state,
|
|
1569
|
+
status: response.status,
|
|
1570
|
+
statusReason: response.status_reason,
|
|
1571
|
+
isDisabled: response.is_disabled,
|
|
1572
|
+
createdAt: response.created_at,
|
|
1573
|
+
updatedAt: response.updated_at,
|
|
1574
|
+
testRequestEndpoint: response.test_request_endpoint
|
|
1575
|
+
});
|
|
1576
|
+
if (!result.success) {
|
|
1577
|
+
throw new ValidationError("Failed to parse connected account retrieve response", {
|
|
1578
|
+
cause: result.error
|
|
1539
1579
|
});
|
|
1540
|
-
this.name = "ComposioNoAPIKeyError";
|
|
1541
1580
|
}
|
|
1542
|
-
|
|
1581
|
+
return result.data;
|
|
1582
|
+
}
|
|
1543
1583
|
|
|
1544
1584
|
// src/models/CustomTools.ts
|
|
1545
1585
|
var CustomTools = class {
|
|
@@ -1703,35 +1743,7 @@ var CustomTools = class {
|
|
|
1703
1743
|
`Connected account not found for toolkit ${toolkitSlug} for user ${userId}`
|
|
1704
1744
|
);
|
|
1705
1745
|
}
|
|
1706
|
-
|
|
1707
|
-
id: connectedAccount.id,
|
|
1708
|
-
authConfig: {
|
|
1709
|
-
id: connectedAccount.auth_config.id,
|
|
1710
|
-
authScheme: connectedAccount.auth_config.auth_scheme,
|
|
1711
|
-
isComposioManaged: connectedAccount.auth_config.is_composio_managed,
|
|
1712
|
-
isDisabled: connectedAccount.auth_config.is_disabled
|
|
1713
|
-
},
|
|
1714
|
-
userId: connectedAccount.user_id,
|
|
1715
|
-
data: connectedAccount.data || {},
|
|
1716
|
-
status: connectedAccount.status,
|
|
1717
|
-
statusReason: connectedAccount.status_reason,
|
|
1718
|
-
toolkit: {
|
|
1719
|
-
slug: connectedAccount.toolkit.slug
|
|
1720
|
-
},
|
|
1721
|
-
testRequestEndpoint: connectedAccount.test_request_endpoint,
|
|
1722
|
-
isDisabled: connectedAccount.is_disabled,
|
|
1723
|
-
createdAt: connectedAccount.created_at,
|
|
1724
|
-
updatedAt: connectedAccount.updated_at
|
|
1725
|
-
});
|
|
1726
|
-
if (!connectedAccountResponse.success) {
|
|
1727
|
-
throw new ValidationError(
|
|
1728
|
-
`Validation error for connected account of ${toolkitSlug} for user ${userId}`,
|
|
1729
|
-
{
|
|
1730
|
-
cause: connectedAccountResponse.error
|
|
1731
|
-
}
|
|
1732
|
-
);
|
|
1733
|
-
}
|
|
1734
|
-
return connectedAccountResponse.data;
|
|
1746
|
+
return transformConnectedAccountResponse(connectedAccount);
|
|
1735
1747
|
}
|
|
1736
1748
|
/**
|
|
1737
1749
|
* Execute a custom tool
|
|
@@ -1826,6 +1838,36 @@ var CustomTools = class {
|
|
|
1826
1838
|
}
|
|
1827
1839
|
};
|
|
1828
1840
|
|
|
1841
|
+
// src/utils/jsonSchema.ts
|
|
1842
|
+
import { jsonSchemaToZod } from "@composio/json-schema-to-zod";
|
|
1843
|
+
var removeNonRequiredProperties = (schema) => {
|
|
1844
|
+
if (schema && schema.type === "object" && schema.required?.length) {
|
|
1845
|
+
schema.properties = Object.fromEntries(
|
|
1846
|
+
Object.entries(schema.properties || {}).filter(
|
|
1847
|
+
([key]) => schema.required.includes(key)
|
|
1848
|
+
)
|
|
1849
|
+
);
|
|
1850
|
+
}
|
|
1851
|
+
return schema;
|
|
1852
|
+
};
|
|
1853
|
+
function jsonSchemaToZodSchema(jsonSchema, { strict } = {
|
|
1854
|
+
strict: false
|
|
1855
|
+
}) {
|
|
1856
|
+
try {
|
|
1857
|
+
let schema = jsonSchema;
|
|
1858
|
+
if (strict && schema) {
|
|
1859
|
+
schema = removeNonRequiredProperties(
|
|
1860
|
+
schema
|
|
1861
|
+
);
|
|
1862
|
+
}
|
|
1863
|
+
return jsonSchemaToZod(schema);
|
|
1864
|
+
} catch (error) {
|
|
1865
|
+
throw new JsonSchemaToZodError("Failed to convert JSON Schema to Zod Schema", {
|
|
1866
|
+
cause: error
|
|
1867
|
+
});
|
|
1868
|
+
}
|
|
1869
|
+
}
|
|
1870
|
+
|
|
1829
1871
|
// src/models/Tools.ts
|
|
1830
1872
|
var Tools = class {
|
|
1831
1873
|
client;
|
|
@@ -2086,7 +2128,14 @@ var Tools = class {
|
|
|
2086
2128
|
const tool = await this.getRawComposioToolBySlug(userId, arg2, options?.modifySchema);
|
|
2087
2129
|
return this.provider.wrapTools([tool], executeToolFn);
|
|
2088
2130
|
} else {
|
|
2089
|
-
|
|
2131
|
+
let tools = await this.getRawComposioTools(userId, arg2, options?.modifySchema);
|
|
2132
|
+
if (arg2?.strict) {
|
|
2133
|
+
tools = tools.map((tool) => ({
|
|
2134
|
+
...tool,
|
|
2135
|
+
inputParameters: tool.inputParameters ? removeNonRequiredProperties(tool.inputParameters) : void 0,
|
|
2136
|
+
outputParameters: tool.outputParameters ? removeNonRequiredProperties(tool.outputParameters) : void 0
|
|
2137
|
+
}));
|
|
2138
|
+
}
|
|
2090
2139
|
return this.provider.wrapTools(tools, executeToolFn);
|
|
2091
2140
|
}
|
|
2092
2141
|
}
|
|
@@ -2882,34 +2931,6 @@ var AuthConfigs = class {
|
|
|
2882
2931
|
|
|
2883
2932
|
// src/models/ConnectionRequest.ts
|
|
2884
2933
|
import ComposioClient from "@composio/client";
|
|
2885
|
-
|
|
2886
|
-
// src/utils/transformers/connectedAccounts.ts
|
|
2887
|
-
function transformConnectedAccountResponse(response) {
|
|
2888
|
-
const result = ConnectedAccountRetrieveResponseSchema.safeParse({
|
|
2889
|
-
...response,
|
|
2890
|
-
authConfig: {
|
|
2891
|
-
...response.auth_config,
|
|
2892
|
-
id: response.auth_config.id,
|
|
2893
|
-
isComposioManaged: response.auth_config.is_composio_managed,
|
|
2894
|
-
isDisabled: response.auth_config.is_disabled
|
|
2895
|
-
},
|
|
2896
|
-
state: response.state,
|
|
2897
|
-
status: response.status,
|
|
2898
|
-
statusReason: response.status_reason,
|
|
2899
|
-
isDisabled: response.is_disabled,
|
|
2900
|
-
createdAt: response.created_at,
|
|
2901
|
-
updatedAt: response.updated_at,
|
|
2902
|
-
testRequestEndpoint: response.test_request_endpoint
|
|
2903
|
-
});
|
|
2904
|
-
if (!result.success) {
|
|
2905
|
-
throw new ValidationError("Failed to parse connected account retrieve response", {
|
|
2906
|
-
cause: result.error
|
|
2907
|
-
});
|
|
2908
|
-
}
|
|
2909
|
-
return result.data;
|
|
2910
|
-
}
|
|
2911
|
-
|
|
2912
|
-
// src/models/ConnectionRequest.ts
|
|
2913
2934
|
var ConnectionRequest = class {
|
|
2914
2935
|
client;
|
|
2915
2936
|
id;
|
|
@@ -3477,6 +3498,10 @@ var Toolkits = class {
|
|
|
3477
3498
|
|
|
3478
3499
|
// src/types/triggers.types.ts
|
|
3479
3500
|
import { z as z6 } from "zod";
|
|
3501
|
+
var TriggerStatuses = {
|
|
3502
|
+
ENABLE: "enable",
|
|
3503
|
+
DISABLE: "disable"
|
|
3504
|
+
};
|
|
3480
3505
|
var TriggerStatusEnum = z6.enum(["enable", "disable"]);
|
|
3481
3506
|
var TriggerSubscribeParamSchema = z6.object({
|
|
3482
3507
|
toolkits: z6.array(z6.string()).optional(),
|
|
@@ -4650,7 +4675,7 @@ var OpenAIProvider = class extends BaseNonAgenticProvider {
|
|
|
4650
4675
|
};
|
|
4651
4676
|
|
|
4652
4677
|
// package.json
|
|
4653
|
-
var version = "0.1.
|
|
4678
|
+
var version = "0.1.16";
|
|
4654
4679
|
|
|
4655
4680
|
// src/composio.ts
|
|
4656
4681
|
var Composio = class _Composio {
|
|
@@ -4828,25 +4853,23 @@ var ConsoleTelemetryTransport = class {
|
|
|
4828
4853
|
return Promise.resolve();
|
|
4829
4854
|
}
|
|
4830
4855
|
};
|
|
4831
|
-
|
|
4832
|
-
// src/utils/jsonSchema.ts
|
|
4833
|
-
import { jsonSchemaToZod } from "@composio/json-schema-to-zod";
|
|
4834
|
-
function jsonSchemaToZodSchema(jsonSchema) {
|
|
4835
|
-
try {
|
|
4836
|
-
return jsonSchemaToZod(jsonSchema);
|
|
4837
|
-
} catch (error) {
|
|
4838
|
-
throw new JsonSchemaToZodError("Failed to convert JSON Schema to Zod Schema", {
|
|
4839
|
-
cause: error
|
|
4840
|
-
});
|
|
4841
|
-
}
|
|
4842
|
-
}
|
|
4843
4856
|
export {
|
|
4857
|
+
AUTH_MODES_ENUM,
|
|
4844
4858
|
AuthConfigErrorCodes,
|
|
4859
|
+
AuthConfigListParamsSchema,
|
|
4860
|
+
AuthConfigListResponseSchema,
|
|
4861
|
+
AuthConfigRetrieveResponseSchema,
|
|
4845
4862
|
AuthConfigTypes,
|
|
4863
|
+
AuthConfigUpdateParamsSchema,
|
|
4864
|
+
AuthCustomConfigUpdateParamsSchema,
|
|
4865
|
+
AuthDefaultConfigUpdateParamsSchema,
|
|
4866
|
+
AuthSchemeEnum,
|
|
4846
4867
|
AuthSchemeTypes,
|
|
4847
4868
|
BaseAgenticProvider,
|
|
4848
4869
|
BaseNonAgenticProvider,
|
|
4849
4870
|
BaseTelemetryTransport,
|
|
4871
|
+
BasicWithJwtConnectionDataSchema,
|
|
4872
|
+
BillcomAuthConnectionDataSchema,
|
|
4850
4873
|
Composio,
|
|
4851
4874
|
ComposioAuthConfigNotFoundError,
|
|
4852
4875
|
ComposioConnectedAccountNotFoundError,
|
|
@@ -4855,6 +4878,7 @@ export {
|
|
|
4855
4878
|
ComposioGlobalExecuteToolFnNotSetError,
|
|
4856
4879
|
ComposioInvalidExecuteFunctionError,
|
|
4857
4880
|
ComposioInvalidModifierError,
|
|
4881
|
+
ComposioLinkConnectionDataSchema,
|
|
4858
4882
|
ComposioNoAPIKeyError,
|
|
4859
4883
|
ComposioProvider,
|
|
4860
4884
|
ComposioProviderNotDefinedError,
|
|
@@ -4863,16 +4887,68 @@ export {
|
|
|
4863
4887
|
ComposioToolkitFetchError,
|
|
4864
4888
|
ComposioToolkitNotFoundError,
|
|
4865
4889
|
ConnectedAccountErrorCodes,
|
|
4890
|
+
ConnectionDataSchema,
|
|
4866
4891
|
ConnectionRequestErrorCodes,
|
|
4867
4892
|
ConnectionRequestFailedError,
|
|
4868
4893
|
ConnectionRequestTimeoutError,
|
|
4894
|
+
ConnectionStatusEnum,
|
|
4869
4895
|
ConsoleTelemetryTransport,
|
|
4896
|
+
CreateAuthConfigParamsSchema,
|
|
4897
|
+
CreateAuthConfigResponseSchema,
|
|
4898
|
+
CreateComposioManagedAuthConfigParamsSchema,
|
|
4899
|
+
CreateCustomAuthConfigParamsSchema,
|
|
4900
|
+
CustomAuthParamsSchema,
|
|
4901
|
+
IncomingTriggerPayloadSchema,
|
|
4870
4902
|
JsonSchemaToZodError,
|
|
4903
|
+
Oauth1ActiveConnectionDataSchema,
|
|
4904
|
+
Oauth1ConnectionDataSchema,
|
|
4905
|
+
Oauth1ExpiredConnectionDataSchema,
|
|
4906
|
+
Oauth1FailedConnectionDataSchema,
|
|
4907
|
+
Oauth1InitiatedConnectionDataSchema,
|
|
4908
|
+
Oauth1InitiatingConnectionDataSchema,
|
|
4909
|
+
Oauth2ActiveConnectionDataSchema,
|
|
4910
|
+
Oauth2ConnectionDataSchema,
|
|
4911
|
+
Oauth2ExpiredConnectionDataSchema,
|
|
4912
|
+
Oauth2FailedConnectionDataSchema,
|
|
4913
|
+
Oauth2InitiatedConnectionDataSchema,
|
|
4914
|
+
Oauth2InitiatingConnectionDataSchema,
|
|
4871
4915
|
OpenAIProvider,
|
|
4916
|
+
RedirectableAuthSchemeSchema,
|
|
4872
4917
|
SDKErrorCodes,
|
|
4873
4918
|
ToolErrorCodes,
|
|
4919
|
+
ToolExecuteParamsSchema,
|
|
4920
|
+
ToolExecuteResponseSchema,
|
|
4921
|
+
ToolKitItemSchema,
|
|
4922
|
+
ToolKitListResponseSchema,
|
|
4923
|
+
ToolKitMetaSchema,
|
|
4924
|
+
ToolListFilterBySearchSchema,
|
|
4925
|
+
ToolListFilterByToolkitsSchema,
|
|
4926
|
+
ToolListFilterByToolsSchema,
|
|
4874
4927
|
ToolListParamsSchema,
|
|
4928
|
+
ToolListResponseSchema,
|
|
4929
|
+
ToolProxyParamsSchema,
|
|
4930
|
+
ToolSchema,
|
|
4931
|
+
ToolkitAuthConfigDetailsSchema,
|
|
4932
|
+
ToolkitAuthFieldSchema,
|
|
4933
|
+
ToolkitCategorySchema,
|
|
4875
4934
|
ToolkitErrorCodes,
|
|
4935
|
+
ToolkitMangedByEnumSchema,
|
|
4936
|
+
ToolkitRetrieveCategoriesResponseSchema,
|
|
4937
|
+
ToolkitRetrieveResponseSchema,
|
|
4938
|
+
ToolkitSchema,
|
|
4939
|
+
ToolkitSortByEnumSchema,
|
|
4940
|
+
ToolkitsListParamsSchema,
|
|
4941
|
+
TriggerInstanceListActiveParamsSchema,
|
|
4942
|
+
TriggerInstanceListActiveResponseItemSchema,
|
|
4943
|
+
TriggerInstanceListActiveResponseSchema,
|
|
4944
|
+
TriggerInstanceManageDeleteResponseSchema,
|
|
4945
|
+
TriggerInstanceManageUpdateParamsSchema,
|
|
4946
|
+
TriggerInstanceManageUpdateResponseSchema,
|
|
4947
|
+
TriggerInstanceUpsertParamsSchema,
|
|
4948
|
+
TriggerInstanceUpsertResponseSchema,
|
|
4949
|
+
TriggerStatusEnum,
|
|
4950
|
+
TriggerStatuses,
|
|
4951
|
+
TriggerSubscribeParamSchema,
|
|
4876
4952
|
ValidationError,
|
|
4877
4953
|
ValidationErrorCodes,
|
|
4878
4954
|
jsonSchemaToZodSchema,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@composio/core",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.16",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -30,8 +30,8 @@
|
|
|
30
30
|
"@composio/json-schema-to-zod": "0.1.1"
|
|
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.2",
|
|
35
35
|
"chalk": "^5.4.1",
|
|
36
36
|
"openai": "^4.94.0",
|
|
37
37
|
"pusher-js": "^8.4.0",
|