effect 4.0.0-beta.84 → 4.0.0-beta.86
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/ChannelSchema.d.ts +8 -8
- package/dist/ChannelSchema.d.ts.map +1 -1
- package/dist/Config.d.ts +2 -2
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +10 -3
- package/dist/Config.js.map +1 -1
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +4 -3
- package/dist/Context.js.map +1 -1
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +4 -0
- package/dist/Cron.js.map +1 -1
- package/dist/Layer.js +4 -3
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +4 -3
- package/dist/LayerMap.js.map +1 -1
- package/dist/Random.d.ts +31 -0
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +32 -0
- package/dist/Random.js.map +1 -1
- package/dist/Schema.d.ts +793 -399
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +121 -75
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +8 -7
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +207 -157
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaParser.d.ts +24 -24
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +43 -39
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +300 -300
- package/dist/internal/effect.js +16 -17
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/matcher.js +0 -2
- package/dist/internal/matcher.js.map +1 -1
- package/dist/internal/schema/arbitrary.js +17 -1
- package/dist/internal/schema/arbitrary.js.map +1 -1
- package/dist/internal/schema/representation.js +1 -5
- package/dist/internal/schema/representation.js.map +1 -1
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/internal/stackTraceLimit.d.ts +2 -0
- package/dist/internal/stackTraceLimit.d.ts.map +1 -0
- package/dist/internal/stackTraceLimit.js +40 -0
- package/dist/internal/stackTraceLimit.js.map +1 -0
- package/dist/internal/tracer.d.ts.map +1 -1
- package/dist/internal/tracer.js +4 -3
- package/dist/internal/tracer.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +9 -9
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/testing/TestSchema.js +3 -2
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +2 -2
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +1 -1
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +4 -4
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +13 -6
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- 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.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +2 -2
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +2 -2
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +26 -26
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +4 -5
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/cli/Argument.d.ts +8 -7
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/Flag.d.ts +8 -7
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/Param.d.ts +1806 -168
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +0 -70
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +3 -4
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/internal/ansi.d.ts.map +1 -1
- package/dist/unstable/cli/internal/ansi.js +0 -22
- package/dist/unstable/cli/internal/ansi.js.map +1 -1
- package/dist/unstable/cli/internal/config.d.ts +48 -0
- package/dist/unstable/cli/internal/config.d.ts.map +1 -1
- package/dist/unstable/cli/internal/config.js +0 -6
- package/dist/unstable/cli/internal/config.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +3 -3
- package/dist/unstable/cluster/Reply.d.ts +2 -2
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
- package/dist/unstable/encoding/Msgpack.d.ts +6 -6
- package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
- package/dist/unstable/encoding/Msgpack.js.map +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts +8 -8
- package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.d.ts +1 -1
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +22 -22
- package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +15 -15
- package/dist/unstable/http/HttpBody.d.ts +1 -1
- package/dist/unstable/http/HttpBody.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.d.ts +1 -1
- package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +12 -3
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApi.d.ts +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +2 -2
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +32 -32
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js +4 -3
- package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +13 -6
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.js +0 -13
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/observability/internal/otlpProtobuf.js +0 -68
- package/dist/unstable/observability/internal/otlpProtobuf.js.map +1 -1
- package/dist/unstable/observability/internal/protobuf.js +0 -28
- package/dist/unstable/observability/internal/protobuf.js.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +2 -2
- package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
- package/dist/unstable/persistence/Persistable.d.ts +6 -6
- package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts +3 -3
- package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.js +1 -1
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/Persistence.d.ts +5 -5
- package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.d.ts +2 -2
- package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +1 -1
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +3 -4
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js +1 -1
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +25 -4
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcMessage.d.ts +7 -0
- package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMessage.js +20 -0
- package/dist/unstable/rpc/RpcMessage.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts +2 -2
- package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js +4 -3
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts +10 -3
- package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcWorker.d.ts +3 -3
- package/dist/unstable/rpc/RpcWorker.d.ts.map +1 -1
- package/dist/unstable/schema/Model.d.ts +2 -2
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +16 -2
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/sql/SqlConnection.d.ts +1 -0
- package/dist/unstable/sql/SqlConnection.d.ts.map +1 -1
- package/dist/unstable/sql/SqlConnection.js.map +1 -1
- package/dist/unstable/sql/SqlModel.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.d.ts +4 -4
- package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/sql/SqlSchema.d.ts +5 -5
- package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.d.ts +1 -0
- package/dist/unstable/sql/Statement.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.js +3 -0
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/workflow/Activity.d.ts +2 -2
- package/dist/unstable/workflow/Activity.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts +18 -18
- package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +3 -3
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +3 -3
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/ChannelSchema.ts +9 -9
- package/src/Config.ts +12 -5
- package/src/Context.ts +4 -5
- package/src/Cron.ts +4 -0
- package/src/Layer.ts +4 -4
- package/src/LayerMap.ts +4 -3
- package/src/Random.ts +42 -0
- package/src/Schema.ts +1038 -710
- package/src/SchemaAST.ts +239 -169
- package/src/SchemaParser.ts +85 -77
- package/src/internal/effect.ts +17 -33
- package/src/internal/matcher.ts +0 -5
- package/src/internal/schema/arbitrary.ts +24 -3
- package/src/internal/schema/representation.ts +1 -5
- package/src/internal/schema/schema.ts +1 -1
- package/src/internal/stackTraceLimit.ts +63 -0
- package/src/internal/tracer.ts +4 -3
- package/src/testing/TestSchema.ts +14 -13
- package/src/unstable/ai/AnthropicStructuredOutput.ts +2 -2
- package/src/unstable/ai/Chat.ts +1 -1
- package/src/unstable/ai/LanguageModel.ts +7 -7
- package/src/unstable/ai/McpSchema.ts +16 -14
- package/src/unstable/ai/McpServer.ts +7 -7
- package/src/unstable/ai/OpenAiStructuredOutput.ts +2 -2
- package/src/unstable/ai/Response.ts +9 -5
- package/src/unstable/ai/Tool.ts +53 -50
- package/src/unstable/cli/Argument.ts +9 -8
- package/src/unstable/cli/Flag.ts +9 -8
- package/src/unstable/cli/Param.ts +6 -146
- package/src/unstable/cli/Primitive.ts +5 -6
- package/src/unstable/cli/internal/ansi.ts +0 -33
- package/src/unstable/cli/internal/config.ts +0 -8
- package/src/unstable/cli/internal/parser.ts +2 -2
- package/src/unstable/cluster/MessageStorage.ts +1 -1
- package/src/unstable/cluster/Reply.ts +6 -2
- package/src/unstable/devtools/DevToolsSchema.ts +1 -1
- package/src/unstable/encoding/Msgpack.ts +9 -7
- package/src/unstable/encoding/Ndjson.ts +10 -10
- package/src/unstable/encoding/Sse.ts +1 -1
- package/src/unstable/eventlog/Event.ts +3 -3
- package/src/unstable/http/HttpBody.ts +1 -1
- package/src/unstable/http/HttpClientRequest.ts +1 -1
- package/src/unstable/http/HttpIncomingMessage.ts +1 -1
- package/src/unstable/http/HttpMiddleware.ts +12 -3
- package/src/unstable/httpapi/HttpApi.ts +1 -1
- package/src/unstable/httpapi/HttpApiBuilder.ts +9 -5
- package/src/unstable/httpapi/HttpApiClient.ts +10 -10
- package/src/unstable/httpapi/HttpApiEndpoint.ts +45 -33
- package/src/unstable/httpapi/HttpApiMiddleware.ts +6 -5
- package/src/unstable/httpapi/HttpApiSchema.ts +16 -43
- package/src/unstable/httpapi/OpenApi.ts +5 -5
- package/src/unstable/observability/internal/otlpProtobuf.ts +0 -75
- package/src/unstable/observability/internal/protobuf.ts +0 -42
- package/src/unstable/persistence/KeyValueStore.ts +2 -2
- package/src/unstable/persistence/Persistable.ts +7 -7
- package/src/unstable/persistence/PersistedQueue.ts +4 -4
- package/src/unstable/persistence/Persistence.ts +5 -5
- package/src/unstable/reactivity/AsyncResult.ts +4 -4
- package/src/unstable/reactivity/Atom.ts +1 -1
- package/src/unstable/reactivity/AtomHttpApi.ts +1 -1
- package/src/unstable/rpc/Rpc.ts +7 -8
- package/src/unstable/rpc/RpcClient.ts +26 -4
- package/src/unstable/rpc/RpcMessage.ts +19 -0
- package/src/unstable/rpc/RpcMiddleware.ts +6 -5
- package/src/unstable/rpc/RpcSchema.ts +12 -9
- package/src/unstable/rpc/RpcWorker.ts +3 -3
- package/src/unstable/schema/Model.ts +2 -2
- package/src/unstable/schema/VariantSchema.ts +19 -17
- package/src/unstable/sql/SqlConnection.ts +5 -0
- package/src/unstable/sql/SqlModel.ts +2 -2
- package/src/unstable/sql/SqlResolver.ts +6 -6
- package/src/unstable/sql/SqlSchema.ts +5 -5
- package/src/unstable/sql/Statement.ts +11 -0
- package/src/unstable/workflow/Activity.ts +6 -6
- package/src/unstable/workflow/DurableDeferred.ts +33 -33
- package/src/unstable/workflow/Workflow.ts +5 -5
- package/src/unstable/workflow/WorkflowEngine.ts +10 -10
- package/dist/internal/concurrency.d.ts +0 -2
- package/dist/internal/concurrency.d.ts.map +0 -1
- package/dist/internal/concurrency.js +0 -29
- package/dist/internal/concurrency.js.map +0 -1
- package/src/internal/concurrency.ts +0 -52
package/dist/Schema.d.ts
CHANGED
|
@@ -102,24 +102,18 @@ export interface MakeOptions {
|
|
|
102
102
|
}
|
|
103
103
|
/**
|
|
104
104
|
* The fully-parameterized base interface for all schemas. Exposes all 14 type
|
|
105
|
-
* parameters controlling type inference, mutability, optionality, services,
|
|
106
|
-
*
|
|
105
|
+
* parameters controlling type inference, mutability, optionality, services, and
|
|
106
|
+
* transformation behavior.
|
|
107
107
|
*
|
|
108
108
|
* **When to use**
|
|
109
109
|
*
|
|
110
|
-
* Use when you are writing advanced generic schema utilities or performing
|
|
111
|
-
* introspection.
|
|
112
|
-
* - In user code, prefer {@link Schema}, {@link Codec}, {@link Decoder}, or
|
|
113
|
-
* {@link Encoder} instead.
|
|
114
|
-
*
|
|
115
|
-
* @see {@link Top} — the existential "any schema" type (erased type params)
|
|
116
|
-
* @see {@link Schema} — tracks only the decoded Type
|
|
117
|
-
* @see {@link Codec} — tracks Type + Encoded
|
|
110
|
+
* Use when you are writing advanced generic schema utilities or performing
|
|
111
|
+
* schema introspection.
|
|
118
112
|
*
|
|
119
113
|
* @category models
|
|
120
114
|
* @since 4.0.0
|
|
121
115
|
*/
|
|
122
|
-
export interface Bottom<out T, out E, out RD, out RE, out Ast extends SchemaAST.AST, out Rebuild extends Top, out TypeMakeIn = T, out Iso = T, in out TypeParameters extends ReadonlyArray<
|
|
116
|
+
export interface Bottom<out T, out E, out RD, out RE, out Ast extends SchemaAST.AST, out Rebuild extends Top, out TypeMakeIn = T, out Iso = T, in out TypeParameters extends ReadonlyArray<Constraint> = readonly [], out TypeMake = TypeMakeIn, out TypeMutability extends Mutability = "readonly", out TypeOptionality extends Optionality = "required", out TypeConstructorDefault extends ConstructorDefault = "no-default", out EncodedMutability extends Mutability = "readonly", out EncodedOptionality extends Optionality = "required"> extends Pipeable.Pipeable {
|
|
123
117
|
readonly [TypeId]: typeof TypeId;
|
|
124
118
|
readonly "ast": Ast;
|
|
125
119
|
readonly "Rebuild": Rebuild;
|
|
@@ -202,13 +196,40 @@ export interface Bottom<out T, out E, out RD, out RE, out Ast extends SchemaAST.
|
|
|
202
196
|
*/
|
|
203
197
|
makeEffect(input: this["~type.make.in"], options?: MakeOptions): Effect.Effect<this["Type"], SchemaError>;
|
|
204
198
|
}
|
|
199
|
+
/**
|
|
200
|
+
* Lazy `Bottom` variant for schema implementations that compute their public
|
|
201
|
+
* views on demand.
|
|
202
|
+
*
|
|
203
|
+
* **When to use**
|
|
204
|
+
*
|
|
205
|
+
* Use as an implementation base for schema interfaces that must expose
|
|
206
|
+
* `Bottom` behavior without forcing TypeScript to eagerly evaluate expensive
|
|
207
|
+
* `Type`, `Encoded`, or service views.
|
|
208
|
+
*
|
|
209
|
+
* **Details**
|
|
210
|
+
*
|
|
211
|
+
* The laziness is purely type-level; runtime behavior is unchanged.
|
|
212
|
+
* `BottomLazy` keeps the structural operations inherited from `Bottom`, but
|
|
213
|
+
* erases the expensive schema views to `unknown`. Concrete schema interfaces can
|
|
214
|
+
* then redeclare the precise views they expose. This keeps wide schemas such as
|
|
215
|
+
* `Struct` and `Union` cheaper when generic code reads a single view, while
|
|
216
|
+
* preserving their exact public types.
|
|
217
|
+
*
|
|
218
|
+
* @see {@link Bottom} for the fully parameterized schema interface when every
|
|
219
|
+
* view must be supplied directly.
|
|
220
|
+
*
|
|
221
|
+
* @category utility types
|
|
222
|
+
* @since 4.0.0
|
|
223
|
+
*/
|
|
224
|
+
export interface BottomLazy<out Ast extends SchemaAST.AST, out Rebuild extends Top, in out TypeParameters extends ReadonlyArray<Constraint> = readonly [], out TypeMutability extends Mutability = "readonly", out TypeOptionality extends Optionality = "required", out TypeConstructorDefault extends ConstructorDefault = "no-default", out EncodedMutability extends Mutability = "readonly", out EncodedOptionality extends Optionality = "required"> extends Bottom<unknown, unknown, unknown, unknown, Ast, Rebuild, unknown, unknown, TypeParameters, unknown, TypeMutability, TypeOptionality, TypeConstructorDefault, EncodedMutability, EncodedOptionality> {
|
|
225
|
+
}
|
|
205
226
|
/**
|
|
206
227
|
* Type-level representation returned by {@link declareConstructor}.
|
|
207
228
|
*
|
|
208
229
|
* @category constructors
|
|
209
230
|
* @since 4.0.0
|
|
210
231
|
*/
|
|
211
|
-
export interface declareConstructor<T, E, TypeParameters extends ReadonlyArray<
|
|
232
|
+
export interface declareConstructor<T, E, TypeParameters extends ReadonlyArray<Constraint>, Iso = T> extends Bottom<T, E, TypeParameters[number]["DecodingServices"], TypeParameters[number]["EncodingServices"], SchemaAST.Declaration, declareConstructor<T, E, TypeParameters, Iso>, T, Iso, TypeParameters> {
|
|
212
233
|
}
|
|
213
234
|
/**
|
|
214
235
|
* Creates a schema for a **parametric** type (a generic container such as
|
|
@@ -243,7 +264,7 @@ export interface declareConstructor<T, E, TypeParameters extends ReadonlyArray<T
|
|
|
243
264
|
* const isBox = (u: unknown): u is Box<unknown> =>
|
|
244
265
|
* typeof u === "object" && u !== null && "value" in u
|
|
245
266
|
*
|
|
246
|
-
* const Box = <A extends Schema.
|
|
267
|
+
* const Box = <A extends Schema.Constraint>(item: A) =>
|
|
247
268
|
* Schema.declareConstructor<Box<A["Type"]>, Box<A["Encoded"]>>()(
|
|
248
269
|
* [item],
|
|
249
270
|
* ([itemCodec]) =>
|
|
@@ -264,7 +285,7 @@ export interface declareConstructor<T, E, TypeParameters extends ReadonlyArray<T
|
|
|
264
285
|
* @category constructors
|
|
265
286
|
* @since 4.0.0
|
|
266
287
|
*/
|
|
267
|
-
export declare function declareConstructor<T, E = T, Iso = T>(): <const TypeParameters extends ReadonlyArray<
|
|
288
|
+
export declare function declareConstructor<T, E = T, Iso = T>(): <const TypeParameters extends ReadonlyArray<Constraint>>(typeParameters: TypeParameters, run: (typeParameters: { readonly [K in keyof TypeParameters]: Codec<TypeParameters[K]["Type"], TypeParameters[K]["Encoded"]>; }) => (u: unknown, self: SchemaAST.Declaration, options: SchemaAST.ParseOptions) => Effect.Effect<T, SchemaIssue.Issue>, annotations?: Annotations.Declaration<T, TypeParameters>) => declareConstructor<T, E, TypeParameters, Iso>;
|
|
268
289
|
/**
|
|
269
290
|
* Type-level representation returned by {@link declare}.
|
|
270
291
|
*
|
|
@@ -439,8 +460,8 @@ export declare function annotateKey<S extends Top>(annotations: Annotations.Key<
|
|
|
439
460
|
* In user code prefer the narrower interfaces:
|
|
440
461
|
* - {@link Schema}`<T>` — when you only care about the decoded type
|
|
441
462
|
* - {@link Codec}`<T, E, RD, RE>` — when you need the encoded type and service requirements
|
|
442
|
-
* - {@link
|
|
443
|
-
* - {@link
|
|
463
|
+
* - {@link ConstraintDecoder}`<T, RD>` — for decode-only APIs
|
|
464
|
+
* - {@link ConstraintEncoder}`<E, RE>` — for encode-only APIs
|
|
444
465
|
*
|
|
445
466
|
* @category models
|
|
446
467
|
* @since 4.0.0
|
|
@@ -448,6 +469,121 @@ export declare function annotateKey<S extends Top>(annotations: Annotations.Key<
|
|
|
448
469
|
export interface Top extends Bottom<unknown, unknown, unknown, unknown, SchemaAST.AST, Top, unknown, unknown, any, // this is because TypeParameters is invariant
|
|
449
470
|
unknown, Mutability, Optionality, ConstructorDefault, Mutability, Optionality> {
|
|
450
471
|
}
|
|
472
|
+
/**
|
|
473
|
+
* Lightweight structural constraint for APIs that accept schema values but only
|
|
474
|
+
* read their data and type-level views.
|
|
475
|
+
*
|
|
476
|
+
* **When to use**
|
|
477
|
+
*
|
|
478
|
+
* Use when you need to constrain a generic value to be a schema, but the API
|
|
479
|
+
* only reads properties such as `ast`, `Type`, `Encoded`, service
|
|
480
|
+
* requirements, constructor input views, or modifier flags.
|
|
481
|
+
*
|
|
482
|
+
* **Details**
|
|
483
|
+
*
|
|
484
|
+
* `Constraint` keeps the schema type identifier and the property surface needed
|
|
485
|
+
* by schema constructors, while avoiding the full `Bottom` protocol. Use
|
|
486
|
+
* {@link Top} when an API calls schema methods such as `annotate`, `check`,
|
|
487
|
+
* `rebuild`, `make`, or `makeEffect`.
|
|
488
|
+
*
|
|
489
|
+
* @see {@link Top} for the complete schema protocol.
|
|
490
|
+
*
|
|
491
|
+
* @category models
|
|
492
|
+
* @since 4.0.0
|
|
493
|
+
*/
|
|
494
|
+
export interface Constraint {
|
|
495
|
+
readonly [TypeId]: typeof TypeId;
|
|
496
|
+
readonly "ast": SchemaAST.AST;
|
|
497
|
+
readonly "Type": unknown;
|
|
498
|
+
readonly "Encoded": unknown;
|
|
499
|
+
readonly "DecodingServices": unknown;
|
|
500
|
+
readonly "EncodingServices": unknown;
|
|
501
|
+
readonly "~type.parameters": any;
|
|
502
|
+
readonly "~type.make.in": unknown;
|
|
503
|
+
readonly "~type.make": unknown;
|
|
504
|
+
readonly "Iso": unknown;
|
|
505
|
+
readonly "~type.optionality": Optionality;
|
|
506
|
+
readonly "~type.mutability": Mutability;
|
|
507
|
+
readonly "~type.constructor.default": ConstructorDefault;
|
|
508
|
+
readonly "~encoded.optionality": Optionality;
|
|
509
|
+
readonly "~encoded.mutability": Mutability;
|
|
510
|
+
}
|
|
511
|
+
/**
|
|
512
|
+
* Lightweight structural constraint for APIs that need codec type views but do
|
|
513
|
+
* not need the full schema protocol.
|
|
514
|
+
*
|
|
515
|
+
* **When to use**
|
|
516
|
+
*
|
|
517
|
+
* Use when you need to preserve decoded type, encoded type, and service
|
|
518
|
+
* requirements for a schema value, but the API does not call schema methods
|
|
519
|
+
* such as `annotate`, `check`, `rebuild`, `make`, or `makeEffect`.
|
|
520
|
+
*
|
|
521
|
+
* @see {@link Constraint} for the generic lightweight schema constraint.
|
|
522
|
+
* @see {@link Codec} for the full schema protocol with codec type views.
|
|
523
|
+
*
|
|
524
|
+
* @category models
|
|
525
|
+
* @since 4.0.0
|
|
526
|
+
*/
|
|
527
|
+
export interface ConstraintCodec<out T, out E = T, out RD = never, out RE = never> extends Constraint {
|
|
528
|
+
readonly "Type": T;
|
|
529
|
+
readonly "Encoded": E;
|
|
530
|
+
readonly "DecodingServices": RD;
|
|
531
|
+
readonly "EncodingServices": RE;
|
|
532
|
+
}
|
|
533
|
+
/**
|
|
534
|
+
* Lightweight structural constraint for APIs that need decoder type views but
|
|
535
|
+
* do not need the full schema protocol.
|
|
536
|
+
*
|
|
537
|
+
* **When to use**
|
|
538
|
+
*
|
|
539
|
+
* Use when you need to preserve a schema's decoded type and decoding services,
|
|
540
|
+
* but the API does not constrain the encoded type, encoding services, or call
|
|
541
|
+
* schema methods such as `annotate`, `check`, `rebuild`, `make`, or
|
|
542
|
+
* `makeEffect`.
|
|
543
|
+
*
|
|
544
|
+
* @see {@link ConstraintCodec} for APIs that need both decoded and encoded codec views.
|
|
545
|
+
* @see {@link Codec} for the full schema protocol with codec type views.
|
|
546
|
+
*
|
|
547
|
+
* @category models
|
|
548
|
+
* @since 4.0.0
|
|
549
|
+
*/
|
|
550
|
+
export interface ConstraintDecoder<out T, out RD = never> extends ConstraintCodec<T, unknown, RD, unknown> {
|
|
551
|
+
}
|
|
552
|
+
/**
|
|
553
|
+
* Lightweight structural constraint for APIs that need encoder type views but
|
|
554
|
+
* do not need the full schema protocol.
|
|
555
|
+
*
|
|
556
|
+
* **When to use**
|
|
557
|
+
*
|
|
558
|
+
* Use when you need to preserve a schema's encoded type and encoding services,
|
|
559
|
+
* but the API does not constrain the decoded type, decoding services, or call
|
|
560
|
+
* schema methods such as `annotate`, `check`, `rebuild`, `make`, or
|
|
561
|
+
* `makeEffect`.
|
|
562
|
+
*
|
|
563
|
+
* @see {@link ConstraintCodec} for APIs that need both decoded and encoded codec views.
|
|
564
|
+
* @see {@link Codec} for the full schema protocol with codec type views.
|
|
565
|
+
*
|
|
566
|
+
* @category models
|
|
567
|
+
* @since 4.0.0
|
|
568
|
+
*/
|
|
569
|
+
export interface ConstraintEncoder<out E, out RE = never> extends ConstraintCodec<unknown, E, unknown, RE> {
|
|
570
|
+
}
|
|
571
|
+
/**
|
|
572
|
+
* Lightweight structural constraint for APIs that need schema views and the
|
|
573
|
+
* rebuilt schema type, but do not call the full schema protocol.
|
|
574
|
+
*
|
|
575
|
+
* **When to use**
|
|
576
|
+
*
|
|
577
|
+
* Use when an API needs to read `Rebuild` in addition to the schema views
|
|
578
|
+
* exposed by {@link Constraint}, but does not call methods such as `annotate`,
|
|
579
|
+
* `check`, `rebuild`, `make`, or `makeEffect`.
|
|
580
|
+
*
|
|
581
|
+
* @category models
|
|
582
|
+
* @since 4.0.0
|
|
583
|
+
*/
|
|
584
|
+
export interface ConstraintRebuildable extends Constraint {
|
|
585
|
+
readonly "Rebuild": Constraint;
|
|
586
|
+
}
|
|
451
587
|
/**
|
|
452
588
|
* Namespace of type-level helpers for {@link Schema}.
|
|
453
589
|
*
|
|
@@ -470,7 +606,9 @@ export declare namespace Schema {
|
|
|
470
606
|
* @category utility types
|
|
471
607
|
* @since 3.10.0
|
|
472
608
|
*/
|
|
473
|
-
type Type<S> = S extends
|
|
609
|
+
type Type<S> = S extends {
|
|
610
|
+
readonly "Type": infer T;
|
|
611
|
+
} ? T : never;
|
|
474
612
|
}
|
|
475
613
|
/**
|
|
476
614
|
* A typed view of a schema that tracks only the decoded (output) type `T`.
|
|
@@ -528,7 +666,9 @@ export declare namespace Codec {
|
|
|
528
666
|
* @category utility types
|
|
529
667
|
* @since 3.10.0
|
|
530
668
|
*/
|
|
531
|
-
type Encoded<S> = S extends
|
|
669
|
+
type Encoded<S> = S extends {
|
|
670
|
+
readonly "Encoded": infer E;
|
|
671
|
+
} ? E : never;
|
|
532
672
|
/**
|
|
533
673
|
* Extracts the Effect services required during *decoding* from a schema.
|
|
534
674
|
*
|
|
@@ -545,7 +685,9 @@ export declare namespace Codec {
|
|
|
545
685
|
* @category utility types
|
|
546
686
|
* @since 4.0.0
|
|
547
687
|
*/
|
|
548
|
-
type DecodingServices<S> = S extends
|
|
688
|
+
type DecodingServices<S> = S extends {
|
|
689
|
+
readonly "DecodingServices": infer R;
|
|
690
|
+
} ? R : never;
|
|
549
691
|
/**
|
|
550
692
|
* Extracts the Effect services required during *encoding* from a schema.
|
|
551
693
|
*
|
|
@@ -562,7 +704,9 @@ export declare namespace Codec {
|
|
|
562
704
|
* @category utility types
|
|
563
705
|
* @since 4.0.0
|
|
564
706
|
*/
|
|
565
|
-
type EncodingServices<S> = S extends
|
|
707
|
+
type EncodingServices<S> = S extends {
|
|
708
|
+
readonly "EncodingServices": infer R;
|
|
709
|
+
} ? R : never;
|
|
566
710
|
}
|
|
567
711
|
/**
|
|
568
712
|
* A schema that additionally supports optic (lens/prism) operations.
|
|
@@ -599,8 +743,8 @@ export interface Optic<out T, out Iso> extends Schema<T> {
|
|
|
599
743
|
* Most concrete schemas produced by this module implement `Codec`.
|
|
600
744
|
*
|
|
601
745
|
* For APIs that only need one direction, prefer the narrower views:
|
|
602
|
-
* - {@link
|
|
603
|
-
* - {@link
|
|
746
|
+
* - {@link ConstraintDecoder}`<T, RD>` — decode-only
|
|
747
|
+
* - {@link ConstraintEncoder}`<E, RE>` — encode-only
|
|
604
748
|
* - {@link Schema}`<T>` — type-only (no encoded representation)
|
|
605
749
|
*
|
|
606
750
|
* **Example** (Accepting a codec that decodes to `number` from `string`)
|
|
@@ -627,58 +771,6 @@ export interface Codec<out T, out E = T, out RD = never, out RE = never> extends
|
|
|
627
771
|
readonly "EncodingServices": RE;
|
|
628
772
|
readonly "Rebuild": Codec<T, E, RD, RE>;
|
|
629
773
|
}
|
|
630
|
-
/**
|
|
631
|
-
* A {@link Codec} view for APIs that only *decode* (parse/validate) values.
|
|
632
|
-
*
|
|
633
|
-
* **Details**
|
|
634
|
-
*
|
|
635
|
-
* Use `Decoder<T, RD>` to accept "any schema that can decode to `T`" without
|
|
636
|
-
* constraining or depending on the encoded representation (`Encoded` is
|
|
637
|
-
* `unknown`) or encoding services.
|
|
638
|
-
*
|
|
639
|
-
* **Example** (Accepting schemas that only need to decode)
|
|
640
|
-
*
|
|
641
|
-
* ```ts
|
|
642
|
-
* import { Schema } from "effect"
|
|
643
|
-
*
|
|
644
|
-
* declare function validate<T>(decoder: Schema.Decoder<T>): (input: unknown) => T
|
|
645
|
-
*
|
|
646
|
-
* validate(Schema.String) // ok
|
|
647
|
-
* validate(Schema.NumberFromString) // ok
|
|
648
|
-
* ```
|
|
649
|
-
*
|
|
650
|
-
* @category models
|
|
651
|
-
* @since 4.0.0
|
|
652
|
-
*/
|
|
653
|
-
export interface Decoder<out T, out RD = never> extends Codec<T, unknown, RD, unknown> {
|
|
654
|
-
readonly "Rebuild": Decoder<T, RD>;
|
|
655
|
-
}
|
|
656
|
-
/**
|
|
657
|
-
* A {@link Codec} view for APIs that only *encode* values.
|
|
658
|
-
*
|
|
659
|
-
* **Details**
|
|
660
|
-
*
|
|
661
|
-
* Use `Encoder<E, RE>` to accept "any schema that can encode to `E`" without
|
|
662
|
-
* constraining or depending on the decoded `Type` (`Type` is `unknown`) or
|
|
663
|
-
* decoding services.
|
|
664
|
-
*
|
|
665
|
-
* **Example** (Accepting schemas that only need to encode)
|
|
666
|
-
*
|
|
667
|
-
* ```ts
|
|
668
|
-
* import { Schema } from "effect"
|
|
669
|
-
*
|
|
670
|
-
* declare function serialize<E>(encoder: Schema.Encoder<E>): (value: unknown) => E
|
|
671
|
-
*
|
|
672
|
-
* serialize(Schema.String) // ok — encodes to string
|
|
673
|
-
* serialize(Schema.NumberFromString) // ok — encodes number to string
|
|
674
|
-
* ```
|
|
675
|
-
*
|
|
676
|
-
* @category models
|
|
677
|
-
* @since 4.0.0
|
|
678
|
-
*/
|
|
679
|
-
export interface Encoder<out E, out RE = never> extends Codec<unknown, E, unknown, RE> {
|
|
680
|
-
readonly "Rebuild": Encoder<E, RE>;
|
|
681
|
-
}
|
|
682
774
|
/**
|
|
683
775
|
* Returns a codec widened to the full {@link Codec} interface, prompting
|
|
684
776
|
* TypeScript to infer all four type parameters (`T`, `E`, `RD`, `RE`).
|
|
@@ -822,7 +914,7 @@ export declare function isSchemaError(u: unknown): u is SchemaError;
|
|
|
822
914
|
* @category Standard Schema
|
|
823
915
|
* @since 4.0.0
|
|
824
916
|
*/
|
|
825
|
-
export declare function toStandardSchemaV1<S extends
|
|
917
|
+
export declare function toStandardSchemaV1<S extends ConstraintDecoder<unknown>>(self: S, options?: {
|
|
826
918
|
readonly leafHook?: SchemaIssue.LeafHook | undefined;
|
|
827
919
|
readonly checkHook?: SchemaIssue.CheckHook | undefined;
|
|
828
920
|
readonly parseOptions?: SchemaAST.ParseOptions | undefined;
|
|
@@ -837,7 +929,7 @@ export declare function toStandardSchemaV1<S extends Decoder<unknown>>(self: S,
|
|
|
837
929
|
* @category Standard Schema
|
|
838
930
|
* @since 4.0.0
|
|
839
931
|
*/
|
|
840
|
-
export declare function toStandardJSONSchemaV1<S extends
|
|
932
|
+
export declare function toStandardJSONSchemaV1<S extends Constraint>(self: S): StandardJSONSchemaV1<S["Encoded"], S["Type"]> & S;
|
|
841
933
|
/**
|
|
842
934
|
* Creates a type guard function that checks if a value conforms to a given
|
|
843
935
|
* schema.
|
|
@@ -919,7 +1011,7 @@ export declare const is: typeof SchemaParser.is;
|
|
|
919
1011
|
* @category guards
|
|
920
1012
|
* @since 4.0.0
|
|
921
1013
|
*/
|
|
922
|
-
export declare const asserts: <S extends
|
|
1014
|
+
export declare const asserts: <S extends Constraint, I>(schema: S, input: I) => asserts input is I & S["Type"];
|
|
923
1015
|
/**
|
|
924
1016
|
* Decodes an `unknown` input against a schema, returning an `Effect` that
|
|
925
1017
|
* succeeds with the decoded value or fails with a {@link SchemaError}.
|
|
@@ -941,7 +1033,7 @@ export declare const asserts: <S extends Top, I>(schema: S, input: I) => asserts
|
|
|
941
1033
|
* @category decoding
|
|
942
1034
|
* @since 4.0.0
|
|
943
1035
|
*/
|
|
944
|
-
export declare function decodeUnknownEffect<S extends
|
|
1036
|
+
export declare function decodeUnknownEffect<S extends Constraint>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Effect.Effect<S["Type"], SchemaError, S["DecodingServices"]>;
|
|
945
1037
|
/**
|
|
946
1038
|
* Decodes a typed input (the schema's `Encoded` type) against a schema,
|
|
947
1039
|
* returning an `Effect` that succeeds with the decoded value or fails with a
|
|
@@ -963,7 +1055,7 @@ export declare function decodeUnknownEffect<S extends Top>(schema: S, options?:
|
|
|
963
1055
|
* @category decoding
|
|
964
1056
|
* @since 4.0.0
|
|
965
1057
|
*/
|
|
966
|
-
export declare const decodeEffect: <S extends
|
|
1058
|
+
export declare const decodeEffect: <S extends Constraint>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Encoded"], options?: SchemaAST.ParseOptions) => Effect.Effect<S["Type"], SchemaError, S["DecodingServices"]>;
|
|
967
1059
|
/**
|
|
968
1060
|
* Decodes an `unknown` input against a schema synchronously, returning an
|
|
969
1061
|
* `Exit` that is either a `Success` with the decoded value or a `Failure`.
|
|
@@ -994,7 +1086,7 @@ export declare const decodeEffect: <S extends Top>(schema: S, options?: SchemaAS
|
|
|
994
1086
|
* @category decoding
|
|
995
1087
|
* @since 4.0.0
|
|
996
1088
|
*/
|
|
997
|
-
export declare function decodeUnknownExit<S extends
|
|
1089
|
+
export declare function decodeUnknownExit<S extends ConstraintDecoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Exit_.Exit<S["Type"], SchemaError>;
|
|
998
1090
|
/**
|
|
999
1091
|
* Decodes a typed input (the schema's `Encoded` type) against a schema
|
|
1000
1092
|
* synchronously, returning an `Exit` that is either a `Success` with the decoded
|
|
@@ -1025,7 +1117,7 @@ export declare function decodeUnknownExit<S extends Decoder<unknown>>(schema: S,
|
|
|
1025
1117
|
* @category decoding
|
|
1026
1118
|
* @since 4.0.0
|
|
1027
1119
|
*/
|
|
1028
|
-
export declare const decodeExit: <S extends
|
|
1120
|
+
export declare const decodeExit: <S extends ConstraintDecoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Encoded"], options?: SchemaAST.ParseOptions) => Exit_.Exit<S["Type"], SchemaError>;
|
|
1029
1121
|
/**
|
|
1030
1122
|
* Decodes an `unknown` input against a schema, returning an `Option` that is
|
|
1031
1123
|
* `Some` with the decoded value on success or `None` for schema mismatches.
|
|
@@ -1052,7 +1144,7 @@ export declare const decodeExit: <S extends Decoder<unknown>>(schema: S, options
|
|
|
1052
1144
|
* @category decoding
|
|
1053
1145
|
* @since 3.10.0
|
|
1054
1146
|
*/
|
|
1055
|
-
export declare const decodeUnknownOption: <S extends
|
|
1147
|
+
export declare const decodeUnknownOption: <S extends ConstraintDecoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: unknown, options?: SchemaAST.ParseOptions) => Option_.Option<S["Type"]>;
|
|
1056
1148
|
/**
|
|
1057
1149
|
* Decodes a typed input (the schema's `Encoded` type) against a schema,
|
|
1058
1150
|
* returning an `Option` that is `Some` with the decoded value on success or
|
|
@@ -1078,7 +1170,7 @@ export declare const decodeUnknownOption: <S extends Decoder<unknown>>(schema: S
|
|
|
1078
1170
|
* @category decoding
|
|
1079
1171
|
* @since 3.10.0
|
|
1080
1172
|
*/
|
|
1081
|
-
export declare const decodeOption: <S extends
|
|
1173
|
+
export declare const decodeOption: <S extends ConstraintDecoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Encoded"], options?: SchemaAST.ParseOptions) => Option_.Option<S["Type"]>;
|
|
1082
1174
|
/**
|
|
1083
1175
|
* Decodes an `unknown` input against a schema, returning a `Result` that
|
|
1084
1176
|
* succeeds with the decoded value or fails with a {@link SchemaError} for schema
|
|
@@ -1108,7 +1200,7 @@ export declare const decodeOption: <S extends Decoder<unknown>>(schema: S, optio
|
|
|
1108
1200
|
* @category decoding
|
|
1109
1201
|
* @since 4.0.0
|
|
1110
1202
|
*/
|
|
1111
|
-
export declare function decodeUnknownResult<S extends
|
|
1203
|
+
export declare function decodeUnknownResult<S extends ConstraintDecoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Result_.Result<S["Type"], SchemaError>;
|
|
1112
1204
|
/**
|
|
1113
1205
|
* Decodes a typed input (the schema's `Encoded` type) against a schema,
|
|
1114
1206
|
* returning a `Result` that succeeds with the decoded value or fails with a
|
|
@@ -1137,7 +1229,7 @@ export declare function decodeUnknownResult<S extends Decoder<unknown>>(schema:
|
|
|
1137
1229
|
* @category decoding
|
|
1138
1230
|
* @since 4.0.0
|
|
1139
1231
|
*/
|
|
1140
|
-
export declare const decodeResult: <S extends
|
|
1232
|
+
export declare const decodeResult: <S extends ConstraintDecoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Encoded"], options?: SchemaAST.ParseOptions) => Result_.Result<S["Type"], SchemaError>;
|
|
1141
1233
|
/**
|
|
1142
1234
|
* Decodes an `unknown` input against a schema, returning a `Promise` that
|
|
1143
1235
|
* resolves with the decoded value or rejects with a {@link SchemaError} for
|
|
@@ -1165,7 +1257,7 @@ export declare const decodeResult: <S extends Decoder<unknown>>(schema: S, optio
|
|
|
1165
1257
|
* @category decoding
|
|
1166
1258
|
* @since 3.10.0
|
|
1167
1259
|
*/
|
|
1168
|
-
export declare function decodeUnknownPromise<S extends
|
|
1260
|
+
export declare function decodeUnknownPromise<S extends ConstraintDecoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Promise<S["Type"]>;
|
|
1169
1261
|
/**
|
|
1170
1262
|
* Decodes a typed input (the schema's `Encoded` type) against a schema,
|
|
1171
1263
|
* returning a `Promise` that resolves with the decoded value or rejects with a
|
|
@@ -1193,7 +1285,7 @@ export declare function decodeUnknownPromise<S extends Decoder<unknown>>(schema:
|
|
|
1193
1285
|
* @category decoding
|
|
1194
1286
|
* @since 3.10.0
|
|
1195
1287
|
*/
|
|
1196
|
-
export declare const decodePromise: <S extends
|
|
1288
|
+
export declare const decodePromise: <S extends ConstraintDecoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Encoded"], options?: SchemaAST.ParseOptions) => Promise<S["Type"]>;
|
|
1197
1289
|
/**
|
|
1198
1290
|
* Decodes an `unknown` input against a schema synchronously, returning the
|
|
1199
1291
|
* decoded value or throwing a {@link SchemaError} for schema mismatches.
|
|
@@ -1238,7 +1330,7 @@ export declare const decodePromise: <S extends Decoder<unknown>>(schema: S, opti
|
|
|
1238
1330
|
* @category decoding
|
|
1239
1331
|
* @since 4.0.0
|
|
1240
1332
|
*/
|
|
1241
|
-
export declare function decodeUnknownSync<S extends
|
|
1333
|
+
export declare function decodeUnknownSync<S extends ConstraintDecoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => S["Type"];
|
|
1242
1334
|
/**
|
|
1243
1335
|
* Decodes a typed input (the schema's `Encoded` type) against a schema
|
|
1244
1336
|
* synchronously, returning the decoded value or throwing a {@link SchemaError}
|
|
@@ -1265,7 +1357,7 @@ export declare function decodeUnknownSync<S extends Decoder<unknown>>(schema: S,
|
|
|
1265
1357
|
* @category decoding
|
|
1266
1358
|
* @since 4.0.0
|
|
1267
1359
|
*/
|
|
1268
|
-
export declare const decodeSync: <S extends
|
|
1360
|
+
export declare const decodeSync: <S extends ConstraintDecoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Encoded"], options?: SchemaAST.ParseOptions) => S["Type"];
|
|
1269
1361
|
/**
|
|
1270
1362
|
* Encodes an `unknown` input against a schema, returning an `Effect` that
|
|
1271
1363
|
* succeeds with the encoded value or fails with a {@link SchemaError}.
|
|
@@ -1298,7 +1390,7 @@ export declare const decodeSync: <S extends Decoder<unknown>>(schema: S, options
|
|
|
1298
1390
|
* @category encoding
|
|
1299
1391
|
* @since 4.0.0
|
|
1300
1392
|
*/
|
|
1301
|
-
export declare function encodeUnknownEffect<S extends
|
|
1393
|
+
export declare function encodeUnknownEffect<S extends Constraint>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Effect.Effect<S["Encoded"], SchemaError, S["EncodingServices"]>;
|
|
1302
1394
|
/**
|
|
1303
1395
|
* Encodes a typed input (the schema's `Type`) against a schema, returning an
|
|
1304
1396
|
* `Effect` that succeeds with the encoded value or fails with a
|
|
@@ -1320,7 +1412,7 @@ export declare function encodeUnknownEffect<S extends Top>(schema: S, options?:
|
|
|
1320
1412
|
* @category encoding
|
|
1321
1413
|
* @since 4.0.0
|
|
1322
1414
|
*/
|
|
1323
|
-
export declare const encodeEffect: <S extends
|
|
1415
|
+
export declare const encodeEffect: <S extends Constraint>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Type"], options?: SchemaAST.ParseOptions) => Effect.Effect<S["Encoded"], SchemaError, S["EncodingServices"]>;
|
|
1324
1416
|
/**
|
|
1325
1417
|
* Encodes an `unknown` input against a schema synchronously, returning an
|
|
1326
1418
|
* `Exit` that is either a `Success` with the encoded value or a `Failure`.
|
|
@@ -1350,7 +1442,7 @@ export declare const encodeEffect: <S extends Top>(schema: S, options?: SchemaAS
|
|
|
1350
1442
|
* @category encoding
|
|
1351
1443
|
* @since 4.0.0
|
|
1352
1444
|
*/
|
|
1353
|
-
export declare function encodeUnknownExit<S extends
|
|
1445
|
+
export declare function encodeUnknownExit<S extends ConstraintEncoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Exit_.Exit<S["Encoded"], SchemaError>;
|
|
1354
1446
|
/**
|
|
1355
1447
|
* Encodes a typed input (the schema's `Type`) against a schema synchronously,
|
|
1356
1448
|
* returning an `Exit` that is either a `Success` with the encoded value or a
|
|
@@ -1381,7 +1473,7 @@ export declare function encodeUnknownExit<S extends Encoder<unknown>>(schema: S,
|
|
|
1381
1473
|
* @category encoding
|
|
1382
1474
|
* @since 4.0.0
|
|
1383
1475
|
*/
|
|
1384
|
-
export declare const encodeExit: <S extends
|
|
1476
|
+
export declare const encodeExit: <S extends ConstraintEncoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Type"], options?: SchemaAST.ParseOptions) => Exit_.Exit<S["Encoded"], SchemaError>;
|
|
1385
1477
|
/**
|
|
1386
1478
|
* Encodes an `unknown` input against a schema, returning an `Option` that is
|
|
1387
1479
|
* `Some` with the encoded value on success or `None` for schema mismatches.
|
|
@@ -1408,7 +1500,7 @@ export declare const encodeExit: <S extends Encoder<unknown>>(schema: S, options
|
|
|
1408
1500
|
* @category encoding
|
|
1409
1501
|
* @since 3.10.0
|
|
1410
1502
|
*/
|
|
1411
|
-
export declare const encodeUnknownOption: <S extends
|
|
1503
|
+
export declare const encodeUnknownOption: <S extends ConstraintEncoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: unknown, options?: SchemaAST.ParseOptions) => Option_.Option<S["Encoded"]>;
|
|
1412
1504
|
/**
|
|
1413
1505
|
* Encodes a typed input (the schema's `Type`) against a schema, returning an
|
|
1414
1506
|
* `Option` that is `Some` with the encoded value on success or `None` for schema
|
|
@@ -1434,7 +1526,7 @@ export declare const encodeUnknownOption: <S extends Encoder<unknown>>(schema: S
|
|
|
1434
1526
|
* @category encoding
|
|
1435
1527
|
* @since 3.10.0
|
|
1436
1528
|
*/
|
|
1437
|
-
export declare const encodeOption: <S extends
|
|
1529
|
+
export declare const encodeOption: <S extends ConstraintEncoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Type"], options?: SchemaAST.ParseOptions) => Option_.Option<S["Encoded"]>;
|
|
1438
1530
|
/**
|
|
1439
1531
|
* Encodes an `unknown` input against a schema, returning a `Result` that
|
|
1440
1532
|
* succeeds with the encoded value or fails with a {@link SchemaError} for schema
|
|
@@ -1463,7 +1555,7 @@ export declare const encodeOption: <S extends Encoder<unknown>>(schema: S, optio
|
|
|
1463
1555
|
* @category encoding
|
|
1464
1556
|
* @since 4.0.0
|
|
1465
1557
|
*/
|
|
1466
|
-
export declare function encodeUnknownResult<S extends
|
|
1558
|
+
export declare function encodeUnknownResult<S extends ConstraintEncoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Result_.Result<S["Encoded"], SchemaError>;
|
|
1467
1559
|
/**
|
|
1468
1560
|
* Encodes a typed input (the schema's `Type`) against a schema, returning a
|
|
1469
1561
|
* `Result` that succeeds with the encoded value or fails with a
|
|
@@ -1492,7 +1584,7 @@ export declare function encodeUnknownResult<S extends Encoder<unknown>>(schema:
|
|
|
1492
1584
|
* @category encoding
|
|
1493
1585
|
* @since 4.0.0
|
|
1494
1586
|
*/
|
|
1495
|
-
export declare const encodeResult: <S extends
|
|
1587
|
+
export declare const encodeResult: <S extends ConstraintEncoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Type"], options?: SchemaAST.ParseOptions) => Result_.Result<S["Encoded"], SchemaError>;
|
|
1496
1588
|
/**
|
|
1497
1589
|
* Encodes an `unknown` input against a schema, returning a `Promise` that
|
|
1498
1590
|
* resolves with the encoded value or rejects with a {@link SchemaError} for
|
|
@@ -1519,7 +1611,7 @@ export declare const encodeResult: <S extends Encoder<unknown>>(schema: S, optio
|
|
|
1519
1611
|
* @category encoding
|
|
1520
1612
|
* @since 3.10.0
|
|
1521
1613
|
*/
|
|
1522
|
-
export declare function encodeUnknownPromise<S extends
|
|
1614
|
+
export declare function encodeUnknownPromise<S extends ConstraintEncoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => Promise<S["Encoded"]>;
|
|
1523
1615
|
/**
|
|
1524
1616
|
* Encodes a typed input (the schema's `Type`) against a schema, returning a
|
|
1525
1617
|
* `Promise` that resolves with the encoded value or rejects with a
|
|
@@ -1547,7 +1639,7 @@ export declare function encodeUnknownPromise<S extends Encoder<unknown>>(schema:
|
|
|
1547
1639
|
* @category encoding
|
|
1548
1640
|
* @since 3.10.0
|
|
1549
1641
|
*/
|
|
1550
|
-
export declare const encodePromise: <S extends
|
|
1642
|
+
export declare const encodePromise: <S extends ConstraintEncoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Type"], options?: SchemaAST.ParseOptions) => Promise<S["Encoded"]>;
|
|
1551
1643
|
/**
|
|
1552
1644
|
* Encodes an `unknown` input against a schema synchronously, throwing a
|
|
1553
1645
|
* {@link SchemaError} for schema mismatches.
|
|
@@ -1574,7 +1666,7 @@ export declare const encodePromise: <S extends Encoder<unknown>>(schema: S, opti
|
|
|
1574
1666
|
* @category encoding
|
|
1575
1667
|
* @since 4.0.0
|
|
1576
1668
|
*/
|
|
1577
|
-
export declare function encodeUnknownSync<S extends
|
|
1669
|
+
export declare function encodeUnknownSync<S extends ConstraintEncoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions): (input: unknown, options?: SchemaAST.ParseOptions) => S["Encoded"];
|
|
1578
1670
|
/**
|
|
1579
1671
|
* Encodes a typed input (the schema's `Type`) against a schema synchronously,
|
|
1580
1672
|
* throwing a {@link SchemaError} for schema mismatches.
|
|
@@ -1599,7 +1691,7 @@ export declare function encodeUnknownSync<S extends Encoder<unknown>>(schema: S,
|
|
|
1599
1691
|
* @category encoding
|
|
1600
1692
|
* @since 4.0.0
|
|
1601
1693
|
*/
|
|
1602
|
-
export declare const encodeSync: <S extends
|
|
1694
|
+
export declare const encodeSync: <S extends ConstraintEncoder<unknown>>(schema: S, options?: SchemaAST.ParseOptions) => (input: S["Type"], options?: SchemaAST.ParseOptions) => S["Encoded"];
|
|
1603
1695
|
/**
|
|
1604
1696
|
* Creates a schema from an AST (Abstract Syntax Tree) node.
|
|
1605
1697
|
*
|
|
@@ -1617,7 +1709,7 @@ export declare const encodeSync: <S extends Encoder<unknown>>(schema: S, options
|
|
|
1617
1709
|
* @category constructors
|
|
1618
1710
|
* @since 3.10.0
|
|
1619
1711
|
*/
|
|
1620
|
-
export declare const make: <S extends
|
|
1712
|
+
export declare const make: <S extends Constraint>(ast: S["ast"], options?: object) => S;
|
|
1621
1713
|
/**
|
|
1622
1714
|
* Transforms a schema into a class that can be extended with `extends`. The
|
|
1623
1715
|
* resulting class inherits the full schema API (e.g. `annotate`) and can define
|
|
@@ -1655,12 +1747,19 @@ export declare function isSchema(u: unknown): u is Top;
|
|
|
1655
1747
|
* @category models
|
|
1656
1748
|
* @since 4.0.0
|
|
1657
1749
|
*/
|
|
1658
|
-
export interface optionalKey<S extends
|
|
1750
|
+
export interface optionalKey<S extends Constraint> extends BottomLazy<S["ast"], optionalKey<S>, S["~type.parameters"], S["~type.mutability"], "optional", S["~type.constructor.default"], S["~encoded.mutability"], "optional"> {
|
|
1751
|
+
readonly "Type": S["Type"];
|
|
1752
|
+
readonly "Encoded": S["Encoded"];
|
|
1753
|
+
readonly "DecodingServices": S["DecodingServices"];
|
|
1754
|
+
readonly "EncodingServices": S["EncodingServices"];
|
|
1755
|
+
readonly "~type.make.in": S["~type.make.in"];
|
|
1756
|
+
readonly "~type.make": S["~type.make"];
|
|
1757
|
+
readonly "Iso": S["Iso"];
|
|
1659
1758
|
readonly schema: S;
|
|
1660
1759
|
}
|
|
1661
1760
|
interface optionalKeyLambda extends Lambda {
|
|
1662
|
-
<S extends
|
|
1663
|
-
readonly "~lambda.out": this["~lambda.in"] extends
|
|
1761
|
+
<S extends Constraint>(self: S): optionalKey<S>;
|
|
1762
|
+
readonly "~lambda.out": this["~lambda.in"] extends Constraint ? optionalKey<this["~lambda.in"]> : never;
|
|
1664
1763
|
}
|
|
1665
1764
|
/**
|
|
1666
1765
|
* Creates an exact optional key schema for struct fields. Unlike `optional`,
|
|
@@ -1686,8 +1785,8 @@ interface optionalKeyLambda extends Lambda {
|
|
|
1686
1785
|
*/
|
|
1687
1786
|
export declare const optionalKey: optionalKeyLambda;
|
|
1688
1787
|
interface requiredKeyLambda extends Lambda {
|
|
1689
|
-
<S extends
|
|
1690
|
-
readonly "~lambda.out": this["~lambda.in"] extends optionalKey<
|
|
1788
|
+
<S extends Constraint>(self: optionalKey<S>): S;
|
|
1789
|
+
readonly "~lambda.out": this["~lambda.in"] extends optionalKey<Constraint> ? this["~lambda.in"]["schema"] : "Error: schema not eligible for requiredKey";
|
|
1691
1790
|
}
|
|
1692
1791
|
/**
|
|
1693
1792
|
* Reverses `optionalKey` and returns the inner required schema.
|
|
@@ -1707,12 +1806,12 @@ export declare const requiredKey: requiredKeyLambda;
|
|
|
1707
1806
|
* @category models
|
|
1708
1807
|
* @since 3.10.0
|
|
1709
1808
|
*/
|
|
1710
|
-
export interface optional<S extends
|
|
1809
|
+
export interface optional<S extends Constraint> extends optionalKey<UndefinedOr<S>> {
|
|
1711
1810
|
readonly "Rebuild": optional<S>;
|
|
1712
1811
|
}
|
|
1713
1812
|
interface optionalLambda extends Lambda {
|
|
1714
|
-
<S extends
|
|
1715
|
-
readonly "~lambda.out": this["~lambda.in"] extends
|
|
1813
|
+
<S extends Constraint>(self: S): optional<S>;
|
|
1814
|
+
readonly "~lambda.out": this["~lambda.in"] extends Constraint ? optional<this["~lambda.in"]> : never;
|
|
1716
1815
|
}
|
|
1717
1816
|
/**
|
|
1718
1817
|
* Marks a struct field as optional, allowing the key to be absent or
|
|
@@ -1745,8 +1844,8 @@ interface optionalLambda extends Lambda {
|
|
|
1745
1844
|
*/
|
|
1746
1845
|
export declare const optional: optionalLambda;
|
|
1747
1846
|
interface requiredLambda extends Lambda {
|
|
1748
|
-
<S extends
|
|
1749
|
-
readonly "~lambda.out": this["~lambda.in"] extends optional<
|
|
1847
|
+
<S extends Constraint>(self: optional<S>): S;
|
|
1848
|
+
readonly "~lambda.out": this["~lambda.in"] extends optional<Constraint> ? this["~lambda.in"]["schema"]["members"][0] : "Error: schema not eligible for required";
|
|
1750
1849
|
}
|
|
1751
1850
|
/**
|
|
1752
1851
|
* Reverses `optional` and returns the inner schema.
|
|
@@ -1770,12 +1869,19 @@ export declare const required: requiredLambda;
|
|
|
1770
1869
|
* @category models
|
|
1771
1870
|
* @since 4.0.0
|
|
1772
1871
|
*/
|
|
1773
|
-
export interface mutableKey<S extends
|
|
1872
|
+
export interface mutableKey<S extends Constraint> extends BottomLazy<S["ast"], mutableKey<S>, S["~type.parameters"], "mutable", S["~type.optionality"], S["~type.constructor.default"], "mutable", S["~encoded.optionality"]> {
|
|
1873
|
+
readonly "Type": S["Type"];
|
|
1874
|
+
readonly "Encoded": S["Encoded"];
|
|
1875
|
+
readonly "DecodingServices": S["DecodingServices"];
|
|
1876
|
+
readonly "EncodingServices": S["EncodingServices"];
|
|
1877
|
+
readonly "~type.make.in": S["~type.make.in"];
|
|
1878
|
+
readonly "~type.make": S["~type.make"];
|
|
1879
|
+
readonly "Iso": S["Iso"];
|
|
1774
1880
|
readonly schema: S;
|
|
1775
1881
|
}
|
|
1776
1882
|
interface mutableKeyLambda extends Lambda {
|
|
1777
|
-
<S extends
|
|
1778
|
-
readonly "~lambda.out": this["~lambda.in"] extends
|
|
1883
|
+
<S extends Constraint>(self: S): mutableKey<S>;
|
|
1884
|
+
readonly "~lambda.out": this["~lambda.in"] extends Constraint ? mutableKey<this["~lambda.in"]> : never;
|
|
1779
1885
|
}
|
|
1780
1886
|
/**
|
|
1781
1887
|
* Makes a struct field mutable (removes the `readonly` modifier on the property).
|
|
@@ -1786,8 +1892,8 @@ interface mutableKeyLambda extends Lambda {
|
|
|
1786
1892
|
*/
|
|
1787
1893
|
export declare const mutableKey: mutableKeyLambda;
|
|
1788
1894
|
interface readonlyKeyLambda extends Lambda {
|
|
1789
|
-
<S extends
|
|
1790
|
-
readonly "~lambda.out": this["~lambda.in"] extends mutableKey<
|
|
1895
|
+
<S extends Constraint>(self: mutableKey<S>): S;
|
|
1896
|
+
readonly "~lambda.out": this["~lambda.in"] extends mutableKey<Constraint> ? this["~lambda.in"]["schema"] : "Error: schema not eligible for readonlyKey";
|
|
1791
1897
|
}
|
|
1792
1898
|
/**
|
|
1793
1899
|
* Reverses `mutableKey` and returns the inner readonly schema.
|
|
@@ -1807,11 +1913,18 @@ export declare const readonlyKey: readonlyKeyLambda;
|
|
|
1807
1913
|
* @category transforming
|
|
1808
1914
|
* @since 4.0.0
|
|
1809
1915
|
*/
|
|
1810
|
-
export interface toType<S extends
|
|
1916
|
+
export interface toType<S extends Constraint> extends BottomLazy<S["ast"], toType<S>, S["~type.parameters"], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
|
|
1917
|
+
readonly "Type": S["Type"];
|
|
1918
|
+
readonly "Encoded": S["Type"];
|
|
1919
|
+
readonly "DecodingServices": never;
|
|
1920
|
+
readonly "EncodingServices": never;
|
|
1921
|
+
readonly "~type.make.in": S["~type.make.in"];
|
|
1922
|
+
readonly "~type.make": S["~type.make"];
|
|
1923
|
+
readonly "Iso": S["Iso"];
|
|
1811
1924
|
}
|
|
1812
1925
|
interface toTypeLambda extends Lambda {
|
|
1813
|
-
<S extends
|
|
1814
|
-
readonly "~lambda.out": this["~lambda.in"] extends
|
|
1926
|
+
<S extends Constraint>(self: S): toType<S>;
|
|
1927
|
+
readonly "~lambda.out": this["~lambda.in"] extends Constraint ? toType<this["~lambda.in"]> : never;
|
|
1815
1928
|
}
|
|
1816
1929
|
/**
|
|
1817
1930
|
* Extracts the type-side schema: sets `Encoded` to equal the decoded `Type`,
|
|
@@ -1827,11 +1940,18 @@ export declare const toType: toTypeLambda;
|
|
|
1827
1940
|
* @category transforming
|
|
1828
1941
|
* @since 4.0.0
|
|
1829
1942
|
*/
|
|
1830
|
-
export interface toEncoded<S extends
|
|
1943
|
+
export interface toEncoded<S extends Constraint> extends BottomLazy<SchemaAST.AST, toEncoded<S>, ReadonlyArray<Constraint>, S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
|
|
1944
|
+
readonly "Type": S["Encoded"];
|
|
1945
|
+
readonly "Encoded": S["Encoded"];
|
|
1946
|
+
readonly "DecodingServices": never;
|
|
1947
|
+
readonly "EncodingServices": never;
|
|
1948
|
+
readonly "~type.make.in": S["Encoded"];
|
|
1949
|
+
readonly "~type.make": S["Encoded"];
|
|
1950
|
+
readonly "Iso": S["Encoded"];
|
|
1831
1951
|
}
|
|
1832
1952
|
interface toEncodedLambda extends Lambda {
|
|
1833
|
-
<S extends
|
|
1834
|
-
readonly "~lambda.out": this["~lambda.in"] extends
|
|
1953
|
+
<S extends Constraint>(self: S): toEncoded<S>;
|
|
1954
|
+
readonly "~lambda.out": this["~lambda.in"] extends Constraint ? toEncoded<this["~lambda.in"]> : never;
|
|
1835
1955
|
}
|
|
1836
1956
|
/**
|
|
1837
1957
|
* Extracts the encoded-side schema: sets `Type` to equal the `Encoded`,
|
|
@@ -1848,7 +1968,14 @@ declare const FlipTypeId = "~effect/Schema/flip";
|
|
|
1848
1968
|
* @category transforming
|
|
1849
1969
|
* @since 4.0.0
|
|
1850
1970
|
*/
|
|
1851
|
-
export interface flip<S extends Top> extends
|
|
1971
|
+
export interface flip<S extends Top> extends BottomLazy<SchemaAST.AST, flip<S>, ReadonlyArray<Constraint>, S["~encoded.mutability"], S["~encoded.optionality"], ConstructorDefault, S["~type.mutability"], S["~type.optionality"]> {
|
|
1972
|
+
readonly "Type": S["Encoded"];
|
|
1973
|
+
readonly "Encoded": S["Type"];
|
|
1974
|
+
readonly "DecodingServices": S["EncodingServices"];
|
|
1975
|
+
readonly "EncodingServices": S["DecodingServices"];
|
|
1976
|
+
readonly "~type.make.in": S["Encoded"];
|
|
1977
|
+
readonly "~type.make": S["Encoded"];
|
|
1978
|
+
readonly "Iso": S["Encoded"];
|
|
1852
1979
|
readonly [FlipTypeId]: typeof FlipTypeId;
|
|
1853
1980
|
readonly schema: S;
|
|
1854
1981
|
}
|
|
@@ -1923,7 +2050,7 @@ export declare namespace TemplateLiteral {
|
|
|
1923
2050
|
* @category utility types
|
|
1924
2051
|
* @since 4.0.0
|
|
1925
2052
|
*/
|
|
1926
|
-
interface SchemaPart extends
|
|
2053
|
+
interface SchemaPart extends Constraint {
|
|
1927
2054
|
readonly Encoded: string | number | bigint;
|
|
1928
2055
|
}
|
|
1929
2056
|
/**
|
|
@@ -1948,7 +2075,9 @@ export declare namespace TemplateLiteral {
|
|
|
1948
2075
|
* @since 4.0.0
|
|
1949
2076
|
*/
|
|
1950
2077
|
type Parts = ReadonlyArray<Part>;
|
|
1951
|
-
type AppendType<Template extends string, Next> = Next extends LiteralPart ? `${Template}${Next}` : Next extends
|
|
2078
|
+
type AppendType<Template extends string, Next> = Next extends LiteralPart ? `${Template}${Next}` : Next extends {
|
|
2079
|
+
readonly Encoded: infer E extends LiteralPart;
|
|
2080
|
+
} ? `${Template}${E}` : never;
|
|
1952
2081
|
/**
|
|
1953
2082
|
* Computes the encoded string literal type produced by concatenating the encoded
|
|
1954
2083
|
* forms of all template literal parts.
|
|
@@ -1968,14 +2097,20 @@ export interface TemplateLiteral<Parts extends TemplateLiteral.Parts> extends Bo
|
|
|
1968
2097
|
readonly parts: Parts;
|
|
1969
2098
|
}
|
|
1970
2099
|
/**
|
|
1971
|
-
* Creates a schema that validates strings matching
|
|
1972
|
-
*
|
|
2100
|
+
* Creates a schema that validates strings by matching ordered template literal
|
|
2101
|
+
* parts.
|
|
1973
2102
|
*
|
|
1974
2103
|
* **When to use**
|
|
1975
2104
|
*
|
|
1976
2105
|
* Use when the decoded value should remain the matched string and you do not
|
|
1977
2106
|
* need the individual template parts parsed into a tuple.
|
|
1978
2107
|
*
|
|
2108
|
+
* **Details**
|
|
2109
|
+
*
|
|
2110
|
+
* Each part can be a literal `string`, `number`, or `bigint`, or a schema whose
|
|
2111
|
+
* encoded type is `string`, `number`, or `bigint`. Checks on string, number,
|
|
2112
|
+
* and bigint schema parts are applied while matching each segment.
|
|
2113
|
+
*
|
|
1979
2114
|
* **Example** (Defining a URL path pattern)
|
|
1980
2115
|
*
|
|
1981
2116
|
* ```ts
|
|
@@ -2018,11 +2153,18 @@ export declare namespace TemplateLiteralParser {
|
|
|
2018
2153
|
* @category models
|
|
2019
2154
|
* @since 3.10.0
|
|
2020
2155
|
*/
|
|
2021
|
-
export interface TemplateLiteralParser<Parts extends TemplateLiteral.Parts> extends
|
|
2156
|
+
export interface TemplateLiteralParser<Parts extends TemplateLiteral.Parts> extends BottomLazy<SchemaAST.Arrays, TemplateLiteralParser<Parts>> {
|
|
2157
|
+
readonly "Type": TemplateLiteralParser.Type<Parts>;
|
|
2158
|
+
readonly "Encoded": TemplateLiteral.Encoded<Parts>;
|
|
2159
|
+
readonly "DecodingServices": never;
|
|
2160
|
+
readonly "EncodingServices": never;
|
|
2161
|
+
readonly "~type.make.in": TemplateLiteralParser.Type<Parts>;
|
|
2162
|
+
readonly "~type.make": TemplateLiteralParser.Type<Parts>;
|
|
2163
|
+
readonly "Iso": TemplateLiteralParser.Type<Parts>;
|
|
2022
2164
|
readonly parts: Parts;
|
|
2023
2165
|
}
|
|
2024
2166
|
/**
|
|
2025
|
-
* Schema for parsing template literal
|
|
2167
|
+
* Schema for parsing matched template literal strings into typed tuple parts.
|
|
2026
2168
|
*
|
|
2027
2169
|
* **When to use**
|
|
2028
2170
|
*
|
|
@@ -2032,7 +2174,8 @@ export interface TemplateLiteralParser<Parts extends TemplateLiteral.Parts> exte
|
|
|
2032
2174
|
* **Details**
|
|
2033
2175
|
*
|
|
2034
2176
|
* Unlike {@link TemplateLiteral}, this schema decodes the matched string into a
|
|
2035
|
-
* readonly tuple with one element per schema part.
|
|
2177
|
+
* readonly tuple with one element per schema part. Checks on string, number,
|
|
2178
|
+
* and bigint schema parts are applied while matching each segment.
|
|
2036
2179
|
*
|
|
2037
2180
|
* **Example** (Parsing path parameters)
|
|
2038
2181
|
*
|
|
@@ -2344,7 +2487,7 @@ export declare namespace Struct {
|
|
|
2344
2487
|
* @since 3.10.0
|
|
2345
2488
|
*/
|
|
2346
2489
|
type Fields = {
|
|
2347
|
-
readonly [x: PropertyKey]:
|
|
2490
|
+
readonly [x: PropertyKey]: Constraint;
|
|
2348
2491
|
};
|
|
2349
2492
|
type TypeOptionalKeys<Fields extends Struct.Fields> = {
|
|
2350
2493
|
[K in keyof Fields]: Fields[K] extends {
|
|
@@ -2356,15 +2499,28 @@ export declare namespace Struct {
|
|
|
2356
2499
|
readonly "~type.mutability": "mutable";
|
|
2357
2500
|
} ? K : never;
|
|
2358
2501
|
}[keyof Fields];
|
|
2359
|
-
type
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2502
|
+
type SetOptional<A, K extends keyof A> = Omit<A, K> & Partial<Pick<A, K>>;
|
|
2503
|
+
type Mutable<A> = {
|
|
2504
|
+
-readonly [K in keyof A]: A[K];
|
|
2505
|
+
};
|
|
2506
|
+
type SetMutable<A, K extends keyof A> = Omit<A, K> & Mutable<Pick<A, K>>;
|
|
2507
|
+
type Side = "Type" | "Iso" | "Encoded";
|
|
2508
|
+
type EncodedOptionalKeys<Fields extends Struct.Fields> = {
|
|
2509
|
+
[K in keyof Fields]: Fields[K] extends {
|
|
2510
|
+
readonly "~encoded.optionality": "optional";
|
|
2511
|
+
} ? K : never;
|
|
2512
|
+
}[keyof Fields];
|
|
2513
|
+
type EncodedMutableKeys<Fields extends Struct.Fields> = {
|
|
2514
|
+
[K in keyof Fields]: Fields[K] extends {
|
|
2515
|
+
readonly "~encoded.mutability": "mutable";
|
|
2516
|
+
} ? K : never;
|
|
2517
|
+
}[keyof Fields];
|
|
2518
|
+
type SideOptionalKeys<F extends Fields, S extends Side> = S extends "Encoded" ? EncodedOptionalKeys<F> : TypeOptionalKeys<F>;
|
|
2519
|
+
type SideMutableKeys<F extends Fields, S extends Side> = S extends "Encoded" ? EncodedMutableKeys<F> : TypeMutableKeys<F>;
|
|
2520
|
+
type ReadonlySide<F extends Fields, S extends Side> = {
|
|
2521
|
+
readonly [K in keyof F]: F[K][S];
|
|
2367
2522
|
};
|
|
2523
|
+
type View<F extends Fields, S extends Side, O extends keyof F = SideOptionalKeys<F, S>, M extends keyof F = SideMutableKeys<F, S>> = [O | M] extends [never] ? ReadonlySide<F, S> : [M] extends [never] ? Simplify<SetOptional<ReadonlySide<F, S>, O>> : [O] extends [never] ? Simplify<SetMutable<ReadonlySide<F, S>, M>> : Simplify<SetMutable<SetOptional<ReadonlySide<F, S>, O>, Extract<keyof SetOptional<ReadonlySide<F, S>, O>, M>>>;
|
|
2368
2524
|
/**
|
|
2369
2525
|
* Computes the decoded object type for a struct field map.
|
|
2370
2526
|
*
|
|
@@ -2376,16 +2532,7 @@ export declare namespace Struct {
|
|
|
2376
2532
|
* @category utility types
|
|
2377
2533
|
* @since 3.10.0
|
|
2378
2534
|
*/
|
|
2379
|
-
type Type<F extends Fields> =
|
|
2380
|
-
type Iso_<F extends Fields, O extends keyof F = TypeOptionalKeys<F>, M extends keyof F = TypeMutableKeys<F>> = {
|
|
2381
|
-
readonly [K in keyof F as K extends M | O ? never : K]: F[K]["Iso"];
|
|
2382
|
-
} & {
|
|
2383
|
-
readonly [K in keyof F as K extends O ? K extends M ? never : K : never]?: F[K]["Iso"];
|
|
2384
|
-
} & {
|
|
2385
|
-
-readonly [K in keyof F as K extends M ? K extends O ? never : K : never]: F[K]["Iso"];
|
|
2386
|
-
} & {
|
|
2387
|
-
-readonly [K in keyof F as K extends M & O ? K : never]?: F[K]["Iso"];
|
|
2388
|
-
};
|
|
2535
|
+
type Type<F extends Fields> = View<F, "Type">;
|
|
2389
2536
|
/**
|
|
2390
2537
|
* Computes the iso object type for a struct field map from each field schema's
|
|
2391
2538
|
* `Iso` type.
|
|
@@ -2398,26 +2545,7 @@ export declare namespace Struct {
|
|
|
2398
2545
|
* @category utility types
|
|
2399
2546
|
* @since 4.0.0
|
|
2400
2547
|
*/
|
|
2401
|
-
type Iso<F extends Fields> =
|
|
2402
|
-
type EncodedOptionalKeys<Fields extends Struct.Fields> = {
|
|
2403
|
-
[K in keyof Fields]: Fields[K] extends {
|
|
2404
|
-
readonly "~encoded.optionality": "optional";
|
|
2405
|
-
} ? K : never;
|
|
2406
|
-
}[keyof Fields];
|
|
2407
|
-
type EncodedMutableKeys<Fields extends Struct.Fields> = {
|
|
2408
|
-
[K in keyof Fields]: Fields[K] extends {
|
|
2409
|
-
readonly "~encoded.mutability": "mutable";
|
|
2410
|
-
} ? K : never;
|
|
2411
|
-
}[keyof Fields];
|
|
2412
|
-
type Encoded_<F extends Fields, O extends keyof F = EncodedOptionalKeys<F>, M extends keyof F = EncodedMutableKeys<F>> = {
|
|
2413
|
-
readonly [K in keyof F as K extends M | O ? never : K]: F[K]["Encoded"];
|
|
2414
|
-
} & {
|
|
2415
|
-
readonly [K in keyof F as K extends O ? K extends M ? never : K : never]?: F[K]["Encoded"];
|
|
2416
|
-
} & {
|
|
2417
|
-
-readonly [K in keyof F as K extends M ? K extends O ? never : K : never]: F[K]["Encoded"];
|
|
2418
|
-
} & {
|
|
2419
|
-
-readonly [K in keyof F as K extends M & O ? K : never]?: F[K]["Encoded"];
|
|
2420
|
-
};
|
|
2548
|
+
type Iso<F extends Fields> = View<F, "Iso">;
|
|
2421
2549
|
/**
|
|
2422
2550
|
* Computes the encoded object type for a struct field map.
|
|
2423
2551
|
*
|
|
@@ -2430,7 +2558,7 @@ export declare namespace Struct {
|
|
|
2430
2558
|
* @category utility types
|
|
2431
2559
|
* @since 3.10.0
|
|
2432
2560
|
*/
|
|
2433
|
-
type Encoded<F extends Fields> =
|
|
2561
|
+
type Encoded<F extends Fields> = View<F, "Encoded">;
|
|
2434
2562
|
/**
|
|
2435
2563
|
* Union of all decoding service requirements needed by the schemas in a struct
|
|
2436
2564
|
* field map.
|
|
@@ -2456,11 +2584,10 @@ export declare namespace Struct {
|
|
|
2456
2584
|
readonly "~type.constructor.default": "with-default";
|
|
2457
2585
|
} ? K : never;
|
|
2458
2586
|
}[keyof Fields];
|
|
2459
|
-
type
|
|
2460
|
-
readonly [K in keyof F
|
|
2461
|
-
} & {
|
|
2462
|
-
readonly [K in keyof F as K extends O ? K : never]?: F[K]["~type.make"];
|
|
2587
|
+
type ReadonlyMakeIn<F extends Fields> = {
|
|
2588
|
+
readonly [K in keyof F]: F[K]["~type.make"];
|
|
2463
2589
|
};
|
|
2590
|
+
type MakeInView<F extends Fields, O extends keyof F = TypeOptionalKeys<F> | TypeConstructorDefaultedKeys<F>> = [O] extends [never] ? ReadonlyMakeIn<F> : Simplify<SetOptional<ReadonlyMakeIn<F>, O>>;
|
|
2464
2591
|
/**
|
|
2465
2592
|
* Computes the input object type accepted when constructing a struct value.
|
|
2466
2593
|
*
|
|
@@ -2472,7 +2599,7 @@ export declare namespace Struct {
|
|
|
2472
2599
|
* @category utility types
|
|
2473
2600
|
* @since 4.0.0
|
|
2474
2601
|
*/
|
|
2475
|
-
type MakeIn<F extends Fields> =
|
|
2602
|
+
type MakeIn<F extends Fields> = MakeInView<F>;
|
|
2476
2603
|
}
|
|
2477
2604
|
/**
|
|
2478
2605
|
* Type-level representation returned by {@link Struct}.
|
|
@@ -2480,7 +2607,14 @@ export declare namespace Struct {
|
|
|
2480
2607
|
* @category models
|
|
2481
2608
|
* @since 3.10.0
|
|
2482
2609
|
*/
|
|
2483
|
-
export interface Struct<Fields extends Struct.Fields> extends
|
|
2610
|
+
export interface Struct<Fields extends Struct.Fields> extends BottomLazy<SchemaAST.Objects, Struct<Fields>> {
|
|
2611
|
+
readonly "Type": Struct.Type<Fields>;
|
|
2612
|
+
readonly "Encoded": Struct.Encoded<Fields>;
|
|
2613
|
+
readonly "DecodingServices": Struct.DecodingServices<Fields>;
|
|
2614
|
+
readonly "EncodingServices": Struct.EncodingServices<Fields>;
|
|
2615
|
+
readonly "~type.make.in": Struct.MakeIn<Fields>;
|
|
2616
|
+
readonly "~type.make": Struct.MakeIn<Fields>;
|
|
2617
|
+
readonly "Iso": Struct.Iso<Fields>;
|
|
2484
2618
|
/**
|
|
2485
2619
|
* The field definitions of this struct. Spread them into a new struct to
|
|
2486
2620
|
* reuse fields across schemas.
|
|
@@ -2595,7 +2729,7 @@ export declare function fieldsAssign<const NewFields extends Struct.Fields>(fiel
|
|
|
2595
2729
|
* @category transforming
|
|
2596
2730
|
* @since 4.0.0
|
|
2597
2731
|
*/
|
|
2598
|
-
export interface encodeKeys<S extends
|
|
2732
|
+
export interface encodeKeys<S extends Constraint & {
|
|
2599
2733
|
readonly fields: Struct.Fields;
|
|
2600
2734
|
}, M extends {
|
|
2601
2735
|
readonly [K in keyof S["fields"]]?: PropertyKey;
|
|
@@ -2631,7 +2765,7 @@ export interface encodeKeys<S extends Top & {
|
|
|
2631
2765
|
* @category transforming
|
|
2632
2766
|
* @since 4.0.0
|
|
2633
2767
|
*/
|
|
2634
|
-
export declare function encodeKeys<S extends
|
|
2768
|
+
export declare function encodeKeys<S extends Constraint & {
|
|
2635
2769
|
readonly fields: Struct.Fields;
|
|
2636
2770
|
}, const M extends {
|
|
2637
2771
|
readonly [K in keyof S["fields"]]?: PropertyKey;
|
|
@@ -2714,7 +2848,7 @@ export declare namespace Record {
|
|
|
2714
2848
|
* @category utility types
|
|
2715
2849
|
* @since 3.10.0
|
|
2716
2850
|
*/
|
|
2717
|
-
type Type<Key extends Record.Key, Value extends
|
|
2851
|
+
type Type<Key extends Record.Key, Value extends Constraint> = Value extends {
|
|
2718
2852
|
readonly "~type.optionality": "optional";
|
|
2719
2853
|
} ? Value extends {
|
|
2720
2854
|
readonly "~type.mutability": "mutable";
|
|
@@ -2736,7 +2870,7 @@ export declare namespace Record {
|
|
|
2736
2870
|
* @category utility types
|
|
2737
2871
|
* @since 4.0.0
|
|
2738
2872
|
*/
|
|
2739
|
-
type Iso<Key extends Record.Key, Value extends
|
|
2873
|
+
type Iso<Key extends Record.Key, Value extends Constraint> = Value extends {
|
|
2740
2874
|
readonly "~type.optionality": "optional";
|
|
2741
2875
|
} ? Value extends {
|
|
2742
2876
|
readonly "~type.mutability": "mutable";
|
|
@@ -2763,7 +2897,7 @@ export declare namespace Record {
|
|
|
2763
2897
|
* @category utility types
|
|
2764
2898
|
* @since 3.10.0
|
|
2765
2899
|
*/
|
|
2766
|
-
type Encoded<Key extends Record.Key, Value extends
|
|
2900
|
+
type Encoded<Key extends Record.Key, Value extends Constraint> = Value extends {
|
|
2767
2901
|
readonly "~encoded.optionality": "optional";
|
|
2768
2902
|
} ? Value extends {
|
|
2769
2903
|
readonly "~encoded.mutability": "mutable";
|
|
@@ -2785,7 +2919,7 @@ export declare namespace Record {
|
|
|
2785
2919
|
* @category utility types
|
|
2786
2920
|
* @since 4.0.0
|
|
2787
2921
|
*/
|
|
2788
|
-
type DecodingServices<Key extends Record.Key, Value extends
|
|
2922
|
+
type DecodingServices<Key extends Record.Key, Value extends Constraint> = Key["DecodingServices"] | Value["DecodingServices"];
|
|
2789
2923
|
/**
|
|
2790
2924
|
* Union of the encoding service requirements of a record's key schema and value
|
|
2791
2925
|
* schema.
|
|
@@ -2793,7 +2927,7 @@ export declare namespace Record {
|
|
|
2793
2927
|
* @category utility types
|
|
2794
2928
|
* @since 4.0.0
|
|
2795
2929
|
*/
|
|
2796
|
-
type EncodingServices<Key extends Record.Key, Value extends
|
|
2930
|
+
type EncodingServices<Key extends Record.Key, Value extends Constraint> = Key["EncodingServices"] | Value["EncodingServices"];
|
|
2797
2931
|
/**
|
|
2798
2932
|
* Computes the input object type accepted when constructing a record value.
|
|
2799
2933
|
*
|
|
@@ -2806,7 +2940,7 @@ export declare namespace Record {
|
|
|
2806
2940
|
* @category utility types
|
|
2807
2941
|
* @since 4.0.0
|
|
2808
2942
|
*/
|
|
2809
|
-
type MakeIn<Key extends Record.Key, Value extends
|
|
2943
|
+
type MakeIn<Key extends Record.Key, Value extends Constraint> = Value extends {
|
|
2810
2944
|
readonly "~encoded.optionality": "optional";
|
|
2811
2945
|
} ? Value extends {
|
|
2812
2946
|
readonly "~encoded.mutability": "mutable";
|
|
@@ -2828,12 +2962,30 @@ export declare namespace Record {
|
|
|
2828
2962
|
* @category models
|
|
2829
2963
|
* @since 4.0.0
|
|
2830
2964
|
*/
|
|
2831
|
-
export interface $Record<Key extends Record.Key, Value extends
|
|
2965
|
+
export interface $Record<Key extends Record.Key, Value extends Constraint> extends BottomLazy<SchemaAST.Objects, $Record<Key, Value>> {
|
|
2966
|
+
readonly "Type": Record.Type<Key, Value>;
|
|
2967
|
+
readonly "Encoded": Record.Encoded<Key, Value>;
|
|
2968
|
+
readonly "DecodingServices": Record.DecodingServices<Key, Value>;
|
|
2969
|
+
readonly "EncodingServices": Record.EncodingServices<Key, Value>;
|
|
2970
|
+
readonly "~type.make.in": Simplify<Record.MakeIn<Key, Value>>;
|
|
2971
|
+
readonly "~type.make": Simplify<Record.MakeIn<Key, Value>>;
|
|
2972
|
+
readonly "Iso": Record.Iso<Key, Value>;
|
|
2832
2973
|
readonly key: Key;
|
|
2833
2974
|
readonly value: Value;
|
|
2834
2975
|
}
|
|
2835
2976
|
/**
|
|
2836
|
-
* Defines a record
|
|
2977
|
+
* Defines a record schema whose dynamic properties are selected by a key schema
|
|
2978
|
+
* and decoded with a value schema.
|
|
2979
|
+
*
|
|
2980
|
+
* **Details**
|
|
2981
|
+
*
|
|
2982
|
+
* For dynamic keys, the key schema selects matching own properties and the
|
|
2983
|
+
* value schema decodes or encodes only those selected properties. Checks on
|
|
2984
|
+
* string, number, symbol, and template literal key schemas narrow which
|
|
2985
|
+
* properties are selected.
|
|
2986
|
+
*
|
|
2987
|
+
* For transformed key schemas, property selection is based on encoded property
|
|
2988
|
+
* names before the selected key is decoded.
|
|
2837
2989
|
*
|
|
2838
2990
|
* **Example** (Defining a string-keyed record of numbers)
|
|
2839
2991
|
*
|
|
@@ -2853,7 +3005,7 @@ export interface $Record<Key extends Record.Key, Value extends Top> extends Bott
|
|
|
2853
3005
|
* @category constructors
|
|
2854
3006
|
* @since 3.10.0
|
|
2855
3007
|
*/
|
|
2856
|
-
export declare function Record<Key extends Record.Key, Value extends
|
|
3008
|
+
export declare function Record<Key extends Record.Key, Value extends Constraint>(key: Key, value: Value, options?: {
|
|
2857
3009
|
readonly keyValueCombiner: {
|
|
2858
3010
|
readonly decode?: Combiner.Combiner<readonly [Key["Type"], Value["Type"]]> | undefined;
|
|
2859
3011
|
readonly encode?: Combiner.Combiner<readonly [Key["Encoded"], Value["Encoded"]]> | undefined;
|
|
@@ -2877,7 +3029,7 @@ export declare namespace StructWithRest {
|
|
|
2877
3029
|
* @category utility types
|
|
2878
3030
|
* @since 4.0.0
|
|
2879
3031
|
*/
|
|
2880
|
-
type Objects =
|
|
3032
|
+
type Objects = Constraint & {
|
|
2881
3033
|
readonly ast: SchemaAST.Objects;
|
|
2882
3034
|
};
|
|
2883
3035
|
/**
|
|
@@ -2887,7 +3039,7 @@ export declare namespace StructWithRest {
|
|
|
2887
3039
|
* @category utility types
|
|
2888
3040
|
* @since 3.10.0
|
|
2889
3041
|
*/
|
|
2890
|
-
type Records = ReadonlyArray<$Record<Record.Key,
|
|
3042
|
+
type Records = ReadonlyArray<$Record<Record.Key, Constraint>>;
|
|
2891
3043
|
type MergeTuple<T extends ReadonlyArray<unknown>> = T extends readonly [infer Head, ...infer Tail] ? Head & MergeTuple<Tail> : {};
|
|
2892
3044
|
type Intersect<S extends Objects, Records extends StructWithRest.Records, Side extends "Type" | "Iso" | "Encoded" | "~type.make"> = S[Side] & MergeTuple<{
|
|
2893
3045
|
readonly [K in keyof Records]: Records[K][Side];
|
|
@@ -2950,16 +3102,43 @@ export declare namespace StructWithRest {
|
|
|
2950
3102
|
type IncompatibleSideKeys<S extends Objects, Records extends StructWithRest.Records, Side extends "Type" | "Encoded" | "Iso" | "~type.make"> = {
|
|
2951
3103
|
[I in keyof Records]: Records[I][Side] extends object ? IncompatibleKeys<S[Side], Records[I][Side]> : never;
|
|
2952
3104
|
}[number];
|
|
3105
|
+
type IncompatibleRecords<S extends Objects, Records extends StructWithRest.Records> = IncompatibleSideKeys<S, Records, "Type"> | IncompatibleSideKeys<S, Records, "Encoded"> | IncompatibleSideKeys<S, Records, "Iso"> | IncompatibleSideKeys<S, Records, "~type.make">;
|
|
2953
3106
|
/**
|
|
2954
|
-
*
|
|
3107
|
+
* Checks whether fixed fields are compatible with the rest record schemas.
|
|
3108
|
+
*
|
|
3109
|
+
* **Details**
|
|
3110
|
+
*
|
|
3111
|
+
* Returns `true` when all fixed fields can also satisfy the matching rest
|
|
3112
|
+
* index signatures. Returns a diagnostic object when TypeScript would make
|
|
3113
|
+
* the resulting intersection too narrow for one or more fixed keys.
|
|
3114
|
+
*
|
|
3115
|
+
* **Example** (Checking record compatibility)
|
|
3116
|
+
*
|
|
3117
|
+
* ```ts
|
|
3118
|
+
* import { Schema } from "effect"
|
|
3119
|
+
*
|
|
3120
|
+
* const user = Schema.Struct({ id: Schema.String })
|
|
3121
|
+
* const stringExtras = [Schema.Record(Schema.String, Schema.String)] as const
|
|
3122
|
+
*
|
|
3123
|
+
* type UserCheck = Schema.StructWithRest.ValidateRecords<typeof user, typeof stringExtras>
|
|
3124
|
+
*
|
|
3125
|
+
* const userCheck: UserCheck = true
|
|
3126
|
+
* void userCheck
|
|
3127
|
+
*
|
|
3128
|
+
* const counter = Schema.Struct({ count: Schema.NumberFromString })
|
|
3129
|
+
*
|
|
3130
|
+
* type CounterCheck = Schema.StructWithRest.ValidateRecords<typeof counter, typeof stringExtras>
|
|
3131
|
+
* // ^? { "incompatible index signatures": "count" }
|
|
3132
|
+
*
|
|
3133
|
+
* const counterCheck = null as unknown as CounterCheck
|
|
3134
|
+
* void counterCheck
|
|
3135
|
+
* ```
|
|
2955
3136
|
*
|
|
2956
3137
|
* @category utility types
|
|
2957
3138
|
* @since 4.0.0
|
|
2958
3139
|
*/
|
|
2959
|
-
type ValidateRecords<S extends Objects, Records extends StructWithRest.Records> = [
|
|
2960
|
-
|
|
2961
|
-
] extends [never] ? unknown : {
|
|
2962
|
-
"incompatible index signatures": IncompatibleSideKeys<S, Records, "Type"> | IncompatibleSideKeys<S, Records, "Encoded"> | IncompatibleSideKeys<S, Records, "Iso"> | IncompatibleSideKeys<S, Records, "~type.make">;
|
|
3140
|
+
type ValidateRecords<S extends Objects, Records extends StructWithRest.Records> = [IncompatibleRecords<S, Records>] extends [never] ? true : {
|
|
3141
|
+
"incompatible index signatures": IncompatibleRecords<S, Records>;
|
|
2963
3142
|
};
|
|
2964
3143
|
}
|
|
2965
3144
|
/**
|
|
@@ -2968,7 +3147,14 @@ export declare namespace StructWithRest {
|
|
|
2968
3147
|
* @category models
|
|
2969
3148
|
* @since 4.0.0
|
|
2970
3149
|
*/
|
|
2971
|
-
export interface StructWithRest<S extends StructWithRest.Objects, Records extends StructWithRest.Records> extends
|
|
3150
|
+
export interface StructWithRest<S extends StructWithRest.Objects, Records extends StructWithRest.Records> extends BottomLazy<SchemaAST.Objects, StructWithRest<S, Records>> {
|
|
3151
|
+
readonly "Type": Simplify<StructWithRest.Type<S, Records>>;
|
|
3152
|
+
readonly "Encoded": Simplify<StructWithRest.Encoded<S, Records>>;
|
|
3153
|
+
readonly "DecodingServices": StructWithRest.DecodingServices<S, Records>;
|
|
3154
|
+
readonly "EncodingServices": StructWithRest.EncodingServices<S, Records>;
|
|
3155
|
+
readonly "~type.make.in": Simplify<StructWithRest.MakeIn<S, Records>>;
|
|
3156
|
+
readonly "~type.make": Simplify<StructWithRest.MakeIn<S, Records>>;
|
|
3157
|
+
readonly "Iso": Simplify<StructWithRest.Iso<S, Records>>;
|
|
2972
3158
|
readonly schema: S;
|
|
2973
3159
|
readonly records: Records;
|
|
2974
3160
|
}
|
|
@@ -2976,6 +3162,13 @@ export interface StructWithRest<S extends StructWithRest.Objects, Records extend
|
|
|
2976
3162
|
* Extends a struct schema with one or more record (index-signature) schemas,
|
|
2977
3163
|
* producing a schema whose decoded type intersects the struct and all records.
|
|
2978
3164
|
*
|
|
3165
|
+
* **Gotchas**
|
|
3166
|
+
*
|
|
3167
|
+
* TypeScript index signatures also apply to fixed keys. `StructWithRest` does
|
|
3168
|
+
* not reject incompatible fixed fields at the call site; use
|
|
3169
|
+
* `StructWithRest.ValidateRecords` when you want an explicit type-level
|
|
3170
|
+
* compatibility check.
|
|
3171
|
+
*
|
|
2979
3172
|
* **Example** (Defining structs with string-indexed extra keys)
|
|
2980
3173
|
*
|
|
2981
3174
|
* ```ts
|
|
@@ -2993,7 +3186,7 @@ export interface StructWithRest<S extends StructWithRest.Objects, Records extend
|
|
|
2993
3186
|
* @category constructors
|
|
2994
3187
|
* @since 4.0.0
|
|
2995
3188
|
*/
|
|
2996
|
-
export declare function StructWithRest<const S extends StructWithRest.Objects, const Records extends StructWithRest.Records>(schema: S, records: Records
|
|
3189
|
+
export declare function StructWithRest<const S extends StructWithRest.Objects, const Records extends StructWithRest.Records>(schema: S, records: Records): StructWithRest<S, Records>;
|
|
2997
3190
|
/**
|
|
2998
3191
|
* Namespace for `Tuple` type utilities.
|
|
2999
3192
|
*
|
|
@@ -3014,7 +3207,7 @@ export declare namespace Tuple {
|
|
|
3014
3207
|
* @category utility types
|
|
3015
3208
|
* @since 3.10.0
|
|
3016
3209
|
*/
|
|
3017
|
-
type Elements = ReadonlyArray<
|
|
3210
|
+
type Elements = ReadonlyArray<Constraint>;
|
|
3018
3211
|
type Type_<Elements, Out extends ReadonlyArray<any> = readonly []> = Elements extends readonly [infer Head, ...infer Tail] ? Head extends {
|
|
3019
3212
|
readonly "Type": infer T;
|
|
3020
3213
|
} ? Head extends {
|
|
@@ -3104,7 +3297,14 @@ export declare namespace Tuple {
|
|
|
3104
3297
|
* @category models
|
|
3105
3298
|
* @since 3.10.0
|
|
3106
3299
|
*/
|
|
3107
|
-
export interface Tuple<Elements extends Tuple.Elements> extends
|
|
3300
|
+
export interface Tuple<Elements extends Tuple.Elements> extends BottomLazy<SchemaAST.Arrays, Tuple<Elements>> {
|
|
3301
|
+
readonly "Type": Tuple.Type<Elements>;
|
|
3302
|
+
readonly "Encoded": Tuple.Encoded<Elements>;
|
|
3303
|
+
readonly "DecodingServices": Tuple.DecodingServices<Elements>;
|
|
3304
|
+
readonly "EncodingServices": Tuple.EncodingServices<Elements>;
|
|
3305
|
+
readonly "~type.make.in": Tuple.MakeIn<Elements>;
|
|
3306
|
+
readonly "~type.make": Tuple.MakeIn<Elements>;
|
|
3307
|
+
readonly "Iso": Tuple.Iso<Elements>;
|
|
3108
3308
|
readonly elements: Elements;
|
|
3109
3309
|
/**
|
|
3110
3310
|
* Returns a new tuple with the elements modified by the provided function.
|
|
@@ -3144,7 +3344,7 @@ export interface Tuple<Elements extends Tuple.Elements> extends Bottom<Tuple.Typ
|
|
|
3144
3344
|
* @category constructors
|
|
3145
3345
|
* @since 3.10.0
|
|
3146
3346
|
*/
|
|
3147
|
-
export declare function Tuple<const Elements extends ReadonlyArray<
|
|
3347
|
+
export declare function Tuple<const Elements extends ReadonlyArray<Constraint>>(elements: Elements): Tuple<Elements>;
|
|
3148
3348
|
/**
|
|
3149
3349
|
* Namespace for `TupleWithRest` type utilities.
|
|
3150
3350
|
*
|
|
@@ -3165,7 +3365,7 @@ export declare namespace TupleWithRest {
|
|
|
3165
3365
|
* @category utility types
|
|
3166
3366
|
* @since 3.10.0
|
|
3167
3367
|
*/
|
|
3168
|
-
type TupleType =
|
|
3368
|
+
type TupleType = Constraint & {
|
|
3169
3369
|
readonly Type: ReadonlyArray<unknown>;
|
|
3170
3370
|
readonly Encoded: ReadonlyArray<unknown>;
|
|
3171
3371
|
readonly ast: SchemaAST.Arrays;
|
|
@@ -3183,7 +3383,7 @@ export declare namespace TupleWithRest {
|
|
|
3183
3383
|
* @category utility types
|
|
3184
3384
|
* @since 3.10.0
|
|
3185
3385
|
*/
|
|
3186
|
-
type Rest = readonly [
|
|
3386
|
+
type Rest = readonly [Constraint, ...Array<Constraint>];
|
|
3187
3387
|
/**
|
|
3188
3388
|
* Computes the decoded tuple type for a `TupleWithRest`.
|
|
3189
3389
|
*
|
|
@@ -3196,7 +3396,7 @@ export declare namespace TupleWithRest {
|
|
|
3196
3396
|
* @category utility types
|
|
3197
3397
|
* @since 3.10.0
|
|
3198
3398
|
*/
|
|
3199
|
-
type Type<T extends ReadonlyArray<unknown>, Rest extends TupleWithRest.Rest> = Rest extends readonly [infer Head extends
|
|
3399
|
+
type Type<T extends ReadonlyArray<unknown>, Rest extends TupleWithRest.Rest> = Rest extends readonly [infer Head extends Constraint, ...infer Tail extends ReadonlyArray<Constraint>] ? Readonly<[
|
|
3200
3400
|
...T,
|
|
3201
3401
|
...Array<Head["Type"]>,
|
|
3202
3402
|
...{
|
|
@@ -3215,7 +3415,7 @@ export declare namespace TupleWithRest {
|
|
|
3215
3415
|
* @category utility types
|
|
3216
3416
|
* @since 4.0.0
|
|
3217
3417
|
*/
|
|
3218
|
-
type Iso<T extends ReadonlyArray<unknown>, Rest extends TupleWithRest.Rest> = Rest extends readonly [infer Head extends
|
|
3418
|
+
type Iso<T extends ReadonlyArray<unknown>, Rest extends TupleWithRest.Rest> = Rest extends readonly [infer Head extends Constraint, ...infer Tail extends ReadonlyArray<Constraint>] ? Readonly<[
|
|
3219
3419
|
...T,
|
|
3220
3420
|
...Array<Head["Iso"]>,
|
|
3221
3421
|
...{
|
|
@@ -3234,7 +3434,7 @@ export declare namespace TupleWithRest {
|
|
|
3234
3434
|
* @category utility types
|
|
3235
3435
|
* @since 3.10.0
|
|
3236
3436
|
*/
|
|
3237
|
-
type Encoded<E extends ReadonlyArray<unknown>, Rest extends TupleWithRest.Rest> = Rest extends readonly [infer Head extends
|
|
3437
|
+
type Encoded<E extends ReadonlyArray<unknown>, Rest extends TupleWithRest.Rest> = Rest extends readonly [infer Head extends Constraint, ...infer Tail extends ReadonlyArray<Constraint>] ? readonly [
|
|
3238
3438
|
...E,
|
|
3239
3439
|
...Array<Head["Encoded"]>,
|
|
3240
3440
|
...{
|
|
@@ -3253,7 +3453,7 @@ export declare namespace TupleWithRest {
|
|
|
3253
3453
|
* @category utility types
|
|
3254
3454
|
* @since 4.0.0
|
|
3255
3455
|
*/
|
|
3256
|
-
type MakeIn<M extends ReadonlyArray<unknown>, Rest extends TupleWithRest.Rest> = Rest extends readonly [infer Head extends
|
|
3456
|
+
type MakeIn<M extends ReadonlyArray<unknown>, Rest extends TupleWithRest.Rest> = Rest extends readonly [infer Head extends Constraint, ...infer Tail extends ReadonlyArray<Constraint>] ? readonly [
|
|
3257
3457
|
...M,
|
|
3258
3458
|
...Array<Head["~type.make"]>,
|
|
3259
3459
|
...{
|
|
@@ -3267,7 +3467,14 @@ export declare namespace TupleWithRest {
|
|
|
3267
3467
|
* @category models
|
|
3268
3468
|
* @since 4.0.0
|
|
3269
3469
|
*/
|
|
3270
|
-
export interface TupleWithRest<S extends TupleWithRest.TupleType, Rest extends TupleWithRest.Rest> extends
|
|
3470
|
+
export interface TupleWithRest<S extends TupleWithRest.TupleType, Rest extends TupleWithRest.Rest> extends BottomLazy<SchemaAST.Arrays, TupleWithRest<S, Rest>> {
|
|
3471
|
+
readonly "Type": TupleWithRest.Type<S["Type"], Rest>;
|
|
3472
|
+
readonly "Encoded": TupleWithRest.Encoded<S["Encoded"], Rest>;
|
|
3473
|
+
readonly "DecodingServices": S["DecodingServices"] | Rest[number]["DecodingServices"];
|
|
3474
|
+
readonly "EncodingServices": S["EncodingServices"] | Rest[number]["EncodingServices"];
|
|
3475
|
+
readonly "~type.make.in": TupleWithRest.MakeIn<S["~type.make"], Rest>;
|
|
3476
|
+
readonly "~type.make": TupleWithRest.MakeIn<S["~type.make"], Rest>;
|
|
3477
|
+
readonly "Iso": TupleWithRest.Iso<S["Iso"], Rest>;
|
|
3271
3478
|
readonly schema: S;
|
|
3272
3479
|
readonly rest: Rest;
|
|
3273
3480
|
}
|
|
@@ -3308,12 +3515,19 @@ export declare function TupleWithRest<S extends Tuple<Tuple.Elements>, const Res
|
|
|
3308
3515
|
* @category models
|
|
3309
3516
|
* @since 4.0.0
|
|
3310
3517
|
*/
|
|
3311
|
-
export interface $Array<S extends
|
|
3518
|
+
export interface $Array<S extends Constraint> extends BottomLazy<SchemaAST.Arrays, $Array<S>> {
|
|
3519
|
+
readonly "Type": ReadonlyArray<S["Type"]>;
|
|
3520
|
+
readonly "Encoded": ReadonlyArray<S["Encoded"]>;
|
|
3521
|
+
readonly "DecodingServices": S["DecodingServices"];
|
|
3522
|
+
readonly "EncodingServices": S["EncodingServices"];
|
|
3523
|
+
readonly "~type.make.in": ReadonlyArray<S["~type.make"]>;
|
|
3524
|
+
readonly "~type.make": ReadonlyArray<S["~type.make"]>;
|
|
3525
|
+
readonly "Iso": ReadonlyArray<S["Iso"]>;
|
|
3312
3526
|
readonly value: S;
|
|
3313
3527
|
}
|
|
3314
3528
|
interface ArrayLambda extends Lambda {
|
|
3315
|
-
<S extends
|
|
3316
|
-
readonly "~lambda.out": this["~lambda.in"] extends
|
|
3529
|
+
<S extends Constraint>(self: S): $Array<S>;
|
|
3530
|
+
readonly "~lambda.out": this["~lambda.in"] extends Constraint ? $Array<this["~lambda.in"]> : never;
|
|
3317
3531
|
}
|
|
3318
3532
|
/**
|
|
3319
3533
|
* @category constructors
|
|
@@ -3346,12 +3560,19 @@ ArraySchema as Array };
|
|
|
3346
3560
|
* @category models
|
|
3347
3561
|
* @since 3.10.0
|
|
3348
3562
|
*/
|
|
3349
|
-
export interface NonEmptyArray<S extends
|
|
3563
|
+
export interface NonEmptyArray<S extends Constraint> extends BottomLazy<SchemaAST.Arrays, NonEmptyArray<S>> {
|
|
3564
|
+
readonly "Type": readonly [S["Type"], ...Array<S["Type"]>];
|
|
3565
|
+
readonly "Encoded": readonly [S["Encoded"], ...Array<S["Encoded"]>];
|
|
3566
|
+
readonly "DecodingServices": S["DecodingServices"];
|
|
3567
|
+
readonly "EncodingServices": S["EncodingServices"];
|
|
3568
|
+
readonly "~type.make.in": readonly [S["~type.make"], ...Array<S["~type.make"]>];
|
|
3569
|
+
readonly "~type.make": readonly [S["~type.make"], ...Array<S["~type.make"]>];
|
|
3570
|
+
readonly "Iso": readonly [S["Iso"], ...Array<S["Iso"]>];
|
|
3350
3571
|
readonly value: S;
|
|
3351
3572
|
}
|
|
3352
3573
|
interface NonEmptyArrayLambda extends Lambda {
|
|
3353
|
-
<S extends
|
|
3354
|
-
readonly "~lambda.out": this["~lambda.in"] extends
|
|
3574
|
+
<S extends Constraint>(self: S): NonEmptyArray<S>;
|
|
3575
|
+
readonly "~lambda.out": this["~lambda.in"] extends Constraint ? NonEmptyArray<this["~lambda.in"]> : never;
|
|
3355
3576
|
}
|
|
3356
3577
|
/**
|
|
3357
3578
|
* Defines a non-empty `ReadonlyArray` schema — at least one element required.
|
|
@@ -3378,7 +3599,7 @@ export declare const NonEmptyArray: NonEmptyArrayLambda;
|
|
|
3378
3599
|
* @category constructors
|
|
3379
3600
|
* @since 3.10.0
|
|
3380
3601
|
*/
|
|
3381
|
-
export interface ArrayEnsure<S extends
|
|
3602
|
+
export interface ArrayEnsure<S extends Constraint> extends decodeTo<$Array<toType<S>>, Union<readonly [S, $Array<S>]>> {
|
|
3382
3603
|
readonly "Rebuild": ArrayEnsure<S>;
|
|
3383
3604
|
}
|
|
3384
3605
|
/**
|
|
@@ -3407,14 +3628,14 @@ export interface ArrayEnsure<S extends Top> extends decodeTo<$Array<toType<S>>,
|
|
|
3407
3628
|
* @category constructors
|
|
3408
3629
|
* @since 3.10.0
|
|
3409
3630
|
*/
|
|
3410
|
-
export declare function ArrayEnsure<S extends
|
|
3631
|
+
export declare function ArrayEnsure<S extends Constraint>(schema: S): ArrayEnsure<S>;
|
|
3411
3632
|
/**
|
|
3412
3633
|
* Type-level representation returned by {@link UniqueArray}.
|
|
3413
3634
|
*
|
|
3414
3635
|
* @category models
|
|
3415
3636
|
* @since 4.0.0
|
|
3416
3637
|
*/
|
|
3417
|
-
export interface UniqueArray<S extends
|
|
3638
|
+
export interface UniqueArray<S extends Constraint> extends $Array<S> {
|
|
3418
3639
|
readonly "Rebuild": UniqueArray<S>;
|
|
3419
3640
|
}
|
|
3420
3641
|
/**
|
|
@@ -3428,23 +3649,30 @@ export interface UniqueArray<S extends Top> extends $Array<S> {
|
|
|
3428
3649
|
* @category constructors
|
|
3429
3650
|
* @since 4.0.0
|
|
3430
3651
|
*/
|
|
3431
|
-
export declare function UniqueArray<S extends
|
|
3652
|
+
export declare function UniqueArray<S extends Constraint>(item: S): UniqueArray<S>;
|
|
3432
3653
|
/**
|
|
3433
3654
|
* Type-level representation returned by {@link mutable}.
|
|
3434
3655
|
*
|
|
3435
3656
|
* @category transforming
|
|
3436
3657
|
* @since 3.10.0
|
|
3437
3658
|
*/
|
|
3438
|
-
export interface mutable<S extends
|
|
3659
|
+
export interface mutable<S extends Constraint & {
|
|
3439
3660
|
readonly "ast": SchemaAST.Arrays;
|
|
3440
|
-
}> extends
|
|
3661
|
+
}> extends BottomLazy<S["ast"], mutable<S>, S["~type.parameters"], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
|
|
3662
|
+
readonly "Type": Mutable<S["Type"]>;
|
|
3663
|
+
readonly "Encoded": Mutable<S["Encoded"]>;
|
|
3664
|
+
readonly "DecodingServices": S["DecodingServices"];
|
|
3665
|
+
readonly "EncodingServices": S["EncodingServices"];
|
|
3666
|
+
readonly "~type.make.in": S["~type.make.in"];
|
|
3667
|
+
readonly "~type.make": S["~type.make"];
|
|
3668
|
+
readonly "Iso": S["Iso"];
|
|
3441
3669
|
readonly schema: S;
|
|
3442
3670
|
}
|
|
3443
3671
|
interface mutableLambda extends Lambda {
|
|
3444
|
-
<S extends
|
|
3672
|
+
<S extends Constraint & {
|
|
3445
3673
|
readonly "ast": SchemaAST.Arrays;
|
|
3446
3674
|
}>(self: S): mutable<S>;
|
|
3447
|
-
readonly "~lambda.out": this["~lambda.in"] extends
|
|
3675
|
+
readonly "~lambda.out": this["~lambda.in"] extends Constraint & {
|
|
3448
3676
|
readonly "ast": SchemaAST.Arrays;
|
|
3449
3677
|
} ? mutable<this["~lambda.in"]> : "Error: schema not eligible for mutable";
|
|
3450
3678
|
}
|
|
@@ -3472,21 +3700,30 @@ export declare const mutable: mutableLambda;
|
|
|
3472
3700
|
* @category models
|
|
3473
3701
|
* @since 3.10.0
|
|
3474
3702
|
*/
|
|
3475
|
-
export interface Union<Members extends ReadonlyArray<
|
|
3476
|
-
[K in keyof Members]: Members[K]["Type"];
|
|
3477
|
-
}[number], {
|
|
3478
|
-
[K in keyof Members]: Members[K]["Encoded"];
|
|
3479
|
-
}[number], {
|
|
3480
|
-
[K in keyof Members]: Members[K]["DecodingServices"];
|
|
3481
|
-
}[number], {
|
|
3482
|
-
[K in keyof Members]: Members[K]["EncodingServices"];
|
|
3483
|
-
}[number], SchemaAST.Union<{
|
|
3703
|
+
export interface Union<Members extends ReadonlyArray<Constraint>> extends BottomLazy<SchemaAST.Union<{
|
|
3484
3704
|
[K in keyof Members]: Members[K]["ast"];
|
|
3485
|
-
}[number]>, Union<Members
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
[
|
|
3489
|
-
|
|
3705
|
+
}[number]>, Union<Members>> {
|
|
3706
|
+
readonly "Type": {
|
|
3707
|
+
[K in keyof Members]: Members[K]["Type"];
|
|
3708
|
+
}[number];
|
|
3709
|
+
readonly "Encoded": {
|
|
3710
|
+
[K in keyof Members]: Members[K]["Encoded"];
|
|
3711
|
+
}[number];
|
|
3712
|
+
readonly "DecodingServices": {
|
|
3713
|
+
[K in keyof Members]: Members[K]["DecodingServices"];
|
|
3714
|
+
}[number];
|
|
3715
|
+
readonly "EncodingServices": {
|
|
3716
|
+
[K in keyof Members]: Members[K]["EncodingServices"];
|
|
3717
|
+
}[number];
|
|
3718
|
+
readonly "~type.make.in": {
|
|
3719
|
+
[K in keyof Members]: Members[K]["~type.make"];
|
|
3720
|
+
}[number];
|
|
3721
|
+
readonly "~type.make": {
|
|
3722
|
+
[K in keyof Members]: Members[K]["~type.make"];
|
|
3723
|
+
}[number];
|
|
3724
|
+
readonly "Iso": {
|
|
3725
|
+
[K in keyof Members]: Members[K]["Iso"];
|
|
3726
|
+
}[number];
|
|
3490
3727
|
readonly members: Members;
|
|
3491
3728
|
/**
|
|
3492
3729
|
* Returns a new union with the members modified by the provided function.
|
|
@@ -3504,7 +3741,7 @@ export interface Union<Members extends ReadonlyArray<Top>> extends Bottom<{
|
|
|
3504
3741
|
* use this option if you have verified that your refinements remain correct
|
|
3505
3742
|
* after the transformation.
|
|
3506
3743
|
*/
|
|
3507
|
-
mapMembers<To extends ReadonlyArray<
|
|
3744
|
+
mapMembers<To extends ReadonlyArray<Constraint>>(f: (members: Members) => To, options?: {
|
|
3508
3745
|
readonly unsafePreserveChecks?: boolean | undefined;
|
|
3509
3746
|
} | undefined): Union<Simplify<Readonly<To>>>;
|
|
3510
3747
|
}
|
|
@@ -3532,7 +3769,7 @@ export interface Union<Members extends ReadonlyArray<Top>> extends Bottom<{
|
|
|
3532
3769
|
* @category constructors
|
|
3533
3770
|
* @since 3.10.0
|
|
3534
3771
|
*/
|
|
3535
|
-
export declare function Union<const Members extends ReadonlyArray<
|
|
3772
|
+
export declare function Union<const Members extends ReadonlyArray<Constraint>>(members: Members, options?: {
|
|
3536
3773
|
mode?: "anyOf" | "oneOf";
|
|
3537
3774
|
}): Union<Members>;
|
|
3538
3775
|
/**
|
|
@@ -3549,7 +3786,7 @@ export interface Literals<L extends ReadonlyArray<SchemaAST.LiteralValue>> exten
|
|
|
3549
3786
|
/**
|
|
3550
3787
|
* Map over the members of the union.
|
|
3551
3788
|
*/
|
|
3552
|
-
mapMembers<To extends ReadonlyArray<
|
|
3789
|
+
mapMembers<To extends ReadonlyArray<Constraint>>(f: (members: this["members"]) => To): Union<Simplify<Readonly<To>>>;
|
|
3553
3790
|
pick<const L2 extends ReadonlyArray<L[number]>>(literals: L2): Literals<L2>;
|
|
3554
3791
|
transform<const L2 extends {
|
|
3555
3792
|
readonly [I in keyof L]: SchemaAST.LiteralValue;
|
|
@@ -3580,12 +3817,12 @@ export declare function Literals<const L extends ReadonlyArray<SchemaAST.Literal
|
|
|
3580
3817
|
* @category models
|
|
3581
3818
|
* @since 3.10.0
|
|
3582
3819
|
*/
|
|
3583
|
-
export interface NullOr<S extends
|
|
3820
|
+
export interface NullOr<S extends Constraint> extends Union<readonly [S, Null]> {
|
|
3584
3821
|
readonly "Rebuild": NullOr<S>;
|
|
3585
3822
|
}
|
|
3586
3823
|
interface NullOrLambda extends Lambda {
|
|
3587
|
-
<S extends
|
|
3588
|
-
readonly "~lambda.out": this["~lambda.in"] extends
|
|
3824
|
+
<S extends Constraint>(self: S): NullOr<S>;
|
|
3825
|
+
readonly "~lambda.out": this["~lambda.in"] extends Constraint ? NullOr<this["~lambda.in"]> : never;
|
|
3589
3826
|
}
|
|
3590
3827
|
/**
|
|
3591
3828
|
* Creates a union schema of `S | null`.
|
|
@@ -3600,12 +3837,12 @@ export declare const NullOr: NullOrLambda;
|
|
|
3600
3837
|
* @category models
|
|
3601
3838
|
* @since 3.10.0
|
|
3602
3839
|
*/
|
|
3603
|
-
export interface UndefinedOr<S extends
|
|
3840
|
+
export interface UndefinedOr<S extends Constraint> extends Union<readonly [S, Undefined]> {
|
|
3604
3841
|
readonly "Rebuild": UndefinedOr<S>;
|
|
3605
3842
|
}
|
|
3606
3843
|
interface UndefinedOrLambda extends Lambda {
|
|
3607
|
-
<S extends
|
|
3608
|
-
readonly "~lambda.out": this["~lambda.in"] extends
|
|
3844
|
+
<S extends Constraint>(self: S): UndefinedOr<S>;
|
|
3845
|
+
readonly "~lambda.out": this["~lambda.in"] extends Constraint ? UndefinedOr<this["~lambda.in"]> : never;
|
|
3609
3846
|
}
|
|
3610
3847
|
/**
|
|
3611
3848
|
* Creates a union schema of `S | undefined`.
|
|
@@ -3620,12 +3857,12 @@ export declare const UndefinedOr: UndefinedOrLambda;
|
|
|
3620
3857
|
* @category models
|
|
3621
3858
|
* @since 3.10.0
|
|
3622
3859
|
*/
|
|
3623
|
-
export interface NullishOr<S extends
|
|
3860
|
+
export interface NullishOr<S extends Constraint> extends Union<readonly [S, Null, Undefined]> {
|
|
3624
3861
|
readonly "Rebuild": NullishOr<S>;
|
|
3625
3862
|
}
|
|
3626
3863
|
interface NullishOrLambda extends Lambda {
|
|
3627
|
-
<S extends
|
|
3628
|
-
readonly "~lambda.out": this["~lambda.in"] extends
|
|
3864
|
+
<S extends Constraint>(self: S): NullishOr<S>;
|
|
3865
|
+
readonly "~lambda.out": this["~lambda.in"] extends Constraint ? NullishOr<this["~lambda.in"]> : never;
|
|
3629
3866
|
}
|
|
3630
3867
|
/**
|
|
3631
3868
|
* Creates a union schema of `S | null | undefined`.
|
|
@@ -3640,7 +3877,14 @@ export declare const NullishOr: NullishOrLambda;
|
|
|
3640
3877
|
* @category models
|
|
3641
3878
|
* @since 3.10.0
|
|
3642
3879
|
*/
|
|
3643
|
-
export interface suspend<S extends
|
|
3880
|
+
export interface suspend<S extends Constraint> extends BottomLazy<SchemaAST.Suspend, suspend<S>, S["~type.parameters"], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
|
|
3881
|
+
readonly "Type": S["Type"];
|
|
3882
|
+
readonly "Encoded": S["Encoded"];
|
|
3883
|
+
readonly "DecodingServices": S["DecodingServices"];
|
|
3884
|
+
readonly "EncodingServices": S["EncodingServices"];
|
|
3885
|
+
readonly "~type.make.in": S["~type.make.in"];
|
|
3886
|
+
readonly "~type.make": S["~type.make"];
|
|
3887
|
+
readonly "Iso": S["Iso"];
|
|
3644
3888
|
}
|
|
3645
3889
|
/**
|
|
3646
3890
|
* Creates a suspended schema that defers evaluation until needed. This is
|
|
@@ -3666,7 +3910,7 @@ export interface suspend<S extends Top> extends Bottom<S["Type"], S["Encoded"],
|
|
|
3666
3910
|
* @category constructors
|
|
3667
3911
|
* @since 3.10.0
|
|
3668
3912
|
*/
|
|
3669
|
-
export declare function suspend<S extends
|
|
3913
|
+
export declare function suspend<S extends Constraint>(f: () => S): suspend<S>;
|
|
3670
3914
|
/**
|
|
3671
3915
|
* Attaches one or more filter checks to a schema without changing the
|
|
3672
3916
|
* TypeScript type.
|
|
@@ -3691,7 +3935,14 @@ export declare function check<S extends Top>(...checks: readonly [SchemaAST.Chec
|
|
|
3691
3935
|
* @category filtering
|
|
3692
3936
|
* @since 3.10.0
|
|
3693
3937
|
*/
|
|
3694
|
-
export interface refine<T extends S["Type"], S extends
|
|
3938
|
+
export interface refine<T extends S["Type"], S extends Constraint> extends BottomLazy<S["ast"], refine<T, S>, S["~type.parameters"], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
|
|
3939
|
+
readonly "Type": T;
|
|
3940
|
+
readonly "Encoded": S["Encoded"];
|
|
3941
|
+
readonly "DecodingServices": S["DecodingServices"];
|
|
3942
|
+
readonly "EncodingServices": S["EncodingServices"];
|
|
3943
|
+
readonly "~type.make.in": S["~type.make.in"];
|
|
3944
|
+
readonly "~type.make": T;
|
|
3945
|
+
readonly "Iso": T;
|
|
3695
3946
|
readonly schema: S;
|
|
3696
3947
|
}
|
|
3697
3948
|
/**
|
|
@@ -3709,7 +3960,7 @@ export interface refine<T extends S["Type"], S extends Top> extends Bottom<T, S[
|
|
|
3709
3960
|
* @category filtering
|
|
3710
3961
|
* @since 3.10.0
|
|
3711
3962
|
*/
|
|
3712
|
-
export declare function refine<S extends
|
|
3963
|
+
export declare function refine<S extends Constraint, T extends S["Type"]>(refinement: (value: S["Type"]) => value is T, annotations?: Annotations.Filter): (schema: S) => refine<T, S>;
|
|
3713
3964
|
type DistributeBrands<B> = UnionToIntersection<B extends infer U extends string ? Brand.Brand<U> : never>;
|
|
3714
3965
|
/**
|
|
3715
3966
|
* Type-level representation returned by {@link brand}.
|
|
@@ -3717,7 +3968,14 @@ type DistributeBrands<B> = UnionToIntersection<B extends infer U extends string
|
|
|
3717
3968
|
* @category branding
|
|
3718
3969
|
* @since 3.10.0
|
|
3719
3970
|
*/
|
|
3720
|
-
export interface brand<S extends
|
|
3971
|
+
export interface brand<S extends Constraint, B> extends BottomLazy<S["ast"], brand<S, B>, S["~type.parameters"], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
|
|
3972
|
+
readonly "Type": S["Type"] & DistributeBrands<B>;
|
|
3973
|
+
readonly "Encoded": S["Encoded"];
|
|
3974
|
+
readonly "DecodingServices": S["DecodingServices"];
|
|
3975
|
+
readonly "EncodingServices": S["EncodingServices"];
|
|
3976
|
+
readonly "~type.make.in": S["~type.make.in"];
|
|
3977
|
+
readonly "~type.make": S["Type"] & DistributeBrands<B>;
|
|
3978
|
+
readonly "Iso": S["Type"] & DistributeBrands<B>;
|
|
3721
3979
|
readonly schema: S;
|
|
3722
3980
|
readonly identifier: string;
|
|
3723
3981
|
}
|
|
@@ -3740,7 +3998,7 @@ export interface brand<S extends Top, B> extends Bottom<S["Type"] & DistributeBr
|
|
|
3740
3998
|
* @category branding
|
|
3741
3999
|
* @since 3.10.0
|
|
3742
4000
|
*/
|
|
3743
|
-
export declare function brand<B extends string>(identifier: B): <S extends
|
|
4001
|
+
export declare function brand<B extends string>(identifier: B): <S extends ConstraintRebuildable>(schema: S) => brand<S["Rebuild"], B>;
|
|
3744
4002
|
/**
|
|
3745
4003
|
* Creates a branded schema from a {@link Brand.Constructor}, applying the
|
|
3746
4004
|
* constructor's checks and brand tag to the underlying schema.
|
|
@@ -3757,7 +4015,14 @@ export declare function fromBrand<A extends Brand.Brand<any>>(identifier: string
|
|
|
3757
4015
|
* @category decoding
|
|
3758
4016
|
* @since 4.0.0
|
|
3759
4017
|
*/
|
|
3760
|
-
export interface middlewareDecoding<S extends
|
|
4018
|
+
export interface middlewareDecoding<S extends Constraint, RD> extends BottomLazy<S["ast"], middlewareDecoding<S, RD>, S["~type.parameters"], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
|
|
4019
|
+
readonly "Type": S["Type"];
|
|
4020
|
+
readonly "Encoded": S["Encoded"];
|
|
4021
|
+
readonly "DecodingServices": RD;
|
|
4022
|
+
readonly "EncodingServices": S["EncodingServices"];
|
|
4023
|
+
readonly "~type.make.in": S["~type.make.in"];
|
|
4024
|
+
readonly "~type.make": S["~type.make"];
|
|
4025
|
+
readonly "Iso": S["Iso"];
|
|
3761
4026
|
readonly schema: S;
|
|
3762
4027
|
}
|
|
3763
4028
|
/**
|
|
@@ -3785,14 +4050,21 @@ export interface middlewareDecoding<S extends Top, RD> extends Bottom<S["Type"],
|
|
|
3785
4050
|
* @category decoding
|
|
3786
4051
|
* @since 4.0.0
|
|
3787
4052
|
*/
|
|
3788
|
-
export declare function middlewareDecoding<S extends
|
|
4053
|
+
export declare function middlewareDecoding<S extends Constraint, RD>(decode: (effect: Effect.Effect<Option_.Option<S["Type"]>, SchemaIssue.Issue, S["DecodingServices"]>, options: SchemaAST.ParseOptions) => Effect.Effect<Option_.Option<S["Type"]>, SchemaIssue.Issue, RD>): (schema: S) => middlewareDecoding<S, RD>;
|
|
3789
4054
|
/**
|
|
3790
4055
|
* Type-level representation returned by {@link middlewareEncoding}.
|
|
3791
4056
|
*
|
|
3792
4057
|
* @category encoding
|
|
3793
4058
|
* @since 4.0.0
|
|
3794
4059
|
*/
|
|
3795
|
-
export interface middlewareEncoding<S extends
|
|
4060
|
+
export interface middlewareEncoding<S extends Constraint, RE> extends BottomLazy<S["ast"], middlewareEncoding<S, RE>, S["~type.parameters"], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
|
|
4061
|
+
readonly "Type": S["Type"];
|
|
4062
|
+
readonly "Encoded": S["Encoded"];
|
|
4063
|
+
readonly "DecodingServices": S["DecodingServices"];
|
|
4064
|
+
readonly "EncodingServices": RE;
|
|
4065
|
+
readonly "~type.make.in": S["~type.make.in"];
|
|
4066
|
+
readonly "~type.make": S["~type.make"];
|
|
4067
|
+
readonly "Iso": S["Iso"];
|
|
3796
4068
|
readonly schema: S;
|
|
3797
4069
|
}
|
|
3798
4070
|
/**
|
|
@@ -3820,7 +4092,7 @@ export interface middlewareEncoding<S extends Top, RE> extends Bottom<S["Type"],
|
|
|
3820
4092
|
* @category encoding
|
|
3821
4093
|
* @since 4.0.0
|
|
3822
4094
|
*/
|
|
3823
|
-
export declare function middlewareEncoding<S extends
|
|
4095
|
+
export declare function middlewareEncoding<S extends Constraint, RE>(encode: (effect: Effect.Effect<Option_.Option<S["Encoded"]>, SchemaIssue.Issue, S["EncodingServices"]>, options: SchemaAST.ParseOptions) => Effect.Effect<Option_.Option<S["Encoded"]>, SchemaIssue.Issue, RE>): (schema: S) => middlewareEncoding<S, RE>;
|
|
3824
4096
|
/**
|
|
3825
4097
|
* Recovers from a decoding error by providing a fallback value.
|
|
3826
4098
|
*
|
|
@@ -3843,7 +4115,7 @@ export declare function middlewareEncoding<S extends Top, RE>(encode: (effect: E
|
|
|
3843
4115
|
* @category error handling
|
|
3844
4116
|
* @since 4.0.0
|
|
3845
4117
|
*/
|
|
3846
|
-
export declare function catchDecoding<S extends
|
|
4118
|
+
export declare function catchDecoding<S extends Constraint>(f: (issue: SchemaIssue.Issue) => Effect.Effect<Option_.Option<S["Type"]>, SchemaIssue.Issue>): (self: S) => middlewareDecoding<S, S["DecodingServices"]>;
|
|
3847
4119
|
/**
|
|
3848
4120
|
* Recovers from a decoding error with a handler that may require Effect services.
|
|
3849
4121
|
*
|
|
@@ -3864,7 +4136,7 @@ export declare function catchDecoding<S extends Top>(f: (issue: SchemaIssue.Issu
|
|
|
3864
4136
|
* @category error handling
|
|
3865
4137
|
* @since 4.0.0
|
|
3866
4138
|
*/
|
|
3867
|
-
export declare function catchDecodingWithContext<S extends
|
|
4139
|
+
export declare function catchDecodingWithContext<S extends Constraint, R = never>(f: (issue: SchemaIssue.Issue) => Effect.Effect<Option_.Option<S["Type"]>, SchemaIssue.Issue, R>): (self: S) => middlewareDecoding<S, S["DecodingServices"] | R>;
|
|
3868
4140
|
/**
|
|
3869
4141
|
* Recovers from an encoding error by providing a fallback value.
|
|
3870
4142
|
*
|
|
@@ -3877,7 +4149,7 @@ export declare function catchDecodingWithContext<S extends Top, R = never>(f: (i
|
|
|
3877
4149
|
* @category error handling
|
|
3878
4150
|
* @since 4.0.0
|
|
3879
4151
|
*/
|
|
3880
|
-
export declare function catchEncoding<S extends
|
|
4152
|
+
export declare function catchEncoding<S extends Constraint>(f: (issue: SchemaIssue.Issue) => Effect.Effect<Option_.Option<S["Encoded"]>, SchemaIssue.Issue>): (self: S) => middlewareEncoding<S, S["EncodingServices"]>;
|
|
3881
4153
|
/**
|
|
3882
4154
|
* Recovers from an encoding error with a handler that may require Effect services.
|
|
3883
4155
|
*
|
|
@@ -3898,14 +4170,21 @@ export declare function catchEncoding<S extends Top>(f: (issue: SchemaIssue.Issu
|
|
|
3898
4170
|
* @category error handling
|
|
3899
4171
|
* @since 4.0.0
|
|
3900
4172
|
*/
|
|
3901
|
-
export declare function catchEncodingWithContext<S extends
|
|
4173
|
+
export declare function catchEncodingWithContext<S extends Constraint, R = never>(f: (issue: SchemaIssue.Issue) => Effect.Effect<Option_.Option<S["Encoded"]>, SchemaIssue.Issue, R>): (self: S) => middlewareEncoding<S, S["EncodingServices"] | R>;
|
|
3902
4174
|
/**
|
|
3903
4175
|
* Type-level representation returned by {@link decodeTo}.
|
|
3904
4176
|
*
|
|
3905
4177
|
* @category transforming
|
|
3906
4178
|
* @since 4.0.0
|
|
3907
4179
|
*/
|
|
3908
|
-
export interface decodeTo<To extends
|
|
4180
|
+
export interface decodeTo<To extends Constraint, From extends Constraint, RD = never, RE = never> extends BottomLazy<To["ast"], decodeTo<To, From, RD, RE>, To["~type.parameters"], To["~type.mutability"], To["~type.optionality"], To["~type.constructor.default"], From["~encoded.mutability"], From["~encoded.optionality"]> {
|
|
4181
|
+
readonly "Type": To["Type"];
|
|
4182
|
+
readonly "Encoded": From["Encoded"];
|
|
4183
|
+
readonly "DecodingServices": To["DecodingServices"] | From["DecodingServices"] | RD;
|
|
4184
|
+
readonly "EncodingServices": To["EncodingServices"] | From["EncodingServices"] | RE;
|
|
4185
|
+
readonly "~type.make.in": To["~type.make.in"];
|
|
4186
|
+
readonly "~type.make": To["~type.make"];
|
|
4187
|
+
readonly "Iso": To["Iso"];
|
|
3909
4188
|
readonly from: From;
|
|
3910
4189
|
readonly to: To;
|
|
3911
4190
|
}
|
|
@@ -3915,7 +4194,7 @@ export interface decodeTo<To extends Top, From extends Top, RD = never, RE = nev
|
|
|
3915
4194
|
* @category transforming
|
|
3916
4195
|
* @since 3.10.0
|
|
3917
4196
|
*/
|
|
3918
|
-
export interface compose<To extends
|
|
4197
|
+
export interface compose<To extends Constraint, From extends Constraint> extends decodeTo<To, From> {
|
|
3919
4198
|
}
|
|
3920
4199
|
/**
|
|
3921
4200
|
* Creates a schema that transforms from a source schema to a target schema.
|
|
@@ -3965,8 +4244,8 @@ export interface compose<To extends Top, From extends Top> extends decodeTo<To,
|
|
|
3965
4244
|
* @category transforming
|
|
3966
4245
|
* @since 4.0.0
|
|
3967
4246
|
*/
|
|
3968
|
-
export declare function decodeTo<To extends
|
|
3969
|
-
export declare function decodeTo<To extends
|
|
4247
|
+
export declare function decodeTo<To extends Constraint>(to: To): <From extends Constraint>(from: From) => compose<To, From>;
|
|
4248
|
+
export declare function decodeTo<To extends Constraint, From extends Constraint, RD = never, RE = never>(to: To, transformation: {
|
|
3970
4249
|
readonly decode: SchemaGetter.Getter<NoInfer<To["Encoded"]>, NoInfer<From["Type"]>, RD>;
|
|
3971
4250
|
readonly encode: SchemaGetter.Getter<NoInfer<From["Type"]>, NoInfer<To["Encoded"]>, RE>;
|
|
3972
4251
|
}): (from: From) => decodeTo<To, From, RD, RE>;
|
|
@@ -4013,7 +4292,7 @@ export declare function decodeTo<To extends Top, From extends Top, RD = never, R
|
|
|
4013
4292
|
* @category transforming
|
|
4014
4293
|
* @since 3.10.0
|
|
4015
4294
|
*/
|
|
4016
|
-
export declare function decode<S extends
|
|
4295
|
+
export declare function decode<S extends Constraint, RD = never, RE = never>(transformation: {
|
|
4017
4296
|
readonly decode: SchemaGetter.Getter<S["Type"], S["Type"], RD>;
|
|
4018
4297
|
readonly encode: SchemaGetter.Getter<S["Type"], S["Type"], RE>;
|
|
4019
4298
|
}): (self: S) => decodeTo<toType<S>, S, RD, RE>;
|
|
@@ -4046,8 +4325,8 @@ export declare function decode<S extends Top, RD = never, RE = never>(transforma
|
|
|
4046
4325
|
* @category transforming
|
|
4047
4326
|
* @since 4.0.0
|
|
4048
4327
|
*/
|
|
4049
|
-
export declare function encodeTo<To extends
|
|
4050
|
-
export declare function encodeTo<To extends
|
|
4328
|
+
export declare function encodeTo<To extends Constraint>(to: To): <From extends Constraint>(from: From) => decodeTo<From, To>;
|
|
4329
|
+
export declare function encodeTo<To extends Constraint, From extends Constraint, RD = never, RE = never>(to: To, transformation: {
|
|
4051
4330
|
readonly decode: SchemaGetter.Getter<NoInfer<From["Encoded"]>, NoInfer<To["Type"]>, RD>;
|
|
4052
4331
|
readonly encode: SchemaGetter.Getter<NoInfer<To["Type"]>, NoInfer<From["Encoded"]>, RE>;
|
|
4053
4332
|
}): (from: From) => decodeTo<From, To, RD, RE>;
|
|
@@ -4076,7 +4355,7 @@ export declare function encodeTo<To extends Top, From extends Top, RD = never, R
|
|
|
4076
4355
|
* @category transforming
|
|
4077
4356
|
* @since 3.10.0
|
|
4078
4357
|
*/
|
|
4079
|
-
export declare function encode<S extends
|
|
4358
|
+
export declare function encode<S extends Constraint, RD = never, RE = never>(transformation: {
|
|
4080
4359
|
readonly decode: SchemaGetter.Getter<S["Encoded"], S["Encoded"], RD>;
|
|
4081
4360
|
readonly encode: SchemaGetter.Getter<S["Encoded"], S["Encoded"], RE>;
|
|
4082
4361
|
}): (self: S) => decodeTo<S, toEncoded<S>, RD, RE>;
|
|
@@ -4099,7 +4378,14 @@ export interface WithoutConstructorDefault {
|
|
|
4099
4378
|
* @category constructors
|
|
4100
4379
|
* @since 3.10.0
|
|
4101
4380
|
*/
|
|
4102
|
-
export interface withConstructorDefault<S extends
|
|
4381
|
+
export interface withConstructorDefault<S extends Constraint & WithoutConstructorDefault> extends BottomLazy<S["ast"], withConstructorDefault<S>, S["~type.parameters"], S["~type.mutability"], S["~type.optionality"], "with-default", S["~encoded.mutability"], S["~encoded.optionality"]> {
|
|
4382
|
+
readonly "Type": S["Type"];
|
|
4383
|
+
readonly "Encoded": S["Encoded"];
|
|
4384
|
+
readonly "DecodingServices": S["DecodingServices"];
|
|
4385
|
+
readonly "EncodingServices": S["EncodingServices"];
|
|
4386
|
+
readonly "~type.make.in": S["~type.make.in"];
|
|
4387
|
+
readonly "~type.make": S["~type.make"];
|
|
4388
|
+
readonly "Iso": S["Iso"];
|
|
4103
4389
|
readonly schema: S;
|
|
4104
4390
|
}
|
|
4105
4391
|
/**
|
|
@@ -4129,14 +4415,14 @@ export interface withConstructorDefault<S extends Top & WithoutConstructorDefaul
|
|
|
4129
4415
|
* @category constructors
|
|
4130
4416
|
* @since 3.10.0
|
|
4131
4417
|
*/
|
|
4132
|
-
export declare function withConstructorDefault<S extends
|
|
4418
|
+
export declare function withConstructorDefault<S extends Constraint & WithoutConstructorDefault>(defaultValue: Effect.Effect<S["~type.make.in"], SchemaError>): (schema: S) => withConstructorDefault<S>;
|
|
4133
4419
|
/**
|
|
4134
4420
|
* Type-level representation returned by {@link withDecodingDefaultKey}.
|
|
4135
4421
|
*
|
|
4136
4422
|
* @category decoding
|
|
4137
4423
|
* @since 4.0.0
|
|
4138
4424
|
*/
|
|
4139
|
-
export interface withDecodingDefaultKey<S extends
|
|
4425
|
+
export interface withDecodingDefaultKey<S extends Constraint, R = never> extends decodeTo<S, optionalKey<toEncoded<S>>, R> {
|
|
4140
4426
|
readonly "Rebuild": withDecodingDefaultKey<S, R>;
|
|
4141
4427
|
}
|
|
4142
4428
|
/**
|
|
@@ -4188,14 +4474,14 @@ export type DecodingDefaultOptions = {
|
|
|
4188
4474
|
* @category decoding
|
|
4189
4475
|
* @since 4.0.0
|
|
4190
4476
|
*/
|
|
4191
|
-
export declare function withDecodingDefaultKey<S extends
|
|
4477
|
+
export declare function withDecodingDefaultKey<S extends Constraint, R = never>(defaultValue: Effect.Effect<S["Encoded"], SchemaError, R>, options?: DecodingDefaultOptions): (self: S) => withDecodingDefaultKey<S, R>;
|
|
4192
4478
|
/**
|
|
4193
4479
|
* Type-level representation returned by {@link withDecodingDefaultTypeKey}.
|
|
4194
4480
|
*
|
|
4195
4481
|
* @category decoding
|
|
4196
4482
|
* @since 4.0.0
|
|
4197
4483
|
*/
|
|
4198
|
-
export interface withDecodingDefaultTypeKey<S extends
|
|
4484
|
+
export interface withDecodingDefaultTypeKey<S extends Constraint, R = never> extends decodeTo<withDecodingDefaultKey<toType<S>, R>, optionalKey<S>> {
|
|
4199
4485
|
readonly "Rebuild": withDecodingDefaultTypeKey<S, R>;
|
|
4200
4486
|
}
|
|
4201
4487
|
/**
|
|
@@ -4220,14 +4506,14 @@ export interface withDecodingDefaultTypeKey<S extends Top, R = never> extends de
|
|
|
4220
4506
|
* @category decoding
|
|
4221
4507
|
* @since 4.0.0
|
|
4222
4508
|
*/
|
|
4223
|
-
export declare function withDecodingDefaultTypeKey<S extends
|
|
4509
|
+
export declare function withDecodingDefaultTypeKey<S extends Constraint, R = never>(defaultValue: Effect.Effect<S["Type"], SchemaError, R>, options?: DecodingDefaultOptions): (self: S) => withDecodingDefaultTypeKey<S, R>;
|
|
4224
4510
|
/**
|
|
4225
4511
|
* Type-level representation returned by {@link withDecodingDefault}.
|
|
4226
4512
|
*
|
|
4227
4513
|
* @category decoding
|
|
4228
4514
|
* @since 3.10.0
|
|
4229
4515
|
*/
|
|
4230
|
-
export interface withDecodingDefault<S extends
|
|
4516
|
+
export interface withDecodingDefault<S extends Constraint, R = never> extends decodeTo<S, optional<toEncoded<S>>, R> {
|
|
4231
4517
|
readonly "Rebuild": withDecodingDefault<S, R>;
|
|
4232
4518
|
}
|
|
4233
4519
|
/**
|
|
@@ -4269,14 +4555,14 @@ export interface withDecodingDefault<S extends Top, R = never> extends decodeTo<
|
|
|
4269
4555
|
* @category decoding
|
|
4270
4556
|
* @since 3.10.0
|
|
4271
4557
|
*/
|
|
4272
|
-
export declare function withDecodingDefault<S extends
|
|
4558
|
+
export declare function withDecodingDefault<S extends Constraint, R = never>(defaultValue: Effect.Effect<S["Encoded"], SchemaError, R>, options?: DecodingDefaultOptions): (self: S) => withDecodingDefault<S, R>;
|
|
4273
4559
|
/**
|
|
4274
4560
|
* Type-level representation returned by {@link withDecodingDefaultType}.
|
|
4275
4561
|
*
|
|
4276
4562
|
* @category decoding
|
|
4277
4563
|
* @since 4.0.0
|
|
4278
4564
|
*/
|
|
4279
|
-
export interface withDecodingDefaultType<S extends
|
|
4565
|
+
export interface withDecodingDefaultType<S extends Constraint, R = never> extends decodeTo<withDecodingDefault<toType<S>, R>, optional<S>> {
|
|
4280
4566
|
readonly "Rebuild": withDecodingDefaultType<S, R>;
|
|
4281
4567
|
}
|
|
4282
4568
|
/**
|
|
@@ -4306,7 +4592,7 @@ export interface withDecodingDefaultType<S extends Top, R = never> extends decod
|
|
|
4306
4592
|
* @category decoding
|
|
4307
4593
|
* @since 4.0.0
|
|
4308
4594
|
*/
|
|
4309
|
-
export declare function withDecodingDefaultType<S extends
|
|
4595
|
+
export declare function withDecodingDefaultType<S extends Constraint, R = never>(defaultValue: Effect.Effect<S["Type"], SchemaError, R>, options?: DecodingDefaultOptions): (self: S) => withDecodingDefaultType<S, R>;
|
|
4310
4596
|
/**
|
|
4311
4597
|
* Type-level representation returned by {@link tag}.
|
|
4312
4598
|
*
|
|
@@ -4431,11 +4717,11 @@ export declare function TaggedStruct<const Tag extends SchemaAST.LiteralValue, c
|
|
|
4431
4717
|
* Recursively flatten any nested Schema.Union members into a single tuple of leaf schemas.
|
|
4432
4718
|
*/
|
|
4433
4719
|
type Flatten<Schemas> = Schemas extends readonly [infer Head, ...infer Tail] ? Head extends Union<infer Inner> ? [...Flatten<Inner>, ...Flatten<Tail>] : [Head, ...Flatten<Tail>] : [];
|
|
4434
|
-
type TaggedUnionUtils<Tag extends PropertyKey, Members extends ReadonlyArray<
|
|
4720
|
+
type TaggedUnionUtils<Tag extends PropertyKey, Members extends ReadonlyArray<Constraint & {
|
|
4435
4721
|
readonly Type: {
|
|
4436
4722
|
readonly [K in Tag]: PropertyKey;
|
|
4437
4723
|
};
|
|
4438
|
-
}>, Flattened extends ReadonlyArray<
|
|
4724
|
+
}>, Flattened extends ReadonlyArray<Constraint & {
|
|
4439
4725
|
readonly Type: {
|
|
4440
4726
|
readonly [K in Tag]: PropertyKey;
|
|
4441
4727
|
};
|
|
@@ -4464,7 +4750,7 @@ type TaggedUnionUtils<Tag extends PropertyKey, Members extends ReadonlyArray<Top
|
|
|
4464
4750
|
* @category combinators
|
|
4465
4751
|
* @since 4.0.0
|
|
4466
4752
|
*/
|
|
4467
|
-
export type toTaggedUnion<Tag extends PropertyKey, Members extends ReadonlyArray<
|
|
4753
|
+
export type toTaggedUnion<Tag extends PropertyKey, Members extends ReadonlyArray<Constraint & {
|
|
4468
4754
|
readonly Type: {
|
|
4469
4755
|
readonly [K in Tag]: PropertyKey;
|
|
4470
4756
|
};
|
|
@@ -4493,7 +4779,7 @@ export type toTaggedUnion<Tag extends PropertyKey, Members extends ReadonlyArray
|
|
|
4493
4779
|
* @category combinators
|
|
4494
4780
|
* @since 4.0.0
|
|
4495
4781
|
*/
|
|
4496
|
-
export declare function toTaggedUnion<const Tag extends PropertyKey>(tag: Tag): <const Members extends ReadonlyArray<
|
|
4782
|
+
export declare function toTaggedUnion<const Tag extends PropertyKey>(tag: Tag): <const Members extends ReadonlyArray<Constraint & {
|
|
4497
4783
|
readonly Type: { readonly [K in Tag]: PropertyKey; };
|
|
4498
4784
|
}>>(self: Union<Members>) => toTaggedUnion<Tag, Members>;
|
|
4499
4785
|
/**
|
|
@@ -4502,17 +4788,28 @@ export declare function toTaggedUnion<const Tag extends PropertyKey>(tag: Tag):
|
|
|
4502
4788
|
* @category models
|
|
4503
4789
|
* @since 4.0.0
|
|
4504
4790
|
*/
|
|
4505
|
-
export interface TaggedUnion<Cases extends Record<string,
|
|
4506
|
-
|
|
4507
|
-
|
|
4508
|
-
[
|
|
4509
|
-
|
|
4510
|
-
|
|
4511
|
-
}[keyof Cases]
|
|
4512
|
-
|
|
4513
|
-
|
|
4514
|
-
[
|
|
4515
|
-
|
|
4791
|
+
export interface TaggedUnion<Cases extends Record<string, Constraint>> extends BottomLazy<SchemaAST.Union<SchemaAST.Objects>, TaggedUnion<Cases>> {
|
|
4792
|
+
readonly "Type": {
|
|
4793
|
+
[K in keyof Cases]: Cases[K]["Type"];
|
|
4794
|
+
}[keyof Cases];
|
|
4795
|
+
readonly "Encoded": {
|
|
4796
|
+
[K in keyof Cases]: Cases[K]["Encoded"];
|
|
4797
|
+
}[keyof Cases];
|
|
4798
|
+
readonly "DecodingServices": {
|
|
4799
|
+
[K in keyof Cases]: Cases[K]["DecodingServices"];
|
|
4800
|
+
}[keyof Cases];
|
|
4801
|
+
readonly "EncodingServices": {
|
|
4802
|
+
[K in keyof Cases]: Cases[K]["EncodingServices"];
|
|
4803
|
+
}[keyof Cases];
|
|
4804
|
+
readonly "~type.make.in": {
|
|
4805
|
+
[K in keyof Cases]: Cases[K]["~type.make"];
|
|
4806
|
+
}[keyof Cases];
|
|
4807
|
+
readonly "~type.make": {
|
|
4808
|
+
[K in keyof Cases]: Cases[K]["~type.make"];
|
|
4809
|
+
}[keyof Cases];
|
|
4810
|
+
readonly "Iso": {
|
|
4811
|
+
[K in keyof Cases]: Cases[K]["Type"];
|
|
4812
|
+
}[keyof Cases];
|
|
4516
4813
|
readonly cases: Cases;
|
|
4517
4814
|
readonly isAnyOf: <const Keys>(keys: ReadonlyArray<Keys>) => (value: Cases[keyof Cases]["Type"]) => value is Extract<Cases[keyof Cases]["Type"], {
|
|
4518
4815
|
_tag: Keys;
|
|
@@ -4564,7 +4861,14 @@ export declare function TaggedUnion<const CasesByTag extends Record<string, Stru
|
|
|
4564
4861
|
* @category models
|
|
4565
4862
|
* @since 4.0.0
|
|
4566
4863
|
*/
|
|
4567
|
-
export interface Opaque<Self, S extends Top, Brand> extends
|
|
4864
|
+
export interface Opaque<Self, S extends Top, Brand> extends BottomLazy<S["ast"], S["Rebuild"], S["~type.parameters"], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
|
|
4865
|
+
readonly "Type": Self;
|
|
4866
|
+
readonly "Encoded": S["Encoded"];
|
|
4867
|
+
readonly "DecodingServices": S["DecodingServices"];
|
|
4868
|
+
readonly "EncodingServices": S["EncodingServices"];
|
|
4869
|
+
readonly "~type.make.in": S["~type.make.in"];
|
|
4870
|
+
readonly "~type.make": S["~type.make"];
|
|
4871
|
+
readonly "Iso": S["Iso"];
|
|
4568
4872
|
new (_: never): S["Type"] & Brand;
|
|
4569
4873
|
}
|
|
4570
4874
|
/**
|
|
@@ -4627,7 +4931,7 @@ export declare function instanceOf<C extends abstract new (...args: any) => any,
|
|
|
4627
4931
|
* @category transforming
|
|
4628
4932
|
* @since 4.0.0
|
|
4629
4933
|
*/
|
|
4630
|
-
export declare function link<T>(): <To extends
|
|
4934
|
+
export declare function link<T>(): <To extends Constraint>(encodeTo: To, transformation: {
|
|
4631
4935
|
readonly decode: SchemaGetter.Getter<T, NoInfer<To["Type"]>>;
|
|
4632
4936
|
readonly encode: SchemaGetter.Getter<NoInfer<To["Type"]>, T>;
|
|
4633
4937
|
}) => SchemaAST.Link;
|
|
@@ -5817,7 +6121,7 @@ export declare function isPropertiesLengthBetween(minimum: number, maximum: numb
|
|
|
5817
6121
|
* @category Object checks
|
|
5818
6122
|
* @since 4.0.0
|
|
5819
6123
|
*/
|
|
5820
|
-
export declare function isPropertyNames(keySchema:
|
|
6124
|
+
export declare function isPropertyNames(keySchema: Constraint, annotations?: Annotations.Filter): SchemaAST.Filter<object>;
|
|
5821
6125
|
/**
|
|
5822
6126
|
* Validates that all items in an array are unique according to Effect equality.
|
|
5823
6127
|
*
|
|
@@ -5887,7 +6191,7 @@ export declare const Char: Char;
|
|
|
5887
6191
|
* @category Option
|
|
5888
6192
|
* @since 3.10.0
|
|
5889
6193
|
*/
|
|
5890
|
-
export interface Option<A extends
|
|
6194
|
+
export interface Option<A extends Constraint> extends declareConstructor<Option_.Option<A["Type"]>, Option_.Option<A["Encoded"]>, readonly [A], OptionIso<A>> {
|
|
5891
6195
|
readonly "Rebuild": Option<A>;
|
|
5892
6196
|
readonly value: A;
|
|
5893
6197
|
}
|
|
@@ -5902,7 +6206,7 @@ export interface Option<A extends Top> extends declareConstructor<Option_.Option
|
|
|
5902
6206
|
* @category Option
|
|
5903
6207
|
* @since 4.0.0
|
|
5904
6208
|
*/
|
|
5905
|
-
export type OptionIso<A extends
|
|
6209
|
+
export type OptionIso<A extends Constraint> = {
|
|
5906
6210
|
readonly _tag: "None";
|
|
5907
6211
|
} | {
|
|
5908
6212
|
readonly _tag: "Some";
|
|
@@ -5914,14 +6218,14 @@ export type OptionIso<A extends Top> = {
|
|
|
5914
6218
|
* @category Option
|
|
5915
6219
|
* @since 3.10.0
|
|
5916
6220
|
*/
|
|
5917
|
-
export declare function Option<A extends
|
|
6221
|
+
export declare function Option<A extends Constraint>(value: A): Option<A>;
|
|
5918
6222
|
/**
|
|
5919
6223
|
* Type-level representation returned by {@link OptionFromNullOr}.
|
|
5920
6224
|
*
|
|
5921
6225
|
* @category Option
|
|
5922
6226
|
* @since 3.10.0
|
|
5923
6227
|
*/
|
|
5924
|
-
export interface OptionFromNullOr<S extends
|
|
6228
|
+
export interface OptionFromNullOr<S extends Constraint> extends decodeTo<Option<toType<S>>, NullOr<S>> {
|
|
5925
6229
|
readonly "Rebuild": OptionFromNullOr<S>;
|
|
5926
6230
|
}
|
|
5927
6231
|
/**
|
|
@@ -5935,14 +6239,14 @@ export interface OptionFromNullOr<S extends Top> extends decodeTo<Option<toType<
|
|
|
5935
6239
|
* @category Option
|
|
5936
6240
|
* @since 3.10.0
|
|
5937
6241
|
*/
|
|
5938
|
-
export declare function OptionFromNullOr<S extends
|
|
6242
|
+
export declare function OptionFromNullOr<S extends Constraint>(schema: S): OptionFromNullOr<S>;
|
|
5939
6243
|
/**
|
|
5940
6244
|
* Type-level representation returned by {@link OptionFromUndefinedOr}.
|
|
5941
6245
|
*
|
|
5942
6246
|
* @category Option
|
|
5943
6247
|
* @since 3.10.0
|
|
5944
6248
|
*/
|
|
5945
|
-
export interface OptionFromUndefinedOr<S extends
|
|
6249
|
+
export interface OptionFromUndefinedOr<S extends Constraint> extends decodeTo<Option<toType<S>>, UndefinedOr<S>> {
|
|
5946
6250
|
readonly "Rebuild": OptionFromUndefinedOr<S>;
|
|
5947
6251
|
}
|
|
5948
6252
|
/**
|
|
@@ -5957,14 +6261,14 @@ export interface OptionFromUndefinedOr<S extends Top> extends decodeTo<Option<to
|
|
|
5957
6261
|
* @category Option
|
|
5958
6262
|
* @since 3.10.0
|
|
5959
6263
|
*/
|
|
5960
|
-
export declare function OptionFromUndefinedOr<S extends
|
|
6264
|
+
export declare function OptionFromUndefinedOr<S extends Constraint>(schema: S): OptionFromUndefinedOr<S>;
|
|
5961
6265
|
/**
|
|
5962
6266
|
* Type-level representation returned by {@link OptionFromNullishOr}.
|
|
5963
6267
|
*
|
|
5964
6268
|
* @category Option
|
|
5965
6269
|
* @since 3.10.0
|
|
5966
6270
|
*/
|
|
5967
|
-
export interface OptionFromNullishOr<S extends
|
|
6271
|
+
export interface OptionFromNullishOr<S extends Constraint> extends decodeTo<Option<toType<S>>, NullishOr<S>> {
|
|
5968
6272
|
readonly "Rebuild": OptionFromNullishOr<S>;
|
|
5969
6273
|
}
|
|
5970
6274
|
/**
|
|
@@ -5980,7 +6284,7 @@ export interface OptionFromNullishOr<S extends Top> extends decodeTo<Option<toTy
|
|
|
5980
6284
|
* @category Option
|
|
5981
6285
|
* @since 3.10.0
|
|
5982
6286
|
*/
|
|
5983
|
-
export declare function OptionFromNullishOr<S extends
|
|
6287
|
+
export declare function OptionFromNullishOr<S extends Constraint>(schema: S, options?: {
|
|
5984
6288
|
onNoneEncoding: null | undefined;
|
|
5985
6289
|
}): OptionFromNullishOr<S>;
|
|
5986
6290
|
/**
|
|
@@ -5989,7 +6293,7 @@ export declare function OptionFromNullishOr<S extends Top>(schema: S, options?:
|
|
|
5989
6293
|
* @category Option
|
|
5990
6294
|
* @since 4.0.0
|
|
5991
6295
|
*/
|
|
5992
|
-
export interface OptionFromOptionalKey<S extends
|
|
6296
|
+
export interface OptionFromOptionalKey<S extends Constraint> extends decodeTo<Option<toType<S>>, optionalKey<S>> {
|
|
5993
6297
|
readonly "Rebuild": OptionFromOptionalKey<S>;
|
|
5994
6298
|
}
|
|
5995
6299
|
/**
|
|
@@ -6003,14 +6307,14 @@ export interface OptionFromOptionalKey<S extends Top> extends decodeTo<Option<to
|
|
|
6003
6307
|
* @category Option
|
|
6004
6308
|
* @since 4.0.0
|
|
6005
6309
|
*/
|
|
6006
|
-
export declare function OptionFromOptionalKey<S extends
|
|
6310
|
+
export declare function OptionFromOptionalKey<S extends Constraint>(schema: S): OptionFromOptionalKey<S>;
|
|
6007
6311
|
/**
|
|
6008
6312
|
* Type-level representation returned by {@link OptionFromOptional}.
|
|
6009
6313
|
*
|
|
6010
6314
|
* @category Option
|
|
6011
6315
|
* @since 4.0.0
|
|
6012
6316
|
*/
|
|
6013
|
-
export interface OptionFromOptional<S extends
|
|
6317
|
+
export interface OptionFromOptional<S extends Constraint> extends decodeTo<Option<toType<S>>, optional<S>> {
|
|
6014
6318
|
readonly "Rebuild": OptionFromOptional<S>;
|
|
6015
6319
|
}
|
|
6016
6320
|
/**
|
|
@@ -6026,14 +6330,14 @@ export interface OptionFromOptional<S extends Top> extends decodeTo<Option<toTyp
|
|
|
6026
6330
|
* @category Option
|
|
6027
6331
|
* @since 4.0.0
|
|
6028
6332
|
*/
|
|
6029
|
-
export declare function OptionFromOptional<S extends
|
|
6333
|
+
export declare function OptionFromOptional<S extends Constraint>(schema: S): OptionFromOptional<S>;
|
|
6030
6334
|
/**
|
|
6031
6335
|
* Type-level representation returned by {@link OptionFromOptionalNullOr}.
|
|
6032
6336
|
*
|
|
6033
6337
|
* @category Option
|
|
6034
6338
|
* @since 4.0.0
|
|
6035
6339
|
*/
|
|
6036
|
-
export interface OptionFromOptionalNullOr<S extends
|
|
6340
|
+
export interface OptionFromOptionalNullOr<S extends Constraint> extends decodeTo<Option<toType<S>>, optional<NullOr<S>>> {
|
|
6037
6341
|
readonly "Rebuild": OptionFromOptionalNullOr<S>;
|
|
6038
6342
|
}
|
|
6039
6343
|
/**
|
|
@@ -6050,7 +6354,7 @@ export interface OptionFromOptionalNullOr<S extends Top> extends decodeTo<Option
|
|
|
6050
6354
|
* @category Option
|
|
6051
6355
|
* @since 4.0.0
|
|
6052
6356
|
*/
|
|
6053
|
-
export declare function OptionFromOptionalNullOr<S extends
|
|
6357
|
+
export declare function OptionFromOptionalNullOr<S extends Constraint>(schema: S, options?: {
|
|
6054
6358
|
readonly onNoneEncoding: "omit" | null | undefined;
|
|
6055
6359
|
}): OptionFromOptionalNullOr<S>;
|
|
6056
6360
|
/**
|
|
@@ -6059,7 +6363,7 @@ export declare function OptionFromOptionalNullOr<S extends Top>(schema: S, optio
|
|
|
6059
6363
|
* @category schemas
|
|
6060
6364
|
* @since 4.0.0
|
|
6061
6365
|
*/
|
|
6062
|
-
export interface Result<A extends
|
|
6366
|
+
export interface Result<A extends Constraint, E extends Constraint> extends declareConstructor<Result_.Result<A["Type"], E["Type"]>, Result_.Result<A["Encoded"], E["Encoded"]>, readonly [A, E], ResultIso<A, E>> {
|
|
6063
6367
|
readonly "Rebuild": Result<A, E>;
|
|
6064
6368
|
readonly success: A;
|
|
6065
6369
|
readonly failure: E;
|
|
@@ -6075,7 +6379,7 @@ export interface Result<A extends Top, E extends Top> extends declareConstructor
|
|
|
6075
6379
|
* @category schemas
|
|
6076
6380
|
* @since 4.0.0
|
|
6077
6381
|
*/
|
|
6078
|
-
export type ResultIso<A extends
|
|
6382
|
+
export type ResultIso<A extends Constraint, E extends Constraint> = {
|
|
6079
6383
|
readonly _tag: "Success";
|
|
6080
6384
|
readonly success: A["Iso"];
|
|
6081
6385
|
} | {
|
|
@@ -6088,14 +6392,14 @@ export type ResultIso<A extends Top, E extends Top> = {
|
|
|
6088
6392
|
* @category schemas
|
|
6089
6393
|
* @since 4.0.0
|
|
6090
6394
|
*/
|
|
6091
|
-
export declare function Result<A extends
|
|
6395
|
+
export declare function Result<A extends Constraint, E extends Constraint>(success: A, failure: E): Result<A, E>;
|
|
6092
6396
|
/**
|
|
6093
6397
|
* Type-level representation returned by {@link Redacted}.
|
|
6094
6398
|
*
|
|
6095
6399
|
* @category Redacted
|
|
6096
6400
|
* @since 3.10.0
|
|
6097
6401
|
*/
|
|
6098
|
-
export interface Redacted<S extends
|
|
6402
|
+
export interface Redacted<S extends Constraint> extends declareConstructor<Redacted_.Redacted<S["Type"]>, Redacted_.Redacted<S["Encoded"]>, readonly [S]> {
|
|
6099
6403
|
readonly "Rebuild": Redacted<S>;
|
|
6100
6404
|
readonly value: S;
|
|
6101
6405
|
}
|
|
@@ -6119,10 +6423,11 @@ export interface Redacted<S extends Top> extends declareConstructor<Redacted_.Re
|
|
|
6119
6423
|
* into JSON, it will fail with an error. This is useful when the wrapped schema is
|
|
6120
6424
|
* sensitive and should not be exposed in JSON.
|
|
6121
6425
|
*
|
|
6426
|
+
* @see {@link RedactedFromValue} for decoding raw values and wrapping them in `Redacted`.
|
|
6122
6427
|
* @category Redacted
|
|
6123
6428
|
* @since 3.10.0
|
|
6124
6429
|
*/
|
|
6125
|
-
export declare function Redacted<S extends
|
|
6430
|
+
export declare function Redacted<S extends Constraint>(value: S, options?: {
|
|
6126
6431
|
readonly label?: string | undefined;
|
|
6127
6432
|
readonly disallowJsonEncode?: boolean | undefined;
|
|
6128
6433
|
}): Redacted<S>;
|
|
@@ -6132,7 +6437,7 @@ export declare function Redacted<S extends Top>(value: S, options?: {
|
|
|
6132
6437
|
* @category Redacted
|
|
6133
6438
|
* @since 4.0.0
|
|
6134
6439
|
*/
|
|
6135
|
-
export interface RedactedFromValue<S extends
|
|
6440
|
+
export interface RedactedFromValue<S extends Constraint> extends decodeTo<Redacted<toType<S>>, middlewareDecoding<S, S["DecodingServices"]>> {
|
|
6136
6441
|
readonly "Rebuild": RedactedFromValue<S>;
|
|
6137
6442
|
}
|
|
6138
6443
|
/**
|
|
@@ -6142,16 +6447,17 @@ export interface RedactedFromValue<S extends Top> extends decodeTo<Redacted<toTy
|
|
|
6142
6447
|
* @category Redacted
|
|
6143
6448
|
* @since 4.0.0
|
|
6144
6449
|
*/
|
|
6145
|
-
export declare function redact<S extends
|
|
6450
|
+
export declare function redact<S extends Constraint>(schema: S): middlewareDecoding<S, S["DecodingServices"]>;
|
|
6146
6451
|
/**
|
|
6147
6452
|
* Decodes a value and wraps it in `Redacted<A>`. Unlike {@link Redacted} which
|
|
6148
6453
|
* expects the input to already be a `Redacted` instance, this schema decodes
|
|
6149
6454
|
* the raw value and wraps it.
|
|
6150
6455
|
*
|
|
6456
|
+
* @see {@link Redacted} for schemas whose input is already a `Redacted` value.
|
|
6151
6457
|
* @category Redacted
|
|
6152
6458
|
* @since 4.0.0
|
|
6153
6459
|
*/
|
|
6154
|
-
export declare function RedactedFromValue<S extends
|
|
6460
|
+
export declare function RedactedFromValue<S extends Constraint>(value: S, options?: {
|
|
6155
6461
|
readonly label?: string | undefined;
|
|
6156
6462
|
readonly disallowEncode?: boolean | undefined;
|
|
6157
6463
|
}): RedactedFromValue<S>;
|
|
@@ -6161,7 +6467,7 @@ export declare function RedactedFromValue<S extends Top>(value: S, options?: {
|
|
|
6161
6467
|
* @category CauseReason
|
|
6162
6468
|
* @since 4.0.0
|
|
6163
6469
|
*/
|
|
6164
|
-
export interface CauseReason<E extends
|
|
6470
|
+
export interface CauseReason<E extends Constraint, D extends Constraint> extends declareConstructor<Cause_.Reason<E["Type"]>, Cause_.Reason<E["Encoded"]>, readonly [E, D], CauseReasonIso<E, D>> {
|
|
6165
6471
|
readonly "Rebuild": CauseReason<E, D>;
|
|
6166
6472
|
readonly error: E;
|
|
6167
6473
|
readonly defect: D;
|
|
@@ -6177,7 +6483,7 @@ export interface CauseReason<E extends Top, D extends Top> extends declareConstr
|
|
|
6177
6483
|
* @category CauseReason
|
|
6178
6484
|
* @since 4.0.0
|
|
6179
6485
|
*/
|
|
6180
|
-
export type CauseReasonIso<E extends
|
|
6486
|
+
export type CauseReasonIso<E extends Constraint, D extends Constraint> = {
|
|
6181
6487
|
readonly _tag: "Fail";
|
|
6182
6488
|
readonly error: E["Iso"];
|
|
6183
6489
|
} | {
|
|
@@ -6207,14 +6513,14 @@ export type CauseReasonIso<E extends Top, D extends Top> = {
|
|
|
6207
6513
|
* @category CauseReason
|
|
6208
6514
|
* @since 4.0.0
|
|
6209
6515
|
*/
|
|
6210
|
-
export declare function CauseReason<E extends
|
|
6516
|
+
export declare function CauseReason<E extends Constraint, D extends Constraint>(error: E, defect: D): CauseReason<E, D>;
|
|
6211
6517
|
/**
|
|
6212
6518
|
* Type-level representation returned by {@link Cause}.
|
|
6213
6519
|
*
|
|
6214
6520
|
* @category Cause
|
|
6215
6521
|
* @since 3.10.0
|
|
6216
6522
|
*/
|
|
6217
|
-
export interface Cause<E extends
|
|
6523
|
+
export interface Cause<E extends Constraint, D extends Constraint> extends declareConstructor<Cause_.Cause<E["Type"]>, Cause_.Cause<E["Encoded"]>, readonly [E, D], CauseIso<E, D>> {
|
|
6218
6524
|
readonly "Rebuild": Cause<E, D>;
|
|
6219
6525
|
readonly error: E;
|
|
6220
6526
|
readonly defect: D;
|
|
@@ -6234,7 +6540,7 @@ export interface Cause<E extends Top, D extends Top> extends declareConstructor<
|
|
|
6234
6540
|
* @category Cause
|
|
6235
6541
|
* @since 4.0.0
|
|
6236
6542
|
*/
|
|
6237
|
-
export type CauseIso<E extends
|
|
6543
|
+
export type CauseIso<E extends Constraint, D extends Constraint> = ReadonlyArray<CauseReasonIso<E, D>>;
|
|
6238
6544
|
/**
|
|
6239
6545
|
* Creates a schema for `Cause` values using separate schemas for typed failures
|
|
6240
6546
|
* and unexpected defects.
|
|
@@ -6256,7 +6562,7 @@ export type CauseIso<E extends Top, D extends Top> = ReadonlyArray<CauseReasonIs
|
|
|
6256
6562
|
* @category Cause
|
|
6257
6563
|
* @since 3.10.0
|
|
6258
6564
|
*/
|
|
6259
|
-
export declare function Cause<E extends
|
|
6565
|
+
export declare function Cause<E extends Constraint, D extends Constraint>(error: E, defect: D): Cause<E, D>;
|
|
6260
6566
|
/**
|
|
6261
6567
|
* Type-level representation of {@link Error}.
|
|
6262
6568
|
*
|
|
@@ -6360,7 +6666,7 @@ export declare function Defect(options?: ErrorOptions): Defect;
|
|
|
6360
6666
|
* @category Exit
|
|
6361
6667
|
* @since 3.10.0
|
|
6362
6668
|
*/
|
|
6363
|
-
export interface Exit<A extends
|
|
6669
|
+
export interface Exit<A extends Constraint, E extends Constraint, D extends Constraint> extends declareConstructor<Exit_.Exit<A["Type"], E["Type"]>, Exit_.Exit<A["Encoded"], E["Encoded"]>, readonly [A, E, D], ExitIso<A, E, D>> {
|
|
6364
6670
|
readonly "Rebuild": Exit<A, E, D>;
|
|
6365
6671
|
readonly value: A;
|
|
6366
6672
|
readonly error: E;
|
|
@@ -6377,7 +6683,7 @@ export interface Exit<A extends Top, E extends Top, D extends Top> extends decla
|
|
|
6377
6683
|
* @category Exit
|
|
6378
6684
|
* @since 4.0.0
|
|
6379
6685
|
*/
|
|
6380
|
-
export type ExitIso<A extends
|
|
6686
|
+
export type ExitIso<A extends Constraint, E extends Constraint, D extends Constraint> = {
|
|
6381
6687
|
readonly _tag: "Success";
|
|
6382
6688
|
readonly value: A["Iso"];
|
|
6383
6689
|
} | {
|
|
@@ -6396,14 +6702,14 @@ export type ExitIso<A extends Top, E extends Top, D extends Top> = {
|
|
|
6396
6702
|
* @category Exit
|
|
6397
6703
|
* @since 3.10.0
|
|
6398
6704
|
*/
|
|
6399
|
-
export declare function Exit<A extends
|
|
6705
|
+
export declare function Exit<A extends Constraint, E extends Constraint, D extends Constraint>(value: A, error: E, defect: D): Exit<A, E, D>;
|
|
6400
6706
|
/**
|
|
6401
6707
|
* Type-level representation returned by {@link ReadonlyMap}.
|
|
6402
6708
|
*
|
|
6403
6709
|
* @category ReadonlyMap
|
|
6404
6710
|
* @since 4.0.0
|
|
6405
6711
|
*/
|
|
6406
|
-
export interface $ReadonlyMap<Key extends
|
|
6712
|
+
export interface $ReadonlyMap<Key extends Constraint, Value extends Constraint> extends declareConstructor<globalThis.ReadonlyMap<Key["Type"], Value["Type"]>, globalThis.ReadonlyMap<Key["Encoded"], Value["Encoded"]>, readonly [Key, Value], ReadonlyMapIso<Key, Value>> {
|
|
6407
6713
|
readonly "Rebuild": $ReadonlyMap<Key, Value>;
|
|
6408
6714
|
readonly key: Key;
|
|
6409
6715
|
readonly value: Value;
|
|
@@ -6415,7 +6721,7 @@ export interface $ReadonlyMap<Key extends Top, Value extends Top> extends declar
|
|
|
6415
6721
|
* @category ReadonlyMap
|
|
6416
6722
|
* @since 4.0.0
|
|
6417
6723
|
*/
|
|
6418
|
-
export type ReadonlyMapIso<Key extends
|
|
6724
|
+
export type ReadonlyMapIso<Key extends Constraint, Value extends Constraint> = ReadonlyArray<readonly [Key["Iso"], Value["Iso"]]>;
|
|
6419
6725
|
/**
|
|
6420
6726
|
* Schema for readonly maps whose keys and values conform to the provided
|
|
6421
6727
|
* schemas.
|
|
@@ -6423,14 +6729,14 @@ export type ReadonlyMapIso<Key extends Top, Value extends Top> = ReadonlyArray<r
|
|
|
6423
6729
|
* @category ReadonlyMap
|
|
6424
6730
|
* @since 3.10.0
|
|
6425
6731
|
*/
|
|
6426
|
-
export declare function ReadonlyMap<Key extends
|
|
6732
|
+
export declare function ReadonlyMap<Key extends Constraint, Value extends Constraint>(key: Key, value: Value): $ReadonlyMap<Key, Value>;
|
|
6427
6733
|
/**
|
|
6428
6734
|
* Type-level representation returned by {@link HashMap}.
|
|
6429
6735
|
*
|
|
6430
6736
|
* @category HashMap
|
|
6431
6737
|
* @since 3.10.0
|
|
6432
6738
|
*/
|
|
6433
|
-
export interface HashMap<Key extends
|
|
6739
|
+
export interface HashMap<Key extends Constraint, Value extends Constraint> extends declareConstructor<HashMap_.HashMap<Key["Type"], Value["Type"]>, HashMap_.HashMap<Key["Encoded"], Value["Encoded"]>, readonly [Key, Value], HashMapIso<Key, Value>> {
|
|
6434
6740
|
readonly "Rebuild": HashMap<Key, Value>;
|
|
6435
6741
|
readonly key: Key;
|
|
6436
6742
|
readonly value: Value;
|
|
@@ -6442,21 +6748,21 @@ export interface HashMap<Key extends Top, Value extends Top> extends declareCons
|
|
|
6442
6748
|
* @category HashMap
|
|
6443
6749
|
* @since 4.0.0
|
|
6444
6750
|
*/
|
|
6445
|
-
export type HashMapIso<Key extends
|
|
6751
|
+
export type HashMapIso<Key extends Constraint, Value extends Constraint> = ReadonlyArray<readonly [Key["Iso"], Value["Iso"]]>;
|
|
6446
6752
|
/**
|
|
6447
6753
|
* Schema for hash maps whose keys and values conform to the provided schemas.
|
|
6448
6754
|
*
|
|
6449
6755
|
* @category HashMap
|
|
6450
6756
|
* @since 3.10.0
|
|
6451
6757
|
*/
|
|
6452
|
-
export declare function HashMap<Key extends
|
|
6758
|
+
export declare function HashMap<Key extends Constraint, Value extends Constraint>(key: Key, value: Value): HashMap<Key, Value>;
|
|
6453
6759
|
/**
|
|
6454
6760
|
* Type-level representation returned by {@link ReadonlySet}.
|
|
6455
6761
|
*
|
|
6456
6762
|
* @category ReadonlySet
|
|
6457
6763
|
* @since 4.0.0
|
|
6458
6764
|
*/
|
|
6459
|
-
export interface $ReadonlySet<Value extends
|
|
6765
|
+
export interface $ReadonlySet<Value extends Constraint> extends declareConstructor<globalThis.ReadonlySet<Value["Type"]>, globalThis.ReadonlySet<Value["Encoded"]>, readonly [Value], ReadonlySetIso<Value>> {
|
|
6460
6766
|
readonly "Rebuild": $ReadonlySet<Value>;
|
|
6461
6767
|
readonly value: Value;
|
|
6462
6768
|
}
|
|
@@ -6467,21 +6773,21 @@ export interface $ReadonlySet<Value extends Top> extends declareConstructor<glob
|
|
|
6467
6773
|
* @category ReadonlySet
|
|
6468
6774
|
* @since 4.0.0
|
|
6469
6775
|
*/
|
|
6470
|
-
export type ReadonlySetIso<Value extends
|
|
6776
|
+
export type ReadonlySetIso<Value extends Constraint> = ReadonlyArray<Value["Iso"]>;
|
|
6471
6777
|
/**
|
|
6472
6778
|
* Schema for readonly sets whose values conform to the provided element schema.
|
|
6473
6779
|
*
|
|
6474
6780
|
* @category ReadonlySet
|
|
6475
6781
|
* @since 3.10.0
|
|
6476
6782
|
*/
|
|
6477
|
-
export declare function ReadonlySet<Value extends
|
|
6783
|
+
export declare function ReadonlySet<Value extends Constraint>(value: Value): $ReadonlySet<Value>;
|
|
6478
6784
|
/**
|
|
6479
6785
|
* Type-level representation returned by {@link HashSet}.
|
|
6480
6786
|
*
|
|
6481
6787
|
* @category HashSet
|
|
6482
6788
|
* @since 3.10.0
|
|
6483
6789
|
*/
|
|
6484
|
-
export interface HashSet<Value extends
|
|
6790
|
+
export interface HashSet<Value extends Constraint> extends declareConstructor<HashSet_.HashSet<Value["Type"]>, HashSet_.HashSet<Value["Encoded"]>, readonly [Value], HashSetIso<Value>> {
|
|
6485
6791
|
readonly "Rebuild": HashSet<Value>;
|
|
6486
6792
|
readonly value: Value;
|
|
6487
6793
|
}
|
|
@@ -6492,21 +6798,21 @@ export interface HashSet<Value extends Top> extends declareConstructor<HashSet_.
|
|
|
6492
6798
|
* @category HashSet
|
|
6493
6799
|
* @since 4.0.0
|
|
6494
6800
|
*/
|
|
6495
|
-
export type HashSetIso<Value extends
|
|
6801
|
+
export type HashSetIso<Value extends Constraint> = ReadonlyArray<Value["Iso"]>;
|
|
6496
6802
|
/**
|
|
6497
6803
|
* Schema for hash sets whose values conform to the provided element schema.
|
|
6498
6804
|
*
|
|
6499
6805
|
* @category HashSet
|
|
6500
6806
|
* @since 3.10.0
|
|
6501
6807
|
*/
|
|
6502
|
-
export declare function HashSet<Value extends
|
|
6808
|
+
export declare function HashSet<Value extends Constraint>(value: Value): HashSet<Value>;
|
|
6503
6809
|
/**
|
|
6504
6810
|
* Type-level representation returned by {@link Chunk}.
|
|
6505
6811
|
*
|
|
6506
6812
|
* @category Chunk
|
|
6507
6813
|
* @since 3.10.0
|
|
6508
6814
|
*/
|
|
6509
|
-
export interface Chunk<Value extends
|
|
6815
|
+
export interface Chunk<Value extends Constraint> extends declareConstructor<Chunk_.Chunk<Value["Type"]>, Chunk_.Chunk<Value["Encoded"]>, readonly [Value], ChunkIso<Value>> {
|
|
6510
6816
|
readonly "Rebuild": Chunk<Value>;
|
|
6511
6817
|
readonly value: Value;
|
|
6512
6818
|
}
|
|
@@ -6524,14 +6830,14 @@ export interface Chunk<Value extends Top> extends declareConstructor<Chunk_.Chun
|
|
|
6524
6830
|
* @category Chunk
|
|
6525
6831
|
* @since 4.0.0
|
|
6526
6832
|
*/
|
|
6527
|
-
export type ChunkIso<Value extends
|
|
6833
|
+
export type ChunkIso<Value extends Constraint> = ReadonlyArray<Value["Iso"]>;
|
|
6528
6834
|
/**
|
|
6529
6835
|
* Schema for chunks whose values conform to the provided element schema.
|
|
6530
6836
|
*
|
|
6531
6837
|
* @category Chunk
|
|
6532
6838
|
* @since 3.10.0
|
|
6533
6839
|
*/
|
|
6534
|
-
export declare function Chunk<Value extends
|
|
6840
|
+
export declare function Chunk<Value extends Constraint>(value: Value): Chunk<Value>;
|
|
6535
6841
|
/**
|
|
6536
6842
|
* Type-level representation of {@link RegExp}.
|
|
6537
6843
|
*
|
|
@@ -6912,7 +7218,7 @@ export declare const UnknownFromJsonString: UnknownFromJsonString;
|
|
|
6912
7218
|
* @category models
|
|
6913
7219
|
* @since 4.0.0
|
|
6914
7220
|
*/
|
|
6915
|
-
export interface fromJsonString<S extends
|
|
7221
|
+
export interface fromJsonString<S extends Constraint> extends decodeTo<S, String> {
|
|
6916
7222
|
readonly "Rebuild": fromJsonString<S>;
|
|
6917
7223
|
}
|
|
6918
7224
|
/**
|
|
@@ -6981,7 +7287,7 @@ export interface fromJsonString<S extends Top> extends decodeTo<S, String> {
|
|
|
6981
7287
|
* @category constructors
|
|
6982
7288
|
* @since 4.0.0
|
|
6983
7289
|
*/
|
|
6984
|
-
export declare function fromJsonString<S extends
|
|
7290
|
+
export declare function fromJsonString<S extends Constraint>(schema: S): fromJsonString<S>;
|
|
6985
7291
|
/**
|
|
6986
7292
|
* Type-level representation of {@link File}.
|
|
6987
7293
|
*
|
|
@@ -7030,7 +7336,7 @@ export declare const FormData: FormData;
|
|
|
7030
7336
|
* @category FormData
|
|
7031
7337
|
* @since 4.0.0
|
|
7032
7338
|
*/
|
|
7033
|
-
export interface fromFormData<S extends
|
|
7339
|
+
export interface fromFormData<S extends Constraint> extends decodeTo<S, FormData> {
|
|
7034
7340
|
readonly "Rebuild": fromFormData<S>;
|
|
7035
7341
|
}
|
|
7036
7342
|
/**
|
|
@@ -7049,10 +7355,8 @@ export interface fromFormData<S extends Top> extends decodeTo<S, FormData> {
|
|
|
7049
7355
|
*
|
|
7050
7356
|
* You can express nested values using bracket notation.
|
|
7051
7357
|
*
|
|
7052
|
-
* If you want to decode
|
|
7053
|
-
* `Schema.toCodecStringTree
|
|
7054
|
-
* This serializer preserves values such as numbers and `Blob` objects when
|
|
7055
|
-
* compatible with the schema.
|
|
7358
|
+
* If you want to decode string fields into non-string primitive values, use
|
|
7359
|
+
* `Schema.toCodecStringTree`.
|
|
7056
7360
|
*
|
|
7057
7361
|
* **Example** (Decoding a flat structure)
|
|
7058
7362
|
*
|
|
@@ -7106,8 +7410,7 @@ export interface fromFormData<S extends Top> extends decodeTo<S, FormData> {
|
|
|
7106
7410
|
* Schema.toCodecStringTree(
|
|
7107
7411
|
* Schema.Struct({
|
|
7108
7412
|
* a: Schema.Int
|
|
7109
|
-
* })
|
|
7110
|
-
* { keepDeclarations: true }
|
|
7413
|
+
* })
|
|
7111
7414
|
* )
|
|
7112
7415
|
* )
|
|
7113
7416
|
*
|
|
@@ -7121,7 +7424,7 @@ export interface fromFormData<S extends Top> extends decodeTo<S, FormData> {
|
|
|
7121
7424
|
* @category decoding
|
|
7122
7425
|
* @since 4.0.0
|
|
7123
7426
|
*/
|
|
7124
|
-
export declare function fromFormData<S extends
|
|
7427
|
+
export declare function fromFormData<S extends Constraint>(schema: S): fromFormData<S>;
|
|
7125
7428
|
/**
|
|
7126
7429
|
* Type-level representation of {@link URLSearchParams}.
|
|
7127
7430
|
*
|
|
@@ -7148,7 +7451,7 @@ export declare const URLSearchParams: URLSearchParams;
|
|
|
7148
7451
|
* @category search params
|
|
7149
7452
|
* @since 4.0.0
|
|
7150
7453
|
*/
|
|
7151
|
-
export interface fromURLSearchParams<S extends
|
|
7454
|
+
export interface fromURLSearchParams<S extends Constraint> extends decodeTo<S, URLSearchParams> {
|
|
7152
7455
|
readonly "Rebuild": fromURLSearchParams<S>;
|
|
7153
7456
|
}
|
|
7154
7457
|
/**
|
|
@@ -7231,7 +7534,7 @@ export interface fromURLSearchParams<S extends Top> extends decodeTo<S, URLSearc
|
|
|
7231
7534
|
* @category decoding
|
|
7232
7535
|
* @since 4.0.0
|
|
7233
7536
|
*/
|
|
7234
|
-
export declare function fromURLSearchParams<S extends
|
|
7537
|
+
export declare function fromURLSearchParams<S extends Constraint>(schema: S): fromURLSearchParams<S>;
|
|
7235
7538
|
/**
|
|
7236
7539
|
* Type-level representation of {@link Finite}.
|
|
7237
7540
|
*
|
|
@@ -7948,9 +8251,16 @@ export declare const DateTimeZonedFromString: DateTimeZonedFromString;
|
|
|
7948
8251
|
* @category models
|
|
7949
8252
|
* @since 3.10.0
|
|
7950
8253
|
*/
|
|
7951
|
-
export interface Class<Self, S extends
|
|
8254
|
+
export interface Class<Self, S extends Constraint & {
|
|
7952
8255
|
readonly fields: Struct.Fields;
|
|
7953
|
-
}, Inherited> extends
|
|
8256
|
+
}, Inherited> extends BottomLazy<SchemaAST.Declaration, decodeTo<declareConstructor<Self, S["Encoded"], readonly [S], S["Iso"]>, S>, readonly [S], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
|
|
8257
|
+
readonly "Type": Self;
|
|
8258
|
+
readonly "Encoded": S["Encoded"];
|
|
8259
|
+
readonly "DecodingServices": S["DecodingServices"];
|
|
8260
|
+
readonly "EncodingServices": S["EncodingServices"];
|
|
8261
|
+
readonly "~type.make.in": RequiredKeys<S["~type.make.in"]> extends never ? void | S["~type.make.in"] : S["~type.make.in"];
|
|
8262
|
+
readonly "~type.make": Self;
|
|
8263
|
+
readonly "Iso": S["Iso"];
|
|
7954
8264
|
new (...args: {} extends S["~type.make.in"] ? [props?: S["~type.make.in"], options?: MakeOptions] : [props: S["~type.make.in"], options?: MakeOptions]): S["Type"] & Inherited;
|
|
7955
8265
|
readonly identifier: string;
|
|
7956
8266
|
readonly fields: S["fields"];
|
|
@@ -7973,7 +8283,31 @@ export interface Class<Self, S extends Top & {
|
|
|
7973
8283
|
mapFields<To extends Struct.Fields>(f: (fields: S["fields"]) => To, options?: {
|
|
7974
8284
|
readonly unsafePreserveChecks?: boolean | undefined;
|
|
7975
8285
|
} | undefined): Struct<Simplify<Readonly<To>>>;
|
|
7976
|
-
|
|
8286
|
+
/**
|
|
8287
|
+
* Returns a function that creates a schema-backed subclass with this class's
|
|
8288
|
+
* fields plus additional fields.
|
|
8289
|
+
*
|
|
8290
|
+
* **When to use**
|
|
8291
|
+
*
|
|
8292
|
+
* Use when you need a subclass whose constructor validates both inherited
|
|
8293
|
+
* fields and newly added fields.
|
|
8294
|
+
*
|
|
8295
|
+
* **Details**
|
|
8296
|
+
*
|
|
8297
|
+
* The returned function accepts either a field map or a `Struct`. When you
|
|
8298
|
+
* pass a `Struct`, checks attached to that extension schema are preserved and
|
|
8299
|
+
* combined with checks from the base class schema.
|
|
8300
|
+
*
|
|
8301
|
+
* **Gotchas**
|
|
8302
|
+
*
|
|
8303
|
+
* Checks from a `Struct` argument are evaluated against the full subclass
|
|
8304
|
+
* value after inherited and extension fields are merged. Object-wide checks
|
|
8305
|
+
* such as `isMaxProperties` count inherited fields too.
|
|
8306
|
+
*/
|
|
8307
|
+
extend<Extended = never, Static = {}, Brand = {}>(identifier: string): {
|
|
8308
|
+
<NewFields extends Struct.Fields>(fields: NewFields, annotations?: Annotations.Declaration<Extended, readonly [Struct<Simplify<Assign<S["fields"], NewFields>>>]>): [Extended] extends [never] ? MissingSelfGeneric<"Base.extend"> : InheritStaticMembers<Class<Extended, Struct<Simplify<Assign<S["fields"], NewFields>>>, Self & Brand>, Static>;
|
|
8309
|
+
<Extension extends Struct<Struct.Fields>>(schema: Extension, annotations?: Annotations.Declaration<Extended, readonly [Struct<Simplify<Assign<S["fields"], Extension["fields"]>>>]>): [Extended] extends [never] ? MissingSelfGeneric<"Base.extend"> : InheritStaticMembers<Class<Extended, Struct<Simplify<Assign<S["fields"], Extension["fields"]>>>, Self & Brand>, Static>;
|
|
8310
|
+
};
|
|
7977
8311
|
}
|
|
7978
8312
|
type InheritStaticMembers<C, Static> = C & Pick<Static, Exclude<keyof Static, keyof C>>;
|
|
7979
8313
|
type MissingSelfGeneric<Usage extends string> = `Missing \`Self\` generic - use \`class Self extends ${Usage}<Self>(...)\``;
|
|
@@ -8584,7 +8918,7 @@ export type LazyArbitrary<T> = (fc: typeof FastCheck) => FastCheck.Arbitrary<T>;
|
|
|
8584
8918
|
* @category Arbitrary
|
|
8585
8919
|
* @since 4.0.0
|
|
8586
8920
|
*/
|
|
8587
|
-
export declare function toArbitraryLazy<S extends
|
|
8921
|
+
export declare function toArbitraryLazy<S extends Constraint>(schema: S): LazyArbitrary<S["Type"]>;
|
|
8588
8922
|
/**
|
|
8589
8923
|
* Derives a `fast-check` `Arbitrary` from a schema for property-based
|
|
8590
8924
|
* testing. The derived arbitrary generates values that satisfy the schema.
|
|
@@ -8614,8 +8948,8 @@ export declare function toArbitraryLazy<S extends Top>(schema: S): LazyArbitrary
|
|
|
8614
8948
|
* @category Arbitrary
|
|
8615
8949
|
* @since 4.0.0
|
|
8616
8950
|
*/
|
|
8617
|
-
export declare function toArbitrary<S extends
|
|
8618
|
-
export declare function toArbitrary<S extends
|
|
8951
|
+
export declare function toArbitrary<S extends Constraint>(schema: S): FastCheck.Arbitrary<S["Type"]>;
|
|
8952
|
+
export declare function toArbitrary<S extends Constraint>(schema: S, options: {
|
|
8619
8953
|
readonly report: true;
|
|
8620
8954
|
}): Annotations.ToArbitrary.WithReport<FastCheck.Arbitrary<S["Type"]>>;
|
|
8621
8955
|
/**
|
|
@@ -8644,9 +8978,9 @@ export declare function overrideToFormatter<S extends Top>(toFormatter: () => Fo
|
|
|
8644
8978
|
* @category Formatter
|
|
8645
8979
|
* @since 4.0.0
|
|
8646
8980
|
*/
|
|
8647
|
-
export declare function toFormatter<
|
|
8981
|
+
export declare function toFormatter<S extends Constraint>(schema: S, options?: {
|
|
8648
8982
|
readonly onBefore?: ((ast: SchemaAST.AST, recur: (ast: SchemaAST.AST) => Formatter<any>) => Formatter<any> | undefined) | undefined;
|
|
8649
|
-
}): Formatter<
|
|
8983
|
+
}): Formatter<S["Type"]>;
|
|
8650
8984
|
/**
|
|
8651
8985
|
* Overrides the equivalence derivation for a schema by supplying a custom
|
|
8652
8986
|
* `Equivalence`.
|
|
@@ -8688,7 +9022,7 @@ export declare function toEquivalence<T>(schema: Schema<T>): Equivalence.Equival
|
|
|
8688
9022
|
* @category Representation
|
|
8689
9023
|
* @since 4.0.0
|
|
8690
9024
|
*/
|
|
8691
|
-
export declare function toRepresentation(schema:
|
|
9025
|
+
export declare function toRepresentation(schema: Constraint): SchemaRepresentation.Document;
|
|
8692
9026
|
/**
|
|
8693
9027
|
* Options for {@link toJsonSchemaDocument}.
|
|
8694
9028
|
*
|
|
@@ -8781,7 +9115,22 @@ export interface ToJsonSchemaOptions {
|
|
|
8781
9115
|
* @category converting
|
|
8782
9116
|
* @since 4.0.0
|
|
8783
9117
|
*/
|
|
8784
|
-
export declare function toJsonSchemaDocument(schema:
|
|
9118
|
+
export declare function toJsonSchemaDocument(schema: Constraint, options?: ToJsonSchemaOptions): JsonSchema.Document<"draft-2020-12">;
|
|
9119
|
+
/**
|
|
9120
|
+
* Type-level representation returned by {@link toCodecJson}.
|
|
9121
|
+
*
|
|
9122
|
+
* @category Canonical Codecs
|
|
9123
|
+
* @since 4.0.0
|
|
9124
|
+
*/
|
|
9125
|
+
export interface toCodecJson<S extends Constraint> extends BottomLazy<S["ast"], toCodecJson<S>, S["~type.parameters"], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
|
|
9126
|
+
readonly "Type": S["Type"];
|
|
9127
|
+
readonly "Encoded": Json;
|
|
9128
|
+
readonly "DecodingServices": S["DecodingServices"];
|
|
9129
|
+
readonly "EncodingServices": S["EncodingServices"];
|
|
9130
|
+
readonly "~type.make.in": S["~type.make.in"];
|
|
9131
|
+
readonly "~type.make": S["~type.make"];
|
|
9132
|
+
readonly "Iso": S["Iso"];
|
|
9133
|
+
}
|
|
8785
9134
|
/**
|
|
8786
9135
|
* Derives a canonical JSON codec from a schema. The encoded form is `Json`, and
|
|
8787
9136
|
* decoding produces the schema's `Type`.
|
|
@@ -8789,7 +9138,7 @@ export declare function toJsonSchemaDocument(schema: Top, options?: ToJsonSchema
|
|
|
8789
9138
|
* @category Canonical Codecs
|
|
8790
9139
|
* @since 4.0.0
|
|
8791
9140
|
*/
|
|
8792
|
-
export declare function toCodecJson<
|
|
9141
|
+
export declare function toCodecJson<S extends Constraint>(schema: S): toCodecJson<S>;
|
|
8793
9142
|
/**
|
|
8794
9143
|
* Derives an isomorphism codec from a schema. The encoded form is the
|
|
8795
9144
|
* schema's `Iso` type — the intermediate representation used for round-tripping.
|
|
@@ -8797,7 +9146,7 @@ export declare function toCodecJson<T, E, RD, RE>(schema: Codec<T, E, RD, RE>):
|
|
|
8797
9146
|
* @category Canonical Codecs
|
|
8798
9147
|
* @since 4.0.0
|
|
8799
9148
|
*/
|
|
8800
|
-
export declare function toCodecIso<S extends
|
|
9149
|
+
export declare function toCodecIso<S extends Constraint>(schema: S): Codec<S["Type"], S["Iso"]>;
|
|
8801
9150
|
/**
|
|
8802
9151
|
* A {@link Tree} of `string | undefined` nodes. Leaf values are either a
|
|
8803
9152
|
* string representation or `undefined` for opaque/declaration types.
|
|
@@ -8806,6 +9155,21 @@ export declare function toCodecIso<S extends Top>(schema: S): Codec<S["Type"], S
|
|
|
8806
9155
|
* @since 4.0.0
|
|
8807
9156
|
*/
|
|
8808
9157
|
export type StringTree = Tree<string | undefined>;
|
|
9158
|
+
/**
|
|
9159
|
+
* Type-level representation returned by {@link toCodecStringTree}.
|
|
9160
|
+
*
|
|
9161
|
+
* @category Canonical Codecs
|
|
9162
|
+
* @since 4.0.0
|
|
9163
|
+
*/
|
|
9164
|
+
export interface toCodecStringTree<S extends Constraint> extends BottomLazy<S["ast"], toCodecStringTree<S>, ReadonlyArray<Constraint>, S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
|
|
9165
|
+
readonly "Type": S["Type"];
|
|
9166
|
+
readonly "Encoded": StringTree;
|
|
9167
|
+
readonly "DecodingServices": S["DecodingServices"];
|
|
9168
|
+
readonly "EncodingServices": S["EncodingServices"];
|
|
9169
|
+
readonly "~type.make.in": S["~type.make.in"];
|
|
9170
|
+
readonly "~type.make": S["~type.make"];
|
|
9171
|
+
readonly "Iso": S["Iso"];
|
|
9172
|
+
}
|
|
8809
9173
|
/**
|
|
8810
9174
|
* Converts a schema to the StringTree canonical codec, where every leaf value
|
|
8811
9175
|
* becomes a string while preserving the original structure.
|
|
@@ -8815,21 +9179,44 @@ export type StringTree = Tree<string | undefined>;
|
|
|
8815
9179
|
* Declarations are converted to `undefined` (unless they have a
|
|
8816
9180
|
* `toCodecJson` or `toCodec` annotation).
|
|
8817
9181
|
*
|
|
8818
|
-
*
|
|
9182
|
+
* @category Canonical Codecs
|
|
9183
|
+
* @since 4.0.0
|
|
9184
|
+
*/
|
|
9185
|
+
export declare function toCodecStringTree<S extends Constraint>(schema: S): toCodecStringTree<S>;
|
|
9186
|
+
/**
|
|
9187
|
+
* Type-level representation returned by {@link toCodecArrayFromSingle}.
|
|
8819
9188
|
*
|
|
8820
|
-
*
|
|
8821
|
-
*
|
|
8822
|
-
|
|
9189
|
+
* @category Canonical Codecs
|
|
9190
|
+
* @since 4.0.0
|
|
9191
|
+
*/
|
|
9192
|
+
export interface toCodecArrayFromSingle<S extends Constraint> extends BottomLazy<S["ast"], toCodecArrayFromSingle<S>, S["~type.parameters"], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
|
|
9193
|
+
readonly "Type": S["Type"];
|
|
9194
|
+
readonly "Encoded": S["Encoded"];
|
|
9195
|
+
readonly "DecodingServices": S["DecodingServices"];
|
|
9196
|
+
readonly "EncodingServices": S["EncodingServices"];
|
|
9197
|
+
readonly "~type.make.in": S["~type.make.in"];
|
|
9198
|
+
readonly "~type.make": S["~type.make"];
|
|
9199
|
+
readonly "Iso": S["Iso"];
|
|
9200
|
+
}
|
|
9201
|
+
/**
|
|
9202
|
+
* Allows array schemas to decode from either an array input or a single value
|
|
9203
|
+
* input.
|
|
8823
9204
|
*
|
|
8824
|
-
*
|
|
9205
|
+
* **When to use**
|
|
9206
|
+
*
|
|
9207
|
+
* Use when you need to accept transport formats that may represent a
|
|
9208
|
+
* single-item array as a bare value, such as query-string or form-data adapters.
|
|
9209
|
+
*
|
|
9210
|
+
* **Gotchas**
|
|
9211
|
+
*
|
|
9212
|
+
* This combinator is intentionally not part of `toCodecStringTree`; it adds a
|
|
9213
|
+
* decoding convenience rather than a canonical StringTree representation. It
|
|
9214
|
+
* does not parse comma-separated strings.
|
|
8825
9215
|
*
|
|
8826
9216
|
* @category Canonical Codecs
|
|
8827
9217
|
* @since 4.0.0
|
|
8828
9218
|
*/
|
|
8829
|
-
export declare function
|
|
8830
|
-
export declare function toCodecStringTree<T, E, RD, RE>(schema: Codec<T, E, RD, RE>, options: {
|
|
8831
|
-
readonly keepDeclarations: true;
|
|
8832
|
-
}): Codec<T, unknown, RD, RE>;
|
|
9219
|
+
export declare function toCodecArrayFromSingle<S extends Constraint>(schema: S): toCodecArrayFromSingle<S>;
|
|
8833
9220
|
type XmlEncoderOptions = {
|
|
8834
9221
|
/** Root element name for the returned XML string. Default: "root" */
|
|
8835
9222
|
readonly rootName?: string | undefined;
|
|
@@ -8862,28 +9249,35 @@ export declare function toEncoderXml<T, E, RD, RE>(codec: Codec<T, E, RD, RE>, o
|
|
|
8862
9249
|
* @category Optic
|
|
8863
9250
|
* @since 4.0.0
|
|
8864
9251
|
*/
|
|
8865
|
-
export declare function toIso<S extends
|
|
9252
|
+
export declare function toIso<S extends Constraint>(schema: S): Optic_.Iso<S["Type"], S["Iso"]>;
|
|
8866
9253
|
/**
|
|
8867
9254
|
* Returns an identity `Iso` over the schema's source (`Type`) side.
|
|
8868
9255
|
*
|
|
8869
9256
|
* @category Optic
|
|
8870
9257
|
* @since 4.0.0
|
|
8871
9258
|
*/
|
|
8872
|
-
export declare function toIsoSource<S extends
|
|
9259
|
+
export declare function toIsoSource<S extends Constraint>(_: S): Optic_.Iso<S["Type"], S["Type"]>;
|
|
8873
9260
|
/**
|
|
8874
9261
|
* Returns an identity `Iso` over the schema's focus (`Iso`) side.
|
|
8875
9262
|
*
|
|
8876
9263
|
* @category Optic
|
|
8877
9264
|
* @since 4.0.0
|
|
8878
9265
|
*/
|
|
8879
|
-
export declare function toIsoFocus<S extends
|
|
9266
|
+
export declare function toIsoFocus<S extends Constraint>(_: S): Optic_.Iso<S["Iso"], S["Iso"]>;
|
|
8880
9267
|
/**
|
|
8881
9268
|
* Type-level representation returned by {@link overrideToCodecIso}.
|
|
8882
9269
|
*
|
|
8883
9270
|
* @category Optic
|
|
8884
9271
|
* @since 4.0.0
|
|
8885
9272
|
*/
|
|
8886
|
-
export interface overrideToCodecIso<S extends
|
|
9273
|
+
export interface overrideToCodecIso<S extends Constraint, Iso> extends BottomLazy<S["ast"], overrideToCodecIso<S, Iso>, S["~type.parameters"], S["~type.mutability"], S["~type.optionality"], S["~type.constructor.default"], S["~encoded.mutability"], S["~encoded.optionality"]> {
|
|
9274
|
+
readonly "Type": S["Type"];
|
|
9275
|
+
readonly "Encoded": S["Encoded"];
|
|
9276
|
+
readonly "DecodingServices": S["DecodingServices"];
|
|
9277
|
+
readonly "EncodingServices": S["EncodingServices"];
|
|
9278
|
+
readonly "~type.make.in": S["~type.make.in"];
|
|
9279
|
+
readonly "~type.make": S["~type.make"];
|
|
9280
|
+
readonly "Iso": Iso;
|
|
8887
9281
|
readonly schema: S;
|
|
8888
9282
|
}
|
|
8889
9283
|
/**
|
|
@@ -8903,7 +9297,7 @@ export interface overrideToCodecIso<S extends Top, Iso> extends Bottom<S["Type"]
|
|
|
8903
9297
|
* @category Optic
|
|
8904
9298
|
* @since 4.0.0
|
|
8905
9299
|
*/
|
|
8906
|
-
export declare function overrideToCodecIso<S extends
|
|
9300
|
+
export declare function overrideToCodecIso<S extends Constraint, Iso>(to: Codec<Iso>, transformation: {
|
|
8907
9301
|
readonly decode: SchemaGetter.Getter<S["Type"], Iso>;
|
|
8908
9302
|
readonly encode: SchemaGetter.Getter<Iso, S["Type"]>;
|
|
8909
9303
|
}): (schema: S) => overrideToCodecIso<S, Iso>;
|
|
@@ -8942,7 +9336,7 @@ export interface TreeRecord<A> {
|
|
|
8942
9336
|
* @category Tree
|
|
8943
9337
|
* @since 4.0.0
|
|
8944
9338
|
*/
|
|
8945
|
-
export declare function Tree<S extends
|
|
9339
|
+
export declare function Tree<S extends Constraint>(node: S): Union<readonly [S, $Array<suspend<Codec<Tree<S["Type"]>, Tree<S["Encoded"]>, S["DecodingServices"], S["EncodingServices"]>>>, $Record<String, suspend<Codec<Tree<S["Type"]>, Tree<S["Encoded"]>, S["DecodingServices"], S["EncodingServices"]>>>]>;
|
|
8946
9340
|
/**
|
|
8947
9341
|
* Recursive TypeScript type for any valid immutable JSON value: `null`,
|
|
8948
9342
|
* `number`, `boolean`, `string`, a readonly array of `Json` values, or a
|
|
@@ -9028,7 +9422,7 @@ export declare const MutableJson: Codec<MutableJson>;
|
|
|
9028
9422
|
* @category Schema Resolvers
|
|
9029
9423
|
* @since 4.0.0
|
|
9030
9424
|
*/
|
|
9031
|
-
export declare function resolveAnnotations<S extends
|
|
9425
|
+
export declare function resolveAnnotations<S extends Constraint>(schema: S): Annotations.Bottom<S["Type"], S["~type.parameters"]> | undefined;
|
|
9032
9426
|
/**
|
|
9033
9427
|
* Resolves the context (key-level) annotations from a schema. Context
|
|
9034
9428
|
* annotations are those attached via `annotateKey` and live on the AST's
|
|
@@ -9037,7 +9431,7 @@ export declare function resolveAnnotations<S extends Top>(schema: S): Annotation
|
|
|
9037
9431
|
* @category Schema Resolvers
|
|
9038
9432
|
* @since 4.0.0
|
|
9039
9433
|
*/
|
|
9040
|
-
export declare function resolveAnnotationsKey<S extends
|
|
9434
|
+
export declare function resolveAnnotationsKey<S extends Constraint>(schema: S): Annotations.Key<S["Type"]> | undefined;
|
|
9041
9435
|
/**
|
|
9042
9436
|
* The `Annotations` namespace groups all annotation interfaces used to attach
|
|
9043
9437
|
* metadata to schemas. Annotations control documentation, validation messages,
|
|
@@ -9159,7 +9553,7 @@ export declare namespace Annotations {
|
|
|
9159
9553
|
* @category models
|
|
9160
9554
|
* @since 4.0.0
|
|
9161
9555
|
*/
|
|
9162
|
-
interface Bottom<T, TypeParameters extends ReadonlyArray<
|
|
9556
|
+
interface Bottom<T, TypeParameters extends ReadonlyArray<Constraint>> extends Documentation<T> {
|
|
9163
9557
|
/**
|
|
9164
9558
|
* Complete message to use when this schema node reports an issue.
|
|
9165
9559
|
*
|
|
@@ -9216,7 +9610,7 @@ export declare namespace Annotations {
|
|
|
9216
9610
|
* @category utility types
|
|
9217
9611
|
* @since 4.0.0
|
|
9218
9612
|
*/
|
|
9219
|
-
type Type<TypeParameters extends ReadonlyArray<
|
|
9613
|
+
type Type<TypeParameters extends ReadonlyArray<Constraint>> = {
|
|
9220
9614
|
readonly [K in keyof TypeParameters]: Codec<TypeParameters[K]["Type"]>;
|
|
9221
9615
|
};
|
|
9222
9616
|
/**
|
|
@@ -9225,7 +9619,7 @@ export declare namespace Annotations {
|
|
|
9225
9619
|
* @category utility types
|
|
9226
9620
|
* @since 4.0.0
|
|
9227
9621
|
*/
|
|
9228
|
-
type Encoded<TypeParameters extends ReadonlyArray<
|
|
9622
|
+
type Encoded<TypeParameters extends ReadonlyArray<Constraint>> = {
|
|
9229
9623
|
readonly [K in keyof TypeParameters]: Codec<TypeParameters[K]["Encoded"]>;
|
|
9230
9624
|
};
|
|
9231
9625
|
}
|
|
@@ -9239,7 +9633,7 @@ export declare namespace Annotations {
|
|
|
9239
9633
|
* @category models
|
|
9240
9634
|
* @since 4.0.0
|
|
9241
9635
|
*/
|
|
9242
|
-
interface Declaration<T, TypeParameters extends ReadonlyArray<
|
|
9636
|
+
interface Declaration<T, TypeParameters extends ReadonlyArray<Constraint> = readonly []> extends Bottom<T, TypeParameters> {
|
|
9243
9637
|
readonly toCodec?: ((typeParameters: TypeParameters.Encoded<TypeParameters>) => SchemaAST.Link) | undefined;
|
|
9244
9638
|
readonly toCodecJson?: ((typeParameters: TypeParameters.Encoded<TypeParameters>) => SchemaAST.Link) | undefined;
|
|
9245
9639
|
readonly toCodecIso?: ((typeParameters: TypeParameters.Type<TypeParameters>) => SchemaAST.Link) | undefined;
|
|
@@ -9334,7 +9728,7 @@ export declare namespace Annotations {
|
|
|
9334
9728
|
* @since 4.0.0
|
|
9335
9729
|
*/
|
|
9336
9730
|
interface Filter {
|
|
9337
|
-
readonly constraint?:
|
|
9731
|
+
readonly constraint?: GenerationConstraint | undefined;
|
|
9338
9732
|
readonly candidate?: Candidate | undefined;
|
|
9339
9733
|
}
|
|
9340
9734
|
/**
|
|
@@ -9380,10 +9774,10 @@ export declare namespace Annotations {
|
|
|
9380
9774
|
*
|
|
9381
9775
|
* **Details**
|
|
9382
9776
|
*
|
|
9383
|
-
* `
|
|
9384
|
-
* self-describing validation contract. Each generator consumes
|
|
9385
|
-
* understands for the current node and ignores the rest;
|
|
9386
|
-
* filters still validate every generated value.
|
|
9777
|
+
* `GenerationConstraint` is a generation hint for the current schema AST
|
|
9778
|
+
* node, not a self-describing validation contract. Each generator consumes
|
|
9779
|
+
* the fields it understands for the current node and ignores the rest;
|
|
9780
|
+
* final schema filters still validate every generated value.
|
|
9387
9781
|
*
|
|
9388
9782
|
* `minLength` and `maxLength` represent node-local cardinality: string
|
|
9389
9783
|
* length for strings, array length for arrays, final own-property count for
|
|
@@ -9396,7 +9790,7 @@ export declare namespace Annotations {
|
|
|
9396
9790
|
* @category models
|
|
9397
9791
|
* @since 4.0.0
|
|
9398
9792
|
*/
|
|
9399
|
-
interface
|
|
9793
|
+
interface GenerationConstraint {
|
|
9400
9794
|
readonly minLength?: number | undefined;
|
|
9401
9795
|
readonly maxLength?: number | undefined;
|
|
9402
9796
|
readonly patterns?: readonly [string, ...Array<string>];
|
|
@@ -9437,7 +9831,7 @@ export declare namespace Annotations {
|
|
|
9437
9831
|
* @since 4.0.0
|
|
9438
9832
|
*/
|
|
9439
9833
|
interface Context {
|
|
9440
|
-
readonly constraint?: ToArbitrary.
|
|
9834
|
+
readonly constraint?: ToArbitrary.GenerationConstraint | undefined;
|
|
9441
9835
|
readonly recursion?: ToArbitrary.Recursion | undefined;
|
|
9442
9836
|
}
|
|
9443
9837
|
/**
|
|
@@ -9499,7 +9893,7 @@ export declare namespace Annotations {
|
|
|
9499
9893
|
* @category models
|
|
9500
9894
|
* @since 4.0.0
|
|
9501
9895
|
*/
|
|
9502
|
-
interface Declaration<T, TypeParameters extends ReadonlyArray<
|
|
9896
|
+
interface Declaration<T, TypeParameters extends ReadonlyArray<Constraint>> {
|
|
9503
9897
|
(typeParameters: {
|
|
9504
9898
|
readonly [K in keyof TypeParameters]: TypeParameter<TypeParameters[K]["Type"]>;
|
|
9505
9899
|
}): (fc: typeof FastCheck, context: Context) => Output<T>;
|
|
@@ -9570,7 +9964,7 @@ export declare namespace Annotations {
|
|
|
9570
9964
|
* @category models
|
|
9571
9965
|
* @since 4.0.0
|
|
9572
9966
|
*/
|
|
9573
|
-
interface Declaration<T, TypeParameters extends ReadonlyArray<
|
|
9967
|
+
interface Declaration<T, TypeParameters extends ReadonlyArray<Constraint>> {
|
|
9574
9968
|
(typeParameters: {
|
|
9575
9969
|
readonly [K in keyof TypeParameters]: Formatter<TypeParameters[K]["Type"]>;
|
|
9576
9970
|
}): Formatter<T>;
|
|
@@ -9593,7 +9987,7 @@ export declare namespace Annotations {
|
|
|
9593
9987
|
* @category models
|
|
9594
9988
|
* @since 4.0.0
|
|
9595
9989
|
*/
|
|
9596
|
-
interface Declaration<T, TypeParameters extends ReadonlyArray<
|
|
9990
|
+
interface Declaration<T, TypeParameters extends ReadonlyArray<Constraint>> {
|
|
9597
9991
|
(typeParameters: {
|
|
9598
9992
|
readonly [K in keyof TypeParameters]: Equivalence.Equivalence<TypeParameters[K]["Type"]>;
|
|
9599
9993
|
}): Equivalence.Equivalence<T>;
|