@decocms/bindings 0.2.4 → 1.0.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.
Files changed (54) hide show
  1. package/README.md +3 -3
  2. package/package.json +9 -35
  3. package/src/core/binder.ts +241 -0
  4. package/src/core/client/README.md +3 -0
  5. package/{dist/core/client/http-client-transport.js → src/core/client/http-client-transport.ts} +24 -12
  6. package/src/core/client/index.ts +1 -0
  7. package/src/core/client/mcp-client.ts +149 -0
  8. package/src/core/client/mcp.ts +93 -0
  9. package/src/core/client/proxy.ts +151 -0
  10. package/src/core/connection.ts +38 -0
  11. package/src/core/subset.ts +514 -0
  12. package/src/index.ts +15 -0
  13. package/src/well-known/agent.ts +60 -0
  14. package/src/well-known/collections.ts +416 -0
  15. package/src/well-known/language-model.ts +383 -0
  16. package/test/index.test.ts +942 -0
  17. package/tsconfig.json +11 -0
  18. package/vitest.config.ts +8 -0
  19. package/dist/core/binder.d.ts +0 -3
  20. package/dist/core/binder.js +0 -77
  21. package/dist/core/binder.js.map +0 -1
  22. package/dist/core/client/http-client-transport.d.ts +0 -12
  23. package/dist/core/client/http-client-transport.js.map +0 -1
  24. package/dist/core/client/index.d.ts +0 -3
  25. package/dist/core/client/index.js +0 -5
  26. package/dist/core/client/index.js.map +0 -1
  27. package/dist/core/client/mcp-client.d.ts +0 -233
  28. package/dist/core/client/mcp-client.js +0 -99
  29. package/dist/core/client/mcp-client.js.map +0 -1
  30. package/dist/core/client/mcp.d.ts +0 -3
  31. package/dist/core/client/mcp.js +0 -29
  32. package/dist/core/client/mcp.js.map +0 -1
  33. package/dist/core/client/proxy.d.ts +0 -10
  34. package/dist/core/client/proxy.js +0 -104
  35. package/dist/core/client/proxy.js.map +0 -1
  36. package/dist/core/connection.d.ts +0 -30
  37. package/dist/core/connection.js +0 -1
  38. package/dist/core/connection.js.map +0 -1
  39. package/dist/core/subset.d.ts +0 -17
  40. package/dist/core/subset.js +0 -319
  41. package/dist/core/subset.js.map +0 -1
  42. package/dist/index-D0aUdNls.d.ts +0 -153
  43. package/dist/index.d.ts +0 -3
  44. package/dist/index.js +0 -7
  45. package/dist/index.js.map +0 -1
  46. package/dist/well-known/agent.d.ts +0 -903
  47. package/dist/well-known/agent.js +0 -27
  48. package/dist/well-known/agent.js.map +0 -1
  49. package/dist/well-known/collections.d.ts +0 -537
  50. package/dist/well-known/collections.js +0 -134
  51. package/dist/well-known/collections.js.map +0 -1
  52. package/dist/well-known/language-model.d.ts +0 -2836
  53. package/dist/well-known/language-model.js +0 -209
  54. package/dist/well-known/language-model.js.map +0 -1
