effect 4.0.0-beta.3 → 4.0.0-beta.30
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Array.d.ts +126 -299
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +102 -62
- package/dist/Array.js.map +1 -1
- package/dist/Brand.d.ts +1 -1
- package/dist/Brand.d.ts.map +1 -1
- package/dist/Brand.js +1 -1
- package/dist/Brand.js.map +1 -1
- package/dist/Cache.d.ts +2 -2
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +6 -5
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +2 -2
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Channel.d.ts +116 -30
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +82 -37
- package/dist/Channel.js.map +1 -1
- package/dist/Chunk.d.ts +54 -247
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +36 -67
- package/dist/Chunk.js.map +1 -1
- package/dist/Combiner.d.ts +280 -13
- package/dist/Combiner.d.ts.map +1 -1
- package/dist/Combiner.js +198 -7
- package/dist/Combiner.js.map +1 -1
- package/dist/Config.d.ts +165 -9
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +65 -10
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +1 -1
- package/dist/Cron.d.ts +1 -1
- package/dist/Data.d.ts +535 -366
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js +132 -79
- package/dist/Data.js.map +1 -1
- package/dist/DateTime.d.ts +23 -161
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +6 -51
- package/dist/DateTime.js.map +1 -1
- package/dist/Duration.d.ts +11 -11
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +11 -11
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +1206 -924
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +390 -329
- package/dist/Effect.js.map +1 -1
- package/dist/Encoding.d.ts +194 -0
- package/dist/Encoding.d.ts.map +1 -0
- package/dist/Encoding.js +352 -0
- package/dist/Encoding.js.map +1 -0
- package/dist/Equal.d.ts +276 -109
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +124 -48
- package/dist/Equal.js.map +1 -1
- package/dist/ErrorReporter.d.ts +374 -0
- package/dist/ErrorReporter.d.ts.map +1 -0
- package/dist/ErrorReporter.js +244 -0
- package/dist/ErrorReporter.js.map +1 -0
- package/dist/Exit.d.ts +24 -12
- package/dist/Exit.d.ts.map +1 -1
- package/dist/Exit.js +8 -4
- package/dist/Exit.js.map +1 -1
- package/dist/Fiber.d.ts +3 -2
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js.map +1 -1
- package/dist/FileSystem.d.ts +1 -1
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +5 -5
- package/dist/FileSystem.js.map +1 -1
- package/dist/Filter.d.ts +34 -38
- package/dist/Filter.d.ts.map +1 -1
- package/dist/Filter.js +15 -13
- package/dist/Filter.js.map +1 -1
- package/dist/Formatter.d.ts +131 -47
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +229 -51
- package/dist/Formatter.js.map +1 -1
- package/dist/Function.d.ts +1 -9
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +2 -10
- package/dist/Function.js.map +1 -1
- package/dist/Graph.d.ts +1 -1
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +5 -8
- package/dist/Graph.js.map +1 -1
- package/dist/HashMap.d.ts +15 -14
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashMap.js +4 -4
- package/dist/HashMap.js.map +1 -1
- package/dist/Iterable.d.ts +39 -39
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +94 -22
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonSchema.d.ts +299 -10
- package/dist/JsonSchema.d.ts.map +1 -1
- package/dist/JsonSchema.js +323 -4
- package/dist/JsonSchema.js.map +1 -1
- package/dist/Latch.d.ts +109 -0
- package/dist/Latch.d.ts.map +1 -0
- package/dist/Latch.js +72 -0
- package/dist/Latch.js.map +1 -0
- package/dist/Layer.d.ts +121 -126
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +43 -44
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +8 -8
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +3 -3
- package/dist/LogLevel.d.ts +32 -0
- package/dist/LogLevel.d.ts.map +1 -1
- package/dist/LogLevel.js +28 -100
- package/dist/LogLevel.js.map +1 -1
- package/dist/Logger.d.ts +29 -95
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +2 -3
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +2 -2
- package/dist/ManagedRuntime.js +2 -2
- package/dist/Metric.d.ts +4 -6
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +3 -5
- package/dist/Metric.js.map +1 -1
- package/dist/Newtype.d.ts +291 -0
- package/dist/Newtype.d.ts.map +1 -0
- package/dist/Newtype.js +161 -0
- package/dist/Newtype.js.map +1 -0
- package/dist/Optic.d.ts +947 -18
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +454 -5
- package/dist/Optic.js.map +1 -1
- package/dist/Option.d.ts +23 -16
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +15 -9
- package/dist/Option.js.map +1 -1
- package/dist/Pipeable.d.ts +17 -0
- package/dist/Pipeable.d.ts.map +1 -1
- package/dist/Pipeable.js +19 -1
- package/dist/Pipeable.js.map +1 -1
- package/dist/PlatformError.d.ts +10 -9
- package/dist/PlatformError.d.ts.map +1 -1
- package/dist/PlatformError.js +2 -2
- package/dist/PlatformError.js.map +1 -1
- package/dist/Pool.d.ts +6 -4
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +7 -5
- package/dist/Pool.js.map +1 -1
- package/dist/PubSub.d.ts +3 -2
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +3 -2
- package/dist/PubSub.js.map +1 -1
- package/dist/Pull.d.ts.map +1 -1
- package/dist/Pull.js +1 -1
- package/dist/Pull.js.map +1 -1
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +0 -1
- package/dist/Queue.js.map +1 -1
- package/dist/Random.d.ts +35 -1
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +46 -12
- package/dist/Random.js.map +1 -1
- package/dist/RcMap.d.ts +2 -2
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +1 -1
- package/dist/RcMap.js.map +1 -1
- package/dist/RcRef.d.ts +1 -1
- package/dist/RcRef.d.ts.map +1 -1
- package/dist/Record.d.ts +23 -120
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +21 -41
- package/dist/Record.js.map +1 -1
- package/dist/Reducer.d.ts +166 -7
- package/dist/Reducer.d.ts.map +1 -1
- package/dist/Reducer.js +135 -1
- package/dist/Reducer.js.map +1 -1
- package/dist/References.d.ts +9 -4
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +6 -1
- package/dist/References.js.map +1 -1
- package/dist/Request.d.ts +1 -1
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js +2 -1
- package/dist/Request.js.map +1 -1
- package/dist/RequestResolver.d.ts +25 -45
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +10 -30
- 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 -2
- package/dist/Result.js.map +1 -1
- package/dist/Runtime.d.ts +66 -0
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +79 -6
- package/dist/Runtime.js.map +1 -1
- package/dist/Schedule.d.ts +191 -102
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +152 -66
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts +9 -0
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +11 -0
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +309 -88
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +499 -109
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +129 -23
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +5 -5
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +12 -14
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaParser.d.ts +5 -0
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +10 -0
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +44 -43
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +49 -24
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +107 -3
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +159 -4
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/ScopedCache.d.ts +2 -2
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedCache.js +1 -1
- package/dist/ScopedCache.js.map +1 -1
- package/dist/Semaphore.d.ts +211 -0
- package/dist/Semaphore.d.ts.map +1 -0
- package/dist/{PartitionedSemaphore.js → Semaphore.js} +97 -13
- package/dist/Semaphore.js.map +1 -0
- package/dist/ServiceMap.d.ts +41 -31
- package/dist/ServiceMap.d.ts.map +1 -1
- package/dist/ServiceMap.js +3 -3
- package/dist/ServiceMap.js.map +1 -1
- package/dist/Sink.d.ts +13 -13
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +53 -6
- package/dist/Sink.js.map +1 -1
- package/dist/Stdio.d.ts +16 -4
- package/dist/Stdio.d.ts.map +1 -1
- package/dist/Stdio.js +18 -0
- package/dist/Stdio.js.map +1 -1
- package/dist/Stream.d.ts +250 -428
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +137 -82
- package/dist/Stream.js.map +1 -1
- package/dist/Struct.d.ts +16 -0
- package/dist/Struct.d.ts.map +1 -1
- package/dist/Struct.js +22 -0
- package/dist/Struct.js.map +1 -1
- package/dist/SubscriptionRef.d.ts +2 -1
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +2 -1
- package/dist/SubscriptionRef.js.map +1 -1
- package/dist/SynchronizedRef.d.ts +2 -1
- package/dist/SynchronizedRef.d.ts.map +1 -1
- package/dist/SynchronizedRef.js +2 -1
- package/dist/SynchronizedRef.js.map +1 -1
- package/dist/Trie.d.ts +18 -17
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js +5 -5
- package/dist/Trie.js.map +1 -1
- package/dist/TxChunk.d.ts +37 -37
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxChunk.js +3 -3
- package/dist/TxChunk.js.map +1 -1
- package/dist/TxDeferred.d.ts +328 -0
- package/dist/TxDeferred.d.ts.map +1 -0
- package/dist/TxDeferred.js +196 -0
- package/dist/TxDeferred.js.map +1 -0
- package/dist/TxHashMap.d.ts +84 -83
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +24 -24
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxHashSet.d.ts +35 -35
- package/dist/TxHashSet.d.ts.map +1 -1
- package/dist/TxHashSet.js +14 -14
- package/dist/TxHashSet.js.map +1 -1
- package/dist/TxPriorityQueue.d.ts +609 -0
- package/dist/TxPriorityQueue.d.ts.map +1 -0
- package/dist/TxPriorityQueue.js +415 -0
- package/dist/TxPriorityQueue.js.map +1 -0
- package/dist/TxPubSub.d.ts +585 -0
- package/dist/TxPubSub.d.ts.map +1 -0
- package/dist/TxPubSub.js +521 -0
- package/dist/TxPubSub.js.map +1 -0
- package/dist/TxQueue.d.ts +32 -32
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxQueue.js +26 -26
- package/dist/TxQueue.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +523 -0
- package/dist/TxReentrantLock.d.ts.map +1 -0
- package/dist/TxReentrantLock.js +504 -0
- package/dist/TxReentrantLock.js.map +1 -0
- package/dist/TxRef.d.ts +34 -34
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +21 -14
- package/dist/TxRef.js.map +1 -1
- package/dist/TxSemaphore.d.ts +8 -8
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +7 -7
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/TxSubscriptionRef.d.ts +508 -0
- package/dist/TxSubscriptionRef.d.ts.map +1 -0
- package/dist/TxSubscriptionRef.js +293 -0
- package/dist/TxSubscriptionRef.js.map +1 -0
- package/dist/Types.d.ts +80 -23
- package/dist/Types.d.ts.map +1 -1
- package/dist/Utils.d.ts +137 -65
- package/dist/Utils.d.ts.map +1 -1
- package/dist/Utils.js +38 -66
- package/dist/Utils.js.map +1 -1
- package/dist/index.d.ts +718 -23
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +718 -23
- package/dist/index.js.map +1 -1
- package/dist/internal/core.js +11 -3
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/dateTime.js +3 -11
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/effect.js +264 -126
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/hashMap.js +5 -4
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/random.d.ts +2 -0
- package/dist/internal/random.d.ts.map +1 -0
- package/dist/internal/random.js +13 -0
- package/dist/internal/random.js.map +1 -0
- package/dist/internal/rcRef.js +3 -2
- package/dist/internal/rcRef.js.map +1 -1
- package/dist/internal/request.js +2 -2
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/schema/annotations.js +2 -0
- package/dist/internal/schema/annotations.js.map +1 -1
- package/dist/internal/schema/representation.js +47 -106
- package/dist/internal/schema/representation.js.map +1 -1
- package/dist/internal/schema/schema.js +1 -0
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/internal/schema/to-codec.js +7 -10
- package/dist/internal/schema/to-codec.js.map +1 -1
- package/dist/internal/trie.js +5 -4
- package/dist/internal/trie.js.map +1 -1
- package/dist/testing/TestClock.d.ts +8 -7
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestClock.js +6 -4
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +266 -32
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/testing/TestSchema.js +296 -23
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/testing/index.d.ts +64 -1
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +64 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +134 -51
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +19 -16
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +5 -5
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +38 -44
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +16 -30
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +97 -37
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +183 -88
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +57 -12
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +66 -13
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +193 -51
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Model.d.ts +25 -7
- package/dist/unstable/ai/Model.d.ts.map +1 -1
- package/dist/unstable/ai/Model.js +22 -6
- package/dist/unstable/ai/Model.js.map +1 -1
- package/dist/unstable/ai/Prompt.d.ts +20 -20
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Response.d.ts +26 -26
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js +1 -1
- package/dist/unstable/ai/Response.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +20 -4
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +14 -9
- 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 +4 -11
- package/dist/unstable/ai/Toolkit.js.map +1 -1
- package/dist/unstable/ai/index.d.ts +1 -1
- package/dist/unstable/ai/index.js +1 -1
- package/dist/unstable/ai/internal/codec-transformer.js +0 -5
- package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +27 -60
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +25 -57
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/CliOutput.js +59 -6
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +368 -56
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +325 -64
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +125 -0
- package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -0
- package/dist/unstable/cli/GlobalFlag.js +118 -0
- package/dist/unstable/cli/GlobalFlag.js.map +1 -0
- package/dist/unstable/cli/HelpDoc.d.ts +70 -2
- package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +1 -1
- package/dist/unstable/cli/Primitive.js +1 -1
- package/dist/unstable/cli/Prompt.js +35 -8
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/index.d.ts +4 -0
- package/dist/unstable/cli/index.d.ts.map +1 -1
- package/dist/unstable/cli/index.js +4 -0
- package/dist/unstable/cli/index.js.map +1 -1
- package/dist/unstable/cli/internal/command.d.ts +40 -14
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +72 -46
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/completions/CommandDescriptor.js +7 -2
- package/dist/unstable/cli/internal/completions/CommandDescriptor.js.map +1 -1
- package/dist/unstable/cli/internal/config.js +42 -0
- package/dist/unstable/cli/internal/config.js.map +1 -1
- package/dist/unstable/cli/internal/help.d.ts +33 -0
- package/dist/unstable/cli/internal/help.d.ts.map +1 -0
- package/dist/unstable/cli/internal/help.js +125 -0
- package/dist/unstable/cli/internal/help.js.map +1 -0
- package/dist/unstable/cli/internal/parser.js +55 -42
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cluster/ClusterCron.d.ts +1 -1
- package/dist/unstable/cluster/ClusterCron.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterCron.js +1 -1
- package/dist/unstable/cluster/ClusterCron.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +4 -3
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +7 -6
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/EntityResource.d.ts +2 -2
- package/dist/unstable/cluster/EntityResource.d.ts.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts +1 -1
- package/dist/unstable/cluster/K8sHttpClient.d.ts +1 -1
- package/dist/unstable/cluster/K8sHttpClient.js +4 -4
- package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +10 -10
- package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/MessageStorage.js +2 -1
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts +6 -6
- package/dist/unstable/cluster/Runner.d.ts +1 -1
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +4 -3
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts +2 -2
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +9 -7
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +21 -21
- package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.js +20 -20
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +5 -4
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/cluster/internal/entityReaper.js +2 -1
- package/dist/unstable/cluster/internal/entityReaper.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceRef.js +2 -1
- package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.d.ts +36 -36
- package/dist/unstable/encoding/Msgpack.d.ts +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts +1 -1
- package/dist/unstable/encoding/Sse.d.ts +4 -4
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.js +1 -1
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +2 -2
- package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLog.js +2 -1
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +6 -6
- package/dist/unstable/http/Cookies.d.ts +47 -3
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +24 -2
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts +16 -0
- package/dist/unstable/http/Headers.d.ts.map +1 -1
- package/dist/unstable/http/Headers.js +38 -10
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpBody.d.ts +3 -3
- package/dist/unstable/http/HttpBody.d.ts.map +1 -1
- package/dist/unstable/http/HttpBody.js +6 -6
- package/dist/unstable/http/HttpBody.js.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts +117 -15
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +189 -12
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientError.d.ts +7 -7
- package/dist/unstable/http/HttpClientRequest.d.ts +16 -11
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +31 -20
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts +2 -1
- package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientResponse.js +4 -0
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts +7 -5
- package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
- package/dist/unstable/http/HttpEffect.js +46 -54
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/HttpMethod.d.ts +4 -4
- package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
- package/dist/unstable/http/HttpMethod.js +3 -3
- package/dist/unstable/http/HttpMethod.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts +1 -6
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +8 -17
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +20 -33
- package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerError.js +37 -44
- package/dist/unstable/http/HttpServerError.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +12 -1
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +291 -1
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.d.ts +2 -2
- package/dist/unstable/http/HttpServerRespondable.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.js +5 -5
- package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +50 -3
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +234 -1
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpStaticServer.d.ts +69 -0
- package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -0
- package/dist/unstable/http/HttpStaticServer.js +353 -0
- package/dist/unstable/http/HttpStaticServer.js.map +1 -0
- package/dist/unstable/http/Multipart.d.ts +3 -3
- package/dist/unstable/http/UrlParams.d.ts +14 -6
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +1 -1
- 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/preResponseHandler.d.ts +2 -0
- package/dist/unstable/http/internal/preResponseHandler.d.ts.map +1 -0
- package/dist/unstable/http/internal/preResponseHandler.js +10 -0
- package/dist/unstable/http/internal/preResponseHandler.js.map +1 -0
- package/dist/unstable/httpapi/HttpApi.d.ts +4 -4
- package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +11 -5
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +28 -18
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +66 -6
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +40 -3
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +41 -54
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.js +17 -26
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +16 -14
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.js +44 -29
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.d.ts +4 -3
- package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +4 -4
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts +6 -0
- package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts +2 -2
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +32 -21
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/observability/Otlp.d.ts +12 -12
- package/dist/unstable/observability/Otlp.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts +2 -2
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +1 -1
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.d.ts +4 -4
- package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js +7 -4
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts +4 -4
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.d.ts +4 -4
- package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +1 -1
- package/dist/unstable/persistence/KeyValueStore.js +6 -6
- package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
- package/dist/unstable/persistence/Persistable.d.ts +2 -2
- package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedCache.d.ts +6 -5
- package/dist/unstable/persistence/PersistedCache.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedCache.js +2 -1
- package/dist/unstable/persistence/PersistedCache.js.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts +12 -12
- package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.js +12 -11
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/Persistence.d.ts +1 -1
- package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistence.js +2 -2
- package/dist/unstable/persistence/Persistence.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +3 -3
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +1 -1
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/process/ChildProcess.d.ts +5 -128
- package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcess.js +1 -65
- package/dist/unstable/process/ChildProcess.js.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.d.ts +45 -7
- package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js +21 -1
- package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +73 -12
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +107 -20
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +10 -12
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.js +42 -12
- package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.d.ts +6 -0
- package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +50 -9
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts +9 -9
- package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.js +47 -21
- package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
- package/dist/unstable/reactivity/Hydration.d.ts +39 -0
- package/dist/unstable/reactivity/Hydration.d.ts.map +1 -0
- package/dist/unstable/reactivity/Hydration.js +76 -0
- package/dist/unstable/reactivity/Hydration.js.map +1 -0
- package/dist/unstable/reactivity/index.d.ts +4 -0
- package/dist/unstable/reactivity/index.d.ts.map +1 -1
- package/dist/unstable/reactivity/index.js +4 -0
- package/dist/unstable/reactivity/index.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +5 -5
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts +5 -26
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +6 -13
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcGroup.d.ts +2 -2
- package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcGroup.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts +8 -8
- package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts +13 -0
- package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSchema.js +14 -0
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +34 -9
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +5 -9
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +17 -17
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/rpc/Utils.d.ts.map +1 -1
- package/dist/unstable/rpc/Utils.js +3 -2
- package/dist/unstable/rpc/Utils.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts +22 -1
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js +15 -0
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +5 -5
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.js +6 -6
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +4 -4
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +6 -5
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/socket/SocketServer.d.ts +3 -3
- package/dist/unstable/sql/Migrator.d.ts +1 -1
- package/dist/unstable/sql/SqlClient.d.ts +1 -1
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlError.d.ts +14 -14
- package/dist/unstable/sql/SqlError.d.ts.map +1 -1
- package/dist/unstable/sql/SqlError.js +9 -3
- package/dist/unstable/sql/SqlError.js.map +1 -1
- package/dist/unstable/sql/SqlModel.d.ts +2 -2
- package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
- package/dist/unstable/sql/SqlModel.js +3 -3
- package/dist/unstable/sql/SqlModel.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
- package/dist/unstable/sql/SqlResolver.js +17 -8
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/sql/SqlSchema.d.ts +17 -6
- package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
- package/dist/unstable/sql/SqlSchema.js +17 -7
- package/dist/unstable/sql/SqlSchema.js.map +1 -1
- package/dist/unstable/sql/Statement.js +0 -1
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/workers/Worker.d.ts.map +1 -1
- package/dist/unstable/workers/Worker.js +2 -1
- package/dist/unstable/workers/Worker.js.map +1 -1
- package/dist/unstable/workflow/DurableClock.d.ts +3 -3
- package/dist/unstable/workflow/DurableClock.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableClock.js +3 -3
- package/dist/unstable/workflow/DurableClock.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.js +2 -2
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +3 -3
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js +1 -1
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +12 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +137 -1
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/package.json +2 -2
- package/src/Array.ts +192 -342
- package/src/Brand.ts +1 -1
- package/src/Cache.ts +9 -8
- package/src/Cause.ts +2 -2
- package/src/Channel.ts +554 -138
- package/src/Chunk.ts +81 -268
- package/src/Combiner.ts +280 -13
- package/src/Config.ts +186 -24
- package/src/Data.ts +539 -376
- package/src/DateTime.ts +24 -164
- package/src/Duration.ts +13 -13
- package/src/Effect.ts +1477 -1126
- package/src/Encoding.ts +879 -0
- package/src/Equal.ts +278 -111
- package/src/ErrorReporter.ts +457 -0
- package/src/Exit.ts +24 -12
- package/src/Fiber.ts +10 -2
- package/src/FileSystem.ts +7 -8
- package/src/Filter.ts +52 -63
- package/src/Formatter.ts +253 -51
- package/src/Function.ts +2 -10
- package/src/Graph.ts +24 -11
- package/src/HashMap.ts +15 -14
- package/src/Iterable.ts +104 -50
- package/src/JsonSchema.ts +383 -10
- package/src/Latch.ts +112 -0
- package/src/Layer.ts +123 -132
- package/src/LayerMap.ts +9 -9
- package/src/LogLevel.ts +37 -0
- package/src/Logger.ts +33 -100
- package/src/ManagedRuntime.ts +2 -2
- package/src/Metric.ts +6 -8
- package/src/Newtype.ts +308 -0
- package/src/Optic.ts +948 -19
- package/src/Option.ts +32 -24
- package/src/Pipeable.ts +32 -1
- package/src/PlatformError.ts +5 -5
- package/src/Pool.ts +13 -11
- package/src/PubSub.ts +10 -9
- package/src/Pull.ts +1 -1
- package/src/Queue.ts +0 -1
- package/src/Random.ts +51 -14
- package/src/RcMap.ts +5 -5
- package/src/RcRef.ts +1 -1
- package/src/Record.ts +42 -152
- package/src/Reducer.ts +166 -7
- package/src/References.ts +10 -5
- package/src/Request.ts +3 -2
- package/src/RequestResolver.ts +29 -49
- package/src/Result.ts +2 -4
- package/src/Runtime.ts +102 -6
- package/src/Schedule.ts +462 -242
- package/src/Scheduler.ts +12 -0
- package/src/Schema.ts +796 -194
- package/src/SchemaAST.ts +164 -31
- package/src/SchemaGetter.ts +15 -17
- package/src/SchemaParser.ts +11 -0
- package/src/SchemaRepresentation.ts +49 -24
- package/src/SchemaTransformation.ts +189 -4
- package/src/ScopedCache.ts +3 -3
- package/src/Semaphore.ts +356 -0
- package/src/ServiceMap.ts +50 -40
- package/src/Sink.ts +78 -26
- package/src/Stdio.ts +27 -4
- package/src/Stream.ts +586 -608
- package/src/Struct.ts +26 -0
- package/src/SubscriptionRef.ts +3 -2
- package/src/SynchronizedRef.ts +3 -2
- package/src/Trie.ts +18 -17
- package/src/TxChunk.ts +72 -53
- package/src/TxDeferred.ts +394 -0
- package/src/TxHashMap.ts +332 -285
- package/src/TxHashSet.ts +111 -116
- package/src/TxPriorityQueue.ts +767 -0
- package/src/TxPubSub.ts +789 -0
- package/src/TxQueue.ts +241 -251
- package/src/TxReentrantLock.ts +753 -0
- package/src/TxRef.ts +50 -38
- package/src/TxSemaphore.ts +29 -32
- package/src/TxSubscriptionRef.ts +639 -0
- package/src/Types.ts +73 -19
- package/src/Utils.ts +137 -111
- package/src/index.ts +728 -24
- package/src/internal/core.ts +12 -5
- package/src/internal/dateTime.ts +9 -30
- package/src/internal/effect.ts +774 -301
- package/src/internal/hashMap.ts +8 -7
- package/src/internal/random.ts +20 -0
- package/src/internal/rcRef.ts +4 -3
- package/src/internal/request.ts +2 -2
- package/src/internal/schema/annotations.ts +2 -0
- package/src/internal/schema/representation.ts +45 -94
- package/src/internal/schema/schema.ts +1 -0
- package/src/internal/schema/to-codec.ts +7 -17
- package/src/internal/trie.ts +15 -9
- package/src/testing/TestClock.ts +13 -11
- package/src/testing/TestSchema.ts +332 -35
- package/src/testing/index.ts +64 -1
- package/src/unstable/ai/AiError.ts +105 -48
- package/src/unstable/ai/Chat.ts +47 -61
- package/src/unstable/ai/LanguageModel.ts +153 -68
- package/src/unstable/ai/McpSchema.ts +73 -13
- package/src/unstable/ai/McpServer.ts +271 -61
- package/src/unstable/ai/Model.ts +40 -9
- package/src/unstable/ai/Prompt.ts +37 -37
- package/src/unstable/ai/Response.ts +25 -25
- package/src/unstable/ai/Tool.ts +20 -14
- package/src/unstable/ai/Toolkit.ts +5 -14
- package/src/unstable/ai/index.ts +1 -1
- package/src/unstable/ai/internal/codec-transformer.ts +0 -7
- package/src/unstable/cli/CliError.ts +47 -59
- package/src/unstable/cli/CliOutput.ts +75 -6
- package/src/unstable/cli/Command.ts +796 -187
- package/src/unstable/cli/GlobalFlag.ts +243 -0
- package/src/unstable/cli/HelpDoc.ts +80 -2
- package/src/unstable/cli/Primitive.ts +1 -1
- package/src/unstable/cli/Prompt.ts +31 -9
- package/src/unstable/cli/index.ts +5 -0
- package/src/unstable/cli/internal/command.ts +109 -63
- package/src/unstable/cli/internal/completions/CommandDescriptor.ts +7 -2
- package/src/unstable/cli/internal/config.ts +49 -0
- package/src/unstable/cli/internal/help.ts +171 -0
- package/src/unstable/cli/internal/parser.ts +66 -61
- package/src/unstable/cluster/ClusterCron.ts +2 -2
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +5 -4
- package/src/unstable/cluster/Entity.ts +11 -10
- package/src/unstable/cluster/EntityResource.ts +4 -4
- package/src/unstable/cluster/Envelope.ts +1 -1
- package/src/unstable/cluster/K8sHttpClient.ts +5 -5
- package/src/unstable/cluster/MessageStorage.ts +3 -5
- package/src/unstable/cluster/Runners.ts +6 -5
- package/src/unstable/cluster/Sharding.ts +12 -10
- package/src/unstable/cluster/ShardingConfig.ts +30 -31
- package/src/unstable/cluster/SqlRunnerStorage.ts +1 -1
- package/src/unstable/cluster/internal/entityManager.ts +9 -8
- package/src/unstable/cluster/internal/entityReaper.ts +2 -1
- package/src/unstable/cluster/internal/resourceRef.ts +2 -1
- package/src/unstable/encoding/Sse.ts +3 -5
- package/src/unstable/eventlog/EventLog.ts +2 -1
- package/src/unstable/http/Cookies.ts +87 -3
- package/src/unstable/http/Headers.ts +62 -13
- package/src/unstable/http/HttpBody.ts +6 -6
- package/src/unstable/http/HttpClient.ts +374 -33
- package/src/unstable/http/HttpClientRequest.ts +38 -30
- package/src/unstable/http/HttpClientResponse.ts +7 -2
- package/src/unstable/http/HttpEffect.ts +54 -68
- package/src/unstable/http/HttpMethod.ts +16 -4
- package/src/unstable/http/HttpMiddleware.ts +9 -24
- package/src/unstable/http/HttpServerError.ts +42 -45
- package/src/unstable/http/HttpServerRequest.ts +389 -2
- package/src/unstable/http/HttpServerRespondable.ts +6 -6
- package/src/unstable/http/HttpServerResponse.ts +337 -4
- package/src/unstable/http/HttpStaticServer.ts +456 -0
- package/src/unstable/http/Multipart.ts +2 -2
- package/src/unstable/http/UrlParams.ts +20 -5
- package/src/unstable/http/index.ts +5 -0
- package/src/unstable/http/internal/preResponseHandler.ts +15 -0
- package/src/unstable/httpapi/HttpApi.ts +6 -6
- package/src/unstable/httpapi/HttpApiBuilder.ts +81 -28
- package/src/unstable/httpapi/HttpApiClient.ts +100 -11
- package/src/unstable/httpapi/HttpApiEndpoint.ts +71 -87
- package/src/unstable/httpapi/HttpApiError.ts +51 -28
- package/src/unstable/httpapi/HttpApiGroup.ts +7 -6
- package/src/unstable/httpapi/HttpApiMiddleware.ts +4 -4
- package/src/unstable/httpapi/HttpApiScalar.ts +6 -0
- package/src/unstable/httpapi/HttpApiSecurity.ts +3 -3
- package/src/unstable/httpapi/OpenApi.ts +41 -23
- package/src/unstable/observability/Otlp.ts +12 -12
- package/src/unstable/observability/OtlpExporter.ts +3 -3
- package/src/unstable/observability/OtlpLogger.ts +13 -9
- package/src/unstable/observability/OtlpMetrics.ts +4 -4
- package/src/unstable/observability/OtlpTracer.ts +4 -4
- package/src/unstable/persistence/KeyValueStore.ts +6 -6
- package/src/unstable/persistence/Persistable.ts +2 -2
- package/src/unstable/persistence/PersistedCache.ts +20 -9
- package/src/unstable/persistence/PersistedQueue.ts +25 -24
- package/src/unstable/persistence/Persistence.ts +3 -3
- package/src/unstable/persistence/RateLimiter.ts +4 -4
- package/src/unstable/process/ChildProcess.ts +6 -208
- package/src/unstable/process/ChildProcessSpawner.ts +75 -14
- package/src/unstable/reactivity/Atom.ts +211 -50
- package/src/unstable/reactivity/AtomHttpApi.ts +66 -31
- package/src/unstable/reactivity/AtomRegistry.ts +61 -9
- package/src/unstable/reactivity/AtomRpc.ts +51 -20
- package/src/unstable/reactivity/Hydration.ts +112 -0
- package/src/unstable/reactivity/index.ts +5 -0
- package/src/unstable/rpc/Rpc.ts +7 -9
- package/src/unstable/rpc/RpcClient.ts +12 -54
- package/src/unstable/rpc/RpcGroup.ts +4 -4
- package/src/unstable/rpc/RpcMiddleware.ts +15 -9
- package/src/unstable/rpc/RpcSchema.ts +17 -0
- package/src/unstable/rpc/RpcSerialization.ts +44 -9
- package/src/unstable/rpc/RpcServer.ts +28 -32
- package/src/unstable/rpc/Utils.ts +3 -2
- package/src/unstable/schema/Model.ts +31 -0
- package/src/unstable/schema/VariantSchema.ts +9 -9
- package/src/unstable/socket/Socket.ts +16 -17
- package/src/unstable/sql/SqlClient.ts +1 -1
- package/src/unstable/sql/SqlError.ts +11 -9
- package/src/unstable/sql/SqlModel.ts +5 -5
- package/src/unstable/sql/SqlResolver.ts +17 -7
- package/src/unstable/sql/SqlSchema.ts +42 -26
- package/src/unstable/sql/Statement.ts +0 -1
- package/src/unstable/workers/Worker.ts +2 -1
- package/src/unstable/workflow/DurableClock.ts +8 -8
- package/src/unstable/workflow/DurableDeferred.ts +2 -2
- package/src/unstable/workflow/Workflow.ts +6 -2
- package/src/unstable/workflow/WorkflowEngine.ts +185 -2
- package/dist/PartitionedSemaphore.d.ts +0 -52
- package/dist/PartitionedSemaphore.d.ts.map +0 -1
- package/dist/PartitionedSemaphore.js.map +0 -1
- package/dist/encoding/Base64.d.ts +0 -67
- package/dist/encoding/Base64.d.ts.map +0 -1
- package/dist/encoding/Base64.js +0 -146
- package/dist/encoding/Base64.js.map +0 -1
- package/dist/encoding/Base64Url.d.ts +0 -60
- package/dist/encoding/Base64Url.d.ts.map +0 -1
- package/dist/encoding/Base64Url.js +0 -89
- package/dist/encoding/Base64Url.js.map +0 -1
- package/dist/encoding/EncodingError.d.ts +0 -31
- package/dist/encoding/EncodingError.d.ts.map +0 -1
- package/dist/encoding/EncodingError.js +0 -22
- package/dist/encoding/EncodingError.js.map +0 -1
- package/dist/encoding/Hex.d.ts +0 -61
- package/dist/encoding/Hex.d.ts.map +0 -1
- package/dist/encoding/Hex.js +0 -115
- package/dist/encoding/Hex.js.map +0 -1
- package/dist/encoding/index.d.ts +0 -26
- package/dist/encoding/index.d.ts.map +0 -1
- package/dist/encoding/index.js +0 -27
- package/dist/encoding/index.js.map +0 -1
- package/dist/unstable/cli/internal/builtInFlags.d.ts +0 -7
- package/dist/unstable/cli/internal/builtInFlags.d.ts.map +0 -1
- package/dist/unstable/cli/internal/builtInFlags.js +0 -44
- package/dist/unstable/cli/internal/builtInFlags.js.map +0 -1
- package/src/PartitionedSemaphore.ts +0 -182
- package/src/encoding/Base64.ts +0 -366
- package/src/encoding/Base64Url.ts +0 -104
- package/src/encoding/EncodingError.ts +0 -35
- package/src/encoding/Hex.ts +0 -390
- package/src/encoding/index.ts +0 -31
- package/src/unstable/cli/internal/builtInFlags.ts +0 -78
|
@@ -3,10 +3,11 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import type { NonEmptyReadonlyArray } from "../../Array.ts"
|
|
5
5
|
import * as Cause from "../../Cause.ts"
|
|
6
|
+
import { Clock } from "../../Clock.ts"
|
|
7
|
+
import * as Duration from "../../Duration.ts"
|
|
6
8
|
import * as Effect from "../../Effect.ts"
|
|
7
|
-
import * as
|
|
8
|
-
import
|
|
9
|
-
import { constFalse, constTrue, dual, flow, identity } from "../../Function.ts"
|
|
9
|
+
import * as Fiber from "../../Fiber.ts"
|
|
10
|
+
import { constant, constFalse, constTrue, dual, flow, identity } from "../../Function.ts"
|
|
10
11
|
import * as Inspectable from "../../Inspectable.ts"
|
|
11
12
|
import * as Layer from "../../Layer.ts"
|
|
12
13
|
import { type Pipeable, pipeArguments } from "../../Pipeable.ts"
|
|
@@ -19,6 +20,7 @@ import * as ServiceMap from "../../ServiceMap.ts"
|
|
|
19
20
|
import * as Stream from "../../Stream.ts"
|
|
20
21
|
import * as Tracer from "../../Tracer.ts"
|
|
21
22
|
import type { EqualsWith, ExcludeTag, ExtractTag, NoExcessProperties, NoInfer, Tags } from "../../Types.ts"
|
|
23
|
+
import type * as RateLimiter from "../persistence/RateLimiter.ts"
|
|
22
24
|
import * as Cookies from "./Cookies.ts"
|
|
23
25
|
import * as Headers from "./Headers.ts"
|
|
24
26
|
import * as Error from "./HttpClientError.ts"
|
|
@@ -61,11 +63,11 @@ export declare namespace HttpClient {
|
|
|
61
63
|
|
|
62
64
|
readonly get: (
|
|
63
65
|
url: string | URL,
|
|
64
|
-
options?: HttpClientRequest.Options.
|
|
66
|
+
options?: HttpClientRequest.Options.NoUrl
|
|
65
67
|
) => Effect.Effect<HttpClientResponse.HttpClientResponse, E, R>
|
|
66
68
|
readonly head: (
|
|
67
69
|
url: string | URL,
|
|
68
|
-
options?: HttpClientRequest.Options.
|
|
70
|
+
options?: HttpClientRequest.Options.NoUrl
|
|
69
71
|
) => Effect.Effect<HttpClientResponse.HttpClientResponse, E, R>
|
|
70
72
|
readonly post: (
|
|
71
73
|
url: string | URL,
|
|
@@ -132,7 +134,7 @@ export const execute: (
|
|
|
132
134
|
* @since 4.0.0
|
|
133
135
|
* @category accessors
|
|
134
136
|
*/
|
|
135
|
-
export const get: (url: string | URL, options?: HttpClientRequest.Options.
|
|
137
|
+
export const get: (url: string | URL, options?: HttpClientRequest.Options.NoUrl | undefined) => Effect.Effect<
|
|
136
138
|
HttpClientResponse.HttpClientResponse,
|
|
137
139
|
Error.HttpClientError,
|
|
138
140
|
HttpClient
|
|
@@ -142,7 +144,7 @@ export const get: (url: string | URL, options?: HttpClientRequest.Options.NoBody
|
|
|
142
144
|
* @since 4.0.0
|
|
143
145
|
* @category accessors
|
|
144
146
|
*/
|
|
145
|
-
export const head: (url: string | URL, options?: HttpClientRequest.Options.
|
|
147
|
+
export const head: (url: string | URL, options?: HttpClientRequest.Options.NoUrl | undefined) => Effect.Effect<
|
|
146
148
|
HttpClientResponse.HttpClientResponse,
|
|
147
149
|
Error.HttpClientError,
|
|
148
150
|
HttpClient
|
|
@@ -630,7 +632,7 @@ export const make = (
|
|
|
630
632
|
request: HttpClientRequest.HttpClientRequest,
|
|
631
633
|
url: URL,
|
|
632
634
|
signal: AbortSignal,
|
|
633
|
-
fiber: Fiber<HttpClientResponse.HttpClientResponse, Error.HttpClientError>
|
|
635
|
+
fiber: Fiber.Fiber<HttpClientResponse.HttpClientResponse, Error.HttpClientError>
|
|
634
636
|
) => Effect.Effect<HttpClientResponse.HttpClientResponse, Error.HttpClientError>
|
|
635
637
|
): HttpClient =>
|
|
636
638
|
makeWith((effect) =>
|
|
@@ -928,7 +930,7 @@ export const retry: {
|
|
|
928
930
|
/**
|
|
929
931
|
* Retries common transient errors, such as rate limiting, timeouts or network issues.
|
|
930
932
|
*
|
|
931
|
-
* Use `
|
|
933
|
+
* Use `retryOn` to focus on retrying errors, transient responses, or both.
|
|
932
934
|
*
|
|
933
935
|
* Specifying a `while` predicate allows you to consider other errors as
|
|
934
936
|
* transient, and is ignored in "response-only" mode.
|
|
@@ -940,7 +942,7 @@ export const retryTransient: {
|
|
|
940
942
|
/**
|
|
941
943
|
* Retries common transient errors, such as rate limiting, timeouts or network issues.
|
|
942
944
|
*
|
|
943
|
-
* Use `
|
|
945
|
+
* Use `retryOn` to focus on retrying errors, transient responses, or both.
|
|
944
946
|
*
|
|
945
947
|
* Specifying a `while` predicate allows you to consider other errors as
|
|
946
948
|
* transient, and is ignored in "response-only" mode.
|
|
@@ -949,26 +951,29 @@ export const retryTransient: {
|
|
|
949
951
|
* @category error handling
|
|
950
952
|
*/
|
|
951
953
|
<
|
|
952
|
-
B,
|
|
953
954
|
E,
|
|
955
|
+
B = never,
|
|
954
956
|
ES = never,
|
|
955
957
|
R1 = never,
|
|
956
|
-
const
|
|
957
|
-
|
|
958
|
-
|
|
958
|
+
const RetryOn extends "errors-only" | "response-only" | "errors-and-responses" =
|
|
959
|
+
| "errors-only"
|
|
960
|
+
| "response-only"
|
|
961
|
+
| "errors-and-responses",
|
|
962
|
+
Input = RetryOn extends "errors-only" ? E
|
|
963
|
+
: RetryOn extends "response-only" ? HttpClientResponse.HttpClientResponse
|
|
959
964
|
: HttpClientResponse.HttpClientResponse | E
|
|
960
965
|
>(
|
|
961
966
|
options: {
|
|
962
|
-
readonly
|
|
967
|
+
readonly retryOn?: RetryOn | undefined
|
|
963
968
|
readonly while?: Predicate.Predicate<NoInfer<E | ES>>
|
|
964
969
|
readonly schedule?: Schedule.Schedule<B, NoInfer<Input>, ES, R1>
|
|
965
970
|
readonly times?: number
|
|
966
|
-
}
|
|
971
|
+
}
|
|
967
972
|
): <R>(self: HttpClient.With<E, R>) => HttpClient.With<E | ES, R1 | R>
|
|
968
973
|
/**
|
|
969
974
|
* Retries common transient errors, such as rate limiting, timeouts or network issues.
|
|
970
975
|
*
|
|
971
|
-
* Use `
|
|
976
|
+
* Use `retryOn` to focus on retrying errors, transient responses, or both.
|
|
972
977
|
*
|
|
973
978
|
* Specifying a `while` predicate allows you to consider other errors as
|
|
974
979
|
* transient, and is ignored in "response-only" mode.
|
|
@@ -979,21 +984,53 @@ export const retryTransient: {
|
|
|
979
984
|
<
|
|
980
985
|
E,
|
|
981
986
|
R,
|
|
982
|
-
B,
|
|
987
|
+
B = never,
|
|
983
988
|
ES = never,
|
|
984
989
|
R1 = never,
|
|
985
|
-
const
|
|
986
|
-
|
|
987
|
-
|
|
990
|
+
const RetryOn extends "errors-only" | "response-only" | "errors-and-responses" =
|
|
991
|
+
| "errors-only"
|
|
992
|
+
| "response-only"
|
|
993
|
+
| "errors-and-responses",
|
|
994
|
+
Input = RetryOn extends "errors-only" ? E
|
|
995
|
+
: RetryOn extends "response-only" ? HttpClientResponse.HttpClientResponse
|
|
988
996
|
: HttpClientResponse.HttpClientResponse | E
|
|
989
997
|
>(
|
|
990
998
|
self: HttpClient.With<E, R>,
|
|
991
999
|
options: {
|
|
992
|
-
readonly
|
|
1000
|
+
readonly retryOn?: RetryOn | undefined
|
|
993
1001
|
readonly while?: Predicate.Predicate<NoInfer<E | ES>>
|
|
994
1002
|
readonly schedule?: Schedule.Schedule<B, NoInfer<Input>, ES, R1>
|
|
995
1003
|
readonly times?: number
|
|
996
|
-
}
|
|
1004
|
+
}
|
|
1005
|
+
): HttpClient.With<E | ES, R1 | R>
|
|
1006
|
+
/**
|
|
1007
|
+
* Retries common transient errors, such as rate limiting, timeouts or network issues.
|
|
1008
|
+
*
|
|
1009
|
+
* Use `retryOn` to focus on retrying errors, transient responses, or both.
|
|
1010
|
+
*
|
|
1011
|
+
* Specifying a `while` predicate allows you to consider other errors as
|
|
1012
|
+
* transient, and is ignored in "response-only" mode.
|
|
1013
|
+
*
|
|
1014
|
+
* @since 4.0.0
|
|
1015
|
+
* @category error handling
|
|
1016
|
+
*/
|
|
1017
|
+
<B, E, ES = never, R1 = never>(
|
|
1018
|
+
options: Schedule.Schedule<B, NoInfer<HttpClientResponse.HttpClientResponse | E>, ES, R1>
|
|
1019
|
+
): <R>(self: HttpClient.With<E, R>) => HttpClient.With<E | ES, R1 | R>
|
|
1020
|
+
/**
|
|
1021
|
+
* Retries common transient errors, such as rate limiting, timeouts or network issues.
|
|
1022
|
+
*
|
|
1023
|
+
* Use `retryOn` to focus on retrying errors, transient responses, or both.
|
|
1024
|
+
*
|
|
1025
|
+
* Specifying a `while` predicate allows you to consider other errors as
|
|
1026
|
+
* transient, and is ignored in "response-only" mode.
|
|
1027
|
+
*
|
|
1028
|
+
* @since 4.0.0
|
|
1029
|
+
* @category error handling
|
|
1030
|
+
*/
|
|
1031
|
+
<E, R, B, ES = never, R1 = never>(
|
|
1032
|
+
self: HttpClient.With<E, R>,
|
|
1033
|
+
options: Schedule.Schedule<B, NoInfer<HttpClientResponse.HttpClientResponse | E>, ES, R1>
|
|
997
1034
|
): HttpClient.With<E | ES, R1 | R>
|
|
998
1035
|
} = dual(
|
|
999
1036
|
2,
|
|
@@ -1006,26 +1043,26 @@ export const retryTransient: {
|
|
|
1006
1043
|
>(
|
|
1007
1044
|
self: HttpClient.With<E, R>,
|
|
1008
1045
|
options: {
|
|
1009
|
-
readonly
|
|
1046
|
+
readonly retryOn?: "errors-only" | "response-only" | "errors-and-responses" | undefined
|
|
1010
1047
|
readonly while?: Predicate.Predicate<E | ES>
|
|
1011
1048
|
readonly schedule?: Schedule.Schedule<B, any, ES, R1>
|
|
1012
1049
|
readonly times?: number
|
|
1013
1050
|
} | Schedule.Schedule<B, any, ES, R1>
|
|
1014
1051
|
): HttpClient.With<E | ES, R1 | R> => {
|
|
1015
1052
|
const isOnlySchedule = Schedule.isSchedule(options)
|
|
1016
|
-
const
|
|
1053
|
+
const retryOn = isOnlySchedule ? "errors-and-responses" : options.retryOn ?? "errors-and-responses"
|
|
1017
1054
|
const schedule = isOnlySchedule ? options : options.schedule
|
|
1018
1055
|
const passthroughSchedule = schedule && Schedule.passthrough(schedule)
|
|
1019
1056
|
const times = isOnlySchedule ? undefined : options.times
|
|
1020
1057
|
return transformResponse(
|
|
1021
1058
|
self,
|
|
1022
1059
|
flow(
|
|
1023
|
-
|
|
1060
|
+
retryOn === "errors-only" ? identity : Effect.repeat({
|
|
1024
1061
|
schedule: passthroughSchedule!,
|
|
1025
1062
|
times,
|
|
1026
1063
|
while: isTransientResponse
|
|
1027
1064
|
}),
|
|
1028
|
-
|
|
1065
|
+
retryOn === "response-only" ? identity : Effect.retry({
|
|
1029
1066
|
while: isOnlySchedule || options.while === undefined
|
|
1030
1067
|
? isTransientError
|
|
1031
1068
|
: Predicate.or(isTransientError, options.while),
|
|
@@ -1037,6 +1074,301 @@ export const retryTransient: {
|
|
|
1037
1074
|
}
|
|
1038
1075
|
)
|
|
1039
1076
|
|
|
1077
|
+
/**
|
|
1078
|
+
* @since 4.0.0
|
|
1079
|
+
* @category rate limiting
|
|
1080
|
+
*/
|
|
1081
|
+
export declare namespace WithRateLimiter {
|
|
1082
|
+
/**
|
|
1083
|
+
* @since 4.0.0
|
|
1084
|
+
* @category rate limiting
|
|
1085
|
+
*/
|
|
1086
|
+
export interface Options {
|
|
1087
|
+
/**
|
|
1088
|
+
* The `RateLimiter` service to use for rate limiting.
|
|
1089
|
+
*/
|
|
1090
|
+
readonly limiter: RateLimiter.RateLimiter
|
|
1091
|
+
/**
|
|
1092
|
+
* The initial rate limit window duration.
|
|
1093
|
+
*/
|
|
1094
|
+
readonly window: Duration.Input
|
|
1095
|
+
/**
|
|
1096
|
+
* The initial maximum number of allowed requests in the window.
|
|
1097
|
+
*/
|
|
1098
|
+
readonly limit: number
|
|
1099
|
+
/**
|
|
1100
|
+
* The key to identify the rate limit. Requests with the same key will share
|
|
1101
|
+
* the same rate limit. This can be used to implement per-user or
|
|
1102
|
+
* per-endpoint rate limits.
|
|
1103
|
+
*/
|
|
1104
|
+
readonly key: string | ((request: HttpClientRequest.HttpClientRequest) => string)
|
|
1105
|
+
/**
|
|
1106
|
+
* Defaults to `"fixed-window"`.
|
|
1107
|
+
*/
|
|
1108
|
+
readonly algorithm?: "fixed-window" | "token-bucket" | undefined
|
|
1109
|
+
/**
|
|
1110
|
+
* Defaults to `1`.
|
|
1111
|
+
*/
|
|
1112
|
+
readonly tokens?: number | ((request: HttpClientRequest.HttpClientRequest) => number) | undefined
|
|
1113
|
+
/**
|
|
1114
|
+
* Disable automatic limits updates from response headers.
|
|
1115
|
+
*/
|
|
1116
|
+
readonly disableResponseInspection?: boolean | undefined
|
|
1117
|
+
}
|
|
1118
|
+
}
|
|
1119
|
+
|
|
1120
|
+
/**
|
|
1121
|
+
* Applies request rate limiting using the `RateLimiter` service.
|
|
1122
|
+
*
|
|
1123
|
+
* It can update limits by inspecting common rate limit response headers and
|
|
1124
|
+
* automatically retries HTTP `429` responses (or `HttpClientError` values
|
|
1125
|
+
* wrapping a `429` response) by forcing the retry back through the limiter.
|
|
1126
|
+
*
|
|
1127
|
+
* @since 4.0.0
|
|
1128
|
+
* @category rate limiting
|
|
1129
|
+
*/
|
|
1130
|
+
export const withRateLimiter: {
|
|
1131
|
+
/**
|
|
1132
|
+
* Applies request rate limiting using the `RateLimiter` service.
|
|
1133
|
+
*
|
|
1134
|
+
* It can update limits by inspecting common rate limit response headers and
|
|
1135
|
+
* automatically retries HTTP `429` responses (or `HttpClientError` values
|
|
1136
|
+
* wrapping a `429` response) by forcing the retry back through the limiter.
|
|
1137
|
+
*
|
|
1138
|
+
* @since 4.0.0
|
|
1139
|
+
* @category rate limiting
|
|
1140
|
+
*/
|
|
1141
|
+
(options: WithRateLimiter.Options): <E, R>(
|
|
1142
|
+
self: HttpClient.With<E, R>
|
|
1143
|
+
) => HttpClient.With<E | RateLimiter.RateLimiterError, R>
|
|
1144
|
+
/**
|
|
1145
|
+
* Applies request rate limiting using the `RateLimiter` service.
|
|
1146
|
+
*
|
|
1147
|
+
* It can update limits by inspecting common rate limit response headers and
|
|
1148
|
+
* automatically retries HTTP `429` responses (or `HttpClientError` values
|
|
1149
|
+
* wrapping a `429` response) by forcing the retry back through the limiter.
|
|
1150
|
+
*
|
|
1151
|
+
* @since 4.0.0
|
|
1152
|
+
* @category rate limiting
|
|
1153
|
+
*/
|
|
1154
|
+
<E, R>(self: HttpClient.With<E, R>, options: WithRateLimiter.Options): HttpClient.With<E | RateLimiter.RateLimiterError, R>
|
|
1155
|
+
} = dual(2, <E, R>(
|
|
1156
|
+
self: HttpClient.With<E, R>,
|
|
1157
|
+
options: WithRateLimiter.Options
|
|
1158
|
+
): HttpClient.With<E | RateLimiter.RateLimiterError, R> => {
|
|
1159
|
+
const initialState: RateLimiterState = {
|
|
1160
|
+
initial: true,
|
|
1161
|
+
limit: options.limit,
|
|
1162
|
+
window: Duration.max(Duration.fromInputUnsafe(options.window), Duration.millis(1))
|
|
1163
|
+
}
|
|
1164
|
+
const states = new Map<string, RateLimiterState>()
|
|
1165
|
+
|
|
1166
|
+
const keyOption = options.key
|
|
1167
|
+
const resolveKey: (request: HttpClientRequest.HttpClientRequest) => string = typeof keyOption === "function"
|
|
1168
|
+
? keyOption
|
|
1169
|
+
: constant(keyOption)
|
|
1170
|
+
const tokensOption = options.tokens
|
|
1171
|
+
const resolveTokens: (request: HttpClientRequest.HttpClientRequest) => number = typeof tokensOption === "function"
|
|
1172
|
+
? tokensOption
|
|
1173
|
+
: constant(tokensOption ?? 1)
|
|
1174
|
+
|
|
1175
|
+
const getState = (key: string): RateLimiterState => {
|
|
1176
|
+
const current = states.get(key)
|
|
1177
|
+
if (current !== undefined) {
|
|
1178
|
+
return current
|
|
1179
|
+
}
|
|
1180
|
+
states.set(key, initialState)
|
|
1181
|
+
return initialState
|
|
1182
|
+
}
|
|
1183
|
+
|
|
1184
|
+
const onResponse = options.disableResponseInspection
|
|
1185
|
+
? undefined
|
|
1186
|
+
: (clock: Clock, key: string, headers: Headers.Headers, tokens: number) => {
|
|
1187
|
+
const current = getState(key)
|
|
1188
|
+
const next = parseRateLimiterState(current, clock, headers, tokens)
|
|
1189
|
+
if (next.limit !== current.limit || !Duration.equals(next.window, current.window)) {
|
|
1190
|
+
states.set(key, next)
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
|
|
1194
|
+
return transform(self, function loop(effect, request): Effect.Effect<
|
|
1195
|
+
HttpClientResponse.HttpClientResponse,
|
|
1196
|
+
E | RateLimiter.RateLimiterError,
|
|
1197
|
+
R
|
|
1198
|
+
> {
|
|
1199
|
+
const fiber = Fiber.getCurrent()!
|
|
1200
|
+
const clock = fiber.getRef(Clock)
|
|
1201
|
+
const key = resolveKey(request)
|
|
1202
|
+
const tokens = Math.max(resolveTokens(request), 1)
|
|
1203
|
+
const current = getState(key)
|
|
1204
|
+
function retry(response: HttpClientResponse.HttpClientResponse) {
|
|
1205
|
+
if (options.disableResponseInspection) return loop(effect, request)
|
|
1206
|
+
const retryAfter = parseRetryAfter(clock, getHeader(response.headers, "retry-after"))
|
|
1207
|
+
return retryAfter
|
|
1208
|
+
? Effect.flatMap(Effect.sleep(retryAfter), () => loop(effect, request))
|
|
1209
|
+
: loop(effect, request)
|
|
1210
|
+
}
|
|
1211
|
+
return Effect.flatMap(
|
|
1212
|
+
options.limiter.consume({
|
|
1213
|
+
algorithm: options.algorithm,
|
|
1214
|
+
onExceeded: "delay",
|
|
1215
|
+
key,
|
|
1216
|
+
limit: current.limit,
|
|
1217
|
+
window: current.window,
|
|
1218
|
+
tokens
|
|
1219
|
+
}),
|
|
1220
|
+
({ delay }) => {
|
|
1221
|
+
const run = Effect.matchEffect(effect, {
|
|
1222
|
+
onSuccess(response) {
|
|
1223
|
+
onResponse?.(clock, key, response.headers, tokens)
|
|
1224
|
+
if (response.status !== 429) return Effect.succeed(response)
|
|
1225
|
+
return retry(response)
|
|
1226
|
+
},
|
|
1227
|
+
onFailure(error) {
|
|
1228
|
+
if (isTooManyRequestsHttpClientError(error)) {
|
|
1229
|
+
onResponse?.(clock, key, error.reason.response.headers, tokens)
|
|
1230
|
+
return retry(error.reason.response)
|
|
1231
|
+
}
|
|
1232
|
+
return Effect.fail(error)
|
|
1233
|
+
}
|
|
1234
|
+
})
|
|
1235
|
+
return Duration.isZero(delay) ? run : Effect.delay(run, delay)
|
|
1236
|
+
}
|
|
1237
|
+
)
|
|
1238
|
+
})
|
|
1239
|
+
})
|
|
1240
|
+
|
|
1241
|
+
interface RateLimiterState {
|
|
1242
|
+
readonly limit: number
|
|
1243
|
+
readonly window: Duration.Duration
|
|
1244
|
+
readonly initial: boolean
|
|
1245
|
+
}
|
|
1246
|
+
|
|
1247
|
+
const parseRateLimiterState = (
|
|
1248
|
+
state: RateLimiterState,
|
|
1249
|
+
clock: Clock,
|
|
1250
|
+
headers: Headers.Headers,
|
|
1251
|
+
tokens: number
|
|
1252
|
+
): RateLimiterState => {
|
|
1253
|
+
const limit = parseRateLimitLimit(state, headers, tokens) ?? state.limit
|
|
1254
|
+
const window = parseRateLimitWindow(clock, headers) ?? state.window
|
|
1255
|
+
if (limit === state.limit && Duration.equals(window, state.window)) {
|
|
1256
|
+
return state
|
|
1257
|
+
}
|
|
1258
|
+
return { limit, window, initial: false }
|
|
1259
|
+
}
|
|
1260
|
+
|
|
1261
|
+
const parseRateLimitLimit = (
|
|
1262
|
+
state: RateLimiterState,
|
|
1263
|
+
headers: Headers.Headers,
|
|
1264
|
+
tokens: number
|
|
1265
|
+
): number | undefined => {
|
|
1266
|
+
const raw = getHeader(headers, "ratelimit-limit", "x-ratelimit-limit")
|
|
1267
|
+
const value = parseNumberHeader(raw)
|
|
1268
|
+
if (value !== undefined && value > 0) {
|
|
1269
|
+
return value
|
|
1270
|
+
}
|
|
1271
|
+
const remaining = parseRateLimitRemaining(headers)
|
|
1272
|
+
if (remaining === undefined) {
|
|
1273
|
+
return undefined
|
|
1274
|
+
}
|
|
1275
|
+
return state.initial ? remaining + tokens : Math.max(remaining + tokens, state.limit)
|
|
1276
|
+
}
|
|
1277
|
+
|
|
1278
|
+
const parseRateLimitRemaining = (headers: Headers.Headers): number | undefined => {
|
|
1279
|
+
const raw = getHeader(headers, "ratelimit-remaining", "x-ratelimit-remaining")
|
|
1280
|
+
const value = parseNumberHeader(raw)
|
|
1281
|
+
return value !== undefined && value >= 0 ? value : undefined
|
|
1282
|
+
}
|
|
1283
|
+
|
|
1284
|
+
const parseRateLimitWindow = (
|
|
1285
|
+
clock: Clock,
|
|
1286
|
+
headers: Headers.Headers
|
|
1287
|
+
): Duration.Duration | undefined => {
|
|
1288
|
+
const retryAfter = parseRetryAfter(
|
|
1289
|
+
clock,
|
|
1290
|
+
getHeader(headers, "retry-after")
|
|
1291
|
+
)
|
|
1292
|
+
if (retryAfter !== undefined) {
|
|
1293
|
+
return retryAfter
|
|
1294
|
+
}
|
|
1295
|
+
const resetAfter = parseResetAfter(getHeader(headers, "ratelimit-reset-after", "x-ratelimit-reset-after"))
|
|
1296
|
+
if (resetAfter !== undefined) {
|
|
1297
|
+
return resetAfter
|
|
1298
|
+
}
|
|
1299
|
+
return parseResetHeader(clock, getHeader(headers, "ratelimit-reset", "x-ratelimit-reset"))
|
|
1300
|
+
}
|
|
1301
|
+
|
|
1302
|
+
const parseRetryAfter = (
|
|
1303
|
+
clock: Clock,
|
|
1304
|
+
value: string | undefined
|
|
1305
|
+
): Duration.Duration | undefined => {
|
|
1306
|
+
if (value === undefined) {
|
|
1307
|
+
return undefined
|
|
1308
|
+
}
|
|
1309
|
+
const numeric = parseNumberHeader(value)
|
|
1310
|
+
if (numeric !== undefined) {
|
|
1311
|
+
return Duration.max(Duration.seconds(numeric), Duration.millis(1))
|
|
1312
|
+
}
|
|
1313
|
+
const parsedDate = Date.parse(value)
|
|
1314
|
+
if (Number.isNaN(parsedDate)) {
|
|
1315
|
+
return undefined
|
|
1316
|
+
}
|
|
1317
|
+
const millis = parsedDate - clock.currentTimeMillisUnsafe()
|
|
1318
|
+
if (millis <= 0) {
|
|
1319
|
+
return Duration.millis(1)
|
|
1320
|
+
}
|
|
1321
|
+
return Duration.millis(millis)
|
|
1322
|
+
}
|
|
1323
|
+
|
|
1324
|
+
const parseResetAfter = (value: string | undefined): Duration.Duration | undefined => {
|
|
1325
|
+
const numeric = parseNumberHeader(value)
|
|
1326
|
+
if (numeric === undefined || numeric <= 0) {
|
|
1327
|
+
return undefined
|
|
1328
|
+
}
|
|
1329
|
+
return Duration.max(Duration.seconds(numeric), Duration.millis(1))
|
|
1330
|
+
}
|
|
1331
|
+
|
|
1332
|
+
const parseResetHeader = (
|
|
1333
|
+
clock: Clock,
|
|
1334
|
+
value: string | undefined
|
|
1335
|
+
): Duration.Duration | undefined => {
|
|
1336
|
+
const numeric = parseNumberHeader(value)
|
|
1337
|
+
if (numeric === undefined || numeric <= 0) {
|
|
1338
|
+
return undefined
|
|
1339
|
+
}
|
|
1340
|
+
const nowMillis = clock.currentTimeMillisUnsafe()
|
|
1341
|
+
if (numeric > 1_000_000_000_000) {
|
|
1342
|
+
return Duration.millis(Math.max(numeric - nowMillis, 1))
|
|
1343
|
+
}
|
|
1344
|
+
if (numeric > 1_000_000_000) {
|
|
1345
|
+
return Duration.millis(Math.max((numeric * 1_000) - nowMillis, 1))
|
|
1346
|
+
}
|
|
1347
|
+
return Duration.max(Duration.seconds(numeric), Duration.millis(1))
|
|
1348
|
+
}
|
|
1349
|
+
|
|
1350
|
+
const parseNumberHeader = (value: string | undefined): number | undefined => {
|
|
1351
|
+
if (value === undefined) {
|
|
1352
|
+
return undefined
|
|
1353
|
+
}
|
|
1354
|
+
const match = /-?\d+(?:\.\d+)?/.exec(value)
|
|
1355
|
+
if (match === null) {
|
|
1356
|
+
return undefined
|
|
1357
|
+
}
|
|
1358
|
+
const parsed = Number(match[0])
|
|
1359
|
+
return Number.isFinite(parsed) ? parsed : undefined
|
|
1360
|
+
}
|
|
1361
|
+
|
|
1362
|
+
const getHeader = (headers: Headers.Headers, ...keys: Array<string>): string | undefined => {
|
|
1363
|
+
for (let i = 0; i < keys.length; i++) {
|
|
1364
|
+
const value = headers[keys[i]]
|
|
1365
|
+
if (value !== undefined) {
|
|
1366
|
+
return value
|
|
1367
|
+
}
|
|
1368
|
+
}
|
|
1369
|
+
return undefined
|
|
1370
|
+
}
|
|
1371
|
+
|
|
1040
1372
|
/**
|
|
1041
1373
|
* Performs an additional effect after a successful request.
|
|
1042
1374
|
*
|
|
@@ -1331,7 +1663,7 @@ const responseRegistry = (() => {
|
|
|
1331
1663
|
|
|
1332
1664
|
const scopedRequests = new WeakMap<HttpClientRequest.HttpClientRequest, AbortController>()
|
|
1333
1665
|
|
|
1334
|
-
class InterruptibleResponse implements HttpClientResponse.HttpClientResponse {
|
|
1666
|
+
class InterruptibleResponse implements HttpClientResponse.HttpClientResponse, Pipeable {
|
|
1335
1667
|
readonly original: HttpClientResponse.HttpClientResponse
|
|
1336
1668
|
readonly controller: AbortController
|
|
1337
1669
|
|
|
@@ -1402,12 +1734,12 @@ class InterruptibleResponse implements HttpClientResponse.HttpClientResponse {
|
|
|
1402
1734
|
get stream() {
|
|
1403
1735
|
return Stream.suspend(() => {
|
|
1404
1736
|
responseRegistry.unregister(this.original)
|
|
1405
|
-
return Stream.
|
|
1406
|
-
|
|
1737
|
+
return Stream.ensuring(
|
|
1738
|
+
this.original.stream,
|
|
1739
|
+
Effect.sync(() => {
|
|
1407
1740
|
this.controller.abort()
|
|
1408
|
-
}
|
|
1409
|
-
|
|
1410
|
-
})
|
|
1741
|
+
})
|
|
1742
|
+
)
|
|
1411
1743
|
})
|
|
1412
1744
|
}
|
|
1413
1745
|
|
|
@@ -1418,6 +1750,10 @@ class InterruptibleResponse implements HttpClientResponse.HttpClientResponse {
|
|
|
1418
1750
|
[Inspectable.NodeInspectSymbol]() {
|
|
1419
1751
|
return this.original[Inspectable.NodeInspectSymbol]()
|
|
1420
1752
|
}
|
|
1753
|
+
|
|
1754
|
+
pipe() {
|
|
1755
|
+
return pipeArguments(this, arguments)
|
|
1756
|
+
}
|
|
1421
1757
|
}
|
|
1422
1758
|
|
|
1423
1759
|
const isTransientError = (error: unknown) => Cause.isTimeoutError(error) || isTransientHttpError(error)
|
|
@@ -1427,6 +1763,11 @@ const isTransientHttpError = (error: unknown) =>
|
|
|
1427
1763
|
(error.reason._tag === "TransportError" ||
|
|
1428
1764
|
(error.reason._tag === "StatusCodeError" && isTransientResponse(error.reason.response)))
|
|
1429
1765
|
|
|
1766
|
+
const isTooManyRequestsHttpClientError = (
|
|
1767
|
+
error: unknown
|
|
1768
|
+
): error is Error.HttpClientError & { readonly reason: Error.StatusCodeError } =>
|
|
1769
|
+
Error.isHttpClientError(error) && error.reason._tag === "StatusCodeError" && error.reason.response.status === 429
|
|
1770
|
+
|
|
1430
1771
|
const isTransientResponse = (response: HttpClientResponse.HttpClientResponse) =>
|
|
1431
1772
|
response.status === 408 ||
|
|
1432
1773
|
response.status === 429 ||
|