@composio/core 0.1.0-rc.7 → 0.1.3-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +319 -173
- package/dist/index.d.cts +810 -109
- package/dist/index.d.ts +810 -109
- package/dist/index.js +319 -173
- package/package.json +6 -3
package/dist/index.cjs
CHANGED
|
@@ -71,8 +71,8 @@ var ToolListParamsSchema = import_zod.z.object({
|
|
|
71
71
|
important: import_zod.z.string().optional(),
|
|
72
72
|
limit: import_zod.z.string().optional(),
|
|
73
73
|
search: import_zod.z.string().optional(),
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
toolkits: import_zod.z.string().optional(),
|
|
75
|
+
tools: import_zod.z.array(import_zod.z.string()).optional()
|
|
76
76
|
});
|
|
77
77
|
var CustomAuthParamsSchema = import_zod.z.object({
|
|
78
78
|
baseURL: import_zod.z.string().optional(),
|
|
@@ -436,15 +436,15 @@ var Tools = class {
|
|
|
436
436
|
important: queryParams.data.important,
|
|
437
437
|
limit: queryParams.data.limit,
|
|
438
438
|
search: queryParams.data.search,
|
|
439
|
-
toolkit_slug: queryParams.data.
|
|
440
|
-
tool_slugs: queryParams.data.
|
|
439
|
+
toolkit_slug: queryParams.data.toolkits,
|
|
440
|
+
tool_slugs: queryParams.data.tools?.join(",")
|
|
441
441
|
});
|
|
442
442
|
if (!tools) {
|
|
443
443
|
return [];
|
|
444
444
|
}
|
|
445
445
|
const caseTransformedTools = tools.items.map((tool) => this.transformToolCases(tool));
|
|
446
446
|
const customTools = await this.customTools.getCustomTools({
|
|
447
|
-
toolSlugs: queryParams.data.
|
|
447
|
+
toolSlugs: queryParams.data.tools
|
|
448
448
|
});
|
|
449
449
|
let modifiedTools = [...caseTransformedTools, ...customTools];
|
|
450
450
|
if (modifier) {
|
|
@@ -482,13 +482,36 @@ var Tools = class {
|
|
|
482
482
|
}
|
|
483
483
|
return modifiedToool;
|
|
484
484
|
}
|
|
485
|
-
async get(userId,
|
|
486
|
-
|
|
487
|
-
|
|
485
|
+
async get(userId, arg2, options) {
|
|
486
|
+
const executeToolFn = this.createExecuteToolFn(userId, options);
|
|
487
|
+
if (typeof arg2 === "string") {
|
|
488
|
+
const tool = await this.getComposioToolBySlug(userId, arg2, options?.modifyToolSchema);
|
|
489
|
+
return this.toolset.wrapTool(tool, executeToolFn);
|
|
488
490
|
} else {
|
|
489
|
-
|
|
491
|
+
const tools = await this.getComposioTools(userId, arg2, options?.modifyToolSchema);
|
|
492
|
+
return this.toolset.wrapTools(tools, executeToolFn);
|
|
490
493
|
}
|
|
491
494
|
}
|
|
495
|
+
/**
|
|
496
|
+
* Creates a function that executes a tool.
|
|
497
|
+
* This function is used by agentic the toolsets to execute the tool
|
|
498
|
+
* @param {string} userId - The user id
|
|
499
|
+
* @param {ExecuteToolModifiers} modifiers - The modifiers to be applied to the tool
|
|
500
|
+
* @returns {ExecuteToolFn} The execute tool function
|
|
501
|
+
*/
|
|
502
|
+
createExecuteToolFn(userId, modifiers) {
|
|
503
|
+
const executeToolFn = async (toolSlug, input) => {
|
|
504
|
+
return await this.execute(
|
|
505
|
+
toolSlug,
|
|
506
|
+
{
|
|
507
|
+
userId,
|
|
508
|
+
arguments: input
|
|
509
|
+
},
|
|
510
|
+
modifiers
|
|
511
|
+
);
|
|
512
|
+
};
|
|
513
|
+
return executeToolFn;
|
|
514
|
+
}
|
|
492
515
|
/**
|
|
493
516
|
* Exectes a given tool with the provided parameters.
|
|
494
517
|
*
|
|
@@ -578,6 +601,87 @@ var Tools = class {
|
|
|
578
601
|
}
|
|
579
602
|
};
|
|
580
603
|
|
|
604
|
+
// src/types/toolkit.types.ts
|
|
605
|
+
var import_zod2 = require("zod");
|
|
606
|
+
var ToolkitMangedByEnumSchema = import_zod2.z.enum(["all", "composio_managed", "project_managed"]);
|
|
607
|
+
var ToolkitSortByEnumSchema = import_zod2.z.enum(["usage", "alphabetically"]);
|
|
608
|
+
var ToolkitsListParamsSchema = import_zod2.z.object({
|
|
609
|
+
category: import_zod2.z.string().optional(),
|
|
610
|
+
isLocal: import_zod2.z.boolean().optional(),
|
|
611
|
+
managedBy: ToolkitMangedByEnumSchema.optional(),
|
|
612
|
+
sortBy: ToolkitSortByEnumSchema.optional()
|
|
613
|
+
});
|
|
614
|
+
var ToolKitMetaSchema = import_zod2.z.object({
|
|
615
|
+
categories: import_zod2.z.array(
|
|
616
|
+
import_zod2.z.object({
|
|
617
|
+
id: import_zod2.z.string(),
|
|
618
|
+
name: import_zod2.z.string()
|
|
619
|
+
})
|
|
620
|
+
),
|
|
621
|
+
createdAt: import_zod2.z.string(),
|
|
622
|
+
description: import_zod2.z.string(),
|
|
623
|
+
logo: import_zod2.z.string(),
|
|
624
|
+
toolsCount: import_zod2.z.number(),
|
|
625
|
+
triggersCount: import_zod2.z.number(),
|
|
626
|
+
updatedAt: import_zod2.z.string()
|
|
627
|
+
});
|
|
628
|
+
var ToolKitItemSchema = import_zod2.z.object({
|
|
629
|
+
name: import_zod2.z.string(),
|
|
630
|
+
slug: import_zod2.z.string(),
|
|
631
|
+
meta: ToolKitMetaSchema,
|
|
632
|
+
isLocalToolkit: import_zod2.z.boolean(),
|
|
633
|
+
authSchemes: import_zod2.z.array(import_zod2.z.string()).optional(),
|
|
634
|
+
composioManagedAuthSchemes: import_zod2.z.array(import_zod2.z.string()).optional(),
|
|
635
|
+
noAuth: import_zod2.z.boolean().optional()
|
|
636
|
+
});
|
|
637
|
+
var ToolKitListResponseSchema = import_zod2.z.object({
|
|
638
|
+
items: import_zod2.z.array(ToolKitItemSchema),
|
|
639
|
+
nextCursor: import_zod2.z.string().nullable(),
|
|
640
|
+
totalPages: import_zod2.z.number()
|
|
641
|
+
});
|
|
642
|
+
var ToolkitAuthFieldSchema = import_zod2.z.object({
|
|
643
|
+
name: import_zod2.z.string(),
|
|
644
|
+
displayName: import_zod2.z.string(),
|
|
645
|
+
type: import_zod2.z.string(),
|
|
646
|
+
default: import_zod2.z.string().nullable().optional()
|
|
647
|
+
});
|
|
648
|
+
var ToolkitAuthConfigDetailsSchema = import_zod2.z.object({
|
|
649
|
+
name: import_zod2.z.string(),
|
|
650
|
+
mode: import_zod2.z.string(),
|
|
651
|
+
fields: import_zod2.z.array(
|
|
652
|
+
import_zod2.z.object({
|
|
653
|
+
authConfigCreation: import_zod2.z.object({
|
|
654
|
+
optional: import_zod2.z.array(ToolkitAuthFieldSchema),
|
|
655
|
+
required: import_zod2.z.array(ToolkitAuthFieldSchema)
|
|
656
|
+
}),
|
|
657
|
+
connectedAccountInitiation: import_zod2.z.object({
|
|
658
|
+
optional: import_zod2.z.array(ToolkitAuthFieldSchema),
|
|
659
|
+
required: import_zod2.z.array(ToolkitAuthFieldSchema)
|
|
660
|
+
})
|
|
661
|
+
})
|
|
662
|
+
),
|
|
663
|
+
proxy: import_zod2.z.object({
|
|
664
|
+
baseUrul: import_zod2.z.string()
|
|
665
|
+
})
|
|
666
|
+
});
|
|
667
|
+
var ToolkitRetrieveResponseSchema = import_zod2.z.object({
|
|
668
|
+
name: import_zod2.z.string(),
|
|
669
|
+
slug: import_zod2.z.string(),
|
|
670
|
+
meta: ToolKitMetaSchema,
|
|
671
|
+
isLocalToolkit: import_zod2.z.boolean(),
|
|
672
|
+
composioManagedAuthSchemes: import_zod2.z.array(import_zod2.z.string()).optional(),
|
|
673
|
+
authConfigDetails: import_zod2.z.array(ToolkitAuthConfigDetailsSchema).optional()
|
|
674
|
+
});
|
|
675
|
+
var ToolkitCategorySchema = import_zod2.z.object({
|
|
676
|
+
id: import_zod2.z.string(),
|
|
677
|
+
name: import_zod2.z.string()
|
|
678
|
+
});
|
|
679
|
+
var ToolkitRetrieveCategoriesResponseSchema = import_zod2.z.object({
|
|
680
|
+
items: import_zod2.z.array(ToolkitCategorySchema),
|
|
681
|
+
nextCursor: import_zod2.z.string().nullable(),
|
|
682
|
+
totalPages: import_zod2.z.number()
|
|
683
|
+
});
|
|
684
|
+
|
|
581
685
|
// src/models/Toolkits.ts
|
|
582
686
|
var Toolkits = class {
|
|
583
687
|
client;
|
|
@@ -589,8 +693,31 @@ var Toolkits = class {
|
|
|
589
693
|
* This method fetches the toolkits from the Composio API.
|
|
590
694
|
* @returns {Promise<Toolkit[]>} List of toolkits
|
|
591
695
|
*/
|
|
592
|
-
async getToolkits(query
|
|
593
|
-
|
|
696
|
+
async getToolkits(query) {
|
|
697
|
+
const parsedQuery = ToolkitsListParamsSchema.parse(query);
|
|
698
|
+
const result = await this.client.toolkits.list({
|
|
699
|
+
category: parsedQuery.category,
|
|
700
|
+
is_local: parsedQuery.isLocal,
|
|
701
|
+
managed_by: parsedQuery.managedBy,
|
|
702
|
+
sort_by: parsedQuery.sortBy
|
|
703
|
+
});
|
|
704
|
+
const parsedResult = ToolKitListResponseSchema.parse({
|
|
705
|
+
items: result.items.map((item) => {
|
|
706
|
+
const parsedItem = ToolKitItemSchema.parse({
|
|
707
|
+
name: item.name,
|
|
708
|
+
slug: item.slug,
|
|
709
|
+
meta: item.meta,
|
|
710
|
+
isLocalToolkit: item.is_local_toolkit,
|
|
711
|
+
authSchemes: item.auth_schemes,
|
|
712
|
+
composioManagedAuthSchemes: item.composio_managed_auth_schemes,
|
|
713
|
+
noAuth: item.no_auth
|
|
714
|
+
});
|
|
715
|
+
return parsedItem;
|
|
716
|
+
}),
|
|
717
|
+
nextCursor: result.next_cursor,
|
|
718
|
+
totalPages: result.total_pages
|
|
719
|
+
});
|
|
720
|
+
return parsedResult;
|
|
594
721
|
}
|
|
595
722
|
/**
|
|
596
723
|
* Fetches a toolkit by its Slug.
|
|
@@ -599,16 +726,49 @@ var Toolkits = class {
|
|
|
599
726
|
* @param options - Request options
|
|
600
727
|
* @returns {Promise<ToolkitRetrieveResponse>} The toolkit object
|
|
601
728
|
*/
|
|
602
|
-
async getToolkitBySlug(slug
|
|
603
|
-
|
|
729
|
+
async getToolkitBySlug(slug) {
|
|
730
|
+
const result = await this.client.toolkits.retrieve(slug);
|
|
731
|
+
const parsedResult = ToolkitRetrieveResponseSchema.parse({
|
|
732
|
+
name: result.name,
|
|
733
|
+
slug: result.slug,
|
|
734
|
+
meta: result.meta,
|
|
735
|
+
isLocalToolkit: result.is_local_toolkit,
|
|
736
|
+
composioManagedAuthSchemes: result.composio_managed_auth_schemes,
|
|
737
|
+
authConfigDetails: result.auth_config_details
|
|
738
|
+
});
|
|
739
|
+
return parsedResult;
|
|
740
|
+
}
|
|
741
|
+
/**
|
|
742
|
+
* Fetches a toolkit by its Slug or a list of toolkits.
|
|
743
|
+
* This method retrieves the toolkit from the Composio API.
|
|
744
|
+
* @param arg - The ID of the toolkit to be retrieved or a list of parameters
|
|
745
|
+
* @returns {Promise<ToolkitRetrieveResponse | ToolKitListResponse>} The toolkit object or a list of toolkits
|
|
746
|
+
*/
|
|
747
|
+
async get(arg) {
|
|
748
|
+
if (typeof arg === "string") {
|
|
749
|
+
return this.getToolkitBySlug(arg);
|
|
750
|
+
}
|
|
751
|
+
return this.getToolkits(arg);
|
|
604
752
|
}
|
|
605
753
|
/**
|
|
606
754
|
* Fetches all categories available in the Composio SDK
|
|
607
755
|
*
|
|
608
756
|
* @returns {Promise<ToolkitRetrieveCategoriesResponse>} List of categories
|
|
609
757
|
*/
|
|
610
|
-
async listCategories(
|
|
611
|
-
|
|
758
|
+
async listCategories() {
|
|
759
|
+
const result = await this.client.toolkits.retrieveCategories();
|
|
760
|
+
const parsedResult = ToolkitRetrieveCategoriesResponseSchema.parse({
|
|
761
|
+
items: result.items.map((item) => {
|
|
762
|
+
const parsedItem = ToolkitCategorySchema.parse({
|
|
763
|
+
id: item.id,
|
|
764
|
+
name: item.name
|
|
765
|
+
});
|
|
766
|
+
return parsedItem;
|
|
767
|
+
}),
|
|
768
|
+
nextCursor: result.next_cursor,
|
|
769
|
+
totalPages: result.total_pages
|
|
770
|
+
});
|
|
771
|
+
return parsedResult;
|
|
612
772
|
}
|
|
613
773
|
};
|
|
614
774
|
|
|
@@ -937,7 +1097,7 @@ var AuthConfigs = class {
|
|
|
937
1097
|
};
|
|
938
1098
|
|
|
939
1099
|
// src/types/connectedAccounts.types.ts
|
|
940
|
-
var
|
|
1100
|
+
var import_zod3 = require("zod");
|
|
941
1101
|
var ConnectedAccountStatuses = {
|
|
942
1102
|
ACTIVE: "ACTIVE",
|
|
943
1103
|
INACTIVE: "INACTIVE",
|
|
@@ -946,7 +1106,7 @@ var ConnectedAccountStatuses = {
|
|
|
946
1106
|
EXPIRED: "EXPIRED",
|
|
947
1107
|
FAILED: "FAILED"
|
|
948
1108
|
};
|
|
949
|
-
var ConnectedAccountStatusSchema =
|
|
1109
|
+
var ConnectedAccountStatusSchema = import_zod3.z.enum([
|
|
950
1110
|
ConnectedAccountStatuses.ACTIVE,
|
|
951
1111
|
ConnectedAccountStatuses.INACTIVE,
|
|
952
1112
|
ConnectedAccountStatuses.PENDING,
|
|
@@ -954,20 +1114,34 @@ var ConnectedAccountStatusSchema = import_zod2.z.enum([
|
|
|
954
1114
|
ConnectedAccountStatuses.EXPIRED,
|
|
955
1115
|
ConnectedAccountStatuses.FAILED
|
|
956
1116
|
]);
|
|
957
|
-
var CreateConnectedAccountParamsSchema =
|
|
958
|
-
authConfig:
|
|
959
|
-
id:
|
|
1117
|
+
var CreateConnectedAccountParamsSchema = import_zod3.z.object({
|
|
1118
|
+
authConfig: import_zod3.z.object({
|
|
1119
|
+
id: import_zod3.z.string()
|
|
960
1120
|
}),
|
|
961
|
-
connection:
|
|
962
|
-
data:
|
|
963
|
-
|
|
964
|
-
userId:
|
|
1121
|
+
connection: import_zod3.z.object({
|
|
1122
|
+
data: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()).optional(),
|
|
1123
|
+
redirectUrl: import_zod3.z.string().optional(),
|
|
1124
|
+
userId: import_zod3.z.string().optional()
|
|
965
1125
|
})
|
|
966
1126
|
});
|
|
967
|
-
var
|
|
968
|
-
|
|
1127
|
+
var DefaultCreateConnectedAccountParamsSchema = import_zod3.z.object({
|
|
1128
|
+
auth_config: import_zod3.z.object({
|
|
1129
|
+
id: import_zod3.z.string()
|
|
1130
|
+
}),
|
|
1131
|
+
connection: import_zod3.z.object({
|
|
1132
|
+
data: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()).optional(),
|
|
1133
|
+
redirect_uri: import_zod3.z.string().optional(),
|
|
1134
|
+
user_id: import_zod3.z.string().optional()
|
|
1135
|
+
})
|
|
1136
|
+
});
|
|
1137
|
+
var CreateConnectedAccountOptionsSchema = import_zod3.z.object({
|
|
1138
|
+
redirectUrl: import_zod3.z.string().optional(),
|
|
1139
|
+
data: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()).optional()
|
|
1140
|
+
});
|
|
1141
|
+
var CreateConnectedAccountResponseSchema = import_zod3.z.object({
|
|
1142
|
+
id: import_zod3.z.string(),
|
|
969
1143
|
status: ConnectedAccountStatusSchema,
|
|
970
|
-
redirectUrl:
|
|
1144
|
+
redirectUrl: import_zod3.z.string().nullable()
|
|
971
1145
|
});
|
|
972
1146
|
var ConnectedAccountAuthSchemes = {
|
|
973
1147
|
OAUTH2: "OAUTH2",
|
|
@@ -984,7 +1158,7 @@ var ConnectedAccountAuthSchemes = {
|
|
|
984
1158
|
CALCOM_AUTH: "CALCOM_AUTH",
|
|
985
1159
|
SNOWFLAKE: "SNOWFLAKE"
|
|
986
1160
|
};
|
|
987
|
-
var ConnectedAccountAuthSchemesSchema =
|
|
1161
|
+
var ConnectedAccountAuthSchemesSchema = import_zod3.z.enum([
|
|
988
1162
|
ConnectedAccountAuthSchemes.OAUTH2,
|
|
989
1163
|
ConnectedAccountAuthSchemes.OAUTH1,
|
|
990
1164
|
ConnectedAccountAuthSchemes.OAUTH1A,
|
|
@@ -999,28 +1173,28 @@ var ConnectedAccountAuthSchemesSchema = import_zod2.z.enum([
|
|
|
999
1173
|
ConnectedAccountAuthSchemes.CALCOM_AUTH,
|
|
1000
1174
|
ConnectedAccountAuthSchemes.SNOWFLAKE
|
|
1001
1175
|
]);
|
|
1002
|
-
var ConnectedAccountAuthConfigSchema =
|
|
1003
|
-
id:
|
|
1176
|
+
var ConnectedAccountAuthConfigSchema = import_zod3.z.object({
|
|
1177
|
+
id: import_zod3.z.string(),
|
|
1004
1178
|
authScheme: ConnectedAccountAuthSchemesSchema,
|
|
1005
|
-
isComposioManaged:
|
|
1006
|
-
isDisabled:
|
|
1179
|
+
isComposioManaged: import_zod3.z.boolean(),
|
|
1180
|
+
isDisabled: import_zod3.z.boolean()
|
|
1007
1181
|
});
|
|
1008
|
-
var ConnectedAccountRetrieveResponseSchema =
|
|
1009
|
-
id:
|
|
1010
|
-
uuid:
|
|
1182
|
+
var ConnectedAccountRetrieveResponseSchema = import_zod3.z.object({
|
|
1183
|
+
id: import_zod3.z.string(),
|
|
1184
|
+
uuid: import_zod3.z.string(),
|
|
1011
1185
|
authConfig: ConnectedAccountAuthConfigSchema,
|
|
1012
|
-
userId:
|
|
1013
|
-
data:
|
|
1014
|
-
params:
|
|
1186
|
+
userId: import_zod3.z.string(),
|
|
1187
|
+
data: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()),
|
|
1188
|
+
params: import_zod3.z.record(import_zod3.z.string(), import_zod3.z.unknown()),
|
|
1015
1189
|
status: ConnectedAccountStatusSchema,
|
|
1016
|
-
statusReason:
|
|
1017
|
-
toolkit:
|
|
1018
|
-
slug:
|
|
1190
|
+
statusReason: import_zod3.z.string().nullable(),
|
|
1191
|
+
toolkit: import_zod3.z.object({
|
|
1192
|
+
slug: import_zod3.z.string()
|
|
1019
1193
|
}),
|
|
1020
|
-
testRequestEndpoint:
|
|
1021
|
-
isDisabled:
|
|
1022
|
-
createdAt:
|
|
1023
|
-
updatedAt:
|
|
1194
|
+
testRequestEndpoint: import_zod3.z.string().optional(),
|
|
1195
|
+
isDisabled: import_zod3.z.boolean(),
|
|
1196
|
+
createdAt: import_zod3.z.string(),
|
|
1197
|
+
updatedAt: import_zod3.z.string()
|
|
1024
1198
|
});
|
|
1025
1199
|
|
|
1026
1200
|
// src/models/ConnectionRequest.ts
|
|
@@ -1040,7 +1214,7 @@ var ConnectionRequest = class {
|
|
|
1040
1214
|
* @returns
|
|
1041
1215
|
*/
|
|
1042
1216
|
async transformResponse(response) {
|
|
1043
|
-
|
|
1217
|
+
const parsedResponse = ConnectedAccountRetrieveResponseSchema.parse({
|
|
1044
1218
|
...response,
|
|
1045
1219
|
userId: response.user_id,
|
|
1046
1220
|
// Add the missing userId property
|
|
@@ -1055,7 +1229,8 @@ var ConnectionRequest = class {
|
|
|
1055
1229
|
createdAt: response.created_at,
|
|
1056
1230
|
updatedAt: response.updated_at,
|
|
1057
1231
|
testRequestEndpoint: response.test_request_endpoint
|
|
1058
|
-
};
|
|
1232
|
+
});
|
|
1233
|
+
return parsedResponse;
|
|
1059
1234
|
}
|
|
1060
1235
|
/**
|
|
1061
1236
|
* Wait for the connection to be established.
|
|
@@ -1101,8 +1276,8 @@ var ConnectedAccounts = class {
|
|
|
1101
1276
|
* @param {RequestOptions} options - Request options
|
|
1102
1277
|
* @returns {Promise<ConnectedAccountListResponse>} List of connected accounts
|
|
1103
1278
|
*/
|
|
1104
|
-
async list(query
|
|
1105
|
-
return this.client.connectedAccounts.list(query
|
|
1279
|
+
async list(query) {
|
|
1280
|
+
return this.client.connectedAccounts.list(query);
|
|
1106
1281
|
}
|
|
1107
1282
|
/**
|
|
1108
1283
|
* Create a new connected account
|
|
@@ -1110,8 +1285,8 @@ var ConnectedAccounts = class {
|
|
|
1110
1285
|
* @param {RequestOptions} options - Request options
|
|
1111
1286
|
* @returns {Promise<ConnectedAccountCreateResponse>} Created connected account
|
|
1112
1287
|
*/
|
|
1113
|
-
async create(data
|
|
1114
|
-
return this.client.connectedAccounts.create(data
|
|
1288
|
+
async create(data) {
|
|
1289
|
+
return this.client.connectedAccounts.create(data);
|
|
1115
1290
|
}
|
|
1116
1291
|
/**
|
|
1117
1292
|
* Get a connected account by nanoid
|
|
@@ -1119,8 +1294,8 @@ var ConnectedAccounts = class {
|
|
|
1119
1294
|
* @param {RequestOptions} options - Request options
|
|
1120
1295
|
* @returns {Promise<ConnectedAccountRetrieveResponse>} Connected account details
|
|
1121
1296
|
*/
|
|
1122
|
-
async get(nanoid
|
|
1123
|
-
return this.client.connectedAccounts.retrieve(nanoid
|
|
1297
|
+
async get(nanoid) {
|
|
1298
|
+
return this.client.connectedAccounts.retrieve(nanoid);
|
|
1124
1299
|
}
|
|
1125
1300
|
/**
|
|
1126
1301
|
* Delete a connected account
|
|
@@ -1128,8 +1303,8 @@ var ConnectedAccounts = class {
|
|
|
1128
1303
|
* @param {RequestOptions} options - Request options
|
|
1129
1304
|
* @returns {Promise<ConnectedAccountDeleteResponse>} Response from deletion
|
|
1130
1305
|
*/
|
|
1131
|
-
async delete(nanoid
|
|
1132
|
-
return this.client.connectedAccounts.delete(nanoid
|
|
1306
|
+
async delete(nanoid) {
|
|
1307
|
+
return this.client.connectedAccounts.delete(nanoid);
|
|
1133
1308
|
}
|
|
1134
1309
|
/**
|
|
1135
1310
|
* Refresh a connected account's credentials
|
|
@@ -1137,8 +1312,8 @@ var ConnectedAccounts = class {
|
|
|
1137
1312
|
* @param {RequestOptions} options - Request options
|
|
1138
1313
|
* @returns {Promise<ConnectedAccountRefreshResponse>} Refreshed connected account details
|
|
1139
1314
|
*/
|
|
1140
|
-
async refresh(nanoid
|
|
1141
|
-
return this.client.connectedAccounts.refresh(nanoid
|
|
1315
|
+
async refresh(nanoid) {
|
|
1316
|
+
return this.client.connectedAccounts.refresh(nanoid);
|
|
1142
1317
|
}
|
|
1143
1318
|
/**
|
|
1144
1319
|
* Update the status of a connected account
|
|
@@ -1147,8 +1322,8 @@ var ConnectedAccounts = class {
|
|
|
1147
1322
|
* @param {RequestOptions} options - Request options
|
|
1148
1323
|
* @returns {Promise<ConnectedAccountUpdateStatusResponse>} Updated connected account details
|
|
1149
1324
|
*/
|
|
1150
|
-
async updateStatus(nanoid, params
|
|
1151
|
-
return this.client.connectedAccounts.updateStatus(nanoid, params
|
|
1325
|
+
async updateStatus(nanoid, params) {
|
|
1326
|
+
return this.client.connectedAccounts.updateStatus(nanoid, params);
|
|
1152
1327
|
}
|
|
1153
1328
|
/**
|
|
1154
1329
|
* Enable a connected account
|
|
@@ -1156,8 +1331,8 @@ var ConnectedAccounts = class {
|
|
|
1156
1331
|
* @param {RequestOptions} options - Request options
|
|
1157
1332
|
* @returns {Promise<ConnectedAccountUpdateStatusResponse>} Updated connected account details
|
|
1158
1333
|
*/
|
|
1159
|
-
async enable(nanoid
|
|
1160
|
-
return this.client.connectedAccounts.updateStatus(nanoid, { enabled: true }
|
|
1334
|
+
async enable(nanoid) {
|
|
1335
|
+
return this.client.connectedAccounts.updateStatus(nanoid, { enabled: true });
|
|
1161
1336
|
}
|
|
1162
1337
|
/**
|
|
1163
1338
|
* Disable a connected account
|
|
@@ -1165,8 +1340,8 @@ var ConnectedAccounts = class {
|
|
|
1165
1340
|
* @param {RequestOptions} options - Request options
|
|
1166
1341
|
* @returns {Promise<ConnectedAccountUpdateStatusResponse>} Updated connected account details
|
|
1167
1342
|
*/
|
|
1168
|
-
async disable(nanoid
|
|
1169
|
-
return this.client.connectedAccounts.updateStatus(nanoid, { enabled: false }
|
|
1343
|
+
async disable(nanoid) {
|
|
1344
|
+
return this.client.connectedAccounts.updateStatus(nanoid, { enabled: false });
|
|
1170
1345
|
}
|
|
1171
1346
|
/**
|
|
1172
1347
|
* Compound function to create a new connected account.
|
|
@@ -1175,16 +1350,16 @@ var ConnectedAccounts = class {
|
|
|
1175
1350
|
* @param {CreateConnectedAccountParams} data - Data for creating a new connected account
|
|
1176
1351
|
* @returns {Promise<ConnectionRequest>} Connection request object
|
|
1177
1352
|
*/
|
|
1178
|
-
async createConnectedAccount(
|
|
1179
|
-
const {
|
|
1353
|
+
async createConnectedAccount(userId, authConfigId, options) {
|
|
1354
|
+
const { redirectUrl, data } = options;
|
|
1180
1355
|
const response = await this.create({
|
|
1181
1356
|
auth_config: {
|
|
1182
|
-
id:
|
|
1357
|
+
id: authConfigId
|
|
1183
1358
|
},
|
|
1184
1359
|
connection: {
|
|
1185
|
-
data
|
|
1186
|
-
redirect_uri:
|
|
1187
|
-
user_id:
|
|
1360
|
+
data,
|
|
1361
|
+
redirect_uri: redirectUrl,
|
|
1362
|
+
user_id: userId
|
|
1188
1363
|
}
|
|
1189
1364
|
});
|
|
1190
1365
|
return new ConnectionRequest(this.client, response.id, response.status);
|
|
@@ -1474,37 +1649,44 @@ async function checkForLatestVersionFromNPM(currentVersion) {
|
|
|
1474
1649
|
}
|
|
1475
1650
|
|
|
1476
1651
|
// src/toolset/BaseToolset.ts
|
|
1477
|
-
var
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1484
|
-
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1652
|
+
var BaseToolset = class {
|
|
1653
|
+
/**
|
|
1654
|
+
* @internal
|
|
1655
|
+
* The function to execute a tool.
|
|
1656
|
+
* This is set automatically injected by the core SDK.
|
|
1657
|
+
*/
|
|
1658
|
+
_globalExecuteToolFn;
|
|
1659
|
+
/**
|
|
1660
|
+
* @internal
|
|
1661
|
+
* Set the function to execute a tool.
|
|
1662
|
+
* This is set automatically injected by the core SDK.
|
|
1663
|
+
*/
|
|
1664
|
+
_setExecuteToolFn(executeToolFn) {
|
|
1665
|
+
this._globalExecuteToolFn = executeToolFn;
|
|
1489
1666
|
}
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
}
|
|
1502
|
-
return this.composio;
|
|
1667
|
+
/**
|
|
1668
|
+
* @public
|
|
1669
|
+
* Gloabl function to execute a tool.
|
|
1670
|
+
* This function is used by toolset providers to implement helper functions to execute tools.
|
|
1671
|
+
* This is a 1:1 mapping of the `execute` method in the `Tools` class.
|
|
1672
|
+
* @param {string} toolSlug - The slug of the tool to execute.
|
|
1673
|
+
* @param {Record<string, unknown>} input - The input to the tool.
|
|
1674
|
+
* @returns {Promise<string>} The result of the tool execution.
|
|
1675
|
+
*/
|
|
1676
|
+
executeTool(toolSlug, body, modifers) {
|
|
1677
|
+
return this._globalExecuteToolFn(toolSlug, body, modifers);
|
|
1503
1678
|
}
|
|
1504
1679
|
};
|
|
1680
|
+
var BaseNonAgenticToolset = class extends BaseToolset {
|
|
1681
|
+
_isAgentic = false;
|
|
1682
|
+
};
|
|
1683
|
+
var BaseAgenticToolset = class extends BaseToolset {
|
|
1684
|
+
_isAgentic = true;
|
|
1685
|
+
};
|
|
1505
1686
|
|
|
1506
1687
|
// src/toolset/OpenAIToolset.ts
|
|
1507
1688
|
var OpenAIToolset = class extends BaseNonAgenticToolset {
|
|
1689
|
+
name = "openai";
|
|
1508
1690
|
/**
|
|
1509
1691
|
* Absract method to wrap a tool in the toolset.
|
|
1510
1692
|
* This method is implemented by the toolset.
|
|
@@ -1522,49 +1704,24 @@ var OpenAIToolset = class extends BaseNonAgenticToolset {
|
|
|
1522
1704
|
function: formattedSchema
|
|
1523
1705
|
};
|
|
1524
1706
|
};
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
* @param modifiers - Optional modifiers to transform tool schemas
|
|
1529
|
-
* @returns The tools.
|
|
1530
|
-
*/
|
|
1531
|
-
async getTools(userId, params, modifiers) {
|
|
1532
|
-
const tools = await this.getComposio()?.tools.getComposioTools(
|
|
1533
|
-
userId,
|
|
1534
|
-
params,
|
|
1535
|
-
modifiers?.modifyToolSchema
|
|
1536
|
-
);
|
|
1537
|
-
return tools?.map((tool) => this.wrapTool(tool)) ?? [];
|
|
1538
|
-
}
|
|
1539
|
-
async getToolBySlug(userId, slug, modifiers) {
|
|
1540
|
-
const tool = await this.getComposio().tools.getComposioToolBySlug(
|
|
1541
|
-
userId,
|
|
1542
|
-
slug,
|
|
1543
|
-
modifiers?.modifyToolSchema
|
|
1544
|
-
);
|
|
1545
|
-
return this.wrapTool(tool);
|
|
1546
|
-
}
|
|
1707
|
+
wrapTools = (tools) => {
|
|
1708
|
+
return tools.map((tool) => this.wrapTool(tool));
|
|
1709
|
+
};
|
|
1547
1710
|
/**
|
|
1548
1711
|
* Execute a tool call.
|
|
1549
1712
|
* @param {OpenAI.ChatCompletionMessageToolCall} tool - The tool to execute.
|
|
1550
1713
|
* @param {string} userId - The user id.
|
|
1551
1714
|
* @returns {Promise<string>} The result of the tool call.
|
|
1552
1715
|
*/
|
|
1553
|
-
async executeToolCall(userId, tool, modifiers) {
|
|
1554
|
-
const toolSchema = await this.getComposio().tools.getComposioToolBySlug(
|
|
1555
|
-
userId,
|
|
1556
|
-
tool.function.name
|
|
1557
|
-
);
|
|
1558
|
-
const appSlug = toolSchema?.toolkit?.slug.toLowerCase();
|
|
1559
|
-
if (!appSlug) {
|
|
1560
|
-
throw new Error("App slug not found");
|
|
1561
|
-
}
|
|
1716
|
+
async executeToolCall(userId, tool, options, modifiers) {
|
|
1562
1717
|
const payload = {
|
|
1563
|
-
|
|
1564
|
-
|
|
1718
|
+
arguments: JSON.parse(tool.function.arguments),
|
|
1719
|
+
connectedAccountId: options.connectedAccountId,
|
|
1720
|
+
customAuthParams: options.customAuthParams,
|
|
1721
|
+
userId
|
|
1565
1722
|
};
|
|
1566
|
-
const
|
|
1567
|
-
return JSON.stringify(
|
|
1723
|
+
const result = await this.executeTool(tool.function.name, payload, modifiers);
|
|
1724
|
+
return JSON.stringify(result);
|
|
1568
1725
|
}
|
|
1569
1726
|
/**
|
|
1570
1727
|
* Handle the tool call from the assistant.
|
|
@@ -1573,11 +1730,13 @@ var OpenAIToolset = class extends BaseNonAgenticToolset {
|
|
|
1573
1730
|
* @param {string} userId - The user id.
|
|
1574
1731
|
* @returns {Promise<string[]>} The results of the tool call.
|
|
1575
1732
|
*/
|
|
1576
|
-
async handleToolCall(userId, chatCompletion, modifiers) {
|
|
1733
|
+
async handleToolCall(userId, chatCompletion, options, modifiers) {
|
|
1577
1734
|
const outputs = [];
|
|
1578
1735
|
for (const message of chatCompletion.choices) {
|
|
1579
1736
|
if (message.message.tool_calls) {
|
|
1580
|
-
outputs.push(
|
|
1737
|
+
outputs.push(
|
|
1738
|
+
await this.executeToolCall(userId, message.message.tool_calls[0], options, modifiers)
|
|
1739
|
+
);
|
|
1581
1740
|
}
|
|
1582
1741
|
}
|
|
1583
1742
|
return outputs;
|
|
@@ -1589,7 +1748,7 @@ var OpenAIToolset = class extends BaseNonAgenticToolset {
|
|
|
1589
1748
|
* @param {string} userId - The user id.
|
|
1590
1749
|
* @returns {Promise<OpenAI.Beta.Threads.Runs.RunSubmitToolOutputsParams.ToolOutput[]>} The tool outputs.
|
|
1591
1750
|
*/
|
|
1592
|
-
async handleAssistantMessage(userId, run, modifiers) {
|
|
1751
|
+
async handleAssistantMessage(userId, run, options, modifiers) {
|
|
1593
1752
|
const tool_calls = run.required_action?.submit_tool_outputs?.tool_calls || [];
|
|
1594
1753
|
const tool_outputs = await Promise.all(
|
|
1595
1754
|
tool_calls.map(async (tool_call) => {
|
|
@@ -1597,6 +1756,7 @@ var OpenAIToolset = class extends BaseNonAgenticToolset {
|
|
|
1597
1756
|
const tool_response = await this.executeToolCall(
|
|
1598
1757
|
userId,
|
|
1599
1758
|
tool_call,
|
|
1759
|
+
options,
|
|
1600
1760
|
modifiers
|
|
1601
1761
|
);
|
|
1602
1762
|
logger_default.debug(`Tool call ${tool_call.id} executed with response: ${tool_response}`);
|
|
@@ -1617,7 +1777,7 @@ var OpenAIToolset = class extends BaseNonAgenticToolset {
|
|
|
1617
1777
|
* @param {string} userId - The user id.
|
|
1618
1778
|
* @returns {AsyncGenerator<OpenAI.Beta.Assistants.AssistantStreamEvent, void, unknown>} The run stream.
|
|
1619
1779
|
*/
|
|
1620
|
-
async *waitAndHandleAssistantStreamToolCalls(userId, client, runStream, thread, modifiers) {
|
|
1780
|
+
async *waitAndHandleAssistantStreamToolCalls(userId, client, runStream, thread, options, modifiers) {
|
|
1621
1781
|
let runId = null;
|
|
1622
1782
|
for await (const event of runStream) {
|
|
1623
1783
|
yield event;
|
|
@@ -1629,7 +1789,12 @@ var OpenAIToolset = class extends BaseNonAgenticToolset {
|
|
|
1629
1789
|
continue;
|
|
1630
1790
|
}
|
|
1631
1791
|
if (event.event === "thread.run.requires_action") {
|
|
1632
|
-
const toolOutputs = await this.handleAssistantMessage(
|
|
1792
|
+
const toolOutputs = await this.handleAssistantMessage(
|
|
1793
|
+
userId,
|
|
1794
|
+
event.data,
|
|
1795
|
+
options,
|
|
1796
|
+
modifiers
|
|
1797
|
+
);
|
|
1633
1798
|
await client.beta.threads.runs.submitToolOutputs(thread.id, runId, {
|
|
1634
1799
|
tool_outputs: toolOutputs
|
|
1635
1800
|
});
|
|
@@ -1649,7 +1814,7 @@ var OpenAIToolset = class extends BaseNonAgenticToolset {
|
|
|
1649
1814
|
let finalRun = await client.beta.threads.runs.retrieve(thread.id, runId);
|
|
1650
1815
|
while (["queued", "in_progress", "requires_action"].includes(finalRun.status)) {
|
|
1651
1816
|
if (finalRun.status === "requires_action") {
|
|
1652
|
-
const toolOutputs = await this.handleAssistantMessage(userId, finalRun, modifiers);
|
|
1817
|
+
const toolOutputs = await this.handleAssistantMessage(userId, finalRun, options, modifiers);
|
|
1653
1818
|
finalRun = await client.beta.threads.runs.submitToolOutputs(thread.id, runId, {
|
|
1654
1819
|
tool_outputs: toolOutputs
|
|
1655
1820
|
});
|
|
@@ -1668,9 +1833,9 @@ var OpenAIToolset = class extends BaseNonAgenticToolset {
|
|
|
1668
1833
|
* @param {string} userId - The user id.
|
|
1669
1834
|
* @returns {Promise<OpenAI.Beta.Threads.Run>} The run object.
|
|
1670
1835
|
*/
|
|
1671
|
-
async waitAndHandleAssistantToolCalls(userId, client, run, thread, modifiers) {
|
|
1836
|
+
async waitAndHandleAssistantToolCalls(userId, client, run, thread, options, modifiers) {
|
|
1672
1837
|
while (["queued", "in_progress", "requires_action"].includes(run.status)) {
|
|
1673
|
-
const tool_outputs = await this.handleAssistantMessage(userId, run, modifiers);
|
|
1838
|
+
const tool_outputs = await this.handleAssistantMessage(userId, run, options, modifiers);
|
|
1674
1839
|
if (run.status === "requires_action") {
|
|
1675
1840
|
run = await client.beta.threads.runs.submitToolOutputs(thread.id, run.id, {
|
|
1676
1841
|
tool_outputs
|
|
@@ -1685,7 +1850,7 @@ var OpenAIToolset = class extends BaseNonAgenticToolset {
|
|
|
1685
1850
|
};
|
|
1686
1851
|
|
|
1687
1852
|
// package.json
|
|
1688
|
-
var version = "0.1.
|
|
1853
|
+
var version = "0.1.1-alpha.0";
|
|
1689
1854
|
|
|
1690
1855
|
// src/utils/uuid.ts
|
|
1691
1856
|
var import_uuid = require("uuid");
|
|
@@ -1695,7 +1860,6 @@ function getRandomUUID() {
|
|
|
1695
1860
|
|
|
1696
1861
|
// src/composio.ts
|
|
1697
1862
|
var Composio = class {
|
|
1698
|
-
DEFAULT_USER_ID = "default";
|
|
1699
1863
|
/**
|
|
1700
1864
|
* The Composio API client.
|
|
1701
1865
|
* @type {ComposioClient}
|
|
@@ -1744,8 +1908,8 @@ var Composio = class {
|
|
|
1744
1908
|
allowTracking: config.allowTracking ?? true
|
|
1745
1909
|
};
|
|
1746
1910
|
this.toolset = config.toolset ?? new OpenAIToolset();
|
|
1747
|
-
this.toolset.setComposio(this);
|
|
1748
1911
|
this.tools = new Tools(this.client, this.toolset);
|
|
1912
|
+
this.toolset._setExecuteToolFn(this.tools.execute);
|
|
1749
1913
|
this.toolkits = new Toolkits(this.client);
|
|
1750
1914
|
this.triggers = new Triggers(this.client);
|
|
1751
1915
|
this.authConfigs = new AuthConfigs(this.client);
|
|
@@ -1816,30 +1980,12 @@ var Composio = class {
|
|
|
1816
1980
|
|
|
1817
1981
|
// src/toolset/ComposioToolset.ts
|
|
1818
1982
|
var ComposioToolset = class extends BaseNonAgenticToolset {
|
|
1819
|
-
|
|
1820
|
-
constructor() {
|
|
1821
|
-
super();
|
|
1822
|
-
}
|
|
1983
|
+
name = "ComposioToolset";
|
|
1823
1984
|
wrapTool = (tool) => {
|
|
1824
1985
|
return tool;
|
|
1825
1986
|
};
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
userId,
|
|
1829
|
-
params,
|
|
1830
|
-
options?.modifyToolSchema
|
|
1831
|
-
);
|
|
1832
|
-
return tools?.map((tool) => this.wrapTool(tool)) ?? [];
|
|
1833
|
-
}
|
|
1834
|
-
async getToolBySlug(userId, slug, modifiers) {
|
|
1835
|
-
const tool = await this.getComposio().tools.getComposioToolBySlug(
|
|
1836
|
-
userId,
|
|
1837
|
-
slug,
|
|
1838
|
-
modifiers?.modifyToolSchema
|
|
1839
|
-
);
|
|
1840
|
-
return this.wrapTool(tool);
|
|
1841
|
-
}
|
|
1842
|
-
async test() {
|
|
1987
|
+
wrapTools(tools) {
|
|
1988
|
+
return tools.map((tool) => this.wrapTool(tool));
|
|
1843
1989
|
}
|
|
1844
1990
|
};
|
|
1845
1991
|
|
|
@@ -1848,39 +1994,39 @@ var BaseTelemetryTransport = class {
|
|
|
1848
1994
|
};
|
|
1849
1995
|
|
|
1850
1996
|
// src/utils/jsonSchema.ts
|
|
1851
|
-
var
|
|
1997
|
+
var import_zod4 = require("zod");
|
|
1852
1998
|
function jsonSchemaPropertiesToTSTypes(value) {
|
|
1853
1999
|
if (!value.type) {
|
|
1854
|
-
return
|
|
2000
|
+
return import_zod4.z.object({});
|
|
1855
2001
|
}
|
|
1856
2002
|
let zodType;
|
|
1857
2003
|
switch (value.type) {
|
|
1858
2004
|
case "string":
|
|
1859
|
-
zodType =
|
|
2005
|
+
zodType = import_zod4.z.string().describe(
|
|
1860
2006
|
(value.description || "") + (value.examples ? `
|
|
1861
2007
|
Examples: ${value.examples.join(", ")}` : "")
|
|
1862
2008
|
);
|
|
1863
2009
|
break;
|
|
1864
2010
|
case "number":
|
|
1865
|
-
zodType =
|
|
2011
|
+
zodType = import_zod4.z.number().describe(
|
|
1866
2012
|
(value.description || "") + (value.examples ? `
|
|
1867
2013
|
Examples: ${value.examples.join(", ")}` : "")
|
|
1868
2014
|
);
|
|
1869
2015
|
break;
|
|
1870
2016
|
case "integer":
|
|
1871
|
-
zodType =
|
|
2017
|
+
zodType = import_zod4.z.number().int().describe(
|
|
1872
2018
|
(value.description || "") + (value.examples ? `
|
|
1873
2019
|
Examples: ${value.examples.join(", ")}` : "")
|
|
1874
2020
|
);
|
|
1875
2021
|
break;
|
|
1876
2022
|
case "boolean":
|
|
1877
|
-
zodType =
|
|
2023
|
+
zodType = import_zod4.z.boolean().describe(
|
|
1878
2024
|
(value.description || "") + (value.examples ? `
|
|
1879
2025
|
Examples: ${value.examples.join(", ")}` : "")
|
|
1880
2026
|
);
|
|
1881
2027
|
break;
|
|
1882
2028
|
case "array":
|
|
1883
|
-
zodType =
|
|
2029
|
+
zodType = import_zod4.z.array(
|
|
1884
2030
|
jsonSchemaPropertiesToTSTypes(
|
|
1885
2031
|
value.items
|
|
1886
2032
|
)
|
|
@@ -1896,7 +2042,7 @@ Examples: ${value.examples.join(", ")}` : "")
|
|
|
1896
2042
|
);
|
|
1897
2043
|
break;
|
|
1898
2044
|
case "null":
|
|
1899
|
-
zodType =
|
|
2045
|
+
zodType = import_zod4.z.null().describe(value.description || "");
|
|
1900
2046
|
break;
|
|
1901
2047
|
default:
|
|
1902
2048
|
throw new Error(`Unsupported JSON schema type: ${value.type}`);
|
|
@@ -1907,7 +2053,7 @@ function jsonSchemaToModel(jsonSchema) {
|
|
|
1907
2053
|
const properties = jsonSchema.properties;
|
|
1908
2054
|
const requiredFields = jsonSchema.required || [];
|
|
1909
2055
|
if (!properties) {
|
|
1910
|
-
return
|
|
2056
|
+
return import_zod4.z.object({});
|
|
1911
2057
|
}
|
|
1912
2058
|
const zodSchema = {};
|
|
1913
2059
|
for (const [key, _] of Object.entries(properties)) {
|
|
@@ -1919,7 +2065,7 @@ function jsonSchemaToModel(jsonSchema) {
|
|
|
1919
2065
|
schema
|
|
1920
2066
|
)
|
|
1921
2067
|
);
|
|
1922
|
-
zodType =
|
|
2068
|
+
zodType = import_zod4.z.union(anyOfTypes).describe(
|
|
1923
2069
|
(value.description || "") + (value.examples ? `
|
|
1924
2070
|
Examples: ${value.examples.join(", ")}` : "")
|
|
1925
2071
|
);
|
|
@@ -1929,7 +2075,7 @@ Examples: ${value.examples.join(", ")}` : "")
|
|
|
1929
2075
|
schema
|
|
1930
2076
|
)
|
|
1931
2077
|
);
|
|
1932
|
-
zodType =
|
|
2078
|
+
zodType = import_zod4.z.intersection(
|
|
1933
2079
|
allOfTypes[0],
|
|
1934
2080
|
allOfTypes.slice(1).reduce((acc, schema) => acc.and(schema), allOfTypes[0])
|
|
1935
2081
|
).describe(
|
|
@@ -1953,7 +2099,7 @@ Examples: ${value.examples.join(", ")}` : "")
|
|
|
1953
2099
|
zodSchema[key] = zodType.optional();
|
|
1954
2100
|
}
|
|
1955
2101
|
}
|
|
1956
|
-
return
|
|
2102
|
+
return import_zod4.z.object(zodSchema);
|
|
1957
2103
|
}
|
|
1958
2104
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1959
2105
|
0 && (module.exports = {
|