conductor-oss 0.60.16 → 0.60.18
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/node_modules/yaml/browser/dist/compose/resolve-flow-scalar.js +5 -3
- package/node_modules/yaml/browser/dist/nodes/Alias.js +2 -0
- package/node_modules/yaml/browser/dist/schema/yaml-1.1/merge.js +11 -8
- package/node_modules/yaml/browser/dist/stringify/stringifyNumber.js +2 -1
- package/node_modules/yaml/dist/compose/resolve-flow-scalar.js +5 -3
- package/node_modules/yaml/dist/nodes/Alias.js +2 -0
- package/node_modules/yaml/dist/nodes/Scalar.d.ts +5 -1
- package/node_modules/yaml/dist/schema/yaml-1.1/merge.js +10 -7
- package/node_modules/yaml/dist/stringify/stringifyNumber.js +2 -1
- package/node_modules/yaml/package.json +1 -1
- package/node_modules/zod/README.md +1 -18
- package/node_modules/zod/locales/package.json +2 -1
- package/node_modules/zod/mini/package.json +2 -1
- package/node_modules/zod/package.json +1 -1
- package/node_modules/zod/src/v3/tests/all-errors.test.ts +3 -3
- package/node_modules/zod/src/v3/tests/object.test.ts +5 -5
- package/node_modules/zod/src/v3/tests/partials.test.ts +3 -3
- package/node_modules/zod/src/v4/classic/errors.ts +2 -2
- package/node_modules/zod/src/v4/classic/external.ts +1 -0
- package/node_modules/zod/src/v4/classic/from-json-schema.ts +39 -23
- package/node_modules/zod/src/v4/classic/parse.ts +6 -6
- package/node_modules/zod/src/v4/classic/schemas.ts +414 -151
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +6 -0
- package/node_modules/zod/src/v4/classic/tests/catch.test.ts +50 -0
- package/node_modules/zod/src/v4/classic/tests/codec.test.ts +142 -1
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +1 -1
- package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +1 -1
- package/node_modules/zod/src/v4/classic/tests/default.test.ts +44 -0
- package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +197 -0
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +34 -1
- package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +214 -2
- package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +161 -0
- package/node_modules/zod/src/v4/classic/tests/function.test.ts +6 -6
- package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +39 -0
- package/node_modules/zod/src/v4/classic/tests/index.test.ts +2 -2
- package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +46 -0
- package/node_modules/zod/src/v4/classic/tests/locales_ka.test.ts +29 -0
- package/node_modules/zod/src/v4/classic/tests/locales_ro.test.ts +24 -0
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +55 -0
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +83 -6
- package/node_modules/zod/src/v4/classic/tests/optional.test.ts +114 -4
- package/node_modules/zod/src/v4/classic/tests/partial.test.ts +24 -1
- package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +1 -1
- package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +26 -0
- package/node_modules/zod/src/v4/classic/tests/preprocess.test.ts +69 -0
- package/node_modules/zod/src/v4/classic/tests/record.test.ts +85 -0
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +49 -0
- package/node_modules/zod/src/v4/classic/tests/refine.test.ts +63 -0
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +50 -1
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +4 -4
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +150 -15
- package/node_modules/zod/src/v4/classic/tests/transform.test.ts +17 -0
- package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +315 -2
- package/node_modules/zod/src/v4/classic/tests/union.test.ts +54 -0
- package/node_modules/zod/src/v4/core/api.ts +31 -6
- package/node_modules/zod/src/v4/core/checks.ts +1 -1
- package/node_modules/zod/src/v4/core/core.ts +17 -2
- package/node_modules/zod/src/v4/core/errors.ts +31 -24
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +17 -18
- package/node_modules/zod/src/v4/core/parse.ts +7 -7
- package/node_modules/zod/src/v4/core/regexes.ts +8 -1
- package/node_modules/zod/src/v4/core/schemas.ts +263 -71
- package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +215 -0
- package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +72 -0
- package/node_modules/zod/src/v4/core/tests/locales/hr.test.ts +163 -0
- package/node_modules/zod/src/v4/core/tests/locales/uz.test.ts +22 -0
- package/node_modules/zod/src/v4/core/tests/record-constructor.test.ts +58 -0
- package/node_modules/zod/src/v4/core/to-json-schema.ts +10 -1
- package/node_modules/zod/src/v4/core/util.ts +52 -35
- package/node_modules/zod/src/v4/core/versions.ts +2 -2
- package/node_modules/zod/src/v4/locales/el.ts +121 -0
- package/node_modules/zod/src/v4/locales/en.ts +4 -0
- package/node_modules/zod/src/v4/locales/fr.ts +24 -8
- package/node_modules/zod/src/v4/locales/hr.ts +131 -0
- package/node_modules/zod/src/v4/locales/index.ts +3 -0
- package/node_modules/zod/src/v4/locales/it.ts +1 -1
- package/node_modules/zod/src/v4/locales/ka.ts +8 -8
- package/node_modules/zod/src/v4/locales/ro.ts +129 -0
- package/node_modules/zod/src/v4/locales/uz.ts +1 -0
- package/node_modules/zod/src/v4/mini/external.ts +1 -0
- package/node_modules/zod/src/v4/mini/schemas.ts +56 -25
- package/node_modules/zod/src/v4/mini/tests/codec.test.ts +19 -0
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +32 -2
- package/node_modules/zod/src/v4/mini/tests/object.test.ts +9 -9
- package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +51 -1
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +5 -0
- package/node_modules/zod/v3/package.json +2 -1
- package/node_modules/zod/v4/classic/errors.js +2 -2
- package/node_modules/zod/v4/classic/external.d.cts +1 -0
- package/node_modules/zod/v4/classic/external.d.ts +1 -0
- package/node_modules/zod/v4/classic/from-json-schema.cjs +31 -16
- package/node_modules/zod/v4/classic/from-json-schema.js +31 -16
- package/node_modules/zod/v4/classic/package.json +2 -1
- package/node_modules/zod/v4/classic/schemas.cjs +358 -119
- package/node_modules/zod/v4/classic/schemas.d.cts +42 -14
- package/node_modules/zod/v4/classic/schemas.d.ts +42 -14
- package/node_modules/zod/v4/classic/schemas.js +356 -118
- package/node_modules/zod/v4/core/api.cjs +7 -2
- package/node_modules/zod/v4/core/api.d.cts +26 -5
- package/node_modules/zod/v4/core/api.d.ts +26 -5
- package/node_modules/zod/v4/core/api.js +7 -2
- package/node_modules/zod/v4/core/checks.d.cts +1 -1
- package/node_modules/zod/v4/core/checks.d.ts +1 -1
- package/node_modules/zod/v4/core/core.cjs +3 -1
- package/node_modules/zod/v4/core/core.js +4 -2
- package/node_modules/zod/v4/core/errors.cjs +26 -23
- package/node_modules/zod/v4/core/errors.d.cts +1 -0
- package/node_modules/zod/v4/core/errors.d.ts +1 -0
- package/node_modules/zod/v4/core/errors.js +26 -23
- package/node_modules/zod/v4/core/json-schema-processors.cjs +16 -20
- package/node_modules/zod/v4/core/json-schema-processors.js +16 -20
- package/node_modules/zod/v4/core/package.json +2 -1
- package/node_modules/zod/v4/core/parse.cjs +7 -7
- package/node_modules/zod/v4/core/parse.js +7 -7
- package/node_modules/zod/v4/core/regexes.cjs +9 -3
- package/node_modules/zod/v4/core/regexes.d.cts +6 -0
- package/node_modules/zod/v4/core/regexes.d.ts +6 -0
- package/node_modules/zod/v4/core/regexes.js +7 -1
- package/node_modules/zod/v4/core/schemas.cjs +211 -65
- package/node_modules/zod/v4/core/schemas.d.cts +39 -1
- package/node_modules/zod/v4/core/schemas.d.ts +39 -1
- package/node_modules/zod/v4/core/schemas.js +210 -64
- package/node_modules/zod/v4/core/to-json-schema.cjs +12 -1
- package/node_modules/zod/v4/core/to-json-schema.js +12 -1
- package/node_modules/zod/v4/core/util.cjs +54 -30
- package/node_modules/zod/v4/core/util.d.cts +1 -0
- package/node_modules/zod/v4/core/util.d.ts +1 -0
- package/node_modules/zod/v4/core/util.js +55 -32
- package/node_modules/zod/v4/core/versions.cjs +2 -2
- package/node_modules/zod/v4/core/versions.d.cts +1 -1
- package/node_modules/zod/v4/core/versions.d.ts +1 -1
- package/node_modules/zod/v4/core/versions.js +2 -2
- package/node_modules/zod/v4/locales/el.cjs +136 -0
- package/node_modules/zod/v4/locales/el.d.cts +5 -0
- package/node_modules/zod/v4/locales/el.d.ts +4 -0
- package/node_modules/zod/v4/locales/el.js +109 -0
- package/node_modules/zod/v4/locales/en.cjs +4 -0
- package/node_modules/zod/v4/locales/en.js +4 -0
- package/node_modules/zod/v4/locales/fr.cjs +24 -7
- package/node_modules/zod/v4/locales/fr.js +24 -7
- package/node_modules/zod/v4/locales/hr.cjs +149 -0
- package/node_modules/zod/v4/locales/hr.d.cts +5 -0
- package/node_modules/zod/v4/locales/hr.d.ts +4 -0
- package/node_modules/zod/v4/locales/hr.js +122 -0
- package/node_modules/zod/v4/locales/index.cjs +8 -1
- package/node_modules/zod/v4/locales/index.d.cts +3 -0
- package/node_modules/zod/v4/locales/index.d.ts +3 -0
- package/node_modules/zod/v4/locales/index.js +3 -0
- package/node_modules/zod/v4/locales/it.cjs +1 -1
- package/node_modules/zod/v4/locales/it.js +1 -1
- package/node_modules/zod/v4/locales/ka.cjs +8 -8
- package/node_modules/zod/v4/locales/ka.js +8 -8
- package/node_modules/zod/v4/locales/package.json +2 -1
- package/node_modules/zod/v4/locales/ro.cjs +146 -0
- package/node_modules/zod/v4/locales/ro.d.cts +5 -0
- package/node_modules/zod/v4/locales/ro.d.ts +4 -0
- package/node_modules/zod/v4/locales/ro.js +119 -0
- package/node_modules/zod/v4/locales/uz.cjs +1 -0
- package/node_modules/zod/v4/locales/uz.js +1 -0
- package/node_modules/zod/v4/mini/external.d.cts +1 -0
- package/node_modules/zod/v4/mini/external.d.ts +1 -0
- package/node_modules/zod/v4/mini/package.json +2 -1
- package/node_modules/zod/v4/mini/schemas.cjs +41 -4
- package/node_modules/zod/v4/mini/schemas.d.cts +28 -10
- package/node_modules/zod/v4/mini/schemas.d.ts +28 -10
- package/node_modules/zod/v4/mini/schemas.js +40 -4
- package/node_modules/zod/v4/package.json +2 -1
- package/node_modules/zod/v4-mini/package.json +2 -1
- package/package.json +5 -5
- package/web/.next/standalone/packages/web/.next/BUILD_ID +1 -1
- package/web/.next/standalone/packages/web/.next/app-path-routes-manifest.json +8 -8
- package/web/.next/standalone/packages/web/.next/build-manifest.json +3 -3
- package/web/.next/standalone/packages/web/.next/prerender-manifest.json +3 -3
- package/web/.next/standalone/packages/web/.next/react-loadable-manifest.json +15 -3
- package/web/.next/standalone/packages/web/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/_global-error.html +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/_global-error.rsc +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/_not-found/page.js +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/bridge/connect/page.js +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/bridge/connect/page.js.nft.json +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/bridge/connect/page_client-reference-manifest.js +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/embed/terminal/[id]/page.js +3 -5
- package/web/.next/standalone/packages/web/.next/server/app/embed/terminal/[id]/page.js.nft.json +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/embed/terminal/[id]/page_client-reference-manifest.js +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/page.js +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/page.js.nft.json +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/page_client-reference-manifest.js +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/sessions/[id]/page.js +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/sessions/[id]/page.js.nft.json +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/sessions/[id]/page_client-reference-manifest.js +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/settings/bridge/page.js +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/settings/bridge/page.js.nft.json +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/settings/bridge/page_client-reference-manifest.js +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/sign-in/[[...sign-in]]/page.js +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/sign-in/[[...sign-in]]/page.js.nft.json +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/sign-in/[[...sign-in]]/page_client-reference-manifest.js +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/sign-in/hosted/page.js +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/sign-in/hosted/page.js.nft.json +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/sign-in/hosted/page_client-reference-manifest.js +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/sign-in/sso-callback/page.js +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/sign-in/sso-callback/page.js.nft.json +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/sign-in/sso-callback/page_client-reference-manifest.js +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/sign-up/[[...sign-up]]/page.js +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/sign-up/[[...sign-up]]/page.js.nft.json +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/sign-up/[[...sign-up]]/page_client-reference-manifest.js +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/unlock/page.js +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/unlock/page.js.nft.json +1 -1
- package/web/.next/standalone/packages/web/.next/server/app/unlock/page_client-reference-manifest.js +1 -1
- package/web/.next/standalone/packages/web/.next/server/app-paths-manifest.json +8 -8
- package/web/.next/standalone/packages/web/.next/server/chunks/1339.js +3 -0
- package/web/.next/standalone/packages/web/.next/server/chunks/2013.js +1 -0
- package/web/.next/standalone/packages/web/.next/server/chunks/276.js +1 -0
- package/web/.next/standalone/packages/web/.next/server/chunks/5127.js +1 -0
- package/web/.next/standalone/packages/web/.next/server/chunks/6213.js +3 -3
- package/web/.next/standalone/packages/web/.next/server/chunks/9455.js +1 -1
- package/web/.next/standalone/packages/web/.next/server/middleware-build-manifest.js +1 -1
- package/web/.next/standalone/packages/web/.next/server/middleware-react-loadable-manifest.js +1 -1
- package/web/.next/standalone/packages/web/.next/server/pages/500.html +1 -1
- package/web/.next/standalone/packages/web/.next/server/server-reference-manifest.js +1 -1
- package/web/.next/standalone/packages/web/.next/server/server-reference-manifest.json +1 -1
- package/web/.next/standalone/packages/web/.next/static/chunks/32341.b08256296d42e066.js +1 -0
- package/web/.next/standalone/packages/web/.next/static/chunks/34443.a0277d3c21383e3f.js +1 -0
- package/web/.next/standalone/packages/web/.next/static/chunks/62821.b4e3e384e988c8a5.js +1 -0
- package/web/.next/standalone/packages/web/.next/static/chunks/{74419-40f44b554832e9fb.js → 74419-0aabe7c6c5d27082.js} +2 -2
- package/web/.next/standalone/packages/web/.next/static/chunks/app/embed/terminal/[id]/page-51ad995aad07251f.js +2 -0
- package/web/.next/standalone/packages/web/.next/static/chunks/app/{layout-fc34c3ab4e013a5b.js → layout-21522e861808c8bf.js} +1 -1
- package/web/.next/standalone/packages/web/.next/static/chunks/webpack-cbab49114808171a.js +1 -0
- package/web/.next/standalone/packages/web/.next/static/css/840f2f3d9c886f61.css +1 -0
- package/web/.next/static/chunks/32341.b08256296d42e066.js +1 -0
- package/web/.next/static/chunks/34443.a0277d3c21383e3f.js +1 -0
- package/web/.next/static/chunks/62821.b4e3e384e988c8a5.js +1 -0
- package/web/.next/static/chunks/{74419-40f44b554832e9fb.js → 74419-0aabe7c6c5d27082.js} +2 -2
- package/web/.next/static/chunks/app/embed/terminal/[id]/page-51ad995aad07251f.js +2 -0
- package/web/.next/static/chunks/app/{layout-fc34c3ab4e013a5b.js → layout-21522e861808c8bf.js} +1 -1
- package/web/.next/static/chunks/webpack-cbab49114808171a.js +1 -0
- package/web/.next/static/css/840f2f3d9c886f61.css +1 -0
- package/web/.next/standalone/packages/web/.next/server/chunks/25.js +0 -1
- package/web/.next/standalone/packages/web/.next/server/chunks/3881.js +0 -1
- package/web/.next/standalone/packages/web/.next/static/chunks/34443.3532c8a78fd72d73.js +0 -1
- package/web/.next/standalone/packages/web/.next/static/chunks/71753.1aca0cf48b1461f3.js +0 -1
- package/web/.next/standalone/packages/web/.next/static/chunks/app/embed/terminal/[id]/page-471550689324d212.js +0 -2
- package/web/.next/standalone/packages/web/.next/static/chunks/webpack-a5ce960b2dff074a.js +0 -1
- package/web/.next/standalone/packages/web/.next/static/css/d43fa5e7016a3fed.css +0 -1
- package/web/.next/static/chunks/34443.3532c8a78fd72d73.js +0 -1
- package/web/.next/static/chunks/71753.1aca0cf48b1461f3.js +0 -1
- package/web/.next/static/chunks/app/embed/terminal/[id]/page-471550689324d212.js +0 -2
- package/web/.next/static/chunks/webpack-a5ce960b2dff074a.js +0 -1
- package/web/.next/static/css/d43fa5e7016a3fed.css +0 -1
- /package/web/.next/standalone/packages/web/.next/static/{PoyqH1XdDksbZ-lIHuiao → 5pQxL9tu2ET9VWhEzDShA}/_buildManifest.js +0 -0
- /package/web/.next/standalone/packages/web/.next/static/{PoyqH1XdDksbZ-lIHuiao → 5pQxL9tu2ET9VWhEzDShA}/_ssgManifest.js +0 -0
- /package/web/.next/standalone/packages/web/.next/static/chunks/{ca465714-871cd8ade4ec9803.js → ca465714.871cd8ade4ec9803.js} +0 -0
- /package/web/.next/static/{PoyqH1XdDksbZ-lIHuiao → 5pQxL9tu2ET9VWhEzDShA}/_buildManifest.js +0 -0
- /package/web/.next/static/{PoyqH1XdDksbZ-lIHuiao → 5pQxL9tu2ET9VWhEzDShA}/_ssgManifest.js +0 -0
- /package/web/.next/static/chunks/{ca465714-871cd8ade4ec9803.js → ca465714.871cd8ade4ec9803.js} +0 -0
|
@@ -142,7 +142,7 @@ function doubleQuotedValue(source, onError) {
|
|
|
142
142
|
next = source[++i + 1];
|
|
143
143
|
}
|
|
144
144
|
else if (next === 'x' || next === 'u' || next === 'U') {
|
|
145
|
-
const length =
|
|
145
|
+
const length = next === 'x' ? 2 : next === 'u' ? 4 : 8;
|
|
146
146
|
res += parseCharCode(source, i + 1, length, onError);
|
|
147
147
|
i += length;
|
|
148
148
|
}
|
|
@@ -212,12 +212,14 @@ function parseCharCode(source, offset, length, onError) {
|
|
|
212
212
|
const cc = source.substr(offset, length);
|
|
213
213
|
const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
|
|
214
214
|
const code = ok ? parseInt(cc, 16) : NaN;
|
|
215
|
-
|
|
215
|
+
try {
|
|
216
|
+
return String.fromCodePoint(code);
|
|
217
|
+
}
|
|
218
|
+
catch {
|
|
216
219
|
const raw = source.substr(offset - 2, length + 2);
|
|
217
220
|
onError(offset - 2, 'BAD_DQ_ESCAPE', `Invalid escape sequence ${raw}`);
|
|
218
221
|
return raw;
|
|
219
222
|
}
|
|
220
|
-
return String.fromCodePoint(code);
|
|
221
223
|
}
|
|
222
224
|
|
|
223
225
|
export { resolveFlowScalar };
|
|
@@ -19,6 +19,8 @@ class Alias extends NodeBase {
|
|
|
19
19
|
* instance of the `source` anchor before this node.
|
|
20
20
|
*/
|
|
21
21
|
resolve(doc, ctx) {
|
|
22
|
+
if (ctx?.maxAliasCount === 0)
|
|
23
|
+
throw new ReferenceError('Alias resolution is disabled');
|
|
22
24
|
let nodes;
|
|
23
25
|
if (ctx?.aliasResolveCache) {
|
|
24
26
|
nodes = ctx.aliasResolveCache;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { isScalar,
|
|
1
|
+
import { isScalar, isSeq, isAlias, isMap } from '../../nodes/identity.js';
|
|
2
2
|
import { Scalar } from '../../nodes/Scalar.js';
|
|
3
3
|
|
|
4
4
|
// If the value associated with a merge key is a single mapping node, each of
|
|
@@ -26,18 +26,18 @@ const isMergeKey = (ctx, key) => (merge.identify(key) ||
|
|
|
26
26
|
merge.identify(key.value))) &&
|
|
27
27
|
ctx?.doc.schema.tags.some(tag => tag.tag === merge.tag && tag.default);
|
|
28
28
|
function addMergeToJSMap(ctx, map, value) {
|
|
29
|
-
|
|
30
|
-
if (isSeq(
|
|
31
|
-
for (const it of
|
|
29
|
+
const source = resolveAliasValue(ctx, value);
|
|
30
|
+
if (isSeq(source))
|
|
31
|
+
for (const it of source.items)
|
|
32
32
|
mergeValue(ctx, map, it);
|
|
33
|
-
else if (Array.isArray(
|
|
34
|
-
for (const it of
|
|
33
|
+
else if (Array.isArray(source))
|
|
34
|
+
for (const it of source)
|
|
35
35
|
mergeValue(ctx, map, it);
|
|
36
36
|
else
|
|
37
|
-
mergeValue(ctx, map,
|
|
37
|
+
mergeValue(ctx, map, source);
|
|
38
38
|
}
|
|
39
39
|
function mergeValue(ctx, map, value) {
|
|
40
|
-
const source = ctx
|
|
40
|
+
const source = resolveAliasValue(ctx, value);
|
|
41
41
|
if (!isMap(source))
|
|
42
42
|
throw new Error('Merge sources must be maps or map aliases');
|
|
43
43
|
const srcMap = source.toJSON(null, ctx, Map);
|
|
@@ -60,5 +60,8 @@ function mergeValue(ctx, map, value) {
|
|
|
60
60
|
}
|
|
61
61
|
return map;
|
|
62
62
|
}
|
|
63
|
+
function resolveAliasValue(ctx, value) {
|
|
64
|
+
return ctx && isAlias(value) ? value.resolve(ctx.doc, ctx) : value;
|
|
65
|
+
}
|
|
63
66
|
|
|
64
67
|
export { addMergeToJSMap, isMergeKey, merge };
|
|
@@ -8,7 +8,8 @@ function stringifyNumber({ format, minFractionDigits, tag, value }) {
|
|
|
8
8
|
if (!format &&
|
|
9
9
|
minFractionDigits &&
|
|
10
10
|
(!tag || tag === 'tag:yaml.org,2002:float') &&
|
|
11
|
-
|
|
11
|
+
/^-?\d/.test(n) &&
|
|
12
|
+
!n.includes('e')) {
|
|
12
13
|
let i = n.indexOf('.');
|
|
13
14
|
if (i < 0) {
|
|
14
15
|
i = n.length;
|
|
@@ -144,7 +144,7 @@ function doubleQuotedValue(source, onError) {
|
|
|
144
144
|
next = source[++i + 1];
|
|
145
145
|
}
|
|
146
146
|
else if (next === 'x' || next === 'u' || next === 'U') {
|
|
147
|
-
const length =
|
|
147
|
+
const length = next === 'x' ? 2 : next === 'u' ? 4 : 8;
|
|
148
148
|
res += parseCharCode(source, i + 1, length, onError);
|
|
149
149
|
i += length;
|
|
150
150
|
}
|
|
@@ -214,12 +214,14 @@ function parseCharCode(source, offset, length, onError) {
|
|
|
214
214
|
const cc = source.substr(offset, length);
|
|
215
215
|
const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);
|
|
216
216
|
const code = ok ? parseInt(cc, 16) : NaN;
|
|
217
|
-
|
|
217
|
+
try {
|
|
218
|
+
return String.fromCodePoint(code);
|
|
219
|
+
}
|
|
220
|
+
catch {
|
|
218
221
|
const raw = source.substr(offset - 2, length + 2);
|
|
219
222
|
onError(offset - 2, 'BAD_DQ_ESCAPE', `Invalid escape sequence ${raw}`);
|
|
220
223
|
return raw;
|
|
221
224
|
}
|
|
222
|
-
return String.fromCodePoint(code);
|
|
223
225
|
}
|
|
224
226
|
|
|
225
227
|
exports.resolveFlowScalar = resolveFlowScalar;
|
|
@@ -21,6 +21,8 @@ class Alias extends Node.NodeBase {
|
|
|
21
21
|
* instance of the `source` anchor before this node.
|
|
22
22
|
*/
|
|
23
23
|
resolve(doc, ctx) {
|
|
24
|
+
if (ctx?.maxAliasCount === 0)
|
|
25
|
+
throw new ReferenceError('Alias resolution is disabled');
|
|
24
26
|
let nodes;
|
|
25
27
|
if (ctx?.aliasResolveCache) {
|
|
26
28
|
nodes = ctx.aliasResolveCache;
|
|
@@ -31,7 +31,11 @@ export declare class Scalar<T = unknown> extends NodeBase {
|
|
|
31
31
|
* The YAML 1.1 schema also supports 'BIN' and 'TIME'
|
|
32
32
|
*/
|
|
33
33
|
format?: string;
|
|
34
|
-
/**
|
|
34
|
+
/**
|
|
35
|
+
* If `value` is a number that is serialized as a decimal string
|
|
36
|
+
* (i.e. not using exponential notation),
|
|
37
|
+
* use this value when stringifying this node.
|
|
38
|
+
*/
|
|
35
39
|
minFractionDigits?: number;
|
|
36
40
|
/** Set during parsing to the source string value */
|
|
37
41
|
source?: string;
|
|
@@ -28,18 +28,18 @@ const isMergeKey = (ctx, key) => (merge.identify(key) ||
|
|
|
28
28
|
merge.identify(key.value))) &&
|
|
29
29
|
ctx?.doc.schema.tags.some(tag => tag.tag === merge.tag && tag.default);
|
|
30
30
|
function addMergeToJSMap(ctx, map, value) {
|
|
31
|
-
|
|
32
|
-
if (identity.isSeq(
|
|
33
|
-
for (const it of
|
|
31
|
+
const source = resolveAliasValue(ctx, value);
|
|
32
|
+
if (identity.isSeq(source))
|
|
33
|
+
for (const it of source.items)
|
|
34
34
|
mergeValue(ctx, map, it);
|
|
35
|
-
else if (Array.isArray(
|
|
36
|
-
for (const it of
|
|
35
|
+
else if (Array.isArray(source))
|
|
36
|
+
for (const it of source)
|
|
37
37
|
mergeValue(ctx, map, it);
|
|
38
38
|
else
|
|
39
|
-
mergeValue(ctx, map,
|
|
39
|
+
mergeValue(ctx, map, source);
|
|
40
40
|
}
|
|
41
41
|
function mergeValue(ctx, map, value) {
|
|
42
|
-
const source = ctx
|
|
42
|
+
const source = resolveAliasValue(ctx, value);
|
|
43
43
|
if (!identity.isMap(source))
|
|
44
44
|
throw new Error('Merge sources must be maps or map aliases');
|
|
45
45
|
const srcMap = source.toJSON(null, ctx, Map);
|
|
@@ -62,6 +62,9 @@ function mergeValue(ctx, map, value) {
|
|
|
62
62
|
}
|
|
63
63
|
return map;
|
|
64
64
|
}
|
|
65
|
+
function resolveAliasValue(ctx, value) {
|
|
66
|
+
return ctx && identity.isAlias(value) ? value.resolve(ctx.doc, ctx) : value;
|
|
67
|
+
}
|
|
65
68
|
|
|
66
69
|
exports.addMergeToJSMap = addMergeToJSMap;
|
|
67
70
|
exports.isMergeKey = isMergeKey;
|
|
@@ -10,7 +10,8 @@ function stringifyNumber({ format, minFractionDigits, tag, value }) {
|
|
|
10
10
|
if (!format &&
|
|
11
11
|
minFractionDigits &&
|
|
12
12
|
(!tag || tag === 'tag:yaml.org,2002:float') &&
|
|
13
|
-
|
|
13
|
+
/^-?\d/.test(n) &&
|
|
14
|
+
!n.includes('e')) {
|
|
14
15
|
let i = n.indexOf('.');
|
|
15
16
|
if (i < 0) {
|
|
16
17
|
i = n.length;
|
|
@@ -31,23 +31,6 @@
|
|
|
31
31
|
<br/>
|
|
32
32
|
<br/>
|
|
33
33
|
|
|
34
|
-
<h2 align="center">Featured sponsor: Jazz</h2>
|
|
35
|
-
|
|
36
|
-
<div align="center">
|
|
37
|
-
<a href="https://jazz.tools/?utm_source=zod">
|
|
38
|
-
<picture width="85%" >
|
|
39
|
-
<source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/garden-co/jazz/938f6767e46cdfded60e50d99bf3b533f4809c68/homepage/homepage/public/Zod%20sponsor%20message.png">
|
|
40
|
-
<img alt="jazz logo" src="https://raw.githubusercontent.com/garden-co/jazz/938f6767e46cdfded60e50d99bf3b533f4809c68/homepage/homepage/public/Zod%20sponsor%20message.png" width="85%">
|
|
41
|
-
</picture>
|
|
42
|
-
</a>
|
|
43
|
-
<br/>
|
|
44
|
-
<p><sub>Learn more about <a target="_blank" rel="noopener noreferrer" href="mailto:sponsorship@colinhacks.com">featured sponsorships</a></sub></p>
|
|
45
|
-
</div>
|
|
46
|
-
|
|
47
|
-
<br/>
|
|
48
|
-
<br/>
|
|
49
|
-
<br/>
|
|
50
|
-
|
|
51
34
|
### [Read the docs →](https://zod.dev/api)
|
|
52
35
|
|
|
53
36
|
<br/>
|
|
@@ -169,7 +152,7 @@ if (!result.success) {
|
|
|
169
152
|
}
|
|
170
153
|
```
|
|
171
154
|
|
|
172
|
-
**Note** — If your schema uses certain asynchronous APIs like `async` [refinements](#
|
|
155
|
+
**Note** — If your schema uses certain asynchronous APIs like `async` [refinements](https://zod.dev/api#refinements) or [transforms](https://zod.dev/api#transforms), you'll need to use the `.safeParseAsync()` method instead.
|
|
173
156
|
|
|
174
157
|
```ts
|
|
175
158
|
const schema = z.string().refine(async (val) => val.length <= 8);
|
|
@@ -16,7 +16,7 @@ type TestFormErrors = z.inferFlattenedErrors<typeof Test>;
|
|
|
16
16
|
test("default flattened errors type inference", () => {
|
|
17
17
|
type TestTypeErrors = {
|
|
18
18
|
formErrors: string[];
|
|
19
|
-
fieldErrors: { [P in keyof z.TypeOf<typeof Test>]?: string[]
|
|
19
|
+
fieldErrors: { [P in keyof z.TypeOf<typeof Test>]?: string[] };
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
util.assertEqual<z.inferFlattenedErrors<typeof Test>, TestTypeErrors>(true);
|
|
@@ -28,7 +28,7 @@ test("custom flattened errors type inference", () => {
|
|
|
28
28
|
type TestTypeErrors = {
|
|
29
29
|
formErrors: ErrorType[];
|
|
30
30
|
fieldErrors: {
|
|
31
|
-
[P in keyof z.TypeOf<typeof Test>]?: ErrorType[]
|
|
31
|
+
[P in keyof z.TypeOf<typeof Test>]?: ErrorType[];
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
34
|
|
|
@@ -40,7 +40,7 @@ test("custom flattened errors type inference", () => {
|
|
|
40
40
|
test("form errors type inference", () => {
|
|
41
41
|
type TestTypeErrors = {
|
|
42
42
|
formErrors: string[];
|
|
43
|
-
fieldErrors: { [P in keyof z.TypeOf<typeof Test>]?: string[]
|
|
43
|
+
fieldErrors: { [P in keyof z.TypeOf<typeof Test>]?: string[] };
|
|
44
44
|
};
|
|
45
45
|
|
|
46
46
|
util.assertEqual<z.inferFlattenedErrors<typeof Test>, TestTypeErrors>(true);
|
|
@@ -212,9 +212,9 @@ test("inferred merged object type with optional properties", async () => {
|
|
|
212
212
|
.object({ a: z.string(), b: z.string().optional() })
|
|
213
213
|
.merge(z.object({ a: z.string().optional(), b: z.string() }));
|
|
214
214
|
type Merged = z.infer<typeof Merged>;
|
|
215
|
-
util.assertEqual<Merged, { a?: string; b: string }>(true);
|
|
215
|
+
util.assertEqual<Merged, { a?: string | undefined; b: string }>(true);
|
|
216
216
|
// todo
|
|
217
|
-
// util.assertEqual<Merged, { a?: string; b: string }>(true);
|
|
217
|
+
// util.assertEqual<Merged, { a?: string | undefined; b: string }>(true);
|
|
218
218
|
});
|
|
219
219
|
|
|
220
220
|
test("inferred unioned object type with optional properties", async () => {
|
|
@@ -223,7 +223,7 @@ test("inferred unioned object type with optional properties", async () => {
|
|
|
223
223
|
z.object({ a: z.string().optional(), b: z.string() }),
|
|
224
224
|
]);
|
|
225
225
|
type Unioned = z.infer<typeof Unioned>;
|
|
226
|
-
util.assertEqual<Unioned, { a: string; b?: string } | { a?: string; b: string }>(true);
|
|
226
|
+
util.assertEqual<Unioned, { a: string; b?: string | undefined } | { a?: string | undefined; b: string }>(true);
|
|
227
227
|
});
|
|
228
228
|
|
|
229
229
|
test("inferred enum type", async () => {
|
|
@@ -245,13 +245,13 @@ test("inferred enum type", async () => {
|
|
|
245
245
|
test("inferred partial object type with optional properties", async () => {
|
|
246
246
|
const Partial = z.object({ a: z.string(), b: z.string().optional() }).partial();
|
|
247
247
|
type Partial = z.infer<typeof Partial>;
|
|
248
|
-
util.assertEqual<Partial, { a?: string; b?: string }>(true);
|
|
248
|
+
util.assertEqual<Partial, { a?: string | undefined; b?: string | undefined }>(true);
|
|
249
249
|
});
|
|
250
250
|
|
|
251
251
|
test("inferred picked object type with optional properties", async () => {
|
|
252
252
|
const Picked = z.object({ a: z.string(), b: z.string().optional() }).pick({ b: true });
|
|
253
253
|
type Picked = z.infer<typeof Picked>;
|
|
254
|
-
util.assertEqual<Picked, { b?: string }>(true);
|
|
254
|
+
util.assertEqual<Picked, { b?: string | undefined }>(true);
|
|
255
255
|
});
|
|
256
256
|
|
|
257
257
|
test("inferred type for unknown/any keys", () => {
|
|
@@ -21,7 +21,7 @@ test("shallow inference", () => {
|
|
|
21
21
|
name?: string | undefined;
|
|
22
22
|
age?: number | undefined;
|
|
23
23
|
outer?: { inner: string } | undefined;
|
|
24
|
-
array?: { asdf: string }[];
|
|
24
|
+
array?: { asdf: string }[] | undefined;
|
|
25
25
|
};
|
|
26
26
|
util.assertEqual<shallow, correct>(true);
|
|
27
27
|
});
|
|
@@ -41,7 +41,7 @@ test("deep partial inference", () => {
|
|
|
41
41
|
asdf.parse("asdf");
|
|
42
42
|
type deep = z.infer<typeof deep>;
|
|
43
43
|
type correct = {
|
|
44
|
-
array?: { asdf?: string }[];
|
|
44
|
+
array?: { asdf?: string | undefined }[] | undefined;
|
|
45
45
|
name?: string | undefined;
|
|
46
46
|
age?: number | undefined;
|
|
47
47
|
outer?: { inner?: string | undefined } | undefined;
|
|
@@ -118,7 +118,7 @@ test("deep partial inference", () => {
|
|
|
118
118
|
asdf?: string | undefined;
|
|
119
119
|
}[]
|
|
120
120
|
| undefined;
|
|
121
|
-
tuple?: [{ value?: string }] | undefined;
|
|
121
|
+
tuple?: [{ value?: string | undefined }] | undefined;
|
|
122
122
|
};
|
|
123
123
|
util.assertEqual<expected, partialed>(true);
|
|
124
124
|
});
|
|
@@ -61,8 +61,8 @@ const initializer = (inst: ZodError, issues: core.$ZodIssue[]) => {
|
|
|
61
61
|
// },
|
|
62
62
|
// });
|
|
63
63
|
};
|
|
64
|
-
export const ZodError: core.$constructor<ZodError> = core.$constructor("ZodError", initializer);
|
|
65
|
-
export const ZodRealError: core.$constructor<ZodError> = core.$constructor("ZodError", initializer, {
|
|
64
|
+
export const ZodError: core.$constructor<ZodError> = /*@__PURE__*/ core.$constructor("ZodError", initializer);
|
|
65
|
+
export const ZodRealError: core.$constructor<ZodError> = /*@__PURE__*/ core.$constructor("ZodError", initializer, {
|
|
66
66
|
Parent: Error,
|
|
67
67
|
});
|
|
68
68
|
|
|
@@ -29,7 +29,7 @@ interface ConversionContext {
|
|
|
29
29
|
}
|
|
30
30
|
|
|
31
31
|
// Keys that are recognized and handled by the conversion logic
|
|
32
|
-
const RECOGNIZED_KEYS = new Set([
|
|
32
|
+
const RECOGNIZED_KEYS = /*@__PURE__*/ new Set([
|
|
33
33
|
// Schema identification
|
|
34
34
|
"$schema",
|
|
35
35
|
"$ref",
|
|
@@ -478,10 +478,10 @@ function convertBaseSchema(schema: JSONSchema.JSONSchema, ctx: ConversionContext
|
|
|
478
478
|
}
|
|
479
479
|
// Apply minItems/maxItems constraints to tuples
|
|
480
480
|
if (typeof schema.minItems === "number") {
|
|
481
|
-
zodSchema =
|
|
481
|
+
zodSchema = zodSchema.check(z.minLength(schema.minItems));
|
|
482
482
|
}
|
|
483
483
|
if (typeof schema.maxItems === "number") {
|
|
484
|
-
zodSchema =
|
|
484
|
+
zodSchema = zodSchema.check(z.maxLength(schema.maxItems));
|
|
485
485
|
}
|
|
486
486
|
} else if (Array.isArray(items)) {
|
|
487
487
|
// Tuple with items array (draft-7)
|
|
@@ -497,10 +497,10 @@ function convertBaseSchema(schema: JSONSchema.JSONSchema, ctx: ConversionContext
|
|
|
497
497
|
}
|
|
498
498
|
// Apply minItems/maxItems constraints to tuples
|
|
499
499
|
if (typeof schema.minItems === "number") {
|
|
500
|
-
zodSchema =
|
|
500
|
+
zodSchema = zodSchema.check(z.minLength(schema.minItems));
|
|
501
501
|
}
|
|
502
502
|
if (typeof schema.maxItems === "number") {
|
|
503
|
-
zodSchema =
|
|
503
|
+
zodSchema = zodSchema.check(z.maxLength(schema.maxItems));
|
|
504
504
|
}
|
|
505
505
|
} else if (items !== undefined) {
|
|
506
506
|
// Regular array
|
|
@@ -509,10 +509,10 @@ function convertBaseSchema(schema: JSONSchema.JSONSchema, ctx: ConversionContext
|
|
|
509
509
|
|
|
510
510
|
// Apply constraints
|
|
511
511
|
if (typeof schema.minItems === "number") {
|
|
512
|
-
arraySchema =
|
|
512
|
+
arraySchema = arraySchema.min(schema.minItems);
|
|
513
513
|
}
|
|
514
514
|
if (typeof schema.maxItems === "number") {
|
|
515
|
-
arraySchema =
|
|
515
|
+
arraySchema = arraySchema.max(schema.maxItems);
|
|
516
516
|
}
|
|
517
517
|
|
|
518
518
|
zodSchema = arraySchema;
|
|
@@ -527,14 +527,6 @@ function convertBaseSchema(schema: JSONSchema.JSONSchema, ctx: ConversionContext
|
|
|
527
527
|
throw new Error(`Unsupported type: ${type}`);
|
|
528
528
|
}
|
|
529
529
|
|
|
530
|
-
// Apply metadata
|
|
531
|
-
if (schema.description) {
|
|
532
|
-
zodSchema = zodSchema.describe(schema.description);
|
|
533
|
-
}
|
|
534
|
-
if (schema.default !== undefined) {
|
|
535
|
-
zodSchema = (zodSchema as any).default(schema.default);
|
|
536
|
-
}
|
|
537
|
-
|
|
538
530
|
return zodSchema;
|
|
539
531
|
}
|
|
540
532
|
|
|
@@ -586,10 +578,18 @@ function convertSchema(schema: JSONSchema.JSONSchema | boolean, ctx: ConversionC
|
|
|
586
578
|
baseSchema = z.readonly(baseSchema);
|
|
587
579
|
}
|
|
588
580
|
|
|
589
|
-
//
|
|
581
|
+
// Apply `default` so it wraps the fully-composed schema. This ensures
|
|
582
|
+
// `parse(undefined) -> default` works regardless of which branch of
|
|
583
|
+
// `convertBaseSchema` produced the inner schema (enum/const/not/typed/etc.).
|
|
584
|
+
if (schema.default !== undefined) {
|
|
585
|
+
baseSchema = baseSchema.default(schema.default);
|
|
586
|
+
}
|
|
587
|
+
|
|
588
|
+
// Collect non-description annotation metadata into the user-supplied
|
|
589
|
+
// registry. Description is handled separately below via `.describe()` to
|
|
590
|
+
// preserve the contract that `schema.description` reads from globalRegistry.
|
|
590
591
|
const extraMeta: Record<string, unknown> = {};
|
|
591
592
|
|
|
592
|
-
// Core schema keywords that should be captured as metadata
|
|
593
593
|
const coreMetadataKeys = ["$id", "id", "$comment", "$anchor", "$vocabulary", "$dynamicRef", "$dynamicAnchor"];
|
|
594
594
|
for (const key of coreMetadataKeys) {
|
|
595
595
|
if (key in schema) {
|
|
@@ -597,7 +597,6 @@ function convertSchema(schema: JSONSchema.JSONSchema | boolean, ctx: ConversionC
|
|
|
597
597
|
}
|
|
598
598
|
}
|
|
599
599
|
|
|
600
|
-
// Content keywords - store as metadata
|
|
601
600
|
const contentMetadataKeys = ["contentEncoding", "contentMediaType", "contentSchema"];
|
|
602
601
|
for (const key of contentMetadataKeys) {
|
|
603
602
|
if (key in schema) {
|
|
@@ -605,7 +604,6 @@ function convertSchema(schema: JSONSchema.JSONSchema | boolean, ctx: ConversionC
|
|
|
605
604
|
}
|
|
606
605
|
}
|
|
607
606
|
|
|
608
|
-
// Unrecognized keys (custom metadata)
|
|
609
607
|
for (const key of Object.keys(schema)) {
|
|
610
608
|
if (!RECOGNIZED_KEYS.has(key)) {
|
|
611
609
|
extraMeta[key] = schema[key];
|
|
@@ -616,6 +614,13 @@ function convertSchema(schema: JSONSchema.JSONSchema | boolean, ctx: ConversionC
|
|
|
616
614
|
ctx.registry.add(baseSchema, extraMeta);
|
|
617
615
|
}
|
|
618
616
|
|
|
617
|
+
// Apply description last. `.describe()` clones the schema and sets
|
|
618
|
+
// `_zod.parent` on the clone, so registry lookups on the returned reference
|
|
619
|
+
// still resolve `extraMeta` via parent inheritance.
|
|
620
|
+
if (schema.description) {
|
|
621
|
+
baseSchema = baseSchema.describe(schema.description);
|
|
622
|
+
}
|
|
623
|
+
|
|
619
624
|
return baseSchema;
|
|
620
625
|
}
|
|
621
626
|
|
|
@@ -627,17 +632,28 @@ export function fromJSONSchema(schema: JSONSchema.JSONSchema | boolean, params?:
|
|
|
627
632
|
return schema ? z.any() : z.never();
|
|
628
633
|
}
|
|
629
634
|
|
|
630
|
-
|
|
631
|
-
|
|
635
|
+
// Normalize input via a JSON round-trip. This guarantees the converter
|
|
636
|
+
// walks a plain, finite, JSON-valid object graph: cyclic inputs fail here,
|
|
637
|
+
// getter/Proxy-based properties are materialized into static values, and
|
|
638
|
+
// class instances collapse to plain objects.
|
|
639
|
+
let normalized: JSONSchema.JSONSchema;
|
|
640
|
+
try {
|
|
641
|
+
normalized = JSON.parse(JSON.stringify(schema));
|
|
642
|
+
} catch {
|
|
643
|
+
throw new Error("fromJSONSchema input is not valid JSON (possibly cyclic); use $defs/$ref for recursive schemas");
|
|
644
|
+
}
|
|
645
|
+
|
|
646
|
+
const version = detectVersion(normalized, params?.defaultTarget);
|
|
647
|
+
const defs = (normalized.$defs || normalized.definitions || {}) as Record<string, JSONSchema.JSONSchema>;
|
|
632
648
|
|
|
633
649
|
const ctx: ConversionContext = {
|
|
634
650
|
version,
|
|
635
651
|
defs,
|
|
636
652
|
refs: new Map(),
|
|
637
653
|
processing: new Set(),
|
|
638
|
-
rootSchema:
|
|
654
|
+
rootSchema: normalized,
|
|
639
655
|
registry: params?.registry ?? globalRegistry,
|
|
640
656
|
};
|
|
641
657
|
|
|
642
|
-
return convertSchema(
|
|
658
|
+
return convertSchema(normalized, ctx);
|
|
643
659
|
}
|
|
@@ -10,14 +10,14 @@ export const parse: <T extends core.$ZodType>(
|
|
|
10
10
|
value: unknown,
|
|
11
11
|
_ctx?: core.ParseContext<core.$ZodIssue>,
|
|
12
12
|
_params?: { callee?: core.util.AnyFunc; Err?: core.$ZodErrorClass }
|
|
13
|
-
) => core.output<T> = /* @__PURE__ */ core._parse(ZodRealError)
|
|
13
|
+
) => core.output<T> = /* @__PURE__ */ core._parse(ZodRealError);
|
|
14
14
|
|
|
15
15
|
export const parseAsync: <T extends core.$ZodType>(
|
|
16
16
|
schema: T,
|
|
17
17
|
value: unknown,
|
|
18
18
|
_ctx?: core.ParseContext<core.$ZodIssue>,
|
|
19
19
|
_params?: { callee?: core.util.AnyFunc; Err?: core.$ZodErrorClass }
|
|
20
|
-
) => Promise<core.output<T>> = /* @__PURE__ */ core._parseAsync(ZodRealError)
|
|
20
|
+
) => Promise<core.output<T>> = /* @__PURE__ */ core._parseAsync(ZodRealError);
|
|
21
21
|
|
|
22
22
|
export const safeParse: <T extends core.$ZodType>(
|
|
23
23
|
schema: T,
|
|
@@ -37,25 +37,25 @@ export const encode: <T extends core.$ZodType>(
|
|
|
37
37
|
schema: T,
|
|
38
38
|
value: core.output<T>,
|
|
39
39
|
_ctx?: core.ParseContext<core.$ZodIssue>
|
|
40
|
-
) => core.input<T> = /* @__PURE__ */ core._encode(ZodRealError)
|
|
40
|
+
) => core.input<T> = /* @__PURE__ */ core._encode(ZodRealError);
|
|
41
41
|
|
|
42
42
|
export const decode: <T extends core.$ZodType>(
|
|
43
43
|
schema: T,
|
|
44
44
|
value: core.input<T>,
|
|
45
45
|
_ctx?: core.ParseContext<core.$ZodIssue>
|
|
46
|
-
) => core.output<T> = /* @__PURE__ */ core._decode(ZodRealError)
|
|
46
|
+
) => core.output<T> = /* @__PURE__ */ core._decode(ZodRealError);
|
|
47
47
|
|
|
48
48
|
export const encodeAsync: <T extends core.$ZodType>(
|
|
49
49
|
schema: T,
|
|
50
50
|
value: core.output<T>,
|
|
51
51
|
_ctx?: core.ParseContext<core.$ZodIssue>
|
|
52
|
-
) => Promise<core.input<T>> = /* @__PURE__ */ core._encodeAsync(ZodRealError)
|
|
52
|
+
) => Promise<core.input<T>> = /* @__PURE__ */ core._encodeAsync(ZodRealError);
|
|
53
53
|
|
|
54
54
|
export const decodeAsync: <T extends core.$ZodType>(
|
|
55
55
|
schema: T,
|
|
56
56
|
value: core.input<T>,
|
|
57
57
|
_ctx?: core.ParseContext<core.$ZodIssue>
|
|
58
|
-
) => Promise<core.output<T>> = /* @__PURE__ */ core._decodeAsync(ZodRealError)
|
|
58
|
+
) => Promise<core.output<T>> = /* @__PURE__ */ core._decodeAsync(ZodRealError);
|
|
59
59
|
|
|
60
60
|
export const safeEncode: <T extends core.$ZodType>(
|
|
61
61
|
schema: T,
|