@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as checks from "./checks.js";
|
|
2
2
|
import * as core from "./core.js";
|
|
3
3
|
import { Doc } from "./doc.js";
|
|
4
|
-
import { parse, parseAsync
|
|
4
|
+
import { parse, parseAsync } from "./parse.js";
|
|
5
5
|
import * as regexes from "./regexes.js";
|
|
6
6
|
import * as util from "./util.js";
|
|
7
7
|
import { version } from "./versions.js";
|
|
@@ -11,19 +11,20 @@ export const $ZodType = /*@__PURE__*/ core.$constructor("$ZodType", (inst, def)
|
|
|
11
11
|
inst._zod.def = def; // set _def property
|
|
12
12
|
inst._zod.bag = inst._zod.bag || {}; // initialize _bag object
|
|
13
13
|
inst._zod.version = version;
|
|
14
|
-
const
|
|
14
|
+
const defChecks = inst._zod.def.checks;
|
|
15
15
|
// if inst is itself a checks.$ZodCheck, run it as a check
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
const checks = inst._zod.traits.has("$ZodCheck")
|
|
17
|
+
? [inst, ...(defChecks ?? [])]
|
|
18
|
+
: defChecks?.length
|
|
19
|
+
? [...defChecks]
|
|
20
|
+
: [];
|
|
19
21
|
for (const ch of checks) {
|
|
20
22
|
for (const fn of ch._zod.onattach) {
|
|
21
23
|
fn(inst);
|
|
22
24
|
}
|
|
23
25
|
}
|
|
24
26
|
if (checks.length === 0) {
|
|
25
|
-
// deferred initializer
|
|
26
|
-
// inst._zod.parse is not yet defined
|
|
27
|
+
// deferred initializer inst._zod.parse is not yet defined
|
|
27
28
|
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
28
29
|
inst._zod.deferred?.push(() => {
|
|
29
30
|
inst._zod.run = inst._zod.parse;
|
|
@@ -31,6 +32,8 @@ export const $ZodType = /*@__PURE__*/ core.$constructor("$ZodType", (inst, def)
|
|
|
31
32
|
}
|
|
32
33
|
else {
|
|
33
34
|
const runChecks = (payload, checks, ctx) => {
|
|
35
|
+
if (payload.memo)
|
|
36
|
+
return payload;
|
|
34
37
|
let isAborted = util.aborted(payload);
|
|
35
38
|
let asyncResult;
|
|
36
39
|
for (const ch of checks) {
|
|
@@ -55,6 +58,7 @@ export const $ZodType = /*@__PURE__*/ core.$constructor("$ZodType", (inst, def)
|
|
|
55
58
|
const nextLen = payload.issues.length;
|
|
56
59
|
if (nextLen === currLen)
|
|
57
60
|
return;
|
|
61
|
+
util.attachSchema(payload.issues, currLen, inst);
|
|
58
62
|
if (!isAborted)
|
|
59
63
|
isAborted = util.aborted(payload, currLen);
|
|
60
64
|
});
|
|
@@ -63,6 +67,7 @@ export const $ZodType = /*@__PURE__*/ core.$constructor("$ZodType", (inst, def)
|
|
|
63
67
|
const nextLen = payload.issues.length;
|
|
64
68
|
if (nextLen === currLen)
|
|
65
69
|
continue;
|
|
70
|
+
util.attachSchema(payload.issues, currLen, inst);
|
|
66
71
|
if (!isAborted)
|
|
67
72
|
isAborted = util.aborted(payload, currLen);
|
|
68
73
|
}
|
|
@@ -94,8 +99,7 @@ export const $ZodType = /*@__PURE__*/ core.$constructor("$ZodType", (inst, def)
|
|
|
94
99
|
return inst._zod.parse(payload, ctx);
|
|
95
100
|
}
|
|
96
101
|
if (ctx.direction === "backward") {
|
|
97
|
-
// run canary
|
|
98
|
-
// initial pass (no checks)
|
|
102
|
+
// run canary initial pass (no checks)
|
|
99
103
|
const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });
|
|
100
104
|
if (canary instanceof Promise) {
|
|
101
105
|
return canary.then((canary) => {
|
|
@@ -114,25 +118,44 @@ export const $ZodType = /*@__PURE__*/ core.$constructor("$ZodType", (inst, def)
|
|
|
114
118
|
return runChecks(result, checks, ctx);
|
|
115
119
|
};
|
|
116
120
|
}
|
|
117
|
-
|
|
118
|
-
|
|
121
|
+
}, {
|
|
122
|
+
// Wrappers extend this by installing a richer factory over it; reading it eagerly would defeat the laziness.
|
|
123
|
+
get "~standard"() {
|
|
124
|
+
return util.hide(this, "~standard", standardProps(this));
|
|
125
|
+
},
|
|
126
|
+
set "~standard"(value) {
|
|
127
|
+
util.own(this, "~standard", value);
|
|
128
|
+
},
|
|
129
|
+
});
|
|
130
|
+
/** The Standard Schema surface for `inst`. Shared so wrappers can extend it without forcing it. */
|
|
131
|
+
// 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
|
|
132
|
+
const toStandardResult = (r, ctx) => r.issues.length ? { issues: r.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())) } : { value: r.value };
|
|
133
|
+
async function validateAsync(inst, value) {
|
|
134
|
+
const ctx = { async: true };
|
|
135
|
+
return toStandardResult((await inst._zod.run({ value, issues: [] }, ctx)), ctx);
|
|
136
|
+
}
|
|
137
|
+
export function standardProps(inst) {
|
|
138
|
+
return {
|
|
119
139
|
validate: (value) => {
|
|
140
|
+
const ctx = { async: false };
|
|
120
141
|
try {
|
|
121
|
-
const r =
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
catch (_) {
|
|
125
|
-
return safeParseAsync(inst, value).then((r) => (r.success ? { value: r.data } : { issues: r.error?.issues }));
|
|
142
|
+
const r = inst._zod.run({ value, issues: [] }, ctx);
|
|
143
|
+
if (!(r instanceof Promise))
|
|
144
|
+
return toStandardResult(r, ctx);
|
|
126
145
|
}
|
|
146
|
+
catch (_) { }
|
|
147
|
+
// async function so a synchronously throwing check rejects instead of escaping validate
|
|
148
|
+
return validateAsync(inst, value);
|
|
127
149
|
},
|
|
128
150
|
vendor: "zod",
|
|
129
151
|
version: 1,
|
|
130
|
-
}
|
|
131
|
-
}
|
|
152
|
+
};
|
|
153
|
+
}
|
|
132
154
|
export { clone } from "./util.js";
|
|
133
155
|
export const $ZodString = /*@__PURE__*/ core.$constructor("$ZodString", (inst, def) => {
|
|
134
156
|
$ZodType.init(inst, def);
|
|
135
|
-
|
|
157
|
+
// a format's own pattern, else unbounded; a template literal derives the check-aware form itself
|
|
158
|
+
inst._zod.pattern = def.pattern ?? regexes.anyString;
|
|
136
159
|
inst._zod.parse = (payload, _) => {
|
|
137
160
|
if (def.coerce)
|
|
138
161
|
try {
|
|
@@ -184,66 +207,115 @@ export const $ZodEmail = /*@__PURE__*/ core.$constructor("$ZodEmail", (inst, def
|
|
|
184
207
|
def.pattern ?? (def.pattern = regexes.email);
|
|
185
208
|
$ZodStringFormat.init(inst, def);
|
|
186
209
|
});
|
|
210
|
+
/** The `://` guard rejected the input before the URL constructor saw it. */
|
|
211
|
+
export const URL_BAD_FORMAT = 1;
|
|
212
|
+
/** The URL parser rejected the input. */
|
|
213
|
+
export const URL_UNPARSEABLE = 2;
|
|
214
|
+
export function canParseURL(input) {
|
|
215
|
+
try {
|
|
216
|
+
if (typeof URL !== "undefined" && typeof URL.canParse === "function")
|
|
217
|
+
return URL.canParse(input);
|
|
218
|
+
new URL(input);
|
|
219
|
+
return true;
|
|
220
|
+
}
|
|
221
|
+
catch {
|
|
222
|
+
return false;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
export function validateURL(trimmed, def) {
|
|
226
|
+
if (!("normalize" in def) && !("hostname" in def) && !("protocol" in def)) {
|
|
227
|
+
return canParseURL(trimmed) || URL_UNPARSEABLE;
|
|
228
|
+
}
|
|
229
|
+
return parseURLObject(trimmed, def);
|
|
230
|
+
}
|
|
231
|
+
/** Parses a URL while preserving the non-normalizing HTTP guard. */
|
|
232
|
+
export function parseURLObject(trimmed, def) {
|
|
233
|
+
// When normalize is off, require :// for http/https URLs. This prevents strings like "http:example.com" or "https:/path" from being silently accepted
|
|
234
|
+
if (!def.normalize && def.protocol?.source === regexes.httpProtocol.source && !/^https?:\/\//i.test(trimmed)) {
|
|
235
|
+
return URL_BAD_FORMAT;
|
|
236
|
+
}
|
|
237
|
+
try {
|
|
238
|
+
if (typeof URL !== "undefined") {
|
|
239
|
+
const URLStatic = URL;
|
|
240
|
+
if (typeof URLStatic.parse === "function")
|
|
241
|
+
return URLStatic.parse(trimmed) ?? URL_UNPARSEABLE;
|
|
242
|
+
}
|
|
243
|
+
// @ts-ignore
|
|
244
|
+
return new URL(trimmed);
|
|
245
|
+
}
|
|
246
|
+
catch {
|
|
247
|
+
return URL_UNPARSEABLE;
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
const asciiTabOrNewline = /[\t\n\r]/g;
|
|
251
|
+
/** 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. */
|
|
252
|
+
export function stripTabAndNewline(value) {
|
|
253
|
+
return value.replace(asciiTabOrNewline, "");
|
|
254
|
+
}
|
|
255
|
+
export function urlHostnameOk(url, hostname) {
|
|
256
|
+
hostname.lastIndex = 0;
|
|
257
|
+
return hostname.test(url.hostname);
|
|
258
|
+
}
|
|
259
|
+
export function urlProtocolOk(url, protocol) {
|
|
260
|
+
protocol.lastIndex = 0;
|
|
261
|
+
return protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol);
|
|
262
|
+
}
|
|
187
263
|
export const $ZodURL = /*@__PURE__*/ core.$constructor("$ZodURL", (inst, def) => {
|
|
188
264
|
$ZodStringFormat.init(inst, def);
|
|
189
265
|
inst._zod.check = (payload) => {
|
|
190
266
|
try {
|
|
191
267
|
// Trim whitespace from input
|
|
192
268
|
const trimmed = payload.value.trim();
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
});
|
|
205
|
-
return;
|
|
206
|
-
}
|
|
269
|
+
const url = validateURL(trimmed, def);
|
|
270
|
+
if (url === URL_BAD_FORMAT) {
|
|
271
|
+
payload.issues.push({
|
|
272
|
+
code: "invalid_format",
|
|
273
|
+
format: "url",
|
|
274
|
+
note: "Invalid URL format",
|
|
275
|
+
input: payload.value,
|
|
276
|
+
inst,
|
|
277
|
+
continue: !def.abort,
|
|
278
|
+
});
|
|
279
|
+
return;
|
|
207
280
|
}
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
pattern: def.hostname.source,
|
|
218
|
-
input: payload.value,
|
|
219
|
-
inst,
|
|
220
|
-
continue: !def.abort,
|
|
221
|
-
});
|
|
222
|
-
}
|
|
281
|
+
if (url === URL_UNPARSEABLE) {
|
|
282
|
+
payload.issues.push({
|
|
283
|
+
code: "invalid_format",
|
|
284
|
+
format: "url",
|
|
285
|
+
input: payload.value,
|
|
286
|
+
inst,
|
|
287
|
+
continue: !def.abort,
|
|
288
|
+
});
|
|
289
|
+
return;
|
|
223
290
|
}
|
|
224
|
-
if (
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
payload.issues.push({
|
|
228
|
-
code: "invalid_format",
|
|
229
|
-
format: "url",
|
|
230
|
-
note: "Invalid protocol",
|
|
231
|
-
pattern: def.protocol.source,
|
|
232
|
-
input: payload.value,
|
|
233
|
-
inst,
|
|
234
|
-
continue: !def.abort,
|
|
235
|
-
});
|
|
236
|
-
}
|
|
291
|
+
if (url === true) {
|
|
292
|
+
payload.value = stripTabAndNewline(trimmed);
|
|
293
|
+
return;
|
|
237
294
|
}
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
295
|
+
if (def.hostname && !urlHostnameOk(url, def.hostname)) {
|
|
296
|
+
payload.issues.push({
|
|
297
|
+
code: "invalid_format",
|
|
298
|
+
format: "url",
|
|
299
|
+
note: "Invalid hostname",
|
|
300
|
+
pattern: def.hostname.source,
|
|
301
|
+
input: payload.value,
|
|
302
|
+
inst,
|
|
303
|
+
continue: !def.abort,
|
|
304
|
+
});
|
|
242
305
|
}
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
306
|
+
if (def.protocol && !urlProtocolOk(url, def.protocol)) {
|
|
307
|
+
payload.issues.push({
|
|
308
|
+
code: "invalid_format",
|
|
309
|
+
format: "url",
|
|
310
|
+
note: "Invalid protocol",
|
|
311
|
+
pattern: def.protocol.source,
|
|
312
|
+
input: payload.value,
|
|
313
|
+
inst,
|
|
314
|
+
continue: !def.abort,
|
|
315
|
+
});
|
|
246
316
|
}
|
|
317
|
+
// Set the output value based on normalize flag
|
|
318
|
+
payload.value = def.normalize ? url.href : stripTabAndNewline(trimmed);
|
|
247
319
|
return;
|
|
248
320
|
}
|
|
249
321
|
catch (_) {
|
|
@@ -262,7 +334,9 @@ export const $ZodEmoji = /*@__PURE__*/ core.$constructor("$ZodEmoji", (inst, def
|
|
|
262
334
|
$ZodStringFormat.init(inst, def);
|
|
263
335
|
});
|
|
264
336
|
export const $ZodNanoID = /*@__PURE__*/ core.$constructor("$ZodNanoID", (inst, def) => {
|
|
265
|
-
def.
|
|
337
|
+
if (def.length !== undefined && (!Number.isInteger(def.length) || def.length < 1))
|
|
338
|
+
throw new Error(`Invalid nanoid length: ${def.length}`);
|
|
339
|
+
def.pattern ?? (def.pattern = def.length === undefined ? regexes.nanoid : regexes.nanoidOfLength(def.length));
|
|
266
340
|
$ZodStringFormat.init(inst, def);
|
|
267
341
|
});
|
|
268
342
|
/**
|
|
@@ -309,19 +383,19 @@ export const $ZodISODuration = /*@__PURE__*/ core.$constructor("$ZodISODuration"
|
|
|
309
383
|
export const $ZodIPv4 = /*@__PURE__*/ core.$constructor("$ZodIPv4", (inst, def) => {
|
|
310
384
|
def.pattern ?? (def.pattern = regexes.ipv4);
|
|
311
385
|
$ZodStringFormat.init(inst, def);
|
|
312
|
-
inst._zod.bag.format = `ipv4`;
|
|
313
386
|
});
|
|
387
|
+
/** 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`. */
|
|
388
|
+
const ipv6Alphabet = /^[0-9a-fA-F:.]+$/;
|
|
389
|
+
export function isValidIPv6(value) {
|
|
390
|
+
if (!ipv6Alphabet.test(value))
|
|
391
|
+
return false;
|
|
392
|
+
return canParseURL(`http://[${value}]`);
|
|
393
|
+
}
|
|
314
394
|
export const $ZodIPv6 = /*@__PURE__*/ core.$constructor("$ZodIPv6", (inst, def) => {
|
|
315
395
|
def.pattern ?? (def.pattern = regexes.ipv6);
|
|
316
396
|
$ZodStringFormat.init(inst, def);
|
|
317
|
-
inst._zod.bag.format = `ipv6`;
|
|
318
397
|
inst._zod.check = (payload) => {
|
|
319
|
-
|
|
320
|
-
// @ts-ignore
|
|
321
|
-
new URL(`http://[${payload.value}]`);
|
|
322
|
-
// return;
|
|
323
|
-
}
|
|
324
|
-
catch {
|
|
398
|
+
if (!isValidIPv6(payload.value)) {
|
|
325
399
|
payload.issues.push({
|
|
326
400
|
code: "invalid_format",
|
|
327
401
|
format: "ipv6",
|
|
@@ -335,32 +409,30 @@ export const $ZodIPv6 = /*@__PURE__*/ core.$constructor("$ZodIPv6", (inst, def)
|
|
|
335
409
|
export const $ZodMAC = /*@__PURE__*/ core.$constructor("$ZodMAC", (inst, def) => {
|
|
336
410
|
def.pattern ?? (def.pattern = regexes.mac(def.delimiter));
|
|
337
411
|
$ZodStringFormat.init(inst, def);
|
|
338
|
-
inst._zod.bag.format = `mac`;
|
|
339
412
|
});
|
|
340
413
|
export const $ZodCIDRv4 = /*@__PURE__*/ core.$constructor("$ZodCIDRv4", (inst, def) => {
|
|
341
414
|
def.pattern ?? (def.pattern = regexes.cidrv4);
|
|
342
415
|
$ZodStringFormat.init(inst, def);
|
|
343
416
|
});
|
|
417
|
+
export function isValidCIDRv6(value) {
|
|
418
|
+
const parts = value.split("/");
|
|
419
|
+
if (parts.length !== 2)
|
|
420
|
+
return false;
|
|
421
|
+
const [address, prefix] = parts;
|
|
422
|
+
if (!prefix)
|
|
423
|
+
return false;
|
|
424
|
+
const prefixNum = Number(prefix);
|
|
425
|
+
if (`${prefixNum}` !== prefix)
|
|
426
|
+
return false;
|
|
427
|
+
if (prefixNum < 0 || prefixNum > 128)
|
|
428
|
+
return false;
|
|
429
|
+
return isValidIPv6(address);
|
|
430
|
+
}
|
|
344
431
|
export const $ZodCIDRv6 = /*@__PURE__*/ core.$constructor("$ZodCIDRv6", (inst, def) => {
|
|
345
432
|
def.pattern ?? (def.pattern = regexes.cidrv6); // not used for validation
|
|
346
433
|
$ZodStringFormat.init(inst, def);
|
|
347
434
|
inst._zod.check = (payload) => {
|
|
348
|
-
|
|
349
|
-
try {
|
|
350
|
-
if (parts.length !== 2)
|
|
351
|
-
throw new Error();
|
|
352
|
-
const [address, prefix] = parts;
|
|
353
|
-
if (!prefix)
|
|
354
|
-
throw new Error();
|
|
355
|
-
const prefixNum = Number(prefix);
|
|
356
|
-
if (`${prefixNum}` !== prefix)
|
|
357
|
-
throw new Error();
|
|
358
|
-
if (prefixNum < 0 || prefixNum > 128)
|
|
359
|
-
throw new Error();
|
|
360
|
-
// @ts-ignore
|
|
361
|
-
new URL(`http://[${address}]`);
|
|
362
|
-
}
|
|
363
|
-
catch {
|
|
435
|
+
if (!isValidCIDRv6(payload.value)) {
|
|
364
436
|
payload.issues.push({
|
|
365
437
|
code: "invalid_format",
|
|
366
438
|
format: "cidrv6",
|
|
@@ -389,10 +461,11 @@ export function isValidBase64(data) {
|
|
|
389
461
|
return false;
|
|
390
462
|
}
|
|
391
463
|
}
|
|
464
|
+
// 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
|
|
465
|
+
export const base64Charset = /^[0-9a-zA-Z+/]*={0,2}$/;
|
|
392
466
|
export const $ZodBase64 = /*@__PURE__*/ core.$constructor("$ZodBase64", (inst, def) => {
|
|
393
|
-
def.pattern ?? (def.pattern =
|
|
467
|
+
def.pattern ?? (def.pattern = base64Charset);
|
|
394
468
|
$ZodStringFormat.init(inst, def);
|
|
395
|
-
inst._zod.bag.contentEncoding = "base64";
|
|
396
469
|
inst._zod.check = (payload) => {
|
|
397
470
|
if (isValidBase64(payload.value))
|
|
398
471
|
return;
|
|
@@ -405,18 +478,19 @@ export const $ZodBase64 = /*@__PURE__*/ core.$constructor("$ZodBase64", (inst, d
|
|
|
405
478
|
});
|
|
406
479
|
};
|
|
407
480
|
});
|
|
408
|
-
//////////////////////////////
|
|
481
|
+
////////////////////////////// ZodBase64URL //////////////////////////////
|
|
482
|
+
// lax on purpose: the quantified regexes.base64url overflows the regex stack on multi-MB input; isValidBase64 enforces length on the padded string
|
|
483
|
+
export const base64urlCharset = /^[A-Za-z0-9_-]*$/;
|
|
409
484
|
export function isValidBase64URL(data) {
|
|
410
|
-
if (!
|
|
485
|
+
if (!base64urlCharset.test(data))
|
|
411
486
|
return false;
|
|
412
487
|
const base64 = data.replace(/[-_]/g, (c) => (c === "-" ? "+" : "/"));
|
|
413
488
|
const padded = base64.padEnd(Math.ceil(base64.length / 4) * 4, "=");
|
|
414
489
|
return isValidBase64(padded);
|
|
415
490
|
}
|
|
416
491
|
export const $ZodBase64URL = /*@__PURE__*/ core.$constructor("$ZodBase64URL", (inst, def) => {
|
|
417
|
-
def.pattern ?? (def.pattern =
|
|
492
|
+
def.pattern ?? (def.pattern = base64urlCharset);
|
|
418
493
|
$ZodStringFormat.init(inst, def);
|
|
419
|
-
inst._zod.bag.contentEncoding = "base64url";
|
|
420
494
|
inst._zod.check = (payload) => {
|
|
421
495
|
if (isValidBase64URL(payload.value))
|
|
422
496
|
return;
|
|
@@ -433,6 +507,77 @@ export const $ZodE164 = /*@__PURE__*/ core.$constructor("$ZodE164", (inst, def)
|
|
|
433
507
|
def.pattern ?? (def.pattern = regexes.e164);
|
|
434
508
|
$ZodStringFormat.init(inst, def);
|
|
435
509
|
});
|
|
510
|
+
////////////////////////////// ZodCreditCard //////////////////////////////
|
|
511
|
+
const CC_SANITIZE = /[- ]/g;
|
|
512
|
+
/** Luhn checksum on a digit-only string. Adapted from valibot (MIT). */
|
|
513
|
+
function isLuhnAlgo(digits) {
|
|
514
|
+
let length = digits.length;
|
|
515
|
+
let bit = 1;
|
|
516
|
+
let sum = 0;
|
|
517
|
+
while (length) {
|
|
518
|
+
const value = digits.charCodeAt(--length) - 48;
|
|
519
|
+
bit ^= 1;
|
|
520
|
+
sum += bit ? [0, 2, 4, 6, 8, 1, 3, 5, 7, 9][value] : value;
|
|
521
|
+
}
|
|
522
|
+
return sum % 10 === 0;
|
|
523
|
+
}
|
|
524
|
+
export function isValidCreditCard(input) {
|
|
525
|
+
if (!regexes.creditCard.test(input))
|
|
526
|
+
return false;
|
|
527
|
+
return isLuhnAlgo(input.replace(CC_SANITIZE, ""));
|
|
528
|
+
}
|
|
529
|
+
export const $ZodCreditCard = /*@__PURE__*/ core.$constructor("$ZodCreditCard", (inst, def) => {
|
|
530
|
+
// 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.
|
|
531
|
+
def.pattern ?? (def.pattern = regexes.creditCard);
|
|
532
|
+
$ZodStringFormat.init(inst, def);
|
|
533
|
+
inst._zod.check = (payload) => {
|
|
534
|
+
if (isValidCreditCard(payload.value))
|
|
535
|
+
return;
|
|
536
|
+
payload.issues.push({
|
|
537
|
+
code: "invalid_format",
|
|
538
|
+
format: "credit_card",
|
|
539
|
+
input: payload.value,
|
|
540
|
+
inst,
|
|
541
|
+
continue: !def.abort,
|
|
542
|
+
});
|
|
543
|
+
};
|
|
544
|
+
});
|
|
545
|
+
////////////////////////////// ZodIBAN //////////////////////////////
|
|
546
|
+
// iso 7064 mod 97-10 checksum without BigInt
|
|
547
|
+
function isIso7064Mod97(iban) {
|
|
548
|
+
let remainder = 0;
|
|
549
|
+
const len = iban.length;
|
|
550
|
+
for (let i = 4; i < len; i++) {
|
|
551
|
+
const code = iban.charCodeAt(i);
|
|
552
|
+
remainder = (code >= 65 ? remainder * 100 + (code - 55) : remainder * 10 + (code - 48)) % 97;
|
|
553
|
+
}
|
|
554
|
+
for (let i = 0; i < 4; i++) {
|
|
555
|
+
const code = iban.charCodeAt(i);
|
|
556
|
+
remainder = (code >= 65 ? remainder * 100 + (code - 55) : remainder * 10 + (code - 48)) % 97;
|
|
557
|
+
}
|
|
558
|
+
return remainder === 1;
|
|
559
|
+
}
|
|
560
|
+
export function isValidIBAN(input) {
|
|
561
|
+
if (!regexes.iban.test(input))
|
|
562
|
+
return false;
|
|
563
|
+
return isIso7064Mod97(input);
|
|
564
|
+
}
|
|
565
|
+
export const $ZodIBAN = /*@__PURE__*/ core.$constructor("$ZodIBAN", (inst, def) => {
|
|
566
|
+
// shape only — checksum is not expressible as a pattern
|
|
567
|
+
def.pattern ?? (def.pattern = regexes.iban);
|
|
568
|
+
$ZodStringFormat.init(inst, def);
|
|
569
|
+
inst._zod.check = (payload) => {
|
|
570
|
+
if (isValidIBAN(payload.value))
|
|
571
|
+
return;
|
|
572
|
+
payload.issues.push({
|
|
573
|
+
code: "invalid_format",
|
|
574
|
+
format: "iban",
|
|
575
|
+
input: payload.value,
|
|
576
|
+
inst,
|
|
577
|
+
continue: !def.abort,
|
|
578
|
+
});
|
|
579
|
+
};
|
|
580
|
+
});
|
|
436
581
|
////////////////////////////// ZodJWT //////////////////////////////
|
|
437
582
|
export function isValidJWT(token, algorithm = null) {
|
|
438
583
|
try {
|
|
@@ -486,7 +631,7 @@ export const $ZodCustomStringFormat = /*@__PURE__*/ core.$constructor("$ZodCusto
|
|
|
486
631
|
});
|
|
487
632
|
export const $ZodNumber = /*@__PURE__*/ core.$constructor("$ZodNumber", (inst, def) => {
|
|
488
633
|
$ZodType.init(inst, def);
|
|
489
|
-
inst._zod.pattern =
|
|
634
|
+
inst._zod.pattern = regexes.number;
|
|
490
635
|
inst._zod.parse = (payload, _ctx) => {
|
|
491
636
|
if (def.coerce)
|
|
492
637
|
try {
|
|
@@ -501,7 +646,7 @@ export const $ZodNumber = /*@__PURE__*/ core.$constructor("$ZodNumber", (inst, d
|
|
|
501
646
|
? Number.isNaN(input)
|
|
502
647
|
? "NaN"
|
|
503
648
|
: !Number.isFinite(input)
|
|
504
|
-
?
|
|
649
|
+
? String(input)
|
|
505
650
|
: undefined
|
|
506
651
|
: undefined;
|
|
507
652
|
payload.issues.push({
|
|
@@ -671,6 +816,33 @@ export const $ZodDate = /*@__PURE__*/ core.$constructor("$ZodDate", (inst, def)
|
|
|
671
816
|
return payload;
|
|
672
817
|
};
|
|
673
818
|
});
|
|
819
|
+
// an oversized container fails its leading size checks before any element is parsed
|
|
820
|
+
function capSize(inst, size) {
|
|
821
|
+
const caps = util.sizeCaps(inst._zod.def.checks);
|
|
822
|
+
if (!caps.length)
|
|
823
|
+
return;
|
|
824
|
+
const cap = Math.min(...caps.map((c) => c[0]));
|
|
825
|
+
const parse = inst._zod.parse;
|
|
826
|
+
inst._zod.parse = (payload, ctx) => {
|
|
827
|
+
const n = size(payload.value);
|
|
828
|
+
if (n > cap && !ctx?.skipChecks && ctx?.direction !== "backward") {
|
|
829
|
+
for (const [max, ch] of util.sizeCaps(inst._zod.def.checks)) {
|
|
830
|
+
if (n > max && ch._zod.def.when(payload)) {
|
|
831
|
+
const start = payload.issues.length;
|
|
832
|
+
ch._zod.check(payload);
|
|
833
|
+
// the value is still the raw input, so no later check may read it
|
|
834
|
+
payload.issues[start].continue = false;
|
|
835
|
+
util.attachSchema(payload.issues, start, inst);
|
|
836
|
+
return payload;
|
|
837
|
+
}
|
|
838
|
+
}
|
|
839
|
+
}
|
|
840
|
+
return parse(payload, ctx);
|
|
841
|
+
};
|
|
842
|
+
}
|
|
843
|
+
const arraySize = (input) => (Array.isArray(input) ? input.length : -1);
|
|
844
|
+
const mapSize = (input) => (input instanceof Map ? input.size : -1);
|
|
845
|
+
const setSize = (input) => (input instanceof Set ? input.size : -1);
|
|
674
846
|
function handleArrayResult(result, final, index) {
|
|
675
847
|
if (result.issues.length) {
|
|
676
848
|
final.issues.push(...util.prefixIssues(index, result.issues));
|
|
@@ -679,6 +851,8 @@ function handleArrayResult(result, final, index) {
|
|
|
679
851
|
}
|
|
680
852
|
export const $ZodArray = /*@__PURE__*/ core.$constructor("$ZodArray", (inst, def) => {
|
|
681
853
|
$ZodType.init(inst, def);
|
|
854
|
+
const memo = core.globalConfig.memoizer;
|
|
855
|
+
memo?.attach(inst);
|
|
682
856
|
inst._zod.parse = (payload, ctx) => {
|
|
683
857
|
const input = payload.value;
|
|
684
858
|
if (!Array.isArray(input)) {
|
|
@@ -690,8 +864,9 @@ export const $ZodArray = /*@__PURE__*/ core.$constructor("$ZodArray", (inst, def
|
|
|
690
864
|
});
|
|
691
865
|
return payload;
|
|
692
866
|
}
|
|
693
|
-
payload.value = Array(input.length);
|
|
867
|
+
payload.value = memo ? memo.alloc(inst, payload, Array(input.length), ctx) : Array(input.length);
|
|
694
868
|
const proms = [];
|
|
869
|
+
const abortEarly = ctx?.abortEarly;
|
|
695
870
|
for (let i = 0; i < input.length; i++) {
|
|
696
871
|
const item = input[i];
|
|
697
872
|
const result = def.element._zod.run({
|
|
@@ -703,6 +878,9 @@ export const $ZodArray = /*@__PURE__*/ core.$constructor("$ZodArray", (inst, def
|
|
|
703
878
|
}
|
|
704
879
|
else {
|
|
705
880
|
handleArrayResult(result, payload, i);
|
|
881
|
+
// the element's payload is authoritative here, since handleArrayResult forwards every issue; an object's is not, because it drops a failed absent optional
|
|
882
|
+
if (abortEarly && result.issues.length !== 0 && util.aborted(result))
|
|
883
|
+
break;
|
|
706
884
|
}
|
|
707
885
|
}
|
|
708
886
|
if (proms.length) {
|
|
@@ -710,17 +888,23 @@ export const $ZodArray = /*@__PURE__*/ core.$constructor("$ZodArray", (inst, def
|
|
|
710
888
|
}
|
|
711
889
|
return payload; //handleArrayResultsAsync(parseResults, final);
|
|
712
890
|
};
|
|
891
|
+
capSize(inst, arraySize);
|
|
713
892
|
});
|
|
714
|
-
function handlePropertyResult(result, final, key, input,
|
|
893
|
+
function handlePropertyResult(result, final, key, input, optin, optout) {
|
|
715
894
|
const isPresent = key in input;
|
|
895
|
+
const isOptionalOut = optout === "optional";
|
|
896
|
+
// 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.
|
|
897
|
+
if (!isPresent && isOptionalOut && optin === "optional") {
|
|
898
|
+
return;
|
|
899
|
+
}
|
|
716
900
|
if (result.issues.length) {
|
|
717
901
|
// For optional-in/out schemas, ignore errors on absent keys.
|
|
718
|
-
if (
|
|
902
|
+
if (optin !== undefined && isOptionalOut && !isPresent) {
|
|
719
903
|
return;
|
|
720
904
|
}
|
|
721
905
|
final.issues.push(...util.prefixIssues(key, result.issues));
|
|
722
906
|
}
|
|
723
|
-
if (!isPresent &&
|
|
907
|
+
if (!isPresent && optin === undefined) {
|
|
724
908
|
if (!result.issues.length) {
|
|
725
909
|
final.issues.push({
|
|
726
910
|
code: "invalid_type",
|
|
@@ -732,7 +916,7 @@ function handlePropertyResult(result, final, key, input, isOptionalIn, isOptiona
|
|
|
732
916
|
return;
|
|
733
917
|
}
|
|
734
918
|
if (result.value === undefined) {
|
|
735
|
-
if (isPresent) {
|
|
919
|
+
if (isPresent || (optin === "defaulted" && !isOptionalOut)) {
|
|
736
920
|
final.value[key] = undefined;
|
|
737
921
|
}
|
|
738
922
|
}
|
|
@@ -740,46 +924,64 @@ function handlePropertyResult(result, final, key, input, isOptionalIn, isOptiona
|
|
|
740
924
|
final.value[key] = result.value;
|
|
741
925
|
}
|
|
742
926
|
}
|
|
927
|
+
// one shared instance; a fresh [] per schema cost 56 bytes retained
|
|
928
|
+
const NO_SYMBOL_KEYS = [];
|
|
743
929
|
function normalizeDef(def) {
|
|
744
930
|
const keys = Object.keys(def.shape);
|
|
745
|
-
|
|
931
|
+
const ownSymbols = Object.getOwnPropertySymbols(def.shape);
|
|
932
|
+
const symbolKeys = ownSymbols.length ? ownSymbols : NO_SYMBOL_KEYS;
|
|
933
|
+
// aliases `keys` when there are no symbols, so a string-only shape keeps one array
|
|
934
|
+
const allKeys = symbolKeys.length ? [...keys, ...symbolKeys] : keys;
|
|
935
|
+
for (const k of allKeys) {
|
|
746
936
|
if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) {
|
|
747
|
-
throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
|
|
937
|
+
throw new Error(`Invalid element at key "${String(k)}": expected a Zod schema`);
|
|
748
938
|
}
|
|
749
939
|
}
|
|
750
940
|
const okeys = util.optionalKeys(def.shape);
|
|
751
941
|
return {
|
|
752
942
|
...def,
|
|
753
|
-
|
|
943
|
+
allKeys,
|
|
944
|
+
symbolKeys,
|
|
945
|
+
// string-only: handleCatchall matches it against `for...in`, which never yields a symbol
|
|
754
946
|
keySet: new Set(keys),
|
|
755
947
|
numKeys: keys.length,
|
|
756
948
|
optionalKeys: new Set(okeys),
|
|
757
949
|
};
|
|
758
950
|
}
|
|
759
|
-
function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
951
|
+
function handleCatchall(proms, input, payload, ctx, def, inst, abortEarly) {
|
|
760
952
|
const unrecognized = [];
|
|
761
953
|
const keySet = def.keySet;
|
|
762
954
|
const _catchall = def.catchall._zod;
|
|
763
955
|
const t = _catchall.def.type;
|
|
764
|
-
const
|
|
765
|
-
const
|
|
956
|
+
const optin = _catchall.optin;
|
|
957
|
+
const optout = _catchall.optout;
|
|
958
|
+
// starts at 0, not the current length: the shape phase already ran and may have aborted
|
|
959
|
+
let seen = 0;
|
|
766
960
|
for (const key in input) {
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
961
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
962
|
+
if (util.aborted(payload, seen))
|
|
963
|
+
break;
|
|
964
|
+
seen = payload.issues.length;
|
|
965
|
+
}
|
|
966
|
+
// Must precede the __proto__ branch: a declared key is not unrecognized, even though the shape loop deliberately strips __proto__ from the parsed output.
|
|
771
967
|
if (keySet.has(key))
|
|
772
968
|
continue;
|
|
969
|
+
// 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.
|
|
970
|
+
if (key === "__proto__") {
|
|
971
|
+
if (t === "never")
|
|
972
|
+
unrecognized.push(key);
|
|
973
|
+
continue;
|
|
974
|
+
}
|
|
773
975
|
if (t === "never") {
|
|
774
976
|
unrecognized.push(key);
|
|
775
977
|
continue;
|
|
776
978
|
}
|
|
777
979
|
const r = _catchall.run({ value: input[key], issues: [] }, ctx);
|
|
778
980
|
if (r instanceof Promise) {
|
|
779
|
-
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input,
|
|
981
|
+
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
|
|
780
982
|
}
|
|
781
983
|
else {
|
|
782
|
-
handlePropertyResult(r, payload, key, input,
|
|
984
|
+
handlePropertyResult(r, payload, key, input, optin, optout);
|
|
783
985
|
}
|
|
784
986
|
}
|
|
785
987
|
if (unrecognized.length) {
|
|
@@ -788,6 +990,8 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
788
990
|
keys: unrecognized,
|
|
789
991
|
input,
|
|
790
992
|
inst,
|
|
993
|
+
// 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.
|
|
994
|
+
continue: true,
|
|
791
995
|
});
|
|
792
996
|
}
|
|
793
997
|
if (!proms.length)
|
|
@@ -799,30 +1003,35 @@ function handleCatchall(proms, input, payload, ctx, def, inst) {
|
|
|
799
1003
|
export const $ZodObject = /*@__PURE__*/ core.$constructor("$ZodObject", (inst, def) => {
|
|
800
1004
|
// requires cast because technically $ZodObject doesn't extend
|
|
801
1005
|
$ZodType.init(inst, def);
|
|
802
|
-
// const sh = def.shape;
|
|
803
1006
|
const desc = Object.getOwnPropertyDescriptor(def, "shape");
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
1007
|
+
// 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
|
|
1008
|
+
const sh = desc?.get ? desc.get.raw : (def.shape ?? {});
|
|
1009
|
+
if (sh) {
|
|
1010
|
+
// Freezes the shape on first read, so its getters resolve once and every later read sees the same schemas.
|
|
1011
|
+
const get = () => {
|
|
1012
|
+
const newSh = { ...sh };
|
|
1013
|
+
Object.defineProperty(def, "shape", { value: newSh });
|
|
1014
|
+
get.raw = newSh;
|
|
1015
|
+
return newSh;
|
|
1016
|
+
};
|
|
1017
|
+
get.raw = sh;
|
|
1018
|
+
Object.defineProperty(def, "shape", { get });
|
|
815
1019
|
}
|
|
816
1020
|
const _normalized = util.cached(() => normalizeDef(def));
|
|
817
|
-
util.
|
|
818
|
-
const shape = def.shape;
|
|
1021
|
+
util.defineLazyInternal(inst, "propValues", (zod) => {
|
|
1022
|
+
const shape = zod.def.shape;
|
|
819
1023
|
const propValues = {};
|
|
820
1024
|
for (const key in shape) {
|
|
821
1025
|
const field = shape[key]._zod;
|
|
822
1026
|
if (field.values) {
|
|
823
|
-
|
|
1027
|
+
if (!Object.prototype.hasOwnProperty.call(propValues, key)) {
|
|
1028
|
+
util.assignProp(propValues, key, new Set());
|
|
1029
|
+
}
|
|
824
1030
|
for (const v of field.values)
|
|
825
1031
|
propValues[key].add(v);
|
|
1032
|
+
// 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.
|
|
1033
|
+
if (field.optin !== undefined)
|
|
1034
|
+
propValues[key].add(undefined);
|
|
826
1035
|
}
|
|
827
1036
|
}
|
|
828
1037
|
return propValues;
|
|
@@ -830,6 +1039,8 @@ export const $ZodObject = /*@__PURE__*/ core.$constructor("$ZodObject", (inst, d
|
|
|
830
1039
|
const isObject = util.isObject;
|
|
831
1040
|
const catchall = def.catchall;
|
|
832
1041
|
let value;
|
|
1042
|
+
const memo = core.globalConfig.memoizer;
|
|
1043
|
+
memo?.attach(inst);
|
|
833
1044
|
inst._zod.parse = (payload, ctx) => {
|
|
834
1045
|
value ?? (value = _normalized.value);
|
|
835
1046
|
const input = payload.value;
|
|
@@ -842,25 +1053,34 @@ export const $ZodObject = /*@__PURE__*/ core.$constructor("$ZodObject", (inst, d
|
|
|
842
1053
|
});
|
|
843
1054
|
return payload;
|
|
844
1055
|
}
|
|
845
|
-
payload.value = {};
|
|
1056
|
+
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
846
1057
|
const proms = [];
|
|
847
1058
|
const shape = value.shape;
|
|
848
|
-
|
|
1059
|
+
const abortEarly = ctx?.abortEarly;
|
|
1060
|
+
let seen = payload.issues.length;
|
|
1061
|
+
for (const key of value.allKeys) {
|
|
1062
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
1063
|
+
if (util.aborted(payload, seen))
|
|
1064
|
+
break;
|
|
1065
|
+
seen = payload.issues.length;
|
|
1066
|
+
}
|
|
1067
|
+
if (key === "__proto__")
|
|
1068
|
+
continue;
|
|
849
1069
|
const el = shape[key];
|
|
850
|
-
const
|
|
851
|
-
const
|
|
1070
|
+
const optin = el._zod.optin;
|
|
1071
|
+
const optout = el._zod.optout;
|
|
852
1072
|
const r = el._zod.run({ value: input[key], issues: [] }, ctx);
|
|
853
1073
|
if (r instanceof Promise) {
|
|
854
|
-
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input,
|
|
1074
|
+
proms.push(r.then((r) => handlePropertyResult(r, payload, key, input, optin, optout)));
|
|
855
1075
|
}
|
|
856
1076
|
else {
|
|
857
|
-
handlePropertyResult(r, payload, key, input,
|
|
1077
|
+
handlePropertyResult(r, payload, key, input, optin, optout);
|
|
858
1078
|
}
|
|
859
1079
|
}
|
|
860
1080
|
if (!catchall) {
|
|
861
1081
|
return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
862
1082
|
}
|
|
863
|
-
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
|
|
1083
|
+
return handleCatchall(proms, input, payload, ctx, _normalized.value, inst, abortEarly === true);
|
|
864
1084
|
};
|
|
865
1085
|
});
|
|
866
1086
|
export const $ZodObjectJIT = /*@__PURE__*/ core.$constructor("$ZodObjectJIT", (inst, def) => {
|
|
@@ -868,58 +1088,65 @@ export const $ZodObjectJIT = /*@__PURE__*/ core.$constructor("$ZodObjectJIT", (i
|
|
|
868
1088
|
$ZodObject.init(inst, def);
|
|
869
1089
|
const superParse = inst._zod.parse;
|
|
870
1090
|
const _normalized = util.cached(() => normalizeDef(def));
|
|
1091
|
+
const memo = core.globalConfig.memoizer;
|
|
871
1092
|
const generateFastpass = (shape) => {
|
|
872
|
-
const doc = new Doc(["shape", "payload", "ctx"]);
|
|
873
1093
|
const normalized = _normalized.value;
|
|
874
|
-
const
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
}
|
|
1094
|
+
const syms = normalized.symbolKeys;
|
|
1095
|
+
// a symbol has no source literal, so it is read as `syms[i]` off the closed-over scope
|
|
1096
|
+
const doc = new Doc(["payload", "ctx"], { shape, inst, memo, syms });
|
|
1097
|
+
const parseStr = (k) => `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
1098
|
+
// 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
|
|
1099
|
+
const prefixStr = (id, k) => `
|
|
1100
|
+
let ${id}_ab = false;
|
|
1101
|
+
for (let i = 0; i < ${id}.issues.length; i++) {
|
|
1102
|
+
const iss = ${id}.issues[i];
|
|
1103
|
+
iss.path = iss.path ? [${k}, ...iss.path] : [${k}];
|
|
1104
|
+
payload.issues.push(iss);
|
|
1105
|
+
if (iss.continue !== true) ${id}_ab = true;
|
|
1106
|
+
}
|
|
1107
|
+
if (${id}_ab && ctx && ctx.abortEarly) {
|
|
1108
|
+
payload.value = newResult;
|
|
1109
|
+
return payload;
|
|
1110
|
+
}`;
|
|
878
1111
|
doc.write(`const input = payload.value;`);
|
|
879
1112
|
const ids = Object.create(null);
|
|
880
1113
|
let counter = 0;
|
|
881
|
-
for (const key of normalized.
|
|
1114
|
+
for (const key of normalized.allKeys) {
|
|
882
1115
|
ids[key] = `key_${counter++}`;
|
|
883
1116
|
}
|
|
884
1117
|
// A: preserve key order {
|
|
885
|
-
doc.write(`const newResult = {};`);
|
|
886
|
-
for (const key of normalized.
|
|
1118
|
+
doc.write(memo ? `const newResult = memo.alloc(inst, payload, {}, ctx);` : `const newResult = {};`);
|
|
1119
|
+
for (const key of normalized.allKeys) {
|
|
1120
|
+
if (key === "__proto__")
|
|
1121
|
+
continue;
|
|
887
1122
|
const id = ids[key];
|
|
888
|
-
const k = util.esc(key);
|
|
1123
|
+
const k = typeof key === "symbol" ? `syms[${syms.indexOf(key)}]` : util.esc(key);
|
|
1124
|
+
const isPresent = `${k} in input`;
|
|
889
1125
|
const schema = shape[key];
|
|
890
|
-
const
|
|
1126
|
+
const optin = schema?._zod?.optin;
|
|
1127
|
+
const isOptionalIn = optin !== undefined;
|
|
891
1128
|
const isOptionalOut = schema?._zod?.optout === "optional";
|
|
892
|
-
doc.write(`const ${id} = ${parseStr(
|
|
1129
|
+
doc.write(`const ${id} = ${parseStr(k)};`);
|
|
893
1130
|
if (isOptionalIn && isOptionalOut) {
|
|
894
|
-
// For optional-in/out schemas, ignore errors on absent keys
|
|
1131
|
+
// 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.
|
|
1132
|
+
const assign = optin === "optional" ? `${id}_present` : `${id}.value !== undefined || ${id}_present`;
|
|
895
1133
|
doc.write(`
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
...iss,
|
|
900
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
901
|
-
})));
|
|
1134
|
+
const ${id}_present = ${isPresent};
|
|
1135
|
+
if (!${id}.issues.length || ${id}_present) {
|
|
1136
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
902
1137
|
}
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
if (${k} in input) {
|
|
907
|
-
newResult[${k}] = undefined;
|
|
1138
|
+
|
|
1139
|
+
if (${assign}) {
|
|
1140
|
+
newResult[${k}] = ${id}.value;
|
|
908
1141
|
}
|
|
909
|
-
} else {
|
|
910
|
-
newResult[${k}] = ${id}.value;
|
|
911
1142
|
}
|
|
912
|
-
|
|
1143
|
+
|
|
913
1144
|
`);
|
|
914
1145
|
}
|
|
915
1146
|
else if (!isOptionalIn) {
|
|
916
1147
|
doc.write(`
|
|
917
|
-
const ${id}_present = ${
|
|
918
|
-
if (${id}.issues.length) {
|
|
919
|
-
payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
920
|
-
...iss,
|
|
921
|
-
path: iss.path ? [${k}, ...iss.path] : [${k}]
|
|
922
|
-
})));
|
|
1148
|
+
const ${id}_present = ${isPresent};
|
|
1149
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
923
1150
|
}
|
|
924
1151
|
if (!${id}_present && !${id}.issues.length) {
|
|
925
1152
|
payload.issues.push({
|
|
@@ -928,42 +1155,39 @@ export const $ZodObjectJIT = /*@__PURE__*/ core.$constructor("$ZodObjectJIT", (i
|
|
|
928
1155
|
input: undefined,
|
|
929
1156
|
path: [${k}]
|
|
930
1157
|
});
|
|
1158
|
+
if (ctx && ctx.abortEarly) {
|
|
1159
|
+
payload.value = newResult;
|
|
1160
|
+
return payload;
|
|
1161
|
+
}
|
|
931
1162
|
}
|
|
932
1163
|
|
|
933
1164
|
if (${id}_present) {
|
|
934
|
-
|
|
935
|
-
newResult[${k}] = undefined;
|
|
936
|
-
} else {
|
|
937
|
-
newResult[${k}] = ${id}.value;
|
|
938
|
-
}
|
|
1165
|
+
newResult[${k}] = ${id}.value;
|
|
939
1166
|
}
|
|
940
1167
|
|
|
941
1168
|
`);
|
|
942
1169
|
}
|
|
943
1170
|
else {
|
|
944
1171
|
doc.write(`
|
|
945
|
-
if (${id}.issues.length) {
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
newResult[${k}] = undefined;
|
|
955
|
-
}
|
|
956
|
-
} else {
|
|
1172
|
+
if (${id}.issues.length) {${prefixStr(id, k)}
|
|
1173
|
+
}
|
|
1174
|
+
`);
|
|
1175
|
+
if (optin === "defaulted") {
|
|
1176
|
+
doc.write(`newResult[${k}] = ${id}.value;`);
|
|
1177
|
+
}
|
|
1178
|
+
else {
|
|
1179
|
+
doc.write(`
|
|
1180
|
+
if (${id}.value !== undefined || ${isPresent}) {
|
|
957
1181
|
newResult[${k}] = ${id}.value;
|
|
958
1182
|
}
|
|
959
|
-
|
|
960
1183
|
`);
|
|
1184
|
+
}
|
|
961
1185
|
}
|
|
962
1186
|
}
|
|
963
1187
|
doc.write(`payload.value = newResult;`);
|
|
964
1188
|
doc.write(`return payload;`);
|
|
965
|
-
|
|
966
|
-
return (
|
|
1189
|
+
// 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
|
|
1190
|
+
return doc.compile();
|
|
967
1191
|
};
|
|
968
1192
|
let fastpass;
|
|
969
1193
|
const isObject = util.isObject;
|
|
@@ -991,7 +1215,7 @@ export const $ZodObjectJIT = /*@__PURE__*/ core.$constructor("$ZodObjectJIT", (i
|
|
|
991
1215
|
payload = fastpass(payload, ctx);
|
|
992
1216
|
if (!catchall)
|
|
993
1217
|
return payload;
|
|
994
|
-
return handleCatchall([], input, payload, ctx, value, inst);
|
|
1218
|
+
return handleCatchall([], input, payload, ctx, value, inst, ctx?.abortEarly === true);
|
|
995
1219
|
}
|
|
996
1220
|
return superParse(payload, ctx);
|
|
997
1221
|
};
|
|
@@ -1018,17 +1242,21 @@ function handleUnionResults(results, final, inst, ctx) {
|
|
|
1018
1242
|
}
|
|
1019
1243
|
export const $ZodUnion = /*@__PURE__*/ core.$constructor("$ZodUnion", (inst, def) => {
|
|
1020
1244
|
$ZodType.init(inst, def);
|
|
1021
|
-
util.
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1245
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.options.some((o) => o._zod.optin === "defaulted")
|
|
1246
|
+
? "defaulted"
|
|
1247
|
+
: zod.def.options.some((o) => o._zod.optin !== undefined)
|
|
1248
|
+
? "optional"
|
|
1249
|
+
: undefined);
|
|
1250
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.def.options.some((o) => o._zod.optout === "optional") ? "optional" : undefined);
|
|
1251
|
+
util.defineLazyInternal(inst, "values", (zod) => {
|
|
1252
|
+
if (zod.def.options.every((o) => o._zod.values)) {
|
|
1253
|
+
return new Set(zod.def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
1026
1254
|
}
|
|
1027
1255
|
return undefined;
|
|
1028
1256
|
});
|
|
1029
|
-
util.
|
|
1030
|
-
if (def.options.every((o) => o._zod.pattern)) {
|
|
1031
|
-
const patterns = def.options.map((o) => o._zod.pattern);
|
|
1257
|
+
util.defineLazyInternal(inst, "pattern", (zod) => {
|
|
1258
|
+
if (zod.def.options.every((o) => o._zod.pattern)) {
|
|
1259
|
+
const patterns = zod.def.options.map((o) => o._zod.pattern);
|
|
1032
1260
|
return new RegExp(`^(${patterns.map((p) => util.cleanRegex(p.source)).join("|")})$`);
|
|
1033
1261
|
}
|
|
1034
1262
|
return undefined;
|
|
@@ -1063,12 +1291,16 @@ export const $ZodUnion = /*@__PURE__*/ core.$constructor("$ZodUnion", (inst, def
|
|
|
1063
1291
|
};
|
|
1064
1292
|
});
|
|
1065
1293
|
function handleExclusiveUnionResults(results, final, inst, ctx) {
|
|
1066
|
-
const
|
|
1067
|
-
|
|
1068
|
-
|
|
1294
|
+
const matches = [];
|
|
1295
|
+
for (let i = 0; i < results.length; i++) {
|
|
1296
|
+
if (results[i].issues.length === 0)
|
|
1297
|
+
matches.push(i);
|
|
1298
|
+
}
|
|
1299
|
+
if (matches.length === 1) {
|
|
1300
|
+
final.value = results[matches[0]].value;
|
|
1069
1301
|
return final;
|
|
1070
1302
|
}
|
|
1071
|
-
if (
|
|
1303
|
+
if (matches.length === 0) {
|
|
1072
1304
|
// No matches - same as regular union
|
|
1073
1305
|
final.issues.push({
|
|
1074
1306
|
code: "invalid_union",
|
|
@@ -1085,6 +1317,7 @@ function handleExclusiveUnionResults(results, final, inst, ctx) {
|
|
|
1085
1317
|
inst,
|
|
1086
1318
|
errors: [],
|
|
1087
1319
|
inclusive: false,
|
|
1320
|
+
matches,
|
|
1088
1321
|
});
|
|
1089
1322
|
}
|
|
1090
1323
|
return final;
|
|
@@ -1119,44 +1352,75 @@ export const $ZodXor = /*@__PURE__*/ core.$constructor("$ZodXor", (inst, def) =>
|
|
|
1119
1352
|
});
|
|
1120
1353
|
};
|
|
1121
1354
|
});
|
|
1355
|
+
/** Returns the option whose discriminator claims `value`, or throws if ambiguous. */
|
|
1356
|
+
export function getDiscriminatedOption(union, value) {
|
|
1357
|
+
const internals = union._zod;
|
|
1358
|
+
let map = internals.bag.optionsMap;
|
|
1359
|
+
if (!map) {
|
|
1360
|
+
map = discriminatorMap(internals.def);
|
|
1361
|
+
internals.bag.optionsMap = map;
|
|
1362
|
+
}
|
|
1363
|
+
const option = map.get(value);
|
|
1364
|
+
if (option === null)
|
|
1365
|
+
throw new Error(`Ambiguous discriminator value "${String(value)}"`);
|
|
1366
|
+
return option;
|
|
1367
|
+
}
|
|
1368
|
+
function discriminatorMap(def) {
|
|
1369
|
+
const map = new Map();
|
|
1370
|
+
for (const option of def.options) {
|
|
1371
|
+
const values = option._zod.propValues?.[def.discriminator];
|
|
1372
|
+
if (!values || values.size === 0)
|
|
1373
|
+
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
1374
|
+
for (const value of values) {
|
|
1375
|
+
if (map.has(value)) {
|
|
1376
|
+
if (value !== undefined)
|
|
1377
|
+
throw new Error(`Duplicate discriminator value "${String(value)}"`);
|
|
1378
|
+
// keep the collision marked so a later member cannot reclaim it
|
|
1379
|
+
map.set(value, null);
|
|
1380
|
+
}
|
|
1381
|
+
else {
|
|
1382
|
+
map.set(value, option);
|
|
1383
|
+
}
|
|
1384
|
+
}
|
|
1385
|
+
}
|
|
1386
|
+
return map;
|
|
1387
|
+
}
|
|
1122
1388
|
export const $ZodDiscriminatedUnion =
|
|
1123
1389
|
/*@__PURE__*/
|
|
1124
1390
|
core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
1125
1391
|
def.inclusive = false;
|
|
1126
1392
|
$ZodUnion.init(inst, def);
|
|
1127
1393
|
const _super = inst._zod.parse;
|
|
1128
|
-
util.
|
|
1394
|
+
util.defineLazyInternal(inst, "propValues", (zod) => {
|
|
1129
1395
|
const propValues = {};
|
|
1130
|
-
|
|
1396
|
+
let undefinedCount = 0;
|
|
1397
|
+
for (const option of zod.def.options) {
|
|
1131
1398
|
const pv = option._zod.propValues;
|
|
1132
1399
|
if (!pv || Object.keys(pv).length === 0)
|
|
1133
|
-
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
1400
|
+
throw new Error(`Invalid discriminated union option at index "${zod.def.options.indexOf(option)}"`);
|
|
1401
|
+
if (pv[zod.def.discriminator]?.has(undefined))
|
|
1402
|
+
undefinedCount++;
|
|
1134
1403
|
for (const [k, v] of Object.entries(pv)) {
|
|
1135
|
-
if (!propValues
|
|
1136
|
-
propValues
|
|
1404
|
+
if (!Object.prototype.hasOwnProperty.call(propValues, k)) {
|
|
1405
|
+
util.assignProp(propValues, k, new Set());
|
|
1406
|
+
}
|
|
1137
1407
|
for (const val of v) {
|
|
1138
1408
|
propValues[k].add(val);
|
|
1139
1409
|
}
|
|
1140
1410
|
}
|
|
1141
1411
|
}
|
|
1412
|
+
if (!zod.def.unionFallback && undefinedCount > 1)
|
|
1413
|
+
propValues[zod.def.discriminator]?.delete(undefined);
|
|
1142
1414
|
return propValues;
|
|
1143
1415
|
});
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
const
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
if (!values || values.size === 0)
|
|
1150
|
-
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
|
|
1151
|
-
for (const v of values) {
|
|
1152
|
-
if (map.has(v)) {
|
|
1153
|
-
throw new Error(`Duplicate discriminator value "${String(v)}"`);
|
|
1154
|
-
}
|
|
1155
|
-
map.set(v, o);
|
|
1156
|
-
}
|
|
1416
|
+
// 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.
|
|
1417
|
+
def.options.forEach((option, i) => {
|
|
1418
|
+
const propShape = util.rawShape(option._zod.def);
|
|
1419
|
+
if (propShape && !Object.prototype.hasOwnProperty.call(propShape, def.discriminator)) {
|
|
1420
|
+
throw new Error(`Invalid discriminated union option at index "${i}"`);
|
|
1157
1421
|
}
|
|
1158
|
-
return map;
|
|
1159
1422
|
});
|
|
1423
|
+
const disc = util.cached(() => discriminatorMap(def));
|
|
1160
1424
|
inst._zod.parse = (payload, ctx) => {
|
|
1161
1425
|
const input = payload.value;
|
|
1162
1426
|
if (!util.isObject(input)) {
|
|
@@ -1168,14 +1432,15 @@ core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
|
1168
1432
|
});
|
|
1169
1433
|
return payload;
|
|
1170
1434
|
}
|
|
1171
|
-
const
|
|
1172
|
-
|
|
1435
|
+
const value = input?.[def.discriminator];
|
|
1436
|
+
const opt = disc.value.get(value);
|
|
1437
|
+
// forward metadata cannot choose an encoder for an absent tag
|
|
1438
|
+
if (opt && (value !== undefined || ctx.direction !== "backward")) {
|
|
1173
1439
|
return opt._zod.run(payload, ctx);
|
|
1174
1440
|
}
|
|
1175
1441
|
// Fall back to union matching when the fast discriminator path fails:
|
|
1176
1442
|
// - explicitly enabled via unionFallback, or
|
|
1177
|
-
// - during backward direction (encode), since codec-based discriminators
|
|
1178
|
-
// have different values in forward vs backward directions
|
|
1443
|
+
// - during backward direction (encode), since codec-based discriminators have different values in forward vs backward directions
|
|
1179
1444
|
if (def.unionFallback || ctx.direction === "backward") {
|
|
1180
1445
|
return _super(payload, ctx);
|
|
1181
1446
|
}
|
|
@@ -1185,7 +1450,7 @@ core.$constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
|
1185
1450
|
errors: [],
|
|
1186
1451
|
note: "No matching discriminator",
|
|
1187
1452
|
discriminator: def.discriminator,
|
|
1188
|
-
options: Array.from(disc.value.keys()),
|
|
1453
|
+
options: Array.from(disc.value.keys()).filter((value) => disc.value.get(value) !== null),
|
|
1189
1454
|
input,
|
|
1190
1455
|
path: [def.discriminator],
|
|
1191
1456
|
inst,
|
|
@@ -1208,7 +1473,7 @@ export const $ZodIntersection = /*@__PURE__*/ core.$constructor("$ZodIntersectio
|
|
|
1208
1473
|
return handleIntersectionResults(payload, left, right);
|
|
1209
1474
|
};
|
|
1210
1475
|
});
|
|
1211
|
-
function mergeValues(a, b) {
|
|
1476
|
+
export function mergeValues(a, b) {
|
|
1212
1477
|
// const aType = parse.t(a);
|
|
1213
1478
|
// const bType = parse.t(b);
|
|
1214
1479
|
if (a === b) {
|
|
@@ -1221,7 +1486,11 @@ function mergeValues(a, b) {
|
|
|
1221
1486
|
const bKeys = Object.keys(b);
|
|
1222
1487
|
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
1223
1488
|
const newObj = { ...a, ...b };
|
|
1489
|
+
if (Object.prototype.hasOwnProperty.call(newObj, "__proto__"))
|
|
1490
|
+
delete newObj.__proto__;
|
|
1224
1491
|
for (const key of sharedKeys) {
|
|
1492
|
+
if (key === "__proto__")
|
|
1493
|
+
continue;
|
|
1225
1494
|
const sharedValue = mergeValues(a[key], b[key]);
|
|
1226
1495
|
if (!sharedValue.valid) {
|
|
1227
1496
|
return {
|
|
@@ -1255,43 +1524,55 @@ function mergeValues(a, b) {
|
|
|
1255
1524
|
return { valid: false, mergeErrorPath: [] };
|
|
1256
1525
|
}
|
|
1257
1526
|
function handleIntersectionResults(result, left, right) {
|
|
1258
|
-
// Track which side(s)
|
|
1527
|
+
// 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.
|
|
1259
1528
|
const unrecKeys = new Map();
|
|
1260
1529
|
let unrecIssue;
|
|
1261
|
-
|
|
1262
|
-
|
|
1530
|
+
const keyIssues = new Map();
|
|
1531
|
+
const collect = (iss, side) => {
|
|
1532
|
+
let keys;
|
|
1533
|
+
if (iss.code === "unrecognized_keys" && !iss.path?.length) {
|
|
1263
1534
|
unrecIssue ?? (unrecIssue = iss);
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1535
|
+
keys = iss.keys;
|
|
1536
|
+
}
|
|
1537
|
+
else if (iss.code === "invalid_key" && iss.origin === "record" && iss.path?.length === 1) {
|
|
1538
|
+
const k = String(iss.path[0]);
|
|
1539
|
+
if (!keyIssues.has(k))
|
|
1540
|
+
keyIssues.set(k, iss);
|
|
1541
|
+
keys = [k];
|
|
1269
1542
|
}
|
|
1270
1543
|
else {
|
|
1271
|
-
|
|
1544
|
+
return false;
|
|
1545
|
+
}
|
|
1546
|
+
for (const k of keys) {
|
|
1547
|
+
if (!unrecKeys.has(k))
|
|
1548
|
+
unrecKeys.set(k, {});
|
|
1549
|
+
unrecKeys.get(k)[side] = true;
|
|
1272
1550
|
}
|
|
1551
|
+
return true;
|
|
1552
|
+
};
|
|
1553
|
+
for (const iss of left.issues) {
|
|
1554
|
+
if (!collect(iss, "l"))
|
|
1555
|
+
result.issues.push(iss);
|
|
1273
1556
|
}
|
|
1274
1557
|
for (const iss of right.issues) {
|
|
1275
|
-
if (iss
|
|
1276
|
-
for (const k of iss.keys) {
|
|
1277
|
-
if (!unrecKeys.has(k))
|
|
1278
|
-
unrecKeys.set(k, {});
|
|
1279
|
-
unrecKeys.get(k).r = true;
|
|
1280
|
-
}
|
|
1281
|
-
}
|
|
1282
|
-
else {
|
|
1558
|
+
if (!collect(iss, "r"))
|
|
1283
1559
|
result.issues.push(iss);
|
|
1284
|
-
}
|
|
1285
1560
|
}
|
|
1286
|
-
// Report only keys
|
|
1561
|
+
// Report only keys rejected by BOTH sides
|
|
1287
1562
|
const bothKeys = [...unrecKeys].filter(([, f]) => f.l && f.r).map(([k]) => k);
|
|
1288
|
-
if (bothKeys.length
|
|
1289
|
-
|
|
1563
|
+
if (bothKeys.length) {
|
|
1564
|
+
const aggregated = unrecIssue ? bothKeys.filter((k) => unrecIssue.keys.includes(k)) : [];
|
|
1565
|
+
if (aggregated.length)
|
|
1566
|
+
result.issues.push({ ...unrecIssue, keys: aggregated });
|
|
1567
|
+
for (const k of bothKeys) {
|
|
1568
|
+
if (!aggregated.includes(k) && keyIssues.has(k))
|
|
1569
|
+
result.issues.push(keyIssues.get(k));
|
|
1570
|
+
}
|
|
1290
1571
|
}
|
|
1291
|
-
if (util.aborted(result))
|
|
1292
|
-
return result;
|
|
1293
1572
|
const merged = mergeValues(left.value, right.value);
|
|
1294
1573
|
if (!merged.valid) {
|
|
1574
|
+
if (util.aborted(result))
|
|
1575
|
+
return result;
|
|
1295
1576
|
throw new Error(`Unmergable intersection. Error path: ` + `${JSON.stringify(merged.mergeErrorPath)}`);
|
|
1296
1577
|
}
|
|
1297
1578
|
result.value = merged.data;
|
|
@@ -1300,6 +1581,8 @@ function handleIntersectionResults(result, left, right) {
|
|
|
1300
1581
|
export const $ZodTuple = /*@__PURE__*/ core.$constructor("$ZodTuple", (inst, def) => {
|
|
1301
1582
|
$ZodType.init(inst, def);
|
|
1302
1583
|
const items = def.items;
|
|
1584
|
+
const memo = core.globalConfig.memoizer;
|
|
1585
|
+
memo?.attach(inst);
|
|
1303
1586
|
inst._zod.parse = (payload, ctx) => {
|
|
1304
1587
|
const input = payload.value;
|
|
1305
1588
|
if (!Array.isArray(input)) {
|
|
@@ -1311,7 +1594,7 @@ export const $ZodTuple = /*@__PURE__*/ core.$constructor("$ZodTuple", (inst, def
|
|
|
1311
1594
|
});
|
|
1312
1595
|
return payload;
|
|
1313
1596
|
}
|
|
1314
|
-
payload.value = [];
|
|
1597
|
+
payload.value = memo ? memo.alloc(inst, payload, [], ctx) : [];
|
|
1315
1598
|
const proms = [];
|
|
1316
1599
|
const optinStart = getTupleOptStart(items, "optin");
|
|
1317
1600
|
const optoutStart = getTupleOptStart(items, "optout");
|
|
@@ -1338,11 +1621,11 @@ export const $ZodTuple = /*@__PURE__*/ core.$constructor("$ZodTuple", (inst, def
|
|
|
1338
1621
|
});
|
|
1339
1622
|
}
|
|
1340
1623
|
}
|
|
1341
|
-
// Run every item in parallel, collecting results into an indexed
|
|
1342
|
-
// array. The post-processing in `handleTupleResults` walks them in
|
|
1343
|
-
// order so it can decide whether an absent optional-output error can
|
|
1344
|
-
// truncate the tail or must be reported to preserve required output.
|
|
1624
|
+
// 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.
|
|
1345
1625
|
const itemResults = new Array(items.length);
|
|
1626
|
+
// only tracked when there is a rest loop to skip
|
|
1627
|
+
const abortEarly = def.rest ? ctx?.abortEarly : undefined;
|
|
1628
|
+
let itemAborted = false;
|
|
1346
1629
|
for (let i = 0; i < items.length; i++) {
|
|
1347
1630
|
const r = items[i]._zod.run({ value: input[i], issues: [] }, ctx);
|
|
1348
1631
|
if (r instanceof Promise) {
|
|
@@ -1352,12 +1635,21 @@ export const $ZodTuple = /*@__PURE__*/ core.$constructor("$ZodTuple", (inst, def
|
|
|
1352
1635
|
}
|
|
1353
1636
|
else {
|
|
1354
1637
|
itemResults[i] = r;
|
|
1638
|
+
if (abortEarly && !itemAborted && r.issues.length)
|
|
1639
|
+
itemAborted = util.aborted(r);
|
|
1355
1640
|
}
|
|
1356
1641
|
}
|
|
1357
|
-
|
|
1642
|
+
// sound because rest is non-empty exactly when every fixed index is present, the one case handleTupleResults cannot discard an item's issues
|
|
1643
|
+
if (def.rest && !itemAborted) {
|
|
1358
1644
|
let i = items.length - 1;
|
|
1359
1645
|
const rest = input.slice(items.length);
|
|
1646
|
+
let seen = payload.issues.length;
|
|
1360
1647
|
for (const el of rest) {
|
|
1648
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
1649
|
+
if (util.aborted(payload, seen))
|
|
1650
|
+
break;
|
|
1651
|
+
seen = payload.issues.length;
|
|
1652
|
+
}
|
|
1361
1653
|
i++;
|
|
1362
1654
|
const result = def.rest._zod.run({ value: el, issues: [] }, ctx);
|
|
1363
1655
|
if (result instanceof Promise) {
|
|
@@ -1376,7 +1668,9 @@ export const $ZodTuple = /*@__PURE__*/ core.$constructor("$ZodTuple", (inst, def
|
|
|
1376
1668
|
});
|
|
1377
1669
|
function getTupleOptStart(items, key) {
|
|
1378
1670
|
for (let i = items.length - 1; i >= 0; i--) {
|
|
1379
|
-
|
|
1671
|
+
// optin is a three-rung ladder so any rung above `undefined` permits an absent slot; optout stays two-valued.
|
|
1672
|
+
const omittable = key === "optin" ? items[i]._zod.optin !== undefined : items[i]._zod.optout === "optional";
|
|
1673
|
+
if (!omittable)
|
|
1380
1674
|
return i + 1;
|
|
1381
1675
|
}
|
|
1382
1676
|
return 0;
|
|
@@ -1388,12 +1682,15 @@ function handleTupleResult(result, final, index) {
|
|
|
1388
1682
|
final.value[index] = result.value;
|
|
1389
1683
|
}
|
|
1390
1684
|
function handleTupleResults(itemResults, final, items, input, optoutStart) {
|
|
1391
|
-
// Walk results in order. Mirror $ZodObject's swallow-on-absent-optional
|
|
1392
|
-
// rule, but only after `optoutStart`: the first index where the output
|
|
1393
|
-
// tuple tail can be absent.
|
|
1685
|
+
// 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.
|
|
1394
1686
|
for (let i = 0; i < items.length; i++) {
|
|
1395
1687
|
const r = itemResults[i];
|
|
1396
1688
|
const isPresent = i < input.length;
|
|
1689
|
+
// 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`.
|
|
1690
|
+
if (!isPresent && i >= optoutStart && items[i]._zod.optin === "optional") {
|
|
1691
|
+
final.value.length = i;
|
|
1692
|
+
break;
|
|
1693
|
+
}
|
|
1397
1694
|
if (r.issues.length) {
|
|
1398
1695
|
if (!isPresent && i >= optoutStart) {
|
|
1399
1696
|
final.value.length = i;
|
|
@@ -1421,6 +1718,8 @@ function handleTupleResults(itemResults, final, items, input, optoutStart) {
|
|
|
1421
1718
|
}
|
|
1422
1719
|
export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, def) => {
|
|
1423
1720
|
$ZodType.init(inst, def);
|
|
1721
|
+
const memo = core.globalConfig.memoizer;
|
|
1722
|
+
memo?.attach(inst);
|
|
1424
1723
|
inst._zod.parse = (payload, ctx) => {
|
|
1425
1724
|
const input = payload.value;
|
|
1426
1725
|
if (!util.isPlainObject(input)) {
|
|
@@ -1432,14 +1731,18 @@ export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, d
|
|
|
1432
1731
|
});
|
|
1433
1732
|
return payload;
|
|
1434
1733
|
}
|
|
1734
|
+
// 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
|
|
1435
1735
|
const proms = [];
|
|
1436
1736
|
const values = def.keyType._zod.values;
|
|
1437
|
-
if (values) {
|
|
1438
|
-
payload.value = {};
|
|
1737
|
+
if (values && !def.partial) {
|
|
1738
|
+
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
1439
1739
|
const recordKeys = new Set();
|
|
1440
1740
|
for (const key of values) {
|
|
1441
1741
|
if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
1442
1742
|
recordKeys.add(typeof key === "number" ? key.toString() : key);
|
|
1743
|
+
// A declared __proto__ is stripped but is not an unrecognized key.
|
|
1744
|
+
if (key === "__proto__")
|
|
1745
|
+
continue;
|
|
1443
1746
|
const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
1444
1747
|
if (keyResult instanceof Promise) {
|
|
1445
1748
|
throw new Error("Async schemas not supported in object keys currently");
|
|
@@ -1456,6 +1759,8 @@ export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, d
|
|
|
1456
1759
|
continue;
|
|
1457
1760
|
}
|
|
1458
1761
|
const outKey = keyResult.value;
|
|
1762
|
+
if (outKey === "__proto__")
|
|
1763
|
+
continue;
|
|
1459
1764
|
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
1460
1765
|
if (result instanceof Promise) {
|
|
1461
1766
|
proms.push(result.then((result) => {
|
|
@@ -1476,8 +1781,16 @@ export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, d
|
|
|
1476
1781
|
let unrecognized;
|
|
1477
1782
|
for (const key in input) {
|
|
1478
1783
|
if (!recordKeys.has(key)) {
|
|
1479
|
-
|
|
1480
|
-
|
|
1784
|
+
if (def.mode === "loose") {
|
|
1785
|
+
// skip __proto__ so it can't replace the result prototype via the assignment setter on the plain {} we build into
|
|
1786
|
+
if (key === "__proto__")
|
|
1787
|
+
continue;
|
|
1788
|
+
payload.value[key] = input[key];
|
|
1789
|
+
}
|
|
1790
|
+
else {
|
|
1791
|
+
unrecognized = unrecognized ?? [];
|
|
1792
|
+
unrecognized.push(key);
|
|
1793
|
+
}
|
|
1481
1794
|
}
|
|
1482
1795
|
}
|
|
1483
1796
|
if (unrecognized && unrecognized.length > 0) {
|
|
@@ -1486,11 +1799,14 @@ export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, d
|
|
|
1486
1799
|
input,
|
|
1487
1800
|
inst,
|
|
1488
1801
|
keys: unrecognized,
|
|
1802
|
+
continue: true,
|
|
1489
1803
|
});
|
|
1490
1804
|
}
|
|
1491
1805
|
}
|
|
1492
1806
|
else {
|
|
1493
|
-
payload.value = {};
|
|
1807
|
+
payload.value = memo ? memo.alloc(inst, payload, {}, ctx) : {};
|
|
1808
|
+
// 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.
|
|
1809
|
+
let unrecognized;
|
|
1494
1810
|
// Reflect.ownKeys for Symbol-key support; filter non-enumerable to match z.object()
|
|
1495
1811
|
for (const key of Reflect.ownKeys(input)) {
|
|
1496
1812
|
if (key === "__proto__")
|
|
@@ -1501,8 +1817,7 @@ export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, d
|
|
|
1501
1817
|
if (keyResult instanceof Promise) {
|
|
1502
1818
|
throw new Error("Async schemas not supported in object keys currently");
|
|
1503
1819
|
}
|
|
1504
|
-
// Numeric string fallback: if key is a numeric string and failed, retry with Number(key)
|
|
1505
|
-
// This handles z.number(), z.literal([1, 2, 3]), and unions containing numeric literals
|
|
1820
|
+
// 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
|
|
1506
1821
|
const checkNumericKey = typeof key === "string" && regexes.number.test(key) && keyResult.issues.length;
|
|
1507
1822
|
if (checkNumericKey) {
|
|
1508
1823
|
const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
|
|
@@ -1518,6 +1833,10 @@ export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, d
|
|
|
1518
1833
|
// Pass through unchanged
|
|
1519
1834
|
payload.value[key] = input[key];
|
|
1520
1835
|
}
|
|
1836
|
+
else if (values) {
|
|
1837
|
+
unrecognized = unrecognized ?? [];
|
|
1838
|
+
unrecognized.push(key);
|
|
1839
|
+
}
|
|
1521
1840
|
else {
|
|
1522
1841
|
// Default "strict" behavior: error on invalid key
|
|
1523
1842
|
payload.issues.push({
|
|
@@ -1531,22 +1850,35 @@ export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, d
|
|
|
1531
1850
|
}
|
|
1532
1851
|
continue;
|
|
1533
1852
|
}
|
|
1853
|
+
// 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
|
|
1854
|
+
const outKey = keyResult.value;
|
|
1855
|
+
if (outKey === "__proto__")
|
|
1856
|
+
continue;
|
|
1534
1857
|
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
1535
1858
|
if (result instanceof Promise) {
|
|
1536
1859
|
proms.push(result.then((result) => {
|
|
1537
1860
|
if (result.issues.length) {
|
|
1538
1861
|
payload.issues.push(...util.prefixIssues(key, result.issues));
|
|
1539
1862
|
}
|
|
1540
|
-
payload.value[
|
|
1863
|
+
payload.value[outKey] = result.value;
|
|
1541
1864
|
}));
|
|
1542
1865
|
}
|
|
1543
1866
|
else {
|
|
1544
1867
|
if (result.issues.length) {
|
|
1545
1868
|
payload.issues.push(...util.prefixIssues(key, result.issues));
|
|
1546
1869
|
}
|
|
1547
|
-
payload.value[
|
|
1870
|
+
payload.value[outKey] = result.value;
|
|
1548
1871
|
}
|
|
1549
1872
|
}
|
|
1873
|
+
if (unrecognized && unrecognized.length > 0) {
|
|
1874
|
+
payload.issues.push({
|
|
1875
|
+
code: "unrecognized_keys",
|
|
1876
|
+
input,
|
|
1877
|
+
inst,
|
|
1878
|
+
keys: unrecognized,
|
|
1879
|
+
continue: true,
|
|
1880
|
+
});
|
|
1881
|
+
}
|
|
1550
1882
|
}
|
|
1551
1883
|
if (proms.length) {
|
|
1552
1884
|
return Promise.all(proms).then(() => payload);
|
|
@@ -1556,6 +1888,8 @@ export const $ZodRecord = /*@__PURE__*/ core.$constructor("$ZodRecord", (inst, d
|
|
|
1556
1888
|
});
|
|
1557
1889
|
export const $ZodMap = /*@__PURE__*/ core.$constructor("$ZodMap", (inst, def) => {
|
|
1558
1890
|
$ZodType.init(inst, def);
|
|
1891
|
+
const memo = core.globalConfig.memoizer;
|
|
1892
|
+
memo?.attach(inst);
|
|
1559
1893
|
inst._zod.parse = (payload, ctx) => {
|
|
1560
1894
|
const input = payload.value;
|
|
1561
1895
|
if (!(input instanceof Map)) {
|
|
@@ -1568,8 +1902,15 @@ export const $ZodMap = /*@__PURE__*/ core.$constructor("$ZodMap", (inst, def) =>
|
|
|
1568
1902
|
return payload;
|
|
1569
1903
|
}
|
|
1570
1904
|
const proms = [];
|
|
1571
|
-
payload.value = new Map();
|
|
1905
|
+
payload.value = memo ? memo.alloc(inst, payload, new Map(), ctx) : new Map();
|
|
1906
|
+
const abortEarly = ctx?.abortEarly;
|
|
1907
|
+
let seen = payload.issues.length;
|
|
1572
1908
|
for (const [key, value] of input) {
|
|
1909
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
1910
|
+
if (util.aborted(payload, seen))
|
|
1911
|
+
break;
|
|
1912
|
+
seen = payload.issues.length;
|
|
1913
|
+
}
|
|
1573
1914
|
const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
1574
1915
|
const valueResult = def.valueType._zod.run({ value: value, issues: [] }, ctx);
|
|
1575
1916
|
if (keyResult instanceof Promise || valueResult instanceof Promise) {
|
|
@@ -1585,6 +1926,7 @@ export const $ZodMap = /*@__PURE__*/ core.$constructor("$ZodMap", (inst, def) =>
|
|
|
1585
1926
|
return Promise.all(proms).then(() => payload);
|
|
1586
1927
|
return payload;
|
|
1587
1928
|
};
|
|
1929
|
+
capSize(inst, mapSize);
|
|
1588
1930
|
});
|
|
1589
1931
|
function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
1590
1932
|
if (keyResult.issues.length) {
|
|
@@ -1620,6 +1962,8 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
|
|
|
1620
1962
|
}
|
|
1621
1963
|
export const $ZodSet = /*@__PURE__*/ core.$constructor("$ZodSet", (inst, def) => {
|
|
1622
1964
|
$ZodType.init(inst, def);
|
|
1965
|
+
const memo = core.globalConfig.memoizer;
|
|
1966
|
+
memo?.attach(inst);
|
|
1623
1967
|
inst._zod.parse = (payload, ctx) => {
|
|
1624
1968
|
const input = payload.value;
|
|
1625
1969
|
if (!(input instanceof Set)) {
|
|
@@ -1632,8 +1976,15 @@ export const $ZodSet = /*@__PURE__*/ core.$constructor("$ZodSet", (inst, def) =>
|
|
|
1632
1976
|
return payload;
|
|
1633
1977
|
}
|
|
1634
1978
|
const proms = [];
|
|
1635
|
-
payload.value = new Set();
|
|
1979
|
+
payload.value = memo ? memo.alloc(inst, payload, new Set(), ctx) : new Set();
|
|
1980
|
+
const abortEarly = ctx?.abortEarly;
|
|
1981
|
+
let seen = payload.issues.length;
|
|
1636
1982
|
for (const item of input) {
|
|
1983
|
+
if (abortEarly && payload.issues.length !== seen) {
|
|
1984
|
+
if (util.aborted(payload, seen))
|
|
1985
|
+
break;
|
|
1986
|
+
seen = payload.issues.length;
|
|
1987
|
+
}
|
|
1637
1988
|
const result = def.valueType._zod.run({ value: item, issues: [] }, ctx);
|
|
1638
1989
|
if (result instanceof Promise) {
|
|
1639
1990
|
proms.push(result.then((result) => handleSetResult(result, payload)));
|
|
@@ -1645,6 +1996,7 @@ export const $ZodSet = /*@__PURE__*/ core.$constructor("$ZodSet", (inst, def) =>
|
|
|
1645
1996
|
return Promise.all(proms).then(() => payload);
|
|
1646
1997
|
return payload;
|
|
1647
1998
|
};
|
|
1999
|
+
capSize(inst, setSize);
|
|
1648
2000
|
});
|
|
1649
2001
|
function handleSetResult(result, final) {
|
|
1650
2002
|
if (result.issues.length) {
|
|
@@ -1657,10 +2009,11 @@ export const $ZodEnum = /*@__PURE__*/ core.$constructor("$ZodEnum", (inst, def)
|
|
|
1657
2009
|
const values = util.getEnumValues(def.entries);
|
|
1658
2010
|
const valuesSet = new Set(values);
|
|
1659
2011
|
inst._zod.values = valuesSet;
|
|
1660
|
-
inst
|
|
1661
|
-
.filter((k) => util.propertyKeyTypes.has(typeof k))
|
|
1662
|
-
|
|
1663
|
-
.join("|")})$`);
|
|
2012
|
+
util.defineLazyInternal(inst, "pattern", (zod) => {
|
|
2013
|
+
const patternValues = util.getEnumValues(zod.def.entries).filter((k) => util.propertyKeyTypes.has(typeof k));
|
|
2014
|
+
// unmatchable fallback, RE2-safe: an empty alternation would compile to /^()$/, which matches ""
|
|
2015
|
+
return new RegExp(patternValues.length ? `^(${patternValues.map((o) => util.escapeRegex(o.toString())).join("|")})$` : "^[^\\s\\S]$");
|
|
2016
|
+
});
|
|
1664
2017
|
inst._zod.parse = (payload, _ctx) => {
|
|
1665
2018
|
const input = payload.value;
|
|
1666
2019
|
if (valuesSet.has(input)) {
|
|
@@ -1677,14 +2030,17 @@ export const $ZodEnum = /*@__PURE__*/ core.$constructor("$ZodEnum", (inst, def)
|
|
|
1677
2030
|
});
|
|
1678
2031
|
export const $ZodLiteral = /*@__PURE__*/ core.$constructor("$ZodLiteral", (inst, def) => {
|
|
1679
2032
|
$ZodType.init(inst, def);
|
|
1680
|
-
if (def.values.length === 0) {
|
|
1681
|
-
throw new Error("Cannot create literal schema with no valid values");
|
|
1682
|
-
}
|
|
1683
2033
|
const values = new Set(def.values);
|
|
1684
2034
|
inst._zod.values = values;
|
|
1685
|
-
inst
|
|
1686
|
-
|
|
1687
|
-
|
|
2035
|
+
util.defineLazyInternal(inst, "pattern", (zod) => {
|
|
2036
|
+
const vals = zod.def.values;
|
|
2037
|
+
// unmatchable fallback, RE2-safe: an empty alternation would compile to /^()$/, which matches ""
|
|
2038
|
+
return new RegExp(vals.length
|
|
2039
|
+
? `^(${vals
|
|
2040
|
+
.map((o) => typeof o === "string" ? util.escapeRegex(o) : o ? util.escapeRegex(o.toString()) : String(o))
|
|
2041
|
+
.join("|")})$`
|
|
2042
|
+
: "^[^\\s\\S]$");
|
|
2043
|
+
});
|
|
1688
2044
|
inst._zod.parse = (payload, _ctx) => {
|
|
1689
2045
|
const input = payload.value;
|
|
1690
2046
|
if (values.has(input)) {
|
|
@@ -1718,6 +2074,7 @@ export const $ZodFile = /*@__PURE__*/ core.$constructor("$ZodFile", (inst, def)
|
|
|
1718
2074
|
export const $ZodTransform = /*@__PURE__*/ core.$constructor("$ZodTransform", (inst, def) => {
|
|
1719
2075
|
$ZodType.init(inst, def);
|
|
1720
2076
|
inst._zod.optin = "optional";
|
|
2077
|
+
core.globalConfig.memoizer?.guard(inst);
|
|
1721
2078
|
inst._zod.parse = (payload, ctx) => {
|
|
1722
2079
|
if (ctx.direction === "backward") {
|
|
1723
2080
|
throw new core.$ZodEncodeError(inst.constructor.name);
|
|
@@ -1727,7 +2084,6 @@ export const $ZodTransform = /*@__PURE__*/ core.$constructor("$ZodTransform", (i
|
|
|
1727
2084
|
const output = _out instanceof Promise ? _out : Promise.resolve(_out);
|
|
1728
2085
|
return output.then((output) => {
|
|
1729
2086
|
payload.value = output;
|
|
1730
|
-
payload.fallback = true;
|
|
1731
2087
|
return payload;
|
|
1732
2088
|
});
|
|
1733
2089
|
}
|
|
@@ -1735,37 +2091,37 @@ export const $ZodTransform = /*@__PURE__*/ core.$constructor("$ZodTransform", (i
|
|
|
1735
2091
|
throw new core.$ZodAsyncError();
|
|
1736
2092
|
}
|
|
1737
2093
|
payload.value = _out;
|
|
1738
|
-
payload.fallback = true;
|
|
1739
2094
|
return payload;
|
|
1740
2095
|
};
|
|
1741
2096
|
});
|
|
1742
|
-
function handleOptionalResult(
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
return result;
|
|
2097
|
+
function handleOptionalResult(payload, result) {
|
|
2098
|
+
// 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.
|
|
2099
|
+
payload.value = result.issues.length ? undefined : result.value;
|
|
2100
|
+
return payload;
|
|
1747
2101
|
}
|
|
1748
2102
|
export const $ZodOptional = /*@__PURE__*/ core.$constructor("$ZodOptional", (inst, def) => {
|
|
1749
2103
|
$ZodType.init(inst, def);
|
|
1750
|
-
|
|
2104
|
+
// .optional() propagates absence rather than substituting for it, so a defaulted inner keeps its rung.
|
|
2105
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
|
|
1751
2106
|
inst._zod.optout = "optional";
|
|
1752
|
-
util.
|
|
1753
|
-
|
|
2107
|
+
util.defineLazyInternal(inst, "values", (zod) => {
|
|
2108
|
+
const values = zod.def.innerType._zod.values;
|
|
2109
|
+
return values ? new Set([...values, undefined]) : undefined;
|
|
1754
2110
|
});
|
|
1755
|
-
util.
|
|
1756
|
-
const pattern = def.innerType._zod.pattern;
|
|
2111
|
+
util.defineLazyInternal(inst, "pattern", (zod) => {
|
|
2112
|
+
const pattern = zod.def.innerType._zod.pattern;
|
|
1757
2113
|
return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)})?$`) : undefined;
|
|
1758
2114
|
});
|
|
1759
2115
|
inst._zod.parse = (payload, ctx) => {
|
|
1760
|
-
if (def.innerType._zod.optin === "optional") {
|
|
1761
|
-
const input = payload.value;
|
|
1762
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
1763
|
-
if (result instanceof Promise)
|
|
1764
|
-
return result.then((r) => handleOptionalResult(r, input));
|
|
1765
|
-
return handleOptionalResult(result, input);
|
|
1766
|
-
}
|
|
1767
2116
|
if (payload.value === undefined) {
|
|
1768
|
-
|
|
2117
|
+
// Only the top rung substitutes a value for absence; everything else leaves it intact, which is what .optional() means.
|
|
2118
|
+
if (def.innerType._zod.optin !== "defaulted")
|
|
2119
|
+
return payload;
|
|
2120
|
+
// 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.
|
|
2121
|
+
const result = def.innerType._zod.run({ value: payload.value, issues: [] }, ctx);
|
|
2122
|
+
if (result instanceof Promise)
|
|
2123
|
+
return result.then((result) => handleOptionalResult(payload, result));
|
|
2124
|
+
return handleOptionalResult(payload, result);
|
|
1769
2125
|
}
|
|
1770
2126
|
return def.innerType._zod.run(payload, ctx);
|
|
1771
2127
|
};
|
|
@@ -1774,8 +2130,8 @@ export const $ZodExactOptional = /*@__PURE__*/ core.$constructor("$ZodExactOptio
|
|
|
1774
2130
|
// Call parent init - inherits optin/optout = "optional"
|
|
1775
2131
|
$ZodOptional.init(inst, def);
|
|
1776
2132
|
// Override values/pattern to NOT add undefined
|
|
1777
|
-
util.
|
|
1778
|
-
util.
|
|
2133
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2134
|
+
util.defineLazyInternal(inst, "pattern", (zod) => zod.def.innerType._zod.pattern);
|
|
1779
2135
|
// Override parse to just delegate (no undefined handling)
|
|
1780
2136
|
inst._zod.parse = (payload, ctx) => {
|
|
1781
2137
|
return def.innerType._zod.run(payload, ctx);
|
|
@@ -1783,14 +2139,14 @@ export const $ZodExactOptional = /*@__PURE__*/ core.$constructor("$ZodExactOptio
|
|
|
1783
2139
|
});
|
|
1784
2140
|
export const $ZodNullable = /*@__PURE__*/ core.$constructor("$ZodNullable", (inst, def) => {
|
|
1785
2141
|
$ZodType.init(inst, def);
|
|
1786
|
-
util.
|
|
1787
|
-
util.
|
|
1788
|
-
util.
|
|
1789
|
-
const pattern = def.innerType._zod.pattern;
|
|
2142
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin);
|
|
2143
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
|
|
2144
|
+
util.defineLazyInternal(inst, "pattern", (zod) => {
|
|
2145
|
+
const pattern = zod.def.innerType._zod.pattern;
|
|
1790
2146
|
return pattern ? new RegExp(`^(${util.cleanRegex(pattern.source)}|null)$`) : undefined;
|
|
1791
2147
|
});
|
|
1792
|
-
util.
|
|
1793
|
-
return def.innerType._zod.values ? new Set([...def.innerType._zod.values, null]) : undefined;
|
|
2148
|
+
util.defineLazyInternal(inst, "values", (zod) => {
|
|
2149
|
+
return zod.def.innerType._zod.values ? new Set([...zod.def.innerType._zod.values, null]) : undefined;
|
|
1794
2150
|
});
|
|
1795
2151
|
inst._zod.parse = (payload, ctx) => {
|
|
1796
2152
|
// Forward direction (decode): allow null to pass through
|
|
@@ -1802,8 +2158,8 @@ export const $ZodNullable = /*@__PURE__*/ core.$constructor("$ZodNullable", (ins
|
|
|
1802
2158
|
export const $ZodDefault = /*@__PURE__*/ core.$constructor("$ZodDefault", (inst, def) => {
|
|
1803
2159
|
$ZodType.init(inst, def);
|
|
1804
2160
|
// inst._zod.qin = "true";
|
|
1805
|
-
inst._zod.optin = "
|
|
1806
|
-
util.
|
|
2161
|
+
inst._zod.optin = "defaulted";
|
|
2162
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
1807
2163
|
inst._zod.parse = (payload, ctx) => {
|
|
1808
2164
|
if (ctx.direction === "backward") {
|
|
1809
2165
|
return def.innerType._zod.run(payload, ctx);
|
|
@@ -1832,8 +2188,8 @@ function handleDefaultResult(payload, def) {
|
|
|
1832
2188
|
}
|
|
1833
2189
|
export const $ZodPrefault = /*@__PURE__*/ core.$constructor("$ZodPrefault", (inst, def) => {
|
|
1834
2190
|
$ZodType.init(inst, def);
|
|
1835
|
-
inst._zod.optin = "
|
|
1836
|
-
util.
|
|
2191
|
+
inst._zod.optin = "defaulted";
|
|
2192
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
1837
2193
|
inst._zod.parse = (payload, ctx) => {
|
|
1838
2194
|
if (ctx.direction === "backward") {
|
|
1839
2195
|
return def.innerType._zod.run(payload, ctx);
|
|
@@ -1847,8 +2203,8 @@ export const $ZodPrefault = /*@__PURE__*/ core.$constructor("$ZodPrefault", (ins
|
|
|
1847
2203
|
});
|
|
1848
2204
|
export const $ZodNonOptional = /*@__PURE__*/ core.$constructor("$ZodNonOptional", (inst, def) => {
|
|
1849
2205
|
$ZodType.init(inst, def);
|
|
1850
|
-
util.
|
|
1851
|
-
const v = def.innerType._zod.values;
|
|
2206
|
+
util.defineLazyInternal(inst, "values", (zod) => {
|
|
2207
|
+
const v = zod.def.innerType._zod.values;
|
|
1852
2208
|
return v ? new Set([...v].filter((x) => x !== undefined)) : undefined;
|
|
1853
2209
|
});
|
|
1854
2210
|
inst._zod.parse = (payload, ctx) => {
|
|
@@ -1887,47 +2243,40 @@ export const $ZodSuccess = /*@__PURE__*/ core.$constructor("$ZodSuccess", (inst,
|
|
|
1887
2243
|
return payload;
|
|
1888
2244
|
};
|
|
1889
2245
|
});
|
|
2246
|
+
function handleCatchResult(payload, result, def, ctx) {
|
|
2247
|
+
if (!result.issues.length) {
|
|
2248
|
+
payload.value = result.value;
|
|
2249
|
+
// 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.
|
|
2250
|
+
if (result.memo)
|
|
2251
|
+
payload.memo = true;
|
|
2252
|
+
return payload;
|
|
2253
|
+
}
|
|
2254
|
+
// 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.
|
|
2255
|
+
payload.value = def.catchValue({
|
|
2256
|
+
...result,
|
|
2257
|
+
value: payload.value,
|
|
2258
|
+
error: {
|
|
2259
|
+
issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
|
|
2260
|
+
},
|
|
2261
|
+
input: payload.value,
|
|
2262
|
+
});
|
|
2263
|
+
return payload;
|
|
2264
|
+
}
|
|
1890
2265
|
export const $ZodCatch = /*@__PURE__*/ core.$constructor("$ZodCatch", (inst, def) => {
|
|
1891
2266
|
$ZodType.init(inst, def);
|
|
1892
|
-
inst._zod.optin
|
|
1893
|
-
util.
|
|
1894
|
-
util.
|
|
2267
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.innerType._zod.optin === "defaulted" ? "defaulted" : "optional");
|
|
2268
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.def.innerType._zod.optout);
|
|
2269
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
1895
2270
|
inst._zod.parse = (payload, ctx) => {
|
|
1896
2271
|
if (ctx.direction === "backward") {
|
|
1897
2272
|
return def.innerType._zod.run(payload, ctx);
|
|
1898
2273
|
}
|
|
1899
2274
|
// Forward direction (decode): apply catch logic
|
|
1900
|
-
const result = def.innerType._zod.run(payload, ctx);
|
|
2275
|
+
const result = def.innerType._zod.run({ value: payload.value, issues: [] }, ctx);
|
|
1901
2276
|
if (result instanceof Promise) {
|
|
1902
|
-
return result.then((result) =>
|
|
1903
|
-
payload.value = result.value;
|
|
1904
|
-
if (result.issues.length) {
|
|
1905
|
-
payload.value = def.catchValue({
|
|
1906
|
-
...payload,
|
|
1907
|
-
error: {
|
|
1908
|
-
issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
|
|
1909
|
-
},
|
|
1910
|
-
input: payload.value,
|
|
1911
|
-
});
|
|
1912
|
-
payload.issues = [];
|
|
1913
|
-
payload.fallback = true;
|
|
1914
|
-
}
|
|
1915
|
-
return payload;
|
|
1916
|
-
});
|
|
2277
|
+
return result.then((result) => handleCatchResult(payload, result, def, ctx));
|
|
1917
2278
|
}
|
|
1918
|
-
payload
|
|
1919
|
-
if (result.issues.length) {
|
|
1920
|
-
payload.value = def.catchValue({
|
|
1921
|
-
...payload,
|
|
1922
|
-
error: {
|
|
1923
|
-
issues: result.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
|
|
1924
|
-
},
|
|
1925
|
-
input: payload.value,
|
|
1926
|
-
});
|
|
1927
|
-
payload.issues = [];
|
|
1928
|
-
payload.fallback = true;
|
|
1929
|
-
}
|
|
1930
|
-
return payload;
|
|
2279
|
+
return handleCatchResult(payload, result, def, ctx);
|
|
1931
2280
|
};
|
|
1932
2281
|
});
|
|
1933
2282
|
export const $ZodNaN = /*@__PURE__*/ core.$constructor("$ZodNaN", (inst, def) => {
|
|
@@ -1947,10 +2296,10 @@ export const $ZodNaN = /*@__PURE__*/ core.$constructor("$ZodNaN", (inst, def) =>
|
|
|
1947
2296
|
});
|
|
1948
2297
|
export const $ZodPipe = /*@__PURE__*/ core.$constructor("$ZodPipe", (inst, def) => {
|
|
1949
2298
|
$ZodType.init(inst, def);
|
|
1950
|
-
util.
|
|
1951
|
-
util.
|
|
1952
|
-
util.
|
|
1953
|
-
util.
|
|
2299
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.in._zod.values);
|
|
2300
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.in._zod.optin);
|
|
2301
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.def.out._zod.optout);
|
|
2302
|
+
util.defineLazyInternal(inst, "propValues", (zod) => zod.def.in._zod.propValues);
|
|
1954
2303
|
inst._zod.parse = (payload, ctx) => {
|
|
1955
2304
|
if (ctx.direction === "backward") {
|
|
1956
2305
|
const right = def.out._zod.run(payload, ctx);
|
|
@@ -1967,19 +2316,20 @@ export const $ZodPipe = /*@__PURE__*/ core.$constructor("$ZodPipe", (inst, def)
|
|
|
1967
2316
|
};
|
|
1968
2317
|
});
|
|
1969
2318
|
function handlePipeResult(left, next, ctx) {
|
|
1970
|
-
|
|
2319
|
+
// 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.
|
|
2320
|
+
if (left.issues.some((iss) => iss.code !== "unrecognized_keys")) {
|
|
1971
2321
|
// prevent further checks
|
|
1972
2322
|
left.aborted = true;
|
|
1973
2323
|
return left;
|
|
1974
2324
|
}
|
|
1975
|
-
return next._zod.run({ value: left.value, issues: left.issues
|
|
2325
|
+
return next._zod.run({ value: left.value, issues: left.issues }, ctx);
|
|
1976
2326
|
}
|
|
1977
2327
|
export const $ZodCodec = /*@__PURE__*/ core.$constructor("$ZodCodec", (inst, def) => {
|
|
1978
2328
|
$ZodType.init(inst, def);
|
|
1979
|
-
util.
|
|
1980
|
-
util.
|
|
1981
|
-
util.
|
|
1982
|
-
util.
|
|
2329
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.in._zod.values);
|
|
2330
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.in._zod.optin);
|
|
2331
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.def.out._zod.optout);
|
|
2332
|
+
util.defineLazyInternal(inst, "propValues", (zod) => zod.def.in._zod.propValues);
|
|
1983
2333
|
inst._zod.parse = (payload, ctx) => {
|
|
1984
2334
|
const direction = ctx.direction || "forward";
|
|
1985
2335
|
if (direction === "forward") {
|
|
@@ -2033,10 +2383,10 @@ export const $ZodPreprocess = /*@__PURE__*/ core.$constructor("$ZodPreprocess",
|
|
|
2033
2383
|
});
|
|
2034
2384
|
export const $ZodReadonly = /*@__PURE__*/ core.$constructor("$ZodReadonly", (inst, def) => {
|
|
2035
2385
|
$ZodType.init(inst, def);
|
|
2036
|
-
util.
|
|
2037
|
-
util.
|
|
2038
|
-
util.
|
|
2039
|
-
util.
|
|
2386
|
+
util.defineLazyInternal(inst, "propValues", (zod) => zod.def.innerType._zod.propValues);
|
|
2387
|
+
util.defineLazyInternal(inst, "values", (zod) => zod.def.innerType._zod.values);
|
|
2388
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.def.innerType?._zod?.optin);
|
|
2389
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.def.innerType?._zod?.optout);
|
|
2040
2390
|
inst._zod.parse = (payload, ctx) => {
|
|
2041
2391
|
if (ctx.direction === "backward") {
|
|
2042
2392
|
return def.innerType._zod.run(payload, ctx);
|
|
@@ -2049,25 +2399,72 @@ export const $ZodReadonly = /*@__PURE__*/ core.$constructor("$ZodReadonly", (ins
|
|
|
2049
2399
|
};
|
|
2050
2400
|
});
|
|
2051
2401
|
function handleReadonlyResult(payload) {
|
|
2052
|
-
|
|
2402
|
+
// 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.
|
|
2403
|
+
if (!payload.memo)
|
|
2404
|
+
payload.value = Object.freeze(payload.value);
|
|
2053
2405
|
return payload;
|
|
2054
2406
|
}
|
|
2407
|
+
// 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
|
|
2408
|
+
function leafPattern(schema) {
|
|
2409
|
+
const def = schema._zod.def;
|
|
2410
|
+
let pattern = def.pattern;
|
|
2411
|
+
let isInt = !!def.format?.includes("int");
|
|
2412
|
+
let minimum;
|
|
2413
|
+
let maximum;
|
|
2414
|
+
for (const ch of def.checks ?? []) {
|
|
2415
|
+
const d = ch._zod.def;
|
|
2416
|
+
if (d.pattern)
|
|
2417
|
+
pattern = d.pattern;
|
|
2418
|
+
isInt || (isInt = !!d.format?.includes("int"));
|
|
2419
|
+
const lo = d.minimum ?? d.length;
|
|
2420
|
+
const hi = d.maximum ?? d.length;
|
|
2421
|
+
if (lo !== undefined && (minimum === undefined || lo > minimum))
|
|
2422
|
+
minimum = lo;
|
|
2423
|
+
if (hi !== undefined && (maximum === undefined || hi < maximum))
|
|
2424
|
+
maximum = hi;
|
|
2425
|
+
}
|
|
2426
|
+
if (pattern)
|
|
2427
|
+
return pattern.source;
|
|
2428
|
+
// an empty range matches nothing at runtime, and `{8,5}` is not a legal quantifier
|
|
2429
|
+
if (minimum !== undefined && maximum !== undefined && minimum > maximum)
|
|
2430
|
+
return "(?!)";
|
|
2431
|
+
if (minimum !== undefined || maximum !== undefined)
|
|
2432
|
+
return regexes.string({ minimum, maximum }).source;
|
|
2433
|
+
const own = schema._zod.pattern;
|
|
2434
|
+
return (isInt && own === regexes.number ? regexes.integer : own)?.source;
|
|
2435
|
+
}
|
|
2436
|
+
// 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
|
|
2437
|
+
function partPattern(schema) {
|
|
2438
|
+
const def = schema._zod.def;
|
|
2439
|
+
const own = schema._zod.pattern?.source;
|
|
2440
|
+
// lazy resolves its inner on the internals, not the def
|
|
2441
|
+
const inner = def.innerType ?? schema._zod.innerType;
|
|
2442
|
+
if (inner) {
|
|
2443
|
+
const before = inner._zod.pattern?.source;
|
|
2444
|
+
const after = partPattern(inner);
|
|
2445
|
+
if (own && before && after && after !== before) {
|
|
2446
|
+
return own.replace(util.cleanRegex(before), () => util.cleanRegex(after));
|
|
2447
|
+
}
|
|
2448
|
+
return own;
|
|
2449
|
+
}
|
|
2450
|
+
if (def.options) {
|
|
2451
|
+
const sources = def.options.map(partPattern);
|
|
2452
|
+
if (sources.every(Boolean))
|
|
2453
|
+
return `^(${sources.map((s) => util.cleanRegex(s)).join("|")})$`;
|
|
2454
|
+
}
|
|
2455
|
+
return leafPattern(schema);
|
|
2456
|
+
}
|
|
2055
2457
|
export const $ZodTemplateLiteral = /*@__PURE__*/ core.$constructor("$ZodTemplateLiteral", (inst, def) => {
|
|
2056
2458
|
$ZodType.init(inst, def);
|
|
2057
2459
|
const regexParts = [];
|
|
2058
2460
|
for (const part of def.parts) {
|
|
2059
2461
|
if (typeof part === "object" && part !== null) {
|
|
2060
2462
|
// is Zod schema
|
|
2061
|
-
|
|
2062
|
-
|
|
2463
|
+
const source = partPattern(part);
|
|
2464
|
+
if (!source) {
|
|
2063
2465
|
throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);
|
|
2064
2466
|
}
|
|
2065
|
-
|
|
2066
|
-
if (!source)
|
|
2067
|
-
throw new Error(`Invalid template literal part: ${part._zod.traits}`);
|
|
2068
|
-
const start = source.startsWith("^") ? 1 : 0;
|
|
2069
|
-
const end = source.endsWith("$") ? source.length - 1 : source.length;
|
|
2070
|
-
regexParts.push(source.slice(start, end));
|
|
2467
|
+
regexParts.push(util.cleanRegex(source));
|
|
2071
2468
|
}
|
|
2072
2469
|
else if (part === null || util.primitiveTypes.has(typeof part)) {
|
|
2073
2470
|
regexParts.push(util.escapeRegex(`${part}`));
|
|
@@ -2103,33 +2500,35 @@ export const $ZodTemplateLiteral = /*@__PURE__*/ core.$constructor("$ZodTemplate
|
|
|
2103
2500
|
});
|
|
2104
2501
|
export const $ZodFunction = /*@__PURE__*/ core.$constructor("$ZodFunction", (inst, def) => {
|
|
2105
2502
|
$ZodType.init(inst, def);
|
|
2106
|
-
|
|
2503
|
+
// Defined, not assigned: the classic prototype exposes `_def` as a getter with no setter.
|
|
2504
|
+
Object.defineProperty(inst, "_def", { value: def });
|
|
2107
2505
|
inst._zod.def = def;
|
|
2108
2506
|
inst.implement = (func) => {
|
|
2109
2507
|
if (typeof func !== "function") {
|
|
2110
2508
|
throw new Error("implement() must be called with a function");
|
|
2111
2509
|
}
|
|
2112
|
-
|
|
2510
|
+
// Defined inline so the closure stays anonymous: binding it to a `const` first names it, which costs 256 bytes per implemented function.
|
|
2511
|
+
return Object.defineProperty(function (...args) {
|
|
2113
2512
|
const parsedArgs = inst._def.input ? parse(inst._def.input, args) : args;
|
|
2114
2513
|
const result = Reflect.apply(func, this, parsedArgs);
|
|
2115
2514
|
if (inst._def.output) {
|
|
2116
2515
|
return parse(inst._def.output, result);
|
|
2117
2516
|
}
|
|
2118
2517
|
return result;
|
|
2119
|
-
};
|
|
2518
|
+
}, "_zod", { value: inst._zod, enumerable: false });
|
|
2120
2519
|
};
|
|
2121
2520
|
inst.implementAsync = (func) => {
|
|
2122
2521
|
if (typeof func !== "function") {
|
|
2123
2522
|
throw new Error("implementAsync() must be called with a function");
|
|
2124
2523
|
}
|
|
2125
|
-
return async function (...args) {
|
|
2524
|
+
return Object.defineProperty(async function (...args) {
|
|
2126
2525
|
const parsedArgs = inst._def.input ? await parseAsync(inst._def.input, args) : args;
|
|
2127
2526
|
const result = await Reflect.apply(func, this, parsedArgs);
|
|
2128
2527
|
if (inst._def.output) {
|
|
2129
2528
|
return await parseAsync(inst._def.output, result);
|
|
2130
2529
|
}
|
|
2131
2530
|
return result;
|
|
2132
|
-
};
|
|
2531
|
+
}, "_zod", { value: inst._zod, enumerable: false });
|
|
2133
2532
|
};
|
|
2134
2533
|
inst._zod.parse = (payload, _ctx) => {
|
|
2135
2534
|
if (typeof payload.value !== "function") {
|
|
@@ -2188,19 +2587,17 @@ export const $ZodPromise = /*@__PURE__*/ core.$constructor("$ZodPromise", (inst,
|
|
|
2188
2587
|
});
|
|
2189
2588
|
export const $ZodLazy = /*@__PURE__*/ core.$constructor("$ZodLazy", (inst, def) => {
|
|
2190
2589
|
$ZodType.init(inst, def);
|
|
2191
|
-
// Cache the resolved inner type on the shared `def` so all clones of this
|
|
2192
|
-
// lazy (e.g. via `.describe()`/`.meta()`) share the same inner instance,
|
|
2193
|
-
// preserving identity for cycle detection on recursive schemas.
|
|
2590
|
+
// 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.
|
|
2194
2591
|
util.defineLazy(inst._zod, "innerType", () => {
|
|
2195
2592
|
const d = def;
|
|
2196
2593
|
if (!d._cachedInner)
|
|
2197
2594
|
d._cachedInner = def.getter();
|
|
2198
2595
|
return d._cachedInner;
|
|
2199
2596
|
});
|
|
2200
|
-
util.
|
|
2201
|
-
util.
|
|
2202
|
-
util.
|
|
2203
|
-
util.
|
|
2597
|
+
util.defineLazyInternal(inst, "pattern", (zod) => zod.innerType?._zod?.pattern);
|
|
2598
|
+
util.defineLazyInternal(inst, "propValues", (zod) => zod.innerType?._zod?.propValues);
|
|
2599
|
+
util.defineLazyInternal(inst, "optin", (zod) => zod.innerType?._zod?.optin ?? undefined);
|
|
2600
|
+
util.defineLazyInternal(inst, "optout", (zod) => zod.innerType?._zod?.optout ?? undefined);
|
|
2204
2601
|
inst._zod.parse = (payload, ctx) => {
|
|
2205
2602
|
const inner = inst._zod.innerType;
|
|
2206
2603
|
return inner._zod.run(payload, ctx);
|