@kubb/plugin-zod 4.10.1 → 4.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{components-BCKi8Hou.js → components-B9udp6Zi.js} +247 -200
- package/dist/components-B9udp6Zi.js.map +1 -0
- package/dist/{components-CwZBp5_M.cjs → components-DaK9uYjS.cjs} +246 -199
- package/dist/components-DaK9uYjS.cjs.map +1 -0
- package/dist/components.cjs +1 -1
- package/dist/components.js +1 -1
- package/dist/{generators-CCF0NvKr.cjs → generators-CDPXFoZT.cjs} +2 -2
- package/dist/{generators-CCF0NvKr.cjs.map → generators-CDPXFoZT.cjs.map} +1 -1
- package/dist/{generators-uL_Da-pi.js → generators-DKQPsBns.js} +2 -2
- package/dist/{generators-uL_Da-pi.js.map → generators-DKQPsBns.js.map} +1 -1
- package/dist/generators.cjs +1 -1
- package/dist/generators.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.js +1 -1
- package/package.json +6 -6
- package/src/parser.ts +339 -300
- package/dist/components-BCKi8Hou.js.map +0 -1
- package/dist/components-CwZBp5_M.cjs.map +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import transformers from "@kubb/core/transformers";
|
|
2
|
-
import { SchemaGenerator, isKeyword, schemaKeywords } from "@kubb/plugin-oas";
|
|
2
|
+
import { SchemaGenerator, createParser, findSchemaKeyword, isKeyword, schemaKeywords } from "@kubb/plugin-oas";
|
|
3
3
|
import { Const, File, Type } from "@kubb/react-fabric";
|
|
4
4
|
import { Fragment as Fragment$1, jsx, jsxs } from "@kubb/react-fabric/jsx-runtime";
|
|
5
5
|
|
|
@@ -230,6 +230,8 @@ const zodKeywordMapper = {
|
|
|
230
230
|
default: (value, innerSchema, mini) => {
|
|
231
231
|
if (mini && innerSchema) return `z._default(${innerSchema}, ${typeof value === "object" ? "{}" : value ?? ""})`;
|
|
232
232
|
if (typeof value === "object") return ".default({})";
|
|
233
|
+
if (value === void 0) return ".default()";
|
|
234
|
+
if (typeof value === "string" && !value) return `.default('')`;
|
|
233
235
|
return `.default(${value ?? ""})`;
|
|
234
236
|
},
|
|
235
237
|
and: (items = [], mini) => {
|
|
@@ -394,226 +396,271 @@ const shouldCoerce = (coercion, type) => {
|
|
|
394
396
|
if (typeof coercion === "boolean") return coercion;
|
|
395
397
|
return !!coercion[type];
|
|
396
398
|
};
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
},
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
schema,
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
siblings: siblings$1
|
|
439
|
-
}, options);
|
|
440
|
-
}).filter(Boolean), current.args.min, current.args.max, current.args.unique, options.mini);
|
|
441
|
-
if (isKeyword(current, schemaKeywords.enum)) {
|
|
442
|
-
if (current.args.asConst) {
|
|
443
|
-
if (current.args.items.length === 1) {
|
|
444
|
-
const child = {
|
|
445
|
-
keyword: schemaKeywords.const,
|
|
446
|
-
args: current.args.items[0]
|
|
447
|
-
};
|
|
448
|
-
return parse({
|
|
449
|
-
schema,
|
|
450
|
-
parent: current,
|
|
451
|
-
name,
|
|
452
|
-
current: child,
|
|
453
|
-
siblings: [child]
|
|
454
|
-
}, options);
|
|
455
|
-
}
|
|
456
|
-
return zodKeywordMapper.union(current.args.items.map((schema$1) => ({
|
|
457
|
-
keyword: schemaKeywords.const,
|
|
458
|
-
args: schema$1
|
|
459
|
-
})).map((it, _index, siblings$1) => {
|
|
460
|
-
return parse({
|
|
399
|
+
const parse = createParser({
|
|
400
|
+
mapper: zodKeywordMapper,
|
|
401
|
+
handlers: {
|
|
402
|
+
union(tree, options) {
|
|
403
|
+
const { current, schema, parent, name, siblings } = tree;
|
|
404
|
+
if (!isKeyword(current, schemaKeywords.union)) return void 0;
|
|
405
|
+
if (Array.isArray(current.args) && current.args.length === 1) return this.parse({
|
|
406
|
+
schema,
|
|
407
|
+
parent,
|
|
408
|
+
name,
|
|
409
|
+
current: current.args[0],
|
|
410
|
+
siblings
|
|
411
|
+
}, options);
|
|
412
|
+
if (Array.isArray(current.args) && !current.args.length) return "";
|
|
413
|
+
return zodKeywordMapper.union(sort(current.args).map((it, _index, siblings$1) => this.parse({
|
|
414
|
+
schema,
|
|
415
|
+
parent: current,
|
|
416
|
+
name,
|
|
417
|
+
current: it,
|
|
418
|
+
siblings: siblings$1
|
|
419
|
+
}, options)).filter(Boolean));
|
|
420
|
+
},
|
|
421
|
+
and(tree, options) {
|
|
422
|
+
const { current, schema, name } = tree;
|
|
423
|
+
if (!isKeyword(current, schemaKeywords.and)) return void 0;
|
|
424
|
+
const items = sort(current.args).filter((schema$1) => {
|
|
425
|
+
return ![schemaKeywords.optional, schemaKeywords.describe].includes(schema$1.keyword);
|
|
426
|
+
}).map((it, _index, siblings) => this.parse({
|
|
427
|
+
schema,
|
|
428
|
+
parent: current,
|
|
429
|
+
name,
|
|
430
|
+
current: it,
|
|
431
|
+
siblings
|
|
432
|
+
}, options)).filter(Boolean);
|
|
433
|
+
return `${items.slice(0, 1)}${zodKeywordMapper.and(items.slice(1), options.mini)}`;
|
|
434
|
+
},
|
|
435
|
+
array(tree, options) {
|
|
436
|
+
const { current, schema, name } = tree;
|
|
437
|
+
if (!isKeyword(current, schemaKeywords.array)) return void 0;
|
|
438
|
+
return zodKeywordMapper.array(sort(current.args.items).map((it, _index, siblings) => {
|
|
439
|
+
return this.parse({
|
|
461
440
|
schema,
|
|
462
441
|
parent: current,
|
|
463
442
|
name,
|
|
464
443
|
current: it,
|
|
465
|
-
siblings
|
|
444
|
+
siblings
|
|
466
445
|
}, options);
|
|
467
|
-
}).filter(Boolean));
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
if (
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
const
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
446
|
+
}).filter(Boolean), current.args.min, current.args.max, current.args.unique, options.mini);
|
|
447
|
+
},
|
|
448
|
+
enum(tree, options) {
|
|
449
|
+
const { current, schema, name } = tree;
|
|
450
|
+
if (!isKeyword(current, schemaKeywords.enum)) return void 0;
|
|
451
|
+
if (current.args.asConst) {
|
|
452
|
+
if (current.args.items.length === 1) {
|
|
453
|
+
const child = {
|
|
454
|
+
keyword: schemaKeywords.const,
|
|
455
|
+
args: current.args.items[0]
|
|
456
|
+
};
|
|
457
|
+
return this.parse({
|
|
458
|
+
schema,
|
|
459
|
+
parent: current,
|
|
460
|
+
name,
|
|
461
|
+
current: child,
|
|
462
|
+
siblings: [child]
|
|
463
|
+
}, options);
|
|
464
|
+
}
|
|
465
|
+
return zodKeywordMapper.union(current.args.items.map((schema$1) => ({
|
|
466
|
+
keyword: schemaKeywords.const,
|
|
467
|
+
args: schema$1
|
|
468
|
+
})).map((it, _index, siblings) => {
|
|
469
|
+
return this.parse({
|
|
470
|
+
schema,
|
|
471
|
+
parent: current,
|
|
472
|
+
name,
|
|
473
|
+
current: it,
|
|
474
|
+
siblings
|
|
475
|
+
}, options);
|
|
476
|
+
}).filter(Boolean));
|
|
477
|
+
}
|
|
478
|
+
return zodKeywordMapper.enum(current.args.items.map((schema$1) => {
|
|
479
|
+
if (schema$1.format === "boolean") return transformers.stringify(schema$1.value);
|
|
480
|
+
if (schema$1.format === "number") return transformers.stringify(schema$1.value);
|
|
481
|
+
return transformers.stringify(schema$1.value);
|
|
482
|
+
}));
|
|
483
|
+
},
|
|
484
|
+
ref(tree, options) {
|
|
485
|
+
const { current } = tree;
|
|
486
|
+
if (!isKeyword(current, schemaKeywords.ref)) return void 0;
|
|
487
|
+
if (options.skipLazyForRefs) return current.args?.name;
|
|
488
|
+
return zodKeywordMapper.ref(current.args?.name);
|
|
489
|
+
},
|
|
490
|
+
object(tree, options) {
|
|
491
|
+
const { current, schema, name } = tree;
|
|
492
|
+
if (!isKeyword(current, schemaKeywords.object)) return void 0;
|
|
493
|
+
const properties = Object.entries(current.args?.properties || {}).filter((item) => {
|
|
494
|
+
const schema$1 = item[1];
|
|
495
|
+
return schema$1 && typeof schema$1.map === "function";
|
|
496
|
+
}).map(([propertyName, schemas]) => {
|
|
497
|
+
const nameSchema = schemas.find((it) => it.keyword === schemaKeywords.name);
|
|
498
|
+
const isNullable = schemas.some((it) => isKeyword(it, schemaKeywords.nullable));
|
|
499
|
+
const isNullish = schemas.some((it) => isKeyword(it, schemaKeywords.nullish));
|
|
500
|
+
const isOptional = schemas.some((it) => isKeyword(it, schemaKeywords.optional));
|
|
501
|
+
const hasRef = !!SchemaGenerator.find(schemas, schemaKeywords.ref);
|
|
502
|
+
const mappedName = nameSchema?.args || propertyName;
|
|
503
|
+
if (options.mapper?.[mappedName]) return `"${propertyName}": ${options.mapper?.[mappedName]}`;
|
|
504
|
+
const baseSchemaOutput = sort(schemas).filter((schema$1) => {
|
|
505
|
+
return !isKeyword(schema$1, schemaKeywords.optional) && !isKeyword(schema$1, schemaKeywords.nullable) && !isKeyword(schema$1, schemaKeywords.nullish);
|
|
506
|
+
}).map((it) => {
|
|
507
|
+
const skipLazyForRefs = options.version === "4" && hasRef;
|
|
508
|
+
return this.parse({
|
|
509
|
+
schema,
|
|
510
|
+
parent: current,
|
|
511
|
+
name,
|
|
512
|
+
current: it,
|
|
513
|
+
siblings: schemas
|
|
514
|
+
}, {
|
|
515
|
+
...options,
|
|
516
|
+
skipLazyForRefs
|
|
517
|
+
});
|
|
518
|
+
}).filter(Boolean).join("");
|
|
519
|
+
const objectValue = options.wrapOutput ? options.wrapOutput({
|
|
520
|
+
output: baseSchemaOutput,
|
|
521
|
+
schema: schema?.properties?.[propertyName]
|
|
522
|
+
}) || baseSchemaOutput : baseSchemaOutput;
|
|
523
|
+
if (options.version === "4" && hasRef) {
|
|
524
|
+
if (options.mini) {
|
|
525
|
+
if (isNullish) return `get "${propertyName}"(){
|
|
513
526
|
return ${zodKeywordMapper.nullish(objectValue)}
|
|
514
527
|
}`;
|
|
515
|
-
|
|
528
|
+
if (isOptional) return `get "${propertyName}"(){
|
|
516
529
|
return ${zodKeywordMapper.optional(objectValue)}
|
|
517
530
|
}`;
|
|
518
|
-
|
|
531
|
+
if (isNullable) return `get "${propertyName}"(){
|
|
519
532
|
return ${zodKeywordMapper.nullable(objectValue)}
|
|
520
533
|
}`;
|
|
521
|
-
|
|
534
|
+
return `get "${propertyName}"(){
|
|
522
535
|
return ${objectValue}
|
|
523
536
|
}`;
|
|
524
|
-
|
|
525
|
-
|
|
537
|
+
}
|
|
538
|
+
if (isNullish) return `get "${propertyName}"(){
|
|
526
539
|
return ${objectValue}${zodKeywordMapper.nullish()}
|
|
527
540
|
}`;
|
|
528
|
-
|
|
541
|
+
if (isOptional) return `get "${propertyName}"(){
|
|
529
542
|
return ${objectValue}${zodKeywordMapper.optional()}
|
|
530
543
|
}`;
|
|
531
|
-
|
|
544
|
+
if (isNullable) return `get "${propertyName}"(){
|
|
532
545
|
return ${objectValue}${zodKeywordMapper.nullable()}
|
|
533
546
|
}`;
|
|
534
|
-
|
|
547
|
+
return `get "${propertyName}"(){
|
|
535
548
|
return ${objectValue}
|
|
536
549
|
}`;
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
550
|
+
}
|
|
551
|
+
if (isNullish) return `"${propertyName}": ${objectValue}${zodKeywordMapper.nullish()}`;
|
|
552
|
+
if (isOptional) return `"${propertyName}": ${zodKeywordMapper.optional(objectValue)}`;
|
|
553
|
+
if (isNullable) return `"${propertyName}": ${zodKeywordMapper.nullable(objectValue)}`;
|
|
554
|
+
return `"${propertyName}": ${objectValue}`;
|
|
555
|
+
}).join(",\n");
|
|
556
|
+
const additionalProperties = current.args?.additionalProperties?.length ? current.args.additionalProperties.map((it, _index, siblings) => this.parse({
|
|
557
|
+
schema,
|
|
558
|
+
parent: current,
|
|
559
|
+
name,
|
|
560
|
+
current: it,
|
|
561
|
+
siblings
|
|
562
|
+
}, options)).filter(Boolean).join("") : void 0;
|
|
563
|
+
return [zodKeywordMapper.object(properties, current.args?.strict, options.version), additionalProperties ? zodKeywordMapper.catchall(additionalProperties, options.mini) : void 0].filter(Boolean).join("");
|
|
564
|
+
},
|
|
565
|
+
tuple(tree, options) {
|
|
566
|
+
const { current, schema, name } = tree;
|
|
567
|
+
if (!isKeyword(current, schemaKeywords.tuple)) return void 0;
|
|
568
|
+
return zodKeywordMapper.tuple(current.args.items.map((it, _index, siblings) => this.parse({
|
|
569
|
+
schema,
|
|
570
|
+
parent: current,
|
|
571
|
+
name,
|
|
572
|
+
current: it,
|
|
573
|
+
siblings
|
|
574
|
+
}, options)).filter(Boolean));
|
|
575
|
+
},
|
|
576
|
+
const(tree, _options) {
|
|
577
|
+
const { current } = tree;
|
|
578
|
+
if (!isKeyword(current, schemaKeywords.const)) return void 0;
|
|
579
|
+
if (current.args.format === "number" && current.args.value !== void 0) return zodKeywordMapper.const(Number(current.args.value));
|
|
580
|
+
if (current.args.format === "boolean" && current.args.value !== void 0) return zodKeywordMapper.const(typeof current.args.value === "boolean" ? current.args.value : void 0);
|
|
581
|
+
return zodKeywordMapper.const(transformers.stringify(current.args.value));
|
|
582
|
+
},
|
|
583
|
+
matches(tree, options) {
|
|
584
|
+
const { current, siblings } = tree;
|
|
585
|
+
if (!isKeyword(current, schemaKeywords.matches)) return void 0;
|
|
586
|
+
if (siblings.some((it) => isKeyword(it, schemaKeywords.ref))) return;
|
|
587
|
+
if (current.args) return zodKeywordMapper.matches(transformers.toRegExpString(current.args, null), shouldCoerce(options.coercion, "strings"), options.mini);
|
|
588
|
+
},
|
|
589
|
+
default(tree, options) {
|
|
590
|
+
const { current } = tree;
|
|
591
|
+
if (!isKeyword(current, schemaKeywords.default)) return void 0;
|
|
592
|
+
if (options.mini) return;
|
|
593
|
+
if (current.args !== void 0) return zodKeywordMapper.default(current.args);
|
|
594
|
+
return zodKeywordMapper.default();
|
|
595
|
+
},
|
|
596
|
+
describe(tree, options) {
|
|
597
|
+
const { current } = tree;
|
|
598
|
+
if (!isKeyword(current, schemaKeywords.describe)) return void 0;
|
|
599
|
+
if (current.args) return zodKeywordMapper.describe(transformers.stringify(current.args.toString()), void 0, options.mini);
|
|
600
|
+
},
|
|
601
|
+
string(tree, options) {
|
|
602
|
+
const { current, siblings } = tree;
|
|
603
|
+
if (!isKeyword(current, schemaKeywords.string)) return void 0;
|
|
604
|
+
const minSchema = findSchemaKeyword(siblings, "min");
|
|
605
|
+
const maxSchema = findSchemaKeyword(siblings, "max");
|
|
606
|
+
return zodKeywordMapper.string(shouldCoerce(options.coercion, "strings"), minSchema?.args, maxSchema?.args, options.mini);
|
|
607
|
+
},
|
|
608
|
+
uuid(tree, options) {
|
|
609
|
+
const { current, siblings } = tree;
|
|
610
|
+
if (!isKeyword(current, schemaKeywords.uuid)) return void 0;
|
|
611
|
+
const minSchema = findSchemaKeyword(siblings, "min");
|
|
612
|
+
const maxSchema = findSchemaKeyword(siblings, "max");
|
|
613
|
+
return zodKeywordMapper.uuid(shouldCoerce(options.coercion, "strings"), options.version, minSchema?.args, maxSchema?.args, options.mini);
|
|
614
|
+
},
|
|
615
|
+
email(tree, options) {
|
|
616
|
+
const { current, siblings } = tree;
|
|
617
|
+
if (!isKeyword(current, schemaKeywords.email)) return void 0;
|
|
618
|
+
const minSchema = findSchemaKeyword(siblings, "min");
|
|
619
|
+
const maxSchema = findSchemaKeyword(siblings, "max");
|
|
620
|
+
return zodKeywordMapper.email(shouldCoerce(options.coercion, "strings"), options.version, minSchema?.args, maxSchema?.args, options.mini);
|
|
621
|
+
},
|
|
622
|
+
url(tree, options) {
|
|
623
|
+
const { current, siblings } = tree;
|
|
624
|
+
if (!isKeyword(current, schemaKeywords.url)) return void 0;
|
|
625
|
+
const minSchema = findSchemaKeyword(siblings, "min");
|
|
626
|
+
const maxSchema = findSchemaKeyword(siblings, "max");
|
|
627
|
+
return zodKeywordMapper.url(shouldCoerce(options.coercion, "strings"), options.version, minSchema?.args, maxSchema?.args, options.mini);
|
|
628
|
+
},
|
|
629
|
+
number(tree, options) {
|
|
630
|
+
const { current, siblings } = tree;
|
|
631
|
+
if (!isKeyword(current, schemaKeywords.number)) return void 0;
|
|
632
|
+
const minSchema = findSchemaKeyword(siblings, "min");
|
|
633
|
+
const maxSchema = findSchemaKeyword(siblings, "max");
|
|
634
|
+
const exclusiveMinimumSchema = findSchemaKeyword(siblings, "exclusiveMinimum");
|
|
635
|
+
const exclusiveMaximumSchema = findSchemaKeyword(siblings, "exclusiveMaximum");
|
|
636
|
+
return zodKeywordMapper.number(shouldCoerce(options.coercion, "numbers"), minSchema?.args, maxSchema?.args, exclusiveMinimumSchema?.args, exclusiveMaximumSchema?.args, options.mini);
|
|
637
|
+
},
|
|
638
|
+
integer(tree, options) {
|
|
639
|
+
const { current, siblings } = tree;
|
|
640
|
+
if (!isKeyword(current, schemaKeywords.integer)) return void 0;
|
|
641
|
+
const minSchema = findSchemaKeyword(siblings, "min");
|
|
642
|
+
const maxSchema = findSchemaKeyword(siblings, "max");
|
|
643
|
+
const exclusiveMinimumSchema = findSchemaKeyword(siblings, "exclusiveMinimum");
|
|
644
|
+
const exclusiveMaximumSchema = findSchemaKeyword(siblings, "exclusiveMaximum");
|
|
645
|
+
return zodKeywordMapper.integer(shouldCoerce(options.coercion, "numbers"), minSchema?.args, maxSchema?.args, options.version, exclusiveMinimumSchema?.args, exclusiveMaximumSchema?.args, options.mini);
|
|
646
|
+
},
|
|
647
|
+
datetime(tree, options) {
|
|
648
|
+
const { current } = tree;
|
|
649
|
+
if (!isKeyword(current, schemaKeywords.datetime)) return void 0;
|
|
650
|
+
return zodKeywordMapper.datetime(current.args.offset, current.args.local, options.version, options.mini);
|
|
651
|
+
},
|
|
652
|
+
date(tree, options) {
|
|
653
|
+
const { current } = tree;
|
|
654
|
+
if (!isKeyword(current, schemaKeywords.date)) return void 0;
|
|
655
|
+
return zodKeywordMapper.date(current.args.type, shouldCoerce(options.coercion, "dates"), options.version);
|
|
656
|
+
},
|
|
657
|
+
time(tree, options) {
|
|
658
|
+
const { current } = tree;
|
|
659
|
+
if (!isKeyword(current, schemaKeywords.time)) return void 0;
|
|
660
|
+
return zodKeywordMapper.time(current.args.type, shouldCoerce(options.coercion, "dates"), options.version);
|
|
661
|
+
}
|
|
614
662
|
}
|
|
615
|
-
|
|
616
|
-
}
|
|
663
|
+
});
|
|
617
664
|
|
|
618
665
|
//#endregion
|
|
619
666
|
//#region src/components/Zod.tsx
|
|
@@ -698,4 +745,4 @@ function Zod({ name, typeName, tree, schema, inferTypeName, mapper, coercion, ke
|
|
|
698
745
|
|
|
699
746
|
//#endregion
|
|
700
747
|
export { Operations as n, Zod as t };
|
|
701
|
-
//# sourceMappingURL=components-
|
|
748
|
+
//# sourceMappingURL=components-B9udp6Zi.js.map
|