schema-truth 0.0.0-stage → 0.8.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 (45) hide show
  1. package/README.md +143 -2
  2. package/dist/ajv-DS9gtNZC.js +105 -0
  3. package/dist/ajv.d.ts +24 -0
  4. package/dist/ajv.js +1 -0
  5. package/dist/arktype-CRZ8vXZ5.js +803 -0
  6. package/dist/arktype.d.ts +10 -0
  7. package/dist/arktype.js +1 -0
  8. package/dist/cli/ajv.d.ts +1 -0
  9. package/dist/cli/ajv.js +15 -0
  10. package/dist/cli/arktype.d.ts +1 -0
  11. package/dist/cli/arktype.js +15 -0
  12. package/dist/cli/effect.d.ts +1 -0
  13. package/dist/cli/effect.js +15 -0
  14. package/dist/cli/typebox.d.ts +1 -0
  15. package/dist/cli/typebox.js +15 -0
  16. package/dist/cli/valibot.d.ts +1 -0
  17. package/dist/cli/valibot.js +15 -0
  18. package/dist/cli/yup.d.ts +1 -0
  19. package/dist/cli/yup.js +15 -0
  20. package/dist/cli/zod.d.ts +1 -0
  21. package/dist/cli/zod.js +15 -0
  22. package/dist/cli-eAY8LqwP.js +124 -0
  23. package/dist/effect-BkWovUi3.js +678 -0
  24. package/dist/effect.d.ts +12 -0
  25. package/dist/effect.js +1 -0
  26. package/dist/helper-CbeedY35.js +1798 -0
  27. package/dist/index-DYzAccyT.d.ts +69 -0
  28. package/dist/index-G7UqNQ4w.d.ts +603 -0
  29. package/dist/index.d.ts +332 -0
  30. package/dist/index.js +10 -0
  31. package/dist/parser-CyJ2auea.js +36 -0
  32. package/dist/typebox-wYeJqy7T.js +563 -0
  33. package/dist/typebox.d.ts +21 -0
  34. package/dist/typebox.js +1 -0
  35. package/dist/utils-Bky98UmP.js +1146 -0
  36. package/dist/valibot-DQUEDYKt.js +705 -0
  37. package/dist/valibot.d.ts +9 -0
  38. package/dist/valibot.js +1 -0
  39. package/dist/yup-BMpa9Co1.js +92 -0
  40. package/dist/yup.d.ts +17 -0
  41. package/dist/yup.js +1 -0
  42. package/dist/zod-Dq9LtqPL.js +816 -0
  43. package/dist/zod.d.ts +9 -0
  44. package/dist/zod.js +1 -0
  45. package/package.json +112 -4
