effect 4.0.0-beta.66 → 4.0.0-beta.67
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 +113 -67
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +28 -18
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +404 -337
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +190 -146
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts +167 -97
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +87 -47
- package/dist/BigInt.js.map +1 -1
- package/dist/Boolean.d.ts +62 -31
- package/dist/Boolean.d.ts.map +1 -1
- package/dist/Boolean.js +30 -15
- package/dist/Boolean.js.map +1 -1
- package/dist/Brand.d.ts +20 -1
- package/dist/Brand.d.ts.map +1 -1
- package/dist/Brand.js +16 -0
- package/dist/Brand.js.map +1 -1
- package/dist/Cache.d.ts +236 -132
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +133 -57
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +74 -62
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Cause.js +43 -36
- package/dist/Cause.js.map +1 -1
- package/dist/Channel.d.ts +1518 -575
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +661 -287
- package/dist/Channel.js.map +1 -1
- package/dist/ChannelSchema.d.ts +119 -10
- package/dist/ChannelSchema.d.ts.map +1 -1
- package/dist/ChannelSchema.js +45 -6
- package/dist/ChannelSchema.js.map +1 -1
- package/dist/Chunk.d.ts +548 -379
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +238 -170
- package/dist/Chunk.js.map +1 -1
- package/dist/Clock.d.ts +15 -8
- package/dist/Clock.d.ts.map +1 -1
- package/dist/Clock.js +8 -4
- package/dist/Clock.js.map +1 -1
- package/dist/Combiner.d.ts +2 -4
- package/dist/Combiner.d.ts.map +1 -1
- package/dist/Combiner.js +2 -4
- package/dist/Combiner.js.map +1 -1
- package/dist/Config.d.ts +4 -2
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +2 -2
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +1 -1
- package/dist/ConfigProvider.js +1 -1
- package/dist/Console.d.ts +76 -50
- package/dist/Console.d.ts.map +1 -1
- package/dist/Console.js +69 -46
- package/dist/Console.js.map +1 -1
- package/dist/Context.d.ts +383 -134
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +134 -54
- package/dist/Context.js.map +1 -1
- package/dist/Cron.d.ts +69 -48
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +96 -36
- package/dist/Cron.js.map +1 -1
- package/dist/Data.d.ts +3 -2
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js.map +1 -1
- package/dist/DateTime.d.ts +874 -443
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +374 -215
- package/dist/DateTime.js.map +1 -1
- package/dist/Deferred.d.ts +367 -174
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +145 -71
- package/dist/Deferred.js.map +1 -1
- package/dist/Differ.d.ts +42 -0
- package/dist/Differ.d.ts.map +1 -1
- package/dist/Differ.js +36 -0
- package/dist/Duration.d.ts +329 -185
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +174 -106
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +2109 -1945
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +901 -726
- package/dist/Effect.js.map +1 -1
- package/dist/Effectable.d.ts +37 -2
- package/dist/Effectable.d.ts.map +1 -1
- package/dist/Effectable.js +2 -2
- package/dist/Effectable.js.map +1 -1
- package/dist/Encoding.d.ts +78 -28
- package/dist/Encoding.d.ts.map +1 -1
- package/dist/Encoding.js +75 -27
- package/dist/Encoding.js.map +1 -1
- package/dist/Equivalence.d.ts +14 -19
- package/dist/Equivalence.d.ts.map +1 -1
- package/dist/Equivalence.js +14 -19
- package/dist/Equivalence.js.map +1 -1
- package/dist/ErrorReporter.d.ts +66 -82
- package/dist/ErrorReporter.d.ts.map +1 -1
- package/dist/ErrorReporter.js +38 -29
- package/dist/ErrorReporter.js.map +1 -1
- package/dist/ExecutionPlan.d.ts +94 -9
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/ExecutionPlan.js +20 -5
- package/dist/ExecutionPlan.js.map +1 -1
- package/dist/Exit.d.ts +7 -5
- package/dist/Exit.d.ts.map +1 -1
- package/dist/Exit.js.map +1 -1
- package/dist/Fiber.d.ts +72 -40
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js +39 -21
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +117 -56
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +120 -38
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +286 -158
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +174 -72
- package/dist/FiberMap.js.map +1 -1
- package/dist/FiberSet.d.ts +92 -51
- package/dist/FiberSet.d.ts.map +1 -1
- package/dist/FiberSet.js +96 -33
- package/dist/FiberSet.js.map +1 -1
- package/dist/FileSystem.d.ts +104 -73
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +53 -39
- package/dist/FileSystem.js.map +1 -1
- package/dist/Filter.d.ts +166 -88
- package/dist/Filter.d.ts.map +1 -1
- package/dist/Filter.js +68 -42
- package/dist/Filter.js.map +1 -1
- package/dist/Function.d.ts +154 -86
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +53 -37
- package/dist/Function.js.map +1 -1
- package/dist/Graph.d.ts +682 -365
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +308 -157
- package/dist/Graph.js.map +1 -1
- package/dist/HKT.d.ts +29 -13
- package/dist/HKT.d.ts.map +1 -1
- package/dist/Hash.d.ts +31 -18
- package/dist/Hash.d.ts.map +1 -1
- package/dist/Hash.js +25 -15
- package/dist/Hash.js.map +1 -1
- package/dist/HashMap.d.ts +444 -256
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashMap.js +223 -105
- package/dist/HashMap.js.map +1 -1
- package/dist/HashRing.d.ts +36 -17
- package/dist/HashRing.d.ts.map +1 -1
- package/dist/HashRing.js +75 -8
- package/dist/HashRing.js.map +1 -1
- package/dist/HashSet.d.ts +194 -104
- package/dist/HashSet.d.ts.map +1 -1
- package/dist/HashSet.js +93 -38
- package/dist/HashSet.js.map +1 -1
- package/dist/Inspectable.d.ts +20 -9
- package/dist/Inspectable.d.ts.map +1 -1
- package/dist/Inspectable.js +16 -6
- package/dist/Inspectable.js.map +1 -1
- package/dist/Iterable.d.ts +309 -149
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +129 -65
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonPatch.d.ts +4 -3
- package/dist/JsonPatch.d.ts.map +1 -1
- package/dist/JsonPatch.js +4 -3
- package/dist/JsonPatch.js.map +1 -1
- package/dist/Latch.d.ts +98 -15
- package/dist/Latch.d.ts.map +1 -1
- package/dist/Latch.js +41 -10
- package/dist/Latch.js.map +1 -1
- package/dist/Layer.d.ts +412 -309
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +261 -180
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +95 -21
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +55 -11
- package/dist/LayerMap.js.map +1 -1
- package/dist/LogLevel.d.ts +92 -131
- package/dist/LogLevel.d.ts.map +1 -1
- package/dist/LogLevel.js +25 -15
- package/dist/LogLevel.js.map +1 -1
- package/dist/Logger.d.ts +155 -99
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +211 -184
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +75 -17
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/ManagedRuntime.js +22 -16
- package/dist/ManagedRuntime.js.map +1 -1
- package/dist/Match.d.ts +133 -157
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js +85 -76
- package/dist/Match.js.map +1 -1
- package/dist/Metric.d.ts +325 -284
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +217 -212
- package/dist/Metric.js.map +1 -1
- package/dist/MutableHashMap.d.ts +117 -58
- package/dist/MutableHashMap.d.ts.map +1 -1
- package/dist/MutableHashMap.js +52 -29
- package/dist/MutableHashMap.js.map +1 -1
- package/dist/MutableHashSet.d.ts +52 -30
- package/dist/MutableHashSet.d.ts.map +1 -1
- package/dist/MutableHashSet.js +94 -38
- package/dist/MutableHashSet.js.map +1 -1
- package/dist/MutableList.d.ts +92 -49
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +123 -71
- package/dist/MutableList.js.map +1 -1
- package/dist/MutableRef.d.ts +99 -62
- package/dist/MutableRef.d.ts.map +1 -1
- package/dist/MutableRef.js +79 -60
- package/dist/MutableRef.js.map +1 -1
- package/dist/Newtype.d.ts +3 -0
- package/dist/Newtype.d.ts.map +1 -1
- package/dist/Newtype.js.map +1 -1
- package/dist/NonEmptyIterable.d.ts +36 -39
- package/dist/NonEmptyIterable.d.ts.map +1 -1
- package/dist/NonEmptyIterable.js +34 -20
- package/dist/NonEmptyIterable.js.map +1 -1
- package/dist/Number.d.ts +116 -64
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +54 -30
- package/dist/Number.js.map +1 -1
- package/dist/Optic.d.ts +1 -2
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +0 -1
- package/dist/Optic.js.map +1 -1
- package/dist/Option.d.ts +28 -47
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +14 -12
- package/dist/Option.js.map +1 -1
- package/dist/Ordering.d.ts +43 -28
- package/dist/Ordering.d.ts.map +1 -1
- package/dist/Ordering.js +4 -2
- package/dist/Ordering.js.map +1 -1
- package/dist/PartitionedSemaphore.d.ts +225 -40
- package/dist/PartitionedSemaphore.d.ts.map +1 -1
- package/dist/PartitionedSemaphore.js +113 -17
- package/dist/PartitionedSemaphore.js.map +1 -1
- package/dist/Path.d.ts +77 -13
- package/dist/Path.d.ts.map +1 -1
- package/dist/Path.js +48 -4
- package/dist/Path.js.map +1 -1
- package/dist/Pipeable.d.ts +71 -15
- package/dist/Pipeable.d.ts.map +1 -1
- package/dist/Pipeable.js +59 -12
- package/dist/Pipeable.js.map +1 -1
- package/dist/PlatformError.d.ts +74 -6
- package/dist/PlatformError.d.ts.map +1 -1
- package/dist/PlatformError.js +68 -5
- package/dist/PlatformError.js.map +1 -1
- package/dist/Pool.d.ts +66 -31
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +26 -24
- package/dist/Pool.js.map +1 -1
- package/dist/Predicate.d.ts +16 -21
- package/dist/Predicate.d.ts.map +1 -1
- package/dist/Predicate.js +9 -14
- package/dist/Predicate.js.map +1 -1
- package/dist/PrimaryKey.d.ts +9 -2
- package/dist/PrimaryKey.d.ts.map +1 -1
- package/dist/PrimaryKey.js +7 -1
- package/dist/PrimaryKey.js.map +1 -1
- package/dist/PubSub.d.ts +364 -262
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +245 -174
- package/dist/PubSub.js.map +1 -1
- package/dist/Pull.d.ts +94 -25
- package/dist/Pull.d.ts.map +1 -1
- package/dist/Pull.js +61 -13
- package/dist/Pull.js.map +1 -1
- package/dist/Queue.d.ts +284 -150
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +216 -113
- package/dist/Queue.js.map +1 -1
- package/dist/Random.d.ts +54 -35
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +36 -24
- package/dist/Random.js.map +1 -1
- package/dist/RcMap.d.ts +151 -141
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +66 -20
- package/dist/RcMap.js.map +1 -1
- package/dist/RcRef.d.ts +69 -32
- package/dist/RcRef.d.ts.map +1 -1
- package/dist/RcRef.js +33 -16
- package/dist/RcRef.js.map +1 -1
- package/dist/Record.d.ts +273 -129
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +117 -57
- package/dist/Record.js.map +1 -1
- package/dist/Redactable.d.ts +3 -3
- package/dist/Redactable.js +2 -2
- package/dist/Redacted.d.ts +63 -33
- package/dist/Redacted.d.ts.map +1 -1
- package/dist/Redacted.js +30 -14
- package/dist/Redacted.js.map +1 -1
- package/dist/Ref.d.ts +81 -52
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +54 -35
- package/dist/Ref.js.map +1 -1
- package/dist/References.d.ts +73 -31
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +66 -30
- package/dist/References.js.map +1 -1
- package/dist/RegExp.d.ts +11 -5
- package/dist/RegExp.d.ts.map +1 -1
- package/dist/RegExp.js +11 -5
- package/dist/RegExp.js.map +1 -1
- package/dist/Request.d.ts +158 -34
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js +67 -12
- package/dist/Request.js.map +1 -1
- package/dist/RequestResolver.d.ts +261 -116
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +77 -41
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Resource.d.ts +13 -7
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +44 -6
- package/dist/Resource.js.map +1 -1
- package/dist/Result.d.ts +16 -14
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +6 -6
- package/dist/Result.js.map +1 -1
- package/dist/Runtime.d.ts +43 -18
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +35 -16
- package/dist/Runtime.js.map +1 -1
- package/dist/Schedule.d.ts +545 -576
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +260 -246
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts +43 -6
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +33 -4
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +803 -282
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +281 -189
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +24 -15
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +13 -9
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +26 -13
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +22 -9
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.d.ts +1 -8
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.d.ts +194 -25
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +220 -26
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +61 -41
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +56 -33
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/SchemaUtils.d.ts +7 -0
- package/dist/SchemaUtils.d.ts.map +1 -1
- package/dist/SchemaUtils.js +23 -0
- package/dist/SchemaUtils.js.map +1 -1
- package/dist/Scope.d.ts +102 -43
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +57 -23
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.d.ts +138 -46
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedCache.js +80 -19
- package/dist/ScopedCache.js.map +1 -1
- package/dist/ScopedRef.d.ts +28 -8
- package/dist/ScopedRef.d.ts.map +1 -1
- package/dist/ScopedRef.js +25 -5
- package/dist/ScopedRef.js.map +1 -1
- package/dist/Semaphore.d.ts +64 -28
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js +22 -13
- package/dist/Semaphore.js.map +1 -1
- package/dist/Sink.d.ts +458 -200
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +240 -89
- package/dist/Sink.js.map +1 -1
- package/dist/Stdio.d.ts +43 -6
- package/dist/Stdio.d.ts.map +1 -1
- package/dist/Stdio.js +33 -4
- package/dist/Stdio.js.map +1 -1
- package/dist/Stream.d.ts +1896 -1183
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +867 -524
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +171 -95
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +125 -67
- package/dist/String.js.map +1 -1
- package/dist/SubscriptionRef.d.ts +308 -203
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +125 -76
- package/dist/SubscriptionRef.js.map +1 -1
- package/dist/Symbol.d.ts +13 -5
- package/dist/Symbol.d.ts.map +1 -1
- package/dist/Symbol.js +13 -5
- package/dist/Symbol.js.map +1 -1
- package/dist/SynchronizedRef.d.ts +278 -62
- package/dist/SynchronizedRef.d.ts.map +1 -1
- package/dist/SynchronizedRef.js +116 -23
- package/dist/SynchronizedRef.js.map +1 -1
- package/dist/Take.d.ts +26 -2
- package/dist/Take.d.ts.map +1 -1
- package/dist/Take.js +4 -1
- package/dist/Take.js.map +1 -1
- package/dist/Terminal.d.ts +39 -7
- package/dist/Terminal.d.ts.map +1 -1
- package/dist/Terminal.js +10 -4
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +229 -55
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +94 -18
- package/dist/Tracer.js.map +1 -1
- package/dist/Trie.d.ts +213 -142
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js +88 -60
- package/dist/Trie.js.map +1 -1
- package/dist/TxChunk.d.ts +182 -146
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxChunk.js +73 -56
- package/dist/TxChunk.js.map +1 -1
- package/dist/TxDeferred.d.ts +43 -29
- package/dist/TxDeferred.d.ts.map +1 -1
- package/dist/TxDeferred.js +22 -15
- package/dist/TxDeferred.js.map +1 -1
- package/dist/TxHashMap.d.ts +362 -222
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +171 -98
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxHashSet.d.ts +178 -104
- package/dist/TxHashSet.d.ts.map +1 -1
- package/dist/TxHashSet.js +84 -43
- package/dist/TxHashSet.js.map +1 -1
- package/dist/TxPriorityQueue.d.ts +93 -62
- package/dist/TxPriorityQueue.d.ts.map +1 -1
- package/dist/TxPriorityQueue.js +54 -36
- package/dist/TxPriorityQueue.js.map +1 -1
- package/dist/TxPubSub.d.ts +77 -49
- package/dist/TxPubSub.d.ts.map +1 -1
- package/dist/TxPubSub.js +60 -37
- package/dist/TxPubSub.js.map +1 -1
- package/dist/TxQueue.d.ts +279 -241
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxQueue.js +147 -101
- package/dist/TxQueue.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +69 -46
- package/dist/TxReentrantLock.d.ts.map +1 -1
- package/dist/TxReentrantLock.js +48 -32
- package/dist/TxReentrantLock.js.map +1 -1
- package/dist/TxRef.d.ts +69 -40
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +34 -19
- package/dist/TxRef.js.map +1 -1
- package/dist/TxSemaphore.d.ts +101 -54
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +76 -34
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/TxSubscriptionRef.d.ts +72 -48
- package/dist/TxSubscriptionRef.d.ts.map +1 -1
- package/dist/TxSubscriptionRef.js +33 -22
- package/dist/TxSubscriptionRef.js.map +1 -1
- package/dist/Types.d.ts +34 -34
- package/dist/UndefinedOr.d.ts +48 -25
- package/dist/UndefinedOr.d.ts.map +1 -1
- package/dist/UndefinedOr.js +28 -25
- package/dist/UndefinedOr.js.map +1 -1
- package/dist/Unify.d.ts +71 -116
- package/dist/Unify.d.ts.map +1 -1
- package/dist/Unify.js +20 -6
- package/dist/Unify.js.map +1 -1
- package/dist/Utils.d.ts +4 -0
- package/dist/Utils.d.ts.map +1 -1
- package/dist/Utils.js +4 -0
- package/dist/Utils.js.map +1 -1
- package/dist/index.d.ts +81 -32
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +81 -32
- package/dist/index.js.map +1 -1
- package/dist/internal/schema/schema.js +1 -1
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/testing/FastCheck.d.ts +6 -3
- package/dist/testing/FastCheck.d.ts.map +1 -1
- package/dist/testing/FastCheck.js +6 -3
- package/dist/testing/FastCheck.js.map +1 -1
- package/dist/testing/TestClock.d.ts +39 -34
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestClock.js +42 -12
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/testing/TestConsole.d.ts +39 -30
- package/dist/testing/TestConsole.d.ts.map +1 -1
- package/dist/testing/TestConsole.js +25 -10
- package/dist/testing/TestConsole.js.map +1 -1
- package/dist/testing/TestSchema.js +7 -7
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +197 -130
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +166 -102
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +2 -2
- package/dist/unstable/ai/Chat.d.ts +65 -41
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +51 -33
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.d.ts +12 -11
- package/dist/unstable/ai/EmbeddingModel.d.ts.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.js +9 -8
- package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
- package/dist/unstable/ai/IdGenerator.d.ts +28 -18
- package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
- package/dist/unstable/ai/IdGenerator.js +18 -11
- package/dist/unstable/ai/IdGenerator.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +31 -25
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +20 -14
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +339 -119
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +264 -98
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +53 -19
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +63 -15
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Model.d.ts +8 -6
- package/dist/unstable/ai/Model.d.ts.map +1 -1
- package/dist/unstable/ai/Model.js +7 -5
- package/dist/unstable/ai/Model.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +2 -2
- package/dist/unstable/ai/Prompt.d.ts +194 -168
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Prompt.js +75 -66
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +153 -140
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js +43 -48
- package/dist/unstable/ai/Response.js.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.d.ts +43 -4
- package/dist/unstable/ai/ResponseIdTracker.d.ts.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.js +27 -2
- package/dist/unstable/ai/ResponseIdTracker.js.map +1 -1
- package/dist/unstable/ai/Telemetry.d.ts +42 -32
- package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
- package/dist/unstable/ai/Telemetry.js +14 -10
- package/dist/unstable/ai/Telemetry.js.map +1 -1
- package/dist/unstable/ai/Tokenizer.d.ts +13 -8
- package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
- package/dist/unstable/ai/Tokenizer.js +10 -6
- package/dist/unstable/ai/Tokenizer.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +153 -84
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +97 -44
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +32 -39
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +7 -5
- package/dist/unstable/ai/Toolkit.js.map +1 -1
- package/dist/unstable/ai/index.d.ts +42 -24
- package/dist/unstable/ai/index.d.ts.map +1 -1
- package/dist/unstable/ai/index.js +42 -24
- package/dist/unstable/ai/index.js.map +1 -1
- package/dist/unstable/cli/Argument.d.ts +226 -134
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js +101 -65
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +72 -26
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +86 -23
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/CliOutput.d.ts +43 -13
- package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
- package/dist/unstable/cli/CliOutput.js +30 -6
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +194 -113
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +45 -31
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Completions.d.ts +7 -7
- package/dist/unstable/cli/Completions.js +1 -1
- package/dist/unstable/cli/Flag.d.ts +235 -142
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +111 -71
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +41 -13
- package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
- package/dist/unstable/cli/GlobalFlag.js +30 -7
- package/dist/unstable/cli/GlobalFlag.js.map +1 -1
- package/dist/unstable/cli/HelpDoc.d.ts +35 -10
- package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
- package/dist/unstable/cli/HelpDoc.js +21 -0
- package/dist/unstable/cli/Param.d.ts +79 -31
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +160 -98
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +79 -42
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js +66 -35
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/Prompt.d.ts +177 -45
- package/dist/unstable/cli/Prompt.d.ts.map +1 -1
- package/dist/unstable/cli/Prompt.js +103 -21
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/internal/ansi.d.ts.map +1 -1
- package/dist/unstable/cli/internal/ansi.js +13 -0
- package/dist/unstable/cli/internal/ansi.js.map +1 -1
- package/dist/unstable/cli/internal/command.d.ts +5 -1
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +5 -1
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/config.d.ts +3 -0
- package/dist/unstable/cli/internal/config.d.ts.map +1 -1
- package/dist/unstable/cli/internal/config.js.map +1 -1
- package/dist/unstable/cli/internal/lexer.js.map +1 -1
- package/dist/unstable/cluster/ClusterCron.d.ts +35 -1
- package/dist/unstable/cluster/ClusterCron.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterCron.js +35 -1
- package/dist/unstable/cluster/ClusterCron.js.map +1 -1
- package/dist/unstable/cluster/ClusterError.d.ts +56 -7
- package/dist/unstable/cluster/ClusterError.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterError.js +56 -7
- package/dist/unstable/cluster/ClusterError.js.map +1 -1
- package/dist/unstable/cluster/ClusterMetrics.d.ts +39 -5
- package/dist/unstable/cluster/ClusterMetrics.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterMetrics.js +39 -5
- package/dist/unstable/cluster/ClusterMetrics.js.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.d.ts +61 -8
- package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.js +61 -8
- package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +14 -2
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +35 -2
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/DeliverAt.d.ts +39 -4
- package/dist/unstable/cluster/DeliverAt.d.ts.map +1 -1
- package/dist/unstable/cluster/DeliverAt.js +11 -3
- package/dist/unstable/cluster/DeliverAt.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +75 -16
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +75 -10
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/EntityAddress.d.ts +30 -2
- package/dist/unstable/cluster/EntityAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityAddress.js +30 -2
- package/dist/unstable/cluster/EntityAddress.js.map +1 -1
- package/dist/unstable/cluster/EntityId.d.ts +18 -3
- package/dist/unstable/cluster/EntityId.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityId.js +15 -2
- package/dist/unstable/cluster/EntityId.js.map +1 -1
- package/dist/unstable/cluster/EntityProxy.d.ts +34 -2
- package/dist/unstable/cluster/EntityProxy.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxy.js +24 -2
- package/dist/unstable/cluster/EntityProxy.js.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.d.ts +17 -2
- package/dist/unstable/cluster/EntityProxyServer.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.js +40 -8
- package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
- package/dist/unstable/cluster/EntityResource.d.ts +43 -6
- package/dist/unstable/cluster/EntityResource.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityResource.js +11 -4
- package/dist/unstable/cluster/EntityResource.js.map +1 -1
- package/dist/unstable/cluster/EntityType.d.ts +27 -3
- package/dist/unstable/cluster/EntityType.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityType.js +24 -2
- package/dist/unstable/cluster/EntityType.js.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts +105 -23
- package/dist/unstable/cluster/Envelope.d.ts.map +1 -1
- package/dist/unstable/cluster/Envelope.js +88 -14
- package/dist/unstable/cluster/Envelope.js.map +1 -1
- package/dist/unstable/cluster/HttpRunner.d.ts +88 -13
- package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/HttpRunner.js +88 -13
- package/dist/unstable/cluster/HttpRunner.js.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.d.ts +49 -6
- package/dist/unstable/cluster/K8sHttpClient.d.ts.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.js +31 -6
- package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
- package/dist/unstable/cluster/MachineId.d.ts +24 -3
- package/dist/unstable/cluster/MachineId.d.ts.map +1 -1
- package/dist/unstable/cluster/MachineId.js +21 -2
- package/dist/unstable/cluster/MachineId.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +102 -13
- package/dist/unstable/cluster/Message.d.ts.map +1 -1
- package/dist/unstable/cluster/Message.js +86 -10
- package/dist/unstable/cluster/Message.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +127 -21
- package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/MessageStorage.js +70 -10
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts +101 -12
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +64 -8
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/Runner.d.ts +47 -17
- package/dist/unstable/cluster/Runner.d.ts.map +1 -1
- package/dist/unstable/cluster/Runner.js +47 -17
- package/dist/unstable/cluster/Runner.js.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.d.ts +34 -2
- package/dist/unstable/cluster/RunnerAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.js +34 -2
- package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.d.ts +40 -12
- package/dist/unstable/cluster/RunnerHealth.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.js +40 -12
- package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts +7 -4
- package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +31 -4
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.d.ts +42 -5
- package/dist/unstable/cluster/RunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.js +38 -4
- package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +73 -10
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +70 -9
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/ShardId.d.ts +51 -5
- package/dist/unstable/cluster/ShardId.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardId.js +47 -4
- package/dist/unstable/cluster/ShardId.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts +10 -2
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +35 -4
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +65 -9
- package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.js +66 -9
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/ShardingRegistrationEvent.d.ts +27 -6
- package/dist/unstable/cluster/ShardingRegistrationEvent.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingRegistrationEvent.js +28 -4
- package/dist/unstable/cluster/ShardingRegistrationEvent.js.map +1 -1
- package/dist/unstable/cluster/SingleRunner.d.ts +23 -1
- package/dist/unstable/cluster/SingleRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/SingleRunner.js +23 -1
- package/dist/unstable/cluster/SingleRunner.js.map +1 -1
- package/dist/unstable/cluster/Singleton.d.ts +15 -1
- package/dist/unstable/cluster/Singleton.d.ts.map +1 -1
- package/dist/unstable/cluster/Singleton.js +15 -1
- package/dist/unstable/cluster/Singleton.js.map +1 -1
- package/dist/unstable/cluster/SingletonAddress.d.ts +21 -1
- package/dist/unstable/cluster/SingletonAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/SingletonAddress.js +21 -1
- package/dist/unstable/cluster/SingletonAddress.js.map +1 -1
- package/dist/unstable/cluster/Snowflake.d.ts +89 -19
- package/dist/unstable/cluster/Snowflake.d.ts.map +1 -1
- package/dist/unstable/cluster/Snowflake.js +48 -13
- package/dist/unstable/cluster/Snowflake.js.map +1 -1
- package/dist/unstable/cluster/SocketRunner.d.ts +8 -2
- package/dist/unstable/cluster/SocketRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/SocketRunner.js +29 -2
- package/dist/unstable/cluster/SocketRunner.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.d.ts +11 -3
- package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +27 -3
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts +11 -3
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js +46 -7
- package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/TestRunner.d.ts +18 -1
- package/dist/unstable/cluster/TestRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/TestRunner.js +18 -1
- package/dist/unstable/cluster/TestRunner.js.map +1 -1
- package/dist/unstable/cluster/internal/hash.js +12 -0
- package/dist/unstable/cluster/internal/hash.js.map +1 -1
- package/dist/unstable/devtools/DevTools.d.ts +26 -3
- package/dist/unstable/devtools/DevTools.d.ts.map +1 -1
- package/dist/unstable/devtools/DevTools.js +26 -3
- package/dist/unstable/devtools/DevTools.js.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.d.ts +20 -5
- package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.js +32 -5
- package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.d.ts +184 -44
- package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js +102 -20
- package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
- package/dist/unstable/devtools/DevToolsServer.d.ts +27 -2
- package/dist/unstable/devtools/DevToolsServer.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsServer.js +21 -1
- package/dist/unstable/devtools/DevToolsServer.js.map +1 -1
- package/dist/unstable/encoding/Msgpack.d.ts +81 -12
- package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
- package/dist/unstable/encoding/Msgpack.js +75 -9
- package/dist/unstable/encoding/Msgpack.js.map +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts +149 -21
- package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
- package/dist/unstable/encoding/Ndjson.js +97 -13
- package/dist/unstable/encoding/Ndjson.js.map +1 -1
- package/dist/unstable/encoding/Sse.d.ts +109 -18
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.js +69 -13
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/eventlog/Event.d.ts +115 -30
- package/dist/unstable/eventlog/Event.d.ts.map +1 -1
- package/dist/unstable/eventlog/Event.js +22 -2
- package/dist/unstable/eventlog/Event.js.map +1 -1
- package/dist/unstable/eventlog/EventGroup.d.ts +50 -17
- package/dist/unstable/eventlog/EventGroup.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventGroup.js +24 -6
- package/dist/unstable/eventlog/EventGroup.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +104 -20
- package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventJournal.js +108 -16
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts +151 -31
- package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLog.js +111 -20
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.d.ts +42 -6
- package/dist/unstable/eventlog/EventLogEncryption.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js +38 -5
- package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +92 -18
- package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.js +72 -16
- package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +35 -8
- package/dist/unstable/eventlog/EventLogRemote.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.js +54 -8
- package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.d.ts +17 -3
- package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.js +17 -3
- package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +32 -6
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.js +52 -6
- package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +74 -16
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js +90 -16
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +59 -15
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.js +73 -14
- package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.d.ts +10 -2
- package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.js +28 -2
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts +32 -3
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js +32 -3
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts +10 -2
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +28 -2
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/http/Cookies.d.ts +156 -77
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +93 -39
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Etag.d.ts +40 -7
- package/dist/unstable/http/Etag.d.ts.map +1 -1
- package/dist/unstable/http/Etag.js +27 -4
- package/dist/unstable/http/Etag.js.map +1 -1
- package/dist/unstable/http/FetchHttpClient.d.ts +29 -3
- package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/unstable/http/FetchHttpClient.js +33 -4
- package/dist/unstable/http/FetchHttpClient.js.map +1 -1
- package/dist/unstable/http/FindMyWay.d.ts +1 -1
- package/dist/unstable/http/FindMyWay.js +1 -1
- package/dist/unstable/http/Headers.d.ts +182 -36
- package/dist/unstable/http/Headers.d.ts.map +1 -1
- package/dist/unstable/http/Headers.js +86 -16
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpBody.d.ts +114 -26
- package/dist/unstable/http/HttpBody.d.ts.map +1 -1
- package/dist/unstable/http/HttpBody.js +98 -20
- package/dist/unstable/http/HttpBody.js.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts +205 -96
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +84 -38
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientError.d.ts +68 -12
- package/dist/unstable/http/HttpClientError.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientError.js +71 -9
- package/dist/unstable/http/HttpClientError.js.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts +318 -100
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +151 -45
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts +59 -16
- package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientResponse.js +44 -11
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts +42 -16
- package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
- package/dist/unstable/http/HttpEffect.js +33 -13
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.d.ts +47 -7
- package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js +44 -6
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMethod.d.ts +35 -5
- package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
- package/dist/unstable/http/HttpMethod.js +23 -1
- package/dist/unstable/http/HttpMethod.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts +37 -11
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +52 -10
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpPlatform.d.ts +34 -3
- package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
- package/dist/unstable/http/HttpPlatform.js +34 -3
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +194 -45
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +118 -24
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServer.d.ts +151 -22
- package/dist/unstable/http/HttpServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpServer.js +76 -11
- package/dist/unstable/http/HttpServer.js.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +90 -10
- package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerError.js +82 -8
- package/dist/unstable/http/HttpServerError.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +125 -21
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +101 -20
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.d.ts +32 -6
- package/dist/unstable/http/HttpServerRespondable.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.js +43 -5
- package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +390 -67
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +204 -33
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpStaticServer.d.ts +22 -4
- package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpStaticServer.js +22 -4
- package/dist/unstable/http/HttpStaticServer.js.map +1 -1
- package/dist/unstable/http/HttpTraceContext.d.ts +53 -6
- package/dist/unstable/http/HttpTraceContext.d.ts.map +1 -1
- package/dist/unstable/http/HttpTraceContext.js +47 -5
- package/dist/unstable/http/HttpTraceContext.js.map +1 -1
- package/dist/unstable/http/Multipart.d.ts +178 -28
- package/dist/unstable/http/Multipart.d.ts.map +1 -1
- package/dist/unstable/http/Multipart.js +129 -19
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/Multipasta/HeadersParser.d.ts +1 -1
- package/dist/unstable/http/Multipasta/HeadersParser.js +1 -1
- package/dist/unstable/http/Multipasta/Node.d.ts +1 -1
- package/dist/unstable/http/Multipasta/Node.js +1 -1
- package/dist/unstable/http/Multipasta/Search.d.ts +1 -1
- package/dist/unstable/http/Multipasta/Search.js +1 -1
- package/dist/unstable/http/Multipasta/Web.d.ts +1 -1
- package/dist/unstable/http/Multipasta/Web.js +1 -1
- package/dist/unstable/http/Multipasta.d.ts +1 -1
- package/dist/unstable/http/Multipasta.js +1 -1
- package/dist/unstable/http/Template.d.ts +53 -0
- package/dist/unstable/http/Template.d.ts.map +1 -1
- package/dist/unstable/http/Template.js +26 -0
- package/dist/unstable/http/Template.js.map +1 -1
- package/dist/unstable/http/Url.d.ts +56 -42
- package/dist/unstable/http/Url.d.ts.map +1 -1
- package/dist/unstable/http/Url.js +29 -15
- package/dist/unstable/http/Url.js.map +1 -1
- package/dist/unstable/http/UrlParams.d.ts +233 -49
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +116 -23
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/httpapi/HttpApi.d.ts +49 -14
- package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js +14 -8
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +55 -16
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +44 -6
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +58 -15
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +42 -6
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +214 -59
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.js +53 -9
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +81 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.js +98 -1
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.d.ts +87 -20
- package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.js +5 -2
- package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +111 -22
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js +47 -5
- package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts +19 -4
- package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.js +32 -2
- package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +67 -30
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.js +48 -27
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts +74 -17
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.js +38 -5
- package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.d.ts +5 -2
- package/dist/unstable/httpapi/HttpApiSwagger.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.js +24 -2
- package/dist/unstable/httpapi/HttpApiSwagger.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiTest.d.ts +6 -1
- package/dist/unstable/httpapi/HttpApiTest.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiTest.js +26 -1
- package/dist/unstable/httpapi/HttpApiTest.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts +86 -15
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +73 -15
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/observability/Otlp.d.ts +33 -3
- package/dist/unstable/observability/Otlp.d.ts.map +1 -1
- package/dist/unstable/observability/Otlp.js +14 -3
- package/dist/unstable/observability/Otlp.js.map +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts +8 -1
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +32 -1
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.d.ts +14 -2
- package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js +29 -2
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts +15 -4
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.js +32 -2
- package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
- package/dist/unstable/observability/OtlpResource.d.ts +49 -12
- package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpResource.js +47 -5
- package/dist/unstable/observability/OtlpResource.js.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.d.ts +28 -3
- package/dist/unstable/observability/OtlpSerialization.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.js +28 -3
- package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.d.ts +16 -2
- package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js +32 -2
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.d.ts +32 -12
- package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.js +7 -5
- package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
- package/dist/unstable/observability/index.d.ts +2 -1
- package/dist/unstable/observability/index.d.ts.map +1 -1
- package/dist/unstable/observability/index.js +2 -1
- package/dist/unstable/observability/index.js.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +93 -18
- package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.js +81 -21
- package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
- package/dist/unstable/persistence/Persistable.d.ts +76 -15
- package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistable.js +22 -5
- package/dist/unstable/persistence/Persistable.js.map +1 -1
- package/dist/unstable/persistence/PersistedCache.d.ts +27 -2
- package/dist/unstable/persistence/PersistedCache.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedCache.js +24 -1
- package/dist/unstable/persistence/PersistedCache.js.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts +73 -16
- package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.js +60 -13
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/Persistence.d.ts +97 -16
- package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistence.js +90 -14
- package/dist/unstable/persistence/Persistence.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +97 -21
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +81 -16
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/persistence/Redis.d.ts +26 -5
- package/dist/unstable/persistence/Redis.d.ts.map +1 -1
- package/dist/unstable/persistence/Redis.js +36 -4
- package/dist/unstable/persistence/Redis.js.map +1 -1
- package/dist/unstable/process/ChildProcess.d.ts +87 -64
- package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcess.js +24 -17
- package/dist/unstable/process/ChildProcess.js.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.d.ts +22 -11
- package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js +11 -6
- package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
- package/dist/unstable/process/index.d.ts +2 -1
- package/dist/unstable/process/index.d.ts.map +1 -1
- package/dist/unstable/process/index.js +2 -1
- package/dist/unstable/process/index.js.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.d.ts +196 -59
- package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.js +121 -36
- package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +539 -130
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +252 -58
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +41 -2
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.js +35 -1
- package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/unstable/reactivity/AtomRef.d.ts +51 -7
- package/dist/unstable/reactivity/AtomRef.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRef.js +29 -3
- package/dist/unstable/reactivity/AtomRef.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.d.ts +135 -21
- package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +69 -10
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts +36 -2
- package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.js +29 -1
- package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
- package/dist/unstable/reactivity/Hydration.d.ts +28 -5
- package/dist/unstable/reactivity/Hydration.d.ts.map +1 -1
- package/dist/unstable/reactivity/Hydration.js +35 -3
- package/dist/unstable/reactivity/Hydration.js.map +1 -1
- package/dist/unstable/reactivity/Reactivity.d.ts +95 -13
- package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
- package/dist/unstable/reactivity/Reactivity.js +61 -7
- package/dist/unstable/reactivity/Reactivity.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +255 -56
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js +44 -11
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts +81 -19
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +52 -12
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcClientError.d.ts +26 -2
- package/dist/unstable/rpc/RpcClientError.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClientError.js +26 -2
- package/dist/unstable/rpc/RpcClientError.js.map +1 -1
- package/dist/unstable/rpc/RpcGroup.d.ts +51 -8
- package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcGroup.js +3 -1
- package/dist/unstable/rpc/RpcGroup.js.map +1 -1
- package/dist/unstable/rpc/RpcMessage.d.ts +128 -32
- package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMessage.js +23 -7
- package/dist/unstable/rpc/RpcMessage.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts +100 -20
- package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js +39 -3
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts +38 -4
- package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSchema.js +34 -3
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts +60 -13
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +56 -12
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +73 -23
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +69 -22
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/rpc/RpcTest.d.ts +20 -1
- package/dist/unstable/rpc/RpcTest.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcTest.js +20 -1
- package/dist/unstable/rpc/RpcTest.js.map +1 -1
- package/dist/unstable/rpc/RpcWorker.d.ts +40 -6
- package/dist/unstable/rpc/RpcWorker.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcWorker.js +16 -4
- package/dist/unstable/rpc/RpcWorker.js.map +1 -1
- package/dist/unstable/rpc/Utils.d.ts +8 -0
- package/dist/unstable/rpc/Utils.d.ts.map +1 -1
- package/dist/unstable/rpc/Utils.js +8 -0
- package/dist/unstable/rpc/Utils.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts +130 -52
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js +79 -34
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +104 -24
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.js +22 -6
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +167 -34
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +123 -28
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/socket/SocketServer.d.ts +58 -10
- package/dist/unstable/socket/SocketServer.d.ts.map +1 -1
- package/dist/unstable/socket/SocketServer.js +43 -5
- package/dist/unstable/socket/SocketServer.js.map +1 -1
- package/dist/unstable/sql/Migrator.d.ts +35 -4
- package/dist/unstable/sql/Migrator.d.ts.map +1 -1
- package/dist/unstable/sql/Migrator.js +44 -4
- package/dist/unstable/sql/Migrator.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts +34 -2
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +38 -1
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/sql/SqlConnection.d.ts +31 -0
- package/dist/unstable/sql/SqlConnection.d.ts.map +1 -1
- package/dist/unstable/sql/SqlConnection.js +22 -0
- package/dist/unstable/sql/SqlConnection.js.map +1 -1
- package/dist/unstable/sql/SqlError.d.ts +99 -0
- package/dist/unstable/sql/SqlError.d.ts.map +1 -1
- package/dist/unstable/sql/SqlError.js +114 -0
- package/dist/unstable/sql/SqlError.js.map +1 -1
- package/dist/unstable/sql/SqlModel.d.ts +26 -5
- package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
- package/dist/unstable/sql/SqlModel.js +8 -4
- package/dist/unstable/sql/SqlModel.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.d.ts +56 -13
- package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
- package/dist/unstable/sql/SqlResolver.js +44 -10
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/sql/SqlSchema.d.ts +29 -8
- package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
- package/dist/unstable/sql/SqlSchema.js +29 -8
- package/dist/unstable/sql/SqlSchema.js.map +1 -1
- package/dist/unstable/sql/SqlStream.d.ts +3 -0
- package/dist/unstable/sql/SqlStream.d.ts.map +1 -1
- package/dist/unstable/sql/SqlStream.js +23 -0
- package/dist/unstable/sql/SqlStream.js.map +1 -1
- package/dist/unstable/sql/Statement.d.ts +124 -0
- package/dist/unstable/sql/Statement.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.js +82 -0
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/sql/index.d.ts +1 -1
- package/dist/unstable/sql/index.js +1 -1
- package/dist/unstable/workers/Transferable.d.ts +65 -13
- package/dist/unstable/workers/Transferable.d.ts.map +1 -1
- package/dist/unstable/workers/Transferable.js +53 -10
- package/dist/unstable/workers/Transferable.js.map +1 -1
- package/dist/unstable/workers/Worker.d.ts +60 -8
- package/dist/unstable/workers/Worker.d.ts.map +1 -1
- package/dist/unstable/workers/Worker.js +43 -4
- package/dist/unstable/workers/Worker.js.map +1 -1
- package/dist/unstable/workers/WorkerError.d.ts +31 -9
- package/dist/unstable/workers/WorkerError.d.ts.map +1 -1
- package/dist/unstable/workers/WorkerError.js +44 -7
- package/dist/unstable/workers/WorkerError.js.map +1 -1
- package/dist/unstable/workers/WorkerRunner.d.ts +32 -3
- package/dist/unstable/workers/WorkerRunner.d.ts.map +1 -1
- package/dist/unstable/workers/WorkerRunner.js +24 -1
- package/dist/unstable/workers/WorkerRunner.js.map +1 -1
- package/dist/unstable/workers/index.d.ts +1 -1
- package/dist/unstable/workers/index.js +1 -1
- package/dist/unstable/workflow/Activity.d.ts +61 -10
- package/dist/unstable/workflow/Activity.d.ts.map +1 -1
- package/dist/unstable/workflow/Activity.js +20 -5
- package/dist/unstable/workflow/Activity.js.map +1 -1
- package/dist/unstable/workflow/DurableClock.d.ts +12 -3
- package/dist/unstable/workflow/DurableClock.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableClock.js +22 -2
- package/dist/unstable/workflow/DurableClock.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts +126 -31
- package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.js +76 -13
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/DurableQueue.d.ts +30 -7
- package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableQueue.js +23 -5
- package/dist/unstable/workflow/DurableQueue.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +100 -31
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js +75 -19
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +40 -5
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +16 -4
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.d.ts +32 -2
- package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.js +2 -2
- package/dist/unstable/workflow/WorkflowProxy.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.d.ts +36 -2
- package/dist/unstable/workflow/WorkflowProxyServer.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.js +12 -6
- package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
- package/package.json +11 -11
- package/src/Array.ts +113 -67
- package/src/BigDecimal.ts +404 -337
- package/src/BigInt.ts +167 -97
- package/src/Boolean.ts +62 -31
- package/src/Brand.ts +20 -1
- package/src/Cache.ts +331 -164
- package/src/Cause.ts +74 -62
- package/src/Channel.ts +1585 -607
- package/src/ChannelSchema.ts +137 -12
- package/src/Chunk.ts +549 -380
- package/src/Clock.ts +15 -8
- package/src/Combiner.ts +2 -4
- package/src/Config.ts +4 -2
- package/src/ConfigProvider.ts +1 -1
- package/src/Console.ts +88 -58
- package/src/Context.ts +384 -135
- package/src/Cron.ts +111 -48
- package/src/Data.ts +3 -2
- package/src/DateTime.ts +874 -443
- package/src/Deferred.ts +367 -174
- package/src/Differ.ts +42 -0
- package/src/Duration.ts +329 -185
- package/src/Effect.ts +2127 -1957
- package/src/Effectable.ts +37 -2
- package/src/Encoding.ts +78 -28
- package/src/Equivalence.ts +14 -19
- package/src/ErrorReporter.ts +66 -82
- package/src/ExecutionPlan.ts +94 -9
- package/src/Exit.ts +7 -5
- package/src/Fiber.ts +72 -40
- package/src/FiberHandle.ts +156 -56
- package/src/FiberMap.ts +327 -162
- package/src/FiberSet.ts +129 -51
- package/src/FileSystem.ts +106 -74
- package/src/Filter.ts +166 -88
- package/src/Function.ts +154 -86
- package/src/Graph.ts +682 -365
- package/src/HKT.ts +29 -13
- package/src/Hash.ts +31 -18
- package/src/HashMap.ts +444 -256
- package/src/HashRing.ts +94 -17
- package/src/HashSet.ts +194 -104
- package/src/Inspectable.ts +22 -10
- package/src/Iterable.ts +309 -149
- package/src/JsonPatch.ts +4 -3
- package/src/Latch.ts +98 -15
- package/src/Layer.ts +487 -344
- package/src/LayerMap.ts +95 -21
- package/src/LogLevel.ts +92 -131
- package/src/Logger.ts +357 -288
- package/src/ManagedRuntime.ts +75 -17
- package/src/Match.ts +133 -157
- package/src/Metric.ts +355 -304
- package/src/MutableHashMap.ts +161 -84
- package/src/MutableHashSet.ts +122 -52
- package/src/MutableList.ts +141 -81
- package/src/MutableRef.ts +130 -90
- package/src/Newtype.ts +3 -0
- package/src/NonEmptyIterable.ts +36 -39
- package/src/Number.ts +116 -64
- package/src/Optic.ts +1 -2
- package/src/Option.ts +28 -47
- package/src/Ordering.ts +43 -28
- package/src/PartitionedSemaphore.ts +225 -40
- package/src/Path.ts +77 -13
- package/src/Pipeable.ts +76 -21
- package/src/PlatformError.ts +74 -6
- package/src/Pool.ts +94 -31
- package/src/Predicate.ts +16 -21
- package/src/PrimaryKey.ts +9 -2
- package/src/PubSub.ts +364 -262
- package/src/Pull.ts +94 -25
- package/src/Queue.ts +284 -150
- package/src/Random.ts +54 -35
- package/src/RcMap.ts +151 -141
- package/src/RcRef.ts +69 -32
- package/src/Record.ts +273 -129
- package/src/Redactable.ts +3 -3
- package/src/Redacted.ts +63 -33
- package/src/Ref.ts +161 -104
- package/src/References.ts +73 -31
- package/src/RegExp.ts +11 -5
- package/src/Request.ts +158 -34
- package/src/RequestResolver.ts +277 -119
- package/src/Resource.ts +45 -7
- package/src/Result.ts +18 -16
- package/src/Runtime.ts +45 -19
- package/src/Schedule.ts +574 -599
- package/src/Scheduler.ts +43 -6
- package/src/Schema.ts +819 -295
- package/src/SchemaAST.ts +25 -16
- package/src/SchemaGetter.ts +29 -14
- package/src/SchemaIssue.ts +1 -8
- package/src/SchemaParser.ts +262 -38
- package/src/SchemaTransformation.ts +61 -41
- package/src/SchemaUtils.ts +23 -0
- package/src/Scope.ts +102 -43
- package/src/ScopedCache.ts +192 -56
- package/src/ScopedRef.ts +28 -8
- package/src/Semaphore.ts +64 -28
- package/src/Sink.ts +458 -200
- package/src/Stdio.ts +43 -6
- package/src/Stream.ts +2039 -1252
- package/src/String.ts +171 -95
- package/src/SubscriptionRef.ts +308 -203
- package/src/Symbol.ts +13 -5
- package/src/SynchronizedRef.ts +278 -62
- package/src/Take.ts +26 -2
- package/src/Terminal.ts +40 -7
- package/src/Tracer.ts +229 -55
- package/src/Trie.ts +213 -142
- package/src/TxChunk.ts +182 -146
- package/src/TxDeferred.ts +43 -29
- package/src/TxHashMap.ts +370 -230
- package/src/TxHashSet.ts +250 -152
- package/src/TxPriorityQueue.ts +96 -64
- package/src/TxPubSub.ts +77 -49
- package/src/TxQueue.ts +279 -241
- package/src/TxReentrantLock.ts +70 -47
- package/src/TxRef.ts +69 -40
- package/src/TxSemaphore.ts +101 -54
- package/src/TxSubscriptionRef.ts +72 -48
- package/src/Types.ts +34 -34
- package/src/UndefinedOr.ts +48 -25
- package/src/Unify.ts +71 -116
- package/src/Utils.ts +4 -0
- package/src/index.ts +81 -32
- package/src/internal/schema/schema.ts +1 -1
- package/src/testing/FastCheck.ts +6 -3
- package/src/testing/TestClock.ts +63 -34
- package/src/testing/TestConsole.ts +49 -30
- package/src/testing/TestSchema.ts +8 -8
- package/src/unstable/ai/AiError.ts +187 -120
- package/src/unstable/ai/AnthropicStructuredOutput.ts +2 -2
- package/src/unstable/ai/Chat.ts +69 -43
- package/src/unstable/ai/EmbeddingModel.ts +12 -11
- package/src/unstable/ai/IdGenerator.ts +28 -18
- package/src/unstable/ai/LanguageModel.ts +35 -27
- package/src/unstable/ai/McpSchema.ts +339 -119
- package/src/unstable/ai/McpServer.ts +76 -19
- package/src/unstable/ai/Model.ts +8 -6
- package/src/unstable/ai/OpenAiStructuredOutput.ts +2 -2
- package/src/unstable/ai/Prompt.ts +210 -184
- package/src/unstable/ai/Response.ts +159 -147
- package/src/unstable/ai/ResponseIdTracker.ts +43 -4
- package/src/unstable/ai/Telemetry.ts +42 -32
- package/src/unstable/ai/Tokenizer.ts +13 -8
- package/src/unstable/ai/Tool.ts +154 -85
- package/src/unstable/ai/Toolkit.ts +51 -46
- package/src/unstable/ai/index.ts +42 -24
- package/src/unstable/cli/Argument.ts +226 -134
- package/src/unstable/cli/CliError.ts +96 -26
- package/src/unstable/cli/CliOutput.ts +43 -13
- package/src/unstable/cli/Command.ts +194 -113
- package/src/unstable/cli/Completions.ts +7 -7
- package/src/unstable/cli/Flag.ts +235 -142
- package/src/unstable/cli/GlobalFlag.ts +41 -13
- package/src/unstable/cli/HelpDoc.ts +35 -10
- package/src/unstable/cli/Param.ts +327 -189
- package/src/unstable/cli/Primitive.ts +79 -42
- package/src/unstable/cli/Prompt.ts +201 -45
- package/src/unstable/cli/internal/ansi.ts +13 -0
- package/src/unstable/cli/internal/command.ts +5 -1
- package/src/unstable/cli/internal/config.ts +3 -0
- package/src/unstable/cli/internal/lexer.ts +11 -0
- package/src/unstable/cluster/ClusterCron.ts +35 -1
- package/src/unstable/cluster/ClusterError.ts +56 -7
- package/src/unstable/cluster/ClusterMetrics.ts +39 -5
- package/src/unstable/cluster/ClusterSchema.ts +61 -8
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +35 -2
- package/src/unstable/cluster/DeliverAt.ts +39 -4
- package/src/unstable/cluster/Entity.ts +107 -16
- package/src/unstable/cluster/EntityAddress.ts +30 -2
- package/src/unstable/cluster/EntityId.ts +18 -3
- package/src/unstable/cluster/EntityProxy.ts +34 -2
- package/src/unstable/cluster/EntityProxyServer.ts +44 -8
- package/src/unstable/cluster/EntityResource.ts +43 -6
- package/src/unstable/cluster/EntityType.ts +27 -3
- package/src/unstable/cluster/Envelope.ts +128 -23
- package/src/unstable/cluster/HttpRunner.ts +88 -13
- package/src/unstable/cluster/K8sHttpClient.ts +49 -6
- package/src/unstable/cluster/MachineId.ts +24 -3
- package/src/unstable/cluster/Message.ts +102 -13
- package/src/unstable/cluster/MessageStorage.ts +127 -21
- package/src/unstable/cluster/Reply.ts +101 -12
- package/src/unstable/cluster/Runner.ts +47 -17
- package/src/unstable/cluster/RunnerAddress.ts +34 -2
- package/src/unstable/cluster/RunnerHealth.ts +40 -12
- package/src/unstable/cluster/RunnerServer.ts +31 -4
- package/src/unstable/cluster/RunnerStorage.ts +42 -5
- package/src/unstable/cluster/Runners.ts +73 -10
- package/src/unstable/cluster/ShardId.ts +51 -5
- package/src/unstable/cluster/Sharding.ts +35 -4
- package/src/unstable/cluster/ShardingConfig.ts +75 -10
- package/src/unstable/cluster/ShardingRegistrationEvent.ts +31 -7
- package/src/unstable/cluster/SingleRunner.ts +23 -1
- package/src/unstable/cluster/Singleton.ts +15 -1
- package/src/unstable/cluster/SingletonAddress.ts +21 -1
- package/src/unstable/cluster/Snowflake.ts +89 -19
- package/src/unstable/cluster/SocketRunner.ts +29 -2
- package/src/unstable/cluster/SqlMessageStorage.ts +27 -3
- package/src/unstable/cluster/SqlRunnerStorage.ts +46 -7
- package/src/unstable/cluster/TestRunner.ts +18 -1
- package/src/unstable/cluster/internal/hash.ts +12 -0
- package/src/unstable/devtools/DevTools.ts +26 -3
- package/src/unstable/devtools/DevToolsClient.ts +32 -5
- package/src/unstable/devtools/DevToolsSchema.ts +201 -44
- package/src/unstable/devtools/DevToolsServer.ts +27 -2
- package/src/unstable/encoding/Msgpack.ts +97 -12
- package/src/unstable/encoding/Ndjson.ts +149 -21
- package/src/unstable/encoding/Sse.ts +109 -18
- package/src/unstable/eventlog/Event.ts +131 -30
- package/src/unstable/eventlog/EventGroup.ts +50 -17
- package/src/unstable/eventlog/EventJournal.ts +120 -20
- package/src/unstable/eventlog/EventLog.ts +151 -31
- package/src/unstable/eventlog/EventLogEncryption.ts +42 -6
- package/src/unstable/eventlog/EventLogMessage.ts +92 -18
- package/src/unstable/eventlog/EventLogRemote.ts +54 -8
- package/src/unstable/eventlog/EventLogServer.ts +33 -3
- package/src/unstable/eventlog/EventLogServerEncrypted.ts +52 -6
- package/src/unstable/eventlog/EventLogServerUnencrypted.ts +90 -16
- package/src/unstable/eventlog/EventLogSessionAuth.ts +77 -15
- package/src/unstable/eventlog/SqlEventJournal.ts +28 -2
- package/src/unstable/eventlog/SqlEventLogServerEncrypted.ts +32 -3
- package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +28 -2
- package/src/unstable/http/Cookies.ts +156 -77
- package/src/unstable/http/Etag.ts +40 -7
- package/src/unstable/http/FetchHttpClient.ts +33 -4
- package/src/unstable/http/FindMyWay.ts +1 -1
- package/src/unstable/http/Headers.ts +252 -50
- package/src/unstable/http/HttpBody.ts +128 -26
- package/src/unstable/http/HttpClient.ts +205 -96
- package/src/unstable/http/HttpClientError.ts +80 -12
- package/src/unstable/http/HttpClientRequest.ts +318 -100
- package/src/unstable/http/HttpClientResponse.ts +59 -16
- package/src/unstable/http/HttpEffect.ts +66 -18
- package/src/unstable/http/HttpIncomingMessage.ts +47 -7
- package/src/unstable/http/HttpMethod.ts +35 -5
- package/src/unstable/http/HttpMiddleware.ts +59 -11
- package/src/unstable/http/HttpPlatform.ts +34 -3
- package/src/unstable/http/HttpRouter.ts +217 -52
- package/src/unstable/http/HttpServer.ts +151 -22
- package/src/unstable/http/HttpServerError.ts +90 -10
- package/src/unstable/http/HttpServerRequest.ts +125 -21
- package/src/unstable/http/HttpServerRespondable.ts +49 -6
- package/src/unstable/http/HttpServerResponse.ts +390 -67
- package/src/unstable/http/HttpStaticServer.ts +22 -4
- package/src/unstable/http/HttpTraceContext.ts +53 -6
- package/src/unstable/http/Multipart.ts +178 -28
- package/src/unstable/http/Multipasta/HeadersParser.ts +1 -1
- package/src/unstable/http/Multipasta/Node.ts +1 -1
- package/src/unstable/http/Multipasta/Search.ts +1 -1
- package/src/unstable/http/Multipasta/Web.ts +1 -1
- package/src/unstable/http/Multipasta.ts +1 -1
- package/src/unstable/http/Template.ts +53 -0
- package/src/unstable/http/Url.ts +56 -42
- package/src/unstable/http/UrlParams.ts +233 -49
- package/src/unstable/httpapi/HttpApi.ts +49 -14
- package/src/unstable/httpapi/HttpApiBuilder.ts +82 -16
- package/src/unstable/httpapi/HttpApiClient.ts +79 -15
- package/src/unstable/httpapi/HttpApiEndpoint.ts +238 -59
- package/src/unstable/httpapi/HttpApiError.ts +100 -1
- package/src/unstable/httpapi/HttpApiGroup.ts +87 -20
- package/src/unstable/httpapi/HttpApiMiddleware.ts +111 -22
- package/src/unstable/httpapi/HttpApiScalar.ts +38 -4
- package/src/unstable/httpapi/HttpApiSchema.ts +67 -30
- package/src/unstable/httpapi/HttpApiSecurity.ts +74 -17
- package/src/unstable/httpapi/HttpApiSwagger.ts +24 -2
- package/src/unstable/httpapi/HttpApiTest.ts +26 -1
- package/src/unstable/httpapi/OpenApi.ts +115 -15
- package/src/unstable/observability/Otlp.ts +33 -3
- package/src/unstable/observability/OtlpExporter.ts +32 -1
- package/src/unstable/observability/OtlpLogger.ts +31 -2
- package/src/unstable/observability/OtlpMetrics.ts +37 -4
- package/src/unstable/observability/OtlpResource.ts +68 -12
- package/src/unstable/observability/OtlpSerialization.ts +28 -3
- package/src/unstable/observability/OtlpTracer.ts +38 -2
- package/src/unstable/observability/PrometheusMetrics.ts +32 -12
- package/src/unstable/observability/index.ts +2 -1
- package/src/unstable/persistence/KeyValueStore.ts +108 -28
- package/src/unstable/persistence/Persistable.ts +76 -15
- package/src/unstable/persistence/PersistedCache.ts +27 -2
- package/src/unstable/persistence/PersistedQueue.ts +98 -16
- package/src/unstable/persistence/Persistence.ts +97 -16
- package/src/unstable/persistence/RateLimiter.ts +97 -21
- package/src/unstable/persistence/Redis.ts +42 -5
- package/src/unstable/process/ChildProcess.ts +89 -65
- package/src/unstable/process/ChildProcessSpawner.ts +22 -11
- package/src/unstable/process/index.ts +2 -1
- package/src/unstable/reactivity/AsyncResult.ts +202 -61
- package/src/unstable/reactivity/Atom.ts +593 -139
- package/src/unstable/reactivity/AtomHttpApi.ts +41 -2
- package/src/unstable/reactivity/AtomRef.ts +51 -7
- package/src/unstable/reactivity/AtomRegistry.ts +141 -22
- package/src/unstable/reactivity/AtomRpc.ts +36 -2
- package/src/unstable/reactivity/Hydration.ts +45 -5
- package/src/unstable/reactivity/Reactivity.ts +95 -13
- package/src/unstable/rpc/Rpc.ts +255 -56
- package/src/unstable/rpc/RpcClient.ts +107 -19
- package/src/unstable/rpc/RpcClientError.ts +26 -2
- package/src/unstable/rpc/RpcGroup.ts +51 -8
- package/src/unstable/rpc/RpcMessage.ts +128 -32
- package/src/unstable/rpc/RpcMiddleware.ts +100 -20
- package/src/unstable/rpc/RpcSchema.ts +38 -4
- package/src/unstable/rpc/RpcSerialization.ts +60 -13
- package/src/unstable/rpc/RpcServer.ts +107 -23
- package/src/unstable/rpc/RpcTest.ts +20 -1
- package/src/unstable/rpc/RpcWorker.ts +40 -6
- package/src/unstable/rpc/Utils.ts +31 -0
- package/src/unstable/schema/Model.ts +148 -52
- package/src/unstable/schema/VariantSchema.ts +104 -24
- package/src/unstable/socket/Socket.ts +167 -34
- package/src/unstable/socket/SocketServer.ts +58 -10
- package/src/unstable/sql/Migrator.ts +56 -4
- package/src/unstable/sql/SqlClient.ts +55 -2
- package/src/unstable/sql/SqlConnection.ts +31 -0
- package/src/unstable/sql/SqlError.ts +117 -0
- package/src/unstable/sql/SqlModel.ts +26 -5
- package/src/unstable/sql/SqlResolver.ts +56 -13
- package/src/unstable/sql/SqlSchema.ts +29 -8
- package/src/unstable/sql/SqlStream.ts +23 -0
- package/src/unstable/sql/Statement.ts +141 -0
- package/src/unstable/sql/index.ts +1 -1
- package/src/unstable/workers/Transferable.ts +65 -13
- package/src/unstable/workers/Worker.ts +60 -8
- package/src/unstable/workers/WorkerError.ts +50 -9
- package/src/unstable/workers/WorkerRunner.ts +32 -3
- package/src/unstable/workers/index.ts +1 -1
- package/src/unstable/workflow/Activity.ts +61 -10
- package/src/unstable/workflow/DurableClock.ts +26 -3
- package/src/unstable/workflow/DurableDeferred.ts +146 -31
- package/src/unstable/workflow/DurableQueue.ts +30 -7
- package/src/unstable/workflow/Workflow.ts +121 -31
- package/src/unstable/workflow/WorkflowEngine.ts +40 -5
- package/src/unstable/workflow/WorkflowProxy.ts +32 -2
- package/src/unstable/workflow/WorkflowProxyServer.ts +40 -6
package/dist/Effect.js
CHANGED
|
@@ -12,6 +12,8 @@ import * as Metric from "./Metric.js";
|
|
|
12
12
|
import { CurrentLogAnnotations, CurrentLogSpans } from "./References.js";
|
|
13
13
|
import { internalCall } from "./Utils.js";
|
|
14
14
|
/**
|
|
15
|
+
* Runtime identifier used to recognize `Effect` values.
|
|
16
|
+
*
|
|
15
17
|
* @category Type identifiers
|
|
16
18
|
* @since 2.0.0
|
|
17
19
|
*/
|
|
@@ -19,7 +21,8 @@ export const TypeId = core.EffectTypeId;
|
|
|
19
21
|
/**
|
|
20
22
|
* Tests if a value is an `Effect`.
|
|
21
23
|
*
|
|
22
|
-
*
|
|
24
|
+
* **Example** (Usage)
|
|
25
|
+
*
|
|
23
26
|
* ```ts
|
|
24
27
|
* import { Effect } from "effect"
|
|
25
28
|
*
|
|
@@ -27,54 +30,30 @@ export const TypeId = core.EffectTypeId;
|
|
|
27
30
|
* console.log(Effect.isEffect("hello")) // false
|
|
28
31
|
* ```
|
|
29
32
|
*
|
|
30
|
-
* @since 2.0.0
|
|
31
33
|
* @category Guards
|
|
34
|
+
* @since 2.0.0
|
|
32
35
|
*/
|
|
33
36
|
export const isEffect = core.isEffect;
|
|
34
37
|
/**
|
|
35
|
-
* Combines
|
|
36
|
-
*
|
|
38
|
+
* Combines an iterable or record of effects into one effect whose success shape
|
|
39
|
+
* follows the input.
|
|
37
40
|
*
|
|
38
41
|
* **Details**
|
|
39
42
|
*
|
|
40
|
-
*
|
|
41
|
-
* results
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
* For instance, if the input is a tuple:
|
|
45
|
-
*
|
|
46
|
-
* ```ts skip-type-checking
|
|
47
|
-
* // ┌─── a tuple of effects
|
|
48
|
-
* // ▼
|
|
49
|
-
* Effect.all([effect1, effect2, ...])
|
|
50
|
-
* ```
|
|
51
|
-
*
|
|
52
|
-
* the effects are executed sequentially, and the result is a new effect
|
|
53
|
-
* containing the results as a tuple. The results in the tuple match the order
|
|
54
|
-
* of the effects passed to `Effect.all`.
|
|
55
|
-
*
|
|
56
|
-
* **Concurrency**
|
|
57
|
-
*
|
|
58
|
-
* You can control the execution order (e.g., sequential vs. concurrent) using
|
|
59
|
-
* the `concurrency` option.
|
|
43
|
+
* Tuple and iterable inputs collect results in order. Record inputs collect
|
|
44
|
+
* results under the same keys. By default, the combined effect fails on the
|
|
45
|
+
* first failure; with concurrent execution, effects that have already started
|
|
46
|
+
* may be interrupted, while effects not yet started are skipped.
|
|
60
47
|
*
|
|
61
|
-
* **
|
|
48
|
+
* **Options**
|
|
62
49
|
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
* and collect every success / failure as `Result` values.
|
|
50
|
+
* Use `concurrency` to control sequential or concurrent execution. Use
|
|
51
|
+
* `mode: "result"` to run every effect and collect each success or failure as a
|
|
52
|
+
* `Result` in the same output shape. Use `discard: true` to ignore successful
|
|
53
|
+
* values and return `void`.
|
|
68
54
|
*
|
|
69
|
-
* **
|
|
55
|
+
* **Example** (Combining Effects in Tuples)
|
|
70
56
|
*
|
|
71
|
-
* The `{ mode: "result" }` option changes the behavior of `Effect.all` to
|
|
72
|
-
* ensure all effects run, even if some fail. Instead of stopping on the first
|
|
73
|
-
* failure, this mode collects both successes and failures, returning an array
|
|
74
|
-
* of `Result` instances where each result is either an `Ok` (success) or a
|
|
75
|
-
* `Err` (failure).
|
|
76
|
-
*
|
|
77
|
-
* @example Combining Effects in Tuples
|
|
78
57
|
* ```ts
|
|
79
58
|
* import { Console, Effect } from "effect"
|
|
80
59
|
*
|
|
@@ -94,7 +73,8 @@ export const isEffect = core.isEffect;
|
|
|
94
73
|
* // [ 42, 'Hello' ]
|
|
95
74
|
* ```
|
|
96
75
|
*
|
|
97
|
-
*
|
|
76
|
+
* **Example** (Combining Effects in Iterables)
|
|
77
|
+
*
|
|
98
78
|
* ```ts
|
|
99
79
|
* import { Console, Effect } from "effect"
|
|
100
80
|
*
|
|
@@ -114,7 +94,8 @@ export const isEffect = core.isEffect;
|
|
|
114
94
|
* // [ 1, 2, 3 ]
|
|
115
95
|
* ```
|
|
116
96
|
*
|
|
117
|
-
*
|
|
97
|
+
* **Example** (Combining Effects in Structs)
|
|
98
|
+
*
|
|
118
99
|
* ```ts
|
|
119
100
|
* import { Console, Effect } from "effect"
|
|
120
101
|
*
|
|
@@ -134,7 +115,8 @@ export const isEffect = core.isEffect;
|
|
|
134
115
|
* // { a: 42, b: 'Hello' }
|
|
135
116
|
* ```
|
|
136
117
|
*
|
|
137
|
-
*
|
|
118
|
+
* **Example** (Combining Effects in Records)
|
|
119
|
+
*
|
|
138
120
|
* ```ts
|
|
139
121
|
* import { Console, Effect } from "effect"
|
|
140
122
|
*
|
|
@@ -154,7 +136,8 @@ export const isEffect = core.isEffect;
|
|
|
154
136
|
* // { key1: 1, key2: 2 }
|
|
155
137
|
* ```
|
|
156
138
|
*
|
|
157
|
-
*
|
|
139
|
+
* **Example** (Short-Circuiting Behavior)
|
|
140
|
+
*
|
|
158
141
|
* ```ts
|
|
159
142
|
* import { Console, Effect } from "effect"
|
|
160
143
|
*
|
|
@@ -177,8 +160,8 @@ export const isEffect = core.isEffect;
|
|
|
177
160
|
*
|
|
178
161
|
* @see {@link forEach} for iterating over elements and applying an effect.
|
|
179
162
|
*
|
|
180
|
-
* @since 2.0.0
|
|
181
163
|
* @category Collecting
|
|
164
|
+
* @since 2.0.0
|
|
182
165
|
*/
|
|
183
166
|
export const all = internal.all;
|
|
184
167
|
/**
|
|
@@ -193,7 +176,8 @@ export const all = internal.all;
|
|
|
193
176
|
* This function runs every effect and never fails. Use `concurrency` to control
|
|
194
177
|
* parallelism.
|
|
195
178
|
*
|
|
196
|
-
*
|
|
179
|
+
* **Example** (Usage)
|
|
180
|
+
*
|
|
197
181
|
* ```ts
|
|
198
182
|
* import { Effect } from "effect"
|
|
199
183
|
*
|
|
@@ -205,8 +189,8 @@ export const all = internal.all;
|
|
|
205
189
|
* // [ ["0 is even", "2 is even"], [1, 3] ]
|
|
206
190
|
* ```
|
|
207
191
|
*
|
|
208
|
-
* @since 3.0.0
|
|
209
192
|
* @category Collecting
|
|
193
|
+
* @since 3.0.0
|
|
210
194
|
*/
|
|
211
195
|
export const partition = internal.partition;
|
|
212
196
|
/**
|
|
@@ -219,7 +203,8 @@ export const partition = internal.partition;
|
|
|
219
203
|
* Use `discard: true` to ignore successful values while still validating all
|
|
220
204
|
* elements.
|
|
221
205
|
*
|
|
222
|
-
*
|
|
206
|
+
* **Example** (Usage)
|
|
207
|
+
*
|
|
223
208
|
* ```ts
|
|
224
209
|
* import { Effect } from "effect"
|
|
225
210
|
*
|
|
@@ -241,8 +226,8 @@ export const partition = internal.partition;
|
|
|
241
226
|
* // }
|
|
242
227
|
* ```
|
|
243
228
|
*
|
|
244
|
-
* @since 4.0.0
|
|
245
229
|
* @category Error Accumulation
|
|
230
|
+
* @since 4.0.0
|
|
246
231
|
*/
|
|
247
232
|
export const validate = internal.validate;
|
|
248
233
|
/**
|
|
@@ -251,7 +236,8 @@ export const validate = internal.validate;
|
|
|
251
236
|
* The predicate receives the element and its index. Evaluation short-circuits
|
|
252
237
|
* as soon as an element matches.
|
|
253
238
|
*
|
|
254
|
-
*
|
|
239
|
+
* **Example** (Usage)
|
|
240
|
+
*
|
|
255
241
|
* ```ts
|
|
256
242
|
* import { Effect } from "effect"
|
|
257
243
|
*
|
|
@@ -261,8 +247,8 @@ export const validate = internal.validate;
|
|
|
261
247
|
* // { _id: 'Option', _tag: 'Some', value: 3 }
|
|
262
248
|
* ```
|
|
263
249
|
*
|
|
264
|
-
* @since 2.0.0
|
|
265
250
|
* @category Collecting
|
|
251
|
+
* @since 2.0.0
|
|
266
252
|
*/
|
|
267
253
|
export const findFirst = internal.findFirst;
|
|
268
254
|
/**
|
|
@@ -271,8 +257,8 @@ export const findFirst = internal.findFirst;
|
|
|
271
257
|
* The filter receives the element and index. Evaluation short-circuits on the
|
|
272
258
|
* first `Result.succeed` and returns the transformed value in `Option.some`.
|
|
273
259
|
*
|
|
274
|
-
* @since 4.0.0
|
|
275
260
|
* @category Collecting
|
|
261
|
+
* @since 4.0.0
|
|
276
262
|
*/
|
|
277
263
|
export const findFirstFilter = internal.findFirstFilter;
|
|
278
264
|
/**
|
|
@@ -298,9 +284,9 @@ export const findFirstFilter = internal.findFirstFilter;
|
|
|
298
284
|
*
|
|
299
285
|
* @see {@link all} for combining multiple effects into one.
|
|
300
286
|
*
|
|
301
|
-
*
|
|
287
|
+
* **Example** (Applying Effects to Iterable Elements)
|
|
288
|
+
*
|
|
302
289
|
* ```ts
|
|
303
|
-
* // Title: Applying Effects to Iterable Elements
|
|
304
290
|
* import { Effect } from "effect"
|
|
305
291
|
* import { Console } from "effect"
|
|
306
292
|
*
|
|
@@ -320,8 +306,9 @@ export const findFirstFilter = internal.findFirstFilter;
|
|
|
320
306
|
* // [ 2, 4, 6, 8, 10 ]
|
|
321
307
|
* ```
|
|
322
308
|
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
309
|
+
* **Example** (Using discard to Ignore Results)
|
|
310
|
+
*
|
|
311
|
+
* ```ts
|
|
325
312
|
* import { Effect } from "effect"
|
|
326
313
|
* import { Console } from "effect"
|
|
327
314
|
*
|
|
@@ -341,15 +328,17 @@ export const findFirstFilter = internal.findFirstFilter;
|
|
|
341
328
|
* // Currently at index 3
|
|
342
329
|
* // Currently at index 4
|
|
343
330
|
* // undefined
|
|
331
|
+
* ```
|
|
344
332
|
*
|
|
345
|
-
* @since 2.0.0
|
|
346
333
|
* @category Collecting
|
|
334
|
+
* @since 2.0.0
|
|
347
335
|
*/
|
|
348
336
|
export const forEach = internal.forEach;
|
|
349
337
|
/**
|
|
350
338
|
* Executes a body effect repeatedly while a condition holds true.
|
|
351
339
|
*
|
|
352
|
-
*
|
|
340
|
+
* **Example** (Usage)
|
|
341
|
+
*
|
|
353
342
|
* ```ts
|
|
354
343
|
* import { Effect } from "effect"
|
|
355
344
|
*
|
|
@@ -370,8 +359,8 @@ export const forEach = internal.forEach;
|
|
|
370
359
|
* // Current count: 5
|
|
371
360
|
* ```
|
|
372
361
|
*
|
|
373
|
-
* @since 2.0.0
|
|
374
362
|
* @category Collecting
|
|
363
|
+
* @since 2.0.0
|
|
375
364
|
*/
|
|
376
365
|
export const whileLoop = internal.whileLoop;
|
|
377
366
|
// -----------------------------------------------------------------------------
|
|
@@ -402,9 +391,9 @@ export const whileLoop = internal.whileLoop;
|
|
|
402
391
|
*
|
|
403
392
|
* @see {@link tryPromise} for a version that can handle failures.
|
|
404
393
|
*
|
|
405
|
-
*
|
|
394
|
+
* **Example** (Delayed Message)
|
|
395
|
+
*
|
|
406
396
|
* ```ts
|
|
407
|
-
* // Title: Delayed Message
|
|
408
397
|
* import { Effect } from "effect"
|
|
409
398
|
*
|
|
410
399
|
* const delay = (message: string) =>
|
|
@@ -422,8 +411,8 @@ export const whileLoop = internal.whileLoop;
|
|
|
422
411
|
* const program = delay("Async operation completed successfully!")
|
|
423
412
|
* ```
|
|
424
413
|
*
|
|
425
|
-
* @since 2.0.0
|
|
426
414
|
* @category Creating Effects
|
|
415
|
+
* @since 2.0.0
|
|
427
416
|
*/
|
|
428
417
|
export const promise = internal.promise;
|
|
429
418
|
/**
|
|
@@ -452,7 +441,8 @@ export const promise = internal.promise;
|
|
|
452
441
|
* An optional `AbortSignal` can be provided to allow for interruption of the
|
|
453
442
|
* wrapped `Promise` API.
|
|
454
443
|
*
|
|
455
|
-
*
|
|
444
|
+
* **Example** (Fetching a TODO Item)
|
|
445
|
+
*
|
|
456
446
|
* ```ts
|
|
457
447
|
* import { Effect } from "effect"
|
|
458
448
|
*
|
|
@@ -467,7 +457,8 @@ export const promise = internal.promise;
|
|
|
467
457
|
* const program = getTodo(1)
|
|
468
458
|
* ```
|
|
469
459
|
*
|
|
470
|
-
*
|
|
460
|
+
* **Example** (Custom Error Handling)
|
|
461
|
+
*
|
|
471
462
|
* ```ts
|
|
472
463
|
* import { Data, Effect } from "effect"
|
|
473
464
|
*
|
|
@@ -487,8 +478,8 @@ export const promise = internal.promise;
|
|
|
487
478
|
*
|
|
488
479
|
* @see {@link promise} if the effectful computation is asynchronous and does not throw errors.
|
|
489
480
|
*
|
|
490
|
-
* @since 2.0.0
|
|
491
481
|
* @category Creating Effects
|
|
482
|
+
* @since 2.0.0
|
|
492
483
|
*/
|
|
493
484
|
export const tryPromise = internal.tryPromise;
|
|
494
485
|
/**
|
|
@@ -501,9 +492,9 @@ export const tryPromise = internal.tryPromise;
|
|
|
501
492
|
*
|
|
502
493
|
* @see {@link fail} to create an effect that represents a failure.
|
|
503
494
|
*
|
|
504
|
-
*
|
|
495
|
+
* **Example** (Creating a Successful Effect)
|
|
496
|
+
*
|
|
505
497
|
* ```ts
|
|
506
|
-
* // Title: Creating a Successful Effect
|
|
507
498
|
* import { Effect } from "effect"
|
|
508
499
|
*
|
|
509
500
|
* // Creating an effect that represents a successful scenario
|
|
@@ -513,14 +504,15 @@ export const tryPromise = internal.tryPromise;
|
|
|
513
504
|
* const success = Effect.succeed(42)
|
|
514
505
|
* ```
|
|
515
506
|
*
|
|
516
|
-
* @since 2.0.0
|
|
517
507
|
* @category Creating Effects
|
|
508
|
+
* @since 2.0.0
|
|
518
509
|
*/
|
|
519
510
|
export const succeed = internal.succeed;
|
|
520
511
|
/**
|
|
521
512
|
* Returns an effect which succeeds with `None`.
|
|
522
513
|
*
|
|
523
|
-
*
|
|
514
|
+
* **Example** (Usage)
|
|
515
|
+
*
|
|
524
516
|
* ```ts
|
|
525
517
|
* import { Effect } from "effect"
|
|
526
518
|
*
|
|
@@ -530,14 +522,15 @@ export const succeed = internal.succeed;
|
|
|
530
522
|
* // Output: { _id: 'Option', _tag: 'None' }
|
|
531
523
|
* ```
|
|
532
524
|
*
|
|
533
|
-
* @since 2.0.0
|
|
534
525
|
* @category Creating Effects
|
|
526
|
+
* @since 2.0.0
|
|
535
527
|
*/
|
|
536
528
|
export const succeedNone = internal.succeedNone;
|
|
537
529
|
/**
|
|
538
530
|
* Returns an effect which succeeds with the value wrapped in a `Some`.
|
|
539
531
|
*
|
|
540
|
-
*
|
|
532
|
+
* **Example** (Usage)
|
|
533
|
+
*
|
|
541
534
|
* ```ts
|
|
542
535
|
* import { Effect } from "effect"
|
|
543
536
|
*
|
|
@@ -547,8 +540,8 @@ export const succeedNone = internal.succeedNone;
|
|
|
547
540
|
* // Output: { _id: 'Option', _tag: 'Some', value: 42 }
|
|
548
541
|
* ```
|
|
549
542
|
*
|
|
550
|
-
* @since 2.0.0
|
|
551
543
|
* @category Creating Effects
|
|
544
|
+
* @since 2.0.0
|
|
552
545
|
*/
|
|
553
546
|
export const succeedSome = internal.succeedSome;
|
|
554
547
|
/**
|
|
@@ -565,9 +558,9 @@ export const succeedSome = internal.succeedSome;
|
|
|
565
558
|
* - **Handling Circular Dependencies**: Useful in managing circular dependencies, such as recursive functions that need to avoid eager evaluation to prevent stack overflow.
|
|
566
559
|
* - **Unifying Return Types**: Can help TypeScript unify return types in situations where multiple branches of logic return different effects, simplifying type inference.
|
|
567
560
|
*
|
|
568
|
-
*
|
|
561
|
+
* **Example** (Lazy Evaluation with Side Effects)
|
|
562
|
+
*
|
|
569
563
|
* ```ts
|
|
570
|
-
* // Title: Lazy Evaluation with Side Effects
|
|
571
564
|
* import { Effect } from "effect"
|
|
572
565
|
*
|
|
573
566
|
* let i = 0
|
|
@@ -583,8 +576,9 @@ export const succeedSome = internal.succeedSome;
|
|
|
583
576
|
* console.log(Effect.runSync(good)) // Output: 2
|
|
584
577
|
* ```
|
|
585
578
|
*
|
|
586
|
-
*
|
|
587
|
-
*
|
|
579
|
+
* **Example** (Recursive Fibonacci)
|
|
580
|
+
*
|
|
581
|
+
* ```ts
|
|
588
582
|
* import { Effect } from "effect"
|
|
589
583
|
*
|
|
590
584
|
* const blowsUp = (n: number): Effect.Effect<number> =>
|
|
@@ -606,9 +600,11 @@ export const succeedSome = internal.succeedSome;
|
|
|
606
600
|
*
|
|
607
601
|
* console.log(Effect.runSync(allGood(32)))
|
|
608
602
|
* // Output: 3524578
|
|
603
|
+
* ```
|
|
604
|
+
*
|
|
605
|
+
* **Example** (Using Effect.suspend to Help TypeScript Infer Types)
|
|
609
606
|
*
|
|
610
|
-
*
|
|
611
|
-
* // Title: Using Effect.suspend to Help TypeScript Infer Types
|
|
607
|
+
* ```ts
|
|
612
608
|
* import { Effect } from "effect"
|
|
613
609
|
*
|
|
614
610
|
* // Without suspend, TypeScript may struggle with type inference.
|
|
@@ -629,9 +625,10 @@ export const succeedSome = internal.succeedSome;
|
|
|
629
625
|
* ? Effect.fail(new Error("Cannot divide by zero"))
|
|
630
626
|
* : Effect.succeed(a / b)
|
|
631
627
|
* )
|
|
628
|
+
* ```
|
|
632
629
|
*
|
|
633
|
-
* @since 2.0.0
|
|
634
630
|
* @category Creating Effects
|
|
631
|
+
* @since 2.0.0
|
|
635
632
|
*/
|
|
636
633
|
export const suspend = internal.suspend;
|
|
637
634
|
/**
|
|
@@ -653,9 +650,9 @@ export const suspend = internal.suspend;
|
|
|
653
650
|
*
|
|
654
651
|
* @see {@link try_ | try} for a version that can handle failures.
|
|
655
652
|
*
|
|
656
|
-
*
|
|
653
|
+
* **Example** (Logging a Message)
|
|
654
|
+
*
|
|
657
655
|
* ```ts
|
|
658
|
-
* // Title: Logging a Message
|
|
659
656
|
* import { Effect } from "effect"
|
|
660
657
|
*
|
|
661
658
|
* const log = (message: string) =>
|
|
@@ -668,54 +665,47 @@ export const suspend = internal.suspend;
|
|
|
668
665
|
* const program = log("Hello, World!")
|
|
669
666
|
* ```
|
|
670
667
|
*
|
|
671
|
-
* @since 2.0.0
|
|
672
668
|
* @category Creating Effects
|
|
669
|
+
* @since 2.0.0
|
|
673
670
|
*/
|
|
674
671
|
export const sync = internal.sync;
|
|
675
672
|
const void_ = internal.void;
|
|
676
673
|
export {
|
|
677
674
|
/**
|
|
678
|
-
* @since 2.0.0
|
|
679
675
|
* @category Creating Effects
|
|
676
|
+
* @since 2.0.0
|
|
680
677
|
*/
|
|
681
678
|
void_ as void };
|
|
682
679
|
const undefined_ = internal.undefined;
|
|
683
680
|
export {
|
|
684
681
|
/**
|
|
685
|
-
* @since 4.0.0
|
|
686
682
|
* @category Creating Effects
|
|
683
|
+
* @since 4.0.0
|
|
687
684
|
*/
|
|
688
685
|
undefined_ as undefined };
|
|
689
686
|
/**
|
|
690
|
-
* Creates an `Effect` from a callback-based asynchronous
|
|
687
|
+
* Creates an `Effect` from a callback-based asynchronous API.
|
|
691
688
|
*
|
|
692
689
|
* **Details**
|
|
693
690
|
*
|
|
694
|
-
* The `resume`
|
|
695
|
-
*
|
|
696
|
-
*
|
|
697
|
-
*
|
|
698
|
-
* need to handle resource cleanup if the operation is interrupted.
|
|
699
|
-
* - Can receive an `AbortSignal` to handle interruption if needed.
|
|
700
|
-
*
|
|
701
|
-
* The `FiberId` of the fiber that may complete the async callback may also be
|
|
702
|
-
* specified using the `blockingOn` argument. This is called the "blocking
|
|
703
|
-
* fiber" because it suspends the fiber executing the `async` effect (i.e.
|
|
704
|
-
* semantically blocks the fiber from making progress). Specifying this fiber id
|
|
705
|
-
* in cases where it is known will improve diagnostics, but not affect the
|
|
706
|
-
* behavior of the returned effect.
|
|
691
|
+
* The registration function receives a `resume` callback and, when requested,
|
|
692
|
+
* an `AbortSignal`. Call `resume` at most once with the effect that should
|
|
693
|
+
* complete the fiber; later calls are ignored. Return an optional cleanup
|
|
694
|
+
* effect from the registration function to run if the fiber is interrupted.
|
|
707
695
|
*
|
|
708
696
|
* **When to Use**
|
|
709
697
|
*
|
|
710
|
-
* Use `Effect.callback` when
|
|
711
|
-
*
|
|
712
|
-
*
|
|
698
|
+
* Use `Effect.callback` when integrating APIs that complete through callbacks
|
|
699
|
+
* instead of returning a `Promise`.
|
|
700
|
+
*
|
|
701
|
+
* **Previously Known As**
|
|
713
702
|
*
|
|
714
703
|
* This API replaces the following from Effect 3.x:
|
|
715
704
|
*
|
|
716
705
|
* - `Effect.async`
|
|
717
706
|
*
|
|
718
|
-
*
|
|
707
|
+
* **Example** (Usage)
|
|
708
|
+
*
|
|
719
709
|
* ```ts
|
|
720
710
|
* import { Effect } from "effect"
|
|
721
711
|
*
|
|
@@ -731,15 +721,16 @@ undefined_ as undefined };
|
|
|
731
721
|
* const program = delay(1000)
|
|
732
722
|
* ```
|
|
733
723
|
*
|
|
734
|
-
* @since 2.0.0
|
|
735
724
|
* @category Creating Effects
|
|
725
|
+
* @since 2.0.0
|
|
736
726
|
*/
|
|
737
727
|
export const callback = internal.callback;
|
|
738
728
|
/**
|
|
739
729
|
* Returns an effect that will never produce anything. The moral equivalent of
|
|
740
730
|
* `while(true) {}`, only without the wasted CPU cycles.
|
|
741
731
|
*
|
|
742
|
-
*
|
|
732
|
+
* **Example** (Usage)
|
|
733
|
+
*
|
|
743
734
|
* ```ts
|
|
744
735
|
* import { Effect } from "effect"
|
|
745
736
|
*
|
|
@@ -753,15 +744,16 @@ export const callback = internal.callback;
|
|
|
753
744
|
* const timedProgram = Effect.timeout(program, "1 second")
|
|
754
745
|
* ```
|
|
755
746
|
*
|
|
756
|
-
* @since 2.0.0
|
|
757
747
|
* @category Creating Effects
|
|
748
|
+
* @since 2.0.0
|
|
758
749
|
*/
|
|
759
750
|
export const never = internal.never;
|
|
760
751
|
/**
|
|
761
752
|
* An `Effect` containing an empty record `{}`, used as the starting point for
|
|
762
753
|
* do notation chains.
|
|
763
754
|
*
|
|
764
|
-
*
|
|
755
|
+
* **Example** (Usage)
|
|
756
|
+
*
|
|
765
757
|
* ```ts
|
|
766
758
|
* import { Effect } from "effect"
|
|
767
759
|
* import { pipe } from "effect/Function"
|
|
@@ -774,16 +766,16 @@ export const never = internal.never;
|
|
|
774
766
|
* )
|
|
775
767
|
* ```
|
|
776
768
|
*
|
|
777
|
-
* @since 4.0.0
|
|
778
769
|
* @category Do notation
|
|
770
|
+
* @since 4.0.0
|
|
779
771
|
*/
|
|
780
772
|
export const Do = internal.Do;
|
|
781
773
|
/**
|
|
782
774
|
* Gives a name to the success value of an `Effect`, creating a single-key
|
|
783
775
|
* record used in do notation pipelines.
|
|
784
776
|
*
|
|
785
|
-
* @since 4.0.0
|
|
786
777
|
* @category Do notation
|
|
778
|
+
* @since 4.0.0
|
|
787
779
|
*/
|
|
788
780
|
export const bindTo = internal.bindTo;
|
|
789
781
|
const let_ = internal.let;
|
|
@@ -791,15 +783,15 @@ export {
|
|
|
791
783
|
/**
|
|
792
784
|
* Adds a computed plain value to the do notation record.
|
|
793
785
|
*
|
|
794
|
-
* @since 4.0.0
|
|
795
786
|
* @category Do notation
|
|
787
|
+
* @since 4.0.0
|
|
796
788
|
*/
|
|
797
789
|
let_ as let };
|
|
798
790
|
/**
|
|
799
791
|
* Adds an `Effect` value to the do notation record under a given name.
|
|
800
792
|
*
|
|
801
|
-
* @since 4.0.0
|
|
802
793
|
* @category Do notation
|
|
794
|
+
* @since 4.0.0
|
|
803
795
|
*/
|
|
804
796
|
export const bind = internal.bind;
|
|
805
797
|
/**
|
|
@@ -817,7 +809,8 @@ export const bind = internal.bind;
|
|
|
817
809
|
* explicit control over the execution of effects. You can `yield*` values from
|
|
818
810
|
* effects and return the final result at the end.
|
|
819
811
|
*
|
|
820
|
-
*
|
|
812
|
+
* **Example** (Usage)
|
|
813
|
+
*
|
|
821
814
|
* ```ts
|
|
822
815
|
* import { Data, Effect } from "effect"
|
|
823
816
|
*
|
|
@@ -849,8 +842,8 @@ export const bind = internal.bind;
|
|
|
849
842
|
* })
|
|
850
843
|
* ```
|
|
851
844
|
*
|
|
852
|
-
* @since 2.0.0
|
|
853
845
|
* @category Creating Effects
|
|
846
|
+
* @since 2.0.0
|
|
854
847
|
*/
|
|
855
848
|
export const gen = internal.gen;
|
|
856
849
|
/**
|
|
@@ -864,9 +857,9 @@ export const gen = internal.gen;
|
|
|
864
857
|
*
|
|
865
858
|
* @see {@link succeed} to create an effect that represents a successful value.
|
|
866
859
|
*
|
|
867
|
-
*
|
|
860
|
+
* **Example** (Creating a Failed Effect)
|
|
861
|
+
*
|
|
868
862
|
* ```ts
|
|
869
|
-
* // Title: Creating a Failed Effect
|
|
870
863
|
* import { Data, Effect } from "effect"
|
|
871
864
|
*
|
|
872
865
|
* class OperationFailedError extends Data.TaggedError("OperationFailedError")<{}> {}
|
|
@@ -878,8 +871,8 @@ export const gen = internal.gen;
|
|
|
878
871
|
* )
|
|
879
872
|
* ```
|
|
880
873
|
*
|
|
881
|
-
* @since 2.0.0
|
|
882
874
|
* @category Creating Effects
|
|
875
|
+
* @since 2.0.0
|
|
883
876
|
*/
|
|
884
877
|
export const fail = internal.fail;
|
|
885
878
|
/**
|
|
@@ -888,7 +881,8 @@ export const fail = internal.fail;
|
|
|
888
881
|
* This function is useful when you need to create an error effect but want to
|
|
889
882
|
* defer the computation of the error value until the effect is actually run.
|
|
890
883
|
*
|
|
891
|
-
*
|
|
884
|
+
* **Example** (Usage)
|
|
885
|
+
*
|
|
892
886
|
* ```ts
|
|
893
887
|
* import { Data, Effect } from "effect"
|
|
894
888
|
*
|
|
@@ -900,8 +894,8 @@ export const fail = internal.fail;
|
|
|
900
894
|
* // Output: { _id: 'Exit', _tag: 'Failure', cause: ... }
|
|
901
895
|
* ```
|
|
902
896
|
*
|
|
903
|
-
* @since 2.0.0
|
|
904
897
|
* @category Creating Effects
|
|
898
|
+
* @since 2.0.0
|
|
905
899
|
*/
|
|
906
900
|
export const failSync = internal.failSync;
|
|
907
901
|
/**
|
|
@@ -910,7 +904,8 @@ export const failSync = internal.failSync;
|
|
|
910
904
|
* This function allows you to create effects that fail with complex error
|
|
911
905
|
* structures, including multiple errors, defects, interruptions, and more.
|
|
912
906
|
*
|
|
913
|
-
*
|
|
907
|
+
* **Example** (Usage)
|
|
908
|
+
*
|
|
914
909
|
* ```ts
|
|
915
910
|
* import { Cause, Effect } from "effect"
|
|
916
911
|
*
|
|
@@ -922,8 +917,8 @@ export const failSync = internal.failSync;
|
|
|
922
917
|
* // Output: { _id: 'Exit', _tag: 'Failure', cause: ... }
|
|
923
918
|
* ```
|
|
924
919
|
*
|
|
925
|
-
* @since 2.0.0
|
|
926
920
|
* @category Creating Effects
|
|
921
|
+
* @since 2.0.0
|
|
927
922
|
*/
|
|
928
923
|
export const failCause = internal.failCause;
|
|
929
924
|
/**
|
|
@@ -932,7 +927,8 @@ export const failCause = internal.failCause;
|
|
|
932
927
|
* This function is useful when you need to create a failure effect with a
|
|
933
928
|
* complex cause but want to defer the computation until the effect is run.
|
|
934
929
|
*
|
|
935
|
-
*
|
|
930
|
+
* **Example** (Usage)
|
|
931
|
+
*
|
|
936
932
|
* ```ts
|
|
937
933
|
* import { Cause, Effect } from "effect"
|
|
938
934
|
*
|
|
@@ -944,8 +940,8 @@ export const failCause = internal.failCause;
|
|
|
944
940
|
* // Output: { _id: 'Exit', _tag: 'Failure', cause: ... }
|
|
945
941
|
* ```
|
|
946
942
|
*
|
|
947
|
-
* @since 2.0.0
|
|
948
943
|
* @category Creating Effects
|
|
944
|
+
* @since 2.0.0
|
|
949
945
|
*/
|
|
950
946
|
export const failCauseSync = internal.failCauseSync;
|
|
951
947
|
/**
|
|
@@ -968,9 +964,9 @@ export const failCauseSync = internal.failCauseSync;
|
|
|
968
964
|
* @see {@link dieSync} for a variant that throws a specified error, evaluated lazily.
|
|
969
965
|
* @see {@link dieMessage} for a variant that throws a `RuntimeException` with a message.
|
|
970
966
|
*
|
|
971
|
-
*
|
|
967
|
+
* **Example** (Terminating on Division by Zero with a Specified Error)
|
|
968
|
+
*
|
|
972
969
|
* ```ts
|
|
973
|
-
* // Title: Terminating on Division by Zero with a Specified Error
|
|
974
970
|
* import { Effect } from "effect"
|
|
975
971
|
*
|
|
976
972
|
* const divide = (a: number, b: number) =>
|
|
@@ -988,8 +984,8 @@ export const failCauseSync = internal.failCauseSync;
|
|
|
988
984
|
* // ...stack trace...
|
|
989
985
|
* ```
|
|
990
986
|
*
|
|
991
|
-
* @since 2.0.0
|
|
992
987
|
* @category Creating Effects
|
|
988
|
+
* @since 2.0.0
|
|
993
989
|
*/
|
|
994
990
|
export const die = internal.die;
|
|
995
991
|
const try_ = internal.try;
|
|
@@ -1017,7 +1013,8 @@ export {
|
|
|
1017
1013
|
* @see {@link sync} if the effectful computation is synchronous and does not
|
|
1018
1014
|
* throw errors.
|
|
1019
1015
|
*
|
|
1020
|
-
*
|
|
1016
|
+
* **Example** (Basic Usage with Default Error Handling)
|
|
1017
|
+
*
|
|
1021
1018
|
* ```ts
|
|
1022
1019
|
* import { Effect } from "effect"
|
|
1023
1020
|
*
|
|
@@ -1036,7 +1033,8 @@ export {
|
|
|
1036
1033
|
* // Output: Exit.failure with Error
|
|
1037
1034
|
* ```
|
|
1038
1035
|
*
|
|
1039
|
-
*
|
|
1036
|
+
* **Example** (Custom Error Handling)
|
|
1037
|
+
*
|
|
1040
1038
|
* ```ts
|
|
1041
1039
|
* import { Data, Effect } from "effect"
|
|
1042
1040
|
*
|
|
@@ -1052,14 +1050,15 @@ export {
|
|
|
1052
1050
|
* // Output: Exit.failure with custom Error message
|
|
1053
1051
|
* ```
|
|
1054
1052
|
*
|
|
1055
|
-
* @since 2.0.0
|
|
1056
1053
|
* @category Creating Effects
|
|
1054
|
+
* @since 2.0.0
|
|
1057
1055
|
*/
|
|
1058
1056
|
try_ as try };
|
|
1059
1057
|
/**
|
|
1060
1058
|
* Yields control back to the Effect runtime, allowing other fibers to execute.
|
|
1061
1059
|
*
|
|
1062
|
-
*
|
|
1060
|
+
* **Example** (Usage)
|
|
1061
|
+
*
|
|
1063
1062
|
* ```ts
|
|
1064
1063
|
* import { Effect } from "effect"
|
|
1065
1064
|
*
|
|
@@ -1072,14 +1071,15 @@ try_ as try };
|
|
|
1072
1071
|
* Effect.runPromise(program)
|
|
1073
1072
|
* ```
|
|
1074
1073
|
*
|
|
1075
|
-
* @since 2.0.0
|
|
1076
1074
|
* @category Creating Effects
|
|
1075
|
+
* @since 2.0.0
|
|
1077
1076
|
*/
|
|
1078
1077
|
export const yieldNow = internal.yieldNow;
|
|
1079
1078
|
/**
|
|
1080
1079
|
* Yields control back to the Effect runtime with a specified priority, allowing other fibers to execute.
|
|
1081
1080
|
*
|
|
1082
|
-
*
|
|
1081
|
+
* **Example** (Usage)
|
|
1082
|
+
*
|
|
1083
1083
|
* ```ts
|
|
1084
1084
|
* import { Effect } from "effect"
|
|
1085
1085
|
*
|
|
@@ -1092,14 +1092,15 @@ export const yieldNow = internal.yieldNow;
|
|
|
1092
1092
|
* Effect.runPromise(program)
|
|
1093
1093
|
* ```
|
|
1094
1094
|
*
|
|
1095
|
-
* @since 2.0.0
|
|
1096
1095
|
* @category Creating Effects
|
|
1096
|
+
* @since 2.0.0
|
|
1097
1097
|
*/
|
|
1098
1098
|
export const yieldNowWith = internal.yieldNowWith;
|
|
1099
1099
|
/**
|
|
1100
1100
|
* Provides access to the current fiber within an effect computation.
|
|
1101
1101
|
*
|
|
1102
|
-
*
|
|
1102
|
+
* **Example** (Usage)
|
|
1103
|
+
*
|
|
1103
1104
|
* ```ts
|
|
1104
1105
|
* import { Effect } from "effect"
|
|
1105
1106
|
*
|
|
@@ -1111,8 +1112,8 @@ export const yieldNowWith = internal.yieldNowWith;
|
|
|
1111
1112
|
* // Output: Fiber ID: 1
|
|
1112
1113
|
* ```
|
|
1113
1114
|
*
|
|
1114
|
-
* @since 2.0.0
|
|
1115
1115
|
* @category Creating Effects
|
|
1116
|
+
* @since 2.0.0
|
|
1116
1117
|
*/
|
|
1117
1118
|
export const withFiber = core.withFiber;
|
|
1118
1119
|
// -----------------------------------------------------------------------------
|
|
@@ -1121,7 +1122,8 @@ export const withFiber = core.withFiber;
|
|
|
1121
1122
|
/**
|
|
1122
1123
|
* Converts a `Result` to an `Effect`.
|
|
1123
1124
|
*
|
|
1124
|
-
*
|
|
1125
|
+
* **Example** (Usage)
|
|
1126
|
+
*
|
|
1125
1127
|
* ```ts
|
|
1126
1128
|
* import { Effect, Result } from "effect"
|
|
1127
1129
|
*
|
|
@@ -1136,14 +1138,18 @@ export const withFiber = core.withFiber;
|
|
|
1136
1138
|
* // { _id: 'Exit', _tag: 'Failure', cause: { _id: 'Cause', _tag: 'Fail', failure: 'Something went wrong' } }
|
|
1137
1139
|
* ```
|
|
1138
1140
|
*
|
|
1139
|
-
* @since 4.0.0
|
|
1140
1141
|
* @category Conversions
|
|
1142
|
+
* @since 4.0.0
|
|
1141
1143
|
*/
|
|
1142
1144
|
export const fromResult = internal.fromResult;
|
|
1143
1145
|
/**
|
|
1144
|
-
* Converts an `Option`
|
|
1146
|
+
* Converts an `Option` into an `Effect`.
|
|
1147
|
+
*
|
|
1148
|
+
* `Option.some` becomes a successful effect with the contained value, while
|
|
1149
|
+
* `Option.none` becomes a failed effect with `NoSuchElementError`.
|
|
1150
|
+
*
|
|
1151
|
+
* **Example** (Usage)
|
|
1145
1152
|
*
|
|
1146
|
-
* @example
|
|
1147
1153
|
* ```ts
|
|
1148
1154
|
* import { Effect, Option } from "effect"
|
|
1149
1155
|
*
|
|
@@ -1158,15 +1164,16 @@ export const fromResult = internal.fromResult;
|
|
|
1158
1164
|
* // { _id: 'Exit', _tag: 'Failure', cause: { _id: 'Cause', _tag: 'Fail', failure: { _id: 'NoSuchElementError' } } }
|
|
1159
1165
|
* ```
|
|
1160
1166
|
*
|
|
1161
|
-
* @since 4.0.0
|
|
1162
1167
|
* @category Conversions
|
|
1168
|
+
* @since 4.0.0
|
|
1163
1169
|
*/
|
|
1164
1170
|
export const fromOption = internal.fromOption;
|
|
1165
1171
|
/**
|
|
1166
1172
|
* Converts a nullable value to an `Effect`, failing with a `NoSuchElementError`
|
|
1167
1173
|
* when the value is `null` or `undefined`.
|
|
1168
1174
|
*
|
|
1169
|
-
*
|
|
1175
|
+
* **Example** (Usage)
|
|
1176
|
+
*
|
|
1170
1177
|
* ```ts
|
|
1171
1178
|
* import { Console, Effect } from "effect"
|
|
1172
1179
|
*
|
|
@@ -1183,8 +1190,8 @@ export const fromOption = internal.fromOption;
|
|
|
1183
1190
|
* // Output: hello
|
|
1184
1191
|
* ```
|
|
1185
1192
|
*
|
|
1186
|
-
* @since 4.0.0
|
|
1187
1193
|
* @category Conversions
|
|
1194
|
+
* @since 4.0.0
|
|
1188
1195
|
*/
|
|
1189
1196
|
export const fromNullishOr = internal.fromNullishOr;
|
|
1190
1197
|
// -----------------------------------------------------------------------------
|
|
@@ -1220,7 +1227,8 @@ export const fromNullishOr = internal.fromNullishOr;
|
|
|
1220
1227
|
* step produces a new `Effect` while flattening any nested effects that may
|
|
1221
1228
|
* occur.
|
|
1222
1229
|
*
|
|
1223
|
-
*
|
|
1230
|
+
* **Example** (Usage)
|
|
1231
|
+
*
|
|
1224
1232
|
* ```ts
|
|
1225
1233
|
* import { Data, Effect, pipe } from "effect"
|
|
1226
1234
|
*
|
|
@@ -1250,14 +1258,15 @@ export const fromNullishOr = internal.fromNullishOr;
|
|
|
1250
1258
|
*
|
|
1251
1259
|
* @see {@link tap} for a version that ignores the result of the effect.
|
|
1252
1260
|
*
|
|
1253
|
-
* @since 2.0.0
|
|
1254
1261
|
* @category Sequencing
|
|
1262
|
+
* @since 2.0.0
|
|
1255
1263
|
*/
|
|
1256
1264
|
export const flatMap = internal.flatMap;
|
|
1257
1265
|
/**
|
|
1258
1266
|
* Flattens an `Effect` that produces another `Effect` into a single effect.
|
|
1259
1267
|
*
|
|
1260
|
-
*
|
|
1268
|
+
* **Example** (Usage)
|
|
1269
|
+
*
|
|
1261
1270
|
* ```ts
|
|
1262
1271
|
* import { Console, Effect } from "effect"
|
|
1263
1272
|
*
|
|
@@ -1270,13 +1279,13 @@ export const flatMap = internal.flatMap;
|
|
|
1270
1279
|
* })
|
|
1271
1280
|
* ```
|
|
1272
1281
|
*
|
|
1273
|
-
* @since 2.0.0
|
|
1274
1282
|
* @category Sequencing
|
|
1283
|
+
* @since 2.0.0
|
|
1275
1284
|
*/
|
|
1276
1285
|
export const flatten = internal.flatten;
|
|
1277
1286
|
/**
|
|
1278
|
-
*
|
|
1279
|
-
*
|
|
1287
|
+
* Runs this effect and then runs another effect, optionally using the first
|
|
1288
|
+
* effect's success value to choose the next effect.
|
|
1280
1289
|
*
|
|
1281
1290
|
* **Syntax**
|
|
1282
1291
|
*
|
|
@@ -1290,23 +1299,18 @@ export const flatten = internal.flatten;
|
|
|
1290
1299
|
*
|
|
1291
1300
|
* **When to Use**
|
|
1292
1301
|
*
|
|
1293
|
-
* Use `andThen` when
|
|
1294
|
-
*
|
|
1295
|
-
* combining effects or handling computations that must happen in order.
|
|
1302
|
+
* Use `andThen` when one effect must run after another and the second effect
|
|
1303
|
+
* may depend on the first effect's success value.
|
|
1296
1304
|
*
|
|
1297
1305
|
* **Details**
|
|
1298
1306
|
*
|
|
1299
|
-
*
|
|
1307
|
+
* When the second argument is an `Effect`, the first success value is discarded
|
|
1308
|
+
* and the returned effect produces the second effect's value. When the second
|
|
1309
|
+
* argument is a function, it receives the first success value and must return
|
|
1310
|
+
* the next `Effect`.
|
|
1300
1311
|
*
|
|
1301
|
-
*
|
|
1302
|
-
*
|
|
1303
|
-
* - A `Promise`
|
|
1304
|
-
* - A function returning a `Promise`
|
|
1305
|
-
* - An `Effect`
|
|
1306
|
-
* - A function returning an `Effect` (similar to {@link flatMap})
|
|
1307
|
-
*
|
|
1308
|
-
* **Note:** `andThen` works well with both `Option` and `Result` types,
|
|
1309
|
-
* treating them as effects.
|
|
1312
|
+
* Failures or requirements from either effect are preserved in the returned
|
|
1313
|
+
* effect.
|
|
1310
1314
|
*
|
|
1311
1315
|
* **Previously Known As**
|
|
1312
1316
|
*
|
|
@@ -1314,7 +1318,8 @@ export const flatten = internal.flatten;
|
|
|
1314
1318
|
*
|
|
1315
1319
|
* - `Effect.zipRight`
|
|
1316
1320
|
*
|
|
1317
|
-
*
|
|
1321
|
+
* **Example** (Applying a Discount Based on Fetched Amount)
|
|
1322
|
+
*
|
|
1318
1323
|
* ```ts
|
|
1319
1324
|
* import { Data, Effect, pipe } from "effect"
|
|
1320
1325
|
*
|
|
@@ -1353,8 +1358,8 @@ export const flatten = internal.flatten;
|
|
|
1353
1358
|
* // Output: 190
|
|
1354
1359
|
* ```
|
|
1355
1360
|
*
|
|
1356
|
-
* @since 2.0.0
|
|
1357
1361
|
* @category Sequencing
|
|
1362
|
+
* @since 2.0.0
|
|
1358
1363
|
*/
|
|
1359
1364
|
export const andThen = internal.andThen;
|
|
1360
1365
|
/**
|
|
@@ -1380,9 +1385,9 @@ export const andThen = internal.andThen;
|
|
|
1380
1385
|
*
|
|
1381
1386
|
* - `Effect.zipLeft`
|
|
1382
1387
|
*
|
|
1383
|
-
*
|
|
1388
|
+
* **Example** (Logging a step in a pipeline)
|
|
1389
|
+
*
|
|
1384
1390
|
* ```ts
|
|
1385
|
-
* // Title: Logging a step in a pipeline
|
|
1386
1391
|
* import { Data, Effect, pipe } from "effect"
|
|
1387
1392
|
* import { Console } from "effect"
|
|
1388
1393
|
*
|
|
@@ -1414,8 +1419,8 @@ export const andThen = internal.andThen;
|
|
|
1414
1419
|
* // 95
|
|
1415
1420
|
* ```
|
|
1416
1421
|
*
|
|
1417
|
-
* @since 2.0.0
|
|
1418
1422
|
* @category Sequencing
|
|
1423
|
+
* @since 2.0.0
|
|
1419
1424
|
*/
|
|
1420
1425
|
export const tap = internal.tap;
|
|
1421
1426
|
/**
|
|
@@ -1447,7 +1452,8 @@ export const tap = internal.tap;
|
|
|
1447
1452
|
*
|
|
1448
1453
|
* - `Effect.either`
|
|
1449
1454
|
*
|
|
1450
|
-
*
|
|
1455
|
+
* **Example** (Usage)
|
|
1456
|
+
*
|
|
1451
1457
|
* ```ts
|
|
1452
1458
|
* import { Effect } from "effect"
|
|
1453
1459
|
*
|
|
@@ -1467,8 +1473,8 @@ export const tap = internal.tap;
|
|
|
1467
1473
|
* @see {@link option} for a version that uses `Option` instead.
|
|
1468
1474
|
* @see {@link exit} for a version that encapsulates both recoverable errors and defects in an `Exit`.
|
|
1469
1475
|
*
|
|
1470
|
-
* @since 4.0.0
|
|
1471
1476
|
* @category Outcome Encapsulation
|
|
1477
|
+
* @since 4.0.0
|
|
1472
1478
|
*/
|
|
1473
1479
|
export const result = internal.result;
|
|
1474
1480
|
/**
|
|
@@ -1479,7 +1485,8 @@ export const result = internal.result;
|
|
|
1479
1485
|
* Success values become `Option.some`, recoverable failures become
|
|
1480
1486
|
* `Option.none`, and defects still fail the effect.
|
|
1481
1487
|
*
|
|
1482
|
-
*
|
|
1488
|
+
* **Example** (Usage)
|
|
1489
|
+
*
|
|
1483
1490
|
* ```ts
|
|
1484
1491
|
* import { Console, Effect, Option } from "effect"
|
|
1485
1492
|
*
|
|
@@ -1499,8 +1506,8 @@ export const result = internal.result;
|
|
|
1499
1506
|
* @see {@link result} for a version that uses `Result` instead.
|
|
1500
1507
|
* @see {@link exit} for a version that encapsulates both recoverable errors and defects in an `Exit`.
|
|
1501
1508
|
*
|
|
1502
|
-
* @since 2.0.0
|
|
1503
1509
|
* @category Output Encapsulation
|
|
1510
|
+
* @since 2.0.0
|
|
1504
1511
|
*/
|
|
1505
1512
|
export const option = internal.option;
|
|
1506
1513
|
/**
|
|
@@ -1516,7 +1523,8 @@ export const option = internal.option;
|
|
|
1516
1523
|
* the `Exit.Failure` type. The error type is set to `never`, indicating that
|
|
1517
1524
|
* the effect is structured to never fail directly.
|
|
1518
1525
|
*
|
|
1519
|
-
*
|
|
1526
|
+
* **Example** (Usage)
|
|
1527
|
+
*
|
|
1520
1528
|
* ```ts
|
|
1521
1529
|
* import { Effect } from "effect"
|
|
1522
1530
|
*
|
|
@@ -1536,8 +1544,8 @@ export const option = internal.option;
|
|
|
1536
1544
|
* @see {@link option} for a version that uses `Option` instead.
|
|
1537
1545
|
* @see {@link result} for a version that uses `Result` instead.
|
|
1538
1546
|
*
|
|
1539
|
-
* @since 2.0.0
|
|
1540
1547
|
* @category Outcome Encapsulation
|
|
1548
|
+
* @since 2.0.0
|
|
1541
1549
|
*/
|
|
1542
1550
|
export const exit = internal.exit;
|
|
1543
1551
|
/**
|
|
@@ -1562,7 +1570,8 @@ export const exit = internal.exit;
|
|
|
1562
1570
|
* effect is not modified. Instead, a new effect is returned with the updated
|
|
1563
1571
|
* value.
|
|
1564
1572
|
*
|
|
1565
|
-
*
|
|
1573
|
+
* **Example** (Adding a Service Charge)
|
|
1574
|
+
*
|
|
1566
1575
|
* ```ts
|
|
1567
1576
|
* import { Effect, pipe } from "effect"
|
|
1568
1577
|
*
|
|
@@ -1583,8 +1592,8 @@ export const exit = internal.exit;
|
|
|
1583
1592
|
* @see {@link mapBoth} for a version that operates on both channels.
|
|
1584
1593
|
* @see {@link flatMap} or {@link andThen} for a version that can return a new effect.
|
|
1585
1594
|
*
|
|
1586
|
-
* @since 2.0.0
|
|
1587
1595
|
* @category Mapping
|
|
1596
|
+
* @since 2.0.0
|
|
1588
1597
|
*/
|
|
1589
1598
|
export const map = internal.map;
|
|
1590
1599
|
/**
|
|
@@ -1593,9 +1602,9 @@ export const map = internal.map;
|
|
|
1593
1602
|
* `as` allows you to ignore the original value inside an effect and
|
|
1594
1603
|
* replace it with a new constant value.
|
|
1595
1604
|
*
|
|
1596
|
-
*
|
|
1605
|
+
* **Example** (Replacing a Value)
|
|
1606
|
+
*
|
|
1597
1607
|
* ```ts
|
|
1598
|
-
* // Title: Replacing a Value
|
|
1599
1608
|
* import { Effect, pipe } from "effect"
|
|
1600
1609
|
*
|
|
1601
1610
|
* // Replaces the value 5 with the constant "new value"
|
|
@@ -1605,8 +1614,8 @@ export const map = internal.map;
|
|
|
1605
1614
|
* // Output: "new value"
|
|
1606
1615
|
* ```
|
|
1607
1616
|
*
|
|
1608
|
-
* @since 2.0.0
|
|
1609
1617
|
* @category Mapping
|
|
1618
|
+
* @since 2.0.0
|
|
1610
1619
|
*/
|
|
1611
1620
|
export const as = internal.as;
|
|
1612
1621
|
/**
|
|
@@ -1614,7 +1623,8 @@ export const as = internal.as;
|
|
|
1614
1623
|
* in an `Option` value. If the original `Effect` value fails, the returned
|
|
1615
1624
|
* `Effect` value will also fail.
|
|
1616
1625
|
*
|
|
1617
|
-
*
|
|
1626
|
+
* **Example** (Usage)
|
|
1627
|
+
*
|
|
1618
1628
|
* ```ts
|
|
1619
1629
|
* import { Effect } from "effect"
|
|
1620
1630
|
*
|
|
@@ -1634,7 +1644,8 @@ export const asSome = internal.asSome;
|
|
|
1634
1644
|
* succeed. If the original `Effect` value fails, the returned `Effect` value
|
|
1635
1645
|
* will fail with the same error.
|
|
1636
1646
|
*
|
|
1637
|
-
*
|
|
1647
|
+
* **Example** (Usage)
|
|
1648
|
+
*
|
|
1638
1649
|
* ```ts
|
|
1639
1650
|
* import { Effect } from "effect"
|
|
1640
1651
|
*
|
|
@@ -1644,8 +1655,8 @@ export const asSome = internal.asSome;
|
|
|
1644
1655
|
* // undefined (void)
|
|
1645
1656
|
* ```
|
|
1646
1657
|
*
|
|
1647
|
-
* @since 2.0.0
|
|
1648
1658
|
* @category Mapping
|
|
1659
|
+
* @since 2.0.0
|
|
1649
1660
|
*/
|
|
1650
1661
|
export const asVoid = internal.asVoid;
|
|
1651
1662
|
/**
|
|
@@ -1657,7 +1668,8 @@ export const asVoid = internal.asVoid;
|
|
|
1657
1668
|
* be helpful in scenarios where you want to handle a success as a failure or
|
|
1658
1669
|
* treat an error as a valid result.
|
|
1659
1670
|
*
|
|
1660
|
-
*
|
|
1671
|
+
* **Example** (Usage)
|
|
1672
|
+
*
|
|
1661
1673
|
* ```ts
|
|
1662
1674
|
* import { Effect } from "effect"
|
|
1663
1675
|
*
|
|
@@ -1670,8 +1682,8 @@ export const asVoid = internal.asVoid;
|
|
|
1670
1682
|
* const flipped = Effect.flip(program)
|
|
1671
1683
|
* ```
|
|
1672
1684
|
*
|
|
1673
|
-
* @since 2.0.0
|
|
1674
1685
|
* @category Mapping
|
|
1686
|
+
* @since 2.0.0
|
|
1675
1687
|
*/
|
|
1676
1688
|
export const flip = internal.flip;
|
|
1677
1689
|
// -----------------------------------------------------------------------------
|
|
@@ -1691,9 +1703,9 @@ export const flip = internal.flip;
|
|
|
1691
1703
|
* @see {@link zipWith} for a version that combines the results with a custom function.
|
|
1692
1704
|
* @see {@link validate} for a version that accumulates errors.
|
|
1693
1705
|
*
|
|
1694
|
-
*
|
|
1706
|
+
* **Example** (Combining Two Effects Sequentially)
|
|
1707
|
+
*
|
|
1695
1708
|
* ```ts
|
|
1696
|
-
* // Title: Combining Two Effects Sequentially
|
|
1697
1709
|
* import { Effect } from "effect"
|
|
1698
1710
|
*
|
|
1699
1711
|
* const task1 = Effect.succeed(1).pipe(
|
|
@@ -1718,8 +1730,9 @@ export const flip = internal.flip;
|
|
|
1718
1730
|
* // [ 1, 'hello' ]
|
|
1719
1731
|
* ```
|
|
1720
1732
|
*
|
|
1721
|
-
*
|
|
1722
|
-
*
|
|
1733
|
+
* **Example** (Combining Two Effects Concurrently)
|
|
1734
|
+
*
|
|
1735
|
+
* ```ts
|
|
1723
1736
|
* import { Effect } from "effect"
|
|
1724
1737
|
*
|
|
1725
1738
|
* const task1 = Effect.succeed(1).pipe(
|
|
@@ -1739,9 +1752,10 @@ export const flip = internal.flip;
|
|
|
1739
1752
|
* // timestamp=... level=INFO fiber=#0 message="task2 done"
|
|
1740
1753
|
* // timestamp=... level=INFO fiber=#0 message="task1 done"
|
|
1741
1754
|
* // [ 1, 'hello' ]
|
|
1755
|
+
* ```
|
|
1742
1756
|
*
|
|
1743
|
-
* @since 2.0.0
|
|
1744
1757
|
* @category Zipping
|
|
1758
|
+
* @since 2.0.0
|
|
1745
1759
|
*/
|
|
1746
1760
|
export const zip = internal.zip;
|
|
1747
1761
|
/**
|
|
@@ -1759,9 +1773,9 @@ export const zip = internal.zip;
|
|
|
1759
1773
|
* By default, the effects are run sequentially. To execute them concurrently,
|
|
1760
1774
|
* use the `{ concurrent: true }` option.
|
|
1761
1775
|
*
|
|
1762
|
-
*
|
|
1776
|
+
* **Example** (Combining Effects with a Custom Function)
|
|
1777
|
+
*
|
|
1763
1778
|
* ```ts
|
|
1764
|
-
* // Title: Combining Effects with a Custom Function
|
|
1765
1779
|
* import { Effect } from "effect"
|
|
1766
1780
|
*
|
|
1767
1781
|
* const task1 = Effect.succeed(1).pipe(
|
|
@@ -1787,8 +1801,8 @@ export const zip = internal.zip;
|
|
|
1787
1801
|
* // 6
|
|
1788
1802
|
* ```
|
|
1789
1803
|
*
|
|
1790
|
-
* @since 2.0.0
|
|
1791
1804
|
* @category Zipping
|
|
1805
|
+
* @since 2.0.0
|
|
1792
1806
|
*/
|
|
1793
1807
|
export const zipWith = internal.zipWith;
|
|
1794
1808
|
// -----------------------------------------------------------------------------
|
|
@@ -1817,8 +1831,8 @@ export {
|
|
|
1817
1831
|
*
|
|
1818
1832
|
* - `Effect.catchAll`
|
|
1819
1833
|
*
|
|
1820
|
-
* @since 4.0.0
|
|
1821
1834
|
* @category Error Handling
|
|
1835
|
+
* @since 4.0.0
|
|
1822
1836
|
*/
|
|
1823
1837
|
catch_ as catch };
|
|
1824
1838
|
/**
|
|
@@ -1835,7 +1849,8 @@ catch_ as catch };
|
|
|
1835
1849
|
* The error type must have a readonly `_tag` field to use `catchTag`. This
|
|
1836
1850
|
* field is used to identify and match errors.
|
|
1837
1851
|
*
|
|
1838
|
-
*
|
|
1852
|
+
* **Example** (Usage)
|
|
1853
|
+
*
|
|
1839
1854
|
* ```ts
|
|
1840
1855
|
* import { Effect } from "effect"
|
|
1841
1856
|
*
|
|
@@ -1858,8 +1873,8 @@ catch_ as catch };
|
|
|
1858
1873
|
* )
|
|
1859
1874
|
* ```
|
|
1860
1875
|
*
|
|
1861
|
-
* @since 2.0.0
|
|
1862
1876
|
* @category Error Handling
|
|
1877
|
+
* @since 2.0.0
|
|
1863
1878
|
*/
|
|
1864
1879
|
export const catchTag = internal.catchTag;
|
|
1865
1880
|
/**
|
|
@@ -1877,7 +1892,8 @@ export const catchTag = internal.catchTag;
|
|
|
1877
1892
|
* The error type must have a readonly `_tag` field to use `catchTag`. This
|
|
1878
1893
|
* field is used to identify and match errors.
|
|
1879
1894
|
*
|
|
1880
|
-
*
|
|
1895
|
+
* **Example** (Usage)
|
|
1896
|
+
*
|
|
1881
1897
|
* ```ts
|
|
1882
1898
|
* import { Data, Effect } from "effect"
|
|
1883
1899
|
*
|
|
@@ -1901,8 +1917,8 @@ export const catchTag = internal.catchTag;
|
|
|
1901
1917
|
* })
|
|
1902
1918
|
* ```
|
|
1903
1919
|
*
|
|
1904
|
-
* @since 2.0.0
|
|
1905
1920
|
* @category Error Handling
|
|
1921
|
+
* @since 2.0.0
|
|
1906
1922
|
*/
|
|
1907
1923
|
export const catchTags = internal.catchTags;
|
|
1908
1924
|
/**
|
|
@@ -1911,7 +1927,8 @@ export const catchTags = internal.catchTags;
|
|
|
1911
1927
|
* Use this to handle nested error causes without removing the parent error
|
|
1912
1928
|
* from the error channel. The handler receives the unwrapped reason.
|
|
1913
1929
|
*
|
|
1914
|
-
*
|
|
1930
|
+
* **Example** (Usage)
|
|
1931
|
+
*
|
|
1915
1932
|
* ```ts
|
|
1916
1933
|
* import { Data, Effect } from "effect"
|
|
1917
1934
|
*
|
|
@@ -1937,14 +1954,15 @@ export const catchTags = internal.catchTags;
|
|
|
1937
1954
|
* )
|
|
1938
1955
|
* ```
|
|
1939
1956
|
*
|
|
1940
|
-
* @since 4.0.0
|
|
1941
1957
|
* @category Error Handling
|
|
1958
|
+
* @since 4.0.0
|
|
1942
1959
|
*/
|
|
1943
1960
|
export const catchReason = internal.catchReason;
|
|
1944
1961
|
/**
|
|
1945
1962
|
* Catches multiple reasons within a tagged error using an object of handlers.
|
|
1946
1963
|
*
|
|
1947
|
-
*
|
|
1964
|
+
* **Example** (Usage)
|
|
1965
|
+
*
|
|
1948
1966
|
* ```ts
|
|
1949
1967
|
* import { Data, Effect } from "effect"
|
|
1950
1968
|
*
|
|
@@ -1972,15 +1990,16 @@ export const catchReason = internal.catchReason;
|
|
|
1972
1990
|
* )
|
|
1973
1991
|
* ```
|
|
1974
1992
|
*
|
|
1975
|
-
* @since 4.0.0
|
|
1976
1993
|
* @category Error Handling
|
|
1994
|
+
* @since 4.0.0
|
|
1977
1995
|
*/
|
|
1978
1996
|
export const catchReasons = internal.catchReasons;
|
|
1979
1997
|
/**
|
|
1980
1998
|
* Promotes nested reason errors into the Effect error channel, replacing
|
|
1981
1999
|
* the parent error.
|
|
1982
2000
|
*
|
|
1983
|
-
*
|
|
2001
|
+
* **Example** (Usage)
|
|
2002
|
+
*
|
|
1984
2003
|
* ```ts
|
|
1985
2004
|
* import { Data, Effect } from "effect"
|
|
1986
2005
|
*
|
|
@@ -2003,8 +2022,8 @@ export const catchReasons = internal.catchReasons;
|
|
|
2003
2022
|
* const unwrapped = program.pipe(Effect.unwrapReason("AiError"))
|
|
2004
2023
|
* ```
|
|
2005
2024
|
*
|
|
2006
|
-
* @since 4.0.0
|
|
2007
2025
|
* @category Error Handling
|
|
2026
|
+
* @since 4.0.0
|
|
2008
2027
|
*/
|
|
2009
2028
|
export const unwrapReason = internal.unwrapReason;
|
|
2010
2029
|
/**
|
|
@@ -2030,7 +2049,8 @@ export const unwrapReason = internal.unwrapReason;
|
|
|
2030
2049
|
*
|
|
2031
2050
|
* - `Effect.catchAllCause`
|
|
2032
2051
|
*
|
|
2033
|
-
*
|
|
2052
|
+
* **Example** (Usage)
|
|
2053
|
+
*
|
|
2034
2054
|
* ```ts
|
|
2035
2055
|
* import { Cause, Console, Effect } from "effect"
|
|
2036
2056
|
*
|
|
@@ -2048,32 +2068,28 @@ export const unwrapReason = internal.unwrapReason;
|
|
|
2048
2068
|
* })
|
|
2049
2069
|
* ```
|
|
2050
2070
|
*
|
|
2051
|
-
* @since 4.0.0
|
|
2052
2071
|
* @category Error Handling
|
|
2072
|
+
* @since 4.0.0
|
|
2053
2073
|
*/
|
|
2054
2074
|
export const catchCause = internal.catchCause;
|
|
2055
2075
|
/**
|
|
2056
|
-
* Recovers from
|
|
2076
|
+
* Recovers from defects using a provided recovery function.
|
|
2057
2077
|
*
|
|
2058
2078
|
* **When to Use**
|
|
2059
2079
|
*
|
|
2060
|
-
*
|
|
2061
|
-
*
|
|
2062
|
-
* information on a defect for diagnostic or explanatory purposes.
|
|
2080
|
+
* Use this sparingly, usually at integration boundaries where defects must be
|
|
2081
|
+
* reported or translated for an external system.
|
|
2063
2082
|
*
|
|
2064
2083
|
* **Details**
|
|
2065
2084
|
*
|
|
2066
|
-
* `
|
|
2067
|
-
*
|
|
2068
|
-
* from these defects by providing a function that handles the error. However,
|
|
2069
|
-
* it does not handle expected errors (like those from {@link fail}) or
|
|
2070
|
-
* execution interruptions (like those from {@link interrupt}).
|
|
2085
|
+
* `catchDefect` handles unexpected defects, such as thrown exceptions or
|
|
2086
|
+
* values passed to `die`, without catching typed failures or interruptions.
|
|
2071
2087
|
*
|
|
2072
2088
|
* **When to Recover from Defects**
|
|
2073
2089
|
*
|
|
2074
|
-
* Defects are unexpected errors that typically
|
|
2075
|
-
* they often indicate serious issues.
|
|
2076
|
-
*
|
|
2090
|
+
* Defects are unexpected errors that typically should not be recovered from, as
|
|
2091
|
+
* they often indicate serious issues. In some cases, such as dynamically loaded
|
|
2092
|
+
* plugins, controlled recovery may be needed.
|
|
2077
2093
|
*
|
|
2078
2094
|
* **Previously Known As**
|
|
2079
2095
|
*
|
|
@@ -2081,7 +2097,8 @@ export const catchCause = internal.catchCause;
|
|
|
2081
2097
|
*
|
|
2082
2098
|
* - `Effect.catchAllDefect`
|
|
2083
2099
|
*
|
|
2084
|
-
*
|
|
2100
|
+
* **Example** (Usage)
|
|
2101
|
+
*
|
|
2085
2102
|
* ```ts
|
|
2086
2103
|
* import { Console, Effect } from "effect"
|
|
2087
2104
|
*
|
|
@@ -2098,8 +2115,8 @@ export const catchCause = internal.catchCause;
|
|
|
2098
2115
|
* })
|
|
2099
2116
|
* ```
|
|
2100
2117
|
*
|
|
2101
|
-
* @since 4.0.0
|
|
2102
2118
|
* @category Error Handling
|
|
2119
|
+
* @since 4.0.0
|
|
2103
2120
|
*/
|
|
2104
2121
|
export const catchDefect = internal.catchDefect;
|
|
2105
2122
|
/**
|
|
@@ -2119,7 +2136,8 @@ export const catchDefect = internal.catchDefect;
|
|
|
2119
2136
|
* - `Effect.catchSome` (Effect 3.x)
|
|
2120
2137
|
* - `Effect.catchIf`
|
|
2121
2138
|
*
|
|
2122
|
-
*
|
|
2139
|
+
* **Example** (Usage)
|
|
2140
|
+
*
|
|
2123
2141
|
* ```ts
|
|
2124
2142
|
* import { Data, Effect, Filter } from "effect"
|
|
2125
2143
|
*
|
|
@@ -2144,15 +2162,15 @@ export const catchDefect = internal.catchDefect;
|
|
|
2144
2162
|
* )
|
|
2145
2163
|
* ```
|
|
2146
2164
|
*
|
|
2147
|
-
* @since 2.0.0
|
|
2148
2165
|
* @category Error Handling
|
|
2166
|
+
* @since 2.0.0
|
|
2149
2167
|
*/
|
|
2150
2168
|
export const catchIf = internal.catchIf;
|
|
2151
2169
|
/**
|
|
2152
2170
|
* Recovers from specific errors using a `Filter`.
|
|
2153
2171
|
*
|
|
2154
|
-
* @since 4.0.0
|
|
2155
2172
|
* @category Error Handling
|
|
2173
|
+
* @since 4.0.0
|
|
2156
2174
|
*/
|
|
2157
2175
|
export const catchFilter = internal.catchFilter;
|
|
2158
2176
|
/**
|
|
@@ -2161,7 +2179,8 @@ export const catchFilter = internal.catchFilter;
|
|
|
2161
2179
|
* Success values become `Option.some`, `NoSuchElementError` becomes
|
|
2162
2180
|
* `Option.none`, and all other errors are preserved.
|
|
2163
2181
|
*
|
|
2164
|
-
*
|
|
2182
|
+
* **Example** (Usage)
|
|
2183
|
+
*
|
|
2165
2184
|
* ```ts
|
|
2166
2185
|
* import { Effect, Option } from "effect"
|
|
2167
2186
|
*
|
|
@@ -2178,8 +2197,8 @@ export const catchFilter = internal.catchFilter;
|
|
|
2178
2197
|
*
|
|
2179
2198
|
* - `Effect.optionFromOptional`
|
|
2180
2199
|
*
|
|
2181
|
-
* @since 2.0.0
|
|
2182
2200
|
* @category Error Handling
|
|
2201
|
+
* @since 2.0.0
|
|
2183
2202
|
*/
|
|
2184
2203
|
export const catchNoSuchElement = internal.catchNoSuchElement;
|
|
2185
2204
|
/**
|
|
@@ -2195,7 +2214,8 @@ export const catchNoSuchElement = internal.catchNoSuchElement;
|
|
|
2195
2214
|
*
|
|
2196
2215
|
* - `Effect.catchSomeCause`
|
|
2197
2216
|
*
|
|
2198
|
-
*
|
|
2217
|
+
* **Example** (Usage)
|
|
2218
|
+
*
|
|
2199
2219
|
* ```ts
|
|
2200
2220
|
* import { Cause, Console, Effect } from "effect"
|
|
2201
2221
|
*
|
|
@@ -2217,15 +2237,15 @@ export const catchNoSuchElement = internal.catchNoSuchElement;
|
|
|
2217
2237
|
* // Then: "Fallback response"
|
|
2218
2238
|
* ```
|
|
2219
2239
|
*
|
|
2220
|
-
* @since 4.0.0
|
|
2221
2240
|
* @category Error Handling
|
|
2241
|
+
* @since 4.0.0
|
|
2222
2242
|
*/
|
|
2223
2243
|
export const catchCauseIf = internal.catchCauseIf;
|
|
2224
2244
|
/**
|
|
2225
2245
|
* Recovers from specific failures based on a `Filter`.
|
|
2226
2246
|
*
|
|
2227
|
-
* @since 4.0.0
|
|
2228
2247
|
* @category Error Handling
|
|
2248
|
+
* @since 4.0.0
|
|
2229
2249
|
*/
|
|
2230
2250
|
export const catchCauseFilter = internal.catchCauseFilter;
|
|
2231
2251
|
/**
|
|
@@ -2241,7 +2261,8 @@ export const catchCauseFilter = internal.catchCauseFilter;
|
|
|
2241
2261
|
* @see {@link mapBoth} for a version that operates on both channels.
|
|
2242
2262
|
* @see {@link orElseFail} if you want to replace the error with a new one.
|
|
2243
2263
|
*
|
|
2244
|
-
*
|
|
2264
|
+
* **Example** (Usage)
|
|
2265
|
+
*
|
|
2245
2266
|
* ```ts
|
|
2246
2267
|
* import { Data, Effect } from "effect"
|
|
2247
2268
|
*
|
|
@@ -2259,8 +2280,8 @@ export const catchCauseFilter = internal.catchCauseFilter;
|
|
|
2259
2280
|
* )
|
|
2260
2281
|
* ```
|
|
2261
2282
|
*
|
|
2262
|
-
* @since 2.0.0
|
|
2263
2283
|
* @category Error Handling
|
|
2284
|
+
* @since 2.0.0
|
|
2264
2285
|
*/
|
|
2265
2286
|
export const mapError = internal.mapError;
|
|
2266
2287
|
/**
|
|
@@ -2273,7 +2294,8 @@ export const mapError = internal.mapError;
|
|
|
2273
2294
|
* the error and the success values without altering the overall success or
|
|
2274
2295
|
* failure status of the effect.
|
|
2275
2296
|
*
|
|
2276
|
-
*
|
|
2297
|
+
* **Example** (Usage)
|
|
2298
|
+
*
|
|
2277
2299
|
* ```ts
|
|
2278
2300
|
* import { Data, Effect } from "effect"
|
|
2279
2301
|
*
|
|
@@ -2294,28 +2316,24 @@ export const mapError = internal.mapError;
|
|
|
2294
2316
|
* @see {@link map} for a version that operates on the success channel.
|
|
2295
2317
|
* @see {@link mapError} for a version that operates on the error channel.
|
|
2296
2318
|
*
|
|
2297
|
-
* @since 2.0.0
|
|
2298
2319
|
* @category Mapping
|
|
2320
|
+
* @since 2.0.0
|
|
2299
2321
|
*/
|
|
2300
2322
|
export const mapBoth = internal.mapBoth;
|
|
2301
2323
|
/**
|
|
2302
|
-
* Converts
|
|
2324
|
+
* Converts typed failures from the error channel into defects, removing the
|
|
2325
|
+
* error type from the returned effect.
|
|
2303
2326
|
*
|
|
2304
|
-
* **When to Use
|
|
2305
|
-
*
|
|
2306
|
-
* Use `orDie` when failures should be treated as unrecoverable defects and no error handling is required.
|
|
2307
|
-
*
|
|
2308
|
-
* **Details**
|
|
2327
|
+
* **When to Use**
|
|
2309
2328
|
*
|
|
2310
|
-
*
|
|
2311
|
-
*
|
|
2312
|
-
* This is useful for propagating failures as defects, signaling that they should not be handled within the effect.
|
|
2329
|
+
* Use `orDie` when a typed failure represents an unrecoverable bug or invalid
|
|
2330
|
+
* state and should not be handled as a recoverable error.
|
|
2313
2331
|
*
|
|
2314
2332
|
* @see {@link orDieWith} if you need to customize the error.
|
|
2315
2333
|
*
|
|
2316
|
-
*
|
|
2334
|
+
* **Example** (Propagating an Error as a Defect)
|
|
2335
|
+
*
|
|
2317
2336
|
* ```ts
|
|
2318
|
-
* // Title: Propagating an Error as a Defect
|
|
2319
2337
|
* import { Data, Effect } from "effect"
|
|
2320
2338
|
*
|
|
2321
2339
|
* class DivideByZeroError extends Data.TaggedError("DivideByZeroError")<{}> {}
|
|
@@ -2335,20 +2353,22 @@ export const mapBoth = internal.mapBoth;
|
|
|
2335
2353
|
* // ...stack trace...
|
|
2336
2354
|
* ```
|
|
2337
2355
|
*
|
|
2338
|
-
* @since 2.0.0
|
|
2339
2356
|
* @category Converting Failures to Defects
|
|
2357
|
+
* @since 2.0.0
|
|
2340
2358
|
*/
|
|
2341
2359
|
export const orDie = internal.orDie;
|
|
2342
2360
|
/**
|
|
2343
|
-
*
|
|
2344
|
-
*
|
|
2361
|
+
* Runs an effectful operation when the source effect fails, while preserving
|
|
2362
|
+
* the original failure when the operation succeeds.
|
|
2363
|
+
*
|
|
2364
|
+
* **Details**
|
|
2365
|
+
*
|
|
2366
|
+
* Use this for logging, metrics, or other failure-side observations. If the
|
|
2367
|
+
* operation passed to `tapError` fails, that error is also represented in the
|
|
2368
|
+
* returned effect's error channel.
|
|
2345
2369
|
*
|
|
2346
|
-
*
|
|
2347
|
-
* logging or tracking) on the failure of an effect, but without changing the
|
|
2348
|
-
* result of the effect itself. The error remains in the effect's error channel,
|
|
2349
|
-
* while the operation you provide can inspect or act on it.
|
|
2370
|
+
* **Example** (Usage)
|
|
2350
2371
|
*
|
|
2351
|
-
* @example
|
|
2352
2372
|
* ```ts
|
|
2353
2373
|
* import { Console, Effect } from "effect"
|
|
2354
2374
|
*
|
|
@@ -2366,17 +2386,19 @@ export const orDie = internal.orDie;
|
|
|
2366
2386
|
* // expected error: NetworkError
|
|
2367
2387
|
* ```
|
|
2368
2388
|
*
|
|
2369
|
-
* @since 2.0.0
|
|
2370
2389
|
* @category Sequencing
|
|
2390
|
+
* @since 2.0.0
|
|
2371
2391
|
*/
|
|
2372
2392
|
export const tapError = internal.tapError;
|
|
2373
2393
|
/**
|
|
2374
2394
|
* Runs an effectful handler when a failure's `_tag` matches.
|
|
2375
2395
|
*
|
|
2376
|
-
* Use this with tagged-union errors to perform side effects for
|
|
2377
|
-
* list
|
|
2396
|
+
* Use this with tagged-union errors to perform side effects for one tag or a
|
|
2397
|
+
* list of tags. When the handler succeeds, the original failure is preserved;
|
|
2398
|
+
* if the handler fails, its error is also included in the returned effect.
|
|
2399
|
+
*
|
|
2400
|
+
* **Example** (Usage)
|
|
2378
2401
|
*
|
|
2379
|
-
* @example
|
|
2380
2402
|
* ```ts
|
|
2381
2403
|
* import { Console, Data, Effect } from "effect"
|
|
2382
2404
|
*
|
|
@@ -2400,18 +2422,19 @@ export const tapError = internal.tapError;
|
|
|
2400
2422
|
* // expected error: 504
|
|
2401
2423
|
* ```
|
|
2402
2424
|
*
|
|
2403
|
-
* @since 2.0.0
|
|
2404
2425
|
* @category Sequencing
|
|
2426
|
+
* @since 2.0.0
|
|
2405
2427
|
*/
|
|
2406
2428
|
export const tapErrorTag = internal.tapErrorTag;
|
|
2407
2429
|
/**
|
|
2408
|
-
*
|
|
2409
|
-
*
|
|
2430
|
+
* Runs an effectful operation with the full `Cause` when the source effect
|
|
2431
|
+
* fails.
|
|
2432
|
+
*
|
|
2433
|
+
* **Details**
|
|
2410
2434
|
*
|
|
2411
|
-
*
|
|
2412
|
-
*
|
|
2413
|
-
*
|
|
2414
|
-
* altering the error or the overall result of the effect.
|
|
2435
|
+
* Use this to log or inspect typed failures, defects, and interruptions. When
|
|
2436
|
+
* the operation succeeds, the original cause is preserved. If the operation
|
|
2437
|
+
* fails, its error is also represented in the returned effect.
|
|
2415
2438
|
*
|
|
2416
2439
|
* **Previously Known As**
|
|
2417
2440
|
*
|
|
@@ -2419,7 +2442,8 @@ export const tapErrorTag = internal.tapErrorTag;
|
|
|
2419
2442
|
*
|
|
2420
2443
|
* - `Effect.tapErrorCause`
|
|
2421
2444
|
*
|
|
2422
|
-
*
|
|
2445
|
+
* **Example** (Usage)
|
|
2446
|
+
*
|
|
2423
2447
|
* ```ts
|
|
2424
2448
|
* import { Cause, Console, Effect } from "effect"
|
|
2425
2449
|
*
|
|
@@ -2435,8 +2459,8 @@ export const tapErrorTag = internal.tapErrorTag;
|
|
|
2435
2459
|
* // Then: { _id: 'Exit', _tag: 'Failure', cause: ... }
|
|
2436
2460
|
* ```
|
|
2437
2461
|
*
|
|
2438
|
-
* @since 2.0.0
|
|
2439
2462
|
* @category Sequencing
|
|
2463
|
+
* @since 2.0.0
|
|
2440
2464
|
*/
|
|
2441
2465
|
export const tapCause = internal.tapCause;
|
|
2442
2466
|
/**
|
|
@@ -2446,7 +2470,8 @@ export const tapCause = internal.tapCause;
|
|
|
2446
2470
|
* the cause matches a specific predicate. This is useful for conditional logging,
|
|
2447
2471
|
* monitoring, or other side effects based on the type of failure.
|
|
2448
2472
|
*
|
|
2449
|
-
*
|
|
2473
|
+
* **Example** (Usage)
|
|
2474
|
+
*
|
|
2450
2475
|
* ```ts
|
|
2451
2476
|
* import { Cause, Console, Effect } from "effect"
|
|
2452
2477
|
*
|
|
@@ -2464,34 +2489,29 @@ export const tapCause = internal.tapCause;
|
|
|
2464
2489
|
* // Then: { _id: 'Exit', _tag: 'Failure', cause: ... }
|
|
2465
2490
|
* ```
|
|
2466
2491
|
*
|
|
2467
|
-
* @since 4.0.0
|
|
2468
2492
|
* @category Sequencing
|
|
2493
|
+
* @since 4.0.0
|
|
2469
2494
|
*/
|
|
2470
2495
|
export const tapCauseIf = internal.tapCauseIf;
|
|
2471
2496
|
/**
|
|
2472
2497
|
* Conditionally executes a side effect based on the cause of a failed effect.
|
|
2473
2498
|
*
|
|
2474
|
-
* @since 4.0.0
|
|
2475
2499
|
* @category Sequencing
|
|
2500
|
+
* @since 4.0.0
|
|
2476
2501
|
*/
|
|
2477
2502
|
export const tapCauseFilter = internal.tapCauseFilter;
|
|
2478
2503
|
/**
|
|
2479
|
-
*
|
|
2504
|
+
* Runs an effectful operation when the source effect dies with a defect.
|
|
2480
2505
|
*
|
|
2481
2506
|
* **Details**
|
|
2482
2507
|
*
|
|
2483
|
-
*
|
|
2484
|
-
*
|
|
2485
|
-
*
|
|
2486
|
-
*
|
|
2487
|
-
* handling.
|
|
2508
|
+
* Use this for diagnostics such as logging unexpected thrown exceptions or
|
|
2509
|
+
* values passed to `die`. Recoverable failures are not handled. When the
|
|
2510
|
+
* operation succeeds, the original defect is preserved; if the operation fails,
|
|
2511
|
+
* its error is also represented in the returned effect.
|
|
2488
2512
|
*
|
|
2489
|
-
*
|
|
2490
|
-
* will be executed, allowing you to log, monitor, or handle the defect in some
|
|
2491
|
-
* way. Importantly, this does not alter the main result of the effect. If no
|
|
2492
|
-
* defect occurs, the effect behaves as if this function was not used.
|
|
2513
|
+
* **Example** (Usage)
|
|
2493
2514
|
*
|
|
2494
|
-
* @example
|
|
2495
2515
|
* ```ts
|
|
2496
2516
|
* import { Console, Effect } from "effect"
|
|
2497
2517
|
*
|
|
@@ -2524,8 +2544,8 @@ export const tapCauseFilter = internal.tapCauseFilter;
|
|
|
2524
2544
|
* // ... stack trace ...
|
|
2525
2545
|
* ```
|
|
2526
2546
|
*
|
|
2527
|
-
* @since 2.0.0
|
|
2528
2547
|
* @category Sequencing
|
|
2548
|
+
* @since 2.0.0
|
|
2529
2549
|
*/
|
|
2530
2550
|
export const tapDefect = internal.tapDefect;
|
|
2531
2551
|
/**
|
|
@@ -2533,7 +2553,8 @@ export const tapDefect = internal.tapDefect;
|
|
|
2533
2553
|
*
|
|
2534
2554
|
* Yields between attempts so other fibers can run.
|
|
2535
2555
|
*
|
|
2536
|
-
*
|
|
2556
|
+
* **Example** (Usage)
|
|
2557
|
+
*
|
|
2537
2558
|
* ```ts
|
|
2538
2559
|
* import { Console, Effect } from "effect"
|
|
2539
2560
|
*
|
|
@@ -2558,32 +2579,29 @@ export const tapDefect = internal.tapDefect;
|
|
|
2558
2579
|
* // Ready
|
|
2559
2580
|
* ```
|
|
2560
2581
|
*
|
|
2561
|
-
* @since 2.0.0
|
|
2562
2582
|
* @category Repetition / Recursion
|
|
2583
|
+
* @since 2.0.0
|
|
2563
2584
|
*/
|
|
2564
2585
|
export const eventually = internal.eventually;
|
|
2565
2586
|
/**
|
|
2566
|
-
* Retries
|
|
2587
|
+
* Retries typed failures from an effect according to a retry policy.
|
|
2567
2588
|
*
|
|
2568
2589
|
* **Details**
|
|
2569
2590
|
*
|
|
2570
|
-
* The
|
|
2571
|
-
*
|
|
2572
|
-
* the policy
|
|
2591
|
+
* The policy can be a `Schedule`, a schedule builder, or a `Retry.Options`
|
|
2592
|
+
* object using `schedule`, `times`, `while`, or `until`. If a retry eventually
|
|
2593
|
+
* succeeds, the returned effect succeeds with that value. If the policy stops
|
|
2594
|
+
* while the effect is still failing, the last failure is propagated.
|
|
2573
2595
|
*
|
|
2574
|
-
*
|
|
2575
|
-
*
|
|
2576
|
-
* If the maximum retries are exhausted and the effect still fails, the failure
|
|
2577
|
-
* is propagated.
|
|
2596
|
+
* Defects and interruptions are not retried as typed failures.
|
|
2578
2597
|
*
|
|
2579
2598
|
* **When to Use**
|
|
2580
2599
|
*
|
|
2581
|
-
*
|
|
2582
|
-
*
|
|
2583
|
-
*
|
|
2584
|
-
*
|
|
2600
|
+
* Use `retry` when typed failures may be transient, such as network issues or
|
|
2601
|
+
* temporary resource unavailability.
|
|
2602
|
+
*
|
|
2603
|
+
* **Example** (Usage)
|
|
2585
2604
|
*
|
|
2586
|
-
* @example
|
|
2587
2605
|
* ```ts
|
|
2588
2606
|
* import { Data, Effect, Schedule } from "effect"
|
|
2589
2607
|
*
|
|
@@ -2609,8 +2627,8 @@ export const eventually = internal.eventually;
|
|
|
2609
2627
|
* @see {@link retryOrElse} for a version that allows you to run a fallback.
|
|
2610
2628
|
* @see {@link repeat} if your retry condition is based on successful outcomes rather than errors.
|
|
2611
2629
|
*
|
|
2612
|
-
* @since 2.0.0
|
|
2613
2630
|
* @category Error Handling
|
|
2631
|
+
* @since 2.0.0
|
|
2614
2632
|
*/
|
|
2615
2633
|
export const retry = internalSchedule.retry;
|
|
2616
2634
|
/**
|
|
@@ -2631,7 +2649,8 @@ export const retry = internalSchedule.retry;
|
|
|
2631
2649
|
*
|
|
2632
2650
|
* @see {@link retry} for a version that does not run a fallback effect.
|
|
2633
2651
|
*
|
|
2634
|
-
*
|
|
2652
|
+
* **Example** (Usage)
|
|
2653
|
+
*
|
|
2635
2654
|
* ```ts
|
|
2636
2655
|
* import { Console, Data, Effect, Schedule } from "effect"
|
|
2637
2656
|
*
|
|
@@ -2666,24 +2685,21 @@ export const retry = internalSchedule.retry;
|
|
|
2666
2685
|
* // Network data
|
|
2667
2686
|
* ```
|
|
2668
2687
|
*
|
|
2669
|
-
* @since 2.0.0
|
|
2670
2688
|
* @category Error Handling
|
|
2689
|
+
* @since 2.0.0
|
|
2671
2690
|
*/
|
|
2672
2691
|
export const retryOrElse = internalSchedule.retryOrElse;
|
|
2673
2692
|
/**
|
|
2674
|
-
*
|
|
2675
|
-
*
|
|
2676
|
-
*
|
|
2677
|
-
*
|
|
2693
|
+
* Exposes an effect's full failure cause in the error channel as `Cause<E>`.
|
|
2694
|
+
*
|
|
2695
|
+
* **Details**
|
|
2696
|
+
*
|
|
2697
|
+
* Use `sandbox` when downstream error handling needs to distinguish typed
|
|
2698
|
+
* failures, defects, and interruptions. Use `unsandbox` to restore the original
|
|
2699
|
+
* typed error channel after cause-level handling.
|
|
2678
2700
|
*
|
|
2679
|
-
*
|
|
2680
|
-
* of failures, defects, or interruptions, enabling more detailed error
|
|
2681
|
-
* handling. Once you apply `sandbox`, you can use operators like
|
|
2682
|
-
* {@link catchAll} and {@link catchTags} to handle specific error conditions.
|
|
2683
|
-
* If necessary, you can revert the sandboxing operation with {@link unsandbox}
|
|
2684
|
-
* to return to the original error handling behavior.
|
|
2701
|
+
* **Example** (Usage)
|
|
2685
2702
|
*
|
|
2686
|
-
* @example
|
|
2687
2703
|
* ```ts
|
|
2688
2704
|
* import { Cause, Effect } from "effect"
|
|
2689
2705
|
*
|
|
@@ -2701,8 +2717,8 @@ export const retryOrElse = internalSchedule.retryOrElse;
|
|
|
2701
2717
|
*
|
|
2702
2718
|
* @see {@link unsandbox} to restore the original error handling.
|
|
2703
2719
|
*
|
|
2704
|
-
* @since 2.0.0
|
|
2705
2720
|
* @category Error Handling
|
|
2721
|
+
* @since 2.0.0
|
|
2706
2722
|
*/
|
|
2707
2723
|
export const sandbox = internal.sandbox;
|
|
2708
2724
|
/**
|
|
@@ -2717,9 +2733,9 @@ export const sandbox = internal.sandbox;
|
|
|
2717
2733
|
* Use the `log` option to emit the full {@link Cause} when the effect fails,
|
|
2718
2734
|
* and `message` to prepend a custom log message.
|
|
2719
2735
|
*
|
|
2720
|
-
*
|
|
2736
|
+
* **Example** (Using Effect.ignore to Discard Values)
|
|
2737
|
+
*
|
|
2721
2738
|
* ```ts
|
|
2722
|
-
* // Title: Using Effect.ignore to Discard Values
|
|
2723
2739
|
* import { Effect } from "effect"
|
|
2724
2740
|
*
|
|
2725
2741
|
* // ┌─── Effect<number, string, never>
|
|
@@ -2731,9 +2747,9 @@ export const sandbox = internal.sandbox;
|
|
|
2731
2747
|
* const program = task.pipe(Effect.ignore)
|
|
2732
2748
|
* ```
|
|
2733
2749
|
*
|
|
2734
|
-
*
|
|
2750
|
+
* **Example** (Logging failures while ignoring results)
|
|
2751
|
+
*
|
|
2735
2752
|
* ```ts
|
|
2736
|
-
* // Title: Logging failures while ignoring results
|
|
2737
2753
|
* import { Effect } from "effect"
|
|
2738
2754
|
*
|
|
2739
2755
|
* const task = Effect.fail("Uh oh!")
|
|
@@ -2748,8 +2764,8 @@ export const sandbox = internal.sandbox;
|
|
|
2748
2764
|
*
|
|
2749
2765
|
* - `Effect.ignoreLogged`
|
|
2750
2766
|
*
|
|
2751
|
-
* @since 2.0.0
|
|
2752
2767
|
* @category Error Handling
|
|
2768
|
+
* @since 2.0.0
|
|
2753
2769
|
*/
|
|
2754
2770
|
export const ignore = internal.ignore;
|
|
2755
2771
|
/**
|
|
@@ -2758,7 +2774,8 @@ export const ignore = internal.ignore;
|
|
|
2758
2774
|
* Use the `log` option to emit the full {@link Cause} when the effect fails,
|
|
2759
2775
|
* and `message` to prepend a custom log message.
|
|
2760
2776
|
*
|
|
2761
|
-
*
|
|
2777
|
+
* **Example** (Usage)
|
|
2778
|
+
*
|
|
2762
2779
|
* ```ts
|
|
2763
2780
|
* import { Effect } from "effect"
|
|
2764
2781
|
*
|
|
@@ -2768,8 +2785,8 @@ export const ignore = internal.ignore;
|
|
|
2768
2785
|
* const programLog = task.pipe(Effect.ignoreCause({ log: true, message: "Ignoring failure cause" }))
|
|
2769
2786
|
* ```
|
|
2770
2787
|
*
|
|
2771
|
-
* @since 4.0.0
|
|
2772
2788
|
* @category Error Handling
|
|
2789
|
+
* @since 4.0.0
|
|
2773
2790
|
*/
|
|
2774
2791
|
export const ignoreCause = internal.ignoreCause;
|
|
2775
2792
|
/**
|
|
@@ -2780,7 +2797,8 @@ export const ignoreCause = internal.ignoreCause;
|
|
|
2780
2797
|
* and retry timing is derived per step (the first attempt uses the remaining
|
|
2781
2798
|
* attempts schedule; later retries apply the step schedule at least once).
|
|
2782
2799
|
*
|
|
2783
|
-
*
|
|
2800
|
+
* **Example** (Usage)
|
|
2801
|
+
*
|
|
2784
2802
|
* ```ts
|
|
2785
2803
|
* import { Effect, ExecutionPlan, Layer, Context } from "effect"
|
|
2786
2804
|
*
|
|
@@ -2802,8 +2820,8 @@ export const ignoreCause = internal.ignoreCause;
|
|
|
2802
2820
|
* const program = Effect.withExecutionPlan(fetchUrl, plan)
|
|
2803
2821
|
* ```
|
|
2804
2822
|
*
|
|
2805
|
-
* @since 3.16.0
|
|
2806
2823
|
* @category Fallback
|
|
2824
|
+
* @since 3.16.0
|
|
2807
2825
|
*/
|
|
2808
2826
|
export const withExecutionPlan = internalExecutionPlan.withExecutionPlan;
|
|
2809
2827
|
/**
|
|
@@ -2812,31 +2830,26 @@ export const withExecutionPlan = internalExecutionPlan.withExecutionPlan;
|
|
|
2812
2830
|
* If the `defectsOnly` option is set to `true`, only defects (unrecoverable
|
|
2813
2831
|
* errors) will be reported, while regular failures will be ignored.
|
|
2814
2832
|
*
|
|
2815
|
-
* @since 4.0.0
|
|
2816
2833
|
* @category Error Handling
|
|
2834
|
+
* @since 4.0.0
|
|
2817
2835
|
*/
|
|
2818
2836
|
export const withErrorReporting = internal.withErrorReporting;
|
|
2819
2837
|
// -----------------------------------------------------------------------------
|
|
2820
2838
|
// Fallback
|
|
2821
2839
|
// -----------------------------------------------------------------------------
|
|
2822
2840
|
/**
|
|
2823
|
-
*
|
|
2824
|
-
*
|
|
2841
|
+
* Recovers from a typed failure by producing a fallback success value.
|
|
2842
|
+
*
|
|
2843
|
+
* **Details**
|
|
2825
2844
|
*
|
|
2826
|
-
*
|
|
2827
|
-
*
|
|
2828
|
-
* value,
|
|
2829
|
-
* you want to guarantee a successful result regardless of whether the original
|
|
2830
|
-
* effect failed.
|
|
2845
|
+
* If the source effect succeeds, its value is preserved. If it fails in the
|
|
2846
|
+
* error channel, `orElseSucceed` evaluates the fallback and succeeds with that
|
|
2847
|
+
* value, removing the typed error from the returned effect.
|
|
2831
2848
|
*
|
|
2832
|
-
*
|
|
2833
|
-
* by a successful value, which can be helpful for providing default values in
|
|
2834
|
-
* case of failure.
|
|
2849
|
+
* Defects and interruptions are not recovered by this operator.
|
|
2835
2850
|
*
|
|
2836
|
-
* **
|
|
2837
|
-
* already succeeds, it will remain unchanged.
|
|
2851
|
+
* **Example** (Usage)
|
|
2838
2852
|
*
|
|
2839
|
-
* @example
|
|
2840
2853
|
* ```ts
|
|
2841
2854
|
* import { Effect } from "effect"
|
|
2842
2855
|
*
|
|
@@ -2857,8 +2870,8 @@ export const withErrorReporting = internal.withErrorReporting;
|
|
|
2857
2870
|
* // { _id: 'Exit', _tag: 'Success', value: 18 }
|
|
2858
2871
|
* ```
|
|
2859
2872
|
*
|
|
2860
|
-
* @since 2.0.0
|
|
2861
2873
|
* @category Fallback
|
|
2874
|
+
* @since 2.0.0
|
|
2862
2875
|
*/
|
|
2863
2876
|
export const orElseSucceed = internal.orElseSucceed;
|
|
2864
2877
|
/**
|
|
@@ -2881,7 +2894,8 @@ export const orElseSucceed = internal.orElseSucceed;
|
|
|
2881
2894
|
* attempting multiple APIs, reading configuration from several sources, or
|
|
2882
2895
|
* trying alternative resource locations in order.
|
|
2883
2896
|
*
|
|
2884
|
-
*
|
|
2897
|
+
* **Example** (Usage)
|
|
2898
|
+
*
|
|
2885
2899
|
* ```ts
|
|
2886
2900
|
* import { Effect } from "effect"
|
|
2887
2901
|
*
|
|
@@ -2901,8 +2915,8 @@ export const orElseSucceed = internal.orElseSucceed;
|
|
|
2901
2915
|
* // Output: "secondary result"
|
|
2902
2916
|
* ```
|
|
2903
2917
|
*
|
|
2904
|
-
* @since 2.0.0
|
|
2905
2918
|
* @category Fallback
|
|
2919
|
+
* @since 2.0.0
|
|
2906
2920
|
*/
|
|
2907
2921
|
export const firstSuccessOf = internal.firstSuccessOf;
|
|
2908
2922
|
// -----------------------------------------------------------------------------
|
|
@@ -2922,7 +2936,8 @@ export const firstSuccessOf = internal.firstSuccessOf;
|
|
|
2922
2936
|
* @see {@link timeoutFailCause} for a version that raises a custom defect.
|
|
2923
2937
|
* @see {@link timeoutTo} for a version that allows specifying both success and timeout handlers.
|
|
2924
2938
|
*
|
|
2925
|
-
*
|
|
2939
|
+
* **Example** (Usage)
|
|
2940
|
+
*
|
|
2926
2941
|
* ```ts
|
|
2927
2942
|
* import { Effect } from "effect"
|
|
2928
2943
|
*
|
|
@@ -2951,30 +2966,28 @@ export const firstSuccessOf = internal.firstSuccessOf;
|
|
|
2951
2966
|
* // }
|
|
2952
2967
|
* ```
|
|
2953
2968
|
*
|
|
2954
|
-
* @since 2.0.0
|
|
2955
2969
|
* @category Delays & Timeouts
|
|
2970
|
+
* @since 2.0.0
|
|
2956
2971
|
*/
|
|
2957
2972
|
export const timeout = internal.timeout;
|
|
2958
2973
|
/**
|
|
2959
|
-
*
|
|
2960
|
-
*
|
|
2974
|
+
* Runs an effect with a time limit and represents only the timeout case as
|
|
2975
|
+
* `Option.none`.
|
|
2961
2976
|
*
|
|
2962
|
-
*
|
|
2963
|
-
* timeouts by wrapping the outcome of an effect in an `Option` type. If the
|
|
2964
|
-
* effect completes within the specified time, it returns a `Some` containing
|
|
2965
|
-
* the result. If the effect times out, it returns a `None`, allowing you to
|
|
2966
|
-
* treat the timeout as a regular result instead of throwing an error.
|
|
2977
|
+
* **Details**
|
|
2967
2978
|
*
|
|
2968
|
-
*
|
|
2969
|
-
*
|
|
2970
|
-
*
|
|
2979
|
+
* If the source effect succeeds before the timeout, the returned effect
|
|
2980
|
+
* succeeds with `Option.some(value)`. If the timeout wins, the source effect is
|
|
2981
|
+
* interrupted and the returned effect succeeds with `Option.none`. If the
|
|
2982
|
+
* source effect fails before the timeout, that failure is preserved.
|
|
2971
2983
|
*
|
|
2972
2984
|
* @see {@link timeout} for a version that raises a `TimeoutException`.
|
|
2973
2985
|
* @see {@link timeoutFail} for a version that raises a custom error.
|
|
2974
2986
|
* @see {@link timeoutFailCause} for a version that raises a custom defect.
|
|
2975
2987
|
* @see {@link timeoutTo} for a version that allows specifying both success and timeout handlers.
|
|
2976
2988
|
*
|
|
2977
|
-
*
|
|
2989
|
+
* **Example** (Usage)
|
|
2990
|
+
*
|
|
2978
2991
|
* ```ts
|
|
2979
2992
|
* import { Effect } from "effect"
|
|
2980
2993
|
*
|
|
@@ -3001,8 +3014,8 @@ export const timeout = internal.timeout;
|
|
|
3001
3014
|
* // ]
|
|
3002
3015
|
* ```
|
|
3003
3016
|
*
|
|
3004
|
-
* @since 3.1.0
|
|
3005
3017
|
* @category Delays & Timeouts
|
|
3018
|
+
* @since 3.1.0
|
|
3006
3019
|
*/
|
|
3007
3020
|
export const timeoutOption = internal.timeoutOption;
|
|
3008
3021
|
/**
|
|
@@ -3011,7 +3024,8 @@ export const timeoutOption = internal.timeoutOption;
|
|
|
3011
3024
|
* This function is useful when you want to set a maximum duration for an operation
|
|
3012
3025
|
* and provide an alternative action if the timeout is exceeded.
|
|
3013
3026
|
*
|
|
3014
|
-
*
|
|
3027
|
+
* **Example** (Usage)
|
|
3028
|
+
*
|
|
3015
3029
|
* ```ts
|
|
3016
3030
|
* import { Console, Effect } from "effect"
|
|
3017
3031
|
*
|
|
@@ -3038,15 +3052,16 @@ export const timeoutOption = internal.timeoutOption;
|
|
|
3038
3052
|
* // Cached result
|
|
3039
3053
|
* ```
|
|
3040
3054
|
*
|
|
3041
|
-
* @since 3.1.0
|
|
3042
3055
|
* @category Delays & Timeouts
|
|
3056
|
+
* @since 3.1.0
|
|
3043
3057
|
*/
|
|
3044
3058
|
export const timeoutOrElse = internal.timeoutOrElse;
|
|
3045
3059
|
/**
|
|
3046
3060
|
* Returns an effect that is delayed from this effect by the specified
|
|
3047
3061
|
* `Duration`.
|
|
3048
3062
|
*
|
|
3049
|
-
*
|
|
3063
|
+
* **Example** (Usage)
|
|
3064
|
+
*
|
|
3050
3065
|
* ```ts
|
|
3051
3066
|
* import { Console, Effect } from "effect"
|
|
3052
3067
|
*
|
|
@@ -3059,15 +3074,16 @@ export const timeoutOrElse = internal.timeoutOrElse;
|
|
|
3059
3074
|
* // Waits 1 second, then prints: "Delayed message"
|
|
3060
3075
|
* ```
|
|
3061
3076
|
*
|
|
3062
|
-
* @since 2.0.0
|
|
3063
3077
|
* @category Delays & Timeouts
|
|
3078
|
+
* @since 2.0.0
|
|
3064
3079
|
*/
|
|
3065
3080
|
export const delay = internal.delay;
|
|
3066
3081
|
/**
|
|
3067
|
-
* Returns an effect that suspends for the specified duration
|
|
3068
|
-
*
|
|
3082
|
+
* Returns an effect that suspends the current fiber for the specified duration
|
|
3083
|
+
* without blocking a JavaScript thread.
|
|
3084
|
+
*
|
|
3085
|
+
* **Example** (Usage)
|
|
3069
3086
|
*
|
|
3070
|
-
* @example
|
|
3071
3087
|
* ```ts
|
|
3072
3088
|
* import { Console, Effect } from "effect"
|
|
3073
3089
|
*
|
|
@@ -3082,8 +3098,8 @@ export const delay = internal.delay;
|
|
|
3082
3098
|
* // Output: "End" (after 2 seconds)
|
|
3083
3099
|
* ```
|
|
3084
3100
|
*
|
|
3085
|
-
* @since 2.0.0
|
|
3086
3101
|
* @category Delays & Timeouts
|
|
3102
|
+
* @since 2.0.0
|
|
3087
3103
|
*/
|
|
3088
3104
|
export const sleep = internal.sleep;
|
|
3089
3105
|
/**
|
|
@@ -3092,7 +3108,8 @@ export const sleep = internal.sleep;
|
|
|
3092
3108
|
* The original success, failure, or interruption is preserved; only the success
|
|
3093
3109
|
* value is paired with the duration.
|
|
3094
3110
|
*
|
|
3095
|
-
*
|
|
3111
|
+
* **Example** (Usage)
|
|
3112
|
+
*
|
|
3096
3113
|
* ```ts
|
|
3097
3114
|
* import { Console, Duration, Effect } from "effect"
|
|
3098
3115
|
*
|
|
@@ -3102,35 +3119,32 @@ export const sleep = internal.sleep;
|
|
|
3102
3119
|
* })
|
|
3103
3120
|
* ```
|
|
3104
3121
|
*
|
|
3105
|
-
* @since 2.0.0
|
|
3106
3122
|
* @category Delays & Timeouts
|
|
3123
|
+
* @since 2.0.0
|
|
3107
3124
|
*/
|
|
3108
3125
|
export const timed = internal.timed;
|
|
3109
3126
|
// -----------------------------------------------------------------------------
|
|
3110
3127
|
// Racing
|
|
3111
3128
|
// -----------------------------------------------------------------------------
|
|
3112
3129
|
/**
|
|
3113
|
-
*
|
|
3130
|
+
* Runs multiple effects concurrently and returns the first successful result.
|
|
3114
3131
|
*
|
|
3115
3132
|
* **Details**
|
|
3116
3133
|
*
|
|
3117
|
-
*
|
|
3118
|
-
*
|
|
3119
|
-
* interrupted.
|
|
3120
|
-
*
|
|
3121
|
-
* If none of the effects succeed, the function will fail with the last error
|
|
3122
|
-
* encountered.
|
|
3134
|
+
* Early failures do not finish the race; `raceAll` keeps waiting until one
|
|
3135
|
+
* effect succeeds or every effect has failed. When one effect succeeds, the
|
|
3136
|
+
* remaining effects are interrupted. If every effect fails, the returned effect
|
|
3137
|
+
* fails with a cause containing the collected failure reasons.
|
|
3123
3138
|
*
|
|
3124
3139
|
* **When to Use**
|
|
3125
3140
|
*
|
|
3126
|
-
*
|
|
3127
|
-
*
|
|
3128
|
-
* retries, or when you want to optimize for the faster response without
|
|
3129
|
-
* worrying about the other effects.
|
|
3141
|
+
* Use `raceAll` when early failures should be ignored until a success occurs
|
|
3142
|
+
* or all effects fail.
|
|
3130
3143
|
*
|
|
3131
3144
|
* @see {@link race} for a version that handles only two effects.
|
|
3132
3145
|
*
|
|
3133
|
-
*
|
|
3146
|
+
* **Example** (Usage)
|
|
3147
|
+
*
|
|
3134
3148
|
* ```ts
|
|
3135
3149
|
* import { Duration, Effect } from "effect"
|
|
3136
3150
|
*
|
|
@@ -3145,20 +3159,22 @@ export const timed = internal.timed;
|
|
|
3145
3159
|
* // Result: "Fast" (after ~100ms)
|
|
3146
3160
|
* ```
|
|
3147
3161
|
*
|
|
3148
|
-
* @since 2.0.0
|
|
3149
3162
|
* @category Racing
|
|
3163
|
+
* @since 2.0.0
|
|
3150
3164
|
*/
|
|
3151
3165
|
export const raceAll = internal.raceAll;
|
|
3152
3166
|
/**
|
|
3153
|
-
*
|
|
3167
|
+
* Runs multiple effects concurrently and completes with the first effect to
|
|
3168
|
+
* finish, whether it succeeds or fails.
|
|
3154
3169
|
*
|
|
3155
3170
|
* **Details**
|
|
3156
3171
|
*
|
|
3157
|
-
*
|
|
3158
|
-
*
|
|
3159
|
-
*
|
|
3172
|
+
* After the first effect completes, all remaining effects are interrupted. Use
|
|
3173
|
+
* `raceAll` when early failures should be ignored until a success occurs or
|
|
3174
|
+
* all effects fail.
|
|
3175
|
+
*
|
|
3176
|
+
* **Example** (Usage)
|
|
3160
3177
|
*
|
|
3161
|
-
* @example
|
|
3162
3178
|
* ```ts
|
|
3163
3179
|
* import { Duration, Effect } from "effect"
|
|
3164
3180
|
*
|
|
@@ -3173,8 +3189,8 @@ export const raceAll = internal.raceAll;
|
|
|
3173
3189
|
* // Result: "First" (after ~200ms, even though effect2 completes first but fails)
|
|
3174
3190
|
* ```
|
|
3175
3191
|
*
|
|
3176
|
-
* @since 4.0.0
|
|
3177
3192
|
* @category Racing
|
|
3193
|
+
* @since 4.0.0
|
|
3178
3194
|
*/
|
|
3179
3195
|
export const raceAllFirst = internal.raceAllFirst;
|
|
3180
3196
|
/**
|
|
@@ -3183,7 +3199,8 @@ export const raceAllFirst = internal.raceAllFirst;
|
|
|
3183
3199
|
* If one effect succeeds, the other is interrupted and `onWinner` can observe the
|
|
3184
3200
|
* winning fiber. If both fail, the race fails.
|
|
3185
3201
|
*
|
|
3186
|
-
*
|
|
3202
|
+
* **Example** (Usage)
|
|
3203
|
+
*
|
|
3187
3204
|
* ```ts
|
|
3188
3205
|
* import { Console, Duration, Effect } from "effect"
|
|
3189
3206
|
*
|
|
@@ -3199,8 +3216,8 @@ export const raceAllFirst = internal.raceAllFirst;
|
|
|
3199
3216
|
* // Output: winner: slow-success
|
|
3200
3217
|
* ```
|
|
3201
3218
|
*
|
|
3202
|
-
* @since 2.0.0
|
|
3203
3219
|
* @category Racing
|
|
3220
|
+
* @since 2.0.0
|
|
3204
3221
|
*/
|
|
3205
3222
|
export const race = internal.race;
|
|
3206
3223
|
/**
|
|
@@ -3209,7 +3226,8 @@ export const race = internal.race;
|
|
|
3209
3226
|
*
|
|
3210
3227
|
* The losing effect is interrupted, and `onWinner` can observe the winning fiber.
|
|
3211
3228
|
*
|
|
3212
|
-
*
|
|
3229
|
+
* **Example** (Usage)
|
|
3230
|
+
*
|
|
3213
3231
|
* ```ts
|
|
3214
3232
|
* import { Console, Duration, Effect } from "effect"
|
|
3215
3233
|
*
|
|
@@ -3228,8 +3246,8 @@ export const race = internal.race;
|
|
|
3228
3246
|
* // Output: failed: fast-fail
|
|
3229
3247
|
* ```
|
|
3230
3248
|
*
|
|
3231
|
-
* @since 2.0.0
|
|
3232
3249
|
* @category Racing
|
|
3250
|
+
* @since 2.0.0
|
|
3233
3251
|
*/
|
|
3234
3252
|
export const raceFirst = internal.raceFirst;
|
|
3235
3253
|
// -----------------------------------------------------------------------------
|
|
@@ -3239,7 +3257,8 @@ export const raceFirst = internal.raceFirst;
|
|
|
3239
3257
|
* Filters elements of an iterable using a predicate, refinement, or effectful
|
|
3240
3258
|
* predicate.
|
|
3241
3259
|
*
|
|
3242
|
-
*
|
|
3260
|
+
* **Example** (Usage)
|
|
3261
|
+
*
|
|
3243
3262
|
* ```ts
|
|
3244
3263
|
* import { Effect } from "effect"
|
|
3245
3264
|
*
|
|
@@ -3252,22 +3271,22 @@ export const raceFirst = internal.raceFirst;
|
|
|
3252
3271
|
* // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
|
|
3253
3272
|
* ```
|
|
3254
3273
|
*
|
|
3255
|
-
* @since 2.0.0
|
|
3256
3274
|
* @category Filtering
|
|
3275
|
+
* @since 2.0.0
|
|
3257
3276
|
*/
|
|
3258
3277
|
export const filter = internal.filter;
|
|
3259
3278
|
/**
|
|
3260
3279
|
* Filters and maps elements of an iterable with a `Filter`.
|
|
3261
3280
|
*
|
|
3262
|
-
* @since 4.0.0
|
|
3263
3281
|
* @category Filtering
|
|
3282
|
+
* @since 4.0.0
|
|
3264
3283
|
*/
|
|
3265
3284
|
export const filterMap = internal.filterMap;
|
|
3266
3285
|
/**
|
|
3267
3286
|
* Effectfully filters and maps elements of an iterable with a `FilterEffect`.
|
|
3268
3287
|
*
|
|
3269
|
-
* @since 4.0.0
|
|
3270
3288
|
* @category Filtering
|
|
3289
|
+
* @since 4.0.0
|
|
3271
3290
|
*/
|
|
3272
3291
|
export const filterMapEffect = internal.filterMapEffect;
|
|
3273
3292
|
/**
|
|
@@ -3280,7 +3299,8 @@ export const filterMapEffect = internal.filterMapEffect;
|
|
|
3280
3299
|
* `orElse` effect can produce an alternative value or perform additional
|
|
3281
3300
|
* computations.
|
|
3282
3301
|
*
|
|
3283
|
-
*
|
|
3302
|
+
* **Example** (Usage)
|
|
3303
|
+
*
|
|
3284
3304
|
* ```ts
|
|
3285
3305
|
* import { Effect } from "effect"
|
|
3286
3306
|
*
|
|
@@ -3297,15 +3317,15 @@ export const filterMapEffect = internal.filterMapEffect;
|
|
|
3297
3317
|
* // Result: "Number 5 is odd" (since 5 is not even)
|
|
3298
3318
|
* ```
|
|
3299
3319
|
*
|
|
3300
|
-
* @since 2.0.0
|
|
3301
3320
|
* @category Filtering
|
|
3321
|
+
* @since 2.0.0
|
|
3302
3322
|
*/
|
|
3303
3323
|
export const filterOrElse = internal.filterOrElse;
|
|
3304
3324
|
/**
|
|
3305
3325
|
* Filters an effect with a `Filter`, providing an alternative effect on failure.
|
|
3306
3326
|
*
|
|
3307
|
-
* @since 4.0.0
|
|
3308
3327
|
* @category Filtering
|
|
3328
|
+
* @since 4.0.0
|
|
3309
3329
|
*/
|
|
3310
3330
|
export const filterMapOrElse = internal.filterMapOrElse;
|
|
3311
3331
|
/**
|
|
@@ -3317,7 +3337,8 @@ export const filterMapOrElse = internal.filterMapOrElse;
|
|
|
3317
3337
|
* predicate evaluates to `false`, the effect fails with either a custom
|
|
3318
3338
|
* error (if `orFailWith` is provided) or a `NoSuchElementError`.
|
|
3319
3339
|
*
|
|
3320
|
-
*
|
|
3340
|
+
* **Example** (Usage)
|
|
3341
|
+
*
|
|
3321
3342
|
* ```ts
|
|
3322
3343
|
* import { Effect } from "effect"
|
|
3323
3344
|
*
|
|
@@ -3334,37 +3355,38 @@ export const filterMapOrElse = internal.filterMapOrElse;
|
|
|
3334
3355
|
* // Result: Effect.fail("Expected even number, got 5")
|
|
3335
3356
|
* ```
|
|
3336
3357
|
*
|
|
3337
|
-
* @since 2.0.0
|
|
3338
3358
|
* @category Filtering
|
|
3359
|
+
* @since 2.0.0
|
|
3339
3360
|
*/
|
|
3340
3361
|
export const filterOrFail = internal.filterOrFail;
|
|
3341
3362
|
/**
|
|
3342
3363
|
* Filters an effect with a `Filter`, failing when the filter fails.
|
|
3343
3364
|
*
|
|
3344
|
-
* @since 4.0.0
|
|
3345
3365
|
* @category Filtering
|
|
3366
|
+
* @since 4.0.0
|
|
3346
3367
|
*/
|
|
3347
3368
|
export const filterMapOrFail = internal.filterMapOrFail;
|
|
3348
3369
|
// -----------------------------------------------------------------------------
|
|
3349
3370
|
// Conditional Operators
|
|
3350
3371
|
// -----------------------------------------------------------------------------
|
|
3351
3372
|
/**
|
|
3352
|
-
* Conditionally
|
|
3373
|
+
* Conditionally runs an effect based on the result of an effectful boolean
|
|
3374
|
+
* condition.
|
|
3353
3375
|
*
|
|
3354
3376
|
* **Details**
|
|
3355
3377
|
*
|
|
3356
|
-
*
|
|
3357
|
-
*
|
|
3358
|
-
*
|
|
3359
|
-
*
|
|
3378
|
+
* The condition effect is evaluated first. If it succeeds with `true`, the
|
|
3379
|
+
* source effect is run and its success value is wrapped in `Option.some`. If it
|
|
3380
|
+
* succeeds with `false`, the source effect is skipped and the result is
|
|
3381
|
+
* `Option.none`. If the condition effect fails, that failure is preserved.
|
|
3360
3382
|
*
|
|
3361
3383
|
* **When to Use**
|
|
3362
3384
|
*
|
|
3363
|
-
*
|
|
3364
|
-
*
|
|
3365
|
-
*
|
|
3385
|
+
* Use this when an effectful check decides whether to run another effect while
|
|
3386
|
+
* representing the skipped case explicitly.
|
|
3387
|
+
*
|
|
3388
|
+
* **Example** (Usage)
|
|
3366
3389
|
*
|
|
3367
|
-
* @example
|
|
3368
3390
|
* ```ts
|
|
3369
3391
|
* import { Console, Effect } from "effect"
|
|
3370
3392
|
*
|
|
@@ -3383,8 +3405,8 @@ export const filterMapOrFail = internal.filterMapOrFail;
|
|
|
3383
3405
|
* @see {@link whenEffect} for a version that allows the condition to be an effect.
|
|
3384
3406
|
* @see {@link unless} for a version that executes the effect when the condition is `false`.
|
|
3385
3407
|
*
|
|
3386
|
-
* @since 2.0.0
|
|
3387
3408
|
* @category Conditional Operators
|
|
3409
|
+
* @since 2.0.0
|
|
3388
3410
|
*/
|
|
3389
3411
|
export const when = internal.when;
|
|
3390
3412
|
// -----------------------------------------------------------------------------
|
|
@@ -3408,9 +3430,9 @@ export const when = internal.when;
|
|
|
3408
3430
|
*
|
|
3409
3431
|
* @see {@link matchEffect} if you need to perform side effects in the handlers.
|
|
3410
3432
|
*
|
|
3411
|
-
*
|
|
3433
|
+
* **Example** (Handling Both Success and Failure Cases)
|
|
3434
|
+
*
|
|
3412
3435
|
* ```ts
|
|
3413
|
-
* // Title: Handling Both Success and Failure Cases
|
|
3414
3436
|
* import { Data, Effect } from "effect"
|
|
3415
3437
|
*
|
|
3416
3438
|
* class ExampleError extends Data.TaggedError("ExampleError")<{ readonly message: string }> {}
|
|
@@ -3440,8 +3462,8 @@ export const when = internal.when;
|
|
|
3440
3462
|
* // Output: "failure: Uh oh!"
|
|
3441
3463
|
* ```
|
|
3442
3464
|
*
|
|
3443
|
-
* @since 2.0.0
|
|
3444
3465
|
* @category Pattern Matching
|
|
3466
|
+
* @since 2.0.0
|
|
3445
3467
|
*/
|
|
3446
3468
|
export const match = internal.match;
|
|
3447
3469
|
/**
|
|
@@ -3461,7 +3483,8 @@ export const match = internal.match;
|
|
|
3461
3483
|
* optimal performance for resolved effects. This is particularly useful in
|
|
3462
3484
|
* scenarios where you frequently work with already computed values.
|
|
3463
3485
|
*
|
|
3464
|
-
*
|
|
3486
|
+
* **Example** (Usage)
|
|
3487
|
+
*
|
|
3465
3488
|
* ```ts
|
|
3466
3489
|
* import { Effect } from "effect"
|
|
3467
3490
|
*
|
|
@@ -3477,8 +3500,8 @@ export const match = internal.match;
|
|
|
3477
3500
|
* @see {@link match} for the non-eager version.
|
|
3478
3501
|
* @see {@link matchEffect} if you need to perform side effects in the handlers.
|
|
3479
3502
|
*
|
|
3480
|
-
* @since 2.0.0
|
|
3481
3503
|
* @category Pattern Matching
|
|
3504
|
+
* @since 2.0.0
|
|
3482
3505
|
*/
|
|
3483
3506
|
export const matchEager = internal.matchEager;
|
|
3484
3507
|
/**
|
|
@@ -3495,7 +3518,8 @@ export const matchEager = internal.matchEager;
|
|
|
3495
3518
|
* regular failures, defects, or interruptions. You can provide specific
|
|
3496
3519
|
* handling logic for each failure type based on the cause.
|
|
3497
3520
|
*
|
|
3498
|
-
*
|
|
3521
|
+
* **Example** (Usage)
|
|
3522
|
+
*
|
|
3499
3523
|
* ```ts
|
|
3500
3524
|
* import { Cause, Effect } from "effect"
|
|
3501
3525
|
*
|
|
@@ -3514,8 +3538,8 @@ export const matchEager = internal.matchEager;
|
|
|
3514
3538
|
* handlers.
|
|
3515
3539
|
* @see {@link match} if you don't need to handle the cause of the failure.
|
|
3516
3540
|
*
|
|
3517
|
-
* @since 2.0.0
|
|
3518
3541
|
* @category Pattern Matching
|
|
3542
|
+
* @since 2.0.0
|
|
3519
3543
|
*/
|
|
3520
3544
|
export const matchCause = internal.matchCause;
|
|
3521
3545
|
/**
|
|
@@ -3533,7 +3557,8 @@ export const matchCause = internal.matchCause;
|
|
|
3533
3557
|
* and you want to avoid the overhead of the effect pipeline. For pending effects,
|
|
3534
3558
|
* it automatically falls back to the regular `matchCause` behavior.
|
|
3535
3559
|
*
|
|
3536
|
-
*
|
|
3560
|
+
* **Example** (Usage)
|
|
3561
|
+
*
|
|
3537
3562
|
* ```ts
|
|
3538
3563
|
* import { Effect } from "effect"
|
|
3539
3564
|
*
|
|
@@ -3543,8 +3568,8 @@ export const matchCause = internal.matchCause;
|
|
|
3543
3568
|
* })
|
|
3544
3569
|
* ```
|
|
3545
3570
|
*
|
|
3546
|
-
* @since 3.8.0
|
|
3547
3571
|
* @category Pattern Matching
|
|
3572
|
+
* @since 3.8.0
|
|
3548
3573
|
*/
|
|
3549
3574
|
export const matchCauseEager = internal.matchCauseEager;
|
|
3550
3575
|
/**
|
|
@@ -3553,8 +3578,8 @@ export const matchCauseEager = internal.matchCauseEager;
|
|
|
3553
3578
|
* If the effect is an `Exit`, the matching handler runs immediately; otherwise it behaves like
|
|
3554
3579
|
* {@link matchCauseEffect}.
|
|
3555
3580
|
*
|
|
3556
|
-
* @since 4.0.0
|
|
3557
3581
|
* @category Pattern Matching
|
|
3582
|
+
* @since 4.0.0
|
|
3558
3583
|
*/
|
|
3559
3584
|
export const matchCauseEffectEager = internal.matchCauseEffectEager;
|
|
3560
3585
|
/**
|
|
@@ -3569,7 +3594,8 @@ export const matchCauseEffectEager = internal.matchCauseEffectEager;
|
|
|
3569
3594
|
* you to respond accordingly while performing side effects (like logging or
|
|
3570
3595
|
* other operations).
|
|
3571
3596
|
*
|
|
3572
|
-
*
|
|
3597
|
+
* **Example** (Usage)
|
|
3598
|
+
*
|
|
3573
3599
|
* ```ts
|
|
3574
3600
|
* import { Cause, Console, Data, Effect, Result } from "effect"
|
|
3575
3601
|
*
|
|
@@ -3607,30 +3633,29 @@ export const matchCauseEffectEager = internal.matchCauseEffectEager;
|
|
|
3607
3633
|
* @see {@link matchCause} if you don't need side effects and only want to handle the result or failure.
|
|
3608
3634
|
* @see {@link matchEffect} if you don't need to handle the cause of the failure.
|
|
3609
3635
|
*
|
|
3610
|
-
* @since 2.0.0
|
|
3611
3636
|
* @category Pattern Matching
|
|
3637
|
+
* @since 2.0.0
|
|
3612
3638
|
*/
|
|
3613
3639
|
export const matchCauseEffect = internal.matchCauseEffect;
|
|
3614
3640
|
/**
|
|
3615
|
-
* Handles both success and failure
|
|
3616
|
-
* side effects.
|
|
3641
|
+
* Handles both success and failure by running effectful handlers.
|
|
3617
3642
|
*
|
|
3618
3643
|
* **Details**
|
|
3619
3644
|
*
|
|
3620
|
-
*
|
|
3621
|
-
*
|
|
3645
|
+
* Use `matchEffect` when either branch needs to return an `Effect`, such as
|
|
3646
|
+
* performing logging, recovery, notification, or other effectful work. The
|
|
3647
|
+
* returned effect succeeds or fails according to the handler that is run.
|
|
3622
3648
|
*
|
|
3623
3649
|
* **When to Use**
|
|
3624
3650
|
*
|
|
3625
|
-
*
|
|
3626
|
-
* notifying users, based on whether an effect succeeds or fails.
|
|
3651
|
+
* Use this when the failure or success branch must run additional effects.
|
|
3627
3652
|
*
|
|
3628
3653
|
* @see {@link match} if you don't need side effects and only want to handle the
|
|
3629
3654
|
* result or failure.
|
|
3630
3655
|
*
|
|
3631
|
-
*
|
|
3656
|
+
* **Example** (Handling Both Success and Failure Cases with Side Effects)
|
|
3657
|
+
*
|
|
3632
3658
|
* ```ts
|
|
3633
|
-
* // Title: Handling Both Success and Failure Cases with Side Effects
|
|
3634
3659
|
* import { Data, Effect } from "effect"
|
|
3635
3660
|
*
|
|
3636
3661
|
* class ExampleError extends Data.TaggedError("ExampleError")<{ readonly message: string }> {}
|
|
@@ -3669,8 +3694,8 @@ export const matchCauseEffect = internal.matchCauseEffect;
|
|
|
3669
3694
|
* // failure: Uh oh!
|
|
3670
3695
|
* ```
|
|
3671
3696
|
*
|
|
3672
|
-
* @since 2.0.0
|
|
3673
3697
|
* @category Pattern Matching
|
|
3698
|
+
* @since 2.0.0
|
|
3674
3699
|
*/
|
|
3675
3700
|
export const matchEffect = internal.matchEffect;
|
|
3676
3701
|
// -----------------------------------------------------------------------------
|
|
@@ -3681,7 +3706,7 @@ export const matchEffect = internal.matchEffect;
|
|
|
3681
3706
|
*
|
|
3682
3707
|
* Defects are not converted; if the effect dies, the resulting effect dies too.
|
|
3683
3708
|
*
|
|
3684
|
-
* **Example**
|
|
3709
|
+
* **Example** (Checking whether an effect fails)
|
|
3685
3710
|
*
|
|
3686
3711
|
* ```ts
|
|
3687
3712
|
* import { Console, Effect } from "effect"
|
|
@@ -3695,8 +3720,8 @@ export const matchEffect = internal.matchEffect;
|
|
|
3695
3720
|
* // Output: true
|
|
3696
3721
|
* ```
|
|
3697
3722
|
*
|
|
3698
|
-
* @since 2.0.0
|
|
3699
3723
|
* @category Condition Checking
|
|
3724
|
+
* @since 2.0.0
|
|
3700
3725
|
*/
|
|
3701
3726
|
export const isFailure = internal.isFailure;
|
|
3702
3727
|
/**
|
|
@@ -3705,7 +3730,7 @@ export const isFailure = internal.isFailure;
|
|
|
3705
3730
|
* Returns `false` for failures in the error channel, but defects still fail the
|
|
3706
3731
|
* effect.
|
|
3707
3732
|
*
|
|
3708
|
-
* **Example**
|
|
3733
|
+
* **Example** (Checking whether an effect succeeds)
|
|
3709
3734
|
*
|
|
3710
3735
|
* ```ts
|
|
3711
3736
|
* import { Console, Effect } from "effect"
|
|
@@ -3723,8 +3748,8 @@ export const isFailure = internal.isFailure;
|
|
|
3723
3748
|
* // failed: false
|
|
3724
3749
|
* ```
|
|
3725
3750
|
*
|
|
3726
|
-
* @since 2.0.0
|
|
3727
3751
|
* @category Condition Checking
|
|
3752
|
+
* @since 2.0.0
|
|
3728
3753
|
*/
|
|
3729
3754
|
export const isSuccess = internal.isSuccess;
|
|
3730
3755
|
// -----------------------------------------------------------------------------
|
|
@@ -3737,7 +3762,8 @@ export const isSuccess = internal.isSuccess;
|
|
|
3737
3762
|
* in the effect's environment. This can be useful for debugging, introspection,
|
|
3738
3763
|
* or when you need to pass the entire context to another function.
|
|
3739
3764
|
*
|
|
3740
|
-
*
|
|
3765
|
+
* **Example** (Usage)
|
|
3766
|
+
*
|
|
3741
3767
|
* ```ts
|
|
3742
3768
|
* import { Console, Effect, Option, Context } from "effect"
|
|
3743
3769
|
*
|
|
@@ -3765,8 +3791,8 @@ export const isSuccess = internal.isSuccess;
|
|
|
3765
3791
|
* const provided = Effect.provideContext(program, context)
|
|
3766
3792
|
* ```
|
|
3767
3793
|
*
|
|
3768
|
-
* @since 2.0.0
|
|
3769
3794
|
* @category Environment
|
|
3795
|
+
* @since 2.0.0
|
|
3770
3796
|
*/
|
|
3771
3797
|
export const context = internal.context;
|
|
3772
3798
|
/**
|
|
@@ -3776,7 +3802,8 @@ export const context = internal.context;
|
|
|
3776
3802
|
* computations based on all available services. This is useful when you need
|
|
3777
3803
|
* to conditionally execute logic based on what services are available.
|
|
3778
3804
|
*
|
|
3779
|
-
*
|
|
3805
|
+
* **Example** (Usage)
|
|
3806
|
+
*
|
|
3780
3807
|
* ```ts
|
|
3781
3808
|
* import { Console, Effect, Option, Context } from "effect"
|
|
3782
3809
|
*
|
|
@@ -3810,8 +3837,8 @@ export const context = internal.context;
|
|
|
3810
3837
|
* })
|
|
3811
3838
|
* ```
|
|
3812
3839
|
*
|
|
3813
|
-
* @since 2.0.0
|
|
3814
3840
|
* @category Environment
|
|
3841
|
+
* @since 2.0.0
|
|
3815
3842
|
*/
|
|
3816
3843
|
export const contextWith = internal.contextWith;
|
|
3817
3844
|
/**
|
|
@@ -3819,7 +3846,8 @@ export const contextWith = internal.contextWith;
|
|
|
3819
3846
|
* to build the layer every time; by default, layers are shared between provide
|
|
3820
3847
|
* calls.
|
|
3821
3848
|
*
|
|
3822
|
-
*
|
|
3849
|
+
* **Example** (Usage)
|
|
3850
|
+
*
|
|
3823
3851
|
* ```ts
|
|
3824
3852
|
* import { Effect, Layer, Context } from "effect"
|
|
3825
3853
|
*
|
|
@@ -3844,8 +3872,8 @@ export const contextWith = internal.contextWith;
|
|
|
3844
3872
|
* // Output: "Result for: SELECT * FROM users"
|
|
3845
3873
|
* ```
|
|
3846
3874
|
*
|
|
3847
|
-
* @since 2.0.0
|
|
3848
3875
|
* @category Environment
|
|
3876
|
+
* @since 2.0.0
|
|
3849
3877
|
*/
|
|
3850
3878
|
export const provide = internalLayer.provide;
|
|
3851
3879
|
/**
|
|
@@ -3857,7 +3885,8 @@ export const provide = internalLayer.provide;
|
|
|
3857
3885
|
* that contains all the required services. It removes the provided services
|
|
3858
3886
|
* from the effect's requirements, making them available to the effect.
|
|
3859
3887
|
*
|
|
3860
|
-
*
|
|
3888
|
+
* **Example** (Usage)
|
|
3889
|
+
*
|
|
3861
3890
|
* ```ts
|
|
3862
3891
|
* import { Effect, Context } from "effect"
|
|
3863
3892
|
*
|
|
@@ -3884,14 +3913,15 @@ export const provide = internalLayer.provide;
|
|
|
3884
3913
|
* const provided = Effect.provideContext(program, context)
|
|
3885
3914
|
* ```
|
|
3886
3915
|
*
|
|
3887
|
-
* @since 2.0.0
|
|
3888
3916
|
* @category Environment
|
|
3917
|
+
* @since 2.0.0
|
|
3889
3918
|
*/
|
|
3890
3919
|
export const provideContext = internal.provideContext;
|
|
3891
3920
|
/**
|
|
3892
3921
|
* Accesses a service from the context.
|
|
3893
3922
|
*
|
|
3894
|
-
*
|
|
3923
|
+
* **Example** (Usage)
|
|
3924
|
+
*
|
|
3895
3925
|
* ```ts
|
|
3896
3926
|
* import { Effect, Context } from "effect"
|
|
3897
3927
|
*
|
|
@@ -3907,8 +3937,8 @@ export const provideContext = internal.provideContext;
|
|
|
3907
3937
|
* })
|
|
3908
3938
|
* ```
|
|
3909
3939
|
*
|
|
3910
|
-
* @since 4.0.0
|
|
3911
3940
|
* @category Context
|
|
3941
|
+
* @since 4.0.0
|
|
3912
3942
|
*/
|
|
3913
3943
|
export const service = internal.service;
|
|
3914
3944
|
/**
|
|
@@ -3921,7 +3951,8 @@ export const service = internal.service;
|
|
|
3921
3951
|
* available, it returns `None`. Unlike `service`, this function does not
|
|
3922
3952
|
* require the service to be present in the environment.
|
|
3923
3953
|
*
|
|
3924
|
-
*
|
|
3954
|
+
* **Example** (Usage)
|
|
3955
|
+
*
|
|
3925
3956
|
* ```ts
|
|
3926
3957
|
* import { Effect, Option, Context } from "effect"
|
|
3927
3958
|
*
|
|
@@ -3942,8 +3973,8 @@ export const service = internal.service;
|
|
|
3942
3973
|
* })
|
|
3943
3974
|
* ```
|
|
3944
3975
|
*
|
|
3945
|
-
* @since 2.0.0
|
|
3946
3976
|
* @category Context
|
|
3977
|
+
* @since 2.0.0
|
|
3947
3978
|
*/
|
|
3948
3979
|
export const serviceOption = internal.serviceOption;
|
|
3949
3980
|
/**
|
|
@@ -3954,7 +3985,8 @@ export const serviceOption = internal.serviceOption;
|
|
|
3954
3985
|
* This function allows you to transform the context required by an effect,
|
|
3955
3986
|
* providing part of the context and leaving the rest to be fulfilled later.
|
|
3956
3987
|
*
|
|
3957
|
-
*
|
|
3988
|
+
* **Example** (Usage)
|
|
3989
|
+
*
|
|
3958
3990
|
* ```ts
|
|
3959
3991
|
* import { Effect, Context } from "effect"
|
|
3960
3992
|
*
|
|
@@ -3983,14 +4015,19 @@ export const serviceOption = internal.serviceOption;
|
|
|
3983
4015
|
* })
|
|
3984
4016
|
* ```
|
|
3985
4017
|
*
|
|
3986
|
-
* @since 4.0.0
|
|
3987
4018
|
* @category Context
|
|
4019
|
+
* @since 4.0.0
|
|
3988
4020
|
*/
|
|
3989
4021
|
export const updateContext = internal.updateContext;
|
|
3990
4022
|
/**
|
|
3991
|
-
*
|
|
4023
|
+
* Runs an effect with a service implementation transformed by the provided
|
|
4024
|
+
* function.
|
|
4025
|
+
*
|
|
4026
|
+
* The service must be available in the effect's context; `updateService`
|
|
4027
|
+
* replaces it for the wrapped effect with the value returned by the updater.
|
|
4028
|
+
*
|
|
4029
|
+
* **Example** (Usage)
|
|
3992
4030
|
*
|
|
3993
|
-
* @example
|
|
3994
4031
|
* ```ts
|
|
3995
4032
|
* import { Console, Effect, Context } from "effect"
|
|
3996
4033
|
*
|
|
@@ -4012,8 +4049,8 @@ export const updateContext = internal.updateContext;
|
|
|
4012
4049
|
* // 1
|
|
4013
4050
|
* ```
|
|
4014
4051
|
*
|
|
4015
|
-
* @since 2.0.0
|
|
4016
4052
|
* @category Context
|
|
4053
|
+
* @since 2.0.0
|
|
4017
4054
|
*/
|
|
4018
4055
|
export const updateService = internal.updateService;
|
|
4019
4056
|
/**
|
|
@@ -4028,7 +4065,8 @@ export const updateService = internal.updateService;
|
|
|
4028
4065
|
*
|
|
4029
4066
|
* @see {@link provide} for providing multiple layers to an effect.
|
|
4030
4067
|
*
|
|
4031
|
-
*
|
|
4068
|
+
* **Example** (Usage)
|
|
4069
|
+
*
|
|
4032
4070
|
* ```ts
|
|
4033
4071
|
* import { Console, Effect, Context } from "effect"
|
|
4034
4072
|
*
|
|
@@ -4058,21 +4096,22 @@ export const updateService = internal.updateService;
|
|
|
4058
4096
|
* // data
|
|
4059
4097
|
* ```
|
|
4060
4098
|
*
|
|
4061
|
-
* @since 2.0.0
|
|
4062
4099
|
* @category Context
|
|
4100
|
+
* @since 2.0.0
|
|
4063
4101
|
*/
|
|
4064
4102
|
export const provideService = internal.provideService;
|
|
4065
4103
|
/**
|
|
4066
|
-
* Provides
|
|
4067
|
-
*
|
|
4104
|
+
* Provides one service to an effect using an effectful acquisition.
|
|
4105
|
+
*
|
|
4106
|
+
* **Details**
|
|
4107
|
+
*
|
|
4108
|
+
* `provideServiceEffect` runs the acquisition effect to produce the service
|
|
4109
|
+
* implementation, removes that service from the wrapped effect's requirements,
|
|
4110
|
+
* and leaves any other requirements to be provided later. Acquisition failures
|
|
4111
|
+
* are included in the returned effect's error channel.
|
|
4068
4112
|
*
|
|
4069
|
-
*
|
|
4070
|
-
* static service implementation, it allows you to provide an effect that
|
|
4071
|
-
* will produce the service. This is useful when the service needs to be
|
|
4072
|
-
* acquired through an effectful computation (e.g., reading from a database,
|
|
4073
|
-
* making an HTTP request, or allocating resources).
|
|
4113
|
+
* **Example** (Usage)
|
|
4074
4114
|
*
|
|
4075
|
-
* @example
|
|
4076
4115
|
* ```ts
|
|
4077
4116
|
* import { Console, Effect, Context } from "effect"
|
|
4078
4117
|
*
|
|
@@ -4111,8 +4150,8 @@ export const provideService = internal.provideService;
|
|
|
4111
4150
|
* // Result for: SELECT * FROM users
|
|
4112
4151
|
* ```
|
|
4113
4152
|
*
|
|
4114
|
-
* @since 2.0.0
|
|
4115
4153
|
* @category Context
|
|
4154
|
+
* @since 2.0.0
|
|
4116
4155
|
*/
|
|
4117
4156
|
export const provideServiceEffect = internal.provideServiceEffect;
|
|
4118
4157
|
// -----------------------------------------------------------------------------
|
|
@@ -4121,7 +4160,8 @@ export const provideServiceEffect = internal.provideServiceEffect;
|
|
|
4121
4160
|
/**
|
|
4122
4161
|
* Sets the concurrency level for parallel operations within an effect.
|
|
4123
4162
|
*
|
|
4124
|
-
*
|
|
4163
|
+
* **Example** (Usage)
|
|
4164
|
+
*
|
|
4125
4165
|
* ```ts
|
|
4126
4166
|
* import { Console, Effect } from "effect"
|
|
4127
4167
|
*
|
|
@@ -4146,8 +4186,8 @@ export const provideServiceEffect = internal.provideServiceEffect;
|
|
|
4146
4186
|
* // [1, 2, 3, 4, 5]
|
|
4147
4187
|
* ```
|
|
4148
4188
|
*
|
|
4149
|
-
* @since 2.0.0
|
|
4150
4189
|
* @category References
|
|
4190
|
+
* @since 2.0.0
|
|
4151
4191
|
*/
|
|
4152
4192
|
export const withConcurrency = internal.withConcurrency;
|
|
4153
4193
|
// -----------------------------------------------------------------------------
|
|
@@ -4156,7 +4196,8 @@ export const withConcurrency = internal.withConcurrency;
|
|
|
4156
4196
|
/**
|
|
4157
4197
|
* Returns the current scope for resource management.
|
|
4158
4198
|
*
|
|
4159
|
-
*
|
|
4199
|
+
* **Example** (Usage)
|
|
4200
|
+
*
|
|
4160
4201
|
* ```ts
|
|
4161
4202
|
* import { Console, Effect } from "effect"
|
|
4162
4203
|
*
|
|
@@ -4181,8 +4222,8 @@ export const withConcurrency = internal.withConcurrency;
|
|
|
4181
4222
|
* // Releasing resource
|
|
4182
4223
|
* ```
|
|
4183
4224
|
*
|
|
4184
|
-
* @since 2.0.0
|
|
4185
4225
|
* @category Resource Management & Finalization
|
|
4226
|
+
* @since 2.0.0
|
|
4186
4227
|
*/
|
|
4187
4228
|
export const scope = internal.scope;
|
|
4188
4229
|
/**
|
|
@@ -4190,7 +4231,8 @@ export const scope = internal.scope;
|
|
|
4190
4231
|
* ensuring that their finalizers are run as soon as this workflow completes
|
|
4191
4232
|
* execution, whether by success, failure, or interruption.
|
|
4192
4233
|
*
|
|
4193
|
-
*
|
|
4234
|
+
* **Example** (Usage)
|
|
4235
|
+
*
|
|
4194
4236
|
* ```ts
|
|
4195
4237
|
* import { Console, Effect } from "effect"
|
|
4196
4238
|
*
|
|
@@ -4213,14 +4255,15 @@ export const scope = internal.scope;
|
|
|
4213
4255
|
* // Output: "Releasing resource"
|
|
4214
4256
|
* ```
|
|
4215
4257
|
*
|
|
4216
|
-
* @since 2.0.0
|
|
4217
4258
|
* @category Resource Management & Finalization
|
|
4259
|
+
* @since 2.0.0
|
|
4218
4260
|
*/
|
|
4219
4261
|
export const scoped = internal.scoped;
|
|
4220
4262
|
/**
|
|
4221
4263
|
* Creates a scoped effect by providing access to the scope.
|
|
4222
4264
|
*
|
|
4223
|
-
*
|
|
4265
|
+
* **Example** (Usage)
|
|
4266
|
+
*
|
|
4224
4267
|
* ```ts
|
|
4225
4268
|
* import { Console, Effect, Scope } from "effect"
|
|
4226
4269
|
*
|
|
@@ -4252,24 +4295,25 @@ export const scoped = internal.scoped;
|
|
|
4252
4295
|
* // Manual finalizer
|
|
4253
4296
|
* ```
|
|
4254
4297
|
*
|
|
4255
|
-
* @since 2.0.0
|
|
4256
4298
|
* @category Resource Management & Finalization
|
|
4299
|
+
* @since 2.0.0
|
|
4257
4300
|
*/
|
|
4258
4301
|
export const scopedWith = internal.scopedWith;
|
|
4259
4302
|
/**
|
|
4260
|
-
*
|
|
4261
|
-
*
|
|
4303
|
+
* Constructs a scoped resource from an acquisition effect and a release
|
|
4304
|
+
* finalizer.
|
|
4305
|
+
*
|
|
4306
|
+
* **Details**
|
|
4262
4307
|
*
|
|
4263
|
-
* If the
|
|
4264
|
-
*
|
|
4265
|
-
*
|
|
4266
|
-
* is closed.
|
|
4308
|
+
* If acquisition succeeds, the release finalizer is added to the current scope
|
|
4309
|
+
* and is guaranteed to run when that scope closes. The finalizer receives the
|
|
4310
|
+
* `Exit` value used to close the scope.
|
|
4267
4311
|
*
|
|
4268
|
-
*
|
|
4269
|
-
*
|
|
4270
|
-
*
|
|
4312
|
+
* By default, acquisition is protected by an uninterruptible region. Pass
|
|
4313
|
+
* `{ interruptible: true }` to allow the acquisition effect to be interrupted.
|
|
4314
|
+
*
|
|
4315
|
+
* **Example** (Usage)
|
|
4271
4316
|
*
|
|
4272
|
-
* @example
|
|
4273
4317
|
* ```ts
|
|
4274
4318
|
* import { Console, Effect, Exit } from "effect"
|
|
4275
4319
|
*
|
|
@@ -4306,8 +4350,8 @@ export const scopedWith = internal.scopedWith;
|
|
|
4306
4350
|
* )
|
|
4307
4351
|
* ```
|
|
4308
4352
|
*
|
|
4309
|
-
* @since 2.0.0
|
|
4310
4353
|
* @category Resource Management & Finalization
|
|
4354
|
+
* @since 2.0.0
|
|
4311
4355
|
*/
|
|
4312
4356
|
export const acquireRelease = internal.acquireRelease;
|
|
4313
4357
|
/**
|
|
@@ -4325,7 +4369,8 @@ export const acquireRelease = internal.acquireRelease;
|
|
|
4325
4369
|
*
|
|
4326
4370
|
* @see {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/using}
|
|
4327
4371
|
*
|
|
4328
|
-
*
|
|
4372
|
+
* **Example** (Usage)
|
|
4373
|
+
*
|
|
4329
4374
|
* ```ts
|
|
4330
4375
|
* import sqlite from "node:sqlite";
|
|
4331
4376
|
* import { Effect } from "effect";
|
|
@@ -4344,8 +4389,8 @@ export const acquireRelease = internal.acquireRelease;
|
|
|
4344
4389
|
* )
|
|
4345
4390
|
* ```
|
|
4346
4391
|
*
|
|
4347
|
-
* @since 4.0.0
|
|
4348
4392
|
* @category Resource Management & Finalization
|
|
4393
|
+
* @since 4.0.0
|
|
4349
4394
|
*/
|
|
4350
4395
|
export const acquireDisposable = internal.acquireDisposable;
|
|
4351
4396
|
/**
|
|
@@ -4371,7 +4416,8 @@ export const acquireDisposable = internal.acquireDisposable;
|
|
|
4371
4416
|
* is not desired, errors produced by the `release` `Effect` value can be caught
|
|
4372
4417
|
* and ignored.
|
|
4373
4418
|
*
|
|
4374
|
-
*
|
|
4419
|
+
* **Example** (Usage)
|
|
4420
|
+
*
|
|
4375
4421
|
* ```ts
|
|
4376
4422
|
* import { Console, Effect, Exit } from "effect"
|
|
4377
4423
|
*
|
|
@@ -4416,8 +4462,8 @@ export const acquireDisposable = internal.acquireDisposable;
|
|
|
4416
4462
|
* // Closing connection to db://localhost:5432 (success)
|
|
4417
4463
|
* ```
|
|
4418
4464
|
*
|
|
4419
|
-
* @since 2.0.0
|
|
4420
4465
|
* @category Resource Management & Finalization
|
|
4466
|
+
* @since 2.0.0
|
|
4421
4467
|
*/
|
|
4422
4468
|
export const acquireUseRelease = internal.acquireUseRelease;
|
|
4423
4469
|
/**
|
|
@@ -4429,7 +4475,8 @@ export const acquireUseRelease = internal.acquireUseRelease;
|
|
|
4429
4475
|
* whether the effect succeeds or fails. They're commonly used for resource
|
|
4430
4476
|
* cleanup, logging, or other side effects that should always occur.
|
|
4431
4477
|
*
|
|
4432
|
-
*
|
|
4478
|
+
* **Example** (Usage)
|
|
4479
|
+
*
|
|
4433
4480
|
* ```ts
|
|
4434
4481
|
* import { Console, Effect, Exit } from "effect"
|
|
4435
4482
|
*
|
|
@@ -4458,8 +4505,8 @@ export const acquireUseRelease = internal.acquireUseRelease;
|
|
|
4458
4505
|
* // operation result
|
|
4459
4506
|
* ```
|
|
4460
4507
|
*
|
|
4461
|
-
* @since 2.0.0
|
|
4462
4508
|
* @category Resource Management & Finalization
|
|
4509
|
+
* @since 2.0.0
|
|
4463
4510
|
*/
|
|
4464
4511
|
export const addFinalizer = internal.addFinalizer;
|
|
4465
4512
|
/**
|
|
@@ -4473,7 +4520,8 @@ export const addFinalizer = internal.addFinalizer;
|
|
|
4473
4520
|
* should generally not be used for releasing resources. For higher-level
|
|
4474
4521
|
* logic built on `ensuring`, see the `acquireRelease` family of methods.
|
|
4475
4522
|
*
|
|
4476
|
-
*
|
|
4523
|
+
* **Example** (Usage)
|
|
4524
|
+
*
|
|
4477
4525
|
* ```ts
|
|
4478
4526
|
* import { Console, Effect } from "effect"
|
|
4479
4527
|
*
|
|
@@ -4498,15 +4546,16 @@ export const addFinalizer = internal.addFinalizer;
|
|
|
4498
4546
|
* // 42
|
|
4499
4547
|
* ```
|
|
4500
4548
|
*
|
|
4501
|
-
* @since 2.0.0
|
|
4502
4549
|
* @category Resource Management & Finalization
|
|
4550
|
+
* @since 2.0.0
|
|
4503
4551
|
*/
|
|
4504
4552
|
export const ensuring = internal.ensuring;
|
|
4505
4553
|
/**
|
|
4506
4554
|
* Runs the specified effect if this effect fails, providing the error to the
|
|
4507
4555
|
* effect if it exists. The provided effect will not be interrupted.
|
|
4508
4556
|
*
|
|
4509
|
-
*
|
|
4557
|
+
* **Example** (Usage)
|
|
4558
|
+
*
|
|
4510
4559
|
* ```ts
|
|
4511
4560
|
* import { Cause, Data, Console, Effect } from "effect"
|
|
4512
4561
|
*
|
|
@@ -4525,15 +4574,16 @@ export const ensuring = internal.ensuring;
|
|
|
4525
4574
|
* // TaskError: Something went wrong
|
|
4526
4575
|
* ```
|
|
4527
4576
|
*
|
|
4528
|
-
* @since 2.0.0
|
|
4529
4577
|
* @category Resource Management & Finalization
|
|
4578
|
+
* @since 2.0.0
|
|
4530
4579
|
*/
|
|
4531
4580
|
export const onError = internal.onError;
|
|
4532
4581
|
/**
|
|
4533
4582
|
* Runs the finalizer only when this effect fails and the `Cause` matches the
|
|
4534
4583
|
* provided predicate.
|
|
4535
4584
|
*
|
|
4536
|
-
*
|
|
4585
|
+
* **Example** (Usage)
|
|
4586
|
+
*
|
|
4537
4587
|
* ```ts
|
|
4538
4588
|
* import { Cause, Console, Effect } from "effect"
|
|
4539
4589
|
*
|
|
@@ -4549,31 +4599,36 @@ export const onError = internal.onError;
|
|
|
4549
4599
|
* )
|
|
4550
4600
|
* ```
|
|
4551
4601
|
*
|
|
4552
|
-
* @since 4.0.0
|
|
4553
4602
|
* @category Resource Management & Finalization
|
|
4603
|
+
* @since 4.0.0
|
|
4554
4604
|
*/
|
|
4555
4605
|
export const onErrorIf = internal.onErrorIf;
|
|
4556
4606
|
/**
|
|
4557
4607
|
* Runs the finalizer only when this effect fails and the cause matches the provided `Filter`.
|
|
4558
4608
|
*
|
|
4559
|
-
* @since 4.0.0
|
|
4560
4609
|
* @category Resource Management & Finalization
|
|
4610
|
+
* @since 4.0.0
|
|
4561
4611
|
*/
|
|
4562
4612
|
export const onErrorFilter = internal.onErrorFilter;
|
|
4563
4613
|
/**
|
|
4564
|
-
*
|
|
4565
|
-
*
|
|
4566
|
-
*
|
|
4614
|
+
* Runs an optional finalizer with the effect's `Exit` value when the effect
|
|
4615
|
+
* completes.
|
|
4616
|
+
*
|
|
4617
|
+
* **Details**
|
|
4618
|
+
*
|
|
4619
|
+
* This low-level operator preserves the source effect's result unless the
|
|
4620
|
+
* finalizer fails. Prefer `onExit` for normal cleanup logic.
|
|
4567
4621
|
*
|
|
4568
|
-
* @since 2.0.0
|
|
4569
4622
|
* @category Resource Management & Finalization
|
|
4623
|
+
* @since 2.0.0
|
|
4570
4624
|
*/
|
|
4571
4625
|
export const onExitPrimitive = internal.onExitPrimitive;
|
|
4572
4626
|
/**
|
|
4573
4627
|
* Ensures that a cleanup functions runs, whether this effect succeeds, fails,
|
|
4574
4628
|
* or is interrupted.
|
|
4575
4629
|
*
|
|
4576
|
-
*
|
|
4630
|
+
* **Example** (Usage)
|
|
4631
|
+
*
|
|
4577
4632
|
* ```ts
|
|
4578
4633
|
* import { Console, Effect, Exit } from "effect"
|
|
4579
4634
|
*
|
|
@@ -4592,15 +4647,16 @@ export const onExitPrimitive = internal.onExitPrimitive;
|
|
|
4592
4647
|
* // 42
|
|
4593
4648
|
* ```
|
|
4594
4649
|
*
|
|
4595
|
-
* @since 2.0.0
|
|
4596
4650
|
* @category Resource Management & Finalization
|
|
4651
|
+
* @since 2.0.0
|
|
4597
4652
|
*/
|
|
4598
4653
|
export const onExit = internal.onExit;
|
|
4599
4654
|
/**
|
|
4600
4655
|
* Runs the cleanup effect only when the `Exit` satisfies the provided
|
|
4601
4656
|
* predicate.
|
|
4602
4657
|
*
|
|
4603
|
-
*
|
|
4658
|
+
* **Example** (Usage)
|
|
4659
|
+
*
|
|
4604
4660
|
* ```ts
|
|
4605
4661
|
* import { Console, Effect, Exit } from "effect"
|
|
4606
4662
|
*
|
|
@@ -4614,15 +4670,15 @@ export const onExit = internal.onExit;
|
|
|
4614
4670
|
* )
|
|
4615
4671
|
* ```
|
|
4616
4672
|
*
|
|
4617
|
-
* @since 4.0.0
|
|
4618
4673
|
* @category Resource Management & Finalization
|
|
4674
|
+
* @since 4.0.0
|
|
4619
4675
|
*/
|
|
4620
4676
|
export const onExitIf = internal.onExitIf;
|
|
4621
4677
|
/**
|
|
4622
4678
|
* Runs the cleanup effect only when the `Exit` matches the provided `Filter`.
|
|
4623
4679
|
*
|
|
4624
|
-
* @since 4.0.0
|
|
4625
4680
|
* @category Resource Management & Finalization
|
|
4681
|
+
* @since 4.0.0
|
|
4626
4682
|
*/
|
|
4627
4683
|
export const onExitFilter = internal.onExitFilter;
|
|
4628
4684
|
// -----------------------------------------------------------------------------
|
|
@@ -4651,7 +4707,8 @@ export const onExitFilter = internal.onExitFilter;
|
|
|
4651
4707
|
* @see {@link cachedInvalidateWithTTL} for a similar function that includes an
|
|
4652
4708
|
* additional effect for manually invalidating the cached value.
|
|
4653
4709
|
*
|
|
4654
|
-
*
|
|
4710
|
+
* **Example** (Usage)
|
|
4711
|
+
*
|
|
4655
4712
|
* ```ts
|
|
4656
4713
|
* import { Console, Effect } from "effect"
|
|
4657
4714
|
*
|
|
@@ -4688,8 +4745,8 @@ export const onExitFilter = internal.onExitFilter;
|
|
|
4688
4745
|
* // result 3
|
|
4689
4746
|
* ```
|
|
4690
4747
|
*
|
|
4691
|
-
* @since 2.0.0
|
|
4692
4748
|
* @category Caching
|
|
4749
|
+
* @since 2.0.0
|
|
4693
4750
|
*/
|
|
4694
4751
|
export const cached = internal.cached;
|
|
4695
4752
|
/**
|
|
@@ -4724,7 +4781,8 @@ export const cached = internal.cached;
|
|
|
4724
4781
|
* @see {@link cachedInvalidateWithTTL} for a similar function that includes an
|
|
4725
4782
|
* additional effect for manually invalidating the cached value.
|
|
4726
4783
|
*
|
|
4727
|
-
*
|
|
4784
|
+
* **Example** (Usage)
|
|
4785
|
+
*
|
|
4728
4786
|
* ```ts
|
|
4729
4787
|
* import { Console, Effect } from "effect"
|
|
4730
4788
|
*
|
|
@@ -4755,8 +4813,8 @@ export const cached = internal.cached;
|
|
|
4755
4813
|
* // result 2
|
|
4756
4814
|
* ```
|
|
4757
4815
|
*
|
|
4758
|
-
* @since 2.0.0
|
|
4759
4816
|
* @category Caching
|
|
4817
|
+
* @since 2.0.0
|
|
4760
4818
|
*/
|
|
4761
4819
|
export const cachedWithTTL = internal.cachedWithTTL;
|
|
4762
4820
|
/**
|
|
@@ -4791,7 +4849,8 @@ export const cachedWithTTL = internal.cachedWithTTL;
|
|
|
4791
4849
|
* @see {@link cachedWithTTL} for a similar function that caches the result for
|
|
4792
4850
|
* a specified duration but does not include an effect for manual invalidation.
|
|
4793
4851
|
*
|
|
4794
|
-
*
|
|
4852
|
+
* **Example** (Usage)
|
|
4853
|
+
*
|
|
4795
4854
|
* ```ts
|
|
4796
4855
|
* import { Console, Effect } from "effect"
|
|
4797
4856
|
*
|
|
@@ -4825,8 +4884,8 @@ export const cachedWithTTL = internal.cachedWithTTL;
|
|
|
4825
4884
|
* // result 2
|
|
4826
4885
|
* ```
|
|
4827
4886
|
*
|
|
4828
|
-
* @since 2.0.0
|
|
4829
4887
|
* @category Caching
|
|
4888
|
+
* @since 2.0.0
|
|
4830
4889
|
*/
|
|
4831
4890
|
export const cachedInvalidateWithTTL = internal.cachedInvalidateWithTTL;
|
|
4832
4891
|
// -----------------------------------------------------------------------------
|
|
@@ -4835,7 +4894,8 @@ export const cachedInvalidateWithTTL = internal.cachedInvalidateWithTTL;
|
|
|
4835
4894
|
/**
|
|
4836
4895
|
* Returns an effect that is immediately interrupted.
|
|
4837
4896
|
*
|
|
4838
|
-
*
|
|
4897
|
+
* **Example** (Usage)
|
|
4898
|
+
*
|
|
4839
4899
|
* ```ts
|
|
4840
4900
|
* import { Effect } from "effect"
|
|
4841
4901
|
*
|
|
@@ -4848,14 +4908,15 @@ export const cachedInvalidateWithTTL = internal.cachedInvalidateWithTTL;
|
|
|
4848
4908
|
* // Throws: InterruptedException
|
|
4849
4909
|
* ```
|
|
4850
4910
|
*
|
|
4851
|
-
* @since 2.0.0
|
|
4852
4911
|
* @category Interruption
|
|
4912
|
+
* @since 2.0.0
|
|
4853
4913
|
*/
|
|
4854
4914
|
export const interrupt = internal.interrupt;
|
|
4855
4915
|
/**
|
|
4856
4916
|
* Returns a new effect that allows the effect to be interruptible.
|
|
4857
4917
|
*
|
|
4858
|
-
*
|
|
4918
|
+
* **Example** (Usage)
|
|
4919
|
+
*
|
|
4859
4920
|
* ```ts
|
|
4860
4921
|
* import { Effect } from "effect"
|
|
4861
4922
|
*
|
|
@@ -4868,14 +4929,15 @@ export const interrupt = internal.interrupt;
|
|
|
4868
4929
|
* // Later: fiber.interrupt()
|
|
4869
4930
|
* ```
|
|
4870
4931
|
*
|
|
4871
|
-
* @since 2.0.0
|
|
4872
4932
|
* @category Interruption
|
|
4933
|
+
* @since 2.0.0
|
|
4873
4934
|
*/
|
|
4874
4935
|
export const interruptible = internal.interruptible;
|
|
4875
4936
|
/**
|
|
4876
4937
|
* Runs the specified finalizer effect if this effect is interrupted.
|
|
4877
4938
|
*
|
|
4878
|
-
*
|
|
4939
|
+
* **Example** (Usage)
|
|
4940
|
+
*
|
|
4879
4941
|
* ```ts
|
|
4880
4942
|
* import { Console, Effect, Fiber } from "effect"
|
|
4881
4943
|
*
|
|
@@ -4892,14 +4954,15 @@ export const interruptible = internal.interruptible;
|
|
|
4892
4954
|
* // Output: Task was interrupted, cleaning up...
|
|
4893
4955
|
* ```
|
|
4894
4956
|
*
|
|
4895
|
-
* @since 2.0.0
|
|
4896
4957
|
* @category Interruption
|
|
4958
|
+
* @since 2.0.0
|
|
4897
4959
|
*/
|
|
4898
4960
|
export const onInterrupt = internal.onInterrupt;
|
|
4899
4961
|
/**
|
|
4900
4962
|
* Returns a new effect that disables interruption for the given effect.
|
|
4901
4963
|
*
|
|
4902
|
-
*
|
|
4964
|
+
* **Example** (Usage)
|
|
4965
|
+
*
|
|
4903
4966
|
* ```ts
|
|
4904
4967
|
* import { Console, Effect, Fiber } from "effect"
|
|
4905
4968
|
*
|
|
@@ -4916,15 +4979,16 @@ export const onInterrupt = internal.onInterrupt;
|
|
|
4916
4979
|
* Effect.runPromise(Fiber.interrupt(fiber))
|
|
4917
4980
|
* ```
|
|
4918
4981
|
*
|
|
4919
|
-
* @since 2.0.0
|
|
4920
4982
|
* @category Interruption
|
|
4983
|
+
* @since 2.0.0
|
|
4921
4984
|
*/
|
|
4922
4985
|
export const uninterruptible = internal.uninterruptible;
|
|
4923
4986
|
/**
|
|
4924
4987
|
* Disables interruption and provides a restore function to restore the
|
|
4925
4988
|
* interruptible state within the effect.
|
|
4926
4989
|
*
|
|
4927
|
-
*
|
|
4990
|
+
* **Example** (Usage)
|
|
4991
|
+
*
|
|
4928
4992
|
* ```ts
|
|
4929
4993
|
* import { Console, Effect } from "effect"
|
|
4930
4994
|
*
|
|
@@ -4946,8 +5010,8 @@ export const uninterruptible = internal.uninterruptible;
|
|
|
4946
5010
|
* )
|
|
4947
5011
|
* ```
|
|
4948
5012
|
*
|
|
4949
|
-
* @since 2.0.0
|
|
4950
5013
|
* @category Interruption
|
|
5014
|
+
* @since 2.0.0
|
|
4951
5015
|
*/
|
|
4952
5016
|
export const uninterruptibleMask = internal.uninterruptibleMask;
|
|
4953
5017
|
/**
|
|
@@ -4955,7 +5019,8 @@ export const uninterruptibleMask = internal.uninterruptibleMask;
|
|
|
4955
5019
|
* `restore` function. This function can be used to restore the interruptibility
|
|
4956
5020
|
* of any specific region of code.
|
|
4957
5021
|
*
|
|
4958
|
-
*
|
|
5022
|
+
* **Example** (Usage)
|
|
5023
|
+
*
|
|
4959
5024
|
* ```ts
|
|
4960
5025
|
* import { Console, Effect } from "effect"
|
|
4961
5026
|
*
|
|
@@ -4977,21 +5042,22 @@ export const uninterruptibleMask = internal.uninterruptibleMask;
|
|
|
4977
5042
|
* )
|
|
4978
5043
|
* ```
|
|
4979
5044
|
*
|
|
4980
|
-
* @since 2.0.0
|
|
4981
5045
|
* @category Interruption
|
|
5046
|
+
* @since 2.0.0
|
|
4982
5047
|
*/
|
|
4983
5048
|
export const interruptibleMask = internal.interruptibleMask;
|
|
4984
5049
|
/**
|
|
4985
5050
|
* Creates an AbortSignal that is managed by the provided scope.
|
|
4986
5051
|
*
|
|
4987
|
-
* @since 4.0.0
|
|
4988
5052
|
* @category Interruption
|
|
5053
|
+
* @since 4.0.0
|
|
4989
5054
|
*/
|
|
4990
5055
|
export const abortSignal = internal.abortSignal;
|
|
4991
5056
|
/**
|
|
4992
5057
|
* Repeats this effect forever (until the first error).
|
|
4993
5058
|
*
|
|
4994
|
-
*
|
|
5059
|
+
* **Example** (Usage)
|
|
5060
|
+
*
|
|
4995
5061
|
* ```ts
|
|
4996
5062
|
* import { Console, Effect, Fiber } from "effect"
|
|
4997
5063
|
*
|
|
@@ -5014,8 +5080,8 @@ export const abortSignal = internal.abortSignal;
|
|
|
5014
5080
|
* })
|
|
5015
5081
|
* ```
|
|
5016
5082
|
*
|
|
5017
|
-
* @since 2.0.0
|
|
5018
5083
|
* @category Repetition / Recursion
|
|
5084
|
+
* @since 2.0.0
|
|
5019
5085
|
*/
|
|
5020
5086
|
export const forever = internal.forever;
|
|
5021
5087
|
/**
|
|
@@ -5040,7 +5106,8 @@ export const forever = internal.forever;
|
|
|
5040
5106
|
* delays, limiting recursions, or dynamically adjusting based on the outcome of
|
|
5041
5107
|
* each execution.
|
|
5042
5108
|
*
|
|
5043
|
-
*
|
|
5109
|
+
* **Example** (Usage)
|
|
5110
|
+
*
|
|
5044
5111
|
* ```ts
|
|
5045
5112
|
* // Success Example
|
|
5046
5113
|
* import { Effect } from "effect"
|
|
@@ -5054,7 +5121,9 @@ export const forever = internal.forever;
|
|
|
5054
5121
|
* // Effect.runPromise(program).then((n) => console.log(`repetitions: ${n}`))
|
|
5055
5122
|
* ```
|
|
5056
5123
|
*
|
|
5057
|
-
*
|
|
5124
|
+
* **Example** (Usage)
|
|
5125
|
+
*
|
|
5126
|
+
* ```ts
|
|
5058
5127
|
* // Failure Example
|
|
5059
5128
|
* import { Effect } from "effect"
|
|
5060
5129
|
* import { Schedule } from "effect"
|
|
@@ -5077,30 +5146,25 @@ export const forever = internal.forever;
|
|
|
5077
5146
|
* const program = Effect.repeat(action, policy)
|
|
5078
5147
|
*
|
|
5079
5148
|
* // Effect.runPromiseExit(program).then(console.log)
|
|
5149
|
+
* ```
|
|
5080
5150
|
*
|
|
5081
|
-
* @since 2.0.0
|
|
5082
5151
|
* @category Repetition / Recursion
|
|
5152
|
+
* @since 2.0.0
|
|
5083
5153
|
*/
|
|
5084
5154
|
export const repeat = internalSchedule.repeat;
|
|
5085
5155
|
/**
|
|
5086
|
-
* Repeats an effect
|
|
5156
|
+
* Repeats an effect according to a schedule and runs a fallback effect if
|
|
5157
|
+
* repetition fails before the schedule completes.
|
|
5087
5158
|
*
|
|
5088
5159
|
* **Details**
|
|
5089
5160
|
*
|
|
5090
|
-
*
|
|
5091
|
-
*
|
|
5092
|
-
*
|
|
5093
|
-
*
|
|
5094
|
-
* schedule will never be executed and the output provided to the handler will
|
|
5095
|
-
* be `None`. This enables advanced error recovery or alternative fallback logic
|
|
5096
|
-
* while maintaining flexibility in how repetitions are handled.
|
|
5161
|
+
* If the repeated effect or schedule step fails, `orElse` receives the failure
|
|
5162
|
+
* and the latest schedule metadata when at least one schedule step has run;
|
|
5163
|
+
* otherwise it receives `None`. If the schedule completes normally, the
|
|
5164
|
+
* returned effect succeeds with the schedule's output.
|
|
5097
5165
|
*
|
|
5098
|
-
*
|
|
5099
|
-
* repetitions after the initial execution, provided the effect succeeds. If a
|
|
5100
|
-
* failure occurs during any iteration, the failure handler is invoked to handle
|
|
5101
|
-
* the situation.
|
|
5166
|
+
* **Example** (Usage)
|
|
5102
5167
|
*
|
|
5103
|
-
* @example
|
|
5104
5168
|
* ```ts
|
|
5105
5169
|
* import { Console, Effect, Schedule } from "effect"
|
|
5106
5170
|
* import * as Option from "effect/Option"
|
|
@@ -5128,8 +5192,8 @@ export const repeat = internalSchedule.repeat;
|
|
|
5128
5192
|
* )
|
|
5129
5193
|
* ```
|
|
5130
5194
|
*
|
|
5131
|
-
* @since 2.0.0
|
|
5132
5195
|
* @category Repetition / Recursion
|
|
5196
|
+
* @since 2.0.0
|
|
5133
5197
|
*/
|
|
5134
5198
|
export const repeatOrElse = internalSchedule.repeatOrElse;
|
|
5135
5199
|
/**
|
|
@@ -5137,8 +5201,8 @@ export const repeatOrElse = internalSchedule.repeatOrElse;
|
|
|
5137
5201
|
*
|
|
5138
5202
|
* Use with `Effect.all` to run the replicated effects and collect results.
|
|
5139
5203
|
*
|
|
5140
|
-
* @since 2.0.0
|
|
5141
5204
|
* @category Collecting
|
|
5205
|
+
* @since 2.0.0
|
|
5142
5206
|
*/
|
|
5143
5207
|
export const replicate = internal.replicate;
|
|
5144
5208
|
/**
|
|
@@ -5146,7 +5210,8 @@ export const replicate = internal.replicate;
|
|
|
5146
5210
|
*
|
|
5147
5211
|
* Use `concurrency` to control parallelism and `discard: true` to ignore results.
|
|
5148
5212
|
*
|
|
5149
|
-
*
|
|
5213
|
+
* **Example** (Usage)
|
|
5214
|
+
*
|
|
5150
5215
|
* ```ts
|
|
5151
5216
|
* import { Console, Effect } from "effect"
|
|
5152
5217
|
*
|
|
@@ -5156,27 +5221,24 @@ export const replicate = internal.replicate;
|
|
|
5156
5221
|
* })
|
|
5157
5222
|
* ```
|
|
5158
5223
|
*
|
|
5159
|
-
* @since 2.0.0
|
|
5160
5224
|
* @category Collecting
|
|
5225
|
+
* @since 2.0.0
|
|
5161
5226
|
*/
|
|
5162
5227
|
export const replicateEffect = internal.replicateEffect;
|
|
5163
5228
|
/**
|
|
5164
|
-
*
|
|
5229
|
+
* Runs an effect repeatedly according to a schedule and returns the schedule's
|
|
5230
|
+
* final output.
|
|
5165
5231
|
*
|
|
5166
5232
|
* **Details**
|
|
5167
5233
|
*
|
|
5168
|
-
*
|
|
5169
|
-
*
|
|
5170
|
-
*
|
|
5171
|
-
*
|
|
5172
|
-
*
|
|
5234
|
+
* The schedule is first stepped with `undefined`. After each successful
|
|
5235
|
+
* execution, the effect's success value is fed to the schedule to decide
|
|
5236
|
+
* whether to run again. The returned effect fails if the effect or schedule
|
|
5237
|
+
* fails, and otherwise succeeds with the schedule output when the schedule
|
|
5238
|
+
* completes.
|
|
5173
5239
|
*
|
|
5174
|
-
*
|
|
5175
|
-
* adds delays between repetitions, or customizes repetition behavior based on
|
|
5176
|
-
* external inputs. The effect runs initially and is repeated according to the
|
|
5177
|
-
* schedule.
|
|
5240
|
+
* **Example** (Usage)
|
|
5178
5241
|
*
|
|
5179
|
-
* @example
|
|
5180
5242
|
* ```ts
|
|
5181
5243
|
* import { Console, Effect, Schedule } from "effect"
|
|
5182
5244
|
*
|
|
@@ -5202,26 +5264,24 @@ export const replicateEffect = internal.replicateEffect;
|
|
|
5202
5264
|
* @see {@link scheduleFrom} for a variant that allows the schedule's decision
|
|
5203
5265
|
* to depend on the result of this effect.
|
|
5204
5266
|
*
|
|
5205
|
-
* @since 2.0.0
|
|
5206
5267
|
* @category Repetition / Recursion
|
|
5268
|
+
* @since 2.0.0
|
|
5207
5269
|
*/
|
|
5208
5270
|
export const schedule = /*#__PURE__*/dual(2, (self, schedule) => scheduleFrom(self, undefined, schedule));
|
|
5209
5271
|
/**
|
|
5210
|
-
* Runs an effect repeatedly according to a schedule
|
|
5211
|
-
*
|
|
5272
|
+
* Runs an effect repeatedly according to a schedule that is initialized with a
|
|
5273
|
+
* specific schedule input.
|
|
5212
5274
|
*
|
|
5213
5275
|
* **Details**
|
|
5214
5276
|
*
|
|
5215
|
-
*
|
|
5216
|
-
*
|
|
5217
|
-
* the
|
|
5218
|
-
* the schedule
|
|
5219
|
-
*
|
|
5277
|
+
* `initial` is passed to the schedule before the first execution, not to the
|
|
5278
|
+
* effect itself. After each successful execution, the effect's success value is
|
|
5279
|
+
* fed back into the schedule to decide whether to continue. The returned effect
|
|
5280
|
+
* succeeds with the schedule output when the schedule completes and fails if
|
|
5281
|
+
* the effect or schedule fails.
|
|
5220
5282
|
*
|
|
5221
|
-
*
|
|
5222
|
-
* propagating the error.
|
|
5283
|
+
* **Example** (Usage)
|
|
5223
5284
|
*
|
|
5224
|
-
* @example
|
|
5225
5285
|
* ```ts
|
|
5226
5286
|
* import { Console, Effect, Schedule } from "effect"
|
|
5227
5287
|
*
|
|
@@ -5242,8 +5302,8 @@ export const schedule = /*#__PURE__*/dual(2, (self, schedule) => scheduleFrom(se
|
|
|
5242
5302
|
* // Returns the schedule count
|
|
5243
5303
|
* ```
|
|
5244
5304
|
*
|
|
5245
|
-
* @since 2.0.0
|
|
5246
5305
|
* @category Repetition / Recursion
|
|
5306
|
+
* @since 2.0.0
|
|
5247
5307
|
*/
|
|
5248
5308
|
export const scheduleFrom = internalSchedule.scheduleFrom;
|
|
5249
5309
|
// -----------------------------------------------------------------------------
|
|
@@ -5252,7 +5312,8 @@ export const scheduleFrom = internalSchedule.scheduleFrom;
|
|
|
5252
5312
|
/**
|
|
5253
5313
|
* Returns the current tracer from the context.
|
|
5254
5314
|
*
|
|
5255
|
-
*
|
|
5315
|
+
* **Example** (Usage)
|
|
5316
|
+
*
|
|
5256
5317
|
* ```ts
|
|
5257
5318
|
* import { Effect } from "effect"
|
|
5258
5319
|
*
|
|
@@ -5263,14 +5324,15 @@ export const scheduleFrom = internalSchedule.scheduleFrom;
|
|
|
5263
5324
|
* })
|
|
5264
5325
|
* ```
|
|
5265
5326
|
*
|
|
5266
|
-
* @since 2.0.0
|
|
5267
5327
|
* @category Tracing
|
|
5328
|
+
* @since 2.0.0
|
|
5268
5329
|
*/
|
|
5269
5330
|
export const tracer = internal.tracer;
|
|
5270
5331
|
/**
|
|
5271
5332
|
* Provides a tracer to an effect.
|
|
5272
5333
|
*
|
|
5273
|
-
*
|
|
5334
|
+
* **Example** (Usage)
|
|
5335
|
+
*
|
|
5274
5336
|
* ```ts
|
|
5275
5337
|
* import { Effect } from "effect"
|
|
5276
5338
|
*
|
|
@@ -5283,14 +5345,20 @@ export const tracer = internal.tracer;
|
|
|
5283
5345
|
* // const traced = Effect.withTracer(program, customTracer)
|
|
5284
5346
|
* ```
|
|
5285
5347
|
*
|
|
5286
|
-
* @since 2.0.0
|
|
5287
5348
|
* @category Tracing
|
|
5349
|
+
* @since 2.0.0
|
|
5288
5350
|
*/
|
|
5289
5351
|
export const withTracer = internal.withTracer;
|
|
5290
5352
|
/**
|
|
5291
|
-
*
|
|
5353
|
+
* Enables or disables tracing for spans created by the given effect.
|
|
5354
|
+
*
|
|
5355
|
+
* **Details**
|
|
5356
|
+
*
|
|
5357
|
+
* When `enabled` is `false`, spans created inside the effect are not registered
|
|
5358
|
+
* with the current tracer and do not propagate as normal trace parents.
|
|
5359
|
+
*
|
|
5360
|
+
* **Example** (Usage)
|
|
5292
5361
|
*
|
|
5293
|
-
* @example
|
|
5294
5362
|
* ```ts
|
|
5295
5363
|
* import { Effect } from "effect"
|
|
5296
5364
|
*
|
|
@@ -5301,14 +5369,15 @@ export const withTracer = internal.withTracer;
|
|
|
5301
5369
|
* )
|
|
5302
5370
|
* ```
|
|
5303
5371
|
*
|
|
5304
|
-
* @since 2.0.0
|
|
5305
5372
|
* @category Tracing
|
|
5373
|
+
* @since 2.0.0
|
|
5306
5374
|
*/
|
|
5307
5375
|
export const withTracerEnabled = internal.withTracerEnabled;
|
|
5308
5376
|
/**
|
|
5309
5377
|
* Enables or disables tracer timing for the given Effect.
|
|
5310
5378
|
*
|
|
5311
|
-
*
|
|
5379
|
+
* **Example** (Usage)
|
|
5380
|
+
*
|
|
5312
5381
|
* ```ts
|
|
5313
5382
|
* import { Effect } from "effect"
|
|
5314
5383
|
*
|
|
@@ -5319,14 +5388,15 @@ export const withTracerEnabled = internal.withTracerEnabled;
|
|
|
5319
5388
|
* )
|
|
5320
5389
|
* ```
|
|
5321
5390
|
*
|
|
5322
|
-
* @since 2.0.0
|
|
5323
5391
|
* @category Tracing
|
|
5392
|
+
* @since 2.0.0
|
|
5324
5393
|
*/
|
|
5325
5394
|
export const withTracerTiming = internal.withTracerTiming;
|
|
5326
5395
|
/**
|
|
5327
5396
|
* Adds an annotation to each span in this effect.
|
|
5328
5397
|
*
|
|
5329
|
-
*
|
|
5398
|
+
* **Example** (Usage)
|
|
5399
|
+
*
|
|
5330
5400
|
* ```ts
|
|
5331
5401
|
* import { Effect } from "effect"
|
|
5332
5402
|
*
|
|
@@ -5346,14 +5416,15 @@ export const withTracerTiming = internal.withTracerTiming;
|
|
|
5346
5416
|
* })
|
|
5347
5417
|
* ```
|
|
5348
5418
|
*
|
|
5349
|
-
* @since 2.0.0
|
|
5350
5419
|
* @category Tracing
|
|
5420
|
+
* @since 2.0.0
|
|
5351
5421
|
*/
|
|
5352
5422
|
export const annotateSpans = internal.annotateSpans;
|
|
5353
5423
|
/**
|
|
5354
5424
|
* Adds an annotation to the current span if available.
|
|
5355
5425
|
*
|
|
5356
|
-
*
|
|
5426
|
+
* **Example** (Usage)
|
|
5427
|
+
*
|
|
5357
5428
|
* ```ts
|
|
5358
5429
|
* import { Effect } from "effect"
|
|
5359
5430
|
*
|
|
@@ -5370,14 +5441,20 @@ export const annotateSpans = internal.annotateSpans;
|
|
|
5370
5441
|
* const traced = Effect.withSpan(program, "user-operation")
|
|
5371
5442
|
* ```
|
|
5372
5443
|
*
|
|
5373
|
-
* @since 2.0.0
|
|
5374
5444
|
* @category Tracing
|
|
5445
|
+
* @since 2.0.0
|
|
5375
5446
|
*/
|
|
5376
5447
|
export const annotateCurrentSpan = internal.annotateCurrentSpan;
|
|
5377
5448
|
/**
|
|
5378
|
-
* Returns the
|
|
5449
|
+
* Returns the currently active local tracing span.
|
|
5450
|
+
*
|
|
5451
|
+
* **Details**
|
|
5452
|
+
*
|
|
5453
|
+
* The effect fails with `NoSuchElementError` when there is no active local
|
|
5454
|
+
* `Span`.
|
|
5455
|
+
*
|
|
5456
|
+
* **Example** (Usage)
|
|
5379
5457
|
*
|
|
5380
|
-
* @example
|
|
5381
5458
|
* ```ts
|
|
5382
5459
|
* import { Effect } from "effect"
|
|
5383
5460
|
*
|
|
@@ -5390,14 +5467,21 @@ export const annotateCurrentSpan = internal.annotateCurrentSpan;
|
|
|
5390
5467
|
* const traced = Effect.withSpan(program, "my-span")
|
|
5391
5468
|
* ```
|
|
5392
5469
|
*
|
|
5393
|
-
* @since 2.0.0
|
|
5394
5470
|
* @category Tracing
|
|
5471
|
+
* @since 2.0.0
|
|
5395
5472
|
*/
|
|
5396
5473
|
export const currentSpan = internal.currentSpan;
|
|
5397
5474
|
/**
|
|
5398
|
-
* Returns the current parent span from the context.
|
|
5475
|
+
* Returns the current parent span from the effect context.
|
|
5476
|
+
*
|
|
5477
|
+
* **Details**
|
|
5478
|
+
*
|
|
5479
|
+
* The effect succeeds with either a local span or external span when one is
|
|
5480
|
+
* present, and fails with `NoSuchElementError` when no parent span is
|
|
5481
|
+
* available.
|
|
5482
|
+
*
|
|
5483
|
+
* **Example** (Usage)
|
|
5399
5484
|
*
|
|
5400
|
-
* @example
|
|
5401
5485
|
* ```ts
|
|
5402
5486
|
* import { Effect } from "effect"
|
|
5403
5487
|
*
|
|
@@ -5415,14 +5499,20 @@ export const currentSpan = internal.currentSpan;
|
|
|
5415
5499
|
* const traced = Effect.withSpan(program, "parent-span")
|
|
5416
5500
|
* ```
|
|
5417
5501
|
*
|
|
5418
|
-
* @since 2.0.0
|
|
5419
5502
|
* @category Tracing
|
|
5503
|
+
* @since 2.0.0
|
|
5420
5504
|
*/
|
|
5421
5505
|
export const currentParentSpan = internal.currentParentSpan;
|
|
5422
5506
|
/**
|
|
5423
|
-
* Returns the annotations
|
|
5507
|
+
* Returns the tracing span annotations currently carried in the effect context.
|
|
5508
|
+
*
|
|
5509
|
+
* **Details**
|
|
5510
|
+
*
|
|
5511
|
+
* These annotations are applied to spans created inside the context, such as
|
|
5512
|
+
* spans created by `withSpan`, `useSpan`, or `makeSpan`.
|
|
5513
|
+
*
|
|
5514
|
+
* **Example** (Usage)
|
|
5424
5515
|
*
|
|
5425
|
-
* @example
|
|
5426
5516
|
* ```ts
|
|
5427
5517
|
* import { Effect } from "effect"
|
|
5428
5518
|
*
|
|
@@ -5442,18 +5532,20 @@ export const currentParentSpan = internal.currentParentSpan;
|
|
|
5442
5532
|
* // Output: Current span annotations: { userId: "123", operation: "data-processing" }
|
|
5443
5533
|
* ```
|
|
5444
5534
|
*
|
|
5445
|
-
* @since 2.0.0
|
|
5446
5535
|
* @category Tracing
|
|
5536
|
+
* @since 2.0.0
|
|
5447
5537
|
*/
|
|
5448
5538
|
export const spanAnnotations = internal.spanAnnotations;
|
|
5449
5539
|
/**
|
|
5450
|
-
*
|
|
5540
|
+
* Returns the tracing span links currently carried in the effect context.
|
|
5541
|
+
*
|
|
5542
|
+
* **Details**
|
|
5451
5543
|
*
|
|
5452
|
-
*
|
|
5453
|
-
*
|
|
5454
|
-
*
|
|
5544
|
+
* These links are attached to spans created inside the context. Span links
|
|
5545
|
+
* connect related spans without making one span the parent of another.
|
|
5546
|
+
*
|
|
5547
|
+
* **Example** (Usage)
|
|
5455
5548
|
*
|
|
5456
|
-
* @example
|
|
5457
5549
|
* ```ts
|
|
5458
5550
|
* import { Effect } from "effect"
|
|
5459
5551
|
*
|
|
@@ -5465,8 +5557,8 @@ export const spanAnnotations = internal.spanAnnotations;
|
|
|
5465
5557
|
* })
|
|
5466
5558
|
* ```
|
|
5467
5559
|
*
|
|
5468
|
-
* @since 2.0.0
|
|
5469
5560
|
* @category Tracing
|
|
5561
|
+
* @since 2.0.0
|
|
5470
5562
|
*/
|
|
5471
5563
|
export const spanLinks = internal.spanLinks;
|
|
5472
5564
|
/**
|
|
@@ -5476,7 +5568,8 @@ export const spanLinks = internal.spanLinks;
|
|
|
5476
5568
|
* parent-child relationship. For example, you might want to link spans from
|
|
5477
5569
|
* parallel operations or connect spans across different traces.
|
|
5478
5570
|
*
|
|
5479
|
-
*
|
|
5571
|
+
* **Example** (Usage)
|
|
5572
|
+
*
|
|
5480
5573
|
* ```ts
|
|
5481
5574
|
* import { Effect } from "effect"
|
|
5482
5575
|
*
|
|
@@ -5498,7 +5591,8 @@ export const spanLinks = internal.spanLinks;
|
|
|
5498
5591
|
* })
|
|
5499
5592
|
* ```
|
|
5500
5593
|
*
|
|
5501
|
-
*
|
|
5594
|
+
* **Example** (Usage)
|
|
5595
|
+
*
|
|
5502
5596
|
* ```ts
|
|
5503
5597
|
* import { Effect } from "effect"
|
|
5504
5598
|
*
|
|
@@ -5516,14 +5610,21 @@ export const spanLinks = internal.spanLinks;
|
|
|
5516
5610
|
* })
|
|
5517
5611
|
* ```
|
|
5518
5612
|
*
|
|
5519
|
-
* @since 2.0.0
|
|
5520
5613
|
* @category Tracing
|
|
5614
|
+
* @since 2.0.0
|
|
5521
5615
|
*/
|
|
5522
5616
|
export const linkSpans = internal.linkSpans;
|
|
5523
5617
|
/**
|
|
5524
|
-
*
|
|
5618
|
+
* Creates a new tracing span and returns it without managing its lifetime.
|
|
5619
|
+
*
|
|
5620
|
+
* **Details**
|
|
5621
|
+
*
|
|
5622
|
+
* The span is not added to the current span stack and is not ended
|
|
5623
|
+
* automatically. Use `withSpan`, `useSpan`, or `makeSpanScoped` when the span
|
|
5624
|
+
* should be installed as context or closed automatically.
|
|
5625
|
+
*
|
|
5626
|
+
* **Example** (Usage)
|
|
5525
5627
|
*
|
|
5526
|
-
* @example
|
|
5527
5628
|
* ```ts
|
|
5528
5629
|
* import { Effect } from "effect"
|
|
5529
5630
|
*
|
|
@@ -5534,8 +5635,8 @@ export const linkSpans = internal.linkSpans;
|
|
|
5534
5635
|
* })
|
|
5535
5636
|
* ```
|
|
5536
5637
|
*
|
|
5537
|
-
* @since 2.0.0
|
|
5538
5638
|
* @category Tracing
|
|
5639
|
+
* @since 2.0.0
|
|
5539
5640
|
*/
|
|
5540
5641
|
export const makeSpan = internal.makeSpan;
|
|
5541
5642
|
/**
|
|
@@ -5545,7 +5646,8 @@ export const makeSpan = internal.makeSpan;
|
|
|
5545
5646
|
* The span is not added to the current span stack, so no child spans will be
|
|
5546
5647
|
* created for it.
|
|
5547
5648
|
*
|
|
5548
|
-
*
|
|
5649
|
+
* **Example** (Usage)
|
|
5650
|
+
*
|
|
5549
5651
|
* ```ts
|
|
5550
5652
|
* import { Effect } from "effect"
|
|
5551
5653
|
*
|
|
@@ -5559,8 +5661,8 @@ export const makeSpan = internal.makeSpan;
|
|
|
5559
5661
|
* )
|
|
5560
5662
|
* ```
|
|
5561
5663
|
*
|
|
5562
|
-
* @since 2.0.0
|
|
5563
5664
|
* @category Tracing
|
|
5665
|
+
* @since 2.0.0
|
|
5564
5666
|
*/
|
|
5565
5667
|
export const makeSpanScoped = internal.makeSpanScoped;
|
|
5566
5668
|
/**
|
|
@@ -5570,7 +5672,8 @@ export const makeSpanScoped = internal.makeSpanScoped;
|
|
|
5570
5672
|
* The span is not added to the current span stack, so no child spans will be
|
|
5571
5673
|
* created for it.
|
|
5572
5674
|
*
|
|
5573
|
-
*
|
|
5675
|
+
* **Example** (Usage)
|
|
5676
|
+
*
|
|
5574
5677
|
* ```ts
|
|
5575
5678
|
* import { Effect } from "effect"
|
|
5576
5679
|
*
|
|
@@ -5584,14 +5687,15 @@ export const makeSpanScoped = internal.makeSpanScoped;
|
|
|
5584
5687
|
* )
|
|
5585
5688
|
* ```
|
|
5586
5689
|
*
|
|
5587
|
-
* @since 2.0.0
|
|
5588
5690
|
* @category Tracing
|
|
5691
|
+
* @since 2.0.0
|
|
5589
5692
|
*/
|
|
5590
5693
|
export const useSpan = internal.useSpan;
|
|
5591
5694
|
/**
|
|
5592
5695
|
* Wraps the effect with a new span for tracing.
|
|
5593
5696
|
*
|
|
5594
|
-
*
|
|
5697
|
+
* **Example** (Usage)
|
|
5698
|
+
*
|
|
5595
5699
|
* ```ts
|
|
5596
5700
|
* import { Effect } from "effect"
|
|
5597
5701
|
*
|
|
@@ -5605,8 +5709,8 @@ export const useSpan = internal.useSpan;
|
|
|
5605
5709
|
* })
|
|
5606
5710
|
* ```
|
|
5607
5711
|
*
|
|
5608
|
-
* @since 2.0.0
|
|
5609
5712
|
* @category Tracing
|
|
5713
|
+
* @since 2.0.0
|
|
5610
5714
|
*/
|
|
5611
5715
|
export const withSpan = internal.withSpan;
|
|
5612
5716
|
/**
|
|
@@ -5614,7 +5718,8 @@ export const withSpan = internal.withSpan;
|
|
|
5614
5718
|
*
|
|
5615
5719
|
* The span is ended when the Scope is finalized.
|
|
5616
5720
|
*
|
|
5617
|
-
*
|
|
5721
|
+
* **Example** (Usage)
|
|
5722
|
+
*
|
|
5618
5723
|
* ```ts
|
|
5619
5724
|
* import { Effect } from "effect"
|
|
5620
5725
|
*
|
|
@@ -5627,14 +5732,15 @@ export const withSpan = internal.withSpan;
|
|
|
5627
5732
|
* )
|
|
5628
5733
|
* ```
|
|
5629
5734
|
*
|
|
5630
|
-
* @since 2.0.0
|
|
5631
5735
|
* @category Tracing
|
|
5736
|
+
* @since 2.0.0
|
|
5632
5737
|
*/
|
|
5633
5738
|
export const withSpanScoped = internal.withSpanScoped;
|
|
5634
5739
|
/**
|
|
5635
5740
|
* Adds the provided span to the current span stack.
|
|
5636
5741
|
*
|
|
5637
|
-
*
|
|
5742
|
+
* **Example** (Usage)
|
|
5743
|
+
*
|
|
5638
5744
|
* ```ts
|
|
5639
5745
|
* import { Effect } from "effect"
|
|
5640
5746
|
*
|
|
@@ -5646,8 +5752,8 @@ export const withSpanScoped = internal.withSpanScoped;
|
|
|
5646
5752
|
* })
|
|
5647
5753
|
* ```
|
|
5648
5754
|
*
|
|
5649
|
-
* @since 2.0.0
|
|
5650
5755
|
* @category Tracing
|
|
5756
|
+
* @since 2.0.0
|
|
5651
5757
|
*/
|
|
5652
5758
|
export const withParentSpan = internal.withParentSpan;
|
|
5653
5759
|
// -----------------------------------------------------------------------------
|
|
@@ -5656,10 +5762,11 @@ export const withParentSpan = internal.withParentSpan;
|
|
|
5656
5762
|
/**
|
|
5657
5763
|
* Executes a request using the provided resolver.
|
|
5658
5764
|
*
|
|
5659
|
-
* @since 2.0.0
|
|
5660
5765
|
* @category Requests & Batching
|
|
5766
|
+
* @since 2.0.0
|
|
5767
|
+
*
|
|
5768
|
+
* **Example** (Usage)
|
|
5661
5769
|
*
|
|
5662
|
-
* @example
|
|
5663
5770
|
* ```ts
|
|
5664
5771
|
* import { Console, Effect, Exit, Request, RequestResolver } from "effect"
|
|
5665
5772
|
*
|
|
@@ -5690,8 +5797,8 @@ export const request = internalRequest.request;
|
|
|
5690
5797
|
*
|
|
5691
5798
|
* It returns a canceler that removes the pending request entry.
|
|
5692
5799
|
*
|
|
5693
|
-
* @since 4.0.0
|
|
5694
5800
|
* @category Requests & Batching
|
|
5801
|
+
* @since 4.0.0
|
|
5695
5802
|
*/
|
|
5696
5803
|
export const requestUnsafe = internalRequest.requestUnsafe;
|
|
5697
5804
|
// -----------------------------------------------------------------------------
|
|
@@ -5718,7 +5825,8 @@ export const requestUnsafe = internalRequest.requestUnsafe;
|
|
|
5718
5825
|
* fibers leak. This behavior is called "auto supervision", and if this
|
|
5719
5826
|
* behavior is not desired, you may use the `forkDetach` or `forkIn` methods.
|
|
5720
5827
|
*
|
|
5721
|
-
*
|
|
5828
|
+
* **Example** (Usage)
|
|
5829
|
+
*
|
|
5722
5830
|
* ```ts
|
|
5723
5831
|
* import { Effect, Fiber } from "effect"
|
|
5724
5832
|
*
|
|
@@ -5740,15 +5848,16 @@ export const requestUnsafe = internalRequest.requestUnsafe;
|
|
|
5740
5848
|
* })
|
|
5741
5849
|
* ```
|
|
5742
5850
|
*
|
|
5743
|
-
* @since 4.0.0
|
|
5744
5851
|
* @category Supervision & Fibers
|
|
5852
|
+
* @since 4.0.0
|
|
5745
5853
|
*/
|
|
5746
5854
|
export const forkChild = internal.forkChild;
|
|
5747
5855
|
/**
|
|
5748
5856
|
* Forks the effect in the specified scope. The fiber will be interrupted
|
|
5749
5857
|
* when the scope is closed.
|
|
5750
5858
|
*
|
|
5751
|
-
*
|
|
5859
|
+
* **Example** (Usage)
|
|
5860
|
+
*
|
|
5752
5861
|
* ```ts
|
|
5753
5862
|
* import { Effect } from "effect"
|
|
5754
5863
|
*
|
|
@@ -5768,14 +5877,15 @@ export const forkChild = internal.forkChild;
|
|
|
5768
5877
|
* )
|
|
5769
5878
|
* ```
|
|
5770
5879
|
*
|
|
5771
|
-
* @since 2.0.0
|
|
5772
5880
|
* @category Supervision & Fibers
|
|
5881
|
+
* @since 2.0.0
|
|
5773
5882
|
*/
|
|
5774
5883
|
export const forkIn = internal.forkIn;
|
|
5775
5884
|
/**
|
|
5776
5885
|
* Forks the fiber in a `Scope`, interrupting it when the scope is closed.
|
|
5777
5886
|
*
|
|
5778
|
-
*
|
|
5887
|
+
* **Example** (Usage)
|
|
5888
|
+
*
|
|
5779
5889
|
* ```ts
|
|
5780
5890
|
* import { Effect } from "effect"
|
|
5781
5891
|
*
|
|
@@ -5801,8 +5911,8 @@ export const forkIn = internal.forkIn;
|
|
|
5801
5911
|
* )
|
|
5802
5912
|
* ```
|
|
5803
5913
|
*
|
|
5804
|
-
* @since 2.0.0
|
|
5805
5914
|
* @category Supervision & Fibers
|
|
5915
|
+
* @since 2.0.0
|
|
5806
5916
|
*/
|
|
5807
5917
|
export const forkScoped = internal.forkScoped;
|
|
5808
5918
|
/**
|
|
@@ -5810,7 +5920,8 @@ export const forkScoped = internal.forkScoped;
|
|
|
5810
5920
|
* new fiber is attached to the global scope, when the fiber executing the
|
|
5811
5921
|
* returned effect terminates, the forked fiber will continue running.
|
|
5812
5922
|
*
|
|
5813
|
-
*
|
|
5923
|
+
* **Example** (Usage)
|
|
5924
|
+
*
|
|
5814
5925
|
* ```ts
|
|
5815
5926
|
* import { Effect } from "effect"
|
|
5816
5927
|
*
|
|
@@ -5834,22 +5945,23 @@ export const forkScoped = internal.forkScoped;
|
|
|
5834
5945
|
* })
|
|
5835
5946
|
* ```
|
|
5836
5947
|
*
|
|
5837
|
-
* @since 2.0.0
|
|
5838
5948
|
* @category Supervision & Fibers
|
|
5949
|
+
* @since 2.0.0
|
|
5839
5950
|
*/
|
|
5840
5951
|
export const forkDetach = internal.forkDetach;
|
|
5841
5952
|
/**
|
|
5842
5953
|
* Waits for all child fibers forked by this effect to complete before this
|
|
5843
5954
|
* effect completes.
|
|
5844
5955
|
*
|
|
5845
|
-
* @since 2.0.0
|
|
5846
5956
|
* @category Supervision & Fibers
|
|
5957
|
+
* @since 2.0.0
|
|
5847
5958
|
*/
|
|
5848
5959
|
export const awaitAllChildren = internal.awaitAllChildren;
|
|
5849
5960
|
/**
|
|
5850
5961
|
* Access the fiber currently executing the effect.
|
|
5851
5962
|
*
|
|
5852
|
-
*
|
|
5963
|
+
* **Example** (Usage)
|
|
5964
|
+
*
|
|
5853
5965
|
* ```ts
|
|
5854
5966
|
* import { Console, Effect } from "effect"
|
|
5855
5967
|
*
|
|
@@ -5859,14 +5971,15 @@ export const awaitAllChildren = internal.awaitAllChildren;
|
|
|
5859
5971
|
* })
|
|
5860
5972
|
* ```
|
|
5861
5973
|
*
|
|
5862
|
-
* @since 4.0.0
|
|
5863
5974
|
* @category Supervision & Fibers
|
|
5975
|
+
* @since 4.0.0
|
|
5864
5976
|
*/
|
|
5865
5977
|
export const fiber = internal.fiber;
|
|
5866
5978
|
/**
|
|
5867
5979
|
* Access the current fiber id executing the effect.
|
|
5868
5980
|
*
|
|
5869
|
-
*
|
|
5981
|
+
* **Example** (Usage)
|
|
5982
|
+
*
|
|
5870
5983
|
* ```ts
|
|
5871
5984
|
* import { Effect } from "effect"
|
|
5872
5985
|
*
|
|
@@ -5881,8 +5994,8 @@ export const fiber = internal.fiber;
|
|
|
5881
5994
|
* )
|
|
5882
5995
|
* ```
|
|
5883
5996
|
*
|
|
5884
|
-
* @since 4.0.0
|
|
5885
5997
|
* @category Supervision & Fibers
|
|
5998
|
+
* @since 4.0.0
|
|
5886
5999
|
*/
|
|
5887
6000
|
export const fiberId = internal.fiberId;
|
|
5888
6001
|
/**
|
|
@@ -5898,9 +6011,9 @@ export const fiberId = internal.fiberId;
|
|
|
5898
6011
|
* Unless you specifically need a `Promise` or synchronous operation,
|
|
5899
6012
|
* `runFork` is a good default choice.
|
|
5900
6013
|
*
|
|
5901
|
-
*
|
|
6014
|
+
* **Example** (Running an Effect in the Background)
|
|
6015
|
+
*
|
|
5902
6016
|
* ```ts
|
|
5903
|
-
* // Title: Running an Effect in the Background
|
|
5904
6017
|
* import { Effect } from "effect"
|
|
5905
6018
|
* import { Schedule } from "effect"
|
|
5906
6019
|
* import { Fiber } from "effect"
|
|
@@ -5922,14 +6035,15 @@ export const fiberId = internal.fiberId;
|
|
|
5922
6035
|
* }, 500)
|
|
5923
6036
|
* ```
|
|
5924
6037
|
*
|
|
5925
|
-
* @since 2.0.0
|
|
5926
6038
|
* @category Running Effects
|
|
6039
|
+
* @since 2.0.0
|
|
5927
6040
|
*/
|
|
5928
6041
|
export const runFork = internal.runFork;
|
|
5929
6042
|
/**
|
|
5930
6043
|
* Runs an effect in the background with the provided services.
|
|
5931
6044
|
*
|
|
5932
|
-
*
|
|
6045
|
+
* **Example** (Usage)
|
|
6046
|
+
*
|
|
5933
6047
|
* ```ts
|
|
5934
6048
|
* import { Effect, Context } from "effect"
|
|
5935
6049
|
*
|
|
@@ -5952,8 +6066,8 @@ export const runFork = internal.runFork;
|
|
|
5952
6066
|
* const fiber = Effect.runForkWith(services)(program)
|
|
5953
6067
|
* ```
|
|
5954
6068
|
*
|
|
5955
|
-
* @since 4.0.0
|
|
5956
6069
|
* @category Running Effects
|
|
6070
|
+
* @since 4.0.0
|
|
5957
6071
|
*/
|
|
5958
6072
|
export const runForkWith = internal.runForkWith;
|
|
5959
6073
|
/**
|
|
@@ -5961,7 +6075,8 @@ export const runForkWith = internal.runForkWith;
|
|
|
5961
6075
|
*
|
|
5962
6076
|
* The returned interruptor calls `fiber.interruptUnsafe`, optionally with an interruptor id.
|
|
5963
6077
|
*
|
|
5964
|
-
*
|
|
6078
|
+
* **Example** (Usage)
|
|
6079
|
+
*
|
|
5965
6080
|
* ```ts
|
|
5966
6081
|
* import { Console, Effect, Exit, Context } from "effect"
|
|
5967
6082
|
*
|
|
@@ -5993,8 +6108,8 @@ export const runForkWith = internal.runForkWith;
|
|
|
5993
6108
|
* interrupt()
|
|
5994
6109
|
* ```
|
|
5995
6110
|
*
|
|
5996
|
-
* @since 4.0.0
|
|
5997
6111
|
* @category Running Effects
|
|
6112
|
+
* @since 4.0.0
|
|
5998
6113
|
*/
|
|
5999
6114
|
export const runCallbackWith = internal.runCallbackWith;
|
|
6000
6115
|
/**
|
|
@@ -6004,7 +6119,8 @@ export const runCallbackWith = internal.runCallbackWith;
|
|
|
6004
6119
|
* The interruptor calls `fiber.interruptUnsafe` with the optional interruptor
|
|
6005
6120
|
* id.
|
|
6006
6121
|
*
|
|
6007
|
-
*
|
|
6122
|
+
* **Example** (Usage)
|
|
6123
|
+
*
|
|
6008
6124
|
* ```ts
|
|
6009
6125
|
* import { Console, Effect, Exit } from "effect"
|
|
6010
6126
|
*
|
|
@@ -6031,8 +6147,8 @@ export const runCallbackWith = internal.runCallbackWith;
|
|
|
6031
6147
|
* // interrupt() to cancel the fiber if needed
|
|
6032
6148
|
* ```
|
|
6033
6149
|
*
|
|
6034
|
-
* @since 4.0.0
|
|
6035
6150
|
* @category Running Effects
|
|
6151
|
+
* @since 4.0.0
|
|
6036
6152
|
*/
|
|
6037
6153
|
export const runCallback = internal.runCallback;
|
|
6038
6154
|
/**
|
|
@@ -6049,31 +6165,35 @@ export const runCallback = internal.runCallback;
|
|
|
6049
6165
|
*
|
|
6050
6166
|
* @see {@link runPromiseExit} for a version that returns an `Exit` type instead of rejecting.
|
|
6051
6167
|
*
|
|
6052
|
-
*
|
|
6168
|
+
* **Example** (Running a Successful Effect as a Promise)
|
|
6169
|
+
*
|
|
6053
6170
|
* ```ts
|
|
6054
|
-
* // Title: Running a Successful Effect as a Promise
|
|
6055
6171
|
* import { Effect } from "effect"
|
|
6056
6172
|
*
|
|
6057
6173
|
* Effect.runPromise(Effect.succeed(1)).then(console.log)
|
|
6058
6174
|
* // Output: 1
|
|
6059
6175
|
* ```
|
|
6060
6176
|
*
|
|
6061
|
-
*
|
|
6177
|
+
* **Example** (Usage)
|
|
6178
|
+
*
|
|
6179
|
+
* ```ts
|
|
6062
6180
|
* //Example: Handling a Failing Effect as a Rejected Promise
|
|
6063
6181
|
* import { Effect } from "effect"
|
|
6064
6182
|
*
|
|
6065
6183
|
* Effect.runPromise(Effect.fail("my error")).catch(console.error)
|
|
6066
6184
|
* // Output:
|
|
6067
6185
|
* // (FiberFailure) Error: my error
|
|
6186
|
+
* ```
|
|
6068
6187
|
*
|
|
6069
|
-
* @since 2.0.0
|
|
6070
6188
|
* @category Running Effects
|
|
6189
|
+
* @since 2.0.0
|
|
6071
6190
|
*/
|
|
6072
6191
|
export const runPromise = internal.runPromise;
|
|
6073
6192
|
/**
|
|
6074
6193
|
* Executes an effect as a Promise with the provided services.
|
|
6075
6194
|
*
|
|
6076
|
-
*
|
|
6195
|
+
* **Example** (Usage)
|
|
6196
|
+
*
|
|
6077
6197
|
* ```ts
|
|
6078
6198
|
* import { Effect, Context } from "effect"
|
|
6079
6199
|
*
|
|
@@ -6095,8 +6215,8 @@ export const runPromise = internal.runPromise;
|
|
|
6095
6215
|
* Effect.runPromiseWith(context)(program).then(console.log)
|
|
6096
6216
|
* ```
|
|
6097
6217
|
*
|
|
6098
|
-
* @since 4.0.0
|
|
6099
6218
|
* @category Running Effects
|
|
6219
|
+
* @since 4.0.0
|
|
6100
6220
|
*/
|
|
6101
6221
|
export const runPromiseWith = internal.runPromiseWith;
|
|
6102
6222
|
/**
|
|
@@ -6115,9 +6235,9 @@ export const runPromiseWith = internal.runPromiseWith;
|
|
|
6115
6235
|
* - If it fails, the failure information is provided as a `Failure` containing
|
|
6116
6236
|
* a `Cause` type.
|
|
6117
6237
|
*
|
|
6118
|
-
*
|
|
6238
|
+
* **Example** (Handling Results as Exit)
|
|
6239
|
+
*
|
|
6119
6240
|
* ```ts
|
|
6120
|
-
* // Title: Handling Results as Exit
|
|
6121
6241
|
* import { Effect } from "effect"
|
|
6122
6242
|
*
|
|
6123
6243
|
* // Execute a successful effect and get the Exit result as a Promise
|
|
@@ -6143,14 +6263,15 @@ export const runPromiseWith = internal.runPromiseWith;
|
|
|
6143
6263
|
* // }
|
|
6144
6264
|
* ```
|
|
6145
6265
|
*
|
|
6146
|
-
* @since 2.0.0
|
|
6147
6266
|
* @category Running Effects
|
|
6267
|
+
* @since 2.0.0
|
|
6148
6268
|
*/
|
|
6149
6269
|
export const runPromiseExit = internal.runPromiseExit;
|
|
6150
6270
|
/**
|
|
6151
6271
|
* Runs an effect and returns a Promise of Exit with provided services.
|
|
6152
6272
|
*
|
|
6153
|
-
*
|
|
6273
|
+
* **Example** (Usage)
|
|
6274
|
+
*
|
|
6154
6275
|
* ```ts
|
|
6155
6276
|
* import { Effect, Exit, Context } from "effect"
|
|
6156
6277
|
*
|
|
@@ -6176,28 +6297,29 @@ export const runPromiseExit = internal.runPromiseExit;
|
|
|
6176
6297
|
* })
|
|
6177
6298
|
* ```
|
|
6178
6299
|
*
|
|
6179
|
-
* @since 4.0.0
|
|
6180
6300
|
* @category Running Effects
|
|
6301
|
+
* @since 4.0.0
|
|
6181
6302
|
*/
|
|
6182
6303
|
export const runPromiseExitWith = internal.runPromiseExitWith;
|
|
6183
6304
|
/**
|
|
6184
|
-
* Executes an effect synchronously
|
|
6185
|
-
* result.
|
|
6305
|
+
* Executes an effect synchronously and returns its success value.
|
|
6186
6306
|
*
|
|
6187
6307
|
* **When to Use**
|
|
6188
6308
|
*
|
|
6189
|
-
* Use `runSync`
|
|
6190
|
-
*
|
|
6309
|
+
* Use `runSync` only for effects that can complete synchronously.
|
|
6310
|
+
*
|
|
6311
|
+
* **Details**
|
|
6191
6312
|
*
|
|
6192
|
-
* If the effect fails
|
|
6193
|
-
*
|
|
6313
|
+
* If the effect fails, dies, is interrupted, or performs asynchronous work,
|
|
6314
|
+
* `runSync` throws a `FiberFailure` instead of returning a value. Use
|
|
6315
|
+
* `runSyncExit` when you want the failure captured as an `Exit`.
|
|
6194
6316
|
*
|
|
6195
6317
|
* @see {@link runSyncExit} for a version that returns an `Exit` type instead of
|
|
6196
6318
|
* throwing an error.
|
|
6197
6319
|
*
|
|
6198
|
-
*
|
|
6320
|
+
* **Example** (Synchronous Logging)
|
|
6321
|
+
*
|
|
6199
6322
|
* ```ts
|
|
6200
|
-
* // Title: Synchronous Logging
|
|
6201
6323
|
* import { Effect } from "effect"
|
|
6202
6324
|
*
|
|
6203
6325
|
* const program = Effect.sync(() => {
|
|
@@ -6212,8 +6334,9 @@ export const runPromiseExitWith = internal.runPromiseExitWith;
|
|
|
6212
6334
|
* // Output: 1
|
|
6213
6335
|
* ```
|
|
6214
6336
|
*
|
|
6215
|
-
*
|
|
6216
|
-
*
|
|
6337
|
+
* **Example** (Incorrect Usage with Failing or Async Effects)
|
|
6338
|
+
*
|
|
6339
|
+
* ```ts
|
|
6217
6340
|
* import { Effect } from "effect"
|
|
6218
6341
|
*
|
|
6219
6342
|
* try {
|
|
@@ -6233,15 +6356,17 @@ export const runPromiseExitWith = internal.runPromiseExitWith;
|
|
|
6233
6356
|
* }
|
|
6234
6357
|
* // Output:
|
|
6235
6358
|
* // (FiberFailure) AsyncFiberException: Fiber #0 cannot be resolved synchronously. This is caused by using runSync on an effect that performs async work
|
|
6359
|
+
* ```
|
|
6236
6360
|
*
|
|
6237
|
-
* @since 2.0.0
|
|
6238
6361
|
* @category Running Effects
|
|
6362
|
+
* @since 2.0.0
|
|
6239
6363
|
*/
|
|
6240
6364
|
export const runSync = internal.runSync;
|
|
6241
6365
|
/**
|
|
6242
6366
|
* Executes an effect synchronously with provided services.
|
|
6243
6367
|
*
|
|
6244
|
-
*
|
|
6368
|
+
* **Example** (Usage)
|
|
6369
|
+
*
|
|
6245
6370
|
* ```ts
|
|
6246
6371
|
* import { Effect, Context } from "effect"
|
|
6247
6372
|
*
|
|
@@ -6264,8 +6389,8 @@ export const runSync = internal.runSync;
|
|
|
6264
6389
|
* console.log(result) // 5
|
|
6265
6390
|
* ```
|
|
6266
6391
|
*
|
|
6267
|
-
* @since 4.0.0
|
|
6268
6392
|
* @category Running Effects
|
|
6393
|
+
* @since 4.0.0
|
|
6269
6394
|
*/
|
|
6270
6395
|
export const runSyncWith = internal.runSyncWith;
|
|
6271
6396
|
/**
|
|
@@ -6288,9 +6413,9 @@ export const runSyncWith = internal.runSyncWith;
|
|
|
6288
6413
|
* return an `Failure` with a `Die` cause, indicating that the effect cannot be
|
|
6289
6414
|
* resolved synchronously.
|
|
6290
6415
|
*
|
|
6291
|
-
*
|
|
6416
|
+
* **Example** (Handling Results as Exit)
|
|
6417
|
+
*
|
|
6292
6418
|
* ```ts
|
|
6293
|
-
* // Title: Handling Results as Exit
|
|
6294
6419
|
* import { Effect } from "effect"
|
|
6295
6420
|
*
|
|
6296
6421
|
* console.log(Effect.runSyncExit(Effect.succeed(1)))
|
|
@@ -6314,8 +6439,9 @@ export const runSyncWith = internal.runSyncWith;
|
|
|
6314
6439
|
* // }
|
|
6315
6440
|
* ```
|
|
6316
6441
|
*
|
|
6317
|
-
*
|
|
6318
|
-
*
|
|
6442
|
+
* **Example** (Asynchronous Operation Resulting in Die)
|
|
6443
|
+
*
|
|
6444
|
+
* ```ts
|
|
6319
6445
|
* import { Effect } from "effect"
|
|
6320
6446
|
*
|
|
6321
6447
|
* console.log(Effect.runSyncExit(Effect.promise(() => Promise.resolve(1))))
|
|
@@ -6333,15 +6459,17 @@ export const runSyncWith = internal.runSyncWith;
|
|
|
6333
6459
|
* // }
|
|
6334
6460
|
* // }
|
|
6335
6461
|
* // }
|
|
6462
|
+
* ```
|
|
6336
6463
|
*
|
|
6337
|
-
* @since 2.0.0
|
|
6338
6464
|
* @category Running Effects
|
|
6465
|
+
* @since 2.0.0
|
|
6339
6466
|
*/
|
|
6340
6467
|
export const runSyncExit = internal.runSyncExit;
|
|
6341
6468
|
/**
|
|
6342
6469
|
* Runs an effect synchronously with provided services, returning an Exit result.
|
|
6343
6470
|
*
|
|
6344
|
-
*
|
|
6471
|
+
* **Example** (Usage)
|
|
6472
|
+
*
|
|
6345
6473
|
* ```ts
|
|
6346
6474
|
* import { Effect, Exit, Context } from "effect"
|
|
6347
6475
|
*
|
|
@@ -6373,8 +6501,8 @@ export const runSyncExit = internal.runSyncExit;
|
|
|
6373
6501
|
* // Success: 42
|
|
6374
6502
|
* ```
|
|
6375
6503
|
*
|
|
6376
|
-
* @since 4.0.0
|
|
6377
6504
|
* @category Running Effects
|
|
6505
|
+
* @since 4.0.0
|
|
6378
6506
|
*/
|
|
6379
6507
|
export const runSyncExitWith = internal.runSyncExitWith;
|
|
6380
6508
|
/**
|
|
@@ -6382,7 +6510,8 @@ export const runSyncExitWith = internal.runSyncExitWith;
|
|
|
6382
6510
|
*
|
|
6383
6511
|
* `Effect.fnUntraced` also acts as a `pipe` function, so you can append transforms after the body.
|
|
6384
6512
|
*
|
|
6385
|
-
*
|
|
6513
|
+
* **Example** (Usage)
|
|
6514
|
+
*
|
|
6386
6515
|
* ```ts
|
|
6387
6516
|
* import { Console, Effect } from "effect"
|
|
6388
6517
|
*
|
|
@@ -6394,8 +6523,8 @@ export const runSyncExitWith = internal.runSyncExitWith;
|
|
|
6394
6523
|
* Effect.runFork(greet("Ada"))
|
|
6395
6524
|
* ```
|
|
6396
6525
|
*
|
|
6397
|
-
* @since 3.12.0
|
|
6398
6526
|
* @category Function
|
|
6527
|
+
* @since 3.12.0
|
|
6399
6528
|
*/
|
|
6400
6529
|
export const fnUntraced = internal.fnUntraced;
|
|
6401
6530
|
/**
|
|
@@ -6403,7 +6532,8 @@ export const fnUntraced = internal.fnUntraced;
|
|
|
6403
6532
|
*
|
|
6404
6533
|
* Pipeable functions run after the body and can transform the resulting Effect.
|
|
6405
6534
|
*
|
|
6406
|
-
*
|
|
6535
|
+
* **Example** (Usage)
|
|
6536
|
+
*
|
|
6407
6537
|
* ```ts
|
|
6408
6538
|
* import { Console, Effect } from "effect"
|
|
6409
6539
|
*
|
|
@@ -6422,8 +6552,8 @@ export const fnUntraced = internal.fnUntraced;
|
|
|
6422
6552
|
* })
|
|
6423
6553
|
* ```
|
|
6424
6554
|
*
|
|
6425
|
-
* @since 3.12.0
|
|
6426
6555
|
* @category Function
|
|
6556
|
+
* @since 3.12.0
|
|
6427
6557
|
*/
|
|
6428
6558
|
export const fn = internal.fn;
|
|
6429
6559
|
// ========================================================================
|
|
@@ -6433,7 +6563,8 @@ export const fn = internal.fn;
|
|
|
6433
6563
|
* Retrieves the `Clock` service from the context and provides it to the
|
|
6434
6564
|
* specified effectful function.
|
|
6435
6565
|
*
|
|
6436
|
-
*
|
|
6566
|
+
* **Example** (Usage)
|
|
6567
|
+
*
|
|
6437
6568
|
* ```ts
|
|
6438
6569
|
* import { Console, Effect } from "effect"
|
|
6439
6570
|
*
|
|
@@ -6449,8 +6580,8 @@ export const fn = internal.fn;
|
|
|
6449
6580
|
* // Current time is: 1735484929744
|
|
6450
6581
|
* ```
|
|
6451
6582
|
*
|
|
6452
|
-
* @since 2.0.0
|
|
6453
6583
|
* @category Clock
|
|
6584
|
+
* @since 2.0.0
|
|
6454
6585
|
*/
|
|
6455
6586
|
export const clockWith = internal.clockWith;
|
|
6456
6587
|
// ========================================================================
|
|
@@ -6462,7 +6593,8 @@ export const clockWith = internal.clockWith;
|
|
|
6462
6593
|
* If no level is provided, the logger uses the fiber's current log level and
|
|
6463
6594
|
* extracts any `Cause` values from the message list.
|
|
6464
6595
|
*
|
|
6465
|
-
*
|
|
6596
|
+
* **Example** (Usage)
|
|
6597
|
+
*
|
|
6466
6598
|
* ```ts
|
|
6467
6599
|
* import { Effect } from "effect"
|
|
6468
6600
|
*
|
|
@@ -6473,14 +6605,15 @@ export const clockWith = internal.clockWith;
|
|
|
6473
6605
|
* })
|
|
6474
6606
|
* ```
|
|
6475
6607
|
*
|
|
6476
|
-
* @since 2.0.0
|
|
6477
6608
|
* @category Logging
|
|
6609
|
+
* @since 2.0.0
|
|
6478
6610
|
*/
|
|
6479
6611
|
export const logWithLevel = internal.logWithLevel;
|
|
6480
6612
|
/**
|
|
6481
6613
|
* Logs one or more messages using the default log level.
|
|
6482
6614
|
*
|
|
6483
|
-
*
|
|
6615
|
+
* **Example** (Usage)
|
|
6616
|
+
*
|
|
6484
6617
|
* ```ts
|
|
6485
6618
|
* import { Effect } from "effect"
|
|
6486
6619
|
*
|
|
@@ -6500,14 +6633,15 @@ export const logWithLevel = internal.logWithLevel;
|
|
|
6500
6633
|
* // 4
|
|
6501
6634
|
* ```
|
|
6502
6635
|
*
|
|
6503
|
-
* @since 2.0.0
|
|
6504
6636
|
* @category Logging
|
|
6637
|
+
* @since 2.0.0
|
|
6505
6638
|
*/
|
|
6506
6639
|
export const log = /*#__PURE__*/internal.logWithLevel();
|
|
6507
6640
|
/**
|
|
6508
6641
|
* Logs one or more messages at the FATAL level.
|
|
6509
6642
|
*
|
|
6510
|
-
*
|
|
6643
|
+
* **Example** (Usage)
|
|
6644
|
+
*
|
|
6511
6645
|
* ```ts
|
|
6512
6646
|
* import { Effect } from "effect"
|
|
6513
6647
|
*
|
|
@@ -6528,14 +6662,15 @@ export const log = /*#__PURE__*/internal.logWithLevel();
|
|
|
6528
6662
|
* // timestamp=2023-... level=FATAL message="System shutting down"
|
|
6529
6663
|
* ```
|
|
6530
6664
|
*
|
|
6531
|
-
* @since 2.0.0
|
|
6532
6665
|
* @category Logging
|
|
6666
|
+
* @since 2.0.0
|
|
6533
6667
|
*/
|
|
6534
6668
|
export const logFatal = /*#__PURE__*/internal.logWithLevel("Fatal");
|
|
6535
6669
|
/**
|
|
6536
6670
|
* Logs one or more messages at the WARNING level.
|
|
6537
6671
|
*
|
|
6538
|
-
*
|
|
6672
|
+
* **Example** (Usage)
|
|
6673
|
+
*
|
|
6539
6674
|
* ```ts
|
|
6540
6675
|
* import { Effect } from "effect"
|
|
6541
6676
|
*
|
|
@@ -6557,14 +6692,15 @@ export const logFatal = /*#__PURE__*/internal.logWithLevel("Fatal");
|
|
|
6557
6692
|
* // timestamp=2023-... level=WARN message="Using deprecated API endpoint"
|
|
6558
6693
|
* ```
|
|
6559
6694
|
*
|
|
6560
|
-
* @since 2.0.0
|
|
6561
6695
|
* @category Logging
|
|
6696
|
+
* @since 2.0.0
|
|
6562
6697
|
*/
|
|
6563
6698
|
export const logWarning = /*#__PURE__*/internal.logWithLevel("Warn");
|
|
6564
6699
|
/**
|
|
6565
6700
|
* Logs one or more messages at the ERROR level.
|
|
6566
6701
|
*
|
|
6567
|
-
*
|
|
6702
|
+
* **Example** (Usage)
|
|
6703
|
+
*
|
|
6568
6704
|
* ```ts
|
|
6569
6705
|
* import { Effect } from "effect"
|
|
6570
6706
|
*
|
|
@@ -6589,14 +6725,15 @@ export const logWarning = /*#__PURE__*/internal.logWithLevel("Warn");
|
|
|
6589
6725
|
* // timestamp=2023-... level=ERROR message="Caught error: Something went wrong"
|
|
6590
6726
|
* ```
|
|
6591
6727
|
*
|
|
6592
|
-
* @since 2.0.0
|
|
6593
6728
|
* @category Logging
|
|
6729
|
+
* @since 2.0.0
|
|
6594
6730
|
*/
|
|
6595
6731
|
export const logError = /*#__PURE__*/internal.logWithLevel("Error");
|
|
6596
6732
|
/**
|
|
6597
6733
|
* Logs one or more messages at the INFO level.
|
|
6598
6734
|
*
|
|
6599
|
-
*
|
|
6735
|
+
* **Example** (Usage)
|
|
6736
|
+
*
|
|
6600
6737
|
* ```ts
|
|
6601
6738
|
* import { Effect } from "effect"
|
|
6602
6739
|
*
|
|
@@ -6616,14 +6753,15 @@ export const logError = /*#__PURE__*/internal.logWithLevel("Error");
|
|
|
6616
6753
|
* // timestamp=2023-... level=INFO message="Application version: 1.2.3"
|
|
6617
6754
|
* ```
|
|
6618
6755
|
*
|
|
6619
|
-
* @since 2.0.0
|
|
6620
6756
|
* @category Logging
|
|
6757
|
+
* @since 2.0.0
|
|
6621
6758
|
*/
|
|
6622
6759
|
export const logInfo = /*#__PURE__*/internal.logWithLevel("Info");
|
|
6623
6760
|
/**
|
|
6624
6761
|
* Logs one or more messages at the DEBUG level.
|
|
6625
6762
|
*
|
|
6626
|
-
*
|
|
6763
|
+
* **Example** (Usage)
|
|
6764
|
+
*
|
|
6627
6765
|
* ```ts
|
|
6628
6766
|
* import { Effect } from "effect"
|
|
6629
6767
|
*
|
|
@@ -6644,14 +6782,15 @@ export const logInfo = /*#__PURE__*/internal.logWithLevel("Info");
|
|
|
6644
6782
|
* // timestamp=2023-... level=DEBUG message="Variable state: x=10 y=20 z=30"
|
|
6645
6783
|
* ```
|
|
6646
6784
|
*
|
|
6647
|
-
* @since 2.0.0
|
|
6648
6785
|
* @category Logging
|
|
6786
|
+
* @since 2.0.0
|
|
6649
6787
|
*/
|
|
6650
6788
|
export const logDebug = /*#__PURE__*/internal.logWithLevel("Debug");
|
|
6651
6789
|
/**
|
|
6652
6790
|
* Logs one or more messages at the TRACE level.
|
|
6653
6791
|
*
|
|
6654
|
-
*
|
|
6792
|
+
* **Example** (Usage)
|
|
6793
|
+
*
|
|
6655
6794
|
* ```ts
|
|
6656
6795
|
* import { Effect } from "effect"
|
|
6657
6796
|
*
|
|
@@ -6675,14 +6814,15 @@ export const logDebug = /*#__PURE__*/internal.logWithLevel("Debug");
|
|
|
6675
6814
|
* // timestamp=2023-... level=TRACE message="Exiting function processData"
|
|
6676
6815
|
* ```
|
|
6677
6816
|
*
|
|
6678
|
-
* @since 2.0.0
|
|
6679
6817
|
* @category Logging
|
|
6818
|
+
* @since 2.0.0
|
|
6680
6819
|
*/
|
|
6681
6820
|
export const logTrace = /*#__PURE__*/internal.logWithLevel("Trace");
|
|
6682
6821
|
/**
|
|
6683
6822
|
* Adds a logger to the set of loggers which will output logs for this effect.
|
|
6684
6823
|
*
|
|
6685
|
-
*
|
|
6824
|
+
* **Example** (Usage)
|
|
6825
|
+
*
|
|
6686
6826
|
* ```ts
|
|
6687
6827
|
* import { Effect, Logger } from "effect"
|
|
6688
6828
|
*
|
|
@@ -6703,14 +6843,15 @@ export const logTrace = /*#__PURE__*/internal.logWithLevel("Trace");
|
|
|
6703
6843
|
* // Output includes both default and custom log outputs
|
|
6704
6844
|
* ```
|
|
6705
6845
|
*
|
|
6706
|
-
* @since 2.0.0
|
|
6707
6846
|
* @category Logging
|
|
6847
|
+
* @since 2.0.0
|
|
6708
6848
|
*/
|
|
6709
6849
|
export const withLogger = /*#__PURE__*/dual(2, (effect, logger) => internal.updateService(effect, internal.CurrentLoggers, loggers => new Set([...loggers, logger])));
|
|
6710
6850
|
/**
|
|
6711
6851
|
* Adds an annotation to each log line in this effect.
|
|
6712
6852
|
*
|
|
6713
|
-
*
|
|
6853
|
+
* **Example** (Usage)
|
|
6854
|
+
*
|
|
6714
6855
|
* ```ts
|
|
6715
6856
|
* import { Effect } from "effect"
|
|
6716
6857
|
*
|
|
@@ -6733,8 +6874,8 @@ export const withLogger = /*#__PURE__*/dual(2, (effect, logger) => internal.upda
|
|
|
6733
6874
|
* // All log messages will include the userId and operation annotations
|
|
6734
6875
|
* ```
|
|
6735
6876
|
*
|
|
6736
|
-
* @since 2.0.0
|
|
6737
6877
|
* @category Logging
|
|
6878
|
+
* @since 2.0.0
|
|
6738
6879
|
*/
|
|
6739
6880
|
export const annotateLogs = /*#__PURE__*/dual(args => isEffect(args[0]), (effect, ...args) => internal.updateService(effect, CurrentLogAnnotations, annotations => {
|
|
6740
6881
|
const newAnnotations = {
|
|
@@ -6754,7 +6895,8 @@ export const annotateLogs = /*#__PURE__*/dual(args => isEffect(args[0]), (effect
|
|
|
6754
6895
|
* `annotateLogsScoped` updates annotations for the entire current `Scope` and
|
|
6755
6896
|
* restores the previous annotations when the scope closes.
|
|
6756
6897
|
*
|
|
6757
|
-
*
|
|
6898
|
+
* **Example** (Usage)
|
|
6899
|
+
*
|
|
6758
6900
|
* ```ts
|
|
6759
6901
|
* import { Effect } from "effect"
|
|
6760
6902
|
*
|
|
@@ -6769,14 +6911,15 @@ export const annotateLogs = /*#__PURE__*/dual(args => isEffect(args[0]), (effect
|
|
|
6769
6911
|
* Effect.runPromise(program)
|
|
6770
6912
|
* ```
|
|
6771
6913
|
*
|
|
6772
|
-
* @since 4.0.0
|
|
6773
6914
|
* @category Logging
|
|
6915
|
+
* @since 4.0.0
|
|
6774
6916
|
*/
|
|
6775
6917
|
export const annotateLogsScoped = internal.annotateLogsScoped;
|
|
6776
6918
|
/**
|
|
6777
6919
|
* Adds a span to each log line in this effect.
|
|
6778
6920
|
*
|
|
6779
|
-
*
|
|
6921
|
+
* **Example** (Usage)
|
|
6922
|
+
*
|
|
6780
6923
|
* ```ts
|
|
6781
6924
|
* import { Effect } from "effect"
|
|
6782
6925
|
*
|
|
@@ -6800,8 +6943,8 @@ export const annotateLogsScoped = internal.annotateLogsScoped;
|
|
|
6800
6943
|
* // All log messages will include span information showing the nested operation context
|
|
6801
6944
|
* ```
|
|
6802
6945
|
*
|
|
6803
|
-
* @since 2.0.0
|
|
6804
6946
|
* @category Logging
|
|
6947
|
+
* @since 2.0.0
|
|
6805
6948
|
*/
|
|
6806
6949
|
export const withLogSpan = /*#__PURE__*/dual(2, (effect, label) => internal.flatMap(internal.currentTimeMillis, now => internal.updateService(effect, CurrentLogSpans, spans => {
|
|
6807
6950
|
const span = [label, now];
|
|
@@ -6816,7 +6959,8 @@ export const withLogSpan = /*#__PURE__*/dual(2, (effect, label) => internal.flat
|
|
|
6816
6959
|
* Also accepts an optional function which can be used to map the `Exit` value
|
|
6817
6960
|
* of the `Effect` into a valid `Input` for the `Metric`.
|
|
6818
6961
|
*
|
|
6819
|
-
*
|
|
6962
|
+
* **Example** (Usage)
|
|
6963
|
+
*
|
|
6820
6964
|
* ```ts
|
|
6821
6965
|
* import { Effect, Metric } from "effect"
|
|
6822
6966
|
*
|
|
@@ -6835,7 +6979,8 @@ export const withLogSpan = /*#__PURE__*/dual(2, (effect, label) => internal.flat
|
|
|
6835
6979
|
* )
|
|
6836
6980
|
* ```
|
|
6837
6981
|
*
|
|
6838
|
-
*
|
|
6982
|
+
* **Example** (Usage)
|
|
6983
|
+
*
|
|
6839
6984
|
* ```ts
|
|
6840
6985
|
* import { Effect, Exit, Metric } from "effect"
|
|
6841
6986
|
*
|
|
@@ -6855,8 +7000,8 @@ export const withLogSpan = /*#__PURE__*/dual(2, (effect, label) => internal.flat
|
|
|
6855
7000
|
* )
|
|
6856
7001
|
* ```
|
|
6857
7002
|
*
|
|
6858
|
-
* @since 4.0.0
|
|
6859
7003
|
* @category Tracking
|
|
7004
|
+
* @since 4.0.0
|
|
6860
7005
|
*/
|
|
6861
7006
|
export const track = /*#__PURE__*/dual(args => isEffect(args[0]), (self, metric, f) => onExit(self, exit => {
|
|
6862
7007
|
const input = f === undefined ? exit : internalCall(() => f(exit));
|
|
@@ -6869,7 +7014,8 @@ export const track = /*#__PURE__*/dual(args => isEffect(args[0]), (self, metric,
|
|
|
6869
7014
|
* Also accepts an optional function which can be used to map the success value
|
|
6870
7015
|
* of the `Effect` into a valid `Input` for the `Metric`.
|
|
6871
7016
|
*
|
|
6872
|
-
*
|
|
7017
|
+
* **Example** (Usage)
|
|
7018
|
+
*
|
|
6873
7019
|
* ```ts
|
|
6874
7020
|
* import { Effect, Metric } from "effect"
|
|
6875
7021
|
*
|
|
@@ -6887,7 +7033,8 @@ export const track = /*#__PURE__*/dual(args => isEffect(args[0]), (self, metric,
|
|
|
6887
7033
|
* )
|
|
6888
7034
|
* ```
|
|
6889
7035
|
*
|
|
6890
|
-
*
|
|
7036
|
+
* **Example** (Usage)
|
|
7037
|
+
*
|
|
6891
7038
|
* ```ts
|
|
6892
7039
|
* import { Effect, Metric } from "effect"
|
|
6893
7040
|
*
|
|
@@ -6904,8 +7051,8 @@ export const track = /*#__PURE__*/dual(args => isEffect(args[0]), (self, metric,
|
|
|
6904
7051
|
* )
|
|
6905
7052
|
* ```
|
|
6906
7053
|
*
|
|
6907
|
-
* @since 4.0.0
|
|
6908
7054
|
* @category Tracking
|
|
7055
|
+
* @since 4.0.0
|
|
6909
7056
|
*/
|
|
6910
7057
|
export const trackSuccesses = /*#__PURE__*/dual(args => isEffect(args[0]), (self, metric, f) => tap(self, value => {
|
|
6911
7058
|
const input = f === undefined ? value : f(value);
|
|
@@ -6918,7 +7065,8 @@ export const trackSuccesses = /*#__PURE__*/dual(args => isEffect(args[0]), (self
|
|
|
6918
7065
|
* Also accepts an optional function which can be used to map the error value
|
|
6919
7066
|
* of the `Effect` into a valid `Input` for the `Metric`.
|
|
6920
7067
|
*
|
|
6921
|
-
*
|
|
7068
|
+
* **Example** (Usage)
|
|
7069
|
+
*
|
|
6922
7070
|
* ```ts
|
|
6923
7071
|
* import { Effect, Metric } from "effect"
|
|
6924
7072
|
*
|
|
@@ -6936,7 +7084,8 @@ export const trackSuccesses = /*#__PURE__*/dual(args => isEffect(args[0]), (self
|
|
|
6936
7084
|
* )
|
|
6937
7085
|
* ```
|
|
6938
7086
|
*
|
|
6939
|
-
*
|
|
7087
|
+
* **Example** (Usage)
|
|
7088
|
+
*
|
|
6940
7089
|
* ```ts
|
|
6941
7090
|
* import { Data, Effect, Metric } from "effect"
|
|
6942
7091
|
*
|
|
@@ -6955,8 +7104,8 @@ export const trackSuccesses = /*#__PURE__*/dual(args => isEffect(args[0]), (self
|
|
|
6955
7104
|
* )
|
|
6956
7105
|
* ```
|
|
6957
7106
|
*
|
|
6958
|
-
* @since 4.0.0
|
|
6959
7107
|
* @category Tracking
|
|
7108
|
+
* @since 4.0.0
|
|
6960
7109
|
*/
|
|
6961
7110
|
export const trackErrors = /*#__PURE__*/dual(args => isEffect(args[0]), (self, metric, f) => tapError(self, error => {
|
|
6962
7111
|
const input = f === undefined ? error : internalCall(() => f(error));
|
|
@@ -6969,7 +7118,8 @@ export const trackErrors = /*#__PURE__*/dual(args => isEffect(args[0]), (self, m
|
|
|
6969
7118
|
* Also accepts an optional function which can be used to map the defect value
|
|
6970
7119
|
* of the `Effect` into a valid `Input` for the `Metric`.
|
|
6971
7120
|
*
|
|
6972
|
-
*
|
|
7121
|
+
* **Example** (Usage)
|
|
7122
|
+
*
|
|
6973
7123
|
* ```ts
|
|
6974
7124
|
* import { Effect, Metric } from "effect"
|
|
6975
7125
|
*
|
|
@@ -6987,7 +7137,8 @@ export const trackErrors = /*#__PURE__*/dual(args => isEffect(args[0]), (self, m
|
|
|
6987
7137
|
* )
|
|
6988
7138
|
* ```
|
|
6989
7139
|
*
|
|
6990
|
-
*
|
|
7140
|
+
* **Example** (Usage)
|
|
7141
|
+
*
|
|
6991
7142
|
* ```ts
|
|
6992
7143
|
* import { Effect, Metric } from "effect"
|
|
6993
7144
|
*
|
|
@@ -7007,8 +7158,8 @@ export const trackErrors = /*#__PURE__*/dual(args => isEffect(args[0]), (self, m
|
|
|
7007
7158
|
* )
|
|
7008
7159
|
* ```
|
|
7009
7160
|
*
|
|
7010
|
-
* @since 4.0.0
|
|
7011
7161
|
* @category Tracking
|
|
7162
|
+
* @since 4.0.0
|
|
7012
7163
|
*/
|
|
7013
7164
|
export const trackDefects = /*#__PURE__*/dual(args => isEffect(args[0]), (self, metric, f) => tapDefect(self, defect => {
|
|
7014
7165
|
const input = f === undefined ? defect : internalCall(() => f(defect));
|
|
@@ -7022,7 +7173,8 @@ export const trackDefects = /*#__PURE__*/dual(args => isEffect(args[0]), (self,
|
|
|
7022
7173
|
* that the wrapped `Effect` took to complete into a valid `Input` for the
|
|
7023
7174
|
* `Metric`.
|
|
7024
7175
|
*
|
|
7025
|
-
*
|
|
7176
|
+
* **Example** (Usage)
|
|
7177
|
+
*
|
|
7026
7178
|
* ```ts
|
|
7027
7179
|
* import { Effect, Metric } from "effect"
|
|
7028
7180
|
*
|
|
@@ -7038,7 +7190,8 @@ export const trackDefects = /*#__PURE__*/dual(args => isEffect(args[0]), (self,
|
|
|
7038
7190
|
* )
|
|
7039
7191
|
* ```
|
|
7040
7192
|
*
|
|
7041
|
-
*
|
|
7193
|
+
* **Example** (Usage)
|
|
7194
|
+
*
|
|
7042
7195
|
* ```ts
|
|
7043
7196
|
* import { Duration, Effect, Metric } from "effect"
|
|
7044
7197
|
*
|
|
@@ -7055,8 +7208,8 @@ export const trackDefects = /*#__PURE__*/dual(args => isEffect(args[0]), (self,
|
|
|
7055
7208
|
* )
|
|
7056
7209
|
* ```
|
|
7057
7210
|
*
|
|
7058
|
-
* @since 4.0.0
|
|
7059
7211
|
* @category Tracking
|
|
7212
|
+
* @since 4.0.0
|
|
7060
7213
|
*/
|
|
7061
7214
|
export const trackDuration = /*#__PURE__*/dual(args => isEffect(args[0]), (self, metric, f) => clockWith(clock => {
|
|
7062
7215
|
const startTime = clock.currentTimeNanosUnsafe();
|
|
@@ -7076,7 +7229,8 @@ export const trackDuration = /*#__PURE__*/dual(args => isEffect(args[0]), (self,
|
|
|
7076
7229
|
* - a journal that stores any non committed change to TxRef values
|
|
7077
7230
|
* - a retry flag to know if the transaction should be retried
|
|
7078
7231
|
*
|
|
7079
|
-
*
|
|
7232
|
+
* **Example** (Usage)
|
|
7233
|
+
*
|
|
7080
7234
|
* ```ts
|
|
7081
7235
|
* import { Effect } from "effect"
|
|
7082
7236
|
*
|
|
@@ -7088,8 +7242,8 @@ export const trackDuration = /*#__PURE__*/dual(args => isEffect(args[0]), (self,
|
|
|
7088
7242
|
* })
|
|
7089
7243
|
* ```
|
|
7090
7244
|
*
|
|
7091
|
-
* @since 4.0.0
|
|
7092
7245
|
* @category Transactions
|
|
7246
|
+
* @since 4.0.0
|
|
7093
7247
|
*/
|
|
7094
7248
|
export class Transaction extends /*#__PURE__*/Context.Service()("effect/Effect/Transaction") {}
|
|
7095
7249
|
/**
|
|
@@ -7110,7 +7264,8 @@ export class Transaction extends /*#__PURE__*/Context.Service()("effect/Effect/T
|
|
|
7110
7264
|
* The outermost `tx` call creates the transaction boundary and commits or rolls back the full
|
|
7111
7265
|
* composed transaction.
|
|
7112
7266
|
*
|
|
7113
|
-
*
|
|
7267
|
+
* **Example** (Usage)
|
|
7268
|
+
*
|
|
7114
7269
|
* ```ts
|
|
7115
7270
|
* import { Effect, TxRef } from "effect"
|
|
7116
7271
|
*
|
|
@@ -7131,8 +7286,8 @@ export class Transaction extends /*#__PURE__*/Context.Service()("effect/Effect/T
|
|
|
7131
7286
|
* })
|
|
7132
7287
|
* ```
|
|
7133
7288
|
*
|
|
7134
|
-
* @since 4.0.0
|
|
7135
7289
|
* @category Transactions
|
|
7290
|
+
* @since 4.0.0
|
|
7136
7291
|
*/
|
|
7137
7292
|
export const tx = effect => withFiber(fiber => {
|
|
7138
7293
|
if (fiber.context.mapUnsafe.has(Transaction.key)) {
|
|
@@ -7215,10 +7370,10 @@ function clearTransaction(state) {
|
|
|
7215
7370
|
*
|
|
7216
7371
|
* NOTE: the transaction retries on any change to transactional values (i.e. TxRef) accessed in its body.
|
|
7217
7372
|
*
|
|
7218
|
-
* @since 4.0.0
|
|
7219
7373
|
* @category Transactions
|
|
7374
|
+
* @since 4.0.0
|
|
7220
7375
|
*
|
|
7221
|
-
*
|
|
7376
|
+
* **Example** (Usage)
|
|
7222
7377
|
*
|
|
7223
7378
|
* ```ts
|
|
7224
7379
|
* import { Effect, TxRef } from "effect"
|
|
@@ -7252,9 +7407,19 @@ export const txRetry = /*#__PURE__*/flatMap(Transaction, state => {
|
|
|
7252
7407
|
return interrupt;
|
|
7253
7408
|
});
|
|
7254
7409
|
/**
|
|
7255
|
-
* Converts
|
|
7410
|
+
* Converts an error-first callback API into a function that returns an
|
|
7411
|
+
* `Effect`.
|
|
7412
|
+
*
|
|
7413
|
+
* **Details**
|
|
7414
|
+
*
|
|
7415
|
+
* The original function is called with the supplied arguments plus a final
|
|
7416
|
+
* callback. A non-null callback error fails the returned effect, while a
|
|
7417
|
+
* successful callback value becomes the effect success. Use `onError` to map
|
|
7418
|
+
* callback errors and `onSyncError` to turn synchronous throws into typed
|
|
7419
|
+
* failures; otherwise synchronous throws become defects.
|
|
7420
|
+
*
|
|
7421
|
+
* **Example** (Basic Usage)
|
|
7256
7422
|
*
|
|
7257
|
-
* @example Basic Usage
|
|
7258
7423
|
* ```ts
|
|
7259
7424
|
* import { Effect } from "effect"
|
|
7260
7425
|
* import * as fs from "fs"
|
|
@@ -7269,7 +7434,8 @@ export const txRetry = /*#__PURE__*/flatMap(Transaction, state => {
|
|
|
7269
7434
|
* // Output: contents of package.json
|
|
7270
7435
|
* ```
|
|
7271
7436
|
*
|
|
7272
|
-
*
|
|
7437
|
+
* **Example** (Custom Error Handling)
|
|
7438
|
+
*
|
|
7273
7439
|
* ```ts
|
|
7274
7440
|
* import { Effect } from "effect"
|
|
7275
7441
|
* import * as fs from "fs"
|
|
@@ -7285,8 +7451,8 @@ export const txRetry = /*#__PURE__*/flatMap(Transaction, state => {
|
|
|
7285
7451
|
* // Output: Exit.failure with custom error message
|
|
7286
7452
|
* ```
|
|
7287
7453
|
*
|
|
7288
|
-
* @since 4.0.0
|
|
7289
7454
|
* @category Effectify
|
|
7455
|
+
* @since 4.0.0
|
|
7290
7456
|
*/
|
|
7291
7457
|
export const effectify = (fn, onError, onSyncError) => (...args) => callback(resume => {
|
|
7292
7458
|
try {
|
|
@@ -7310,7 +7476,8 @@ export const effectify = (fn, onError, onSyncError) => (...args) => callback(res
|
|
|
7310
7476
|
* This function provides compile-time type checking to ensure that the success
|
|
7311
7477
|
* value of an effect conforms to a specific type constraint.
|
|
7312
7478
|
*
|
|
7313
|
-
*
|
|
7479
|
+
* **Example** (Usage)
|
|
7480
|
+
*
|
|
7314
7481
|
* ```ts
|
|
7315
7482
|
* import { Effect } from "effect"
|
|
7316
7483
|
*
|
|
@@ -7326,8 +7493,8 @@ export const effectify = (fn, onError, onSyncError) => (...args) => callback(res
|
|
|
7326
7493
|
* // Type 'string' is not assignable to type 'number'
|
|
7327
7494
|
* ```
|
|
7328
7495
|
*
|
|
7329
|
-
* @since 4.0.0
|
|
7330
7496
|
* @category Type Constraints
|
|
7497
|
+
* @since 4.0.0
|
|
7331
7498
|
*/
|
|
7332
7499
|
export const satisfiesSuccessType = () => effect => effect;
|
|
7333
7500
|
/**
|
|
@@ -7336,7 +7503,8 @@ export const satisfiesSuccessType = () => effect => effect;
|
|
|
7336
7503
|
* This function provides compile-time type checking to ensure that the error
|
|
7337
7504
|
* type of an effect conforms to a specific type constraint.
|
|
7338
7505
|
*
|
|
7339
|
-
*
|
|
7506
|
+
* **Example** (Usage)
|
|
7507
|
+
*
|
|
7340
7508
|
* ```ts
|
|
7341
7509
|
* import { Data, Effect } from "effect"
|
|
7342
7510
|
*
|
|
@@ -7354,8 +7522,8 @@ export const satisfiesSuccessType = () => effect => effect;
|
|
|
7354
7522
|
* // Type 'string' is not assignable to type 'ValidationError'
|
|
7355
7523
|
* ```
|
|
7356
7524
|
*
|
|
7357
|
-
* @since 4.0.0
|
|
7358
7525
|
* @category Type Constraints
|
|
7526
|
+
* @since 4.0.0
|
|
7359
7527
|
*/
|
|
7360
7528
|
export const satisfiesErrorType = () => effect => effect;
|
|
7361
7529
|
/**
|
|
@@ -7364,7 +7532,8 @@ export const satisfiesErrorType = () => effect => effect;
|
|
|
7364
7532
|
* This function provides compile-time type checking to ensure that the
|
|
7365
7533
|
* requirements (context) type of an effect conforms to a specific type constraint.
|
|
7366
7534
|
*
|
|
7367
|
-
*
|
|
7535
|
+
* **Example** (Usage)
|
|
7536
|
+
*
|
|
7368
7537
|
* ```ts
|
|
7369
7538
|
* import { Effect } from "effect"
|
|
7370
7539
|
*
|
|
@@ -7380,8 +7549,8 @@ export const satisfiesErrorType = () => effect => effect;
|
|
|
7380
7549
|
* // const constrainedInvalid = satisfiesStringServices(invalidEffect)
|
|
7381
7550
|
* ```
|
|
7382
7551
|
*
|
|
7383
|
-
* @since 4.0.0
|
|
7384
7552
|
* @category Type Constraints
|
|
7553
|
+
* @since 4.0.0
|
|
7385
7554
|
*/
|
|
7386
7555
|
export const satisfiesServicesType = () => effect => effect;
|
|
7387
7556
|
/**
|
|
@@ -7400,7 +7569,8 @@ export const satisfiesServicesType = () => effect => effect;
|
|
|
7400
7569
|
* - For **Failure effects**: Returns the failure as-is without applying the mapping
|
|
7401
7570
|
* - For **Pending effects**: Falls back to the regular `map` behavior
|
|
7402
7571
|
*
|
|
7403
|
-
*
|
|
7572
|
+
* **Example** (Usage)
|
|
7573
|
+
*
|
|
7404
7574
|
* ```ts
|
|
7405
7575
|
* import { Effect } from "effect"
|
|
7406
7576
|
*
|
|
@@ -7413,8 +7583,8 @@ export const satisfiesServicesType = () => effect => effect;
|
|
|
7413
7583
|
* const mappedPending = Effect.mapEager(pending, (n) => n * 2) // Uses regular map
|
|
7414
7584
|
* ```
|
|
7415
7585
|
*
|
|
7416
|
-
* @since 4.0.0
|
|
7417
7586
|
* @category Eager
|
|
7587
|
+
* @since 4.0.0
|
|
7418
7588
|
*/
|
|
7419
7589
|
export const mapEager = internal.mapEager;
|
|
7420
7590
|
/**
|
|
@@ -7433,7 +7603,8 @@ export const mapEager = internal.mapEager;
|
|
|
7433
7603
|
* - For **Failure effects**: Applies the mapping function immediately to the error
|
|
7434
7604
|
* - For **Pending effects**: Falls back to the regular `mapError` behavior
|
|
7435
7605
|
*
|
|
7436
|
-
*
|
|
7606
|
+
* **Example** (Usage)
|
|
7607
|
+
*
|
|
7437
7608
|
* ```ts
|
|
7438
7609
|
* import { Effect } from "effect"
|
|
7439
7610
|
*
|
|
@@ -7449,8 +7620,8 @@ export const mapEager = internal.mapEager;
|
|
|
7449
7620
|
* ) // Uses regular mapError
|
|
7450
7621
|
* ```
|
|
7451
7622
|
*
|
|
7452
|
-
* @since 4.0.0
|
|
7453
7623
|
* @category Eager
|
|
7624
|
+
* @since 4.0.0
|
|
7454
7625
|
*/
|
|
7455
7626
|
export const mapErrorEager = internal.mapErrorEager;
|
|
7456
7627
|
/**
|
|
@@ -7469,7 +7640,8 @@ export const mapErrorEager = internal.mapErrorEager;
|
|
|
7469
7640
|
* - For **Failure effects**: Applies the `onFailure` function immediately to the error
|
|
7470
7641
|
* - For **Pending effects**: Falls back to the regular `mapBoth` behavior
|
|
7471
7642
|
*
|
|
7472
|
-
*
|
|
7643
|
+
* **Example** (Usage)
|
|
7644
|
+
*
|
|
7473
7645
|
* ```ts
|
|
7474
7646
|
* import { Effect } from "effect"
|
|
7475
7647
|
*
|
|
@@ -7487,8 +7659,8 @@ export const mapErrorEager = internal.mapErrorEager;
|
|
|
7487
7659
|
* }) // onFailure applied eagerly
|
|
7488
7660
|
* ```
|
|
7489
7661
|
*
|
|
7490
|
-
* @since 4.0.0
|
|
7491
7662
|
* @category Eager
|
|
7663
|
+
* @since 4.0.0
|
|
7492
7664
|
*/
|
|
7493
7665
|
export const mapBothEager = internal.mapBothEager;
|
|
7494
7666
|
/**
|
|
@@ -7507,7 +7679,8 @@ export const mapBothEager = internal.mapBothEager;
|
|
|
7507
7679
|
* - For **Failure effects**: Returns the failure as-is without applying the flatMap
|
|
7508
7680
|
* - For **Pending effects**: Falls back to the regular `flatMap` behavior
|
|
7509
7681
|
*
|
|
7510
|
-
*
|
|
7682
|
+
* **Example** (Usage)
|
|
7683
|
+
*
|
|
7511
7684
|
* ```ts
|
|
7512
7685
|
* import { Effect } from "effect"
|
|
7513
7686
|
*
|
|
@@ -7523,8 +7696,8 @@ export const mapBothEager = internal.mapBothEager;
|
|
|
7523
7696
|
* ) // Uses regular flatMap
|
|
7524
7697
|
* ```
|
|
7525
7698
|
*
|
|
7526
|
-
* @since 4.0.0
|
|
7527
7699
|
* @category Eager
|
|
7700
|
+
* @since 4.0.0
|
|
7528
7701
|
*/
|
|
7529
7702
|
export const flatMapEager = internal.flatMapEager;
|
|
7530
7703
|
/**
|
|
@@ -7543,7 +7716,8 @@ export const flatMapEager = internal.flatMapEager;
|
|
|
7543
7716
|
* - For **Failure effects**: Applies the catch function immediately to the error
|
|
7544
7717
|
* - For **Pending effects**: Falls back to the regular `catch` behavior
|
|
7545
7718
|
*
|
|
7546
|
-
*
|
|
7719
|
+
* **Example** (Usage)
|
|
7720
|
+
*
|
|
7547
7721
|
* ```ts
|
|
7548
7722
|
* import { Effect } from "effect"
|
|
7549
7723
|
*
|
|
@@ -7569,8 +7743,8 @@ export const flatMapEager = internal.flatMapEager;
|
|
|
7569
7743
|
* ) // Uses regular catch
|
|
7570
7744
|
* ```
|
|
7571
7745
|
*
|
|
7572
|
-
* @since 4.0.0
|
|
7573
7746
|
* @category Eager
|
|
7747
|
+
* @since 4.0.0
|
|
7574
7748
|
*/
|
|
7575
7749
|
export const catchEager = internal.catchEager;
|
|
7576
7750
|
/**
|
|
@@ -7579,7 +7753,8 @@ export const catchEager = internal.catchEager;
|
|
|
7579
7753
|
* Executes generator functions eagerly when all yielded effects are synchronous,
|
|
7580
7754
|
* stopping at the first async effect and deferring to normal execution.
|
|
7581
7755
|
*
|
|
7582
|
-
*
|
|
7756
|
+
* **Example** (Usage)
|
|
7757
|
+
*
|
|
7583
7758
|
* ```ts
|
|
7584
7759
|
* import { Effect } from "effect"
|
|
7585
7760
|
*
|
|
@@ -7592,8 +7767,8 @@ export const catchEager = internal.catchEager;
|
|
|
7592
7767
|
* const effect = computation() // Executed immediately if all effects are sync
|
|
7593
7768
|
* ```
|
|
7594
7769
|
*
|
|
7595
|
-
* @since 4.0.0
|
|
7596
7770
|
* @category Eager
|
|
7771
|
+
* @since 4.0.0
|
|
7597
7772
|
*/
|
|
7598
7773
|
export const fnUntracedEager = internal.fnUntracedEager;
|
|
7599
7774
|
//# sourceMappingURL=Effect.js.map
|