effect 4.0.0-beta.66 → 4.0.0-beta.68
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 +151 -106
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +50 -40
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +620 -553
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +298 -254
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts +342 -274
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +168 -126
- package/dist/BigInt.js.map +1 -1
- package/dist/Boolean.d.ts +189 -156
- package/dist/Boolean.d.ts.map +1 -1
- package/dist/Boolean.js +85 -68
- package/dist/Boolean.js.map +1 -1
- package/dist/Brand.d.ts +30 -5
- package/dist/Brand.d.ts.map +1 -1
- package/dist/Brand.js +19 -2
- package/dist/Brand.js.map +1 -1
- package/dist/Cache.d.ts +239 -135
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +135 -59
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +84 -73
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Cause.js +51 -44
- package/dist/Cause.js.map +1 -1
- package/dist/Channel.d.ts +1568 -632
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +685 -315
- 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 +574 -428
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +250 -191
- package/dist/Chunk.js.map +1 -1
- package/dist/Clock.d.ts +16 -9
- package/dist/Clock.d.ts.map +1 -1
- package/dist/Clock.js +9 -5
- package/dist/Clock.js.map +1 -1
- package/dist/Combiner.d.ts +11 -5
- package/dist/Combiner.d.ts.map +1 -1
- package/dist/Combiner.js +10 -4
- package/dist/Combiner.js.map +1 -1
- package/dist/Config.d.ts +80 -68
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +53 -49
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +33 -32
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +19 -18
- package/dist/ConfigProvider.js.map +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 +400 -189
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +143 -77
- package/dist/Context.js.map +1 -1
- package/dist/Cron.d.ts +67 -48
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +94 -36
- package/dist/Cron.js.map +1 -1
- package/dist/Crypto.d.ts +208 -0
- package/dist/Crypto.d.ts.map +1 -0
- package/dist/Crypto.js +157 -0
- package/dist/Crypto.js.map +1 -0
- package/dist/Data.d.ts +9 -3
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js.map +1 -1
- package/dist/DateTime.d.ts +893 -464
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +387 -228
- package/dist/DateTime.js.map +1 -1
- package/dist/Deferred.d.ts +367 -175
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +146 -72
- package/dist/Deferred.js.map +1 -1
- package/dist/Differ.d.ts +44 -2
- package/dist/Differ.d.ts.map +1 -1
- package/dist/Differ.js +36 -0
- package/dist/Duration.d.ts +333 -186
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +178 -107
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +2181 -2275
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +935 -850
- package/dist/Effect.js.map +1 -1
- package/dist/Effectable.d.ts +38 -3
- package/dist/Effectable.d.ts.map +1 -1
- package/dist/Effectable.js +3 -3
- 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/Equal.d.ts +4 -3
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +4 -3
- package/dist/Equal.js.map +1 -1
- package/dist/Equivalence.d.ts +18 -24
- package/dist/Equivalence.d.ts.map +1 -1
- package/dist/Equivalence.js +16 -21
- 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 +106 -12
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/ExecutionPlan.js +23 -6
- package/dist/ExecutionPlan.js.map +1 -1
- package/dist/Exit.d.ts +6 -5
- package/dist/Exit.d.ts.map +1 -1
- package/dist/Exit.js.map +1 -1
- package/dist/Fiber.d.ts +71 -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 +118 -57
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +121 -39
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +287 -159
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +175 -73
- package/dist/FiberMap.js.map +1 -1
- package/dist/FiberSet.d.ts +93 -52
- package/dist/FiberSet.d.ts.map +1 -1
- package/dist/FiberSet.js +97 -34
- package/dist/FiberSet.js.map +1 -1
- package/dist/FileSystem.d.ts +102 -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/Formatter.d.ts +4 -2
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +3 -69
- package/dist/Formatter.js.map +1 -1
- package/dist/Function.d.ts +218 -151
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +94 -78
- package/dist/Function.js.map +1 -1
- package/dist/Graph.d.ts +714 -415
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +325 -182
- 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 +35 -24
- package/dist/Hash.d.ts.map +1 -1
- package/dist/Hash.js +27 -17
- package/dist/Hash.js.map +1 -1
- package/dist/HashMap.d.ts +540 -388
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashMap.js +262 -156
- package/dist/HashMap.js.map +1 -1
- package/dist/HashRing.d.ts +53 -34
- package/dist/HashRing.d.ts.map +1 -1
- package/dist/HashRing.js +83 -16
- package/dist/HashRing.js.map +1 -1
- package/dist/HashSet.d.ts +239 -153
- package/dist/HashSet.d.ts.map +1 -1
- package/dist/HashSet.js +110 -56
- package/dist/HashSet.js.map +1 -1
- package/dist/Inspectable.d.ts +26 -13
- package/dist/Inspectable.d.ts.map +1 -1
- package/dist/Inspectable.js +22 -10
- package/dist/Inspectable.js.map +1 -1
- package/dist/Iterable.d.ts +336 -222
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +146 -100
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonPatch.d.ts +12 -9
- package/dist/JsonPatch.d.ts.map +1 -1
- package/dist/JsonPatch.js +9 -6
- package/dist/JsonPatch.js.map +1 -1
- package/dist/JsonPointer.d.ts +13 -11
- package/dist/JsonPointer.d.ts.map +1 -1
- package/dist/JsonPointer.js +13 -11
- package/dist/JsonPointer.js.map +1 -1
- package/dist/JsonSchema.d.ts +16 -0
- package/dist/JsonSchema.d.ts.map +1 -1
- package/dist/JsonSchema.js +10 -0
- package/dist/JsonSchema.js.map +1 -1
- package/dist/Latch.d.ts +97 -26
- package/dist/Latch.d.ts.map +1 -1
- package/dist/Latch.js +39 -20
- package/dist/Latch.js.map +1 -1
- package/dist/Layer.d.ts +472 -410
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +290 -226
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +99 -26
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +58 -14
- 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 +159 -104
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +215 -189
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +78 -19
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/ManagedRuntime.js +24 -17
- package/dist/ManagedRuntime.js.map +1 -1
- package/dist/Match.d.ts +135 -161
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js +86 -78
- package/dist/Match.js.map +1 -1
- package/dist/Metric.d.ts +330 -291
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +219 -214
- package/dist/Metric.js.map +1 -1
- package/dist/MutableHashMap.d.ts +146 -87
- package/dist/MutableHashMap.d.ts.map +1 -1
- package/dist/MutableHashMap.js +67 -43
- 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 +92 -38
- package/dist/MutableHashSet.js.map +1 -1
- package/dist/MutableList.d.ts +110 -68
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +135 -85
- 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 +78 -60
- package/dist/MutableRef.js.map +1 -1
- package/dist/Newtype.d.ts +15 -2
- package/dist/Newtype.d.ts.map +1 -1
- package/dist/Newtype.js +8 -2
- package/dist/Newtype.js.map +1 -1
- package/dist/NonEmptyIterable.d.ts +38 -48
- package/dist/NonEmptyIterable.d.ts.map +1 -1
- package/dist/NonEmptyIterable.js +34 -25
- package/dist/NonEmptyIterable.js.map +1 -1
- package/dist/Number.d.ts +261 -205
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +119 -91
- package/dist/Number.js.map +1 -1
- package/dist/Optic.d.ts +6 -7
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +5 -6
- package/dist/Optic.js.map +1 -1
- package/dist/Option.d.ts +133 -156
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +64 -64
- package/dist/Option.js.map +1 -1
- package/dist/Order.d.ts +6 -6
- package/dist/Order.js +6 -6
- package/dist/Ordering.d.ts +56 -45
- package/dist/Ordering.d.ts.map +1 -1
- package/dist/Ordering.js +10 -8
- 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 +49 -4
- package/dist/Path.js.map +1 -1
- package/dist/Pipeable.d.ts +77 -18
- package/dist/Pipeable.d.ts.map +1 -1
- package/dist/Pipeable.js +63 -14
- 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 -23
- package/dist/Predicate.d.ts.map +1 -1
- package/dist/Predicate.js +12 -17
- package/dist/Predicate.js.map +1 -1
- package/dist/PrimaryKey.d.ts +11 -3
- package/dist/PrimaryKey.d.ts.map +1 -1
- package/dist/PrimaryKey.js +9 -2
- package/dist/PrimaryKey.js.map +1 -1
- package/dist/PubSub.d.ts +385 -309
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +260 -207
- 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 +303 -184
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +231 -134
- package/dist/Queue.js.map +1 -1
- package/dist/Random.d.ts +65 -57
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +41 -66
- 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 +68 -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 +282 -137
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +124 -62
- package/dist/Record.js.map +1 -1
- package/dist/Redactable.d.ts +7 -5
- package/dist/Redactable.d.ts.map +1 -1
- package/dist/Redactable.js +5 -3
- package/dist/Redactable.js.map +1 -1
- package/dist/Redacted.d.ts +63 -34
- package/dist/Redacted.d.ts.map +1 -1
- package/dist/Redacted.js +31 -15
- package/dist/Redacted.js.map +1 -1
- package/dist/Reducer.d.ts +3 -1
- package/dist/Reducer.d.ts.map +1 -1
- package/dist/Reducer.js +2 -0
- package/dist/Reducer.js.map +1 -1
- package/dist/Ref.d.ts +85 -66
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +57 -45
- 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 +12 -6
- package/dist/RegExp.d.ts.map +1 -1
- package/dist/RegExp.js +12 -6
- package/dist/RegExp.js.map +1 -1
- package/dist/Request.d.ts +159 -34
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js +68 -12
- package/dist/Request.js.map +1 -1
- package/dist/RequestResolver.d.ts +262 -118
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +78 -42
- 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 +135 -151
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +56 -68
- package/dist/Result.js.map +1 -1
- package/dist/Runtime.d.ts +40 -20
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +34 -17
- package/dist/Runtime.js.map +1 -1
- package/dist/Schedule.d.ts +556 -590
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +265 -253
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts +44 -7
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +34 -5
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +1293 -602
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +501 -361
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +122 -92
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +102 -77
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +49 -36
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +42 -29
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.d.ts +19 -24
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js +16 -14
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.d.ts +231 -63
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +266 -75
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +89 -77
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +47 -37
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +97 -46
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +89 -38
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/SchemaUtils.d.ts +8 -1
- package/dist/SchemaUtils.d.ts.map +1 -1
- package/dist/SchemaUtils.js +24 -1
- package/dist/SchemaUtils.js.map +1 -1
- package/dist/Scope.d.ts +107 -65
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +61 -32
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.d.ts +141 -49
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedCache.js +82 -21
- 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 +61 -37
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js +18 -21
- package/dist/Semaphore.js.map +1 -1
- package/dist/Sink.d.ts +461 -206
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +241 -90
- 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 +2117 -1541
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +951 -682
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +174 -97
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +128 -69
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts +20 -18
- package/dist/Struct.d.ts.map +1 -1
- package/dist/Struct.js +10 -8
- package/dist/Struct.js.map +1 -1
- package/dist/SubscriptionRef.d.ts +309 -204
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +126 -77
- 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 +233 -59
- 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 +280 -245
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js +116 -102
- package/dist/Trie.js.map +1 -1
- package/dist/Tuple.d.ts +34 -32
- package/dist/Tuple.d.ts.map +1 -1
- package/dist/Tuple.js +16 -14
- package/dist/Tuple.js.map +1 -1
- package/dist/TxChunk.d.ts +200 -155
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxChunk.js +83 -61
- 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 -223
- 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 +181 -111
- package/dist/TxHashSet.d.ts.map +1 -1
- package/dist/TxHashSet.js +87 -49
- package/dist/TxHashSet.js.map +1 -1
- package/dist/TxPriorityQueue.d.ts +94 -63
- package/dist/TxPriorityQueue.d.ts.map +1 -1
- package/dist/TxPriorityQueue.js +55 -37
- 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 +277 -242
- 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 -115
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +76 -77
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/TxSubscriptionRef.d.ts +74 -50
- package/dist/TxSubscriptionRef.d.ts.map +1 -1
- package/dist/TxSubscriptionRef.js +34 -23
- package/dist/TxSubscriptionRef.js.map +1 -1
- package/dist/Types.d.ts +31 -34
- package/dist/Types.d.ts.map +1 -1
- package/dist/UndefinedOr.d.ts +62 -25
- package/dist/UndefinedOr.d.ts.map +1 -1
- package/dist/UndefinedOr.js +36 -25
- package/dist/UndefinedOr.js.map +1 -1
- package/dist/Unify.d.ts +72 -117
- 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 +5 -2
- 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 +1973 -418
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1973 -418
- 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 +9 -6
- package/dist/testing/FastCheck.d.ts.map +1 -1
- package/dist/testing/FastCheck.js +9 -6
- package/dist/testing/FastCheck.js.map +1 -1
- package/dist/testing/TestClock.d.ts +39 -35
- 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 +44 -36
- package/dist/testing/TestConsole.d.ts.map +1 -1
- package/dist/testing/TestConsole.js +30 -15
- package/dist/testing/TestConsole.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +2 -0
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/testing/TestSchema.js +9 -7
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/testing/index.d.ts +34 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +34 -0
- package/dist/testing/index.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +205 -147
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +164 -109
- 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 +64 -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 +342 -119
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +266 -98
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +56 -20
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +64 -16
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Model.d.ts +10 -12
- package/dist/unstable/ai/Model.d.ts.map +1 -1
- package/dist/unstable/ai/Model.js +9 -7
- 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 +200 -176
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Prompt.js +77 -68
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +173 -160
- 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 +43 -33
- package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
- package/dist/unstable/ai/Telemetry.js +15 -11
- package/dist/unstable/ai/Telemetry.js.map +1 -1
- package/dist/unstable/ai/Tokenizer.d.ts +14 -9
- 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 +167 -96
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +107 -53
- 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 +121 -29
- package/dist/unstable/ai/index.d.ts.map +1 -1
- package/dist/unstable/ai/index.js +121 -29
- 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 +48 -19
- package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
- package/dist/unstable/cli/CliOutput.js +32 -9
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +196 -115
- 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 +39 -14
- 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 +110 -32
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +196 -135
- 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 +183 -59
- package/dist/unstable/cli/Prompt.d.ts.map +1 -1
- package/dist/unstable/cli/Prompt.js +105 -23
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/index.d.ts +182 -0
- package/dist/unstable/cli/index.d.ts.map +1 -1
- package/dist/unstable/cli/index.js +205 -6
- package/dist/unstable/cli/index.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/cli/internal/parser.js +0 -1
- package/dist/unstable/cli/internal/parser.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 +74 -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 +42 -14
- package/dist/unstable/cluster/EntityProxy.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxy.js +30 -14
- package/dist/unstable/cluster/EntityProxy.js.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.d.ts +18 -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 +126 -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 +76 -13
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +73 -12
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/ShardId.d.ts +53 -5
- package/dist/unstable/cluster/ShardId.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardId.js +49 -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 +90 -19
- package/dist/unstable/cluster/Snowflake.d.ts.map +1 -1
- package/dist/unstable/cluster/Snowflake.js +49 -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/index.d.ts +790 -0
- package/dist/unstable/cluster/index.d.ts.map +1 -1
- package/dist/unstable/cluster/index.js +790 -0
- package/dist/unstable/cluster/index.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/devtools/index.d.ts +58 -0
- package/dist/unstable/devtools/index.d.ts.map +1 -1
- package/dist/unstable/devtools/index.js +58 -0
- package/dist/unstable/devtools/index.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/encoding/index.d.ts +49 -0
- package/dist/unstable/encoding/index.d.ts.map +1 -1
- package/dist/unstable/encoding/index.js +49 -0
- package/dist/unstable/encoding/index.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 +150 -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/eventlog/index.d.ts +240 -0
- package/dist/unstable/eventlog/index.d.ts.map +1 -1
- package/dist/unstable/eventlog/index.js +240 -0
- package/dist/unstable/eventlog/index.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 +204 -96
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +85 -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 +48 -7
- package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js +45 -6
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMethod.d.ts +38 -6
- package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
- package/dist/unstable/http/HttpMethod.js +27 -2
- package/dist/unstable/http/HttpMethod.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts +38 -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 +209 -62
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +136 -41
- 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 +93 -10
- package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerError.js +85 -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 +391 -67
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +205 -33
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpStaticServer.d.ts +24 -8
- package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpStaticServer.js +24 -8
- 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 +179 -28
- package/dist/unstable/http/Multipart.d.ts.map +1 -1
- package/dist/unstable/http/Multipart.js +131 -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 -1
- 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 +70 -56
- package/dist/unstable/http/Url.d.ts.map +1 -1
- package/dist/unstable/http/Url.js +35 -21
- package/dist/unstable/http/Url.js.map +1 -1
- package/dist/unstable/http/UrlParams.d.ts +237 -51
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +120 -25
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/http/index.d.ts +452 -0
- package/dist/unstable/http/index.d.ts.map +1 -1
- package/dist/unstable/http/index.js +452 -0
- package/dist/unstable/http/index.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 +54 -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 +57 -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 +113 -22
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js +49 -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 +86 -38
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.js +59 -35
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts +73 -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 +4 -3
- package/dist/unstable/httpapi/HttpApiSwagger.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.js +23 -3
- 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/httpapi/index.d.ts +310 -25
- package/dist/unstable/httpapi/index.d.ts.map +1 -1
- package/dist/unstable/httpapi/index.js +310 -25
- package/dist/unstable/httpapi/index.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 +15 -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 +17 -5
- 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 +19 -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 +36 -16
- package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.js +9 -7
- package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
- package/dist/unstable/observability/index.d.ts +160 -3
- package/dist/unstable/observability/index.d.ts.map +1 -1
- package/dist/unstable/observability/index.js +160 -3
- 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 +98 -16
- package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistence.js +91 -14
- package/dist/unstable/persistence/Persistence.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +101 -21
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +85 -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/persistence/index.d.ts +147 -0
- package/dist/unstable/persistence/index.d.ts.map +1 -1
- package/dist/unstable/persistence/index.js +147 -0
- package/dist/unstable/persistence/index.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 +25 -18
- package/dist/unstable/process/ChildProcess.js.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.d.ts +23 -12
- 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 +198 -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 +544 -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 +94 -13
- package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
- package/dist/unstable/reactivity/Reactivity.js +60 -7
- package/dist/unstable/reactivity/Reactivity.js.map +1 -1
- package/dist/unstable/reactivity/index.d.ts +167 -0
- package/dist/unstable/reactivity/index.d.ts.map +1 -1
- package/dist/unstable/reactivity/index.js +167 -0
- package/dist/unstable/reactivity/index.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +254 -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 +80 -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 +39 -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 +10 -0
- package/dist/unstable/rpc/Utils.d.ts.map +1 -1
- package/dist/unstable/rpc/Utils.js +10 -0
- package/dist/unstable/rpc/Utils.js.map +1 -1
- package/dist/unstable/rpc/index.d.ts +272 -0
- package/dist/unstable/rpc/index.d.ts.map +1 -1
- package/dist/unstable/rpc/index.js +272 -0
- package/dist/unstable/rpc/index.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts +192 -59
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js +122 -38
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +101 -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/schema/index.d.ts +37 -0
- package/dist/unstable/schema/index.d.ts.map +1 -1
- package/dist/unstable/schema/index.js +37 -0
- package/dist/unstable/schema/index.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +168 -34
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +124 -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/socket/index.d.ts +44 -0
- package/dist/unstable/socket/index.d.ts.map +1 -1
- package/dist/unstable/socket/index.js +44 -0
- package/dist/unstable/socket/index.js.map +1 -1
- package/dist/unstable/sql/Migrator.d.ts +40 -9
- package/dist/unstable/sql/Migrator.d.ts.map +1 -1
- package/dist/unstable/sql/Migrator.js +45 -5
- package/dist/unstable/sql/Migrator.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts +38 -2
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +40 -1
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/sql/SqlConnection.d.ts +34 -3
- 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 +117 -0
- package/dist/unstable/sql/SqlError.d.ts.map +1 -1
- package/dist/unstable/sql/SqlError.js +131 -0
- package/dist/unstable/sql/SqlError.js.map +1 -1
- package/dist/unstable/sql/SqlModel.d.ts +25 -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 +4 -0
- package/dist/unstable/sql/SqlStream.d.ts.map +1 -1
- package/dist/unstable/sql/SqlStream.js +24 -0
- package/dist/unstable/sql/SqlStream.js.map +1 -1
- package/dist/unstable/sql/Statement.d.ts +151 -24
- package/dist/unstable/sql/Statement.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.js +91 -6
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/sql/index.d.ts +179 -1
- package/dist/unstable/sql/index.d.ts.map +1 -1
- package/dist/unstable/sql/index.js +179 -1
- package/dist/unstable/sql/index.js.map +1 -1
- package/dist/unstable/workers/Transferable.d.ts +72 -20
- package/dist/unstable/workers/Transferable.d.ts.map +1 -1
- package/dist/unstable/workers/Transferable.js +57 -14
- package/dist/unstable/workers/Transferable.js.map +1 -1
- package/dist/unstable/workers/Worker.d.ts +61 -8
- package/dist/unstable/workers/Worker.d.ts.map +1 -1
- package/dist/unstable/workers/Worker.js +44 -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 +81 -1
- package/dist/unstable/workers/index.d.ts.map +1 -1
- package/dist/unstable/workers/index.js +81 -1
- package/dist/unstable/workers/index.js.map +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 +128 -31
- package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.js +77 -13
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/DurableQueue.d.ts +33 -8
- package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableQueue.js +26 -6
- package/dist/unstable/workflow/DurableQueue.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +102 -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 +40 -12
- package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.js +8 -12
- package/dist/unstable/workflow/WorkflowProxy.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.d.ts +37 -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/dist/unstable/workflow/index.d.ts +160 -0
- package/dist/unstable/workflow/index.d.ts.map +1 -1
- package/dist/unstable/workflow/index.js +160 -0
- package/dist/unstable/workflow/index.js.map +1 -1
- package/package.json +11 -11
- package/src/Array.ts +151 -106
- package/src/BigDecimal.ts +620 -553
- package/src/BigInt.ts +342 -274
- package/src/Boolean.ts +189 -156
- package/src/Brand.ts +30 -5
- package/src/Cache.ts +334 -167
- package/src/Cause.ts +84 -73
- package/src/Channel.ts +1639 -667
- package/src/ChannelSchema.ts +137 -12
- package/src/Chunk.ts +575 -429
- package/src/Clock.ts +16 -9
- package/src/Combiner.ts +11 -5
- package/src/Config.ts +80 -68
- package/src/ConfigProvider.ts +33 -32
- package/src/Console.ts +88 -58
- package/src/Context.ts +401 -190
- package/src/Cron.ts +109 -48
- package/src/Crypto.ts +327 -0
- package/src/Data.ts +9 -3
- package/src/DateTime.ts +893 -464
- package/src/Deferred.ts +367 -175
- package/src/Differ.ts +44 -2
- package/src/Duration.ts +333 -186
- package/src/Effect.ts +2201 -2289
- package/src/Effectable.ts +38 -3
- package/src/Encoding.ts +78 -28
- package/src/Equal.ts +4 -3
- package/src/Equivalence.ts +18 -24
- package/src/ErrorReporter.ts +66 -82
- package/src/ExecutionPlan.ts +106 -12
- package/src/Exit.ts +6 -5
- package/src/Fiber.ts +71 -40
- package/src/FiberHandle.ts +157 -57
- package/src/FiberMap.ts +328 -163
- package/src/FiberSet.ts +130 -52
- package/src/FileSystem.ts +104 -74
- package/src/Filter.ts +166 -88
- package/src/Formatter.ts +4 -70
- package/src/Function.ts +218 -151
- package/src/Graph.ts +714 -415
- package/src/HKT.ts +29 -13
- package/src/Hash.ts +35 -24
- package/src/HashMap.ts +540 -388
- package/src/HashRing.ts +111 -34
- package/src/HashSet.ts +239 -153
- package/src/Inspectable.ts +30 -17
- package/src/Iterable.ts +336 -222
- package/src/JsonPatch.ts +13 -10
- package/src/JsonPointer.ts +13 -11
- package/src/JsonSchema.ts +16 -0
- package/src/Latch.ts +97 -26
- package/src/Layer.ts +547 -445
- package/src/LayerMap.ts +99 -26
- package/src/LogLevel.ts +92 -131
- package/src/Logger.ts +365 -297
- package/src/ManagedRuntime.ts +78 -19
- package/src/Match.ts +135 -161
- package/src/Metric.ts +362 -313
- package/src/MutableHashMap.ts +202 -127
- package/src/MutableHashSet.ts +120 -52
- package/src/MutableList.ts +157 -100
- package/src/MutableRef.ts +129 -90
- package/src/Newtype.ts +15 -2
- package/src/NonEmptyIterable.ts +38 -48
- package/src/Number.ts +261 -205
- package/src/Optic.ts +6 -7
- package/src/Option.ts +133 -156
- package/src/Order.ts +6 -6
- package/src/Ordering.ts +56 -45
- package/src/PartitionedSemaphore.ts +225 -40
- package/src/Path.ts +77 -13
- package/src/Pipeable.ts +82 -24
- package/src/PlatformError.ts +74 -6
- package/src/Pool.ts +94 -31
- package/src/Predicate.ts +17 -24
- package/src/PrimaryKey.ts +11 -3
- package/src/PubSub.ts +385 -309
- package/src/Pull.ts +94 -25
- package/src/Queue.ts +303 -184
- package/src/Random.ts +69 -93
- package/src/RcMap.ts +151 -141
- package/src/RcRef.ts +68 -32
- package/src/Record.ts +282 -137
- package/src/Redactable.ts +7 -5
- package/src/Redacted.ts +63 -34
- package/src/Reducer.ts +3 -1
- package/src/Ref.ts +173 -134
- package/src/References.ts +73 -31
- package/src/RegExp.ts +12 -6
- package/src/Request.ts +159 -34
- package/src/RequestResolver.ts +278 -121
- package/src/Resource.ts +45 -7
- package/src/Result.ts +137 -153
- package/src/Runtime.ts +42 -21
- package/src/Schedule.ts +585 -613
- package/src/Scheduler.ts +44 -7
- package/src/Schema.ts +1309 -615
- package/src/SchemaAST.ts +123 -93
- package/src/SchemaGetter.ts +52 -37
- package/src/SchemaIssue.ts +19 -24
- package/src/SchemaParser.ts +306 -85
- package/src/SchemaRepresentation.ts +89 -77
- package/src/SchemaTransformation.ts +97 -46
- package/src/SchemaUtils.ts +24 -1
- package/src/Scope.ts +107 -65
- package/src/ScopedCache.ts +195 -59
- package/src/ScopedRef.ts +28 -8
- package/src/Semaphore.ts +61 -37
- package/src/Sink.ts +461 -206
- package/src/Stdio.ts +43 -6
- package/src/Stream.ts +2361 -1613
- package/src/String.ts +174 -97
- package/src/Struct.ts +20 -18
- package/src/SubscriptionRef.ts +309 -204
- 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 +233 -59
- package/src/Trie.ts +280 -245
- package/src/Tuple.ts +34 -32
- package/src/TxChunk.ts +200 -155
- package/src/TxDeferred.ts +43 -29
- package/src/TxHashMap.ts +370 -231
- package/src/TxHashSet.ts +253 -159
- package/src/TxPriorityQueue.ts +97 -65
- package/src/TxPubSub.ts +77 -49
- package/src/TxQueue.ts +277 -242
- package/src/TxReentrantLock.ts +70 -47
- package/src/TxRef.ts +69 -40
- package/src/TxSemaphore.ts +101 -115
- package/src/TxSubscriptionRef.ts +74 -50
- package/src/Types.ts +31 -34
- package/src/UndefinedOr.ts +62 -25
- package/src/Unify.ts +72 -117
- package/src/Utils.ts +5 -2
- package/src/index.ts +1976 -420
- package/src/internal/schema/schema.ts +1 -1
- package/src/testing/FastCheck.ts +9 -6
- package/src/testing/TestClock.ts +63 -35
- package/src/testing/TestConsole.ts +54 -36
- package/src/testing/TestSchema.ts +10 -8
- package/src/testing/index.ts +34 -0
- package/src/unstable/ai/AiError.ts +195 -137
- package/src/unstable/ai/AnthropicStructuredOutput.ts +2 -2
- package/src/unstable/ai/Chat.ts +68 -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 +342 -119
- package/src/unstable/ai/McpServer.ts +79 -20
- package/src/unstable/ai/Model.ts +10 -12
- package/src/unstable/ai/OpenAiStructuredOutput.ts +2 -2
- package/src/unstable/ai/Prompt.ts +216 -192
- package/src/unstable/ai/Response.ts +179 -167
- package/src/unstable/ai/ResponseIdTracker.ts +43 -4
- package/src/unstable/ai/Telemetry.ts +43 -33
- package/src/unstable/ai/Tokenizer.ts +14 -9
- package/src/unstable/ai/Tool.ts +168 -97
- package/src/unstable/ai/Toolkit.ts +51 -46
- package/src/unstable/ai/index.ts +121 -29
- package/src/unstable/cli/Argument.ts +226 -134
- package/src/unstable/cli/CliError.ts +96 -26
- package/src/unstable/cli/CliOutput.ts +48 -19
- package/src/unstable/cli/Command.ts +196 -115
- 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 +39 -14
- package/src/unstable/cli/Param.ts +395 -260
- package/src/unstable/cli/Primitive.ts +79 -42
- package/src/unstable/cli/Prompt.ts +207 -59
- package/src/unstable/cli/index.ts +205 -6
- 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/cli/internal/parser.ts +0 -1
- 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 +106 -16
- package/src/unstable/cluster/EntityAddress.ts +30 -2
- package/src/unstable/cluster/EntityId.ts +18 -3
- package/src/unstable/cluster/EntityProxy.ts +42 -14
- package/src/unstable/cluster/EntityProxyServer.ts +45 -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 +126 -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 +76 -13
- package/src/unstable/cluster/ShardId.ts +53 -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 +90 -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/index.ts +790 -0
- 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/devtools/index.ts +58 -0
- 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/encoding/index.ts +49 -0
- 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 +150 -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/eventlog/index.ts +240 -0
- 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 +204 -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 +48 -7
- package/src/unstable/http/HttpMethod.ts +38 -6
- package/src/unstable/http/HttpMiddleware.ts +60 -11
- package/src/unstable/http/HttpPlatform.ts +34 -3
- package/src/unstable/http/HttpRouter.ts +232 -69
- package/src/unstable/http/HttpServer.ts +151 -22
- package/src/unstable/http/HttpServerError.ts +93 -10
- package/src/unstable/http/HttpServerRequest.ts +125 -21
- package/src/unstable/http/HttpServerRespondable.ts +49 -6
- package/src/unstable/http/HttpServerResponse.ts +391 -67
- package/src/unstable/http/HttpStaticServer.ts +24 -8
- package/src/unstable/http/HttpTraceContext.ts +53 -6
- package/src/unstable/http/Multipart.ts +179 -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 -1
- package/src/unstable/http/Url.ts +70 -56
- package/src/unstable/http/UrlParams.ts +237 -51
- package/src/unstable/http/index.ts +452 -0
- package/src/unstable/httpapi/HttpApi.ts +49 -14
- package/src/unstable/httpapi/HttpApiBuilder.ts +81 -16
- package/src/unstable/httpapi/HttpApiClient.ts +78 -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 +113 -22
- package/src/unstable/httpapi/HttpApiScalar.ts +38 -4
- package/src/unstable/httpapi/HttpApiSchema.ts +86 -38
- package/src/unstable/httpapi/HttpApiSecurity.ts +73 -17
- package/src/unstable/httpapi/HttpApiSwagger.ts +23 -3
- package/src/unstable/httpapi/HttpApiTest.ts +26 -1
- package/src/unstable/httpapi/OpenApi.ts +115 -15
- package/src/unstable/httpapi/index.ts +310 -25
- package/src/unstable/observability/Otlp.ts +33 -3
- package/src/unstable/observability/OtlpExporter.ts +32 -1
- package/src/unstable/observability/OtlpLogger.ts +32 -2
- package/src/unstable/observability/OtlpMetrics.ts +39 -5
- package/src/unstable/observability/OtlpResource.ts +68 -12
- package/src/unstable/observability/OtlpSerialization.ts +28 -3
- package/src/unstable/observability/OtlpTracer.ts +41 -2
- package/src/unstable/observability/PrometheusMetrics.ts +36 -16
- package/src/unstable/observability/index.ts +160 -3
- 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 +98 -16
- package/src/unstable/persistence/RateLimiter.ts +101 -21
- package/src/unstable/persistence/Redis.ts +42 -5
- package/src/unstable/persistence/index.ts +147 -0
- package/src/unstable/process/ChildProcess.ts +90 -66
- package/src/unstable/process/ChildProcessSpawner.ts +23 -12
- package/src/unstable/process/index.ts +2 -1
- package/src/unstable/reactivity/AsyncResult.ts +204 -61
- package/src/unstable/reactivity/Atom.ts +598 -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 +94 -13
- package/src/unstable/reactivity/index.ts +167 -0
- package/src/unstable/rpc/Rpc.ts +254 -56
- package/src/unstable/rpc/RpcClient.ts +106 -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 +39 -6
- package/src/unstable/rpc/Utils.ts +33 -0
- package/src/unstable/rpc/index.ts +272 -0
- package/src/unstable/schema/Model.ts +245 -61
- package/src/unstable/schema/VariantSchema.ts +101 -24
- package/src/unstable/schema/index.ts +37 -0
- package/src/unstable/socket/Socket.ts +168 -34
- package/src/unstable/socket/SocketServer.ts +58 -10
- package/src/unstable/socket/index.ts +44 -0
- package/src/unstable/sql/Migrator.ts +61 -9
- package/src/unstable/sql/SqlClient.ts +59 -2
- package/src/unstable/sql/SqlConnection.ts +34 -3
- package/src/unstable/sql/SqlError.ts +135 -0
- package/src/unstable/sql/SqlModel.ts +25 -5
- package/src/unstable/sql/SqlResolver.ts +56 -13
- package/src/unstable/sql/SqlSchema.ts +29 -8
- package/src/unstable/sql/SqlStream.ts +24 -0
- package/src/unstable/sql/Statement.ts +168 -24
- package/src/unstable/sql/index.ts +179 -1
- package/src/unstable/workers/Transferable.ts +72 -20
- package/src/unstable/workers/Worker.ts +61 -8
- package/src/unstable/workers/WorkerError.ts +50 -9
- package/src/unstable/workers/WorkerRunner.ts +32 -3
- package/src/unstable/workers/index.ts +81 -1
- package/src/unstable/workflow/Activity.ts +61 -10
- package/src/unstable/workflow/DurableClock.ts +26 -3
- package/src/unstable/workflow/DurableDeferred.ts +148 -31
- package/src/unstable/workflow/DurableQueue.ts +33 -8
- package/src/unstable/workflow/Workflow.ts +123 -31
- package/src/unstable/workflow/WorkflowEngine.ts +40 -5
- package/src/unstable/workflow/WorkflowProxy.ts +40 -12
- package/src/unstable/workflow/WorkflowProxyServer.ts +41 -6
- package/src/unstable/workflow/index.ts +160 -0
package/dist/Effect.js
CHANGED
|
@@ -12,14 +12,17 @@ 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
|
-
* @since
|
|
18
|
+
* @since 4.0.0
|
|
17
19
|
*/
|
|
18
20
|
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
|
*
|
|
33
|
+
* @category guards
|
|
30
34
|
* @since 2.0.0
|
|
31
|
-
* @category Guards
|
|
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**
|
|
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.
|
|
57
47
|
*
|
|
58
|
-
*
|
|
59
|
-
* the `concurrency` option.
|
|
48
|
+
* **Options**
|
|
60
49
|
*
|
|
61
|
-
*
|
|
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`.
|
|
62
54
|
*
|
|
63
|
-
*
|
|
64
|
-
* called "short-circuiting". If any effect in the collection fails, the
|
|
65
|
-
* remaining effects will not run, and the error will be propagated. To change
|
|
66
|
-
* this behavior, you can use the `mode` option, which allows all effects to run
|
|
67
|
-
* and collect every success / failure as `Result` values.
|
|
55
|
+
* **Example** (Combining Effects in Tuples)
|
|
68
56
|
*
|
|
69
|
-
* **The `mode` option**
|
|
70
|
-
*
|
|
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 2.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 2.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,11 +284,10 @@ 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
|
-
*
|
|
304
|
-
* import { Effect } from "effect"
|
|
305
|
-
* import { Console } from "effect"
|
|
290
|
+
* import { Console, Effect } from "effect"
|
|
306
291
|
*
|
|
307
292
|
* const result = Effect.forEach(
|
|
308
293
|
* [1, 2, 3, 4, 5],
|
|
@@ -320,10 +305,10 @@ export const findFirstFilter = internal.findFirstFilter;
|
|
|
320
305
|
* // [ 2, 4, 6, 8, 10 ]
|
|
321
306
|
* ```
|
|
322
307
|
*
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
* import { Console } from "effect"
|
|
308
|
+
* **Example** (Using discard to Ignore Results)
|
|
309
|
+
*
|
|
310
|
+
* ```ts
|
|
311
|
+
* import { Console, Effect } from "effect"
|
|
327
312
|
*
|
|
328
313
|
* // Apply effects but discard the results
|
|
329
314
|
* const result = Effect.forEach(
|
|
@@ -341,15 +326,17 @@ export const findFirstFilter = internal.findFirstFilter;
|
|
|
341
326
|
* // Currently at index 3
|
|
342
327
|
* // Currently at index 4
|
|
343
328
|
* // undefined
|
|
329
|
+
* ```
|
|
344
330
|
*
|
|
345
|
-
* @since 2.0.0
|
|
346
331
|
* @category Collecting
|
|
332
|
+
* @since 2.0.0
|
|
347
333
|
*/
|
|
348
334
|
export const forEach = internal.forEach;
|
|
349
335
|
/**
|
|
350
336
|
* Executes a body effect repeatedly while a condition holds true.
|
|
351
337
|
*
|
|
352
|
-
*
|
|
338
|
+
* **Example** (Usage)
|
|
339
|
+
*
|
|
353
340
|
* ```ts
|
|
354
341
|
* import { Effect } from "effect"
|
|
355
342
|
*
|
|
@@ -370,8 +357,8 @@ export const forEach = internal.forEach;
|
|
|
370
357
|
* // Current count: 5
|
|
371
358
|
* ```
|
|
372
359
|
*
|
|
373
|
-
* @since 2.0.0
|
|
374
360
|
* @category Collecting
|
|
361
|
+
* @since 2.0.0
|
|
375
362
|
*/
|
|
376
363
|
export const whileLoop = internal.whileLoop;
|
|
377
364
|
// -----------------------------------------------------------------------------
|
|
@@ -393,7 +380,7 @@ export const whileLoop = internal.whileLoop;
|
|
|
393
380
|
* This defect is not a standard error but indicates a flaw in the logic that
|
|
394
381
|
* was expected to be error-free. You can think of it similar to an unexpected
|
|
395
382
|
* crash in the program, which can be further managed or logged using tools like
|
|
396
|
-
* {@link
|
|
383
|
+
* {@link catchDefect}.
|
|
397
384
|
*
|
|
398
385
|
* **Interruptions**
|
|
399
386
|
*
|
|
@@ -402,9 +389,9 @@ export const whileLoop = internal.whileLoop;
|
|
|
402
389
|
*
|
|
403
390
|
* @see {@link tryPromise} for a version that can handle failures.
|
|
404
391
|
*
|
|
405
|
-
*
|
|
392
|
+
* **Example** (Delayed Message)
|
|
393
|
+
*
|
|
406
394
|
* ```ts
|
|
407
|
-
* // Title: Delayed Message
|
|
408
395
|
* import { Effect } from "effect"
|
|
409
396
|
*
|
|
410
397
|
* const delay = (message: string) =>
|
|
@@ -422,8 +409,8 @@ export const whileLoop = internal.whileLoop;
|
|
|
422
409
|
* const program = delay("Async operation completed successfully!")
|
|
423
410
|
* ```
|
|
424
411
|
*
|
|
425
|
-
* @since 2.0.0
|
|
426
412
|
* @category Creating Effects
|
|
413
|
+
* @since 2.0.0
|
|
427
414
|
*/
|
|
428
415
|
export const promise = internal.promise;
|
|
429
416
|
/**
|
|
@@ -452,7 +439,8 @@ export const promise = internal.promise;
|
|
|
452
439
|
* An optional `AbortSignal` can be provided to allow for interruption of the
|
|
453
440
|
* wrapped `Promise` API.
|
|
454
441
|
*
|
|
455
|
-
*
|
|
442
|
+
* **Example** (Fetching a TODO Item)
|
|
443
|
+
*
|
|
456
444
|
* ```ts
|
|
457
445
|
* import { Effect } from "effect"
|
|
458
446
|
*
|
|
@@ -467,7 +455,8 @@ export const promise = internal.promise;
|
|
|
467
455
|
* const program = getTodo(1)
|
|
468
456
|
* ```
|
|
469
457
|
*
|
|
470
|
-
*
|
|
458
|
+
* **Example** (Custom Error Handling)
|
|
459
|
+
*
|
|
471
460
|
* ```ts
|
|
472
461
|
* import { Data, Effect } from "effect"
|
|
473
462
|
*
|
|
@@ -487,8 +476,8 @@ export const promise = internal.promise;
|
|
|
487
476
|
*
|
|
488
477
|
* @see {@link promise} if the effectful computation is asynchronous and does not throw errors.
|
|
489
478
|
*
|
|
490
|
-
* @since 2.0.0
|
|
491
479
|
* @category Creating Effects
|
|
480
|
+
* @since 2.0.0
|
|
492
481
|
*/
|
|
493
482
|
export const tryPromise = internal.tryPromise;
|
|
494
483
|
/**
|
|
@@ -501,9 +490,9 @@ export const tryPromise = internal.tryPromise;
|
|
|
501
490
|
*
|
|
502
491
|
* @see {@link fail} to create an effect that represents a failure.
|
|
503
492
|
*
|
|
504
|
-
*
|
|
493
|
+
* **Example** (Creating a Successful Effect)
|
|
494
|
+
*
|
|
505
495
|
* ```ts
|
|
506
|
-
* // Title: Creating a Successful Effect
|
|
507
496
|
* import { Effect } from "effect"
|
|
508
497
|
*
|
|
509
498
|
* // Creating an effect that represents a successful scenario
|
|
@@ -513,14 +502,15 @@ export const tryPromise = internal.tryPromise;
|
|
|
513
502
|
* const success = Effect.succeed(42)
|
|
514
503
|
* ```
|
|
515
504
|
*
|
|
516
|
-
* @since 2.0.0
|
|
517
505
|
* @category Creating Effects
|
|
506
|
+
* @since 2.0.0
|
|
518
507
|
*/
|
|
519
508
|
export const succeed = internal.succeed;
|
|
520
509
|
/**
|
|
521
510
|
* Returns an effect which succeeds with `None`.
|
|
522
511
|
*
|
|
523
|
-
*
|
|
512
|
+
* **Example** (Usage)
|
|
513
|
+
*
|
|
524
514
|
* ```ts
|
|
525
515
|
* import { Effect } from "effect"
|
|
526
516
|
*
|
|
@@ -530,14 +520,15 @@ export const succeed = internal.succeed;
|
|
|
530
520
|
* // Output: { _id: 'Option', _tag: 'None' }
|
|
531
521
|
* ```
|
|
532
522
|
*
|
|
533
|
-
* @since 2.0.0
|
|
534
523
|
* @category Creating Effects
|
|
524
|
+
* @since 2.0.0
|
|
535
525
|
*/
|
|
536
526
|
export const succeedNone = internal.succeedNone;
|
|
537
527
|
/**
|
|
538
528
|
* Returns an effect which succeeds with the value wrapped in a `Some`.
|
|
539
529
|
*
|
|
540
|
-
*
|
|
530
|
+
* **Example** (Usage)
|
|
531
|
+
*
|
|
541
532
|
* ```ts
|
|
542
533
|
* import { Effect } from "effect"
|
|
543
534
|
*
|
|
@@ -547,8 +538,8 @@ export const succeedNone = internal.succeedNone;
|
|
|
547
538
|
* // Output: { _id: 'Option', _tag: 'Some', value: 42 }
|
|
548
539
|
* ```
|
|
549
540
|
*
|
|
550
|
-
* @since 2.0.0
|
|
551
541
|
* @category Creating Effects
|
|
542
|
+
* @since 2.0.0
|
|
552
543
|
*/
|
|
553
544
|
export const succeedSome = internal.succeedSome;
|
|
554
545
|
/**
|
|
@@ -565,9 +556,9 @@ export const succeedSome = internal.succeedSome;
|
|
|
565
556
|
* - **Handling Circular Dependencies**: Useful in managing circular dependencies, such as recursive functions that need to avoid eager evaluation to prevent stack overflow.
|
|
566
557
|
* - **Unifying Return Types**: Can help TypeScript unify return types in situations where multiple branches of logic return different effects, simplifying type inference.
|
|
567
558
|
*
|
|
568
|
-
*
|
|
559
|
+
* **Example** (Lazy Evaluation with Side Effects)
|
|
560
|
+
*
|
|
569
561
|
* ```ts
|
|
570
|
-
* // Title: Lazy Evaluation with Side Effects
|
|
571
562
|
* import { Effect } from "effect"
|
|
572
563
|
*
|
|
573
564
|
* let i = 0
|
|
@@ -583,8 +574,9 @@ export const succeedSome = internal.succeedSome;
|
|
|
583
574
|
* console.log(Effect.runSync(good)) // Output: 2
|
|
584
575
|
* ```
|
|
585
576
|
*
|
|
586
|
-
*
|
|
587
|
-
*
|
|
577
|
+
* **Example** (Recursive Fibonacci)
|
|
578
|
+
*
|
|
579
|
+
* ```ts
|
|
588
580
|
* import { Effect } from "effect"
|
|
589
581
|
*
|
|
590
582
|
* const blowsUp = (n: number): Effect.Effect<number> =>
|
|
@@ -606,9 +598,11 @@ export const succeedSome = internal.succeedSome;
|
|
|
606
598
|
*
|
|
607
599
|
* console.log(Effect.runSync(allGood(32)))
|
|
608
600
|
* // Output: 3524578
|
|
601
|
+
* ```
|
|
602
|
+
*
|
|
603
|
+
* **Example** (Using Effect.suspend to Help TypeScript Infer Types)
|
|
609
604
|
*
|
|
610
|
-
*
|
|
611
|
-
* // Title: Using Effect.suspend to Help TypeScript Infer Types
|
|
605
|
+
* ```ts
|
|
612
606
|
* import { Effect } from "effect"
|
|
613
607
|
*
|
|
614
608
|
* // Without suspend, TypeScript may struggle with type inference.
|
|
@@ -629,9 +623,10 @@ export const succeedSome = internal.succeedSome;
|
|
|
629
623
|
* ? Effect.fail(new Error("Cannot divide by zero"))
|
|
630
624
|
* : Effect.succeed(a / b)
|
|
631
625
|
* )
|
|
626
|
+
* ```
|
|
632
627
|
*
|
|
633
|
-
* @since 2.0.0
|
|
634
628
|
* @category Creating Effects
|
|
629
|
+
* @since 2.0.0
|
|
635
630
|
*/
|
|
636
631
|
export const suspend = internal.suspend;
|
|
637
632
|
/**
|
|
@@ -649,13 +644,13 @@ export const suspend = internal.suspend;
|
|
|
649
644
|
* This defect is not a standard error but indicates a flaw in the logic that
|
|
650
645
|
* was expected to be error-free. You can think of it similar to an unexpected
|
|
651
646
|
* crash in the program, which can be further managed or logged using tools like
|
|
652
|
-
* {@link
|
|
647
|
+
* {@link catchDefect}.
|
|
653
648
|
*
|
|
654
649
|
* @see {@link try_ | try} for a version that can handle failures.
|
|
655
650
|
*
|
|
656
|
-
*
|
|
651
|
+
* **Example** (Logging a Message)
|
|
652
|
+
*
|
|
657
653
|
* ```ts
|
|
658
|
-
* // Title: Logging a Message
|
|
659
654
|
* import { Effect } from "effect"
|
|
660
655
|
*
|
|
661
656
|
* const log = (message: string) =>
|
|
@@ -668,54 +663,41 @@ export const suspend = internal.suspend;
|
|
|
668
663
|
* const program = log("Hello, World!")
|
|
669
664
|
* ```
|
|
670
665
|
*
|
|
671
|
-
* @since 2.0.0
|
|
672
666
|
* @category Creating Effects
|
|
667
|
+
* @since 2.0.0
|
|
673
668
|
*/
|
|
674
669
|
export const sync = internal.sync;
|
|
675
670
|
const void_ = internal.void;
|
|
676
671
|
export {
|
|
677
672
|
/**
|
|
678
|
-
* @since 2.0.0
|
|
679
673
|
* @category Creating Effects
|
|
674
|
+
* @since 2.0.0
|
|
680
675
|
*/
|
|
681
676
|
void_ as void };
|
|
682
677
|
const undefined_ = internal.undefined;
|
|
683
678
|
export {
|
|
684
679
|
/**
|
|
685
|
-
* @since 4.0.0
|
|
686
680
|
* @category Creating Effects
|
|
681
|
+
* @since 4.0.0
|
|
687
682
|
*/
|
|
688
683
|
undefined_ as undefined };
|
|
689
684
|
/**
|
|
690
|
-
* Creates an `Effect` from a callback-based asynchronous
|
|
685
|
+
* Creates an `Effect` from a callback-based asynchronous API.
|
|
691
686
|
*
|
|
692
687
|
* **Details**
|
|
693
688
|
*
|
|
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.
|
|
689
|
+
* The registration function receives a `resume` callback and, when requested,
|
|
690
|
+
* an `AbortSignal`. Call `resume` at most once with the effect that should
|
|
691
|
+
* complete the fiber; later calls are ignored. Return an optional cleanup
|
|
692
|
+
* effect from the registration function to run if the fiber is interrupted.
|
|
707
693
|
*
|
|
708
694
|
* **When to Use**
|
|
709
695
|
*
|
|
710
|
-
* Use `Effect.callback` when
|
|
711
|
-
*
|
|
712
|
-
* * **Previously Known As**
|
|
713
|
-
*
|
|
714
|
-
* This API replaces the following from Effect 3.x:
|
|
696
|
+
* Use `Effect.callback` when integrating APIs that complete through callbacks
|
|
697
|
+
* instead of returning a `Promise`.
|
|
715
698
|
*
|
|
716
|
-
*
|
|
699
|
+
* **Example** (Usage)
|
|
717
700
|
*
|
|
718
|
-
* @example
|
|
719
701
|
* ```ts
|
|
720
702
|
* import { Effect } from "effect"
|
|
721
703
|
*
|
|
@@ -731,15 +713,16 @@ undefined_ as undefined };
|
|
|
731
713
|
* const program = delay(1000)
|
|
732
714
|
* ```
|
|
733
715
|
*
|
|
734
|
-
* @since 2.0.0
|
|
735
716
|
* @category Creating Effects
|
|
717
|
+
* @since 4.0.0
|
|
736
718
|
*/
|
|
737
719
|
export const callback = internal.callback;
|
|
738
720
|
/**
|
|
739
721
|
* Returns an effect that will never produce anything. The moral equivalent of
|
|
740
722
|
* `while(true) {}`, only without the wasted CPU cycles.
|
|
741
723
|
*
|
|
742
|
-
*
|
|
724
|
+
* **Example** (Usage)
|
|
725
|
+
*
|
|
743
726
|
* ```ts
|
|
744
727
|
* import { Effect } from "effect"
|
|
745
728
|
*
|
|
@@ -753,18 +736,18 @@ export const callback = internal.callback;
|
|
|
753
736
|
* const timedProgram = Effect.timeout(program, "1 second")
|
|
754
737
|
* ```
|
|
755
738
|
*
|
|
756
|
-
* @since 2.0.0
|
|
757
739
|
* @category Creating Effects
|
|
740
|
+
* @since 2.0.0
|
|
758
741
|
*/
|
|
759
742
|
export const never = internal.never;
|
|
760
743
|
/**
|
|
761
744
|
* An `Effect` containing an empty record `{}`, used as the starting point for
|
|
762
745
|
* do notation chains.
|
|
763
746
|
*
|
|
764
|
-
*
|
|
747
|
+
* **Example** (Usage)
|
|
748
|
+
*
|
|
765
749
|
* ```ts
|
|
766
|
-
* import { Effect } from "effect"
|
|
767
|
-
* import { pipe } from "effect/Function"
|
|
750
|
+
* import { Effect, pipe } from "effect"
|
|
768
751
|
*
|
|
769
752
|
* const program = pipe(
|
|
770
753
|
* Effect.Do,
|
|
@@ -774,16 +757,16 @@ export const never = internal.never;
|
|
|
774
757
|
* )
|
|
775
758
|
* ```
|
|
776
759
|
*
|
|
777
|
-
* @since 4.0.0
|
|
778
760
|
* @category Do notation
|
|
761
|
+
* @since 2.0.0
|
|
779
762
|
*/
|
|
780
763
|
export const Do = internal.Do;
|
|
781
764
|
/**
|
|
782
765
|
* Gives a name to the success value of an `Effect`, creating a single-key
|
|
783
766
|
* record used in do notation pipelines.
|
|
784
767
|
*
|
|
785
|
-
* @since 4.0.0
|
|
786
768
|
* @category Do notation
|
|
769
|
+
* @since 2.0.0
|
|
787
770
|
*/
|
|
788
771
|
export const bindTo = internal.bindTo;
|
|
789
772
|
const let_ = internal.let;
|
|
@@ -791,15 +774,15 @@ export {
|
|
|
791
774
|
/**
|
|
792
775
|
* Adds a computed plain value to the do notation record.
|
|
793
776
|
*
|
|
794
|
-
* @since 4.0.0
|
|
795
777
|
* @category Do notation
|
|
778
|
+
* @since 2.0.0
|
|
796
779
|
*/
|
|
797
780
|
let_ as let };
|
|
798
781
|
/**
|
|
799
782
|
* Adds an `Effect` value to the do notation record under a given name.
|
|
800
783
|
*
|
|
801
|
-
* @since 4.0.0
|
|
802
784
|
* @category Do notation
|
|
785
|
+
* @since 2.0.0
|
|
803
786
|
*/
|
|
804
787
|
export const bind = internal.bind;
|
|
805
788
|
/**
|
|
@@ -817,7 +800,8 @@ export const bind = internal.bind;
|
|
|
817
800
|
* explicit control over the execution of effects. You can `yield*` values from
|
|
818
801
|
* effects and return the final result at the end.
|
|
819
802
|
*
|
|
820
|
-
*
|
|
803
|
+
* **Example** (Usage)
|
|
804
|
+
*
|
|
821
805
|
* ```ts
|
|
822
806
|
* import { Data, Effect } from "effect"
|
|
823
807
|
*
|
|
@@ -849,8 +833,8 @@ export const bind = internal.bind;
|
|
|
849
833
|
* })
|
|
850
834
|
* ```
|
|
851
835
|
*
|
|
852
|
-
* @since 2.0.0
|
|
853
836
|
* @category Creating Effects
|
|
837
|
+
* @since 2.0.0
|
|
854
838
|
*/
|
|
855
839
|
export const gen = internal.gen;
|
|
856
840
|
/**
|
|
@@ -860,13 +844,13 @@ export const gen = internal.gen;
|
|
|
860
844
|
*
|
|
861
845
|
* Use this function to explicitly signal an error in an `Effect`. The error
|
|
862
846
|
* will keep propagating unless it is handled. You can handle the error with
|
|
863
|
-
* functions like {@link
|
|
847
|
+
* functions like {@link catchTag} or {@link catchTags}.
|
|
864
848
|
*
|
|
865
849
|
* @see {@link succeed} to create an effect that represents a successful value.
|
|
866
850
|
*
|
|
867
|
-
*
|
|
851
|
+
* **Example** (Creating a Failed Effect)
|
|
852
|
+
*
|
|
868
853
|
* ```ts
|
|
869
|
-
* // Title: Creating a Failed Effect
|
|
870
854
|
* import { Data, Effect } from "effect"
|
|
871
855
|
*
|
|
872
856
|
* class OperationFailedError extends Data.TaggedError("OperationFailedError")<{}> {}
|
|
@@ -878,8 +862,8 @@ export const gen = internal.gen;
|
|
|
878
862
|
* )
|
|
879
863
|
* ```
|
|
880
864
|
*
|
|
881
|
-
* @since 2.0.0
|
|
882
865
|
* @category Creating Effects
|
|
866
|
+
* @since 2.0.0
|
|
883
867
|
*/
|
|
884
868
|
export const fail = internal.fail;
|
|
885
869
|
/**
|
|
@@ -888,7 +872,8 @@ export const fail = internal.fail;
|
|
|
888
872
|
* This function is useful when you need to create an error effect but want to
|
|
889
873
|
* defer the computation of the error value until the effect is actually run.
|
|
890
874
|
*
|
|
891
|
-
*
|
|
875
|
+
* **Example** (Usage)
|
|
876
|
+
*
|
|
892
877
|
* ```ts
|
|
893
878
|
* import { Data, Effect } from "effect"
|
|
894
879
|
*
|
|
@@ -900,8 +885,8 @@ export const fail = internal.fail;
|
|
|
900
885
|
* // Output: { _id: 'Exit', _tag: 'Failure', cause: ... }
|
|
901
886
|
* ```
|
|
902
887
|
*
|
|
903
|
-
* @since 2.0.0
|
|
904
888
|
* @category Creating Effects
|
|
889
|
+
* @since 2.0.0
|
|
905
890
|
*/
|
|
906
891
|
export const failSync = internal.failSync;
|
|
907
892
|
/**
|
|
@@ -910,7 +895,8 @@ export const failSync = internal.failSync;
|
|
|
910
895
|
* This function allows you to create effects that fail with complex error
|
|
911
896
|
* structures, including multiple errors, defects, interruptions, and more.
|
|
912
897
|
*
|
|
913
|
-
*
|
|
898
|
+
* **Example** (Usage)
|
|
899
|
+
*
|
|
914
900
|
* ```ts
|
|
915
901
|
* import { Cause, Effect } from "effect"
|
|
916
902
|
*
|
|
@@ -922,8 +908,8 @@ export const failSync = internal.failSync;
|
|
|
922
908
|
* // Output: { _id: 'Exit', _tag: 'Failure', cause: ... }
|
|
923
909
|
* ```
|
|
924
910
|
*
|
|
925
|
-
* @since 2.0.0
|
|
926
911
|
* @category Creating Effects
|
|
912
|
+
* @since 2.0.0
|
|
927
913
|
*/
|
|
928
914
|
export const failCause = internal.failCause;
|
|
929
915
|
/**
|
|
@@ -932,7 +918,8 @@ export const failCause = internal.failCause;
|
|
|
932
918
|
* This function is useful when you need to create a failure effect with a
|
|
933
919
|
* complex cause but want to defer the computation until the effect is run.
|
|
934
920
|
*
|
|
935
|
-
*
|
|
921
|
+
* **Example** (Usage)
|
|
922
|
+
*
|
|
936
923
|
* ```ts
|
|
937
924
|
* import { Cause, Effect } from "effect"
|
|
938
925
|
*
|
|
@@ -944,8 +931,8 @@ export const failCause = internal.failCause;
|
|
|
944
931
|
* // Output: { _id: 'Exit', _tag: 'Failure', cause: ... }
|
|
945
932
|
* ```
|
|
946
933
|
*
|
|
947
|
-
* @since 2.0.0
|
|
948
934
|
* @category Creating Effects
|
|
935
|
+
* @since 2.0.0
|
|
949
936
|
*/
|
|
950
937
|
export const failCauseSync = internal.failCauseSync;
|
|
951
938
|
/**
|
|
@@ -965,12 +952,11 @@ export const failCauseSync = internal.failCauseSync;
|
|
|
965
952
|
* The error channel of the resulting effect is of type `never`, indicating that
|
|
966
953
|
* it cannot recover from this failure.
|
|
967
954
|
*
|
|
968
|
-
* @see {@link
|
|
969
|
-
*
|
|
955
|
+
* @see {@link die} for a variant that dies with an already computed defect.
|
|
956
|
+
*
|
|
957
|
+
* **Example** (Terminating on Division by Zero with a Specified Error)
|
|
970
958
|
*
|
|
971
|
-
* @example
|
|
972
959
|
* ```ts
|
|
973
|
-
* // Title: Terminating on Division by Zero with a Specified Error
|
|
974
960
|
* import { Effect } from "effect"
|
|
975
961
|
*
|
|
976
962
|
* const divide = (a: number, b: number) =>
|
|
@@ -988,8 +974,8 @@ export const failCauseSync = internal.failCauseSync;
|
|
|
988
974
|
* // ...stack trace...
|
|
989
975
|
* ```
|
|
990
976
|
*
|
|
991
|
-
* @since 2.0.0
|
|
992
977
|
* @category Creating Effects
|
|
978
|
+
* @since 2.0.0
|
|
993
979
|
*/
|
|
994
980
|
export const die = internal.die;
|
|
995
981
|
const try_ = internal.try;
|
|
@@ -1017,7 +1003,8 @@ export {
|
|
|
1017
1003
|
* @see {@link sync} if the effectful computation is synchronous and does not
|
|
1018
1004
|
* throw errors.
|
|
1019
1005
|
*
|
|
1020
|
-
*
|
|
1006
|
+
* **Example** (Basic Usage with Default Error Handling)
|
|
1007
|
+
*
|
|
1021
1008
|
* ```ts
|
|
1022
1009
|
* import { Effect } from "effect"
|
|
1023
1010
|
*
|
|
@@ -1036,7 +1023,8 @@ export {
|
|
|
1036
1023
|
* // Output: Exit.failure with Error
|
|
1037
1024
|
* ```
|
|
1038
1025
|
*
|
|
1039
|
-
*
|
|
1026
|
+
* **Example** (Custom Error Handling)
|
|
1027
|
+
*
|
|
1040
1028
|
* ```ts
|
|
1041
1029
|
* import { Data, Effect } from "effect"
|
|
1042
1030
|
*
|
|
@@ -1052,14 +1040,15 @@ export {
|
|
|
1052
1040
|
* // Output: Exit.failure with custom Error message
|
|
1053
1041
|
* ```
|
|
1054
1042
|
*
|
|
1055
|
-
* @since 2.0.0
|
|
1056
1043
|
* @category Creating Effects
|
|
1044
|
+
* @since 2.0.0
|
|
1057
1045
|
*/
|
|
1058
1046
|
try_ as try };
|
|
1059
1047
|
/**
|
|
1060
1048
|
* Yields control back to the Effect runtime, allowing other fibers to execute.
|
|
1061
1049
|
*
|
|
1062
|
-
*
|
|
1050
|
+
* **Example** (Usage)
|
|
1051
|
+
*
|
|
1063
1052
|
* ```ts
|
|
1064
1053
|
* import { Effect } from "effect"
|
|
1065
1054
|
*
|
|
@@ -1072,14 +1061,15 @@ try_ as try };
|
|
|
1072
1061
|
* Effect.runPromise(program)
|
|
1073
1062
|
* ```
|
|
1074
1063
|
*
|
|
1075
|
-
* @since 2.0.0
|
|
1076
1064
|
* @category Creating Effects
|
|
1065
|
+
* @since 2.0.0
|
|
1077
1066
|
*/
|
|
1078
1067
|
export const yieldNow = internal.yieldNow;
|
|
1079
1068
|
/**
|
|
1080
1069
|
* Yields control back to the Effect runtime with a specified priority, allowing other fibers to execute.
|
|
1081
1070
|
*
|
|
1082
|
-
*
|
|
1071
|
+
* **Example** (Usage)
|
|
1072
|
+
*
|
|
1083
1073
|
* ```ts
|
|
1084
1074
|
* import { Effect } from "effect"
|
|
1085
1075
|
*
|
|
@@ -1092,14 +1082,15 @@ export const yieldNow = internal.yieldNow;
|
|
|
1092
1082
|
* Effect.runPromise(program)
|
|
1093
1083
|
* ```
|
|
1094
1084
|
*
|
|
1095
|
-
* @since 2.0.0
|
|
1096
1085
|
* @category Creating Effects
|
|
1086
|
+
* @since 4.0.0
|
|
1097
1087
|
*/
|
|
1098
1088
|
export const yieldNowWith = internal.yieldNowWith;
|
|
1099
1089
|
/**
|
|
1100
1090
|
* Provides access to the current fiber within an effect computation.
|
|
1101
1091
|
*
|
|
1102
|
-
*
|
|
1092
|
+
* **Example** (Usage)
|
|
1093
|
+
*
|
|
1103
1094
|
* ```ts
|
|
1104
1095
|
* import { Effect } from "effect"
|
|
1105
1096
|
*
|
|
@@ -1111,8 +1102,8 @@ export const yieldNowWith = internal.yieldNowWith;
|
|
|
1111
1102
|
* // Output: Fiber ID: 1
|
|
1112
1103
|
* ```
|
|
1113
1104
|
*
|
|
1114
|
-
* @since 2.0.0
|
|
1115
1105
|
* @category Creating Effects
|
|
1106
|
+
* @since 4.0.0
|
|
1116
1107
|
*/
|
|
1117
1108
|
export const withFiber = core.withFiber;
|
|
1118
1109
|
// -----------------------------------------------------------------------------
|
|
@@ -1121,7 +1112,8 @@ export const withFiber = core.withFiber;
|
|
|
1121
1112
|
/**
|
|
1122
1113
|
* Converts a `Result` to an `Effect`.
|
|
1123
1114
|
*
|
|
1124
|
-
*
|
|
1115
|
+
* **Example** (Usage)
|
|
1116
|
+
*
|
|
1125
1117
|
* ```ts
|
|
1126
1118
|
* import { Effect, Result } from "effect"
|
|
1127
1119
|
*
|
|
@@ -1136,14 +1128,18 @@ export const withFiber = core.withFiber;
|
|
|
1136
1128
|
* // { _id: 'Exit', _tag: 'Failure', cause: { _id: 'Cause', _tag: 'Fail', failure: 'Something went wrong' } }
|
|
1137
1129
|
* ```
|
|
1138
1130
|
*
|
|
1131
|
+
* @category converting
|
|
1139
1132
|
* @since 4.0.0
|
|
1140
|
-
* @category Conversions
|
|
1141
1133
|
*/
|
|
1142
1134
|
export const fromResult = internal.fromResult;
|
|
1143
1135
|
/**
|
|
1144
|
-
* Converts an `Option`
|
|
1136
|
+
* Converts an `Option` into an `Effect`.
|
|
1137
|
+
*
|
|
1138
|
+
* `Option.some` becomes a successful effect with the contained value, while
|
|
1139
|
+
* `Option.none` becomes a failed effect with `NoSuchElementError`.
|
|
1140
|
+
*
|
|
1141
|
+
* **Example** (Usage)
|
|
1145
1142
|
*
|
|
1146
|
-
* @example
|
|
1147
1143
|
* ```ts
|
|
1148
1144
|
* import { Effect, Option } from "effect"
|
|
1149
1145
|
*
|
|
@@ -1158,15 +1154,16 @@ export const fromResult = internal.fromResult;
|
|
|
1158
1154
|
* // { _id: 'Exit', _tag: 'Failure', cause: { _id: 'Cause', _tag: 'Fail', failure: { _id: 'NoSuchElementError' } } }
|
|
1159
1155
|
* ```
|
|
1160
1156
|
*
|
|
1157
|
+
* @category converting
|
|
1161
1158
|
* @since 4.0.0
|
|
1162
|
-
* @category Conversions
|
|
1163
1159
|
*/
|
|
1164
1160
|
export const fromOption = internal.fromOption;
|
|
1165
1161
|
/**
|
|
1166
1162
|
* Converts a nullable value to an `Effect`, failing with a `NoSuchElementError`
|
|
1167
1163
|
* when the value is `null` or `undefined`.
|
|
1168
1164
|
*
|
|
1169
|
-
*
|
|
1165
|
+
* **Example** (Usage)
|
|
1166
|
+
*
|
|
1170
1167
|
* ```ts
|
|
1171
1168
|
* import { Console, Effect } from "effect"
|
|
1172
1169
|
*
|
|
@@ -1183,8 +1180,8 @@ export const fromOption = internal.fromOption;
|
|
|
1183
1180
|
* // Output: hello
|
|
1184
1181
|
* ```
|
|
1185
1182
|
*
|
|
1183
|
+
* @category converting
|
|
1186
1184
|
* @since 4.0.0
|
|
1187
|
-
* @category Conversions
|
|
1188
1185
|
*/
|
|
1189
1186
|
export const fromNullishOr = internal.fromNullishOr;
|
|
1190
1187
|
// -----------------------------------------------------------------------------
|
|
@@ -1220,7 +1217,8 @@ export const fromNullishOr = internal.fromNullishOr;
|
|
|
1220
1217
|
* step produces a new `Effect` while flattening any nested effects that may
|
|
1221
1218
|
* occur.
|
|
1222
1219
|
*
|
|
1223
|
-
*
|
|
1220
|
+
* **Example** (Usage)
|
|
1221
|
+
*
|
|
1224
1222
|
* ```ts
|
|
1225
1223
|
* import { Data, Effect, pipe } from "effect"
|
|
1226
1224
|
*
|
|
@@ -1250,14 +1248,15 @@ export const fromNullishOr = internal.fromNullishOr;
|
|
|
1250
1248
|
*
|
|
1251
1249
|
* @see {@link tap} for a version that ignores the result of the effect.
|
|
1252
1250
|
*
|
|
1251
|
+
* @category sequencing
|
|
1253
1252
|
* @since 2.0.0
|
|
1254
|
-
* @category Sequencing
|
|
1255
1253
|
*/
|
|
1256
1254
|
export const flatMap = internal.flatMap;
|
|
1257
1255
|
/**
|
|
1258
1256
|
* Flattens an `Effect` that produces another `Effect` into a single effect.
|
|
1259
1257
|
*
|
|
1260
|
-
*
|
|
1258
|
+
* **Example** (Usage)
|
|
1259
|
+
*
|
|
1261
1260
|
* ```ts
|
|
1262
1261
|
* import { Console, Effect } from "effect"
|
|
1263
1262
|
*
|
|
@@ -1270,13 +1269,13 @@ export const flatMap = internal.flatMap;
|
|
|
1270
1269
|
* })
|
|
1271
1270
|
* ```
|
|
1272
1271
|
*
|
|
1272
|
+
* @category sequencing
|
|
1273
1273
|
* @since 2.0.0
|
|
1274
|
-
* @category Sequencing
|
|
1275
1274
|
*/
|
|
1276
1275
|
export const flatten = internal.flatten;
|
|
1277
1276
|
/**
|
|
1278
|
-
*
|
|
1279
|
-
*
|
|
1277
|
+
* Runs this effect and then runs another effect, optionally using the first
|
|
1278
|
+
* effect's success value to choose the next effect.
|
|
1280
1279
|
*
|
|
1281
1280
|
* **Syntax**
|
|
1282
1281
|
*
|
|
@@ -1290,31 +1289,21 @@ export const flatten = internal.flatten;
|
|
|
1290
1289
|
*
|
|
1291
1290
|
* **When to Use**
|
|
1292
1291
|
*
|
|
1293
|
-
* Use `andThen` when
|
|
1294
|
-
*
|
|
1295
|
-
* combining effects or handling computations that must happen in order.
|
|
1292
|
+
* Use `andThen` when one effect must run after another and the second effect
|
|
1293
|
+
* may depend on the first effect's success value.
|
|
1296
1294
|
*
|
|
1297
1295
|
* **Details**
|
|
1298
1296
|
*
|
|
1299
|
-
*
|
|
1300
|
-
*
|
|
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.
|
|
1310
|
-
*
|
|
1311
|
-
* **Previously Known As**
|
|
1297
|
+
* When the second argument is an `Effect`, the first success value is discarded
|
|
1298
|
+
* and the returned effect produces the second effect's value. When the second
|
|
1299
|
+
* argument is a function, it receives the first success value and must return
|
|
1300
|
+
* the next `Effect`.
|
|
1312
1301
|
*
|
|
1313
|
-
*
|
|
1302
|
+
* Failures or requirements from either effect are preserved in the returned
|
|
1303
|
+
* effect.
|
|
1314
1304
|
*
|
|
1315
|
-
*
|
|
1305
|
+
* **Example** (Applying a Discount Based on Fetched Amount)
|
|
1316
1306
|
*
|
|
1317
|
-
* @example Applying a Discount Based on Fetched Amount
|
|
1318
1307
|
* ```ts
|
|
1319
1308
|
* import { Data, Effect, pipe } from "effect"
|
|
1320
1309
|
*
|
|
@@ -1353,8 +1342,8 @@ export const flatten = internal.flatten;
|
|
|
1353
1342
|
* // Output: 190
|
|
1354
1343
|
* ```
|
|
1355
1344
|
*
|
|
1345
|
+
* @category sequencing
|
|
1356
1346
|
* @since 2.0.0
|
|
1357
|
-
* @category Sequencing
|
|
1358
1347
|
*/
|
|
1359
1348
|
export const andThen = internal.andThen;
|
|
1360
1349
|
/**
|
|
@@ -1374,17 +1363,10 @@ export const andThen = internal.andThen;
|
|
|
1374
1363
|
* next part of the chain. Note that if the side effect fails, the entire chain
|
|
1375
1364
|
* will fail too.
|
|
1376
1365
|
*
|
|
1377
|
-
* **
|
|
1378
|
-
*
|
|
1379
|
-
* This API replaces the following from Effect 3.x:
|
|
1380
|
-
*
|
|
1381
|
-
* - `Effect.zipLeft`
|
|
1366
|
+
* **Example** (Logging a step in a pipeline)
|
|
1382
1367
|
*
|
|
1383
|
-
* @example
|
|
1384
1368
|
* ```ts
|
|
1385
|
-
*
|
|
1386
|
-
* import { Data, Effect, pipe } from "effect"
|
|
1387
|
-
* import { Console } from "effect"
|
|
1369
|
+
* import { Console, Data, Effect, pipe } from "effect"
|
|
1388
1370
|
*
|
|
1389
1371
|
* class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
|
|
1390
1372
|
*
|
|
@@ -1414,8 +1396,8 @@ export const andThen = internal.andThen;
|
|
|
1414
1396
|
* // 95
|
|
1415
1397
|
* ```
|
|
1416
1398
|
*
|
|
1399
|
+
* @category sequencing
|
|
1417
1400
|
* @since 2.0.0
|
|
1418
|
-
* @category Sequencing
|
|
1419
1401
|
*/
|
|
1420
1402
|
export const tap = internal.tap;
|
|
1421
1403
|
/**
|
|
@@ -1441,13 +1423,8 @@ export const tap = internal.tap;
|
|
|
1441
1423
|
* The resulting effect cannot fail directly because all recoverable failures
|
|
1442
1424
|
* are represented inside the `Result` type.
|
|
1443
1425
|
*
|
|
1444
|
-
* **
|
|
1445
|
-
*
|
|
1446
|
-
* This API replaces the following from Effect 3.x:
|
|
1426
|
+
* **Example** (Usage)
|
|
1447
1427
|
*
|
|
1448
|
-
* - `Effect.either`
|
|
1449
|
-
*
|
|
1450
|
-
* @example
|
|
1451
1428
|
* ```ts
|
|
1452
1429
|
* import { Effect } from "effect"
|
|
1453
1430
|
*
|
|
@@ -1467,8 +1444,8 @@ export const tap = internal.tap;
|
|
|
1467
1444
|
* @see {@link option} for a version that uses `Option` instead.
|
|
1468
1445
|
* @see {@link exit} for a version that encapsulates both recoverable errors and defects in an `Exit`.
|
|
1469
1446
|
*
|
|
1470
|
-
* @since 4.0.0
|
|
1471
1447
|
* @category Outcome Encapsulation
|
|
1448
|
+
* @since 4.0.0
|
|
1472
1449
|
*/
|
|
1473
1450
|
export const result = internal.result;
|
|
1474
1451
|
/**
|
|
@@ -1479,7 +1456,8 @@ export const result = internal.result;
|
|
|
1479
1456
|
* Success values become `Option.some`, recoverable failures become
|
|
1480
1457
|
* `Option.none`, and defects still fail the effect.
|
|
1481
1458
|
*
|
|
1482
|
-
*
|
|
1459
|
+
* **Example** (Usage)
|
|
1460
|
+
*
|
|
1483
1461
|
* ```ts
|
|
1484
1462
|
* import { Console, Effect, Option } from "effect"
|
|
1485
1463
|
*
|
|
@@ -1499,8 +1477,8 @@ export const result = internal.result;
|
|
|
1499
1477
|
* @see {@link result} for a version that uses `Result` instead.
|
|
1500
1478
|
* @see {@link exit} for a version that encapsulates both recoverable errors and defects in an `Exit`.
|
|
1501
1479
|
*
|
|
1502
|
-
* @since 2.0.0
|
|
1503
1480
|
* @category Output Encapsulation
|
|
1481
|
+
* @since 2.0.0
|
|
1504
1482
|
*/
|
|
1505
1483
|
export const option = internal.option;
|
|
1506
1484
|
/**
|
|
@@ -1516,7 +1494,8 @@ export const option = internal.option;
|
|
|
1516
1494
|
* the `Exit.Failure` type. The error type is set to `never`, indicating that
|
|
1517
1495
|
* the effect is structured to never fail directly.
|
|
1518
1496
|
*
|
|
1519
|
-
*
|
|
1497
|
+
* **Example** (Usage)
|
|
1498
|
+
*
|
|
1520
1499
|
* ```ts
|
|
1521
1500
|
* import { Effect } from "effect"
|
|
1522
1501
|
*
|
|
@@ -1536,8 +1515,8 @@ export const option = internal.option;
|
|
|
1536
1515
|
* @see {@link option} for a version that uses `Option` instead.
|
|
1537
1516
|
* @see {@link result} for a version that uses `Result` instead.
|
|
1538
1517
|
*
|
|
1539
|
-
* @since 2.0.0
|
|
1540
1518
|
* @category Outcome Encapsulation
|
|
1519
|
+
* @since 2.0.0
|
|
1541
1520
|
*/
|
|
1542
1521
|
export const exit = internal.exit;
|
|
1543
1522
|
/**
|
|
@@ -1562,7 +1541,8 @@ export const exit = internal.exit;
|
|
|
1562
1541
|
* effect is not modified. Instead, a new effect is returned with the updated
|
|
1563
1542
|
* value.
|
|
1564
1543
|
*
|
|
1565
|
-
*
|
|
1544
|
+
* **Example** (Adding a Service Charge)
|
|
1545
|
+
*
|
|
1566
1546
|
* ```ts
|
|
1567
1547
|
* import { Effect, pipe } from "effect"
|
|
1568
1548
|
*
|
|
@@ -1583,8 +1563,8 @@ export const exit = internal.exit;
|
|
|
1583
1563
|
* @see {@link mapBoth} for a version that operates on both channels.
|
|
1584
1564
|
* @see {@link flatMap} or {@link andThen} for a version that can return a new effect.
|
|
1585
1565
|
*
|
|
1566
|
+
* @category mapping
|
|
1586
1567
|
* @since 2.0.0
|
|
1587
|
-
* @category Mapping
|
|
1588
1568
|
*/
|
|
1589
1569
|
export const map = internal.map;
|
|
1590
1570
|
/**
|
|
@@ -1593,9 +1573,9 @@ export const map = internal.map;
|
|
|
1593
1573
|
* `as` allows you to ignore the original value inside an effect and
|
|
1594
1574
|
* replace it with a new constant value.
|
|
1595
1575
|
*
|
|
1596
|
-
*
|
|
1576
|
+
* **Example** (Replacing a Value)
|
|
1577
|
+
*
|
|
1597
1578
|
* ```ts
|
|
1598
|
-
* // Title: Replacing a Value
|
|
1599
1579
|
* import { Effect, pipe } from "effect"
|
|
1600
1580
|
*
|
|
1601
1581
|
* // Replaces the value 5 with the constant "new value"
|
|
@@ -1605,8 +1585,8 @@ export const map = internal.map;
|
|
|
1605
1585
|
* // Output: "new value"
|
|
1606
1586
|
* ```
|
|
1607
1587
|
*
|
|
1588
|
+
* @category mapping
|
|
1608
1589
|
* @since 2.0.0
|
|
1609
|
-
* @category Mapping
|
|
1610
1590
|
*/
|
|
1611
1591
|
export const as = internal.as;
|
|
1612
1592
|
/**
|
|
@@ -1614,7 +1594,8 @@ export const as = internal.as;
|
|
|
1614
1594
|
* in an `Option` value. If the original `Effect` value fails, the returned
|
|
1615
1595
|
* `Effect` value will also fail.
|
|
1616
1596
|
*
|
|
1617
|
-
*
|
|
1597
|
+
* **Example** (Usage)
|
|
1598
|
+
*
|
|
1618
1599
|
* ```ts
|
|
1619
1600
|
* import { Effect } from "effect"
|
|
1620
1601
|
*
|
|
@@ -1624,7 +1605,7 @@ export const as = internal.as;
|
|
|
1624
1605
|
* // { _id: 'Option', _tag: 'Some', value: 42 }
|
|
1625
1606
|
* ```
|
|
1626
1607
|
*
|
|
1627
|
-
* @category
|
|
1608
|
+
* @category mapping
|
|
1628
1609
|
* @since 2.0.0
|
|
1629
1610
|
*/
|
|
1630
1611
|
export const asSome = internal.asSome;
|
|
@@ -1634,7 +1615,8 @@ export const asSome = internal.asSome;
|
|
|
1634
1615
|
* succeed. If the original `Effect` value fails, the returned `Effect` value
|
|
1635
1616
|
* will fail with the same error.
|
|
1636
1617
|
*
|
|
1637
|
-
*
|
|
1618
|
+
* **Example** (Usage)
|
|
1619
|
+
*
|
|
1638
1620
|
* ```ts
|
|
1639
1621
|
* import { Effect } from "effect"
|
|
1640
1622
|
*
|
|
@@ -1644,8 +1626,8 @@ export const asSome = internal.asSome;
|
|
|
1644
1626
|
* // undefined (void)
|
|
1645
1627
|
* ```
|
|
1646
1628
|
*
|
|
1629
|
+
* @category mapping
|
|
1647
1630
|
* @since 2.0.0
|
|
1648
|
-
* @category Mapping
|
|
1649
1631
|
*/
|
|
1650
1632
|
export const asVoid = internal.asVoid;
|
|
1651
1633
|
/**
|
|
@@ -1657,7 +1639,8 @@ export const asVoid = internal.asVoid;
|
|
|
1657
1639
|
* be helpful in scenarios where you want to handle a success as a failure or
|
|
1658
1640
|
* treat an error as a valid result.
|
|
1659
1641
|
*
|
|
1660
|
-
*
|
|
1642
|
+
* **Example** (Usage)
|
|
1643
|
+
*
|
|
1661
1644
|
* ```ts
|
|
1662
1645
|
* import { Effect } from "effect"
|
|
1663
1646
|
*
|
|
@@ -1670,8 +1653,8 @@ export const asVoid = internal.asVoid;
|
|
|
1670
1653
|
* const flipped = Effect.flip(program)
|
|
1671
1654
|
* ```
|
|
1672
1655
|
*
|
|
1656
|
+
* @category mapping
|
|
1673
1657
|
* @since 2.0.0
|
|
1674
|
-
* @category Mapping
|
|
1675
1658
|
*/
|
|
1676
1659
|
export const flip = internal.flip;
|
|
1677
1660
|
// -----------------------------------------------------------------------------
|
|
@@ -1691,9 +1674,9 @@ export const flip = internal.flip;
|
|
|
1691
1674
|
* @see {@link zipWith} for a version that combines the results with a custom function.
|
|
1692
1675
|
* @see {@link validate} for a version that accumulates errors.
|
|
1693
1676
|
*
|
|
1694
|
-
*
|
|
1677
|
+
* **Example** (Combining Two Effects Sequentially)
|
|
1678
|
+
*
|
|
1695
1679
|
* ```ts
|
|
1696
|
-
* // Title: Combining Two Effects Sequentially
|
|
1697
1680
|
* import { Effect } from "effect"
|
|
1698
1681
|
*
|
|
1699
1682
|
* const task1 = Effect.succeed(1).pipe(
|
|
@@ -1718,8 +1701,9 @@ export const flip = internal.flip;
|
|
|
1718
1701
|
* // [ 1, 'hello' ]
|
|
1719
1702
|
* ```
|
|
1720
1703
|
*
|
|
1721
|
-
*
|
|
1722
|
-
*
|
|
1704
|
+
* **Example** (Combining Two Effects Concurrently)
|
|
1705
|
+
*
|
|
1706
|
+
* ```ts
|
|
1723
1707
|
* import { Effect } from "effect"
|
|
1724
1708
|
*
|
|
1725
1709
|
* const task1 = Effect.succeed(1).pipe(
|
|
@@ -1739,9 +1723,10 @@ export const flip = internal.flip;
|
|
|
1739
1723
|
* // timestamp=... level=INFO fiber=#0 message="task2 done"
|
|
1740
1724
|
* // timestamp=... level=INFO fiber=#0 message="task1 done"
|
|
1741
1725
|
* // [ 1, 'hello' ]
|
|
1726
|
+
* ```
|
|
1742
1727
|
*
|
|
1728
|
+
* @category zipping
|
|
1743
1729
|
* @since 2.0.0
|
|
1744
|
-
* @category Zipping
|
|
1745
1730
|
*/
|
|
1746
1731
|
export const zip = internal.zip;
|
|
1747
1732
|
/**
|
|
@@ -1759,9 +1744,9 @@ export const zip = internal.zip;
|
|
|
1759
1744
|
* By default, the effects are run sequentially. To execute them concurrently,
|
|
1760
1745
|
* use the `{ concurrent: true }` option.
|
|
1761
1746
|
*
|
|
1762
|
-
*
|
|
1747
|
+
* **Example** (Combining Effects with a Custom Function)
|
|
1748
|
+
*
|
|
1763
1749
|
* ```ts
|
|
1764
|
-
* // Title: Combining Effects with a Custom Function
|
|
1765
1750
|
* import { Effect } from "effect"
|
|
1766
1751
|
*
|
|
1767
1752
|
* const task1 = Effect.succeed(1).pipe(
|
|
@@ -1787,8 +1772,8 @@ export const zip = internal.zip;
|
|
|
1787
1772
|
* // 6
|
|
1788
1773
|
* ```
|
|
1789
1774
|
*
|
|
1775
|
+
* @category zipping
|
|
1790
1776
|
* @since 2.0.0
|
|
1791
|
-
* @category Zipping
|
|
1792
1777
|
*/
|
|
1793
1778
|
export const zipWith = internal.zipWith;
|
|
1794
1779
|
// -----------------------------------------------------------------------------
|
|
@@ -1811,14 +1796,8 @@ export {
|
|
|
1811
1796
|
*
|
|
1812
1797
|
* @see {@link catchCause} for a version that can recover from both recoverable and unrecoverable errors.
|
|
1813
1798
|
*
|
|
1814
|
-
*
|
|
1815
|
-
*
|
|
1816
|
-
* This API replaces the following from Effect 3.x:
|
|
1817
|
-
*
|
|
1818
|
-
* - `Effect.catchAll`
|
|
1819
|
-
*
|
|
1799
|
+
* @category error handling
|
|
1820
1800
|
* @since 4.0.0
|
|
1821
|
-
* @category Error Handling
|
|
1822
1801
|
*/
|
|
1823
1802
|
catch_ as catch };
|
|
1824
1803
|
/**
|
|
@@ -1835,7 +1814,8 @@ catch_ as catch };
|
|
|
1835
1814
|
* The error type must have a readonly `_tag` field to use `catchTag`. This
|
|
1836
1815
|
* field is used to identify and match errors.
|
|
1837
1816
|
*
|
|
1838
|
-
*
|
|
1817
|
+
* **Example** (Usage)
|
|
1818
|
+
*
|
|
1839
1819
|
* ```ts
|
|
1840
1820
|
* import { Effect } from "effect"
|
|
1841
1821
|
*
|
|
@@ -1858,8 +1838,8 @@ catch_ as catch };
|
|
|
1858
1838
|
* )
|
|
1859
1839
|
* ```
|
|
1860
1840
|
*
|
|
1841
|
+
* @category error handling
|
|
1861
1842
|
* @since 2.0.0
|
|
1862
|
-
* @category Error Handling
|
|
1863
1843
|
*/
|
|
1864
1844
|
export const catchTag = internal.catchTag;
|
|
1865
1845
|
/**
|
|
@@ -1877,7 +1857,8 @@ export const catchTag = internal.catchTag;
|
|
|
1877
1857
|
* The error type must have a readonly `_tag` field to use `catchTag`. This
|
|
1878
1858
|
* field is used to identify and match errors.
|
|
1879
1859
|
*
|
|
1880
|
-
*
|
|
1860
|
+
* **Example** (Usage)
|
|
1861
|
+
*
|
|
1881
1862
|
* ```ts
|
|
1882
1863
|
* import { Data, Effect } from "effect"
|
|
1883
1864
|
*
|
|
@@ -1901,8 +1882,8 @@ export const catchTag = internal.catchTag;
|
|
|
1901
1882
|
* })
|
|
1902
1883
|
* ```
|
|
1903
1884
|
*
|
|
1885
|
+
* @category error handling
|
|
1904
1886
|
* @since 2.0.0
|
|
1905
|
-
* @category Error Handling
|
|
1906
1887
|
*/
|
|
1907
1888
|
export const catchTags = internal.catchTags;
|
|
1908
1889
|
/**
|
|
@@ -1911,7 +1892,8 @@ export const catchTags = internal.catchTags;
|
|
|
1911
1892
|
* Use this to handle nested error causes without removing the parent error
|
|
1912
1893
|
* from the error channel. The handler receives the unwrapped reason.
|
|
1913
1894
|
*
|
|
1914
|
-
*
|
|
1895
|
+
* **Example** (Usage)
|
|
1896
|
+
*
|
|
1915
1897
|
* ```ts
|
|
1916
1898
|
* import { Data, Effect } from "effect"
|
|
1917
1899
|
*
|
|
@@ -1937,14 +1919,15 @@ export const catchTags = internal.catchTags;
|
|
|
1937
1919
|
* )
|
|
1938
1920
|
* ```
|
|
1939
1921
|
*
|
|
1922
|
+
* @category error handling
|
|
1940
1923
|
* @since 4.0.0
|
|
1941
|
-
* @category Error Handling
|
|
1942
1924
|
*/
|
|
1943
1925
|
export const catchReason = internal.catchReason;
|
|
1944
1926
|
/**
|
|
1945
1927
|
* Catches multiple reasons within a tagged error using an object of handlers.
|
|
1946
1928
|
*
|
|
1947
|
-
*
|
|
1929
|
+
* **Example** (Usage)
|
|
1930
|
+
*
|
|
1948
1931
|
* ```ts
|
|
1949
1932
|
* import { Data, Effect } from "effect"
|
|
1950
1933
|
*
|
|
@@ -1972,15 +1955,16 @@ export const catchReason = internal.catchReason;
|
|
|
1972
1955
|
* )
|
|
1973
1956
|
* ```
|
|
1974
1957
|
*
|
|
1958
|
+
* @category error handling
|
|
1975
1959
|
* @since 4.0.0
|
|
1976
|
-
* @category Error Handling
|
|
1977
1960
|
*/
|
|
1978
1961
|
export const catchReasons = internal.catchReasons;
|
|
1979
1962
|
/**
|
|
1980
1963
|
* Promotes nested reason errors into the Effect error channel, replacing
|
|
1981
1964
|
* the parent error.
|
|
1982
1965
|
*
|
|
1983
|
-
*
|
|
1966
|
+
* **Example** (Usage)
|
|
1967
|
+
*
|
|
1984
1968
|
* ```ts
|
|
1985
1969
|
* import { Data, Effect } from "effect"
|
|
1986
1970
|
*
|
|
@@ -2003,8 +1987,8 @@ export const catchReasons = internal.catchReasons;
|
|
|
2003
1987
|
* const unwrapped = program.pipe(Effect.unwrapReason("AiError"))
|
|
2004
1988
|
* ```
|
|
2005
1989
|
*
|
|
1990
|
+
* @category error handling
|
|
2006
1991
|
* @since 4.0.0
|
|
2007
|
-
* @category Error Handling
|
|
2008
1992
|
*/
|
|
2009
1993
|
export const unwrapReason = internal.unwrapReason;
|
|
2010
1994
|
/**
|
|
@@ -2024,13 +2008,8 @@ export const unwrapReason = internal.unwrapReason;
|
|
|
2024
2008
|
* they often indicate serious issues. However, in some cases, such as
|
|
2025
2009
|
* dynamically loaded plugins, controlled recovery might be needed.
|
|
2026
2010
|
*
|
|
2027
|
-
* **
|
|
2028
|
-
*
|
|
2029
|
-
* This API replaces the following from Effect 3.x:
|
|
2011
|
+
* **Example** (Usage)
|
|
2030
2012
|
*
|
|
2031
|
-
* - `Effect.catchAllCause`
|
|
2032
|
-
*
|
|
2033
|
-
* @example
|
|
2034
2013
|
* ```ts
|
|
2035
2014
|
* import { Cause, Console, Effect } from "effect"
|
|
2036
2015
|
*
|
|
@@ -2048,40 +2027,31 @@ export const unwrapReason = internal.unwrapReason;
|
|
|
2048
2027
|
* })
|
|
2049
2028
|
* ```
|
|
2050
2029
|
*
|
|
2030
|
+
* @category error handling
|
|
2051
2031
|
* @since 4.0.0
|
|
2052
|
-
* @category Error Handling
|
|
2053
2032
|
*/
|
|
2054
2033
|
export const catchCause = internal.catchCause;
|
|
2055
2034
|
/**
|
|
2056
|
-
* Recovers from
|
|
2035
|
+
* Recovers from defects using a provided recovery function.
|
|
2057
2036
|
*
|
|
2058
2037
|
* **When to Use**
|
|
2059
2038
|
*
|
|
2060
|
-
*
|
|
2061
|
-
*
|
|
2062
|
-
* information on a defect for diagnostic or explanatory purposes.
|
|
2039
|
+
* Use this sparingly, usually at integration boundaries where defects must be
|
|
2040
|
+
* reported or translated for an external system.
|
|
2063
2041
|
*
|
|
2064
2042
|
* **Details**
|
|
2065
2043
|
*
|
|
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}).
|
|
2044
|
+
* `catchDefect` handles unexpected defects, such as thrown exceptions or
|
|
2045
|
+
* values passed to `die`, without catching typed failures or interruptions.
|
|
2071
2046
|
*
|
|
2072
2047
|
* **When to Recover from Defects**
|
|
2073
2048
|
*
|
|
2074
|
-
* Defects are unexpected errors that typically
|
|
2075
|
-
* they often indicate serious issues.
|
|
2076
|
-
*
|
|
2077
|
-
*
|
|
2078
|
-
* **Previously Known As**
|
|
2049
|
+
* Defects are unexpected errors that typically should not be recovered from, as
|
|
2050
|
+
* they often indicate serious issues. In some cases, such as dynamically loaded
|
|
2051
|
+
* plugins, controlled recovery may be needed.
|
|
2079
2052
|
*
|
|
2080
|
-
*
|
|
2053
|
+
* **Example** (Usage)
|
|
2081
2054
|
*
|
|
2082
|
-
* - `Effect.catchAllDefect`
|
|
2083
|
-
*
|
|
2084
|
-
* @example
|
|
2085
2055
|
* ```ts
|
|
2086
2056
|
* import { Console, Effect } from "effect"
|
|
2087
2057
|
*
|
|
@@ -2098,8 +2068,8 @@ export const catchCause = internal.catchCause;
|
|
|
2098
2068
|
* })
|
|
2099
2069
|
* ```
|
|
2100
2070
|
*
|
|
2071
|
+
* @category error handling
|
|
2101
2072
|
* @since 4.0.0
|
|
2102
|
-
* @category Error Handling
|
|
2103
2073
|
*/
|
|
2104
2074
|
export const catchDefect = internal.catchDefect;
|
|
2105
2075
|
/**
|
|
@@ -2112,14 +2082,8 @@ export const catchDefect = internal.catchDefect;
|
|
|
2112
2082
|
* matching. Non-matching errors re-fail with the original cause. Defects and
|
|
2113
2083
|
* interrupts are not caught.
|
|
2114
2084
|
*
|
|
2115
|
-
* **
|
|
2116
|
-
*
|
|
2117
|
-
* This API replaces the following:
|
|
2118
|
-
*
|
|
2119
|
-
* - `Effect.catchSome` (Effect 3.x)
|
|
2120
|
-
* - `Effect.catchIf`
|
|
2085
|
+
* **Example** (Usage)
|
|
2121
2086
|
*
|
|
2122
|
-
* @example
|
|
2123
2087
|
* ```ts
|
|
2124
2088
|
* import { Data, Effect, Filter } from "effect"
|
|
2125
2089
|
*
|
|
@@ -2144,15 +2108,15 @@ export const catchDefect = internal.catchDefect;
|
|
|
2144
2108
|
* )
|
|
2145
2109
|
* ```
|
|
2146
2110
|
*
|
|
2111
|
+
* @category error handling
|
|
2147
2112
|
* @since 2.0.0
|
|
2148
|
-
* @category Error Handling
|
|
2149
2113
|
*/
|
|
2150
2114
|
export const catchIf = internal.catchIf;
|
|
2151
2115
|
/**
|
|
2152
2116
|
* Recovers from specific errors using a `Filter`.
|
|
2153
2117
|
*
|
|
2118
|
+
* @category error handling
|
|
2154
2119
|
* @since 4.0.0
|
|
2155
|
-
* @category Error Handling
|
|
2156
2120
|
*/
|
|
2157
2121
|
export const catchFilter = internal.catchFilter;
|
|
2158
2122
|
/**
|
|
@@ -2161,7 +2125,8 @@ export const catchFilter = internal.catchFilter;
|
|
|
2161
2125
|
* Success values become `Option.some`, `NoSuchElementError` becomes
|
|
2162
2126
|
* `Option.none`, and all other errors are preserved.
|
|
2163
2127
|
*
|
|
2164
|
-
*
|
|
2128
|
+
* **Example** (Usage)
|
|
2129
|
+
*
|
|
2165
2130
|
* ```ts
|
|
2166
2131
|
* import { Effect, Option } from "effect"
|
|
2167
2132
|
*
|
|
@@ -2172,14 +2137,8 @@ export const catchFilter = internal.catchFilter;
|
|
|
2172
2137
|
* Effect.runPromise(none).then(console.log) // { _id: 'Option', _tag: 'None' }
|
|
2173
2138
|
* ```
|
|
2174
2139
|
*
|
|
2175
|
-
*
|
|
2176
|
-
*
|
|
2177
|
-
* This API replaces the following from Effect 3.x:
|
|
2178
|
-
*
|
|
2179
|
-
* - `Effect.optionFromOptional`
|
|
2180
|
-
*
|
|
2181
|
-
* @since 2.0.0
|
|
2182
|
-
* @category Error Handling
|
|
2140
|
+
* @category error handling
|
|
2141
|
+
* @since 4.0.0
|
|
2183
2142
|
*/
|
|
2184
2143
|
export const catchNoSuchElement = internal.catchNoSuchElement;
|
|
2185
2144
|
/**
|
|
@@ -2189,13 +2148,8 @@ export const catchNoSuchElement = internal.catchNoSuchElement;
|
|
|
2189
2148
|
* that match a specific predicate. This is useful when you want to handle
|
|
2190
2149
|
* only certain types of errors while letting others propagate.
|
|
2191
2150
|
*
|
|
2192
|
-
* **
|
|
2193
|
-
*
|
|
2194
|
-
* This API replaces the following from Effect 3.x:
|
|
2195
|
-
*
|
|
2196
|
-
* - `Effect.catchSomeCause`
|
|
2151
|
+
* **Example** (Usage)
|
|
2197
2152
|
*
|
|
2198
|
-
* @example
|
|
2199
2153
|
* ```ts
|
|
2200
2154
|
* import { Cause, Console, Effect } from "effect"
|
|
2201
2155
|
*
|
|
@@ -2217,15 +2171,15 @@ export const catchNoSuchElement = internal.catchNoSuchElement;
|
|
|
2217
2171
|
* // Then: "Fallback response"
|
|
2218
2172
|
* ```
|
|
2219
2173
|
*
|
|
2174
|
+
* @category error handling
|
|
2220
2175
|
* @since 4.0.0
|
|
2221
|
-
* @category Error Handling
|
|
2222
2176
|
*/
|
|
2223
2177
|
export const catchCauseIf = internal.catchCauseIf;
|
|
2224
2178
|
/**
|
|
2225
2179
|
* Recovers from specific failures based on a `Filter`.
|
|
2226
2180
|
*
|
|
2181
|
+
* @category error handling
|
|
2227
2182
|
* @since 4.0.0
|
|
2228
|
-
* @category Error Handling
|
|
2229
2183
|
*/
|
|
2230
2184
|
export const catchCauseFilter = internal.catchCauseFilter;
|
|
2231
2185
|
/**
|
|
@@ -2239,9 +2193,10 @@ export const catchCauseFilter = internal.catchCauseFilter;
|
|
|
2239
2193
|
*
|
|
2240
2194
|
* @see {@link map} for a version that operates on the success channel.
|
|
2241
2195
|
* @see {@link mapBoth} for a version that operates on both channels.
|
|
2242
|
-
* @see {@link
|
|
2196
|
+
* @see {@link mapError} if you want to replace the error with a new one.
|
|
2197
|
+
*
|
|
2198
|
+
* **Example** (Usage)
|
|
2243
2199
|
*
|
|
2244
|
-
* @example
|
|
2245
2200
|
* ```ts
|
|
2246
2201
|
* import { Data, Effect } from "effect"
|
|
2247
2202
|
*
|
|
@@ -2259,8 +2214,8 @@ export const catchCauseFilter = internal.catchCauseFilter;
|
|
|
2259
2214
|
* )
|
|
2260
2215
|
* ```
|
|
2261
2216
|
*
|
|
2217
|
+
* @category error handling
|
|
2262
2218
|
* @since 2.0.0
|
|
2263
|
-
* @category Error Handling
|
|
2264
2219
|
*/
|
|
2265
2220
|
export const mapError = internal.mapError;
|
|
2266
2221
|
/**
|
|
@@ -2273,7 +2228,8 @@ export const mapError = internal.mapError;
|
|
|
2273
2228
|
* the error and the success values without altering the overall success or
|
|
2274
2229
|
* failure status of the effect.
|
|
2275
2230
|
*
|
|
2276
|
-
*
|
|
2231
|
+
* **Example** (Usage)
|
|
2232
|
+
*
|
|
2277
2233
|
* ```ts
|
|
2278
2234
|
* import { Data, Effect } from "effect"
|
|
2279
2235
|
*
|
|
@@ -2294,28 +2250,24 @@ export const mapError = internal.mapError;
|
|
|
2294
2250
|
* @see {@link map} for a version that operates on the success channel.
|
|
2295
2251
|
* @see {@link mapError} for a version that operates on the error channel.
|
|
2296
2252
|
*
|
|
2253
|
+
* @category mapping
|
|
2297
2254
|
* @since 2.0.0
|
|
2298
|
-
* @category Mapping
|
|
2299
2255
|
*/
|
|
2300
2256
|
export const mapBoth = internal.mapBoth;
|
|
2301
2257
|
/**
|
|
2302
|
-
* Converts
|
|
2258
|
+
* Converts typed failures from the error channel into defects, removing the
|
|
2259
|
+
* error type from the returned effect.
|
|
2303
2260
|
*
|
|
2304
|
-
* **When to Use
|
|
2305
|
-
*
|
|
2306
|
-
* Use `orDie` when failures should be treated as unrecoverable defects and no error handling is required.
|
|
2261
|
+
* **When to Use**
|
|
2307
2262
|
*
|
|
2308
|
-
*
|
|
2263
|
+
* Use `orDie` when a typed failure represents an unrecoverable bug or invalid
|
|
2264
|
+
* state and should not be handled as a recoverable error.
|
|
2309
2265
|
*
|
|
2310
|
-
*
|
|
2311
|
-
* It removes the error type from the effect and ensures that any failure will terminate the fiber.
|
|
2312
|
-
* This is useful for propagating failures as defects, signaling that they should not be handled within the effect.
|
|
2266
|
+
* @see {@link mapError} to transform the error before converting it into a defect with {@link orDie}.
|
|
2313
2267
|
*
|
|
2314
|
-
*
|
|
2268
|
+
* **Example** (Propagating an Error as a Defect)
|
|
2315
2269
|
*
|
|
2316
|
-
* @example
|
|
2317
2270
|
* ```ts
|
|
2318
|
-
* // Title: Propagating an Error as a Defect
|
|
2319
2271
|
* import { Data, Effect } from "effect"
|
|
2320
2272
|
*
|
|
2321
2273
|
* class DivideByZeroError extends Data.TaggedError("DivideByZeroError")<{}> {}
|
|
@@ -2335,20 +2287,22 @@ export const mapBoth = internal.mapBoth;
|
|
|
2335
2287
|
* // ...stack trace...
|
|
2336
2288
|
* ```
|
|
2337
2289
|
*
|
|
2338
|
-
* @since 2.0.0
|
|
2339
2290
|
* @category Converting Failures to Defects
|
|
2291
|
+
* @since 2.0.0
|
|
2340
2292
|
*/
|
|
2341
2293
|
export const orDie = internal.orDie;
|
|
2342
2294
|
/**
|
|
2343
|
-
*
|
|
2344
|
-
*
|
|
2295
|
+
* Runs an effectful operation when the source effect fails, while preserving
|
|
2296
|
+
* the original failure when the operation succeeds.
|
|
2345
2297
|
*
|
|
2346
|
-
*
|
|
2347
|
-
*
|
|
2348
|
-
*
|
|
2349
|
-
*
|
|
2298
|
+
* **Details**
|
|
2299
|
+
*
|
|
2300
|
+
* Use this for logging, metrics, or other failure-side observations. If the
|
|
2301
|
+
* operation passed to `tapError` fails, that error is also represented in the
|
|
2302
|
+
* returned effect's error channel.
|
|
2303
|
+
*
|
|
2304
|
+
* **Example** (Usage)
|
|
2350
2305
|
*
|
|
2351
|
-
* @example
|
|
2352
2306
|
* ```ts
|
|
2353
2307
|
* import { Console, Effect } from "effect"
|
|
2354
2308
|
*
|
|
@@ -2366,17 +2320,19 @@ export const orDie = internal.orDie;
|
|
|
2366
2320
|
* // expected error: NetworkError
|
|
2367
2321
|
* ```
|
|
2368
2322
|
*
|
|
2323
|
+
* @category sequencing
|
|
2369
2324
|
* @since 2.0.0
|
|
2370
|
-
* @category Sequencing
|
|
2371
2325
|
*/
|
|
2372
2326
|
export const tapError = internal.tapError;
|
|
2373
2327
|
/**
|
|
2374
2328
|
* Runs an effectful handler when a failure's `_tag` matches.
|
|
2375
2329
|
*
|
|
2376
|
-
* Use this with tagged-union errors to perform side effects for
|
|
2377
|
-
* list
|
|
2330
|
+
* Use this with tagged-union errors to perform side effects for one tag or a
|
|
2331
|
+
* list of tags. When the handler succeeds, the original failure is preserved;
|
|
2332
|
+
* if the handler fails, its error is also included in the returned effect.
|
|
2333
|
+
*
|
|
2334
|
+
* **Example** (Usage)
|
|
2378
2335
|
*
|
|
2379
|
-
* @example
|
|
2380
2336
|
* ```ts
|
|
2381
2337
|
* import { Console, Data, Effect } from "effect"
|
|
2382
2338
|
*
|
|
@@ -2400,26 +2356,22 @@ export const tapError = internal.tapError;
|
|
|
2400
2356
|
* // expected error: 504
|
|
2401
2357
|
* ```
|
|
2402
2358
|
*
|
|
2359
|
+
* @category sequencing
|
|
2403
2360
|
* @since 2.0.0
|
|
2404
|
-
* @category Sequencing
|
|
2405
2361
|
*/
|
|
2406
2362
|
export const tapErrorTag = internal.tapErrorTag;
|
|
2407
2363
|
/**
|
|
2408
|
-
*
|
|
2409
|
-
*
|
|
2410
|
-
*
|
|
2411
|
-
* This function is helpful when you need to log, monitor, or handle specific
|
|
2412
|
-
* error causes in your effects. It gives you access to the full error cause,
|
|
2413
|
-
* whether it's a failure, defect, or other exceptional conditions, without
|
|
2414
|
-
* altering the error or the overall result of the effect.
|
|
2364
|
+
* Runs an effectful operation with the full `Cause` when the source effect
|
|
2365
|
+
* fails.
|
|
2415
2366
|
*
|
|
2416
|
-
* **
|
|
2367
|
+
* **Details**
|
|
2417
2368
|
*
|
|
2418
|
-
*
|
|
2369
|
+
* Use this to log or inspect typed failures, defects, and interruptions. When
|
|
2370
|
+
* the operation succeeds, the original cause is preserved. If the operation
|
|
2371
|
+
* fails, its error is also represented in the returned effect.
|
|
2419
2372
|
*
|
|
2420
|
-
*
|
|
2373
|
+
* **Example** (Usage)
|
|
2421
2374
|
*
|
|
2422
|
-
* @example
|
|
2423
2375
|
* ```ts
|
|
2424
2376
|
* import { Cause, Console, Effect } from "effect"
|
|
2425
2377
|
*
|
|
@@ -2435,8 +2387,8 @@ export const tapErrorTag = internal.tapErrorTag;
|
|
|
2435
2387
|
* // Then: { _id: 'Exit', _tag: 'Failure', cause: ... }
|
|
2436
2388
|
* ```
|
|
2437
2389
|
*
|
|
2438
|
-
* @
|
|
2439
|
-
* @
|
|
2390
|
+
* @category sequencing
|
|
2391
|
+
* @since 4.0.0
|
|
2440
2392
|
*/
|
|
2441
2393
|
export const tapCause = internal.tapCause;
|
|
2442
2394
|
/**
|
|
@@ -2446,7 +2398,8 @@ export const tapCause = internal.tapCause;
|
|
|
2446
2398
|
* the cause matches a specific predicate. This is useful for conditional logging,
|
|
2447
2399
|
* monitoring, or other side effects based on the type of failure.
|
|
2448
2400
|
*
|
|
2449
|
-
*
|
|
2401
|
+
* **Example** (Usage)
|
|
2402
|
+
*
|
|
2450
2403
|
* ```ts
|
|
2451
2404
|
* import { Cause, Console, Effect } from "effect"
|
|
2452
2405
|
*
|
|
@@ -2464,34 +2417,29 @@ export const tapCause = internal.tapCause;
|
|
|
2464
2417
|
* // Then: { _id: 'Exit', _tag: 'Failure', cause: ... }
|
|
2465
2418
|
* ```
|
|
2466
2419
|
*
|
|
2420
|
+
* @category sequencing
|
|
2467
2421
|
* @since 4.0.0
|
|
2468
|
-
* @category Sequencing
|
|
2469
2422
|
*/
|
|
2470
2423
|
export const tapCauseIf = internal.tapCauseIf;
|
|
2471
2424
|
/**
|
|
2472
2425
|
* Conditionally executes a side effect based on the cause of a failed effect.
|
|
2473
2426
|
*
|
|
2427
|
+
* @category sequencing
|
|
2474
2428
|
* @since 4.0.0
|
|
2475
|
-
* @category Sequencing
|
|
2476
2429
|
*/
|
|
2477
2430
|
export const tapCauseFilter = internal.tapCauseFilter;
|
|
2478
2431
|
/**
|
|
2479
|
-
*
|
|
2432
|
+
* Runs an effectful operation when the source effect dies with a defect.
|
|
2480
2433
|
*
|
|
2481
2434
|
* **Details**
|
|
2482
2435
|
*
|
|
2483
|
-
*
|
|
2484
|
-
*
|
|
2485
|
-
*
|
|
2486
|
-
*
|
|
2487
|
-
* handling.
|
|
2436
|
+
* Use this for diagnostics such as logging unexpected thrown exceptions or
|
|
2437
|
+
* values passed to `die`. Recoverable failures are not handled. When the
|
|
2438
|
+
* operation succeeds, the original defect is preserved; if the operation fails,
|
|
2439
|
+
* its error is also represented in the returned effect.
|
|
2488
2440
|
*
|
|
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.
|
|
2441
|
+
* **Example** (Usage)
|
|
2493
2442
|
*
|
|
2494
|
-
* @example
|
|
2495
2443
|
* ```ts
|
|
2496
2444
|
* import { Console, Effect } from "effect"
|
|
2497
2445
|
*
|
|
@@ -2524,8 +2472,8 @@ export const tapCauseFilter = internal.tapCauseFilter;
|
|
|
2524
2472
|
* // ... stack trace ...
|
|
2525
2473
|
* ```
|
|
2526
2474
|
*
|
|
2475
|
+
* @category sequencing
|
|
2527
2476
|
* @since 2.0.0
|
|
2528
|
-
* @category Sequencing
|
|
2529
2477
|
*/
|
|
2530
2478
|
export const tapDefect = internal.tapDefect;
|
|
2531
2479
|
/**
|
|
@@ -2533,7 +2481,8 @@ export const tapDefect = internal.tapDefect;
|
|
|
2533
2481
|
*
|
|
2534
2482
|
* Yields between attempts so other fibers can run.
|
|
2535
2483
|
*
|
|
2536
|
-
*
|
|
2484
|
+
* **Example** (Usage)
|
|
2485
|
+
*
|
|
2537
2486
|
* ```ts
|
|
2538
2487
|
* import { Console, Effect } from "effect"
|
|
2539
2488
|
*
|
|
@@ -2558,32 +2507,29 @@ export const tapDefect = internal.tapDefect;
|
|
|
2558
2507
|
* // Ready
|
|
2559
2508
|
* ```
|
|
2560
2509
|
*
|
|
2561
|
-
* @since 2.0.0
|
|
2562
2510
|
* @category Repetition / Recursion
|
|
2511
|
+
* @since 2.0.0
|
|
2563
2512
|
*/
|
|
2564
2513
|
export const eventually = internal.eventually;
|
|
2565
2514
|
/**
|
|
2566
|
-
* Retries
|
|
2515
|
+
* Retries typed failures from an effect according to a retry policy.
|
|
2567
2516
|
*
|
|
2568
2517
|
* **Details**
|
|
2569
2518
|
*
|
|
2570
|
-
* The
|
|
2571
|
-
*
|
|
2572
|
-
* the policy
|
|
2573
|
-
*
|
|
2574
|
-
* If the effect ultimately succeeds, the result will be returned.
|
|
2519
|
+
* The policy can be a `Schedule`, a schedule builder, or a `Retry.Options`
|
|
2520
|
+
* object using `schedule`, `times`, `while`, or `until`. If a retry eventually
|
|
2521
|
+
* succeeds, the returned effect succeeds with that value. If the policy stops
|
|
2522
|
+
* while the effect is still failing, the last failure is propagated.
|
|
2575
2523
|
*
|
|
2576
|
-
*
|
|
2577
|
-
* is propagated.
|
|
2524
|
+
* Defects and interruptions are not retried as typed failures.
|
|
2578
2525
|
*
|
|
2579
2526
|
* **When to Use**
|
|
2580
2527
|
*
|
|
2581
|
-
*
|
|
2582
|
-
*
|
|
2583
|
-
*
|
|
2584
|
-
*
|
|
2528
|
+
* Use `retry` when typed failures may be transient, such as network issues or
|
|
2529
|
+
* temporary resource unavailability.
|
|
2530
|
+
*
|
|
2531
|
+
* **Example** (Usage)
|
|
2585
2532
|
*
|
|
2586
|
-
* @example
|
|
2587
2533
|
* ```ts
|
|
2588
2534
|
* import { Data, Effect, Schedule } from "effect"
|
|
2589
2535
|
*
|
|
@@ -2609,8 +2555,8 @@ export const eventually = internal.eventually;
|
|
|
2609
2555
|
* @see {@link retryOrElse} for a version that allows you to run a fallback.
|
|
2610
2556
|
* @see {@link repeat} if your retry condition is based on successful outcomes rather than errors.
|
|
2611
2557
|
*
|
|
2558
|
+
* @category error handling
|
|
2612
2559
|
* @since 2.0.0
|
|
2613
|
-
* @category Error Handling
|
|
2614
2560
|
*/
|
|
2615
2561
|
export const retry = internalSchedule.retry;
|
|
2616
2562
|
/**
|
|
@@ -2631,7 +2577,8 @@ export const retry = internalSchedule.retry;
|
|
|
2631
2577
|
*
|
|
2632
2578
|
* @see {@link retry} for a version that does not run a fallback effect.
|
|
2633
2579
|
*
|
|
2634
|
-
*
|
|
2580
|
+
* **Example** (Usage)
|
|
2581
|
+
*
|
|
2635
2582
|
* ```ts
|
|
2636
2583
|
* import { Console, Data, Effect, Schedule } from "effect"
|
|
2637
2584
|
*
|
|
@@ -2666,24 +2613,21 @@ export const retry = internalSchedule.retry;
|
|
|
2666
2613
|
* // Network data
|
|
2667
2614
|
* ```
|
|
2668
2615
|
*
|
|
2616
|
+
* @category error handling
|
|
2669
2617
|
* @since 2.0.0
|
|
2670
|
-
* @category Error Handling
|
|
2671
2618
|
*/
|
|
2672
2619
|
export const retryOrElse = internalSchedule.retryOrElse;
|
|
2673
2620
|
/**
|
|
2674
|
-
*
|
|
2675
|
-
*
|
|
2676
|
-
*
|
|
2677
|
-
*
|
|
2621
|
+
* Exposes an effect's full failure cause in the error channel as `Cause<E>`.
|
|
2622
|
+
*
|
|
2623
|
+
* **Details**
|
|
2624
|
+
*
|
|
2625
|
+
* Use `sandbox` when downstream error handling needs to distinguish typed
|
|
2626
|
+
* failures, defects, and interruptions. Use `unsandbox` to restore the original
|
|
2627
|
+
* typed error channel after cause-level handling.
|
|
2678
2628
|
*
|
|
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.
|
|
2629
|
+
* **Example** (Usage)
|
|
2685
2630
|
*
|
|
2686
|
-
* @example
|
|
2687
2631
|
* ```ts
|
|
2688
2632
|
* import { Cause, Effect } from "effect"
|
|
2689
2633
|
*
|
|
@@ -2699,10 +2643,10 @@ export const retryOrElse = internalSchedule.retryOrElse;
|
|
|
2699
2643
|
* // Output: "Caught cause: Something went wrong"
|
|
2700
2644
|
* ```
|
|
2701
2645
|
*
|
|
2702
|
-
* @see {@link
|
|
2646
|
+
* @see {@link sandbox} to expose failures as full causes.
|
|
2703
2647
|
*
|
|
2648
|
+
* @category error handling
|
|
2704
2649
|
* @since 2.0.0
|
|
2705
|
-
* @category Error Handling
|
|
2706
2650
|
*/
|
|
2707
2651
|
export const sandbox = internal.sandbox;
|
|
2708
2652
|
/**
|
|
@@ -2717,9 +2661,9 @@ export const sandbox = internal.sandbox;
|
|
|
2717
2661
|
* Use the `log` option to emit the full {@link Cause} when the effect fails,
|
|
2718
2662
|
* and `message` to prepend a custom log message.
|
|
2719
2663
|
*
|
|
2720
|
-
*
|
|
2664
|
+
* **Example** (Using Effect.ignore to Discard Values)
|
|
2665
|
+
*
|
|
2721
2666
|
* ```ts
|
|
2722
|
-
* // Title: Using Effect.ignore to Discard Values
|
|
2723
2667
|
* import { Effect } from "effect"
|
|
2724
2668
|
*
|
|
2725
2669
|
* // ┌─── Effect<number, string, never>
|
|
@@ -2731,9 +2675,9 @@ export const sandbox = internal.sandbox;
|
|
|
2731
2675
|
* const program = task.pipe(Effect.ignore)
|
|
2732
2676
|
* ```
|
|
2733
2677
|
*
|
|
2734
|
-
*
|
|
2678
|
+
* **Example** (Logging failures while ignoring results)
|
|
2679
|
+
*
|
|
2735
2680
|
* ```ts
|
|
2736
|
-
* // Title: Logging failures while ignoring results
|
|
2737
2681
|
* import { Effect } from "effect"
|
|
2738
2682
|
*
|
|
2739
2683
|
* const task = Effect.fail("Uh oh!")
|
|
@@ -2742,14 +2686,8 @@ export const sandbox = internal.sandbox;
|
|
|
2742
2686
|
* const programWarn = task.pipe(Effect.ignore({ log: "Warn", message: "Ignoring task failure" }))
|
|
2743
2687
|
* ```
|
|
2744
2688
|
*
|
|
2745
|
-
*
|
|
2746
|
-
*
|
|
2747
|
-
* This API replaces the following from Effect 3.x:
|
|
2748
|
-
*
|
|
2749
|
-
* - `Effect.ignoreLogged`
|
|
2750
|
-
*
|
|
2689
|
+
* @category error handling
|
|
2751
2690
|
* @since 2.0.0
|
|
2752
|
-
* @category Error Handling
|
|
2753
2691
|
*/
|
|
2754
2692
|
export const ignore = internal.ignore;
|
|
2755
2693
|
/**
|
|
@@ -2758,7 +2696,8 @@ export const ignore = internal.ignore;
|
|
|
2758
2696
|
* Use the `log` option to emit the full {@link Cause} when the effect fails,
|
|
2759
2697
|
* and `message` to prepend a custom log message.
|
|
2760
2698
|
*
|
|
2761
|
-
*
|
|
2699
|
+
* **Example** (Usage)
|
|
2700
|
+
*
|
|
2762
2701
|
* ```ts
|
|
2763
2702
|
* import { Effect } from "effect"
|
|
2764
2703
|
*
|
|
@@ -2768,8 +2707,8 @@ export const ignore = internal.ignore;
|
|
|
2768
2707
|
* const programLog = task.pipe(Effect.ignoreCause({ log: true, message: "Ignoring failure cause" }))
|
|
2769
2708
|
* ```
|
|
2770
2709
|
*
|
|
2710
|
+
* @category error handling
|
|
2771
2711
|
* @since 4.0.0
|
|
2772
|
-
* @category Error Handling
|
|
2773
2712
|
*/
|
|
2774
2713
|
export const ignoreCause = internal.ignoreCause;
|
|
2775
2714
|
/**
|
|
@@ -2780,9 +2719,10 @@ export const ignoreCause = internal.ignoreCause;
|
|
|
2780
2719
|
* and retry timing is derived per step (the first attempt uses the remaining
|
|
2781
2720
|
* attempts schedule; later retries apply the step schedule at least once).
|
|
2782
2721
|
*
|
|
2783
|
-
*
|
|
2722
|
+
* **Example** (Usage)
|
|
2723
|
+
*
|
|
2784
2724
|
* ```ts
|
|
2785
|
-
* import { Effect, ExecutionPlan, Layer
|
|
2725
|
+
* import { Context, Effect, ExecutionPlan, Layer } from "effect"
|
|
2786
2726
|
*
|
|
2787
2727
|
* const Endpoint = Context.Service<{ url: string }>("Endpoint")
|
|
2788
2728
|
*
|
|
@@ -2802,8 +2742,8 @@ export const ignoreCause = internal.ignoreCause;
|
|
|
2802
2742
|
* const program = Effect.withExecutionPlan(fetchUrl, plan)
|
|
2803
2743
|
* ```
|
|
2804
2744
|
*
|
|
2805
|
-
* @since 3.16.0
|
|
2806
2745
|
* @category Fallback
|
|
2746
|
+
* @since 3.16.0
|
|
2807
2747
|
*/
|
|
2808
2748
|
export const withExecutionPlan = internalExecutionPlan.withExecutionPlan;
|
|
2809
2749
|
/**
|
|
@@ -2812,31 +2752,26 @@ export const withExecutionPlan = internalExecutionPlan.withExecutionPlan;
|
|
|
2812
2752
|
* If the `defectsOnly` option is set to `true`, only defects (unrecoverable
|
|
2813
2753
|
* errors) will be reported, while regular failures will be ignored.
|
|
2814
2754
|
*
|
|
2755
|
+
* @category error handling
|
|
2815
2756
|
* @since 4.0.0
|
|
2816
|
-
* @category Error Handling
|
|
2817
2757
|
*/
|
|
2818
2758
|
export const withErrorReporting = internal.withErrorReporting;
|
|
2819
2759
|
// -----------------------------------------------------------------------------
|
|
2820
2760
|
// Fallback
|
|
2821
2761
|
// -----------------------------------------------------------------------------
|
|
2822
2762
|
/**
|
|
2823
|
-
*
|
|
2824
|
-
* cannot fail.
|
|
2763
|
+
* Recovers from a typed failure by producing a fallback success value.
|
|
2825
2764
|
*
|
|
2826
|
-
*
|
|
2827
|
-
*
|
|
2828
|
-
*
|
|
2829
|
-
*
|
|
2830
|
-
* effect
|
|
2765
|
+
* **Details**
|
|
2766
|
+
*
|
|
2767
|
+
* If the source effect succeeds, its value is preserved. If it fails in the
|
|
2768
|
+
* error channel, `orElseSucceed` evaluates the fallback and succeeds with that
|
|
2769
|
+
* value, removing the typed error from the returned effect.
|
|
2831
2770
|
*
|
|
2832
|
-
*
|
|
2833
|
-
* by a successful value, which can be helpful for providing default values in
|
|
2834
|
-
* case of failure.
|
|
2771
|
+
* Defects and interruptions are not recovered by this operator.
|
|
2835
2772
|
*
|
|
2836
|
-
* **
|
|
2837
|
-
* already succeeds, it will remain unchanged.
|
|
2773
|
+
* **Example** (Usage)
|
|
2838
2774
|
*
|
|
2839
|
-
* @example
|
|
2840
2775
|
* ```ts
|
|
2841
2776
|
* import { Effect } from "effect"
|
|
2842
2777
|
*
|
|
@@ -2857,8 +2792,8 @@ export const withErrorReporting = internal.withErrorReporting;
|
|
|
2857
2792
|
* // { _id: 'Exit', _tag: 'Success', value: 18 }
|
|
2858
2793
|
* ```
|
|
2859
2794
|
*
|
|
2860
|
-
* @since 2.0.0
|
|
2861
2795
|
* @category Fallback
|
|
2796
|
+
* @since 2.0.0
|
|
2862
2797
|
*/
|
|
2863
2798
|
export const orElseSucceed = internal.orElseSucceed;
|
|
2864
2799
|
/**
|
|
@@ -2881,7 +2816,8 @@ export const orElseSucceed = internal.orElseSucceed;
|
|
|
2881
2816
|
* attempting multiple APIs, reading configuration from several sources, or
|
|
2882
2817
|
* trying alternative resource locations in order.
|
|
2883
2818
|
*
|
|
2884
|
-
*
|
|
2819
|
+
* **Example** (Usage)
|
|
2820
|
+
*
|
|
2885
2821
|
* ```ts
|
|
2886
2822
|
* import { Effect } from "effect"
|
|
2887
2823
|
*
|
|
@@ -2901,8 +2837,8 @@ export const orElseSucceed = internal.orElseSucceed;
|
|
|
2901
2837
|
* // Output: "secondary result"
|
|
2902
2838
|
* ```
|
|
2903
2839
|
*
|
|
2904
|
-
* @since 2.0.0
|
|
2905
2840
|
* @category Fallback
|
|
2841
|
+
* @since 2.0.0
|
|
2906
2842
|
*/
|
|
2907
2843
|
export const firstSuccessOf = internal.firstSuccessOf;
|
|
2908
2844
|
// -----------------------------------------------------------------------------
|
|
@@ -2918,11 +2854,10 @@ export const firstSuccessOf = internal.firstSuccessOf;
|
|
|
2918
2854
|
* your program waits for a task to finish, ensuring that it doesn't hang
|
|
2919
2855
|
* indefinitely if the task takes too long.
|
|
2920
2856
|
*
|
|
2921
|
-
* @see {@link
|
|
2922
|
-
*
|
|
2923
|
-
*
|
|
2857
|
+
* @see {@link timeoutOrElse} for a version that allows specifying both success and timeout handlers.
|
|
2858
|
+
*
|
|
2859
|
+
* **Example** (Usage)
|
|
2924
2860
|
*
|
|
2925
|
-
* @example
|
|
2926
2861
|
* ```ts
|
|
2927
2862
|
* import { Effect } from "effect"
|
|
2928
2863
|
*
|
|
@@ -2951,30 +2886,26 @@ export const firstSuccessOf = internal.firstSuccessOf;
|
|
|
2951
2886
|
* // }
|
|
2952
2887
|
* ```
|
|
2953
2888
|
*
|
|
2954
|
-
* @since 2.0.0
|
|
2955
2889
|
* @category Delays & Timeouts
|
|
2890
|
+
* @since 2.0.0
|
|
2956
2891
|
*/
|
|
2957
2892
|
export const timeout = internal.timeout;
|
|
2958
2893
|
/**
|
|
2959
|
-
*
|
|
2960
|
-
*
|
|
2894
|
+
* Runs an effect with a time limit and represents only the timeout case as
|
|
2895
|
+
* `Option.none`.
|
|
2961
2896
|
*
|
|
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.
|
|
2897
|
+
* **Details**
|
|
2967
2898
|
*
|
|
2968
|
-
*
|
|
2969
|
-
*
|
|
2970
|
-
*
|
|
2899
|
+
* If the source effect succeeds before the timeout, the returned effect
|
|
2900
|
+
* succeeds with `Option.some(value)`. If the timeout wins, the source effect is
|
|
2901
|
+
* interrupted and the returned effect succeeds with `Option.none`. If the
|
|
2902
|
+
* source effect fails before the timeout, that failure is preserved.
|
|
2971
2903
|
*
|
|
2972
2904
|
* @see {@link timeout} for a version that raises a `TimeoutException`.
|
|
2973
|
-
* @see {@link
|
|
2974
|
-
*
|
|
2975
|
-
*
|
|
2905
|
+
* @see {@link timeoutOrElse} for a version that allows specifying both success and timeout handlers.
|
|
2906
|
+
*
|
|
2907
|
+
* **Example** (Usage)
|
|
2976
2908
|
*
|
|
2977
|
-
* @example
|
|
2978
2909
|
* ```ts
|
|
2979
2910
|
* import { Effect } from "effect"
|
|
2980
2911
|
*
|
|
@@ -3001,8 +2932,8 @@ export const timeout = internal.timeout;
|
|
|
3001
2932
|
* // ]
|
|
3002
2933
|
* ```
|
|
3003
2934
|
*
|
|
3004
|
-
* @since 3.1.0
|
|
3005
2935
|
* @category Delays & Timeouts
|
|
2936
|
+
* @since 3.1.0
|
|
3006
2937
|
*/
|
|
3007
2938
|
export const timeoutOption = internal.timeoutOption;
|
|
3008
2939
|
/**
|
|
@@ -3011,7 +2942,8 @@ export const timeoutOption = internal.timeoutOption;
|
|
|
3011
2942
|
* This function is useful when you want to set a maximum duration for an operation
|
|
3012
2943
|
* and provide an alternative action if the timeout is exceeded.
|
|
3013
2944
|
*
|
|
3014
|
-
*
|
|
2945
|
+
* **Example** (Usage)
|
|
2946
|
+
*
|
|
3015
2947
|
* ```ts
|
|
3016
2948
|
* import { Console, Effect } from "effect"
|
|
3017
2949
|
*
|
|
@@ -3038,15 +2970,16 @@ export const timeoutOption = internal.timeoutOption;
|
|
|
3038
2970
|
* // Cached result
|
|
3039
2971
|
* ```
|
|
3040
2972
|
*
|
|
3041
|
-
* @since 3.1.0
|
|
3042
2973
|
* @category Delays & Timeouts
|
|
2974
|
+
* @since 4.0.0
|
|
3043
2975
|
*/
|
|
3044
2976
|
export const timeoutOrElse = internal.timeoutOrElse;
|
|
3045
2977
|
/**
|
|
3046
2978
|
* Returns an effect that is delayed from this effect by the specified
|
|
3047
2979
|
* `Duration`.
|
|
3048
2980
|
*
|
|
3049
|
-
*
|
|
2981
|
+
* **Example** (Usage)
|
|
2982
|
+
*
|
|
3050
2983
|
* ```ts
|
|
3051
2984
|
* import { Console, Effect } from "effect"
|
|
3052
2985
|
*
|
|
@@ -3059,15 +2992,16 @@ export const timeoutOrElse = internal.timeoutOrElse;
|
|
|
3059
2992
|
* // Waits 1 second, then prints: "Delayed message"
|
|
3060
2993
|
* ```
|
|
3061
2994
|
*
|
|
3062
|
-
* @since 2.0.0
|
|
3063
2995
|
* @category Delays & Timeouts
|
|
2996
|
+
* @since 2.0.0
|
|
3064
2997
|
*/
|
|
3065
2998
|
export const delay = internal.delay;
|
|
3066
2999
|
/**
|
|
3067
|
-
* Returns an effect that suspends for the specified duration
|
|
3068
|
-
*
|
|
3000
|
+
* Returns an effect that suspends the current fiber for the specified duration
|
|
3001
|
+
* without blocking a JavaScript thread.
|
|
3002
|
+
*
|
|
3003
|
+
* **Example** (Usage)
|
|
3069
3004
|
*
|
|
3070
|
-
* @example
|
|
3071
3005
|
* ```ts
|
|
3072
3006
|
* import { Console, Effect } from "effect"
|
|
3073
3007
|
*
|
|
@@ -3082,8 +3016,8 @@ export const delay = internal.delay;
|
|
|
3082
3016
|
* // Output: "End" (after 2 seconds)
|
|
3083
3017
|
* ```
|
|
3084
3018
|
*
|
|
3085
|
-
* @since 2.0.0
|
|
3086
3019
|
* @category Delays & Timeouts
|
|
3020
|
+
* @since 2.0.0
|
|
3087
3021
|
*/
|
|
3088
3022
|
export const sleep = internal.sleep;
|
|
3089
3023
|
/**
|
|
@@ -3092,7 +3026,8 @@ export const sleep = internal.sleep;
|
|
|
3092
3026
|
* The original success, failure, or interruption is preserved; only the success
|
|
3093
3027
|
* value is paired with the duration.
|
|
3094
3028
|
*
|
|
3095
|
-
*
|
|
3029
|
+
* **Example** (Usage)
|
|
3030
|
+
*
|
|
3096
3031
|
* ```ts
|
|
3097
3032
|
* import { Console, Duration, Effect } from "effect"
|
|
3098
3033
|
*
|
|
@@ -3102,35 +3037,32 @@ export const sleep = internal.sleep;
|
|
|
3102
3037
|
* })
|
|
3103
3038
|
* ```
|
|
3104
3039
|
*
|
|
3105
|
-
* @since 2.0.0
|
|
3106
3040
|
* @category Delays & Timeouts
|
|
3041
|
+
* @since 2.0.0
|
|
3107
3042
|
*/
|
|
3108
3043
|
export const timed = internal.timed;
|
|
3109
3044
|
// -----------------------------------------------------------------------------
|
|
3110
3045
|
// Racing
|
|
3111
3046
|
// -----------------------------------------------------------------------------
|
|
3112
3047
|
/**
|
|
3113
|
-
*
|
|
3048
|
+
* Runs multiple effects concurrently and returns the first successful result.
|
|
3114
3049
|
*
|
|
3115
3050
|
* **Details**
|
|
3116
3051
|
*
|
|
3117
|
-
*
|
|
3118
|
-
*
|
|
3119
|
-
* interrupted.
|
|
3120
|
-
*
|
|
3121
|
-
* If none of the effects succeed, the function will fail with the last error
|
|
3122
|
-
* encountered.
|
|
3052
|
+
* Early failures do not finish the race; `raceAll` keeps waiting until one
|
|
3053
|
+
* effect succeeds or every effect has failed. When one effect succeeds, the
|
|
3054
|
+
* remaining effects are interrupted. If every effect fails, the returned effect
|
|
3055
|
+
* fails with a cause containing the collected failure reasons.
|
|
3123
3056
|
*
|
|
3124
3057
|
* **When to Use**
|
|
3125
3058
|
*
|
|
3126
|
-
*
|
|
3127
|
-
*
|
|
3128
|
-
* retries, or when you want to optimize for the faster response without
|
|
3129
|
-
* worrying about the other effects.
|
|
3059
|
+
* Use `raceAll` when early failures should be ignored until a success occurs
|
|
3060
|
+
* or all effects fail.
|
|
3130
3061
|
*
|
|
3131
3062
|
* @see {@link race} for a version that handles only two effects.
|
|
3132
3063
|
*
|
|
3133
|
-
*
|
|
3064
|
+
* **Example** (Usage)
|
|
3065
|
+
*
|
|
3134
3066
|
* ```ts
|
|
3135
3067
|
* import { Duration, Effect } from "effect"
|
|
3136
3068
|
*
|
|
@@ -3145,20 +3077,22 @@ export const timed = internal.timed;
|
|
|
3145
3077
|
* // Result: "Fast" (after ~100ms)
|
|
3146
3078
|
* ```
|
|
3147
3079
|
*
|
|
3148
|
-
* @since 2.0.0
|
|
3149
3080
|
* @category Racing
|
|
3081
|
+
* @since 2.0.0
|
|
3150
3082
|
*/
|
|
3151
3083
|
export const raceAll = internal.raceAll;
|
|
3152
3084
|
/**
|
|
3153
|
-
*
|
|
3085
|
+
* Runs multiple effects concurrently and completes with the first effect to
|
|
3086
|
+
* finish, whether it succeeds or fails.
|
|
3154
3087
|
*
|
|
3155
3088
|
* **Details**
|
|
3156
3089
|
*
|
|
3157
|
-
*
|
|
3158
|
-
*
|
|
3159
|
-
*
|
|
3090
|
+
* After the first effect completes, all remaining effects are interrupted. Use
|
|
3091
|
+
* `raceAll` when early failures should be ignored until a success occurs or
|
|
3092
|
+
* all effects fail.
|
|
3093
|
+
*
|
|
3094
|
+
* **Example** (Usage)
|
|
3160
3095
|
*
|
|
3161
|
-
* @example
|
|
3162
3096
|
* ```ts
|
|
3163
3097
|
* import { Duration, Effect } from "effect"
|
|
3164
3098
|
*
|
|
@@ -3173,8 +3107,8 @@ export const raceAll = internal.raceAll;
|
|
|
3173
3107
|
* // Result: "First" (after ~200ms, even though effect2 completes first but fails)
|
|
3174
3108
|
* ```
|
|
3175
3109
|
*
|
|
3176
|
-
* @since 4.0.0
|
|
3177
3110
|
* @category Racing
|
|
3111
|
+
* @since 4.0.0
|
|
3178
3112
|
*/
|
|
3179
3113
|
export const raceAllFirst = internal.raceAllFirst;
|
|
3180
3114
|
/**
|
|
@@ -3183,7 +3117,8 @@ export const raceAllFirst = internal.raceAllFirst;
|
|
|
3183
3117
|
* If one effect succeeds, the other is interrupted and `onWinner` can observe the
|
|
3184
3118
|
* winning fiber. If both fail, the race fails.
|
|
3185
3119
|
*
|
|
3186
|
-
*
|
|
3120
|
+
* **Example** (Usage)
|
|
3121
|
+
*
|
|
3187
3122
|
* ```ts
|
|
3188
3123
|
* import { Console, Duration, Effect } from "effect"
|
|
3189
3124
|
*
|
|
@@ -3199,8 +3134,8 @@ export const raceAllFirst = internal.raceAllFirst;
|
|
|
3199
3134
|
* // Output: winner: slow-success
|
|
3200
3135
|
* ```
|
|
3201
3136
|
*
|
|
3202
|
-
* @since 2.0.0
|
|
3203
3137
|
* @category Racing
|
|
3138
|
+
* @since 2.0.0
|
|
3204
3139
|
*/
|
|
3205
3140
|
export const race = internal.race;
|
|
3206
3141
|
/**
|
|
@@ -3209,7 +3144,8 @@ export const race = internal.race;
|
|
|
3209
3144
|
*
|
|
3210
3145
|
* The losing effect is interrupted, and `onWinner` can observe the winning fiber.
|
|
3211
3146
|
*
|
|
3212
|
-
*
|
|
3147
|
+
* **Example** (Usage)
|
|
3148
|
+
*
|
|
3213
3149
|
* ```ts
|
|
3214
3150
|
* import { Console, Duration, Effect } from "effect"
|
|
3215
3151
|
*
|
|
@@ -3228,8 +3164,8 @@ export const race = internal.race;
|
|
|
3228
3164
|
* // Output: failed: fast-fail
|
|
3229
3165
|
* ```
|
|
3230
3166
|
*
|
|
3231
|
-
* @since 2.0.0
|
|
3232
3167
|
* @category Racing
|
|
3168
|
+
* @since 2.0.0
|
|
3233
3169
|
*/
|
|
3234
3170
|
export const raceFirst = internal.raceFirst;
|
|
3235
3171
|
// -----------------------------------------------------------------------------
|
|
@@ -3239,7 +3175,8 @@ export const raceFirst = internal.raceFirst;
|
|
|
3239
3175
|
* Filters elements of an iterable using a predicate, refinement, or effectful
|
|
3240
3176
|
* predicate.
|
|
3241
3177
|
*
|
|
3242
|
-
*
|
|
3178
|
+
* **Example** (Usage)
|
|
3179
|
+
*
|
|
3243
3180
|
* ```ts
|
|
3244
3181
|
* import { Effect } from "effect"
|
|
3245
3182
|
*
|
|
@@ -3252,22 +3189,22 @@ export const raceFirst = internal.raceFirst;
|
|
|
3252
3189
|
* // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
|
|
3253
3190
|
* ```
|
|
3254
3191
|
*
|
|
3192
|
+
* @category filtering
|
|
3255
3193
|
* @since 2.0.0
|
|
3256
|
-
* @category Filtering
|
|
3257
3194
|
*/
|
|
3258
3195
|
export const filter = internal.filter;
|
|
3259
3196
|
/**
|
|
3260
3197
|
* Filters and maps elements of an iterable with a `Filter`.
|
|
3261
3198
|
*
|
|
3262
|
-
* @
|
|
3263
|
-
* @
|
|
3199
|
+
* @category filtering
|
|
3200
|
+
* @since 2.0.0
|
|
3264
3201
|
*/
|
|
3265
3202
|
export const filterMap = internal.filterMap;
|
|
3266
3203
|
/**
|
|
3267
3204
|
* Effectfully filters and maps elements of an iterable with a `FilterEffect`.
|
|
3268
3205
|
*
|
|
3206
|
+
* @category filtering
|
|
3269
3207
|
* @since 4.0.0
|
|
3270
|
-
* @category Filtering
|
|
3271
3208
|
*/
|
|
3272
3209
|
export const filterMapEffect = internal.filterMapEffect;
|
|
3273
3210
|
/**
|
|
@@ -3280,7 +3217,8 @@ export const filterMapEffect = internal.filterMapEffect;
|
|
|
3280
3217
|
* `orElse` effect can produce an alternative value or perform additional
|
|
3281
3218
|
* computations.
|
|
3282
3219
|
*
|
|
3283
|
-
*
|
|
3220
|
+
* **Example** (Usage)
|
|
3221
|
+
*
|
|
3284
3222
|
* ```ts
|
|
3285
3223
|
* import { Effect } from "effect"
|
|
3286
3224
|
*
|
|
@@ -3297,15 +3235,15 @@ export const filterMapEffect = internal.filterMapEffect;
|
|
|
3297
3235
|
* // Result: "Number 5 is odd" (since 5 is not even)
|
|
3298
3236
|
* ```
|
|
3299
3237
|
*
|
|
3238
|
+
* @category filtering
|
|
3300
3239
|
* @since 2.0.0
|
|
3301
|
-
* @category Filtering
|
|
3302
3240
|
*/
|
|
3303
3241
|
export const filterOrElse = internal.filterOrElse;
|
|
3304
3242
|
/**
|
|
3305
3243
|
* Filters an effect with a `Filter`, providing an alternative effect on failure.
|
|
3306
3244
|
*
|
|
3245
|
+
* @category filtering
|
|
3307
3246
|
* @since 4.0.0
|
|
3308
|
-
* @category Filtering
|
|
3309
3247
|
*/
|
|
3310
3248
|
export const filterMapOrElse = internal.filterMapOrElse;
|
|
3311
3249
|
/**
|
|
@@ -3317,7 +3255,8 @@ export const filterMapOrElse = internal.filterMapOrElse;
|
|
|
3317
3255
|
* predicate evaluates to `false`, the effect fails with either a custom
|
|
3318
3256
|
* error (if `orFailWith` is provided) or a `NoSuchElementError`.
|
|
3319
3257
|
*
|
|
3320
|
-
*
|
|
3258
|
+
* **Example** (Usage)
|
|
3259
|
+
*
|
|
3321
3260
|
* ```ts
|
|
3322
3261
|
* import { Effect } from "effect"
|
|
3323
3262
|
*
|
|
@@ -3334,37 +3273,38 @@ export const filterMapOrElse = internal.filterMapOrElse;
|
|
|
3334
3273
|
* // Result: Effect.fail("Expected even number, got 5")
|
|
3335
3274
|
* ```
|
|
3336
3275
|
*
|
|
3276
|
+
* @category filtering
|
|
3337
3277
|
* @since 2.0.0
|
|
3338
|
-
* @category Filtering
|
|
3339
3278
|
*/
|
|
3340
3279
|
export const filterOrFail = internal.filterOrFail;
|
|
3341
3280
|
/**
|
|
3342
3281
|
* Filters an effect with a `Filter`, failing when the filter fails.
|
|
3343
3282
|
*
|
|
3283
|
+
* @category filtering
|
|
3344
3284
|
* @since 4.0.0
|
|
3345
|
-
* @category Filtering
|
|
3346
3285
|
*/
|
|
3347
3286
|
export const filterMapOrFail = internal.filterMapOrFail;
|
|
3348
3287
|
// -----------------------------------------------------------------------------
|
|
3349
3288
|
// Conditional Operators
|
|
3350
3289
|
// -----------------------------------------------------------------------------
|
|
3351
3290
|
/**
|
|
3352
|
-
* Conditionally
|
|
3291
|
+
* Conditionally runs an effect based on the result of an effectful boolean
|
|
3292
|
+
* condition.
|
|
3353
3293
|
*
|
|
3354
3294
|
* **Details**
|
|
3355
3295
|
*
|
|
3356
|
-
*
|
|
3357
|
-
*
|
|
3358
|
-
*
|
|
3359
|
-
*
|
|
3296
|
+
* The condition effect is evaluated first. If it succeeds with `true`, the
|
|
3297
|
+
* source effect is run and its success value is wrapped in `Option.some`. If it
|
|
3298
|
+
* succeeds with `false`, the source effect is skipped and the result is
|
|
3299
|
+
* `Option.none`. If the condition effect fails, that failure is preserved.
|
|
3360
3300
|
*
|
|
3361
3301
|
* **When to Use**
|
|
3362
3302
|
*
|
|
3363
|
-
*
|
|
3364
|
-
*
|
|
3365
|
-
*
|
|
3303
|
+
* Use this when an effectful check decides whether to run another effect while
|
|
3304
|
+
* representing the skipped case explicitly.
|
|
3305
|
+
*
|
|
3306
|
+
* **Example** (Usage)
|
|
3366
3307
|
*
|
|
3367
|
-
* @example
|
|
3368
3308
|
* ```ts
|
|
3369
3309
|
* import { Console, Effect } from "effect"
|
|
3370
3310
|
*
|
|
@@ -3380,11 +3320,10 @@ export const filterMapOrFail = internal.filterMapOrFail;
|
|
|
3380
3320
|
* // { _id: 'Option', _tag: 'Some', value: undefined }
|
|
3381
3321
|
* ```
|
|
3382
3322
|
*
|
|
3383
|
-
* @see {@link
|
|
3384
|
-
* @see {@link unless} for a version that executes the effect when the condition is `false`.
|
|
3323
|
+
* @see {@link when} for conditional execution with a boolean condition.
|
|
3385
3324
|
*
|
|
3386
|
-
* @since 2.0.0
|
|
3387
3325
|
* @category Conditional Operators
|
|
3326
|
+
* @since 2.0.0
|
|
3388
3327
|
*/
|
|
3389
3328
|
export const when = internal.when;
|
|
3390
3329
|
// -----------------------------------------------------------------------------
|
|
@@ -3408,9 +3347,9 @@ export const when = internal.when;
|
|
|
3408
3347
|
*
|
|
3409
3348
|
* @see {@link matchEffect} if you need to perform side effects in the handlers.
|
|
3410
3349
|
*
|
|
3411
|
-
*
|
|
3350
|
+
* **Example** (Handling Both Success and Failure Cases)
|
|
3351
|
+
*
|
|
3412
3352
|
* ```ts
|
|
3413
|
-
* // Title: Handling Both Success and Failure Cases
|
|
3414
3353
|
* import { Data, Effect } from "effect"
|
|
3415
3354
|
*
|
|
3416
3355
|
* class ExampleError extends Data.TaggedError("ExampleError")<{ readonly message: string }> {}
|
|
@@ -3440,8 +3379,8 @@ export const when = internal.when;
|
|
|
3440
3379
|
* // Output: "failure: Uh oh!"
|
|
3441
3380
|
* ```
|
|
3442
3381
|
*
|
|
3443
|
-
* @since 2.0.0
|
|
3444
3382
|
* @category Pattern Matching
|
|
3383
|
+
* @since 2.0.0
|
|
3445
3384
|
*/
|
|
3446
3385
|
export const match = internal.match;
|
|
3447
3386
|
/**
|
|
@@ -3461,7 +3400,8 @@ export const match = internal.match;
|
|
|
3461
3400
|
* optimal performance for resolved effects. This is particularly useful in
|
|
3462
3401
|
* scenarios where you frequently work with already computed values.
|
|
3463
3402
|
*
|
|
3464
|
-
*
|
|
3403
|
+
* **Example** (Usage)
|
|
3404
|
+
*
|
|
3465
3405
|
* ```ts
|
|
3466
3406
|
* import { Effect } from "effect"
|
|
3467
3407
|
*
|
|
@@ -3477,8 +3417,8 @@ export const match = internal.match;
|
|
|
3477
3417
|
* @see {@link match} for the non-eager version.
|
|
3478
3418
|
* @see {@link matchEffect} if you need to perform side effects in the handlers.
|
|
3479
3419
|
*
|
|
3480
|
-
* @since 2.0.0
|
|
3481
3420
|
* @category Pattern Matching
|
|
3421
|
+
* @since 4.0.0
|
|
3482
3422
|
*/
|
|
3483
3423
|
export const matchEager = internal.matchEager;
|
|
3484
3424
|
/**
|
|
@@ -3495,7 +3435,8 @@ export const matchEager = internal.matchEager;
|
|
|
3495
3435
|
* regular failures, defects, or interruptions. You can provide specific
|
|
3496
3436
|
* handling logic for each failure type based on the cause.
|
|
3497
3437
|
*
|
|
3498
|
-
*
|
|
3438
|
+
* **Example** (Usage)
|
|
3439
|
+
*
|
|
3499
3440
|
* ```ts
|
|
3500
3441
|
* import { Cause, Effect } from "effect"
|
|
3501
3442
|
*
|
|
@@ -3514,8 +3455,8 @@ export const matchEager = internal.matchEager;
|
|
|
3514
3455
|
* handlers.
|
|
3515
3456
|
* @see {@link match} if you don't need to handle the cause of the failure.
|
|
3516
3457
|
*
|
|
3517
|
-
* @since 2.0.0
|
|
3518
3458
|
* @category Pattern Matching
|
|
3459
|
+
* @since 2.0.0
|
|
3519
3460
|
*/
|
|
3520
3461
|
export const matchCause = internal.matchCause;
|
|
3521
3462
|
/**
|
|
@@ -3533,7 +3474,8 @@ export const matchCause = internal.matchCause;
|
|
|
3533
3474
|
* and you want to avoid the overhead of the effect pipeline. For pending effects,
|
|
3534
3475
|
* it automatically falls back to the regular `matchCause` behavior.
|
|
3535
3476
|
*
|
|
3536
|
-
*
|
|
3477
|
+
* **Example** (Usage)
|
|
3478
|
+
*
|
|
3537
3479
|
* ```ts
|
|
3538
3480
|
* import { Effect } from "effect"
|
|
3539
3481
|
*
|
|
@@ -3543,8 +3485,8 @@ export const matchCause = internal.matchCause;
|
|
|
3543
3485
|
* })
|
|
3544
3486
|
* ```
|
|
3545
3487
|
*
|
|
3546
|
-
* @since 3.8.0
|
|
3547
3488
|
* @category Pattern Matching
|
|
3489
|
+
* @since 4.0.0
|
|
3548
3490
|
*/
|
|
3549
3491
|
export const matchCauseEager = internal.matchCauseEager;
|
|
3550
3492
|
/**
|
|
@@ -3553,8 +3495,8 @@ export const matchCauseEager = internal.matchCauseEager;
|
|
|
3553
3495
|
* If the effect is an `Exit`, the matching handler runs immediately; otherwise it behaves like
|
|
3554
3496
|
* {@link matchCauseEffect}.
|
|
3555
3497
|
*
|
|
3556
|
-
* @since 4.0.0
|
|
3557
3498
|
* @category Pattern Matching
|
|
3499
|
+
* @since 4.0.0
|
|
3558
3500
|
*/
|
|
3559
3501
|
export const matchCauseEffectEager = internal.matchCauseEffectEager;
|
|
3560
3502
|
/**
|
|
@@ -3569,7 +3511,8 @@ export const matchCauseEffectEager = internal.matchCauseEffectEager;
|
|
|
3569
3511
|
* you to respond accordingly while performing side effects (like logging or
|
|
3570
3512
|
* other operations).
|
|
3571
3513
|
*
|
|
3572
|
-
*
|
|
3514
|
+
* **Example** (Usage)
|
|
3515
|
+
*
|
|
3573
3516
|
* ```ts
|
|
3574
3517
|
* import { Cause, Console, Data, Effect, Result } from "effect"
|
|
3575
3518
|
*
|
|
@@ -3607,30 +3550,29 @@ export const matchCauseEffectEager = internal.matchCauseEffectEager;
|
|
|
3607
3550
|
* @see {@link matchCause} if you don't need side effects and only want to handle the result or failure.
|
|
3608
3551
|
* @see {@link matchEffect} if you don't need to handle the cause of the failure.
|
|
3609
3552
|
*
|
|
3610
|
-
* @since 2.0.0
|
|
3611
3553
|
* @category Pattern Matching
|
|
3554
|
+
* @since 2.0.0
|
|
3612
3555
|
*/
|
|
3613
3556
|
export const matchCauseEffect = internal.matchCauseEffect;
|
|
3614
3557
|
/**
|
|
3615
|
-
* Handles both success and failure
|
|
3616
|
-
* side effects.
|
|
3558
|
+
* Handles both success and failure by running effectful handlers.
|
|
3617
3559
|
*
|
|
3618
3560
|
* **Details**
|
|
3619
3561
|
*
|
|
3620
|
-
*
|
|
3621
|
-
*
|
|
3562
|
+
* Use `matchEffect` when either branch needs to return an `Effect`, such as
|
|
3563
|
+
* performing logging, recovery, notification, or other effectful work. The
|
|
3564
|
+
* returned effect succeeds or fails according to the handler that is run.
|
|
3622
3565
|
*
|
|
3623
3566
|
* **When to Use**
|
|
3624
3567
|
*
|
|
3625
|
-
*
|
|
3626
|
-
* notifying users, based on whether an effect succeeds or fails.
|
|
3568
|
+
* Use this when the failure or success branch must run additional effects.
|
|
3627
3569
|
*
|
|
3628
3570
|
* @see {@link match} if you don't need side effects and only want to handle the
|
|
3629
3571
|
* result or failure.
|
|
3630
3572
|
*
|
|
3631
|
-
*
|
|
3573
|
+
* **Example** (Handling Both Success and Failure Cases with Side Effects)
|
|
3574
|
+
*
|
|
3632
3575
|
* ```ts
|
|
3633
|
-
* // Title: Handling Both Success and Failure Cases with Side Effects
|
|
3634
3576
|
* import { Data, Effect } from "effect"
|
|
3635
3577
|
*
|
|
3636
3578
|
* class ExampleError extends Data.TaggedError("ExampleError")<{ readonly message: string }> {}
|
|
@@ -3669,8 +3611,8 @@ export const matchCauseEffect = internal.matchCauseEffect;
|
|
|
3669
3611
|
* // failure: Uh oh!
|
|
3670
3612
|
* ```
|
|
3671
3613
|
*
|
|
3672
|
-
* @since 2.0.0
|
|
3673
3614
|
* @category Pattern Matching
|
|
3615
|
+
* @since 2.0.0
|
|
3674
3616
|
*/
|
|
3675
3617
|
export const matchEffect = internal.matchEffect;
|
|
3676
3618
|
// -----------------------------------------------------------------------------
|
|
@@ -3681,7 +3623,7 @@ export const matchEffect = internal.matchEffect;
|
|
|
3681
3623
|
*
|
|
3682
3624
|
* Defects are not converted; if the effect dies, the resulting effect dies too.
|
|
3683
3625
|
*
|
|
3684
|
-
* **Example**
|
|
3626
|
+
* **Example** (Checking whether an effect fails)
|
|
3685
3627
|
*
|
|
3686
3628
|
* ```ts
|
|
3687
3629
|
* import { Console, Effect } from "effect"
|
|
@@ -3695,8 +3637,8 @@ export const matchEffect = internal.matchEffect;
|
|
|
3695
3637
|
* // Output: true
|
|
3696
3638
|
* ```
|
|
3697
3639
|
*
|
|
3698
|
-
* @since 2.0.0
|
|
3699
3640
|
* @category Condition Checking
|
|
3641
|
+
* @since 2.0.0
|
|
3700
3642
|
*/
|
|
3701
3643
|
export const isFailure = internal.isFailure;
|
|
3702
3644
|
/**
|
|
@@ -3705,7 +3647,7 @@ export const isFailure = internal.isFailure;
|
|
|
3705
3647
|
* Returns `false` for failures in the error channel, but defects still fail the
|
|
3706
3648
|
* effect.
|
|
3707
3649
|
*
|
|
3708
|
-
* **Example**
|
|
3650
|
+
* **Example** (Checking whether an effect succeeds)
|
|
3709
3651
|
*
|
|
3710
3652
|
* ```ts
|
|
3711
3653
|
* import { Console, Effect } from "effect"
|
|
@@ -3723,8 +3665,8 @@ export const isFailure = internal.isFailure;
|
|
|
3723
3665
|
* // failed: false
|
|
3724
3666
|
* ```
|
|
3725
3667
|
*
|
|
3726
|
-
* @since 2.0.0
|
|
3727
3668
|
* @category Condition Checking
|
|
3669
|
+
* @since 2.0.0
|
|
3728
3670
|
*/
|
|
3729
3671
|
export const isSuccess = internal.isSuccess;
|
|
3730
3672
|
// -----------------------------------------------------------------------------
|
|
@@ -3737,9 +3679,10 @@ export const isSuccess = internal.isSuccess;
|
|
|
3737
3679
|
* in the effect's environment. This can be useful for debugging, introspection,
|
|
3738
3680
|
* or when you need to pass the entire context to another function.
|
|
3739
3681
|
*
|
|
3740
|
-
*
|
|
3682
|
+
* **Example** (Usage)
|
|
3683
|
+
*
|
|
3741
3684
|
* ```ts
|
|
3742
|
-
* import { Console, Effect, Option
|
|
3685
|
+
* import { Console, Context, Effect, Option } from "effect"
|
|
3743
3686
|
*
|
|
3744
3687
|
* const Logger = Context.Service<{
|
|
3745
3688
|
* log: (msg: string) => void
|
|
@@ -3765,8 +3708,8 @@ export const isSuccess = internal.isSuccess;
|
|
|
3765
3708
|
* const provided = Effect.provideContext(program, context)
|
|
3766
3709
|
* ```
|
|
3767
3710
|
*
|
|
3768
|
-
* @since 2.0.0
|
|
3769
3711
|
* @category Environment
|
|
3712
|
+
* @since 2.0.0
|
|
3770
3713
|
*/
|
|
3771
3714
|
export const context = internal.context;
|
|
3772
3715
|
/**
|
|
@@ -3776,9 +3719,10 @@ export const context = internal.context;
|
|
|
3776
3719
|
* computations based on all available services. This is useful when you need
|
|
3777
3720
|
* to conditionally execute logic based on what services are available.
|
|
3778
3721
|
*
|
|
3779
|
-
*
|
|
3722
|
+
* **Example** (Usage)
|
|
3723
|
+
*
|
|
3780
3724
|
* ```ts
|
|
3781
|
-
* import { Console, Effect, Option
|
|
3725
|
+
* import { Console, Context, Effect, Option } from "effect"
|
|
3782
3726
|
*
|
|
3783
3727
|
* const Logger = Context.Service<{
|
|
3784
3728
|
* log: (msg: string) => void
|
|
@@ -3810,8 +3754,8 @@ export const context = internal.context;
|
|
|
3810
3754
|
* })
|
|
3811
3755
|
* ```
|
|
3812
3756
|
*
|
|
3813
|
-
* @since 2.0.0
|
|
3814
3757
|
* @category Environment
|
|
3758
|
+
* @since 2.0.0
|
|
3815
3759
|
*/
|
|
3816
3760
|
export const contextWith = internal.contextWith;
|
|
3817
3761
|
/**
|
|
@@ -3819,9 +3763,10 @@ export const contextWith = internal.contextWith;
|
|
|
3819
3763
|
* to build the layer every time; by default, layers are shared between provide
|
|
3820
3764
|
* calls.
|
|
3821
3765
|
*
|
|
3822
|
-
*
|
|
3766
|
+
* **Example** (Usage)
|
|
3767
|
+
*
|
|
3823
3768
|
* ```ts
|
|
3824
|
-
* import { Effect, Layer
|
|
3769
|
+
* import { Context, Effect, Layer } from "effect"
|
|
3825
3770
|
*
|
|
3826
3771
|
* interface Database {
|
|
3827
3772
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
@@ -3844,8 +3789,8 @@ export const contextWith = internal.contextWith;
|
|
|
3844
3789
|
* // Output: "Result for: SELECT * FROM users"
|
|
3845
3790
|
* ```
|
|
3846
3791
|
*
|
|
3847
|
-
* @since 2.0.0
|
|
3848
3792
|
* @category Environment
|
|
3793
|
+
* @since 2.0.0
|
|
3849
3794
|
*/
|
|
3850
3795
|
export const provide = internalLayer.provide;
|
|
3851
3796
|
/**
|
|
@@ -3857,9 +3802,10 @@ export const provide = internalLayer.provide;
|
|
|
3857
3802
|
* that contains all the required services. It removes the provided services
|
|
3858
3803
|
* from the effect's requirements, making them available to the effect.
|
|
3859
3804
|
*
|
|
3860
|
-
*
|
|
3805
|
+
* **Example** (Usage)
|
|
3806
|
+
*
|
|
3861
3807
|
* ```ts
|
|
3862
|
-
* import {
|
|
3808
|
+
* import { Context, Effect } from "effect"
|
|
3863
3809
|
*
|
|
3864
3810
|
* // Define service keys
|
|
3865
3811
|
* const Logger = Context.Service<{
|
|
@@ -3884,16 +3830,17 @@ export const provide = internalLayer.provide;
|
|
|
3884
3830
|
* const provided = Effect.provideContext(program, context)
|
|
3885
3831
|
* ```
|
|
3886
3832
|
*
|
|
3887
|
-
* @since 2.0.0
|
|
3888
3833
|
* @category Environment
|
|
3834
|
+
* @since 4.0.0
|
|
3889
3835
|
*/
|
|
3890
3836
|
export const provideContext = internal.provideContext;
|
|
3891
3837
|
/**
|
|
3892
3838
|
* Accesses a service from the context.
|
|
3893
3839
|
*
|
|
3894
|
-
*
|
|
3840
|
+
* **Example** (Usage)
|
|
3841
|
+
*
|
|
3895
3842
|
* ```ts
|
|
3896
|
-
* import {
|
|
3843
|
+
* import { Context, Effect } from "effect"
|
|
3897
3844
|
*
|
|
3898
3845
|
* interface Database {
|
|
3899
3846
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
@@ -3907,8 +3854,8 @@ export const provideContext = internal.provideContext;
|
|
|
3907
3854
|
* })
|
|
3908
3855
|
* ```
|
|
3909
3856
|
*
|
|
3910
|
-
* @since 4.0.0
|
|
3911
3857
|
* @category Context
|
|
3858
|
+
* @since 4.0.0
|
|
3912
3859
|
*/
|
|
3913
3860
|
export const service = internal.service;
|
|
3914
3861
|
/**
|
|
@@ -3921,9 +3868,10 @@ export const service = internal.service;
|
|
|
3921
3868
|
* available, it returns `None`. Unlike `service`, this function does not
|
|
3922
3869
|
* require the service to be present in the environment.
|
|
3923
3870
|
*
|
|
3924
|
-
*
|
|
3871
|
+
* **Example** (Usage)
|
|
3872
|
+
*
|
|
3925
3873
|
* ```ts
|
|
3926
|
-
* import { Effect, Option
|
|
3874
|
+
* import { Context, Effect, Option } from "effect"
|
|
3927
3875
|
*
|
|
3928
3876
|
* // Define a service key
|
|
3929
3877
|
* const Logger = Context.Service<{
|
|
@@ -3942,8 +3890,8 @@ export const service = internal.service;
|
|
|
3942
3890
|
* })
|
|
3943
3891
|
* ```
|
|
3944
3892
|
*
|
|
3945
|
-
* @since 2.0.0
|
|
3946
3893
|
* @category Context
|
|
3894
|
+
* @since 2.0.0
|
|
3947
3895
|
*/
|
|
3948
3896
|
export const serviceOption = internal.serviceOption;
|
|
3949
3897
|
/**
|
|
@@ -3954,9 +3902,10 @@ export const serviceOption = internal.serviceOption;
|
|
|
3954
3902
|
* This function allows you to transform the context required by an effect,
|
|
3955
3903
|
* providing part of the context and leaving the rest to be fulfilled later.
|
|
3956
3904
|
*
|
|
3957
|
-
*
|
|
3905
|
+
* **Example** (Usage)
|
|
3906
|
+
*
|
|
3958
3907
|
* ```ts
|
|
3959
|
-
* import {
|
|
3908
|
+
* import { Context, Effect } from "effect"
|
|
3960
3909
|
*
|
|
3961
3910
|
* // Define services
|
|
3962
3911
|
* const Logger = Context.Service<{
|
|
@@ -3983,16 +3932,21 @@ export const serviceOption = internal.serviceOption;
|
|
|
3983
3932
|
* })
|
|
3984
3933
|
* ```
|
|
3985
3934
|
*
|
|
3986
|
-
* @since 4.0.0
|
|
3987
3935
|
* @category Context
|
|
3936
|
+
* @since 4.0.0
|
|
3988
3937
|
*/
|
|
3989
3938
|
export const updateContext = internal.updateContext;
|
|
3990
3939
|
/**
|
|
3991
|
-
*
|
|
3940
|
+
* Runs an effect with a service implementation transformed by the provided
|
|
3941
|
+
* function.
|
|
3942
|
+
*
|
|
3943
|
+
* The service must be available in the effect's context; `updateService`
|
|
3944
|
+
* replaces it for the wrapped effect with the value returned by the updater.
|
|
3945
|
+
*
|
|
3946
|
+
* **Example** (Usage)
|
|
3992
3947
|
*
|
|
3993
|
-
* @example
|
|
3994
3948
|
* ```ts
|
|
3995
|
-
* import { Console,
|
|
3949
|
+
* import { Console, Context, Effect } from "effect"
|
|
3996
3950
|
*
|
|
3997
3951
|
* // Define a counter service
|
|
3998
3952
|
* const Counter = Context.Service<{ count: number }>("Counter")
|
|
@@ -4012,8 +3966,8 @@ export const updateContext = internal.updateContext;
|
|
|
4012
3966
|
* // 1
|
|
4013
3967
|
* ```
|
|
4014
3968
|
*
|
|
4015
|
-
* @since 2.0.0
|
|
4016
3969
|
* @category Context
|
|
3970
|
+
* @since 2.0.0
|
|
4017
3971
|
*/
|
|
4018
3972
|
export const updateService = internal.updateService;
|
|
4019
3973
|
/**
|
|
@@ -4028,9 +3982,10 @@ export const updateService = internal.updateService;
|
|
|
4028
3982
|
*
|
|
4029
3983
|
* @see {@link provide} for providing multiple layers to an effect.
|
|
4030
3984
|
*
|
|
4031
|
-
*
|
|
3985
|
+
* **Example** (Usage)
|
|
3986
|
+
*
|
|
4032
3987
|
* ```ts
|
|
4033
|
-
* import { Console,
|
|
3988
|
+
* import { Console, Context, Effect } from "effect"
|
|
4034
3989
|
*
|
|
4035
3990
|
* // Define a service for configuration
|
|
4036
3991
|
* const Config = Context.Service<{
|
|
@@ -4058,23 +4013,24 @@ export const updateService = internal.updateService;
|
|
|
4058
4013
|
* // data
|
|
4059
4014
|
* ```
|
|
4060
4015
|
*
|
|
4061
|
-
* @since 2.0.0
|
|
4062
4016
|
* @category Context
|
|
4017
|
+
* @since 2.0.0
|
|
4063
4018
|
*/
|
|
4064
4019
|
export const provideService = internal.provideService;
|
|
4065
4020
|
/**
|
|
4066
|
-
* Provides
|
|
4067
|
-
* requires more than one service use `provide` instead.
|
|
4021
|
+
* Provides one service to an effect using an effectful acquisition.
|
|
4068
4022
|
*
|
|
4069
|
-
*
|
|
4070
|
-
*
|
|
4071
|
-
*
|
|
4072
|
-
*
|
|
4073
|
-
*
|
|
4023
|
+
* **Details**
|
|
4024
|
+
*
|
|
4025
|
+
* `provideServiceEffect` runs the acquisition effect to produce the service
|
|
4026
|
+
* implementation, removes that service from the wrapped effect's requirements,
|
|
4027
|
+
* and leaves any other requirements to be provided later. Acquisition failures
|
|
4028
|
+
* are included in the returned effect's error channel.
|
|
4029
|
+
*
|
|
4030
|
+
* **Example** (Usage)
|
|
4074
4031
|
*
|
|
4075
|
-
* @example
|
|
4076
4032
|
* ```ts
|
|
4077
|
-
* import { Console,
|
|
4033
|
+
* import { Console, Context, Effect } from "effect"
|
|
4078
4034
|
*
|
|
4079
4035
|
* // Define a database connection service
|
|
4080
4036
|
* interface DatabaseConnection {
|
|
@@ -4111,8 +4067,8 @@ export const provideService = internal.provideService;
|
|
|
4111
4067
|
* // Result for: SELECT * FROM users
|
|
4112
4068
|
* ```
|
|
4113
4069
|
*
|
|
4114
|
-
* @since 2.0.0
|
|
4115
4070
|
* @category Context
|
|
4071
|
+
* @since 2.0.0
|
|
4116
4072
|
*/
|
|
4117
4073
|
export const provideServiceEffect = internal.provideServiceEffect;
|
|
4118
4074
|
// -----------------------------------------------------------------------------
|
|
@@ -4121,7 +4077,8 @@ export const provideServiceEffect = internal.provideServiceEffect;
|
|
|
4121
4077
|
/**
|
|
4122
4078
|
* Sets the concurrency level for parallel operations within an effect.
|
|
4123
4079
|
*
|
|
4124
|
-
*
|
|
4080
|
+
* **Example** (Usage)
|
|
4081
|
+
*
|
|
4125
4082
|
* ```ts
|
|
4126
4083
|
* import { Console, Effect } from "effect"
|
|
4127
4084
|
*
|
|
@@ -4146,8 +4103,8 @@ export const provideServiceEffect = internal.provideServiceEffect;
|
|
|
4146
4103
|
* // [1, 2, 3, 4, 5]
|
|
4147
4104
|
* ```
|
|
4148
4105
|
*
|
|
4106
|
+
* @category references
|
|
4149
4107
|
* @since 2.0.0
|
|
4150
|
-
* @category References
|
|
4151
4108
|
*/
|
|
4152
4109
|
export const withConcurrency = internal.withConcurrency;
|
|
4153
4110
|
// -----------------------------------------------------------------------------
|
|
@@ -4156,7 +4113,8 @@ export const withConcurrency = internal.withConcurrency;
|
|
|
4156
4113
|
/**
|
|
4157
4114
|
* Returns the current scope for resource management.
|
|
4158
4115
|
*
|
|
4159
|
-
*
|
|
4116
|
+
* **Example** (Usage)
|
|
4117
|
+
*
|
|
4160
4118
|
* ```ts
|
|
4161
4119
|
* import { Console, Effect } from "effect"
|
|
4162
4120
|
*
|
|
@@ -4181,8 +4139,8 @@ export const withConcurrency = internal.withConcurrency;
|
|
|
4181
4139
|
* // Releasing resource
|
|
4182
4140
|
* ```
|
|
4183
4141
|
*
|
|
4142
|
+
* @category resource management
|
|
4184
4143
|
* @since 2.0.0
|
|
4185
|
-
* @category Resource Management & Finalization
|
|
4186
4144
|
*/
|
|
4187
4145
|
export const scope = internal.scope;
|
|
4188
4146
|
/**
|
|
@@ -4190,7 +4148,8 @@ export const scope = internal.scope;
|
|
|
4190
4148
|
* ensuring that their finalizers are run as soon as this workflow completes
|
|
4191
4149
|
* execution, whether by success, failure, or interruption.
|
|
4192
4150
|
*
|
|
4193
|
-
*
|
|
4151
|
+
* **Example** (Usage)
|
|
4152
|
+
*
|
|
4194
4153
|
* ```ts
|
|
4195
4154
|
* import { Console, Effect } from "effect"
|
|
4196
4155
|
*
|
|
@@ -4213,14 +4172,15 @@ export const scope = internal.scope;
|
|
|
4213
4172
|
* // Output: "Releasing resource"
|
|
4214
4173
|
* ```
|
|
4215
4174
|
*
|
|
4175
|
+
* @category resource management
|
|
4216
4176
|
* @since 2.0.0
|
|
4217
|
-
* @category Resource Management & Finalization
|
|
4218
4177
|
*/
|
|
4219
4178
|
export const scoped = internal.scoped;
|
|
4220
4179
|
/**
|
|
4221
4180
|
* Creates a scoped effect by providing access to the scope.
|
|
4222
4181
|
*
|
|
4223
|
-
*
|
|
4182
|
+
* **Example** (Usage)
|
|
4183
|
+
*
|
|
4224
4184
|
* ```ts
|
|
4225
4185
|
* import { Console, Effect, Scope } from "effect"
|
|
4226
4186
|
*
|
|
@@ -4252,24 +4212,25 @@ export const scoped = internal.scoped;
|
|
|
4252
4212
|
* // Manual finalizer
|
|
4253
4213
|
* ```
|
|
4254
4214
|
*
|
|
4255
|
-
* @
|
|
4256
|
-
* @
|
|
4215
|
+
* @category resource management
|
|
4216
|
+
* @since 3.11.0
|
|
4257
4217
|
*/
|
|
4258
4218
|
export const scopedWith = internal.scopedWith;
|
|
4259
4219
|
/**
|
|
4260
|
-
*
|
|
4261
|
-
*
|
|
4220
|
+
* Constructs a scoped resource from an acquisition effect and a release
|
|
4221
|
+
* finalizer.
|
|
4262
4222
|
*
|
|
4263
|
-
*
|
|
4264
|
-
*
|
|
4265
|
-
*
|
|
4266
|
-
* is
|
|
4223
|
+
* **Details**
|
|
4224
|
+
*
|
|
4225
|
+
* If acquisition succeeds, the release finalizer is added to the current scope
|
|
4226
|
+
* and is guaranteed to run when that scope closes. The finalizer receives the
|
|
4227
|
+
* `Exit` value used to close the scope.
|
|
4228
|
+
*
|
|
4229
|
+
* By default, acquisition is protected by an uninterruptible region. Pass
|
|
4230
|
+
* `{ interruptible: true }` to allow the acquisition effect to be interrupted.
|
|
4267
4231
|
*
|
|
4268
|
-
*
|
|
4269
|
-
* Additionally, the `release` `Effect` value may depend on the `Exit` value
|
|
4270
|
-
* specified when the scope is closed.
|
|
4232
|
+
* **Example** (Usage)
|
|
4271
4233
|
*
|
|
4272
|
-
* @example
|
|
4273
4234
|
* ```ts
|
|
4274
4235
|
* import { Console, Effect, Exit } from "effect"
|
|
4275
4236
|
*
|
|
@@ -4306,8 +4267,8 @@ export const scopedWith = internal.scopedWith;
|
|
|
4306
4267
|
* )
|
|
4307
4268
|
* ```
|
|
4308
4269
|
*
|
|
4270
|
+
* @category resource management
|
|
4309
4271
|
* @since 2.0.0
|
|
4310
|
-
* @category Resource Management & Finalization
|
|
4311
4272
|
*/
|
|
4312
4273
|
export const acquireRelease = internal.acquireRelease;
|
|
4313
4274
|
/**
|
|
@@ -4323,12 +4284,13 @@ export const acquireRelease = internal.acquireRelease;
|
|
|
4323
4284
|
* JavaScript disposal protocal instead of requiring an explicit release
|
|
4324
4285
|
* function.
|
|
4325
4286
|
*
|
|
4326
|
-
* @see
|
|
4287
|
+
* @see [JavaScript `using` declarations](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/using)
|
|
4288
|
+
*
|
|
4289
|
+
* **Example** (Usage)
|
|
4327
4290
|
*
|
|
4328
|
-
* @example
|
|
4329
4291
|
* ```ts
|
|
4330
4292
|
* import sqlite from "node:sqlite";
|
|
4331
|
-
* import { Effect } from "effect"
|
|
4293
|
+
* import { Effect } from "effect"
|
|
4332
4294
|
*
|
|
4333
4295
|
* const program = Effect.scoped(
|
|
4334
4296
|
* Effect.gen(function* () {
|
|
@@ -4344,8 +4306,8 @@ export const acquireRelease = internal.acquireRelease;
|
|
|
4344
4306
|
* )
|
|
4345
4307
|
* ```
|
|
4346
4308
|
*
|
|
4309
|
+
* @category resource management
|
|
4347
4310
|
* @since 4.0.0
|
|
4348
|
-
* @category Resource Management & Finalization
|
|
4349
4311
|
*/
|
|
4350
4312
|
export const acquireDisposable = internal.acquireDisposable;
|
|
4351
4313
|
/**
|
|
@@ -4371,7 +4333,8 @@ export const acquireDisposable = internal.acquireDisposable;
|
|
|
4371
4333
|
* is not desired, errors produced by the `release` `Effect` value can be caught
|
|
4372
4334
|
* and ignored.
|
|
4373
4335
|
*
|
|
4374
|
-
*
|
|
4336
|
+
* **Example** (Usage)
|
|
4337
|
+
*
|
|
4375
4338
|
* ```ts
|
|
4376
4339
|
* import { Console, Effect, Exit } from "effect"
|
|
4377
4340
|
*
|
|
@@ -4416,8 +4379,8 @@ export const acquireDisposable = internal.acquireDisposable;
|
|
|
4416
4379
|
* // Closing connection to db://localhost:5432 (success)
|
|
4417
4380
|
* ```
|
|
4418
4381
|
*
|
|
4382
|
+
* @category resource management
|
|
4419
4383
|
* @since 2.0.0
|
|
4420
|
-
* @category Resource Management & Finalization
|
|
4421
4384
|
*/
|
|
4422
4385
|
export const acquireUseRelease = internal.acquireUseRelease;
|
|
4423
4386
|
/**
|
|
@@ -4429,7 +4392,8 @@ export const acquireUseRelease = internal.acquireUseRelease;
|
|
|
4429
4392
|
* whether the effect succeeds or fails. They're commonly used for resource
|
|
4430
4393
|
* cleanup, logging, or other side effects that should always occur.
|
|
4431
4394
|
*
|
|
4432
|
-
*
|
|
4395
|
+
* **Example** (Usage)
|
|
4396
|
+
*
|
|
4433
4397
|
* ```ts
|
|
4434
4398
|
* import { Console, Effect, Exit } from "effect"
|
|
4435
4399
|
*
|
|
@@ -4458,8 +4422,8 @@ export const acquireUseRelease = internal.acquireUseRelease;
|
|
|
4458
4422
|
* // operation result
|
|
4459
4423
|
* ```
|
|
4460
4424
|
*
|
|
4425
|
+
* @category resource management
|
|
4461
4426
|
* @since 2.0.0
|
|
4462
|
-
* @category Resource Management & Finalization
|
|
4463
4427
|
*/
|
|
4464
4428
|
export const addFinalizer = internal.addFinalizer;
|
|
4465
4429
|
/**
|
|
@@ -4473,7 +4437,8 @@ export const addFinalizer = internal.addFinalizer;
|
|
|
4473
4437
|
* should generally not be used for releasing resources. For higher-level
|
|
4474
4438
|
* logic built on `ensuring`, see the `acquireRelease` family of methods.
|
|
4475
4439
|
*
|
|
4476
|
-
*
|
|
4440
|
+
* **Example** (Usage)
|
|
4441
|
+
*
|
|
4477
4442
|
* ```ts
|
|
4478
4443
|
* import { Console, Effect } from "effect"
|
|
4479
4444
|
*
|
|
@@ -4498,17 +4463,18 @@ export const addFinalizer = internal.addFinalizer;
|
|
|
4498
4463
|
* // 42
|
|
4499
4464
|
* ```
|
|
4500
4465
|
*
|
|
4466
|
+
* @category resource management
|
|
4501
4467
|
* @since 2.0.0
|
|
4502
|
-
* @category Resource Management & Finalization
|
|
4503
4468
|
*/
|
|
4504
4469
|
export const ensuring = internal.ensuring;
|
|
4505
4470
|
/**
|
|
4506
4471
|
* Runs the specified effect if this effect fails, providing the error to the
|
|
4507
4472
|
* effect if it exists. The provided effect will not be interrupted.
|
|
4508
4473
|
*
|
|
4509
|
-
*
|
|
4474
|
+
* **Example** (Usage)
|
|
4475
|
+
*
|
|
4510
4476
|
* ```ts
|
|
4511
|
-
* import { Cause,
|
|
4477
|
+
* import { Cause, Console, Data, Effect } from "effect"
|
|
4512
4478
|
*
|
|
4513
4479
|
* class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
|
|
4514
4480
|
*
|
|
@@ -4525,15 +4491,16 @@ export const ensuring = internal.ensuring;
|
|
|
4525
4491
|
* // TaskError: Something went wrong
|
|
4526
4492
|
* ```
|
|
4527
4493
|
*
|
|
4494
|
+
* @category resource management
|
|
4528
4495
|
* @since 2.0.0
|
|
4529
|
-
* @category Resource Management & Finalization
|
|
4530
4496
|
*/
|
|
4531
4497
|
export const onError = internal.onError;
|
|
4532
4498
|
/**
|
|
4533
4499
|
* Runs the finalizer only when this effect fails and the `Cause` matches the
|
|
4534
4500
|
* provided predicate.
|
|
4535
4501
|
*
|
|
4536
|
-
*
|
|
4502
|
+
* **Example** (Usage)
|
|
4503
|
+
*
|
|
4537
4504
|
* ```ts
|
|
4538
4505
|
* import { Cause, Console, Effect } from "effect"
|
|
4539
4506
|
*
|
|
@@ -4549,31 +4516,36 @@ export const onError = internal.onError;
|
|
|
4549
4516
|
* )
|
|
4550
4517
|
* ```
|
|
4551
4518
|
*
|
|
4519
|
+
* @category resource management
|
|
4552
4520
|
* @since 4.0.0
|
|
4553
|
-
* @category Resource Management & Finalization
|
|
4554
4521
|
*/
|
|
4555
4522
|
export const onErrorIf = internal.onErrorIf;
|
|
4556
4523
|
/**
|
|
4557
4524
|
* Runs the finalizer only when this effect fails and the cause matches the provided `Filter`.
|
|
4558
4525
|
*
|
|
4526
|
+
* @category resource management
|
|
4559
4527
|
* @since 4.0.0
|
|
4560
|
-
* @category Resource Management & Finalization
|
|
4561
4528
|
*/
|
|
4562
4529
|
export const onErrorFilter = internal.onErrorFilter;
|
|
4563
4530
|
/**
|
|
4564
|
-
*
|
|
4565
|
-
*
|
|
4566
|
-
* exit status.
|
|
4531
|
+
* Runs an optional finalizer with the effect's `Exit` value when the effect
|
|
4532
|
+
* completes.
|
|
4567
4533
|
*
|
|
4568
|
-
*
|
|
4569
|
-
*
|
|
4534
|
+
* **Details**
|
|
4535
|
+
*
|
|
4536
|
+
* This low-level operator preserves the source effect's result unless the
|
|
4537
|
+
* finalizer fails. Prefer `onExit` for normal cleanup logic.
|
|
4538
|
+
*
|
|
4539
|
+
* @category resource management
|
|
4540
|
+
* @since 4.0.0
|
|
4570
4541
|
*/
|
|
4571
4542
|
export const onExitPrimitive = internal.onExitPrimitive;
|
|
4572
4543
|
/**
|
|
4573
4544
|
* Ensures that a cleanup functions runs, whether this effect succeeds, fails,
|
|
4574
4545
|
* or is interrupted.
|
|
4575
4546
|
*
|
|
4576
|
-
*
|
|
4547
|
+
* **Example** (Usage)
|
|
4548
|
+
*
|
|
4577
4549
|
* ```ts
|
|
4578
4550
|
* import { Console, Effect, Exit } from "effect"
|
|
4579
4551
|
*
|
|
@@ -4592,15 +4564,16 @@ export const onExitPrimitive = internal.onExitPrimitive;
|
|
|
4592
4564
|
* // 42
|
|
4593
4565
|
* ```
|
|
4594
4566
|
*
|
|
4567
|
+
* @category resource management
|
|
4595
4568
|
* @since 2.0.0
|
|
4596
|
-
* @category Resource Management & Finalization
|
|
4597
4569
|
*/
|
|
4598
4570
|
export const onExit = internal.onExit;
|
|
4599
4571
|
/**
|
|
4600
4572
|
* Runs the cleanup effect only when the `Exit` satisfies the provided
|
|
4601
4573
|
* predicate.
|
|
4602
4574
|
*
|
|
4603
|
-
*
|
|
4575
|
+
* **Example** (Usage)
|
|
4576
|
+
*
|
|
4604
4577
|
* ```ts
|
|
4605
4578
|
* import { Console, Effect, Exit } from "effect"
|
|
4606
4579
|
*
|
|
@@ -4614,15 +4587,15 @@ export const onExit = internal.onExit;
|
|
|
4614
4587
|
* )
|
|
4615
4588
|
* ```
|
|
4616
4589
|
*
|
|
4590
|
+
* @category resource management
|
|
4617
4591
|
* @since 4.0.0
|
|
4618
|
-
* @category Resource Management & Finalization
|
|
4619
4592
|
*/
|
|
4620
4593
|
export const onExitIf = internal.onExitIf;
|
|
4621
4594
|
/**
|
|
4622
4595
|
* Runs the cleanup effect only when the `Exit` matches the provided `Filter`.
|
|
4623
4596
|
*
|
|
4597
|
+
* @category resource management
|
|
4624
4598
|
* @since 4.0.0
|
|
4625
|
-
* @category Resource Management & Finalization
|
|
4626
4599
|
*/
|
|
4627
4600
|
export const onExitFilter = internal.onExitFilter;
|
|
4628
4601
|
// -----------------------------------------------------------------------------
|
|
@@ -4651,7 +4624,8 @@ export const onExitFilter = internal.onExitFilter;
|
|
|
4651
4624
|
* @see {@link cachedInvalidateWithTTL} for a similar function that includes an
|
|
4652
4625
|
* additional effect for manually invalidating the cached value.
|
|
4653
4626
|
*
|
|
4654
|
-
*
|
|
4627
|
+
* **Example** (Usage)
|
|
4628
|
+
*
|
|
4655
4629
|
* ```ts
|
|
4656
4630
|
* import { Console, Effect } from "effect"
|
|
4657
4631
|
*
|
|
@@ -4688,8 +4662,8 @@ export const onExitFilter = internal.onExitFilter;
|
|
|
4688
4662
|
* // result 3
|
|
4689
4663
|
* ```
|
|
4690
4664
|
*
|
|
4691
|
-
* @since 2.0.0
|
|
4692
4665
|
* @category Caching
|
|
4666
|
+
* @since 2.0.0
|
|
4693
4667
|
*/
|
|
4694
4668
|
export const cached = internal.cached;
|
|
4695
4669
|
/**
|
|
@@ -4724,7 +4698,8 @@ export const cached = internal.cached;
|
|
|
4724
4698
|
* @see {@link cachedInvalidateWithTTL} for a similar function that includes an
|
|
4725
4699
|
* additional effect for manually invalidating the cached value.
|
|
4726
4700
|
*
|
|
4727
|
-
*
|
|
4701
|
+
* **Example** (Usage)
|
|
4702
|
+
*
|
|
4728
4703
|
* ```ts
|
|
4729
4704
|
* import { Console, Effect } from "effect"
|
|
4730
4705
|
*
|
|
@@ -4755,8 +4730,8 @@ export const cached = internal.cached;
|
|
|
4755
4730
|
* // result 2
|
|
4756
4731
|
* ```
|
|
4757
4732
|
*
|
|
4758
|
-
* @since 2.0.0
|
|
4759
4733
|
* @category Caching
|
|
4734
|
+
* @since 2.0.0
|
|
4760
4735
|
*/
|
|
4761
4736
|
export const cachedWithTTL = internal.cachedWithTTL;
|
|
4762
4737
|
/**
|
|
@@ -4791,7 +4766,8 @@ export const cachedWithTTL = internal.cachedWithTTL;
|
|
|
4791
4766
|
* @see {@link cachedWithTTL} for a similar function that caches the result for
|
|
4792
4767
|
* a specified duration but does not include an effect for manual invalidation.
|
|
4793
4768
|
*
|
|
4794
|
-
*
|
|
4769
|
+
* **Example** (Usage)
|
|
4770
|
+
*
|
|
4795
4771
|
* ```ts
|
|
4796
4772
|
* import { Console, Effect } from "effect"
|
|
4797
4773
|
*
|
|
@@ -4825,8 +4801,8 @@ export const cachedWithTTL = internal.cachedWithTTL;
|
|
|
4825
4801
|
* // result 2
|
|
4826
4802
|
* ```
|
|
4827
4803
|
*
|
|
4828
|
-
* @since 2.0.0
|
|
4829
4804
|
* @category Caching
|
|
4805
|
+
* @since 2.0.0
|
|
4830
4806
|
*/
|
|
4831
4807
|
export const cachedInvalidateWithTTL = internal.cachedInvalidateWithTTL;
|
|
4832
4808
|
// -----------------------------------------------------------------------------
|
|
@@ -4835,7 +4811,8 @@ export const cachedInvalidateWithTTL = internal.cachedInvalidateWithTTL;
|
|
|
4835
4811
|
/**
|
|
4836
4812
|
* Returns an effect that is immediately interrupted.
|
|
4837
4813
|
*
|
|
4838
|
-
*
|
|
4814
|
+
* **Example** (Usage)
|
|
4815
|
+
*
|
|
4839
4816
|
* ```ts
|
|
4840
4817
|
* import { Effect } from "effect"
|
|
4841
4818
|
*
|
|
@@ -4848,14 +4825,15 @@ export const cachedInvalidateWithTTL = internal.cachedInvalidateWithTTL;
|
|
|
4848
4825
|
* // Throws: InterruptedException
|
|
4849
4826
|
* ```
|
|
4850
4827
|
*
|
|
4851
|
-
* @since 2.0.0
|
|
4852
4828
|
* @category Interruption
|
|
4829
|
+
* @since 2.0.0
|
|
4853
4830
|
*/
|
|
4854
4831
|
export const interrupt = internal.interrupt;
|
|
4855
4832
|
/**
|
|
4856
4833
|
* Returns a new effect that allows the effect to be interruptible.
|
|
4857
4834
|
*
|
|
4858
|
-
*
|
|
4835
|
+
* **Example** (Usage)
|
|
4836
|
+
*
|
|
4859
4837
|
* ```ts
|
|
4860
4838
|
* import { Effect } from "effect"
|
|
4861
4839
|
*
|
|
@@ -4868,14 +4846,15 @@ export const interrupt = internal.interrupt;
|
|
|
4868
4846
|
* // Later: fiber.interrupt()
|
|
4869
4847
|
* ```
|
|
4870
4848
|
*
|
|
4871
|
-
* @since 2.0.0
|
|
4872
4849
|
* @category Interruption
|
|
4850
|
+
* @since 2.0.0
|
|
4873
4851
|
*/
|
|
4874
4852
|
export const interruptible = internal.interruptible;
|
|
4875
4853
|
/**
|
|
4876
4854
|
* Runs the specified finalizer effect if this effect is interrupted.
|
|
4877
4855
|
*
|
|
4878
|
-
*
|
|
4856
|
+
* **Example** (Usage)
|
|
4857
|
+
*
|
|
4879
4858
|
* ```ts
|
|
4880
4859
|
* import { Console, Effect, Fiber } from "effect"
|
|
4881
4860
|
*
|
|
@@ -4892,14 +4871,15 @@ export const interruptible = internal.interruptible;
|
|
|
4892
4871
|
* // Output: Task was interrupted, cleaning up...
|
|
4893
4872
|
* ```
|
|
4894
4873
|
*
|
|
4895
|
-
* @since 2.0.0
|
|
4896
4874
|
* @category Interruption
|
|
4875
|
+
* @since 2.0.0
|
|
4897
4876
|
*/
|
|
4898
4877
|
export const onInterrupt = internal.onInterrupt;
|
|
4899
4878
|
/**
|
|
4900
4879
|
* Returns a new effect that disables interruption for the given effect.
|
|
4901
4880
|
*
|
|
4902
|
-
*
|
|
4881
|
+
* **Example** (Usage)
|
|
4882
|
+
*
|
|
4903
4883
|
* ```ts
|
|
4904
4884
|
* import { Console, Effect, Fiber } from "effect"
|
|
4905
4885
|
*
|
|
@@ -4916,15 +4896,16 @@ export const onInterrupt = internal.onInterrupt;
|
|
|
4916
4896
|
* Effect.runPromise(Fiber.interrupt(fiber))
|
|
4917
4897
|
* ```
|
|
4918
4898
|
*
|
|
4919
|
-
* @since 2.0.0
|
|
4920
4899
|
* @category Interruption
|
|
4900
|
+
* @since 2.0.0
|
|
4921
4901
|
*/
|
|
4922
4902
|
export const uninterruptible = internal.uninterruptible;
|
|
4923
4903
|
/**
|
|
4924
4904
|
* Disables interruption and provides a restore function to restore the
|
|
4925
4905
|
* interruptible state within the effect.
|
|
4926
4906
|
*
|
|
4927
|
-
*
|
|
4907
|
+
* **Example** (Usage)
|
|
4908
|
+
*
|
|
4928
4909
|
* ```ts
|
|
4929
4910
|
* import { Console, Effect } from "effect"
|
|
4930
4911
|
*
|
|
@@ -4946,8 +4927,8 @@ export const uninterruptible = internal.uninterruptible;
|
|
|
4946
4927
|
* )
|
|
4947
4928
|
* ```
|
|
4948
4929
|
*
|
|
4949
|
-
* @since 2.0.0
|
|
4950
4930
|
* @category Interruption
|
|
4931
|
+
* @since 2.0.0
|
|
4951
4932
|
*/
|
|
4952
4933
|
export const uninterruptibleMask = internal.uninterruptibleMask;
|
|
4953
4934
|
/**
|
|
@@ -4955,7 +4936,8 @@ export const uninterruptibleMask = internal.uninterruptibleMask;
|
|
|
4955
4936
|
* `restore` function. This function can be used to restore the interruptibility
|
|
4956
4937
|
* of any specific region of code.
|
|
4957
4938
|
*
|
|
4958
|
-
*
|
|
4939
|
+
* **Example** (Usage)
|
|
4940
|
+
*
|
|
4959
4941
|
* ```ts
|
|
4960
4942
|
* import { Console, Effect } from "effect"
|
|
4961
4943
|
*
|
|
@@ -4977,21 +4959,22 @@ export const uninterruptibleMask = internal.uninterruptibleMask;
|
|
|
4977
4959
|
* )
|
|
4978
4960
|
* ```
|
|
4979
4961
|
*
|
|
4980
|
-
* @since 2.0.0
|
|
4981
4962
|
* @category Interruption
|
|
4963
|
+
* @since 2.0.0
|
|
4982
4964
|
*/
|
|
4983
4965
|
export const interruptibleMask = internal.interruptibleMask;
|
|
4984
4966
|
/**
|
|
4985
4967
|
* Creates an AbortSignal that is managed by the provided scope.
|
|
4986
4968
|
*
|
|
4987
|
-
* @since 4.0.0
|
|
4988
4969
|
* @category Interruption
|
|
4970
|
+
* @since 4.0.0
|
|
4989
4971
|
*/
|
|
4990
4972
|
export const abortSignal = internal.abortSignal;
|
|
4991
4973
|
/**
|
|
4992
4974
|
* Repeats this effect forever (until the first error).
|
|
4993
4975
|
*
|
|
4994
|
-
*
|
|
4976
|
+
* **Example** (Usage)
|
|
4977
|
+
*
|
|
4995
4978
|
* ```ts
|
|
4996
4979
|
* import { Console, Effect, Fiber } from "effect"
|
|
4997
4980
|
*
|
|
@@ -5014,8 +4997,8 @@ export const abortSignal = internal.abortSignal;
|
|
|
5014
4997
|
* })
|
|
5015
4998
|
* ```
|
|
5016
4999
|
*
|
|
5017
|
-
* @since 2.0.0
|
|
5018
5000
|
* @category Repetition / Recursion
|
|
5001
|
+
* @since 2.0.0
|
|
5019
5002
|
*/
|
|
5020
5003
|
export const forever = internal.forever;
|
|
5021
5004
|
/**
|
|
@@ -5040,12 +5023,11 @@ export const forever = internal.forever;
|
|
|
5040
5023
|
* delays, limiting recursions, or dynamically adjusting based on the outcome of
|
|
5041
5024
|
* each execution.
|
|
5042
5025
|
*
|
|
5043
|
-
*
|
|
5026
|
+
* **Example** (Usage)
|
|
5027
|
+
*
|
|
5044
5028
|
* ```ts
|
|
5045
5029
|
* // Success Example
|
|
5046
|
-
* import { Effect } from "effect"
|
|
5047
|
-
* import { Schedule } from "effect"
|
|
5048
|
-
* import { Console } from "effect"
|
|
5030
|
+
* import { Console, Effect, Schedule } from "effect"
|
|
5049
5031
|
*
|
|
5050
5032
|
* const action = Console.log("success")
|
|
5051
5033
|
* const policy = Schedule.addDelay(Schedule.recurs(2), () => Effect.succeed("100 millis"))
|
|
@@ -5054,10 +5036,11 @@ export const forever = internal.forever;
|
|
|
5054
5036
|
* // Effect.runPromise(program).then((n) => console.log(`repetitions: ${n}`))
|
|
5055
5037
|
* ```
|
|
5056
5038
|
*
|
|
5057
|
-
*
|
|
5039
|
+
* **Example** (Usage)
|
|
5040
|
+
*
|
|
5041
|
+
* ```ts
|
|
5058
5042
|
* // Failure Example
|
|
5059
|
-
* import { Effect } from "effect"
|
|
5060
|
-
* import { Schedule } from "effect"
|
|
5043
|
+
* import { Effect, Schedule } from "effect"
|
|
5061
5044
|
*
|
|
5062
5045
|
* let count = 0
|
|
5063
5046
|
*
|
|
@@ -5077,33 +5060,27 @@ export const forever = internal.forever;
|
|
|
5077
5060
|
* const program = Effect.repeat(action, policy)
|
|
5078
5061
|
*
|
|
5079
5062
|
* // Effect.runPromiseExit(program).then(console.log)
|
|
5063
|
+
* ```
|
|
5080
5064
|
*
|
|
5081
|
-
* @since 2.0.0
|
|
5082
5065
|
* @category Repetition / Recursion
|
|
5066
|
+
* @since 2.0.0
|
|
5083
5067
|
*/
|
|
5084
5068
|
export const repeat = internalSchedule.repeat;
|
|
5085
5069
|
/**
|
|
5086
|
-
* Repeats an effect
|
|
5070
|
+
* Repeats an effect according to a schedule and runs a fallback effect if
|
|
5071
|
+
* repetition fails before the schedule completes.
|
|
5087
5072
|
*
|
|
5088
5073
|
* **Details**
|
|
5089
5074
|
*
|
|
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.
|
|
5075
|
+
* If the repeated effect or schedule step fails, `orElse` receives the failure
|
|
5076
|
+
* and the latest schedule metadata when at least one schedule step has run;
|
|
5077
|
+
* otherwise it receives `None`. If the schedule completes normally, the
|
|
5078
|
+
* returned effect succeeds with the schedule's output.
|
|
5097
5079
|
*
|
|
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.
|
|
5080
|
+
* **Example** (Usage)
|
|
5102
5081
|
*
|
|
5103
|
-
* @example
|
|
5104
5082
|
* ```ts
|
|
5105
|
-
* import { Console, Effect, Schedule } from "effect"
|
|
5106
|
-
* import * as Option from "effect/Option"
|
|
5083
|
+
* import { Console, Effect, Option, Schedule } from "effect"
|
|
5107
5084
|
*
|
|
5108
5085
|
* let attempt = 0
|
|
5109
5086
|
* const task = Effect.gen(function*() {
|
|
@@ -5128,8 +5105,8 @@ export const repeat = internalSchedule.repeat;
|
|
|
5128
5105
|
* )
|
|
5129
5106
|
* ```
|
|
5130
5107
|
*
|
|
5131
|
-
* @since 2.0.0
|
|
5132
5108
|
* @category Repetition / Recursion
|
|
5109
|
+
* @since 2.0.0
|
|
5133
5110
|
*/
|
|
5134
5111
|
export const repeatOrElse = internalSchedule.repeatOrElse;
|
|
5135
5112
|
/**
|
|
@@ -5137,8 +5114,8 @@ export const repeatOrElse = internalSchedule.repeatOrElse;
|
|
|
5137
5114
|
*
|
|
5138
5115
|
* Use with `Effect.all` to run the replicated effects and collect results.
|
|
5139
5116
|
*
|
|
5140
|
-
* @since 2.0.0
|
|
5141
5117
|
* @category Collecting
|
|
5118
|
+
* @since 2.0.0
|
|
5142
5119
|
*/
|
|
5143
5120
|
export const replicate = internal.replicate;
|
|
5144
5121
|
/**
|
|
@@ -5146,7 +5123,8 @@ export const replicate = internal.replicate;
|
|
|
5146
5123
|
*
|
|
5147
5124
|
* Use `concurrency` to control parallelism and `discard: true` to ignore results.
|
|
5148
5125
|
*
|
|
5149
|
-
*
|
|
5126
|
+
* **Example** (Usage)
|
|
5127
|
+
*
|
|
5150
5128
|
* ```ts
|
|
5151
5129
|
* import { Console, Effect } from "effect"
|
|
5152
5130
|
*
|
|
@@ -5156,27 +5134,24 @@ export const replicate = internal.replicate;
|
|
|
5156
5134
|
* })
|
|
5157
5135
|
* ```
|
|
5158
5136
|
*
|
|
5159
|
-
* @since 2.0.0
|
|
5160
5137
|
* @category Collecting
|
|
5138
|
+
* @since 2.0.0
|
|
5161
5139
|
*/
|
|
5162
5140
|
export const replicateEffect = internal.replicateEffect;
|
|
5163
5141
|
/**
|
|
5164
|
-
*
|
|
5142
|
+
* Runs an effect repeatedly according to a schedule and returns the schedule's
|
|
5143
|
+
* final output.
|
|
5165
5144
|
*
|
|
5166
5145
|
* **Details**
|
|
5167
5146
|
*
|
|
5168
|
-
*
|
|
5169
|
-
*
|
|
5170
|
-
*
|
|
5171
|
-
*
|
|
5172
|
-
*
|
|
5147
|
+
* The schedule is first stepped with `undefined`. After each successful
|
|
5148
|
+
* execution, the effect's success value is fed to the schedule to decide
|
|
5149
|
+
* whether to run again. The returned effect fails if the effect or schedule
|
|
5150
|
+
* fails, and otherwise succeeds with the schedule output when the schedule
|
|
5151
|
+
* completes.
|
|
5173
5152
|
*
|
|
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.
|
|
5153
|
+
* **Example** (Usage)
|
|
5178
5154
|
*
|
|
5179
|
-
* @example
|
|
5180
5155
|
* ```ts
|
|
5181
5156
|
* import { Console, Effect, Schedule } from "effect"
|
|
5182
5157
|
*
|
|
@@ -5202,26 +5177,24 @@ export const replicateEffect = internal.replicateEffect;
|
|
|
5202
5177
|
* @see {@link scheduleFrom} for a variant that allows the schedule's decision
|
|
5203
5178
|
* to depend on the result of this effect.
|
|
5204
5179
|
*
|
|
5205
|
-
* @since 2.0.0
|
|
5206
5180
|
* @category Repetition / Recursion
|
|
5181
|
+
* @since 2.0.0
|
|
5207
5182
|
*/
|
|
5208
5183
|
export const schedule = /*#__PURE__*/dual(2, (self, schedule) => scheduleFrom(self, undefined, schedule));
|
|
5209
5184
|
/**
|
|
5210
|
-
* Runs an effect repeatedly according to a schedule
|
|
5211
|
-
*
|
|
5185
|
+
* Runs an effect repeatedly according to a schedule that is initialized with a
|
|
5186
|
+
* specific schedule input.
|
|
5212
5187
|
*
|
|
5213
5188
|
* **Details**
|
|
5214
5189
|
*
|
|
5215
|
-
*
|
|
5216
|
-
*
|
|
5217
|
-
* the
|
|
5218
|
-
* the schedule
|
|
5219
|
-
*
|
|
5190
|
+
* `initial` is passed to the schedule before the first execution, not to the
|
|
5191
|
+
* effect itself. After each successful execution, the effect's success value is
|
|
5192
|
+
* fed back into the schedule to decide whether to continue. The returned effect
|
|
5193
|
+
* succeeds with the schedule output when the schedule completes and fails if
|
|
5194
|
+
* the effect or schedule fails.
|
|
5220
5195
|
*
|
|
5221
|
-
*
|
|
5222
|
-
* propagating the error.
|
|
5196
|
+
* **Example** (Usage)
|
|
5223
5197
|
*
|
|
5224
|
-
* @example
|
|
5225
5198
|
* ```ts
|
|
5226
5199
|
* import { Console, Effect, Schedule } from "effect"
|
|
5227
5200
|
*
|
|
@@ -5242,8 +5215,8 @@ export const schedule = /*#__PURE__*/dual(2, (self, schedule) => scheduleFrom(se
|
|
|
5242
5215
|
* // Returns the schedule count
|
|
5243
5216
|
* ```
|
|
5244
5217
|
*
|
|
5245
|
-
* @since 2.0.0
|
|
5246
5218
|
* @category Repetition / Recursion
|
|
5219
|
+
* @since 2.0.0
|
|
5247
5220
|
*/
|
|
5248
5221
|
export const scheduleFrom = internalSchedule.scheduleFrom;
|
|
5249
5222
|
// -----------------------------------------------------------------------------
|
|
@@ -5252,7 +5225,8 @@ export const scheduleFrom = internalSchedule.scheduleFrom;
|
|
|
5252
5225
|
/**
|
|
5253
5226
|
* Returns the current tracer from the context.
|
|
5254
5227
|
*
|
|
5255
|
-
*
|
|
5228
|
+
* **Example** (Usage)
|
|
5229
|
+
*
|
|
5256
5230
|
* ```ts
|
|
5257
5231
|
* import { Effect } from "effect"
|
|
5258
5232
|
*
|
|
@@ -5263,14 +5237,15 @@ export const scheduleFrom = internalSchedule.scheduleFrom;
|
|
|
5263
5237
|
* })
|
|
5264
5238
|
* ```
|
|
5265
5239
|
*
|
|
5240
|
+
* @category tracing
|
|
5266
5241
|
* @since 2.0.0
|
|
5267
|
-
* @category Tracing
|
|
5268
5242
|
*/
|
|
5269
5243
|
export const tracer = internal.tracer;
|
|
5270
5244
|
/**
|
|
5271
5245
|
* Provides a tracer to an effect.
|
|
5272
5246
|
*
|
|
5273
|
-
*
|
|
5247
|
+
* **Example** (Usage)
|
|
5248
|
+
*
|
|
5274
5249
|
* ```ts
|
|
5275
5250
|
* import { Effect } from "effect"
|
|
5276
5251
|
*
|
|
@@ -5283,14 +5258,20 @@ export const tracer = internal.tracer;
|
|
|
5283
5258
|
* // const traced = Effect.withTracer(program, customTracer)
|
|
5284
5259
|
* ```
|
|
5285
5260
|
*
|
|
5261
|
+
* @category tracing
|
|
5286
5262
|
* @since 2.0.0
|
|
5287
|
-
* @category Tracing
|
|
5288
5263
|
*/
|
|
5289
5264
|
export const withTracer = internal.withTracer;
|
|
5290
5265
|
/**
|
|
5291
|
-
*
|
|
5266
|
+
* Enables or disables tracing for spans created by the given effect.
|
|
5267
|
+
*
|
|
5268
|
+
* **Details**
|
|
5269
|
+
*
|
|
5270
|
+
* When `enabled` is `false`, spans created inside the effect are not registered
|
|
5271
|
+
* with the current tracer and do not propagate as normal trace parents.
|
|
5272
|
+
*
|
|
5273
|
+
* **Example** (Usage)
|
|
5292
5274
|
*
|
|
5293
|
-
* @example
|
|
5294
5275
|
* ```ts
|
|
5295
5276
|
* import { Effect } from "effect"
|
|
5296
5277
|
*
|
|
@@ -5301,14 +5282,15 @@ export const withTracer = internal.withTracer;
|
|
|
5301
5282
|
* )
|
|
5302
5283
|
* ```
|
|
5303
5284
|
*
|
|
5285
|
+
* @category tracing
|
|
5304
5286
|
* @since 2.0.0
|
|
5305
|
-
* @category Tracing
|
|
5306
5287
|
*/
|
|
5307
5288
|
export const withTracerEnabled = internal.withTracerEnabled;
|
|
5308
5289
|
/**
|
|
5309
5290
|
* Enables or disables tracer timing for the given Effect.
|
|
5310
5291
|
*
|
|
5311
|
-
*
|
|
5292
|
+
* **Example** (Usage)
|
|
5293
|
+
*
|
|
5312
5294
|
* ```ts
|
|
5313
5295
|
* import { Effect } from "effect"
|
|
5314
5296
|
*
|
|
@@ -5319,14 +5301,15 @@ export const withTracerEnabled = internal.withTracerEnabled;
|
|
|
5319
5301
|
* )
|
|
5320
5302
|
* ```
|
|
5321
5303
|
*
|
|
5304
|
+
* @category tracing
|
|
5322
5305
|
* @since 2.0.0
|
|
5323
|
-
* @category Tracing
|
|
5324
5306
|
*/
|
|
5325
5307
|
export const withTracerTiming = internal.withTracerTiming;
|
|
5326
5308
|
/**
|
|
5327
5309
|
* Adds an annotation to each span in this effect.
|
|
5328
5310
|
*
|
|
5329
|
-
*
|
|
5311
|
+
* **Example** (Usage)
|
|
5312
|
+
*
|
|
5330
5313
|
* ```ts
|
|
5331
5314
|
* import { Effect } from "effect"
|
|
5332
5315
|
*
|
|
@@ -5346,14 +5329,15 @@ export const withTracerTiming = internal.withTracerTiming;
|
|
|
5346
5329
|
* })
|
|
5347
5330
|
* ```
|
|
5348
5331
|
*
|
|
5332
|
+
* @category tracing
|
|
5349
5333
|
* @since 2.0.0
|
|
5350
|
-
* @category Tracing
|
|
5351
5334
|
*/
|
|
5352
5335
|
export const annotateSpans = internal.annotateSpans;
|
|
5353
5336
|
/**
|
|
5354
5337
|
* Adds an annotation to the current span if available.
|
|
5355
5338
|
*
|
|
5356
|
-
*
|
|
5339
|
+
* **Example** (Usage)
|
|
5340
|
+
*
|
|
5357
5341
|
* ```ts
|
|
5358
5342
|
* import { Effect } from "effect"
|
|
5359
5343
|
*
|
|
@@ -5370,14 +5354,20 @@ export const annotateSpans = internal.annotateSpans;
|
|
|
5370
5354
|
* const traced = Effect.withSpan(program, "user-operation")
|
|
5371
5355
|
* ```
|
|
5372
5356
|
*
|
|
5357
|
+
* @category tracing
|
|
5373
5358
|
* @since 2.0.0
|
|
5374
|
-
* @category Tracing
|
|
5375
5359
|
*/
|
|
5376
5360
|
export const annotateCurrentSpan = internal.annotateCurrentSpan;
|
|
5377
5361
|
/**
|
|
5378
|
-
* Returns the
|
|
5362
|
+
* Returns the currently active local tracing span.
|
|
5363
|
+
*
|
|
5364
|
+
* **Details**
|
|
5365
|
+
*
|
|
5366
|
+
* The effect fails with `NoSuchElementError` when there is no active local
|
|
5367
|
+
* `Span`.
|
|
5368
|
+
*
|
|
5369
|
+
* **Example** (Usage)
|
|
5379
5370
|
*
|
|
5380
|
-
* @example
|
|
5381
5371
|
* ```ts
|
|
5382
5372
|
* import { Effect } from "effect"
|
|
5383
5373
|
*
|
|
@@ -5390,14 +5380,21 @@ export const annotateCurrentSpan = internal.annotateCurrentSpan;
|
|
|
5390
5380
|
* const traced = Effect.withSpan(program, "my-span")
|
|
5391
5381
|
* ```
|
|
5392
5382
|
*
|
|
5383
|
+
* @category tracing
|
|
5393
5384
|
* @since 2.0.0
|
|
5394
|
-
* @category Tracing
|
|
5395
5385
|
*/
|
|
5396
5386
|
export const currentSpan = internal.currentSpan;
|
|
5397
5387
|
/**
|
|
5398
|
-
* Returns the current parent span from the context.
|
|
5388
|
+
* Returns the current parent span from the effect context.
|
|
5389
|
+
*
|
|
5390
|
+
* **Details**
|
|
5391
|
+
*
|
|
5392
|
+
* The effect succeeds with either a local span or external span when one is
|
|
5393
|
+
* present, and fails with `NoSuchElementError` when no parent span is
|
|
5394
|
+
* available.
|
|
5395
|
+
*
|
|
5396
|
+
* **Example** (Usage)
|
|
5399
5397
|
*
|
|
5400
|
-
* @example
|
|
5401
5398
|
* ```ts
|
|
5402
5399
|
* import { Effect } from "effect"
|
|
5403
5400
|
*
|
|
@@ -5415,14 +5412,20 @@ export const currentSpan = internal.currentSpan;
|
|
|
5415
5412
|
* const traced = Effect.withSpan(program, "parent-span")
|
|
5416
5413
|
* ```
|
|
5417
5414
|
*
|
|
5415
|
+
* @category tracing
|
|
5418
5416
|
* @since 2.0.0
|
|
5419
|
-
* @category Tracing
|
|
5420
5417
|
*/
|
|
5421
5418
|
export const currentParentSpan = internal.currentParentSpan;
|
|
5422
5419
|
/**
|
|
5423
|
-
* Returns the annotations
|
|
5420
|
+
* Returns the tracing span annotations currently carried in the effect context.
|
|
5421
|
+
*
|
|
5422
|
+
* **Details**
|
|
5423
|
+
*
|
|
5424
|
+
* These annotations are applied to spans created inside the context, such as
|
|
5425
|
+
* spans created by `withSpan`, `useSpan`, or `makeSpan`.
|
|
5426
|
+
*
|
|
5427
|
+
* **Example** (Usage)
|
|
5424
5428
|
*
|
|
5425
|
-
* @example
|
|
5426
5429
|
* ```ts
|
|
5427
5430
|
* import { Effect } from "effect"
|
|
5428
5431
|
*
|
|
@@ -5442,18 +5445,20 @@ export const currentParentSpan = internal.currentParentSpan;
|
|
|
5442
5445
|
* // Output: Current span annotations: { userId: "123", operation: "data-processing" }
|
|
5443
5446
|
* ```
|
|
5444
5447
|
*
|
|
5448
|
+
* @category tracing
|
|
5445
5449
|
* @since 2.0.0
|
|
5446
|
-
* @category Tracing
|
|
5447
5450
|
*/
|
|
5448
5451
|
export const spanAnnotations = internal.spanAnnotations;
|
|
5449
5452
|
/**
|
|
5450
|
-
*
|
|
5453
|
+
* Returns the tracing span links currently carried in the effect context.
|
|
5454
|
+
*
|
|
5455
|
+
* **Details**
|
|
5456
|
+
*
|
|
5457
|
+
* These links are attached to spans created inside the context. Span links
|
|
5458
|
+
* connect related spans without making one span the parent of another.
|
|
5451
5459
|
*
|
|
5452
|
-
*
|
|
5453
|
-
* parent-child relationship. They are useful for linking spans across different
|
|
5454
|
-
* traces or connecting spans from parallel operations.
|
|
5460
|
+
* **Example** (Usage)
|
|
5455
5461
|
*
|
|
5456
|
-
* @example
|
|
5457
5462
|
* ```ts
|
|
5458
5463
|
* import { Effect } from "effect"
|
|
5459
5464
|
*
|
|
@@ -5465,8 +5470,8 @@ export const spanAnnotations = internal.spanAnnotations;
|
|
|
5465
5470
|
* })
|
|
5466
5471
|
* ```
|
|
5467
5472
|
*
|
|
5473
|
+
* @category tracing
|
|
5468
5474
|
* @since 2.0.0
|
|
5469
|
-
* @category Tracing
|
|
5470
5475
|
*/
|
|
5471
5476
|
export const spanLinks = internal.spanLinks;
|
|
5472
5477
|
/**
|
|
@@ -5476,7 +5481,8 @@ export const spanLinks = internal.spanLinks;
|
|
|
5476
5481
|
* parent-child relationship. For example, you might want to link spans from
|
|
5477
5482
|
* parallel operations or connect spans across different traces.
|
|
5478
5483
|
*
|
|
5479
|
-
*
|
|
5484
|
+
* **Example** (Usage)
|
|
5485
|
+
*
|
|
5480
5486
|
* ```ts
|
|
5481
5487
|
* import { Effect } from "effect"
|
|
5482
5488
|
*
|
|
@@ -5498,7 +5504,8 @@ export const spanLinks = internal.spanLinks;
|
|
|
5498
5504
|
* })
|
|
5499
5505
|
* ```
|
|
5500
5506
|
*
|
|
5501
|
-
*
|
|
5507
|
+
* **Example** (Usage)
|
|
5508
|
+
*
|
|
5502
5509
|
* ```ts
|
|
5503
5510
|
* import { Effect } from "effect"
|
|
5504
5511
|
*
|
|
@@ -5516,14 +5523,21 @@ export const spanLinks = internal.spanLinks;
|
|
|
5516
5523
|
* })
|
|
5517
5524
|
* ```
|
|
5518
5525
|
*
|
|
5526
|
+
* @category tracing
|
|
5519
5527
|
* @since 2.0.0
|
|
5520
|
-
* @category Tracing
|
|
5521
5528
|
*/
|
|
5522
5529
|
export const linkSpans = internal.linkSpans;
|
|
5523
5530
|
/**
|
|
5524
|
-
*
|
|
5531
|
+
* Creates a new tracing span and returns it without managing its lifetime.
|
|
5532
|
+
*
|
|
5533
|
+
* **Details**
|
|
5534
|
+
*
|
|
5535
|
+
* The span is not added to the current span stack and is not ended
|
|
5536
|
+
* automatically. Use `withSpan`, `useSpan`, or `makeSpanScoped` when the span
|
|
5537
|
+
* should be installed as context or closed automatically.
|
|
5538
|
+
*
|
|
5539
|
+
* **Example** (Usage)
|
|
5525
5540
|
*
|
|
5526
|
-
* @example
|
|
5527
5541
|
* ```ts
|
|
5528
5542
|
* import { Effect } from "effect"
|
|
5529
5543
|
*
|
|
@@ -5534,8 +5548,8 @@ export const linkSpans = internal.linkSpans;
|
|
|
5534
5548
|
* })
|
|
5535
5549
|
* ```
|
|
5536
5550
|
*
|
|
5551
|
+
* @category tracing
|
|
5537
5552
|
* @since 2.0.0
|
|
5538
|
-
* @category Tracing
|
|
5539
5553
|
*/
|
|
5540
5554
|
export const makeSpan = internal.makeSpan;
|
|
5541
5555
|
/**
|
|
@@ -5545,7 +5559,8 @@ export const makeSpan = internal.makeSpan;
|
|
|
5545
5559
|
* The span is not added to the current span stack, so no child spans will be
|
|
5546
5560
|
* created for it.
|
|
5547
5561
|
*
|
|
5548
|
-
*
|
|
5562
|
+
* **Example** (Usage)
|
|
5563
|
+
*
|
|
5549
5564
|
* ```ts
|
|
5550
5565
|
* import { Effect } from "effect"
|
|
5551
5566
|
*
|
|
@@ -5559,8 +5574,8 @@ export const makeSpan = internal.makeSpan;
|
|
|
5559
5574
|
* )
|
|
5560
5575
|
* ```
|
|
5561
5576
|
*
|
|
5577
|
+
* @category tracing
|
|
5562
5578
|
* @since 2.0.0
|
|
5563
|
-
* @category Tracing
|
|
5564
5579
|
*/
|
|
5565
5580
|
export const makeSpanScoped = internal.makeSpanScoped;
|
|
5566
5581
|
/**
|
|
@@ -5570,7 +5585,8 @@ export const makeSpanScoped = internal.makeSpanScoped;
|
|
|
5570
5585
|
* The span is not added to the current span stack, so no child spans will be
|
|
5571
5586
|
* created for it.
|
|
5572
5587
|
*
|
|
5573
|
-
*
|
|
5588
|
+
* **Example** (Usage)
|
|
5589
|
+
*
|
|
5574
5590
|
* ```ts
|
|
5575
5591
|
* import { Effect } from "effect"
|
|
5576
5592
|
*
|
|
@@ -5584,14 +5600,15 @@ export const makeSpanScoped = internal.makeSpanScoped;
|
|
|
5584
5600
|
* )
|
|
5585
5601
|
* ```
|
|
5586
5602
|
*
|
|
5603
|
+
* @category tracing
|
|
5587
5604
|
* @since 2.0.0
|
|
5588
|
-
* @category Tracing
|
|
5589
5605
|
*/
|
|
5590
5606
|
export const useSpan = internal.useSpan;
|
|
5591
5607
|
/**
|
|
5592
5608
|
* Wraps the effect with a new span for tracing.
|
|
5593
5609
|
*
|
|
5594
|
-
*
|
|
5610
|
+
* **Example** (Usage)
|
|
5611
|
+
*
|
|
5595
5612
|
* ```ts
|
|
5596
5613
|
* import { Effect } from "effect"
|
|
5597
5614
|
*
|
|
@@ -5605,8 +5622,8 @@ export const useSpan = internal.useSpan;
|
|
|
5605
5622
|
* })
|
|
5606
5623
|
* ```
|
|
5607
5624
|
*
|
|
5625
|
+
* @category tracing
|
|
5608
5626
|
* @since 2.0.0
|
|
5609
|
-
* @category Tracing
|
|
5610
5627
|
*/
|
|
5611
5628
|
export const withSpan = internal.withSpan;
|
|
5612
5629
|
/**
|
|
@@ -5614,7 +5631,8 @@ export const withSpan = internal.withSpan;
|
|
|
5614
5631
|
*
|
|
5615
5632
|
* The span is ended when the Scope is finalized.
|
|
5616
5633
|
*
|
|
5617
|
-
*
|
|
5634
|
+
* **Example** (Usage)
|
|
5635
|
+
*
|
|
5618
5636
|
* ```ts
|
|
5619
5637
|
* import { Effect } from "effect"
|
|
5620
5638
|
*
|
|
@@ -5627,14 +5645,15 @@ export const withSpan = internal.withSpan;
|
|
|
5627
5645
|
* )
|
|
5628
5646
|
* ```
|
|
5629
5647
|
*
|
|
5648
|
+
* @category tracing
|
|
5630
5649
|
* @since 2.0.0
|
|
5631
|
-
* @category Tracing
|
|
5632
5650
|
*/
|
|
5633
5651
|
export const withSpanScoped = internal.withSpanScoped;
|
|
5634
5652
|
/**
|
|
5635
5653
|
* Adds the provided span to the current span stack.
|
|
5636
5654
|
*
|
|
5637
|
-
*
|
|
5655
|
+
* **Example** (Usage)
|
|
5656
|
+
*
|
|
5638
5657
|
* ```ts
|
|
5639
5658
|
* import { Effect } from "effect"
|
|
5640
5659
|
*
|
|
@@ -5646,8 +5665,8 @@ export const withSpanScoped = internal.withSpanScoped;
|
|
|
5646
5665
|
* })
|
|
5647
5666
|
* ```
|
|
5648
5667
|
*
|
|
5668
|
+
* @category tracing
|
|
5649
5669
|
* @since 2.0.0
|
|
5650
|
-
* @category Tracing
|
|
5651
5670
|
*/
|
|
5652
5671
|
export const withParentSpan = internal.withParentSpan;
|
|
5653
5672
|
// -----------------------------------------------------------------------------
|
|
@@ -5656,10 +5675,11 @@ export const withParentSpan = internal.withParentSpan;
|
|
|
5656
5675
|
/**
|
|
5657
5676
|
* Executes a request using the provided resolver.
|
|
5658
5677
|
*
|
|
5659
|
-
* @since 2.0.0
|
|
5660
5678
|
* @category Requests & Batching
|
|
5679
|
+
* @since 2.0.0
|
|
5680
|
+
*
|
|
5681
|
+
* **Example** (Usage)
|
|
5661
5682
|
*
|
|
5662
|
-
* @example
|
|
5663
5683
|
* ```ts
|
|
5664
5684
|
* import { Console, Effect, Exit, Request, RequestResolver } from "effect"
|
|
5665
5685
|
*
|
|
@@ -5690,8 +5710,8 @@ export const request = internalRequest.request;
|
|
|
5690
5710
|
*
|
|
5691
5711
|
* It returns a canceler that removes the pending request entry.
|
|
5692
5712
|
*
|
|
5693
|
-
* @since 4.0.0
|
|
5694
5713
|
* @category Requests & Batching
|
|
5714
|
+
* @since 4.0.0
|
|
5695
5715
|
*/
|
|
5696
5716
|
export const requestUnsafe = internalRequest.requestUnsafe;
|
|
5697
5717
|
// -----------------------------------------------------------------------------
|
|
@@ -5718,7 +5738,8 @@ export const requestUnsafe = internalRequest.requestUnsafe;
|
|
|
5718
5738
|
* fibers leak. This behavior is called "auto supervision", and if this
|
|
5719
5739
|
* behavior is not desired, you may use the `forkDetach` or `forkIn` methods.
|
|
5720
5740
|
*
|
|
5721
|
-
*
|
|
5741
|
+
* **Example** (Usage)
|
|
5742
|
+
*
|
|
5722
5743
|
* ```ts
|
|
5723
5744
|
* import { Effect, Fiber } from "effect"
|
|
5724
5745
|
*
|
|
@@ -5740,15 +5761,16 @@ export const requestUnsafe = internalRequest.requestUnsafe;
|
|
|
5740
5761
|
* })
|
|
5741
5762
|
* ```
|
|
5742
5763
|
*
|
|
5743
|
-
* @since 4.0.0
|
|
5744
5764
|
* @category Supervision & Fibers
|
|
5765
|
+
* @since 4.0.0
|
|
5745
5766
|
*/
|
|
5746
5767
|
export const forkChild = internal.forkChild;
|
|
5747
5768
|
/**
|
|
5748
5769
|
* Forks the effect in the specified scope. The fiber will be interrupted
|
|
5749
5770
|
* when the scope is closed.
|
|
5750
5771
|
*
|
|
5751
|
-
*
|
|
5772
|
+
* **Example** (Usage)
|
|
5773
|
+
*
|
|
5752
5774
|
* ```ts
|
|
5753
5775
|
* import { Effect } from "effect"
|
|
5754
5776
|
*
|
|
@@ -5768,14 +5790,15 @@ export const forkChild = internal.forkChild;
|
|
|
5768
5790
|
* )
|
|
5769
5791
|
* ```
|
|
5770
5792
|
*
|
|
5771
|
-
* @since 2.0.0
|
|
5772
5793
|
* @category Supervision & Fibers
|
|
5794
|
+
* @since 2.0.0
|
|
5773
5795
|
*/
|
|
5774
5796
|
export const forkIn = internal.forkIn;
|
|
5775
5797
|
/**
|
|
5776
5798
|
* Forks the fiber in a `Scope`, interrupting it when the scope is closed.
|
|
5777
5799
|
*
|
|
5778
|
-
*
|
|
5800
|
+
* **Example** (Usage)
|
|
5801
|
+
*
|
|
5779
5802
|
* ```ts
|
|
5780
5803
|
* import { Effect } from "effect"
|
|
5781
5804
|
*
|
|
@@ -5801,8 +5824,8 @@ export const forkIn = internal.forkIn;
|
|
|
5801
5824
|
* )
|
|
5802
5825
|
* ```
|
|
5803
5826
|
*
|
|
5804
|
-
* @since 2.0.0
|
|
5805
5827
|
* @category Supervision & Fibers
|
|
5828
|
+
* @since 2.0.0
|
|
5806
5829
|
*/
|
|
5807
5830
|
export const forkScoped = internal.forkScoped;
|
|
5808
5831
|
/**
|
|
@@ -5810,7 +5833,8 @@ export const forkScoped = internal.forkScoped;
|
|
|
5810
5833
|
* new fiber is attached to the global scope, when the fiber executing the
|
|
5811
5834
|
* returned effect terminates, the forked fiber will continue running.
|
|
5812
5835
|
*
|
|
5813
|
-
*
|
|
5836
|
+
* **Example** (Usage)
|
|
5837
|
+
*
|
|
5814
5838
|
* ```ts
|
|
5815
5839
|
* import { Effect } from "effect"
|
|
5816
5840
|
*
|
|
@@ -5834,22 +5858,23 @@ export const forkScoped = internal.forkScoped;
|
|
|
5834
5858
|
* })
|
|
5835
5859
|
* ```
|
|
5836
5860
|
*
|
|
5837
|
-
* @since 2.0.0
|
|
5838
5861
|
* @category Supervision & Fibers
|
|
5862
|
+
* @since 4.0.0
|
|
5839
5863
|
*/
|
|
5840
5864
|
export const forkDetach = internal.forkDetach;
|
|
5841
5865
|
/**
|
|
5842
5866
|
* Waits for all child fibers forked by this effect to complete before this
|
|
5843
5867
|
* effect completes.
|
|
5844
5868
|
*
|
|
5845
|
-
* @since 2.0.0
|
|
5846
5869
|
* @category Supervision & Fibers
|
|
5870
|
+
* @since 2.0.0
|
|
5847
5871
|
*/
|
|
5848
5872
|
export const awaitAllChildren = internal.awaitAllChildren;
|
|
5849
5873
|
/**
|
|
5850
5874
|
* Access the fiber currently executing the effect.
|
|
5851
5875
|
*
|
|
5852
|
-
*
|
|
5876
|
+
* **Example** (Usage)
|
|
5877
|
+
*
|
|
5853
5878
|
* ```ts
|
|
5854
5879
|
* import { Console, Effect } from "effect"
|
|
5855
5880
|
*
|
|
@@ -5859,14 +5884,15 @@ export const awaitAllChildren = internal.awaitAllChildren;
|
|
|
5859
5884
|
* })
|
|
5860
5885
|
* ```
|
|
5861
5886
|
*
|
|
5862
|
-
* @since 4.0.0
|
|
5863
5887
|
* @category Supervision & Fibers
|
|
5888
|
+
* @since 4.0.0
|
|
5864
5889
|
*/
|
|
5865
5890
|
export const fiber = internal.fiber;
|
|
5866
5891
|
/**
|
|
5867
5892
|
* Access the current fiber id executing the effect.
|
|
5868
5893
|
*
|
|
5869
|
-
*
|
|
5894
|
+
* **Example** (Usage)
|
|
5895
|
+
*
|
|
5870
5896
|
* ```ts
|
|
5871
5897
|
* import { Effect } from "effect"
|
|
5872
5898
|
*
|
|
@@ -5881,8 +5907,8 @@ export const fiber = internal.fiber;
|
|
|
5881
5907
|
* )
|
|
5882
5908
|
* ```
|
|
5883
5909
|
*
|
|
5884
|
-
* @since 4.0.0
|
|
5885
5910
|
* @category Supervision & Fibers
|
|
5911
|
+
* @since 2.0.0
|
|
5886
5912
|
*/
|
|
5887
5913
|
export const fiberId = internal.fiberId;
|
|
5888
5914
|
/**
|
|
@@ -5898,13 +5924,10 @@ export const fiberId = internal.fiberId;
|
|
|
5898
5924
|
* Unless you specifically need a `Promise` or synchronous operation,
|
|
5899
5925
|
* `runFork` is a good default choice.
|
|
5900
5926
|
*
|
|
5901
|
-
*
|
|
5927
|
+
* **Example** (Running an Effect in the Background)
|
|
5928
|
+
*
|
|
5902
5929
|
* ```ts
|
|
5903
|
-
*
|
|
5904
|
-
* import { Effect } from "effect"
|
|
5905
|
-
* import { Schedule } from "effect"
|
|
5906
|
-
* import { Fiber } from "effect"
|
|
5907
|
-
* import { Console } from "effect"
|
|
5930
|
+
* import { Console, Effect, Fiber, Schedule } from "effect"
|
|
5908
5931
|
*
|
|
5909
5932
|
* // ┌─── Effect<number, never, never>
|
|
5910
5933
|
* // ▼
|
|
@@ -5922,16 +5945,17 @@ export const fiberId = internal.fiberId;
|
|
|
5922
5945
|
* }, 500)
|
|
5923
5946
|
* ```
|
|
5924
5947
|
*
|
|
5925
|
-
* @since 2.0.0
|
|
5926
5948
|
* @category Running Effects
|
|
5949
|
+
* @since 2.0.0
|
|
5927
5950
|
*/
|
|
5928
5951
|
export const runFork = internal.runFork;
|
|
5929
5952
|
/**
|
|
5930
5953
|
* Runs an effect in the background with the provided services.
|
|
5931
5954
|
*
|
|
5932
|
-
*
|
|
5955
|
+
* **Example** (Usage)
|
|
5956
|
+
*
|
|
5933
5957
|
* ```ts
|
|
5934
|
-
* import {
|
|
5958
|
+
* import { Context, Effect } from "effect"
|
|
5935
5959
|
*
|
|
5936
5960
|
* interface Logger {
|
|
5937
5961
|
* log: (message: string) => void
|
|
@@ -5952,8 +5976,8 @@ export const runFork = internal.runFork;
|
|
|
5952
5976
|
* const fiber = Effect.runForkWith(services)(program)
|
|
5953
5977
|
* ```
|
|
5954
5978
|
*
|
|
5955
|
-
* @since 4.0.0
|
|
5956
5979
|
* @category Running Effects
|
|
5980
|
+
* @since 4.0.0
|
|
5957
5981
|
*/
|
|
5958
5982
|
export const runForkWith = internal.runForkWith;
|
|
5959
5983
|
/**
|
|
@@ -5961,9 +5985,10 @@ export const runForkWith = internal.runForkWith;
|
|
|
5961
5985
|
*
|
|
5962
5986
|
* The returned interruptor calls `fiber.interruptUnsafe`, optionally with an interruptor id.
|
|
5963
5987
|
*
|
|
5964
|
-
*
|
|
5988
|
+
* **Example** (Usage)
|
|
5989
|
+
*
|
|
5965
5990
|
* ```ts
|
|
5966
|
-
* import { Console, Effect, Exit
|
|
5991
|
+
* import { Console, Context, Effect, Exit } from "effect"
|
|
5967
5992
|
*
|
|
5968
5993
|
* interface Logger {
|
|
5969
5994
|
* log: (message: string) => Effect.Effect<void>
|
|
@@ -5993,8 +6018,8 @@ export const runForkWith = internal.runForkWith;
|
|
|
5993
6018
|
* interrupt()
|
|
5994
6019
|
* ```
|
|
5995
6020
|
*
|
|
5996
|
-
* @since 4.0.0
|
|
5997
6021
|
* @category Running Effects
|
|
6022
|
+
* @since 4.0.0
|
|
5998
6023
|
*/
|
|
5999
6024
|
export const runCallbackWith = internal.runCallbackWith;
|
|
6000
6025
|
/**
|
|
@@ -6004,7 +6029,8 @@ export const runCallbackWith = internal.runCallbackWith;
|
|
|
6004
6029
|
* The interruptor calls `fiber.interruptUnsafe` with the optional interruptor
|
|
6005
6030
|
* id.
|
|
6006
6031
|
*
|
|
6007
|
-
*
|
|
6032
|
+
* **Example** (Usage)
|
|
6033
|
+
*
|
|
6008
6034
|
* ```ts
|
|
6009
6035
|
* import { Console, Effect, Exit } from "effect"
|
|
6010
6036
|
*
|
|
@@ -6031,8 +6057,8 @@ export const runCallbackWith = internal.runCallbackWith;
|
|
|
6031
6057
|
* // interrupt() to cancel the fiber if needed
|
|
6032
6058
|
* ```
|
|
6033
6059
|
*
|
|
6034
|
-
* @since 4.0.0
|
|
6035
6060
|
* @category Running Effects
|
|
6061
|
+
* @since 2.0.0
|
|
6036
6062
|
*/
|
|
6037
6063
|
export const runCallback = internal.runCallback;
|
|
6038
6064
|
/**
|
|
@@ -6049,33 +6075,37 @@ export const runCallback = internal.runCallback;
|
|
|
6049
6075
|
*
|
|
6050
6076
|
* @see {@link runPromiseExit} for a version that returns an `Exit` type instead of rejecting.
|
|
6051
6077
|
*
|
|
6052
|
-
*
|
|
6078
|
+
* **Example** (Running a Successful Effect as a Promise)
|
|
6079
|
+
*
|
|
6053
6080
|
* ```ts
|
|
6054
|
-
* // Title: Running a Successful Effect as a Promise
|
|
6055
6081
|
* import { Effect } from "effect"
|
|
6056
6082
|
*
|
|
6057
6083
|
* Effect.runPromise(Effect.succeed(1)).then(console.log)
|
|
6058
6084
|
* // Output: 1
|
|
6059
6085
|
* ```
|
|
6060
6086
|
*
|
|
6061
|
-
*
|
|
6087
|
+
* **Example** (Usage)
|
|
6088
|
+
*
|
|
6089
|
+
* ```ts
|
|
6062
6090
|
* //Example: Handling a Failing Effect as a Rejected Promise
|
|
6063
6091
|
* import { Effect } from "effect"
|
|
6064
6092
|
*
|
|
6065
6093
|
* Effect.runPromise(Effect.fail("my error")).catch(console.error)
|
|
6066
6094
|
* // Output:
|
|
6067
6095
|
* // (FiberFailure) Error: my error
|
|
6096
|
+
* ```
|
|
6068
6097
|
*
|
|
6069
|
-
* @since 2.0.0
|
|
6070
6098
|
* @category Running Effects
|
|
6099
|
+
* @since 2.0.0
|
|
6071
6100
|
*/
|
|
6072
6101
|
export const runPromise = internal.runPromise;
|
|
6073
6102
|
/**
|
|
6074
6103
|
* Executes an effect as a Promise with the provided services.
|
|
6075
6104
|
*
|
|
6076
|
-
*
|
|
6105
|
+
* **Example** (Usage)
|
|
6106
|
+
*
|
|
6077
6107
|
* ```ts
|
|
6078
|
-
* import {
|
|
6108
|
+
* import { Context, Effect } from "effect"
|
|
6079
6109
|
*
|
|
6080
6110
|
* interface Config {
|
|
6081
6111
|
* apiUrl: string
|
|
@@ -6095,8 +6125,8 @@ export const runPromise = internal.runPromise;
|
|
|
6095
6125
|
* Effect.runPromiseWith(context)(program).then(console.log)
|
|
6096
6126
|
* ```
|
|
6097
6127
|
*
|
|
6098
|
-
* @since 4.0.0
|
|
6099
6128
|
* @category Running Effects
|
|
6129
|
+
* @since 4.0.0
|
|
6100
6130
|
*/
|
|
6101
6131
|
export const runPromiseWith = internal.runPromiseWith;
|
|
6102
6132
|
/**
|
|
@@ -6115,9 +6145,9 @@ export const runPromiseWith = internal.runPromiseWith;
|
|
|
6115
6145
|
* - If it fails, the failure information is provided as a `Failure` containing
|
|
6116
6146
|
* a `Cause` type.
|
|
6117
6147
|
*
|
|
6118
|
-
*
|
|
6148
|
+
* **Example** (Handling Results as Exit)
|
|
6149
|
+
*
|
|
6119
6150
|
* ```ts
|
|
6120
|
-
* // Title: Handling Results as Exit
|
|
6121
6151
|
* import { Effect } from "effect"
|
|
6122
6152
|
*
|
|
6123
6153
|
* // Execute a successful effect and get the Exit result as a Promise
|
|
@@ -6143,16 +6173,17 @@ export const runPromiseWith = internal.runPromiseWith;
|
|
|
6143
6173
|
* // }
|
|
6144
6174
|
* ```
|
|
6145
6175
|
*
|
|
6146
|
-
* @since 2.0.0
|
|
6147
6176
|
* @category Running Effects
|
|
6177
|
+
* @since 2.0.0
|
|
6148
6178
|
*/
|
|
6149
6179
|
export const runPromiseExit = internal.runPromiseExit;
|
|
6150
6180
|
/**
|
|
6151
6181
|
* Runs an effect and returns a Promise of Exit with provided services.
|
|
6152
6182
|
*
|
|
6153
|
-
*
|
|
6183
|
+
* **Example** (Usage)
|
|
6184
|
+
*
|
|
6154
6185
|
* ```ts
|
|
6155
|
-
* import { Effect, Exit
|
|
6186
|
+
* import { Context, Effect, Exit } from "effect"
|
|
6156
6187
|
*
|
|
6157
6188
|
* interface Database {
|
|
6158
6189
|
* query: (sql: string) => string
|
|
@@ -6176,28 +6207,29 @@ export const runPromiseExit = internal.runPromiseExit;
|
|
|
6176
6207
|
* })
|
|
6177
6208
|
* ```
|
|
6178
6209
|
*
|
|
6179
|
-
* @since 4.0.0
|
|
6180
6210
|
* @category Running Effects
|
|
6211
|
+
* @since 4.0.0
|
|
6181
6212
|
*/
|
|
6182
6213
|
export const runPromiseExitWith = internal.runPromiseExitWith;
|
|
6183
6214
|
/**
|
|
6184
|
-
* Executes an effect synchronously
|
|
6185
|
-
* result.
|
|
6215
|
+
* Executes an effect synchronously and returns its success value.
|
|
6186
6216
|
*
|
|
6187
6217
|
* **When to Use**
|
|
6188
6218
|
*
|
|
6189
|
-
* Use `runSync`
|
|
6190
|
-
*
|
|
6219
|
+
* Use `runSync` only for effects that can complete synchronously.
|
|
6220
|
+
*
|
|
6221
|
+
* **Details**
|
|
6191
6222
|
*
|
|
6192
|
-
* If the effect fails
|
|
6193
|
-
*
|
|
6223
|
+
* If the effect fails, dies, is interrupted, or performs asynchronous work,
|
|
6224
|
+
* `runSync` throws a `FiberFailure` instead of returning a value. Use
|
|
6225
|
+
* `runSyncExit` when you want the failure captured as an `Exit`.
|
|
6194
6226
|
*
|
|
6195
6227
|
* @see {@link runSyncExit} for a version that returns an `Exit` type instead of
|
|
6196
6228
|
* throwing an error.
|
|
6197
6229
|
*
|
|
6198
|
-
*
|
|
6230
|
+
* **Example** (Synchronous Logging)
|
|
6231
|
+
*
|
|
6199
6232
|
* ```ts
|
|
6200
|
-
* // Title: Synchronous Logging
|
|
6201
6233
|
* import { Effect } from "effect"
|
|
6202
6234
|
*
|
|
6203
6235
|
* const program = Effect.sync(() => {
|
|
@@ -6212,8 +6244,9 @@ export const runPromiseExitWith = internal.runPromiseExitWith;
|
|
|
6212
6244
|
* // Output: 1
|
|
6213
6245
|
* ```
|
|
6214
6246
|
*
|
|
6215
|
-
*
|
|
6216
|
-
*
|
|
6247
|
+
* **Example** (Incorrect Usage with Failing or Async Effects)
|
|
6248
|
+
*
|
|
6249
|
+
* ```ts
|
|
6217
6250
|
* import { Effect } from "effect"
|
|
6218
6251
|
*
|
|
6219
6252
|
* try {
|
|
@@ -6233,17 +6266,19 @@ export const runPromiseExitWith = internal.runPromiseExitWith;
|
|
|
6233
6266
|
* }
|
|
6234
6267
|
* // Output:
|
|
6235
6268
|
* // (FiberFailure) AsyncFiberException: Fiber #0 cannot be resolved synchronously. This is caused by using runSync on an effect that performs async work
|
|
6269
|
+
* ```
|
|
6236
6270
|
*
|
|
6237
|
-
* @since 2.0.0
|
|
6238
6271
|
* @category Running Effects
|
|
6272
|
+
* @since 2.0.0
|
|
6239
6273
|
*/
|
|
6240
6274
|
export const runSync = internal.runSync;
|
|
6241
6275
|
/**
|
|
6242
6276
|
* Executes an effect synchronously with provided services.
|
|
6243
6277
|
*
|
|
6244
|
-
*
|
|
6278
|
+
* **Example** (Usage)
|
|
6279
|
+
*
|
|
6245
6280
|
* ```ts
|
|
6246
|
-
* import {
|
|
6281
|
+
* import { Context, Effect } from "effect"
|
|
6247
6282
|
*
|
|
6248
6283
|
* interface MathService {
|
|
6249
6284
|
* add: (a: number, b: number) => number
|
|
@@ -6264,8 +6299,8 @@ export const runSync = internal.runSync;
|
|
|
6264
6299
|
* console.log(result) // 5
|
|
6265
6300
|
* ```
|
|
6266
6301
|
*
|
|
6267
|
-
* @since 4.0.0
|
|
6268
6302
|
* @category Running Effects
|
|
6303
|
+
* @since 4.0.0
|
|
6269
6304
|
*/
|
|
6270
6305
|
export const runSyncWith = internal.runSyncWith;
|
|
6271
6306
|
/**
|
|
@@ -6288,9 +6323,9 @@ export const runSyncWith = internal.runSyncWith;
|
|
|
6288
6323
|
* return an `Failure` with a `Die` cause, indicating that the effect cannot be
|
|
6289
6324
|
* resolved synchronously.
|
|
6290
6325
|
*
|
|
6291
|
-
*
|
|
6326
|
+
* **Example** (Handling Results as Exit)
|
|
6327
|
+
*
|
|
6292
6328
|
* ```ts
|
|
6293
|
-
* // Title: Handling Results as Exit
|
|
6294
6329
|
* import { Effect } from "effect"
|
|
6295
6330
|
*
|
|
6296
6331
|
* console.log(Effect.runSyncExit(Effect.succeed(1)))
|
|
@@ -6314,8 +6349,9 @@ export const runSyncWith = internal.runSyncWith;
|
|
|
6314
6349
|
* // }
|
|
6315
6350
|
* ```
|
|
6316
6351
|
*
|
|
6317
|
-
*
|
|
6318
|
-
*
|
|
6352
|
+
* **Example** (Asynchronous Operation Resulting in Die)
|
|
6353
|
+
*
|
|
6354
|
+
* ```ts
|
|
6319
6355
|
* import { Effect } from "effect"
|
|
6320
6356
|
*
|
|
6321
6357
|
* console.log(Effect.runSyncExit(Effect.promise(() => Promise.resolve(1))))
|
|
@@ -6333,17 +6369,19 @@ export const runSyncWith = internal.runSyncWith;
|
|
|
6333
6369
|
* // }
|
|
6334
6370
|
* // }
|
|
6335
6371
|
* // }
|
|
6372
|
+
* ```
|
|
6336
6373
|
*
|
|
6337
|
-
* @since 2.0.0
|
|
6338
6374
|
* @category Running Effects
|
|
6375
|
+
* @since 2.0.0
|
|
6339
6376
|
*/
|
|
6340
6377
|
export const runSyncExit = internal.runSyncExit;
|
|
6341
6378
|
/**
|
|
6342
6379
|
* Runs an effect synchronously with provided services, returning an Exit result.
|
|
6343
6380
|
*
|
|
6344
|
-
*
|
|
6381
|
+
* **Example** (Usage)
|
|
6382
|
+
*
|
|
6345
6383
|
* ```ts
|
|
6346
|
-
* import { Effect, Exit
|
|
6384
|
+
* import { Context, Effect, Exit } from "effect"
|
|
6347
6385
|
*
|
|
6348
6386
|
* // Define a logger service
|
|
6349
6387
|
* const Logger = Context.Service<{
|
|
@@ -6373,8 +6411,8 @@ export const runSyncExit = internal.runSyncExit;
|
|
|
6373
6411
|
* // Success: 42
|
|
6374
6412
|
* ```
|
|
6375
6413
|
*
|
|
6376
|
-
* @since 4.0.0
|
|
6377
6414
|
* @category Running Effects
|
|
6415
|
+
* @since 4.0.0
|
|
6378
6416
|
*/
|
|
6379
6417
|
export const runSyncExitWith = internal.runSyncExitWith;
|
|
6380
6418
|
/**
|
|
@@ -6382,7 +6420,8 @@ export const runSyncExitWith = internal.runSyncExitWith;
|
|
|
6382
6420
|
*
|
|
6383
6421
|
* `Effect.fnUntraced` also acts as a `pipe` function, so you can append transforms after the body.
|
|
6384
6422
|
*
|
|
6385
|
-
*
|
|
6423
|
+
* **Example** (Usage)
|
|
6424
|
+
*
|
|
6386
6425
|
* ```ts
|
|
6387
6426
|
* import { Console, Effect } from "effect"
|
|
6388
6427
|
*
|
|
@@ -6394,8 +6433,8 @@ export const runSyncExitWith = internal.runSyncExitWith;
|
|
|
6394
6433
|
* Effect.runFork(greet("Ada"))
|
|
6395
6434
|
* ```
|
|
6396
6435
|
*
|
|
6397
|
-
* @since 3.12.0
|
|
6398
6436
|
* @category Function
|
|
6437
|
+
* @since 3.12.0
|
|
6399
6438
|
*/
|
|
6400
6439
|
export const fnUntraced = internal.fnUntraced;
|
|
6401
6440
|
/**
|
|
@@ -6403,7 +6442,8 @@ export const fnUntraced = internal.fnUntraced;
|
|
|
6403
6442
|
*
|
|
6404
6443
|
* Pipeable functions run after the body and can transform the resulting Effect.
|
|
6405
6444
|
*
|
|
6406
|
-
*
|
|
6445
|
+
* **Example** (Usage)
|
|
6446
|
+
*
|
|
6407
6447
|
* ```ts
|
|
6408
6448
|
* import { Console, Effect } from "effect"
|
|
6409
6449
|
*
|
|
@@ -6422,8 +6462,8 @@ export const fnUntraced = internal.fnUntraced;
|
|
|
6422
6462
|
* })
|
|
6423
6463
|
* ```
|
|
6424
6464
|
*
|
|
6425
|
-
* @since 3.12.0
|
|
6426
6465
|
* @category Function
|
|
6466
|
+
* @since 3.11.0
|
|
6427
6467
|
*/
|
|
6428
6468
|
export const fn = internal.fn;
|
|
6429
6469
|
// ========================================================================
|
|
@@ -6433,7 +6473,8 @@ export const fn = internal.fn;
|
|
|
6433
6473
|
* Retrieves the `Clock` service from the context and provides it to the
|
|
6434
6474
|
* specified effectful function.
|
|
6435
6475
|
*
|
|
6436
|
-
*
|
|
6476
|
+
* **Example** (Usage)
|
|
6477
|
+
*
|
|
6437
6478
|
* ```ts
|
|
6438
6479
|
* import { Console, Effect } from "effect"
|
|
6439
6480
|
*
|
|
@@ -6449,8 +6490,8 @@ export const fn = internal.fn;
|
|
|
6449
6490
|
* // Current time is: 1735484929744
|
|
6450
6491
|
* ```
|
|
6451
6492
|
*
|
|
6452
|
-
* @since 2.0.0
|
|
6453
6493
|
* @category Clock
|
|
6494
|
+
* @since 2.0.0
|
|
6454
6495
|
*/
|
|
6455
6496
|
export const clockWith = internal.clockWith;
|
|
6456
6497
|
// ========================================================================
|
|
@@ -6462,7 +6503,8 @@ export const clockWith = internal.clockWith;
|
|
|
6462
6503
|
* If no level is provided, the logger uses the fiber's current log level and
|
|
6463
6504
|
* extracts any `Cause` values from the message list.
|
|
6464
6505
|
*
|
|
6465
|
-
*
|
|
6506
|
+
* **Example** (Usage)
|
|
6507
|
+
*
|
|
6466
6508
|
* ```ts
|
|
6467
6509
|
* import { Effect } from "effect"
|
|
6468
6510
|
*
|
|
@@ -6473,14 +6515,15 @@ export const clockWith = internal.clockWith;
|
|
|
6473
6515
|
* })
|
|
6474
6516
|
* ```
|
|
6475
6517
|
*
|
|
6518
|
+
* @category logging
|
|
6476
6519
|
* @since 2.0.0
|
|
6477
|
-
* @category Logging
|
|
6478
6520
|
*/
|
|
6479
6521
|
export const logWithLevel = internal.logWithLevel;
|
|
6480
6522
|
/**
|
|
6481
6523
|
* Logs one or more messages using the default log level.
|
|
6482
6524
|
*
|
|
6483
|
-
*
|
|
6525
|
+
* **Example** (Usage)
|
|
6526
|
+
*
|
|
6484
6527
|
* ```ts
|
|
6485
6528
|
* import { Effect } from "effect"
|
|
6486
6529
|
*
|
|
@@ -6500,14 +6543,15 @@ export const logWithLevel = internal.logWithLevel;
|
|
|
6500
6543
|
* // 4
|
|
6501
6544
|
* ```
|
|
6502
6545
|
*
|
|
6546
|
+
* @category logging
|
|
6503
6547
|
* @since 2.0.0
|
|
6504
|
-
* @category Logging
|
|
6505
6548
|
*/
|
|
6506
6549
|
export const log = /*#__PURE__*/internal.logWithLevel();
|
|
6507
6550
|
/**
|
|
6508
6551
|
* Logs one or more messages at the FATAL level.
|
|
6509
6552
|
*
|
|
6510
|
-
*
|
|
6553
|
+
* **Example** (Usage)
|
|
6554
|
+
*
|
|
6511
6555
|
* ```ts
|
|
6512
6556
|
* import { Effect } from "effect"
|
|
6513
6557
|
*
|
|
@@ -6528,14 +6572,15 @@ export const log = /*#__PURE__*/internal.logWithLevel();
|
|
|
6528
6572
|
* // timestamp=2023-... level=FATAL message="System shutting down"
|
|
6529
6573
|
* ```
|
|
6530
6574
|
*
|
|
6575
|
+
* @category logging
|
|
6531
6576
|
* @since 2.0.0
|
|
6532
|
-
* @category Logging
|
|
6533
6577
|
*/
|
|
6534
6578
|
export const logFatal = /*#__PURE__*/internal.logWithLevel("Fatal");
|
|
6535
6579
|
/**
|
|
6536
6580
|
* Logs one or more messages at the WARNING level.
|
|
6537
6581
|
*
|
|
6538
|
-
*
|
|
6582
|
+
* **Example** (Usage)
|
|
6583
|
+
*
|
|
6539
6584
|
* ```ts
|
|
6540
6585
|
* import { Effect } from "effect"
|
|
6541
6586
|
*
|
|
@@ -6557,14 +6602,15 @@ export const logFatal = /*#__PURE__*/internal.logWithLevel("Fatal");
|
|
|
6557
6602
|
* // timestamp=2023-... level=WARN message="Using deprecated API endpoint"
|
|
6558
6603
|
* ```
|
|
6559
6604
|
*
|
|
6605
|
+
* @category logging
|
|
6560
6606
|
* @since 2.0.0
|
|
6561
|
-
* @category Logging
|
|
6562
6607
|
*/
|
|
6563
6608
|
export const logWarning = /*#__PURE__*/internal.logWithLevel("Warn");
|
|
6564
6609
|
/**
|
|
6565
6610
|
* Logs one or more messages at the ERROR level.
|
|
6566
6611
|
*
|
|
6567
|
-
*
|
|
6612
|
+
* **Example** (Usage)
|
|
6613
|
+
*
|
|
6568
6614
|
* ```ts
|
|
6569
6615
|
* import { Effect } from "effect"
|
|
6570
6616
|
*
|
|
@@ -6589,14 +6635,15 @@ export const logWarning = /*#__PURE__*/internal.logWithLevel("Warn");
|
|
|
6589
6635
|
* // timestamp=2023-... level=ERROR message="Caught error: Something went wrong"
|
|
6590
6636
|
* ```
|
|
6591
6637
|
*
|
|
6638
|
+
* @category logging
|
|
6592
6639
|
* @since 2.0.0
|
|
6593
|
-
* @category Logging
|
|
6594
6640
|
*/
|
|
6595
6641
|
export const logError = /*#__PURE__*/internal.logWithLevel("Error");
|
|
6596
6642
|
/**
|
|
6597
6643
|
* Logs one or more messages at the INFO level.
|
|
6598
6644
|
*
|
|
6599
|
-
*
|
|
6645
|
+
* **Example** (Usage)
|
|
6646
|
+
*
|
|
6600
6647
|
* ```ts
|
|
6601
6648
|
* import { Effect } from "effect"
|
|
6602
6649
|
*
|
|
@@ -6616,14 +6663,15 @@ export const logError = /*#__PURE__*/internal.logWithLevel("Error");
|
|
|
6616
6663
|
* // timestamp=2023-... level=INFO message="Application version: 1.2.3"
|
|
6617
6664
|
* ```
|
|
6618
6665
|
*
|
|
6666
|
+
* @category logging
|
|
6619
6667
|
* @since 2.0.0
|
|
6620
|
-
* @category Logging
|
|
6621
6668
|
*/
|
|
6622
6669
|
export const logInfo = /*#__PURE__*/internal.logWithLevel("Info");
|
|
6623
6670
|
/**
|
|
6624
6671
|
* Logs one or more messages at the DEBUG level.
|
|
6625
6672
|
*
|
|
6626
|
-
*
|
|
6673
|
+
* **Example** (Usage)
|
|
6674
|
+
*
|
|
6627
6675
|
* ```ts
|
|
6628
6676
|
* import { Effect } from "effect"
|
|
6629
6677
|
*
|
|
@@ -6644,14 +6692,15 @@ export const logInfo = /*#__PURE__*/internal.logWithLevel("Info");
|
|
|
6644
6692
|
* // timestamp=2023-... level=DEBUG message="Variable state: x=10 y=20 z=30"
|
|
6645
6693
|
* ```
|
|
6646
6694
|
*
|
|
6695
|
+
* @category logging
|
|
6647
6696
|
* @since 2.0.0
|
|
6648
|
-
* @category Logging
|
|
6649
6697
|
*/
|
|
6650
6698
|
export const logDebug = /*#__PURE__*/internal.logWithLevel("Debug");
|
|
6651
6699
|
/**
|
|
6652
6700
|
* Logs one or more messages at the TRACE level.
|
|
6653
6701
|
*
|
|
6654
|
-
*
|
|
6702
|
+
* **Example** (Usage)
|
|
6703
|
+
*
|
|
6655
6704
|
* ```ts
|
|
6656
6705
|
* import { Effect } from "effect"
|
|
6657
6706
|
*
|
|
@@ -6675,14 +6724,15 @@ export const logDebug = /*#__PURE__*/internal.logWithLevel("Debug");
|
|
|
6675
6724
|
* // timestamp=2023-... level=TRACE message="Exiting function processData"
|
|
6676
6725
|
* ```
|
|
6677
6726
|
*
|
|
6727
|
+
* @category logging
|
|
6678
6728
|
* @since 2.0.0
|
|
6679
|
-
* @category Logging
|
|
6680
6729
|
*/
|
|
6681
6730
|
export const logTrace = /*#__PURE__*/internal.logWithLevel("Trace");
|
|
6682
6731
|
/**
|
|
6683
6732
|
* Adds a logger to the set of loggers which will output logs for this effect.
|
|
6684
6733
|
*
|
|
6685
|
-
*
|
|
6734
|
+
* **Example** (Usage)
|
|
6735
|
+
*
|
|
6686
6736
|
* ```ts
|
|
6687
6737
|
* import { Effect, Logger } from "effect"
|
|
6688
6738
|
*
|
|
@@ -6703,14 +6753,15 @@ export const logTrace = /*#__PURE__*/internal.logWithLevel("Trace");
|
|
|
6703
6753
|
* // Output includes both default and custom log outputs
|
|
6704
6754
|
* ```
|
|
6705
6755
|
*
|
|
6706
|
-
* @
|
|
6707
|
-
* @
|
|
6756
|
+
* @category logging
|
|
6757
|
+
* @since 4.0.0
|
|
6708
6758
|
*/
|
|
6709
6759
|
export const withLogger = /*#__PURE__*/dual(2, (effect, logger) => internal.updateService(effect, internal.CurrentLoggers, loggers => new Set([...loggers, logger])));
|
|
6710
6760
|
/**
|
|
6711
6761
|
* Adds an annotation to each log line in this effect.
|
|
6712
6762
|
*
|
|
6713
|
-
*
|
|
6763
|
+
* **Example** (Usage)
|
|
6764
|
+
*
|
|
6714
6765
|
* ```ts
|
|
6715
6766
|
* import { Effect } from "effect"
|
|
6716
6767
|
*
|
|
@@ -6733,8 +6784,8 @@ export const withLogger = /*#__PURE__*/dual(2, (effect, logger) => internal.upda
|
|
|
6733
6784
|
* // All log messages will include the userId and operation annotations
|
|
6734
6785
|
* ```
|
|
6735
6786
|
*
|
|
6787
|
+
* @category logging
|
|
6736
6788
|
* @since 2.0.0
|
|
6737
|
-
* @category Logging
|
|
6738
6789
|
*/
|
|
6739
6790
|
export const annotateLogs = /*#__PURE__*/dual(args => isEffect(args[0]), (effect, ...args) => internal.updateService(effect, CurrentLogAnnotations, annotations => {
|
|
6740
6791
|
const newAnnotations = {
|
|
@@ -6754,7 +6805,8 @@ export const annotateLogs = /*#__PURE__*/dual(args => isEffect(args[0]), (effect
|
|
|
6754
6805
|
* `annotateLogsScoped` updates annotations for the entire current `Scope` and
|
|
6755
6806
|
* restores the previous annotations when the scope closes.
|
|
6756
6807
|
*
|
|
6757
|
-
*
|
|
6808
|
+
* **Example** (Usage)
|
|
6809
|
+
*
|
|
6758
6810
|
* ```ts
|
|
6759
6811
|
* import { Effect } from "effect"
|
|
6760
6812
|
*
|
|
@@ -6769,14 +6821,15 @@ export const annotateLogs = /*#__PURE__*/dual(args => isEffect(args[0]), (effect
|
|
|
6769
6821
|
* Effect.runPromise(program)
|
|
6770
6822
|
* ```
|
|
6771
6823
|
*
|
|
6772
|
-
* @
|
|
6773
|
-
* @
|
|
6824
|
+
* @category logging
|
|
6825
|
+
* @since 3.1.0
|
|
6774
6826
|
*/
|
|
6775
6827
|
export const annotateLogsScoped = internal.annotateLogsScoped;
|
|
6776
6828
|
/**
|
|
6777
6829
|
* Adds a span to each log line in this effect.
|
|
6778
6830
|
*
|
|
6779
|
-
*
|
|
6831
|
+
* **Example** (Usage)
|
|
6832
|
+
*
|
|
6780
6833
|
* ```ts
|
|
6781
6834
|
* import { Effect } from "effect"
|
|
6782
6835
|
*
|
|
@@ -6800,8 +6853,8 @@ export const annotateLogsScoped = internal.annotateLogsScoped;
|
|
|
6800
6853
|
* // All log messages will include span information showing the nested operation context
|
|
6801
6854
|
* ```
|
|
6802
6855
|
*
|
|
6856
|
+
* @category logging
|
|
6803
6857
|
* @since 2.0.0
|
|
6804
|
-
* @category Logging
|
|
6805
6858
|
*/
|
|
6806
6859
|
export const withLogSpan = /*#__PURE__*/dual(2, (effect, label) => internal.flatMap(internal.currentTimeMillis, now => internal.updateService(effect, CurrentLogSpans, spans => {
|
|
6807
6860
|
const span = [label, now];
|
|
@@ -6816,7 +6869,8 @@ export const withLogSpan = /*#__PURE__*/dual(2, (effect, label) => internal.flat
|
|
|
6816
6869
|
* Also accepts an optional function which can be used to map the `Exit` value
|
|
6817
6870
|
* of the `Effect` into a valid `Input` for the `Metric`.
|
|
6818
6871
|
*
|
|
6819
|
-
*
|
|
6872
|
+
* **Example** (Usage)
|
|
6873
|
+
*
|
|
6820
6874
|
* ```ts
|
|
6821
6875
|
* import { Effect, Metric } from "effect"
|
|
6822
6876
|
*
|
|
@@ -6835,7 +6889,8 @@ export const withLogSpan = /*#__PURE__*/dual(2, (effect, label) => internal.flat
|
|
|
6835
6889
|
* )
|
|
6836
6890
|
* ```
|
|
6837
6891
|
*
|
|
6838
|
-
*
|
|
6892
|
+
* **Example** (Usage)
|
|
6893
|
+
*
|
|
6839
6894
|
* ```ts
|
|
6840
6895
|
* import { Effect, Exit, Metric } from "effect"
|
|
6841
6896
|
*
|
|
@@ -6855,8 +6910,8 @@ export const withLogSpan = /*#__PURE__*/dual(2, (effect, label) => internal.flat
|
|
|
6855
6910
|
* )
|
|
6856
6911
|
* ```
|
|
6857
6912
|
*
|
|
6858
|
-
* @since 4.0.0
|
|
6859
6913
|
* @category Tracking
|
|
6914
|
+
* @since 4.0.0
|
|
6860
6915
|
*/
|
|
6861
6916
|
export const track = /*#__PURE__*/dual(args => isEffect(args[0]), (self, metric, f) => onExit(self, exit => {
|
|
6862
6917
|
const input = f === undefined ? exit : internalCall(() => f(exit));
|
|
@@ -6869,7 +6924,8 @@ export const track = /*#__PURE__*/dual(args => isEffect(args[0]), (self, metric,
|
|
|
6869
6924
|
* Also accepts an optional function which can be used to map the success value
|
|
6870
6925
|
* of the `Effect` into a valid `Input` for the `Metric`.
|
|
6871
6926
|
*
|
|
6872
|
-
*
|
|
6927
|
+
* **Example** (Usage)
|
|
6928
|
+
*
|
|
6873
6929
|
* ```ts
|
|
6874
6930
|
* import { Effect, Metric } from "effect"
|
|
6875
6931
|
*
|
|
@@ -6887,7 +6943,8 @@ export const track = /*#__PURE__*/dual(args => isEffect(args[0]), (self, metric,
|
|
|
6887
6943
|
* )
|
|
6888
6944
|
* ```
|
|
6889
6945
|
*
|
|
6890
|
-
*
|
|
6946
|
+
* **Example** (Usage)
|
|
6947
|
+
*
|
|
6891
6948
|
* ```ts
|
|
6892
6949
|
* import { Effect, Metric } from "effect"
|
|
6893
6950
|
*
|
|
@@ -6904,8 +6961,8 @@ export const track = /*#__PURE__*/dual(args => isEffect(args[0]), (self, metric,
|
|
|
6904
6961
|
* )
|
|
6905
6962
|
* ```
|
|
6906
6963
|
*
|
|
6907
|
-
* @since 4.0.0
|
|
6908
6964
|
* @category Tracking
|
|
6965
|
+
* @since 4.0.0
|
|
6909
6966
|
*/
|
|
6910
6967
|
export const trackSuccesses = /*#__PURE__*/dual(args => isEffect(args[0]), (self, metric, f) => tap(self, value => {
|
|
6911
6968
|
const input = f === undefined ? value : f(value);
|
|
@@ -6918,7 +6975,8 @@ export const trackSuccesses = /*#__PURE__*/dual(args => isEffect(args[0]), (self
|
|
|
6918
6975
|
* Also accepts an optional function which can be used to map the error value
|
|
6919
6976
|
* of the `Effect` into a valid `Input` for the `Metric`.
|
|
6920
6977
|
*
|
|
6921
|
-
*
|
|
6978
|
+
* **Example** (Usage)
|
|
6979
|
+
*
|
|
6922
6980
|
* ```ts
|
|
6923
6981
|
* import { Effect, Metric } from "effect"
|
|
6924
6982
|
*
|
|
@@ -6936,7 +6994,8 @@ export const trackSuccesses = /*#__PURE__*/dual(args => isEffect(args[0]), (self
|
|
|
6936
6994
|
* )
|
|
6937
6995
|
* ```
|
|
6938
6996
|
*
|
|
6939
|
-
*
|
|
6997
|
+
* **Example** (Usage)
|
|
6998
|
+
*
|
|
6940
6999
|
* ```ts
|
|
6941
7000
|
* import { Data, Effect, Metric } from "effect"
|
|
6942
7001
|
*
|
|
@@ -6955,8 +7014,8 @@ export const trackSuccesses = /*#__PURE__*/dual(args => isEffect(args[0]), (self
|
|
|
6955
7014
|
* )
|
|
6956
7015
|
* ```
|
|
6957
7016
|
*
|
|
6958
|
-
* @since 4.0.0
|
|
6959
7017
|
* @category Tracking
|
|
7018
|
+
* @since 4.0.0
|
|
6960
7019
|
*/
|
|
6961
7020
|
export const trackErrors = /*#__PURE__*/dual(args => isEffect(args[0]), (self, metric, f) => tapError(self, error => {
|
|
6962
7021
|
const input = f === undefined ? error : internalCall(() => f(error));
|
|
@@ -6969,7 +7028,8 @@ export const trackErrors = /*#__PURE__*/dual(args => isEffect(args[0]), (self, m
|
|
|
6969
7028
|
* Also accepts an optional function which can be used to map the defect value
|
|
6970
7029
|
* of the `Effect` into a valid `Input` for the `Metric`.
|
|
6971
7030
|
*
|
|
6972
|
-
*
|
|
7031
|
+
* **Example** (Usage)
|
|
7032
|
+
*
|
|
6973
7033
|
* ```ts
|
|
6974
7034
|
* import { Effect, Metric } from "effect"
|
|
6975
7035
|
*
|
|
@@ -6987,7 +7047,8 @@ export const trackErrors = /*#__PURE__*/dual(args => isEffect(args[0]), (self, m
|
|
|
6987
7047
|
* )
|
|
6988
7048
|
* ```
|
|
6989
7049
|
*
|
|
6990
|
-
*
|
|
7050
|
+
* **Example** (Usage)
|
|
7051
|
+
*
|
|
6991
7052
|
* ```ts
|
|
6992
7053
|
* import { Effect, Metric } from "effect"
|
|
6993
7054
|
*
|
|
@@ -7007,8 +7068,8 @@ export const trackErrors = /*#__PURE__*/dual(args => isEffect(args[0]), (self, m
|
|
|
7007
7068
|
* )
|
|
7008
7069
|
* ```
|
|
7009
7070
|
*
|
|
7010
|
-
* @since 4.0.0
|
|
7011
7071
|
* @category Tracking
|
|
7072
|
+
* @since 4.0.0
|
|
7012
7073
|
*/
|
|
7013
7074
|
export const trackDefects = /*#__PURE__*/dual(args => isEffect(args[0]), (self, metric, f) => tapDefect(self, defect => {
|
|
7014
7075
|
const input = f === undefined ? defect : internalCall(() => f(defect));
|
|
@@ -7022,7 +7083,8 @@ export const trackDefects = /*#__PURE__*/dual(args => isEffect(args[0]), (self,
|
|
|
7022
7083
|
* that the wrapped `Effect` took to complete into a valid `Input` for the
|
|
7023
7084
|
* `Metric`.
|
|
7024
7085
|
*
|
|
7025
|
-
*
|
|
7086
|
+
* **Example** (Usage)
|
|
7087
|
+
*
|
|
7026
7088
|
* ```ts
|
|
7027
7089
|
* import { Effect, Metric } from "effect"
|
|
7028
7090
|
*
|
|
@@ -7038,7 +7100,8 @@ export const trackDefects = /*#__PURE__*/dual(args => isEffect(args[0]), (self,
|
|
|
7038
7100
|
* )
|
|
7039
7101
|
* ```
|
|
7040
7102
|
*
|
|
7041
|
-
*
|
|
7103
|
+
* **Example** (Usage)
|
|
7104
|
+
*
|
|
7042
7105
|
* ```ts
|
|
7043
7106
|
* import { Duration, Effect, Metric } from "effect"
|
|
7044
7107
|
*
|
|
@@ -7055,8 +7118,8 @@ export const trackDefects = /*#__PURE__*/dual(args => isEffect(args[0]), (self,
|
|
|
7055
7118
|
* )
|
|
7056
7119
|
* ```
|
|
7057
7120
|
*
|
|
7058
|
-
* @since 4.0.0
|
|
7059
7121
|
* @category Tracking
|
|
7122
|
+
* @since 4.0.0
|
|
7060
7123
|
*/
|
|
7061
7124
|
export const trackDuration = /*#__PURE__*/dual(args => isEffect(args[0]), (self, metric, f) => clockWith(clock => {
|
|
7062
7125
|
const startTime = clock.currentTimeNanosUnsafe();
|
|
@@ -7076,7 +7139,8 @@ export const trackDuration = /*#__PURE__*/dual(args => isEffect(args[0]), (self,
|
|
|
7076
7139
|
* - a journal that stores any non committed change to TxRef values
|
|
7077
7140
|
* - a retry flag to know if the transaction should be retried
|
|
7078
7141
|
*
|
|
7079
|
-
*
|
|
7142
|
+
* **Example** (Usage)
|
|
7143
|
+
*
|
|
7080
7144
|
* ```ts
|
|
7081
7145
|
* import { Effect } from "effect"
|
|
7082
7146
|
*
|
|
@@ -7088,8 +7152,8 @@ export const trackDuration = /*#__PURE__*/dual(args => isEffect(args[0]), (self,
|
|
|
7088
7152
|
* })
|
|
7089
7153
|
* ```
|
|
7090
7154
|
*
|
|
7091
|
-
* @since 4.0.0
|
|
7092
7155
|
* @category Transactions
|
|
7156
|
+
* @since 4.0.0
|
|
7093
7157
|
*/
|
|
7094
7158
|
export class Transaction extends /*#__PURE__*/Context.Service()("effect/Effect/Transaction") {}
|
|
7095
7159
|
/**
|
|
@@ -7110,7 +7174,8 @@ export class Transaction extends /*#__PURE__*/Context.Service()("effect/Effect/T
|
|
|
7110
7174
|
* The outermost `tx` call creates the transaction boundary and commits or rolls back the full
|
|
7111
7175
|
* composed transaction.
|
|
7112
7176
|
*
|
|
7113
|
-
*
|
|
7177
|
+
* **Example** (Usage)
|
|
7178
|
+
*
|
|
7114
7179
|
* ```ts
|
|
7115
7180
|
* import { Effect, TxRef } from "effect"
|
|
7116
7181
|
*
|
|
@@ -7131,8 +7196,8 @@ export class Transaction extends /*#__PURE__*/Context.Service()("effect/Effect/T
|
|
|
7131
7196
|
* })
|
|
7132
7197
|
* ```
|
|
7133
7198
|
*
|
|
7134
|
-
* @since 4.0.0
|
|
7135
7199
|
* @category Transactions
|
|
7200
|
+
* @since 4.0.0
|
|
7136
7201
|
*/
|
|
7137
7202
|
export const tx = effect => withFiber(fiber => {
|
|
7138
7203
|
if (fiber.context.mapUnsafe.has(Transaction.key)) {
|
|
@@ -7215,10 +7280,10 @@ function clearTransaction(state) {
|
|
|
7215
7280
|
*
|
|
7216
7281
|
* NOTE: the transaction retries on any change to transactional values (i.e. TxRef) accessed in its body.
|
|
7217
7282
|
*
|
|
7218
|
-
* @since 4.0.0
|
|
7219
7283
|
* @category Transactions
|
|
7284
|
+
* @since 4.0.0
|
|
7220
7285
|
*
|
|
7221
|
-
*
|
|
7286
|
+
* **Example** (Usage)
|
|
7222
7287
|
*
|
|
7223
7288
|
* ```ts
|
|
7224
7289
|
* import { Effect, TxRef } from "effect"
|
|
@@ -7252,9 +7317,19 @@ export const txRetry = /*#__PURE__*/flatMap(Transaction, state => {
|
|
|
7252
7317
|
return interrupt;
|
|
7253
7318
|
});
|
|
7254
7319
|
/**
|
|
7255
|
-
* Converts
|
|
7320
|
+
* Converts an error-first callback API into a function that returns an
|
|
7321
|
+
* `Effect`.
|
|
7322
|
+
*
|
|
7323
|
+
* **Details**
|
|
7324
|
+
*
|
|
7325
|
+
* The original function is called with the supplied arguments plus a final
|
|
7326
|
+
* callback. A non-null callback error fails the returned effect, while a
|
|
7327
|
+
* successful callback value becomes the effect success. Use `onError` to map
|
|
7328
|
+
* callback errors and `onSyncError` to turn synchronous throws into typed
|
|
7329
|
+
* failures; otherwise synchronous throws become defects.
|
|
7330
|
+
*
|
|
7331
|
+
* **Example** (Basic Usage)
|
|
7256
7332
|
*
|
|
7257
|
-
* @example Basic Usage
|
|
7258
7333
|
* ```ts
|
|
7259
7334
|
* import { Effect } from "effect"
|
|
7260
7335
|
* import * as fs from "fs"
|
|
@@ -7269,7 +7344,8 @@ export const txRetry = /*#__PURE__*/flatMap(Transaction, state => {
|
|
|
7269
7344
|
* // Output: contents of package.json
|
|
7270
7345
|
* ```
|
|
7271
7346
|
*
|
|
7272
|
-
*
|
|
7347
|
+
* **Example** (Custom Error Handling)
|
|
7348
|
+
*
|
|
7273
7349
|
* ```ts
|
|
7274
7350
|
* import { Effect } from "effect"
|
|
7275
7351
|
* import * as fs from "fs"
|
|
@@ -7285,8 +7361,8 @@ export const txRetry = /*#__PURE__*/flatMap(Transaction, state => {
|
|
|
7285
7361
|
* // Output: Exit.failure with custom error message
|
|
7286
7362
|
* ```
|
|
7287
7363
|
*
|
|
7288
|
-
* @since 4.0.0
|
|
7289
7364
|
* @category Effectify
|
|
7365
|
+
* @since 4.0.0
|
|
7290
7366
|
*/
|
|
7291
7367
|
export const effectify = (fn, onError, onSyncError) => (...args) => callback(resume => {
|
|
7292
7368
|
try {
|
|
@@ -7310,7 +7386,8 @@ export const effectify = (fn, onError, onSyncError) => (...args) => callback(res
|
|
|
7310
7386
|
* This function provides compile-time type checking to ensure that the success
|
|
7311
7387
|
* value of an effect conforms to a specific type constraint.
|
|
7312
7388
|
*
|
|
7313
|
-
*
|
|
7389
|
+
* **Example** (Usage)
|
|
7390
|
+
*
|
|
7314
7391
|
* ```ts
|
|
7315
7392
|
* import { Effect } from "effect"
|
|
7316
7393
|
*
|
|
@@ -7326,8 +7403,8 @@ export const effectify = (fn, onError, onSyncError) => (...args) => callback(res
|
|
|
7326
7403
|
* // Type 'string' is not assignable to type 'number'
|
|
7327
7404
|
* ```
|
|
7328
7405
|
*
|
|
7329
|
-
* @since 4.0.0
|
|
7330
7406
|
* @category Type Constraints
|
|
7407
|
+
* @since 4.0.0
|
|
7331
7408
|
*/
|
|
7332
7409
|
export const satisfiesSuccessType = () => effect => effect;
|
|
7333
7410
|
/**
|
|
@@ -7336,7 +7413,8 @@ export const satisfiesSuccessType = () => effect => effect;
|
|
|
7336
7413
|
* This function provides compile-time type checking to ensure that the error
|
|
7337
7414
|
* type of an effect conforms to a specific type constraint.
|
|
7338
7415
|
*
|
|
7339
|
-
*
|
|
7416
|
+
* **Example** (Usage)
|
|
7417
|
+
*
|
|
7340
7418
|
* ```ts
|
|
7341
7419
|
* import { Data, Effect } from "effect"
|
|
7342
7420
|
*
|
|
@@ -7354,8 +7432,8 @@ export const satisfiesSuccessType = () => effect => effect;
|
|
|
7354
7432
|
* // Type 'string' is not assignable to type 'ValidationError'
|
|
7355
7433
|
* ```
|
|
7356
7434
|
*
|
|
7357
|
-
* @since 4.0.0
|
|
7358
7435
|
* @category Type Constraints
|
|
7436
|
+
* @since 4.0.0
|
|
7359
7437
|
*/
|
|
7360
7438
|
export const satisfiesErrorType = () => effect => effect;
|
|
7361
7439
|
/**
|
|
@@ -7364,7 +7442,8 @@ export const satisfiesErrorType = () => effect => effect;
|
|
|
7364
7442
|
* This function provides compile-time type checking to ensure that the
|
|
7365
7443
|
* requirements (context) type of an effect conforms to a specific type constraint.
|
|
7366
7444
|
*
|
|
7367
|
-
*
|
|
7445
|
+
* **Example** (Usage)
|
|
7446
|
+
*
|
|
7368
7447
|
* ```ts
|
|
7369
7448
|
* import { Effect } from "effect"
|
|
7370
7449
|
*
|
|
@@ -7380,8 +7459,8 @@ export const satisfiesErrorType = () => effect => effect;
|
|
|
7380
7459
|
* // const constrainedInvalid = satisfiesStringServices(invalidEffect)
|
|
7381
7460
|
* ```
|
|
7382
7461
|
*
|
|
7383
|
-
* @since 4.0.0
|
|
7384
7462
|
* @category Type Constraints
|
|
7463
|
+
* @since 4.0.0
|
|
7385
7464
|
*/
|
|
7386
7465
|
export const satisfiesServicesType = () => effect => effect;
|
|
7387
7466
|
/**
|
|
@@ -7400,7 +7479,8 @@ export const satisfiesServicesType = () => effect => effect;
|
|
|
7400
7479
|
* - For **Failure effects**: Returns the failure as-is without applying the mapping
|
|
7401
7480
|
* - For **Pending effects**: Falls back to the regular `map` behavior
|
|
7402
7481
|
*
|
|
7403
|
-
*
|
|
7482
|
+
* **Example** (Usage)
|
|
7483
|
+
*
|
|
7404
7484
|
* ```ts
|
|
7405
7485
|
* import { Effect } from "effect"
|
|
7406
7486
|
*
|
|
@@ -7413,8 +7493,8 @@ export const satisfiesServicesType = () => effect => effect;
|
|
|
7413
7493
|
* const mappedPending = Effect.mapEager(pending, (n) => n * 2) // Uses regular map
|
|
7414
7494
|
* ```
|
|
7415
7495
|
*
|
|
7416
|
-
* @since 4.0.0
|
|
7417
7496
|
* @category Eager
|
|
7497
|
+
* @since 4.0.0
|
|
7418
7498
|
*/
|
|
7419
7499
|
export const mapEager = internal.mapEager;
|
|
7420
7500
|
/**
|
|
@@ -7433,7 +7513,8 @@ export const mapEager = internal.mapEager;
|
|
|
7433
7513
|
* - For **Failure effects**: Applies the mapping function immediately to the error
|
|
7434
7514
|
* - For **Pending effects**: Falls back to the regular `mapError` behavior
|
|
7435
7515
|
*
|
|
7436
|
-
*
|
|
7516
|
+
* **Example** (Usage)
|
|
7517
|
+
*
|
|
7437
7518
|
* ```ts
|
|
7438
7519
|
* import { Effect } from "effect"
|
|
7439
7520
|
*
|
|
@@ -7449,8 +7530,8 @@ export const mapEager = internal.mapEager;
|
|
|
7449
7530
|
* ) // Uses regular mapError
|
|
7450
7531
|
* ```
|
|
7451
7532
|
*
|
|
7452
|
-
* @since 4.0.0
|
|
7453
7533
|
* @category Eager
|
|
7534
|
+
* @since 4.0.0
|
|
7454
7535
|
*/
|
|
7455
7536
|
export const mapErrorEager = internal.mapErrorEager;
|
|
7456
7537
|
/**
|
|
@@ -7469,7 +7550,8 @@ export const mapErrorEager = internal.mapErrorEager;
|
|
|
7469
7550
|
* - For **Failure effects**: Applies the `onFailure` function immediately to the error
|
|
7470
7551
|
* - For **Pending effects**: Falls back to the regular `mapBoth` behavior
|
|
7471
7552
|
*
|
|
7472
|
-
*
|
|
7553
|
+
* **Example** (Usage)
|
|
7554
|
+
*
|
|
7473
7555
|
* ```ts
|
|
7474
7556
|
* import { Effect } from "effect"
|
|
7475
7557
|
*
|
|
@@ -7487,8 +7569,8 @@ export const mapErrorEager = internal.mapErrorEager;
|
|
|
7487
7569
|
* }) // onFailure applied eagerly
|
|
7488
7570
|
* ```
|
|
7489
7571
|
*
|
|
7490
|
-
* @since 4.0.0
|
|
7491
7572
|
* @category Eager
|
|
7573
|
+
* @since 4.0.0
|
|
7492
7574
|
*/
|
|
7493
7575
|
export const mapBothEager = internal.mapBothEager;
|
|
7494
7576
|
/**
|
|
@@ -7507,7 +7589,8 @@ export const mapBothEager = internal.mapBothEager;
|
|
|
7507
7589
|
* - For **Failure effects**: Returns the failure as-is without applying the flatMap
|
|
7508
7590
|
* - For **Pending effects**: Falls back to the regular `flatMap` behavior
|
|
7509
7591
|
*
|
|
7510
|
-
*
|
|
7592
|
+
* **Example** (Usage)
|
|
7593
|
+
*
|
|
7511
7594
|
* ```ts
|
|
7512
7595
|
* import { Effect } from "effect"
|
|
7513
7596
|
*
|
|
@@ -7523,8 +7606,8 @@ export const mapBothEager = internal.mapBothEager;
|
|
|
7523
7606
|
* ) // Uses regular flatMap
|
|
7524
7607
|
* ```
|
|
7525
7608
|
*
|
|
7526
|
-
* @since 4.0.0
|
|
7527
7609
|
* @category Eager
|
|
7610
|
+
* @since 4.0.0
|
|
7528
7611
|
*/
|
|
7529
7612
|
export const flatMapEager = internal.flatMapEager;
|
|
7530
7613
|
/**
|
|
@@ -7543,7 +7626,8 @@ export const flatMapEager = internal.flatMapEager;
|
|
|
7543
7626
|
* - For **Failure effects**: Applies the catch function immediately to the error
|
|
7544
7627
|
* - For **Pending effects**: Falls back to the regular `catch` behavior
|
|
7545
7628
|
*
|
|
7546
|
-
*
|
|
7629
|
+
* **Example** (Usage)
|
|
7630
|
+
*
|
|
7547
7631
|
* ```ts
|
|
7548
7632
|
* import { Effect } from "effect"
|
|
7549
7633
|
*
|
|
@@ -7569,8 +7653,8 @@ export const flatMapEager = internal.flatMapEager;
|
|
|
7569
7653
|
* ) // Uses regular catch
|
|
7570
7654
|
* ```
|
|
7571
7655
|
*
|
|
7572
|
-
* @since 4.0.0
|
|
7573
7656
|
* @category Eager
|
|
7657
|
+
* @since 4.0.0
|
|
7574
7658
|
*/
|
|
7575
7659
|
export const catchEager = internal.catchEager;
|
|
7576
7660
|
/**
|
|
@@ -7579,7 +7663,8 @@ export const catchEager = internal.catchEager;
|
|
|
7579
7663
|
* Executes generator functions eagerly when all yielded effects are synchronous,
|
|
7580
7664
|
* stopping at the first async effect and deferring to normal execution.
|
|
7581
7665
|
*
|
|
7582
|
-
*
|
|
7666
|
+
* **Example** (Usage)
|
|
7667
|
+
*
|
|
7583
7668
|
* ```ts
|
|
7584
7669
|
* import { Effect } from "effect"
|
|
7585
7670
|
*
|
|
@@ -7592,8 +7677,8 @@ export const catchEager = internal.catchEager;
|
|
|
7592
7677
|
* const effect = computation() // Executed immediately if all effects are sync
|
|
7593
7678
|
* ```
|
|
7594
7679
|
*
|
|
7595
|
-
* @since 4.0.0
|
|
7596
7680
|
* @category Eager
|
|
7681
|
+
* @since 4.0.0
|
|
7597
7682
|
*/
|
|
7598
7683
|
export const fnUntracedEager = internal.fnUntracedEager;
|
|
7599
7684
|
//# sourceMappingURL=Effect.js.map
|