effect 4.0.0-beta.6 → 4.0.0-beta.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Array.d.ts +213 -385
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +149 -102
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +82 -45
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +105 -52
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts +39 -32
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +36 -33
- package/dist/BigInt.js.map +1 -1
- package/dist/Brand.d.ts +3 -5
- package/dist/Brand.d.ts.map +1 -1
- package/dist/Brand.js +1 -1
- package/dist/Brand.js.map +1 -1
- package/dist/Cache.d.ts +14 -45
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +21 -47
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +53 -22
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Cause.js +108 -10
- package/dist/Cause.js.map +1 -1
- package/dist/Channel.d.ts +166 -48
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +176 -87
- package/dist/Channel.js.map +1 -1
- package/dist/Chunk.d.ts +112 -304
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +56 -88
- package/dist/Chunk.js.map +1 -1
- package/dist/Clock.d.ts +2 -2
- package/dist/Clock.d.ts.map +1 -1
- package/dist/Clock.js.map +1 -1
- package/dist/Combiner.d.ts +280 -13
- package/dist/Combiner.d.ts.map +1 -1
- package/dist/Combiner.js +198 -7
- package/dist/Combiner.js.map +1 -1
- package/dist/Config.d.ts +189 -29
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +85 -35
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +6 -6
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +5 -5
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Console.d.ts +2 -2
- package/dist/Console.d.ts.map +1 -1
- package/dist/Console.js.map +1 -1
- package/dist/Context.d.ts +1150 -0
- package/dist/Context.d.ts.map +1 -0
- package/dist/{ServiceMap.js → Context.js} +181 -165
- package/dist/Context.js.map +1 -0
- package/dist/Cron.d.ts +11 -7
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +120 -63
- package/dist/Cron.js.map +1 -1
- package/dist/Data.d.ts +533 -365
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js +125 -73
- package/dist/Data.js.map +1 -1
- package/dist/DateTime.d.ts +74 -255
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +17 -62
- package/dist/DateTime.js.map +1 -1
- package/dist/Deferred.d.ts +12 -5
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +13 -5
- package/dist/Deferred.js.map +1 -1
- package/dist/Duration.d.ts +74 -40
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +126 -87
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +1435 -927
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +516 -328
- package/dist/Effect.js.map +1 -1
- package/dist/Effectable.d.ts +29 -0
- package/dist/Effectable.d.ts.map +1 -0
- package/dist/Effectable.js +31 -0
- package/dist/Effectable.js.map +1 -0
- package/dist/Encoding.d.ts +1 -1
- package/dist/Equal.d.ts +276 -109
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +140 -48
- package/dist/Equal.js.map +1 -1
- package/dist/Equivalence.d.ts +60 -3
- package/dist/Equivalence.d.ts.map +1 -1
- package/dist/Equivalence.js +70 -13
- package/dist/Equivalence.js.map +1 -1
- package/dist/ErrorReporter.d.ts +374 -0
- package/dist/ErrorReporter.d.ts.map +1 -0
- package/dist/ErrorReporter.js +245 -0
- package/dist/ErrorReporter.js.map +1 -0
- package/dist/ExecutionPlan.d.ts +6 -6
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/ExecutionPlan.js +4 -4
- package/dist/ExecutionPlan.js.map +1 -1
- package/dist/Exit.d.ts +24 -12
- package/dist/Exit.d.ts.map +1 -1
- package/dist/Exit.js +8 -4
- package/dist/Exit.js.map +1 -1
- package/dist/Fiber.d.ts +10 -8
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +11 -10
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +12 -11
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +22 -21
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +10 -10
- package/dist/FiberMap.js.map +1 -1
- package/dist/FiberSet.d.ts +2 -2
- package/dist/FiberSet.d.ts.map +1 -1
- package/dist/FiberSet.js +4 -4
- package/dist/FiberSet.js.map +1 -1
- package/dist/FileSystem.d.ts +20 -19
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +15 -11
- package/dist/FileSystem.js.map +1 -1
- package/dist/Filter.d.ts +4 -37
- package/dist/Filter.d.ts.map +1 -1
- package/dist/Filter.js +0 -13
- package/dist/Filter.js.map +1 -1
- package/dist/Formatter.d.ts +131 -47
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +243 -55
- package/dist/Formatter.js.map +1 -1
- package/dist/Function.d.ts +1 -9
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +2 -10
- package/dist/Function.js.map +1 -1
- package/dist/Graph.d.ts +65 -65
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +58 -60
- package/dist/Graph.js.map +1 -1
- package/dist/Hash.js +1 -1
- package/dist/Hash.js.map +1 -1
- package/dist/HashMap.d.ts +26 -19
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashMap.js +7 -5
- package/dist/HashMap.js.map +1 -1
- package/dist/Inspectable.d.ts +0 -4
- package/dist/Inspectable.d.ts.map +1 -1
- package/dist/Inspectable.js +4 -13
- package/dist/Inspectable.js.map +1 -1
- package/dist/Iterable.d.ts +50 -50
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +106 -34
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonSchema.d.ts +299 -10
- package/dist/JsonSchema.d.ts.map +1 -1
- package/dist/JsonSchema.js +323 -4
- package/dist/JsonSchema.js.map +1 -1
- package/dist/Latch.d.ts +69 -3
- package/dist/Latch.d.ts.map +1 -1
- package/dist/Latch.js +58 -0
- package/dist/Latch.js.map +1 -1
- package/dist/Layer.d.ts +599 -379
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +249 -180
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +27 -26
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +21 -18
- package/dist/LayerMap.js.map +1 -1
- package/dist/LogLevel.d.ts +32 -0
- package/dist/LogLevel.d.ts.map +1 -1
- package/dist/LogLevel.js +28 -100
- package/dist/LogLevel.js.map +1 -1
- package/dist/Logger.d.ts +31 -97
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +2 -3
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +8 -8
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/ManagedRuntime.js +34 -25
- package/dist/ManagedRuntime.js.map +1 -1
- package/dist/Metric.d.ts +23 -25
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +24 -26
- package/dist/Metric.js.map +1 -1
- package/dist/MutableHashMap.d.ts +7 -0
- package/dist/MutableHashMap.d.ts.map +1 -1
- package/dist/MutableHashMap.js +8 -0
- package/dist/MutableHashMap.js.map +1 -1
- package/dist/MutableHashSet.d.ts +7 -0
- package/dist/MutableHashSet.d.ts.map +1 -1
- package/dist/MutableHashSet.js +8 -0
- package/dist/MutableHashSet.js.map +1 -1
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +3 -0
- package/dist/MutableList.js.map +1 -1
- package/dist/Newtype.d.ts +291 -0
- package/dist/Newtype.d.ts.map +1 -0
- package/dist/Newtype.js +161 -0
- package/dist/Newtype.js.map +1 -0
- package/dist/Number.d.ts +74 -18
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +46 -18
- package/dist/Number.js.map +1 -1
- package/dist/Optic.d.ts +947 -18
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +454 -5
- package/dist/Optic.js.map +1 -1
- package/dist/Option.d.ts +25 -16
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +15 -9
- package/dist/Option.js.map +1 -1
- package/dist/Order.d.ts +6 -1
- package/dist/Order.d.ts.map +1 -1
- package/dist/Order.js +19 -14
- package/dist/Order.js.map +1 -1
- package/dist/PartitionedSemaphore.d.ts +183 -0
- package/dist/PartitionedSemaphore.d.ts.map +1 -0
- package/dist/PartitionedSemaphore.js +231 -0
- package/dist/PartitionedSemaphore.js.map +1 -0
- package/dist/Path.d.ts +2 -2
- package/dist/Path.d.ts.map +1 -1
- package/dist/Path.js +2 -2
- package/dist/Path.js.map +1 -1
- package/dist/PlatformError.d.ts +2 -2
- package/dist/Pool.d.ts +1 -1
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +5 -5
- package/dist/Pool.js.map +1 -1
- package/dist/Predicate.d.ts +1 -1
- package/dist/Predicate.d.ts.map +1 -1
- package/dist/PubSub.d.ts +5 -4
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +15 -8
- package/dist/PubSub.js.map +1 -1
- package/dist/Pull.d.ts.map +1 -1
- package/dist/Pull.js +1 -1
- package/dist/Pull.js.map +1 -1
- package/dist/Queue.d.ts +9 -6
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +7 -5
- package/dist/Queue.js.map +1 -1
- package/dist/Random.d.ts +36 -2
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +46 -35
- package/dist/Random.js.map +1 -1
- package/dist/RcMap.d.ts +4 -4
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +13 -13
- package/dist/RcMap.js.map +1 -1
- package/dist/RcRef.d.ts +1 -1
- package/dist/RcRef.d.ts.map +1 -1
- package/dist/Record.d.ts +63 -160
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +37 -56
- package/dist/Record.js.map +1 -1
- package/dist/Redactable.d.ts +139 -62
- package/dist/Redactable.d.ts.map +1 -1
- package/dist/Redactable.js +59 -55
- package/dist/Redactable.js.map +1 -1
- package/dist/Reducer.d.ts +166 -7
- package/dist/Reducer.d.ts.map +1 -1
- package/dist/Reducer.js +135 -1
- package/dist/Reducer.js.map +1 -1
- package/dist/References.d.ts +257 -229
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +240 -259
- package/dist/References.js.map +1 -1
- package/dist/Request.d.ts +5 -5
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js.map +1 -1
- package/dist/RequestResolver.d.ts +25 -25
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +15 -16
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Resource.d.ts +0 -3
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +5 -4
- package/dist/Resource.js.map +1 -1
- package/dist/Result.d.ts +1 -1
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +1 -2
- package/dist/Result.js.map +1 -1
- package/dist/Runtime.d.ts +66 -0
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +79 -6
- package/dist/Runtime.js.map +1 -1
- package/dist/Schedule.d.ts +174 -291
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +132 -120
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts +36 -125
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +37 -126
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +3213 -392
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +2058 -252
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +13 -2
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +340 -257
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +55 -13
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +73 -11
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js +29 -11
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.d.ts +44 -54
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +69 -4
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +2 -2
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +63 -39
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +245 -3
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +297 -33
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/Scope.d.ts +2 -2
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.d.ts +2 -2
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedCache.js +5 -5
- package/dist/ScopedCache.js.map +1 -1
- package/dist/Semaphore.d.ts +148 -52
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js +135 -117
- package/dist/Semaphore.js.map +1 -1
- package/dist/Sink.d.ts +22 -19
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +54 -7
- package/dist/Sink.js.map +1 -1
- package/dist/Stdio.d.ts +18 -6
- package/dist/Stdio.d.ts.map +1 -1
- package/dist/Stdio.js +20 -2
- package/dist/Stdio.js.map +1 -1
- package/dist/Stream.d.ts +465 -542
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +329 -145
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +114 -47
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +29 -47
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts +7 -7
- package/dist/Struct.d.ts.map +1 -1
- package/dist/SubscriptionRef.d.ts +1 -2
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +83 -116
- package/dist/SubscriptionRef.js.map +1 -1
- package/dist/Terminal.d.ts +5 -4
- package/dist/Terminal.d.ts.map +1 -1
- package/dist/Terminal.js +2 -2
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +21 -20
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +13 -9
- package/dist/Tracer.js.map +1 -1
- package/dist/Trie.d.ts +44 -31
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js +13 -9
- package/dist/Trie.js.map +1 -1
- package/dist/TxChunk.d.ts +4 -4
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxChunk.js +4 -4
- package/dist/TxChunk.js.map +1 -1
- package/dist/TxDeferred.d.ts +328 -0
- package/dist/TxDeferred.d.ts.map +1 -0
- package/dist/TxDeferred.js +197 -0
- package/dist/TxDeferred.js.map +1 -0
- package/dist/TxHashMap.d.ts +105 -86
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +51 -44
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxHashSet.d.ts +2 -2
- package/dist/TxHashSet.d.ts.map +1 -1
- package/dist/TxHashSet.js +16 -15
- package/dist/TxHashSet.js.map +1 -1
- package/dist/TxPriorityQueue.d.ts +609 -0
- package/dist/TxPriorityQueue.d.ts.map +1 -0
- package/dist/TxPriorityQueue.js +416 -0
- package/dist/TxPriorityQueue.js.map +1 -0
- package/dist/TxPubSub.d.ts +585 -0
- package/dist/TxPubSub.d.ts.map +1 -0
- package/dist/TxPubSub.js +521 -0
- package/dist/TxPubSub.js.map +1 -0
- package/dist/TxQueue.d.ts +1 -1
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxQueue.js +42 -57
- package/dist/TxQueue.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +500 -0
- package/dist/TxReentrantLock.d.ts.map +1 -0
- package/dist/TxReentrantLock.js +481 -0
- package/dist/TxReentrantLock.js.map +1 -0
- package/dist/TxRef.d.ts +14 -20
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +8 -10
- package/dist/TxRef.js.map +1 -1
- package/dist/TxSemaphore.d.ts +162 -2
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +25 -10
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/TxSubscriptionRef.d.ts +508 -0
- package/dist/TxSubscriptionRef.d.ts.map +1 -0
- package/dist/TxSubscriptionRef.js +293 -0
- package/dist/TxSubscriptionRef.js.map +1 -0
- package/dist/Types.d.ts +80 -22
- package/dist/Types.d.ts.map +1 -1
- package/dist/Unify.d.ts +8 -2
- package/dist/Unify.d.ts.map +1 -1
- package/dist/Unify.js.map +1 -1
- package/dist/Utils.d.ts +137 -65
- package/dist/Utils.d.ts.map +1 -1
- package/dist/Utils.js +38 -66
- package/dist/Utils.js.map +1 -1
- package/dist/index.d.ts +886 -71
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +886 -71
- package/dist/index.js.map +1 -1
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/dateTime.js +77 -71
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/effect.js +502 -326
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/hashMap.js +7 -5
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/layer.js +3 -3
- package/dist/internal/layer.js.map +1 -1
- package/dist/internal/option.js +6 -0
- package/dist/internal/option.js.map +1 -1
- package/dist/internal/random.d.ts +2 -0
- package/dist/internal/random.d.ts.map +1 -0
- package/dist/internal/random.js +13 -0
- package/dist/internal/random.js.map +1 -0
- package/dist/internal/rcRef.js +9 -9
- package/dist/internal/rcRef.js.map +1 -1
- package/dist/internal/references.d.ts +2 -0
- package/dist/internal/references.d.ts.map +1 -0
- package/dist/internal/references.js +51 -0
- package/dist/internal/references.js.map +1 -0
- package/dist/internal/request.js +6 -6
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/schedule.js +1 -1
- package/dist/internal/schedule.js.map +1 -1
- package/dist/internal/schema/annotations.js +2 -0
- package/dist/internal/schema/annotations.js.map +1 -1
- package/dist/internal/schema/representation.js +87 -109
- package/dist/internal/schema/representation.js.map +1 -1
- package/dist/internal/schema/schema.d.ts +10 -1
- package/dist/internal/schema/schema.d.ts.map +1 -1
- package/dist/internal/schema/schema.js +59 -1
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/internal/trie.js +8 -7
- package/dist/internal/trie.js.map +1 -1
- package/dist/testing/TestClock.d.ts +5 -5
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestClock.js +2 -2
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +267 -33
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/testing/TestSchema.js +296 -23
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/testing/index.d.ts +64 -1
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +64 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +127 -45
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +29 -23
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +9 -2
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +39 -11
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +40 -47
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.d.ts +130 -0
- package/dist/unstable/ai/EmbeddingModel.d.ts.map +1 -0
- package/dist/unstable/ai/EmbeddingModel.js +127 -0
- package/dist/unstable/ai/EmbeddingModel.js.map +1 -0
- package/dist/unstable/ai/IdGenerator.d.ts +2 -2
- package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
- package/dist/unstable/ai/IdGenerator.js +2 -2
- package/dist/unstable/ai/IdGenerator.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +119 -49
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +260 -61
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +207 -112
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +71 -19
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +68 -15
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +225 -73
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Model.d.ts +27 -9
- package/dist/unstable/ai/Model.d.ts.map +1 -1
- package/dist/unstable/ai/Model.js +25 -9
- package/dist/unstable/ai/Model.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +9 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Prompt.d.ts +17 -17
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Prompt.js +6 -9
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +24 -24
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js +7 -8
- package/dist/unstable/ai/Response.js.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.d.ts +38 -0
- package/dist/unstable/ai/ResponseIdTracker.d.ts.map +1 -0
- package/dist/unstable/ai/ResponseIdTracker.js +68 -0
- package/dist/unstable/ai/ResponseIdTracker.js.map +1 -0
- package/dist/unstable/ai/Telemetry.d.ts +35 -2
- package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
- package/dist/unstable/ai/Telemetry.js +2 -2
- package/dist/unstable/ai/Telemetry.js.map +1 -1
- package/dist/unstable/ai/Tokenizer.d.ts +2 -2
- package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
- package/dist/unstable/ai/Tokenizer.js +2 -2
- package/dist/unstable/ai/Tokenizer.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +46 -16
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +68 -22
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +4 -4
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +14 -21
- package/dist/unstable/ai/Toolkit.js.map +1 -1
- package/dist/unstable/ai/index.d.ts +22 -1
- package/dist/unstable/ai/index.d.ts.map +1 -1
- package/dist/unstable/ai/index.js +22 -1
- package/dist/unstable/ai/index.js.map +1 -1
- package/dist/unstable/ai/internal/codec-transformer.js +5 -7
- package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
- package/dist/unstable/cli/Argument.d.ts +4 -7
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js +1 -3
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +51 -63
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +32 -57
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/CliOutput.d.ts +5 -4
- package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
- package/dist/unstable/cli/CliOutput.js +67 -12
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +372 -59
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +328 -66
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Completions.d.ts +97 -0
- package/dist/unstable/cli/Completions.d.ts.map +1 -0
- package/dist/unstable/cli/Completions.js +25 -0
- package/dist/unstable/cli/Completions.js.map +1 -0
- package/dist/unstable/cli/Flag.d.ts +4 -5
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +1 -1
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +125 -0
- package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -0
- package/dist/unstable/cli/GlobalFlag.js +118 -0
- package/dist/unstable/cli/GlobalFlag.js.map +1 -0
- package/dist/unstable/cli/HelpDoc.d.ts +81 -11
- package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
- package/dist/unstable/cli/Param.d.ts +34 -6
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +24 -14
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +2 -2
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js +1 -1
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/Prompt.js +266 -86
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/index.d.ts +10 -0
- package/dist/unstable/cli/index.d.ts.map +1 -1
- package/dist/unstable/cli/index.js +10 -0
- package/dist/unstable/cli/index.js.map +1 -1
- package/dist/unstable/cli/internal/command.d.ts +41 -15
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +84 -47
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/completions/bash.js.map +1 -1
- package/dist/unstable/cli/internal/completions/descriptor.d.ts +2 -0
- package/dist/unstable/cli/internal/completions/descriptor.d.ts.map +1 -0
- package/dist/unstable/cli/internal/completions/{CommandDescriptor.js → descriptor.js} +17 -5
- package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -0
- package/dist/unstable/cli/internal/completions/fish.js.map +1 -1
- package/dist/unstable/cli/internal/completions/zsh.js.map +1 -1
- package/dist/unstable/cli/internal/config.js +42 -0
- package/dist/unstable/cli/internal/config.js.map +1 -1
- package/dist/unstable/cli/internal/help.d.ts +33 -0
- package/dist/unstable/cli/internal/help.d.ts.map +1 -0
- package/dist/unstable/cli/internal/help.js +125 -0
- package/dist/unstable/cli/internal/help.js.map +1 -0
- package/dist/unstable/cli/internal/parser.js +155 -58
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cluster/ClusterCron.d.ts +1 -1
- package/dist/unstable/cluster/ClusterCron.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterCron.js +1 -1
- package/dist/unstable/cluster/ClusterCron.js.map +1 -1
- package/dist/unstable/cluster/ClusterError.d.ts +7 -7
- package/dist/unstable/cluster/ClusterSchema.d.ts +28 -7
- package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.js +28 -8
- package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +4 -2
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +96 -63
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/DeliverAt.js +1 -1
- package/dist/unstable/cluster/DeliverAt.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +17 -16
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +31 -25
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/EntityAddress.d.ts +2 -2
- package/dist/unstable/cluster/EntityAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityAddress.js +1 -1
- package/dist/unstable/cluster/EntityAddress.js.map +1 -1
- package/dist/unstable/cluster/EntityProxy.js +3 -3
- package/dist/unstable/cluster/EntityProxy.js.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.js +6 -6
- package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
- package/dist/unstable/cluster/EntityResource.d.ts +4 -4
- package/dist/unstable/cluster/EntityResource.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityResource.js +2 -2
- package/dist/unstable/cluster/EntityResource.js.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts +3 -3
- package/dist/unstable/cluster/HttpRunner.js +2 -2
- package/dist/unstable/cluster/HttpRunner.js.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.d.ts +5 -5
- package/dist/unstable/cluster/K8sHttpClient.d.ts.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.js +7 -7
- package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +16 -10
- package/dist/unstable/cluster/Message.d.ts.map +1 -1
- package/dist/unstable/cluster/Message.js +16 -8
- package/dist/unstable/cluster/Message.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +46 -23
- package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/MessageStorage.js +40 -25
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts +7 -6
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +8 -7
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/Runner.d.ts +1 -1
- package/dist/unstable/cluster/Runner.d.ts.map +1 -1
- package/dist/unstable/cluster/Runner.js +1 -1
- package/dist/unstable/cluster/Runner.js.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.d.ts +1 -1
- package/dist/unstable/cluster/RunnerAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.js +1 -1
- package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.d.ts +2 -2
- package/dist/unstable/cluster/RunnerHealth.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.js +2 -2
- package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +10 -9
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.d.ts +12 -12
- package/dist/unstable/cluster/RunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.js +3 -3
- package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +5 -4
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +16 -14
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/ShardId.d.ts +35 -49
- package/dist/unstable/cluster/ShardId.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardId.js +65 -67
- package/dist/unstable/cluster/ShardId.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts +4 -4
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +59 -49
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +28 -27
- package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.js +27 -27
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/SingletonAddress.d.ts +2 -2
- package/dist/unstable/cluster/Snowflake.d.ts +2 -2
- package/dist/unstable/cluster/Snowflake.d.ts.map +1 -1
- package/dist/unstable/cluster/Snowflake.js +2 -2
- package/dist/unstable/cluster/Snowflake.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +24 -20
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js +7 -7
- package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +30 -24
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/cluster/internal/entityReaper.js +2 -2
- package/dist/unstable/cluster/internal/entityReaper.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceMap.js +3 -3
- package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.d.ts +2 -2
- package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.js +9 -8
- package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.d.ts +4 -4
- package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js +9 -2
- package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
- package/dist/unstable/encoding/Msgpack.d.ts +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts +9 -9
- package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
- package/dist/unstable/encoding/Ndjson.js.map +1 -1
- package/dist/unstable/encoding/Sse.d.ts +3 -3
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.js +1 -1
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/eventlog/Event.d.ts +0 -6
- package/dist/unstable/eventlog/Event.d.ts.map +1 -1
- package/dist/unstable/eventlog/Event.js +0 -5
- package/dist/unstable/eventlog/Event.js.map +1 -1
- package/dist/unstable/eventlog/EventGroup.d.ts +0 -2
- package/dist/unstable/eventlog/EventGroup.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventGroup.js +0 -2
- package/dist/unstable/eventlog/EventGroup.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +27 -10
- package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventJournal.js +130 -71
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts +94 -37
- package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLog.js +225 -151
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.d.ts +11 -9
- package/dist/unstable/eventlog/EventLogEncryption.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js +15 -17
- package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +228 -0
- package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -0
- package/dist/unstable/eventlog/EventLogMessage.js +214 -0
- package/dist/unstable/eventlog/EventLogMessage.js.map +1 -0
- package/dist/unstable/eventlog/EventLogRemote.d.ts +112 -194
- package/dist/unstable/eventlog/EventLogRemote.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.js +168 -322
- package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.d.ts +26 -48
- package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.js +128 -199
- package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +60 -0
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -0
- package/dist/unstable/eventlog/EventLogServerEncrypted.js +166 -0
- package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -0
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +183 -0
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -0
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js +461 -0
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -0
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +117 -0
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts.map +1 -0
- package/dist/unstable/eventlog/EventLogSessionAuth.js +284 -0
- package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -0
- package/dist/unstable/eventlog/{SqlEventLogJournal.d.ts → SqlEventJournal.d.ts} +2 -2
- package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -0
- package/dist/unstable/eventlog/{SqlEventLogJournal.js → SqlEventJournal.js} +28 -21
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -0
- package/dist/unstable/eventlog/{SqlEventLogServer.d.ts → SqlEventLogServerEncrypted.d.ts} +5 -5
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts.map +1 -0
- package/dist/unstable/eventlog/{SqlEventLogServer.js → SqlEventLogServerEncrypted.js} +69 -27
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -0
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts +25 -0
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -0
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +355 -0
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -0
- package/dist/unstable/eventlog/index.d.ts +22 -2
- package/dist/unstable/eventlog/index.d.ts.map +1 -1
- package/dist/unstable/eventlog/index.js +22 -2
- package/dist/unstable/eventlog/index.js.map +1 -1
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.d.ts +2 -0
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.d.ts.map +1 -0
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js +89 -0
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js.map +1 -0
- package/dist/unstable/http/Cookies.d.ts +51 -6
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +27 -6
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Etag.d.ts +2 -2
- package/dist/unstable/http/Etag.d.ts.map +1 -1
- package/dist/unstable/http/Etag.js +7 -3
- package/dist/unstable/http/Etag.js.map +1 -1
- package/dist/unstable/http/FetchHttpClient.d.ts +6 -3
- package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/unstable/http/FetchHttpClient.js +5 -5
- package/dist/unstable/http/FetchHttpClient.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts +24 -4
- package/dist/unstable/http/Headers.d.ts.map +1 -1
- package/dist/unstable/http/Headers.js +42 -13
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpBody.d.ts +1 -1
- package/dist/unstable/http/HttpClient.d.ts +125 -21
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +197 -19
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientError.d.ts +8 -8
- package/dist/unstable/http/HttpClientRequest.d.ts +43 -15
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +131 -21
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts +2 -1
- package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientResponse.js +18 -3
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts +13 -11
- package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
- package/dist/unstable/http/HttpEffect.js +51 -51
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.d.ts +5 -4
- package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js +6 -10
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMethod.d.ts +4 -4
- package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
- package/dist/unstable/http/HttpMethod.js +3 -3
- package/dist/unstable/http/HttpMethod.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts +4 -9
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +47 -43
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpPlatform.d.ts +2 -2
- package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
- package/dist/unstable/http/HttpPlatform.js +5 -4
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +9 -8
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +36 -36
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServer.d.ts +2 -2
- package/dist/unstable/http/HttpServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpServer.js +4 -4
- package/dist/unstable/http/HttpServer.js.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +22 -34
- package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerError.js +39 -45
- package/dist/unstable/http/HttpServerError.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +19 -7
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +307 -13
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.d.ts +2 -2
- package/dist/unstable/http/HttpServerRespondable.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.js +5 -5
- package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +52 -5
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +240 -5
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpStaticServer.d.ts +69 -0
- package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -0
- package/dist/unstable/http/HttpStaticServer.js +353 -0
- package/dist/unstable/http/HttpStaticServer.js.map +1 -0
- package/dist/unstable/http/HttpTraceContext.d.ts +3 -2
- package/dist/unstable/http/HttpTraceContext.d.ts.map +1 -1
- package/dist/unstable/http/HttpTraceContext.js +27 -15
- package/dist/unstable/http/HttpTraceContext.js.map +1 -1
- package/dist/unstable/http/Multipart.d.ts +7 -7
- package/dist/unstable/http/Multipart.d.ts.map +1 -1
- package/dist/unstable/http/Multipart.js +7 -7
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/Url.d.ts +604 -0
- package/dist/unstable/http/Url.d.ts.map +1 -0
- package/dist/unstable/http/Url.js +256 -0
- package/dist/unstable/http/Url.js.map +1 -0
- package/dist/unstable/http/UrlParams.d.ts +18 -9
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +6 -7
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/http/index.d.ts +8 -0
- package/dist/unstable/http/index.d.ts.map +1 -1
- package/dist/unstable/http/index.js +8 -0
- package/dist/unstable/http/index.js.map +1 -1
- package/dist/unstable/http/internal/preResponseHandler.d.ts +2 -0
- package/dist/unstable/http/internal/preResponseHandler.d.ts.map +1 -0
- package/dist/unstable/http/internal/preResponseHandler.js +10 -0
- package/dist/unstable/http/internal/preResponseHandler.js.map +1 -0
- package/dist/unstable/httpapi/HttpApi.d.ts +11 -11
- package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js +8 -8
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +12 -9
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +73 -48
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +82 -7
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +79 -11
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +210 -105
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.js +52 -47
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +66 -29
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.js +138 -32
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.d.ts +9 -8
- package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.js +4 -4
- package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +49 -17
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js +38 -8
- package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +88 -9
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.js +86 -11
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts +9 -6
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.js +6 -6
- package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts +17 -25
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +59 -60
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/observability/Otlp.d.ts +12 -12
- package/dist/unstable/observability/Otlp.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts +2 -2
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +8 -8
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.d.ts +4 -4
- package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js +7 -4
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts +4 -4
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.js +2 -2
- package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.d.ts +2 -2
- package/dist/unstable/observability/OtlpSerialization.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.js +2 -2
- package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.d.ts +4 -4
- package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js +7 -3
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.d.ts +3 -3
- package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.js +4 -33
- package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
- package/dist/unstable/observability/internal/protobuf.js +4 -4
- package/dist/unstable/observability/internal/protobuf.js.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +24 -3
- package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.js +144 -2
- package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
- package/dist/unstable/persistence/Persistable.d.ts +2 -2
- package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistable.js +1 -1
- package/dist/unstable/persistence/Persistable.js.map +1 -1
- package/dist/unstable/persistence/PersistedCache.d.ts +1 -2
- package/dist/unstable/persistence/PersistedCache.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedCache.js +10 -11
- package/dist/unstable/persistence/PersistedCache.js.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts +16 -16
- package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.js +9 -9
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/Persistence.d.ts +5 -5
- package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistence.js +5 -5
- package/dist/unstable/persistence/Persistence.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +9 -9
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +4 -4
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/persistence/Redis.d.ts +3 -3
- package/dist/unstable/persistence/Redis.d.ts.map +1 -1
- package/dist/unstable/persistence/Redis.js +2 -2
- package/dist/unstable/persistence/Redis.js.map +1 -1
- package/dist/unstable/process/ChildProcess.d.ts +5 -128
- package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcess.js +1 -65
- package/dist/unstable/process/ChildProcess.js.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.d.ts +83 -8
- package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js +22 -2
- package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.d.ts +37 -17
- package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.js +9 -0
- package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +108 -47
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +105 -25
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +25 -20
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.js +58 -26
- package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.d.ts +8 -2
- package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +57 -14
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts +12 -12
- package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.js +59 -31
- package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
- package/dist/unstable/reactivity/Reactivity.d.ts +2 -2
- package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
- package/dist/unstable/reactivity/Reactivity.js +6 -6
- package/dist/unstable/reactivity/Reactivity.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +137 -19
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js +99 -7
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts +26 -47
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +117 -75
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcClientError.d.ts +2 -2
- package/dist/unstable/rpc/RpcGroup.d.ts +15 -11
- package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcGroup.js +30 -20
- package/dist/unstable/rpc/RpcGroup.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts +12 -12
- package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js +5 -5
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts +14 -1
- package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSchema.js +17 -2
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts +13 -2
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +60 -27
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +8 -12
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +73 -43
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/rpc/RpcWorker.d.ts +2 -2
- package/dist/unstable/rpc/RpcWorker.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcWorker.js +4 -4
- package/dist/unstable/rpc/RpcWorker.js.map +1 -1
- package/dist/unstable/rpc/Utils.d.ts +6 -3
- package/dist/unstable/rpc/Utils.d.ts.map +1 -1
- package/dist/unstable/rpc/Utils.js +46 -5
- package/dist/unstable/rpc/Utils.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts +24 -3
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js +17 -4
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +7 -7
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.js +7 -18
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +35 -15
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +34 -27
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/socket/SocketServer.d.ts +8 -5
- package/dist/unstable/socket/SocketServer.d.ts.map +1 -1
- package/dist/unstable/socket/SocketServer.js +2 -2
- package/dist/unstable/socket/SocketServer.js.map +1 -1
- package/dist/unstable/sql/Migrator.d.ts +1 -1
- package/dist/unstable/sql/Migrator.d.ts.map +1 -1
- package/dist/unstable/sql/Migrator.js +2 -2
- package/dist/unstable/sql/Migrator.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts +24 -6
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +37 -32
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/sql/SqlConnection.d.ts +2 -2
- package/dist/unstable/sql/SqlConnection.d.ts.map +1 -1
- package/dist/unstable/sql/SqlConnection.js +5 -2
- package/dist/unstable/sql/SqlConnection.js.map +1 -1
- package/dist/unstable/sql/SqlError.d.ts +237 -17
- package/dist/unstable/sql/SqlError.d.ts.map +1 -1
- package/dist/unstable/sql/SqlError.js +260 -4
- package/dist/unstable/sql/SqlError.js.map +1 -1
- package/dist/unstable/sql/SqlModel.d.ts +8 -9
- package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
- package/dist/unstable/sql/SqlModel.js +12 -38
- package/dist/unstable/sql/SqlModel.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.js +24 -17
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/sql/SqlSchema.d.ts +17 -6
- package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
- package/dist/unstable/sql/SqlSchema.js +17 -7
- package/dist/unstable/sql/SqlSchema.js.map +1 -1
- package/dist/unstable/sql/Statement.d.ts +3 -5
- package/dist/unstable/sql/Statement.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.js +14 -13
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/workers/Transferable.d.ts +4 -4
- package/dist/unstable/workers/Transferable.d.ts.map +1 -1
- package/dist/unstable/workers/Transferable.js +7 -7
- package/dist/unstable/workers/Transferable.js.map +1 -1
- package/dist/unstable/workers/Worker.d.ts +3 -3
- package/dist/unstable/workers/Worker.d.ts.map +1 -1
- package/dist/unstable/workers/Worker.js +6 -3
- package/dist/unstable/workers/Worker.js.map +1 -1
- package/dist/unstable/workers/WorkerError.d.ts +5 -5
- package/dist/unstable/workers/WorkerRunner.d.ts +2 -2
- package/dist/unstable/workers/WorkerRunner.d.ts.map +1 -1
- package/dist/unstable/workers/WorkerRunner.js +5 -2
- package/dist/unstable/workers/WorkerRunner.js.map +1 -1
- package/dist/unstable/workflow/Activity.d.ts +8 -3
- package/dist/unstable/workflow/Activity.d.ts.map +1 -1
- package/dist/unstable/workflow/Activity.js +25 -11
- package/dist/unstable/workflow/Activity.js.map +1 -1
- package/dist/unstable/workflow/DurableClock.d.ts +3 -6
- package/dist/unstable/workflow/DurableClock.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableClock.js +6 -6
- package/dist/unstable/workflow/DurableClock.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts +2 -5
- package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.js +33 -15
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +12 -14
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js +30 -26
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +24 -7
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +165 -16
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.js +4 -4
- package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
- package/package.json +11 -10
- package/src/Array.ts +304 -447
- package/src/BigDecimal.ts +137 -82
- package/src/BigInt.ts +53 -45
- package/src/Brand.ts +3 -5
- package/src/Cache.ts +27 -54
- package/src/Cause.ts +57 -22
- package/src/Channel.ts +687 -220
- package/src/Chunk.ts +149 -331
- package/src/Clock.ts +2 -2
- package/src/Combiner.ts +280 -13
- package/src/Config.ts +214 -52
- package/src/ConfigProvider.ts +5 -5
- package/src/Console.ts +2 -2
- package/src/Context.ts +1454 -0
- package/src/Cron.ts +155 -63
- package/src/Data.ts +530 -368
- package/src/DateTime.ts +77 -258
- package/src/Deferred.ts +15 -6
- package/src/Duration.ts +151 -81
- package/src/Effect.ts +1633 -1055
- package/src/Effectable.ts +47 -0
- package/src/Equal.ts +293 -109
- package/src/Equivalence.ts +114 -52
- package/src/ErrorReporter.ts +458 -0
- package/src/ExecutionPlan.ts +8 -9
- package/src/Exit.ts +24 -12
- package/src/Fiber.ts +17 -8
- package/src/FiberHandle.ts +15 -14
- package/src/FiberMap.ts +27 -27
- package/src/FiberSet.ts +5 -5
- package/src/FileSystem.ts +30 -26
- package/src/Filter.ts +4 -62
- package/src/Formatter.ts +268 -60
- package/src/Function.ts +2 -10
- package/src/Graph.ts +123 -112
- package/src/Hash.ts +2 -2
- package/src/HashMap.ts +26 -19
- package/src/Inspectable.ts +2 -22
- package/src/Iterable.ts +117 -63
- package/src/JsonSchema.ts +383 -10
- package/src/Latch.ts +85 -3
- package/src/Layer.ts +728 -441
- package/src/LayerMap.ts +38 -35
- package/src/LogLevel.ts +37 -0
- package/src/Logger.ts +35 -102
- package/src/ManagedRuntime.ts +61 -48
- package/src/Metric.ts +64 -66
- package/src/MutableHashMap.ts +9 -0
- package/src/MutableHashSet.ts +9 -0
- package/src/MutableList.ts +3 -0
- package/src/Newtype.ts +308 -0
- package/src/Number.ts +98 -29
- package/src/Optic.ts +948 -19
- package/src/Option.ts +34 -24
- package/src/Order.ts +39 -32
- package/src/PartitionedSemaphore.ts +414 -0
- package/src/Path.ts +2 -2
- package/src/Pool.ts +9 -9
- package/src/Predicate.ts +1 -1
- package/src/PubSub.ts +20 -11
- package/src/Pull.ts +1 -1
- package/src/Queue.ts +11 -9
- package/src/Random.ts +51 -14
- package/src/RcMap.ts +19 -19
- package/src/RcRef.ts +1 -1
- package/src/Record.ts +94 -199
- package/src/Redactable.ts +146 -72
- package/src/Reducer.ts +166 -7
- package/src/References.ts +283 -287
- package/src/Request.ts +5 -5
- package/src/RequestResolver.ts +34 -35
- package/src/Resource.ts +6 -5
- package/src/Result.ts +2 -4
- package/src/Runtime.ts +102 -6
- package/src/Schedule.ts +243 -336
- package/src/Scheduler.ts +52 -129
- package/src/Schema.ts +3769 -597
- package/src/SchemaAST.ts +480 -302
- package/src/SchemaGetter.ts +80 -24
- package/src/SchemaIssue.ts +28 -15
- package/src/SchemaParser.ts +100 -29
- package/src/SchemaRepresentation.ts +57 -33
- package/src/SchemaTransformation.ts +321 -32
- package/src/Scope.ts +2 -2
- package/src/ScopedCache.ts +8 -8
- package/src/Semaphore.ts +268 -182
- package/src/Sink.ts +89 -34
- package/src/Stdio.ts +29 -6
- package/src/Stream.ts +908 -752
- package/src/String.ts +122 -69
- package/src/Struct.ts +7 -7
- package/src/SubscriptionRef.ts +98 -118
- package/src/Terminal.ts +5 -4
- package/src/Tracer.ts +23 -22
- package/src/Trie.ts +44 -31
- package/src/TxChunk.ts +26 -16
- package/src/TxDeferred.ts +391 -0
- package/src/TxHashMap.ts +347 -291
- package/src/TxHashSet.ts +54 -61
- package/src/TxPriorityQueue.ts +762 -0
- package/src/TxPubSub.ts +787 -0
- package/src/TxQueue.ts +221 -245
- package/src/TxReentrantLock.ts +729 -0
- package/src/TxRef.ts +31 -31
- package/src/TxSemaphore.ts +203 -31
- package/src/TxSubscriptionRef.ts +637 -0
- package/src/Types.ts +75 -23
- package/src/Unify.ts +26 -2
- package/src/Utils.ts +137 -111
- package/src/index.ts +896 -73
- package/src/internal/core.ts +9 -10
- package/src/internal/dateTime.ts +91 -96
- package/src/internal/effect.ts +1179 -614
- package/src/internal/hashMap.ts +12 -10
- package/src/internal/layer.ts +7 -7
- package/src/internal/option.ts +7 -0
- package/src/internal/random.ts +20 -0
- package/src/internal/rcRef.ts +12 -12
- package/src/internal/references.ts +72 -0
- package/src/internal/request.ts +8 -8
- package/src/internal/schedule.ts +3 -1
- package/src/internal/schema/annotations.ts +2 -0
- package/src/internal/schema/representation.ts +82 -97
- package/src/internal/schema/schema.ts +68 -1
- package/src/internal/trie.ts +21 -15
- package/src/testing/TestClock.ts +6 -6
- package/src/testing/TestSchema.ts +333 -36
- package/src/testing/index.ts +64 -1
- package/src/unstable/ai/AiError.ts +111 -53
- package/src/unstable/ai/AnthropicStructuredOutput.ts +7 -3
- package/src/unstable/ai/Chat.ts +136 -88
- package/src/unstable/ai/EmbeddingModel.ts +209 -0
- package/src/unstable/ai/IdGenerator.ts +2 -2
- package/src/unstable/ai/LanguageModel.ts +685 -255
- package/src/unstable/ai/McpSchema.ts +84 -22
- package/src/unstable/ai/McpServer.ts +307 -87
- package/src/unstable/ai/Model.ts +44 -13
- package/src/unstable/ai/OpenAiStructuredOutput.ts +9 -2
- package/src/unstable/ai/Prompt.ts +23 -29
- package/src/unstable/ai/Response.ts +29 -31
- package/src/unstable/ai/ResponseIdTracker.ts +95 -0
- package/src/unstable/ai/Telemetry.ts +2 -2
- package/src/unstable/ai/Tokenizer.ts +2 -2
- package/src/unstable/ai/Tool.ts +62 -36
- package/src/unstable/ai/Toolkit.ts +17 -26
- package/src/unstable/ai/index.ts +24 -1
- package/src/unstable/ai/internal/codec-transformer.ts +3 -9
- package/src/unstable/cli/Argument.ts +5 -8
- package/src/unstable/cli/CliError.ts +67 -66
- package/src/unstable/cli/CliOutput.ts +87 -15
- package/src/unstable/cli/Command.ts +808 -193
- package/src/unstable/cli/Completions.ts +107 -0
- package/src/unstable/cli/Flag.ts +5 -6
- package/src/unstable/cli/GlobalFlag.ts +242 -0
- package/src/unstable/cli/HelpDoc.ts +91 -11
- package/src/unstable/cli/Param.ts +54 -27
- package/src/unstable/cli/Primitive.ts +2 -2
- package/src/unstable/cli/Prompt.ts +275 -104
- package/src/unstable/cli/index.ts +12 -0
- package/src/unstable/cli/internal/command.ts +125 -64
- package/src/unstable/cli/internal/completions/bash.ts +7 -7
- package/src/unstable/cli/internal/completions/{CommandDescriptor.ts → descriptor.ts} +16 -58
- package/src/unstable/cli/internal/completions/fish.ts +7 -7
- package/src/unstable/cli/internal/completions/zsh.ts +8 -14
- package/src/unstable/cli/internal/config.ts +49 -0
- package/src/unstable/cli/internal/help.ts +171 -0
- package/src/unstable/cli/internal/parser.ts +201 -84
- package/src/unstable/cluster/ClusterCron.ts +2 -2
- package/src/unstable/cluster/ClusterSchema.ts +38 -10
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +142 -80
- package/src/unstable/cluster/DeliverAt.ts +1 -1
- package/src/unstable/cluster/Entity.ts +58 -45
- package/src/unstable/cluster/EntityAddress.ts +1 -1
- package/src/unstable/cluster/EntityProxy.ts +3 -3
- package/src/unstable/cluster/EntityProxyServer.ts +6 -6
- package/src/unstable/cluster/EntityResource.ts +6 -6
- package/src/unstable/cluster/HttpRunner.ts +2 -2
- package/src/unstable/cluster/K8sHttpClient.ts +10 -10
- package/src/unstable/cluster/Message.ts +30 -17
- package/src/unstable/cluster/MessageStorage.ts +74 -45
- package/src/unstable/cluster/Reply.ts +13 -10
- package/src/unstable/cluster/Runner.ts +1 -1
- package/src/unstable/cluster/RunnerAddress.ts +1 -1
- package/src/unstable/cluster/RunnerHealth.ts +2 -2
- package/src/unstable/cluster/RunnerServer.ts +11 -14
- package/src/unstable/cluster/RunnerStorage.ts +9 -9
- package/src/unstable/cluster/Runners.ts +22 -18
- package/src/unstable/cluster/ShardId.ts +84 -74
- package/src/unstable/cluster/Sharding.ts +75 -60
- package/src/unstable/cluster/ShardingConfig.ts +39 -40
- package/src/unstable/cluster/Snowflake.ts +2 -2
- package/src/unstable/cluster/SqlMessageStorage.ts +29 -20
- package/src/unstable/cluster/SqlRunnerStorage.ts +13 -7
- package/src/unstable/cluster/internal/entityManager.ts +60 -41
- package/src/unstable/cluster/internal/entityReaper.ts +2 -2
- package/src/unstable/cluster/internal/resourceMap.ts +3 -3
- package/src/unstable/devtools/DevToolsClient.ts +26 -21
- package/src/unstable/devtools/DevToolsSchema.ts +16 -3
- package/src/unstable/encoding/Ndjson.ts +17 -17
- package/src/unstable/encoding/Sse.ts +3 -5
- package/src/unstable/eventlog/Event.ts +0 -8
- package/src/unstable/eventlog/EventGroup.ts +0 -4
- package/src/unstable/eventlog/EventJournal.ts +148 -80
- package/src/unstable/eventlog/EventLog.ts +360 -234
- package/src/unstable/eventlog/EventLogEncryption.ts +18 -32
- package/src/unstable/eventlog/EventLogMessage.ts +277 -0
- package/src/unstable/eventlog/EventLogRemote.ts +264 -410
- package/src/unstable/eventlog/EventLogServer.ts +183 -275
- package/src/unstable/eventlog/EventLogServerEncrypted.ts +206 -0
- package/src/unstable/eventlog/EventLogServerUnencrypted.ts +749 -0
- package/src/unstable/eventlog/EventLogSessionAuth.ts +437 -0
- package/src/unstable/eventlog/{SqlEventLogJournal.ts → SqlEventJournal.ts} +38 -22
- package/src/unstable/eventlog/{SqlEventLogServer.ts → SqlEventLogServerEncrypted.ts} +110 -43
- package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +506 -0
- package/src/unstable/eventlog/index.ts +27 -2
- package/src/unstable/eventlog/internal/identityRootSecretDerivation.ts +153 -0
- package/src/unstable/http/Cookies.ts +94 -11
- package/src/unstable/http/Etag.ts +7 -5
- package/src/unstable/http/FetchHttpClient.ts +5 -5
- package/src/unstable/http/Headers.ts +70 -20
- package/src/unstable/http/HttpClient.ts +385 -42
- package/src/unstable/http/HttpClientRequest.ts +151 -39
- package/src/unstable/http/HttpClientResponse.ts +24 -8
- package/src/unstable/http/HttpEffect.ts +71 -77
- package/src/unstable/http/HttpIncomingMessage.ts +9 -8
- package/src/unstable/http/HttpMethod.ts +16 -4
- package/src/unstable/http/HttpMiddleware.ts +50 -50
- package/src/unstable/http/HttpPlatform.ts +5 -4
- package/src/unstable/http/HttpRouter.ts +46 -46
- package/src/unstable/http/HttpServer.ts +5 -11
- package/src/unstable/http/HttpServerError.ts +45 -47
- package/src/unstable/http/HttpServerRequest.ts +414 -23
- package/src/unstable/http/HttpServerRespondable.ts +6 -6
- package/src/unstable/http/HttpServerResponse.ts +351 -13
- package/src/unstable/http/HttpStaticServer.ts +456 -0
- package/src/unstable/http/HttpTraceContext.ts +31 -17
- package/src/unstable/http/Multipart.ts +8 -8
- package/src/unstable/http/Url.ts +650 -0
- package/src/unstable/http/UrlParams.ts +30 -18
- package/src/unstable/http/index.ts +10 -0
- package/src/unstable/http/internal/preResponseHandler.ts +15 -0
- package/src/unstable/httpapi/HttpApi.ts +22 -22
- package/src/unstable/httpapi/HttpApiBuilder.ts +156 -66
- package/src/unstable/httpapi/HttpApiClient.ts +185 -34
- package/src/unstable/httpapi/HttpApiEndpoint.ts +225 -114
- package/src/unstable/httpapi/HttpApiError.ts +129 -30
- package/src/unstable/httpapi/HttpApiGroup.ts +18 -17
- package/src/unstable/httpapi/HttpApiMiddleware.ts +95 -32
- package/src/unstable/httpapi/HttpApiSchema.ts +106 -11
- package/src/unstable/httpapi/HttpApiSecurity.ts +13 -13
- package/src/unstable/httpapi/OpenApi.ts +74 -73
- package/src/unstable/observability/Otlp.ts +12 -12
- package/src/unstable/observability/OtlpExporter.ts +14 -10
- package/src/unstable/observability/OtlpLogger.ts +13 -9
- package/src/unstable/observability/OtlpMetrics.ts +6 -6
- package/src/unstable/observability/OtlpSerialization.ts +2 -2
- package/src/unstable/observability/OtlpTracer.ts +14 -10
- package/src/unstable/observability/PrometheusMetrics.ts +5 -5
- package/src/unstable/observability/internal/protobuf.ts +4 -4
- package/src/unstable/persistence/KeyValueStore.ts +226 -3
- package/src/unstable/persistence/Persistable.ts +3 -3
- package/src/unstable/persistence/PersistedCache.ts +20 -17
- package/src/unstable/persistence/PersistedQueue.ts +21 -21
- package/src/unstable/persistence/Persistence.ts +7 -7
- package/src/unstable/persistence/RateLimiter.ts +7 -7
- package/src/unstable/persistence/Redis.ts +2 -2
- package/src/unstable/process/ChildProcess.ts +6 -208
- package/src/unstable/process/ChildProcessSpawner.ts +114 -15
- package/src/unstable/reactivity/AsyncResult.ts +59 -17
- package/src/unstable/reactivity/Atom.ts +280 -124
- package/src/unstable/reactivity/AtomHttpApi.ts +127 -61
- package/src/unstable/reactivity/AtomRegistry.ts +70 -16
- package/src/unstable/reactivity/AtomRpc.ts +82 -37
- package/src/unstable/reactivity/Reactivity.ts +6 -6
- package/src/unstable/rpc/Rpc.ts +212 -32
- package/src/unstable/rpc/RpcClient.ts +161 -142
- package/src/unstable/rpc/RpcGroup.ts +51 -34
- package/src/unstable/rpc/RpcMiddleware.ts +28 -22
- package/src/unstable/rpc/RpcSchema.ts +24 -6
- package/src/unstable/rpc/RpcSerialization.ts +97 -54
- package/src/unstable/rpc/RpcServer.ts +91 -65
- package/src/unstable/rpc/RpcWorker.ts +5 -5
- package/src/unstable/rpc/Utils.ts +63 -4
- package/src/unstable/schema/Model.ts +35 -6
- package/src/unstable/schema/VariantSchema.ts +14 -27
- package/src/unstable/socket/Socket.ts +102 -62
- package/src/unstable/socket/SocketServer.ts +2 -2
- package/src/unstable/sql/Migrator.ts +7 -5
- package/src/unstable/sql/SqlClient.ts +48 -19
- package/src/unstable/sql/SqlConnection.ts +2 -2
- package/src/unstable/sql/SqlError.ts +365 -11
- package/src/unstable/sql/SqlModel.ts +57 -85
- package/src/unstable/sql/SqlResolver.ts +28 -20
- package/src/unstable/sql/SqlSchema.ts +42 -26
- package/src/unstable/sql/Statement.ts +21 -25
- package/src/unstable/workers/Transferable.ts +17 -19
- package/src/unstable/workers/Worker.ts +4 -4
- package/src/unstable/workers/WorkerRunner.ts +2 -2
- package/src/unstable/workflow/Activity.ts +36 -13
- package/src/unstable/workflow/DurableClock.ts +11 -11
- package/src/unstable/workflow/DurableDeferred.ts +36 -18
- package/src/unstable/workflow/Workflow.ts +46 -35
- package/src/unstable/workflow/WorkflowEngine.ts +236 -23
- package/src/unstable/workflow/WorkflowProxyServer.ts +4 -4
- package/dist/NullOr.d.ts +0 -149
- package/dist/NullOr.d.ts.map +0 -1
- package/dist/NullOr.js +0 -152
- package/dist/NullOr.js.map +0 -1
- package/dist/ServiceMap.d.ts +0 -1126
- package/dist/ServiceMap.d.ts.map +0 -1
- package/dist/ServiceMap.js.map +0 -1
- package/dist/internal/schema/to-codec.d.ts +0 -2
- package/dist/internal/schema/to-codec.d.ts.map +0 -1
- package/dist/internal/schema/to-codec.js +0 -129
- package/dist/internal/schema/to-codec.js.map +0 -1
- package/dist/unstable/cli/internal/builtInFlags.d.ts +0 -7
- package/dist/unstable/cli/internal/builtInFlags.d.ts.map +0 -1
- package/dist/unstable/cli/internal/builtInFlags.js +0 -44
- package/dist/unstable/cli/internal/builtInFlags.js.map +0 -1
- package/dist/unstable/cli/internal/completions/CommandDescriptor.d.ts +0 -2
- package/dist/unstable/cli/internal/completions/CommandDescriptor.d.ts.map +0 -1
- package/dist/unstable/cli/internal/completions/CommandDescriptor.js.map +0 -1
- package/dist/unstable/cli/internal/completions/Completions.d.ts +0 -2
- package/dist/unstable/cli/internal/completions/Completions.d.ts.map +0 -1
- package/dist/unstable/cli/internal/completions/Completions.js +0 -23
- package/dist/unstable/cli/internal/completions/Completions.js.map +0 -1
- package/dist/unstable/eventlog/SqlEventLogJournal.d.ts.map +0 -1
- package/dist/unstable/eventlog/SqlEventLogJournal.js.map +0 -1
- package/dist/unstable/eventlog/SqlEventLogServer.d.ts.map +0 -1
- package/dist/unstable/eventlog/SqlEventLogServer.js.map +0 -1
- package/src/NullOr.ts +0 -204
- package/src/ServiceMap.ts +0 -1410
- package/src/internal/schema/to-codec.ts +0 -148
- package/src/unstable/cli/internal/builtInFlags.ts +0 -78
- package/src/unstable/cli/internal/completions/Completions.ts +0 -31
package/dist/Effect.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as Context from "./Context.js";
|
|
1
2
|
import * as Duration from "./Duration.js";
|
|
2
3
|
import * as Exit from "./Exit.js";
|
|
3
4
|
import { constant, dual } from "./Function.js";
|
|
@@ -9,7 +10,6 @@ import * as internalRequest from "./internal/request.js";
|
|
|
9
10
|
import * as internalSchedule from "./internal/schedule.js";
|
|
10
11
|
import * as Metric from "./Metric.js";
|
|
11
12
|
import { CurrentLogAnnotations, CurrentLogSpans } from "./References.js";
|
|
12
|
-
import * as ServiceMap from "./ServiceMap.js";
|
|
13
13
|
import { internalCall, SingleShotGen } from "./Utils.js";
|
|
14
14
|
const TypeId = core.EffectTypeId;
|
|
15
15
|
/**
|
|
@@ -35,7 +35,7 @@ export class YieldableClass {
|
|
|
35
35
|
* @since 2.0.0
|
|
36
36
|
* @category Guards
|
|
37
37
|
*/
|
|
38
|
-
export const isEffect =
|
|
38
|
+
export const isEffect = core.isEffect;
|
|
39
39
|
/**
|
|
40
40
|
* Combines multiple effects into one, returning results based on the input
|
|
41
41
|
* structure.
|
|
@@ -181,7 +181,6 @@ export const isEffect = u => typeof u === "object" && u !== null && TypeId in u;
|
|
|
181
181
|
* ```
|
|
182
182
|
*
|
|
183
183
|
* @see {@link forEach} for iterating over elements and applying an effect.
|
|
184
|
-
* @see {@link allWith} for a data-last version of this function.
|
|
185
184
|
*
|
|
186
185
|
* @since 2.0.0
|
|
187
186
|
* @category Collecting
|
|
@@ -215,6 +214,72 @@ export const all = internal.all;
|
|
|
215
214
|
* @category Collecting
|
|
216
215
|
*/
|
|
217
216
|
export const partition = internal.partition;
|
|
217
|
+
/**
|
|
218
|
+
* Applies an effectful function to each element and accumulates all failures.
|
|
219
|
+
*
|
|
220
|
+
* This function always evaluates every element. If at least one effect fails,
|
|
221
|
+
* all failures are returned as a non-empty array and successes are discarded.
|
|
222
|
+
* If all effects succeed, it returns all collected successes.
|
|
223
|
+
*
|
|
224
|
+
* Use `discard: true` to ignore successful values while still validating all
|
|
225
|
+
* elements.
|
|
226
|
+
*
|
|
227
|
+
* @example
|
|
228
|
+
* ```ts
|
|
229
|
+
* import { Effect } from "effect"
|
|
230
|
+
*
|
|
231
|
+
* const program = Effect.validate([0, 1, 2, 3], (n) =>
|
|
232
|
+
* n % 2 === 0 ? Effect.fail(`${n} is even`) : Effect.succeed(n)
|
|
233
|
+
* )
|
|
234
|
+
*
|
|
235
|
+
* Effect.runPromiseExit(program).then(console.log)
|
|
236
|
+
* // {
|
|
237
|
+
* // _id: 'Exit',
|
|
238
|
+
* // _tag: 'Failure',
|
|
239
|
+
* // cause: {
|
|
240
|
+
* // _id: 'Cause',
|
|
241
|
+
* // reasons: [
|
|
242
|
+
* // { _id: 'Reason', _tag: 'Fail', error: '0 is even' },
|
|
243
|
+
* // { _id: 'Reason', _tag: 'Fail', error: '2 is even' }
|
|
244
|
+
* // ]
|
|
245
|
+
* // }
|
|
246
|
+
* // }
|
|
247
|
+
* ```
|
|
248
|
+
*
|
|
249
|
+
* @since 4.0.0
|
|
250
|
+
* @category Error Accumulation
|
|
251
|
+
*/
|
|
252
|
+
export const validate = internal.validate;
|
|
253
|
+
/**
|
|
254
|
+
* Returns the first element that satisfies an effectful predicate.
|
|
255
|
+
*
|
|
256
|
+
* The predicate receives the element and its index. Evaluation short-circuits
|
|
257
|
+
* as soon as an element matches.
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* ```ts
|
|
261
|
+
* import { Effect } from "effect"
|
|
262
|
+
*
|
|
263
|
+
* const program = Effect.findFirst([1, 2, 3, 4], (n) => Effect.succeed(n > 2))
|
|
264
|
+
*
|
|
265
|
+
* Effect.runPromise(program).then(console.log)
|
|
266
|
+
* // { _id: 'Option', _tag: 'Some', value: 3 }
|
|
267
|
+
* ```
|
|
268
|
+
*
|
|
269
|
+
* @since 2.0.0
|
|
270
|
+
* @category Collecting
|
|
271
|
+
*/
|
|
272
|
+
export const findFirst = internal.findFirst;
|
|
273
|
+
/**
|
|
274
|
+
* Returns the first value that passes an effectful `FilterEffect`.
|
|
275
|
+
*
|
|
276
|
+
* The filter receives the element and index. Evaluation short-circuits on the
|
|
277
|
+
* first `Result.succeed` and returns the transformed value in `Option.some`.
|
|
278
|
+
*
|
|
279
|
+
* @since 4.0.0
|
|
280
|
+
* @category Collecting
|
|
281
|
+
*/
|
|
282
|
+
export const findFirstFilter = internal.findFirstFilter;
|
|
218
283
|
/**
|
|
219
284
|
* Executes an effectful operation for each element in an `Iterable`.
|
|
220
285
|
*
|
|
@@ -409,16 +474,18 @@ export const promise = internal.promise;
|
|
|
409
474
|
*
|
|
410
475
|
* @example Custom Error Handling
|
|
411
476
|
* ```ts
|
|
412
|
-
* import { Effect } from "effect"
|
|
477
|
+
* import { Data, Effect } from "effect"
|
|
478
|
+
*
|
|
479
|
+
* class TodoFetchError extends Data.TaggedError("TodoFetchError")<{ readonly cause: unknown }> {}
|
|
413
480
|
*
|
|
414
481
|
* const getTodo = (id: number) =>
|
|
415
482
|
* Effect.tryPromise({
|
|
416
483
|
* try: () => fetch(`https://jsonplaceholder.typicode.com/todos/${id}`),
|
|
417
484
|
* // remap the error
|
|
418
|
-
* catch: (
|
|
485
|
+
* catch: (cause) => new TodoFetchError({ cause })
|
|
419
486
|
* })
|
|
420
487
|
*
|
|
421
|
-
* // ┌─── Effect<Response,
|
|
488
|
+
* // ┌─── Effect<Response, TodoFetchError, never>
|
|
422
489
|
* // ▼
|
|
423
490
|
* const program = getTodo(1)
|
|
424
491
|
* ```
|
|
@@ -645,8 +712,13 @@ undefined_ as undefined };
|
|
|
645
712
|
*
|
|
646
713
|
* **When to Use**
|
|
647
714
|
*
|
|
648
|
-
* Use `Effect.
|
|
715
|
+
* Use `Effect.callback` when dealing with APIs that use callback-style instead of
|
|
649
716
|
* `async/await` or `Promise`.
|
|
717
|
+
* * **Previously Known As**
|
|
718
|
+
*
|
|
719
|
+
* This API replaces the following from Effect 3.x:
|
|
720
|
+
*
|
|
721
|
+
* - `Effect.async`
|
|
650
722
|
*
|
|
651
723
|
* @example
|
|
652
724
|
* ```ts
|
|
@@ -690,6 +762,51 @@ export const callback = internal.callback;
|
|
|
690
762
|
* @category Creating Effects
|
|
691
763
|
*/
|
|
692
764
|
export const never = internal.never;
|
|
765
|
+
/**
|
|
766
|
+
* An `Effect` containing an empty record `{}`, used as the starting point for
|
|
767
|
+
* do notation chains.
|
|
768
|
+
*
|
|
769
|
+
* @example
|
|
770
|
+
* ```ts
|
|
771
|
+
* import { Effect } from "effect"
|
|
772
|
+
* import { pipe } from "effect/Function"
|
|
773
|
+
*
|
|
774
|
+
* const program = pipe(
|
|
775
|
+
* Effect.Do,
|
|
776
|
+
* Effect.bind("x", () => Effect.succeed(2)),
|
|
777
|
+
* Effect.bind("y", ({ x }) => Effect.succeed(x + 1)),
|
|
778
|
+
* Effect.let("sum", ({ x, y }) => x + y)
|
|
779
|
+
* )
|
|
780
|
+
* ```
|
|
781
|
+
*
|
|
782
|
+
* @since 4.0.0
|
|
783
|
+
* @category Do notation
|
|
784
|
+
*/
|
|
785
|
+
export const Do = internal.Do;
|
|
786
|
+
/**
|
|
787
|
+
* Gives a name to the success value of an `Effect`, creating a single-key
|
|
788
|
+
* record used in do notation pipelines.
|
|
789
|
+
*
|
|
790
|
+
* @since 4.0.0
|
|
791
|
+
* @category Do notation
|
|
792
|
+
*/
|
|
793
|
+
export const bindTo = internal.bindTo;
|
|
794
|
+
const let_ = internal.let;
|
|
795
|
+
export {
|
|
796
|
+
/**
|
|
797
|
+
* Adds a computed plain value to the do notation record.
|
|
798
|
+
*
|
|
799
|
+
* @since 4.0.0
|
|
800
|
+
* @category Do notation
|
|
801
|
+
*/
|
|
802
|
+
let_ as let };
|
|
803
|
+
/**
|
|
804
|
+
* Adds an `Effect` value to the do notation record under a given name.
|
|
805
|
+
*
|
|
806
|
+
* @since 4.0.0
|
|
807
|
+
* @category Do notation
|
|
808
|
+
*/
|
|
809
|
+
export const bind = internal.bind;
|
|
693
810
|
/**
|
|
694
811
|
* Provides a way to write effectful code using generator functions, simplifying
|
|
695
812
|
* control flow and error handling.
|
|
@@ -707,16 +824,18 @@ export const never = internal.never;
|
|
|
707
824
|
*
|
|
708
825
|
* @example
|
|
709
826
|
* ```ts
|
|
710
|
-
* import { Effect } from "effect"
|
|
827
|
+
* import { Data, Effect } from "effect"
|
|
828
|
+
*
|
|
829
|
+
* class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
|
|
711
830
|
*
|
|
712
831
|
* const addServiceCharge = (amount: number) => amount + 1
|
|
713
832
|
*
|
|
714
833
|
* const applyDiscount = (
|
|
715
834
|
* total: number,
|
|
716
835
|
* discountRate: number
|
|
717
|
-
* ): Effect.Effect<number,
|
|
836
|
+
* ): Effect.Effect<number, DiscountRateError> =>
|
|
718
837
|
* discountRate === 0
|
|
719
|
-
* ? Effect.fail(new
|
|
838
|
+
* ? Effect.fail(new DiscountRateError())
|
|
720
839
|
* : Effect.succeed(total - (total * discountRate) / 100)
|
|
721
840
|
*
|
|
722
841
|
* const fetchTransactionAmount = Effect.promise(() => Promise.resolve(100))
|
|
@@ -753,12 +872,14 @@ export const gen = internal.gen;
|
|
|
753
872
|
* @example
|
|
754
873
|
* ```ts
|
|
755
874
|
* // Title: Creating a Failed Effect
|
|
756
|
-
* import { Effect } from "effect"
|
|
875
|
+
* import { Data, Effect } from "effect"
|
|
876
|
+
*
|
|
877
|
+
* class OperationFailedError extends Data.TaggedError("OperationFailedError")<{}> {}
|
|
757
878
|
*
|
|
758
|
-
* // ┌─── Effect<never,
|
|
879
|
+
* // ┌─── Effect<never, OperationFailedError, never>
|
|
759
880
|
* // ▼
|
|
760
881
|
* const failure = Effect.fail(
|
|
761
|
-
* new
|
|
882
|
+
* new OperationFailedError()
|
|
762
883
|
* )
|
|
763
884
|
* ```
|
|
764
885
|
*
|
|
@@ -774,9 +895,11 @@ export const fail = internal.fail;
|
|
|
774
895
|
*
|
|
775
896
|
* @example
|
|
776
897
|
* ```ts
|
|
777
|
-
* import { Effect } from "effect"
|
|
898
|
+
* import { Data, Effect } from "effect"
|
|
899
|
+
*
|
|
900
|
+
* class ProgramError extends Data.TaggedError("ProgramError")<{ readonly failedAt: Date }> {}
|
|
778
901
|
*
|
|
779
|
-
* const program = Effect.failSync(() => new
|
|
902
|
+
* const program = Effect.failSync(() => new ProgramError({ failedAt: new Date() }))
|
|
780
903
|
*
|
|
781
904
|
* Effect.runPromiseExit(program).then(console.log)
|
|
782
905
|
* // Output: { _id: 'Exit', _tag: 'Failure', cause: ... }
|
|
@@ -920,12 +1043,14 @@ export {
|
|
|
920
1043
|
*
|
|
921
1044
|
* @example Custom Error Handling
|
|
922
1045
|
* ```ts
|
|
923
|
-
* import { Effect } from "effect"
|
|
1046
|
+
* import { Data, Effect } from "effect"
|
|
1047
|
+
*
|
|
1048
|
+
* class JsonParsingError extends Data.TaggedError("JsonParsingError")<{ readonly cause: unknown }> {}
|
|
924
1049
|
*
|
|
925
1050
|
* const parseJSON = (input: string) =>
|
|
926
1051
|
* Effect.try({
|
|
927
1052
|
* try: () => JSON.parse(input),
|
|
928
|
-
* catch: (
|
|
1053
|
+
* catch: (cause) => new JsonParsingError({ cause })
|
|
929
1054
|
* })
|
|
930
1055
|
*
|
|
931
1056
|
* Effect.runPromiseExit(parseJSON("invalid json")).then(console.log)
|
|
@@ -1050,17 +1175,17 @@ export const fromOption = internal.fromOption;
|
|
|
1050
1175
|
* ```ts
|
|
1051
1176
|
* import { Console, Effect } from "effect"
|
|
1052
1177
|
*
|
|
1053
|
-
* const input: string | null
|
|
1054
|
-
*
|
|
1055
|
-
* const program = Effect.gen(function*() {
|
|
1178
|
+
* const program = Effect.fn(function*(input: string | null) {
|
|
1056
1179
|
* const value = yield* Effect.fromNullishOr(input)
|
|
1057
1180
|
* yield* Console.log(value)
|
|
1058
|
-
* }
|
|
1181
|
+
* },
|
|
1059
1182
|
* Effect.catch(() => Console.log("missing"))
|
|
1060
1183
|
* )
|
|
1061
1184
|
*
|
|
1062
|
-
* Effect.runPromise(program)
|
|
1185
|
+
* Effect.runPromise(program(null))
|
|
1063
1186
|
* // Output: missing
|
|
1187
|
+
* Effect.runPromise(program("hello"))
|
|
1188
|
+
* // Output: hello
|
|
1064
1189
|
* ```
|
|
1065
1190
|
*
|
|
1066
1191
|
* @since 4.0.0
|
|
@@ -1124,15 +1249,17 @@ export const fromYieldable = internal.fromYieldable;
|
|
|
1124
1249
|
*
|
|
1125
1250
|
* @example
|
|
1126
1251
|
* ```ts
|
|
1127
|
-
* import { Effect, pipe } from "effect"
|
|
1252
|
+
* import { Data, Effect, pipe } from "effect"
|
|
1253
|
+
*
|
|
1254
|
+
* class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
|
|
1128
1255
|
*
|
|
1129
1256
|
* // Function to apply a discount safely to a transaction amount
|
|
1130
1257
|
* const applyDiscount = (
|
|
1131
1258
|
* total: number,
|
|
1132
1259
|
* discountRate: number
|
|
1133
|
-
* ): Effect.Effect<number,
|
|
1260
|
+
* ): Effect.Effect<number, DiscountRateError> =>
|
|
1134
1261
|
* discountRate === 0
|
|
1135
|
-
* ? Effect.fail(new
|
|
1262
|
+
* ? Effect.fail(new DiscountRateError())
|
|
1136
1263
|
* : Effect.succeed(total - (total * discountRate) / 100)
|
|
1137
1264
|
*
|
|
1138
1265
|
* // Simulated asynchronous task to fetch a transaction amount from database
|
|
@@ -1216,15 +1343,17 @@ export const flatten = internal.flatten;
|
|
|
1216
1343
|
*
|
|
1217
1344
|
* @example Applying a Discount Based on Fetched Amount
|
|
1218
1345
|
* ```ts
|
|
1219
|
-
* import { Effect, pipe } from "effect"
|
|
1346
|
+
* import { Data, Effect, pipe } from "effect"
|
|
1347
|
+
*
|
|
1348
|
+
* class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
|
|
1220
1349
|
*
|
|
1221
1350
|
* // Function to apply a discount safely to a transaction amount
|
|
1222
1351
|
* const applyDiscount = (
|
|
1223
1352
|
* total: number,
|
|
1224
1353
|
* discountRate: number
|
|
1225
|
-
* ): Effect.Effect<number,
|
|
1354
|
+
* ): Effect.Effect<number, DiscountRateError> =>
|
|
1226
1355
|
* discountRate === 0
|
|
1227
|
-
* ? Effect.fail(new
|
|
1356
|
+
* ? Effect.fail(new DiscountRateError())
|
|
1228
1357
|
* : Effect.succeed(total - (total * discountRate) / 100)
|
|
1229
1358
|
*
|
|
1230
1359
|
* // Simulated asynchronous task to fetch a transaction amount from database
|
|
@@ -1281,16 +1410,18 @@ export const andThen = internal.andThen;
|
|
|
1281
1410
|
* @example
|
|
1282
1411
|
* ```ts
|
|
1283
1412
|
* // Title: Logging a step in a pipeline
|
|
1284
|
-
* import { Effect, pipe } from "effect"
|
|
1413
|
+
* import { Data, Effect, pipe } from "effect"
|
|
1285
1414
|
* import { Console } from "effect"
|
|
1286
1415
|
*
|
|
1416
|
+
* class DiscountRateError extends Data.TaggedError("DiscountRateError")<{}> {}
|
|
1417
|
+
*
|
|
1287
1418
|
* // Function to apply a discount safely to a transaction amount
|
|
1288
1419
|
* const applyDiscount = (
|
|
1289
1420
|
* total: number,
|
|
1290
1421
|
* discountRate: number
|
|
1291
|
-
* ): Effect.Effect<number,
|
|
1422
|
+
* ): Effect.Effect<number, DiscountRateError> =>
|
|
1292
1423
|
* discountRate === 0
|
|
1293
|
-
* ? Effect.fail(new
|
|
1424
|
+
* ? Effect.fail(new DiscountRateError())
|
|
1294
1425
|
* : Effect.succeed(total - (total * discountRate) / 100)
|
|
1295
1426
|
*
|
|
1296
1427
|
* // Simulated asynchronous task to fetch a transaction amount from database
|
|
@@ -1697,12 +1828,12 @@ export {
|
|
|
1697
1828
|
*
|
|
1698
1829
|
* **Details**
|
|
1699
1830
|
*
|
|
1700
|
-
* The `
|
|
1831
|
+
* The `catch` function catches any errors that may occur during the
|
|
1701
1832
|
* execution of an effect and allows you to handle them by specifying a fallback
|
|
1702
1833
|
* effect. This ensures that the program continues without failing by recovering
|
|
1703
1834
|
* from errors using the provided fallback logic.
|
|
1704
1835
|
*
|
|
1705
|
-
* **Note**: `
|
|
1836
|
+
* **Note**: `catch` only handles recoverable errors. It will not recover
|
|
1706
1837
|
* from unrecoverable defects.
|
|
1707
1838
|
*
|
|
1708
1839
|
* @see {@link catchCause} for a version that can recover from both recoverable and unrecoverable errors.
|
|
@@ -1767,7 +1898,8 @@ export const catchTag = internal.catchTag;
|
|
|
1767
1898
|
* once. Instead of using {@link catchTag} multiple times, you can pass an
|
|
1768
1899
|
* object where each key is an error type's `_tag`, and the value is the handler
|
|
1769
1900
|
* for that specific error. This allows you to catch and recover from multiple
|
|
1770
|
-
* error types in a single call.
|
|
1901
|
+
* error types in a single call. You can also provide a fallback handler for
|
|
1902
|
+
* unhandled errors.
|
|
1771
1903
|
*
|
|
1772
1904
|
* The error type must have a readonly `_tag` field to use `catchTag`. This
|
|
1773
1905
|
* field is used to identify and match errors.
|
|
@@ -1998,15 +2130,14 @@ export const catchCause = internal.catchCause;
|
|
|
1998
2130
|
*/
|
|
1999
2131
|
export const catchDefect = internal.catchDefect;
|
|
2000
2132
|
/**
|
|
2001
|
-
* Recovers from specific errors using a `
|
|
2002
|
-
* `Refinement`.
|
|
2133
|
+
* Recovers from specific errors using a `Predicate` or `Refinement`.
|
|
2003
2134
|
*
|
|
2004
2135
|
* **When to Use**
|
|
2005
2136
|
*
|
|
2006
|
-
* `catchIf` lets you recover from errors that match a condition.
|
|
2007
|
-
* `
|
|
2008
|
-
*
|
|
2009
|
-
*
|
|
2137
|
+
* `catchIf` lets you recover from errors that match a condition. Use a
|
|
2138
|
+
* `Refinement` for type narrowing or a `Predicate` for simple boolean
|
|
2139
|
+
* matching. Non-matching errors re-fail with the original cause. Defects and
|
|
2140
|
+
* interrupts are not caught.
|
|
2010
2141
|
*
|
|
2011
2142
|
* **Previously Known As**
|
|
2012
2143
|
*
|
|
@@ -2033,7 +2164,7 @@ export const catchDefect = internal.catchDefect;
|
|
|
2033
2164
|
*
|
|
2034
2165
|
* // With a Filter
|
|
2035
2166
|
* const recovered2 = program.pipe(
|
|
2036
|
-
* Effect.
|
|
2167
|
+
* Effect.catchFilter(
|
|
2037
2168
|
* Filter.tagged("NotFound"),
|
|
2038
2169
|
* (error) => Effect.succeed(`missing:${error.id}`)
|
|
2039
2170
|
* )
|
|
@@ -2044,6 +2175,13 @@ export const catchDefect = internal.catchDefect;
|
|
|
2044
2175
|
* @category Error Handling
|
|
2045
2176
|
*/
|
|
2046
2177
|
export const catchIf = internal.catchIf;
|
|
2178
|
+
/**
|
|
2179
|
+
* Recovers from specific errors using a `Filter`.
|
|
2180
|
+
*
|
|
2181
|
+
* @since 4.0.0
|
|
2182
|
+
* @category Error Handling
|
|
2183
|
+
*/
|
|
2184
|
+
export const catchFilter = internal.catchFilter;
|
|
2047
2185
|
/**
|
|
2048
2186
|
* Catches `NoSuchElementError` failures and converts them to `Option.none`.
|
|
2049
2187
|
*
|
|
@@ -2110,6 +2248,13 @@ export const catchNoSuchElement = internal.catchNoSuchElement;
|
|
|
2110
2248
|
* @category Error Handling
|
|
2111
2249
|
*/
|
|
2112
2250
|
export const catchCauseIf = internal.catchCauseIf;
|
|
2251
|
+
/**
|
|
2252
|
+
* Recovers from specific failures based on a `Filter`.
|
|
2253
|
+
*
|
|
2254
|
+
* @since 4.0.0
|
|
2255
|
+
* @category Error Handling
|
|
2256
|
+
*/
|
|
2257
|
+
export const catchCauseFilter = internal.catchCauseFilter;
|
|
2113
2258
|
/**
|
|
2114
2259
|
* The `mapError` function is used to transform or modify the error
|
|
2115
2260
|
* produced by an effect, without affecting its success value.
|
|
@@ -2125,17 +2270,19 @@ export const catchCauseIf = internal.catchCauseIf;
|
|
|
2125
2270
|
*
|
|
2126
2271
|
* @example
|
|
2127
2272
|
* ```ts
|
|
2128
|
-
* import { Effect } from "effect"
|
|
2273
|
+
* import { Data, Effect } from "effect"
|
|
2274
|
+
*
|
|
2275
|
+
* class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
|
|
2129
2276
|
*
|
|
2130
2277
|
* // ┌─── Effect<number, string, never>
|
|
2131
2278
|
* // ▼
|
|
2132
2279
|
* const simulatedTask = Effect.fail("Oh no!").pipe(Effect.as(1))
|
|
2133
2280
|
*
|
|
2134
|
-
* // ┌─── Effect<number,
|
|
2281
|
+
* // ┌─── Effect<number, TaskError, never>
|
|
2135
2282
|
* // ▼
|
|
2136
2283
|
* const mapped = Effect.mapError(
|
|
2137
2284
|
* simulatedTask,
|
|
2138
|
-
* (message) => new
|
|
2285
|
+
* (message) => new TaskError({ message })
|
|
2139
2286
|
* )
|
|
2140
2287
|
* ```
|
|
2141
2288
|
*
|
|
@@ -2155,16 +2302,18 @@ export const mapError = internal.mapError;
|
|
|
2155
2302
|
*
|
|
2156
2303
|
* @example
|
|
2157
2304
|
* ```ts
|
|
2158
|
-
* import { Effect } from "effect"
|
|
2305
|
+
* import { Data, Effect } from "effect"
|
|
2306
|
+
*
|
|
2307
|
+
* class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
|
|
2159
2308
|
*
|
|
2160
2309
|
* // ┌─── Effect<number, string, never>
|
|
2161
2310
|
* // ▼
|
|
2162
2311
|
* const simulatedTask = Effect.fail("Oh no!").pipe(Effect.as(1))
|
|
2163
2312
|
*
|
|
2164
|
-
* // ┌─── Effect<boolean,
|
|
2313
|
+
* // ┌─── Effect<boolean, TaskError, never>
|
|
2165
2314
|
* // ▼
|
|
2166
2315
|
* const modified = Effect.mapBoth(simulatedTask, {
|
|
2167
|
-
* onFailure: (message) => new
|
|
2316
|
+
* onFailure: (message) => new TaskError({ message }),
|
|
2168
2317
|
* onSuccess: (n) => n > 0
|
|
2169
2318
|
* })
|
|
2170
2319
|
* ```
|
|
@@ -2194,11 +2343,13 @@ export const mapBoth = internal.mapBoth;
|
|
|
2194
2343
|
* @example
|
|
2195
2344
|
* ```ts
|
|
2196
2345
|
* // Title: Propagating an Error as a Defect
|
|
2197
|
-
* import { Effect } from "effect"
|
|
2346
|
+
* import { Data, Effect } from "effect"
|
|
2347
|
+
*
|
|
2348
|
+
* class DivideByZeroError extends Data.TaggedError("DivideByZeroError")<{}> {}
|
|
2198
2349
|
*
|
|
2199
2350
|
* const divide = (a: number, b: number) =>
|
|
2200
2351
|
* b === 0
|
|
2201
|
-
* ? Effect.fail(new
|
|
2352
|
+
* ? Effect.fail(new DivideByZeroError())
|
|
2202
2353
|
* : Effect.succeed(a / b)
|
|
2203
2354
|
*
|
|
2204
2355
|
* // ┌─── Effect<number, never, never>
|
|
@@ -2207,7 +2358,7 @@ export const mapBoth = internal.mapBoth;
|
|
|
2207
2358
|
*
|
|
2208
2359
|
* Effect.runPromise(program).catch(console.error)
|
|
2209
2360
|
* // Output:
|
|
2210
|
-
* // (FiberFailure)
|
|
2361
|
+
* // (FiberFailure) DivideByZeroError
|
|
2211
2362
|
* // ...stack trace...
|
|
2212
2363
|
* ```
|
|
2213
2364
|
*
|
|
@@ -2344,6 +2495,13 @@ export const tapCause = internal.tapCause;
|
|
|
2344
2495
|
* @category Sequencing
|
|
2345
2496
|
*/
|
|
2346
2497
|
export const tapCauseIf = internal.tapCauseIf;
|
|
2498
|
+
/**
|
|
2499
|
+
* Conditionally executes a side effect based on the cause of a failed effect.
|
|
2500
|
+
*
|
|
2501
|
+
* @since 4.0.0
|
|
2502
|
+
* @category Sequencing
|
|
2503
|
+
*/
|
|
2504
|
+
export const tapCauseFilter = internal.tapCauseFilter;
|
|
2347
2505
|
/**
|
|
2348
2506
|
* Inspect severe errors or defects (non-recoverable failures) in an effect.
|
|
2349
2507
|
*
|
|
@@ -2412,7 +2570,7 @@ export const tapDefect = internal.tapDefect;
|
|
|
2412
2570
|
* attempts++
|
|
2413
2571
|
* yield* Console.log(`Attempt ${attempts}`)
|
|
2414
2572
|
* if (attempts < 3) {
|
|
2415
|
-
* yield* Effect.fail("Not ready")
|
|
2573
|
+
* return yield* Effect.fail("Not ready")
|
|
2416
2574
|
* }
|
|
2417
2575
|
* return "Ready"
|
|
2418
2576
|
* })
|
|
@@ -2454,13 +2612,15 @@ export const eventually = internal.eventually;
|
|
|
2454
2612
|
*
|
|
2455
2613
|
* @example
|
|
2456
2614
|
* ```ts
|
|
2457
|
-
* import { Effect, Schedule } from "effect"
|
|
2615
|
+
* import { Data, Effect, Schedule } from "effect"
|
|
2616
|
+
*
|
|
2617
|
+
* class AttemptError extends Data.TaggedError("AttemptError")<{ readonly attempt: number }> {}
|
|
2458
2618
|
*
|
|
2459
2619
|
* let attempt = 0
|
|
2460
|
-
* const task = Effect.callback<string,
|
|
2620
|
+
* const task = Effect.callback<string, AttemptError>((resume) => {
|
|
2461
2621
|
* attempt++
|
|
2462
2622
|
* if (attempt <= 2) {
|
|
2463
|
-
* resume(Effect.fail(new
|
|
2623
|
+
* resume(Effect.fail(new AttemptError({ attempt })))
|
|
2464
2624
|
* } else {
|
|
2465
2625
|
* resume(Effect.succeed("Success!"))
|
|
2466
2626
|
* }
|
|
@@ -2500,14 +2660,16 @@ export const retry = internalSchedule.retry;
|
|
|
2500
2660
|
*
|
|
2501
2661
|
* @example
|
|
2502
2662
|
* ```ts
|
|
2503
|
-
* import { Console, Effect, Schedule } from "effect"
|
|
2663
|
+
* import { Console, Data, Effect, Schedule } from "effect"
|
|
2664
|
+
*
|
|
2665
|
+
* class NetworkTimeoutError extends Data.TaggedError("NetworkTimeoutError")<{}> {}
|
|
2504
2666
|
*
|
|
2505
2667
|
* let attempt = 0
|
|
2506
2668
|
* const networkRequest = Effect.gen(function*() {
|
|
2507
2669
|
* attempt++
|
|
2508
2670
|
* yield* Console.log(`Network attempt ${attempt}`)
|
|
2509
2671
|
* if (attempt < 3) {
|
|
2510
|
-
* return yield* Effect.fail(new
|
|
2672
|
+
* return yield* Effect.fail(new NetworkTimeoutError())
|
|
2511
2673
|
* }
|
|
2512
2674
|
* return "Network data"
|
|
2513
2675
|
* })
|
|
@@ -2579,7 +2741,8 @@ export const sandbox = internal.sandbox;
|
|
|
2579
2741
|
* it succeeds or fails. This is useful when you only care about the side
|
|
2580
2742
|
* effects of the effect and do not need to handle or process its outcome.
|
|
2581
2743
|
*
|
|
2582
|
-
* Use the `log` option to emit the full {@link Cause} when the effect fails
|
|
2744
|
+
* Use the `log` option to emit the full {@link Cause} when the effect fails,
|
|
2745
|
+
* and `message` to prepend a custom log message.
|
|
2583
2746
|
*
|
|
2584
2747
|
* @example
|
|
2585
2748
|
* ```ts
|
|
@@ -2603,7 +2766,7 @@ export const sandbox = internal.sandbox;
|
|
|
2603
2766
|
* const task = Effect.fail("Uh oh!")
|
|
2604
2767
|
*
|
|
2605
2768
|
* const program = task.pipe(Effect.ignore({ log: true }))
|
|
2606
|
-
* const programWarn = task.pipe(Effect.ignore({ log: "Warn" }))
|
|
2769
|
+
* const programWarn = task.pipe(Effect.ignore({ log: "Warn", message: "Ignoring task failure" }))
|
|
2607
2770
|
* ```
|
|
2608
2771
|
*
|
|
2609
2772
|
* **Previously Known As**
|
|
@@ -2619,7 +2782,8 @@ export const ignore = internal.ignore;
|
|
|
2619
2782
|
/**
|
|
2620
2783
|
* Ignores the effect's failure cause, including defects and interruptions.
|
|
2621
2784
|
*
|
|
2622
|
-
* Use the `log` option to emit the full {@link Cause} when the effect fails
|
|
2785
|
+
* Use the `log` option to emit the full {@link Cause} when the effect fails,
|
|
2786
|
+
* and `message` to prepend a custom log message.
|
|
2623
2787
|
*
|
|
2624
2788
|
* @example
|
|
2625
2789
|
* ```ts
|
|
@@ -2628,7 +2792,7 @@ export const ignore = internal.ignore;
|
|
|
2628
2792
|
* const task = Effect.fail("boom")
|
|
2629
2793
|
*
|
|
2630
2794
|
* const program = task.pipe(Effect.ignoreCause)
|
|
2631
|
-
* const programLog = task.pipe(Effect.ignoreCause({ log: true }))
|
|
2795
|
+
* const programLog = task.pipe(Effect.ignoreCause({ log: true, message: "Ignoring failure cause" }))
|
|
2632
2796
|
* ```
|
|
2633
2797
|
*
|
|
2634
2798
|
* @since 4.0.0
|
|
@@ -2645,13 +2809,16 @@ export const ignoreCause = internal.ignoreCause;
|
|
|
2645
2809
|
*
|
|
2646
2810
|
* @example
|
|
2647
2811
|
* ```ts
|
|
2648
|
-
* import { Effect, ExecutionPlan, Layer,
|
|
2812
|
+
* import { Effect, ExecutionPlan, Layer, Context } from "effect"
|
|
2649
2813
|
*
|
|
2650
|
-
* const Endpoint =
|
|
2814
|
+
* const Endpoint = Context.Service<{ url: string }>("Endpoint")
|
|
2651
2815
|
*
|
|
2652
2816
|
* const fetchUrl = Effect.gen(function*() {
|
|
2653
2817
|
* const endpoint = yield* Effect.service(Endpoint)
|
|
2654
|
-
*
|
|
2818
|
+
* if (endpoint.url === "bad") {
|
|
2819
|
+
* return yield* Effect.fail("Unavailable")
|
|
2820
|
+
* }
|
|
2821
|
+
* return endpoint.url
|
|
2655
2822
|
* })
|
|
2656
2823
|
*
|
|
2657
2824
|
* const plan = ExecutionPlan.make(
|
|
@@ -2666,6 +2833,16 @@ export const ignoreCause = internal.ignoreCause;
|
|
|
2666
2833
|
* @category Fallback
|
|
2667
2834
|
*/
|
|
2668
2835
|
export const withExecutionPlan = internalExecutionPlan.withExecutionPlan;
|
|
2836
|
+
/**
|
|
2837
|
+
* Runs an effect and reports any errors to the configured `ErrorReporter`s.
|
|
2838
|
+
*
|
|
2839
|
+
* If the `defectsOnly` option is set to `true`, only defects (unrecoverable
|
|
2840
|
+
* errors) will be reported, while regular failures will be ignored.
|
|
2841
|
+
*
|
|
2842
|
+
* @since 4.0.0
|
|
2843
|
+
* @category Error Handling
|
|
2844
|
+
*/
|
|
2845
|
+
export const withErrorReporting = internal.withErrorReporting;
|
|
2669
2846
|
// -----------------------------------------------------------------------------
|
|
2670
2847
|
// Fallback
|
|
2671
2848
|
// -----------------------------------------------------------------------------
|
|
@@ -2711,6 +2888,50 @@ export const withExecutionPlan = internalExecutionPlan.withExecutionPlan;
|
|
|
2711
2888
|
* @category Fallback
|
|
2712
2889
|
*/
|
|
2713
2890
|
export const orElseSucceed = internal.orElseSucceed;
|
|
2891
|
+
/**
|
|
2892
|
+
* Runs a sequence of effects and returns the result of the first successful
|
|
2893
|
+
* one.
|
|
2894
|
+
*
|
|
2895
|
+
* **Details**
|
|
2896
|
+
*
|
|
2897
|
+
* This function executes the provided effects in sequence, stopping at the
|
|
2898
|
+
* first success. If an effect succeeds, its result is returned immediately and
|
|
2899
|
+
* no further effects in the sequence are executed.
|
|
2900
|
+
*
|
|
2901
|
+
* If all effects fail, the returned effect fails with the error from the last
|
|
2902
|
+
* effect. If the collection is empty, the returned effect defects with an
|
|
2903
|
+
* `Error` whose message is `"Received an empty collection of effects"`.
|
|
2904
|
+
*
|
|
2905
|
+
* **When to Use**
|
|
2906
|
+
*
|
|
2907
|
+
* Use `firstSuccessOf` when you have prioritized fallback strategies, such as
|
|
2908
|
+
* attempting multiple APIs, reading configuration from several sources, or
|
|
2909
|
+
* trying alternative resource locations in order.
|
|
2910
|
+
*
|
|
2911
|
+
* @example
|
|
2912
|
+
* ```ts
|
|
2913
|
+
* import { Effect } from "effect"
|
|
2914
|
+
*
|
|
2915
|
+
* const primary = Effect.fail("primary unavailable")
|
|
2916
|
+
* const secondary = Effect.succeed("secondary result")
|
|
2917
|
+
* const tertiary = Effect.sync(() => {
|
|
2918
|
+
* throw new Error("not evaluated")
|
|
2919
|
+
* })
|
|
2920
|
+
*
|
|
2921
|
+
* const program = Effect.firstSuccessOf([
|
|
2922
|
+
* primary,
|
|
2923
|
+
* secondary,
|
|
2924
|
+
* tertiary
|
|
2925
|
+
* ])
|
|
2926
|
+
*
|
|
2927
|
+
* console.log(Effect.runSync(program))
|
|
2928
|
+
* // Output: "secondary result"
|
|
2929
|
+
* ```
|
|
2930
|
+
*
|
|
2931
|
+
* @since 2.0.0
|
|
2932
|
+
* @category Fallback
|
|
2933
|
+
*/
|
|
2934
|
+
export const firstSuccessOf = internal.firstSuccessOf;
|
|
2714
2935
|
// -----------------------------------------------------------------------------
|
|
2715
2936
|
// Delays & timeouts
|
|
2716
2937
|
// -----------------------------------------------------------------------------
|
|
@@ -2830,7 +3051,7 @@ export const timeoutOption = internal.timeoutOption;
|
|
|
2830
3051
|
* // Use cached data as fallback when timeout is reached
|
|
2831
3052
|
* const program = Effect.timeoutOrElse(slowQuery, {
|
|
2832
3053
|
* duration: "2 seconds",
|
|
2833
|
-
*
|
|
3054
|
+
* orElse: () =>
|
|
2834
3055
|
* Effect.gen(function*() {
|
|
2835
3056
|
* yield* Console.log("Query timed out, using cached data")
|
|
2836
3057
|
* return "Cached result"
|
|
@@ -3042,12 +3263,12 @@ export const raceFirst = internal.raceFirst;
|
|
|
3042
3263
|
// Filtering
|
|
3043
3264
|
// -----------------------------------------------------------------------------
|
|
3044
3265
|
/**
|
|
3045
|
-
* Filters elements of an iterable using a predicate, refinement, effectful
|
|
3046
|
-
* predicate
|
|
3266
|
+
* Filters elements of an iterable using a predicate, refinement, or effectful
|
|
3267
|
+
* predicate.
|
|
3047
3268
|
*
|
|
3048
3269
|
* @example
|
|
3049
3270
|
* ```ts
|
|
3050
|
-
* import { Effect
|
|
3271
|
+
* import { Effect } from "effect"
|
|
3051
3272
|
*
|
|
3052
3273
|
* // Sync predicate
|
|
3053
3274
|
* const evens = Effect.filter([1, 2, 3, 4], (n) => n % 2 === 0)
|
|
@@ -3055,16 +3276,27 @@ export const raceFirst = internal.raceFirst;
|
|
|
3055
3276
|
* // Effectful predicate
|
|
3056
3277
|
* const checked = Effect.filter([1, 2, 3], (n) => Effect.succeed(n > 1))
|
|
3057
3278
|
*
|
|
3058
|
-
* //
|
|
3059
|
-
* const mapped = Effect.filter([1, 2, 3, 4], (n) =>
|
|
3060
|
-
* Effect.succeed(n % 2 === 0 ? Result.succeed(n * 2) : Result.fail(n))
|
|
3061
|
-
* )
|
|
3279
|
+
* // Use Effect.filterMapEffect for effectful Filter.Filter callbacks
|
|
3062
3280
|
* ```
|
|
3063
3281
|
*
|
|
3064
3282
|
* @since 2.0.0
|
|
3065
3283
|
* @category Filtering
|
|
3066
3284
|
*/
|
|
3067
3285
|
export const filter = internal.filter;
|
|
3286
|
+
/**
|
|
3287
|
+
* Filters and maps elements of an iterable with a `Filter`.
|
|
3288
|
+
*
|
|
3289
|
+
* @since 4.0.0
|
|
3290
|
+
* @category Filtering
|
|
3291
|
+
*/
|
|
3292
|
+
export const filterMap = internal.filterMap;
|
|
3293
|
+
/**
|
|
3294
|
+
* Effectfully filters and maps elements of an iterable with a `FilterEffect`.
|
|
3295
|
+
*
|
|
3296
|
+
* @since 4.0.0
|
|
3297
|
+
* @category Filtering
|
|
3298
|
+
*/
|
|
3299
|
+
export const filterMapEffect = internal.filterMapEffect;
|
|
3068
3300
|
/**
|
|
3069
3301
|
* Filters an effect, providing an alternative effect if the predicate fails.
|
|
3070
3302
|
*
|
|
@@ -3096,6 +3328,13 @@ export const filter = internal.filter;
|
|
|
3096
3328
|
* @category Filtering
|
|
3097
3329
|
*/
|
|
3098
3330
|
export const filterOrElse = internal.filterOrElse;
|
|
3331
|
+
/**
|
|
3332
|
+
* Filters an effect with a `Filter`, providing an alternative effect on failure.
|
|
3333
|
+
*
|
|
3334
|
+
* @since 4.0.0
|
|
3335
|
+
* @category Filtering
|
|
3336
|
+
*/
|
|
3337
|
+
export const filterMapOrElse = internal.filterMapOrElse;
|
|
3099
3338
|
/**
|
|
3100
3339
|
* Filters an effect, failing with a custom error if the predicate fails.
|
|
3101
3340
|
*
|
|
@@ -3126,6 +3365,13 @@ export const filterOrElse = internal.filterOrElse;
|
|
|
3126
3365
|
* @category Filtering
|
|
3127
3366
|
*/
|
|
3128
3367
|
export const filterOrFail = internal.filterOrFail;
|
|
3368
|
+
/**
|
|
3369
|
+
* Filters an effect with a `Filter`, failing when the filter fails.
|
|
3370
|
+
*
|
|
3371
|
+
* @since 4.0.0
|
|
3372
|
+
* @category Filtering
|
|
3373
|
+
*/
|
|
3374
|
+
export const filterMapOrFail = internal.filterMapOrFail;
|
|
3129
3375
|
// -----------------------------------------------------------------------------
|
|
3130
3376
|
// Conditional Operators
|
|
3131
3377
|
// -----------------------------------------------------------------------------
|
|
@@ -3192,9 +3438,11 @@ export const when = internal.when;
|
|
|
3192
3438
|
* @example
|
|
3193
3439
|
* ```ts
|
|
3194
3440
|
* // Title: Handling Both Success and Failure Cases
|
|
3195
|
-
* import { Effect } from "effect"
|
|
3441
|
+
* import { Data, Effect } from "effect"
|
|
3196
3442
|
*
|
|
3197
|
-
*
|
|
3443
|
+
* class ExampleError extends Data.TaggedError("ExampleError")<{ readonly message: string }> {}
|
|
3444
|
+
*
|
|
3445
|
+
* const success: Effect.Effect<number, ExampleError> = Effect.succeed(42)
|
|
3198
3446
|
*
|
|
3199
3447
|
* const program1 = Effect.match(success, {
|
|
3200
3448
|
* onFailure: (error) => `failure: ${error.message}`,
|
|
@@ -3205,8 +3453,8 @@ export const when = internal.when;
|
|
|
3205
3453
|
* Effect.runPromise(program1).then(console.log)
|
|
3206
3454
|
* // Output: "success: 42"
|
|
3207
3455
|
*
|
|
3208
|
-
* const failure: Effect.Effect<number,
|
|
3209
|
-
* new
|
|
3456
|
+
* const failure: Effect.Effect<number, ExampleError> = Effect.fail(
|
|
3457
|
+
* new ExampleError({ message: "Uh oh!" })
|
|
3210
3458
|
* )
|
|
3211
3459
|
*
|
|
3212
3460
|
* const program2 = Effect.match(failure, {
|
|
@@ -3350,9 +3598,11 @@ export const matchCauseEffectEager = internal.matchCauseEffectEager;
|
|
|
3350
3598
|
*
|
|
3351
3599
|
* @example
|
|
3352
3600
|
* ```ts
|
|
3353
|
-
* import { Cause, Console, Effect, Result } from "effect"
|
|
3601
|
+
* import { Cause, Console, Data, Effect, Result } from "effect"
|
|
3602
|
+
*
|
|
3603
|
+
* class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
|
|
3354
3604
|
*
|
|
3355
|
-
* const task = Effect.fail(new
|
|
3605
|
+
* const task = Effect.fail(new TaskError({ message: "Task failed" }))
|
|
3356
3606
|
*
|
|
3357
3607
|
* const program = Effect.matchCauseEffect(task, {
|
|
3358
3608
|
* onFailure: (cause) =>
|
|
@@ -3408,11 +3658,13 @@ export const matchCauseEffect = internal.matchCauseEffect;
|
|
|
3408
3658
|
* @example
|
|
3409
3659
|
* ```ts
|
|
3410
3660
|
* // Title: Handling Both Success and Failure Cases with Side Effects
|
|
3411
|
-
* import { Effect } from "effect"
|
|
3661
|
+
* import { Data, Effect } from "effect"
|
|
3412
3662
|
*
|
|
3413
|
-
*
|
|
3414
|
-
*
|
|
3415
|
-
*
|
|
3663
|
+
* class ExampleError extends Data.TaggedError("ExampleError")<{ readonly message: string }> {}
|
|
3664
|
+
*
|
|
3665
|
+
* const success: Effect.Effect<number, ExampleError> = Effect.succeed(42)
|
|
3666
|
+
* const failure: Effect.Effect<number, ExampleError> = Effect.fail(
|
|
3667
|
+
* new ExampleError({ message: "Uh oh!" })
|
|
3416
3668
|
* )
|
|
3417
3669
|
*
|
|
3418
3670
|
* const program1 = Effect.matchEffect(success, {
|
|
@@ -3506,7 +3758,7 @@ export const isSuccess = internal.isSuccess;
|
|
|
3506
3758
|
// Environment
|
|
3507
3759
|
// -----------------------------------------------------------------------------
|
|
3508
3760
|
/**
|
|
3509
|
-
* Returns the complete
|
|
3761
|
+
* Returns the complete context.
|
|
3510
3762
|
*
|
|
3511
3763
|
* This function allows you to access all services that are currently available
|
|
3512
3764
|
* in the effect's environment. This can be useful for debugging, introspection,
|
|
@@ -3514,56 +3766,56 @@ export const isSuccess = internal.isSuccess;
|
|
|
3514
3766
|
*
|
|
3515
3767
|
* @example
|
|
3516
3768
|
* ```ts
|
|
3517
|
-
* import { Console, Effect, Option,
|
|
3769
|
+
* import { Console, Effect, Option, Context } from "effect"
|
|
3518
3770
|
*
|
|
3519
|
-
* const Logger =
|
|
3771
|
+
* const Logger = Context.Service<{
|
|
3520
3772
|
* log: (msg: string) => void
|
|
3521
3773
|
* }>("Logger")
|
|
3522
|
-
* const Database =
|
|
3774
|
+
* const Database = Context.Service<{
|
|
3523
3775
|
* query: (sql: string) => string
|
|
3524
3776
|
* }>("Database")
|
|
3525
3777
|
*
|
|
3526
3778
|
* const program = Effect.gen(function*() {
|
|
3527
|
-
* const allServices = yield* Effect.
|
|
3779
|
+
* const allServices = yield* Effect.context()
|
|
3528
3780
|
*
|
|
3529
3781
|
* // Check if specific services are available
|
|
3530
|
-
* const loggerOption =
|
|
3531
|
-
* const databaseOption =
|
|
3782
|
+
* const loggerOption = Context.getOption(allServices, Logger)
|
|
3783
|
+
* const databaseOption = Context.getOption(allServices, Database)
|
|
3532
3784
|
*
|
|
3533
3785
|
* yield* Console.log(`Logger available: ${Option.isSome(loggerOption)}`)
|
|
3534
3786
|
* yield* Console.log(`Database available: ${Option.isSome(databaseOption)}`)
|
|
3535
3787
|
* })
|
|
3536
3788
|
*
|
|
3537
|
-
* const
|
|
3538
|
-
* .pipe(
|
|
3789
|
+
* const context = Context.make(Logger, { log: console.log })
|
|
3790
|
+
* .pipe(Context.add(Database, { query: () => "result" }))
|
|
3539
3791
|
*
|
|
3540
|
-
* const provided = Effect.
|
|
3792
|
+
* const provided = Effect.provideContext(program, context)
|
|
3541
3793
|
* ```
|
|
3542
3794
|
*
|
|
3543
3795
|
* @since 2.0.0
|
|
3544
3796
|
* @category Environment
|
|
3545
3797
|
*/
|
|
3546
|
-
export const
|
|
3798
|
+
export const context = internal.context;
|
|
3547
3799
|
/**
|
|
3548
|
-
* Transforms the current
|
|
3800
|
+
* Transforms the current context using the provided function.
|
|
3549
3801
|
*
|
|
3550
|
-
* This function allows you to access the complete
|
|
3802
|
+
* This function allows you to access the complete context and perform
|
|
3551
3803
|
* computations based on all available services. This is useful when you need
|
|
3552
3804
|
* to conditionally execute logic based on what services are available.
|
|
3553
3805
|
*
|
|
3554
3806
|
* @example
|
|
3555
3807
|
* ```ts
|
|
3556
|
-
* import { Console, Effect, Option,
|
|
3808
|
+
* import { Console, Effect, Option, Context } from "effect"
|
|
3557
3809
|
*
|
|
3558
|
-
* const Logger =
|
|
3810
|
+
* const Logger = Context.Service<{
|
|
3559
3811
|
* log: (msg: string) => void
|
|
3560
3812
|
* }>("Logger")
|
|
3561
|
-
* const Cache =
|
|
3813
|
+
* const Cache = Context.Service<{
|
|
3562
3814
|
* get: (key: string) => string | null
|
|
3563
3815
|
* }>("Cache")
|
|
3564
3816
|
*
|
|
3565
|
-
* const program = Effect.
|
|
3566
|
-
* const cacheOption =
|
|
3817
|
+
* const program = Effect.contextWith((services) => {
|
|
3818
|
+
* const cacheOption = Context.getOption(services, Cache)
|
|
3567
3819
|
* const hasCache = Option.isSome(cacheOption)
|
|
3568
3820
|
*
|
|
3569
3821
|
* if (hasCache) {
|
|
@@ -3588,7 +3840,7 @@ export const services = internal.services;
|
|
|
3588
3840
|
* @since 2.0.0
|
|
3589
3841
|
* @category Environment
|
|
3590
3842
|
*/
|
|
3591
|
-
export const
|
|
3843
|
+
export const contextWith = internal.contextWith;
|
|
3592
3844
|
/**
|
|
3593
3845
|
* Provides dependencies to an effect using layers or a context. Use `options.local`
|
|
3594
3846
|
* to build the layer every time; by default, layers are shared between provide
|
|
@@ -3596,16 +3848,16 @@ export const servicesWith = internal.servicesWith;
|
|
|
3596
3848
|
*
|
|
3597
3849
|
* @example
|
|
3598
3850
|
* ```ts
|
|
3599
|
-
* import { Effect, Layer,
|
|
3851
|
+
* import { Effect, Layer, Context } from "effect"
|
|
3600
3852
|
*
|
|
3601
3853
|
* interface Database {
|
|
3602
3854
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
3603
3855
|
* }
|
|
3604
3856
|
*
|
|
3605
|
-
* const Database =
|
|
3857
|
+
* const Database = Context.Service<Database>("Database")
|
|
3606
3858
|
*
|
|
3607
3859
|
* const DatabaseLive = Layer.succeed(Database)({
|
|
3608
|
-
* query: (sql: string) => Effect.succeed(`Result for: ${sql}`)
|
|
3860
|
+
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result for: ${sql}`))
|
|
3609
3861
|
* })
|
|
3610
3862
|
*
|
|
3611
3863
|
* const program = Effect.gen(function*() {
|
|
@@ -3624,29 +3876,29 @@ export const servicesWith = internal.servicesWith;
|
|
|
3624
3876
|
*/
|
|
3625
3877
|
export const provide = internalLayer.provide;
|
|
3626
3878
|
/**
|
|
3627
|
-
* Provides a
|
|
3879
|
+
* Provides a context to an effect, fulfilling its service requirements.
|
|
3628
3880
|
*
|
|
3629
3881
|
* **Details**
|
|
3630
3882
|
*
|
|
3631
|
-
* This function provides multiple services at once by supplying a
|
|
3883
|
+
* This function provides multiple services at once by supplying a context
|
|
3632
3884
|
* that contains all the required services. It removes the provided services
|
|
3633
3885
|
* from the effect's requirements, making them available to the effect.
|
|
3634
3886
|
*
|
|
3635
3887
|
* @example
|
|
3636
3888
|
* ```ts
|
|
3637
|
-
* import { Effect,
|
|
3889
|
+
* import { Effect, Context } from "effect"
|
|
3638
3890
|
*
|
|
3639
3891
|
* // Define service keys
|
|
3640
|
-
* const Logger =
|
|
3892
|
+
* const Logger = Context.Service<{
|
|
3641
3893
|
* log: (msg: string) => void
|
|
3642
3894
|
* }>("Logger")
|
|
3643
|
-
* const Database =
|
|
3895
|
+
* const Database = Context.Service<{
|
|
3644
3896
|
* query: (sql: string) => string
|
|
3645
3897
|
* }>("Database")
|
|
3646
3898
|
*
|
|
3647
|
-
* // Create
|
|
3648
|
-
* const
|
|
3649
|
-
* .pipe(
|
|
3899
|
+
* // Create a context with multiple services
|
|
3900
|
+
* const context = Context.make(Logger, { log: console.log })
|
|
3901
|
+
* .pipe(Context.add(Database, { query: () => "result" }))
|
|
3650
3902
|
*
|
|
3651
3903
|
* // An effect that requires both services
|
|
3652
3904
|
* const program = Effect.gen(function*() {
|
|
@@ -3656,25 +3908,25 @@ export const provide = internalLayer.provide;
|
|
|
3656
3908
|
* return db.query("SELECT * FROM users")
|
|
3657
3909
|
* })
|
|
3658
3910
|
*
|
|
3659
|
-
* const provided = Effect.
|
|
3911
|
+
* const provided = Effect.provideContext(program, context)
|
|
3660
3912
|
* ```
|
|
3661
3913
|
*
|
|
3662
3914
|
* @since 2.0.0
|
|
3663
3915
|
* @category Environment
|
|
3664
3916
|
*/
|
|
3665
|
-
export const
|
|
3917
|
+
export const provideContext = internal.provideContext;
|
|
3666
3918
|
/**
|
|
3667
3919
|
* Accesses a service from the context.
|
|
3668
3920
|
*
|
|
3669
3921
|
* @example
|
|
3670
3922
|
* ```ts
|
|
3671
|
-
* import { Effect,
|
|
3923
|
+
* import { Effect, Context } from "effect"
|
|
3672
3924
|
*
|
|
3673
3925
|
* interface Database {
|
|
3674
3926
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
3675
3927
|
* }
|
|
3676
3928
|
*
|
|
3677
|
-
* const Database =
|
|
3929
|
+
* const Database = Context.Service<Database>("Database")
|
|
3678
3930
|
*
|
|
3679
3931
|
* const program = Effect.gen(function*() {
|
|
3680
3932
|
* const db = yield* Effect.service(Database)
|
|
@@ -3683,7 +3935,7 @@ export const provideServices = internal.provideServices;
|
|
|
3683
3935
|
* ```
|
|
3684
3936
|
*
|
|
3685
3937
|
* @since 4.0.0
|
|
3686
|
-
* @category
|
|
3938
|
+
* @category Context
|
|
3687
3939
|
*/
|
|
3688
3940
|
export const service = internal.service;
|
|
3689
3941
|
/**
|
|
@@ -3698,10 +3950,10 @@ export const service = internal.service;
|
|
|
3698
3950
|
*
|
|
3699
3951
|
* @example
|
|
3700
3952
|
* ```ts
|
|
3701
|
-
* import { Effect, Option,
|
|
3953
|
+
* import { Effect, Option, Context } from "effect"
|
|
3702
3954
|
*
|
|
3703
3955
|
* // Define a service key
|
|
3704
|
-
* const Logger =
|
|
3956
|
+
* const Logger = Context.Service<{
|
|
3705
3957
|
* log: (msg: string) => void
|
|
3706
3958
|
* }>("Logger")
|
|
3707
3959
|
*
|
|
@@ -3718,7 +3970,7 @@ export const service = internal.service;
|
|
|
3718
3970
|
* ```
|
|
3719
3971
|
*
|
|
3720
3972
|
* @since 2.0.0
|
|
3721
|
-
* @category
|
|
3973
|
+
* @category Context
|
|
3722
3974
|
*/
|
|
3723
3975
|
export const serviceOption = internal.serviceOption;
|
|
3724
3976
|
/**
|
|
@@ -3731,13 +3983,13 @@ export const serviceOption = internal.serviceOption;
|
|
|
3731
3983
|
*
|
|
3732
3984
|
* @example
|
|
3733
3985
|
* ```ts
|
|
3734
|
-
* import { Effect,
|
|
3986
|
+
* import { Effect, Context } from "effect"
|
|
3735
3987
|
*
|
|
3736
3988
|
* // Define services
|
|
3737
|
-
* const Logger =
|
|
3989
|
+
* const Logger = Context.Service<{
|
|
3738
3990
|
* log: (msg: string) => void
|
|
3739
3991
|
* }>("Logger")
|
|
3740
|
-
* const Config =
|
|
3992
|
+
* const Config = Context.Service<{
|
|
3741
3993
|
* name: string
|
|
3742
3994
|
* }>("Config")
|
|
3743
3995
|
*
|
|
@@ -3747,8 +3999,8 @@ export const serviceOption = internal.serviceOption;
|
|
|
3747
3999
|
*
|
|
3748
4000
|
* // Transform services by providing Config while keeping Logger requirement
|
|
3749
4001
|
* const configured = program.pipe(
|
|
3750
|
-
* Effect.
|
|
3751
|
-
*
|
|
4002
|
+
* Effect.updateContext((context: Context.Context<typeof Logger>) =>
|
|
4003
|
+
* Context.add(context, Config, { name: "World" })
|
|
3752
4004
|
* )
|
|
3753
4005
|
* )
|
|
3754
4006
|
*
|
|
@@ -3759,18 +4011,18 @@ export const serviceOption = internal.serviceOption;
|
|
|
3759
4011
|
* ```
|
|
3760
4012
|
*
|
|
3761
4013
|
* @since 4.0.0
|
|
3762
|
-
* @category
|
|
4014
|
+
* @category Context
|
|
3763
4015
|
*/
|
|
3764
|
-
export const
|
|
4016
|
+
export const updateContext = internal.updateContext;
|
|
3765
4017
|
/**
|
|
3766
4018
|
* Updates the service with the required service entry.
|
|
3767
4019
|
*
|
|
3768
4020
|
* @example
|
|
3769
4021
|
* ```ts
|
|
3770
|
-
* import { Console, Effect,
|
|
4022
|
+
* import { Console, Effect, Context } from "effect"
|
|
3771
4023
|
*
|
|
3772
4024
|
* // Define a counter service
|
|
3773
|
-
* const Counter =
|
|
4025
|
+
* const Counter = Context.Service<{ count: number }>("Counter")
|
|
3774
4026
|
*
|
|
3775
4027
|
* const program = Effect.gen(function*() {
|
|
3776
4028
|
* const updatedCounter = yield* Effect.service(Counter)
|
|
@@ -3788,7 +4040,7 @@ export const updateServices = internal.updateServices;
|
|
|
3788
4040
|
* ```
|
|
3789
4041
|
*
|
|
3790
4042
|
* @since 2.0.0
|
|
3791
|
-
* @category
|
|
4043
|
+
* @category Context
|
|
3792
4044
|
*/
|
|
3793
4045
|
export const updateService = internal.updateService;
|
|
3794
4046
|
/**
|
|
@@ -3805,10 +4057,10 @@ export const updateService = internal.updateService;
|
|
|
3805
4057
|
*
|
|
3806
4058
|
* @example
|
|
3807
4059
|
* ```ts
|
|
3808
|
-
* import { Console, Effect,
|
|
4060
|
+
* import { Console, Effect, Context } from "effect"
|
|
3809
4061
|
*
|
|
3810
4062
|
* // Define a service for configuration
|
|
3811
|
-
* const Config =
|
|
4063
|
+
* const Config = Context.Service<{
|
|
3812
4064
|
* apiUrl: string
|
|
3813
4065
|
* timeout: number
|
|
3814
4066
|
* }>("Config")
|
|
@@ -3834,7 +4086,7 @@ export const updateService = internal.updateService;
|
|
|
3834
4086
|
* ```
|
|
3835
4087
|
*
|
|
3836
4088
|
* @since 2.0.0
|
|
3837
|
-
* @category
|
|
4089
|
+
* @category Context
|
|
3838
4090
|
*/
|
|
3839
4091
|
export const provideService = internal.provideService;
|
|
3840
4092
|
/**
|
|
@@ -3849,13 +4101,13 @@ export const provideService = internal.provideService;
|
|
|
3849
4101
|
*
|
|
3850
4102
|
* @example
|
|
3851
4103
|
* ```ts
|
|
3852
|
-
* import { Console, Effect,
|
|
4104
|
+
* import { Console, Effect, Context } from "effect"
|
|
3853
4105
|
*
|
|
3854
4106
|
* // Define a database connection service
|
|
3855
4107
|
* interface DatabaseConnection {
|
|
3856
4108
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
3857
4109
|
* }
|
|
3858
|
-
* const Database =
|
|
4110
|
+
* const Database = Context.Service<DatabaseConnection>("Database")
|
|
3859
4111
|
*
|
|
3860
4112
|
* // Effect that creates a database connection
|
|
3861
4113
|
* const createConnection = Effect.gen(function*() {
|
|
@@ -3887,7 +4139,7 @@ export const provideService = internal.provideService;
|
|
|
3887
4139
|
* ```
|
|
3888
4140
|
*
|
|
3889
4141
|
* @since 2.0.0
|
|
3890
|
-
* @category
|
|
4142
|
+
* @category Context
|
|
3891
4143
|
*/
|
|
3892
4144
|
export const provideServiceEffect = internal.provideServiceEffect;
|
|
3893
4145
|
// -----------------------------------------------------------------------------
|
|
@@ -4245,9 +4497,11 @@ export const ensuring = internal.ensuring;
|
|
|
4245
4497
|
*
|
|
4246
4498
|
* @example
|
|
4247
4499
|
* ```ts
|
|
4248
|
-
* import { Cause, Console, Effect } from "effect"
|
|
4500
|
+
* import { Cause, Data, Console, Effect } from "effect"
|
|
4249
4501
|
*
|
|
4250
|
-
*
|
|
4502
|
+
* class TaskError extends Data.TaggedError("TaskError")<{ readonly message: string }> {}
|
|
4503
|
+
*
|
|
4504
|
+
* const task = Effect.fail(new TaskError({ message: "Something went wrong" }))
|
|
4251
4505
|
*
|
|
4252
4506
|
* const program = Effect.onError(
|
|
4253
4507
|
* task,
|
|
@@ -4256,8 +4510,8 @@ export const ensuring = internal.ensuring;
|
|
|
4256
4510
|
*
|
|
4257
4511
|
* Effect.runPromise(program).catch(console.error)
|
|
4258
4512
|
* // Output:
|
|
4259
|
-
* // Cleanup on error:
|
|
4260
|
-
* //
|
|
4513
|
+
* // Cleanup on error: TaskError: Something went wrong
|
|
4514
|
+
* // TaskError: Something went wrong
|
|
4261
4515
|
* ```
|
|
4262
4516
|
*
|
|
4263
4517
|
* @since 2.0.0
|
|
@@ -4266,7 +4520,7 @@ export const ensuring = internal.ensuring;
|
|
|
4266
4520
|
export const onError = internal.onError;
|
|
4267
4521
|
/**
|
|
4268
4522
|
* Runs the finalizer only when this effect fails and the `Cause` matches the
|
|
4269
|
-
*
|
|
4523
|
+
* provided predicate.
|
|
4270
4524
|
*
|
|
4271
4525
|
* @example
|
|
4272
4526
|
* ```ts
|
|
@@ -4288,6 +4542,13 @@ export const onError = internal.onError;
|
|
|
4288
4542
|
* @category Resource Management & Finalization
|
|
4289
4543
|
*/
|
|
4290
4544
|
export const onErrorIf = internal.onErrorIf;
|
|
4545
|
+
/**
|
|
4546
|
+
* Runs the finalizer only when this effect fails and the cause matches the provided `Filter`.
|
|
4547
|
+
*
|
|
4548
|
+
* @since 4.0.0
|
|
4549
|
+
* @category Resource Management & Finalization
|
|
4550
|
+
*/
|
|
4551
|
+
export const onErrorFilter = internal.onErrorFilter;
|
|
4291
4552
|
/**
|
|
4292
4553
|
* The low level primitive that powers `onExit`.
|
|
4293
4554
|
* function is used to run a finalizer when the effect exits, regardless of the
|
|
@@ -4325,20 +4586,20 @@ export const onExitPrimitive = internal.onExitPrimitive;
|
|
|
4325
4586
|
*/
|
|
4326
4587
|
export const onExit = internal.onExit;
|
|
4327
4588
|
/**
|
|
4328
|
-
* Runs the cleanup effect only when the `Exit`
|
|
4329
|
-
*
|
|
4330
|
-
* The cleanup is skipped when the filter returns `Filter.fail`.
|
|
4589
|
+
* Runs the cleanup effect only when the `Exit` satisfies the provided
|
|
4590
|
+
* predicate.
|
|
4331
4591
|
*
|
|
4332
4592
|
* @example
|
|
4333
4593
|
* ```ts
|
|
4334
|
-
* import { Console, Effect, Exit
|
|
4335
|
-
*
|
|
4336
|
-
* const exitFilter = Filter.fromPredicate(Exit.isSuccess<number, never>)
|
|
4594
|
+
* import { Console, Effect, Exit } from "effect"
|
|
4337
4595
|
*
|
|
4338
4596
|
* const program = Effect.onExitIf(
|
|
4339
4597
|
* Effect.succeed(42),
|
|
4340
|
-
*
|
|
4341
|
-
* (
|
|
4598
|
+
* Exit.isSuccess,
|
|
4599
|
+
* (exit) =>
|
|
4600
|
+
* Exit.isSuccess(exit)
|
|
4601
|
+
* ? Console.log(`Succeeded with: ${exit.value}`)
|
|
4602
|
+
* : Effect.void
|
|
4342
4603
|
* )
|
|
4343
4604
|
* ```
|
|
4344
4605
|
*
|
|
@@ -4346,6 +4607,13 @@ export const onExit = internal.onExit;
|
|
|
4346
4607
|
* @category Resource Management & Finalization
|
|
4347
4608
|
*/
|
|
4348
4609
|
export const onExitIf = internal.onExitIf;
|
|
4610
|
+
/**
|
|
4611
|
+
* Runs the cleanup effect only when the `Exit` matches the provided `Filter`.
|
|
4612
|
+
*
|
|
4613
|
+
* @since 4.0.0
|
|
4614
|
+
* @category Resource Management & Finalization
|
|
4615
|
+
*/
|
|
4616
|
+
export const onExitFilter = internal.onExitFilter;
|
|
4349
4617
|
// -----------------------------------------------------------------------------
|
|
4350
4618
|
// Caching
|
|
4351
4619
|
// -----------------------------------------------------------------------------
|
|
@@ -4561,8 +4829,8 @@ export const cachedInvalidateWithTTL = internal.cachedInvalidateWithTTL;
|
|
|
4561
4829
|
* import { Effect } from "effect"
|
|
4562
4830
|
*
|
|
4563
4831
|
* const program = Effect.gen(function*() {
|
|
4564
|
-
* yield* Effect.interrupt
|
|
4565
|
-
* yield* Effect.succeed("This won't execute")
|
|
4832
|
+
* return yield* Effect.interrupt
|
|
4833
|
+
* yield* Effect.succeed("This won't execute and is unreachable")
|
|
4566
4834
|
* })
|
|
4567
4835
|
*
|
|
4568
4836
|
* Effect.runPromise(program).catch(console.error)
|
|
@@ -4702,6 +4970,13 @@ export const uninterruptibleMask = internal.uninterruptibleMask;
|
|
|
4702
4970
|
* @category Interruption
|
|
4703
4971
|
*/
|
|
4704
4972
|
export const interruptibleMask = internal.interruptibleMask;
|
|
4973
|
+
/**
|
|
4974
|
+
* Creates an AbortSignal that is managed by the provided scope.
|
|
4975
|
+
*
|
|
4976
|
+
* @since 4.0.0
|
|
4977
|
+
* @category Interruption
|
|
4978
|
+
*/
|
|
4979
|
+
export const abortSignal = internal.abortSignal;
|
|
4705
4980
|
/**
|
|
4706
4981
|
* Repeats this effect forever (until the first error).
|
|
4707
4982
|
*
|
|
@@ -4824,7 +5099,7 @@ export const repeat = internalSchedule.repeat;
|
|
|
4824
5099
|
* attempt++
|
|
4825
5100
|
* if (attempt <= 2) {
|
|
4826
5101
|
* yield* Console.log(`Attempt ${attempt} failed`)
|
|
4827
|
-
* yield* Effect.fail(`Error ${attempt}`)
|
|
5102
|
+
* return yield* Effect.fail(`Error ${attempt}`)
|
|
4828
5103
|
* }
|
|
4829
5104
|
* yield* Console.log(`Attempt ${attempt} succeeded`)
|
|
4830
5105
|
* return "success"
|
|
@@ -5392,7 +5667,7 @@ export const withParentSpan = internal.withParentSpan;
|
|
|
5392
5667
|
* )
|
|
5393
5668
|
*
|
|
5394
5669
|
* const program = Effect.gen(function*() {
|
|
5395
|
-
* const name = yield* Effect.request(GetUser({ id: 1 }),
|
|
5670
|
+
* const name = yield* Effect.request(GetUser({ id: 1 }), resolver)
|
|
5396
5671
|
* yield* Console.log(name)
|
|
5397
5672
|
* })
|
|
5398
5673
|
* ```
|
|
@@ -5400,7 +5675,7 @@ export const withParentSpan = internal.withParentSpan;
|
|
|
5400
5675
|
export const request = internalRequest.request;
|
|
5401
5676
|
/**
|
|
5402
5677
|
* Low-level entry point that registers a request with a resolver and delivers the exit value via `onExit`.
|
|
5403
|
-
* Use this when you already have a `
|
|
5678
|
+
* Use this when you already have a `Context` and need to enqueue a request outside an `Effect`.
|
|
5404
5679
|
*
|
|
5405
5680
|
* It returns a canceler that removes the pending request entry.
|
|
5406
5681
|
*
|
|
@@ -5645,15 +5920,15 @@ export const runFork = internal.runFork;
|
|
|
5645
5920
|
*
|
|
5646
5921
|
* @example
|
|
5647
5922
|
* ```ts
|
|
5648
|
-
* import { Effect,
|
|
5923
|
+
* import { Effect, Context } from "effect"
|
|
5649
5924
|
*
|
|
5650
5925
|
* interface Logger {
|
|
5651
5926
|
* log: (message: string) => void
|
|
5652
5927
|
* }
|
|
5653
5928
|
*
|
|
5654
|
-
* const Logger =
|
|
5929
|
+
* const Logger = Context.Service<Logger>("Logger")
|
|
5655
5930
|
*
|
|
5656
|
-
* const services =
|
|
5931
|
+
* const services = Context.make(Logger, {
|
|
5657
5932
|
* log: (message) => console.log(message)
|
|
5658
5933
|
* })
|
|
5659
5934
|
*
|
|
@@ -5677,15 +5952,15 @@ export const runForkWith = internal.runForkWith;
|
|
|
5677
5952
|
*
|
|
5678
5953
|
* @example
|
|
5679
5954
|
* ```ts
|
|
5680
|
-
* import { Console, Effect, Exit,
|
|
5955
|
+
* import { Console, Effect, Exit, Context } from "effect"
|
|
5681
5956
|
*
|
|
5682
5957
|
* interface Logger {
|
|
5683
5958
|
* log: (message: string) => Effect.Effect<void>
|
|
5684
5959
|
* }
|
|
5685
5960
|
*
|
|
5686
|
-
* const Logger =
|
|
5961
|
+
* const Logger = Context.Service<Logger>("Logger")
|
|
5687
5962
|
*
|
|
5688
|
-
* const services =
|
|
5963
|
+
* const services = Context.make(Logger, {
|
|
5689
5964
|
* log: (message) => Console.log(message)
|
|
5690
5965
|
* })
|
|
5691
5966
|
*
|
|
@@ -5789,15 +6064,15 @@ export const runPromise = internal.runPromise;
|
|
|
5789
6064
|
*
|
|
5790
6065
|
* @example
|
|
5791
6066
|
* ```ts
|
|
5792
|
-
* import { Effect,
|
|
6067
|
+
* import { Effect, Context } from "effect"
|
|
5793
6068
|
*
|
|
5794
6069
|
* interface Config {
|
|
5795
6070
|
* apiUrl: string
|
|
5796
6071
|
* }
|
|
5797
6072
|
*
|
|
5798
|
-
* const Config =
|
|
6073
|
+
* const Config = Context.Service<Config>("Config")
|
|
5799
6074
|
*
|
|
5800
|
-
* const
|
|
6075
|
+
* const context = Context.make(Config, {
|
|
5801
6076
|
* apiUrl: "https://api.example.com"
|
|
5802
6077
|
* })
|
|
5803
6078
|
*
|
|
@@ -5806,7 +6081,7 @@ export const runPromise = internal.runPromise;
|
|
|
5806
6081
|
* return `Connecting to ${config.apiUrl}`
|
|
5807
6082
|
* })
|
|
5808
6083
|
*
|
|
5809
|
-
* Effect.runPromiseWith(
|
|
6084
|
+
* Effect.runPromiseWith(context)(program).then(console.log)
|
|
5810
6085
|
* ```
|
|
5811
6086
|
*
|
|
5812
6087
|
* @since 4.0.0
|
|
@@ -5866,15 +6141,15 @@ export const runPromiseExit = internal.runPromiseExit;
|
|
|
5866
6141
|
*
|
|
5867
6142
|
* @example
|
|
5868
6143
|
* ```ts
|
|
5869
|
-
* import { Effect, Exit,
|
|
6144
|
+
* import { Effect, Exit, Context } from "effect"
|
|
5870
6145
|
*
|
|
5871
6146
|
* interface Database {
|
|
5872
6147
|
* query: (sql: string) => string
|
|
5873
6148
|
* }
|
|
5874
6149
|
*
|
|
5875
|
-
* const Database =
|
|
6150
|
+
* const Database = Context.Service<Database>("Database")
|
|
5876
6151
|
*
|
|
5877
|
-
* const services =
|
|
6152
|
+
* const services = Context.make(Database, {
|
|
5878
6153
|
* query: (sql) => `Result for: ${sql}`
|
|
5879
6154
|
* })
|
|
5880
6155
|
*
|
|
@@ -5957,15 +6232,15 @@ export const runSync = internal.runSync;
|
|
|
5957
6232
|
*
|
|
5958
6233
|
* @example
|
|
5959
6234
|
* ```ts
|
|
5960
|
-
* import { Effect,
|
|
6235
|
+
* import { Effect, Context } from "effect"
|
|
5961
6236
|
*
|
|
5962
6237
|
* interface MathService {
|
|
5963
6238
|
* add: (a: number, b: number) => number
|
|
5964
6239
|
* }
|
|
5965
6240
|
*
|
|
5966
|
-
* const MathService =
|
|
6241
|
+
* const MathService = Context.Service<MathService>("MathService")
|
|
5967
6242
|
*
|
|
5968
|
-
* const
|
|
6243
|
+
* const context = Context.make(MathService, {
|
|
5969
6244
|
* add: (a, b) => a + b
|
|
5970
6245
|
* })
|
|
5971
6246
|
*
|
|
@@ -5974,7 +6249,7 @@ export const runSync = internal.runSync;
|
|
|
5974
6249
|
* return math.add(2, 3)
|
|
5975
6250
|
* })
|
|
5976
6251
|
*
|
|
5977
|
-
* const result = Effect.runSyncWith(
|
|
6252
|
+
* const result = Effect.runSyncWith(context)(program)
|
|
5978
6253
|
* console.log(result) // 5
|
|
5979
6254
|
* ```
|
|
5980
6255
|
*
|
|
@@ -6057,10 +6332,10 @@ export const runSyncExit = internal.runSyncExit;
|
|
|
6057
6332
|
*
|
|
6058
6333
|
* @example
|
|
6059
6334
|
* ```ts
|
|
6060
|
-
* import { Effect, Exit,
|
|
6335
|
+
* import { Effect, Exit, Context } from "effect"
|
|
6061
6336
|
*
|
|
6062
6337
|
* // Define a logger service
|
|
6063
|
-
* const Logger =
|
|
6338
|
+
* const Logger = Context.Service<{
|
|
6064
6339
|
* log: (msg: string) => void
|
|
6065
6340
|
* }>("Logger")
|
|
6066
6341
|
*
|
|
@@ -6070,12 +6345,12 @@ export const runSyncExit = internal.runSyncExit;
|
|
|
6070
6345
|
* return 42
|
|
6071
6346
|
* })
|
|
6072
6347
|
*
|
|
6073
|
-
* // Prepare
|
|
6074
|
-
* const
|
|
6348
|
+
* // Prepare context
|
|
6349
|
+
* const context = Context.make(Logger, {
|
|
6075
6350
|
* log: (msg) => console.log(`[LOG] ${msg}`)
|
|
6076
6351
|
* })
|
|
6077
6352
|
*
|
|
6078
|
-
* const exit = Effect.runSyncExitWith(
|
|
6353
|
+
* const exit = Effect.runSyncExitWith(context)(program)
|
|
6079
6354
|
*
|
|
6080
6355
|
* if (Exit.isSuccess(exit)) {
|
|
6081
6356
|
* console.log(`Success: ${exit.value}`)
|
|
@@ -6450,7 +6725,7 @@ export const withLogger = /*#__PURE__*/dual(2, (effect, logger) => internal.upda
|
|
|
6450
6725
|
* @since 2.0.0
|
|
6451
6726
|
* @category Logging
|
|
6452
6727
|
*/
|
|
6453
|
-
export const annotateLogs = /*#__PURE__*/dual(args =>
|
|
6728
|
+
export const annotateLogs = /*#__PURE__*/dual(args => isEffect(args[0]), (effect, ...args) => internal.updateService(effect, CurrentLogAnnotations, annotations => {
|
|
6454
6729
|
const newAnnotations = {
|
|
6455
6730
|
...annotations
|
|
6456
6731
|
};
|
|
@@ -6461,6 +6736,32 @@ export const annotateLogs = /*#__PURE__*/dual(args => core.isEffect(args[0]), (e
|
|
|
6461
6736
|
}
|
|
6462
6737
|
return newAnnotations;
|
|
6463
6738
|
}));
|
|
6739
|
+
/**
|
|
6740
|
+
* Adds log annotations to the current scope.
|
|
6741
|
+
*
|
|
6742
|
+
* This differs from `annotateLogs`, which only annotates a specific effect.
|
|
6743
|
+
* `annotateLogsScoped` updates annotations for the entire current `Scope` and
|
|
6744
|
+
* restores the previous annotations when the scope closes.
|
|
6745
|
+
*
|
|
6746
|
+
* @example
|
|
6747
|
+
* ```ts
|
|
6748
|
+
* import { Effect } from "effect"
|
|
6749
|
+
*
|
|
6750
|
+
* const program = Effect.scoped(
|
|
6751
|
+
* Effect.gen(function*() {
|
|
6752
|
+
* yield* Effect.log("before")
|
|
6753
|
+
* yield* Effect.annotateLogsScoped({ requestId: "req-123" })
|
|
6754
|
+
* yield* Effect.log("inside scope")
|
|
6755
|
+
* })
|
|
6756
|
+
* )
|
|
6757
|
+
*
|
|
6758
|
+
* Effect.runPromise(program)
|
|
6759
|
+
* ```
|
|
6760
|
+
*
|
|
6761
|
+
* @since 4.0.0
|
|
6762
|
+
* @category Logging
|
|
6763
|
+
*/
|
|
6764
|
+
export const annotateLogsScoped = internal.annotateLogsScoped;
|
|
6464
6765
|
/**
|
|
6465
6766
|
* Adds a span to each log line in this effect.
|
|
6466
6767
|
*
|
|
@@ -6626,18 +6927,20 @@ export const trackSuccesses = /*#__PURE__*/dual(args => isEffect(args[0]), (self
|
|
|
6626
6927
|
*
|
|
6627
6928
|
* @example
|
|
6628
6929
|
* ```ts
|
|
6629
|
-
* import { Effect, Metric } from "effect"
|
|
6930
|
+
* import { Data, Effect, Metric } from "effect"
|
|
6931
|
+
*
|
|
6932
|
+
* class ConnectionFailedError extends Data.TaggedError("ConnectionFailedError")<{}> {}
|
|
6630
6933
|
*
|
|
6631
6934
|
* // Track error types using frequency metric
|
|
6632
6935
|
* const errorTypeFrequency = Metric.frequency("error_types")
|
|
6633
6936
|
*
|
|
6634
|
-
* const program = Effect.fail(new
|
|
6635
|
-
* Effect.trackErrors(errorTypeFrequency, (error:
|
|
6937
|
+
* const program = Effect.fail(new ConnectionFailedError()).pipe(
|
|
6938
|
+
* Effect.trackErrors(errorTypeFrequency, (error: ConnectionFailedError) => error._tag)
|
|
6636
6939
|
* )
|
|
6637
6940
|
*
|
|
6638
6941
|
* Effect.runPromiseExit(program).then(() =>
|
|
6639
6942
|
* Effect.runPromise(Metric.value(errorTypeFrequency)).then(console.log)
|
|
6640
|
-
* // Output: { occurrences: Map(1) { "
|
|
6943
|
+
* // Output: { occurrences: Map(1) { "ConnectionFailedError" => 1 } }
|
|
6641
6944
|
* )
|
|
6642
6945
|
* ```
|
|
6643
6946
|
*
|
|
@@ -6748,7 +7051,7 @@ export const trackDuration = /*#__PURE__*/dual(args => isEffect(args[0]), (self,
|
|
|
6748
7051
|
const startTime = clock.currentTimeNanosUnsafe();
|
|
6749
7052
|
return onExit(self, () => {
|
|
6750
7053
|
const endTime = clock.currentTimeNanosUnsafe();
|
|
6751
|
-
const duration = Duration.subtract(Duration.
|
|
7054
|
+
const duration = Duration.subtract(Duration.fromInputUnsafe(endTime), Duration.fromInputUnsafe(startTime));
|
|
6752
7055
|
const input = f === undefined ? duration : internalCall(() => f(duration));
|
|
6753
7056
|
return Metric.update(metric, input);
|
|
6754
7057
|
});
|
|
@@ -6777,21 +7080,24 @@ export const trackDuration = /*#__PURE__*/dual(args => isEffect(args[0]), (self,
|
|
|
6777
7080
|
* @since 4.0.0
|
|
6778
7081
|
* @category Transactions
|
|
6779
7082
|
*/
|
|
6780
|
-
export class Transaction extends /*#__PURE__*/
|
|
7083
|
+
export class Transaction extends /*#__PURE__*/Context.Service()("effect/Effect/Transaction") {}
|
|
6781
7084
|
/**
|
|
6782
|
-
* Defines a transaction. Transactions are "all or nothing" with respect to changes
|
|
6783
|
-
* transactional values (i.e. TxRef) that occur within the transaction body.
|
|
7085
|
+
* Defines a transaction boundary. Transactions are "all or nothing" with respect to changes
|
|
7086
|
+
* made to transactional values (i.e. TxRef) that occur within the transaction body.
|
|
7087
|
+
*
|
|
7088
|
+
* If called inside an active transaction, `tx` composes with the current transaction and reuses
|
|
7089
|
+
* its journal and retry state instead of creating a nested boundary.
|
|
6784
7090
|
*
|
|
6785
7091
|
* In Effect transactions are optimistic with retry, that means transactions are retried when:
|
|
6786
7092
|
*
|
|
6787
|
-
* - the body of the transaction explicitely calls to `Effect.
|
|
7093
|
+
* - the body of the transaction explicitely calls to `Effect.txRetry` and any of the
|
|
6788
7094
|
* accessed transactional values changes.
|
|
6789
7095
|
*
|
|
6790
7096
|
* - any of the accessed transactional values change during the execution of the transaction
|
|
6791
7097
|
* due to a different transaction committing before the current.
|
|
6792
7098
|
*
|
|
6793
|
-
*
|
|
6794
|
-
*
|
|
7099
|
+
* The outermost `tx` call creates the transaction boundary and commits or rolls back the full
|
|
7100
|
+
* composed transaction.
|
|
6795
7101
|
*
|
|
6796
7102
|
* @example
|
|
6797
7103
|
* ```ts
|
|
@@ -6801,10 +7107,10 @@ export class Transaction extends /*#__PURE__*/ServiceMap.Service()("effect/Effec
|
|
|
6801
7107
|
* const ref1 = yield* TxRef.make(0)
|
|
6802
7108
|
* const ref2 = yield* TxRef.make(0)
|
|
6803
7109
|
*
|
|
6804
|
-
* //
|
|
6805
|
-
* yield* Effect.
|
|
7110
|
+
* // Nested tx calls compose into the same transaction
|
|
7111
|
+
* yield* Effect.tx(Effect.gen(function*() {
|
|
6806
7112
|
* yield* TxRef.set(ref1, 10)
|
|
6807
|
-
* yield* TxRef.set(ref2, 20)
|
|
7113
|
+
* yield* Effect.tx(TxRef.set(ref2, 20))
|
|
6808
7114
|
* const sum = (yield* TxRef.get(ref1)) + (yield* TxRef.get(ref2))
|
|
6809
7115
|
* console.log(`Transaction sum: ${sum}`)
|
|
6810
7116
|
* }))
|
|
@@ -6817,139 +7123,19 @@ export class Transaction extends /*#__PURE__*/ServiceMap.Service()("effect/Effec
|
|
|
6817
7123
|
* @since 4.0.0
|
|
6818
7124
|
* @category Transactions
|
|
6819
7125
|
*/
|
|
6820
|
-
export const
|
|
6821
|
-
|
|
6822
|
-
|
|
6823
|
-
*
|
|
6824
|
-
* @example
|
|
6825
|
-
* ```ts
|
|
6826
|
-
* import { Effect, TxRef } from "effect"
|
|
6827
|
-
*
|
|
6828
|
-
* const program = Effect.atomicWith((txState) =>
|
|
6829
|
-
* Effect.gen(function*() {
|
|
6830
|
-
* const ref = yield* TxRef.make(0)
|
|
6831
|
-
*
|
|
6832
|
-
* // Access transaction state for debugging
|
|
6833
|
-
* console.log(`Journal size: ${txState.journal.size}`)
|
|
6834
|
-
* console.log(`Retry flag: ${txState.retry}`)
|
|
6835
|
-
*
|
|
6836
|
-
* yield* TxRef.set(ref, 42)
|
|
6837
|
-
* return yield* TxRef.get(ref)
|
|
6838
|
-
* })
|
|
6839
|
-
* )
|
|
6840
|
-
*
|
|
6841
|
-
* Effect.runPromise(program).then(console.log) // 42
|
|
6842
|
-
* ```
|
|
6843
|
-
*
|
|
6844
|
-
* @since 4.0.0
|
|
6845
|
-
* @category Transactions
|
|
6846
|
-
*/
|
|
6847
|
-
export const atomicWith = f => withFiber(fiber => {
|
|
6848
|
-
// Check if transaction already exists and reuse it (composing behavior)
|
|
6849
|
-
if (fiber.services.mapUnsafe.has(Transaction.key)) {
|
|
6850
|
-
return internalCall(() => f(ServiceMap.getUnsafe(fiber.services, Transaction)));
|
|
7126
|
+
export const tx = effect => withFiber(fiber => {
|
|
7127
|
+
if (fiber.context.mapUnsafe.has(Transaction.key)) {
|
|
7128
|
+
return effect;
|
|
6851
7129
|
}
|
|
6852
|
-
//
|
|
6853
|
-
return transactionWith(f);
|
|
6854
|
-
});
|
|
6855
|
-
/**
|
|
6856
|
-
* Creates an isolated transaction that never composes with parent transactions.
|
|
6857
|
-
*
|
|
6858
|
-
* **Details**
|
|
6859
|
-
*
|
|
6860
|
-
* Unlike `Effect.atomic`, which composes with parent transactions when nested,
|
|
6861
|
-
* `Effect.transaction` always creates a new isolated transaction boundary.
|
|
6862
|
-
* This ensures complete isolation between different transaction scopes.
|
|
6863
|
-
*
|
|
6864
|
-
* **Key Differences from Effect.atomic:**
|
|
6865
|
-
* - Always creates a new transaction, even when called within another transaction
|
|
6866
|
-
* - Parent transaction failures don't affect isolated transactions
|
|
6867
|
-
* - Isolated transaction failures don't affect parent transactions
|
|
6868
|
-
* - Each transaction has its own journal and retry logic
|
|
6869
|
-
*
|
|
6870
|
-
* **When to Use:**
|
|
6871
|
-
* - When you need guaranteed isolation between transaction scopes
|
|
6872
|
-
* - For implementing independent operations that shouldn't be affected by outer transactions
|
|
6873
|
-
* - When building transaction-based systems where isolation is critical
|
|
6874
|
-
*
|
|
6875
|
-
* @example
|
|
6876
|
-
* ```ts
|
|
6877
|
-
* import { Effect, TxRef } from "effect"
|
|
6878
|
-
*
|
|
6879
|
-
* const program = Effect.gen(function*() {
|
|
6880
|
-
* const ref1 = yield* TxRef.make(0)
|
|
6881
|
-
* const ref2 = yield* TxRef.make(100)
|
|
6882
|
-
*
|
|
6883
|
-
* // Nested atomic transaction - ref1 will be part of outer transaction
|
|
6884
|
-
* yield* Effect.atomic(Effect.gen(function*() {
|
|
6885
|
-
* yield* TxRef.set(ref1, 10)
|
|
6886
|
-
*
|
|
6887
|
-
* // This atomic operation composes with the parent
|
|
6888
|
-
* yield* Effect.atomic(Effect.gen(function*() {
|
|
6889
|
-
* yield* TxRef.set(ref1, 20) // Part of same transaction
|
|
6890
|
-
* }))
|
|
6891
|
-
* }))
|
|
6892
|
-
*
|
|
6893
|
-
* // Isolated transaction - ref2 will be in its own transaction
|
|
6894
|
-
* yield* Effect.transaction(Effect.gen(function*() {
|
|
6895
|
-
* yield* TxRef.set(ref2, 200)
|
|
6896
|
-
* }))
|
|
6897
|
-
*
|
|
6898
|
-
* const val1 = yield* TxRef.get(ref1) // 20
|
|
6899
|
-
* const val2 = yield* TxRef.get(ref2) // 200
|
|
6900
|
-
* return { ref1: val1, ref2: val2 }
|
|
6901
|
-
* })
|
|
6902
|
-
* ```
|
|
6903
|
-
*
|
|
6904
|
-
* @since 4.0.0
|
|
6905
|
-
* @category Transactions
|
|
6906
|
-
*/
|
|
6907
|
-
export const transaction = effect => transactionWith(() => effect);
|
|
6908
|
-
/**
|
|
6909
|
-
* Executes a function within an isolated transaction context, providing access to the transaction state.
|
|
6910
|
-
*
|
|
6911
|
-
* This function always creates a new transaction boundary, regardless of whether it's called
|
|
6912
|
-
* within another transaction. This ensures complete isolation between transaction scopes.
|
|
6913
|
-
*
|
|
6914
|
-
* @example
|
|
6915
|
-
* ```ts
|
|
6916
|
-
* import { Effect, TxRef } from "effect"
|
|
6917
|
-
*
|
|
6918
|
-
* const program = Effect.transactionWith((txState) =>
|
|
6919
|
-
* Effect.gen(function*() {
|
|
6920
|
-
* const ref = yield* TxRef.make(0)
|
|
6921
|
-
*
|
|
6922
|
-
* // This transaction is isolated - it has its own journal
|
|
6923
|
-
* // txState.journal is independent of any parent transaction
|
|
6924
|
-
*
|
|
6925
|
-
* yield* TxRef.set(ref, 42)
|
|
6926
|
-
* return yield* TxRef.get(ref)
|
|
6927
|
-
* })
|
|
6928
|
-
* )
|
|
6929
|
-
*
|
|
6930
|
-
* // Even when nested in another atomic block, this transaction is isolated
|
|
6931
|
-
* const nestedProgram = Effect.atomic(
|
|
6932
|
-
* Effect.gen(function*() {
|
|
6933
|
-
* const result = yield* program // Runs in its own isolated transaction
|
|
6934
|
-
* return result
|
|
6935
|
-
* })
|
|
6936
|
-
* )
|
|
6937
|
-
* ```
|
|
6938
|
-
*
|
|
6939
|
-
* @since 4.0.0
|
|
6940
|
-
* @category Transactions
|
|
6941
|
-
*/
|
|
6942
|
-
export const transactionWith = f => withFiber(fiber => {
|
|
6943
|
-
// Always create a new transaction state, never compose with parent
|
|
7130
|
+
// Create transaction state only at the outermost boundary
|
|
6944
7131
|
const state = {
|
|
6945
7132
|
journal: new Map(),
|
|
6946
7133
|
retry: false
|
|
6947
7134
|
};
|
|
6948
|
-
const scheduler = fiber.currentScheduler;
|
|
6949
7135
|
let result;
|
|
6950
7136
|
return uninterruptibleMask(restore => flatMap(whileLoop({
|
|
6951
7137
|
while: () => !result,
|
|
6952
|
-
body: constant(restore(
|
|
7138
|
+
body: constant(restore(effect).pipe(provideService(Transaction, state), tapCause(() => {
|
|
6953
7139
|
if (!state.retry) return void_;
|
|
6954
7140
|
return restore(awaitPendingTransaction(state));
|
|
6955
7141
|
}), exit)),
|
|
@@ -6958,7 +7144,7 @@ export const transactionWith = f => withFiber(fiber => {
|
|
|
6958
7144
|
return clearTransaction(state);
|
|
6959
7145
|
}
|
|
6960
7146
|
if (Exit.isSuccess(exit)) {
|
|
6961
|
-
commitTransaction(
|
|
7147
|
+
commitTransaction(fiber, state);
|
|
6962
7148
|
} else {
|
|
6963
7149
|
clearTransaction(state);
|
|
6964
7150
|
}
|
|
@@ -6995,7 +7181,7 @@ const awaitPendingTransaction = state => suspend(() => {
|
|
|
6995
7181
|
return sync(clearPending);
|
|
6996
7182
|
});
|
|
6997
7183
|
});
|
|
6998
|
-
function commitTransaction(
|
|
7184
|
+
function commitTransaction(fiber, state) {
|
|
6999
7185
|
for (const [ref, {
|
|
7000
7186
|
value
|
|
7001
7187
|
}] of state.journal) {
|
|
@@ -7004,7 +7190,7 @@ function commitTransaction(scheduler, state) {
|
|
|
7004
7190
|
ref.value = value;
|
|
7005
7191
|
}
|
|
7006
7192
|
for (const pending of ref.pending.values()) {
|
|
7007
|
-
|
|
7193
|
+
fiber.currentDispatcher.scheduleTask(pending, 0);
|
|
7008
7194
|
}
|
|
7009
7195
|
ref.pending.clear();
|
|
7010
7196
|
}
|
|
@@ -7033,15 +7219,15 @@ function clearTransaction(state) {
|
|
|
7033
7219
|
* // forks a fiber that increases the value of `ref` every 100 millis
|
|
7034
7220
|
* yield* Effect.forkChild(Effect.forever(
|
|
7035
7221
|
* // update to transactional value
|
|
7036
|
-
* TxRef.update(ref, (n) => n + 1).pipe(Effect.delay("100 millis"))
|
|
7222
|
+
* Effect.tx(TxRef.update(ref, (n) => n + 1)).pipe(Effect.delay("100 millis"))
|
|
7037
7223
|
* ))
|
|
7038
7224
|
*
|
|
7039
7225
|
* // the following will retry 10 times until the `ref` value is 10
|
|
7040
|
-
* yield* Effect.
|
|
7226
|
+
* yield* Effect.tx(Effect.gen(function*() {
|
|
7041
7227
|
* const value = yield* TxRef.get(ref)
|
|
7042
7228
|
* if (value < 10) {
|
|
7043
7229
|
* yield* Effect.log(`retry due to value: ${value}`)
|
|
7044
|
-
* return yield* Effect.
|
|
7230
|
+
* return yield* Effect.txRetry
|
|
7045
7231
|
* }
|
|
7046
7232
|
* yield* Effect.log(`transaction done with value: ${value}`)
|
|
7047
7233
|
* }))
|
|
@@ -7050,7 +7236,7 @@ function clearTransaction(state) {
|
|
|
7050
7236
|
* Effect.runPromise(program).catch(console.error)
|
|
7051
7237
|
* ```
|
|
7052
7238
|
*/
|
|
7053
|
-
export const
|
|
7239
|
+
export const txRetry = /*#__PURE__*/flatMap(/*#__PURE__*/Transaction.asEffect(), state => {
|
|
7054
7240
|
state.retry = true;
|
|
7055
7241
|
return interrupt;
|
|
7056
7242
|
});
|
|
@@ -7141,18 +7327,20 @@ export const satisfiesSuccessType = () => effect => effect;
|
|
|
7141
7327
|
*
|
|
7142
7328
|
* @example
|
|
7143
7329
|
* ```ts
|
|
7144
|
-
* import { Effect } from "effect"
|
|
7330
|
+
* import { Data, Effect } from "effect"
|
|
7331
|
+
*
|
|
7332
|
+
* class ValidationError extends Data.TaggedError("ValidationError")<{}> {}
|
|
7145
7333
|
*
|
|
7146
|
-
* // Define a constraint that the error type must be
|
|
7147
|
-
* const satisfiesError = Effect.satisfiesErrorType<
|
|
7334
|
+
* // Define a constraint that the error type must be a ValidationError
|
|
7335
|
+
* const satisfiesError = Effect.satisfiesErrorType<ValidationError>()
|
|
7148
7336
|
*
|
|
7149
|
-
* // This works - Effect<number,
|
|
7150
|
-
* const validEffect = satisfiesError(Effect.fail(new
|
|
7337
|
+
* // This works - Effect<number, ValidationError, never> extends the constrained type
|
|
7338
|
+
* const validEffect = satisfiesError(Effect.fail(new ValidationError()))
|
|
7151
7339
|
*
|
|
7152
7340
|
* // This would cause a TypeScript compilation error:
|
|
7153
7341
|
* // const invalidEffect = satisfiesError(Effect.fail("string error"))
|
|
7154
7342
|
* // ^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
7155
|
-
* // Type 'string' is not assignable to type '
|
|
7343
|
+
* // Type 'string' is not assignable to type 'ValidationError'
|
|
7156
7344
|
* ```
|
|
7157
7345
|
*
|
|
7158
7346
|
* @since 4.0.0
|