@zuplo/cli 7.13.3 → 7.13.4
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/dist/cmds/lint.d.ts.map +1 -1
- package/dist/cmds/lint.js +0 -5
- package/dist/cmds/lint.js.map +1 -1
- package/dist/lint/handler.d.ts.map +1 -1
- package/dist/lint/handler.js +9 -0
- package/dist/lint/handler.js.map +1 -1
- package/node_modules/@simple-git/argv-parser/LICENSE +20 -0
- package/node_modules/@simple-git/argv-parser/dist/index.cjs +1 -1
- package/node_modules/@simple-git/argv-parser/dist/index.cjs.map +1 -1
- package/node_modules/@simple-git/argv-parser/dist/index.d.ts +2 -1
- package/node_modules/@simple-git/argv-parser/dist/index.d.ts.map +1 -0
- package/node_modules/@simple-git/argv-parser/dist/index.mjs +244 -198
- package/node_modules/@simple-git/argv-parser/dist/index.mjs.map +1 -1
- package/node_modules/@simple-git/argv-parser/dist/src/args/parse-argv.d.ts +1 -0
- package/node_modules/@simple-git/argv-parser/dist/src/args/parse-argv.d.ts.map +1 -0
- package/node_modules/@simple-git/argv-parser/dist/src/args/parse-argv.types.d.ts +1 -0
- package/node_modules/@simple-git/argv-parser/dist/src/args/parse-argv.types.d.ts.map +1 -0
- package/node_modules/@simple-git/argv-parser/dist/src/config/analyse-config.d.ts +1 -0
- package/node_modules/@simple-git/argv-parser/dist/src/config/analyse-config.d.ts.map +1 -0
- package/node_modules/@simple-git/argv-parser/dist/src/config/config-operands.d.ts +1 -0
- package/node_modules/@simple-git/argv-parser/dist/src/config/config-operands.d.ts.map +1 -0
- package/node_modules/@simple-git/argv-parser/dist/src/config/config.types.d.ts +1 -0
- package/node_modules/@simple-git/argv-parser/dist/src/config/config.types.d.ts.map +1 -0
- package/node_modules/@simple-git/argv-parser/dist/src/config/detect-config-action.d.ts +1 -0
- package/node_modules/@simple-git/argv-parser/dist/src/config/detect-config-action.d.ts.map +1 -0
- package/node_modules/@simple-git/argv-parser/dist/src/env/parse-env.d.ts +25 -0
- package/node_modules/@simple-git/argv-parser/dist/src/env/parse-env.d.ts.map +1 -0
- package/node_modules/@simple-git/argv-parser/dist/src/flags/flags.helpers.d.ts +1 -0
- package/node_modules/@simple-git/argv-parser/dist/src/flags/flags.helpers.d.ts.map +1 -0
- package/node_modules/@simple-git/argv-parser/dist/src/flags/parse-global-flags.d.ts +1 -0
- package/node_modules/@simple-git/argv-parser/dist/src/flags/parse-global-flags.d.ts.map +1 -0
- package/node_modules/@simple-git/argv-parser/dist/src/flags/parse-task-flags.d.ts +1 -0
- package/node_modules/@simple-git/argv-parser/dist/src/flags/parse-task-flags.d.ts.map +1 -0
- package/node_modules/@simple-git/argv-parser/dist/src/tokens/flag-specs.d.ts +1 -0
- package/node_modules/@simple-git/argv-parser/dist/src/tokens/flag-specs.d.ts.map +1 -0
- package/node_modules/@simple-git/argv-parser/dist/src/tokens/token-expander.d.ts +1 -0
- package/node_modules/@simple-git/argv-parser/dist/src/tokens/token-expander.d.ts.map +1 -0
- package/node_modules/@simple-git/argv-parser/dist/src/vulnerabilities/detect-vulnerable-config-writes.d.ts +1 -0
- package/node_modules/@simple-git/argv-parser/dist/src/vulnerabilities/detect-vulnerable-config-writes.d.ts.map +1 -0
- package/node_modules/@simple-git/argv-parser/dist/src/vulnerabilities/detect-vulnerable-flags.d.ts +1 -0
- package/node_modules/@simple-git/argv-parser/dist/src/vulnerabilities/detect-vulnerable-flags.d.ts.map +1 -0
- package/node_modules/@simple-git/argv-parser/dist/src/vulnerabilities/vulnerability-analysis.d.ts +1 -0
- package/node_modules/@simple-git/argv-parser/dist/src/vulnerabilities/vulnerability-analysis.d.ts.map +1 -0
- package/node_modules/@simple-git/argv-parser/dist/src/vulnerabilities/vulnerability-check.d.ts +1 -0
- package/node_modules/@simple-git/argv-parser/dist/src/vulnerabilities/vulnerability-check.d.ts.map +1 -0
- package/node_modules/@simple-git/argv-parser/dist/src/vulnerabilities/vulnerability.types.d.ts +29 -0
- package/node_modules/@simple-git/argv-parser/dist/src/vulnerabilities/vulnerability.types.d.ts.map +1 -0
- package/node_modules/@simple-git/argv-parser/package.json +2 -2
- package/node_modules/@zuplo/core/customer.cli.minified.js +344 -344
- package/node_modules/@zuplo/core/index.minified.js +359 -359
- package/node_modules/@zuplo/core/package.json +1 -1
- package/node_modules/@zuplo/graphql/package.json +1 -1
- package/node_modules/@zuplo/openapi-tools/package.json +2 -2
- package/node_modules/@zuplo/otel/package.json +1 -1
- package/node_modules/@zuplo/runtime/out/esm/{chunk-DVFQRFED.js → chunk-NWYAKCSU.js} +81 -81
- package/node_modules/@zuplo/runtime/out/esm/chunk-NWYAKCSU.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/chunk-PXS4NOKU.js +102 -0
- package/node_modules/@zuplo/runtime/out/esm/chunk-PXS4NOKU.js.map +1 -0
- package/node_modules/@zuplo/runtime/out/esm/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mcp-gateway/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/mocks/index.js +1 -1
- package/node_modules/@zuplo/runtime/out/esm/sdks/aws/index.js +1 -1
- package/node_modules/@zuplo/runtime/package.json +2 -2
- package/node_modules/simple-git/LICENSE +20 -0
- package/node_modules/simple-git/dist/index.cjs +6 -0
- package/node_modules/simple-git/dist/index.cjs.map +1 -0
- package/node_modules/simple-git/dist/index.d.ts +5 -0
- package/node_modules/simple-git/dist/index.d.ts.map +1 -0
- package/node_modules/simple-git/dist/index.mjs +2895 -0
- package/node_modules/simple-git/dist/index.mjs.map +1 -0
- package/node_modules/simple-git/dist/src/lib/api.d.ts +13 -13
- package/node_modules/simple-git/dist/src/lib/api.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/args/log-format.d.ts +1 -0
- package/node_modules/simple-git/dist/src/lib/args/log-format.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/errors/git-configuration-error.d.ts +25 -0
- package/node_modules/simple-git/dist/src/lib/errors/git-configuration-error.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/errors/git-construct-error.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/errors/git-construct-error.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/errors/git-error.d.ts +3 -2
- package/node_modules/simple-git/dist/src/lib/errors/git-error.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/errors/git-plugin-error.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/errors/git-plugin-error.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/errors/git-response-error.d.ts +3 -2
- package/node_modules/simple-git/dist/src/lib/errors/git-response-error.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/errors/task-configuration-error.d.ts +1 -0
- package/node_modules/simple-git/dist/src/lib/errors/task-configuration-error.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/git-factory.d.ts +3 -15
- package/node_modules/simple-git/dist/src/lib/git-factory.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/git-logger.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/git-logger.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/parsers/parse-branch-delete.d.ts +3 -2
- package/node_modules/simple-git/dist/src/lib/parsers/parse-branch-delete.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/parsers/parse-branch.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/parsers/parse-branch.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/{responses/CleanSummary.d.ts → parsers/parse-clean.d.ts} +5 -4
- package/node_modules/simple-git/dist/src/lib/parsers/parse-clean.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/parsers/parse-commit.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/parsers/parse-commit.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/parsers/parse-diff-summary.d.ts +1 -0
- package/node_modules/simple-git/dist/src/lib/parsers/parse-diff-summary.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/parsers/parse-fetch.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/parsers/parse-fetch.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/parsers/parse-list-log-summary.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/parsers/parse-list-log-summary.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/parsers/parse-merge.d.ts +3 -2
- package/node_modules/simple-git/dist/src/lib/parsers/parse-merge.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/parsers/parse-move.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/parsers/parse-move.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/parsers/parse-pull.d.ts +3 -2
- package/node_modules/simple-git/dist/src/lib/parsers/parse-pull.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/parsers/parse-push.d.ts +3 -2
- package/node_modules/simple-git/dist/src/lib/parsers/parse-push.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/parsers/parse-remote-messages.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/parsers/parse-remote-messages.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/parsers/parse-remote-objects.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/parsers/parse-remote-objects.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/plugins/abort-plugin.d.ts +3 -2
- package/node_modules/simple-git/dist/src/lib/plugins/abort-plugin.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/plugins/allow-environment.plugin.d.ts +3 -0
- package/node_modules/simple-git/dist/src/lib/plugins/allow-environment.plugin.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/plugins/block-unsafe-operations-plugin.d.ts +1 -0
- package/node_modules/simple-git/dist/src/lib/plugins/block-unsafe-operations-plugin.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/plugins/command-config-prefixing-plugin.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/plugins/command-config-prefixing-plugin.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/plugins/completion-detection.plugin.d.ts +3 -2
- package/node_modules/simple-git/dist/src/lib/plugins/completion-detection.plugin.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/plugins/custom-binary.plugin.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/plugins/custom-binary.plugin.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/plugins/error-detection.plugin.d.ts +3 -2
- package/node_modules/simple-git/dist/src/lib/plugins/error-detection.plugin.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/plugins/index.d.ts +5 -1
- package/node_modules/simple-git/dist/src/lib/plugins/index.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/plugins/input.plugin.d.ts +4 -0
- package/node_modules/simple-git/dist/src/lib/plugins/input.plugin.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/plugins/plugin-store.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/plugins/plugin-store.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/plugins/progress-monitor-plugin.d.ts +3 -2
- package/node_modules/simple-git/dist/src/lib/plugins/progress-monitor-plugin.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/plugins/simple-git-plugin.d.ts +8 -4
- package/node_modules/simple-git/dist/src/lib/plugins/simple-git-plugin.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/plugins/spawn-options-plugin.d.ts +3 -2
- package/node_modules/simple-git/dist/src/lib/plugins/spawn-options-plugin.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/plugins/suffix-paths.plugin.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/plugins/suffix-paths.plugin.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/plugins/{timout-plugin.d.ts → timeout-plugin.d.ts} +2 -1
- package/node_modules/simple-git/dist/src/lib/plugins/timeout-plugin.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/responses/BranchDeleteSummary.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/responses/BranchDeleteSummary.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/responses/BranchSummary.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/responses/BranchSummary.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/responses/ConfigList.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/responses/ConfigList.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/responses/DiffSummary.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/responses/DiffSummary.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/responses/FileStatusSummary.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/responses/FileStatusSummary.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/responses/GetRemoteSummary.d.ts +1 -0
- package/node_modules/simple-git/dist/src/lib/responses/GetRemoteSummary.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/responses/InitSummary.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/responses/InitSummary.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/responses/MergeSummary.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/responses/MergeSummary.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/responses/PullSummary.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/responses/PullSummary.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/responses/StatusSummary.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/responses/StatusSummary.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/responses/TagList.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/responses/TagList.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/runners/git-executor-chain.d.ts +5 -3
- package/node_modules/simple-git/dist/src/lib/runners/git-executor-chain.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/runners/git-executor.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/runners/git-executor.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/runners/scheduler.d.ts +1 -0
- package/node_modules/simple-git/dist/src/lib/runners/scheduler.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/runners/tasks-pending-queue.d.ts +3 -2
- package/node_modules/simple-git/dist/src/lib/runners/tasks-pending-queue.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/simple-git-api.d.ts +3 -2
- package/node_modules/simple-git/dist/src/lib/simple-git-api.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/task-callback.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/task-callback.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/apply-patch.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/tasks/apply-patch.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/branch.d.ts +3 -2
- package/node_modules/simple-git/dist/src/lib/tasks/branch.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/change-working-directory.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/tasks/change-working-directory.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/check-ignore.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/tasks/check-ignore.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/check-is-repo.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/tasks/check-is-repo.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/checkout.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/tasks/checkout.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/clean.d.ts +3 -2
- package/node_modules/simple-git/dist/src/lib/tasks/clean.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/clone.d.ts +4 -3
- package/node_modules/simple-git/dist/src/lib/tasks/clone.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/commit.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/tasks/commit.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/config.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/tasks/config.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/count-objects.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/tasks/count-objects.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/diff-name-status.d.ts +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/diff-name-status.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/diff.d.ts +4 -3
- package/node_modules/simple-git/dist/src/lib/tasks/diff.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/fetch.d.ts +4 -3
- package/node_modules/simple-git/dist/src/lib/tasks/fetch.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/first-commit.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/tasks/first-commit.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/grep.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/tasks/grep.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/hash-object.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/tasks/hash-object.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/init.d.ts +3 -2
- package/node_modules/simple-git/dist/src/lib/tasks/init.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/interpret-trailers.d.ts +3 -0
- package/node_modules/simple-git/dist/src/lib/tasks/interpret-trailers.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/log.d.ts +3 -2
- package/node_modules/simple-git/dist/src/lib/tasks/log.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/merge.d.ts +4 -3
- package/node_modules/simple-git/dist/src/lib/tasks/merge.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/move.d.ts +3 -2
- package/node_modules/simple-git/dist/src/lib/tasks/move.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/pull.d.ts +3 -2
- package/node_modules/simple-git/dist/src/lib/tasks/pull.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/push.d.ts +3 -2
- package/node_modules/simple-git/dist/src/lib/tasks/push.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/remote.d.ts +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/remote.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/reset.d.ts +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/reset.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/show.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/tasks/show.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/stash-list.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/tasks/stash-list.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/status.d.ts +3 -2
- package/node_modules/simple-git/dist/src/lib/tasks/status.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/sub-module.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/tasks/sub-module.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/tag.d.ts +3 -2
- package/node_modules/simple-git/dist/src/lib/tasks/tag.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/task.d.ts +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/task.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/tasks/version.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/tasks/version.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/types/handlers.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/types/handlers.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/types/index.d.ts +19 -2
- package/node_modules/simple-git/dist/src/lib/types/index.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/types/tasks.d.ts +4 -2
- package/node_modules/simple-git/dist/src/lib/types/tasks.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/utils/argument-filters.d.ts +2 -0
- package/node_modules/simple-git/dist/src/lib/utils/argument-filters.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/utils/exit-codes.d.ts +1 -0
- package/node_modules/simple-git/dist/src/lib/utils/exit-codes.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/utils/git-output-streams.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/utils/git-output-streams.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/utils/index.d.ts +1 -0
- package/node_modules/simple-git/dist/src/lib/utils/index.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/utils/line-parser.d.ts +1 -0
- package/node_modules/simple-git/dist/src/lib/utils/line-parser.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/utils/simple-git-options.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/utils/simple-git-options.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/utils/task-options.d.ts +2 -1
- package/node_modules/simple-git/dist/src/lib/utils/task-options.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/utils/task-parser.d.ts +3 -2
- package/node_modules/simple-git/dist/src/lib/utils/task-parser.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/lib/utils/util.d.ts +2 -0
- package/node_modules/simple-git/dist/src/lib/utils/util.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/typings/index.d.ts +4 -0
- package/node_modules/simple-git/dist/src/typings/index.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/typings/response.d.ts +479 -0
- package/node_modules/simple-git/dist/src/typings/response.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/typings/simple-git.d.ts +517 -0
- package/node_modules/simple-git/dist/src/typings/simple-git.d.ts.map +1 -0
- package/node_modules/simple-git/dist/src/typings/types.d.ts +11 -0
- package/node_modules/simple-git/dist/src/typings/types.d.ts.map +1 -0
- package/node_modules/simple-git/package.json +12 -16
- package/node_modules/simple-git/readme.md +29 -47
- package/node_modules/undici/docs/docs/api/Client.md +2 -0
- package/node_modules/undici/docs/docs/api/DiagnosticsChannel.md +3 -1
- package/node_modules/undici/docs/docs/api/Dispatcher.md +1 -0
- package/node_modules/undici/lib/core/connect.js +10 -4
- package/node_modules/undici/lib/core/request.js +23 -2
- package/node_modules/undici/lib/core/symbols.js +1 -0
- package/node_modules/undici/lib/dispatcher/agent.js +6 -2
- package/node_modules/undici/lib/dispatcher/balanced-pool.js +4 -2
- package/node_modules/undici/lib/dispatcher/client-h1.js +23 -10
- package/node_modules/undici/lib/dispatcher/client-h2.js +84 -23
- package/node_modules/undici/lib/dispatcher/client.js +9 -4
- package/node_modules/undici/lib/dispatcher/dispatcher-base.js +12 -0
- package/node_modules/undici/lib/handler/cache-handler.js +69 -5
- package/node_modules/undici/lib/handler/deduplication-handler.js +57 -13
- package/node_modules/undici/lib/handler/redirect-handler.js +8 -1
- package/node_modules/undici/lib/handler/retry-handler.js +109 -23
- package/node_modules/undici/lib/interceptor/cache.js +20 -1
- package/node_modules/undici/lib/interceptor/decompress.js +348 -46
- package/node_modules/undici/lib/interceptor/dump.js +10 -23
- package/node_modules/undici/lib/web/cookies/index.js +3 -1
- package/node_modules/undici/lib/web/cookies/parse.js +138 -137
- package/node_modules/undici/lib/web/cookies/util.js +21 -2
- package/node_modules/undici/lib/web/eventsource/eventsource-stream.js +325 -149
- package/node_modules/undici/lib/web/eventsource/eventsource.js +4 -1
- package/node_modules/undici/lib/web/fetch/index.js +3 -3
- package/node_modules/undici/lib/web/infra/index.js +14 -0
- package/node_modules/undici/lib/web/subresource-integrity/subresource-integrity.js +5 -5
- package/node_modules/undici/lib/web/websocket/connection.js +19 -9
- package/node_modules/undici/lib/web/websocket/permessage-deflate.js +5 -0
- package/node_modules/undici/lib/web/websocket/receiver.js +13 -0
- package/node_modules/undici/lib/web/websocket/stream/websocketstream.js +8 -10
- package/node_modules/undici/package.json +1 -1
- package/node_modules/undici/types/client.d.ts +14 -0
- package/node_modules/undici/types/interceptors.d.ts +2 -0
- package/node_modules/zod/README.md +29 -2
- package/node_modules/zod/compile.cjs +96 -0
- package/node_modules/zod/compile.d.cts +1 -0
- package/node_modules/zod/compile.d.ts +1 -0
- package/node_modules/zod/compile.js +52 -0
- package/node_modules/zod/index.cjs +21 -2
- package/node_modules/zod/index.d.cts +1 -2
- package/node_modules/zod/index.d.ts +1 -2
- package/node_modules/zod/index.js +5 -2
- package/node_modules/zod/locales/index.cjs +19 -0
- package/node_modules/zod/mini/index.cjs +19 -0
- package/node_modules/zod/package.json +20 -8
- package/node_modules/zod/src/compile.ts +56 -0
- package/node_modules/zod/src/index.ts +5 -2
- package/node_modules/zod/src/v3/ZodError.ts +22 -12
- package/node_modules/zod/src/v3/helpers/errorUtil.ts +1 -1
- package/node_modules/zod/src/v3/tests/error.test.ts +35 -0
- package/node_modules/zod/src/v3/tests/intersection.test.ts +18 -0
- package/node_modules/zod/src/v3/tests/language-server.test.ts +1 -2
- package/node_modules/zod/src/v3/tests/object.test.ts +3 -6
- package/node_modules/zod/src/v3/tests/readonly.test.ts +0 -80
- package/node_modules/zod/src/v3/tests/string.test.ts +6 -0
- package/node_modules/zod/src/v3/types.ts +5 -5
- package/node_modules/zod/src/v4/classic/checks.ts +1 -0
- package/node_modules/zod/src/v4/classic/compat.ts +26 -18
- package/node_modules/zod/src/v4/classic/deep-partial.ts +76 -0
- package/node_modules/zod/src/v4/classic/errors.ts +59 -44
- package/node_modules/zod/src/v4/classic/external.ts +14 -9
- package/node_modules/zod/src/v4/classic/from-json-schema.ts +363 -78
- package/node_modules/zod/src/v4/classic/in-out.ts +45 -0
- package/node_modules/zod/src/v4/classic/index.ts +2 -2
- package/node_modules/zod/src/v4/classic/iso.ts +2 -72
- package/node_modules/zod/src/v4/classic/parse.ts +10 -4
- package/node_modules/zod/src/v4/classic/schemas.ts +640 -375
- package/node_modules/zod/src/v4/classic/tests/apply.test.ts +27 -0
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +29 -2
- package/node_modules/zod/src/v4/classic/tests/assignability.test.ts +186 -0
- package/node_modules/zod/src/v4/classic/tests/bigint.test.ts +36 -1
- package/node_modules/zod/src/v4/classic/tests/catch.test.ts +278 -0
- package/node_modules/zod/src/v4/classic/tests/codec-examples.test.ts +1 -2
- package/node_modules/zod/src/v4/classic/tests/codec.test.ts +2 -1
- package/node_modules/zod/src/v4/classic/tests/continuability.test.ts +3 -3
- package/node_modules/zod/src/v4/classic/tests/credit-card.test.ts +76 -0
- package/node_modules/zod/src/v4/classic/tests/cyclic-data.test.ts +985 -0
- package/node_modules/zod/src/v4/classic/tests/date.test.ts +30 -0
- package/node_modules/zod/src/v4/classic/tests/datetime.test.ts +32 -18
- package/node_modules/zod/src/v4/classic/tests/deep-partial.test.ts +380 -0
- package/node_modules/zod/src/v4/classic/tests/default-locale.test.ts +32 -0
- package/node_modules/zod/src/v4/classic/tests/default.test.ts +46 -0
- package/node_modules/zod/src/v4/classic/tests/detached-methods.test.ts +31 -7
- package/node_modules/zod/src/v4/classic/tests/discriminated-unions.test.ts +261 -13
- package/node_modules/zod/src/v4/classic/tests/enum.test.ts +20 -0
- package/node_modules/zod/src/v4/classic/tests/error-utils.test.ts +112 -2
- package/node_modules/zod/src/v4/classic/tests/error.test.ts +403 -6
- package/node_modules/zod/src/v4/classic/tests/from-json-schema.test.ts +582 -10
- package/node_modules/zod/src/v4/classic/tests/function.test.ts +31 -0
- package/node_modules/zod/src/v4/classic/tests/global-config.test.ts +2 -9
- package/node_modules/zod/src/v4/classic/tests/hash.test.ts +1 -2
- package/node_modules/zod/src/v4/classic/tests/iban.test.ts +81 -0
- package/node_modules/zod/src/v4/classic/tests/in-out.test.ts +159 -0
- package/node_modules/zod/src/v4/classic/tests/index.test.ts +21 -2
- package/node_modules/zod/src/v4/classic/tests/instance-footprint.test.ts +319 -0
- package/node_modules/zod/src/v4/classic/tests/instanceof.test.ts +67 -0
- package/node_modules/zod/src/v4/classic/tests/intersection.test.ts +136 -0
- package/node_modules/zod/src/v4/classic/tests/issue-schema.test.ts +215 -0
- package/node_modules/zod/src/v4/classic/tests/jitless-allows-eval.test.ts +3 -10
- package/node_modules/zod/src/v4/classic/tests/lazy.test.ts +36 -1
- package/node_modules/zod/src/v4/classic/tests/literal.test.ts +12 -1
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +19 -0
- package/node_modules/zod/src/v4/classic/tests/number.test.ts +85 -9
- package/node_modules/zod/src/v4/classic/tests/object.test.ts +301 -12
- package/node_modules/zod/src/v4/classic/tests/optin-ladder.test.ts +235 -0
- package/node_modules/zod/src/v4/classic/tests/optional.test.ts +49 -16
- package/node_modules/zod/src/v4/classic/tests/partial.test.ts +51 -4
- package/node_modules/zod/src/v4/classic/tests/prefault.test.ts +70 -0
- package/node_modules/zod/src/v4/classic/tests/preprocess-types.test.ts +20 -2
- package/node_modules/zod/src/v4/classic/tests/properties.test.ts +141 -0
- package/node_modules/zod/src/v4/classic/tests/readonly.test.ts +0 -68
- package/node_modules/zod/src/v4/classic/tests/record.test.ts +186 -18
- package/node_modules/zod/src/v4/classic/tests/recursive-types.test.ts +79 -3
- package/node_modules/zod/src/v4/classic/tests/redos.test.ts +68 -0
- package/node_modules/zod/src/v4/classic/tests/refine.test.ts +60 -0
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +15 -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 +222 -6
- package/node_modules/zod/src/v4/classic/tests/stringbool.test.ts +18 -0
- package/node_modules/zod/src/v4/classic/tests/template-literal.test.ts +44 -3
- package/node_modules/zod/src/v4/classic/tests/to-json-schema.test.ts +1812 -204
- package/node_modules/zod/src/v4/classic/tests/tuple.test.ts +45 -30
- package/node_modules/zod/src/v4/classic/tests/union.test.ts +39 -2
- package/node_modules/zod/src/v4/classic/tests/validate.test.ts +645 -0
- package/node_modules/zod/src/v4/classic/tests/validations.test.ts +2 -2
- package/node_modules/zod/src/v4/core/api.ts +87 -35
- package/node_modules/zod/src/v4/core/checks.ts +119 -146
- package/node_modules/zod/src/v4/core/compile.ts +2322 -0
- package/node_modules/zod/src/v4/core/core.ts +99 -22
- package/node_modules/zod/src/v4/core/doc.ts +17 -9
- package/node_modules/zod/src/v4/core/errors.ts +113 -25
- package/node_modules/zod/src/v4/core/index.ts +3 -0
- package/node_modules/zod/src/v4/core/json-schema-generator.ts +8 -3
- package/node_modules/zod/src/v4/core/json-schema-processors.ts +424 -156
- package/node_modules/zod/src/v4/core/json-schema.ts +2 -1
- package/node_modules/zod/src/v4/core/memoizer.ts +331 -0
- package/node_modules/zod/src/v4/core/parse.ts +164 -50
- package/node_modules/zod/src/v4/core/regexes.ts +42 -15
- package/node_modules/zod/src/v4/core/registries.ts +2 -2
- package/node_modules/zod/src/v4/core/schemas.ts +1035 -539
- 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 +1004 -0
- package/node_modules/zod/src/v4/core/tests/compile-generative.test.ts +445 -0
- package/node_modules/zod/src/v4/core/tests/compile-global.test.ts +89 -0
- package/node_modules/zod/src/v4/core/tests/compile-off-by-default.test.ts +26 -0
- package/node_modules/zod/src/v4/core/tests/compile-stats.test.ts +34 -0
- package/node_modules/zod/src/v4/core/tests/compile.test.ts +2036 -0
- package/node_modules/zod/src/v4/core/tests/email-regex.test.ts +140 -0
- package/node_modules/zod/src/v4/core/tests/locales/el.test.ts +1 -2
- package/node_modules/zod/src/v4/core/tests/locales/es.test.ts +1 -2
- package/node_modules/zod/src/v4/core/tests/locales/fr.test.ts +3 -3
- package/node_modules/zod/src/v4/core/tests/locales/parity.test.ts +42 -0
- package/node_modules/zod/src/v4/core/tests/locales/tg.test.ts +85 -0
- package/node_modules/zod/src/v4/core/tests/locales/tk.test.ts +69 -0
- package/node_modules/zod/src/v4/core/tests/polyfill-collision.test.ts +46 -0
- package/node_modules/zod/src/v4/core/tests/treeshake.test.ts +51 -0
- package/node_modules/zod/src/v4/core/tests/url-no-canparse.test.ts +133 -0
- package/node_modules/zod/src/v4/core/to-json-schema.ts +283 -48
- package/node_modules/zod/src/v4/core/util.ts +467 -157
- package/node_modules/zod/src/v4/core/versions.ts +2 -2
- package/node_modules/zod/src/v4/core/visit.ts +193 -0
- package/node_modules/zod/src/v4/index.ts +3 -3
- package/node_modules/zod/src/v4/locales/ar.ts +5 -0
- package/node_modules/zod/src/v4/locales/az.ts +5 -0
- package/node_modules/zod/src/v4/locales/be.ts +12 -0
- package/node_modules/zod/src/v4/locales/bg.ts +5 -0
- package/node_modules/zod/src/v4/locales/bn.ts +123 -0
- package/node_modules/zod/src/v4/locales/ca.ts +5 -0
- package/node_modules/zod/src/v4/locales/ckb.ts +140 -0
- package/node_modules/zod/src/v4/locales/cs.ts +5 -0
- package/node_modules/zod/src/v4/locales/da.ts +7 -2
- package/node_modules/zod/src/v4/locales/de.ts +5 -0
- package/node_modules/zod/src/v4/locales/el.ts +3 -0
- package/node_modules/zod/src/v4/locales/en.ts +17 -4
- package/node_modules/zod/src/v4/locales/eo.ts +5 -0
- package/node_modules/zod/src/v4/locales/es.ts +4 -0
- package/node_modules/zod/src/v4/locales/fa.ts +5 -0
- package/node_modules/zod/src/v4/locales/fi.ts +5 -0
- package/node_modules/zod/src/v4/locales/fr-CA.ts +5 -0
- package/node_modules/zod/src/v4/locales/fr.ts +21 -14
- package/node_modules/zod/src/v4/locales/gu.ts +123 -0
- package/node_modules/zod/src/v4/locales/he.ts +8 -1
- package/node_modules/zod/src/v4/locales/hi.ts +126 -0
- package/node_modules/zod/src/v4/locales/hr.ts +4 -0
- package/node_modules/zod/src/v4/locales/hu.ts +5 -0
- package/node_modules/zod/src/v4/locales/hy.ts +11 -0
- package/node_modules/zod/src/v4/locales/id.ts +5 -0
- package/node_modules/zod/src/v4/locales/index.ts +11 -0
- package/node_modules/zod/src/v4/locales/is.ts +5 -0
- package/node_modules/zod/src/v4/locales/it.ts +5 -0
- package/node_modules/zod/src/v4/locales/ja.ts +5 -0
- package/node_modules/zod/src/v4/locales/ka.ts +5 -0
- package/node_modules/zod/src/v4/locales/km.ts +5 -0
- package/node_modules/zod/src/v4/locales/kn.ts +126 -0
- package/node_modules/zod/src/v4/locales/ko.ts +5 -0
- package/node_modules/zod/src/v4/locales/lt.ts +4 -0
- package/node_modules/zod/src/v4/locales/mk.ts +5 -0
- package/node_modules/zod/src/v4/locales/ms.ts +5 -0
- package/node_modules/zod/src/v4/locales/ne.ts +128 -0
- package/node_modules/zod/src/v4/locales/nl.ts +5 -0
- package/node_modules/zod/src/v4/locales/nn.ts +121 -0
- package/node_modules/zod/src/v4/locales/no.ts +7 -2
- package/node_modules/zod/src/v4/locales/ota.ts +5 -0
- package/node_modules/zod/src/v4/locales/pl.ts +5 -0
- package/node_modules/zod/src/v4/locales/ps.ts +5 -0
- package/node_modules/zod/src/v4/locales/pt-BR.ts +161 -0
- package/node_modules/zod/src/v4/locales/pt.ts +101 -58
- package/node_modules/zod/src/v4/locales/ro.ts +3 -0
- package/node_modules/zod/src/v4/locales/ru.ts +12 -0
- package/node_modules/zod/src/v4/locales/sk.ts +123 -0
- package/node_modules/zod/src/v4/locales/sl.ts +5 -0
- package/node_modules/zod/src/v4/locales/sv.ts +7 -2
- package/node_modules/zod/src/v4/locales/ta.ts +5 -0
- package/node_modules/zod/src/v4/locales/tg.ts +135 -0
- package/node_modules/zod/src/v4/locales/th.ts +5 -0
- package/node_modules/zod/src/v4/locales/tk.ts +113 -0
- package/node_modules/zod/src/v4/locales/tr.ts +5 -0
- package/node_modules/zod/src/v4/locales/uk.ts +5 -0
- package/node_modules/zod/src/v4/locales/ur.ts +5 -0
- package/node_modules/zod/src/v4/locales/uz.ts +3 -0
- package/node_modules/zod/src/v4/locales/vi.ts +5 -0
- package/node_modules/zod/src/v4/locales/yo.ts +5 -0
- package/node_modules/zod/src/v4/locales/zh-CN.ts +5 -0
- package/node_modules/zod/src/v4/locales/zh-TW.ts +5 -0
- package/node_modules/zod/src/v4/mini/checks.ts +1 -0
- package/node_modules/zod/src/v4/mini/deep-partial.ts +73 -0
- package/node_modules/zod/src/v4/mini/external.ts +12 -1
- package/node_modules/zod/src/v4/mini/in-out.ts +45 -0
- package/node_modules/zod/src/v4/mini/parse.ts +2 -0
- package/node_modules/zod/src/v4/mini/schemas.ts +167 -63
- package/node_modules/zod/src/v4/mini/tests/apply.test.ts +33 -0
- package/node_modules/zod/src/v4/mini/tests/assignability.test.ts +62 -1
- package/node_modules/zod/src/v4/mini/tests/checks.test.ts +14 -0
- package/node_modules/zod/src/v4/mini/tests/codec.test.ts +35 -1
- package/node_modules/zod/src/v4/mini/tests/computed.test.ts +11 -17
- package/node_modules/zod/src/v4/mini/tests/cyclic-data.test.ts +84 -0
- package/node_modules/zod/src/v4/mini/tests/deep-partial.test.ts +54 -0
- package/node_modules/zod/src/v4/mini/tests/error.test.ts +23 -4
- package/node_modules/zod/src/v4/mini/tests/functions.test.ts +9 -0
- package/node_modules/zod/src/v4/mini/tests/index.test.ts +158 -5
- package/node_modules/zod/src/v4/mini/tests/number.test.ts +14 -0
- package/node_modules/zod/src/v4/mini/tests/object.test.ts +65 -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 +44 -0
- package/node_modules/zod/v3/ZodError.cjs +41 -12
- package/node_modules/zod/v3/ZodError.d.cts +1 -1
- package/node_modules/zod/v3/ZodError.d.ts +1 -1
- package/node_modules/zod/v3/ZodError.js +22 -12
- 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 +26 -5
- package/node_modules/zod/v3/types.js +7 -5
- package/node_modules/zod/v4/classic/checks.cjs +21 -1
- package/node_modules/zod/v4/classic/checks.d.cts +1 -1
- package/node_modules/zod/v4/classic/checks.d.ts +1 -1
- package/node_modules/zod/v4/classic/checks.js +1 -1
- 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/compat.d.cts +9 -11
- package/node_modules/zod/v4/classic/compat.d.ts +9 -11
- package/node_modules/zod/v4/classic/deep-partial.cjs +58 -0
- package/node_modules/zod/v4/classic/deep-partial.d.cts +14 -0
- package/node_modules/zod/v4/classic/deep-partial.d.ts +14 -0
- package/node_modules/zod/v4/classic/deep-partial.js +13 -0
- package/node_modules/zod/v4/classic/errors.cjs +62 -34
- package/node_modules/zod/v4/classic/errors.d.cts +3 -4
- package/node_modules/zod/v4/classic/errors.d.ts +3 -4
- package/node_modules/zod/v4/classic/errors.js +43 -34
- package/node_modules/zod/v4/classic/external.cjs +51 -27
- package/node_modules/zod/v4/classic/external.d.cts +5 -2
- package/node_modules/zod/v4/classic/external.d.ts +5 -2
- package/node_modules/zod/v4/classic/external.js +5 -8
- package/node_modules/zod/v4/classic/from-json-schema.cjs +376 -75
- package/node_modules/zod/v4/classic/from-json-schema.js +357 -75
- package/node_modules/zod/v4/classic/in-out.cjs +82 -0
- package/node_modules/zod/v4/classic/in-out.d.cts +8 -0
- package/node_modules/zod/v4/classic/in-out.d.ts +8 -0
- package/node_modules/zod/v4/classic/in-out.js +36 -0
- package/node_modules/zod/v4/classic/index.cjs +21 -2
- package/node_modules/zod/v4/classic/index.d.cts +1 -2
- package/node_modules/zod/v4/classic/index.d.ts +1 -2
- package/node_modules/zod/v4/classic/index.js +2 -2
- package/node_modules/zod/v4/classic/iso.cjs +30 -22
- package/node_modules/zod/v4/classic/iso.d.cts +2 -17
- package/node_modules/zod/v4/classic/iso.d.ts +2 -17
- package/node_modules/zod/v4/classic/iso.js +2 -17
- package/node_modules/zod/v4/classic/parse.cjs +23 -1
- package/node_modules/zod/v4/classic/parse.d.cts +17 -4
- package/node_modules/zod/v4/classic/parse.d.ts +17 -4
- package/node_modules/zod/v4/classic/parse.js +1 -0
- package/node_modules/zod/v4/classic/schemas.cjs +591 -426
- package/node_modules/zod/v4/classic/schemas.d.cts +68 -19
- package/node_modules/zod/v4/classic/schemas.d.ts +68 -19
- package/node_modules/zod/v4/classic/schemas.js +564 -424
- package/node_modules/zod/v4/core/api.cjs +66 -24
- package/node_modules/zod/v4/core/api.d.cts +22 -12
- package/node_modules/zod/v4/core/api.d.ts +22 -12
- package/node_modules/zod/v4/core/api.js +44 -24
- package/node_modules/zod/v4/core/checks.cjs +88 -128
- package/node_modules/zod/v4/core/checks.d.cts +29 -13
- package/node_modules/zod/v4/core/checks.d.ts +29 -13
- package/node_modules/zod/v4/core/checks.js +68 -127
- package/node_modules/zod/v4/core/compile.cjs +1916 -0
- package/node_modules/zod/v4/core/compile.d.cts +65 -0
- package/node_modules/zod/v4/core/compile.d.ts +65 -0
- package/node_modules/zod/v4/core/compile.js +1866 -0
- package/node_modules/zod/v4/core/core.cjs +101 -19
- package/node_modules/zod/v4/core/core.d.cts +16 -4
- package/node_modules/zod/v4/core/core.d.ts +16 -4
- package/node_modules/zod/v4/core/core.js +83 -20
- package/node_modules/zod/v4/core/doc.cjs +31 -9
- package/node_modules/zod/v4/core/doc.d.cts +3 -1
- package/node_modules/zod/v4/core/doc.d.ts +3 -1
- package/node_modules/zod/v4/core/doc.js +12 -9
- package/node_modules/zod/v4/core/errors.cjs +126 -25
- package/node_modules/zod/v4/core/errors.d.cts +4 -0
- package/node_modules/zod/v4/core/errors.d.ts +4 -0
- package/node_modules/zod/v4/core/errors.js +107 -25
- package/node_modules/zod/v4/core/index.cjs +24 -1
- package/node_modules/zod/v4/core/index.d.cts +3 -0
- package/node_modules/zod/v4/core/index.d.ts +3 -0
- package/node_modules/zod/v4/core/index.js +3 -0
- package/node_modules/zod/v4/core/json-schema-generator.cjs +24 -1
- package/node_modules/zod/v4/core/json-schema-generator.d.cts +2 -2
- package/node_modules/zod/v4/core/json-schema-generator.d.ts +2 -2
- package/node_modules/zod/v4/core/json-schema-generator.js +6 -2
- package/node_modules/zod/v4/core/json-schema-processors.cjs +441 -156
- 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 +400 -158
- package/node_modules/zod/v4/core/json-schema.cjs +19 -0
- package/node_modules/zod/v4/core/json-schema.d.cts +2 -1
- package/node_modules/zod/v4/core/json-schema.d.ts +2 -1
- package/node_modules/zod/v4/core/memoizer.cjs +360 -0
- package/node_modules/zod/v4/core/memoizer.d.cts +15 -0
- package/node_modules/zod/v4/core/memoizer.d.ts +15 -0
- package/node_modules/zod/v4/core/memoizer.js +311 -0
- package/node_modules/zod/v4/core/parse.cjs +148 -46
- package/node_modules/zod/v4/core/parse.d.cts +14 -11
- package/node_modules/zod/v4/core/parse.d.ts +14 -11
- package/node_modules/zod/v4/core/parse.js +127 -45
- package/node_modules/zod/v4/core/regexes.cjs +54 -17
- package/node_modules/zod/v4/core/regexes.d.cts +5 -0
- package/node_modules/zod/v4/core/regexes.d.ts +5 -0
- package/node_modules/zod/v4/core/regexes.js +32 -15
- package/node_modules/zod/v4/core/registries.cjs +19 -0
- package/node_modules/zod/v4/core/registries.js +2 -2
- package/node_modules/zod/v4/core/schemas.cjs +815 -386
- package/node_modules/zod/v4/core/schemas.d.cts +126 -35
- package/node_modules/zod/v4/core/schemas.d.ts +126 -35
- package/node_modules/zod/v4/core/schemas.js +783 -386
- package/node_modules/zod/v4/core/standard-schema.cjs +19 -0
- package/node_modules/zod/v4/core/to-json-schema.cjs +269 -45
- package/node_modules/zod/v4/core/to-json-schema.d.cts +45 -5
- package/node_modules/zod/v4/core/to-json-schema.d.ts +45 -5
- package/node_modules/zod/v4/core/to-json-schema.js +247 -44
- package/node_modules/zod/v4/core/util.cjs +387 -157
- package/node_modules/zod/v4/core/util.d.cts +81 -1
- package/node_modules/zod/v4/core/util.d.ts +81 -1
- package/node_modules/zod/v4/core/util.js +355 -156
- 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 +214 -0
- package/node_modules/zod/v4/core/visit.d.cts +30 -0
- package/node_modules/zod/v4/core/visit.d.ts +30 -0
- package/node_modules/zod/v4/core/visit.js +169 -0
- package/node_modules/zod/v4/index.cjs +34 -5
- package/node_modules/zod/v4/index.d.cts +2 -2
- package/node_modules/zod/v4/index.d.ts +2 -2
- package/node_modules/zod/v4/index.js +3 -2
- package/node_modules/zod/v4/locales/ar.cjs +5 -0
- package/node_modules/zod/v4/locales/ar.js +5 -0
- package/node_modules/zod/v4/locales/az.cjs +5 -0
- package/node_modules/zod/v4/locales/az.js +5 -0
- package/node_modules/zod/v4/locales/be.cjs +12 -0
- package/node_modules/zod/v4/locales/be.js +12 -0
- package/node_modules/zod/v4/locales/bg.cjs +5 -0
- package/node_modules/zod/v4/locales/bg.js +5 -0
- package/node_modules/zod/v4/locales/bn.cjs +140 -0
- package/node_modules/zod/v4/locales/bn.d.cts +5 -0
- package/node_modules/zod/v4/locales/bn.d.ts +4 -0
- package/node_modules/zod/v4/locales/bn.js +113 -0
- package/node_modules/zod/v4/locales/ca.cjs +5 -0
- package/node_modules/zod/v4/locales/ca.js +5 -0
- package/node_modules/zod/v4/locales/ckb.cjs +160 -0
- package/node_modules/zod/v4/locales/ckb.d.cts +5 -0
- package/node_modules/zod/v4/locales/ckb.d.ts +4 -0
- package/node_modules/zod/v4/locales/ckb.js +133 -0
- package/node_modules/zod/v4/locales/cs.cjs +5 -0
- package/node_modules/zod/v4/locales/cs.js +5 -0
- package/node_modules/zod/v4/locales/da.cjs +7 -2
- package/node_modules/zod/v4/locales/da.js +7 -2
- package/node_modules/zod/v4/locales/de.cjs +5 -0
- package/node_modules/zod/v4/locales/de.js +5 -0
- package/node_modules/zod/v4/locales/el.cjs +3 -0
- package/node_modules/zod/v4/locales/el.js +3 -0
- package/node_modules/zod/v4/locales/en.cjs +16 -4
- package/node_modules/zod/v4/locales/en.js +16 -4
- package/node_modules/zod/v4/locales/eo.cjs +5 -0
- package/node_modules/zod/v4/locales/eo.js +5 -0
- package/node_modules/zod/v4/locales/es.cjs +4 -0
- package/node_modules/zod/v4/locales/es.js +4 -0
- package/node_modules/zod/v4/locales/fa.cjs +5 -0
- package/node_modules/zod/v4/locales/fa.js +5 -0
- package/node_modules/zod/v4/locales/fi.cjs +5 -0
- package/node_modules/zod/v4/locales/fi.js +5 -0
- package/node_modules/zod/v4/locales/fr-CA.cjs +5 -0
- package/node_modules/zod/v4/locales/fr-CA.js +5 -0
- package/node_modules/zod/v4/locales/fr.cjs +18 -14
- package/node_modules/zod/v4/locales/fr.js +18 -14
- package/node_modules/zod/v4/locales/gu.cjs +140 -0
- package/node_modules/zod/v4/locales/gu.d.cts +5 -0
- package/node_modules/zod/v4/locales/gu.d.ts +4 -0
- package/node_modules/zod/v4/locales/gu.js +113 -0
- package/node_modules/zod/v4/locales/he.cjs +7 -0
- package/node_modules/zod/v4/locales/he.js +7 -0
- package/node_modules/zod/v4/locales/hi.cjs +138 -0
- package/node_modules/zod/v4/locales/hi.d.cts +5 -0
- package/node_modules/zod/v4/locales/hi.d.ts +4 -0
- package/node_modules/zod/v4/locales/hi.js +111 -0
- package/node_modules/zod/v4/locales/hr.cjs +4 -0
- package/node_modules/zod/v4/locales/hr.js +4 -0
- package/node_modules/zod/v4/locales/hu.cjs +5 -0
- package/node_modules/zod/v4/locales/hu.js +5 -0
- package/node_modules/zod/v4/locales/hy.cjs +11 -0
- package/node_modules/zod/v4/locales/hy.js +11 -0
- package/node_modules/zod/v4/locales/id.cjs +5 -0
- package/node_modules/zod/v4/locales/id.js +5 -0
- package/node_modules/zod/v4/locales/index.cjs +43 -2
- package/node_modules/zod/v4/locales/index.d.cts +11 -0
- package/node_modules/zod/v4/locales/index.d.ts +11 -0
- package/node_modules/zod/v4/locales/index.js +11 -0
- package/node_modules/zod/v4/locales/is.cjs +5 -0
- package/node_modules/zod/v4/locales/is.js +5 -0
- package/node_modules/zod/v4/locales/it.cjs +5 -0
- package/node_modules/zod/v4/locales/it.js +5 -0
- package/node_modules/zod/v4/locales/ja.cjs +5 -0
- package/node_modules/zod/v4/locales/ja.js +5 -0
- package/node_modules/zod/v4/locales/ka.cjs +5 -0
- package/node_modules/zod/v4/locales/ka.js +5 -0
- package/node_modules/zod/v4/locales/km.cjs +5 -0
- package/node_modules/zod/v4/locales/km.js +5 -0
- package/node_modules/zod/v4/locales/kn.cjs +143 -0
- package/node_modules/zod/v4/locales/kn.d.cts +5 -0
- package/node_modules/zod/v4/locales/kn.d.ts +4 -0
- package/node_modules/zod/v4/locales/kn.js +116 -0
- package/node_modules/zod/v4/locales/ko.cjs +5 -0
- package/node_modules/zod/v4/locales/ko.js +5 -0
- package/node_modules/zod/v4/locales/lt.cjs +4 -0
- package/node_modules/zod/v4/locales/lt.js +4 -0
- package/node_modules/zod/v4/locales/mk.cjs +5 -0
- package/node_modules/zod/v4/locales/mk.js +5 -0
- package/node_modules/zod/v4/locales/ms.cjs +5 -0
- package/node_modules/zod/v4/locales/ms.js +5 -0
- package/node_modules/zod/v4/locales/ne.cjs +138 -0
- package/node_modules/zod/v4/locales/ne.d.cts +5 -0
- package/node_modules/zod/v4/locales/ne.d.ts +4 -0
- package/node_modules/zod/v4/locales/ne.js +111 -0
- package/node_modules/zod/v4/locales/nl.cjs +5 -0
- package/node_modules/zod/v4/locales/nl.js +5 -0
- package/node_modules/zod/v4/locales/nn.cjs +140 -0
- package/node_modules/zod/v4/locales/nn.d.cts +5 -0
- package/node_modules/zod/v4/locales/nn.d.ts +4 -0
- package/node_modules/zod/v4/locales/nn.js +113 -0
- package/node_modules/zod/v4/locales/no.cjs +7 -2
- package/node_modules/zod/v4/locales/no.js +7 -2
- package/node_modules/zod/v4/locales/ota.cjs +5 -0
- package/node_modules/zod/v4/locales/ota.js +5 -0
- package/node_modules/zod/v4/locales/pl.cjs +5 -0
- package/node_modules/zod/v4/locales/pl.js +5 -0
- package/node_modules/zod/v4/locales/ps.cjs +5 -0
- package/node_modules/zod/v4/locales/ps.js +5 -0
- package/node_modules/zod/v4/locales/pt-BR.cjs +170 -0
- package/node_modules/zod/v4/locales/pt-BR.d.cts +5 -0
- package/node_modules/zod/v4/locales/pt-BR.d.ts +4 -0
- package/node_modules/zod/v4/locales/pt-BR.js +143 -0
- package/node_modules/zod/v4/locales/pt.cjs +89 -55
- package/node_modules/zod/v4/locales/pt.js +89 -55
- package/node_modules/zod/v4/locales/ro.cjs +3 -0
- package/node_modules/zod/v4/locales/ro.js +3 -0
- package/node_modules/zod/v4/locales/ru.cjs +12 -0
- package/node_modules/zod/v4/locales/ru.js +12 -0
- package/node_modules/zod/v4/locales/sk.cjs +143 -0
- package/node_modules/zod/v4/locales/sk.d.cts +5 -0
- package/node_modules/zod/v4/locales/sk.d.ts +4 -0
- package/node_modules/zod/v4/locales/sk.js +116 -0
- package/node_modules/zod/v4/locales/sl.cjs +5 -0
- package/node_modules/zod/v4/locales/sl.js +5 -0
- package/node_modules/zod/v4/locales/sv.cjs +7 -2
- package/node_modules/zod/v4/locales/sv.js +7 -2
- package/node_modules/zod/v4/locales/ta.cjs +5 -0
- package/node_modules/zod/v4/locales/ta.js +5 -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 +5 -0
- package/node_modules/zod/v4/locales/th.js +5 -0
- package/node_modules/zod/v4/locales/tk.cjs +134 -0
- package/node_modules/zod/v4/locales/tk.d.cts +5 -0
- package/node_modules/zod/v4/locales/tk.d.ts +4 -0
- package/node_modules/zod/v4/locales/tk.js +107 -0
- package/node_modules/zod/v4/locales/tr.cjs +5 -0
- package/node_modules/zod/v4/locales/tr.js +5 -0
- package/node_modules/zod/v4/locales/uk.cjs +5 -0
- package/node_modules/zod/v4/locales/uk.js +5 -0
- package/node_modules/zod/v4/locales/ur.cjs +5 -0
- package/node_modules/zod/v4/locales/ur.js +5 -0
- package/node_modules/zod/v4/locales/uz.cjs +3 -0
- package/node_modules/zod/v4/locales/uz.js +3 -0
- package/node_modules/zod/v4/locales/vi.cjs +5 -0
- package/node_modules/zod/v4/locales/vi.js +5 -0
- package/node_modules/zod/v4/locales/yo.cjs +5 -0
- package/node_modules/zod/v4/locales/yo.js +5 -0
- package/node_modules/zod/v4/locales/zh-CN.cjs +5 -0
- package/node_modules/zod/v4/locales/zh-CN.js +5 -0
- package/node_modules/zod/v4/locales/zh-TW.cjs +5 -0
- package/node_modules/zod/v4/locales/zh-TW.js +5 -0
- package/node_modules/zod/v4/mini/checks.cjs +21 -1
- package/node_modules/zod/v4/mini/checks.d.cts +1 -1
- package/node_modules/zod/v4/mini/checks.d.ts +1 -1
- package/node_modules/zod/v4/mini/checks.js +1 -1
- package/node_modules/zod/v4/mini/coerce.cjs +19 -0
- package/node_modules/zod/v4/mini/deep-partial.cjs +58 -0
- package/node_modules/zod/v4/mini/deep-partial.d.cts +14 -0
- package/node_modules/zod/v4/mini/deep-partial.d.ts +14 -0
- package/node_modules/zod/v4/mini/deep-partial.js +13 -0
- package/node_modules/zod/v4/mini/external.cjs +33 -1
- package/node_modules/zod/v4/mini/external.d.cts +5 -2
- package/node_modules/zod/v4/mini/external.d.ts +5 -2
- package/node_modules/zod/v4/mini/external.js +3 -1
- package/node_modules/zod/v4/mini/in-out.cjs +82 -0
- package/node_modules/zod/v4/mini/in-out.d.cts +8 -0
- package/node_modules/zod/v4/mini/in-out.d.ts +8 -0
- package/node_modules/zod/v4/mini/in-out.js +36 -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 +22 -1
- package/node_modules/zod/v4/mini/parse.d.cts +1 -1
- package/node_modules/zod/v4/mini/parse.d.ts +1 -1
- package/node_modules/zod/v4/mini/parse.js +1 -1
- package/node_modules/zod/v4/mini/schemas.cjs +117 -53
- package/node_modules/zod/v4/mini/schemas.d.cts +49 -14
- package/node_modules/zod/v4/mini/schemas.d.ts +49 -14
- package/node_modules/zod/v4/mini/schemas.js +92 -51
- package/node_modules/zod/v4-mini/index.cjs +19 -0
- package/package.json +14 -14
- package/node_modules/@zuplo/runtime/out/esm/chunk-DVFQRFED.js.map +0 -1
- package/node_modules/@zuplo/runtime/out/esm/chunk-FQIUJWH2.js +0 -105
- package/node_modules/@zuplo/runtime/out/esm/chunk-FQIUJWH2.js.map +0 -1
- package/node_modules/simple-git/dist/cjs/index.js +0 -4898
- package/node_modules/simple-git/dist/cjs/index.js.map +0 -7
- package/node_modules/simple-git/dist/esm/index.js +0 -4745
- package/node_modules/simple-git/dist/esm/index.js.map +0 -7
- package/node_modules/simple-git/dist/esm/package.json +0 -3
- package/node_modules/simple-git/dist/src/lib/responses/CheckIgnore.d.ts +0 -4
- package/node_modules/simple-git/dist/src/lib/runners/promise-wrapped.d.ts +0 -2
- package/node_modules/simple-git/dist/typings/errors.d.ts +0 -5
- package/node_modules/simple-git/dist/typings/index.d.ts +0 -14
- package/node_modules/simple-git/dist/typings/response.d.ts +0 -556
- package/node_modules/simple-git/dist/typings/simple-git.d.ts +0 -1033
- package/node_modules/simple-git/dist/typings/types.d.ts +0 -22
- package/node_modules/simple-git/promise.js +0 -17
- package/node_modules/zod/src/v4/core/config.ts +0 -15
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-DVFQRFED.js.LEGAL.txt → chunk-NWYAKCSU.js.LEGAL.txt} +0 -0
- /package/node_modules/@zuplo/runtime/out/esm/{chunk-FQIUJWH2.js.LEGAL.txt → chunk-PXS4NOKU.js.LEGAL.txt} +0 -0
|
@@ -23,11 +23,24 @@ 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 = 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
|
+
exports.standardProps = standardProps;
|
|
29
|
+
exports.canParseURL = canParseURL;
|
|
30
|
+
exports.validateURL = validateURL;
|
|
31
|
+
exports.parseURLObject = parseURLObject;
|
|
32
|
+
exports.stripTabAndNewline = stripTabAndNewline;
|
|
33
|
+
exports.urlHostnameOk = urlHostnameOk;
|
|
34
|
+
exports.urlProtocolOk = urlProtocolOk;
|
|
35
|
+
exports.isValidIPv6 = isValidIPv6;
|
|
36
|
+
exports.isValidCIDRv6 = isValidCIDRv6;
|
|
28
37
|
exports.isValidBase64 = isValidBase64;
|
|
29
38
|
exports.isValidBase64URL = isValidBase64URL;
|
|
39
|
+
exports.isValidCreditCard = isValidCreditCard;
|
|
40
|
+
exports.isValidIBAN = isValidIBAN;
|
|
30
41
|
exports.isValidJWT = isValidJWT;
|
|
42
|
+
exports.getDiscriminatedOption = getDiscriminatedOption;
|
|
43
|
+
exports.mergeValues = mergeValues;
|
|
31
44
|
const checks = __importStar(require("./checks.cjs"));
|
|
32
45
|
const core = __importStar(require("./core.cjs"));
|
|
33
46
|
const doc_js_1 = require("./doc.cjs");
|
|
@@ -41,19 +54,20 @@ exports.$ZodType = core.$constructor("$ZodType", (inst, def) => {
|
|
|
41
54
|
inst._zod.def = def; // set _def property
|
|
42
55
|
inst._zod.bag = inst._zod.bag || {}; // initialize _bag object
|
|
43
56
|
inst._zod.version = versions_js_1.version;
|
|
44
|
-
const
|
|
57
|
+
const defChecks = inst._zod.def.checks;
|
|
45
58
|
// if inst is itself a checks.$ZodCheck, run it as a check
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
59
|
+
const checks = inst._zod.traits.has("$ZodCheck")
|
|
60
|
+
? [inst, ...(defChecks ?? [])]
|
|
61
|
+
: defChecks?.length
|
|
62
|
+
? [...defChecks]
|
|
63
|
+
: [];
|
|
49
64
|
for (const ch of checks) {
|
|
50
65
|
for (const fn of ch._zod.onattach) {
|
|
51
66
|
fn(inst);
|
|
52
67
|
}
|
|
53
68
|
}
|
|
54
69
|
if (checks.length === 0) {
|
|
55
|
-
// deferred initializer
|
|
56
|
-
// inst._zod.parse is not yet defined
|
|
70
|
+
// deferred initializer inst._zod.parse is not yet defined
|
|
57
71
|
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
58
72
|
inst._zod.deferred?.push(() => {
|
|
59
73
|
inst._zod.run = inst._zod.parse;
|
|
@@ -61,6 +75,8 @@ exports.$ZodType = core.$constructor("$ZodType", (inst, def) => {
|
|
|
61
75
|
}
|
|
62
76
|
else {
|
|
63
77
|
const runChecks = (payload, checks, ctx) => {
|
|
78
|
+
if (payload.memo)
|
|
79
|
+
return payload;
|
|
64
80
|
let isAborted = util.aborted(payload);
|
|
65
81
|
let asyncResult;
|
|
66
82
|
for (const ch of checks) {
|
|
@@ -85,6 +101,7 @@ exports.$ZodType = core.$constructor("$ZodType", (inst, def) => {
|
|
|
85
101
|
const nextLen = payload.issues.length;
|
|
86
102
|
if (nextLen === currLen)
|
|
87
103
|
return;
|
|
104
|
+
util.attachSchema(payload.issues, currLen, inst);
|
|
88
105
|
if (!isAborted)
|
|
89
106
|
isAborted = util.aborted(payload, currLen);
|
|
90
107
|
});
|
|
@@ -93,6 +110,7 @@ exports.$ZodType = core.$constructor("$ZodType", (inst, def) => {
|
|
|
93
110
|
const nextLen = payload.issues.length;
|
|
94
111
|
if (nextLen === currLen)
|
|
95
112
|
continue;
|
|
113
|
+
util.attachSchema(payload.issues, currLen, inst);
|
|
96
114
|
if (!isAborted)
|
|
97
115
|
isAborted = util.aborted(payload, currLen);
|
|
98
116
|
}
|
|
@@ -124,8 +142,7 @@ exports.$ZodType = core.$constructor("$ZodType", (inst, def) => {
|
|
|
124
142
|
return inst._zod.parse(payload, ctx);
|
|
125
143
|
}
|
|
126
144
|
if (ctx.direction === "backward") {
|
|
127
|
-
// run canary
|
|
128
|
-
// initial pass (no checks)
|
|
145
|
+
// run canary initial pass (no checks)
|
|
129
146
|
const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });
|
|
130
147
|
if (canary instanceof Promise) {
|
|
131
148
|
return canary.then((canary) => {
|
|
@@ -144,26 +161,45 @@ exports.$ZodType = core.$constructor("$ZodType", (inst, def) => {
|
|
|
144
161
|
return runChecks(result, checks, ctx);
|
|
145
162
|
};
|
|
146
163
|
}
|
|
147
|
-
|
|
148
|
-
|
|
164
|
+
}, {
|
|
165
|
+
// Wrappers extend this by installing a richer factory over it; reading it eagerly would defeat the laziness.
|
|
166
|
+
get "~standard"() {
|
|
167
|
+
return util.hide(this, "~standard", standardProps(this));
|
|
168
|
+
},
|
|
169
|
+
set "~standard"(value) {
|
|
170
|
+
util.own(this, "~standard", value);
|
|
171
|
+
},
|
|
172
|
+
});
|
|
173
|
+
/** The Standard Schema surface for `inst`. Shared so wrappers can extend it without forcing it. */
|
|
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
|
+
}
|
|
180
|
+
function standardProps(inst) {
|
|
181
|
+
return {
|
|
149
182
|
validate: (value) => {
|
|
183
|
+
const ctx = { async: false };
|
|
150
184
|
try {
|
|
151
|
-
const r = (
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
catch (_) {
|
|
155
|
-
return (0, parse_js_1.safeParseAsync)(inst, value).then((r) => (r.success ? { value: r.data } : { issues: r.error?.issues }));
|
|
185
|
+
const r = inst._zod.run({ value, issues: [] }, ctx);
|
|
186
|
+
if (!(r instanceof Promise))
|
|
187
|
+
return toStandardResult(r, ctx);
|
|
156
188
|
}
|
|
189
|
+
catch (_) { }
|
|
190
|
+
// async function so a synchronously throwing check rejects instead of escaping validate
|
|
191
|
+
return validateAsync(inst, value);
|
|
157
192
|
},
|
|
158
193
|
vendor: "zod",
|
|
159
194
|
version: 1,
|
|
160
|
-
}
|
|
161
|
-
}
|
|
195
|
+
};
|
|
196
|
+
}
|
|
162
197
|
var util_js_1 = require("./util.cjs");
|
|
163
198
|
Object.defineProperty(exports, "clone", { enumerable: true, get: function () { return util_js_1.clone; } });
|
|
164
199
|
exports.$ZodString = core.$constructor("$ZodString", (inst, def) => {
|
|
165
200
|
exports.$ZodType.init(inst, def);
|
|
166
|
-
|
|
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;
|
|
167
203
|
inst._zod.parse = (payload, _) => {
|
|
168
204
|
if (def.coerce)
|
|
169
205
|
try {
|
|
@@ -215,66 +251,115 @@ exports.$ZodEmail = core.$constructor("$ZodEmail", (inst, def) => {
|
|
|
215
251
|
def.pattern ?? (def.pattern = regexes.email);
|
|
216
252
|
exports.$ZodStringFormat.init(inst, def);
|
|
217
253
|
});
|
|
254
|
+
/** The `://` guard rejected the input before the URL constructor saw it. */
|
|
255
|
+
exports.URL_BAD_FORMAT = 1;
|
|
256
|
+
/** The URL parser rejected the input. */
|
|
257
|
+
exports.URL_UNPARSEABLE = 2;
|
|
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. */
|
|
276
|
+
function parseURLObject(trimmed, def) {
|
|
277
|
+
// When normalize is off, require :// for http/https URLs. This prevents strings like "http:example.com" or "https:/path" from being silently accepted
|
|
278
|
+
if (!def.normalize && def.protocol?.source === regexes.httpProtocol.source && !/^https?:\/\//i.test(trimmed)) {
|
|
279
|
+
return exports.URL_BAD_FORMAT;
|
|
280
|
+
}
|
|
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
|
+
}
|
|
287
|
+
// @ts-ignore
|
|
288
|
+
return new URL(trimmed);
|
|
289
|
+
}
|
|
290
|
+
catch {
|
|
291
|
+
return exports.URL_UNPARSEABLE;
|
|
292
|
+
}
|
|
293
|
+
}
|
|
294
|
+
const asciiTabOrNewline = /[\t\n\r]/g;
|
|
295
|
+
/** The URL parser deletes every ASCII tab, LF and CR from its input before it parses, so `new URL("https://exa\nmple.com")` reports on `example.com`. Applying the same deletion to the returned value closes the half of that divergence which can move the host; the parser's other rewrite, stripping C0 controls at the edges, cannot. */
|
|
296
|
+
function stripTabAndNewline(value) {
|
|
297
|
+
return value.replace(asciiTabOrNewline, "");
|
|
298
|
+
}
|
|
299
|
+
function urlHostnameOk(url, hostname) {
|
|
300
|
+
hostname.lastIndex = 0;
|
|
301
|
+
return hostname.test(url.hostname);
|
|
302
|
+
}
|
|
303
|
+
function urlProtocolOk(url, protocol) {
|
|
304
|
+
protocol.lastIndex = 0;
|
|
305
|
+
return protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol);
|
|
306
|
+
}
|
|
218
307
|
exports.$ZodURL = core.$constructor("$ZodURL", (inst, def) => {
|
|
219
308
|
exports.$ZodStringFormat.init(inst, def);
|
|
220
309
|
inst._zod.check = (payload) => {
|
|
221
310
|
try {
|
|
222
311
|
// Trim whitespace from input
|
|
223
312
|
const trimmed = payload.value.trim();
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
});
|
|
236
|
-
return;
|
|
237
|
-
}
|
|
313
|
+
const url = validateURL(trimmed, def);
|
|
314
|
+
if (url === exports.URL_BAD_FORMAT) {
|
|
315
|
+
payload.issues.push({
|
|
316
|
+
code: "invalid_format",
|
|
317
|
+
format: "url",
|
|
318
|
+
note: "Invalid URL format",
|
|
319
|
+
input: payload.value,
|
|
320
|
+
inst,
|
|
321
|
+
continue: !def.abort,
|
|
322
|
+
});
|
|
323
|
+
return;
|
|
238
324
|
}
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
pattern: def.hostname.source,
|
|
249
|
-
input: payload.value,
|
|
250
|
-
inst,
|
|
251
|
-
continue: !def.abort,
|
|
252
|
-
});
|
|
253
|
-
}
|
|
325
|
+
if (url === exports.URL_UNPARSEABLE) {
|
|
326
|
+
payload.issues.push({
|
|
327
|
+
code: "invalid_format",
|
|
328
|
+
format: "url",
|
|
329
|
+
input: payload.value,
|
|
330
|
+
inst,
|
|
331
|
+
continue: !def.abort,
|
|
332
|
+
});
|
|
333
|
+
return;
|
|
254
334
|
}
|
|
255
|
-
if (
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
payload.issues.push({
|
|
259
|
-
code: "invalid_format",
|
|
260
|
-
format: "url",
|
|
261
|
-
note: "Invalid protocol",
|
|
262
|
-
pattern: def.protocol.source,
|
|
263
|
-
input: payload.value,
|
|
264
|
-
inst,
|
|
265
|
-
continue: !def.abort,
|
|
266
|
-
});
|
|
267
|
-
}
|
|
335
|
+
if (url === true) {
|
|
336
|
+
payload.value = stripTabAndNewline(trimmed);
|
|
337
|
+
return;
|
|
268
338
|
}
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
339
|
+
if (def.hostname && !urlHostnameOk(url, def.hostname)) {
|
|
340
|
+
payload.issues.push({
|
|
341
|
+
code: "invalid_format",
|
|
342
|
+
format: "url",
|
|
343
|
+
note: "Invalid hostname",
|
|
344
|
+
pattern: def.hostname.source,
|
|
345
|
+
input: payload.value,
|
|
346
|
+
inst,
|
|
347
|
+
continue: !def.abort,
|
|
348
|
+
});
|
|
273
349
|
}
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
350
|
+
if (def.protocol && !urlProtocolOk(url, def.protocol)) {
|
|
351
|
+
payload.issues.push({
|
|
352
|
+
code: "invalid_format",
|
|
353
|
+
format: "url",
|
|
354
|
+
note: "Invalid protocol",
|
|
355
|
+
pattern: def.protocol.source,
|
|
356
|
+
input: payload.value,
|
|
357
|
+
inst,
|
|
358
|
+
continue: !def.abort,
|
|
359
|
+
});
|
|
277
360
|
}
|
|
361
|
+
// Set the output value based on normalize flag
|
|
362
|
+
payload.value = def.normalize ? url.href : stripTabAndNewline(trimmed);
|
|
278
363
|
return;
|
|
279
364
|
}
|
|
280
365
|
catch (_) {
|
|
@@ -293,7 +378,9 @@ exports.$ZodEmoji = core.$constructor("$ZodEmoji", (inst, def) => {
|
|
|
293
378
|
exports.$ZodStringFormat.init(inst, def);
|
|
294
379
|
});
|
|
295
380
|
exports.$ZodNanoID = core.$constructor("$ZodNanoID", (inst, def) => {
|
|
296
|
-
def.
|
|
381
|
+
if (def.length !== undefined && (!Number.isInteger(def.length) || def.length < 1))
|
|
382
|
+
throw new Error(`Invalid nanoid length: ${def.length}`);
|
|
383
|
+
def.pattern ?? (def.pattern = def.length === undefined ? regexes.nanoid : regexes.nanoidOfLength(def.length));
|
|
297
384
|
exports.$ZodStringFormat.init(inst, def);
|
|
298
385
|
});
|
|
299
386
|
/**
|
|
@@ -340,19 +427,19 @@ exports.$ZodISODuration = core.$constructor("$ZodISODuration", (inst, def) => {
|
|
|
340
427
|
exports.$ZodIPv4 = core.$constructor("$ZodIPv4", (inst, def) => {
|
|
341
428
|
def.pattern ?? (def.pattern = regexes.ipv4);
|
|
342
429
|
exports.$ZodStringFormat.init(inst, def);
|
|
343
|
-
inst._zod.bag.format = `ipv4`;
|
|
344
430
|
});
|
|
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`. */
|
|
432
|
+
const ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
|
|
433
|
+
function isValidIPv6(value) {
|
|
434
|
+
if (!ipv6Alphabet.test(value))
|
|
435
|
+
return false;
|
|
436
|
+
return canParseURL(`http://[${value}]`);
|
|
437
|
+
}
|
|
345
438
|
exports.$ZodIPv6 = core.$constructor("$ZodIPv6", (inst, def) => {
|
|
346
439
|
def.pattern ?? (def.pattern = regexes.ipv6);
|
|
347
440
|
exports.$ZodStringFormat.init(inst, def);
|
|
348
|
-
inst._zod.bag.format = `ipv6`;
|
|
349
441
|
inst._zod.check = (payload) => {
|
|
350
|
-
|
|
351
|
-
// @ts-ignore
|
|
352
|
-
new URL(`http://[${payload.value}]`);
|
|
353
|
-
// return;
|
|
354
|
-
}
|
|
355
|
-
catch {
|
|
442
|
+
if (!isValidIPv6(payload.value)) {
|
|
356
443
|
payload.issues.push({
|
|
357
444
|
code: "invalid_format",
|
|
358
445
|
format: "ipv6",
|
|
@@ -366,32 +453,30 @@ exports.$ZodIPv6 = core.$constructor("$ZodIPv6", (inst, def) => {
|
|
|
366
453
|
exports.$ZodMAC = core.$constructor("$ZodMAC", (inst, def) => {
|
|
367
454
|
def.pattern ?? (def.pattern = regexes.mac(def.delimiter));
|
|
368
455
|
exports.$ZodStringFormat.init(inst, def);
|
|
369
|
-
inst._zod.bag.format = `mac`;
|
|
370
456
|
});
|
|
371
457
|
exports.$ZodCIDRv4 = core.$constructor("$ZodCIDRv4", (inst, def) => {
|
|
372
458
|
def.pattern ?? (def.pattern = regexes.cidrv4);
|
|
373
459
|
exports.$ZodStringFormat.init(inst, def);
|
|
374
460
|
});
|
|
461
|
+
function isValidCIDRv6(value) {
|
|
462
|
+
const parts = value.split("/");
|
|
463
|
+
if (parts.length !== 2)
|
|
464
|
+
return false;
|
|
465
|
+
const [address, prefix] = parts;
|
|
466
|
+
if (!prefix)
|
|
467
|
+
return false;
|
|
468
|
+
const prefixNum = Number(prefix);
|
|
469
|
+
if (`${prefixNum}` !== prefix)
|
|
470
|
+
return false;
|
|
471
|
+
if (prefixNum < 0 || prefixNum > 128)
|
|
472
|
+
return false;
|
|
473
|
+
return isValidIPv6(address);
|
|
474
|
+
}
|
|
375
475
|
exports.$ZodCIDRv6 = core.$constructor("$ZodCIDRv6", (inst, def) => {
|
|
376
476
|
def.pattern ?? (def.pattern = regexes.cidrv6); // not used for validation
|
|
377
477
|
exports.$ZodStringFormat.init(inst, def);
|
|
378
478
|
inst._zod.check = (payload) => {
|
|
379
|
-
|
|
380
|
-
try {
|
|
381
|
-
if (parts.length !== 2)
|
|
382
|
-
throw new Error();
|
|
383
|
-
const [address, prefix] = parts;
|
|
384
|
-
if (!prefix)
|
|
385
|
-
throw new Error();
|
|
386
|
-
const prefixNum = Number(prefix);
|
|
387
|
-
if (`${prefixNum}` !== prefix)
|
|
388
|
-
throw new Error();
|
|
389
|
-
if (prefixNum < 0 || prefixNum > 128)
|
|
390
|
-
throw new Error();
|
|
391
|
-
// @ts-ignore
|
|
392
|
-
new URL(`http://[${address}]`);
|
|
393
|
-
}
|
|
394
|
-
catch {
|
|
479
|
+
if (!isValidCIDRv6(payload.value)) {
|
|
395
480
|
payload.issues.push({
|
|
396
481
|
code: "invalid_format",
|
|
397
482
|
format: "cidrv6",
|
|
@@ -420,10 +505,11 @@ function isValidBase64(data) {
|
|
|
420
505
|
return false;
|
|
421
506
|
}
|
|
422
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}$/;
|
|
423
510
|
exports.$ZodBase64 = core.$constructor("$ZodBase64", (inst, def) => {
|
|
424
|
-
def.pattern ?? (def.pattern =
|
|
511
|
+
def.pattern ?? (def.pattern = exports.base64Charset);
|
|
425
512
|
exports.$ZodStringFormat.init(inst, def);
|
|
426
|
-
inst._zod.bag.contentEncoding = "base64";
|
|
427
513
|
inst._zod.check = (payload) => {
|
|
428
514
|
if (isValidBase64(payload.value))
|
|
429
515
|
return;
|
|
@@ -436,18 +522,19 @@ exports.$ZodBase64 = core.$constructor("$ZodBase64", (inst, def) => {
|
|
|
436
522
|
});
|
|
437
523
|
};
|
|
438
524
|
});
|
|
439
|
-
//////////////////////////////
|
|
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_-]*$/;
|
|
440
528
|
function isValidBase64URL(data) {
|
|
441
|
-
if (!
|
|
529
|
+
if (!exports.base64urlCharset.test(data))
|
|
442
530
|
return false;
|
|
443
531
|
const base64 = data.replace(/[-_]/g, (c) => (c === "-" ? "+" : "/"));
|
|
444
532
|
const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, "=");
|
|
445
533
|
return isValidBase64(padded);
|
|
446
534
|
}
|
|
447
535
|
exports.$ZodBase64URL = core.$constructor("$ZodBase64URL", (inst, def) => {
|
|
448
|
-
def.pattern ?? (def.pattern =
|
|
536
|
+
def.pattern ?? (def.pattern = exports.base64urlCharset);
|
|
449
537
|
exports.$ZodStringFormat.init(inst, def);
|
|
450
|
-
inst._zod.bag.contentEncoding = "base64url";
|
|
451
538
|
inst._zod.check = (payload) => {
|
|
452
539
|
if (isValidBase64URL(payload.value))
|
|
453
540
|
return;
|
|
@@ -464,6 +551,77 @@ exports.$ZodE164 = core.$constructor("$ZodE164", (inst, def) => {
|
|
|
464
551
|
def.pattern ?? (def.pattern = regexes.e164);
|
|
465
552
|
exports.$ZodStringFormat.init(inst, def);
|
|
466
553
|
});
|
|
554
|
+
////////////////////////////// ZodCreditCard //////////////////////////////
|
|
555
|
+
const CC_SANITIZE = /[- ]/g;
|
|
556
|
+
/** Luhn checksum on a digit-only string. Adapted from valibot (MIT). */
|
|
557
|
+
function isLuhnAlgo(digits) {
|
|
558
|
+
let length = digits.length;
|
|
559
|
+
let bit = 1;
|
|
560
|
+
let sum = 0;
|
|
561
|
+
while (length) {
|
|
562
|
+
const value = digits.charCodeAt(--length) - 48;
|
|
563
|
+
bit ^= 1;
|
|
564
|
+
sum += bit ? [0, 2, 4, 6, 8, 1, 3, 5, 7, 9][value] : value;
|
|
565
|
+
}
|
|
566
|
+
return sum % 10 === 0;
|
|
567
|
+
}
|
|
568
|
+
function isValidCreditCard(input) {
|
|
569
|
+
if (!regexes.creditCard.test(input))
|
|
570
|
+
return false;
|
|
571
|
+
return isLuhnAlgo(input.replace(CC_SANITIZE, ""));
|
|
572
|
+
}
|
|
573
|
+
exports.$ZodCreditCard = core.$constructor("$ZodCreditCard", (inst, def) => {
|
|
574
|
+
// Shape only — the Luhn check below is not expressible as a pattern, so consumers of `pattern` (JSON Schema, template literals) get the length and separator rules alone.
|
|
575
|
+
def.pattern ?? (def.pattern = regexes.creditCard);
|
|
576
|
+
exports.$ZodStringFormat.init(inst, def);
|
|
577
|
+
inst._zod.check = (payload) => {
|
|
578
|
+
if (isValidCreditCard(payload.value))
|
|
579
|
+
return;
|
|
580
|
+
payload.issues.push({
|
|
581
|
+
code: "invalid_format",
|
|
582
|
+
format: "credit_card",
|
|
583
|
+
input: payload.value,
|
|
584
|
+
inst,
|
|
585
|
+
continue: !def.abort,
|
|
586
|
+
});
|
|
587
|
+
};
|
|
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
|
+
});
|
|
467
625
|
////////////////////////////// ZodJWT //////////////////////////////
|
|
468
626
|
function isValidJWT(token, algorithm = null) {
|
|
469
627
|
try {
|
|
@@ -517,7 +675,7 @@ exports.$ZodCustomStringFormat = core.$constructor("$ZodCustomStringFormat", (in
|
|
|
517
675
|
});
|
|
518
676
|
exports.$ZodNumber = core.$constructor("$ZodNumber", (inst, def) => {
|
|
519
677
|
exports.$ZodType.init(inst, def);
|
|
520
|
-
inst._zod.pattern =
|
|
678
|
+
inst._zod.pattern = regexes.number;
|
|
521
679
|
inst._zod.parse = (payload, _ctx) => {
|
|
522
680
|
if (def.coerce)
|
|
523
681
|
try {
|
|
@@ -532,7 +690,7 @@ exports.$ZodNumber = core.$constructor("$ZodNumber", (inst, def) => {
|
|
|
532
690
|
? Number.isNaN(input)
|
|
533
691
|
? "NaN"
|
|
534
692
|
: !Number.isFinite(input)
|
|
535
|
-
?
|
|
693
|
+
? String(input)
|
|
536
694
|
: undefined
|
|
537
695
|
: undefined;
|
|
538
696
|
payload.issues.push({
|
|
@@ -702,6 +860,33 @@ exports.$ZodDate = core.$constructor("$ZodDate", (inst, def) => {
|
|
|
702
860
|
return payload;
|
|
703
861
|
};
|
|
704
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);
|
|
705
890
|
function handleArrayResult(result, final, index) {
|
|
706
891
|
if (result.issues.length) {
|
|
707
892
|
final.issues.push(...util.prefixIssues(index, result.issues));
|
|
@@ -710,6 +895,8 @@ function handleArrayResult(result, final, index) {
|
|
|
710
895
|
}
|
|
711
896
|
exports.$ZodArray = core.$constructor("$ZodArray", (inst, def) => {
|
|
712
897
|
exports.$ZodType.init(inst, def);
|
|
898
|
+
const memo = core.globalConfig.memoizer;
|
|
899
|
+
memo?.attach(inst);
|
|
713
900
|
inst._zod.parse = (payload, ctx) => {
|
|
714
901
|
const input = payload.value;
|
|
715
902
|
if (!Array.isArray(input)) {
|
|
@@ -721,8 +908,9 @@ exports.$ZodArray = core.$constructor("$ZodArray", (inst, def) => {
|
|
|
721
908
|
});
|
|
722
909
|
return payload;
|
|
723
910
|
}
|
|
724
|
-
payload.value = Array(input.length);
|
|
911
|
+
payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
|
|
725
912
|
const proms = [];
|
|
913
|
+
const abortEarly = ctx?.abortEarly;
|
|
726
914
|
for (let i = 0; i < input.length; i++) {
|
|
727
915
|
const item = input[i];
|
|
728
916
|
const result = def.element._zod.run({
|
|
@@ -734,6 +922,9 @@ exports.$ZodArray = core.$constructor("$ZodArray", (inst, def) => {
|
|
|
734
922
|
}
|
|
735
923
|
else {
|
|
736
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;
|
|
737
928
|
}
|
|
738
929
|
}
|
|
739
930
|
if (proms.length) {
|
|
@@ -741,17 +932,23 @@ exports.$ZodArray = core.$constructor("$ZodArray", (inst, def) => {
|
|
|
741
932
|
}
|
|
742
933
|
return payload; //handleArrayResultsAsync(parseResults, final);
|
|
743
934
|
};
|
|
935
|
+
capSize(inst, arraySize);
|
|
744
936
|
});
|
|
745
|
-
function handlePropertyResult(result, final, key, input,
|
|
937
|
+
function handlePropertyResult(result, final, key, input, optin, optout) {
|
|
746
938
|
const isPresent = key in input;
|
|
939
|
+
const isOptionalOut = optout === "optional";
|
|
940
|
+
// The middle rung means "absence permitted, nothing supplied in its place", so an absent key contributes nothing — whatever the schema made of `undefined` is invented, not substituted. Only `optional` reaches this with a value: `defaulted` substitutes, and a schema that isn't optional-out has to keep the key.
|
|
941
|
+
if (!isPresent && isOptionalOut && optin === "optional") {
|
|
942
|
+
return;
|
|
943
|
+
}
|
|
747
944
|
if (result.issues.length) {
|
|
748
945
|
// For optional-in/out schemas, ignore errors on absent keys.
|
|
749
|
-
if (
|
|
946
|
+
if (optin !== undefined && isOptionalOut && !isPresent) {
|
|
750
947
|
return;
|
|
751
948
|
}
|
|
752
949
|
final.issues.push(...util.prefixIssues(key, result.issues));
|
|
753
950
|
}
|
|
754
|
-
if (!isPresent &&
|
|
951
|
+
if (!isPresent && optin === undefined) {
|
|
755
952
|
if (!result.issues.length) {
|
|
756
953
|
final.issues.push({
|
|
757
954
|
code: "invalid_type",
|
|
@@ -763,7 +960,7 @@ function handlePropertyResult(result, final, key, input, isOptionalIn, isOptiona
|
|
|
763
960
|
return;
|
|
764
961
|
}
|
|
765
962
|
if (result.value === undefined) {
|
|
766
|
-
if (isPresent) {
|
|
963
|
+
if (isPresent || (optin === "defaulted" && !isOptionalOut)) {
|
|
767
964
|
final.value[key] = undefined;
|
|
768
965
|
}
|
|
769
966
|
}
|
|
@@ -771,46 +968,64 @@ function handlePropertyResult(result, final, key, input, isOptionalIn, isOptiona
|
|
|
771
968
|
final.value[key] = result.value;
|
|
772
969
|
}
|
|
773
970
|
}
|
|
971
|
+
// one shared instance; a fresh [] per schema cost 56 bytes retained
|
|
972
|
+
const NO_SYMBOL_KEYS = [];
|
|
774
973
|
function normalizeDef(def) {
|
|
775
974
|
const keys = Object.keys(def.shape);
|
|
776
|
-
|
|
975
|
+
const ownSymbols = Object.getOwnPropertySymbols(def.shape);
|
|
976
|
+
const symbolKeys = ownSymbols.length ? ownSymbols : NO_SYMBOL_KEYS;
|
|
977
|
+
// aliases `keys` when there are no symbols, so a string-only shape keeps one array
|
|
978
|
+
const allKeys = symbolKeys.length ? [...keys, ...symbolKeys] : keys;
|
|
979
|
+
for (const k of allKeys) {
|
|
777
980
|
if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) {
|
|
778
|
-
throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
|
|
981
|
+
throw new Error(`Invalid element at key "${String(k)}": expected a Zod schema`);
|
|
779
982
|
}
|
|
780
983
|
}
|
|
781
984
|
const okeys = util.optionalKeys(def.shape);
|
|
782
985
|
return {
|
|
783
986
|
...def,
|
|
784
|
-
|
|
987
|
+
allKeys,
|
|
988
|
+
symbolKeys,
|
|
989
|
+
// string-only: handleCatchall matches it against `for...in`, which never yields a symbol
|
|
785
990
|
keySet: new Set(keys),
|
|
786
991
|
numKeys: keys.length,
|
|
787
992
|
optionalKeys: new Set(okeys),
|
|
788
993
|
};
|
|
789
994
|
}
|
|
790
|
-
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
995
|
+
function handleCatchall(proms, input, payload, ctx, def, inst, abortEarly) {
|
|
791
996
|
const unrecognized = [];
|
|
792
997
|
const keySet = def.keySet;
|
|
793
998
|
const _catchall = def.catchall._zod;
|
|
794
999
|
const t = _catchall.def.type;
|
|
795
|
-
const
|
|
796
|
-
const
|
|
1000
|
+
const optin = _catchall.optin;
|
|
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;
|
|
797
1004
|
for (const key in input) {
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
1005
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
1006
|
+
if (util.aborted(payload, seen))
|
|
1007
|
+
break;
|
|
1008
|
+
seen = payload.issues.length;
|
|
1009
|
+
}
|
|
1010
|
+
// Must precede the __proto__ branch: a declared key is not unrecognized, even though the shape loop deliberately strips __proto__ from the parsed output.
|
|
802
1011
|
if (keySet.has(key))
|
|
803
1012
|
continue;
|
|
1013
|
+
// Don't copy an undeclared __proto__ into the result; assignment to a plain {} would replace the result prototype. But in strict mode it is still an unknown key, so report it before skipping.
|
|
1014
|
+
if (key === "__proto__") {
|
|
1015
|
+
if (t === "never")
|
|
1016
|
+
unrecognized.push(key);
|
|
1017
|
+
continue;
|
|
1018
|
+
}
|
|
804
1019
|
if (t === "never") {
|
|
805
1020
|
unrecognized.push(key);
|
|
806
1021
|
continue;
|
|
807
1022
|
}
|
|
808
1023
|
const r = _catchall.run({ value: input[key], issues: [] }, ctx);
|
|
809
1024
|
if (r instanceof Promise) {
|
|
810
|
-
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input,
|
|
1025
|
+
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
|
|
811
1026
|
}
|
|
812
1027
|
else {
|
|
813
|
-
handlePropertyResult(r, payload, key, input,
|
|
1028
|
+
handlePropertyResult(r, payload, key, input, optin, optout);
|
|
814
1029
|
}
|
|
815
1030
|
}
|
|
816
1031
|
if (unrecognized.length) {
|
|
@@ -819,6 +1034,8 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
819
1034
|
keys: unrecognized,
|
|
820
1035
|
input,
|
|
821
1036
|
inst,
|
|
1037
|
+
// Describes the shape of the input, not the validity of the parsed value, so it never aborts. The parse still fails; the schema's own checks just get to run first, and an enclosing intersection can reconcile the key against a sibling operand.
|
|
1038
|
+
continue: true,
|
|
822
1039
|
});
|
|
823
1040
|
}
|
|
824
1041
|
if (!proms.length)
|
|
@@ -830,30 +1047,35 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
830
1047
|
exports.$ZodObject = core.$constructor("$ZodObject", (inst, def) => {
|
|
831
1048
|
// requires cast because technically $ZodObject doesn't extend
|
|
832
1049
|
exports.$ZodType.init(inst, def);
|
|
833
|
-
// const sh = def.shape;
|
|
834
1050
|
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
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 });
|
|
846
1063
|
}
|
|
847
1064
|
const _normalized = util.cached(() => normalizeDef(def));
|
|
848
|
-
util.
|
|
849
|
-
const shape = def.shape;
|
|
1065
|
+
util.defineLazyInternal(inst, "propValues", (zod) => {
|
|
1066
|
+
const shape = zod.def.shape;
|
|
850
1067
|
const propValues = {};
|
|
851
1068
|
for (const key in shape) {
|
|
852
1069
|
const field = shape[key]._zod;
|
|
853
1070
|
if (field.values) {
|
|
854
|
-
|
|
1071
|
+
if (!Object.prototype.hasOwnProperty.call(propValues, key)) {
|
|
1072
|
+
util.assignProp(propValues, key, new Set());
|
|
1073
|
+
}
|
|
855
1074
|
for (const v of field.values)
|
|
856
1075
|
propValues[key].add(v);
|
|
1076
|
+
// An omittable slot reads back as undefined at a discriminator lookup, so it has to claim undefined: two options that can both omit the key are not discriminable on it.
|
|
1077
|
+
if (field.optin !== undefined)
|
|
1078
|
+
propValues[key].add(undefined);
|
|
857
1079
|
}
|
|
858
1080
|
}
|
|
859
1081
|
return propValues;
|
|
@@ -861,6 +1083,8 @@ exports.$ZodObject = core.$constructor("$ZodObject", (inst, def) => {
|
|
|
861
1083
|
const isObject = util.isObject;
|
|
862
1084
|
const catchall = def.catchall;
|
|
863
1085
|
let value;
|
|
1086
|
+
const memo = core.globalConfig.memoizer;
|
|
1087
|
+
memo?.attach(inst);
|
|
864
1088
|
inst._zod.parse = (payload, ctx) => {
|
|
865
1089
|
value ?? (value = _normalized.value);
|
|
866
1090
|
const input = payload.value;
|
|
@@ -873,25 +1097,34 @@ exports.$ZodObject = core.$constructor("$ZodObject", (inst, def) => {
|
|
|
873
1097
|
});
|
|
874
1098
|
return payload;
|
|
875
1099
|
}
|
|
876
|
-
payload.value = {};
|
|
1100
|
+
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
877
1101
|
const proms = [];
|
|
878
1102
|
const shape = value.shape;
|
|
879
|
-
|
|
1103
|
+
const abortEarly = ctx?.abortEarly;
|
|
1104
|
+
let seen = payload.issues.length;
|
|
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
|
+
}
|
|
1111
|
+
if (key === "__proto__")
|
|
1112
|
+
continue;
|
|
880
1113
|
const el = shape[key];
|
|
881
|
-
const
|
|
882
|
-
const
|
|
1114
|
+
const optin = el._zod.optin;
|
|
1115
|
+
const optout = el._zod.optout;
|
|
883
1116
|
const r = el._zod.run({ value: input[key], issues: [] }, ctx);
|
|
884
1117
|
if (r instanceof Promise) {
|
|
885
|
-
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input,
|
|
1118
|
+
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
|
|
886
1119
|
}
|
|
887
1120
|
else {
|
|
888
|
-
handlePropertyResult(r, payload, key, input,
|
|
1121
|
+
handlePropertyResult(r, payload, key, input, optin, optout);
|
|
889
1122
|
}
|
|
890
1123
|
}
|
|
891
1124
|
if (!catchall) {
|
|
892
1125
|
return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
893
1126
|
}
|
|
894
|
-
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
1127
|
+
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst, abortEarly === true);
|
|
895
1128
|
};
|
|
896
1129
|
});
|
|
897
1130
|
exports.$ZodObjectJIT = core.$constructor("$ZodObjectJIT", (inst, def) => {
|
|
@@ -899,58 +1132,65 @@ exports.$ZodObjectJIT = core.$constructor("$ZodObjectJIT", (inst, def) => {
|
|
|
899
1132
|
exports.$ZodObject.init(inst, def);
|
|
900
1133
|
const superParse = inst._zod.parse;
|
|
901
1134
|
const _normalized = util.cached(() => normalizeDef(def));
|
|
1135
|
+
const memo = core.globalConfig.memoizer;
|
|
902
1136
|
const generateFastpass = (shape) => {
|
|
903
|
-
const doc = new doc_js_1.Doc(["shape", "payload", "ctx"]);
|
|
904
1137
|
const normalized = _normalized.value;
|
|
905
|
-
const
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
}
|
|
1138
|
+
const syms = normalized.symbolKeys;
|
|
1139
|
+
// a symbol has no source literal, so it is read as `syms[i]` off the closed-over scope
|
|
1140
|
+
const doc = new doc_js_1.Doc(["payload", "ctx"], { shape, inst, memo, syms });
|
|
1141
|
+
const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
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
|
|
1143
|
+
const prefixStr = (id, k) => `
|
|
1144
|
+
let ${id}_ab = false;
|
|
1145
|
+
for (let i = 0; i < ${id}.issues.length; i++) {
|
|
1146
|
+
const iss = ${id}.issues[i];
|
|
1147
|
+
iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
|
|
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;
|
|
1154
|
+
}`;
|
|
909
1155
|
doc.write(`const input = payload.value;`);
|
|
910
1156
|
const ids = Object.create(null);
|
|
911
1157
|
let counter = 0;
|
|
912
|
-
for (const key of normalized.
|
|
1158
|
+
for (const key of normalized.allKeys) {
|
|
913
1159
|
ids[key] = `key_${counter++}`;
|
|
914
1160
|
}
|
|
915
1161
|
// A: preserve key order {
|
|
916
|
-
doc.write(`const newResult = {};`);
|
|
917
|
-
for (const key of normalized.
|
|
1162
|
+
doc.write(memo ? `const newResult = memo.alloc(inst, payload, {}, ctx);` : `const newResult = {};`);
|
|
1163
|
+
for (const key of normalized.allKeys) {
|
|
1164
|
+
if (key === "__proto__")
|
|
1165
|
+
continue;
|
|
918
1166
|
const id = ids[key];
|
|
919
|
-
const k = util.esc(key);
|
|
1167
|
+
const k = typeof key === "symbol" ? `syms[${syms.indexOf(key)}]` : util.esc(key);
|
|
1168
|
+
const isPresent = `${k} in input`;
|
|
920
1169
|
const schema = shape[key];
|
|
921
|
-
const
|
|
1170
|
+
const optin = schema?._zod?.optin;
|
|
1171
|
+
const isOptionalIn = optin !== undefined;
|
|
922
1172
|
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
923
|
-
doc.write(`const ${id} = ${parseStr(
|
|
1173
|
+
doc.write(`const ${id} = ${parseStr(k)};`);
|
|
924
1174
|
if (isOptionalIn && isOptionalOut) {
|
|
925
|
-
// For optional-in/out schemas, ignore errors on absent keys
|
|
1175
|
+
// For optional-in/out schemas, ignore errors on absent keys — and, like the interpreted path, drop the value produced alongside them. The middle rung goes further: it permits absence without supplying anything in its place, so an absent key contributes nothing at all.
|
|
1176
|
+
const assign = optin === "optional" ? `${id}_present` : `${id}.value !== undefined || ${id}_present`;
|
|
926
1177
|
doc.write(`
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
...iss,
|
|
931
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
932
|
-
})));
|
|
1178
|
+
const ${id}_present = ${isPresent};
|
|
1179
|
+
if (!${id}.issues.length || ${id}_present) {
|
|
1180
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
933
1181
|
}
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
if (${k} in input) {
|
|
938
|
-
newResult[${k}] = undefined;
|
|
1182
|
+
|
|
1183
|
+
if (${assign}) {
|
|
1184
|
+
newResult[${k}] = ${id}.value;
|
|
939
1185
|
}
|
|
940
|
-
} else {
|
|
941
|
-
newResult[${k}] = ${id}.value;
|
|
942
1186
|
}
|
|
943
|
-
|
|
1187
|
+
|
|
944
1188
|
`);
|
|
945
1189
|
}
|
|
946
1190
|
else if (!isOptionalIn) {
|
|
947
1191
|
doc.write(`
|
|
948
|
-
const ${id}_present = ${
|
|
949
|
-
if (${id}.issues.length) {
|
|
950
|
-
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
951
|
-
...iss,
|
|
952
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
953
|
-
})));
|
|
1192
|
+
const ${id}_present = ${isPresent};
|
|
1193
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
954
1194
|
}
|
|
955
1195
|
if (!${id}_present && !${id}.issues.length) {
|
|
956
1196
|
payload.issues.push({
|
|
@@ -959,42 +1199,39 @@ exports.$ZodObjectJIT = core.$constructor("$ZodObjectJIT", (inst, def) => {
|
|
|
959
1199
|
input: undefined,
|
|
960
1200
|
path: [${k}]
|
|
961
1201
|
});
|
|
1202
|
+
if (ctx && ctx.abortEarly) {
|
|
1203
|
+
payload.value = newResult;
|
|
1204
|
+
return payload;
|
|
1205
|
+
}
|
|
962
1206
|
}
|
|
963
1207
|
|
|
964
1208
|
if (${id}_present) {
|
|
965
|
-
|
|
966
|
-
newResult[${k}] = undefined;
|
|
967
|
-
} else {
|
|
968
|
-
newResult[${k}] = ${id}.value;
|
|
969
|
-
}
|
|
1209
|
+
newResult[${k}] = ${id}.value;
|
|
970
1210
|
}
|
|
971
1211
|
|
|
972
1212
|
`);
|
|
973
1213
|
}
|
|
974
1214
|
else {
|
|
975
1215
|
doc.write(`
|
|
976
|
-
if (${id}.issues.length) {
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
newResult[${k}] = undefined;
|
|
986
|
-
}
|
|
987
|
-
} else {
|
|
1216
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
1217
|
+
}
|
|
1218
|
+
`);
|
|
1219
|
+
if (optin === "defaulted") {
|
|
1220
|
+
doc.write(`newResult[${k}] = ${id}.value;`);
|
|
1221
|
+
}
|
|
1222
|
+
else {
|
|
1223
|
+
doc.write(`
|
|
1224
|
+
if (${id}.value !== undefined || ${isPresent}) {
|
|
988
1225
|
newResult[${k}] = ${id}.value;
|
|
989
1226
|
}
|
|
990
|
-
|
|
991
1227
|
`);
|
|
1228
|
+
}
|
|
992
1229
|
}
|
|
993
1230
|
}
|
|
994
1231
|
doc.write(`payload.value = newResult;`);
|
|
995
1232
|
doc.write(`return payload;`);
|
|
996
|
-
|
|
997
|
-
return (
|
|
1233
|
+
// closing `shape` in is what pays: turbofan specializes the parser against that one shape object, so every `shape[k]._zod.run` folds to a known callee. as a parameter it stays a generic load and measures 13% slower even with the forwarding frame gone
|
|
1234
|
+
return doc.compile();
|
|
998
1235
|
};
|
|
999
1236
|
let fastpass;
|
|
1000
1237
|
const isObject = util.isObject;
|
|
@@ -1022,7 +1259,7 @@ exports.$ZodObjectJIT = core.$constructor("$ZodObjectJIT", (inst, def) => {
|
|
|
1022
1259
|
payload = fastpass(payload, ctx);
|
|
1023
1260
|
if (!catchall)
|
|
1024
1261
|
return payload;
|
|
1025
|
-
return handleCatchall([], input, payload, ctx, value, inst);
|
|
1262
|
+
return handleCatchall([], input, payload, ctx, value, inst, ctx?.abortEarly === true);
|
|
1026
1263
|
}
|
|
1027
1264
|
return superParse(payload, ctx);
|
|
1028
1265
|
};
|
|
@@ -1049,17 +1286,21 @@ function handleUnionResults(results, final, inst, ctx) {
|
|
|
1049
1286
|
}
|
|
1050
1287
|
exports.$ZodUnion = core.$constructor("$ZodUnion", (inst, def) => {
|
|
1051
1288
|
exports.$ZodType.init(inst, def);
|
|
1052
|
-
util.
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1289
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.options.some((o) => o._zod.optin === "defaulted")
|
|
1290
|
+
? "defaulted"
|
|
1291
|
+
: zod.def.options.some((o) => o._zod.optin !== undefined)
|
|
1292
|
+
? "optional"
|
|
1293
|
+
: undefined);
|
|
1294
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.def.options.some((o) => o._zod.optout === "optional") ? "optional" : undefined);
|
|
1295
|
+
util.defineLazyInternal(inst, "values", (zod) => {
|
|
1296
|
+
if (zod.def.options.every((o) => o._zod.values)) {
|
|
1297
|
+
return new Set(zod.def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
1057
1298
|
}
|
|
1058
1299
|
return undefined;
|
|
1059
1300
|
});
|
|
1060
|
-
util.
|
|
1061
|
-
if (def.options.every((o) => o._zod.pattern)) {
|
|
1062
|
-
const patterns = def.options.map((o) => o._zod.pattern);
|
|
1301
|
+
util.defineLazyInternal(inst, "pattern", (zod) => {
|
|
1302
|
+
if (zod.def.options.every((o) => o._zod.pattern)) {
|
|
1303
|
+
const patterns = zod.def.options.map((o) => o._zod.pattern);
|
|
1063
1304
|
return new RegExp(`^(${patterns.map((p) => util.cleanRegex(p.source)).join("|")})$`);
|
|
1064
1305
|
}
|
|
1065
1306
|
return undefined;
|
|
@@ -1094,12 +1335,16 @@ exports.$ZodUnion = core.$constructor("$ZodUnion", (inst, def) => {
|
|
|
1094
1335
|
};
|
|
1095
1336
|
});
|
|
1096
1337
|
function handleExclusiveUnionResults(results, final, inst, ctx) {
|
|
1097
|
-
const
|
|
1098
|
-
|
|
1099
|
-
|
|
1338
|
+
const matches = [];
|
|
1339
|
+
for (let i = 0; i < results.length; i++) {
|
|
1340
|
+
if (results[i].issues.length === 0)
|
|
1341
|
+
matches.push(i);
|
|
1342
|
+
}
|
|
1343
|
+
if (matches.length === 1) {
|
|
1344
|
+
final.value = results[matches[0]].value;
|
|
1100
1345
|
return final;
|
|
1101
1346
|
}
|
|
1102
|
-
if (
|
|
1347
|
+
if (matches.length === 0) {
|
|
1103
1348
|
// No matches - same as regular union
|
|
1104
1349
|
final.issues.push({
|
|
1105
1350
|
code: "invalid_union",
|
|
@@ -1116,6 +1361,7 @@ function handleExclusiveUnionResults(results, final, inst, ctx) {
|
|
|
1116
1361
|
inst,
|
|
1117
1362
|
errors: [],
|
|
1118
1363
|
inclusive: false,
|
|
1364
|
+
matches,
|
|
1119
1365
|
});
|
|
1120
1366
|
}
|
|
1121
1367
|
return final;
|
|
@@ -1150,44 +1396,75 @@ exports.$ZodXor = core.$constructor("$ZodXor", (inst, def) => {
|
|
|
1150
1396
|
});
|
|
1151
1397
|
};
|
|
1152
1398
|
});
|
|
1399
|
+
/** Returns the option whose discriminator claims `value`, or throws if ambiguous. */
|
|
1400
|
+
function getDiscriminatedOption(union, value) {
|
|
1401
|
+
const internals = union._zod;
|
|
1402
|
+
let map = internals.bag.optionsMap;
|
|
1403
|
+
if (!map) {
|
|
1404
|
+
map = discriminatorMap(internals.def);
|
|
1405
|
+
internals.bag.optionsMap = map;
|
|
1406
|
+
}
|
|
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;
|
|
1431
|
+
}
|
|
1153
1432
|
exports.$ZodDiscriminatedUnion =
|
|
1154
1433
|
/*@__PURE__*/
|
|
1155
1434
|
core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
1156
1435
|
def.inclusive = false;
|
|
1157
1436
|
exports.$ZodUnion.init(inst, def);
|
|
1158
1437
|
const _super = inst._zod.parse;
|
|
1159
|
-
util.
|
|
1438
|
+
util.defineLazyInternal(inst, "propValues", (zod) => {
|
|
1160
1439
|
const propValues = {};
|
|
1161
|
-
|
|
1440
|
+
let undefinedCount = 0;
|
|
1441
|
+
for (const option of zod.def.options) {
|
|
1162
1442
|
const pv = option._zod.propValues;
|
|
1163
1443
|
if (!pv || Object.keys(pv).length === 0)
|
|
1164
|
-
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
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++;
|
|
1165
1447
|
for (const [k, v] of Object.entries(pv)) {
|
|
1166
|
-
if (!propValues
|
|
1167
|
-
propValues
|
|
1448
|
+
if (!Object.prototype.hasOwnProperty.call(propValues, k)) {
|
|
1449
|
+
util.assignProp(propValues, k, new Set());
|
|
1450
|
+
}
|
|
1168
1451
|
for (const val of v) {
|
|
1169
1452
|
propValues[k].add(val);
|
|
1170
1453
|
}
|
|
1171
1454
|
}
|
|
1172
1455
|
}
|
|
1456
|
+
if (!zod.def.unionFallback && undefinedCount > 1)
|
|
1457
|
+
propValues[zod.def.discriminator]?.delete(undefined);
|
|
1173
1458
|
return propValues;
|
|
1174
1459
|
});
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
const
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
if (!values || values.size === 0)
|
|
1181
|
-
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
|
|
1182
|
-
for (const v of values) {
|
|
1183
|
-
if (map.has(v)) {
|
|
1184
|
-
throw new Error(`Duplicate discriminator value "${String(v)}"`);
|
|
1185
|
-
}
|
|
1186
|
-
map.set(v, o);
|
|
1187
|
-
}
|
|
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.
|
|
1461
|
+
def.options.forEach((option, i) => {
|
|
1462
|
+
const propShape = util.rawShape(option._zod.def);
|
|
1463
|
+
if (propShape && !Object.prototype.hasOwnProperty.call(propShape, def.discriminator)) {
|
|
1464
|
+
throw new Error(`Invalid discriminated union option at index "${i}"`);
|
|
1188
1465
|
}
|
|
1189
|
-
return map;
|
|
1190
1466
|
});
|
|
1467
|
+
const disc = util.cached(() => discriminatorMap(def));
|
|
1191
1468
|
inst._zod.parse = (payload, ctx) => {
|
|
1192
1469
|
const input = payload.value;
|
|
1193
1470
|
if (!util.isObject(input)) {
|
|
@@ -1199,14 +1476,15 @@ core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
|
1199
1476
|
});
|
|
1200
1477
|
return payload;
|
|
1201
1478
|
}
|
|
1202
|
-
const
|
|
1203
|
-
|
|
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")) {
|
|
1204
1483
|
return opt._zod.run(payload, ctx);
|
|
1205
1484
|
}
|
|
1206
1485
|
// Fall back to union matching when the fast discriminator path fails:
|
|
1207
1486
|
// - explicitly enabled via unionFallback, or
|
|
1208
|
-
// - during backward direction (encode), since codec-based discriminators
|
|
1209
|
-
// have different values in forward vs backward directions
|
|
1487
|
+
// - during backward direction (encode), since codec-based discriminators have different values in forward vs backward directions
|
|
1210
1488
|
if (def.unionFallback || ctx.direction === "backward") {
|
|
1211
1489
|
return _super(payload, ctx);
|
|
1212
1490
|
}
|
|
@@ -1216,7 +1494,7 @@ core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
|
1216
1494
|
errors: [],
|
|
1217
1495
|
note: "No matching discriminator",
|
|
1218
1496
|
discriminator: def.discriminator,
|
|
1219
|
-
options: Array.from(disc.value.keys()),
|
|
1497
|
+
options: Array.from(disc.value.keys()).filter((value) => disc.value.get(value) !== null),
|
|
1220
1498
|
input,
|
|
1221
1499
|
path: [def.discriminator],
|
|
1222
1500
|
inst,
|
|
@@ -1252,7 +1530,11 @@ function mergeValues(a, b) {
|
|
|
1252
1530
|
const bKeys = Object.keys(b);
|
|
1253
1531
|
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
1254
1532
|
const newObj = { ...a, ...b };
|
|
1533
|
+
if (Object.prototype.hasOwnProperty.call(newObj, "__proto__"))
|
|
1534
|
+
delete newObj.__proto__;
|
|
1255
1535
|
for (const key of sharedKeys) {
|
|
1536
|
+
if (key === "__proto__")
|
|
1537
|
+
continue;
|
|
1256
1538
|
const sharedValue = mergeValues(a[key], b[key]);
|
|
1257
1539
|
if (!sharedValue.valid) {
|
|
1258
1540
|
return {
|
|
@@ -1286,43 +1568,55 @@ function mergeValues(a, b) {
|
|
|
1286
1568
|
return { valid: false, mergeErrorPath: [] };
|
|
1287
1569
|
}
|
|
1288
1570
|
function handleIntersectionResults(result, left, right) {
|
|
1289
|
-
// Track which side(s)
|
|
1571
|
+
// Track which side(s) reject each key. A key rejection is reported only when BOTH sides reject it, so a key owned by one branch survives the other's key schema. strictObject reports these as unrecognized_keys; a record with an open key schema reports one invalid_key per key.
|
|
1290
1572
|
const unrecKeys = new Map();
|
|
1291
1573
|
let unrecIssue;
|
|
1292
|
-
|
|
1293
|
-
|
|
1574
|
+
const keyIssues = new Map();
|
|
1575
|
+
const collect = (iss, side) => {
|
|
1576
|
+
let keys;
|
|
1577
|
+
if (iss.code === "unrecognized_keys" && !iss.path?.length) {
|
|
1294
1578
|
unrecIssue ?? (unrecIssue = iss);
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1579
|
+
keys = iss.keys;
|
|
1580
|
+
}
|
|
1581
|
+
else if (iss.code === "invalid_key" && iss.origin === "record" && iss.path?.length === 1) {
|
|
1582
|
+
const k = String(iss.path[0]);
|
|
1583
|
+
if (!keyIssues.has(k))
|
|
1584
|
+
keyIssues.set(k, iss);
|
|
1585
|
+
keys = [k];
|
|
1300
1586
|
}
|
|
1301
1587
|
else {
|
|
1302
|
-
|
|
1588
|
+
return false;
|
|
1589
|
+
}
|
|
1590
|
+
for (const k of keys) {
|
|
1591
|
+
if (!unrecKeys.has(k))
|
|
1592
|
+
unrecKeys.set(k, {});
|
|
1593
|
+
unrecKeys.get(k)[side] = true;
|
|
1303
1594
|
}
|
|
1595
|
+
return true;
|
|
1596
|
+
};
|
|
1597
|
+
for (const iss of left.issues) {
|
|
1598
|
+
if (!collect(iss, "l"))
|
|
1599
|
+
result.issues.push(iss);
|
|
1304
1600
|
}
|
|
1305
1601
|
for (const iss of right.issues) {
|
|
1306
|
-
if (iss
|
|
1307
|
-
for (const k of iss.keys) {
|
|
1308
|
-
if (!unrecKeys.has(k))
|
|
1309
|
-
unrecKeys.set(k, {});
|
|
1310
|
-
unrecKeys.get(k).r = true;
|
|
1311
|
-
}
|
|
1312
|
-
}
|
|
1313
|
-
else {
|
|
1602
|
+
if (!collect(iss, "r"))
|
|
1314
1603
|
result.issues.push(iss);
|
|
1315
|
-
}
|
|
1316
1604
|
}
|
|
1317
|
-
// Report only keys
|
|
1605
|
+
// Report only keys rejected by BOTH sides
|
|
1318
1606
|
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
1319
|
-
if (bothKeys.length
|
|
1320
|
-
|
|
1607
|
+
if (bothKeys.length) {
|
|
1608
|
+
const aggregated = unrecIssue ? bothKeys.filter((k) => unrecIssue.keys.includes(k)) : [];
|
|
1609
|
+
if (aggregated.length)
|
|
1610
|
+
result.issues.push({ ...unrecIssue, keys: aggregated });
|
|
1611
|
+
for (const k of bothKeys) {
|
|
1612
|
+
if (!aggregated.includes(k) && keyIssues.has(k))
|
|
1613
|
+
result.issues.push(keyIssues.get(k));
|
|
1614
|
+
}
|
|
1321
1615
|
}
|
|
1322
|
-
if (util.aborted(result))
|
|
1323
|
-
return result;
|
|
1324
1616
|
const merged = mergeValues(left.value, right.value);
|
|
1325
1617
|
if (!merged.valid) {
|
|
1618
|
+
if (util.aborted(result))
|
|
1619
|
+
return result;
|
|
1326
1620
|
throw new Error(`Unmergable intersection. Error path: ` + `${JSON.stringify(merged.mergeErrorPath)}`);
|
|
1327
1621
|
}
|
|
1328
1622
|
result.value = merged.data;
|
|
@@ -1331,6 +1625,8 @@ function handleIntersectionResults(result, left, right) {
|
|
|
1331
1625
|
exports.$ZodTuple = core.$constructor("$ZodTuple", (inst, def) => {
|
|
1332
1626
|
exports.$ZodType.init(inst, def);
|
|
1333
1627
|
const items = def.items;
|
|
1628
|
+
const memo = core.globalConfig.memoizer;
|
|
1629
|
+
memo?.attach(inst);
|
|
1334
1630
|
inst._zod.parse = (payload, ctx) => {
|
|
1335
1631
|
const input = payload.value;
|
|
1336
1632
|
if (!Array.isArray(input)) {
|
|
@@ -1342,7 +1638,7 @@ exports.$ZodTuple = core.$constructor("$ZodTuple", (inst, def) => {
|
|
|
1342
1638
|
});
|
|
1343
1639
|
return payload;
|
|
1344
1640
|
}
|
|
1345
|
-
payload.value = [];
|
|
1641
|
+
payload.value = memo ? memo.alloc(inst, payload, [], ctx) : [];
|
|
1346
1642
|
const proms = [];
|
|
1347
1643
|
const optinStart = getTupleOptStart(items, "optin");
|
|
1348
1644
|
const optoutStart = getTupleOptStart(items, "optout");
|
|
@@ -1369,11 +1665,11 @@ exports.$ZodTuple = core.$constructor("$ZodTuple", (inst, def) => {
|
|
|
1369
1665
|
});
|
|
1370
1666
|
}
|
|
1371
1667
|
}
|
|
1372
|
-
// Run every item in parallel, collecting results into an indexed
|
|
1373
|
-
// array. The post-processing in `handleTupleResults` walks them in
|
|
1374
|
-
// order so it can decide whether an absent optional-output error can
|
|
1375
|
-
// truncate the tail or must be reported to preserve required output.
|
|
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.
|
|
1376
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;
|
|
1377
1673
|
for (let i = 0; i < items.length; i++) {
|
|
1378
1674
|
const r = items[i]._zod.run({ value: input[i], issues: [] }, ctx);
|
|
1379
1675
|
if (r instanceof Promise) {
|
|
@@ -1383,12 +1679,21 @@ exports.$ZodTuple = core.$constructor("$ZodTuple", (inst, def) => {
|
|
|
1383
1679
|
}
|
|
1384
1680
|
else {
|
|
1385
1681
|
itemResults[i] = r;
|
|
1682
|
+
if (abortEarly && !itemAborted && r.issues.length)
|
|
1683
|
+
itemAborted = util.aborted(r);
|
|
1386
1684
|
}
|
|
1387
1685
|
}
|
|
1388
|
-
|
|
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) {
|
|
1389
1688
|
let i = items.length - 1;
|
|
1390
1689
|
const rest = input.slice(items.length);
|
|
1690
|
+
let seen = payload.issues.length;
|
|
1391
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
|
+
}
|
|
1392
1697
|
i++;
|
|
1393
1698
|
const result = def.rest._zod.run({ value: el, issues: [] }, ctx);
|
|
1394
1699
|
if (result instanceof Promise) {
|
|
@@ -1407,7 +1712,9 @@ exports.$ZodTuple = core.$constructor("$ZodTuple", (inst, def) => {
|
|
|
1407
1712
|
});
|
|
1408
1713
|
function getTupleOptStart(items, key) {
|
|
1409
1714
|
for (let i = items.length - 1; i >= 0; i--) {
|
|
1410
|
-
|
|
1715
|
+
// optin is a three-rung ladder so any rung above `undefined` permits an absent slot; optout stays two-valued.
|
|
1716
|
+
const omittable = key === "optin" ? items[i]._zod.optin !== undefined : items[i]._zod.optout === "optional";
|
|
1717
|
+
if (!omittable)
|
|
1411
1718
|
return i + 1;
|
|
1412
1719
|
}
|
|
1413
1720
|
return 0;
|
|
@@ -1419,12 +1726,15 @@ function handleTupleResult(result, final, index) {
|
|
|
1419
1726
|
final.value[index] = result.value;
|
|
1420
1727
|
}
|
|
1421
1728
|
function handleTupleResults(itemResults, final, items, input, optoutStart) {
|
|
1422
|
-
// Walk results in order. Mirror $ZodObject's swallow-on-absent-optional
|
|
1423
|
-
// rule, but only after `optoutStart`: the first index where the output
|
|
1424
|
-
// tuple tail can be absent.
|
|
1729
|
+
// Walk results in order. Mirror $ZodObject's swallow-on-absent-optional rule, but only after `optoutStart`: the first index where the output tuple tail can be absent.
|
|
1425
1730
|
for (let i = 0; i < items.length; i++) {
|
|
1426
1731
|
const r = itemResults[i];
|
|
1427
1732
|
const isPresent = i < input.length;
|
|
1733
|
+
// The array analog of `handlePropertyResult`'s absent-key early return: the middle rung permits absence without supplying anything in its place, so the tail truncates here instead of materializing whatever the item made of `undefined`.
|
|
1734
|
+
if (!isPresent && i >= optoutStart && items[i]._zod.optin === "optional") {
|
|
1735
|
+
final.value.length = i;
|
|
1736
|
+
break;
|
|
1737
|
+
}
|
|
1428
1738
|
if (r.issues.length) {
|
|
1429
1739
|
if (!isPresent && i >= optoutStart) {
|
|
1430
1740
|
final.value.length = i;
|
|
@@ -1452,6 +1762,8 @@ function handleTupleResults(itemResults, final, items, input, optoutStart) {
|
|
|
1452
1762
|
}
|
|
1453
1763
|
exports.$ZodRecord = core.$constructor("$ZodRecord", (inst, def) => {
|
|
1454
1764
|
exports.$ZodType.init(inst, def);
|
|
1765
|
+
const memo = core.globalConfig.memoizer;
|
|
1766
|
+
memo?.attach(inst);
|
|
1455
1767
|
inst._zod.parse = (payload, ctx) => {
|
|
1456
1768
|
const input = payload.value;
|
|
1457
1769
|
if (!util.isPlainObject(input)) {
|
|
@@ -1463,14 +1775,18 @@ exports.$ZodRecord = core.$constructor("$ZodRecord", (inst, def) => {
|
|
|
1463
1775
|
});
|
|
1464
1776
|
return payload;
|
|
1465
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
|
|
1466
1779
|
const proms = [];
|
|
1467
1780
|
const values = def.keyType._zod.values;
|
|
1468
|
-
if (values) {
|
|
1469
|
-
payload.value = {};
|
|
1781
|
+
if (values && !def.partial) {
|
|
1782
|
+
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
1470
1783
|
const recordKeys = new Set();
|
|
1471
1784
|
for (const key of values) {
|
|
1472
1785
|
if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
1473
1786
|
recordKeys.add(typeof key === "number" ? key.toString() : key);
|
|
1787
|
+
// A declared __proto__ is stripped but is not an unrecognized key.
|
|
1788
|
+
if (key === "__proto__")
|
|
1789
|
+
continue;
|
|
1474
1790
|
const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
1475
1791
|
if (keyResult instanceof Promise) {
|
|
1476
1792
|
throw new Error("Async schemas not supported in object keys currently");
|
|
@@ -1487,6 +1803,8 @@ exports.$ZodRecord = core.$constructor("$ZodRecord", (inst, def) => {
|
|
|
1487
1803
|
continue;
|
|
1488
1804
|
}
|
|
1489
1805
|
const outKey = keyResult.value;
|
|
1806
|
+
if (outKey === "__proto__")
|
|
1807
|
+
continue;
|
|
1490
1808
|
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
1491
1809
|
if (result instanceof Promise) {
|
|
1492
1810
|
proms.push(result.then((result) => {
|
|
@@ -1507,8 +1825,16 @@ exports.$ZodRecord = core.$constructor("$ZodRecord", (inst, def) => {
|
|
|
1507
1825
|
let unrecognized;
|
|
1508
1826
|
for (const key in input) {
|
|
1509
1827
|
if (!recordKeys.has(key)) {
|
|
1510
|
-
|
|
1511
|
-
|
|
1828
|
+
if (def.mode === "loose") {
|
|
1829
|
+
// skip __proto__ so it can't replace the result prototype via the assignment setter on the plain {} we build into
|
|
1830
|
+
if (key === "__proto__")
|
|
1831
|
+
continue;
|
|
1832
|
+
payload.value[key] = input[key];
|
|
1833
|
+
}
|
|
1834
|
+
else {
|
|
1835
|
+
unrecognized = unrecognized ?? [];
|
|
1836
|
+
unrecognized.push(key);
|
|
1837
|
+
}
|
|
1512
1838
|
}
|
|
1513
1839
|
}
|
|
1514
1840
|
if (unrecognized && unrecognized.length > 0) {
|
|
@@ -1517,11 +1843,14 @@ exports.$ZodRecord = core.$constructor("$ZodRecord", (inst, def) => {
|
|
|
1517
1843
|
input,
|
|
1518
1844
|
inst,
|
|
1519
1845
|
keys: unrecognized,
|
|
1846
|
+
continue: true,
|
|
1520
1847
|
});
|
|
1521
1848
|
}
|
|
1522
1849
|
}
|
|
1523
1850
|
else {
|
|
1524
|
-
payload.value = {};
|
|
1851
|
+
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
1852
|
+
// An enumerable key schema declares which keys the record owns, so a key outside the set is unrecognized. A non-enumerable one (regex, refine) is a constraint every key must satisfy, so a failing key is invalid. Only the former is reconcilable against the other side of an intersection.
|
|
1853
|
+
let unrecognized;
|
|
1525
1854
|
// Reflect.ownKeys for Symbol-key support; filter non-enumerable to match z.object()
|
|
1526
1855
|
for (const key of Reflect.ownKeys(input)) {
|
|
1527
1856
|
if (key === "__proto__")
|
|
@@ -1532,8 +1861,7 @@ exports.$ZodRecord = core.$constructor("$ZodRecord", (inst, def) => {
|
|
|
1532
1861
|
if (keyResult instanceof Promise) {
|
|
1533
1862
|
throw new Error("Async schemas not supported in object keys currently");
|
|
1534
1863
|
}
|
|
1535
|
-
// Numeric string fallback: if key is a numeric string and failed, retry with Number(key)
|
|
1536
|
-
// This handles z.number(), z.literal([1, 2, 3]), and unions containing numeric literals
|
|
1864
|
+
// Numeric string fallback: if key is a numeric string and failed, retry with Number(key). This handles z.number(), z.literal([1, 2, 3]), and unions containing numeric literals
|
|
1537
1865
|
const checkNumericKey = typeof key === "string" && regexes.number.test(key) && keyResult.issues.length;
|
|
1538
1866
|
if (checkNumericKey) {
|
|
1539
1867
|
const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
|
|
@@ -1549,6 +1877,10 @@ exports.$ZodRecord = core.$constructor("$ZodRecord", (inst, def) => {
|
|
|
1549
1877
|
// Pass through unchanged
|
|
1550
1878
|
payload.value[key] = input[key];
|
|
1551
1879
|
}
|
|
1880
|
+
else if (values) {
|
|
1881
|
+
unrecognized = unrecognized ?? [];
|
|
1882
|
+
unrecognized.push(key);
|
|
1883
|
+
}
|
|
1552
1884
|
else {
|
|
1553
1885
|
// Default "strict" behavior: error on invalid key
|
|
1554
1886
|
payload.issues.push({
|
|
@@ -1562,22 +1894,35 @@ exports.$ZodRecord = core.$constructor("$ZodRecord", (inst, def) => {
|
|
|
1562
1894
|
}
|
|
1563
1895
|
continue;
|
|
1564
1896
|
}
|
|
1897
|
+
// the guard above tests the raw input key, but the key schema can normalize an ordinary key into __proto__; re-check the key we actually write under
|
|
1898
|
+
const outKey = keyResult.value;
|
|
1899
|
+
if (outKey === "__proto__")
|
|
1900
|
+
continue;
|
|
1565
1901
|
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
1566
1902
|
if (result instanceof Promise) {
|
|
1567
1903
|
proms.push(result.then((result) => {
|
|
1568
1904
|
if (result.issues.length) {
|
|
1569
1905
|
payload.issues.push(...util.prefixIssues(key, result.issues));
|
|
1570
1906
|
}
|
|
1571
|
-
payload.value[
|
|
1907
|
+
payload.value[outKey] = result.value;
|
|
1572
1908
|
}));
|
|
1573
1909
|
}
|
|
1574
1910
|
else {
|
|
1575
1911
|
if (result.issues.length) {
|
|
1576
1912
|
payload.issues.push(...util.prefixIssues(key, result.issues));
|
|
1577
1913
|
}
|
|
1578
|
-
payload.value[
|
|
1914
|
+
payload.value[outKey] = result.value;
|
|
1579
1915
|
}
|
|
1580
1916
|
}
|
|
1917
|
+
if (unrecognized && unrecognized.length > 0) {
|
|
1918
|
+
payload.issues.push({
|
|
1919
|
+
code: "unrecognized_keys",
|
|
1920
|
+
input,
|
|
1921
|
+
inst,
|
|
1922
|
+
keys: unrecognized,
|
|
1923
|
+
continue: true,
|
|
1924
|
+
});
|
|
1925
|
+
}
|
|
1581
1926
|
}
|
|
1582
1927
|
if (proms.length) {
|
|
1583
1928
|
return Promise.all(proms).then(() => payload);
|
|
@@ -1587,6 +1932,8 @@ exports.$ZodRecord = core.$constructor("$ZodRecord", (inst, def) => {
|
|
|
1587
1932
|
});
|
|
1588
1933
|
exports.$ZodMap = core.$constructor("$ZodMap", (inst, def) => {
|
|
1589
1934
|
exports.$ZodType.init(inst, def);
|
|
1935
|
+
const memo = core.globalConfig.memoizer;
|
|
1936
|
+
memo?.attach(inst);
|
|
1590
1937
|
inst._zod.parse = (payload, ctx) => {
|
|
1591
1938
|
const input = payload.value;
|
|
1592
1939
|
if (!(input instanceof Map)) {
|
|
@@ -1599,8 +1946,15 @@ exports.$ZodMap = core.$constructor("$ZodMap", (inst, def) => {
|
|
|
1599
1946
|
return payload;
|
|
1600
1947
|
}
|
|
1601
1948
|
const proms = [];
|
|
1602
|
-
payload.value = new Map();
|
|
1949
|
+
payload.value = memo ? memo.alloc(inst, payload, new Map(), ctx) : new Map();
|
|
1950
|
+
const abortEarly = ctx?.abortEarly;
|
|
1951
|
+
let seen = payload.issues.length;
|
|
1603
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
|
+
}
|
|
1604
1958
|
const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
1605
1959
|
const valueResult = def.valueType._zod.run({ value: value, issues: [] }, ctx);
|
|
1606
1960
|
if (keyResult instanceof Promise || valueResult instanceof Promise) {
|
|
@@ -1616,6 +1970,7 @@ exports.$ZodMap = core.$constructor("$ZodMap", (inst, def) => {
|
|
|
1616
1970
|
return Promise.all(proms).then(() => payload);
|
|
1617
1971
|
return payload;
|
|
1618
1972
|
};
|
|
1973
|
+
capSize(inst, mapSize);
|
|
1619
1974
|
});
|
|
1620
1975
|
function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
1621
1976
|
if (keyResult.issues.length) {
|
|
@@ -1651,6 +2006,8 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
|
1651
2006
|
}
|
|
1652
2007
|
exports.$ZodSet = core.$constructor("$ZodSet", (inst, def) => {
|
|
1653
2008
|
exports.$ZodType.init(inst, def);
|
|
2009
|
+
const memo = core.globalConfig.memoizer;
|
|
2010
|
+
memo?.attach(inst);
|
|
1654
2011
|
inst._zod.parse = (payload, ctx) => {
|
|
1655
2012
|
const input = payload.value;
|
|
1656
2013
|
if (!(input instanceof Set)) {
|
|
@@ -1663,8 +2020,15 @@ exports.$ZodSet = core.$constructor("$ZodSet", (inst, def) => {
|
|
|
1663
2020
|
return payload;
|
|
1664
2021
|
}
|
|
1665
2022
|
const proms = [];
|
|
1666
|
-
payload.value = new Set();
|
|
2023
|
+
payload.value = memo ? memo.alloc(inst, payload, new Set(), ctx) : new Set();
|
|
2024
|
+
const abortEarly = ctx?.abortEarly;
|
|
2025
|
+
let seen = payload.issues.length;
|
|
1667
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
|
+
}
|
|
1668
2032
|
const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
|
|
1669
2033
|
if (result instanceof Promise) {
|
|
1670
2034
|
proms.push(result.then((result) => handleSetResult(result, payload)));
|
|
@@ -1676,6 +2040,7 @@ exports.$ZodSet = core.$constructor("$ZodSet", (inst, def) => {
|
|
|
1676
2040
|
return Promise.all(proms).then(() => payload);
|
|
1677
2041
|
return payload;
|
|
1678
2042
|
};
|
|
2043
|
+
capSize(inst, setSize);
|
|
1679
2044
|
});
|
|
1680
2045
|
function handleSetResult(result, final) {
|
|
1681
2046
|
if (result.issues.length) {
|
|
@@ -1688,10 +2053,11 @@ exports.$ZodEnum = core.$constructor("$ZodEnum", (inst, def) => {
|
|
|
1688
2053
|
const values = util.getEnumValues(def.entries);
|
|
1689
2054
|
const valuesSet = new Set(values);
|
|
1690
2055
|
inst._zod.values = valuesSet;
|
|
1691
|
-
inst
|
|
1692
|
-
.filter((k) => util.propertyKeyTypes.has(typeof k))
|
|
1693
|
-
|
|
1694
|
-
.join("|")})$`);
|
|
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
|
+
});
|
|
1695
2061
|
inst._zod.parse = (payload, _ctx) => {
|
|
1696
2062
|
const input = payload.value;
|
|
1697
2063
|
if (valuesSet.has(input)) {
|
|
@@ -1708,14 +2074,17 @@ exports.$ZodEnum = core.$constructor("$ZodEnum", (inst, def) => {
|
|
|
1708
2074
|
});
|
|
1709
2075
|
exports.$ZodLiteral = core.$constructor("$ZodLiteral", (inst, def) => {
|
|
1710
2076
|
exports.$ZodType.init(inst, def);
|
|
1711
|
-
if (def.values.length === 0) {
|
|
1712
|
-
throw new Error("Cannot create literal schema with no valid values");
|
|
1713
|
-
}
|
|
1714
2077
|
const values = new Set(def.values);
|
|
1715
2078
|
inst._zod.values = values;
|
|
1716
|
-
inst
|
|
1717
|
-
|
|
1718
|
-
|
|
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
|
+
});
|
|
1719
2088
|
inst._zod.parse = (payload, _ctx) => {
|
|
1720
2089
|
const input = payload.value;
|
|
1721
2090
|
if (values.has(input)) {
|
|
@@ -1749,6 +2118,7 @@ exports.$ZodFile = core.$constructor("$ZodFile", (inst, def) => {
|
|
|
1749
2118
|
exports.$ZodTransform = core.$constructor("$ZodTransform", (inst, def) => {
|
|
1750
2119
|
exports.$ZodType.init(inst, def);
|
|
1751
2120
|
inst._zod.optin = "optional";
|
|
2121
|
+
core.globalConfig.memoizer?.guard(inst);
|
|
1752
2122
|
inst._zod.parse = (payload, ctx) => {
|
|
1753
2123
|
if (ctx.direction === "backward") {
|
|
1754
2124
|
throw new core.$ZodEncodeError(inst.constructor.name);
|
|
@@ -1758,7 +2128,6 @@ exports.$ZodTransform = core.$constructor("$ZodTransform", (inst, def) => {
|
|
|
1758
2128
|
const output = _out instanceof Promise ? _out : Promise.resolve(_out);
|
|
1759
2129
|
return output.then((output) => {
|
|
1760
2130
|
payload.value = output;
|
|
1761
|
-
payload.fallback = true;
|
|
1762
2131
|
return payload;
|
|
1763
2132
|
});
|
|
1764
2133
|
}
|
|
@@ -1766,37 +2135,37 @@ exports.$ZodTransform = core.$constructor("$ZodTransform", (inst, def) => {
|
|
|
1766
2135
|
throw new core.$ZodAsyncError();
|
|
1767
2136
|
}
|
|
1768
2137
|
payload.value = _out;
|
|
1769
|
-
payload.fallback = true;
|
|
1770
2138
|
return payload;
|
|
1771
2139
|
};
|
|
1772
2140
|
});
|
|
1773
|
-
function handleOptionalResult(
|
|
1774
|
-
|
|
1775
|
-
|
|
1776
|
-
|
|
1777
|
-
return result;
|
|
2141
|
+
function handleOptionalResult(payload, result) {
|
|
2142
|
+
// A substituting schema that still failed has no usable answer; yield undefined. Its issues are simply dropped: it ran on a payload of its own, so there is no shared array to truncate and nothing of the caller's to lose with it.
|
|
2143
|
+
payload.value = result.issues.length ? undefined : result.value;
|
|
2144
|
+
return payload;
|
|
1778
2145
|
}
|
|
1779
2146
|
exports.$ZodOptional = core.$constructor("$ZodOptional", (inst, def) => {
|
|
1780
2147
|
exports.$ZodType.init(inst, def);
|
|
1781
|
-
|
|
2148
|
+
// .optional() propagates absence rather than substituting for it, so a defaulted inner keeps its rung.
|
|
2149
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
|
|
1782
2150
|
inst._zod.optout = "optional";
|
|
1783
|
-
util.
|
|
1784
|
-
|
|
2151
|
+
util.defineLazyInternal(inst, "values", (zod) => {
|
|
2152
|
+
const values = zod.def.innerType._zod.values;
|
|
2153
|
+
return values ? new Set([...values, undefined]) : undefined;
|
|
1785
2154
|
});
|
|
1786
|
-
util.
|
|
1787
|
-
const pattern = def.innerType._zod.pattern;
|
|
2155
|
+
util.defineLazyInternal(inst, "pattern", (zod) => {
|
|
2156
|
+
const pattern = zod.def.innerType._zod.pattern;
|
|
1788
2157
|
return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)})?$`) : undefined;
|
|
1789
2158
|
});
|
|
1790
2159
|
inst._zod.parse = (payload, ctx) => {
|
|
1791
|
-
if (def.innerType._zod.optin === "optional") {
|
|
1792
|
-
const input = payload.value;
|
|
1793
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
1794
|
-
if (result instanceof Promise)
|
|
1795
|
-
return result.then((r) => handleOptionalResult(r, input));
|
|
1796
|
-
return handleOptionalResult(result, input);
|
|
1797
|
-
}
|
|
1798
2160
|
if (payload.value === undefined) {
|
|
1799
|
-
|
|
2161
|
+
// Only the top rung substitutes a value for absence; everything else leaves it intact, which is what .optional() means.
|
|
2162
|
+
if (def.innerType._zod.optin !== "defaulted")
|
|
2163
|
+
return payload;
|
|
2164
|
+
// Its own payload, for the same reason $ZodCatch gets one: a pipe forwards an unrecognized key through the caller's issues array, and this must not read that as the substituting schema failing and drop it.
|
|
2165
|
+
const result = def.innerType._zod.run({ value: payload.value, issues: [] }, ctx);
|
|
2166
|
+
if (result instanceof Promise)
|
|
2167
|
+
return result.then((result) => handleOptionalResult(payload, result));
|
|
2168
|
+
return handleOptionalResult(payload, result);
|
|
1800
2169
|
}
|
|
1801
2170
|
return def.innerType._zod.run(payload, ctx);
|
|
1802
2171
|
};
|
|
@@ -1805,8 +2174,8 @@ exports.$ZodExactOptional = core.$constructor("$ZodExactOptional", (inst, def) =
|
|
|
1805
2174
|
// Call parent init - inherits optin/optout = "optional"
|
|
1806
2175
|
exports.$ZodOptional.init(inst, def);
|
|
1807
2176
|
// Override values/pattern to NOT add undefined
|
|
1808
|
-
util.
|
|
1809
|
-
util.
|
|
2177
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2178
|
+
util.defineLazyInternal(inst, "pattern", (zod) => zod.def.innerType._zod.pattern);
|
|
1810
2179
|
// Override parse to just delegate (no undefined handling)
|
|
1811
2180
|
inst._zod.parse = (payload, ctx) => {
|
|
1812
2181
|
return def.innerType._zod.run(payload, ctx);
|
|
@@ -1814,14 +2183,14 @@ exports.$ZodExactOptional = core.$constructor("$ZodExactOptional", (inst, def) =
|
|
|
1814
2183
|
});
|
|
1815
2184
|
exports.$ZodNullable = core.$constructor("$ZodNullable", (inst, def) => {
|
|
1816
2185
|
exports.$ZodType.init(inst, def);
|
|
1817
|
-
util.
|
|
1818
|
-
util.
|
|
1819
|
-
util.
|
|
1820
|
-
const pattern = def.innerType._zod.pattern;
|
|
2186
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin);
|
|
2187
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
|
|
2188
|
+
util.defineLazyInternal(inst, "pattern", (zod) => {
|
|
2189
|
+
const pattern = zod.def.innerType._zod.pattern;
|
|
1821
2190
|
return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)}|null)$`) : undefined;
|
|
1822
2191
|
});
|
|
1823
|
-
util.
|
|
1824
|
-
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : undefined;
|
|
2192
|
+
util.defineLazyInternal(inst, "values", (zod) => {
|
|
2193
|
+
return zod.def.innerType._zod.values ? new Set([...zod.def.innerType._zod.values, null]) : undefined;
|
|
1825
2194
|
});
|
|
1826
2195
|
inst._zod.parse = (payload, ctx) => {
|
|
1827
2196
|
// Forward direction (decode): allow null to pass through
|
|
@@ -1833,8 +2202,8 @@ exports.$ZodNullable = core.$constructor("$ZodNullable", (inst, def) => {
|
|
|
1833
2202
|
exports.$ZodDefault = core.$constructor("$ZodDefault", (inst, def) => {
|
|
1834
2203
|
exports.$ZodType.init(inst, def);
|
|
1835
2204
|
// inst._zod.qin = "true";
|
|
1836
|
-
inst._zod.optin = "
|
|
1837
|
-
util.
|
|
2205
|
+
inst._zod.optin = "defaulted";
|
|
2206
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
1838
2207
|
inst._zod.parse = (payload, ctx) => {
|
|
1839
2208
|
if (ctx.direction === "backward") {
|
|
1840
2209
|
return def.innerType._zod.run(payload, ctx);
|
|
@@ -1863,8 +2232,8 @@ function handleDefaultResult(payload, def) {
|
|
|
1863
2232
|
}
|
|
1864
2233
|
exports.$ZodPrefault = core.$constructor("$ZodPrefault", (inst, def) => {
|
|
1865
2234
|
exports.$ZodType.init(inst, def);
|
|
1866
|
-
inst._zod.optin = "
|
|
1867
|
-
util.
|
|
2235
|
+
inst._zod.optin = "defaulted";
|
|
2236
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
1868
2237
|
inst._zod.parse = (payload, ctx) => {
|
|
1869
2238
|
if (ctx.direction === "backward") {
|
|
1870
2239
|
return def.innerType._zod.run(payload, ctx);
|
|
@@ -1878,8 +2247,8 @@ exports.$ZodPrefault = core.$constructor("$ZodPrefault", (inst, def) => {
|
|
|
1878
2247
|
});
|
|
1879
2248
|
exports.$ZodNonOptional = core.$constructor("$ZodNonOptional", (inst, def) => {
|
|
1880
2249
|
exports.$ZodType.init(inst, def);
|
|
1881
|
-
util.
|
|
1882
|
-
const v = def.innerType._zod.values;
|
|
2250
|
+
util.defineLazyInternal(inst, "values", (zod) => {
|
|
2251
|
+
const v = zod.def.innerType._zod.values;
|
|
1883
2252
|
return v ? new Set([...v].filter((x) => x !== undefined)) : undefined;
|
|
1884
2253
|
});
|
|
1885
2254
|
inst._zod.parse = (payload, ctx) => {
|
|
@@ -1918,47 +2287,40 @@ exports.$ZodSuccess = core.$constructor("$ZodSuccess", (inst, def) => {
|
|
|
1918
2287
|
return payload;
|
|
1919
2288
|
};
|
|
1920
2289
|
});
|
|
2290
|
+
function handleCatchResult(payload, result, def, ctx) {
|
|
2291
|
+
if (!result.issues.length) {
|
|
2292
|
+
payload.value = result.value;
|
|
2293
|
+
// The value carries up, so the flag describing it has to carry with it: a back-edge into a node still being parsed must not be frozen by an enclosing readonly, and its checks belong to the node itself. Guarded so the ordinary case adds no own property.
|
|
2294
|
+
if (result.memo)
|
|
2295
|
+
payload.memo = true;
|
|
2296
|
+
return payload;
|
|
2297
|
+
}
|
|
2298
|
+
// Spread the inner's own payload, not ours: `value` has to stay the input the catch was handed, and the inner ran on a payload of its own so its issues are already private to this call.
|
|
2299
|
+
payload.value = def.catchValue({
|
|
2300
|
+
...result,
|
|
2301
|
+
value: payload.value,
|
|
2302
|
+
error: {
|
|
2303
|
+
issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
|
|
2304
|
+
},
|
|
2305
|
+
input: payload.value,
|
|
2306
|
+
});
|
|
2307
|
+
return payload;
|
|
2308
|
+
}
|
|
1921
2309
|
exports.$ZodCatch = core.$constructor("$ZodCatch", (inst, def) => {
|
|
1922
2310
|
exports.$ZodType.init(inst, def);
|
|
1923
|
-
inst._zod.optin
|
|
1924
|
-
util.
|
|
1925
|
-
util.
|
|
2311
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
|
|
2312
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
|
|
2313
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
1926
2314
|
inst._zod.parse = (payload, ctx) => {
|
|
1927
2315
|
if (ctx.direction === "backward") {
|
|
1928
2316
|
return def.innerType._zod.run(payload, ctx);
|
|
1929
2317
|
}
|
|
1930
2318
|
// Forward direction (decode): apply catch logic
|
|
1931
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
2319
|
+
const result = def.innerType._zod.run({ value: payload.value, issues: [] }, ctx);
|
|
1932
2320
|
if (result instanceof Promise) {
|
|
1933
|
-
return result.then((result) =>
|
|
1934
|
-
payload.value = result.value;
|
|
1935
|
-
if (result.issues.length) {
|
|
1936
|
-
payload.value = def.catchValue({
|
|
1937
|
-
...payload,
|
|
1938
|
-
error: {
|
|
1939
|
-
issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
|
|
1940
|
-
},
|
|
1941
|
-
input: payload.value,
|
|
1942
|
-
});
|
|
1943
|
-
payload.issues = [];
|
|
1944
|
-
payload.fallback = true;
|
|
1945
|
-
}
|
|
1946
|
-
return payload;
|
|
1947
|
-
});
|
|
1948
|
-
}
|
|
1949
|
-
payload.value = result.value;
|
|
1950
|
-
if (result.issues.length) {
|
|
1951
|
-
payload.value = def.catchValue({
|
|
1952
|
-
...payload,
|
|
1953
|
-
error: {
|
|
1954
|
-
issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
|
|
1955
|
-
},
|
|
1956
|
-
input: payload.value,
|
|
1957
|
-
});
|
|
1958
|
-
payload.issues = [];
|
|
1959
|
-
payload.fallback = true;
|
|
2321
|
+
return result.then((result) => handleCatchResult(payload, result, def, ctx));
|
|
1960
2322
|
}
|
|
1961
|
-
return payload;
|
|
2323
|
+
return handleCatchResult(payload, result, def, ctx);
|
|
1962
2324
|
};
|
|
1963
2325
|
});
|
|
1964
2326
|
exports.$ZodNaN = core.$constructor("$ZodNaN", (inst, def) => {
|
|
@@ -1978,10 +2340,10 @@ exports.$ZodNaN = core.$constructor("$ZodNaN", (inst, def) => {
|
|
|
1978
2340
|
});
|
|
1979
2341
|
exports.$ZodPipe = core.$constructor("$ZodPipe", (inst, def) => {
|
|
1980
2342
|
exports.$ZodType.init(inst, def);
|
|
1981
|
-
util.
|
|
1982
|
-
util.
|
|
1983
|
-
util.
|
|
1984
|
-
util.
|
|
2343
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.in._zod.values);
|
|
2344
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.in._zod.optin);
|
|
2345
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.def.out._zod.optout);
|
|
2346
|
+
util.defineLazyInternal(inst, "propValues", (zod) => zod.def.in._zod.propValues);
|
|
1985
2347
|
inst._zod.parse = (payload, ctx) => {
|
|
1986
2348
|
if (ctx.direction === "backward") {
|
|
1987
2349
|
const right = def.out._zod.run(payload, ctx);
|
|
@@ -1998,19 +2360,20 @@ exports.$ZodPipe = core.$constructor("$ZodPipe", (inst, def) => {
|
|
|
1998
2360
|
};
|
|
1999
2361
|
});
|
|
2000
2362
|
function handlePipeResult(left, next, ctx) {
|
|
2001
|
-
|
|
2363
|
+
// Any issue stops the pipe, so a failing refinement never feeds its transform. An unrecognized key is the exception: it describes the input's extra properties, not the value being piped, and an enclosing intersection may yet reconcile it.
|
|
2364
|
+
if (left.issues.some((iss) => iss.code !== "unrecognized_keys")) {
|
|
2002
2365
|
// prevent further checks
|
|
2003
2366
|
left.aborted = true;
|
|
2004
2367
|
return left;
|
|
2005
2368
|
}
|
|
2006
|
-
return next._zod.run({ value: left.value, issues: left.issues
|
|
2369
|
+
return next._zod.run({ value: left.value, issues: left.issues }, ctx);
|
|
2007
2370
|
}
|
|
2008
2371
|
exports.$ZodCodec = core.$constructor("$ZodCodec", (inst, def) => {
|
|
2009
2372
|
exports.$ZodType.init(inst, def);
|
|
2010
|
-
util.
|
|
2011
|
-
util.
|
|
2012
|
-
util.
|
|
2013
|
-
util.
|
|
2373
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.in._zod.values);
|
|
2374
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.in._zod.optin);
|
|
2375
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.def.out._zod.optout);
|
|
2376
|
+
util.defineLazyInternal(inst, "propValues", (zod) => zod.def.in._zod.propValues);
|
|
2014
2377
|
inst._zod.parse = (payload, ctx) => {
|
|
2015
2378
|
const direction = ctx.direction || "forward";
|
|
2016
2379
|
if (direction === "forward") {
|
|
@@ -2064,10 +2427,10 @@ exports.$ZodPreprocess = core.$constructor("$ZodPreprocess", (inst, def) => {
|
|
|
2064
2427
|
});
|
|
2065
2428
|
exports.$ZodReadonly = core.$constructor("$ZodReadonly", (inst, def) => {
|
|
2066
2429
|
exports.$ZodType.init(inst, def);
|
|
2067
|
-
util.
|
|
2068
|
-
util.
|
|
2069
|
-
util.
|
|
2070
|
-
util.
|
|
2430
|
+
util.defineLazyInternal(inst, "propValues", (zod) => zod.def.innerType._zod.propValues);
|
|
2431
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2432
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.innerType?._zod?.optin);
|
|
2433
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.def.innerType?._zod?.optout);
|
|
2071
2434
|
inst._zod.parse = (payload, ctx) => {
|
|
2072
2435
|
if (ctx.direction === "backward") {
|
|
2073
2436
|
return def.innerType._zod.run(payload, ctx);
|
|
@@ -2080,25 +2443,72 @@ exports.$ZodReadonly = core.$constructor("$ZodReadonly", (inst, def) => {
|
|
|
2080
2443
|
};
|
|
2081
2444
|
});
|
|
2082
2445
|
function handleReadonlyResult(payload) {
|
|
2083
|
-
|
|
2446
|
+
// A repeat visit hands back a node that is still being built; freezing it here would make the rest of its keys fail to assign.
|
|
2447
|
+
if (!payload.memo)
|
|
2448
|
+
payload.value = Object.freeze(payload.value);
|
|
2084
2449
|
return payload;
|
|
2085
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
|
+
}
|
|
2086
2501
|
exports.$ZodTemplateLiteral = core.$constructor("$ZodTemplateLiteral", (inst, def) => {
|
|
2087
2502
|
exports.$ZodType.init(inst, def);
|
|
2088
2503
|
const regexParts = [];
|
|
2089
2504
|
for (const part of def.parts) {
|
|
2090
2505
|
if (typeof part === "object" && part !== null) {
|
|
2091
2506
|
// is Zod schema
|
|
2092
|
-
|
|
2093
|
-
|
|
2507
|
+
const source = partPattern(part);
|
|
2508
|
+
if (!source) {
|
|
2094
2509
|
throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);
|
|
2095
2510
|
}
|
|
2096
|
-
|
|
2097
|
-
if (!source)
|
|
2098
|
-
throw new Error(`Invalid template literal part: ${part._zod.traits}`);
|
|
2099
|
-
const start = source.startsWith("^") ? 1 : 0;
|
|
2100
|
-
const end = source.endsWith("$") ? source.length - 1 : source.length;
|
|
2101
|
-
regexParts.push(source.slice(start, end));
|
|
2511
|
+
regexParts.push(util.cleanRegex(source));
|
|
2102
2512
|
}
|
|
2103
2513
|
else if (part === null || util.primitiveTypes.has(typeof part)) {
|
|
2104
2514
|
regexParts.push(util.escapeRegex(`${part}`));
|
|
@@ -2134,33 +2544,35 @@ exports.$ZodTemplateLiteral = core.$constructor("$ZodTemplateLiteral", (inst, de
|
|
|
2134
2544
|
});
|
|
2135
2545
|
exports.$ZodFunction = core.$constructor("$ZodFunction", (inst, def) => {
|
|
2136
2546
|
exports.$ZodType.init(inst, def);
|
|
2137
|
-
|
|
2547
|
+
// Defined, not assigned: the classic prototype exposes `_def` as a getter with no setter.
|
|
2548
|
+
Object.defineProperty(inst, "_def", { value: def });
|
|
2138
2549
|
inst._zod.def = def;
|
|
2139
2550
|
inst.implement = (func) => {
|
|
2140
2551
|
if (typeof func !== "function") {
|
|
2141
2552
|
throw new Error("implement() must be called with a function");
|
|
2142
2553
|
}
|
|
2143
|
-
|
|
2554
|
+
// Defined inline so the closure stays anonymous: binding it to a `const` first names it, which costs 256 bytes per implemented function.
|
|
2555
|
+
return Object.defineProperty(function (...args) {
|
|
2144
2556
|
const parsedArgs = inst._def.input ? (0, parse_js_1.parse)(inst._def.input, args) : args;
|
|
2145
2557
|
const result = Reflect.apply(func, this, parsedArgs);
|
|
2146
2558
|
if (inst._def.output) {
|
|
2147
2559
|
return (0, parse_js_1.parse)(inst._def.output, result);
|
|
2148
2560
|
}
|
|
2149
2561
|
return result;
|
|
2150
|
-
};
|
|
2562
|
+
}, "_zod", { value: inst._zod, enumerable: false });
|
|
2151
2563
|
};
|
|
2152
2564
|
inst.implementAsync = (func) => {
|
|
2153
2565
|
if (typeof func !== "function") {
|
|
2154
2566
|
throw new Error("implementAsync() must be called with a function");
|
|
2155
2567
|
}
|
|
2156
|
-
return async function (...args) {
|
|
2568
|
+
return Object.defineProperty(async function (...args) {
|
|
2157
2569
|
const parsedArgs = inst._def.input ? await (0, parse_js_1.parseAsync)(inst._def.input, args) : args;
|
|
2158
2570
|
const result = await Reflect.apply(func, this, parsedArgs);
|
|
2159
2571
|
if (inst._def.output) {
|
|
2160
2572
|
return await (0, parse_js_1.parseAsync)(inst._def.output, result);
|
|
2161
2573
|
}
|
|
2162
2574
|
return result;
|
|
2163
|
-
};
|
|
2575
|
+
}, "_zod", { value: inst._zod, enumerable: false });
|
|
2164
2576
|
};
|
|
2165
2577
|
inst._zod.parse = (payload, _ctx) => {
|
|
2166
2578
|
if (typeof payload.value !== "function") {
|
|
@@ -2219,19 +2631,17 @@ exports.$ZodPromise = core.$constructor("$ZodPromise", (inst, def) => {
|
|
|
2219
2631
|
});
|
|
2220
2632
|
exports.$ZodLazy = core.$constructor("$ZodLazy", (inst, def) => {
|
|
2221
2633
|
exports.$ZodType.init(inst, def);
|
|
2222
|
-
// Cache the resolved inner type on the shared `def` so all clones of this
|
|
2223
|
-
// lazy (e.g. via `.describe()`/`.meta()`) share the same inner instance,
|
|
2224
|
-
// preserving identity for cycle detection on recursive schemas.
|
|
2634
|
+
// Cache the resolved inner type on the shared `def` so all clones of this lazy (e.g. via `.describe()`/`.meta()`) share the same inner instance, preserving identity for cycle detection on recursive schemas.
|
|
2225
2635
|
util.defineLazy(inst._zod, "innerType", () => {
|
|
2226
2636
|
const d = def;
|
|
2227
2637
|
if (!d._cachedInner)
|
|
2228
2638
|
d._cachedInner = def.getter();
|
|
2229
2639
|
return d._cachedInner;
|
|
2230
2640
|
});
|
|
2231
|
-
util.
|
|
2232
|
-
util.
|
|
2233
|
-
util.
|
|
2234
|
-
util.
|
|
2641
|
+
util.defineLazyInternal(inst, "pattern", (zod) => zod.innerType?._zod?.pattern);
|
|
2642
|
+
util.defineLazyInternal(inst, "propValues", (zod) => zod.innerType?._zod?.propValues);
|
|
2643
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.innerType?._zod?.optin ?? undefined);
|
|
2644
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.innerType?._zod?.optout ?? undefined);
|
|
2235
2645
|
inst._zod.parse = (payload, ctx) => {
|
|
2236
2646
|
const inner = inst._zod.innerType;
|
|
2237
2647
|
return inner._zod.run(payload, ctx);
|
|
@@ -2268,3 +2678,22 @@ function handleRefineResult(result, payload, input, inst) {
|
|
|
2268
2678
|
payload.issues.push(util.issue(_iss));
|
|
2269
2679
|
}
|
|
2270
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
|
+
})();
|