effect 4.0.0-rc.111 → 4.0.0-rc.113
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/AGENTS.md +24 -9
- package/CLAUDE.md +24 -9
- package/ai-docs/package.json +2 -2
- package/ai-docs/src/01_effect/01_basics/02_effect-fn.ts +18 -5
- package/ai-docs/src/01_effect/01_basics/index.md +5 -3
- package/ai-docs/src/01_effect/03_services/20_layer-composition.ts +1 -1
- package/ai-docs/src/01_effect/03_services/20_layer-unwrap.ts +2 -2
- package/ai-docs/src/01_effect/05_resources/10_acquire-release.ts +2 -2
- package/ai-docs/src/03_stream/30_encoding.ts +5 -7
- package/ai-docs/src/08_observability/10_logging.ts +1 -1
- package/ai-docs/src/70_cli/10_basics.ts +7 -7
- package/ai-docs/src/71_ai/10_language-model.ts +2 -2
- package/ai-docs/src/71_ai/20_tools.ts +1 -1
- package/ai-docs/src/71_ai/30_chat.ts +1 -1
- package/dist/Array.d.ts +109 -52
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +65 -32
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +5 -1
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +40 -23
- package/dist/BigDecimal.js.map +1 -1
- package/dist/ByteSize.d.ts +633 -0
- package/dist/ByteSize.d.ts.map +1 -0
- package/dist/ByteSize.js +524 -0
- package/dist/ByteSize.js.map +1 -0
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +17 -3
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +1 -1
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Channel.d.ts +97 -24
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +68 -41
- package/dist/Channel.js.map +1 -1
- package/dist/Chunk.d.ts +49 -28
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +27 -18
- package/dist/Chunk.js.map +1 -1
- package/dist/Config.d.ts +162 -201
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +103 -212
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +4 -4
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +7 -7
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Context.d.ts +31 -0
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js.map +1 -1
- package/dist/Cron.d.ts +2 -2
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +2 -2
- package/dist/Cron.js.map +1 -1
- package/dist/Crypto.d.ts +1 -1
- package/dist/Crypto.d.ts.map +1 -1
- package/dist/Crypto.js +3 -2
- package/dist/Crypto.js.map +1 -1
- package/dist/DateTime.d.ts +2 -2
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +6 -6
- package/dist/Deferred.js.map +1 -1
- package/dist/Duration.d.ts +1 -1
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +1 -1
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +220 -113
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +27 -26
- package/dist/Effect.js.map +1 -1
- package/dist/Effectable.d.ts +58 -2
- package/dist/Effectable.d.ts.map +1 -1
- package/dist/Effectable.js +58 -6
- package/dist/Effectable.js.map +1 -1
- package/dist/Encoding.d.ts +3 -1
- package/dist/Encoding.d.ts.map +1 -1
- package/dist/Encoding.js +40 -10
- package/dist/Encoding.js.map +1 -1
- package/dist/Equal.d.ts +1 -1
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +1 -1
- package/dist/Equal.js.map +1 -1
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/ExecutionPlan.js +1 -0
- package/dist/ExecutionPlan.js.map +1 -1
- package/dist/Fiber.d.ts +32 -8
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.js +3 -3
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +12 -6
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +11 -6
- package/dist/FiberMap.js.map +1 -1
- package/dist/FileSystem.d.ts +42 -210
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +16 -148
- package/dist/FileSystem.js.map +1 -1
- package/dist/Formatter.d.ts +1 -0
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +19 -3
- package/dist/Formatter.js.map +1 -1
- package/dist/Graph.d.ts +48 -20
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +20 -5
- package/dist/Graph.js.map +1 -1
- package/dist/Hash.d.ts +1 -1
- package/dist/Hash.d.ts.map +1 -1
- package/dist/Hash.js +5 -14
- package/dist/Hash.js.map +1 -1
- package/dist/HashMap.d.ts +1 -1
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashRing.d.ts +6 -1
- package/dist/HashRing.d.ts.map +1 -1
- package/dist/HashRing.js +9 -2
- package/dist/HashRing.js.map +1 -1
- package/dist/HashSet.d.ts +1 -1
- package/dist/HashSet.d.ts.map +1 -1
- package/dist/HashSet.js.map +1 -1
- package/dist/Iterable.d.ts +56 -17
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +65 -45
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonPatch.js +4 -4
- package/dist/JsonPatch.js.map +1 -1
- package/dist/JsonPointer.d.ts +68 -4
- package/dist/JsonPointer.d.ts.map +1 -1
- package/dist/JsonPointer.js +90 -4
- package/dist/JsonPointer.js.map +1 -1
- package/dist/JsonSchema.d.ts +67 -94
- package/dist/JsonSchema.d.ts.map +1 -1
- package/dist/JsonSchema.js +752 -397
- package/dist/JsonSchema.js.map +1 -1
- package/dist/Layer.d.ts +47 -4
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +4 -6
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +24 -3
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +9 -5
- package/dist/LayerMap.js.map +1 -1
- package/dist/LayerRef.d.ts.map +1 -1
- package/dist/LayerRef.js +7 -5
- package/dist/LayerRef.js.map +1 -1
- package/dist/Logger.d.ts +114 -9
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +109 -9
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.js +1 -1
- package/dist/ManagedRuntime.js.map +1 -1
- package/dist/Match.d.ts +43 -31
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js +5 -2
- package/dist/Match.js.map +1 -1
- package/dist/Metric.d.ts +11 -4
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +14 -18
- package/dist/Metric.js.map +1 -1
- package/dist/MutableHashMap.d.ts +1 -1
- package/dist/MutableHashMap.d.ts.map +1 -1
- package/dist/MutableHashMap.js +1 -1
- package/dist/MutableHashMap.js.map +1 -1
- package/dist/MutableHashSet.d.ts +1 -1
- package/dist/MutableHashSet.d.ts.map +1 -1
- package/dist/MutableHashSet.js +1 -1
- package/dist/MutableHashSet.js.map +1 -1
- package/dist/MutableList.d.ts +13 -2
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +18 -2
- package/dist/MutableList.js.map +1 -1
- package/dist/Number.d.ts +6 -0
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +3 -1
- package/dist/Number.js.map +1 -1
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +5 -4
- package/dist/Optic.js.map +1 -1
- package/dist/Option.d.ts +1 -1
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +1 -1
- package/dist/Option.js.map +1 -1
- package/dist/Order.d.ts +1 -0
- package/dist/Order.d.ts.map +1 -1
- package/dist/Order.js +3 -1
- package/dist/Order.js.map +1 -1
- package/dist/PartitionedSemaphore.d.ts.map +1 -1
- package/dist/PartitionedSemaphore.js +1 -2
- package/dist/PartitionedSemaphore.js.map +1 -1
- package/dist/Path.d.ts +1 -1
- package/dist/Path.d.ts.map +1 -1
- package/dist/Path.js +1 -1
- package/dist/Path.js.map +1 -1
- package/dist/PlatformError.d.ts +1 -1
- package/dist/PlatformError.d.ts.map +1 -1
- package/dist/PlatformError.js +1 -1
- package/dist/PlatformError.js.map +1 -1
- package/dist/Pool.d.ts +137 -10
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +332 -75
- package/dist/Pool.js.map +1 -1
- package/dist/PrimaryKey.d.ts +1 -1
- package/dist/PrimaryKey.d.ts.map +1 -1
- package/dist/PrimaryKey.js +1 -1
- package/dist/PrimaryKey.js.map +1 -1
- package/dist/PubSub.d.ts +21 -9
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +18 -14
- package/dist/PubSub.js.map +1 -1
- package/dist/Queue.d.ts +82 -6
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +116 -27
- package/dist/Queue.js.map +1 -1
- package/dist/Random.d.ts +17 -4
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +1 -1
- package/dist/Random.js.map +1 -1
- package/dist/RcMap.d.ts +137 -0
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +72 -9
- package/dist/RcMap.js.map +1 -1
- package/dist/Record.d.ts +13 -0
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js.map +1 -1
- package/dist/Redacted.d.ts +1 -1
- package/dist/Redacted.d.ts.map +1 -1
- package/dist/Redacted.js +1 -1
- package/dist/Redacted.js.map +1 -1
- package/dist/RequestResolver.d.ts +15 -9
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +33 -15
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Result.d.ts +1 -1
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +1 -1
- package/dist/Result.js.map +1 -1
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +19 -10
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +2200 -2433
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +2797 -4184
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +359 -176
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +373 -630
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +46 -22
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +56 -53
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.d.ts +123 -200
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js +59 -263
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.js +2 -9
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +1276 -172
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +1371 -29
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +49 -16
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +75 -98
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/Scope.d.ts +9 -2
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedCache.js +10 -3
- package/dist/ScopedCache.js.map +1 -1
- package/dist/Sink.d.ts +9 -4
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +49 -31
- package/dist/Sink.js.map +1 -1
- package/dist/StandardSchema.d.ts +125 -0
- package/dist/StandardSchema.d.ts.map +1 -0
- package/dist/StandardSchema.js +9 -0
- package/dist/StandardSchema.js.map +1 -0
- package/dist/Stream.d.ts +221 -35
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +168 -84
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +16 -6
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +12 -5
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts.map +1 -1
- package/dist/Struct.js +7 -4
- package/dist/Struct.js.map +1 -1
- package/dist/SynchronizedRef.d.ts +3 -2
- package/dist/SynchronizedRef.d.ts.map +1 -1
- package/dist/SynchronizedRef.js.map +1 -1
- package/dist/Terminal.d.ts +3 -3
- package/dist/Terminal.d.ts.map +1 -1
- package/dist/Terminal.js +3 -3
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +27 -7
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +38 -13
- package/dist/Tracer.js.map +1 -1
- package/dist/Trie.d.ts +1 -1
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Tuple.d.ts +2 -1
- package/dist/Tuple.d.ts.map +1 -1
- package/dist/Tuple.js.map +1 -1
- package/dist/TxChunk.d.ts +1 -1
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxChunk.js +1 -1
- package/dist/TxChunk.js.map +1 -1
- package/dist/TxDeferred.d.ts +1 -1
- package/dist/TxDeferred.d.ts.map +1 -1
- package/dist/TxDeferred.js +1 -1
- package/dist/TxDeferred.js.map +1 -1
- package/dist/TxHashMap.d.ts +1 -1
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +1 -1
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxHashSet.d.ts +1 -1
- package/dist/TxHashSet.d.ts.map +1 -1
- package/dist/TxHashSet.js +1 -1
- package/dist/TxHashSet.js.map +1 -1
- package/dist/TxPriorityQueue.d.ts +1 -1
- package/dist/TxPriorityQueue.d.ts.map +1 -1
- package/dist/TxPriorityQueue.js +1 -1
- package/dist/TxPriorityQueue.js.map +1 -1
- package/dist/TxPubSub.d.ts +1 -1
- package/dist/TxPubSub.d.ts.map +1 -1
- package/dist/TxPubSub.js +1 -1
- package/dist/TxPubSub.js.map +1 -1
- package/dist/TxQueue.d.ts +9 -9
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxQueue.js +93 -86
- package/dist/TxQueue.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +29 -1
- package/dist/TxReentrantLock.d.ts.map +1 -1
- package/dist/TxReentrantLock.js +29 -1
- package/dist/TxReentrantLock.js.map +1 -1
- package/dist/TxRef.d.ts +1 -1
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +1 -1
- package/dist/TxRef.js.map +1 -1
- package/dist/TxSemaphore.d.ts +1 -1
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +1 -1
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/TxSubscriptionRef.d.ts +1 -1
- package/dist/TxSubscriptionRef.d.ts.map +1 -1
- package/dist/TxSubscriptionRef.js +1 -1
- package/dist/TxSubscriptionRef.js.map +1 -1
- package/dist/Types.d.ts +33 -19
- package/dist/Types.d.ts.map +1 -1
- package/dist/Utils.d.ts.map +1 -1
- package/dist/Utils.js +2 -1
- package/dist/Utils.js.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/arbitrary/model.d.ts +2 -0
- package/dist/internal/arbitrary/model.d.ts.map +1 -0
- package/dist/internal/arbitrary/model.js +495 -0
- package/dist/internal/arbitrary/model.js.map +1 -0
- package/dist/internal/arbitrary/regexp.d.ts +2 -0
- package/dist/internal/arbitrary/regexp.d.ts.map +1 -0
- package/dist/internal/arbitrary/regexp.js +789 -0
- package/dist/internal/arbitrary/regexp.js.map +1 -0
- package/dist/internal/arbitrary/runner.d.ts +2 -0
- package/dist/internal/arbitrary/runner.d.ts.map +1 -0
- package/dist/internal/arbitrary/runner.js +496 -0
- package/dist/internal/arbitrary/runner.js.map +1 -0
- package/dist/internal/arbitrary/schema.d.ts.map +1 -0
- package/dist/internal/arbitrary/schema.js +1340 -0
- package/dist/internal/arbitrary/schema.js.map +1 -0
- package/dist/internal/core.js +27 -13
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/count.d.ts +2 -0
- package/dist/internal/count.d.ts.map +1 -0
- package/dist/internal/count.js +14 -0
- package/dist/internal/count.js.map +1 -0
- package/dist/internal/dateTime.js +4 -10
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/effect.js +416 -258
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/graph.js +3 -1
- package/dist/internal/graph.js.map +1 -1
- package/dist/internal/hashMap.js +5 -3
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/hashSet.js +1 -1
- package/dist/internal/hashSet.js.map +1 -1
- package/dist/internal/matcher.js +1 -1
- package/dist/internal/matcher.js.map +1 -1
- package/dist/internal/metric.js +1 -1
- package/dist/internal/metric.js.map +1 -1
- package/dist/internal/option.js +6 -5
- package/dist/internal/option.js.map +1 -1
- package/dist/internal/random.js +17 -0
- package/dist/internal/random.js.map +1 -1
- package/dist/internal/rcRef.js +10 -7
- package/dist/internal/rcRef.js.map +1 -1
- package/dist/internal/references.js +1 -0
- package/dist/internal/references.js.map +1 -1
- package/dist/internal/request.js +13 -6
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/result.js +11 -9
- package/dist/internal/result.js.map +1 -1
- package/dist/internal/schema/annotations.js +1 -1
- package/dist/internal/schema/annotations.js.map +1 -1
- package/dist/internal/schema/fromJsonSchemaDocument.js +238 -132
- package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -1
- package/dist/internal/schema/fromRepresentation.js +5 -5
- package/dist/internal/schema/fromRepresentation.js.map +1 -1
- package/dist/internal/schema/make.d.ts +2 -0
- package/dist/internal/schema/make.d.ts.map +1 -0
- package/dist/internal/schema/{schema.js → make.js} +1 -25
- package/dist/internal/schema/make.js.map +1 -0
- package/dist/internal/schema/parser.d.ts +0 -12
- package/dist/internal/schema/parser.d.ts.map +1 -1
- package/dist/internal/schema/parser.js +7 -0
- package/dist/internal/schema/parser.js.map +1 -1
- package/dist/internal/schema/standardSchema.d.ts +2 -0
- package/dist/internal/schema/standardSchema.d.ts.map +1 -0
- package/dist/internal/schema/standardSchema.js +112 -0
- package/dist/internal/schema/standardSchema.js.map +1 -0
- package/dist/internal/schema/toCodeDocument.js +34 -22
- package/dist/internal/schema/toCodeDocument.js.map +1 -1
- package/dist/internal/schema/toCodec.d.ts +2 -0
- package/dist/internal/schema/toCodec.d.ts.map +1 -0
- package/dist/internal/schema/toCodec.js +242 -0
- package/dist/internal/schema/toCodec.js.map +1 -0
- package/dist/internal/schema/toDifferJsonPatch.d.ts +2 -0
- package/dist/internal/schema/toDifferJsonPatch.d.ts.map +1 -0
- package/dist/internal/schema/toDifferJsonPatch.js +20 -0
- package/dist/internal/schema/toDifferJsonPatch.js.map +1 -0
- package/dist/internal/schema/toEncoderXml.d.ts +2 -0
- package/dist/internal/schema/toEncoderXml.d.ts.map +1 -0
- package/dist/internal/schema/toEncoderXml.js +104 -0
- package/dist/internal/schema/toEncoderXml.js.map +1 -0
- package/dist/internal/schema/toEquivalence.js +66 -0
- package/dist/internal/schema/toEquivalence.js.map +1 -1
- package/dist/internal/schema/toFormatter.d.ts +2 -0
- package/dist/internal/schema/toFormatter.d.ts.map +1 -0
- package/dist/internal/schema/toFormatter.js +227 -0
- package/dist/internal/schema/toFormatter.js.map +1 -0
- package/dist/internal/schema/toIso.d.ts +2 -0
- package/dist/internal/schema/toIso.d.ts.map +1 -0
- package/dist/internal/schema/toIso.js +17 -0
- package/dist/internal/schema/toIso.js.map +1 -0
- package/dist/internal/schema/toJsonSchemaDocument.js +122 -71
- package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -1
- package/dist/internal/schema/toRepresentation.js +3 -1
- package/dist/internal/schema/toRepresentation.js.map +1 -1
- package/dist/internal/schemaError.d.ts +4 -0
- package/dist/internal/schemaError.d.ts.map +1 -0
- package/dist/internal/schemaError.js +6 -0
- package/dist/internal/schemaError.js.map +1 -0
- package/dist/internal/stream.js +5 -6
- package/dist/internal/stream.js.map +1 -1
- package/dist/internal/tracer.d.ts +1 -3
- package/dist/internal/tracer.d.ts.map +1 -1
- package/dist/internal/tracer.js +6 -0
- package/dist/internal/tracer.js.map +1 -1
- package/dist/internal/trie.js +2 -2
- package/dist/internal/trie.js.map +1 -1
- package/dist/internal/uuid.d.ts +1 -2
- package/dist/internal/uuid.d.ts.map +1 -1
- package/dist/internal/uuid.js +2 -0
- package/dist/internal/uuid.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +9 -11
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/testing/TestSchema.js +20 -18
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/testing/index.d.ts +0 -4
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +0 -4
- package/dist/testing/index.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +98 -23
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +98 -6
- 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 +5 -16
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +27 -32
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +10 -13
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.d.ts +23 -16
- package/dist/unstable/ai/EmbeddingModel.d.ts.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.js +13 -11
- package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +48 -37
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +150 -47
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +2 -2
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +87 -78
- package/dist/unstable/ai/McpServer.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 +3 -14
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Prompt.d.ts +2 -2
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Prompt.js +15 -4
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +37 -94
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js +46 -96
- package/dist/unstable/ai/Response.js.map +1 -1
- package/dist/unstable/ai/Tokenizer.js +4 -5
- package/dist/unstable/ai/Tokenizer.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +38 -20
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +27 -1
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +1 -1
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +30 -18
- package/dist/unstable/ai/Toolkit.js.map +1 -1
- package/dist/unstable/ai/internal/codec-transformer.js +2 -2
- package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
- package/dist/unstable/ai/internal/structured-output.js +28 -5
- package/dist/unstable/ai/internal/structured-output.js.map +1 -1
- package/dist/unstable/arbitrary/Arbitrary.d.ts +626 -0
- package/dist/unstable/arbitrary/Arbitrary.d.ts.map +1 -0
- package/dist/unstable/arbitrary/Arbitrary.js +238 -0
- package/dist/unstable/arbitrary/Arbitrary.js.map +1 -0
- package/dist/unstable/arbitrary/index.d.ts +8 -0
- package/dist/unstable/arbitrary/index.d.ts.map +1 -0
- package/dist/unstable/arbitrary/index.js +9 -0
- package/dist/unstable/arbitrary/index.js.map +1 -0
- package/dist/unstable/cli/Argument.d.ts +104 -108
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js +56 -57
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +2 -0
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +2 -0
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/CliOutput.js +27 -4
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +73 -73
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +22 -22
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Completions.d.ts +4 -4
- package/dist/unstable/cli/Completions.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.d.ts +150 -161
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +79 -90
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +3 -3
- package/dist/unstable/cli/GlobalFlag.js +13 -13
- package/dist/unstable/cli/GlobalFlag.js.map +1 -1
- package/dist/unstable/cli/Param.d.ts +118 -126
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +104 -113
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +69 -58
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js +65 -66
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/Prompt.d.ts +113 -59
- package/dist/unstable/cli/Prompt.d.ts.map +1 -1
- package/dist/unstable/cli/Prompt.js +391 -327
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/internal/completions/bash.js +109 -38
- package/dist/unstable/cli/internal/completions/bash.js.map +1 -1
- package/dist/unstable/cli/internal/completions/descriptor.js +23 -11
- package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -1
- package/dist/unstable/cli/internal/completions/fish.js +15 -7
- package/dist/unstable/cli/internal/completions/fish.js.map +1 -1
- package/dist/unstable/cli/internal/completions/zsh.js +6 -4
- package/dist/unstable/cli/internal/completions/zsh.js.map +1 -1
- package/dist/unstable/cli/internal/config.js +4 -4
- package/dist/unstable/cli/internal/parser.js +1 -1
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cli/internal/wizard.d.ts +5 -1
- package/dist/unstable/cli/internal/wizard.d.ts.map +1 -1
- package/dist/unstable/cli/internal/wizard.js +34 -26
- package/dist/unstable/cli/internal/wizard.js.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.d.ts +13 -0
- package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.js +16 -1
- package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +57 -14
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +2 -0
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.d.ts +2 -2
- package/dist/unstable/cluster/EntityProxyServer.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts +22 -5
- package/dist/unstable/cluster/Envelope.d.ts.map +1 -1
- package/dist/unstable/cluster/Envelope.js +23 -3
- package/dist/unstable/cluster/Envelope.js.map +1 -1
- package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/HttpRunner.js +32 -13
- package/dist/unstable/cluster/HttpRunner.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +17 -5
- package/dist/unstable/cluster/Message.d.ts.map +1 -1
- package/dist/unstable/cluster/Message.js +21 -8
- package/dist/unstable/cluster/Message.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +34 -4
- package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/MessageStorage.js +33 -12
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts +5 -4
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +21 -12
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +12 -6
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +11 -5
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +56 -35
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts +1 -1
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +32 -17
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.js +23 -23
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/SocketRunner.d.ts +2 -2
- package/dist/unstable/cluster/SocketRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/SocketRunner.js +4 -3
- package/dist/unstable/cluster/SocketRunner.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +11 -8
- 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 +11 -4
- package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/internal/clusterAbandon.d.ts +5 -0
- package/dist/unstable/cluster/internal/clusterAbandon.d.ts.map +1 -0
- package/dist/unstable/cluster/internal/clusterAbandon.js +9 -0
- package/dist/unstable/cluster/internal/clusterAbandon.js.map +1 -0
- package/dist/unstable/cluster/internal/entityManager.js +10 -6
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/cluster/internal/interruptors.js +30 -1
- package/dist/unstable/cluster/internal/interruptors.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceRef.js +12 -7
- package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.js +12 -7
- package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
- package/dist/unstable/encoding/Ini.d.ts +2 -0
- package/dist/unstable/encoding/Ini.d.ts.map +1 -1
- package/dist/unstable/encoding/Ini.js +2 -0
- package/dist/unstable/encoding/Ini.js.map +1 -1
- package/dist/unstable/encoding/SchemaBinary.d.ts +273 -0
- package/dist/unstable/encoding/SchemaBinary.d.ts.map +1 -0
- package/dist/unstable/encoding/SchemaBinary.js +4573 -0
- package/dist/unstable/encoding/SchemaBinary.js.map +1 -0
- package/dist/unstable/encoding/Sse.js +1 -1
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/encoding/Toml.d.ts +2 -0
- package/dist/unstable/encoding/Toml.d.ts.map +1 -1
- package/dist/unstable/encoding/Toml.js +6 -4
- package/dist/unstable/encoding/Toml.js.map +1 -1
- package/dist/unstable/encoding/Yaml.d.ts +2 -0
- package/dist/unstable/encoding/Yaml.d.ts.map +1 -1
- package/dist/unstable/encoding/Yaml.js +16 -5
- package/dist/unstable/encoding/Yaml.js.map +1 -1
- package/dist/unstable/encoding/index.d.ts +2 -2
- package/dist/unstable/encoding/index.d.ts.map +1 -1
- package/dist/unstable/encoding/index.js +2 -2
- package/dist/unstable/encoding/index.js.map +1 -1
- package/dist/unstable/eventlog/Event.d.ts +5 -5
- package/dist/unstable/eventlog/Event.d.ts.map +1 -1
- package/dist/unstable/eventlog/Event.js +3 -3
- package/dist/unstable/eventlog/Event.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +15 -9
- package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventJournal.js +26 -12
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLog.js +13 -9
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +11 -5
- package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.js +25 -15
- package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +7 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.js +13 -3
- package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js +2 -2
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.d.ts +0 -10
- package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.js +29 -14
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +5 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/http/Cookies.d.ts +1 -45
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +2 -64
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/FetchHttpClient.js +1 -1
- package/dist/unstable/http/FetchHttpClient.js.map +1 -1
- package/dist/unstable/http/FindMyWay/internal/router.js +124 -33
- package/dist/unstable/http/FindMyWay/internal/router.js.map +1 -1
- package/dist/unstable/http/FindMyWay.d.ts +15 -5
- package/dist/unstable/http/FindMyWay.d.ts.map +1 -1
- package/dist/unstable/http/FindMyWay.js +3 -1
- package/dist/unstable/http/FindMyWay.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts +0 -22
- package/dist/unstable/http/Headers.d.ts.map +1 -1
- package/dist/unstable/http/Headers.js +3 -34
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpBody.d.ts +41 -10
- package/dist/unstable/http/HttpBody.d.ts.map +1 -1
- package/dist/unstable/http/HttpBody.js +64 -10
- package/dist/unstable/http/HttpBody.js.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts +1 -1
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +28 -18
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts +28 -6
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +8 -19
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts +6 -1
- package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientResponse.js +10 -6
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts +16 -0
- package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
- package/dist/unstable/http/HttpEffect.js +121 -65
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.d.ts +3 -3
- package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js +1 -13
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +29 -21
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpPlatform.d.ts +12 -11
- package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
- package/dist/unstable/http/HttpPlatform.js +36 -10
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +5 -1
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +22 -8
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServer.d.ts +11 -42
- package/dist/unstable/http/HttpServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpServer.js +16 -20
- package/dist/unstable/http/HttpServer.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +11 -11
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.js +1 -1
- package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +9 -13
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +34 -44
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpStaticServer.d.ts +2 -2
- package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpStaticServer.js +19 -19
- package/dist/unstable/http/HttpStaticServer.js.map +1 -1
- package/dist/unstable/http/Mime.d.ts +28 -0
- package/dist/unstable/http/Mime.d.ts.map +1 -0
- package/dist/unstable/http/Mime.js +72 -0
- package/dist/unstable/http/Mime.js.map +1 -0
- package/dist/unstable/http/Multipart.d.ts +22 -9
- package/dist/unstable/http/Multipart.d.ts.map +1 -1
- package/dist/unstable/http/Multipart.js +26 -10
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/MultipartParser/internal/multipart.d.ts +1 -1
- package/dist/unstable/http/MultipartParser/internal/multipart.d.ts.map +1 -1
- package/dist/unstable/http/MultipartParser/internal/multipart.js +8 -3
- package/dist/unstable/http/MultipartParser/internal/multipart.js.map +1 -1
- package/dist/unstable/http/MultipartParser.d.ts +4 -3
- package/dist/unstable/http/MultipartParser.d.ts.map +1 -1
- package/dist/unstable/http/MultipartParser.js.map +1 -1
- package/dist/unstable/http/UrlParams.d.ts +0 -97
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +3 -104
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/http/index.d.ts +4 -0
- package/dist/unstable/http/index.d.ts.map +1 -1
- package/dist/unstable/http/index.js +4 -0
- package/dist/unstable/http/index.js.map +1 -1
- package/dist/unstable/http/internal/compression.js +8 -11
- package/dist/unstable/http/internal/compression.js.map +1 -1
- package/dist/unstable/http/internal/headers.d.ts +2 -0
- package/dist/unstable/http/internal/headers.d.ts.map +1 -0
- package/dist/unstable/http/internal/headers.js +5 -0
- package/dist/unstable/http/internal/headers.js.map +1 -0
- package/dist/unstable/http/internal/httpBody.js +8 -0
- package/dist/unstable/http/internal/httpBody.js.map +1 -1
- package/dist/unstable/http/internal/mimeTypes.d.ts +361 -0
- package/dist/unstable/http/internal/mimeTypes.d.ts.map +1 -0
- package/dist/unstable/http/internal/mimeTypes.js +363 -0
- package/dist/unstable/http/internal/mimeTypes.js.map +1 -0
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +13 -0
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +28 -11
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +4 -3
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +25 -13
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +8 -3
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.js +9 -6
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.js +3 -1
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js +7 -5
- package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.js +15 -12
- package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +12 -0
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.js +8 -10
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.js +6 -3
- package/dist/unstable/httpapi/HttpApiSwagger.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiTest.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiTest.js +8 -2
- package/dist/unstable/httpapi/HttpApiTest.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +31 -20
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/net/IpInterface.d.ts +140 -0
- package/dist/unstable/net/IpInterface.d.ts.map +1 -0
- package/dist/unstable/net/IpInterface.js +149 -0
- package/dist/unstable/net/IpInterface.js.map +1 -0
- package/dist/unstable/net/IpNetwork.d.ts +227 -0
- package/dist/unstable/net/IpNetwork.d.ts.map +1 -0
- package/dist/unstable/net/IpNetwork.js +239 -0
- package/dist/unstable/net/IpNetwork.js.map +1 -0
- package/dist/unstable/net/NetAddress.d.ts +705 -0
- package/dist/unstable/net/NetAddress.d.ts.map +1 -0
- package/dist/unstable/net/NetAddress.js +956 -0
- package/dist/unstable/net/NetAddress.js.map +1 -0
- package/dist/unstable/net/index.d.ts +16 -0
- package/dist/unstable/net/index.d.ts.map +1 -0
- package/dist/unstable/net/index.js +17 -0
- package/dist/unstable/net/index.js.map +1 -0
- package/dist/unstable/observability/OtlpExporter.d.ts +1 -0
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +4 -6
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js +9 -9
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.js +9 -8
- package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
- package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpResource.js +2 -2
- package/dist/unstable/observability/OtlpResource.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js +82 -55
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/observability/internal/otlpEnv.d.ts +1 -1
- package/dist/unstable/observability/internal/otlpEnv.d.ts.map +1 -1
- package/dist/unstable/observability/internal/otlpEnv.js +5 -9
- package/dist/unstable/observability/internal/otlpEnv.js.map +1 -1
- package/dist/unstable/persistence/PersistedCache.js +1 -1
- package/dist/unstable/persistence/PersistedCache.js.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts +114 -14
- package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.js +799 -234
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +28 -15
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +33 -41
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/process/ChildProcess.d.ts +8 -2
- package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcess.js +7 -2
- package/dist/unstable/process/ChildProcess.js.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.d.ts +1 -1
- package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +6 -3
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +3 -6
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.js +6 -3
- package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +2 -3
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts +2 -2
- package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.js +1 -1
- package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
- package/dist/unstable/reactivity/Hydration.d.ts +6 -4
- package/dist/unstable/reactivity/Hydration.d.ts.map +1 -1
- package/dist/unstable/reactivity/Hydration.js +20 -6
- package/dist/unstable/reactivity/Hydration.js.map +1 -1
- package/dist/unstable/reactivity/Reactivity.d.ts +26 -26
- package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
- package/dist/unstable/reactivity/Reactivity.js +10 -12
- package/dist/unstable/reactivity/Reactivity.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts +5 -0
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +94 -81
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcClientError.d.ts +1 -1
- package/dist/unstable/rpc/RpcMessage.d.ts +66 -7
- package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMessage.js +68 -9
- package/dist/unstable/rpc/RpcMessage.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js +7 -5
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts +28 -33
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +56 -92
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +25 -0
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +125 -68
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js +7 -6
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.js +3 -0
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +287 -102
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +408 -215
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/socket/SocketServer.d.ts +5 -32
- package/dist/unstable/socket/SocketServer.d.ts.map +1 -1
- package/dist/unstable/socket/SocketServer.js +3 -3
- package/dist/unstable/socket/SocketServer.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts +20 -0
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +14 -7
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/sql/SqlConnection.d.ts +15 -0
- package/dist/unstable/sql/SqlConnection.d.ts.map +1 -1
- package/dist/unstable/sql/SqlConnection.js.map +1 -1
- package/dist/unstable/sql/SqlModel.d.ts +1 -1
- package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.d.ts +13 -5
- package/dist/unstable/sql/Statement.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.js +29 -15
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/workers/Transferable.js +1 -1
- package/dist/unstable/workers/Worker.d.ts.map +1 -1
- package/dist/unstable/workers/Worker.js +3 -1
- package/dist/unstable/workers/Worker.js.map +1 -1
- package/dist/unstable/workflow/Activity.d.ts +7 -0
- package/dist/unstable/workflow/Activity.d.ts.map +1 -1
- package/dist/unstable/workflow/Activity.js +14 -4
- package/dist/unstable/workflow/Activity.js.map +1 -1
- package/dist/unstable/workflow/DurableClock.js +1 -1
- package/dist/unstable/workflow/DurableClock.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts +2 -2
- package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/DurableQueue.d.ts +8 -0
- package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableQueue.js +8 -0
- package/dist/unstable/workflow/DurableQueue.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +5 -0
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js +70 -12
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +6 -0
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +11 -0
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.d.ts +2 -2
- package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.js +4 -2
- package/dist/unstable/workflow/WorkflowProxy.js.map +1 -1
- package/package.json +8 -10
- package/src/Array.ts +142 -70
- package/src/BigDecimal.ts +50 -28
- package/src/ByteSize.ts +838 -0
- package/src/Cache.ts +17 -3
- package/src/Cause.ts +1 -1
- package/src/Channel.ts +185 -50
- package/src/Chunk.ts +65 -36
- package/src/Config.ts +237 -248
- package/src/ConfigProvider.ts +7 -8
- package/src/Context.ts +31 -0
- package/src/Cron.ts +2 -2
- package/src/Crypto.ts +3 -2
- package/src/Deferred.ts +7 -6
- package/src/Duration.ts +1 -1
- package/src/Effect.ts +226 -122
- package/src/Effectable.ts +78 -9
- package/src/Encoding.ts +101 -11
- package/src/Equal.ts +1 -1
- package/src/ExecutionPlan.ts +3 -0
- package/src/Fiber.ts +33 -8
- package/src/FiberHandle.ts +3 -3
- package/src/FiberMap.ts +19 -10
- package/src/FileSystem.ts +55 -230
- package/src/Formatter.ts +21 -3
- package/src/Graph.ts +55 -25
- package/src/Hash.ts +5 -16
- package/src/HashRing.ts +9 -2
- package/src/HashSet.ts +56 -0
- package/src/Iterable.ts +90 -44
- package/src/JsonPatch.ts +4 -4
- package/src/JsonPointer.ts +97 -4
- package/src/JsonSchema.ts +998 -476
- package/src/Layer.ts +59 -18
- package/src/LayerMap.ts +38 -6
- package/src/LayerRef.ts +7 -5
- package/src/Logger.ts +125 -18
- package/src/ManagedRuntime.ts +1 -1
- package/src/Match.ts +33 -14
- package/src/Metric.ts +24 -21
- package/src/MutableHashMap.ts +1 -1
- package/src/MutableHashSet.ts +1 -1
- package/src/MutableList.ts +18 -2
- package/src/Number.ts +7 -1
- package/src/Optic.ts +8 -4
- package/src/Option.ts +1 -1
- package/src/Order.ts +3 -1
- package/src/PartitionedSemaphore.ts +1 -2
- package/src/Path.ts +1 -1
- package/src/PlatformError.ts +1 -1
- package/src/Pool.ts +535 -134
- package/src/PrimaryKey.ts +1 -1
- package/src/PubSub.ts +32 -20
- package/src/Queue.ts +119 -28
- package/src/Random.ts +20 -6
- package/src/RcMap.ts +176 -13
- package/src/Record.ts +15 -0
- package/src/Redacted.ts +1 -1
- package/src/RequestResolver.ts +49 -26
- package/src/Result.ts +1 -1
- package/src/Scheduler.ts +21 -11
- package/src/Schema.ts +5032 -6518
- package/src/SchemaAST.ts +1156 -316
- package/src/SchemaGetter.ts +75 -21
- package/src/SchemaIssue.ts +260 -16
- package/src/SchemaParser.ts +2 -12
- package/src/SchemaRepresentation.ts +1774 -189
- package/src/SchemaTransformation.ts +145 -22
- package/src/Scope.ts +9 -2
- package/src/ScopedCache.ts +10 -3
- package/src/Sink.ts +31 -15
- package/src/StandardSchema.ts +207 -0
- package/src/Stream.ts +294 -76
- package/src/String.ts +20 -9
- package/src/Struct.ts +8 -4
- package/src/SynchronizedRef.ts +3 -5
- package/src/Terminal.ts +3 -3
- package/src/Tracer.ts +43 -14
- package/src/Tuple.ts +3 -1
- package/src/TxChunk.ts +1 -1
- package/src/TxDeferred.ts +1 -1
- package/src/TxHashMap.ts +1 -1
- package/src/TxHashSet.ts +92 -11
- package/src/TxPriorityQueue.ts +1 -1
- package/src/TxPubSub.ts +1 -1
- package/src/TxQueue.ts +22 -17
- package/src/TxReentrantLock.ts +29 -1
- package/src/TxRef.ts +1 -1
- package/src/TxSemaphore.ts +1 -1
- package/src/TxSubscriptionRef.ts +1 -1
- package/src/Types.ts +40 -17
- package/src/Utils.ts +3 -1
- package/src/index.ts +10 -0
- package/src/internal/arbitrary/model.ts +701 -0
- package/src/internal/arbitrary/regexp.ts +855 -0
- package/src/internal/arbitrary/runner.ts +608 -0
- package/src/internal/arbitrary/schema.ts +1800 -0
- package/src/internal/core.ts +48 -22
- package/src/internal/count.ts +14 -0
- package/src/internal/dateTime.ts +8 -10
- package/src/internal/effect.ts +510 -301
- package/src/internal/graph.ts +6 -1
- package/src/internal/hashMap.ts +5 -3
- package/src/internal/hashSet.ts +1 -1
- package/src/internal/matcher.ts +34 -19
- package/src/internal/metric.ts +1 -1
- package/src/internal/option.ts +8 -6
- package/src/internal/random.ts +20 -7
- package/src/internal/rcRef.ts +10 -7
- package/src/internal/references.ts +1 -0
- package/src/internal/request.ts +12 -7
- package/src/internal/result.ts +15 -11
- package/src/internal/schema/annotations.ts +3 -3
- package/src/internal/schema/fromJsonSchemaDocument.ts +326 -160
- package/src/internal/schema/fromRepresentation.ts +5 -3
- package/src/internal/schema/{schema.ts → make.ts} +0 -40
- package/src/internal/schema/parser.ts +8 -0
- package/src/internal/schema/standardSchema.ts +125 -0
- package/src/internal/schema/toCodeDocument.ts +58 -44
- package/src/internal/schema/toCodec.ts +312 -0
- package/src/internal/schema/toDifferJsonPatch.ts +24 -0
- package/src/internal/schema/toEncoderXml.ts +110 -0
- package/src/internal/schema/toEquivalence.ts +76 -0
- package/src/internal/schema/toFormatter.ts +230 -0
- package/src/internal/schema/toIso.ts +20 -0
- package/src/internal/schema/toJsonSchemaDocument.ts +125 -67
- package/src/internal/schema/toRepresentation.ts +1 -1
- package/src/internal/schemaError.ts +8 -0
- package/src/internal/stream.ts +14 -6
- package/src/internal/tracer.ts +4 -0
- package/src/internal/trie.ts +5 -2
- package/src/internal/uuid.ts +4 -0
- package/src/testing/TestSchema.ts +36 -30
- package/src/testing/index.ts +0 -5
- package/src/unstable/ai/AiError.ts +126 -6
- package/src/unstable/ai/AnthropicStructuredOutput.ts +8 -5
- package/src/unstable/ai/Chat.ts +35 -36
- package/src/unstable/ai/EmbeddingModel.ts +27 -15
- package/src/unstable/ai/LanguageModel.ts +283 -100
- package/src/unstable/ai/McpServer.ts +105 -92
- package/src/unstable/ai/OpenAiStructuredOutput.ts +6 -3
- package/src/unstable/ai/Prompt.ts +20 -5
- package/src/unstable/ai/Response.ts +107 -189
- package/src/unstable/ai/Tokenizer.ts +4 -5
- package/src/unstable/ai/Tool.ts +58 -35
- package/src/unstable/ai/Toolkit.ts +43 -37
- package/src/unstable/ai/internal/codec-transformer.ts +3 -2
- package/src/unstable/ai/internal/structured-output.ts +29 -6
- package/src/unstable/arbitrary/Arbitrary.ts +715 -0
- package/src/unstable/arbitrary/index.ts +10 -0
- package/src/unstable/cli/Argument.ts +111 -115
- package/src/unstable/cli/CliError.ts +2 -0
- package/src/unstable/cli/CliOutput.ts +41 -4
- package/src/unstable/cli/Command.ts +79 -78
- package/src/unstable/cli/Completions.ts +4 -4
- package/src/unstable/cli/Flag.ts +158 -169
- package/src/unstable/cli/GlobalFlag.ts +13 -13
- package/src/unstable/cli/Param.ts +150 -159
- package/src/unstable/cli/Primitive.ts +75 -76
- package/src/unstable/cli/Prompt.ts +543 -408
- package/src/unstable/cli/internal/completions/bash.ts +113 -38
- package/src/unstable/cli/internal/completions/descriptor.ts +23 -11
- package/src/unstable/cli/internal/completions/fish.ts +17 -9
- package/src/unstable/cli/internal/completions/zsh.ts +7 -4
- package/src/unstable/cli/internal/config.ts +4 -4
- package/src/unstable/cli/internal/parser.ts +1 -1
- package/src/unstable/cli/internal/wizard.ts +60 -32
- package/src/unstable/cluster/ClusterSchema.ts +19 -1
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +66 -16
- package/src/unstable/cluster/Entity.ts +3 -0
- package/src/unstable/cluster/EntityProxyServer.ts +6 -2
- package/src/unstable/cluster/Envelope.ts +32 -3
- package/src/unstable/cluster/HttpRunner.ts +52 -25
- package/src/unstable/cluster/Message.ts +35 -13
- package/src/unstable/cluster/MessageStorage.ts +69 -24
- package/src/unstable/cluster/Reply.ts +36 -19
- package/src/unstable/cluster/RunnerServer.ts +21 -11
- package/src/unstable/cluster/Runners.ts +93 -80
- package/src/unstable/cluster/Sharding.ts +44 -19
- package/src/unstable/cluster/ShardingConfig.ts +23 -23
- package/src/unstable/cluster/SocketRunner.ts +5 -4
- package/src/unstable/cluster/SqlMessageStorage.ts +12 -8
- package/src/unstable/cluster/SqlRunnerStorage.ts +18 -10
- package/src/unstable/cluster/internal/clusterAbandon.ts +14 -0
- package/src/unstable/cluster/internal/entityManager.ts +15 -6
- package/src/unstable/cluster/internal/interruptors.ts +58 -1
- package/src/unstable/cluster/internal/resourceRef.ts +15 -7
- package/src/unstable/devtools/DevToolsClient.ts +13 -3
- package/src/unstable/encoding/Ini.ts +2 -0
- package/src/unstable/encoding/SchemaBinary.ts +5308 -0
- package/src/unstable/encoding/Sse.ts +1 -1
- package/src/unstable/encoding/Toml.ts +7 -5
- package/src/unstable/encoding/Yaml.ts +18 -5
- package/src/unstable/encoding/index.ts +2 -2
- package/src/unstable/eventlog/Event.ts +7 -7
- package/src/unstable/eventlog/EventJournal.ts +22 -15
- package/src/unstable/eventlog/EventLog.ts +24 -14
- package/src/unstable/eventlog/EventLogMessage.ts +25 -15
- package/src/unstable/eventlog/EventLogRemote.ts +15 -4
- package/src/unstable/eventlog/EventLogServerUnencrypted.ts +2 -2
- package/src/unstable/eventlog/SqlEventJournal.ts +35 -10
- package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +11 -1
- package/src/unstable/http/Cookies.ts +2 -102
- package/src/unstable/http/FetchHttpClient.ts +1 -1
- package/src/unstable/http/FindMyWay/internal/router.ts +139 -33
- package/src/unstable/http/FindMyWay.ts +15 -5
- package/src/unstable/http/Headers.ts +3 -48
- package/src/unstable/http/HttpBody.ts +107 -36
- package/src/unstable/http/HttpClient.ts +41 -30
- package/src/unstable/http/HttpClientRequest.ts +32 -18
- package/src/unstable/http/HttpClientResponse.ts +16 -3
- package/src/unstable/http/HttpEffect.ts +145 -73
- package/src/unstable/http/HttpIncomingMessage.ts +4 -4
- package/src/unstable/http/HttpMiddleware.ts +43 -24
- package/src/unstable/http/HttpPlatform.ts +62 -20
- package/src/unstable/http/HttpRouter.ts +27 -16
- package/src/unstable/http/HttpServer.ts +18 -57
- package/src/unstable/http/HttpServerRequest.ts +17 -15
- package/src/unstable/http/HttpServerRespondable.ts +1 -1
- package/src/unstable/http/HttpServerResponse.ts +49 -40
- package/src/unstable/http/HttpStaticServer.ts +30 -28
- package/src/unstable/http/Mime.ts +76 -0
- package/src/unstable/http/Multipart.ts +35 -18
- package/src/unstable/http/MultipartParser/internal/multipart.ts +10 -3
- package/src/unstable/http/MultipartParser.ts +4 -3
- package/src/unstable/http/UrlParams.ts +3 -161
- package/src/unstable/http/index.ts +5 -0
- package/src/unstable/http/internal/compression.ts +11 -12
- package/src/unstable/http/internal/headers.ts +7 -0
- package/src/unstable/http/internal/httpBody.ts +9 -0
- package/src/unstable/http/internal/mimeTypes.ts +395 -0
- package/src/unstable/httpapi/HttpApiBuilder.ts +63 -11
- package/src/unstable/httpapi/HttpApiClient.ts +44 -24
- package/src/unstable/httpapi/HttpApiEndpoint.ts +24 -11
- package/src/unstable/httpapi/HttpApiError.ts +3 -1
- package/src/unstable/httpapi/HttpApiMiddleware.ts +7 -5
- package/src/unstable/httpapi/HttpApiScalar.ts +30 -27
- package/src/unstable/httpapi/HttpApiSchema.ts +14 -7
- package/src/unstable/httpapi/HttpApiSwagger.ts +6 -3
- package/src/unstable/httpapi/HttpApiTest.ts +6 -1
- package/src/unstable/httpapi/OpenApi.ts +32 -22
- package/src/unstable/net/IpInterface.ts +242 -0
- package/src/unstable/net/IpNetwork.ts +357 -0
- package/src/unstable/net/NetAddress.ts +1271 -0
- package/src/unstable/net/index.ts +20 -0
- package/src/unstable/observability/OtlpExporter.ts +5 -6
- package/src/unstable/observability/OtlpLogger.ts +9 -9
- package/src/unstable/observability/OtlpMetrics.ts +9 -8
- package/src/unstable/observability/OtlpResource.ts +5 -4
- package/src/unstable/observability/OtlpTracer.ts +103 -81
- package/src/unstable/observability/internal/otlpEnv.ts +10 -13
- package/src/unstable/persistence/PersistedCache.ts +1 -1
- package/src/unstable/persistence/PersistedQueue.ts +1100 -291
- package/src/unstable/persistence/RateLimiter.ts +64 -58
- package/src/unstable/process/ChildProcess.ts +15 -4
- package/src/unstable/process/ChildProcessSpawner.ts +1 -1
- package/src/unstable/reactivity/Atom.ts +6 -3
- package/src/unstable/reactivity/AtomHttpApi.ts +21 -10
- package/src/unstable/reactivity/AtomRegistry.ts +2 -4
- package/src/unstable/reactivity/AtomRpc.ts +6 -5
- package/src/unstable/reactivity/Hydration.ts +26 -7
- package/src/unstable/reactivity/Reactivity.ts +49 -36
- package/src/unstable/rpc/RpcClient.ts +100 -82
- package/src/unstable/rpc/RpcMessage.ts +78 -11
- package/src/unstable/rpc/RpcMiddleware.ts +7 -5
- package/src/unstable/rpc/RpcSerialization.ts +82 -92
- package/src/unstable/rpc/RpcServer.ts +171 -93
- package/src/unstable/schema/Model.ts +8 -7
- package/src/unstable/schema/VariantSchema.ts +3 -0
- package/src/unstable/socket/Socket.ts +714 -383
- package/src/unstable/socket/SocketServer.ts +5 -35
- package/src/unstable/sql/SqlClient.ts +42 -7
- package/src/unstable/sql/SqlConnection.ts +18 -0
- package/src/unstable/sql/SqlModel.ts +1 -1
- package/src/unstable/sql/Statement.ts +46 -20
- package/src/unstable/workers/Transferable.ts +1 -1
- package/src/unstable/workers/Worker.ts +3 -1
- package/src/unstable/workflow/Activity.ts +20 -9
- package/src/unstable/workflow/DurableClock.ts +1 -1
- package/src/unstable/workflow/DurableDeferred.ts +6 -0
- package/src/unstable/workflow/DurableQueue.ts +8 -0
- package/src/unstable/workflow/Workflow.ts +105 -28
- package/src/unstable/workflow/WorkflowEngine.ts +22 -0
- package/src/unstable/workflow/WorkflowProxy.ts +8 -4
- package/dist/internal/schema/schema.d.ts.map +0 -1
- package/dist/internal/schema/schema.js.map +0 -1
- package/dist/internal/schema/toArbitrary.d.ts +0 -2
- package/dist/internal/schema/toArbitrary.d.ts.map +0 -1
- package/dist/internal/schema/toArbitrary.js +0 -705
- package/dist/internal/schema/toArbitrary.js.map +0 -1
- package/dist/testing/FastCheck.d.ts +0 -90
- package/dist/testing/FastCheck.d.ts.map +0 -1
- package/dist/testing/FastCheck.js +0 -90
- package/dist/testing/FastCheck.js.map +0 -1
- package/dist/unstable/encoding/Msgpack.d.ts +0 -185
- package/dist/unstable/encoding/Msgpack.d.ts.map +0 -1
- package/dist/unstable/encoding/Msgpack.js +0 -227
- package/dist/unstable/encoding/Msgpack.js.map +0 -1
- package/src/internal/schema/toArbitrary.ts +0 -843
- package/src/testing/FastCheck.ts +0 -90
- package/src/unstable/encoding/Msgpack.ts +0 -432
- /package/dist/internal/{schema → arbitrary}/schema.d.ts +0 -0
package/src/internal/effect.ts
CHANGED
|
@@ -18,7 +18,6 @@ import * as Iterable from "../Iterable.ts"
|
|
|
18
18
|
import type * as _Latch from "../Latch.ts"
|
|
19
19
|
import type * as Logger from "../Logger.ts"
|
|
20
20
|
import type * as LogLevel from "../LogLevel.ts"
|
|
21
|
-
import type * as Metric from "../Metric.ts"
|
|
22
21
|
import * as Option from "../Option.ts"
|
|
23
22
|
import * as Order from "../Order.ts"
|
|
24
23
|
import { pipeArguments } from "../Pipeable.ts"
|
|
@@ -105,7 +104,7 @@ import { addSpanStackTrace, makeStackCleaner } from "./tracer.ts"
|
|
|
105
104
|
|
|
106
105
|
/** @internal */
|
|
107
106
|
export class Interrupt extends ReasonBase<"Interrupt"> implements Cause.Interrupt {
|
|
108
|
-
readonly fiberId: number | undefined
|
|
107
|
+
declare readonly fiberId: number | undefined
|
|
109
108
|
constructor(
|
|
110
109
|
fiberId: number | undefined,
|
|
111
110
|
annotations = constEmptyAnnotations
|
|
@@ -238,6 +237,29 @@ export const causeAnnotations = <E>(
|
|
|
238
237
|
return Context.makeUnsafe(map)
|
|
239
238
|
}
|
|
240
239
|
|
|
240
|
+
const dedupeReasons = <E>(
|
|
241
|
+
self: ReadonlyArray<Cause.Reason<E>>,
|
|
242
|
+
that: ReadonlyArray<Cause.Reason<E>>
|
|
243
|
+
): Array<Cause.Reason<E>> => {
|
|
244
|
+
// Keep deduplication local so causeCombine does not retain Array.ts in the core bundle.
|
|
245
|
+
// Snapshot both arrays before invoking user-defined hash or equality methods.
|
|
246
|
+
const buckets = new Map<number, Array<Cause.Reason<E>>>()
|
|
247
|
+
const out: Array<Cause.Reason<E>> = []
|
|
248
|
+
for (const reason of self.concat(that)) {
|
|
249
|
+
const hash = Hash.hash(reason)
|
|
250
|
+
const bucket = buckets.get(hash)
|
|
251
|
+
if (bucket === undefined) {
|
|
252
|
+
buckets.set(hash, [reason])
|
|
253
|
+
} else if (bucket.some((previous) => Equal.equals(previous, reason))) {
|
|
254
|
+
continue
|
|
255
|
+
} else {
|
|
256
|
+
bucket.push(reason)
|
|
257
|
+
}
|
|
258
|
+
out.push(reason)
|
|
259
|
+
}
|
|
260
|
+
return out
|
|
261
|
+
}
|
|
262
|
+
|
|
241
263
|
/** @internal */
|
|
242
264
|
export const causeCombine: {
|
|
243
265
|
<E2>(that: Cause.Cause<E2>): <E>(self: Cause.Cause<E>) => Cause.Cause<E | E2>
|
|
@@ -251,7 +273,7 @@ export const causeCombine: {
|
|
|
251
273
|
return self as Cause.Cause<E | E2>
|
|
252
274
|
}
|
|
253
275
|
const newCause = new CauseImpl<E | E2>(
|
|
254
|
-
|
|
276
|
+
dedupeReasons<E | E2>(self.reasons, that.reasons)
|
|
255
277
|
)
|
|
256
278
|
return Equal.equals(self, newCause) ? self : newCause
|
|
257
279
|
}
|
|
@@ -317,7 +339,7 @@ export const causePrettyErrors = <E>(self: Cause.Cause<E>, options?: {
|
|
|
317
339
|
if (self.reasons.length === 0) return errors
|
|
318
340
|
|
|
319
341
|
const prevStackLimit = getStackTraceLimit()
|
|
320
|
-
setStackTraceLimit(1)
|
|
342
|
+
if (prevStackLimit !== 0) setStackTraceLimit(1)
|
|
321
343
|
|
|
322
344
|
for (const failure of self.reasons) {
|
|
323
345
|
if (failure._tag === "Interrupt") {
|
|
@@ -342,7 +364,7 @@ export const causePrettyErrors = <E>(self: Cause.Cause<E>, options?: {
|
|
|
342
364
|
errors.push(causePrettyError(error, interrupts[0].annotations, options))
|
|
343
365
|
}
|
|
344
366
|
|
|
345
|
-
setStackTraceLimit(prevStackLimit)
|
|
367
|
+
if (prevStackLimit !== 0) setStackTraceLimit(prevStackLimit)
|
|
346
368
|
return errors
|
|
347
369
|
}
|
|
348
370
|
|
|
@@ -513,14 +535,15 @@ export class FiberImpl<A = any, E = any> implements Fiber.Fiber<A, E> {
|
|
|
513
535
|
this.currentOpCount = 0
|
|
514
536
|
this.interruptible = interruptible
|
|
515
537
|
this._stack = []
|
|
516
|
-
this._observers =
|
|
538
|
+
this._observers = undefined
|
|
517
539
|
this._exit = undefined
|
|
518
540
|
this._children = undefined
|
|
519
541
|
this._interruptedCause = undefined
|
|
520
542
|
this._yielded = undefined
|
|
521
543
|
this._running = false
|
|
522
544
|
this._deferredInterrupt = false
|
|
523
|
-
this.
|
|
545
|
+
this._parent = undefined
|
|
546
|
+
this.cache.runtimeMetrics?.recordFiberStart(this.context)
|
|
524
547
|
}
|
|
525
548
|
|
|
526
549
|
readonly [FiberTypeId]: Fiber.Fiber.Variance<A, E>
|
|
@@ -529,29 +552,22 @@ export class FiberImpl<A = any, E = any> implements Fiber.Fiber<A, E> {
|
|
|
529
552
|
interruptible: boolean
|
|
530
553
|
currentOpCount: number
|
|
531
554
|
readonly _stack: Array<Primitive>
|
|
532
|
-
|
|
555
|
+
_observers: Array<(exit: Exit.Exit<A, E>) => void> | undefined
|
|
533
556
|
_exit: Exit.Exit<A, E> | undefined
|
|
534
557
|
_children: Set<FiberImpl<any, any>> | undefined
|
|
535
558
|
_interruptedCause: Cause.Cause<never> | undefined
|
|
536
559
|
_yielded: Exit.Exit<any, any> | (() => void) | undefined
|
|
537
560
|
_running: boolean
|
|
538
561
|
_deferredInterrupt: boolean
|
|
562
|
+
_parent: FiberImpl<any, any> | undefined
|
|
539
563
|
|
|
540
564
|
// set in setContext
|
|
541
565
|
context!: Context.Context<never>
|
|
542
|
-
|
|
543
|
-
currentTracerContext: Tracer.Tracer["context"]
|
|
544
|
-
currentSpan: Tracer.AnySpan | undefined
|
|
545
|
-
currentLogLevel!: LogLevel.LogLevel
|
|
546
|
-
minimumLogLevel!: LogLevel.LogLevel
|
|
547
|
-
currentStackFrame: StackFrame | undefined
|
|
548
|
-
runtimeMetrics: Metric.FiberRuntimeMetricsService | undefined
|
|
549
|
-
maxOpsBeforeYield!: number
|
|
550
|
-
currentPreventYield!: boolean
|
|
566
|
+
cache!: Fiber.Fiber.Cache
|
|
551
567
|
|
|
552
568
|
_dispatcher: Scheduler.SchedulerDispatcher | undefined = undefined
|
|
553
569
|
get currentDispatcher(): Scheduler.SchedulerDispatcher {
|
|
554
|
-
return this._dispatcher ??= this.
|
|
570
|
+
return this._dispatcher ??= this.cache.scheduler.makeDispatcher()
|
|
555
571
|
}
|
|
556
572
|
|
|
557
573
|
getRef<X>(ref: Context.Reference<X>): X {
|
|
@@ -562,9 +578,13 @@ export class FiberImpl<A = any, E = any> implements Fiber.Fiber<A, E> {
|
|
|
562
578
|
cb(this._exit)
|
|
563
579
|
return constVoid
|
|
564
580
|
}
|
|
565
|
-
this._observers
|
|
581
|
+
if (this._observers === undefined) {
|
|
582
|
+
this._observers = [cb]
|
|
583
|
+
} else {
|
|
584
|
+
this._observers.push(cb)
|
|
585
|
+
}
|
|
566
586
|
return () => {
|
|
567
|
-
if (this._exit) return
|
|
587
|
+
if (this._exit || this._observers === undefined) return
|
|
568
588
|
const index = this._observers.indexOf(cb)
|
|
569
589
|
if (index >= 0) {
|
|
570
590
|
this._observers.splice(index, 1)
|
|
@@ -576,8 +596,8 @@ export class FiberImpl<A = any, E = any> implements Fiber.Fiber<A, E> {
|
|
|
576
596
|
return
|
|
577
597
|
}
|
|
578
598
|
let cause = causeInterrupt(fiberId)
|
|
579
|
-
if (this.
|
|
580
|
-
cause = causeAnnotate(cause, Context.make(CauseStackTrace, this.
|
|
599
|
+
if (this.cache.stackFrame) {
|
|
600
|
+
cause = causeAnnotate(cause, Context.make(CauseStackTrace, this.cache.stackFrame))
|
|
581
601
|
}
|
|
582
602
|
if (annotations) {
|
|
583
603
|
cause = causeAnnotate(cause, annotations)
|
|
@@ -617,11 +637,18 @@ export class FiberImpl<A = any, E = any> implements Fiber.Fiber<A, E> {
|
|
|
617
637
|
}
|
|
618
638
|
|
|
619
639
|
this._exit = exit
|
|
620
|
-
this.runtimeMetrics?.recordFiberEnd(this.context, this._exit)
|
|
621
|
-
|
|
622
|
-
this.
|
|
640
|
+
this.cache.runtimeMetrics?.recordFiberEnd(this.context, this._exit)
|
|
641
|
+
if (this._parent) {
|
|
642
|
+
this._parent._children?.delete(this)
|
|
643
|
+
this._parent = undefined
|
|
644
|
+
}
|
|
645
|
+
if (this._observers !== undefined) {
|
|
646
|
+
const observers = this._observers
|
|
647
|
+
this._observers = undefined
|
|
648
|
+
for (let i = 0; i < observers.length; i++) {
|
|
649
|
+
observers[i](exit)
|
|
650
|
+
}
|
|
623
651
|
}
|
|
624
|
-
this._observers.length = 0
|
|
625
652
|
this._stack.length = 0
|
|
626
653
|
this._children = undefined
|
|
627
654
|
this.context = Context.empty()
|
|
@@ -641,17 +668,19 @@ export class FiberImpl<A = any, E = any> implements Fiber.Fiber<A, E> {
|
|
|
641
668
|
current = failCause(this._interruptedCause!) as any
|
|
642
669
|
}
|
|
643
670
|
this.currentOpCount++
|
|
671
|
+
// Refresh the cache because a primitive can replace the fiber context.
|
|
672
|
+
const cache = this.cache
|
|
644
673
|
if (
|
|
645
674
|
!yielding &&
|
|
646
|
-
!
|
|
647
|
-
|
|
675
|
+
!cache.preventYield &&
|
|
676
|
+
cache.scheduler.shouldYield(this as any)
|
|
648
677
|
) {
|
|
649
678
|
yielding = true
|
|
650
679
|
const prev = current
|
|
651
680
|
current = flatMap(yieldNow, () => prev as any) as any
|
|
652
681
|
}
|
|
653
|
-
current =
|
|
654
|
-
?
|
|
682
|
+
current = cache.tracerContext
|
|
683
|
+
? cache.tracerContext(current as any, this)
|
|
655
684
|
: (current as any)[evaluate](this)
|
|
656
685
|
if (current === Yield) {
|
|
657
686
|
const yielded = this._yielded!
|
|
@@ -688,10 +717,13 @@ export class FiberImpl<A = any, E = any> implements Fiber.Fiber<A, E> {
|
|
|
688
717
|
while (true) {
|
|
689
718
|
const op = this._stack.pop()
|
|
690
719
|
if (!op) return undefined
|
|
691
|
-
const
|
|
692
|
-
if (
|
|
693
|
-
|
|
694
|
-
|
|
720
|
+
const all = op[contAll]
|
|
721
|
+
if (all !== undefined) {
|
|
722
|
+
const cont = all.call(op, this)
|
|
723
|
+
if (cont) {
|
|
724
|
+
;(cont as any)[symbol] = cont
|
|
725
|
+
return cont as any
|
|
726
|
+
}
|
|
695
727
|
}
|
|
696
728
|
if (op[symbol]) return op as any
|
|
697
729
|
}
|
|
@@ -712,25 +744,38 @@ export class FiberImpl<A = any, E = any> implements Fiber.Fiber<A, E> {
|
|
|
712
744
|
// Every key cached below opts in to Context caching, so contexts related
|
|
713
745
|
// only by non-caching adds cannot have changed any of them
|
|
714
746
|
if (previous !== undefined && Context.hasSameCache(previous, context)) return
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
747
|
+
// Contexts sharing a cacheRoot resolve every cached key identically, so
|
|
748
|
+
// the derived cache object is computed once per root and shared by all
|
|
749
|
+
// fibers running with that root (forked fibers reuse the parent's).
|
|
750
|
+
const root: any = (context as any).cacheRoot
|
|
751
|
+
const cache: Fiber.Fiber.Cache = root._fiberCache ??= makeFiberContextCache(context)
|
|
752
|
+
if (this.cache !== undefined && this.cache.scheduler !== cache.scheduler) {
|
|
718
753
|
this._dispatcher = undefined
|
|
719
754
|
}
|
|
720
|
-
|
|
721
|
-
// tracer behind Tracer.Tracer's default) out of every bundle
|
|
722
|
-
this.currentSpan = Context.getOrUndefinedUnsafe(context, Tracer.ParentSpanKey)
|
|
723
|
-
this.currentLogLevel = this.getRef(CurrentLogLevel)
|
|
724
|
-
this.minimumLogLevel = this.getRef(MinimumLogLevel)
|
|
725
|
-
this.currentStackFrame = this.getRef(CurrentStackFrame)
|
|
726
|
-
this.maxOpsBeforeYield = this.getRef(Scheduler.MaxOpsBeforeYield)
|
|
727
|
-
this.currentPreventYield = this.getRef(Scheduler.PreventSchedulerYield)
|
|
728
|
-
this.runtimeMetrics = Context.getOrUndefinedUnsafe(context, InternalMetric.FiberRuntimeMetricsKey)
|
|
729
|
-
const currentTracer = Context.getOrUndefinedUnsafe<Tracer.Tracer>(context, Tracer.TracerKey)
|
|
730
|
-
this.currentTracerContext = currentTracer ? currentTracer["context"] : undefined
|
|
755
|
+
this.cache = cache
|
|
731
756
|
}
|
|
732
757
|
get currentSpanLocal(): Tracer.Span | undefined {
|
|
733
|
-
|
|
758
|
+
const span = this.cache.span
|
|
759
|
+
return span?._tag === "Span" ? span : undefined
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
|
|
763
|
+
const makeFiberContextCache = (context: Context.Context<never>): Fiber.Fiber.Cache => {
|
|
764
|
+
// The string-keyed lookups keep the Tracer key values (and the native
|
|
765
|
+
// tracer behind Tracer.Tracer's default) out of every bundle
|
|
766
|
+
const currentTracer = Context.getOrUndefinedUnsafe<Tracer.Tracer>(context, Tracer.TracerKey)
|
|
767
|
+
return {
|
|
768
|
+
scheduler: Context.get(context, Scheduler.Scheduler),
|
|
769
|
+
tracer: currentTracer,
|
|
770
|
+
tracerContext: currentTracer ? currentTracer["context"] : undefined,
|
|
771
|
+
tracerEnabled: Context.get(context, TracerEnabled),
|
|
772
|
+
span: Context.getOrUndefinedUnsafe(context, Tracer.ParentSpanKey),
|
|
773
|
+
logLevel: Context.get(context, CurrentLogLevel),
|
|
774
|
+
minimumLogLevel: Context.get(context, MinimumLogLevel),
|
|
775
|
+
stackFrame: Context.get(context, CurrentStackFrame),
|
|
776
|
+
runtimeMetrics: Context.getOrUndefinedUnsafe(context, InternalMetric.FiberRuntimeMetricsKey),
|
|
777
|
+
maxOpsBeforeYield: Context.get(context, Scheduler.MaxOpsBeforeYield),
|
|
778
|
+
preventYield: Context.get(context, Scheduler.PreventSchedulerYield)
|
|
734
779
|
}
|
|
735
780
|
}
|
|
736
781
|
|
|
@@ -750,9 +795,9 @@ const fiberMiddleware = {
|
|
|
750
795
|
}
|
|
751
796
|
|
|
752
797
|
const fiberStackAnnotations = (fiber: Fiber.Fiber<any, any>) => {
|
|
753
|
-
if (!fiber.
|
|
798
|
+
if (!fiber.cache.stackFrame) return undefined
|
|
754
799
|
const annotations = new Map<string, unknown>()
|
|
755
|
-
annotations.set(InterruptorStackTrace.key, fiber.
|
|
800
|
+
annotations.set(InterruptorStackTrace.key, fiber.cache.stackFrame)
|
|
756
801
|
return Context.makeUnsafe(annotations)
|
|
757
802
|
}
|
|
758
803
|
|
|
@@ -1106,41 +1151,50 @@ const callbackOptions: <A, E = never, R = never>(
|
|
|
1106
1151
|
signal?: AbortSignal
|
|
1107
1152
|
) => void | Effect.Effect<void, never, R>,
|
|
1108
1153
|
withSignal: boolean
|
|
1109
|
-
) => Effect.Effect<A, E, R> =
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1154
|
+
) => Effect.Effect<A, E, R> = (function() {
|
|
1155
|
+
const Proto = makePrimitiveProto({
|
|
1156
|
+
op: "Async",
|
|
1157
|
+
[evaluate](this: any, fiber) {
|
|
1158
|
+
const register = internalCall(() => this.register.bind(fiber.cache.scheduler))
|
|
1159
|
+
let resumed = false
|
|
1160
|
+
let yielded: boolean | Primitive = false
|
|
1161
|
+
const controller = this.withSignal ? new AbortController() : undefined
|
|
1162
|
+
const onCancel = register((effect: Effect.Effect<any, any, any>) => {
|
|
1163
|
+
if (resumed) return
|
|
1164
|
+
resumed = true
|
|
1165
|
+
if (yielded) {
|
|
1166
|
+
fiber.evaluate(effect as any)
|
|
1167
|
+
} else {
|
|
1168
|
+
yielded = effect as any
|
|
1169
|
+
}
|
|
1170
|
+
}, controller?.signal)
|
|
1171
|
+
if (yielded !== false) return yielded
|
|
1172
|
+
yielded = true
|
|
1173
|
+
fiber._yielded = () => {
|
|
1174
|
+
resumed = true
|
|
1124
1175
|
}
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1176
|
+
if (controller === undefined && onCancel === undefined) {
|
|
1177
|
+
return Yield
|
|
1178
|
+
}
|
|
1179
|
+
fiber._stack.push(
|
|
1180
|
+
asyncFinalizer(() => {
|
|
1181
|
+
resumed = true
|
|
1182
|
+
controller?.abort()
|
|
1183
|
+
return onCancel ?? exitVoid
|
|
1184
|
+
})
|
|
1185
|
+
)
|
|
1132
1186
|
return Yield
|
|
1133
1187
|
}
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
return
|
|
1142
|
-
}
|
|
1143
|
-
})
|
|
1188
|
+
})
|
|
1189
|
+
const AsyncImpl = function(this: any, register: any, withSignal: boolean) {
|
|
1190
|
+
this.register = register
|
|
1191
|
+
this.withSignal = withSignal
|
|
1192
|
+
} as unknown as PrimitiveCtor<[register: any, withSignal: boolean]>
|
|
1193
|
+
AsyncImpl.prototype = Proto
|
|
1194
|
+
return function(register: any, withSignal: boolean) {
|
|
1195
|
+
return new AsyncImpl(register, withSignal)
|
|
1196
|
+
} as any
|
|
1197
|
+
})()
|
|
1144
1198
|
|
|
1145
1199
|
const asyncFinalizer: (
|
|
1146
1200
|
onInterrupt: () => Effect.Effect<void, any, any>
|
|
@@ -1188,12 +1242,14 @@ export const gen = <
|
|
|
1188
1242
|
[Eff] extends [never] ? never
|
|
1189
1243
|
: [Eff] extends [Effect.Effect<infer _A, infer _E, infer R>] ? R
|
|
1190
1244
|
: never
|
|
1191
|
-
> =>
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1245
|
+
> => {
|
|
1246
|
+
if (args.length === 1) {
|
|
1247
|
+
const body = args[0]
|
|
1248
|
+
return suspend(() => fromIteratorUnsafe(body()))
|
|
1249
|
+
}
|
|
1250
|
+
const [options, body] = args
|
|
1251
|
+
return suspend(() => fromIteratorUnsafe(body.call(options.self) as any))
|
|
1252
|
+
}
|
|
1197
1253
|
|
|
1198
1254
|
/** @internal */
|
|
1199
1255
|
export const fnUntraced: Effect.fn.Untraced = (
|
|
@@ -1229,9 +1285,12 @@ export const fn: typeof Effect.fn = function() {
|
|
|
1229
1285
|
const spanOptions = nameFirst ? arguments[1] : undefined
|
|
1230
1286
|
|
|
1231
1287
|
const prevLimit = getStackTraceLimit()
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1288
|
+
let defError: Error | undefined
|
|
1289
|
+
if (prevLimit !== 0) {
|
|
1290
|
+
setStackTraceLimit(2)
|
|
1291
|
+
defError = new globalThis.Error()
|
|
1292
|
+
setStackTraceLimit(prevLimit)
|
|
1293
|
+
}
|
|
1235
1294
|
|
|
1236
1295
|
if (nameFirst) {
|
|
1237
1296
|
return (body: Function | { readonly self: any }, ...pipeables: Array<Function>) =>
|
|
@@ -1251,7 +1310,7 @@ export const fn: typeof Effect.fn = function() {
|
|
|
1251
1310
|
const makeFn = (
|
|
1252
1311
|
name: string,
|
|
1253
1312
|
bodyOrOptions: Function | { readonly self: any },
|
|
1254
|
-
defError: Error,
|
|
1313
|
+
defError: Error | undefined,
|
|
1255
1314
|
pipeables: Array<Function>,
|
|
1256
1315
|
addSpan: boolean,
|
|
1257
1316
|
spanOptions: Tracer.SpanOptionsNoTrace | undefined
|
|
@@ -1272,9 +1331,12 @@ const makeFn = (
|
|
|
1272
1331
|
return result
|
|
1273
1332
|
}
|
|
1274
1333
|
const prevLimit = getStackTraceLimit()
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1334
|
+
let callError: Error | undefined
|
|
1335
|
+
if (prevLimit !== 0) {
|
|
1336
|
+
setStackTraceLimit(2)
|
|
1337
|
+
callError = new globalThis.Error()
|
|
1338
|
+
setStackTraceLimit(prevLimit)
|
|
1339
|
+
}
|
|
1278
1340
|
return updateService(
|
|
1279
1341
|
addSpan ?
|
|
1280
1342
|
useSpan(name, spanOptions!, (span) => provideParentSpan(result, span)) :
|
|
@@ -1282,10 +1344,10 @@ const makeFn = (
|
|
|
1282
1344
|
CurrentStackFrame,
|
|
1283
1345
|
(prev) => ({
|
|
1284
1346
|
name,
|
|
1285
|
-
stack: fnStackCleaner(() => callError.stack),
|
|
1347
|
+
stack: callError ? fnStackCleaner(() => callError.stack) : constUndefined,
|
|
1286
1348
|
parent: {
|
|
1287
1349
|
name: `${name} (definition)`,
|
|
1288
|
-
stack: fnStackCleaner(() => defError.stack),
|
|
1350
|
+
stack: defError ? fnStackCleaner(() => defError.stack) : constUndefined,
|
|
1289
1351
|
parent: prev
|
|
1290
1352
|
}
|
|
1291
1353
|
})
|
|
@@ -1307,7 +1369,7 @@ export const fnUntracedEager: Effect.fn.Untraced = (
|
|
|
1307
1369
|
: function(this: any) {
|
|
1308
1370
|
let effect = fromIteratorEagerUnsafe(() => body.apply(this, arguments))
|
|
1309
1371
|
for (const pipeable of pipeables) {
|
|
1310
|
-
effect = pipeable(effect)
|
|
1372
|
+
effect = pipeable(effect, ...arguments)
|
|
1311
1373
|
}
|
|
1312
1374
|
return effect
|
|
1313
1375
|
}
|
|
@@ -1356,27 +1418,36 @@ const fromIteratorEagerUnsafe = (
|
|
|
1356
1418
|
const fromIteratorUnsafe: (
|
|
1357
1419
|
iterator: Iterator<Effect.Effect<any, any, any>>,
|
|
1358
1420
|
initial?: undefined
|
|
1359
|
-
) => Effect.Effect<any, any, any> =
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1363
|
-
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
|
|
1370
|
-
|
|
1371
|
-
|
|
1421
|
+
) => Effect.Effect<any, any, any> = (function() {
|
|
1422
|
+
const Proto = makePrimitiveProto({
|
|
1423
|
+
op: "Iterator",
|
|
1424
|
+
[contA](this: any, value, fiber) {
|
|
1425
|
+
const iter = this.iterator
|
|
1426
|
+
while (true) {
|
|
1427
|
+
const state = iter.next(value)
|
|
1428
|
+
if (state.done) return succeed(state.value)
|
|
1429
|
+
if (!effectIsExit(state.value)) {
|
|
1430
|
+
fiber._stack.push(this)
|
|
1431
|
+
return state.value
|
|
1432
|
+
} else if (state.value._tag === "Failure") {
|
|
1433
|
+
return state.value
|
|
1434
|
+
}
|
|
1435
|
+
value = state.value.value
|
|
1372
1436
|
}
|
|
1373
|
-
|
|
1437
|
+
},
|
|
1438
|
+
[evaluate](this: any, fiber: FiberImpl) {
|
|
1439
|
+
return this[contA](this.initial, fiber)
|
|
1374
1440
|
}
|
|
1375
|
-
}
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
}
|
|
1441
|
+
})
|
|
1442
|
+
const IteratorImpl = function(this: any, iterator: any, initial: any) {
|
|
1443
|
+
this.iterator = iterator
|
|
1444
|
+
this.initial = initial
|
|
1445
|
+
} as unknown as PrimitiveCtor<[iterator: any, initial: any]>
|
|
1446
|
+
IteratorImpl.prototype = Proto
|
|
1447
|
+
return function(iterator: any, initial?: undefined) {
|
|
1448
|
+
return new IteratorImpl(iterator, initial)
|
|
1449
|
+
} as any
|
|
1450
|
+
})()
|
|
1380
1451
|
|
|
1381
1452
|
// ----------------------------------------------------------------------------
|
|
1382
1453
|
// mapping & sequencing
|
|
@@ -1393,12 +1464,71 @@ export const as: {
|
|
|
1393
1464
|
<A, E, R, B>(
|
|
1394
1465
|
self: Effect.Effect<A, E, R>,
|
|
1395
1466
|
value: B
|
|
1396
|
-
): Effect.Effect<B, E, R> =>
|
|
1397
|
-
const b = succeed(value)
|
|
1398
|
-
return flatMap(self, (_) => b)
|
|
1399
|
-
}
|
|
1467
|
+
): Effect.Effect<B, E, R> => new ContImpl(self, returnPayload, succeed(value))
|
|
1400
1468
|
)
|
|
1401
1469
|
|
|
1470
|
+
const evaluateCont = function(this: any, fiber: FiberImpl): Primitive {
|
|
1471
|
+
fiber._stack.push(this)
|
|
1472
|
+
return this[args]
|
|
1473
|
+
}
|
|
1474
|
+
|
|
1475
|
+
interface PrimitiveCtor<Args extends Array<any>> {
|
|
1476
|
+
new(...args: Args): Primitive & Effect.Effect<any, any, any>
|
|
1477
|
+
prototype: any
|
|
1478
|
+
}
|
|
1479
|
+
|
|
1480
|
+
const OnSuccessProto = makePrimitiveProto({
|
|
1481
|
+
op: "OnSuccess",
|
|
1482
|
+
[evaluate]: evaluateCont
|
|
1483
|
+
})
|
|
1484
|
+
|
|
1485
|
+
const OnSuccessImpl = function(this: any, self: Effect.Effect<any, any, any>, f: any) {
|
|
1486
|
+
this[args] = self
|
|
1487
|
+
this[contA] = f
|
|
1488
|
+
} as unknown as PrimitiveCtor<[self: Effect.Effect<any, any, any>, f: any]>
|
|
1489
|
+
OnSuccessImpl.prototype = OnSuccessProto
|
|
1490
|
+
|
|
1491
|
+
// A success continuation with an extra payload slot. The stored continuation
|
|
1492
|
+
// receives the primitive as `this` and reads `this.payload`, so combinators
|
|
1493
|
+
// like map / as / tap / andThen can share module-level continuation functions
|
|
1494
|
+
// instead of allocating a closure per call.
|
|
1495
|
+
const ContImpl = function(
|
|
1496
|
+
this: any,
|
|
1497
|
+
self: Effect.Effect<any, any, any>,
|
|
1498
|
+
cont: (this: { readonly payload: any }, value: any, fiber: FiberImpl) => unknown,
|
|
1499
|
+
payload: unknown
|
|
1500
|
+
) {
|
|
1501
|
+
this[args] = self
|
|
1502
|
+
this[contA] = cont
|
|
1503
|
+
this.payload = payload
|
|
1504
|
+
} as unknown as PrimitiveCtor<
|
|
1505
|
+
[
|
|
1506
|
+
self: Effect.Effect<any, any, any>,
|
|
1507
|
+
cont: (this: { readonly payload: any }, value: any, fiber: FiberImpl) => unknown,
|
|
1508
|
+
payload: unknown
|
|
1509
|
+
]
|
|
1510
|
+
>
|
|
1511
|
+
ContImpl.prototype = OnSuccessProto
|
|
1512
|
+
|
|
1513
|
+
const returnPayload = function(this: { readonly payload: any }) {
|
|
1514
|
+
return this.payload
|
|
1515
|
+
}
|
|
1516
|
+
const mapCont = function(this: { readonly payload: any }, value: any) {
|
|
1517
|
+
const f = this.payload
|
|
1518
|
+
return succeed(internalCall(() => f(value)))
|
|
1519
|
+
}
|
|
1520
|
+
const andThenCont = function(this: { readonly payload: any }, value: any) {
|
|
1521
|
+
const f = this.payload
|
|
1522
|
+
return internalCall(() => f(value))
|
|
1523
|
+
}
|
|
1524
|
+
const tapCont = function(this: { readonly payload: any }, value: any) {
|
|
1525
|
+
const f = this.payload
|
|
1526
|
+
return new ContImpl(internalCall(() => f(value)), returnPayload, exitSucceed(value))
|
|
1527
|
+
}
|
|
1528
|
+
const tapEffectCont = function(this: { readonly payload: any }, value: any) {
|
|
1529
|
+
return new ContImpl(this.payload, returnPayload, exitSucceed(value))
|
|
1530
|
+
}
|
|
1531
|
+
|
|
1402
1532
|
/** @internal */
|
|
1403
1533
|
export const asSome = <A, E, R>(
|
|
1404
1534
|
self: Effect.Effect<A, E, R>
|
|
@@ -1434,8 +1564,7 @@ export const andThen: {
|
|
|
1434
1564
|
<A, E, R, B, E2, R2>(
|
|
1435
1565
|
self: Effect.Effect<A, E, R>,
|
|
1436
1566
|
f: ((a: A) => Effect.Effect<B, E2, R2>) | Effect.Effect<B, E2, R2>
|
|
1437
|
-
): Effect.Effect<B, E | E2, R | R2> =>
|
|
1438
|
-
flatMap(self, (a) => isEffect(f) ? f : internalCall(() => (f as (a: A) => Effect.Effect<B, E2, R2>)(a)))
|
|
1567
|
+
): Effect.Effect<B, E | E2, R | R2> => new ContImpl(self, isEffect(f) ? returnPayload : andThenCont, f)
|
|
1439
1568
|
)
|
|
1440
1569
|
|
|
1441
1570
|
/** @internal */
|
|
@@ -1459,14 +1588,13 @@ export const tap: {
|
|
|
1459
1588
|
<A, E, R, B, E2, R2>(
|
|
1460
1589
|
self: Effect.Effect<A, E, R>,
|
|
1461
1590
|
f: ((a: A) => Effect.Effect<B, E2, R2>) | Effect.Effect<B, E2, R2>
|
|
1462
|
-
): Effect.Effect<A, E | E2, R | R2> =>
|
|
1463
|
-
flatMap(self, (a) => as(isEffect(f) ? f : internalCall(() => (f as (a: A) => Effect.Effect<B, E2, R2>)(a)), a))
|
|
1591
|
+
): Effect.Effect<A, E | E2, R | R2> => new ContImpl(self, isEffect(f) ? tapEffectCont : tapCont, f)
|
|
1464
1592
|
)
|
|
1465
1593
|
|
|
1466
1594
|
/** @internal */
|
|
1467
1595
|
export const asVoid = <A, E, R>(
|
|
1468
1596
|
self: Effect.Effect<A, E, R>
|
|
1469
|
-
): Effect.Effect<void, E, R> =>
|
|
1597
|
+
): Effect.Effect<void, E, R> => new ContImpl(self, returnPayload, exitVoid)
|
|
1470
1598
|
|
|
1471
1599
|
/** @internal */
|
|
1472
1600
|
export const sandbox = <A, E, R>(
|
|
@@ -1673,20 +1801,8 @@ export const flatMap: {
|
|
|
1673
1801
|
<A, E, R, B, E2, R2>(
|
|
1674
1802
|
self: Effect.Effect<A, E, R>,
|
|
1675
1803
|
f: (a: A) => Effect.Effect<B, E2, R2>
|
|
1676
|
-
): Effect.Effect<B, E | E2, R | R2> =>
|
|
1677
|
-
const onSuccess = Object.create(OnSuccessProto)
|
|
1678
|
-
onSuccess[args] = self
|
|
1679
|
-
onSuccess[contA] = f.length !== 1 ? (a: A) => f(a) : f
|
|
1680
|
-
return onSuccess
|
|
1681
|
-
}
|
|
1804
|
+
): Effect.Effect<B, E | E2, R | R2> => new OnSuccessImpl(self, f.length !== 1 ? (a: A) => f(a) : f)
|
|
1682
1805
|
)
|
|
1683
|
-
const OnSuccessProto = makePrimitiveProto({
|
|
1684
|
-
op: "OnSuccess",
|
|
1685
|
-
[evaluate](this: any, fiber: FiberImpl): Primitive {
|
|
1686
|
-
fiber._stack.push(this)
|
|
1687
|
-
return this[args]
|
|
1688
|
-
}
|
|
1689
|
-
})
|
|
1690
1806
|
|
|
1691
1807
|
/** @internal */
|
|
1692
1808
|
export const matchCauseEffectEager: {
|
|
@@ -1722,7 +1838,8 @@ export const matchCauseEffectEager: {
|
|
|
1722
1838
|
)
|
|
1723
1839
|
|
|
1724
1840
|
/** @internal */
|
|
1725
|
-
export const effectIsExit = <A, E, R>(effect: Effect.Effect<A, E, R>): effect is Exit.Exit<A, E> =>
|
|
1841
|
+
export const effectIsExit = <A, E, R>(effect: Effect.Effect<A, E, R>): effect is Exit.Exit<A, E> =>
|
|
1842
|
+
(effect as any)[ExitTypeId] !== undefined
|
|
1726
1843
|
|
|
1727
1844
|
/** @internal */
|
|
1728
1845
|
export const flatMapEager: {
|
|
@@ -1769,7 +1886,7 @@ export const map: {
|
|
|
1769
1886
|
<A, E, R, B>(
|
|
1770
1887
|
self: Effect.Effect<A, E, R>,
|
|
1771
1888
|
f: (a: A) => B
|
|
1772
|
-
): Effect.Effect<B, E, R> =>
|
|
1889
|
+
): Effect.Effect<B, E, R> => new ContImpl(self, mapCont, f)
|
|
1773
1890
|
)
|
|
1774
1891
|
|
|
1775
1892
|
/** @internal */
|
|
@@ -2135,7 +2252,9 @@ export const updateServiceScoped = <I, A>(
|
|
|
2135
2252
|
const updated = update(original)
|
|
2136
2253
|
fiber.setContext(Context.add(fiber.context, service, updated))
|
|
2137
2254
|
return scopeAddFinalizerExit(Context.getUnsafe(fiber.context, scopeTag), (_) => {
|
|
2138
|
-
const
|
|
2255
|
+
const currentOption = Context.getOption(fiber.context, service)
|
|
2256
|
+
if (Option.isNone(currentOption)) return void_
|
|
2257
|
+
const current = currentOption.value
|
|
2139
2258
|
let next: A
|
|
2140
2259
|
if (options?.reset === undefined) {
|
|
2141
2260
|
if (current !== updated) return void_
|
|
@@ -2311,7 +2430,7 @@ export const zipWith: {
|
|
|
2311
2430
|
// filtering & conditionals
|
|
2312
2431
|
// ----------------------------------------------------------------------------
|
|
2313
2432
|
|
|
2314
|
-
|
|
2433
|
+
/** @internal */
|
|
2315
2434
|
export const filterOrFail: {
|
|
2316
2435
|
<A, E2, B extends A>(
|
|
2317
2436
|
refinement: Predicate.Refinement<NoInfer<A>, B>,
|
|
@@ -2485,20 +2604,18 @@ export const catchCause: {
|
|
|
2485
2604
|
<A, E, R, B, E2, R2>(
|
|
2486
2605
|
self: Effect.Effect<A, E, R>,
|
|
2487
2606
|
f: (cause: NoInfer<Cause.Cause<E>>) => Effect.Effect<B, E2, R2>
|
|
2488
|
-
): Effect.Effect<A | B, E2, R | R2> =>
|
|
2489
|
-
|
|
2490
|
-
onFailure[args] = self
|
|
2491
|
-
onFailure[contE] = f.length !== 1 ? (cause: Cause.Cause<E>) => f(cause) : f
|
|
2492
|
-
return onFailure
|
|
2493
|
-
}
|
|
2607
|
+
): Effect.Effect<A | B, E2, R | R2> =>
|
|
2608
|
+
new OnFailureImpl(self, f.length !== 1 ? (cause: Cause.Cause<E>) => f(cause) : f)
|
|
2494
2609
|
)
|
|
2495
2610
|
const OnFailureProto = makePrimitiveProto({
|
|
2496
2611
|
op: "OnFailure",
|
|
2497
|
-
[evaluate]
|
|
2498
|
-
fiber._stack.push(this as any)
|
|
2499
|
-
return this[args]
|
|
2500
|
-
}
|
|
2612
|
+
[evaluate]: evaluateCont
|
|
2501
2613
|
})
|
|
2614
|
+
const OnFailureImpl = function(this: any, self: Effect.Effect<any, any, any>, f: any) {
|
|
2615
|
+
this[args] = self
|
|
2616
|
+
this[contE] = f
|
|
2617
|
+
} as unknown as PrimitiveCtor<[self: Effect.Effect<any, any, any>, f: any]>
|
|
2618
|
+
OnFailureImpl.prototype = OnFailureProto
|
|
2502
2619
|
|
|
2503
2620
|
/** @internal */
|
|
2504
2621
|
export const catchCauseIf: {
|
|
@@ -2741,9 +2858,9 @@ export const tapErrorTag: {
|
|
|
2741
2858
|
|
|
2742
2859
|
/** @internal */
|
|
2743
2860
|
export const tapDefect: {
|
|
2744
|
-
<
|
|
2861
|
+
<B, E2, R2>(
|
|
2745
2862
|
f: (defect: unknown) => Effect.Effect<B, E2, R2>
|
|
2746
|
-
): <A, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E | E2, R | R2>
|
|
2863
|
+
): <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E | E2, R | R2>
|
|
2747
2864
|
<A, E, R, B, E2, R2>(
|
|
2748
2865
|
self: Effect.Effect<A, E, R>,
|
|
2749
2866
|
f: (defect: unknown) => Effect.Effect<B, E2, R2>
|
|
@@ -3098,7 +3215,10 @@ export const catchReason: {
|
|
|
3098
3215
|
> =>
|
|
3099
3216
|
catchIf(
|
|
3100
3217
|
self,
|
|
3101
|
-
((e: any) =>
|
|
3218
|
+
((e: any) =>
|
|
3219
|
+
isTagged(e, errorTag) &&
|
|
3220
|
+
hasProperty(e, "reason") &&
|
|
3221
|
+
(orElse !== undefined || isTagged(e.reason, reasonTag))) as any,
|
|
3102
3222
|
(e: any): Effect.Effect<A2 | A3, E | E2 | E3, R2 | R3> => {
|
|
3103
3223
|
const reason = e.reason as any
|
|
3104
3224
|
if (isTagged(reason, reasonTag)) return f(reason as any, e)
|
|
@@ -3198,7 +3318,8 @@ export const catchReasons: {
|
|
|
3198
3318
|
isTagged(e, errorTag) &&
|
|
3199
3319
|
hasProperty(e, "reason") &&
|
|
3200
3320
|
hasProperty(e.reason, "_tag") &&
|
|
3201
|
-
isString(e.reason._tag)
|
|
3321
|
+
isString(e.reason._tag) &&
|
|
3322
|
+
(orElse !== undefined || (keys ??= Object.keys(cases)).includes(e.reason._tag))) as any,
|
|
3202
3323
|
(e: any) => {
|
|
3203
3324
|
const reason = e.reason
|
|
3204
3325
|
keys ??= Object.keys(cases)
|
|
@@ -3267,7 +3388,7 @@ export const mapError: {
|
|
|
3267
3388
|
): Effect.Effect<A, E2, R> => catch_(self, (error) => failSync(() => f(error)))
|
|
3268
3389
|
)
|
|
3269
3390
|
|
|
3270
|
-
|
|
3391
|
+
/** @internal */
|
|
3271
3392
|
export const mapBoth: {
|
|
3272
3393
|
<E, E2, A, A2>(
|
|
3273
3394
|
options: { readonly onFailure: (e: E) => E2; readonly onSuccess: (a: A) => A2 }
|
|
@@ -3446,23 +3567,30 @@ export const matchCauseEffect: {
|
|
|
3446
3567
|
readonly onFailure: (cause: Cause.Cause<E>) => Effect.Effect<A2, E2, R2>
|
|
3447
3568
|
readonly onSuccess: (a: A) => Effect.Effect<A3, E3, R3>
|
|
3448
3569
|
}
|
|
3449
|
-
): Effect.Effect<A2 | A3, E2 | E3, R2 | R3 | R> =>
|
|
3450
|
-
|
|
3451
|
-
|
|
3452
|
-
|
|
3453
|
-
|
|
3454
|
-
|
|
3455
|
-
|
|
3456
|
-
|
|
3457
|
-
}
|
|
3570
|
+
): Effect.Effect<A2 | A3, E2 | E3, R2 | R3 | R> =>
|
|
3571
|
+
new OnSuccessAndFailureImpl(
|
|
3572
|
+
self,
|
|
3573
|
+
options.onSuccess.length !== 1 ? (a: A) => options.onSuccess(a) : options.onSuccess,
|
|
3574
|
+
options.onFailure.length !== 1
|
|
3575
|
+
? (cause: Cause.Cause<E>) => options.onFailure(cause)
|
|
3576
|
+
: options.onFailure
|
|
3577
|
+
)
|
|
3458
3578
|
)
|
|
3459
3579
|
const OnSuccessAndFailureProto = makePrimitiveProto({
|
|
3460
3580
|
op: "OnSuccessAndFailure",
|
|
3461
|
-
[evaluate]
|
|
3462
|
-
fiber._stack.push(this)
|
|
3463
|
-
return this[args]
|
|
3464
|
-
}
|
|
3581
|
+
[evaluate]: evaluateCont
|
|
3465
3582
|
})
|
|
3583
|
+
const OnSuccessAndFailureImpl = function(
|
|
3584
|
+
this: any,
|
|
3585
|
+
self: Effect.Effect<any, any, any>,
|
|
3586
|
+
onSuccess: any,
|
|
3587
|
+
onFailure: any
|
|
3588
|
+
) {
|
|
3589
|
+
this[args] = self
|
|
3590
|
+
this[contA] = onSuccess
|
|
3591
|
+
this[contE] = onFailure
|
|
3592
|
+
} as unknown as PrimitiveCtor<[self: Effect.Effect<any, any, any>, onSuccess: any, onFailure: any]>
|
|
3593
|
+
OnSuccessAndFailureImpl.prototype = OnSuccessAndFailureProto
|
|
3466
3594
|
|
|
3467
3595
|
/** @internal */
|
|
3468
3596
|
export const matchCause: {
|
|
@@ -3697,12 +3825,16 @@ export const timeoutOrElse: {
|
|
|
3697
3825
|
readonly orElse: LazyArg<Effect.Effect<A2, E2, R2>>
|
|
3698
3826
|
}
|
|
3699
3827
|
): Effect.Effect<A | A2, E | E2, R | R2> =>
|
|
3700
|
-
|
|
3701
|
-
self,
|
|
3702
|
-
|
|
3828
|
+
flatMap(
|
|
3829
|
+
timeoutOption(self, options.duration),
|
|
3830
|
+
(option): Effect.Effect<A | A2, E2, R2> => Option.isNone(option) ? options.orElse() : succeed(option.value)
|
|
3703
3831
|
)
|
|
3704
3832
|
)
|
|
3705
3833
|
|
|
3834
|
+
/** @internal */
|
|
3835
|
+
const timeoutErrorFromDuration = (duration: Duration.Duration): TimeoutError =>
|
|
3836
|
+
new TimeoutError(`Operation timed out after '${Duration.format(duration)}'`)
|
|
3837
|
+
|
|
3706
3838
|
/** @internal */
|
|
3707
3839
|
export const timeout: {
|
|
3708
3840
|
(
|
|
@@ -3719,11 +3851,13 @@ export const timeout: {
|
|
|
3719
3851
|
<A, E, R>(
|
|
3720
3852
|
self: Effect.Effect<A, E, R>,
|
|
3721
3853
|
duration: Duration.Input
|
|
3722
|
-
): Effect.Effect<A, E | TimeoutError, R> =>
|
|
3723
|
-
|
|
3724
|
-
|
|
3725
|
-
|
|
3854
|
+
): Effect.Effect<A, E | TimeoutError, R> => {
|
|
3855
|
+
const decoded = Duration.fromInputUnsafe(duration)
|
|
3856
|
+
return timeoutOrElse(self, {
|
|
3857
|
+
duration: decoded,
|
|
3858
|
+
orElse: () => fail(timeoutErrorFromDuration(decoded))
|
|
3726
3859
|
})
|
|
3860
|
+
}
|
|
3727
3861
|
)
|
|
3728
3862
|
|
|
3729
3863
|
/** @internal */
|
|
@@ -3783,9 +3917,13 @@ export const scopeCloseUnsafe = <A, E>(self: Scope.Scope, exit_: Exit.Exit<A, E>
|
|
|
3783
3917
|
self.state = closed
|
|
3784
3918
|
return
|
|
3785
3919
|
}
|
|
3786
|
-
const
|
|
3920
|
+
const state = self.state
|
|
3787
3921
|
self.state = closed
|
|
3788
|
-
if (
|
|
3922
|
+
if (state.finalizer !== undefined) {
|
|
3923
|
+
return state.finalizer(exit_)
|
|
3924
|
+
}
|
|
3925
|
+
const finalizers = state.finalizers
|
|
3926
|
+
if (finalizers === undefined || finalizers.size === 0) {
|
|
3789
3927
|
return
|
|
3790
3928
|
} else if (finalizers.size === 1) {
|
|
3791
3929
|
return finalizers.values().next().value!(exit_)
|
|
@@ -3801,7 +3939,7 @@ const combineFinalizerCause = <A, E, XE, XR>(
|
|
|
3801
3939
|
|
|
3802
3940
|
const scopeCloseFinalizers = fnUntraced(function*<A, E>(
|
|
3803
3941
|
self: Scope.Scope,
|
|
3804
|
-
finalizers: Scope.State.Open["finalizers"]
|
|
3942
|
+
finalizers: NonNullable<Scope.State.Open["finalizers"]>,
|
|
3805
3943
|
exit_: Exit.Exit<A, E>
|
|
3806
3944
|
) {
|
|
3807
3945
|
let exits: Array<Exit.Exit<any, never>> = []
|
|
@@ -3866,9 +4004,20 @@ export const scopeAddFinalizerUnsafe = (
|
|
|
3866
4004
|
finalizer: (exit: Exit.Exit<any, any>) => Effect.Effect<unknown>
|
|
3867
4005
|
): void => {
|
|
3868
4006
|
if (scope.state._tag === "Empty") {
|
|
3869
|
-
scope.state = { _tag: "Open",
|
|
4007
|
+
scope.state = { _tag: "Open", finalizerKey: key, finalizer, finalizers: undefined }
|
|
3870
4008
|
} else if (scope.state._tag === "Open") {
|
|
3871
|
-
scope.state
|
|
4009
|
+
const state = scope.state
|
|
4010
|
+
if (state.finalizer !== undefined) {
|
|
4011
|
+
state.finalizers = new Map([[state.finalizerKey!, state.finalizer]])
|
|
4012
|
+
state.finalizerKey = undefined
|
|
4013
|
+
state.finalizer = undefined
|
|
4014
|
+
state.finalizers.set(key, finalizer)
|
|
4015
|
+
} else if (state.finalizers === undefined) {
|
|
4016
|
+
state.finalizerKey = key
|
|
4017
|
+
state.finalizer = finalizer
|
|
4018
|
+
} else {
|
|
4019
|
+
state.finalizers.set(key, finalizer)
|
|
4020
|
+
}
|
|
3872
4021
|
}
|
|
3873
4022
|
}
|
|
3874
4023
|
|
|
@@ -3878,10 +4027,24 @@ export const scopeRemoveFinalizerUnsafe = (
|
|
|
3878
4027
|
key: {}
|
|
3879
4028
|
): void => {
|
|
3880
4029
|
if (scope.state._tag === "Open") {
|
|
3881
|
-
scope.state
|
|
4030
|
+
const state = scope.state
|
|
4031
|
+
if (state.finalizerKey === key) {
|
|
4032
|
+
state.finalizerKey = undefined
|
|
4033
|
+
state.finalizer = undefined
|
|
4034
|
+
} else if (state.finalizers !== undefined) {
|
|
4035
|
+
state.finalizers.delete(key)
|
|
4036
|
+
}
|
|
3882
4037
|
}
|
|
3883
4038
|
}
|
|
3884
4039
|
|
|
4040
|
+
/** @internal */
|
|
4041
|
+
export const scopeFinalizerCountUnsafe = (scope: Scope.Scope): number =>
|
|
4042
|
+
scope.state._tag !== "Open"
|
|
4043
|
+
? 0
|
|
4044
|
+
: scope.state.finalizer !== undefined
|
|
4045
|
+
? 1
|
|
4046
|
+
: (scope.state.finalizers?.size ?? 0)
|
|
4047
|
+
|
|
3885
4048
|
/** @internal */
|
|
3886
4049
|
export const scopeMakeUnsafe = (finalizerStrategy: "sequential" | "parallel" = "sequential"): Scope.Closeable => ({
|
|
3887
4050
|
[ScopeCloseableTypeId]: ScopeCloseableTypeId,
|
|
@@ -3974,30 +4137,40 @@ export const onExitPrimitive: <A, E, R, XE = never, XR = never>(
|
|
|
3974
4137
|
self: Effect.Effect<A, E, R>,
|
|
3975
4138
|
f: (exit: Exit.Exit<A, E>) => Effect.Effect<void, XE, XR> | undefined,
|
|
3976
4139
|
interruptible?: boolean
|
|
3977
|
-
) => Effect.Effect<A, E | XE, R | XR> =
|
|
3978
|
-
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
|
|
3985
|
-
|
|
3986
|
-
|
|
3987
|
-
|
|
4140
|
+
) => Effect.Effect<A, E | XE, R | XR> = (function() {
|
|
4141
|
+
const Proto = makePrimitiveProto({
|
|
4142
|
+
op: "OnExit",
|
|
4143
|
+
[evaluate](this: any, fiber: FiberImpl) {
|
|
4144
|
+
fiber._stack.push(this)
|
|
4145
|
+
return this.effect
|
|
4146
|
+
},
|
|
4147
|
+
[contAll](this: any, fiber) {
|
|
4148
|
+
if (fiber.interruptible && this.interruptible !== true) {
|
|
4149
|
+
fiber._stack.push(setInterruptibleTrue)
|
|
4150
|
+
fiber.interruptible = false
|
|
4151
|
+
}
|
|
4152
|
+
},
|
|
4153
|
+
[contA](this: any, value, _, exit) {
|
|
4154
|
+
exit ??= exitSucceed(value)
|
|
4155
|
+
const eff = this.onExit(exit)
|
|
4156
|
+
return eff ? flatMap(eff, (_) => exit) : exit
|
|
4157
|
+
},
|
|
4158
|
+
[contE](this: any, cause, _, exit) {
|
|
4159
|
+
exit ??= exitFailCause(cause)
|
|
4160
|
+
const eff = this.onExit(exit)
|
|
4161
|
+
return eff ? flatMap(combineFinalizerCause(exit, eff), (_) => exit) : exit
|
|
3988
4162
|
}
|
|
3989
|
-
}
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
},
|
|
3995
|
-
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
})
|
|
4163
|
+
})
|
|
4164
|
+
const OnExitImpl = function(this: any, effect: any, onExit: any, interruptible: any) {
|
|
4165
|
+
this.effect = effect
|
|
4166
|
+
this.onExit = onExit
|
|
4167
|
+
this.interruptible = interruptible
|
|
4168
|
+
} as unknown as PrimitiveCtor<[effect: any, onExit: any, interruptible: any]>
|
|
4169
|
+
OnExitImpl.prototype = Proto
|
|
4170
|
+
return function(effect: any, onExit: any, interruptible?: boolean) {
|
|
4171
|
+
return new OnExitImpl(effect, onExit, interruptible)
|
|
4172
|
+
} as any
|
|
4173
|
+
})()
|
|
4001
4174
|
|
|
4002
4175
|
/** @internal */
|
|
4003
4176
|
export const onExit: {
|
|
@@ -4177,7 +4350,7 @@ export const acquireUseRelease = <Resource, E, R, A, E2, R2, E3, R3>(
|
|
|
4177
4350
|
uninterruptibleMask((restore) =>
|
|
4178
4351
|
flatMap(acquire, (a) =>
|
|
4179
4352
|
onExitPrimitive(
|
|
4180
|
-
restore(use(a)),
|
|
4353
|
+
suspend(() => restore(use(a))),
|
|
4181
4354
|
(exit) => release(a, exit),
|
|
4182
4355
|
true
|
|
4183
4356
|
))
|
|
@@ -4260,7 +4433,22 @@ export const cachedWithTTL: {
|
|
|
4260
4433
|
|
|
4261
4434
|
/** @internal */
|
|
4262
4435
|
export const cached = <A, E, R>(self: Effect.Effect<A, E, R>): Effect.Effect<Effect.Effect<A, E, R>> =>
|
|
4263
|
-
|
|
4436
|
+
sync(() => {
|
|
4437
|
+
const latch = makeLatchUnsafe(false)
|
|
4438
|
+
let started = false
|
|
4439
|
+
let exit: Exit.Exit<A, E> | undefined
|
|
4440
|
+
const wait = flatMap(latch.await, () => exit!)
|
|
4441
|
+
return suspend(() => {
|
|
4442
|
+
if (exit !== undefined) return exit
|
|
4443
|
+
if (started) return wait
|
|
4444
|
+
started = true
|
|
4445
|
+
return onExit(self, (result) =>
|
|
4446
|
+
sync(() => {
|
|
4447
|
+
exit = result
|
|
4448
|
+
latch.openUnsafe()
|
|
4449
|
+
}))
|
|
4450
|
+
})
|
|
4451
|
+
})
|
|
4264
4452
|
|
|
4265
4453
|
// ----------------------------------------------------------------------------
|
|
4266
4454
|
// interruption
|
|
@@ -4298,6 +4486,34 @@ const setFiberInterruptible = (fiber: FiberImpl): Effect.Effect<never> | undefin
|
|
|
4298
4486
|
if (fiber._interruptedCause) return failCause(fiber._interruptedCause)
|
|
4299
4487
|
}
|
|
4300
4488
|
|
|
4489
|
+
/**
|
|
4490
|
+
* Makes the current fiber uninterruptible for the returned effect without an
|
|
4491
|
+
* extra primitive. Call only within `withFiber`.
|
|
4492
|
+
*
|
|
4493
|
+
* @internal
|
|
4494
|
+
*/
|
|
4495
|
+
export const fiberEnterUninterruptibleUnsafe = (fiber: Fiber.Fiber<unknown, unknown>): void => {
|
|
4496
|
+
const impl = fiber as FiberImpl
|
|
4497
|
+
if (!impl.interruptible) return
|
|
4498
|
+
impl.interruptible = false
|
|
4499
|
+
impl._stack.push(setInterruptibleTrue)
|
|
4500
|
+
}
|
|
4501
|
+
|
|
4502
|
+
/**
|
|
4503
|
+
* Makes the current fiber interruptible for the returned effect without an
|
|
4504
|
+
* extra primitive. Call only within `withFiber` and return any pending
|
|
4505
|
+
* interruption it produces.
|
|
4506
|
+
*
|
|
4507
|
+
* @internal
|
|
4508
|
+
*/
|
|
4509
|
+
export const fiberEnterInterruptibleUnsafe = (
|
|
4510
|
+
fiber: Fiber.Fiber<unknown, unknown>
|
|
4511
|
+
): Effect.Effect<never> | undefined => {
|
|
4512
|
+
const impl = fiber as FiberImpl
|
|
4513
|
+
if (impl.interruptible) return undefined
|
|
4514
|
+
return setFiberInterruptible(impl)
|
|
4515
|
+
}
|
|
4516
|
+
|
|
4301
4517
|
/** @internal */
|
|
4302
4518
|
export const interruptible = <A, E, R>(
|
|
4303
4519
|
self: Effect.Effect<A, E, R>
|
|
@@ -4643,10 +4859,7 @@ export const forEach: {
|
|
|
4643
4859
|
}
|
|
4644
4860
|
): Effect.Effect<any, E, R> =>
|
|
4645
4861
|
suspend(() => {
|
|
4646
|
-
const
|
|
4647
|
-
const concurrency = concurrencyOption === "unbounded"
|
|
4648
|
-
? Number.POSITIVE_INFINITY
|
|
4649
|
-
: Math.max(1, concurrencyOption)
|
|
4862
|
+
const concurrency = resolveConcurrency(options?.concurrency)
|
|
4650
4863
|
|
|
4651
4864
|
if (concurrency === 1) {
|
|
4652
4865
|
return forEachSequential(iterable, f, options)
|
|
@@ -4699,19 +4912,22 @@ const forEachSequential = <A, B, E, R>(
|
|
|
4699
4912
|
)
|
|
4700
4913
|
})
|
|
4701
4914
|
|
|
4702
|
-
|
|
4703
|
-
|
|
4704
|
-
|
|
4705
|
-
readonly orderedStep?: boolean | undefined
|
|
4706
|
-
}
|
|
4915
|
+
/** @internal */
|
|
4916
|
+
export const resolveConcurrency = (concurrency: Concurrency | undefined): number =>
|
|
4917
|
+
concurrency === "unbounded" ? Number.POSITIVE_INFINITY : Math.max(1, concurrency ?? 1)
|
|
4707
4918
|
|
|
4708
|
-
|
|
4919
|
+
type IterateOptions<S, A, X, E, R, E2> = {
|
|
4709
4920
|
readonly onItem: (state: S, item: A, index: number) => Effect.Effect<X, E, R>
|
|
4710
4921
|
readonly step: (state: NoInfer<S>, item: A, exit: Exit.Exit<X, E>, index: number) => Exit.Exit<void, E2> | void
|
|
4711
|
-
}
|
|
4922
|
+
}
|
|
4923
|
+
|
|
4924
|
+
/** @internal */
|
|
4925
|
+
export const iterateEager = <S, A>() =>
|
|
4926
|
+
<X, E, R, E2>(options: IterateOptions<S, A, X, E, R, E2>): (
|
|
4712
4927
|
initialState: S,
|
|
4713
4928
|
items: ReadonlyArray<A>,
|
|
4714
|
-
|
|
4929
|
+
start?: number,
|
|
4930
|
+
end?: number
|
|
4715
4931
|
) => Effect.Effect<void, E | E2, R> | undefined => {
|
|
4716
4932
|
const onItem = options.onItem
|
|
4717
4933
|
const step = options.step
|
|
@@ -4719,8 +4935,8 @@ const iterateEagerImpl = <S, A, X, E, R, E2>(options: {
|
|
|
4719
4935
|
const runSequential = (
|
|
4720
4936
|
state: S,
|
|
4721
4937
|
items: ReadonlyArray<A>,
|
|
4722
|
-
index
|
|
4723
|
-
end
|
|
4938
|
+
index = 0,
|
|
4939
|
+
end = items.length
|
|
4724
4940
|
): Effect.Effect<void, E | E2, R> | undefined => {
|
|
4725
4941
|
for (; index < end; index++) {
|
|
4726
4942
|
const item = items[index]
|
|
@@ -4736,18 +4952,20 @@ const iterateEagerImpl = <S, A, X, E, R, E2>(options: {
|
|
|
4736
4952
|
}
|
|
4737
4953
|
}
|
|
4738
4954
|
|
|
4955
|
+
return runSequential
|
|
4956
|
+
}
|
|
4957
|
+
|
|
4958
|
+
const iterateConcurrentImpl = <S, A, X, E, R, E2>(options: IterateOptions<S, A, X, E, R, E2>) => {
|
|
4959
|
+
const onItem = options.onItem
|
|
4960
|
+
const step = options.step
|
|
4739
4961
|
return (
|
|
4740
4962
|
state: S,
|
|
4741
4963
|
items: ReadonlyArray<A>,
|
|
4742
|
-
opts:
|
|
4964
|
+
opts: { readonly concurrency: number; readonly end?: number | undefined }
|
|
4743
4965
|
): Effect.Effect<void, E | E2, R> | undefined => {
|
|
4744
4966
|
let index = 0
|
|
4745
|
-
const end = opts
|
|
4746
|
-
const concurrency = opts
|
|
4747
|
-
if (concurrency === 1) {
|
|
4748
|
-
return runSequential(state, items, 0, end)
|
|
4749
|
-
}
|
|
4750
|
-
const orderedStep = opts?.orderedStep === true && concurrency > 1
|
|
4967
|
+
const end = opts.end ?? items.length
|
|
4968
|
+
const concurrency = opts.concurrency
|
|
4751
4969
|
let done = false
|
|
4752
4970
|
let parentFiber: Fiber.Fiber<any, any> | undefined
|
|
4753
4971
|
let fibers: Set<Fiber.Fiber<any, any>> | undefined
|
|
@@ -4755,8 +4973,6 @@ const iterateEagerImpl = <S, A, X, E, R, E2>(options: {
|
|
|
4755
4973
|
let interrupted = false
|
|
4756
4974
|
let terminal: Exit.Exit<void, E | E2> | void
|
|
4757
4975
|
let effect: Effect.Effect<X, E, R> | undefined
|
|
4758
|
-
let nextIndex = index
|
|
4759
|
-
const exits: Array<Exit.Exit<X, E> | undefined> | undefined = orderedStep ? new Array(end) : undefined
|
|
4760
4976
|
|
|
4761
4977
|
const failDefect = (error: unknown): Effect.Effect<void, E | E2, R> => {
|
|
4762
4978
|
const defect = exitDie(error)
|
|
@@ -4768,20 +4984,6 @@ const iterateEagerImpl = <S, A, X, E, R, E2>(options: {
|
|
|
4768
4984
|
: defect
|
|
4769
4985
|
}
|
|
4770
4986
|
|
|
4771
|
-
const runStep = (item: A, exit: Exit.Exit<X, E>, currentIndex: number): Exit.Exit<void, E | E2> | void => {
|
|
4772
|
-
if (!orderedStep) return step(state, item, exit, currentIndex)
|
|
4773
|
-
if (terminal) return terminal
|
|
4774
|
-
exits![currentIndex] = exit
|
|
4775
|
-
while (nextIndex < end) {
|
|
4776
|
-
const nextExit = exits![nextIndex]
|
|
4777
|
-
if (nextExit === undefined) return
|
|
4778
|
-
exits![nextIndex] = undefined
|
|
4779
|
-
const index = nextIndex++
|
|
4780
|
-
const result = step(state, items[index], nextExit, index)
|
|
4781
|
-
if (result) return result
|
|
4782
|
-
}
|
|
4783
|
-
}
|
|
4784
|
-
|
|
4785
4987
|
const go = (): Effect.Effect<void, E | E2, R> | undefined => {
|
|
4786
4988
|
let paused = false
|
|
4787
4989
|
for (; !terminal && index < end; index++) {
|
|
@@ -4790,7 +4992,7 @@ const iterateEagerImpl = <S, A, X, E, R, E2>(options: {
|
|
|
4790
4992
|
|
|
4791
4993
|
// fast case (already an exit)
|
|
4792
4994
|
if (effectIsExit(eff)) {
|
|
4793
|
-
terminal =
|
|
4995
|
+
terminal = step(state, item, eff, index)
|
|
4794
4996
|
if (terminal) break
|
|
4795
4997
|
|
|
4796
4998
|
// We have an effect, so enter "async" mode
|
|
@@ -4821,7 +5023,7 @@ const iterateEagerImpl = <S, A, X, E, R, E2>(options: {
|
|
|
4821
5023
|
|
|
4822
5024
|
const fiber = forkUnsafe(parentFiber, eff, true, true, "inherit")
|
|
4823
5025
|
if (fiber._exit) {
|
|
4824
|
-
terminal =
|
|
5026
|
+
terminal = step(state, item, fiber._exit, index)
|
|
4825
5027
|
if (terminal) break
|
|
4826
5028
|
continue
|
|
4827
5029
|
}
|
|
@@ -4845,7 +5047,7 @@ const iterateEagerImpl = <S, A, X, E, R, E2>(options: {
|
|
|
4845
5047
|
}
|
|
4846
5048
|
}
|
|
4847
5049
|
} else {
|
|
4848
|
-
const result =
|
|
5050
|
+
const result = step(state, item, exit, currentIndex)
|
|
4849
5051
|
if (result) {
|
|
4850
5052
|
terminal = result._tag === "Failure"
|
|
4851
5053
|
? exitFailCause(causeFromReasons(result.cause.reasons.slice()))
|
|
@@ -4898,16 +5100,10 @@ const iterateEagerImpl = <S, A, X, E, R, E2>(options: {
|
|
|
4898
5100
|
}
|
|
4899
5101
|
|
|
4900
5102
|
/** @internal */
|
|
4901
|
-
export const
|
|
4902
|
-
|
|
4903
|
-
readonly step: (state: NoInfer<S>, item: A, exit: Exit.Exit<X, E>, index: number) => Exit.Exit<void, E2> | void
|
|
4904
|
-
}) => (
|
|
4905
|
-
initialState: S,
|
|
4906
|
-
items: ReadonlyArray<A>,
|
|
4907
|
-
options?: IterateEagerOptions
|
|
4908
|
-
) => Effect.Effect<void, E | E2, R> | undefined => iterateEagerImpl
|
|
5103
|
+
export const iterateConcurrent = <S, A>() => <X, E, R, E2>(options: IterateOptions<S, A, X, E, R, E2>) =>
|
|
5104
|
+
iterateConcurrentImpl<S, A, X, E, R, E2>(options)
|
|
4909
5105
|
|
|
4910
|
-
const forEachConcurrent =
|
|
5106
|
+
const forEachConcurrent = iterateConcurrentImpl({
|
|
4911
5107
|
onItem(
|
|
4912
5108
|
state: {
|
|
4913
5109
|
readonly f: (a: any, i: number) => Effect.Effect<any, any, any>
|
|
@@ -4926,7 +5122,7 @@ const forEachConcurrent = iterateEagerImpl({
|
|
|
4926
5122
|
}
|
|
4927
5123
|
})
|
|
4928
5124
|
|
|
4929
|
-
|
|
5125
|
+
/** @internal */
|
|
4930
5126
|
export const filterOrElse: {
|
|
4931
5127
|
<A, C, E2, R2, B extends A>(
|
|
4932
5128
|
refinement: Predicate.Refinement<NoInfer<A>, B>,
|
|
@@ -4982,7 +5178,7 @@ export const filterMapOrElse: {
|
|
|
4982
5178
|
}
|
|
4983
5179
|
))
|
|
4984
5180
|
|
|
4985
|
-
|
|
5181
|
+
/** @internal */
|
|
4986
5182
|
export const filterMapOrFail: {
|
|
4987
5183
|
<A, B, X, E2>(
|
|
4988
5184
|
filter: Filter.Filter<NoInfer<A>, B, X>,
|
|
@@ -5249,7 +5445,7 @@ export const forkUnsafe = <FA, FE, A, E, R>(
|
|
|
5249
5445
|
}
|
|
5250
5446
|
if (!daemon && !child._exit) {
|
|
5251
5447
|
parentRuntime.children().add(child)
|
|
5252
|
-
child.
|
|
5448
|
+
child._parent = parentRuntime
|
|
5253
5449
|
}
|
|
5254
5450
|
return child
|
|
5255
5451
|
}
|
|
@@ -5704,7 +5900,7 @@ export const makeSpanUnsafe = <XA, XE>(
|
|
|
5704
5900
|
? Option.some(options.parent)
|
|
5705
5901
|
: options?.root
|
|
5706
5902
|
? Option.none<Tracer.AnySpan>()
|
|
5707
|
-
: filterDisablePropagation(fiber.
|
|
5903
|
+
: filterDisablePropagation(fiber.cache.span)
|
|
5708
5904
|
|
|
5709
5905
|
let span: Tracer.Span
|
|
5710
5906
|
|
|
@@ -5737,7 +5933,7 @@ export const makeSpanUnsafe = <XA, XE>(
|
|
|
5737
5933
|
parent,
|
|
5738
5934
|
annotations: options?.annotations ?? Context.empty(),
|
|
5739
5935
|
links,
|
|
5740
|
-
startTime: timingEnabled ? clock.currentTimeNanosUnsafe() :
|
|
5936
|
+
startTime: timingEnabled ? clock.currentTimeNanosUnsafe() : bigint0,
|
|
5741
5937
|
kind: options?.kind ?? "internal",
|
|
5742
5938
|
root: options?.root ?? Option.isNone(parent),
|
|
5743
5939
|
sampled: options?.sampled ??
|
|
@@ -5881,7 +6077,10 @@ export const useSpan: {
|
|
|
5881
6077
|
const span = makeSpanUnsafe(fiber, name, options)
|
|
5882
6078
|
const clock = fiber.getRef(ClockRef)
|
|
5883
6079
|
const timingEnabled = fiber.getRef(TracerTimingEnabled)
|
|
5884
|
-
return onExit(
|
|
6080
|
+
return onExit(
|
|
6081
|
+
suspend(() => internalCall(() => evaluate(span))),
|
|
6082
|
+
(exit) => endSpan(span, exit, clock, timingEnabled)
|
|
6083
|
+
)
|
|
5885
6084
|
})
|
|
5886
6085
|
}
|
|
5887
6086
|
|
|
@@ -6191,7 +6390,7 @@ export class UnknownError extends TaggedError("UnknownError")<{
|
|
|
6191
6390
|
|
|
6192
6391
|
/** @internal */
|
|
6193
6392
|
export const ConsoleRef = Context.Reference<Console.Console>(
|
|
6194
|
-
"effect/Console
|
|
6393
|
+
"effect/Console",
|
|
6195
6394
|
{ defaultValue: (): Console.Console => globalThis.console }
|
|
6196
6395
|
)
|
|
6197
6396
|
|
|
@@ -6234,7 +6433,7 @@ export const isLogLevelGreaterThan = Order.isGreaterThan(LogLevelOrder)
|
|
|
6234
6433
|
/** @internal */
|
|
6235
6434
|
export const CurrentLoggers = Context.Reference<
|
|
6236
6435
|
ReadonlySet<Logger.Logger<unknown, any>>
|
|
6237
|
-
>("effect/
|
|
6436
|
+
>("effect/Logger/CurrentLoggers", {
|
|
6238
6437
|
defaultValue: () => new Set([defaultLogger, tracerLogger])
|
|
6239
6438
|
})
|
|
6240
6439
|
|
|
@@ -6264,7 +6463,7 @@ export const annotateLogsScoped: {
|
|
|
6264
6463
|
const next = { ...current }
|
|
6265
6464
|
for (let i = 0; i < entries.length; i++) {
|
|
6266
6465
|
const [key, value] = entries[i]
|
|
6267
|
-
if (current[key] !== value) continue
|
|
6466
|
+
if (current[key] !== value && !Object.is(current[key], value)) continue
|
|
6268
6467
|
if (Object.hasOwn(prev, key)) {
|
|
6269
6468
|
InternalRecord.assignProperty(next, key, prev[key])
|
|
6270
6469
|
} else {
|
|
@@ -6352,8 +6551,8 @@ export const logWithLevel = (level?: LogLevel.Severity) =>
|
|
|
6352
6551
|
cause = causeEmpty
|
|
6353
6552
|
}
|
|
6354
6553
|
return withFiber((fiber) => {
|
|
6355
|
-
const logLevel = level ?? fiber.
|
|
6356
|
-
if (isLogLevelGreaterThan(fiber.minimumLogLevel, logLevel)) {
|
|
6554
|
+
const logLevel = level ?? fiber.cache.logLevel
|
|
6555
|
+
if (isLogLevelGreaterThan(fiber.cache.minimumLogLevel, logLevel)) {
|
|
6357
6556
|
return void_
|
|
6358
6557
|
}
|
|
6359
6558
|
const clock = fiber.getRef(ClockRef)
|
|
@@ -6429,29 +6628,36 @@ export const consolePretty = (options?: {
|
|
|
6429
6628
|
}) => {
|
|
6430
6629
|
// evaluated lazily so the module-level bundle stays free of `process`
|
|
6431
6630
|
// property accesses, which bundlers must retain as possible side effects
|
|
6432
|
-
const process = (globalThis as {
|
|
6433
|
-
readonly process?: { readonly stdout?: { readonly isTTY?: boolean } }
|
|
6434
|
-
}).process
|
|
6631
|
+
const process = (globalThis as { readonly process?: { readonly stdout?: unknown } }).process
|
|
6435
6632
|
const hasProcessStdout = typeof process?.stdout === "object" && process.stdout !== null
|
|
6436
|
-
const
|
|
6437
|
-
|
|
6438
|
-
const
|
|
6439
|
-
|
|
6440
|
-
|
|
6441
|
-
const isBrowser = mode === "browser"
|
|
6442
|
-
const showColors = typeof options?.colors === "boolean" ? options.colors : processStdoutIsTTY || isBrowser
|
|
6443
|
-
const formatDate = options?.formatDate ?? defaultDateFormat
|
|
6444
|
-
return isBrowser
|
|
6445
|
-
? prettyLoggerBrowser({ colors: showColors, formatDate })
|
|
6446
|
-
: prettyLoggerTty({ colors: showColors, formatDate })
|
|
6633
|
+
const isDeno = "Deno" in globalThis
|
|
6634
|
+
const mode = options?.mode ?? "auto"
|
|
6635
|
+
const isTtyLogger = mode === "auto" ? hasProcessStdout || isDeno : mode === "tty"
|
|
6636
|
+
|
|
6637
|
+
return isTtyLogger ? prettyLoggerTty(options) : prettyLoggerBrowser(options)
|
|
6447
6638
|
}
|
|
6448
6639
|
|
|
6449
|
-
|
|
6450
|
-
|
|
6451
|
-
readonly
|
|
6640
|
+
/** @internal */
|
|
6641
|
+
export const prettyLoggerTty = (options?: {
|
|
6642
|
+
readonly colors?: "auto" | boolean | undefined
|
|
6643
|
+
readonly formatDate?: ((date: Date) => string) | undefined
|
|
6452
6644
|
}) => {
|
|
6453
|
-
const
|
|
6454
|
-
|
|
6645
|
+
const formatDate = options?.formatDate ?? defaultDateFormat
|
|
6646
|
+
// evaluated lazily so the module-level bundle stays free of `process`
|
|
6647
|
+
// property accesses, which bundlers must retain as possible side effects
|
|
6648
|
+
const process = (globalThis as {
|
|
6649
|
+
readonly process?: {
|
|
6650
|
+
readonly stdout?: { readonly isTTY?: unknown }
|
|
6651
|
+
readonly isBun?: boolean
|
|
6652
|
+
}
|
|
6653
|
+
}).process
|
|
6654
|
+
|
|
6655
|
+
const hasProcessStdout = typeof process?.stdout === "object" && process.stdout !== null
|
|
6656
|
+
const processStdoutIsTTY = hasProcessStdout && process.stdout.isTTY === true
|
|
6657
|
+
const showColors = typeof options?.colors === "boolean" ? options.colors : processStdoutIsTTY
|
|
6658
|
+
const color = showColors ? withColor : withColorNoop
|
|
6659
|
+
|
|
6660
|
+
const processIsBun = process?.isBun === true
|
|
6455
6661
|
return loggerMake<unknown, void>(
|
|
6456
6662
|
({ cause, date, fiber, logLevel, message: message_ }) => {
|
|
6457
6663
|
const console = fiber.getRef(ConsoleRef)
|
|
@@ -6460,7 +6666,7 @@ const prettyLoggerTty = (options: {
|
|
|
6460
6666
|
|
|
6461
6667
|
const message = Array.isArray(message_) ? message_.slice() : [message_]
|
|
6462
6668
|
|
|
6463
|
-
let firstLine = color(`[${
|
|
6669
|
+
let firstLine = color(`[${formatDate(date)}]`, colors.white)
|
|
6464
6670
|
+ ` ${color(logLevel.toUpperCase(), ...logLevelColors[logLevel])}`
|
|
6465
6671
|
+ ` (#${fiber.id})`
|
|
6466
6672
|
|
|
@@ -6505,24 +6711,27 @@ const prettyLoggerTty = (options: {
|
|
|
6505
6711
|
)
|
|
6506
6712
|
}
|
|
6507
6713
|
|
|
6508
|
-
|
|
6509
|
-
|
|
6510
|
-
readonly
|
|
6714
|
+
/** @internal */
|
|
6715
|
+
export const prettyLoggerBrowser = (options?: {
|
|
6716
|
+
readonly colors?: "auto" | boolean | undefined
|
|
6717
|
+
readonly formatDate?: ((date: Date) => string) | undefined
|
|
6511
6718
|
}) => {
|
|
6512
|
-
const
|
|
6719
|
+
const showColors = options?.colors !== false
|
|
6720
|
+
const color = showColors ? "%c" : ""
|
|
6721
|
+
const formatDate = options?.formatDate ?? defaultDateFormat
|
|
6513
6722
|
return loggerMake<unknown, void>(
|
|
6514
6723
|
({ cause, date, fiber, logLevel, message: message_ }) => {
|
|
6515
6724
|
const console = fiber.getRef(ConsoleRef)
|
|
6516
6725
|
|
|
6517
6726
|
const message = Array.isArray(message_) ? message_.slice() : [message_]
|
|
6518
6727
|
|
|
6519
|
-
let firstLine = `${color}[${
|
|
6728
|
+
let firstLine = `${color}[${formatDate(date)}]`
|
|
6520
6729
|
const firstParams = []
|
|
6521
|
-
if (
|
|
6730
|
+
if (showColors) {
|
|
6522
6731
|
firstParams.push("color:gray")
|
|
6523
6732
|
}
|
|
6524
6733
|
firstLine += ` ${color}${logLevel.toUpperCase()}${color} (#${fiber.id})`
|
|
6525
|
-
if (
|
|
6734
|
+
if (showColors) {
|
|
6526
6735
|
firstParams.push(logLevelStyle[logLevel], "")
|
|
6527
6736
|
}
|
|
6528
6737
|
|
|
@@ -6539,7 +6748,7 @@ const prettyLoggerBrowser = (options: {
|
|
|
6539
6748
|
const firstMaybeString = structuredMessage(message[0])
|
|
6540
6749
|
if (typeof firstMaybeString === "string") {
|
|
6541
6750
|
firstLine += ` ${color}${firstMaybeString}`
|
|
6542
|
-
if (
|
|
6751
|
+
if (showColors) {
|
|
6543
6752
|
firstParams.push("color:deepskyblue")
|
|
6544
6753
|
}
|
|
6545
6754
|
messageIndex++
|
|
@@ -6564,7 +6773,7 @@ const prettyLoggerBrowser = (options: {
|
|
|
6564
6773
|
const annotations = fiber.getRef(CurrentLogAnnotations)
|
|
6565
6774
|
for (const [key, value] of Object.entries(annotations)) {
|
|
6566
6775
|
const redacted = redact(value)
|
|
6567
|
-
if (
|
|
6776
|
+
if (showColors) {
|
|
6568
6777
|
// oxlint-disable-next-line no-console
|
|
6569
6778
|
console.log(`%c${key}:`, "color:gray", redacted)
|
|
6570
6779
|
} else {
|
|
@@ -6605,7 +6814,7 @@ export const defaultLogger = loggerMake<unknown, void>(({ cause, date, fiber, lo
|
|
|
6605
6814
|
export const tracerLogger = loggerMake<unknown, void>(({ cause, fiber, logLevel, message }) => {
|
|
6606
6815
|
const clock = fiber.getRef(ClockRef)
|
|
6607
6816
|
const annotations = fiber.getRef(CurrentLogAnnotations)
|
|
6608
|
-
const span = fiber.
|
|
6817
|
+
const span = fiber.cache.span
|
|
6609
6818
|
if (span === undefined || span._tag === "ExternalSpan") return
|
|
6610
6819
|
const attributes: Record<string, unknown> = {}
|
|
6611
6820
|
for (const [key, value] of Object.entries(annotations)) {
|
|
@@ -6650,7 +6859,7 @@ export const withErrorReporting: <
|
|
|
6650
6859
|
options?: {
|
|
6651
6860
|
readonly defectsOnly?: boolean | undefined
|
|
6652
6861
|
} | undefined
|
|
6653
|
-
) => [Arg] extends [Effect.Effect<infer
|
|
6862
|
+
) => [Arg] extends [Effect.Effect<infer A, infer E, infer R>] ? Effect.Effect<A, E, R>
|
|
6654
6863
|
: <A, E, R>(self: Effect.Effect<A, E, R>) => Effect.Effect<A, E, R> = dual(
|
|
6655
6864
|
(args) => isEffect(args[0]),
|
|
6656
6865
|
<A, E, R>(
|