ima2-gen 3.19.0 → 3.20.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/docs/migration/runtime-test-inventory.md +2 -1
- package/lib/oauthLauncher.js +10 -5
- package/node_modules/zod/README.md +2 -2
- package/node_modules/zod/compile.cjs +19 -0
- package/node_modules/zod/index.cjs +19 -0
- package/node_modules/zod/locales/index.cjs +19 -0
- package/node_modules/zod/mini/index.cjs +19 -0
- package/node_modules/zod/package.json +8 -7
- package/node_modules/zod/src/v3/helpers/errorUtil.ts +1 -1
- package/node_modules/zod/src/v4/classic/external.ts +2 -0
- package/node_modules/zod/src/v4/classic/from-json-schema.ts +248 -25
- package/node_modules/zod/src/v4/classic/schemas.ts +243 -168
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +60 -9
- package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +6 -0
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +2 -2
- package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +265 -0
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +112 -6
- package/node_modules/zod/src/v4/classic/tests/enum.test.ts +9 -0
- package/node_modules/zod/src/v4/classic/tests/error.test.ts +130 -1
- package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +157 -0
- package/node_modules/zod/src/v4/classic/tests/iban.test.ts +81 -0
- package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +40 -2
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +27 -7
- package/node_modules/zod/src/v4/classic/tests/issue-schema.test.ts +88 -56
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +39 -0
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +56 -0
- package/node_modules/zod/src/v4/classic/tests/optin-ladder.test.ts +3 -2
- package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +70 -0
- package/node_modules/zod/src/v4/classic/tests/properties.test.ts +141 -0
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +46 -1
- package/node_modules/zod/src/v4/classic/tests/standard-schema.test.ts +19 -0
- package/node_modules/zod/src/v4/classic/tests/string.test.ts +95 -1
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +33 -1
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +234 -38
- package/node_modules/zod/src/v4/classic/tests/validate.test.ts +569 -0
- package/node_modules/zod/src/v4/core/api.ts +44 -28
- package/node_modules/zod/src/v4/core/checks.ts +62 -102
- package/node_modules/zod/src/v4/core/compile.ts +218 -93
- package/node_modules/zod/src/v4/core/core.ts +1 -3
- package/node_modules/zod/src/v4/core/doc.ts +6 -2
- package/node_modules/zod/src/v4/core/errors.ts +3 -6
- package/node_modules/zod/src/v4/core/json-schema-generator.ts +2 -2
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +185 -81
- package/node_modules/zod/src/v4/core/memoizer.ts +75 -28
- package/node_modules/zod/src/v4/core/parse.ts +37 -16
- package/node_modules/zod/src/v4/core/regexes.ts +14 -4
- package/node_modules/zod/src/v4/core/schemas.ts +296 -132
- package/node_modules/zod/src/v4/core/tests/cached.test.ts +54 -0
- package/node_modules/zod/src/v4/core/tests/compile-differential.test.ts +35 -0
- package/node_modules/zod/src/v4/core/tests/compile-generative.test.ts +445 -0
- package/node_modules/zod/src/v4/core/tests/compile.test.ts +399 -2
- package/node_modules/zod/src/v4/core/tests/email-regex.test.ts +140 -0
- package/node_modules/zod/src/v4/core/tests/locales/tg.test.ts +85 -0
- package/node_modules/zod/src/v4/core/tests/polyfill-collision.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +118 -16
- package/node_modules/zod/src/v4/core/to-json-schema.ts +9 -7
- package/node_modules/zod/src/v4/core/util.ts +218 -147
- package/node_modules/zod/src/v4/core/versions.ts +2 -2
- package/node_modules/zod/src/v4/locales/ar.ts +2 -0
- package/node_modules/zod/src/v4/locales/az.ts +2 -0
- package/node_modules/zod/src/v4/locales/be.ts +2 -0
- package/node_modules/zod/src/v4/locales/bg.ts +2 -0
- package/node_modules/zod/src/v4/locales/bn.ts +2 -0
- package/node_modules/zod/src/v4/locales/ca.ts +2 -0
- package/node_modules/zod/src/v4/locales/ckb.ts +2 -0
- package/node_modules/zod/src/v4/locales/cs.ts +2 -0
- package/node_modules/zod/src/v4/locales/da.ts +2 -0
- package/node_modules/zod/src/v4/locales/de.ts +2 -0
- package/node_modules/zod/src/v4/locales/el.ts +2 -0
- package/node_modules/zod/src/v4/locales/en.ts +2 -0
- package/node_modules/zod/src/v4/locales/eo.ts +2 -0
- package/node_modules/zod/src/v4/locales/es.ts +2 -0
- package/node_modules/zod/src/v4/locales/fa.ts +2 -0
- package/node_modules/zod/src/v4/locales/fi.ts +2 -0
- package/node_modules/zod/src/v4/locales/fr-CA.ts +2 -0
- package/node_modules/zod/src/v4/locales/fr.ts +2 -0
- package/node_modules/zod/src/v4/locales/gu.ts +2 -0
- package/node_modules/zod/src/v4/locales/he.ts +2 -0
- package/node_modules/zod/src/v4/locales/hi.ts +2 -0
- package/node_modules/zod/src/v4/locales/hr.ts +2 -0
- package/node_modules/zod/src/v4/locales/hu.ts +2 -0
- package/node_modules/zod/src/v4/locales/hy.ts +2 -0
- package/node_modules/zod/src/v4/locales/id.ts +2 -0
- package/node_modules/zod/src/v4/locales/index.ts +1 -0
- package/node_modules/zod/src/v4/locales/is.ts +2 -0
- package/node_modules/zod/src/v4/locales/it.ts +2 -0
- package/node_modules/zod/src/v4/locales/ja.ts +2 -0
- package/node_modules/zod/src/v4/locales/ka.ts +2 -0
- package/node_modules/zod/src/v4/locales/km.ts +2 -0
- package/node_modules/zod/src/v4/locales/kn.ts +2 -0
- package/node_modules/zod/src/v4/locales/ko.ts +2 -0
- package/node_modules/zod/src/v4/locales/lt.ts +2 -0
- package/node_modules/zod/src/v4/locales/mk.ts +2 -0
- package/node_modules/zod/src/v4/locales/ms.ts +2 -0
- package/node_modules/zod/src/v4/locales/ne.ts +2 -0
- package/node_modules/zod/src/v4/locales/nl.ts +2 -0
- package/node_modules/zod/src/v4/locales/nn.ts +2 -0
- package/node_modules/zod/src/v4/locales/no.ts +2 -0
- package/node_modules/zod/src/v4/locales/ota.ts +2 -0
- package/node_modules/zod/src/v4/locales/pl.ts +2 -0
- package/node_modules/zod/src/v4/locales/ps.ts +2 -0
- package/node_modules/zod/src/v4/locales/pt-BR.ts +2 -0
- package/node_modules/zod/src/v4/locales/pt.ts +2 -0
- package/node_modules/zod/src/v4/locales/ro.ts +2 -0
- package/node_modules/zod/src/v4/locales/ru.ts +2 -0
- package/node_modules/zod/src/v4/locales/sk.ts +2 -0
- package/node_modules/zod/src/v4/locales/sl.ts +2 -0
- package/node_modules/zod/src/v4/locales/sv.ts +2 -0
- package/node_modules/zod/src/v4/locales/ta.ts +2 -0
- package/node_modules/zod/src/v4/locales/tg.ts +135 -0
- package/node_modules/zod/src/v4/locales/th.ts +2 -0
- package/node_modules/zod/src/v4/locales/tk.ts +2 -0
- package/node_modules/zod/src/v4/locales/tr.ts +2 -0
- package/node_modules/zod/src/v4/locales/uk.ts +2 -0
- package/node_modules/zod/src/v4/locales/ur.ts +2 -0
- package/node_modules/zod/src/v4/locales/uz.ts +2 -0
- package/node_modules/zod/src/v4/locales/vi.ts +2 -0
- package/node_modules/zod/src/v4/locales/yo.ts +2 -0
- package/node_modules/zod/src/v4/locales/zh-CN.ts +2 -0
- package/node_modules/zod/src/v4/locales/zh-TW.ts +2 -0
- package/node_modules/zod/src/v4/mini/external.ts +2 -0
- package/node_modules/zod/src/v4/mini/schemas.ts +32 -7
- package/node_modules/zod/src/v4/mini/tests/checks.test.ts +1 -1
- package/node_modules/zod/src/v4/mini/tests/computed.test.ts +11 -17
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +86 -0
- package/node_modules/zod/src/v4/mini/tests/recursive-types.test.ts +16 -0
- package/node_modules/zod/src/v4/mini/tests/string.test.ts +23 -0
- package/node_modules/zod/v3/ZodError.cjs +19 -0
- package/node_modules/zod/v3/errors.cjs +19 -0
- package/node_modules/zod/v3/external.cjs +19 -0
- package/node_modules/zod/v3/helpers/enumUtil.cjs +19 -0
- package/node_modules/zod/v3/helpers/errorUtil.cjs +20 -1
- package/node_modules/zod/v3/helpers/errorUtil.js +1 -1
- package/node_modules/zod/v3/helpers/parseUtil.cjs +19 -0
- package/node_modules/zod/v3/helpers/partialUtil.cjs +19 -0
- package/node_modules/zod/v3/helpers/typeAliases.cjs +19 -0
- package/node_modules/zod/v3/helpers/util.cjs +19 -0
- package/node_modules/zod/v3/index.cjs +19 -0
- package/node_modules/zod/v3/standard-schema.cjs +19 -0
- package/node_modules/zod/v3/types.cjs +19 -0
- package/node_modules/zod/v4/classic/checks.cjs +19 -0
- package/node_modules/zod/v4/classic/coerce.cjs +19 -0
- package/node_modules/zod/v4/classic/compat.cjs +19 -0
- package/node_modules/zod/v4/classic/deep-partial.cjs +19 -0
- package/node_modules/zod/v4/classic/errors.cjs +19 -0
- package/node_modules/zod/v4/classic/external.cjs +22 -1
- package/node_modules/zod/v4/classic/external.d.cts +1 -1
- package/node_modules/zod/v4/classic/external.d.ts +1 -1
- package/node_modules/zod/v4/classic/external.js +1 -1
- package/node_modules/zod/v4/classic/from-json-schema.cjs +264 -24
- package/node_modules/zod/v4/classic/from-json-schema.js +245 -24
- package/node_modules/zod/v4/classic/in-out.cjs +19 -0
- package/node_modules/zod/v4/classic/index.cjs +19 -0
- package/node_modules/zod/v4/classic/iso.cjs +19 -0
- package/node_modules/zod/v4/classic/parse.cjs +19 -0
- package/node_modules/zod/v4/classic/schemas.cjs +100 -35
- package/node_modules/zod/v4/classic/schemas.d.cts +15 -1
- package/node_modules/zod/v4/classic/schemas.d.ts +15 -1
- package/node_modules/zod/v4/classic/schemas.js +77 -33
- package/node_modules/zod/v4/core/api.cjs +45 -22
- package/node_modules/zod/v4/core/api.d.cts +12 -6
- package/node_modules/zod/v4/core/api.d.ts +12 -6
- package/node_modules/zod/v4/core/api.js +25 -22
- package/node_modules/zod/v4/core/checks.cjs +51 -97
- package/node_modules/zod/v4/core/checks.d.cts +17 -1
- package/node_modules/zod/v4/core/checks.d.ts +17 -1
- package/node_modules/zod/v4/core/checks.js +31 -96
- package/node_modules/zod/v4/core/compile.cjs +173 -78
- package/node_modules/zod/v4/core/compile.d.cts +18 -4
- package/node_modules/zod/v4/core/compile.d.ts +18 -4
- package/node_modules/zod/v4/core/compile.js +154 -79
- package/node_modules/zod/v4/core/core.cjs +20 -1
- package/node_modules/zod/v4/core/core.js +1 -1
- package/node_modules/zod/v4/core/doc.cjs +26 -2
- package/node_modules/zod/v4/core/doc.js +7 -2
- package/node_modules/zod/v4/core/errors.cjs +21 -5
- package/node_modules/zod/v4/core/errors.js +2 -5
- package/node_modules/zod/v4/core/index.cjs +19 -0
- package/node_modules/zod/v4/core/json-schema-generator.cjs +20 -1
- package/node_modules/zod/v4/core/json-schema-generator.js +2 -2
- package/node_modules/zod/v4/core/json-schema-processors.cjs +188 -72
- package/node_modules/zod/v4/core/json-schema-processors.d.cts +16 -0
- package/node_modules/zod/v4/core/json-schema-processors.d.ts +16 -0
- package/node_modules/zod/v4/core/json-schema-processors.js +170 -74
- package/node_modules/zod/v4/core/json-schema.cjs +19 -0
- package/node_modules/zod/v4/core/memoizer.cjs +111 -23
- package/node_modules/zod/v4/core/memoizer.js +69 -23
- package/node_modules/zod/v4/core/parse.cjs +56 -16
- package/node_modules/zod/v4/core/parse.js +37 -16
- package/node_modules/zod/v4/core/regexes.cjs +31 -6
- package/node_modules/zod/v4/core/regexes.d.cts +3 -0
- package/node_modules/zod/v4/core/regexes.d.ts +3 -0
- package/node_modules/zod/v4/core/regexes.js +10 -4
- package/node_modules/zod/v4/core/registries.cjs +19 -0
- package/node_modules/zod/v4/core/schemas.cjs +302 -114
- package/node_modules/zod/v4/core/schemas.d.cts +28 -8
- package/node_modules/zod/v4/core/schemas.d.ts +28 -8
- package/node_modules/zod/v4/core/schemas.js +279 -113
- package/node_modules/zod/v4/core/standard-schema.cjs +19 -0
- package/node_modules/zod/v4/core/to-json-schema.cjs +28 -7
- package/node_modules/zod/v4/core/to-json-schema.d.cts +4 -3
- package/node_modules/zod/v4/core/to-json-schema.d.ts +4 -3
- package/node_modules/zod/v4/core/to-json-schema.js +7 -6
- package/node_modules/zod/v4/core/util.cjs +177 -143
- package/node_modules/zod/v4/core/util.d.cts +25 -4
- package/node_modules/zod/v4/core/util.d.ts +25 -4
- package/node_modules/zod/v4/core/util.js +156 -143
- package/node_modules/zod/v4/core/versions.cjs +21 -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/core/visit.cjs +19 -0
- package/node_modules/zod/v4/index.cjs +19 -0
- package/node_modules/zod/v4/locales/ar.cjs +2 -0
- package/node_modules/zod/v4/locales/ar.js +2 -0
- package/node_modules/zod/v4/locales/az.cjs +2 -0
- package/node_modules/zod/v4/locales/az.js +2 -0
- package/node_modules/zod/v4/locales/be.cjs +2 -0
- package/node_modules/zod/v4/locales/be.js +2 -0
- package/node_modules/zod/v4/locales/bg.cjs +2 -0
- package/node_modules/zod/v4/locales/bg.js +2 -0
- package/node_modules/zod/v4/locales/bn.cjs +2 -0
- package/node_modules/zod/v4/locales/bn.js +2 -0
- package/node_modules/zod/v4/locales/ca.cjs +2 -0
- package/node_modules/zod/v4/locales/ca.js +2 -0
- package/node_modules/zod/v4/locales/ckb.cjs +2 -0
- package/node_modules/zod/v4/locales/ckb.js +2 -0
- package/node_modules/zod/v4/locales/cs.cjs +2 -0
- package/node_modules/zod/v4/locales/cs.js +2 -0
- package/node_modules/zod/v4/locales/da.cjs +2 -0
- package/node_modules/zod/v4/locales/da.js +2 -0
- package/node_modules/zod/v4/locales/de.cjs +2 -0
- package/node_modules/zod/v4/locales/de.js +2 -0
- package/node_modules/zod/v4/locales/el.cjs +2 -0
- package/node_modules/zod/v4/locales/el.js +2 -0
- package/node_modules/zod/v4/locales/en.cjs +2 -0
- package/node_modules/zod/v4/locales/en.js +2 -0
- package/node_modules/zod/v4/locales/eo.cjs +2 -0
- package/node_modules/zod/v4/locales/eo.js +2 -0
- package/node_modules/zod/v4/locales/es.cjs +2 -0
- package/node_modules/zod/v4/locales/es.js +2 -0
- package/node_modules/zod/v4/locales/fa.cjs +2 -0
- package/node_modules/zod/v4/locales/fa.js +2 -0
- package/node_modules/zod/v4/locales/fi.cjs +2 -0
- package/node_modules/zod/v4/locales/fi.js +2 -0
- package/node_modules/zod/v4/locales/fr-CA.cjs +2 -0
- package/node_modules/zod/v4/locales/fr-CA.js +2 -0
- package/node_modules/zod/v4/locales/fr.cjs +2 -0
- package/node_modules/zod/v4/locales/fr.js +2 -0
- package/node_modules/zod/v4/locales/gu.cjs +2 -0
- package/node_modules/zod/v4/locales/gu.js +2 -0
- package/node_modules/zod/v4/locales/he.cjs +2 -0
- package/node_modules/zod/v4/locales/he.js +2 -0
- package/node_modules/zod/v4/locales/hi.cjs +2 -0
- package/node_modules/zod/v4/locales/hi.js +2 -0
- package/node_modules/zod/v4/locales/hr.cjs +2 -0
- package/node_modules/zod/v4/locales/hr.js +2 -0
- package/node_modules/zod/v4/locales/hu.cjs +2 -0
- package/node_modules/zod/v4/locales/hu.js +2 -0
- package/node_modules/zod/v4/locales/hy.cjs +2 -0
- package/node_modules/zod/v4/locales/hy.js +2 -0
- package/node_modules/zod/v4/locales/id.cjs +2 -0
- package/node_modules/zod/v4/locales/id.js +2 -0
- package/node_modules/zod/v4/locales/index.cjs +22 -1
- package/node_modules/zod/v4/locales/index.d.cts +1 -0
- package/node_modules/zod/v4/locales/index.d.ts +1 -0
- package/node_modules/zod/v4/locales/index.js +1 -0
- package/node_modules/zod/v4/locales/is.cjs +2 -0
- package/node_modules/zod/v4/locales/is.js +2 -0
- package/node_modules/zod/v4/locales/it.cjs +2 -0
- package/node_modules/zod/v4/locales/it.js +2 -0
- package/node_modules/zod/v4/locales/ja.cjs +2 -0
- package/node_modules/zod/v4/locales/ja.js +2 -0
- package/node_modules/zod/v4/locales/ka.cjs +2 -0
- package/node_modules/zod/v4/locales/ka.js +2 -0
- package/node_modules/zod/v4/locales/km.cjs +2 -0
- package/node_modules/zod/v4/locales/km.js +2 -0
- package/node_modules/zod/v4/locales/kn.cjs +2 -0
- package/node_modules/zod/v4/locales/kn.js +2 -0
- package/node_modules/zod/v4/locales/ko.cjs +2 -0
- package/node_modules/zod/v4/locales/ko.js +2 -0
- package/node_modules/zod/v4/locales/lt.cjs +2 -0
- package/node_modules/zod/v4/locales/lt.js +2 -0
- package/node_modules/zod/v4/locales/mk.cjs +2 -0
- package/node_modules/zod/v4/locales/mk.js +2 -0
- package/node_modules/zod/v4/locales/ms.cjs +2 -0
- package/node_modules/zod/v4/locales/ms.js +2 -0
- package/node_modules/zod/v4/locales/ne.cjs +2 -0
- package/node_modules/zod/v4/locales/ne.js +2 -0
- package/node_modules/zod/v4/locales/nl.cjs +2 -0
- package/node_modules/zod/v4/locales/nl.js +2 -0
- package/node_modules/zod/v4/locales/nn.cjs +2 -0
- package/node_modules/zod/v4/locales/nn.js +2 -0
- package/node_modules/zod/v4/locales/no.cjs +2 -0
- package/node_modules/zod/v4/locales/no.js +2 -0
- package/node_modules/zod/v4/locales/ota.cjs +2 -0
- package/node_modules/zod/v4/locales/ota.js +2 -0
- package/node_modules/zod/v4/locales/pl.cjs +2 -0
- package/node_modules/zod/v4/locales/pl.js +2 -0
- package/node_modules/zod/v4/locales/ps.cjs +2 -0
- package/node_modules/zod/v4/locales/ps.js +2 -0
- package/node_modules/zod/v4/locales/pt-BR.cjs +2 -0
- package/node_modules/zod/v4/locales/pt-BR.js +2 -0
- package/node_modules/zod/v4/locales/pt.cjs +2 -0
- package/node_modules/zod/v4/locales/pt.js +2 -0
- package/node_modules/zod/v4/locales/ro.cjs +2 -0
- package/node_modules/zod/v4/locales/ro.js +2 -0
- package/node_modules/zod/v4/locales/ru.cjs +2 -0
- package/node_modules/zod/v4/locales/ru.js +2 -0
- package/node_modules/zod/v4/locales/sk.cjs +2 -0
- package/node_modules/zod/v4/locales/sk.js +2 -0
- package/node_modules/zod/v4/locales/sl.cjs +2 -0
- package/node_modules/zod/v4/locales/sl.js +2 -0
- package/node_modules/zod/v4/locales/sv.cjs +2 -0
- package/node_modules/zod/v4/locales/sv.js +2 -0
- package/node_modules/zod/v4/locales/ta.cjs +2 -0
- package/node_modules/zod/v4/locales/ta.js +2 -0
- package/node_modules/zod/v4/locales/tg.cjs +144 -0
- package/node_modules/zod/v4/locales/tg.d.cts +5 -0
- package/node_modules/zod/v4/locales/tg.d.ts +4 -0
- package/node_modules/zod/v4/locales/tg.js +117 -0
- package/node_modules/zod/v4/locales/th.cjs +2 -0
- package/node_modules/zod/v4/locales/th.js +2 -0
- package/node_modules/zod/v4/locales/tk.cjs +2 -0
- package/node_modules/zod/v4/locales/tk.js +2 -0
- package/node_modules/zod/v4/locales/tr.cjs +2 -0
- package/node_modules/zod/v4/locales/tr.js +2 -0
- package/node_modules/zod/v4/locales/uk.cjs +2 -0
- package/node_modules/zod/v4/locales/uk.js +2 -0
- package/node_modules/zod/v4/locales/ur.cjs +2 -0
- package/node_modules/zod/v4/locales/ur.js +2 -0
- package/node_modules/zod/v4/locales/uz.cjs +2 -0
- package/node_modules/zod/v4/locales/uz.js +2 -0
- package/node_modules/zod/v4/locales/vi.cjs +2 -0
- package/node_modules/zod/v4/locales/vi.js +2 -0
- package/node_modules/zod/v4/locales/yo.cjs +2 -0
- package/node_modules/zod/v4/locales/yo.js +2 -0
- package/node_modules/zod/v4/locales/zh-CN.cjs +2 -0
- package/node_modules/zod/v4/locales/zh-CN.js +2 -0
- package/node_modules/zod/v4/locales/zh-TW.cjs +2 -0
- package/node_modules/zod/v4/locales/zh-TW.js +2 -0
- package/node_modules/zod/v4/mini/checks.cjs +19 -0
- package/node_modules/zod/v4/mini/coerce.cjs +19 -0
- package/node_modules/zod/v4/mini/deep-partial.cjs +19 -0
- package/node_modules/zod/v4/mini/external.cjs +22 -1
- package/node_modules/zod/v4/mini/external.d.cts +1 -1
- package/node_modules/zod/v4/mini/external.d.ts +1 -1
- package/node_modules/zod/v4/mini/external.js +1 -1
- package/node_modules/zod/v4/mini/in-out.cjs +19 -0
- package/node_modules/zod/v4/mini/index.cjs +19 -0
- package/node_modules/zod/v4/mini/iso.cjs +19 -0
- package/node_modules/zod/v4/mini/parse.cjs +19 -0
- package/node_modules/zod/v4/mini/schemas.cjs +44 -8
- package/node_modules/zod/v4/mini/schemas.d.cts +6 -1
- package/node_modules/zod/v4/mini/schemas.d.ts +6 -1
- package/node_modules/zod/v4/mini/schemas.js +21 -6
- package/node_modules/zod/v4-mini/index.cjs +19 -0
- package/package.json +6 -6
- package/routes/health.js +10 -1
- package/ui/dist/.vite/manifest.json +64 -64
- package/ui/dist/assets/{AgentWorkspace-C6ke6Eo4.js → AgentWorkspace-CENfXAob.js} +1 -1
- package/ui/dist/assets/{App-pMN1OjNW.js → App-B9y6oVuL.js} +8 -8
- package/ui/dist/assets/{AssetGenWorkspace-DzEfpUy_.js → AssetGenWorkspace-fL2MjYj9.js} +2 -2
- package/ui/dist/assets/{AssetMediaLightbox-Bx0azN0S.js → AssetMediaLightbox-Be4arnGs.js} +1 -1
- package/ui/dist/assets/{AssetsWorkspace-CHw1u9VC.js → AssetsWorkspace-7z4wyfp0.js} +1 -1
- package/ui/dist/assets/{CardNewsWorkspace-DsjqhaYO.js → CardNewsWorkspace-DSldDpsl.js} +1 -1
- package/ui/dist/assets/{GenerationRequestLogPanel-EYEiHIr9.js → GenerationRequestLogPanel-CcQKi89f.js} +1 -1
- package/ui/dist/assets/{HomeWorkspace-DbnY1YF2.js → HomeWorkspace-BZDk2X1U.js} +1 -1
- package/ui/dist/assets/{KeyingPanel-8J_RMrxg.js → KeyingPanel-snhXKnA3.js} +1 -1
- package/ui/dist/assets/{NodeCanvas-DmjbNcTa.js → NodeCanvas-CJQXsS0r.js} +1 -1
- package/ui/dist/assets/{PromptBuilderPanel-CL34Jpso.js → PromptBuilderPanel-B-YP1ph5.js} +1 -1
- package/ui/dist/assets/{PromptImportDialog-B24cvEkK.js → PromptImportDialog-ssPMxE4j.js} +2 -2
- package/ui/dist/assets/{PromptImportDiscoverySection-Bbw1_J_3.js → PromptImportDiscoverySection-CvOgGTOs.js} +1 -1
- package/ui/dist/assets/{PromptImportFolderSection-CMpxuE8e.js → PromptImportFolderSection-CxR9qxbi.js} +1 -1
- package/ui/dist/assets/{PromptLibraryPanel-Ct98TJ61.js → PromptLibraryPanel-DjYgbXes.js} +2 -2
- package/ui/dist/assets/{SettingsWorkspace-DL9Tm90P.js → SettingsWorkspace-BtruYb6g.js} +1 -1
- package/ui/dist/assets/{SpriteRecipeWorkspace-BJUH1ddP.js → SpriteRecipeWorkspace-DBrYOYOK.js} +1 -1
- package/ui/dist/assets/{index-D_LpLGWV.js → index-CWFgCqE1.js} +3 -3
- package/ui/dist/assets/{index-CHeVGnoy.js → index-va83o9G5.js} +12 -12
- package/ui/dist/assets/{pptxgen.es-s4xfPXLT.js → pptxgen.es-D-kntoLD.js} +1 -1
- package/ui/dist/assets/{promptBuilderStore-DQR29LwN.js → promptBuilderStore-BdGPLEra.js} +1 -1
- package/ui/dist/assets/useAgentDialogFocus-BDdVl-nq.js +1 -0
- package/ui/dist/index.html +1 -1
- package/ui/dist/assets/useAgentDialogFocus-DAeS9IWG.js +0 -1
|
@@ -23,9 +23,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.$
|
|
27
|
-
exports.$ZodCustom = exports.$ZodLazy = exports.$ZodPromise = exports.$ZodFunction = exports.$ZodTemplateLiteral = exports.$ZodReadonly = exports.$ZodPreprocess = exports.$ZodCodec = exports.$ZodPipe = exports.$ZodNaN = exports.$ZodCatch = exports.$ZodSuccess = exports.$ZodNonOptional = exports.$ZodPrefault = exports.$ZodDefault = exports.$ZodNullable = exports.$ZodExactOptional = exports.$ZodOptional = exports.$ZodTransform = exports.$ZodFile = exports.$ZodLiteral = exports.$ZodEnum = exports.$ZodSet = exports.$ZodMap = exports.$ZodRecord = exports.$ZodTuple = exports.$ZodIntersection = exports.$ZodDiscriminatedUnion = void 0;
|
|
26
|
+
exports.$ZodObject = exports.$ZodArray = exports.$ZodDate = exports.$ZodVoid = exports.$ZodNever = exports.$ZodUnknown = exports.$ZodAny = exports.$ZodNull = exports.$ZodUndefined = exports.$ZodSymbol = exports.$ZodBigIntFormat = exports.$ZodBigInt = exports.$ZodBoolean = exports.$ZodNumberFormat = exports.$ZodNumber = exports.$ZodCustomStringFormat = exports.$ZodJWT = exports.$ZodIBAN = exports.$ZodCreditCard = exports.$ZodE164 = exports.$ZodBase64URL = exports.base64urlCharset = exports.$ZodBase64 = exports.base64Charset = exports.$ZodCIDRv6 = exports.$ZodCIDRv4 = exports.$ZodMAC = exports.$ZodIPv6 = exports.$ZodIPv4 = exports.$ZodISODuration = exports.$ZodISOTime = exports.$ZodISODate = exports.$ZodISODateTime = exports.$ZodKSUID = exports.$ZodXID = exports.$ZodULID = exports.$ZodCUID2 = exports.$ZodCUID = exports.$ZodNanoID = exports.$ZodEmoji = exports.$ZodURL = exports.URL_UNPARSEABLE = exports.URL_BAD_FORMAT = exports.$ZodEmail = exports.$ZodUUID = exports.$ZodGUID = exports.$ZodStringFormat = exports.$ZodString = exports.clone = exports.$ZodType = void 0;
|
|
27
|
+
exports.$ZodCustom = exports.$ZodLazy = exports.$ZodPromise = exports.$ZodFunction = exports.$ZodTemplateLiteral = exports.$ZodReadonly = exports.$ZodPreprocess = exports.$ZodCodec = exports.$ZodPipe = exports.$ZodNaN = exports.$ZodCatch = exports.$ZodSuccess = exports.$ZodNonOptional = exports.$ZodPrefault = exports.$ZodDefault = exports.$ZodNullable = exports.$ZodExactOptional = exports.$ZodOptional = exports.$ZodTransform = exports.$ZodFile = exports.$ZodLiteral = exports.$ZodEnum = exports.$ZodSet = exports.$ZodMap = exports.$ZodRecord = exports.$ZodTuple = exports.$ZodIntersection = exports.$ZodDiscriminatedUnion = exports.$ZodXor = exports.$ZodUnion = exports.$ZodObjectJIT = void 0;
|
|
28
28
|
exports.standardProps = standardProps;
|
|
29
|
+
exports.canParseURL = canParseURL;
|
|
30
|
+
exports.validateURL = validateURL;
|
|
29
31
|
exports.parseURLObject = parseURLObject;
|
|
30
32
|
exports.stripTabAndNewline = stripTabAndNewline;
|
|
31
33
|
exports.urlHostnameOk = urlHostnameOk;
|
|
@@ -35,6 +37,7 @@ exports.isValidCIDRv6 = isValidCIDRv6;
|
|
|
35
37
|
exports.isValidBase64 = isValidBase64;
|
|
36
38
|
exports.isValidBase64URL = isValidBase64URL;
|
|
37
39
|
exports.isValidCreditCard = isValidCreditCard;
|
|
40
|
+
exports.isValidIBAN = isValidIBAN;
|
|
38
41
|
exports.isValidJWT = isValidJWT;
|
|
39
42
|
exports.getDiscriminatedOption = getDiscriminatedOption;
|
|
40
43
|
exports.mergeValues = mergeValues;
|
|
@@ -168,16 +171,24 @@ exports.$ZodType = core.$constructor("$ZodType", (inst, def) => {
|
|
|
168
171
|
},
|
|
169
172
|
});
|
|
170
173
|
/** The Standard Schema surface for `inst`. Shared so wrappers can extend it without forcing it. */
|
|
171
|
-
|
|
174
|
+
// a Standard Schema result only reports issues, so a failure finalizes them straight off the raw payload: no ZodError, and no lazy result to read through
|
|
175
|
+
const toStandardResult = (r, ctx) => r.issues.length ? { issues: r.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())) } : { value: r.value };
|
|
176
|
+
async function validateAsync(inst, value) {
|
|
177
|
+
const ctx = { async: true };
|
|
178
|
+
return toStandardResult((await inst._zod.run({ value, issues: [] }, ctx)), ctx);
|
|
179
|
+
}
|
|
172
180
|
function standardProps(inst) {
|
|
173
181
|
return {
|
|
174
182
|
validate: (value) => {
|
|
183
|
+
const ctx = { async: false };
|
|
175
184
|
try {
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
return (0, parse_js_1.safeParseAsync)(inst, value).then(toStandardResult);
|
|
185
|
+
const r = inst._zod.run({ value, issues: [] }, ctx);
|
|
186
|
+
if (!(r instanceof Promise))
|
|
187
|
+
return toStandardResult(r, ctx);
|
|
180
188
|
}
|
|
189
|
+
catch (_) { }
|
|
190
|
+
// async function so a synchronously throwing check rejects instead of escaping validate
|
|
191
|
+
return validateAsync(inst, value);
|
|
181
192
|
},
|
|
182
193
|
vendor: "zod",
|
|
183
194
|
version: 1,
|
|
@@ -187,7 +198,8 @@ var util_js_1 = require("./util.cjs");
|
|
|
187
198
|
Object.defineProperty(exports, "clone", { enumerable: true, get: function () { return util_js_1.clone; } });
|
|
188
199
|
exports.$ZodString = core.$constructor("$ZodString", (inst, def) => {
|
|
189
200
|
exports.$ZodType.init(inst, def);
|
|
190
|
-
|
|
201
|
+
// a format's own pattern, else unbounded; a template literal derives the check-aware form itself
|
|
202
|
+
inst._zod.pattern = def.pattern ?? regexes.anyString;
|
|
191
203
|
inst._zod.parse = (payload, _) => {
|
|
192
204
|
if (def.coerce)
|
|
193
205
|
try {
|
|
@@ -241,15 +253,37 @@ exports.$ZodEmail = core.$constructor("$ZodEmail", (inst, def) => {
|
|
|
241
253
|
});
|
|
242
254
|
/** The `://` guard rejected the input before the URL constructor saw it. */
|
|
243
255
|
exports.URL_BAD_FORMAT = 1;
|
|
244
|
-
/** The URL
|
|
256
|
+
/** The URL parser rejected the input. */
|
|
245
257
|
exports.URL_UNPARSEABLE = 2;
|
|
246
|
-
|
|
258
|
+
function canParseURL(input) {
|
|
259
|
+
try {
|
|
260
|
+
if (typeof URL !== "undefined" && typeof URL.canParse === "function")
|
|
261
|
+
return URL.canParse(input);
|
|
262
|
+
new URL(input);
|
|
263
|
+
return true;
|
|
264
|
+
}
|
|
265
|
+
catch {
|
|
266
|
+
return false;
|
|
267
|
+
}
|
|
268
|
+
}
|
|
269
|
+
function validateURL(trimmed, def) {
|
|
270
|
+
if (!("normalize" in def) && !("hostname" in def) && !("protocol" in def)) {
|
|
271
|
+
return canParseURL(trimmed) || exports.URL_UNPARSEABLE;
|
|
272
|
+
}
|
|
273
|
+
return parseURLObject(trimmed, def);
|
|
274
|
+
}
|
|
275
|
+
/** Parses a URL while preserving the non-normalizing HTTP guard. */
|
|
247
276
|
function parseURLObject(trimmed, def) {
|
|
248
277
|
// When normalize is off, require :// for http/https URLs. This prevents strings like "http:example.com" or "https:/path" from being silently accepted
|
|
249
278
|
if (!def.normalize && def.protocol?.source === regexes.httpProtocol.source && !/^https?:\/\//i.test(trimmed)) {
|
|
250
279
|
return exports.URL_BAD_FORMAT;
|
|
251
280
|
}
|
|
252
281
|
try {
|
|
282
|
+
if (typeof URL !== "undefined") {
|
|
283
|
+
const URLStatic = URL;
|
|
284
|
+
if (typeof URLStatic.parse === "function")
|
|
285
|
+
return URLStatic.parse(trimmed) ?? exports.URL_UNPARSEABLE;
|
|
286
|
+
}
|
|
253
287
|
// @ts-ignore
|
|
254
288
|
return new URL(trimmed);
|
|
255
289
|
}
|
|
@@ -276,7 +310,7 @@ exports.$ZodURL = core.$constructor("$ZodURL", (inst, def) => {
|
|
|
276
310
|
try {
|
|
277
311
|
// Trim whitespace from input
|
|
278
312
|
const trimmed = payload.value.trim();
|
|
279
|
-
const url =
|
|
313
|
+
const url = validateURL(trimmed, def);
|
|
280
314
|
if (url === exports.URL_BAD_FORMAT) {
|
|
281
315
|
payload.issues.push({
|
|
282
316
|
code: "invalid_format",
|
|
@@ -298,6 +332,10 @@ exports.$ZodURL = core.$constructor("$ZodURL", (inst, def) => {
|
|
|
298
332
|
});
|
|
299
333
|
return;
|
|
300
334
|
}
|
|
335
|
+
if (url === true) {
|
|
336
|
+
payload.value = stripTabAndNewline(trimmed);
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
301
339
|
if (def.hostname && !urlHostnameOk(url, def.hostname)) {
|
|
302
340
|
payload.issues.push({
|
|
303
341
|
code: "invalid_format",
|
|
@@ -373,13 +411,6 @@ exports.$ZodKSUID = core.$constructor("$ZodKSUID", (inst, def) => {
|
|
|
373
411
|
exports.$ZodISODateTime = core.$constructor("$ZodISODateTime", (inst, def) => {
|
|
374
412
|
def.pattern ?? (def.pattern = regexes.datetime(def));
|
|
375
413
|
exports.$ZodStringFormat.init(inst, def);
|
|
376
|
-
// these two drop the offset or seconds `date-time` requires — on the bag not the def, since `z.string().check(...)` lands the format on a different schema
|
|
377
|
-
if (def.local || def.precision === -1) {
|
|
378
|
-
inst._zod.bag.laxFormat = true;
|
|
379
|
-
inst._zod.onattach.push((s) => {
|
|
380
|
-
s._zod.bag.laxFormat = true;
|
|
381
|
-
});
|
|
382
|
-
}
|
|
383
414
|
});
|
|
384
415
|
exports.$ZodISODate = core.$constructor("$ZodISODate", (inst, def) => {
|
|
385
416
|
def.pattern ?? (def.pattern = regexes.date);
|
|
@@ -396,26 +427,17 @@ exports.$ZodISODuration = core.$constructor("$ZodISODuration", (inst, def) => {
|
|
|
396
427
|
exports.$ZodIPv4 = core.$constructor("$ZodIPv4", (inst, def) => {
|
|
397
428
|
def.pattern ?? (def.pattern = regexes.ipv4);
|
|
398
429
|
exports.$ZodStringFormat.init(inst, def);
|
|
399
|
-
inst._zod.bag.format = `ipv4`;
|
|
400
430
|
});
|
|
401
431
|
/** An IPv6 address is written with hex digits, colons and dots, and nothing else. The guard is what makes the check below an IPv6 check: `new URL("http://[...]")` parses an authority, not an address, so `@` and `\` re-delimit it and `"::@1\\"` validates against the host `0.0.0.1`. The URL parser also deletes ASCII tab, LF and CR rather than failing, which is how `"::1\n"` validated as `::1`. */
|
|
402
432
|
const ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
|
|
403
433
|
function isValidIPv6(value) {
|
|
404
434
|
if (!ipv6Alphabet.test(value))
|
|
405
435
|
return false;
|
|
406
|
-
|
|
407
|
-
// @ts-ignore
|
|
408
|
-
new URL(`http://[${value}]`);
|
|
409
|
-
return true;
|
|
410
|
-
}
|
|
411
|
-
catch {
|
|
412
|
-
return false;
|
|
413
|
-
}
|
|
436
|
+
return canParseURL(`http://[${value}]`);
|
|
414
437
|
}
|
|
415
438
|
exports.$ZodIPv6 = core.$constructor("$ZodIPv6", (inst, def) => {
|
|
416
439
|
def.pattern ?? (def.pattern = regexes.ipv6);
|
|
417
440
|
exports.$ZodStringFormat.init(inst, def);
|
|
418
|
-
inst._zod.bag.format = `ipv6`;
|
|
419
441
|
inst._zod.check = (payload) => {
|
|
420
442
|
if (!isValidIPv6(payload.value)) {
|
|
421
443
|
payload.issues.push({
|
|
@@ -431,7 +453,6 @@ exports.$ZodIPv6 = core.$constructor("$ZodIPv6", (inst, def) => {
|
|
|
431
453
|
exports.$ZodMAC = core.$constructor("$ZodMAC", (inst, def) => {
|
|
432
454
|
def.pattern ?? (def.pattern = regexes.mac(def.delimiter));
|
|
433
455
|
exports.$ZodStringFormat.init(inst, def);
|
|
434
|
-
inst._zod.bag.format = `mac`;
|
|
435
456
|
});
|
|
436
457
|
exports.$ZodCIDRv4 = core.$constructor("$ZodCIDRv4", (inst, def) => {
|
|
437
458
|
def.pattern ?? (def.pattern = regexes.cidrv4);
|
|
@@ -484,10 +505,11 @@ function isValidBase64(data) {
|
|
|
484
505
|
return false;
|
|
485
506
|
}
|
|
486
507
|
}
|
|
508
|
+
// lax on purpose: the quantified regexes.base64 overflows the regex stack on multi-MB input and its leading ^$| alternation leaks through template-literal composition; isValidBase64 enforces length and padding
|
|
509
|
+
exports.base64Charset = /^[0-9a-zA-Z+/]*={0,2}$/;
|
|
487
510
|
exports.$ZodBase64 = core.$constructor("$ZodBase64", (inst, def) => {
|
|
488
|
-
def.pattern ?? (def.pattern =
|
|
511
|
+
def.pattern ?? (def.pattern = exports.base64Charset);
|
|
489
512
|
exports.$ZodStringFormat.init(inst, def);
|
|
490
|
-
inst._zod.bag.contentEncoding = "base64";
|
|
491
513
|
inst._zod.check = (payload) => {
|
|
492
514
|
if (isValidBase64(payload.value))
|
|
493
515
|
return;
|
|
@@ -500,18 +522,19 @@ exports.$ZodBase64 = core.$constructor("$ZodBase64", (inst, def) => {
|
|
|
500
522
|
});
|
|
501
523
|
};
|
|
502
524
|
});
|
|
503
|
-
//////////////////////////////
|
|
525
|
+
////////////////////////////// ZodBase64URL //////////////////////////////
|
|
526
|
+
// lax on purpose: the quantified regexes.base64url overflows the regex stack on multi-MB input; isValidBase64 enforces length on the padded string
|
|
527
|
+
exports.base64urlCharset = /^[A-Za-z0-9_-]*$/;
|
|
504
528
|
function isValidBase64URL(data) {
|
|
505
|
-
if (!
|
|
529
|
+
if (!exports.base64urlCharset.test(data))
|
|
506
530
|
return false;
|
|
507
531
|
const base64 = data.replace(/[-_]/g, (c) => (c === "-" ? "+" : "/"));
|
|
508
532
|
const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, "=");
|
|
509
533
|
return isValidBase64(padded);
|
|
510
534
|
}
|
|
511
535
|
exports.$ZodBase64URL = core.$constructor("$ZodBase64URL", (inst, def) => {
|
|
512
|
-
def.pattern ?? (def.pattern =
|
|
536
|
+
def.pattern ?? (def.pattern = exports.base64urlCharset);
|
|
513
537
|
exports.$ZodStringFormat.init(inst, def);
|
|
514
|
-
inst._zod.bag.contentEncoding = "base64url";
|
|
515
538
|
inst._zod.check = (payload) => {
|
|
516
539
|
if (isValidBase64URL(payload.value))
|
|
517
540
|
return;
|
|
@@ -536,7 +559,7 @@ function isLuhnAlgo(digits) {
|
|
|
536
559
|
let bit = 1;
|
|
537
560
|
let sum = 0;
|
|
538
561
|
while (length) {
|
|
539
|
-
const value =
|
|
562
|
+
const value = digits.charCodeAt(--length) - 48;
|
|
540
563
|
bit ^= 1;
|
|
541
564
|
sum += bit ? [0, 2, 4, 6, 8, 1, 3, 5, 7, 9][value] : value;
|
|
542
565
|
}
|
|
@@ -563,6 +586,42 @@ exports.$ZodCreditCard = core.$constructor("$ZodCreditCard", (inst, def) => {
|
|
|
563
586
|
});
|
|
564
587
|
};
|
|
565
588
|
});
|
|
589
|
+
////////////////////////////// ZodIBAN //////////////////////////////
|
|
590
|
+
// iso 7064 mod 97-10 checksum without BigInt
|
|
591
|
+
function isIso7064Mod97(iban) {
|
|
592
|
+
let remainder = 0;
|
|
593
|
+
const len = iban.length;
|
|
594
|
+
for (let i = 4; i < len; i++) {
|
|
595
|
+
const code = iban.charCodeAt(i);
|
|
596
|
+
remainder = (code >= 65 ? remainder * 100 + (code - 55) : remainder * 10 + (code - 48)) % 97;
|
|
597
|
+
}
|
|
598
|
+
for (let i = 0; i < 4; i++) {
|
|
599
|
+
const code = iban.charCodeAt(i);
|
|
600
|
+
remainder = (code >= 65 ? remainder * 100 + (code - 55) : remainder * 10 + (code - 48)) % 97;
|
|
601
|
+
}
|
|
602
|
+
return remainder === 1;
|
|
603
|
+
}
|
|
604
|
+
function isValidIBAN(input) {
|
|
605
|
+
if (!regexes.iban.test(input))
|
|
606
|
+
return false;
|
|
607
|
+
return isIso7064Mod97(input);
|
|
608
|
+
}
|
|
609
|
+
exports.$ZodIBAN = core.$constructor("$ZodIBAN", (inst, def) => {
|
|
610
|
+
// shape only — checksum is not expressible as a pattern
|
|
611
|
+
def.pattern ?? (def.pattern = regexes.iban);
|
|
612
|
+
exports.$ZodStringFormat.init(inst, def);
|
|
613
|
+
inst._zod.check = (payload) => {
|
|
614
|
+
if (isValidIBAN(payload.value))
|
|
615
|
+
return;
|
|
616
|
+
payload.issues.push({
|
|
617
|
+
code: "invalid_format",
|
|
618
|
+
format: "iban",
|
|
619
|
+
input: payload.value,
|
|
620
|
+
inst,
|
|
621
|
+
continue: !def.abort,
|
|
622
|
+
});
|
|
623
|
+
};
|
|
624
|
+
});
|
|
566
625
|
////////////////////////////// ZodJWT //////////////////////////////
|
|
567
626
|
function isValidJWT(token, algorithm = null) {
|
|
568
627
|
try {
|
|
@@ -616,7 +675,7 @@ exports.$ZodCustomStringFormat = core.$constructor("$ZodCustomStringFormat", (in
|
|
|
616
675
|
});
|
|
617
676
|
exports.$ZodNumber = core.$constructor("$ZodNumber", (inst, def) => {
|
|
618
677
|
exports.$ZodType.init(inst, def);
|
|
619
|
-
inst._zod.pattern =
|
|
678
|
+
inst._zod.pattern = regexes.number;
|
|
620
679
|
inst._zod.parse = (payload, _ctx) => {
|
|
621
680
|
if (def.coerce)
|
|
622
681
|
try {
|
|
@@ -824,6 +883,7 @@ exports.$ZodArray = core.$constructor("$ZodArray", (inst, def) => {
|
|
|
824
883
|
}
|
|
825
884
|
payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
|
|
826
885
|
const proms = [];
|
|
886
|
+
const abortEarly = ctx?.abortEarly;
|
|
827
887
|
for (let i = 0; i < input.length; i++) {
|
|
828
888
|
const item = input[i];
|
|
829
889
|
const result = def.element._zod.run({
|
|
@@ -835,6 +895,9 @@ exports.$ZodArray = core.$constructor("$ZodArray", (inst, def) => {
|
|
|
835
895
|
}
|
|
836
896
|
else {
|
|
837
897
|
handleArrayResult(result, payload, i);
|
|
898
|
+
// the element's payload is authoritative here, since handleArrayResult forwards every issue; an object's is not, because it drops a failed absent optional
|
|
899
|
+
if (abortEarly && result.issues.length !== 0 && util.aborted(result))
|
|
900
|
+
break;
|
|
838
901
|
}
|
|
839
902
|
}
|
|
840
903
|
if (proms.length) {
|
|
@@ -869,7 +932,7 @@ function handlePropertyResult(result, final, key, input, optin, optout) {
|
|
|
869
932
|
return;
|
|
870
933
|
}
|
|
871
934
|
if (result.value === undefined) {
|
|
872
|
-
if (isPresent) {
|
|
935
|
+
if (isPresent || (optin === "defaulted" && !isOptionalOut)) {
|
|
873
936
|
final.value[key] = undefined;
|
|
874
937
|
}
|
|
875
938
|
}
|
|
@@ -901,14 +964,21 @@ function normalizeDef(def) {
|
|
|
901
964
|
optionalKeys: new Set(okeys),
|
|
902
965
|
};
|
|
903
966
|
}
|
|
904
|
-
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
967
|
+
function handleCatchall(proms, input, payload, ctx, def, inst, abortEarly) {
|
|
905
968
|
const unrecognized = [];
|
|
906
969
|
const keySet = def.keySet;
|
|
907
970
|
const _catchall = def.catchall._zod;
|
|
908
971
|
const t = _catchall.def.type;
|
|
909
972
|
const optin = _catchall.optin;
|
|
910
973
|
const optout = _catchall.optout;
|
|
974
|
+
// starts at 0, not the current length: the shape phase already ran and may have aborted
|
|
975
|
+
let seen = 0;
|
|
911
976
|
for (const key in input) {
|
|
977
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
978
|
+
if (util.aborted(payload, seen))
|
|
979
|
+
break;
|
|
980
|
+
seen = payload.issues.length;
|
|
981
|
+
}
|
|
912
982
|
// Must precede the __proto__ branch: a declared key is not unrecognized, even though the shape loop deliberately strips __proto__ from the parsed output.
|
|
913
983
|
if (keySet.has(key))
|
|
914
984
|
continue;
|
|
@@ -946,26 +1016,22 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
946
1016
|
return payload;
|
|
947
1017
|
});
|
|
948
1018
|
}
|
|
949
|
-
// Whichever object a def's `shape` currently answers from: the one the caller passed until the first read, the frozen copy after it. Keyed by def, so a def rebuilt by a builder is simply absent rather than inheriting the source's. Read its keys with `Object.keys`, which does not invoke them — that is what lets a discriminated union check its discriminator without resolving an option whose getters reference the union being constructed.
|
|
950
|
-
const propShapes = new WeakMap();
|
|
951
1019
|
exports.$ZodObject = core.$constructor("$ZodObject", (inst, def) => {
|
|
952
1020
|
// requires cast because technically $ZodObject doesn't extend
|
|
953
1021
|
exports.$ZodType.init(inst, def);
|
|
954
|
-
// const sh = def.shape;
|
|
955
1022
|
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
});
|
|
1023
|
+
// a cloned def carries its source's accessor, which knows the shape it answers from; adopting that keeps the clone's keys readable without running it
|
|
1024
|
+
const sh = desc?.get ? desc.get.raw : (def.shape ?? {});
|
|
1025
|
+
if (sh) {
|
|
1026
|
+
// Freezes the shape on first read, so its getters resolve once and every later read sees the same schemas.
|
|
1027
|
+
const get = () => {
|
|
1028
|
+
const newSh = { ...sh };
|
|
1029
|
+
Object.defineProperty(def, "shape", { value: newSh });
|
|
1030
|
+
get.raw = newSh;
|
|
1031
|
+
return newSh;
|
|
1032
|
+
};
|
|
1033
|
+
get.raw = sh;
|
|
1034
|
+
Object.defineProperty(def, "shape", { get });
|
|
969
1035
|
}
|
|
970
1036
|
const _normalized = util.cached(() => normalizeDef(def));
|
|
971
1037
|
util.defineLazyInternal(inst, "propValues", (zod) => {
|
|
@@ -1006,7 +1072,14 @@ exports.$ZodObject = core.$constructor("$ZodObject", (inst, def) => {
|
|
|
1006
1072
|
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
1007
1073
|
const proms = [];
|
|
1008
1074
|
const shape = value.shape;
|
|
1075
|
+
const abortEarly = ctx?.abortEarly;
|
|
1076
|
+
let seen = payload.issues.length;
|
|
1009
1077
|
for (const key of value.allKeys) {
|
|
1078
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
1079
|
+
if (util.aborted(payload, seen))
|
|
1080
|
+
break;
|
|
1081
|
+
seen = payload.issues.length;
|
|
1082
|
+
}
|
|
1010
1083
|
if (key === "__proto__")
|
|
1011
1084
|
continue;
|
|
1012
1085
|
const el = shape[key];
|
|
@@ -1023,7 +1096,7 @@ exports.$ZodObject = core.$constructor("$ZodObject", (inst, def) => {
|
|
|
1023
1096
|
if (!catchall) {
|
|
1024
1097
|
return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
1025
1098
|
}
|
|
1026
|
-
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
1099
|
+
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst, abortEarly === true);
|
|
1027
1100
|
};
|
|
1028
1101
|
});
|
|
1029
1102
|
exports.$ZodObjectJIT = core.$constructor("$ZodObjectJIT", (inst, def) => {
|
|
@@ -1038,12 +1111,18 @@ exports.$ZodObjectJIT = core.$constructor("$ZodObjectJIT", (inst, def) => {
|
|
|
1038
1111
|
// a symbol has no source literal, so it is read as `syms[i]` off the closed-over scope
|
|
1039
1112
|
const doc = new doc_js_1.Doc(["payload", "ctx"], { shape, inst, memo, syms });
|
|
1040
1113
|
const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
1041
|
-
//
|
|
1114
|
+
// prefixes in place, like util.prefixIssues. newResult must land before the early return: a catchall runs after this and would otherwise write onto the caller's input
|
|
1042
1115
|
const prefixStr = (id, k) => `
|
|
1116
|
+
let ${id}_ab = false;
|
|
1043
1117
|
for (let i = 0; i < ${id}.issues.length; i++) {
|
|
1044
1118
|
const iss = ${id}.issues[i];
|
|
1045
1119
|
iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
|
|
1046
1120
|
payload.issues.push(iss);
|
|
1121
|
+
if (iss.continue !== true) ${id}_ab = true;
|
|
1122
|
+
}
|
|
1123
|
+
if (${id}_ab && ctx && ctx.abortEarly) {
|
|
1124
|
+
payload.value = newResult;
|
|
1125
|
+
return payload;
|
|
1047
1126
|
}`;
|
|
1048
1127
|
doc.write(`const input = payload.value;`);
|
|
1049
1128
|
const ids = Object.create(null);
|
|
@@ -1092,6 +1171,10 @@ exports.$ZodObjectJIT = core.$constructor("$ZodObjectJIT", (inst, def) => {
|
|
|
1092
1171
|
input: undefined,
|
|
1093
1172
|
path: [${k}]
|
|
1094
1173
|
});
|
|
1174
|
+
if (ctx && ctx.abortEarly) {
|
|
1175
|
+
payload.value = newResult;
|
|
1176
|
+
return payload;
|
|
1177
|
+
}
|
|
1095
1178
|
}
|
|
1096
1179
|
|
|
1097
1180
|
if (${id}_present) {
|
|
@@ -1104,16 +1187,17 @@ exports.$ZodObjectJIT = core.$constructor("$ZodObjectJIT", (inst, def) => {
|
|
|
1104
1187
|
doc.write(`
|
|
1105
1188
|
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
1106
1189
|
}
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1190
|
+
`);
|
|
1191
|
+
if (optin === "defaulted") {
|
|
1192
|
+
doc.write(`newResult[${k}] = ${id}.value;`);
|
|
1193
|
+
}
|
|
1194
|
+
else {
|
|
1195
|
+
doc.write(`
|
|
1196
|
+
if (${id}.value !== undefined || ${isPresent}) {
|
|
1113
1197
|
newResult[${k}] = ${id}.value;
|
|
1114
1198
|
}
|
|
1115
|
-
|
|
1116
1199
|
`);
|
|
1200
|
+
}
|
|
1117
1201
|
}
|
|
1118
1202
|
}
|
|
1119
1203
|
doc.write(`payload.value = newResult;`);
|
|
@@ -1147,7 +1231,7 @@ exports.$ZodObjectJIT = core.$constructor("$ZodObjectJIT", (inst, def) => {
|
|
|
1147
1231
|
payload = fastpass(payload, ctx);
|
|
1148
1232
|
if (!catchall)
|
|
1149
1233
|
return payload;
|
|
1150
|
-
return handleCatchall([], input, payload, ctx, value, inst);
|
|
1234
|
+
return handleCatchall([], input, payload, ctx, value, inst, ctx?.abortEarly === true);
|
|
1151
1235
|
}
|
|
1152
1236
|
return superParse(payload, ctx);
|
|
1153
1237
|
};
|
|
@@ -1284,22 +1368,38 @@ exports.$ZodXor = core.$constructor("$ZodXor", (inst, def) => {
|
|
|
1284
1368
|
});
|
|
1285
1369
|
};
|
|
1286
1370
|
});
|
|
1287
|
-
/** Returns the option
|
|
1371
|
+
/** Returns the option whose discriminator claims `value`, or throws if ambiguous. */
|
|
1288
1372
|
function getDiscriminatedOption(union, value) {
|
|
1289
1373
|
const internals = union._zod;
|
|
1290
1374
|
let map = internals.bag.optionsMap;
|
|
1291
1375
|
if (!map) {
|
|
1292
|
-
map =
|
|
1293
|
-
const { options, discriminator } = internals.def;
|
|
1294
|
-
for (const option of options) {
|
|
1295
|
-
// First declaration wins, matching the order the parse path resolves a duplicate in.
|
|
1296
|
-
for (const v of option._zod.propValues?.[discriminator] ?? [])
|
|
1297
|
-
if (!map.has(v))
|
|
1298
|
-
map.set(v, option);
|
|
1299
|
-
}
|
|
1376
|
+
map = discriminatorMap(internals.def);
|
|
1300
1377
|
internals.bag.optionsMap = map;
|
|
1301
1378
|
}
|
|
1302
|
-
|
|
1379
|
+
const option = map.get(value);
|
|
1380
|
+
if (option === null)
|
|
1381
|
+
throw new Error(`Ambiguous discriminator value "${String(value)}"`);
|
|
1382
|
+
return option;
|
|
1383
|
+
}
|
|
1384
|
+
function discriminatorMap(def) {
|
|
1385
|
+
const map = new Map();
|
|
1386
|
+
for (const option of def.options) {
|
|
1387
|
+
const values = option._zod.propValues?.[def.discriminator];
|
|
1388
|
+
if (!values || values.size === 0)
|
|
1389
|
+
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
1390
|
+
for (const value of values) {
|
|
1391
|
+
if (map.has(value)) {
|
|
1392
|
+
if (value !== undefined)
|
|
1393
|
+
throw new Error(`Duplicate discriminator value "${String(value)}"`);
|
|
1394
|
+
// keep the collision marked so a later member cannot reclaim it
|
|
1395
|
+
map.set(value, null);
|
|
1396
|
+
}
|
|
1397
|
+
else {
|
|
1398
|
+
map.set(value, option);
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
}
|
|
1402
|
+
return map;
|
|
1303
1403
|
}
|
|
1304
1404
|
exports.$ZodDiscriminatedUnion =
|
|
1305
1405
|
/*@__PURE__*/
|
|
@@ -1309,10 +1409,13 @@ core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
|
1309
1409
|
const _super = inst._zod.parse;
|
|
1310
1410
|
util.defineLazyInternal(inst, "propValues", (zod) => {
|
|
1311
1411
|
const propValues = {};
|
|
1412
|
+
let undefinedCount = 0;
|
|
1312
1413
|
for (const option of zod.def.options) {
|
|
1313
1414
|
const pv = option._zod.propValues;
|
|
1314
1415
|
if (!pv || Object.keys(pv).length === 0)
|
|
1315
1416
|
throw new Error(`Invalid discriminated union option at index "${zod.def.options.indexOf(option)}"`);
|
|
1417
|
+
if (pv[zod.def.discriminator]?.has(undefined))
|
|
1418
|
+
undefinedCount++;
|
|
1316
1419
|
for (const [k, v] of Object.entries(pv)) {
|
|
1317
1420
|
if (!Object.prototype.hasOwnProperty.call(propValues, k)) {
|
|
1318
1421
|
util.assignProp(propValues, k, new Set());
|
|
@@ -1322,31 +1425,18 @@ core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
|
1322
1425
|
}
|
|
1323
1426
|
}
|
|
1324
1427
|
}
|
|
1428
|
+
if (!zod.def.unionFallback && undefinedCount > 1)
|
|
1429
|
+
propValues[zod.def.discriminator]?.delete(undefined);
|
|
1325
1430
|
return propValues;
|
|
1326
1431
|
});
|
|
1327
|
-
// Checked now rather than in the lookup map below, so an option that lacks the discriminator fails at the `discriminatedUnion` call instead of on the first object parsed. Options whose shape cannot be enumerated without resolving it — pipes
|
|
1432
|
+
// Checked now rather than in the lookup map below, so an option that lacks the discriminator fails at the `discriminatedUnion` call instead of on the first object parsed. Options whose shape cannot be enumerated without resolving it — pipes and lazies — are left to the map.
|
|
1328
1433
|
def.options.forEach((option, i) => {
|
|
1329
|
-
const propShape =
|
|
1434
|
+
const propShape = util.rawShape(option._zod.def);
|
|
1330
1435
|
if (propShape && !Object.prototype.hasOwnProperty.call(propShape, def.discriminator)) {
|
|
1331
1436
|
throw new Error(`Invalid discriminated union option at index "${i}"`);
|
|
1332
1437
|
}
|
|
1333
1438
|
});
|
|
1334
|
-
const disc = util.cached(() =>
|
|
1335
|
-
const opts = def.options;
|
|
1336
|
-
const map = new Map();
|
|
1337
|
-
for (const o of opts) {
|
|
1338
|
-
const values = o._zod.propValues?.[def.discriminator];
|
|
1339
|
-
if (!values || values.size === 0)
|
|
1340
|
-
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
|
|
1341
|
-
for (const v of values) {
|
|
1342
|
-
if (map.has(v)) {
|
|
1343
|
-
throw new Error(`Duplicate discriminator value "${String(v)}"`);
|
|
1344
|
-
}
|
|
1345
|
-
map.set(v, o);
|
|
1346
|
-
}
|
|
1347
|
-
}
|
|
1348
|
-
return map;
|
|
1349
|
-
});
|
|
1439
|
+
const disc = util.cached(() => discriminatorMap(def));
|
|
1350
1440
|
inst._zod.parse = (payload, ctx) => {
|
|
1351
1441
|
const input = payload.value;
|
|
1352
1442
|
if (!util.isObject(input)) {
|
|
@@ -1358,8 +1448,10 @@ core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
|
1358
1448
|
});
|
|
1359
1449
|
return payload;
|
|
1360
1450
|
}
|
|
1361
|
-
const
|
|
1362
|
-
|
|
1451
|
+
const value = input?.[def.discriminator];
|
|
1452
|
+
const opt = disc.value.get(value);
|
|
1453
|
+
// forward metadata cannot choose an encoder for an absent tag
|
|
1454
|
+
if (opt && (value !== undefined || ctx.direction !== "backward")) {
|
|
1363
1455
|
return opt._zod.run(payload, ctx);
|
|
1364
1456
|
}
|
|
1365
1457
|
// Fall back to union matching when the fast discriminator path fails:
|
|
@@ -1374,7 +1466,7 @@ core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
|
1374
1466
|
errors: [],
|
|
1375
1467
|
note: "No matching discriminator",
|
|
1376
1468
|
discriminator: def.discriminator,
|
|
1377
|
-
options: Array.from(disc.value.keys()),
|
|
1469
|
+
options: Array.from(disc.value.keys()).filter((value) => disc.value.get(value) !== null),
|
|
1378
1470
|
input,
|
|
1379
1471
|
path: [def.discriminator],
|
|
1380
1472
|
inst,
|
|
@@ -1547,6 +1639,9 @@ exports.$ZodTuple = core.$constructor("$ZodTuple", (inst, def) => {
|
|
|
1547
1639
|
}
|
|
1548
1640
|
// Run every item in parallel, collecting results into an indexed array. The post-processing in `handleTupleResults` walks them in order so it can decide whether an absent optional-output error can truncate the tail or must be reported to preserve required output.
|
|
1549
1641
|
const itemResults = new Array(items.length);
|
|
1642
|
+
// only tracked when there is a rest loop to skip
|
|
1643
|
+
const abortEarly = def.rest ? ctx?.abortEarly : undefined;
|
|
1644
|
+
let itemAborted = false;
|
|
1550
1645
|
for (let i = 0; i < items.length; i++) {
|
|
1551
1646
|
const r = items[i]._zod.run({ value: input[i], issues: [] }, ctx);
|
|
1552
1647
|
if (r instanceof Promise) {
|
|
@@ -1556,12 +1651,21 @@ exports.$ZodTuple = core.$constructor("$ZodTuple", (inst, def) => {
|
|
|
1556
1651
|
}
|
|
1557
1652
|
else {
|
|
1558
1653
|
itemResults[i] = r;
|
|
1654
|
+
if (abortEarly && !itemAborted && r.issues.length)
|
|
1655
|
+
itemAborted = util.aborted(r);
|
|
1559
1656
|
}
|
|
1560
1657
|
}
|
|
1561
|
-
|
|
1658
|
+
// sound because rest is non-empty exactly when every fixed index is present, the one case handleTupleResults cannot discard an item's issues
|
|
1659
|
+
if (def.rest && !itemAborted) {
|
|
1562
1660
|
let i = items.length - 1;
|
|
1563
1661
|
const rest = input.slice(items.length);
|
|
1662
|
+
let seen = payload.issues.length;
|
|
1564
1663
|
for (const el of rest) {
|
|
1664
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
1665
|
+
if (util.aborted(payload, seen))
|
|
1666
|
+
break;
|
|
1667
|
+
seen = payload.issues.length;
|
|
1668
|
+
}
|
|
1565
1669
|
i++;
|
|
1566
1670
|
const result = def.rest._zod.run({ value: el, issues: [] }, ctx);
|
|
1567
1671
|
if (result instanceof Promise) {
|
|
@@ -1643,6 +1747,7 @@ exports.$ZodRecord = core.$constructor("$ZodRecord", (inst, def) => {
|
|
|
1643
1747
|
});
|
|
1644
1748
|
return payload;
|
|
1645
1749
|
}
|
|
1750
|
+
// no guard in either loop below: a record's invalid_key aborts but an enclosing intersection can reconcile it, so a stopped loop hides keys the sibling does not own and the intersection then rejects nothing
|
|
1646
1751
|
const proms = [];
|
|
1647
1752
|
const values = def.keyType._zod.values;
|
|
1648
1753
|
if (values && !def.partial) {
|
|
@@ -1814,7 +1919,14 @@ exports.$ZodMap = core.$constructor("$ZodMap", (inst, def) => {
|
|
|
1814
1919
|
}
|
|
1815
1920
|
const proms = [];
|
|
1816
1921
|
payload.value = memo ? memo.alloc(inst, payload, new Map(), ctx) : new Map();
|
|
1922
|
+
const abortEarly = ctx?.abortEarly;
|
|
1923
|
+
let seen = payload.issues.length;
|
|
1817
1924
|
for (const [key, value] of input) {
|
|
1925
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
1926
|
+
if (util.aborted(payload, seen))
|
|
1927
|
+
break;
|
|
1928
|
+
seen = payload.issues.length;
|
|
1929
|
+
}
|
|
1818
1930
|
const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
1819
1931
|
const valueResult = def.valueType._zod.run({ value: value, issues: [] }, ctx);
|
|
1820
1932
|
if (keyResult instanceof Promise || valueResult instanceof Promise) {
|
|
@@ -1880,7 +1992,14 @@ exports.$ZodSet = core.$constructor("$ZodSet", (inst, def) => {
|
|
|
1880
1992
|
}
|
|
1881
1993
|
const proms = [];
|
|
1882
1994
|
payload.value = memo ? memo.alloc(inst, payload, new Set(), ctx) : new Set();
|
|
1995
|
+
const abortEarly = ctx?.abortEarly;
|
|
1996
|
+
let seen = payload.issues.length;
|
|
1883
1997
|
for (const item of input) {
|
|
1998
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
1999
|
+
if (util.aborted(payload, seen))
|
|
2000
|
+
break;
|
|
2001
|
+
seen = payload.issues.length;
|
|
2002
|
+
}
|
|
1884
2003
|
const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
|
|
1885
2004
|
if (result instanceof Promise) {
|
|
1886
2005
|
proms.push(result.then((result) => handleSetResult(result, payload)));
|
|
@@ -1904,9 +2023,11 @@ exports.$ZodEnum = core.$constructor("$ZodEnum", (inst, def) => {
|
|
|
1904
2023
|
const values = util.getEnumValues(def.entries);
|
|
1905
2024
|
const valuesSet = new Set(values);
|
|
1906
2025
|
inst._zod.values = valuesSet;
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
2026
|
+
util.defineLazyInternal(inst, "pattern", (zod) => {
|
|
2027
|
+
const patternValues = util.getEnumValues(zod.def.entries).filter((k) => util.propertyKeyTypes.has(typeof k));
|
|
2028
|
+
// unmatchable fallback, RE2-safe: an empty alternation would compile to /^()$/, which matches ""
|
|
2029
|
+
return new RegExp(patternValues.length ? `^(${patternValues.map((o) => util.escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
|
|
2030
|
+
});
|
|
1910
2031
|
inst._zod.parse = (payload, _ctx) => {
|
|
1911
2032
|
const input = payload.value;
|
|
1912
2033
|
if (valuesSet.has(input)) {
|
|
@@ -1925,12 +2046,15 @@ exports.$ZodLiteral = core.$constructor("$ZodLiteral", (inst, def) => {
|
|
|
1925
2046
|
exports.$ZodType.init(inst, def);
|
|
1926
2047
|
const values = new Set(def.values);
|
|
1927
2048
|
inst._zod.values = values;
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
2049
|
+
util.defineLazyInternal(inst, "pattern", (zod) => {
|
|
2050
|
+
const vals = zod.def.values;
|
|
2051
|
+
// unmatchable fallback, RE2-safe: an empty alternation would compile to /^()$/, which matches ""
|
|
2052
|
+
return new RegExp(vals.length
|
|
2053
|
+
? `^(${vals
|
|
2054
|
+
.map((o) => typeof o === "string" ? util.escapeRegex(o) : o ? util.escapeRegex(o.toString()) : String(o))
|
|
2055
|
+
.join("|")})$`
|
|
2056
|
+
: "^[^\\s\\S]$");
|
|
2057
|
+
});
|
|
1934
2058
|
inst._zod.parse = (payload, _ctx) => {
|
|
1935
2059
|
const input = payload.value;
|
|
1936
2060
|
if (values.has(input)) {
|
|
@@ -2294,22 +2418,67 @@ function handleReadonlyResult(payload) {
|
|
|
2294
2418
|
payload.value = Object.freeze(payload.value);
|
|
2295
2419
|
return payload;
|
|
2296
2420
|
}
|
|
2421
|
+
// a leaf's pattern source with its own checks folded in: the last pattern-carrying check wins, else length bounds narrow the catch-all, else an integer format narrows the number form. the fold lives here instead of on `_zod.pattern` so a bundle without template literals never pays for it
|
|
2422
|
+
function leafPattern(schema) {
|
|
2423
|
+
const def = schema._zod.def;
|
|
2424
|
+
let pattern = def.pattern;
|
|
2425
|
+
let isInt = !!def.format?.includes("int");
|
|
2426
|
+
let minimum;
|
|
2427
|
+
let maximum;
|
|
2428
|
+
for (const ch of def.checks ?? []) {
|
|
2429
|
+
const d = ch._zod.def;
|
|
2430
|
+
if (d.pattern)
|
|
2431
|
+
pattern = d.pattern;
|
|
2432
|
+
isInt || (isInt = !!d.format?.includes("int"));
|
|
2433
|
+
const lo = d.minimum ?? d.length;
|
|
2434
|
+
const hi = d.maximum ?? d.length;
|
|
2435
|
+
if (lo !== undefined && (minimum === undefined || lo > minimum))
|
|
2436
|
+
minimum = lo;
|
|
2437
|
+
if (hi !== undefined && (maximum === undefined || hi < maximum))
|
|
2438
|
+
maximum = hi;
|
|
2439
|
+
}
|
|
2440
|
+
if (pattern)
|
|
2441
|
+
return pattern.source;
|
|
2442
|
+
// an empty range matches nothing at runtime, and `{8,5}` is not a legal quantifier
|
|
2443
|
+
if (minimum !== undefined && maximum !== undefined && minimum > maximum)
|
|
2444
|
+
return "(?!)";
|
|
2445
|
+
if (minimum !== undefined || maximum !== undefined)
|
|
2446
|
+
return regexes.string({ minimum, maximum }).source;
|
|
2447
|
+
const own = schema._zod.pattern;
|
|
2448
|
+
return (isInt && own === regexes.number ? regexes.integer : own)?.source;
|
|
2449
|
+
}
|
|
2450
|
+
// a part's pattern source. a wrapper's pattern embeds its inner pattern's source verbatim, so the folded form is substituted in place without knowing the wrapper's own composition; a union's options are joined the way the union builds its own pattern
|
|
2451
|
+
function partPattern(schema) {
|
|
2452
|
+
const def = schema._zod.def;
|
|
2453
|
+
const own = schema._zod.pattern?.source;
|
|
2454
|
+
// lazy resolves its inner on the internals, not the def
|
|
2455
|
+
const inner = def.innerType ?? schema._zod.innerType;
|
|
2456
|
+
if (inner) {
|
|
2457
|
+
const before = inner._zod.pattern?.source;
|
|
2458
|
+
const after = partPattern(inner);
|
|
2459
|
+
if (own && before && after && after !== before) {
|
|
2460
|
+
return own.replace(util.cleanRegex(before), () => util.cleanRegex(after));
|
|
2461
|
+
}
|
|
2462
|
+
return own;
|
|
2463
|
+
}
|
|
2464
|
+
if (def.options) {
|
|
2465
|
+
const sources = def.options.map(partPattern);
|
|
2466
|
+
if (sources.every(Boolean))
|
|
2467
|
+
return `^(${sources.map((s) => util.cleanRegex(s)).join("|")})$`;
|
|
2468
|
+
}
|
|
2469
|
+
return leafPattern(schema);
|
|
2470
|
+
}
|
|
2297
2471
|
exports.$ZodTemplateLiteral = core.$constructor("$ZodTemplateLiteral", (inst, def) => {
|
|
2298
2472
|
exports.$ZodType.init(inst, def);
|
|
2299
2473
|
const regexParts = [];
|
|
2300
2474
|
for (const part of def.parts) {
|
|
2301
2475
|
if (typeof part === "object" && part !== null) {
|
|
2302
2476
|
// is Zod schema
|
|
2303
|
-
|
|
2304
|
-
|
|
2477
|
+
const source = partPattern(part);
|
|
2478
|
+
if (!source) {
|
|
2305
2479
|
throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);
|
|
2306
2480
|
}
|
|
2307
|
-
|
|
2308
|
-
if (!source)
|
|
2309
|
-
throw new Error(`Invalid template literal part: ${part._zod.traits}`);
|
|
2310
|
-
const start = source.startsWith("^") ? 1 : 0;
|
|
2311
|
-
const end = source.endsWith("$") ? source.length - 1 : source.length;
|
|
2312
|
-
regexParts.push(source.slice(start, end));
|
|
2481
|
+
regexParts.push(util.cleanRegex(source));
|
|
2313
2482
|
}
|
|
2314
2483
|
else if (part === null || util.primitiveTypes.has(typeof part)) {
|
|
2315
2484
|
regexParts.push(util.escapeRegex(`${part}`));
|
|
@@ -2479,3 +2648,22 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
2479
2648
|
payload.issues.push(util.issue(_iss));
|
|
2480
2649
|
}
|
|
2481
2650
|
}
|
|
2651
|
+
|
|
2652
|
+
// seal-cjs-exports
|
|
2653
|
+
(function () {
|
|
2654
|
+
var keys = Object.getOwnPropertyNames(exports);
|
|
2655
|
+
for (var i = 0; i < keys.length; i++) {
|
|
2656
|
+
var desc = Object.getOwnPropertyDescriptor(exports, keys[i]);
|
|
2657
|
+
if (!desc || !desc.get || !desc.configurable) continue;
|
|
2658
|
+
var value;
|
|
2659
|
+
try {
|
|
2660
|
+
value = desc.get();
|
|
2661
|
+
} catch (e) {
|
|
2662
|
+
continue;
|
|
2663
|
+
}
|
|
2664
|
+
// a circular require may not have settled this one yet, so leave it live
|
|
2665
|
+
if (value === undefined) continue;
|
|
2666
|
+
Object.defineProperty(exports, keys[i], { value: value, writable: false, enumerable: desc.enumerable, configurable: false });
|
|
2667
|
+
}
|
|
2668
|
+
Object.freeze(exports);
|
|
2669
|
+
})();
|