@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,628 @@
|
|
|
1
|
+
import { __exports as core } from "../../../_virtual/core.js";
|
|
2
|
+
import { __require as requireValidate } from "./compile/validate/index.js";
|
|
3
|
+
import { __require as requireCodegen } from "./compile/codegen/index.js";
|
|
4
|
+
import { __require as requireValidation_error } from "./runtime/validation_error.js";
|
|
5
|
+
import { __require as requireRef_error } from "./compile/ref_error.js";
|
|
6
|
+
import { __require as requireRules } from "./compile/rules.js";
|
|
7
|
+
import { __require as requireCompile } from "./compile/index.js";
|
|
8
|
+
import { __require as requireResolve } from "./compile/resolve.js";
|
|
9
|
+
import { __require as requireDataType } from "./compile/validate/dataType.js";
|
|
10
|
+
import { __require as requireUtil } from "./compile/util.js";
|
|
11
|
+
import require$$9 from "./refs/data.json.js";
|
|
12
|
+
import { __require as requireUri } from "./runtime/uri.js";
|
|
13
|
+
var hasRequiredCore;
|
|
14
|
+
function requireCore() {
|
|
15
|
+
if (hasRequiredCore) return core;
|
|
16
|
+
hasRequiredCore = 1;
|
|
17
|
+
(function(exports$1) {
|
|
18
|
+
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
19
|
+
exports$1.CodeGen = exports$1.Name = exports$1.nil = exports$1.stringify = exports$1.str = exports$1._ = exports$1.KeywordCxt = void 0;
|
|
20
|
+
var validate_1 = requireValidate();
|
|
21
|
+
Object.defineProperty(exports$1, "KeywordCxt", { enumerable: true, get: function() {
|
|
22
|
+
return validate_1.KeywordCxt;
|
|
23
|
+
} });
|
|
24
|
+
var codegen_1 = requireCodegen();
|
|
25
|
+
Object.defineProperty(exports$1, "_", { enumerable: true, get: function() {
|
|
26
|
+
return codegen_1._;
|
|
27
|
+
} });
|
|
28
|
+
Object.defineProperty(exports$1, "str", { enumerable: true, get: function() {
|
|
29
|
+
return codegen_1.str;
|
|
30
|
+
} });
|
|
31
|
+
Object.defineProperty(exports$1, "stringify", { enumerable: true, get: function() {
|
|
32
|
+
return codegen_1.stringify;
|
|
33
|
+
} });
|
|
34
|
+
Object.defineProperty(exports$1, "nil", { enumerable: true, get: function() {
|
|
35
|
+
return codegen_1.nil;
|
|
36
|
+
} });
|
|
37
|
+
Object.defineProperty(exports$1, "Name", { enumerable: true, get: function() {
|
|
38
|
+
return codegen_1.Name;
|
|
39
|
+
} });
|
|
40
|
+
Object.defineProperty(exports$1, "CodeGen", { enumerable: true, get: function() {
|
|
41
|
+
return codegen_1.CodeGen;
|
|
42
|
+
} });
|
|
43
|
+
const validation_error_1 = requireValidation_error();
|
|
44
|
+
const ref_error_1 = requireRef_error();
|
|
45
|
+
const rules_1 = requireRules();
|
|
46
|
+
const compile_1 = requireCompile();
|
|
47
|
+
const codegen_2 = requireCodegen();
|
|
48
|
+
const resolve_1 = requireResolve();
|
|
49
|
+
const dataType_1 = requireDataType();
|
|
50
|
+
const util_1 = requireUtil();
|
|
51
|
+
const $dataRefSchema = require$$9;
|
|
52
|
+
const uri_1 = requireUri();
|
|
53
|
+
const defaultRegExp = (str, flags) => new RegExp(str, flags);
|
|
54
|
+
defaultRegExp.code = "new RegExp";
|
|
55
|
+
const META_IGNORE_OPTIONS = ["removeAdditional", "useDefaults", "coerceTypes"];
|
|
56
|
+
const EXT_SCOPE_NAMES = /* @__PURE__ */ new Set([
|
|
57
|
+
"validate",
|
|
58
|
+
"serialize",
|
|
59
|
+
"parse",
|
|
60
|
+
"wrapper",
|
|
61
|
+
"root",
|
|
62
|
+
"schema",
|
|
63
|
+
"keyword",
|
|
64
|
+
"pattern",
|
|
65
|
+
"formats",
|
|
66
|
+
"validate$data",
|
|
67
|
+
"func",
|
|
68
|
+
"obj",
|
|
69
|
+
"Error"
|
|
70
|
+
]);
|
|
71
|
+
const removedOptions = {
|
|
72
|
+
errorDataPath: "",
|
|
73
|
+
format: "`validateFormats: false` can be used instead.",
|
|
74
|
+
nullable: '"nullable" keyword is supported by default.',
|
|
75
|
+
jsonPointers: "Deprecated jsPropertySyntax can be used instead.",
|
|
76
|
+
extendRefs: "Deprecated ignoreKeywordsWithRef can be used instead.",
|
|
77
|
+
missingRefs: "Pass empty schema with $id that should be ignored to ajv.addSchema.",
|
|
78
|
+
processCode: "Use option `code: {process: (code, schemaEnv: object) => string}`",
|
|
79
|
+
sourceCode: "Use option `code: {source: true}`",
|
|
80
|
+
strictDefaults: "It is default now, see option `strict`.",
|
|
81
|
+
strictKeywords: "It is default now, see option `strict`.",
|
|
82
|
+
uniqueItems: '"uniqueItems" keyword is always validated.',
|
|
83
|
+
unknownFormats: "Disable strict mode or pass `true` to `ajv.addFormat` (or `formats` option).",
|
|
84
|
+
cache: "Map is used as cache, schema object as key.",
|
|
85
|
+
serialize: "Map is used as cache, schema object as key.",
|
|
86
|
+
ajvErrors: "It is default now."
|
|
87
|
+
};
|
|
88
|
+
const deprecatedOptions = {
|
|
89
|
+
ignoreKeywordsWithRef: "",
|
|
90
|
+
jsPropertySyntax: "",
|
|
91
|
+
unicode: '"minLength"/"maxLength" account for unicode characters by default.'
|
|
92
|
+
};
|
|
93
|
+
const MAX_EXPRESSION = 200;
|
|
94
|
+
function requiredOptions(o) {
|
|
95
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _0;
|
|
96
|
+
const s = o.strict;
|
|
97
|
+
const _optz = (_a = o.code) === null || _a === void 0 ? void 0 : _a.optimize;
|
|
98
|
+
const optimize = _optz === true || _optz === void 0 ? 1 : _optz || 0;
|
|
99
|
+
const regExp = (_c = (_b = o.code) === null || _b === void 0 ? void 0 : _b.regExp) !== null && _c !== void 0 ? _c : defaultRegExp;
|
|
100
|
+
const uriResolver = (_d = o.uriResolver) !== null && _d !== void 0 ? _d : uri_1.default;
|
|
101
|
+
return {
|
|
102
|
+
strictSchema: (_f = (_e = o.strictSchema) !== null && _e !== void 0 ? _e : s) !== null && _f !== void 0 ? _f : true,
|
|
103
|
+
strictNumbers: (_h = (_g = o.strictNumbers) !== null && _g !== void 0 ? _g : s) !== null && _h !== void 0 ? _h : true,
|
|
104
|
+
strictTypes: (_k = (_j = o.strictTypes) !== null && _j !== void 0 ? _j : s) !== null && _k !== void 0 ? _k : "log",
|
|
105
|
+
strictTuples: (_m = (_l = o.strictTuples) !== null && _l !== void 0 ? _l : s) !== null && _m !== void 0 ? _m : "log",
|
|
106
|
+
strictRequired: (_p = (_o = o.strictRequired) !== null && _o !== void 0 ? _o : s) !== null && _p !== void 0 ? _p : false,
|
|
107
|
+
code: o.code ? { ...o.code, optimize, regExp } : { optimize, regExp },
|
|
108
|
+
loopRequired: (_q = o.loopRequired) !== null && _q !== void 0 ? _q : MAX_EXPRESSION,
|
|
109
|
+
loopEnum: (_r = o.loopEnum) !== null && _r !== void 0 ? _r : MAX_EXPRESSION,
|
|
110
|
+
meta: (_s = o.meta) !== null && _s !== void 0 ? _s : true,
|
|
111
|
+
messages: (_t = o.messages) !== null && _t !== void 0 ? _t : true,
|
|
112
|
+
inlineRefs: (_u = o.inlineRefs) !== null && _u !== void 0 ? _u : true,
|
|
113
|
+
schemaId: (_v = o.schemaId) !== null && _v !== void 0 ? _v : "$id",
|
|
114
|
+
addUsedSchema: (_w = o.addUsedSchema) !== null && _w !== void 0 ? _w : true,
|
|
115
|
+
validateSchema: (_x = o.validateSchema) !== null && _x !== void 0 ? _x : true,
|
|
116
|
+
validateFormats: (_y = o.validateFormats) !== null && _y !== void 0 ? _y : true,
|
|
117
|
+
unicodeRegExp: (_z = o.unicodeRegExp) !== null && _z !== void 0 ? _z : true,
|
|
118
|
+
int32range: (_0 = o.int32range) !== null && _0 !== void 0 ? _0 : true,
|
|
119
|
+
uriResolver
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
class Ajv {
|
|
123
|
+
constructor(opts = {}) {
|
|
124
|
+
this.schemas = {};
|
|
125
|
+
this.refs = {};
|
|
126
|
+
this.formats = {};
|
|
127
|
+
this._compilations = /* @__PURE__ */ new Set();
|
|
128
|
+
this._loading = {};
|
|
129
|
+
this._cache = /* @__PURE__ */ new Map();
|
|
130
|
+
opts = this.opts = { ...opts, ...requiredOptions(opts) };
|
|
131
|
+
const { es5, lines } = this.opts.code;
|
|
132
|
+
this.scope = new codegen_2.ValueScope({ scope: {}, prefixes: EXT_SCOPE_NAMES, es5, lines });
|
|
133
|
+
this.logger = getLogger(opts.logger);
|
|
134
|
+
const formatOpt = opts.validateFormats;
|
|
135
|
+
opts.validateFormats = false;
|
|
136
|
+
this.RULES = (0, rules_1.getRules)();
|
|
137
|
+
checkOptions.call(this, removedOptions, opts, "NOT SUPPORTED");
|
|
138
|
+
checkOptions.call(this, deprecatedOptions, opts, "DEPRECATED", "warn");
|
|
139
|
+
this._metaOpts = getMetaSchemaOptions.call(this);
|
|
140
|
+
if (opts.formats)
|
|
141
|
+
addInitialFormats.call(this);
|
|
142
|
+
this._addVocabularies();
|
|
143
|
+
this._addDefaultMetaSchema();
|
|
144
|
+
if (opts.keywords)
|
|
145
|
+
addInitialKeywords.call(this, opts.keywords);
|
|
146
|
+
if (typeof opts.meta == "object")
|
|
147
|
+
this.addMetaSchema(opts.meta);
|
|
148
|
+
addInitialSchemas.call(this);
|
|
149
|
+
opts.validateFormats = formatOpt;
|
|
150
|
+
}
|
|
151
|
+
_addVocabularies() {
|
|
152
|
+
this.addKeyword("$async");
|
|
153
|
+
}
|
|
154
|
+
_addDefaultMetaSchema() {
|
|
155
|
+
const { $data, meta, schemaId } = this.opts;
|
|
156
|
+
let _dataRefSchema = $dataRefSchema;
|
|
157
|
+
if (schemaId === "id") {
|
|
158
|
+
_dataRefSchema = { ...$dataRefSchema };
|
|
159
|
+
_dataRefSchema.id = _dataRefSchema.$id;
|
|
160
|
+
delete _dataRefSchema.$id;
|
|
161
|
+
}
|
|
162
|
+
if (meta && $data)
|
|
163
|
+
this.addMetaSchema(_dataRefSchema, _dataRefSchema[schemaId], false);
|
|
164
|
+
}
|
|
165
|
+
defaultMeta() {
|
|
166
|
+
const { meta, schemaId } = this.opts;
|
|
167
|
+
return this.opts.defaultMeta = typeof meta == "object" ? meta[schemaId] || meta : void 0;
|
|
168
|
+
}
|
|
169
|
+
validate(schemaKeyRef, data) {
|
|
170
|
+
let v;
|
|
171
|
+
if (typeof schemaKeyRef == "string") {
|
|
172
|
+
v = this.getSchema(schemaKeyRef);
|
|
173
|
+
if (!v)
|
|
174
|
+
throw new Error(`no schema with key or ref "${schemaKeyRef}"`);
|
|
175
|
+
} else {
|
|
176
|
+
v = this.compile(schemaKeyRef);
|
|
177
|
+
}
|
|
178
|
+
const valid = v(data);
|
|
179
|
+
if (!("$async" in v))
|
|
180
|
+
this.errors = v.errors;
|
|
181
|
+
return valid;
|
|
182
|
+
}
|
|
183
|
+
compile(schema, _meta) {
|
|
184
|
+
const sch = this._addSchema(schema, _meta);
|
|
185
|
+
return sch.validate || this._compileSchemaEnv(sch);
|
|
186
|
+
}
|
|
187
|
+
compileAsync(schema, meta) {
|
|
188
|
+
if (typeof this.opts.loadSchema != "function") {
|
|
189
|
+
throw new Error("options.loadSchema should be a function");
|
|
190
|
+
}
|
|
191
|
+
const { loadSchema } = this.opts;
|
|
192
|
+
return runCompileAsync.call(this, schema, meta);
|
|
193
|
+
async function runCompileAsync(_schema, _meta) {
|
|
194
|
+
await loadMetaSchema.call(this, _schema.$schema);
|
|
195
|
+
const sch = this._addSchema(_schema, _meta);
|
|
196
|
+
return sch.validate || _compileAsync.call(this, sch);
|
|
197
|
+
}
|
|
198
|
+
async function loadMetaSchema($ref) {
|
|
199
|
+
if ($ref && !this.getSchema($ref)) {
|
|
200
|
+
await runCompileAsync.call(this, { $ref }, true);
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
async function _compileAsync(sch) {
|
|
204
|
+
try {
|
|
205
|
+
return this._compileSchemaEnv(sch);
|
|
206
|
+
} catch (e) {
|
|
207
|
+
if (!(e instanceof ref_error_1.default))
|
|
208
|
+
throw e;
|
|
209
|
+
checkLoaded.call(this, e);
|
|
210
|
+
await loadMissingSchema.call(this, e.missingSchema);
|
|
211
|
+
return _compileAsync.call(this, sch);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
function checkLoaded({ missingSchema: ref, missingRef }) {
|
|
215
|
+
if (this.refs[ref]) {
|
|
216
|
+
throw new Error(`AnySchema ${ref} is loaded but ${missingRef} cannot be resolved`);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
async function loadMissingSchema(ref) {
|
|
220
|
+
const _schema = await _loadSchema.call(this, ref);
|
|
221
|
+
if (!this.refs[ref])
|
|
222
|
+
await loadMetaSchema.call(this, _schema.$schema);
|
|
223
|
+
if (!this.refs[ref])
|
|
224
|
+
this.addSchema(_schema, ref, meta);
|
|
225
|
+
}
|
|
226
|
+
async function _loadSchema(ref) {
|
|
227
|
+
const p = this._loading[ref];
|
|
228
|
+
if (p)
|
|
229
|
+
return p;
|
|
230
|
+
try {
|
|
231
|
+
return await (this._loading[ref] = loadSchema(ref));
|
|
232
|
+
} finally {
|
|
233
|
+
delete this._loading[ref];
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
// Adds schema to the instance
|
|
238
|
+
addSchema(schema, key, _meta, _validateSchema = this.opts.validateSchema) {
|
|
239
|
+
if (Array.isArray(schema)) {
|
|
240
|
+
for (const sch of schema)
|
|
241
|
+
this.addSchema(sch, void 0, _meta, _validateSchema);
|
|
242
|
+
return this;
|
|
243
|
+
}
|
|
244
|
+
let id;
|
|
245
|
+
if (typeof schema === "object") {
|
|
246
|
+
const { schemaId } = this.opts;
|
|
247
|
+
id = schema[schemaId];
|
|
248
|
+
if (id !== void 0 && typeof id != "string") {
|
|
249
|
+
throw new Error(`schema ${schemaId} must be string`);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
key = (0, resolve_1.normalizeId)(key || id);
|
|
253
|
+
this._checkUnique(key);
|
|
254
|
+
this.schemas[key] = this._addSchema(schema, _meta, key, _validateSchema, true);
|
|
255
|
+
return this;
|
|
256
|
+
}
|
|
257
|
+
// Add schema that will be used to validate other schemas
|
|
258
|
+
// options in META_IGNORE_OPTIONS are alway set to false
|
|
259
|
+
addMetaSchema(schema, key, _validateSchema = this.opts.validateSchema) {
|
|
260
|
+
this.addSchema(schema, key, true, _validateSchema);
|
|
261
|
+
return this;
|
|
262
|
+
}
|
|
263
|
+
// Validate schema against its meta-schema
|
|
264
|
+
validateSchema(schema, throwOrLogError) {
|
|
265
|
+
if (typeof schema == "boolean")
|
|
266
|
+
return true;
|
|
267
|
+
let $schema;
|
|
268
|
+
$schema = schema.$schema;
|
|
269
|
+
if ($schema !== void 0 && typeof $schema != "string") {
|
|
270
|
+
throw new Error("$schema must be a string");
|
|
271
|
+
}
|
|
272
|
+
$schema = $schema || this.opts.defaultMeta || this.defaultMeta();
|
|
273
|
+
if (!$schema) {
|
|
274
|
+
this.logger.warn("meta-schema not available");
|
|
275
|
+
this.errors = null;
|
|
276
|
+
return true;
|
|
277
|
+
}
|
|
278
|
+
const valid = this.validate($schema, schema);
|
|
279
|
+
if (!valid && throwOrLogError) {
|
|
280
|
+
const message = "schema is invalid: " + this.errorsText();
|
|
281
|
+
if (this.opts.validateSchema === "log")
|
|
282
|
+
this.logger.error(message);
|
|
283
|
+
else
|
|
284
|
+
throw new Error(message);
|
|
285
|
+
}
|
|
286
|
+
return valid;
|
|
287
|
+
}
|
|
288
|
+
// Get compiled schema by `key` or `ref`.
|
|
289
|
+
// (`key` that was passed to `addSchema` or full schema reference - `schema.$id` or resolved id)
|
|
290
|
+
getSchema(keyRef) {
|
|
291
|
+
let sch;
|
|
292
|
+
while (typeof (sch = getSchEnv.call(this, keyRef)) == "string")
|
|
293
|
+
keyRef = sch;
|
|
294
|
+
if (sch === void 0) {
|
|
295
|
+
const { schemaId } = this.opts;
|
|
296
|
+
const root = new compile_1.SchemaEnv({ schema: {}, schemaId });
|
|
297
|
+
sch = compile_1.resolveSchema.call(this, root, keyRef);
|
|
298
|
+
if (!sch)
|
|
299
|
+
return;
|
|
300
|
+
this.refs[keyRef] = sch;
|
|
301
|
+
}
|
|
302
|
+
return sch.validate || this._compileSchemaEnv(sch);
|
|
303
|
+
}
|
|
304
|
+
// Remove cached schema(s).
|
|
305
|
+
// If no parameter is passed all schemas but meta-schemas are removed.
|
|
306
|
+
// If RegExp is passed all schemas with key/id matching pattern but meta-schemas are removed.
|
|
307
|
+
// Even if schema is referenced by other schemas it still can be removed as other schemas have local references.
|
|
308
|
+
removeSchema(schemaKeyRef) {
|
|
309
|
+
if (schemaKeyRef instanceof RegExp) {
|
|
310
|
+
this._removeAllSchemas(this.schemas, schemaKeyRef);
|
|
311
|
+
this._removeAllSchemas(this.refs, schemaKeyRef);
|
|
312
|
+
return this;
|
|
313
|
+
}
|
|
314
|
+
switch (typeof schemaKeyRef) {
|
|
315
|
+
case "undefined":
|
|
316
|
+
this._removeAllSchemas(this.schemas);
|
|
317
|
+
this._removeAllSchemas(this.refs);
|
|
318
|
+
this._cache.clear();
|
|
319
|
+
return this;
|
|
320
|
+
case "string": {
|
|
321
|
+
const sch = getSchEnv.call(this, schemaKeyRef);
|
|
322
|
+
if (typeof sch == "object")
|
|
323
|
+
this._cache.delete(sch.schema);
|
|
324
|
+
delete this.schemas[schemaKeyRef];
|
|
325
|
+
delete this.refs[schemaKeyRef];
|
|
326
|
+
return this;
|
|
327
|
+
}
|
|
328
|
+
case "object": {
|
|
329
|
+
const cacheKey = schemaKeyRef;
|
|
330
|
+
this._cache.delete(cacheKey);
|
|
331
|
+
let id = schemaKeyRef[this.opts.schemaId];
|
|
332
|
+
if (id) {
|
|
333
|
+
id = (0, resolve_1.normalizeId)(id);
|
|
334
|
+
delete this.schemas[id];
|
|
335
|
+
delete this.refs[id];
|
|
336
|
+
}
|
|
337
|
+
return this;
|
|
338
|
+
}
|
|
339
|
+
default:
|
|
340
|
+
throw new Error("ajv.removeSchema: invalid parameter");
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
// add "vocabulary" - a collection of keywords
|
|
344
|
+
addVocabulary(definitions) {
|
|
345
|
+
for (const def of definitions)
|
|
346
|
+
this.addKeyword(def);
|
|
347
|
+
return this;
|
|
348
|
+
}
|
|
349
|
+
addKeyword(kwdOrDef, def) {
|
|
350
|
+
let keyword;
|
|
351
|
+
if (typeof kwdOrDef == "string") {
|
|
352
|
+
keyword = kwdOrDef;
|
|
353
|
+
if (typeof def == "object") {
|
|
354
|
+
this.logger.warn("these parameters are deprecated, see docs for addKeyword");
|
|
355
|
+
def.keyword = keyword;
|
|
356
|
+
}
|
|
357
|
+
} else if (typeof kwdOrDef == "object" && def === void 0) {
|
|
358
|
+
def = kwdOrDef;
|
|
359
|
+
keyword = def.keyword;
|
|
360
|
+
if (Array.isArray(keyword) && !keyword.length) {
|
|
361
|
+
throw new Error("addKeywords: keyword must be string or non-empty array");
|
|
362
|
+
}
|
|
363
|
+
} else {
|
|
364
|
+
throw new Error("invalid addKeywords parameters");
|
|
365
|
+
}
|
|
366
|
+
checkKeyword.call(this, keyword, def);
|
|
367
|
+
if (!def) {
|
|
368
|
+
(0, util_1.eachItem)(keyword, (kwd) => addRule.call(this, kwd));
|
|
369
|
+
return this;
|
|
370
|
+
}
|
|
371
|
+
keywordMetaschema.call(this, def);
|
|
372
|
+
const definition = {
|
|
373
|
+
...def,
|
|
374
|
+
type: (0, dataType_1.getJSONTypes)(def.type),
|
|
375
|
+
schemaType: (0, dataType_1.getJSONTypes)(def.schemaType)
|
|
376
|
+
};
|
|
377
|
+
(0, util_1.eachItem)(keyword, definition.type.length === 0 ? (k) => addRule.call(this, k, definition) : (k) => definition.type.forEach((t) => addRule.call(this, k, definition, t)));
|
|
378
|
+
return this;
|
|
379
|
+
}
|
|
380
|
+
getKeyword(keyword) {
|
|
381
|
+
const rule = this.RULES.all[keyword];
|
|
382
|
+
return typeof rule == "object" ? rule.definition : !!rule;
|
|
383
|
+
}
|
|
384
|
+
// Remove keyword
|
|
385
|
+
removeKeyword(keyword) {
|
|
386
|
+
const { RULES } = this;
|
|
387
|
+
delete RULES.keywords[keyword];
|
|
388
|
+
delete RULES.all[keyword];
|
|
389
|
+
for (const group of RULES.rules) {
|
|
390
|
+
const i = group.rules.findIndex((rule) => rule.keyword === keyword);
|
|
391
|
+
if (i >= 0)
|
|
392
|
+
group.rules.splice(i, 1);
|
|
393
|
+
}
|
|
394
|
+
return this;
|
|
395
|
+
}
|
|
396
|
+
// Add format
|
|
397
|
+
addFormat(name, format) {
|
|
398
|
+
if (typeof format == "string")
|
|
399
|
+
format = new RegExp(format);
|
|
400
|
+
this.formats[name] = format;
|
|
401
|
+
return this;
|
|
402
|
+
}
|
|
403
|
+
errorsText(errors = this.errors, { separator = ", ", dataVar = "data" } = {}) {
|
|
404
|
+
if (!errors || errors.length === 0)
|
|
405
|
+
return "No errors";
|
|
406
|
+
return errors.map((e) => `${dataVar}${e.instancePath} ${e.message}`).reduce((text, msg) => text + separator + msg);
|
|
407
|
+
}
|
|
408
|
+
$dataMetaSchema(metaSchema, keywordsJsonPointers) {
|
|
409
|
+
const rules = this.RULES.all;
|
|
410
|
+
metaSchema = JSON.parse(JSON.stringify(metaSchema));
|
|
411
|
+
for (const jsonPointer of keywordsJsonPointers) {
|
|
412
|
+
const segments = jsonPointer.split("/").slice(1);
|
|
413
|
+
let keywords = metaSchema;
|
|
414
|
+
for (const seg of segments)
|
|
415
|
+
keywords = keywords[seg];
|
|
416
|
+
for (const key in rules) {
|
|
417
|
+
const rule = rules[key];
|
|
418
|
+
if (typeof rule != "object")
|
|
419
|
+
continue;
|
|
420
|
+
const { $data } = rule.definition;
|
|
421
|
+
const schema = keywords[key];
|
|
422
|
+
if ($data && schema)
|
|
423
|
+
keywords[key] = schemaOrData(schema);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
return metaSchema;
|
|
427
|
+
}
|
|
428
|
+
_removeAllSchemas(schemas, regex) {
|
|
429
|
+
for (const keyRef in schemas) {
|
|
430
|
+
const sch = schemas[keyRef];
|
|
431
|
+
if (!regex || regex.test(keyRef)) {
|
|
432
|
+
if (typeof sch == "string") {
|
|
433
|
+
delete schemas[keyRef];
|
|
434
|
+
} else if (sch && !sch.meta) {
|
|
435
|
+
this._cache.delete(sch.schema);
|
|
436
|
+
delete schemas[keyRef];
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
_addSchema(schema, meta, baseId, validateSchema = this.opts.validateSchema, addSchema = this.opts.addUsedSchema) {
|
|
442
|
+
let id;
|
|
443
|
+
const { schemaId } = this.opts;
|
|
444
|
+
if (typeof schema == "object") {
|
|
445
|
+
id = schema[schemaId];
|
|
446
|
+
} else {
|
|
447
|
+
if (this.opts.jtd)
|
|
448
|
+
throw new Error("schema must be object");
|
|
449
|
+
else if (typeof schema != "boolean")
|
|
450
|
+
throw new Error("schema must be object or boolean");
|
|
451
|
+
}
|
|
452
|
+
let sch = this._cache.get(schema);
|
|
453
|
+
if (sch !== void 0)
|
|
454
|
+
return sch;
|
|
455
|
+
baseId = (0, resolve_1.normalizeId)(id || baseId);
|
|
456
|
+
const localRefs = resolve_1.getSchemaRefs.call(this, schema, baseId);
|
|
457
|
+
sch = new compile_1.SchemaEnv({ schema, schemaId, meta, baseId, localRefs });
|
|
458
|
+
this._cache.set(sch.schema, sch);
|
|
459
|
+
if (addSchema && !baseId.startsWith("#")) {
|
|
460
|
+
if (baseId)
|
|
461
|
+
this._checkUnique(baseId);
|
|
462
|
+
this.refs[baseId] = sch;
|
|
463
|
+
}
|
|
464
|
+
if (validateSchema)
|
|
465
|
+
this.validateSchema(schema, true);
|
|
466
|
+
return sch;
|
|
467
|
+
}
|
|
468
|
+
_checkUnique(id) {
|
|
469
|
+
if (this.schemas[id] || this.refs[id]) {
|
|
470
|
+
throw new Error(`schema with key or id "${id}" already exists`);
|
|
471
|
+
}
|
|
472
|
+
}
|
|
473
|
+
_compileSchemaEnv(sch) {
|
|
474
|
+
if (sch.meta)
|
|
475
|
+
this._compileMetaSchema(sch);
|
|
476
|
+
else
|
|
477
|
+
compile_1.compileSchema.call(this, sch);
|
|
478
|
+
if (!sch.validate)
|
|
479
|
+
throw new Error("ajv implementation error");
|
|
480
|
+
return sch.validate;
|
|
481
|
+
}
|
|
482
|
+
_compileMetaSchema(sch) {
|
|
483
|
+
const currentOpts = this.opts;
|
|
484
|
+
this.opts = this._metaOpts;
|
|
485
|
+
try {
|
|
486
|
+
compile_1.compileSchema.call(this, sch);
|
|
487
|
+
} finally {
|
|
488
|
+
this.opts = currentOpts;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
Ajv.ValidationError = validation_error_1.default;
|
|
493
|
+
Ajv.MissingRefError = ref_error_1.default;
|
|
494
|
+
exports$1.default = Ajv;
|
|
495
|
+
function checkOptions(checkOpts, options, msg, log = "error") {
|
|
496
|
+
for (const key in checkOpts) {
|
|
497
|
+
const opt = key;
|
|
498
|
+
if (opt in options)
|
|
499
|
+
this.logger[log](`${msg}: option ${key}. ${checkOpts[opt]}`);
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
function getSchEnv(keyRef) {
|
|
503
|
+
keyRef = (0, resolve_1.normalizeId)(keyRef);
|
|
504
|
+
return this.schemas[keyRef] || this.refs[keyRef];
|
|
505
|
+
}
|
|
506
|
+
function addInitialSchemas() {
|
|
507
|
+
const optsSchemas = this.opts.schemas;
|
|
508
|
+
if (!optsSchemas)
|
|
509
|
+
return;
|
|
510
|
+
if (Array.isArray(optsSchemas))
|
|
511
|
+
this.addSchema(optsSchemas);
|
|
512
|
+
else
|
|
513
|
+
for (const key in optsSchemas)
|
|
514
|
+
this.addSchema(optsSchemas[key], key);
|
|
515
|
+
}
|
|
516
|
+
function addInitialFormats() {
|
|
517
|
+
for (const name in this.opts.formats) {
|
|
518
|
+
const format = this.opts.formats[name];
|
|
519
|
+
if (format)
|
|
520
|
+
this.addFormat(name, format);
|
|
521
|
+
}
|
|
522
|
+
}
|
|
523
|
+
function addInitialKeywords(defs) {
|
|
524
|
+
if (Array.isArray(defs)) {
|
|
525
|
+
this.addVocabulary(defs);
|
|
526
|
+
return;
|
|
527
|
+
}
|
|
528
|
+
this.logger.warn("keywords option as map is deprecated, pass array");
|
|
529
|
+
for (const keyword in defs) {
|
|
530
|
+
const def = defs[keyword];
|
|
531
|
+
if (!def.keyword)
|
|
532
|
+
def.keyword = keyword;
|
|
533
|
+
this.addKeyword(def);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
function getMetaSchemaOptions() {
|
|
537
|
+
const metaOpts = { ...this.opts };
|
|
538
|
+
for (const opt of META_IGNORE_OPTIONS)
|
|
539
|
+
delete metaOpts[opt];
|
|
540
|
+
return metaOpts;
|
|
541
|
+
}
|
|
542
|
+
const noLogs = { log() {
|
|
543
|
+
}, warn() {
|
|
544
|
+
}, error() {
|
|
545
|
+
} };
|
|
546
|
+
function getLogger(logger) {
|
|
547
|
+
if (logger === false)
|
|
548
|
+
return noLogs;
|
|
549
|
+
if (logger === void 0)
|
|
550
|
+
return console;
|
|
551
|
+
if (logger.log && logger.warn && logger.error)
|
|
552
|
+
return logger;
|
|
553
|
+
throw new Error("logger must implement log, warn and error methods");
|
|
554
|
+
}
|
|
555
|
+
const KEYWORD_NAME = /^[a-z_$][a-z0-9_$:-]*$/i;
|
|
556
|
+
function checkKeyword(keyword, def) {
|
|
557
|
+
const { RULES } = this;
|
|
558
|
+
(0, util_1.eachItem)(keyword, (kwd) => {
|
|
559
|
+
if (RULES.keywords[kwd])
|
|
560
|
+
throw new Error(`Keyword ${kwd} is already defined`);
|
|
561
|
+
if (!KEYWORD_NAME.test(kwd))
|
|
562
|
+
throw new Error(`Keyword ${kwd} has invalid name`);
|
|
563
|
+
});
|
|
564
|
+
if (!def)
|
|
565
|
+
return;
|
|
566
|
+
if (def.$data && !("code" in def || "validate" in def)) {
|
|
567
|
+
throw new Error('$data keyword must have "code" or "validate" function');
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
function addRule(keyword, definition, dataType) {
|
|
571
|
+
var _a;
|
|
572
|
+
const post = definition === null || definition === void 0 ? void 0 : definition.post;
|
|
573
|
+
if (dataType && post)
|
|
574
|
+
throw new Error('keyword with "post" flag cannot have "type"');
|
|
575
|
+
const { RULES } = this;
|
|
576
|
+
let ruleGroup = post ? RULES.post : RULES.rules.find(({ type: t }) => t === dataType);
|
|
577
|
+
if (!ruleGroup) {
|
|
578
|
+
ruleGroup = { type: dataType, rules: [] };
|
|
579
|
+
RULES.rules.push(ruleGroup);
|
|
580
|
+
}
|
|
581
|
+
RULES.keywords[keyword] = true;
|
|
582
|
+
if (!definition)
|
|
583
|
+
return;
|
|
584
|
+
const rule = {
|
|
585
|
+
keyword,
|
|
586
|
+
definition: {
|
|
587
|
+
...definition,
|
|
588
|
+
type: (0, dataType_1.getJSONTypes)(definition.type),
|
|
589
|
+
schemaType: (0, dataType_1.getJSONTypes)(definition.schemaType)
|
|
590
|
+
}
|
|
591
|
+
};
|
|
592
|
+
if (definition.before)
|
|
593
|
+
addBeforeRule.call(this, ruleGroup, rule, definition.before);
|
|
594
|
+
else
|
|
595
|
+
ruleGroup.rules.push(rule);
|
|
596
|
+
RULES.all[keyword] = rule;
|
|
597
|
+
(_a = definition.implements) === null || _a === void 0 ? void 0 : _a.forEach((kwd) => this.addKeyword(kwd));
|
|
598
|
+
}
|
|
599
|
+
function addBeforeRule(ruleGroup, rule, before) {
|
|
600
|
+
const i = ruleGroup.rules.findIndex((_rule) => _rule.keyword === before);
|
|
601
|
+
if (i >= 0) {
|
|
602
|
+
ruleGroup.rules.splice(i, 0, rule);
|
|
603
|
+
} else {
|
|
604
|
+
ruleGroup.rules.push(rule);
|
|
605
|
+
this.logger.warn(`rule ${before} is not defined`);
|
|
606
|
+
}
|
|
607
|
+
}
|
|
608
|
+
function keywordMetaschema(def) {
|
|
609
|
+
let { metaSchema } = def;
|
|
610
|
+
if (metaSchema === void 0)
|
|
611
|
+
return;
|
|
612
|
+
if (def.$data && this.opts.$data)
|
|
613
|
+
metaSchema = schemaOrData(metaSchema);
|
|
614
|
+
def.validateSchema = this.compile(metaSchema, true);
|
|
615
|
+
}
|
|
616
|
+
const $dataRef = {
|
|
617
|
+
$ref: "https://raw.githubusercontent.com/ajv-validator/ajv/master/lib/refs/data.json#"
|
|
618
|
+
};
|
|
619
|
+
function schemaOrData(schema) {
|
|
620
|
+
return { anyOf: [schema, $dataRef] };
|
|
621
|
+
}
|
|
622
|
+
})(core);
|
|
623
|
+
return core;
|
|
624
|
+
}
|
|
625
|
+
export {
|
|
626
|
+
requireCore as __require
|
|
627
|
+
};
|
|
628
|
+
//# sourceMappingURL=core.js.map
|