@nullix/zod-mongoose-studio 3.3.1 → 3.3.3
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/.output/nitro.json +1 -1
- package/.output/public/_nuxt/{BCIlnd0g.js → 5ZXm4f56.js} +1 -1
- package/.output/public/_nuxt/{DcJ7oPvZ.js → B2fcLSyW.js} +1 -1
- package/.output/public/_nuxt/{B0N6xv5E.js → BBN7l5Hn.js} +1 -1
- package/.output/public/_nuxt/BBTTtb8r.js +41 -0
- package/.output/public/_nuxt/{5Tu2WUJz.js → BDbISGvP.js} +1 -1
- package/.output/public/_nuxt/{D87QMS6j.js → BijI4RNx.js} +1 -1
- package/.output/public/_nuxt/{C2BHp-MG.js → Bp9qkJ9m.js} +1 -1
- package/.output/public/_nuxt/{I3Ucam2s.js → Bu3-sqCf.js} +1 -1
- package/.output/public/_nuxt/{BO4hqv6q.js → C-FtTvwz.js} +1 -1
- package/.output/public/_nuxt/C02JV0Aj.js +1 -0
- package/.output/public/_nuxt/{sKEJiAHO.js → C1UkIsDc.js} +1 -1
- package/.output/public/_nuxt/{CKULsFUz.js → CJT28r6J.js} +1 -1
- package/.output/public/_nuxt/{BNDnV2op.js → CL7qtgl2.js} +3 -3
- package/.output/public/_nuxt/{DA0pQuyP.js → CRMd2YH2.js} +3 -3
- package/.output/public/_nuxt/{DpKrXpkK.js → CRkdQgFz.js} +1 -1
- package/.output/public/_nuxt/{B0cUlOSM.js → Cw1XFOz5.js} +1 -1
- package/.output/public/_nuxt/{CzbCpNnc.js → D5yWk6Ly.js} +1 -1
- package/.output/public/_nuxt/{BOsJJ_ZU.js → DA9GjKpR.js} +1 -1
- package/.output/public/_nuxt/{Dce9SnGa.js → DaWAlZhp.js} +1 -1
- package/.output/public/_nuxt/{tqQNlhT9.js → DafLMUHo.js} +1 -1
- package/.output/public/_nuxt/{ypRHVLFO.js → Dyaldc-t.js} +1 -1
- package/.output/public/_nuxt/{o-NCh2rp.js → UU9fpRNQ.js} +1 -1
- package/.output/public/_nuxt/builds/latest.json +1 -1
- package/.output/public/_nuxt/builds/meta/717459d8-0da1-42ed-af0b-9ec5395e8fdc.json +1 -0
- package/.output/public/_nuxt/entry.CDPplHzk.css +1 -0
- package/.output/public/_nuxt/error-404.hPtlUQpd.css +1 -0
- package/.output/public/_nuxt/error-500.E-PXUb6B.css +1 -0
- package/.output/public/_nuxt/{CMH9iX_E.js → kFZJW2-u.js} +2 -2
- package/.output/public/_nuxt/{DsnIpnT9.js → u3DlT5Mh.js} +1 -1
- package/.output/server/chunks/_/error-500.mjs.map +1 -1
- package/.output/server/chunks/_/parse-request.mjs +29 -0
- package/.output/server/chunks/_/parse-request.mjs.map +1 -0
- package/.output/server/chunks/build/client.precomputed.mjs +1 -1
- package/.output/server/chunks/build/{error-404-KRkA0DPI.mjs → error-404-aQ5PiVuX.mjs} +6 -12
- package/.output/server/chunks/build/error-404-aQ5PiVuX.mjs.map +1 -0
- package/.output/server/chunks/build/error-404-styles.DIZfBVBR.mjs +8 -0
- package/.output/server/chunks/build/error-404-styles.DIZfBVBR.mjs.map +1 -0
- package/.output/server/chunks/build/{error-500-DIIFf55p.mjs → error-500-BY6ZAZZ2.mjs} +6 -12
- package/.output/server/chunks/build/error-500-BY6ZAZZ2.mjs.map +1 -0
- package/.output/server/chunks/build/error-500-styles.BZXgEzR5.mjs +8 -0
- package/.output/server/chunks/build/error-500-styles.BZXgEzR5.mjs.map +1 -0
- package/.output/server/chunks/build/index-57_mtIua.mjs +235 -0
- package/.output/server/chunks/build/index-57_mtIua.mjs.map +1 -0
- package/.output/server/chunks/build/{index-CB1N4gax.mjs → index-Qa-4KqCB.mjs} +7 -13
- package/.output/server/chunks/build/index-Qa-4KqCB.mjs.map +1 -0
- package/.output/server/chunks/build/server.mjs +3913 -3378
- package/.output/server/chunks/build/server.mjs.map +1 -1
- package/.output/server/chunks/build/styles.mjs +4 -4
- package/.output/server/chunks/nitro/nitro.mjs +652 -2278
- package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
- package/.output/server/chunks/routes/api/editor-types.get.mjs +91 -28
- package/.output/server/chunks/routes/api/editor-types.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/parse.post.mjs +1599 -7
- package/.output/server/chunks/routes/api/parse.post.mjs.map +1 -1
- package/.output/server/chunks/routes/api/resolve.get.mjs +0 -6
- package/.output/server/chunks/routes/api/resolve.get.mjs.map +1 -1
- package/.output/server/chunks/routes/api/studio/run.post.mjs +50 -12
- package/.output/server/chunks/routes/api/studio/run.post.mjs.map +1 -1
- package/.output/server/chunks/routes/renderer.mjs +21 -44
- package/.output/server/chunks/routes/renderer.mjs.map +1 -1
- package/.output/server/index.mjs +1 -7
- package/.output/server/index.mjs.map +1 -1
- package/.output/server/node_modules/.nitro/@vue/compiler-core@3.5.43/dist/compiler-core.cjs.prod.js +6801 -0
- package/.output/server/node_modules/.nitro/@vue/compiler-core@3.5.43/package.json +58 -0
- package/.output/server/node_modules/.nitro/@vue/compiler-dom@3.5.43/dist/compiler-dom.cjs.prod.js +692 -0
- package/.output/server/node_modules/.nitro/@vue/compiler-dom@3.5.43/package.json +57 -0
- package/.output/server/node_modules/.nitro/@vue/reactivity@3.5.43/dist/reactivity.cjs.prod.js +1905 -0
- package/.output/server/node_modules/.nitro/@vue/reactivity@3.5.43/package.json +55 -0
- package/.output/server/node_modules/.nitro/@vue/runtime-core@3.5.43/dist/runtime-core.cjs.prod.js +7006 -0
- package/.output/server/node_modules/.nitro/@vue/runtime-core@3.5.43/package.json +52 -0
- package/.output/server/node_modules/.nitro/@vue/runtime-dom@3.5.43/dist/runtime-dom.cjs.prod.js +1867 -0
- package/.output/server/node_modules/.nitro/@vue/runtime-dom@3.5.43/package.json +60 -0
- package/.output/server/node_modules/.nitro/@vue/shared@3.5.43/dist/shared.cjs.prod.js +655 -0
- package/.output/server/node_modules/.nitro/@vue/shared@3.5.43/package.json +47 -0
- package/.output/server/node_modules/.nitro/source-map-js@1.2.2/lib/array-set.js +121 -0
- package/.output/server/node_modules/.nitro/source-map-js@1.2.2/lib/base64-vlq.js +140 -0
- package/.output/server/node_modules/.nitro/source-map-js@1.2.2/lib/base64.js +67 -0
- package/.output/server/node_modules/.nitro/source-map-js@1.2.2/lib/binary-search.js +111 -0
- package/.output/server/node_modules/.nitro/source-map-js@1.2.2/lib/mapping-list.js +79 -0
- package/.output/server/node_modules/.nitro/source-map-js@1.2.2/lib/quick-sort.js +141 -0
- package/.output/server/node_modules/.nitro/source-map-js@1.2.2/lib/source-map-consumer.js +1236 -0
- package/.output/server/node_modules/.nitro/source-map-js@1.2.2/lib/source-map-generator.js +446 -0
- package/.output/server/node_modules/.nitro/source-map-js@1.2.2/lib/source-node.js +420 -0
- package/.output/server/node_modules/.nitro/source-map-js@1.2.2/lib/util.js +594 -0
- package/.output/server/node_modules/.nitro/source-map-js@1.2.2/package.json +71 -0
- package/.output/server/node_modules/.nitro/source-map-js@1.2.2/source-map.js +8 -0
- package/.output/server/node_modules/.nitro/vue@3.5.43/dist/vue.cjs.js +80 -0
- package/.output/server/node_modules/.nitro/vue@3.5.43/dist/vue.cjs.prod.js +66 -0
- package/.output/server/node_modules/.nitro/vue@3.5.43/index.js +7 -0
- package/.output/server/node_modules/.nitro/vue@3.5.43/index.mjs +1 -0
- package/.output/server/node_modules/.nitro/vue@3.5.43/package.json +112 -0
- package/.output/server/node_modules/@babel/parser/lib/index.js +55 -21
- package/.output/server/node_modules/@babel/parser/package.json +7 -7
- package/.output/server/node_modules/@esbuild/linux-x64/bin/esbuild +0 -0
- package/.output/server/node_modules/@esbuild/linux-x64/package.json +1 -1
- package/.output/server/node_modules/@iconify/utils/lib/colors/index.js +19 -16
- package/.output/server/node_modules/@iconify/utils/lib/colors/keywords.js +3 -4
- package/.output/server/node_modules/@iconify/utils/lib/css/common.js +16 -16
- package/.output/server/node_modules/@iconify/utils/lib/css/format.js +1 -2
- package/.output/server/node_modules/@iconify/utils/lib/css/icon.js +11 -14
- package/.output/server/node_modules/@iconify/utils/lib/css/icons.js +13 -16
- package/.output/server/node_modules/@iconify/utils/lib/customisations/bool.js +1 -2
- package/.output/server/node_modules/@iconify/utils/lib/customisations/defaults.js +1 -3
- package/.output/server/node_modules/@iconify/utils/lib/customisations/flip.js +2 -5
- package/.output/server/node_modules/@iconify/utils/lib/customisations/merge.js +1 -3
- package/.output/server/node_modules/@iconify/utils/lib/customisations/rotate.js +4 -5
- package/.output/server/node_modules/@iconify/utils/lib/emoji/cleanup.js +1 -3
- package/.output/server/node_modules/@iconify/utils/lib/emoji/convert.js +9 -11
- package/.output/server/node_modules/@iconify/utils/lib/emoji/data.js +1 -2
- package/.output/server/node_modules/@iconify/utils/lib/emoji/format.js +1 -3
- package/.output/server/node_modules/@iconify/utils/lib/emoji/parse.js +1 -3
- package/.output/server/node_modules/@iconify/utils/lib/emoji/regex/base.js +12 -18
- package/.output/server/node_modules/@iconify/utils/lib/emoji/regex/create.js +3 -4
- package/.output/server/node_modules/@iconify/utils/lib/emoji/regex/numbers.js +5 -7
- package/.output/server/node_modules/@iconify/utils/lib/emoji/regex/similar.js +1 -8
- package/.output/server/node_modules/@iconify/utils/lib/emoji/regex/tree.js +11 -12
- package/.output/server/node_modules/@iconify/utils/lib/emoji/replace/find.js +5 -7
- package/.output/server/node_modules/@iconify/utils/lib/emoji/replace/replace.js +1 -3
- package/.output/server/node_modules/@iconify/utils/lib/emoji/test/components.js +1 -3
- package/.output/server/node_modules/@iconify/utils/lib/emoji/test/missing.js +7 -7
- package/.output/server/node_modules/@iconify/utils/lib/emoji/test/name.js +2 -4
- package/.output/server/node_modules/@iconify/utils/lib/emoji/test/parse.js +5 -9
- package/.output/server/node_modules/@iconify/utils/lib/emoji/test/similar.js +3 -5
- package/.output/server/node_modules/@iconify/utils/lib/emoji/test/tree.js +2 -4
- package/.output/server/node_modules/@iconify/utils/lib/emoji/test/variations.js +7 -8
- package/.output/server/node_modules/@iconify/utils/lib/icon/defaults.js +1 -2
- package/.output/server/node_modules/@iconify/utils/lib/icon/merge.js +1 -3
- package/.output/server/node_modules/@iconify/utils/lib/icon/name.js +3 -4
- package/.output/server/node_modules/@iconify/utils/lib/icon/square.js +1 -2
- package/.output/server/node_modules/@iconify/utils/lib/icon/transformations.js +1 -2
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/convert-info.js +10 -15
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/expand.js +1 -3
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/get-icon.js +3 -5
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/get-icons.js +1 -3
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/minify.js +1 -3
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/parse.js +1 -3
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/tree.js +1 -2
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/validate-basic.js +1 -3
- package/.output/server/node_modules/@iconify/utils/lib/icon-set/validate.js +21 -13
- package/.output/server/node_modules/@iconify/utils/lib/index.js +1 -2
- package/.output/server/node_modules/@iconify/utils/lib/loader/custom.js +3 -3
- package/.output/server/node_modules/@iconify/utils/lib/loader/hmr-utils.js +33 -0
- package/.output/server/node_modules/@iconify/utils/lib/loader/loader.js +22 -22
- package/.output/server/node_modules/@iconify/utils/lib/loader/modern.js +7 -22
- package/.output/server/node_modules/@iconify/utils/lib/loader/utils.js +60 -16
- package/.output/server/node_modules/@iconify/utils/lib/misc/objects.js +1 -2
- package/.output/server/node_modules/@iconify/utils/lib/misc/strings.js +1 -2
- package/.output/server/node_modules/@iconify/utils/lib/misc/title.js +1 -2
- package/.output/server/node_modules/@iconify/utils/lib/svg/build.js +9 -11
- package/.output/server/node_modules/@iconify/utils/lib/svg/defs.js +1 -2
- package/.output/server/node_modules/@iconify/utils/lib/svg/encode-svg-for-css.js +1 -3
- package/.output/server/node_modules/@iconify/utils/lib/svg/html.js +1 -2
- package/.output/server/node_modules/@iconify/utils/lib/svg/id.js +1 -2
- package/.output/server/node_modules/@iconify/utils/lib/svg/inner-html.js +1 -2
- package/.output/server/node_modules/@iconify/utils/lib/svg/parse.js +3 -5
- package/.output/server/node_modules/@iconify/utils/lib/svg/pretty.js +5 -4
- package/.output/server/node_modules/@iconify/utils/lib/svg/size.js +1 -2
- package/.output/server/node_modules/@iconify/utils/lib/svg/trim.js +1 -2
- package/.output/server/node_modules/@iconify/utils/lib/svg/url.js +1 -2
- package/.output/server/node_modules/@iconify/utils/lib/svg/viewbox.js +2 -3
- package/.output/server/node_modules/@iconify/utils/package.json +15 -13
- package/.output/server/node_modules/@vue/compiler-ssr/dist/compiler-ssr.cjs.js +8 -1
- package/.output/server/node_modules/@vue/compiler-ssr/package.json +3 -3
- package/.output/server/node_modules/@vue/server-renderer/dist/server-renderer.cjs.prod.js +34 -13
- package/.output/server/node_modules/@vue/server-renderer/package.json +4 -6
- package/.output/server/node_modules/devalue/index.js +15 -2
- package/.output/server/node_modules/devalue/package.json +5 -3
- package/.output/server/node_modules/devalue/src/base64.js +46 -96
- package/.output/server/node_modules/devalue/src/constants.js +5 -0
- package/.output/server/node_modules/devalue/src/operations.js +221 -0
- package/.output/server/node_modules/devalue/src/parse.js +76 -62
- package/.output/server/node_modules/devalue/src/stringify.js +164 -81
- package/.output/server/node_modules/devalue/src/uneval.js +312 -104
- package/.output/server/node_modules/devalue/src/utils.js +61 -19
- package/.output/server/node_modules/esbuild/lib/main.js +12 -8
- package/.output/server/node_modules/esbuild/package.json +50 -50
- package/.output/server/node_modules/hookable/dist/index.mjs +2 -11
- package/.output/server/node_modules/hookable/package.json +23 -22
- package/.output/server/node_modules/ip-address/dist/ipv4.js +7 -0
- package/.output/server/node_modules/ip-address/package.json +1 -1
- package/.output/server/node_modules/zod/package.json +20 -8
- package/.output/server/node_modules/zod/v4/classic/checks.js +1 -1
- package/.output/server/node_modules/zod/v4/classic/deep-partial.js +13 -0
- package/.output/server/node_modules/zod/v4/classic/errors.js +44 -35
- package/.output/server/node_modules/zod/v4/classic/external.js +5 -8
- package/.output/server/node_modules/zod/v4/classic/from-json-schema.js +375 -78
- package/.output/server/node_modules/zod/v4/classic/in-out.js +36 -0
- package/.output/server/node_modules/zod/v4/classic/index.js +2 -2
- package/.output/server/node_modules/zod/v4/classic/iso.js +2 -17
- package/.output/server/node_modules/zod/v4/classic/package.json +2 -1
- package/.output/server/node_modules/zod/v4/classic/parse.js +1 -0
- package/.output/server/node_modules/zod/v4/classic/schemas.js +601 -223
- package/.output/server/node_modules/zod/v4/core/api.js +51 -26
- package/.output/server/node_modules/zod/v4/core/checks.js +68 -127
- package/.output/server/node_modules/zod/v4/core/compile.js +1858 -0
- package/.output/server/node_modules/zod/v4/core/core.js +87 -22
- package/.output/server/node_modules/zod/v4/core/doc.js +12 -9
- package/.output/server/node_modules/zod/v4/core/errors.js +127 -42
- package/.output/server/node_modules/zod/v4/core/index.js +3 -0
- package/.output/server/node_modules/zod/v4/core/json-schema-generator.js +6 -2
- package/.output/server/node_modules/zod/v4/core/json-schema-processors.js +413 -175
- package/.output/server/node_modules/zod/v4/core/memoizer.js +311 -0
- package/.output/server/node_modules/zod/v4/core/package.json +2 -1
- package/.output/server/node_modules/zod/v4/core/parse.js +130 -48
- package/.output/server/node_modules/zod/v4/core/regexes.js +39 -16
- package/.output/server/node_modules/zod/v4/core/registries.js +2 -2
- package/.output/server/node_modules/zod/v4/core/schemas.js +895 -382
- package/.output/server/node_modules/zod/v4/core/to-json-schema.js +253 -39
- package/.output/server/node_modules/zod/v4/core/util.js +383 -175
- package/.output/server/node_modules/zod/v4/core/versions.js +2 -2
- package/.output/server/node_modules/zod/v4/core/visit.js +169 -0
- package/.output/server/node_modules/zod/v4/index.js +3 -2
- package/.output/server/node_modules/zod/v4/locales/ar.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/az.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/be.js +12 -0
- package/.output/server/node_modules/zod/v4/locales/bg.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/bn.js +113 -0
- package/.output/server/node_modules/zod/v4/locales/ca.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/ckb.js +133 -0
- package/.output/server/node_modules/zod/v4/locales/cs.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/da.js +7 -2
- package/.output/server/node_modules/zod/v4/locales/de.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/el.js +112 -0
- package/.output/server/node_modules/zod/v4/locales/en.js +20 -4
- package/.output/server/node_modules/zod/v4/locales/eo.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/es.js +4 -0
- package/.output/server/node_modules/zod/v4/locales/fa.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/fi.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/fr-CA.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/fr.js +38 -17
- package/.output/server/node_modules/zod/v4/locales/gu.js +113 -0
- package/.output/server/node_modules/zod/v4/locales/he.js +7 -0
- package/.output/server/node_modules/zod/v4/locales/hi.js +111 -0
- package/.output/server/node_modules/zod/v4/locales/hr.js +126 -0
- package/.output/server/node_modules/zod/v4/locales/hu.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/hy.js +11 -0
- package/.output/server/node_modules/zod/v4/locales/id.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/index.js +14 -0
- package/.output/server/node_modules/zod/v4/locales/is.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/it.js +6 -1
- package/.output/server/node_modules/zod/v4/locales/ja.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/ka.js +13 -8
- package/.output/server/node_modules/zod/v4/locales/km.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/kn.js +116 -0
- package/.output/server/node_modules/zod/v4/locales/ko.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/lt.js +4 -0
- package/.output/server/node_modules/zod/v4/locales/mk.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/ms.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/ne.js +111 -0
- package/.output/server/node_modules/zod/v4/locales/nl.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/nn.js +113 -0
- package/.output/server/node_modules/zod/v4/locales/no.js +7 -2
- package/.output/server/node_modules/zod/v4/locales/ota.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/package.json +2 -1
- package/.output/server/node_modules/zod/v4/locales/pl.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/ps.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/pt-BR.js +143 -0
- package/.output/server/node_modules/zod/v4/locales/pt.js +89 -55
- package/.output/server/node_modules/zod/v4/locales/ro.js +122 -0
- package/.output/server/node_modules/zod/v4/locales/ru.js +12 -0
- package/.output/server/node_modules/zod/v4/locales/sk.js +116 -0
- package/.output/server/node_modules/zod/v4/locales/sl.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/sv.js +7 -2
- package/.output/server/node_modules/zod/v4/locales/ta.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/tg.js +117 -0
- package/.output/server/node_modules/zod/v4/locales/th.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/tk.js +107 -0
- package/.output/server/node_modules/zod/v4/locales/tr.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/uk.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/ur.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/uz.js +4 -0
- package/.output/server/node_modules/zod/v4/locales/vi.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/yo.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/zh-CN.js +5 -0
- package/.output/server/node_modules/zod/v4/locales/zh-TW.js +5 -0
- package/.output/server/node_modules/zod/v4/package.json +2 -1
- package/.output/server/package.json +18 -18
- package/README.md +12 -1
- package/package.json +10 -9
- package/server/api/editor-types.get.ts +2 -23
- package/server/api/studio/run.post.ts +18 -6
- package/server/utils/editor-types.json +1 -0
- package/.output/public/_nuxt/B9paGgN0.js +0 -33
- package/.output/public/_nuxt/builds/meta/51f1351c-0667-4235-9ddc-16582a51ce03.json +0 -1
- package/.output/public/_nuxt/entry.B-vs1tRH.css +0 -1
- package/.output/public/_nuxt/error-404.CTSXlFYa.css +0 -1
- package/.output/public/_nuxt/error-500.DqEfQnVZ.css +0 -1
- package/.output/server/chunks/build/error-404-KRkA0DPI.mjs.map +0 -1
- package/.output/server/chunks/build/error-404-styles.I0NYw-Bn.mjs +0 -8
- package/.output/server/chunks/build/error-404-styles.I0NYw-Bn.mjs.map +0 -1
- package/.output/server/chunks/build/error-500-DIIFf55p.mjs.map +0 -1
- package/.output/server/chunks/build/error-500-styles.D1cs9hQy.mjs +0 -8
- package/.output/server/chunks/build/error-500-styles.D1cs9hQy.mjs.map +0 -1
- package/.output/server/chunks/build/index-CB1N4gax.mjs.map +0 -1
- /package/.output/server/node_modules/{@vue/compiler-core → .nitro/@vue/compiler-core@3.5.32}/dist/compiler-core.cjs.prod.js +0 -0
- /package/.output/server/node_modules/{@vue/compiler-core → .nitro/@vue/compiler-core@3.5.32}/package.json +0 -0
- /package/.output/server/node_modules/{@vue/compiler-dom → .nitro/@vue/compiler-dom@3.5.32}/dist/compiler-dom.cjs.prod.js +0 -0
- /package/.output/server/node_modules/{@vue/compiler-dom → .nitro/@vue/compiler-dom@3.5.32}/package.json +0 -0
- /package/.output/server/node_modules/{@vue/reactivity → .nitro/@vue/reactivity@3.5.32}/dist/reactivity.cjs.prod.js +0 -0
- /package/.output/server/node_modules/{@vue/reactivity → .nitro/@vue/reactivity@3.5.32}/package.json +0 -0
- /package/.output/server/node_modules/{@vue/runtime-core → .nitro/@vue/runtime-core@3.5.32}/dist/runtime-core.cjs.prod.js +0 -0
- /package/.output/server/node_modules/{@vue/runtime-core → .nitro/@vue/runtime-core@3.5.32}/package.json +0 -0
- /package/.output/server/node_modules/{@vue/runtime-dom → .nitro/@vue/runtime-dom@3.5.32}/dist/runtime-dom.cjs.prod.js +0 -0
- /package/.output/server/node_modules/{@vue/runtime-dom → .nitro/@vue/runtime-dom@3.5.32}/package.json +0 -0
- /package/.output/server/node_modules/{@vue/shared → .nitro/@vue/shared@3.5.32}/dist/shared.cjs.prod.js +0 -0
- /package/.output/server/node_modules/{@vue/shared → .nitro/@vue/shared@3.5.32}/package.json +0 -0
- /package/.output/server/node_modules/{source-map-js → .nitro/source-map-js@1.2.1}/lib/array-set.js +0 -0
- /package/.output/server/node_modules/{source-map-js → .nitro/source-map-js@1.2.1}/lib/base64-vlq.js +0 -0
- /package/.output/server/node_modules/{source-map-js → .nitro/source-map-js@1.2.1}/lib/base64.js +0 -0
- /package/.output/server/node_modules/{source-map-js → .nitro/source-map-js@1.2.1}/lib/binary-search.js +0 -0
- /package/.output/server/node_modules/{source-map-js → .nitro/source-map-js@1.2.1}/lib/mapping-list.js +0 -0
- /package/.output/server/node_modules/{source-map-js → .nitro/source-map-js@1.2.1}/lib/quick-sort.js +0 -0
- /package/.output/server/node_modules/{source-map-js → .nitro/source-map-js@1.2.1}/lib/source-map-consumer.js +0 -0
- /package/.output/server/node_modules/{source-map-js → .nitro/source-map-js@1.2.1}/lib/source-map-generator.js +0 -0
- /package/.output/server/node_modules/{source-map-js → .nitro/source-map-js@1.2.1}/lib/source-node.js +0 -0
- /package/.output/server/node_modules/{source-map-js → .nitro/source-map-js@1.2.1}/lib/util.js +0 -0
- /package/.output/server/node_modules/{source-map-js → .nitro/source-map-js@1.2.1}/package.json +0 -0
- /package/.output/server/node_modules/{source-map-js → .nitro/source-map-js@1.2.1}/source-map.js +0 -0
- /package/.output/server/node_modules/{vue → .nitro/vue@3.5.32}/dist/vue.cjs.js +0 -0
- /package/.output/server/node_modules/{vue → .nitro/vue@3.5.32}/dist/vue.cjs.prod.js +0 -0
- /package/.output/server/node_modules/{vue → .nitro/vue@3.5.32}/index.js +0 -0
- /package/.output/server/node_modules/{vue → .nitro/vue@3.5.32}/index.mjs +0 -0
- /package/.output/server/node_modules/{vue → .nitro/vue@3.5.32}/package.json +0 -0
- /package/.output/server/node_modules/{vue → .nitro/vue@3.5.43}/server-renderer/index.mjs +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { globalRegistry } from "../core/registries.js";
|
|
2
|
+
import { assignProp, isPlainObject } from "../core/util.js";
|
|
2
3
|
import * as _checks from "./checks.js";
|
|
3
4
|
import * as _iso from "./iso.js";
|
|
4
5
|
import * as _schemas from "./schemas.js";
|
|
@@ -9,7 +10,7 @@ const z = {
|
|
|
9
10
|
iso: _iso,
|
|
10
11
|
};
|
|
11
12
|
// Keys that are recognized and handled by the conversion logic
|
|
12
|
-
const RECOGNIZED_KEYS = new Set([
|
|
13
|
+
const RECOGNIZED_KEYS = /*@__PURE__*/ new Set([
|
|
13
14
|
// Schema identification
|
|
14
15
|
"$schema",
|
|
15
16
|
"$ref",
|
|
@@ -94,6 +95,14 @@ function detectVersion(schema, defaultTarget) {
|
|
|
94
95
|
// Use defaultTarget if provided, otherwise default to draft-2020-12
|
|
95
96
|
return defaultTarget ?? "draft-2020-12";
|
|
96
97
|
}
|
|
98
|
+
// Positional schemas constrain the elements that are present; only minItems makes them required.
|
|
99
|
+
function applyMinItems(items, minItems) {
|
|
100
|
+
return items.map((item, index) => (index < minItems ? item : item.optional()));
|
|
101
|
+
}
|
|
102
|
+
// Inverse of the encoding applied to $ref pointer segments in to-json-schema.ts. Per RFC 6901 the `~1` replacement must run before `~0`.
|
|
103
|
+
function decodeJSONPointerSegment(segment) {
|
|
104
|
+
return segment.replace(/~1/g, "/").replace(/~0/g, "~");
|
|
105
|
+
}
|
|
97
106
|
function resolveRef(ref, ctx) {
|
|
98
107
|
if (!ref.startsWith("#")) {
|
|
99
108
|
throw new Error("External $ref is not supported, only local refs (#/...) are allowed");
|
|
@@ -105,7 +114,7 @@ function resolveRef(ref, ctx) {
|
|
|
105
114
|
}
|
|
106
115
|
const defsKey = ctx.version === "draft-2020-12" ? "$defs" : "definitions";
|
|
107
116
|
if (path[0] === defsKey) {
|
|
108
|
-
const key = path[1];
|
|
117
|
+
const key = path[1] === undefined ? undefined : decodeJSONPointerSegment(path[1]);
|
|
109
118
|
if (!key || !ctx.defs[key]) {
|
|
110
119
|
throw new Error(`Reference not found: ${ref}`);
|
|
111
120
|
}
|
|
@@ -113,6 +122,235 @@ function resolveRef(ref, ctx) {
|
|
|
113
122
|
}
|
|
114
123
|
throw new Error(`Reference not found: ${ref}`);
|
|
115
124
|
}
|
|
125
|
+
/**
|
|
126
|
+
* Enforces the keywords that constrain an object's own keys — `propertyNames`,
|
|
127
|
+
* `minProperties`, `maxProperties` — before `objectSchema` runs. The guard has
|
|
128
|
+
* to see the raw input: an object parse drops `__proto__` and can add keys from
|
|
129
|
+
* a property `default`, so its output is not the set of names the instance
|
|
130
|
+
* actually carried.
|
|
131
|
+
*/
|
|
132
|
+
function checkObjectGuards(objectSchema, guards) {
|
|
133
|
+
// An identity transform, not z.any(), so `toJSONSchema` reports the object on both the input and the output side of the pipe.
|
|
134
|
+
const guard = z
|
|
135
|
+
.transform((value) => value)
|
|
136
|
+
.check((payload) => {
|
|
137
|
+
const value = payload.value;
|
|
138
|
+
if (typeof value !== "object" || value === null || Array.isArray(value))
|
|
139
|
+
return;
|
|
140
|
+
const keys = Object.getOwnPropertyNames(value);
|
|
141
|
+
if (guards.minProperties !== undefined && keys.length < guards.minProperties) {
|
|
142
|
+
payload.issues.push({
|
|
143
|
+
origin: "object",
|
|
144
|
+
code: "too_small",
|
|
145
|
+
minimum: guards.minProperties,
|
|
146
|
+
inclusive: true,
|
|
147
|
+
message: `Too small: expected object to have >=${guards.minProperties} properties`,
|
|
148
|
+
input: value,
|
|
149
|
+
inst: objectSchema,
|
|
150
|
+
continue: true,
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
if (guards.maxProperties !== undefined && keys.length > guards.maxProperties) {
|
|
154
|
+
payload.issues.push({
|
|
155
|
+
origin: "object",
|
|
156
|
+
code: "too_big",
|
|
157
|
+
maximum: guards.maxProperties,
|
|
158
|
+
inclusive: true,
|
|
159
|
+
message: `Too big: expected object to have <=${guards.maxProperties} properties`,
|
|
160
|
+
input: value,
|
|
161
|
+
inst: objectSchema,
|
|
162
|
+
continue: true,
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
if (guards.keySchema) {
|
|
166
|
+
for (const key of keys) {
|
|
167
|
+
const result = guards.keySchema.safeParse(key);
|
|
168
|
+
if (result.success)
|
|
169
|
+
continue;
|
|
170
|
+
payload.issues.push({
|
|
171
|
+
code: "invalid_key",
|
|
172
|
+
origin: "record",
|
|
173
|
+
issues: result.error.issues,
|
|
174
|
+
input: key,
|
|
175
|
+
path: [key],
|
|
176
|
+
continue: true,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
});
|
|
181
|
+
return guard.pipe(objectSchema);
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* An injective string for JSON data: two values share a key exactly when `uniqueItems` calls them
|
|
185
|
+
* equal, so duplicate detection is a Map lookup rather than a pairwise walk. Strings and keys are
|
|
186
|
+
* length-prefixed so no value can spell another one. `null` means "never equal to anything" — a
|
|
187
|
+
* cycle or a NaN, neither of which JSON can express.
|
|
188
|
+
*/
|
|
189
|
+
function canonicalKey(value, seen) {
|
|
190
|
+
if (value === null)
|
|
191
|
+
return "z";
|
|
192
|
+
const type = typeof value;
|
|
193
|
+
if (type !== "object") {
|
|
194
|
+
if (type === "number" && Number.isNaN(value))
|
|
195
|
+
return null;
|
|
196
|
+
const raw = String(value);
|
|
197
|
+
return `${type[0]}${raw.length}:${raw}`;
|
|
198
|
+
}
|
|
199
|
+
if (seen.has(value))
|
|
200
|
+
return null;
|
|
201
|
+
seen.add(value);
|
|
202
|
+
try {
|
|
203
|
+
if (Array.isArray(value)) {
|
|
204
|
+
const parts = [];
|
|
205
|
+
for (const item of value) {
|
|
206
|
+
const key = canonicalKey(item, seen);
|
|
207
|
+
if (key === null)
|
|
208
|
+
return null;
|
|
209
|
+
parts.push(key);
|
|
210
|
+
}
|
|
211
|
+
return `a${parts.length}:[${parts.join(",")}]`;
|
|
212
|
+
}
|
|
213
|
+
const keys = Object.keys(value).sort();
|
|
214
|
+
const parts = [];
|
|
215
|
+
for (const k of keys) {
|
|
216
|
+
const key = canonicalKey(value[k], seen);
|
|
217
|
+
if (key === null)
|
|
218
|
+
return null;
|
|
219
|
+
parts.push(`${k.length}:${k}=${key}`);
|
|
220
|
+
}
|
|
221
|
+
return `o${parts.length}:{${parts.join(",")}}`;
|
|
222
|
+
}
|
|
223
|
+
finally {
|
|
224
|
+
seen.delete(value);
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
// keywords whose value is a schema or an array of them
|
|
228
|
+
const SCHEMA_KEYWORDS = /*@__PURE__*/ new Set([
|
|
229
|
+
"items",
|
|
230
|
+
"prefixItems",
|
|
231
|
+
"additionalItems",
|
|
232
|
+
"additionalProperties",
|
|
233
|
+
"contains",
|
|
234
|
+
"propertyNames",
|
|
235
|
+
"not",
|
|
236
|
+
"if",
|
|
237
|
+
"then",
|
|
238
|
+
"else",
|
|
239
|
+
"allOf",
|
|
240
|
+
"anyOf",
|
|
241
|
+
"oneOf",
|
|
242
|
+
"unevaluatedItems",
|
|
243
|
+
"unevaluatedProperties",
|
|
244
|
+
"contentSchema",
|
|
245
|
+
]);
|
|
246
|
+
// keywords whose value maps names to schemas. draft-7 `dependencies` also allows an array of property names, which holds no schema to walk
|
|
247
|
+
const SCHEMA_MAP_KEYWORDS = /*@__PURE__*/ new Set([
|
|
248
|
+
"properties",
|
|
249
|
+
"patternProperties",
|
|
250
|
+
"dependentSchemas",
|
|
251
|
+
"dependencies",
|
|
252
|
+
"$defs",
|
|
253
|
+
"definitions",
|
|
254
|
+
]);
|
|
255
|
+
/**
|
|
256
|
+
* True when a subschema holds a `$ref` anywhere a schema can appear. Only those positions are
|
|
257
|
+
* walked: `$ref` under `default` or an `x-` annotation is instance data with an ordinary key, and
|
|
258
|
+
* reading it as a reference would drop a constraint that resolves perfectly well.
|
|
259
|
+
*/
|
|
260
|
+
function containsRef(value) {
|
|
261
|
+
if (typeof value !== "object" || value === null)
|
|
262
|
+
return false;
|
|
263
|
+
if (Array.isArray(value))
|
|
264
|
+
return value.some(containsRef);
|
|
265
|
+
if (typeof value.$ref === "string")
|
|
266
|
+
return true;
|
|
267
|
+
return Object.entries(value).some(([key, sub]) => {
|
|
268
|
+
if (SCHEMA_KEYWORDS.has(key))
|
|
269
|
+
return containsRef(sub);
|
|
270
|
+
if (!SCHEMA_MAP_KEYWORDS.has(key) || typeof sub !== "object" || sub === null)
|
|
271
|
+
return false;
|
|
272
|
+
return Object.values(sub).some(containsRef);
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
function plural(n) {
|
|
276
|
+
return n === 1 ? "element" : "elements";
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Enforces `uniqueItems` and the `contains` family before `arraySchema` runs, for the same reason
|
|
280
|
+
* `checkObjectGuards` runs pre-pipe: an item parse can apply a nested `default`, so the parsed
|
|
281
|
+
* array is not the instance the keywords are defined over. A guard issue aborts the pipe, so
|
|
282
|
+
* `minItems`/`maxItems` are not also reported on the same parse — instance correctness is worth
|
|
283
|
+
* more than co-reporting two issues.
|
|
284
|
+
*/
|
|
285
|
+
function checkArrayGuards(arraySchema, guards) {
|
|
286
|
+
// An identity transform, not z.any(), so `toJSONSchema` reports the array on both the input and the output side of the pipe.
|
|
287
|
+
const guard = z
|
|
288
|
+
.transform((value) => value)
|
|
289
|
+
.check((payload) => {
|
|
290
|
+
const items = payload.value;
|
|
291
|
+
if (!Array.isArray(items))
|
|
292
|
+
return;
|
|
293
|
+
if (guards.uniqueItems === true) {
|
|
294
|
+
const firstSeen = new Map();
|
|
295
|
+
for (let i = 0; i < items.length; i++) {
|
|
296
|
+
const key = canonicalKey(items[i], new Set());
|
|
297
|
+
if (key === null)
|
|
298
|
+
continue;
|
|
299
|
+
const first = firstSeen.get(key);
|
|
300
|
+
if (first === undefined) {
|
|
301
|
+
firstSeen.set(key, i);
|
|
302
|
+
continue;
|
|
303
|
+
}
|
|
304
|
+
payload.issues.push({
|
|
305
|
+
code: "custom",
|
|
306
|
+
message: `Array items must be unique: element at index ${i} duplicates the one at index ${first}`,
|
|
307
|
+
input: items,
|
|
308
|
+
path: [i],
|
|
309
|
+
continue: true,
|
|
310
|
+
});
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
if (guards.containsSchema) {
|
|
314
|
+
const minContains = guards.minContains ?? 1;
|
|
315
|
+
// one past the ceiling already proves the failure, and nothing above it changes the verdict
|
|
316
|
+
const ceiling = guards.maxContains !== undefined ? guards.maxContains + 1 : Number.POSITIVE_INFINITY;
|
|
317
|
+
let matches = 0;
|
|
318
|
+
for (const item of items) {
|
|
319
|
+
if (guards.containsSchema.safeParse(item).success && ++matches >= ceiling)
|
|
320
|
+
break;
|
|
321
|
+
}
|
|
322
|
+
if (matches < minContains) {
|
|
323
|
+
// the scan ran to the end, so this count is exact
|
|
324
|
+
payload.issues.push({
|
|
325
|
+
code: "custom",
|
|
326
|
+
message: `Array must contain at least ${minContains} matching ${plural(minContains)}; found ${matches}`,
|
|
327
|
+
input: items,
|
|
328
|
+
continue: true,
|
|
329
|
+
});
|
|
330
|
+
}
|
|
331
|
+
if (guards.maxContains !== undefined && matches > guards.maxContains) {
|
|
332
|
+
payload.issues.push({
|
|
333
|
+
code: "custom",
|
|
334
|
+
message: `Array must contain at most ${guards.maxContains} matching ${plural(guards.maxContains)}`,
|
|
335
|
+
input: items,
|
|
336
|
+
continue: true,
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
});
|
|
341
|
+
return guard.pipe(arraySchema);
|
|
342
|
+
}
|
|
343
|
+
function getTupleRest(restSchema, ctx) {
|
|
344
|
+
if (restSchema === false) {
|
|
345
|
+
return undefined;
|
|
346
|
+
}
|
|
347
|
+
if (restSchema === undefined || restSchema === true) {
|
|
348
|
+
return z.any();
|
|
349
|
+
}
|
|
350
|
+
return convertSchema(restSchema, ctx);
|
|
351
|
+
}
|
|
352
|
+
// the RFC 3339 full-time keyword, narrower than `z.iso.time()`; local because sharing it via `timeSource` pins that builder into every bundle (+139 B gzipped on a mini `z.boolean()`)
|
|
353
|
+
const fullTime = /^(?:[01]\d|2[0-3]):[0-5]\d:[0-5]\d(?:\.\d+)?(?:Z|[+-](?:[01]\d|2[0-3]):[0-5]\d)$/;
|
|
116
354
|
function convertBaseSchema(schema, ctx) {
|
|
117
355
|
// Handle unsupported features
|
|
118
356
|
if (schema.not !== undefined) {
|
|
@@ -225,17 +463,20 @@ function convertBaseSchema(schema, ctx) {
|
|
|
225
463
|
stringSchema = stringSchema.check(z.uuid());
|
|
226
464
|
}
|
|
227
465
|
else if (format === "date-time") {
|
|
228
|
-
stringSchema = stringSchema.check(z.iso.datetime());
|
|
466
|
+
stringSchema = stringSchema.check(z.iso.datetime({ offset: true }));
|
|
229
467
|
}
|
|
230
468
|
else if (format === "date") {
|
|
231
469
|
stringSchema = stringSchema.check(z.iso.date());
|
|
232
470
|
}
|
|
233
471
|
else if (format === "time") {
|
|
234
|
-
stringSchema = stringSchema.check(z.
|
|
472
|
+
stringSchema = stringSchema.check(z.regex(fullTime));
|
|
235
473
|
}
|
|
236
474
|
else if (format === "duration") {
|
|
237
475
|
stringSchema = stringSchema.check(z.iso.duration());
|
|
238
476
|
}
|
|
477
|
+
else if (format === "hostname") {
|
|
478
|
+
stringSchema = stringSchema.check(z.hostname());
|
|
479
|
+
}
|
|
239
480
|
else if (format === "ipv4") {
|
|
240
481
|
stringSchema = stringSchema.check(z.ipv4());
|
|
241
482
|
}
|
|
@@ -260,6 +501,12 @@ function convertBaseSchema(schema, ctx) {
|
|
|
260
501
|
else if (format === "e164") {
|
|
261
502
|
stringSchema = stringSchema.check(z.e164());
|
|
262
503
|
}
|
|
504
|
+
else if (format === "credit_card") {
|
|
505
|
+
stringSchema = stringSchema.check(z.creditCard());
|
|
506
|
+
}
|
|
507
|
+
else if (format === "iban") {
|
|
508
|
+
stringSchema = stringSchema.check(z.iban());
|
|
509
|
+
}
|
|
263
510
|
else if (format === "jwt") {
|
|
264
511
|
stringSchema = stringSchema.check(z.jwt());
|
|
265
512
|
}
|
|
@@ -305,10 +552,11 @@ function convertBaseSchema(schema, ctx) {
|
|
|
305
552
|
case "integer": {
|
|
306
553
|
let numberSchema = type === "integer" ? z.number().int() : z.number();
|
|
307
554
|
// Apply constraints
|
|
308
|
-
|
|
555
|
+
// In draft-04, `exclusiveMinimum: true` makes the sibling `minimum` exclusive rather than an independent bound, so the inclusive `.min()` is skipped; emitting it too would be dominated by the exclusive check and report a second, weaker issue.
|
|
556
|
+
if (typeof schema.minimum === "number" && schema.exclusiveMinimum !== true) {
|
|
309
557
|
numberSchema = numberSchema.min(schema.minimum);
|
|
310
558
|
}
|
|
311
|
-
if (typeof schema.maximum === "number") {
|
|
559
|
+
if (typeof schema.maximum === "number" && schema.exclusiveMaximum !== true) {
|
|
312
560
|
numberSchema = numberSchema.max(schema.maximum);
|
|
313
561
|
}
|
|
314
562
|
if (typeof schema.exclusiveMinimum === "number") {
|
|
@@ -341,33 +589,18 @@ function convertBaseSchema(schema, ctx) {
|
|
|
341
589
|
const shape = {};
|
|
342
590
|
const properties = schema.properties || {};
|
|
343
591
|
const requiredSet = new Set(schema.required || []);
|
|
592
|
+
const additionalSchema = typeof schema.additionalProperties === "object"
|
|
593
|
+
? convertSchema(schema.additionalProperties, ctx)
|
|
594
|
+
: undefined;
|
|
344
595
|
// Convert properties - mark optional ones
|
|
345
596
|
for (const [key, propSchema] of Object.entries(properties)) {
|
|
346
597
|
const propZodSchema = convertSchema(propSchema, ctx);
|
|
347
|
-
// If not in required array, make it optional
|
|
348
|
-
shape
|
|
349
|
-
}
|
|
350
|
-
// Handle propertyNames
|
|
351
|
-
if (schema.propertyNames) {
|
|
352
|
-
const keySchema = convertSchema(schema.propertyNames, ctx);
|
|
353
|
-
const valueSchema = schema.additionalProperties && typeof schema.additionalProperties === "object"
|
|
354
|
-
? convertSchema(schema.additionalProperties, ctx)
|
|
355
|
-
: z.any();
|
|
356
|
-
// Case A: No properties (pure record)
|
|
357
|
-
if (Object.keys(shape).length === 0) {
|
|
358
|
-
zodSchema = z.record(keySchema, valueSchema);
|
|
359
|
-
break;
|
|
360
|
-
}
|
|
361
|
-
// Case B: With properties (intersection of object and looseRecord)
|
|
362
|
-
const objectSchema = z.object(shape).passthrough();
|
|
363
|
-
const recordSchema = z.looseRecord(keySchema, valueSchema);
|
|
364
|
-
zodSchema = z.intersection(objectSchema, recordSchema);
|
|
365
|
-
break;
|
|
598
|
+
// If not in required array, make it optional. assignProp so a __proto__ key becomes an own property instead of hitting the inherited setter
|
|
599
|
+
assignProp(shape, key, requiredSet.has(key) ? propZodSchema : propZodSchema.optional());
|
|
366
600
|
}
|
|
367
601
|
// Handle patternProperties
|
|
368
602
|
if (schema.patternProperties) {
|
|
369
|
-
// patternProperties: keys matching pattern must satisfy corresponding schema
|
|
370
|
-
// Use loose records so non-matching keys pass through
|
|
603
|
+
// patternProperties: keys matching pattern must satisfy corresponding schema. Use loose records so non-matching keys pass through
|
|
371
604
|
const patternProps = schema.patternProperties;
|
|
372
605
|
const patternKeys = Object.keys(patternProps);
|
|
373
606
|
const looseRecords = [];
|
|
@@ -397,44 +630,78 @@ function convertBaseSchema(schema, ctx) {
|
|
|
397
630
|
}
|
|
398
631
|
zodSchema = result;
|
|
399
632
|
}
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
633
|
+
// When additionalProperties is false, reject keys that are neither defined in properties nor matched by any patternProperty.
|
|
634
|
+
if (schema.additionalProperties === false) {
|
|
635
|
+
const propertyKeys = Object.keys(shape);
|
|
636
|
+
const patterns = patternKeys.map((p) => new RegExp(p));
|
|
637
|
+
const basePatternSchema = zodSchema;
|
|
638
|
+
zodSchema = zodSchema.check((payload) => {
|
|
639
|
+
if (!isPlainObject(payload.value))
|
|
640
|
+
return;
|
|
641
|
+
const unrecognized = [];
|
|
642
|
+
for (const key of Object.keys(payload.value)) {
|
|
643
|
+
if (propertyKeys.includes(key))
|
|
644
|
+
continue;
|
|
645
|
+
if (patterns.some((regex) => regex.test(key)))
|
|
646
|
+
continue;
|
|
647
|
+
unrecognized.push(key);
|
|
648
|
+
}
|
|
649
|
+
if (unrecognized.length) {
|
|
650
|
+
payload.issues.push({
|
|
651
|
+
code: "unrecognized_keys",
|
|
652
|
+
keys: unrecognized,
|
|
653
|
+
input: payload.value,
|
|
654
|
+
inst: basePatternSchema,
|
|
655
|
+
});
|
|
656
|
+
}
|
|
657
|
+
});
|
|
658
|
+
}
|
|
413
659
|
}
|
|
414
660
|
else {
|
|
415
|
-
// additionalProperties
|
|
416
|
-
|
|
661
|
+
// Handle additionalProperties. In JSON Schema, additionalProperties defaults to true (allow any extra properties). In Zod, objects strip unknown keys by default, so we need to handle this explicitly
|
|
662
|
+
const objectSchema = z.object(shape);
|
|
663
|
+
if (schema.additionalProperties === false) {
|
|
664
|
+
// Strict mode - no extra properties allowed
|
|
665
|
+
zodSchema = objectSchema.strict();
|
|
666
|
+
}
|
|
667
|
+
else if (additionalSchema) {
|
|
668
|
+
// Extra properties must match the specified schema
|
|
669
|
+
zodSchema = objectSchema.catchall(additionalSchema);
|
|
670
|
+
}
|
|
671
|
+
else {
|
|
672
|
+
// additionalProperties is true or undefined - allow any extra properties (passthrough)
|
|
673
|
+
zodSchema = objectSchema.passthrough();
|
|
674
|
+
}
|
|
675
|
+
}
|
|
676
|
+
// propertyNames constrains key *names* only, and says nothing about which keys are required or how their values validate. Layering it on top of the result keeps properties/patternProperties/additionalProperties composing underneath. `true` allows every name, so it needs no guard.
|
|
677
|
+
const hasKeyGuard = schema.propertyNames !== undefined && schema.propertyNames !== true;
|
|
678
|
+
const minProperties = typeof schema.minProperties === "number" ? schema.minProperties : undefined;
|
|
679
|
+
const maxProperties = typeof schema.maxProperties === "number" ? schema.maxProperties : undefined;
|
|
680
|
+
if (hasKeyGuard || minProperties !== undefined || maxProperties !== undefined) {
|
|
681
|
+
let keySchema;
|
|
682
|
+
if (hasKeyGuard) {
|
|
683
|
+
// Keys are always strings, so a propertyNames subschema that omits `type` still constrains them — without this it would convert to z.any().
|
|
684
|
+
const keyJSONSchema = typeof schema.propertyNames === "object" && schema.propertyNames.type === undefined
|
|
685
|
+
? { type: "string", ...schema.propertyNames }
|
|
686
|
+
: schema.propertyNames;
|
|
687
|
+
keySchema = convertSchema(keyJSONSchema, ctx);
|
|
688
|
+
}
|
|
689
|
+
zodSchema = checkObjectGuards(zodSchema, { keySchema, minProperties, maxProperties });
|
|
417
690
|
}
|
|
418
691
|
break;
|
|
419
692
|
}
|
|
420
693
|
case "array": {
|
|
421
|
-
// TODO: uniqueItems is not supported
|
|
422
|
-
// TODO: contains/minContains/maxContains are not supported
|
|
423
694
|
// Check if this is a tuple (prefixItems or items as array)
|
|
424
695
|
const prefixItems = schema.prefixItems;
|
|
425
696
|
const items = schema.items;
|
|
426
697
|
if (prefixItems && Array.isArray(prefixItems)) {
|
|
427
698
|
// Tuple with prefixItems (draft-2020-12)
|
|
699
|
+
const minItems = typeof schema.minItems === "number" ? schema.minItems : 0;
|
|
428
700
|
const tupleItems = prefixItems.map((item) => convertSchema(item, ctx));
|
|
429
|
-
const
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
zodSchema = z.tuple(tupleItems).rest(rest);
|
|
434
|
-
}
|
|
435
|
-
else {
|
|
436
|
-
zodSchema = z.tuple(tupleItems);
|
|
437
|
-
}
|
|
701
|
+
const positionalItems = applyMinItems(tupleItems, minItems);
|
|
702
|
+
const rest = !Array.isArray(items) ? getTupleRest(items, ctx) : undefined;
|
|
703
|
+
const tupleSchema = z.tuple(positionalItems);
|
|
704
|
+
zodSchema = rest ? tupleSchema.rest(rest) : tupleSchema;
|
|
438
705
|
// Apply minItems/maxItems constraints to tuples
|
|
439
706
|
if (typeof schema.minItems === "number") {
|
|
440
707
|
zodSchema = zodSchema.check(z.minLength(schema.minItems));
|
|
@@ -445,16 +712,12 @@ function convertBaseSchema(schema, ctx) {
|
|
|
445
712
|
}
|
|
446
713
|
else if (Array.isArray(items)) {
|
|
447
714
|
// Tuple with items array (draft-7)
|
|
715
|
+
const minItems = typeof schema.minItems === "number" ? schema.minItems : 0;
|
|
448
716
|
const tupleItems = items.map((item) => convertSchema(item, ctx));
|
|
449
|
-
const
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
zodSchema = z.tuple(tupleItems).rest(rest);
|
|
454
|
-
}
|
|
455
|
-
else {
|
|
456
|
-
zodSchema = z.tuple(tupleItems);
|
|
457
|
-
}
|
|
717
|
+
const positionalItems = applyMinItems(tupleItems, minItems);
|
|
718
|
+
const rest = getTupleRest(schema.additionalItems, ctx);
|
|
719
|
+
const tupleSchema = z.tuple(positionalItems);
|
|
720
|
+
zodSchema = rest ? tupleSchema.rest(rest) : tupleSchema;
|
|
458
721
|
// Apply minItems/maxItems constraints to tuples
|
|
459
722
|
if (typeof schema.minItems === "number") {
|
|
460
723
|
zodSchema = zodSchema.check(z.minLength(schema.minItems));
|
|
@@ -480,18 +743,20 @@ function convertBaseSchema(schema, ctx) {
|
|
|
480
743
|
// No items specified - array of any
|
|
481
744
|
zodSchema = z.array(z.any());
|
|
482
745
|
}
|
|
746
|
+
// minContains/maxContains only constrain anything when `contains` itself is present
|
|
747
|
+
if (schema.uniqueItems === true || schema.contains !== undefined) {
|
|
748
|
+
zodSchema = checkArrayGuards(zodSchema, {
|
|
749
|
+
uniqueItems: schema.uniqueItems === true,
|
|
750
|
+
containsSchema: schema.contains !== undefined ? convertSchema(schema.contains, ctx) : undefined,
|
|
751
|
+
minContains: typeof schema.minContains === "number" ? schema.minContains : undefined,
|
|
752
|
+
maxContains: typeof schema.maxContains === "number" ? schema.maxContains : undefined,
|
|
753
|
+
});
|
|
754
|
+
}
|
|
483
755
|
break;
|
|
484
756
|
}
|
|
485
757
|
default:
|
|
486
758
|
throw new Error(`Unsupported type: ${type}`);
|
|
487
759
|
}
|
|
488
|
-
// Apply metadata
|
|
489
|
-
if (schema.description) {
|
|
490
|
-
zodSchema = zodSchema.describe(schema.description);
|
|
491
|
-
}
|
|
492
|
-
if (schema.default !== undefined) {
|
|
493
|
-
zodSchema = zodSchema.default(schema.default);
|
|
494
|
-
}
|
|
495
760
|
return zodSchema;
|
|
496
761
|
}
|
|
497
762
|
function convertSchema(schema, ctx) {
|
|
@@ -536,31 +801,55 @@ function convertSchema(schema, ctx) {
|
|
|
536
801
|
if (schema.readOnly === true) {
|
|
537
802
|
baseSchema = z.readonly(baseSchema);
|
|
538
803
|
}
|
|
539
|
-
//
|
|
804
|
+
// Apply `default` so it wraps the fully-composed schema. This ensures `parse(undefined) -> default` works regardless of which branch of `convertBaseSchema` produced the inner schema (enum/const/not/typed/etc.).
|
|
805
|
+
if (schema.default !== undefined) {
|
|
806
|
+
baseSchema = baseSchema.default(schema.default);
|
|
807
|
+
}
|
|
808
|
+
// Collect non-description annotation metadata into the user-supplied registry. Description is handled separately below via `.describe()` to preserve the contract that `schema.description` reads from globalRegistry.
|
|
540
809
|
const extraMeta = {};
|
|
541
|
-
// Core schema keywords that should be captured as metadata
|
|
542
810
|
const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
|
|
543
811
|
for (const key of coreMetadataKeys) {
|
|
544
812
|
if (key in schema) {
|
|
545
813
|
extraMeta[key] = schema[key];
|
|
546
814
|
}
|
|
547
815
|
}
|
|
548
|
-
// Content keywords - store as metadata
|
|
549
816
|
const contentMetadataKeys = ["contentEncoding", "contentMediaType", "contentSchema"];
|
|
550
817
|
for (const key of contentMetadataKeys) {
|
|
551
818
|
if (key in schema) {
|
|
552
819
|
extraMeta[key] = schema[key];
|
|
553
820
|
}
|
|
554
821
|
}
|
|
555
|
-
//
|
|
822
|
+
// `propertyNames` and `contains` are enforced by a guard, which `toJSONSchema` cannot infer, so the original keyword is carried as metadata to keep the round-trip lossless. Only where it was actually applied: on any other type it is inert, and on a `$ref` the metadata would land on the target every reference shares. A carried subschema is copied verbatim while the root `$defs` stay behind, so one holding a `$ref` is dropped rather than emitted as a dangling reference.
|
|
823
|
+
if (schema.type === "object" && schema.$ref === undefined) {
|
|
824
|
+
if (schema.propertyNames !== undefined && !containsRef(schema.propertyNames)) {
|
|
825
|
+
extraMeta.propertyNames = schema.propertyNames;
|
|
826
|
+
}
|
|
827
|
+
for (const key of ["minProperties", "maxProperties"]) {
|
|
828
|
+
if (schema[key] !== undefined)
|
|
829
|
+
extraMeta[key] = schema[key];
|
|
830
|
+
}
|
|
831
|
+
}
|
|
832
|
+
if (schema.type === "array" && schema.$ref === undefined) {
|
|
833
|
+
if (schema.contains !== undefined && !containsRef(schema.contains)) {
|
|
834
|
+
extraMeta.contains = schema.contains;
|
|
835
|
+
}
|
|
836
|
+
for (const key of ["uniqueItems", "minContains", "maxContains"]) {
|
|
837
|
+
if (schema[key] !== undefined)
|
|
838
|
+
extraMeta[key] = schema[key];
|
|
839
|
+
}
|
|
840
|
+
}
|
|
556
841
|
for (const key of Object.keys(schema)) {
|
|
557
842
|
if (!RECOGNIZED_KEYS.has(key)) {
|
|
558
|
-
extraMeta
|
|
843
|
+
assignProp(extraMeta, key, schema[key]);
|
|
559
844
|
}
|
|
560
845
|
}
|
|
561
846
|
if (Object.keys(extraMeta).length > 0) {
|
|
562
847
|
ctx.registry.add(baseSchema, extraMeta);
|
|
563
848
|
}
|
|
849
|
+
// Apply description last. `.describe()` clones the schema and sets `_zod.parent` on the clone, so registry lookups on the returned reference still resolve `extraMeta` via parent inheritance.
|
|
850
|
+
if (schema.description) {
|
|
851
|
+
baseSchema = baseSchema.describe(schema.description);
|
|
852
|
+
}
|
|
564
853
|
return baseSchema;
|
|
565
854
|
}
|
|
566
855
|
/**
|
|
@@ -570,15 +859,23 @@ export function fromJSONSchema(schema, params) {
|
|
|
570
859
|
if (typeof schema === "boolean") {
|
|
571
860
|
return schema ? z.any() : z.never();
|
|
572
861
|
}
|
|
573
|
-
|
|
574
|
-
|
|
862
|
+
// Normalize input via a JSON round-trip. This guarantees the converter walks a plain, finite, JSON-valid object graph: cyclic inputs fail here, getter/Proxy-based properties are materialized into static values, and class instances collapse to plain objects.
|
|
863
|
+
let normalized;
|
|
864
|
+
try {
|
|
865
|
+
normalized = JSON.parse(JSON.stringify(schema));
|
|
866
|
+
}
|
|
867
|
+
catch {
|
|
868
|
+
throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas");
|
|
869
|
+
}
|
|
870
|
+
const version = detectVersion(normalized, params?.defaultTarget);
|
|
871
|
+
const defs = (normalized.$defs || normalized.definitions || {});
|
|
575
872
|
const ctx = {
|
|
576
873
|
version,
|
|
577
874
|
defs,
|
|
578
875
|
refs: new Map(),
|
|
579
876
|
processing: new Set(),
|
|
580
|
-
rootSchema:
|
|
877
|
+
rootSchema: normalized,
|
|
581
878
|
registry: params?.registry ?? globalRegistry,
|
|
582
879
|
};
|
|
583
|
-
return convertSchema(
|
|
880
|
+
return convertSchema(normalized, ctx);
|
|
584
881
|
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { clone, mergeDefs } from "../core/util.js";
|
|
2
|
+
import { visit } from "../core/visit.js";
|
|
3
|
+
import * as schemas from "./schemas.js";
|
|
4
|
+
/** Appends a pipe's own checks to the side that replaces it, mirroring how `.check()` clones. */
|
|
5
|
+
function withChecks(side, checks) {
|
|
6
|
+
if (!checks?.length)
|
|
7
|
+
return side;
|
|
8
|
+
const def = side._zod.def;
|
|
9
|
+
return clone(side, mergeDefs(def, { checks: [...(def.checks ?? []), ...checks] }), { parent: true });
|
|
10
|
+
}
|
|
11
|
+
/** The out side, carrying the pipe's own checks: those run against the decoded value, which is what `out` produces. */
|
|
12
|
+
function outSide(def) {
|
|
13
|
+
return withChecks(def.out, def.checks);
|
|
14
|
+
}
|
|
15
|
+
/** The in side. `z.preprocess` pipes a transform into a schema, and a bare transform validates nothing, so the schema it feeds is the real input side — the resolution `toJSONSchema` already makes for this case. */
|
|
16
|
+
function inSide(def) {
|
|
17
|
+
return def.in._zod.traits.has("$ZodTransform") ? outSide(def) : def.in;
|
|
18
|
+
}
|
|
19
|
+
/** Returns a copy of the schema with every pipe replaced by its input side. A codec's checks are dropped: they constrain the decoded value the input side never produces. */
|
|
20
|
+
export function input(schema) {
|
|
21
|
+
return visit(schema, {
|
|
22
|
+
pipe: (s) => inSide(s._zod.def),
|
|
23
|
+
// A default value belongs to the output side, so a rewritten inner type leaves it stranded. `.default()` widens the declared input type with `undefined`, and `optional` is what carries that across.
|
|
24
|
+
default: (s, rewritten) => (rewritten ? schemas.optional(s._zod.def.innerType) : s),
|
|
25
|
+
// A catch value is output-side too, but `.catch()` leaves the declared input type alone, so the inner schema stands on its own.
|
|
26
|
+
catch: (s, rewritten) => (rewritten ? s._zod.def.innerType : s),
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
/** Returns a copy of the schema with every pipe replaced by its output side, carrying over the pipe's own checks. */
|
|
30
|
+
export function output(schema) {
|
|
31
|
+
return visit(schema, {
|
|
32
|
+
pipe: (s) => outSide(s._zod.def),
|
|
33
|
+
// A prefault value is fed through the schema, which makes it input-side, so a rewritten inner type leaves it stranded.
|
|
34
|
+
prefault: (s, rewritten) => (rewritten ? s._zod.def.innerType : s),
|
|
35
|
+
});
|
|
36
|
+
}
|