@es-joy/jsoe 0.26.0 → 0.27.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/.gitignore +10 -0
- package/.npmignore +9 -0
- package/CHANGES.md +53 -0
- package/README.md +3 -3
- package/badges/coverage-badge.svg +1 -1
- package/dist/formats/schema.d.ts.map +1 -1
- package/dist/fundamentalTypes/arrayReferenceType.d.ts.map +1 -1
- package/dist/fundamentalTypes/arrayType.d.ts.map +1 -1
- package/dist/fundamentalTypes/regexpType.d.ts.map +1 -1
- package/dist/fundamentalTypes/stringType.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/typeChoices.d.ts.map +1 -1
- package/dist/types.d.ts +12 -3
- package/dist/types.d.ts.map +1 -1
- package/eslint.config.js +36 -26
- package/package.json +13 -11
- package/pnpm-workspace.yaml +3 -2
- package/src/formatAndTypeChoices.js +9 -9
- package/src/formats/schema.js +70 -19
- package/src/fundamentalTypes/arrayReferenceType.js +3 -2
- package/src/fundamentalTypes/arrayType.js +34 -9
- package/src/fundamentalTypes/regexpType.js +9 -1
- package/src/fundamentalTypes/stringType.js +5 -0
- package/src/typeChoices.js +17 -8
- package/src/types.js +19 -8
- package/vendor/typeson-registry/dist/index.js +83 -10
- package/vendor/zod/classic/checks.d.ts +1 -1
- package/vendor/zod/classic/checks.js +1 -1
- package/vendor/zod/classic/external.d.ts +1 -1
- package/vendor/zod/classic/external.js +1 -1
- package/vendor/zod/classic/from-json-schema.js +245 -24
- package/vendor/zod/classic/schemas.d.ts +17 -1
- package/vendor/zod/classic/schemas.js +77 -29
- package/vendor/zod/core/api.d.ts +6 -4
- package/vendor/zod/core/api.js +17 -2
- package/vendor/zod/core/checks.d.ts +1 -1
- package/vendor/zod/core/checks.js +0 -96
- package/vendor/zod/core/compile.d.ts +18 -4
- package/vendor/zod/core/compile.js +146 -67
- package/vendor/zod/core/doc.js +7 -2
- package/vendor/zod/core/errors.js +2 -5
- package/vendor/zod/core/json-schema-generator.js +2 -2
- package/vendor/zod/core/json-schema-processors.d.ts +17 -0
- package/vendor/zod/core/json-schema-processors.js +195 -64
- package/vendor/zod/core/memoizer.js +72 -23
- package/vendor/zod/core/parse.js +37 -16
- package/vendor/zod/core/regexes.d.ts +2 -0
- package/vendor/zod/core/regexes.js +8 -4
- package/vendor/zod/core/schemas.d.ts +42 -7
- package/vendor/zod/core/schemas.js +301 -94
- package/vendor/zod/core/to-json-schema.d.ts +7 -3
- package/vendor/zod/core/to-json-schema.js +8 -7
- package/vendor/zod/core/util.d.ts +25 -4
- package/vendor/zod/core/util.js +160 -143
- package/vendor/zod/core/versions.d.ts +1 -1
- package/vendor/zod/core/versions.js +2 -2
- package/vendor/zod/core/visit.js +12 -0
- package/vendor/zod/locales/ar.js +1 -0
- package/vendor/zod/locales/az.js +1 -0
- package/vendor/zod/locales/be.js +1 -0
- package/vendor/zod/locales/bg.js +1 -0
- package/vendor/zod/locales/bn.js +1 -0
- package/vendor/zod/locales/ca.js +1 -0
- package/vendor/zod/locales/ckb.js +1 -0
- package/vendor/zod/locales/cs.js +1 -0
- package/vendor/zod/locales/da.js +1 -0
- package/vendor/zod/locales/de.js +1 -0
- package/vendor/zod/locales/el.js +1 -0
- package/vendor/zod/locales/en.js +1 -0
- package/vendor/zod/locales/eo.js +1 -0
- package/vendor/zod/locales/es.js +1 -0
- package/vendor/zod/locales/fa.js +1 -0
- package/vendor/zod/locales/fi.js +1 -0
- package/vendor/zod/locales/fr-CA.js +1 -0
- package/vendor/zod/locales/fr.js +1 -0
- package/vendor/zod/locales/gu.js +1 -0
- package/vendor/zod/locales/he.js +1 -0
- package/vendor/zod/locales/hi.js +1 -0
- package/vendor/zod/locales/hr.js +1 -0
- package/vendor/zod/locales/hu.js +1 -0
- package/vendor/zod/locales/hy.js +1 -0
- package/vendor/zod/locales/id.js +1 -0
- package/vendor/zod/locales/index.d.ts +1 -0
- package/vendor/zod/locales/index.js +1 -0
- package/vendor/zod/locales/is.js +1 -0
- package/vendor/zod/locales/it.js +1 -0
- package/vendor/zod/locales/ja.js +1 -0
- package/vendor/zod/locales/ka.js +1 -0
- package/vendor/zod/locales/km.js +1 -0
- package/vendor/zod/locales/kn.js +1 -0
- package/vendor/zod/locales/ko.js +1 -0
- package/vendor/zod/locales/lt.js +1 -0
- package/vendor/zod/locales/mk.js +1 -0
- package/vendor/zod/locales/ms.js +1 -0
- package/vendor/zod/locales/ne.js +1 -0
- package/vendor/zod/locales/nl.js +1 -0
- package/vendor/zod/locales/nn.js +1 -0
- package/vendor/zod/locales/no.js +1 -0
- package/vendor/zod/locales/ota.js +1 -0
- package/vendor/zod/locales/pl.js +1 -0
- package/vendor/zod/locales/ps.js +1 -0
- package/vendor/zod/locales/pt-BR.js +1 -0
- package/vendor/zod/locales/pt.js +1 -0
- package/vendor/zod/locales/ro.js +1 -0
- package/vendor/zod/locales/ru.js +1 -0
- package/vendor/zod/locales/sk.js +1 -0
- package/vendor/zod/locales/sl.js +1 -0
- package/vendor/zod/locales/sv.js +1 -0
- package/vendor/zod/locales/ta.js +1 -0
- package/vendor/zod/locales/tg.d.ts +4 -0
- package/vendor/zod/locales/tg.js +116 -0
- package/vendor/zod/locales/th.js +1 -0
- package/vendor/zod/locales/tk.js +1 -0
- package/vendor/zod/locales/tr.js +1 -0
- package/vendor/zod/locales/uk.js +1 -0
- package/vendor/zod/locales/ur.js +1 -0
- package/vendor/zod/locales/uz.js +1 -0
- package/vendor/zod/locales/vi.js +1 -0
- package/vendor/zod/locales/yo.js +1 -0
- package/vendor/zod/locales/zh-CN.js +1 -0
- package/vendor/zod/locales/zh-TW.js +1 -0
- package/vendor/zod/mini/checks.d.ts +1 -1
- package/vendor/zod/mini/checks.js +1 -1
- package/vendor/zod/mini/external.d.ts +1 -1
- package/vendor/zod/mini/external.js +1 -1
- package/vendor/zod/mini/schemas.d.ts +8 -0
- package/vendor/zod/mini/schemas.js +19 -2
- package/vendor/zodexy/dist/esm/index.js +34 -1
- package/vendor/zodexy/dist/schema.zodexy.json +18 -0
|
@@ -7,7 +7,7 @@ export { input, output } from "./in-out.js";
|
|
|
7
7
|
export type { infer } from "../core/index.js";
|
|
8
8
|
export type { JSONType } from "../core/util.js";
|
|
9
9
|
export type { CompileOptions } from "../core/index.js";
|
|
10
|
-
export { globalRegistry, registry, config, memoizer, $output, $input, $brand, clone, regexes, treeifyError, prettifyError, formatError, flattenError, TimePrecision, util, NEVER, toZod, compile, ZodCompileAsyncError, ZodCompileUnsupportedError, getDiscriminatedOption, } from "../core/index.js";
|
|
10
|
+
export { globalRegistry, registry, config, memoizer, $output, $input, $brand, clone, regexes, treeifyError, prettifyError, formatError, flattenError, TimePrecision, util, NEVER, INVALID, toZod, compile, withParser, ZodCompileAsyncError, ZodCompileUnsupportedError, getDiscriminatedOption, } from "../core/index.js";
|
|
11
11
|
export { toJSONSchema } from "../core/json-schema-processors.js";
|
|
12
12
|
export * as locales from "../locales/index.js";
|
|
13
13
|
/** A special constant with type `never` */
|
|
@@ -4,7 +4,7 @@ export * from "./schemas.js";
|
|
|
4
4
|
export * from "./checks.js";
|
|
5
5
|
export { deepPartial } from "./deep-partial.js";
|
|
6
6
|
export { input, output } from "./in-out.js";
|
|
7
|
-
export { globalRegistry, registry, config, memoizer, $output, $input, $brand, clone, regexes, treeifyError, prettifyError, formatError, flattenError, TimePrecision, util, NEVER, toZod, compile, ZodCompileAsyncError, ZodCompileUnsupportedError, getDiscriminatedOption, } from "../core/index.js";
|
|
7
|
+
export { globalRegistry, registry, config, memoizer, $output, $input, $brand, clone, regexes, treeifyError, prettifyError, formatError, flattenError, TimePrecision, util, NEVER, INVALID, toZod, compile, withParser, ZodCompileAsyncError, ZodCompileUnsupportedError, getDiscriminatedOption, } from "../core/index.js";
|
|
8
8
|
export { toJSONSchema } from "../core/json-schema-processors.js";
|
|
9
9
|
export * as locales from "../locales/index.js";
|
|
10
10
|
/** A special constant with type `never` */
|
|
@@ -132,6 +132,10 @@ export interface ZodMiniCreditCard extends _ZodMiniString<core.$ZodCreditCardInt
|
|
|
132
132
|
}
|
|
133
133
|
export declare const ZodMiniCreditCard: core.$constructor<ZodMiniCreditCard>;
|
|
134
134
|
export declare function creditCard(params?: string | core.$ZodCreditCardParams): ZodMiniCreditCard;
|
|
135
|
+
export interface ZodMiniIBAN extends _ZodMiniString<core.$ZodIBANInternals> {
|
|
136
|
+
}
|
|
137
|
+
export declare const ZodMiniIBAN: core.$constructor<ZodMiniIBAN>;
|
|
138
|
+
export declare function iban(params?: string | core.$ZodIBANParams): ZodMiniIBAN;
|
|
135
139
|
export interface ZodMiniJWT extends _ZodMiniString<core.$ZodJWTInternals> {
|
|
136
140
|
}
|
|
137
141
|
export declare const ZodMiniJWT: core.$constructor<ZodMiniJWT>;
|
|
@@ -415,6 +419,10 @@ export declare function promise<T extends SomeType>(innerType: T): ZodMiniPromis
|
|
|
415
419
|
export interface ZodMiniCustom<O = unknown, I = unknown> extends _ZodMiniType<core.$ZodCustomInternals<O, I>> {
|
|
416
420
|
}
|
|
417
421
|
export declare const ZodMiniCustom: core.$constructor<ZodMiniCustom>;
|
|
422
|
+
export interface ZodMiniProperties<Shape extends core.$ZodShape = core.$ZodShape> extends _ZodMiniType<core.$ZodPropertiesInternals<Shape>>, core.$ZodProperties<Shape> {
|
|
423
|
+
}
|
|
424
|
+
export declare const ZodMiniProperties: core.$constructor<ZodMiniProperties>;
|
|
425
|
+
export declare function properties<Shape extends core.$ZodShape>(shape: Shape, params?: string | core.$ZodPropertiesParams): ZodMiniProperties<Shape>;
|
|
418
426
|
export declare function check<O = unknown>(fn: core.CheckFn<O>, params?: string | core.$ZodCustomParams): core.$ZodCheck<O>;
|
|
419
427
|
export declare function custom<O = unknown, I = O>(fn?: (data: O) => unknown, _params?: string | core.$ZodCustomParams | undefined): ZodMiniCustom<O, I>;
|
|
420
428
|
export declare function refine<T>(fn: (arg: NoInfer<T>) => util.MaybeAsync<unknown>, _params?: string | core.$ZodCustomParams): core.$ZodCheck<T>;
|
|
@@ -257,6 +257,14 @@ export const ZodMiniCreditCard = /*@__PURE__*/ core.$constructor("ZodMiniCreditC
|
|
|
257
257
|
export function creditCard(params) {
|
|
258
258
|
return core._creditCard(ZodMiniCreditCard, params);
|
|
259
259
|
}
|
|
260
|
+
export const ZodMiniIBAN = /*@__PURE__*/ core.$constructor("ZodMiniIBAN", (inst, def) => {
|
|
261
|
+
core.$ZodIBAN.init(inst, def);
|
|
262
|
+
ZodMiniStringFormat.init(inst, def);
|
|
263
|
+
});
|
|
264
|
+
// @__NO_SIDE_EFFECTS__
|
|
265
|
+
export function iban(params) {
|
|
266
|
+
return core._iban(ZodMiniIBAN, params);
|
|
267
|
+
}
|
|
260
268
|
export const ZodMiniJWT = /*@__PURE__*/ core.$constructor("ZodMiniJWT", (inst, def) => {
|
|
261
269
|
core.$ZodJWT.init(inst, def);
|
|
262
270
|
ZodMiniStringFormat.init(inst, def);
|
|
@@ -511,7 +519,8 @@ export function required(schema, mask) {
|
|
|
511
519
|
}
|
|
512
520
|
// @__NO_SIDE_EFFECTS__
|
|
513
521
|
export function catchall(inst, catchall) {
|
|
514
|
-
|
|
522
|
+
// `mergeDefs` rather than a spread: spreading reads `shape`, and resolving it can mint a whole fresh subtree
|
|
523
|
+
return inst.clone(util.mergeDefs(inst._zod.def, { catchall: catchall }));
|
|
515
524
|
}
|
|
516
525
|
export const ZodMiniUnion = /*@__PURE__*/ core.$constructor("ZodMiniUnion", (inst, def) => {
|
|
517
526
|
core.$ZodUnion.init(inst, def);
|
|
@@ -650,7 +659,8 @@ export function set(valueType, params) {
|
|
|
650
659
|
export const ZodMiniEnum = /*@__PURE__*/ core.$constructor("ZodMiniEnum", (inst, def) => {
|
|
651
660
|
core.$ZodEnum.init(inst, def);
|
|
652
661
|
ZodMiniType.init(inst, def);
|
|
653
|
-
|
|
662
|
+
// reuse the parsed value set so a numeric TS enum's reverse-mapping keys stay out
|
|
663
|
+
inst.options = [...inst._zod.values];
|
|
654
664
|
});
|
|
655
665
|
// @__NO_SIDE_EFFECTS__
|
|
656
666
|
function _enum(values, params) {
|
|
@@ -908,6 +918,13 @@ export const ZodMiniCustom = /*@__PURE__*/ core.$constructor("ZodMiniCustom", (i
|
|
|
908
918
|
core.$ZodCustom.init(inst, def);
|
|
909
919
|
ZodMiniType.init(inst, def);
|
|
910
920
|
});
|
|
921
|
+
export const ZodMiniProperties = /*@__PURE__*/ core.$constructor("ZodMiniProperties", (inst, def) => {
|
|
922
|
+
core.$ZodProperties.init(inst, def);
|
|
923
|
+
ZodMiniType.init(inst, def);
|
|
924
|
+
});
|
|
925
|
+
export function properties(shape, params) {
|
|
926
|
+
return core._properties(ZodMiniProperties, shape, params);
|
|
927
|
+
}
|
|
911
928
|
// custom checks
|
|
912
929
|
// @__NO_SIDE_EFFECTS__
|
|
913
930
|
export function check(fn, params) {
|
|
@@ -27,6 +27,7 @@ var STRING_KINDS = /* @__PURE__ */ new Set([
|
|
|
27
27
|
"e164",
|
|
28
28
|
"jwt",
|
|
29
29
|
"credit_card",
|
|
30
|
+
"iban",
|
|
30
31
|
"ipv4",
|
|
31
32
|
"ipv6",
|
|
32
33
|
"cidrv4",
|
|
@@ -294,6 +295,26 @@ var dezerializers = {
|
|
|
294
295
|
opts.pathToSchema.set(opts.path, i);
|
|
295
296
|
return getCustomChecks(i, shape, opts);
|
|
296
297
|
}),
|
|
298
|
+
properties: ((shape, opts) => {
|
|
299
|
+
const i = z.properties(
|
|
300
|
+
{
|
|
301
|
+
...Object.fromEntries(
|
|
302
|
+
Object.entries(shape.properties).map(([key, value]) => {
|
|
303
|
+
return [
|
|
304
|
+
key,
|
|
305
|
+
checkRef(value, opts) || d(value, {
|
|
306
|
+
...opts,
|
|
307
|
+
path: opts.path + "/properties/" + key
|
|
308
|
+
})
|
|
309
|
+
];
|
|
310
|
+
})
|
|
311
|
+
)
|
|
312
|
+
},
|
|
313
|
+
getError(shape, opts)
|
|
314
|
+
);
|
|
315
|
+
opts.pathToSchema.set(opts.path, i);
|
|
316
|
+
return getCustomChecks(i, shape, opts);
|
|
317
|
+
}),
|
|
297
318
|
object: ((shape, opts) => {
|
|
298
319
|
let i = z.object(
|
|
299
320
|
{
|
|
@@ -624,7 +645,7 @@ function dezerialize(shape, opts = {}) {
|
|
|
624
645
|
import { z as z2 } from "zod";
|
|
625
646
|
|
|
626
647
|
// zodexySchema.ts
|
|
627
|
-
var zodexySchema_default = "https://github.com/brettz9/zodexy/releases/tag/v0.
|
|
648
|
+
var zodexySchema_default = "https://github.com/brettz9/zodexy/releases/tag/v0.31.0";
|
|
628
649
|
|
|
629
650
|
// zerialize.ts
|
|
630
651
|
var PRIMITIVES = {
|
|
@@ -1197,6 +1218,18 @@ var zerializers = {
|
|
|
1197
1218
|
...s(def.innerType, opts, true),
|
|
1198
1219
|
readonly: true
|
|
1199
1220
|
}),
|
|
1221
|
+
properties: (def, opts) => ({
|
|
1222
|
+
type: "properties",
|
|
1223
|
+
properties: Object.fromEntries(
|
|
1224
|
+
Object.entries(def.shape).map(([key, schema]) => [
|
|
1225
|
+
key,
|
|
1226
|
+
s(schema, {
|
|
1227
|
+
...opts,
|
|
1228
|
+
currentPath: [...opts.currentPath, "properties", key]
|
|
1229
|
+
})
|
|
1230
|
+
])
|
|
1231
|
+
)
|
|
1232
|
+
}),
|
|
1200
1233
|
custom: (_def, opts, schema) => {
|
|
1201
1234
|
const Constructor = schema._zod.bag.Class;
|
|
1202
1235
|
if (!Constructor) {
|
|
@@ -208,6 +208,7 @@
|
|
|
208
208
|
"emoji": "emoji",
|
|
209
209
|
"e164": "e164",
|
|
210
210
|
"credit_card": "credit_card",
|
|
211
|
+
"iban": "iban",
|
|
211
212
|
"cuid": "cuid",
|
|
212
213
|
"cuid2": "cuid2",
|
|
213
214
|
"ulid": "ulid",
|
|
@@ -709,6 +710,23 @@
|
|
|
709
710
|
}
|
|
710
711
|
}
|
|
711
712
|
},
|
|
713
|
+
{
|
|
714
|
+
"meta": { "title": "Properties" },
|
|
715
|
+
"type": "object",
|
|
716
|
+
"properties": {
|
|
717
|
+
"type": {
|
|
718
|
+
"type": "literal",
|
|
719
|
+
"values": ["properties"]
|
|
720
|
+
},
|
|
721
|
+
"properties": {
|
|
722
|
+
"type": "record",
|
|
723
|
+
"key": { "type": "string" },
|
|
724
|
+
"value": {
|
|
725
|
+
"$ref": "#/$defs/reference-or-type"
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
}
|
|
729
|
+
},
|
|
712
730
|
{
|
|
713
731
|
"meta": { "title": "Union" },
|
|
714
732
|
"type": "object",
|