zod-nest 3.2.4 → 3.2.5
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-N3VWL7G7.js → chunk-BYRNJLNK.js} +31 -15
- package/dist/chunk-BYRNJLNK.js.map +1 -0
- package/dist/{chunk-KNXYA5ER.js → chunk-Q3SWJZBB.js} +3 -8
- package/dist/chunk-Q3SWJZBB.js.map +1 -0
- package/dist/{chunk-VSI3SF7S.mjs → chunk-T4H5ECKV.mjs} +27 -11
- package/dist/chunk-T4H5ECKV.mjs.map +1 -0
- package/dist/{chunk-2NVNXIOY.mjs → chunk-YRTGPVSJ.mjs} +3 -8
- package/dist/chunk-YRTGPVSJ.mjs.map +1 -0
- package/dist/express/index.js +9 -9
- package/dist/express/index.mjs +3 -3
- package/dist/fastify/index.js +6 -6
- package/dist/fastify/index.mjs +3 -3
- package/dist/index.js +80 -75
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +9 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-2NVNXIOY.mjs.map +0 -1
- package/dist/chunk-KNXYA5ER.js.map +0 -1
- package/dist/chunk-N3VWL7G7.js.map +0 -1
- package/dist/chunk-VSI3SF7S.mjs.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkQ3SWJZBB_js = require('./chunk-Q3SWJZBB.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 [chunkQ3SWJZBB_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
|
+
[chunkQ3SWJZBB_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 ?? chunkQ3SWJZBB_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 = chunkQ3SWJZBB_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 [chunkQ3SWJZBB_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
|
+
[chunkQ3SWJZBB_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 chunkQ3SWJZBB_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 (!chunkQ3SWJZBB_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 (chunkQ3SWJZBB_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 (chunkQ3SWJZBB_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 = chunkQ3SWJZBB_js.isZodDto(optionSchema) ? optionSchema.name : void 0;
|
|
507
|
+
const resolvedSchema = chunkQ3SWJZBB_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 = chunkQ3SWJZBB_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 = chunkQ3SWJZBB_js.resolveAnonId(schema, chunkQ3SWJZBB_js.ANON_RESPONSE_PREFIX);
|
|
570
|
+
chunkQ3SWJZBB_js.registerSchema(schema, chunkQ3SWJZBB_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 (chunkQ3SWJZBB_js.isZodDto(entry)) {
|
|
582
582
|
return entry;
|
|
583
583
|
}
|
|
584
|
-
if (
|
|
584
|
+
if (chunkQ3SWJZBB_js.isZodSchema(entry)) {
|
|
585
585
|
return schemaToOutputDto(entry);
|
|
586
586
|
}
|
|
587
587
|
const where = index === void 0 ? "@ZodResponse({ type })" : `@ZodResponse({ type }) element [${index}]`;
|
|
@@ -773,12 +773,17 @@ var ZodBody = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema, options) => {
|
|
|
773
773
|
});
|
|
774
774
|
}, "ZodBody");
|
|
775
775
|
var resolveBodySchema = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema, options) => {
|
|
776
|
+
const registry = options?.registry ?? chunkQ3SWJZBB_js.defaultRegistry;
|
|
776
777
|
if (options?.flatten === true) {
|
|
777
|
-
|
|
778
|
+
const merged = chunkQ3SWJZBB_js.flattenObjectIntersection(schema, registry, "@ZodBody");
|
|
779
|
+
return chunkQ3SWJZBB_js.resolveSchemaRef(merged, {
|
|
780
|
+
registry,
|
|
781
|
+
deferAnonInline: true
|
|
782
|
+
}).ref;
|
|
778
783
|
}
|
|
779
|
-
return
|
|
784
|
+
return chunkQ3SWJZBB_js.resolveSchemaRef(schema, {
|
|
780
785
|
id: options?.id,
|
|
781
|
-
registry
|
|
786
|
+
registry,
|
|
782
787
|
deferAnonInline: true
|
|
783
788
|
}).ref;
|
|
784
789
|
}, "resolveBodySchema");
|
|
@@ -811,27 +816,27 @@ var appendQueryMarker = /* @__PURE__ */ chunkEV5I5HGT_js.__name((dtoId, ref) =>
|
|
|
811
816
|
|
|
812
817
|
// src/decorators/zod-query.decorator.ts
|
|
813
818
|
var ZodQuery = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema, options) => {
|
|
814
|
-
if (!
|
|
815
|
-
throw new
|
|
819
|
+
if (!chunkQ3SWJZBB_js.isZodObject(schema)) {
|
|
820
|
+
throw new chunkQ3SWJZBB_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
821
|
}
|
|
817
|
-
const registry = options?.registry ??
|
|
818
|
-
const id =
|
|
822
|
+
const registry = options?.registry ?? chunkQ3SWJZBB_js.defaultRegistry;
|
|
823
|
+
const id = chunkQ3SWJZBB_js.registerSchema(schema, registry, {
|
|
819
824
|
id: options?.id
|
|
820
825
|
});
|
|
821
826
|
if (id !== void 0) {
|
|
822
827
|
return appendQueryMarker(id, options?.ref);
|
|
823
828
|
}
|
|
824
829
|
if (options?.ref === true) {
|
|
825
|
-
throw new
|
|
830
|
+
throw new chunkQ3SWJZBB_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
831
|
}
|
|
827
|
-
const expanded =
|
|
832
|
+
const expanded = chunkQ3SWJZBB_js.expandObjectSchema(schema, {
|
|
828
833
|
id: options?.id,
|
|
829
834
|
registry,
|
|
830
835
|
decoratorName: "@ZodQuery"
|
|
831
836
|
});
|
|
832
837
|
return common.applyDecorators(...expanded.map(({ name, required, resolution }) => swagger.ApiQuery({
|
|
833
838
|
name,
|
|
834
|
-
schema:
|
|
839
|
+
schema: chunkQ3SWJZBB_js.paramSchemaBody(resolution),
|
|
835
840
|
required
|
|
836
841
|
})));
|
|
837
842
|
}, "ZodQuery");
|
|
@@ -841,7 +846,7 @@ var API_PARAMETERS_KEY = "swagger/apiParameters";
|
|
|
841
846
|
|
|
842
847
|
// src/decorators/zod-headers.decorator.ts
|
|
843
848
|
var ZodHeaders = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema, options) => {
|
|
844
|
-
const expanded =
|
|
849
|
+
const expanded = chunkQ3SWJZBB_js.expandObjectSchema(schema, {
|
|
845
850
|
id: options?.id,
|
|
846
851
|
registry: options?.registry,
|
|
847
852
|
decoratorName: "@ZodHeaders"
|
|
@@ -850,7 +855,7 @@ var ZodHeaders = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema, options) => {
|
|
|
850
855
|
name,
|
|
851
856
|
in: "header",
|
|
852
857
|
required,
|
|
853
|
-
schema:
|
|
858
|
+
schema: chunkQ3SWJZBB_js.paramSchemaBody(resolution)
|
|
854
859
|
}));
|
|
855
860
|
return (_target, _propertyKey, descriptor) => {
|
|
856
861
|
const handler = descriptor.value;
|
|
@@ -867,7 +872,7 @@ var ZodHeaders = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema, options) => {
|
|
|
867
872
|
|
|
868
873
|
// src/decorators/zod-cookies.decorator.ts
|
|
869
874
|
var ZodCookies = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema, options) => {
|
|
870
|
-
const expanded =
|
|
875
|
+
const expanded = chunkQ3SWJZBB_js.expandObjectSchema(schema, {
|
|
871
876
|
id: options?.id,
|
|
872
877
|
registry: options?.registry,
|
|
873
878
|
decoratorName: "@ZodCookies"
|
|
@@ -876,7 +881,7 @@ var ZodCookies = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema, options) => {
|
|
|
876
881
|
name,
|
|
877
882
|
in: "cookie",
|
|
878
883
|
required,
|
|
879
|
-
schema:
|
|
884
|
+
schema: chunkQ3SWJZBB_js.paramSchemaBody(resolution)
|
|
880
885
|
}));
|
|
881
886
|
return (_target, _propertyKey, descriptor) => {
|
|
882
887
|
const handler = descriptor.value;
|
|
@@ -1056,7 +1061,7 @@ var scopeToKnownIds = /* @__PURE__ */ chunkEV5I5HGT_js.__name((zodRegistry, know
|
|
|
1056
1061
|
return scoped;
|
|
1057
1062
|
}, "scopeToKnownIds");
|
|
1058
1063
|
var runPass = /* @__PURE__ */ chunkEV5I5HGT_js.__name((opts, io, knownIds) => {
|
|
1059
|
-
const built =
|
|
1064
|
+
const built = chunkQ3SWJZBB_js.buildToJsonSchemaOptions({
|
|
1060
1065
|
registry: opts.registry,
|
|
1061
1066
|
io,
|
|
1062
1067
|
override: opts.override,
|
|
@@ -1163,7 +1168,7 @@ var readMarker = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema) => {
|
|
|
1163
1168
|
if (!isPlainRecord2(schema.properties)) {
|
|
1164
1169
|
return void 0;
|
|
1165
1170
|
}
|
|
1166
|
-
const marker = schema.properties[
|
|
1171
|
+
const marker = schema.properties[chunkQ3SWJZBB_js.ZOD_NEST_DTO_EXTENSION];
|
|
1167
1172
|
if (!isZodDtoMarker(marker)) {
|
|
1168
1173
|
return void 0;
|
|
1169
1174
|
}
|
|
@@ -1235,10 +1240,10 @@ var collectRefFromSchema = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema, clas
|
|
|
1235
1240
|
return;
|
|
1236
1241
|
}
|
|
1237
1242
|
walkRefs(schema, (ref) => {
|
|
1238
|
-
if (!ref.startsWith(
|
|
1243
|
+
if (!ref.startsWith(chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX)) {
|
|
1239
1244
|
return void 0;
|
|
1240
1245
|
}
|
|
1241
|
-
const className = ref.slice(
|
|
1246
|
+
const className = ref.slice(chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX.length);
|
|
1242
1247
|
const renamed = classToDtoId.get(className);
|
|
1243
1248
|
if (renamed !== void 0) {
|
|
1244
1249
|
ids.add(renamed);
|
|
@@ -1274,7 +1279,7 @@ var collectRefsFromResponses = /* @__PURE__ */ chunkEV5I5HGT_js.__name((response
|
|
|
1274
1279
|
}, "collectRefsFromResponses");
|
|
1275
1280
|
|
|
1276
1281
|
// src/document/errors.ts
|
|
1277
|
-
var ZodNestDocumentError = class extends
|
|
1282
|
+
var ZodNestDocumentError = class extends chunkQ3SWJZBB_js.ZodNestError {
|
|
1278
1283
|
static {
|
|
1279
1284
|
chunkEV5I5HGT_js.__name(this, "ZodNestDocumentError");
|
|
1280
1285
|
}
|
|
@@ -1294,10 +1299,10 @@ var assertNoDanglingRefs = /* @__PURE__ */ chunkEV5I5HGT_js.__name((params) => {
|
|
|
1294
1299
|
const schemas = doc.components?.schemas ?? {};
|
|
1295
1300
|
const dangling = [];
|
|
1296
1301
|
walkRefs(doc, (ref) => {
|
|
1297
|
-
if (!ref.startsWith(
|
|
1302
|
+
if (!ref.startsWith(chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX)) {
|
|
1298
1303
|
return void 0;
|
|
1299
1304
|
}
|
|
1300
|
-
const target = ref.slice(
|
|
1305
|
+
const target = ref.slice(chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX.length);
|
|
1301
1306
|
if (!(target in schemas)) {
|
|
1302
1307
|
dangling.push(ref);
|
|
1303
1308
|
}
|
|
@@ -1313,7 +1318,7 @@ ${lines.join("\n")}`, {
|
|
|
1313
1318
|
});
|
|
1314
1319
|
}, "assertNoDanglingRefs");
|
|
1315
1320
|
var hintFor = /* @__PURE__ */ chunkEV5I5HGT_js.__name((ref, collected) => {
|
|
1316
|
-
const id = ref.slice(
|
|
1321
|
+
const id = ref.slice(chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX.length);
|
|
1317
1322
|
const usedInput = collected.inputExposedIds.has(id);
|
|
1318
1323
|
const usedOutput = collected.outputExposedIds.has(id);
|
|
1319
1324
|
if (usedInput && usedOutput) {
|
|
@@ -1392,7 +1397,7 @@ var buildRefQueryParam = /* @__PURE__ */ chunkEV5I5HGT_js.__name((marker, body)
|
|
|
1392
1397
|
style: "form",
|
|
1393
1398
|
explode: true,
|
|
1394
1399
|
schema: {
|
|
1395
|
-
$ref: `${
|
|
1400
|
+
$ref: `${chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX}${marker.dtoId}`
|
|
1396
1401
|
}
|
|
1397
1402
|
};
|
|
1398
1403
|
}, "buildRefQueryParam");
|
|
@@ -1468,7 +1473,7 @@ var pruneOrphanObjectSchema = /* @__PURE__ */ chunkEV5I5HGT_js.__name((doc) => {
|
|
|
1468
1473
|
return;
|
|
1469
1474
|
}
|
|
1470
1475
|
let referenced = false;
|
|
1471
|
-
const targetRef = `${
|
|
1476
|
+
const targetRef = `${chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX}Object`;
|
|
1472
1477
|
walkRefs(doc, (ref) => {
|
|
1473
1478
|
if (ref === targetRef) {
|
|
1474
1479
|
referenced = true;
|
|
@@ -1498,10 +1503,10 @@ var closeOverRefs = /* @__PURE__ */ chunkEV5I5HGT_js.__name((seed, bodies) => {
|
|
|
1498
1503
|
continue;
|
|
1499
1504
|
}
|
|
1500
1505
|
walkRefs(body, (ref) => {
|
|
1501
|
-
if (!ref.startsWith(
|
|
1506
|
+
if (!ref.startsWith(chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX)) {
|
|
1502
1507
|
return void 0;
|
|
1503
1508
|
}
|
|
1504
|
-
const target = ref.slice(
|
|
1509
|
+
const target = ref.slice(chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX.length);
|
|
1505
1510
|
if (out.has(target)) {
|
|
1506
1511
|
return void 0;
|
|
1507
1512
|
}
|
|
@@ -1534,7 +1539,7 @@ var inlineAnonymousBodies = /* @__PURE__ */ chunkEV5I5HGT_js.__name(({ doc, regi
|
|
|
1534
1539
|
]) {
|
|
1535
1540
|
const body = schemas[key];
|
|
1536
1541
|
if (isPlainRecord4(body)) {
|
|
1537
|
-
bodyByRef.set(`${
|
|
1542
|
+
bodyByRef.set(`${chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX}${key}`, body);
|
|
1538
1543
|
}
|
|
1539
1544
|
}
|
|
1540
1545
|
}
|
|
@@ -1546,7 +1551,7 @@ var inlineAnonymousBodies = /* @__PURE__ */ chunkEV5I5HGT_js.__name(({ doc, regi
|
|
|
1546
1551
|
}
|
|
1547
1552
|
inlineRefs(doc.paths, bodyByRef);
|
|
1548
1553
|
for (const ref of bodyByRef.keys()) {
|
|
1549
|
-
delete schemas[ref.slice(
|
|
1554
|
+
delete schemas[ref.slice(chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX.length)];
|
|
1550
1555
|
}
|
|
1551
1556
|
}, "inlineAnonymousBodies");
|
|
1552
1557
|
var refsWithin = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schemas, bodyByRef) => {
|
|
@@ -1684,7 +1689,7 @@ var isMarkerPlaceholder = /* @__PURE__ */ chunkEV5I5HGT_js.__name((value) => {
|
|
|
1684
1689
|
if (properties === null || typeof properties !== "object") {
|
|
1685
1690
|
return false;
|
|
1686
1691
|
}
|
|
1687
|
-
const marker = properties[
|
|
1692
|
+
const marker = properties[chunkQ3SWJZBB_js.ZOD_NEST_DTO_EXTENSION];
|
|
1688
1693
|
return isZodDtoMarker(marker);
|
|
1689
1694
|
}, "isMarkerPlaceholder");
|
|
1690
1695
|
var canonicalEqual = /* @__PURE__ */ chunkEV5I5HGT_js.__name((a, b) => {
|
|
@@ -1710,7 +1715,7 @@ var decorateIfPresent = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schemas, key) =
|
|
|
1710
1715
|
}
|
|
1711
1716
|
schemas[key] = {
|
|
1712
1717
|
description: `ERROR: duplicate zod-nest id <${key.replace(/Output$/, "")}>`,
|
|
1713
|
-
[
|
|
1718
|
+
[chunkQ3SWJZBB_js.ZOD_NEST_ERROR_EXTENSION]: chunkQ3SWJZBB_js.ZOD_NEST_ERROR_DUPLICATE_ID
|
|
1714
1719
|
};
|
|
1715
1720
|
}, "decorateIfPresent");
|
|
1716
1721
|
|
|
@@ -1744,8 +1749,8 @@ var addRefTitles = /* @__PURE__ */ chunkEV5I5HGT_js.__name((node, titleById) =>
|
|
|
1744
1749
|
return;
|
|
1745
1750
|
}
|
|
1746
1751
|
const ref = node.$ref;
|
|
1747
|
-
if (typeof ref === "string" && ref.startsWith(
|
|
1748
|
-
const title = titleById.get(ref.slice(
|
|
1752
|
+
if (typeof ref === "string" && ref.startsWith(chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX) && node.title === void 0) {
|
|
1753
|
+
const title = titleById.get(ref.slice(chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX.length));
|
|
1749
1754
|
if (title !== void 0) {
|
|
1750
1755
|
node.title = title;
|
|
1751
1756
|
}
|
|
@@ -1760,15 +1765,15 @@ var rewriteRefs = /* @__PURE__ */ chunkEV5I5HGT_js.__name((params) => {
|
|
|
1760
1765
|
const { doc, renames, divergentOutputIds } = params;
|
|
1761
1766
|
if (renames.size > 0) {
|
|
1762
1767
|
walkRefs(doc, (ref) => {
|
|
1763
|
-
if (!ref.startsWith(
|
|
1768
|
+
if (!ref.startsWith(chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX)) {
|
|
1764
1769
|
return void 0;
|
|
1765
1770
|
}
|
|
1766
|
-
const target = ref.slice(
|
|
1771
|
+
const target = ref.slice(chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX.length);
|
|
1767
1772
|
const renamed = renames.get(target);
|
|
1768
1773
|
if (renamed === void 0) {
|
|
1769
1774
|
return void 0;
|
|
1770
1775
|
}
|
|
1771
|
-
return `${
|
|
1776
|
+
return `${chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX}${renamed}`;
|
|
1772
1777
|
});
|
|
1773
1778
|
}
|
|
1774
1779
|
if (divergentOutputIds.size === 0) {
|
|
@@ -1793,14 +1798,14 @@ var rewriteResponseSubtree = /* @__PURE__ */ chunkEV5I5HGT_js.__name((pathItem,
|
|
|
1793
1798
|
continue;
|
|
1794
1799
|
}
|
|
1795
1800
|
walkRefs(responses, (ref) => {
|
|
1796
|
-
if (!ref.startsWith(
|
|
1801
|
+
if (!ref.startsWith(chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX)) {
|
|
1797
1802
|
return void 0;
|
|
1798
1803
|
}
|
|
1799
|
-
const target = ref.slice(
|
|
1804
|
+
const target = ref.slice(chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX.length);
|
|
1800
1805
|
if (!divergentOutputIds.has(target)) {
|
|
1801
1806
|
return void 0;
|
|
1802
1807
|
}
|
|
1803
|
-
return `${
|
|
1808
|
+
return `${chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX}${target}${OUTPUT_SUFFIX}`;
|
|
1804
1809
|
});
|
|
1805
1810
|
}
|
|
1806
1811
|
}, "rewriteResponseSubtree");
|
|
@@ -1842,10 +1847,10 @@ var stripMarkerFromSchema = /* @__PURE__ */ chunkEV5I5HGT_js.__name((schema) =>
|
|
|
1842
1847
|
return;
|
|
1843
1848
|
}
|
|
1844
1849
|
const props = properties;
|
|
1845
|
-
if (!(
|
|
1850
|
+
if (!(chunkQ3SWJZBB_js.ZOD_NEST_DTO_EXTENSION in props)) {
|
|
1846
1851
|
return;
|
|
1847
1852
|
}
|
|
1848
|
-
delete props[
|
|
1853
|
+
delete props[chunkQ3SWJZBB_js.ZOD_NEST_DTO_EXTENSION];
|
|
1849
1854
|
if (Object.keys(props).length === 0) {
|
|
1850
1855
|
delete schema.properties;
|
|
1851
1856
|
}
|
|
@@ -1868,7 +1873,7 @@ var withForcedExposure = /* @__PURE__ */ chunkEV5I5HGT_js.__name((collected, reg
|
|
|
1868
1873
|
}, "withForcedExposure");
|
|
1869
1874
|
var OPENAPI_VERSION = "3.1.0";
|
|
1870
1875
|
var applyZodNest = /* @__PURE__ */ chunkEV5I5HGT_js.__name((doc, opts = {}) => {
|
|
1871
|
-
const registry = opts.registry ??
|
|
1876
|
+
const registry = opts.registry ?? chunkQ3SWJZBB_js.defaultRegistry;
|
|
1872
1877
|
const collected = collectUsage(doc, registry);
|
|
1873
1878
|
const exposed = withForcedExposure(collected, registry);
|
|
1874
1879
|
const { inputSchemas, outputSchemas } = bulkEmit({
|
|
@@ -1913,67 +1918,67 @@ var applyZodNest = /* @__PURE__ */ chunkEV5I5HGT_js.__name((doc, opts = {}) => {
|
|
|
1913
1918
|
|
|
1914
1919
|
Object.defineProperty(exports, "COMPONENTS_SCHEMAS_PREFIX", {
|
|
1915
1920
|
enumerable: true,
|
|
1916
|
-
get: function () { return
|
|
1921
|
+
get: function () { return chunkQ3SWJZBB_js.COMPONENTS_SCHEMAS_PREFIX; }
|
|
1917
1922
|
});
|
|
1918
1923
|
Object.defineProperty(exports, "ZOD_DTO_SYMBOL", {
|
|
1919
1924
|
enumerable: true,
|
|
1920
|
-
get: function () { return
|
|
1925
|
+
get: function () { return chunkQ3SWJZBB_js.ZOD_DTO_SYMBOL; }
|
|
1921
1926
|
});
|
|
1922
1927
|
Object.defineProperty(exports, "ZOD_NEST_DTO_EXTENSION", {
|
|
1923
1928
|
enumerable: true,
|
|
1924
|
-
get: function () { return
|
|
1929
|
+
get: function () { return chunkQ3SWJZBB_js.ZOD_NEST_DTO_EXTENSION; }
|
|
1925
1930
|
});
|
|
1926
1931
|
Object.defineProperty(exports, "ZOD_NEST_ERROR_DUPLICATE_ID", {
|
|
1927
1932
|
enumerable: true,
|
|
1928
|
-
get: function () { return
|
|
1933
|
+
get: function () { return chunkQ3SWJZBB_js.ZOD_NEST_ERROR_DUPLICATE_ID; }
|
|
1929
1934
|
});
|
|
1930
1935
|
Object.defineProperty(exports, "ZOD_NEST_ERROR_EXTENSION", {
|
|
1931
1936
|
enumerable: true,
|
|
1932
|
-
get: function () { return
|
|
1937
|
+
get: function () { return chunkQ3SWJZBB_js.ZOD_NEST_ERROR_EXTENSION; }
|
|
1933
1938
|
});
|
|
1934
1939
|
Object.defineProperty(exports, "ZodNestError", {
|
|
1935
1940
|
enumerable: true,
|
|
1936
|
-
get: function () { return
|
|
1941
|
+
get: function () { return chunkQ3SWJZBB_js.ZodNestError; }
|
|
1937
1942
|
});
|
|
1938
1943
|
Object.defineProperty(exports, "ZodNestUnrepresentableError", {
|
|
1939
1944
|
enumerable: true,
|
|
1940
|
-
get: function () { return
|
|
1945
|
+
get: function () { return chunkQ3SWJZBB_js.ZodNestUnrepresentableError; }
|
|
1941
1946
|
});
|
|
1942
1947
|
Object.defineProperty(exports, "ZodValidationException", {
|
|
1943
1948
|
enumerable: true,
|
|
1944
|
-
get: function () { return
|
|
1949
|
+
get: function () { return chunkQ3SWJZBB_js.ZodValidationException; }
|
|
1945
1950
|
});
|
|
1946
1951
|
Object.defineProperty(exports, "createRegistry", {
|
|
1947
1952
|
enumerable: true,
|
|
1948
|
-
get: function () { return
|
|
1953
|
+
get: function () { return chunkQ3SWJZBB_js.createRegistry; }
|
|
1949
1954
|
});
|
|
1950
1955
|
Object.defineProperty(exports, "defaultRegistry", {
|
|
1951
1956
|
enumerable: true,
|
|
1952
|
-
get: function () { return
|
|
1957
|
+
get: function () { return chunkQ3SWJZBB_js.defaultRegistry; }
|
|
1953
1958
|
});
|
|
1954
1959
|
Object.defineProperty(exports, "extend", {
|
|
1955
1960
|
enumerable: true,
|
|
1956
|
-
get: function () { return
|
|
1961
|
+
get: function () { return chunkQ3SWJZBB_js.extend; }
|
|
1957
1962
|
});
|
|
1958
1963
|
Object.defineProperty(exports, "getLineage", {
|
|
1959
1964
|
enumerable: true,
|
|
1960
|
-
get: function () { return
|
|
1965
|
+
get: function () { return chunkQ3SWJZBB_js.getLineage; }
|
|
1961
1966
|
});
|
|
1962
1967
|
Object.defineProperty(exports, "isZodDto", {
|
|
1963
1968
|
enumerable: true,
|
|
1964
|
-
get: function () { return
|
|
1969
|
+
get: function () { return chunkQ3SWJZBB_js.isZodDto; }
|
|
1965
1970
|
});
|
|
1966
1971
|
Object.defineProperty(exports, "isZodSchema", {
|
|
1967
1972
|
enumerable: true,
|
|
1968
|
-
get: function () { return
|
|
1973
|
+
get: function () { return chunkQ3SWJZBB_js.isZodSchema; }
|
|
1969
1974
|
});
|
|
1970
1975
|
Object.defineProperty(exports, "registerSchema", {
|
|
1971
1976
|
enumerable: true,
|
|
1972
|
-
get: function () { return
|
|
1977
|
+
get: function () { return chunkQ3SWJZBB_js.registerSchema; }
|
|
1973
1978
|
});
|
|
1974
1979
|
Object.defineProperty(exports, "toOpenApi", {
|
|
1975
1980
|
enumerable: true,
|
|
1976
|
-
get: function () { return
|
|
1981
|
+
get: function () { return chunkQ3SWJZBB_js.toOpenApi; }
|
|
1977
1982
|
});
|
|
1978
1983
|
Object.defineProperty(exports, "overrideJSONSchema", {
|
|
1979
1984
|
enumerable: true,
|