zod-nest 3.2.3 → 3.2.4
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/{chunk-7IPDYJNI.mjs → chunk-2NVNXIOY.mjs} +2 -2
- package/dist/chunk-2NVNXIOY.mjs.map +1 -0
- package/dist/{chunk-DUQLL62I.js → chunk-KNXYA5ER.js} +2 -2
- package/dist/chunk-KNXYA5ER.js.map +1 -0
- package/dist/{chunk-6FL3HR4I.js → chunk-N3VWL7G7.js} +10 -10
- package/dist/{chunk-6FL3HR4I.js.map → chunk-N3VWL7G7.js.map} +1 -1
- package/dist/{chunk-47ML6LKE.mjs → chunk-VSI3SF7S.mjs} +3 -3
- package/dist/{chunk-47ML6LKE.mjs.map → chunk-VSI3SF7S.mjs.map} +1 -1
- package/dist/express/index.d.mts +3 -3
- package/dist/express/index.d.ts +3 -3
- package/dist/express/index.js +9 -9
- package/dist/express/index.mjs +3 -3
- package/dist/fastify/index.d.mts +3 -3
- package/dist/fastify/index.d.ts +3 -3
- package/dist/fastify/index.js +6 -6
- package/dist/fastify/index.mjs +3 -3
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +86 -75
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +14 -3
- package/dist/index.mjs.map +1 -1
- package/dist/{param-decorators-Dfd2Cy08.d.mts → param-decorators-1UCi-qHq.d.mts} +1 -1
- package/dist/{param-decorators-23pStLeF.d.ts → param-decorators-CcuRJZXu.d.ts} +1 -1
- package/dist/{registry-Cs1Y0a-L.d.mts → registry-D99yMzJg.d.mts} +3 -2
- package/dist/{registry-Cs1Y0a-L.d.ts → registry-D99yMzJg.d.ts} +3 -2
- package/package.json +1 -1
- package/dist/chunk-7IPDYJNI.mjs.map +0 -1
- package/dist/chunk-DUQLL62I.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkKNXYA5ER_js = require('./chunk-KNXYA5ER.js');
|
|
4
4
|
var chunkEV5I5HGT_js = require('./chunk-EV5I5HGT.js');
|
|
5
5
|
var common = require('@nestjs/common');
|
|
6
6
|
var zod = require('zod');
|
|
@@ -39,7 +39,7 @@ var buildSiblingClass = /* @__PURE__ */ chunkEV5I5HGT_js.__name((parent, schema)
|
|
|
39
39
|
}
|
|
40
40
|
static schema = schema;
|
|
41
41
|
static io = "output";
|
|
42
|
-
static [
|
|
42
|
+
static [chunkKNXYA5ER_js.ZOD_DTO_SYMBOL] = true;
|
|
43
43
|
static get id() {
|
|
44
44
|
return parent.id;
|
|
45
45
|
}
|
|
@@ -54,7 +54,7 @@ var buildSiblingClass = /* @__PURE__ */ chunkEV5I5HGT_js.__name((parent, schema)
|
|
|
54
54
|
}
|
|
55
55
|
static _OPENAPI_METADATA_FACTORY() {
|
|
56
56
|
return {
|
|
57
|
-
[
|
|
57
|
+
[chunkKNXYA5ER_js.ZOD_NEST_DTO_EXTENSION]: makeZodDtoMarker(parent.id, "output")
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
60
|
};
|
|
@@ -92,14 +92,14 @@ var resolveFallbackId = /* @__PURE__ */ chunkEV5I5HGT_js.__name((className) => {
|
|
|
92
92
|
return fallback;
|
|
93
93
|
}, "resolveFallbackId");
|
|
94
94
|
var createZodDto = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema, options) => {
|
|
95
|
-
const registry = options?.registry ??
|
|
95
|
+
const registry = options?.registry ?? chunkKNXYA5ER_js.defaultRegistry;
|
|
96
96
|
const io = "input";
|
|
97
97
|
let cachedId;
|
|
98
98
|
const ensureRegistered = /* @__PURE__ */ chunkEV5I5HGT_js.__name((className) => {
|
|
99
99
|
if (cachedId !== void 0) {
|
|
100
100
|
return cachedId;
|
|
101
101
|
}
|
|
102
|
-
const named =
|
|
102
|
+
const named = chunkKNXYA5ER_js.registerSchema(schema, registry, {
|
|
103
103
|
id: options?.id,
|
|
104
104
|
expose: options?.expose
|
|
105
105
|
});
|
|
@@ -119,7 +119,7 @@ var createZodDto = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema, options) =>
|
|
|
119
119
|
}
|
|
120
120
|
static schema = schema;
|
|
121
121
|
static io = io;
|
|
122
|
-
static [
|
|
122
|
+
static [chunkKNXYA5ER_js.ZOD_DTO_SYMBOL] = true;
|
|
123
123
|
static get id() {
|
|
124
124
|
return ensureRegistered(this.name);
|
|
125
125
|
}
|
|
@@ -134,7 +134,7 @@ var createZodDto = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema, options) =>
|
|
|
134
134
|
}
|
|
135
135
|
static _OPENAPI_METADATA_FACTORY() {
|
|
136
136
|
return {
|
|
137
|
-
[
|
|
137
|
+
[chunkKNXYA5ER_js.ZOD_NEST_DTO_EXTENSION]: makeZodDtoMarker(ensureRegistered(this.name), io)
|
|
138
138
|
};
|
|
139
139
|
}
|
|
140
140
|
};
|
|
@@ -420,7 +420,7 @@ function _ts_param(paramIndex, decorator) {
|
|
|
420
420
|
chunkEV5I5HGT_js.__name(_ts_param, "_ts_param");
|
|
421
421
|
var isZodSchema2 = /* @__PURE__ */ chunkEV5I5HGT_js.__name((value) => value !== null && typeof value === "object" && "_zod" in value, "isZodSchema");
|
|
422
422
|
var isOptionsObject = /* @__PURE__ */ chunkEV5I5HGT_js.__name((value) => value !== null && typeof value === "object" && !isZodSchema2(value), "isOptionsObject");
|
|
423
|
-
var defaultExceptionFactory = /* @__PURE__ */ chunkEV5I5HGT_js.__name((zodError, argMetadata) => new
|
|
423
|
+
var defaultExceptionFactory = /* @__PURE__ */ chunkEV5I5HGT_js.__name((zodError, argMetadata) => new chunkKNXYA5ER_js.ZodValidationException(zodError, argMetadata), "defaultExceptionFactory");
|
|
424
424
|
exports.ZodValidationPipe = class _ZodValidationPipe {
|
|
425
425
|
static {
|
|
426
426
|
chunkEV5I5HGT_js.__name(this, "ZodValidationPipe");
|
|
@@ -458,7 +458,7 @@ exports.ZodValidationPipe = class _ZodValidationPipe {
|
|
|
458
458
|
return this.explicitSchema;
|
|
459
459
|
}
|
|
460
460
|
const metatype = metadata.metatype;
|
|
461
|
-
if (!
|
|
461
|
+
if (!chunkKNXYA5ER_js.isZodDto(metatype)) {
|
|
462
462
|
return void 0;
|
|
463
463
|
}
|
|
464
464
|
return metatype.schema;
|
|
@@ -468,7 +468,7 @@ exports.ZodValidationPipe = class _ZodValidationPipe {
|
|
|
468
468
|
return this.explicitDtoName;
|
|
469
469
|
}
|
|
470
470
|
const metatype = metadata.metatype;
|
|
471
|
-
if (
|
|
471
|
+
if (chunkKNXYA5ER_js.isZodDto(metatype)) {
|
|
472
472
|
return metatype.name;
|
|
473
473
|
}
|
|
474
474
|
return "schema";
|
|
@@ -481,7 +481,7 @@ exports.ZodValidationPipe = class _ZodValidationPipe {
|
|
|
481
481
|
dtoName: void 0
|
|
482
482
|
};
|
|
483
483
|
}
|
|
484
|
-
if (
|
|
484
|
+
if (chunkKNXYA5ER_js.isZodDto(arg)) {
|
|
485
485
|
return {
|
|
486
486
|
schema: arg.schema,
|
|
487
487
|
factory: void 0,
|
|
@@ -503,8 +503,8 @@ exports.ZodValidationPipe = class _ZodValidationPipe {
|
|
|
503
503
|
};
|
|
504
504
|
}
|
|
505
505
|
const optionSchema = arg.schema;
|
|
506
|
-
const dtoName =
|
|
507
|
-
const resolvedSchema =
|
|
506
|
+
const dtoName = chunkKNXYA5ER_js.isZodDto(optionSchema) ? optionSchema.name : void 0;
|
|
507
|
+
const resolvedSchema = chunkKNXYA5ER_js.isZodDto(optionSchema) ? optionSchema.schema : optionSchema;
|
|
508
508
|
return {
|
|
509
509
|
schema: resolvedSchema,
|
|
510
510
|
factory: arg.createValidationException,
|
|
@@ -560,14 +560,14 @@ var schemaToOutputDto = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema) => {
|
|
|
560
560
|
if (cached !== void 0) {
|
|
561
561
|
return cached;
|
|
562
562
|
}
|
|
563
|
-
const namedId =
|
|
563
|
+
const namedId = chunkKNXYA5ER_js.registerSchema(schema);
|
|
564
564
|
if (namedId !== void 0) {
|
|
565
565
|
const dto2 = createZodDto(schema).Output;
|
|
566
566
|
responseDtoCache.set(schema, dto2);
|
|
567
567
|
return dto2;
|
|
568
568
|
}
|
|
569
|
-
const anonId =
|
|
570
|
-
|
|
569
|
+
const anonId = chunkKNXYA5ER_js.resolveAnonId(schema, chunkKNXYA5ER_js.ANON_RESPONSE_PREFIX);
|
|
570
|
+
chunkKNXYA5ER_js.registerSchema(schema, chunkKNXYA5ER_js.defaultRegistry, {
|
|
571
571
|
id: anonId,
|
|
572
572
|
anonymous: true
|
|
573
573
|
});
|
|
@@ -578,10 +578,10 @@ var schemaToOutputDto = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema) => {
|
|
|
578
578
|
return dto;
|
|
579
579
|
}, "schemaToOutputDto");
|
|
580
580
|
var toResponseDto = /* @__PURE__ */ chunkEV5I5HGT_js.__name((entry, index) => {
|
|
581
|
-
if (
|
|
581
|
+
if (chunkKNXYA5ER_js.isZodDto(entry)) {
|
|
582
582
|
return entry;
|
|
583
583
|
}
|
|
584
|
-
if (
|
|
584
|
+
if (chunkKNXYA5ER_js.isZodSchema(entry)) {
|
|
585
585
|
return schemaToOutputDto(entry);
|
|
586
586
|
}
|
|
587
587
|
const where = index === void 0 ? "@ZodResponse({ type })" : `@ZodResponse({ type }) element [${index}]`;
|
|
@@ -774,9 +774,9 @@ var ZodBody = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema, options) => {
|
|
|
774
774
|
}, "ZodBody");
|
|
775
775
|
var resolveBodySchema = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema, options) => {
|
|
776
776
|
if (options?.flatten === true) {
|
|
777
|
-
return
|
|
777
|
+
return chunkKNXYA5ER_js.flattenObjectIntersection(schema, options.registry ?? chunkKNXYA5ER_js.defaultRegistry, "@ZodBody");
|
|
778
778
|
}
|
|
779
|
-
return
|
|
779
|
+
return chunkKNXYA5ER_js.resolveSchemaRef(schema, {
|
|
780
780
|
id: options?.id,
|
|
781
781
|
registry: options?.registry,
|
|
782
782
|
deferAnonInline: true
|
|
@@ -811,27 +811,27 @@ var appendQueryMarker = /* @__PURE__ */ chunkEV5I5HGT_js.__name((dtoId, ref) =>
|
|
|
811
811
|
|
|
812
812
|
// src/decorators/zod-query.decorator.ts
|
|
813
813
|
var ZodQuery = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema, options) => {
|
|
814
|
-
if (!
|
|
815
|
-
throw new
|
|
814
|
+
if (!chunkKNXYA5ER_js.isZodObject(schema)) {
|
|
815
|
+
throw new chunkKNXYA5ER_js.ZodNestError(`@ZodQuery requires a \`z.object({...})\` schema (got \`${schema._zod.def.type}\`). Each property of the object becomes one OpenAPI parameter. For non-object body shapes (intersections, unions, primitives), use \`@ZodBody\` instead.`);
|
|
816
816
|
}
|
|
817
|
-
const registry = options?.registry ??
|
|
818
|
-
const id =
|
|
817
|
+
const registry = options?.registry ?? chunkKNXYA5ER_js.defaultRegistry;
|
|
818
|
+
const id = chunkKNXYA5ER_js.registerSchema(schema, registry, {
|
|
819
819
|
id: options?.id
|
|
820
820
|
});
|
|
821
821
|
if (id !== void 0) {
|
|
822
822
|
return appendQueryMarker(id, options?.ref);
|
|
823
823
|
}
|
|
824
824
|
if (options?.ref === true) {
|
|
825
|
-
throw new
|
|
825
|
+
throw new chunkKNXYA5ER_js.ZodNestError(`@ZodQuery({ ref: true }) requires a named schema \u2014 there is no component to \`$ref\`. Name the schema via \`.meta({ id: 'Foo' })\` or pass the \`id\` option, or drop \`ref\` to expand per property.`);
|
|
826
826
|
}
|
|
827
|
-
const expanded =
|
|
827
|
+
const expanded = chunkKNXYA5ER_js.expandObjectSchema(schema, {
|
|
828
828
|
id: options?.id,
|
|
829
829
|
registry,
|
|
830
830
|
decoratorName: "@ZodQuery"
|
|
831
831
|
});
|
|
832
832
|
return common.applyDecorators(...expanded.map(({ name, required, resolution }) => swagger.ApiQuery({
|
|
833
833
|
name,
|
|
834
|
-
schema:
|
|
834
|
+
schema: chunkKNXYA5ER_js.paramSchemaBody(resolution),
|
|
835
835
|
required
|
|
836
836
|
})));
|
|
837
837
|
}, "ZodQuery");
|
|
@@ -841,7 +841,7 @@ var API_PARAMETERS_KEY = "swagger/apiParameters";
|
|
|
841
841
|
|
|
842
842
|
// src/decorators/zod-headers.decorator.ts
|
|
843
843
|
var ZodHeaders = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema, options) => {
|
|
844
|
-
const expanded =
|
|
844
|
+
const expanded = chunkKNXYA5ER_js.expandObjectSchema(schema, {
|
|
845
845
|
id: options?.id,
|
|
846
846
|
registry: options?.registry,
|
|
847
847
|
decoratorName: "@ZodHeaders"
|
|
@@ -850,7 +850,7 @@ var ZodHeaders = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema, options) => {
|
|
|
850
850
|
name,
|
|
851
851
|
in: "header",
|
|
852
852
|
required,
|
|
853
|
-
schema:
|
|
853
|
+
schema: chunkKNXYA5ER_js.paramSchemaBody(resolution)
|
|
854
854
|
}));
|
|
855
855
|
return (_target, _propertyKey, descriptor) => {
|
|
856
856
|
const handler = descriptor.value;
|
|
@@ -867,7 +867,7 @@ var ZodHeaders = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema, options) => {
|
|
|
867
867
|
|
|
868
868
|
// src/decorators/zod-cookies.decorator.ts
|
|
869
869
|
var ZodCookies = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema, options) => {
|
|
870
|
-
const expanded =
|
|
870
|
+
const expanded = chunkKNXYA5ER_js.expandObjectSchema(schema, {
|
|
871
871
|
id: options?.id,
|
|
872
872
|
registry: options?.registry,
|
|
873
873
|
decoratorName: "@ZodCookies"
|
|
@@ -876,7 +876,7 @@ var ZodCookies = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema, options) => {
|
|
|
876
876
|
name,
|
|
877
877
|
in: "cookie",
|
|
878
878
|
required,
|
|
879
|
-
schema:
|
|
879
|
+
schema: chunkKNXYA5ER_js.paramSchemaBody(resolution)
|
|
880
880
|
}));
|
|
881
881
|
return (_target, _propertyKey, descriptor) => {
|
|
882
882
|
const handler = descriptor.value;
|
|
@@ -1044,8 +1044,19 @@ var bulkEmit = /* @__PURE__ */ chunkEV5I5HGT_js.__name((opts) => {
|
|
|
1044
1044
|
outputSchemas: runPass(opts, "output", knownIds)
|
|
1045
1045
|
};
|
|
1046
1046
|
}, "bulkEmit");
|
|
1047
|
+
var scopeToKnownIds = /* @__PURE__ */ chunkEV5I5HGT_js.__name((zodRegistry, knownIds) => {
|
|
1048
|
+
const scoped = zod.z.registry();
|
|
1049
|
+
for (const [id, schema] of zodRegistry._idmap) {
|
|
1050
|
+
if (knownIds.has(id)) {
|
|
1051
|
+
scoped.add(schema, {
|
|
1052
|
+
id
|
|
1053
|
+
});
|
|
1054
|
+
}
|
|
1055
|
+
}
|
|
1056
|
+
return scoped;
|
|
1057
|
+
}, "scopeToKnownIds");
|
|
1047
1058
|
var runPass = /* @__PURE__ */ chunkEV5I5HGT_js.__name((opts, io, knownIds) => {
|
|
1048
|
-
const built =
|
|
1059
|
+
const built = chunkKNXYA5ER_js.buildToJsonSchemaOptions({
|
|
1049
1060
|
registry: opts.registry,
|
|
1050
1061
|
io,
|
|
1051
1062
|
override: opts.override,
|
|
@@ -1053,7 +1064,7 @@ var runPass = /* @__PURE__ */ chunkEV5I5HGT_js.__name((opts, io, knownIds) => {
|
|
|
1053
1064
|
reused: "inline",
|
|
1054
1065
|
uri: URI
|
|
1055
1066
|
});
|
|
1056
|
-
const raw = zod.z.toJSONSchema(opts.registry.zodRegistry, built.options);
|
|
1067
|
+
const raw = zod.z.toJSONSchema(scopeToKnownIds(opts.registry.zodRegistry, knownIds), built.options);
|
|
1057
1068
|
built.consumeUnrepresentable();
|
|
1058
1069
|
const filtered = /* @__PURE__ */ new Map();
|
|
1059
1070
|
for (const [id, schema] of Object.entries(raw.schemas)) {
|
|
@@ -1152,7 +1163,7 @@ var readMarker = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema) => {
|
|
|
1152
1163
|
if (!isPlainRecord2(schema.properties)) {
|
|
1153
1164
|
return void 0;
|
|
1154
1165
|
}
|
|
1155
|
-
const marker = schema.properties[
|
|
1166
|
+
const marker = schema.properties[chunkKNXYA5ER_js.ZOD_NEST_DTO_EXTENSION];
|
|
1156
1167
|
if (!isZodDtoMarker(marker)) {
|
|
1157
1168
|
return void 0;
|
|
1158
1169
|
}
|
|
@@ -1224,10 +1235,10 @@ var collectRefFromSchema = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema, clas
|
|
|
1224
1235
|
return;
|
|
1225
1236
|
}
|
|
1226
1237
|
walkRefs(schema, (ref) => {
|
|
1227
|
-
if (!ref.startsWith(
|
|
1238
|
+
if (!ref.startsWith(chunkKNXYA5ER_js.COMPONENTS_SCHEMAS_PREFIX)) {
|
|
1228
1239
|
return void 0;
|
|
1229
1240
|
}
|
|
1230
|
-
const className = ref.slice(
|
|
1241
|
+
const className = ref.slice(chunkKNXYA5ER_js.COMPONENTS_SCHEMAS_PREFIX.length);
|
|
1231
1242
|
const renamed = classToDtoId.get(className);
|
|
1232
1243
|
if (renamed !== void 0) {
|
|
1233
1244
|
ids.add(renamed);
|
|
@@ -1263,7 +1274,7 @@ var collectRefsFromResponses = /* @__PURE__ */ chunkEV5I5HGT_js.__name((response
|
|
|
1263
1274
|
}, "collectRefsFromResponses");
|
|
1264
1275
|
|
|
1265
1276
|
// src/document/errors.ts
|
|
1266
|
-
var ZodNestDocumentError = class extends
|
|
1277
|
+
var ZodNestDocumentError = class extends chunkKNXYA5ER_js.ZodNestError {
|
|
1267
1278
|
static {
|
|
1268
1279
|
chunkEV5I5HGT_js.__name(this, "ZodNestDocumentError");
|
|
1269
1280
|
}
|
|
@@ -1283,10 +1294,10 @@ var assertNoDanglingRefs = /* @__PURE__ */ chunkEV5I5HGT_js.__name((params) => {
|
|
|
1283
1294
|
const schemas = doc.components?.schemas ?? {};
|
|
1284
1295
|
const dangling = [];
|
|
1285
1296
|
walkRefs(doc, (ref) => {
|
|
1286
|
-
if (!ref.startsWith(
|
|
1297
|
+
if (!ref.startsWith(chunkKNXYA5ER_js.COMPONENTS_SCHEMAS_PREFIX)) {
|
|
1287
1298
|
return void 0;
|
|
1288
1299
|
}
|
|
1289
|
-
const target = ref.slice(
|
|
1300
|
+
const target = ref.slice(chunkKNXYA5ER_js.COMPONENTS_SCHEMAS_PREFIX.length);
|
|
1290
1301
|
if (!(target in schemas)) {
|
|
1291
1302
|
dangling.push(ref);
|
|
1292
1303
|
}
|
|
@@ -1302,7 +1313,7 @@ ${lines.join("\n")}`, {
|
|
|
1302
1313
|
});
|
|
1303
1314
|
}, "assertNoDanglingRefs");
|
|
1304
1315
|
var hintFor = /* @__PURE__ */ chunkEV5I5HGT_js.__name((ref, collected) => {
|
|
1305
|
-
const id = ref.slice(
|
|
1316
|
+
const id = ref.slice(chunkKNXYA5ER_js.COMPONENTS_SCHEMAS_PREFIX.length);
|
|
1306
1317
|
const usedInput = collected.inputExposedIds.has(id);
|
|
1307
1318
|
const usedOutput = collected.outputExposedIds.has(id);
|
|
1308
1319
|
if (usedInput && usedOutput) {
|
|
@@ -1381,7 +1392,7 @@ var buildRefQueryParam = /* @__PURE__ */ chunkEV5I5HGT_js.__name((marker, body)
|
|
|
1381
1392
|
style: "form",
|
|
1382
1393
|
explode: true,
|
|
1383
1394
|
schema: {
|
|
1384
|
-
$ref: `${
|
|
1395
|
+
$ref: `${chunkKNXYA5ER_js.COMPONENTS_SCHEMAS_PREFIX}${marker.dtoId}`
|
|
1385
1396
|
}
|
|
1386
1397
|
};
|
|
1387
1398
|
}, "buildRefQueryParam");
|
|
@@ -1457,7 +1468,7 @@ var pruneOrphanObjectSchema = /* @__PURE__ */ chunkEV5I5HGT_js.__name((doc) => {
|
|
|
1457
1468
|
return;
|
|
1458
1469
|
}
|
|
1459
1470
|
let referenced = false;
|
|
1460
|
-
const targetRef = `${
|
|
1471
|
+
const targetRef = `${chunkKNXYA5ER_js.COMPONENTS_SCHEMAS_PREFIX}Object`;
|
|
1461
1472
|
walkRefs(doc, (ref) => {
|
|
1462
1473
|
if (ref === targetRef) {
|
|
1463
1474
|
referenced = true;
|
|
@@ -1487,10 +1498,10 @@ var closeOverRefs = /* @__PURE__ */ chunkEV5I5HGT_js.__name((seed, bodies) => {
|
|
|
1487
1498
|
continue;
|
|
1488
1499
|
}
|
|
1489
1500
|
walkRefs(body, (ref) => {
|
|
1490
|
-
if (!ref.startsWith(
|
|
1501
|
+
if (!ref.startsWith(chunkKNXYA5ER_js.COMPONENTS_SCHEMAS_PREFIX)) {
|
|
1491
1502
|
return void 0;
|
|
1492
1503
|
}
|
|
1493
|
-
const target = ref.slice(
|
|
1504
|
+
const target = ref.slice(chunkKNXYA5ER_js.COMPONENTS_SCHEMAS_PREFIX.length);
|
|
1494
1505
|
if (out.has(target)) {
|
|
1495
1506
|
return void 0;
|
|
1496
1507
|
}
|
|
@@ -1523,7 +1534,7 @@ var inlineAnonymousBodies = /* @__PURE__ */ chunkEV5I5HGT_js.__name(({ doc, regi
|
|
|
1523
1534
|
]) {
|
|
1524
1535
|
const body = schemas[key];
|
|
1525
1536
|
if (isPlainRecord4(body)) {
|
|
1526
|
-
bodyByRef.set(`${
|
|
1537
|
+
bodyByRef.set(`${chunkKNXYA5ER_js.COMPONENTS_SCHEMAS_PREFIX}${key}`, body);
|
|
1527
1538
|
}
|
|
1528
1539
|
}
|
|
1529
1540
|
}
|
|
@@ -1535,7 +1546,7 @@ var inlineAnonymousBodies = /* @__PURE__ */ chunkEV5I5HGT_js.__name(({ doc, regi
|
|
|
1535
1546
|
}
|
|
1536
1547
|
inlineRefs(doc.paths, bodyByRef);
|
|
1537
1548
|
for (const ref of bodyByRef.keys()) {
|
|
1538
|
-
delete schemas[ref.slice(
|
|
1549
|
+
delete schemas[ref.slice(chunkKNXYA5ER_js.COMPONENTS_SCHEMAS_PREFIX.length)];
|
|
1539
1550
|
}
|
|
1540
1551
|
}, "inlineAnonymousBodies");
|
|
1541
1552
|
var refsWithin = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schemas, bodyByRef) => {
|
|
@@ -1673,7 +1684,7 @@ var isMarkerPlaceholder = /* @__PURE__ */ chunkEV5I5HGT_js.__name((value) => {
|
|
|
1673
1684
|
if (properties === null || typeof properties !== "object") {
|
|
1674
1685
|
return false;
|
|
1675
1686
|
}
|
|
1676
|
-
const marker = properties[
|
|
1687
|
+
const marker = properties[chunkKNXYA5ER_js.ZOD_NEST_DTO_EXTENSION];
|
|
1677
1688
|
return isZodDtoMarker(marker);
|
|
1678
1689
|
}, "isMarkerPlaceholder");
|
|
1679
1690
|
var canonicalEqual = /* @__PURE__ */ chunkEV5I5HGT_js.__name((a, b) => {
|
|
@@ -1699,7 +1710,7 @@ var decorateIfPresent = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schemas, key) =
|
|
|
1699
1710
|
}
|
|
1700
1711
|
schemas[key] = {
|
|
1701
1712
|
description: `ERROR: duplicate zod-nest id <${key.replace(/Output$/, "")}>`,
|
|
1702
|
-
[
|
|
1713
|
+
[chunkKNXYA5ER_js.ZOD_NEST_ERROR_EXTENSION]: chunkKNXYA5ER_js.ZOD_NEST_ERROR_DUPLICATE_ID
|
|
1703
1714
|
};
|
|
1704
1715
|
}, "decorateIfPresent");
|
|
1705
1716
|
|
|
@@ -1733,8 +1744,8 @@ var addRefTitles = /* @__PURE__ */ chunkEV5I5HGT_js.__name((node, titleById) =>
|
|
|
1733
1744
|
return;
|
|
1734
1745
|
}
|
|
1735
1746
|
const ref = node.$ref;
|
|
1736
|
-
if (typeof ref === "string" && ref.startsWith(
|
|
1737
|
-
const title = titleById.get(ref.slice(
|
|
1747
|
+
if (typeof ref === "string" && ref.startsWith(chunkKNXYA5ER_js.COMPONENTS_SCHEMAS_PREFIX) && node.title === void 0) {
|
|
1748
|
+
const title = titleById.get(ref.slice(chunkKNXYA5ER_js.COMPONENTS_SCHEMAS_PREFIX.length));
|
|
1738
1749
|
if (title !== void 0) {
|
|
1739
1750
|
node.title = title;
|
|
1740
1751
|
}
|
|
@@ -1749,15 +1760,15 @@ var rewriteRefs = /* @__PURE__ */ chunkEV5I5HGT_js.__name((params) => {
|
|
|
1749
1760
|
const { doc, renames, divergentOutputIds } = params;
|
|
1750
1761
|
if (renames.size > 0) {
|
|
1751
1762
|
walkRefs(doc, (ref) => {
|
|
1752
|
-
if (!ref.startsWith(
|
|
1763
|
+
if (!ref.startsWith(chunkKNXYA5ER_js.COMPONENTS_SCHEMAS_PREFIX)) {
|
|
1753
1764
|
return void 0;
|
|
1754
1765
|
}
|
|
1755
|
-
const target = ref.slice(
|
|
1766
|
+
const target = ref.slice(chunkKNXYA5ER_js.COMPONENTS_SCHEMAS_PREFIX.length);
|
|
1756
1767
|
const renamed = renames.get(target);
|
|
1757
1768
|
if (renamed === void 0) {
|
|
1758
1769
|
return void 0;
|
|
1759
1770
|
}
|
|
1760
|
-
return `${
|
|
1771
|
+
return `${chunkKNXYA5ER_js.COMPONENTS_SCHEMAS_PREFIX}${renamed}`;
|
|
1761
1772
|
});
|
|
1762
1773
|
}
|
|
1763
1774
|
if (divergentOutputIds.size === 0) {
|
|
@@ -1782,14 +1793,14 @@ var rewriteResponseSubtree = /* @__PURE__ */ chunkEV5I5HGT_js.__name((pathItem,
|
|
|
1782
1793
|
continue;
|
|
1783
1794
|
}
|
|
1784
1795
|
walkRefs(responses, (ref) => {
|
|
1785
|
-
if (!ref.startsWith(
|
|
1796
|
+
if (!ref.startsWith(chunkKNXYA5ER_js.COMPONENTS_SCHEMAS_PREFIX)) {
|
|
1786
1797
|
return void 0;
|
|
1787
1798
|
}
|
|
1788
|
-
const target = ref.slice(
|
|
1799
|
+
const target = ref.slice(chunkKNXYA5ER_js.COMPONENTS_SCHEMAS_PREFIX.length);
|
|
1789
1800
|
if (!divergentOutputIds.has(target)) {
|
|
1790
1801
|
return void 0;
|
|
1791
1802
|
}
|
|
1792
|
-
return `${
|
|
1803
|
+
return `${chunkKNXYA5ER_js.COMPONENTS_SCHEMAS_PREFIX}${target}${OUTPUT_SUFFIX}`;
|
|
1793
1804
|
});
|
|
1794
1805
|
}
|
|
1795
1806
|
}, "rewriteResponseSubtree");
|
|
@@ -1831,10 +1842,10 @@ var stripMarkerFromSchema = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema) =>
|
|
|
1831
1842
|
return;
|
|
1832
1843
|
}
|
|
1833
1844
|
const props = properties;
|
|
1834
|
-
if (!(
|
|
1845
|
+
if (!(chunkKNXYA5ER_js.ZOD_NEST_DTO_EXTENSION in props)) {
|
|
1835
1846
|
return;
|
|
1836
1847
|
}
|
|
1837
|
-
delete props[
|
|
1848
|
+
delete props[chunkKNXYA5ER_js.ZOD_NEST_DTO_EXTENSION];
|
|
1838
1849
|
if (Object.keys(props).length === 0) {
|
|
1839
1850
|
delete schema.properties;
|
|
1840
1851
|
}
|
|
@@ -1857,7 +1868,7 @@ var withForcedExposure = /* @__PURE__ */ chunkEV5I5HGT_js.__name((collected, reg
|
|
|
1857
1868
|
}, "withForcedExposure");
|
|
1858
1869
|
var OPENAPI_VERSION = "3.1.0";
|
|
1859
1870
|
var applyZodNest = /* @__PURE__ */ chunkEV5I5HGT_js.__name((doc, opts = {}) => {
|
|
1860
|
-
const registry = opts.registry ??
|
|
1871
|
+
const registry = opts.registry ?? chunkKNXYA5ER_js.defaultRegistry;
|
|
1861
1872
|
const collected = collectUsage(doc, registry);
|
|
1862
1873
|
const exposed = withForcedExposure(collected, registry);
|
|
1863
1874
|
const { inputSchemas, outputSchemas } = bulkEmit({
|
|
@@ -1902,67 +1913,67 @@ var applyZodNest = /* @__PURE__ */ chunkEV5I5HGT_js.__name((doc, opts = {}) => {
|
|
|
1902
1913
|
|
|
1903
1914
|
Object.defineProperty(exports, "COMPONENTS_SCHEMAS_PREFIX", {
|
|
1904
1915
|
enumerable: true,
|
|
1905
|
-
get: function () { return
|
|
1916
|
+
get: function () { return chunkKNXYA5ER_js.COMPONENTS_SCHEMAS_PREFIX; }
|
|
1906
1917
|
});
|
|
1907
1918
|
Object.defineProperty(exports, "ZOD_DTO_SYMBOL", {
|
|
1908
1919
|
enumerable: true,
|
|
1909
|
-
get: function () { return
|
|
1920
|
+
get: function () { return chunkKNXYA5ER_js.ZOD_DTO_SYMBOL; }
|
|
1910
1921
|
});
|
|
1911
1922
|
Object.defineProperty(exports, "ZOD_NEST_DTO_EXTENSION", {
|
|
1912
1923
|
enumerable: true,
|
|
1913
|
-
get: function () { return
|
|
1924
|
+
get: function () { return chunkKNXYA5ER_js.ZOD_NEST_DTO_EXTENSION; }
|
|
1914
1925
|
});
|
|
1915
1926
|
Object.defineProperty(exports, "ZOD_NEST_ERROR_DUPLICATE_ID", {
|
|
1916
1927
|
enumerable: true,
|
|
1917
|
-
get: function () { return
|
|
1928
|
+
get: function () { return chunkKNXYA5ER_js.ZOD_NEST_ERROR_DUPLICATE_ID; }
|
|
1918
1929
|
});
|
|
1919
1930
|
Object.defineProperty(exports, "ZOD_NEST_ERROR_EXTENSION", {
|
|
1920
1931
|
enumerable: true,
|
|
1921
|
-
get: function () { return
|
|
1932
|
+
get: function () { return chunkKNXYA5ER_js.ZOD_NEST_ERROR_EXTENSION; }
|
|
1922
1933
|
});
|
|
1923
1934
|
Object.defineProperty(exports, "ZodNestError", {
|
|
1924
1935
|
enumerable: true,
|
|
1925
|
-
get: function () { return
|
|
1936
|
+
get: function () { return chunkKNXYA5ER_js.ZodNestError; }
|
|
1926
1937
|
});
|
|
1927
1938
|
Object.defineProperty(exports, "ZodNestUnrepresentableError", {
|
|
1928
1939
|
enumerable: true,
|
|
1929
|
-
get: function () { return
|
|
1940
|
+
get: function () { return chunkKNXYA5ER_js.ZodNestUnrepresentableError; }
|
|
1930
1941
|
});
|
|
1931
1942
|
Object.defineProperty(exports, "ZodValidationException", {
|
|
1932
1943
|
enumerable: true,
|
|
1933
|
-
get: function () { return
|
|
1944
|
+
get: function () { return chunkKNXYA5ER_js.ZodValidationException; }
|
|
1934
1945
|
});
|
|
1935
1946
|
Object.defineProperty(exports, "createRegistry", {
|
|
1936
1947
|
enumerable: true,
|
|
1937
|
-
get: function () { return
|
|
1948
|
+
get: function () { return chunkKNXYA5ER_js.createRegistry; }
|
|
1938
1949
|
});
|
|
1939
1950
|
Object.defineProperty(exports, "defaultRegistry", {
|
|
1940
1951
|
enumerable: true,
|
|
1941
|
-
get: function () { return
|
|
1952
|
+
get: function () { return chunkKNXYA5ER_js.defaultRegistry; }
|
|
1942
1953
|
});
|
|
1943
1954
|
Object.defineProperty(exports, "extend", {
|
|
1944
1955
|
enumerable: true,
|
|
1945
|
-
get: function () { return
|
|
1956
|
+
get: function () { return chunkKNXYA5ER_js.extend; }
|
|
1946
1957
|
});
|
|
1947
1958
|
Object.defineProperty(exports, "getLineage", {
|
|
1948
1959
|
enumerable: true,
|
|
1949
|
-
get: function () { return
|
|
1960
|
+
get: function () { return chunkKNXYA5ER_js.getLineage; }
|
|
1950
1961
|
});
|
|
1951
1962
|
Object.defineProperty(exports, "isZodDto", {
|
|
1952
1963
|
enumerable: true,
|
|
1953
|
-
get: function () { return
|
|
1964
|
+
get: function () { return chunkKNXYA5ER_js.isZodDto; }
|
|
1954
1965
|
});
|
|
1955
1966
|
Object.defineProperty(exports, "isZodSchema", {
|
|
1956
1967
|
enumerable: true,
|
|
1957
|
-
get: function () { return
|
|
1968
|
+
get: function () { return chunkKNXYA5ER_js.isZodSchema; }
|
|
1958
1969
|
});
|
|
1959
1970
|
Object.defineProperty(exports, "registerSchema", {
|
|
1960
1971
|
enumerable: true,
|
|
1961
|
-
get: function () { return
|
|
1972
|
+
get: function () { return chunkKNXYA5ER_js.registerSchema; }
|
|
1962
1973
|
});
|
|
1963
1974
|
Object.defineProperty(exports, "toOpenApi", {
|
|
1964
1975
|
enumerable: true,
|
|
1965
|
-
get: function () { return
|
|
1976
|
+
get: function () { return chunkKNXYA5ER_js.toOpenApi; }
|
|
1966
1977
|
});
|
|
1967
1978
|
Object.defineProperty(exports, "overrideJSONSchema", {
|
|
1968
1979
|
enumerable: true,
|