effect 4.0.0-beta.5 → 4.0.0-beta.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Array.d.ts +213 -385
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +149 -102
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +82 -45
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +105 -52
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts +39 -32
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +36 -33
- package/dist/BigInt.js.map +1 -1
- package/dist/Brand.d.ts +3 -5
- package/dist/Brand.d.ts.map +1 -1
- package/dist/Brand.js +1 -1
- package/dist/Brand.js.map +1 -1
- package/dist/Cache.d.ts +14 -45
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +21 -47
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +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 +109 -79
- 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 +3326 -383
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +2315 -283
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +13 -2
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +340 -257
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +57 -15
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +85 -25
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js +29 -11
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.d.ts +44 -54
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +69 -4
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +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 +485 -325
- 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 +20 -17
- 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 +24 -20
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js +7 -7
- package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +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} +28 -21
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -0
- package/dist/unstable/eventlog/{SqlEventLogServer.d.ts → SqlEventLogServerEncrypted.d.ts} +5 -5
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts.map +1 -0
- package/dist/unstable/eventlog/{SqlEventLogServer.js → SqlEventLogServerEncrypted.js} +69 -27
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -0
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts +25 -0
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -0
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +355 -0
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -0
- package/dist/unstable/eventlog/index.d.ts +22 -2
- package/dist/unstable/eventlog/index.d.ts.map +1 -1
- package/dist/unstable/eventlog/index.js +22 -2
- package/dist/unstable/eventlog/index.js.map +1 -1
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.d.ts +2 -0
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.d.ts.map +1 -0
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js +89 -0
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js.map +1 -0
- package/dist/unstable/http/Cookies.d.ts +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 +17 -25
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +59 -60
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/observability/Otlp.d.ts +12 -12
- package/dist/unstable/observability/Otlp.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts +2 -2
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +8 -8
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.d.ts +4 -4
- package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js +7 -4
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts +4 -4
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.js +2 -2
- package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.d.ts +2 -2
- package/dist/unstable/observability/OtlpSerialization.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.js +2 -2
- package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.d.ts +4 -4
- package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js +7 -3
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.d.ts +3 -3
- package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.js +4 -33
- package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
- package/dist/unstable/observability/internal/protobuf.js +4 -4
- package/dist/unstable/observability/internal/protobuf.js.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +24 -3
- package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.js +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 +13 -2
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +60 -27
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +8 -12
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +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 +137 -82
- package/src/BigInt.ts +53 -45
- package/src/Brand.ts +3 -5
- 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 +123 -67
- 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 +4267 -752
- package/src/SchemaAST.ts +480 -302
- package/src/SchemaGetter.ts +92 -38
- package/src/SchemaIssue.ts +28 -15
- package/src/SchemaParser.ts +100 -29
- 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 +1150 -611
- 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 +28 -23
- 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 +29 -20
- package/src/unstable/cluster/SqlRunnerStorage.ts +13 -7
- 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} +38 -22
- package/src/unstable/eventlog/{SqlEventLogServer.ts → SqlEventLogServerEncrypted.ts} +110 -43
- package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +506 -0
- package/src/unstable/eventlog/index.ts +27 -2
- package/src/unstable/eventlog/internal/identityRootSecretDerivation.ts +153 -0
- package/src/unstable/http/Cookies.ts +94 -11
- package/src/unstable/http/Etag.ts +7 -5
- package/src/unstable/http/FetchHttpClient.ts +5 -5
- package/src/unstable/http/Headers.ts +70 -20
- package/src/unstable/http/HttpClient.ts +385 -42
- package/src/unstable/http/HttpClientRequest.ts +151 -39
- package/src/unstable/http/HttpClientResponse.ts +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 +73 -72
- package/src/unstable/observability/Otlp.ts +12 -12
- package/src/unstable/observability/OtlpExporter.ts +14 -10
- package/src/unstable/observability/OtlpLogger.ts +13 -9
- package/src/unstable/observability/OtlpMetrics.ts +6 -6
- package/src/unstable/observability/OtlpSerialization.ts +2 -2
- package/src/unstable/observability/OtlpTracer.ts +14 -10
- package/src/unstable/observability/PrometheusMetrics.ts +5 -5
- package/src/unstable/observability/internal/protobuf.ts +4 -4
- package/src/unstable/persistence/KeyValueStore.ts +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 +97 -54
- 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/internal/effect.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as Arr from "../Array.js";
|
|
2
|
+
import * as Context from "../Context.js";
|
|
2
3
|
import * as Duration from "../Duration.js";
|
|
3
4
|
import * as Equal from "../Equal.js";
|
|
4
5
|
import * as Filter from "../Filter.js";
|
|
@@ -12,15 +13,14 @@ import * as Order from "../Order.js";
|
|
|
12
13
|
import { pipeArguments } from "../Pipeable.js";
|
|
13
14
|
import { hasProperty, isIterable, isString, isTagged } from "../Predicate.js";
|
|
14
15
|
import { currentFiberTypeId, redact } from "../Redactable.js";
|
|
15
|
-
import { CurrentConcurrency, CurrentLogAnnotations, CurrentLogLevel, CurrentLogSpans, CurrentStackFrame, MinimumLogLevel, TracerEnabled, TracerSpanAnnotations, TracerSpanLinks, TracerTimingEnabled } from "../References.js";
|
|
16
16
|
import * as Result from "../Result.js";
|
|
17
17
|
import * as Scheduler from "../Scheduler.js";
|
|
18
|
-
import * as ServiceMap from "../ServiceMap.js";
|
|
19
18
|
import * as Tracer from "../Tracer.js";
|
|
20
19
|
import { internalCall } from "../Utils.js";
|
|
21
|
-
import { args, causeAnnotate, causeEmpty, causeFromReasons, CauseImpl, constEmptyAnnotations, contA, contAll, contE,
|
|
20
|
+
import { args, causeAnnotate, causeEmpty, causeFromReasons, CauseImpl, constEmptyAnnotations, contA, contAll, contE, evaluate, exitDie, exitFail, exitFailCause, exitSucceed, ExitTypeId, Fail, InterruptorStackTrace, isCause, isDieReason, isEffect, isFailReason, isInterruptReason, isNoSuchElementError, makePrimitive, makePrimitiveProto, NoSuchElementError, ReasonBase, StackTraceKey as CauseStackTrace, TaggedError, withFiber, Yield } from "./core.js";
|
|
22
21
|
import * as doNotation from "./doNotation.js";
|
|
23
22
|
import * as InternalMetric from "./metric.js";
|
|
23
|
+
import { CurrentConcurrency, CurrentErrorReporters, CurrentLogAnnotations, CurrentLogLevel, CurrentLogSpans, CurrentStackFrame, MinimumLogLevel, TracerEnabled, TracerSpanAnnotations, TracerSpanLinks, TracerTimingEnabled } from "./references.js";
|
|
24
24
|
import { addSpanStackTrace, makeStackCleaner } from "./tracer.js";
|
|
25
25
|
import { version } from "./version.js";
|
|
26
26
|
// ----------------------------------------------------------------------------
|
|
@@ -111,9 +111,9 @@ export const causeInterruptors = self => {
|
|
|
111
111
|
};
|
|
112
112
|
const emptySet = /*#__PURE__*/new Set();
|
|
113
113
|
/** @internal */
|
|
114
|
-
export const hasInterruptsOnly = self => self.reasons.every(isInterruptReason);
|
|
114
|
+
export const hasInterruptsOnly = self => self.reasons.length > 0 && self.reasons.every(isInterruptReason);
|
|
115
115
|
/** @internal */
|
|
116
|
-
export const reasonAnnotations = self =>
|
|
116
|
+
export const reasonAnnotations = self => Context.makeUnsafe(self.annotations);
|
|
117
117
|
/** @internal */
|
|
118
118
|
export const causeAnnotations = self => {
|
|
119
119
|
const map = new Map();
|
|
@@ -124,7 +124,7 @@ export const causeAnnotations = self => {
|
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
}
|
|
127
|
-
return
|
|
127
|
+
return Context.makeUnsafe(map);
|
|
128
128
|
};
|
|
129
129
|
/** @internal */
|
|
130
130
|
export const causeCombine = /*#__PURE__*/dual(2, (self, that) => {
|
|
@@ -201,7 +201,8 @@ export const causePrettyErrors = self => {
|
|
|
201
201
|
Error.stackTraceLimit = prevStackLimit;
|
|
202
202
|
return errors;
|
|
203
203
|
};
|
|
204
|
-
|
|
204
|
+
/** @internal */
|
|
205
|
+
export const causePrettyError = (original, annotations) => {
|
|
205
206
|
const kind = typeof original;
|
|
206
207
|
let error;
|
|
207
208
|
if (original && kind === "object") {
|
|
@@ -321,28 +322,11 @@ const fiberIdStore = {
|
|
|
321
322
|
};
|
|
322
323
|
/** @internal */
|
|
323
324
|
export const getCurrentFiber = () => globalThis[currentFiberTypeId];
|
|
324
|
-
const keepAlive = /*#__PURE__*/(() => {
|
|
325
|
-
let count = 0;
|
|
326
|
-
let running = undefined;
|
|
327
|
-
return {
|
|
328
|
-
increment() {
|
|
329
|
-
count++;
|
|
330
|
-
running ??= globalThis.setInterval(constVoid, 2_147_483_647);
|
|
331
|
-
},
|
|
332
|
-
decrement() {
|
|
333
|
-
count--;
|
|
334
|
-
if (count === 0 && running !== undefined) {
|
|
335
|
-
globalThis.clearInterval(running);
|
|
336
|
-
running = undefined;
|
|
337
|
-
}
|
|
338
|
-
}
|
|
339
|
-
};
|
|
340
|
-
})();
|
|
341
325
|
/** @internal */
|
|
342
326
|
export class FiberImpl {
|
|
343
|
-
constructor(
|
|
327
|
+
constructor(context, interruptible = true) {
|
|
344
328
|
this[FiberTypeId] = fiberVariance;
|
|
345
|
-
this.
|
|
329
|
+
this.setContext(context);
|
|
346
330
|
this.id = ++fiberIdStore.id;
|
|
347
331
|
this.currentOpCount = 0;
|
|
348
332
|
this.currentLoopCount = 0;
|
|
@@ -366,8 +350,8 @@ export class FiberImpl {
|
|
|
366
350
|
_children;
|
|
367
351
|
_interruptedCause;
|
|
368
352
|
_yielded;
|
|
369
|
-
// set in
|
|
370
|
-
|
|
353
|
+
// set in setContext
|
|
354
|
+
context;
|
|
371
355
|
currentScheduler;
|
|
372
356
|
currentTracerContext;
|
|
373
357
|
currentSpan;
|
|
@@ -376,8 +360,13 @@ export class FiberImpl {
|
|
|
376
360
|
currentStackFrame;
|
|
377
361
|
runtimeMetrics;
|
|
378
362
|
maxOpsBeforeYield;
|
|
363
|
+
currentPreventYield;
|
|
364
|
+
_dispatcher = undefined;
|
|
365
|
+
get currentDispatcher() {
|
|
366
|
+
return this._dispatcher ??= this.currentScheduler.makeDispatcher();
|
|
367
|
+
}
|
|
379
368
|
getRef(ref) {
|
|
380
|
-
return
|
|
369
|
+
return Context.getReferenceUnsafe(this.context, ref);
|
|
381
370
|
}
|
|
382
371
|
addObserver(cb) {
|
|
383
372
|
if (this._exit) {
|
|
@@ -398,7 +387,7 @@ export class FiberImpl {
|
|
|
398
387
|
}
|
|
399
388
|
let cause = causeInterrupt(fiberId);
|
|
400
389
|
if (this.currentStackFrame) {
|
|
401
|
-
cause = causeAnnotate(cause,
|
|
390
|
+
cause = causeAnnotate(cause, Context.make(CauseStackTrace, this.currentStackFrame));
|
|
402
391
|
}
|
|
403
392
|
if (annotations) {
|
|
404
393
|
cause = causeAnnotate(cause, annotations);
|
|
@@ -412,7 +401,7 @@ export class FiberImpl {
|
|
|
412
401
|
return this._exit;
|
|
413
402
|
}
|
|
414
403
|
evaluate(effect) {
|
|
415
|
-
this.runtimeMetrics?.recordFiberStart(this.
|
|
404
|
+
this.runtimeMetrics?.recordFiberStart(this.context);
|
|
416
405
|
if (this._exit) {
|
|
417
406
|
return;
|
|
418
407
|
} else if (this._yielded !== undefined) {
|
|
@@ -431,7 +420,7 @@ export class FiberImpl {
|
|
|
431
420
|
return this.evaluate(flatMap(interruptChildren, () => exit));
|
|
432
421
|
}
|
|
433
422
|
this._exit = exit;
|
|
434
|
-
this.runtimeMetrics?.recordFiberEnd(this.
|
|
423
|
+
this.runtimeMetrics?.recordFiberEnd(this.context, this._exit);
|
|
435
424
|
for (let i = 0; i < this._observers.length; i++) {
|
|
436
425
|
this._observers[i](exit);
|
|
437
426
|
}
|
|
@@ -447,7 +436,7 @@ export class FiberImpl {
|
|
|
447
436
|
try {
|
|
448
437
|
while (true) {
|
|
449
438
|
this.currentOpCount++;
|
|
450
|
-
if (!yielding && this.currentScheduler.shouldYield(this)) {
|
|
439
|
+
if (!yielding && !this.currentPreventYield && this.currentScheduler.shouldYield(this)) {
|
|
451
440
|
yielding = true;
|
|
452
441
|
const prev = current;
|
|
453
442
|
current = flatMap(yieldNow, () => prev);
|
|
@@ -498,16 +487,21 @@ export class FiberImpl {
|
|
|
498
487
|
pipe() {
|
|
499
488
|
return pipeArguments(this, arguments);
|
|
500
489
|
}
|
|
501
|
-
|
|
502
|
-
this.
|
|
503
|
-
|
|
504
|
-
|
|
490
|
+
setContext(context) {
|
|
491
|
+
this.context = context;
|
|
492
|
+
const scheduler = this.getRef(Scheduler.Scheduler);
|
|
493
|
+
if (scheduler !== this.currentScheduler) {
|
|
494
|
+
this.currentScheduler = scheduler;
|
|
495
|
+
this._dispatcher = undefined;
|
|
496
|
+
}
|
|
497
|
+
this.currentSpan = context.mapUnsafe.get(Tracer.ParentSpanKey);
|
|
505
498
|
this.currentLogLevel = this.getRef(CurrentLogLevel);
|
|
506
499
|
this.minimumLogLevel = this.getRef(MinimumLogLevel);
|
|
507
|
-
this.currentStackFrame =
|
|
500
|
+
this.currentStackFrame = context.mapUnsafe.get(CurrentStackFrame.key);
|
|
508
501
|
this.maxOpsBeforeYield = this.getRef(Scheduler.MaxOpsBeforeYield);
|
|
509
|
-
this.
|
|
510
|
-
|
|
502
|
+
this.currentPreventYield = this.getRef(Scheduler.PreventSchedulerYield);
|
|
503
|
+
this.runtimeMetrics = context.mapUnsafe.get(InternalMetric.FiberRuntimeMetricsKey);
|
|
504
|
+
const currentTracer = context.mapUnsafe.get(Tracer.TracerKey);
|
|
511
505
|
this.currentTracerContext = currentTracer ? currentTracer["context"] : undefined;
|
|
512
506
|
}
|
|
513
507
|
get currentSpanLocal() {
|
|
@@ -521,7 +515,7 @@ const fiberStackAnnotations = fiber => {
|
|
|
521
515
|
if (!fiber.currentStackFrame) return undefined;
|
|
522
516
|
const annotations = new Map();
|
|
523
517
|
annotations.set(CauseStackTrace.key, fiber.currentStackFrame);
|
|
524
|
-
return
|
|
518
|
+
return Context.makeUnsafe(annotations);
|
|
525
519
|
};
|
|
526
520
|
const fiberInterruptChildren = fiber => {
|
|
527
521
|
if (fiber._children === undefined || fiber._children.size === 0) {
|
|
@@ -574,6 +568,7 @@ export const fiberJoin = self => {
|
|
|
574
568
|
/** @internal */
|
|
575
569
|
export const fiberJoinAll = self => callback(resume => {
|
|
576
570
|
const fibers = Array.from(self);
|
|
571
|
+
if (fibers.length === 0) return resume(succeed(Arr.empty()));
|
|
577
572
|
const out = new Array(fibers.length);
|
|
578
573
|
const cancels = Arr.empty();
|
|
579
574
|
let done = 0;
|
|
@@ -597,8 +592,10 @@ export const fiberJoinAll = self => callback(resume => {
|
|
|
597
592
|
/** @internal */
|
|
598
593
|
export const fiberInterrupt = self => withFiber(fiber => fiberInterruptAs(self, fiber.id));
|
|
599
594
|
/** @internal */
|
|
600
|
-
export const fiberInterruptAs = /*#__PURE__*/dual(
|
|
601
|
-
|
|
595
|
+
export const fiberInterruptAs = /*#__PURE__*/dual(args => hasProperty(args[0], FiberTypeId), (self, fiberId, annotations) => withFiber(parent => {
|
|
596
|
+
let ann = fiberStackAnnotations(parent);
|
|
597
|
+
ann = ann && annotations ? Context.merge(ann, annotations) : ann ?? annotations;
|
|
598
|
+
self.interruptUnsafe(fiberId, ann);
|
|
602
599
|
return asVoid(fiberAwait(self));
|
|
603
600
|
}));
|
|
604
601
|
/** @internal */
|
|
@@ -650,7 +647,7 @@ export const yieldNowWith = /*#__PURE__*/makePrimitive({
|
|
|
650
647
|
op: "Yield",
|
|
651
648
|
[evaluate](fiber) {
|
|
652
649
|
let resumed = false;
|
|
653
|
-
fiber.
|
|
650
|
+
fiber.currentDispatcher.scheduleTask(() => {
|
|
654
651
|
if (resumed) return;
|
|
655
652
|
fiber.evaluate(exitVoid);
|
|
656
653
|
}, this[args] ?? 0);
|
|
@@ -726,10 +723,8 @@ const callbackOptions = /*#__PURE__*/makePrimitive({
|
|
|
726
723
|
}, controller?.signal);
|
|
727
724
|
if (yielded !== false) return yielded;
|
|
728
725
|
yielded = true;
|
|
729
|
-
keepAlive.increment();
|
|
730
726
|
fiber._yielded = () => {
|
|
731
727
|
resumed = true;
|
|
732
|
-
keepAlive.decrement();
|
|
733
728
|
};
|
|
734
729
|
if (controller === undefined && onCancel === undefined) {
|
|
735
730
|
return Yield;
|
|
@@ -762,7 +757,7 @@ export const never = /*#__PURE__*/callback(constVoid);
|
|
|
762
757
|
export const gen = (...args) => suspend(() => fromIteratorUnsafe(args.length === 1 ? args[0]() : args[1].call(args[0].self)));
|
|
763
758
|
/** @internal */
|
|
764
759
|
export const fnUntraced = (body, ...pipeables) => {
|
|
765
|
-
|
|
760
|
+
const fn = pipeables.length === 0 ? function () {
|
|
766
761
|
return suspend(() => fromIteratorUnsafe(body.apply(this, arguments)));
|
|
767
762
|
} : function () {
|
|
768
763
|
let effect = suspend(() => fromIteratorUnsafe(body.apply(this, arguments)));
|
|
@@ -771,7 +766,12 @@ export const fnUntraced = (body, ...pipeables) => {
|
|
|
771
766
|
}
|
|
772
767
|
return effect;
|
|
773
768
|
};
|
|
769
|
+
return defineFunctionLength(body.length, fn);
|
|
774
770
|
};
|
|
771
|
+
const defineFunctionLength = (length, fn) => Object.defineProperty(fn, "length", {
|
|
772
|
+
value: length,
|
|
773
|
+
configurable: true
|
|
774
|
+
});
|
|
775
775
|
const fnStackCleaner = /*#__PURE__*/makeStackCleaner(2);
|
|
776
776
|
/** @internal */
|
|
777
777
|
export const fn = function () {
|
|
@@ -789,7 +789,7 @@ export const fn = function () {
|
|
|
789
789
|
};
|
|
790
790
|
const makeFn = (name, bodyOrOptions, defError, pipeables, addSpan, spanOptions) => {
|
|
791
791
|
const body = typeof bodyOrOptions === "function" ? bodyOrOptions : pipeables.pop().bind(bodyOrOptions.self);
|
|
792
|
-
return function (...args) {
|
|
792
|
+
return defineFunctionLength(body.length, function (...args) {
|
|
793
793
|
let result = suspend(() => {
|
|
794
794
|
const iter = body.apply(this, arguments);
|
|
795
795
|
return isEffect(iter) ? iter : fromIteratorUnsafe(iter);
|
|
@@ -813,10 +813,10 @@ const makeFn = (name, bodyOrOptions, defError, pipeables, addSpan, spanOptions)
|
|
|
813
813
|
parent: prev
|
|
814
814
|
}
|
|
815
815
|
}));
|
|
816
|
-
};
|
|
816
|
+
});
|
|
817
817
|
};
|
|
818
818
|
/** @internal */
|
|
819
|
-
export const fnUntracedEager = (body, ...pipeables) => pipeables.length === 0 ? function () {
|
|
819
|
+
export const fnUntracedEager = (body, ...pipeables) => defineFunctionLength(body.length, pipeables.length === 0 ? function () {
|
|
820
820
|
return fromIteratorEagerUnsafe(() => body.apply(this, arguments));
|
|
821
821
|
} : function () {
|
|
822
822
|
let effect = fromIteratorEagerUnsafe(() => body.apply(this, arguments));
|
|
@@ -824,7 +824,7 @@ export const fnUntracedEager = (body, ...pipeables) => pipeables.length === 0 ?
|
|
|
824
824
|
effect = pipeable(effect);
|
|
825
825
|
}
|
|
826
826
|
return effect;
|
|
827
|
-
};
|
|
827
|
+
});
|
|
828
828
|
const fromIteratorEagerUnsafe = evaluate => {
|
|
829
829
|
try {
|
|
830
830
|
const iterator = evaluate();
|
|
@@ -1107,52 +1107,36 @@ export const exitFindErrorOption = self => {
|
|
|
1107
1107
|
/** @internal */
|
|
1108
1108
|
export const service = fromYieldable;
|
|
1109
1109
|
/** @internal */
|
|
1110
|
-
export const serviceOption = service => withFiber(fiber => succeed(
|
|
1110
|
+
export const serviceOption = service => withFiber(fiber => succeed(Context.getOption(fiber.context, service)));
|
|
1111
1111
|
/** @internal */
|
|
1112
|
-
export const serviceOptional = service => withFiber(fiber => fiber.
|
|
1112
|
+
export const serviceOptional = service => withFiber(fiber => fiber.context.mapUnsafe.has(service.key) ? succeed(Context.getUnsafe(fiber.context, service)) : fail(new NoSuchElementError()));
|
|
1113
1113
|
/** @internal */
|
|
1114
|
-
export const
|
|
1115
|
-
const
|
|
1116
|
-
const
|
|
1117
|
-
if (
|
|
1118
|
-
fiber.
|
|
1119
|
-
const newServices = new Map();
|
|
1120
|
-
for (const [key, value] of fiber.services.mapUnsafe) {
|
|
1121
|
-
if (!prev.mapUnsafe.has(key) || value !== prev.mapUnsafe.get(key)) {
|
|
1122
|
-
newServices.set(key, value);
|
|
1123
|
-
}
|
|
1124
|
-
}
|
|
1114
|
+
export const updateContext = /*#__PURE__*/dual(2, (self, f) => withFiber(fiber => {
|
|
1115
|
+
const prevContext = fiber.context;
|
|
1116
|
+
const nextContext = f(prevContext);
|
|
1117
|
+
if (prevContext === nextContext) return self;
|
|
1118
|
+
fiber.setContext(nextContext);
|
|
1125
1119
|
return onExitPrimitive(self, () => {
|
|
1126
|
-
|
|
1127
|
-
for (const [key, value] of newServices) {
|
|
1128
|
-
if (value !== map.get(key)) continue;
|
|
1129
|
-
if (prev.mapUnsafe.has(key)) {
|
|
1130
|
-
map.set(key, prev.mapUnsafe.get(key));
|
|
1131
|
-
} else {
|
|
1132
|
-
map.delete(key);
|
|
1133
|
-
}
|
|
1134
|
-
}
|
|
1135
|
-
fiber.setServices(ServiceMap.makeUnsafe(map));
|
|
1120
|
+
fiber.setContext(prevContext);
|
|
1136
1121
|
return undefined;
|
|
1137
1122
|
});
|
|
1138
1123
|
}));
|
|
1139
1124
|
/** @internal */
|
|
1140
|
-
export const updateService = /*#__PURE__*/dual(3, (self, service, f) =>
|
|
1141
|
-
const prev =
|
|
1125
|
+
export const updateService = /*#__PURE__*/dual(3, (self, service, f) => updateContext(self, s => {
|
|
1126
|
+
const prev = Context.getUnsafe(s, service);
|
|
1142
1127
|
const next = f(prev);
|
|
1143
|
-
if (prev === next) return
|
|
1144
|
-
|
|
1145
|
-
return onExit(self, () => sync(() => fiber.setServices(ServiceMap.add(fiber.services, service, prev))));
|
|
1128
|
+
if (prev === next) return s;
|
|
1129
|
+
return Context.add(s, service, next);
|
|
1146
1130
|
}));
|
|
1147
1131
|
/** @internal */
|
|
1148
|
-
export const
|
|
1149
|
-
const
|
|
1132
|
+
export const context = () => getContext;
|
|
1133
|
+
const getContext = /*#__PURE__*/withFiber(fiber => succeed(fiber.context));
|
|
1150
1134
|
/** @internal */
|
|
1151
|
-
export const
|
|
1135
|
+
export const contextWith = f => withFiber(fiber => f(fiber.context));
|
|
1152
1136
|
/** @internal */
|
|
1153
|
-
export const
|
|
1137
|
+
export const provideContext = /*#__PURE__*/dual(2, (self, context) => {
|
|
1154
1138
|
if (effectIsExit(self)) return self;
|
|
1155
|
-
return
|
|
1139
|
+
return updateContext(self, Context.merge(context));
|
|
1156
1140
|
});
|
|
1157
1141
|
/** @internal */
|
|
1158
1142
|
export const provideService = function () {
|
|
@@ -1161,11 +1145,10 @@ export const provideService = function () {
|
|
|
1161
1145
|
}
|
|
1162
1146
|
return dual(3, (self, service, impl) => provideServiceImpl(self, service, impl)).apply(this, arguments);
|
|
1163
1147
|
};
|
|
1164
|
-
const provideServiceImpl = (self, service, implementation) =>
|
|
1165
|
-
const prev =
|
|
1166
|
-
if (prev
|
|
1167
|
-
|
|
1168
|
-
return onExit(self, () => sync(() => fiber.setServices(ServiceMap.addOrOmit(fiber.services, service, prev))));
|
|
1148
|
+
const provideServiceImpl = (self, service, implementation) => updateContext(self, s => {
|
|
1149
|
+
const prev = s.mapUnsafe.get(service.key);
|
|
1150
|
+
if (prev === implementation) return s;
|
|
1151
|
+
return Context.add(s, service, implementation);
|
|
1169
1152
|
});
|
|
1170
1153
|
/** @internal */
|
|
1171
1154
|
export const provideServiceEffect = /*#__PURE__*/dual(3, (self, service, acquire) => flatMap(acquire, implementation => provideService(self, service, implementation)));
|
|
@@ -1186,7 +1169,7 @@ export const zipWith = /*#__PURE__*/dual(args => isEffect(args[1]), (self, that,
|
|
|
1186
1169
|
// filtering & conditionals
|
|
1187
1170
|
// ----------------------------------------------------------------------------
|
|
1188
1171
|
/* @internal */
|
|
1189
|
-
export const filterOrFail = /*#__PURE__*/dual(args => isEffect(args[0]), (self,
|
|
1172
|
+
export const filterOrFail = /*#__PURE__*/dual(args => isEffect(args[0]), (self, predicate, orFailWith) => filterOrElse(self, predicate, orFailWith ? a => fail(orFailWith(a)) : () => fail(new NoSuchElementError())));
|
|
1190
1173
|
/** @internal */
|
|
1191
1174
|
export const when = /*#__PURE__*/dual(2, (self, condition) => flatMap(condition, pass => pass ? asSome(self) : succeedNone));
|
|
1192
1175
|
// ----------------------------------------------------------------------------
|
|
@@ -1222,40 +1205,61 @@ const OnFailureProto = /*#__PURE__*/makePrimitiveProto({
|
|
|
1222
1205
|
}
|
|
1223
1206
|
});
|
|
1224
1207
|
/** @internal */
|
|
1225
|
-
export const catchCauseIf = /*#__PURE__*/dual(3, (self,
|
|
1226
|
-
|
|
1227
|
-
|
|
1208
|
+
export const catchCauseIf = /*#__PURE__*/dual(3, (self, predicate, f) => catchCause(self, cause => {
|
|
1209
|
+
if (!predicate(cause)) {
|
|
1210
|
+
return failCause(cause);
|
|
1211
|
+
}
|
|
1212
|
+
return internalCall(() => f(cause));
|
|
1228
1213
|
}));
|
|
1229
1214
|
/** @internal */
|
|
1230
|
-
export const
|
|
1215
|
+
export const catchCauseFilter = /*#__PURE__*/dual(3, (self, filter, f) => catchCause(self, cause => {
|
|
1216
|
+
const eb = filter(cause);
|
|
1217
|
+
return Result.isFailure(eb) ? failCause(eb.failure) : internalCall(() => f(eb.success, cause));
|
|
1218
|
+
}));
|
|
1219
|
+
/** @internal */
|
|
1220
|
+
export const catch_ = /*#__PURE__*/dual(2, (self, f) => catchCauseFilter(self, findError, e => f(e)));
|
|
1231
1221
|
/** @internal */
|
|
1232
1222
|
export const catchNoSuchElement = self => matchEffect(self, {
|
|
1233
1223
|
onFailure: error => isNoSuchElementError(error) ? succeedNone : fail(error),
|
|
1234
1224
|
onSuccess: succeedSome
|
|
1235
1225
|
});
|
|
1236
1226
|
/** @internal */
|
|
1237
|
-
export const catchDefect = /*#__PURE__*/dual(2, (self, f) =>
|
|
1227
|
+
export const catchDefect = /*#__PURE__*/dual(2, (self, f) => catchCauseFilter(self, findDefect, f));
|
|
1238
1228
|
/** @internal */
|
|
1239
1229
|
export const tapCause = /*#__PURE__*/dual(2, (self, f) => catchCause(self, cause => andThen(internalCall(() => f(cause)), failCause(cause))));
|
|
1240
1230
|
/** @internal */
|
|
1241
|
-
export const tapCauseIf = /*#__PURE__*/dual(3, (self,
|
|
1242
|
-
const result = Filter.apply(filter, cause);
|
|
1243
|
-
return Result.isFailure(result) ? Result.fail(cause) : result;
|
|
1244
|
-
}, (failure, cause) => andThen(internalCall(() => f(failure, cause)), failCause(cause))));
|
|
1231
|
+
export const tapCauseIf = /*#__PURE__*/dual(3, (self, predicate, f) => catchCauseIf(self, predicate, cause => andThen(internalCall(() => f(cause)), failCause(cause))));
|
|
1245
1232
|
/** @internal */
|
|
1246
|
-
export const
|
|
1233
|
+
export const tapCauseFilter = /*#__PURE__*/dual(3, (self, filter, f) => catchCause(self, cause => {
|
|
1234
|
+
const result = filter(cause);
|
|
1235
|
+
if (Result.isFailure(result)) {
|
|
1236
|
+
return failCause(cause);
|
|
1237
|
+
}
|
|
1238
|
+
return andThen(internalCall(() => f(result.success, cause)), failCause(cause));
|
|
1239
|
+
}));
|
|
1240
|
+
/** @internal */
|
|
1241
|
+
export const tapError = /*#__PURE__*/dual(2, (self, f) => tapCauseFilter(self, findError, e => f(e)));
|
|
1247
1242
|
/** @internal */
|
|
1248
1243
|
export const tapErrorTag = /*#__PURE__*/dual(3, (self, k, f) => {
|
|
1249
1244
|
const predicate = Array.isArray(k) ? e => hasProperty(e, "_tag") && k.includes(e._tag) : isTagged(k);
|
|
1250
1245
|
return tapError(self, error => predicate(error) ? f(error) : void_);
|
|
1251
1246
|
});
|
|
1252
1247
|
/** @internal */
|
|
1253
|
-
export const tapDefect = /*#__PURE__*/dual(2, (self, f) =>
|
|
1248
|
+
export const tapDefect = /*#__PURE__*/dual(2, (self, f) => tapCauseFilter(self, findDefect, _ => f(_)));
|
|
1249
|
+
/** @internal */
|
|
1250
|
+
export const catchIf = /*#__PURE__*/dual(args => isEffect(args[0]), (self, predicate, f, orElse) => catchCause(self, cause => {
|
|
1251
|
+
const error = findError(cause);
|
|
1252
|
+
if (Result.isFailure(error)) return failCause(error.failure);
|
|
1253
|
+
if (!predicate(error.success)) {
|
|
1254
|
+
return orElse ? internalCall(() => orElse(error.success)) : failCause(cause);
|
|
1255
|
+
}
|
|
1256
|
+
return internalCall(() => f(error.success));
|
|
1257
|
+
}));
|
|
1254
1258
|
/** @internal */
|
|
1255
|
-
export const
|
|
1259
|
+
export const catchFilter = /*#__PURE__*/dual(args => isEffect(args[0]), (self, filter, f, orElse) => catchCause(self, cause => {
|
|
1256
1260
|
const error = findError(cause);
|
|
1257
1261
|
if (Result.isFailure(error)) return failCause(error.failure);
|
|
1258
|
-
const result =
|
|
1262
|
+
const result = filter(error.success);
|
|
1259
1263
|
if (Result.isFailure(result)) {
|
|
1260
1264
|
return orElse ? internalCall(() => orElse(result.failure)) : failCause(cause);
|
|
1261
1265
|
}
|
|
@@ -1269,7 +1273,7 @@ export const catchTag = /*#__PURE__*/dual(args => isEffect(args[0]), (self, k, f
|
|
|
1269
1273
|
/** @internal */
|
|
1270
1274
|
export const catchTags = /*#__PURE__*/dual(args => isEffect(args[0]), (self, cases, orElse) => {
|
|
1271
1275
|
let keys;
|
|
1272
|
-
return
|
|
1276
|
+
return catchFilter(self, e => {
|
|
1273
1277
|
keys ??= Object.keys(cases);
|
|
1274
1278
|
return hasProperty(e, "_tag") && isString(e["_tag"]) && keys.includes(e["_tag"]) ? Result.succeed(e) : Result.fail(e);
|
|
1275
1279
|
}, e => internalCall(() => cases[e["_tag"]](e)), orElse);
|
|
@@ -1277,8 +1281,8 @@ export const catchTags = /*#__PURE__*/dual(args => isEffect(args[0]), (self, cas
|
|
|
1277
1281
|
/** @internal */
|
|
1278
1282
|
export const catchReason = /*#__PURE__*/dual(args => isEffect(args[0]), (self, errorTag, reasonTag, f, orElse) => catchIf(self, e => isTagged(e, errorTag) && hasProperty(e, "reason"), e => {
|
|
1279
1283
|
const reason = e.reason;
|
|
1280
|
-
if (isTagged(reason, reasonTag)) return f(reason);
|
|
1281
|
-
return orElse ? internalCall(() => orElse(reason)) : fail(e);
|
|
1284
|
+
if (isTagged(reason, reasonTag)) return f(reason, e);
|
|
1285
|
+
return orElse ? internalCall(() => orElse(reason, e)) : fail(e);
|
|
1282
1286
|
}));
|
|
1283
1287
|
/** @internal */
|
|
1284
1288
|
export const catchReasons = /*#__PURE__*/dual(args => isEffect(args[0]), (self, errorTag, cases, orElse) => {
|
|
@@ -1287,13 +1291,13 @@ export const catchReasons = /*#__PURE__*/dual(args => isEffect(args[0]), (self,
|
|
|
1287
1291
|
const reason = e.reason;
|
|
1288
1292
|
keys ??= Object.keys(cases);
|
|
1289
1293
|
if (keys.includes(reason._tag)) {
|
|
1290
|
-
return internalCall(() => cases[reason._tag](reason));
|
|
1294
|
+
return internalCall(() => cases[reason._tag](reason, e));
|
|
1291
1295
|
}
|
|
1292
|
-
return orElse ? internalCall(() => orElse(reason)) : fail(e);
|
|
1296
|
+
return orElse ? internalCall(() => orElse(reason, e)) : fail(e);
|
|
1293
1297
|
});
|
|
1294
1298
|
});
|
|
1295
1299
|
/** @internal */
|
|
1296
|
-
export const unwrapReason = /*#__PURE__*/dual(2, (self, errorTag) =>
|
|
1300
|
+
export const unwrapReason = /*#__PURE__*/dual(2, (self, errorTag) => catchFilter(self, e => {
|
|
1297
1301
|
if (isTagged(e, errorTag) && hasProperty(e, "reason")) {
|
|
1298
1302
|
return Result.succeed(e.reason);
|
|
1299
1303
|
}
|
|
@@ -1326,7 +1330,7 @@ export const ignore = /*#__PURE__*/dual(args => isEffect(args[0]), (self, option
|
|
|
1326
1330
|
return matchCauseEffect(self, {
|
|
1327
1331
|
onFailure(cause) {
|
|
1328
1332
|
const failure = findFail(cause);
|
|
1329
|
-
return Result.isFailure(failure) ? failCause(failure.failure) : logEffect(cause);
|
|
1333
|
+
return Result.isFailure(failure) ? failCause(failure.failure) : options.message === undefined ? logEffect(cause) : logEffect(options.message, cause);
|
|
1330
1334
|
},
|
|
1331
1335
|
onSuccess: _ => void_
|
|
1332
1336
|
});
|
|
@@ -1341,7 +1345,7 @@ export const ignoreCause = /*#__PURE__*/dual(args => isEffect(args[0]), (self, o
|
|
|
1341
1345
|
}
|
|
1342
1346
|
const logEffect = logWithLevel(options.log === true ? undefined : options.log);
|
|
1343
1347
|
return matchCauseEffect(self, {
|
|
1344
|
-
onFailure: logEffect,
|
|
1348
|
+
onFailure: cause => options.message === undefined ? logEffect(cause) : logEffect(options.message, cause),
|
|
1345
1349
|
onSuccess: _ => void_
|
|
1346
1350
|
});
|
|
1347
1351
|
});
|
|
@@ -1443,11 +1447,11 @@ export const isSuccess = /*#__PURE__*/matchEager({
|
|
|
1443
1447
|
/** @internal */
|
|
1444
1448
|
export const delay = /*#__PURE__*/dual(2, (self, duration) => andThen(sleep(duration), self));
|
|
1445
1449
|
/** @internal */
|
|
1446
|
-
export const timeoutOrElse = /*#__PURE__*/dual(2, (self, options) => raceFirst(self, flatMap(sleep(options.duration), options.
|
|
1450
|
+
export const timeoutOrElse = /*#__PURE__*/dual(2, (self, options) => raceFirst(self, flatMap(sleep(options.duration), options.orElse)));
|
|
1447
1451
|
/** @internal */
|
|
1448
1452
|
export const timeout = /*#__PURE__*/dual(2, (self, duration) => timeoutOrElse(self, {
|
|
1449
1453
|
duration,
|
|
1450
|
-
|
|
1454
|
+
orElse: () => fail(new TimeoutError())
|
|
1451
1455
|
}));
|
|
1452
1456
|
/** @internal */
|
|
1453
1457
|
export const timeoutOption = /*#__PURE__*/dual(2, (self, duration) => raceFirst(asSome(self), as(sleep(duration), Option.none())));
|
|
@@ -1464,7 +1468,7 @@ export const ScopeTypeId = "~effect/Scope";
|
|
|
1464
1468
|
/** @internal */
|
|
1465
1469
|
export const ScopeCloseableTypeId = "~effect/Scope/Closeable";
|
|
1466
1470
|
/** @internal */
|
|
1467
|
-
export const scopeTag = /*#__PURE__*/
|
|
1471
|
+
export const scopeTag = /*#__PURE__*/Context.Service("effect/Scope");
|
|
1468
1472
|
/** @internal */
|
|
1469
1473
|
export const scopeClose = (self, exit_) => suspend(() => scopeCloseUnsafe(self, exit_) ?? void_);
|
|
1470
1474
|
/** @internal */
|
|
@@ -1568,11 +1572,11 @@ export const scope = /*#__PURE__*/scopeTag.asEffect();
|
|
|
1568
1572
|
export const provideScope = /*#__PURE__*/provideService(scopeTag);
|
|
1569
1573
|
/** @internal */
|
|
1570
1574
|
export const scoped = self => withFiber(fiber => {
|
|
1571
|
-
const prev =
|
|
1575
|
+
const prev = fiber.context;
|
|
1572
1576
|
const scope = scopeMakeUnsafe();
|
|
1573
|
-
fiber.
|
|
1577
|
+
fiber.setContext(Context.add(fiber.context, scopeTag, scope));
|
|
1574
1578
|
return onExitPrimitive(self, exit => {
|
|
1575
|
-
fiber.
|
|
1579
|
+
fiber.setContext(prev);
|
|
1576
1580
|
return scopeCloseUnsafe(scope, exit);
|
|
1577
1581
|
});
|
|
1578
1582
|
});
|
|
@@ -1584,9 +1588,9 @@ export const scopedWith = f => suspend(() => {
|
|
|
1584
1588
|
return onExit(f(scope), exit => suspend(() => scopeCloseUnsafe(scope, exit) ?? void_));
|
|
1585
1589
|
});
|
|
1586
1590
|
/** @internal */
|
|
1587
|
-
export const acquireRelease = (acquire, release) =>
|
|
1591
|
+
export const acquireRelease = (acquire, release, options) => contextWith(context => uninterruptibleMask(restore => flatMap(scope, scope => tap(options?.interruptible ? restore(acquire) : acquire, a => scopeAddFinalizerExit(scope, exit => provideContext(release(a, exit), context))))));
|
|
1588
1592
|
/** @internal */
|
|
1589
|
-
export const addFinalizer = finalizer => flatMap(scope, scope =>
|
|
1593
|
+
export const addFinalizer = finalizer => flatMap(scope, scope => contextWith(context => scopeAddFinalizerExit(scope, exit => provideContext(finalizer(exit), context))));
|
|
1590
1594
|
/** @internal */
|
|
1591
1595
|
export const onExitPrimitive = /*#__PURE__*/makePrimitive({
|
|
1592
1596
|
op: "OnExit",
|
|
@@ -1617,19 +1621,36 @@ export const onExit = /*#__PURE__*/dual(2, onExitPrimitive);
|
|
|
1617
1621
|
/** @internal */
|
|
1618
1622
|
export const ensuring = /*#__PURE__*/dual(2, (self, finalizer) => onExit(self, _ => finalizer));
|
|
1619
1623
|
/** @internal */
|
|
1620
|
-
export const onExitIf = /*#__PURE__*/dual(3, (self,
|
|
1621
|
-
|
|
1622
|
-
|
|
1624
|
+
export const onExitIf = /*#__PURE__*/dual(3, (self, predicate, f) => onExit(self, exit => {
|
|
1625
|
+
if (!predicate(exit)) {
|
|
1626
|
+
return void_;
|
|
1627
|
+
}
|
|
1628
|
+
return f(exit);
|
|
1629
|
+
}));
|
|
1630
|
+
/** @internal */
|
|
1631
|
+
export const onExitFilter = /*#__PURE__*/dual(3, (self, filter, f) => onExit(self, exit => {
|
|
1632
|
+
const b = filter(exit);
|
|
1633
|
+
return Result.isFailure(b) ? void_ : f(b.success, exit);
|
|
1623
1634
|
}));
|
|
1624
1635
|
/** @internal */
|
|
1625
|
-
export const onError = /*#__PURE__*/dual(2, (self, f) =>
|
|
1636
|
+
export const onError = /*#__PURE__*/dual(2, (self, f) => onExitFilter(self, exitFilterCause, f));
|
|
1626
1637
|
/** @internal */
|
|
1627
|
-
export const onErrorIf = /*#__PURE__*/dual(3, (self,
|
|
1628
|
-
if (exit._tag !== "Failure")
|
|
1629
|
-
|
|
1630
|
-
}
|
|
1638
|
+
export const onErrorIf = /*#__PURE__*/dual(3, (self, predicate, f) => onExitIf(self, exit => {
|
|
1639
|
+
if (exit._tag !== "Failure") {
|
|
1640
|
+
return false;
|
|
1641
|
+
}
|
|
1642
|
+
return predicate(exit.cause);
|
|
1643
|
+
}, exit => f(exit.cause)));
|
|
1644
|
+
/** @internal */
|
|
1645
|
+
export const onErrorFilter = /*#__PURE__*/dual(3, (self, filter, f) => onExit(self, exit => {
|
|
1646
|
+
if (exit._tag !== "Failure") {
|
|
1647
|
+
return void_;
|
|
1648
|
+
}
|
|
1649
|
+
const result = filter(exit.cause);
|
|
1650
|
+
return Result.isFailure(result) ? void_ : f(result.success, exit.cause);
|
|
1651
|
+
}));
|
|
1631
1652
|
/** @internal */
|
|
1632
|
-
export const onInterrupt = /*#__PURE__*/dual(2, (self, finalizer) =>
|
|
1653
|
+
export const onInterrupt = /*#__PURE__*/dual(2, (self, finalizer) => onErrorFilter(causeFilterInterruptors, finalizer)(self));
|
|
1633
1654
|
/** @internal */
|
|
1634
1655
|
export const acquireUseRelease = (acquire, use, release) => uninterruptibleMask(restore => flatMap(acquire, a => onExitPrimitive(restore(use(a)), exit => release(a, exit), true)));
|
|
1635
1656
|
// ----------------------------------------------------------------------------
|
|
@@ -1637,7 +1658,7 @@ export const acquireUseRelease = (acquire, use, release) => uninterruptibleMask(
|
|
|
1637
1658
|
// ----------------------------------------------------------------------------
|
|
1638
1659
|
/** @internal */
|
|
1639
1660
|
export const cachedInvalidateWithTTL = /*#__PURE__*/dual(2, (self, ttl) => sync(() => {
|
|
1640
|
-
const ttlMillis = Duration.toMillis(Duration.
|
|
1661
|
+
const ttlMillis = Duration.toMillis(Duration.fromInputUnsafe(ttl));
|
|
1641
1662
|
const isFinite = Number.isFinite(ttlMillis);
|
|
1642
1663
|
const latch = makeLatchUnsafe(false);
|
|
1643
1664
|
let expiresAt = 0;
|
|
@@ -1645,14 +1666,15 @@ export const cachedInvalidateWithTTL = /*#__PURE__*/dual(2, (self, ttl) => sync(
|
|
|
1645
1666
|
let exit;
|
|
1646
1667
|
const wait = flatMap(latch.await, () => exit);
|
|
1647
1668
|
return [withFiber(fiber => {
|
|
1648
|
-
const
|
|
1669
|
+
const clock = fiber.getRef(ClockRef);
|
|
1670
|
+
const now = isFinite ? clock.currentTimeMillisUnsafe() : 0;
|
|
1649
1671
|
if (running || now < expiresAt) return exit ?? wait;
|
|
1650
1672
|
running = true;
|
|
1651
1673
|
latch.closeUnsafe();
|
|
1652
1674
|
exit = undefined;
|
|
1653
1675
|
return onExit(self, exit_ => sync(() => {
|
|
1654
1676
|
running = false;
|
|
1655
|
-
expiresAt =
|
|
1677
|
+
expiresAt = clock.currentTimeMillisUnsafe() + ttlMillis;
|
|
1656
1678
|
exit = exit_;
|
|
1657
1679
|
latch.openUnsafe();
|
|
1658
1680
|
}));
|
|
@@ -1732,7 +1754,54 @@ export const all = (arg, options) => {
|
|
|
1732
1754
|
});
|
|
1733
1755
|
};
|
|
1734
1756
|
/** @internal */
|
|
1735
|
-
export const partition = /*#__PURE__*/dual(args => isIterable(args[0]) && !isEffect(args[0]), (elements, f, options) => map(forEach(elements, (a, i) => result(f(a, i)), options), results => Arr.
|
|
1757
|
+
export const partition = /*#__PURE__*/dual(args => isIterable(args[0]) && !isEffect(args[0]), (elements, f, options) => map(forEach(elements, (a, i) => result(f(a, i)), options), results => Arr.partition(results, identity)));
|
|
1758
|
+
/** @internal */
|
|
1759
|
+
export const validate = /*#__PURE__*/dual(args => isIterable(args[0]) && !isEffect(args[0]), (elements, f, options) => flatMap(partition(elements, f, {
|
|
1760
|
+
concurrency: options?.concurrency
|
|
1761
|
+
}), ([excluded, satisfying]) => {
|
|
1762
|
+
if (Arr.isArrayNonEmpty(excluded)) {
|
|
1763
|
+
return fail(excluded);
|
|
1764
|
+
}
|
|
1765
|
+
return options?.discard ? void_ : succeed(satisfying);
|
|
1766
|
+
}));
|
|
1767
|
+
/** @internal */
|
|
1768
|
+
export const findFirst = /*#__PURE__*/dual(args => isIterable(args[0]) && !isEffect(args[0]), (elements, predicate) => suspend(() => {
|
|
1769
|
+
const iterator = elements[Symbol.iterator]();
|
|
1770
|
+
const next = iterator.next();
|
|
1771
|
+
if (!next.done) {
|
|
1772
|
+
return findFirstLoop(iterator, 0, predicate, next.value);
|
|
1773
|
+
}
|
|
1774
|
+
return succeed(Option.none());
|
|
1775
|
+
}));
|
|
1776
|
+
const findFirstLoop = (iterator, index, predicate, value) => flatMap(predicate(value, index), keep => {
|
|
1777
|
+
if (keep) {
|
|
1778
|
+
return succeed(Option.some(value));
|
|
1779
|
+
}
|
|
1780
|
+
const next = iterator.next();
|
|
1781
|
+
if (!next.done) {
|
|
1782
|
+
return findFirstLoop(iterator, index + 1, predicate, next.value);
|
|
1783
|
+
}
|
|
1784
|
+
return succeed(Option.none());
|
|
1785
|
+
});
|
|
1786
|
+
/** @internal */
|
|
1787
|
+
export const findFirstFilter = /*#__PURE__*/dual(args => isIterable(args[0]) && !isEffect(args[0]), (elements, filter) => suspend(() => {
|
|
1788
|
+
const iterator = elements[Symbol.iterator]();
|
|
1789
|
+
const next = iterator.next();
|
|
1790
|
+
if (!next.done) {
|
|
1791
|
+
return findFirstFilterLoop(iterator, 0, filter, next.value);
|
|
1792
|
+
}
|
|
1793
|
+
return succeed(Option.none());
|
|
1794
|
+
}));
|
|
1795
|
+
const findFirstFilterLoop = (iterator, index, filter, value) => flatMap(filter(value, index), result => {
|
|
1796
|
+
if (Result.isSuccess(result)) {
|
|
1797
|
+
return succeed(Option.some(result.success));
|
|
1798
|
+
}
|
|
1799
|
+
const next = iterator.next();
|
|
1800
|
+
if (!next.done) {
|
|
1801
|
+
return findFirstFilterLoop(iterator, index + 1, filter, next.value);
|
|
1802
|
+
}
|
|
1803
|
+
return succeed(Option.none());
|
|
1804
|
+
});
|
|
1736
1805
|
/** @internal */
|
|
1737
1806
|
export const whileLoop = /*#__PURE__*/makePrimitive({
|
|
1738
1807
|
op: "While",
|
|
@@ -1765,70 +1834,13 @@ export const forEach = /*#__PURE__*/dual(args => typeof args[1] === "function",
|
|
|
1765
1834
|
return options?.discard ? void_ : succeed([]);
|
|
1766
1835
|
}
|
|
1767
1836
|
const out = options?.discard ? undefined : new Array(length);
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
let failed = false;
|
|
1774
|
-
let inProgress = 0;
|
|
1775
|
-
let doneCount = 0;
|
|
1776
|
-
let pumping = false;
|
|
1777
|
-
let interrupted = false;
|
|
1778
|
-
function pump() {
|
|
1779
|
-
pumping = true;
|
|
1780
|
-
while (inProgress < concurrency && index < length) {
|
|
1781
|
-
const currentIndex = index;
|
|
1782
|
-
const item = items[currentIndex];
|
|
1783
|
-
index++;
|
|
1784
|
-
inProgress++;
|
|
1785
|
-
try {
|
|
1786
|
-
const child = forkUnsafe(parent, f(item, currentIndex), true, true, "inherit");
|
|
1787
|
-
fibers.add(child);
|
|
1788
|
-
child.addObserver(exit => {
|
|
1789
|
-
if (interrupted) {
|
|
1790
|
-
return;
|
|
1791
|
-
}
|
|
1792
|
-
fibers.delete(child);
|
|
1793
|
-
if (exit._tag === "Failure") {
|
|
1794
|
-
if (!failed) {
|
|
1795
|
-
failed = true;
|
|
1796
|
-
length = index;
|
|
1797
|
-
failures.push(...exit.cause.reasons);
|
|
1798
|
-
fibers.forEach(fiber => fiber.interruptUnsafe(parent.id, annotations));
|
|
1799
|
-
} else {
|
|
1800
|
-
for (const f of exit.cause.reasons) {
|
|
1801
|
-
if (f._tag === "Interrupt") continue;
|
|
1802
|
-
failures.push(f);
|
|
1803
|
-
}
|
|
1804
|
-
}
|
|
1805
|
-
} else if (out !== undefined) {
|
|
1806
|
-
out[currentIndex] = exit.value;
|
|
1807
|
-
}
|
|
1808
|
-
doneCount++;
|
|
1809
|
-
inProgress--;
|
|
1810
|
-
if (doneCount === length) {
|
|
1811
|
-
resume(failures.length > 0 ? exitFailCause(causeFromReasons(failures)) : succeed(out));
|
|
1812
|
-
} else if (!pumping && !failed && inProgress < concurrency) {
|
|
1813
|
-
pump();
|
|
1814
|
-
}
|
|
1815
|
-
});
|
|
1816
|
-
} catch (err) {
|
|
1817
|
-
failed = true;
|
|
1818
|
-
length = index;
|
|
1819
|
-
failures.push(new Die(err));
|
|
1820
|
-
fibers.forEach(fiber => fiber.interruptUnsafe(parent.id, annotations));
|
|
1821
|
-
}
|
|
1822
|
-
}
|
|
1823
|
-
pumping = false;
|
|
1824
|
-
}
|
|
1825
|
-
pump();
|
|
1826
|
-
return suspend(() => {
|
|
1827
|
-
interrupted = true;
|
|
1828
|
-
index = length;
|
|
1829
|
-
return fiberInterruptAll(fibers);
|
|
1830
|
-
});
|
|
1837
|
+
const eff = forEachConcurrent({
|
|
1838
|
+
f,
|
|
1839
|
+
out
|
|
1840
|
+
}, items, {
|
|
1841
|
+
concurrency
|
|
1831
1842
|
});
|
|
1843
|
+
return eff ? as(eff, out) : succeed(out);
|
|
1832
1844
|
}));
|
|
1833
1845
|
const forEachSequential = (iterable, f, options) => suspend(() => {
|
|
1834
1846
|
const out = options?.discard ? undefined : [];
|
|
@@ -1844,31 +1856,151 @@ const forEachSequential = (iterable, f, options) => suspend(() => {
|
|
|
1844
1856
|
}
|
|
1845
1857
|
}), out);
|
|
1846
1858
|
});
|
|
1859
|
+
const iterateEagerImpl = options => {
|
|
1860
|
+
const onItem = options.onItem;
|
|
1861
|
+
const step = options.step;
|
|
1862
|
+
return (state, items, opts) => {
|
|
1863
|
+
let index = opts?.start ?? 0;
|
|
1864
|
+
const end = opts?.end ?? items.length;
|
|
1865
|
+
const concurrency = opts?.concurrency ?? 1;
|
|
1866
|
+
let done = false;
|
|
1867
|
+
let parentFiber;
|
|
1868
|
+
let fibers;
|
|
1869
|
+
let resume;
|
|
1870
|
+
let interrupted = false;
|
|
1871
|
+
let terminal;
|
|
1872
|
+
let effect;
|
|
1873
|
+
const go = () => {
|
|
1874
|
+
let paused = false;
|
|
1875
|
+
for (; !terminal && index < end; index++) {
|
|
1876
|
+
const item = items[index];
|
|
1877
|
+
const eff = effect ?? onItem(state, item, index);
|
|
1878
|
+
// fast case (already an exit)
|
|
1879
|
+
if (effectIsExit(eff)) {
|
|
1880
|
+
terminal = step(state, item, eff, index);
|
|
1881
|
+
if (terminal) break;
|
|
1882
|
+
// Use flatMap for concurrency of 1
|
|
1883
|
+
} else if (concurrency === 1) {
|
|
1884
|
+
return flatMap(exit(eff), exit => {
|
|
1885
|
+
terminal = step(state, item, exit, index);
|
|
1886
|
+
index++;
|
|
1887
|
+
return terminal ?? go() ?? void_;
|
|
1888
|
+
});
|
|
1889
|
+
// We have an effect, so enter "async" mode
|
|
1890
|
+
} else if (!parentFiber) {
|
|
1891
|
+
return callback(cb => {
|
|
1892
|
+
parentFiber = getCurrentFiber();
|
|
1893
|
+
effect = eff;
|
|
1894
|
+
resume = cb;
|
|
1895
|
+
const result = go();
|
|
1896
|
+
if (result) return cb(result);
|
|
1897
|
+
return suspend(() => {
|
|
1898
|
+
terminal = exitVoid;
|
|
1899
|
+
interrupted = true;
|
|
1900
|
+
return fibers ? fiberInterruptAll(fibers) : void_;
|
|
1901
|
+
});
|
|
1902
|
+
});
|
|
1903
|
+
// Fork the effect with concurrency > 1
|
|
1904
|
+
} else {
|
|
1905
|
+
// Clear the temporary effect from capturing the parentFiber
|
|
1906
|
+
effect = undefined;
|
|
1907
|
+
const fiber = forkUnsafe(parentFiber, eff, true, true, "inherit");
|
|
1908
|
+
if (fiber._exit) {
|
|
1909
|
+
terminal = step(state, item, fiber._exit, index);
|
|
1910
|
+
if (terminal) break;
|
|
1911
|
+
continue;
|
|
1912
|
+
}
|
|
1913
|
+
// Add the fiber to the Set
|
|
1914
|
+
if (fibers) fibers.add(fiber);else fibers = new Set([fiber]);
|
|
1915
|
+
const currentIndex = index;
|
|
1916
|
+
fiber.addObserver(exit => {
|
|
1917
|
+
fibers.delete(fiber);
|
|
1918
|
+
if (terminal) {
|
|
1919
|
+
if (!interrupted && exit._tag === "Failure") {
|
|
1920
|
+
for (const reason of exit.cause.reasons) {
|
|
1921
|
+
if (reason._tag === "Interrupt") continue;else if (terminal._tag === "Failure") {
|
|
1922
|
+
;
|
|
1923
|
+
terminal.cause.reasons.push(reason);
|
|
1924
|
+
} else {
|
|
1925
|
+
terminal = exitFailCause(causeFromReasons([reason]));
|
|
1926
|
+
}
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
} else {
|
|
1930
|
+
const result = step(state, item, exit, currentIndex);
|
|
1931
|
+
if (result) {
|
|
1932
|
+
terminal = result._tag === "Failure" ? exitFailCause(causeFromReasons(result.cause.reasons.slice())) : result;
|
|
1933
|
+
go();
|
|
1934
|
+
}
|
|
1935
|
+
}
|
|
1936
|
+
if (paused) {
|
|
1937
|
+
const eff = go();
|
|
1938
|
+
if (eff) resume(eff);
|
|
1939
|
+
} else if (done && fibers.size === 0) {
|
|
1940
|
+
resume(terminal ?? void_);
|
|
1941
|
+
}
|
|
1942
|
+
});
|
|
1943
|
+
// Check if we have reached the concurrency limit
|
|
1944
|
+
if (fibers.size < concurrency) continue;
|
|
1945
|
+
paused = true;
|
|
1946
|
+
index++;
|
|
1947
|
+
return;
|
|
1948
|
+
}
|
|
1949
|
+
}
|
|
1950
|
+
done = true;
|
|
1951
|
+
if (terminal) {
|
|
1952
|
+
if (fibers && fibers.size > 0) {
|
|
1953
|
+
const annotations = fiberStackAnnotations(parentFiber);
|
|
1954
|
+
fibers.forEach(f => f.interruptUnsafe(parentFiber.id, annotations));
|
|
1955
|
+
return;
|
|
1956
|
+
}
|
|
1957
|
+
if (resume || terminal._tag === "Failure") {
|
|
1958
|
+
return terminal;
|
|
1959
|
+
}
|
|
1960
|
+
} else if (resume) {
|
|
1961
|
+
if (!fibers) {
|
|
1962
|
+
return exitVoid;
|
|
1963
|
+
} else if (fibers.size === 0) {
|
|
1964
|
+
resume(void_);
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1967
|
+
};
|
|
1968
|
+
return go();
|
|
1969
|
+
};
|
|
1970
|
+
};
|
|
1971
|
+
/** @internal */
|
|
1972
|
+
export const iterateEager = () => iterateEagerImpl;
|
|
1973
|
+
const forEachConcurrent = /*#__PURE__*/iterateEagerImpl({
|
|
1974
|
+
onItem(state, item, index) {
|
|
1975
|
+
return state.f(item, index);
|
|
1976
|
+
},
|
|
1977
|
+
step(state, _, exit, index) {
|
|
1978
|
+
if (exit._tag === "Failure") return exit;else if (state.out) {
|
|
1979
|
+
state.out[index] = exit.value;
|
|
1980
|
+
}
|
|
1981
|
+
}
|
|
1982
|
+
});
|
|
1847
1983
|
/* @internal */
|
|
1848
|
-
export const filterOrElse = /*#__PURE__*/dual(3, (self,
|
|
1849
|
-
|
|
1984
|
+
export const filterOrElse = /*#__PURE__*/dual(3, (self, predicate, orElse) => flatMap(self, a => predicate(a) ? succeed(a) : orElse(a)));
|
|
1985
|
+
/** @internal */
|
|
1986
|
+
export const filterMapOrElse = /*#__PURE__*/dual(3, (self, filter, orElse) => flatMap(self, a => {
|
|
1987
|
+
const result = filter(a);
|
|
1850
1988
|
return Result.isFailure(result) ? orElse(result.failure) : succeed(result.success);
|
|
1851
1989
|
}));
|
|
1990
|
+
/* @internal */
|
|
1991
|
+
export const filterMapOrFail = /*#__PURE__*/dual(args => isEffect(args[0]), (self, filter, orFailWith) => filterMapOrElse(self, filter, orFailWith ? x => fail(orFailWith(x)) : () => fail(new NoSuchElementError())));
|
|
1852
1992
|
/** @internal */
|
|
1853
|
-
export const filter = /*#__PURE__*/dual(args => isIterable(args[0]) && !isEffect(args[0]), (elements,
|
|
1993
|
+
export const filter = /*#__PURE__*/dual(args => isIterable(args[0]) && !isEffect(args[0]), (elements, predicate, options) => suspend(() => {
|
|
1854
1994
|
const out = [];
|
|
1855
1995
|
return as(forEach(elements, (a, i) => {
|
|
1856
|
-
const result =
|
|
1996
|
+
const result = predicate(a, i);
|
|
1857
1997
|
if (typeof result === "boolean") {
|
|
1858
1998
|
if (result) out.push(a);
|
|
1859
1999
|
return void_;
|
|
1860
2000
|
}
|
|
1861
|
-
|
|
1862
|
-
if (
|
|
1863
|
-
out.push(
|
|
1864
|
-
}
|
|
1865
|
-
return void_;
|
|
1866
|
-
}
|
|
1867
|
-
return map(result, r => {
|
|
1868
|
-
if (typeof r === "boolean") {
|
|
1869
|
-
if (r) out.push(a);
|
|
1870
|
-
} else if (!Result.isFailure(r)) {
|
|
1871
|
-
out.push(r.success);
|
|
2001
|
+
return map(result, keep => {
|
|
2002
|
+
if (keep) {
|
|
2003
|
+
out.push(a);
|
|
1872
2004
|
}
|
|
1873
2005
|
});
|
|
1874
2006
|
}, {
|
|
@@ -1876,6 +2008,29 @@ export const filter = /*#__PURE__*/dual(args => isIterable(args[0]) && !isEffect
|
|
|
1876
2008
|
concurrency: options?.concurrency
|
|
1877
2009
|
}), out);
|
|
1878
2010
|
}));
|
|
2011
|
+
/** @internal */
|
|
2012
|
+
export const filterMap = /*#__PURE__*/dual(args => isIterable(args[0]) && !isEffect(args[0]), (elements, filter) => suspend(() => {
|
|
2013
|
+
const out = [];
|
|
2014
|
+
for (const a of elements) {
|
|
2015
|
+
const result = filter(a);
|
|
2016
|
+
if (Result.isSuccess(result)) {
|
|
2017
|
+
out.push(result.success);
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
2020
|
+
return succeed(out);
|
|
2021
|
+
}));
|
|
2022
|
+
/** @internal */
|
|
2023
|
+
export const filterMapEffect = /*#__PURE__*/dual(args => isIterable(args[0]) && !isEffect(args[0]), (elements, filter, options) => suspend(() => {
|
|
2024
|
+
const out = [];
|
|
2025
|
+
return as(forEach(elements, a => map(filter(a), result => {
|
|
2026
|
+
if (Result.isSuccess(result)) {
|
|
2027
|
+
out.push(result.success);
|
|
2028
|
+
}
|
|
2029
|
+
}), {
|
|
2030
|
+
discard: true,
|
|
2031
|
+
concurrency: options?.concurrency
|
|
2032
|
+
}), out);
|
|
2033
|
+
}));
|
|
1879
2034
|
// ----------------------------------------------------------------------------
|
|
1880
2035
|
// do notation
|
|
1881
2036
|
// ----------------------------------------------------------------------------
|
|
@@ -1900,11 +2055,11 @@ export const forkChild = /*#__PURE__*/dual(args => isEffect(args[0]), (self, opt
|
|
|
1900
2055
|
/** @internal */
|
|
1901
2056
|
export const forkUnsafe = (parent, effect, immediate = false, daemon = false, uninterruptible = false) => {
|
|
1902
2057
|
const interruptible = uninterruptible === "inherit" ? parent.interruptible : !uninterruptible;
|
|
1903
|
-
const child = new FiberImpl(parent.
|
|
2058
|
+
const child = new FiberImpl(parent.context, interruptible);
|
|
1904
2059
|
if (immediate) {
|
|
1905
2060
|
child.evaluate(effect);
|
|
1906
2061
|
} else {
|
|
1907
|
-
parent.
|
|
2062
|
+
parent.currentDispatcher.scheduleTask(() => child.evaluate(effect), 0);
|
|
1908
2063
|
}
|
|
1909
2064
|
if (!daemon && !child._exit) {
|
|
1910
2065
|
parent.children().add(child);
|
|
@@ -1948,9 +2103,8 @@ export const forkScoped = /*#__PURE__*/dual(args => isEffect(args[0]), (self, op
|
|
|
1948
2103
|
// execution
|
|
1949
2104
|
// ----------------------------------------------------------------------------
|
|
1950
2105
|
/** @internal */
|
|
1951
|
-
export const runForkWith =
|
|
1952
|
-
const
|
|
1953
|
-
const fiber = new FiberImpl(scheduler ? ServiceMap.add(services, Scheduler.Scheduler, scheduler) : services, options?.uninterruptible !== true);
|
|
2106
|
+
export const runForkWith = context => (effect, options) => {
|
|
2107
|
+
const fiber = new FiberImpl(options?.scheduler ? Context.add(context, Scheduler.Scheduler, options.scheduler) : context, options?.uninterruptible !== true);
|
|
1954
2108
|
fiber.evaluate(effect);
|
|
1955
2109
|
if (fiber._exit) return fiber;
|
|
1956
2110
|
if (options?.signal) {
|
|
@@ -1964,6 +2118,9 @@ export const runForkWith = services => (effect, options) => {
|
|
|
1964
2118
|
fiber.addObserver(() => options.signal.removeEventListener("abort", abort));
|
|
1965
2119
|
}
|
|
1966
2120
|
}
|
|
2121
|
+
if (options?.onFiberStart) {
|
|
2122
|
+
options.onFiberStart(fiber);
|
|
2123
|
+
}
|
|
1967
2124
|
return fiber;
|
|
1968
2125
|
};
|
|
1969
2126
|
/** @internal */
|
|
@@ -1980,10 +2137,10 @@ export const fiberRunIn = /*#__PURE__*/dual(2, (self, scope) => {
|
|
|
1980
2137
|
return self;
|
|
1981
2138
|
});
|
|
1982
2139
|
/** @internal */
|
|
1983
|
-
export const runFork = /*#__PURE__*/runForkWith(/*#__PURE__*/
|
|
2140
|
+
export const runFork = /*#__PURE__*/runForkWith(/*#__PURE__*/Context.empty());
|
|
1984
2141
|
/** @internal */
|
|
1985
|
-
export const runCallbackWith =
|
|
1986
|
-
const runFork = runForkWith(
|
|
2142
|
+
export const runCallbackWith = context => {
|
|
2143
|
+
const runFork = runForkWith(context);
|
|
1987
2144
|
return (effect, options) => {
|
|
1988
2145
|
const fiber = runFork(effect, options);
|
|
1989
2146
|
if (options?.onExit) {
|
|
@@ -1995,10 +2152,10 @@ export const runCallbackWith = services => {
|
|
|
1995
2152
|
};
|
|
1996
2153
|
};
|
|
1997
2154
|
/** @internal */
|
|
1998
|
-
export const runCallback = /*#__PURE__*/runCallbackWith(/*#__PURE__*/
|
|
2155
|
+
export const runCallback = /*#__PURE__*/runCallbackWith(/*#__PURE__*/Context.empty());
|
|
1999
2156
|
/** @internal */
|
|
2000
|
-
export const runPromiseExitWith =
|
|
2001
|
-
const runFork = runForkWith(
|
|
2157
|
+
export const runPromiseExitWith = context => {
|
|
2158
|
+
const runFork = runForkWith(context);
|
|
2002
2159
|
return (effect, options) => {
|
|
2003
2160
|
const fiber = runFork(effect, options);
|
|
2004
2161
|
return new Promise(resolve => {
|
|
@@ -2007,10 +2164,10 @@ export const runPromiseExitWith = services => {
|
|
|
2007
2164
|
};
|
|
2008
2165
|
};
|
|
2009
2166
|
/** @internal */
|
|
2010
|
-
export const runPromiseExit = /*#__PURE__*/runPromiseExitWith(/*#__PURE__*/
|
|
2167
|
+
export const runPromiseExit = /*#__PURE__*/runPromiseExitWith(/*#__PURE__*/Context.empty());
|
|
2011
2168
|
/** @internal */
|
|
2012
|
-
export const runPromiseWith =
|
|
2013
|
-
const runPromiseExit = runPromiseExitWith(
|
|
2169
|
+
export const runPromiseWith = context => {
|
|
2170
|
+
const runPromiseExit = runPromiseExitWith(context);
|
|
2014
2171
|
return (effect, options) => runPromiseExit(effect, options).then(exit => {
|
|
2015
2172
|
if (exit._tag === "Failure") {
|
|
2016
2173
|
throw causeSquash(exit.cause);
|
|
@@ -2019,25 +2176,25 @@ export const runPromiseWith = services => {
|
|
|
2019
2176
|
});
|
|
2020
2177
|
};
|
|
2021
2178
|
/** @internal */
|
|
2022
|
-
export const runPromise = /*#__PURE__*/runPromiseWith(/*#__PURE__*/
|
|
2179
|
+
export const runPromise = /*#__PURE__*/runPromiseWith(/*#__PURE__*/Context.empty());
|
|
2023
2180
|
/** @internal */
|
|
2024
|
-
export const runSyncExitWith =
|
|
2025
|
-
const runFork = runForkWith(
|
|
2181
|
+
export const runSyncExitWith = context => {
|
|
2182
|
+
const runFork = runForkWith(context);
|
|
2026
2183
|
return effect => {
|
|
2027
2184
|
if (effectIsExit(effect)) return effect;
|
|
2028
2185
|
const scheduler = new Scheduler.MixedScheduler("sync");
|
|
2029
2186
|
const fiber = runFork(effect, {
|
|
2030
2187
|
scheduler
|
|
2031
2188
|
});
|
|
2032
|
-
|
|
2033
|
-
return fiber._exit ?? exitDie(fiber);
|
|
2189
|
+
fiber.currentDispatcher?.flush();
|
|
2190
|
+
return fiber._exit ?? exitDie(new AsyncFiberError(fiber));
|
|
2034
2191
|
};
|
|
2035
2192
|
};
|
|
2036
2193
|
/** @internal */
|
|
2037
|
-
export const runSyncExit = /*#__PURE__*/runSyncExitWith(/*#__PURE__*/
|
|
2194
|
+
export const runSyncExit = /*#__PURE__*/runSyncExitWith(/*#__PURE__*/Context.empty());
|
|
2038
2195
|
/** @internal */
|
|
2039
|
-
export const runSyncWith =
|
|
2040
|
-
const runSyncExit = runSyncExitWith(
|
|
2196
|
+
export const runSyncWith = context => {
|
|
2197
|
+
const runSyncExit = runSyncExitWith(context);
|
|
2041
2198
|
return effect => {
|
|
2042
2199
|
const exit = runSyncExit(effect);
|
|
2043
2200
|
if (exit._tag === "Failure") throw causeSquash(exit.cause);
|
|
@@ -2045,79 +2202,7 @@ export const runSyncWith = services => {
|
|
|
2045
2202
|
};
|
|
2046
2203
|
};
|
|
2047
2204
|
/** @internal */
|
|
2048
|
-
export const runSync = /*#__PURE__*/runSyncWith(/*#__PURE__*/
|
|
2049
|
-
// ----------------------------------------------------------------------------
|
|
2050
|
-
// Semaphore
|
|
2051
|
-
// ----------------------------------------------------------------------------
|
|
2052
|
-
/** @internal */
|
|
2053
|
-
class Semaphore {
|
|
2054
|
-
waiters = /*#__PURE__*/new Set();
|
|
2055
|
-
taken = 0;
|
|
2056
|
-
permits;
|
|
2057
|
-
constructor(permits) {
|
|
2058
|
-
this.permits = permits;
|
|
2059
|
-
}
|
|
2060
|
-
get free() {
|
|
2061
|
-
return this.permits - this.taken;
|
|
2062
|
-
}
|
|
2063
|
-
take = n => callback(resume => {
|
|
2064
|
-
if (this.free < n) {
|
|
2065
|
-
const observer = () => {
|
|
2066
|
-
if (this.free < n) {
|
|
2067
|
-
return;
|
|
2068
|
-
}
|
|
2069
|
-
this.waiters.delete(observer);
|
|
2070
|
-
this.taken += n;
|
|
2071
|
-
resume(succeed(n));
|
|
2072
|
-
};
|
|
2073
|
-
this.waiters.add(observer);
|
|
2074
|
-
return sync(() => {
|
|
2075
|
-
this.waiters.delete(observer);
|
|
2076
|
-
});
|
|
2077
|
-
}
|
|
2078
|
-
this.taken += n;
|
|
2079
|
-
return resume(succeed(n));
|
|
2080
|
-
});
|
|
2081
|
-
updateTakenUnsafe(fiber, f) {
|
|
2082
|
-
this.taken = f(this.taken);
|
|
2083
|
-
if (this.waiters.size > 0) {
|
|
2084
|
-
fiber.currentScheduler.scheduleTask(() => {
|
|
2085
|
-
const iter = this.waiters.values();
|
|
2086
|
-
let item = iter.next();
|
|
2087
|
-
while (item.done === false && this.free > 0) {
|
|
2088
|
-
item.value();
|
|
2089
|
-
item = iter.next();
|
|
2090
|
-
}
|
|
2091
|
-
}, 0);
|
|
2092
|
-
}
|
|
2093
|
-
return succeed(this.free);
|
|
2094
|
-
}
|
|
2095
|
-
updateTaken(f) {
|
|
2096
|
-
return withFiber(fiber => this.updateTakenUnsafe(fiber, f));
|
|
2097
|
-
}
|
|
2098
|
-
resize = permits => asVoid(withFiber(fiber => {
|
|
2099
|
-
this.permits = permits;
|
|
2100
|
-
if (this.free < 0) {
|
|
2101
|
-
return void_;
|
|
2102
|
-
}
|
|
2103
|
-
return this.updateTakenUnsafe(fiber, taken => taken);
|
|
2104
|
-
}));
|
|
2105
|
-
release = n => this.updateTaken(taken => taken - n);
|
|
2106
|
-
releaseAll = /*#__PURE__*/this.updateTaken(_ => 0);
|
|
2107
|
-
withPermits = n => self => uninterruptibleMask(restore => flatMap(restore(this.take(n)), permits => ensuring(restore(self), this.release(permits))));
|
|
2108
|
-
withPermit = /*#__PURE__*/this.withPermits(1);
|
|
2109
|
-
withPermitsIfAvailable = n => self => uninterruptibleMask(restore => suspend(() => {
|
|
2110
|
-
if (this.free < n) {
|
|
2111
|
-
return succeedNone;
|
|
2112
|
-
}
|
|
2113
|
-
this.taken += n;
|
|
2114
|
-
return ensuring(restore(asSome(self)), this.release(n));
|
|
2115
|
-
}));
|
|
2116
|
-
}
|
|
2117
|
-
/** @internal */
|
|
2118
|
-
export const makeSemaphoreUnsafe = permits => new Semaphore(permits);
|
|
2119
|
-
/** @internal */
|
|
2120
|
-
export const makeSemaphore = permits => sync(() => makeSemaphoreUnsafe(permits));
|
|
2205
|
+
export const runSync = /*#__PURE__*/runSyncWith(/*#__PURE__*/Context.empty());
|
|
2121
2206
|
const succeedTrue = /*#__PURE__*/succeed(true);
|
|
2122
2207
|
const succeedFalse = /*#__PURE__*/succeed(false);
|
|
2123
2208
|
class Latch {
|
|
@@ -2132,7 +2217,7 @@ class Latch {
|
|
|
2132
2217
|
return succeedTrue;
|
|
2133
2218
|
}
|
|
2134
2219
|
this.scheduled = true;
|
|
2135
|
-
fiber.
|
|
2220
|
+
fiber.currentDispatcher.scheduleTask(this.flushWaiters, 0);
|
|
2136
2221
|
return succeedTrue;
|
|
2137
2222
|
}
|
|
2138
2223
|
flushWaiters = () => {
|
|
@@ -2173,7 +2258,7 @@ class Latch {
|
|
|
2173
2258
|
return true;
|
|
2174
2259
|
}
|
|
2175
2260
|
close = /*#__PURE__*/sync(() => this.closeUnsafe());
|
|
2176
|
-
whenOpen = self =>
|
|
2261
|
+
whenOpen = self => flatMap(this.await, () => self);
|
|
2177
2262
|
}
|
|
2178
2263
|
/** @internal */
|
|
2179
2264
|
export const makeLatchUnsafe = open => new Latch(open ?? false);
|
|
@@ -2213,20 +2298,19 @@ const NoopSpanProto = {
|
|
|
2213
2298
|
/** @internal */
|
|
2214
2299
|
export const noopSpan = options => Object.assign(Object.create(NoopSpanProto), options);
|
|
2215
2300
|
const filterDisablePropagation = span => {
|
|
2216
|
-
if (span)
|
|
2217
|
-
|
|
2218
|
-
}
|
|
2301
|
+
if (!span) return Option.none();
|
|
2302
|
+
return Context.get(span.annotations, Tracer.DisablePropagation) ? span._tag === "Span" ? filterDisablePropagation(Option.getOrUndefined(span.parent)) : Option.none() : Option.some(span);
|
|
2219
2303
|
};
|
|
2220
2304
|
/** @internal */
|
|
2221
2305
|
export const makeSpanUnsafe = (fiber, name, options) => {
|
|
2222
|
-
const disablePropagation = !fiber.getRef(TracerEnabled) || options?.annotations &&
|
|
2223
|
-
const parent = options?.parent
|
|
2306
|
+
const disablePropagation = !fiber.getRef(TracerEnabled) || options?.annotations && Context.get(options.annotations, Tracer.DisablePropagation);
|
|
2307
|
+
const parent = options?.parent !== undefined ? Option.some(options.parent) : options?.root ? Option.none() : filterDisablePropagation(fiber.currentSpan);
|
|
2224
2308
|
let span;
|
|
2225
2309
|
if (disablePropagation) {
|
|
2226
2310
|
span = noopSpan({
|
|
2227
2311
|
name,
|
|
2228
2312
|
parent,
|
|
2229
|
-
annotations:
|
|
2313
|
+
annotations: Context.add(options?.annotations ?? Context.empty(), Tracer.DisablePropagation, true)
|
|
2230
2314
|
});
|
|
2231
2315
|
} else {
|
|
2232
2316
|
const tracer = fiber.getRef(Tracer.Tracer);
|
|
@@ -2239,12 +2323,12 @@ export const makeSpanUnsafe = (fiber, name, options) => {
|
|
|
2239
2323
|
span = tracer.span({
|
|
2240
2324
|
name,
|
|
2241
2325
|
parent,
|
|
2242
|
-
annotations: options?.annotations ??
|
|
2326
|
+
annotations: options?.annotations ?? Context.empty(),
|
|
2243
2327
|
links,
|
|
2244
|
-
startTime: timingEnabled ? clock.currentTimeNanosUnsafe() :
|
|
2328
|
+
startTime: timingEnabled ? clock.currentTimeNanosUnsafe() : BigInt(0),
|
|
2245
2329
|
kind: options?.kind ?? "internal",
|
|
2246
|
-
root: options?.root ??
|
|
2247
|
-
sampled: options?.sampled ?? (parent
|
|
2330
|
+
root: options?.root ?? Option.isNone(parent),
|
|
2331
|
+
sampled: options?.sampled ?? (Option.isSome(parent) && parent.value.sampled === false ? false : !isLogLevelGreaterThan(fiber.getRef(Tracer.MinimumTraceLevel), level))
|
|
2248
2332
|
});
|
|
2249
2333
|
for (const [key, value] of Object.entries(annotationsFromEnv)) {
|
|
2250
2334
|
span.attribute(key, value);
|
|
@@ -2261,7 +2345,7 @@ export const makeSpanUnsafe = (fiber, name, options) => {
|
|
|
2261
2345
|
export const makeSpan = (name, options) => withFiber(fiber => succeed(makeSpanUnsafe(fiber, name, options)));
|
|
2262
2346
|
/** @internal */
|
|
2263
2347
|
export const makeSpanScoped = (name, options) => uninterruptible(withFiber(fiber => {
|
|
2264
|
-
const scope =
|
|
2348
|
+
const scope = Context.getUnsafe(fiber.context, scopeTag);
|
|
2265
2349
|
const span = makeSpanUnsafe(fiber, name, options ?? {});
|
|
2266
2350
|
const clock = fiber.getRef(ClockRef);
|
|
2267
2351
|
const timingEnabled = fiber.getRef(TracerTimingEnabled);
|
|
@@ -2383,7 +2467,7 @@ export const currentParentSpan = /*#__PURE__*/serviceOptional(Tracer.ParentSpan)
|
|
|
2383
2467
|
// Clock
|
|
2384
2468
|
// ----------------------------------------------------------------------------
|
|
2385
2469
|
/** @internal */
|
|
2386
|
-
export const ClockRef = /*#__PURE__*/
|
|
2470
|
+
export const ClockRef = /*#__PURE__*/Context.Reference("effect/Clock", {
|
|
2387
2471
|
defaultValue: () => new ClockImpl()
|
|
2388
2472
|
});
|
|
2389
2473
|
const MAX_TIMER_MILLIS = 2 ** 31 - 1;
|
|
@@ -2427,7 +2511,7 @@ const processOrPerformanceNow = /*#__PURE__*/function () {
|
|
|
2427
2511
|
/** @internal */
|
|
2428
2512
|
export const clockWith = f => withFiber(fiber => f(fiber.getRef(ClockRef)));
|
|
2429
2513
|
/** @internal */
|
|
2430
|
-
export const sleep = duration => clockWith(clock => clock.sleep(Duration.
|
|
2514
|
+
export const sleep = duration => clockWith(clock => clock.sleep(Duration.fromInputUnsafe(duration)));
|
|
2431
2515
|
/** @internal */
|
|
2432
2516
|
export const currentTimeMillis = /*#__PURE__*/clockWith(clock => clock.currentTimeMillis);
|
|
2433
2517
|
/** @internal */
|
|
@@ -2475,6 +2559,20 @@ export class ExceededCapacityError extends /*#__PURE__*/TaggedError("ExceededCap
|
|
|
2475
2559
|
}
|
|
2476
2560
|
}
|
|
2477
2561
|
/** @internal */
|
|
2562
|
+
export const AsyncFiberErrorTypeId = "~effect/Cause/AsyncFiberError";
|
|
2563
|
+
/** @internal */
|
|
2564
|
+
export const isAsyncFiberError = u => hasProperty(u, AsyncFiberErrorTypeId);
|
|
2565
|
+
/** @internal */
|
|
2566
|
+
export class AsyncFiberError extends /*#__PURE__*/TaggedError("AsyncFiberError") {
|
|
2567
|
+
[AsyncFiberErrorTypeId] = AsyncFiberErrorTypeId;
|
|
2568
|
+
constructor(fiber) {
|
|
2569
|
+
super({
|
|
2570
|
+
message: "An asynchronous Effect was executed with Effect.runSync",
|
|
2571
|
+
fiber
|
|
2572
|
+
});
|
|
2573
|
+
}
|
|
2574
|
+
}
|
|
2575
|
+
/** @internal */
|
|
2478
2576
|
export const UnknownErrorTypeId = "~effect/Cause/UnknownError";
|
|
2479
2577
|
/** @internal */
|
|
2480
2578
|
export const isUnknownError = u => hasProperty(u, UnknownErrorTypeId);
|
|
@@ -2492,7 +2590,7 @@ export class UnknownError extends /*#__PURE__*/TaggedError("UnknownError") {
|
|
|
2492
2590
|
// Console
|
|
2493
2591
|
// ----------------------------------------------------------------------------
|
|
2494
2592
|
/** @internal */
|
|
2495
|
-
export const ConsoleRef = /*#__PURE__*/
|
|
2593
|
+
export const ConsoleRef = /*#__PURE__*/Context.Reference("effect/Console/CurrentConsole", {
|
|
2496
2594
|
defaultValue: () => globalThis.console
|
|
2497
2595
|
});
|
|
2498
2596
|
// ----------------------------------------------------------------------------
|
|
@@ -2527,14 +2625,46 @@ export const isLogLevelGreaterThan = /*#__PURE__*/Order.isGreaterThan(LogLevelOr
|
|
|
2527
2625
|
// Logger
|
|
2528
2626
|
// ----------------------------------------------------------------------------
|
|
2529
2627
|
/** @internal */
|
|
2530
|
-
export const CurrentLoggers = /*#__PURE__*/
|
|
2628
|
+
export const CurrentLoggers = /*#__PURE__*/Context.Reference("effect/Loggers/CurrentLoggers", {
|
|
2531
2629
|
defaultValue: () => new Set([defaultLogger, tracerLogger])
|
|
2532
2630
|
});
|
|
2533
2631
|
/** @internal */
|
|
2534
|
-
export const LogToStderr = /*#__PURE__*/
|
|
2632
|
+
export const LogToStderr = /*#__PURE__*/Context.Reference("effect/Logger/LogToStderr", {
|
|
2535
2633
|
defaultValue: constFalse
|
|
2536
2634
|
});
|
|
2537
2635
|
/** @internal */
|
|
2636
|
+
export const annotateLogsScoped = function () {
|
|
2637
|
+
const entries = typeof arguments[0] === "string" ? [[arguments[0], arguments[1]]] : Object.entries(arguments[0]);
|
|
2638
|
+
return uninterruptible(withFiber(fiber => {
|
|
2639
|
+
const prev = fiber.getRef(CurrentLogAnnotations);
|
|
2640
|
+
const next = {
|
|
2641
|
+
...prev
|
|
2642
|
+
};
|
|
2643
|
+
for (let i = 0; i < entries.length; i++) {
|
|
2644
|
+
const [key, value] = entries[i];
|
|
2645
|
+
next[key] = value;
|
|
2646
|
+
}
|
|
2647
|
+
fiber.setContext(Context.add(fiber.context, CurrentLogAnnotations, next));
|
|
2648
|
+
return scopeAddFinalizerExit(Context.getUnsafe(fiber.context, scopeTag), _ => {
|
|
2649
|
+
const current = fiber.getRef(CurrentLogAnnotations);
|
|
2650
|
+
const next = {
|
|
2651
|
+
...current
|
|
2652
|
+
};
|
|
2653
|
+
for (let i = 0; i < entries.length; i++) {
|
|
2654
|
+
const [key, value] = entries[i];
|
|
2655
|
+
if (current[key] !== value) continue;
|
|
2656
|
+
if (key in prev) {
|
|
2657
|
+
next[key] = prev[key];
|
|
2658
|
+
} else {
|
|
2659
|
+
delete next[key];
|
|
2660
|
+
}
|
|
2661
|
+
}
|
|
2662
|
+
fiber.setContext(Context.add(fiber.context, CurrentLogAnnotations, next));
|
|
2663
|
+
return void_;
|
|
2664
|
+
});
|
|
2665
|
+
}));
|
|
2666
|
+
};
|
|
2667
|
+
/** @internal */
|
|
2538
2668
|
export const LoggerTypeId = "~effect/Logger";
|
|
2539
2669
|
const LoggerProto = {
|
|
2540
2670
|
[LoggerTypeId]: {
|
|
@@ -2684,7 +2814,7 @@ export const consolePretty = options => {
|
|
|
2684
2814
|
};
|
|
2685
2815
|
const prettyLoggerTty = options => {
|
|
2686
2816
|
const processIsBun = typeof process === "object" && "isBun" in process && process.isBun === true;
|
|
2687
|
-
const color = options.colors
|
|
2817
|
+
const color = options.colors ? withColor : withColorNoop;
|
|
2688
2818
|
return loggerMake(({
|
|
2689
2819
|
cause,
|
|
2690
2820
|
date,
|
|
@@ -2693,6 +2823,7 @@ const prettyLoggerTty = options => {
|
|
|
2693
2823
|
message: message_
|
|
2694
2824
|
}) => {
|
|
2695
2825
|
const console = fiber.getRef(ConsoleRef);
|
|
2826
|
+
// oxlint-disable-next-line no-console
|
|
2696
2827
|
const log = fiber.getRef(LogToStderr) ? console.error : console.log;
|
|
2697
2828
|
const message = Array.isArray(message_) ? message_.slice() : [message_];
|
|
2698
2829
|
let firstLine = color(`[${options.formatDate(date)}]`, colors.white) + ` ${color(logLevel.toUpperCase(), ...logLevelColors[logLevel])}` + ` (#${fiber.id})`;
|
|
@@ -2711,6 +2842,7 @@ const prettyLoggerTty = options => {
|
|
|
2711
2842
|
}
|
|
2712
2843
|
}
|
|
2713
2844
|
log(firstLine);
|
|
2845
|
+
// oxlint-disable-next-line no-console
|
|
2714
2846
|
if (!processIsBun) console.group();
|
|
2715
2847
|
if (cause.reasons.length > 0) {
|
|
2716
2848
|
log(causePretty(cause));
|
|
@@ -2724,6 +2856,7 @@ const prettyLoggerTty = options => {
|
|
|
2724
2856
|
for (const [key, value] of Object.entries(annotations)) {
|
|
2725
2857
|
log(color(`${key}:`, colors.bold, colors.white), redact(value));
|
|
2726
2858
|
}
|
|
2859
|
+
// oxlint-disable-next-line no-console
|
|
2727
2860
|
if (!processIsBun) console.groupEnd();
|
|
2728
2861
|
});
|
|
2729
2862
|
};
|
|
@@ -2764,12 +2897,15 @@ const prettyLoggerBrowser = options => {
|
|
|
2764
2897
|
messageIndex++;
|
|
2765
2898
|
}
|
|
2766
2899
|
}
|
|
2900
|
+
// oxlint-disable-next-line no-console
|
|
2767
2901
|
console.groupCollapsed(firstLine, ...firstParams);
|
|
2768
2902
|
if (cause.reasons.length > 0) {
|
|
2903
|
+
// oxlint-disable-next-line no-console
|
|
2769
2904
|
console.error(causePretty(cause));
|
|
2770
2905
|
}
|
|
2771
2906
|
if (messageIndex < message.length) {
|
|
2772
2907
|
for (; messageIndex < message.length; messageIndex++) {
|
|
2908
|
+
// oxlint-disable-next-line no-console
|
|
2773
2909
|
console.log(redact(message[messageIndex]));
|
|
2774
2910
|
}
|
|
2775
2911
|
}
|
|
@@ -2777,11 +2913,14 @@ const prettyLoggerBrowser = options => {
|
|
|
2777
2913
|
for (const [key, value] of Object.entries(annotations)) {
|
|
2778
2914
|
const redacted = redact(value);
|
|
2779
2915
|
if (options.colors) {
|
|
2916
|
+
// oxlint-disable-next-line no-console
|
|
2780
2917
|
console.log(`%c${key}:`, "color:gray", redacted);
|
|
2781
2918
|
} else {
|
|
2919
|
+
// oxlint-disable-next-line no-console
|
|
2782
2920
|
console.log(`${key}:`, redacted);
|
|
2783
2921
|
}
|
|
2784
2922
|
}
|
|
2923
|
+
// oxlint-disable-next-line no-console
|
|
2785
2924
|
console.groupEnd();
|
|
2786
2925
|
});
|
|
2787
2926
|
};
|
|
@@ -2795,7 +2934,7 @@ export const defaultLogger = /*#__PURE__*/loggerMake(({
|
|
|
2795
2934
|
}) => {
|
|
2796
2935
|
const message_ = Array.isArray(message) ? message.slice() : [message];
|
|
2797
2936
|
if (cause.reasons.length > 0) {
|
|
2798
|
-
message_.
|
|
2937
|
+
message_.push(causePretty(cause));
|
|
2799
2938
|
}
|
|
2800
2939
|
const now = date.getTime();
|
|
2801
2940
|
const spans = fiber.getRef(CurrentLogSpans);
|
|
@@ -2808,6 +2947,7 @@ export const defaultLogger = /*#__PURE__*/loggerMake(({
|
|
|
2808
2947
|
message_.push(annotations);
|
|
2809
2948
|
}
|
|
2810
2949
|
const console = fiber.getRef(ConsoleRef);
|
|
2950
|
+
// oxlint-disable-next-line no-console
|
|
2811
2951
|
const log = fiber.getRef(LogToStderr) ? console.error : console.log;
|
|
2812
2952
|
log(`[${defaultDateFormat(date)}] ${logLevel.toUpperCase()} (#${fiber.id})${spanString}:`, ...message_);
|
|
2813
2953
|
});
|
|
@@ -2841,4 +2981,24 @@ export function interruptChildrenPatch() {
|
|
|
2841
2981
|
const undefined_ = /*#__PURE__*/succeed(undefined);
|
|
2842
2982
|
/** @internal */
|
|
2843
2983
|
export { undefined_ as undefined };
|
|
2984
|
+
// ----------------------------------------------------------------------------
|
|
2985
|
+
// ErrorReporter
|
|
2986
|
+
// ----------------------------------------------------------------------------
|
|
2987
|
+
/** @internal */
|
|
2988
|
+
export const withErrorReporting = /*#__PURE__*/dual(args => isEffect(args[0]), (self, options) => onError(self, cause => withFiber(fiber => {
|
|
2989
|
+
reportCauseUnsafe(fiber, cause, options?.defectsOnly);
|
|
2990
|
+
return void_;
|
|
2991
|
+
})));
|
|
2992
|
+
/** @internal */
|
|
2993
|
+
export const reportCauseUnsafe = (fiber, cause, defectsOnly) => {
|
|
2994
|
+
const reporters = fiber.getRef(CurrentErrorReporters);
|
|
2995
|
+
if (reporters.size === 0) return;
|
|
2996
|
+
if (defectsOnly && !hasDies(cause)) return;
|
|
2997
|
+
const opts = {
|
|
2998
|
+
cause,
|
|
2999
|
+
fiber,
|
|
3000
|
+
timestamp: fiber.getRef(ClockRef).currentTimeNanosUnsafe()
|
|
3001
|
+
};
|
|
3002
|
+
reporters.forEach(reporter => reporter.report(opts));
|
|
3003
|
+
};
|
|
2844
3004
|
//# sourceMappingURL=effect.js.map
|