@decocms/bindings 0.2.0 → 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,125 @@
1
+ import { init_esm_shims } from './chunk-QMQMPK7Q.js';
2
+ import { z } from 'zod';
3
+
4
+ // src/well-known/collections.ts
5
+ init_esm_shims();
6
+ var BaseCollectionEntitySchema = z.object({
7
+ id: z.string().describe("Unique identifier for the entity"),
8
+ title: z.string().describe("Human-readable title for the entity"),
9
+ created_at: z.string().datetime(),
10
+ updated_at: z.string().datetime(),
11
+ created_by: z.string().optional(),
12
+ updated_by: z.string().optional()
13
+ });
14
+ var ComparisonExpressionSchema = z.object({
15
+ field: z.array(z.string()),
16
+ operator: z.enum(["eq", "gt", "gte", "lt", "lte", "in", "like", "contains"]),
17
+ value: z.unknown()
18
+ });
19
+ var WhereExpressionSchema = z.union([
20
+ ComparisonExpressionSchema,
21
+ z.object({
22
+ operator: z.enum(["and", "or", "not"]),
23
+ conditions: z.array(ComparisonExpressionSchema)
24
+ })
25
+ ]);
26
+ var OrderByExpressionSchema = z.object({
27
+ field: z.array(z.string()),
28
+ direction: z.enum(["asc", "desc"]),
29
+ nulls: z.enum(["first", "last"]).optional()
30
+ });
31
+ var CollectionListInputSchema = z.object({
32
+ where: WhereExpressionSchema.optional().describe("Filter expression"),
33
+ orderBy: z.array(OrderByExpressionSchema).optional().describe("Sort expressions"),
34
+ limit: z.number().int().min(1).max(1e3).optional().describe("Maximum number of items to return"),
35
+ offset: z.number().int().min(0).optional().describe("Number of items to skip")
36
+ });
37
+ function createCollectionListOutputSchema(entitySchema) {
38
+ return z.object({
39
+ items: z.array(entitySchema).describe("Array of collection items"),
40
+ totalCount: z.number().int().min(0).optional().describe("Total number of matching items (if available)"),
41
+ hasMore: z.boolean().optional().describe("Whether there are more items available")
42
+ });
43
+ }
44
+ var CollectionGetInputSchema = z.object({
45
+ id: z.string().describe("ID of the entity to retrieve")
46
+ });
47
+ function createCollectionGetOutputSchema(entitySchema) {
48
+ return z.object({
49
+ item: entitySchema.nullable().describe("The retrieved item, or null if not found")
50
+ });
51
+ }
52
+ function createCollectionInsertInputSchema(entitySchema) {
53
+ return z.object({
54
+ data: entitySchema.describe(
55
+ "Data for the new entity (id may be auto-generated)"
56
+ )
57
+ });
58
+ }
59
+ function createCollectionInsertOutputSchema(entitySchema) {
60
+ return z.object({
61
+ item: entitySchema.describe("The created entity with generated id")
62
+ });
63
+ }
64
+ function createCollectionUpdateInputSchema(entitySchema) {
65
+ return z.object({
66
+ id: z.string().describe("ID of the entity to update"),
67
+ data: entitySchema.partial().describe("Partial entity data to update")
68
+ });
69
+ }
70
+ function createCollectionUpdateOutputSchema(entitySchema) {
71
+ return z.object({
72
+ item: entitySchema.describe("The updated entity")
73
+ });
74
+ }
75
+ var CollectionDeleteInputSchema = z.object({
76
+ id: z.string().describe("ID of the entity to delete")
77
+ });
78
+ function createCollectionDeleteOutputSchema(entitySchema) {
79
+ return z.object({
80
+ item: entitySchema.describe("The deleted entity")
81
+ });
82
+ }
83
+ function createCollectionBindings(collectionName, entitySchema, options) {
84
+ const upperName = collectionName.toUpperCase();
85
+ const readOnly = options?.readOnly ?? false;
86
+ const bindings = [
87
+ {
88
+ name: `COLLECTION_${upperName}_LIST`,
89
+ inputSchema: CollectionListInputSchema,
90
+ outputSchema: createCollectionListOutputSchema(entitySchema)
91
+ },
92
+ {
93
+ name: `COLLECTION_${upperName}_GET`,
94
+ inputSchema: CollectionGetInputSchema,
95
+ outputSchema: createCollectionGetOutputSchema(entitySchema)
96
+ }
97
+ ];
98
+ if (!readOnly) {
99
+ bindings.push(
100
+ {
101
+ name: `COLLECTION_${upperName}_CREATE`,
102
+ inputSchema: createCollectionInsertInputSchema(entitySchema),
103
+ outputSchema: createCollectionInsertOutputSchema(entitySchema),
104
+ opt: true
105
+ },
106
+ {
107
+ name: `COLLECTION_${upperName}_UPDATE`,
108
+ inputSchema: createCollectionUpdateInputSchema(entitySchema),
109
+ outputSchema: createCollectionUpdateOutputSchema(entitySchema),
110
+ opt: true
111
+ },
112
+ {
113
+ name: `COLLECTION_${upperName}_DELETE`,
114
+ inputSchema: CollectionDeleteInputSchema,
115
+ outputSchema: createCollectionDeleteOutputSchema(entitySchema),
116
+ opt: true
117
+ }
118
+ );
119
+ }
120
+ return bindings;
121
+ }
122
+
123
+ export { BaseCollectionEntitySchema, CollectionDeleteInputSchema, CollectionGetInputSchema, CollectionListInputSchema, OrderByExpressionSchema, WhereExpressionSchema, createCollectionBindings, createCollectionDeleteOutputSchema, createCollectionGetOutputSchema, createCollectionInsertInputSchema, createCollectionInsertOutputSchema, createCollectionListOutputSchema, createCollectionUpdateInputSchema, createCollectionUpdateOutputSchema };
124
+ //# sourceMappingURL=chunk-T2DG7334.js.map
125
+ //# sourceMappingURL=chunk-T2DG7334.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/well-known/collections.ts"],"names":[],"mappings":";;;;AAAA,cAAA,EAAA;AAsBO,IAAM,0BAAA,GAA6B,EAAE,MAAA,CAAO;AAAA,EACjD,EAAA,EAAI,CAAA,CAAE,MAAA,EAAO,CAAE,SAAS,kCAAkC,CAAA;AAAA,EAC1D,KAAA,EAAO,CAAA,CAAE,MAAA,EAAO,CAAE,SAAS,qCAAqC,CAAA;AAAA,EAChE,UAAA,EAAY,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA,EAAS;AAAA,EAChC,UAAA,EAAY,CAAA,CAAE,MAAA,EAAO,CAAE,QAAA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,QACE,IAAA,EAAM,cAAc,SAAS,CAAA,OAAA,CAAA;AAAA,QAC7B,WAAA,EAAa,kCAAkC,YAAY,CAAA;AAAA,QAC3D,YAAA,EAAc,mCAAmC,YAAY,CAAA;AAAA,QAC7D,GAAA,EAAK;AAAA,OACP;AAAA,MACA;AAAA,QACE,IAAA,EAAM,cAAc,SAAS,CAAA,OAAA,CAAA;AAAA,QAC7B,WAAA,EAAa,kCAAkC,YAAY,CAAA;AAAA,QAC3D,YAAA,EAAc,mCAAmC,YAAY,CAAA;AAAA,QAC7D,GAAA,EAAK;AAAA,OACP;AAAA,MACA;AAAA,QACE,IAAA,EAAM,cAAc,SAAS,CAAA,OAAA,CAAA;AAAA,QAC7B,WAAA,EAAa,2BAAA;AAAA,QACb,YAAA,EAAc,mCAAmC,YAAY,CAAA;AAAA,QAC7D,GAAA,EAAK;AAAA;AACP,KACF;AAAA,EACF;AAEA,EAAA,OAAO,QAAA;AACT","file":"chunk-T2DG7334.js","sourcesContent":["import { z } from \"zod\";\nimport type { ToolBinder } from \"../core/binder\";\n\n/**\n * Collection Bindings\n *\n * This module provides standardized tool bindings for Collections, representing\n * SQL table-like structures with CRUD + Search operations compatible with TanStack DB.\n *\n * Key Features:\n * - Generic collection bindings that work with any entity type\n * - Standardized tool naming: `COLLECTION_{COLLECTION}_*`\n * - Compatible with TanStack DB query-collection\n * - Full TypeScript support with proper type constraints\n * - Support for filtering, sorting, and pagination\n * - Simple id and title fields for human-readable identification\n */\n\n/**\n * Base schema for collection entities\n * All collection entities must have an id, title, and audit trail fields\n */\nexport const BaseCollectionEntitySchema = z.object({\n id: z.string().describe(\"Unique identifier for the entity\"),\n title: z.string().describe(\"Human-readable title for the entity\"),\n created_at: z.string().datetime(),\n updated_at: z.string().datetime(),\n created_by: z.string().optional(),\n updated_by: z.string().optional(),\n});\n\n/**\n * Type helper for BaseCollectionEntitySchema\n */\nexport type BaseCollectionEntitySchemaType = typeof BaseCollectionEntitySchema;\n\n/**\n * Comparison expression schema for filtering\n */\nconst ComparisonExpressionSchema = z.object({\n field: z.array(z.string()),\n operator: z.enum([\"eq\", \"gt\", \"gte\", \"lt\", \"lte\", \"in\", \"like\", \"contains\"]),\n value: z.unknown(),\n});\n\n/**\n * Where expression schema for filtering\n * Supports TanStack DB predicate push-down patterns\n */\nexport const WhereExpressionSchema = z.union([\n ComparisonExpressionSchema,\n z.object({\n operator: z.enum([\"and\", \"or\", \"not\"]),\n conditions: z.array(ComparisonExpressionSchema),\n }),\n]);\n\n/**\n * Where expression type for filtering\n * Derived from WhereExpressionSchema\n */\nexport type WhereExpression = z.infer<typeof WhereExpressionSchema>;\n\n/**\n * Order by expression for sorting\n */\nexport const OrderByExpressionSchema = z.object({\n field: z.array(z.string()),\n direction: z.enum([\"asc\", \"desc\"]),\n nulls: z.enum([\"first\", \"last\"]).optional(),\n});\n\n/**\n * List/Query input schema for collections\n * Compatible with TanStack DB LoadSubsetOptions\n */\nexport const CollectionListInputSchema = z.object({\n where: WhereExpressionSchema.optional().describe(\"Filter expression\"),\n orderBy: z\n .array(OrderByExpressionSchema)\n .optional()\n .describe(\"Sort expressions\"),\n limit: z\n .number()\n .int()\n .min(1)\n .max(1000)\n .optional()\n .describe(\"Maximum number of items to return\"),\n offset: z\n .number()\n .int()\n .min(0)\n .optional()\n .describe(\"Number of items to skip\"),\n});\n\n/**\n * Factory function to create list output schema for a specific collection type\n */\nexport function createCollectionListOutputSchema<T extends z.ZodTypeAny>(\n entitySchema: T,\n) {\n return z.object({\n items: z.array(entitySchema).describe(\"Array of collection items\"),\n totalCount: z\n .number()\n .int()\n .min(0)\n .optional()\n .describe(\"Total number of matching items (if available)\"),\n hasMore: z\n .boolean()\n .optional()\n .describe(\"Whether there are more items available\"),\n });\n}\n\n/**\n * Get by ID input schema\n */\nexport const CollectionGetInputSchema = z.object({\n id: z.string().describe(\"ID of the entity to retrieve\"),\n});\n\n/**\n * Factory function to create get output schema\n */\nexport function createCollectionGetOutputSchema<T extends z.ZodTypeAny>(\n entitySchema: T,\n) {\n return z.object({\n item: entitySchema\n .nullable()\n .describe(\"The retrieved item, or null if not found\"),\n });\n}\n\n/**\n * Factory function to create insert input schema\n */\nexport function createCollectionInsertInputSchema<T extends z.ZodTypeAny>(\n entitySchema: T,\n) {\n // Remove id field since it may be auto-generated by the server\n return z.object({\n data: entitySchema.describe(\n \"Data for the new entity (id may be auto-generated)\",\n ),\n });\n}\n\n/**\n * Factory function to create insert output schema\n */\nexport function createCollectionInsertOutputSchema<T extends z.ZodTypeAny>(\n entitySchema: T,\n) {\n return z.object({\n item: entitySchema.describe(\"The created entity with generated id\"),\n });\n}\n\n/**\n * Factory function to create update input schema\n */\nexport function createCollectionUpdateInputSchema<T extends z.ZodTypeAny>(\n entitySchema: T,\n) {\n return z.object({\n id: z.string().describe(\"ID of the entity to update\"),\n data: (entitySchema as unknown as z.AnyZodObject)\n .partial()\n .describe(\"Partial entity data to update\"),\n });\n}\n\n/**\n * Factory function to create update output schema\n */\nexport function createCollectionUpdateOutputSchema<T extends z.ZodTypeAny>(\n entitySchema: T,\n) {\n return z.object({\n item: entitySchema.describe(\"The updated entity\"),\n });\n}\n\n/**\n * Delete input schema\n */\nexport const CollectionDeleteInputSchema = z.object({\n id: z.string().describe(\"ID of the entity to delete\"),\n});\n\n/**\n * Factory function to create delete output schema\n */\nexport function createCollectionDeleteOutputSchema<T extends z.ZodTypeAny>(\n entitySchema: T,\n) {\n return z.object({\n item: entitySchema.describe(\"The deleted entity\"),\n });\n}\n\n/**\n * Options for creating collection bindings\n */\nexport interface CollectionBindingOptions {\n /**\n * If true, only LIST and GET operations will be included (read-only collection)\n * @default false\n */\n readOnly?: boolean;\n}\n\n/**\n * Creates generic collection bindings for a specific entity type\n *\n * This function generates standardized tool bindings that work with any collection/table\n * by accepting a custom entity schema and collection name. The bindings provide:\n * - COLLECTION_{NAME}_LIST - Query/search entities with filtering and sorting (required)\n * - COLLECTION_{NAME}_GET - Get a single entity by ID (required)\n * - COLLECTION_{NAME}_CREATE - Create a new entity (optional, excluded if readOnly=true)\n * - COLLECTION_{NAME}_UPDATE - Update an existing entity (optional, excluded if readOnly=true)\n * - COLLECTION_{NAME}_DELETE - Delete an entity (optional, excluded if readOnly=true)\n *\n * @param collectionName - The name of the collection/table (e.g., \"users\", \"products\", \"orders\")\n * @param entitySchema - The Zod schema for the entity type (must extend BaseCollectionEntitySchema)\n * @param options - Optional configuration for the collection bindings\n * @returns Array of tool bindings for Collection CRUD + Query operations\n *\n * @example\n * ```typescript\n * const UserSchema = z.object({\n * id: z.string(),\n * title: z.string(),\n * created_at: z.string().datetime(),\n * updated_at: z.string().datetime(),\n * created_by: z.string().optional(),\n * updated_by: z.string().optional(),\n * email: z.string().email(),\n * });\n *\n * // Full CRUD collection\n * const USER_COLLECTION_BINDING = createCollectionBindings(\"users\", UserSchema);\n *\n * // Read-only collection (only LIST and GET)\n * const READONLY_COLLECTION_BINDING = createCollectionBindings(\"products\", ProductSchema, { readOnly: true });\n * ```\n */\nexport function createCollectionBindings<\n TEntitySchema extends BaseCollectionEntitySchemaType,\n TName extends string,\n>(\n collectionName: TName,\n entitySchema: TEntitySchema,\n options?: CollectionBindingOptions,\n) {\n const upperName = collectionName.toUpperCase() as Uppercase<TName>;\n const readOnly = options?.readOnly ?? false;\n\n const bindings: CollectionBinding<TEntitySchema, Uppercase<TName>>[number][] =\n [\n {\n name: `COLLECTION_${upperName}_LIST` as const,\n inputSchema: CollectionListInputSchema,\n outputSchema: createCollectionListOutputSchema(entitySchema),\n },\n {\n name: `COLLECTION_${upperName}_GET` as const,\n inputSchema: CollectionGetInputSchema,\n outputSchema: createCollectionGetOutputSchema(entitySchema),\n },\n ];\n\n // Only include mutation operations if not read-only\n if (!readOnly) {\n bindings.push(\n {\n name: `COLLECTION_${upperName}_CREATE` as const,\n inputSchema: createCollectionInsertInputSchema(entitySchema),\n outputSchema: createCollectionInsertOutputSchema(entitySchema),\n opt: true,\n },\n {\n name: `COLLECTION_${upperName}_UPDATE` as const,\n inputSchema: createCollectionUpdateInputSchema(entitySchema),\n outputSchema: createCollectionUpdateOutputSchema(entitySchema),\n opt: true,\n },\n {\n name: `COLLECTION_${upperName}_DELETE` as const,\n inputSchema: CollectionDeleteInputSchema,\n outputSchema: createCollectionDeleteOutputSchema(entitySchema),\n opt: true,\n },\n );\n }\n\n return bindings satisfies readonly ToolBinder[];\n}\n\nexport type ReadOnlyCollectionBinding<\n TEntitySchema extends BaseCollectionEntitySchemaType,\n TUpperName extends Uppercase<string> = Uppercase<string>,\n> = [\n {\n name: `COLLECTION_${TUpperName}_LIST`;\n inputSchema: typeof CollectionListInputSchema;\n outputSchema: ReturnType<\n typeof createCollectionListOutputSchema<TEntitySchema>\n >;\n },\n {\n name: `COLLECTION_${TUpperName}_GET`;\n inputSchema: typeof CollectionGetInputSchema;\n outputSchema: ReturnType<\n typeof createCollectionGetOutputSchema<TEntitySchema>\n >;\n },\n];\n/**\n * Type helper to extract the collection binding type\n */\nexport type CollectionBinding<\n TEntitySchema extends BaseCollectionEntitySchemaType,\n TUpperName extends Uppercase<string> = Uppercase<string>,\n> = [\n ...ReadOnlyCollectionBinding<TEntitySchema, TUpperName>,\n {\n name: `COLLECTION_${TUpperName}_CREATE`;\n inputSchema: ReturnType<\n typeof createCollectionInsertInputSchema<TEntitySchema>\n >;\n outputSchema: ReturnType<\n typeof createCollectionInsertOutputSchema<TEntitySchema>\n >;\n opt: true;\n },\n {\n name: `COLLECTION_${TUpperName}_UPDATE`;\n inputSchema: ReturnType<\n typeof createCollectionUpdateInputSchema<TEntitySchema>\n >;\n outputSchema: ReturnType<\n typeof createCollectionUpdateOutputSchema<TEntitySchema>\n >;\n opt: true;\n },\n {\n name: `COLLECTION_${TUpperName}_DELETE`;\n inputSchema: typeof CollectionDeleteInputSchema;\n outputSchema: ReturnType<\n typeof createCollectionDeleteOutputSchema<TEntitySchema>\n >;\n opt: true;\n },\n];\n\n/**\n * Type helper to extract tool names from a collection binding\n */\nexport type CollectionTools<\n TEntitySchema extends BaseCollectionEntitySchemaType,\n TUpperName extends Uppercase<string> = Uppercase<string>,\n> = CollectionBinding<TEntitySchema, TUpperName>[number][\"name\"];\n\n// Export types for TypeScript usage\nexport type CollectionListInput = z.infer<typeof CollectionListInputSchema>;\nexport type CollectionGetInput = z.infer<typeof CollectionGetInputSchema>;\nexport type CollectionDeleteInput = z.infer<typeof CollectionDeleteInputSchema>;\nexport type OrderByExpression = z.infer<typeof OrderByExpressionSchema>;\n\n/**\n * Type helper for list output with generic item type\n */\nexport type CollectionListOutput<T> = {\n items: T[];\n totalCount?: number;\n hasMore?: boolean;\n};\n\n/**\n * Type helper for get output with generic item type\n */\nexport type CollectionGetOutput<T> = {\n item: T | null;\n};\n\n/**\n * Type helper for insert output with generic item type\n */\nexport type CollectionInsertOutput<T> = {\n item: T;\n};\n\n/**\n * Type helper for update output with generic item type\n */\nexport type CollectionUpdateOutput<T> = {\n item: T;\n};\n\n/**\n * Type helper for delete output with generic item type\n */\nexport type CollectionDeleteOutput<T> = {\n item: T;\n};\n\n/**\n * Base collection entity type - inferred from BaseCollectionEntitySchema\n */\nexport type BaseCollectionEntity = z.infer<typeof BaseCollectionEntitySchema>;\n"]}
@@ -0,0 +1,12 @@
1
+ import { JSONRPCMessage } from '@modelcontextprotocol/sdk/types.js';
2
+ import { StreamableHTTPClientTransport, StreamableHTTPClientTransportOptions } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
3
+
4
+ declare class HTTPClientTransport extends StreamableHTTPClientTransport {
5
+ constructor(url: URL, opts?: StreamableHTTPClientTransportOptions);
6
+ send(message: JSONRPCMessage, options?: {
7
+ resumptionToken?: string;
8
+ onresumptiontoken?: (token: string) => void;
9
+ }): Promise<void>;
10
+ }
11
+
12
+ export { HTTPClientTransport };
@@ -0,0 +1,7 @@
1
+ export { HTTPClientTransport } from './chunk-BLCFITZG.js';
2
+ import { init_esm_shims } from './chunk-QMQMPK7Q.js';
3
+
4
+ // src/core/client/index.ts
5
+ init_esm_shims();
6
+ //# sourceMappingURL=client.js.map
7
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/core/client/index.ts"],"names":[],"mappings":";;;;AAAA,cAAA,EAAA","file":"client.js","sourcesContent":["export { HTTPClientTransport } from \"./http-client-transport\";\n"]}