@decocms/bindings 0.2.1 → 0.2.2

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 (51) hide show
  1. package/dist/browser/agents.js +29 -0
  2. package/dist/browser/agents.js.map +1 -0
  3. package/dist/browser/chunk-6QEXJ7XW.js +48564 -0
  4. package/dist/browser/chunk-6QEXJ7XW.js.map +1 -0
  5. package/dist/browser/chunk-WKNVAFKE.js +2176 -0
  6. package/dist/browser/chunk-WKNVAFKE.js.map +1 -0
  7. package/dist/browser/chunk-XWLBKKHZ.js +127 -0
  8. package/dist/browser/chunk-XWLBKKHZ.js.map +1 -0
  9. package/dist/browser/chunk-ZX4ZDU2T.js +58 -0
  10. package/dist/browser/chunk-ZX4ZDU2T.js.map +1 -0
  11. package/dist/browser/client.js +9 -0
  12. package/dist/browser/client.js.map +1 -0
  13. package/dist/browser/collections.js +4 -0
  14. package/dist/browser/collections.js.map +1 -0
  15. package/dist/browser/connection.js +8 -0
  16. package/dist/browser/connection.js.map +1 -0
  17. package/dist/browser/index.js +10 -0
  18. package/dist/browser/index.js.map +1 -0
  19. package/dist/browser/language-model.js +205 -0
  20. package/dist/browser/language-model.js.map +1 -0
  21. package/dist/node/agents.d.ts +903 -0
  22. package/dist/node/agents.js +27 -0
  23. package/dist/node/agents.js.map +1 -0
  24. package/dist/node/chunk-BLCFITZG.js +56 -0
  25. package/dist/node/chunk-BLCFITZG.js.map +1 -0
  26. package/dist/node/chunk-QMQMPK7Q.js +50 -0
  27. package/dist/node/chunk-QMQMPK7Q.js.map +1 -0
  28. package/dist/node/chunk-QP7AQCEP.js +23478 -0
  29. package/dist/node/chunk-QP7AQCEP.js.map +1 -0
  30. package/dist/node/chunk-T2DG7334.js +125 -0
  31. package/dist/node/chunk-T2DG7334.js.map +1 -0
  32. package/dist/node/client.d.ts +12 -0
  33. package/dist/node/client.js +7 -0
  34. package/dist/node/client.js.map +1 -0
  35. package/dist/node/collections.d.ts +537 -0
  36. package/dist/node/collections.js +4 -0
  37. package/dist/node/collections.js.map +1 -0
  38. package/dist/node/connection.d.ts +30 -0
  39. package/dist/node/connection.js +6 -0
  40. package/dist/node/connection.js.map +1 -0
  41. package/dist/node/index.d.ts +94 -0
  42. package/dist/node/index.js +8 -0
  43. package/dist/node/index.js.map +1 -0
  44. package/dist/node/language-model.d.ts +2840 -0
  45. package/dist/node/language-model.js +203 -0
  46. package/dist/node/language-model.js.map +1 -0
  47. package/package.json +45 -16
  48. package/src/core/binder.ts +0 -226
  49. package/src/index.ts +0 -15
  50. package/src/well-known/collections.ts +0 -363
  51. package/src/well-known/models.ts +0 -87
