effect 4.0.0-beta.4 → 4.0.0-beta.41
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 +213 -385
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +149 -102
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +82 -45
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +87 -38
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts +39 -32
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +32 -29
- package/dist/BigInt.js.map +1 -1
- package/dist/Brand.d.ts +1 -1
- package/dist/Brand.d.ts.map +1 -1
- package/dist/Brand.js +1 -1
- package/dist/Brand.js.map +1 -1
- package/dist/Cache.d.ts +2 -2
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +6 -5
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +33 -2
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Cause.js +19 -0
- package/dist/Cause.js.map +1 -1
- package/dist/Channel.d.ts +130 -35
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +96 -45
- package/dist/Channel.js.map +1 -1
- package/dist/Chunk.d.ts +112 -304
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +56 -88
- package/dist/Chunk.js.map +1 -1
- package/dist/Combiner.d.ts +280 -13
- package/dist/Combiner.d.ts.map +1 -1
- package/dist/Combiner.js +198 -7
- package/dist/Combiner.js.map +1 -1
- package/dist/Config.d.ts +169 -9
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +69 -11
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +1 -1
- package/dist/Cron.d.ts +11 -7
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +120 -63
- package/dist/Cron.js.map +1 -1
- package/dist/Data.d.ts +535 -366
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js +132 -79
- package/dist/Data.js.map +1 -1
- package/dist/DateTime.d.ts +72 -253
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +15 -60
- package/dist/DateTime.js.map +1 -1
- package/dist/Deferred.d.ts +7 -5
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +7 -5
- package/dist/Deferred.js.map +1 -1
- package/dist/Duration.d.ts +62 -32
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +108 -78
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +1225 -951
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +398 -338
- package/dist/Effect.js.map +1 -1
- package/dist/Encoding.d.ts +194 -0
- package/dist/Encoding.d.ts.map +1 -0
- package/dist/Encoding.js +352 -0
- package/dist/Encoding.js.map +1 -0
- package/dist/Equal.d.ts +276 -109
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +124 -48
- package/dist/Equal.js.map +1 -1
- package/dist/Equivalence.d.ts +60 -3
- package/dist/Equivalence.d.ts.map +1 -1
- package/dist/Equivalence.js +70 -13
- package/dist/Equivalence.js.map +1 -1
- package/dist/ErrorReporter.d.ts +374 -0
- package/dist/ErrorReporter.d.ts.map +1 -0
- package/dist/ErrorReporter.js +245 -0
- package/dist/ErrorReporter.js.map +1 -0
- package/dist/Exit.d.ts +24 -12
- package/dist/Exit.d.ts.map +1 -1
- package/dist/Exit.js +8 -4
- package/dist/Exit.js.map +1 -1
- package/dist/Fiber.d.ts +5 -3
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +9 -8
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +8 -7
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +20 -19
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +6 -6
- package/dist/FiberMap.js.map +1 -1
- package/dist/FileSystem.d.ts +18 -17
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +17 -13
- package/dist/FileSystem.js.map +1 -1
- package/dist/Filter.d.ts +34 -38
- package/dist/Filter.d.ts.map +1 -1
- package/dist/Filter.js +15 -13
- package/dist/Filter.js.map +1 -1
- package/dist/Formatter.d.ts +131 -47
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +229 -51
- package/dist/Formatter.js.map +1 -1
- package/dist/Function.d.ts +1 -9
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +2 -10
- package/dist/Function.js.map +1 -1
- package/dist/Graph.d.ts +65 -65
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +60 -62
- package/dist/Graph.js.map +1 -1
- package/dist/HashMap.d.ts +26 -19
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashMap.js +7 -5
- package/dist/HashMap.js.map +1 -1
- package/dist/Iterable.d.ts +50 -50
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +106 -34
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonSchema.d.ts +299 -10
- package/dist/JsonSchema.d.ts.map +1 -1
- package/dist/JsonSchema.js +323 -4
- package/dist/JsonSchema.js.map +1 -1
- package/dist/Latch.d.ts +175 -0
- package/dist/Latch.d.ts.map +1 -0
- package/dist/Latch.js +130 -0
- package/dist/Latch.js.map +1 -0
- package/dist/Layer.d.ts +306 -129
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +93 -48
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +9 -8
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +3 -3
- package/dist/LayerMap.js.map +1 -1
- package/dist/LogLevel.d.ts +32 -0
- package/dist/LogLevel.d.ts.map +1 -1
- package/dist/LogLevel.js +28 -100
- package/dist/LogLevel.js.map +1 -1
- package/dist/Logger.d.ts +29 -95
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +2 -3
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +2 -2
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/ManagedRuntime.js +21 -9
- package/dist/ManagedRuntime.js.map +1 -1
- package/dist/Metric.d.ts +4 -6
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +3 -5
- package/dist/Metric.js.map +1 -1
- package/dist/MutableHashMap.d.ts +7 -0
- package/dist/MutableHashMap.d.ts.map +1 -1
- package/dist/MutableHashMap.js +8 -0
- package/dist/MutableHashMap.js.map +1 -1
- package/dist/MutableHashSet.d.ts +7 -0
- package/dist/MutableHashSet.d.ts.map +1 -1
- package/dist/MutableHashSet.js +8 -0
- package/dist/MutableHashSet.js.map +1 -1
- package/dist/Newtype.d.ts +291 -0
- package/dist/Newtype.d.ts.map +1 -0
- package/dist/Newtype.js +161 -0
- package/dist/Newtype.js.map +1 -0
- package/dist/Number.d.ts +74 -18
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +34 -15
- package/dist/Number.js.map +1 -1
- package/dist/Optic.d.ts +947 -18
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +454 -5
- package/dist/Optic.js.map +1 -1
- package/dist/Option.d.ts +25 -16
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +15 -9
- package/dist/Option.js.map +1 -1
- package/dist/Order.d.ts +6 -1
- package/dist/Order.d.ts.map +1 -1
- package/dist/Order.js +19 -14
- package/dist/Order.js.map +1 -1
- package/dist/PartitionedSemaphore.d.ts +146 -15
- package/dist/PartitionedSemaphore.d.ts.map +1 -1
- package/dist/PartitionedSemaphore.js +174 -61
- package/dist/PartitionedSemaphore.js.map +1 -1
- package/dist/Pipeable.d.ts +17 -0
- package/dist/Pipeable.d.ts.map +1 -1
- package/dist/Pipeable.js +19 -1
- package/dist/Pipeable.js.map +1 -1
- package/dist/PlatformError.d.ts +10 -9
- package/dist/PlatformError.d.ts.map +1 -1
- package/dist/PlatformError.js +2 -2
- package/dist/PlatformError.js.map +1 -1
- package/dist/Pool.d.ts +6 -4
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +7 -5
- package/dist/Pool.js.map +1 -1
- package/dist/PubSub.d.ts +8 -6
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +18 -10
- package/dist/PubSub.js.map +1 -1
- package/dist/Pull.d.ts.map +1 -1
- package/dist/Pull.js +1 -1
- package/dist/Pull.js.map +1 -1
- package/dist/Queue.d.ts +9 -6
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +7 -5
- package/dist/Queue.js.map +1 -1
- package/dist/Random.d.ts +35 -1
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +46 -12
- package/dist/Random.js.map +1 -1
- package/dist/RcMap.d.ts +2 -2
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +1 -1
- package/dist/RcMap.js.map +1 -1
- package/dist/RcRef.d.ts +1 -1
- package/dist/RcRef.d.ts.map +1 -1
- package/dist/Record.d.ts +63 -160
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +37 -56
- package/dist/Record.js.map +1 -1
- package/dist/Reducer.d.ts +166 -7
- package/dist/Reducer.d.ts.map +1 -1
- package/dist/Reducer.js +135 -1
- package/dist/Reducer.js.map +1 -1
- package/dist/References.d.ts +242 -226
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +240 -247
- package/dist/References.js.map +1 -1
- package/dist/Request.d.ts +1 -1
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js +2 -1
- package/dist/Request.js.map +1 -1
- package/dist/RequestResolver.d.ts +25 -45
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +10 -30
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +2 -1
- package/dist/Resource.js.map +1 -1
- package/dist/Result.d.ts +1 -1
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +1 -2
- package/dist/Result.js.map +1 -1
- package/dist/Runtime.d.ts +66 -0
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +79 -6
- package/dist/Runtime.js.map +1 -1
- package/dist/Schedule.d.ts +174 -291
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +160 -134
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts +34 -123
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +31 -123
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +2722 -247
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +1947 -224
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +7 -2
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +131 -25
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +5 -5
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +18 -18
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaParser.d.ts +44 -54
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +55 -2
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +46 -45
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +49 -24
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +107 -3
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +173 -13
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/ScopedCache.d.ts +2 -2
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedCache.js +1 -1
- package/dist/ScopedCache.js.map +1 -1
- package/dist/Semaphore.d.ts +307 -0
- package/dist/Semaphore.d.ts.map +1 -0
- package/dist/Semaphore.js +222 -0
- package/dist/Semaphore.js.map +1 -0
- package/dist/ServiceMap.d.ts +76 -52
- package/dist/ServiceMap.d.ts.map +1 -1
- package/dist/ServiceMap.js +45 -29
- package/dist/ServiceMap.js.map +1 -1
- package/dist/Sink.d.ts +18 -15
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +53 -6
- package/dist/Sink.js.map +1 -1
- package/dist/Stdio.d.ts +16 -4
- package/dist/Stdio.d.ts.map +1 -1
- package/dist/Stdio.js +18 -0
- package/dist/Stdio.js.map +1 -1
- package/dist/Stream.d.ts +284 -431
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +189 -88
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +114 -47
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +29 -47
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts +23 -7
- package/dist/Struct.d.ts.map +1 -1
- package/dist/Struct.js +22 -0
- package/dist/Struct.js.map +1 -1
- package/dist/SubscriptionRef.d.ts +3 -3
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +85 -117
- package/dist/SubscriptionRef.js.map +1 -1
- package/dist/SynchronizedRef.d.ts +2 -1
- package/dist/SynchronizedRef.d.ts.map +1 -1
- package/dist/SynchronizedRef.js +2 -1
- package/dist/SynchronizedRef.js.map +1 -1
- package/dist/Terminal.d.ts +2 -1
- package/dist/Terminal.d.ts.map +1 -1
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +5 -4
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +2 -1
- package/dist/Tracer.js.map +1 -1
- package/dist/Trie.d.ts +44 -31
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js +13 -9
- package/dist/Trie.js.map +1 -1
- package/dist/TxChunk.d.ts +37 -37
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxChunk.js +3 -3
- package/dist/TxChunk.js.map +1 -1
- package/dist/TxDeferred.d.ts +328 -0
- package/dist/TxDeferred.d.ts.map +1 -0
- package/dist/TxDeferred.js +197 -0
- package/dist/TxDeferred.js.map +1 -0
- package/dist/TxHashMap.d.ts +159 -140
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +51 -44
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxHashSet.d.ts +36 -36
- package/dist/TxHashSet.d.ts.map +1 -1
- package/dist/TxHashSet.js +16 -15
- package/dist/TxHashSet.js.map +1 -1
- package/dist/TxPriorityQueue.d.ts +609 -0
- package/dist/TxPriorityQueue.d.ts.map +1 -0
- package/dist/TxPriorityQueue.js +416 -0
- package/dist/TxPriorityQueue.js.map +1 -0
- package/dist/TxPubSub.d.ts +585 -0
- package/dist/TxPubSub.d.ts.map +1 -0
- package/dist/TxPubSub.js +521 -0
- package/dist/TxPubSub.js.map +1 -0
- package/dist/TxQueue.d.ts +32 -32
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxQueue.js +26 -26
- package/dist/TxQueue.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +523 -0
- package/dist/TxReentrantLock.d.ts.map +1 -0
- package/dist/TxReentrantLock.js +504 -0
- package/dist/TxReentrantLock.js.map +1 -0
- package/dist/TxRef.d.ts +34 -34
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +21 -14
- package/dist/TxRef.js.map +1 -1
- package/dist/TxSemaphore.d.ts +170 -10
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +23 -8
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/TxSubscriptionRef.d.ts +508 -0
- package/dist/TxSubscriptionRef.d.ts.map +1 -0
- package/dist/TxSubscriptionRef.js +293 -0
- package/dist/TxSubscriptionRef.js.map +1 -0
- package/dist/Types.d.ts +80 -23
- package/dist/Types.d.ts.map +1 -1
- package/dist/Utils.d.ts +137 -65
- package/dist/Utils.d.ts.map +1 -1
- package/dist/Utils.js +38 -66
- package/dist/Utils.js.map +1 -1
- package/dist/index.d.ts +806 -55
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +806 -55
- package/dist/index.js.map +1 -1
- package/dist/internal/core.js +11 -3
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/dateTime.js +77 -71
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/effect.js +284 -201
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/hashMap.js +7 -5
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/option.js +6 -0
- package/dist/internal/option.js.map +1 -1
- package/dist/internal/random.d.ts +2 -0
- package/dist/internal/random.d.ts.map +1 -0
- package/dist/internal/random.js +13 -0
- package/dist/internal/random.js.map +1 -0
- package/dist/internal/rcRef.js +3 -2
- package/dist/internal/rcRef.js.map +1 -1
- package/dist/internal/references.d.ts +2 -0
- package/dist/internal/references.d.ts.map +1 -0
- package/dist/internal/references.js +51 -0
- package/dist/internal/references.js.map +1 -0
- package/dist/internal/request.js +2 -2
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/schema/annotations.js +2 -0
- package/dist/internal/schema/annotations.js.map +1 -1
- package/dist/internal/schema/representation.js +75 -106
- package/dist/internal/schema/representation.js.map +1 -1
- package/dist/internal/schema/schema.js +1 -0
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/internal/schema/to-codec.js +7 -10
- package/dist/internal/schema/to-codec.js.map +1 -1
- package/dist/internal/trie.js +8 -7
- package/dist/internal/trie.js.map +1 -1
- package/dist/testing/TestClock.d.ts +8 -7
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestClock.js +6 -4
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +266 -32
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/testing/TestSchema.js +296 -23
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/testing/index.d.ts +64 -1
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +64 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +136 -54
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +28 -23
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +4 -0
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +35 -7
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +38 -44
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.d.ts +130 -0
- package/dist/unstable/ai/EmbeddingModel.d.ts.map +1 -0
- package/dist/unstable/ai/EmbeddingModel.js +127 -0
- package/dist/unstable/ai/EmbeddingModel.js.map +1 -0
- package/dist/unstable/ai/LanguageModel.d.ts +117 -47
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +258 -59
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +183 -88
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +57 -12
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +66 -13
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +193 -51
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Model.d.ts +25 -7
- package/dist/unstable/ai/Model.d.ts.map +1 -1
- package/dist/unstable/ai/Model.js +22 -6
- package/dist/unstable/ai/Model.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +4 -0
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Prompt.d.ts +20 -20
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Response.d.ts +26 -26
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js +1 -1
- package/dist/unstable/ai/Response.js.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.d.ts +38 -0
- package/dist/unstable/ai/ResponseIdTracker.d.ts.map +1 -0
- package/dist/unstable/ai/ResponseIdTracker.js +68 -0
- package/dist/unstable/ai/ResponseIdTracker.js.map +1 -0
- package/dist/unstable/ai/Tool.d.ts +34 -4
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +28 -10
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +1 -1
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +4 -11
- package/dist/unstable/ai/Toolkit.js.map +1 -1
- package/dist/unstable/ai/index.d.ts +22 -1
- package/dist/unstable/ai/index.d.ts.map +1 -1
- package/dist/unstable/ai/index.js +22 -1
- package/dist/unstable/ai/index.js.map +1 -1
- package/dist/unstable/ai/internal/codec-transformer.js +0 -5
- package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
- package/dist/unstable/cli/Argument.d.ts +2 -4
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js +1 -3
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +27 -60
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +25 -57
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/CliOutput.d.ts +3 -2
- package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
- package/dist/unstable/cli/CliOutput.js +65 -10
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +371 -58
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +328 -67
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Completions.d.ts +16 -0
- package/dist/unstable/cli/Completions.d.ts.map +1 -0
- package/dist/unstable/cli/Completions.js +23 -0
- package/dist/unstable/cli/Completions.js.map +1 -0
- package/dist/unstable/cli/Flag.d.ts +2 -2
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +1 -1
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +125 -0
- package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -0
- package/dist/unstable/cli/GlobalFlag.js +118 -0
- package/dist/unstable/cli/GlobalFlag.js.map +1 -0
- package/dist/unstable/cli/HelpDoc.d.ts +81 -11
- package/dist/unstable/cli/HelpDoc.d.ts.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 +7 -7
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +2 -2
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js +1 -1
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/Prompt.js +259 -85
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/index.d.ts +8 -0
- package/dist/unstable/cli/index.d.ts.map +1 -1
- package/dist/unstable/cli/index.js +8 -0
- package/dist/unstable/cli/index.js.map +1 -1
- package/dist/unstable/cli/internal/command.d.ts +40 -14
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +72 -46
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/completions/CommandDescriptor.js +16 -4
- package/dist/unstable/cli/internal/completions/CommandDescriptor.js.map +1 -1
- package/dist/unstable/cli/internal/config.js +42 -0
- package/dist/unstable/cli/internal/config.js.map +1 -1
- package/dist/unstable/cli/internal/help.d.ts +33 -0
- package/dist/unstable/cli/internal/help.d.ts.map +1 -0
- package/dist/unstable/cli/internal/help.js +125 -0
- package/dist/unstable/cli/internal/help.js.map +1 -0
- package/dist/unstable/cli/internal/parser.js +61 -43
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cluster/ClusterCron.d.ts +1 -1
- package/dist/unstable/cluster/ClusterCron.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterCron.js +1 -1
- package/dist/unstable/cluster/ClusterCron.js.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.d.ts +18 -0
- package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.js +21 -1
- package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +3 -2
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +35 -29
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/DeliverAt.js +1 -1
- package/dist/unstable/cluster/DeliverAt.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +10 -8
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +8 -7
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/EntityAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityAddress.js +1 -1
- package/dist/unstable/cluster/EntityAddress.js.map +1 -1
- package/dist/unstable/cluster/EntityResource.d.ts +2 -2
- package/dist/unstable/cluster/EntityResource.d.ts.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts +1 -1
- package/dist/unstable/cluster/K8sHttpClient.d.ts +1 -1
- package/dist/unstable/cluster/K8sHttpClient.js +4 -4
- package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +18 -15
- package/dist/unstable/cluster/Message.d.ts.map +1 -1
- package/dist/unstable/cluster/Message.js +15 -7
- package/dist/unstable/cluster/Message.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +33 -10
- package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/MessageStorage.js +36 -20
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts +8 -7
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +4 -3
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/Runner.d.ts +1 -1
- package/dist/unstable/cluster/Runner.d.ts.map +1 -1
- package/dist/unstable/cluster/Runner.js +1 -1
- package/dist/unstable/cluster/Runner.js.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.js +1 -1
- package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +9 -8
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +2 -1
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +11 -9
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/ShardId.js +3 -3
- package/dist/unstable/cluster/ShardId.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts +2 -2
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +51 -39
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +26 -25
- package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.js +24 -24
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +25 -19
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +24 -18
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/cluster/internal/entityReaper.js +2 -1
- package/dist/unstable/cluster/internal/entityReaper.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceRef.js +2 -1
- package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.js +4 -3
- package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.d.ts +40 -40
- package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js +9 -2
- package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
- package/dist/unstable/encoding/Msgpack.d.ts +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts +9 -9
- package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
- package/dist/unstable/encoding/Ndjson.js.map +1 -1
- package/dist/unstable/encoding/Sse.d.ts +4 -4
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.js +1 -1
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +2 -2
- package/dist/unstable/eventlog/EventJournal.js +2 -2
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLog.js +3 -2
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +6 -6
- package/dist/unstable/eventlog/SqlEventLogJournal.js +2 -2
- package/dist/unstable/eventlog/SqlEventLogJournal.js.map +1 -1
- package/dist/unstable/http/Cookies.d.ts +52 -7
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +27 -6
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Etag.d.ts.map +1 -1
- package/dist/unstable/http/Etag.js +5 -1
- package/dist/unstable/http/Etag.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts +19 -2
- package/dist/unstable/http/Headers.d.ts.map +1 -1
- package/dist/unstable/http/Headers.js +40 -11
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpBody.d.ts +1 -1
- package/dist/unstable/http/HttpClient.d.ts +117 -15
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +191 -13
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientError.d.ts +7 -7
- package/dist/unstable/http/HttpClientRequest.d.ts +43 -15
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +131 -21
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts +2 -1
- package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientResponse.js +6 -1
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts +7 -5
- package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
- package/dist/unstable/http/HttpEffect.js +46 -54
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.d.ts +3 -2
- package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMethod.d.ts +4 -4
- package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
- package/dist/unstable/http/HttpMethod.js +3 -3
- package/dist/unstable/http/HttpMethod.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts +1 -6
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +24 -32
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
- package/dist/unstable/http/HttpPlatform.js +3 -2
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +2 -1
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +7 -7
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpServer.js +2 -2
- package/dist/unstable/http/HttpServer.js.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +22 -34
- package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerError.js +39 -45
- package/dist/unstable/http/HttpServerError.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +15 -3
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +301 -7
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.d.ts +2 -2
- package/dist/unstable/http/HttpServerRespondable.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.js +5 -5
- package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +50 -3
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +236 -1
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpStaticServer.d.ts +69 -0
- package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -0
- package/dist/unstable/http/HttpStaticServer.js +353 -0
- package/dist/unstable/http/HttpStaticServer.js.map +1 -0
- package/dist/unstable/http/HttpTraceContext.d.ts +3 -2
- package/dist/unstable/http/HttpTraceContext.d.ts.map +1 -1
- package/dist/unstable/http/HttpTraceContext.js +27 -15
- package/dist/unstable/http/HttpTraceContext.js.map +1 -1
- package/dist/unstable/http/Multipart.d.ts +3 -3
- package/dist/unstable/http/Url.d.ts +604 -0
- package/dist/unstable/http/Url.d.ts.map +1 -0
- package/dist/unstable/http/Url.js +256 -0
- package/dist/unstable/http/Url.js.map +1 -0
- package/dist/unstable/http/UrlParams.d.ts +19 -10
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +6 -7
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/http/index.d.ts +8 -0
- package/dist/unstable/http/index.d.ts.map +1 -1
- package/dist/unstable/http/index.js +8 -0
- package/dist/unstable/http/index.js.map +1 -1
- package/dist/unstable/http/internal/preResponseHandler.d.ts +2 -0
- package/dist/unstable/http/internal/preResponseHandler.d.ts.map +1 -0
- package/dist/unstable/http/internal/preResponseHandler.js +10 -0
- package/dist/unstable/http/internal/preResponseHandler.js.map +1 -0
- package/dist/unstable/httpapi/HttpApi.d.ts +4 -4
- package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +11 -5
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +40 -27
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +83 -7
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +78 -10
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +207 -101
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.js +49 -43
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +31 -14
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.js +125 -32
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.d.ts +4 -3
- package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +46 -15
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js +32 -3
- package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts +6 -0
- package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +6 -3
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.js +20 -2
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts +2 -2
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts +1 -0
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +34 -26
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/observability/Otlp.d.ts +12 -12
- package/dist/unstable/observability/Otlp.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts +2 -2
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +3 -3
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.d.ts +4 -4
- package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js +7 -4
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts +4 -4
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.d.ts +4 -4
- package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js +7 -3
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +1 -1
- package/dist/unstable/persistence/KeyValueStore.js +6 -6
- package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
- package/dist/unstable/persistence/Persistable.d.ts +2 -2
- package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistable.js +1 -1
- package/dist/unstable/persistence/Persistable.js.map +1 -1
- package/dist/unstable/persistence/PersistedCache.d.ts +6 -5
- package/dist/unstable/persistence/PersistedCache.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedCache.js +2 -1
- package/dist/unstable/persistence/PersistedCache.js.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts +12 -12
- package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.js +12 -11
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/Persistence.d.ts +1 -1
- package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistence.js +2 -2
- package/dist/unstable/persistence/Persistence.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +3 -3
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +1 -1
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/process/ChildProcess.d.ts +5 -128
- package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcess.js +1 -65
- package/dist/unstable/process/ChildProcess.js.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.d.ts +45 -7
- package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js +21 -1
- package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +73 -12
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +108 -25
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +17 -15
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.js +45 -15
- package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.d.ts +6 -0
- package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +54 -11
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts +9 -9
- package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.js +47 -21
- package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
- package/dist/unstable/reactivity/Hydration.d.ts +39 -0
- package/dist/unstable/reactivity/Hydration.d.ts.map +1 -0
- package/dist/unstable/reactivity/Hydration.js +76 -0
- package/dist/unstable/reactivity/Hydration.js.map +1 -0
- package/dist/unstable/reactivity/index.d.ts +4 -0
- package/dist/unstable/reactivity/index.d.ts.map +1 -1
- package/dist/unstable/reactivity/index.js +4 -0
- package/dist/unstable/reactivity/index.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +6 -5
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js +4 -3
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts +5 -26
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +53 -43
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcGroup.d.ts +3 -5
- package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcGroup.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts +8 -8
- package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts +13 -0
- package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSchema.js +17 -2
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +39 -11
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +6 -10
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +20 -19
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/rpc/Utils.d.ts.map +1 -1
- package/dist/unstable/rpc/Utils.js +3 -2
- package/dist/unstable/rpc/Utils.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts +22 -1
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js +15 -0
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +6 -6
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.js +6 -6
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +6 -5
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +12 -9
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/socket/SocketServer.d.ts +3 -3
- package/dist/unstable/sql/Migrator.d.ts +1 -1
- package/dist/unstable/sql/Migrator.d.ts.map +1 -1
- package/dist/unstable/sql/Migrator.js +2 -2
- package/dist/unstable/sql/Migrator.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts +1 -1
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +1 -1
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/sql/SqlError.d.ts +237 -17
- package/dist/unstable/sql/SqlError.d.ts.map +1 -1
- package/dist/unstable/sql/SqlError.js +260 -4
- package/dist/unstable/sql/SqlError.js.map +1 -1
- package/dist/unstable/sql/SqlModel.d.ts +2 -2
- package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
- package/dist/unstable/sql/SqlModel.js +3 -3
- package/dist/unstable/sql/SqlModel.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
- package/dist/unstable/sql/SqlResolver.js +17 -8
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/sql/SqlSchema.d.ts +17 -6
- package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
- package/dist/unstable/sql/SqlSchema.js +17 -7
- package/dist/unstable/sql/SqlSchema.js.map +1 -1
- package/dist/unstable/sql/Statement.js +0 -1
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/workers/Worker.d.ts.map +1 -1
- package/dist/unstable/workers/Worker.js +2 -1
- package/dist/unstable/workers/Worker.js.map +1 -1
- package/dist/unstable/workflow/Activity.d.ts +5 -0
- package/dist/unstable/workflow/Activity.d.ts.map +1 -1
- package/dist/unstable/workflow/Activity.js +13 -0
- package/dist/unstable/workflow/Activity.js.map +1 -1
- package/dist/unstable/workflow/DurableClock.d.ts +3 -3
- package/dist/unstable/workflow/DurableClock.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableClock.js +3 -3
- package/dist/unstable/workflow/DurableClock.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.js +8 -8
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +5 -4
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js +1 -1
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +17 -5
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +153 -12
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/package.json +2 -2
- package/src/Array.ts +304 -447
- package/src/BigDecimal.ts +117 -66
- package/src/BigInt.ts +49 -41
- package/src/Brand.ts +1 -1
- package/src/Cache.ts +9 -8
- package/src/Cause.ts +37 -2
- package/src/Channel.ts +582 -154
- package/src/Chunk.ts +149 -331
- package/src/Combiner.ts +280 -13
- package/src/Config.ts +195 -25
- package/src/Cron.ts +155 -63
- package/src/Data.ts +539 -376
- package/src/DateTime.ts +75 -256
- package/src/Deferred.ts +8 -6
- package/src/Duration.ts +122 -66
- package/src/Effect.ts +1484 -1157
- package/src/Encoding.ts +879 -0
- package/src/Equal.ts +278 -111
- package/src/Equivalence.ts +114 -52
- package/src/ErrorReporter.ts +458 -0
- package/src/Exit.ts +24 -12
- package/src/Fiber.ts +12 -3
- package/src/FiberHandle.ts +10 -9
- package/src/FiberMap.ts +22 -22
- package/src/FileSystem.ts +34 -31
- package/src/Filter.ts +52 -63
- package/src/Formatter.ts +253 -51
- package/src/Function.ts +2 -10
- package/src/Graph.ts +131 -117
- package/src/HashMap.ts +26 -19
- package/src/Iterable.ts +117 -63
- package/src/JsonSchema.ts +383 -10
- package/src/Latch.ts +194 -0
- package/src/Layer.ts +394 -160
- package/src/LayerMap.ts +11 -9
- package/src/LogLevel.ts +37 -0
- package/src/Logger.ts +33 -100
- package/src/ManagedRuntime.ts +35 -22
- package/src/Metric.ts +6 -8
- package/src/MutableHashMap.ts +9 -0
- package/src/MutableHashSet.ts +9 -0
- package/src/Newtype.ts +308 -0
- package/src/Number.ts +85 -26
- package/src/Optic.ts +948 -19
- package/src/Option.ts +34 -24
- package/src/Order.ts +39 -32
- package/src/PartitionedSemaphore.ts +288 -56
- package/src/Pipeable.ts +32 -1
- package/src/PlatformError.ts +5 -5
- package/src/Pool.ts +13 -11
- package/src/PubSub.ts +30 -20
- package/src/Pull.ts +1 -1
- package/src/Queue.ts +11 -9
- package/src/Random.ts +51 -14
- package/src/RcMap.ts +5 -5
- package/src/RcRef.ts +1 -1
- package/src/Record.ts +94 -199
- package/src/Reducer.ts +166 -7
- package/src/References.ts +283 -287
- package/src/Request.ts +3 -2
- package/src/RequestResolver.ts +29 -49
- package/src/Resource.ts +2 -1
- package/src/Result.ts +2 -4
- package/src/Runtime.ts +102 -6
- package/src/Schedule.ts +458 -449
- package/src/Scheduler.ts +49 -126
- package/src/Schema.ts +3298 -392
- package/src/SchemaAST.ts +172 -33
- package/src/SchemaGetter.ts +19 -21
- package/src/SchemaParser.ts +92 -27
- package/src/SchemaRepresentation.ts +51 -26
- package/src/SchemaTransformation.ts +198 -13
- package/src/ScopedCache.ts +3 -3
- package/src/Semaphore.ts +444 -0
- package/src/ServiceMap.ts +144 -97
- package/src/Sink.ts +83 -28
- package/src/Stdio.ts +27 -4
- package/src/Stream.ts +687 -617
- package/src/String.ts +122 -69
- package/src/Struct.ts +33 -7
- package/src/SubscriptionRef.ts +101 -120
- package/src/SynchronizedRef.ts +3 -2
- package/src/Terminal.ts +2 -1
- package/src/Tracer.ts +6 -5
- package/src/Trie.ts +44 -31
- package/src/TxChunk.ts +72 -53
- package/src/TxDeferred.ts +394 -0
- package/src/TxHashMap.ts +409 -343
- package/src/TxHashSet.ts +113 -118
- package/src/TxPriorityQueue.ts +766 -0
- package/src/TxPubSub.ts +789 -0
- package/src/TxQueue.ts +241 -251
- package/src/TxReentrantLock.ts +753 -0
- package/src/TxRef.ts +50 -38
- package/src/TxSemaphore.ts +217 -44
- package/src/TxSubscriptionRef.ts +639 -0
- package/src/Types.ts +73 -19
- package/src/Utils.ts +137 -111
- package/src/index.ts +816 -56
- package/src/internal/core.ts +12 -5
- package/src/internal/dateTime.ts +91 -96
- package/src/internal/effect.ts +844 -432
- package/src/internal/hashMap.ts +12 -10
- package/src/internal/option.ts +7 -0
- package/src/internal/random.ts +20 -0
- package/src/internal/rcRef.ts +4 -3
- package/src/internal/references.ts +72 -0
- package/src/internal/request.ts +2 -2
- package/src/internal/schema/annotations.ts +2 -0
- package/src/internal/schema/representation.ts +73 -94
- package/src/internal/schema/schema.ts +1 -0
- package/src/internal/schema/to-codec.ts +7 -17
- package/src/internal/trie.ts +21 -15
- package/src/testing/TestClock.ts +13 -11
- package/src/testing/TestSchema.ts +332 -35
- package/src/testing/index.ts +64 -1
- package/src/unstable/ai/AiError.ts +111 -54
- package/src/unstable/ai/AnthropicStructuredOutput.ts +4 -0
- package/src/unstable/ai/Chat.ts +134 -85
- package/src/unstable/ai/EmbeddingModel.ts +209 -0
- package/src/unstable/ai/LanguageModel.ts +683 -253
- package/src/unstable/ai/McpSchema.ts +73 -13
- package/src/unstable/ai/McpServer.ts +271 -61
- package/src/unstable/ai/Model.ts +40 -9
- package/src/unstable/ai/OpenAiStructuredOutput.ts +4 -0
- package/src/unstable/ai/Prompt.ts +37 -37
- package/src/unstable/ai/Response.ts +25 -25
- package/src/unstable/ai/ResponseIdTracker.ts +97 -0
- package/src/unstable/ai/Tool.ts +42 -16
- package/src/unstable/ai/Toolkit.ts +5 -14
- package/src/unstable/ai/index.ts +24 -1
- package/src/unstable/ai/internal/codec-transformer.ts +0 -7
- package/src/unstable/cli/Argument.ts +2 -4
- package/src/unstable/cli/CliError.ts +47 -59
- package/src/unstable/cli/CliOutput.ts +85 -13
- package/src/unstable/cli/Command.ts +801 -192
- package/src/unstable/cli/Completions.ts +36 -0
- package/src/unstable/cli/Flag.ts +2 -2
- package/src/unstable/cli/GlobalFlag.ts +242 -0
- package/src/unstable/cli/HelpDoc.ts +91 -11
- package/src/unstable/cli/Param.ts +15 -11
- package/src/unstable/cli/Primitive.ts +2 -2
- package/src/unstable/cli/Prompt.ts +265 -101
- package/src/unstable/cli/index.ts +10 -0
- package/src/unstable/cli/internal/command.ts +109 -63
- package/src/unstable/cli/internal/completions/CommandDescriptor.ts +10 -4
- package/src/unstable/cli/internal/config.ts +49 -0
- package/src/unstable/cli/internal/help.ts +171 -0
- package/src/unstable/cli/internal/parser.ts +71 -63
- package/src/unstable/cluster/ClusterCron.ts +2 -2
- package/src/unstable/cluster/ClusterSchema.ts +29 -1
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +62 -37
- package/src/unstable/cluster/DeliverAt.ts +1 -1
- package/src/unstable/cluster/Entity.ts +25 -22
- package/src/unstable/cluster/EntityAddress.ts +1 -1
- package/src/unstable/cluster/EntityResource.ts +4 -4
- package/src/unstable/cluster/Envelope.ts +1 -1
- package/src/unstable/cluster/K8sHttpClient.ts +5 -5
- package/src/unstable/cluster/Message.ts +28 -15
- package/src/unstable/cluster/MessageStorage.ts +66 -36
- package/src/unstable/cluster/Reply.ts +7 -4
- package/src/unstable/cluster/Runner.ts +1 -1
- package/src/unstable/cluster/RunnerAddress.ts +1 -1
- package/src/unstable/cluster/RunnerServer.ts +10 -13
- package/src/unstable/cluster/Runners.ts +14 -12
- package/src/unstable/cluster/ShardId.ts +2 -2
- package/src/unstable/cluster/Sharding.ts +66 -49
- package/src/unstable/cluster/ShardingConfig.ts +36 -37
- package/src/unstable/cluster/SqlMessageStorage.ts +31 -19
- package/src/unstable/cluster/SqlRunnerStorage.ts +1 -1
- package/src/unstable/cluster/internal/entityManager.ts +50 -34
- package/src/unstable/cluster/internal/entityReaper.ts +2 -1
- package/src/unstable/cluster/internal/resourceRef.ts +2 -1
- package/src/unstable/devtools/DevToolsClient.ts +23 -18
- package/src/unstable/devtools/DevToolsSchema.ts +16 -3
- package/src/unstable/encoding/Ndjson.ts +17 -17
- package/src/unstable/encoding/Sse.ts +3 -5
- package/src/unstable/eventlog/EventJournal.ts +2 -2
- package/src/unstable/eventlog/EventLog.ts +3 -2
- package/src/unstable/eventlog/SqlEventLogJournal.ts +2 -2
- package/src/unstable/http/Cookies.ts +94 -11
- package/src/unstable/http/Etag.ts +5 -3
- package/src/unstable/http/Headers.ts +68 -18
- package/src/unstable/http/HttpClient.ts +376 -34
- package/src/unstable/http/HttpClientRequest.ts +151 -39
- package/src/unstable/http/HttpClientResponse.ts +12 -6
- package/src/unstable/http/HttpEffect.ts +54 -68
- package/src/unstable/http/HttpIncomingMessage.ts +3 -2
- package/src/unstable/http/HttpMethod.ts +16 -4
- package/src/unstable/http/HttpMiddleware.ts +25 -39
- package/src/unstable/http/HttpPlatform.ts +3 -2
- package/src/unstable/http/HttpRouter.ts +9 -9
- package/src/unstable/http/HttpServer.ts +3 -9
- package/src/unstable/http/HttpServerError.ts +45 -47
- package/src/unstable/http/HttpServerRequest.ts +407 -16
- package/src/unstable/http/HttpServerRespondable.ts +6 -6
- package/src/unstable/http/HttpServerResponse.ts +345 -7
- package/src/unstable/http/HttpStaticServer.ts +456 -0
- package/src/unstable/http/HttpTraceContext.ts +31 -17
- package/src/unstable/http/Multipart.ts +2 -2
- package/src/unstable/http/Url.ts +650 -0
- package/src/unstable/http/UrlParams.ts +31 -19
- package/src/unstable/http/index.ts +10 -0
- package/src/unstable/http/internal/preResponseHandler.ts +15 -0
- package/src/unstable/httpapi/HttpApi.ts +6 -6
- package/src/unstable/httpapi/HttpApiBuilder.ts +106 -41
- package/src/unstable/httpapi/HttpApiClient.ts +180 -28
- package/src/unstable/httpapi/HttpApiEndpoint.ts +216 -104
- package/src/unstable/httpapi/HttpApiError.ts +108 -30
- package/src/unstable/httpapi/HttpApiGroup.ts +7 -6
- package/src/unstable/httpapi/HttpApiMiddleware.ts +83 -22
- package/src/unstable/httpapi/HttpApiScalar.ts +6 -0
- package/src/unstable/httpapi/HttpApiSchema.ts +21 -3
- package/src/unstable/httpapi/HttpApiSecurity.ts +3 -3
- package/src/unstable/httpapi/OpenApi.ts +44 -29
- package/src/unstable/observability/Otlp.ts +12 -12
- package/src/unstable/observability/OtlpExporter.ts +8 -5
- package/src/unstable/observability/OtlpLogger.ts +13 -9
- package/src/unstable/observability/OtlpMetrics.ts +4 -4
- package/src/unstable/observability/OtlpTracer.ts +12 -8
- package/src/unstable/persistence/KeyValueStore.ts +6 -6
- package/src/unstable/persistence/Persistable.ts +3 -3
- package/src/unstable/persistence/PersistedCache.ts +20 -9
- package/src/unstable/persistence/PersistedQueue.ts +25 -24
- package/src/unstable/persistence/Persistence.ts +3 -3
- package/src/unstable/persistence/RateLimiter.ts +4 -4
- package/src/unstable/process/ChildProcess.ts +6 -208
- package/src/unstable/process/ChildProcessSpawner.ts +75 -14
- package/src/unstable/reactivity/Atom.ts +212 -54
- package/src/unstable/reactivity/AtomHttpApi.ts +81 -41
- package/src/unstable/reactivity/AtomRegistry.ts +66 -12
- package/src/unstable/reactivity/AtomRpc.ts +51 -20
- package/src/unstable/reactivity/Hydration.ts +112 -0
- package/src/unstable/reactivity/index.ts +5 -0
- package/src/unstable/rpc/Rpc.ts +12 -12
- package/src/unstable/rpc/RpcClient.ts +67 -96
- package/src/unstable/rpc/RpcGroup.ts +7 -7
- package/src/unstable/rpc/RpcMiddleware.ts +15 -9
- package/src/unstable/rpc/RpcSchema.ts +23 -5
- package/src/unstable/rpc/RpcSerialization.ts +49 -11
- package/src/unstable/rpc/RpcServer.ts +31 -35
- package/src/unstable/rpc/Utils.ts +3 -2
- package/src/unstable/schema/Model.ts +31 -0
- package/src/unstable/schema/VariantSchema.ts +10 -10
- package/src/unstable/socket/Socket.ts +31 -27
- package/src/unstable/sql/Migrator.ts +7 -5
- package/src/unstable/sql/SqlClient.ts +6 -4
- package/src/unstable/sql/SqlError.ts +365 -11
- package/src/unstable/sql/SqlModel.ts +5 -5
- package/src/unstable/sql/SqlResolver.ts +17 -7
- package/src/unstable/sql/SqlSchema.ts +42 -26
- package/src/unstable/sql/Statement.ts +0 -1
- package/src/unstable/workers/Worker.ts +2 -1
- package/src/unstable/workflow/Activity.ts +23 -0
- package/src/unstable/workflow/DurableClock.ts +8 -8
- package/src/unstable/workflow/DurableDeferred.ts +8 -8
- package/src/unstable/workflow/Workflow.ts +7 -3
- package/src/unstable/workflow/WorkflowEngine.ts +211 -19
- package/dist/NullOr.d.ts +0 -149
- package/dist/NullOr.d.ts.map +0 -1
- package/dist/NullOr.js +0 -152
- package/dist/NullOr.js.map +0 -1
- package/dist/encoding/Base64.d.ts +0 -67
- package/dist/encoding/Base64.d.ts.map +0 -1
- package/dist/encoding/Base64.js +0 -146
- package/dist/encoding/Base64.js.map +0 -1
- package/dist/encoding/Base64Url.d.ts +0 -60
- package/dist/encoding/Base64Url.d.ts.map +0 -1
- package/dist/encoding/Base64Url.js +0 -89
- package/dist/encoding/Base64Url.js.map +0 -1
- package/dist/encoding/EncodingError.d.ts +0 -31
- package/dist/encoding/EncodingError.d.ts.map +0 -1
- package/dist/encoding/EncodingError.js +0 -22
- package/dist/encoding/EncodingError.js.map +0 -1
- package/dist/encoding/Hex.d.ts +0 -61
- package/dist/encoding/Hex.d.ts.map +0 -1
- package/dist/encoding/Hex.js +0 -115
- package/dist/encoding/Hex.js.map +0 -1
- package/dist/encoding/index.d.ts +0 -26
- package/dist/encoding/index.d.ts.map +0 -1
- package/dist/encoding/index.js +0 -27
- package/dist/encoding/index.js.map +0 -1
- package/dist/unstable/cli/internal/builtInFlags.d.ts +0 -7
- package/dist/unstable/cli/internal/builtInFlags.d.ts.map +0 -1
- package/dist/unstable/cli/internal/builtInFlags.js +0 -44
- package/dist/unstable/cli/internal/builtInFlags.js.map +0 -1
- package/dist/unstable/cli/internal/completions/Completions.d.ts +0 -2
- package/dist/unstable/cli/internal/completions/Completions.d.ts.map +0 -1
- package/dist/unstable/cli/internal/completions/Completions.js +0 -23
- package/dist/unstable/cli/internal/completions/Completions.js.map +0 -1
- package/src/NullOr.ts +0 -204
- package/src/encoding/Base64.ts +0 -366
- package/src/encoding/Base64Url.ts +0 -104
- package/src/encoding/EncodingError.ts +0 -35
- package/src/encoding/Hex.ts +0 -390
- package/src/encoding/index.ts +0 -31
- package/src/unstable/cli/internal/builtInFlags.ts +0 -78
- package/src/unstable/cli/internal/completions/Completions.ts +0 -31
package/dist/Effect.js
CHANGED
|
@@ -35,7 +35,7 @@ export class YieldableClass {
|
|
|
35
35
|
* @since 2.0.0
|
|
36
36
|
* @category Guards
|
|
37
37
|
*/
|
|
38
|
-
export const isEffect =
|
|
38
|
+
export const isEffect = core.isEffect;
|
|
39
39
|
/**
|
|
40
40
|
* Combines multiple effects into one, returning results based on the input
|
|
41
41
|
* structure.
|
|
@@ -181,7 +181,6 @@ export const isEffect = u => typeof u === "object" && u !== null && TypeId in u;
|
|
|
181
181
|
* ```
|
|
182
182
|
*
|
|
183
183
|
* @see {@link forEach} for iterating over elements and applying an effect.
|
|
184
|
-
* @see {@link allWith} for a data-last version of this function.
|
|
185
184
|
*
|
|
186
185
|
* @since 2.0.0
|
|
187
186
|
* @category Collecting
|
|
@@ -215,6 +214,72 @@ export const all = internal.all;
|
|
|
215
214
|
* @category Collecting
|
|
216
215
|
*/
|
|
217
216
|
export const partition = internal.partition;
|
|
217
|
+
/**
|
|
218
|
+
* Applies an effectful function to each element and accumulates all failures.
|
|
219
|
+
*
|
|
220
|
+
* This function always evaluates every element. If at least one effect fails,
|
|
221
|
+
* all failures are returned as a non-empty array and successes are discarded.
|
|
222
|
+
* If all effects succeed, it returns all collected successes.
|
|
223
|
+
*
|
|
224
|
+
* Use `discard: true` to ignore successful values while still validating all
|
|
225
|
+
* elements.
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* ```ts
|
|
229
|
+
* import { Effect } from "effect"
|
|
230
|
+
*
|
|
231
|
+
* const program = Effect.validate([0, 1, 2, 3], (n) =>
|
|
232
|
+
* n % 2 === 0 ? Effect.fail(`${n} is even`) : Effect.succeed(n)
|
|
233
|
+
* )
|
|
234
|
+
*
|
|
235
|
+
* Effect.runPromiseExit(program).then(console.log)
|
|
236
|
+
* // {
|
|
237
|
+
* // _id: 'Exit',
|
|
238
|
+
* // _tag: 'Failure',
|
|
239
|
+
* // cause: {
|
|
240
|
+
* // _id: 'Cause',
|
|
241
|
+
* // reasons: [
|
|
242
|
+
* // { _id: 'Reason', _tag: 'Fail', error: '0 is even' },
|
|
243
|
+
* // { _id: 'Reason', _tag: 'Fail', error: '2 is even' }
|
|
244
|
+
* // ]
|
|
245
|
+
* // }
|
|
246
|
+
* // }
|
|
247
|
+
* ```
|
|
248
|
+
*
|
|
249
|
+
* @since 4.0.0
|
|
250
|
+
* @category Error Accumulation
|
|
251
|
+
*/
|
|
252
|
+
export const validate = internal.validate;
|
|
253
|
+
/**
|
|
254
|
+
* Returns the first element that satisfies an effectful predicate.
|
|
255
|
+
*
|
|
256
|
+
* The predicate receives the element and its index. Evaluation short-circuits
|
|
257
|
+
* as soon as an element matches.
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* ```ts
|
|
261
|
+
* import { Effect } from "effect"
|
|
262
|
+
*
|
|
263
|
+
* const program = Effect.findFirst([1, 2, 3, 4], (n) => Effect.succeed(n > 2))
|
|
264
|
+
*
|
|
265
|
+
* Effect.runPromise(program).then(console.log)
|
|
266
|
+
* // { _id: 'Option', _tag: 'Some', value: 3 }
|
|
267
|
+
* ```
|
|
268
|
+
*
|
|
269
|
+
* @since 2.0.0
|
|
270
|
+
* @category Collecting
|
|
271
|
+
*/
|
|
272
|
+
export const findFirst = internal.findFirst;
|
|
273
|
+
/**
|
|
274
|
+
* Returns the first value that passes an effectful `FilterEffect`.
|
|
275
|
+
*
|
|
276
|
+
* The filter receives the element and index. Evaluation short-circuits on the
|
|
277
|
+
* first `Result.succeed` and returns the transformed value in `Option.some`.
|
|
278
|
+
*
|
|
279
|
+
* @since 4.0.0
|
|
280
|
+
* @category Collecting
|
|
281
|
+
*/
|
|
282
|
+
export const findFirstFilter = internal.findFirstFilter;
|
|
218
283
|
/**
|
|
219
284
|
* Executes an effectful operation for each element in an `Iterable`.
|
|
220
285
|
*
|
|
@@ -409,16 +474,18 @@ export const promise = internal.promise;
|
|
|
409
474
|
*
|
|
410
475
|
* @example Custom Error Handling
|
|
411
476
|
* ```ts
|
|
412
|
-
* import { Effect } from "effect"
|
|
477
|
+
* import { Data, Effect } from "effect"
|
|
478
|
+
*
|
|
479
|
+
* class TodoFetchError extends Data.TaggedError("TodoFetchError")<{ readonly cause: unknown }> {}
|
|
413
480
|
*
|
|
414
481
|
* const getTodo = (id: number) =>
|
|
415
482
|
* Effect.tryPromise({
|
|
416
483
|
* try: () => fetch(`https://jsonplaceholder.typicode.com/todos/${id}`),
|
|
417
484
|
* // remap the error
|
|
418
|
-
* catch: (
|
|
485
|
+
* catch: (cause) => new TodoFetchError({ cause })
|
|
419
486
|
* })
|
|
420
487
|
*
|
|
421
|
-
* // ┌─── Effect<Response,
|
|
488
|
+
* // ┌─── Effect<Response, TodoFetchError, never>
|
|
422
489
|
* // ▼
|
|
423
490
|
* const program = getTodo(1)
|
|
424
491
|
* ```
|
|
@@ -645,8 +712,13 @@ undefined_ as undefined };
|
|
|
645
712
|
*
|
|
646
713
|
* **When to Use**
|
|
647
714
|
*
|
|
648
|
-
* Use `Effect.
|
|
715
|
+
* Use `Effect.callback` when dealing with APIs that use callback-style instead of
|
|
649
716
|
* `async/await` or `Promise`.
|
|
717
|
+
* * **Previously Known As**
|
|
718
|
+
*
|
|
719
|
+
* This API replaces the following from Effect 3.x:
|
|
720
|
+
*
|
|
721
|
+
* - `Effect.async`
|
|
650
722
|
*
|
|
651
723
|
* @example
|
|
652
724
|
* ```ts
|
|
@@ -690,6 +762,51 @@ export const callback = internal.callback;
|
|
|
690
762
|
* @category Creating Effects
|
|
691
763
|
*/
|
|
692
764
|
export const never = internal.never;
|
|
765
|
+
/**
|
|
766
|
+
* An `Effect` containing an empty record `{}`, used as the starting point for
|
|
767
|
+
* do notation chains.
|
|
768
|
+
*
|
|
769
|
+
* @example
|
|
770
|
+
* ```ts
|
|
771
|
+
* import { Effect } from "effect"
|
|
772
|
+
* import { pipe } from "effect/Function"
|
|
773
|
+
*
|
|
774
|
+
* const program = pipe(
|
|
775
|
+
* Effect.Do,
|
|
776
|
+
* Effect.bind("x", () => Effect.succeed(2)),
|
|
777
|
+
* Effect.bind("y", ({ x }) => Effect.succeed(x + 1)),
|
|
778
|
+
* Effect.let("sum", ({ x, y }) => x + y)
|
|
779
|
+
* )
|
|
780
|
+
* ```
|
|
781
|
+
*
|
|
782
|
+
* @since 4.0.0
|
|
783
|
+
* @category Do notation
|
|
784
|
+
*/
|
|
785
|
+
export const Do = internal.Do;
|
|
786
|
+
/**
|
|
787
|
+
* Gives a name to the success value of an `Effect`, creating a single-key
|
|
788
|
+
* record used in do notation pipelines.
|
|
789
|
+
*
|
|
790
|
+
* @since 4.0.0
|
|
791
|
+
* @category Do notation
|
|
792
|
+
*/
|
|
793
|
+
export const bindTo = internal.bindTo;
|
|
794
|
+
const let_ = internal.let;
|
|
795
|
+
export {
|
|
796
|
+
/**
|
|
797
|
+
* Adds a computed plain value to the do notation record.
|
|
798
|
+
*
|
|
799
|
+
* @since 4.0.0
|
|
800
|
+
* @category Do notation
|
|
801
|
+
*/
|
|
802
|
+
let_ as let };
|
|
803
|
+
/**
|
|
804
|
+
* Adds an `Effect` value to the do notation record under a given name.
|
|
805
|
+
*
|
|
806
|
+
* @since 4.0.0
|
|
807
|
+
* @category Do notation
|
|
808
|
+
*/
|
|
809
|
+
export const bind = internal.bind;
|
|
693
810
|
/**
|
|
694
811
|
* Provides a way to write effectful code using generator functions, simplifying
|
|
695
812
|
* control flow and error handling.
|
|
@@ -707,16 +824,18 @@ export const never = internal.never;
|
|
|
707
824
|
*
|
|
708
825
|
* @example
|
|
709
826
|
* ```ts
|
|
710
|
-
* import { Effect } from "effect"
|
|
827
|
+
* import { Data, Effect } from "effect"
|
|
828
|
+
*
|
|
829
|
+
* class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
|
|
711
830
|
*
|
|
712
831
|
* const addServiceCharge = (amount: number) => amount + 1
|
|
713
832
|
*
|
|
714
833
|
* const applyDiscount = (
|
|
715
834
|
* total: number,
|
|
716
835
|
* discountRate: number
|
|
717
|
-
* ): Effect.Effect<number,
|
|
836
|
+
* ): Effect.Effect<number, DiscountRateError> =>
|
|
718
837
|
* discountRate === 0
|
|
719
|
-
* ? Effect.fail(new
|
|
838
|
+
* ? Effect.fail(new DiscountRateError())
|
|
720
839
|
* : Effect.succeed(total - (total * discountRate) / 100)
|
|
721
840
|
*
|
|
722
841
|
* const fetchTransactionAmount = Effect.promise(() => Promise.resolve(100))
|
|
@@ -753,12 +872,14 @@ export const gen = internal.gen;
|
|
|
753
872
|
* @example
|
|
754
873
|
* ```ts
|
|
755
874
|
* // Title: Creating a Failed Effect
|
|
756
|
-
* import { Effect } from "effect"
|
|
875
|
+
* import { Data, Effect } from "effect"
|
|
876
|
+
*
|
|
877
|
+
* class OperationFailedError extends Data.TaggedError("OperationFailedError")<{}> {}
|
|
757
878
|
*
|
|
758
|
-
* // ┌─── Effect<never,
|
|
879
|
+
* // ┌─── Effect<never, OperationFailedError, never>
|
|
759
880
|
* // ▼
|
|
760
881
|
* const failure = Effect.fail(
|
|
761
|
-
* new
|
|
882
|
+
* new OperationFailedError()
|
|
762
883
|
* )
|
|
763
884
|
* ```
|
|
764
885
|
*
|
|
@@ -774,9 +895,11 @@ export const fail = internal.fail;
|
|
|
774
895
|
*
|
|
775
896
|
* @example
|
|
776
897
|
* ```ts
|
|
777
|
-
* import { Effect } from "effect"
|
|
898
|
+
* import { Data, Effect } from "effect"
|
|
899
|
+
*
|
|
900
|
+
* class ProgramError extends Data.TaggedError("ProgramError")<{ readonly failedAt: Date }> {}
|
|
778
901
|
*
|
|
779
|
-
* const program = Effect.failSync(() => new
|
|
902
|
+
* const program = Effect.failSync(() => new ProgramError({ failedAt: new Date() }))
|
|
780
903
|
*
|
|
781
904
|
* Effect.runPromiseExit(program).then(console.log)
|
|
782
905
|
* // Output: { _id: 'Exit', _tag: 'Failure', cause: ... }
|
|
@@ -920,12 +1043,14 @@ export {
|
|
|
920
1043
|
*
|
|
921
1044
|
* @example Custom Error Handling
|
|
922
1045
|
* ```ts
|
|
923
|
-
* import { Effect } from "effect"
|
|
1046
|
+
* import { Data, Effect } from "effect"
|
|
1047
|
+
*
|
|
1048
|
+
* class JsonParsingError extends Data.TaggedError("JsonParsingError")<{ readonly cause: unknown }> {}
|
|
924
1049
|
*
|
|
925
1050
|
* const parseJSON = (input: string) =>
|
|
926
1051
|
* Effect.try({
|
|
927
1052
|
* try: () => JSON.parse(input),
|
|
928
|
-
* catch: (
|
|
1053
|
+
* catch: (cause) => new JsonParsingError({ cause })
|
|
929
1054
|
* })
|
|
930
1055
|
*
|
|
931
1056
|
* Effect.runPromiseExit(parseJSON("invalid json")).then(console.log)
|
|
@@ -1050,17 +1175,17 @@ export const fromOption = internal.fromOption;
|
|
|
1050
1175
|
* ```ts
|
|
1051
1176
|
* import { Console, Effect } from "effect"
|
|
1052
1177
|
*
|
|
1053
|
-
* const input: string | null
|
|
1054
|
-
*
|
|
1055
|
-
* const program = Effect.gen(function*() {
|
|
1178
|
+
* const program = Effect.fn(function*(input: string | null) {
|
|
1056
1179
|
* const value = yield* Effect.fromNullishOr(input)
|
|
1057
1180
|
* yield* Console.log(value)
|
|
1058
|
-
* }
|
|
1181
|
+
* },
|
|
1059
1182
|
* Effect.catch(() => Console.log("missing"))
|
|
1060
1183
|
* )
|
|
1061
1184
|
*
|
|
1062
|
-
* Effect.runPromise(program)
|
|
1185
|
+
* Effect.runPromise(program(null))
|
|
1063
1186
|
* // Output: missing
|
|
1187
|
+
* Effect.runPromise(program("hello"))
|
|
1188
|
+
* // Output: hello
|
|
1064
1189
|
* ```
|
|
1065
1190
|
*
|
|
1066
1191
|
* @since 4.0.0
|
|
@@ -1124,15 +1249,17 @@ export const fromYieldable = internal.fromYieldable;
|
|
|
1124
1249
|
*
|
|
1125
1250
|
* @example
|
|
1126
1251
|
* ```ts
|
|
1127
|
-
* import { Effect, pipe } from "effect"
|
|
1252
|
+
* import { Data, Effect, pipe } from "effect"
|
|
1253
|
+
*
|
|
1254
|
+
* class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
|
|
1128
1255
|
*
|
|
1129
1256
|
* // Function to apply a discount safely to a transaction amount
|
|
1130
1257
|
* const applyDiscount = (
|
|
1131
1258
|
* total: number,
|
|
1132
1259
|
* discountRate: number
|
|
1133
|
-
* ): Effect.Effect<number,
|
|
1260
|
+
* ): Effect.Effect<number, DiscountRateError> =>
|
|
1134
1261
|
* discountRate === 0
|
|
1135
|
-
* ? Effect.fail(new
|
|
1262
|
+
* ? Effect.fail(new DiscountRateError())
|
|
1136
1263
|
* : Effect.succeed(total - (total * discountRate) / 100)
|
|
1137
1264
|
*
|
|
1138
1265
|
* // Simulated asynchronous task to fetch a transaction amount from database
|
|
@@ -1216,15 +1343,17 @@ export const flatten = internal.flatten;
|
|
|
1216
1343
|
*
|
|
1217
1344
|
* @example Applying a Discount Based on Fetched Amount
|
|
1218
1345
|
* ```ts
|
|
1219
|
-
* import { Effect, pipe } from "effect"
|
|
1346
|
+
* import { Data, Effect, pipe } from "effect"
|
|
1347
|
+
*
|
|
1348
|
+
* class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
|
|
1220
1349
|
*
|
|
1221
1350
|
* // Function to apply a discount safely to a transaction amount
|
|
1222
1351
|
* const applyDiscount = (
|
|
1223
1352
|
* total: number,
|
|
1224
1353
|
* discountRate: number
|
|
1225
|
-
* ): Effect.Effect<number,
|
|
1354
|
+
* ): Effect.Effect<number, DiscountRateError> =>
|
|
1226
1355
|
* discountRate === 0
|
|
1227
|
-
* ? Effect.fail(new
|
|
1356
|
+
* ? Effect.fail(new DiscountRateError())
|
|
1228
1357
|
* : Effect.succeed(total - (total * discountRate) / 100)
|
|
1229
1358
|
*
|
|
1230
1359
|
* // Simulated asynchronous task to fetch a transaction amount from database
|
|
@@ -1281,16 +1410,18 @@ export const andThen = internal.andThen;
|
|
|
1281
1410
|
* @example
|
|
1282
1411
|
* ```ts
|
|
1283
1412
|
* // Title: Logging a step in a pipeline
|
|
1284
|
-
* import { Effect, pipe } from "effect"
|
|
1413
|
+
* import { Data, Effect, pipe } from "effect"
|
|
1285
1414
|
* import { Console } from "effect"
|
|
1286
1415
|
*
|
|
1416
|
+
* class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
|
|
1417
|
+
*
|
|
1287
1418
|
* // Function to apply a discount safely to a transaction amount
|
|
1288
1419
|
* const applyDiscount = (
|
|
1289
1420
|
* total: number,
|
|
1290
1421
|
* discountRate: number
|
|
1291
|
-
* ): Effect.Effect<number,
|
|
1422
|
+
* ): Effect.Effect<number, DiscountRateError> =>
|
|
1292
1423
|
* discountRate === 0
|
|
1293
|
-
* ? Effect.fail(new
|
|
1424
|
+
* ? Effect.fail(new DiscountRateError())
|
|
1294
1425
|
* : Effect.succeed(total - (total * discountRate) / 100)
|
|
1295
1426
|
*
|
|
1296
1427
|
* // Simulated asynchronous task to fetch a transaction amount from database
|
|
@@ -1697,12 +1828,12 @@ export {
|
|
|
1697
1828
|
*
|
|
1698
1829
|
* **Details**
|
|
1699
1830
|
*
|
|
1700
|
-
* The `
|
|
1831
|
+
* The `catch` function catches any errors that may occur during the
|
|
1701
1832
|
* execution of an effect and allows you to handle them by specifying a fallback
|
|
1702
1833
|
* effect. This ensures that the program continues without failing by recovering
|
|
1703
1834
|
* from errors using the provided fallback logic.
|
|
1704
1835
|
*
|
|
1705
|
-
* **Note**: `
|
|
1836
|
+
* **Note**: `catch` only handles recoverable errors. It will not recover
|
|
1706
1837
|
* from unrecoverable defects.
|
|
1707
1838
|
*
|
|
1708
1839
|
* @see {@link catchCause} for a version that can recover from both recoverable and unrecoverable errors.
|
|
@@ -1767,7 +1898,8 @@ export const catchTag = internal.catchTag;
|
|
|
1767
1898
|
* once. Instead of using {@link catchTag} multiple times, you can pass an
|
|
1768
1899
|
* object where each key is an error type's `_tag`, and the value is the handler
|
|
1769
1900
|
* for that specific error. This allows you to catch and recover from multiple
|
|
1770
|
-
* error types in a single call.
|
|
1901
|
+
* error types in a single call. You can also provide a fallback handler for
|
|
1902
|
+
* unhandled errors.
|
|
1771
1903
|
*
|
|
1772
1904
|
* The error type must have a readonly `_tag` field to use `catchTag`. This
|
|
1773
1905
|
* field is used to identify and match errors.
|
|
@@ -1998,15 +2130,14 @@ export const catchCause = internal.catchCause;
|
|
|
1998
2130
|
*/
|
|
1999
2131
|
export const catchDefect = internal.catchDefect;
|
|
2000
2132
|
/**
|
|
2001
|
-
* Recovers from specific errors using a `
|
|
2002
|
-
* `Refinement`.
|
|
2133
|
+
* Recovers from specific errors using a `Predicate` or `Refinement`.
|
|
2003
2134
|
*
|
|
2004
2135
|
* **When to Use**
|
|
2005
2136
|
*
|
|
2006
|
-
* `catchIf` lets you recover from errors that match a condition.
|
|
2007
|
-
* `
|
|
2008
|
-
*
|
|
2009
|
-
*
|
|
2137
|
+
* `catchIf` lets you recover from errors that match a condition. Use a
|
|
2138
|
+
* `Refinement` for type narrowing or a `Predicate` for simple boolean
|
|
2139
|
+
* matching. Non-matching errors re-fail with the original cause. Defects and
|
|
2140
|
+
* interrupts are not caught.
|
|
2010
2141
|
*
|
|
2011
2142
|
* **Previously Known As**
|
|
2012
2143
|
*
|
|
@@ -2033,7 +2164,7 @@ export const catchDefect = internal.catchDefect;
|
|
|
2033
2164
|
*
|
|
2034
2165
|
* // With a Filter
|
|
2035
2166
|
* const recovered2 = program.pipe(
|
|
2036
|
-
* Effect.
|
|
2167
|
+
* Effect.catchFilter(
|
|
2037
2168
|
* Filter.tagged("NotFound"),
|
|
2038
2169
|
* (error) => Effect.succeed(`missing:${error.id}`)
|
|
2039
2170
|
* )
|
|
@@ -2044,6 +2175,13 @@ export const catchDefect = internal.catchDefect;
|
|
|
2044
2175
|
* @category Error Handling
|
|
2045
2176
|
*/
|
|
2046
2177
|
export const catchIf = internal.catchIf;
|
|
2178
|
+
/**
|
|
2179
|
+
* Recovers from specific errors using a `Filter`.
|
|
2180
|
+
*
|
|
2181
|
+
* @since 4.0.0
|
|
2182
|
+
* @category Error Handling
|
|
2183
|
+
*/
|
|
2184
|
+
export const catchFilter = internal.catchFilter;
|
|
2047
2185
|
/**
|
|
2048
2186
|
* Catches `NoSuchElementError` failures and converts them to `Option.none`.
|
|
2049
2187
|
*
|
|
@@ -2110,6 +2248,13 @@ export const catchNoSuchElement = internal.catchNoSuchElement;
|
|
|
2110
2248
|
* @category Error Handling
|
|
2111
2249
|
*/
|
|
2112
2250
|
export const catchCauseIf = internal.catchCauseIf;
|
|
2251
|
+
/**
|
|
2252
|
+
* Recovers from specific failures based on a `Filter`.
|
|
2253
|
+
*
|
|
2254
|
+
* @since 4.0.0
|
|
2255
|
+
* @category Error Handling
|
|
2256
|
+
*/
|
|
2257
|
+
export const catchCauseFilter = internal.catchCauseFilter;
|
|
2113
2258
|
/**
|
|
2114
2259
|
* The `mapError` function is used to transform or modify the error
|
|
2115
2260
|
* produced by an effect, without affecting its success value.
|
|
@@ -2125,17 +2270,19 @@ export const catchCauseIf = internal.catchCauseIf;
|
|
|
2125
2270
|
*
|
|
2126
2271
|
* @example
|
|
2127
2272
|
* ```ts
|
|
2128
|
-
* import { Effect } from "effect"
|
|
2273
|
+
* import { Data, Effect } from "effect"
|
|
2274
|
+
*
|
|
2275
|
+
* class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
|
|
2129
2276
|
*
|
|
2130
2277
|
* // ┌─── Effect<number, string, never>
|
|
2131
2278
|
* // ▼
|
|
2132
2279
|
* const simulatedTask = Effect.fail("Oh no!").pipe(Effect.as(1))
|
|
2133
2280
|
*
|
|
2134
|
-
* // ┌─── Effect<number,
|
|
2281
|
+
* // ┌─── Effect<number, TaskError, never>
|
|
2135
2282
|
* // ▼
|
|
2136
2283
|
* const mapped = Effect.mapError(
|
|
2137
2284
|
* simulatedTask,
|
|
2138
|
-
* (message) => new
|
|
2285
|
+
* (message) => new TaskError({ message })
|
|
2139
2286
|
* )
|
|
2140
2287
|
* ```
|
|
2141
2288
|
*
|
|
@@ -2155,16 +2302,18 @@ export const mapError = internal.mapError;
|
|
|
2155
2302
|
*
|
|
2156
2303
|
* @example
|
|
2157
2304
|
* ```ts
|
|
2158
|
-
* import { Effect } from "effect"
|
|
2305
|
+
* import { Data, Effect } from "effect"
|
|
2306
|
+
*
|
|
2307
|
+
* class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
|
|
2159
2308
|
*
|
|
2160
2309
|
* // ┌─── Effect<number, string, never>
|
|
2161
2310
|
* // ▼
|
|
2162
2311
|
* const simulatedTask = Effect.fail("Oh no!").pipe(Effect.as(1))
|
|
2163
2312
|
*
|
|
2164
|
-
* // ┌─── Effect<boolean,
|
|
2313
|
+
* // ┌─── Effect<boolean, TaskError, never>
|
|
2165
2314
|
* // ▼
|
|
2166
2315
|
* const modified = Effect.mapBoth(simulatedTask, {
|
|
2167
|
-
* onFailure: (message) => new
|
|
2316
|
+
* onFailure: (message) => new TaskError({ message }),
|
|
2168
2317
|
* onSuccess: (n) => n > 0
|
|
2169
2318
|
* })
|
|
2170
2319
|
* ```
|
|
@@ -2194,11 +2343,13 @@ export const mapBoth = internal.mapBoth;
|
|
|
2194
2343
|
* @example
|
|
2195
2344
|
* ```ts
|
|
2196
2345
|
* // Title: Propagating an Error as a Defect
|
|
2197
|
-
* import { Effect } from "effect"
|
|
2346
|
+
* import { Data, Effect } from "effect"
|
|
2347
|
+
*
|
|
2348
|
+
* class DivideByZeroError extends Data.TaggedError("DivideByZeroError")<{}> {}
|
|
2198
2349
|
*
|
|
2199
2350
|
* const divide = (a: number, b: number) =>
|
|
2200
2351
|
* b === 0
|
|
2201
|
-
* ? Effect.fail(new
|
|
2352
|
+
* ? Effect.fail(new DivideByZeroError())
|
|
2202
2353
|
* : Effect.succeed(a / b)
|
|
2203
2354
|
*
|
|
2204
2355
|
* // ┌─── Effect<number, never, never>
|
|
@@ -2207,7 +2358,7 @@ export const mapBoth = internal.mapBoth;
|
|
|
2207
2358
|
*
|
|
2208
2359
|
* Effect.runPromise(program).catch(console.error)
|
|
2209
2360
|
* // Output:
|
|
2210
|
-
* // (FiberFailure)
|
|
2361
|
+
* // (FiberFailure) DivideByZeroError
|
|
2211
2362
|
* // ...stack trace...
|
|
2212
2363
|
* ```
|
|
2213
2364
|
*
|
|
@@ -2344,6 +2495,13 @@ export const tapCause = internal.tapCause;
|
|
|
2344
2495
|
* @category Sequencing
|
|
2345
2496
|
*/
|
|
2346
2497
|
export const tapCauseIf = internal.tapCauseIf;
|
|
2498
|
+
/**
|
|
2499
|
+
* Conditionally executes a side effect based on the cause of a failed effect.
|
|
2500
|
+
*
|
|
2501
|
+
* @since 4.0.0
|
|
2502
|
+
* @category Sequencing
|
|
2503
|
+
*/
|
|
2504
|
+
export const tapCauseFilter = internal.tapCauseFilter;
|
|
2347
2505
|
/**
|
|
2348
2506
|
* Inspect severe errors or defects (non-recoverable failures) in an effect.
|
|
2349
2507
|
*
|
|
@@ -2412,7 +2570,7 @@ export const tapDefect = internal.tapDefect;
|
|
|
2412
2570
|
* attempts++
|
|
2413
2571
|
* yield* Console.log(`Attempt ${attempts}`)
|
|
2414
2572
|
* if (attempts < 3) {
|
|
2415
|
-
* yield* Effect.fail("Not ready")
|
|
2573
|
+
* return yield* Effect.fail("Not ready")
|
|
2416
2574
|
* }
|
|
2417
2575
|
* return "Ready"
|
|
2418
2576
|
* })
|
|
@@ -2454,13 +2612,15 @@ export const eventually = internal.eventually;
|
|
|
2454
2612
|
*
|
|
2455
2613
|
* @example
|
|
2456
2614
|
* ```ts
|
|
2457
|
-
* import { Effect, Schedule } from "effect"
|
|
2615
|
+
* import { Data, Effect, Schedule } from "effect"
|
|
2616
|
+
*
|
|
2617
|
+
* class AttemptError extends Data.TaggedError("AttemptError")<{ readonly attempt: number }> {}
|
|
2458
2618
|
*
|
|
2459
2619
|
* let attempt = 0
|
|
2460
|
-
* const task = Effect.callback<string,
|
|
2620
|
+
* const task = Effect.callback<string, AttemptError>((resume) => {
|
|
2461
2621
|
* attempt++
|
|
2462
2622
|
* if (attempt <= 2) {
|
|
2463
|
-
* resume(Effect.fail(new
|
|
2623
|
+
* resume(Effect.fail(new AttemptError({ attempt })))
|
|
2464
2624
|
* } else {
|
|
2465
2625
|
* resume(Effect.succeed("Success!"))
|
|
2466
2626
|
* }
|
|
@@ -2500,14 +2660,16 @@ export const retry = internalSchedule.retry;
|
|
|
2500
2660
|
*
|
|
2501
2661
|
* @example
|
|
2502
2662
|
* ```ts
|
|
2503
|
-
* import { Console, Effect, Schedule } from "effect"
|
|
2663
|
+
* import { Console, Data, Effect, Schedule } from "effect"
|
|
2664
|
+
*
|
|
2665
|
+
* class NetworkTimeoutError extends Data.TaggedError("NetworkTimeoutError")<{}> {}
|
|
2504
2666
|
*
|
|
2505
2667
|
* let attempt = 0
|
|
2506
2668
|
* const networkRequest = Effect.gen(function*() {
|
|
2507
2669
|
* attempt++
|
|
2508
2670
|
* yield* Console.log(`Network attempt ${attempt}`)
|
|
2509
2671
|
* if (attempt < 3) {
|
|
2510
|
-
* return yield* Effect.fail(new
|
|
2672
|
+
* return yield* Effect.fail(new NetworkTimeoutError())
|
|
2511
2673
|
* }
|
|
2512
2674
|
* return "Network data"
|
|
2513
2675
|
* })
|
|
@@ -2579,7 +2741,8 @@ export const sandbox = internal.sandbox;
|
|
|
2579
2741
|
* it succeeds or fails. This is useful when you only care about the side
|
|
2580
2742
|
* effects of the effect and do not need to handle or process its outcome.
|
|
2581
2743
|
*
|
|
2582
|
-
* Use the `log` option to emit the full {@link Cause} when the effect fails
|
|
2744
|
+
* Use the `log` option to emit the full {@link Cause} when the effect fails,
|
|
2745
|
+
* and `message` to prepend a custom log message.
|
|
2583
2746
|
*
|
|
2584
2747
|
* @example
|
|
2585
2748
|
* ```ts
|
|
@@ -2603,7 +2766,7 @@ export const sandbox = internal.sandbox;
|
|
|
2603
2766
|
* const task = Effect.fail("Uh oh!")
|
|
2604
2767
|
*
|
|
2605
2768
|
* const program = task.pipe(Effect.ignore({ log: true }))
|
|
2606
|
-
* const programWarn = task.pipe(Effect.ignore({ log: "Warn" }))
|
|
2769
|
+
* const programWarn = task.pipe(Effect.ignore({ log: "Warn", message: "Ignoring task failure" }))
|
|
2607
2770
|
* ```
|
|
2608
2771
|
*
|
|
2609
2772
|
* **Previously Known As**
|
|
@@ -2619,7 +2782,8 @@ export const ignore = internal.ignore;
|
|
|
2619
2782
|
/**
|
|
2620
2783
|
* Ignores the effect's failure cause, including defects and interruptions.
|
|
2621
2784
|
*
|
|
2622
|
-
* Use the `log` option to emit the full {@link Cause} when the effect fails
|
|
2785
|
+
* Use the `log` option to emit the full {@link Cause} when the effect fails,
|
|
2786
|
+
* and `message` to prepend a custom log message.
|
|
2623
2787
|
*
|
|
2624
2788
|
* @example
|
|
2625
2789
|
* ```ts
|
|
@@ -2628,7 +2792,7 @@ export const ignore = internal.ignore;
|
|
|
2628
2792
|
* const task = Effect.fail("boom")
|
|
2629
2793
|
*
|
|
2630
2794
|
* const program = task.pipe(Effect.ignoreCause)
|
|
2631
|
-
* const programLog = task.pipe(Effect.ignoreCause({ log: true }))
|
|
2795
|
+
* const programLog = task.pipe(Effect.ignoreCause({ log: true, message: "Ignoring failure cause" }))
|
|
2632
2796
|
* ```
|
|
2633
2797
|
*
|
|
2634
2798
|
* @since 4.0.0
|
|
@@ -2651,7 +2815,10 @@ export const ignoreCause = internal.ignoreCause;
|
|
|
2651
2815
|
*
|
|
2652
2816
|
* const fetchUrl = Effect.gen(function*() {
|
|
2653
2817
|
* const endpoint = yield* Effect.service(Endpoint)
|
|
2654
|
-
*
|
|
2818
|
+
* if (endpoint.url === "bad") {
|
|
2819
|
+
* return yield* Effect.fail("Unavailable")
|
|
2820
|
+
* }
|
|
2821
|
+
* return endpoint.url
|
|
2655
2822
|
* })
|
|
2656
2823
|
*
|
|
2657
2824
|
* const plan = ExecutionPlan.make(
|
|
@@ -2666,6 +2833,16 @@ export const ignoreCause = internal.ignoreCause;
|
|
|
2666
2833
|
* @category Fallback
|
|
2667
2834
|
*/
|
|
2668
2835
|
export const withExecutionPlan = internalExecutionPlan.withExecutionPlan;
|
|
2836
|
+
/**
|
|
2837
|
+
* Runs an effect and reports any errors to the configured `ErrorReporter`s.
|
|
2838
|
+
*
|
|
2839
|
+
* If the `defectsOnly` option is set to `true`, only defects (unrecoverable
|
|
2840
|
+
* errors) will be reported, while regular failures will be ignored.
|
|
2841
|
+
*
|
|
2842
|
+
* @since 4.0.0
|
|
2843
|
+
* @category Error Handling
|
|
2844
|
+
*/
|
|
2845
|
+
export const withErrorReporting = internal.withErrorReporting;
|
|
2669
2846
|
// -----------------------------------------------------------------------------
|
|
2670
2847
|
// Fallback
|
|
2671
2848
|
// -----------------------------------------------------------------------------
|
|
@@ -2830,7 +3007,7 @@ export const timeoutOption = internal.timeoutOption;
|
|
|
2830
3007
|
* // Use cached data as fallback when timeout is reached
|
|
2831
3008
|
* const program = Effect.timeoutOrElse(slowQuery, {
|
|
2832
3009
|
* duration: "2 seconds",
|
|
2833
|
-
*
|
|
3010
|
+
* orElse: () =>
|
|
2834
3011
|
* Effect.gen(function*() {
|
|
2835
3012
|
* yield* Console.log("Query timed out, using cached data")
|
|
2836
3013
|
* return "Cached result"
|
|
@@ -3042,12 +3219,12 @@ export const raceFirst = internal.raceFirst;
|
|
|
3042
3219
|
// Filtering
|
|
3043
3220
|
// -----------------------------------------------------------------------------
|
|
3044
3221
|
/**
|
|
3045
|
-
* Filters elements of an iterable using a predicate, refinement, effectful
|
|
3046
|
-
* predicate
|
|
3222
|
+
* Filters elements of an iterable using a predicate, refinement, or effectful
|
|
3223
|
+
* predicate.
|
|
3047
3224
|
*
|
|
3048
3225
|
* @example
|
|
3049
3226
|
* ```ts
|
|
3050
|
-
* import { Effect
|
|
3227
|
+
* import { Effect } from "effect"
|
|
3051
3228
|
*
|
|
3052
3229
|
* // Sync predicate
|
|
3053
3230
|
* const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
|
|
@@ -3055,16 +3232,27 @@ export const raceFirst = internal.raceFirst;
|
|
|
3055
3232
|
* // Effectful predicate
|
|
3056
3233
|
* const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
|
|
3057
3234
|
*
|
|
3058
|
-
* //
|
|
3059
|
-
* const mapped = Effect.filter([1, 2, 3, 4], (n) =>
|
|
3060
|
-
* Effect.succeed(n % 2 === 0 ? Result.succeed(n * 2) : Result.fail(n))
|
|
3061
|
-
* )
|
|
3235
|
+
* // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
|
|
3062
3236
|
* ```
|
|
3063
3237
|
*
|
|
3064
3238
|
* @since 2.0.0
|
|
3065
3239
|
* @category Filtering
|
|
3066
3240
|
*/
|
|
3067
3241
|
export const filter = internal.filter;
|
|
3242
|
+
/**
|
|
3243
|
+
* Filters and maps elements of an iterable with a `Filter`.
|
|
3244
|
+
*
|
|
3245
|
+
* @since 4.0.0
|
|
3246
|
+
* @category Filtering
|
|
3247
|
+
*/
|
|
3248
|
+
export const filterMap = internal.filterMap;
|
|
3249
|
+
/**
|
|
3250
|
+
* Effectfully filters and maps elements of an iterable with a `FilterEffect`.
|
|
3251
|
+
*
|
|
3252
|
+
* @since 4.0.0
|
|
3253
|
+
* @category Filtering
|
|
3254
|
+
*/
|
|
3255
|
+
export const filterMapEffect = internal.filterMapEffect;
|
|
3068
3256
|
/**
|
|
3069
3257
|
* Filters an effect, providing an alternative effect if the predicate fails.
|
|
3070
3258
|
*
|
|
@@ -3096,6 +3284,13 @@ export const filter = internal.filter;
|
|
|
3096
3284
|
* @category Filtering
|
|
3097
3285
|
*/
|
|
3098
3286
|
export const filterOrElse = internal.filterOrElse;
|
|
3287
|
+
/**
|
|
3288
|
+
* Filters an effect with a `Filter`, providing an alternative effect on failure.
|
|
3289
|
+
*
|
|
3290
|
+
* @since 4.0.0
|
|
3291
|
+
* @category Filtering
|
|
3292
|
+
*/
|
|
3293
|
+
export const filterMapOrElse = internal.filterMapOrElse;
|
|
3099
3294
|
/**
|
|
3100
3295
|
* Filters an effect, failing with a custom error if the predicate fails.
|
|
3101
3296
|
*
|
|
@@ -3126,6 +3321,13 @@ export const filterOrElse = internal.filterOrElse;
|
|
|
3126
3321
|
* @category Filtering
|
|
3127
3322
|
*/
|
|
3128
3323
|
export const filterOrFail = internal.filterOrFail;
|
|
3324
|
+
/**
|
|
3325
|
+
* Filters an effect with a `Filter`, failing when the filter fails.
|
|
3326
|
+
*
|
|
3327
|
+
* @since 4.0.0
|
|
3328
|
+
* @category Filtering
|
|
3329
|
+
*/
|
|
3330
|
+
export const filterMapOrFail = internal.filterMapOrFail;
|
|
3129
3331
|
// -----------------------------------------------------------------------------
|
|
3130
3332
|
// Conditional Operators
|
|
3131
3333
|
// -----------------------------------------------------------------------------
|
|
@@ -3192,9 +3394,11 @@ export const when = internal.when;
|
|
|
3192
3394
|
* @example
|
|
3193
3395
|
* ```ts
|
|
3194
3396
|
* // Title: Handling Both Success and Failure Cases
|
|
3195
|
-
* import { Effect } from "effect"
|
|
3397
|
+
* import { Data, Effect } from "effect"
|
|
3196
3398
|
*
|
|
3197
|
-
*
|
|
3399
|
+
* class ExampleError extends Data.TaggedError("ExampleError")<{ readonly message: string }> {}
|
|
3400
|
+
*
|
|
3401
|
+
* const success: Effect.Effect<number, ExampleError> = Effect.succeed(42)
|
|
3198
3402
|
*
|
|
3199
3403
|
* const program1 = Effect.match(success, {
|
|
3200
3404
|
* onFailure: (error) => `failure: ${error.message}`,
|
|
@@ -3205,8 +3409,8 @@ export const when = internal.when;
|
|
|
3205
3409
|
* Effect.runPromise(program1).then(console.log)
|
|
3206
3410
|
* // Output: "success: 42"
|
|
3207
3411
|
*
|
|
3208
|
-
* const failure: Effect.Effect<number,
|
|
3209
|
-
* new
|
|
3412
|
+
* const failure: Effect.Effect<number, ExampleError> = Effect.fail(
|
|
3413
|
+
* new ExampleError({ message: "Uh oh!" })
|
|
3210
3414
|
* )
|
|
3211
3415
|
*
|
|
3212
3416
|
* const program2 = Effect.match(failure, {
|
|
@@ -3350,9 +3554,11 @@ export const matchCauseEffectEager = internal.matchCauseEffectEager;
|
|
|
3350
3554
|
*
|
|
3351
3555
|
* @example
|
|
3352
3556
|
* ```ts
|
|
3353
|
-
* import { Cause, Console, Effect, Result } from "effect"
|
|
3557
|
+
* import { Cause, Console, Data, Effect, Result } from "effect"
|
|
3558
|
+
*
|
|
3559
|
+
* class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
|
|
3354
3560
|
*
|
|
3355
|
-
* const task = Effect.fail(new
|
|
3561
|
+
* const task = Effect.fail(new TaskError({ message: "Task failed" }))
|
|
3356
3562
|
*
|
|
3357
3563
|
* const program = Effect.matchCauseEffect(task, {
|
|
3358
3564
|
* onFailure: (cause) =>
|
|
@@ -3408,11 +3614,13 @@ export const matchCauseEffect = internal.matchCauseEffect;
|
|
|
3408
3614
|
* @example
|
|
3409
3615
|
* ```ts
|
|
3410
3616
|
* // Title: Handling Both Success and Failure Cases with Side Effects
|
|
3411
|
-
* import { Effect } from "effect"
|
|
3617
|
+
* import { Data, Effect } from "effect"
|
|
3618
|
+
*
|
|
3619
|
+
* class ExampleError extends Data.TaggedError("ExampleError")<{ readonly message: string }> {}
|
|
3412
3620
|
*
|
|
3413
|
-
* const success: Effect.Effect<number,
|
|
3414
|
-
* const failure: Effect.Effect<number,
|
|
3415
|
-
* new
|
|
3621
|
+
* const success: Effect.Effect<number, ExampleError> = Effect.succeed(42)
|
|
3622
|
+
* const failure: Effect.Effect<number, ExampleError> = Effect.fail(
|
|
3623
|
+
* new ExampleError({ message: "Uh oh!" })
|
|
3416
3624
|
* )
|
|
3417
3625
|
*
|
|
3418
3626
|
* const program1 = Effect.matchEffect(success, {
|
|
@@ -3605,7 +3813,7 @@ export const servicesWith = internal.servicesWith;
|
|
|
3605
3813
|
* const Database = ServiceMap.Service<Database>("Database")
|
|
3606
3814
|
*
|
|
3607
3815
|
* const DatabaseLive = Layer.succeed(Database)({
|
|
3608
|
-
* query: (sql: string) => Effect.succeed(`Result for: ${sql}`)
|
|
3816
|
+
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result for: ${sql}`))
|
|
3609
3817
|
* })
|
|
3610
3818
|
*
|
|
3611
3819
|
* const program = Effect.gen(function*() {
|
|
@@ -4245,9 +4453,11 @@ export const ensuring = internal.ensuring;
|
|
|
4245
4453
|
*
|
|
4246
4454
|
* @example
|
|
4247
4455
|
* ```ts
|
|
4248
|
-
* import { Cause, Console, Effect } from "effect"
|
|
4456
|
+
* import { Cause, Data, Console, Effect } from "effect"
|
|
4457
|
+
*
|
|
4458
|
+
* class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
|
|
4249
4459
|
*
|
|
4250
|
-
* const task = Effect.fail(new
|
|
4460
|
+
* const task = Effect.fail(new TaskError({ message: "Something went wrong" }))
|
|
4251
4461
|
*
|
|
4252
4462
|
* const program = Effect.onError(
|
|
4253
4463
|
* task,
|
|
@@ -4256,8 +4466,8 @@ export const ensuring = internal.ensuring;
|
|
|
4256
4466
|
*
|
|
4257
4467
|
* Effect.runPromise(program).catch(console.error)
|
|
4258
4468
|
* // Output:
|
|
4259
|
-
* // Cleanup on error:
|
|
4260
|
-
* //
|
|
4469
|
+
* // Cleanup on error: TaskError: Something went wrong
|
|
4470
|
+
* // TaskError: Something went wrong
|
|
4261
4471
|
* ```
|
|
4262
4472
|
*
|
|
4263
4473
|
* @since 2.0.0
|
|
@@ -4266,7 +4476,7 @@ export const ensuring = internal.ensuring;
|
|
|
4266
4476
|
export const onError = internal.onError;
|
|
4267
4477
|
/**
|
|
4268
4478
|
* Runs the finalizer only when this effect fails and the `Cause` matches the
|
|
4269
|
-
*
|
|
4479
|
+
* provided predicate.
|
|
4270
4480
|
*
|
|
4271
4481
|
* @example
|
|
4272
4482
|
* ```ts
|
|
@@ -4288,6 +4498,13 @@ export const onError = internal.onError;
|
|
|
4288
4498
|
* @category Resource Management & Finalization
|
|
4289
4499
|
*/
|
|
4290
4500
|
export const onErrorIf = internal.onErrorIf;
|
|
4501
|
+
/**
|
|
4502
|
+
* Runs the finalizer only when this effect fails and the cause matches the provided `Filter`.
|
|
4503
|
+
*
|
|
4504
|
+
* @since 4.0.0
|
|
4505
|
+
* @category Resource Management & Finalization
|
|
4506
|
+
*/
|
|
4507
|
+
export const onErrorFilter = internal.onErrorFilter;
|
|
4291
4508
|
/**
|
|
4292
4509
|
* The low level primitive that powers `onExit`.
|
|
4293
4510
|
* function is used to run a finalizer when the effect exits, regardless of the
|
|
@@ -4325,20 +4542,20 @@ export const onExitPrimitive = internal.onExitPrimitive;
|
|
|
4325
4542
|
*/
|
|
4326
4543
|
export const onExit = internal.onExit;
|
|
4327
4544
|
/**
|
|
4328
|
-
* Runs the cleanup effect only when the `Exit`
|
|
4329
|
-
*
|
|
4330
|
-
* The cleanup is skipped when the filter returns `Filter.fail`.
|
|
4545
|
+
* Runs the cleanup effect only when the `Exit` satisfies the provided
|
|
4546
|
+
* predicate.
|
|
4331
4547
|
*
|
|
4332
4548
|
* @example
|
|
4333
4549
|
* ```ts
|
|
4334
|
-
* import { Console, Effect, Exit
|
|
4335
|
-
*
|
|
4336
|
-
* const exitFilter = Filter.fromPredicate(Exit.isSuccess<number, never>)
|
|
4550
|
+
* import { Console, Effect, Exit } from "effect"
|
|
4337
4551
|
*
|
|
4338
4552
|
* const program = Effect.onExitIf(
|
|
4339
4553
|
* Effect.succeed(42),
|
|
4340
|
-
*
|
|
4341
|
-
* (
|
|
4554
|
+
* Exit.isSuccess,
|
|
4555
|
+
* (exit) =>
|
|
4556
|
+
* Exit.isSuccess(exit)
|
|
4557
|
+
* ? Console.log(`Succeeded with: ${exit.value}`)
|
|
4558
|
+
* : Effect.void
|
|
4342
4559
|
* )
|
|
4343
4560
|
* ```
|
|
4344
4561
|
*
|
|
@@ -4346,6 +4563,13 @@ export const onExit = internal.onExit;
|
|
|
4346
4563
|
* @category Resource Management & Finalization
|
|
4347
4564
|
*/
|
|
4348
4565
|
export const onExitIf = internal.onExitIf;
|
|
4566
|
+
/**
|
|
4567
|
+
* Runs the cleanup effect only when the `Exit` matches the provided `Filter`.
|
|
4568
|
+
*
|
|
4569
|
+
* @since 4.0.0
|
|
4570
|
+
* @category Resource Management & Finalization
|
|
4571
|
+
*/
|
|
4572
|
+
export const onExitFilter = internal.onExitFilter;
|
|
4349
4573
|
// -----------------------------------------------------------------------------
|
|
4350
4574
|
// Caching
|
|
4351
4575
|
// -----------------------------------------------------------------------------
|
|
@@ -4561,8 +4785,8 @@ export const cachedInvalidateWithTTL = internal.cachedInvalidateWithTTL;
|
|
|
4561
4785
|
* import { Effect } from "effect"
|
|
4562
4786
|
*
|
|
4563
4787
|
* const program = Effect.gen(function*() {
|
|
4564
|
-
* yield* Effect.interrupt
|
|
4565
|
-
* yield* Effect.succeed("This won't execute")
|
|
4788
|
+
* return yield* Effect.interrupt
|
|
4789
|
+
* yield* Effect.succeed("This won't execute and is unreachable")
|
|
4566
4790
|
* })
|
|
4567
4791
|
*
|
|
4568
4792
|
* Effect.runPromise(program).catch(console.error)
|
|
@@ -4702,124 +4926,6 @@ export const uninterruptibleMask = internal.uninterruptibleMask;
|
|
|
4702
4926
|
* @category Interruption
|
|
4703
4927
|
*/
|
|
4704
4928
|
export const interruptibleMask = internal.interruptibleMask;
|
|
4705
|
-
/**
|
|
4706
|
-
* Unsafely creates a new Semaphore.
|
|
4707
|
-
*
|
|
4708
|
-
* @example
|
|
4709
|
-
* ```ts
|
|
4710
|
-
* import { Effect } from "effect"
|
|
4711
|
-
*
|
|
4712
|
-
* const semaphore = Effect.makeSemaphoreUnsafe(3)
|
|
4713
|
-
*
|
|
4714
|
-
* const task = (id: number) =>
|
|
4715
|
-
* semaphore.withPermits(1)(
|
|
4716
|
-
* Effect.gen(function*() {
|
|
4717
|
-
* yield* Effect.log(`Task ${id} started`)
|
|
4718
|
-
* yield* Effect.sleep("1 second")
|
|
4719
|
-
* yield* Effect.log(`Task ${id} completed`)
|
|
4720
|
-
* })
|
|
4721
|
-
* )
|
|
4722
|
-
*
|
|
4723
|
-
* // Only 3 tasks can run concurrently
|
|
4724
|
-
* const program = Effect.all([
|
|
4725
|
-
* task(1),
|
|
4726
|
-
* task(2),
|
|
4727
|
-
* task(3),
|
|
4728
|
-
* task(4),
|
|
4729
|
-
* task(5)
|
|
4730
|
-
* ], { concurrency: "unbounded" })
|
|
4731
|
-
* ```
|
|
4732
|
-
*
|
|
4733
|
-
* @since 2.0.0
|
|
4734
|
-
* @category Semaphore
|
|
4735
|
-
*/
|
|
4736
|
-
export const makeSemaphoreUnsafe = internal.makeSemaphoreUnsafe;
|
|
4737
|
-
/**
|
|
4738
|
-
* Creates a new Semaphore.
|
|
4739
|
-
*
|
|
4740
|
-
* @example
|
|
4741
|
-
* ```ts
|
|
4742
|
-
* import { Effect } from "effect"
|
|
4743
|
-
*
|
|
4744
|
-
* const program = Effect.gen(function*() {
|
|
4745
|
-
* const semaphore = yield* Effect.makeSemaphore(2)
|
|
4746
|
-
*
|
|
4747
|
-
* const task = (id: number) =>
|
|
4748
|
-
* semaphore.withPermits(1)(
|
|
4749
|
-
* Effect.gen(function*() {
|
|
4750
|
-
* yield* Effect.log(`Task ${id} acquired permit`)
|
|
4751
|
-
* yield* Effect.sleep("1 second")
|
|
4752
|
-
* yield* Effect.log(`Task ${id} releasing permit`)
|
|
4753
|
-
* })
|
|
4754
|
-
* )
|
|
4755
|
-
*
|
|
4756
|
-
* // Run 4 tasks, but only 2 can run concurrently
|
|
4757
|
-
* yield* Effect.all([task(1), task(2), task(3), task(4)])
|
|
4758
|
-
* })
|
|
4759
|
-
* ```
|
|
4760
|
-
*
|
|
4761
|
-
* @since 2.0.0
|
|
4762
|
-
* @category Semaphore
|
|
4763
|
-
*/
|
|
4764
|
-
export const makeSemaphore = internal.makeSemaphore;
|
|
4765
|
-
/**
|
|
4766
|
-
* Creates a new Latch.
|
|
4767
|
-
*
|
|
4768
|
-
* @example
|
|
4769
|
-
* ```ts
|
|
4770
|
-
* import { Effect } from "effect"
|
|
4771
|
-
*
|
|
4772
|
-
* const latch = Effect.makeLatchUnsafe(false)
|
|
4773
|
-
*
|
|
4774
|
-
* const waiter = Effect.gen(function*() {
|
|
4775
|
-
* yield* Effect.log("Waiting for latch to open...")
|
|
4776
|
-
* yield* latch.await
|
|
4777
|
-
* yield* Effect.log("Latch opened! Continuing...")
|
|
4778
|
-
* })
|
|
4779
|
-
*
|
|
4780
|
-
* const opener = Effect.gen(function*() {
|
|
4781
|
-
* yield* Effect.sleep("2 seconds")
|
|
4782
|
-
* yield* Effect.log("Opening latch...")
|
|
4783
|
-
* yield* latch.open
|
|
4784
|
-
* })
|
|
4785
|
-
*
|
|
4786
|
-
* const program = Effect.all([waiter, opener])
|
|
4787
|
-
* ```
|
|
4788
|
-
*
|
|
4789
|
-
* @category Latch
|
|
4790
|
-
* @since 3.8.0
|
|
4791
|
-
*/
|
|
4792
|
-
export const makeLatchUnsafe = internal.makeLatchUnsafe;
|
|
4793
|
-
/**
|
|
4794
|
-
* Creates a new Latch.
|
|
4795
|
-
*
|
|
4796
|
-
* @example
|
|
4797
|
-
* ```ts
|
|
4798
|
-
* import { Effect } from "effect"
|
|
4799
|
-
*
|
|
4800
|
-
* const program = Effect.gen(function*() {
|
|
4801
|
-
* const latch = yield* Effect.makeLatch(false)
|
|
4802
|
-
*
|
|
4803
|
-
* const waiter = Effect.gen(function*() {
|
|
4804
|
-
* yield* Effect.log("Waiting for latch to open...")
|
|
4805
|
-
* yield* latch.await
|
|
4806
|
-
* yield* Effect.log("Latch opened! Continuing...")
|
|
4807
|
-
* })
|
|
4808
|
-
*
|
|
4809
|
-
* const opener = Effect.gen(function*() {
|
|
4810
|
-
* yield* Effect.sleep("2 seconds")
|
|
4811
|
-
* yield* Effect.log("Opening latch...")
|
|
4812
|
-
* yield* latch.open
|
|
4813
|
-
* })
|
|
4814
|
-
*
|
|
4815
|
-
* yield* Effect.all([waiter, opener])
|
|
4816
|
-
* })
|
|
4817
|
-
* ```
|
|
4818
|
-
*
|
|
4819
|
-
* @category Latch
|
|
4820
|
-
* @since 3.8.0
|
|
4821
|
-
*/
|
|
4822
|
-
export const makeLatch = internal.makeLatch;
|
|
4823
4929
|
/**
|
|
4824
4930
|
* Repeats this effect forever (until the first error).
|
|
4825
4931
|
*
|
|
@@ -4942,7 +5048,7 @@ export const repeat = internalSchedule.repeat;
|
|
|
4942
5048
|
* attempt++
|
|
4943
5049
|
* if (attempt <= 2) {
|
|
4944
5050
|
* yield* Console.log(`Attempt ${attempt} failed`)
|
|
4945
|
-
* yield* Effect.fail(`Error ${attempt}`)
|
|
5051
|
+
* return yield* Effect.fail(`Error ${attempt}`)
|
|
4946
5052
|
* }
|
|
4947
5053
|
* yield* Console.log(`Attempt ${attempt} succeeded`)
|
|
4948
5054
|
* return "success"
|
|
@@ -5510,7 +5616,7 @@ export const withParentSpan = internal.withParentSpan;
|
|
|
5510
5616
|
* )
|
|
5511
5617
|
*
|
|
5512
5618
|
* const program = Effect.gen(function*() {
|
|
5513
|
-
* const name = yield* Effect.request(GetUser({ id: 1 }),
|
|
5619
|
+
* const name = yield* Effect.request(GetUser({ id: 1 }), resolver)
|
|
5514
5620
|
* yield* Console.log(name)
|
|
5515
5621
|
* })
|
|
5516
5622
|
* ```
|
|
@@ -6568,7 +6674,7 @@ export const withLogger = /*#__PURE__*/dual(2, (effect, logger) => internal.upda
|
|
|
6568
6674
|
* @since 2.0.0
|
|
6569
6675
|
* @category Logging
|
|
6570
6676
|
*/
|
|
6571
|
-
export const annotateLogs = /*#__PURE__*/dual(args =>
|
|
6677
|
+
export const annotateLogs = /*#__PURE__*/dual(args => isEffect(args[0]), (effect, ...args) => internal.updateService(effect, CurrentLogAnnotations, annotations => {
|
|
6572
6678
|
const newAnnotations = {
|
|
6573
6679
|
...annotations
|
|
6574
6680
|
};
|
|
@@ -6579,6 +6685,32 @@ export const annotateLogs = /*#__PURE__*/dual(args => core.isEffect(args[0]), (e
|
|
|
6579
6685
|
}
|
|
6580
6686
|
return newAnnotations;
|
|
6581
6687
|
}));
|
|
6688
|
+
/**
|
|
6689
|
+
* Adds log annotations to the current scope.
|
|
6690
|
+
*
|
|
6691
|
+
* This differs from `annotateLogs`, which only annotates a specific effect.
|
|
6692
|
+
* `annotateLogsScoped` updates annotations for the entire current `Scope` and
|
|
6693
|
+
* restores the previous annotations when the scope closes.
|
|
6694
|
+
*
|
|
6695
|
+
* @example
|
|
6696
|
+
* ```ts
|
|
6697
|
+
* import { Effect } from "effect"
|
|
6698
|
+
*
|
|
6699
|
+
* const program = Effect.scoped(
|
|
6700
|
+
* Effect.gen(function*() {
|
|
6701
|
+
* yield* Effect.log("before")
|
|
6702
|
+
* yield* Effect.annotateLogsScoped({ requestId: "req-123" })
|
|
6703
|
+
* yield* Effect.log("inside scope")
|
|
6704
|
+
* })
|
|
6705
|
+
* )
|
|
6706
|
+
*
|
|
6707
|
+
* Effect.runPromise(program)
|
|
6708
|
+
* ```
|
|
6709
|
+
*
|
|
6710
|
+
* @since 4.0.0
|
|
6711
|
+
* @category Logging
|
|
6712
|
+
*/
|
|
6713
|
+
export const annotateLogsScoped = internal.annotateLogsScoped;
|
|
6582
6714
|
/**
|
|
6583
6715
|
* Adds a span to each log line in this effect.
|
|
6584
6716
|
*
|
|
@@ -6744,18 +6876,20 @@ export const trackSuccesses = /*#__PURE__*/dual(args => isEffect(args[0]), (self
|
|
|
6744
6876
|
*
|
|
6745
6877
|
* @example
|
|
6746
6878
|
* ```ts
|
|
6747
|
-
* import { Effect, Metric } from "effect"
|
|
6879
|
+
* import { Data, Effect, Metric } from "effect"
|
|
6880
|
+
*
|
|
6881
|
+
* class ConnectionFailedError extends Data.TaggedError("ConnectionFailedError")<{}> {}
|
|
6748
6882
|
*
|
|
6749
6883
|
* // Track error types using frequency metric
|
|
6750
6884
|
* const errorTypeFrequency = Metric.frequency("error_types")
|
|
6751
6885
|
*
|
|
6752
|
-
* const program = Effect.fail(new
|
|
6753
|
-
* Effect.trackErrors(errorTypeFrequency, (error:
|
|
6886
|
+
* const program = Effect.fail(new ConnectionFailedError()).pipe(
|
|
6887
|
+
* Effect.trackErrors(errorTypeFrequency, (error: ConnectionFailedError) => error._tag)
|
|
6754
6888
|
* )
|
|
6755
6889
|
*
|
|
6756
6890
|
* Effect.runPromiseExit(program).then(() =>
|
|
6757
6891
|
* Effect.runPromise(Metric.value(errorTypeFrequency)).then(console.log)
|
|
6758
|
-
* // Output: { occurrences: Map(1) { "
|
|
6892
|
+
* // Output: { occurrences: Map(1) { "ConnectionFailedError" => 1 } }
|
|
6759
6893
|
* )
|
|
6760
6894
|
* ```
|
|
6761
6895
|
*
|
|
@@ -6866,7 +7000,7 @@ export const trackDuration = /*#__PURE__*/dual(args => isEffect(args[0]), (self,
|
|
|
6866
7000
|
const startTime = clock.currentTimeNanosUnsafe();
|
|
6867
7001
|
return onExit(self, () => {
|
|
6868
7002
|
const endTime = clock.currentTimeNanosUnsafe();
|
|
6869
|
-
const duration = Duration.subtract(Duration.
|
|
7003
|
+
const duration = Duration.subtract(Duration.fromInputUnsafe(endTime), Duration.fromInputUnsafe(startTime));
|
|
6870
7004
|
const input = f === undefined ? duration : internalCall(() => f(duration));
|
|
6871
7005
|
return Metric.update(metric, input);
|
|
6872
7006
|
});
|
|
@@ -6897,125 +7031,63 @@ export const trackDuration = /*#__PURE__*/dual(args => isEffect(args[0]), (self,
|
|
|
6897
7031
|
*/
|
|
6898
7032
|
export class Transaction extends /*#__PURE__*/ServiceMap.Service()("effect/Effect/Transaction") {}
|
|
6899
7033
|
/**
|
|
6900
|
-
*
|
|
6901
|
-
* transactional values (i.e. TxRef) that occur within the transaction body.
|
|
7034
|
+
* Accesses the current transaction state within an active transaction.
|
|
6902
7035
|
*
|
|
6903
|
-
*
|
|
6904
|
-
*
|
|
6905
|
-
*
|
|
6906
|
-
* accessed transactional values changes.
|
|
6907
|
-
*
|
|
6908
|
-
* - any of the accessed transactional values change during the execution of the transaction
|
|
6909
|
-
* due to a different transaction committing before the current.
|
|
6910
|
-
*
|
|
6911
|
-
* - parent transaction retry, if you have a transaction within another transaction and
|
|
6912
|
-
* the parent retries the child will also retry together with the parent.
|
|
7036
|
+
* This function requires `Transaction` in the context and does NOT create or strip
|
|
7037
|
+
* transaction boundaries. Use it to interact with the transaction journal (e.g. in
|
|
7038
|
+
* `TxRef` internals). To define a transaction boundary, use {@link transaction}.
|
|
6913
7039
|
*
|
|
6914
7040
|
* @example
|
|
6915
7041
|
* ```ts
|
|
6916
7042
|
* import { Effect, TxRef } from "effect"
|
|
6917
7043
|
*
|
|
6918
7044
|
* const program = Effect.gen(function*() {
|
|
6919
|
-
* const
|
|
6920
|
-
* const ref2 = yield* TxRef.make(0)
|
|
6921
|
-
*
|
|
6922
|
-
* // All operations within atomic block succeed or fail together
|
|
6923
|
-
* yield* Effect.atomic(Effect.gen(function*() {
|
|
6924
|
-
* yield* TxRef.set(ref1, 10)
|
|
6925
|
-
* yield* TxRef.set(ref2, 20)
|
|
6926
|
-
* const sum = (yield* TxRef.get(ref1)) + (yield* TxRef.get(ref2))
|
|
6927
|
-
* console.log(`Transaction sum: ${sum}`)
|
|
6928
|
-
* }))
|
|
6929
|
-
*
|
|
6930
|
-
* console.log(`Final ref1: ${yield* TxRef.get(ref1)}`) // 10
|
|
6931
|
-
* console.log(`Final ref2: ${yield* TxRef.get(ref2)}`) // 20
|
|
6932
|
-
* })
|
|
6933
|
-
* ```
|
|
6934
|
-
*
|
|
6935
|
-
* @since 4.0.0
|
|
6936
|
-
* @category Transactions
|
|
6937
|
-
*/
|
|
6938
|
-
export const atomic = effect => atomicWith(() => effect);
|
|
6939
|
-
/**
|
|
6940
|
-
* Executes a function within a transaction context, providing access to the transaction state.
|
|
6941
|
-
*
|
|
6942
|
-
* @example
|
|
6943
|
-
* ```ts
|
|
6944
|
-
* import { Effect, TxRef } from "effect"
|
|
6945
|
-
*
|
|
6946
|
-
* const program = Effect.atomicWith((txState) =>
|
|
6947
|
-
* Effect.gen(function*() {
|
|
6948
|
-
* const ref = yield* TxRef.make(0)
|
|
6949
|
-
*
|
|
6950
|
-
* // Access transaction state for debugging
|
|
6951
|
-
* console.log(`Journal size: ${txState.journal.size}`)
|
|
6952
|
-
* console.log(`Retry flag: ${txState.retry}`)
|
|
7045
|
+
* const ref = yield* Effect.transaction(TxRef.make(0))
|
|
6953
7046
|
*
|
|
7047
|
+
* yield* Effect.transaction(Effect.gen(function*() {
|
|
6954
7048
|
* yield* TxRef.set(ref, 42)
|
|
6955
7049
|
* return yield* TxRef.get(ref)
|
|
6956
|
-
* })
|
|
6957
|
-
* )
|
|
6958
|
-
*
|
|
6959
|
-
* Effect.runPromise(program).then(console.log) // 42
|
|
7050
|
+
* }))
|
|
7051
|
+
* })
|
|
6960
7052
|
* ```
|
|
6961
7053
|
*
|
|
6962
7054
|
* @since 4.0.0
|
|
6963
7055
|
* @category Transactions
|
|
6964
7056
|
*/
|
|
6965
|
-
export const
|
|
6966
|
-
// Check if transaction already exists and reuse it (composing behavior)
|
|
6967
|
-
if (fiber.services.mapUnsafe.has(Transaction.key)) {
|
|
6968
|
-
return internalCall(() => f(ServiceMap.getUnsafe(fiber.services, Transaction)));
|
|
6969
|
-
}
|
|
6970
|
-
// No existing transaction, create isolated one using transactionWith
|
|
6971
|
-
return transactionWith(f);
|
|
6972
|
-
});
|
|
7057
|
+
export const withTxState = f => flatMap(Transaction.asEffect(), state => internalCall(() => f(state)));
|
|
6973
7058
|
/**
|
|
6974
|
-
*
|
|
7059
|
+
* Defines a transaction boundary. Transactions are "all or nothing" with respect to changes
|
|
7060
|
+
* made to transactional values (i.e. TxRef) that occur within the transaction body.
|
|
6975
7061
|
*
|
|
6976
|
-
*
|
|
7062
|
+
* In Effect transactions are optimistic with retry, that means transactions are retried when:
|
|
6977
7063
|
*
|
|
6978
|
-
*
|
|
6979
|
-
*
|
|
6980
|
-
* This ensures complete isolation between different transaction scopes.
|
|
7064
|
+
* - the body of the transaction explicitely calls to `Effect.retryTransaction` and any of the
|
|
7065
|
+
* accessed transactional values changes.
|
|
6981
7066
|
*
|
|
6982
|
-
*
|
|
6983
|
-
*
|
|
6984
|
-
* - Parent transaction failures don't affect isolated transactions
|
|
6985
|
-
* - Isolated transaction failures don't affect parent transactions
|
|
6986
|
-
* - Each transaction has its own journal and retry logic
|
|
7067
|
+
* - any of the accessed transactional values change during the execution of the transaction
|
|
7068
|
+
* due to a different transaction committing before the current.
|
|
6987
7069
|
*
|
|
6988
|
-
*
|
|
6989
|
-
*
|
|
6990
|
-
* - For implementing independent operations that shouldn't be affected by outer transactions
|
|
6991
|
-
* - When building transaction-based systems where isolation is critical
|
|
7070
|
+
* Each call to `transaction` always creates a new isolated transaction boundary with its own
|
|
7071
|
+
* journal and retry logic.
|
|
6992
7072
|
*
|
|
6993
7073
|
* @example
|
|
6994
7074
|
* ```ts
|
|
6995
7075
|
* import { Effect, TxRef } from "effect"
|
|
6996
7076
|
*
|
|
6997
7077
|
* const program = Effect.gen(function*() {
|
|
6998
|
-
* const ref1 = yield* TxRef.make(0)
|
|
6999
|
-
* const ref2 = yield* TxRef.make(
|
|
7000
|
-
*
|
|
7001
|
-
* // Nested atomic transaction - ref1 will be part of outer transaction
|
|
7002
|
-
* yield* Effect.atomic(Effect.gen(function*() {
|
|
7003
|
-
* yield* TxRef.set(ref1, 10)
|
|
7004
|
-
*
|
|
7005
|
-
* // This atomic operation composes with the parent
|
|
7006
|
-
* yield* Effect.atomic(Effect.gen(function*() {
|
|
7007
|
-
* yield* TxRef.set(ref1, 20) // Part of same transaction
|
|
7008
|
-
* }))
|
|
7009
|
-
* }))
|
|
7078
|
+
* const ref1 = yield* Effect.transaction(TxRef.make(0))
|
|
7079
|
+
* const ref2 = yield* Effect.transaction(TxRef.make(0))
|
|
7010
7080
|
*
|
|
7011
|
-
* //
|
|
7081
|
+
* // All operations within transaction block succeed or fail together
|
|
7012
7082
|
* yield* Effect.transaction(Effect.gen(function*() {
|
|
7013
|
-
* yield* TxRef.set(
|
|
7083
|
+
* yield* TxRef.set(ref1, 10)
|
|
7084
|
+
* yield* TxRef.set(ref2, 20)
|
|
7085
|
+
* const sum = (yield* TxRef.get(ref1)) + (yield* TxRef.get(ref2))
|
|
7086
|
+
* console.log(`Transaction sum: ${sum}`)
|
|
7014
7087
|
* }))
|
|
7015
7088
|
*
|
|
7016
|
-
*
|
|
7017
|
-
*
|
|
7018
|
-
* return { ref1: val1, ref2: val2 }
|
|
7089
|
+
* console.log(`Final ref1: ${yield* Effect.transaction(TxRef.get(ref1))}`) // 10
|
|
7090
|
+
* console.log(`Final ref2: ${yield* Effect.transaction(TxRef.get(ref2))}`) // 20
|
|
7019
7091
|
* })
|
|
7020
7092
|
* ```
|
|
7021
7093
|
*
|
|
@@ -7024,34 +7096,21 @@ export const atomicWith = f => withFiber(fiber => {
|
|
|
7024
7096
|
*/
|
|
7025
7097
|
export const transaction = effect => transactionWith(() => effect);
|
|
7026
7098
|
/**
|
|
7027
|
-
*
|
|
7099
|
+
* Like {@link transaction} but provides access to the transaction state.
|
|
7028
7100
|
*
|
|
7029
|
-
*
|
|
7030
|
-
* within another transaction. This ensures complete isolation between transaction scopes.
|
|
7101
|
+
* Always creates a new isolated transaction boundary with its own journal and retry logic.
|
|
7031
7102
|
*
|
|
7032
7103
|
* @example
|
|
7033
7104
|
* ```ts
|
|
7034
7105
|
* import { Effect, TxRef } from "effect"
|
|
7035
7106
|
*
|
|
7036
|
-
* const program = Effect.transactionWith((
|
|
7107
|
+
* const program = Effect.transactionWith((_txState) =>
|
|
7037
7108
|
* Effect.gen(function*() {
|
|
7038
7109
|
* const ref = yield* TxRef.make(0)
|
|
7039
|
-
*
|
|
7040
|
-
* // This transaction is isolated - it has its own journal
|
|
7041
|
-
* // txState.journal is independent of any parent transaction
|
|
7042
|
-
*
|
|
7043
7110
|
* yield* TxRef.set(ref, 42)
|
|
7044
7111
|
* return yield* TxRef.get(ref)
|
|
7045
7112
|
* })
|
|
7046
7113
|
* )
|
|
7047
|
-
*
|
|
7048
|
-
* // Even when nested in another atomic block, this transaction is isolated
|
|
7049
|
-
* const nestedProgram = Effect.atomic(
|
|
7050
|
-
* Effect.gen(function*() {
|
|
7051
|
-
* const result = yield* program // Runs in its own isolated transaction
|
|
7052
|
-
* return result
|
|
7053
|
-
* })
|
|
7054
|
-
* )
|
|
7055
7114
|
* ```
|
|
7056
7115
|
*
|
|
7057
7116
|
* @since 4.0.0
|
|
@@ -7063,7 +7122,6 @@ export const transactionWith = f => withFiber(fiber => {
|
|
|
7063
7122
|
journal: new Map(),
|
|
7064
7123
|
retry: false
|
|
7065
7124
|
};
|
|
7066
|
-
const scheduler = fiber.currentScheduler;
|
|
7067
7125
|
let result;
|
|
7068
7126
|
return uninterruptibleMask(restore => flatMap(whileLoop({
|
|
7069
7127
|
while: () => !result,
|
|
@@ -7076,7 +7134,7 @@ export const transactionWith = f => withFiber(fiber => {
|
|
|
7076
7134
|
return clearTransaction(state);
|
|
7077
7135
|
}
|
|
7078
7136
|
if (Exit.isSuccess(exit)) {
|
|
7079
|
-
commitTransaction(
|
|
7137
|
+
commitTransaction(fiber, state);
|
|
7080
7138
|
} else {
|
|
7081
7139
|
clearTransaction(state);
|
|
7082
7140
|
}
|
|
@@ -7113,7 +7171,7 @@ const awaitPendingTransaction = state => suspend(() => {
|
|
|
7113
7171
|
return sync(clearPending);
|
|
7114
7172
|
});
|
|
7115
7173
|
});
|
|
7116
|
-
function commitTransaction(
|
|
7174
|
+
function commitTransaction(fiber, state) {
|
|
7117
7175
|
for (const [ref, {
|
|
7118
7176
|
value
|
|
7119
7177
|
}] of state.journal) {
|
|
@@ -7122,7 +7180,7 @@ function commitTransaction(scheduler, state) {
|
|
|
7122
7180
|
ref.value = value;
|
|
7123
7181
|
}
|
|
7124
7182
|
for (const pending of ref.pending.values()) {
|
|
7125
|
-
|
|
7183
|
+
fiber.currentDispatcher.scheduleTask(pending, 0);
|
|
7126
7184
|
}
|
|
7127
7185
|
ref.pending.clear();
|
|
7128
7186
|
}
|
|
@@ -7146,16 +7204,16 @@ function clearTransaction(state) {
|
|
|
7146
7204
|
*
|
|
7147
7205
|
* const program = Effect.gen(function*() {
|
|
7148
7206
|
* // create a transactional reference
|
|
7149
|
-
* const ref = yield* TxRef.make(0)
|
|
7207
|
+
* const ref = yield* Effect.transaction(TxRef.make(0))
|
|
7150
7208
|
*
|
|
7151
7209
|
* // forks a fiber that increases the value of `ref` every 100 millis
|
|
7152
7210
|
* yield* Effect.forkChild(Effect.forever(
|
|
7153
7211
|
* // update to transactional value
|
|
7154
|
-
* TxRef.update(ref, (n) => n + 1).pipe(Effect.delay("100 millis"))
|
|
7212
|
+
* Effect.transaction(TxRef.update(ref, (n) => n + 1)).pipe(Effect.delay("100 millis"))
|
|
7155
7213
|
* ))
|
|
7156
7214
|
*
|
|
7157
7215
|
* // the following will retry 10 times until the `ref` value is 10
|
|
7158
|
-
* yield* Effect.
|
|
7216
|
+
* yield* Effect.transaction(Effect.gen(function*() {
|
|
7159
7217
|
* const value = yield* TxRef.get(ref)
|
|
7160
7218
|
* if (value < 10) {
|
|
7161
7219
|
* yield* Effect.log(`retry due to value: ${value}`)
|
|
@@ -7259,18 +7317,20 @@ export const satisfiesSuccessType = () => effect => effect;
|
|
|
7259
7317
|
*
|
|
7260
7318
|
* @example
|
|
7261
7319
|
* ```ts
|
|
7262
|
-
* import { Effect } from "effect"
|
|
7320
|
+
* import { Data, Effect } from "effect"
|
|
7321
|
+
*
|
|
7322
|
+
* class ValidationError extends Data.TaggedError("ValidationError")<{}> {}
|
|
7263
7323
|
*
|
|
7264
|
-
* // Define a constraint that the error type must be
|
|
7265
|
-
* const satisfiesError = Effect.satisfiesErrorType<
|
|
7324
|
+
* // Define a constraint that the error type must be a ValidationError
|
|
7325
|
+
* const satisfiesError = Effect.satisfiesErrorType<ValidationError>()
|
|
7266
7326
|
*
|
|
7267
|
-
* // This works - Effect<number,
|
|
7268
|
-
* const validEffect = satisfiesError(Effect.fail(new
|
|
7327
|
+
* // This works - Effect<number, ValidationError, never> extends the constrained type
|
|
7328
|
+
* const validEffect = satisfiesError(Effect.fail(new ValidationError()))
|
|
7269
7329
|
*
|
|
7270
7330
|
* // This would cause a TypeScript compilation error:
|
|
7271
7331
|
* // const invalidEffect = satisfiesError(Effect.fail("string error"))
|
|
7272
7332
|
* // ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
7273
|
-
* // Type 'string' is not assignable to type '
|
|
7333
|
+
* // Type 'string' is not assignable to type 'ValidationError'
|
|
7274
7334
|
* ```
|
|
7275
7335
|
*
|
|
7276
7336
|
* @since 4.0.0
|