@@ -1,27 +0,0 @@
1
- import { z } from "zod/v3";
2
- import {
3
- BaseCollectionEntitySchema,
4
- createCollectionBindings
5
- } from "./collections";
6
- const AgentSchema = BaseCollectionEntitySchema.extend({
7
- // Agent-specific fields
8
- description: z.string().describe("Brief description of the agent's purpose"),
9
- instructions: z.string().describe("System instructions that define the agent's behavior"),
10
- tool_set: z.record(z.string(), z.array(z.string())).describe(
11
- "Map of connection IDs to arrays of allowed tool names for this agent"
12
- ),
13
- avatar: z.string().url().describe("URL to the agent's avatar image")
14
- });
15
- const AGENTS_COLLECTION_BINDING = createCollectionBindings(
16
- "agent",
17
- AgentSchema
18
- );
19
- const AGENTS_BINDING = [
20
- ...AGENTS_COLLECTION_BINDING
21
- ];
22
- export {
23
- AGENTS_BINDING,
24
- AGENTS_COLLECTION_BINDING,
25
- AgentSchema
26
- };
27
- //# sourceMappingURL=agent.js.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../../src/well-known/agent.ts"],"sourcesContent":["/**\n * Agents Well-Known Binding\n *\n * Defines the interface for AI agent providers.\n * Any MCP that implements this binding can provide configurable AI agents\n * with custom instructions and tool access controls.\n *\n * This binding uses collection bindings for LIST and GET operations (read-only).\n */\n\nimport { z } from \"zod/v3\";\nimport type { Binder } from \"../core/binder\";\nimport {\n BaseCollectionEntitySchema,\n createCollectionBindings,\n} from \"./collections\";\n\n/**\n * Agent entity schema for AI agents\n * Extends BaseCollectionEntitySchema with agent-specific fields\n * Base schema already includes: id, title, created_at, updated_at, created_by, updated_by\n */\nexport const AgentSchema = BaseCollectionEntitySchema.extend({\n // Agent-specific fields\n description: z.string().describe(\"Brief description of the agent's purpose\"),\n instructions: z\n .string()\n .describe(\"System instructions that define the agent's behavior\"),\n tool_set: z\n .record(z.string(), z.array(z.string()))\n .describe(\n \"Map of connection IDs to arrays of allowed tool names for this agent\",\n ),\n avatar: z.string().url().describe(\"URL to the agent's avatar image\"),\n});\n\n/**\n * AGENT Collection Binding\n *\n * Collection bindings for agents (read-only).\n * Provides LIST and GET operations for AI agents.\n */\nexport const AGENTS_COLLECTION_BINDING = createCollectionBindings(\n \"agent\",\n AgentSchema,\n);\n\n/**\n * AGENTS Binding\n *\n * Defines the interface for AI agent providers.\n * Any MCP that implements this binding can provide configurable AI agents.\n *\n * Required tools:\n * - COLLECTION_AGENT_LIST: List available AI agents with their configurations\n * - COLLECTION_AGENT_GET: Get a single agent by ID (includes instructions and tool_set)\n */\nexport const AGENTS_BINDING = [\n ...AGENTS_COLLECTION_BINDING,\n] as const satisfies Binder;\n"],"mappings":"AAUA,SAAS,SAAS;AAElB;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAOA,MAAM,cAAc,2BAA2B,OAAO;AAAA;AAAA,EAE3D,aAAa,EAAE,OAAO,EAAE,SAAS,0CAA0C;AAAA,EAC3E,cAAc,EACX,OAAO,EACP,SAAS,sDAAsD;AAAA,EAClE,UAAU,EACP,OAAO,EAAE,OAAO,GAAG,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC,EACtC;AAAA,IACC;AAAA,EACF;AAAA,EACF,QAAQ,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,iCAAiC;AACrE,CAAC;AAQM,MAAM,4BAA4B;AAAA,EACvC;AAAA,EACA;AACF;AAYO,MAAM,iBAAiB;AAAA,EAC5B,GAAG;AACL;","names":[]}
@@ -1,537 +0,0 @@
1
- import { z } from 'zod/v3';
2
-
3
- /**
4
- * Collection Bindings
5
- *
6
- * This module provides standardized tool bindings for Collections, representing
7
- * SQL table-like structures with CRUD + Search operations compatible with TanStack DB.
8
- *
9
- * Key Features:
10
- * - Generic collection bindings that work with any entity type
11
- * - Standardized tool naming: `COLLECTION_{COLLECTION}_*`
12
- * - Compatible with TanStack DB query-collection
13
- * - Full TypeScript support with proper type constraints
14
- * - Support for filtering, sorting, and pagination
15
- * - Simple id and title fields for human-readable identification
16
- */
17
- /**
18
- * Base schema for collection entities
19
- * All collection entities must have an id, title, and audit trail fields
20
- */
21
- declare const BaseCollectionEntitySchema: z.ZodObject<{
22
- id: z.ZodString;
23
- title: z.ZodString;
24
- created_at: z.ZodString;
25
- updated_at: z.ZodString;
26
- created_by: z.ZodOptional<z.ZodString>;
27
- updated_by: z.ZodOptional<z.ZodString>;
28
- }, "strip", z.ZodTypeAny, {
29
- id: string;
30
- title: string;
31
- created_at: string;
32
- updated_at: string;
33
- created_by?: string | undefined;
34
- updated_by?: string | undefined;
35
- }, {
36
- id: string;
37
- title: string;
38
- created_at: string;
39
- updated_at: string;
40
- created_by?: string | undefined;
41
- updated_by?: string | undefined;
42
- }>;
43
- /**
44
- * Type helper for BaseCollectionEntitySchema
45
- */
46
- type BaseCollectionEntitySchemaType = typeof BaseCollectionEntitySchema;
47
- /**
48
- * Where expression schema for filtering
49
- * Supports TanStack DB predicate push-down patterns
50
- */
51
- declare const WhereExpressionSchema: z.ZodUnion<[z.ZodObject<{
52
- field: z.ZodArray<z.ZodString, "many">;
53
- operator: z.ZodEnum<["eq", "gt", "gte", "lt", "lte", "in", "like", "contains"]>;
54
- value: z.ZodUnknown;
55
- }, "strip", z.ZodTypeAny, {
56
- field: string[];
57
- operator: "eq" | "gt" | "gte" | "lt" | "lte" | "in" | "like" | "contains";
58
- value?: unknown;
59
- }, {
60
- field: string[];
61
- operator: "eq" | "gt" | "gte" | "lt" | "lte" | "in" | "like" | "contains";
62
- value?: unknown;
63
- }>, z.ZodObject<{
64
- operator: z.ZodEnum<["and", "or", "not"]>;
65
- conditions: z.ZodArray<z.ZodObject<{
66
- field: z.ZodArray<z.ZodString, "many">;
67
- operator: z.ZodEnum<["eq", "gt", "gte", "lt", "lte", "in", "like", "contains"]>;
68
- value: z.ZodUnknown;
69
- }, "strip", z.ZodTypeAny, {
70
- field: string[];
71
- operator: "eq" | "gt" | "gte" | "lt" | "lte" | "in" | "like" | "contains";
72
- value?: unknown;
73
- }, {
74
- field: string[];
75
- operator: "eq" | "gt" | "gte" | "lt" | "lte" | "in" | "like" | "contains";
76
- value?: unknown;
77
- }>, "many">;
78
- }, "strip", z.ZodTypeAny, {
79
- operator: "and" | "or" | "not";
80
- conditions: {
81
- field: string[];
82
- operator: "eq" | "gt" | "gte" | "lt" | "lte" | "in" | "like" | "contains";
83
- value?: unknown;
84
- }[];
85
- }, {
86
- operator: "and" | "or" | "not";
87
- conditions: {
88
- field: string[];
89
- operator: "eq" | "gt" | "gte" | "lt" | "lte" | "in" | "like" | "contains";
90
- value?: unknown;
91
- }[];
92
- }>]>;
93
- /**
94
- * Where expression type for filtering
95
- * Derived from WhereExpressionSchema
96
- */
97
- type WhereExpression = z.infer<typeof WhereExpressionSchema>;
98
- /**
99
- * Order by expression for sorting
100
- */
101
- declare const OrderByExpressionSchema: z.ZodObject<{
102
- field: z.ZodArray<z.ZodString, "many">;
103
- direction: z.ZodEnum<["asc", "desc"]>;
104
- nulls: z.ZodOptional<z.ZodEnum<["first", "last"]>>;
105
- }, "strip", z.ZodTypeAny, {
106
- field: string[];
107
- direction: "asc" | "desc";
108
- nulls?: "first" | "last" | undefined;
109
- }, {
110
- field: string[];
111
- direction: "asc" | "desc";
112
- nulls?: "first" | "last" | undefined;
113
- }>;
114
- /**
115
- * List/Query input schema for collections
116
- * Compatible with TanStack DB LoadSubsetOptions
117
- */
118
- declare const CollectionListInputSchema: z.ZodObject<{
119
- where: z.ZodOptional<z.ZodUnion<[z.ZodObject<{
120
- field: z.ZodArray<z.ZodString, "many">;
121
- operator: z.ZodEnum<["eq", "gt", "gte", "lt", "lte", "in", "like", "contains"]>;
122
- value: z.ZodUnknown;
123
- }, "strip", z.ZodTypeAny, {
124
- field: string[];
125
- operator: "eq" | "gt" | "gte" | "lt" | "lte" | "in" | "like" | "contains";
126
- value?: unknown;
127
- }, {
128
- field: string[];
129
- operator: "eq" | "gt" | "gte" | "lt" | "lte" | "in" | "like" | "contains";
130
- value?: unknown;
131
- }>, z.ZodObject<{
132
- operator: z.ZodEnum<["and", "or", "not"]>;
133
- conditions: z.ZodArray<z.ZodObject<{
134
- field: z.ZodArray<z.ZodString, "many">;
135
- operator: z.ZodEnum<["eq", "gt", "gte", "lt", "lte", "in", "like", "contains"]>;
136
- value: z.ZodUnknown;
137
- }, "strip", z.ZodTypeAny, {
138
- field: string[];
139
- operator: "eq" | "gt" | "gte" | "lt" | "lte" | "in" | "like" | "contains";
140
- value?: unknown;
141
- }, {
142
- field: string[];
143
- operator: "eq" | "gt" | "gte" | "lt" | "lte" | "in" | "like" | "contains";
144
- value?: unknown;
145
- }>, "many">;
146
- }, "strip", z.ZodTypeAny, {
147
- operator: "and" | "or" | "not";
148
- conditions: {
149
- field: string[];
150
- operator: "eq" | "gt" | "gte" | "lt" | "lte" | "in" | "like" | "contains";
151
- value?: unknown;
152
- }[];
153
- }, {
154
- operator: "and" | "or" | "not";
155
- conditions: {
156
- field: string[];
157
- operator: "eq" | "gt" | "gte" | "lt" | "lte" | "in" | "like" | "contains";
158
- value?: unknown;
159
- }[];
160
- }>]>>;
161
- orderBy: z.ZodOptional<z.ZodArray<z.ZodObject<{
162
- field: z.ZodArray<z.ZodString, "many">;
163
- direction: z.ZodEnum<["asc", "desc"]>;
164
- nulls: z.ZodOptional<z.ZodEnum<["first", "last"]>>;
165
- }, "strip", z.ZodTypeAny, {
166
- field: string[];
167
- direction: "asc" | "desc";
168
- nulls?: "first" | "last" | undefined;
169
- }, {
170
- field: string[];
171
- direction: "asc" | "desc";
172
- nulls?: "first" | "last" | undefined;
173
- }>, "many">>;
174
- limit: z.ZodOptional<z.ZodNumber>;
175
- offset: z.ZodOptional<z.ZodNumber>;
176
- }, "strip", z.ZodTypeAny, {
177
- where?: {
178
- field: string[];
179
- operator: "eq" | "gt" | "gte" | "lt" | "lte" | "in" | "like" | "contains";
180
- value?: unknown;
181
- } | {
182
- operator: "and" | "or" | "not";
183
- conditions: {
184
- field: string[];
185
- operator: "eq" | "gt" | "gte" | "lt" | "lte" | "in" | "like" | "contains";
186
- value?: unknown;
187
- }[];
188
- } | undefined;
189
- orderBy?: {
190
- field: string[];
191
- direction: "asc" | "desc";
192
- nulls?: "first" | "last" | undefined;
193
- }[] | undefined;
194
- limit?: number | undefined;
195
- offset?: number | undefined;
196
- }, {
197
- where?: {
198
- field: string[];
199
- operator: "eq" | "gt" | "gte" | "lt" | "lte" | "in" | "like" | "contains";
200
- value?: unknown;
201
- } | {
202
- operator: "and" | "or" | "not";
203
- conditions: {
204
- field: string[];
205
- operator: "eq" | "gt" | "gte" | "lt" | "lte" | "in" | "like" | "contains";
206
- value?: unknown;
207
- }[];
208
- } | undefined;
209
- orderBy?: {
210
- field: string[];
211
- direction: "asc" | "desc";
212
- nulls?: "first" | "last" | undefined;
213
- }[] | undefined;
214
- limit?: number | undefined;
215
- offset?: number | undefined;
216
- }>;
217
- /**
218
- * Factory function to create list output schema for a specific collection type
219
- */
220
- declare function createCollectionListOutputSchema<T extends z.ZodTypeAny>(entitySchema: T): z.ZodObject<{
221
- items: z.ZodArray<T, "many">;
222
- totalCount: z.ZodOptional<z.ZodNumber>;
223
- hasMore: z.ZodOptional<z.ZodBoolean>;
224
- }, "strip", z.ZodTypeAny, {
225
- items: T["_output"][];
226
- totalCount?: number | undefined;
227
- hasMore?: boolean | undefined;
228
- }, {
229
- items: T["_input"][];
230
- totalCount?: number | undefined;
231
- hasMore?: boolean | undefined;
232
- }>;
233
- /**
234
- * Get by ID input schema
235
- */
236
- declare const CollectionGetInputSchema: z.ZodObject<{
237
- id: z.ZodString;
238
- }, "strip", z.ZodTypeAny, {
239
- id: string;
240
- }, {
241
- id: string;
242
- }>;
243
- /**
244
- * Factory function to create get output schema
245
- */
246
- declare function createCollectionGetOutputSchema<T extends z.ZodTypeAny>(entitySchema: T): z.ZodObject<{
247
- item: z.ZodNullable<T>;
248
- }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
249
- item: z.ZodNullable<T>;
250
- }>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<{
251
- item: z.ZodNullable<T>;
252
- }> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>;
253
- /**
254
- * Factory function to create insert input schema
255
- */
256
- declare function createCollectionInsertInputSchema<T extends z.ZodTypeAny>(entitySchema: T): z.ZodObject<{
257
- data: T;
258
- }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
259
- data: T;
260
- }>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<{
261
- data: T;
262
- }> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>;
263
- /**
264
- * Factory function to create insert output schema
265
- */
266
- declare function createCollectionInsertOutputSchema<T extends z.ZodTypeAny>(entitySchema: T): z.ZodObject<{
267
- item: T;
268
- }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
269
- item: T;
270
- }>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<{
271
- item: T;
272
- }> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>;
273
- /**
274
- * Factory function to create update input schema
275
- */
276
- declare function createCollectionUpdateInputSchema<T extends z.ZodTypeAny>(entitySchema: T): z.ZodObject<{
277
- id: z.ZodString;
278
- data: z.ZodObject<{
279
- [x: string]: z.ZodOptional<any>;
280
- }, any, any, {
281
- [x: string]: any;
282
- }, {
283
- [x: string]: any;
284
- }>;
285
- }, "strip", z.ZodTypeAny, {
286
- id: string;
287
- data: {
288
- [x: string]: any;
289
- };
290
- }, {
291
- id: string;
292
- data: {
293
- [x: string]: any;
294
- };
295
- }>;
296
- /**
297
- * Factory function to create update output schema
298
- */
299
- declare function createCollectionUpdateOutputSchema<T extends z.ZodTypeAny>(entitySchema: T): z.ZodObject<{
300
- item: T;
301
- }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
302
- item: T;
303
- }>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<{
304
- item: T;
305
- }> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>;
306
- /**
307
- * Delete input schema
308
- */
309
- declare const CollectionDeleteInputSchema: z.ZodObject<{
310
- id: z.ZodString;
311
- }, "strip", z.ZodTypeAny, {
312
- id: string;
313
- }, {
314
- id: string;
315
- }>;
316
- /**
317
- * Factory function to create delete output schema
318
- */
319
- declare function createCollectionDeleteOutputSchema<T extends z.ZodTypeAny>(entitySchema: T): z.ZodObject<{
320
- item: T;
321
- }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
322
- item: T;
323
- }>, any> extends infer T_1 ? { [k in keyof T_1]: T_1[k]; } : never, z.baseObjectInputType<{
324
- item: T;
325
- }> extends infer T_2 ? { [k_1 in keyof T_2]: T_2[k_1]; } : never>;
326
- /**
327
- * Options for creating collection bindings
328
- */
329
- interface CollectionBindingOptions {
330
- /**
331
- * If true, only LIST and GET operations will be included (read-only collection)
332
- * @default false
333
- */
334
- readOnly?: boolean;
335
- }
336
- /**
337
- * Creates generic collection bindings for a specific entity type
338
- *
339
- * This function generates standardized tool bindings that work with any collection/table
340
- * by accepting a custom entity schema and collection name. The bindings provide:
341
- * - COLLECTION_{NAME}_LIST - Query/search entities with filtering and sorting (required)
342
- * - COLLECTION_{NAME}_GET - Get a single entity by ID (required)
343
- * - COLLECTION_{NAME}_CREATE - Create a new entity (optional, excluded if readOnly=true)
344
- * - COLLECTION_{NAME}_UPDATE - Update an existing entity (optional, excluded if readOnly=true)
345
- * - COLLECTION_{NAME}_DELETE - Delete an entity (optional, excluded if readOnly=true)
346
- *
347
- * @param collectionName - The name of the collection/table (e.g., "users", "products", "orders")
348
- * @param entitySchema - The Zod schema for the entity type (must extend BaseCollectionEntitySchema)
349
- * @param options - Optional configuration for the collection bindings
350
- * @returns Array of tool bindings for Collection CRUD + Query operations
351
- *
352
- * @example
353
- * ```typescript
354
- * const UserSchema = z.object({
355
- * id: z.string(),
356
- * title: z.string(),
357
- * created_at: z.string().datetime(),
358
- * updated_at: z.string().datetime(),
359
- * created_by: z.string().optional(),
360
- * updated_by: z.string().optional(),
361
- * email: z.string().email(),
362
- * });
363
- *
364
- * // Full CRUD collection
365
- * const USER_COLLECTION_BINDING = createCollectionBindings("users", UserSchema);
366
- *
367
- * // Read-only collection (only LIST and GET)
368
- * const READONLY_COLLECTION_BINDING = createCollectionBindings("products", ProductSchema, { readOnly: true });
369
- * ```
370
- */
371
- declare function createCollectionBindings<TEntitySchema extends BaseCollectionEntitySchemaType, TName extends string>(collectionName: TName, entitySchema: TEntitySchema, options?: CollectionBindingOptions): ({
372
- name: `COLLECTION_${Uppercase<TName>}_LIST`;
373
- inputSchema: typeof CollectionListInputSchema;
374
- outputSchema: z.ZodObject<{
375
- items: z.ZodArray<TEntitySchema, "many">;
376
- totalCount: z.ZodOptional<z.ZodNumber>;
377
- hasMore: z.ZodOptional<z.ZodBoolean>;
378
- }, "strip", z.ZodTypeAny, {
379
- items: TEntitySchema["_output"][];
380
- totalCount?: number | undefined;
381
- hasMore?: boolean | undefined;
382
- }, {
383
- items: TEntitySchema["_input"][];
384
- totalCount?: number | undefined;
385
- hasMore?: boolean | undefined;
386
- }>;
387
- } | {
388
- name: `COLLECTION_${Uppercase<TName>}_GET`;
389
- inputSchema: typeof CollectionGetInputSchema;
390
- outputSchema: z.ZodObject<{
391
- item: z.ZodNullable<TEntitySchema>;
392
- }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
393
- item: z.ZodNullable<TEntitySchema>;
394
- }>, any> extends infer T ? { [k in keyof T]: T[k]; } : never, z.baseObjectInputType<{
395
- item: z.ZodNullable<TEntitySchema>;
396
- }> extends infer T_1 ? { [k_1 in keyof T_1]: T_1[k_1]; } : never>;
397
- } | {
398
- name: `COLLECTION_${Uppercase<TName>}_CREATE`;
399
- inputSchema: z.ZodObject<{
400
- data: TEntitySchema;
401
- }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
402
- data: TEntitySchema;
403
- }>, any> extends infer T_2 ? { [k_2 in keyof T_2]: T_2[k_2]; } : never, z.baseObjectInputType<{
404
- data: TEntitySchema;
405
- }> extends infer T_3 ? { [k_3 in keyof T_3]: T_3[k_3]; } : never>;
406
- outputSchema: z.ZodObject<{
407
- item: TEntitySchema;
408
- }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
409
- item: TEntitySchema;
410
- }>, any> extends infer T_4 ? { [k_4 in keyof T_4]: T_4[k_4]; } : never, z.baseObjectInputType<{
411
- item: TEntitySchema;
412
- }> extends infer T_5 ? { [k_5 in keyof T_5]: T_5[k_5]; } : never>;
413
- opt: true;
414
- } | {
415
- name: `COLLECTION_${Uppercase<TName>}_UPDATE`;
416
- inputSchema: z.ZodObject<{
417
- id: z.ZodString;
418
- data: z.ZodObject<{
419
- [x: string]: z.ZodOptional<any>;
420
- }, any, any, {
421
- [x: string]: any;
422
- }, {
423
- [x: string]: any;
424
- }>;
425
- }, "strip", z.ZodTypeAny, {
426
- id: string;
427
- data: {
428
- [x: string]: any;
429
- };
430
- }, {
431
- id: string;
432
- data: {
433
- [x: string]: any;
434
- };
435
- }>;
436
- outputSchema: z.ZodObject<{
437
- item: TEntitySchema;
438
- }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
439
- item: TEntitySchema;
440
- }>, any> extends infer T_6 ? { [k_6 in keyof T_6]: T_6[k_6]; } : never, z.baseObjectInputType<{
441
- item: TEntitySchema;
442
- }> extends infer T_7 ? { [k_7 in keyof T_7]: T_7[k_7]; } : never>;
443
- opt: true;
444
- } | {
445
- name: `COLLECTION_${Uppercase<TName>}_DELETE`;
446
- inputSchema: typeof CollectionDeleteInputSchema;
447
- outputSchema: z.ZodObject<{
448
- item: TEntitySchema;
449
- }, "strip", z.ZodTypeAny, z.objectUtil.addQuestionMarks<z.baseObjectOutputType<{
450
- item: TEntitySchema;
451
- }>, any> extends infer T_8 ? { [k_8 in keyof T_8]: T_8[k_8]; } : never, z.baseObjectInputType<{
452
- item: TEntitySchema;
453
- }> extends infer T_9 ? { [k_9 in keyof T_9]: T_9[k_9]; } : never>;
454
- opt: true;
455
- })[];
456
- type ReadOnlyCollectionBinding<TEntitySchema extends BaseCollectionEntitySchemaType, TUpperName extends Uppercase<string> = Uppercase<string>> = [
457
- {
458
- name: `COLLECTION_${TUpperName}_LIST`;
459
- inputSchema: typeof CollectionListInputSchema;
460
- outputSchema: ReturnType<typeof createCollectionListOutputSchema<TEntitySchema>>;
461
- },
462
- {
463
- name: `COLLECTION_${TUpperName}_GET`;
464
- inputSchema: typeof CollectionGetInputSchema;
465
- outputSchema: ReturnType<typeof createCollectionGetOutputSchema<TEntitySchema>>;
466
- }
467
- ];
468
- /**
469
- * Type helper to extract the collection binding type
470
- */
471
- type CollectionBinding<TEntitySchema extends BaseCollectionEntitySchemaType, TUpperName extends Uppercase<string> = Uppercase<string>> = [
472
- ...ReadOnlyCollectionBinding<TEntitySchema, TUpperName>,
473
- {
474
- name: `COLLECTION_${TUpperName}_CREATE`;
475
- inputSchema: ReturnType<typeof createCollectionInsertInputSchema<TEntitySchema>>;
476
- outputSchema: ReturnType<typeof createCollectionInsertOutputSchema<TEntitySchema>>;
477
- opt: true;
478
- },
479
- {
480
- name: `COLLECTION_${TUpperName}_UPDATE`;
481
- inputSchema: ReturnType<typeof createCollectionUpdateInputSchema<TEntitySchema>>;
482
- outputSchema: ReturnType<typeof createCollectionUpdateOutputSchema<TEntitySchema>>;
483
- opt: true;
484
- },
485
- {
486
- name: `COLLECTION_${TUpperName}_DELETE`;
487
- inputSchema: typeof CollectionDeleteInputSchema;
488
- outputSchema: ReturnType<typeof createCollectionDeleteOutputSchema<TEntitySchema>>;
489
- opt: true;
490
- }
491
- ];
492
- /**
493
- * Type helper to extract tool names from a collection binding
494
- */
495
- type CollectionTools<TEntitySchema extends BaseCollectionEntitySchemaType, TUpperName extends Uppercase<string> = Uppercase<string>> = CollectionBinding<TEntitySchema, TUpperName>[number]["name"];
496
- type CollectionListInput = z.infer<typeof CollectionListInputSchema>;
497
- type CollectionGetInput = z.infer<typeof CollectionGetInputSchema>;
498
- type CollectionDeleteInput = z.infer<typeof CollectionDeleteInputSchema>;
499
- type OrderByExpression = z.infer<typeof OrderByExpressionSchema>;
500
- /**
501
- * Type helper for list output with generic item type
502
- */
503
- type CollectionListOutput<T> = {
504
- items: T[];
505
- totalCount?: number;
506
- hasMore?: boolean;
507
- };
508
- /**
509
- * Type helper for get output with generic item type
510
- */
511
- type CollectionGetOutput<T> = {
512
- item: T | null;
513
- };
514
- /**
515
- * Type helper for insert output with generic item type
516
- */
517
- type CollectionInsertOutput<T> = {
518
- item: T;
519
- };
520
- /**
521
- * Type helper for update output with generic item type
522
- */
523
- type CollectionUpdateOutput<T> = {
524
- item: T;
525
- };
526
- /**
527
- * Type helper for delete output with generic item type
528
- */
529
- type CollectionDeleteOutput<T> = {
530
- item: T;
531
- };
532
- /**
533
- * Base collection entity type - inferred from BaseCollectionEntitySchema
534
- */
535
- type BaseCollectionEntity = z.infer<typeof BaseCollectionEntitySchema>;
536
-
537
- export { type BaseCollectionEntity, BaseCollectionEntitySchema, type BaseCollectionEntitySchemaType, type CollectionBinding, type CollectionBindingOptions, type CollectionDeleteInput, CollectionDeleteInputSchema, type CollectionDeleteOutput, type CollectionGetInput, CollectionGetInputSchema, type CollectionGetOutput, type CollectionInsertOutput, type CollectionListInput, CollectionListInputSchema, type CollectionListOutput, type CollectionTools, type CollectionUpdateOutput, type OrderByExpression, OrderByExpressionSchema, type ReadOnlyCollectionBinding, type WhereExpression, WhereExpressionSchema, createCollectionBindings, createCollectionDeleteOutputSchema, createCollectionGetOutputSchema, createCollectionInsertInputSchema, createCollectionInsertOutputSchema, createCollectionListOutputSchema, createCollectionUpdateInputSchema, createCollectionUpdateOutputSchema };