effect 4.0.0-beta.73 → 4.0.0-beta.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Array.d.ts +745 -627
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +277 -217
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +37 -30
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +19 -16
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts +34 -40
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +16 -16
- package/dist/BigInt.js.map +1 -1
- package/dist/Boolean.d.ts +10 -10
- package/dist/Boolean.js +6 -6
- package/dist/Brand.d.ts +13 -11
- package/dist/Brand.d.ts.map +1 -1
- package/dist/Brand.js +10 -8
- package/dist/Brand.js.map +1 -1
- package/dist/Cause.d.ts +21 -23
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Cause.js +21 -23
- package/dist/Cause.js.map +1 -1
- package/dist/Channel.d.ts +282 -72
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +108 -28
- package/dist/Channel.js.map +1 -1
- package/dist/ChannelSchema.d.ts +11 -11
- package/dist/ChannelSchema.js +5 -5
- package/dist/Chunk.d.ts +86 -33
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +48 -13
- package/dist/Chunk.js.map +1 -1
- package/dist/Clock.d.ts +3 -3
- package/dist/Clock.js +3 -3
- package/dist/Combiner.d.ts +9 -13
- package/dist/Combiner.d.ts.map +1 -1
- package/dist/Combiner.js +9 -13
- package/dist/Combiner.js.map +1 -1
- package/dist/Config.d.ts +49 -56
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +40 -43
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +34 -44
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +24 -32
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Console.d.ts +2 -2
- package/dist/Console.js +2 -2
- package/dist/Context.d.ts +63 -75
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +29 -33
- package/dist/Context.js.map +1 -1
- package/dist/Cron.d.ts +6 -6
- package/dist/Cron.js +6 -6
- package/dist/Crypto.d.ts +4 -4
- package/dist/Crypto.js +4 -4
- package/dist/Data.d.ts +21 -15
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js +7 -7
- package/dist/Data.js.map +1 -1
- package/dist/DateTime.d.ts +35 -16
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +35 -8
- package/dist/DateTime.js.map +1 -1
- package/dist/Deferred.d.ts +61 -52
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +21 -18
- package/dist/Deferred.js.map +1 -1
- package/dist/Duration.d.ts +50 -37
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +24 -13
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +574 -474
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +273 -213
- package/dist/Effect.js.map +1 -1
- package/dist/Encoding.d.ts +5 -0
- package/dist/Encoding.d.ts.map +1 -1
- package/dist/Encoding.js +5 -0
- package/dist/Encoding.js.map +1 -1
- package/dist/Equal.d.ts +28 -41
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +12 -19
- package/dist/Equal.js.map +1 -1
- package/dist/Equivalence.d.ts +72 -100
- package/dist/Equivalence.d.ts.map +1 -1
- package/dist/Equivalence.js +54 -74
- package/dist/Equivalence.js.map +1 -1
- package/dist/ErrorReporter.d.ts +1 -1
- package/dist/ErrorReporter.js +1 -1
- package/dist/ExecutionPlan.d.ts +2 -2
- package/dist/ExecutionPlan.js +1 -1
- package/dist/Exit.d.ts +79 -96
- package/dist/Exit.d.ts.map +1 -1
- package/dist/Exit.js +57 -64
- package/dist/Exit.js.map +1 -1
- package/dist/Fiber.d.ts +8 -6
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js +8 -6
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +25 -0
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +15 -0
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +35 -0
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +15 -0
- package/dist/FiberMap.js.map +1 -1
- package/dist/FiberSet.d.ts +20 -0
- package/dist/FiberSet.d.ts.map +1 -1
- package/dist/FiberSet.js +10 -0
- package/dist/FiberSet.js.map +1 -1
- package/dist/FileSystem.d.ts +6 -6
- package/dist/FileSystem.js +2 -2
- package/dist/Filter.d.ts +4 -4
- package/dist/Filter.js +4 -4
- package/dist/Formatter.d.ts +14 -19
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +14 -19
- package/dist/Formatter.js.map +1 -1
- package/dist/Function.d.ts +20 -21
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +14 -15
- package/dist/Function.js.map +1 -1
- package/dist/Graph.d.ts +13 -13
- package/dist/Graph.js +7 -7
- package/dist/HKT.d.ts +3 -3
- package/dist/Hash.d.ts +2 -1
- package/dist/Hash.d.ts.map +1 -1
- package/dist/Hash.js +2 -1
- package/dist/Hash.js.map +1 -1
- package/dist/HashMap.d.ts +18 -3
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashMap.js +5 -0
- package/dist/HashMap.js.map +1 -1
- package/dist/HashRing.d.ts +9 -9
- package/dist/HashRing.js +3 -3
- package/dist/HashSet.d.ts +1 -1
- package/dist/Iterable.d.ts +39 -27
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +21 -11
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonPatch.d.ts +2 -3
- package/dist/JsonPatch.d.ts.map +1 -1
- package/dist/JsonPatch.js +2 -3
- package/dist/JsonPatch.js.map +1 -1
- package/dist/JsonPointer.d.ts +2 -6
- package/dist/JsonPointer.d.ts.map +1 -1
- package/dist/JsonPointer.js +2 -6
- package/dist/JsonPointer.js.map +1 -1
- package/dist/JsonSchema.d.ts +17 -13
- package/dist/JsonSchema.d.ts.map +1 -1
- package/dist/JsonSchema.js +17 -13
- package/dist/JsonSchema.js.map +1 -1
- package/dist/Latch.d.ts +4 -3
- package/dist/Latch.d.ts.map +1 -1
- package/dist/Latch.js +4 -3
- package/dist/Latch.js.map +1 -1
- package/dist/Layer.d.ts +108 -130
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +43 -51
- package/dist/Layer.js.map +1 -1
- package/dist/Logger.d.ts +16 -19
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +15 -18
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +2 -2
- package/dist/Match.d.ts +22 -22
- package/dist/Match.js +18 -18
- package/dist/Metric.d.ts +105 -125
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +54 -64
- package/dist/Metric.js.map +1 -1
- package/dist/MutableHashMap.d.ts +21 -12
- package/dist/MutableHashMap.d.ts.map +1 -1
- package/dist/MutableHashMap.js +7 -4
- package/dist/MutableHashMap.js.map +1 -1
- package/dist/MutableList.d.ts +15 -0
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +15 -0
- package/dist/MutableList.js.map +1 -1
- package/dist/MutableRef.d.ts +56 -42
- package/dist/MutableRef.d.ts.map +1 -1
- package/dist/MutableRef.js +28 -22
- package/dist/MutableRef.js.map +1 -1
- package/dist/Newtype.d.ts +10 -7
- package/dist/Newtype.d.ts.map +1 -1
- package/dist/Newtype.js +10 -7
- package/dist/Newtype.js.map +1 -1
- package/dist/Number.d.ts +23 -11
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +9 -5
- package/dist/Number.js.map +1 -1
- package/dist/Optic.d.ts +16 -16
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +10 -9
- package/dist/Optic.js.map +1 -1
- package/dist/Option.d.ts +232 -204
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +113 -96
- package/dist/Option.js.map +1 -1
- package/dist/Order.d.ts +119 -180
- package/dist/Order.d.ts.map +1 -1
- package/dist/Order.js +93 -145
- package/dist/Order.js.map +1 -1
- package/dist/PartitionedSemaphore.d.ts +14 -14
- package/dist/PartitionedSemaphore.js +6 -6
- package/dist/Path.d.ts +3 -3
- package/dist/Path.js +3 -3
- package/dist/Pipeable.d.ts +3 -3
- package/dist/Pipeable.js +3 -3
- package/dist/PlatformError.d.ts +4 -4
- package/dist/PlatformError.js +4 -4
- package/dist/Pool.d.ts +7 -11
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +3 -5
- package/dist/Pool.js.map +1 -1
- package/dist/Predicate.d.ts +279 -268
- package/dist/Predicate.d.ts.map +1 -1
- package/dist/Predicate.js +128 -123
- package/dist/Predicate.js.map +1 -1
- package/dist/PubSub.d.ts +33 -23
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +21 -11
- package/dist/PubSub.js.map +1 -1
- package/dist/Pull.d.ts +4 -4
- package/dist/Pull.js +4 -4
- package/dist/Queue.d.ts +70 -31
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +66 -27
- package/dist/Queue.js.map +1 -1
- package/dist/RcRef.d.ts +0 -4
- package/dist/RcRef.d.ts.map +1 -1
- package/dist/RcRef.js.map +1 -1
- package/dist/Record.d.ts +15 -15
- package/dist/Record.js +5 -5
- package/dist/Redactable.d.ts +2 -2
- package/dist/Redactable.js +2 -2
- package/dist/Redacted.d.ts +5 -5
- package/dist/Redacted.js +4 -4
- package/dist/Reducer.d.ts +2 -3
- package/dist/Reducer.d.ts.map +1 -1
- package/dist/Reducer.js +2 -3
- package/dist/Reducer.js.map +1 -1
- package/dist/Ref.d.ts +23 -22
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +21 -20
- package/dist/Ref.js.map +1 -1
- package/dist/References.d.ts +4 -4
- package/dist/References.js +4 -4
- package/dist/RegExp.d.ts +1 -1
- package/dist/RegExp.js +1 -1
- package/dist/Request.d.ts +22 -22
- package/dist/Request.js +6 -6
- package/dist/RequestResolver.d.ts +6 -6
- package/dist/RequestResolver.js +2 -2
- package/dist/Resource.d.ts +3 -3
- package/dist/Resource.js +3 -3
- package/dist/Result.d.ts +95 -51
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +53 -30
- package/dist/Result.js.map +1 -1
- package/dist/Runtime.d.ts +11 -8
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +11 -8
- package/dist/Runtime.js.map +1 -1
- package/dist/Schedule.d.ts +151 -89
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +59 -47
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts +6 -4
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +6 -4
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +620 -830
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +543 -452
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +43 -22
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +80 -59
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +139 -119
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +133 -113
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.d.ts +37 -39
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js +16 -17
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.d.ts +75 -156
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +75 -148
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +30 -21
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +26 -22
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +169 -145
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +183 -159
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/SchemaUtils.js +2 -2
- package/dist/SchemaUtils.js.map +1 -1
- package/dist/Scope.d.ts +16 -1
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +16 -1
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.d.ts +1 -1
- package/dist/ScopedCache.js +1 -1
- package/dist/ScopedRef.d.ts +14 -18
- package/dist/ScopedRef.d.ts.map +1 -1
- package/dist/ScopedRef.js +6 -8
- package/dist/ScopedRef.js.map +1 -1
- package/dist/Semaphore.d.ts +9 -9
- package/dist/Semaphore.js +3 -3
- package/dist/Sink.d.ts +18 -18
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +12 -12
- package/dist/Sink.js.map +1 -1
- package/dist/Stdio.d.ts +4 -5
- package/dist/Stdio.d.ts.map +1 -1
- package/dist/Stdio.js +4 -5
- package/dist/Stdio.js.map +1 -1
- package/dist/Stream.d.ts +376 -99
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +158 -43
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +11 -14
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +5 -6
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts +23 -21
- package/dist/Struct.d.ts.map +1 -1
- package/dist/Struct.js +14 -12
- package/dist/Struct.js.map +1 -1
- package/dist/SubscriptionRef.d.ts +24 -19
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +12 -7
- package/dist/SubscriptionRef.js.map +1 -1
- package/dist/SynchronizedRef.d.ts +145 -120
- package/dist/SynchronizedRef.d.ts.map +1 -1
- package/dist/SynchronizedRef.js +51 -42
- package/dist/SynchronizedRef.js.map +1 -1
- package/dist/Terminal.d.ts +1 -1
- package/dist/Terminal.js +1 -1
- package/dist/Tracer.d.ts +9 -9
- package/dist/Tracer.js +6 -6
- package/dist/Trie.d.ts +15 -0
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js +5 -0
- package/dist/Trie.js.map +1 -1
- package/dist/Tuple.d.ts +39 -33
- package/dist/Tuple.d.ts.map +1 -1
- package/dist/Tuple.js +23 -19
- package/dist/Tuple.js.map +1 -1
- package/dist/TxHashMap.d.ts +3 -3
- package/dist/TxHashSet.d.ts +1 -1
- package/dist/TxReentrantLock.d.ts +6 -3
- package/dist/TxReentrantLock.d.ts.map +1 -1
- package/dist/TxReentrantLock.js +2 -1
- package/dist/TxReentrantLock.js.map +1 -1
- package/dist/TxRef.d.ts +16 -16
- package/dist/TxRef.js +8 -8
- package/dist/TxSubscriptionRef.d.ts +43 -27
- package/dist/TxSubscriptionRef.d.ts.map +1 -1
- package/dist/TxSubscriptionRef.js +19 -13
- package/dist/TxSubscriptionRef.js.map +1 -1
- package/dist/Types.d.ts +12 -38
- package/dist/Types.d.ts.map +1 -1
- package/dist/Types.js +0 -2
- package/dist/UndefinedOr.d.ts +15 -14
- package/dist/UndefinedOr.d.ts.map +1 -1
- package/dist/UndefinedOr.js +11 -10
- package/dist/UndefinedOr.js.map +1 -1
- package/dist/Unify.d.ts +9 -9
- package/dist/Unify.js +1 -1
- package/dist/internal/schema/annotations.js.map +1 -1
- package/dist/internal/schema/arbitrary.js +9 -9
- package/dist/internal/schema/arbitrary.js.map +1 -1
- package/dist/internal/schema/equivalence.js +9 -9
- package/dist/internal/schema/equivalence.js.map +1 -1
- package/dist/internal/schema/representation.js +14 -14
- package/dist/internal/schema/representation.js.map +1 -1
- package/dist/internal/schema/schema.js +11 -11
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/testing/TestClock.d.ts +5 -5
- package/dist/testing/TestClock.js +4 -4
- package/dist/testing/TestConsole.d.ts +3 -3
- package/dist/testing/TestConsole.js +3 -3
- package/dist/testing/TestSchema.d.ts +10 -10
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/testing/TestSchema.js +9 -9
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +4 -2
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +4 -2
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +17 -20
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +36 -39
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +6 -7
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +6 -7
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.d.ts +5 -5
- package/dist/unstable/ai/EmbeddingModel.js +4 -4
- package/dist/unstable/ai/IdGenerator.d.ts +4 -5
- package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
- package/dist/unstable/ai/IdGenerator.js +3 -4
- package/dist/unstable/ai/IdGenerator.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +7 -6
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +6 -5
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +14 -12
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +19 -17
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +11 -4
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +8 -5
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +20 -18
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +45 -43
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Prompt.d.ts +17 -17
- package/dist/unstable/ai/Prompt.js +4 -4
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.d.ts +3 -2
- package/dist/unstable/ai/ResponseIdTracker.d.ts.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.js +3 -2
- package/dist/unstable/ai/ResponseIdTracker.js.map +1 -1
- package/dist/unstable/ai/Telemetry.d.ts +26 -11
- package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
- package/dist/unstable/ai/Telemetry.js +9 -4
- package/dist/unstable/ai/Telemetry.js.map +1 -1
- package/dist/unstable/ai/Tokenizer.d.ts +1 -1
- package/dist/unstable/ai/Tokenizer.js +1 -1
- package/dist/unstable/ai/Tool.d.ts +13 -12
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +14 -13
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +2 -2
- package/dist/unstable/ai/Toolkit.js +2 -2
- package/dist/unstable/cli/Command.d.ts +37 -16
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +16 -9
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Completions.d.ts +1 -1
- package/dist/unstable/cli/Completions.js +1 -1
- package/dist/unstable/cli/Flag.d.ts +7 -6
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +7 -6
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +6 -1
- package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
- package/dist/unstable/cli/GlobalFlag.js +7 -2
- package/dist/unstable/cli/GlobalFlag.js.map +1 -1
- package/dist/unstable/cli/Param.d.ts +4 -4
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +13 -10
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +6 -5
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js +4 -3
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/Prompt.d.ts +11 -11
- package/dist/unstable/cli/internal/parser.js +145 -10
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cluster/ClusterCron.d.ts +1 -2
- package/dist/unstable/cluster/ClusterCron.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterCron.js.map +1 -1
- package/dist/unstable/cluster/ClusterMetrics.d.ts +5 -0
- package/dist/unstable/cluster/ClusterMetrics.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterMetrics.js +5 -0
- package/dist/unstable/cluster/ClusterMetrics.js.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.d.ts +3 -3
- package/dist/unstable/cluster/ClusterSchema.js +3 -3
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +15 -15
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +1 -1
- package/dist/unstable/cluster/Entity.js +1 -1
- package/dist/unstable/cluster/EntityResource.d.ts +10 -0
- package/dist/unstable/cluster/EntityResource.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityResource.js +10 -0
- package/dist/unstable/cluster/EntityResource.js.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts +2 -2
- package/dist/unstable/cluster/Envelope.d.ts.map +1 -1
- package/dist/unstable/cluster/Envelope.js +2 -2
- package/dist/unstable/cluster/Envelope.js.map +1 -1
- package/dist/unstable/cluster/HttpRunner.d.ts +2 -2
- package/dist/unstable/cluster/HttpRunner.js +2 -2
- package/dist/unstable/cluster/K8sHttpClient.d.ts +1 -1
- package/dist/unstable/cluster/K8sHttpClient.js +1 -1
- 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 +12 -12
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.d.ts +2 -1
- package/dist/unstable/cluster/RunnerHealth.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.js +2 -1
- package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts +2 -2
- package/dist/unstable/cluster/RunnerServer.js +2 -2
- package/dist/unstable/cluster/Runners.d.ts +4 -4
- package/dist/unstable/cluster/Runners.js +4 -4
- package/dist/unstable/cluster/ShardId.js +3 -3
- package/dist/unstable/cluster/ShardId.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts +4 -4
- package/dist/unstable/cluster/Sharding.js +4 -4
- package/dist/unstable/cluster/ShardingConfig.d.ts +4 -4
- package/dist/unstable/cluster/ShardingConfig.js +4 -4
- package/dist/unstable/cluster/SingletonAddress.d.ts +1 -1
- package/dist/unstable/cluster/SingletonAddress.js +1 -1
- package/dist/unstable/cluster/Snowflake.d.ts +6 -6
- package/dist/unstable/cluster/Snowflake.js +8 -8
- package/dist/unstable/cluster/Snowflake.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +2 -2
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.d.ts +1 -1
- package/dist/unstable/devtools/DevToolsClient.js +1 -1
- package/dist/unstable/encoding/Msgpack.d.ts +2 -2
- package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
- package/dist/unstable/encoding/Msgpack.js +5 -5
- package/dist/unstable/encoding/Msgpack.js.map +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts +5 -0
- package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
- package/dist/unstable/encoding/Ndjson.js +5 -0
- package/dist/unstable/encoding/Ndjson.js.map +1 -1
- package/dist/unstable/encoding/Sse.d.ts +2 -2
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.js +2 -2
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/eventlog/EventGroup.d.ts +2 -1
- package/dist/unstable/eventlog/EventGroup.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventGroup.js +2 -1
- package/dist/unstable/eventlog/EventGroup.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +10 -0
- package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventJournal.js +10 -0
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts +4 -4
- package/dist/unstable/eventlog/EventLog.js +4 -4
- package/dist/unstable/eventlog/EventLogEncryption.d.ts +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +1 -1
- package/dist/unstable/eventlog/EventLogRemote.js +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +2 -3
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.js +2 -3
- package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +8 -10
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js +8 -10
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +4 -4
- package/dist/unstable/eventlog/EventLogSessionAuth.js +4 -4
- package/dist/unstable/http/Cookies.d.ts +1 -1
- package/dist/unstable/http/Cookies.js +4 -4
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Etag.d.ts +3 -4
- package/dist/unstable/http/Etag.d.ts.map +1 -1
- package/dist/unstable/http/Etag.js +3 -4
- package/dist/unstable/http/Etag.js.map +1 -1
- package/dist/unstable/http/FetchHttpClient.d.ts +2 -2
- package/dist/unstable/http/FetchHttpClient.js +2 -2
- package/dist/unstable/http/Headers.js +2 -2
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpBody.js +2 -2
- package/dist/unstable/http/HttpBody.js.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts +3 -3
- package/dist/unstable/http/HttpClient.js +3 -3
- package/dist/unstable/http/HttpClientRequest.d.ts +32 -5
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +10 -1
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts +1 -1
- package/dist/unstable/http/HttpMiddleware.js +1 -1
- package/dist/unstable/http/HttpPlatform.d.ts +1 -1
- package/dist/unstable/http/HttpPlatform.js +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +5 -5
- package/dist/unstable/http/HttpRouter.js +5 -5
- package/dist/unstable/http/HttpServerResponse.d.ts +28 -23
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +13 -8
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/Multipart.js +3 -3
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/Url.d.ts +33 -33
- package/dist/unstable/http/Url.js +11 -11
- package/dist/unstable/http/UrlParams.d.ts +30 -0
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +16 -6
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/httpapi/HttpApi.d.ts +4 -3
- package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js +4 -3
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +10 -8
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +15 -15
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +13 -13
- package/dist/unstable/httpapi/HttpApiError.js +13 -13
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +3 -3
- package/dist/unstable/httpapi/HttpApiMiddleware.js +3 -3
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +2 -2
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.js +9 -9
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +11 -11
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/observability/OtlpResource.d.ts +5 -0
- package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpResource.js +5 -0
- package/dist/unstable/observability/OtlpResource.js.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.d.ts +8 -6
- package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.js +6 -4
- package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +3 -3
- package/dist/unstable/persistence/KeyValueStore.js +1 -1
- package/dist/unstable/persistence/Persistable.d.ts +2 -2
- package/dist/unstable/persistence/Persistable.js +2 -2
- package/dist/unstable/persistence/PersistedQueue.d.ts +8 -8
- package/dist/unstable/persistence/PersistedQueue.js +8 -8
- package/dist/unstable/persistence/RateLimiter.d.ts +1 -1
- package/dist/unstable/persistence/RateLimiter.js +1 -1
- package/dist/unstable/process/ChildProcess.d.ts +5 -5
- package/dist/unstable/process/ChildProcess.js +2 -2
- package/dist/unstable/reactivity/AsyncResult.d.ts +4 -4
- package/dist/unstable/reactivity/AsyncResult.js +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +4 -4
- package/dist/unstable/reactivity/Atom.js +4 -4
- package/dist/unstable/reactivity/AtomRegistry.d.ts +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +1 -1
- package/dist/unstable/reactivity/Reactivity.d.ts +1 -1
- package/dist/unstable/reactivity/Reactivity.js +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +5 -5
- package/dist/unstable/rpc/Rpc.js +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts +5 -5
- package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSchema.js +2 -2
- package/dist/unstable/rpc/RpcSerialization.d.ts +2 -2
- package/dist/unstable/rpc/RpcSerialization.js +2 -2
- package/dist/unstable/schema/Model.d.ts +2 -2
- package/dist/unstable/schema/Model.js +6 -6
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +2 -2
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +3 -3
- package/dist/unstable/socket/Socket.js +3 -3
- package/dist/unstable/socket/SocketServer.d.ts +1 -1
- package/dist/unstable/socket/SocketServer.js +1 -1
- package/dist/unstable/sql/Migrator.d.ts +1 -1
- package/dist/unstable/sql/SqlClient.d.ts +3 -3
- package/dist/unstable/sql/SqlClient.js +2 -2
- package/dist/unstable/sql/SqlConnection.d.ts +1 -1
- package/dist/unstable/sql/SqlConnection.js +1 -1
- package/dist/unstable/sql/SqlSchema.d.ts +4 -4
- package/dist/unstable/sql/SqlSchema.js +4 -4
- package/dist/unstable/sql/Statement.d.ts +2 -2
- package/dist/unstable/sql/Statement.js +2 -2
- package/dist/unstable/workers/Transferable.d.ts +3 -3
- package/dist/unstable/workers/Transferable.d.ts.map +1 -1
- package/dist/unstable/workers/Transferable.js +6 -6
- package/dist/unstable/workers/Transferable.js.map +1 -1
- package/dist/unstable/workers/Worker.d.ts +1 -1
- package/dist/unstable/workers/Worker.js +1 -1
- package/dist/unstable/workflow/Activity.d.ts +1 -1
- package/dist/unstable/workflow/Activity.js +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts +1 -1
- package/dist/unstable/workflow/DurableDeferred.js +8 -8
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/DurableQueue.d.ts +1 -2
- package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableQueue.js +1 -2
- package/dist/unstable/workflow/DurableQueue.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +35 -15
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js +94 -72
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +10 -2
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +16 -8
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.d.ts +2 -4
- package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.js +9 -11
- package/dist/unstable/workflow/WorkflowProxy.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.js +7 -7
- package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
- package/package.json +1 -1
- package/src/Array.ts +745 -627
- package/src/BigDecimal.ts +37 -30
- package/src/BigInt.ts +34 -40
- package/src/Boolean.ts +10 -10
- package/src/Brand.ts +16 -14
- package/src/Cause.ts +21 -23
- package/src/Channel.ts +316 -76
- package/src/ChannelSchema.ts +11 -11
- package/src/Chunk.ts +87 -34
- package/src/Clock.ts +3 -3
- package/src/Combiner.ts +9 -13
- package/src/Config.ts +60 -67
- package/src/ConfigProvider.ts +34 -44
- package/src/Console.ts +2 -2
- package/src/Context.ts +64 -76
- package/src/Cron.ts +6 -6
- package/src/Crypto.ts +4 -4
- package/src/Data.ts +21 -15
- package/src/DateTime.ts +35 -16
- package/src/Deferred.ts +61 -52
- package/src/Duration.ts +50 -37
- package/src/Effect.ts +574 -474
- package/src/Encoding.ts +5 -0
- package/src/Equal.ts +28 -41
- package/src/Equivalence.ts +72 -100
- package/src/ErrorReporter.ts +1 -1
- package/src/ExecutionPlan.ts +2 -2
- package/src/Exit.ts +79 -96
- package/src/Fiber.ts +8 -6
- package/src/FiberHandle.ts +25 -0
- package/src/FiberMap.ts +35 -0
- package/src/FiberSet.ts +20 -0
- package/src/FileSystem.ts +6 -6
- package/src/Filter.ts +4 -4
- package/src/Formatter.ts +14 -19
- package/src/Function.ts +20 -21
- package/src/Graph.ts +13 -13
- package/src/HKT.ts +3 -3
- package/src/Hash.ts +2 -1
- package/src/HashMap.ts +18 -3
- package/src/HashRing.ts +9 -9
- package/src/HashSet.ts +1 -1
- package/src/Iterable.ts +39 -27
- package/src/JsonPatch.ts +2 -3
- package/src/JsonPointer.ts +2 -6
- package/src/JsonSchema.ts +17 -13
- package/src/Latch.ts +4 -3
- package/src/Layer.ts +108 -130
- package/src/Logger.ts +22 -25
- package/src/ManagedRuntime.ts +2 -2
- package/src/Match.ts +22 -22
- package/src/Metric.ts +129 -157
- package/src/MutableHashMap.ts +35 -20
- package/src/MutableList.ts +15 -0
- package/src/MutableRef.ts +56 -42
- package/src/Newtype.ts +10 -7
- package/src/Number.ts +23 -11
- package/src/Optic.ts +25 -22
- package/src/Option.ts +232 -204
- package/src/Order.ts +119 -180
- package/src/PartitionedSemaphore.ts +14 -14
- package/src/Path.ts +3 -3
- package/src/Pipeable.ts +3 -3
- package/src/PlatformError.ts +4 -4
- package/src/Pool.ts +7 -11
- package/src/Predicate.ts +279 -268
- package/src/PubSub.ts +33 -23
- package/src/Pull.ts +4 -4
- package/src/Queue.ts +70 -31
- package/src/RcRef.ts +0 -4
- package/src/Record.ts +15 -15
- package/src/Redactable.ts +2 -2
- package/src/Redacted.ts +5 -5
- package/src/Reducer.ts +2 -3
- package/src/Ref.ts +61 -58
- package/src/References.ts +4 -4
- package/src/RegExp.ts +1 -1
- package/src/Request.ts +22 -22
- package/src/RequestResolver.ts +8 -8
- package/src/Resource.ts +3 -3
- package/src/Result.ts +105 -51
- package/src/Runtime.ts +11 -8
- package/src/Schedule.ts +157 -90
- package/src/Scheduler.ts +6 -4
- package/src/Schema.ts +1020 -1108
- package/src/SchemaAST.ts +149 -118
- package/src/SchemaGetter.ts +155 -134
- package/src/SchemaIssue.ts +39 -41
- package/src/SchemaParser.ts +176 -232
- package/src/SchemaRepresentation.ts +38 -28
- package/src/SchemaTransformation.ts +233 -207
- package/src/SchemaUtils.ts +2 -2
- package/src/Scope.ts +16 -1
- package/src/ScopedCache.ts +1 -1
- package/src/ScopedRef.ts +14 -18
- package/src/Semaphore.ts +9 -9
- package/src/Sink.ts +18 -18
- package/src/Stdio.ts +4 -5
- package/src/Stream.ts +411 -114
- package/src/String.ts +11 -14
- package/src/Struct.ts +23 -21
- package/src/SubscriptionRef.ts +24 -19
- package/src/SynchronizedRef.ts +145 -120
- package/src/Terminal.ts +1 -1
- package/src/Tracer.ts +9 -9
- package/src/Trie.ts +15 -0
- package/src/Tuple.ts +39 -33
- package/src/TxHashMap.ts +3 -3
- package/src/TxHashSet.ts +1 -1
- package/src/TxReentrantLock.ts +6 -3
- package/src/TxRef.ts +16 -16
- package/src/TxSubscriptionRef.ts +43 -27
- package/src/Types.ts +12 -39
- package/src/UndefinedOr.ts +15 -14
- package/src/Unify.ts +9 -9
- package/src/internal/schema/annotations.ts +4 -4
- package/src/internal/schema/arbitrary.ts +16 -16
- package/src/internal/schema/equivalence.ts +11 -11
- package/src/internal/schema/representation.ts +23 -23
- package/src/internal/schema/schema.ts +17 -17
- package/src/testing/TestClock.ts +5 -5
- package/src/testing/TestConsole.ts +3 -3
- package/src/testing/TestSchema.ts +20 -20
- package/src/unstable/ai/AiError.ts +4 -2
- package/src/unstable/ai/AnthropicStructuredOutput.ts +59 -56
- package/src/unstable/ai/Chat.ts +6 -7
- package/src/unstable/ai/EmbeddingModel.ts +5 -5
- package/src/unstable/ai/IdGenerator.ts +4 -5
- package/src/unstable/ai/LanguageModel.ts +9 -8
- package/src/unstable/ai/McpSchema.ts +19 -17
- package/src/unstable/ai/McpServer.ts +14 -7
- package/src/unstable/ai/OpenAiStructuredOutput.ts +72 -61
- package/src/unstable/ai/Prompt.ts +20 -20
- package/src/unstable/ai/ResponseIdTracker.ts +3 -2
- package/src/unstable/ai/Telemetry.ts +26 -11
- package/src/unstable/ai/Tokenizer.ts +1 -1
- package/src/unstable/ai/Tool.ts +17 -16
- package/src/unstable/ai/Toolkit.ts +2 -2
- package/src/unstable/cli/Command.ts +42 -17
- package/src/unstable/cli/Completions.ts +1 -1
- package/src/unstable/cli/Flag.ts +7 -6
- package/src/unstable/cli/GlobalFlag.ts +7 -1
- package/src/unstable/cli/Param.ts +24 -19
- package/src/unstable/cli/Primitive.ts +6 -5
- package/src/unstable/cli/Prompt.ts +11 -11
- package/src/unstable/cli/internal/parser.ts +204 -10
- package/src/unstable/cluster/ClusterCron.ts +1 -2
- package/src/unstable/cluster/ClusterMetrics.ts +5 -0
- package/src/unstable/cluster/ClusterSchema.ts +3 -3
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +15 -15
- package/src/unstable/cluster/Entity.ts +1 -1
- package/src/unstable/cluster/EntityResource.ts +10 -0
- package/src/unstable/cluster/Envelope.ts +3 -3
- package/src/unstable/cluster/HttpRunner.ts +2 -2
- package/src/unstable/cluster/K8sHttpClient.ts +1 -1
- package/src/unstable/cluster/Reply.ts +14 -12
- package/src/unstable/cluster/RunnerHealth.ts +2 -1
- package/src/unstable/cluster/RunnerServer.ts +2 -2
- package/src/unstable/cluster/Runners.ts +4 -4
- package/src/unstable/cluster/ShardId.ts +3 -3
- package/src/unstable/cluster/Sharding.ts +4 -4
- package/src/unstable/cluster/ShardingConfig.ts +4 -4
- package/src/unstable/cluster/SingletonAddress.ts +1 -1
- package/src/unstable/cluster/Snowflake.ts +8 -8
- package/src/unstable/cluster/internal/entityManager.ts +2 -2
- package/src/unstable/devtools/DevToolsClient.ts +1 -1
- package/src/unstable/encoding/Msgpack.ts +6 -6
- package/src/unstable/encoding/Ndjson.ts +5 -0
- package/src/unstable/encoding/Sse.ts +2 -2
- package/src/unstable/eventlog/EventGroup.ts +2 -1
- package/src/unstable/eventlog/EventJournal.ts +10 -0
- package/src/unstable/eventlog/EventLog.ts +4 -4
- package/src/unstable/eventlog/EventLogEncryption.ts +1 -1
- package/src/unstable/eventlog/EventLogRemote.ts +1 -1
- package/src/unstable/eventlog/EventLogServerEncrypted.ts +2 -3
- package/src/unstable/eventlog/EventLogServerUnencrypted.ts +8 -10
- package/src/unstable/eventlog/EventLogSessionAuth.ts +4 -4
- package/src/unstable/http/Cookies.ts +5 -5
- package/src/unstable/http/Etag.ts +3 -4
- package/src/unstable/http/FetchHttpClient.ts +2 -2
- package/src/unstable/http/Headers.ts +2 -2
- package/src/unstable/http/HttpBody.ts +2 -2
- package/src/unstable/http/HttpClient.ts +3 -3
- package/src/unstable/http/HttpClientRequest.ts +32 -5
- package/src/unstable/http/HttpMiddleware.ts +1 -1
- package/src/unstable/http/HttpPlatform.ts +1 -1
- package/src/unstable/http/HttpRouter.ts +5 -5
- package/src/unstable/http/HttpServerResponse.ts +28 -23
- package/src/unstable/http/Multipart.ts +3 -3
- package/src/unstable/http/Url.ts +33 -33
- package/src/unstable/http/UrlParams.ts +36 -6
- package/src/unstable/httpapi/HttpApi.ts +6 -5
- package/src/unstable/httpapi/HttpApiBuilder.ts +14 -13
- package/src/unstable/httpapi/HttpApiClient.ts +16 -16
- package/src/unstable/httpapi/HttpApiError.ts +13 -13
- package/src/unstable/httpapi/HttpApiMiddleware.ts +3 -3
- package/src/unstable/httpapi/HttpApiSchema.ts +15 -15
- package/src/unstable/httpapi/OpenApi.ts +18 -18
- package/src/unstable/observability/OtlpResource.ts +5 -0
- package/src/unstable/observability/PrometheusMetrics.ts +8 -6
- package/src/unstable/persistence/KeyValueStore.ts +3 -3
- package/src/unstable/persistence/Persistable.ts +2 -2
- package/src/unstable/persistence/PersistedQueue.ts +8 -8
- package/src/unstable/persistence/RateLimiter.ts +1 -1
- package/src/unstable/process/ChildProcess.ts +5 -5
- package/src/unstable/reactivity/AsyncResult.ts +4 -4
- package/src/unstable/reactivity/Atom.ts +4 -4
- package/src/unstable/reactivity/AtomRegistry.ts +1 -1
- package/src/unstable/reactivity/Reactivity.ts +1 -1
- package/src/unstable/rpc/Rpc.ts +5 -5
- package/src/unstable/rpc/RpcMiddleware.ts +1 -1
- package/src/unstable/rpc/RpcSchema.ts +5 -5
- package/src/unstable/rpc/RpcSerialization.ts +2 -2
- package/src/unstable/schema/Model.ts +7 -7
- package/src/unstable/schema/VariantSchema.ts +2 -2
- package/src/unstable/socket/Socket.ts +3 -3
- package/src/unstable/socket/SocketServer.ts +1 -1
- package/src/unstable/sql/Migrator.ts +1 -1
- package/src/unstable/sql/SqlClient.ts +3 -3
- package/src/unstable/sql/SqlConnection.ts +1 -1
- package/src/unstable/sql/SqlSchema.ts +4 -4
- package/src/unstable/sql/Statement.ts +2 -2
- package/src/unstable/workers/Transferable.ts +7 -7
- package/src/unstable/workers/Worker.ts +1 -1
- package/src/unstable/workflow/Activity.ts +1 -1
- package/src/unstable/workflow/DurableDeferred.ts +8 -8
- package/src/unstable/workflow/DurableQueue.ts +1 -2
- package/src/unstable/workflow/Workflow.ts +159 -114
- package/src/unstable/workflow/WorkflowEngine.ts +16 -8
- package/src/unstable/workflow/WorkflowProxy.ts +9 -11
- package/src/unstable/workflow/WorkflowProxyServer.ts +7 -7
package/src/SchemaParser.ts
CHANGED
|
@@ -53,17 +53,17 @@ import * as Option from "./Option.ts"
|
|
|
53
53
|
import * as Predicate from "./Predicate.ts"
|
|
54
54
|
import * as Result from "./Result.ts"
|
|
55
55
|
import type * as Schema from "./Schema.ts"
|
|
56
|
-
import * as
|
|
57
|
-
import * as
|
|
56
|
+
import * as SchemaAST from "./SchemaAST.ts"
|
|
57
|
+
import * as SchemaIssue from "./SchemaIssue.ts"
|
|
58
58
|
|
|
59
|
-
const recurDefaults = memoize((ast:
|
|
59
|
+
const recurDefaults = memoize((ast: SchemaAST.AST): SchemaAST.AST => {
|
|
60
60
|
switch (ast._tag) {
|
|
61
61
|
case "Declaration": {
|
|
62
|
-
const getLink = ast.annotations?.[
|
|
62
|
+
const getLink = ast.annotations?.[SchemaAST.ClassTypeId]
|
|
63
63
|
if (Predicate.isFunction(getLink)) {
|
|
64
64
|
const link = getLink(ast.typeParameters)
|
|
65
65
|
const to = recurDefaults(link.to)
|
|
66
|
-
return
|
|
66
|
+
return SchemaAST.replaceEncoding(ast, to === link.to ? [link] : [new SchemaAST.Link(to, link.transformation)])
|
|
67
67
|
}
|
|
68
68
|
return ast
|
|
69
69
|
}
|
|
@@ -72,7 +72,7 @@ const recurDefaults = memoize((ast: AST.AST): AST.AST => {
|
|
|
72
72
|
return ast.recur((ast) => {
|
|
73
73
|
const defaultValue = ast.context?.defaultValue
|
|
74
74
|
if (defaultValue) {
|
|
75
|
-
return
|
|
75
|
+
return SchemaAST.replaceEncoding(recurDefaults(ast), defaultValue)
|
|
76
76
|
}
|
|
77
77
|
return recurDefaults(ast)
|
|
78
78
|
})
|
|
@@ -89,7 +89,7 @@ const recurDefaults = memoize((ast: AST.AST): AST.AST => {
|
|
|
89
89
|
* **When to use**
|
|
90
90
|
*
|
|
91
91
|
* Use to construct decoded schema values in `Effect` while preserving
|
|
92
|
-
* construction
|
|
92
|
+
* construction failures as `SchemaIssue.Issue` values in the error channel.
|
|
93
93
|
*
|
|
94
94
|
* **Details**
|
|
95
95
|
*
|
|
@@ -97,13 +97,13 @@ const recurDefaults = memoize((ast: AST.AST): AST.AST => {
|
|
|
97
97
|
* runs type-side validation unless checks are disabled, and fails with a
|
|
98
98
|
* `SchemaIssue.Issue` when construction fails.
|
|
99
99
|
*
|
|
100
|
-
* @category
|
|
100
|
+
* @category constructors
|
|
101
101
|
* @since 4.0.0
|
|
102
102
|
*/
|
|
103
103
|
export function makeEffect<S extends Schema.Top>(schema: S) {
|
|
104
|
-
const ast = recurDefaults(
|
|
104
|
+
const ast = recurDefaults(SchemaAST.toType(schema.ast))
|
|
105
105
|
const parser = run<S["Type"], never>(ast)
|
|
106
|
-
return (input: S["~type.make.in"], options?: Schema.MakeOptions): Effect.Effect<S["Type"],
|
|
106
|
+
return (input: S["~type.make.in"], options?: Schema.MakeOptions): Effect.Effect<S["Type"], SchemaIssue.Issue> => {
|
|
107
107
|
return parser(
|
|
108
108
|
input,
|
|
109
109
|
options?.disableChecks
|
|
@@ -119,10 +119,10 @@ export function makeEffect<S extends Schema.Top>(schema: S) {
|
|
|
119
119
|
*
|
|
120
120
|
* **When to use**
|
|
121
121
|
*
|
|
122
|
-
* Use when you
|
|
123
|
-
*
|
|
122
|
+
* Use when you need to validate schema constructor input and only care whether
|
|
123
|
+
* construction succeeds, without exposing `SchemaIssue.Issue` details.
|
|
124
124
|
*
|
|
125
|
-
* @category
|
|
125
|
+
* @category constructors
|
|
126
126
|
* @since 4.0.0
|
|
127
127
|
*/
|
|
128
128
|
export function makeOption<S extends Schema.Top>(schema: S) {
|
|
@@ -138,14 +138,14 @@ export function makeOption<S extends Schema.Top>(schema: S) {
|
|
|
138
138
|
* **When to use**
|
|
139
139
|
*
|
|
140
140
|
* Use to construct decoded schema values synchronously when invalid input
|
|
141
|
-
* should throw.
|
|
141
|
+
* should throw an `Error` whose cause is `SchemaIssue.Issue`.
|
|
142
142
|
*
|
|
143
143
|
* **Details**
|
|
144
144
|
*
|
|
145
145
|
* The returned function constructs a value from constructor input and throws an
|
|
146
146
|
* `Error` with the `SchemaIssue.Issue` in its `cause` when construction fails.
|
|
147
147
|
*
|
|
148
|
-
* @category
|
|
148
|
+
* @category constructors
|
|
149
149
|
* @since 4.0.0
|
|
150
150
|
*/
|
|
151
151
|
export function make<S extends Schema.Top>(schema: S) {
|
|
@@ -182,17 +182,17 @@ export function is<T>(schema: Schema.Schema<T>): <I>(input: I) => input is I & T
|
|
|
182
182
|
}
|
|
183
183
|
|
|
184
184
|
/** @internal */
|
|
185
|
-
export function _is<T>(ast:
|
|
186
|
-
const parser = asExit(run<T, never>(
|
|
185
|
+
export function _is<T>(ast: SchemaAST.AST) {
|
|
186
|
+
const parser = asExit(run<T, never>(SchemaAST.toType(ast)))
|
|
187
187
|
return <I>(input: I): input is I & T => {
|
|
188
|
-
return Exit.isSuccess(parser(input,
|
|
188
|
+
return Exit.isSuccess(parser(input, SchemaAST.defaultParseOptions))
|
|
189
189
|
}
|
|
190
190
|
}
|
|
191
191
|
|
|
192
192
|
/** @internal */
|
|
193
|
-
export function _issue<T>(ast:
|
|
193
|
+
export function _issue<T>(ast: SchemaAST.AST) {
|
|
194
194
|
const parser = run<T, never>(ast)
|
|
195
|
-
return (input: unknown, options:
|
|
195
|
+
return (input: unknown, options: SchemaAST.ParseOptions): SchemaIssue.Issue | undefined => {
|
|
196
196
|
return Effect.runSync(Effect.matchEager(parser(input, options), {
|
|
197
197
|
onSuccess: () => undefined,
|
|
198
198
|
onFailure: identity
|
|
@@ -206,7 +206,7 @@ export function _issue<T>(ast: AST.AST) {
|
|
|
206
206
|
* **When to use**
|
|
207
207
|
*
|
|
208
208
|
* Use to assert that an input satisfies the decoded side of a schema, throwing
|
|
209
|
-
* when validation fails.
|
|
209
|
+
* an `Error` whose cause is `SchemaIssue.Issue` when validation fails.
|
|
210
210
|
*
|
|
211
211
|
* **Details**
|
|
212
212
|
*
|
|
@@ -217,8 +217,8 @@ export function _issue<T>(ast: AST.AST) {
|
|
|
217
217
|
* @since 4.0.0
|
|
218
218
|
*/
|
|
219
219
|
export function asserts<S extends Schema.Top, I>(schema: S, input: I): asserts input is I & S["Type"] {
|
|
220
|
-
const parser = asExit(run<S["Type"], never>(
|
|
221
|
-
const exit = parser(input,
|
|
220
|
+
const parser = asExit(run<S["Type"], never>(SchemaAST.toType(schema.ast)))
|
|
221
|
+
const exit = parser(input, SchemaAST.defaultParseOptions)
|
|
222
222
|
if (Exit.isFailure(exit)) {
|
|
223
223
|
const issue = Cause.findError(exit.cause)
|
|
224
224
|
if (Result.isFailure(issue)) {
|
|
@@ -233,8 +233,9 @@ export function asserts<S extends Schema.Top, I>(schema: S, input: I): asserts i
|
|
|
233
233
|
*
|
|
234
234
|
* **When to use**
|
|
235
235
|
*
|
|
236
|
-
* Use when
|
|
237
|
-
*
|
|
236
|
+
* Use when you need to decode untyped boundary input in an `Effect` whose
|
|
237
|
+
* failure channel is `SchemaIssue.Issue`, while preserving transformations
|
|
238
|
+
* and service requirements.
|
|
238
239
|
*
|
|
239
240
|
* **Details**
|
|
240
241
|
*
|
|
@@ -250,8 +251,11 @@ export function asserts<S extends Schema.Top, I>(schema: S, input: I): asserts i
|
|
|
250
251
|
*/
|
|
251
252
|
export function decodeUnknownEffect<S extends Schema.Top>(
|
|
252
253
|
schema: S,
|
|
253
|
-
options?:
|
|
254
|
-
): (
|
|
254
|
+
options?: SchemaAST.ParseOptions
|
|
255
|
+
): (
|
|
256
|
+
input: unknown,
|
|
257
|
+
options?: SchemaAST.ParseOptions
|
|
258
|
+
) => Effect.Effect<S["Type"], SchemaIssue.Issue, S["DecodingServices"]> {
|
|
255
259
|
const parser = run<S["Type"], S["DecodingServices"]>(schema.ast)
|
|
256
260
|
return options === undefined
|
|
257
261
|
? parser
|
|
@@ -264,9 +268,9 @@ export function decodeUnknownEffect<S extends Schema.Top>(
|
|
|
264
268
|
*
|
|
265
269
|
* **When to use**
|
|
266
270
|
*
|
|
267
|
-
* Use when
|
|
268
|
-
*
|
|
269
|
-
* decoding
|
|
271
|
+
* Use when you already have input typed as the schema's `Encoded` type and
|
|
272
|
+
* need an `Effect` whose failure channel is `SchemaIssue.Issue`, while
|
|
273
|
+
* preserving decoding service requirements.
|
|
270
274
|
*
|
|
271
275
|
* **Details**
|
|
272
276
|
*
|
|
@@ -282,17 +286,19 @@ export function decodeUnknownEffect<S extends Schema.Top>(
|
|
|
282
286
|
*/
|
|
283
287
|
export const decodeEffect: <S extends Schema.Top>(
|
|
284
288
|
schema: S,
|
|
285
|
-
options?:
|
|
286
|
-
) => (
|
|
287
|
-
|
|
289
|
+
options?: SchemaAST.ParseOptions
|
|
290
|
+
) => (
|
|
291
|
+
input: S["Encoded"],
|
|
292
|
+
options?: SchemaAST.ParseOptions
|
|
293
|
+
) => Effect.Effect<S["Type"], SchemaIssue.Issue, S["DecodingServices"]> = decodeUnknownEffect
|
|
288
294
|
|
|
289
295
|
/**
|
|
290
296
|
* Creates a Promise-based decoder for `unknown` input.
|
|
291
297
|
*
|
|
292
298
|
* **When to use**
|
|
293
299
|
*
|
|
294
|
-
* Use when
|
|
295
|
-
* `Promise`
|
|
300
|
+
* Use when you need to decode untyped input with a service-free schema and
|
|
301
|
+
* return a JavaScript `Promise` that rejects with `SchemaIssue.Issue`.
|
|
296
302
|
*
|
|
297
303
|
* **Details**
|
|
298
304
|
*
|
|
@@ -307,8 +313,8 @@ export const decodeEffect: <S extends Schema.Top>(
|
|
|
307
313
|
*/
|
|
308
314
|
export function decodeUnknownPromise<S extends Schema.Decoder<unknown>>(
|
|
309
315
|
schema: S,
|
|
310
|
-
options?:
|
|
311
|
-
): (input: unknown, options?:
|
|
316
|
+
options?: SchemaAST.ParseOptions
|
|
317
|
+
): (input: unknown, options?: SchemaAST.ParseOptions) => Promise<S["Type"]> {
|
|
312
318
|
return asPromise(decodeUnknownEffect(schema, options))
|
|
313
319
|
}
|
|
314
320
|
|
|
@@ -318,15 +324,15 @@ export function decodeUnknownPromise<S extends Schema.Decoder<unknown>>(
|
|
|
318
324
|
*
|
|
319
325
|
* **When to use**
|
|
320
326
|
*
|
|
321
|
-
* Use when
|
|
322
|
-
*
|
|
327
|
+
* Use when you already have input typed as the schema's `Encoded` type and need
|
|
328
|
+
* decoding to return a JavaScript `Promise` that rejects with `SchemaIssue.Issue`.
|
|
323
329
|
*
|
|
324
330
|
* **Details**
|
|
325
331
|
*
|
|
326
332
|
* The returned function resolves with the decoded `Type` on success and rejects
|
|
327
333
|
* with a `SchemaIssue.Issue` on decoding failure.
|
|
328
334
|
*
|
|
329
|
-
* @see {@link decodeUnknownPromise} for untyped input
|
|
335
|
+
* @see {@link decodeUnknownPromise} for untyped input returning a JavaScript `Promise`
|
|
330
336
|
* @see {@link decodeEffect} for preserving decoding services and failures in `Effect`
|
|
331
337
|
*
|
|
332
338
|
* @category decoding
|
|
@@ -334,8 +340,8 @@ export function decodeUnknownPromise<S extends Schema.Decoder<unknown>>(
|
|
|
334
340
|
*/
|
|
335
341
|
export function decodePromise<S extends Schema.Decoder<unknown>>(
|
|
336
342
|
schema: S,
|
|
337
|
-
options?:
|
|
338
|
-
): (input: S["Encoded"], options?:
|
|
343
|
+
options?: SchemaAST.ParseOptions
|
|
344
|
+
): (input: S["Encoded"], options?: SchemaAST.ParseOptions) => Promise<S["Type"]> {
|
|
339
345
|
return asPromise(decodeEffect(schema, options))
|
|
340
346
|
}
|
|
341
347
|
|
|
@@ -345,8 +351,8 @@ export function decodePromise<S extends Schema.Decoder<unknown>>(
|
|
|
345
351
|
*
|
|
346
352
|
* **When to use**
|
|
347
353
|
*
|
|
348
|
-
* Use when
|
|
349
|
-
*
|
|
354
|
+
* Use when you need to decode unknown input synchronously into an `Exit` whose
|
|
355
|
+
* failure contains `SchemaIssue.Issue`.
|
|
350
356
|
*
|
|
351
357
|
* **Details**
|
|
352
358
|
*
|
|
@@ -361,7 +367,6 @@ export function decodePromise<S extends Schema.Decoder<unknown>>(
|
|
|
361
367
|
*
|
|
362
368
|
* @see {@link decodeExit} for input already typed as the schema's `Encoded` type
|
|
363
369
|
* @see {@link decodeUnknownEffect} for preserving decoding services and failures in `Effect`
|
|
364
|
-
* @see {@link decodeUnknownOption} for discarding issue details
|
|
365
370
|
* @see {@link decodeUnknownResult} for returning schema issues as data
|
|
366
371
|
* @see {@link decodeUnknownSync} for throwing on decoding failure
|
|
367
372
|
*
|
|
@@ -370,8 +375,8 @@ export function decodePromise<S extends Schema.Decoder<unknown>>(
|
|
|
370
375
|
*/
|
|
371
376
|
export function decodeUnknownExit<S extends Schema.Decoder<unknown>>(
|
|
372
377
|
schema: S,
|
|
373
|
-
options?:
|
|
374
|
-
): (input: unknown, options?:
|
|
378
|
+
options?: SchemaAST.ParseOptions
|
|
379
|
+
): (input: unknown, options?: SchemaAST.ParseOptions) => Exit.Exit<S["Type"], SchemaIssue.Issue> {
|
|
375
380
|
return asExit(decodeUnknownEffect(schema, options))
|
|
376
381
|
}
|
|
377
382
|
|
|
@@ -381,8 +386,8 @@ export function decodeUnknownExit<S extends Schema.Decoder<unknown>>(
|
|
|
381
386
|
*
|
|
382
387
|
* **When to use**
|
|
383
388
|
*
|
|
384
|
-
* Use
|
|
385
|
-
*
|
|
389
|
+
* Use when you need synchronous decoding of already typed `Encoded` input into
|
|
390
|
+
* an `Exit` whose failure contains `SchemaIssue.Issue`.
|
|
386
391
|
*
|
|
387
392
|
* **Details**
|
|
388
393
|
*
|
|
@@ -397,59 +402,23 @@ export function decodeUnknownExit<S extends Schema.Decoder<unknown>>(
|
|
|
397
402
|
*/
|
|
398
403
|
export const decodeExit: <S extends Schema.Decoder<unknown>>(
|
|
399
404
|
schema: S,
|
|
400
|
-
options?:
|
|
401
|
-
) => (input: S["Encoded"], options?:
|
|
405
|
+
options?: SchemaAST.ParseOptions
|
|
406
|
+
) => (input: S["Encoded"], options?: SchemaAST.ParseOptions) => Exit.Exit<S["Type"], SchemaIssue.Issue> =
|
|
407
|
+
decodeUnknownExit
|
|
402
408
|
|
|
403
|
-
/**
|
|
404
|
-
* Creates a decoder for `unknown` input that returns an `Option` safely.
|
|
405
|
-
*
|
|
406
|
-
* **When to use**
|
|
407
|
-
*
|
|
408
|
-
* Use when you need a synchronous yes/no decode from untyped input and do not
|
|
409
|
-
* need schema issue details.
|
|
410
|
-
*
|
|
411
|
-
* **Details**
|
|
412
|
-
*
|
|
413
|
-
* The returned function produces `Option.some` with the decoded `Type` on success
|
|
414
|
-
* or `Option.none` on failure, discarding issue details.
|
|
415
|
-
*
|
|
416
|
-
* @see {@link decodeOption} for input already typed as the schema's `Encoded` type
|
|
417
|
-
* @see {@link decodeUnknownResult} for retaining schema issues as data
|
|
418
|
-
*
|
|
419
|
-
* @category decoding
|
|
420
|
-
* @since 3.10.0
|
|
421
|
-
*/
|
|
409
|
+
/** @internal */
|
|
422
410
|
export function decodeUnknownOption<S extends Schema.Decoder<unknown>>(
|
|
423
411
|
schema: S,
|
|
424
|
-
options?:
|
|
425
|
-
): (input: unknown, options?:
|
|
412
|
+
options?: SchemaAST.ParseOptions
|
|
413
|
+
): (input: unknown, options?: SchemaAST.ParseOptions) => Option.Option<S["Type"]> {
|
|
426
414
|
return asOption(decodeUnknownEffect(schema, options))
|
|
427
415
|
}
|
|
428
416
|
|
|
429
|
-
/**
|
|
430
|
-
* Creates a decoder safely for input already typed as the schema's `Encoded` type,
|
|
431
|
-
* returning an `Option`.
|
|
432
|
-
*
|
|
433
|
-
* **When to use**
|
|
434
|
-
*
|
|
435
|
-
* Use when the input is already typed as the schema's `Encoded` type and you
|
|
436
|
-
* only need to know whether decoding succeeds.
|
|
437
|
-
*
|
|
438
|
-
* **Details**
|
|
439
|
-
*
|
|
440
|
-
* The returned function produces `Option.some` with the decoded `Type` on success
|
|
441
|
-
* or `Option.none` on failure, discarding issue details.
|
|
442
|
-
*
|
|
443
|
-
* @see {@link decodeUnknownOption} for untyped input with the same yes/no result shape
|
|
444
|
-
* @see {@link decodeResult} for retaining schema issues as data
|
|
445
|
-
*
|
|
446
|
-
* @category decoding
|
|
447
|
-
* @since 3.10.0
|
|
448
|
-
*/
|
|
417
|
+
/** @internal */
|
|
449
418
|
export const decodeOption: <S extends Schema.Decoder<unknown>>(
|
|
450
419
|
schema: S,
|
|
451
|
-
options?:
|
|
452
|
-
) => (input: S["Encoded"], options?:
|
|
420
|
+
options?: SchemaAST.ParseOptions
|
|
421
|
+
) => (input: S["Encoded"], options?: SchemaAST.ParseOptions) => Option.Option<S["Type"]> = decodeUnknownOption
|
|
453
422
|
|
|
454
423
|
/**
|
|
455
424
|
* Creates a decoder for `unknown` input that reports failure safely as a
|
|
@@ -457,8 +426,8 @@ export const decodeOption: <S extends Schema.Decoder<unknown>>(
|
|
|
457
426
|
*
|
|
458
427
|
* **When to use**
|
|
459
428
|
*
|
|
460
|
-
* Use when decoding untyped boundary input and you want
|
|
461
|
-
* as data in a `Result`.
|
|
429
|
+
* Use when decoding untyped boundary input and you want `SchemaIssue.Issue`
|
|
430
|
+
* failures returned as data in a `Result`.
|
|
462
431
|
*
|
|
463
432
|
* **Details**
|
|
464
433
|
*
|
|
@@ -478,8 +447,8 @@ export const decodeOption: <S extends Schema.Decoder<unknown>>(
|
|
|
478
447
|
*/
|
|
479
448
|
export function decodeUnknownResult<S extends Schema.Decoder<unknown>>(
|
|
480
449
|
schema: S,
|
|
481
|
-
options?:
|
|
482
|
-
): (input: unknown, options?:
|
|
450
|
+
options?: SchemaAST.ParseOptions
|
|
451
|
+
): (input: unknown, options?: SchemaAST.ParseOptions) => Result.Result<S["Type"], SchemaIssue.Issue> {
|
|
483
452
|
return asResult(decodeUnknownEffect(schema, options))
|
|
484
453
|
}
|
|
485
454
|
|
|
@@ -489,8 +458,8 @@ export function decodeUnknownResult<S extends Schema.Decoder<unknown>>(
|
|
|
489
458
|
*
|
|
490
459
|
* **When to use**
|
|
491
460
|
*
|
|
492
|
-
* Use when
|
|
493
|
-
*
|
|
461
|
+
* Use when you already have input typed as the schema's `Encoded` type and want
|
|
462
|
+
* schema decoding failures represented as `Result.fail` with `SchemaIssue.Issue`.
|
|
494
463
|
*
|
|
495
464
|
* **Details**
|
|
496
465
|
*
|
|
@@ -510,8 +479,9 @@ export function decodeUnknownResult<S extends Schema.Decoder<unknown>>(
|
|
|
510
479
|
*/
|
|
511
480
|
export const decodeResult: <S extends Schema.Decoder<unknown>>(
|
|
512
481
|
schema: S,
|
|
513
|
-
options?:
|
|
514
|
-
) => (input: S["Encoded"], options?:
|
|
482
|
+
options?: SchemaAST.ParseOptions
|
|
483
|
+
) => (input: S["Encoded"], options?: SchemaAST.ParseOptions) => Result.Result<S["Type"], SchemaIssue.Issue> =
|
|
484
|
+
decodeUnknownResult
|
|
515
485
|
|
|
516
486
|
/**
|
|
517
487
|
* Creates a synchronous decoder for `unknown` input.
|
|
@@ -519,7 +489,7 @@ export const decodeResult: <S extends Schema.Decoder<unknown>>(
|
|
|
519
489
|
* **When to use**
|
|
520
490
|
*
|
|
521
491
|
* Use to decode untrusted or dynamically typed input at a synchronous boundary
|
|
522
|
-
* where invalid data should
|
|
492
|
+
* where invalid data should throw an `Error` whose cause is `SchemaIssue.Issue`.
|
|
523
493
|
*
|
|
524
494
|
* **Details**
|
|
525
495
|
*
|
|
@@ -535,8 +505,8 @@ export const decodeResult: <S extends Schema.Decoder<unknown>>(
|
|
|
535
505
|
*/
|
|
536
506
|
export function decodeUnknownSync<S extends Schema.Decoder<unknown>>(
|
|
537
507
|
schema: S,
|
|
538
|
-
options?:
|
|
539
|
-
): (input: unknown, options?:
|
|
508
|
+
options?: SchemaAST.ParseOptions
|
|
509
|
+
): (input: unknown, options?: SchemaAST.ParseOptions) => S["Type"] {
|
|
540
510
|
return asSync(decodeUnknownEffect(schema, options))
|
|
541
511
|
}
|
|
542
512
|
|
|
@@ -547,7 +517,7 @@ export function decodeUnknownSync<S extends Schema.Decoder<unknown>>(
|
|
|
547
517
|
* **When to use**
|
|
548
518
|
*
|
|
549
519
|
* Use to decode values already typed as the schema's `Encoded` input when
|
|
550
|
-
* decoding failure should
|
|
520
|
+
* decoding failure should throw an `Error` whose cause is `SchemaIssue.Issue`.
|
|
551
521
|
*
|
|
552
522
|
* **Details**
|
|
553
523
|
*
|
|
@@ -563,16 +533,17 @@ export function decodeUnknownSync<S extends Schema.Decoder<unknown>>(
|
|
|
563
533
|
*/
|
|
564
534
|
export const decodeSync: <S extends Schema.Decoder<unknown>>(
|
|
565
535
|
schema: S,
|
|
566
|
-
options?:
|
|
567
|
-
) => (input: S["Encoded"], options?:
|
|
536
|
+
options?: SchemaAST.ParseOptions
|
|
537
|
+
) => (input: S["Encoded"], options?: SchemaAST.ParseOptions) => S["Type"] = decodeUnknownSync
|
|
568
538
|
|
|
569
539
|
/**
|
|
570
540
|
* Creates an effectful encoder for `unknown` input.
|
|
571
541
|
*
|
|
572
542
|
* **When to use**
|
|
573
543
|
*
|
|
574
|
-
* Use when
|
|
575
|
-
*
|
|
544
|
+
* Use when you need to encode untyped boundary input in an `Effect` whose
|
|
545
|
+
* failure channel is `SchemaIssue.Issue`, while preserving service
|
|
546
|
+
* requirements.
|
|
576
547
|
*
|
|
577
548
|
* **Details**
|
|
578
549
|
*
|
|
@@ -588,9 +559,12 @@ export const decodeSync: <S extends Schema.Decoder<unknown>>(
|
|
|
588
559
|
*/
|
|
589
560
|
export function encodeUnknownEffect<S extends Schema.Top>(
|
|
590
561
|
schema: S,
|
|
591
|
-
options?:
|
|
592
|
-
): (
|
|
593
|
-
|
|
562
|
+
options?: SchemaAST.ParseOptions
|
|
563
|
+
): (
|
|
564
|
+
input: unknown,
|
|
565
|
+
options?: SchemaAST.ParseOptions
|
|
566
|
+
) => Effect.Effect<S["Encoded"], SchemaIssue.Issue, S["EncodingServices"]> {
|
|
567
|
+
const parser = run<S["Encoded"], S["EncodingServices"]>(SchemaAST.flip(schema.ast))
|
|
594
568
|
return options === undefined
|
|
595
569
|
? parser
|
|
596
570
|
: (input, overrideOptions) => parser(input, mergeParseOptions(options, overrideOptions))
|
|
@@ -602,9 +576,9 @@ export function encodeUnknownEffect<S extends Schema.Top>(
|
|
|
602
576
|
*
|
|
603
577
|
* **When to use**
|
|
604
578
|
*
|
|
605
|
-
* Use to encode values already typed as the schema's decoded
|
|
606
|
-
*
|
|
607
|
-
*
|
|
579
|
+
* Use when you need to encode values already typed as the schema's decoded
|
|
580
|
+
* `Type` in an `Effect` whose failure channel is `SchemaIssue.Issue`, while
|
|
581
|
+
* preserving service requirements.
|
|
608
582
|
*
|
|
609
583
|
* **Details**
|
|
610
584
|
*
|
|
@@ -619,17 +593,20 @@ export function encodeUnknownEffect<S extends Schema.Top>(
|
|
|
619
593
|
*/
|
|
620
594
|
export const encodeEffect: <S extends Schema.Top>(
|
|
621
595
|
schema: S,
|
|
622
|
-
options?:
|
|
623
|
-
) => (
|
|
624
|
-
|
|
596
|
+
options?: SchemaAST.ParseOptions
|
|
597
|
+
) => (
|
|
598
|
+
input: S["Type"],
|
|
599
|
+
options?: SchemaAST.ParseOptions
|
|
600
|
+
) => Effect.Effect<S["Encoded"], SchemaIssue.Issue, S["EncodingServices"]> = encodeUnknownEffect
|
|
625
601
|
|
|
626
602
|
/**
|
|
627
603
|
* Creates a Promise-based encoder for `unknown` input.
|
|
628
604
|
*
|
|
629
605
|
* **When to use**
|
|
630
606
|
*
|
|
631
|
-
* Use to encode untrusted or dynamically typed values
|
|
632
|
-
*
|
|
607
|
+
* Use when you need to encode untrusted or dynamically typed values with a
|
|
608
|
+
* service-free schema and return a JavaScript `Promise` that rejects with
|
|
609
|
+
* `SchemaIssue.Issue`.
|
|
633
610
|
*
|
|
634
611
|
* **Details**
|
|
635
612
|
*
|
|
@@ -644,8 +621,8 @@ export const encodeEffect: <S extends Schema.Top>(
|
|
|
644
621
|
*/
|
|
645
622
|
export const encodeUnknownPromise = <S extends Schema.Encoder<unknown>>(
|
|
646
623
|
schema: S,
|
|
647
|
-
options?:
|
|
648
|
-
): (input: unknown, options?:
|
|
624
|
+
options?: SchemaAST.ParseOptions
|
|
625
|
+
): (input: unknown, options?: SchemaAST.ParseOptions) => Promise<S["Encoded"]> =>
|
|
649
626
|
asPromise(encodeUnknownEffect(schema, options))
|
|
650
627
|
|
|
651
628
|
/**
|
|
@@ -654,9 +631,9 @@ export const encodeUnknownPromise = <S extends Schema.Encoder<unknown>>(
|
|
|
654
631
|
*
|
|
655
632
|
* **When to use**
|
|
656
633
|
*
|
|
657
|
-
* Use when you
|
|
658
|
-
*
|
|
659
|
-
*
|
|
634
|
+
* Use when you already have values typed as the schema's decoded `Type` and
|
|
635
|
+
* need encoding to return a JavaScript `Promise` that rejects with
|
|
636
|
+
* `SchemaIssue.Issue`.
|
|
660
637
|
*
|
|
661
638
|
* **Details**
|
|
662
639
|
*
|
|
@@ -671,8 +648,8 @@ export const encodeUnknownPromise = <S extends Schema.Encoder<unknown>>(
|
|
|
671
648
|
*/
|
|
672
649
|
export const encodePromise: <S extends Schema.Encoder<unknown>>(
|
|
673
650
|
schema: S,
|
|
674
|
-
options?:
|
|
675
|
-
) => (input: S["Type"], options?:
|
|
651
|
+
options?: SchemaAST.ParseOptions
|
|
652
|
+
) => (input: S["Type"], options?: SchemaAST.ParseOptions) => Promise<S["Encoded"]> = encodeUnknownPromise
|
|
676
653
|
|
|
677
654
|
/**
|
|
678
655
|
* Creates a synchronous encoder for `unknown` input that reports failure safely
|
|
@@ -680,8 +657,8 @@ export const encodePromise: <S extends Schema.Encoder<unknown>>(
|
|
|
680
657
|
*
|
|
681
658
|
* **When to use**
|
|
682
659
|
*
|
|
683
|
-
* Use
|
|
684
|
-
*
|
|
660
|
+
* Use when you need synchronous encoding of unknown input into an `Exit` whose
|
|
661
|
+
* failure contains `SchemaIssue.Issue`.
|
|
685
662
|
*
|
|
686
663
|
* **Details**
|
|
687
664
|
*
|
|
@@ -696,8 +673,8 @@ export const encodePromise: <S extends Schema.Encoder<unknown>>(
|
|
|
696
673
|
*/
|
|
697
674
|
export function encodeUnknownExit<S extends Schema.Encoder<unknown>>(
|
|
698
675
|
schema: S,
|
|
699
|
-
options?:
|
|
700
|
-
): (input: unknown, options?:
|
|
676
|
+
options?: SchemaAST.ParseOptions
|
|
677
|
+
): (input: unknown, options?: SchemaAST.ParseOptions) => Exit.Exit<S["Encoded"], SchemaIssue.Issue> {
|
|
701
678
|
return asExit(encodeUnknownEffect(schema, options))
|
|
702
679
|
}
|
|
703
680
|
|
|
@@ -707,8 +684,8 @@ export function encodeUnknownExit<S extends Schema.Encoder<unknown>>(
|
|
|
707
684
|
*
|
|
708
685
|
* **When to use**
|
|
709
686
|
*
|
|
710
|
-
* Use
|
|
711
|
-
*
|
|
687
|
+
* Use when you need synchronous encoding of already typed schema values into
|
|
688
|
+
* an `Exit` whose failure contains `SchemaIssue.Issue`.
|
|
712
689
|
*
|
|
713
690
|
* **Details**
|
|
714
691
|
*
|
|
@@ -723,59 +700,23 @@ export function encodeUnknownExit<S extends Schema.Encoder<unknown>>(
|
|
|
723
700
|
*/
|
|
724
701
|
export const encodeExit: <S extends Schema.Encoder<unknown>>(
|
|
725
702
|
schema: S,
|
|
726
|
-
options?:
|
|
727
|
-
) => (input: S["Type"], options?:
|
|
703
|
+
options?: SchemaAST.ParseOptions
|
|
704
|
+
) => (input: S["Type"], options?: SchemaAST.ParseOptions) => Exit.Exit<S["Encoded"], SchemaIssue.Issue> =
|
|
705
|
+
encodeUnknownExit
|
|
728
706
|
|
|
729
|
-
/**
|
|
730
|
-
* Creates an encoder for `unknown` input that returns an `Option` safely.
|
|
731
|
-
*
|
|
732
|
-
* **When to use**
|
|
733
|
-
*
|
|
734
|
-
* Use when encoding untyped input and you want a synchronous `Option` result
|
|
735
|
-
* that keeps the encoded value on success but discards issue details on failure.
|
|
736
|
-
*
|
|
737
|
-
* **Details**
|
|
738
|
-
*
|
|
739
|
-
* The returned function produces `Option.some` with the schema's `Encoded` value
|
|
740
|
-
* on success or `Option.none` on failure, discarding issue details.
|
|
741
|
-
*
|
|
742
|
-
* @see {@link encodeOption} for input already typed as the schema's decoded `Type`
|
|
743
|
-
* @see {@link encodeUnknownResult} for retaining schema issues as data
|
|
744
|
-
*
|
|
745
|
-
* @category encoding
|
|
746
|
-
* @since 3.10.0
|
|
747
|
-
*/
|
|
707
|
+
/** @internal */
|
|
748
708
|
export function encodeUnknownOption<S extends Schema.Encoder<unknown>>(
|
|
749
709
|
schema: S,
|
|
750
|
-
options?:
|
|
751
|
-
): (input: unknown, options?:
|
|
710
|
+
options?: SchemaAST.ParseOptions
|
|
711
|
+
): (input: unknown, options?: SchemaAST.ParseOptions) => Option.Option<S["Encoded"]> {
|
|
752
712
|
return asOption(encodeUnknownEffect(schema, options))
|
|
753
713
|
}
|
|
754
714
|
|
|
755
|
-
/**
|
|
756
|
-
* Creates an encoder safely for input already typed as the schema's decoded `Type`,
|
|
757
|
-
* returning an `Option`.
|
|
758
|
-
*
|
|
759
|
-
* **When to use**
|
|
760
|
-
*
|
|
761
|
-
* Use when encoding values that are already typed as the schema's decoded
|
|
762
|
-
* `Type` and an `Option` result is the desired success/failure boundary.
|
|
763
|
-
*
|
|
764
|
-
* **Details**
|
|
765
|
-
*
|
|
766
|
-
* The returned function produces `Option.some` with the schema's `Encoded` value
|
|
767
|
-
* on success or `Option.none` on failure, discarding issue details.
|
|
768
|
-
*
|
|
769
|
-
* @see {@link encodeUnknownOption} for untyped input with the same yes/no result shape
|
|
770
|
-
* @see {@link encodeResult} for retaining schema issues as data
|
|
771
|
-
*
|
|
772
|
-
* @category encoding
|
|
773
|
-
* @since 3.10.0
|
|
774
|
-
*/
|
|
715
|
+
/** @internal */
|
|
775
716
|
export const encodeOption: <S extends Schema.Encoder<unknown>>(
|
|
776
717
|
schema: S,
|
|
777
|
-
options?:
|
|
778
|
-
) => (input: S["Type"], options?:
|
|
718
|
+
options?: SchemaAST.ParseOptions
|
|
719
|
+
) => (input: S["Type"], options?: SchemaAST.ParseOptions) => Option.Option<S["Encoded"]> = encodeUnknownOption
|
|
779
720
|
|
|
780
721
|
/**
|
|
781
722
|
* Creates an encoder for `unknown` input that reports failure safely as a
|
|
@@ -784,7 +725,8 @@ export const encodeOption: <S extends Schema.Encoder<unknown>>(
|
|
|
784
725
|
* **When to use**
|
|
785
726
|
*
|
|
786
727
|
* Use when encoding values from an unknown or dynamically typed boundary
|
|
787
|
-
* synchronously, and you want
|
|
728
|
+
* synchronously, and you want `SchemaIssue.Issue` failures returned as `Result`
|
|
729
|
+
* data.
|
|
788
730
|
*
|
|
789
731
|
* **Details**
|
|
790
732
|
*
|
|
@@ -800,8 +742,8 @@ export const encodeOption: <S extends Schema.Encoder<unknown>>(
|
|
|
800
742
|
*/
|
|
801
743
|
export function encodeUnknownResult<S extends Schema.Encoder<unknown>>(
|
|
802
744
|
schema: S,
|
|
803
|
-
options?:
|
|
804
|
-
): (input: unknown, options?:
|
|
745
|
+
options?: SchemaAST.ParseOptions
|
|
746
|
+
): (input: unknown, options?: SchemaAST.ParseOptions) => Result.Result<S["Encoded"], SchemaIssue.Issue> {
|
|
805
747
|
return asResult(encodeUnknownEffect(schema, options))
|
|
806
748
|
}
|
|
807
749
|
|
|
@@ -811,9 +753,8 @@ export function encodeUnknownResult<S extends Schema.Encoder<unknown>>(
|
|
|
811
753
|
*
|
|
812
754
|
* **When to use**
|
|
813
755
|
*
|
|
814
|
-
* Use when
|
|
815
|
-
* encoding failures
|
|
816
|
-
* `Effect`.
|
|
756
|
+
* Use when you already have input typed as the schema's decoded `Type` and want
|
|
757
|
+
* encoding failures returned as `Result.fail` with `SchemaIssue.Issue`.
|
|
817
758
|
*
|
|
818
759
|
* **Details**
|
|
819
760
|
*
|
|
@@ -828,16 +769,17 @@ export function encodeUnknownResult<S extends Schema.Encoder<unknown>>(
|
|
|
828
769
|
*/
|
|
829
770
|
export const encodeResult: <S extends Schema.Encoder<unknown>>(
|
|
830
771
|
schema: S,
|
|
831
|
-
options?:
|
|
832
|
-
) => (input: S["Type"], options?:
|
|
772
|
+
options?: SchemaAST.ParseOptions
|
|
773
|
+
) => (input: S["Type"], options?: SchemaAST.ParseOptions) => Result.Result<S["Encoded"], SchemaIssue.Issue> =
|
|
774
|
+
encodeUnknownResult
|
|
833
775
|
|
|
834
776
|
/**
|
|
835
777
|
* Creates a synchronous encoder for `unknown` input.
|
|
836
778
|
*
|
|
837
779
|
* **When to use**
|
|
838
780
|
*
|
|
839
|
-
* Use when
|
|
840
|
-
* encoding failures
|
|
781
|
+
* Use when you need to encode values from untyped input in synchronous code and
|
|
782
|
+
* want encoding failures to throw an `Error` whose cause is `SchemaIssue.Issue`.
|
|
841
783
|
*
|
|
842
784
|
* **Details**
|
|
843
785
|
*
|
|
@@ -852,8 +794,8 @@ export const encodeResult: <S extends Schema.Encoder<unknown>>(
|
|
|
852
794
|
*/
|
|
853
795
|
export function encodeUnknownSync<S extends Schema.Encoder<unknown>>(
|
|
854
796
|
schema: S,
|
|
855
|
-
options?:
|
|
856
|
-
): (input: unknown, options?:
|
|
797
|
+
options?: SchemaAST.ParseOptions
|
|
798
|
+
): (input: unknown, options?: SchemaAST.ParseOptions) => S["Encoded"] {
|
|
857
799
|
return asSync(encodeUnknownEffect(schema, options))
|
|
858
800
|
}
|
|
859
801
|
|
|
@@ -864,7 +806,7 @@ export function encodeUnknownSync<S extends Schema.Encoder<unknown>>(
|
|
|
864
806
|
* **When to use**
|
|
865
807
|
*
|
|
866
808
|
* Use to encode already typed schema values synchronously when encoding failure
|
|
867
|
-
* should
|
|
809
|
+
* should throw an `Error` whose cause is `SchemaIssue.Issue`.
|
|
868
810
|
*
|
|
869
811
|
* **Details**
|
|
870
812
|
*
|
|
@@ -872,7 +814,6 @@ export function encodeUnknownSync<S extends Schema.Encoder<unknown>>(
|
|
|
872
814
|
* an `Error` with the `SchemaIssue.Issue` in its `cause` on encoding failure.
|
|
873
815
|
*
|
|
874
816
|
* @see {@link encodeUnknownSync} for unknown input with the same throwing boundary
|
|
875
|
-
* @see {@link encodeOption} for discarding failure details
|
|
876
817
|
* @see {@link encodeResult} for returning schema issues as data
|
|
877
818
|
* @see {@link encodeEffect} for effectful encoding that preserves service requirements
|
|
878
819
|
*
|
|
@@ -881,51 +822,51 @@ export function encodeUnknownSync<S extends Schema.Encoder<unknown>>(
|
|
|
881
822
|
*/
|
|
882
823
|
export const encodeSync: <S extends Schema.Encoder<unknown>>(
|
|
883
824
|
schema: S,
|
|
884
|
-
options?:
|
|
885
|
-
) => (input: S["Type"], options?:
|
|
825
|
+
options?: SchemaAST.ParseOptions
|
|
826
|
+
) => (input: S["Type"], options?: SchemaAST.ParseOptions) => S["Encoded"] = encodeUnknownSync
|
|
886
827
|
|
|
887
828
|
const mergeParseOptions = (
|
|
888
|
-
options:
|
|
889
|
-
overrideOptions:
|
|
890
|
-
):
|
|
829
|
+
options: SchemaAST.ParseOptions,
|
|
830
|
+
overrideOptions: SchemaAST.ParseOptions | undefined
|
|
831
|
+
): SchemaAST.ParseOptions => overrideOptions === undefined ? options : { ...options, ...overrideOptions }
|
|
891
832
|
|
|
892
833
|
/** @internal */
|
|
893
|
-
export function run<T, R>(ast:
|
|
834
|
+
export function run<T, R>(ast: SchemaAST.AST) {
|
|
894
835
|
const parser = recur(ast)
|
|
895
|
-
return (input: unknown, options?:
|
|
896
|
-
Effect.flatMapEager(parser(Option.some(input), options ??
|
|
836
|
+
return (input: unknown, options?: SchemaAST.ParseOptions): Effect.Effect<T, SchemaIssue.Issue, R> =>
|
|
837
|
+
Effect.flatMapEager(parser(Option.some(input), options ?? SchemaAST.defaultParseOptions), (oa) => {
|
|
897
838
|
if (oa._tag === "None") {
|
|
898
|
-
return Effect.fail(new
|
|
839
|
+
return Effect.fail(new SchemaIssue.InvalidValue(oa))
|
|
899
840
|
}
|
|
900
841
|
return Effect.succeed(oa.value as T)
|
|
901
842
|
})
|
|
902
843
|
}
|
|
903
844
|
|
|
904
845
|
function asPromise<T, E>(
|
|
905
|
-
parser: (input: E, options?:
|
|
906
|
-
): (input: E, options?:
|
|
907
|
-
return (input: E, options?:
|
|
846
|
+
parser: (input: E, options?: SchemaAST.ParseOptions) => Effect.Effect<T, SchemaIssue.Issue>
|
|
847
|
+
): (input: E, options?: SchemaAST.ParseOptions) => Promise<T> {
|
|
848
|
+
return (input: E, options?: SchemaAST.ParseOptions) => Effect.runPromise(parser(input, options))
|
|
908
849
|
}
|
|
909
850
|
|
|
910
851
|
function asExit<T, E, R>(
|
|
911
|
-
parser: (input: E, options?:
|
|
912
|
-
): (input: E, options?:
|
|
913
|
-
return (input: E, options?:
|
|
852
|
+
parser: (input: E, options?: SchemaAST.ParseOptions) => Effect.Effect<T, SchemaIssue.Issue, R>
|
|
853
|
+
): (input: E, options?: SchemaAST.ParseOptions) => Exit.Exit<T, SchemaIssue.Issue> {
|
|
854
|
+
return (input: E, options?: SchemaAST.ParseOptions) => Effect.runSyncExit(parser(input, options) as any)
|
|
914
855
|
}
|
|
915
856
|
|
|
916
857
|
/** @internal */
|
|
917
858
|
export function asOption<T, E, R>(
|
|
918
|
-
parser: (input: E, options?:
|
|
919
|
-
): (input: E, options?:
|
|
859
|
+
parser: (input: E, options?: SchemaAST.ParseOptions) => Effect.Effect<T, SchemaIssue.Issue, R>
|
|
860
|
+
): (input: E, options?: SchemaAST.ParseOptions) => Option.Option<T> {
|
|
920
861
|
const parserExit = asExit(parser)
|
|
921
|
-
return (input: E, options?:
|
|
862
|
+
return (input: E, options?: SchemaAST.ParseOptions) => Exit.getSuccess(parserExit(input, options))
|
|
922
863
|
}
|
|
923
864
|
|
|
924
865
|
function asResult<T, E, R>(
|
|
925
|
-
parser: (input: E, options?:
|
|
926
|
-
): (input: E, options?:
|
|
866
|
+
parser: (input: E, options?: SchemaAST.ParseOptions) => Effect.Effect<T, SchemaIssue.Issue, R>
|
|
867
|
+
): (input: E, options?: SchemaAST.ParseOptions) => Result.Result<T, SchemaIssue.Issue> {
|
|
927
868
|
const parserExit = asExit(parser)
|
|
928
|
-
return (input: E, options?:
|
|
869
|
+
return (input: E, options?: SchemaAST.ParseOptions) => {
|
|
929
870
|
const exit = parserExit(input, options)
|
|
930
871
|
if (Exit.isSuccess(exit)) {
|
|
931
872
|
return Result.succeed(exit.value)
|
|
@@ -939,9 +880,9 @@ function asResult<T, E, R>(
|
|
|
939
880
|
}
|
|
940
881
|
|
|
941
882
|
function asSync<T, E, R>(
|
|
942
|
-
parser: (input: E, options?:
|
|
943
|
-
): (input: E, options?:
|
|
944
|
-
return (input: E, options?:
|
|
883
|
+
parser: (input: E, options?: SchemaAST.ParseOptions) => Effect.Effect<T, SchemaIssue.Issue, R>
|
|
884
|
+
): (input: E, options?: SchemaAST.ParseOptions) => T {
|
|
885
|
+
return (input: E, options?: SchemaAST.ParseOptions) =>
|
|
945
886
|
Effect.runSync(
|
|
946
887
|
Effect.mapErrorEager(
|
|
947
888
|
parser(input, options),
|
|
@@ -952,11 +893,14 @@ function asSync<T, E, R>(
|
|
|
952
893
|
|
|
953
894
|
/** @internal */
|
|
954
895
|
export interface Parser {
|
|
955
|
-
(
|
|
896
|
+
(
|
|
897
|
+
input: Option.Option<unknown>,
|
|
898
|
+
options: SchemaAST.ParseOptions
|
|
899
|
+
): Effect.Effect<Option.Option<unknown>, SchemaIssue.Issue, any>
|
|
956
900
|
}
|
|
957
901
|
|
|
958
902
|
const recur = memoize(
|
|
959
|
-
(ast:
|
|
903
|
+
(ast: SchemaAST.AST): Parser => {
|
|
960
904
|
let parser: Parser
|
|
961
905
|
const astOptions = InternalAnnotations.resolve(ast)?.["parseOptions"]
|
|
962
906
|
if (!ast.context && !ast.encoding && !ast.checks) {
|
|
@@ -968,14 +912,14 @@ const recur = memoize(
|
|
|
968
912
|
return parser(ou, options)
|
|
969
913
|
}
|
|
970
914
|
}
|
|
971
|
-
const isStructural =
|
|
972
|
-
(
|
|
915
|
+
const isStructural = SchemaAST.isArrays(ast) || SchemaAST.isObjects(ast) ||
|
|
916
|
+
(SchemaAST.isDeclaration(ast) && ast.typeParameters.length > 0)
|
|
973
917
|
return (ou, options) => {
|
|
974
918
|
if (astOptions) {
|
|
975
919
|
options = { ...options, ...astOptions }
|
|
976
920
|
}
|
|
977
921
|
const encoding = ast.encoding
|
|
978
|
-
let srou: Effect.Effect<Option.Option<unknown>,
|
|
922
|
+
let srou: Effect.Effect<Option.Option<unknown>, SchemaIssue.Issue, unknown> | undefined
|
|
979
923
|
if (encoding) {
|
|
980
924
|
const links = encoding
|
|
981
925
|
const len = links.length
|
|
@@ -991,7 +935,7 @@ const recur = memoize(
|
|
|
991
935
|
srou = link.transformation.decode(srou, options)
|
|
992
936
|
}
|
|
993
937
|
}
|
|
994
|
-
srou = Effect.mapErrorEager(srou!, (issue) => new
|
|
938
|
+
srou = Effect.mapErrorEager(srou!, (issue) => new SchemaIssue.Encoding(ast, ou, issue))
|
|
995
939
|
}
|
|
996
940
|
|
|
997
941
|
parser ??= ast.getParser(recur)
|
|
@@ -1001,18 +945,18 @@ const recur = memoize(
|
|
|
1001
945
|
const checks = ast.checks
|
|
1002
946
|
if (options?.errors === "all" && isStructural && Option.isSome(ou)) {
|
|
1003
947
|
sroa = Effect.catchEager(sroa, (issue) => {
|
|
1004
|
-
const issues: Array<
|
|
1005
|
-
|
|
1006
|
-
checks.filter((check) => check.annotations?.[
|
|
948
|
+
const issues: Array<SchemaIssue.Issue> = []
|
|
949
|
+
SchemaAST.collectIssues(
|
|
950
|
+
checks.filter((check) => check.annotations?.[SchemaAST.STRUCTURAL_ANNOTATION_KEY]),
|
|
1007
951
|
ou.value,
|
|
1008
952
|
issues,
|
|
1009
953
|
ast,
|
|
1010
954
|
options
|
|
1011
955
|
)
|
|
1012
|
-
const out:
|
|
956
|
+
const out: SchemaIssue.Issue = Arr.isArrayNonEmpty(issues)
|
|
1013
957
|
? issue._tag === "Composite" && issue.ast === ast
|
|
1014
|
-
? new
|
|
1015
|
-
: new
|
|
958
|
+
? new SchemaIssue.Composite(ast, issue.actual, [...issue.issues, ...issues])
|
|
959
|
+
: new SchemaIssue.Composite(ast, ou, [issue, ...issues])
|
|
1016
960
|
: issue
|
|
1017
961
|
return Effect.fail(out)
|
|
1018
962
|
})
|
|
@@ -1020,12 +964,12 @@ const recur = memoize(
|
|
|
1020
964
|
sroa = Effect.flatMapEager(sroa, (oa) => {
|
|
1021
965
|
if (Option.isSome(oa)) {
|
|
1022
966
|
const value = oa.value
|
|
1023
|
-
const issues: Array<
|
|
967
|
+
const issues: Array<SchemaIssue.Issue> = []
|
|
1024
968
|
|
|
1025
|
-
|
|
969
|
+
SchemaAST.collectIssues(checks, value, issues, ast, options)
|
|
1026
970
|
|
|
1027
971
|
if (Arr.isArrayNonEmpty(issues)) {
|
|
1028
|
-
return Effect.fail(new
|
|
972
|
+
return Effect.fail(new SchemaIssue.Composite(ast, oa, issues))
|
|
1029
973
|
}
|
|
1030
974
|
}
|
|
1031
975
|
return Effect.succeed(oa)
|