effect 4.0.0-beta.74 → 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 +729 -611
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +273 -213
- 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 +8 -8
- package/dist/Boolean.js +4 -4
- 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 +219 -9
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +83 -3
- 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 +69 -16
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +43 -8
- 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 +60 -72
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +28 -32
- package/dist/Context.js.map +1 -1
- package/dist/Cron.d.ts +2 -2
- package/dist/Cron.js +2 -2
- 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 +24 -15
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +8 -5
- package/dist/Deferred.js.map +1 -1
- package/dist/Duration.d.ts +44 -31
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +22 -11
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +516 -416
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +234 -174
- 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 +26 -39
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +10 -17
- package/dist/Equal.js.map +1 -1
- package/dist/Equivalence.d.ts +71 -99
- package/dist/Equivalence.d.ts.map +1 -1
- package/dist/Equivalence.js +53 -73
- package/dist/Equivalence.js.map +1 -1
- package/dist/ErrorReporter.d.ts +1 -1
- package/dist/ErrorReporter.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/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 +15 -16
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +9 -10
- package/dist/Function.js.map +1 -1
- package/dist/Graph.d.ts +2 -2
- package/dist/Graph.js +2 -2
- package/dist/HKT.d.ts +2 -2
- 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 +15 -0
- 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/Iterable.d.ts +24 -12
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +16 -6
- 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 +92 -114
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +38 -46
- package/dist/Layer.js.map +1 -1
- package/dist/Logger.d.ts +11 -14
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +11 -14
- package/dist/Logger.js.map +1 -1
- package/dist/Match.d.ts +2 -2
- package/dist/Match.js +2 -2
- package/dist/Metric.d.ts +89 -109
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +51 -61
- 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 +196 -168
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +96 -79
- package/dist/Option.js.map +1 -1
- package/dist/Order.d.ts +118 -179
- package/dist/Order.d.ts.map +1 -1
- package/dist/Order.js +92 -144
- 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 +2 -2
- package/dist/Path.js +2 -2
- package/dist/Pipeable.d.ts +2 -2
- package/dist/Pipeable.js +2 -2
- 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 +274 -263
- 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 +24 -14
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +16 -6
- 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 +46 -7
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +46 -7
- 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/Redactable.d.ts +2 -2
- package/dist/Redactable.js +2 -2
- package/dist/Redacted.d.ts +3 -3
- package/dist/Redacted.js +3 -3
- 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 +17 -16
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +15 -14
- package/dist/Ref.js.map +1 -1
- package/dist/References.d.ts +4 -4
- package/dist/References.js +4 -4
- package/dist/Request.d.ts +18 -18
- package/dist/Request.js +6 -6
- package/dist/Resource.d.ts +2 -2
- package/dist/Resource.js +2 -2
- package/dist/Result.d.ts +77 -33
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +42 -19
- 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 +107 -45
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +41 -29
- 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 +443 -371
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +518 -427
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +42 -21
- 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 +126 -106
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +121 -101
- 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 +72 -153
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +72 -145
- 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 +15 -0
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +15 -0
- 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 +13 -13
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +9 -9
- 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 +321 -44
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +137 -22
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +6 -9
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +2 -3
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts +15 -13
- package/dist/Struct.d.ts.map +1 -1
- package/dist/Struct.js +11 -9
- 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 +88 -63
- package/dist/SynchronizedRef.d.ts.map +1 -1
- package/dist/SynchronizedRef.js +32 -23
- package/dist/SynchronizedRef.js.map +1 -1
- package/dist/Tracer.d.ts +4 -4
- package/dist/Tracer.js +4 -4
- 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 +25 -19
- package/dist/Tuple.d.ts.map +1 -1
- package/dist/Tuple.js +17 -13
- package/dist/Tuple.js.map +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 +2 -2
- 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/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 +4 -5
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +4 -5
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.d.ts +4 -4
- package/dist/unstable/ai/EmbeddingModel.js +4 -4
- package/dist/unstable/ai/IdGenerator.d.ts +2 -3
- package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
- package/dist/unstable/ai/IdGenerator.js +2 -3
- package/dist/unstable/ai/IdGenerator.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +3 -2
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +5 -4
- 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 +2 -2
- package/dist/unstable/ai/Prompt.js +3 -3
- 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 +21 -6
- package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
- package/dist/unstable/ai/Telemetry.js +7 -2
- package/dist/unstable/ai/Telemetry.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +7 -6
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +8 -7
- 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 +15 -8
- 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 +3 -3
- 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 +3 -2
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js +3 -2
- package/dist/unstable/cli/Primitive.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/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/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 +3 -3
- package/dist/unstable/cluster/Runners.js +3 -3
- package/dist/unstable/cluster/ShardId.js +3 -3
- package/dist/unstable/cluster/ShardId.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts +3 -3
- package/dist/unstable/cluster/Sharding.js +3 -3
- package/dist/unstable/cluster/ShardingConfig.d.ts +4 -4
- package/dist/unstable/cluster/ShardingConfig.js +4 -4
- package/dist/unstable/cluster/Snowflake.d.ts +1 -1
- package/dist/unstable/cluster/Snowflake.js +3 -3
- 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/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 +3 -3
- package/dist/unstable/eventlog/EventLog.js +3 -3
- 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 +5 -7
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js +5 -7
- 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.js +4 -4
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Etag.d.ts +2 -3
- package/dist/unstable/http/Etag.d.ts.map +1 -1
- package/dist/unstable/http/Etag.js +2 -3
- package/dist/unstable/http/Etag.js.map +1 -1
- 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 +2 -2
- package/dist/unstable/http/HttpClient.js +2 -2
- package/dist/unstable/http/HttpClientRequest.d.ts +30 -3
- 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/HttpRouter.d.ts +1 -1
- package/dist/unstable/http/HttpRouter.js +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +25 -20
- 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/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 +3 -2
- package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js +3 -2
- 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/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 +4 -2
- package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.js +4 -2
- package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +3 -3
- package/dist/unstable/reactivity/Atom.js +3 -3
- package/dist/unstable/rpc/RpcSchema.d.ts +2 -2
- package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts +2 -2
- package/dist/unstable/rpc/RpcSerialization.js +2 -2
- package/dist/unstable/schema/Model.js +5 -5
- 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/sql/SqlSchema.d.ts +4 -4
- package/dist/unstable/sql/SqlSchema.js +4 -4
- package/dist/unstable/workers/Transferable.d.ts +2 -2
- package/dist/unstable/workers/Transferable.d.ts.map +1 -1
- package/dist/unstable/workers/Transferable.js +5 -5
- package/dist/unstable/workers/Transferable.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.js +7 -7
- 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 +729 -611
- package/src/BigDecimal.ts +37 -30
- package/src/BigInt.ts +34 -40
- package/src/Boolean.ts +8 -8
- package/src/Brand.ts +16 -14
- package/src/Cause.ts +21 -23
- package/src/Channel.ts +249 -9
- package/src/ChannelSchema.ts +11 -11
- package/src/Chunk.ts +69 -16
- 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 +60 -72
- package/src/Cron.ts +2 -2
- package/src/Crypto.ts +4 -4
- package/src/Data.ts +21 -15
- package/src/DateTime.ts +35 -16
- package/src/Deferred.ts +24 -15
- package/src/Duration.ts +44 -31
- package/src/Effect.ts +516 -416
- package/src/Encoding.ts +5 -0
- package/src/Equal.ts +26 -39
- package/src/Equivalence.ts +71 -99
- package/src/ErrorReporter.ts +1 -1
- 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/Filter.ts +4 -4
- package/src/Formatter.ts +14 -19
- package/src/Function.ts +15 -16
- package/src/Graph.ts +2 -2
- package/src/HKT.ts +2 -2
- package/src/Hash.ts +2 -1
- package/src/HashMap.ts +15 -0
- package/src/HashRing.ts +9 -9
- package/src/Iterable.ts +24 -12
- 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 +92 -114
- package/src/Logger.ts +15 -18
- package/src/Match.ts +2 -2
- package/src/Metric.ts +109 -137
- 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 +196 -168
- package/src/Order.ts +118 -179
- package/src/PartitionedSemaphore.ts +14 -14
- package/src/Path.ts +2 -2
- package/src/Pipeable.ts +2 -2
- package/src/PlatformError.ts +4 -4
- package/src/Pool.ts +7 -11
- package/src/Predicate.ts +274 -263
- package/src/PubSub.ts +24 -14
- package/src/Pull.ts +4 -4
- package/src/Queue.ts +46 -7
- package/src/RcRef.ts +0 -4
- package/src/Redactable.ts +2 -2
- package/src/Redacted.ts +3 -3
- package/src/Reducer.ts +2 -3
- package/src/Ref.ts +43 -40
- package/src/References.ts +4 -4
- package/src/Request.ts +18 -18
- package/src/Resource.ts +2 -2
- package/src/Result.ts +87 -33
- package/src/Runtime.ts +11 -8
- package/src/Schedule.ts +112 -45
- package/src/Scheduler.ts +6 -4
- package/src/Schema.ts +843 -649
- package/src/SchemaAST.ts +148 -117
- package/src/SchemaGetter.ts +142 -121
- package/src/SchemaIssue.ts +39 -41
- package/src/SchemaParser.ts +173 -229
- package/src/SchemaRepresentation.ts +38 -28
- package/src/SchemaTransformation.ts +233 -207
- package/src/SchemaUtils.ts +2 -2
- package/src/Scope.ts +15 -0
- package/src/ScopedCache.ts +1 -1
- package/src/ScopedRef.ts +14 -18
- package/src/Semaphore.ts +9 -9
- package/src/Sink.ts +13 -13
- package/src/Stdio.ts +4 -5
- package/src/Stream.ts +354 -57
- package/src/String.ts +6 -9
- package/src/Struct.ts +15 -13
- package/src/SubscriptionRef.ts +24 -19
- package/src/SynchronizedRef.ts +88 -63
- package/src/Tracer.ts +4 -4
- package/src/Trie.ts +15 -0
- package/src/Tuple.ts +25 -19
- 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 +2 -2
- 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/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 +4 -5
- package/src/unstable/ai/EmbeddingModel.ts +4 -4
- package/src/unstable/ai/IdGenerator.ts +2 -3
- package/src/unstable/ai/LanguageModel.ts +5 -4
- 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 +5 -5
- package/src/unstable/ai/ResponseIdTracker.ts +3 -2
- package/src/unstable/ai/Telemetry.ts +21 -6
- package/src/unstable/ai/Tool.ts +11 -10
- package/src/unstable/ai/Toolkit.ts +2 -2
- package/src/unstable/cli/Command.ts +37 -16
- 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 +23 -18
- package/src/unstable/cli/Primitive.ts +3 -2
- 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/EntityResource.ts +10 -0
- package/src/unstable/cluster/Envelope.ts +3 -3
- 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 +3 -3
- package/src/unstable/cluster/ShardId.ts +3 -3
- package/src/unstable/cluster/Sharding.ts +3 -3
- package/src/unstable/cluster/ShardingConfig.ts +4 -4
- package/src/unstable/cluster/Snowflake.ts +3 -3
- package/src/unstable/cluster/internal/entityManager.ts +2 -2
- 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 +3 -3
- package/src/unstable/eventlog/EventLogServerEncrypted.ts +2 -3
- package/src/unstable/eventlog/EventLogServerUnencrypted.ts +5 -7
- package/src/unstable/eventlog/EventLogSessionAuth.ts +4 -4
- package/src/unstable/http/Cookies.ts +4 -4
- package/src/unstable/http/Etag.ts +2 -3
- package/src/unstable/http/Headers.ts +2 -2
- package/src/unstable/http/HttpBody.ts +2 -2
- package/src/unstable/http/HttpClient.ts +2 -2
- package/src/unstable/http/HttpClientRequest.ts +30 -3
- package/src/unstable/http/HttpRouter.ts +1 -1
- package/src/unstable/http/HttpServerResponse.ts +25 -20
- package/src/unstable/http/Multipart.ts +3 -3
- package/src/unstable/http/UrlParams.ts +36 -6
- package/src/unstable/httpapi/HttpApi.ts +5 -4
- package/src/unstable/httpapi/HttpApiBuilder.ts +14 -13
- package/src/unstable/httpapi/HttpApiClient.ts +16 -16
- 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 +4 -2
- package/src/unstable/reactivity/Atom.ts +3 -3
- package/src/unstable/rpc/RpcSchema.ts +2 -2
- package/src/unstable/rpc/RpcSerialization.ts +2 -2
- package/src/unstable/schema/Model.ts +5 -5
- package/src/unstable/schema/VariantSchema.ts +2 -2
- package/src/unstable/sql/SqlSchema.ts +4 -4
- package/src/unstable/workers/Transferable.ts +6 -6
- package/src/unstable/workflow/DurableDeferred.ts +7 -7
- 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
|
@@ -92,9 +92,9 @@ import * as Effect from "./Effect.ts"
|
|
|
92
92
|
import { formatDate } from "./Formatter.ts"
|
|
93
93
|
import * as Option from "./Option.ts"
|
|
94
94
|
import * as Predicate from "./Predicate.ts"
|
|
95
|
-
import type * as
|
|
96
|
-
import * as
|
|
97
|
-
import * as
|
|
95
|
+
import type * as SchemaAST from "./SchemaAST.ts"
|
|
96
|
+
import * as SchemaGetter from "./SchemaGetter.ts"
|
|
97
|
+
import * as SchemaIssue from "./SchemaIssue.ts"
|
|
98
98
|
|
|
99
99
|
/**
|
|
100
100
|
* Middleware that wraps the entire parsing `Effect` pipeline for both
|
|
@@ -102,9 +102,9 @@ import * as Issue from "./SchemaIssue.ts"
|
|
|
102
102
|
*
|
|
103
103
|
* **When to use**
|
|
104
104
|
*
|
|
105
|
-
* Use when you need to catch or recover from parsing
|
|
106
|
-
*
|
|
107
|
-
*
|
|
105
|
+
* Use when you need a schema middleware to catch or recover from parsing
|
|
106
|
+
* errors (e.g. `Schema.catchDecoding`), run side effects around the parsing
|
|
107
|
+
* pipeline, or access the full `Effect` rather than a single decoded value.
|
|
108
108
|
*
|
|
109
109
|
* **Details**
|
|
110
110
|
*
|
|
@@ -141,23 +141,23 @@ import * as Issue from "./SchemaIssue.ts"
|
|
|
141
141
|
export class Middleware<in out T, in out E, RDE, RDT, RET, REE> {
|
|
142
142
|
readonly _tag = "Middleware"
|
|
143
143
|
readonly decode: (
|
|
144
|
-
effect: Effect.Effect<Option.Option<E>,
|
|
145
|
-
options:
|
|
146
|
-
) => Effect.Effect<Option.Option<T>,
|
|
144
|
+
effect: Effect.Effect<Option.Option<E>, SchemaIssue.Issue, RDE>,
|
|
145
|
+
options: SchemaAST.ParseOptions
|
|
146
|
+
) => Effect.Effect<Option.Option<T>, SchemaIssue.Issue, RDT>
|
|
147
147
|
readonly encode: (
|
|
148
|
-
effect: Effect.Effect<Option.Option<T>,
|
|
149
|
-
options:
|
|
150
|
-
) => Effect.Effect<Option.Option<E>,
|
|
148
|
+
effect: Effect.Effect<Option.Option<T>, SchemaIssue.Issue, RET>,
|
|
149
|
+
options: SchemaAST.ParseOptions
|
|
150
|
+
) => Effect.Effect<Option.Option<E>, SchemaIssue.Issue, REE>
|
|
151
151
|
|
|
152
152
|
constructor(
|
|
153
153
|
decode: (
|
|
154
|
-
effect: Effect.Effect<Option.Option<E>,
|
|
155
|
-
options:
|
|
156
|
-
) => Effect.Effect<Option.Option<T>,
|
|
154
|
+
effect: Effect.Effect<Option.Option<E>, SchemaIssue.Issue, RDE>,
|
|
155
|
+
options: SchemaAST.ParseOptions
|
|
156
|
+
) => Effect.Effect<Option.Option<T>, SchemaIssue.Issue, RDT>,
|
|
157
157
|
encode: (
|
|
158
|
-
effect: Effect.Effect<Option.Option<T>,
|
|
159
|
-
options:
|
|
160
|
-
) => Effect.Effect<Option.Option<E>,
|
|
158
|
+
effect: Effect.Effect<Option.Option<T>, SchemaIssue.Issue, RET>,
|
|
159
|
+
options: SchemaAST.ParseOptions
|
|
160
|
+
) => Effect.Effect<Option.Option<E>, SchemaIssue.Issue, REE>
|
|
161
161
|
) {
|
|
162
162
|
this.decode = decode
|
|
163
163
|
this.encode = encode
|
|
@@ -175,7 +175,8 @@ const TypeId = "~effect/SchemaTransformation/Transformation"
|
|
|
175
175
|
*
|
|
176
176
|
* **When to use**
|
|
177
177
|
*
|
|
178
|
-
* Use when you need
|
|
178
|
+
* Use when you need a schema transformation that defines how a schema converts
|
|
179
|
+
* between two representations.
|
|
179
180
|
* - You want to compose multiple transformations into a pipeline.
|
|
180
181
|
* - You want to flip a transformation to swap decode/encode.
|
|
181
182
|
*
|
|
@@ -213,12 +214,12 @@ const TypeId = "~effect/SchemaTransformation/Transformation"
|
|
|
213
214
|
export class Transformation<in out T, in out E, RD = never, RE = never> {
|
|
214
215
|
readonly [TypeId] = TypeId
|
|
215
216
|
readonly _tag = "Transformation"
|
|
216
|
-
readonly decode:
|
|
217
|
-
readonly encode:
|
|
217
|
+
readonly decode: SchemaGetter.Getter<T, E, RD>
|
|
218
|
+
readonly encode: SchemaGetter.Getter<E, T, RE>
|
|
218
219
|
|
|
219
220
|
constructor(
|
|
220
|
-
decode:
|
|
221
|
-
encode:
|
|
221
|
+
decode: SchemaGetter.Getter<T, E, RD>,
|
|
222
|
+
encode: SchemaGetter.Getter<E, T, RE>
|
|
222
223
|
) {
|
|
223
224
|
this.decode = decode
|
|
224
225
|
this.encode = encode
|
|
@@ -239,7 +240,8 @@ export class Transformation<in out T, in out E, RD = never, RE = never> {
|
|
|
239
240
|
*
|
|
240
241
|
* **When to use**
|
|
241
242
|
*
|
|
242
|
-
* Use to check whether a value is already a
|
|
243
|
+
* Use to check whether a value is already a schema transformation before
|
|
244
|
+
* wrapping it.
|
|
243
245
|
*
|
|
244
246
|
* **Details**
|
|
245
247
|
*
|
|
@@ -274,7 +276,8 @@ export function isTransformation(u: unknown): u is Transformation<any, any, unkn
|
|
|
274
276
|
*
|
|
275
277
|
* **When to use**
|
|
276
278
|
*
|
|
277
|
-
* Use when you already have
|
|
279
|
+
* Use when you already have schema getter instances and want to pair them into
|
|
280
|
+
* a schema transformation.
|
|
278
281
|
* - You want idempotent wrapping (won't double-wrap).
|
|
279
282
|
*
|
|
280
283
|
* **Details**
|
|
@@ -300,8 +303,8 @@ export function isTransformation(u: unknown): u is Transformation<any, any, unkn
|
|
|
300
303
|
* @since 3.10.0
|
|
301
304
|
*/
|
|
302
305
|
export const make = <T, E, RD = never, RE = never>(options: {
|
|
303
|
-
readonly decode:
|
|
304
|
-
readonly encode:
|
|
306
|
+
readonly decode: SchemaGetter.Getter<T, E, RD>
|
|
307
|
+
readonly encode: SchemaGetter.Getter<E, T, RE>
|
|
305
308
|
}): Transformation<T, E, RD, RE> => {
|
|
306
309
|
if (isTransformation(options)) {
|
|
307
310
|
return options as any
|
|
@@ -315,8 +318,8 @@ export const make = <T, E, RD = never, RE = never>(options: {
|
|
|
315
318
|
*
|
|
316
319
|
* **When to use**
|
|
317
320
|
*
|
|
318
|
-
* Use when
|
|
319
|
-
*
|
|
321
|
+
* Use when you need a schema transformation that may fail or require Effect
|
|
322
|
+
* services.
|
|
320
323
|
*
|
|
321
324
|
* **Details**
|
|
322
325
|
*
|
|
@@ -353,12 +356,12 @@ export const make = <T, E, RD = never, RE = never>(options: {
|
|
|
353
356
|
* @since 3.10.0
|
|
354
357
|
*/
|
|
355
358
|
export function transformOrFail<T, E, RD = never, RE = never>(options: {
|
|
356
|
-
readonly decode: (e: E, options:
|
|
357
|
-
readonly encode: (t: T, options:
|
|
359
|
+
readonly decode: (e: E, options: SchemaAST.ParseOptions) => Effect.Effect<T, SchemaIssue.Issue, RD>
|
|
360
|
+
readonly encode: (t: T, options: SchemaAST.ParseOptions) => Effect.Effect<E, SchemaIssue.Issue, RE>
|
|
358
361
|
}): Transformation<T, E, RD, RE> {
|
|
359
362
|
return new Transformation(
|
|
360
|
-
|
|
361
|
-
|
|
363
|
+
SchemaGetter.transformOrFail(options.decode),
|
|
364
|
+
SchemaGetter.transformOrFail(options.encode)
|
|
362
365
|
)
|
|
363
366
|
}
|
|
364
367
|
|
|
@@ -368,8 +371,8 @@ export function transformOrFail<T, E, RD = never, RE = never>(options: {
|
|
|
368
371
|
*
|
|
369
372
|
* **When to use**
|
|
370
373
|
*
|
|
371
|
-
* Use when
|
|
372
|
-
*
|
|
374
|
+
* Use when you need an infallible schema transformation that does not require
|
|
375
|
+
* Effect services.
|
|
373
376
|
*
|
|
374
377
|
* **Details**
|
|
375
378
|
*
|
|
@@ -405,8 +408,8 @@ export function transform<T, E>(options: {
|
|
|
405
408
|
readonly encode: (input: T) => E
|
|
406
409
|
}): Transformation<T, E> {
|
|
407
410
|
return new Transformation(
|
|
408
|
-
|
|
409
|
-
|
|
411
|
+
SchemaGetter.transform(options.decode),
|
|
412
|
+
SchemaGetter.transform(options.encode)
|
|
410
413
|
)
|
|
411
414
|
}
|
|
412
415
|
|
|
@@ -416,7 +419,8 @@ export function transform<T, E>(options: {
|
|
|
416
419
|
*
|
|
417
420
|
* **When to use**
|
|
418
421
|
*
|
|
419
|
-
* Use when you need to produce or consume `Option.None`
|
|
422
|
+
* Use when you need a schema transformation to produce or consume `Option.None`
|
|
423
|
+
* for absent keys.
|
|
420
424
|
* - You are working with optional struct fields.
|
|
421
425
|
*
|
|
422
426
|
* **Details**
|
|
@@ -456,8 +460,8 @@ export function transformOptional<T, E>(options: {
|
|
|
456
460
|
readonly encode: (input: Option.Option<T>) => Option.Option<E>
|
|
457
461
|
}): Transformation<T, E> {
|
|
458
462
|
return new Transformation(
|
|
459
|
-
|
|
460
|
-
|
|
463
|
+
SchemaGetter.transformOptional(options.decode),
|
|
464
|
+
SchemaGetter.transformOptional(options.encode)
|
|
461
465
|
)
|
|
462
466
|
}
|
|
463
467
|
|
|
@@ -467,13 +471,14 @@ export function transformOptional<T, E>(options: {
|
|
|
467
471
|
*
|
|
468
472
|
* **When to use**
|
|
469
473
|
*
|
|
470
|
-
* Use to normalize user input by
|
|
474
|
+
* Use when you need a schema transformation to normalize user input by
|
|
475
|
+
* stripping leading/trailing whitespace.
|
|
471
476
|
*
|
|
472
477
|
* **Details**
|
|
473
478
|
*
|
|
474
|
-
*
|
|
475
|
-
*
|
|
476
|
-
*
|
|
479
|
+
* Decoding applies `String.prototype.trim()`. Encoding is passthrough and
|
|
480
|
+
* returns the string unchanged. This is not round-trippable if the original had
|
|
481
|
+
* whitespace.
|
|
477
482
|
*
|
|
478
483
|
* **Example** (Trimming on decode)
|
|
479
484
|
*
|
|
@@ -494,8 +499,8 @@ export function transformOptional<T, E>(options: {
|
|
|
494
499
|
*/
|
|
495
500
|
export function trim(): Transformation<string, string> {
|
|
496
501
|
return new Transformation(
|
|
497
|
-
|
|
498
|
-
|
|
502
|
+
SchemaGetter.trim(),
|
|
503
|
+
SchemaGetter.passthrough()
|
|
499
504
|
)
|
|
500
505
|
}
|
|
501
506
|
|
|
@@ -505,13 +510,14 @@ export function trim(): Transformation<string, string> {
|
|
|
505
510
|
*
|
|
506
511
|
* **When to use**
|
|
507
512
|
*
|
|
508
|
-
* Use to convert API field names between
|
|
513
|
+
* Use when you need a schema transformation to convert API field names between
|
|
514
|
+
* snake_case and camelCase conventions.
|
|
509
515
|
*
|
|
510
516
|
* **Details**
|
|
511
517
|
*
|
|
512
|
-
*
|
|
513
|
-
*
|
|
514
|
-
*
|
|
518
|
+
* Decoding converts values such as `"my_field_name"` to `"myFieldName"`.
|
|
519
|
+
* Encoding converts values such as `"myFieldName"` back to `"my_field_name"`.
|
|
520
|
+
* The transformation is round-trippable for standard snake_case and camelCase.
|
|
515
521
|
*
|
|
516
522
|
* **Example** (Snake to camel conversion)
|
|
517
523
|
*
|
|
@@ -531,8 +537,8 @@ export function trim(): Transformation<string, string> {
|
|
|
531
537
|
*/
|
|
532
538
|
export function snakeToCamel(): Transformation<string, string> {
|
|
533
539
|
return new Transformation(
|
|
534
|
-
|
|
535
|
-
|
|
540
|
+
SchemaGetter.snakeToCamel(),
|
|
541
|
+
SchemaGetter.camelToSnake()
|
|
536
542
|
)
|
|
537
543
|
}
|
|
538
544
|
|
|
@@ -542,13 +548,13 @@ export function snakeToCamel(): Transformation<string, string> {
|
|
|
542
548
|
*
|
|
543
549
|
* **When to use**
|
|
544
550
|
*
|
|
545
|
-
* Use to normalize strings to lowercase
|
|
551
|
+
* Use when you need a schema transformation to normalize strings to lowercase
|
|
552
|
+
* (e.g. email addresses).
|
|
546
553
|
*
|
|
547
554
|
* **Details**
|
|
548
555
|
*
|
|
549
|
-
*
|
|
550
|
-
* -
|
|
551
|
-
* - Not round-trippable if the original had uppercase characters.
|
|
556
|
+
* Decoding applies `String.prototype.toLowerCase()`. Encoding is passthrough.
|
|
557
|
+
* This is not round-trippable if the original had uppercase characters.
|
|
552
558
|
*
|
|
553
559
|
* **Example** (Lowercasing on decode)
|
|
554
560
|
*
|
|
@@ -568,8 +574,8 @@ export function snakeToCamel(): Transformation<string, string> {
|
|
|
568
574
|
*/
|
|
569
575
|
export function toLowerCase(): Transformation<string, string> {
|
|
570
576
|
return new Transformation(
|
|
571
|
-
|
|
572
|
-
|
|
577
|
+
SchemaGetter.toLowerCase(),
|
|
578
|
+
SchemaGetter.passthrough()
|
|
573
579
|
)
|
|
574
580
|
}
|
|
575
581
|
|
|
@@ -579,13 +585,13 @@ export function toLowerCase(): Transformation<string, string> {
|
|
|
579
585
|
*
|
|
580
586
|
* **When to use**
|
|
581
587
|
*
|
|
582
|
-
* Use to normalize strings to uppercase
|
|
588
|
+
* Use when you need a schema transformation to normalize strings to uppercase
|
|
589
|
+
* (e.g. country codes).
|
|
583
590
|
*
|
|
584
591
|
* **Details**
|
|
585
592
|
*
|
|
586
|
-
*
|
|
587
|
-
* -
|
|
588
|
-
* - Not round-trippable if the original had lowercase characters.
|
|
593
|
+
* Decoding applies `String.prototype.toUpperCase()`. Encoding is passthrough.
|
|
594
|
+
* This is not round-trippable if the original had lowercase characters.
|
|
589
595
|
*
|
|
590
596
|
* **Example** (Uppercasing on decode)
|
|
591
597
|
*
|
|
@@ -605,8 +611,8 @@ export function toLowerCase(): Transformation<string, string> {
|
|
|
605
611
|
*/
|
|
606
612
|
export function toUpperCase(): Transformation<string, string> {
|
|
607
613
|
return new Transformation(
|
|
608
|
-
|
|
609
|
-
|
|
614
|
+
SchemaGetter.toUpperCase(),
|
|
615
|
+
SchemaGetter.passthrough()
|
|
610
616
|
)
|
|
611
617
|
}
|
|
612
618
|
|
|
@@ -616,12 +622,13 @@ export function toUpperCase(): Transformation<string, string> {
|
|
|
616
622
|
*
|
|
617
623
|
* **When to use**
|
|
618
624
|
*
|
|
619
|
-
* Use to normalize display names or
|
|
625
|
+
* Use when you need a schema transformation to normalize display names or
|
|
626
|
+
* titles.
|
|
620
627
|
*
|
|
621
628
|
* **Details**
|
|
622
629
|
*
|
|
623
|
-
*
|
|
624
|
-
*
|
|
630
|
+
* Decoding uppercases the first character and leaves the rest unchanged.
|
|
631
|
+
* Encoding is passthrough.
|
|
625
632
|
*
|
|
626
633
|
* **Example** (Capitalizing on decode)
|
|
627
634
|
*
|
|
@@ -641,8 +648,8 @@ export function toUpperCase(): Transformation<string, string> {
|
|
|
641
648
|
*/
|
|
642
649
|
export function capitalize(): Transformation<string, string> {
|
|
643
650
|
return new Transformation(
|
|
644
|
-
|
|
645
|
-
|
|
651
|
+
SchemaGetter.capitalize(),
|
|
652
|
+
SchemaGetter.passthrough()
|
|
646
653
|
)
|
|
647
654
|
}
|
|
648
655
|
|
|
@@ -652,12 +659,13 @@ export function capitalize(): Transformation<string, string> {
|
|
|
652
659
|
*
|
|
653
660
|
* **When to use**
|
|
654
661
|
*
|
|
655
|
-
* Use to normalize identifiers or field
|
|
662
|
+
* Use when you need a schema transformation to normalize identifiers or field
|
|
663
|
+
* names.
|
|
656
664
|
*
|
|
657
665
|
* **Details**
|
|
658
666
|
*
|
|
659
|
-
*
|
|
660
|
-
*
|
|
667
|
+
* Decoding lowercases the first character and leaves the rest unchanged.
|
|
668
|
+
* Encoding is passthrough.
|
|
661
669
|
*
|
|
662
670
|
* **Example** (Uncapitalizing on decode)
|
|
663
671
|
*
|
|
@@ -677,8 +685,8 @@ export function capitalize(): Transformation<string, string> {
|
|
|
677
685
|
*/
|
|
678
686
|
export function uncapitalize(): Transformation<string, string> {
|
|
679
687
|
return new Transformation(
|
|
680
|
-
|
|
681
|
-
|
|
688
|
+
SchemaGetter.uncapitalize(),
|
|
689
|
+
SchemaGetter.passthrough()
|
|
682
690
|
)
|
|
683
691
|
}
|
|
684
692
|
|
|
@@ -688,14 +696,15 @@ export function uncapitalize(): Transformation<string, string> {
|
|
|
688
696
|
*
|
|
689
697
|
* **When to use**
|
|
690
698
|
*
|
|
691
|
-
* Use to parse query-string-like or
|
|
699
|
+
* Use when you need a schema transformation to parse query-string-like or
|
|
700
|
+
* config-file-like strings into records.
|
|
692
701
|
*
|
|
693
702
|
* **Details**
|
|
694
703
|
*
|
|
695
|
-
*
|
|
696
|
-
*
|
|
697
|
-
*
|
|
698
|
-
* -
|
|
704
|
+
* Decoding splits the string by `separator` (default `","`) into pairs, then
|
|
705
|
+
* splits each pair by `keyValueSeparator` (default `"="`). Encoding joins the
|
|
706
|
+
* record back into a string using the same separators. The transformation is
|
|
707
|
+
* round-trippable when keys and values do not contain the separators.
|
|
699
708
|
*
|
|
700
709
|
* **Example** (Parsing key-value pairs)
|
|
701
710
|
*
|
|
@@ -722,14 +731,14 @@ export function splitKeyValue(options?: {
|
|
|
722
731
|
readonly keyValueSeparator?: string | undefined
|
|
723
732
|
}): Transformation<Record<string, string>, string> {
|
|
724
733
|
return new Transformation(
|
|
725
|
-
|
|
726
|
-
|
|
734
|
+
SchemaGetter.splitKeyValue(options),
|
|
735
|
+
SchemaGetter.joinKeyValue(options)
|
|
727
736
|
)
|
|
728
737
|
}
|
|
729
738
|
|
|
730
739
|
const passthrough_ = new Transformation(
|
|
731
|
-
|
|
732
|
-
|
|
740
|
+
SchemaGetter.passthrough<any>(),
|
|
741
|
+
SchemaGetter.passthrough<any>()
|
|
733
742
|
)
|
|
734
743
|
|
|
735
744
|
/**
|
|
@@ -738,9 +747,8 @@ const passthrough_ = new Transformation(
|
|
|
738
747
|
*
|
|
739
748
|
* **When to use**
|
|
740
749
|
*
|
|
741
|
-
* Use when
|
|
742
|
-
*
|
|
743
|
-
* no actual conversion is needed.
|
|
750
|
+
* Use when you need a schema transformation to connect two schemas that share
|
|
751
|
+
* the same type with no actual conversion.
|
|
744
752
|
*
|
|
745
753
|
* **Details**
|
|
746
754
|
*
|
|
@@ -778,7 +786,7 @@ export function passthrough<T>(): Transformation<T, T> {
|
|
|
778
786
|
*
|
|
779
787
|
* **When to use**
|
|
780
788
|
*
|
|
781
|
-
* Use when
|
|
789
|
+
* Use when you need a no-op schema transformation whose decoded side is
|
|
782
790
|
* narrower than the encoded side.
|
|
783
791
|
*
|
|
784
792
|
* **Details**
|
|
@@ -811,7 +819,8 @@ export function passthroughSupertype<T>(): Transformation<T, T> {
|
|
|
811
819
|
*
|
|
812
820
|
* **When to use**
|
|
813
821
|
*
|
|
814
|
-
* Use when
|
|
822
|
+
* Use when you need a no-op schema transformation whose encoded side is more
|
|
823
|
+
* specific than its decoded side.
|
|
815
824
|
*
|
|
816
825
|
* **Details**
|
|
817
826
|
*
|
|
@@ -843,14 +852,15 @@ export function passthroughSubtype<T>(): Transformation<T, T> {
|
|
|
843
852
|
*
|
|
844
853
|
* **When to use**
|
|
845
854
|
*
|
|
846
|
-
* Use to parse numeric strings from APIs,
|
|
855
|
+
* Use when you need a schema transformation to parse numeric strings from APIs,
|
|
856
|
+
* form data, or URL parameters.
|
|
847
857
|
*
|
|
848
858
|
* **Details**
|
|
849
859
|
*
|
|
850
|
-
*
|
|
851
|
-
*
|
|
852
|
-
*
|
|
853
|
-
*
|
|
860
|
+
* Decoding coerces the string to a number like `Number(s)`. Encoding coerces
|
|
861
|
+
* the number to a string like `String(n)`. This does not validate that the
|
|
862
|
+
* result is finite; combine with `Schema.Finite` or `Schema.Int` for stricter
|
|
863
|
+
* checks.
|
|
854
864
|
*
|
|
855
865
|
* **Example** (Number from string)
|
|
856
866
|
*
|
|
@@ -869,8 +879,8 @@ export function passthroughSubtype<T>(): Transformation<T, T> {
|
|
|
869
879
|
* @since 4.0.0
|
|
870
880
|
*/
|
|
871
881
|
export const numberFromString = new Transformation(
|
|
872
|
-
|
|
873
|
-
|
|
882
|
+
SchemaGetter.Number(),
|
|
883
|
+
SchemaGetter.String()
|
|
874
884
|
)
|
|
875
885
|
|
|
876
886
|
/**
|
|
@@ -879,13 +889,14 @@ export const numberFromString = new Transformation(
|
|
|
879
889
|
*
|
|
880
890
|
* **When to use**
|
|
881
891
|
*
|
|
882
|
-
* Use to parse large integer strings
|
|
892
|
+
* Use when you need a schema transformation to parse large integer strings
|
|
893
|
+
* (e.g. database IDs, blockchain values).
|
|
883
894
|
*
|
|
884
895
|
* **Details**
|
|
885
896
|
*
|
|
886
|
-
*
|
|
887
|
-
*
|
|
888
|
-
*
|
|
897
|
+
* Decoding coerces the string to a bigint like `BigInt(s)`. Encoding coerces
|
|
898
|
+
* the bigint to a string like `String(n)`. Decoding fails if the string is not
|
|
899
|
+
* a valid bigint representation.
|
|
889
900
|
*
|
|
890
901
|
* **Example** (BigInt from string)
|
|
891
902
|
*
|
|
@@ -904,8 +915,8 @@ export const numberFromString = new Transformation(
|
|
|
904
915
|
* @since 4.0.0
|
|
905
916
|
*/
|
|
906
917
|
export const bigintFromString = new Transformation(
|
|
907
|
-
|
|
908
|
-
|
|
918
|
+
SchemaGetter.BigInt(),
|
|
919
|
+
SchemaGetter.String()
|
|
909
920
|
)
|
|
910
921
|
|
|
911
922
|
/**
|
|
@@ -913,13 +924,14 @@ export const bigintFromString = new Transformation(
|
|
|
913
924
|
*
|
|
914
925
|
* **When to use**
|
|
915
926
|
*
|
|
916
|
-
* Use to parse ISO 8601 date strings from
|
|
927
|
+
* Use when you need a schema transformation to parse ISO 8601 date strings from
|
|
928
|
+
* APIs or user input.
|
|
917
929
|
*
|
|
918
930
|
* **Details**
|
|
919
931
|
*
|
|
920
|
-
*
|
|
921
|
-
*
|
|
922
|
-
*
|
|
932
|
+
* Decoding creates a `Date` from the string like `new Date(s)`. Encoding
|
|
933
|
+
* converts the `Date` to an ISO string like `date.toISOString()`, returning
|
|
934
|
+
* `"Invalid Date"` for invalid dates.
|
|
923
935
|
*
|
|
924
936
|
* **Example** (Date from string)
|
|
925
937
|
*
|
|
@@ -938,8 +950,8 @@ export const bigintFromString = new Transformation(
|
|
|
938
950
|
* @since 4.0.0
|
|
939
951
|
*/
|
|
940
952
|
export const dateFromString: Transformation<globalThis.Date, string> = new Transformation(
|
|
941
|
-
|
|
942
|
-
|
|
953
|
+
SchemaGetter.Date(),
|
|
954
|
+
SchemaGetter.transform(formatDate)
|
|
943
955
|
)
|
|
944
956
|
|
|
945
957
|
/**
|
|
@@ -948,14 +960,15 @@ export const dateFromString: Transformation<globalThis.Date, string> = new Trans
|
|
|
948
960
|
*
|
|
949
961
|
* **When to use**
|
|
950
962
|
*
|
|
951
|
-
* Use to parse human-readable duration
|
|
963
|
+
* Use when you need a schema transformation to parse human-readable duration
|
|
964
|
+
* strings from APIs, config, or user input.
|
|
952
965
|
*
|
|
953
966
|
* **Details**
|
|
954
967
|
*
|
|
955
|
-
*
|
|
956
|
-
*
|
|
957
|
-
*
|
|
958
|
-
*
|
|
968
|
+
* Decoding accepts any string that `Duration.fromInput` can parse, including
|
|
969
|
+
* `"Infinity"` and `"-Infinity"`. Encoding returns `String(duration)`,
|
|
970
|
+
* producing strings such as `"2000 millis"` or `"10 nanos"` that round-trip
|
|
971
|
+
* through the parser.
|
|
959
972
|
*
|
|
960
973
|
* **Example** (Duration from string)
|
|
961
974
|
*
|
|
@@ -979,7 +992,8 @@ export const durationFromString: Transformation<Duration.Duration, string> = tra
|
|
|
979
992
|
>({
|
|
980
993
|
decode: (s) =>
|
|
981
994
|
Option.match(Duration.fromInput(s as Duration.Input), {
|
|
982
|
-
onNone: () =>
|
|
995
|
+
onNone: () =>
|
|
996
|
+
Effect.fail(new SchemaIssue.InvalidValue(Option.some(s), { message: `Invalid Duration string: ${s}` })),
|
|
983
997
|
onSome: Effect.succeed
|
|
984
998
|
}),
|
|
985
999
|
encode: (duration) => Effect.succeed(globalThis.String(duration))
|
|
@@ -991,13 +1005,14 @@ export const durationFromString: Transformation<Duration.Duration, string> = tra
|
|
|
991
1005
|
*
|
|
992
1006
|
* **When to use**
|
|
993
1007
|
*
|
|
994
|
-
* Use when
|
|
1008
|
+
* Use when you need a schema transformation for nanosecond-precision timestamps
|
|
1009
|
+
* or intervals.
|
|
995
1010
|
*
|
|
996
1011
|
* **Details**
|
|
997
1012
|
*
|
|
998
|
-
*
|
|
999
|
-
*
|
|
1000
|
-
*
|
|
1013
|
+
* Decoding always succeeds and creates a `Duration` from nanoseconds. Encoding
|
|
1014
|
+
* fails with `InvalidValue` if the `Duration` cannot be represented as a
|
|
1015
|
+
* `bigint`, such as `Duration.infinity`.
|
|
1001
1016
|
*
|
|
1002
1017
|
* **Example** (Duration from nanoseconds)
|
|
1003
1018
|
*
|
|
@@ -1020,7 +1035,7 @@ export const durationFromNanos: Transformation<Duration.Duration, bigint> = tran
|
|
|
1020
1035
|
Option.match(Duration.toNanos(a), {
|
|
1021
1036
|
onNone: () =>
|
|
1022
1037
|
Effect.fail(
|
|
1023
|
-
new
|
|
1038
|
+
new SchemaIssue.InvalidValue(Option.some(a), { message: `Unable to encode ${a} into a bigint` })
|
|
1024
1039
|
),
|
|
1025
1040
|
onSome: (nanos) => Effect.succeed(nanos)
|
|
1026
1041
|
})
|
|
@@ -1032,8 +1047,8 @@ export const durationFromNanos: Transformation<Duration.Duration, bigint> = tran
|
|
|
1032
1047
|
*
|
|
1033
1048
|
* **When to use**
|
|
1034
1049
|
*
|
|
1035
|
-
* Use when you
|
|
1036
|
-
* stored as millisecond counts.
|
|
1050
|
+
* Use when you need a schema transformation to decode timeouts, delays, elapsed
|
|
1051
|
+
* intervals, or other duration values stored as millisecond counts.
|
|
1037
1052
|
*
|
|
1038
1053
|
* **Details**
|
|
1039
1054
|
*
|
|
@@ -1097,13 +1112,14 @@ export const errorFromErrorJsonEncoded = (options?: {
|
|
|
1097
1112
|
*
|
|
1098
1113
|
* **When to use**
|
|
1099
1114
|
*
|
|
1100
|
-
* Use to convert nullable API fields to
|
|
1115
|
+
* Use when you need a schema transformation to convert nullable API fields to
|
|
1116
|
+
* `Option`.
|
|
1101
1117
|
*
|
|
1102
1118
|
* **Details**
|
|
1103
1119
|
*
|
|
1104
|
-
*
|
|
1105
|
-
*
|
|
1106
|
-
*
|
|
1120
|
+
* Decoding maps `null` to `Option.none()` and non-null values to
|
|
1121
|
+
* `Option.some(value)`. Encoding maps `Option.none()` to `null` and
|
|
1122
|
+
* `Option.some(value)` to `value`. The transformation is pure and synchronous.
|
|
1107
1123
|
*
|
|
1108
1124
|
* **Example** (Option from nullable)
|
|
1109
1125
|
*
|
|
@@ -1136,13 +1152,14 @@ export function optionFromNullOr<T>(): Transformation<Option.Option<T>, T | null
|
|
|
1136
1152
|
*
|
|
1137
1153
|
* **When to use**
|
|
1138
1154
|
*
|
|
1139
|
-
* Use to convert
|
|
1155
|
+
* Use when you need a schema transformation to convert API fields that use
|
|
1156
|
+
* `undefined` for absence to `Option`.
|
|
1140
1157
|
*
|
|
1141
1158
|
* **Details**
|
|
1142
1159
|
*
|
|
1143
|
-
*
|
|
1144
|
-
*
|
|
1145
|
-
*
|
|
1160
|
+
* Decoding maps `undefined` to `Option.none()` and non-undefined values to
|
|
1161
|
+
* `Option.some(value)`. Encoding maps `Option.none()` to `undefined` and
|
|
1162
|
+
* `Option.some(value)` to `value`. The transformation is pure and synchronous.
|
|
1146
1163
|
*
|
|
1147
1164
|
* **Example** (Option from undefined-or)
|
|
1148
1165
|
*
|
|
@@ -1177,15 +1194,15 @@ export function optionFromUndefinedOr<T>(): Transformation<Option.Option<T>, T |
|
|
|
1177
1194
|
*
|
|
1178
1195
|
* **When to use**
|
|
1179
1196
|
*
|
|
1180
|
-
* Use to convert nullish API fields to
|
|
1181
|
-
*
|
|
1197
|
+
* Use when you need a schema transformation to convert nullish API fields to
|
|
1198
|
+
* `Option` when both `null` and `undefined` represent absence.
|
|
1182
1199
|
*
|
|
1183
1200
|
* **Details**
|
|
1184
1201
|
*
|
|
1185
|
-
*
|
|
1186
|
-
*
|
|
1187
|
-
*
|
|
1188
|
-
*
|
|
1202
|
+
* Decoding maps `null` and `undefined` to `Option.none()` and all other values
|
|
1203
|
+
* to `Option.some(value)`. Encoding maps `Option.none()` to `null` or
|
|
1204
|
+
* `undefined` according to `options.onNoneEncoding`, and maps
|
|
1205
|
+
* `Option.some(value)` to `value`. The transformation is pure and synchronous.
|
|
1189
1206
|
*
|
|
1190
1207
|
* **Example** (Option from nullish, encoding None as null)
|
|
1191
1208
|
*
|
|
@@ -1223,14 +1240,15 @@ export function optionFromNullishOr<T>(
|
|
|
1223
1240
|
*
|
|
1224
1241
|
* **When to use**
|
|
1225
1242
|
*
|
|
1226
|
-
* Use to convert optional struct keys
|
|
1227
|
-
*
|
|
1243
|
+
* Use when you need a schema transformation to convert optional struct keys
|
|
1244
|
+
* (declared with `Schema.optionalKey`) to `Option` values.
|
|
1228
1245
|
*
|
|
1229
1246
|
* **Details**
|
|
1230
1247
|
*
|
|
1231
|
-
*
|
|
1232
|
-
*
|
|
1233
|
-
*
|
|
1248
|
+
* Decoding maps an absent key (`None`) to `Some(None)` and a present key
|
|
1249
|
+
* (`Some(v)`) to `Some(Some(v))`. Encoding maps `Some(None)` to `None` to omit
|
|
1250
|
+
* the key, and maps `Some(Some(v))` to `Some(v)`. This uses
|
|
1251
|
+
* `transformOptional` under the hood.
|
|
1234
1252
|
*
|
|
1235
1253
|
* **Example** (Optional key to Option)
|
|
1236
1254
|
*
|
|
@@ -1267,13 +1285,15 @@ export function optionFromOptionalKey<T>(): Transformation<Option.Option<T>, T>
|
|
|
1267
1285
|
*
|
|
1268
1286
|
* **When to use**
|
|
1269
1287
|
*
|
|
1270
|
-
* Use to convert optional (possibly
|
|
1288
|
+
* Use when you need a schema transformation to convert optional (possibly
|
|
1289
|
+
* `undefined`) values to `Option`.
|
|
1271
1290
|
*
|
|
1272
1291
|
* **Details**
|
|
1273
1292
|
*
|
|
1274
|
-
*
|
|
1275
|
-
*
|
|
1276
|
-
*
|
|
1293
|
+
* Decoding maps an absent or `undefined` value to `Some(None)` and a present
|
|
1294
|
+
* value to `Some(Some(v))`. Encoding maps `Some(None)` to `None` to omit the
|
|
1295
|
+
* value, and maps `Some(Some(v))` to `Some(v)`. This uses
|
|
1296
|
+
* `transformOptional` under the hood and filters out `undefined` on decode.
|
|
1277
1297
|
*
|
|
1278
1298
|
* **Example** (Optional value to Option)
|
|
1279
1299
|
*
|
|
@@ -1310,13 +1330,13 @@ export function optionFromOptional<T>(): Transformation<Option.Option<T>, T | un
|
|
|
1310
1330
|
*
|
|
1311
1331
|
* **When to use**
|
|
1312
1332
|
*
|
|
1313
|
-
* Use to parse URL strings from user
|
|
1333
|
+
* Use when you need a schema transformation to parse URL strings from user
|
|
1334
|
+
* input or API responses.
|
|
1314
1335
|
*
|
|
1315
1336
|
* **Details**
|
|
1316
1337
|
*
|
|
1317
|
-
*
|
|
1318
|
-
*
|
|
1319
|
-
* - Encode: returns `url.href`.
|
|
1338
|
+
* Decoding calls `new URL(s)` and fails with `InvalidValue` if the string is
|
|
1339
|
+
* not a valid URL. Encoding returns `url.href`.
|
|
1320
1340
|
*
|
|
1321
1341
|
* **Example** (URL from string)
|
|
1322
1342
|
*
|
|
@@ -1338,7 +1358,7 @@ export const urlFromString: Transformation<URL, string> = transformOrFail<URL, s
|
|
|
1338
1358
|
decode: (s) =>
|
|
1339
1359
|
Effect.try({
|
|
1340
1360
|
try: () => new URL(s),
|
|
1341
|
-
catch: () => new
|
|
1361
|
+
catch: () => new SchemaIssue.InvalidValue(Option.some(s), { message: `Invalid URL string: ${s}` })
|
|
1342
1362
|
}),
|
|
1343
1363
|
encode: (url) => Effect.succeed(url.href)
|
|
1344
1364
|
})
|
|
@@ -1349,13 +1369,14 @@ export const urlFromString: Transformation<URL, string> = transformOrFail<URL, s
|
|
|
1349
1369
|
*
|
|
1350
1370
|
* **When to use**
|
|
1351
1371
|
*
|
|
1352
|
-
* Use to parse decimal number strings
|
|
1372
|
+
* Use when you need a schema transformation to parse decimal number strings
|
|
1373
|
+
* from APIs or user input.
|
|
1353
1374
|
*
|
|
1354
1375
|
* **Details**
|
|
1355
1376
|
*
|
|
1356
|
-
*
|
|
1357
|
-
*
|
|
1358
|
-
*
|
|
1377
|
+
* Decoding calls `BigDecimal.fromString(s)` and fails with `InvalidValue` if
|
|
1378
|
+
* the string is not a valid `BigDecimal` representation. Encoding returns
|
|
1379
|
+
* `BigDecimal.format(bd)`.
|
|
1359
1380
|
*
|
|
1360
1381
|
* @category transforming
|
|
1361
1382
|
* @since 4.0.0
|
|
@@ -1367,7 +1388,7 @@ export const bigDecimalFromString: Transformation<BigDecimal.BigDecimal, string>
|
|
|
1367
1388
|
decode: (s) => {
|
|
1368
1389
|
const result = BigDecimal.fromString(s)
|
|
1369
1390
|
return Option.isNone(result)
|
|
1370
|
-
? Effect.fail(new
|
|
1391
|
+
? Effect.fail(new SchemaIssue.InvalidValue(Option.some(s), { message: `Invalid BigDecimal string: ${s}` }))
|
|
1371
1392
|
: Effect.succeed(result.value)
|
|
1372
1393
|
},
|
|
1373
1394
|
encode: (bd) => Effect.succeed(BigDecimal.format(bd))
|
|
@@ -1379,13 +1400,13 @@ export const bigDecimalFromString: Transformation<BigDecimal.BigDecimal, string>
|
|
|
1379
1400
|
*
|
|
1380
1401
|
* **When to use**
|
|
1381
1402
|
*
|
|
1382
|
-
* Use when
|
|
1383
|
-
*
|
|
1403
|
+
* Use when you need a schema transformation for binary data transmitted as
|
|
1404
|
+
* Base64 strings (e.g. file uploads, API payloads).
|
|
1384
1405
|
*
|
|
1385
1406
|
* **Details**
|
|
1386
1407
|
*
|
|
1387
|
-
*
|
|
1388
|
-
*
|
|
1408
|
+
* Decoding parses the Base64 string into bytes. Encoding writes the byte array
|
|
1409
|
+
* as a Base64 string.
|
|
1389
1410
|
*
|
|
1390
1411
|
* **Example** (Uint8Array from Base64)
|
|
1391
1412
|
*
|
|
@@ -1404,8 +1425,8 @@ export const bigDecimalFromString: Transformation<BigDecimal.BigDecimal, string>
|
|
|
1404
1425
|
* @since 4.0.0
|
|
1405
1426
|
*/
|
|
1406
1427
|
export const uint8ArrayFromBase64String: Transformation<Uint8Array<ArrayBufferLike>, string> = new Transformation(
|
|
1407
|
-
|
|
1408
|
-
|
|
1428
|
+
SchemaGetter.decodeBase64(),
|
|
1429
|
+
SchemaGetter.encodeBase64()
|
|
1409
1430
|
)
|
|
1410
1431
|
|
|
1411
1432
|
/**
|
|
@@ -1414,12 +1435,13 @@ export const uint8ArrayFromBase64String: Transformation<Uint8Array<ArrayBufferLi
|
|
|
1414
1435
|
*
|
|
1415
1436
|
* **When to use**
|
|
1416
1437
|
*
|
|
1417
|
-
* Use when
|
|
1438
|
+
* Use when you need a schema transformation for text data transmitted as Base64
|
|
1439
|
+
* strings.
|
|
1418
1440
|
*
|
|
1419
1441
|
* **Details**
|
|
1420
1442
|
*
|
|
1421
|
-
*
|
|
1422
|
-
*
|
|
1443
|
+
* Decoding parses the Base64 string into a UTF-8 string. Encoding writes the
|
|
1444
|
+
* string as a Base64 string.
|
|
1423
1445
|
*
|
|
1424
1446
|
* **Example** (String from Base64)
|
|
1425
1447
|
*
|
|
@@ -1438,8 +1460,8 @@ export const uint8ArrayFromBase64String: Transformation<Uint8Array<ArrayBufferLi
|
|
|
1438
1460
|
* @since 4.0.0
|
|
1439
1461
|
*/
|
|
1440
1462
|
export const stringFromBase64String: Transformation<string, string> = new Transformation(
|
|
1441
|
-
|
|
1442
|
-
|
|
1463
|
+
SchemaGetter.decodeBase64String(),
|
|
1464
|
+
SchemaGetter.encodeBase64()
|
|
1443
1465
|
)
|
|
1444
1466
|
|
|
1445
1467
|
/**
|
|
@@ -1447,12 +1469,13 @@ export const stringFromBase64String: Transformation<string, string> = new Transf
|
|
|
1447
1469
|
*
|
|
1448
1470
|
* **When to use**
|
|
1449
1471
|
*
|
|
1450
|
-
* Use when
|
|
1472
|
+
* Use when you need a schema transformation for text data transmitted as Base64
|
|
1473
|
+
* URL-safe strings.
|
|
1451
1474
|
*
|
|
1452
1475
|
* **Details**
|
|
1453
1476
|
*
|
|
1454
|
-
*
|
|
1455
|
-
*
|
|
1477
|
+
* Decoding parses the Base64 URL string into a UTF-8 string. Encoding writes
|
|
1478
|
+
* the string as a Base64 URL string.
|
|
1456
1479
|
*
|
|
1457
1480
|
* **Example** (String from Base64Url)
|
|
1458
1481
|
*
|
|
@@ -1471,8 +1494,8 @@ export const stringFromBase64String: Transformation<string, string> = new Transf
|
|
|
1471
1494
|
* @since 4.0.0
|
|
1472
1495
|
*/
|
|
1473
1496
|
export const stringFromBase64UrlString: Transformation<string, string> = new Transformation(
|
|
1474
|
-
|
|
1475
|
-
|
|
1497
|
+
SchemaGetter.decodeBase64UrlString(),
|
|
1498
|
+
SchemaGetter.encodeBase64Url()
|
|
1476
1499
|
)
|
|
1477
1500
|
|
|
1478
1501
|
/**
|
|
@@ -1480,12 +1503,13 @@ export const stringFromBase64UrlString: Transformation<string, string> = new Tra
|
|
|
1480
1503
|
*
|
|
1481
1504
|
* **When to use**
|
|
1482
1505
|
*
|
|
1483
|
-
* Use when
|
|
1506
|
+
* Use when you need a schema transformation for text data transmitted as
|
|
1507
|
+
* hexadecimal strings.
|
|
1484
1508
|
*
|
|
1485
1509
|
* **Details**
|
|
1486
1510
|
*
|
|
1487
|
-
*
|
|
1488
|
-
*
|
|
1511
|
+
* Decoding parses the hex string into a UTF-8 string. Encoding writes the
|
|
1512
|
+
* string as a hex string.
|
|
1489
1513
|
*
|
|
1490
1514
|
* **Example** (String from Hex)
|
|
1491
1515
|
*
|
|
@@ -1504,8 +1528,8 @@ export const stringFromBase64UrlString: Transformation<string, string> = new Tra
|
|
|
1504
1528
|
* @since 4.0.0
|
|
1505
1529
|
*/
|
|
1506
1530
|
export const stringFromHexString: Transformation<string, string> = new Transformation(
|
|
1507
|
-
|
|
1508
|
-
|
|
1531
|
+
SchemaGetter.decodeHexString(),
|
|
1532
|
+
SchemaGetter.encodeHex()
|
|
1509
1533
|
)
|
|
1510
1534
|
|
|
1511
1535
|
/**
|
|
@@ -1514,14 +1538,14 @@ export const stringFromHexString: Transformation<string, string> = new Transform
|
|
|
1514
1538
|
*
|
|
1515
1539
|
* **When to use**
|
|
1516
1540
|
*
|
|
1517
|
-
* Use when
|
|
1518
|
-
*
|
|
1541
|
+
* Use when you need a schema transformation to store structured data in URL
|
|
1542
|
+
* query parameters or fragments, such as composing with `Schema.parseJson` to
|
|
1543
|
+
* round-trip JSON through a URL.
|
|
1519
1544
|
*
|
|
1520
1545
|
* **Details**
|
|
1521
1546
|
*
|
|
1522
|
-
*
|
|
1523
|
-
*
|
|
1524
|
-
* - Encode: calls `encodeURIComponent`.
|
|
1547
|
+
* Decoding calls `decodeURIComponent` and fails if the input contains malformed
|
|
1548
|
+
* percent-encoding sequences. Encoding calls `encodeURIComponent`.
|
|
1525
1549
|
*
|
|
1526
1550
|
* **Example** (URI component schema)
|
|
1527
1551
|
*
|
|
@@ -1540,8 +1564,8 @@ export const stringFromHexString: Transformation<string, string> = new Transform
|
|
|
1540
1564
|
* @since 4.0.0
|
|
1541
1565
|
*/
|
|
1542
1566
|
export const stringFromUriComponent: Transformation<string, string> = new Transformation(
|
|
1543
|
-
|
|
1544
|
-
|
|
1567
|
+
SchemaGetter.decodeUriComponent(),
|
|
1568
|
+
SchemaGetter.encodeUriComponent()
|
|
1545
1569
|
)
|
|
1546
1570
|
|
|
1547
1571
|
/**
|
|
@@ -1550,8 +1574,9 @@ export const stringFromUriComponent: Transformation<string, string> = new Transf
|
|
|
1550
1574
|
*
|
|
1551
1575
|
* **When to use**
|
|
1552
1576
|
*
|
|
1553
|
-
* Use when you
|
|
1554
|
-
* with another schema that
|
|
1577
|
+
* Use when you need a schema transformation to decode JSON stored or
|
|
1578
|
+
* transmitted as a string, usually before composing with another schema that
|
|
1579
|
+
* validates the parsed structure.
|
|
1555
1580
|
*
|
|
1556
1581
|
* **Details**
|
|
1557
1582
|
*
|
|
@@ -1575,8 +1600,8 @@ export const stringFromUriComponent: Transformation<string, string> = new Transf
|
|
|
1575
1600
|
* @since 4.0.0
|
|
1576
1601
|
*/
|
|
1577
1602
|
export const fromJsonString = new Transformation<unknown, string>(
|
|
1578
|
-
|
|
1579
|
-
|
|
1603
|
+
SchemaGetter.parseJson(),
|
|
1604
|
+
SchemaGetter.stringifyJson()
|
|
1580
1605
|
)
|
|
1581
1606
|
|
|
1582
1607
|
/**
|
|
@@ -1585,8 +1610,8 @@ export const fromJsonString = new Transformation<unknown, string>(
|
|
|
1585
1610
|
*
|
|
1586
1611
|
* **When to use**
|
|
1587
1612
|
*
|
|
1588
|
-
* Use when you
|
|
1589
|
-
* `items[0]
|
|
1613
|
+
* Use when you need a schema transformation for form or multipart payloads
|
|
1614
|
+
* whose keys, such as `user[name]` or `items[0]`, should become nested data.
|
|
1590
1615
|
*
|
|
1591
1616
|
* **Details**
|
|
1592
1617
|
*
|
|
@@ -1611,8 +1636,8 @@ export const fromJsonString = new Transformation<unknown, string>(
|
|
|
1611
1636
|
* @since 4.0.0
|
|
1612
1637
|
*/
|
|
1613
1638
|
export const fromFormData = new Transformation<unknown, FormData>(
|
|
1614
|
-
|
|
1615
|
-
|
|
1639
|
+
SchemaGetter.decodeFormData(),
|
|
1640
|
+
SchemaGetter.encodeFormData()
|
|
1616
1641
|
)
|
|
1617
1642
|
|
|
1618
1643
|
/**
|
|
@@ -1621,8 +1646,8 @@ export const fromFormData = new Transformation<unknown, FormData>(
|
|
|
1621
1646
|
*
|
|
1622
1647
|
* **When to use**
|
|
1623
1648
|
*
|
|
1624
|
-
* Use when you
|
|
1625
|
-
* should become nested data.
|
|
1649
|
+
* Use when you need a schema transformation for query strings whose keys, such
|
|
1650
|
+
* as `filter[name]` or `items[0]`, should become nested data.
|
|
1626
1651
|
*
|
|
1627
1652
|
* **Details**
|
|
1628
1653
|
*
|
|
@@ -1647,8 +1672,8 @@ export const fromFormData = new Transformation<unknown, FormData>(
|
|
|
1647
1672
|
* @since 4.0.0
|
|
1648
1673
|
*/
|
|
1649
1674
|
export const fromURLSearchParams = new Transformation<unknown, URLSearchParams>(
|
|
1650
|
-
|
|
1651
|
-
|
|
1675
|
+
SchemaGetter.decodeURLSearchParams(),
|
|
1676
|
+
SchemaGetter.encodeURLSearchParams()
|
|
1652
1677
|
)
|
|
1653
1678
|
|
|
1654
1679
|
/**
|
|
@@ -1657,8 +1682,8 @@ export const fromURLSearchParams = new Transformation<unknown, URLSearchParams>(
|
|
|
1657
1682
|
*
|
|
1658
1683
|
* **When to use**
|
|
1659
1684
|
*
|
|
1660
|
-
* Use to represent fixed-offset time
|
|
1661
|
-
*
|
|
1685
|
+
* Use when you need a schema transformation to represent fixed-offset time
|
|
1686
|
+
* zones with numeric millisecond offsets.
|
|
1662
1687
|
*
|
|
1663
1688
|
* **Details**
|
|
1664
1689
|
*
|
|
@@ -1685,8 +1710,8 @@ export const timeZoneOffsetFromNumber: Transformation<DateTime.TimeZone.Offset,
|
|
|
1685
1710
|
*
|
|
1686
1711
|
* **When to use**
|
|
1687
1712
|
*
|
|
1688
|
-
* Use when a schema transformation
|
|
1689
|
-
* strings and produce `DateTime.TimeZone.Named` values.
|
|
1713
|
+
* Use when you need a schema transformation to accept only IANA time-zone
|
|
1714
|
+
* identifier strings and produce `DateTime.TimeZone.Named` values.
|
|
1690
1715
|
*
|
|
1691
1716
|
* **Details**
|
|
1692
1717
|
*
|
|
@@ -1704,7 +1729,8 @@ export const timeZoneNamedFromString: Transformation<DateTime.TimeZone.Named, st
|
|
|
1704
1729
|
>({
|
|
1705
1730
|
decode: (s) => {
|
|
1706
1731
|
return Option.match(DateTime.zoneMakeNamed(s), {
|
|
1707
|
-
onNone: () =>
|
|
1732
|
+
onNone: () =>
|
|
1733
|
+
Effect.fail(new SchemaIssue.InvalidValue(Option.some(s), { message: `Invalid IANA time zone: ${s}` })),
|
|
1708
1734
|
onSome: Effect.succeed
|
|
1709
1735
|
})
|
|
1710
1736
|
},
|
|
@@ -1717,8 +1743,8 @@ export const timeZoneNamedFromString: Transformation<DateTime.TimeZone.Named, st
|
|
|
1717
1743
|
*
|
|
1718
1744
|
* **When to use**
|
|
1719
1745
|
*
|
|
1720
|
-
* Use when schema
|
|
1721
|
-
* an offset string and produce a general `DateTime.TimeZone`.
|
|
1746
|
+
* Use when you need a schema transformation to accept either an IANA time-zone
|
|
1747
|
+
* identifier or an offset string and produce a general `DateTime.TimeZone`.
|
|
1722
1748
|
*
|
|
1723
1749
|
* **Details**
|
|
1724
1750
|
*
|
|
@@ -1738,7 +1764,7 @@ export const timeZoneFromString: Transformation<DateTime.TimeZone, string> = tra
|
|
|
1738
1764
|
>({
|
|
1739
1765
|
decode: (s) => {
|
|
1740
1766
|
return Option.match(DateTime.zoneFromString(s), {
|
|
1741
|
-
onNone: () => Effect.fail(new
|
|
1767
|
+
onNone: () => Effect.fail(new SchemaIssue.InvalidValue(Option.some(s), { message: `Invalid time zone: ${s}` })),
|
|
1742
1768
|
onSome: Effect.succeed
|
|
1743
1769
|
})
|
|
1744
1770
|
},
|
|
@@ -1751,8 +1777,8 @@ export const timeZoneFromString: Transformation<DateTime.TimeZone, string> = tra
|
|
|
1751
1777
|
*
|
|
1752
1778
|
* **When to use**
|
|
1753
1779
|
*
|
|
1754
|
-
* Use to decode date-time strings
|
|
1755
|
-
* `DateTime.Utc` and encode back as a UTC ISO string.
|
|
1780
|
+
* Use when you need a schema transformation to decode date-time strings to a
|
|
1781
|
+
* normalized `DateTime.Utc` and encode back as a UTC ISO string.
|
|
1756
1782
|
*
|
|
1757
1783
|
* **Details**
|
|
1758
1784
|
*
|
|
@@ -1773,7 +1799,7 @@ export const dateTimeUtcFromString: Transformation<DateTime.Utc, string> = trans
|
|
|
1773
1799
|
decode: (s) => {
|
|
1774
1800
|
return Option.match(DateTime.make(s), {
|
|
1775
1801
|
onNone: () =>
|
|
1776
|
-
Effect.fail(new
|
|
1802
|
+
Effect.fail(new SchemaIssue.InvalidValue(Option.some(s), { message: `Invalid UTC DateTime string: ${s}` })),
|
|
1777
1803
|
onSome: (result) => Effect.succeed(DateTime.toUtc(result))
|
|
1778
1804
|
})
|
|
1779
1805
|
},
|
|
@@ -1786,8 +1812,8 @@ export const dateTimeUtcFromString: Transformation<DateTime.Utc, string> = trans
|
|
|
1786
1812
|
*
|
|
1787
1813
|
* **When to use**
|
|
1788
1814
|
*
|
|
1789
|
-
* Use
|
|
1790
|
-
* decode to `DateTime.Zoned` and encode with `DateTime.formatIsoZoned`.
|
|
1815
|
+
* Use when you need a schema transformation for ISO zoned date-time strings
|
|
1816
|
+
* that decode to `DateTime.Zoned` and encode with `DateTime.formatIsoZoned`.
|
|
1791
1817
|
*
|
|
1792
1818
|
* **Details**
|
|
1793
1819
|
*
|
|
@@ -1807,7 +1833,7 @@ export const dateTimeZonedFromString: Transformation<DateTime.Zoned, string> = t
|
|
|
1807
1833
|
decode: (s) => {
|
|
1808
1834
|
return Option.match(DateTime.makeZonedFromString(s), {
|
|
1809
1835
|
onNone: () =>
|
|
1810
|
-
Effect.fail(new
|
|
1836
|
+
Effect.fail(new SchemaIssue.InvalidValue(Option.some(s), { message: `Invalid Zoned DateTime string: ${s}` })),
|
|
1811
1837
|
onSome: Effect.succeed
|
|
1812
1838
|
})
|
|
1813
1839
|
},
|