zedbee 0.1.0-beta.10 → 0.1.0-beta.12
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/README.md +8 -0
- package/THIRD_PARTY_NOTICES.md +2 -2
- package/dist/checks/applicability.d.ts.map +1 -1
- package/dist/checks/applicability.js +6 -16
- package/dist/checks/applicability.js.map +1 -1
- package/dist/checks/compiler-inputs.d.ts +9 -0
- package/dist/checks/compiler-inputs.d.ts.map +1 -0
- package/dist/checks/compiler-inputs.js +12 -0
- package/dist/checks/compiler-inputs.js.map +1 -0
- package/dist/checks/dispatcher.d.ts.map +1 -1
- package/dist/checks/dispatcher.js +13 -0
- package/dist/checks/dispatcher.js.map +1 -1
- package/dist/checks/engine-identity.js +2 -2
- package/dist/checks/engine-identity.js.map +1 -1
- package/dist/checks/eslint/lint-adapter.d.ts.map +1 -1
- package/dist/checks/eslint/lint-adapter.js +40 -22
- package/dist/checks/eslint/lint-adapter.js.map +1 -1
- package/dist/checks/observation-result.d.ts.map +1 -1
- package/dist/checks/observation-result.js +9 -3
- package/dist/checks/observation-result.js.map +1 -1
- package/dist/checks/policy-scheduling.d.ts.map +1 -1
- package/dist/checks/policy-scheduling.js +6 -1
- package/dist/checks/policy-scheduling.js.map +1 -1
- package/dist/checks/renamed-baselines.d.ts +5 -0
- package/dist/checks/renamed-baselines.d.ts.map +1 -0
- package/dist/checks/renamed-baselines.js +27 -0
- package/dist/checks/renamed-baselines.js.map +1 -0
- package/dist/checks/typescript/adapter.d.ts.map +1 -1
- package/dist/checks/typescript/adapter.js +45 -11
- package/dist/checks/typescript/adapter.js.map +1 -1
- package/dist/checks/typescript/compiler-host.js +117 -110
- package/dist/checks/typescript/compiler-host.js.map +1 -1
- package/dist/checks/typescript/config.d.ts +6 -0
- package/dist/checks/typescript/config.d.ts.map +1 -1
- package/dist/checks/typescript/config.js +194 -61
- package/dist/checks/typescript/config.js.map +1 -1
- package/dist/checks/typescript/projects.d.ts +17 -0
- package/dist/checks/typescript/projects.d.ts.map +1 -0
- package/dist/checks/typescript/projects.js +42 -0
- package/dist/checks/typescript/projects.js.map +1 -0
- package/dist/checks/vulnerabilities/normalize.d.ts.map +1 -1
- package/dist/checks/vulnerabilities/normalize.js +13 -9
- package/dist/checks/vulnerabilities/normalize.js.map +1 -1
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +22 -2
- package/dist/cli.js.map +1 -1
- package/dist/commands/agent.d.ts +11 -0
- package/dist/commands/agent.d.ts.map +1 -0
- package/dist/commands/agent.js +92 -0
- package/dist/commands/agent.js.map +1 -0
- package/dist/commands/fix.d.ts.map +1 -1
- package/dist/commands/fix.js +71 -12
- package/dist/commands/fix.js.map +1 -1
- package/dist/commands/init.d.ts +3 -2
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +35 -2
- package/dist/commands/init.js.map +1 -1
- package/dist/doctor/diagnostics.d.ts +1 -1
- package/dist/doctor/diagnostics.d.ts.map +1 -1
- package/dist/doctor/diagnostics.js +8 -11
- package/dist/doctor/diagnostics.js.map +1 -1
- package/dist/fixes/apply-plan.d.ts +6 -0
- package/dist/fixes/apply-plan.d.ts.map +1 -1
- package/dist/fixes/apply-plan.js +165 -60
- package/dist/fixes/apply-plan.js.map +1 -1
- package/dist/init/github-workflow.d.ts +13 -0
- package/dist/init/github-workflow.d.ts.map +1 -0
- package/dist/init/github-workflow.js +244 -0
- package/dist/init/github-workflow.js.map +1 -0
- package/dist/init/recommend.d.ts.map +1 -1
- package/dist/init/recommend.js +10 -0
- package/dist/init/recommend.js.map +1 -1
- package/dist/init/types.d.ts +8 -0
- package/dist/init/types.d.ts.map +1 -1
- package/dist/init/types.js.map +1 -1
- package/dist/init/write-config.d.ts.map +1 -1
- package/dist/init/write-config.js +1 -0
- package/dist/init/write-config.js.map +1 -1
- package/dist/inspection/workspaces.d.ts +2 -0
- package/dist/inspection/workspaces.d.ts.map +1 -1
- package/dist/inspection/workspaces.js +3 -2
- package/dist/inspection/workspaces.js.map +1 -1
- package/dist/renderers/sarif.d.ts.map +1 -1
- package/dist/renderers/sarif.js +9 -8
- package/dist/renderers/sarif.js.map +1 -1
- package/dist/ui/init-app.d.ts +3 -3
- package/dist/ui/init-app.d.ts.map +1 -1
- package/dist/ui/init-app.js +20 -5
- package/dist/ui/init-app.js.map +1 -1
- package/docs/checks.md +19 -1
- package/docs/cli-reference.md +43 -1
- package/docs/commercial-licensing.md +2 -2
- package/docs/dependency-license-obligations.md +1 -1
- package/docs/managed-fixes.md +11 -2
- package/docs/reporting.md +2 -0
- 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/array.test.ts +27 -0
- 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/map.test.ts +7 -0
- 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/set.test.ts +6 -0
- 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 +227 -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 +331 -133
- 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 +231 -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 +181 -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 +162 -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 +332 -114
- package/node_modules/zod/v4/core/schemas.d.cts +31 -9
- package/node_modules/zod/v4/core/schemas.d.ts +31 -9
- package/node_modules/zod/v4/core/schemas.js +309 -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 +192 -143
- package/node_modules/zod/v4/core/util.d.cts +27 -4
- package/node_modules/zod/v4/core/util.d.ts +27 -4
- package/node_modules/zod/v4/core/util.js +170 -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 +11 -6
- package/plugins/swarm/LICENSE +121 -0
- package/plugins/swarm/README.md +71 -0
- package/plugins/swarm/skills/scan/SKILL.md +119 -0
- package/licenses/production-inventory.json +0 -8567
- package/node_modules/color-convert/CHANGELOG.md +0 -54
- package/node_modules/es-toolkit/CHANGELOG.md +0 -936
- package/node_modules/es-toolkit/src/compat/_internal/Equals.d.ts +0 -1
- package/node_modules/es-toolkit/src/compat/_internal/IsWritable.d.ts +0 -3
- package/node_modules/es-toolkit/src/compat/_internal/MutableList.d.ts +0 -4
- package/node_modules/es-toolkit/src/compat/_internal/RejectReadonly.d.ts +0 -4
- package/node_modules/rechoir/CHANGELOG.md +0 -12
|
@@ -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 {
|
|
@@ -801,6 +860,33 @@ exports.$ZodDate = core.$constructor("$ZodDate", (inst, def) => {
|
|
|
801
860
|
return payload;
|
|
802
861
|
};
|
|
803
862
|
});
|
|
863
|
+
// an oversized container fails its leading size checks before any element is parsed
|
|
864
|
+
function capSize(inst, size) {
|
|
865
|
+
const caps = util.sizeCaps(inst._zod.def.checks);
|
|
866
|
+
if (!caps.length)
|
|
867
|
+
return;
|
|
868
|
+
const cap = Math.min(...caps.map((c) => c[0]));
|
|
869
|
+
const parse = inst._zod.parse;
|
|
870
|
+
inst._zod.parse = (payload, ctx) => {
|
|
871
|
+
const n = size(payload.value);
|
|
872
|
+
if (n > cap && !ctx?.skipChecks && ctx?.direction !== "backward") {
|
|
873
|
+
for (const [max, ch] of util.sizeCaps(inst._zod.def.checks)) {
|
|
874
|
+
if (n > max && ch._zod.def.when(payload)) {
|
|
875
|
+
const start = payload.issues.length;
|
|
876
|
+
ch._zod.check(payload);
|
|
877
|
+
// the value is still the raw input, so no later check may read it
|
|
878
|
+
payload.issues[start].continue = false;
|
|
879
|
+
util.attachSchema(payload.issues, start, inst);
|
|
880
|
+
return payload;
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
return parse(payload, ctx);
|
|
885
|
+
};
|
|
886
|
+
}
|
|
887
|
+
const arraySize = (input) => (Array.isArray(input) ? input.length : -1);
|
|
888
|
+
const mapSize = (input) => (input instanceof Map ? input.size : -1);
|
|
889
|
+
const setSize = (input) => (input instanceof Set ? input.size : -1);
|
|
804
890
|
function handleArrayResult(result, final, index) {
|
|
805
891
|
if (result.issues.length) {
|
|
806
892
|
final.issues.push(...util.prefixIssues(index, result.issues));
|
|
@@ -824,6 +910,7 @@ exports.$ZodArray = core.$constructor("$ZodArray", (inst, def) => {
|
|
|
824
910
|
}
|
|
825
911
|
payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
|
|
826
912
|
const proms = [];
|
|
913
|
+
const abortEarly = ctx?.abortEarly;
|
|
827
914
|
for (let i = 0; i < input.length; i++) {
|
|
828
915
|
const item = input[i];
|
|
829
916
|
const result = def.element._zod.run({
|
|
@@ -835,6 +922,9 @@ exports.$ZodArray = core.$constructor("$ZodArray", (inst, def) => {
|
|
|
835
922
|
}
|
|
836
923
|
else {
|
|
837
924
|
handleArrayResult(result, payload, i);
|
|
925
|
+
// the element's payload is authoritative here, since handleArrayResult forwards every issue; an object's is not, because it drops a failed absent optional
|
|
926
|
+
if (abortEarly && result.issues.length !== 0 && util.aborted(result))
|
|
927
|
+
break;
|
|
838
928
|
}
|
|
839
929
|
}
|
|
840
930
|
if (proms.length) {
|
|
@@ -842,6 +932,7 @@ exports.$ZodArray = core.$constructor("$ZodArray", (inst, def) => {
|
|
|
842
932
|
}
|
|
843
933
|
return payload; //handleArrayResultsAsync(parseResults, final);
|
|
844
934
|
};
|
|
935
|
+
capSize(inst, arraySize);
|
|
845
936
|
});
|
|
846
937
|
function handlePropertyResult(result, final, key, input, optin, optout) {
|
|
847
938
|
const isPresent = key in input;
|
|
@@ -869,7 +960,7 @@ function handlePropertyResult(result, final, key, input, optin, optout) {
|
|
|
869
960
|
return;
|
|
870
961
|
}
|
|
871
962
|
if (result.value === undefined) {
|
|
872
|
-
if (isPresent) {
|
|
963
|
+
if (isPresent || (optin === "defaulted" && !isOptionalOut)) {
|
|
873
964
|
final.value[key] = undefined;
|
|
874
965
|
}
|
|
875
966
|
}
|
|
@@ -901,14 +992,21 @@ function normalizeDef(def) {
|
|
|
901
992
|
optionalKeys: new Set(okeys),
|
|
902
993
|
};
|
|
903
994
|
}
|
|
904
|
-
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
995
|
+
function handleCatchall(proms, input, payload, ctx, def, inst, abortEarly) {
|
|
905
996
|
const unrecognized = [];
|
|
906
997
|
const keySet = def.keySet;
|
|
907
998
|
const _catchall = def.catchall._zod;
|
|
908
999
|
const t = _catchall.def.type;
|
|
909
1000
|
const optin = _catchall.optin;
|
|
910
1001
|
const optout = _catchall.optout;
|
|
1002
|
+
// starts at 0, not the current length: the shape phase already ran and may have aborted
|
|
1003
|
+
let seen = 0;
|
|
911
1004
|
for (const key in input) {
|
|
1005
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
1006
|
+
if (util.aborted(payload, seen))
|
|
1007
|
+
break;
|
|
1008
|
+
seen = payload.issues.length;
|
|
1009
|
+
}
|
|
912
1010
|
// Must precede the __proto__ branch: a declared key is not unrecognized, even though the shape loop deliberately strips __proto__ from the parsed output.
|
|
913
1011
|
if (keySet.has(key))
|
|
914
1012
|
continue;
|
|
@@ -946,26 +1044,22 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
946
1044
|
return payload;
|
|
947
1045
|
});
|
|
948
1046
|
}
|
|
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
1047
|
exports.$ZodObject = core.$constructor("$ZodObject", (inst, def) => {
|
|
952
1048
|
// requires cast because technically $ZodObject doesn't extend
|
|
953
1049
|
exports.$ZodType.init(inst, def);
|
|
954
|
-
// const sh = def.shape;
|
|
955
1050
|
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
});
|
|
1051
|
+
// 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
|
|
1052
|
+
const sh = desc?.get ? desc.get.raw : (def.shape ?? {});
|
|
1053
|
+
if (sh) {
|
|
1054
|
+
// Freezes the shape on first read, so its getters resolve once and every later read sees the same schemas.
|
|
1055
|
+
const get = () => {
|
|
1056
|
+
const newSh = { ...sh };
|
|
1057
|
+
Object.defineProperty(def, "shape", { value: newSh });
|
|
1058
|
+
get.raw = newSh;
|
|
1059
|
+
return newSh;
|
|
1060
|
+
};
|
|
1061
|
+
get.raw = sh;
|
|
1062
|
+
Object.defineProperty(def, "shape", { get });
|
|
969
1063
|
}
|
|
970
1064
|
const _normalized = util.cached(() => normalizeDef(def));
|
|
971
1065
|
util.defineLazyInternal(inst, "propValues", (zod) => {
|
|
@@ -1006,7 +1100,14 @@ exports.$ZodObject = core.$constructor("$ZodObject", (inst, def) => {
|
|
|
1006
1100
|
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
1007
1101
|
const proms = [];
|
|
1008
1102
|
const shape = value.shape;
|
|
1103
|
+
const abortEarly = ctx?.abortEarly;
|
|
1104
|
+
let seen = payload.issues.length;
|
|
1009
1105
|
for (const key of value.allKeys) {
|
|
1106
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
1107
|
+
if (util.aborted(payload, seen))
|
|
1108
|
+
break;
|
|
1109
|
+
seen = payload.issues.length;
|
|
1110
|
+
}
|
|
1010
1111
|
if (key === "__proto__")
|
|
1011
1112
|
continue;
|
|
1012
1113
|
const el = shape[key];
|
|
@@ -1023,7 +1124,7 @@ exports.$ZodObject = core.$constructor("$ZodObject", (inst, def) => {
|
|
|
1023
1124
|
if (!catchall) {
|
|
1024
1125
|
return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
1025
1126
|
}
|
|
1026
|
-
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
1127
|
+
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst, abortEarly === true);
|
|
1027
1128
|
};
|
|
1028
1129
|
});
|
|
1029
1130
|
exports.$ZodObjectJIT = core.$constructor("$ZodObjectJIT", (inst, def) => {
|
|
@@ -1038,12 +1139,18 @@ exports.$ZodObjectJIT = core.$constructor("$ZodObjectJIT", (inst, def) => {
|
|
|
1038
1139
|
// a symbol has no source literal, so it is read as `syms[i]` off the closed-over scope
|
|
1039
1140
|
const doc = new doc_js_1.Doc(["payload", "ctx"], { shape, inst, memo, syms });
|
|
1040
1141
|
const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
1041
|
-
//
|
|
1142
|
+
// 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
1143
|
const prefixStr = (id, k) => `
|
|
1144
|
+
let ${id}_ab = false;
|
|
1043
1145
|
for (let i = 0; i < ${id}.issues.length; i++) {
|
|
1044
1146
|
const iss = ${id}.issues[i];
|
|
1045
1147
|
iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
|
|
1046
1148
|
payload.issues.push(iss);
|
|
1149
|
+
if (iss.continue !== true) ${id}_ab = true;
|
|
1150
|
+
}
|
|
1151
|
+
if (${id}_ab && ctx && ctx.abortEarly) {
|
|
1152
|
+
payload.value = newResult;
|
|
1153
|
+
return payload;
|
|
1047
1154
|
}`;
|
|
1048
1155
|
doc.write(`const input = payload.value;`);
|
|
1049
1156
|
const ids = Object.create(null);
|
|
@@ -1092,6 +1199,10 @@ exports.$ZodObjectJIT = core.$constructor("$ZodObjectJIT", (inst, def) => {
|
|
|
1092
1199
|
input: undefined,
|
|
1093
1200
|
path: [${k}]
|
|
1094
1201
|
});
|
|
1202
|
+
if (ctx && ctx.abortEarly) {
|
|
1203
|
+
payload.value = newResult;
|
|
1204
|
+
return payload;
|
|
1205
|
+
}
|
|
1095
1206
|
}
|
|
1096
1207
|
|
|
1097
1208
|
if (${id}_present) {
|
|
@@ -1104,16 +1215,17 @@ exports.$ZodObjectJIT = core.$constructor("$ZodObjectJIT", (inst, def) => {
|
|
|
1104
1215
|
doc.write(`
|
|
1105
1216
|
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
1106
1217
|
}
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1218
|
+
`);
|
|
1219
|
+
if (optin === "defaulted") {
|
|
1220
|
+
doc.write(`newResult[${k}] = ${id}.value;`);
|
|
1221
|
+
}
|
|
1222
|
+
else {
|
|
1223
|
+
doc.write(`
|
|
1224
|
+
if (${id}.value !== undefined || ${isPresent}) {
|
|
1113
1225
|
newResult[${k}] = ${id}.value;
|
|
1114
1226
|
}
|
|
1115
|
-
|
|
1116
1227
|
`);
|
|
1228
|
+
}
|
|
1117
1229
|
}
|
|
1118
1230
|
}
|
|
1119
1231
|
doc.write(`payload.value = newResult;`);
|
|
@@ -1147,7 +1259,7 @@ exports.$ZodObjectJIT = core.$constructor("$ZodObjectJIT", (inst, def) => {
|
|
|
1147
1259
|
payload = fastpass(payload, ctx);
|
|
1148
1260
|
if (!catchall)
|
|
1149
1261
|
return payload;
|
|
1150
|
-
return handleCatchall([], input, payload, ctx, value, inst);
|
|
1262
|
+
return handleCatchall([], input, payload, ctx, value, inst, ctx?.abortEarly === true);
|
|
1151
1263
|
}
|
|
1152
1264
|
return superParse(payload, ctx);
|
|
1153
1265
|
};
|
|
@@ -1284,22 +1396,38 @@ exports.$ZodXor = core.$constructor("$ZodXor", (inst, def) => {
|
|
|
1284
1396
|
});
|
|
1285
1397
|
};
|
|
1286
1398
|
});
|
|
1287
|
-
/** Returns the option
|
|
1399
|
+
/** Returns the option whose discriminator claims `value`, or throws if ambiguous. */
|
|
1288
1400
|
function getDiscriminatedOption(union, value) {
|
|
1289
1401
|
const internals = union._zod;
|
|
1290
1402
|
let map = internals.bag.optionsMap;
|
|
1291
1403
|
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
|
-
}
|
|
1404
|
+
map = discriminatorMap(internals.def);
|
|
1300
1405
|
internals.bag.optionsMap = map;
|
|
1301
1406
|
}
|
|
1302
|
-
|
|
1407
|
+
const option = map.get(value);
|
|
1408
|
+
if (option === null)
|
|
1409
|
+
throw new Error(`Ambiguous discriminator value "${String(value)}"`);
|
|
1410
|
+
return option;
|
|
1411
|
+
}
|
|
1412
|
+
function discriminatorMap(def) {
|
|
1413
|
+
const map = new Map();
|
|
1414
|
+
for (const option of def.options) {
|
|
1415
|
+
const values = option._zod.propValues?.[def.discriminator];
|
|
1416
|
+
if (!values || values.size === 0)
|
|
1417
|
+
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
1418
|
+
for (const value of values) {
|
|
1419
|
+
if (map.has(value)) {
|
|
1420
|
+
if (value !== undefined)
|
|
1421
|
+
throw new Error(`Duplicate discriminator value "${String(value)}"`);
|
|
1422
|
+
// keep the collision marked so a later member cannot reclaim it
|
|
1423
|
+
map.set(value, null);
|
|
1424
|
+
}
|
|
1425
|
+
else {
|
|
1426
|
+
map.set(value, option);
|
|
1427
|
+
}
|
|
1428
|
+
}
|
|
1429
|
+
}
|
|
1430
|
+
return map;
|
|
1303
1431
|
}
|
|
1304
1432
|
exports.$ZodDiscriminatedUnion =
|
|
1305
1433
|
/*@__PURE__*/
|
|
@@ -1309,10 +1437,13 @@ core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
|
1309
1437
|
const _super = inst._zod.parse;
|
|
1310
1438
|
util.defineLazyInternal(inst, "propValues", (zod) => {
|
|
1311
1439
|
const propValues = {};
|
|
1440
|
+
let undefinedCount = 0;
|
|
1312
1441
|
for (const option of zod.def.options) {
|
|
1313
1442
|
const pv = option._zod.propValues;
|
|
1314
1443
|
if (!pv || Object.keys(pv).length === 0)
|
|
1315
1444
|
throw new Error(`Invalid discriminated union option at index "${zod.def.options.indexOf(option)}"`);
|
|
1445
|
+
if (pv[zod.def.discriminator]?.has(undefined))
|
|
1446
|
+
undefinedCount++;
|
|
1316
1447
|
for (const [k, v] of Object.entries(pv)) {
|
|
1317
1448
|
if (!Object.prototype.hasOwnProperty.call(propValues, k)) {
|
|
1318
1449
|
util.assignProp(propValues, k, new Set());
|
|
@@ -1322,31 +1453,18 @@ core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
|
1322
1453
|
}
|
|
1323
1454
|
}
|
|
1324
1455
|
}
|
|
1456
|
+
if (!zod.def.unionFallback && undefinedCount > 1)
|
|
1457
|
+
propValues[zod.def.discriminator]?.delete(undefined);
|
|
1325
1458
|
return propValues;
|
|
1326
1459
|
});
|
|
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
|
|
1460
|
+
// 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
1461
|
def.options.forEach((option, i) => {
|
|
1329
|
-
const propShape =
|
|
1462
|
+
const propShape = util.rawShape(option._zod.def);
|
|
1330
1463
|
if (propShape && !Object.prototype.hasOwnProperty.call(propShape, def.discriminator)) {
|
|
1331
1464
|
throw new Error(`Invalid discriminated union option at index "${i}"`);
|
|
1332
1465
|
}
|
|
1333
1466
|
});
|
|
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
|
-
});
|
|
1467
|
+
const disc = util.cached(() => discriminatorMap(def));
|
|
1350
1468
|
inst._zod.parse = (payload, ctx) => {
|
|
1351
1469
|
const input = payload.value;
|
|
1352
1470
|
if (!util.isObject(input)) {
|
|
@@ -1358,8 +1476,10 @@ core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
|
1358
1476
|
});
|
|
1359
1477
|
return payload;
|
|
1360
1478
|
}
|
|
1361
|
-
const
|
|
1362
|
-
|
|
1479
|
+
const value = input?.[def.discriminator];
|
|
1480
|
+
const opt = disc.value.get(value);
|
|
1481
|
+
// forward metadata cannot choose an encoder for an absent tag
|
|
1482
|
+
if (opt && (value !== undefined || ctx.direction !== "backward")) {
|
|
1363
1483
|
return opt._zod.run(payload, ctx);
|
|
1364
1484
|
}
|
|
1365
1485
|
// Fall back to union matching when the fast discriminator path fails:
|
|
@@ -1374,7 +1494,7 @@ core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
|
1374
1494
|
errors: [],
|
|
1375
1495
|
note: "No matching discriminator",
|
|
1376
1496
|
discriminator: def.discriminator,
|
|
1377
|
-
options: Array.from(disc.value.keys()),
|
|
1497
|
+
options: Array.from(disc.value.keys()).filter((value) => disc.value.get(value) !== null),
|
|
1378
1498
|
input,
|
|
1379
1499
|
path: [def.discriminator],
|
|
1380
1500
|
inst,
|
|
@@ -1547,6 +1667,9 @@ exports.$ZodTuple = core.$constructor("$ZodTuple", (inst, def) => {
|
|
|
1547
1667
|
}
|
|
1548
1668
|
// 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
1669
|
const itemResults = new Array(items.length);
|
|
1670
|
+
// only tracked when there is a rest loop to skip
|
|
1671
|
+
const abortEarly = def.rest ? ctx?.abortEarly : undefined;
|
|
1672
|
+
let itemAborted = false;
|
|
1550
1673
|
for (let i = 0; i < items.length; i++) {
|
|
1551
1674
|
const r = items[i]._zod.run({ value: input[i], issues: [] }, ctx);
|
|
1552
1675
|
if (r instanceof Promise) {
|
|
@@ -1556,12 +1679,21 @@ exports.$ZodTuple = core.$constructor("$ZodTuple", (inst, def) => {
|
|
|
1556
1679
|
}
|
|
1557
1680
|
else {
|
|
1558
1681
|
itemResults[i] = r;
|
|
1682
|
+
if (abortEarly && !itemAborted && r.issues.length)
|
|
1683
|
+
itemAborted = util.aborted(r);
|
|
1559
1684
|
}
|
|
1560
1685
|
}
|
|
1561
|
-
|
|
1686
|
+
// sound because rest is non-empty exactly when every fixed index is present, the one case handleTupleResults cannot discard an item's issues
|
|
1687
|
+
if (def.rest && !itemAborted) {
|
|
1562
1688
|
let i = items.length - 1;
|
|
1563
1689
|
const rest = input.slice(items.length);
|
|
1690
|
+
let seen = payload.issues.length;
|
|
1564
1691
|
for (const el of rest) {
|
|
1692
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
1693
|
+
if (util.aborted(payload, seen))
|
|
1694
|
+
break;
|
|
1695
|
+
seen = payload.issues.length;
|
|
1696
|
+
}
|
|
1565
1697
|
i++;
|
|
1566
1698
|
const result = def.rest._zod.run({ value: el, issues: [] }, ctx);
|
|
1567
1699
|
if (result instanceof Promise) {
|
|
@@ -1643,6 +1775,7 @@ exports.$ZodRecord = core.$constructor("$ZodRecord", (inst, def) => {
|
|
|
1643
1775
|
});
|
|
1644
1776
|
return payload;
|
|
1645
1777
|
}
|
|
1778
|
+
// 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
1779
|
const proms = [];
|
|
1647
1780
|
const values = def.keyType._zod.values;
|
|
1648
1781
|
if (values && !def.partial) {
|
|
@@ -1814,7 +1947,14 @@ exports.$ZodMap = core.$constructor("$ZodMap", (inst, def) => {
|
|
|
1814
1947
|
}
|
|
1815
1948
|
const proms = [];
|
|
1816
1949
|
payload.value = memo ? memo.alloc(inst, payload, new Map(), ctx) : new Map();
|
|
1950
|
+
const abortEarly = ctx?.abortEarly;
|
|
1951
|
+
let seen = payload.issues.length;
|
|
1817
1952
|
for (const [key, value] of input) {
|
|
1953
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
1954
|
+
if (util.aborted(payload, seen))
|
|
1955
|
+
break;
|
|
1956
|
+
seen = payload.issues.length;
|
|
1957
|
+
}
|
|
1818
1958
|
const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
1819
1959
|
const valueResult = def.valueType._zod.run({ value: value, issues: [] }, ctx);
|
|
1820
1960
|
if (keyResult instanceof Promise || valueResult instanceof Promise) {
|
|
@@ -1830,6 +1970,7 @@ exports.$ZodMap = core.$constructor("$ZodMap", (inst, def) => {
|
|
|
1830
1970
|
return Promise.all(proms).then(() => payload);
|
|
1831
1971
|
return payload;
|
|
1832
1972
|
};
|
|
1973
|
+
capSize(inst, mapSize);
|
|
1833
1974
|
});
|
|
1834
1975
|
function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
1835
1976
|
if (keyResult.issues.length) {
|
|
@@ -1880,7 +2021,14 @@ exports.$ZodSet = core.$constructor("$ZodSet", (inst, def) => {
|
|
|
1880
2021
|
}
|
|
1881
2022
|
const proms = [];
|
|
1882
2023
|
payload.value = memo ? memo.alloc(inst, payload, new Set(), ctx) : new Set();
|
|
2024
|
+
const abortEarly = ctx?.abortEarly;
|
|
2025
|
+
let seen = payload.issues.length;
|
|
1883
2026
|
for (const item of input) {
|
|
2027
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
2028
|
+
if (util.aborted(payload, seen))
|
|
2029
|
+
break;
|
|
2030
|
+
seen = payload.issues.length;
|
|
2031
|
+
}
|
|
1884
2032
|
const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
|
|
1885
2033
|
if (result instanceof Promise) {
|
|
1886
2034
|
proms.push(result.then((result) => handleSetResult(result, payload)));
|
|
@@ -1892,6 +2040,7 @@ exports.$ZodSet = core.$constructor("$ZodSet", (inst, def) => {
|
|
|
1892
2040
|
return Promise.all(proms).then(() => payload);
|
|
1893
2041
|
return payload;
|
|
1894
2042
|
};
|
|
2043
|
+
capSize(inst, setSize);
|
|
1895
2044
|
});
|
|
1896
2045
|
function handleSetResult(result, final) {
|
|
1897
2046
|
if (result.issues.length) {
|
|
@@ -1904,9 +2053,11 @@ exports.$ZodEnum = core.$constructor("$ZodEnum", (inst, def) => {
|
|
|
1904
2053
|
const values = util.getEnumValues(def.entries);
|
|
1905
2054
|
const valuesSet = new Set(values);
|
|
1906
2055
|
inst._zod.values = valuesSet;
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
2056
|
+
util.defineLazyInternal(inst, "pattern", (zod) => {
|
|
2057
|
+
const patternValues = util.getEnumValues(zod.def.entries).filter((k) => util.propertyKeyTypes.has(typeof k));
|
|
2058
|
+
// unmatchable fallback, RE2-safe: an empty alternation would compile to /^()$/, which matches ""
|
|
2059
|
+
return new RegExp(patternValues.length ? `^(${patternValues.map((o) => util.escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
|
|
2060
|
+
});
|
|
1910
2061
|
inst._zod.parse = (payload, _ctx) => {
|
|
1911
2062
|
const input = payload.value;
|
|
1912
2063
|
if (valuesSet.has(input)) {
|
|
@@ -1925,12 +2076,15 @@ exports.$ZodLiteral = core.$constructor("$ZodLiteral", (inst, def) => {
|
|
|
1925
2076
|
exports.$ZodType.init(inst, def);
|
|
1926
2077
|
const values = new Set(def.values);
|
|
1927
2078
|
inst._zod.values = values;
|
|
1928
|
-
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
2079
|
+
util.defineLazyInternal(inst, "pattern", (zod) => {
|
|
2080
|
+
const vals = zod.def.values;
|
|
2081
|
+
// unmatchable fallback, RE2-safe: an empty alternation would compile to /^()$/, which matches ""
|
|
2082
|
+
return new RegExp(vals.length
|
|
2083
|
+
? `^(${vals
|
|
2084
|
+
.map((o) => typeof o === "string" ? util.escapeRegex(o) : o ? util.escapeRegex(o.toString()) : String(o))
|
|
2085
|
+
.join("|")})$`
|
|
2086
|
+
: "^[^\\s\\S]$");
|
|
2087
|
+
});
|
|
1934
2088
|
inst._zod.parse = (payload, _ctx) => {
|
|
1935
2089
|
const input = payload.value;
|
|
1936
2090
|
if (values.has(input)) {
|
|
@@ -2294,22 +2448,67 @@ function handleReadonlyResult(payload) {
|
|
|
2294
2448
|
payload.value = Object.freeze(payload.value);
|
|
2295
2449
|
return payload;
|
|
2296
2450
|
}
|
|
2451
|
+
// 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
|
|
2452
|
+
function leafPattern(schema) {
|
|
2453
|
+
const def = schema._zod.def;
|
|
2454
|
+
let pattern = def.pattern;
|
|
2455
|
+
let isInt = !!def.format?.includes("int");
|
|
2456
|
+
let minimum;
|
|
2457
|
+
let maximum;
|
|
2458
|
+
for (const ch of def.checks ?? []) {
|
|
2459
|
+
const d = ch._zod.def;
|
|
2460
|
+
if (d.pattern)
|
|
2461
|
+
pattern = d.pattern;
|
|
2462
|
+
isInt || (isInt = !!d.format?.includes("int"));
|
|
2463
|
+
const lo = d.minimum ?? d.length;
|
|
2464
|
+
const hi = d.maximum ?? d.length;
|
|
2465
|
+
if (lo !== undefined && (minimum === undefined || lo > minimum))
|
|
2466
|
+
minimum = lo;
|
|
2467
|
+
if (hi !== undefined && (maximum === undefined || hi < maximum))
|
|
2468
|
+
maximum = hi;
|
|
2469
|
+
}
|
|
2470
|
+
if (pattern)
|
|
2471
|
+
return pattern.source;
|
|
2472
|
+
// an empty range matches nothing at runtime, and `{8,5}` is not a legal quantifier
|
|
2473
|
+
if (minimum !== undefined && maximum !== undefined && minimum > maximum)
|
|
2474
|
+
return "(?!)";
|
|
2475
|
+
if (minimum !== undefined || maximum !== undefined)
|
|
2476
|
+
return regexes.string({ minimum, maximum }).source;
|
|
2477
|
+
const own = schema._zod.pattern;
|
|
2478
|
+
return (isInt && own === regexes.number ? regexes.integer : own)?.source;
|
|
2479
|
+
}
|
|
2480
|
+
// 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
|
|
2481
|
+
function partPattern(schema) {
|
|
2482
|
+
const def = schema._zod.def;
|
|
2483
|
+
const own = schema._zod.pattern?.source;
|
|
2484
|
+
// lazy resolves its inner on the internals, not the def
|
|
2485
|
+
const inner = def.innerType ?? schema._zod.innerType;
|
|
2486
|
+
if (inner) {
|
|
2487
|
+
const before = inner._zod.pattern?.source;
|
|
2488
|
+
const after = partPattern(inner);
|
|
2489
|
+
if (own && before && after && after !== before) {
|
|
2490
|
+
return own.replace(util.cleanRegex(before), () => util.cleanRegex(after));
|
|
2491
|
+
}
|
|
2492
|
+
return own;
|
|
2493
|
+
}
|
|
2494
|
+
if (def.options) {
|
|
2495
|
+
const sources = def.options.map(partPattern);
|
|
2496
|
+
if (sources.every(Boolean))
|
|
2497
|
+
return `^(${sources.map((s) => util.cleanRegex(s)).join("|")})$`;
|
|
2498
|
+
}
|
|
2499
|
+
return leafPattern(schema);
|
|
2500
|
+
}
|
|
2297
2501
|
exports.$ZodTemplateLiteral = core.$constructor("$ZodTemplateLiteral", (inst, def) => {
|
|
2298
2502
|
exports.$ZodType.init(inst, def);
|
|
2299
2503
|
const regexParts = [];
|
|
2300
2504
|
for (const part of def.parts) {
|
|
2301
2505
|
if (typeof part === "object" && part !== null) {
|
|
2302
2506
|
// is Zod schema
|
|
2303
|
-
|
|
2304
|
-
|
|
2507
|
+
const source = partPattern(part);
|
|
2508
|
+
if (!source) {
|
|
2305
2509
|
throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);
|
|
2306
2510
|
}
|
|
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));
|
|
2511
|
+
regexParts.push(util.cleanRegex(source));
|
|
2313
2512
|
}
|
|
2314
2513
|
else if (part === null || util.primitiveTypes.has(typeof part)) {
|
|
2315
2514
|
regexParts.push(util.escapeRegex(`${part}`));
|
|
@@ -2479,3 +2678,22 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
2479
2678
|
payload.issues.push(util.issue(_iss));
|
|
2480
2679
|
}
|
|
2481
2680
|
}
|
|
2681
|
+
|
|
2682
|
+
// seal-cjs-exports
|
|
2683
|
+
(function () {
|
|
2684
|
+
var keys = Object.getOwnPropertyNames(exports);
|
|
2685
|
+
for (var i = 0; i < keys.length; i++) {
|
|
2686
|
+
var desc = Object.getOwnPropertyDescriptor(exports, keys[i]);
|
|
2687
|
+
if (!desc || !desc.get || !desc.configurable) continue;
|
|
2688
|
+
var value;
|
|
2689
|
+
try {
|
|
2690
|
+
value = desc.get();
|
|
2691
|
+
} catch (e) {
|
|
2692
|
+
continue;
|
|
2693
|
+
}
|
|
2694
|
+
// a circular require may not have settled this one yet, so leave it live
|
|
2695
|
+
if (value === undefined) continue;
|
|
2696
|
+
Object.defineProperty(exports, keys[i], { value: value, writable: false, enumerable: desc.enumerable, configurable: false });
|
|
2697
|
+
}
|
|
2698
|
+
Object.freeze(exports);
|
|
2699
|
+
})();
|