@powerlines/schema 0.11.28 → 0.11.37

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 (82) hide show
  1. package/dist/bundle.cjs +34 -20
  2. package/dist/bundle.d.cts +3 -3
  3. package/dist/bundle.d.cts.map +1 -1
  4. package/dist/bundle.d.mts +3 -3
  5. package/dist/bundle.d.mts.map +1 -1
  6. package/dist/bundle.mjs +35 -21
  7. package/dist/bundle.mjs.map +1 -1
  8. package/dist/codegen.cjs +55 -8
  9. package/dist/codegen.d.cts +12 -6
  10. package/dist/codegen.d.cts.map +1 -1
  11. package/dist/codegen.d.mts +12 -6
  12. package/dist/codegen.d.mts.map +1 -1
  13. package/dist/codegen.mjs +52 -8
  14. package/dist/codegen.mjs.map +1 -1
  15. package/dist/constants.cjs +42 -0
  16. package/dist/constants.d.cts +15 -0
  17. package/dist/constants.d.cts.map +1 -0
  18. package/dist/constants.d.mts +15 -0
  19. package/dist/constants.d.mts.map +1 -0
  20. package/dist/constants.mjs +39 -0
  21. package/dist/constants.mjs.map +1 -0
  22. package/dist/extract.cjs +144 -95
  23. package/dist/extract.d.cts +34 -69
  24. package/dist/extract.d.cts.map +1 -1
  25. package/dist/extract.d.mts +34 -69
  26. package/dist/extract.d.mts.map +1 -1
  27. package/dist/extract.mjs +144 -95
  28. package/dist/extract.mjs.map +1 -1
  29. package/dist/helpers.cjs +87 -0
  30. package/dist/helpers.d.cts +48 -0
  31. package/dist/helpers.d.cts.map +1 -0
  32. package/dist/helpers.d.mts +48 -0
  33. package/dist/helpers.d.mts.map +1 -0
  34. package/dist/helpers.mjs +84 -0
  35. package/dist/helpers.mjs.map +1 -0
  36. package/dist/index.cjs +29 -5
  37. package/dist/index.d.cts +8 -5
  38. package/dist/index.d.mts +8 -5
  39. package/dist/index.mjs +7 -4
  40. package/dist/metadata.cjs +80 -0
  41. package/dist/metadata.d.cts +52 -0
  42. package/dist/metadata.d.cts.map +1 -0
  43. package/dist/metadata.d.mts +52 -0
  44. package/dist/metadata.d.mts.map +1 -0
  45. package/dist/metadata.mjs +76 -0
  46. package/dist/metadata.mjs.map +1 -0
  47. package/dist/persistence.cjs +75 -0
  48. package/dist/persistence.d.cts +47 -0
  49. package/dist/persistence.d.cts.map +1 -0
  50. package/dist/persistence.d.mts +47 -0
  51. package/dist/persistence.d.mts.map +1 -0
  52. package/dist/persistence.mjs +71 -0
  53. package/dist/persistence.mjs.map +1 -0
  54. package/dist/reflection.cjs +292 -299
  55. package/dist/reflection.d.cts +3 -16
  56. package/dist/reflection.d.cts.map +1 -1
  57. package/dist/reflection.d.mts +3 -16
  58. package/dist/reflection.d.mts.map +1 -1
  59. package/dist/reflection.mjs +291 -299
  60. package/dist/reflection.mjs.map +1 -1
  61. package/dist/resolve.cjs +7 -7
  62. package/dist/resolve.mjs +7 -7
  63. package/dist/resolve.mjs.map +1 -1
  64. package/dist/type-checks.cjs +126 -25
  65. package/dist/type-checks.d.cts +45 -23
  66. package/dist/type-checks.d.cts.map +1 -1
  67. package/dist/type-checks.d.mts +45 -23
  68. package/dist/type-checks.d.mts.map +1 -1
  69. package/dist/type-checks.mjs +125 -25
  70. package/dist/type-checks.mjs.map +1 -1
  71. package/dist/types.d.cts +237 -95
  72. package/dist/types.d.cts.map +1 -1
  73. package/dist/types.d.mts +237 -95
  74. package/dist/types.d.mts.map +1 -1
  75. package/package.json +24 -8
  76. package/dist/jtd.cjs +0 -385
  77. package/dist/jtd.d.cts +0 -15
  78. package/dist/jtd.d.cts.map +0 -1
  79. package/dist/jtd.d.mts +0 -15
  80. package/dist/jtd.d.mts.map +0 -1
  81. package/dist/jtd.mjs +0 -384
  82. package/dist/jtd.mjs.map +0 -1
