effect 4.0.0-beta.100 → 4.0.0-beta.102
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +81 -5
- package/dist/Array.js.map +1 -1
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +27 -9
- package/dist/Channel.js.map +1 -1
- package/dist/Config.d.ts +1 -1
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +6 -5
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.js +7 -7
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js +2 -1
- package/dist/Data.js.map +1 -1
- package/dist/Effect.d.ts +61 -100
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +66 -39
- package/dist/Effect.js.map +1 -1
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +3 -2
- package/dist/FiberHandle.js.map +1 -1
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +2 -1
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonPatch.d.ts.map +1 -1
- package/dist/JsonPatch.js +4 -3
- package/dist/JsonPatch.js.map +1 -1
- package/dist/JsonSchema.d.ts.map +1 -1
- package/dist/JsonSchema.js +9 -11
- package/dist/JsonSchema.js.map +1 -1
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +3 -2
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +9 -0
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/ManagedRuntime.js +3 -0
- package/dist/ManagedRuntime.js.map +1 -1
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +4 -3
- package/dist/Metric.js.map +1 -1
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +4 -0
- package/dist/MutableList.js.map +1 -1
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +5 -4
- package/dist/Optic.js.map +1 -1
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +2 -1
- package/dist/Option.js.map +1 -1
- package/dist/PartitionedSemaphore.d.ts.map +1 -1
- package/dist/PartitionedSemaphore.js +1 -4
- package/dist/PartitionedSemaphore.js.map +1 -1
- package/dist/Record.d.ts +93 -1
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +57 -19
- package/dist/Record.js.map +1 -1
- package/dist/References.d.ts +0 -45
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +0 -45
- package/dist/References.js.map +1 -1
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js +9 -6
- package/dist/Request.js.map +1 -1
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +2 -1
- package/dist/Result.js.map +1 -1
- package/dist/Schema.d.ts +1269 -496
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +2308 -614
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +2 -2
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +189 -130
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaError.js +1 -1
- package/dist/SchemaError.js.map +1 -1
- package/dist/SchemaGetter.d.ts +13 -11
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +34 -24
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.js +1 -1
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +1 -12
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +403 -1504
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +294 -2852
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +2 -2
- package/dist/SchemaTransformation.js +3 -3
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/Semaphore.d.ts +5 -3
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js.map +1 -1
- package/dist/Stream.d.ts +15 -9
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +46 -16
- package/dist/Stream.js.map +1 -1
- package/dist/Struct.d.ts.map +1 -1
- package/dist/Struct.js +5 -4
- package/dist/Struct.js.map +1 -1
- package/dist/Types.d.ts +1 -3
- package/dist/Types.d.ts.map +1 -1
- package/dist/index.d.ts +0 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -4
- package/dist/index.js.map +1 -1
- package/dist/internal/core.js +3 -2
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/effect.js +119 -53
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/matcher.js +1 -1
- package/dist/internal/matcher.js.map +1 -1
- package/dist/internal/record.d.ts +0 -3
- package/dist/internal/record.d.ts.map +1 -1
- package/dist/internal/record.js +10 -5
- package/dist/internal/record.js.map +1 -1
- package/dist/internal/references.js +0 -4
- package/dist/internal/references.js.map +1 -1
- package/dist/internal/schema/annotations.js +12 -0
- package/dist/internal/schema/annotations.js.map +1 -1
- package/dist/internal/schema/fromJsonSchemaDocument.d.ts +2 -0
- package/dist/internal/schema/fromJsonSchemaDocument.d.ts.map +1 -0
- package/dist/internal/schema/fromJsonSchemaDocument.js +743 -0
- package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -0
- package/dist/internal/schema/fromRepresentation.d.ts +2 -0
- package/dist/internal/schema/fromRepresentation.d.ts.map +1 -0
- package/dist/internal/schema/fromRepresentation.js +252 -0
- package/dist/internal/schema/fromRepresentation.js.map +1 -0
- package/dist/internal/schema/schema.js +28 -40
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/internal/schema/{arbitrary.d.ts → toArbitrary.d.ts} +1 -1
- package/dist/internal/schema/toArbitrary.d.ts.map +1 -0
- package/dist/internal/schema/{arbitrary.js → toArbitrary.js} +8 -9
- package/dist/internal/schema/toArbitrary.js.map +1 -0
- package/dist/internal/schema/toCodeDocument.d.ts +2 -0
- package/dist/internal/schema/toCodeDocument.d.ts.map +1 -0
- package/dist/internal/schema/toCodeDocument.js +438 -0
- package/dist/internal/schema/toCodeDocument.js.map +1 -0
- package/dist/internal/schema/toEquivalence.d.ts +2 -0
- package/dist/internal/schema/toEquivalence.d.ts.map +1 -0
- package/dist/internal/schema/{equivalence.js → toEquivalence.js} +15 -13
- package/dist/internal/schema/toEquivalence.js.map +1 -0
- package/dist/internal/schema/toJsonSchemaDocument.d.ts +2 -0
- package/dist/internal/schema/toJsonSchemaDocument.d.ts.map +1 -0
- package/dist/internal/schema/toJsonSchemaDocument.js +466 -0
- package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -0
- package/dist/internal/schema/toRepresentation.d.ts +2 -0
- package/dist/internal/schema/toRepresentation.d.ts.map +1 -0
- package/dist/internal/schema/toRepresentation.js +369 -0
- package/dist/internal/schema/toRepresentation.js.map +1 -0
- package/dist/internal/stackTraceLimit.js +3 -6
- package/dist/internal/stackTraceLimit.js.map +1 -1
- package/dist/testing/TestClock.js +4 -1
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +26 -26
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +5 -4
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +21 -6
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +86 -316
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.d.ts +1 -1
- package/dist/unstable/ai/EmbeddingModel.js +1 -1
- package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +4 -1
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +19 -17
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +197 -197
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +13 -13
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +4 -4
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +116 -49
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +32 -10
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +193 -377
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +19 -19
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js +14 -14
- package/dist/unstable/ai/Response.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +4 -0
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +11 -3
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +9 -1
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +14 -10
- package/dist/unstable/ai/Toolkit.js.map +1 -1
- package/dist/unstable/ai/internal/codec-transformer.js +15 -12
- package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
- package/dist/unstable/ai/internal/structured-output.d.ts +2 -0
- package/dist/unstable/ai/internal/structured-output.d.ts.map +1 -0
- package/dist/unstable/ai/internal/structured-output.js +316 -0
- package/dist/unstable/ai/internal/structured-output.js.map +1 -0
- package/dist/unstable/cli/CliError.d.ts +40 -2
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +45 -6
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/Command.js +14 -5
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Param.js +3 -3
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.js +1 -1
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/internal/command.d.ts +3 -1
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +11 -4
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/config.d.ts +0 -48
- package/dist/unstable/cli/internal/config.d.ts.map +1 -1
- package/dist/unstable/cli/internal/config.js +8 -10
- package/dist/unstable/cli/internal/config.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/Entity.js +1 -1
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts.map +1 -1
- package/dist/unstable/cluster/Envelope.js +2 -1
- package/dist/unstable/cluster/Envelope.js.map +1 -1
- package/dist/unstable/cluster/Reply.js +1 -1
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/Runner.d.ts +1 -1
- package/dist/unstable/cluster/Runner.js +1 -1
- package/dist/unstable/cluster/Runner.js.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.d.ts +1 -1
- package/dist/unstable/cluster/RunnerAddress.js +1 -1
- package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
- package/dist/unstable/cluster/ShardId.js +1 -1
- package/dist/unstable/cluster/ShardId.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +125 -24
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +10 -2
- package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/SingleRunner.d.ts +4 -2
- package/dist/unstable/cluster/SingleRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/SingleRunner.js +2 -1
- package/dist/unstable/cluster/SingleRunner.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.d.ts +7 -4
- package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +55 -24
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js +109 -62
- package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +19 -7
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/cluster/internal/shardLock.d.ts +2 -0
- package/dist/unstable/cluster/internal/shardLock.d.ts.map +1 -0
- package/dist/unstable/cluster/internal/shardLock.js +4 -0
- package/dist/unstable/cluster/internal/shardLock.js.map +1 -0
- package/dist/unstable/devtools/DevToolsSchema.d.ts +20 -20
- package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js +8 -5
- package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +1 -1
- package/dist/unstable/eventlog/EventJournal.js +1 -1
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLog.js +15 -11
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.d.ts +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +26 -26
- package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.js +8 -3
- package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.js +2 -2
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +3 -3
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +24 -22
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Headers.js +8 -8
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts +44 -0
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +14 -0
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +2 -2
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +5 -4
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/Multipart.d.ts.map +1 -1
- package/dist/unstable/http/Multipart.js +17 -15
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/Template.js +1 -1
- package/dist/unstable/http/Template.js.map +1 -1
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +17 -14
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js +3 -3
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +5 -5
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.js +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +37 -24
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts +72 -1
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +69 -4
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.d.ts +4 -3
- package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js +2 -2
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts +7 -3
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.js +5 -2
- package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.d.ts +4 -3
- package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js +2 -2
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistable.js +2 -1
- package/dist/unstable/persistence/Persistable.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +2 -2
- package/dist/unstable/persistence/RateLimiter.js +2 -2
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/persistence/Redis.d.ts.map +1 -1
- package/dist/unstable/persistence/Redis.js +2 -2
- package/dist/unstable/persistence/Redis.js.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js +3 -1
- package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.js +4 -3
- package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +83 -0
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +31 -0
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +2 -1
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +1 -2
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.js +13 -10
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +1 -1
- package/dist/unstable/socket/Socket.js +1 -1
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/sql/SqlError.d.ts +2 -2
- package/dist/unstable/sql/SqlError.js +2 -2
- package/dist/unstable/sql/SqlError.js.map +1 -1
- package/dist/unstable/sql/Statement.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.js +7 -6
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/package.json +1 -1
- package/src/Array.ts +86 -25
- package/src/Channel.ts +32 -14
- package/src/Config.ts +6 -5
- package/src/ConfigProvider.ts +7 -7
- package/src/Data.ts +3 -2
- package/src/Effect.ts +70 -116
- package/src/FiberHandle.ts +3 -2
- package/src/Iterable.ts +2 -1
- package/src/JsonPatch.ts +4 -3
- package/src/JsonSchema.ts +9 -11
- package/src/Logger.ts +3 -2
- package/src/ManagedRuntime.ts +13 -0
- package/src/Metric.ts +4 -3
- package/src/MutableList.ts +4 -0
- package/src/Optic.ts +5 -4
- package/src/Option.ts +2 -1
- package/src/PartitionedSemaphore.ts +1 -4
- package/src/Record.ts +119 -22
- package/src/References.ts +0 -46
- package/src/Request.ts +5 -7
- package/src/Result.ts +2 -1
- package/src/Schema.ts +2538 -987
- package/src/SchemaAST.ts +228 -149
- package/src/SchemaError.ts +1 -1
- package/src/SchemaGetter.ts +36 -29
- package/src/SchemaIssue.ts +1 -1
- package/src/SchemaParser.ts +1 -25
- package/src/SchemaRepresentation.ts +697 -3398
- package/src/SchemaTransformation.ts +3 -3
- package/src/Semaphore.ts +5 -3
- package/src/Stream.ts +63 -19
- package/src/Struct.ts +5 -4
- package/src/Types.ts +1 -3
- package/src/index.ts +0 -5
- package/src/internal/core.ts +4 -3
- package/src/internal/effect.ts +132 -70
- package/src/internal/matcher.ts +1 -1
- package/src/internal/record.ts +11 -7
- package/src/internal/references.ts +0 -5
- package/src/internal/schema/annotations.ts +44 -0
- package/src/internal/schema/fromJsonSchemaDocument.ts +957 -0
- package/src/internal/schema/fromRepresentation.ts +345 -0
- package/src/internal/schema/schema.ts +45 -46
- package/src/internal/schema/{arbitrary.ts → toArbitrary.ts} +8 -10
- package/src/internal/schema/toCodeDocument.ts +572 -0
- package/src/internal/schema/{equivalence.ts → toEquivalence.ts} +12 -7
- package/src/internal/schema/toJsonSchemaDocument.ts +475 -0
- package/src/internal/schema/toRepresentation.ts +401 -0
- package/src/internal/stackTraceLimit.ts +3 -7
- package/src/testing/TestClock.ts +1 -1
- package/src/unstable/ai/AiError.ts +5 -4
- package/src/unstable/ai/AnthropicStructuredOutput.ts +102 -333
- package/src/unstable/ai/EmbeddingModel.ts +1 -1
- package/src/unstable/ai/LanguageModel.ts +30 -28
- package/src/unstable/ai/McpSchema.ts +15 -15
- package/src/unstable/ai/McpServer.ts +172 -56
- package/src/unstable/ai/OpenAiStructuredOutput.ts +230 -395
- package/src/unstable/ai/Response.ts +24 -24
- package/src/unstable/ai/Tool.ts +22 -4
- package/src/unstable/ai/Toolkit.ts +19 -7
- package/src/unstable/ai/internal/codec-transformer.ts +13 -7
- package/src/unstable/ai/internal/structured-output.ts +458 -0
- package/src/unstable/cli/CliError.ts +51 -5
- package/src/unstable/cli/Command.ts +4 -4
- package/src/unstable/cli/Param.ts +3 -3
- package/src/unstable/cli/Primitive.ts +1 -1
- package/src/unstable/cli/internal/command.ts +13 -5
- package/src/unstable/cli/internal/config.ts +8 -10
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +3 -3
- package/src/unstable/cluster/Entity.ts +1 -1
- package/src/unstable/cluster/Envelope.ts +2 -1
- package/src/unstable/cluster/Reply.ts +1 -1
- package/src/unstable/cluster/Runner.ts +1 -1
- package/src/unstable/cluster/RunnerAddress.ts +1 -1
- package/src/unstable/cluster/ShardId.ts +1 -1
- package/src/unstable/cluster/Sharding.ts +161 -34
- package/src/unstable/cluster/ShardingConfig.ts +5 -1
- package/src/unstable/cluster/SingleRunner.ts +4 -2
- package/src/unstable/cluster/SqlMessageStorage.ts +83 -35
- package/src/unstable/cluster/SqlRunnerStorage.ts +186 -116
- package/src/unstable/cluster/internal/entityManager.ts +31 -10
- package/src/unstable/cluster/internal/shardLock.ts +9 -0
- package/src/unstable/devtools/DevToolsSchema.ts +10 -5
- package/src/unstable/eventlog/EventJournal.ts +1 -1
- package/src/unstable/eventlog/EventLog.ts +21 -11
- package/src/unstable/eventlog/EventLogEncryption.ts +1 -1
- package/src/unstable/eventlog/EventLogMessage.ts +10 -3
- package/src/unstable/eventlog/SqlEventJournal.ts +2 -2
- package/src/unstable/eventlog/SqlEventLogServerEncrypted.ts +1 -1
- package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +6 -3
- package/src/unstable/http/Cookies.ts +29 -24
- package/src/unstable/http/Headers.ts +8 -8
- package/src/unstable/http/HttpClientRequest.ts +57 -0
- package/src/unstable/http/HttpRouter.ts +6 -3
- package/src/unstable/http/HttpServerRequest.ts +5 -4
- package/src/unstable/http/Multipart.ts +16 -13
- package/src/unstable/http/Template.ts +1 -1
- package/src/unstable/http/UrlParams.ts +17 -14
- package/src/unstable/httpapi/HttpApi.ts +3 -3
- package/src/unstable/httpapi/HttpApiClient.ts +5 -5
- package/src/unstable/httpapi/HttpApiGroup.ts +1 -1
- package/src/unstable/httpapi/OpenApi.ts +52 -28
- package/src/unstable/observability/OtlpExporter.ts +109 -5
- package/src/unstable/observability/OtlpLogger.ts +5 -5
- package/src/unstable/observability/OtlpMetrics.ts +8 -4
- package/src/unstable/observability/OtlpTracer.ts +8 -4
- package/src/unstable/persistence/Persistable.ts +3 -2
- package/src/unstable/persistence/RateLimiter.ts +2 -2
- package/src/unstable/persistence/Redis.ts +2 -2
- package/src/unstable/process/ChildProcessSpawner.ts +1 -1
- package/src/unstable/reactivity/AsyncResult.ts +4 -3
- package/src/unstable/reactivity/Atom.ts +92 -0
- package/src/unstable/reactivity/AtomRegistry.ts +1 -1
- package/src/unstable/rpc/RpcClient.ts +2 -1
- package/src/unstable/schema/VariantSchema.ts +14 -24
- package/src/unstable/socket/Socket.ts +1 -1
- package/src/unstable/sql/SqlError.ts +2 -2
- package/src/unstable/sql/Statement.ts +7 -6
- package/dist/SchemaUtils.d.ts +0 -28
- package/dist/SchemaUtils.d.ts.map +0 -1
- package/dist/SchemaUtils.js +0 -45
- package/dist/SchemaUtils.js.map +0 -1
- package/dist/internal/schema/arbitrary.d.ts.map +0 -1
- package/dist/internal/schema/arbitrary.js.map +0 -1
- package/dist/internal/schema/equivalence.d.ts +0 -2
- package/dist/internal/schema/equivalence.d.ts.map +0 -1
- package/dist/internal/schema/equivalence.js.map +0 -1
- package/dist/internal/schema/representation.d.ts +0 -2
- package/dist/internal/schema/representation.d.ts.map +0 -1
- package/dist/internal/schema/representation.js +0 -865
- package/dist/internal/schema/representation.js.map +0 -1
- package/src/SchemaUtils.ts +0 -51
- package/src/internal/schema/representation.ts +0 -795
|
@@ -2,41 +2,123 @@ import type * as JsonSchema from "./JsonSchema.ts";
|
|
|
2
2
|
import * as Schema from "./Schema.ts";
|
|
3
3
|
import * as SchemaAST from "./SchemaAST.ts";
|
|
4
4
|
/**
|
|
5
|
-
*
|
|
5
|
+
* Open persistence identity carried by declarations and opaque checks.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
|
|
7
|
+
* @category annotations
|
|
8
|
+
* @since 4.0.0
|
|
9
|
+
*/
|
|
10
|
+
export interface RepresentationAnnotation {
|
|
11
|
+
readonly id: string;
|
|
12
|
+
readonly payload: Schema.Json;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Open persistence identity and schema dependencies carried by opaque checks.
|
|
10
16
|
*
|
|
11
|
-
*
|
|
17
|
+
* @category annotations
|
|
18
|
+
* @since 4.0.0
|
|
19
|
+
*/
|
|
20
|
+
export interface CheckRepresentationAnnotation<S> extends RepresentationAnnotation {
|
|
21
|
+
readonly schemas?: ReadonlyArray<S> | undefined;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Input passed to JSON Schema compiler annotations.
|
|
12
25
|
*
|
|
13
|
-
*
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
26
|
+
* @since 4.0.0
|
|
27
|
+
*/
|
|
28
|
+
export declare namespace ToJsonSchema {
|
|
29
|
+
/**
|
|
30
|
+
* Input for a check compiler.
|
|
31
|
+
*
|
|
32
|
+
* @category models
|
|
33
|
+
* @since 4.0.0
|
|
34
|
+
*/
|
|
35
|
+
interface CheckInput {
|
|
36
|
+
readonly type: JsonSchema.Type | undefined;
|
|
37
|
+
readonly schemas: ReadonlyArray<JsonSchema.JsonSchema>;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* JSON Schema compiler for a check.
|
|
41
|
+
*
|
|
42
|
+
* @category models
|
|
43
|
+
* @since 4.0.0
|
|
44
|
+
*/
|
|
45
|
+
type Check = (input: CheckInput) => JsonSchema.JsonSchema;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Input and output contracts for code generation annotations.
|
|
17
49
|
*
|
|
18
|
-
* @
|
|
19
|
-
|
|
50
|
+
* @since 4.0.0
|
|
51
|
+
*/
|
|
52
|
+
export declare namespace Generation {
|
|
53
|
+
/**
|
|
54
|
+
* Input for declaration code generation.
|
|
55
|
+
*
|
|
56
|
+
* @category models
|
|
57
|
+
* @since 4.0.0
|
|
58
|
+
*/
|
|
59
|
+
interface DeclarationInput {
|
|
60
|
+
readonly typeParameters: ReadonlyArray<Code>;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Output of declaration code generation.
|
|
64
|
+
*
|
|
65
|
+
* @category models
|
|
66
|
+
* @since 4.0.0
|
|
67
|
+
*/
|
|
68
|
+
interface DeclarationOutput {
|
|
69
|
+
readonly runtime: string;
|
|
70
|
+
readonly Type: string;
|
|
71
|
+
readonly importDeclarations?: ReadonlyArray<string> | undefined;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Declaration code generator.
|
|
75
|
+
*
|
|
76
|
+
* @category models
|
|
77
|
+
* @since 4.0.0
|
|
78
|
+
*/
|
|
79
|
+
type Declaration = (input: DeclarationInput) => DeclarationOutput;
|
|
80
|
+
/**
|
|
81
|
+
* Input for check code generation.
|
|
82
|
+
*
|
|
83
|
+
* @category models
|
|
84
|
+
* @since 4.0.0
|
|
85
|
+
*/
|
|
86
|
+
interface CheckInput {
|
|
87
|
+
readonly schemas: ReadonlyArray<Code>;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Output of check code generation.
|
|
91
|
+
*
|
|
92
|
+
* @category models
|
|
93
|
+
* @since 4.0.0
|
|
94
|
+
*/
|
|
95
|
+
interface CheckOutput {
|
|
96
|
+
readonly runtime: string;
|
|
97
|
+
readonly importDeclarations?: ReadonlyArray<string> | undefined;
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Check code generator.
|
|
101
|
+
*
|
|
102
|
+
* @category models
|
|
103
|
+
* @since 4.0.0
|
|
104
|
+
*/
|
|
105
|
+
type Check = (input: CheckInput) => CheckOutput;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* A custom opaque declaration.
|
|
20
109
|
*
|
|
21
110
|
* @category models
|
|
22
111
|
* @since 4.0.0
|
|
23
112
|
*/
|
|
24
113
|
export interface Declaration {
|
|
25
114
|
readonly _tag: "Declaration";
|
|
115
|
+
readonly representation?: RepresentationAnnotation | undefined;
|
|
26
116
|
readonly annotations?: Schema.Annotations.Annotations | undefined;
|
|
27
117
|
readonly typeParameters: ReadonlyArray<Representation>;
|
|
28
|
-
readonly checks: ReadonlyArray<Check
|
|
29
|
-
readonly encodedSchema: Representation;
|
|
118
|
+
readonly checks: ReadonlyArray<Check>;
|
|
30
119
|
}
|
|
31
120
|
/**
|
|
32
|
-
* A lazily resolved representation
|
|
33
|
-
*
|
|
34
|
-
* **Details**
|
|
35
|
-
*
|
|
36
|
-
* `thunk` points to the actual representation, possibly via a
|
|
37
|
-
* {@link Reference}. `checks` is always empty on `Suspend` nodes.
|
|
38
|
-
*
|
|
39
|
-
* @see {@link Reference}
|
|
121
|
+
* A lazily resolved representation.
|
|
40
122
|
*
|
|
41
123
|
* @category models
|
|
42
124
|
* @since 4.0.0
|
|
@@ -48,25 +130,7 @@ export interface Suspend {
|
|
|
48
130
|
readonly thunk: Representation;
|
|
49
131
|
}
|
|
50
132
|
/**
|
|
51
|
-
* A named reference
|
|
52
|
-
*
|
|
53
|
-
* **When to use**
|
|
54
|
-
*
|
|
55
|
-
* Use when a representation should point to a named definition instead of
|
|
56
|
-
* embedding the definition inline.
|
|
57
|
-
*
|
|
58
|
-
* **Details**
|
|
59
|
-
*
|
|
60
|
-
* `$ref` is the key into `Document.references` or `MultiDocument.references`.
|
|
61
|
-
* References are resolved lazily by {@link toSchema} and
|
|
62
|
-
* {@link toCodeDocument}.
|
|
63
|
-
*
|
|
64
|
-
* **Gotchas**
|
|
65
|
-
*
|
|
66
|
-
* Resolution throws at runtime if the key is not found in the references map.
|
|
67
|
-
*
|
|
68
|
-
* @see {@link References}
|
|
69
|
-
* @see {@link Document}
|
|
133
|
+
* A named reference.
|
|
70
134
|
*
|
|
71
135
|
* @category models
|
|
72
136
|
* @since 4.0.0
|
|
@@ -75,227 +139,155 @@ export interface Reference {
|
|
|
75
139
|
readonly _tag: "Reference";
|
|
76
140
|
readonly $ref: string;
|
|
77
141
|
}
|
|
142
|
+
interface Keyword<Tag extends string> {
|
|
143
|
+
readonly _tag: Tag;
|
|
144
|
+
readonly annotations?: Schema.Annotations.Annotations | undefined;
|
|
145
|
+
readonly checks: ReadonlyArray<Check>;
|
|
146
|
+
}
|
|
78
147
|
/**
|
|
79
|
-
* The
|
|
148
|
+
* The null keyword representation.
|
|
80
149
|
*
|
|
81
150
|
* @category models
|
|
82
151
|
* @since 4.0.0
|
|
83
152
|
*/
|
|
84
|
-
export interface Null {
|
|
85
|
-
readonly _tag: "Null";
|
|
86
|
-
readonly annotations?: Schema.Annotations.Annotations | undefined;
|
|
153
|
+
export interface Null extends Keyword<"Null"> {
|
|
87
154
|
}
|
|
88
155
|
/**
|
|
89
|
-
* The
|
|
156
|
+
* The undefined keyword representation.
|
|
90
157
|
*
|
|
91
158
|
* @category models
|
|
92
159
|
* @since 4.0.0
|
|
93
160
|
*/
|
|
94
|
-
export interface Undefined {
|
|
95
|
-
readonly _tag: "Undefined";
|
|
96
|
-
readonly annotations?: Schema.Annotations.Annotations | undefined;
|
|
161
|
+
export interface Undefined extends Keyword<"Undefined"> {
|
|
97
162
|
}
|
|
98
163
|
/**
|
|
99
|
-
* The
|
|
164
|
+
* The void keyword representation.
|
|
100
165
|
*
|
|
101
166
|
* @category models
|
|
102
167
|
* @since 4.0.0
|
|
103
168
|
*/
|
|
104
|
-
export interface Void {
|
|
105
|
-
readonly _tag: "Void";
|
|
106
|
-
readonly annotations?: Schema.Annotations.Annotations | undefined;
|
|
169
|
+
export interface Void extends Keyword<"Void"> {
|
|
107
170
|
}
|
|
108
171
|
/**
|
|
109
|
-
* The
|
|
172
|
+
* The never keyword representation.
|
|
110
173
|
*
|
|
111
174
|
* @category models
|
|
112
175
|
* @since 4.0.0
|
|
113
176
|
*/
|
|
114
|
-
export interface Never {
|
|
115
|
-
readonly _tag: "Never";
|
|
116
|
-
readonly annotations?: Schema.Annotations.Annotations | undefined;
|
|
177
|
+
export interface Never extends Keyword<"Never"> {
|
|
117
178
|
}
|
|
118
179
|
/**
|
|
119
|
-
* The
|
|
180
|
+
* The unknown keyword representation.
|
|
120
181
|
*
|
|
121
182
|
* @category models
|
|
122
183
|
* @since 4.0.0
|
|
123
184
|
*/
|
|
124
|
-
export interface Unknown {
|
|
125
|
-
readonly _tag: "Unknown";
|
|
126
|
-
readonly annotations?: Schema.Annotations.Annotations | undefined;
|
|
185
|
+
export interface Unknown extends Keyword<"Unknown"> {
|
|
127
186
|
}
|
|
128
187
|
/**
|
|
129
|
-
* The
|
|
188
|
+
* The any keyword representation.
|
|
130
189
|
*
|
|
131
190
|
* @category models
|
|
132
191
|
* @since 4.0.0
|
|
133
192
|
*/
|
|
134
|
-
export interface Any {
|
|
135
|
-
readonly _tag: "Any";
|
|
136
|
-
readonly annotations?: Schema.Annotations.Annotations | undefined;
|
|
193
|
+
export interface Any extends Keyword<"Any"> {
|
|
137
194
|
}
|
|
138
195
|
/**
|
|
139
|
-
*
|
|
140
|
-
*
|
|
141
|
-
* **Details**
|
|
142
|
-
*
|
|
143
|
-
* `checks` holds string-specific constraints, such as min/max length, pattern,
|
|
144
|
-
* and UUID checks. `contentMediaType` and `contentSchema` indicate that the
|
|
145
|
-
* string contains encoded data, such as `"application/json"` with a nested
|
|
146
|
-
* schema.
|
|
147
|
-
*
|
|
148
|
-
* @see {@link StringMeta}
|
|
149
|
-
* @see {@link Check}
|
|
196
|
+
* A string representation.
|
|
150
197
|
*
|
|
151
198
|
* @category models
|
|
152
199
|
* @since 4.0.0
|
|
153
200
|
*/
|
|
154
|
-
export interface String {
|
|
155
|
-
readonly _tag: "String";
|
|
156
|
-
readonly annotations?: Schema.Annotations.Annotations | undefined;
|
|
157
|
-
readonly checks: ReadonlyArray<Check<StringMeta>>;
|
|
158
|
-
readonly contentMediaType?: string | undefined;
|
|
159
|
-
readonly contentSchema?: Representation | undefined;
|
|
201
|
+
export interface String extends Keyword<"String"> {
|
|
160
202
|
}
|
|
161
203
|
/**
|
|
162
|
-
*
|
|
163
|
-
*
|
|
164
|
-
* **Details**
|
|
165
|
-
*
|
|
166
|
-
* `checks` holds number-specific constraints, such as int, finite, min, max,
|
|
167
|
-
* multipleOf, and between checks.
|
|
168
|
-
*
|
|
169
|
-
* @see {@link NumberMeta}
|
|
204
|
+
* A number representation.
|
|
170
205
|
*
|
|
171
206
|
* @category models
|
|
172
207
|
* @since 4.0.0
|
|
173
208
|
*/
|
|
174
|
-
export interface Number {
|
|
175
|
-
readonly _tag: "Number";
|
|
176
|
-
readonly annotations?: Schema.Annotations.Annotations | undefined;
|
|
177
|
-
readonly checks: ReadonlyArray<Check<NumberMeta>>;
|
|
209
|
+
export interface Number extends Keyword<"Number"> {
|
|
178
210
|
}
|
|
179
211
|
/**
|
|
180
|
-
*
|
|
212
|
+
* A boolean representation.
|
|
181
213
|
*
|
|
182
214
|
* @category models
|
|
183
215
|
* @since 4.0.0
|
|
184
216
|
*/
|
|
185
|
-
export interface Boolean {
|
|
186
|
-
readonly _tag: "Boolean";
|
|
187
|
-
readonly annotations?: Schema.Annotations.Annotations | undefined;
|
|
217
|
+
export interface Boolean extends Keyword<"Boolean"> {
|
|
188
218
|
}
|
|
189
219
|
/**
|
|
190
|
-
*
|
|
191
|
-
*
|
|
192
|
-
* @see {@link BigIntMeta}
|
|
220
|
+
* A bigint representation.
|
|
193
221
|
*
|
|
194
222
|
* @category models
|
|
195
223
|
* @since 4.0.0
|
|
196
224
|
*/
|
|
197
|
-
export interface BigInt {
|
|
198
|
-
readonly _tag: "BigInt";
|
|
199
|
-
readonly annotations?: Schema.Annotations.Annotations | undefined;
|
|
200
|
-
readonly checks: ReadonlyArray<Check<BigIntMeta>>;
|
|
225
|
+
export interface BigInt extends Keyword<"BigInt"> {
|
|
201
226
|
}
|
|
202
227
|
/**
|
|
203
|
-
*
|
|
228
|
+
* A symbol representation.
|
|
204
229
|
*
|
|
205
230
|
* @category models
|
|
206
231
|
* @since 4.0.0
|
|
207
232
|
*/
|
|
208
|
-
export interface Symbol {
|
|
209
|
-
readonly _tag: "Symbol";
|
|
210
|
-
readonly annotations?: Schema.Annotations.Annotations | undefined;
|
|
233
|
+
export interface Symbol extends Keyword<"Symbol"> {
|
|
211
234
|
}
|
|
212
235
|
/**
|
|
213
|
-
* A
|
|
236
|
+
* A literal representation.
|
|
237
|
+
*
|
|
238
|
+
* **Details**
|
|
239
|
+
*
|
|
240
|
+
* The live representation stores the native literal value. Persistent codecs
|
|
241
|
+
* add an explicit type discriminator when encoding it.
|
|
214
242
|
*
|
|
215
243
|
* @category models
|
|
216
244
|
* @since 4.0.0
|
|
217
245
|
*/
|
|
218
|
-
export interface Literal {
|
|
219
|
-
readonly
|
|
220
|
-
readonly annotations?: Schema.Annotations.Annotations | undefined;
|
|
221
|
-
readonly literal: string | number | boolean | bigint;
|
|
246
|
+
export interface Literal extends Keyword<"Literal"> {
|
|
247
|
+
readonly literal: SchemaAST.LiteralValue;
|
|
222
248
|
}
|
|
223
249
|
/**
|
|
224
|
-
* A
|
|
250
|
+
* A unique global symbol representation.
|
|
225
251
|
*
|
|
226
252
|
* @category models
|
|
227
253
|
* @since 4.0.0
|
|
228
254
|
*/
|
|
229
|
-
export interface UniqueSymbol {
|
|
230
|
-
readonly _tag: "UniqueSymbol";
|
|
231
|
-
readonly annotations?: Schema.Annotations.Annotations | undefined;
|
|
255
|
+
export interface UniqueSymbol extends Keyword<"UniqueSymbol"> {
|
|
232
256
|
readonly symbol: symbol;
|
|
233
257
|
}
|
|
234
258
|
/**
|
|
235
|
-
* The
|
|
259
|
+
* The object keyword representation.
|
|
236
260
|
*
|
|
237
261
|
* @category models
|
|
238
262
|
* @since 4.0.0
|
|
239
263
|
*/
|
|
240
|
-
export interface ObjectKeyword {
|
|
241
|
-
readonly _tag: "ObjectKeyword";
|
|
242
|
-
readonly annotations?: Schema.Annotations.Annotations | undefined;
|
|
264
|
+
export interface ObjectKeyword extends Keyword<"ObjectKeyword"> {
|
|
243
265
|
}
|
|
244
266
|
/**
|
|
245
|
-
*
|
|
267
|
+
* An enum representation.
|
|
268
|
+
*
|
|
269
|
+
* **Details**
|
|
270
|
+
*
|
|
271
|
+
* Enum members are stored as native string or number values. Persistent
|
|
272
|
+
* codecs add an explicit type discriminator when encoding them.
|
|
246
273
|
*
|
|
247
274
|
* @category models
|
|
248
275
|
* @since 4.0.0
|
|
249
276
|
*/
|
|
250
|
-
export interface Enum {
|
|
251
|
-
readonly _tag: "Enum";
|
|
252
|
-
readonly annotations?: Schema.Annotations.Annotations | undefined;
|
|
277
|
+
export interface Enum extends Keyword<"Enum"> {
|
|
253
278
|
readonly enums: ReadonlyArray<readonly [string, string | number]>;
|
|
254
279
|
}
|
|
255
280
|
/**
|
|
256
|
-
* A template literal
|
|
257
|
-
* numbers, etc.).
|
|
281
|
+
* A template literal representation.
|
|
258
282
|
*
|
|
259
283
|
* @category models
|
|
260
284
|
* @since 4.0.0
|
|
261
285
|
*/
|
|
262
|
-
export interface TemplateLiteral {
|
|
263
|
-
readonly _tag: "TemplateLiteral";
|
|
264
|
-
readonly annotations?: Schema.Annotations.Annotations | undefined;
|
|
286
|
+
export interface TemplateLiteral extends Keyword<"TemplateLiteral"> {
|
|
265
287
|
readonly parts: ReadonlyArray<Representation>;
|
|
266
288
|
}
|
|
267
289
|
/**
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
* **Details**
|
|
271
|
-
*
|
|
272
|
-
* `elements` are the fixed positional elements, or tuple prefix, and each may
|
|
273
|
-
* be optional. `rest` contains the variadic tail types; a single-element
|
|
274
|
-
* `rest` with no `elements` produces a plain `Array<T>`. `checks` holds
|
|
275
|
-
* array-specific constraints, such as minLength, maxLength, and unique checks.
|
|
276
|
-
*
|
|
277
|
-
* @see {@link Element}
|
|
278
|
-
* @see {@link ArraysMeta}
|
|
279
|
-
*
|
|
280
|
-
* @category models
|
|
281
|
-
* @since 4.0.0
|
|
282
|
-
*/
|
|
283
|
-
export interface Arrays {
|
|
284
|
-
readonly _tag: "Arrays";
|
|
285
|
-
readonly annotations?: Schema.Annotations.Annotations | undefined;
|
|
286
|
-
readonly elements: ReadonlyArray<Element>;
|
|
287
|
-
readonly rest: ReadonlyArray<Representation>;
|
|
288
|
-
readonly checks: ReadonlyArray<Check<ArraysMeta>>;
|
|
289
|
-
}
|
|
290
|
-
/**
|
|
291
|
-
* A positional element within an {@link Arrays} tuple.
|
|
292
|
-
*
|
|
293
|
-
* **Details**
|
|
294
|
-
*
|
|
295
|
-
* `isOptional` indicates whether this element can be absent. `type` is the
|
|
296
|
-
* schema representation for this element's value.
|
|
297
|
-
*
|
|
298
|
-
* @see {@link Arrays}
|
|
290
|
+
* A tuple element.
|
|
299
291
|
*
|
|
300
292
|
* @category models
|
|
301
293
|
* @since 4.0.0
|
|
@@ -306,38 +298,27 @@ export interface Element {
|
|
|
306
298
|
readonly annotations?: Schema.Annotations.Annotations | undefined;
|
|
307
299
|
}
|
|
308
300
|
/**
|
|
309
|
-
* An
|
|
310
|
-
*
|
|
311
|
-
* **Details**
|
|
312
|
-
*
|
|
313
|
-
* `propertySignatures` are the explicitly named fields. `indexSignatures`
|
|
314
|
-
* define catch-all key/value types, such as `Record<string, T>`. `checks`
|
|
315
|
-
* holds object-specific constraints, such as minProperties and maxProperties.
|
|
316
|
-
*
|
|
317
|
-
* @see {@link PropertySignature}
|
|
318
|
-
* @see {@link IndexSignature}
|
|
319
|
-
* @see {@link ObjectsMeta}
|
|
301
|
+
* An array or tuple representation.
|
|
320
302
|
*
|
|
321
303
|
* @category models
|
|
322
304
|
* @since 4.0.0
|
|
323
305
|
*/
|
|
324
|
-
export interface
|
|
325
|
-
readonly
|
|
326
|
-
readonly
|
|
327
|
-
readonly propertySignatures: ReadonlyArray<PropertySignature>;
|
|
328
|
-
readonly indexSignatures: ReadonlyArray<IndexSignature>;
|
|
329
|
-
readonly checks: ReadonlyArray<Check<ObjectsMeta>>;
|
|
306
|
+
export interface Arrays extends Keyword<"Arrays"> {
|
|
307
|
+
readonly elements: ReadonlyArray<Element>;
|
|
308
|
+
readonly rest: ReadonlyArray<Representation>;
|
|
330
309
|
}
|
|
331
310
|
/**
|
|
332
|
-
* A
|
|
311
|
+
* A property signature.
|
|
333
312
|
*
|
|
334
313
|
* **Details**
|
|
335
314
|
*
|
|
336
|
-
*
|
|
337
|
-
*
|
|
338
|
-
*
|
|
315
|
+
* The live representation stores the native property key. Persistent codecs
|
|
316
|
+
* add an explicit type discriminator when encoding it.
|
|
317
|
+
*
|
|
318
|
+
* **Gotchas**
|
|
339
319
|
*
|
|
340
|
-
*
|
|
320
|
+
* Local symbols can be represented while the schema is live, but persistent
|
|
321
|
+
* codecs reject them because they cannot be reconstructed by identity.
|
|
341
322
|
*
|
|
342
323
|
* @category models
|
|
343
324
|
* @since 4.0.0
|
|
@@ -350,15 +331,7 @@ export interface PropertySignature {
|
|
|
350
331
|
readonly annotations?: Schema.Annotations.Annotations | undefined;
|
|
351
332
|
}
|
|
352
333
|
/**
|
|
353
|
-
* An index signature
|
|
354
|
-
* {@link Objects}.
|
|
355
|
-
*
|
|
356
|
-
* **Details**
|
|
357
|
-
*
|
|
358
|
-
* `parameter` is the key type representation. `type` is the value type
|
|
359
|
-
* representation.
|
|
360
|
-
*
|
|
361
|
-
* @see {@link Objects}
|
|
334
|
+
* An index signature.
|
|
362
335
|
*
|
|
363
336
|
* @category models
|
|
364
337
|
* @since 4.0.0
|
|
@@ -368,1581 +341,507 @@ export interface IndexSignature {
|
|
|
368
341
|
readonly type: Representation;
|
|
369
342
|
}
|
|
370
343
|
/**
|
|
371
|
-
*
|
|
344
|
+
* An object representation.
|
|
372
345
|
*
|
|
373
|
-
*
|
|
374
|
-
*
|
|
375
|
-
|
|
376
|
-
|
|
346
|
+
* @category models
|
|
347
|
+
* @since 4.0.0
|
|
348
|
+
*/
|
|
349
|
+
export interface Objects extends Keyword<"Objects"> {
|
|
350
|
+
readonly propertySignatures: ReadonlyArray<PropertySignature>;
|
|
351
|
+
readonly indexSignatures: ReadonlyArray<IndexSignature>;
|
|
352
|
+
}
|
|
353
|
+
/**
|
|
354
|
+
* A union representation.
|
|
377
355
|
*
|
|
378
356
|
* @category models
|
|
379
357
|
* @since 4.0.0
|
|
380
358
|
*/
|
|
381
|
-
export interface Union {
|
|
382
|
-
readonly _tag: "Union";
|
|
383
|
-
readonly annotations?: Schema.Annotations.Annotations | undefined;
|
|
359
|
+
export interface Union extends Keyword<"Union"> {
|
|
384
360
|
readonly types: ReadonlyArray<Representation>;
|
|
385
361
|
readonly mode: "anyOf" | "oneOf";
|
|
386
362
|
}
|
|
387
363
|
/**
|
|
388
|
-
* The
|
|
389
|
-
*
|
|
390
|
-
* **Details**
|
|
391
|
-
*
|
|
392
|
-
* Each variant has a `_tag` discriminator. Switch on `_tag` to handle each
|
|
393
|
-
* shape. Most variants carry optional `annotations` and some carry `checks`
|
|
394
|
-
* for validation constraints.
|
|
395
|
-
*
|
|
396
|
-
* @see {@link Document}
|
|
397
|
-
* @see {@link fromAST}
|
|
364
|
+
* The structural schema representation.
|
|
398
365
|
*
|
|
399
366
|
* @category models
|
|
400
367
|
* @since 4.0.0
|
|
401
368
|
*/
|
|
402
369
|
export type Representation = Declaration | Reference | Suspend | Null | Undefined | Void | Never | Unknown | Any | String | Number | Boolean | BigInt | Symbol | Literal | UniqueSymbol | ObjectKeyword | Enum | TemplateLiteral | Arrays | Objects | Union;
|
|
403
370
|
/**
|
|
404
|
-
* A
|
|
405
|
-
* or a {@link FilterGroup} combining multiple checks.
|
|
406
|
-
*
|
|
407
|
-
* @see {@link Filter}
|
|
408
|
-
* @see {@link FilterGroup}
|
|
371
|
+
* A structural check.
|
|
409
372
|
*
|
|
410
373
|
* @category models
|
|
411
374
|
* @since 4.0.0
|
|
412
375
|
*/
|
|
413
|
-
export type Check
|
|
376
|
+
export type Check = Filter | FilterGroup;
|
|
414
377
|
/**
|
|
415
|
-
*
|
|
416
|
-
* (e.g. `{ _tag: "isMinLength", minLength: 3 }`).
|
|
417
|
-
*
|
|
418
|
-
* @see {@link Check}
|
|
378
|
+
* An opaque leaf check.
|
|
419
379
|
*
|
|
420
380
|
* @category models
|
|
421
381
|
* @since 4.0.0
|
|
422
382
|
*/
|
|
423
|
-
export interface Filter
|
|
383
|
+
export interface Filter {
|
|
424
384
|
readonly _tag: "Filter";
|
|
425
|
-
readonly
|
|
426
|
-
readonly
|
|
385
|
+
readonly representation?: CheckRepresentationAnnotation<Representation> | undefined;
|
|
386
|
+
readonly annotations?: Schema.Annotations.Annotations | undefined;
|
|
387
|
+
readonly aborted: boolean;
|
|
427
388
|
}
|
|
428
389
|
/**
|
|
429
|
-
* A group of
|
|
430
|
-
* at least one {@link Check}.
|
|
431
|
-
*
|
|
432
|
-
* @see {@link Check}
|
|
390
|
+
* A non-empty group of checks.
|
|
433
391
|
*
|
|
434
392
|
* @category models
|
|
435
393
|
* @since 4.0.0
|
|
436
394
|
*/
|
|
437
|
-
export interface FilterGroup
|
|
395
|
+
export interface FilterGroup {
|
|
438
396
|
readonly _tag: "FilterGroup";
|
|
439
|
-
readonly
|
|
440
|
-
readonly
|
|
397
|
+
readonly representation?: CheckRepresentationAnnotation<Representation> | undefined;
|
|
398
|
+
readonly annotations?: Schema.Annotations.Annotations | undefined;
|
|
399
|
+
readonly checks: readonly [Check, ...Array<Check>];
|
|
441
400
|
}
|
|
442
401
|
/**
|
|
443
|
-
*
|
|
444
|
-
* pattern, UUID, trimmed, etc.).
|
|
445
|
-
*
|
|
446
|
-
* @see {@link String}
|
|
447
|
-
* @see {@link Check}
|
|
402
|
+
* Named representation definitions.
|
|
448
403
|
*
|
|
449
404
|
* @category models
|
|
450
405
|
* @since 4.0.0
|
|
451
406
|
*/
|
|
452
|
-
export
|
|
407
|
+
export interface References {
|
|
408
|
+
readonly [$ref: string]: Representation;
|
|
409
|
+
}
|
|
453
410
|
/**
|
|
454
|
-
*
|
|
455
|
-
* min, max, multipleOf, between).
|
|
456
|
-
*
|
|
457
|
-
* @see {@link Number}
|
|
458
|
-
* @see {@link Check}
|
|
411
|
+
* A single representation and its definitions.
|
|
459
412
|
*
|
|
460
413
|
* @category models
|
|
461
414
|
* @since 4.0.0
|
|
462
415
|
*/
|
|
463
|
-
export
|
|
416
|
+
export interface Document {
|
|
417
|
+
readonly representation: Representation;
|
|
418
|
+
readonly references: References;
|
|
419
|
+
}
|
|
464
420
|
/**
|
|
465
|
-
*
|
|
466
|
-
*
|
|
467
|
-
* @see {@link BigInt}
|
|
468
|
-
* @see {@link Check}
|
|
421
|
+
* Multiple representations sharing definitions.
|
|
469
422
|
*
|
|
470
423
|
* @category models
|
|
471
424
|
* @since 4.0.0
|
|
472
425
|
*/
|
|
473
|
-
export
|
|
426
|
+
export interface MultiDocument {
|
|
427
|
+
readonly representations: readonly [Representation, ...Array<Representation>];
|
|
428
|
+
readonly references: References;
|
|
429
|
+
}
|
|
474
430
|
/**
|
|
475
|
-
*
|
|
476
|
-
* length, unique).
|
|
477
|
-
*
|
|
478
|
-
* @see {@link Arrays}
|
|
479
|
-
* @see {@link Check}
|
|
431
|
+
* Live schemas reconstructed from a multi-document.
|
|
480
432
|
*
|
|
481
433
|
* @category models
|
|
482
434
|
* @since 4.0.0
|
|
483
435
|
*/
|
|
484
|
-
export
|
|
436
|
+
export interface SchemaMultiDocument {
|
|
437
|
+
readonly schemas: readonly [Schema.Top, ...Array<Schema.Top>];
|
|
438
|
+
readonly definitions: Readonly<Record<string, Schema.Top>>;
|
|
439
|
+
}
|
|
485
440
|
/**
|
|
486
|
-
*
|
|
487
|
-
* maxProperties, propertiesLength, propertyNames).
|
|
488
|
-
*
|
|
489
|
-
* @see {@link Objects}
|
|
490
|
-
* @see {@link Check}
|
|
441
|
+
* Reviver for a declaration.
|
|
491
442
|
*
|
|
492
443
|
* @category models
|
|
493
444
|
* @since 4.0.0
|
|
494
445
|
*/
|
|
495
|
-
export
|
|
496
|
-
readonly
|
|
497
|
-
readonly
|
|
498
|
-
|
|
446
|
+
export interface DeclarationReviver<P> {
|
|
447
|
+
readonly id: string;
|
|
448
|
+
readonly payloadSchema: Schema.Decoder<P>;
|
|
449
|
+
readonly revive: (input: {
|
|
450
|
+
readonly payload: P;
|
|
451
|
+
readonly typeParameters: ReadonlyArray<Schema.Top>;
|
|
452
|
+
readonly annotations: Schema.Annotations.Annotations | undefined;
|
|
453
|
+
}) => Schema.Top;
|
|
454
|
+
}
|
|
499
455
|
/**
|
|
500
|
-
*
|
|
501
|
-
*
|
|
502
|
-
* @see {@link Declaration}
|
|
503
|
-
* @see {@link DeclarationMeta}
|
|
456
|
+
* Reviver for a leaf check.
|
|
504
457
|
*
|
|
505
458
|
* @category models
|
|
506
459
|
* @since 4.0.0
|
|
507
460
|
*/
|
|
508
|
-
export
|
|
461
|
+
export interface FilterReviver<P> {
|
|
462
|
+
readonly id: string;
|
|
463
|
+
readonly payloadSchema: Schema.Decoder<P>;
|
|
464
|
+
readonly revive: (input: {
|
|
465
|
+
readonly payload: P;
|
|
466
|
+
readonly schemas: ReadonlyArray<Schema.Top>;
|
|
467
|
+
readonly annotations: Schema.Annotations.Filter | undefined;
|
|
468
|
+
}) => SchemaAST.Filter<any>;
|
|
469
|
+
}
|
|
509
470
|
/**
|
|
510
|
-
*
|
|
511
|
-
* Used for collection types like `Set`, `Map`.
|
|
512
|
-
*
|
|
513
|
-
* @see {@link Declaration}
|
|
514
|
-
* @see {@link DeclarationMeta}
|
|
471
|
+
* Reviver for a check group.
|
|
515
472
|
*
|
|
516
473
|
* @category models
|
|
517
474
|
* @since 4.0.0
|
|
518
475
|
*/
|
|
519
|
-
export
|
|
476
|
+
export interface FilterGroupReviver<P> {
|
|
477
|
+
readonly id: string;
|
|
478
|
+
readonly payloadSchema: Schema.Decoder<P>;
|
|
479
|
+
readonly revive: (input: {
|
|
480
|
+
readonly payload: P;
|
|
481
|
+
readonly schemas: ReadonlyArray<Schema.Top>;
|
|
482
|
+
readonly annotations: Schema.Annotations.Filter | undefined;
|
|
483
|
+
}) => SchemaAST.FilterGroup<any>;
|
|
484
|
+
}
|
|
520
485
|
/**
|
|
521
|
-
*
|
|
522
|
-
* or {@link SizeMeta}.
|
|
486
|
+
* A check reviver.
|
|
523
487
|
*
|
|
524
488
|
* @category models
|
|
525
489
|
* @since 4.0.0
|
|
526
490
|
*/
|
|
527
|
-
export type
|
|
491
|
+
export type CheckReviver<P> = FilterReviver<P> | FilterGroupReviver<P>;
|
|
528
492
|
/**
|
|
529
|
-
* A
|
|
530
|
-
* {@link Document} and {@link MultiDocument} for `$ref` resolution (analogous
|
|
531
|
-
* to JSON Schema `$defs`).
|
|
532
|
-
*
|
|
533
|
-
* @see {@link Reference}
|
|
534
|
-
* @see {@link Document}
|
|
493
|
+
* A typed reviver.
|
|
535
494
|
*
|
|
536
495
|
* @category models
|
|
537
496
|
* @since 4.0.0
|
|
538
497
|
*/
|
|
539
|
-
export
|
|
540
|
-
readonly [$ref: string]: Representation;
|
|
541
|
-
}
|
|
498
|
+
export type Reviver<P> = DeclarationReviver<P> | CheckReviver<P>;
|
|
542
499
|
/**
|
|
543
|
-
* A
|
|
544
|
-
*
|
|
545
|
-
* **When to use**
|
|
546
|
-
*
|
|
547
|
-
* Use when representing a single Schema AST together with its named references
|
|
548
|
-
* before reconstructing a runtime Schema, converting to JSON Schema, or
|
|
549
|
-
* wrapping it as a {@link MultiDocument}.
|
|
550
|
-
*
|
|
551
|
-
* @see {@link MultiDocument}
|
|
552
|
-
* @see {@link fromAST}
|
|
500
|
+
* A reviver erased only at collection boundaries.
|
|
553
501
|
*
|
|
554
502
|
* @category models
|
|
555
503
|
* @since 4.0.0
|
|
556
504
|
*/
|
|
557
|
-
export type
|
|
558
|
-
readonly representation: Representation;
|
|
559
|
-
readonly references: References;
|
|
560
|
-
};
|
|
505
|
+
export type AnyReviver = Reviver<any>;
|
|
561
506
|
/**
|
|
562
|
-
*
|
|
563
|
-
*
|
|
564
|
-
* **When to use**
|
|
507
|
+
* Creates a declaration reviver while inferring its payload type from `payloadSchema`.
|
|
565
508
|
*
|
|
566
|
-
*
|
|
567
|
-
* {@link toCodeDocument} to generate TypeScript code, and
|
|
568
|
-
* {@link toJsonSchemaMultiDocument} to convert to JSON Schema.
|
|
569
|
-
*
|
|
570
|
-
* @see {@link Document}
|
|
571
|
-
* @see {@link fromASTs}
|
|
572
|
-
*
|
|
573
|
-
* @category models
|
|
509
|
+
* @category constructors
|
|
574
510
|
* @since 4.0.0
|
|
575
511
|
*/
|
|
576
|
-
export
|
|
577
|
-
readonly representations: readonly [Representation, ...Array<Representation>];
|
|
578
|
-
readonly references: References;
|
|
579
|
-
};
|
|
512
|
+
export declare const makeDeclarationReviver: <P>(id: string, payloadSchema: Schema.Decoder<P>, revive: DeclarationReviver<P>["revive"]) => DeclarationReviver<P>;
|
|
580
513
|
/**
|
|
581
|
-
*
|
|
514
|
+
* Creates a filter reviver while inferring its payload type from `payloadSchema`.
|
|
582
515
|
*
|
|
583
|
-
* @category
|
|
516
|
+
* @category constructors
|
|
584
517
|
* @since 4.0.0
|
|
585
518
|
*/
|
|
586
|
-
export
|
|
519
|
+
export declare const makeFilterReviver: <P>(id: string, payloadSchema: Schema.Decoder<P>, revive: FilterReviver<P>["revive"]) => FilterReviver<P>;
|
|
587
520
|
/**
|
|
588
|
-
*
|
|
521
|
+
* Creates a filter group reviver while inferring its payload type from `payloadSchema`.
|
|
589
522
|
*
|
|
590
|
-
*
|
|
591
|
-
*
|
|
592
|
-
* Use to validate recursive annotation metadata trees whose leaves are `null`,
|
|
593
|
-
* `number`, `boolean`, `bigint`, `symbol`, or `string`.
|
|
594
|
-
*
|
|
595
|
-
* @see {@link PrimitiveTree} for the recursive tree type accepted by this codec
|
|
596
|
-
* @see {@link $Annotations} for the annotation codec that filters values through this codec
|
|
597
|
-
*
|
|
598
|
-
* @category schemas
|
|
523
|
+
* @category constructors
|
|
599
524
|
* @since 4.0.0
|
|
600
525
|
*/
|
|
601
|
-
export declare const
|
|
526
|
+
export declare const makeFilterGroupReviver: <P>(id: string, payloadSchema: Schema.Decoder<P>, revive: FilterGroupReviver<P>["revive"]) => FilterGroupReviver<P>;
|
|
602
527
|
/**
|
|
603
|
-
*
|
|
604
|
-
* filters out internal annotation keys and non-primitive values during
|
|
605
|
-
* encoding.
|
|
528
|
+
* Options for importing JSON Schema Draft 2020-12 documents.
|
|
606
529
|
*
|
|
607
530
|
* **When to use**
|
|
608
531
|
*
|
|
609
|
-
* Use
|
|
610
|
-
* only primitive-tree metadata.
|
|
532
|
+
* Use when each JSON Schema node must be transformed before it is translated.
|
|
611
533
|
*
|
|
612
|
-
* **
|
|
613
|
-
*
|
|
614
|
-
* Decoding is passthrough. Encoding removes internal annotation keys and values
|
|
615
|
-
* that are not accepted by `$PrimitiveTree`.
|
|
616
|
-
*
|
|
617
|
-
* @see {@link $PrimitiveTree} for the codec used to filter annotation values
|
|
534
|
+
* **Gotchas**
|
|
618
535
|
*
|
|
619
|
-
*
|
|
620
|
-
* @since 4.0.0
|
|
621
|
-
*/
|
|
622
|
-
export declare const $Annotations: Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree, never, never>>, never, never>;
|
|
623
|
-
/**
|
|
624
|
-
* Schema for the {@link Null} representation node.
|
|
536
|
+
* `onEnter` must return a JSON Schema object. Its result is used directly, and exceptions raised by the callback pass through unchanged.
|
|
625
537
|
*
|
|
626
|
-
* @category
|
|
538
|
+
* @category models
|
|
627
539
|
* @since 4.0.0
|
|
628
540
|
*/
|
|
629
|
-
export
|
|
630
|
-
readonly
|
|
631
|
-
|
|
632
|
-
}>;
|
|
541
|
+
export interface FromJsonSchemaOptions {
|
|
542
|
+
readonly onEnter?: ((schema: JsonSchema.JsonSchema) => JsonSchema.JsonSchema) | undefined;
|
|
543
|
+
}
|
|
633
544
|
/**
|
|
634
|
-
*
|
|
545
|
+
* Runtime and TypeScript source generated for one schema.
|
|
635
546
|
*
|
|
636
|
-
* @category
|
|
547
|
+
* @category models
|
|
637
548
|
* @since 4.0.0
|
|
638
549
|
*/
|
|
639
|
-
export
|
|
640
|
-
readonly
|
|
641
|
-
readonly
|
|
642
|
-
}
|
|
643
|
-
/**
|
|
644
|
-
* Schema for the {@link Void} representation node.
|
|
645
|
-
*
|
|
646
|
-
* @category schemas
|
|
647
|
-
* @since 4.0.0
|
|
648
|
-
*/
|
|
649
|
-
export declare const $Void: Schema.Struct<{
|
|
650
|
-
readonly _tag: Schema.tag<"Void">;
|
|
651
|
-
readonly annotations: Schema.optional<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree, never, never>>, never, never>>;
|
|
652
|
-
}>;
|
|
653
|
-
/**
|
|
654
|
-
* Schema for the {@link Never} representation node.
|
|
655
|
-
*
|
|
656
|
-
* @category schemas
|
|
657
|
-
* @since 4.0.0
|
|
658
|
-
*/
|
|
659
|
-
export declare const $Never: Schema.Struct<{
|
|
660
|
-
readonly _tag: Schema.tag<"Never">;
|
|
661
|
-
readonly annotations: Schema.optional<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree, never, never>>, never, never>>;
|
|
662
|
-
}>;
|
|
550
|
+
export interface Code {
|
|
551
|
+
readonly runtime: string;
|
|
552
|
+
readonly Type: string;
|
|
553
|
+
}
|
|
663
554
|
/**
|
|
664
|
-
*
|
|
665
|
-
*
|
|
666
|
-
* @category schemas
|
|
667
|
-
* @since 4.0.0
|
|
668
|
-
*/
|
|
669
|
-
export declare const $Unknown: Schema.Struct<{
|
|
670
|
-
readonly _tag: Schema.tag<"Unknown">;
|
|
671
|
-
readonly annotations: Schema.optional<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree, never, never>>, never, never>>;
|
|
672
|
-
}>;
|
|
673
|
-
/**
|
|
674
|
-
* Schema for the {@link Any} representation node.
|
|
675
|
-
*
|
|
676
|
-
* @category schemas
|
|
677
|
-
* @since 4.0.0
|
|
678
|
-
*/
|
|
679
|
-
export declare const $Any: Schema.Struct<{
|
|
680
|
-
readonly _tag: Schema.tag<"Any">;
|
|
681
|
-
readonly annotations: Schema.optional<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree, never, never>>, never, never>>;
|
|
682
|
-
}>;
|
|
683
|
-
/**
|
|
684
|
-
* Schema for {@link StringMeta}.
|
|
685
|
-
*
|
|
686
|
-
* @category schemas
|
|
687
|
-
* @since 4.0.0
|
|
688
|
-
*/
|
|
689
|
-
export declare const $StringMeta: Schema.Union<readonly [Schema.Struct<{
|
|
690
|
-
readonly _tag: Schema.tag<"isStringFinite">;
|
|
691
|
-
readonly regExp: Schema.RegExp;
|
|
692
|
-
}>, Schema.Struct<{
|
|
693
|
-
readonly _tag: Schema.tag<"isStringBigInt">;
|
|
694
|
-
readonly regExp: Schema.RegExp;
|
|
695
|
-
}>, Schema.Struct<{
|
|
696
|
-
readonly _tag: Schema.tag<"isStringSymbol">;
|
|
697
|
-
readonly regExp: Schema.RegExp;
|
|
698
|
-
}>, Schema.Struct<{
|
|
699
|
-
readonly _tag: Schema.tag<"isTrimmed">;
|
|
700
|
-
readonly regExp: Schema.RegExp;
|
|
701
|
-
}>, Schema.Struct<{
|
|
702
|
-
readonly _tag: Schema.tag<"isUUID">;
|
|
703
|
-
readonly regExp: Schema.RegExp;
|
|
704
|
-
readonly version: Schema.UndefinedOr<Schema.Literals<readonly [1, 2, 3, 4, 5, 6, 7, 8]>>;
|
|
705
|
-
}>, Schema.Struct<{
|
|
706
|
-
readonly _tag: Schema.tag<"isGUID">;
|
|
707
|
-
readonly regExp: Schema.RegExp;
|
|
708
|
-
}>, Schema.Struct<{
|
|
709
|
-
readonly _tag: Schema.tag<"isULID">;
|
|
710
|
-
readonly regExp: Schema.RegExp;
|
|
711
|
-
}>, Schema.Struct<{
|
|
712
|
-
readonly _tag: Schema.tag<"isBase64">;
|
|
713
|
-
readonly regExp: Schema.RegExp;
|
|
714
|
-
}>, Schema.Struct<{
|
|
715
|
-
readonly _tag: Schema.tag<"isBase64Url">;
|
|
716
|
-
readonly regExp: Schema.RegExp;
|
|
717
|
-
}>, Schema.Struct<{
|
|
718
|
-
readonly _tag: Schema.tag<"isStartsWith">;
|
|
719
|
-
readonly startsWith: Schema.String;
|
|
720
|
-
readonly regExp: Schema.RegExp;
|
|
721
|
-
}>, Schema.Struct<{
|
|
722
|
-
readonly _tag: Schema.tag<"isEndsWith">;
|
|
723
|
-
readonly endsWith: Schema.String;
|
|
724
|
-
readonly regExp: Schema.RegExp;
|
|
725
|
-
}>, Schema.Struct<{
|
|
726
|
-
readonly _tag: Schema.tag<"isIncludes">;
|
|
727
|
-
readonly includes: Schema.String;
|
|
728
|
-
readonly regExp: Schema.RegExp;
|
|
729
|
-
}>, Schema.Struct<{
|
|
730
|
-
readonly _tag: Schema.tag<"isUppercased">;
|
|
731
|
-
readonly regExp: Schema.RegExp;
|
|
732
|
-
}>, Schema.Struct<{
|
|
733
|
-
readonly _tag: Schema.tag<"isLowercased">;
|
|
734
|
-
readonly regExp: Schema.RegExp;
|
|
735
|
-
}>, Schema.Struct<{
|
|
736
|
-
readonly _tag: Schema.tag<"isCapitalized">;
|
|
737
|
-
readonly regExp: Schema.RegExp;
|
|
738
|
-
}>, Schema.Struct<{
|
|
739
|
-
readonly _tag: Schema.tag<"isUncapitalized">;
|
|
740
|
-
readonly regExp: Schema.RegExp;
|
|
741
|
-
}>, Schema.Struct<{
|
|
742
|
-
readonly _tag: Schema.tag<"isMinLength">;
|
|
743
|
-
readonly minLength: Schema.Int;
|
|
744
|
-
}>, Schema.Struct<{
|
|
745
|
-
readonly _tag: Schema.tag<"isMaxLength">;
|
|
746
|
-
readonly maxLength: Schema.Int;
|
|
747
|
-
}>, Schema.Struct<{
|
|
748
|
-
readonly _tag: Schema.tag<"isPattern">;
|
|
749
|
-
readonly regExp: Schema.RegExp;
|
|
750
|
-
}>, Schema.Struct<{
|
|
751
|
-
readonly _tag: Schema.tag<"isLengthBetween">;
|
|
752
|
-
readonly minimum: Schema.Int;
|
|
753
|
-
readonly maximum: Schema.Int;
|
|
754
|
-
}>]>;
|
|
755
|
-
/**
|
|
756
|
-
* Schema for the {@link String} representation node.
|
|
757
|
-
*
|
|
758
|
-
* @category schemas
|
|
759
|
-
* @since 4.0.0
|
|
760
|
-
*/
|
|
761
|
-
export declare const $String: Schema.Struct<{
|
|
762
|
-
readonly _tag: Schema.tag<"String">;
|
|
763
|
-
readonly annotations: Schema.optional<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree, never, never>>, never, never>>;
|
|
764
|
-
readonly checks: Schema.$Array<Schema.Codec<Check<Schema.Struct.ReadonlySide<{
|
|
765
|
-
readonly _tag: Schema.tag<"isStringFinite">;
|
|
766
|
-
readonly regExp: Schema.RegExp;
|
|
767
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
768
|
-
readonly _tag: Schema.tag<"isStringBigInt">;
|
|
769
|
-
readonly regExp: Schema.RegExp;
|
|
770
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
771
|
-
readonly _tag: Schema.tag<"isStringSymbol">;
|
|
772
|
-
readonly regExp: Schema.RegExp;
|
|
773
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
774
|
-
readonly _tag: Schema.tag<"isTrimmed">;
|
|
775
|
-
readonly regExp: Schema.RegExp;
|
|
776
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
777
|
-
readonly _tag: Schema.tag<"isUUID">;
|
|
778
|
-
readonly regExp: Schema.RegExp;
|
|
779
|
-
readonly version: Schema.UndefinedOr<Schema.Literals<readonly [1, 2, 3, 4, 5, 6, 7, 8]>>;
|
|
780
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
781
|
-
readonly _tag: Schema.tag<"isGUID">;
|
|
782
|
-
readonly regExp: Schema.RegExp;
|
|
783
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
784
|
-
readonly _tag: Schema.tag<"isULID">;
|
|
785
|
-
readonly regExp: Schema.RegExp;
|
|
786
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
787
|
-
readonly _tag: Schema.tag<"isBase64">;
|
|
788
|
-
readonly regExp: Schema.RegExp;
|
|
789
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
790
|
-
readonly _tag: Schema.tag<"isBase64Url">;
|
|
791
|
-
readonly regExp: Schema.RegExp;
|
|
792
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
793
|
-
readonly _tag: Schema.tag<"isStartsWith">;
|
|
794
|
-
readonly startsWith: Schema.String;
|
|
795
|
-
readonly regExp: Schema.RegExp;
|
|
796
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
797
|
-
readonly _tag: Schema.tag<"isEndsWith">;
|
|
798
|
-
readonly endsWith: Schema.String;
|
|
799
|
-
readonly regExp: Schema.RegExp;
|
|
800
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
801
|
-
readonly _tag: Schema.tag<"isIncludes">;
|
|
802
|
-
readonly includes: Schema.String;
|
|
803
|
-
readonly regExp: Schema.RegExp;
|
|
804
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
805
|
-
readonly _tag: Schema.tag<"isUppercased">;
|
|
806
|
-
readonly regExp: Schema.RegExp;
|
|
807
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
808
|
-
readonly _tag: Schema.tag<"isLowercased">;
|
|
809
|
-
readonly regExp: Schema.RegExp;
|
|
810
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
811
|
-
readonly _tag: Schema.tag<"isCapitalized">;
|
|
812
|
-
readonly regExp: Schema.RegExp;
|
|
813
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
814
|
-
readonly _tag: Schema.tag<"isUncapitalized">;
|
|
815
|
-
readonly regExp: Schema.RegExp;
|
|
816
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
817
|
-
readonly _tag: Schema.tag<"isMinLength">;
|
|
818
|
-
readonly minLength: Schema.Int;
|
|
819
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
820
|
-
readonly _tag: Schema.tag<"isMaxLength">;
|
|
821
|
-
readonly maxLength: Schema.Int;
|
|
822
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
823
|
-
readonly _tag: Schema.tag<"isLengthBetween">;
|
|
824
|
-
readonly minimum: Schema.Int;
|
|
825
|
-
readonly maximum: Schema.Int;
|
|
826
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
827
|
-
readonly _tag: Schema.tag<"isPattern">;
|
|
828
|
-
readonly regExp: Schema.RegExp;
|
|
829
|
-
}, "Encoded">>, Check<Schema.Struct.ReadonlySide<{
|
|
830
|
-
readonly _tag: Schema.tag<"isStringFinite">;
|
|
831
|
-
readonly regExp: Schema.RegExp;
|
|
832
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
833
|
-
readonly _tag: Schema.tag<"isStringBigInt">;
|
|
834
|
-
readonly regExp: Schema.RegExp;
|
|
835
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
836
|
-
readonly _tag: Schema.tag<"isStringSymbol">;
|
|
837
|
-
readonly regExp: Schema.RegExp;
|
|
838
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
839
|
-
readonly _tag: Schema.tag<"isTrimmed">;
|
|
840
|
-
readonly regExp: Schema.RegExp;
|
|
841
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
842
|
-
readonly _tag: Schema.tag<"isUUID">;
|
|
843
|
-
readonly regExp: Schema.RegExp;
|
|
844
|
-
readonly version: Schema.UndefinedOr<Schema.Literals<readonly [1, 2, 3, 4, 5, 6, 7, 8]>>;
|
|
845
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
846
|
-
readonly _tag: Schema.tag<"isGUID">;
|
|
847
|
-
readonly regExp: Schema.RegExp;
|
|
848
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
849
|
-
readonly _tag: Schema.tag<"isULID">;
|
|
850
|
-
readonly regExp: Schema.RegExp;
|
|
851
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
852
|
-
readonly _tag: Schema.tag<"isBase64">;
|
|
853
|
-
readonly regExp: Schema.RegExp;
|
|
854
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
855
|
-
readonly _tag: Schema.tag<"isBase64Url">;
|
|
856
|
-
readonly regExp: Schema.RegExp;
|
|
857
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
858
|
-
readonly _tag: Schema.tag<"isStartsWith">;
|
|
859
|
-
readonly startsWith: Schema.String;
|
|
860
|
-
readonly regExp: Schema.RegExp;
|
|
861
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
862
|
-
readonly _tag: Schema.tag<"isEndsWith">;
|
|
863
|
-
readonly endsWith: Schema.String;
|
|
864
|
-
readonly regExp: Schema.RegExp;
|
|
865
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
866
|
-
readonly _tag: Schema.tag<"isIncludes">;
|
|
867
|
-
readonly includes: Schema.String;
|
|
868
|
-
readonly regExp: Schema.RegExp;
|
|
869
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
870
|
-
readonly _tag: Schema.tag<"isUppercased">;
|
|
871
|
-
readonly regExp: Schema.RegExp;
|
|
872
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
873
|
-
readonly _tag: Schema.tag<"isLowercased">;
|
|
874
|
-
readonly regExp: Schema.RegExp;
|
|
875
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
876
|
-
readonly _tag: Schema.tag<"isCapitalized">;
|
|
877
|
-
readonly regExp: Schema.RegExp;
|
|
878
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
879
|
-
readonly _tag: Schema.tag<"isUncapitalized">;
|
|
880
|
-
readonly regExp: Schema.RegExp;
|
|
881
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
882
|
-
readonly _tag: Schema.tag<"isMinLength">;
|
|
883
|
-
readonly minLength: Schema.Int;
|
|
884
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
885
|
-
readonly _tag: Schema.tag<"isMaxLength">;
|
|
886
|
-
readonly maxLength: Schema.Int;
|
|
887
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
888
|
-
readonly _tag: Schema.tag<"isLengthBetween">;
|
|
889
|
-
readonly minimum: Schema.Int;
|
|
890
|
-
readonly maximum: Schema.Int;
|
|
891
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
892
|
-
readonly _tag: Schema.tag<"isPattern">;
|
|
893
|
-
readonly regExp: Schema.RegExp;
|
|
894
|
-
}, "Encoded">>, never, never>>;
|
|
895
|
-
readonly contentMediaType: Schema.optional<Schema.String>;
|
|
896
|
-
readonly contentSchema: Schema.optional<Schema.suspend<$Representation>>;
|
|
897
|
-
}>;
|
|
898
|
-
/**
|
|
899
|
-
* Schema for {@link NumberMeta}.
|
|
900
|
-
*
|
|
901
|
-
* @category schemas
|
|
902
|
-
* @since 4.0.0
|
|
903
|
-
*/
|
|
904
|
-
export declare const $NumberMeta: Schema.Union<readonly [Schema.Struct<{
|
|
905
|
-
readonly _tag: Schema.tag<"isInt">;
|
|
906
|
-
}>, Schema.Struct<{
|
|
907
|
-
readonly _tag: Schema.tag<"isMultipleOf">;
|
|
908
|
-
readonly divisor: Schema.Finite;
|
|
909
|
-
}>, Schema.Struct<{
|
|
910
|
-
readonly _tag: Schema.tag<"isFinite">;
|
|
911
|
-
}>, Schema.Struct<{
|
|
912
|
-
readonly _tag: Schema.tag<"isGreaterThan">;
|
|
913
|
-
readonly exclusiveMinimum: Schema.Finite;
|
|
914
|
-
}>, Schema.Struct<{
|
|
915
|
-
readonly _tag: Schema.tag<"isGreaterThanOrEqualTo">;
|
|
916
|
-
readonly minimum: Schema.Finite;
|
|
917
|
-
}>, Schema.Struct<{
|
|
918
|
-
readonly _tag: Schema.tag<"isLessThan">;
|
|
919
|
-
readonly exclusiveMaximum: Schema.Finite;
|
|
920
|
-
}>, Schema.Struct<{
|
|
921
|
-
readonly _tag: Schema.tag<"isLessThanOrEqualTo">;
|
|
922
|
-
readonly maximum: Schema.Finite;
|
|
923
|
-
}>, Schema.Struct<{
|
|
924
|
-
readonly _tag: Schema.tag<"isBetween">;
|
|
925
|
-
readonly minimum: Schema.Finite;
|
|
926
|
-
readonly maximum: Schema.Finite;
|
|
927
|
-
readonly exclusiveMinimum: Schema.optional<Schema.Boolean>;
|
|
928
|
-
readonly exclusiveMaximum: Schema.optional<Schema.Boolean>;
|
|
929
|
-
}>]>;
|
|
930
|
-
/**
|
|
931
|
-
* Schema for the {@link Number} representation node.
|
|
932
|
-
*
|
|
933
|
-
* @category schemas
|
|
934
|
-
* @since 4.0.0
|
|
935
|
-
*/
|
|
936
|
-
export declare const $Number: Schema.Struct<{
|
|
937
|
-
readonly _tag: Schema.tag<"Number">;
|
|
938
|
-
readonly annotations: Schema.optional<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree, never, never>>, never, never>>;
|
|
939
|
-
readonly checks: Schema.$Array<Schema.Codec<Check<Schema.Struct.ReadonlySide<{
|
|
940
|
-
readonly _tag: Schema.tag<"isInt">;
|
|
941
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
942
|
-
readonly _tag: Schema.tag<"isMultipleOf">;
|
|
943
|
-
readonly divisor: Schema.Finite;
|
|
944
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
945
|
-
readonly _tag: Schema.tag<"isFinite">;
|
|
946
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
947
|
-
readonly _tag: Schema.tag<"isGreaterThan">;
|
|
948
|
-
readonly exclusiveMinimum: Schema.Finite;
|
|
949
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
950
|
-
readonly _tag: Schema.tag<"isGreaterThanOrEqualTo">;
|
|
951
|
-
readonly minimum: Schema.Finite;
|
|
952
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
953
|
-
readonly _tag: Schema.tag<"isLessThan">;
|
|
954
|
-
readonly exclusiveMaximum: Schema.Finite;
|
|
955
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
956
|
-
readonly _tag: Schema.tag<"isLessThanOrEqualTo">;
|
|
957
|
-
readonly maximum: Schema.Finite;
|
|
958
|
-
}, "Encoded"> | {
|
|
959
|
-
readonly _tag: "isBetween";
|
|
960
|
-
readonly minimum: number;
|
|
961
|
-
readonly maximum: number;
|
|
962
|
-
readonly exclusiveMinimum?: boolean | undefined;
|
|
963
|
-
readonly exclusiveMaximum?: boolean | undefined;
|
|
964
|
-
}>, Check<Schema.Struct.ReadonlySide<{
|
|
965
|
-
readonly _tag: Schema.tag<"isInt">;
|
|
966
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
967
|
-
readonly _tag: Schema.tag<"isMultipleOf">;
|
|
968
|
-
readonly divisor: Schema.Finite;
|
|
969
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
970
|
-
readonly _tag: Schema.tag<"isFinite">;
|
|
971
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
972
|
-
readonly _tag: Schema.tag<"isGreaterThan">;
|
|
973
|
-
readonly exclusiveMinimum: Schema.Finite;
|
|
974
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
975
|
-
readonly _tag: Schema.tag<"isGreaterThanOrEqualTo">;
|
|
976
|
-
readonly minimum: Schema.Finite;
|
|
977
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
978
|
-
readonly _tag: Schema.tag<"isLessThan">;
|
|
979
|
-
readonly exclusiveMaximum: Schema.Finite;
|
|
980
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
981
|
-
readonly _tag: Schema.tag<"isLessThanOrEqualTo">;
|
|
982
|
-
readonly maximum: Schema.Finite;
|
|
983
|
-
}, "Encoded"> | {
|
|
984
|
-
readonly _tag: "isBetween";
|
|
985
|
-
readonly minimum: number;
|
|
986
|
-
readonly maximum: number;
|
|
987
|
-
readonly exclusiveMinimum?: boolean | undefined;
|
|
988
|
-
readonly exclusiveMaximum?: boolean | undefined;
|
|
989
|
-
}>, never, never>>;
|
|
990
|
-
}>;
|
|
991
|
-
/**
|
|
992
|
-
* Schema for the {@link Boolean} representation node.
|
|
993
|
-
*
|
|
994
|
-
* @category schemas
|
|
995
|
-
* @since 4.0.0
|
|
996
|
-
*/
|
|
997
|
-
export declare const $Boolean: Schema.Struct<{
|
|
998
|
-
readonly _tag: Schema.tag<"Boolean">;
|
|
999
|
-
readonly annotations: Schema.optional<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree, never, never>>, never, never>>;
|
|
1000
|
-
}>;
|
|
1001
|
-
/**
|
|
1002
|
-
* Schema for the {@link BigInt} representation node.
|
|
1003
|
-
*
|
|
1004
|
-
* **When to use**
|
|
1005
|
-
*
|
|
1006
|
-
* Use to encode, decode, or validate serialized `BigInt` representation nodes,
|
|
1007
|
-
* not application `bigint` values.
|
|
1008
|
-
*
|
|
1009
|
-
* **Details**
|
|
1010
|
-
*
|
|
1011
|
-
* Accepts representation nodes with `_tag: "BigInt"`, optional annotations,
|
|
1012
|
-
* and bigint-specific validation metadata in `checks`.
|
|
1013
|
-
*
|
|
1014
|
-
* @see {@link BigIntMeta} for the metadata accepted by the `checks` array
|
|
555
|
+
* Creates generated runtime and TypeScript source strings for a schema.
|
|
1015
556
|
*
|
|
1016
|
-
* @category
|
|
557
|
+
* @category constructors
|
|
1017
558
|
* @since 4.0.0
|
|
1018
559
|
*/
|
|
1019
|
-
export declare const
|
|
1020
|
-
readonly _tag: Schema.tag<"BigInt">;
|
|
1021
|
-
readonly annotations: Schema.optional<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree, never, never>>, never, never>>;
|
|
1022
|
-
readonly checks: Schema.$Array<Schema.Codec<Check<Schema.Struct.ReadonlySide<{
|
|
1023
|
-
readonly _tag: Schema.tag<"isGreaterThanBigInt">;
|
|
1024
|
-
readonly exclusiveMinimum: Schema.BigInt;
|
|
1025
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
1026
|
-
readonly _tag: Schema.tag<"isGreaterThanOrEqualToBigInt">;
|
|
1027
|
-
readonly minimum: Schema.BigInt;
|
|
1028
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
1029
|
-
readonly _tag: Schema.tag<"isLessThanBigInt">;
|
|
1030
|
-
readonly exclusiveMaximum: Schema.BigInt;
|
|
1031
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
1032
|
-
readonly _tag: Schema.tag<"isLessThanOrEqualToBigInt">;
|
|
1033
|
-
readonly maximum: Schema.BigInt;
|
|
1034
|
-
}, "Encoded"> | {
|
|
1035
|
-
readonly _tag: "isBetweenBigInt";
|
|
1036
|
-
readonly minimum: bigint;
|
|
1037
|
-
readonly maximum: bigint;
|
|
1038
|
-
readonly exclusiveMinimum?: boolean | undefined;
|
|
1039
|
-
readonly exclusiveMaximum?: boolean | undefined;
|
|
1040
|
-
}>, Check<Schema.Struct.ReadonlySide<{
|
|
1041
|
-
readonly _tag: Schema.tag<"isGreaterThanBigInt">;
|
|
1042
|
-
readonly exclusiveMinimum: Schema.BigInt;
|
|
1043
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
1044
|
-
readonly _tag: Schema.tag<"isGreaterThanOrEqualToBigInt">;
|
|
1045
|
-
readonly minimum: Schema.BigInt;
|
|
1046
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
1047
|
-
readonly _tag: Schema.tag<"isLessThanBigInt">;
|
|
1048
|
-
readonly exclusiveMaximum: Schema.BigInt;
|
|
1049
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
1050
|
-
readonly _tag: Schema.tag<"isLessThanOrEqualToBigInt">;
|
|
1051
|
-
readonly maximum: Schema.BigInt;
|
|
1052
|
-
}, "Encoded"> | {
|
|
1053
|
-
readonly _tag: "isBetweenBigInt";
|
|
1054
|
-
readonly minimum: bigint;
|
|
1055
|
-
readonly maximum: bigint;
|
|
1056
|
-
readonly exclusiveMinimum?: boolean | undefined;
|
|
1057
|
-
readonly exclusiveMaximum?: boolean | undefined;
|
|
1058
|
-
}>, never, never>>;
|
|
1059
|
-
}>;
|
|
560
|
+
export declare const makeCode: (runtime: string, Type: string) => Code;
|
|
1060
561
|
/**
|
|
1061
|
-
*
|
|
562
|
+
* Auxiliary source artifact emitted while generating schema code.
|
|
1062
563
|
*
|
|
1063
|
-
* @category
|
|
564
|
+
* @category models
|
|
1064
565
|
* @since 4.0.0
|
|
1065
566
|
*/
|
|
1066
|
-
export
|
|
1067
|
-
readonly _tag:
|
|
1068
|
-
readonly
|
|
1069
|
-
|
|
567
|
+
export type Artifact = {
|
|
568
|
+
readonly _tag: "Symbol";
|
|
569
|
+
readonly identifier: string;
|
|
570
|
+
readonly code: Code;
|
|
571
|
+
} | {
|
|
572
|
+
readonly _tag: "Enum";
|
|
573
|
+
readonly identifier: string;
|
|
574
|
+
readonly code: Code;
|
|
575
|
+
} | {
|
|
576
|
+
readonly _tag: "Import";
|
|
577
|
+
readonly importDeclaration: string;
|
|
578
|
+
};
|
|
1070
579
|
/**
|
|
1071
|
-
*
|
|
1072
|
-
* (string, finite number, boolean, or bigint).
|
|
580
|
+
* Generated schema code together with named references and auxiliary artifacts.
|
|
1073
581
|
*
|
|
1074
|
-
* @category
|
|
582
|
+
* @category models
|
|
1075
583
|
* @since 4.0.0
|
|
1076
584
|
*/
|
|
1077
|
-
export
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
readonly
|
|
1087
|
-
|
|
1088
|
-
}>;
|
|
585
|
+
export interface CodeDocument {
|
|
586
|
+
readonly codes: ReadonlyArray<Code>;
|
|
587
|
+
readonly references: {
|
|
588
|
+
readonly nonRecursives: ReadonlyArray<{
|
|
589
|
+
readonly $ref: string;
|
|
590
|
+
readonly code: Code;
|
|
591
|
+
}>;
|
|
592
|
+
readonly recursives: Readonly<Record<string, Code>>;
|
|
593
|
+
};
|
|
594
|
+
readonly artifacts: ReadonlyArray<Artifact>;
|
|
595
|
+
}
|
|
1089
596
|
/**
|
|
1090
|
-
*
|
|
597
|
+
* Lowers the encoded side of an AST to a live representation document.
|
|
1091
598
|
*
|
|
1092
|
-
*
|
|
1093
|
-
* @since 4.0.0
|
|
1094
|
-
*/
|
|
1095
|
-
export declare const $UniqueSymbol: Schema.Struct<{
|
|
1096
|
-
readonly _tag: Schema.tag<"UniqueSymbol">;
|
|
1097
|
-
readonly annotations: Schema.optional<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree, never, never>>, never, never>>;
|
|
1098
|
-
readonly symbol: Schema.Symbol;
|
|
1099
|
-
}>;
|
|
1100
|
-
/**
|
|
1101
|
-
* Schema for the {@link ObjectKeyword} representation node.
|
|
599
|
+
* **Details**
|
|
1102
600
|
*
|
|
1103
|
-
*
|
|
1104
|
-
* @since 4.0.0
|
|
1105
|
-
*/
|
|
1106
|
-
export declare const $ObjectKeyword: Schema.Struct<{
|
|
1107
|
-
readonly _tag: Schema.tag<"ObjectKeyword">;
|
|
1108
|
-
readonly annotations: Schema.optional<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree, never, never>>, never, never>>;
|
|
1109
|
-
}>;
|
|
1110
|
-
/**
|
|
1111
|
-
* Schema for the {@link Enum} representation node.
|
|
601
|
+
* Apply `SchemaAST.toType` to the AST first to lower its type side instead.
|
|
1112
602
|
*
|
|
1113
|
-
* @category
|
|
603
|
+
* @category constructors
|
|
1114
604
|
* @since 4.0.0
|
|
1115
605
|
*/
|
|
1116
|
-
export declare
|
|
1117
|
-
readonly _tag: Schema.tag<"Enum">;
|
|
1118
|
-
readonly annotations: Schema.optional<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree, never, never>>, never, never>>;
|
|
1119
|
-
readonly enums: Schema.$Array<Schema.Tuple<readonly [Schema.String, Schema.Union<readonly [Schema.String, Schema.Number]>]>>;
|
|
1120
|
-
}>;
|
|
1121
|
-
/**
|
|
1122
|
-
* Schema for the {@link TemplateLiteral} representation node.
|
|
1123
|
-
*
|
|
1124
|
-
* @category schemas
|
|
1125
|
-
* @since 4.0.0
|
|
1126
|
-
*/
|
|
1127
|
-
export declare const $TemplateLiteral: Schema.Struct<{
|
|
1128
|
-
readonly _tag: Schema.tag<"TemplateLiteral">;
|
|
1129
|
-
readonly annotations: Schema.optional<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree, never, never>>, never, never>>;
|
|
1130
|
-
readonly parts: Schema.$Array<Schema.suspend<$Representation>>;
|
|
1131
|
-
}>;
|
|
606
|
+
export declare function toRepresentation(ast: SchemaAST.AST): Document;
|
|
1132
607
|
/**
|
|
1133
|
-
*
|
|
608
|
+
* Lowers one or more AST encoded sides in a shared reference environment.
|
|
1134
609
|
*
|
|
1135
|
-
*
|
|
1136
|
-
* @since 4.0.0
|
|
1137
|
-
*/
|
|
1138
|
-
export declare const $Element: Schema.Struct<{
|
|
1139
|
-
readonly isOptional: Schema.Boolean;
|
|
1140
|
-
readonly type: Schema.suspend<$Representation>;
|
|
1141
|
-
readonly annotations: Schema.optional<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree, never, never>>, never, never>>;
|
|
1142
|
-
}>;
|
|
1143
|
-
/**
|
|
1144
|
-
* Schema for the {@link Arrays} representation node.
|
|
610
|
+
* **Details**
|
|
1145
611
|
*
|
|
1146
|
-
*
|
|
1147
|
-
* @since 4.0.0
|
|
1148
|
-
*/
|
|
1149
|
-
export declare const $Arrays: Schema.Struct<{
|
|
1150
|
-
readonly _tag: Schema.tag<"Arrays">;
|
|
1151
|
-
readonly annotations: Schema.optional<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree, never, never>>, never, never>>;
|
|
1152
|
-
readonly elements: Schema.$Array<Schema.Struct<{
|
|
1153
|
-
readonly isOptional: Schema.Boolean;
|
|
1154
|
-
readonly type: Schema.suspend<$Representation>;
|
|
1155
|
-
readonly annotations: Schema.optional<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree, never, never>>, never, never>>;
|
|
1156
|
-
}>>;
|
|
1157
|
-
readonly rest: Schema.$Array<Schema.suspend<$Representation>>;
|
|
1158
|
-
readonly checks: Schema.$Array<Schema.Codec<Check<Schema.Struct.ReadonlySide<{
|
|
1159
|
-
readonly _tag: Schema.tag<"isMinLength">;
|
|
1160
|
-
readonly minLength: Schema.Int;
|
|
1161
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
1162
|
-
readonly _tag: Schema.tag<"isMaxLength">;
|
|
1163
|
-
readonly maxLength: Schema.Int;
|
|
1164
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
1165
|
-
readonly _tag: Schema.tag<"isLengthBetween">;
|
|
1166
|
-
readonly minimum: Schema.Int;
|
|
1167
|
-
readonly maximum: Schema.Int;
|
|
1168
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
1169
|
-
readonly _tag: Schema.tag<"isUnique">;
|
|
1170
|
-
}, "Encoded">>, Check<Schema.Struct.ReadonlySide<{
|
|
1171
|
-
readonly _tag: Schema.tag<"isMinLength">;
|
|
1172
|
-
readonly minLength: Schema.Int;
|
|
1173
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
1174
|
-
readonly _tag: Schema.tag<"isMaxLength">;
|
|
1175
|
-
readonly maxLength: Schema.Int;
|
|
1176
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
1177
|
-
readonly _tag: Schema.tag<"isLengthBetween">;
|
|
1178
|
-
readonly minimum: Schema.Int;
|
|
1179
|
-
readonly maximum: Schema.Int;
|
|
1180
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
1181
|
-
readonly _tag: Schema.tag<"isUnique">;
|
|
1182
|
-
}, "Encoded">>, never, never>>;
|
|
1183
|
-
}>;
|
|
1184
|
-
/**
|
|
1185
|
-
* Schema for the {@link PropertySignature} type.
|
|
1186
|
-
*
|
|
1187
|
-
* @category schemas
|
|
1188
|
-
* @since 4.0.0
|
|
1189
|
-
*/
|
|
1190
|
-
export declare const $PropertySignature: Schema.Struct<{
|
|
1191
|
-
readonly annotations: Schema.optional<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree, never, never>>, never, never>>;
|
|
1192
|
-
readonly name: Schema.Union<readonly [Schema.Finite, Schema.Symbol, Schema.String]>;
|
|
1193
|
-
readonly type: Schema.suspend<$Representation>;
|
|
1194
|
-
readonly isOptional: Schema.Boolean;
|
|
1195
|
-
readonly isMutable: Schema.Boolean;
|
|
1196
|
-
}>;
|
|
1197
|
-
/**
|
|
1198
|
-
* Schema for the {@link IndexSignature} type.
|
|
1199
|
-
*
|
|
1200
|
-
* @category schemas
|
|
1201
|
-
* @since 4.0.0
|
|
1202
|
-
*/
|
|
1203
|
-
export declare const $IndexSignature: Schema.Struct<{
|
|
1204
|
-
readonly parameter: Schema.suspend<$Representation>;
|
|
1205
|
-
readonly type: Schema.suspend<$Representation>;
|
|
1206
|
-
}>;
|
|
1207
|
-
/**
|
|
1208
|
-
* Schema for {@link ObjectsMeta}.
|
|
1209
|
-
*
|
|
1210
|
-
* @category schemas
|
|
1211
|
-
* @since 4.0.0
|
|
1212
|
-
*/
|
|
1213
|
-
export declare const $ObjectsMeta: Schema.Union<readonly [Schema.Struct<{
|
|
1214
|
-
readonly _tag: Schema.tag<"isMinProperties">;
|
|
1215
|
-
readonly minProperties: Schema.Int;
|
|
1216
|
-
}>, Schema.Struct<{
|
|
1217
|
-
readonly _tag: Schema.tag<"isMaxProperties">;
|
|
1218
|
-
readonly maxProperties: Schema.Int;
|
|
1219
|
-
}>, Schema.Struct<{
|
|
1220
|
-
readonly _tag: Schema.tag<"isPropertiesLengthBetween">;
|
|
1221
|
-
readonly minimum: Schema.Int;
|
|
1222
|
-
readonly maximum: Schema.Int;
|
|
1223
|
-
}>, Schema.Struct<{
|
|
1224
|
-
readonly _tag: Schema.tag<"isPropertyNames">;
|
|
1225
|
-
readonly propertyNames: Schema.suspend<$Representation>;
|
|
1226
|
-
}>]>;
|
|
1227
|
-
/**
|
|
1228
|
-
* Schema for the {@link Objects} representation node.
|
|
1229
|
-
*
|
|
1230
|
-
* @category schemas
|
|
1231
|
-
* @since 4.0.0
|
|
1232
|
-
*/
|
|
1233
|
-
export declare const $Objects: Schema.Struct<{
|
|
1234
|
-
readonly _tag: Schema.tag<"Objects">;
|
|
1235
|
-
readonly annotations: Schema.optional<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree, never, never>>, never, never>>;
|
|
1236
|
-
readonly propertySignatures: Schema.$Array<Schema.Struct<{
|
|
1237
|
-
readonly annotations: Schema.optional<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree, never, never>>, never, never>>;
|
|
1238
|
-
readonly name: Schema.Union<readonly [Schema.Finite, Schema.Symbol, Schema.String]>;
|
|
1239
|
-
readonly type: Schema.suspend<$Representation>;
|
|
1240
|
-
readonly isOptional: Schema.Boolean;
|
|
1241
|
-
readonly isMutable: Schema.Boolean;
|
|
1242
|
-
}>>;
|
|
1243
|
-
readonly indexSignatures: Schema.$Array<Schema.Struct<{
|
|
1244
|
-
readonly parameter: Schema.suspend<$Representation>;
|
|
1245
|
-
readonly type: Schema.suspend<$Representation>;
|
|
1246
|
-
}>>;
|
|
1247
|
-
readonly checks: Schema.$Array<Schema.Codec<Check<Schema.Struct.ReadonlySide<{
|
|
1248
|
-
readonly _tag: Schema.tag<"isMinProperties">;
|
|
1249
|
-
readonly minProperties: Schema.Int;
|
|
1250
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
1251
|
-
readonly _tag: Schema.tag<"isMaxProperties">;
|
|
1252
|
-
readonly maxProperties: Schema.Int;
|
|
1253
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
1254
|
-
readonly _tag: Schema.tag<"isPropertiesLengthBetween">;
|
|
1255
|
-
readonly minimum: Schema.Int;
|
|
1256
|
-
readonly maximum: Schema.Int;
|
|
1257
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
1258
|
-
readonly _tag: Schema.tag<"isPropertyNames">;
|
|
1259
|
-
readonly propertyNames: Schema.suspend<$Representation>;
|
|
1260
|
-
}, "Encoded">>, Check<Schema.Struct.ReadonlySide<{
|
|
1261
|
-
readonly _tag: Schema.tag<"isMinProperties">;
|
|
1262
|
-
readonly minProperties: Schema.Int;
|
|
1263
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
1264
|
-
readonly _tag: Schema.tag<"isMaxProperties">;
|
|
1265
|
-
readonly maxProperties: Schema.Int;
|
|
1266
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
1267
|
-
readonly _tag: Schema.tag<"isPropertiesLengthBetween">;
|
|
1268
|
-
readonly minimum: Schema.Int;
|
|
1269
|
-
readonly maximum: Schema.Int;
|
|
1270
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
1271
|
-
readonly _tag: Schema.tag<"isPropertyNames">;
|
|
1272
|
-
readonly propertyNames: Schema.suspend<$Representation>;
|
|
1273
|
-
}, "Encoded">>, never, never>>;
|
|
1274
|
-
}>;
|
|
1275
|
-
/**
|
|
1276
|
-
* Schema for the {@link Union} representation node.
|
|
1277
|
-
*
|
|
1278
|
-
* @category schemas
|
|
1279
|
-
* @since 4.0.0
|
|
1280
|
-
*/
|
|
1281
|
-
export declare const $Union: Schema.Struct<{
|
|
1282
|
-
readonly _tag: Schema.tag<"Union">;
|
|
1283
|
-
readonly annotations: Schema.optional<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree, never, never>>, never, never>>;
|
|
1284
|
-
readonly types: Schema.$Array<Schema.suspend<$Representation>>;
|
|
1285
|
-
readonly mode: Schema.Literals<readonly ["anyOf", "oneOf"]>;
|
|
1286
|
-
}>;
|
|
1287
|
-
/**
|
|
1288
|
-
* Schema for the {@link Reference} representation node.
|
|
1289
|
-
*
|
|
1290
|
-
* @category schemas
|
|
1291
|
-
* @since 4.0.0
|
|
1292
|
-
*/
|
|
1293
|
-
export declare const $Reference: Schema.Struct<{
|
|
1294
|
-
readonly _tag: Schema.tag<"Reference">;
|
|
1295
|
-
readonly $ref: Schema.String;
|
|
1296
|
-
}>;
|
|
1297
|
-
/**
|
|
1298
|
-
* Schema for {@link DateMeta}.
|
|
1299
|
-
*
|
|
1300
|
-
* @category schemas
|
|
1301
|
-
* @since 4.0.0
|
|
1302
|
-
*/
|
|
1303
|
-
export declare const $DateMeta: Schema.Union<readonly [Schema.Struct<{
|
|
1304
|
-
readonly _tag: Schema.tag<"isDateValid">;
|
|
1305
|
-
}>, Schema.Struct<{
|
|
1306
|
-
readonly _tag: Schema.tag<"isGreaterThanDate">;
|
|
1307
|
-
readonly exclusiveMinimum: Schema.Date;
|
|
1308
|
-
}>, Schema.Struct<{
|
|
1309
|
-
readonly _tag: Schema.tag<"isGreaterThanOrEqualToDate">;
|
|
1310
|
-
readonly minimum: Schema.Date;
|
|
1311
|
-
}>, Schema.Struct<{
|
|
1312
|
-
readonly _tag: Schema.tag<"isLessThanDate">;
|
|
1313
|
-
readonly exclusiveMaximum: Schema.Date;
|
|
1314
|
-
}>, Schema.Struct<{
|
|
1315
|
-
readonly _tag: Schema.tag<"isLessThanOrEqualToDate">;
|
|
1316
|
-
readonly maximum: Schema.Date;
|
|
1317
|
-
}>, Schema.Struct<{
|
|
1318
|
-
readonly _tag: Schema.tag<"isBetweenDate">;
|
|
1319
|
-
readonly minimum: Schema.Date;
|
|
1320
|
-
readonly maximum: Schema.Date;
|
|
1321
|
-
readonly exclusiveMinimum: Schema.optional<Schema.Boolean>;
|
|
1322
|
-
readonly exclusiveMaximum: Schema.optional<Schema.Boolean>;
|
|
1323
|
-
}>]>;
|
|
1324
|
-
/**
|
|
1325
|
-
* Schema for {@link SizeMeta}.
|
|
1326
|
-
*
|
|
1327
|
-
* @category schemas
|
|
1328
|
-
* @since 4.0.0
|
|
1329
|
-
*/
|
|
1330
|
-
export declare const $SizeMeta: Schema.Union<readonly [Schema.Struct<{
|
|
1331
|
-
readonly _tag: Schema.tag<"isMinSize">;
|
|
1332
|
-
readonly minSize: Schema.Int;
|
|
1333
|
-
}>, Schema.Struct<{
|
|
1334
|
-
readonly _tag: Schema.tag<"isMaxSize">;
|
|
1335
|
-
readonly maxSize: Schema.Int;
|
|
1336
|
-
}>, Schema.Struct<{
|
|
1337
|
-
readonly _tag: Schema.tag<"isSizeBetween">;
|
|
1338
|
-
readonly minimum: Schema.Int;
|
|
1339
|
-
readonly maximum: Schema.Int;
|
|
1340
|
-
}>]>;
|
|
1341
|
-
/**
|
|
1342
|
-
* Schema for {@link DeclarationMeta}.
|
|
1343
|
-
*
|
|
1344
|
-
* @category schemas
|
|
1345
|
-
* @since 4.0.0
|
|
1346
|
-
*/
|
|
1347
|
-
export declare const $DeclarationMeta: Schema.Union<readonly [Schema.Union<readonly [Schema.Struct<{
|
|
1348
|
-
readonly _tag: Schema.tag<"isDateValid">;
|
|
1349
|
-
}>, Schema.Struct<{
|
|
1350
|
-
readonly _tag: Schema.tag<"isGreaterThanDate">;
|
|
1351
|
-
readonly exclusiveMinimum: Schema.Date;
|
|
1352
|
-
}>, Schema.Struct<{
|
|
1353
|
-
readonly _tag: Schema.tag<"isGreaterThanOrEqualToDate">;
|
|
1354
|
-
readonly minimum: Schema.Date;
|
|
1355
|
-
}>, Schema.Struct<{
|
|
1356
|
-
readonly _tag: Schema.tag<"isLessThanDate">;
|
|
1357
|
-
readonly exclusiveMaximum: Schema.Date;
|
|
1358
|
-
}>, Schema.Struct<{
|
|
1359
|
-
readonly _tag: Schema.tag<"isLessThanOrEqualToDate">;
|
|
1360
|
-
readonly maximum: Schema.Date;
|
|
1361
|
-
}>, Schema.Struct<{
|
|
1362
|
-
readonly _tag: Schema.tag<"isBetweenDate">;
|
|
1363
|
-
readonly minimum: Schema.Date;
|
|
1364
|
-
readonly maximum: Schema.Date;
|
|
1365
|
-
readonly exclusiveMinimum: Schema.optional<Schema.Boolean>;
|
|
1366
|
-
readonly exclusiveMaximum: Schema.optional<Schema.Boolean>;
|
|
1367
|
-
}>]>, Schema.Union<readonly [Schema.Struct<{
|
|
1368
|
-
readonly _tag: Schema.tag<"isMinSize">;
|
|
1369
|
-
readonly minSize: Schema.Int;
|
|
1370
|
-
}>, Schema.Struct<{
|
|
1371
|
-
readonly _tag: Schema.tag<"isMaxSize">;
|
|
1372
|
-
readonly maxSize: Schema.Int;
|
|
1373
|
-
}>, Schema.Struct<{
|
|
1374
|
-
readonly _tag: Schema.tag<"isSizeBetween">;
|
|
1375
|
-
readonly minimum: Schema.Int;
|
|
1376
|
-
readonly maximum: Schema.Int;
|
|
1377
|
-
}>]>]>;
|
|
1378
|
-
/**
|
|
1379
|
-
* Schema for the {@link Declaration} representation node.
|
|
1380
|
-
*
|
|
1381
|
-
* @category schemas
|
|
1382
|
-
* @since 4.0.0
|
|
1383
|
-
*/
|
|
1384
|
-
export declare const $Declaration: Schema.Struct<{
|
|
1385
|
-
readonly _tag: Schema.tag<"Declaration">;
|
|
1386
|
-
readonly annotations: Schema.optional<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree, never, never>>, never, never>>;
|
|
1387
|
-
readonly typeParameters: Schema.$Array<Schema.suspend<$Representation>>;
|
|
1388
|
-
readonly checks: Schema.$Array<Schema.Codec<Check<Schema.Struct.ReadonlySide<{
|
|
1389
|
-
readonly _tag: Schema.tag<"isDateValid">;
|
|
1390
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
1391
|
-
readonly _tag: Schema.tag<"isGreaterThanDate">;
|
|
1392
|
-
readonly exclusiveMinimum: Schema.Date;
|
|
1393
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
1394
|
-
readonly _tag: Schema.tag<"isGreaterThanOrEqualToDate">;
|
|
1395
|
-
readonly minimum: Schema.Date;
|
|
1396
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
1397
|
-
readonly _tag: Schema.tag<"isLessThanDate">;
|
|
1398
|
-
readonly exclusiveMaximum: Schema.Date;
|
|
1399
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
1400
|
-
readonly _tag: Schema.tag<"isLessThanOrEqualToDate">;
|
|
1401
|
-
readonly maximum: Schema.Date;
|
|
1402
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
1403
|
-
readonly _tag: Schema.tag<"isMinSize">;
|
|
1404
|
-
readonly minSize: Schema.Int;
|
|
1405
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
1406
|
-
readonly _tag: Schema.tag<"isMaxSize">;
|
|
1407
|
-
readonly maxSize: Schema.Int;
|
|
1408
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
1409
|
-
readonly _tag: Schema.tag<"isSizeBetween">;
|
|
1410
|
-
readonly minimum: Schema.Int;
|
|
1411
|
-
readonly maximum: Schema.Int;
|
|
1412
|
-
}, "Encoded"> | {
|
|
1413
|
-
readonly _tag: "isBetweenDate";
|
|
1414
|
-
readonly minimum: Date;
|
|
1415
|
-
readonly maximum: Date;
|
|
1416
|
-
readonly exclusiveMinimum?: boolean | undefined;
|
|
1417
|
-
readonly exclusiveMaximum?: boolean | undefined;
|
|
1418
|
-
}>, Check<Schema.Struct.ReadonlySide<{
|
|
1419
|
-
readonly _tag: Schema.tag<"isDateValid">;
|
|
1420
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
1421
|
-
readonly _tag: Schema.tag<"isGreaterThanDate">;
|
|
1422
|
-
readonly exclusiveMinimum: Schema.Date;
|
|
1423
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
1424
|
-
readonly _tag: Schema.tag<"isGreaterThanOrEqualToDate">;
|
|
1425
|
-
readonly minimum: Schema.Date;
|
|
1426
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
1427
|
-
readonly _tag: Schema.tag<"isLessThanDate">;
|
|
1428
|
-
readonly exclusiveMaximum: Schema.Date;
|
|
1429
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
1430
|
-
readonly _tag: Schema.tag<"isLessThanOrEqualToDate">;
|
|
1431
|
-
readonly maximum: Schema.Date;
|
|
1432
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
1433
|
-
readonly _tag: Schema.tag<"isMinSize">;
|
|
1434
|
-
readonly minSize: Schema.Int;
|
|
1435
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
1436
|
-
readonly _tag: Schema.tag<"isMaxSize">;
|
|
1437
|
-
readonly maxSize: Schema.Int;
|
|
1438
|
-
}, "Encoded"> | Schema.Struct.ReadonlySide<{
|
|
1439
|
-
readonly _tag: Schema.tag<"isSizeBetween">;
|
|
1440
|
-
readonly minimum: Schema.Int;
|
|
1441
|
-
readonly maximum: Schema.Int;
|
|
1442
|
-
}, "Encoded"> | {
|
|
1443
|
-
readonly _tag: "isBetweenDate";
|
|
1444
|
-
readonly minimum: Date;
|
|
1445
|
-
readonly maximum: Date;
|
|
1446
|
-
readonly exclusiveMinimum?: boolean | undefined;
|
|
1447
|
-
readonly exclusiveMaximum?: boolean | undefined;
|
|
1448
|
-
}>, never, never>>;
|
|
1449
|
-
readonly encodedSchema: Schema.suspend<$Representation>;
|
|
1450
|
-
}>;
|
|
1451
|
-
/**
|
|
1452
|
-
* Schema for the {@link Suspend} representation node.
|
|
1453
|
-
*
|
|
1454
|
-
* @category schemas
|
|
1455
|
-
* @since 4.0.0
|
|
1456
|
-
*/
|
|
1457
|
-
export declare const $Suspend: Schema.Struct<{
|
|
1458
|
-
readonly _tag: Schema.tag<"Suspend">;
|
|
1459
|
-
readonly annotations: Schema.optional<Schema.decodeTo<Schema.$Record<Schema.String, Schema.Unknown>, Schema.$Record<Schema.String, Schema.Codec<PrimitiveTree, PrimitiveTree, never, never>>, never, never>>;
|
|
1460
|
-
readonly checks: Schema.Tuple<readonly []>;
|
|
1461
|
-
readonly thunk: Schema.suspend<$Representation>;
|
|
1462
|
-
}>;
|
|
1463
|
-
/**
|
|
1464
|
-
* Type-level helper for the recursive {@link $Representation} codec.
|
|
1465
|
-
*
|
|
1466
|
-
* @category schemas
|
|
1467
|
-
* @since 4.0.0
|
|
1468
|
-
*/
|
|
1469
|
-
export interface $Representation extends Schema.Codec<Representation> {
|
|
1470
|
-
}
|
|
1471
|
-
/**
|
|
1472
|
-
* Schema for the full {@link Representation} union. It recursively validates
|
|
1473
|
-
* and encodes any representation node.
|
|
612
|
+
* Apply `SchemaAST.toType` to an AST first to lower its type side instead.
|
|
1474
613
|
*
|
|
1475
|
-
* @category
|
|
614
|
+
* @category constructors
|
|
1476
615
|
* @since 4.0.0
|
|
1477
616
|
*/
|
|
1478
|
-
export declare
|
|
617
|
+
export declare function toRepresentations(asts: readonly [SchemaAST.AST, ...Array<SchemaAST.AST>]): MultiDocument;
|
|
1479
618
|
/**
|
|
1480
|
-
*
|
|
619
|
+
* Converts live schemas and their named definitions to a shared representation document.
|
|
1481
620
|
*
|
|
1482
621
|
* **When to use**
|
|
1483
622
|
*
|
|
1484
|
-
* Use
|
|
1485
|
-
* `Schema.decodeUnknownSync` or `Schema.encodeSync`.
|
|
623
|
+
* Use when schemas with shared or unreachable definitions must be passed to representation compilers such as `toCodeDocument`.
|
|
1486
624
|
*
|
|
1487
625
|
* **Gotchas**
|
|
1488
626
|
*
|
|
1489
|
-
*
|
|
1490
|
-
* against `references`.
|
|
1491
|
-
*
|
|
1492
|
-
* @see {@link DocumentFromJson} for the JSON-string codec wrapper
|
|
1493
|
-
* @see {@link $MultiDocument} for validating documents with multiple root representations
|
|
627
|
+
* Every schema is projected to its encoded side. Definitions are preserved even when no root reaches them.
|
|
1494
628
|
*
|
|
1495
|
-
* @
|
|
1496
|
-
* @
|
|
1497
|
-
*/
|
|
1498
|
-
export declare const $Document: Schema.Struct<{
|
|
1499
|
-
readonly representation: $Representation;
|
|
1500
|
-
readonly references: Schema.$Record<Schema.String, $Representation>;
|
|
1501
|
-
}>;
|
|
1502
|
-
/**
|
|
1503
|
-
* Schema for {@link MultiDocument}.
|
|
629
|
+
* @see {@link toRepresentations} for converting AST roots without an explicit definition map
|
|
630
|
+
* @see {@link toCodeDocument} for generating code from the result
|
|
1504
631
|
*
|
|
1505
|
-
* @category
|
|
632
|
+
* @category constructors
|
|
1506
633
|
* @since 4.0.0
|
|
1507
634
|
*/
|
|
1508
|
-
export declare
|
|
1509
|
-
readonly representations: Schema.NonEmptyArray<$Representation>;
|
|
1510
|
-
readonly references: Schema.$Record<Schema.String, $Representation>;
|
|
1511
|
-
}>;
|
|
635
|
+
export declare function fromSchemaMultiDocument(document: SchemaMultiDocument): MultiDocument;
|
|
1512
636
|
/**
|
|
1513
|
-
*
|
|
637
|
+
* Wraps a single representation document as a multi-document with one root.
|
|
1514
638
|
*
|
|
1515
639
|
* **When to use**
|
|
1516
640
|
*
|
|
1517
|
-
* Use when
|
|
1518
|
-
* document.
|
|
1519
|
-
*
|
|
1520
|
-
* **Details**
|
|
1521
|
-
*
|
|
1522
|
-
* Shared/recursive sub-schemas are extracted into the `references` map.
|
|
1523
|
-
*
|
|
1524
|
-
* **Example** (Converting a Schema to a Document)
|
|
1525
|
-
*
|
|
1526
|
-
* ```ts
|
|
1527
|
-
* import { Schema, SchemaRepresentation } from "effect"
|
|
1528
|
-
*
|
|
1529
|
-
* const Person = Schema.Struct({
|
|
1530
|
-
* name: Schema.String,
|
|
1531
|
-
* age: Schema.Number
|
|
1532
|
-
* })
|
|
1533
|
-
*
|
|
1534
|
-
* const doc = SchemaRepresentation.fromAST(Person.ast)
|
|
1535
|
-
* console.log(doc.representation._tag)
|
|
1536
|
-
* // "Objects"
|
|
1537
|
-
* ```
|
|
641
|
+
* Use when an API such as `toCodeDocument` requires a `MultiDocument`.
|
|
1538
642
|
*
|
|
1539
|
-
* @
|
|
1540
|
-
* @see {@link fromASTs}
|
|
1541
|
-
*
|
|
1542
|
-
* @category constructors
|
|
643
|
+
* @category transforming
|
|
1543
644
|
* @since 4.0.0
|
|
1544
645
|
*/
|
|
1545
|
-
export declare
|
|
646
|
+
export declare function toMultiDocument(document: Document): MultiDocument;
|
|
1546
647
|
/**
|
|
1547
|
-
*
|
|
648
|
+
* Compiles a live representation document to JSON Schema Draft 2020-12.
|
|
1548
649
|
*
|
|
1549
650
|
* **When to use**
|
|
1550
651
|
*
|
|
1551
|
-
* Use when you
|
|
1552
|
-
* `MultiDocument` with shared references.
|
|
652
|
+
* Use when you need JSON Schema output from a representation whose checks carry compiler annotations.
|
|
1553
653
|
*
|
|
1554
|
-
* **
|
|
654
|
+
* **Gotchas**
|
|
1555
655
|
*
|
|
1556
|
-
*
|
|
656
|
+
* Opaque declarations are represented by an unconstrained JSON Schema. Check callback results are used directly, and exceptions raised by a callback pass through unchanged.
|
|
1557
657
|
*
|
|
1558
|
-
* @see {@link
|
|
1559
|
-
* @see {@link fromAST}
|
|
658
|
+
* @see {@link toJsonSchemaMultiDocument} for multiple roots sharing definitions
|
|
1560
659
|
*
|
|
1561
|
-
* @category
|
|
660
|
+
* @category transforming
|
|
1562
661
|
* @since 4.0.0
|
|
1563
662
|
*/
|
|
1564
|
-
export declare
|
|
663
|
+
export declare function toJsonSchemaDocument(document: Document, options?: Schema.ToJsonSchemaOptions): JsonSchema.Document<"draft-2020-12">;
|
|
1565
664
|
/**
|
|
1566
|
-
*
|
|
665
|
+
* Compiles multiple live representations to a shared JSON Schema Draft 2020-12 document.
|
|
1567
666
|
*
|
|
1568
667
|
* **When to use**
|
|
1569
668
|
*
|
|
1570
|
-
* Use when
|
|
1571
|
-
* `Schema.decodeUnknownSync` or `Schema.encodeSync`.
|
|
1572
|
-
*
|
|
1573
|
-
* **Example** (Round-tripping a Document through JSON)
|
|
1574
|
-
*
|
|
1575
|
-
* ```ts
|
|
1576
|
-
* import { Schema, SchemaRepresentation } from "effect"
|
|
1577
|
-
*
|
|
1578
|
-
* const doc = SchemaRepresentation.fromAST(Schema.String.ast)
|
|
1579
|
-
* const json = Schema.encodeSync(SchemaRepresentation.DocumentFromJson)(doc)
|
|
1580
|
-
* const back = Schema.decodeUnknownSync(SchemaRepresentation.DocumentFromJson)(json)
|
|
1581
|
-
* ```
|
|
669
|
+
* Use when several representation roots must share the same JSON Schema definitions.
|
|
1582
670
|
*
|
|
1583
|
-
*
|
|
1584
|
-
* @see {@link MultiDocumentFromJson}
|
|
671
|
+
* **Gotchas**
|
|
1585
672
|
*
|
|
1586
|
-
*
|
|
1587
|
-
* @since 4.0.0
|
|
1588
|
-
*/
|
|
1589
|
-
export declare const DocumentFromJson: Schema.Codec<Document, Schema.Json>;
|
|
1590
|
-
/**
|
|
1591
|
-
* Schema for `MultiDocument` values encoded as JSON.
|
|
673
|
+
* Every definition is compiled, including definitions that are not reachable from a root.
|
|
1592
674
|
*
|
|
1593
|
-
* @see {@link
|
|
1594
|
-
* @see {@link DocumentFromJson}
|
|
675
|
+
* @see {@link toJsonSchemaDocument} for a single root
|
|
1595
676
|
*
|
|
1596
|
-
* @category
|
|
677
|
+
* @category transforming
|
|
1597
678
|
* @since 4.0.0
|
|
1598
679
|
*/
|
|
1599
|
-
export declare
|
|
680
|
+
export declare function toJsonSchemaMultiDocument(document: MultiDocument, options?: Schema.ToJsonSchemaOptions): JsonSchema.MultiDocument<"draft-2020-12">;
|
|
1600
681
|
/**
|
|
1601
|
-
*
|
|
1602
|
-
* representation.
|
|
682
|
+
* Generates TypeScript source for live schema representations and their definitions.
|
|
1603
683
|
*
|
|
1604
684
|
* **When to use**
|
|
1605
685
|
*
|
|
1606
|
-
* Use when
|
|
1607
|
-
* API expects a `MultiDocument`.
|
|
1608
|
-
*
|
|
1609
|
-
* @see {@link Document}
|
|
1610
|
-
* @see {@link MultiDocument}
|
|
1611
|
-
*
|
|
1612
|
-
* @category transforming
|
|
1613
|
-
* @since 4.0.0
|
|
1614
|
-
*/
|
|
1615
|
-
export declare function toMultiDocument(document: Document): MultiDocument;
|
|
1616
|
-
/**
|
|
1617
|
-
* A callback that handles {@link Declaration} nodes during reconstruction
|
|
1618
|
-
* ({@link toSchema}) or code generation ({@link toCodeDocument}).
|
|
1619
|
-
*
|
|
1620
|
-
* **Details**
|
|
686
|
+
* Use when custom declarations and checks provide `toCode` callbacks and must be emitted without a central handler registry.
|
|
1621
687
|
*
|
|
1622
|
-
*
|
|
1623
|
-
* default behavior, which uses `encodedSchema` for `toSchema` or the
|
|
1624
|
-
* `generation` annotation for `toCodeDocument`. `recur` processes child
|
|
1625
|
-
* representations recursively.
|
|
688
|
+
* **Gotchas**
|
|
1626
689
|
*
|
|
1627
|
-
*
|
|
1628
|
-
* @see {@link toSchemaDefaultReviver}
|
|
1629
|
-
* @see {@link toCodeDocument}
|
|
690
|
+
* Opaque declarations and leaf checks require `toCode` callbacks. Callback results are used directly, and exceptions raised by a callback pass through unchanged.
|
|
1630
691
|
*
|
|
1631
|
-
* @category
|
|
692
|
+
* @category transforming
|
|
1632
693
|
* @since 4.0.0
|
|
1633
694
|
*/
|
|
1634
|
-
export
|
|
695
|
+
export declare function toCodeDocument(document: MultiDocument): CodeDocument;
|
|
1635
696
|
/**
|
|
1636
|
-
*
|
|
1637
|
-
* types, including Option, Result, Redacted, Cause, Exit, ReadonlyMap, HashMap,
|
|
1638
|
-
* ReadonlySet, Date, Duration, URL, and RegExp.
|
|
697
|
+
* Projects a live single-root representation document and encodes it as JSON.
|
|
1639
698
|
*
|
|
1640
699
|
* **When to use**
|
|
1641
700
|
*
|
|
1642
|
-
* Use when you need
|
|
1643
|
-
* reconstruct runtime schemas for built-in Effect declarations.
|
|
701
|
+
* Use when you need a stable JSON value for storage or transport after calling `toRepresentation`.
|
|
1644
702
|
*
|
|
1645
|
-
* **
|
|
703
|
+
* **Gotchas**
|
|
1646
704
|
*
|
|
1647
|
-
*
|
|
1648
|
-
* fallback to `encodedSchema`.
|
|
705
|
+
* Generic annotations that are not JSON are omitted. Invalid persistence identities and unsupported structural values throw an `Error` containing their representation path.
|
|
1649
706
|
*
|
|
1650
|
-
* @see {@link
|
|
1651
|
-
* @see {@link
|
|
707
|
+
* @see {@link toRepresentation} for constructing the live document
|
|
708
|
+
* @see {@link toJsonMultiDocument} for documents with multiple roots
|
|
1652
709
|
*
|
|
1653
|
-
* @category
|
|
710
|
+
* @category encoding
|
|
1654
711
|
* @since 4.0.0
|
|
1655
712
|
*/
|
|
1656
|
-
export declare
|
|
713
|
+
export declare function toJson(document: Document): Schema.Json;
|
|
1657
714
|
/**
|
|
1658
|
-
*
|
|
715
|
+
* Projects a live multi-root representation document and encodes it as JSON.
|
|
1659
716
|
*
|
|
1660
717
|
* **When to use**
|
|
1661
718
|
*
|
|
1662
|
-
* Use when you
|
|
1663
|
-
* need a runtime Schema for decoding/encoding.
|
|
1664
|
-
*
|
|
1665
|
-
* **Details**
|
|
1666
|
-
*
|
|
1667
|
-
* Pass `options.reviver`, such as {@link toSchemaDefaultReviver}, to handle
|
|
1668
|
-
* {@link Declaration} nodes for types like `Date` and `Option`. Without a
|
|
1669
|
-
* reviver, declarations fall back to their `encodedSchema`. Circular references
|
|
1670
|
-
* are handled via lazy `Schema.suspend`.
|
|
719
|
+
* Use when you need one JSON value for multiple live roots that share a reference environment.
|
|
1671
720
|
*
|
|
1672
721
|
* **Gotchas**
|
|
1673
722
|
*
|
|
1674
|
-
*
|
|
1675
|
-
*
|
|
1676
|
-
* **Example** (Reconstructing a Schema)
|
|
1677
|
-
*
|
|
1678
|
-
* ```ts
|
|
1679
|
-
* import { Schema, SchemaRepresentation } from "effect"
|
|
723
|
+
* The root order and shared reference keys are preserved, while non-JSON generic annotations are omitted.
|
|
1680
724
|
*
|
|
1681
|
-
*
|
|
1682
|
-
*
|
|
1683
|
-
* )
|
|
725
|
+
* @see {@link toRepresentations} for constructing the live multi-document
|
|
726
|
+
* @see {@link toJson} for a single-root document
|
|
1684
727
|
*
|
|
1685
|
-
*
|
|
1686
|
-
* console.log(JSON.stringify(Schema.toJsonSchemaDocument(schema), null, 2))
|
|
1687
|
-
* ```
|
|
1688
|
-
*
|
|
1689
|
-
* @see {@link Document}
|
|
1690
|
-
* @see {@link Reviver}
|
|
1691
|
-
* @see {@link toSchemaDefaultReviver}
|
|
1692
|
-
*
|
|
1693
|
-
* @category Runtime Generation
|
|
728
|
+
* @category encoding
|
|
1694
729
|
* @since 4.0.0
|
|
1695
730
|
*/
|
|
1696
|
-
export declare function
|
|
1697
|
-
readonly reviver?: Reviver<Schema.Top> | undefined;
|
|
1698
|
-
}): S;
|
|
731
|
+
export declare function toJsonMultiDocument(document: MultiDocument): Schema.Json;
|
|
1699
732
|
/**
|
|
1700
|
-
*
|
|
733
|
+
* Decodes a persisted single-root representation document from JSON.
|
|
1701
734
|
*
|
|
1702
735
|
* **When to use**
|
|
1703
736
|
*
|
|
1704
|
-
* Use when
|
|
1705
|
-
* representation `Document`.
|
|
737
|
+
* Use when reading a representation document from storage or transport before inspecting it or passing it to `fromRepresentation`.
|
|
1706
738
|
*
|
|
1707
739
|
* **Gotchas**
|
|
1708
740
|
*
|
|
1709
|
-
*
|
|
1710
|
-
* semantics cannot be represented exactly in JSON Schema, and importing an
|
|
1711
|
-
* emitted JSON Schema may produce an equivalent approximation rather than the
|
|
1712
|
-
* original representation shape.
|
|
1713
|
-
*
|
|
1714
|
-
* **Example** (Generating JSON Schema)
|
|
741
|
+
* Invalid documents throw a schema decoding error. Decoding does not reconstruct runtime callbacks.
|
|
1715
742
|
*
|
|
1716
|
-
*
|
|
1717
|
-
*
|
|
743
|
+
* @see {@link toJson} for encoding a document
|
|
744
|
+
* @see {@link fromRepresentation} for reconstructing a runtime schema
|
|
745
|
+
* @see {@link fromJsonMultiDocument} for multiple roots sharing references
|
|
1718
746
|
*
|
|
1719
|
-
*
|
|
1720
|
-
* const jsonSchema = SchemaRepresentation.toJsonSchemaDocument(doc)
|
|
1721
|
-
* console.log(jsonSchema.schema.type)
|
|
1722
|
-
* // "string"
|
|
1723
|
-
* ```
|
|
1724
|
-
*
|
|
1725
|
-
* @see {@link Document}
|
|
1726
|
-
* @see {@link toJsonSchemaMultiDocument}
|
|
1727
|
-
* @see {@link fromJsonSchemaDocument}
|
|
1728
|
-
*
|
|
1729
|
-
* @category transforming
|
|
747
|
+
* @category decoding
|
|
1730
748
|
* @since 4.0.0
|
|
1731
749
|
*/
|
|
1732
|
-
export declare
|
|
750
|
+
export declare function fromJson(input: Schema.Json): Document;
|
|
1733
751
|
/**
|
|
1734
|
-
*
|
|
1735
|
-
* multi-document.
|
|
752
|
+
* Decodes a persisted multi-root representation document from JSON.
|
|
1736
753
|
*
|
|
1737
754
|
* **When to use**
|
|
1738
755
|
*
|
|
1739
|
-
* Use when
|
|
1740
|
-
* so shared definitions stay in multi-document JSON Schema form.
|
|
756
|
+
* Use when reading multiple representation roots that share references before inspecting them or passing them to `fromRepresentations`.
|
|
1741
757
|
*
|
|
1742
758
|
* **Gotchas**
|
|
1743
759
|
*
|
|
1744
|
-
*
|
|
1745
|
-
* semantics cannot be represented exactly in JSON Schema, and importing an
|
|
1746
|
-
* emitted JSON Schema may produce equivalent approximations rather than the
|
|
1747
|
-
* original representation shapes.
|
|
1748
|
-
*
|
|
1749
|
-
* @see {@link MultiDocument}
|
|
1750
|
-
* @see {@link toJsonSchemaDocument}
|
|
1751
|
-
* @see {@link fromJsonSchemaMultiDocument}
|
|
1752
|
-
*
|
|
1753
|
-
* @category transforming
|
|
1754
|
-
* @since 4.0.0
|
|
1755
|
-
*/
|
|
1756
|
-
export declare const toJsonSchemaMultiDocument: (document: MultiDocument, options?: Schema.ToJsonSchemaOptions) => JsonSchema.MultiDocument<"draft-2020-12">;
|
|
1757
|
-
/**
|
|
1758
|
-
* A pair of TypeScript source strings for a schema: `runtime` is the
|
|
1759
|
-
* executable Schema expression, `Type` is the corresponding TypeScript type.
|
|
1760
|
-
*
|
|
1761
|
-
* @see {@link makeCode}
|
|
1762
|
-
* @see {@link CodeDocument}
|
|
1763
|
-
*
|
|
1764
|
-
* @category Code Generation
|
|
1765
|
-
* @since 4.0.0
|
|
1766
|
-
*/
|
|
1767
|
-
export type Code = {
|
|
1768
|
-
readonly runtime: string;
|
|
1769
|
-
readonly Type: string;
|
|
1770
|
-
};
|
|
1771
|
-
/**
|
|
1772
|
-
* Constructs a {@link Code} value from a runtime expression string and a
|
|
1773
|
-
* TypeScript type string.
|
|
760
|
+
* Invalid documents throw a schema decoding error. Decoding does not reconstruct runtime callbacks.
|
|
1774
761
|
*
|
|
1775
|
-
* @see {@link
|
|
762
|
+
* @see {@link toJsonMultiDocument} for encoding a multi-document
|
|
763
|
+
* @see {@link fromRepresentations} for reconstructing runtime schemas
|
|
764
|
+
* @see {@link fromJson} for a single root
|
|
1776
765
|
*
|
|
1777
|
-
* @category
|
|
766
|
+
* @category decoding
|
|
1778
767
|
* @since 4.0.0
|
|
1779
768
|
*/
|
|
1780
|
-
export declare function
|
|
769
|
+
export declare function fromJsonMultiDocument(input: Schema.Json): MultiDocument;
|
|
1781
770
|
/**
|
|
1782
|
-
*
|
|
1783
|
-
* declaration, an enum declaration, or an import statement.
|
|
771
|
+
* Reconstructs a runtime schema from a representation document.
|
|
1784
772
|
*
|
|
1785
|
-
*
|
|
1786
|
-
* @see {@link toCodeDocument}
|
|
773
|
+
* **When to use**
|
|
1787
774
|
*
|
|
1788
|
-
*
|
|
1789
|
-
* @since 4.0.0
|
|
1790
|
-
*/
|
|
1791
|
-
export type Artifact = {
|
|
1792
|
-
readonly _tag: "Symbol";
|
|
1793
|
-
readonly identifier: string;
|
|
1794
|
-
readonly generation: Code;
|
|
1795
|
-
} | {
|
|
1796
|
-
readonly _tag: "Enum";
|
|
1797
|
-
readonly identifier: string;
|
|
1798
|
-
readonly generation: Code;
|
|
1799
|
-
} | {
|
|
1800
|
-
readonly _tag: "Import";
|
|
1801
|
-
readonly importDeclaration: string;
|
|
1802
|
-
};
|
|
1803
|
-
/**
|
|
1804
|
-
* The output of {@link toCodeDocument}: generated TypeScript code for one or
|
|
1805
|
-
* more schemas plus their shared references and auxiliary artifacts.
|
|
775
|
+
* Use when you have decoded or constructed a document whose declaration and check annotations may require revivers.
|
|
1806
776
|
*
|
|
1807
|
-
* **
|
|
777
|
+
* **Gotchas**
|
|
1808
778
|
*
|
|
1809
|
-
* `
|
|
1810
|
-
* `references.nonRecursives` contains topologically sorted non-recursive
|
|
1811
|
-
* definitions. `references.recursives` contains definitions involved in cycles.
|
|
1812
|
-
* `artifacts` contains symbols, enums, and import statements needed by the
|
|
1813
|
-
* code.
|
|
779
|
+
* Revivers are resolved locally by `id`; none are installed implicitly. Reviver results are used directly, and exceptions raised by a reviver pass through unchanged.
|
|
1814
780
|
*
|
|
1815
|
-
* @see {@link
|
|
1816
|
-
* @see {@link
|
|
1817
|
-
* @see {@link Artifact}
|
|
781
|
+
* @see {@link fromJson} for decoding a persisted document
|
|
782
|
+
* @see {@link fromRepresentations} for multiple roots sharing references
|
|
1818
783
|
*
|
|
1819
|
-
* @category
|
|
784
|
+
* @category transforming
|
|
1820
785
|
* @since 4.0.0
|
|
1821
786
|
*/
|
|
1822
|
-
export
|
|
1823
|
-
readonly
|
|
1824
|
-
|
|
1825
|
-
readonly nonRecursives: ReadonlyArray<{
|
|
1826
|
-
readonly $ref: string;
|
|
1827
|
-
readonly code: Code;
|
|
1828
|
-
}>;
|
|
1829
|
-
readonly recursives: {
|
|
1830
|
-
readonly [$ref: string]: Code;
|
|
1831
|
-
};
|
|
1832
|
-
};
|
|
1833
|
-
readonly artifacts: ReadonlyArray<Artifact>;
|
|
1834
|
-
};
|
|
787
|
+
export declare function fromRepresentation(document: Document, options: {
|
|
788
|
+
readonly revivers: ReadonlyArray<AnyReviver>;
|
|
789
|
+
}): Schema.Top;
|
|
1835
790
|
/**
|
|
1836
|
-
*
|
|
791
|
+
* Reconstructs multiple runtime schemas and their shared definitions from a representation multi-document.
|
|
1837
792
|
*
|
|
1838
793
|
* **When to use**
|
|
1839
794
|
*
|
|
1840
|
-
* Use when
|
|
1841
|
-
* schema representation `MultiDocument`.
|
|
795
|
+
* Use when every root and named definition must be rebuilt in one shared reference environment.
|
|
1842
796
|
*
|
|
1843
|
-
* **
|
|
1844
|
-
*
|
|
1845
|
-
* `options.reviver` can customize code generation for {@link Declaration}
|
|
1846
|
-
* nodes. Return `undefined` to fall back to the default logic, which uses
|
|
1847
|
-
* `generation` annotations or the encoded schema. References are
|
|
1848
|
-
* topologically sorted so non-recursive definitions are emitted before their
|
|
1849
|
-
* dependents. `$ref` keys are converted to sanitized JavaScript identifiers.
|
|
1850
|
-
*
|
|
1851
|
-
* **Example** (Generating TypeScript code)
|
|
1852
|
-
*
|
|
1853
|
-
* ```ts
|
|
1854
|
-
* import { Schema, SchemaRepresentation } from "effect"
|
|
1855
|
-
*
|
|
1856
|
-
* const Person = Schema.Struct({
|
|
1857
|
-
* name: Schema.String,
|
|
1858
|
-
* age: Schema.Int
|
|
1859
|
-
* })
|
|
797
|
+
* **Gotchas**
|
|
1860
798
|
*
|
|
1861
|
-
*
|
|
1862
|
-
* SchemaRepresentation.fromAST(Person.ast)
|
|
1863
|
-
* )
|
|
1864
|
-
* const codeDoc = SchemaRepresentation.toCodeDocument(multi)
|
|
1865
|
-
* console.log(codeDoc.codes[0].runtime)
|
|
1866
|
-
* // Schema.Struct({ ... })
|
|
1867
|
-
* ```
|
|
799
|
+
* Every definition is revived, including definitions not reachable from a root. Revivers are resolved locally by `id`; none are installed implicitly.
|
|
1868
800
|
*
|
|
1869
|
-
* @see {@link
|
|
1870
|
-
* @see {@link
|
|
1871
|
-
* @see {@link Reviver}
|
|
801
|
+
* @see {@link fromJsonMultiDocument} for decoding a persisted multi-document
|
|
802
|
+
* @see {@link fromRepresentation} for a single root
|
|
1872
803
|
*
|
|
1873
|
-
* @category
|
|
804
|
+
* @category transforming
|
|
1874
805
|
* @since 4.0.0
|
|
1875
806
|
*/
|
|
1876
|
-
export declare function
|
|
1877
|
-
|
|
1878
|
-
|
|
1879
|
-
*/
|
|
1880
|
-
readonly reviver?: Reviver<Code> | undefined;
|
|
1881
|
-
}): CodeDocument;
|
|
807
|
+
export declare function fromRepresentations(document: MultiDocument, options: {
|
|
808
|
+
readonly revivers: ReadonlyArray<AnyReviver>;
|
|
809
|
+
}): SchemaMultiDocument;
|
|
1882
810
|
/**
|
|
1883
|
-
*
|
|
811
|
+
* Imports a JSON Schema Draft 2020-12 document as a runtime schema.
|
|
1884
812
|
*
|
|
1885
813
|
* **When to use**
|
|
1886
814
|
*
|
|
1887
|
-
* Use when you need to
|
|
1888
|
-
* Effect schema representation system.
|
|
1889
|
-
*
|
|
1890
|
-
* **Details**
|
|
1891
|
-
*
|
|
1892
|
-
* `options.onEnter` is an optional hook called on each JSON Schema node before
|
|
1893
|
-
* processing, allowing pre-transformation.
|
|
815
|
+
* Use when you need to validate or transform values described by an external JSON Schema document.
|
|
1894
816
|
*
|
|
1895
817
|
* **Gotchas**
|
|
1896
818
|
*
|
|
1897
|
-
*
|
|
1898
|
-
* exactly to Effect schema representations, and importing a schema previously
|
|
1899
|
-
* emitted by `toJsonSchemaDocument` may produce an equivalent approximation
|
|
1900
|
-
* rather than the original representation shape.
|
|
819
|
+
* Import is best-effort. Built-in declarations and checks are reconstructed with importer-owned revivers. Callback results are used directly, and exceptions raised by a callback pass through unchanged.
|
|
1901
820
|
*
|
|
1902
|
-
*
|
|
1903
|
-
*
|
|
1904
|
-
*
|
|
1905
|
-
* @see {@link Document}
|
|
1906
|
-
* @see {@link toJsonSchemaDocument}
|
|
1907
|
-
* @see {@link fromJsonSchemaMultiDocument}
|
|
821
|
+
* @see {@link fromJsonSchemaMultiDocument} for multiple roots sharing definitions
|
|
822
|
+
* @see {@link toRepresentation} for converting the result to a representation document
|
|
1908
823
|
*
|
|
1909
824
|
* @category constructors
|
|
1910
825
|
* @since 4.0.0
|
|
1911
826
|
*/
|
|
1912
|
-
export declare function fromJsonSchemaDocument(document: JsonSchema.Document<"draft-2020-12">, options?:
|
|
1913
|
-
readonly onEnter?: ((js: JsonSchema.JsonSchema) => JsonSchema.JsonSchema) | undefined;
|
|
1914
|
-
}): Document;
|
|
827
|
+
export declare function fromJsonSchemaDocument(document: JsonSchema.Document<"draft-2020-12">, options?: FromJsonSchemaOptions): Schema.Top;
|
|
1915
828
|
/**
|
|
1916
|
-
*
|
|
1917
|
-
* {@link MultiDocument}.
|
|
829
|
+
* Imports multiple JSON Schema Draft 2020-12 roots as runtime schemas with shared definitions.
|
|
1918
830
|
*
|
|
1919
831
|
* **When to use**
|
|
1920
832
|
*
|
|
1921
|
-
* Use when
|
|
1922
|
-
* schemas share definitions.
|
|
1923
|
-
*
|
|
1924
|
-
* **Details**
|
|
1925
|
-
*
|
|
1926
|
-
* `options.onEnter` is an optional hook called on each JSON Schema node before
|
|
1927
|
-
* processing.
|
|
833
|
+
* Use when multiple imported roots must preserve shared definitions, aliases, and recursion.
|
|
1928
834
|
*
|
|
1929
835
|
* **Gotchas**
|
|
1930
836
|
*
|
|
1931
|
-
*
|
|
1932
|
-
* exactly to Effect schema representations, and importing schemas previously
|
|
1933
|
-
* emitted by `toJsonSchemaMultiDocument` may produce equivalent approximations
|
|
1934
|
-
* rather than the original representation shapes.
|
|
1935
|
-
*
|
|
1936
|
-
* This throws if a `$ref` cannot be resolved.
|
|
837
|
+
* Every definition is translated, including definitions that no root references. Callback results are used directly, and exceptions raised by a callback pass through unchanged.
|
|
1937
838
|
*
|
|
1938
|
-
* @see {@link
|
|
1939
|
-
* @see {@link
|
|
1940
|
-
* @see {@link fromJsonSchemaDocument}
|
|
839
|
+
* @see {@link fromJsonSchemaDocument} for a single root
|
|
840
|
+
* @see {@link fromSchemaMultiDocument} for converting the result to a representation document
|
|
1941
841
|
*
|
|
1942
842
|
* @category constructors
|
|
1943
843
|
* @since 4.0.0
|
|
1944
844
|
*/
|
|
1945
|
-
export declare function fromJsonSchemaMultiDocument(document: JsonSchema.MultiDocument<"draft-2020-12">, options?:
|
|
1946
|
-
|
|
1947
|
-
}): MultiDocument;
|
|
845
|
+
export declare function fromJsonSchemaMultiDocument(document: JsonSchema.MultiDocument<"draft-2020-12">, options?: FromJsonSchemaOptions): SchemaMultiDocument;
|
|
846
|
+
export {};
|
|
1948
847
|
//# sourceMappingURL=SchemaRepresentation.d.ts.map
|