@@ -0,0 +1,332 @@
1
+ import { $ as QUOTE_OR_BACKSLASH_PATTERN, A as DEFINITION_REF_PREFIXES, B as MISSING_DEFINITION_PREFIX, C as ARROW_FUNCTION_PATTERN, D as DEFAULT_ROOT_NAME, E as DATE_PATTERN_SOURCE, F as INPUT_EXTENSIONS, G as NUMBER_WIRE_PATTERN, H as NOT_KEYWORD_UNSUPPORTED_MARKER, I as INTEGER_TEXT_PATTERN, J as OFFSET_PATTERN_SOURCE, K as NUMERIC_KEYWORDS, L as INTEGER_WIRE_PATTERN, M as FORMAT_PATTERNS, N as IDENTIFIER_PATTERN, O as DEFINITION_KEYWORDS, P as IF_THEN_ELSE_UNSUPPORTED_MARKER, Q as PARAM_STYLES, R as ISO_4217_CURRENCY_CODES, S as ARKTYPE_CODE_EXTENSION_KEYS, T as CONTENT_ENCODINGS, U as NUMBER_FORMATS, V as NON_IDENTIFIER_CHARACTER_PATTERN, W as NUMBER_RANGES, X as OUTPUT_EXTENSION, Y as OPENAPI_COMPONENT_SUFFIX_MAP, Z as PARAM_LOCATIONS, _ as XExtMessages, a as JSONSchemaNumberFormat, at as STRING_WIRE_LOCATIONS, b as ALL_CODE_EXTENSION_KEYS, c as JSONSchemaTypes, ct as VALIBOT_CODE_EXTENSION_KEYS, d as Ref, et as ROOT_REFS, f as parseSchemaFile, g as XExtParam, h as ParamStyle, i as JSONSchemaFormat, it as STRING_KEYWORDS, j as EFFECT_CODE_EXTENSION_KEYS, k as DEFINITION_POINTER_PATTERN, l as LocalRef, lt as WIRE_PRIMITIVE_ORDER, m as ParamIn, n as ExternalRef, nt as STRINGBOOL_TRUTHY_PATTERN, o as JSONSchemaStringFormat, ot as UNICODE_ESCAPE_PATTERN, p as XExtTransform, q as OBJECT_PROTOTYPE_PROPERTIES, r as JSONSchema, rt as STRING_FORMATS, s as JSONSchemaType, st as UNSAFE_GENERATED_MARKER, t as ContentEncoding, tt as STRINGBOOL_PATTERN, u as ParseError, ut as ZOD_CODE_EXTENSION_KEYS, v as XExtCode, w as COMPONENT_SCHEMA_REF_PREFIX, x as ANCHOR_REF_PATTERN, y as JSONValue, z as JSON_SCHEMA_TYPES } from "./index-G7UqNQ4w.js";
2
+ import { schemaToAjv } from "./ajv.js";
3
+ import { n as GenerateOptions, t as EmitOptions } from "./index-DYzAccyT.js";
4
+ import { schemaToArktype } from "./arktype.js";
5
+ import { schemaToEffect } from "./effect.js";
6
+ import { TypeboxGenerateOptions, schemaToTypebox } from "./typebox.js";
7
+ import { schemaToValibot } from "./valibot.js";
8
+ import { schemaToYup } from "./yup.js";
9
+ import { schemaToZod } from "./zod.js";
10
+ import * as Effect from "effect/Effect";
11
+ //#region src/format/index.d.ts
12
+ declare const FormatError_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
13
+ readonly _tag: "FormatError";
14
+ } & Readonly<A>;
15
+ /** oxfmt rejected the source it was handed. */
16
+ export declare class FormatError extends FormatError_base<{
17
+ readonly message: string;
18
+ }> {}
19
+ /** Formats generated TypeScript. Failures land in the error channel. */
20
+ export declare function fmt(input: string): Effect.Effect<string, FormatError, never>;
21
+ //#endregion
22
+ //#region src/generator/ajv/ajv.d.ts
23
+ /**
24
+ * One schema node to one Ajv draft-07 schema-object expression.
25
+ *
26
+ * Unsupported keywords, combinators, `$ref` and `x-*` extensions are silent
27
+ * no-ops: the node still becomes a balanced object literal (`{}` when nothing
28
+ * in this slice applies).
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * ajv({ type: 'string', format: 'email' }) // "{type:'string',format:'email'}"
33
+ * ```
34
+ */
35
+ export declare function ajv(schema: JSONSchema): string;
36
+ //#endregion
37
+ //#region src/generator/arktype/arktype.d.ts
38
+ /**
39
+ * Generate ArkType schema code from JSON Schema.
40
+ *
41
+ * @example
42
+ * ```ts
43
+ * arktype({ type: 'string' }, 'MySchema') // '"string"'
44
+ * ```
45
+ */
46
+ export declare function arktype(schema: JSONSchema, rootName?: string, isArktype?: boolean, options?: EmitOptions): string;
47
+ //#endregion
48
+ //#region src/generator/effect/effect.d.ts
49
+ /**
50
+ * Replace every decoding failure of `inner` with a single message.
51
+ *
52
+ * v4 annotates a node with a plain `message` string, but that only covers
53
+ * issues the node itself reports — a missing or mistyped key is reported
54
+ * deeper and keeps its own message. Validating the whole value through one
55
+ * filter and then decoding restores the v3 `transformOrFail` behaviour of
56
+ * collapsing any failure into the given message, and `decodeTo` carries the
57
+ * inner schema's type through.
58
+ */
59
+ export declare function wholeValueMessage(inner: string, message: string): string;
60
+ /**
61
+ * Generate Effect Schema code from a JSON Schema.
62
+ *
63
+ * The `options.readonly` flag is accepted for API symmetry with the other
64
+ * generators but is a no-op for Effect Schema: fields produced by
65
+ * `Schema.Struct({...})` are already `readonly` at the TypeScript type level,
66
+ * and `Schema.Array(...)` returns `ReadonlyArray<T>` by default. Effect Schema
67
+ * has no separate runtime "readonly" wrapper.
68
+ */
69
+ export declare function effect(schema: JSONSchema, rootName?: string, isEffect?: boolean, options?: EmitOptions): string;
70
+ //#endregion
71
+ //#region src/generator/typebox/typebox.d.ts
72
+ /**
73
+ * Generation options threaded through every TypeBox emitter.
74
+ *
75
+ * `cyclicRefs` holds the PascalCase names that `schemaToTypebox` is emitting
76
+ * inside a single `Type.Cyclic($defs, root)` map. References to those names
77
+ * become `Type.Ref('Name')` instead of a bare identifier, because a `const`
78
+ * cannot reference a peer that is declared later in the cycle.
79
+ *
80
+ * `ref` is a host `$ref` name for the **current** node only (the outermost
81
+ * `Type.*` factory). Nested calls drop it so properties and `$defs` members
82
+ * do not inherit the root's name.
83
+ */
84
+ export type TypeboxOptions = {
85
+ readonly openapi?: boolean;
86
+ readonly readonly?: boolean;
87
+ readonly paramIn?: ParamIn;
88
+ readonly cyclicRefs?: ReadonlySet<string>;
89
+ readonly ref?: string;
90
+ };
91
+ /**
92
+ * Options for a nested TypeBox node: the same as `options` but without a
93
+ * host `ref`, so only the outermost factory of a declaration receives it.
94
+ */
95
+ export declare function nestedTypeboxOptions(options?: TypeboxOptions): TypeboxOptions | undefined;
96
+ export declare function typebox(schema: JSONSchema, rootName?: string, isTypebox?: boolean, options?: TypeboxOptions): string;
97
+ //#endregion
98
+ //#region src/generator/valibot/valibot.d.ts
99
+ /**
100
+ * Generate Valibot schema code from JSON Schema.
101
+ *
102
+ * @example
103
+ * ```ts
104
+ * valibot({ type: 'string' }, 'MySchema') // 'v.string()'
105
+ * ```
106
+ */
107
+ export declare function valibot(schema: JSONSchema, rootName?: string, isValibot?: boolean, options?: EmitOptions): string;
108
+ //#endregion
109
+ //#region src/generator/yup/yup.d.ts
110
+ /**
111
+ * Generate a Yup expression from one JSON Schema node.
112
+ *
113
+ * Unsupported keywords, combinators, `$ref` and `x-*` extensions are silent
114
+ * no-ops. Unknown nodes fall back to `yup.mixed()`.
115
+ *
116
+ * @example
117
+ * ```ts
118
+ * yup({ type: 'string' }) // 'yup.string()'
119
+ * ```
120
+ */
121
+ export declare function yup(schema: JSONSchema): string;
122
+ //#endregion
123
+ //#region src/generator/zod/zod.d.ts
124
+ /**
125
+ * Generate Zod schema code from JSON Schema.
126
+ *
127
+ * @example
128
+ * ```ts
129
+ * zod({ type: 'string' }, 'MySchema') // 'z.string()'
130
+ * ```
131
+ */
132
+ export declare function zod(schema: JSONSchema, rootName?: string, isZod?: boolean, options?: EmitOptions): string;
133
+ //#endregion
134
+ //#region src/utils/index.d.ts
135
+ /**
136
+ * Convert string to PascalCase (first character uppercase).
137
+ *
138
+ * When the input contains characters that are not valid in a TypeScript
139
+ * identifier (whitespace, dots, slashes, etc.) the input is routed through
140
+ * {@link toIdentifierPascalCase} so the generated variable name remains
141
+ * parseable. Hyphens and underscores are preserved for back-compat with
142
+ * upstream titles that already generated working code.
143
+ *
144
+ * @example
145
+ * ```ts
146
+ * toPascalCase('animal') // 'Animal'
147
+ * toPascalCase('userProfile') // 'UserProfile'
148
+ * toPascalCase('Self-Referencing Entities') // 'SelfReferencingEntities'
149
+ * ```
150
+ */
151
+ export declare function toPascalCase(name: string): string;
152
+ /**
153
+ * Encode non-ASCII characters as `u<hex codepoint>` so they survive identifier
154
+ * normalization instead of being stripped (which collapses every non-ASCII name
155
+ * to the same `Schema`, producing duplicate declarations). Pure-ASCII input is
156
+ * returned unchanged, so identifier generation stays byte-for-byte identical for
157
+ * the overwhelming majority of specs.
158
+ *
159
+ * @example
160
+ * ```ts
161
+ * encodeNonAscii('User') // 'User'
162
+ * encodeNonAscii('日本語') // 'u65e5u672cu8a9e'
163
+ * ```
164
+ */
165
+ export declare function encodeNonAscii(name: string): string;
166
+ /**
167
+ * Convert string to a valid PascalCase identifier.
168
+ *
169
+ * Splits by non-alphanumeric characters and capitalizes each segment.
170
+ * Handles hyphens, underscores, dots, spaces, leading numbers, and non-ASCII characters.
171
+ *
172
+ * @example
173
+ * ```ts
174
+ * toIdentifierPascalCase('user-name') // 'UserName'
175
+ * toIdentifierPascalCase('hello_world') // 'HelloWorld'
176
+ * toIdentifierPascalCase('123value') // '_123Value'
177
+ * toIdentifierPascalCase('user') // 'User'
178
+ * ```
179
+ */
180
+ export declare function toIdentifierPascalCase(name: string): string;
181
+ export declare function normalizeTypes(t?: string | readonly string[]): string[];
182
+ /** The keywords of a schema node {@link coerceDefault} reads a `default` against. */
183
+ export type DefaultSchema = {
184
+ readonly $ref?: string;
185
+ readonly type?: string | readonly string[];
186
+ readonly nullable?: boolean;
187
+ readonly enum?: readonly unknown[];
188
+ readonly const?: unknown;
189
+ readonly items?: DefaultSchema | readonly DefaultSchema[] | boolean;
190
+ readonly properties?: {
191
+ readonly [key: string]: DefaultSchema;
192
+ };
193
+ readonly required?: readonly string[];
194
+ readonly additionalProperties?: boolean | object;
195
+ readonly patternProperties?: object;
196
+ readonly unevaluatedProperties?: boolean | object;
197
+ readonly allOf?: readonly DefaultSchema[];
198
+ readonly oneOf?: readonly DefaultSchema[];
199
+ readonly anyOf?: readonly DefaultSchema[];
200
+ };
201
+ type DefaultResult = {
202
+ readonly keep: boolean;
203
+ readonly value: unknown;
204
+ };
205
+ /**
206
+ * Reconcile a schema's `default` value with the type the schema actually emits
207
+ * so the generated `.default(...)` stays assignable. The default is kept only
208
+ * when it is a value of the schema, read the way a document usually writes it:
209
+ *
210
+ * - `null` is kept only on a nullable schema (or one whose `enum` lists it).
211
+ * - an `enum` / `const` takes only what it lists.
212
+ * - text that spells a value of the schema's type is read as that value: `'true'`
213
+ * for a boolean, `'7'` for a number or an integer; a number or a boolean for a
214
+ * string is written as text. Any other scalar of the wrong type is dropped
215
+ * (`'null'` for an integer, `'strict'` with the quotes for an enum).
216
+ * - an array keeps its items when every one is a value of `items`.
217
+ * - an object default drops keys the schema does not declare, when the emitted
218
+ * object has no index signature (`additionalProperties` is not `true` or a
219
+ * schema, and there are no `patternProperties`), and needs every `required`
220
+ * key. A loose or record schema keeps every key.
221
+ * - a `$ref`, or an `allOf` the node has no type of its own beside, is read as
222
+ * the definition it names when `definitions` has it; a `oneOf` / `anyOf` keeps
223
+ * the default when a member takes it, whatever `type` sits beside it.
224
+ * - a node with nothing to check against (no `type`, an unknown `$ref`) keeps
225
+ * the default as written.
226
+ *
227
+ * JSON Schema 2020-12 §9.9.4.1 treats `default` as an annotation with no
228
+ * validity guarantee, so an invalid one is dropped rather than reported.
229
+ *
230
+ * @example
231
+ * ```ts
232
+ * coerceDefault({ type: 'boolean' }, 'true') // { keep: true, value: true }
233
+ * coerceDefault({ type: 'number' }, '7') // { keep: true, value: 7 }
234
+ * coerceDefault({ type: 'object' }, null) // { keep: false, value: null }
235
+ * coerceDefault({ type: 'object', nullable: true }, null) // { keep: true, value: null }
236
+ * coerceDefault({ type: 'array' }, 'eval') // { keep: false, value: 'eval' }
237
+ * coerceDefault({ enum: ['a', 'b'] }, "'a'") // { keep: false, value: "'a'" }
238
+ * ```
239
+ */
240
+ export declare function coerceDefault(schema: DefaultSchema, value: unknown, definitions?: {
241
+ readonly [name: string]: DefaultSchema;
242
+ }): DefaultResult;
243
+ /**
244
+ * A message as the expression an emitted check evaluates for each issue: an arrow source
245
+ * is applied to the issue, a sentence becomes a string literal.
246
+ *
247
+ * @example
248
+ * ```ts
249
+ * issueMessageExpression('Invalid') // '"Invalid"'
250
+ * issueMessageExpression('(issue) => issue.path[0]') // '((issue) => issue.path[0])(issue)'
251
+ * ```
252
+ */
253
+ export declare function issueMessageExpression(message: string): string;
254
+ /**
255
+ * Format an error message argument using the Zod v4 unified `error` parameter.
256
+ *
257
+ * @example
258
+ * ```ts
259
+ * zodError('Name must be 3-20 characters') // '{error:"Name must be 3-20 characters"}'
260
+ * zodError('(val) => `Expected ${val}`') // '{error:(val) => `Expected ${val}`}'
261
+ * ```
262
+ */
263
+ export declare function zodError(message: string): string;
264
+ /** `zodError(message)` as a trailing argument, or nothing when there is no message. */
265
+ export declare function zodErrorPart(message: string | undefined): string;
266
+ /**
267
+ * Build the base `{error:...}` argument for a Zod v4 schema constructor when
268
+ * `x-error-message` (type / generic) and/or `x-required-message`
269
+ * (`issue.input === undefined`) are present.
270
+ */
271
+ export declare function zodBaseError(typeMessage: string | undefined, requiredMessage: string | undefined): string;
272
+ /**
273
+ * Format an error message argument for Valibot.
274
+ *
275
+ * @example
276
+ * ```ts
277
+ * valibotError('Must be valid') // '"Must be valid"'
278
+ * valibotError('(issue) => issue.input') // '(issue) => issue.input'
279
+ * ```
280
+ */
281
+ export declare function valibotError(message: string): string;
282
+ /** `valibotError(message)` as a trailing argument, or nothing when there is no message. */
283
+ export declare function valibotErrorPart(message: string | undefined): string;
284
+ /**
285
+ * Format an error message annotation for Effect Schema.
286
+ *
287
+ * Effect Schema v4 types the `message` annotation as a plain `string` (v3 took
288
+ * a `() => string` thunk), so an arrow-expression message has no place to go
289
+ * and is emitted as its source text — see {@link effectMessage}.
290
+ *
291
+ * @example
292
+ * ```ts
293
+ * effectError('Required') // '{message:"Required"}'
294
+ * ```
295
+ */
296
+ export declare function effectError(message: string): string;
297
+ /** `effectError(message)` as a trailing argument, or nothing when there is no message. */
298
+ export declare function effectErrorPart(message: string | undefined): string;
299
+ /**
300
+ * The `message` annotation value for Effect Schema v4: a string literal.
301
+ *
302
+ * @example
303
+ * ```ts
304
+ * effectMessage('Required') // '"Required"'
305
+ * ```
306
+ */
307
+ export declare function effectMessage(message: string): string;
308
+ /**
309
+ * Resolve an OpenAPI $ref string to a variable name with the appropriate suffix
310
+ *
311
+ * @example
312
+ * ```ts
313
+ * resolveOpenAPIRef('#/components/schemas/User') // 'UserSchema'
314
+ * resolveOpenAPIRef('#/components/parameters/UserId') // 'UserIdParamsSchema'
315
+ * resolveOpenAPIRef('#/definitions/Address') // null
316
+ * ```
317
+ */
318
+ export declare function resolveOpenAPIRef($ref: string): string | null;
319
+ /**
320
+ * Encode a property key safely for object literal output.
321
+ * Bare identifiers stay unquoted; everything else is JSON-encoded.
322
+ *
323
+ * @example
324
+ * ```ts
325
+ * makeSafeKey('foo') // 'foo'
326
+ * makeSafeKey('foo-bar') // '"foo-bar"'
327
+ * makeSafeKey('123') // '"123"'
328
+ * ```
329
+ */
330
+ export declare function makeSafeKey(key: string): string;
331
+ //#endregion
332
+ export { ALL_CODE_EXTENSION_KEYS, ANCHOR_REF_PATTERN, ARKTYPE_CODE_EXTENSION_KEYS, ARROW_FUNCTION_PATTERN, COMPONENT_SCHEMA_REF_PREFIX, CONTENT_ENCODINGS, ContentEncoding, DATE_PATTERN_SOURCE, DEFAULT_ROOT_NAME, DEFINITION_KEYWORDS, DEFINITION_POINTER_PATTERN, DEFINITION_REF_PREFIXES, EFFECT_CODE_EXTENSION_KEYS, type EmitOptions, ExternalRef, FORMAT_PATTERNS, type GenerateOptions, IDENTIFIER_PATTERN, IF_THEN_ELSE_UNSUPPORTED_MARKER, INPUT_EXTENSIONS, INTEGER_TEXT_PATTERN, INTEGER_WIRE_PATTERN, ISO_4217_CURRENCY_CODES, JSONSchema, JSONSchemaFormat, JSONSchemaNumberFormat, JSONSchemaStringFormat, JSONSchemaType, JSONSchemaTypes, type JSONValue, JSON_SCHEMA_TYPES, LocalRef, MISSING_DEFINITION_PREFIX, NON_IDENTIFIER_CHARACTER_PATTERN, NOT_KEYWORD_UNSUPPORTED_MARKER, NUMBER_FORMATS, NUMBER_RANGES, NUMBER_WIRE_PATTERN, NUMERIC_KEYWORDS, OBJECT_PROTOTYPE_PROPERTIES, OFFSET_PATTERN_SOURCE, OPENAPI_COMPONENT_SUFFIX_MAP, OUTPUT_EXTENSION, PARAM_LOCATIONS, PARAM_STYLES, type ParamIn, type ParamStyle, ParseError, QUOTE_OR_BACKSLASH_PATTERN, ROOT_REFS, Ref, STRINGBOOL_PATTERN, STRINGBOOL_TRUTHY_PATTERN, STRING_FORMATS, STRING_KEYWORDS, STRING_WIRE_LOCATIONS, TypeboxGenerateOptions, UNICODE_ESCAPE_PATTERN, UNSAFE_GENERATED_MARKER, VALIBOT_CODE_EXTENSION_KEYS, WIRE_PRIMITIVE_ORDER, type XExtCode, type XExtMessages, type XExtParam, type XExtTransform, ZOD_CODE_EXTENSION_KEYS, parseSchemaFile, schemaToAjv, schemaToArktype, schemaToEffect, schemaToTypebox, schemaToValibot, schemaToYup, schemaToZod };
package/dist/index.js ADDED
@@ -0,0 +1,10 @@
1
+ import { $ as DEFINITION_REF_PREFIXES, At as UNSAFE_GENERATED_MARKER, Ct as ROOT_REFS, Dt as STRING_KEYWORDS, Et as STRING_FORMATS, G as ARKTYPE_CODE_EXTENSION_KEYS, J as CONTENT_ENCODINGS, K as ARROW_FUNCTION_PATTERN, Mt as WIRE_PRIMITIVE_ORDER, Nt as ZOD_CODE_EXTENSION_KEYS, Ot as STRING_WIRE_LOCATIONS, Q as DEFINITION_POINTER_PATTERN, St as QUOTE_OR_BACKSLASH_PATTERN, Tt as STRINGBOOL_TRUTHY_PATTERN, U as ALL_CODE_EXTENSION_KEYS, W as ANCHOR_REF_PATTERN, X as DEFAULT_ROOT_NAME, Y as DATE_PATTERN_SOURCE, Z as DEFINITION_KEYWORDS, _t as OFFSET_PATTERN_SOURCE, a as encodeNonAscii, at as INTEGER_TEXT_PATTERN, bt as PARAM_LOCATIONS, c as normalizeTypes, ct as JSON_SCHEMA_TYPES, d as toPascalCase, dt as NOT_KEYWORD_UNSUPPORTED_MARKER, et as EFFECT_CODE_EXTENSION_KEYS, f as valibotError, ft as NUMBER_FORMATS, g as zodErrorPart, gt as OBJECT_PROTOTYPE_PROPERTIES, h as zodError, ht as NUMERIC_KEYWORDS, i as effectMessage, it as INPUT_EXTENSIONS, jt as VALIBOT_CODE_EXTENSION_KEYS, kt as UNICODE_ESCAPE_PATTERN, l as resolveOpenAPIRef, lt as MISSING_DEFINITION_PREFIX, m as zodBaseError, mt as NUMBER_WIRE_PATTERN, n as effectError, nt as IDENTIFIER_PATTERN, o as issueMessageExpression, ot as INTEGER_WIRE_PATTERN, p as valibotErrorPart, pt as NUMBER_RANGES, q as COMPONENT_SCHEMA_REF_PREFIX, r as effectErrorPart, rt as IF_THEN_ELSE_UNSUPPORTED_MARKER, s as makeSafeKey, st as ISO_4217_CURRENCY_CODES, t as coerceDefault, tt as FORMAT_PATTERNS, u as toIdentifierPascalCase, ut as NON_IDENTIFIER_CHARACTER_PATTERN, vt as OPENAPI_COMPONENT_SUFFIX_MAP, wt as STRINGBOOL_PATTERN, xt as PARAM_STYLES, yt as OUTPUT_EXTENSION } from "./utils-Bky98UmP.js";
2
+ import { i as fmt, n as parseSchemaFile, r as FormatError, t as ParseError } from "./parser-CyJ2auea.js";
3
+ import { n as ajv, t as schemaToAjv } from "./ajv-DS9gtNZC.js";
4
+ import { n as arktype, t as schemaToArktype } from "./arktype-CRZ8vXZ5.js";
5
+ import { n as effect, r as wholeValueMessage, t as schemaToEffect } from "./effect-BkWovUi3.js";
6
+ import { n as nestedTypeboxOptions, r as typebox, t as schemaToTypebox } from "./typebox-wYeJqy7T.js";
7
+ import { n as valibot, t as schemaToValibot } from "./valibot-DQUEDYKt.js";
8
+ import { n as yup, t as schemaToYup } from "./yup-BMpa9Co1.js";
9
+ import { n as zod, t as schemaToZod } from "./zod-Dq9LtqPL.js";
10
+ export { ALL_CODE_EXTENSION_KEYS, ANCHOR_REF_PATTERN, ARKTYPE_CODE_EXTENSION_KEYS, ARROW_FUNCTION_PATTERN, COMPONENT_SCHEMA_REF_PREFIX, CONTENT_ENCODINGS, DATE_PATTERN_SOURCE, DEFAULT_ROOT_NAME, DEFINITION_KEYWORDS, DEFINITION_POINTER_PATTERN, DEFINITION_REF_PREFIXES, EFFECT_CODE_EXTENSION_KEYS, FORMAT_PATTERNS, FormatError, IDENTIFIER_PATTERN, IF_THEN_ELSE_UNSUPPORTED_MARKER, INPUT_EXTENSIONS, INTEGER_TEXT_PATTERN, INTEGER_WIRE_PATTERN, ISO_4217_CURRENCY_CODES, JSON_SCHEMA_TYPES, MISSING_DEFINITION_PREFIX, NON_IDENTIFIER_CHARACTER_PATTERN, NOT_KEYWORD_UNSUPPORTED_MARKER, NUMBER_FORMATS, NUMBER_RANGES, NUMBER_WIRE_PATTERN, NUMERIC_KEYWORDS, OBJECT_PROTOTYPE_PROPERTIES, OFFSET_PATTERN_SOURCE, OPENAPI_COMPONENT_SUFFIX_MAP, OUTPUT_EXTENSION, PARAM_LOCATIONS, PARAM_STYLES, ParseError, QUOTE_OR_BACKSLASH_PATTERN, ROOT_REFS, STRINGBOOL_PATTERN, STRINGBOOL_TRUTHY_PATTERN, STRING_FORMATS, STRING_KEYWORDS, STRING_WIRE_LOCATIONS, UNICODE_ESCAPE_PATTERN, UNSAFE_GENERATED_MARKER, VALIBOT_CODE_EXTENSION_KEYS, WIRE_PRIMITIVE_ORDER, ZOD_CODE_EXTENSION_KEYS, ajv, arktype, coerceDefault, effect, effectError, effectErrorPart, effectMessage, encodeNonAscii, fmt, issueMessageExpression, makeSafeKey, nestedTypeboxOptions, normalizeTypes, parseSchemaFile, resolveOpenAPIRef, schemaToAjv, schemaToArktype, schemaToEffect, schemaToTypebox, schemaToValibot, schemaToYup, schemaToZod, toIdentifierPascalCase, toPascalCase, typebox, valibot, valibotError, valibotErrorPart, wholeValueMessage, yup, zod, zodBaseError, zodError, zodErrorPart };
@@ -0,0 +1,36 @@
1
+ import * as Data from "effect/Data";
2
+ import * as Effect from "effect/Effect";
3
+ import { format } from "oxfmt";
4
+ import { bundle } from "@apidevtools/json-schema-ref-parser";
5
+ //#region src/format/index.ts
6
+ /** oxfmt rejected the source it was handed. */
7
+ var FormatError = class extends Data.TaggedError("FormatError") {};
8
+ const FMT_OPTIONS = {
9
+ printWidth: 100,
10
+ singleQuote: true,
11
+ semi: false
12
+ };
13
+ /** Formats generated TypeScript. Failures land in the error channel. */
14
+ function fmt(input) {
15
+ return Effect.gen(function* () {
16
+ const { code, errors } = yield* Effect.tryPromise({
17
+ try: () => format("<stdin>.ts", input, FMT_OPTIONS),
18
+ catch: (cause) => new FormatError({ message: cause instanceof Error ? cause.message : String(cause) })
19
+ });
20
+ if (errors.length > 0) return yield* new FormatError({ message: errors.map((error) => error.message).join("\n") });
21
+ return code;
22
+ });
23
+ }
24
+ //#endregion
25
+ //#region src/parser/index.ts
26
+ /** The document could not be bundled as a JSON Schema. */
27
+ var ParseError = class extends Data.TaggedError("ParseError") {};
28
+ /** The bundled document at `input`. Failures land in the error channel. */
29
+ function parseSchemaFile(input) {
30
+ return Effect.tryPromise({
31
+ try: () => bundle(input),
32
+ catch: (error) => new ParseError({ message: `Failed to parse schema: ${error instanceof Error ? error.message : String(error)}` })
33
+ });
34
+ }
35
+ //#endregion
36
+ export { fmt as i, parseSchemaFile as n, FormatError as r, ParseError as t };