@geekmidas/schema 0.0.1

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 (47) hide show
  1. package/README.md +351 -0
  2. package/dist/conversion-CH_EmflL.d.cts +30 -0
  3. package/dist/conversion-Civd6bIU.mjs +89 -0
  4. package/dist/conversion-Civd6bIU.mjs.map +1 -0
  5. package/dist/conversion-CrSNoSRa.cjs +125 -0
  6. package/dist/conversion-CrSNoSRa.cjs.map +1 -0
  7. package/dist/conversion-DUyZYTWO.d.mts +30 -0
  8. package/dist/conversion.cjs +8 -0
  9. package/dist/conversion.d.cts +2 -0
  10. package/dist/conversion.d.mts +2 -0
  11. package/dist/conversion.mjs +3 -0
  12. package/dist/index.cjs +7 -0
  13. package/dist/index.d.cts +4 -0
  14. package/dist/index.d.mts +4 -0
  15. package/dist/index.mjs +4 -0
  16. package/dist/openapi-DH5yCqKh.mjs +46 -0
  17. package/dist/openapi-DH5yCqKh.mjs.map +1 -0
  18. package/dist/openapi-DR4_PG-e.d.cts +26 -0
  19. package/dist/openapi-DVvLYx-8.cjs +58 -0
  20. package/dist/openapi-DVvLYx-8.cjs.map +1 -0
  21. package/dist/openapi-j01kFjpI.d.mts +26 -0
  22. package/dist/openapi.cjs +4 -0
  23. package/dist/openapi.d.cts +2 -0
  24. package/dist/openapi.d.mts +2 -0
  25. package/dist/openapi.mjs +3 -0
  26. package/dist/parser.cjs +23 -0
  27. package/dist/parser.cjs.map +1 -0
  28. package/dist/parser.d.cts +17 -0
  29. package/dist/parser.d.mts +17 -0
  30. package/dist/parser.mjs +21 -0
  31. package/dist/parser.mjs.map +1 -0
  32. package/dist/types-ByLHeRGs.d.mts +13 -0
  33. package/dist/types-DfcgE7cO.d.cts +13 -0
  34. package/dist/types.cjs +0 -0
  35. package/dist/types.d.cts +2 -0
  36. package/dist/types.d.mts +2 -0
  37. package/dist/types.mjs +0 -0
  38. package/package.json +44 -0
  39. package/src/__tests__/conversion.spec.ts +319 -0
  40. package/src/__tests__/openapi.spec.ts +396 -0
  41. package/src/__tests__/parser.spec.ts +236 -0
  42. package/src/conversion.ts +199 -0
  43. package/src/index.ts +15 -0
  44. package/src/openapi.ts +75 -0
  45. package/src/parser.ts +30 -0
  46. package/src/types.ts +23 -0
  47. package/tsdown.config.ts +5 -0
