effect 4.0.0-beta.6 → 4.0.0-beta.62
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Array.d.ts +213 -385
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +149 -102
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +82 -45
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +105 -52
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts +39 -32
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +36 -33
- package/dist/BigInt.js.map +1 -1
- package/dist/Brand.d.ts +3 -5
- package/dist/Brand.d.ts.map +1 -1
- package/dist/Brand.js +1 -1
- package/dist/Brand.js.map +1 -1
- package/dist/Cache.d.ts +14 -45
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +21 -47
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +53 -22
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Cause.js +108 -10
- package/dist/Cause.js.map +1 -1
- package/dist/Channel.d.ts +166 -48
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +176 -87
- package/dist/Channel.js.map +1 -1
- package/dist/Chunk.d.ts +112 -304
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +56 -88
- package/dist/Chunk.js.map +1 -1
- package/dist/Clock.d.ts +2 -2
- package/dist/Clock.d.ts.map +1 -1
- package/dist/Clock.js.map +1 -1
- package/dist/Combiner.d.ts +280 -13
- package/dist/Combiner.d.ts.map +1 -1
- package/dist/Combiner.js +198 -7
- package/dist/Combiner.js.map +1 -1
- package/dist/Config.d.ts +189 -29
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +85 -35
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +6 -6
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +5 -5
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Console.d.ts +2 -2
- package/dist/Console.d.ts.map +1 -1
- package/dist/Console.js.map +1 -1
- package/dist/Context.d.ts +1150 -0
- package/dist/Context.d.ts.map +1 -0
- package/dist/{ServiceMap.js → Context.js} +181 -165
- package/dist/Context.js.map +1 -0
- package/dist/Cron.d.ts +11 -7
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +120 -63
- package/dist/Cron.js.map +1 -1
- package/dist/Data.d.ts +533 -365
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js +125 -73
- package/dist/Data.js.map +1 -1
- package/dist/DateTime.d.ts +74 -255
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +17 -62
- package/dist/DateTime.js.map +1 -1
- package/dist/Deferred.d.ts +12 -5
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +13 -5
- package/dist/Deferred.js.map +1 -1
- package/dist/Duration.d.ts +74 -40
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +126 -87
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +1435 -927
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +516 -328
- package/dist/Effect.js.map +1 -1
- package/dist/Effectable.d.ts +29 -0
- package/dist/Effectable.d.ts.map +1 -0
- package/dist/Effectable.js +31 -0
- package/dist/Effectable.js.map +1 -0
- package/dist/Encoding.d.ts +1 -1
- package/dist/Equal.d.ts +276 -109
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +140 -48
- package/dist/Equal.js.map +1 -1
- package/dist/Equivalence.d.ts +60 -3
- package/dist/Equivalence.d.ts.map +1 -1
- package/dist/Equivalence.js +70 -13
- package/dist/Equivalence.js.map +1 -1
- package/dist/ErrorReporter.d.ts +374 -0
- package/dist/ErrorReporter.d.ts.map +1 -0
- package/dist/ErrorReporter.js +245 -0
- package/dist/ErrorReporter.js.map +1 -0
- package/dist/ExecutionPlan.d.ts +6 -6
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/ExecutionPlan.js +4 -4
- package/dist/ExecutionPlan.js.map +1 -1
- package/dist/Exit.d.ts +24 -12
- package/dist/Exit.d.ts.map +1 -1
- package/dist/Exit.js +8 -4
- package/dist/Exit.js.map +1 -1
- package/dist/Fiber.d.ts +10 -8
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +11 -10
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +12 -11
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +22 -21
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +10 -10
- package/dist/FiberMap.js.map +1 -1
- package/dist/FiberSet.d.ts +2 -2
- package/dist/FiberSet.d.ts.map +1 -1
- package/dist/FiberSet.js +4 -4
- package/dist/FiberSet.js.map +1 -1
- package/dist/FileSystem.d.ts +20 -19
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +15 -11
- package/dist/FileSystem.js.map +1 -1
- package/dist/Filter.d.ts +4 -37
- package/dist/Filter.d.ts.map +1 -1
- package/dist/Filter.js +0 -13
- package/dist/Filter.js.map +1 -1
- package/dist/Formatter.d.ts +131 -47
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +243 -55
- package/dist/Formatter.js.map +1 -1
- package/dist/Function.d.ts +1 -9
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +2 -10
- package/dist/Function.js.map +1 -1
- package/dist/Graph.d.ts +65 -65
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +58 -60
- package/dist/Graph.js.map +1 -1
- package/dist/Hash.js +1 -1
- package/dist/Hash.js.map +1 -1
- package/dist/HashMap.d.ts +26 -19
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashMap.js +7 -5
- package/dist/HashMap.js.map +1 -1
- package/dist/Inspectable.d.ts +0 -4
- package/dist/Inspectable.d.ts.map +1 -1
- package/dist/Inspectable.js +4 -13
- package/dist/Inspectable.js.map +1 -1
- package/dist/Iterable.d.ts +50 -50
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +106 -34
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonSchema.d.ts +299 -10
- package/dist/JsonSchema.d.ts.map +1 -1
- package/dist/JsonSchema.js +323 -4
- package/dist/JsonSchema.js.map +1 -1
- package/dist/Latch.d.ts +69 -3
- package/dist/Latch.d.ts.map +1 -1
- package/dist/Latch.js +58 -0
- package/dist/Latch.js.map +1 -1
- package/dist/Layer.d.ts +599 -379
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +249 -180
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +27 -26
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +21 -18
- package/dist/LayerMap.js.map +1 -1
- package/dist/LogLevel.d.ts +32 -0
- package/dist/LogLevel.d.ts.map +1 -1
- package/dist/LogLevel.js +28 -100
- package/dist/LogLevel.js.map +1 -1
- package/dist/Logger.d.ts +31 -97
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +2 -3
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +8 -8
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/ManagedRuntime.js +34 -25
- package/dist/ManagedRuntime.js.map +1 -1
- package/dist/Metric.d.ts +23 -25
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +24 -26
- package/dist/Metric.js.map +1 -1
- package/dist/MutableHashMap.d.ts +7 -0
- package/dist/MutableHashMap.d.ts.map +1 -1
- package/dist/MutableHashMap.js +8 -0
- package/dist/MutableHashMap.js.map +1 -1
- package/dist/MutableHashSet.d.ts +7 -0
- package/dist/MutableHashSet.d.ts.map +1 -1
- package/dist/MutableHashSet.js +8 -0
- package/dist/MutableHashSet.js.map +1 -1
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +3 -0
- package/dist/MutableList.js.map +1 -1
- package/dist/Newtype.d.ts +291 -0
- package/dist/Newtype.d.ts.map +1 -0
- package/dist/Newtype.js +161 -0
- package/dist/Newtype.js.map +1 -0
- package/dist/Number.d.ts +74 -18
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +46 -18
- package/dist/Number.js.map +1 -1
- package/dist/Optic.d.ts +947 -18
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +454 -5
- package/dist/Optic.js.map +1 -1
- package/dist/Option.d.ts +25 -16
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +15 -9
- package/dist/Option.js.map +1 -1
- package/dist/Order.d.ts +6 -1
- package/dist/Order.d.ts.map +1 -1
- package/dist/Order.js +19 -14
- package/dist/Order.js.map +1 -1
- package/dist/PartitionedSemaphore.d.ts +183 -0
- package/dist/PartitionedSemaphore.d.ts.map +1 -0
- package/dist/PartitionedSemaphore.js +231 -0
- package/dist/PartitionedSemaphore.js.map +1 -0
- package/dist/Path.d.ts +2 -2
- package/dist/Path.d.ts.map +1 -1
- package/dist/Path.js +2 -2
- package/dist/Path.js.map +1 -1
- package/dist/PlatformError.d.ts +2 -2
- package/dist/Pool.d.ts +1 -1
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +5 -5
- package/dist/Pool.js.map +1 -1
- package/dist/Predicate.d.ts +1 -1
- package/dist/Predicate.d.ts.map +1 -1
- package/dist/PubSub.d.ts +5 -4
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +15 -8
- package/dist/PubSub.js.map +1 -1
- package/dist/Pull.d.ts.map +1 -1
- package/dist/Pull.js +1 -1
- package/dist/Pull.js.map +1 -1
- package/dist/Queue.d.ts +9 -6
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +7 -5
- package/dist/Queue.js.map +1 -1
- package/dist/Random.d.ts +36 -2
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +46 -35
- package/dist/Random.js.map +1 -1
- package/dist/RcMap.d.ts +4 -4
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +13 -13
- package/dist/RcMap.js.map +1 -1
- package/dist/RcRef.d.ts +1 -1
- package/dist/RcRef.d.ts.map +1 -1
- package/dist/Record.d.ts +63 -160
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +37 -56
- package/dist/Record.js.map +1 -1
- package/dist/Redactable.d.ts +139 -62
- package/dist/Redactable.d.ts.map +1 -1
- package/dist/Redactable.js +59 -55
- package/dist/Redactable.js.map +1 -1
- package/dist/Reducer.d.ts +166 -7
- package/dist/Reducer.d.ts.map +1 -1
- package/dist/Reducer.js +135 -1
- package/dist/Reducer.js.map +1 -1
- package/dist/References.d.ts +257 -229
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +240 -259
- package/dist/References.js.map +1 -1
- package/dist/Request.d.ts +5 -5
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js.map +1 -1
- package/dist/RequestResolver.d.ts +25 -25
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +15 -16
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Resource.d.ts +0 -3
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +5 -4
- package/dist/Resource.js.map +1 -1
- package/dist/Result.d.ts +1 -1
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +1 -2
- package/dist/Result.js.map +1 -1
- package/dist/Runtime.d.ts +66 -0
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +79 -6
- package/dist/Runtime.js.map +1 -1
- package/dist/Schedule.d.ts +174 -291
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +132 -120
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts +36 -125
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +37 -126
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +3213 -392
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +2058 -252
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +13 -2
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +340 -257
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +55 -13
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +73 -11
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js +29 -11
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.d.ts +44 -54
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +69 -4
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +2 -2
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +63 -39
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +245 -3
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +297 -33
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/Scope.d.ts +2 -2
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.d.ts +2 -2
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedCache.js +5 -5
- package/dist/ScopedCache.js.map +1 -1
- package/dist/Semaphore.d.ts +148 -52
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js +135 -117
- package/dist/Semaphore.js.map +1 -1
- package/dist/Sink.d.ts +22 -19
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +54 -7
- package/dist/Sink.js.map +1 -1
- package/dist/Stdio.d.ts +18 -6
- package/dist/Stdio.d.ts.map +1 -1
- package/dist/Stdio.js +20 -2
- package/dist/Stdio.js.map +1 -1
- package/dist/Stream.d.ts +465 -542
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +329 -145
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +114 -47
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +29 -47
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts +7 -7
- package/dist/Struct.d.ts.map +1 -1
- package/dist/SubscriptionRef.d.ts +1 -2
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +83 -116
- package/dist/SubscriptionRef.js.map +1 -1
- package/dist/Terminal.d.ts +5 -4
- package/dist/Terminal.d.ts.map +1 -1
- package/dist/Terminal.js +2 -2
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +21 -20
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +13 -9
- package/dist/Tracer.js.map +1 -1
- package/dist/Trie.d.ts +44 -31
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js +13 -9
- package/dist/Trie.js.map +1 -1
- package/dist/TxChunk.d.ts +4 -4
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxChunk.js +4 -4
- package/dist/TxChunk.js.map +1 -1
- package/dist/TxDeferred.d.ts +328 -0
- package/dist/TxDeferred.d.ts.map +1 -0
- package/dist/TxDeferred.js +197 -0
- package/dist/TxDeferred.js.map +1 -0
- package/dist/TxHashMap.d.ts +105 -86
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +51 -44
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxHashSet.d.ts +2 -2
- package/dist/TxHashSet.d.ts.map +1 -1
- package/dist/TxHashSet.js +16 -15
- package/dist/TxHashSet.js.map +1 -1
- package/dist/TxPriorityQueue.d.ts +609 -0
- package/dist/TxPriorityQueue.d.ts.map +1 -0
- package/dist/TxPriorityQueue.js +416 -0
- package/dist/TxPriorityQueue.js.map +1 -0
- package/dist/TxPubSub.d.ts +585 -0
- package/dist/TxPubSub.d.ts.map +1 -0
- package/dist/TxPubSub.js +521 -0
- package/dist/TxPubSub.js.map +1 -0
- package/dist/TxQueue.d.ts +1 -1
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxQueue.js +42 -57
- package/dist/TxQueue.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +500 -0
- package/dist/TxReentrantLock.d.ts.map +1 -0
- package/dist/TxReentrantLock.js +481 -0
- package/dist/TxReentrantLock.js.map +1 -0
- package/dist/TxRef.d.ts +14 -20
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +8 -10
- package/dist/TxRef.js.map +1 -1
- package/dist/TxSemaphore.d.ts +162 -2
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +25 -10
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/TxSubscriptionRef.d.ts +508 -0
- package/dist/TxSubscriptionRef.d.ts.map +1 -0
- package/dist/TxSubscriptionRef.js +293 -0
- package/dist/TxSubscriptionRef.js.map +1 -0
- package/dist/Types.d.ts +80 -22
- package/dist/Types.d.ts.map +1 -1
- package/dist/Unify.d.ts +8 -2
- package/dist/Unify.d.ts.map +1 -1
- package/dist/Unify.js.map +1 -1
- package/dist/Utils.d.ts +137 -65
- package/dist/Utils.d.ts.map +1 -1
- package/dist/Utils.js +38 -66
- package/dist/Utils.js.map +1 -1
- package/dist/index.d.ts +886 -71
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +886 -71
- package/dist/index.js.map +1 -1
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/dateTime.js +77 -71
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/effect.js +502 -326
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/hashMap.js +7 -5
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/layer.js +3 -3
- package/dist/internal/layer.js.map +1 -1
- package/dist/internal/option.js +6 -0
- package/dist/internal/option.js.map +1 -1
- package/dist/internal/random.d.ts +2 -0
- package/dist/internal/random.d.ts.map +1 -0
- package/dist/internal/random.js +13 -0
- package/dist/internal/random.js.map +1 -0
- package/dist/internal/rcRef.js +9 -9
- package/dist/internal/rcRef.js.map +1 -1
- package/dist/internal/references.d.ts +2 -0
- package/dist/internal/references.d.ts.map +1 -0
- package/dist/internal/references.js +51 -0
- package/dist/internal/references.js.map +1 -0
- package/dist/internal/request.js +6 -6
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/schedule.js +1 -1
- package/dist/internal/schedule.js.map +1 -1
- package/dist/internal/schema/annotations.js +2 -0
- package/dist/internal/schema/annotations.js.map +1 -1
- package/dist/internal/schema/representation.js +87 -109
- package/dist/internal/schema/representation.js.map +1 -1
- package/dist/internal/schema/schema.d.ts +10 -1
- package/dist/internal/schema/schema.d.ts.map +1 -1
- package/dist/internal/schema/schema.js +59 -1
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/internal/trie.js +8 -7
- package/dist/internal/trie.js.map +1 -1
- package/dist/testing/TestClock.d.ts +5 -5
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestClock.js +2 -2
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +267 -33
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/testing/TestSchema.js +296 -23
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/testing/index.d.ts +64 -1
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +64 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +127 -45
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +29 -23
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +9 -2
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +39 -11
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +40 -47
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.d.ts +130 -0
- package/dist/unstable/ai/EmbeddingModel.d.ts.map +1 -0
- package/dist/unstable/ai/EmbeddingModel.js +127 -0
- package/dist/unstable/ai/EmbeddingModel.js.map +1 -0
- package/dist/unstable/ai/IdGenerator.d.ts +2 -2
- package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
- package/dist/unstable/ai/IdGenerator.js +2 -2
- package/dist/unstable/ai/IdGenerator.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +119 -49
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +260 -61
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +207 -112
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +71 -19
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +68 -15
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +225 -73
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Model.d.ts +27 -9
- package/dist/unstable/ai/Model.d.ts.map +1 -1
- package/dist/unstable/ai/Model.js +25 -9
- package/dist/unstable/ai/Model.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +9 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Prompt.d.ts +17 -17
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Prompt.js +6 -9
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +24 -24
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js +7 -8
- package/dist/unstable/ai/Response.js.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.d.ts +38 -0
- package/dist/unstable/ai/ResponseIdTracker.d.ts.map +1 -0
- package/dist/unstable/ai/ResponseIdTracker.js +68 -0
- package/dist/unstable/ai/ResponseIdTracker.js.map +1 -0
- package/dist/unstable/ai/Telemetry.d.ts +35 -2
- package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
- package/dist/unstable/ai/Telemetry.js +2 -2
- package/dist/unstable/ai/Telemetry.js.map +1 -1
- package/dist/unstable/ai/Tokenizer.d.ts +2 -2
- package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
- package/dist/unstable/ai/Tokenizer.js +2 -2
- package/dist/unstable/ai/Tokenizer.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +46 -16
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +68 -22
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +4 -4
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +14 -21
- package/dist/unstable/ai/Toolkit.js.map +1 -1
- package/dist/unstable/ai/index.d.ts +22 -1
- package/dist/unstable/ai/index.d.ts.map +1 -1
- package/dist/unstable/ai/index.js +22 -1
- package/dist/unstable/ai/index.js.map +1 -1
- package/dist/unstable/ai/internal/codec-transformer.js +5 -7
- package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
- package/dist/unstable/cli/Argument.d.ts +4 -7
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js +1 -3
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +51 -63
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +32 -57
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/CliOutput.d.ts +5 -4
- package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
- package/dist/unstable/cli/CliOutput.js +67 -12
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +372 -59
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +328 -66
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Completions.d.ts +97 -0
- package/dist/unstable/cli/Completions.d.ts.map +1 -0
- package/dist/unstable/cli/Completions.js +25 -0
- package/dist/unstable/cli/Completions.js.map +1 -0
- package/dist/unstable/cli/Flag.d.ts +4 -5
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +1 -1
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +125 -0
- package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -0
- package/dist/unstable/cli/GlobalFlag.js +118 -0
- package/dist/unstable/cli/GlobalFlag.js.map +1 -0
- package/dist/unstable/cli/HelpDoc.d.ts +81 -11
- package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
- package/dist/unstable/cli/Param.d.ts +34 -6
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +24 -14
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +2 -2
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js +1 -1
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/Prompt.js +266 -86
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/index.d.ts +10 -0
- package/dist/unstable/cli/index.d.ts.map +1 -1
- package/dist/unstable/cli/index.js +10 -0
- package/dist/unstable/cli/index.js.map +1 -1
- package/dist/unstable/cli/internal/command.d.ts +41 -15
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +84 -47
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/completions/bash.js.map +1 -1
- package/dist/unstable/cli/internal/completions/descriptor.d.ts +2 -0
- package/dist/unstable/cli/internal/completions/descriptor.d.ts.map +1 -0
- package/dist/unstable/cli/internal/completions/{CommandDescriptor.js → descriptor.js} +17 -5
- package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -0
- package/dist/unstable/cli/internal/completions/fish.js.map +1 -1
- package/dist/unstable/cli/internal/completions/zsh.js.map +1 -1
- package/dist/unstable/cli/internal/config.js +42 -0
- package/dist/unstable/cli/internal/config.js.map +1 -1
- package/dist/unstable/cli/internal/help.d.ts +33 -0
- package/dist/unstable/cli/internal/help.d.ts.map +1 -0
- package/dist/unstable/cli/internal/help.js +125 -0
- package/dist/unstable/cli/internal/help.js.map +1 -0
- package/dist/unstable/cli/internal/parser.js +155 -58
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cluster/ClusterCron.d.ts +1 -1
- package/dist/unstable/cluster/ClusterCron.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterCron.js +1 -1
- package/dist/unstable/cluster/ClusterCron.js.map +1 -1
- package/dist/unstable/cluster/ClusterError.d.ts +7 -7
- package/dist/unstable/cluster/ClusterSchema.d.ts +28 -7
- package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.js +28 -8
- package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +4 -2
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +96 -63
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/DeliverAt.js +1 -1
- package/dist/unstable/cluster/DeliverAt.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +17 -16
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +31 -25
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/EntityAddress.d.ts +2 -2
- package/dist/unstable/cluster/EntityAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityAddress.js +1 -1
- package/dist/unstable/cluster/EntityAddress.js.map +1 -1
- package/dist/unstable/cluster/EntityProxy.js +3 -3
- package/dist/unstable/cluster/EntityProxy.js.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.js +6 -6
- package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
- package/dist/unstable/cluster/EntityResource.d.ts +4 -4
- package/dist/unstable/cluster/EntityResource.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityResource.js +2 -2
- package/dist/unstable/cluster/EntityResource.js.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts +3 -3
- package/dist/unstable/cluster/HttpRunner.js +2 -2
- package/dist/unstable/cluster/HttpRunner.js.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.d.ts +5 -5
- package/dist/unstable/cluster/K8sHttpClient.d.ts.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.js +7 -7
- package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +16 -10
- package/dist/unstable/cluster/Message.d.ts.map +1 -1
- package/dist/unstable/cluster/Message.js +16 -8
- package/dist/unstable/cluster/Message.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +46 -23
- package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/MessageStorage.js +40 -25
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts +7 -6
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +8 -7
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/Runner.d.ts +1 -1
- package/dist/unstable/cluster/Runner.d.ts.map +1 -1
- package/dist/unstable/cluster/Runner.js +1 -1
- package/dist/unstable/cluster/Runner.js.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.d.ts +1 -1
- package/dist/unstable/cluster/RunnerAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.js +1 -1
- package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.d.ts +2 -2
- package/dist/unstable/cluster/RunnerHealth.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.js +2 -2
- package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +10 -9
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.d.ts +12 -12
- package/dist/unstable/cluster/RunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.js +3 -3
- package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +5 -4
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +16 -14
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/ShardId.d.ts +35 -49
- package/dist/unstable/cluster/ShardId.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardId.js +65 -67
- package/dist/unstable/cluster/ShardId.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts +4 -4
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +59 -49
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +28 -27
- package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.js +27 -27
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/SingletonAddress.d.ts +2 -2
- package/dist/unstable/cluster/Snowflake.d.ts +2 -2
- package/dist/unstable/cluster/Snowflake.d.ts.map +1 -1
- package/dist/unstable/cluster/Snowflake.js +2 -2
- package/dist/unstable/cluster/Snowflake.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +24 -20
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js +7 -7
- package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +30 -24
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/cluster/internal/entityReaper.js +2 -2
- package/dist/unstable/cluster/internal/entityReaper.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceMap.js +3 -3
- package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.d.ts +2 -2
- package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.js +9 -8
- package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.d.ts +4 -4
- package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js +9 -2
- package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
- package/dist/unstable/encoding/Msgpack.d.ts +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts +9 -9
- package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
- package/dist/unstable/encoding/Ndjson.js.map +1 -1
- package/dist/unstable/encoding/Sse.d.ts +3 -3
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.js +1 -1
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/eventlog/Event.d.ts +0 -6
- package/dist/unstable/eventlog/Event.d.ts.map +1 -1
- package/dist/unstable/eventlog/Event.js +0 -5
- package/dist/unstable/eventlog/Event.js.map +1 -1
- package/dist/unstable/eventlog/EventGroup.d.ts +0 -2
- package/dist/unstable/eventlog/EventGroup.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventGroup.js +0 -2
- package/dist/unstable/eventlog/EventGroup.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +27 -10
- package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventJournal.js +130 -71
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts +94 -37
- package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLog.js +225 -151
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.d.ts +11 -9
- package/dist/unstable/eventlog/EventLogEncryption.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js +15 -17
- package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +228 -0
- package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -0
- package/dist/unstable/eventlog/EventLogMessage.js +214 -0
- package/dist/unstable/eventlog/EventLogMessage.js.map +1 -0
- package/dist/unstable/eventlog/EventLogRemote.d.ts +112 -194
- package/dist/unstable/eventlog/EventLogRemote.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.js +168 -322
- package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.d.ts +26 -48
- package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.js +128 -199
- package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +60 -0
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -0
- package/dist/unstable/eventlog/EventLogServerEncrypted.js +166 -0
- package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -0
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +183 -0
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -0
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js +461 -0
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -0
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +117 -0
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts.map +1 -0
- package/dist/unstable/eventlog/EventLogSessionAuth.js +284 -0
- package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -0
- package/dist/unstable/eventlog/{SqlEventLogJournal.d.ts → SqlEventJournal.d.ts} +2 -2
- package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -0
- package/dist/unstable/eventlog/{SqlEventLogJournal.js → SqlEventJournal.js} +28 -21
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -0
- package/dist/unstable/eventlog/{SqlEventLogServer.d.ts → SqlEventLogServerEncrypted.d.ts} +5 -5
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts.map +1 -0
- package/dist/unstable/eventlog/{SqlEventLogServer.js → SqlEventLogServerEncrypted.js} +69 -27
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -0
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts +25 -0
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -0
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +355 -0
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -0
- package/dist/unstable/eventlog/index.d.ts +22 -2
- package/dist/unstable/eventlog/index.d.ts.map +1 -1
- package/dist/unstable/eventlog/index.js +22 -2
- package/dist/unstable/eventlog/index.js.map +1 -1
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.d.ts +2 -0
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.d.ts.map +1 -0
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js +89 -0
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js.map +1 -0
- package/dist/unstable/http/Cookies.d.ts +51 -6
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +27 -6
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Etag.d.ts +2 -2
- package/dist/unstable/http/Etag.d.ts.map +1 -1
- package/dist/unstable/http/Etag.js +7 -3
- package/dist/unstable/http/Etag.js.map +1 -1
- package/dist/unstable/http/FetchHttpClient.d.ts +6 -3
- package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/unstable/http/FetchHttpClient.js +5 -5
- package/dist/unstable/http/FetchHttpClient.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts +24 -4
- package/dist/unstable/http/Headers.d.ts.map +1 -1
- package/dist/unstable/http/Headers.js +42 -13
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpBody.d.ts +1 -1
- package/dist/unstable/http/HttpClient.d.ts +125 -21
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +197 -19
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientError.d.ts +8 -8
- package/dist/unstable/http/HttpClientRequest.d.ts +43 -15
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +131 -21
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts +2 -1
- package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientResponse.js +18 -3
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts +13 -11
- package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
- package/dist/unstable/http/HttpEffect.js +51 -51
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.d.ts +5 -4
- package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js +6 -10
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMethod.d.ts +4 -4
- package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
- package/dist/unstable/http/HttpMethod.js +3 -3
- package/dist/unstable/http/HttpMethod.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts +4 -9
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +47 -43
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpPlatform.d.ts +2 -2
- package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
- package/dist/unstable/http/HttpPlatform.js +5 -4
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +9 -8
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +36 -36
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServer.d.ts +2 -2
- package/dist/unstable/http/HttpServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpServer.js +4 -4
- package/dist/unstable/http/HttpServer.js.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +22 -34
- package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerError.js +39 -45
- package/dist/unstable/http/HttpServerError.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +19 -7
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +307 -13
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.d.ts +2 -2
- package/dist/unstable/http/HttpServerRespondable.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.js +5 -5
- package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +52 -5
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +240 -5
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpStaticServer.d.ts +69 -0
- package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -0
- package/dist/unstable/http/HttpStaticServer.js +353 -0
- package/dist/unstable/http/HttpStaticServer.js.map +1 -0
- package/dist/unstable/http/HttpTraceContext.d.ts +3 -2
- package/dist/unstable/http/HttpTraceContext.d.ts.map +1 -1
- package/dist/unstable/http/HttpTraceContext.js +27 -15
- package/dist/unstable/http/HttpTraceContext.js.map +1 -1
- package/dist/unstable/http/Multipart.d.ts +7 -7
- package/dist/unstable/http/Multipart.d.ts.map +1 -1
- package/dist/unstable/http/Multipart.js +7 -7
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/Url.d.ts +604 -0
- package/dist/unstable/http/Url.d.ts.map +1 -0
- package/dist/unstable/http/Url.js +256 -0
- package/dist/unstable/http/Url.js.map +1 -0
- package/dist/unstable/http/UrlParams.d.ts +18 -9
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +6 -7
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/http/index.d.ts +8 -0
- package/dist/unstable/http/index.d.ts.map +1 -1
- package/dist/unstable/http/index.js +8 -0
- package/dist/unstable/http/index.js.map +1 -1
- package/dist/unstable/http/internal/preResponseHandler.d.ts +2 -0
- package/dist/unstable/http/internal/preResponseHandler.d.ts.map +1 -0
- package/dist/unstable/http/internal/preResponseHandler.js +10 -0
- package/dist/unstable/http/internal/preResponseHandler.js.map +1 -0
- package/dist/unstable/httpapi/HttpApi.d.ts +11 -11
- package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js +8 -8
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +12 -9
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +73 -48
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +82 -7
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +79 -11
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +210 -105
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.js +52 -47
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +66 -29
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.js +138 -32
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.d.ts +9 -8
- package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.js +4 -4
- package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +49 -17
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js +38 -8
- package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +88 -9
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.js +86 -11
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts +9 -6
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.js +6 -6
- package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts +17 -25
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +59 -60
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/observability/Otlp.d.ts +12 -12
- package/dist/unstable/observability/Otlp.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts +2 -2
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +8 -8
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.d.ts +4 -4
- package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js +7 -4
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts +4 -4
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.js +2 -2
- package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.d.ts +2 -2
- package/dist/unstable/observability/OtlpSerialization.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.js +2 -2
- package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.d.ts +4 -4
- package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js +7 -3
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.d.ts +3 -3
- package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.js +4 -33
- package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
- package/dist/unstable/observability/internal/protobuf.js +4 -4
- package/dist/unstable/observability/internal/protobuf.js.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +24 -3
- package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.js +144 -2
- package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
- package/dist/unstable/persistence/Persistable.d.ts +2 -2
- package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistable.js +1 -1
- package/dist/unstable/persistence/Persistable.js.map +1 -1
- package/dist/unstable/persistence/PersistedCache.d.ts +1 -2
- package/dist/unstable/persistence/PersistedCache.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedCache.js +10 -11
- package/dist/unstable/persistence/PersistedCache.js.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts +16 -16
- package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.js +9 -9
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/Persistence.d.ts +5 -5
- package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistence.js +5 -5
- package/dist/unstable/persistence/Persistence.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +9 -9
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +4 -4
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/persistence/Redis.d.ts +3 -3
- package/dist/unstable/persistence/Redis.d.ts.map +1 -1
- package/dist/unstable/persistence/Redis.js +2 -2
- package/dist/unstable/persistence/Redis.js.map +1 -1
- package/dist/unstable/process/ChildProcess.d.ts +5 -128
- package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcess.js +1 -65
- package/dist/unstable/process/ChildProcess.js.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.d.ts +83 -8
- package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js +22 -2
- package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.d.ts +37 -17
- package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.js +9 -0
- package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +108 -47
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +105 -25
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +25 -20
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.js +58 -26
- package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.d.ts +8 -2
- package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +57 -14
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts +12 -12
- package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.js +59 -31
- package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
- package/dist/unstable/reactivity/Reactivity.d.ts +2 -2
- package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
- package/dist/unstable/reactivity/Reactivity.js +6 -6
- package/dist/unstable/reactivity/Reactivity.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +137 -19
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js +99 -7
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts +26 -47
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +117 -75
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcClientError.d.ts +2 -2
- package/dist/unstable/rpc/RpcGroup.d.ts +15 -11
- package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcGroup.js +30 -20
- package/dist/unstable/rpc/RpcGroup.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts +12 -12
- package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js +5 -5
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts +14 -1
- package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSchema.js +17 -2
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts +13 -2
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +60 -27
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +8 -12
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +73 -43
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/rpc/RpcWorker.d.ts +2 -2
- package/dist/unstable/rpc/RpcWorker.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcWorker.js +4 -4
- package/dist/unstable/rpc/RpcWorker.js.map +1 -1
- package/dist/unstable/rpc/Utils.d.ts +6 -3
- package/dist/unstable/rpc/Utils.d.ts.map +1 -1
- package/dist/unstable/rpc/Utils.js +46 -5
- package/dist/unstable/rpc/Utils.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts +24 -3
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js +17 -4
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +7 -7
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.js +7 -18
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +35 -15
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +34 -27
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/socket/SocketServer.d.ts +8 -5
- package/dist/unstable/socket/SocketServer.d.ts.map +1 -1
- package/dist/unstable/socket/SocketServer.js +2 -2
- package/dist/unstable/socket/SocketServer.js.map +1 -1
- package/dist/unstable/sql/Migrator.d.ts +1 -1
- package/dist/unstable/sql/Migrator.d.ts.map +1 -1
- package/dist/unstable/sql/Migrator.js +2 -2
- package/dist/unstable/sql/Migrator.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts +24 -6
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +37 -32
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/sql/SqlConnection.d.ts +2 -2
- package/dist/unstable/sql/SqlConnection.d.ts.map +1 -1
- package/dist/unstable/sql/SqlConnection.js +5 -2
- package/dist/unstable/sql/SqlConnection.js.map +1 -1
- package/dist/unstable/sql/SqlError.d.ts +237 -17
- package/dist/unstable/sql/SqlError.d.ts.map +1 -1
- package/dist/unstable/sql/SqlError.js +260 -4
- package/dist/unstable/sql/SqlError.js.map +1 -1
- package/dist/unstable/sql/SqlModel.d.ts +8 -9
- package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
- package/dist/unstable/sql/SqlModel.js +12 -38
- package/dist/unstable/sql/SqlModel.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.js +24 -17
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/sql/SqlSchema.d.ts +17 -6
- package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
- package/dist/unstable/sql/SqlSchema.js +17 -7
- package/dist/unstable/sql/SqlSchema.js.map +1 -1
- package/dist/unstable/sql/Statement.d.ts +3 -5
- package/dist/unstable/sql/Statement.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.js +14 -13
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/workers/Transferable.d.ts +4 -4
- package/dist/unstable/workers/Transferable.d.ts.map +1 -1
- package/dist/unstable/workers/Transferable.js +7 -7
- package/dist/unstable/workers/Transferable.js.map +1 -1
- package/dist/unstable/workers/Worker.d.ts +3 -3
- package/dist/unstable/workers/Worker.d.ts.map +1 -1
- package/dist/unstable/workers/Worker.js +6 -3
- package/dist/unstable/workers/Worker.js.map +1 -1
- package/dist/unstable/workers/WorkerError.d.ts +5 -5
- package/dist/unstable/workers/WorkerRunner.d.ts +2 -2
- package/dist/unstable/workers/WorkerRunner.d.ts.map +1 -1
- package/dist/unstable/workers/WorkerRunner.js +5 -2
- package/dist/unstable/workers/WorkerRunner.js.map +1 -1
- package/dist/unstable/workflow/Activity.d.ts +8 -3
- package/dist/unstable/workflow/Activity.d.ts.map +1 -1
- package/dist/unstable/workflow/Activity.js +25 -11
- package/dist/unstable/workflow/Activity.js.map +1 -1
- package/dist/unstable/workflow/DurableClock.d.ts +3 -6
- package/dist/unstable/workflow/DurableClock.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableClock.js +6 -6
- package/dist/unstable/workflow/DurableClock.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts +2 -5
- package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.js +33 -15
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +12 -14
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js +30 -26
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +24 -7
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +165 -16
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.js +4 -4
- package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
- package/package.json +11 -10
- package/src/Array.ts +304 -447
- package/src/BigDecimal.ts +137 -82
- package/src/BigInt.ts +53 -45
- package/src/Brand.ts +3 -5
- package/src/Cache.ts +27 -54
- package/src/Cause.ts +57 -22
- package/src/Channel.ts +687 -220
- package/src/Chunk.ts +149 -331
- package/src/Clock.ts +2 -2
- package/src/Combiner.ts +280 -13
- package/src/Config.ts +214 -52
- package/src/ConfigProvider.ts +5 -5
- package/src/Console.ts +2 -2
- package/src/Context.ts +1454 -0
- package/src/Cron.ts +155 -63
- package/src/Data.ts +530 -368
- package/src/DateTime.ts +77 -258
- package/src/Deferred.ts +15 -6
- package/src/Duration.ts +151 -81
- package/src/Effect.ts +1633 -1055
- package/src/Effectable.ts +47 -0
- package/src/Equal.ts +293 -109
- package/src/Equivalence.ts +114 -52
- package/src/ErrorReporter.ts +458 -0
- package/src/ExecutionPlan.ts +8 -9
- package/src/Exit.ts +24 -12
- package/src/Fiber.ts +17 -8
- package/src/FiberHandle.ts +15 -14
- package/src/FiberMap.ts +27 -27
- package/src/FiberSet.ts +5 -5
- package/src/FileSystem.ts +30 -26
- package/src/Filter.ts +4 -62
- package/src/Formatter.ts +268 -60
- package/src/Function.ts +2 -10
- package/src/Graph.ts +123 -112
- package/src/Hash.ts +2 -2
- package/src/HashMap.ts +26 -19
- package/src/Inspectable.ts +2 -22
- package/src/Iterable.ts +117 -63
- package/src/JsonSchema.ts +383 -10
- package/src/Latch.ts +85 -3
- package/src/Layer.ts +728 -441
- package/src/LayerMap.ts +38 -35
- package/src/LogLevel.ts +37 -0
- package/src/Logger.ts +35 -102
- package/src/ManagedRuntime.ts +61 -48
- package/src/Metric.ts +64 -66
- package/src/MutableHashMap.ts +9 -0
- package/src/MutableHashSet.ts +9 -0
- package/src/MutableList.ts +3 -0
- package/src/Newtype.ts +308 -0
- package/src/Number.ts +98 -29
- package/src/Optic.ts +948 -19
- package/src/Option.ts +34 -24
- package/src/Order.ts +39 -32
- package/src/PartitionedSemaphore.ts +414 -0
- package/src/Path.ts +2 -2
- package/src/Pool.ts +9 -9
- package/src/Predicate.ts +1 -1
- package/src/PubSub.ts +20 -11
- package/src/Pull.ts +1 -1
- package/src/Queue.ts +11 -9
- package/src/Random.ts +51 -14
- package/src/RcMap.ts +19 -19
- package/src/RcRef.ts +1 -1
- package/src/Record.ts +94 -199
- package/src/Redactable.ts +146 -72
- package/src/Reducer.ts +166 -7
- package/src/References.ts +283 -287
- package/src/Request.ts +5 -5
- package/src/RequestResolver.ts +34 -35
- package/src/Resource.ts +6 -5
- package/src/Result.ts +2 -4
- package/src/Runtime.ts +102 -6
- package/src/Schedule.ts +243 -336
- package/src/Scheduler.ts +52 -129
- package/src/Schema.ts +3769 -597
- package/src/SchemaAST.ts +480 -302
- package/src/SchemaGetter.ts +80 -24
- package/src/SchemaIssue.ts +28 -15
- package/src/SchemaParser.ts +100 -29
- package/src/SchemaRepresentation.ts +57 -33
- package/src/SchemaTransformation.ts +321 -32
- package/src/Scope.ts +2 -2
- package/src/ScopedCache.ts +8 -8
- package/src/Semaphore.ts +268 -182
- package/src/Sink.ts +89 -34
- package/src/Stdio.ts +29 -6
- package/src/Stream.ts +908 -752
- package/src/String.ts +122 -69
- package/src/Struct.ts +7 -7
- package/src/SubscriptionRef.ts +98 -118
- package/src/Terminal.ts +5 -4
- package/src/Tracer.ts +23 -22
- package/src/Trie.ts +44 -31
- package/src/TxChunk.ts +26 -16
- package/src/TxDeferred.ts +391 -0
- package/src/TxHashMap.ts +347 -291
- package/src/TxHashSet.ts +54 -61
- package/src/TxPriorityQueue.ts +762 -0
- package/src/TxPubSub.ts +787 -0
- package/src/TxQueue.ts +221 -245
- package/src/TxReentrantLock.ts +729 -0
- package/src/TxRef.ts +31 -31
- package/src/TxSemaphore.ts +203 -31
- package/src/TxSubscriptionRef.ts +637 -0
- package/src/Types.ts +75 -23
- package/src/Unify.ts +26 -2
- package/src/Utils.ts +137 -111
- package/src/index.ts +896 -73
- package/src/internal/core.ts +9 -10
- package/src/internal/dateTime.ts +91 -96
- package/src/internal/effect.ts +1179 -614
- package/src/internal/hashMap.ts +12 -10
- package/src/internal/layer.ts +7 -7
- package/src/internal/option.ts +7 -0
- package/src/internal/random.ts +20 -0
- package/src/internal/rcRef.ts +12 -12
- package/src/internal/references.ts +72 -0
- package/src/internal/request.ts +8 -8
- package/src/internal/schedule.ts +3 -1
- package/src/internal/schema/annotations.ts +2 -0
- package/src/internal/schema/representation.ts +82 -97
- package/src/internal/schema/schema.ts +68 -1
- package/src/internal/trie.ts +21 -15
- package/src/testing/TestClock.ts +6 -6
- package/src/testing/TestSchema.ts +333 -36
- package/src/testing/index.ts +64 -1
- package/src/unstable/ai/AiError.ts +111 -53
- package/src/unstable/ai/AnthropicStructuredOutput.ts +7 -3
- package/src/unstable/ai/Chat.ts +136 -88
- package/src/unstable/ai/EmbeddingModel.ts +209 -0
- package/src/unstable/ai/IdGenerator.ts +2 -2
- package/src/unstable/ai/LanguageModel.ts +685 -255
- package/src/unstable/ai/McpSchema.ts +84 -22
- package/src/unstable/ai/McpServer.ts +307 -87
- package/src/unstable/ai/Model.ts +44 -13
- package/src/unstable/ai/OpenAiStructuredOutput.ts +9 -2
- package/src/unstable/ai/Prompt.ts +23 -29
- package/src/unstable/ai/Response.ts +29 -31
- package/src/unstable/ai/ResponseIdTracker.ts +95 -0
- package/src/unstable/ai/Telemetry.ts +2 -2
- package/src/unstable/ai/Tokenizer.ts +2 -2
- package/src/unstable/ai/Tool.ts +62 -36
- package/src/unstable/ai/Toolkit.ts +17 -26
- package/src/unstable/ai/index.ts +24 -1
- package/src/unstable/ai/internal/codec-transformer.ts +3 -9
- package/src/unstable/cli/Argument.ts +5 -8
- package/src/unstable/cli/CliError.ts +67 -66
- package/src/unstable/cli/CliOutput.ts +87 -15
- package/src/unstable/cli/Command.ts +808 -193
- package/src/unstable/cli/Completions.ts +107 -0
- package/src/unstable/cli/Flag.ts +5 -6
- package/src/unstable/cli/GlobalFlag.ts +242 -0
- package/src/unstable/cli/HelpDoc.ts +91 -11
- package/src/unstable/cli/Param.ts +54 -27
- package/src/unstable/cli/Primitive.ts +2 -2
- package/src/unstable/cli/Prompt.ts +275 -104
- package/src/unstable/cli/index.ts +12 -0
- package/src/unstable/cli/internal/command.ts +125 -64
- package/src/unstable/cli/internal/completions/bash.ts +7 -7
- package/src/unstable/cli/internal/completions/{CommandDescriptor.ts → descriptor.ts} +16 -58
- package/src/unstable/cli/internal/completions/fish.ts +7 -7
- package/src/unstable/cli/internal/completions/zsh.ts +8 -14
- package/src/unstable/cli/internal/config.ts +49 -0
- package/src/unstable/cli/internal/help.ts +171 -0
- package/src/unstable/cli/internal/parser.ts +201 -84
- package/src/unstable/cluster/ClusterCron.ts +2 -2
- package/src/unstable/cluster/ClusterSchema.ts +38 -10
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +142 -80
- package/src/unstable/cluster/DeliverAt.ts +1 -1
- package/src/unstable/cluster/Entity.ts +58 -45
- package/src/unstable/cluster/EntityAddress.ts +1 -1
- package/src/unstable/cluster/EntityProxy.ts +3 -3
- package/src/unstable/cluster/EntityProxyServer.ts +6 -6
- package/src/unstable/cluster/EntityResource.ts +6 -6
- package/src/unstable/cluster/HttpRunner.ts +2 -2
- package/src/unstable/cluster/K8sHttpClient.ts +10 -10
- package/src/unstable/cluster/Message.ts +30 -17
- package/src/unstable/cluster/MessageStorage.ts +74 -45
- package/src/unstable/cluster/Reply.ts +13 -10
- package/src/unstable/cluster/Runner.ts +1 -1
- package/src/unstable/cluster/RunnerAddress.ts +1 -1
- package/src/unstable/cluster/RunnerHealth.ts +2 -2
- package/src/unstable/cluster/RunnerServer.ts +11 -14
- package/src/unstable/cluster/RunnerStorage.ts +9 -9
- package/src/unstable/cluster/Runners.ts +22 -18
- package/src/unstable/cluster/ShardId.ts +84 -74
- package/src/unstable/cluster/Sharding.ts +75 -60
- package/src/unstable/cluster/ShardingConfig.ts +39 -40
- package/src/unstable/cluster/Snowflake.ts +2 -2
- package/src/unstable/cluster/SqlMessageStorage.ts +29 -20
- package/src/unstable/cluster/SqlRunnerStorage.ts +13 -7
- package/src/unstable/cluster/internal/entityManager.ts +60 -41
- package/src/unstable/cluster/internal/entityReaper.ts +2 -2
- package/src/unstable/cluster/internal/resourceMap.ts +3 -3
- package/src/unstable/devtools/DevToolsClient.ts +26 -21
- package/src/unstable/devtools/DevToolsSchema.ts +16 -3
- package/src/unstable/encoding/Ndjson.ts +17 -17
- package/src/unstable/encoding/Sse.ts +3 -5
- package/src/unstable/eventlog/Event.ts +0 -8
- package/src/unstable/eventlog/EventGroup.ts +0 -4
- package/src/unstable/eventlog/EventJournal.ts +148 -80
- package/src/unstable/eventlog/EventLog.ts +360 -234
- package/src/unstable/eventlog/EventLogEncryption.ts +18 -32
- package/src/unstable/eventlog/EventLogMessage.ts +277 -0
- package/src/unstable/eventlog/EventLogRemote.ts +264 -410
- package/src/unstable/eventlog/EventLogServer.ts +183 -275
- package/src/unstable/eventlog/EventLogServerEncrypted.ts +206 -0
- package/src/unstable/eventlog/EventLogServerUnencrypted.ts +749 -0
- package/src/unstable/eventlog/EventLogSessionAuth.ts +437 -0
- package/src/unstable/eventlog/{SqlEventLogJournal.ts → SqlEventJournal.ts} +38 -22
- package/src/unstable/eventlog/{SqlEventLogServer.ts → SqlEventLogServerEncrypted.ts} +110 -43
- package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +506 -0
- package/src/unstable/eventlog/index.ts +27 -2
- package/src/unstable/eventlog/internal/identityRootSecretDerivation.ts +153 -0
- package/src/unstable/http/Cookies.ts +94 -11
- package/src/unstable/http/Etag.ts +7 -5
- package/src/unstable/http/FetchHttpClient.ts +5 -5
- package/src/unstable/http/Headers.ts +70 -20
- package/src/unstable/http/HttpClient.ts +385 -42
- package/src/unstable/http/HttpClientRequest.ts +151 -39
- package/src/unstable/http/HttpClientResponse.ts +24 -8
- package/src/unstable/http/HttpEffect.ts +71 -77
- package/src/unstable/http/HttpIncomingMessage.ts +9 -8
- package/src/unstable/http/HttpMethod.ts +16 -4
- package/src/unstable/http/HttpMiddleware.ts +50 -50
- package/src/unstable/http/HttpPlatform.ts +5 -4
- package/src/unstable/http/HttpRouter.ts +46 -46
- package/src/unstable/http/HttpServer.ts +5 -11
- package/src/unstable/http/HttpServerError.ts +45 -47
- package/src/unstable/http/HttpServerRequest.ts +414 -23
- package/src/unstable/http/HttpServerRespondable.ts +6 -6
- package/src/unstable/http/HttpServerResponse.ts +351 -13
- package/src/unstable/http/HttpStaticServer.ts +456 -0
- package/src/unstable/http/HttpTraceContext.ts +31 -17
- package/src/unstable/http/Multipart.ts +8 -8
- package/src/unstable/http/Url.ts +650 -0
- package/src/unstable/http/UrlParams.ts +30 -18
- package/src/unstable/http/index.ts +10 -0
- package/src/unstable/http/internal/preResponseHandler.ts +15 -0
- package/src/unstable/httpapi/HttpApi.ts +22 -22
- package/src/unstable/httpapi/HttpApiBuilder.ts +156 -66
- package/src/unstable/httpapi/HttpApiClient.ts +185 -34
- package/src/unstable/httpapi/HttpApiEndpoint.ts +225 -114
- package/src/unstable/httpapi/HttpApiError.ts +129 -30
- package/src/unstable/httpapi/HttpApiGroup.ts +18 -17
- package/src/unstable/httpapi/HttpApiMiddleware.ts +95 -32
- package/src/unstable/httpapi/HttpApiSchema.ts +106 -11
- package/src/unstable/httpapi/HttpApiSecurity.ts +13 -13
- package/src/unstable/httpapi/OpenApi.ts +74 -73
- package/src/unstable/observability/Otlp.ts +12 -12
- package/src/unstable/observability/OtlpExporter.ts +14 -10
- package/src/unstable/observability/OtlpLogger.ts +13 -9
- package/src/unstable/observability/OtlpMetrics.ts +6 -6
- package/src/unstable/observability/OtlpSerialization.ts +2 -2
- package/src/unstable/observability/OtlpTracer.ts +14 -10
- package/src/unstable/observability/PrometheusMetrics.ts +5 -5
- package/src/unstable/observability/internal/protobuf.ts +4 -4
- package/src/unstable/persistence/KeyValueStore.ts +226 -3
- package/src/unstable/persistence/Persistable.ts +3 -3
- package/src/unstable/persistence/PersistedCache.ts +20 -17
- package/src/unstable/persistence/PersistedQueue.ts +21 -21
- package/src/unstable/persistence/Persistence.ts +7 -7
- package/src/unstable/persistence/RateLimiter.ts +7 -7
- package/src/unstable/persistence/Redis.ts +2 -2
- package/src/unstable/process/ChildProcess.ts +6 -208
- package/src/unstable/process/ChildProcessSpawner.ts +114 -15
- package/src/unstable/reactivity/AsyncResult.ts +59 -17
- package/src/unstable/reactivity/Atom.ts +280 -124
- package/src/unstable/reactivity/AtomHttpApi.ts +127 -61
- package/src/unstable/reactivity/AtomRegistry.ts +70 -16
- package/src/unstable/reactivity/AtomRpc.ts +82 -37
- package/src/unstable/reactivity/Reactivity.ts +6 -6
- package/src/unstable/rpc/Rpc.ts +212 -32
- package/src/unstable/rpc/RpcClient.ts +161 -142
- package/src/unstable/rpc/RpcGroup.ts +51 -34
- package/src/unstable/rpc/RpcMiddleware.ts +28 -22
- package/src/unstable/rpc/RpcSchema.ts +24 -6
- package/src/unstable/rpc/RpcSerialization.ts +97 -54
- package/src/unstable/rpc/RpcServer.ts +91 -65
- package/src/unstable/rpc/RpcWorker.ts +5 -5
- package/src/unstable/rpc/Utils.ts +63 -4
- package/src/unstable/schema/Model.ts +35 -6
- package/src/unstable/schema/VariantSchema.ts +14 -27
- package/src/unstable/socket/Socket.ts +102 -62
- package/src/unstable/socket/SocketServer.ts +2 -2
- package/src/unstable/sql/Migrator.ts +7 -5
- package/src/unstable/sql/SqlClient.ts +48 -19
- package/src/unstable/sql/SqlConnection.ts +2 -2
- package/src/unstable/sql/SqlError.ts +365 -11
- package/src/unstable/sql/SqlModel.ts +57 -85
- package/src/unstable/sql/SqlResolver.ts +28 -20
- package/src/unstable/sql/SqlSchema.ts +42 -26
- package/src/unstable/sql/Statement.ts +21 -25
- package/src/unstable/workers/Transferable.ts +17 -19
- package/src/unstable/workers/Worker.ts +4 -4
- package/src/unstable/workers/WorkerRunner.ts +2 -2
- package/src/unstable/workflow/Activity.ts +36 -13
- package/src/unstable/workflow/DurableClock.ts +11 -11
- package/src/unstable/workflow/DurableDeferred.ts +36 -18
- package/src/unstable/workflow/Workflow.ts +46 -35
- package/src/unstable/workflow/WorkflowEngine.ts +236 -23
- package/src/unstable/workflow/WorkflowProxyServer.ts +4 -4
- package/dist/NullOr.d.ts +0 -149
- package/dist/NullOr.d.ts.map +0 -1
- package/dist/NullOr.js +0 -152
- package/dist/NullOr.js.map +0 -1
- package/dist/ServiceMap.d.ts +0 -1126
- package/dist/ServiceMap.d.ts.map +0 -1
- package/dist/ServiceMap.js.map +0 -1
- package/dist/internal/schema/to-codec.d.ts +0 -2
- package/dist/internal/schema/to-codec.d.ts.map +0 -1
- package/dist/internal/schema/to-codec.js +0 -129
- package/dist/internal/schema/to-codec.js.map +0 -1
- package/dist/unstable/cli/internal/builtInFlags.d.ts +0 -7
- package/dist/unstable/cli/internal/builtInFlags.d.ts.map +0 -1
- package/dist/unstable/cli/internal/builtInFlags.js +0 -44
- package/dist/unstable/cli/internal/builtInFlags.js.map +0 -1
- package/dist/unstable/cli/internal/completions/CommandDescriptor.d.ts +0 -2
- package/dist/unstable/cli/internal/completions/CommandDescriptor.d.ts.map +0 -1
- package/dist/unstable/cli/internal/completions/CommandDescriptor.js.map +0 -1
- package/dist/unstable/cli/internal/completions/Completions.d.ts +0 -2
- package/dist/unstable/cli/internal/completions/Completions.d.ts.map +0 -1
- package/dist/unstable/cli/internal/completions/Completions.js +0 -23
- package/dist/unstable/cli/internal/completions/Completions.js.map +0 -1
- package/dist/unstable/eventlog/SqlEventLogJournal.d.ts.map +0 -1
- package/dist/unstable/eventlog/SqlEventLogJournal.js.map +0 -1
- package/dist/unstable/eventlog/SqlEventLogServer.d.ts.map +0 -1
- package/dist/unstable/eventlog/SqlEventLogServer.js.map +0 -1
- package/src/NullOr.ts +0 -204
- package/src/ServiceMap.ts +0 -1410
- package/src/internal/schema/to-codec.ts +0 -148
- package/src/unstable/cli/internal/builtInFlags.ts +0 -78
- package/src/unstable/cli/internal/completions/Completions.ts +0 -31
package/dist/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;
|
|
@@ -353,6 +337,7 @@ export class FiberImpl {
|
|
|
353
337
|
this._children = undefined;
|
|
354
338
|
this._interruptedCause = undefined;
|
|
355
339
|
this._yielded = undefined;
|
|
340
|
+
this.runtimeMetrics?.recordFiberStart(this.context);
|
|
356
341
|
}
|
|
357
342
|
[FiberTypeId];
|
|
358
343
|
id;
|
|
@@ -366,8 +351,8 @@ export class FiberImpl {
|
|
|
366
351
|
_children;
|
|
367
352
|
_interruptedCause;
|
|
368
353
|
_yielded;
|
|
369
|
-
// set in
|
|
370
|
-
|
|
354
|
+
// set in setContext
|
|
355
|
+
context;
|
|
371
356
|
currentScheduler;
|
|
372
357
|
currentTracerContext;
|
|
373
358
|
currentSpan;
|
|
@@ -376,8 +361,13 @@ export class FiberImpl {
|
|
|
376
361
|
currentStackFrame;
|
|
377
362
|
runtimeMetrics;
|
|
378
363
|
maxOpsBeforeYield;
|
|
364
|
+
currentPreventYield;
|
|
365
|
+
_dispatcher = undefined;
|
|
366
|
+
get currentDispatcher() {
|
|
367
|
+
return this._dispatcher ??= this.currentScheduler.makeDispatcher();
|
|
368
|
+
}
|
|
379
369
|
getRef(ref) {
|
|
380
|
-
return
|
|
370
|
+
return Context.getReferenceUnsafe(this.context, ref);
|
|
381
371
|
}
|
|
382
372
|
addObserver(cb) {
|
|
383
373
|
if (this._exit) {
|
|
@@ -398,7 +388,7 @@ export class FiberImpl {
|
|
|
398
388
|
}
|
|
399
389
|
let cause = causeInterrupt(fiberId);
|
|
400
390
|
if (this.currentStackFrame) {
|
|
401
|
-
cause = causeAnnotate(cause,
|
|
391
|
+
cause = causeAnnotate(cause, Context.make(CauseStackTrace, this.currentStackFrame));
|
|
402
392
|
}
|
|
403
393
|
if (annotations) {
|
|
404
394
|
cause = causeAnnotate(cause, annotations);
|
|
@@ -412,7 +402,6 @@ export class FiberImpl {
|
|
|
412
402
|
return this._exit;
|
|
413
403
|
}
|
|
414
404
|
evaluate(effect) {
|
|
415
|
-
this.runtimeMetrics?.recordFiberStart(this.services);
|
|
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
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1231
|
+
export const tapCauseIf = /*#__PURE__*/dual(3, (self, predicate, f) => catchCauseIf(self, predicate, cause => andThen(internalCall(() => f(cause)), failCause(cause))));
|
|
1232
|
+
/** @internal */
|
|
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
|
+
}));
|
|
1245
1240
|
/** @internal */
|
|
1246
|
-
export const tapError = /*#__PURE__*/dual(2, (self, f) =>
|
|
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(_)));
|
|
1254
1249
|
/** @internal */
|
|
1255
|
-
export const catchIf = /*#__PURE__*/dual(args => isEffect(args[0]), (self,
|
|
1250
|
+
export const catchIf = /*#__PURE__*/dual(args => isEffect(args[0]), (self, predicate, f, orElse) => catchCause(self, cause => {
|
|
1256
1251
|
const error = findError(cause);
|
|
1257
1252
|
if (Result.isFailure(error)) return failCause(error.failure);
|
|
1258
|
-
|
|
1253
|
+
if (!predicate(error.success)) {
|
|
1254
|
+
return orElse ? internalCall(() => orElse(error.success)) : failCause(cause);
|
|
1255
|
+
}
|
|
1256
|
+
return internalCall(() => f(error.success));
|
|
1257
|
+
}));
|
|
1258
|
+
/** @internal */
|
|
1259
|
+
export const catchFilter = /*#__PURE__*/dual(args => isEffect(args[0]), (self, filter, f, orElse) => catchCause(self, cause => {
|
|
1260
|
+
const error = findError(cause);
|
|
1261
|
+
if (Result.isFailure(error)) return failCause(error.failure);
|
|
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
|
}
|
|
@@ -1313,6 +1317,20 @@ export const orDie = self => catch_(self, die);
|
|
|
1313
1317
|
/** @internal */
|
|
1314
1318
|
export const orElseSucceed = /*#__PURE__*/dual(2, (self, f) => catch_(self, _ => sync(f)));
|
|
1315
1319
|
/** @internal */
|
|
1320
|
+
export const firstSuccessOf = effects => suspend(() => {
|
|
1321
|
+
const iterator = effects[Symbol.iterator]();
|
|
1322
|
+
let state = iterator.next();
|
|
1323
|
+
if (state.done) {
|
|
1324
|
+
return die(new Error("Received an empty collection of effects"));
|
|
1325
|
+
}
|
|
1326
|
+
function loop(current) {
|
|
1327
|
+
const next = iterator.next();
|
|
1328
|
+
if (next.done) return current.value;
|
|
1329
|
+
return catch_(current.value, _ => loop(next));
|
|
1330
|
+
}
|
|
1331
|
+
return loop(state);
|
|
1332
|
+
});
|
|
1333
|
+
/** @internal */
|
|
1316
1334
|
export const eventually = self => catch_(self, _ => flatMap(yieldNow, () => eventually(self)));
|
|
1317
1335
|
/** @internal */
|
|
1318
1336
|
export const ignore = /*#__PURE__*/dual(args => isEffect(args[0]), (self, options) => {
|
|
@@ -1326,7 +1344,7 @@ export const ignore = /*#__PURE__*/dual(args => isEffect(args[0]), (self, option
|
|
|
1326
1344
|
return matchCauseEffect(self, {
|
|
1327
1345
|
onFailure(cause) {
|
|
1328
1346
|
const failure = findFail(cause);
|
|
1329
|
-
return Result.isFailure(failure) ? failCause(failure.failure) : logEffect(cause);
|
|
1347
|
+
return Result.isFailure(failure) ? failCause(failure.failure) : options.message === undefined ? logEffect(cause) : logEffect(options.message, cause);
|
|
1330
1348
|
},
|
|
1331
1349
|
onSuccess: _ => void_
|
|
1332
1350
|
});
|
|
@@ -1341,7 +1359,7 @@ export const ignoreCause = /*#__PURE__*/dual(args => isEffect(args[0]), (self, o
|
|
|
1341
1359
|
}
|
|
1342
1360
|
const logEffect = logWithLevel(options.log === true ? undefined : options.log);
|
|
1343
1361
|
return matchCauseEffect(self, {
|
|
1344
|
-
onFailure: logEffect,
|
|
1362
|
+
onFailure: cause => options.message === undefined ? logEffect(cause) : logEffect(options.message, cause),
|
|
1345
1363
|
onSuccess: _ => void_
|
|
1346
1364
|
});
|
|
1347
1365
|
});
|
|
@@ -1443,11 +1461,11 @@ export const isSuccess = /*#__PURE__*/matchEager({
|
|
|
1443
1461
|
/** @internal */
|
|
1444
1462
|
export const delay = /*#__PURE__*/dual(2, (self, duration) => andThen(sleep(duration), self));
|
|
1445
1463
|
/** @internal */
|
|
1446
|
-
export const timeoutOrElse = /*#__PURE__*/dual(2, (self, options) => raceFirst(self, flatMap(sleep(options.duration), options.
|
|
1464
|
+
export const timeoutOrElse = /*#__PURE__*/dual(2, (self, options) => raceFirst(self, flatMap(sleep(options.duration), options.orElse)));
|
|
1447
1465
|
/** @internal */
|
|
1448
1466
|
export const timeout = /*#__PURE__*/dual(2, (self, duration) => timeoutOrElse(self, {
|
|
1449
1467
|
duration,
|
|
1450
|
-
|
|
1468
|
+
orElse: () => fail(new TimeoutError())
|
|
1451
1469
|
}));
|
|
1452
1470
|
/** @internal */
|
|
1453
1471
|
export const timeoutOption = /*#__PURE__*/dual(2, (self, duration) => raceFirst(asSome(self), as(sleep(duration), Option.none())));
|
|
@@ -1464,7 +1482,7 @@ export const ScopeTypeId = "~effect/Scope";
|
|
|
1464
1482
|
/** @internal */
|
|
1465
1483
|
export const ScopeCloseableTypeId = "~effect/Scope/Closeable";
|
|
1466
1484
|
/** @internal */
|
|
1467
|
-
export const scopeTag = /*#__PURE__*/
|
|
1485
|
+
export const scopeTag = /*#__PURE__*/Context.Service("effect/Scope");
|
|
1468
1486
|
/** @internal */
|
|
1469
1487
|
export const scopeClose = (self, exit_) => suspend(() => scopeCloseUnsafe(self, exit_) ?? void_);
|
|
1470
1488
|
/** @internal */
|
|
@@ -1568,11 +1586,11 @@ export const scope = /*#__PURE__*/scopeTag.asEffect();
|
|
|
1568
1586
|
export const provideScope = /*#__PURE__*/provideService(scopeTag);
|
|
1569
1587
|
/** @internal */
|
|
1570
1588
|
export const scoped = self => withFiber(fiber => {
|
|
1571
|
-
const prev =
|
|
1589
|
+
const prev = fiber.context;
|
|
1572
1590
|
const scope = scopeMakeUnsafe();
|
|
1573
|
-
fiber.
|
|
1591
|
+
fiber.setContext(Context.add(fiber.context, scopeTag, scope));
|
|
1574
1592
|
return onExitPrimitive(self, exit => {
|
|
1575
|
-
fiber.
|
|
1593
|
+
fiber.setContext(prev);
|
|
1576
1594
|
return scopeCloseUnsafe(scope, exit);
|
|
1577
1595
|
});
|
|
1578
1596
|
});
|
|
@@ -1584,9 +1602,9 @@ export const scopedWith = f => suspend(() => {
|
|
|
1584
1602
|
return onExit(f(scope), exit => suspend(() => scopeCloseUnsafe(scope, exit) ?? void_));
|
|
1585
1603
|
});
|
|
1586
1604
|
/** @internal */
|
|
1587
|
-
export const acquireRelease = (acquire, release) =>
|
|
1605
|
+
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
1606
|
/** @internal */
|
|
1589
|
-
export const addFinalizer = finalizer => flatMap(scope, scope =>
|
|
1607
|
+
export const addFinalizer = finalizer => flatMap(scope, scope => contextWith(context => scopeAddFinalizerExit(scope, exit => provideContext(finalizer(exit), context))));
|
|
1590
1608
|
/** @internal */
|
|
1591
1609
|
export const onExitPrimitive = /*#__PURE__*/makePrimitive({
|
|
1592
1610
|
op: "OnExit",
|
|
@@ -1617,19 +1635,36 @@ export const onExit = /*#__PURE__*/dual(2, onExitPrimitive);
|
|
|
1617
1635
|
/** @internal */
|
|
1618
1636
|
export const ensuring = /*#__PURE__*/dual(2, (self, finalizer) => onExit(self, _ => finalizer));
|
|
1619
1637
|
/** @internal */
|
|
1620
|
-
export const onExitIf = /*#__PURE__*/dual(3, (self,
|
|
1621
|
-
|
|
1622
|
-
|
|
1638
|
+
export const onExitIf = /*#__PURE__*/dual(3, (self, predicate, f) => onExit(self, exit => {
|
|
1639
|
+
if (!predicate(exit)) {
|
|
1640
|
+
return void_;
|
|
1641
|
+
}
|
|
1642
|
+
return f(exit);
|
|
1643
|
+
}));
|
|
1644
|
+
/** @internal */
|
|
1645
|
+
export const onExitFilter = /*#__PURE__*/dual(3, (self, filter, f) => onExit(self, exit => {
|
|
1646
|
+
const b = filter(exit);
|
|
1647
|
+
return Result.isFailure(b) ? void_ : f(b.success, exit);
|
|
1623
1648
|
}));
|
|
1624
1649
|
/** @internal */
|
|
1625
|
-
export const onError = /*#__PURE__*/dual(2, (self, f) =>
|
|
1650
|
+
export const onError = /*#__PURE__*/dual(2, (self, f) => onExitFilter(self, exitFilterCause, f));
|
|
1651
|
+
/** @internal */
|
|
1652
|
+
export const onErrorIf = /*#__PURE__*/dual(3, (self, predicate, f) => onExitIf(self, exit => {
|
|
1653
|
+
if (exit._tag !== "Failure") {
|
|
1654
|
+
return false;
|
|
1655
|
+
}
|
|
1656
|
+
return predicate(exit.cause);
|
|
1657
|
+
}, exit => f(exit.cause)));
|
|
1626
1658
|
/** @internal */
|
|
1627
|
-
export const
|
|
1628
|
-
if (exit._tag !== "Failure")
|
|
1629
|
-
|
|
1630
|
-
}
|
|
1659
|
+
export const onErrorFilter = /*#__PURE__*/dual(3, (self, filter, f) => onExit(self, exit => {
|
|
1660
|
+
if (exit._tag !== "Failure") {
|
|
1661
|
+
return void_;
|
|
1662
|
+
}
|
|
1663
|
+
const result = filter(exit.cause);
|
|
1664
|
+
return Result.isFailure(result) ? void_ : f(result.success, exit.cause);
|
|
1665
|
+
}));
|
|
1631
1666
|
/** @internal */
|
|
1632
|
-
export const onInterrupt = /*#__PURE__*/dual(2, (self, finalizer) =>
|
|
1667
|
+
export const onInterrupt = /*#__PURE__*/dual(2, (self, finalizer) => onErrorFilter(causeFilterInterruptors, finalizer)(self));
|
|
1633
1668
|
/** @internal */
|
|
1634
1669
|
export const acquireUseRelease = (acquire, use, release) => uninterruptibleMask(restore => flatMap(acquire, a => onExitPrimitive(restore(use(a)), exit => release(a, exit), true)));
|
|
1635
1670
|
// ----------------------------------------------------------------------------
|
|
@@ -1637,7 +1672,7 @@ export const acquireUseRelease = (acquire, use, release) => uninterruptibleMask(
|
|
|
1637
1672
|
// ----------------------------------------------------------------------------
|
|
1638
1673
|
/** @internal */
|
|
1639
1674
|
export const cachedInvalidateWithTTL = /*#__PURE__*/dual(2, (self, ttl) => sync(() => {
|
|
1640
|
-
const ttlMillis = Duration.toMillis(Duration.
|
|
1675
|
+
const ttlMillis = Duration.toMillis(Duration.fromInputUnsafe(ttl));
|
|
1641
1676
|
const isFinite = Number.isFinite(ttlMillis);
|
|
1642
1677
|
const latch = makeLatchUnsafe(false);
|
|
1643
1678
|
let expiresAt = 0;
|
|
@@ -1645,14 +1680,15 @@ export const cachedInvalidateWithTTL = /*#__PURE__*/dual(2, (self, ttl) => sync(
|
|
|
1645
1680
|
let exit;
|
|
1646
1681
|
const wait = flatMap(latch.await, () => exit);
|
|
1647
1682
|
return [withFiber(fiber => {
|
|
1648
|
-
const
|
|
1683
|
+
const clock = fiber.getRef(ClockRef);
|
|
1684
|
+
const now = isFinite ? clock.currentTimeMillisUnsafe() : 0;
|
|
1649
1685
|
if (running || now < expiresAt) return exit ?? wait;
|
|
1650
1686
|
running = true;
|
|
1651
1687
|
latch.closeUnsafe();
|
|
1652
1688
|
exit = undefined;
|
|
1653
1689
|
return onExit(self, exit_ => sync(() => {
|
|
1654
1690
|
running = false;
|
|
1655
|
-
expiresAt =
|
|
1691
|
+
expiresAt = clock.currentTimeMillisUnsafe() + ttlMillis;
|
|
1656
1692
|
exit = exit_;
|
|
1657
1693
|
latch.openUnsafe();
|
|
1658
1694
|
}));
|
|
@@ -1711,6 +1747,8 @@ export const interruptibleMask = f => withFiber(fiber => {
|
|
|
1711
1747
|
fiber._stack.push(setInterruptibleFalse);
|
|
1712
1748
|
return f(uninterruptible);
|
|
1713
1749
|
});
|
|
1750
|
+
/** @internal */
|
|
1751
|
+
export const abortSignal = /*#__PURE__*/map(/*#__PURE__*/acquireRelease(/*#__PURE__*/sync(() => new AbortController()), controller => sync(() => controller.abort())), _ => _.signal);
|
|
1714
1752
|
// ========================================================================
|
|
1715
1753
|
// collecting & elements
|
|
1716
1754
|
// ========================================================================
|
|
@@ -1732,7 +1770,54 @@ export const all = (arg, options) => {
|
|
|
1732
1770
|
});
|
|
1733
1771
|
};
|
|
1734
1772
|
/** @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.
|
|
1773
|
+
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)));
|
|
1774
|
+
/** @internal */
|
|
1775
|
+
export const validate = /*#__PURE__*/dual(args => isIterable(args[0]) && !isEffect(args[0]), (elements, f, options) => flatMap(partition(elements, f, {
|
|
1776
|
+
concurrency: options?.concurrency
|
|
1777
|
+
}), ([excluded, satisfying]) => {
|
|
1778
|
+
if (Arr.isArrayNonEmpty(excluded)) {
|
|
1779
|
+
return fail(excluded);
|
|
1780
|
+
}
|
|
1781
|
+
return options?.discard ? void_ : succeed(satisfying);
|
|
1782
|
+
}));
|
|
1783
|
+
/** @internal */
|
|
1784
|
+
export const findFirst = /*#__PURE__*/dual(args => isIterable(args[0]) && !isEffect(args[0]), (elements, predicate) => suspend(() => {
|
|
1785
|
+
const iterator = elements[Symbol.iterator]();
|
|
1786
|
+
const next = iterator.next();
|
|
1787
|
+
if (!next.done) {
|
|
1788
|
+
return findFirstLoop(iterator, 0, predicate, next.value);
|
|
1789
|
+
}
|
|
1790
|
+
return succeed(Option.none());
|
|
1791
|
+
}));
|
|
1792
|
+
const findFirstLoop = (iterator, index, predicate, value) => flatMap(predicate(value, index), keep => {
|
|
1793
|
+
if (keep) {
|
|
1794
|
+
return succeed(Option.some(value));
|
|
1795
|
+
}
|
|
1796
|
+
const next = iterator.next();
|
|
1797
|
+
if (!next.done) {
|
|
1798
|
+
return findFirstLoop(iterator, index + 1, predicate, next.value);
|
|
1799
|
+
}
|
|
1800
|
+
return succeed(Option.none());
|
|
1801
|
+
});
|
|
1802
|
+
/** @internal */
|
|
1803
|
+
export const findFirstFilter = /*#__PURE__*/dual(args => isIterable(args[0]) && !isEffect(args[0]), (elements, filter) => suspend(() => {
|
|
1804
|
+
const iterator = elements[Symbol.iterator]();
|
|
1805
|
+
const next = iterator.next();
|
|
1806
|
+
if (!next.done) {
|
|
1807
|
+
return findFirstFilterLoop(iterator, 0, filter, next.value);
|
|
1808
|
+
}
|
|
1809
|
+
return succeed(Option.none());
|
|
1810
|
+
}));
|
|
1811
|
+
const findFirstFilterLoop = (iterator, index, filter, value) => flatMap(filter(value, index), result => {
|
|
1812
|
+
if (Result.isSuccess(result)) {
|
|
1813
|
+
return succeed(Option.some(result.success));
|
|
1814
|
+
}
|
|
1815
|
+
const next = iterator.next();
|
|
1816
|
+
if (!next.done) {
|
|
1817
|
+
return findFirstFilterLoop(iterator, index + 1, filter, next.value);
|
|
1818
|
+
}
|
|
1819
|
+
return succeed(Option.none());
|
|
1820
|
+
});
|
|
1736
1821
|
/** @internal */
|
|
1737
1822
|
export const whileLoop = /*#__PURE__*/makePrimitive({
|
|
1738
1823
|
op: "While",
|
|
@@ -1765,70 +1850,13 @@ export const forEach = /*#__PURE__*/dual(args => typeof args[1] === "function",
|
|
|
1765
1850
|
return options?.discard ? void_ : succeed([]);
|
|
1766
1851
|
}
|
|
1767
1852
|
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
|
-
});
|
|
1853
|
+
const eff = forEachConcurrent({
|
|
1854
|
+
f,
|
|
1855
|
+
out
|
|
1856
|
+
}, items, {
|
|
1857
|
+
concurrency
|
|
1831
1858
|
});
|
|
1859
|
+
return eff ? as(eff, out) : succeed(out);
|
|
1832
1860
|
}));
|
|
1833
1861
|
const forEachSequential = (iterable, f, options) => suspend(() => {
|
|
1834
1862
|
const out = options?.discard ? undefined : [];
|
|
@@ -1844,31 +1872,151 @@ const forEachSequential = (iterable, f, options) => suspend(() => {
|
|
|
1844
1872
|
}
|
|
1845
1873
|
}), out);
|
|
1846
1874
|
});
|
|
1875
|
+
const iterateEagerImpl = options => {
|
|
1876
|
+
const onItem = options.onItem;
|
|
1877
|
+
const step = options.step;
|
|
1878
|
+
return (state, items, opts) => {
|
|
1879
|
+
let index = opts?.start ?? 0;
|
|
1880
|
+
const end = opts?.end ?? items.length;
|
|
1881
|
+
const concurrency = opts?.concurrency ?? 1;
|
|
1882
|
+
let done = false;
|
|
1883
|
+
let parentFiber;
|
|
1884
|
+
let fibers;
|
|
1885
|
+
let resume;
|
|
1886
|
+
let interrupted = false;
|
|
1887
|
+
let terminal;
|
|
1888
|
+
let effect;
|
|
1889
|
+
const go = () => {
|
|
1890
|
+
let paused = false;
|
|
1891
|
+
for (; !terminal && index < end; index++) {
|
|
1892
|
+
const item = items[index];
|
|
1893
|
+
const eff = effect ?? onItem(state, item, index);
|
|
1894
|
+
// fast case (already an exit)
|
|
1895
|
+
if (effectIsExit(eff)) {
|
|
1896
|
+
terminal = step(state, item, eff, index);
|
|
1897
|
+
if (terminal) break;
|
|
1898
|
+
// Use flatMap for concurrency of 1
|
|
1899
|
+
} else if (concurrency === 1) {
|
|
1900
|
+
return flatMap(exit(eff), exit => {
|
|
1901
|
+
terminal = step(state, item, exit, index);
|
|
1902
|
+
index++;
|
|
1903
|
+
return terminal ?? go() ?? void_;
|
|
1904
|
+
});
|
|
1905
|
+
// We have an effect, so enter "async" mode
|
|
1906
|
+
} else if (!parentFiber) {
|
|
1907
|
+
return callback(cb => {
|
|
1908
|
+
parentFiber = getCurrentFiber();
|
|
1909
|
+
effect = eff;
|
|
1910
|
+
resume = cb;
|
|
1911
|
+
const result = go();
|
|
1912
|
+
if (result) return cb(result);
|
|
1913
|
+
return suspend(() => {
|
|
1914
|
+
terminal = exitVoid;
|
|
1915
|
+
interrupted = true;
|
|
1916
|
+
return fibers ? fiberInterruptAll(fibers) : void_;
|
|
1917
|
+
});
|
|
1918
|
+
});
|
|
1919
|
+
// Fork the effect with concurrency > 1
|
|
1920
|
+
} else {
|
|
1921
|
+
// Clear the temporary effect from capturing the parentFiber
|
|
1922
|
+
effect = undefined;
|
|
1923
|
+
const fiber = forkUnsafe(parentFiber, eff, true, true, "inherit");
|
|
1924
|
+
if (fiber._exit) {
|
|
1925
|
+
terminal = step(state, item, fiber._exit, index);
|
|
1926
|
+
if (terminal) break;
|
|
1927
|
+
continue;
|
|
1928
|
+
}
|
|
1929
|
+
// Add the fiber to the Set
|
|
1930
|
+
if (fibers) fibers.add(fiber);else fibers = new Set([fiber]);
|
|
1931
|
+
const currentIndex = index;
|
|
1932
|
+
fiber.addObserver(exit => {
|
|
1933
|
+
fibers.delete(fiber);
|
|
1934
|
+
if (terminal) {
|
|
1935
|
+
if (!interrupted && exit._tag === "Failure") {
|
|
1936
|
+
for (const reason of exit.cause.reasons) {
|
|
1937
|
+
if (reason._tag === "Interrupt") continue;else if (terminal._tag === "Failure") {
|
|
1938
|
+
;
|
|
1939
|
+
terminal.cause.reasons.push(reason);
|
|
1940
|
+
} else {
|
|
1941
|
+
terminal = exitFailCause(causeFromReasons([reason]));
|
|
1942
|
+
}
|
|
1943
|
+
}
|
|
1944
|
+
}
|
|
1945
|
+
} else {
|
|
1946
|
+
const result = step(state, item, exit, currentIndex);
|
|
1947
|
+
if (result) {
|
|
1948
|
+
terminal = result._tag === "Failure" ? exitFailCause(causeFromReasons(result.cause.reasons.slice())) : result;
|
|
1949
|
+
go();
|
|
1950
|
+
}
|
|
1951
|
+
}
|
|
1952
|
+
if (paused) {
|
|
1953
|
+
const eff = go();
|
|
1954
|
+
if (eff) resume(eff);
|
|
1955
|
+
} else if (done && fibers.size === 0) {
|
|
1956
|
+
resume(terminal ?? void_);
|
|
1957
|
+
}
|
|
1958
|
+
});
|
|
1959
|
+
// Check if we have reached the concurrency limit
|
|
1960
|
+
if (fibers.size < concurrency) continue;
|
|
1961
|
+
paused = true;
|
|
1962
|
+
index++;
|
|
1963
|
+
return;
|
|
1964
|
+
}
|
|
1965
|
+
}
|
|
1966
|
+
done = true;
|
|
1967
|
+
if (terminal) {
|
|
1968
|
+
if (fibers && fibers.size > 0) {
|
|
1969
|
+
const annotations = fiberStackAnnotations(parentFiber);
|
|
1970
|
+
fibers.forEach(f => f.interruptUnsafe(parentFiber.id, annotations));
|
|
1971
|
+
return;
|
|
1972
|
+
}
|
|
1973
|
+
if (resume || terminal._tag === "Failure") {
|
|
1974
|
+
return terminal;
|
|
1975
|
+
}
|
|
1976
|
+
} else if (resume) {
|
|
1977
|
+
if (!fibers) {
|
|
1978
|
+
return exitVoid;
|
|
1979
|
+
} else if (fibers.size === 0) {
|
|
1980
|
+
resume(void_);
|
|
1981
|
+
}
|
|
1982
|
+
}
|
|
1983
|
+
};
|
|
1984
|
+
return go();
|
|
1985
|
+
};
|
|
1986
|
+
};
|
|
1987
|
+
/** @internal */
|
|
1988
|
+
export const iterateEager = () => iterateEagerImpl;
|
|
1989
|
+
const forEachConcurrent = /*#__PURE__*/iterateEagerImpl({
|
|
1990
|
+
onItem(state, item, index) {
|
|
1991
|
+
return state.f(item, index);
|
|
1992
|
+
},
|
|
1993
|
+
step(state, _, exit, index) {
|
|
1994
|
+
if (exit._tag === "Failure") return exit;else if (state.out) {
|
|
1995
|
+
state.out[index] = exit.value;
|
|
1996
|
+
}
|
|
1997
|
+
}
|
|
1998
|
+
});
|
|
1847
1999
|
/* @internal */
|
|
1848
|
-
export const filterOrElse = /*#__PURE__*/dual(3, (self,
|
|
1849
|
-
|
|
2000
|
+
export const filterOrElse = /*#__PURE__*/dual(3, (self, predicate, orElse) => flatMap(self, a => predicate(a) ? succeed(a) : orElse(a)));
|
|
2001
|
+
/** @internal */
|
|
2002
|
+
export const filterMapOrElse = /*#__PURE__*/dual(3, (self, filter, orElse) => flatMap(self, a => {
|
|
2003
|
+
const result = filter(a);
|
|
1850
2004
|
return Result.isFailure(result) ? orElse(result.failure) : succeed(result.success);
|
|
1851
2005
|
}));
|
|
2006
|
+
/* @internal */
|
|
2007
|
+
export const filterMapOrFail = /*#__PURE__*/dual(args => isEffect(args[0]), (self, filter, orFailWith) => filterMapOrElse(self, filter, orFailWith ? x => fail(orFailWith(x)) : () => fail(new NoSuchElementError())));
|
|
1852
2008
|
/** @internal */
|
|
1853
|
-
export const filter = /*#__PURE__*/dual(args => isIterable(args[0]) && !isEffect(args[0]), (elements,
|
|
2009
|
+
export const filter = /*#__PURE__*/dual(args => isIterable(args[0]) && !isEffect(args[0]), (elements, predicate, options) => suspend(() => {
|
|
1854
2010
|
const out = [];
|
|
1855
2011
|
return as(forEach(elements, (a, i) => {
|
|
1856
|
-
const result =
|
|
2012
|
+
const result = predicate(a, i);
|
|
1857
2013
|
if (typeof result === "boolean") {
|
|
1858
2014
|
if (result) out.push(a);
|
|
1859
2015
|
return void_;
|
|
1860
2016
|
}
|
|
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);
|
|
2017
|
+
return map(result, keep => {
|
|
2018
|
+
if (keep) {
|
|
2019
|
+
out.push(a);
|
|
1872
2020
|
}
|
|
1873
2021
|
});
|
|
1874
2022
|
}, {
|
|
@@ -1876,6 +2024,29 @@ export const filter = /*#__PURE__*/dual(args => isIterable(args[0]) && !isEffect
|
|
|
1876
2024
|
concurrency: options?.concurrency
|
|
1877
2025
|
}), out);
|
|
1878
2026
|
}));
|
|
2027
|
+
/** @internal */
|
|
2028
|
+
export const filterMap = /*#__PURE__*/dual(args => isIterable(args[0]) && !isEffect(args[0]), (elements, filter) => suspend(() => {
|
|
2029
|
+
const out = [];
|
|
2030
|
+
for (const a of elements) {
|
|
2031
|
+
const result = filter(a);
|
|
2032
|
+
if (Result.isSuccess(result)) {
|
|
2033
|
+
out.push(result.success);
|
|
2034
|
+
}
|
|
2035
|
+
}
|
|
2036
|
+
return succeed(out);
|
|
2037
|
+
}));
|
|
2038
|
+
/** @internal */
|
|
2039
|
+
export const filterMapEffect = /*#__PURE__*/dual(args => isIterable(args[0]) && !isEffect(args[0]), (elements, filter, options) => suspend(() => {
|
|
2040
|
+
const out = [];
|
|
2041
|
+
return as(forEach(elements, a => map(filter(a), result => {
|
|
2042
|
+
if (Result.isSuccess(result)) {
|
|
2043
|
+
out.push(result.success);
|
|
2044
|
+
}
|
|
2045
|
+
}), {
|
|
2046
|
+
discard: true,
|
|
2047
|
+
concurrency: options?.concurrency
|
|
2048
|
+
}), out);
|
|
2049
|
+
}));
|
|
1879
2050
|
// ----------------------------------------------------------------------------
|
|
1880
2051
|
// do notation
|
|
1881
2052
|
// ----------------------------------------------------------------------------
|
|
@@ -1900,11 +2071,11 @@ export const forkChild = /*#__PURE__*/dual(args => isEffect(args[0]), (self, opt
|
|
|
1900
2071
|
/** @internal */
|
|
1901
2072
|
export const forkUnsafe = (parent, effect, immediate = false, daemon = false, uninterruptible = false) => {
|
|
1902
2073
|
const interruptible = uninterruptible === "inherit" ? parent.interruptible : !uninterruptible;
|
|
1903
|
-
const child = new FiberImpl(parent.
|
|
2074
|
+
const child = new FiberImpl(parent.context, interruptible);
|
|
1904
2075
|
if (immediate) {
|
|
1905
2076
|
child.evaluate(effect);
|
|
1906
2077
|
} else {
|
|
1907
|
-
parent.
|
|
2078
|
+
parent.currentDispatcher.scheduleTask(() => child.evaluate(effect), 0);
|
|
1908
2079
|
}
|
|
1909
2080
|
if (!daemon && !child._exit) {
|
|
1910
2081
|
parent.children().add(child);
|
|
@@ -1948,9 +2119,8 @@ export const forkScoped = /*#__PURE__*/dual(args => isEffect(args[0]), (self, op
|
|
|
1948
2119
|
// execution
|
|
1949
2120
|
// ----------------------------------------------------------------------------
|
|
1950
2121
|
/** @internal */
|
|
1951
|
-
export const runForkWith =
|
|
1952
|
-
const
|
|
1953
|
-
const fiber = new FiberImpl(scheduler ? ServiceMap.add(services, Scheduler.Scheduler, scheduler) : services, options?.uninterruptible !== true);
|
|
2122
|
+
export const runForkWith = context => (effect, options) => {
|
|
2123
|
+
const fiber = new FiberImpl(options?.scheduler ? Context.add(context, Scheduler.Scheduler, options.scheduler) : context, options?.uninterruptible !== true);
|
|
1954
2124
|
fiber.evaluate(effect);
|
|
1955
2125
|
if (fiber._exit) return fiber;
|
|
1956
2126
|
if (options?.signal) {
|
|
@@ -1964,6 +2134,9 @@ export const runForkWith = services => (effect, options) => {
|
|
|
1964
2134
|
fiber.addObserver(() => options.signal.removeEventListener("abort", abort));
|
|
1965
2135
|
}
|
|
1966
2136
|
}
|
|
2137
|
+
if (options?.onFiberStart) {
|
|
2138
|
+
options.onFiberStart(fiber);
|
|
2139
|
+
}
|
|
1967
2140
|
return fiber;
|
|
1968
2141
|
};
|
|
1969
2142
|
/** @internal */
|
|
@@ -1980,10 +2153,10 @@ export const fiberRunIn = /*#__PURE__*/dual(2, (self, scope) => {
|
|
|
1980
2153
|
return self;
|
|
1981
2154
|
});
|
|
1982
2155
|
/** @internal */
|
|
1983
|
-
export const runFork = /*#__PURE__*/runForkWith(/*#__PURE__*/
|
|
2156
|
+
export const runFork = /*#__PURE__*/runForkWith(/*#__PURE__*/Context.empty());
|
|
1984
2157
|
/** @internal */
|
|
1985
|
-
export const runCallbackWith =
|
|
1986
|
-
const runFork = runForkWith(
|
|
2158
|
+
export const runCallbackWith = context => {
|
|
2159
|
+
const runFork = runForkWith(context);
|
|
1987
2160
|
return (effect, options) => {
|
|
1988
2161
|
const fiber = runFork(effect, options);
|
|
1989
2162
|
if (options?.onExit) {
|
|
@@ -1995,10 +2168,10 @@ export const runCallbackWith = services => {
|
|
|
1995
2168
|
};
|
|
1996
2169
|
};
|
|
1997
2170
|
/** @internal */
|
|
1998
|
-
export const runCallback = /*#__PURE__*/runCallbackWith(/*#__PURE__*/
|
|
2171
|
+
export const runCallback = /*#__PURE__*/runCallbackWith(/*#__PURE__*/Context.empty());
|
|
1999
2172
|
/** @internal */
|
|
2000
|
-
export const runPromiseExitWith =
|
|
2001
|
-
const runFork = runForkWith(
|
|
2173
|
+
export const runPromiseExitWith = context => {
|
|
2174
|
+
const runFork = runForkWith(context);
|
|
2002
2175
|
return (effect, options) => {
|
|
2003
2176
|
const fiber = runFork(effect, options);
|
|
2004
2177
|
return new Promise(resolve => {
|
|
@@ -2007,10 +2180,10 @@ export const runPromiseExitWith = services => {
|
|
|
2007
2180
|
};
|
|
2008
2181
|
};
|
|
2009
2182
|
/** @internal */
|
|
2010
|
-
export const runPromiseExit = /*#__PURE__*/runPromiseExitWith(/*#__PURE__*/
|
|
2183
|
+
export const runPromiseExit = /*#__PURE__*/runPromiseExitWith(/*#__PURE__*/Context.empty());
|
|
2011
2184
|
/** @internal */
|
|
2012
|
-
export const runPromiseWith =
|
|
2013
|
-
const runPromiseExit = runPromiseExitWith(
|
|
2185
|
+
export const runPromiseWith = context => {
|
|
2186
|
+
const runPromiseExit = runPromiseExitWith(context);
|
|
2014
2187
|
return (effect, options) => runPromiseExit(effect, options).then(exit => {
|
|
2015
2188
|
if (exit._tag === "Failure") {
|
|
2016
2189
|
throw causeSquash(exit.cause);
|
|
@@ -2019,25 +2192,25 @@ export const runPromiseWith = services => {
|
|
|
2019
2192
|
});
|
|
2020
2193
|
};
|
|
2021
2194
|
/** @internal */
|
|
2022
|
-
export const runPromise = /*#__PURE__*/runPromiseWith(/*#__PURE__*/
|
|
2195
|
+
export const runPromise = /*#__PURE__*/runPromiseWith(/*#__PURE__*/Context.empty());
|
|
2023
2196
|
/** @internal */
|
|
2024
|
-
export const runSyncExitWith =
|
|
2025
|
-
const runFork = runForkWith(
|
|
2197
|
+
export const runSyncExitWith = context => {
|
|
2198
|
+
const runFork = runForkWith(context);
|
|
2026
2199
|
return effect => {
|
|
2027
2200
|
if (effectIsExit(effect)) return effect;
|
|
2028
2201
|
const scheduler = new Scheduler.MixedScheduler("sync");
|
|
2029
2202
|
const fiber = runFork(effect, {
|
|
2030
2203
|
scheduler
|
|
2031
2204
|
});
|
|
2032
|
-
|
|
2033
|
-
return fiber._exit ?? exitDie(fiber);
|
|
2205
|
+
fiber.currentDispatcher?.flush();
|
|
2206
|
+
return fiber._exit ?? exitDie(new AsyncFiberError(fiber));
|
|
2034
2207
|
};
|
|
2035
2208
|
};
|
|
2036
2209
|
/** @internal */
|
|
2037
|
-
export const runSyncExit = /*#__PURE__*/runSyncExitWith(/*#__PURE__*/
|
|
2210
|
+
export const runSyncExit = /*#__PURE__*/runSyncExitWith(/*#__PURE__*/Context.empty());
|
|
2038
2211
|
/** @internal */
|
|
2039
|
-
export const runSyncWith =
|
|
2040
|
-
const runSyncExit = runSyncExitWith(
|
|
2212
|
+
export const runSyncWith = context => {
|
|
2213
|
+
const runSyncExit = runSyncExitWith(context);
|
|
2041
2214
|
return effect => {
|
|
2042
2215
|
const exit = runSyncExit(effect);
|
|
2043
2216
|
if (exit._tag === "Failure") throw causeSquash(exit.cause);
|
|
@@ -2045,79 +2218,7 @@ export const runSyncWith = services => {
|
|
|
2045
2218
|
};
|
|
2046
2219
|
};
|
|
2047
2220
|
/** @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));
|
|
2221
|
+
export const runSync = /*#__PURE__*/runSyncWith(/*#__PURE__*/Context.empty());
|
|
2121
2222
|
const succeedTrue = /*#__PURE__*/succeed(true);
|
|
2122
2223
|
const succeedFalse = /*#__PURE__*/succeed(false);
|
|
2123
2224
|
class Latch {
|
|
@@ -2132,7 +2233,7 @@ class Latch {
|
|
|
2132
2233
|
return succeedTrue;
|
|
2133
2234
|
}
|
|
2134
2235
|
this.scheduled = true;
|
|
2135
|
-
fiber.
|
|
2236
|
+
fiber.currentDispatcher.scheduleTask(this.flushWaiters, 0);
|
|
2136
2237
|
return succeedTrue;
|
|
2137
2238
|
}
|
|
2138
2239
|
flushWaiters = () => {
|
|
@@ -2148,7 +2249,7 @@ class Latch {
|
|
|
2148
2249
|
this.isOpen = true;
|
|
2149
2250
|
return this.scheduleUnsafe(fiber);
|
|
2150
2251
|
});
|
|
2151
|
-
release = /*#__PURE__*/withFiber(fiber => this.
|
|
2252
|
+
release = /*#__PURE__*/withFiber(fiber => this.isOpen ? succeedFalse : this.scheduleUnsafe(fiber));
|
|
2152
2253
|
openUnsafe() {
|
|
2153
2254
|
if (this.isOpen) return false;
|
|
2154
2255
|
this.isOpen = true;
|
|
@@ -2173,7 +2274,7 @@ class Latch {
|
|
|
2173
2274
|
return true;
|
|
2174
2275
|
}
|
|
2175
2276
|
close = /*#__PURE__*/sync(() => this.closeUnsafe());
|
|
2176
|
-
whenOpen = self =>
|
|
2277
|
+
whenOpen = self => flatMap(this.await, () => self);
|
|
2177
2278
|
}
|
|
2178
2279
|
/** @internal */
|
|
2179
2280
|
export const makeLatchUnsafe = open => new Latch(open ?? false);
|
|
@@ -2213,20 +2314,19 @@ const NoopSpanProto = {
|
|
|
2213
2314
|
/** @internal */
|
|
2214
2315
|
export const noopSpan = options => Object.assign(Object.create(NoopSpanProto), options);
|
|
2215
2316
|
const filterDisablePropagation = span => {
|
|
2216
|
-
if (span)
|
|
2217
|
-
|
|
2218
|
-
}
|
|
2317
|
+
if (!span) return Option.none();
|
|
2318
|
+
return Context.get(span.annotations, Tracer.DisablePropagation) ? span._tag === "Span" ? filterDisablePropagation(Option.getOrUndefined(span.parent)) : Option.none() : Option.some(span);
|
|
2219
2319
|
};
|
|
2220
2320
|
/** @internal */
|
|
2221
2321
|
export const makeSpanUnsafe = (fiber, name, options) => {
|
|
2222
|
-
const disablePropagation = !fiber.getRef(TracerEnabled) || options?.annotations &&
|
|
2223
|
-
const parent = options?.parent
|
|
2322
|
+
const disablePropagation = !fiber.getRef(TracerEnabled) || options?.annotations && Context.get(options.annotations, Tracer.DisablePropagation);
|
|
2323
|
+
const parent = options?.parent !== undefined ? Option.some(options.parent) : options?.root ? Option.none() : filterDisablePropagation(fiber.currentSpan);
|
|
2224
2324
|
let span;
|
|
2225
2325
|
if (disablePropagation) {
|
|
2226
2326
|
span = noopSpan({
|
|
2227
2327
|
name,
|
|
2228
2328
|
parent,
|
|
2229
|
-
annotations:
|
|
2329
|
+
annotations: Context.add(options?.annotations ?? Context.empty(), Tracer.DisablePropagation, true)
|
|
2230
2330
|
});
|
|
2231
2331
|
} else {
|
|
2232
2332
|
const tracer = fiber.getRef(Tracer.Tracer);
|
|
@@ -2239,12 +2339,12 @@ export const makeSpanUnsafe = (fiber, name, options) => {
|
|
|
2239
2339
|
span = tracer.span({
|
|
2240
2340
|
name,
|
|
2241
2341
|
parent,
|
|
2242
|
-
annotations: options?.annotations ??
|
|
2342
|
+
annotations: options?.annotations ?? Context.empty(),
|
|
2243
2343
|
links,
|
|
2244
|
-
startTime: timingEnabled ? clock.currentTimeNanosUnsafe() :
|
|
2344
|
+
startTime: timingEnabled ? clock.currentTimeNanosUnsafe() : BigInt(0),
|
|
2245
2345
|
kind: options?.kind ?? "internal",
|
|
2246
|
-
root: options?.root ??
|
|
2247
|
-
sampled: options?.sampled ?? (parent
|
|
2346
|
+
root: options?.root ?? Option.isNone(parent),
|
|
2347
|
+
sampled: options?.sampled ?? (Option.isSome(parent) && parent.value.sampled === false ? false : !isLogLevelGreaterThan(fiber.getRef(Tracer.MinimumTraceLevel), level))
|
|
2248
2348
|
});
|
|
2249
2349
|
for (const [key, value] of Object.entries(annotationsFromEnv)) {
|
|
2250
2350
|
span.attribute(key, value);
|
|
@@ -2261,7 +2361,7 @@ export const makeSpanUnsafe = (fiber, name, options) => {
|
|
|
2261
2361
|
export const makeSpan = (name, options) => withFiber(fiber => succeed(makeSpanUnsafe(fiber, name, options)));
|
|
2262
2362
|
/** @internal */
|
|
2263
2363
|
export const makeSpanScoped = (name, options) => uninterruptible(withFiber(fiber => {
|
|
2264
|
-
const scope =
|
|
2364
|
+
const scope = Context.getUnsafe(fiber.context, scopeTag);
|
|
2265
2365
|
const span = makeSpanUnsafe(fiber, name, options ?? {});
|
|
2266
2366
|
const clock = fiber.getRef(ClockRef);
|
|
2267
2367
|
const timingEnabled = fiber.getRef(TracerTimingEnabled);
|
|
@@ -2383,7 +2483,7 @@ export const currentParentSpan = /*#__PURE__*/serviceOptional(Tracer.ParentSpan)
|
|
|
2383
2483
|
// Clock
|
|
2384
2484
|
// ----------------------------------------------------------------------------
|
|
2385
2485
|
/** @internal */
|
|
2386
|
-
export const ClockRef = /*#__PURE__*/
|
|
2486
|
+
export const ClockRef = /*#__PURE__*/Context.Reference("effect/Clock", {
|
|
2387
2487
|
defaultValue: () => new ClockImpl()
|
|
2388
2488
|
});
|
|
2389
2489
|
const MAX_TIMER_MILLIS = 2 ** 31 - 1;
|
|
@@ -2427,7 +2527,7 @@ const processOrPerformanceNow = /*#__PURE__*/function () {
|
|
|
2427
2527
|
/** @internal */
|
|
2428
2528
|
export const clockWith = f => withFiber(fiber => f(fiber.getRef(ClockRef)));
|
|
2429
2529
|
/** @internal */
|
|
2430
|
-
export const sleep = duration => clockWith(clock => clock.sleep(Duration.
|
|
2530
|
+
export const sleep = duration => clockWith(clock => clock.sleep(Duration.fromInputUnsafe(duration)));
|
|
2431
2531
|
/** @internal */
|
|
2432
2532
|
export const currentTimeMillis = /*#__PURE__*/clockWith(clock => clock.currentTimeMillis);
|
|
2433
2533
|
/** @internal */
|
|
@@ -2475,6 +2575,20 @@ export class ExceededCapacityError extends /*#__PURE__*/TaggedError("ExceededCap
|
|
|
2475
2575
|
}
|
|
2476
2576
|
}
|
|
2477
2577
|
/** @internal */
|
|
2578
|
+
export const AsyncFiberErrorTypeId = "~effect/Cause/AsyncFiberError";
|
|
2579
|
+
/** @internal */
|
|
2580
|
+
export const isAsyncFiberError = u => hasProperty(u, AsyncFiberErrorTypeId);
|
|
2581
|
+
/** @internal */
|
|
2582
|
+
export class AsyncFiberError extends /*#__PURE__*/TaggedError("AsyncFiberError") {
|
|
2583
|
+
[AsyncFiberErrorTypeId] = AsyncFiberErrorTypeId;
|
|
2584
|
+
constructor(fiber) {
|
|
2585
|
+
super({
|
|
2586
|
+
message: "An asynchronous Effect was executed with Effect.runSync",
|
|
2587
|
+
fiber
|
|
2588
|
+
});
|
|
2589
|
+
}
|
|
2590
|
+
}
|
|
2591
|
+
/** @internal */
|
|
2478
2592
|
export const UnknownErrorTypeId = "~effect/Cause/UnknownError";
|
|
2479
2593
|
/** @internal */
|
|
2480
2594
|
export const isUnknownError = u => hasProperty(u, UnknownErrorTypeId);
|
|
@@ -2492,7 +2606,7 @@ export class UnknownError extends /*#__PURE__*/TaggedError("UnknownError") {
|
|
|
2492
2606
|
// Console
|
|
2493
2607
|
// ----------------------------------------------------------------------------
|
|
2494
2608
|
/** @internal */
|
|
2495
|
-
export const ConsoleRef = /*#__PURE__*/
|
|
2609
|
+
export const ConsoleRef = /*#__PURE__*/Context.Reference("effect/Console/CurrentConsole", {
|
|
2496
2610
|
defaultValue: () => globalThis.console
|
|
2497
2611
|
});
|
|
2498
2612
|
// ----------------------------------------------------------------------------
|
|
@@ -2527,14 +2641,46 @@ export const isLogLevelGreaterThan = /*#__PURE__*/Order.isGreaterThan(LogLevelOr
|
|
|
2527
2641
|
// Logger
|
|
2528
2642
|
// ----------------------------------------------------------------------------
|
|
2529
2643
|
/** @internal */
|
|
2530
|
-
export const CurrentLoggers = /*#__PURE__*/
|
|
2644
|
+
export const CurrentLoggers = /*#__PURE__*/Context.Reference("effect/Loggers/CurrentLoggers", {
|
|
2531
2645
|
defaultValue: () => new Set([defaultLogger, tracerLogger])
|
|
2532
2646
|
});
|
|
2533
2647
|
/** @internal */
|
|
2534
|
-
export const LogToStderr = /*#__PURE__*/
|
|
2648
|
+
export const LogToStderr = /*#__PURE__*/Context.Reference("effect/Logger/LogToStderr", {
|
|
2535
2649
|
defaultValue: constFalse
|
|
2536
2650
|
});
|
|
2537
2651
|
/** @internal */
|
|
2652
|
+
export const annotateLogsScoped = function () {
|
|
2653
|
+
const entries = typeof arguments[0] === "string" ? [[arguments[0], arguments[1]]] : Object.entries(arguments[0]);
|
|
2654
|
+
return uninterruptible(withFiber(fiber => {
|
|
2655
|
+
const prev = fiber.getRef(CurrentLogAnnotations);
|
|
2656
|
+
const next = {
|
|
2657
|
+
...prev
|
|
2658
|
+
};
|
|
2659
|
+
for (let i = 0; i < entries.length; i++) {
|
|
2660
|
+
const [key, value] = entries[i];
|
|
2661
|
+
next[key] = value;
|
|
2662
|
+
}
|
|
2663
|
+
fiber.setContext(Context.add(fiber.context, CurrentLogAnnotations, next));
|
|
2664
|
+
return scopeAddFinalizerExit(Context.getUnsafe(fiber.context, scopeTag), _ => {
|
|
2665
|
+
const current = fiber.getRef(CurrentLogAnnotations);
|
|
2666
|
+
const next = {
|
|
2667
|
+
...current
|
|
2668
|
+
};
|
|
2669
|
+
for (let i = 0; i < entries.length; i++) {
|
|
2670
|
+
const [key, value] = entries[i];
|
|
2671
|
+
if (current[key] !== value) continue;
|
|
2672
|
+
if (key in prev) {
|
|
2673
|
+
next[key] = prev[key];
|
|
2674
|
+
} else {
|
|
2675
|
+
delete next[key];
|
|
2676
|
+
}
|
|
2677
|
+
}
|
|
2678
|
+
fiber.setContext(Context.add(fiber.context, CurrentLogAnnotations, next));
|
|
2679
|
+
return void_;
|
|
2680
|
+
});
|
|
2681
|
+
}));
|
|
2682
|
+
};
|
|
2683
|
+
/** @internal */
|
|
2538
2684
|
export const LoggerTypeId = "~effect/Logger";
|
|
2539
2685
|
const LoggerProto = {
|
|
2540
2686
|
[LoggerTypeId]: {
|
|
@@ -2684,7 +2830,7 @@ export const consolePretty = options => {
|
|
|
2684
2830
|
};
|
|
2685
2831
|
const prettyLoggerTty = options => {
|
|
2686
2832
|
const processIsBun = typeof process === "object" && "isBun" in process && process.isBun === true;
|
|
2687
|
-
const color = options.colors
|
|
2833
|
+
const color = options.colors ? withColor : withColorNoop;
|
|
2688
2834
|
return loggerMake(({
|
|
2689
2835
|
cause,
|
|
2690
2836
|
date,
|
|
@@ -2693,6 +2839,7 @@ const prettyLoggerTty = options => {
|
|
|
2693
2839
|
message: message_
|
|
2694
2840
|
}) => {
|
|
2695
2841
|
const console = fiber.getRef(ConsoleRef);
|
|
2842
|
+
// oxlint-disable-next-line no-console
|
|
2696
2843
|
const log = fiber.getRef(LogToStderr) ? console.error : console.log;
|
|
2697
2844
|
const message = Array.isArray(message_) ? message_.slice() : [message_];
|
|
2698
2845
|
let firstLine = color(`[${options.formatDate(date)}]`, colors.white) + ` ${color(logLevel.toUpperCase(), ...logLevelColors[logLevel])}` + ` (#${fiber.id})`;
|
|
@@ -2711,6 +2858,7 @@ const prettyLoggerTty = options => {
|
|
|
2711
2858
|
}
|
|
2712
2859
|
}
|
|
2713
2860
|
log(firstLine);
|
|
2861
|
+
// oxlint-disable-next-line no-console
|
|
2714
2862
|
if (!processIsBun) console.group();
|
|
2715
2863
|
if (cause.reasons.length > 0) {
|
|
2716
2864
|
log(causePretty(cause));
|
|
@@ -2724,6 +2872,7 @@ const prettyLoggerTty = options => {
|
|
|
2724
2872
|
for (const [key, value] of Object.entries(annotations)) {
|
|
2725
2873
|
log(color(`${key}:`, colors.bold, colors.white), redact(value));
|
|
2726
2874
|
}
|
|
2875
|
+
// oxlint-disable-next-line no-console
|
|
2727
2876
|
if (!processIsBun) console.groupEnd();
|
|
2728
2877
|
});
|
|
2729
2878
|
};
|
|
@@ -2764,12 +2913,15 @@ const prettyLoggerBrowser = options => {
|
|
|
2764
2913
|
messageIndex++;
|
|
2765
2914
|
}
|
|
2766
2915
|
}
|
|
2916
|
+
// oxlint-disable-next-line no-console
|
|
2767
2917
|
console.groupCollapsed(firstLine, ...firstParams);
|
|
2768
2918
|
if (cause.reasons.length > 0) {
|
|
2919
|
+
// oxlint-disable-next-line no-console
|
|
2769
2920
|
console.error(causePretty(cause));
|
|
2770
2921
|
}
|
|
2771
2922
|
if (messageIndex < message.length) {
|
|
2772
2923
|
for (; messageIndex < message.length; messageIndex++) {
|
|
2924
|
+
// oxlint-disable-next-line no-console
|
|
2773
2925
|
console.log(redact(message[messageIndex]));
|
|
2774
2926
|
}
|
|
2775
2927
|
}
|
|
@@ -2777,11 +2929,14 @@ const prettyLoggerBrowser = options => {
|
|
|
2777
2929
|
for (const [key, value] of Object.entries(annotations)) {
|
|
2778
2930
|
const redacted = redact(value);
|
|
2779
2931
|
if (options.colors) {
|
|
2932
|
+
// oxlint-disable-next-line no-console
|
|
2780
2933
|
console.log(`%c${key}:`, "color:gray", redacted);
|
|
2781
2934
|
} else {
|
|
2935
|
+
// oxlint-disable-next-line no-console
|
|
2782
2936
|
console.log(`${key}:`, redacted);
|
|
2783
2937
|
}
|
|
2784
2938
|
}
|
|
2939
|
+
// oxlint-disable-next-line no-console
|
|
2785
2940
|
console.groupEnd();
|
|
2786
2941
|
});
|
|
2787
2942
|
};
|
|
@@ -2795,7 +2950,7 @@ export const defaultLogger = /*#__PURE__*/loggerMake(({
|
|
|
2795
2950
|
}) => {
|
|
2796
2951
|
const message_ = Array.isArray(message) ? message.slice() : [message];
|
|
2797
2952
|
if (cause.reasons.length > 0) {
|
|
2798
|
-
message_.
|
|
2953
|
+
message_.push(causePretty(cause));
|
|
2799
2954
|
}
|
|
2800
2955
|
const now = date.getTime();
|
|
2801
2956
|
const spans = fiber.getRef(CurrentLogSpans);
|
|
@@ -2808,6 +2963,7 @@ export const defaultLogger = /*#__PURE__*/loggerMake(({
|
|
|
2808
2963
|
message_.push(annotations);
|
|
2809
2964
|
}
|
|
2810
2965
|
const console = fiber.getRef(ConsoleRef);
|
|
2966
|
+
// oxlint-disable-next-line no-console
|
|
2811
2967
|
const log = fiber.getRef(LogToStderr) ? console.error : console.log;
|
|
2812
2968
|
log(`[${defaultDateFormat(date)}] ${logLevel.toUpperCase()} (#${fiber.id})${spanString}:`, ...message_);
|
|
2813
2969
|
});
|
|
@@ -2841,4 +2997,24 @@ export function interruptChildrenPatch() {
|
|
|
2841
2997
|
const undefined_ = /*#__PURE__*/succeed(undefined);
|
|
2842
2998
|
/** @internal */
|
|
2843
2999
|
export { undefined_ as undefined };
|
|
3000
|
+
// ----------------------------------------------------------------------------
|
|
3001
|
+
// ErrorReporter
|
|
3002
|
+
// ----------------------------------------------------------------------------
|
|
3003
|
+
/** @internal */
|
|
3004
|
+
export const withErrorReporting = /*#__PURE__*/dual(args => isEffect(args[0]), (self, options) => onError(self, cause => withFiber(fiber => {
|
|
3005
|
+
reportCauseUnsafe(fiber, cause, options?.defectsOnly);
|
|
3006
|
+
return void_;
|
|
3007
|
+
})));
|
|
3008
|
+
/** @internal */
|
|
3009
|
+
export const reportCauseUnsafe = (fiber, cause, defectsOnly) => {
|
|
3010
|
+
const reporters = fiber.getRef(CurrentErrorReporters);
|
|
3011
|
+
if (reporters.size === 0) return;
|
|
3012
|
+
if (defectsOnly && !hasDies(cause)) return;
|
|
3013
|
+
const opts = {
|
|
3014
|
+
cause,
|
|
3015
|
+
fiber,
|
|
3016
|
+
timestamp: fiber.getRef(ClockRef).currentTimeNanosUnsafe()
|
|
3017
|
+
};
|
|
3018
|
+
reporters.forEach(reporter => reporter.report(opts));
|
|
3019
|
+
};
|
|
2844
3020
|
//# sourceMappingURL=effect.js.map
|