effect 4.0.0-beta.5 → 4.0.0-beta.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Array.d.ts +213 -385
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +149 -102
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +82 -45
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +87 -38
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts +39 -32
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +32 -29
- package/dist/BigInt.js.map +1 -1
- package/dist/Brand.d.ts +1 -1
- package/dist/Brand.d.ts.map +1 -1
- package/dist/Brand.js +1 -1
- package/dist/Brand.js.map +1 -1
- package/dist/Cache.d.ts +14 -45
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +21 -47
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +54 -23
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Cause.js +108 -10
- package/dist/Cause.js.map +1 -1
- package/dist/Channel.d.ts +166 -48
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +182 -91
- package/dist/Channel.js.map +1 -1
- package/dist/Chunk.d.ts +112 -304
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +56 -88
- package/dist/Chunk.js.map +1 -1
- package/dist/Clock.d.ts +2 -2
- package/dist/Clock.d.ts.map +1 -1
- package/dist/Clock.js.map +1 -1
- package/dist/Combiner.d.ts +280 -13
- package/dist/Combiner.d.ts.map +1 -1
- package/dist/Combiner.js +198 -7
- package/dist/Combiner.js.map +1 -1
- package/dist/Config.d.ts +171 -11
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +69 -11
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +6 -6
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +5 -5
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Console.d.ts +2 -2
- package/dist/Console.d.ts.map +1 -1
- package/dist/Console.js.map +1 -1
- package/dist/Context.d.ts +1150 -0
- package/dist/Context.d.ts.map +1 -0
- package/dist/{ServiceMap.js → Context.js} +181 -165
- package/dist/Context.js.map +1 -0
- package/dist/Cron.d.ts +11 -7
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +120 -63
- package/dist/Cron.js.map +1 -1
- package/dist/Data.d.ts +535 -366
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js +132 -79
- package/dist/Data.js.map +1 -1
- package/dist/DateTime.d.ts +74 -255
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +17 -62
- package/dist/DateTime.js.map +1 -1
- package/dist/Deferred.d.ts +12 -5
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +13 -5
- package/dist/Deferred.js.map +1 -1
- package/dist/Duration.d.ts +62 -32
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +108 -78
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +1377 -1147
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +465 -446
- package/dist/Effect.js.map +1 -1
- package/dist/Encoding.d.ts +194 -0
- package/dist/Encoding.d.ts.map +1 -0
- package/dist/Encoding.js +352 -0
- package/dist/Encoding.js.map +1 -0
- package/dist/Equal.d.ts +276 -109
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +140 -48
- package/dist/Equal.js.map +1 -1
- package/dist/Equivalence.d.ts +60 -3
- package/dist/Equivalence.d.ts.map +1 -1
- package/dist/Equivalence.js +70 -13
- package/dist/Equivalence.js.map +1 -1
- package/dist/ErrorReporter.d.ts +374 -0
- package/dist/ErrorReporter.d.ts.map +1 -0
- package/dist/ErrorReporter.js +245 -0
- package/dist/ErrorReporter.js.map +1 -0
- package/dist/ExecutionPlan.d.ts +6 -6
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/ExecutionPlan.js +4 -4
- package/dist/ExecutionPlan.js.map +1 -1
- package/dist/Exit.d.ts +24 -12
- package/dist/Exit.d.ts.map +1 -1
- package/dist/Exit.js +8 -4
- package/dist/Exit.js.map +1 -1
- package/dist/Fiber.d.ts +10 -8
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +11 -10
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +12 -11
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +22 -21
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +10 -10
- package/dist/FiberMap.js.map +1 -1
- package/dist/FiberSet.d.ts +2 -2
- package/dist/FiberSet.d.ts.map +1 -1
- package/dist/FiberSet.js +4 -4
- package/dist/FiberSet.js.map +1 -1
- package/dist/FileSystem.d.ts +20 -19
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +17 -13
- package/dist/FileSystem.js.map +1 -1
- package/dist/Filter.d.ts +4 -37
- package/dist/Filter.d.ts.map +1 -1
- package/dist/Filter.js +0 -13
- package/dist/Filter.js.map +1 -1
- package/dist/Formatter.d.ts +131 -47
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +229 -51
- package/dist/Formatter.js.map +1 -1
- package/dist/Function.d.ts +1 -9
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +2 -10
- package/dist/Function.js.map +1 -1
- package/dist/Graph.d.ts +65 -65
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +60 -62
- package/dist/Graph.js.map +1 -1
- package/dist/Hash.js +1 -1
- package/dist/Hash.js.map +1 -1
- package/dist/HashMap.d.ts +26 -19
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashMap.js +7 -5
- package/dist/HashMap.js.map +1 -1
- package/dist/Iterable.d.ts +50 -50
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +106 -34
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonSchema.d.ts +299 -10
- package/dist/JsonSchema.d.ts.map +1 -1
- package/dist/JsonSchema.js +323 -4
- package/dist/JsonSchema.js.map +1 -1
- package/dist/Latch.d.ts +175 -0
- package/dist/Latch.d.ts.map +1 -0
- package/dist/Latch.js +130 -0
- package/dist/Latch.js.map +1 -0
- package/dist/Layer.d.ts +599 -379
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +249 -180
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +27 -26
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +21 -18
- package/dist/LayerMap.js.map +1 -1
- package/dist/LogLevel.d.ts +32 -0
- package/dist/LogLevel.d.ts.map +1 -1
- package/dist/LogLevel.js +28 -100
- package/dist/LogLevel.js.map +1 -1
- package/dist/Logger.d.ts +31 -97
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +2 -3
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +8 -8
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/ManagedRuntime.js +34 -25
- package/dist/ManagedRuntime.js.map +1 -1
- package/dist/Metric.d.ts +23 -25
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +24 -26
- package/dist/Metric.js.map +1 -1
- package/dist/MutableHashMap.d.ts +7 -0
- package/dist/MutableHashMap.d.ts.map +1 -1
- package/dist/MutableHashMap.js +8 -0
- package/dist/MutableHashMap.js.map +1 -1
- package/dist/MutableHashSet.d.ts +7 -0
- package/dist/MutableHashSet.d.ts.map +1 -1
- package/dist/MutableHashSet.js +8 -0
- package/dist/MutableHashSet.js.map +1 -1
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +3 -0
- package/dist/MutableList.js.map +1 -1
- package/dist/Newtype.d.ts +291 -0
- package/dist/Newtype.d.ts.map +1 -0
- package/dist/Newtype.js +161 -0
- package/dist/Newtype.js.map +1 -0
- package/dist/Number.d.ts +74 -18
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +46 -18
- package/dist/Number.js.map +1 -1
- package/dist/Optic.d.ts +947 -18
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +454 -5
- package/dist/Optic.js.map +1 -1
- package/dist/Option.d.ts +25 -16
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +15 -9
- package/dist/Option.js.map +1 -1
- package/dist/Order.d.ts +6 -1
- package/dist/Order.d.ts.map +1 -1
- package/dist/Order.js +19 -14
- package/dist/Order.js.map +1 -1
- package/dist/PartitionedSemaphore.d.ts +146 -15
- package/dist/PartitionedSemaphore.d.ts.map +1 -1
- package/dist/PartitionedSemaphore.js +174 -61
- package/dist/PartitionedSemaphore.js.map +1 -1
- package/dist/Path.d.ts +2 -2
- package/dist/Path.d.ts.map +1 -1
- package/dist/Path.js +2 -2
- package/dist/Path.js.map +1 -1
- package/dist/Pipeable.d.ts +17 -0
- package/dist/Pipeable.d.ts.map +1 -1
- package/dist/Pipeable.js +19 -1
- package/dist/Pipeable.js.map +1 -1
- package/dist/PlatformError.d.ts +2 -2
- package/dist/Pool.d.ts +6 -4
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +11 -9
- package/dist/Pool.js.map +1 -1
- package/dist/PubSub.d.ts +8 -6
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +18 -10
- package/dist/PubSub.js.map +1 -1
- package/dist/Pull.d.ts.map +1 -1
- package/dist/Pull.js +1 -1
- package/dist/Pull.js.map +1 -1
- package/dist/Queue.d.ts +9 -6
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +7 -5
- package/dist/Queue.js.map +1 -1
- package/dist/Random.d.ts +36 -2
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +46 -35
- package/dist/Random.js.map +1 -1
- package/dist/RcMap.d.ts +4 -4
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +13 -13
- package/dist/RcMap.js.map +1 -1
- package/dist/RcRef.d.ts +1 -1
- package/dist/RcRef.d.ts.map +1 -1
- package/dist/Record.d.ts +63 -160
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +37 -56
- package/dist/Record.js.map +1 -1
- package/dist/Redactable.d.ts +139 -62
- package/dist/Redactable.d.ts.map +1 -1
- package/dist/Redactable.js +59 -55
- package/dist/Redactable.js.map +1 -1
- package/dist/Reducer.d.ts +166 -7
- package/dist/Reducer.d.ts.map +1 -1
- package/dist/Reducer.js +135 -1
- package/dist/Reducer.js.map +1 -1
- package/dist/References.d.ts +257 -229
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +240 -259
- package/dist/References.js.map +1 -1
- package/dist/Request.d.ts +6 -6
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js +2 -1
- package/dist/Request.js.map +1 -1
- package/dist/RequestResolver.d.ts +25 -45
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +15 -36
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Resource.d.ts +0 -3
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +5 -4
- package/dist/Resource.js.map +1 -1
- package/dist/Result.d.ts +1 -1
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +1 -2
- package/dist/Result.js.map +1 -1
- package/dist/Runtime.d.ts +66 -0
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +79 -6
- package/dist/Runtime.js.map +1 -1
- package/dist/Schedule.d.ts +176 -293
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +162 -136
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts +36 -125
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +37 -126
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +3269 -394
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +2284 -282
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +7 -2
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +136 -40
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +54 -10
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +82 -23
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaParser.d.ts +44 -54
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +55 -2
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +46 -45
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +65 -38
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +252 -3
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +319 -13
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/Scope.d.ts +2 -2
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.d.ts +2 -2
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedCache.js +5 -5
- package/dist/ScopedCache.js.map +1 -1
- package/dist/Semaphore.d.ts +307 -0
- package/dist/Semaphore.d.ts.map +1 -0
- package/dist/Semaphore.js +220 -0
- package/dist/Semaphore.js.map +1 -0
- package/dist/Sink.d.ts +22 -19
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +54 -7
- package/dist/Sink.js.map +1 -1
- package/dist/Stdio.d.ts +18 -6
- package/dist/Stdio.d.ts.map +1 -1
- package/dist/Stdio.js +20 -2
- package/dist/Stdio.js.map +1 -1
- package/dist/Stream.d.ts +465 -542
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +321 -144
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +114 -47
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +29 -47
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts +23 -7
- package/dist/Struct.d.ts.map +1 -1
- package/dist/Struct.js +22 -0
- package/dist/Struct.js.map +1 -1
- package/dist/SubscriptionRef.d.ts +3 -3
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +85 -117
- package/dist/SubscriptionRef.js.map +1 -1
- package/dist/SynchronizedRef.d.ts +2 -1
- package/dist/SynchronizedRef.d.ts.map +1 -1
- package/dist/SynchronizedRef.js +2 -1
- package/dist/SynchronizedRef.js.map +1 -1
- package/dist/Terminal.d.ts +5 -4
- package/dist/Terminal.d.ts.map +1 -1
- package/dist/Terminal.js +2 -2
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +21 -20
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +13 -9
- package/dist/Tracer.js.map +1 -1
- package/dist/Trie.d.ts +44 -31
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js +13 -9
- package/dist/Trie.js.map +1 -1
- package/dist/TxChunk.d.ts +4 -4
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxChunk.js +4 -4
- package/dist/TxChunk.js.map +1 -1
- package/dist/TxDeferred.d.ts +328 -0
- package/dist/TxDeferred.d.ts.map +1 -0
- package/dist/TxDeferred.js +197 -0
- package/dist/TxDeferred.js.map +1 -0
- package/dist/TxHashMap.d.ts +105 -86
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +51 -44
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxHashSet.d.ts +2 -2
- package/dist/TxHashSet.d.ts.map +1 -1
- package/dist/TxHashSet.js +16 -15
- package/dist/TxHashSet.js.map +1 -1
- package/dist/TxPriorityQueue.d.ts +609 -0
- package/dist/TxPriorityQueue.d.ts.map +1 -0
- package/dist/TxPriorityQueue.js +416 -0
- package/dist/TxPriorityQueue.js.map +1 -0
- package/dist/TxPubSub.d.ts +585 -0
- package/dist/TxPubSub.d.ts.map +1 -0
- package/dist/TxPubSub.js +521 -0
- package/dist/TxPubSub.js.map +1 -0
- package/dist/TxQueue.d.ts +1 -1
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxQueue.js +42 -57
- package/dist/TxQueue.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +500 -0
- package/dist/TxReentrantLock.d.ts.map +1 -0
- package/dist/TxReentrantLock.js +481 -0
- package/dist/TxReentrantLock.js.map +1 -0
- package/dist/TxRef.d.ts +14 -20
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +8 -10
- package/dist/TxRef.js.map +1 -1
- package/dist/TxSemaphore.d.ts +162 -2
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +25 -10
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/TxSubscriptionRef.d.ts +508 -0
- package/dist/TxSubscriptionRef.d.ts.map +1 -0
- package/dist/TxSubscriptionRef.js +293 -0
- package/dist/TxSubscriptionRef.js.map +1 -0
- package/dist/Types.d.ts +83 -17
- package/dist/Types.d.ts.map +1 -1
- package/dist/Unify.d.ts +8 -2
- package/dist/Unify.d.ts.map +1 -1
- package/dist/Unify.js.map +1 -1
- package/dist/Utils.d.ts +137 -65
- package/dist/Utils.d.ts.map +1 -1
- package/dist/Utils.js +38 -66
- package/dist/Utils.js.map +1 -1
- package/dist/index.d.ts +888 -71
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +888 -71
- package/dist/index.js.map +1 -1
- package/dist/internal/core.js +11 -3
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/dateTime.js +77 -71
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/effect.js +343 -260
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/hashMap.js +7 -5
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/layer.js +3 -3
- package/dist/internal/layer.js.map +1 -1
- package/dist/internal/option.js +6 -0
- package/dist/internal/option.js.map +1 -1
- package/dist/internal/random.d.ts +2 -0
- package/dist/internal/random.d.ts.map +1 -0
- package/dist/internal/random.js +13 -0
- package/dist/internal/random.js.map +1 -0
- package/dist/internal/rcRef.js +11 -10
- package/dist/internal/rcRef.js.map +1 -1
- package/dist/internal/references.d.ts +2 -0
- package/dist/internal/references.d.ts.map +1 -0
- package/dist/internal/references.js +51 -0
- package/dist/internal/references.js.map +1 -0
- package/dist/internal/request.js +6 -6
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/schedule.js +1 -1
- package/dist/internal/schedule.js.map +1 -1
- package/dist/internal/schema/annotations.js +2 -0
- package/dist/internal/schema/annotations.js.map +1 -1
- package/dist/internal/schema/representation.js +86 -107
- package/dist/internal/schema/representation.js.map +1 -1
- package/dist/internal/schema/schema.d.ts +10 -1
- package/dist/internal/schema/schema.d.ts.map +1 -1
- package/dist/internal/schema/schema.js +22 -1
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/internal/schema/to-codec.js +7 -10
- package/dist/internal/schema/to-codec.js.map +1 -1
- package/dist/internal/trie.js +8 -7
- package/dist/internal/trie.js.map +1 -1
- package/dist/testing/TestClock.d.ts +8 -7
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestClock.js +6 -4
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +267 -33
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/testing/TestSchema.js +296 -23
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/testing/index.d.ts +64 -1
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +64 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +155 -73
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +29 -23
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +9 -2
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +39 -11
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +41 -47
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.d.ts +130 -0
- package/dist/unstable/ai/EmbeddingModel.d.ts.map +1 -0
- package/dist/unstable/ai/EmbeddingModel.js +127 -0
- package/dist/unstable/ai/EmbeddingModel.js.map +1 -0
- package/dist/unstable/ai/IdGenerator.d.ts +2 -2
- package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
- package/dist/unstable/ai/IdGenerator.js +2 -2
- package/dist/unstable/ai/IdGenerator.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +119 -49
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +260 -61
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +236 -141
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +71 -19
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +68 -15
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +218 -73
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Model.d.ts +27 -9
- package/dist/unstable/ai/Model.d.ts.map +1 -1
- package/dist/unstable/ai/Model.js +25 -9
- package/dist/unstable/ai/Model.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +9 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Prompt.d.ts +20 -20
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Prompt.js +6 -9
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +27 -27
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js +7 -8
- package/dist/unstable/ai/Response.js.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.d.ts +38 -0
- package/dist/unstable/ai/ResponseIdTracker.d.ts.map +1 -0
- package/dist/unstable/ai/ResponseIdTracker.js +68 -0
- package/dist/unstable/ai/ResponseIdTracker.js.map +1 -0
- package/dist/unstable/ai/Telemetry.d.ts +35 -2
- package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
- package/dist/unstable/ai/Telemetry.js +2 -2
- package/dist/unstable/ai/Telemetry.js.map +1 -1
- package/dist/unstable/ai/Tokenizer.d.ts +2 -2
- package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
- package/dist/unstable/ai/Tokenizer.js +2 -2
- package/dist/unstable/ai/Tokenizer.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +46 -16
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +68 -22
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +4 -4
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +14 -21
- package/dist/unstable/ai/Toolkit.js.map +1 -1
- package/dist/unstable/ai/index.d.ts +22 -1
- package/dist/unstable/ai/index.d.ts.map +1 -1
- package/dist/unstable/ai/index.js +22 -1
- package/dist/unstable/ai/index.js.map +1 -1
- package/dist/unstable/ai/internal/codec-transformer.js +5 -7
- package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
- package/dist/unstable/cli/Argument.d.ts +4 -7
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js +1 -3
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +55 -67
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +32 -57
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/CliOutput.d.ts +5 -4
- package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
- package/dist/unstable/cli/CliOutput.js +67 -12
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +372 -59
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +328 -66
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Completions.d.ts +97 -0
- package/dist/unstable/cli/Completions.d.ts.map +1 -0
- package/dist/unstable/cli/Completions.js +25 -0
- package/dist/unstable/cli/Completions.js.map +1 -0
- package/dist/unstable/cli/Flag.d.ts +4 -5
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +1 -1
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +125 -0
- package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -0
- package/dist/unstable/cli/GlobalFlag.js +118 -0
- package/dist/unstable/cli/GlobalFlag.js.map +1 -0
- package/dist/unstable/cli/HelpDoc.d.ts +81 -11
- package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
- package/dist/unstable/cli/Param.d.ts +34 -6
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +24 -14
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +2 -2
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js +1 -1
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/Prompt.js +266 -86
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/index.d.ts +8 -0
- package/dist/unstable/cli/index.d.ts.map +1 -1
- package/dist/unstable/cli/index.js +8 -0
- package/dist/unstable/cli/index.js.map +1 -1
- package/dist/unstable/cli/internal/command.d.ts +41 -15
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +84 -47
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/completions/bash.js.map +1 -1
- package/dist/unstable/cli/internal/completions/descriptor.d.ts +2 -0
- package/dist/unstable/cli/internal/completions/descriptor.d.ts.map +1 -0
- package/dist/unstable/cli/internal/completions/{CommandDescriptor.js → descriptor.js} +17 -5
- package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -0
- package/dist/unstable/cli/internal/completions/fish.js.map +1 -1
- package/dist/unstable/cli/internal/completions/zsh.js.map +1 -1
- package/dist/unstable/cli/internal/config.js +42 -0
- package/dist/unstable/cli/internal/config.js.map +1 -1
- package/dist/unstable/cli/internal/help.d.ts +33 -0
- package/dist/unstable/cli/internal/help.d.ts.map +1 -0
- package/dist/unstable/cli/internal/help.js +125 -0
- package/dist/unstable/cli/internal/help.js.map +1 -0
- package/dist/unstable/cli/internal/parser.js +155 -58
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cluster/ClusterCron.d.ts +1 -1
- package/dist/unstable/cluster/ClusterCron.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterCron.js +1 -1
- package/dist/unstable/cluster/ClusterCron.js.map +1 -1
- package/dist/unstable/cluster/ClusterError.d.ts +7 -7
- package/dist/unstable/cluster/ClusterSchema.d.ts +28 -7
- package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.js +28 -8
- package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +4 -2
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +97 -63
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/DeliverAt.js +1 -1
- package/dist/unstable/cluster/DeliverAt.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +18 -16
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +31 -25
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/EntityAddress.d.ts +2 -2
- package/dist/unstable/cluster/EntityAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityAddress.js +1 -1
- package/dist/unstable/cluster/EntityAddress.js.map +1 -1
- package/dist/unstable/cluster/EntityProxy.js +3 -3
- package/dist/unstable/cluster/EntityProxy.js.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.js +4 -4
- package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
- package/dist/unstable/cluster/EntityResource.d.ts +4 -4
- package/dist/unstable/cluster/EntityResource.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityResource.js +2 -2
- package/dist/unstable/cluster/EntityResource.js.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts +4 -4
- package/dist/unstable/cluster/HttpRunner.js +2 -2
- package/dist/unstable/cluster/HttpRunner.js.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.d.ts +5 -5
- package/dist/unstable/cluster/K8sHttpClient.d.ts.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.js +6 -6
- package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +21 -15
- package/dist/unstable/cluster/Message.d.ts.map +1 -1
- package/dist/unstable/cluster/Message.js +16 -8
- package/dist/unstable/cluster/Message.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +46 -23
- package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/MessageStorage.js +42 -26
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts +10 -9
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +8 -7
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/Runner.d.ts +2 -2
- package/dist/unstable/cluster/Runner.d.ts.map +1 -1
- package/dist/unstable/cluster/Runner.js +1 -1
- package/dist/unstable/cluster/Runner.js.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.d.ts +1 -1
- package/dist/unstable/cluster/RunnerAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.js +1 -1
- package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.d.ts +2 -2
- package/dist/unstable/cluster/RunnerHealth.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.js +2 -2
- package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +10 -9
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.d.ts +12 -12
- package/dist/unstable/cluster/RunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.js +3 -3
- package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +5 -4
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +18 -16
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/ShardId.d.ts +35 -49
- package/dist/unstable/cluster/ShardId.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardId.js +65 -67
- package/dist/unstable/cluster/ShardId.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts +4 -4
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +66 -54
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +28 -27
- package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.js +27 -27
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/SingletonAddress.d.ts +2 -2
- package/dist/unstable/cluster/Snowflake.d.ts +2 -2
- package/dist/unstable/cluster/Snowflake.d.ts.map +1 -1
- package/dist/unstable/cluster/Snowflake.js +2 -2
- package/dist/unstable/cluster/Snowflake.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +23 -20
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +34 -27
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/cluster/internal/entityReaper.js +4 -3
- package/dist/unstable/cluster/internal/entityReaper.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceMap.js +3 -3
- package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceRef.js +2 -1
- package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.d.ts +2 -2
- package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.js +9 -8
- package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.d.ts +40 -40
- package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js +9 -2
- package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
- package/dist/unstable/encoding/Msgpack.d.ts +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts +9 -9
- package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
- package/dist/unstable/encoding/Ndjson.js.map +1 -1
- package/dist/unstable/encoding/Sse.d.ts +4 -4
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.js +1 -1
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/eventlog/Event.d.ts +0 -6
- package/dist/unstable/eventlog/Event.d.ts.map +1 -1
- package/dist/unstable/eventlog/Event.js +0 -5
- package/dist/unstable/eventlog/Event.js.map +1 -1
- package/dist/unstable/eventlog/EventGroup.d.ts +0 -2
- package/dist/unstable/eventlog/EventGroup.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventGroup.js +0 -2
- package/dist/unstable/eventlog/EventGroup.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +28 -11
- package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventJournal.js +130 -71
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts +94 -37
- package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLog.js +225 -150
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.d.ts +11 -9
- package/dist/unstable/eventlog/EventLogEncryption.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js +15 -17
- package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +228 -0
- package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -0
- package/dist/unstable/eventlog/EventLogMessage.js +214 -0
- package/dist/unstable/eventlog/EventLogMessage.js.map +1 -0
- package/dist/unstable/eventlog/EventLogRemote.d.ts +112 -194
- package/dist/unstable/eventlog/EventLogRemote.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.js +168 -322
- package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.d.ts +26 -48
- package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.js +128 -199
- package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +60 -0
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -0
- package/dist/unstable/eventlog/EventLogServerEncrypted.js +166 -0
- package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -0
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +183 -0
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -0
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js +461 -0
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -0
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +117 -0
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts.map +1 -0
- package/dist/unstable/eventlog/EventLogSessionAuth.js +284 -0
- package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -0
- package/dist/unstable/eventlog/{SqlEventLogJournal.d.ts → SqlEventJournal.d.ts} +2 -2
- package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -0
- package/dist/unstable/eventlog/{SqlEventLogJournal.js → SqlEventJournal.js} +22 -16
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -0
- package/dist/unstable/eventlog/{SqlEventLogServer.d.ts → SqlEventLogServerEncrypted.d.ts} +5 -5
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts.map +1 -0
- package/dist/unstable/eventlog/{SqlEventLogServer.js → SqlEventLogServerEncrypted.js} +65 -24
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -0
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts +25 -0
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -0
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +354 -0
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -0
- package/dist/unstable/eventlog/index.d.ts +22 -2
- package/dist/unstable/eventlog/index.d.ts.map +1 -1
- package/dist/unstable/eventlog/index.js +22 -2
- package/dist/unstable/eventlog/index.js.map +1 -1
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.d.ts +2 -0
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.d.ts.map +1 -0
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js +89 -0
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js.map +1 -0
- package/dist/unstable/http/Cookies.d.ts +52 -7
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +27 -6
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Etag.d.ts +2 -2
- package/dist/unstable/http/Etag.d.ts.map +1 -1
- package/dist/unstable/http/Etag.js +7 -3
- package/dist/unstable/http/Etag.js.map +1 -1
- package/dist/unstable/http/FetchHttpClient.d.ts +6 -3
- package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/unstable/http/FetchHttpClient.js +5 -5
- package/dist/unstable/http/FetchHttpClient.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts +24 -4
- package/dist/unstable/http/Headers.d.ts.map +1 -1
- package/dist/unstable/http/Headers.js +42 -13
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpBody.d.ts +1 -1
- package/dist/unstable/http/HttpClient.d.ts +125 -21
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +197 -19
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientError.d.ts +8 -8
- package/dist/unstable/http/HttpClientRequest.d.ts +43 -15
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +131 -21
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts +2 -1
- package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientResponse.js +6 -1
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts +13 -11
- package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
- package/dist/unstable/http/HttpEffect.js +67 -75
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.d.ts +5 -4
- package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js +2 -2
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMethod.d.ts +4 -4
- package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
- package/dist/unstable/http/HttpMethod.js +3 -3
- package/dist/unstable/http/HttpMethod.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts +4 -9
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +47 -43
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpPlatform.d.ts +2 -2
- package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
- package/dist/unstable/http/HttpPlatform.js +5 -4
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +9 -8
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +36 -36
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServer.d.ts +2 -2
- package/dist/unstable/http/HttpServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpServer.js +4 -4
- package/dist/unstable/http/HttpServer.js.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +22 -34
- package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerError.js +39 -45
- package/dist/unstable/http/HttpServerError.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +19 -7
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +307 -13
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.d.ts +2 -2
- package/dist/unstable/http/HttpServerRespondable.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.js +5 -5
- package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +52 -5
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +240 -5
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpStaticServer.d.ts +69 -0
- package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -0
- package/dist/unstable/http/HttpStaticServer.js +353 -0
- package/dist/unstable/http/HttpStaticServer.js.map +1 -0
- package/dist/unstable/http/HttpTraceContext.d.ts +3 -2
- package/dist/unstable/http/HttpTraceContext.d.ts.map +1 -1
- package/dist/unstable/http/HttpTraceContext.js +27 -15
- package/dist/unstable/http/HttpTraceContext.js.map +1 -1
- package/dist/unstable/http/Multipart.d.ts +9 -9
- package/dist/unstable/http/Multipart.d.ts.map +1 -1
- package/dist/unstable/http/Multipart.js +7 -7
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/Url.d.ts +604 -0
- package/dist/unstable/http/Url.d.ts.map +1 -0
- package/dist/unstable/http/Url.js +256 -0
- package/dist/unstable/http/Url.js.map +1 -0
- package/dist/unstable/http/UrlParams.d.ts +19 -10
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +6 -7
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/http/index.d.ts +8 -0
- package/dist/unstable/http/index.d.ts.map +1 -1
- package/dist/unstable/http/index.js +8 -0
- package/dist/unstable/http/index.js.map +1 -1
- package/dist/unstable/http/internal/preResponseHandler.d.ts +2 -0
- package/dist/unstable/http/internal/preResponseHandler.d.ts.map +1 -0
- package/dist/unstable/http/internal/preResponseHandler.js +10 -0
- package/dist/unstable/http/internal/preResponseHandler.js.map +1 -0
- package/dist/unstable/httpapi/HttpApi.d.ts +11 -11
- package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js +8 -8
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +12 -9
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +53 -39
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +83 -7
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +79 -11
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +211 -105
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.js +53 -47
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +43 -26
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.js +125 -32
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.d.ts +9 -8
- package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.js +4 -4
- package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +49 -18
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js +38 -8
- package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts +6 -0
- package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +88 -9
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.js +86 -11
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts +9 -6
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.js +6 -6
- package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts +16 -15
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +57 -49
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/observability/Otlp.d.ts +12 -12
- package/dist/unstable/observability/Otlp.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts +2 -2
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +8 -8
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.d.ts +4 -4
- package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js +7 -4
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts +4 -4
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.js +1 -1
- package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.d.ts +2 -2
- package/dist/unstable/observability/OtlpSerialization.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.js +2 -2
- package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.d.ts +4 -4
- package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js +7 -3
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.d.ts +3 -3
- package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.js +4 -33
- package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +24 -3
- package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.js +148 -6
- package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
- package/dist/unstable/persistence/Persistable.d.ts +2 -2
- package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistable.js +1 -1
- package/dist/unstable/persistence/Persistable.js.map +1 -1
- package/dist/unstable/persistence/PersistedCache.d.ts +6 -6
- package/dist/unstable/persistence/PersistedCache.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedCache.js +12 -12
- package/dist/unstable/persistence/PersistedCache.js.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts +16 -16
- package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.js +15 -14
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/Persistence.d.ts +5 -5
- package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistence.js +5 -5
- package/dist/unstable/persistence/Persistence.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +9 -9
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +4 -4
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/persistence/Redis.d.ts +3 -3
- package/dist/unstable/persistence/Redis.d.ts.map +1 -1
- package/dist/unstable/persistence/Redis.js +2 -2
- package/dist/unstable/persistence/Redis.js.map +1 -1
- package/dist/unstable/process/ChildProcess.d.ts +5 -128
- package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcess.js +1 -65
- package/dist/unstable/process/ChildProcess.js.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.d.ts +89 -8
- package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js +22 -2
- package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +108 -47
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +105 -25
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +22 -20
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.js +58 -26
- package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.d.ts +8 -2
- package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +57 -14
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts +12 -12
- package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.js +59 -31
- package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
- package/dist/unstable/reactivity/Reactivity.d.ts +2 -2
- package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
- package/dist/unstable/reactivity/Reactivity.js +6 -6
- package/dist/unstable/reactivity/Reactivity.js.map +1 -1
- package/dist/unstable/reactivity/index.d.ts +2 -2
- package/dist/unstable/reactivity/index.d.ts.map +1 -1
- package/dist/unstable/reactivity/index.js +2 -2
- package/dist/unstable/reactivity/index.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +47 -19
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js +39 -7
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts +26 -47
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +120 -77
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcClientError.d.ts +2 -2
- package/dist/unstable/rpc/RpcGroup.d.ts +15 -11
- package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcGroup.js +30 -20
- package/dist/unstable/rpc/RpcGroup.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts +12 -12
- package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js +5 -5
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts +14 -1
- package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSchema.js +17 -2
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts +2 -2
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +46 -18
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +8 -12
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +78 -46
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/rpc/RpcWorker.d.ts +2 -2
- package/dist/unstable/rpc/RpcWorker.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcWorker.js +4 -4
- package/dist/unstable/rpc/RpcWorker.js.map +1 -1
- package/dist/unstable/rpc/Utils.d.ts +6 -3
- package/dist/unstable/rpc/Utils.d.ts.map +1 -1
- package/dist/unstable/rpc/Utils.js +48 -6
- package/dist/unstable/rpc/Utils.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts +24 -3
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js +17 -4
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +7 -7
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.js +7 -18
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +16 -15
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +22 -19
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/socket/SocketServer.d.ts +8 -5
- package/dist/unstable/socket/SocketServer.d.ts.map +1 -1
- package/dist/unstable/socket/SocketServer.js +2 -2
- package/dist/unstable/socket/SocketServer.js.map +1 -1
- package/dist/unstable/sql/Migrator.d.ts +1 -1
- package/dist/unstable/sql/Migrator.d.ts.map +1 -1
- package/dist/unstable/sql/Migrator.js +2 -2
- package/dist/unstable/sql/Migrator.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts +5 -5
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +7 -7
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/sql/SqlConnection.d.ts +2 -2
- package/dist/unstable/sql/SqlConnection.d.ts.map +1 -1
- package/dist/unstable/sql/SqlConnection.js +5 -2
- package/dist/unstable/sql/SqlConnection.js.map +1 -1
- package/dist/unstable/sql/SqlError.d.ts +237 -17
- package/dist/unstable/sql/SqlError.d.ts.map +1 -1
- package/dist/unstable/sql/SqlError.js +260 -4
- package/dist/unstable/sql/SqlError.js.map +1 -1
- package/dist/unstable/sql/SqlModel.d.ts +8 -9
- package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
- package/dist/unstable/sql/SqlModel.js +12 -38
- package/dist/unstable/sql/SqlModel.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
- package/dist/unstable/sql/SqlResolver.js +26 -17
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/sql/SqlSchema.d.ts +17 -6
- package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
- package/dist/unstable/sql/SqlSchema.js +17 -7
- package/dist/unstable/sql/SqlSchema.js.map +1 -1
- package/dist/unstable/sql/Statement.d.ts +2 -2
- package/dist/unstable/sql/Statement.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.js +2 -3
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/workers/Transferable.d.ts +4 -4
- package/dist/unstable/workers/Transferable.d.ts.map +1 -1
- package/dist/unstable/workers/Transferable.js +7 -7
- package/dist/unstable/workers/Transferable.js.map +1 -1
- package/dist/unstable/workers/Worker.d.ts +3 -3
- package/dist/unstable/workers/Worker.d.ts.map +1 -1
- package/dist/unstable/workers/Worker.js +8 -4
- package/dist/unstable/workers/Worker.js.map +1 -1
- package/dist/unstable/workers/WorkerError.d.ts +5 -5
- package/dist/unstable/workers/WorkerRunner.d.ts +2 -2
- package/dist/unstable/workers/WorkerRunner.d.ts.map +1 -1
- package/dist/unstable/workers/WorkerRunner.js +5 -2
- package/dist/unstable/workers/WorkerRunner.js.map +1 -1
- package/dist/unstable/workflow/Activity.d.ts +7 -2
- package/dist/unstable/workflow/Activity.d.ts.map +1 -1
- package/dist/unstable/workflow/Activity.js +17 -4
- package/dist/unstable/workflow/Activity.js.map +1 -1
- package/dist/unstable/workflow/DurableClock.d.ts +3 -6
- package/dist/unstable/workflow/DurableClock.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableClock.js +6 -6
- package/dist/unstable/workflow/DurableClock.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.js +15 -15
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +13 -12
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js +18 -18
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +26 -8
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +167 -17
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.js +4 -4
- package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
- package/package.json +11 -11
- package/src/Array.ts +304 -447
- package/src/BigDecimal.ts +117 -66
- package/src/BigInt.ts +49 -41
- package/src/Brand.ts +1 -1
- package/src/Cache.ts +27 -54
- package/src/Cause.ts +58 -23
- package/src/Channel.ts +693 -224
- package/src/Chunk.ts +149 -331
- package/src/Clock.ts +2 -2
- package/src/Combiner.ts +280 -13
- package/src/Config.ts +197 -27
- package/src/ConfigProvider.ts +5 -5
- package/src/Console.ts +2 -2
- package/src/Context.ts +1454 -0
- package/src/Cron.ts +155 -63
- package/src/Data.ts +539 -376
- package/src/DateTime.ts +77 -258
- package/src/Deferred.ts +15 -6
- package/src/Duration.ts +122 -66
- package/src/Effect.ts +1629 -1355
- package/src/Encoding.ts +879 -0
- package/src/Equal.ts +295 -111
- package/src/Equivalence.ts +114 -52
- package/src/ErrorReporter.ts +458 -0
- package/src/ExecutionPlan.ts +8 -9
- package/src/Exit.ts +24 -12
- package/src/Fiber.ts +17 -8
- package/src/FiberHandle.ts +15 -14
- package/src/FiberMap.ts +27 -27
- package/src/FiberSet.ts +5 -5
- package/src/FileSystem.ts +34 -30
- package/src/Filter.ts +4 -62
- package/src/Formatter.ts +253 -51
- package/src/Function.ts +2 -10
- package/src/Graph.ts +131 -117
- package/src/Hash.ts +2 -2
- package/src/HashMap.ts +26 -19
- package/src/Iterable.ts +117 -63
- package/src/JsonSchema.ts +383 -10
- package/src/Latch.ts +194 -0
- package/src/Layer.ts +728 -441
- package/src/LayerMap.ts +38 -35
- package/src/LogLevel.ts +37 -0
- package/src/Logger.ts +35 -102
- package/src/ManagedRuntime.ts +61 -48
- package/src/Metric.ts +64 -66
- package/src/MutableHashMap.ts +9 -0
- package/src/MutableHashSet.ts +9 -0
- package/src/MutableList.ts +3 -0
- package/src/Newtype.ts +308 -0
- package/src/Number.ts +98 -29
- package/src/Optic.ts +948 -19
- package/src/Option.ts +34 -24
- package/src/Order.ts +39 -32
- package/src/PartitionedSemaphore.ts +288 -56
- package/src/Path.ts +2 -2
- package/src/Pipeable.ts +32 -1
- package/src/Pool.ts +18 -16
- package/src/PubSub.ts +30 -20
- package/src/Pull.ts +1 -1
- package/src/Queue.ts +11 -9
- package/src/Random.ts +51 -14
- package/src/RcMap.ts +19 -19
- package/src/RcRef.ts +1 -1
- package/src/Record.ts +94 -199
- package/src/Redactable.ts +146 -72
- package/src/Reducer.ts +166 -7
- package/src/References.ts +283 -287
- package/src/Request.ts +8 -7
- package/src/RequestResolver.ts +34 -55
- package/src/Resource.ts +6 -5
- package/src/Result.ts +2 -4
- package/src/Runtime.ts +102 -6
- package/src/Schedule.ts +460 -451
- package/src/Scheduler.ts +52 -129
- package/src/Schema.ts +4102 -663
- package/src/SchemaAST.ts +177 -47
- package/src/SchemaGetter.ts +88 -32
- package/src/SchemaParser.ts +92 -27
- package/src/SchemaRepresentation.ts +59 -32
- package/src/SchemaTransformation.ts +364 -13
- package/src/Scope.ts +2 -2
- package/src/ScopedCache.ts +8 -8
- package/src/Semaphore.ts +442 -0
- package/src/Sink.ts +89 -34
- package/src/Stdio.ts +29 -6
- package/src/Stream.ts +898 -752
- package/src/String.ts +122 -69
- package/src/Struct.ts +33 -7
- package/src/SubscriptionRef.ts +101 -120
- package/src/SynchronizedRef.ts +3 -2
- package/src/Terminal.ts +5 -4
- package/src/Tracer.ts +23 -22
- package/src/Trie.ts +44 -31
- package/src/TxChunk.ts +26 -16
- package/src/TxDeferred.ts +391 -0
- package/src/TxHashMap.ts +347 -291
- package/src/TxHashSet.ts +54 -61
- package/src/TxPriorityQueue.ts +762 -0
- package/src/TxPubSub.ts +787 -0
- package/src/TxQueue.ts +221 -245
- package/src/TxReentrantLock.ts +729 -0
- package/src/TxRef.ts +31 -31
- package/src/TxSemaphore.ts +203 -31
- package/src/TxSubscriptionRef.ts +637 -0
- package/src/Types.ts +78 -17
- package/src/Unify.ts +26 -2
- package/src/Utils.ts +137 -111
- package/src/index.ts +898 -72
- package/src/internal/core.ts +19 -12
- package/src/internal/dateTime.ts +91 -96
- package/src/internal/effect.ts +918 -506
- package/src/internal/hashMap.ts +12 -10
- package/src/internal/layer.ts +7 -7
- package/src/internal/option.ts +7 -0
- package/src/internal/random.ts +20 -0
- package/src/internal/rcRef.ts +14 -13
- package/src/internal/references.ts +72 -0
- package/src/internal/request.ts +8 -8
- package/src/internal/schedule.ts +3 -1
- package/src/internal/schema/annotations.ts +2 -0
- package/src/internal/schema/representation.ts +81 -95
- package/src/internal/schema/schema.ts +25 -1
- package/src/internal/schema/to-codec.ts +7 -17
- package/src/internal/trie.ts +21 -15
- package/src/testing/TestClock.ts +13 -11
- package/src/testing/TestSchema.ts +333 -36
- package/src/testing/index.ts +64 -1
- package/src/unstable/ai/AiError.ts +112 -54
- package/src/unstable/ai/AnthropicStructuredOutput.ts +7 -3
- package/src/unstable/ai/Chat.ts +137 -88
- package/src/unstable/ai/EmbeddingModel.ts +209 -0
- package/src/unstable/ai/IdGenerator.ts +2 -2
- package/src/unstable/ai/LanguageModel.ts +685 -255
- package/src/unstable/ai/McpSchema.ts +84 -22
- package/src/unstable/ai/McpServer.ts +299 -87
- package/src/unstable/ai/Model.ts +44 -13
- package/src/unstable/ai/OpenAiStructuredOutput.ts +9 -2
- package/src/unstable/ai/Prompt.ts +43 -49
- package/src/unstable/ai/Response.ts +31 -33
- package/src/unstable/ai/ResponseIdTracker.ts +95 -0
- package/src/unstable/ai/Telemetry.ts +2 -2
- package/src/unstable/ai/Tokenizer.ts +2 -2
- package/src/unstable/ai/Tool.ts +62 -36
- package/src/unstable/ai/Toolkit.ts +17 -26
- package/src/unstable/ai/index.ts +24 -1
- package/src/unstable/ai/internal/codec-transformer.ts +3 -9
- package/src/unstable/cli/Argument.ts +5 -8
- package/src/unstable/cli/CliError.ts +67 -66
- package/src/unstable/cli/CliOutput.ts +87 -15
- package/src/unstable/cli/Command.ts +808 -193
- package/src/unstable/cli/Completions.ts +107 -0
- package/src/unstable/cli/Flag.ts +5 -6
- package/src/unstable/cli/GlobalFlag.ts +242 -0
- package/src/unstable/cli/HelpDoc.ts +91 -11
- package/src/unstable/cli/Param.ts +54 -27
- package/src/unstable/cli/Primitive.ts +2 -2
- package/src/unstable/cli/Prompt.ts +275 -104
- package/src/unstable/cli/index.ts +10 -0
- package/src/unstable/cli/internal/command.ts +125 -64
- package/src/unstable/cli/internal/completions/bash.ts +7 -7
- package/src/unstable/cli/internal/completions/{CommandDescriptor.ts → descriptor.ts} +16 -58
- package/src/unstable/cli/internal/completions/fish.ts +7 -7
- package/src/unstable/cli/internal/completions/zsh.ts +8 -14
- package/src/unstable/cli/internal/config.ts +49 -0
- package/src/unstable/cli/internal/help.ts +171 -0
- package/src/unstable/cli/internal/parser.ts +201 -84
- package/src/unstable/cluster/ClusterCron.ts +2 -2
- package/src/unstable/cluster/ClusterSchema.ts +38 -10
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +144 -81
- package/src/unstable/cluster/DeliverAt.ts +1 -1
- package/src/unstable/cluster/Entity.ts +59 -45
- package/src/unstable/cluster/EntityAddress.ts +1 -1
- package/src/unstable/cluster/EntityProxy.ts +3 -3
- package/src/unstable/cluster/EntityProxyServer.ts +4 -4
- package/src/unstable/cluster/EntityResource.ts +6 -6
- package/src/unstable/cluster/Envelope.ts +1 -1
- package/src/unstable/cluster/HttpRunner.ts +2 -2
- package/src/unstable/cluster/K8sHttpClient.ts +7 -7
- package/src/unstable/cluster/Message.ts +30 -17
- package/src/unstable/cluster/MessageStorage.ts +76 -46
- package/src/unstable/cluster/Reply.ts +13 -10
- package/src/unstable/cluster/Runner.ts +1 -1
- package/src/unstable/cluster/RunnerAddress.ts +1 -1
- package/src/unstable/cluster/RunnerHealth.ts +2 -2
- package/src/unstable/cluster/RunnerServer.ts +11 -14
- package/src/unstable/cluster/RunnerStorage.ts +9 -9
- package/src/unstable/cluster/Runners.ts +21 -19
- package/src/unstable/cluster/ShardId.ts +84 -74
- package/src/unstable/cluster/Sharding.ts +83 -66
- package/src/unstable/cluster/ShardingConfig.ts +39 -40
- package/src/unstable/cluster/Snowflake.ts +2 -2
- package/src/unstable/cluster/SqlMessageStorage.ts +28 -20
- package/src/unstable/cluster/SqlRunnerStorage.ts +1 -1
- package/src/unstable/cluster/internal/entityManager.ts +66 -46
- package/src/unstable/cluster/internal/entityReaper.ts +4 -3
- package/src/unstable/cluster/internal/resourceMap.ts +3 -3
- package/src/unstable/cluster/internal/resourceRef.ts +2 -1
- package/src/unstable/devtools/DevToolsClient.ts +26 -21
- package/src/unstable/devtools/DevToolsSchema.ts +16 -3
- package/src/unstable/encoding/Ndjson.ts +17 -17
- package/src/unstable/encoding/Sse.ts +3 -5
- package/src/unstable/eventlog/Event.ts +0 -8
- package/src/unstable/eventlog/EventGroup.ts +0 -4
- package/src/unstable/eventlog/EventJournal.ts +148 -80
- package/src/unstable/eventlog/EventLog.ts +360 -233
- package/src/unstable/eventlog/EventLogEncryption.ts +18 -32
- package/src/unstable/eventlog/EventLogMessage.ts +277 -0
- package/src/unstable/eventlog/EventLogRemote.ts +264 -410
- package/src/unstable/eventlog/EventLogServer.ts +183 -275
- package/src/unstable/eventlog/EventLogServerEncrypted.ts +206 -0
- package/src/unstable/eventlog/EventLogServerUnencrypted.ts +749 -0
- package/src/unstable/eventlog/EventLogSessionAuth.ts +437 -0
- package/src/unstable/eventlog/{SqlEventLogJournal.ts → SqlEventJournal.ts} +28 -20
- package/src/unstable/eventlog/{SqlEventLogServer.ts → SqlEventLogServerEncrypted.ts} +102 -40
- package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +500 -0
- package/src/unstable/eventlog/index.ts +27 -2
- package/src/unstable/eventlog/internal/identityRootSecretDerivation.ts +153 -0
- package/src/unstable/http/Cookies.ts +94 -11
- package/src/unstable/http/Etag.ts +7 -5
- package/src/unstable/http/FetchHttpClient.ts +5 -5
- package/src/unstable/http/Headers.ts +70 -20
- package/src/unstable/http/HttpClient.ts +385 -42
- package/src/unstable/http/HttpClientRequest.ts +151 -39
- package/src/unstable/http/HttpClientResponse.ts +12 -6
- package/src/unstable/http/HttpEffect.ts +86 -100
- package/src/unstable/http/HttpIncomingMessage.ts +5 -4
- package/src/unstable/http/HttpMethod.ts +16 -4
- package/src/unstable/http/HttpMiddleware.ts +50 -50
- package/src/unstable/http/HttpPlatform.ts +5 -4
- package/src/unstable/http/HttpRouter.ts +46 -46
- package/src/unstable/http/HttpServer.ts +5 -11
- package/src/unstable/http/HttpServerError.ts +45 -47
- package/src/unstable/http/HttpServerRequest.ts +414 -23
- package/src/unstable/http/HttpServerRespondable.ts +6 -6
- package/src/unstable/http/HttpServerResponse.ts +351 -13
- package/src/unstable/http/HttpStaticServer.ts +456 -0
- package/src/unstable/http/HttpTraceContext.ts +31 -17
- package/src/unstable/http/Multipart.ts +10 -10
- package/src/unstable/http/Url.ts +650 -0
- package/src/unstable/http/UrlParams.ts +31 -19
- package/src/unstable/http/index.ts +10 -0
- package/src/unstable/http/internal/preResponseHandler.ts +15 -0
- package/src/unstable/httpapi/HttpApi.ts +21 -21
- package/src/unstable/httpapi/HttpApiBuilder.ts +128 -55
- package/src/unstable/httpapi/HttpApiClient.ts +186 -34
- package/src/unstable/httpapi/HttpApiEndpoint.ts +225 -113
- package/src/unstable/httpapi/HttpApiError.ts +108 -30
- package/src/unstable/httpapi/HttpApiGroup.ts +18 -17
- package/src/unstable/httpapi/HttpApiMiddleware.ts +95 -33
- package/src/unstable/httpapi/HttpApiScalar.ts +6 -0
- package/src/unstable/httpapi/HttpApiSchema.ts +106 -11
- package/src/unstable/httpapi/HttpApiSecurity.ts +13 -13
- package/src/unstable/httpapi/OpenApi.ts +71 -58
- package/src/unstable/observability/Otlp.ts +12 -12
- package/src/unstable/observability/OtlpExporter.ts +14 -10
- package/src/unstable/observability/OtlpLogger.ts +13 -9
- package/src/unstable/observability/OtlpMetrics.ts +5 -5
- package/src/unstable/observability/OtlpSerialization.ts +2 -2
- package/src/unstable/observability/OtlpTracer.ts +14 -10
- package/src/unstable/observability/PrometheusMetrics.ts +5 -5
- package/src/unstable/persistence/KeyValueStore.ts +230 -7
- package/src/unstable/persistence/Persistable.ts +3 -3
- package/src/unstable/persistence/PersistedCache.ts +35 -21
- package/src/unstable/persistence/PersistedQueue.ts +28 -27
- package/src/unstable/persistence/Persistence.ts +7 -7
- package/src/unstable/persistence/RateLimiter.ts +7 -7
- package/src/unstable/persistence/Redis.ts +2 -2
- package/src/unstable/process/ChildProcess.ts +6 -208
- package/src/unstable/process/ChildProcessSpawner.ts +120 -15
- package/src/unstable/reactivity/Atom.ts +280 -124
- package/src/unstable/reactivity/AtomHttpApi.ts +115 -59
- package/src/unstable/reactivity/AtomRegistry.ts +70 -16
- package/src/unstable/reactivity/AtomRpc.ts +82 -37
- package/src/unstable/reactivity/Reactivity.ts +6 -6
- package/src/unstable/reactivity/index.ts +2 -2
- package/src/unstable/rpc/Rpc.ts +77 -32
- package/src/unstable/rpc/RpcClient.ts +165 -145
- package/src/unstable/rpc/RpcGroup.ts +51 -34
- package/src/unstable/rpc/RpcMiddleware.ts +28 -22
- package/src/unstable/rpc/RpcSchema.ts +24 -6
- package/src/unstable/rpc/RpcSerialization.ts +56 -18
- package/src/unstable/rpc/RpcServer.ts +97 -69
- package/src/unstable/rpc/RpcWorker.ts +5 -5
- package/src/unstable/rpc/Utils.ts +65 -5
- package/src/unstable/schema/Model.ts +35 -6
- package/src/unstable/schema/VariantSchema.ts +14 -27
- package/src/unstable/socket/Socket.ts +42 -38
- package/src/unstable/socket/SocketServer.ts +2 -2
- package/src/unstable/sql/Migrator.ts +7 -5
- package/src/unstable/sql/SqlClient.ts +13 -11
- package/src/unstable/sql/SqlConnection.ts +2 -2
- package/src/unstable/sql/SqlError.ts +365 -11
- package/src/unstable/sql/SqlModel.ts +57 -85
- package/src/unstable/sql/SqlResolver.ts +26 -16
- package/src/unstable/sql/SqlSchema.ts +42 -26
- package/src/unstable/sql/Statement.ts +2 -3
- package/src/unstable/workers/Transferable.ts +17 -19
- package/src/unstable/workers/Worker.ts +6 -5
- package/src/unstable/workers/WorkerRunner.ts +2 -2
- package/src/unstable/workflow/Activity.ts +27 -4
- package/src/unstable/workflow/DurableClock.ts +11 -11
- package/src/unstable/workflow/DurableDeferred.ts +16 -16
- package/src/unstable/workflow/Workflow.ts +32 -25
- package/src/unstable/workflow/WorkflowEngine.ts +239 -25
- package/src/unstable/workflow/WorkflowProxyServer.ts +4 -4
- package/dist/NullOr.d.ts +0 -149
- package/dist/NullOr.d.ts.map +0 -1
- package/dist/NullOr.js +0 -152
- package/dist/NullOr.js.map +0 -1
- package/dist/ServiceMap.d.ts +0 -1126
- package/dist/ServiceMap.d.ts.map +0 -1
- package/dist/ServiceMap.js.map +0 -1
- package/dist/encoding/Base64.d.ts +0 -67
- package/dist/encoding/Base64.d.ts.map +0 -1
- package/dist/encoding/Base64.js +0 -146
- package/dist/encoding/Base64.js.map +0 -1
- package/dist/encoding/Base64Url.d.ts +0 -60
- package/dist/encoding/Base64Url.d.ts.map +0 -1
- package/dist/encoding/Base64Url.js +0 -89
- package/dist/encoding/Base64Url.js.map +0 -1
- package/dist/encoding/EncodingError.d.ts +0 -31
- package/dist/encoding/EncodingError.d.ts.map +0 -1
- package/dist/encoding/EncodingError.js +0 -22
- package/dist/encoding/EncodingError.js.map +0 -1
- package/dist/encoding/Hex.d.ts +0 -61
- package/dist/encoding/Hex.d.ts.map +0 -1
- package/dist/encoding/Hex.js +0 -115
- package/dist/encoding/Hex.js.map +0 -1
- package/dist/encoding/index.d.ts +0 -26
- package/dist/encoding/index.d.ts.map +0 -1
- package/dist/encoding/index.js +0 -27
- package/dist/encoding/index.js.map +0 -1
- package/dist/unstable/cli/internal/builtInFlags.d.ts +0 -7
- package/dist/unstable/cli/internal/builtInFlags.d.ts.map +0 -1
- package/dist/unstable/cli/internal/builtInFlags.js +0 -44
- package/dist/unstable/cli/internal/builtInFlags.js.map +0 -1
- package/dist/unstable/cli/internal/completions/CommandDescriptor.d.ts +0 -2
- package/dist/unstable/cli/internal/completions/CommandDescriptor.d.ts.map +0 -1
- package/dist/unstable/cli/internal/completions/CommandDescriptor.js.map +0 -1
- package/dist/unstable/cli/internal/completions/Completions.d.ts +0 -2
- package/dist/unstable/cli/internal/completions/Completions.d.ts.map +0 -1
- package/dist/unstable/cli/internal/completions/Completions.js +0 -23
- package/dist/unstable/cli/internal/completions/Completions.js.map +0 -1
- package/dist/unstable/eventlog/SqlEventLogJournal.d.ts.map +0 -1
- package/dist/unstable/eventlog/SqlEventLogJournal.js.map +0 -1
- package/dist/unstable/eventlog/SqlEventLogServer.d.ts.map +0 -1
- package/dist/unstable/eventlog/SqlEventLogServer.js.map +0 -1
- package/src/NullOr.ts +0 -204
- package/src/ServiceMap.ts +0 -1410
- package/src/encoding/Base64.ts +0 -366
- package/src/encoding/Base64Url.ts +0 -104
- package/src/encoding/EncodingError.ts +0 -35
- package/src/encoding/Hex.ts +0 -390
- package/src/encoding/index.ts +0 -31
- package/src/unstable/cli/internal/builtInFlags.ts +0 -78
- package/src/unstable/cli/internal/completions/Completions.ts +0 -31
package/dist/Layer.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import * as Context from "./Context.js";
|
|
1
2
|
import * as Deferred from "./Deferred.js";
|
|
2
3
|
import { constant, constTrue, constUndefined, dual, identity } from "./Function.js";
|
|
3
4
|
import * as core from "./internal/core.js";
|
|
@@ -7,7 +8,6 @@ import { pipeArguments } from "./Pipeable.js";
|
|
|
7
8
|
import { hasProperty } from "./Predicate.js";
|
|
8
9
|
import { CurrentStackFrame } from "./References.js";
|
|
9
10
|
import * as Scope from "./Scope.js";
|
|
10
|
-
import * as ServiceMap from "./ServiceMap.js";
|
|
11
11
|
import * as Tracer from "./Tracer.js";
|
|
12
12
|
const TypeId = "~effect/Layer";
|
|
13
13
|
const MemoMapTypeId = "~effect/Layer/MemoMap";
|
|
@@ -16,14 +16,14 @@ const MemoMapTypeId = "~effect/Layer/MemoMap";
|
|
|
16
16
|
*
|
|
17
17
|
* @example
|
|
18
18
|
* ```ts
|
|
19
|
-
* import { Effect, Layer,
|
|
19
|
+
* import { Effect, Layer, Context } from "effect"
|
|
20
20
|
*
|
|
21
|
-
* class Database extends
|
|
21
|
+
* class Database extends Context.Service<Database, {
|
|
22
22
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
23
23
|
* }>()("Database") {}
|
|
24
24
|
*
|
|
25
25
|
* const dbLayer = Layer.succeed(Database)({
|
|
26
|
-
* query: (sql: string) => Effect.succeed("result")
|
|
26
|
+
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
|
27
27
|
* })
|
|
28
28
|
* const notALayer = { someProperty: "value" }
|
|
29
29
|
*
|
|
@@ -58,15 +58,15 @@ const fromBuildUnsafe = build => {
|
|
|
58
58
|
*
|
|
59
59
|
* @example
|
|
60
60
|
* ```ts
|
|
61
|
-
* import { Effect, Layer,
|
|
61
|
+
* import { Effect, Layer, Context } from "effect"
|
|
62
62
|
*
|
|
63
|
-
* class Database extends
|
|
63
|
+
* class Database extends Context.Service<Database, {
|
|
64
64
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
65
65
|
* }>()("Database") {}
|
|
66
66
|
*
|
|
67
67
|
* const databaseLayer = Layer.fromBuild(() =>
|
|
68
68
|
* Effect.sync(() =>
|
|
69
|
-
*
|
|
69
|
+
* Context.make(Database, {
|
|
70
70
|
* query: (sql: string) => Effect.succeed("result")
|
|
71
71
|
* })
|
|
72
72
|
* )
|
|
@@ -89,15 +89,15 @@ export const fromBuild = build => fromBuildUnsafe((memoMap, scope) => {
|
|
|
89
89
|
*
|
|
90
90
|
* @example
|
|
91
91
|
* ```ts
|
|
92
|
-
* import { Effect, Layer,
|
|
92
|
+
* import { Effect, Layer, Context } from "effect"
|
|
93
93
|
*
|
|
94
|
-
* class Database extends
|
|
94
|
+
* class Database extends Context.Service<Database, {
|
|
95
95
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
96
96
|
* }>()("Database") {}
|
|
97
97
|
*
|
|
98
98
|
* const databaseLayer = Layer.fromBuildMemo(() =>
|
|
99
99
|
* Effect.sync(() =>
|
|
100
|
-
*
|
|
100
|
+
* Context.make(Database, {
|
|
101
101
|
* query: (sql: string) => Effect.succeed("result")
|
|
102
102
|
* })
|
|
103
103
|
* )
|
|
@@ -148,9 +148,9 @@ class MemoMapImpl {
|
|
|
148
148
|
*
|
|
149
149
|
* @example
|
|
150
150
|
* ```ts
|
|
151
|
-
* import { Effect, Layer,
|
|
151
|
+
* import { Effect, Layer, Context } from "effect"
|
|
152
152
|
*
|
|
153
|
-
* class Database extends
|
|
153
|
+
* class Database extends Context.Service<Database, {
|
|
154
154
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
155
155
|
* }>()("Database") {}
|
|
156
156
|
*
|
|
@@ -160,11 +160,11 @@ class MemoMapImpl {
|
|
|
160
160
|
* const scope = yield* Effect.scope
|
|
161
161
|
*
|
|
162
162
|
* const dbLayer = Layer.succeed(Database)({
|
|
163
|
-
* query: (sql: string) => Effect.succeed("result")
|
|
163
|
+
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
|
164
164
|
* })
|
|
165
|
-
* const
|
|
165
|
+
* const context = yield* Layer.buildWithMemoMap(dbLayer, memoMap, scope)
|
|
166
166
|
*
|
|
167
|
-
* return
|
|
167
|
+
* return Context.get(context, Database)
|
|
168
168
|
* })
|
|
169
169
|
* ```
|
|
170
170
|
*
|
|
@@ -177,9 +177,9 @@ export const makeMemoMapUnsafe = () => new MemoMapImpl();
|
|
|
177
177
|
*
|
|
178
178
|
* @example
|
|
179
179
|
* ```ts
|
|
180
|
-
* import { Effect, Layer,
|
|
180
|
+
* import { Effect, Layer, Context } from "effect"
|
|
181
181
|
*
|
|
182
|
-
* class Database extends
|
|
182
|
+
* class Database extends Context.Service<Database, {
|
|
183
183
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
184
184
|
* }>()("Database") {}
|
|
185
185
|
*
|
|
@@ -189,11 +189,11 @@ export const makeMemoMapUnsafe = () => new MemoMapImpl();
|
|
|
189
189
|
* const scope = yield* Effect.scope
|
|
190
190
|
*
|
|
191
191
|
* const dbLayer = Layer.succeed(Database)({
|
|
192
|
-
* query: (sql: string) => Effect.succeed("result")
|
|
192
|
+
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
|
193
193
|
* })
|
|
194
|
-
* const
|
|
194
|
+
* const context = yield* Layer.buildWithMemoMap(dbLayer, memoMap, scope)
|
|
195
195
|
*
|
|
196
|
-
* return
|
|
196
|
+
* return Context.get(context, Database)
|
|
197
197
|
* })
|
|
198
198
|
* ```
|
|
199
199
|
*
|
|
@@ -210,8 +210,8 @@ export const makeMemoMap = /*#__PURE__*/internalEffect.sync(makeMemoMapUnsafe);
|
|
|
210
210
|
* @since 3.13.0
|
|
211
211
|
* @category models
|
|
212
212
|
*/
|
|
213
|
-
export class CurrentMemoMap extends /*#__PURE__*/
|
|
214
|
-
static getOrCreate = /*#__PURE__*/
|
|
213
|
+
export class CurrentMemoMap extends /*#__PURE__*/Context.Service()("effect/Layer/CurrentMemoMap") {
|
|
214
|
+
static getOrCreate = /*#__PURE__*/Context.getOrElse(this, makeMemoMapUnsafe);
|
|
215
215
|
}
|
|
216
216
|
/**
|
|
217
217
|
* Builds a layer into an `Effect` value, using the specified `MemoMap` to memoize
|
|
@@ -219,13 +219,13 @@ export class CurrentMemoMap extends /*#__PURE__*/ServiceMap.Service()("effect/La
|
|
|
219
219
|
*
|
|
220
220
|
* @example
|
|
221
221
|
* ```ts
|
|
222
|
-
* import { Effect, Layer,
|
|
222
|
+
* import { Effect, Layer, Context } from "effect"
|
|
223
223
|
*
|
|
224
|
-
* class Database extends
|
|
224
|
+
* class Database extends Context.Service<Database, {
|
|
225
225
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
226
226
|
* }>()("Database") {}
|
|
227
227
|
*
|
|
228
|
-
* class Logger extends
|
|
228
|
+
* class Logger extends Context.Service<Logger, {
|
|
229
229
|
* readonly log: (msg: string) => Effect.Effect<void>
|
|
230
230
|
* }>()("Logger") {}
|
|
231
231
|
*
|
|
@@ -236,23 +236,23 @@ export class CurrentMemoMap extends /*#__PURE__*/ServiceMap.Service()("effect/La
|
|
|
236
236
|
*
|
|
237
237
|
* // Build database layer with memoization
|
|
238
238
|
* const dbLayer = Layer.succeed(Database)({
|
|
239
|
-
* query: (sql: string) => Effect.succeed("result")
|
|
239
|
+
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
|
240
240
|
* })
|
|
241
|
-
* const
|
|
241
|
+
* const dbContext = yield* Layer.buildWithMemoMap(dbLayer, memoMap, scope)
|
|
242
242
|
*
|
|
243
243
|
* // Build logger layer with same memoization (reuses memo if same layer)
|
|
244
244
|
* const loggerLayer = Layer.succeed(Logger)({
|
|
245
|
-
* log: (msg: string) => Effect.sync(() => console.log(msg))
|
|
245
|
+
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(msg)))
|
|
246
246
|
* })
|
|
247
|
-
* const
|
|
247
|
+
* const loggerContext = yield* Layer.buildWithMemoMap(
|
|
248
248
|
* loggerLayer,
|
|
249
249
|
* memoMap,
|
|
250
250
|
* scope
|
|
251
251
|
* )
|
|
252
252
|
*
|
|
253
253
|
* return {
|
|
254
|
-
* database:
|
|
255
|
-
* logger:
|
|
254
|
+
* database: Context.get(dbContext, Database),
|
|
255
|
+
* logger: Context.get(loggerContext, Logger)
|
|
256
256
|
* }
|
|
257
257
|
* })
|
|
258
258
|
* ```
|
|
@@ -260,29 +260,29 @@ export class CurrentMemoMap extends /*#__PURE__*/ServiceMap.Service()("effect/La
|
|
|
260
260
|
* @since 2.0.0
|
|
261
261
|
* @category memo map
|
|
262
262
|
*/
|
|
263
|
-
export const buildWithMemoMap = /*#__PURE__*/dual(3, (self, memoMap, scope) => internalEffect.provideService(internalEffect.map(self.build(memoMap, scope),
|
|
263
|
+
export const buildWithMemoMap = /*#__PURE__*/dual(3, (self, memoMap, scope) => internalEffect.provideService(internalEffect.map(self.build(memoMap, scope), Context.add(CurrentMemoMap, memoMap)), CurrentMemoMap, memoMap));
|
|
264
264
|
/**
|
|
265
265
|
* Builds a layer into a scoped value.
|
|
266
266
|
*
|
|
267
267
|
* @example
|
|
268
268
|
* ```ts
|
|
269
|
-
* import { Effect, Layer,
|
|
269
|
+
* import { Effect, Layer, Context } from "effect"
|
|
270
270
|
*
|
|
271
|
-
* class Database extends
|
|
271
|
+
* class Database extends Context.Service<Database, {
|
|
272
272
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
273
273
|
* }>()("Database") {}
|
|
274
274
|
*
|
|
275
275
|
* // Build a layer to get its services
|
|
276
276
|
* const program = Effect.gen(function*() {
|
|
277
277
|
* const dbLayer = Layer.succeed(Database)({
|
|
278
|
-
* query: (sql: string) => Effect.succeed("result")
|
|
278
|
+
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
|
279
279
|
* })
|
|
280
280
|
*
|
|
281
|
-
* // Build the layer into
|
|
282
|
-
* const
|
|
281
|
+
* // Build the layer into Context - automatically manages scope and memoization
|
|
282
|
+
* const context = yield* Layer.build(dbLayer)
|
|
283
283
|
*
|
|
284
284
|
* // Extract the specific service from the built layer
|
|
285
|
-
* const database =
|
|
285
|
+
* const database = Context.get(context, Database)
|
|
286
286
|
*
|
|
287
287
|
* return yield* database.query("SELECT * FROM users")
|
|
288
288
|
* })
|
|
@@ -291,7 +291,7 @@ export const buildWithMemoMap = /*#__PURE__*/dual(3, (self, memoMap, scope) => i
|
|
|
291
291
|
* @since 2.0.0
|
|
292
292
|
* @category destructors
|
|
293
293
|
*/
|
|
294
|
-
export const build = self => core.withFiber(fiber => buildWithMemoMap(self, CurrentMemoMap.getOrCreate(fiber.
|
|
294
|
+
export const build = self => core.withFiber(fiber => buildWithMemoMap(self, CurrentMemoMap.getOrCreate(fiber.context), Context.getUnsafe(fiber.context, Scope.Scope)));
|
|
295
295
|
/**
|
|
296
296
|
* Builds a layer into an `Effect` value. Any resources associated with this
|
|
297
297
|
* layer will be released when the specified scope is closed unless their scope
|
|
@@ -301,9 +301,9 @@ export const build = self => core.withFiber(fiber => buildWithMemoMap(self, Curr
|
|
|
301
301
|
*
|
|
302
302
|
* @example
|
|
303
303
|
* ```ts
|
|
304
|
-
* import { Effect, Layer, Scope,
|
|
304
|
+
* import { Effect, Layer, Scope, Context } from "effect"
|
|
305
305
|
*
|
|
306
|
-
* class Database extends
|
|
306
|
+
* class Database extends Context.Service<Database, {
|
|
307
307
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
308
308
|
* }>()("Database") {}
|
|
309
309
|
*
|
|
@@ -317,12 +317,12 @@ export const build = self => core.withFiber(fiber => buildWithMemoMap(self, Curr
|
|
|
317
317
|
* scope,
|
|
318
318
|
* Effect.sync(() => console.log("Database closed"))
|
|
319
319
|
* )
|
|
320
|
-
* return { query: (sql: string) => Effect.succeed(`Result: ${sql}`) }
|
|
320
|
+
* return { query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result: ${sql}`)) }
|
|
321
321
|
* }))
|
|
322
322
|
*
|
|
323
323
|
* // Build with specific scope - resources tied to this scope
|
|
324
|
-
* const
|
|
325
|
-
* const database =
|
|
324
|
+
* const context = yield* Layer.buildWithScope(dbLayer, scope)
|
|
325
|
+
* const database = Context.get(context, Database)
|
|
326
326
|
*
|
|
327
327
|
* return yield* database.query("SELECT * FROM users")
|
|
328
328
|
* // Database will be closed when scope is closed
|
|
@@ -332,29 +332,29 @@ export const build = self => core.withFiber(fiber => buildWithMemoMap(self, Curr
|
|
|
332
332
|
* @since 2.0.0
|
|
333
333
|
* @category destructors
|
|
334
334
|
*/
|
|
335
|
-
export const buildWithScope = /*#__PURE__*/dual(2, (self, scope) => core.withFiber(fiber => buildWithMemoMap(self, CurrentMemoMap.getOrCreate(fiber.
|
|
335
|
+
export const buildWithScope = /*#__PURE__*/dual(2, (self, scope) => core.withFiber(fiber => buildWithMemoMap(self, CurrentMemoMap.getOrCreate(fiber.context), scope)));
|
|
336
336
|
/**
|
|
337
337
|
* Constructs a layer from the specified value.
|
|
338
338
|
*
|
|
339
339
|
* @example
|
|
340
340
|
* ```ts
|
|
341
|
-
* import { Effect, Layer,
|
|
341
|
+
* import { Effect, Layer, Context } from "effect"
|
|
342
342
|
*
|
|
343
|
-
* class Database extends
|
|
343
|
+
* class Database extends Context.Service<Database, {
|
|
344
344
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
345
345
|
* }>()("Database") {}
|
|
346
346
|
*
|
|
347
|
-
* class Logger extends
|
|
347
|
+
* class Logger extends Context.Service<Logger, {
|
|
348
348
|
* readonly log: (msg: string) => Effect.Effect<void>
|
|
349
349
|
* }>()("Logger") {}
|
|
350
350
|
*
|
|
351
351
|
* // Create layers from concrete service implementations
|
|
352
352
|
* const databaseLayer = Layer.succeed(Database)({
|
|
353
|
-
* query: (sql: string) => Effect.succeed(`Query result: ${sql}`)
|
|
353
|
+
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Query result: ${sql}`))
|
|
354
354
|
* })
|
|
355
355
|
*
|
|
356
356
|
* const loggerLayer = Layer.succeed(Logger)({
|
|
357
|
-
* log: (msg: string) => Effect.sync(() => console.log(`[LOG] ${msg}`))
|
|
357
|
+
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(`[LOG] ${msg}`)))
|
|
358
358
|
* })
|
|
359
359
|
*
|
|
360
360
|
* // Use the layers in a program
|
|
@@ -377,47 +377,46 @@ export const buildWithScope = /*#__PURE__*/dual(2, (self, scope) => core.withFib
|
|
|
377
377
|
*/
|
|
378
378
|
export const succeed = function () {
|
|
379
379
|
if (arguments.length === 1) {
|
|
380
|
-
return resource =>
|
|
380
|
+
return resource => succeedContext(Context.make(arguments[0], resource));
|
|
381
381
|
}
|
|
382
|
-
return
|
|
382
|
+
return succeedContext(Context.make(arguments[0], arguments[1]));
|
|
383
383
|
};
|
|
384
384
|
/**
|
|
385
385
|
* Constructs a layer from the specified value, which must return one or more
|
|
386
386
|
* services.
|
|
387
387
|
*
|
|
388
388
|
* This is a more general version of `succeed` that allows you to provide multiple
|
|
389
|
-
* services at once through a `
|
|
389
|
+
* services at once through a `Context`.
|
|
390
390
|
*
|
|
391
391
|
* @example
|
|
392
392
|
* ```ts
|
|
393
|
-
* import { Effect, Layer,
|
|
393
|
+
* import { Effect, Layer, Context } from "effect"
|
|
394
394
|
*
|
|
395
|
-
* class Database extends
|
|
395
|
+
* class Database extends Context.Service<Database, {
|
|
396
396
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
397
397
|
* }>()("Database") {}
|
|
398
398
|
*
|
|
399
|
-
* class Logger extends
|
|
399
|
+
* class Logger extends Context.Service<Logger, {
|
|
400
400
|
* readonly log: (msg: string) => Effect.Effect<void>
|
|
401
401
|
* }>()("Logger") {}
|
|
402
402
|
*
|
|
403
|
-
* const
|
|
404
|
-
* query: (sql: string) => Effect.succeed("result")
|
|
405
|
-
* })
|
|
406
|
-
* .
|
|
407
|
-
*
|
|
408
|
-
*
|
|
409
|
-
*
|
|
410
|
-
* )
|
|
403
|
+
* const context = Context.make(Database, {
|
|
404
|
+
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
|
405
|
+
* }).pipe(
|
|
406
|
+
* Context.add(Logger, {
|
|
407
|
+
* log: (msg: string) => Effect.sync(() => console.log(msg))
|
|
408
|
+
* })
|
|
409
|
+
* )
|
|
411
410
|
*
|
|
412
|
-
* const layer = Layer.
|
|
411
|
+
* const layer = Layer.succeedContext(context)
|
|
413
412
|
* ```
|
|
414
413
|
*
|
|
415
414
|
* @since 2.0.0
|
|
416
415
|
* @category constructors
|
|
417
416
|
*/
|
|
418
|
-
export const
|
|
417
|
+
export const succeedContext = context => fromBuildUnsafe(constant(internalEffect.succeed(context)));
|
|
419
418
|
/**
|
|
420
|
-
* A Layer that constructs an empty
|
|
419
|
+
* A Layer that constructs an empty Context.
|
|
421
420
|
*
|
|
422
421
|
* This layer provides no services and can be used as a neutral element
|
|
423
422
|
* in layer composition or as a starting point for building layers.
|
|
@@ -432,7 +431,7 @@ export const succeedServices = services => fromBuildUnsafe(constant(internalEffe
|
|
|
432
431
|
* @since 2.0.0
|
|
433
432
|
* @category constructors
|
|
434
433
|
*/
|
|
435
|
-
export const empty = /*#__PURE__*/
|
|
434
|
+
export const empty = /*#__PURE__*/succeedContext(/*#__PURE__*/Context.empty());
|
|
436
435
|
/**
|
|
437
436
|
* Lazily constructs a layer from the specified value.
|
|
438
437
|
*
|
|
@@ -441,9 +440,9 @@ export const empty = /*#__PURE__*/succeedServices(/*#__PURE__*/ServiceMap.empty(
|
|
|
441
440
|
*
|
|
442
441
|
* @example
|
|
443
442
|
* ```ts
|
|
444
|
-
* import { Effect, Layer,
|
|
443
|
+
* import { Effect, Layer, Context } from "effect"
|
|
445
444
|
*
|
|
446
|
-
* class Database extends
|
|
445
|
+
* class Database extends Context.Service<Database, {
|
|
447
446
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
448
447
|
* }>()("Database") {}
|
|
449
448
|
*
|
|
@@ -457,27 +456,27 @@ export const empty = /*#__PURE__*/succeedServices(/*#__PURE__*/ServiceMap.empty(
|
|
|
457
456
|
*/
|
|
458
457
|
export const sync = function () {
|
|
459
458
|
if (arguments.length === 1) {
|
|
460
|
-
return evaluate =>
|
|
459
|
+
return evaluate => syncContext(() => Context.make(arguments[0], evaluate()));
|
|
461
460
|
}
|
|
462
|
-
return
|
|
461
|
+
return syncContext(() => Context.make(arguments[0], arguments[1]()));
|
|
463
462
|
};
|
|
464
463
|
/**
|
|
465
464
|
* Lazily constructs a layer from the specified value, which must return one or more
|
|
466
465
|
* services.
|
|
467
466
|
*
|
|
468
|
-
* This is a lazy version of `
|
|
467
|
+
* This is a lazy version of `succeedContext` where the Context is computed
|
|
469
468
|
* synchronously only when the layer is built.
|
|
470
469
|
*
|
|
471
470
|
* @example
|
|
472
471
|
* ```ts
|
|
473
|
-
* import { Effect, Layer,
|
|
472
|
+
* import { Effect, Layer, Context } from "effect"
|
|
474
473
|
*
|
|
475
|
-
* class Database extends
|
|
474
|
+
* class Database extends Context.Service<Database, {
|
|
476
475
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
477
476
|
* }>()("Database") {}
|
|
478
477
|
*
|
|
479
|
-
* const layer = Layer.
|
|
480
|
-
*
|
|
478
|
+
* const layer = Layer.syncContext(() =>
|
|
479
|
+
* Context.make(Database, {
|
|
481
480
|
* query: (sql: string) => Effect.succeed(`Query: ${sql}`)
|
|
482
481
|
* })
|
|
483
482
|
* )
|
|
@@ -486,7 +485,7 @@ export const sync = function () {
|
|
|
486
485
|
* @since 2.0.0
|
|
487
486
|
* @category constructors
|
|
488
487
|
*/
|
|
489
|
-
export const
|
|
488
|
+
export const syncContext = evaluate => fromBuildMemo(constant(internalEffect.sync(evaluate)));
|
|
490
489
|
/**
|
|
491
490
|
* Constructs a layer from the specified scoped effect.
|
|
492
491
|
*
|
|
@@ -502,9 +501,9 @@ export const syncServices = evaluate => fromBuildMemo(constant(internalEffect.sy
|
|
|
502
501
|
*
|
|
503
502
|
* @example
|
|
504
503
|
* ```ts
|
|
505
|
-
* import { Effect, Layer,
|
|
504
|
+
* import { Effect, Layer, Context } from "effect"
|
|
506
505
|
*
|
|
507
|
-
* class Database extends
|
|
506
|
+
* class Database extends Context.Service<Database, {
|
|
508
507
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
509
508
|
* }>()("Database") {}
|
|
510
509
|
*
|
|
@@ -524,7 +523,7 @@ export const effect = function () {
|
|
|
524
523
|
}
|
|
525
524
|
return effectImpl(arguments[0], arguments[1]);
|
|
526
525
|
};
|
|
527
|
-
const effectImpl = (service, effect) =>
|
|
526
|
+
const effectImpl = (service, effect) => effectContext(internalEffect.map(effect, value => Context.make(service, value)));
|
|
528
527
|
/**
|
|
529
528
|
* Constructs a layer from the specified scoped effect, which must return one
|
|
530
529
|
* or more services.
|
|
@@ -534,15 +533,15 @@ const effectImpl = (service, effect) => effectServices(internalEffect.map(effect
|
|
|
534
533
|
*
|
|
535
534
|
* @example
|
|
536
535
|
* ```ts
|
|
537
|
-
* import { Effect, Layer,
|
|
536
|
+
* import { Effect, Layer, Context } from "effect"
|
|
538
537
|
*
|
|
539
|
-
* class Database extends
|
|
538
|
+
* class Database extends Context.Service<
|
|
540
539
|
* Database,
|
|
541
540
|
* { readonly query: (sql: string) => Effect.Effect<string> }
|
|
542
541
|
* >()("Database") {}
|
|
543
542
|
*
|
|
544
|
-
* const layer = Layer.
|
|
545
|
-
* Effect.succeed(
|
|
543
|
+
* const layer = Layer.effectContext(
|
|
544
|
+
* Effect.succeed(Context.make(Database, {
|
|
546
545
|
* query: (sql: string) => Effect.succeed(`Query: ${sql}`)
|
|
547
546
|
* }))
|
|
548
547
|
* )
|
|
@@ -551,7 +550,7 @@ const effectImpl = (service, effect) => effectServices(internalEffect.map(effect
|
|
|
551
550
|
* @since 2.0.0
|
|
552
551
|
* @category constructors
|
|
553
552
|
*/
|
|
554
|
-
export const
|
|
553
|
+
export const effectContext = effect => fromBuildMemo((_, scope) => Scope.provide(effect, scope));
|
|
555
554
|
/**
|
|
556
555
|
* Constructs a layer from the specified scoped effect.
|
|
557
556
|
*
|
|
@@ -578,7 +577,32 @@ export const effectServices = effect => fromBuildMemo((_, scope) => Scope.provid
|
|
|
578
577
|
* @since 2.0.0
|
|
579
578
|
* @category constructors
|
|
580
579
|
*/
|
|
581
|
-
export const effectDiscard = effect =>
|
|
580
|
+
export const effectDiscard = effect => effectContext(internalEffect.as(effect, Context.empty()));
|
|
581
|
+
/**
|
|
582
|
+
* Lazily constructs a layer using the specified factory.
|
|
583
|
+
*
|
|
584
|
+
* The factory is evaluated only when the suspended layer is first built, and
|
|
585
|
+
* the result is memoized with normal layer sharing semantics.
|
|
586
|
+
*
|
|
587
|
+
* @example
|
|
588
|
+
* ```ts
|
|
589
|
+
* import { Layer, Context } from "effect"
|
|
590
|
+
*
|
|
591
|
+
* class Config extends Context.Service<Config, string>()("Config") {}
|
|
592
|
+
*
|
|
593
|
+
* const useProd = true
|
|
594
|
+
*
|
|
595
|
+
* const layer = Layer.suspend(() =>
|
|
596
|
+
* useProd
|
|
597
|
+
* ? Layer.succeed(Config)("https://api.example.com")
|
|
598
|
+
* : Layer.succeed(Config)("http://localhost:3000")
|
|
599
|
+
* )
|
|
600
|
+
* ```
|
|
601
|
+
*
|
|
602
|
+
* @since 4.0.0
|
|
603
|
+
* @category constructors
|
|
604
|
+
*/
|
|
605
|
+
export const suspend = evaluate => fromBuildMemo((memoMap, scope) => internalEffect.suspend(() => evaluate().build(memoMap, scope)));
|
|
582
606
|
/**
|
|
583
607
|
* Unwraps a Layer from an Effect, flattening the nested structure.
|
|
584
608
|
*
|
|
@@ -588,14 +612,14 @@ export const effectDiscard = effect => effectServices(internalEffect.as(effect,
|
|
|
588
612
|
*
|
|
589
613
|
* @example
|
|
590
614
|
* ```ts
|
|
591
|
-
* import { Effect, Layer,
|
|
615
|
+
* import { Effect, Layer, Context } from "effect"
|
|
592
616
|
*
|
|
593
|
-
* class Database extends
|
|
617
|
+
* class Database extends Context.Service<Database, {
|
|
594
618
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
595
619
|
* }>()("Database") {}
|
|
596
620
|
*
|
|
597
621
|
* const layerEffect = Effect.succeed(
|
|
598
|
-
* Layer.succeed(Database)({ query: (sql: string) => Effect.succeed("result") })
|
|
622
|
+
* Layer.succeed(Database)({ query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result")) })
|
|
599
623
|
* )
|
|
600
624
|
*
|
|
601
625
|
* const unwrappedLayer = Layer.unwrap(layerEffect)
|
|
@@ -605,14 +629,14 @@ export const effectDiscard = effect => effectServices(internalEffect.as(effect,
|
|
|
605
629
|
* @category utils
|
|
606
630
|
*/
|
|
607
631
|
export const unwrap = self => {
|
|
608
|
-
const service =
|
|
609
|
-
return flatMap(effect(service)(self),
|
|
632
|
+
const service = Context.Service("effect/Layer/unwrap");
|
|
633
|
+
return flatMap(effect(service)(self), Context.get(service));
|
|
610
634
|
};
|
|
611
635
|
const mergeAllEffect = (layers, memoMap, scope) => {
|
|
612
636
|
const parentScope = Scope.forkUnsafe(scope, "parallel");
|
|
613
637
|
return internalEffect.forEach(layers, layer => layer.build(memoMap, Scope.forkUnsafe(parentScope, "sequential")), {
|
|
614
638
|
concurrency: layers.length
|
|
615
|
-
}).pipe(internalEffect.map(
|
|
639
|
+
}).pipe(internalEffect.map(context => Context.mergeAll(...context)));
|
|
616
640
|
};
|
|
617
641
|
/**
|
|
618
642
|
* Combines all the provided layers concurrently, creating a new layer with merged input, error, and output types.
|
|
@@ -622,21 +646,21 @@ const mergeAllEffect = (layers, memoMap, scope) => {
|
|
|
622
646
|
*
|
|
623
647
|
* @example
|
|
624
648
|
* ```ts
|
|
625
|
-
* import { Effect, Layer,
|
|
649
|
+
* import { Effect, Layer, Context } from "effect"
|
|
626
650
|
*
|
|
627
|
-
* class Database extends
|
|
651
|
+
* class Database extends Context.Service<Database, {
|
|
628
652
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
629
653
|
* }>()("Database") {}
|
|
630
654
|
*
|
|
631
|
-
* class Logger extends
|
|
655
|
+
* class Logger extends Context.Service<Logger, {
|
|
632
656
|
* readonly log: (msg: string) => Effect.Effect<void>
|
|
633
657
|
* }>()("Logger") {}
|
|
634
658
|
*
|
|
635
659
|
* const dbLayer = Layer.succeed(Database)({
|
|
636
|
-
* query: (sql: string) => Effect.succeed("result")
|
|
660
|
+
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
|
637
661
|
* })
|
|
638
662
|
* const loggerLayer = Layer.succeed(Logger)({
|
|
639
|
-
* log: (msg: string) => Effect.sync(() => console.log(msg))
|
|
663
|
+
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(msg)))
|
|
640
664
|
* })
|
|
641
665
|
*
|
|
642
666
|
* const mergedLayer = Layer.mergeAll(dbLayer, loggerLayer)
|
|
@@ -654,21 +678,21 @@ export const mergeAll = (...layers) => fromBuild((memoMap, scope) => mergeAllEff
|
|
|
654
678
|
*
|
|
655
679
|
* @example
|
|
656
680
|
* ```ts
|
|
657
|
-
* import { Effect, Layer,
|
|
681
|
+
* import { Effect, Layer, Context } from "effect"
|
|
658
682
|
*
|
|
659
|
-
* class Database extends
|
|
683
|
+
* class Database extends Context.Service<Database, {
|
|
660
684
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
661
685
|
* }>()("Database") {}
|
|
662
686
|
*
|
|
663
|
-
* class Logger extends
|
|
687
|
+
* class Logger extends Context.Service<Logger, {
|
|
664
688
|
* readonly log: (msg: string) => Effect.Effect<void>
|
|
665
689
|
* }>()("Logger") {}
|
|
666
690
|
*
|
|
667
691
|
* const dbLayer = Layer.succeed(Database)({
|
|
668
|
-
* query: (sql: string) => Effect.succeed("result")
|
|
692
|
+
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
|
669
693
|
* })
|
|
670
694
|
* const loggerLayer = Layer.succeed(Logger)({
|
|
671
|
-
* log: (msg: string) => Effect.sync(() => console.log(msg))
|
|
695
|
+
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(msg)))
|
|
672
696
|
* })
|
|
673
697
|
*
|
|
674
698
|
* const mergedLayer = Layer.merge(dbLayer, loggerLayer)
|
|
@@ -678,7 +702,7 @@ export const mergeAll = (...layers) => fromBuild((memoMap, scope) => mergeAllEff
|
|
|
678
702
|
* @category zipping
|
|
679
703
|
*/
|
|
680
704
|
export const merge = /*#__PURE__*/dual(2, (self, that) => mergeAll(self, ...(Array.isArray(that) ? that : [that])));
|
|
681
|
-
const provideWith = (self, that, f) => fromBuild((memoMap, scope) => internalEffect.flatMap(Array.isArray(that) ? mergeAllEffect(that, memoMap, scope) : that.build(memoMap, scope), context => self.build(memoMap, scope).pipe(internalEffect.
|
|
705
|
+
const provideWith = (self, that, f) => fromBuild((memoMap, scope) => internalEffect.flatMap(Array.isArray(that) ? mergeAllEffect(that, memoMap, scope) : that.build(memoMap, scope), context => self.build(memoMap, scope).pipe(internalEffect.provideContext(context), internalEffect.map(merged => f(merged, context)))));
|
|
682
706
|
/**
|
|
683
707
|
* Feeds the output services of this builder into the input of the specified
|
|
684
708
|
* builder, resulting in a new builder with the inputs of this builder as
|
|
@@ -686,30 +710,30 @@ const provideWith = (self, that, f) => fromBuild((memoMap, scope) => internalEff
|
|
|
686
710
|
*
|
|
687
711
|
* @example
|
|
688
712
|
* ```ts
|
|
689
|
-
* import { Effect, Layer,
|
|
713
|
+
* import { Effect, Layer, Context } from "effect"
|
|
690
714
|
*
|
|
691
|
-
* class Database extends
|
|
715
|
+
* class Database extends Context.Service<Database, {
|
|
692
716
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
693
717
|
* }>()("Database") {}
|
|
694
718
|
*
|
|
695
|
-
* class UserService extends
|
|
719
|
+
* class UserService extends Context.Service<UserService, {
|
|
696
720
|
* readonly getUser: (id: string) => Effect.Effect<{
|
|
697
721
|
* id: string
|
|
698
722
|
* name: string
|
|
699
723
|
* }>
|
|
700
724
|
* }>()("UserService") {}
|
|
701
725
|
*
|
|
702
|
-
* class Logger extends
|
|
726
|
+
* class Logger extends Context.Service<Logger, {
|
|
703
727
|
* readonly log: (msg: string) => Effect.Effect<void>
|
|
704
728
|
* }>()("Logger") {}
|
|
705
729
|
*
|
|
706
730
|
* // Create dependency layers
|
|
707
731
|
* const databaseLayer = Layer.succeed(Database)({
|
|
708
|
-
* query: (sql: string) => Effect.succeed(`DB: ${sql}`)
|
|
732
|
+
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`DB: ${sql}`))
|
|
709
733
|
* })
|
|
710
734
|
*
|
|
711
735
|
* const loggerLayer = Layer.succeed(Logger)({
|
|
712
|
-
* log: (msg: string) => Effect.sync(() => console.log(`[LOG] ${msg}`))
|
|
736
|
+
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(`[LOG] ${msg}`)))
|
|
713
737
|
* })
|
|
714
738
|
*
|
|
715
739
|
* // UserService depends on Database and Logger
|
|
@@ -718,8 +742,7 @@ const provideWith = (self, that, f) => fromBuild((memoMap, scope) => internalEff
|
|
|
718
742
|
* const logger = yield* Logger
|
|
719
743
|
*
|
|
720
744
|
* return {
|
|
721
|
-
* getUser: (id: string)
|
|
722
|
-
* Effect.gen(function*() {
|
|
745
|
+
* getUser: Effect.fn("UserService.getUser")(function*(id: string) {
|
|
723
746
|
* yield* logger.log(`Looking up user ${id}`)
|
|
724
747
|
* const result = yield* database.query(
|
|
725
748
|
* `SELECT * FROM users WHERE id = ${id}`
|
|
@@ -754,17 +777,17 @@ export const provide = /*#__PURE__*/dual(2, (self, that) => provideWith(self, th
|
|
|
754
777
|
*
|
|
755
778
|
* @example
|
|
756
779
|
* ```ts
|
|
757
|
-
* import { Effect, Layer,
|
|
780
|
+
* import { Effect, Layer, Context } from "effect"
|
|
758
781
|
*
|
|
759
|
-
* class Database extends
|
|
782
|
+
* class Database extends Context.Service<Database, {
|
|
760
783
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
761
784
|
* }>()("Database") {}
|
|
762
785
|
*
|
|
763
|
-
* class Logger extends
|
|
786
|
+
* class Logger extends Context.Service<Logger, {
|
|
764
787
|
* readonly log: (msg: string) => Effect.Effect<void>
|
|
765
788
|
* }>()("Logger") {}
|
|
766
789
|
*
|
|
767
|
-
* class UserService extends
|
|
790
|
+
* class UserService extends Context.Service<UserService, {
|
|
768
791
|
* readonly getUser: (id: string) => Effect.Effect<{
|
|
769
792
|
* id: string
|
|
770
793
|
* name: string
|
|
@@ -773,11 +796,11 @@ export const provide = /*#__PURE__*/dual(2, (self, that) => provideWith(self, th
|
|
|
773
796
|
*
|
|
774
797
|
* // Create dependency layers
|
|
775
798
|
* const databaseLayer = Layer.succeed(Database)({
|
|
776
|
-
* query: (sql: string) => Effect.succeed(`DB: ${sql}`)
|
|
799
|
+
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`DB: ${sql}`))
|
|
777
800
|
* })
|
|
778
801
|
*
|
|
779
802
|
* const loggerLayer = Layer.succeed(Logger)({
|
|
780
|
-
* log: (msg: string) => Effect.sync(() => console.log(`[LOG] ${msg}`))
|
|
803
|
+
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(`[LOG] ${msg}`)))
|
|
781
804
|
* })
|
|
782
805
|
*
|
|
783
806
|
* // UserService depends on Database and Logger
|
|
@@ -786,8 +809,7 @@ export const provide = /*#__PURE__*/dual(2, (self, that) => provideWith(self, th
|
|
|
786
809
|
* const logger = yield* Logger
|
|
787
810
|
*
|
|
788
811
|
* return {
|
|
789
|
-
* getUser: (id: string)
|
|
790
|
-
* Effect.gen(function*() {
|
|
812
|
+
* getUser: Effect.fn("UserService.getUser")(function*(id: string) {
|
|
791
813
|
* yield* logger.log(`Looking up user ${id}`)
|
|
792
814
|
* const result = yield* database.query(
|
|
793
815
|
* `SELECT * FROM users WHERE id = ${id}`
|
|
@@ -820,24 +842,24 @@ export const provide = /*#__PURE__*/dual(2, (self, that) => provideWith(self, th
|
|
|
820
842
|
* @since 2.0.0
|
|
821
843
|
* @category utils
|
|
822
844
|
*/
|
|
823
|
-
export const provideMerge = /*#__PURE__*/dual(2, (self, that) => provideWith(self, that, (self, that) =>
|
|
845
|
+
export const provideMerge = /*#__PURE__*/dual(2, (self, that) => provideWith(self, that, (self, that) => Context.merge(that, self)));
|
|
824
846
|
/**
|
|
825
847
|
* Constructs a layer dynamically based on the output of this layer.
|
|
826
848
|
*
|
|
827
849
|
* @example
|
|
828
850
|
* ```ts
|
|
829
|
-
* import { Effect, Layer,
|
|
851
|
+
* import { Effect, Layer, Context } from "effect"
|
|
830
852
|
*
|
|
831
|
-
* class Config extends
|
|
853
|
+
* class Config extends Context.Service<Config, {
|
|
832
854
|
* readonly dbUrl: string
|
|
833
855
|
* readonly logLevel: string
|
|
834
856
|
* }>()("Config") {}
|
|
835
857
|
*
|
|
836
|
-
* class Database extends
|
|
858
|
+
* class Database extends Context.Service<Database, {
|
|
837
859
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
838
860
|
* }>()("Database") {}
|
|
839
861
|
*
|
|
840
|
-
* class Logger extends
|
|
862
|
+
* class Logger extends Context.Service<Logger, {
|
|
841
863
|
* readonly log: (msg: string) => Effect.Effect<void>
|
|
842
864
|
* }>()("Logger") {}
|
|
843
865
|
*
|
|
@@ -849,23 +871,24 @@ export const provideMerge = /*#__PURE__*/dual(2, (self, that) => provideWith(sel
|
|
|
849
871
|
*
|
|
850
872
|
* // Dynamically create services based on config
|
|
851
873
|
* const dynamicServiceLayer = configLayer.pipe(
|
|
852
|
-
* Layer.flatMap((
|
|
853
|
-
* const config =
|
|
874
|
+
* Layer.flatMap((context) => {
|
|
875
|
+
* const config = Context.get(context, Config)
|
|
854
876
|
*
|
|
855
877
|
* // Create database layer based on config
|
|
856
878
|
* const dbLayer = Layer.succeed(Database)({
|
|
857
|
-
* query: (sql: string) =>
|
|
879
|
+
* query: Effect.fn("Database.query")((sql: string) =>
|
|
858
880
|
* Effect.succeed(
|
|
859
881
|
* `Querying ${config.dbUrl}: ${sql}`
|
|
860
|
-
* )
|
|
882
|
+
* ))
|
|
861
883
|
* })
|
|
862
884
|
*
|
|
863
885
|
* // Create logger layer based on config
|
|
864
886
|
* const loggerLayer = Layer.succeed(Logger)({
|
|
865
|
-
* log: (msg: string) =>
|
|
887
|
+
* log: Effect.fn("Logger.log")((msg: string) =>
|
|
866
888
|
* config.logLevel === "debug"
|
|
867
889
|
* ? Effect.sync(() => console.log(`[DEBUG] ${msg}`))
|
|
868
890
|
* : Effect.sync(() => console.log(msg))
|
|
891
|
+
* )
|
|
869
892
|
* })
|
|
870
893
|
*
|
|
871
894
|
* // Return combined layer
|
|
@@ -891,19 +914,46 @@ export const provideMerge = /*#__PURE__*/dual(2, (self, that) => provideWith(sel
|
|
|
891
914
|
* @category sequencing
|
|
892
915
|
*/
|
|
893
916
|
export const flatMap = /*#__PURE__*/dual(2, (self, f) => fromBuild((memoMap, scope) => internalEffect.flatMap(self.build(memoMap, scope), context => f(context).build(memoMap, scope))));
|
|
917
|
+
/**
|
|
918
|
+
* Performs the specified effect if this layer succeeds.
|
|
919
|
+
*
|
|
920
|
+
* @since 4.0.0
|
|
921
|
+
* @category sequencing
|
|
922
|
+
*/
|
|
923
|
+
export const tap = /*#__PURE__*/dual(2, (self, f) => fromBuild((memoMap, scope) => internalEffect.flatMap(self.build(memoMap, scope), context => Scope.provide(internalEffect.as(f(context), context), scope))));
|
|
924
|
+
/**
|
|
925
|
+
* Performs the specified effect if this layer fails.
|
|
926
|
+
*
|
|
927
|
+
* @since 4.0.0
|
|
928
|
+
* @category sequencing
|
|
929
|
+
*/
|
|
930
|
+
export const tapError = /*#__PURE__*/dual(2, (self, f) => fromBuild((memoMap, scope) => internalEffect.catch_(self.build(memoMap, scope), error => Scope.provide(internalEffect.andThen(f(error), internalEffect.fail(error)), scope))));
|
|
931
|
+
/**
|
|
932
|
+
* Performs the specified effect if this layer fails.
|
|
933
|
+
*
|
|
934
|
+
* **Previously Known As**
|
|
935
|
+
*
|
|
936
|
+
* This API replaces the following from Effect 3.x:
|
|
937
|
+
*
|
|
938
|
+
* - `Layer.tapErrorCause`
|
|
939
|
+
*
|
|
940
|
+
* @since 4.0.0
|
|
941
|
+
* @category sequencing
|
|
942
|
+
*/
|
|
943
|
+
export const tapCause = /*#__PURE__*/dual(2, (self, f) => fromBuild((memoMap, scope) => internalEffect.catchCause(self.build(memoMap, scope), cause => Scope.provide(internalEffect.andThen(f(cause), internalEffect.failCause(cause)), scope))));
|
|
894
944
|
/**
|
|
895
945
|
* Translates effect failure into death of the fiber, making all failures
|
|
896
946
|
* unchecked and not a part of the type of the layer.
|
|
897
947
|
*
|
|
898
948
|
* @example
|
|
899
949
|
* ```ts
|
|
900
|
-
* import { Data, Effect, Layer,
|
|
950
|
+
* import { Data, Effect, Layer, Context } from "effect"
|
|
901
951
|
*
|
|
902
952
|
* class DatabaseError extends Data.TaggedError("DatabaseError")<{
|
|
903
953
|
* message: string
|
|
904
954
|
* }> {}
|
|
905
955
|
*
|
|
906
|
-
* class Database extends
|
|
956
|
+
* class Database extends Context.Service<Database, {
|
|
907
957
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
908
958
|
* }>()("Database") {}
|
|
909
959
|
*
|
|
@@ -912,10 +962,10 @@ export const flatMap = /*#__PURE__*/dual(2, (self, f) => fromBuild((memoMap, sco
|
|
|
912
962
|
* // Simulate a database connection that might fail
|
|
913
963
|
* const shouldFail = Math.random() > 0.5
|
|
914
964
|
* if (shouldFail) {
|
|
915
|
-
* yield*
|
|
965
|
+
* return yield* new DatabaseError({ message: "Connection failed" })
|
|
916
966
|
* }
|
|
917
967
|
*
|
|
918
|
-
* return { query: (sql: string) => Effect.succeed(`Result: ${sql}`) }
|
|
968
|
+
* return { query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result: ${sql}`)) }
|
|
919
969
|
* }))
|
|
920
970
|
*
|
|
921
971
|
* // Convert failures to fiber death - removes error from type
|
|
@@ -951,11 +1001,11 @@ catch_ as catch };
|
|
|
951
1001
|
*
|
|
952
1002
|
* @example
|
|
953
1003
|
* ```ts
|
|
954
|
-
* import { Data, Effect, Layer,
|
|
1004
|
+
* import { Data, Effect, Layer, Context } from "effect"
|
|
955
1005
|
*
|
|
956
1006
|
* class ConfigError extends Data.TaggedError("ConfigError") {}
|
|
957
1007
|
*
|
|
958
|
-
* class Config extends
|
|
1008
|
+
* class Config extends Context.Service<Config, {
|
|
959
1009
|
* readonly apiUrl: string
|
|
960
1010
|
* }>()("Config") {}
|
|
961
1011
|
*
|
|
@@ -977,7 +1027,7 @@ export const catchTag = /*#__PURE__*/dual(3, (self, k, f) => fromBuildUnsafe((me
|
|
|
977
1027
|
*
|
|
978
1028
|
* @example
|
|
979
1029
|
* ```ts
|
|
980
|
-
* import { Data, Effect, Layer,
|
|
1030
|
+
* import { Data, Effect, Layer, Context } from "effect"
|
|
981
1031
|
*
|
|
982
1032
|
* class DatabaseError extends Data.TaggedError("DatabaseError")<{
|
|
983
1033
|
* message: string
|
|
@@ -987,18 +1037,18 @@ export const catchTag = /*#__PURE__*/dual(3, (self, k, f) => fromBuildUnsafe((me
|
|
|
987
1037
|
* reason: string
|
|
988
1038
|
* }> {}
|
|
989
1039
|
*
|
|
990
|
-
* class Database extends
|
|
1040
|
+
* class Database extends Context.Service<Database, {
|
|
991
1041
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
992
1042
|
* }>()("Database") {}
|
|
993
1043
|
*
|
|
994
|
-
* class Logger extends
|
|
1044
|
+
* class Logger extends Context.Service<Logger, {
|
|
995
1045
|
* readonly log: (msg: string) => Effect.Effect<void>
|
|
996
1046
|
* }>()("Logger") {}
|
|
997
1047
|
*
|
|
998
1048
|
* // Primary database layer that might fail
|
|
999
1049
|
* const primaryDatabaseLayer = Layer.effect(Database)(Effect.gen(function*() {
|
|
1000
|
-
* yield*
|
|
1001
|
-
* return { query: (sql: string) => Effect.succeed(`Primary: ${sql}`) }
|
|
1050
|
+
* return yield* new DatabaseError({ message: "Primary DB unreachable" })
|
|
1051
|
+
* return { query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Primary: ${sql}`)) }
|
|
1002
1052
|
* }))
|
|
1003
1053
|
*
|
|
1004
1054
|
* // Fallback layers for different error causes
|
|
@@ -1007,11 +1057,12 @@ export const catchTag = /*#__PURE__*/dual(3, (self, k, f) => fromBuildUnsafe((me
|
|
|
1007
1057
|
* // For any cause/error, fallback to in-memory database
|
|
1008
1058
|
* return Layer.mergeAll(
|
|
1009
1059
|
* Layer.succeed(Database)({
|
|
1010
|
-
* query: (sql: string) => Effect.succeed(`Memory: ${sql}`)
|
|
1060
|
+
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Memory: ${sql}`))
|
|
1011
1061
|
* }),
|
|
1012
1062
|
* Layer.succeed(Logger)({
|
|
1013
|
-
* log: (msg: string) =>
|
|
1063
|
+
* log: Effect.fn("Logger.log")((msg: string) =>
|
|
1014
1064
|
* Effect.sync(() => console.log(`[FALLBACK] ${msg}`))
|
|
1065
|
+
* )
|
|
1015
1066
|
* })
|
|
1016
1067
|
* )
|
|
1017
1068
|
* })
|
|
@@ -1047,15 +1098,15 @@ export const catchCause = /*#__PURE__*/dual(2, (self, onError) => fromBuildUnsaf
|
|
|
1047
1098
|
* @since 3.13.0
|
|
1048
1099
|
* @category utils
|
|
1049
1100
|
*/
|
|
1050
|
-
export const updateService = /*#__PURE__*/dual(3, (layer, service, f) => provide(layer, effect(service
|
|
1101
|
+
export const updateService = /*#__PURE__*/dual(3, (layer, service, f) => provide(layer, effect(service, internalEffect.map(service.asEffect(), f))));
|
|
1051
1102
|
/**
|
|
1052
1103
|
* Creates a fresh version of this layer that will not be shared.
|
|
1053
1104
|
*
|
|
1054
1105
|
* @example
|
|
1055
1106
|
* ```ts
|
|
1056
|
-
* import { Effect, Layer, Ref,
|
|
1107
|
+
* import { Effect, Layer, Ref, Context } from "effect"
|
|
1057
1108
|
*
|
|
1058
|
-
* class Counter extends
|
|
1109
|
+
* class Counter extends Context.Service<Counter, {
|
|
1059
1110
|
* readonly count: number
|
|
1060
1111
|
* readonly increment: () => Effect.Effect<number>
|
|
1061
1112
|
* }>()("Counter") {}
|
|
@@ -1065,10 +1116,11 @@ export const updateService = /*#__PURE__*/dual(3, (layer, service, f) => provide
|
|
|
1065
1116
|
* const ref = yield* Ref.make(0)
|
|
1066
1117
|
* return {
|
|
1067
1118
|
* count: 0,
|
|
1068
|
-
* increment: () =>
|
|
1119
|
+
* increment: Effect.fn("Counter.increment")(() =>
|
|
1069
1120
|
* Ref.update(ref, (n) => n + 1).pipe(
|
|
1070
1121
|
* Effect.flatMap(() => Ref.get(ref))
|
|
1071
1122
|
* )
|
|
1123
|
+
* )
|
|
1072
1124
|
* }
|
|
1073
1125
|
* }))
|
|
1074
1126
|
*
|
|
@@ -1105,14 +1157,14 @@ export const fresh = self => fromBuildUnsafe((_, scope) => self.build(makeMemoMa
|
|
|
1105
1157
|
*
|
|
1106
1158
|
* @example
|
|
1107
1159
|
* ```ts
|
|
1108
|
-
* import { Console, Effect, Layer,
|
|
1160
|
+
* import { Console, Effect, Layer, Context } from "effect"
|
|
1109
1161
|
*
|
|
1110
|
-
* class HttpServer extends
|
|
1162
|
+
* class HttpServer extends Context.Service<HttpServer, {
|
|
1111
1163
|
* readonly start: () => Effect.Effect<string>
|
|
1112
1164
|
* readonly stop: () => Effect.Effect<string>
|
|
1113
1165
|
* }>()("HttpServer") {}
|
|
1114
1166
|
*
|
|
1115
|
-
* class Logger extends
|
|
1167
|
+
* class Logger extends Context.Service<Logger, {
|
|
1116
1168
|
* readonly log: (msg: string) => Effect.Effect<void>
|
|
1117
1169
|
* }>()("Logger") {}
|
|
1118
1170
|
*
|
|
@@ -1121,13 +1173,11 @@ export const fresh = self => fromBuildUnsafe((_, scope) => self.build(makeMemoMa
|
|
|
1121
1173
|
* yield* Console.log("Starting HTTP server...")
|
|
1122
1174
|
*
|
|
1123
1175
|
* return {
|
|
1124
|
-
* start: ()
|
|
1125
|
-
* Effect.gen(function*() {
|
|
1176
|
+
* start: Effect.fn("HttpServer.start")(function*() {
|
|
1126
1177
|
* yield* Console.log("Server listening on port 3000")
|
|
1127
1178
|
* return "Server started"
|
|
1128
1179
|
* }),
|
|
1129
|
-
* stop: ()
|
|
1130
|
-
* Effect.gen(function*() {
|
|
1180
|
+
* stop: Effect.fn("HttpServer.stop")(function*() {
|
|
1131
1181
|
* yield* Console.log("Server stopped gracefully")
|
|
1132
1182
|
* return "Server stopped"
|
|
1133
1183
|
* })
|
|
@@ -1135,7 +1185,7 @@ export const fresh = self => fromBuildUnsafe((_, scope) => self.build(makeMemoMa
|
|
|
1135
1185
|
* }))
|
|
1136
1186
|
*
|
|
1137
1187
|
* const loggerLayer = Layer.succeed(Logger)({
|
|
1138
|
-
* log: (msg: string) => Console.log(`[LOG] ${msg}`)
|
|
1188
|
+
* log: Effect.fn("Logger.log")((msg: string) => Console.log(`[LOG] ${msg}`))
|
|
1139
1189
|
* })
|
|
1140
1190
|
*
|
|
1141
1191
|
* // Application layer combining all services
|
|
@@ -1163,9 +1213,9 @@ export const launch = self => internalEffect.scoped(internalEffect.andThen(build
|
|
|
1163
1213
|
*
|
|
1164
1214
|
* @example
|
|
1165
1215
|
* ```ts
|
|
1166
|
-
* import { Effect, Layer,
|
|
1216
|
+
* import { Effect, Layer, Context } from "effect"
|
|
1167
1217
|
*
|
|
1168
|
-
* class UserService extends
|
|
1218
|
+
* class UserService extends Context.Service<UserService, {
|
|
1169
1219
|
* readonly config: { apiUrl: string }
|
|
1170
1220
|
* readonly getUser: (
|
|
1171
1221
|
* id: string
|
|
@@ -1178,7 +1228,7 @@ export const launch = self => internalEffect.scoped(internalEffect.andThen(build
|
|
|
1178
1228
|
* }>()("UserService") {}
|
|
1179
1229
|
*
|
|
1180
1230
|
* // Create a partial mock - only implement what you need for testing
|
|
1181
|
-
* const testUserLayer = Layer.mock(UserService
|
|
1231
|
+
* const testUserLayer = Layer.mock(UserService, {
|
|
1182
1232
|
* config: { apiUrl: "https://test-api.com" }, // Required - non-Effect property
|
|
1183
1233
|
* getUser: (id: string) => Effect.succeed({ id, name: "Test User" }) // Mock implementation
|
|
1184
1234
|
* // deleteUser and updateUser are omitted - will throw UnimplementedError if called
|
|
@@ -1202,7 +1252,13 @@ export const launch = self => internalEffect.scoped(internalEffect.andThen(build
|
|
|
1202
1252
|
* @since 4.0.0
|
|
1203
1253
|
* @category Testing
|
|
1204
1254
|
*/
|
|
1205
|
-
export const mock =
|
|
1255
|
+
export const mock = function () {
|
|
1256
|
+
if (arguments.length === 1) {
|
|
1257
|
+
return implementation => mockImpl(arguments[0], implementation);
|
|
1258
|
+
}
|
|
1259
|
+
return mockImpl(arguments[0], arguments[1]);
|
|
1260
|
+
};
|
|
1261
|
+
const mockImpl = (service, implementation) => succeed(service)(new Proxy({
|
|
1206
1262
|
...implementation
|
|
1207
1263
|
}, {
|
|
1208
1264
|
get(target, prop, _receiver) {
|
|
@@ -1219,7 +1275,18 @@ export const mock = service => implementation => succeed(service)(new Proxy({
|
|
|
1219
1275
|
has: constTrue
|
|
1220
1276
|
}));
|
|
1221
1277
|
const makeUnimplemented = error => {
|
|
1222
|
-
const dead = internalEffect.die(error)
|
|
1278
|
+
const dead = Object.assign(internalEffect.die(error), {
|
|
1279
|
+
[StreamTypeId]: StreamTypeId,
|
|
1280
|
+
channel: {
|
|
1281
|
+
[ChannelTypeId]: ChannelTypeId,
|
|
1282
|
+
transform: () => internalEffect.succeed(dead),
|
|
1283
|
+
pipe() {
|
|
1284
|
+
return pipeArguments(this, arguments);
|
|
1285
|
+
}
|
|
1286
|
+
},
|
|
1287
|
+
[ChannelTypeId]: ChannelTypeId,
|
|
1288
|
+
transform: () => internalEffect.succeed(dead)
|
|
1289
|
+
});
|
|
1223
1290
|
function unimplemented() {
|
|
1224
1291
|
return dead;
|
|
1225
1292
|
}
|
|
@@ -1228,6 +1295,8 @@ const makeUnimplemented = error => {
|
|
|
1228
1295
|
Object.setPrototypeOf(unimplemented, Object.getPrototypeOf(dead));
|
|
1229
1296
|
return unimplemented;
|
|
1230
1297
|
};
|
|
1298
|
+
const StreamTypeId = "~effect/Stream";
|
|
1299
|
+
const ChannelTypeId = "~effect/Channel";
|
|
1231
1300
|
// -----------------------------------------------------------------------------
|
|
1232
1301
|
// Type constraints
|
|
1233
1302
|
// -----------------------------------------------------------------------------
|
|
@@ -1329,9 +1398,9 @@ export const satisfiesServicesType = () => layer => layer;
|
|
|
1329
1398
|
*
|
|
1330
1399
|
* @example
|
|
1331
1400
|
* ```ts
|
|
1332
|
-
* import { Console, Effect, Layer,
|
|
1401
|
+
* import { Console, Effect, Layer, Context, type Tracer } from "effect"
|
|
1333
1402
|
*
|
|
1334
|
-
* class Database extends
|
|
1403
|
+
* class Database extends Context.Service<Database, {
|
|
1335
1404
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
1336
1405
|
* }>()("Database") {}
|
|
1337
1406
|
*
|
|
@@ -1347,7 +1416,7 @@ export const satisfiesServicesType = () => layer => layer;
|
|
|
1347
1416
|
* yield* Console.log((parentSpan as Tracer.Span).name) // "database-init"
|
|
1348
1417
|
*
|
|
1349
1418
|
* return {
|
|
1350
|
-
* query: (sql: string) => Effect.succeed(`Result: ${sql}`)
|
|
1419
|
+
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result: ${sql}`))
|
|
1351
1420
|
* }
|
|
1352
1421
|
* })).pipe(Layer.provide(Layer.span("database-init")))
|
|
1353
1422
|
*
|
|
@@ -1378,9 +1447,9 @@ export const span = (name, options) => {
|
|
|
1378
1447
|
*
|
|
1379
1448
|
* @example
|
|
1380
1449
|
* ```ts
|
|
1381
|
-
* import { Console, Effect, Layer,
|
|
1450
|
+
* import { Console, Effect, Layer, Context, Tracer } from "effect"
|
|
1382
1451
|
*
|
|
1383
|
-
* class Database extends
|
|
1452
|
+
* class Database extends Context.Service<Database, {
|
|
1384
1453
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
1385
1454
|
* }>()("Database") {}
|
|
1386
1455
|
*
|
|
@@ -1394,7 +1463,7 @@ export const span = (name, options) => {
|
|
|
1394
1463
|
* yield* Console.log(parentSpan.spanId) // "42"
|
|
1395
1464
|
*
|
|
1396
1465
|
* return {
|
|
1397
|
-
* query: (sql: string) => Effect.succeed(`Result: ${sql}`)
|
|
1466
|
+
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result: ${sql}`))
|
|
1398
1467
|
* }
|
|
1399
1468
|
* })
|
|
1400
1469
|
* ).pipe(Layer.provide(Layer.parentSpan(Tracer.externalSpan({
|
|
@@ -1406,7 +1475,7 @@ export const span = (name, options) => {
|
|
|
1406
1475
|
* @since 4.0.0
|
|
1407
1476
|
* @category tracing
|
|
1408
1477
|
*/
|
|
1409
|
-
export const parentSpan = span =>
|
|
1478
|
+
export const parentSpan = span => succeedContext(Tracer.ParentSpan.context(span));
|
|
1410
1479
|
/**
|
|
1411
1480
|
* Wraps a Layer with a new tracing span, making all operations in the layer
|
|
1412
1481
|
* constructor part of the named trace span.
|
|
@@ -1417,13 +1486,13 @@ export const parentSpan = span => succeedServices(Tracer.ParentSpan.serviceMap(s
|
|
|
1417
1486
|
*
|
|
1418
1487
|
* @example
|
|
1419
1488
|
* ```ts
|
|
1420
|
-
* import { Effect, Layer,
|
|
1489
|
+
* import { Effect, Layer, Context } from "effect"
|
|
1421
1490
|
*
|
|
1422
|
-
* class Database extends
|
|
1491
|
+
* class Database extends Context.Service<Database, {
|
|
1423
1492
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
1424
1493
|
* }>()("Database") {}
|
|
1425
1494
|
*
|
|
1426
|
-
* class Logger extends
|
|
1495
|
+
* class Logger extends Context.Service<Logger, {
|
|
1427
1496
|
* readonly log: (msg: string) => Effect.Effect<void>
|
|
1428
1497
|
* }>()("Logger") {}
|
|
1429
1498
|
*
|
|
@@ -1432,14 +1501,14 @@ export const parentSpan = span => succeedServices(Tracer.ParentSpan.serviceMap(s
|
|
|
1432
1501
|
* yield* Effect.log("Connecting to database")
|
|
1433
1502
|
* yield* Effect.sleep("100 millis")
|
|
1434
1503
|
* return {
|
|
1435
|
-
* query: (sql: string) => Effect.succeed(`Result: ${sql}`)
|
|
1504
|
+
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result: ${sql}`))
|
|
1436
1505
|
* }
|
|
1437
1506
|
* })).pipe(Layer.withSpan("database-initialization", {
|
|
1438
1507
|
* attributes: { dbType: "postgres" }
|
|
1439
1508
|
* }))
|
|
1440
1509
|
*
|
|
1441
1510
|
* const loggerLayer = Layer.succeed(Logger, {
|
|
1442
|
-
* log: (msg: string) => Effect.sync(() => console.log(msg))
|
|
1511
|
+
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => console.log(msg)))
|
|
1443
1512
|
* }).pipe(Layer.withSpan("logger-initialization"))
|
|
1444
1513
|
*
|
|
1445
1514
|
* // Combine traced layers
|
|
@@ -1484,13 +1553,13 @@ export const withSpan = function () {
|
|
|
1484
1553
|
*
|
|
1485
1554
|
* @example
|
|
1486
1555
|
* ```ts
|
|
1487
|
-
* import { Effect, Layer,
|
|
1556
|
+
* import { Effect, Layer, Context, Tracer } from "effect"
|
|
1488
1557
|
*
|
|
1489
|
-
* class Database extends
|
|
1558
|
+
* class Database extends Context.Service<Database, {
|
|
1490
1559
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
1491
1560
|
* }>()("Database") {}
|
|
1492
1561
|
*
|
|
1493
|
-
* class Cache extends
|
|
1562
|
+
* class Cache extends Context.Service<Cache, {
|
|
1494
1563
|
* readonly get: (key: string) => Effect.Effect<string | null>
|
|
1495
1564
|
* }>()("Cache") {}
|
|
1496
1565
|
*
|
|
@@ -1498,14 +1567,14 @@ export const withSpan = function () {
|
|
|
1498
1567
|
* const DatabaseLayer = Layer.effect(Database, Effect.gen(function*() {
|
|
1499
1568
|
* yield* Effect.log("Connecting to database")
|
|
1500
1569
|
* return {
|
|
1501
|
-
* query: (sql: string) => Effect.succeed(`DB: ${sql}`)
|
|
1570
|
+
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`DB: ${sql}`))
|
|
1502
1571
|
* }
|
|
1503
1572
|
* }))
|
|
1504
1573
|
*
|
|
1505
1574
|
* const CacheLayer = Layer.effect(Cache, Effect.gen(function*() {
|
|
1506
1575
|
* yield* Effect.log("Connecting to cache")
|
|
1507
1576
|
* return {
|
|
1508
|
-
* get: (key: string) => Effect.succeed(`Cache: ${key}`)
|
|
1577
|
+
* get: Effect.fn("Cache.get")((key: string) => Effect.succeed(`Cache: ${key}`))
|
|
1509
1578
|
* }
|
|
1510
1579
|
* }))
|
|
1511
1580
|
*
|
|
@@ -1519,9 +1588,9 @@ export const withSpan = function () {
|
|
|
1519
1588
|
* Layer.withParentSpan(parentSpan)
|
|
1520
1589
|
* )
|
|
1521
1590
|
*
|
|
1522
|
-
* const
|
|
1523
|
-
* const database =
|
|
1524
|
-
* const cache =
|
|
1591
|
+
* const context = yield* Layer.build(AppLayer)
|
|
1592
|
+
* const database = Context.get(context, Database)
|
|
1593
|
+
* const cache = Context.get(context, Cache)
|
|
1525
1594
|
*
|
|
1526
1595
|
* const dbResult = yield* database.query("SELECT * FROM users")
|
|
1527
1596
|
* const cacheResult = yield* cache.get("user:123")
|