package/dist/jtd.cjs DELETED
@@ -1,385 +0,0 @@
1
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
2
- const require_runtime = require('./_virtual/_rolldown/runtime.cjs');
3
- let _stryke_type_checks = require("@stryke/type-checks");
4
- let _stryke_type_checks_is_set_object = require("@stryke/type-checks/is-set-object");
5
-
6
- //#region src/jtd.ts
7
- /**
8
- * Maps a JSON Schema `format` annotation for integers to the closest JTD numeric type.
9
- *
10
- * @param format - The JSON Schema format hint to map.
11
- * @returns The matching JTD numeric type, or `undefined` if no exact match exists.
12
- */
13
- function jsonSchemaIntegerFormatToJtd(format) {
14
- switch (format) {
15
- case "int8": return "int8";
16
- case "uint8": return "uint8";
17
- case "int16": return "int16";
18
- case "uint16": return "uint16";
19
- case "int32": return "int32";
20
- case "uint32": return "uint32";
21
- case void 0:
22
- default: return;
23
- }
24
- }
25
- /**
26
- * Maps a JSON Schema `format` annotation for floating point numbers to the closest JTD numeric type.
27
- *
28
- * @param format - The JSON Schema format hint to map.
29
- * @returns The matching JTD numeric type, or `undefined` if no exact match exists.
30
- */
31
- function jsonSchemaNumberFormatToJtd(format) {
32
- switch (format) {
33
- case "float":
34
- case "float32": return "float32";
35
- case "double":
36
- case "float64": return "float64";
37
- case void 0:
38
- default: return;
39
- }
40
- }
41
- /**
42
- * Picks the smallest unsigned JTD integer type that can hold the provided bounds.
43
- *
44
- * @param minimum - The inclusive lower bound, when known.
45
- * @param maximum - The inclusive upper bound, when known.
46
- * @returns The narrowest unsigned JTD integer type that can represent the range, or `undefined` if the range cannot be expressed as an unsigned integer.
47
- */
48
- function pickUnsignedIntegerType(minimum, maximum) {
49
- if (minimum === void 0 || minimum < 0) return;
50
- if (maximum === void 0) return;
51
- if (maximum <= 255) return "uint8";
52
- if (maximum <= 65535) return "uint16";
53
- if (maximum <= 4294967295) return "uint32";
54
- }
55
- /**
56
- * Picks the smallest signed JTD integer type that can hold the provided bounds.
57
- *
58
- * @param minimum - The inclusive lower bound, when known.
59
- * @param maximum - The inclusive upper bound, when known.
60
- * @returns The narrowest signed JTD integer type that can represent the range, or `undefined` if the range cannot be expressed as a signed integer.
61
- */
62
- function pickSignedIntegerType(minimum, maximum) {
63
- if (minimum !== void 0 && maximum !== void 0 && minimum >= -128 && maximum <= 127) return "int8";
64
- if (minimum !== void 0 && maximum !== void 0 && minimum >= -32768 && maximum <= 32767) return "int16";
65
- return "int32";
66
- }
67
- /**
68
- * Tests whether the provided value is a non-null object that can be inspected as a JSON Schema fragment.
69
- *
70
- * @param value - The value to test.
71
- * @returns `true` if the value is a plain object suitable for JSON-Schema conversion.
72
- */
73
- function isJsonSchemaLike(value) {
74
- return (0, _stryke_type_checks_is_set_object.isSetObject)(value);
75
- }
76
- /**
77
- * Reads the JSON Schema `type` field as an array, normalising the single-string form.
78
- *
79
- * @param schema - The JSON Schema fragment to inspect.
80
- * @returns The list of JSON Schema type names declared on the fragment.
81
- */
82
- function readTypes(schema) {
83
- if (Array.isArray(schema.type)) return schema.type;
84
- if (typeof schema.type === "string") return [schema.type];
85
- return [];
86
- }
87
- /**
88
- * Builds a JTD `metadata` object from the JSON Schema annotation keywords found on a fragment.
89
- *
90
- * @param schema - The source JSON Schema fragment.
91
- * @returns A metadata bag suitable for attaching to a JTD form, or `undefined` if no annotations are present.
92
- */
93
- function collectMetadata(schema) {
94
- const metadata = {};
95
- if ((0, _stryke_type_checks.isSetString)(schema.description)) metadata.description = schema.description;
96
- if ((0, _stryke_type_checks.isSetArray)(schema.examples)) metadata.examples = schema.examples;
97
- if ((0, _stryke_type_checks.isSetArray)(schema.alias) && schema.alias.every(_stryke_type_checks.isSetString)) metadata.alias = schema.alias;
98
- if ((0, _stryke_type_checks.isSetString)(schema.table)) metadata.default = schema.table;
99
- if ((0, _stryke_type_checks.isSetString)(schema.title)) metadata.title = schema.title;
100
- if (!(0, _stryke_type_checks.isUndefined)(schema.default)) metadata.default = schema.default;
101
- if ((0, _stryke_type_checks.isBoolean)(schema.isHidden)) metadata.isHidden = schema.isHidden;
102
- else if ((0, _stryke_type_checks.isBoolean)(schema.hidden)) metadata.isHidden = schema.hidden;
103
- if ((0, _stryke_type_checks.isBoolean)(schema.isIgnored)) metadata.isIgnored = schema.isIgnored;
104
- else if ((0, _stryke_type_checks.isBoolean)(schema.ignored)) metadata.isIgnored = schema.ignored;
105
- if ((0, _stryke_type_checks.isBoolean)(schema.isReadonly)) metadata.isReadonly = schema.isReadonly;
106
- else if ((0, _stryke_type_checks.isBoolean)(schema.readonly)) metadata.isReadonly = schema.readonly;
107
- if ((0, _stryke_type_checks.isBoolean)(schema.isPrimaryKey)) metadata.isPrimaryKey = schema.isPrimaryKey;
108
- else if ((0, _stryke_type_checks.isBoolean)(schema.primaryKey)) metadata.isPrimaryKey = schema.primaryKey;
109
- if ((0, _stryke_type_checks.isBoolean)(schema.isInternal)) metadata.isInternal = schema.isInternal;
110
- else if ((0, _stryke_type_checks.isBoolean)(schema.internal)) metadata.isInternal = schema.internal;
111
- if ((0, _stryke_type_checks.isBoolean)(schema.isRuntime)) metadata.isRuntime = schema.isRuntime;
112
- else if ((0, _stryke_type_checks.isBoolean)(schema.runtime)) metadata.isRuntime = schema.runtime;
113
- if ((0, _stryke_type_checks.isSetArray)(schema.union)) metadata.union = schema.union;
114
- return Object.keys(metadata).length > 0 ? metadata : void 0;
115
- }
116
- /**
117
- * Attaches metadata and nullability flags to a JTD form, mutating and returning the form.
118
- *
119
- * @param form - The base JTD form to decorate.
120
- * @param schema - The source JSON Schema fragment from which annotations are read.
121
- * @param nullable - Whether the schema is nullable in JTD semantics.
122
- * @returns The decorated JTD form.
123
- */
124
- function decorate(form, schema, nullable) {
125
- if (nullable) form.nullable = true;
126
- const metadata = collectMetadata(schema);
127
- if (metadata) form.metadata = metadata;
128
- return form;
129
- }
130
- /**
131
- * Determines whether the supplied list of JSON Schema types collapses to `null` only.
132
- *
133
- * @param types - The normalized list of JSON Schema type names.
134
- * @returns `true` if the only declared type is `null`.
135
- */
136
- function isNullOnly(types) {
137
- return types.length > 0 && types.every((t) => t === "null");
138
- }
139
- /**
140
- * Splits a `null` declaration away from a list of JSON Schema types.
141
- *
142
- * @param types - The normalized list of JSON Schema type names.
143
- * @returns A tuple of `[nonNullTypes, nullable]` describing the remaining types and whether `null` was present.
144
- */
145
- function stripNull(types) {
146
- const nullable = types.includes("null");
147
- return {
148
- types: types.filter((t) => t !== "null"),
149
- nullable
150
- };
151
- }
152
- /**
153
- * Converts a JSON Schema `enum` keyword to a JTD enum form, stringifying values when required.
154
- *
155
- * @param values - The raw enum values from the JSON Schema fragment.
156
- * @returns A JTD enum form, or `undefined` if the enum cannot be represented (e.g. empty list).
157
- */
158
- function enumToJtd(values) {
159
- const strings = values.filter((v) => v !== null && v !== void 0).map((v) => String(v));
160
- if (strings.length === 0) return;
161
- return { enum: Array.from(new Set(strings)) };
162
- }
163
- /**
164
- * Selects the most appropriate JTD numeric `type` value for a JSON Schema integer fragment.
165
- *
166
- * @param schema - The integer JSON Schema fragment.
167
- * @returns The chosen JTD integer type.
168
- */
169
- function pickIntegerJtdType(schema) {
170
- const mapped = jsonSchemaIntegerFormatToJtd(schema.format);
171
- if (mapped) return mapped;
172
- const unsigned = pickUnsignedIntegerType(schema.minimum, schema.maximum);
173
- if (unsigned) return unsigned;
174
- return pickSignedIntegerType(schema.minimum, schema.maximum) ?? "int32";
175
- }
176
- /**
177
- * Selects the most appropriate JTD numeric `type` value for a JSON Schema number fragment.
178
- *
179
- * @param schema - The number JSON Schema fragment.
180
- * @returns The chosen JTD floating point type.
181
- */
182
- function pickNumberJtdType(schema) {
183
- return jsonSchemaNumberFormatToJtd(schema.format) ?? "float64";
184
- }
185
- /**
186
- * Selects the JTD string `type` value for a JSON Schema string fragment, mapping `format: "date-time"` to `timestamp`.
187
- *
188
- * @param schema - The string JSON Schema fragment.
189
- * @returns The chosen JTD string type.
190
- */
191
- function pickStringJtdType(schema) {
192
- if (schema.format === "date-time") return "timestamp";
193
- return "string";
194
- }
195
- /**
196
- * Converts a JSON Schema object fragment into a JTD properties form.
197
- *
198
- * @param schema - The object JSON Schema fragment.
199
- * @param nullable - Whether the resulting JTD form should be nullable.
200
- * @returns The JTD properties form representing the object.
201
- */
202
- function objectToJtd(schema, nullable) {
203
- const required = new Set(schema.required ?? []);
204
- const properties = {};
205
- const optionalProperties = {};
206
- const metadata = { default: schema.default ?? {} };
207
- if (schema.properties) for (const [key, value] of Object.entries(schema.properties)) {
208
- if (!(0, _stryke_type_checks.isUndefined)(value.default)) metadata.default[key] = value.default;
209
- const converted = jsonSchemaToJtd(value);
210
- if (!converted) continue;
211
- if (required.has(key)) properties[key] = converted;
212
- else optionalProperties[key] = converted;
213
- }
214
- const hasProperties = Object.keys(properties).length > 0;
215
- const hasOptional = Object.keys(optionalProperties).length > 0;
216
- if (!hasProperties && !hasOptional && isJsonSchemaLike(schema.additionalProperties)) {
217
- const values = jsonSchemaToJtd(schema.additionalProperties);
218
- if (values) return decorate({
219
- metadata,
220
- values
221
- }, schema, nullable);
222
- }
223
- if (!hasProperties && !hasOptional && schema.patternProperties) {
224
- const first = Object.values(schema.patternProperties)[0];
225
- if (first) {
226
- const values = jsonSchemaToJtd(first);
227
- if (values) return decorate({
228
- metadata,
229
- values
230
- }, schema, nullable);
231
- }
232
- }
233
- const form = { metadata };
234
- if (hasProperties) form.properties = properties;
235
- else if (!hasOptional) form.properties = {};
236
- if (hasOptional) form.optionalProperties = optionalProperties;
237
- if (schema.additionalProperties === true || isJsonSchemaLike(schema.additionalProperties) || schema.patternProperties !== void 0) form.additionalProperties = true;
238
- return decorate(form, schema, nullable);
239
- }
240
- /**
241
- * Converts a JSON Schema array fragment into a JTD elements form.
242
- *
243
- * @param schema - The array JSON Schema fragment.
244
- * @param nullable - Whether the resulting JTD form should be nullable.
245
- * @returns The JTD elements form representing the array.
246
- */
247
- function arrayToJtd(schema, nullable) {
248
- let elementSchema;
249
- if (Array.isArray(schema.items)) elementSchema = schema.items[0];
250
- else if (schema.items) elementSchema = schema.items;
251
- return decorate({ elements: (elementSchema ? jsonSchemaToJtd(elementSchema) : {}) ?? {} }, schema, nullable);
252
- }
253
- /**
254
- * Attempts to detect and emit a JTD discriminator form from a JSON Schema `oneOf` or `anyOf` fragment.
255
- *
256
- * @param schemas - The list of candidate JSON Schema fragments.
257
- * @param nullable - Whether the resulting JTD form should be nullable.
258
- * @returns A discriminator form when every branch shares a single tag property, otherwise `undefined`.
259
- */
260
- function tryDiscriminator(schemas, nullable) {
261
- if (schemas.length < 2) return;
262
- let candidateKey;
263
- const mapping = {};
264
- for (const branch of schemas) {
265
- if (!isJsonSchemaLike(branch) || !branch.properties) return;
266
- const constantTags = Object.entries(branch.properties).filter(([, value]) => isJsonSchemaLike(value) && (typeof value.const === "string" || Array.isArray(value.enum) && value.enum.length === 1 && typeof value.enum[0] === "string"));
267
- if (constantTags.length === 0) return;
268
- const [tagKey, tagSchema] = constantTags[0];
269
- if (!candidateKey) candidateKey = tagKey;
270
- else if (candidateKey !== tagKey) return;
271
- const tag = typeof tagSchema.const === "string" ? tagSchema.const : tagSchema.enum?.[0];
272
- const { [tagKey]: _omit, ...restProperties } = branch.properties;
273
- const restRequired = (branch.required ?? []).filter((k) => k !== tagKey);
274
- const branchForm = jsonSchemaToJtd({
275
- ...branch,
276
- properties: restProperties,
277
- required: restRequired
278
- });
279
- if (!branchForm || !(0, _stryke_type_checks_is_set_object.isSetObject)(branchForm) || "ref" in branchForm) return;
280
- mapping[tag] = branchForm;
281
- }
282
- if (!candidateKey) return;
283
- const form = {
284
- discriminator: candidateKey,
285
- mapping
286
- };
287
- if (nullable) form.nullable = true;
288
- return form;
289
- }
290
- /**
291
- * Converts a JSON Schema fragment (draft-07 style, as produced by `zod-to-json-schema`, Standard Schema, etc.) into a valid JSON Type Definition (RFC 8927) schema.
292
- *
293
- * Unsupported JSON Schema keywords (`pattern`, `const`, `minItems`, `maxItems`, `uniqueItems`, etc.) are dropped — JTD intentionally omits these. Annotation keywords (`description`, `title`, `default`, `examples`) are preserved under the JTD `metadata` field.
294
- *
295
- * @param schema - The JSON Schema fragment to convert.
296
- * @returns A valid JTD form, or `undefined` if the input cannot be represented.
297
- */
298
- function jsonSchemaToJtd(schema) {
299
- if (!isJsonSchemaLike(schema)) return;
300
- if ((0, _stryke_type_checks.isSetString)(schema.$ref)) {
301
- const match = /^#\/(?:definitions|\$defs)\/(.+)$/.exec(schema.$ref);
302
- if (match) return { ref: match[1] };
303
- }
304
- if (Array.isArray(schema.allOf) && schema.allOf.length > 0) {
305
- const merged = schema.allOf.reduce((acc, current) => mergeJsonSchema(acc, current), {});
306
- const { allOf: _allOf, ...rest } = schema;
307
- return jsonSchemaToJtd(mergeJsonSchema(merged, rest));
308
- }
309
- const rawTypes = readTypes(schema);
310
- const { types: nonNullTypes, nullable: typeIsNullable } = stripNull(rawTypes);
311
- const nullable = Boolean(schema.nullable) || typeIsNullable;
312
- if (isNullOnly(rawTypes)) return decorate({}, schema, true);
313
- if (Array.isArray(schema.enum)) {
314
- const enumForm = enumToJtd(schema.enum);
315
- if (enumForm) return decorate(enumForm, schema, nullable);
316
- }
317
- if ((0, _stryke_type_checks.isSetString)(schema.const)) return decorate({ enum: [schema.const] }, schema, nullable);
318
- const union = schema.oneOf ?? schema.anyOf;
319
- if (Array.isArray(union) && union.length > 0) {
320
- const branches = union.filter(isJsonSchemaLike);
321
- const onlyNullBranches = branches.filter((b) => readTypes(b).includes("null"));
322
- const nonNullBranches = branches.filter((b) => !isNullOnly(readTypes(b)) && readTypes(b).join() !== "null");
323
- const unionNullable = nullable || onlyNullBranches.length > 0;
324
- if (nonNullBranches.length === 1) {
325
- const collapsed = jsonSchemaToJtd(nonNullBranches[0]);
326
- if (collapsed) return decorate(collapsed, schema, unionNullable);
327
- }
328
- const discriminated = tryDiscriminator(nonNullBranches, unionNullable);
329
- if (discriminated) {
330
- const metadata = collectMetadata(schema);
331
- if (metadata) discriminated.metadata = metadata;
332
- return discriminated;
333
- }
334
- const fallback = decorate({}, schema, unionNullable);
335
- const metadata = fallback.metadata ?? {};
336
- metadata.union = union;
337
- fallback.metadata = metadata;
338
- return fallback;
339
- }
340
- if (nonNullTypes.includes("object") || schema.properties || schema.patternProperties || isJsonSchemaLike(schema.additionalProperties)) {
341
- const result = objectToJtd(schema, nullable);
342
- const definitions = schema.definitions ?? schema.$defs;
343
- if (definitions && Object.keys(definitions).length > 0) {
344
- const converted = {};
345
- for (const [key, value] of Object.entries(definitions)) {
346
- const def = jsonSchemaToJtd(value);
347
- if (def) converted[key] = def;
348
- }
349
- if (Object.keys(converted).length > 0) result.definitions = converted;
350
- }
351
- return result;
352
- }
353
- if (nonNullTypes.includes("array")) return arrayToJtd(schema, nullable);
354
- if (nonNullTypes.length === 1) {
355
- const t = nonNullTypes[0];
356
- if (t === "string") return decorate({ type: pickStringJtdType(schema) }, schema, nullable);
357
- if (t === "boolean") return decorate({ type: "boolean" }, schema, nullable);
358
- if (t === "integer") return decorate({ type: pickIntegerJtdType(schema) }, schema, nullable);
359
- if (t === "number") return decorate({ type: pickNumberJtdType(schema) }, schema, nullable);
360
- }
361
- if (nonNullTypes.length > 1) return decorate({}, schema, nullable);
362
- return decorate({}, schema, nullable);
363
- }
364
- /**
365
- * Shallow-merges two JSON Schema fragments, combining `required` arrays and `properties` maps.
366
- *
367
- * @param left - The base schema fragment.
368
- * @param right - The schema fragment to merge into the base.
369
- * @returns A merged schema fragment. Neither input is mutated.
370
- */
371
- function mergeJsonSchema(left, right) {
372
- const merged = {
373
- ...left,
374
- ...right
375
- };
376
- if (left.properties || right.properties) merged.properties = {
377
- ...left.properties ?? {},
378
- ...right.properties ?? {}
379
- };
380
- if (left.required || right.required) merged.required = Array.from(new Set([...left.required ?? [], ...right.required ?? []]));
381
- return merged;
382
- }
383
-
384
- //#endregion
385
- exports.jsonSchemaToJtd = jsonSchemaToJtd;
package/dist/jtd.d.cts DELETED
@@ -1,15 +0,0 @@
1
- import { JTDSchemaType, JsonSchemaLike, SchemaMetadata } from "./types.cjs";
2
-
3
- //#region src/jtd.d.ts
4
- /**
5
- * Converts a JSON Schema fragment (draft-07 style, as produced by `zod-to-json-schema`, Standard Schema, etc.) into a valid JSON Type Definition (RFC 8927) schema.
6
- *
7
- * Unsupported JSON Schema keywords (`pattern`, `const`, `minItems`, `maxItems`, `uniqueItems`, etc.) are dropped — JTD intentionally omits these. Annotation keywords (`description`, `title`, `default`, `examples`) are preserved under the JTD `metadata` field.
8
- *
9
- * @param schema - The JSON Schema fragment to convert.
10
- * @returns A valid JTD form, or `undefined` if the input cannot be represented.
11
- */
12
- declare function jsonSchemaToJtd<TMetadata extends Partial<SchemaMetadata> = Partial<SchemaMetadata>>(schema: JsonSchemaLike | undefined | null): JTDSchemaType<TMetadata> | undefined;
13
- //#endregion
14
- export { jsonSchemaToJtd };
15
- //# sourceMappingURL=jtd.d.cts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jtd.d.cts","names":[],"sources":["../src/jtd.ts"],"mappings":";;;;;AAgjBA;;;;;;iBAAgB,eAAA,mBACI,OAAA,CAAQ,cAAA,IAAkB,OAAA,CAAQ,cAAA,EAAA,CAEpD,MAAA,EAAQ,cAAA,sBACP,aAAA,CAAc,SAAA"}
package/dist/jtd.d.mts DELETED
@@ -1,15 +0,0 @@
1
- import { JTDSchemaType, JsonSchemaLike, SchemaMetadata } from "./types.mjs";
2
-
3
- //#region src/jtd.d.ts
4
- /**
5
- * Converts a JSON Schema fragment (draft-07 style, as produced by `zod-to-json-schema`, Standard Schema, etc.) into a valid JSON Type Definition (RFC 8927) schema.
6
- *
7
- * Unsupported JSON Schema keywords (`pattern`, `const`, `minItems`, `maxItems`, `uniqueItems`, etc.) are dropped — JTD intentionally omits these. Annotation keywords (`description`, `title`, `default`, `examples`) are preserved under the JTD `metadata` field.
8
- *
9
- * @param schema - The JSON Schema fragment to convert.
10
- * @returns A valid JTD form, or `undefined` if the input cannot be represented.
11
- */
12
- declare function jsonSchemaToJtd<TMetadata extends Partial<SchemaMetadata> = Partial<SchemaMetadata>>(schema: JsonSchemaLike | undefined | null): JTDSchemaType<TMetadata> | undefined;
13
- //#endregion
14
- export { jsonSchemaToJtd };
15
- //# sourceMappingURL=jtd.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"jtd.d.mts","names":[],"sources":["../src/jtd.ts"],"mappings":";;;;;AAgjBA;;;;;;iBAAgB,eAAA,mBACI,OAAA,CAAQ,cAAA,IAAkB,OAAA,CAAQ,cAAA,EAAA,CAEpD,MAAA,EAAQ,cAAA,sBACP,aAAA,CAAc,SAAA"}