effect 4.0.0-beta.5 → 4.0.0-beta.50
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 +14 -45
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +21 -47
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +54 -23
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Cause.js +108 -10
- package/dist/Cause.js.map +1 -1
- package/dist/Channel.d.ts +166 -48
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +182 -91
- 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/Clock.d.ts +2 -2
- package/dist/Clock.d.ts.map +1 -1
- package/dist/Clock.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 +171 -11
- 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 +6 -6
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +5 -5
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Console.d.ts +2 -2
- package/dist/Console.d.ts.map +1 -1
- package/dist/Console.js.map +1 -1
- package/dist/Context.d.ts +1150 -0
- package/dist/Context.d.ts.map +1 -0
- package/dist/{ServiceMap.js → Context.js} +181 -165
- package/dist/Context.js.map +1 -0
- 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 +74 -255
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +17 -62
- package/dist/DateTime.js.map +1 -1
- package/dist/Deferred.d.ts +12 -5
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +13 -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 +1377 -1147
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +465 -446
- 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 +140 -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/ExecutionPlan.d.ts +6 -6
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/ExecutionPlan.js +4 -4
- package/dist/ExecutionPlan.js.map +1 -1
- 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 +10 -8
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +11 -10
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +12 -11
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +22 -21
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +10 -10
- package/dist/FiberMap.js.map +1 -1
- package/dist/FiberSet.d.ts +2 -2
- package/dist/FiberSet.d.ts.map +1 -1
- package/dist/FiberSet.js +4 -4
- package/dist/FiberSet.js.map +1 -1
- package/dist/FileSystem.d.ts +20 -19
- 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 +4 -37
- package/dist/Filter.d.ts.map +1 -1
- package/dist/Filter.js +0 -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/Hash.js +1 -1
- package/dist/Hash.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 +599 -379
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +249 -180
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +27 -26
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +21 -18
- 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 +31 -97
- 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 +8 -8
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/ManagedRuntime.js +34 -25
- package/dist/ManagedRuntime.js.map +1 -1
- package/dist/Metric.d.ts +23 -25
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +24 -26
- 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/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +3 -0
- package/dist/MutableList.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 +46 -18
- 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/Path.d.ts +2 -2
- package/dist/Path.d.ts.map +1 -1
- package/dist/Path.js +2 -2
- package/dist/Path.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 +2 -2
- package/dist/Pool.d.ts +6 -4
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +11 -9
- 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 +36 -2
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +46 -35
- package/dist/Random.js.map +1 -1
- package/dist/RcMap.d.ts +4 -4
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +13 -13
- 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/Redactable.d.ts +139 -62
- package/dist/Redactable.d.ts.map +1 -1
- package/dist/Redactable.js +59 -55
- package/dist/Redactable.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 +257 -229
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +240 -259
- package/dist/References.js.map +1 -1
- package/dist/Request.d.ts +6 -6
- 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 +15 -36
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Resource.d.ts +0 -3
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +5 -4
- 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 +176 -293
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +162 -136
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts +36 -125
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +37 -126
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +3269 -394
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +2284 -282
- 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 +136 -40
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +54 -10
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +82 -23
- 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 +65 -38
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +252 -3
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +319 -13
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/Scope.d.ts +2 -2
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.d.ts +2 -2
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedCache.js +5 -5
- 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 +220 -0
- package/dist/Semaphore.js.map +1 -0
- package/dist/Sink.d.ts +22 -19
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +54 -7
- package/dist/Sink.js.map +1 -1
- package/dist/Stdio.d.ts +18 -6
- package/dist/Stdio.d.ts.map +1 -1
- package/dist/Stdio.js +20 -2
- package/dist/Stdio.js.map +1 -1
- package/dist/Stream.d.ts +465 -542
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +321 -144
- 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 +5 -4
- package/dist/Terminal.d.ts.map +1 -1
- package/dist/Terminal.js +2 -2
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +21 -20
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +13 -9
- 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 +4 -4
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxChunk.js +4 -4
- 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 +105 -86
- 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 +2 -2
- 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 +1 -1
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxQueue.js +42 -57
- package/dist/TxQueue.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +500 -0
- package/dist/TxReentrantLock.d.ts.map +1 -0
- package/dist/TxReentrantLock.js +481 -0
- package/dist/TxReentrantLock.js.map +1 -0
- package/dist/TxRef.d.ts +14 -20
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +8 -10
- package/dist/TxRef.js.map +1 -1
- package/dist/TxSemaphore.d.ts +162 -2
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +25 -10
- 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 +83 -17
- package/dist/Types.d.ts.map +1 -1
- package/dist/Unify.d.ts +8 -2
- package/dist/Unify.d.ts.map +1 -1
- package/dist/Unify.js.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 +888 -71
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +888 -71
- 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 +343 -260
- 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/layer.js +3 -3
- package/dist/internal/layer.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 +11 -10
- 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 +6 -6
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/schedule.js +1 -1
- package/dist/internal/schedule.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 +86 -107
- package/dist/internal/schema/representation.js.map +1 -1
- package/dist/internal/schema/schema.d.ts +10 -1
- package/dist/internal/schema/schema.d.ts.map +1 -1
- package/dist/internal/schema/schema.js +22 -1
- 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 +267 -33
- 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 +155 -73
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +29 -23
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +9 -2
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +39 -11
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +41 -47
- 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/IdGenerator.d.ts +2 -2
- package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
- package/dist/unstable/ai/IdGenerator.js +2 -2
- package/dist/unstable/ai/IdGenerator.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +119 -49
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +260 -61
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +236 -141
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +71 -19
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +68 -15
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +218 -73
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Model.d.ts +27 -9
- package/dist/unstable/ai/Model.d.ts.map +1 -1
- package/dist/unstable/ai/Model.js +25 -9
- package/dist/unstable/ai/Model.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +9 -1
- 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/Prompt.js +6 -9
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +27 -27
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js +7 -8
- 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/Telemetry.d.ts +35 -2
- package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
- package/dist/unstable/ai/Telemetry.js +2 -2
- package/dist/unstable/ai/Telemetry.js.map +1 -1
- package/dist/unstable/ai/Tokenizer.d.ts +2 -2
- package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
- package/dist/unstable/ai/Tokenizer.js +2 -2
- package/dist/unstable/ai/Tokenizer.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +46 -16
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +68 -22
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +4 -4
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +14 -21
- 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 +5 -7
- package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
- package/dist/unstable/cli/Argument.d.ts +4 -7
- 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 +55 -67
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +32 -57
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/CliOutput.d.ts +5 -4
- package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
- package/dist/unstable/cli/CliOutput.js +67 -12
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +372 -59
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +328 -66
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Completions.d.ts +97 -0
- package/dist/unstable/cli/Completions.d.ts.map +1 -0
- package/dist/unstable/cli/Completions.js +25 -0
- package/dist/unstable/cli/Completions.js.map +1 -0
- package/dist/unstable/cli/Flag.d.ts +4 -5
- 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 +34 -6
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +24 -14
- 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 +266 -86
- 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 +41 -15
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +84 -47
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/completions/bash.js.map +1 -1
- package/dist/unstable/cli/internal/completions/descriptor.d.ts +2 -0
- package/dist/unstable/cli/internal/completions/descriptor.d.ts.map +1 -0
- package/dist/unstable/cli/internal/completions/{CommandDescriptor.js → descriptor.js} +17 -5
- package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -0
- package/dist/unstable/cli/internal/completions/fish.js.map +1 -1
- package/dist/unstable/cli/internal/completions/zsh.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 +155 -58
- 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/ClusterError.d.ts +7 -7
- package/dist/unstable/cluster/ClusterSchema.d.ts +28 -7
- package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.js +28 -8
- package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +4 -2
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +97 -63
- 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 +18 -16
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +31 -25
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/EntityAddress.d.ts +2 -2
- 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/EntityProxy.js +3 -3
- package/dist/unstable/cluster/EntityProxy.js.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.js +4 -4
- package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
- package/dist/unstable/cluster/EntityResource.d.ts +4 -4
- package/dist/unstable/cluster/EntityResource.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityResource.js +2 -2
- package/dist/unstable/cluster/EntityResource.js.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts +4 -4
- package/dist/unstable/cluster/HttpRunner.js +2 -2
- package/dist/unstable/cluster/HttpRunner.js.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.d.ts +5 -5
- package/dist/unstable/cluster/K8sHttpClient.d.ts.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.js +6 -6
- package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +21 -15
- package/dist/unstable/cluster/Message.d.ts.map +1 -1
- package/dist/unstable/cluster/Message.js +16 -8
- package/dist/unstable/cluster/Message.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +46 -23
- package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/MessageStorage.js +42 -26
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts +10 -9
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +8 -7
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/Runner.d.ts +2 -2
- 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 +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/RunnerHealth.d.ts +2 -2
- package/dist/unstable/cluster/RunnerHealth.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.js +2 -2
- package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +10 -9
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.d.ts +12 -12
- package/dist/unstable/cluster/RunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.js +3 -3
- package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +5 -4
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +18 -16
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/ShardId.d.ts +35 -49
- package/dist/unstable/cluster/ShardId.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardId.js +65 -67
- package/dist/unstable/cluster/ShardId.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts +4 -4
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +66 -54
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +28 -27
- package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.js +27 -27
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/SingletonAddress.d.ts +2 -2
- package/dist/unstable/cluster/Snowflake.d.ts +2 -2
- package/dist/unstable/cluster/Snowflake.d.ts.map +1 -1
- package/dist/unstable/cluster/Snowflake.js +2 -2
- package/dist/unstable/cluster/Snowflake.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +23 -20
- 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 +34 -27
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/cluster/internal/entityReaper.js +4 -3
- package/dist/unstable/cluster/internal/entityReaper.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceMap.js +3 -3
- package/dist/unstable/cluster/internal/resourceMap.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 +2 -2
- package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.js +9 -8
- 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/Event.d.ts +0 -6
- package/dist/unstable/eventlog/Event.d.ts.map +1 -1
- package/dist/unstable/eventlog/Event.js +0 -5
- package/dist/unstable/eventlog/Event.js.map +1 -1
- package/dist/unstable/eventlog/EventGroup.d.ts +0 -2
- package/dist/unstable/eventlog/EventGroup.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventGroup.js +0 -2
- package/dist/unstable/eventlog/EventGroup.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +28 -11
- package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventJournal.js +130 -71
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts +94 -37
- package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLog.js +225 -150
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.d.ts +11 -9
- package/dist/unstable/eventlog/EventLogEncryption.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js +15 -17
- package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +228 -0
- package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -0
- package/dist/unstable/eventlog/EventLogMessage.js +214 -0
- package/dist/unstable/eventlog/EventLogMessage.js.map +1 -0
- package/dist/unstable/eventlog/EventLogRemote.d.ts +112 -194
- package/dist/unstable/eventlog/EventLogRemote.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.js +168 -322
- package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.d.ts +26 -48
- package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.js +128 -199
- package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +60 -0
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -0
- package/dist/unstable/eventlog/EventLogServerEncrypted.js +166 -0
- package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -0
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +183 -0
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -0
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js +461 -0
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -0
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +117 -0
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts.map +1 -0
- package/dist/unstable/eventlog/EventLogSessionAuth.js +284 -0
- package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -0
- package/dist/unstable/eventlog/{SqlEventLogJournal.d.ts → SqlEventJournal.d.ts} +2 -2
- package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -0
- package/dist/unstable/eventlog/{SqlEventLogJournal.js → SqlEventJournal.js} +22 -16
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -0
- package/dist/unstable/eventlog/{SqlEventLogServer.d.ts → SqlEventLogServerEncrypted.d.ts} +5 -5
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts.map +1 -0
- package/dist/unstable/eventlog/{SqlEventLogServer.js → SqlEventLogServerEncrypted.js} +65 -24
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -0
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts +25 -0
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -0
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +354 -0
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -0
- package/dist/unstable/eventlog/index.d.ts +22 -2
- package/dist/unstable/eventlog/index.d.ts.map +1 -1
- package/dist/unstable/eventlog/index.js +22 -2
- package/dist/unstable/eventlog/index.js.map +1 -1
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.d.ts +2 -0
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.d.ts.map +1 -0
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js +89 -0
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js.map +1 -0
- 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 +2 -2
- package/dist/unstable/http/Etag.d.ts.map +1 -1
- package/dist/unstable/http/Etag.js +7 -3
- package/dist/unstable/http/Etag.js.map +1 -1
- package/dist/unstable/http/FetchHttpClient.d.ts +6 -3
- package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/unstable/http/FetchHttpClient.js +5 -5
- package/dist/unstable/http/FetchHttpClient.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts +24 -4
- package/dist/unstable/http/Headers.d.ts.map +1 -1
- package/dist/unstable/http/Headers.js +42 -13
- 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 +125 -21
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +197 -19
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientError.d.ts +8 -8
- 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 +13 -11
- package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
- package/dist/unstable/http/HttpEffect.js +67 -75
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.d.ts +5 -4
- package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js +2 -2
- 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 +4 -9
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +47 -43
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpPlatform.d.ts +2 -2
- package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
- package/dist/unstable/http/HttpPlatform.js +5 -4
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +9 -8
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +36 -36
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServer.d.ts +2 -2
- package/dist/unstable/http/HttpServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpServer.js +4 -4
- 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 +19 -7
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +307 -13
- 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 +52 -5
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +240 -5
- 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 +9 -9
- package/dist/unstable/http/Multipart.d.ts.map +1 -1
- package/dist/unstable/http/Multipart.js +7 -7
- package/dist/unstable/http/Multipart.js.map +1 -1
- 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 +11 -11
- package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js +8 -8
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +12 -9
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +53 -39
- 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 +79 -11
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +211 -105
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.js +53 -47
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +43 -26
- 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 +9 -8
- package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.js +4 -4
- package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +49 -18
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js +38 -8
- 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 +88 -9
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.js +86 -11
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts +9 -6
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.js +6 -6
- package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts +16 -15
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +57 -49
- 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 +8 -8
- 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/OtlpMetrics.js +1 -1
- package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.d.ts +2 -2
- package/dist/unstable/observability/OtlpSerialization.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.js +2 -2
- package/dist/unstable/observability/OtlpSerialization.js.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/observability/PrometheusMetrics.d.ts +3 -3
- package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.js +4 -33
- package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +24 -3
- package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.js +148 -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 -6
- package/dist/unstable/persistence/PersistedCache.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedCache.js +12 -12
- package/dist/unstable/persistence/PersistedCache.js.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts +16 -16
- package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.js +15 -14
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/Persistence.d.ts +5 -5
- package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistence.js +5 -5
- package/dist/unstable/persistence/Persistence.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +9 -9
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +4 -4
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/persistence/Redis.d.ts +3 -3
- package/dist/unstable/persistence/Redis.d.ts.map +1 -1
- package/dist/unstable/persistence/Redis.js +2 -2
- package/dist/unstable/persistence/Redis.js.map +1 -1
- package/dist/unstable/process/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 +89 -8
- package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js +22 -2
- package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +108 -47
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +105 -25
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +22 -20
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.js +58 -26
- package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.d.ts +8 -2
- package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +57 -14
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts +12 -12
- package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.js +59 -31
- package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
- package/dist/unstable/reactivity/Reactivity.d.ts +2 -2
- package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
- package/dist/unstable/reactivity/Reactivity.js +6 -6
- package/dist/unstable/reactivity/Reactivity.js.map +1 -1
- package/dist/unstable/reactivity/index.d.ts +2 -2
- package/dist/unstable/reactivity/index.d.ts.map +1 -1
- package/dist/unstable/reactivity/index.js +2 -2
- package/dist/unstable/reactivity/index.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +47 -19
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js +39 -7
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts +26 -47
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +120 -77
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcClientError.d.ts +2 -2
- package/dist/unstable/rpc/RpcGroup.d.ts +15 -11
- package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcGroup.js +30 -20
- package/dist/unstable/rpc/RpcGroup.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts +12 -12
- package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js +5 -5
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts +14 -1
- 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 +2 -2
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +46 -18
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +8 -12
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +78 -46
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/rpc/RpcWorker.d.ts +2 -2
- package/dist/unstable/rpc/RpcWorker.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcWorker.js +4 -4
- package/dist/unstable/rpc/RpcWorker.js.map +1 -1
- package/dist/unstable/rpc/Utils.d.ts +6 -3
- package/dist/unstable/rpc/Utils.d.ts.map +1 -1
- package/dist/unstable/rpc/Utils.js +48 -6
- package/dist/unstable/rpc/Utils.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts +24 -3
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js +17 -4
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +7 -7
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.js +7 -18
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +16 -15
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +22 -19
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/socket/SocketServer.d.ts +8 -5
- package/dist/unstable/socket/SocketServer.d.ts.map +1 -1
- package/dist/unstable/socket/SocketServer.js +2 -2
- package/dist/unstable/socket/SocketServer.js.map +1 -1
- 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 +5 -5
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +7 -7
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/sql/SqlConnection.d.ts +2 -2
- package/dist/unstable/sql/SqlConnection.d.ts.map +1 -1
- package/dist/unstable/sql/SqlConnection.js +5 -2
- package/dist/unstable/sql/SqlConnection.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 +8 -9
- package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
- package/dist/unstable/sql/SqlModel.js +12 -38
- 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 +26 -17
- 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.d.ts +2 -2
- package/dist/unstable/sql/Statement.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.js +2 -3
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/workers/Transferable.d.ts +4 -4
- package/dist/unstable/workers/Transferable.d.ts.map +1 -1
- package/dist/unstable/workers/Transferable.js +7 -7
- package/dist/unstable/workers/Transferable.js.map +1 -1
- package/dist/unstable/workers/Worker.d.ts +3 -3
- package/dist/unstable/workers/Worker.d.ts.map +1 -1
- package/dist/unstable/workers/Worker.js +8 -4
- package/dist/unstable/workers/Worker.js.map +1 -1
- package/dist/unstable/workers/WorkerError.d.ts +5 -5
- package/dist/unstable/workers/WorkerRunner.d.ts +2 -2
- package/dist/unstable/workers/WorkerRunner.d.ts.map +1 -1
- package/dist/unstable/workers/WorkerRunner.js +5 -2
- package/dist/unstable/workers/WorkerRunner.js.map +1 -1
- package/dist/unstable/workflow/Activity.d.ts +7 -2
- package/dist/unstable/workflow/Activity.d.ts.map +1 -1
- package/dist/unstable/workflow/Activity.js +17 -4
- package/dist/unstable/workflow/Activity.js.map +1 -1
- package/dist/unstable/workflow/DurableClock.d.ts +3 -6
- package/dist/unstable/workflow/DurableClock.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableClock.js +6 -6
- package/dist/unstable/workflow/DurableClock.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.js +15 -15
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +13 -12
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js +18 -18
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +26 -8
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +167 -17
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.js +4 -4
- package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
- package/package.json +11 -11
- 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 +27 -54
- package/src/Cause.ts +58 -23
- package/src/Channel.ts +693 -224
- package/src/Chunk.ts +149 -331
- package/src/Clock.ts +2 -2
- package/src/Combiner.ts +280 -13
- package/src/Config.ts +197 -27
- package/src/ConfigProvider.ts +5 -5
- package/src/Console.ts +2 -2
- package/src/Context.ts +1454 -0
- package/src/Cron.ts +155 -63
- package/src/Data.ts +539 -376
- package/src/DateTime.ts +77 -258
- package/src/Deferred.ts +15 -6
- package/src/Duration.ts +122 -66
- package/src/Effect.ts +1629 -1355
- package/src/Encoding.ts +879 -0
- package/src/Equal.ts +295 -111
- package/src/Equivalence.ts +114 -52
- package/src/ErrorReporter.ts +458 -0
- package/src/ExecutionPlan.ts +8 -9
- package/src/Exit.ts +24 -12
- package/src/Fiber.ts +17 -8
- package/src/FiberHandle.ts +15 -14
- package/src/FiberMap.ts +27 -27
- package/src/FiberSet.ts +5 -5
- package/src/FileSystem.ts +34 -30
- package/src/Filter.ts +4 -62
- package/src/Formatter.ts +253 -51
- package/src/Function.ts +2 -10
- package/src/Graph.ts +131 -117
- package/src/Hash.ts +2 -2
- 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 +728 -441
- package/src/LayerMap.ts +38 -35
- package/src/LogLevel.ts +37 -0
- package/src/Logger.ts +35 -102
- package/src/ManagedRuntime.ts +61 -48
- package/src/Metric.ts +64 -66
- package/src/MutableHashMap.ts +9 -0
- package/src/MutableHashSet.ts +9 -0
- package/src/MutableList.ts +3 -0
- package/src/Newtype.ts +308 -0
- package/src/Number.ts +98 -29
- 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/Path.ts +2 -2
- package/src/Pipeable.ts +32 -1
- package/src/Pool.ts +18 -16
- 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 +19 -19
- package/src/RcRef.ts +1 -1
- package/src/Record.ts +94 -199
- package/src/Redactable.ts +146 -72
- package/src/Reducer.ts +166 -7
- package/src/References.ts +283 -287
- package/src/Request.ts +8 -7
- package/src/RequestResolver.ts +34 -55
- package/src/Resource.ts +6 -5
- package/src/Result.ts +2 -4
- package/src/Runtime.ts +102 -6
- package/src/Schedule.ts +460 -451
- package/src/Scheduler.ts +52 -129
- package/src/Schema.ts +4102 -663
- package/src/SchemaAST.ts +177 -47
- package/src/SchemaGetter.ts +88 -32
- package/src/SchemaParser.ts +92 -27
- package/src/SchemaRepresentation.ts +59 -32
- package/src/SchemaTransformation.ts +364 -13
- package/src/Scope.ts +2 -2
- package/src/ScopedCache.ts +8 -8
- package/src/Semaphore.ts +442 -0
- package/src/Sink.ts +89 -34
- package/src/Stdio.ts +29 -6
- package/src/Stream.ts +898 -752
- 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 +5 -4
- package/src/Tracer.ts +23 -22
- package/src/Trie.ts +44 -31
- package/src/TxChunk.ts +26 -16
- package/src/TxDeferred.ts +391 -0
- package/src/TxHashMap.ts +347 -291
- package/src/TxHashSet.ts +54 -61
- package/src/TxPriorityQueue.ts +762 -0
- package/src/TxPubSub.ts +787 -0
- package/src/TxQueue.ts +221 -245
- package/src/TxReentrantLock.ts +729 -0
- package/src/TxRef.ts +31 -31
- package/src/TxSemaphore.ts +203 -31
- package/src/TxSubscriptionRef.ts +637 -0
- package/src/Types.ts +78 -17
- package/src/Unify.ts +26 -2
- package/src/Utils.ts +137 -111
- package/src/index.ts +898 -72
- package/src/internal/core.ts +19 -12
- package/src/internal/dateTime.ts +91 -96
- package/src/internal/effect.ts +918 -506
- package/src/internal/hashMap.ts +12 -10
- package/src/internal/layer.ts +7 -7
- package/src/internal/option.ts +7 -0
- package/src/internal/random.ts +20 -0
- package/src/internal/rcRef.ts +14 -13
- package/src/internal/references.ts +72 -0
- package/src/internal/request.ts +8 -8
- package/src/internal/schedule.ts +3 -1
- package/src/internal/schema/annotations.ts +2 -0
- package/src/internal/schema/representation.ts +81 -95
- package/src/internal/schema/schema.ts +25 -1
- 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 +333 -36
- package/src/testing/index.ts +64 -1
- package/src/unstable/ai/AiError.ts +112 -54
- package/src/unstable/ai/AnthropicStructuredOutput.ts +7 -3
- package/src/unstable/ai/Chat.ts +137 -88
- package/src/unstable/ai/EmbeddingModel.ts +209 -0
- package/src/unstable/ai/IdGenerator.ts +2 -2
- package/src/unstable/ai/LanguageModel.ts +685 -255
- package/src/unstable/ai/McpSchema.ts +84 -22
- package/src/unstable/ai/McpServer.ts +299 -87
- package/src/unstable/ai/Model.ts +44 -13
- package/src/unstable/ai/OpenAiStructuredOutput.ts +9 -2
- package/src/unstable/ai/Prompt.ts +43 -49
- package/src/unstable/ai/Response.ts +31 -33
- package/src/unstable/ai/ResponseIdTracker.ts +95 -0
- package/src/unstable/ai/Telemetry.ts +2 -2
- package/src/unstable/ai/Tokenizer.ts +2 -2
- package/src/unstable/ai/Tool.ts +62 -36
- package/src/unstable/ai/Toolkit.ts +17 -26
- package/src/unstable/ai/index.ts +24 -1
- package/src/unstable/ai/internal/codec-transformer.ts +3 -9
- package/src/unstable/cli/Argument.ts +5 -8
- package/src/unstable/cli/CliError.ts +67 -66
- package/src/unstable/cli/CliOutput.ts +87 -15
- package/src/unstable/cli/Command.ts +808 -193
- package/src/unstable/cli/Completions.ts +107 -0
- package/src/unstable/cli/Flag.ts +5 -6
- package/src/unstable/cli/GlobalFlag.ts +242 -0
- package/src/unstable/cli/HelpDoc.ts +91 -11
- package/src/unstable/cli/Param.ts +54 -27
- package/src/unstable/cli/Primitive.ts +2 -2
- package/src/unstable/cli/Prompt.ts +275 -104
- package/src/unstable/cli/index.ts +10 -0
- package/src/unstable/cli/internal/command.ts +125 -64
- package/src/unstable/cli/internal/completions/bash.ts +7 -7
- package/src/unstable/cli/internal/completions/{CommandDescriptor.ts → descriptor.ts} +16 -58
- package/src/unstable/cli/internal/completions/fish.ts +7 -7
- package/src/unstable/cli/internal/completions/zsh.ts +8 -14
- 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 +201 -84
- package/src/unstable/cluster/ClusterCron.ts +2 -2
- package/src/unstable/cluster/ClusterSchema.ts +38 -10
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +144 -81
- package/src/unstable/cluster/DeliverAt.ts +1 -1
- package/src/unstable/cluster/Entity.ts +59 -45
- package/src/unstable/cluster/EntityAddress.ts +1 -1
- package/src/unstable/cluster/EntityProxy.ts +3 -3
- package/src/unstable/cluster/EntityProxyServer.ts +4 -4
- package/src/unstable/cluster/EntityResource.ts +6 -6
- package/src/unstable/cluster/Envelope.ts +1 -1
- package/src/unstable/cluster/HttpRunner.ts +2 -2
- package/src/unstable/cluster/K8sHttpClient.ts +7 -7
- package/src/unstable/cluster/Message.ts +30 -17
- package/src/unstable/cluster/MessageStorage.ts +76 -46
- package/src/unstable/cluster/Reply.ts +13 -10
- package/src/unstable/cluster/Runner.ts +1 -1
- package/src/unstable/cluster/RunnerAddress.ts +1 -1
- package/src/unstable/cluster/RunnerHealth.ts +2 -2
- package/src/unstable/cluster/RunnerServer.ts +11 -14
- package/src/unstable/cluster/RunnerStorage.ts +9 -9
- package/src/unstable/cluster/Runners.ts +21 -19
- package/src/unstable/cluster/ShardId.ts +84 -74
- package/src/unstable/cluster/Sharding.ts +83 -66
- package/src/unstable/cluster/ShardingConfig.ts +39 -40
- package/src/unstable/cluster/Snowflake.ts +2 -2
- package/src/unstable/cluster/SqlMessageStorage.ts +28 -20
- package/src/unstable/cluster/SqlRunnerStorage.ts +1 -1
- package/src/unstable/cluster/internal/entityManager.ts +66 -46
- package/src/unstable/cluster/internal/entityReaper.ts +4 -3
- package/src/unstable/cluster/internal/resourceMap.ts +3 -3
- package/src/unstable/cluster/internal/resourceRef.ts +2 -1
- package/src/unstable/devtools/DevToolsClient.ts +26 -21
- 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/Event.ts +0 -8
- package/src/unstable/eventlog/EventGroup.ts +0 -4
- package/src/unstable/eventlog/EventJournal.ts +148 -80
- package/src/unstable/eventlog/EventLog.ts +360 -233
- package/src/unstable/eventlog/EventLogEncryption.ts +18 -32
- package/src/unstable/eventlog/EventLogMessage.ts +277 -0
- package/src/unstable/eventlog/EventLogRemote.ts +264 -410
- package/src/unstable/eventlog/EventLogServer.ts +183 -275
- package/src/unstable/eventlog/EventLogServerEncrypted.ts +206 -0
- package/src/unstable/eventlog/EventLogServerUnencrypted.ts +749 -0
- package/src/unstable/eventlog/EventLogSessionAuth.ts +437 -0
- package/src/unstable/eventlog/{SqlEventLogJournal.ts → SqlEventJournal.ts} +28 -20
- package/src/unstable/eventlog/{SqlEventLogServer.ts → SqlEventLogServerEncrypted.ts} +102 -40
- package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +500 -0
- package/src/unstable/eventlog/index.ts +27 -2
- package/src/unstable/eventlog/internal/identityRootSecretDerivation.ts +153 -0
- package/src/unstable/http/Cookies.ts +94 -11
- package/src/unstable/http/Etag.ts +7 -5
- package/src/unstable/http/FetchHttpClient.ts +5 -5
- package/src/unstable/http/Headers.ts +70 -20
- package/src/unstable/http/HttpClient.ts +385 -42
- package/src/unstable/http/HttpClientRequest.ts +151 -39
- package/src/unstable/http/HttpClientResponse.ts +12 -6
- package/src/unstable/http/HttpEffect.ts +86 -100
- package/src/unstable/http/HttpIncomingMessage.ts +5 -4
- package/src/unstable/http/HttpMethod.ts +16 -4
- package/src/unstable/http/HttpMiddleware.ts +50 -50
- package/src/unstable/http/HttpPlatform.ts +5 -4
- package/src/unstable/http/HttpRouter.ts +46 -46
- package/src/unstable/http/HttpServer.ts +5 -11
- package/src/unstable/http/HttpServerError.ts +45 -47
- package/src/unstable/http/HttpServerRequest.ts +414 -23
- package/src/unstable/http/HttpServerRespondable.ts +6 -6
- package/src/unstable/http/HttpServerResponse.ts +351 -13
- package/src/unstable/http/HttpStaticServer.ts +456 -0
- package/src/unstable/http/HttpTraceContext.ts +31 -17
- package/src/unstable/http/Multipart.ts +10 -10
- 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 +21 -21
- package/src/unstable/httpapi/HttpApiBuilder.ts +128 -55
- package/src/unstable/httpapi/HttpApiClient.ts +186 -34
- package/src/unstable/httpapi/HttpApiEndpoint.ts +225 -113
- package/src/unstable/httpapi/HttpApiError.ts +108 -30
- package/src/unstable/httpapi/HttpApiGroup.ts +18 -17
- package/src/unstable/httpapi/HttpApiMiddleware.ts +95 -33
- package/src/unstable/httpapi/HttpApiScalar.ts +6 -0
- package/src/unstable/httpapi/HttpApiSchema.ts +106 -11
- package/src/unstable/httpapi/HttpApiSecurity.ts +13 -13
- package/src/unstable/httpapi/OpenApi.ts +71 -58
- package/src/unstable/observability/Otlp.ts +12 -12
- package/src/unstable/observability/OtlpExporter.ts +14 -10
- package/src/unstable/observability/OtlpLogger.ts +13 -9
- package/src/unstable/observability/OtlpMetrics.ts +5 -5
- package/src/unstable/observability/OtlpSerialization.ts +2 -2
- package/src/unstable/observability/OtlpTracer.ts +14 -10
- package/src/unstable/observability/PrometheusMetrics.ts +5 -5
- package/src/unstable/persistence/KeyValueStore.ts +230 -7
- package/src/unstable/persistence/Persistable.ts +3 -3
- package/src/unstable/persistence/PersistedCache.ts +35 -21
- package/src/unstable/persistence/PersistedQueue.ts +28 -27
- package/src/unstable/persistence/Persistence.ts +7 -7
- package/src/unstable/persistence/RateLimiter.ts +7 -7
- package/src/unstable/persistence/Redis.ts +2 -2
- package/src/unstable/process/ChildProcess.ts +6 -208
- package/src/unstable/process/ChildProcessSpawner.ts +120 -15
- package/src/unstable/reactivity/Atom.ts +280 -124
- package/src/unstable/reactivity/AtomHttpApi.ts +115 -59
- package/src/unstable/reactivity/AtomRegistry.ts +70 -16
- package/src/unstable/reactivity/AtomRpc.ts +82 -37
- package/src/unstable/reactivity/Reactivity.ts +6 -6
- package/src/unstable/reactivity/index.ts +2 -2
- package/src/unstable/rpc/Rpc.ts +77 -32
- package/src/unstable/rpc/RpcClient.ts +165 -145
- package/src/unstable/rpc/RpcGroup.ts +51 -34
- package/src/unstable/rpc/RpcMiddleware.ts +28 -22
- package/src/unstable/rpc/RpcSchema.ts +24 -6
- package/src/unstable/rpc/RpcSerialization.ts +56 -18
- package/src/unstable/rpc/RpcServer.ts +97 -69
- package/src/unstable/rpc/RpcWorker.ts +5 -5
- package/src/unstable/rpc/Utils.ts +65 -5
- package/src/unstable/schema/Model.ts +35 -6
- package/src/unstable/schema/VariantSchema.ts +14 -27
- package/src/unstable/socket/Socket.ts +42 -38
- package/src/unstable/socket/SocketServer.ts +2 -2
- package/src/unstable/sql/Migrator.ts +7 -5
- package/src/unstable/sql/SqlClient.ts +13 -11
- package/src/unstable/sql/SqlConnection.ts +2 -2
- package/src/unstable/sql/SqlError.ts +365 -11
- package/src/unstable/sql/SqlModel.ts +57 -85
- package/src/unstable/sql/SqlResolver.ts +26 -16
- package/src/unstable/sql/SqlSchema.ts +42 -26
- package/src/unstable/sql/Statement.ts +2 -3
- package/src/unstable/workers/Transferable.ts +17 -19
- package/src/unstable/workers/Worker.ts +6 -5
- package/src/unstable/workers/WorkerRunner.ts +2 -2
- package/src/unstable/workflow/Activity.ts +27 -4
- package/src/unstable/workflow/DurableClock.ts +11 -11
- package/src/unstable/workflow/DurableDeferred.ts +16 -16
- package/src/unstable/workflow/Workflow.ts +32 -25
- package/src/unstable/workflow/WorkflowEngine.ts +239 -25
- package/src/unstable/workflow/WorkflowProxyServer.ts +4 -4
- 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/ServiceMap.d.ts +0 -1126
- package/dist/ServiceMap.d.ts.map +0 -1
- package/dist/ServiceMap.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/CommandDescriptor.d.ts +0 -2
- package/dist/unstable/cli/internal/completions/CommandDescriptor.d.ts.map +0 -1
- package/dist/unstable/cli/internal/completions/CommandDescriptor.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/dist/unstable/eventlog/SqlEventLogJournal.d.ts.map +0 -1
- package/dist/unstable/eventlog/SqlEventLogJournal.js.map +0 -1
- package/dist/unstable/eventlog/SqlEventLogServer.d.ts.map +0 -1
- package/dist/unstable/eventlog/SqlEventLogServer.js.map +0 -1
- package/src/NullOr.ts +0 -204
- package/src/ServiceMap.ts +0 -1410
- 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
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as Context from "./Context.js";
|
|
1
2
|
import * as Duration from "./Duration.js";
|
|
2
3
|
import * as Exit from "./Exit.js";
|
|
3
4
|
import { constant, dual } from "./Function.js";
|
|
@@ -9,7 +10,6 @@ import * as internalRequest from "./internal/request.js";
|
|
|
9
10
|
import * as internalSchedule from "./internal/schedule.js";
|
|
10
11
|
import * as Metric from "./Metric.js";
|
|
11
12
|
import { CurrentLogAnnotations, CurrentLogSpans } from "./References.js";
|
|
12
|
-
import * as ServiceMap from "./ServiceMap.js";
|
|
13
13
|
import { internalCall, SingleShotGen } from "./Utils.js";
|
|
14
14
|
const TypeId = core.EffectTypeId;
|
|
15
15
|
/**
|
|
@@ -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
|
|
@@ -2645,13 +2809,16 @@ export const ignoreCause = internal.ignoreCause;
|
|
|
2645
2809
|
*
|
|
2646
2810
|
* @example
|
|
2647
2811
|
* ```ts
|
|
2648
|
-
* import { Effect, ExecutionPlan, Layer,
|
|
2812
|
+
* import { Effect, ExecutionPlan, Layer, Context } from "effect"
|
|
2649
2813
|
*
|
|
2650
|
-
* const Endpoint =
|
|
2814
|
+
* const Endpoint = Context.Service<{ url: string }>("Endpoint")
|
|
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"
|
|
3398
|
+
*
|
|
3399
|
+
* class ExampleError extends Data.TaggedError("ExampleError")<{ readonly message: string }> {}
|
|
3196
3400
|
*
|
|
3197
|
-
* const success: Effect.Effect<number,
|
|
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"
|
|
3354
3558
|
*
|
|
3355
|
-
*
|
|
3559
|
+
* class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
|
|
3560
|
+
*
|
|
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"
|
|
3412
3618
|
*
|
|
3413
|
-
*
|
|
3414
|
-
*
|
|
3415
|
-
*
|
|
3619
|
+
* class ExampleError extends Data.TaggedError("ExampleError")<{ readonly message: string }> {}
|
|
3620
|
+
*
|
|
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, {
|
|
@@ -3506,7 +3714,7 @@ export const isSuccess = internal.isSuccess;
|
|
|
3506
3714
|
// Environment
|
|
3507
3715
|
// -----------------------------------------------------------------------------
|
|
3508
3716
|
/**
|
|
3509
|
-
* Returns the complete
|
|
3717
|
+
* Returns the complete context.
|
|
3510
3718
|
*
|
|
3511
3719
|
* This function allows you to access all services that are currently available
|
|
3512
3720
|
* in the effect's environment. This can be useful for debugging, introspection,
|
|
@@ -3514,56 +3722,56 @@ export const isSuccess = internal.isSuccess;
|
|
|
3514
3722
|
*
|
|
3515
3723
|
* @example
|
|
3516
3724
|
* ```ts
|
|
3517
|
-
* import { Console, Effect, Option,
|
|
3725
|
+
* import { Console, Effect, Option, Context } from "effect"
|
|
3518
3726
|
*
|
|
3519
|
-
* const Logger =
|
|
3727
|
+
* const Logger = Context.Service<{
|
|
3520
3728
|
* log: (msg: string) => void
|
|
3521
3729
|
* }>("Logger")
|
|
3522
|
-
* const Database =
|
|
3730
|
+
* const Database = Context.Service<{
|
|
3523
3731
|
* query: (sql: string) => string
|
|
3524
3732
|
* }>("Database")
|
|
3525
3733
|
*
|
|
3526
3734
|
* const program = Effect.gen(function*() {
|
|
3527
|
-
* const allServices = yield* Effect.
|
|
3735
|
+
* const allServices = yield* Effect.context()
|
|
3528
3736
|
*
|
|
3529
3737
|
* // Check if specific services are available
|
|
3530
|
-
* const loggerOption =
|
|
3531
|
-
* const databaseOption =
|
|
3738
|
+
* const loggerOption = Context.getOption(allServices, Logger)
|
|
3739
|
+
* const databaseOption = Context.getOption(allServices, Database)
|
|
3532
3740
|
*
|
|
3533
3741
|
* yield* Console.log(`Logger available: ${Option.isSome(loggerOption)}`)
|
|
3534
3742
|
* yield* Console.log(`Database available: ${Option.isSome(databaseOption)}`)
|
|
3535
3743
|
* })
|
|
3536
3744
|
*
|
|
3537
|
-
* const
|
|
3538
|
-
* .pipe(
|
|
3745
|
+
* const context = Context.make(Logger, { log: console.log })
|
|
3746
|
+
* .pipe(Context.add(Database, { query: () => "result" }))
|
|
3539
3747
|
*
|
|
3540
|
-
* const provided = Effect.
|
|
3748
|
+
* const provided = Effect.provideContext(program, context)
|
|
3541
3749
|
* ```
|
|
3542
3750
|
*
|
|
3543
3751
|
* @since 2.0.0
|
|
3544
3752
|
* @category Environment
|
|
3545
3753
|
*/
|
|
3546
|
-
export const
|
|
3754
|
+
export const context = internal.context;
|
|
3547
3755
|
/**
|
|
3548
|
-
* Transforms the current
|
|
3756
|
+
* Transforms the current context using the provided function.
|
|
3549
3757
|
*
|
|
3550
|
-
* This function allows you to access the complete
|
|
3758
|
+
* This function allows you to access the complete context and perform
|
|
3551
3759
|
* computations based on all available services. This is useful when you need
|
|
3552
3760
|
* to conditionally execute logic based on what services are available.
|
|
3553
3761
|
*
|
|
3554
3762
|
* @example
|
|
3555
3763
|
* ```ts
|
|
3556
|
-
* import { Console, Effect, Option,
|
|
3764
|
+
* import { Console, Effect, Option, Context } from "effect"
|
|
3557
3765
|
*
|
|
3558
|
-
* const Logger =
|
|
3766
|
+
* const Logger = Context.Service<{
|
|
3559
3767
|
* log: (msg: string) => void
|
|
3560
3768
|
* }>("Logger")
|
|
3561
|
-
* const Cache =
|
|
3769
|
+
* const Cache = Context.Service<{
|
|
3562
3770
|
* get: (key: string) => string | null
|
|
3563
3771
|
* }>("Cache")
|
|
3564
3772
|
*
|
|
3565
|
-
* const program = Effect.
|
|
3566
|
-
* const cacheOption =
|
|
3773
|
+
* const program = Effect.contextWith((services) => {
|
|
3774
|
+
* const cacheOption = Context.getOption(services, Cache)
|
|
3567
3775
|
* const hasCache = Option.isSome(cacheOption)
|
|
3568
3776
|
*
|
|
3569
3777
|
* if (hasCache) {
|
|
@@ -3588,7 +3796,7 @@ export const services = internal.services;
|
|
|
3588
3796
|
* @since 2.0.0
|
|
3589
3797
|
* @category Environment
|
|
3590
3798
|
*/
|
|
3591
|
-
export const
|
|
3799
|
+
export const contextWith = internal.contextWith;
|
|
3592
3800
|
/**
|
|
3593
3801
|
* Provides dependencies to an effect using layers or a context. Use `options.local`
|
|
3594
3802
|
* to build the layer every time; by default, layers are shared between provide
|
|
@@ -3596,16 +3804,16 @@ export const servicesWith = internal.servicesWith;
|
|
|
3596
3804
|
*
|
|
3597
3805
|
* @example
|
|
3598
3806
|
* ```ts
|
|
3599
|
-
* import { Effect, Layer,
|
|
3807
|
+
* import { Effect, Layer, Context } from "effect"
|
|
3600
3808
|
*
|
|
3601
3809
|
* interface Database {
|
|
3602
3810
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
3603
3811
|
* }
|
|
3604
3812
|
*
|
|
3605
|
-
* const Database =
|
|
3813
|
+
* const Database = Context.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*() {
|
|
@@ -3624,29 +3832,29 @@ export const servicesWith = internal.servicesWith;
|
|
|
3624
3832
|
*/
|
|
3625
3833
|
export const provide = internalLayer.provide;
|
|
3626
3834
|
/**
|
|
3627
|
-
* Provides a
|
|
3835
|
+
* Provides a context to an effect, fulfilling its service requirements.
|
|
3628
3836
|
*
|
|
3629
3837
|
* **Details**
|
|
3630
3838
|
*
|
|
3631
|
-
* This function provides multiple services at once by supplying a
|
|
3839
|
+
* This function provides multiple services at once by supplying a context
|
|
3632
3840
|
* that contains all the required services. It removes the provided services
|
|
3633
3841
|
* from the effect's requirements, making them available to the effect.
|
|
3634
3842
|
*
|
|
3635
3843
|
* @example
|
|
3636
3844
|
* ```ts
|
|
3637
|
-
* import { Effect,
|
|
3845
|
+
* import { Effect, Context } from "effect"
|
|
3638
3846
|
*
|
|
3639
3847
|
* // Define service keys
|
|
3640
|
-
* const Logger =
|
|
3848
|
+
* const Logger = Context.Service<{
|
|
3641
3849
|
* log: (msg: string) => void
|
|
3642
3850
|
* }>("Logger")
|
|
3643
|
-
* const Database =
|
|
3851
|
+
* const Database = Context.Service<{
|
|
3644
3852
|
* query: (sql: string) => string
|
|
3645
3853
|
* }>("Database")
|
|
3646
3854
|
*
|
|
3647
|
-
* // Create
|
|
3648
|
-
* const
|
|
3649
|
-
* .pipe(
|
|
3855
|
+
* // Create a context with multiple services
|
|
3856
|
+
* const context = Context.make(Logger, { log: console.log })
|
|
3857
|
+
* .pipe(Context.add(Database, { query: () => "result" }))
|
|
3650
3858
|
*
|
|
3651
3859
|
* // An effect that requires both services
|
|
3652
3860
|
* const program = Effect.gen(function*() {
|
|
@@ -3656,25 +3864,25 @@ export const provide = internalLayer.provide;
|
|
|
3656
3864
|
* return db.query("SELECT * FROM users")
|
|
3657
3865
|
* })
|
|
3658
3866
|
*
|
|
3659
|
-
* const provided = Effect.
|
|
3867
|
+
* const provided = Effect.provideContext(program, context)
|
|
3660
3868
|
* ```
|
|
3661
3869
|
*
|
|
3662
3870
|
* @since 2.0.0
|
|
3663
3871
|
* @category Environment
|
|
3664
3872
|
*/
|
|
3665
|
-
export const
|
|
3873
|
+
export const provideContext = internal.provideContext;
|
|
3666
3874
|
/**
|
|
3667
3875
|
* Accesses a service from the context.
|
|
3668
3876
|
*
|
|
3669
3877
|
* @example
|
|
3670
3878
|
* ```ts
|
|
3671
|
-
* import { Effect,
|
|
3879
|
+
* import { Effect, Context } from "effect"
|
|
3672
3880
|
*
|
|
3673
3881
|
* interface Database {
|
|
3674
3882
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
3675
3883
|
* }
|
|
3676
3884
|
*
|
|
3677
|
-
* const Database =
|
|
3885
|
+
* const Database = Context.Service<Database>("Database")
|
|
3678
3886
|
*
|
|
3679
3887
|
* const program = Effect.gen(function*() {
|
|
3680
3888
|
* const db = yield* Effect.service(Database)
|
|
@@ -3683,7 +3891,7 @@ export const provideServices = internal.provideServices;
|
|
|
3683
3891
|
* ```
|
|
3684
3892
|
*
|
|
3685
3893
|
* @since 4.0.0
|
|
3686
|
-
* @category
|
|
3894
|
+
* @category Context
|
|
3687
3895
|
*/
|
|
3688
3896
|
export const service = internal.service;
|
|
3689
3897
|
/**
|
|
@@ -3698,10 +3906,10 @@ export const service = internal.service;
|
|
|
3698
3906
|
*
|
|
3699
3907
|
* @example
|
|
3700
3908
|
* ```ts
|
|
3701
|
-
* import { Effect, Option,
|
|
3909
|
+
* import { Effect, Option, Context } from "effect"
|
|
3702
3910
|
*
|
|
3703
3911
|
* // Define a service key
|
|
3704
|
-
* const Logger =
|
|
3912
|
+
* const Logger = Context.Service<{
|
|
3705
3913
|
* log: (msg: string) => void
|
|
3706
3914
|
* }>("Logger")
|
|
3707
3915
|
*
|
|
@@ -3718,7 +3926,7 @@ export const service = internal.service;
|
|
|
3718
3926
|
* ```
|
|
3719
3927
|
*
|
|
3720
3928
|
* @since 2.0.0
|
|
3721
|
-
* @category
|
|
3929
|
+
* @category Context
|
|
3722
3930
|
*/
|
|
3723
3931
|
export const serviceOption = internal.serviceOption;
|
|
3724
3932
|
/**
|
|
@@ -3731,13 +3939,13 @@ export const serviceOption = internal.serviceOption;
|
|
|
3731
3939
|
*
|
|
3732
3940
|
* @example
|
|
3733
3941
|
* ```ts
|
|
3734
|
-
* import { Effect,
|
|
3942
|
+
* import { Effect, Context } from "effect"
|
|
3735
3943
|
*
|
|
3736
3944
|
* // Define services
|
|
3737
|
-
* const Logger =
|
|
3945
|
+
* const Logger = Context.Service<{
|
|
3738
3946
|
* log: (msg: string) => void
|
|
3739
3947
|
* }>("Logger")
|
|
3740
|
-
* const Config =
|
|
3948
|
+
* const Config = Context.Service<{
|
|
3741
3949
|
* name: string
|
|
3742
3950
|
* }>("Config")
|
|
3743
3951
|
*
|
|
@@ -3747,8 +3955,8 @@ export const serviceOption = internal.serviceOption;
|
|
|
3747
3955
|
*
|
|
3748
3956
|
* // Transform services by providing Config while keeping Logger requirement
|
|
3749
3957
|
* const configured = program.pipe(
|
|
3750
|
-
* Effect.
|
|
3751
|
-
*
|
|
3958
|
+
* Effect.updateContext((context: Context.Context<typeof Logger>) =>
|
|
3959
|
+
* Context.add(context, Config, { name: "World" })
|
|
3752
3960
|
* )
|
|
3753
3961
|
* )
|
|
3754
3962
|
*
|
|
@@ -3759,18 +3967,18 @@ export const serviceOption = internal.serviceOption;
|
|
|
3759
3967
|
* ```
|
|
3760
3968
|
*
|
|
3761
3969
|
* @since 4.0.0
|
|
3762
|
-
* @category
|
|
3970
|
+
* @category Context
|
|
3763
3971
|
*/
|
|
3764
|
-
export const
|
|
3972
|
+
export const updateContext = internal.updateContext;
|
|
3765
3973
|
/**
|
|
3766
3974
|
* Updates the service with the required service entry.
|
|
3767
3975
|
*
|
|
3768
3976
|
* @example
|
|
3769
3977
|
* ```ts
|
|
3770
|
-
* import { Console, Effect,
|
|
3978
|
+
* import { Console, Effect, Context } from "effect"
|
|
3771
3979
|
*
|
|
3772
3980
|
* // Define a counter service
|
|
3773
|
-
* const Counter =
|
|
3981
|
+
* const Counter = Context.Service<{ count: number }>("Counter")
|
|
3774
3982
|
*
|
|
3775
3983
|
* const program = Effect.gen(function*() {
|
|
3776
3984
|
* const updatedCounter = yield* Effect.service(Counter)
|
|
@@ -3788,7 +3996,7 @@ export const updateServices = internal.updateServices;
|
|
|
3788
3996
|
* ```
|
|
3789
3997
|
*
|
|
3790
3998
|
* @since 2.0.0
|
|
3791
|
-
* @category
|
|
3999
|
+
* @category Context
|
|
3792
4000
|
*/
|
|
3793
4001
|
export const updateService = internal.updateService;
|
|
3794
4002
|
/**
|
|
@@ -3805,10 +4013,10 @@ export const updateService = internal.updateService;
|
|
|
3805
4013
|
*
|
|
3806
4014
|
* @example
|
|
3807
4015
|
* ```ts
|
|
3808
|
-
* import { Console, Effect,
|
|
4016
|
+
* import { Console, Effect, Context } from "effect"
|
|
3809
4017
|
*
|
|
3810
4018
|
* // Define a service for configuration
|
|
3811
|
-
* const Config =
|
|
4019
|
+
* const Config = Context.Service<{
|
|
3812
4020
|
* apiUrl: string
|
|
3813
4021
|
* timeout: number
|
|
3814
4022
|
* }>("Config")
|
|
@@ -3834,7 +4042,7 @@ export const updateService = internal.updateService;
|
|
|
3834
4042
|
* ```
|
|
3835
4043
|
*
|
|
3836
4044
|
* @since 2.0.0
|
|
3837
|
-
* @category
|
|
4045
|
+
* @category Context
|
|
3838
4046
|
*/
|
|
3839
4047
|
export const provideService = internal.provideService;
|
|
3840
4048
|
/**
|
|
@@ -3849,13 +4057,13 @@ export const provideService = internal.provideService;
|
|
|
3849
4057
|
*
|
|
3850
4058
|
* @example
|
|
3851
4059
|
* ```ts
|
|
3852
|
-
* import { Console, Effect,
|
|
4060
|
+
* import { Console, Effect, Context } from "effect"
|
|
3853
4061
|
*
|
|
3854
4062
|
* // Define a database connection service
|
|
3855
4063
|
* interface DatabaseConnection {
|
|
3856
4064
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
3857
4065
|
* }
|
|
3858
|
-
* const Database =
|
|
4066
|
+
* const Database = Context.Service<DatabaseConnection>("Database")
|
|
3859
4067
|
*
|
|
3860
4068
|
* // Effect that creates a database connection
|
|
3861
4069
|
* const createConnection = Effect.gen(function*() {
|
|
@@ -3887,7 +4095,7 @@ export const provideService = internal.provideService;
|
|
|
3887
4095
|
* ```
|
|
3888
4096
|
*
|
|
3889
4097
|
* @since 2.0.0
|
|
3890
|
-
* @category
|
|
4098
|
+
* @category Context
|
|
3891
4099
|
*/
|
|
3892
4100
|
export const provideServiceEffect = internal.provideServiceEffect;
|
|
3893
4101
|
// -----------------------------------------------------------------------------
|
|
@@ -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"
|
|
4249
4457
|
*
|
|
4250
|
-
*
|
|
4458
|
+
* class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
|
|
4459
|
+
*
|
|
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
|
* ```
|
|
@@ -5518,7 +5624,7 @@ export const withParentSpan = internal.withParentSpan;
|
|
|
5518
5624
|
export const request = internalRequest.request;
|
|
5519
5625
|
/**
|
|
5520
5626
|
* Low-level entry point that registers a request with a resolver and delivers the exit value via `onExit`.
|
|
5521
|
-
* Use this when you already have a `
|
|
5627
|
+
* Use this when you already have a `Context` and need to enqueue a request outside an `Effect`.
|
|
5522
5628
|
*
|
|
5523
5629
|
* It returns a canceler that removes the pending request entry.
|
|
5524
5630
|
*
|
|
@@ -5763,15 +5869,15 @@ export const runFork = internal.runFork;
|
|
|
5763
5869
|
*
|
|
5764
5870
|
* @example
|
|
5765
5871
|
* ```ts
|
|
5766
|
-
* import { Effect,
|
|
5872
|
+
* import { Effect, Context } from "effect"
|
|
5767
5873
|
*
|
|
5768
5874
|
* interface Logger {
|
|
5769
5875
|
* log: (message: string) => void
|
|
5770
5876
|
* }
|
|
5771
5877
|
*
|
|
5772
|
-
* const Logger =
|
|
5878
|
+
* const Logger = Context.Service<Logger>("Logger")
|
|
5773
5879
|
*
|
|
5774
|
-
* const services =
|
|
5880
|
+
* const services = Context.make(Logger, {
|
|
5775
5881
|
* log: (message) => console.log(message)
|
|
5776
5882
|
* })
|
|
5777
5883
|
*
|
|
@@ -5795,15 +5901,15 @@ export const runForkWith = internal.runForkWith;
|
|
|
5795
5901
|
*
|
|
5796
5902
|
* @example
|
|
5797
5903
|
* ```ts
|
|
5798
|
-
* import { Console, Effect, Exit,
|
|
5904
|
+
* import { Console, Effect, Exit, Context } from "effect"
|
|
5799
5905
|
*
|
|
5800
5906
|
* interface Logger {
|
|
5801
5907
|
* log: (message: string) => Effect.Effect<void>
|
|
5802
5908
|
* }
|
|
5803
5909
|
*
|
|
5804
|
-
* const Logger =
|
|
5910
|
+
* const Logger = Context.Service<Logger>("Logger")
|
|
5805
5911
|
*
|
|
5806
|
-
* const services =
|
|
5912
|
+
* const services = Context.make(Logger, {
|
|
5807
5913
|
* log: (message) => Console.log(message)
|
|
5808
5914
|
* })
|
|
5809
5915
|
*
|
|
@@ -5907,15 +6013,15 @@ export const runPromise = internal.runPromise;
|
|
|
5907
6013
|
*
|
|
5908
6014
|
* @example
|
|
5909
6015
|
* ```ts
|
|
5910
|
-
* import { Effect,
|
|
6016
|
+
* import { Effect, Context } from "effect"
|
|
5911
6017
|
*
|
|
5912
6018
|
* interface Config {
|
|
5913
6019
|
* apiUrl: string
|
|
5914
6020
|
* }
|
|
5915
6021
|
*
|
|
5916
|
-
* const Config =
|
|
6022
|
+
* const Config = Context.Service<Config>("Config")
|
|
5917
6023
|
*
|
|
5918
|
-
* const
|
|
6024
|
+
* const context = Context.make(Config, {
|
|
5919
6025
|
* apiUrl: "https://api.example.com"
|
|
5920
6026
|
* })
|
|
5921
6027
|
*
|
|
@@ -5924,7 +6030,7 @@ export const runPromise = internal.runPromise;
|
|
|
5924
6030
|
* return `Connecting to ${config.apiUrl}`
|
|
5925
6031
|
* })
|
|
5926
6032
|
*
|
|
5927
|
-
* Effect.runPromiseWith(
|
|
6033
|
+
* Effect.runPromiseWith(context)(program).then(console.log)
|
|
5928
6034
|
* ```
|
|
5929
6035
|
*
|
|
5930
6036
|
* @since 4.0.0
|
|
@@ -5984,15 +6090,15 @@ export const runPromiseExit = internal.runPromiseExit;
|
|
|
5984
6090
|
*
|
|
5985
6091
|
* @example
|
|
5986
6092
|
* ```ts
|
|
5987
|
-
* import { Effect, Exit,
|
|
6093
|
+
* import { Effect, Exit, Context } from "effect"
|
|
5988
6094
|
*
|
|
5989
6095
|
* interface Database {
|
|
5990
6096
|
* query: (sql: string) => string
|
|
5991
6097
|
* }
|
|
5992
6098
|
*
|
|
5993
|
-
* const Database =
|
|
6099
|
+
* const Database = Context.Service<Database>("Database")
|
|
5994
6100
|
*
|
|
5995
|
-
* const services =
|
|
6101
|
+
* const services = Context.make(Database, {
|
|
5996
6102
|
* query: (sql) => `Result for: ${sql}`
|
|
5997
6103
|
* })
|
|
5998
6104
|
*
|
|
@@ -6075,15 +6181,15 @@ export const runSync = internal.runSync;
|
|
|
6075
6181
|
*
|
|
6076
6182
|
* @example
|
|
6077
6183
|
* ```ts
|
|
6078
|
-
* import { Effect,
|
|
6184
|
+
* import { Effect, Context } from "effect"
|
|
6079
6185
|
*
|
|
6080
6186
|
* interface MathService {
|
|
6081
6187
|
* add: (a: number, b: number) => number
|
|
6082
6188
|
* }
|
|
6083
6189
|
*
|
|
6084
|
-
* const MathService =
|
|
6190
|
+
* const MathService = Context.Service<MathService>("MathService")
|
|
6085
6191
|
*
|
|
6086
|
-
* const
|
|
6192
|
+
* const context = Context.make(MathService, {
|
|
6087
6193
|
* add: (a, b) => a + b
|
|
6088
6194
|
* })
|
|
6089
6195
|
*
|
|
@@ -6092,7 +6198,7 @@ export const runSync = internal.runSync;
|
|
|
6092
6198
|
* return math.add(2, 3)
|
|
6093
6199
|
* })
|
|
6094
6200
|
*
|
|
6095
|
-
* const result = Effect.runSyncWith(
|
|
6201
|
+
* const result = Effect.runSyncWith(context)(program)
|
|
6096
6202
|
* console.log(result) // 5
|
|
6097
6203
|
* ```
|
|
6098
6204
|
*
|
|
@@ -6175,10 +6281,10 @@ export const runSyncExit = internal.runSyncExit;
|
|
|
6175
6281
|
*
|
|
6176
6282
|
* @example
|
|
6177
6283
|
* ```ts
|
|
6178
|
-
* import { Effect, Exit,
|
|
6284
|
+
* import { Effect, Exit, Context } from "effect"
|
|
6179
6285
|
*
|
|
6180
6286
|
* // Define a logger service
|
|
6181
|
-
* const Logger =
|
|
6287
|
+
* const Logger = Context.Service<{
|
|
6182
6288
|
* log: (msg: string) => void
|
|
6183
6289
|
* }>("Logger")
|
|
6184
6290
|
*
|
|
@@ -6188,12 +6294,12 @@ export const runSyncExit = internal.runSyncExit;
|
|
|
6188
6294
|
* return 42
|
|
6189
6295
|
* })
|
|
6190
6296
|
*
|
|
6191
|
-
* // Prepare
|
|
6192
|
-
* const
|
|
6297
|
+
* // Prepare context
|
|
6298
|
+
* const context = Context.make(Logger, {
|
|
6193
6299
|
* log: (msg) => console.log(`[LOG] ${msg}`)
|
|
6194
6300
|
* })
|
|
6195
6301
|
*
|
|
6196
|
-
* const exit = Effect.runSyncExitWith(
|
|
6302
|
+
* const exit = Effect.runSyncExitWith(context)(program)
|
|
6197
6303
|
*
|
|
6198
6304
|
* if (Exit.isSuccess(exit)) {
|
|
6199
6305
|
* console.log(`Success: ${exit.value}`)
|
|
@@ -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
|
});
|
|
@@ -6895,21 +7029,24 @@ export const trackDuration = /*#__PURE__*/dual(args => isEffect(args[0]), (self,
|
|
|
6895
7029
|
* @since 4.0.0
|
|
6896
7030
|
* @category Transactions
|
|
6897
7031
|
*/
|
|
6898
|
-
export class Transaction extends /*#__PURE__*/
|
|
7032
|
+
export class Transaction extends /*#__PURE__*/Context.Service()("effect/Effect/Transaction") {}
|
|
6899
7033
|
/**
|
|
6900
|
-
* Defines a transaction. Transactions are "all or nothing" with respect to changes
|
|
6901
|
-
* transactional values (i.e. TxRef) that occur within the transaction body.
|
|
7034
|
+
* Defines a transaction boundary. Transactions are "all or nothing" with respect to changes
|
|
7035
|
+
* made to transactional values (i.e. TxRef) that occur within the transaction body.
|
|
7036
|
+
*
|
|
7037
|
+
* If called inside an active transaction, `tx` composes with the current transaction and reuses
|
|
7038
|
+
* its journal and retry state instead of creating a nested boundary.
|
|
6902
7039
|
*
|
|
6903
7040
|
* In Effect transactions are optimistic with retry, that means transactions are retried when:
|
|
6904
7041
|
*
|
|
6905
|
-
* - the body of the transaction explicitely calls to `Effect.
|
|
7042
|
+
* - the body of the transaction explicitely calls to `Effect.txRetry` and any of the
|
|
6906
7043
|
* accessed transactional values changes.
|
|
6907
7044
|
*
|
|
6908
7045
|
* - any of the accessed transactional values change during the execution of the transaction
|
|
6909
7046
|
* due to a different transaction committing before the current.
|
|
6910
7047
|
*
|
|
6911
|
-
*
|
|
6912
|
-
*
|
|
7048
|
+
* The outermost `tx` call creates the transaction boundary and commits or rolls back the full
|
|
7049
|
+
* composed transaction.
|
|
6913
7050
|
*
|
|
6914
7051
|
* @example
|
|
6915
7052
|
* ```ts
|
|
@@ -6919,10 +7056,10 @@ export class Transaction extends /*#__PURE__*/ServiceMap.Service()("effect/Effec
|
|
|
6919
7056
|
* const ref1 = yield* TxRef.make(0)
|
|
6920
7057
|
* const ref2 = yield* TxRef.make(0)
|
|
6921
7058
|
*
|
|
6922
|
-
* //
|
|
6923
|
-
* yield* Effect.
|
|
7059
|
+
* // Nested tx calls compose into the same transaction
|
|
7060
|
+
* yield* Effect.tx(Effect.gen(function*() {
|
|
6924
7061
|
* yield* TxRef.set(ref1, 10)
|
|
6925
|
-
* yield* TxRef.set(ref2, 20)
|
|
7062
|
+
* yield* Effect.tx(TxRef.set(ref2, 20))
|
|
6926
7063
|
* const sum = (yield* TxRef.get(ref1)) + (yield* TxRef.get(ref2))
|
|
6927
7064
|
* console.log(`Transaction sum: ${sum}`)
|
|
6928
7065
|
* }))
|
|
@@ -6935,139 +7072,19 @@ export class Transaction extends /*#__PURE__*/ServiceMap.Service()("effect/Effec
|
|
|
6935
7072
|
* @since 4.0.0
|
|
6936
7073
|
* @category Transactions
|
|
6937
7074
|
*/
|
|
6938
|
-
export const
|
|
6939
|
-
|
|
6940
|
-
|
|
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}`)
|
|
6953
|
-
*
|
|
6954
|
-
* yield* TxRef.set(ref, 42)
|
|
6955
|
-
* return yield* TxRef.get(ref)
|
|
6956
|
-
* })
|
|
6957
|
-
* )
|
|
6958
|
-
*
|
|
6959
|
-
* Effect.runPromise(program).then(console.log) // 42
|
|
6960
|
-
* ```
|
|
6961
|
-
*
|
|
6962
|
-
* @since 4.0.0
|
|
6963
|
-
* @category Transactions
|
|
6964
|
-
*/
|
|
6965
|
-
export const atomicWith = f => withFiber(fiber => {
|
|
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)));
|
|
7075
|
+
export const tx = effect => withFiber(fiber => {
|
|
7076
|
+
if (fiber.context.mapUnsafe.has(Transaction.key)) {
|
|
7077
|
+
return effect;
|
|
6969
7078
|
}
|
|
6970
|
-
//
|
|
6971
|
-
return transactionWith(f);
|
|
6972
|
-
});
|
|
6973
|
-
/**
|
|
6974
|
-
* Creates an isolated transaction that never composes with parent transactions.
|
|
6975
|
-
*
|
|
6976
|
-
* **Details**
|
|
6977
|
-
*
|
|
6978
|
-
* Unlike `Effect.atomic`, which composes with parent transactions when nested,
|
|
6979
|
-
* `Effect.transaction` always creates a new isolated transaction boundary.
|
|
6980
|
-
* This ensures complete isolation between different transaction scopes.
|
|
6981
|
-
*
|
|
6982
|
-
* **Key Differences from Effect.atomic:**
|
|
6983
|
-
* - Always creates a new transaction, even when called within another transaction
|
|
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
|
|
6987
|
-
*
|
|
6988
|
-
* **When to Use:**
|
|
6989
|
-
* - When you need guaranteed isolation between transaction scopes
|
|
6990
|
-
* - For implementing independent operations that shouldn't be affected by outer transactions
|
|
6991
|
-
* - When building transaction-based systems where isolation is critical
|
|
6992
|
-
*
|
|
6993
|
-
* @example
|
|
6994
|
-
* ```ts
|
|
6995
|
-
* import { Effect, TxRef } from "effect"
|
|
6996
|
-
*
|
|
6997
|
-
* const program = Effect.gen(function*() {
|
|
6998
|
-
* const ref1 = yield* TxRef.make(0)
|
|
6999
|
-
* const ref2 = yield* TxRef.make(100)
|
|
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
|
-
* }))
|
|
7010
|
-
*
|
|
7011
|
-
* // Isolated transaction - ref2 will be in its own transaction
|
|
7012
|
-
* yield* Effect.transaction(Effect.gen(function*() {
|
|
7013
|
-
* yield* TxRef.set(ref2, 200)
|
|
7014
|
-
* }))
|
|
7015
|
-
*
|
|
7016
|
-
* const val1 = yield* TxRef.get(ref1) // 20
|
|
7017
|
-
* const val2 = yield* TxRef.get(ref2) // 200
|
|
7018
|
-
* return { ref1: val1, ref2: val2 }
|
|
7019
|
-
* })
|
|
7020
|
-
* ```
|
|
7021
|
-
*
|
|
7022
|
-
* @since 4.0.0
|
|
7023
|
-
* @category Transactions
|
|
7024
|
-
*/
|
|
7025
|
-
export const transaction = effect => transactionWith(() => effect);
|
|
7026
|
-
/**
|
|
7027
|
-
* Executes a function within an isolated transaction context, providing access to the transaction state.
|
|
7028
|
-
*
|
|
7029
|
-
* This function always creates a new transaction boundary, regardless of whether it's called
|
|
7030
|
-
* within another transaction. This ensures complete isolation between transaction scopes.
|
|
7031
|
-
*
|
|
7032
|
-
* @example
|
|
7033
|
-
* ```ts
|
|
7034
|
-
* import { Effect, TxRef } from "effect"
|
|
7035
|
-
*
|
|
7036
|
-
* const program = Effect.transactionWith((txState) =>
|
|
7037
|
-
* Effect.gen(function*() {
|
|
7038
|
-
* 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
|
-
* yield* TxRef.set(ref, 42)
|
|
7044
|
-
* return yield* TxRef.get(ref)
|
|
7045
|
-
* })
|
|
7046
|
-
* )
|
|
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
|
-
* ```
|
|
7056
|
-
*
|
|
7057
|
-
* @since 4.0.0
|
|
7058
|
-
* @category Transactions
|
|
7059
|
-
*/
|
|
7060
|
-
export const transactionWith = f => withFiber(fiber => {
|
|
7061
|
-
// Always create a new transaction state, never compose with parent
|
|
7079
|
+
// Create transaction state only at the outermost boundary
|
|
7062
7080
|
const state = {
|
|
7063
7081
|
journal: new Map(),
|
|
7064
7082
|
retry: false
|
|
7065
7083
|
};
|
|
7066
|
-
const scheduler = fiber.currentScheduler;
|
|
7067
7084
|
let result;
|
|
7068
7085
|
return uninterruptibleMask(restore => flatMap(whileLoop({
|
|
7069
7086
|
while: () => !result,
|
|
7070
|
-
body: constant(restore(
|
|
7087
|
+
body: constant(restore(effect).pipe(provideService(Transaction, state), tapCause(() => {
|
|
7071
7088
|
if (!state.retry) return void_;
|
|
7072
7089
|
return restore(awaitPendingTransaction(state));
|
|
7073
7090
|
}), exit)),
|
|
@@ -7076,7 +7093,7 @@ export const transactionWith = f => withFiber(fiber => {
|
|
|
7076
7093
|
return clearTransaction(state);
|
|
7077
7094
|
}
|
|
7078
7095
|
if (Exit.isSuccess(exit)) {
|
|
7079
|
-
commitTransaction(
|
|
7096
|
+
commitTransaction(fiber, state);
|
|
7080
7097
|
} else {
|
|
7081
7098
|
clearTransaction(state);
|
|
7082
7099
|
}
|
|
@@ -7113,7 +7130,7 @@ const awaitPendingTransaction = state => suspend(() => {
|
|
|
7113
7130
|
return sync(clearPending);
|
|
7114
7131
|
});
|
|
7115
7132
|
});
|
|
7116
|
-
function commitTransaction(
|
|
7133
|
+
function commitTransaction(fiber, state) {
|
|
7117
7134
|
for (const [ref, {
|
|
7118
7135
|
value
|
|
7119
7136
|
}] of state.journal) {
|
|
@@ -7122,7 +7139,7 @@ function commitTransaction(scheduler, state) {
|
|
|
7122
7139
|
ref.value = value;
|
|
7123
7140
|
}
|
|
7124
7141
|
for (const pending of ref.pending.values()) {
|
|
7125
|
-
|
|
7142
|
+
fiber.currentDispatcher.scheduleTask(pending, 0);
|
|
7126
7143
|
}
|
|
7127
7144
|
ref.pending.clear();
|
|
7128
7145
|
}
|
|
@@ -7151,15 +7168,15 @@ function clearTransaction(state) {
|
|
|
7151
7168
|
* // forks a fiber that increases the value of `ref` every 100 millis
|
|
7152
7169
|
* yield* Effect.forkChild(Effect.forever(
|
|
7153
7170
|
* // update to transactional value
|
|
7154
|
-
* TxRef.update(ref, (n) => n + 1).pipe(Effect.delay("100 millis"))
|
|
7171
|
+
* Effect.tx(TxRef.update(ref, (n) => n + 1)).pipe(Effect.delay("100 millis"))
|
|
7155
7172
|
* ))
|
|
7156
7173
|
*
|
|
7157
7174
|
* // the following will retry 10 times until the `ref` value is 10
|
|
7158
|
-
* yield* Effect.
|
|
7175
|
+
* yield* Effect.tx(Effect.gen(function*() {
|
|
7159
7176
|
* const value = yield* TxRef.get(ref)
|
|
7160
7177
|
* if (value < 10) {
|
|
7161
7178
|
* yield* Effect.log(`retry due to value: ${value}`)
|
|
7162
|
-
* return yield* Effect.
|
|
7179
|
+
* return yield* Effect.txRetry
|
|
7163
7180
|
* }
|
|
7164
7181
|
* yield* Effect.log(`transaction done with value: ${value}`)
|
|
7165
7182
|
* }))
|
|
@@ -7168,7 +7185,7 @@ function clearTransaction(state) {
|
|
|
7168
7185
|
* Effect.runPromise(program).catch(console.error)
|
|
7169
7186
|
* ```
|
|
7170
7187
|
*/
|
|
7171
|
-
export const
|
|
7188
|
+
export const txRetry = /*#__PURE__*/flatMap(/*#__PURE__*/Transaction.asEffect(), state => {
|
|
7172
7189
|
state.retry = true;
|
|
7173
7190
|
return interrupt;
|
|
7174
7191
|
});
|
|
@@ -7259,18 +7276,20 @@ export const satisfiesSuccessType = () => effect => effect;
|
|
|
7259
7276
|
*
|
|
7260
7277
|
* @example
|
|
7261
7278
|
* ```ts
|
|
7262
|
-
* import { Effect } from "effect"
|
|
7279
|
+
* import { Data, Effect } from "effect"
|
|
7280
|
+
*
|
|
7281
|
+
* class ValidationError extends Data.TaggedError("ValidationError")<{}> {}
|
|
7263
7282
|
*
|
|
7264
|
-
* // Define a constraint that the error type must be
|
|
7265
|
-
* const satisfiesError = Effect.satisfiesErrorType<
|
|
7283
|
+
* // Define a constraint that the error type must be a ValidationError
|
|
7284
|
+
* const satisfiesError = Effect.satisfiesErrorType<ValidationError>()
|
|
7266
7285
|
*
|
|
7267
|
-
* // This works - Effect<number,
|
|
7268
|
-
* const validEffect = satisfiesError(Effect.fail(new
|
|
7286
|
+
* // This works - Effect<number, ValidationError, never> extends the constrained type
|
|
7287
|
+
* const validEffect = satisfiesError(Effect.fail(new ValidationError()))
|
|
7269
7288
|
*
|
|
7270
7289
|
* // This would cause a TypeScript compilation error:
|
|
7271
7290
|
* // const invalidEffect = satisfiesError(Effect.fail("string error"))
|
|
7272
7291
|
* // ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
7273
|
-
* // Type 'string' is not assignable to type '
|
|
7292
|
+
* // Type 'string' is not assignable to type 'ValidationError'
|
|
7274
7293
|
* ```
|
|
7275
7294
|
*
|
|
7276
7295
|
* @since 4.0.0
|