package/README.md ADDED
@@ -0,0 +1,351 @@
1
+ # @geekmidas/schema
2
+
3
+ Type utilities for working with StandardSchema-compatible validation libraries. Provides type inference helpers that work with any validation library implementing the StandardSchema specification (Zod, Valibot, ArkType, etc.).
4
+
5
+ ## Features
6
+
7
+ - ✅ **Type Inference**: Extract output types from StandardSchema instances
8
+ - ✅ **Composable Schemas**: Support for object-based schema composition
9
+ - ✅ **Zero Runtime Overhead**: Pure TypeScript types with no runtime code
10
+ - ✅ **Universal Compatibility**: Works with any StandardSchema-compatible library
11
+ - ✅ **Type Safety**: Full TypeScript type inference and checking
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ pnpm add @geekmidas/schema
17
+ ```
18
+
19
+ ## What is StandardSchema?
20
+
21
+ [StandardSchema](https://github.com/standard-schema/standard-schema) is a standard for schema validation libraries in TypeScript/JavaScript. It provides a unified interface that allows different validation libraries (Zod, Valibot, ArkType, etc.) to be used interchangeably.
22
+
23
+ This package provides TypeScript utilities to work with StandardSchema-compatible types.
24
+
25
+ ## API Reference
26
+
27
+ ### `InferStandardSchema<T>`
28
+
29
+ Infers the output type from a StandardSchema instance.
30
+
31
+ ```typescript
32
+ type InferStandardSchema<T> = T extends StandardSchemaV1
33
+ ? StandardSchemaV1.InferOutput<T>
34
+ : never;
35
+ ```
36
+
37
+ ### `ComposableStandardSchema`
38
+
39
+ Type for composable schemas - can be a single schema or an object of schemas.
40
+
41
+ ```typescript
42
+ type ComposableStandardSchema =
43
+ | StandardSchemaV1
44
+ | {
45
+ [key: string]: StandardSchemaV1 | undefined;
46
+ };
47
+ ```
48
+
49
+ ### `InferComposableStandardSchema<T>`
50
+
51
+ Infers types from composable schemas, supporting both single schemas and schema objects.
52
+
53
+ ```typescript
54
+ type InferComposableStandardSchema<T> = T extends StandardSchemaV1
55
+ ? StandardSchemaV1.InferOutput<T>
56
+ : T extends { [key: string]: StandardSchemaV1 | undefined }
57
+ ? {
58
+ [K in keyof T as T[K] extends StandardSchemaV1
59
+ ? K
60
+ : never]: T[K] extends StandardSchemaV1
61
+ ? StandardSchemaV1.InferOutput<T[K]>
62
+ : never;
63
+ }
64
+ : {};
65
+ ```
66
+
67
+ ## Usage with Zod
68
+
69
+ ```typescript
70
+ import type { InferStandardSchema } from '@geekmidas/schema';
71
+ import { z } from 'zod';
72
+
73
+ // Define a schema
74
+ const userSchema = z.object({
75
+ id: z.string(),
76
+ email: z.string().email(),
77
+ age: z.number().min(18),
78
+ role: z.enum(['admin', 'user'])
79
+ });
80
+
81
+ // Infer the type
82
+ type User = InferStandardSchema<typeof userSchema>;
83
+ // type User = {
84
+ // id: string;
85
+ // email: string;
86
+ // age: number;
87
+ // role: 'admin' | 'user';
88
+ // }
89
+
90
+ // Use the type
91
+ function processUser(user: User) {
92
+ console.log(user.email);
93
+ }
94
+ ```
95
+
96
+ ## Usage with Valibot
97
+
98
+ ```typescript
99
+ import type { InferStandardSchema } from '@geekmidas/schema';
100
+ import * as v from 'valibot';
101
+
102
+ const productSchema = v.object({
103
+ id: v.string(),
104
+ name: v.string(),
105
+ price: v.number(),
106
+ inStock: v.boolean()
107
+ });
108
+
109
+ type Product = InferStandardSchema<typeof productSchema>;
110
+ // type Product = {
111
+ // id: string;
112
+ // name: string;
113
+ // price: number;
114
+ // inStock: boolean;
115
+ // }
116
+ ```
117
+
118
+ ## Composable Schemas
119
+
120
+ Use `ComposableStandardSchema` and `InferComposableStandardSchema` to work with multiple schemas:
121
+
122
+ ```typescript
123
+ import type {
124
+ ComposableStandardSchema,
125
+ InferComposableStandardSchema
126
+ } from '@geekmidas/schema';
127
+ import { z } from 'zod';
128
+
129
+ // Define multiple schemas
130
+ const schemas = {
131
+ user: z.object({
132
+ id: z.string(),
133
+ email: z.string().email()
134
+ }),
135
+ post: z.object({
136
+ id: z.string(),
137
+ title: z.string(),
138
+ authorId: z.string()
139
+ }),
140
+ comment: z.object({
141
+ id: z.string(),
142
+ content: z.string(),
143
+ postId: z.string()
144
+ })
145
+ } satisfies Record<string, ComposableStandardSchema>;
146
+
147
+ // Infer types from all schemas
148
+ type Schemas = InferComposableStandardSchema<typeof schemas>;
149
+ // type Schemas = {
150
+ // user: { id: string; email: string };
151
+ // post: { id: string; title: string; authorId: string };
152
+ // comment: { id: string; content: string; postId: string };
153
+ // }
154
+
155
+ // Use individual types
156
+ type User = Schemas['user'];
157
+ type Post = Schemas['post'];
158
+ type Comment = Schemas['comment'];
159
+ ```
160
+
161
+ ## Generic Functions
162
+
163
+ Create generic functions that work with any StandardSchema:
164
+
165
+ ```typescript
166
+ import type { InferStandardSchema } from '@geekmidas/schema';
167
+ import type { StandardSchemaV1 } from '@standard-schema/spec';
168
+
169
+ function validateData<T extends StandardSchemaV1>(
170
+ schema: T,
171
+ data: unknown
172
+ ): InferStandardSchema<T> | null {
173
+ const result = schema['~standard'].validate(data);
174
+
175
+ if (result.issues) {
176
+ console.error('Validation failed:', result.issues);
177
+ return null;
178
+ }
179
+
180
+ return result.value as InferStandardSchema<T>;
181
+ }
182
+
183
+ // Usage with any schema
184
+ const userSchema = z.object({ name: z.string() });
185
+ const validatedUser = validateData(userSchema, { name: 'John' });
186
+ // validatedUser is typed as { name: string } | null
187
+ ```
188
+
189
+ ## Factory Pattern
190
+
191
+ Use composable schemas in factory patterns:
192
+
193
+ ```typescript
194
+ import type {
195
+ ComposableStandardSchema,
196
+ InferComposableStandardSchema
197
+ } from '@geekmidas/schema';
198
+
199
+ class SchemaFactory<T extends Record<string, ComposableStandardSchema>> {
200
+ constructor(private schemas: T) {}
201
+
202
+ validate<K extends keyof T>(
203
+ key: K,
204
+ data: unknown
205
+ ): InferComposableStandardSchema<T>[K] | null {
206
+ const schema = this.schemas[key];
207
+ if (!schema) return null;
208
+
209
+ const result = schema['~standard'].validate(data);
210
+ return result.issues ? null : result.value;
211
+ }
212
+
213
+ getSchema<K extends keyof T>(key: K): T[K] {
214
+ return this.schemas[key];
215
+ }
216
+ }
217
+
218
+ // Usage
219
+ const schemas = {
220
+ user: z.object({ name: z.string() }),
221
+ product: z.object({ sku: z.string(), price: z.number() })
222
+ };
223
+
224
+ const factory = new SchemaFactory(schemas);
225
+ const user = factory.validate('user', { name: 'John' });
226
+ // user is typed as { name: string } | null
227
+ ```
228
+
229
+ ## API Endpoint Validation
230
+
231
+ Common pattern for API endpoint validation:
232
+
233
+ ```typescript
234
+ import type { InferStandardSchema } from '@geekmidas/schema';
235
+ import { z } from 'zod';
236
+
237
+ const createUserEndpoint = {
238
+ body: z.object({
239
+ name: z.string().min(1),
240
+ email: z.string().email(),
241
+ age: z.number().int().min(18)
242
+ }),
243
+ response: z.object({
244
+ id: z.string(),
245
+ name: z.string(),
246
+ email: z.string()
247
+ })
248
+ };
249
+
250
+ type CreateUserBody = InferStandardSchema<typeof createUserEndpoint.body>;
251
+ type CreateUserResponse = InferStandardSchema<typeof createUserEndpoint.response>;
252
+
253
+ async function createUser(
254
+ data: CreateUserBody
255
+ ): Promise<CreateUserResponse> {
256
+ // Implementation with fully typed request and response
257
+ return {
258
+ id: '123',
259
+ name: data.name,
260
+ email: data.email
261
+ };
262
+ }
263
+ ```
264
+
265
+ ## Type Guards
266
+
267
+ Create type guards using schema inference:
268
+
269
+ ```typescript
270
+ import type { InferStandardSchema } from '@geekmidas/schema';
271
+ import { z } from 'zod';
272
+
273
+ const userSchema = z.object({
274
+ id: z.string(),
275
+ email: z.string().email()
276
+ });
277
+
278
+ type User = InferStandardSchema<typeof userSchema>;
279
+
280
+ function isUser(value: unknown): value is User {
281
+ const result = userSchema.safeParse(value);
282
+ return result.success;
283
+ }
284
+
285
+ // Usage
286
+ const data: unknown = { id: '123', email: 'user@example.com' };
287
+
288
+ if (isUser(data)) {
289
+ // data is now typed as User
290
+ console.log(data.email);
291
+ }
292
+ ```
293
+
294
+ ## Integration with @geekmidas/constructs
295
+
296
+ This package is used internally by `@geekmidas/constructs` for type-safe endpoint validation:
297
+
298
+ ```typescript
299
+ import { e } from '@geekmidas/constructs/endpoints';
300
+ import { z } from 'zod';
301
+
302
+ // The constructs package uses InferStandardSchema internally
303
+ const endpoint = e
304
+ .post('/users')
305
+ .body(z.object({ name: z.string() }))
306
+ .output(z.object({ id: z.string() }))
307
+ .handle(async ({ body }) => {
308
+ // body is automatically typed as { name: string }
309
+ return { id: '123' };
310
+ });
311
+ ```
312
+
313
+ ## Why Use This Package?
314
+
315
+ 1. **Type Safety**: Ensures your types match your runtime validation schemas
316
+ 2. **DRY Principle**: Define schemas once, derive types automatically
317
+ 3. **Refactoring Safety**: Changing schemas automatically updates types
318
+ 4. **Universal**: Works with any StandardSchema-compatible library
319
+ 5. **Zero Cost**: Pure TypeScript types with no runtime overhead
320
+
321
+ ## Supported Validation Libraries
322
+
323
+ Any library implementing the StandardSchema specification, including:
324
+
325
+ - [Zod](https://github.com/colinhacks/zod)
326
+ - [Valibot](https://github.com/fabian-hiller/valibot)
327
+ - [ArkType](https://github.com/arktypeio/arktype)
328
+ - And any future StandardSchema-compatible library
329
+
330
+ ## TypeScript Configuration
331
+
332
+ Requires TypeScript 5.0 or higher with strict mode enabled:
333
+
334
+ ```json
335
+ {
336
+ "compilerOptions": {
337
+ "strict": true,
338
+ "strictNullChecks": true
339
+ }
340
+ }
341
+ ```
342
+
343
+ ## Related Packages
344
+
345
+ - [@geekmidas/constructs](../constructs) - Uses this package for endpoint validation
346
+ - [@geekmidas/envkit](../envkit) - Environment configuration with schema validation
347
+ - [@standard-schema/spec](https://github.com/standard-schema/standard-schema) - StandardSchema specification
348
+
349
+ ## License
350
+
351
+ MIT
@@ -0,0 +1,30 @@
1
+ import { StandardSchemaV1 } from "@standard-schema/spec";
2
+
3
+ //#region src/conversion.d.ts
4
+ declare enum SchemaVendor {
5
+ zod = "zod",
6
+ valibot = "valibot",
7
+ }
8
+ type VendorConvertor = (schema: any) => Promise<any>;
9
+ type VendorConvertors = Record<SchemaVendor, VendorConvertor>;
10
+ declare const StandardSchemaJsonSchema: VendorConvertors;
11
+ declare function convertStandardSchemaToJsonSchema(schema?: StandardSchemaV1, componentCollector?: {
12
+ addSchema(id: string, schema: any): void;
13
+ getReference(id: string): {
14
+ $ref: string;
15
+ };
16
+ }): Promise<any>;
17
+ declare function getZodMetadata(schema: StandardSchemaV1): Promise<SchemaMeta | undefined>;
18
+ declare function getSchemaMetadata(schema: StandardSchemaV1): Promise<SchemaMeta | undefined>;
19
+ interface SchemaMeta {
20
+ id?: string;
21
+ }
22
+ declare function convertSchemaWithComponents(schema: StandardSchemaV1 | undefined, componentCollector?: {
23
+ addSchema(id: string, schema: any): void;
24
+ getReference(id: string): {
25
+ $ref: string;
26
+ };
27
+ }): Promise<any>;
28
+ //#endregion
29
+ export { SchemaVendor, StandardSchemaJsonSchema, VendorConvertor, VendorConvertors, convertSchemaWithComponents, convertStandardSchemaToJsonSchema, getSchemaMetadata, getZodMetadata };
30
+ //# sourceMappingURL=conversion-CH_EmflL.d.cts.map
@@ -0,0 +1,89 @@
1
+ //#region src/conversion.ts
2
+ let SchemaVendor = /* @__PURE__ */ function(SchemaVendor$1) {
3
+ SchemaVendor$1["zod"] = "zod";
4
+ SchemaVendor$1["valibot"] = "valibot";
5
+ return SchemaVendor$1;
6
+ }({});
7
+ function isSchemaVendor(vendor) {
8
+ if (!vendor) return false;
9
+ return Object.values(SchemaVendor).includes(vendor);
10
+ }
11
+ const StandardSchemaJsonSchema = {
12
+ zod: async (schema) => {
13
+ try {
14
+ const { z } = await import("zod/v4").catch(() => ({ z: {} }));
15
+ if ("toJSONSchema" in z && typeof z.toJSONSchema === "function") return z.toJSONSchema(schema);
16
+ const { zodToJsonSchema } = await import("zod-to-json-schema");
17
+ const result = zodToJsonSchema(schema, { removeAdditionalStrategy: "strict" });
18
+ return result;
19
+ } catch (error) {
20
+ console.warn("zod-to-json-schema not available, using basic conversion", error);
21
+ return { type: "object" };
22
+ }
23
+ },
24
+ valibot: async (schema) => {
25
+ const { toJsonSchema } = await import("@valibot/to-json-schema");
26
+ return toJsonSchema(schema);
27
+ }
28
+ };
29
+ function extractAndConvertDefs(jsonSchema, componentCollector) {
30
+ if (!jsonSchema || typeof jsonSchema !== "object") return jsonSchema;
31
+ const processSchema = (schema) => {
32
+ if (!schema || typeof schema !== "object") return schema;
33
+ if (schema.$ref && typeof schema.$ref === "string") {
34
+ if (schema.$ref.startsWith("#/$defs/")) {
35
+ const refName = schema.$ref.replace("#/$defs/", "");
36
+ return componentCollector ? componentCollector.getReference(refName) : schema;
37
+ }
38
+ return schema;
39
+ }
40
+ if (Array.isArray(schema)) return schema.map(processSchema);
41
+ const processed = {};
42
+ for (const [key, value] of Object.entries(schema)) {
43
+ if (key === "$defs") continue;
44
+ processed[key] = processSchema(value);
45
+ }
46
+ return processed;
47
+ };
48
+ if (jsonSchema.$defs && componentCollector) for (const [defName, defSchema] of Object.entries(jsonSchema.$defs)) {
49
+ const processedDefSchema = processSchema(defSchema);
50
+ componentCollector.addSchema(defName, processedDefSchema);
51
+ }
52
+ const { $defs,...schemaWithoutDefs } = jsonSchema;
53
+ return processSchema(schemaWithoutDefs);
54
+ }
55
+ async function convertStandardSchemaToJsonSchema(schema, componentCollector) {
56
+ if (!schema) return void 0;
57
+ const vendor = schema["~standard"]?.vendor;
58
+ if (!isSchemaVendor(vendor)) throw new Error(`Unsupported or missing vendor "${vendor}" for Standard Schema. Supported vendors are: ${Object.keys(StandardSchemaJsonSchema).join(", ")}`);
59
+ const toJSONSchema = StandardSchemaJsonSchema[vendor];
60
+ const jsonSchema = await toJSONSchema(schema);
61
+ return extractAndConvertDefs(jsonSchema, componentCollector);
62
+ }
63
+ async function getZodMetadata(schema) {
64
+ const { ZodObject } = await import("zod/v4");
65
+ if (schema instanceof ZodObject) return schema.meta();
66
+ return void 0;
67
+ }
68
+ async function getSchemaMetadata(schema) {
69
+ const vendor = schema["~standard"]?.vendor;
70
+ if (vendor === "zod") return getZodMetadata(schema);
71
+ return void 0;
72
+ }
73
+ async function convertSchemaWithComponents(schema, componentCollector) {
74
+ if (!schema) return void 0;
75
+ const jsonSchema = await convertStandardSchemaToJsonSchema(schema, componentCollector);
76
+ if (!componentCollector) return jsonSchema;
77
+ const metadata = await getSchemaMetadata(schema);
78
+ const schemaId = metadata?.id || jsonSchema?.id;
79
+ if (schemaId) {
80
+ const { id,...schemaWithoutId } = jsonSchema;
81
+ componentCollector.addSchema(schemaId, schemaWithoutId);
82
+ return componentCollector.getReference(schemaId);
83
+ }
84
+ return jsonSchema;
85
+ }
86
+
87
+ //#endregion
88
+ export { SchemaVendor, StandardSchemaJsonSchema, convertSchemaWithComponents, convertStandardSchemaToJsonSchema, getSchemaMetadata, getZodMetadata };
89
+ //# sourceMappingURL=conversion-Civd6bIU.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversion-Civd6bIU.mjs","names":["vendor?: string","StandardSchemaJsonSchema: VendorConvertors","jsonSchema: any","componentCollector?: {\n addSchema(id: string, schema: any): void;\n getReference(id: string): { $ref: string };\n }","schema: any","processed: any","schema?: StandardSchemaV1","schema: StandardSchemaV1","schema: StandardSchemaV1 | undefined"],"sources":["../src/conversion.ts"],"sourcesContent":["import type { StandardSchemaV1 } from '@standard-schema/spec';\n\nexport enum SchemaVendor {\n zod = 'zod',\n valibot = 'valibot',\n}\n\nexport type VendorConvertor = (schema: any) => Promise<any>;\nexport type VendorConvertors = Record<SchemaVendor, VendorConvertor>;\n\nfunction isSchemaVendor(vendor?: string): vendor is SchemaVendor {\n if (!vendor) {\n return false;\n }\n\n return Object.values(SchemaVendor).includes(vendor as SchemaVendor);\n}\n\nexport const StandardSchemaJsonSchema: VendorConvertors = {\n zod: async (schema): Promise<any> => {\n try {\n const { z } = await import('zod/v4').catch(() => ({ z: {} }));\n\n if ('toJSONSchema' in z && typeof z.toJSONSchema === 'function') {\n return z.toJSONSchema(schema);\n }\n const { zodToJsonSchema } = await import('zod-to-json-schema');\n\n const result = zodToJsonSchema(schema, {\n removeAdditionalStrategy: 'strict',\n });\n\n return result;\n } catch (error) {\n // Fallback to basic conversion if zod-to-json-schema is not available\n console.warn(\n 'zod-to-json-schema not available, using basic conversion',\n error,\n );\n return { type: 'object' };\n }\n },\n valibot: async (schema): Promise<any> => {\n const { toJsonSchema } = await import('@valibot/to-json-schema');\n return toJsonSchema(schema as any);\n },\n};\n\nfunction extractAndConvertDefs(\n jsonSchema: any,\n componentCollector?: {\n addSchema(id: string, schema: any): void;\n getReference(id: string): { $ref: string };\n },\n): any {\n if (!jsonSchema || typeof jsonSchema !== 'object') {\n return jsonSchema;\n }\n\n // Process the schema recursively to update references\n const processSchema = (schema: any): any => {\n if (!schema || typeof schema !== 'object') {\n return schema;\n }\n\n // Handle $ref\n if (schema.$ref && typeof schema.$ref === 'string') {\n // Convert #/$defs/X to #/components/schemas/X\n if (schema.$ref.startsWith('#/$defs/')) {\n const refName = schema.$ref.replace('#/$defs/', '');\n return componentCollector\n ? componentCollector.getReference(refName)\n : schema;\n }\n return schema;\n }\n\n // Handle arrays\n if (Array.isArray(schema)) {\n return schema.map(processSchema);\n }\n\n // Process all properties recursively\n const processed: any = {};\n for (const [key, value] of Object.entries(schema)) {\n if (key === '$defs') {\n // Skip $defs as they've been extracted\n continue;\n }\n processed[key] = processSchema(value);\n }\n return processed;\n };\n\n // Extract $defs if present\n if (jsonSchema.$defs && componentCollector) {\n for (const [defName, defSchema] of Object.entries(jsonSchema.$defs)) {\n // Process the definition recursively to handle nested $refs\n const processedDefSchema = processSchema(defSchema);\n // Add each definition to the component collector\n componentCollector.addSchema(defName, processedDefSchema);\n }\n }\n\n // Process the schema and remove $defs\n const { $defs, ...schemaWithoutDefs } = jsonSchema;\n return processSchema(schemaWithoutDefs);\n}\n\nexport async function convertStandardSchemaToJsonSchema(\n schema?: StandardSchemaV1,\n componentCollector?: {\n addSchema(id: string, schema: any): void;\n getReference(id: string): { $ref: string };\n },\n): Promise<any> {\n if (!schema) {\n return undefined;\n }\n\n const vendor = schema['~standard']?.vendor;\n if (!isSchemaVendor(vendor)) {\n throw new Error(\n `Unsupported or missing vendor \"${vendor}\" for Standard Schema. Supported vendors are: ${Object.keys(StandardSchemaJsonSchema).join(', ')}`,\n );\n }\n\n const toJSONSchema = StandardSchemaJsonSchema[vendor];\n const jsonSchema = await toJSONSchema(schema);\n\n // Extract and convert $defs to components\n return extractAndConvertDefs(jsonSchema, componentCollector);\n}\n\nexport async function getZodMetadata(\n schema: StandardSchemaV1,\n): Promise<SchemaMeta | undefined> {\n const { ZodObject } = await import('zod/v4');\n\n if (schema instanceof ZodObject) {\n return schema.meta();\n }\n\n return undefined;\n}\n\nexport async function getSchemaMetadata(\n schema: StandardSchemaV1,\n): Promise<SchemaMeta | undefined> {\n const vendor = schema['~standard']?.vendor;\n\n if (vendor === 'zod') {\n return getZodMetadata(schema);\n }\n\n return undefined;\n}\n\ninterface SchemaMeta {\n id?: string;\n}\n\nexport async function convertSchemaWithComponents(\n schema: StandardSchemaV1 | undefined,\n componentCollector?: {\n addSchema(id: string, schema: any): void;\n getReference(id: string): { $ref: string };\n },\n): Promise<any> {\n if (!schema) {\n return undefined;\n }\n\n // Convert to JSON Schema with component collector to handle $defs\n const jsonSchema = await convertStandardSchemaToJsonSchema(\n schema,\n componentCollector,\n );\n\n if (!componentCollector) {\n return jsonSchema;\n }\n\n // Check if this schema has metadata with an ID\n const metadata = await getSchemaMetadata(schema);\n\n // Also check if the JSON Schema itself has an id field (from Zod's meta)\n const schemaId = metadata?.id || jsonSchema?.id;\n\n if (schemaId) {\n // Remove the id from the schema before adding to components\n const { id, ...schemaWithoutId } = jsonSchema;\n // Add this schema to components and return a reference\n componentCollector.addSchema(schemaId, schemaWithoutId);\n return componentCollector.getReference(schemaId);\n }\n\n return jsonSchema;\n}\n"],"mappings":";AAEA,IAAY,wDAAL;AACL;AACA;;A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= "zod";
5
+ SchemaVendor$1["valibot"] = "valibot";
6
+ return SchemaVendor$1;
7
+ }({});
8
+ function isSchemaVendor(vendor) {
9
+ if (!vendor) return false;
10
+ return Object.values(SchemaVendor).includes(vendor);
11
+ }
12
+ const StandardSchemaJsonSchema = {
13
+ zod: async (schema) => {
14
+ try {
15
+ const { z } = await import("zod/v4").catch(() => ({ z: {} }));
16
+ if ("toJSONSchema" in z && typeof z.toJSONSchema === "function") return z.toJSONSchema(schema);
17
+ const { zodToJsonSchema } = await import("zod-to-json-schema");
18
+ const result = zodToJsonSchema(schema, { removeAdditionalStrategy: "strict" });
19
+ return result;
20
+ } catch (error) {
21
+ console.warn("zod-to-json-schema not available, using basic conversion", error);
22
+ return { type: "object" };
23
+ }
24
+ },
25
+ valibot: async (schema) => {
26
+ const { toJsonSchema } = await import("@valibot/to-json-schema");
27
+ return toJsonSchema(schema);
28
+ }
29
+ };
30
+ function extractAndConvertDefs(jsonSchema, componentCollector) {
31
+ if (!jsonSchema || typeof jsonSchema !== "object") return jsonSchema;
32
+ const processSchema = (schema) => {
33
+ if (!schema || typeof schema !== "object") return schema;
34
+ if (schema.$ref && typeof schema.$ref === "string") {
35
+ if (schema.$ref.startsWith("#/$defs/")) {
36
+ const refName = schema.$ref.replace("#/$defs/", "");
37
+ return componentCollector ? componentCollector.getReference(refName) : schema;
38
+ }
39
+ return schema;
40
+ }
41
+ if (Array.isArray(schema)) return schema.map(processSchema);
42
+ const processed = {};
43
+ for (const [key, value] of Object.entries(schema)) {
44
+ if (key === "$defs") continue;
45
+ processed[key] = processSchema(value);
46
+ }
47
+ return processed;
48
+ };
49
+ if (jsonSchema.$defs && componentCollector) for (const [defName, defSchema] of Object.entries(jsonSchema.$defs)) {
50
+ const processedDefSchema = processSchema(defSchema);
51
+ componentCollector.addSchema(defName, processedDefSchema);
52
+ }
53
+ const { $defs,...schemaWithoutDefs } = jsonSchema;
54
+ return processSchema(schemaWithoutDefs);
55
+ }
56
+ async function convertStandardSchemaToJsonSchema(schema, componentCollector) {
57
+ if (!schema) return void 0;
58
+ const vendor = schema["~standard"]?.vendor;
59
+ if (!isSchemaVendor(vendor)) throw new Error(`Unsupported or missing vendor "${vendor}" for Standard Schema. Supported vendors are: ${Object.keys(StandardSchemaJsonSchema).join(", ")}`);
60
+ const toJSONSchema = StandardSchemaJsonSchema[vendor];
61
+ const jsonSchema = await toJSONSchema(schema);
62
+ return extractAndConvertDefs(jsonSchema, componentCollector);
63
+ }
64
+ async function getZodMetadata(schema) {
65
+ const { ZodObject } = await import("zod/v4");
66
+ if (schema instanceof ZodObject) return schema.meta();
67
+ return void 0;
68
+ }
69
+ async function getSchemaMetadata(schema) {
70
+ const vendor = schema["~standard"]?.vendor;
71
+ if (vendor === "zod") return getZodMetadata(schema);
72
+ return void 0;
73
+ }
74
+ async function convertSchemaWithComponents(schema, componentCollector) {
75
+ if (!schema) return void 0;
76
+ const jsonSchema = await convertStandardSchemaToJsonSchema(schema, componentCollector);
77
+ if (!componentCollector) return jsonSchema;
78
+ const metadata = await getSchemaMetadata(schema);
79
+ const schemaId = metadata?.id || jsonSchema?.id;
80
+ if (schemaId) {
81
+ const { id,...schemaWithoutId } = jsonSchema;
82
+ componentCollector.addSchema(schemaId, schemaWithoutId);
83
+ return componentCollector.getReference(schemaId);
84
+ }
85
+ return jsonSchema;
86
+ }
87
+
88
+ //#endregion
89
+ Object.defineProperty(exports, 'SchemaVendor', {
90
+ enumerable: true,
91
+ get: function () {
92
+ return SchemaVendor;
93
+ }
94
+ });
95
+ Object.defineProperty(exports, 'StandardSchemaJsonSchema', {
96
+ enumerable: true,
97
+ get: function () {
98
+ return StandardSchemaJsonSchema;
99
+ }
100
+ });
101
+ Object.defineProperty(exports, 'convertSchemaWithComponents', {
102
+ enumerable: true,
103
+ get: function () {
104
+ return convertSchemaWithComponents;
105
+ }
106
+ });
107
+ Object.defineProperty(exports, 'convertStandardSchemaToJsonSchema', {
108
+ enumerable: true,
109
+ get: function () {
110
+ return convertStandardSchemaToJsonSchema;
111
+ }
112
+ });
113
+ Object.defineProperty(exports, 'getSchemaMetadata', {
114
+ enumerable: true,
115
+ get: function () {
116
+ return getSchemaMetadata;
117
+ }
118
+ });
119
+ Object.defineProperty(exports, 'getZodMetadata', {
120
+ enumerable: true,
121
+ get: function () {
122
+ return getZodMetadata;
123
+ }
124
+ });
125
+ //# sourceMappingURL=conversion-CrSNoSRa.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversion-CrSNoSRa.cjs","names":["vendor?: string","StandardSchemaJsonSchema: VendorConvertors","jsonSchema: any","componentCollector?: {\n addSchema(id: string, schema: any): void;\n getReference(id: string): { $ref: string };\n }","schema: any","processed: any","schema?: StandardSchemaV1","schema: StandardSchemaV1","schema: StandardSchemaV1 | undefined"],"sources":["../src/conversion.ts"],"sourcesContent":["import type { StandardSchemaV1 } from '@standard-schema/spec';\n\nexport enum SchemaVendor {\n zod = 'zod',\n valibot = 'valibot',\n}\n\nexport type VendorConvertor = (schema: any) => Promise<any>;\nexport type VendorConvertors = Record<SchemaVendor, VendorConvertor>;\n\nfunction isSchemaVendor(vendor?: string): vendor is SchemaVendor {\n if (!vendor) {\n return false;\n }\n\n return Object.values(SchemaVendor).includes(vendor as SchemaVendor);\n}\n\nexport const StandardSchemaJsonSchema: VendorConvertors = {\n zod: async (schema): Promise<any> => {\n try {\n const { z } = await import('zod/v4').catch(() => ({ z: {} }));\n\n if ('toJSONSchema' in z && typeof z.toJSONSchema === 'function') {\n return z.toJSONSchema(schema);\n }\n const { zodToJsonSchema } = await import('zod-to-json-schema');\n\n const result = zodToJsonSchema(schema, {\n removeAdditionalStrategy: 'strict',\n });\n\n return result;\n } catch (error) {\n // Fallback to basic conversion if zod-to-json-schema is not available\n console.warn(\n 'zod-to-json-schema not available, using basic conversion',\n error,\n );\n return { type: 'object' };\n }\n },\n valibot: async (schema): Promise<any> => {\n const { toJsonSchema } = await import('@valibot/to-json-schema');\n return toJsonSchema(schema as any);\n },\n};\n\nfunction extractAndConvertDefs(\n jsonSchema: any,\n componentCollector?: {\n addSchema(id: string, schema: any): void;\n getReference(id: string): { $ref: string };\n },\n): any {\n if (!jsonSchema || typeof jsonSchema !== 'object') {\n return jsonSchema;\n }\n\n // Process the schema recursively to update references\n const processSchema = (schema: any): any => {\n if (!schema || typeof schema !== 'object') {\n return schema;\n }\n\n // Handle $ref\n if (schema.$ref && typeof schema.$ref === 'string') {\n // Convert #/$defs/X to #/components/schemas/X\n if (schema.$ref.startsWith('#/$defs/')) {\n const refName = schema.$ref.replace('#/$defs/', '');\n return componentCollector\n ? componentCollector.getReference(refName)\n : schema;\n }\n return schema;\n }\n\n // Handle arrays\n if (Array.isArray(schema)) {\n return schema.map(processSchema);\n }\n\n // Process all properties recursively\n const processed: any = {};\n for (const [key, value] of Object.entries(schema)) {\n if (key === '$defs') {\n // Skip $defs as they've been extracted\n continue;\n }\n processed[key] = processSchema(value);\n }\n return processed;\n };\n\n // Extract $defs if present\n if (jsonSchema.$defs && componentCollector) {\n for (const [defName, defSchema] of Object.entries(jsonSchema.$defs)) {\n // Process the definition recursively to handle nested $refs\n const processedDefSchema = processSchema(defSchema);\n // Add each definition to the component collector\n componentCollector.addSchema(defName, processedDefSchema);\n }\n }\n\n // Process the schema and remove $defs\n const { $defs, ...schemaWithoutDefs } = jsonSchema;\n return processSchema(schemaWithoutDefs);\n}\n\nexport async function convertStandardSchemaToJsonSchema(\n schema?: StandardSchemaV1,\n componentCollector?: {\n addSchema(id: string, schema: any): void;\n getReference(id: string): { $ref: string };\n },\n): Promise<any> {\n if (!schema) {\n return undefined;\n }\n\n const vendor = schema['~standard']?.vendor;\n if (!isSchemaVendor(vendor)) {\n throw new Error(\n `Unsupported or missing vendor \"${vendor}\" for Standard Schema. Supported vendors are: ${Object.keys(StandardSchemaJsonSchema).join(', ')}`,\n );\n }\n\n const toJSONSchema = StandardSchemaJsonSchema[vendor];\n const jsonSchema = await toJSONSchema(schema);\n\n // Extract and convert $defs to components\n return extractAndConvertDefs(jsonSchema, componentCollector);\n}\n\nexport async function getZodMetadata(\n schema: StandardSchemaV1,\n): Promise<SchemaMeta | undefined> {\n const { ZodObject } = await import('zod/v4');\n\n if (schema instanceof ZodObject) {\n return schema.meta();\n }\n\n return undefined;\n}\n\nexport async function getSchemaMetadata(\n schema: StandardSchemaV1,\n): Promise<SchemaMeta | undefined> {\n const vendor = schema['~standard']?.vendor;\n\n if (vendor === 'zod') {\n return getZodMetadata(schema);\n }\n\n return undefined;\n}\n\ninterface SchemaMeta {\n id?: string;\n}\n\nexport async function convertSchemaWithComponents(\n schema: StandardSchemaV1 | undefined,\n componentCollector?: {\n addSchema(id: string, schema: any): void;\n getReference(id: string): { $ref: string };\n },\n): Promise<any> {\n if (!schema) {\n return undefined;\n }\n\n // Convert to JSON Schema with component collector to handle $defs\n const jsonSchema = await convertStandardSchemaToJsonSchema(\n schema,\n componentCollector,\n );\n\n if (!componentCollector) {\n return jsonSchema;\n }\n\n // Check if this schema has metadata with an ID\n const metadata = await getSchemaMetadata(schema);\n\n // Also check if the JSON Schema itself has an id field (from Zod's meta)\n const schemaId = metadata?.id || jsonSchema?.id;\n\n if (schemaId) {\n // Remove the id from the schema before adding to components\n const { id, ...schemaWithoutId } = jsonSchema;\n // Add this schema to components and return a reference\n componentCollector.addSchema(schemaId, schemaWithoutId);\n return componentCollector.getReference(schemaId);\n }\n\n return jsonSchema;\n}\n"],"mappings":";;AAEA,IAAY,wDAAL;AACL;AACA;;AACD;AAKD,SAAS,eAAeA,QAAyC;AAC/D,MAAK,OACH,QAAO;AAGT,QAAO,OAAO,OAAO,aAAa,CAAC,SAAS,OAAuB;AACpE;AAED,MAAaC,2BAA6C;CACxD,KAAK,OAAO,WAAyB;AACnC,MAAI;GACF,MAAM,EAAE,GAAG,GAAG,MAAM,OAAO,UAAU,MAAM,OAAO,EAAE,GAAG,CAAE,EAAE,GAAE;AAE7D,OAAI,kBAAkB,YAAY,EAAE,iBAAiB,WACnD,QAAO,EAAE,aAAa,O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K,eAAe,OAAO,CACzB,OAAM,IAAI,OACP,iCAAiC,OAAO,gDAAgD,OAAO,KAAK,yBAAyB,CAAC,KAAK,KAAK,CAAC;CAI9I,MAAM,eAAe,yBAAyB;CAC9C,MAAM,aAAa,MAAM,aAAa,OAAO;AAG7C,QAAO,sBAAsB,YAAY,mBAAmB;AAC7D;AAED,eAAsB,eACpBI,QACiC;CACjC,MAAM,EAAE,WAAW,GAAG,MAAM,OAAO;AAEnC,KAAI,kBAAkB,UACpB,QAAO,OAAO,MAAM;AAGtB;AACD;AAED,eAAsB,kBACpBA,QACiC;CACjC,MAAM,SAAS,OAAO,cAAc;AAEpC,KAAI,WAAW,MACb,QAAO,eAAe,OAAO;AAG/B;AACD;AAMD,eAAsB,4BACpBC,QACAL,oBAIc;AACd,MAAK,OACH;CAIF,MAAM,aAAa,MAAM,kCACvB,QACA,mBACD;AAED,MAAK,mBACH,QAAO;CAIT,MAAM,WAAW,MAAM,kBAAkB,OAAO;CAGhD,MAAM,WAAW,UAAU,MAAM,YAAY;AAE7C,KAAI,UAAU;EAEZ,MAAM,EAAE,GAAI,GAAG,iBAAiB,GAAG;AAEnC,qBAAmB,UAAU,UAAU,gBAAgB;AACvD,SAAO,mBAAmB,aAAa,SAAS;CACjD;AAED,QAAO;AACR"}
@@ -0,0 +1,30 @@
1
+ import { StandardSchemaV1 } from "@standard-schema/spec";
2
+
3
+ //#region src/conversion.d.ts
4
+ declare enum SchemaVendor {
5
+ zod = "zod",
6
+ valibot = "valibot",
7
+ }
8
+ type VendorConvertor = (schema: any) => Promise<any>;
9
+ type VendorConvertors = Record<SchemaVendor, VendorConvertor>;
10
+ declare const StandardSchemaJsonSchema: VendorConvertors;
11
+ declare function convertStandardSchemaToJsonSchema(schema?: StandardSchemaV1, componentCollector?: {
12
+ addSchema(id: string, schema: any): void;
13
+ getReference(id: string): {
14
+ $ref: string;
15
+ };
16
+ }): Promise<any>;
17
+ declare function getZodMetadata(schema: StandardSchemaV1): Promise<SchemaMeta | undefined>;
18
+ declare function getSchemaMetadata(schema: StandardSchemaV1): Promise<SchemaMeta | undefined>;
19
+ interface SchemaMeta {
20
+ id?: string;
21
+ }
22
+ declare function convertSchemaWithComponents(schema: StandardSchemaV1 | undefined, componentCollector?: {
23
+ addSchema(id: string, schema: any): void;
24
+ getReference(id: string): {
25
+ $ref: string;
26
+ };
27
+ }): Promise<any>;
28
+ //#endregion
29
+ export { SchemaVendor, StandardSchemaJsonSchema, VendorConvertor, VendorConvertors, convertSchemaWithComponents, convertStandardSchemaToJsonSchema, getSchemaMetadata, getZodMetadata };
30
+ //# sourceMappingURL=conversion-DUyZYTWO.d.mts.map
@@ -0,0 +1,8 @@
1
+ const require_conversion = require('./conversion-CrSNoSRa.cjs');
2
+
3
+ exports.SchemaVendor = require_conversion.SchemaVendor;
4
+ exports.StandardSchemaJsonSchema = require_conversion.StandardSchemaJsonSchema;
5
+ exports.convertSchemaWithComponents = require_conversion.convertSchemaWithComponents;
6
+ exports.convertStandardSchemaToJsonSchema = require_conversion.convertStandardSchemaToJsonSchema;
7
+ exports.getSchemaMetadata = require_conversion.getSchemaMetadata;
8
+ exports.getZodMetadata = require_conversion.getZodMetadata;
@@ -0,0 +1,2 @@
1
+ import { SchemaVendor, StandardSchemaJsonSchema, VendorConvertor, VendorConvertors, convertSchemaWithComponents, convertStandardSchemaToJsonSchema, getSchemaMetadata, getZodMetadata } from "./conversion-CH_EmflL.cjs";
2
+ export { SchemaVendor, StandardSchemaJsonSchema, VendorConvertor, VendorConvertors, convertSchemaWithComponents, convertStandardSchemaToJsonSchema, getSchemaMetadata, getZodMetadata };
@@ -0,0 +1,2 @@
1
+ import { SchemaVendor, StandardSchemaJsonSchema, VendorConvertor, VendorConvertors, convertSchemaWithComponents, convertStandardSchemaToJsonSchema, getSchemaMetadata, getZodMetadata } from "./conversion-DUyZYTWO.mjs";
2
+ export { SchemaVendor, StandardSchemaJsonSchema, VendorConvertor, VendorConvertors, convertSchemaWithComponents, convertStandardSchemaToJsonSchema, getSchemaMetadata, getZodMetadata };