@weavelogic/knowledge-graph-agent 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +686 -304
- package/dist/_virtual/_commonjsHelpers.js +7 -0
- package/dist/_virtual/_commonjsHelpers.js.map +1 -0
- package/dist/_virtual/additionalItems.js +5 -0
- package/dist/_virtual/additionalItems.js.map +1 -0
- package/dist/_virtual/additionalProperties.js +5 -0
- package/dist/_virtual/additionalProperties.js.map +1 -0
- package/dist/_virtual/ajv.js +6 -0
- package/dist/_virtual/ajv.js.map +1 -0
- package/dist/_virtual/ajv2.js +5 -0
- package/dist/_virtual/ajv2.js.map +1 -0
- package/dist/_virtual/allOf.js +5 -0
- package/dist/_virtual/allOf.js.map +1 -0
- package/dist/_virtual/anyOf.js +5 -0
- package/dist/_virtual/anyOf.js.map +1 -0
- package/dist/_virtual/applicability.js +5 -0
- package/dist/_virtual/applicability.js.map +1 -0
- package/dist/_virtual/boolSchema.js +5 -0
- package/dist/_virtual/boolSchema.js.map +1 -0
- package/dist/_virtual/code.js +5 -0
- package/dist/_virtual/code.js.map +1 -0
- package/dist/_virtual/code2.js +5 -0
- package/dist/_virtual/code2.js.map +1 -0
- package/dist/_virtual/const.js +5 -0
- package/dist/_virtual/const.js.map +1 -0
- package/dist/_virtual/contains.js +5 -0
- package/dist/_virtual/contains.js.map +1 -0
- package/dist/_virtual/core.js +5 -0
- package/dist/_virtual/core.js.map +1 -0
- package/dist/_virtual/dataType.js +5 -0
- package/dist/_virtual/dataType.js.map +1 -0
- package/dist/_virtual/defaults.js +5 -0
- package/dist/_virtual/defaults.js.map +1 -0
- package/dist/_virtual/dependencies.js +5 -0
- package/dist/_virtual/dependencies.js.map +1 -0
- package/dist/_virtual/draft7.js +5 -0
- package/dist/_virtual/draft7.js.map +1 -0
- package/dist/_virtual/enum.js +5 -0
- package/dist/_virtual/enum.js.map +1 -0
- package/dist/_virtual/equal.js +5 -0
- package/dist/_virtual/equal.js.map +1 -0
- package/dist/_virtual/errors.js +5 -0
- package/dist/_virtual/errors.js.map +1 -0
- package/dist/_virtual/format.js +5 -0
- package/dist/_virtual/format.js.map +1 -0
- package/dist/_virtual/formats.js +5 -0
- package/dist/_virtual/formats.js.map +1 -0
- package/dist/_virtual/id.js +5 -0
- package/dist/_virtual/id.js.map +1 -0
- package/dist/_virtual/if.js +5 -0
- package/dist/_virtual/if.js.map +1 -0
- package/dist/_virtual/index.js +8 -0
- package/dist/_virtual/index.js.map +1 -0
- package/dist/_virtual/index10.js +5 -0
- package/dist/_virtual/index10.js.map +1 -0
- package/dist/_virtual/index11.js +5 -0
- package/dist/_virtual/index11.js.map +1 -0
- package/dist/_virtual/index12.js +5 -0
- package/dist/_virtual/index12.js.map +1 -0
- package/dist/_virtual/index2.js +5 -0
- package/dist/_virtual/index2.js.map +1 -0
- package/dist/_virtual/index3.js +5 -0
- package/dist/_virtual/index3.js.map +1 -0
- package/dist/_virtual/index4.js +5 -0
- package/dist/_virtual/index4.js.map +1 -0
- package/dist/_virtual/index5.js +5 -0
- package/dist/_virtual/index5.js.map +1 -0
- package/dist/_virtual/index6.js +5 -0
- package/dist/_virtual/index6.js.map +1 -0
- package/dist/_virtual/index7.js +5 -0
- package/dist/_virtual/index7.js.map +1 -0
- package/dist/_virtual/index8.js +5 -0
- package/dist/_virtual/index8.js.map +1 -0
- package/dist/_virtual/index9.js +5 -0
- package/dist/_virtual/index9.js.map +1 -0
- package/dist/_virtual/items.js +5 -0
- package/dist/_virtual/items.js.map +1 -0
- package/dist/_virtual/items2020.js +5 -0
- package/dist/_virtual/items2020.js.map +1 -0
- package/dist/_virtual/keyword.js +5 -0
- package/dist/_virtual/keyword.js.map +1 -0
- package/dist/_virtual/limit.js +5 -0
- package/dist/_virtual/limit.js.map +1 -0
- package/dist/_virtual/limitItems.js +5 -0
- package/dist/_virtual/limitItems.js.map +1 -0
- package/dist/_virtual/limitLength.js +5 -0
- package/dist/_virtual/limitLength.js.map +1 -0
- package/dist/_virtual/limitNumber.js +5 -0
- package/dist/_virtual/limitNumber.js.map +1 -0
- package/dist/_virtual/limitProperties.js +5 -0
- package/dist/_virtual/limitProperties.js.map +1 -0
- package/dist/_virtual/metadata.js +5 -0
- package/dist/_virtual/metadata.js.map +1 -0
- package/dist/_virtual/multipleOf.js +5 -0
- package/dist/_virtual/multipleOf.js.map +1 -0
- package/dist/_virtual/names.js +5 -0
- package/dist/_virtual/names.js.map +1 -0
- package/dist/_virtual/not.js +5 -0
- package/dist/_virtual/not.js.map +1 -0
- package/dist/_virtual/oneOf.js +5 -0
- package/dist/_virtual/oneOf.js.map +1 -0
- package/dist/_virtual/pattern.js +5 -0
- package/dist/_virtual/pattern.js.map +1 -0
- package/dist/_virtual/patternProperties.js +5 -0
- package/dist/_virtual/patternProperties.js.map +1 -0
- package/dist/_virtual/prefixItems.js +5 -0
- package/dist/_virtual/prefixItems.js.map +1 -0
- package/dist/_virtual/properties.js +5 -0
- package/dist/_virtual/properties.js.map +1 -0
- package/dist/_virtual/propertyNames.js +5 -0
- package/dist/_virtual/propertyNames.js.map +1 -0
- package/dist/_virtual/ref.js +5 -0
- package/dist/_virtual/ref.js.map +1 -0
- package/dist/_virtual/ref_error.js +5 -0
- package/dist/_virtual/ref_error.js.map +1 -0
- package/dist/_virtual/required.js +5 -0
- package/dist/_virtual/required.js.map +1 -0
- package/dist/_virtual/resolve.js +5 -0
- package/dist/_virtual/resolve.js.map +1 -0
- package/dist/_virtual/rules.js +5 -0
- package/dist/_virtual/rules.js.map +1 -0
- package/dist/_virtual/scope.js +5 -0
- package/dist/_virtual/scope.js.map +1 -0
- package/dist/_virtual/subschema.js +5 -0
- package/dist/_virtual/subschema.js.map +1 -0
- package/dist/_virtual/thenElse.js +5 -0
- package/dist/_virtual/thenElse.js.map +1 -0
- package/dist/_virtual/types.js +5 -0
- package/dist/_virtual/types.js.map +1 -0
- package/dist/_virtual/ucs2length.js +5 -0
- package/dist/_virtual/ucs2length.js.map +1 -0
- package/dist/_virtual/uniqueItems.js +5 -0
- package/dist/_virtual/uniqueItems.js.map +1 -0
- package/dist/_virtual/uri.js +5 -0
- package/dist/_virtual/uri.js.map +1 -0
- package/dist/_virtual/util.js +5 -0
- package/dist/_virtual/util.js.map +1 -0
- package/dist/_virtual/validation_error.js +5 -0
- package/dist/_virtual/validation_error.js.map +1 -0
- package/dist/agents/analyst-agent.d.ts +230 -0
- package/dist/agents/analyst-agent.d.ts.map +1 -0
- package/dist/agents/analyst-agent.js +793 -0
- package/dist/agents/analyst-agent.js.map +1 -0
- package/dist/agents/architect-agent.d.ts +248 -0
- package/dist/agents/architect-agent.d.ts.map +1 -0
- package/dist/agents/architect-agent.js +685 -0
- package/dist/agents/architect-agent.js.map +1 -0
- package/dist/agents/base-agent.d.ts +169 -0
- package/dist/agents/base-agent.d.ts.map +1 -0
- package/dist/agents/base-agent.js +441 -0
- package/dist/agents/base-agent.js.map +1 -0
- package/dist/agents/coder-agent.d.ts +191 -0
- package/dist/agents/coder-agent.d.ts.map +1 -0
- package/dist/agents/coder-agent.js +1008 -0
- package/dist/agents/coder-agent.js.map +1 -0
- package/dist/agents/index.d.ts +18 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +40 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/registry.d.ts +213 -0
- package/dist/agents/registry.d.ts.map +1 -0
- package/dist/agents/registry.js +419 -0
- package/dist/agents/registry.js.map +1 -0
- package/dist/agents/researcher-agent.d.ts +226 -0
- package/dist/agents/researcher-agent.d.ts.map +1 -0
- package/dist/agents/researcher-agent.js +572 -0
- package/dist/agents/researcher-agent.js.map +1 -0
- package/dist/agents/rules-engine.d.ts +320 -0
- package/dist/agents/rules-engine.d.ts.map +1 -0
- package/dist/agents/rules-engine.js +552 -0
- package/dist/agents/rules-engine.js.map +1 -0
- package/dist/agents/tester-agent.d.ts +219 -0
- package/dist/agents/tester-agent.d.ts.map +1 -0
- package/dist/agents/tester-agent.js +683 -0
- package/dist/agents/tester-agent.js.map +1 -0
- package/dist/agents/types.d.ts +425 -0
- package/dist/agents/types.d.ts.map +1 -0
- package/dist/agents/types.js +57 -0
- package/dist/agents/types.js.map +1 -0
- package/dist/caching/index.d.ts +55 -0
- package/dist/caching/index.d.ts.map +1 -0
- package/dist/caching/index.js +206 -0
- package/dist/caching/index.js.map +1 -0
- package/dist/caching/lru-cache.d.ts +254 -0
- package/dist/caching/lru-cache.d.ts.map +1 -0
- package/dist/caching/types.d.ts +95 -0
- package/dist/caching/types.d.ts.map +1 -0
- package/dist/chunking/chunker.d.ts +94 -0
- package/dist/chunking/chunker.d.ts.map +1 -0
- package/dist/chunking/index.d.ts +125 -0
- package/dist/chunking/index.d.ts.map +1 -0
- package/dist/chunking/index.js +283 -0
- package/dist/chunking/index.js.map +1 -0
- package/dist/chunking/types.d.ts +92 -0
- package/dist/chunking/types.d.ts.map +1 -0
- package/dist/cli/commands/commit.d.ts +11 -0
- package/dist/cli/commands/commit.d.ts.map +1 -0
- package/dist/cli/commands/commit.js +379 -0
- package/dist/cli/commands/commit.js.map +1 -0
- package/dist/cli/commands/config.d.ts +8 -0
- package/dist/cli/commands/config.d.ts.map +1 -0
- package/dist/cli/commands/config.js +107 -0
- package/dist/cli/commands/config.js.map +1 -0
- package/dist/cli/commands/cultivate.d.ts +16 -0
- package/dist/cli/commands/cultivate.d.ts.map +1 -0
- package/dist/cli/commands/cultivate.js +254 -0
- package/dist/cli/commands/cultivate.js.map +1 -0
- package/dist/cli/commands/diagnostics.d.ts +8 -0
- package/dist/cli/commands/diagnostics.d.ts.map +1 -0
- package/dist/cli/commands/diagnostics.js +140 -0
- package/dist/cli/commands/diagnostics.js.map +1 -0
- package/dist/cli/commands/generate.d.ts +13 -0
- package/dist/cli/commands/generate.d.ts.map +1 -0
- package/dist/cli/commands/init-primitives.d.ts +19 -0
- package/dist/cli/commands/init-primitives.d.ts.map +1 -0
- package/dist/cli/commands/init-primitives.js +208 -0
- package/dist/cli/commands/init-primitives.js.map +1 -0
- package/dist/cli/commands/sop.d.ts +14 -0
- package/dist/cli/commands/sop.d.ts.map +1 -0
- package/dist/cli/commands/sop.js +598 -0
- package/dist/cli/commands/sop.js.map +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +40 -1
- package/dist/cli/index.js.map +1 -1
- package/dist/config/index.d.ts +153 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +141 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/manager.d.ts +136 -0
- package/dist/config/manager.d.ts.map +1 -0
- package/dist/config/types.d.ts +127 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/core/cache.d.ts +185 -0
- package/dist/core/cache.d.ts.map +1 -0
- package/dist/core/cache.js +435 -0
- package/dist/core/cache.js.map +1 -0
- package/dist/cultivation/deep-analyzer.d.ts +129 -0
- package/dist/cultivation/deep-analyzer.d.ts.map +1 -0
- package/dist/cultivation/deep-analyzer.js +322 -0
- package/dist/cultivation/deep-analyzer.js.map +1 -0
- package/dist/cultivation/index.d.ts +13 -0
- package/dist/cultivation/index.d.ts.map +1 -0
- package/dist/cultivation/seed-generator.d.ts +92 -0
- package/dist/cultivation/seed-generator.d.ts.map +1 -0
- package/dist/cultivation/seed-generator.js +1033 -0
- package/dist/cultivation/seed-generator.js.map +1 -0
- package/dist/cultivation/types.d.ts +230 -0
- package/dist/cultivation/types.d.ts.map +1 -0
- package/dist/generators/claude-md.d.ts +7 -0
- package/dist/generators/claude-md.d.ts.map +1 -1
- package/dist/generators/claude-md.js.map +1 -1
- package/dist/generators/docs-init.d.ts +6 -0
- package/dist/generators/docs-init.d.ts.map +1 -1
- package/dist/generators/docs-init.js.map +1 -1
- package/dist/health/checks.d.ts +135 -0
- package/dist/health/checks.d.ts.map +1 -0
- package/dist/health/index.d.ts +119 -0
- package/dist/health/index.d.ts.map +1 -0
- package/dist/health/index.js +191 -0
- package/dist/health/index.js.map +1 -0
- package/dist/health/monitor.d.ts +146 -0
- package/dist/health/monitor.d.ts.map +1 -0
- package/dist/health/types.d.ts +135 -0
- package/dist/health/types.d.ts.map +1 -0
- package/dist/index.d.ts +30 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +173 -1
- package/dist/index.js.map +1 -1
- package/dist/integrations/auto-commit.d.ts +175 -0
- package/dist/integrations/auto-commit.d.ts.map +1 -0
- package/dist/integrations/auto-commit.js +399 -0
- package/dist/integrations/auto-commit.js.map +1 -0
- package/dist/integrations/git.d.ts +299 -0
- package/dist/integrations/git.d.ts.map +1 -0
- package/dist/integrations/git.js +465 -0
- package/dist/integrations/git.js.map +1 -0
- package/dist/mcp-server/bin.d.ts +11 -0
- package/dist/mcp-server/bin.d.ts.map +1 -0
- package/dist/mcp-server/handlers/index.d.ts +57 -0
- package/dist/mcp-server/handlers/index.d.ts.map +1 -0
- package/dist/mcp-server/handlers/index.js +235 -0
- package/dist/mcp-server/handlers/index.js.map +1 -0
- package/dist/mcp-server/index.d.ts +28 -0
- package/dist/mcp-server/index.d.ts.map +1 -0
- package/dist/mcp-server/server.d.ts +133 -0
- package/dist/mcp-server/server.d.ts.map +1 -0
- package/dist/mcp-server/server.js +280 -0
- package/dist/mcp-server/server.js.map +1 -0
- package/dist/mcp-server/tools/agents/index.d.ts +10 -0
- package/dist/mcp-server/tools/agents/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/agents/list.d.ts +19 -0
- package/dist/mcp-server/tools/agents/list.d.ts.map +1 -0
- package/dist/mcp-server/tools/agents/spawn.d.ts +19 -0
- package/dist/mcp-server/tools/agents/spawn.d.ts.map +1 -0
- package/dist/mcp-server/tools/graph/generate.d.ts +21 -0
- package/dist/mcp-server/tools/graph/generate.d.ts.map +1 -0
- package/dist/mcp-server/tools/graph/index.d.ts +11 -0
- package/dist/mcp-server/tools/graph/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/graph/query.d.ts +22 -0
- package/dist/mcp-server/tools/graph/query.d.ts.map +1 -0
- package/dist/mcp-server/tools/graph/stats.d.ts +22 -0
- package/dist/mcp-server/tools/graph/stats.d.ts.map +1 -0
- package/dist/mcp-server/tools/health.d.ts +21 -0
- package/dist/mcp-server/tools/health.d.ts.map +1 -0
- package/dist/mcp-server/tools/index.d.ts +13 -0
- package/dist/mcp-server/tools/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/registry.d.ts +90 -0
- package/dist/mcp-server/tools/registry.d.ts.map +1 -0
- package/dist/mcp-server/tools/registry.js +663 -0
- package/dist/mcp-server/tools/registry.js.map +1 -0
- package/dist/mcp-server/tools/search/index.d.ts +10 -0
- package/dist/mcp-server/tools/search/index.d.ts.map +1 -0
- package/dist/mcp-server/tools/search/nodes.d.ts +22 -0
- package/dist/mcp-server/tools/search/nodes.d.ts.map +1 -0
- package/dist/mcp-server/tools/search/tags.d.ts +22 -0
- package/dist/mcp-server/tools/search/tags.d.ts.map +1 -0
- package/dist/mcp-server/types/index.d.ts +286 -0
- package/dist/mcp-server/types/index.d.ts.map +1 -0
- package/dist/memory/index.d.ts +10 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/vault-sync.d.ts +212 -0
- package/dist/memory/vault-sync.d.ts.map +1 -0
- package/dist/memory/vault-sync.js +463 -0
- package/dist/memory/vault-sync.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js +296 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js +71 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js +26 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js +407 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/protocol.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js +1332 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js.map +1 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js +71 -0
- package/dist/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js.map +1 -0
- package/dist/node_modules/ajv/dist/ajv.js +84 -0
- package/dist/node_modules/ajv/dist/ajv.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/codegen/code.js +160 -0
- package/dist/node_modules/ajv/dist/compile/codegen/code.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/codegen/index.js +728 -0
- package/dist/node_modules/ajv/dist/compile/codegen/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/codegen/scope.js +152 -0
- package/dist/node_modules/ajv/dist/compile/codegen/scope.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/errors.js +131 -0
- package/dist/node_modules/ajv/dist/compile/errors.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/index.js +234 -0
- package/dist/node_modules/ajv/dist/compile/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/names.js +44 -0
- package/dist/node_modules/ajv/dist/compile/names.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/ref_error.js +22 -0
- package/dist/node_modules/ajv/dist/compile/ref_error.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/resolve.js +163 -0
- package/dist/node_modules/ajv/dist/compile/resolve.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/rules.js +35 -0
- package/dist/node_modules/ajv/dist/compile/rules.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/util.js +173 -0
- package/dist/node_modules/ajv/dist/compile/util.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/applicability.js +27 -0
- package/dist/node_modules/ajv/dist/compile/validate/applicability.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/boolSchema.js +58 -0
- package/dist/node_modules/ajv/dist/compile/validate/boolSchema.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/dataType.js +193 -0
- package/dist/node_modules/ajv/dist/compile/validate/dataType.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/defaults.js +43 -0
- package/dist/node_modules/ajv/dist/compile/validate/defaults.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/index.js +522 -0
- package/dist/node_modules/ajv/dist/compile/validate/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/keyword.js +126 -0
- package/dist/node_modules/ajv/dist/compile/validate/keyword.js.map +1 -0
- package/dist/node_modules/ajv/dist/compile/validate/subschema.js +89 -0
- package/dist/node_modules/ajv/dist/compile/validate/subschema.js.map +1 -0
- package/dist/node_modules/ajv/dist/core.js +628 -0
- package/dist/node_modules/ajv/dist/core.js.map +1 -0
- package/dist/node_modules/ajv/dist/refs/data.json.js +24 -0
- package/dist/node_modules/ajv/dist/refs/data.json.js.map +1 -0
- package/dist/node_modules/ajv/dist/refs/json-schema-draft-07.json.js +25 -0
- package/dist/node_modules/ajv/dist/refs/json-schema-draft-07.json.js.map +1 -0
- package/dist/node_modules/ajv/dist/runtime/equal.js +16 -0
- package/dist/node_modules/ajv/dist/runtime/equal.js.map +1 -0
- package/dist/node_modules/ajv/dist/runtime/ucs2length.js +30 -0
- package/dist/node_modules/ajv/dist/runtime/ucs2length.js.map +1 -0
- package/dist/node_modules/ajv/dist/runtime/uri.js +16 -0
- package/dist/node_modules/ajv/dist/runtime/uri.js.map +1 -0
- package/dist/node_modules/ajv/dist/runtime/validation_error.js +20 -0
- package/dist/node_modules/ajv/dist/runtime/validation_error.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js +59 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalItems.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js +114 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/additionalProperties.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/allOf.js +32 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/allOf.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/anyOf.js +22 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/anyOf.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/contains.js +100 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/contains.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/dependencies.js +103 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/dependencies.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/if.js +75 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/if.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/index.js +68 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/items.js +64 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/items.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/items2020.js +43 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/items2020.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/not.js +36 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/not.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/oneOf.js +64 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/oneOf.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js +81 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/patternProperties.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js +22 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/prefixItems.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/properties.js +66 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/properties.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js +49 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/propertyNames.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/thenElse.js +23 -0
- package/dist/node_modules/ajv/dist/vocabularies/applicator/thenElse.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/code.js +140 -0
- package/dist/node_modules/ajv/dist/vocabularies/code.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/core/id.js +19 -0
- package/dist/node_modules/ajv/dist/vocabularies/core/id.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/core/index.js +27 -0
- package/dist/node_modules/ajv/dist/vocabularies/core/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/core/ref.js +132 -0
- package/dist/node_modules/ajv/dist/vocabularies/core/ref.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/discriminator/index.js +114 -0
- package/dist/node_modules/ajv/dist/vocabularies/discriminator/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/discriminator/types.js +18 -0
- package/dist/node_modules/ajv/dist/vocabularies/discriminator/types.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/draft7.js +31 -0
- package/dist/node_modules/ajv/dist/vocabularies/draft7.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/format/format.js +95 -0
- package/dist/node_modules/ajv/dist/vocabularies/format/format.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/format/index.js +16 -0
- package/dist/node_modules/ajv/dist/vocabularies/format/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/metadata.js +27 -0
- package/dist/node_modules/ajv/dist/vocabularies/metadata.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/const.js +36 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/const.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/enum.js +56 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/enum.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/index.js +52 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/index.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitItems.js +34 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitItems.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitLength.js +39 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitLength.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitNumber.js +37 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitNumber.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitProperties.js +34 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/limitProperties.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/multipleOf.js +33 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/multipleOf.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/pattern.js +34 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/pattern.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/required.js +89 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/required.js.map +1 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js +75 -0
- package/dist/node_modules/ajv/dist/vocabularies/validation/uniqueItems.js.map +1 -0
- package/dist/node_modules/ajv-formats/dist/formats.js +209 -0
- package/dist/node_modules/ajv-formats/dist/formats.js.map +1 -0
- package/dist/node_modules/ajv-formats/dist/index.js +51 -0
- package/dist/node_modules/ajv-formats/dist/index.js.map +1 -0
- package/dist/node_modules/ajv-formats/dist/limit.js +80 -0
- package/dist/node_modules/ajv-formats/dist/limit.js.map +1 -0
- package/dist/node_modules/fast-deep-equal/index.js +39 -0
- package/dist/node_modules/fast-deep-equal/index.js.map +1 -0
- package/dist/node_modules/fast-uri/index.js +261 -0
- package/dist/node_modules/fast-uri/index.js.map +1 -0
- package/dist/node_modules/fast-uri/lib/schemes.js +215 -0
- package/dist/node_modules/fast-uri/lib/schemes.js.map +1 -0
- package/dist/node_modules/fast-uri/lib/utils.js +261 -0
- package/dist/node_modules/fast-uri/lib/utils.js.map +1 -0
- package/dist/node_modules/json-schema-traverse/index.js +92 -0
- package/dist/node_modules/json-schema-traverse/index.js.map +1 -0
- package/dist/node_modules/zod/v4/classic/errors.js +37 -0
- package/dist/node_modules/zod/v4/classic/errors.js.map +1 -0
- package/dist/node_modules/zod/v4/classic/iso.js +43 -0
- package/dist/node_modules/zod/v4/classic/iso.js.map +1 -0
- package/dist/node_modules/zod/v4/classic/parse.js +13 -0
- package/dist/node_modules/zod/v4/classic/parse.js.map +1 -0
- package/dist/node_modules/zod/v4/classic/schemas.js +688 -0
- package/dist/node_modules/zod/v4/classic/schemas.js.map +1 -0
- package/dist/node_modules/zod/v4/core/api.js +492 -0
- package/dist/node_modules/zod/v4/core/api.js.map +1 -0
- package/dist/node_modules/zod/v4/core/checks.js +405 -0
- package/dist/node_modules/zod/v4/core/checks.js.map +1 -0
- package/dist/node_modules/zod/v4/core/core.js +58 -0
- package/dist/node_modules/zod/v4/core/core.js.map +1 -0
- package/dist/node_modules/zod/v4/core/doc.js +38 -0
- package/dist/node_modules/zod/v4/core/doc.js.map +1 -0
- package/dist/node_modules/zod/v4/core/errors.js +82 -0
- package/dist/node_modules/zod/v4/core/errors.js.map +1 -0
- package/dist/node_modules/zod/v4/core/parse.js +60 -0
- package/dist/node_modules/zod/v4/core/parse.js.map +1 -0
- package/dist/node_modules/zod/v4/core/regexes.js +87 -0
- package/dist/node_modules/zod/v4/core/regexes.js.map +1 -0
- package/dist/node_modules/zod/v4/core/registries.js +52 -0
- package/dist/node_modules/zod/v4/core/registries.js.map +1 -0
- package/dist/node_modules/zod/v4/core/schemas.js +1283 -0
- package/dist/node_modules/zod/v4/core/schemas.js.map +1 -0
- package/dist/node_modules/zod/v4/core/util.js +341 -0
- package/dist/node_modules/zod/v4/core/util.js.map +1 -0
- package/dist/node_modules/zod/v4/core/versions.js +9 -0
- package/dist/node_modules/zod/v4/core/versions.js.map +1 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/string.js +2 -0
- package/dist/node_modules/zod-to-json-schema/dist/esm/parsers/string.js.map +1 -0
- package/dist/reasoning/index.d.ts +74 -0
- package/dist/reasoning/index.d.ts.map +1 -0
- package/dist/reasoning/index.js +124 -0
- package/dist/reasoning/index.js.map +1 -0
- package/dist/reasoning/tracker.d.ts +210 -0
- package/dist/reasoning/tracker.d.ts.map +1 -0
- package/dist/reasoning/types.d.ts +146 -0
- package/dist/reasoning/types.d.ts.map +1 -0
- package/dist/recovery/backup.d.ts +110 -0
- package/dist/recovery/backup.d.ts.map +1 -0
- package/dist/recovery/index.d.ts +70 -0
- package/dist/recovery/index.d.ts.map +1 -0
- package/dist/recovery/index.js +186 -0
- package/dist/recovery/index.js.map +1 -0
- package/dist/recovery/integrity.d.ts +74 -0
- package/dist/recovery/integrity.d.ts.map +1 -0
- package/dist/recovery/types.d.ts +94 -0
- package/dist/recovery/types.d.ts.map +1 -0
- package/dist/services/index.d.ts +130 -0
- package/dist/services/index.d.ts.map +1 -0
- package/dist/services/index.js +134 -0
- package/dist/services/index.js.map +1 -0
- package/dist/services/manager.d.ts +140 -0
- package/dist/services/manager.d.ts.map +1 -0
- package/dist/services/types.d.ts +106 -0
- package/dist/services/types.d.ts.map +1 -0
- package/dist/services/watchers.d.ts +95 -0
- package/dist/services/watchers.d.ts.map +1 -0
- package/dist/sops/compliance-checker.d.ts +83 -0
- package/dist/sops/compliance-checker.d.ts.map +1 -0
- package/dist/sops/compliance-checker.js +399 -0
- package/dist/sops/compliance-checker.js.map +1 -0
- package/dist/sops/gap-analyzer.d.ts +124 -0
- package/dist/sops/gap-analyzer.d.ts.map +1 -0
- package/dist/sops/gap-analyzer.js +313 -0
- package/dist/sops/gap-analyzer.js.map +1 -0
- package/dist/sops/index.d.ts +14 -0
- package/dist/sops/index.d.ts.map +1 -0
- package/dist/sops/overlay-manager.d.ts +115 -0
- package/dist/sops/overlay-manager.d.ts.map +1 -0
- package/dist/sops/overlay-manager.js +394 -0
- package/dist/sops/overlay-manager.js.map +1 -0
- package/dist/sops/registry.d.ts +73 -0
- package/dist/sops/registry.d.ts.map +1 -0
- package/dist/sops/registry.js +919 -0
- package/dist/sops/registry.js.map +1 -0
- package/dist/sops/types.d.ts +377 -0
- package/dist/sops/types.d.ts.map +1 -0
- package/dist/sops/types.js +46 -0
- package/dist/sops/types.js.map +1 -0
- package/dist/utils/error-recovery.d.ts +230 -0
- package/dist/utils/error-recovery.d.ts.map +1 -0
- package/dist/utils/error-recovery.js +228 -0
- package/dist/utils/error-recovery.js.map +1 -0
- package/dist/utils/error-taxonomy.d.ts +149 -0
- package/dist/utils/error-taxonomy.d.ts.map +1 -0
- package/dist/utils/error-taxonomy.js +260 -0
- package/dist/utils/error-taxonomy.js.map +1 -0
- package/dist/utils/index.d.ts +11 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/logger.d.ts +139 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +311 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/workflows/index.d.ts +11 -0
- package/dist/workflows/index.d.ts.map +1 -0
- package/dist/workflows/registry.d.ts +118 -0
- package/dist/workflows/registry.d.ts.map +1 -0
- package/dist/workflows/registry.js +575 -0
- package/dist/workflows/registry.js.map +1 -0
- package/dist/workflows/types.d.ts +322 -0
- package/dist/workflows/types.d.ts.map +1 -0
- package/dist/workflows/types.js +16 -0
- package/dist/workflows/types.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,1283 @@
|
|
|
1
|
+
import { $ZodCheck, $ZodCheckStringFormat, $ZodCheckNumberFormat } from "./checks.js";
|
|
2
|
+
import { $constructor, globalConfig, config, $ZodAsyncError } from "./core.js";
|
|
3
|
+
import { Doc } from "./doc.js";
|
|
4
|
+
import { safeParse, safeParseAsync } from "./parse.js";
|
|
5
|
+
import { string, number, boolean, datetime, date, time, duration, email, guid, uuid, hostname, emoji, nanoid, cuid, cuid2, ulid, xid, ksuid, ipv4, ipv6, cidrv4, cidrv6, base64, base64url, e164 } from "./regexes.js";
|
|
6
|
+
import { defineLazy, allowsEval, cached, isObject, esc, cleanRegex, isPlainObject, prefixIssues, finalizeIssue, getEnumValues, propertyKeyTypes, escapeRegex, aborted, optionalKeys, issue } from "./util.js";
|
|
7
|
+
import { clone } from "./util.js";
|
|
8
|
+
import { version } from "./versions.js";
|
|
9
|
+
const $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
|
|
10
|
+
var _a;
|
|
11
|
+
inst ?? (inst = {});
|
|
12
|
+
inst._zod.def = def;
|
|
13
|
+
inst._zod.bag = inst._zod.bag || {};
|
|
14
|
+
inst._zod.version = version;
|
|
15
|
+
const checks = [...inst._zod.def.checks ?? []];
|
|
16
|
+
if (inst._zod.traits.has("$ZodCheck")) {
|
|
17
|
+
checks.unshift(inst);
|
|
18
|
+
}
|
|
19
|
+
for (const ch of checks) {
|
|
20
|
+
for (const fn of ch._zod.onattach) {
|
|
21
|
+
fn(inst);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
if (checks.length === 0) {
|
|
25
|
+
(_a = inst._zod).deferred ?? (_a.deferred = []);
|
|
26
|
+
inst._zod.deferred?.push(() => {
|
|
27
|
+
inst._zod.run = inst._zod.parse;
|
|
28
|
+
});
|
|
29
|
+
} else {
|
|
30
|
+
const runChecks = (payload, checks2, ctx) => {
|
|
31
|
+
let isAborted = aborted(payload);
|
|
32
|
+
let asyncResult;
|
|
33
|
+
for (const ch of checks2) {
|
|
34
|
+
if (ch._zod.def.when) {
|
|
35
|
+
const shouldRun = ch._zod.def.when(payload);
|
|
36
|
+
if (!shouldRun)
|
|
37
|
+
continue;
|
|
38
|
+
} else if (isAborted) {
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
const currLen = payload.issues.length;
|
|
42
|
+
const _ = ch._zod.check(payload);
|
|
43
|
+
if (_ instanceof Promise && ctx?.async === false) {
|
|
44
|
+
throw new $ZodAsyncError();
|
|
45
|
+
}
|
|
46
|
+
if (asyncResult || _ instanceof Promise) {
|
|
47
|
+
asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
|
|
48
|
+
await _;
|
|
49
|
+
const nextLen = payload.issues.length;
|
|
50
|
+
if (nextLen === currLen)
|
|
51
|
+
return;
|
|
52
|
+
if (!isAborted)
|
|
53
|
+
isAborted = aborted(payload, currLen);
|
|
54
|
+
});
|
|
55
|
+
} else {
|
|
56
|
+
const nextLen = payload.issues.length;
|
|
57
|
+
if (nextLen === currLen)
|
|
58
|
+
continue;
|
|
59
|
+
if (!isAborted)
|
|
60
|
+
isAborted = aborted(payload, currLen);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
if (asyncResult) {
|
|
64
|
+
return asyncResult.then(() => {
|
|
65
|
+
return payload;
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
return payload;
|
|
69
|
+
};
|
|
70
|
+
inst._zod.run = (payload, ctx) => {
|
|
71
|
+
const result = inst._zod.parse(payload, ctx);
|
|
72
|
+
if (result instanceof Promise) {
|
|
73
|
+
if (ctx.async === false)
|
|
74
|
+
throw new $ZodAsyncError();
|
|
75
|
+
return result.then((result2) => runChecks(result2, checks, ctx));
|
|
76
|
+
}
|
|
77
|
+
return runChecks(result, checks, ctx);
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
inst["~standard"] = {
|
|
81
|
+
validate: (value) => {
|
|
82
|
+
try {
|
|
83
|
+
const r = safeParse(inst, value);
|
|
84
|
+
return r.success ? { value: r.data } : { issues: r.error?.issues };
|
|
85
|
+
} catch (_) {
|
|
86
|
+
return safeParseAsync(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
vendor: "zod",
|
|
90
|
+
version: 1
|
|
91
|
+
};
|
|
92
|
+
});
|
|
93
|
+
const $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
|
|
94
|
+
$ZodType.init(inst, def);
|
|
95
|
+
inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag);
|
|
96
|
+
inst._zod.parse = (payload, _) => {
|
|
97
|
+
if (def.coerce)
|
|
98
|
+
try {
|
|
99
|
+
payload.value = String(payload.value);
|
|
100
|
+
} catch (_2) {
|
|
101
|
+
}
|
|
102
|
+
if (typeof payload.value === "string")
|
|
103
|
+
return payload;
|
|
104
|
+
payload.issues.push({
|
|
105
|
+
expected: "string",
|
|
106
|
+
code: "invalid_type",
|
|
107
|
+
input: payload.value,
|
|
108
|
+
inst
|
|
109
|
+
});
|
|
110
|
+
return payload;
|
|
111
|
+
};
|
|
112
|
+
});
|
|
113
|
+
const $ZodStringFormat = /* @__PURE__ */ $constructor("$ZodStringFormat", (inst, def) => {
|
|
114
|
+
$ZodCheckStringFormat.init(inst, def);
|
|
115
|
+
$ZodString.init(inst, def);
|
|
116
|
+
});
|
|
117
|
+
const $ZodGUID = /* @__PURE__ */ $constructor("$ZodGUID", (inst, def) => {
|
|
118
|
+
def.pattern ?? (def.pattern = guid);
|
|
119
|
+
$ZodStringFormat.init(inst, def);
|
|
120
|
+
});
|
|
121
|
+
const $ZodUUID = /* @__PURE__ */ $constructor("$ZodUUID", (inst, def) => {
|
|
122
|
+
if (def.version) {
|
|
123
|
+
const versionMap = {
|
|
124
|
+
v1: 1,
|
|
125
|
+
v2: 2,
|
|
126
|
+
v3: 3,
|
|
127
|
+
v4: 4,
|
|
128
|
+
v5: 5,
|
|
129
|
+
v6: 6,
|
|
130
|
+
v7: 7,
|
|
131
|
+
v8: 8
|
|
132
|
+
};
|
|
133
|
+
const v = versionMap[def.version];
|
|
134
|
+
if (v === void 0)
|
|
135
|
+
throw new Error(`Invalid UUID version: "${def.version}"`);
|
|
136
|
+
def.pattern ?? (def.pattern = uuid(v));
|
|
137
|
+
} else
|
|
138
|
+
def.pattern ?? (def.pattern = uuid());
|
|
139
|
+
$ZodStringFormat.init(inst, def);
|
|
140
|
+
});
|
|
141
|
+
const $ZodEmail = /* @__PURE__ */ $constructor("$ZodEmail", (inst, def) => {
|
|
142
|
+
def.pattern ?? (def.pattern = email);
|
|
143
|
+
$ZodStringFormat.init(inst, def);
|
|
144
|
+
});
|
|
145
|
+
const $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
|
|
146
|
+
$ZodStringFormat.init(inst, def);
|
|
147
|
+
inst._zod.check = (payload) => {
|
|
148
|
+
try {
|
|
149
|
+
const orig = payload.value;
|
|
150
|
+
const url = new URL(orig);
|
|
151
|
+
const href = url.href;
|
|
152
|
+
if (def.hostname) {
|
|
153
|
+
def.hostname.lastIndex = 0;
|
|
154
|
+
if (!def.hostname.test(url.hostname)) {
|
|
155
|
+
payload.issues.push({
|
|
156
|
+
code: "invalid_format",
|
|
157
|
+
format: "url",
|
|
158
|
+
note: "Invalid hostname",
|
|
159
|
+
pattern: hostname.source,
|
|
160
|
+
input: payload.value,
|
|
161
|
+
inst,
|
|
162
|
+
continue: !def.abort
|
|
163
|
+
});
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
if (def.protocol) {
|
|
167
|
+
def.protocol.lastIndex = 0;
|
|
168
|
+
if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) {
|
|
169
|
+
payload.issues.push({
|
|
170
|
+
code: "invalid_format",
|
|
171
|
+
format: "url",
|
|
172
|
+
note: "Invalid protocol",
|
|
173
|
+
pattern: def.protocol.source,
|
|
174
|
+
input: payload.value,
|
|
175
|
+
inst,
|
|
176
|
+
continue: !def.abort
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
if (!orig.endsWith("/") && href.endsWith("/")) {
|
|
181
|
+
payload.value = href.slice(0, -1);
|
|
182
|
+
} else {
|
|
183
|
+
payload.value = href;
|
|
184
|
+
}
|
|
185
|
+
return;
|
|
186
|
+
} catch (_) {
|
|
187
|
+
payload.issues.push({
|
|
188
|
+
code: "invalid_format",
|
|
189
|
+
format: "url",
|
|
190
|
+
input: payload.value,
|
|
191
|
+
inst,
|
|
192
|
+
continue: !def.abort
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
};
|
|
196
|
+
});
|
|
197
|
+
const $ZodEmoji = /* @__PURE__ */ $constructor("$ZodEmoji", (inst, def) => {
|
|
198
|
+
def.pattern ?? (def.pattern = emoji());
|
|
199
|
+
$ZodStringFormat.init(inst, def);
|
|
200
|
+
});
|
|
201
|
+
const $ZodNanoID = /* @__PURE__ */ $constructor("$ZodNanoID", (inst, def) => {
|
|
202
|
+
def.pattern ?? (def.pattern = nanoid);
|
|
203
|
+
$ZodStringFormat.init(inst, def);
|
|
204
|
+
});
|
|
205
|
+
const $ZodCUID = /* @__PURE__ */ $constructor("$ZodCUID", (inst, def) => {
|
|
206
|
+
def.pattern ?? (def.pattern = cuid);
|
|
207
|
+
$ZodStringFormat.init(inst, def);
|
|
208
|
+
});
|
|
209
|
+
const $ZodCUID2 = /* @__PURE__ */ $constructor("$ZodCUID2", (inst, def) => {
|
|
210
|
+
def.pattern ?? (def.pattern = cuid2);
|
|
211
|
+
$ZodStringFormat.init(inst, def);
|
|
212
|
+
});
|
|
213
|
+
const $ZodULID = /* @__PURE__ */ $constructor("$ZodULID", (inst, def) => {
|
|
214
|
+
def.pattern ?? (def.pattern = ulid);
|
|
215
|
+
$ZodStringFormat.init(inst, def);
|
|
216
|
+
});
|
|
217
|
+
const $ZodXID = /* @__PURE__ */ $constructor("$ZodXID", (inst, def) => {
|
|
218
|
+
def.pattern ?? (def.pattern = xid);
|
|
219
|
+
$ZodStringFormat.init(inst, def);
|
|
220
|
+
});
|
|
221
|
+
const $ZodKSUID = /* @__PURE__ */ $constructor("$ZodKSUID", (inst, def) => {
|
|
222
|
+
def.pattern ?? (def.pattern = ksuid);
|
|
223
|
+
$ZodStringFormat.init(inst, def);
|
|
224
|
+
});
|
|
225
|
+
const $ZodISODateTime = /* @__PURE__ */ $constructor("$ZodISODateTime", (inst, def) => {
|
|
226
|
+
def.pattern ?? (def.pattern = datetime(def));
|
|
227
|
+
$ZodStringFormat.init(inst, def);
|
|
228
|
+
});
|
|
229
|
+
const $ZodISODate = /* @__PURE__ */ $constructor("$ZodISODate", (inst, def) => {
|
|
230
|
+
def.pattern ?? (def.pattern = date);
|
|
231
|
+
$ZodStringFormat.init(inst, def);
|
|
232
|
+
});
|
|
233
|
+
const $ZodISOTime = /* @__PURE__ */ $constructor("$ZodISOTime", (inst, def) => {
|
|
234
|
+
def.pattern ?? (def.pattern = time(def));
|
|
235
|
+
$ZodStringFormat.init(inst, def);
|
|
236
|
+
});
|
|
237
|
+
const $ZodISODuration = /* @__PURE__ */ $constructor("$ZodISODuration", (inst, def) => {
|
|
238
|
+
def.pattern ?? (def.pattern = duration);
|
|
239
|
+
$ZodStringFormat.init(inst, def);
|
|
240
|
+
});
|
|
241
|
+
const $ZodIPv4 = /* @__PURE__ */ $constructor("$ZodIPv4", (inst, def) => {
|
|
242
|
+
def.pattern ?? (def.pattern = ipv4);
|
|
243
|
+
$ZodStringFormat.init(inst, def);
|
|
244
|
+
inst._zod.onattach.push((inst2) => {
|
|
245
|
+
const bag = inst2._zod.bag;
|
|
246
|
+
bag.format = `ipv4`;
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
const $ZodIPv6 = /* @__PURE__ */ $constructor("$ZodIPv6", (inst, def) => {
|
|
250
|
+
def.pattern ?? (def.pattern = ipv6);
|
|
251
|
+
$ZodStringFormat.init(inst, def);
|
|
252
|
+
inst._zod.onattach.push((inst2) => {
|
|
253
|
+
const bag = inst2._zod.bag;
|
|
254
|
+
bag.format = `ipv6`;
|
|
255
|
+
});
|
|
256
|
+
inst._zod.check = (payload) => {
|
|
257
|
+
try {
|
|
258
|
+
new URL(`http://[${payload.value}]`);
|
|
259
|
+
} catch {
|
|
260
|
+
payload.issues.push({
|
|
261
|
+
code: "invalid_format",
|
|
262
|
+
format: "ipv6",
|
|
263
|
+
input: payload.value,
|
|
264
|
+
inst,
|
|
265
|
+
continue: !def.abort
|
|
266
|
+
});
|
|
267
|
+
}
|
|
268
|
+
};
|
|
269
|
+
});
|
|
270
|
+
const $ZodCIDRv4 = /* @__PURE__ */ $constructor("$ZodCIDRv4", (inst, def) => {
|
|
271
|
+
def.pattern ?? (def.pattern = cidrv4);
|
|
272
|
+
$ZodStringFormat.init(inst, def);
|
|
273
|
+
});
|
|
274
|
+
const $ZodCIDRv6 = /* @__PURE__ */ $constructor("$ZodCIDRv6", (inst, def) => {
|
|
275
|
+
def.pattern ?? (def.pattern = cidrv6);
|
|
276
|
+
$ZodStringFormat.init(inst, def);
|
|
277
|
+
inst._zod.check = (payload) => {
|
|
278
|
+
const [address, prefix] = payload.value.split("/");
|
|
279
|
+
try {
|
|
280
|
+
if (!prefix)
|
|
281
|
+
throw new Error();
|
|
282
|
+
const prefixNum = Number(prefix);
|
|
283
|
+
if (`${prefixNum}` !== prefix)
|
|
284
|
+
throw new Error();
|
|
285
|
+
if (prefixNum < 0 || prefixNum > 128)
|
|
286
|
+
throw new Error();
|
|
287
|
+
new URL(`http://[${address}]`);
|
|
288
|
+
} catch {
|
|
289
|
+
payload.issues.push({
|
|
290
|
+
code: "invalid_format",
|
|
291
|
+
format: "cidrv6",
|
|
292
|
+
input: payload.value,
|
|
293
|
+
inst,
|
|
294
|
+
continue: !def.abort
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
});
|
|
299
|
+
function isValidBase64(data) {
|
|
300
|
+
if (data === "")
|
|
301
|
+
return true;
|
|
302
|
+
if (data.length % 4 !== 0)
|
|
303
|
+
return false;
|
|
304
|
+
try {
|
|
305
|
+
atob(data);
|
|
306
|
+
return true;
|
|
307
|
+
} catch {
|
|
308
|
+
return false;
|
|
309
|
+
}
|
|
310
|
+
}
|
|
311
|
+
const $ZodBase64 = /* @__PURE__ */ $constructor("$ZodBase64", (inst, def) => {
|
|
312
|
+
def.pattern ?? (def.pattern = base64);
|
|
313
|
+
$ZodStringFormat.init(inst, def);
|
|
314
|
+
inst._zod.onattach.push((inst2) => {
|
|
315
|
+
inst2._zod.bag.contentEncoding = "base64";
|
|
316
|
+
});
|
|
317
|
+
inst._zod.check = (payload) => {
|
|
318
|
+
if (isValidBase64(payload.value))
|
|
319
|
+
return;
|
|
320
|
+
payload.issues.push({
|
|
321
|
+
code: "invalid_format",
|
|
322
|
+
format: "base64",
|
|
323
|
+
input: payload.value,
|
|
324
|
+
inst,
|
|
325
|
+
continue: !def.abort
|
|
326
|
+
});
|
|
327
|
+
};
|
|
328
|
+
});
|
|
329
|
+
function isValidBase64URL(data) {
|
|
330
|
+
if (!base64url.test(data))
|
|
331
|
+
return false;
|
|
332
|
+
const base642 = data.replace(/[-_]/g, (c) => c === "-" ? "+" : "/");
|
|
333
|
+
const padded = base642.padEnd(Math.ceil(base642.length / 4) * 4, "=");
|
|
334
|
+
return isValidBase64(padded);
|
|
335
|
+
}
|
|
336
|
+
const $ZodBase64URL = /* @__PURE__ */ $constructor("$ZodBase64URL", (inst, def) => {
|
|
337
|
+
def.pattern ?? (def.pattern = base64url);
|
|
338
|
+
$ZodStringFormat.init(inst, def);
|
|
339
|
+
inst._zod.onattach.push((inst2) => {
|
|
340
|
+
inst2._zod.bag.contentEncoding = "base64url";
|
|
341
|
+
});
|
|
342
|
+
inst._zod.check = (payload) => {
|
|
343
|
+
if (isValidBase64URL(payload.value))
|
|
344
|
+
return;
|
|
345
|
+
payload.issues.push({
|
|
346
|
+
code: "invalid_format",
|
|
347
|
+
format: "base64url",
|
|
348
|
+
input: payload.value,
|
|
349
|
+
inst,
|
|
350
|
+
continue: !def.abort
|
|
351
|
+
});
|
|
352
|
+
};
|
|
353
|
+
});
|
|
354
|
+
const $ZodE164 = /* @__PURE__ */ $constructor("$ZodE164", (inst, def) => {
|
|
355
|
+
def.pattern ?? (def.pattern = e164);
|
|
356
|
+
$ZodStringFormat.init(inst, def);
|
|
357
|
+
});
|
|
358
|
+
function isValidJWT(token, algorithm = null) {
|
|
359
|
+
try {
|
|
360
|
+
const tokensParts = token.split(".");
|
|
361
|
+
if (tokensParts.length !== 3)
|
|
362
|
+
return false;
|
|
363
|
+
const [header] = tokensParts;
|
|
364
|
+
if (!header)
|
|
365
|
+
return false;
|
|
366
|
+
const parsedHeader = JSON.parse(atob(header));
|
|
367
|
+
if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT")
|
|
368
|
+
return false;
|
|
369
|
+
if (!parsedHeader.alg)
|
|
370
|
+
return false;
|
|
371
|
+
if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm))
|
|
372
|
+
return false;
|
|
373
|
+
return true;
|
|
374
|
+
} catch {
|
|
375
|
+
return false;
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
const $ZodJWT = /* @__PURE__ */ $constructor("$ZodJWT", (inst, def) => {
|
|
379
|
+
$ZodStringFormat.init(inst, def);
|
|
380
|
+
inst._zod.check = (payload) => {
|
|
381
|
+
if (isValidJWT(payload.value, def.alg))
|
|
382
|
+
return;
|
|
383
|
+
payload.issues.push({
|
|
384
|
+
code: "invalid_format",
|
|
385
|
+
format: "jwt",
|
|
386
|
+
input: payload.value,
|
|
387
|
+
inst,
|
|
388
|
+
continue: !def.abort
|
|
389
|
+
});
|
|
390
|
+
};
|
|
391
|
+
});
|
|
392
|
+
const $ZodNumber = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
393
|
+
$ZodType.init(inst, def);
|
|
394
|
+
inst._zod.pattern = inst._zod.bag.pattern ?? number;
|
|
395
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
396
|
+
if (def.coerce)
|
|
397
|
+
try {
|
|
398
|
+
payload.value = Number(payload.value);
|
|
399
|
+
} catch (_) {
|
|
400
|
+
}
|
|
401
|
+
const input = payload.value;
|
|
402
|
+
if (typeof input === "number" && !Number.isNaN(input) && Number.isFinite(input)) {
|
|
403
|
+
return payload;
|
|
404
|
+
}
|
|
405
|
+
const received = typeof input === "number" ? Number.isNaN(input) ? "NaN" : !Number.isFinite(input) ? "Infinity" : void 0 : void 0;
|
|
406
|
+
payload.issues.push({
|
|
407
|
+
expected: "number",
|
|
408
|
+
code: "invalid_type",
|
|
409
|
+
input,
|
|
410
|
+
inst,
|
|
411
|
+
...received ? { received } : {}
|
|
412
|
+
});
|
|
413
|
+
return payload;
|
|
414
|
+
};
|
|
415
|
+
});
|
|
416
|
+
const $ZodNumberFormat = /* @__PURE__ */ $constructor("$ZodNumber", (inst, def) => {
|
|
417
|
+
$ZodCheckNumberFormat.init(inst, def);
|
|
418
|
+
$ZodNumber.init(inst, def);
|
|
419
|
+
});
|
|
420
|
+
const $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
|
|
421
|
+
$ZodType.init(inst, def);
|
|
422
|
+
inst._zod.pattern = boolean;
|
|
423
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
424
|
+
if (def.coerce)
|
|
425
|
+
try {
|
|
426
|
+
payload.value = Boolean(payload.value);
|
|
427
|
+
} catch (_) {
|
|
428
|
+
}
|
|
429
|
+
const input = payload.value;
|
|
430
|
+
if (typeof input === "boolean")
|
|
431
|
+
return payload;
|
|
432
|
+
payload.issues.push({
|
|
433
|
+
expected: "boolean",
|
|
434
|
+
code: "invalid_type",
|
|
435
|
+
input,
|
|
436
|
+
inst
|
|
437
|
+
});
|
|
438
|
+
return payload;
|
|
439
|
+
};
|
|
440
|
+
});
|
|
441
|
+
const $ZodUnknown = /* @__PURE__ */ $constructor("$ZodUnknown", (inst, def) => {
|
|
442
|
+
$ZodType.init(inst, def);
|
|
443
|
+
inst._zod.parse = (payload) => payload;
|
|
444
|
+
});
|
|
445
|
+
const $ZodNever = /* @__PURE__ */ $constructor("$ZodNever", (inst, def) => {
|
|
446
|
+
$ZodType.init(inst, def);
|
|
447
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
448
|
+
payload.issues.push({
|
|
449
|
+
expected: "never",
|
|
450
|
+
code: "invalid_type",
|
|
451
|
+
input: payload.value,
|
|
452
|
+
inst
|
|
453
|
+
});
|
|
454
|
+
return payload;
|
|
455
|
+
};
|
|
456
|
+
});
|
|
457
|
+
function handleArrayResult(result, final, index) {
|
|
458
|
+
if (result.issues.length) {
|
|
459
|
+
final.issues.push(...prefixIssues(index, result.issues));
|
|
460
|
+
}
|
|
461
|
+
final.value[index] = result.value;
|
|
462
|
+
}
|
|
463
|
+
const $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
|
|
464
|
+
$ZodType.init(inst, def);
|
|
465
|
+
inst._zod.parse = (payload, ctx) => {
|
|
466
|
+
const input = payload.value;
|
|
467
|
+
if (!Array.isArray(input)) {
|
|
468
|
+
payload.issues.push({
|
|
469
|
+
expected: "array",
|
|
470
|
+
code: "invalid_type",
|
|
471
|
+
input,
|
|
472
|
+
inst
|
|
473
|
+
});
|
|
474
|
+
return payload;
|
|
475
|
+
}
|
|
476
|
+
payload.value = Array(input.length);
|
|
477
|
+
const proms = [];
|
|
478
|
+
for (let i = 0; i < input.length; i++) {
|
|
479
|
+
const item = input[i];
|
|
480
|
+
const result = def.element._zod.run({
|
|
481
|
+
value: item,
|
|
482
|
+
issues: []
|
|
483
|
+
}, ctx);
|
|
484
|
+
if (result instanceof Promise) {
|
|
485
|
+
proms.push(result.then((result2) => handleArrayResult(result2, payload, i)));
|
|
486
|
+
} else {
|
|
487
|
+
handleArrayResult(result, payload, i);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
if (proms.length) {
|
|
491
|
+
return Promise.all(proms).then(() => payload);
|
|
492
|
+
}
|
|
493
|
+
return payload;
|
|
494
|
+
};
|
|
495
|
+
});
|
|
496
|
+
function handleObjectResult(result, final, key) {
|
|
497
|
+
if (result.issues.length) {
|
|
498
|
+
final.issues.push(...prefixIssues(key, result.issues));
|
|
499
|
+
}
|
|
500
|
+
final.value[key] = result.value;
|
|
501
|
+
}
|
|
502
|
+
function handleOptionalObjectResult(result, final, key, input) {
|
|
503
|
+
if (result.issues.length) {
|
|
504
|
+
if (input[key] === void 0) {
|
|
505
|
+
if (key in input) {
|
|
506
|
+
final.value[key] = void 0;
|
|
507
|
+
} else {
|
|
508
|
+
final.value[key] = result.value;
|
|
509
|
+
}
|
|
510
|
+
} else {
|
|
511
|
+
final.issues.push(...prefixIssues(key, result.issues));
|
|
512
|
+
}
|
|
513
|
+
} else if (result.value === void 0) {
|
|
514
|
+
if (key in input)
|
|
515
|
+
final.value[key] = void 0;
|
|
516
|
+
} else {
|
|
517
|
+
final.value[key] = result.value;
|
|
518
|
+
}
|
|
519
|
+
}
|
|
520
|
+
const $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
|
|
521
|
+
$ZodType.init(inst, def);
|
|
522
|
+
const _normalized = cached(() => {
|
|
523
|
+
const keys = Object.keys(def.shape);
|
|
524
|
+
for (const k of keys) {
|
|
525
|
+
if (!(def.shape[k] instanceof $ZodType)) {
|
|
526
|
+
throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
const okeys = optionalKeys(def.shape);
|
|
530
|
+
return {
|
|
531
|
+
shape: def.shape,
|
|
532
|
+
keys,
|
|
533
|
+
keySet: new Set(keys),
|
|
534
|
+
numKeys: keys.length,
|
|
535
|
+
optionalKeys: new Set(okeys)
|
|
536
|
+
};
|
|
537
|
+
});
|
|
538
|
+
defineLazy(inst._zod, "propValues", () => {
|
|
539
|
+
const shape = def.shape;
|
|
540
|
+
const propValues = {};
|
|
541
|
+
for (const key in shape) {
|
|
542
|
+
const field = shape[key]._zod;
|
|
543
|
+
if (field.values) {
|
|
544
|
+
propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
|
|
545
|
+
for (const v of field.values)
|
|
546
|
+
propValues[key].add(v);
|
|
547
|
+
}
|
|
548
|
+
}
|
|
549
|
+
return propValues;
|
|
550
|
+
});
|
|
551
|
+
const generateFastpass = (shape) => {
|
|
552
|
+
const doc = new Doc(["shape", "payload", "ctx"]);
|
|
553
|
+
const normalized = _normalized.value;
|
|
554
|
+
const parseStr = (key) => {
|
|
555
|
+
const k = esc(key);
|
|
556
|
+
return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
|
|
557
|
+
};
|
|
558
|
+
doc.write(`const input = payload.value;`);
|
|
559
|
+
const ids = /* @__PURE__ */ Object.create(null);
|
|
560
|
+
let counter = 0;
|
|
561
|
+
for (const key of normalized.keys) {
|
|
562
|
+
ids[key] = `key_${counter++}`;
|
|
563
|
+
}
|
|
564
|
+
doc.write(`const newResult = {}`);
|
|
565
|
+
for (const key of normalized.keys) {
|
|
566
|
+
if (normalized.optionalKeys.has(key)) {
|
|
567
|
+
const id = ids[key];
|
|
568
|
+
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
569
|
+
const k = esc(key);
|
|
570
|
+
doc.write(`
|
|
571
|
+
if (${id}.issues.length) {
|
|
572
|
+
if (input[${k}] === undefined) {
|
|
573
|
+
if (${k} in input) {
|
|
574
|
+
newResult[${k}] = undefined;
|
|
575
|
+
}
|
|
576
|
+
} else {
|
|
577
|
+
payload.issues = payload.issues.concat(
|
|
578
|
+
${id}.issues.map((iss) => ({
|
|
579
|
+
...iss,
|
|
580
|
+
path: iss.path ? [${k}, ...iss.path] : [${k}],
|
|
581
|
+
}))
|
|
582
|
+
);
|
|
583
|
+
}
|
|
584
|
+
} else if (${id}.value === undefined) {
|
|
585
|
+
if (${k} in input) newResult[${k}] = undefined;
|
|
586
|
+
} else {
|
|
587
|
+
newResult[${k}] = ${id}.value;
|
|
588
|
+
}
|
|
589
|
+
`);
|
|
590
|
+
} else {
|
|
591
|
+
const id = ids[key];
|
|
592
|
+
doc.write(`const ${id} = ${parseStr(key)};`);
|
|
593
|
+
doc.write(`
|
|
594
|
+
if (${id}.issues.length) payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
|
|
595
|
+
...iss,
|
|
596
|
+
path: iss.path ? [${esc(key)}, ...iss.path] : [${esc(key)}]
|
|
597
|
+
})));`);
|
|
598
|
+
doc.write(`newResult[${esc(key)}] = ${id}.value`);
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
doc.write(`payload.value = newResult;`);
|
|
602
|
+
doc.write(`return payload;`);
|
|
603
|
+
const fn = doc.compile();
|
|
604
|
+
return (payload, ctx) => fn(shape, payload, ctx);
|
|
605
|
+
};
|
|
606
|
+
let fastpass;
|
|
607
|
+
const isObject$1 = isObject;
|
|
608
|
+
const jit = !globalConfig.jitless;
|
|
609
|
+
const allowsEval$1 = allowsEval;
|
|
610
|
+
const fastEnabled = jit && allowsEval$1.value;
|
|
611
|
+
const catchall = def.catchall;
|
|
612
|
+
let value;
|
|
613
|
+
inst._zod.parse = (payload, ctx) => {
|
|
614
|
+
value ?? (value = _normalized.value);
|
|
615
|
+
const input = payload.value;
|
|
616
|
+
if (!isObject$1(input)) {
|
|
617
|
+
payload.issues.push({
|
|
618
|
+
expected: "object",
|
|
619
|
+
code: "invalid_type",
|
|
620
|
+
input,
|
|
621
|
+
inst
|
|
622
|
+
});
|
|
623
|
+
return payload;
|
|
624
|
+
}
|
|
625
|
+
const proms = [];
|
|
626
|
+
if (jit && fastEnabled && ctx?.async === false && ctx.jitless !== true) {
|
|
627
|
+
if (!fastpass)
|
|
628
|
+
fastpass = generateFastpass(def.shape);
|
|
629
|
+
payload = fastpass(payload, ctx);
|
|
630
|
+
} else {
|
|
631
|
+
payload.value = {};
|
|
632
|
+
const shape = value.shape;
|
|
633
|
+
for (const key of value.keys) {
|
|
634
|
+
const el = shape[key];
|
|
635
|
+
const r = el._zod.run({ value: input[key], issues: [] }, ctx);
|
|
636
|
+
const isOptional = el._zod.optin === "optional" && el._zod.optout === "optional";
|
|
637
|
+
if (r instanceof Promise) {
|
|
638
|
+
proms.push(r.then((r2) => isOptional ? handleOptionalObjectResult(r2, payload, key, input) : handleObjectResult(r2, payload, key)));
|
|
639
|
+
} else if (isOptional) {
|
|
640
|
+
handleOptionalObjectResult(r, payload, key, input);
|
|
641
|
+
} else {
|
|
642
|
+
handleObjectResult(r, payload, key);
|
|
643
|
+
}
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
if (!catchall) {
|
|
647
|
+
return proms.length ? Promise.all(proms).then(() => payload) : payload;
|
|
648
|
+
}
|
|
649
|
+
const unrecognized = [];
|
|
650
|
+
const keySet = value.keySet;
|
|
651
|
+
const _catchall = catchall._zod;
|
|
652
|
+
const t = _catchall.def.type;
|
|
653
|
+
for (const key of Object.keys(input)) {
|
|
654
|
+
if (keySet.has(key))
|
|
655
|
+
continue;
|
|
656
|
+
if (t === "never") {
|
|
657
|
+
unrecognized.push(key);
|
|
658
|
+
continue;
|
|
659
|
+
}
|
|
660
|
+
const r = _catchall.run({ value: input[key], issues: [] }, ctx);
|
|
661
|
+
if (r instanceof Promise) {
|
|
662
|
+
proms.push(r.then((r2) => handleObjectResult(r2, payload, key)));
|
|
663
|
+
} else {
|
|
664
|
+
handleObjectResult(r, payload, key);
|
|
665
|
+
}
|
|
666
|
+
}
|
|
667
|
+
if (unrecognized.length) {
|
|
668
|
+
payload.issues.push({
|
|
669
|
+
code: "unrecognized_keys",
|
|
670
|
+
keys: unrecognized,
|
|
671
|
+
input,
|
|
672
|
+
inst
|
|
673
|
+
});
|
|
674
|
+
}
|
|
675
|
+
if (!proms.length)
|
|
676
|
+
return payload;
|
|
677
|
+
return Promise.all(proms).then(() => {
|
|
678
|
+
return payload;
|
|
679
|
+
});
|
|
680
|
+
};
|
|
681
|
+
});
|
|
682
|
+
function handleUnionResults(results, final, inst, ctx) {
|
|
683
|
+
for (const result of results) {
|
|
684
|
+
if (result.issues.length === 0) {
|
|
685
|
+
final.value = result.value;
|
|
686
|
+
return final;
|
|
687
|
+
}
|
|
688
|
+
}
|
|
689
|
+
final.issues.push({
|
|
690
|
+
code: "invalid_union",
|
|
691
|
+
input: final.value,
|
|
692
|
+
inst,
|
|
693
|
+
errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
|
|
694
|
+
});
|
|
695
|
+
return final;
|
|
696
|
+
}
|
|
697
|
+
const $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
698
|
+
$ZodType.init(inst, def);
|
|
699
|
+
defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
|
|
700
|
+
defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
|
|
701
|
+
defineLazy(inst._zod, "values", () => {
|
|
702
|
+
if (def.options.every((o) => o._zod.values)) {
|
|
703
|
+
return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
|
|
704
|
+
}
|
|
705
|
+
return void 0;
|
|
706
|
+
});
|
|
707
|
+
defineLazy(inst._zod, "pattern", () => {
|
|
708
|
+
if (def.options.every((o) => o._zod.pattern)) {
|
|
709
|
+
const patterns = def.options.map((o) => o._zod.pattern);
|
|
710
|
+
return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
|
|
711
|
+
}
|
|
712
|
+
return void 0;
|
|
713
|
+
});
|
|
714
|
+
inst._zod.parse = (payload, ctx) => {
|
|
715
|
+
let async = false;
|
|
716
|
+
const results = [];
|
|
717
|
+
for (const option of def.options) {
|
|
718
|
+
const result = option._zod.run({
|
|
719
|
+
value: payload.value,
|
|
720
|
+
issues: []
|
|
721
|
+
}, ctx);
|
|
722
|
+
if (result instanceof Promise) {
|
|
723
|
+
results.push(result);
|
|
724
|
+
async = true;
|
|
725
|
+
} else {
|
|
726
|
+
if (result.issues.length === 0)
|
|
727
|
+
return result;
|
|
728
|
+
results.push(result);
|
|
729
|
+
}
|
|
730
|
+
}
|
|
731
|
+
if (!async)
|
|
732
|
+
return handleUnionResults(results, payload, inst, ctx);
|
|
733
|
+
return Promise.all(results).then((results2) => {
|
|
734
|
+
return handleUnionResults(results2, payload, inst, ctx);
|
|
735
|
+
});
|
|
736
|
+
};
|
|
737
|
+
});
|
|
738
|
+
const $ZodDiscriminatedUnion = /* @__PURE__ */ $constructor("$ZodDiscriminatedUnion", (inst, def) => {
|
|
739
|
+
$ZodUnion.init(inst, def);
|
|
740
|
+
const _super = inst._zod.parse;
|
|
741
|
+
defineLazy(inst._zod, "propValues", () => {
|
|
742
|
+
const propValues = {};
|
|
743
|
+
for (const option of def.options) {
|
|
744
|
+
const pv = option._zod.propValues;
|
|
745
|
+
if (!pv || Object.keys(pv).length === 0)
|
|
746
|
+
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(option)}"`);
|
|
747
|
+
for (const [k, v] of Object.entries(pv)) {
|
|
748
|
+
if (!propValues[k])
|
|
749
|
+
propValues[k] = /* @__PURE__ */ new Set();
|
|
750
|
+
for (const val of v) {
|
|
751
|
+
propValues[k].add(val);
|
|
752
|
+
}
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
return propValues;
|
|
756
|
+
});
|
|
757
|
+
const disc = cached(() => {
|
|
758
|
+
const opts = def.options;
|
|
759
|
+
const map = /* @__PURE__ */ new Map();
|
|
760
|
+
for (const o of opts) {
|
|
761
|
+
const values = o._zod.propValues[def.discriminator];
|
|
762
|
+
if (!values || values.size === 0)
|
|
763
|
+
throw new Error(`Invalid discriminated union option at index "${def.options.indexOf(o)}"`);
|
|
764
|
+
for (const v of values) {
|
|
765
|
+
if (map.has(v)) {
|
|
766
|
+
throw new Error(`Duplicate discriminator value "${String(v)}"`);
|
|
767
|
+
}
|
|
768
|
+
map.set(v, o);
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
return map;
|
|
772
|
+
});
|
|
773
|
+
inst._zod.parse = (payload, ctx) => {
|
|
774
|
+
const input = payload.value;
|
|
775
|
+
if (!isObject(input)) {
|
|
776
|
+
payload.issues.push({
|
|
777
|
+
code: "invalid_type",
|
|
778
|
+
expected: "object",
|
|
779
|
+
input,
|
|
780
|
+
inst
|
|
781
|
+
});
|
|
782
|
+
return payload;
|
|
783
|
+
}
|
|
784
|
+
const opt = disc.value.get(input?.[def.discriminator]);
|
|
785
|
+
if (opt) {
|
|
786
|
+
return opt._zod.run(payload, ctx);
|
|
787
|
+
}
|
|
788
|
+
if (def.unionFallback) {
|
|
789
|
+
return _super(payload, ctx);
|
|
790
|
+
}
|
|
791
|
+
payload.issues.push({
|
|
792
|
+
code: "invalid_union",
|
|
793
|
+
errors: [],
|
|
794
|
+
note: "No matching discriminator",
|
|
795
|
+
input,
|
|
796
|
+
path: [def.discriminator],
|
|
797
|
+
inst
|
|
798
|
+
});
|
|
799
|
+
return payload;
|
|
800
|
+
};
|
|
801
|
+
});
|
|
802
|
+
const $ZodIntersection = /* @__PURE__ */ $constructor("$ZodIntersection", (inst, def) => {
|
|
803
|
+
$ZodType.init(inst, def);
|
|
804
|
+
inst._zod.parse = (payload, ctx) => {
|
|
805
|
+
const input = payload.value;
|
|
806
|
+
const left = def.left._zod.run({ value: input, issues: [] }, ctx);
|
|
807
|
+
const right = def.right._zod.run({ value: input, issues: [] }, ctx);
|
|
808
|
+
const async = left instanceof Promise || right instanceof Promise;
|
|
809
|
+
if (async) {
|
|
810
|
+
return Promise.all([left, right]).then(([left2, right2]) => {
|
|
811
|
+
return handleIntersectionResults(payload, left2, right2);
|
|
812
|
+
});
|
|
813
|
+
}
|
|
814
|
+
return handleIntersectionResults(payload, left, right);
|
|
815
|
+
};
|
|
816
|
+
});
|
|
817
|
+
function mergeValues(a, b) {
|
|
818
|
+
if (a === b) {
|
|
819
|
+
return { valid: true, data: a };
|
|
820
|
+
}
|
|
821
|
+
if (a instanceof Date && b instanceof Date && +a === +b) {
|
|
822
|
+
return { valid: true, data: a };
|
|
823
|
+
}
|
|
824
|
+
if (isPlainObject(a) && isPlainObject(b)) {
|
|
825
|
+
const bKeys = Object.keys(b);
|
|
826
|
+
const sharedKeys = Object.keys(a).filter((key) => bKeys.indexOf(key) !== -1);
|
|
827
|
+
const newObj = { ...a, ...b };
|
|
828
|
+
for (const key of sharedKeys) {
|
|
829
|
+
const sharedValue = mergeValues(a[key], b[key]);
|
|
830
|
+
if (!sharedValue.valid) {
|
|
831
|
+
return {
|
|
832
|
+
valid: false,
|
|
833
|
+
mergeErrorPath: [key, ...sharedValue.mergeErrorPath]
|
|
834
|
+
};
|
|
835
|
+
}
|
|
836
|
+
newObj[key] = sharedValue.data;
|
|
837
|
+
}
|
|
838
|
+
return { valid: true, data: newObj };
|
|
839
|
+
}
|
|
840
|
+
if (Array.isArray(a) && Array.isArray(b)) {
|
|
841
|
+
if (a.length !== b.length) {
|
|
842
|
+
return { valid: false, mergeErrorPath: [] };
|
|
843
|
+
}
|
|
844
|
+
const newArray = [];
|
|
845
|
+
for (let index = 0; index < a.length; index++) {
|
|
846
|
+
const itemA = a[index];
|
|
847
|
+
const itemB = b[index];
|
|
848
|
+
const sharedValue = mergeValues(itemA, itemB);
|
|
849
|
+
if (!sharedValue.valid) {
|
|
850
|
+
return {
|
|
851
|
+
valid: false,
|
|
852
|
+
mergeErrorPath: [index, ...sharedValue.mergeErrorPath]
|
|
853
|
+
};
|
|
854
|
+
}
|
|
855
|
+
newArray.push(sharedValue.data);
|
|
856
|
+
}
|
|
857
|
+
return { valid: true, data: newArray };
|
|
858
|
+
}
|
|
859
|
+
return { valid: false, mergeErrorPath: [] };
|
|
860
|
+
}
|
|
861
|
+
function handleIntersectionResults(result, left, right) {
|
|
862
|
+
if (left.issues.length) {
|
|
863
|
+
result.issues.push(...left.issues);
|
|
864
|
+
}
|
|
865
|
+
if (right.issues.length) {
|
|
866
|
+
result.issues.push(...right.issues);
|
|
867
|
+
}
|
|
868
|
+
if (aborted(result))
|
|
869
|
+
return result;
|
|
870
|
+
const merged = mergeValues(left.value, right.value);
|
|
871
|
+
if (!merged.valid) {
|
|
872
|
+
throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
|
|
873
|
+
}
|
|
874
|
+
result.value = merged.data;
|
|
875
|
+
return result;
|
|
876
|
+
}
|
|
877
|
+
const $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
|
|
878
|
+
$ZodType.init(inst, def);
|
|
879
|
+
inst._zod.parse = (payload, ctx) => {
|
|
880
|
+
const input = payload.value;
|
|
881
|
+
if (!isPlainObject(input)) {
|
|
882
|
+
payload.issues.push({
|
|
883
|
+
expected: "record",
|
|
884
|
+
code: "invalid_type",
|
|
885
|
+
input,
|
|
886
|
+
inst
|
|
887
|
+
});
|
|
888
|
+
return payload;
|
|
889
|
+
}
|
|
890
|
+
const proms = [];
|
|
891
|
+
if (def.keyType._zod.values) {
|
|
892
|
+
const values = def.keyType._zod.values;
|
|
893
|
+
payload.value = {};
|
|
894
|
+
for (const key of values) {
|
|
895
|
+
if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
|
|
896
|
+
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
897
|
+
if (result instanceof Promise) {
|
|
898
|
+
proms.push(result.then((result2) => {
|
|
899
|
+
if (result2.issues.length) {
|
|
900
|
+
payload.issues.push(...prefixIssues(key, result2.issues));
|
|
901
|
+
}
|
|
902
|
+
payload.value[key] = result2.value;
|
|
903
|
+
}));
|
|
904
|
+
} else {
|
|
905
|
+
if (result.issues.length) {
|
|
906
|
+
payload.issues.push(...prefixIssues(key, result.issues));
|
|
907
|
+
}
|
|
908
|
+
payload.value[key] = result.value;
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
let unrecognized;
|
|
913
|
+
for (const key in input) {
|
|
914
|
+
if (!values.has(key)) {
|
|
915
|
+
unrecognized = unrecognized ?? [];
|
|
916
|
+
unrecognized.push(key);
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
if (unrecognized && unrecognized.length > 0) {
|
|
920
|
+
payload.issues.push({
|
|
921
|
+
code: "unrecognized_keys",
|
|
922
|
+
input,
|
|
923
|
+
inst,
|
|
924
|
+
keys: unrecognized
|
|
925
|
+
});
|
|
926
|
+
}
|
|
927
|
+
} else {
|
|
928
|
+
payload.value = {};
|
|
929
|
+
for (const key of Reflect.ownKeys(input)) {
|
|
930
|
+
if (key === "__proto__")
|
|
931
|
+
continue;
|
|
932
|
+
const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
|
|
933
|
+
if (keyResult instanceof Promise) {
|
|
934
|
+
throw new Error("Async schemas not supported in object keys currently");
|
|
935
|
+
}
|
|
936
|
+
if (keyResult.issues.length) {
|
|
937
|
+
payload.issues.push({
|
|
938
|
+
origin: "record",
|
|
939
|
+
code: "invalid_key",
|
|
940
|
+
issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
|
|
941
|
+
input: key,
|
|
942
|
+
path: [key],
|
|
943
|
+
inst
|
|
944
|
+
});
|
|
945
|
+
payload.value[keyResult.value] = keyResult.value;
|
|
946
|
+
continue;
|
|
947
|
+
}
|
|
948
|
+
const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
|
|
949
|
+
if (result instanceof Promise) {
|
|
950
|
+
proms.push(result.then((result2) => {
|
|
951
|
+
if (result2.issues.length) {
|
|
952
|
+
payload.issues.push(...prefixIssues(key, result2.issues));
|
|
953
|
+
}
|
|
954
|
+
payload.value[keyResult.value] = result2.value;
|
|
955
|
+
}));
|
|
956
|
+
} else {
|
|
957
|
+
if (result.issues.length) {
|
|
958
|
+
payload.issues.push(...prefixIssues(key, result.issues));
|
|
959
|
+
}
|
|
960
|
+
payload.value[keyResult.value] = result.value;
|
|
961
|
+
}
|
|
962
|
+
}
|
|
963
|
+
}
|
|
964
|
+
if (proms.length) {
|
|
965
|
+
return Promise.all(proms).then(() => payload);
|
|
966
|
+
}
|
|
967
|
+
return payload;
|
|
968
|
+
};
|
|
969
|
+
});
|
|
970
|
+
const $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
|
|
971
|
+
$ZodType.init(inst, def);
|
|
972
|
+
const values = getEnumValues(def.entries);
|
|
973
|
+
inst._zod.values = new Set(values);
|
|
974
|
+
inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
|
|
975
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
976
|
+
const input = payload.value;
|
|
977
|
+
if (inst._zod.values.has(input)) {
|
|
978
|
+
return payload;
|
|
979
|
+
}
|
|
980
|
+
payload.issues.push({
|
|
981
|
+
code: "invalid_value",
|
|
982
|
+
values,
|
|
983
|
+
input,
|
|
984
|
+
inst
|
|
985
|
+
});
|
|
986
|
+
return payload;
|
|
987
|
+
};
|
|
988
|
+
});
|
|
989
|
+
const $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
|
|
990
|
+
$ZodType.init(inst, def);
|
|
991
|
+
inst._zod.values = new Set(def.values);
|
|
992
|
+
inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? o.toString() : String(o)).join("|")})$`);
|
|
993
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
994
|
+
const input = payload.value;
|
|
995
|
+
if (inst._zod.values.has(input)) {
|
|
996
|
+
return payload;
|
|
997
|
+
}
|
|
998
|
+
payload.issues.push({
|
|
999
|
+
code: "invalid_value",
|
|
1000
|
+
values: def.values,
|
|
1001
|
+
input,
|
|
1002
|
+
inst
|
|
1003
|
+
});
|
|
1004
|
+
return payload;
|
|
1005
|
+
};
|
|
1006
|
+
});
|
|
1007
|
+
const $ZodTransform = /* @__PURE__ */ $constructor("$ZodTransform", (inst, def) => {
|
|
1008
|
+
$ZodType.init(inst, def);
|
|
1009
|
+
inst._zod.parse = (payload, _ctx) => {
|
|
1010
|
+
const _out = def.transform(payload.value, payload);
|
|
1011
|
+
if (_ctx.async) {
|
|
1012
|
+
const output = _out instanceof Promise ? _out : Promise.resolve(_out);
|
|
1013
|
+
return output.then((output2) => {
|
|
1014
|
+
payload.value = output2;
|
|
1015
|
+
return payload;
|
|
1016
|
+
});
|
|
1017
|
+
}
|
|
1018
|
+
if (_out instanceof Promise) {
|
|
1019
|
+
throw new $ZodAsyncError();
|
|
1020
|
+
}
|
|
1021
|
+
payload.value = _out;
|
|
1022
|
+
return payload;
|
|
1023
|
+
};
|
|
1024
|
+
});
|
|
1025
|
+
const $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
|
|
1026
|
+
$ZodType.init(inst, def);
|
|
1027
|
+
inst._zod.optin = "optional";
|
|
1028
|
+
inst._zod.optout = "optional";
|
|
1029
|
+
defineLazy(inst._zod, "values", () => {
|
|
1030
|
+
return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, void 0]) : void 0;
|
|
1031
|
+
});
|
|
1032
|
+
defineLazy(inst._zod, "pattern", () => {
|
|
1033
|
+
const pattern = def.innerType._zod.pattern;
|
|
1034
|
+
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
|
|
1035
|
+
});
|
|
1036
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1037
|
+
if (def.innerType._zod.optin === "optional") {
|
|
1038
|
+
return def.innerType._zod.run(payload, ctx);
|
|
1039
|
+
}
|
|
1040
|
+
if (payload.value === void 0) {
|
|
1041
|
+
return payload;
|
|
1042
|
+
}
|
|
1043
|
+
return def.innerType._zod.run(payload, ctx);
|
|
1044
|
+
};
|
|
1045
|
+
});
|
|
1046
|
+
const $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
|
|
1047
|
+
$ZodType.init(inst, def);
|
|
1048
|
+
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
1049
|
+
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
1050
|
+
defineLazy(inst._zod, "pattern", () => {
|
|
1051
|
+
const pattern = def.innerType._zod.pattern;
|
|
1052
|
+
return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
|
|
1053
|
+
});
|
|
1054
|
+
defineLazy(inst._zod, "values", () => {
|
|
1055
|
+
return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, null]) : void 0;
|
|
1056
|
+
});
|
|
1057
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1058
|
+
if (payload.value === null)
|
|
1059
|
+
return payload;
|
|
1060
|
+
return def.innerType._zod.run(payload, ctx);
|
|
1061
|
+
};
|
|
1062
|
+
});
|
|
1063
|
+
const $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
|
|
1064
|
+
$ZodType.init(inst, def);
|
|
1065
|
+
inst._zod.optin = "optional";
|
|
1066
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
1067
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1068
|
+
if (payload.value === void 0) {
|
|
1069
|
+
payload.value = def.defaultValue;
|
|
1070
|
+
return payload;
|
|
1071
|
+
}
|
|
1072
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
1073
|
+
if (result instanceof Promise) {
|
|
1074
|
+
return result.then((result2) => handleDefaultResult(result2, def));
|
|
1075
|
+
}
|
|
1076
|
+
return handleDefaultResult(result, def);
|
|
1077
|
+
};
|
|
1078
|
+
});
|
|
1079
|
+
function handleDefaultResult(payload, def) {
|
|
1080
|
+
if (payload.value === void 0) {
|
|
1081
|
+
payload.value = def.defaultValue;
|
|
1082
|
+
}
|
|
1083
|
+
return payload;
|
|
1084
|
+
}
|
|
1085
|
+
const $ZodPrefault = /* @__PURE__ */ $constructor("$ZodPrefault", (inst, def) => {
|
|
1086
|
+
$ZodType.init(inst, def);
|
|
1087
|
+
inst._zod.optin = "optional";
|
|
1088
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
1089
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1090
|
+
if (payload.value === void 0) {
|
|
1091
|
+
payload.value = def.defaultValue;
|
|
1092
|
+
}
|
|
1093
|
+
return def.innerType._zod.run(payload, ctx);
|
|
1094
|
+
};
|
|
1095
|
+
});
|
|
1096
|
+
const $ZodNonOptional = /* @__PURE__ */ $constructor("$ZodNonOptional", (inst, def) => {
|
|
1097
|
+
$ZodType.init(inst, def);
|
|
1098
|
+
defineLazy(inst._zod, "values", () => {
|
|
1099
|
+
const v = def.innerType._zod.values;
|
|
1100
|
+
return v ? new Set([...v].filter((x) => x !== void 0)) : void 0;
|
|
1101
|
+
});
|
|
1102
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1103
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
1104
|
+
if (result instanceof Promise) {
|
|
1105
|
+
return result.then((result2) => handleNonOptionalResult(result2, inst));
|
|
1106
|
+
}
|
|
1107
|
+
return handleNonOptionalResult(result, inst);
|
|
1108
|
+
};
|
|
1109
|
+
});
|
|
1110
|
+
function handleNonOptionalResult(payload, inst) {
|
|
1111
|
+
if (!payload.issues.length && payload.value === void 0) {
|
|
1112
|
+
payload.issues.push({
|
|
1113
|
+
code: "invalid_type",
|
|
1114
|
+
expected: "nonoptional",
|
|
1115
|
+
input: payload.value,
|
|
1116
|
+
inst
|
|
1117
|
+
});
|
|
1118
|
+
}
|
|
1119
|
+
return payload;
|
|
1120
|
+
}
|
|
1121
|
+
const $ZodCatch = /* @__PURE__ */ $constructor("$ZodCatch", (inst, def) => {
|
|
1122
|
+
$ZodType.init(inst, def);
|
|
1123
|
+
inst._zod.optin = "optional";
|
|
1124
|
+
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
1125
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
1126
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1127
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
1128
|
+
if (result instanceof Promise) {
|
|
1129
|
+
return result.then((result2) => {
|
|
1130
|
+
payload.value = result2.value;
|
|
1131
|
+
if (result2.issues.length) {
|
|
1132
|
+
payload.value = def.catchValue({
|
|
1133
|
+
...payload,
|
|
1134
|
+
error: {
|
|
1135
|
+
issues: result2.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
1136
|
+
},
|
|
1137
|
+
input: payload.value
|
|
1138
|
+
});
|
|
1139
|
+
payload.issues = [];
|
|
1140
|
+
}
|
|
1141
|
+
return payload;
|
|
1142
|
+
});
|
|
1143
|
+
}
|
|
1144
|
+
payload.value = result.value;
|
|
1145
|
+
if (result.issues.length) {
|
|
1146
|
+
payload.value = def.catchValue({
|
|
1147
|
+
...payload,
|
|
1148
|
+
error: {
|
|
1149
|
+
issues: result.issues.map((iss) => finalizeIssue(iss, ctx, config()))
|
|
1150
|
+
},
|
|
1151
|
+
input: payload.value
|
|
1152
|
+
});
|
|
1153
|
+
payload.issues = [];
|
|
1154
|
+
}
|
|
1155
|
+
return payload;
|
|
1156
|
+
};
|
|
1157
|
+
});
|
|
1158
|
+
const $ZodPipe = /* @__PURE__ */ $constructor("$ZodPipe", (inst, def) => {
|
|
1159
|
+
$ZodType.init(inst, def);
|
|
1160
|
+
defineLazy(inst._zod, "values", () => def.in._zod.values);
|
|
1161
|
+
defineLazy(inst._zod, "optin", () => def.in._zod.optin);
|
|
1162
|
+
defineLazy(inst._zod, "optout", () => def.out._zod.optout);
|
|
1163
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1164
|
+
const left = def.in._zod.run(payload, ctx);
|
|
1165
|
+
if (left instanceof Promise) {
|
|
1166
|
+
return left.then((left2) => handlePipeResult(left2, def, ctx));
|
|
1167
|
+
}
|
|
1168
|
+
return handlePipeResult(left, def, ctx);
|
|
1169
|
+
};
|
|
1170
|
+
});
|
|
1171
|
+
function handlePipeResult(left, def, ctx) {
|
|
1172
|
+
if (aborted(left)) {
|
|
1173
|
+
return left;
|
|
1174
|
+
}
|
|
1175
|
+
return def.out._zod.run({ value: left.value, issues: left.issues }, ctx);
|
|
1176
|
+
}
|
|
1177
|
+
const $ZodReadonly = /* @__PURE__ */ $constructor("$ZodReadonly", (inst, def) => {
|
|
1178
|
+
$ZodType.init(inst, def);
|
|
1179
|
+
defineLazy(inst._zod, "propValues", () => def.innerType._zod.propValues);
|
|
1180
|
+
defineLazy(inst._zod, "values", () => def.innerType._zod.values);
|
|
1181
|
+
defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
|
|
1182
|
+
defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
|
|
1183
|
+
inst._zod.parse = (payload, ctx) => {
|
|
1184
|
+
const result = def.innerType._zod.run(payload, ctx);
|
|
1185
|
+
if (result instanceof Promise) {
|
|
1186
|
+
return result.then(handleReadonlyResult);
|
|
1187
|
+
}
|
|
1188
|
+
return handleReadonlyResult(result);
|
|
1189
|
+
};
|
|
1190
|
+
});
|
|
1191
|
+
function handleReadonlyResult(payload) {
|
|
1192
|
+
payload.value = Object.freeze(payload.value);
|
|
1193
|
+
return payload;
|
|
1194
|
+
}
|
|
1195
|
+
const $ZodCustom = /* @__PURE__ */ $constructor("$ZodCustom", (inst, def) => {
|
|
1196
|
+
$ZodCheck.init(inst, def);
|
|
1197
|
+
$ZodType.init(inst, def);
|
|
1198
|
+
inst._zod.parse = (payload, _) => {
|
|
1199
|
+
return payload;
|
|
1200
|
+
};
|
|
1201
|
+
inst._zod.check = (payload) => {
|
|
1202
|
+
const input = payload.value;
|
|
1203
|
+
const r = def.fn(input);
|
|
1204
|
+
if (r instanceof Promise) {
|
|
1205
|
+
return r.then((r2) => handleRefineResult(r2, payload, input, inst));
|
|
1206
|
+
}
|
|
1207
|
+
handleRefineResult(r, payload, input, inst);
|
|
1208
|
+
return;
|
|
1209
|
+
};
|
|
1210
|
+
});
|
|
1211
|
+
function handleRefineResult(result, payload, input, inst) {
|
|
1212
|
+
if (!result) {
|
|
1213
|
+
const _iss = {
|
|
1214
|
+
code: "custom",
|
|
1215
|
+
input,
|
|
1216
|
+
inst,
|
|
1217
|
+
// incorporates params.error into issue reporting
|
|
1218
|
+
path: [...inst._zod.def.path ?? []],
|
|
1219
|
+
// incorporates params.error into issue reporting
|
|
1220
|
+
continue: !inst._zod.def.abort
|
|
1221
|
+
// params: inst._zod.def.params,
|
|
1222
|
+
};
|
|
1223
|
+
if (inst._zod.def.params)
|
|
1224
|
+
_iss.params = inst._zod.def.params;
|
|
1225
|
+
payload.issues.push(issue(_iss));
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1228
|
+
export {
|
|
1229
|
+
$ZodArray,
|
|
1230
|
+
$ZodBase64,
|
|
1231
|
+
$ZodBase64URL,
|
|
1232
|
+
$ZodBoolean,
|
|
1233
|
+
$ZodCIDRv4,
|
|
1234
|
+
$ZodCIDRv6,
|
|
1235
|
+
$ZodCUID,
|
|
1236
|
+
$ZodCUID2,
|
|
1237
|
+
$ZodCatch,
|
|
1238
|
+
$ZodCustom,
|
|
1239
|
+
$ZodDefault,
|
|
1240
|
+
$ZodDiscriminatedUnion,
|
|
1241
|
+
$ZodE164,
|
|
1242
|
+
$ZodEmail,
|
|
1243
|
+
$ZodEmoji,
|
|
1244
|
+
$ZodEnum,
|
|
1245
|
+
$ZodGUID,
|
|
1246
|
+
$ZodIPv4,
|
|
1247
|
+
$ZodIPv6,
|
|
1248
|
+
$ZodISODate,
|
|
1249
|
+
$ZodISODateTime,
|
|
1250
|
+
$ZodISODuration,
|
|
1251
|
+
$ZodISOTime,
|
|
1252
|
+
$ZodIntersection,
|
|
1253
|
+
$ZodJWT,
|
|
1254
|
+
$ZodKSUID,
|
|
1255
|
+
$ZodLiteral,
|
|
1256
|
+
$ZodNanoID,
|
|
1257
|
+
$ZodNever,
|
|
1258
|
+
$ZodNonOptional,
|
|
1259
|
+
$ZodNullable,
|
|
1260
|
+
$ZodNumber,
|
|
1261
|
+
$ZodNumberFormat,
|
|
1262
|
+
$ZodObject,
|
|
1263
|
+
$ZodOptional,
|
|
1264
|
+
$ZodPipe,
|
|
1265
|
+
$ZodPrefault,
|
|
1266
|
+
$ZodReadonly,
|
|
1267
|
+
$ZodRecord,
|
|
1268
|
+
$ZodString,
|
|
1269
|
+
$ZodStringFormat,
|
|
1270
|
+
$ZodTransform,
|
|
1271
|
+
$ZodType,
|
|
1272
|
+
$ZodULID,
|
|
1273
|
+
$ZodURL,
|
|
1274
|
+
$ZodUUID,
|
|
1275
|
+
$ZodUnion,
|
|
1276
|
+
$ZodUnknown,
|
|
1277
|
+
$ZodXID,
|
|
1278
|
+
clone,
|
|
1279
|
+
isValidBase64,
|
|
1280
|
+
isValidBase64URL,
|
|
1281
|
+
isValidJWT
|
|
1282
|
+
};
|
|
1283
|
+
//# sourceMappingURL=schemas.js.map
|