@@ -0,0 +1,537 @@
1
+ import { z } from 'zod';
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 };
@@ -0,0 +1,4 @@
1
+ export { BaseCollectionEntitySchema, CollectionDeleteInputSchema, CollectionGetInputSchema, CollectionListInputSchema, OrderByExpressionSchema, WhereExpressionSchema, createCollectionBindings, createCollectionDeleteOutputSchema, createCollectionGetOutputSchema, createCollectionInsertInputSchema, createCollectionInsertOutputSchema, createCollectionListOutputSchema, createCollectionUpdateInputSchema, createCollectionUpdateOutputSchema } from './chunk-T2DG7334.js';
2
+ import './chunk-QMQMPK7Q.js';
3
+ //# sourceMappingURL=collections.js.map
4
+ //# sourceMappingURL=collections.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"collections.js"}
@@ -0,0 +1,30 @@
1
+ type SSEConnection = {
2
+ type: "SSE";
3
+ url: string;
4
+ token?: string;
5
+ headers?: Record<string, string>;
6
+ };
7
+ type WebsocketConnection = {
8
+ type: "Websocket";
9
+ url: string;
10
+ token?: string;
11
+ };
12
+ type DecoConnection = {
13
+ type: "Deco";
14
+ tenant: string;
15
+ token?: string;
16
+ };
17
+ type InnateConnection = {
18
+ type: "INNATE";
19
+ name: string;
20
+ workspace?: string;
21
+ };
22
+ type HTTPConnection = {
23
+ type: "HTTP";
24
+ url: string;
25
+ headers?: Record<string, string>;
26
+ token?: string;
27
+ };
28
+ type MCPConnection = SSEConnection | WebsocketConnection | InnateConnection | DecoConnection | HTTPConnection;
29
+
30
+ export type { DecoConnection, HTTPConnection, InnateConnection, MCPConnection, SSEConnection, WebsocketConnection };
@@ -0,0 +1,6 @@
1
+ import { init_esm_shims } from './chunk-QMQMPK7Q.js';
2
+
3
+ // src/core/connection.ts
4
+ init_esm_shims();
5
+ //# sourceMappingURL=connection.js.map
6
+ //# sourceMappingURL=connection.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/core/connection.ts"],"names":[],"mappings":";;;AAAA,cAAA,EAAA","file":"connection.js","sourcesContent":["export type SSEConnection = {\n type: \"SSE\";\n url: string;\n token?: string;\n headers?: Record<string, string>;\n};\n\nexport type WebsocketConnection = {\n type: \"Websocket\";\n url: string;\n token?: string;\n};\n\nexport type DecoConnection = {\n type: \"Deco\";\n tenant: string;\n token?: string;\n};\n\nexport type InnateConnection = {\n type: \"INNATE\";\n name: string;\n workspace?: string;\n};\n\nexport type HTTPConnection = {\n type: \"HTTP\";\n url: string;\n headers?: Record<string, string>;\n token?: string;\n};\n\nexport type MCPConnection =\n | SSEConnection\n | WebsocketConnection\n | InnateConnection\n | DecoConnection\n | HTTPConnection;\n"]}
@@ -0,0 +1,94 @@
1
+ import { ZodType } from 'zod';
2
+
3
+ /**
4
+ * Core Binder Types and Utilities
5
+ *
6
+ * This module provides the core types and utilities for the bindings system.
7
+ * Bindings define standardized interfaces that integrations (MCPs) can implement.
8
+ */
9
+
10
+ /**
11
+ * ToolBinder defines a single tool within a binding.
12
+ * It specifies the tool name, input/output schemas, and whether it's optional.
13
+ *
14
+ * @template TName - The tool name (can be a string or RegExp for pattern matching)
15
+ * @template TInput - The input type (inferred from inputSchema)
16
+ * @template TReturn - The return type (inferred from outputSchema)
17
+ */
18
+ interface ToolBinder<TName extends string | RegExp = string, TInput = any, TReturn extends object | null | boolean = object, TStreamable extends boolean = boolean> {
19
+ /** The name of the tool (e.g., "DECO_CHAT_CHANNELS_JOIN") */
20
+ name: TName;
21
+ /** Zod schema for validating tool input */
22
+ inputSchema: ZodType<TInput>;
23
+ /** Optional Zod schema for validating tool output */
24
+ outputSchema?: TStreamable extends true ? never : ZodType<TReturn>;
25
+ /**
26
+ * Whether this tool is streamable.
27
+ */
28
+ streamable?: TStreamable;
29
+ /**
30
+ * Whether this tool is optional in the binding.
31
+ * If true, an implementation doesn't need to provide this tool.
32
+ */
33
+ opt?: true;
34
+ }
35
+ /**
36
+ * Binder represents a collection of tool definitions that form a binding.
37
+ * A binding is like a TypeScript interface - it defines what tools must be implemented.
38
+ *
39
+ * @template TDefinition - Array of ToolBinder definitions
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * const MY_BINDING = [{
44
+ * name: "MY_TOOL" as const,
45
+ * inputSchema: z.object({ id: z.string() }),
46
+ * outputSchema: z.object({ success: z.boolean() }),
47
+ * }] as const satisfies Binder;
48
+ * ```
49
+ */
50
+ type Binder<TDefinition extends readonly ToolBinder[] = readonly ToolBinder[]> = TDefinition;
51
+ /**
52
+ * Tool with schemas for validation
53
+ */
54
+ interface ToolWithSchemas {
55
+ name: string;
56
+ inputSchema?: ZodType<any> | Record<string, unknown>;
57
+ outputSchema?: ZodType<any> | Record<string, unknown>;
58
+ }
59
+ /**
60
+ * Binding checker interface
61
+ */
62
+ interface BindingChecker {
63
+ /**
64
+ * Check if a set of tools implements the binding with full schema validation.
65
+ *
66
+ * Validates:
67
+ * - Tool name matches (exact or regex)
68
+ * - Input schema: Tool accepts what binder requires (no removals from binder to tool)
69
+ * - Output schema: Tool provides what binder expects (no removals from tool to binder)
70
+ *
71
+ * @param tools - Array of tools with names and schemas
72
+ * @returns Promise<boolean> - true if all tools implement the binding correctly
73
+ */
74
+ isImplementedBy: (tools: ToolWithSchemas[]) => Promise<boolean>;
75
+ }
76
+ /**
77
+ * Creates a binding checker with full schema validation using json-schema-diff.
78
+ *
79
+ * This performs strict compatibility checking:
80
+ * - For input schemas: Validates that the tool can accept what the binder requires
81
+ * - For output schemas: Validates that the tool provides what the binder expects
82
+ *
83
+ * @param binderTools - The binding definition to check against
84
+ * @returns A binding checker with an async isImplementedBy method
85
+ *
86
+ * @example
87
+ * ```ts
88
+ * const checker = createBindingChecker(MY_BINDING);
89
+ * const isCompatible = await checker.isImplementedBy(availableTools);
90
+ * ```
91
+ */
92
+ declare function createBindingChecker<TDefinition extends readonly ToolBinder[]>(binderTools: TDefinition): BindingChecker;
93
+
94
+ export { type Binder, type BindingChecker, type ToolBinder, type ToolWithSchemas, createBindingChecker };