@sdk-it/core 0.43.0 → 0.44.0
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.
- package/dist/lib/spec-json.d.ts +23 -0
- package/dist/lib/spec-json.d.ts.map +1 -0
- package/dist/lib/spec-json.js +11 -0
- package/dist/lib/spec-json.js.map +7 -0
- package/dist/lib/zod-jsonschema.d.ts.map +1 -1
- package/dist/lib/zod-jsonschema.js +394 -53
- package/dist/lib/zod-jsonschema.js.map +2 -2
- package/package.json +3 -4
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface JSON {
|
|
3
|
+
/**
|
|
4
|
+
* TC39 "JSON.parse source access" proposal, shipped in Node 21+ and
|
|
5
|
+
* evergreen browsers. TypeScript 6 does not ship lib types for it yet.
|
|
6
|
+
*/
|
|
7
|
+
rawJSON(text: string): {
|
|
8
|
+
rawJSON: string;
|
|
9
|
+
};
|
|
10
|
+
isRawJSON(value: unknown): value is {
|
|
11
|
+
rawJSON: string;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Spec objects produced by the analyzers carry real bigint values for int64
|
|
17
|
+
* defaults and bounds. JSON.stringify throws on bigint; this replacer writes
|
|
18
|
+
* them as bare JSON numbers instead — lossless on disk (JSON's grammar allows
|
|
19
|
+
* arbitrary-precision numbers) and valid against `type: integer` schemas.
|
|
20
|
+
*/
|
|
21
|
+
export declare function specJsonReplacer(_key: string, value: unknown): unknown;
|
|
22
|
+
export declare function stringifySpec(spec: unknown, space?: string | number): string;
|
|
23
|
+
//# sourceMappingURL=spec-json.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"spec-json.d.ts","sourceRoot":"","sources":["../../src/lib/spec-json.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,IAAI;QACZ;;;WAGG;QACH,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG;YAAE,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC;QAC3C,SAAS,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI;YAAE,OAAO,EAAE,MAAM,CAAA;SAAE,CAAC;KACzD;CACF;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,OAAO,CAEtE;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,OAAO,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAE5E"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
function specJsonReplacer(_key, value) {
|
|
2
|
+
return typeof value === "bigint" ? JSON.rawJSON(value.toString()) : value;
|
|
3
|
+
}
|
|
4
|
+
function stringifySpec(spec, space) {
|
|
5
|
+
return JSON.stringify(spec, specJsonReplacer, space);
|
|
6
|
+
}
|
|
7
|
+
export {
|
|
8
|
+
specJsonReplacer,
|
|
9
|
+
stringifySpec
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=spec-json.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/lib/spec-json.ts"],
|
|
4
|
+
"sourcesContent": ["declare global {\n interface JSON {\n /**\n * TC39 \"JSON.parse source access\" proposal, shipped in Node 21+ and\n * evergreen browsers. TypeScript 6 does not ship lib types for it yet.\n */\n rawJSON(text: string): { rawJSON: string };\n isRawJSON(value: unknown): value is { rawJSON: string };\n }\n}\n\n/**\n * Spec objects produced by the analyzers carry real bigint values for int64\n * defaults and bounds. JSON.stringify throws on bigint; this replacer writes\n * them as bare JSON numbers instead \u2014 lossless on disk (JSON's grammar allows\n * arbitrary-precision numbers) and valid against `type: integer` schemas.\n */\nexport function specJsonReplacer(_key: string, value: unknown): unknown {\n return typeof value === 'bigint' ? JSON.rawJSON(value.toString()) : value;\n}\n\nexport function stringifySpec(spec: unknown, space?: string | number): string {\n return JSON.stringify(spec, specJsonReplacer, space);\n}\n"],
|
|
5
|
+
"mappings": "AAiBO,SAAS,iBAAiB,MAAc,OAAyB;AACtE,SAAO,OAAO,UAAU,WAAW,KAAK,QAAQ,MAAM,SAAS,CAAC,IAAI;AACtE;AAEO,SAAS,cAAc,MAAe,OAAiC;AAC5E,SAAO,KAAK,UAAU,MAAM,kBAAkB,KAAK;AACrD;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"zod-jsonschema.d.ts","sourceRoot":"","sources":["../../src/lib/zod-jsonschema.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAUF,wBAAsB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,YAAY,EAAO,
|
|
1
|
+
{"version":3,"file":"zod-jsonschema.d.ts","sourceRoot":"","sources":["../../src/lib/zod-jsonschema.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAUF,wBAAsB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,GAAE,YAAY,EAAO,gBAqmBzE"}
|
|
@@ -7,57 +7,79 @@ async function evalZod(schema, imports = []) {
|
|
|
7
7
|
`const filename = "${import.meta.url}";`,
|
|
8
8
|
`const require = createRequire(filename);`,
|
|
9
9
|
`const z = require("zod");`,
|
|
10
|
+
// zod 4 removed ZodString.ip/.cidr; restore them for analyzed user source
|
|
11
|
+
// that still uses the v3 spellings.
|
|
12
|
+
`const stringProto = Object.getPrototypeOf(z.string());
|
|
13
|
+
const installedShims = [];
|
|
14
|
+
function withReceiverChecks(receiver, format) {
|
|
15
|
+
return (receiver._zod.def.checks ?? []).length
|
|
16
|
+
? z.intersection(receiver, format)
|
|
17
|
+
: format;
|
|
18
|
+
}
|
|
19
|
+
if (!stringProto.ip) {
|
|
20
|
+
installedShims.push('ip');
|
|
21
|
+
stringProto.ip = function (options) {
|
|
22
|
+
if (options?.version === 'v4') return withReceiverChecks(this, z.ipv4());
|
|
23
|
+
if (options?.version === 'v6') return withReceiverChecks(this, z.ipv6());
|
|
24
|
+
return withReceiverChecks(this, z.union([z.ipv4(), z.ipv6()]));
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
if (!stringProto.cidr) {
|
|
28
|
+
installedShims.push('cidr');
|
|
29
|
+
stringProto.cidr = function (options) {
|
|
30
|
+
if (options?.version === 'v4') return withReceiverChecks(this, z.cidrv4());
|
|
31
|
+
if (options?.version === 'v6') return withReceiverChecks(this, z.cidrv6());
|
|
32
|
+
return withReceiverChecks(this, z.union([z.cidrv4(), z.cidrv6()]));
|
|
33
|
+
};
|
|
34
|
+
}`,
|
|
10
35
|
...imports.map((imp) => `const ${imp.import} = require('${imp.from}');`),
|
|
11
|
-
`const {zodToJsonSchema, ignoreOverride} = require('zod-to-json-schema');`,
|
|
12
36
|
`let optional = false;`,
|
|
37
|
+
`const WRAPPER_TYPES = new Set([
|
|
38
|
+
'optional',
|
|
39
|
+
'nullable',
|
|
40
|
+
'default',
|
|
41
|
+
'prefault',
|
|
42
|
+
'catch',
|
|
43
|
+
'readonly',
|
|
44
|
+
'nonoptional',
|
|
45
|
+
]);`,
|
|
13
46
|
`function unwrapSchemaDef(def) {
|
|
14
47
|
while (def) {
|
|
15
|
-
if (
|
|
16
|
-
def
|
|
17
|
-
def.typeName === 'ZodDefault' ||
|
|
18
|
-
def.typeName === 'ZodNullable' ||
|
|
19
|
-
def.typeName === 'ZodCatch' ||
|
|
20
|
-
def.typeName === 'ZodBranded' ||
|
|
21
|
-
def.typeName === 'ZodReadonly'
|
|
22
|
-
) {
|
|
23
|
-
def = def.innerType?._def;
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
|
-
if (def.typeName === 'ZodEffects') {
|
|
27
|
-
def = def.schema?._def;
|
|
48
|
+
if (WRAPPER_TYPES.has(def.type)) {
|
|
49
|
+
def = def.innerType?._zod?.def;
|
|
28
50
|
continue;
|
|
29
51
|
}
|
|
30
|
-
if (def.
|
|
31
|
-
def = def.in?.
|
|
52
|
+
if (def.type === 'pipe') {
|
|
53
|
+
def = def.in?._zod?.def;
|
|
32
54
|
continue;
|
|
33
55
|
}
|
|
34
56
|
return def;
|
|
35
57
|
}
|
|
36
58
|
return def;
|
|
37
59
|
}`,
|
|
38
|
-
`function matchesDefType(schema,
|
|
60
|
+
`function matchesDefType(schema, defType) {
|
|
39
61
|
if (!schema || typeof schema !== 'object') return false;
|
|
40
|
-
if (
|
|
62
|
+
if (defType === 'number') {
|
|
41
63
|
return schema.type === 'number' || schema.type === 'integer';
|
|
42
64
|
}
|
|
43
|
-
if (
|
|
65
|
+
if (defType === 'bigint') {
|
|
44
66
|
return schema.type === 'integer';
|
|
45
67
|
}
|
|
46
|
-
if (
|
|
68
|
+
if (defType === 'string') {
|
|
47
69
|
return schema.type === 'string';
|
|
48
70
|
}
|
|
49
|
-
if (
|
|
71
|
+
if (defType === 'boolean') {
|
|
50
72
|
return schema.type === 'boolean';
|
|
51
73
|
}
|
|
52
|
-
if (
|
|
74
|
+
if (defType === 'date') {
|
|
53
75
|
return schema.type === 'string' && schema.format === 'date-time';
|
|
54
76
|
}
|
|
55
77
|
return typeof schema.type === 'string';
|
|
56
78
|
}`,
|
|
57
|
-
`function applyZodType(schema, zodType,
|
|
79
|
+
`function applyZodType(schema, zodType, defType) {
|
|
58
80
|
if (!schema || typeof schema !== 'object') return false;
|
|
59
81
|
if (schema['x-zod-type']) return true;
|
|
60
|
-
if (matchesDefType(schema,
|
|
82
|
+
if (matchesDefType(schema, defType)) {
|
|
61
83
|
schema['x-zod-type'] = zodType;
|
|
62
84
|
return true;
|
|
63
85
|
}
|
|
@@ -66,17 +88,94 @@ async function evalZod(schema, imports = []) {
|
|
|
66
88
|
const candidates = schema[key].filter(
|
|
67
89
|
(candidate) => candidate && candidate.type !== 'null',
|
|
68
90
|
);
|
|
69
|
-
if (candidates.length === 1 && applyZodType(candidates[0], zodType,
|
|
91
|
+
if (candidates.length === 1 && applyZodType(candidates[0], zodType, defType)) {
|
|
70
92
|
return true;
|
|
71
93
|
}
|
|
72
94
|
for (const candidate of candidates) {
|
|
73
|
-
if (applyZodType(candidate, zodType,
|
|
95
|
+
if (applyZodType(candidate, zodType, defType)) {
|
|
74
96
|
return true;
|
|
75
97
|
}
|
|
76
98
|
}
|
|
77
99
|
}
|
|
78
100
|
return false;
|
|
79
101
|
}`,
|
|
102
|
+
`const BIGINT_SENTINEL = '__sdkit_bigint__';`,
|
|
103
|
+
// zod v4 JSON-round-trips default values before the override callback
|
|
104
|
+
// runs, which throws on bigint. Mask them as sentinel strings up front
|
|
105
|
+
// and restore after conversion.
|
|
106
|
+
`function maskBigIntDefaults(schema, seen = new Set()) {
|
|
107
|
+
if (!schema || !schema._zod || seen.has(schema)) return;
|
|
108
|
+
seen.add(schema);
|
|
109
|
+
const def = schema._zod.def;
|
|
110
|
+
if (
|
|
111
|
+
(def.type === 'default' || def.type === 'prefault') &&
|
|
112
|
+
typeof def.defaultValue === 'bigint'
|
|
113
|
+
) {
|
|
114
|
+
Object.defineProperty(def, 'defaultValue', {
|
|
115
|
+
value: BIGINT_SENTINEL + def.defaultValue.toString(),
|
|
116
|
+
configurable: true,
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
for (const key of ['innerType', 'in', 'out', 'element', 'valueType', 'keyType', 'left', 'right', 'catchall', 'rest']) {
|
|
120
|
+
if (def[key]) maskBigIntDefaults(def[key], seen);
|
|
121
|
+
}
|
|
122
|
+
if (typeof def.getter === 'function') {
|
|
123
|
+
const inner = def.getter();
|
|
124
|
+
maskBigIntDefaults(inner, seen);
|
|
125
|
+
Object.defineProperty(def, 'getter', {
|
|
126
|
+
value: () => inner,
|
|
127
|
+
configurable: true,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
if (def.shape) {
|
|
131
|
+
for (const value of Object.values(def.shape)) maskBigIntDefaults(value, seen);
|
|
132
|
+
}
|
|
133
|
+
if (Array.isArray(def.options)) {
|
|
134
|
+
for (const option of def.options) maskBigIntDefaults(option, seen);
|
|
135
|
+
}
|
|
136
|
+
if (Array.isArray(def.items)) {
|
|
137
|
+
for (const item of def.items) maskBigIntDefaults(item, seen);
|
|
138
|
+
}
|
|
139
|
+
}`,
|
|
140
|
+
// int64 is a plain number in sdk-it, so masked bigint defaults unmask to
|
|
141
|
+
// JS numbers — the spec stays plain JSON with no bigint values to trip up
|
|
142
|
+
// JSON.stringify.
|
|
143
|
+
`function unmaskBigIntDefaults(schema) {
|
|
144
|
+
if (!schema || typeof schema !== 'object') return;
|
|
145
|
+
for (const [key, value] of Object.entries(schema)) {
|
|
146
|
+
if (typeof value === 'string' && value.startsWith(BIGINT_SENTINEL)) {
|
|
147
|
+
schema[key] = Number(value.slice(BIGINT_SENTINEL.length));
|
|
148
|
+
} else if (Array.isArray(value)) {
|
|
149
|
+
value.forEach(unmaskBigIntDefaults);
|
|
150
|
+
} else if (value && typeof value === 'object') {
|
|
151
|
+
unmaskBigIntDefaults(value);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}`,
|
|
155
|
+
`function hasExplicitRegexCheck(def) {
|
|
156
|
+
return (def.checks ?? []).some(
|
|
157
|
+
(check) => check._zod?.def?.format === 'regex',
|
|
158
|
+
);
|
|
159
|
+
}`,
|
|
160
|
+
`const STANDARD_STRING_FORMATS = new Set([
|
|
161
|
+
'email',
|
|
162
|
+
'uri',
|
|
163
|
+
'url',
|
|
164
|
+
'uuid',
|
|
165
|
+
'guid',
|
|
166
|
+
'date-time',
|
|
167
|
+
'date',
|
|
168
|
+
'time',
|
|
169
|
+
'duration',
|
|
170
|
+
'ipv4',
|
|
171
|
+
'ipv6',
|
|
172
|
+
'hostname',
|
|
173
|
+
'binary',
|
|
174
|
+
]);`,
|
|
175
|
+
// Nonstandard formats that sdk-it's own converters map to semantic zod
|
|
176
|
+
// validators. Keep both keys: format for our converters, pattern for
|
|
177
|
+
// third-party validators that do not recognize the format.
|
|
178
|
+
`const MAPPED_NONSTANDARD_FORMATS = new Set(['cidrv4', 'cidrv6']);`,
|
|
80
179
|
`function normalizeDefaultValue(value) {
|
|
81
180
|
return value instanceof Date ? value.toISOString() : value;
|
|
82
181
|
}`,
|
|
@@ -133,6 +232,13 @@ async function evalZod(schema, imports = []) {
|
|
|
133
232
|
`function mergePrimitiveSchemas(schemas) {
|
|
134
233
|
const merged = {};
|
|
135
234
|
for (const schema of schemas) {
|
|
235
|
+
if (
|
|
236
|
+
schema &&
|
|
237
|
+
typeof schema === 'object' &&
|
|
238
|
+
Object.keys(schema).length === 0
|
|
239
|
+
) {
|
|
240
|
+
continue;
|
|
241
|
+
}
|
|
136
242
|
if (!isMergeablePrimitiveSchema(schema)) {
|
|
137
243
|
return null;
|
|
138
244
|
}
|
|
@@ -185,7 +291,7 @@ async function evalZod(schema, imports = []) {
|
|
|
185
291
|
}
|
|
186
292
|
return merged;
|
|
187
293
|
}`,
|
|
188
|
-
`function normalizeSchema(schema) {
|
|
294
|
+
`function normalizeSchema(schema, isIntersectionMember = false) {
|
|
189
295
|
if (!schema || typeof schema !== 'object') {
|
|
190
296
|
return schema;
|
|
191
297
|
}
|
|
@@ -215,7 +321,55 @@ async function evalZod(schema, imports = []) {
|
|
|
215
321
|
|
|
216
322
|
for (const key of ['anyOf', 'oneOf', 'allOf']) {
|
|
217
323
|
if (!Array.isArray(schema[key])) continue;
|
|
218
|
-
schema[key] = schema[key].map((candidate) =>
|
|
324
|
+
schema[key] = schema[key].map((candidate) =>
|
|
325
|
+
normalizeSchema(candidate, key === 'allOf'),
|
|
326
|
+
);
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
if (Array.isArray(schema.oneOf) && !schema.anyOf) {
|
|
330
|
+
schema.anyOf = schema.oneOf;
|
|
331
|
+
delete schema.oneOf;
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
if (
|
|
335
|
+
Array.isArray(schema.anyOf) &&
|
|
336
|
+
schema.anyOf.every(
|
|
337
|
+
(member) =>
|
|
338
|
+
member &&
|
|
339
|
+
typeof member === 'object' &&
|
|
340
|
+
Object.keys(member).length === 1 &&
|
|
341
|
+
typeof member.type === 'string',
|
|
342
|
+
)
|
|
343
|
+
) {
|
|
344
|
+
const { anyOf, ...rest } = schema;
|
|
345
|
+
schema = { ...rest, type: anyOf.map((member) => member.type) };
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
if (
|
|
349
|
+
schema.type === 'object' &&
|
|
350
|
+
schema.properties &&
|
|
351
|
+
schema.additionalProperties === undefined &&
|
|
352
|
+
!isIntersectionMember
|
|
353
|
+
) {
|
|
354
|
+
schema.additionalProperties = false;
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
if (
|
|
358
|
+
schema.type === 'object' &&
|
|
359
|
+
schema.propertyNames &&
|
|
360
|
+
JSON.stringify(schema.propertyNames) === '{"type":"string"}'
|
|
361
|
+
) {
|
|
362
|
+
delete schema.propertyNames;
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
if (
|
|
366
|
+
typeof schema.$ref === 'string' &&
|
|
367
|
+
!schema.$ref.startsWith('#/components/schemas')
|
|
368
|
+
) {
|
|
369
|
+
schema.$ref =
|
|
370
|
+
schema.$ref === '#'
|
|
371
|
+
? '#/components/schemas'
|
|
372
|
+
: schema.$ref.replace(/^#\\//, '#/components/schemas/');
|
|
219
373
|
}
|
|
220
374
|
|
|
221
375
|
if (Array.isArray(schema.allOf)) {
|
|
@@ -224,43 +378,230 @@ async function evalZod(schema, imports = []) {
|
|
|
224
378
|
const { allOf, ...rest } = schema;
|
|
225
379
|
return { ...rest, ...merged };
|
|
226
380
|
}
|
|
381
|
+
if (schema.allOf.length === 1 && Object.keys(schema).length === 1) {
|
|
382
|
+
return schema.allOf[0];
|
|
383
|
+
}
|
|
227
384
|
}
|
|
228
385
|
|
|
229
386
|
return schema;
|
|
230
387
|
}`,
|
|
388
|
+
`function escapePointerSegment(segment) {
|
|
389
|
+
return String(segment).replaceAll('~', '~0').replaceAll('/', '~1');
|
|
390
|
+
}`,
|
|
391
|
+
`function componentPointer(path) {
|
|
392
|
+
return ['#', 'components', 'schemas', ...path.map(escapePointerSegment)].join('/');
|
|
393
|
+
}`,
|
|
394
|
+
// Nested toJsonSchema passes (set/map values, pipe outputs) return
|
|
395
|
+
// self-contained draft-7 documents whose '#' and '#/definitions/*' refs
|
|
396
|
+
// are relative to the embedded document root, not the outer schema.
|
|
397
|
+
// Resolve them to outer-root structural pointers before the outer
|
|
398
|
+
// definitions/normalize passes rewrite them into dangling refs.
|
|
399
|
+
`function resolveEmbeddedDocs(root) {
|
|
400
|
+
function process(node, path, docRoot) {
|
|
401
|
+
if (!node || typeof node !== 'object') return;
|
|
402
|
+
if (Array.isArray(node)) {
|
|
403
|
+
node.forEach((item, index) => process(item, [...path, index], docRoot));
|
|
404
|
+
return;
|
|
405
|
+
}
|
|
406
|
+
if (node['x-sdkit-embedded-root']) {
|
|
407
|
+
delete node['x-sdkit-embedded-root'];
|
|
408
|
+
const defs = node.definitions ?? Object.create(null);
|
|
409
|
+
delete node.definitions;
|
|
410
|
+
docRoot = { path, defs, firstSite: Object.create(null) };
|
|
411
|
+
}
|
|
412
|
+
if (docRoot && typeof node.$ref === 'string') {
|
|
413
|
+
if (node.$ref === '#') {
|
|
414
|
+
node.$ref = componentPointer(docRoot.path);
|
|
415
|
+
return;
|
|
416
|
+
}
|
|
417
|
+
const match = node.$ref.match(/^#\\/definitions\\/(.+)$/);
|
|
418
|
+
if (match) {
|
|
419
|
+
const name = match[1];
|
|
420
|
+
if (name in docRoot.firstSite) {
|
|
421
|
+
node.$ref = docRoot.firstSite[name];
|
|
422
|
+
return;
|
|
423
|
+
}
|
|
424
|
+
docRoot.firstSite[name] = componentPointer(path);
|
|
425
|
+
delete node.$ref;
|
|
426
|
+
Object.assign(node, docRoot.defs[name]);
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
for (const [key, value] of Object.entries(node)) {
|
|
430
|
+
process(value, [...path, key], docRoot);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
process(root, [], null);
|
|
434
|
+
return root;
|
|
435
|
+
}`,
|
|
436
|
+
// zod v4 breaks non-root cycles with a draft-7 definitions block plus
|
|
437
|
+
// #/definitions/* refs, which OpenAPI consumers cannot resolve. Inline
|
|
438
|
+
// each definition at its first use site and point the remaining
|
|
439
|
+
// (recursive) refs structurally at that site, mirroring the v3
|
|
440
|
+
// $refStrategy: 'root' output.
|
|
441
|
+
`function inlineDefinitions(root) {
|
|
442
|
+
const defs = root.definitions;
|
|
443
|
+
if (!defs || typeof defs !== 'object') return root;
|
|
444
|
+
delete root.definitions;
|
|
445
|
+
const firstSite = Object.create(null);
|
|
446
|
+
function walk(node, path) {
|
|
447
|
+
if (!node || typeof node !== 'object') return;
|
|
448
|
+
if (Array.isArray(node)) {
|
|
449
|
+
node.forEach((item, index) => walk(item, [...path, index]));
|
|
450
|
+
return;
|
|
451
|
+
}
|
|
452
|
+
const match =
|
|
453
|
+
typeof node.$ref === 'string' &&
|
|
454
|
+
node.$ref.match(/^#\\/definitions\\/(.+)$/);
|
|
455
|
+
if (match) {
|
|
456
|
+
const name = match[1];
|
|
457
|
+
if (name in firstSite) {
|
|
458
|
+
node.$ref = firstSite[name];
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
firstSite[name] = componentPointer(path);
|
|
462
|
+
delete node.$ref;
|
|
463
|
+
Object.assign(node, defs[name]);
|
|
464
|
+
}
|
|
465
|
+
for (const [key, value] of Object.entries(node)) {
|
|
466
|
+
walk(value, [...path, key]);
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
walk(root, []);
|
|
470
|
+
return root;
|
|
471
|
+
}`,
|
|
472
|
+
// Wraps nested conversions: when the embedded document carries refs or a
|
|
473
|
+
// definitions block, tag its root so resolveEmbeddedDocs can rebase them.
|
|
474
|
+
`function convertEmbedded(schema) {
|
|
475
|
+
const { $schema: _ignored, ...doc } = toJsonSchema(schema);
|
|
476
|
+
if (doc.definitions || JSON.stringify(doc).includes('"$ref"')) {
|
|
477
|
+
doc['x-sdkit-embedded-root'] = true;
|
|
478
|
+
}
|
|
479
|
+
return doc;
|
|
480
|
+
}`,
|
|
231
481
|
`function toJsonSchema(schema) {
|
|
232
|
-
return
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
if (def.
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
482
|
+
return z.toJSONSchema(schema, {
|
|
483
|
+
target: 'draft-7',
|
|
484
|
+
io: 'input',
|
|
485
|
+
unrepresentable: 'any',
|
|
486
|
+
override(ctx) {
|
|
487
|
+
const def = ctx.zodSchema._zod.def;
|
|
488
|
+
const json = ctx.jsonSchema;
|
|
489
|
+
if (def.type === 'optional') {
|
|
490
|
+
optional = true;
|
|
491
|
+
}
|
|
492
|
+
if (def.type === 'catch') {
|
|
493
|
+
delete json.default;
|
|
244
494
|
}
|
|
245
|
-
if (def.
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
495
|
+
if (def.type === 'date') {
|
|
496
|
+
json.type = 'string';
|
|
497
|
+
json.format = 'date-time';
|
|
498
|
+
json['x-zod-type'] = def.coerce ? 'coerce-date' : 'date';
|
|
499
|
+
}
|
|
500
|
+
if (def.type === 'bigint') {
|
|
501
|
+
json.type = 'integer';
|
|
502
|
+
// z.bigint() carries no format; treat it as int64.
|
|
503
|
+
json.format = ctx.zodSchema._zod.bag.format ?? 'int64';
|
|
504
|
+
if (def.coerce) {
|
|
505
|
+
json['x-zod-type'] = 'coerce-bigint';
|
|
506
|
+
}
|
|
507
|
+
}
|
|
508
|
+
if (def.type === 'set') {
|
|
509
|
+
json.type = 'array';
|
|
510
|
+
json.uniqueItems = true;
|
|
511
|
+
json.items = convertEmbedded(def.valueType);
|
|
512
|
+
}
|
|
513
|
+
if (def.type === 'map') {
|
|
514
|
+
json.type = 'array';
|
|
515
|
+
json.items = {
|
|
516
|
+
type: 'array',
|
|
517
|
+
items: [convertEmbedded(def.keyType), convertEmbedded(def.valueType)],
|
|
518
|
+
minItems: 2,
|
|
519
|
+
maxItems: 2,
|
|
251
520
|
};
|
|
252
521
|
}
|
|
253
|
-
|
|
522
|
+
if (def.type === 'string' && json.format === 'base64') {
|
|
523
|
+
json.format = 'binary';
|
|
524
|
+
delete json.pattern;
|
|
525
|
+
delete json.contentEncoding;
|
|
526
|
+
}
|
|
527
|
+
if (
|
|
528
|
+
def.type === 'string' &&
|
|
529
|
+
json.format &&
|
|
530
|
+
json.pattern &&
|
|
531
|
+
!hasExplicitRegexCheck(def)
|
|
532
|
+
) {
|
|
533
|
+
if (STANDARD_STRING_FORMATS.has(json.format)) {
|
|
534
|
+
delete json.pattern;
|
|
535
|
+
} else if (!MAPPED_NONSTANDARD_FORMATS.has(json.format)) {
|
|
536
|
+
delete json.format;
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
if (def.type === 'number') {
|
|
540
|
+
const explicitBound = (kind, value) =>
|
|
541
|
+
(def.checks ?? []).some(
|
|
542
|
+
(check) =>
|
|
543
|
+
check._zod?.def?.check === kind &&
|
|
544
|
+
Number(check._zod.def.value) === value,
|
|
545
|
+
);
|
|
546
|
+
if (
|
|
547
|
+
json.maximum === Number.MAX_SAFE_INTEGER &&
|
|
548
|
+
!explicitBound('less_than', Number.MAX_SAFE_INTEGER)
|
|
549
|
+
) {
|
|
550
|
+
delete json.maximum;
|
|
551
|
+
}
|
|
552
|
+
if (
|
|
553
|
+
json.minimum === Number.MIN_SAFE_INTEGER &&
|
|
554
|
+
!explicitBound('greater_than', Number.MIN_SAFE_INTEGER)
|
|
555
|
+
) {
|
|
556
|
+
delete json.minimum;
|
|
557
|
+
}
|
|
558
|
+
}
|
|
559
|
+
if (def.type === 'pipe') {
|
|
560
|
+
const outJson = convertEmbedded(def.out);
|
|
561
|
+
const outKeys = Object.keys(outJson).filter(
|
|
562
|
+
(key) => key !== 'x-sdkit-embedded-root',
|
|
563
|
+
);
|
|
564
|
+
if (outKeys.length > 0) {
|
|
565
|
+
const inJson = { ...json };
|
|
566
|
+
for (const key of Object.keys(json)) delete json[key];
|
|
567
|
+
json.allOf = [inJson, outJson];
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
if (def.type === 'tuple' && Array.isArray(json.items)) {
|
|
571
|
+
if (json.minItems === undefined) {
|
|
572
|
+
json.minItems = json.items.length;
|
|
573
|
+
}
|
|
574
|
+
if (
|
|
575
|
+
json.additionalItems === undefined &&
|
|
576
|
+
json.maxItems === undefined
|
|
577
|
+
) {
|
|
578
|
+
json.maxItems = json.items.length;
|
|
579
|
+
}
|
|
580
|
+
}
|
|
254
581
|
},
|
|
255
582
|
});
|
|
256
583
|
}`,
|
|
257
|
-
`
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
584
|
+
`let zodSchema;
|
|
585
|
+
let rawResult;
|
|
586
|
+
try {
|
|
587
|
+
zodSchema = ${removeUnsupportedMethods(schema)};
|
|
588
|
+
maskBigIntDefaults(zodSchema);
|
|
589
|
+
const { $schema, ...converted } = toJsonSchema(zodSchema);
|
|
590
|
+
rawResult = converted;
|
|
591
|
+
} finally {
|
|
592
|
+
// The v3 shims exist only while the analyzed source evaluates and
|
|
593
|
+
// converts (lazy getters can call them mid-conversion); remove them so
|
|
594
|
+
// the shared zod instance is not left with v3 API surface process-wide.
|
|
595
|
+
for (const method of installedShims) delete stringProto[method];
|
|
596
|
+
}
|
|
597
|
+
unmaskBigIntDefaults(rawResult);
|
|
598
|
+
const result = normalizeSchema(
|
|
599
|
+
inlineDefinitions(resolveEmbeddedDocs(rawResult)),
|
|
600
|
+
);`,
|
|
601
|
+
`const innerDef = unwrapSchemaDef(zodSchema._zod.def);
|
|
261
602
|
if (innerDef?.coerce && !result['x-zod-type']) {
|
|
262
|
-
const zodType = 'coerce-' + innerDef.
|
|
263
|
-
if (!applyZodType(result, zodType, innerDef.
|
|
603
|
+
const zodType = 'coerce-' + innerDef.type;
|
|
604
|
+
if (!applyZodType(result, zodType, innerDef.type)) {
|
|
264
605
|
result['x-zod-type'] = zodType;
|
|
265
606
|
}
|
|
266
607
|
}`,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../src/lib/zod-jsonschema.ts"],
|
|
4
|
-
"sourcesContent": ["export type InjectImport = {\n import: string;\n from: string;\n};\n\nfunction removeUnsupportedMethods(schema: string) {\n return schema\n .replaceAll('.instanceof(File)', '.string().base64()')\n .replaceAll('.instanceof(Blob)', '.string().base64()')\n .replaceAll('.custom<File>()', '.string().base64()')\n .replaceAll('.custom<Blob>()', '.string().base64()');\n}\n\nexport async function evalZod(schema: string, imports: InjectImport[] = []) {\n // https://github.com/nodejs/node/issues/51956\n const lines = [\n `import { createRequire } from \"node:module\";`,\n `const filename = \"${import.meta.url}\";`,\n `const require = createRequire(filename);`,\n `const z = require(\"zod\");`,\n ...imports.map((imp) => `const ${imp.import} = require('${imp.from}');`),\n `const {zodToJsonSchema, ignoreOverride} = require('zod-to-json-schema');`,\n `let optional = false;`,\n `function unwrapSchemaDef(def) {\n while (def) {\n if (\n def.typeName === 'ZodOptional' ||\n def.typeName === 'ZodDefault' ||\n def.typeName === 'ZodNullable' ||\n def.typeName === 'ZodCatch' ||\n def.typeName === 'ZodBranded' ||\n def.typeName === 'ZodReadonly'\n ) {\n def = def.innerType?._def;\n continue;\n }\n if (def.typeName === 'ZodEffects') {\n def = def.schema?._def;\n continue;\n }\n if (def.typeName === 'ZodPipeline') {\n def = def.in?._def;\n continue;\n }\n return def;\n }\n return def;\n }`,\n `function matchesDefType(schema, typeName) {\n if (!schema || typeof schema !== 'object') return false;\n if (typeName === 'ZodNumber') {\n return schema.type === 'number' || schema.type === 'integer';\n }\n if (typeName === 'ZodBigInt') {\n return schema.type === 'integer';\n }\n if (typeName === 'ZodString') {\n return schema.type === 'string';\n }\n if (typeName === 'ZodBoolean') {\n return schema.type === 'boolean';\n }\n if (typeName === 'ZodDate') {\n return schema.type === 'string' && schema.format === 'date-time';\n }\n return typeof schema.type === 'string';\n }`,\n `function applyZodType(schema, zodType, typeName) {\n if (!schema || typeof schema !== 'object') return false;\n if (schema['x-zod-type']) return true;\n if (matchesDefType(schema, typeName)) {\n schema['x-zod-type'] = zodType;\n return true;\n }\n for (const key of ['anyOf', 'oneOf', 'allOf']) {\n if (!Array.isArray(schema[key])) continue;\n const candidates = schema[key].filter(\n (candidate) => candidate && candidate.type !== 'null',\n );\n if (candidates.length === 1 && applyZodType(candidates[0], zodType, typeName)) {\n return true;\n }\n for (const candidate of candidates) {\n if (applyZodType(candidate, zodType, typeName)) {\n return true;\n }\n }\n }\n return false;\n }`,\n `function normalizeDefaultValue(value) {\n return value instanceof Date ? value.toISOString() : value;\n }`,\n `function mergeComparableValue(target, key, value) {\n if (value === undefined) return true;\n const normalized = normalizeDefaultValue(value);\n if (target[key] === undefined) {\n target[key] = normalized;\n return true;\n }\n return Object.is(target[key], normalized);\n }`,\n `function mergeLowerBound(target, key, value) {\n if (value === undefined) return true;\n if (typeof value !== 'number') return false;\n if (target[key] === undefined || value > target[key]) {\n target[key] = value;\n }\n return true;\n }`,\n `function mergeUpperBound(target, key, value) {\n if (value === undefined) return true;\n if (typeof value !== 'number') return false;\n if (target[key] === undefined || value < target[key]) {\n target[key] = value;\n }\n return true;\n }`,\n `function mergeEnumValues(target, values) {\n if (!Array.isArray(values)) return false;\n if (!Array.isArray(target.enum)) {\n target.enum = [...values];\n return true;\n }\n target.enum = target.enum.filter((candidate) =>\n values.some((value) => Object.is(candidate, value)),\n );\n return target.enum.length > 0;\n }`,\n `function isMergeablePrimitiveSchema(schema) {\n return (\n schema &&\n typeof schema === 'object' &&\n !schema.$ref &&\n !schema.anyOf &&\n !schema.oneOf &&\n !schema.allOf &&\n (schema.type === 'string' ||\n schema.type === 'boolean' ||\n schema.type === 'number' ||\n schema.type === 'integer')\n );\n }`,\n `function mergePrimitiveSchemas(schemas) {\n const merged = {};\n for (const schema of schemas) {\n if (!isMergeablePrimitiveSchema(schema)) {\n return null;\n }\n if (merged.type === undefined) {\n merged.type = schema.type;\n } else if (merged.type !== schema.type) {\n const numericPair =\n (merged.type === 'number' && schema.type === 'integer') ||\n (merged.type === 'integer' && schema.type === 'number');\n if (!numericPair) {\n return null;\n }\n merged.type = 'integer';\n }\n\n for (const [key, value] of Object.entries(schema)) {\n if (key === 'type') {\n continue;\n }\n switch (key) {\n case 'minimum':\n case 'exclusiveMinimum':\n case 'minLength':\n case 'minItems':\n case 'minProperties':\n if (!mergeLowerBound(merged, key, value)) {\n return null;\n }\n break;\n case 'maximum':\n case 'exclusiveMaximum':\n case 'maxLength':\n case 'maxItems':\n case 'maxProperties':\n if (!mergeUpperBound(merged, key, value)) {\n return null;\n }\n break;\n case 'enum':\n if (!mergeEnumValues(merged, value)) {\n return null;\n }\n break;\n default:\n if (!mergeComparableValue(merged, key, value)) {\n return null;\n }\n }\n }\n }\n return merged;\n }`,\n `function normalizeSchema(schema) {\n if (!schema || typeof schema !== 'object') {\n return schema;\n }\n\n if (schema.default !== undefined) {\n schema.default = normalizeDefaultValue(schema.default);\n }\n\n if (Array.isArray(schema.items)) {\n schema.items = schema.items.map((item) => normalizeSchema(item));\n } else if (schema.items && typeof schema.items === 'object') {\n schema.items = normalizeSchema(schema.items);\n }\n\n if (schema.properties && typeof schema.properties === 'object') {\n for (const [key, value] of Object.entries(schema.properties)) {\n schema.properties[key] = normalizeSchema(value);\n }\n }\n\n if (\n schema.additionalProperties &&\n typeof schema.additionalProperties === 'object'\n ) {\n schema.additionalProperties = normalizeSchema(schema.additionalProperties);\n }\n\n for (const key of ['anyOf', 'oneOf', 'allOf']) {\n if (!Array.isArray(schema[key])) continue;\n schema[key] = schema[key].map((candidate) => normalizeSchema(candidate));\n }\n\n if (Array.isArray(schema.allOf)) {\n const merged = mergePrimitiveSchemas(schema.allOf);\n if (merged) {\n const { allOf, ...rest } = schema;\n return { ...rest, ...merged };\n }\n }\n\n return schema;\n }`,\n `function toJsonSchema(schema) {\n return zodToJsonSchema(schema, {\n $refStrategy: 'root',\n basePath: ['#', 'components', 'schemas'],\n target: 'jsonSchema7',\n base64Strategy: 'format:binary',\n effectStrategy: 'input',\n override: (def) => {\n if (def.typeName === 'ZodOptional') {\n\t\t\t\t\t\toptional = true;\n\t\t\t\t\t\tconst { $schema, ...result } = toJsonSchema(def.innerType);\n if (def.description) { result.description = def.description; }\n return result;\n }\n if (def.typeName === 'ZodDate') {\n return {\n type: 'string',\n format: 'date-time',\n 'x-zod-type': def.coerce ? 'coerce-date' : 'date',\n ...(def.description ? { description: def.description } : {}),\n };\n }\n return ignoreOverride;\n },\n });\n }`,\n `const zodSchema = ${removeUnsupportedMethods(schema)};`,\n `const { $schema, ...rawResult } = toJsonSchema(zodSchema);\n const result = normalizeSchema(rawResult);`,\n `const innerDef = unwrapSchemaDef(zodSchema._def);\n if (innerDef?.coerce && !result['x-zod-type']) {\n const zodType = 'coerce-' + innerDef.typeName.replace('Zod', '').toLowerCase();\n if (!applyZodType(result, zodType, innerDef.typeName)) {\n result['x-zod-type'] = zodType;\n }\n }`,\n `export default {schema: result, optional}`,\n ];\n\n const base64 = Buffer.from(lines.join('\\n')).toString('base64');\n return import(\n /* @vite-ignore */\n `data:text/javascript;base64,${base64}`\n ).then((mod) => mod.default);\n}\n"],
|
|
5
|
-
"mappings": "AAKA,SAAS,yBAAyB,QAAgB;AAChD,SAAO,OACJ,WAAW,qBAAqB,oBAAoB,EACpD,WAAW,qBAAqB,oBAAoB,EACpD,WAAW,mBAAmB,oBAAoB,EAClD,WAAW,mBAAmB,oBAAoB;AACvD;AAEA,eAAsB,QAAQ,QAAgB,UAA0B,CAAC,GAAG;AAE1E,QAAM,QAAQ;AAAA,IACZ;AAAA,IACA,qBAAqB,YAAY,GAAG;AAAA,IACpC;AAAA,IACA;AAAA,
|
|
4
|
+
"sourcesContent": ["export type InjectImport = {\n import: string;\n from: string;\n};\n\nfunction removeUnsupportedMethods(schema: string) {\n return schema\n .replaceAll('.instanceof(File)', '.string().base64()')\n .replaceAll('.instanceof(Blob)', '.string().base64()')\n .replaceAll('.custom<File>()', '.string().base64()')\n .replaceAll('.custom<Blob>()', '.string().base64()');\n}\n\nexport async function evalZod(schema: string, imports: InjectImport[] = []) {\n // https://github.com/nodejs/node/issues/51956\n const lines = [\n `import { createRequire } from \"node:module\";`,\n `const filename = \"${import.meta.url}\";`,\n `const require = createRequire(filename);`,\n `const z = require(\"zod\");`,\n // zod 4 removed ZodString.ip/.cidr; restore them for analyzed user source\n // that still uses the v3 spellings.\n `const stringProto = Object.getPrototypeOf(z.string());\n const installedShims = [];\n function withReceiverChecks(receiver, format) {\n return (receiver._zod.def.checks ?? []).length\n ? z.intersection(receiver, format)\n : format;\n }\n if (!stringProto.ip) {\n installedShims.push('ip');\n stringProto.ip = function (options) {\n if (options?.version === 'v4') return withReceiverChecks(this, z.ipv4());\n if (options?.version === 'v6') return withReceiverChecks(this, z.ipv6());\n return withReceiverChecks(this, z.union([z.ipv4(), z.ipv6()]));\n };\n }\n if (!stringProto.cidr) {\n installedShims.push('cidr');\n stringProto.cidr = function (options) {\n if (options?.version === 'v4') return withReceiverChecks(this, z.cidrv4());\n if (options?.version === 'v6') return withReceiverChecks(this, z.cidrv6());\n return withReceiverChecks(this, z.union([z.cidrv4(), z.cidrv6()]));\n };\n }`,\n ...imports.map((imp) => `const ${imp.import} = require('${imp.from}');`),\n `let optional = false;`,\n `const WRAPPER_TYPES = new Set([\n 'optional',\n 'nullable',\n 'default',\n 'prefault',\n 'catch',\n 'readonly',\n 'nonoptional',\n ]);`,\n `function unwrapSchemaDef(def) {\n while (def) {\n if (WRAPPER_TYPES.has(def.type)) {\n def = def.innerType?._zod?.def;\n continue;\n }\n if (def.type === 'pipe') {\n def = def.in?._zod?.def;\n continue;\n }\n return def;\n }\n return def;\n }`,\n `function matchesDefType(schema, defType) {\n if (!schema || typeof schema !== 'object') return false;\n if (defType === 'number') {\n return schema.type === 'number' || schema.type === 'integer';\n }\n if (defType === 'bigint') {\n return schema.type === 'integer';\n }\n if (defType === 'string') {\n return schema.type === 'string';\n }\n if (defType === 'boolean') {\n return schema.type === 'boolean';\n }\n if (defType === 'date') {\n return schema.type === 'string' && schema.format === 'date-time';\n }\n return typeof schema.type === 'string';\n }`,\n `function applyZodType(schema, zodType, defType) {\n if (!schema || typeof schema !== 'object') return false;\n if (schema['x-zod-type']) return true;\n if (matchesDefType(schema, defType)) {\n schema['x-zod-type'] = zodType;\n return true;\n }\n for (const key of ['anyOf', 'oneOf', 'allOf']) {\n if (!Array.isArray(schema[key])) continue;\n const candidates = schema[key].filter(\n (candidate) => candidate && candidate.type !== 'null',\n );\n if (candidates.length === 1 && applyZodType(candidates[0], zodType, defType)) {\n return true;\n }\n for (const candidate of candidates) {\n if (applyZodType(candidate, zodType, defType)) {\n return true;\n }\n }\n }\n return false;\n }`,\n `const BIGINT_SENTINEL = '__sdkit_bigint__';`,\n // zod v4 JSON-round-trips default values before the override callback\n // runs, which throws on bigint. Mask them as sentinel strings up front\n // and restore after conversion.\n `function maskBigIntDefaults(schema, seen = new Set()) {\n if (!schema || !schema._zod || seen.has(schema)) return;\n seen.add(schema);\n const def = schema._zod.def;\n if (\n (def.type === 'default' || def.type === 'prefault') &&\n typeof def.defaultValue === 'bigint'\n ) {\n Object.defineProperty(def, 'defaultValue', {\n value: BIGINT_SENTINEL + def.defaultValue.toString(),\n configurable: true,\n });\n }\n for (const key of ['innerType', 'in', 'out', 'element', 'valueType', 'keyType', 'left', 'right', 'catchall', 'rest']) {\n if (def[key]) maskBigIntDefaults(def[key], seen);\n }\n if (typeof def.getter === 'function') {\n const inner = def.getter();\n maskBigIntDefaults(inner, seen);\n Object.defineProperty(def, 'getter', {\n value: () => inner,\n configurable: true,\n });\n }\n if (def.shape) {\n for (const value of Object.values(def.shape)) maskBigIntDefaults(value, seen);\n }\n if (Array.isArray(def.options)) {\n for (const option of def.options) maskBigIntDefaults(option, seen);\n }\n if (Array.isArray(def.items)) {\n for (const item of def.items) maskBigIntDefaults(item, seen);\n }\n }`,\n // int64 is a plain number in sdk-it, so masked bigint defaults unmask to\n // JS numbers \u2014 the spec stays plain JSON with no bigint values to trip up\n // JSON.stringify.\n `function unmaskBigIntDefaults(schema) {\n if (!schema || typeof schema !== 'object') return;\n for (const [key, value] of Object.entries(schema)) {\n if (typeof value === 'string' && value.startsWith(BIGINT_SENTINEL)) {\n schema[key] = Number(value.slice(BIGINT_SENTINEL.length));\n } else if (Array.isArray(value)) {\n value.forEach(unmaskBigIntDefaults);\n } else if (value && typeof value === 'object') {\n unmaskBigIntDefaults(value);\n }\n }\n }`,\n `function hasExplicitRegexCheck(def) {\n return (def.checks ?? []).some(\n (check) => check._zod?.def?.format === 'regex',\n );\n }`,\n `const STANDARD_STRING_FORMATS = new Set([\n 'email',\n 'uri',\n 'url',\n 'uuid',\n 'guid',\n 'date-time',\n 'date',\n 'time',\n 'duration',\n 'ipv4',\n 'ipv6',\n 'hostname',\n 'binary',\n ]);`,\n // Nonstandard formats that sdk-it's own converters map to semantic zod\n // validators. Keep both keys: format for our converters, pattern for\n // third-party validators that do not recognize the format.\n `const MAPPED_NONSTANDARD_FORMATS = new Set(['cidrv4', 'cidrv6']);`,\n `function normalizeDefaultValue(value) {\n return value instanceof Date ? value.toISOString() : value;\n }`,\n `function mergeComparableValue(target, key, value) {\n if (value === undefined) return true;\n const normalized = normalizeDefaultValue(value);\n if (target[key] === undefined) {\n target[key] = normalized;\n return true;\n }\n return Object.is(target[key], normalized);\n }`,\n `function mergeLowerBound(target, key, value) {\n if (value === undefined) return true;\n if (typeof value !== 'number') return false;\n if (target[key] === undefined || value > target[key]) {\n target[key] = value;\n }\n return true;\n }`,\n `function mergeUpperBound(target, key, value) {\n if (value === undefined) return true;\n if (typeof value !== 'number') return false;\n if (target[key] === undefined || value < target[key]) {\n target[key] = value;\n }\n return true;\n }`,\n `function mergeEnumValues(target, values) {\n if (!Array.isArray(values)) return false;\n if (!Array.isArray(target.enum)) {\n target.enum = [...values];\n return true;\n }\n target.enum = target.enum.filter((candidate) =>\n values.some((value) => Object.is(candidate, value)),\n );\n return target.enum.length > 0;\n }`,\n `function isMergeablePrimitiveSchema(schema) {\n return (\n schema &&\n typeof schema === 'object' &&\n !schema.$ref &&\n !schema.anyOf &&\n !schema.oneOf &&\n !schema.allOf &&\n (schema.type === 'string' ||\n schema.type === 'boolean' ||\n schema.type === 'number' ||\n schema.type === 'integer')\n );\n }`,\n `function mergePrimitiveSchemas(schemas) {\n const merged = {};\n for (const schema of schemas) {\n if (\n schema &&\n typeof schema === 'object' &&\n Object.keys(schema).length === 0\n ) {\n continue;\n }\n if (!isMergeablePrimitiveSchema(schema)) {\n return null;\n }\n if (merged.type === undefined) {\n merged.type = schema.type;\n } else if (merged.type !== schema.type) {\n const numericPair =\n (merged.type === 'number' && schema.type === 'integer') ||\n (merged.type === 'integer' && schema.type === 'number');\n if (!numericPair) {\n return null;\n }\n merged.type = 'integer';\n }\n\n for (const [key, value] of Object.entries(schema)) {\n if (key === 'type') {\n continue;\n }\n switch (key) {\n case 'minimum':\n case 'exclusiveMinimum':\n case 'minLength':\n case 'minItems':\n case 'minProperties':\n if (!mergeLowerBound(merged, key, value)) {\n return null;\n }\n break;\n case 'maximum':\n case 'exclusiveMaximum':\n case 'maxLength':\n case 'maxItems':\n case 'maxProperties':\n if (!mergeUpperBound(merged, key, value)) {\n return null;\n }\n break;\n case 'enum':\n if (!mergeEnumValues(merged, value)) {\n return null;\n }\n break;\n default:\n if (!mergeComparableValue(merged, key, value)) {\n return null;\n }\n }\n }\n }\n return merged;\n }`,\n `function normalizeSchema(schema, isIntersectionMember = false) {\n if (!schema || typeof schema !== 'object') {\n return schema;\n }\n\n if (schema.default !== undefined) {\n schema.default = normalizeDefaultValue(schema.default);\n }\n\n if (Array.isArray(schema.items)) {\n schema.items = schema.items.map((item) => normalizeSchema(item));\n } else if (schema.items && typeof schema.items === 'object') {\n schema.items = normalizeSchema(schema.items);\n }\n\n if (schema.properties && typeof schema.properties === 'object') {\n for (const [key, value] of Object.entries(schema.properties)) {\n schema.properties[key] = normalizeSchema(value);\n }\n }\n\n if (\n schema.additionalProperties &&\n typeof schema.additionalProperties === 'object'\n ) {\n schema.additionalProperties = normalizeSchema(schema.additionalProperties);\n }\n\n for (const key of ['anyOf', 'oneOf', 'allOf']) {\n if (!Array.isArray(schema[key])) continue;\n schema[key] = schema[key].map((candidate) =>\n normalizeSchema(candidate, key === 'allOf'),\n );\n }\n\n if (Array.isArray(schema.oneOf) && !schema.anyOf) {\n schema.anyOf = schema.oneOf;\n delete schema.oneOf;\n }\n\n if (\n Array.isArray(schema.anyOf) &&\n schema.anyOf.every(\n (member) =>\n member &&\n typeof member === 'object' &&\n Object.keys(member).length === 1 &&\n typeof member.type === 'string',\n )\n ) {\n const { anyOf, ...rest } = schema;\n schema = { ...rest, type: anyOf.map((member) => member.type) };\n }\n\n if (\n schema.type === 'object' &&\n schema.properties &&\n schema.additionalProperties === undefined &&\n !isIntersectionMember\n ) {\n schema.additionalProperties = false;\n }\n\n if (\n schema.type === 'object' &&\n schema.propertyNames &&\n JSON.stringify(schema.propertyNames) === '{\"type\":\"string\"}'\n ) {\n delete schema.propertyNames;\n }\n\n if (\n typeof schema.$ref === 'string' &&\n !schema.$ref.startsWith('#/components/schemas')\n ) {\n schema.$ref =\n schema.$ref === '#'\n ? '#/components/schemas'\n : schema.$ref.replace(/^#\\\\//, '#/components/schemas/');\n }\n\n if (Array.isArray(schema.allOf)) {\n const merged = mergePrimitiveSchemas(schema.allOf);\n if (merged) {\n const { allOf, ...rest } = schema;\n return { ...rest, ...merged };\n }\n if (schema.allOf.length === 1 && Object.keys(schema).length === 1) {\n return schema.allOf[0];\n }\n }\n\n return schema;\n }`,\n `function escapePointerSegment(segment) {\n return String(segment).replaceAll('~', '~0').replaceAll('/', '~1');\n }`,\n `function componentPointer(path) {\n return ['#', 'components', 'schemas', ...path.map(escapePointerSegment)].join('/');\n }`,\n // Nested toJsonSchema passes (set/map values, pipe outputs) return\n // self-contained draft-7 documents whose '#' and '#/definitions/*' refs\n // are relative to the embedded document root, not the outer schema.\n // Resolve them to outer-root structural pointers before the outer\n // definitions/normalize passes rewrite them into dangling refs.\n `function resolveEmbeddedDocs(root) {\n function process(node, path, docRoot) {\n if (!node || typeof node !== 'object') return;\n if (Array.isArray(node)) {\n node.forEach((item, index) => process(item, [...path, index], docRoot));\n return;\n }\n if (node['x-sdkit-embedded-root']) {\n delete node['x-sdkit-embedded-root'];\n const defs = node.definitions ?? Object.create(null);\n delete node.definitions;\n docRoot = { path, defs, firstSite: Object.create(null) };\n }\n if (docRoot && typeof node.$ref === 'string') {\n if (node.$ref === '#') {\n node.$ref = componentPointer(docRoot.path);\n return;\n }\n const match = node.$ref.match(/^#\\\\/definitions\\\\/(.+)$/);\n if (match) {\n const name = match[1];\n if (name in docRoot.firstSite) {\n node.$ref = docRoot.firstSite[name];\n return;\n }\n docRoot.firstSite[name] = componentPointer(path);\n delete node.$ref;\n Object.assign(node, docRoot.defs[name]);\n }\n }\n for (const [key, value] of Object.entries(node)) {\n process(value, [...path, key], docRoot);\n }\n }\n process(root, [], null);\n return root;\n }`,\n // zod v4 breaks non-root cycles with a draft-7 definitions block plus\n // #/definitions/* refs, which OpenAPI consumers cannot resolve. Inline\n // each definition at its first use site and point the remaining\n // (recursive) refs structurally at that site, mirroring the v3\n // $refStrategy: 'root' output.\n `function inlineDefinitions(root) {\n const defs = root.definitions;\n if (!defs || typeof defs !== 'object') return root;\n delete root.definitions;\n const firstSite = Object.create(null);\n function walk(node, path) {\n if (!node || typeof node !== 'object') return;\n if (Array.isArray(node)) {\n node.forEach((item, index) => walk(item, [...path, index]));\n return;\n }\n const match =\n typeof node.$ref === 'string' &&\n node.$ref.match(/^#\\\\/definitions\\\\/(.+)$/);\n if (match) {\n const name = match[1];\n if (name in firstSite) {\n node.$ref = firstSite[name];\n return;\n }\n firstSite[name] = componentPointer(path);\n delete node.$ref;\n Object.assign(node, defs[name]);\n }\n for (const [key, value] of Object.entries(node)) {\n walk(value, [...path, key]);\n }\n }\n walk(root, []);\n return root;\n }`,\n // Wraps nested conversions: when the embedded document carries refs or a\n // definitions block, tag its root so resolveEmbeddedDocs can rebase them.\n `function convertEmbedded(schema) {\n const { $schema: _ignored, ...doc } = toJsonSchema(schema);\n if (doc.definitions || JSON.stringify(doc).includes('\"$ref\"')) {\n doc['x-sdkit-embedded-root'] = true;\n }\n return doc;\n }`,\n `function toJsonSchema(schema) {\n return z.toJSONSchema(schema, {\n target: 'draft-7',\n io: 'input',\n unrepresentable: 'any',\n override(ctx) {\n const def = ctx.zodSchema._zod.def;\n const json = ctx.jsonSchema;\n if (def.type === 'optional') {\n optional = true;\n }\n if (def.type === 'catch') {\n delete json.default;\n }\n if (def.type === 'date') {\n json.type = 'string';\n json.format = 'date-time';\n json['x-zod-type'] = def.coerce ? 'coerce-date' : 'date';\n }\n if (def.type === 'bigint') {\n json.type = 'integer';\n // z.bigint() carries no format; treat it as int64.\n json.format = ctx.zodSchema._zod.bag.format ?? 'int64';\n if (def.coerce) {\n json['x-zod-type'] = 'coerce-bigint';\n }\n }\n if (def.type === 'set') {\n json.type = 'array';\n json.uniqueItems = true;\n json.items = convertEmbedded(def.valueType);\n }\n if (def.type === 'map') {\n json.type = 'array';\n json.items = {\n type: 'array',\n items: [convertEmbedded(def.keyType), convertEmbedded(def.valueType)],\n minItems: 2,\n maxItems: 2,\n };\n }\n if (def.type === 'string' && json.format === 'base64') {\n json.format = 'binary';\n delete json.pattern;\n delete json.contentEncoding;\n }\n if (\n def.type === 'string' &&\n json.format &&\n json.pattern &&\n !hasExplicitRegexCheck(def)\n ) {\n if (STANDARD_STRING_FORMATS.has(json.format)) {\n delete json.pattern;\n } else if (!MAPPED_NONSTANDARD_FORMATS.has(json.format)) {\n delete json.format;\n }\n }\n if (def.type === 'number') {\n const explicitBound = (kind, value) =>\n (def.checks ?? []).some(\n (check) =>\n check._zod?.def?.check === kind &&\n Number(check._zod.def.value) === value,\n );\n if (\n json.maximum === Number.MAX_SAFE_INTEGER &&\n !explicitBound('less_than', Number.MAX_SAFE_INTEGER)\n ) {\n delete json.maximum;\n }\n if (\n json.minimum === Number.MIN_SAFE_INTEGER &&\n !explicitBound('greater_than', Number.MIN_SAFE_INTEGER)\n ) {\n delete json.minimum;\n }\n }\n if (def.type === 'pipe') {\n const outJson = convertEmbedded(def.out);\n const outKeys = Object.keys(outJson).filter(\n (key) => key !== 'x-sdkit-embedded-root',\n );\n if (outKeys.length > 0) {\n const inJson = { ...json };\n for (const key of Object.keys(json)) delete json[key];\n json.allOf = [inJson, outJson];\n }\n }\n if (def.type === 'tuple' && Array.isArray(json.items)) {\n if (json.minItems === undefined) {\n json.minItems = json.items.length;\n }\n if (\n json.additionalItems === undefined &&\n json.maxItems === undefined\n ) {\n json.maxItems = json.items.length;\n }\n }\n },\n });\n }`,\n `let zodSchema;\n let rawResult;\n try {\n zodSchema = ${removeUnsupportedMethods(schema)};\n maskBigIntDefaults(zodSchema);\n const { $schema, ...converted } = toJsonSchema(zodSchema);\n rawResult = converted;\n } finally {\n // The v3 shims exist only while the analyzed source evaluates and\n // converts (lazy getters can call them mid-conversion); remove them so\n // the shared zod instance is not left with v3 API surface process-wide.\n for (const method of installedShims) delete stringProto[method];\n }\n unmaskBigIntDefaults(rawResult);\n const result = normalizeSchema(\n inlineDefinitions(resolveEmbeddedDocs(rawResult)),\n );`,\n `const innerDef = unwrapSchemaDef(zodSchema._zod.def);\n if (innerDef?.coerce && !result['x-zod-type']) {\n const zodType = 'coerce-' + innerDef.type;\n if (!applyZodType(result, zodType, innerDef.type)) {\n result['x-zod-type'] = zodType;\n }\n }`,\n `export default {schema: result, optional}`,\n ];\n\n const base64 = Buffer.from(lines.join('\\n')).toString('base64');\n return import(\n /* @vite-ignore */\n `data:text/javascript;base64,${base64}`\n ).then((mod) => mod.default);\n}\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sdk-it/core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.44.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -29,13 +29,12 @@
|
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"debug": "^4.4.0",
|
|
31
31
|
"stringcase": "^4.3.1",
|
|
32
|
-
"lodash-es": "^4.17.21"
|
|
33
|
-
"zod-to-json-schema": "^3.24.6"
|
|
32
|
+
"lodash-es": "^4.17.21"
|
|
34
33
|
},
|
|
35
34
|
"peerDependencies": {
|
|
36
35
|
"typescript": "^5.8.3",
|
|
37
36
|
"openapi3-ts": "^4.4.0",
|
|
38
|
-
"zod": "^
|
|
37
|
+
"zod": "^4.3.0"
|
|
39
38
|
},
|
|
40
39
|
"devDependencies": {
|
|
41
40
|
"@types/debug": "^4.1.12"
|