effect 4.0.0-beta.65 → 4.0.0-beta.67
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 +113 -67
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +28 -18
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +404 -337
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +190 -146
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts +167 -97
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +87 -47
- package/dist/BigInt.js.map +1 -1
- package/dist/Boolean.d.ts +62 -31
- package/dist/Boolean.d.ts.map +1 -1
- package/dist/Boolean.js +30 -15
- package/dist/Boolean.js.map +1 -1
- package/dist/Brand.d.ts +20 -1
- package/dist/Brand.d.ts.map +1 -1
- package/dist/Brand.js +16 -0
- package/dist/Brand.js.map +1 -1
- package/dist/Cache.d.ts +236 -132
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +133 -57
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +77 -65
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Cause.js +43 -36
- package/dist/Cause.js.map +1 -1
- package/dist/Channel.d.ts +1518 -575
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +661 -287
- package/dist/Channel.js.map +1 -1
- package/dist/ChannelSchema.d.ts +119 -10
- package/dist/ChannelSchema.d.ts.map +1 -1
- package/dist/ChannelSchema.js +45 -6
- package/dist/ChannelSchema.js.map +1 -1
- package/dist/Chunk.d.ts +548 -379
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +238 -170
- package/dist/Chunk.js.map +1 -1
- package/dist/Clock.d.ts +15 -8
- package/dist/Clock.d.ts.map +1 -1
- package/dist/Clock.js +8 -4
- package/dist/Clock.js.map +1 -1
- package/dist/Combiner.d.ts +2 -4
- package/dist/Combiner.d.ts.map +1 -1
- package/dist/Combiner.js +2 -4
- package/dist/Combiner.js.map +1 -1
- package/dist/Config.d.ts +5 -4
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +9 -8
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +1 -1
- package/dist/ConfigProvider.js +1 -1
- package/dist/Console.d.ts +76 -50
- package/dist/Console.d.ts.map +1 -1
- package/dist/Console.js +69 -46
- package/dist/Console.js.map +1 -1
- package/dist/Context.d.ts +386 -138
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +144 -62
- package/dist/Context.js.map +1 -1
- package/dist/Cron.d.ts +69 -48
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +96 -36
- package/dist/Cron.js.map +1 -1
- package/dist/Data.d.ts +3 -2
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js.map +1 -1
- package/dist/DateTime.d.ts +875 -444
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +376 -217
- package/dist/DateTime.js.map +1 -1
- package/dist/Deferred.d.ts +367 -174
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +145 -71
- package/dist/Deferred.js.map +1 -1
- package/dist/Differ.d.ts +42 -0
- package/dist/Differ.d.ts.map +1 -1
- package/dist/Differ.js +36 -0
- package/dist/Duration.d.ts +329 -185
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +174 -106
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +2445 -2356
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +906 -758
- package/dist/Effect.js.map +1 -1
- package/dist/Effectable.d.ts +38 -3
- package/dist/Effectable.d.ts.map +1 -1
- package/dist/Effectable.js +3 -3
- package/dist/Effectable.js.map +1 -1
- package/dist/Encoding.d.ts +78 -28
- package/dist/Encoding.d.ts.map +1 -1
- package/dist/Encoding.js +75 -27
- package/dist/Encoding.js.map +1 -1
- package/dist/Equivalence.d.ts +14 -19
- package/dist/Equivalence.d.ts.map +1 -1
- package/dist/Equivalence.js +14 -19
- package/dist/Equivalence.js.map +1 -1
- package/dist/ErrorReporter.d.ts +66 -82
- package/dist/ErrorReporter.d.ts.map +1 -1
- package/dist/ErrorReporter.js +38 -29
- package/dist/ErrorReporter.js.map +1 -1
- package/dist/ExecutionPlan.d.ts +96 -12
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/ExecutionPlan.js +21 -6
- package/dist/ExecutionPlan.js.map +1 -1
- package/dist/Exit.d.ts +7 -5
- package/dist/Exit.d.ts.map +1 -1
- package/dist/Exit.js.map +1 -1
- package/dist/Fiber.d.ts +72 -40
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js +39 -21
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +119 -58
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +122 -40
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +288 -160
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +176 -74
- package/dist/FiberMap.js.map +1 -1
- package/dist/FiberSet.d.ts +93 -52
- package/dist/FiberSet.d.ts.map +1 -1
- package/dist/FiberSet.js +97 -34
- package/dist/FiberSet.js.map +1 -1
- package/dist/FileSystem.d.ts +104 -73
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +53 -39
- package/dist/FileSystem.js.map +1 -1
- package/dist/Filter.d.ts +166 -88
- package/dist/Filter.d.ts.map +1 -1
- package/dist/Filter.js +68 -42
- package/dist/Filter.js.map +1 -1
- package/dist/Function.d.ts +154 -86
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +53 -37
- package/dist/Function.js.map +1 -1
- package/dist/Graph.d.ts +682 -365
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +308 -157
- package/dist/Graph.js.map +1 -1
- package/dist/HKT.d.ts +29 -13
- package/dist/HKT.d.ts.map +1 -1
- package/dist/Hash.d.ts +31 -18
- package/dist/Hash.d.ts.map +1 -1
- package/dist/Hash.js +25 -15
- package/dist/Hash.js.map +1 -1
- package/dist/HashMap.d.ts +444 -256
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashMap.js +223 -105
- package/dist/HashMap.js.map +1 -1
- package/dist/HashRing.d.ts +36 -17
- package/dist/HashRing.d.ts.map +1 -1
- package/dist/HashRing.js +75 -8
- package/dist/HashRing.js.map +1 -1
- package/dist/HashSet.d.ts +194 -104
- package/dist/HashSet.d.ts.map +1 -1
- package/dist/HashSet.js +93 -38
- package/dist/HashSet.js.map +1 -1
- package/dist/Inspectable.d.ts +20 -9
- package/dist/Inspectable.d.ts.map +1 -1
- package/dist/Inspectable.js +16 -6
- package/dist/Inspectable.js.map +1 -1
- package/dist/Iterable.d.ts +309 -149
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +129 -65
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonPatch.d.ts +4 -3
- package/dist/JsonPatch.d.ts.map +1 -1
- package/dist/JsonPatch.js +4 -3
- package/dist/JsonPatch.js.map +1 -1
- package/dist/Latch.d.ts +98 -15
- package/dist/Latch.d.ts.map +1 -1
- package/dist/Latch.js +41 -10
- package/dist/Latch.js.map +1 -1
- package/dist/Layer.d.ts +412 -309
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +262 -181
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +95 -21
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +58 -14
- package/dist/LayerMap.js.map +1 -1
- package/dist/LogLevel.d.ts +92 -131
- package/dist/LogLevel.d.ts.map +1 -1
- package/dist/LogLevel.js +25 -15
- package/dist/LogLevel.js.map +1 -1
- package/dist/Logger.d.ts +155 -99
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +211 -184
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +75 -17
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/ManagedRuntime.js +22 -16
- package/dist/ManagedRuntime.js.map +1 -1
- package/dist/Match.d.ts +133 -157
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js +85 -76
- package/dist/Match.js.map +1 -1
- package/dist/Metric.d.ts +325 -284
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +217 -212
- package/dist/Metric.js.map +1 -1
- package/dist/MutableHashMap.d.ts +117 -58
- package/dist/MutableHashMap.d.ts.map +1 -1
- package/dist/MutableHashMap.js +52 -29
- package/dist/MutableHashMap.js.map +1 -1
- package/dist/MutableHashSet.d.ts +52 -30
- package/dist/MutableHashSet.d.ts.map +1 -1
- package/dist/MutableHashSet.js +94 -38
- package/dist/MutableHashSet.js.map +1 -1
- package/dist/MutableList.d.ts +92 -49
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +123 -71
- package/dist/MutableList.js.map +1 -1
- package/dist/MutableRef.d.ts +99 -62
- package/dist/MutableRef.d.ts.map +1 -1
- package/dist/MutableRef.js +79 -60
- package/dist/MutableRef.js.map +1 -1
- package/dist/Newtype.d.ts +3 -0
- package/dist/Newtype.d.ts.map +1 -1
- package/dist/Newtype.js.map +1 -1
- package/dist/NonEmptyIterable.d.ts +36 -39
- package/dist/NonEmptyIterable.d.ts.map +1 -1
- package/dist/NonEmptyIterable.js +34 -20
- package/dist/NonEmptyIterable.js.map +1 -1
- package/dist/Number.d.ts +116 -64
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +54 -30
- package/dist/Number.js.map +1 -1
- package/dist/Optic.d.ts +1 -2
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +0 -1
- package/dist/Optic.js.map +1 -1
- package/dist/Option.d.ts +38 -53
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +87 -11
- package/dist/Option.js.map +1 -1
- package/dist/Ordering.d.ts +43 -28
- package/dist/Ordering.d.ts.map +1 -1
- package/dist/Ordering.js +4 -2
- package/dist/Ordering.js.map +1 -1
- package/dist/PartitionedSemaphore.d.ts +225 -40
- package/dist/PartitionedSemaphore.d.ts.map +1 -1
- package/dist/PartitionedSemaphore.js +113 -17
- package/dist/PartitionedSemaphore.js.map +1 -1
- package/dist/Path.d.ts +77 -13
- package/dist/Path.d.ts.map +1 -1
- package/dist/Path.js +48 -4
- package/dist/Path.js.map +1 -1
- package/dist/Pipeable.d.ts +71 -15
- package/dist/Pipeable.d.ts.map +1 -1
- package/dist/Pipeable.js +59 -12
- package/dist/Pipeable.js.map +1 -1
- package/dist/PlatformError.d.ts +74 -6
- package/dist/PlatformError.d.ts.map +1 -1
- package/dist/PlatformError.js +68 -5
- package/dist/PlatformError.js.map +1 -1
- package/dist/Pool.d.ts +66 -31
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +26 -24
- package/dist/Pool.js.map +1 -1
- package/dist/Predicate.d.ts +16 -21
- package/dist/Predicate.d.ts.map +1 -1
- package/dist/Predicate.js +9 -14
- package/dist/Predicate.js.map +1 -1
- package/dist/PrimaryKey.d.ts +9 -2
- package/dist/PrimaryKey.d.ts.map +1 -1
- package/dist/PrimaryKey.js +7 -1
- package/dist/PrimaryKey.js.map +1 -1
- package/dist/PubSub.d.ts +364 -262
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +245 -174
- package/dist/PubSub.js.map +1 -1
- package/dist/Pull.d.ts +94 -25
- package/dist/Pull.d.ts.map +1 -1
- package/dist/Pull.js +61 -13
- package/dist/Pull.js.map +1 -1
- package/dist/Queue.d.ts +284 -150
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +216 -113
- package/dist/Queue.js.map +1 -1
- package/dist/Random.d.ts +54 -35
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +36 -24
- package/dist/Random.js.map +1 -1
- package/dist/RcMap.d.ts +151 -141
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +66 -20
- package/dist/RcMap.js.map +1 -1
- package/dist/RcRef.d.ts +69 -32
- package/dist/RcRef.d.ts.map +1 -1
- package/dist/RcRef.js +33 -16
- package/dist/RcRef.js.map +1 -1
- package/dist/Record.d.ts +273 -129
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +117 -57
- package/dist/Record.js.map +1 -1
- package/dist/Redactable.d.ts +3 -3
- package/dist/Redactable.js +2 -2
- package/dist/Redacted.d.ts +63 -33
- package/dist/Redacted.d.ts.map +1 -1
- package/dist/Redacted.js +30 -14
- package/dist/Redacted.js.map +1 -1
- package/dist/Ref.d.ts +81 -52
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +54 -35
- package/dist/Ref.js.map +1 -1
- package/dist/References.d.ts +73 -31
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +66 -30
- package/dist/References.js.map +1 -1
- package/dist/RegExp.d.ts +11 -5
- package/dist/RegExp.d.ts.map +1 -1
- package/dist/RegExp.js +11 -5
- package/dist/RegExp.js.map +1 -1
- package/dist/Request.d.ts +158 -34
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js +67 -12
- package/dist/Request.js.map +1 -1
- package/dist/RequestResolver.d.ts +261 -116
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +77 -41
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Resource.d.ts +13 -7
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +44 -6
- package/dist/Resource.js.map +1 -1
- package/dist/Result.d.ts +26 -16
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +6 -6
- package/dist/Result.js.map +1 -1
- package/dist/Runtime.d.ts +43 -18
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +35 -16
- package/dist/Runtime.js.map +1 -1
- package/dist/Schedule.d.ts +545 -576
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +261 -247
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts +43 -6
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +33 -4
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +815 -294
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +287 -193
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +24 -15
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +13 -9
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +26 -13
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +24 -11
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.d.ts +1 -8
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.d.ts +194 -25
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +220 -26
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +2 -2
- package/dist/SchemaTransformation.d.ts +61 -41
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +56 -33
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/SchemaUtils.d.ts +7 -0
- package/dist/SchemaUtils.d.ts.map +1 -1
- package/dist/SchemaUtils.js +23 -0
- package/dist/SchemaUtils.js.map +1 -1
- package/dist/Scope.d.ts +102 -43
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +57 -23
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.d.ts +138 -46
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedCache.js +80 -19
- package/dist/ScopedCache.js.map +1 -1
- package/dist/ScopedRef.d.ts +28 -8
- package/dist/ScopedRef.d.ts.map +1 -1
- package/dist/ScopedRef.js +25 -5
- package/dist/ScopedRef.js.map +1 -1
- package/dist/Semaphore.d.ts +64 -28
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js +22 -13
- package/dist/Semaphore.js.map +1 -1
- package/dist/Sink.d.ts +458 -200
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +240 -89
- package/dist/Sink.js.map +1 -1
- package/dist/Stdio.d.ts +43 -6
- package/dist/Stdio.d.ts.map +1 -1
- package/dist/Stdio.js +33 -4
- package/dist/Stdio.js.map +1 -1
- package/dist/Stream.d.ts +1899 -1186
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +868 -525
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +171 -95
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +125 -67
- package/dist/String.js.map +1 -1
- package/dist/SubscriptionRef.d.ts +308 -203
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +125 -76
- package/dist/SubscriptionRef.js.map +1 -1
- package/dist/Symbol.d.ts +13 -5
- package/dist/Symbol.d.ts.map +1 -1
- package/dist/Symbol.js +13 -5
- package/dist/Symbol.js.map +1 -1
- package/dist/SynchronizedRef.d.ts +278 -62
- package/dist/SynchronizedRef.d.ts.map +1 -1
- package/dist/SynchronizedRef.js +116 -23
- package/dist/SynchronizedRef.js.map +1 -1
- package/dist/Take.d.ts +26 -2
- package/dist/Take.d.ts.map +1 -1
- package/dist/Take.js +4 -1
- package/dist/Take.js.map +1 -1
- package/dist/Terminal.d.ts +39 -7
- package/dist/Terminal.d.ts.map +1 -1
- package/dist/Terminal.js +10 -4
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +229 -55
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +94 -18
- package/dist/Tracer.js.map +1 -1
- package/dist/Trie.d.ts +213 -142
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js +88 -60
- package/dist/Trie.js.map +1 -1
- package/dist/TxChunk.d.ts +182 -146
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxChunk.js +73 -56
- package/dist/TxChunk.js.map +1 -1
- package/dist/TxDeferred.d.ts +43 -29
- package/dist/TxDeferred.d.ts.map +1 -1
- package/dist/TxDeferred.js +22 -15
- package/dist/TxDeferred.js.map +1 -1
- package/dist/TxHashMap.d.ts +362 -222
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +171 -98
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxHashSet.d.ts +178 -104
- package/dist/TxHashSet.d.ts.map +1 -1
- package/dist/TxHashSet.js +84 -43
- package/dist/TxHashSet.js.map +1 -1
- package/dist/TxPriorityQueue.d.ts +93 -62
- package/dist/TxPriorityQueue.d.ts.map +1 -1
- package/dist/TxPriorityQueue.js +54 -36
- package/dist/TxPriorityQueue.js.map +1 -1
- package/dist/TxPubSub.d.ts +77 -49
- package/dist/TxPubSub.d.ts.map +1 -1
- package/dist/TxPubSub.js +60 -37
- package/dist/TxPubSub.js.map +1 -1
- package/dist/TxQueue.d.ts +279 -241
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxQueue.js +147 -101
- package/dist/TxQueue.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +69 -46
- package/dist/TxReentrantLock.d.ts.map +1 -1
- package/dist/TxReentrantLock.js +48 -32
- package/dist/TxReentrantLock.js.map +1 -1
- package/dist/TxRef.d.ts +69 -40
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +35 -20
- package/dist/TxRef.js.map +1 -1
- package/dist/TxSemaphore.d.ts +101 -54
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +76 -34
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/TxSubscriptionRef.d.ts +72 -48
- package/dist/TxSubscriptionRef.d.ts.map +1 -1
- package/dist/TxSubscriptionRef.js +33 -22
- package/dist/TxSubscriptionRef.js.map +1 -1
- package/dist/Types.d.ts +34 -34
- package/dist/UndefinedOr.d.ts +48 -25
- package/dist/UndefinedOr.d.ts.map +1 -1
- package/dist/UndefinedOr.js +28 -25
- package/dist/UndefinedOr.js.map +1 -1
- package/dist/Unify.d.ts +71 -116
- package/dist/Unify.d.ts.map +1 -1
- package/dist/Unify.js +20 -6
- package/dist/Unify.js.map +1 -1
- package/dist/Utils.d.ts +4 -0
- package/dist/Utils.d.ts.map +1 -1
- package/dist/Utils.js +4 -0
- package/dist/Utils.js.map +1 -1
- package/dist/index.d.ts +81 -32
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +81 -32
- package/dist/index.js.map +1 -1
- package/dist/internal/concurrency.js +2 -2
- package/dist/internal/concurrency.js.map +1 -1
- package/dist/internal/core.js +8 -20
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/effect.js +20 -19
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/executionPlan.js +2 -2
- package/dist/internal/executionPlan.js.map +1 -1
- package/dist/internal/option.js +5 -8
- package/dist/internal/option.js.map +1 -1
- package/dist/internal/result.js +5 -8
- package/dist/internal/result.js.map +1 -1
- package/dist/internal/schema/schema.js +1 -1
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/testing/FastCheck.d.ts +6 -3
- package/dist/testing/FastCheck.d.ts.map +1 -1
- package/dist/testing/FastCheck.js +6 -3
- package/dist/testing/FastCheck.js.map +1 -1
- package/dist/testing/TestClock.d.ts +39 -34
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestClock.js +42 -12
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/testing/TestConsole.d.ts +39 -30
- package/dist/testing/TestConsole.d.ts.map +1 -1
- package/dist/testing/TestConsole.js +25 -10
- package/dist/testing/TestConsole.js.map +1 -1
- package/dist/testing/TestSchema.js +7 -7
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +197 -130
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +166 -102
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +2 -2
- package/dist/unstable/ai/Chat.d.ts +65 -41
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +51 -33
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.d.ts +12 -11
- package/dist/unstable/ai/EmbeddingModel.d.ts.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.js +9 -8
- package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
- package/dist/unstable/ai/IdGenerator.d.ts +28 -18
- package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
- package/dist/unstable/ai/IdGenerator.js +18 -11
- package/dist/unstable/ai/IdGenerator.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +36 -30
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +21 -15
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +339 -119
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +264 -98
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +53 -19
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +65 -17
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Model.d.ts +13 -7
- package/dist/unstable/ai/Model.d.ts.map +1 -1
- package/dist/unstable/ai/Model.js +11 -9
- package/dist/unstable/ai/Model.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +2 -2
- package/dist/unstable/ai/Prompt.d.ts +194 -168
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Prompt.js +75 -66
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +153 -140
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js +43 -48
- package/dist/unstable/ai/Response.js.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.d.ts +43 -4
- package/dist/unstable/ai/ResponseIdTracker.d.ts.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.js +27 -2
- package/dist/unstable/ai/ResponseIdTracker.js.map +1 -1
- package/dist/unstable/ai/Telemetry.d.ts +42 -32
- package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
- package/dist/unstable/ai/Telemetry.js +14 -10
- package/dist/unstable/ai/Telemetry.js.map +1 -1
- package/dist/unstable/ai/Tokenizer.d.ts +13 -8
- package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
- package/dist/unstable/ai/Tokenizer.js +10 -6
- package/dist/unstable/ai/Tokenizer.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +153 -84
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +97 -44
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +33 -42
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +35 -36
- package/dist/unstable/ai/Toolkit.js.map +1 -1
- package/dist/unstable/ai/index.d.ts +42 -24
- package/dist/unstable/ai/index.d.ts.map +1 -1
- package/dist/unstable/ai/index.js +42 -24
- package/dist/unstable/ai/index.js.map +1 -1
- package/dist/unstable/cli/Argument.d.ts +226 -134
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js +101 -65
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +72 -26
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +86 -23
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/CliOutput.d.ts +43 -13
- package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
- package/dist/unstable/cli/CliOutput.js +30 -6
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +218 -117
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +45 -31
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Completions.d.ts +7 -7
- package/dist/unstable/cli/Completions.js +1 -1
- package/dist/unstable/cli/Flag.d.ts +235 -142
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +111 -71
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +42 -14
- package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
- package/dist/unstable/cli/GlobalFlag.js +30 -7
- package/dist/unstable/cli/GlobalFlag.js.map +1 -1
- package/dist/unstable/cli/HelpDoc.d.ts +35 -10
- package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
- package/dist/unstable/cli/HelpDoc.js +21 -0
- package/dist/unstable/cli/Param.d.ts +79 -31
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +161 -99
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +79 -42
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js +66 -35
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/Prompt.d.ts +178 -47
- package/dist/unstable/cli/Prompt.d.ts.map +1 -1
- package/dist/unstable/cli/Prompt.js +111 -31
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/internal/ansi.d.ts.map +1 -1
- package/dist/unstable/cli/internal/ansi.js +13 -0
- package/dist/unstable/cli/internal/ansi.js.map +1 -1
- package/dist/unstable/cli/internal/command.d.ts +7 -7
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +12 -10
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/config.d.ts +3 -0
- package/dist/unstable/cli/internal/config.d.ts.map +1 -1
- package/dist/unstable/cli/internal/config.js.map +1 -1
- package/dist/unstable/cli/internal/lexer.js.map +1 -1
- package/dist/unstable/cluster/ClusterCron.d.ts +35 -1
- package/dist/unstable/cluster/ClusterCron.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterCron.js +35 -1
- package/dist/unstable/cluster/ClusterCron.js.map +1 -1
- package/dist/unstable/cluster/ClusterError.d.ts +56 -7
- package/dist/unstable/cluster/ClusterError.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterError.js +56 -7
- package/dist/unstable/cluster/ClusterError.js.map +1 -1
- package/dist/unstable/cluster/ClusterMetrics.d.ts +39 -5
- package/dist/unstable/cluster/ClusterMetrics.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterMetrics.js +39 -5
- package/dist/unstable/cluster/ClusterMetrics.js.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.d.ts +61 -8
- package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.js +61 -8
- package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +14 -2
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +36 -3
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/DeliverAt.d.ts +39 -4
- package/dist/unstable/cluster/DeliverAt.d.ts.map +1 -1
- package/dist/unstable/cluster/DeliverAt.js +11 -3
- package/dist/unstable/cluster/DeliverAt.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +75 -16
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +78 -13
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/EntityAddress.d.ts +30 -2
- package/dist/unstable/cluster/EntityAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityAddress.js +30 -2
- package/dist/unstable/cluster/EntityAddress.js.map +1 -1
- package/dist/unstable/cluster/EntityId.d.ts +18 -3
- package/dist/unstable/cluster/EntityId.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityId.js +15 -2
- package/dist/unstable/cluster/EntityId.js.map +1 -1
- package/dist/unstable/cluster/EntityProxy.d.ts +34 -2
- package/dist/unstable/cluster/EntityProxy.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxy.js +24 -2
- package/dist/unstable/cluster/EntityProxy.js.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.d.ts +17 -2
- package/dist/unstable/cluster/EntityProxyServer.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.js +40 -8
- package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
- package/dist/unstable/cluster/EntityResource.d.ts +43 -6
- package/dist/unstable/cluster/EntityResource.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityResource.js +11 -4
- package/dist/unstable/cluster/EntityResource.js.map +1 -1
- package/dist/unstable/cluster/EntityType.d.ts +27 -3
- package/dist/unstable/cluster/EntityType.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityType.js +24 -2
- package/dist/unstable/cluster/EntityType.js.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts +105 -23
- package/dist/unstable/cluster/Envelope.d.ts.map +1 -1
- package/dist/unstable/cluster/Envelope.js +88 -14
- package/dist/unstable/cluster/Envelope.js.map +1 -1
- package/dist/unstable/cluster/HttpRunner.d.ts +88 -13
- package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/HttpRunner.js +88 -13
- package/dist/unstable/cluster/HttpRunner.js.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.d.ts +49 -6
- package/dist/unstable/cluster/K8sHttpClient.d.ts.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.js +31 -6
- package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
- package/dist/unstable/cluster/MachineId.d.ts +24 -3
- package/dist/unstable/cluster/MachineId.d.ts.map +1 -1
- package/dist/unstable/cluster/MachineId.js +21 -2
- package/dist/unstable/cluster/MachineId.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +102 -13
- package/dist/unstable/cluster/Message.d.ts.map +1 -1
- package/dist/unstable/cluster/Message.js +86 -10
- package/dist/unstable/cluster/Message.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +127 -21
- package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/MessageStorage.js +71 -11
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts +101 -12
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +64 -8
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/Runner.d.ts +47 -17
- package/dist/unstable/cluster/Runner.d.ts.map +1 -1
- package/dist/unstable/cluster/Runner.js +47 -17
- package/dist/unstable/cluster/Runner.js.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.d.ts +34 -2
- package/dist/unstable/cluster/RunnerAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.js +34 -2
- package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.d.ts +40 -12
- package/dist/unstable/cluster/RunnerHealth.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.js +40 -12
- package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts +7 -4
- package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +31 -4
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.d.ts +42 -5
- package/dist/unstable/cluster/RunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.js +38 -4
- package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +73 -10
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +70 -9
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/ShardId.d.ts +51 -5
- package/dist/unstable/cluster/ShardId.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardId.js +47 -4
- package/dist/unstable/cluster/ShardId.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts +10 -2
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +35 -4
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +65 -9
- package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.js +67 -10
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/ShardingRegistrationEvent.d.ts +27 -6
- package/dist/unstable/cluster/ShardingRegistrationEvent.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingRegistrationEvent.js +28 -4
- package/dist/unstable/cluster/ShardingRegistrationEvent.js.map +1 -1
- package/dist/unstable/cluster/SingleRunner.d.ts +23 -1
- package/dist/unstable/cluster/SingleRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/SingleRunner.js +23 -1
- package/dist/unstable/cluster/SingleRunner.js.map +1 -1
- package/dist/unstable/cluster/Singleton.d.ts +15 -1
- package/dist/unstable/cluster/Singleton.d.ts.map +1 -1
- package/dist/unstable/cluster/Singleton.js +15 -1
- package/dist/unstable/cluster/Singleton.js.map +1 -1
- package/dist/unstable/cluster/SingletonAddress.d.ts +21 -1
- package/dist/unstable/cluster/SingletonAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/SingletonAddress.js +21 -1
- package/dist/unstable/cluster/SingletonAddress.js.map +1 -1
- package/dist/unstable/cluster/Snowflake.d.ts +89 -19
- package/dist/unstable/cluster/Snowflake.d.ts.map +1 -1
- package/dist/unstable/cluster/Snowflake.js +48 -13
- package/dist/unstable/cluster/Snowflake.js.map +1 -1
- package/dist/unstable/cluster/SocketRunner.d.ts +8 -2
- package/dist/unstable/cluster/SocketRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/SocketRunner.js +29 -2
- package/dist/unstable/cluster/SocketRunner.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.d.ts +11 -3
- package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +27 -3
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts +11 -3
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js +46 -7
- package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/TestRunner.d.ts +18 -1
- package/dist/unstable/cluster/TestRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/TestRunner.js +18 -1
- package/dist/unstable/cluster/TestRunner.js.map +1 -1
- package/dist/unstable/cluster/internal/hash.js +12 -0
- package/dist/unstable/cluster/internal/hash.js.map +1 -1
- package/dist/unstable/devtools/DevTools.d.ts +26 -3
- package/dist/unstable/devtools/DevTools.d.ts.map +1 -1
- package/dist/unstable/devtools/DevTools.js +26 -3
- package/dist/unstable/devtools/DevTools.js.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.d.ts +20 -5
- package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.js +32 -5
- package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.d.ts +184 -44
- package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js +102 -20
- package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
- package/dist/unstable/devtools/DevToolsServer.d.ts +27 -2
- package/dist/unstable/devtools/DevToolsServer.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsServer.js +21 -1
- package/dist/unstable/devtools/DevToolsServer.js.map +1 -1
- package/dist/unstable/encoding/Msgpack.d.ts +81 -12
- package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
- package/dist/unstable/encoding/Msgpack.js +75 -9
- package/dist/unstable/encoding/Msgpack.js.map +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts +149 -21
- package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
- package/dist/unstable/encoding/Ndjson.js +97 -13
- package/dist/unstable/encoding/Ndjson.js.map +1 -1
- package/dist/unstable/encoding/Sse.d.ts +109 -18
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.js +69 -13
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/eventlog/Event.d.ts +115 -30
- package/dist/unstable/eventlog/Event.d.ts.map +1 -1
- package/dist/unstable/eventlog/Event.js +22 -2
- package/dist/unstable/eventlog/Event.js.map +1 -1
- package/dist/unstable/eventlog/EventGroup.d.ts +50 -17
- package/dist/unstable/eventlog/EventGroup.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventGroup.js +24 -6
- package/dist/unstable/eventlog/EventGroup.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +104 -20
- package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventJournal.js +108 -16
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts +151 -31
- package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLog.js +111 -20
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.d.ts +42 -6
- package/dist/unstable/eventlog/EventLogEncryption.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js +38 -5
- package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +96 -22
- package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.js +72 -16
- package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +35 -8
- package/dist/unstable/eventlog/EventLogRemote.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.js +54 -8
- package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.d.ts +17 -3
- package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.js +17 -3
- package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +32 -6
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.js +52 -6
- package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +74 -16
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js +90 -16
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +59 -15
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.js +73 -14
- package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.d.ts +10 -2
- package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.js +28 -2
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts +32 -3
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js +32 -3
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts +10 -2
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +28 -2
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/http/Cookies.d.ts +156 -77
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +93 -39
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Etag.d.ts +40 -7
- package/dist/unstable/http/Etag.d.ts.map +1 -1
- package/dist/unstable/http/Etag.js +27 -4
- package/dist/unstable/http/Etag.js.map +1 -1
- package/dist/unstable/http/FetchHttpClient.d.ts +29 -3
- package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/unstable/http/FetchHttpClient.js +33 -4
- package/dist/unstable/http/FetchHttpClient.js.map +1 -1
- package/dist/unstable/http/FindMyWay.d.ts +1 -1
- package/dist/unstable/http/FindMyWay.js +1 -1
- package/dist/unstable/http/Headers.d.ts +182 -36
- package/dist/unstable/http/Headers.d.ts.map +1 -1
- package/dist/unstable/http/Headers.js +86 -16
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpBody.d.ts +114 -26
- package/dist/unstable/http/HttpBody.d.ts.map +1 -1
- package/dist/unstable/http/HttpBody.js +100 -22
- package/dist/unstable/http/HttpBody.js.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts +205 -96
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +85 -39
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientError.d.ts +68 -12
- package/dist/unstable/http/HttpClientError.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientError.js +71 -9
- package/dist/unstable/http/HttpClientError.js.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts +318 -100
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +153 -47
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts +59 -16
- package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientResponse.js +44 -11
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts +42 -16
- package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
- package/dist/unstable/http/HttpEffect.js +33 -13
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.d.ts +47 -7
- package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js +44 -6
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMethod.d.ts +35 -5
- package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
- package/dist/unstable/http/HttpMethod.js +23 -1
- package/dist/unstable/http/HttpMethod.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts +37 -11
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +70 -31
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpPlatform.d.ts +34 -3
- package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
- package/dist/unstable/http/HttpPlatform.js +35 -4
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +194 -45
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +122 -28
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServer.d.ts +151 -22
- package/dist/unstable/http/HttpServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpServer.js +77 -12
- package/dist/unstable/http/HttpServer.js.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +90 -10
- package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerError.js +82 -8
- package/dist/unstable/http/HttpServerError.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +125 -21
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +112 -31
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.d.ts +32 -6
- package/dist/unstable/http/HttpServerRespondable.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.js +43 -5
- package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +390 -67
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +209 -38
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpStaticServer.d.ts +22 -4
- package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpStaticServer.js +22 -4
- package/dist/unstable/http/HttpStaticServer.js.map +1 -1
- package/dist/unstable/http/HttpTraceContext.d.ts +53 -6
- package/dist/unstable/http/HttpTraceContext.d.ts.map +1 -1
- package/dist/unstable/http/HttpTraceContext.js +47 -5
- package/dist/unstable/http/HttpTraceContext.js.map +1 -1
- package/dist/unstable/http/Multipart.d.ts +178 -28
- package/dist/unstable/http/Multipart.d.ts.map +1 -1
- package/dist/unstable/http/Multipart.js +130 -20
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/Multipasta/HeadersParser.d.ts +1 -1
- package/dist/unstable/http/Multipasta/HeadersParser.js +1 -1
- package/dist/unstable/http/Multipasta/Node.d.ts +1 -1
- package/dist/unstable/http/Multipasta/Node.js +1 -1
- package/dist/unstable/http/Multipasta/Search.d.ts +1 -1
- package/dist/unstable/http/Multipasta/Search.js +1 -1
- package/dist/unstable/http/Multipasta/Web.d.ts +1 -1
- package/dist/unstable/http/Multipasta/Web.js +1 -1
- package/dist/unstable/http/Multipasta.d.ts +1 -1
- package/dist/unstable/http/Multipasta.js +1 -1
- package/dist/unstable/http/Template.d.ts +53 -0
- package/dist/unstable/http/Template.d.ts.map +1 -1
- package/dist/unstable/http/Template.js +26 -0
- package/dist/unstable/http/Template.js.map +1 -1
- package/dist/unstable/http/Url.d.ts +56 -42
- package/dist/unstable/http/Url.d.ts.map +1 -1
- package/dist/unstable/http/Url.js +29 -15
- package/dist/unstable/http/Url.js.map +1 -1
- package/dist/unstable/http/UrlParams.d.ts +233 -49
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +116 -23
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/httpapi/HttpApi.d.ts +49 -14
- package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js +14 -8
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +55 -16
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +47 -9
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +58 -15
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +43 -7
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +214 -59
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.js +53 -9
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +81 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.js +98 -1
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.d.ts +87 -20
- package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.js +5 -2
- package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +113 -22
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js +49 -6
- package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts +19 -4
- package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.js +32 -2
- package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +67 -30
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.js +48 -27
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts +74 -17
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.js +38 -5
- package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.d.ts +5 -2
- package/dist/unstable/httpapi/HttpApiSwagger.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.js +24 -2
- package/dist/unstable/httpapi/HttpApiSwagger.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiTest.d.ts +9 -2
- package/dist/unstable/httpapi/HttpApiTest.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiTest.js +28 -3
- package/dist/unstable/httpapi/HttpApiTest.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts +86 -15
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +73 -15
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/observability/Otlp.d.ts +33 -3
- package/dist/unstable/observability/Otlp.d.ts.map +1 -1
- package/dist/unstable/observability/Otlp.js +14 -3
- package/dist/unstable/observability/Otlp.js.map +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts +8 -1
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +32 -1
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.d.ts +14 -2
- package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js +29 -2
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts +15 -4
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.js +32 -2
- package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
- package/dist/unstable/observability/OtlpResource.d.ts +49 -12
- package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpResource.js +47 -5
- package/dist/unstable/observability/OtlpResource.js.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.d.ts +28 -3
- package/dist/unstable/observability/OtlpSerialization.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.js +28 -3
- package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.d.ts +16 -2
- package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js +32 -2
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.d.ts +32 -12
- package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.js +7 -5
- package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
- package/dist/unstable/observability/index.d.ts +2 -1
- package/dist/unstable/observability/index.d.ts.map +1 -1
- package/dist/unstable/observability/index.js +2 -1
- package/dist/unstable/observability/index.js.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +93 -18
- package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.js +81 -21
- package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
- package/dist/unstable/persistence/Persistable.d.ts +76 -15
- package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistable.js +22 -5
- package/dist/unstable/persistence/Persistable.js.map +1 -1
- package/dist/unstable/persistence/PersistedCache.d.ts +27 -2
- package/dist/unstable/persistence/PersistedCache.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedCache.js +24 -1
- package/dist/unstable/persistence/PersistedCache.js.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts +73 -16
- package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.js +60 -13
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/Persistence.d.ts +97 -16
- package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistence.js +90 -14
- package/dist/unstable/persistence/Persistence.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +97 -21
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +82 -17
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/persistence/Redis.d.ts +26 -5
- package/dist/unstable/persistence/Redis.d.ts.map +1 -1
- package/dist/unstable/persistence/Redis.js +36 -4
- package/dist/unstable/persistence/Redis.js.map +1 -1
- package/dist/unstable/process/ChildProcess.d.ts +89 -109
- package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcess.js +74 -23
- package/dist/unstable/process/ChildProcess.js.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.d.ts +22 -11
- package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js +11 -6
- package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
- package/dist/unstable/process/index.d.ts +2 -1
- package/dist/unstable/process/index.d.ts.map +1 -1
- package/dist/unstable/process/index.js +2 -1
- package/dist/unstable/process/index.js.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.d.ts +196 -59
- package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.js +121 -36
- package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +539 -130
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +256 -62
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +41 -2
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.js +35 -1
- package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/unstable/reactivity/AtomRef.d.ts +51 -7
- package/dist/unstable/reactivity/AtomRef.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRef.js +29 -3
- package/dist/unstable/reactivity/AtomRef.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.d.ts +135 -21
- package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +69 -10
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts +36 -2
- package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.js +29 -1
- package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
- package/dist/unstable/reactivity/Hydration.d.ts +28 -5
- package/dist/unstable/reactivity/Hydration.d.ts.map +1 -1
- package/dist/unstable/reactivity/Hydration.js +35 -3
- package/dist/unstable/reactivity/Hydration.js.map +1 -1
- package/dist/unstable/reactivity/Reactivity.d.ts +95 -13
- package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
- package/dist/unstable/reactivity/Reactivity.js +61 -7
- package/dist/unstable/reactivity/Reactivity.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +255 -56
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js +44 -11
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts +81 -19
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +53 -13
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcClientError.d.ts +26 -2
- package/dist/unstable/rpc/RpcClientError.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClientError.js +26 -2
- package/dist/unstable/rpc/RpcClientError.js.map +1 -1
- package/dist/unstable/rpc/RpcGroup.d.ts +51 -8
- package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcGroup.js +3 -1
- package/dist/unstable/rpc/RpcGroup.js.map +1 -1
- package/dist/unstable/rpc/RpcMessage.d.ts +128 -32
- package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMessage.js +23 -7
- package/dist/unstable/rpc/RpcMessage.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts +100 -20
- package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js +39 -3
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts +38 -4
- package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSchema.js +34 -3
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts +60 -13
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +56 -12
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +73 -23
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +70 -23
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/rpc/RpcTest.d.ts +20 -1
- package/dist/unstable/rpc/RpcTest.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcTest.js +20 -1
- package/dist/unstable/rpc/RpcTest.js.map +1 -1
- package/dist/unstable/rpc/RpcWorker.d.ts +40 -6
- package/dist/unstable/rpc/RpcWorker.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcWorker.js +17 -5
- package/dist/unstable/rpc/RpcWorker.js.map +1 -1
- package/dist/unstable/rpc/Utils.d.ts +8 -0
- package/dist/unstable/rpc/Utils.d.ts.map +1 -1
- package/dist/unstable/rpc/Utils.js +8 -0
- package/dist/unstable/rpc/Utils.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts +130 -52
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js +79 -34
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +104 -24
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.js +22 -6
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +167 -34
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +124 -29
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/socket/SocketServer.d.ts +58 -10
- package/dist/unstable/socket/SocketServer.d.ts.map +1 -1
- package/dist/unstable/socket/SocketServer.js +43 -5
- package/dist/unstable/socket/SocketServer.js.map +1 -1
- package/dist/unstable/sql/Migrator.d.ts +35 -4
- package/dist/unstable/sql/Migrator.d.ts.map +1 -1
- package/dist/unstable/sql/Migrator.js +45 -5
- package/dist/unstable/sql/Migrator.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts +34 -2
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +38 -1
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/sql/SqlConnection.d.ts +31 -0
- package/dist/unstable/sql/SqlConnection.d.ts.map +1 -1
- package/dist/unstable/sql/SqlConnection.js +22 -0
- package/dist/unstable/sql/SqlConnection.js.map +1 -1
- package/dist/unstable/sql/SqlError.d.ts +99 -0
- package/dist/unstable/sql/SqlError.d.ts.map +1 -1
- package/dist/unstable/sql/SqlError.js +114 -0
- package/dist/unstable/sql/SqlError.js.map +1 -1
- package/dist/unstable/sql/SqlModel.d.ts +26 -5
- package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
- package/dist/unstable/sql/SqlModel.js +8 -4
- package/dist/unstable/sql/SqlModel.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.d.ts +56 -13
- package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
- package/dist/unstable/sql/SqlResolver.js +44 -10
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/sql/SqlSchema.d.ts +29 -8
- package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
- package/dist/unstable/sql/SqlSchema.js +29 -8
- package/dist/unstable/sql/SqlSchema.js.map +1 -1
- package/dist/unstable/sql/SqlStream.d.ts +3 -0
- package/dist/unstable/sql/SqlStream.d.ts.map +1 -1
- package/dist/unstable/sql/SqlStream.js +23 -0
- package/dist/unstable/sql/SqlStream.js.map +1 -1
- package/dist/unstable/sql/Statement.d.ts +124 -0
- package/dist/unstable/sql/Statement.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.js +82 -0
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/sql/index.d.ts +1 -1
- package/dist/unstable/sql/index.js +1 -1
- package/dist/unstable/workers/Transferable.d.ts +65 -13
- package/dist/unstable/workers/Transferable.d.ts.map +1 -1
- package/dist/unstable/workers/Transferable.js +53 -10
- package/dist/unstable/workers/Transferable.js.map +1 -1
- package/dist/unstable/workers/Worker.d.ts +60 -8
- package/dist/unstable/workers/Worker.d.ts.map +1 -1
- package/dist/unstable/workers/Worker.js +43 -4
- package/dist/unstable/workers/Worker.js.map +1 -1
- package/dist/unstable/workers/WorkerError.d.ts +31 -9
- package/dist/unstable/workers/WorkerError.d.ts.map +1 -1
- package/dist/unstable/workers/WorkerError.js +44 -7
- package/dist/unstable/workers/WorkerError.js.map +1 -1
- package/dist/unstable/workers/WorkerRunner.d.ts +32 -3
- package/dist/unstable/workers/WorkerRunner.d.ts.map +1 -1
- package/dist/unstable/workers/WorkerRunner.js +24 -1
- package/dist/unstable/workers/WorkerRunner.js.map +1 -1
- package/dist/unstable/workers/index.d.ts +1 -1
- package/dist/unstable/workers/index.js +1 -1
- package/dist/unstable/workflow/Activity.d.ts +61 -10
- package/dist/unstable/workflow/Activity.d.ts.map +1 -1
- package/dist/unstable/workflow/Activity.js +21 -6
- package/dist/unstable/workflow/Activity.js.map +1 -1
- package/dist/unstable/workflow/DurableClock.d.ts +12 -3
- package/dist/unstable/workflow/DurableClock.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableClock.js +22 -2
- package/dist/unstable/workflow/DurableClock.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts +126 -31
- package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.js +76 -13
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/DurableQueue.d.ts +145 -0
- package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -0
- package/dist/unstable/workflow/DurableQueue.js +200 -0
- package/dist/unstable/workflow/DurableQueue.js.map +1 -0
- package/dist/unstable/workflow/Workflow.d.ts +100 -31
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js +76 -20
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +40 -5
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +16 -4
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.d.ts +32 -2
- package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.js +2 -2
- package/dist/unstable/workflow/WorkflowProxy.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.d.ts +36 -2
- package/dist/unstable/workflow/WorkflowProxyServer.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.js +12 -6
- package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
- package/dist/unstable/workflow/index.d.ts +4 -0
- package/dist/unstable/workflow/index.d.ts.map +1 -1
- package/dist/unstable/workflow/index.js +4 -0
- package/dist/unstable/workflow/index.js.map +1 -1
- package/package.json +11 -11
- package/src/Array.ts +113 -67
- package/src/BigDecimal.ts +404 -337
- package/src/BigInt.ts +167 -97
- package/src/Boolean.ts +62 -31
- package/src/Brand.ts +20 -1
- package/src/Cache.ts +331 -164
- package/src/Cause.ts +77 -65
- package/src/Channel.ts +1585 -607
- package/src/ChannelSchema.ts +137 -12
- package/src/Chunk.ts +549 -380
- package/src/Clock.ts +15 -8
- package/src/Combiner.ts +2 -4
- package/src/Config.ts +12 -10
- package/src/ConfigProvider.ts +1 -1
- package/src/Console.ts +88 -58
- package/src/Context.ts +397 -149
- package/src/Cron.ts +111 -48
- package/src/Data.ts +3 -2
- package/src/DateTime.ts +876 -445
- package/src/Deferred.ts +367 -174
- package/src/Differ.ts +42 -0
- package/src/Duration.ts +329 -185
- package/src/Effect.ts +2474 -2395
- package/src/Effectable.ts +39 -4
- package/src/Encoding.ts +78 -28
- package/src/Equivalence.ts +14 -19
- package/src/ErrorReporter.ts +66 -82
- package/src/ExecutionPlan.ts +97 -13
- package/src/Exit.ts +7 -5
- package/src/Fiber.ts +72 -40
- package/src/FiberHandle.ts +158 -58
- package/src/FiberMap.ts +329 -164
- package/src/FiberSet.ts +130 -52
- package/src/FileSystem.ts +106 -74
- package/src/Filter.ts +166 -88
- package/src/Function.ts +154 -86
- package/src/Graph.ts +682 -365
- package/src/HKT.ts +29 -13
- package/src/Hash.ts +31 -18
- package/src/HashMap.ts +444 -256
- package/src/HashRing.ts +94 -17
- package/src/HashSet.ts +194 -104
- package/src/Inspectable.ts +22 -10
- package/src/Iterable.ts +309 -149
- package/src/JsonPatch.ts +4 -3
- package/src/Latch.ts +98 -15
- package/src/Layer.ts +488 -345
- package/src/LayerMap.ts +98 -25
- package/src/LogLevel.ts +92 -131
- package/src/Logger.ts +357 -288
- package/src/ManagedRuntime.ts +75 -17
- package/src/Match.ts +133 -157
- package/src/Metric.ts +355 -304
- package/src/MutableHashMap.ts +161 -84
- package/src/MutableHashSet.ts +122 -52
- package/src/MutableList.ts +141 -81
- package/src/MutableRef.ts +130 -90
- package/src/Newtype.ts +3 -0
- package/src/NonEmptyIterable.ts +36 -39
- package/src/Number.ts +116 -64
- package/src/Optic.ts +1 -2
- package/src/Option.ts +41 -53
- package/src/Ordering.ts +43 -28
- package/src/PartitionedSemaphore.ts +225 -40
- package/src/Path.ts +77 -13
- package/src/Pipeable.ts +76 -21
- package/src/PlatformError.ts +74 -6
- package/src/Pool.ts +94 -31
- package/src/Predicate.ts +16 -21
- package/src/PrimaryKey.ts +9 -2
- package/src/PubSub.ts +364 -262
- package/src/Pull.ts +94 -25
- package/src/Queue.ts +284 -150
- package/src/Random.ts +54 -35
- package/src/RcMap.ts +151 -141
- package/src/RcRef.ts +69 -32
- package/src/Record.ts +273 -129
- package/src/Redactable.ts +3 -3
- package/src/Redacted.ts +63 -33
- package/src/Ref.ts +161 -104
- package/src/References.ts +73 -31
- package/src/RegExp.ts +11 -5
- package/src/Request.ts +158 -34
- package/src/RequestResolver.ts +277 -119
- package/src/Resource.ts +45 -7
- package/src/Result.ts +31 -18
- package/src/Runtime.ts +45 -19
- package/src/Schedule.ts +575 -600
- package/src/Scheduler.ts +43 -6
- package/src/Schema.ts +845 -319
- package/src/SchemaAST.ts +25 -16
- package/src/SchemaGetter.ts +32 -17
- package/src/SchemaIssue.ts +1 -8
- package/src/SchemaParser.ts +262 -38
- package/src/SchemaTransformation.ts +61 -41
- package/src/SchemaUtils.ts +23 -0
- package/src/Scope.ts +102 -43
- package/src/ScopedCache.ts +192 -56
- package/src/ScopedRef.ts +28 -8
- package/src/Semaphore.ts +64 -28
- package/src/Sink.ts +458 -200
- package/src/Stdio.ts +43 -6
- package/src/Stream.ts +2043 -1256
- package/src/String.ts +171 -95
- package/src/SubscriptionRef.ts +308 -203
- package/src/Symbol.ts +13 -5
- package/src/SynchronizedRef.ts +278 -62
- package/src/Take.ts +26 -2
- package/src/Terminal.ts +40 -7
- package/src/Tracer.ts +229 -55
- package/src/Trie.ts +213 -142
- package/src/TxChunk.ts +182 -146
- package/src/TxDeferred.ts +43 -29
- package/src/TxHashMap.ts +370 -230
- package/src/TxHashSet.ts +250 -152
- package/src/TxPriorityQueue.ts +96 -64
- package/src/TxPubSub.ts +77 -49
- package/src/TxQueue.ts +279 -241
- package/src/TxReentrantLock.ts +70 -47
- package/src/TxRef.ts +70 -41
- package/src/TxSemaphore.ts +101 -54
- package/src/TxSubscriptionRef.ts +72 -48
- package/src/Types.ts +34 -34
- package/src/UndefinedOr.ts +48 -25
- package/src/Unify.ts +71 -116
- package/src/Utils.ts +4 -0
- package/src/index.ts +81 -32
- package/src/internal/concurrency.ts +2 -2
- package/src/internal/core.ts +12 -23
- package/src/internal/effect.ts +25 -29
- package/src/internal/executionPlan.ts +2 -2
- package/src/internal/option.ts +5 -8
- package/src/internal/result.ts +5 -8
- package/src/internal/schema/schema.ts +1 -1
- package/src/testing/FastCheck.ts +6 -3
- package/src/testing/TestClock.ts +63 -34
- package/src/testing/TestConsole.ts +49 -30
- package/src/testing/TestSchema.ts +8 -8
- package/src/unstable/ai/AiError.ts +187 -120
- package/src/unstable/ai/AnthropicStructuredOutput.ts +2 -2
- package/src/unstable/ai/Chat.ts +69 -43
- package/src/unstable/ai/EmbeddingModel.ts +12 -11
- package/src/unstable/ai/IdGenerator.ts +28 -18
- package/src/unstable/ai/LanguageModel.ts +47 -46
- package/src/unstable/ai/McpSchema.ts +339 -119
- package/src/unstable/ai/McpServer.ts +78 -21
- package/src/unstable/ai/Model.ts +23 -18
- package/src/unstable/ai/OpenAiStructuredOutput.ts +2 -2
- package/src/unstable/ai/Prompt.ts +210 -184
- package/src/unstable/ai/Response.ts +159 -147
- package/src/unstable/ai/ResponseIdTracker.ts +43 -4
- package/src/unstable/ai/Telemetry.ts +42 -32
- package/src/unstable/ai/Tokenizer.ts +13 -8
- package/src/unstable/ai/Tool.ts +154 -85
- package/src/unstable/ai/Toolkit.ts +81 -84
- package/src/unstable/ai/index.ts +42 -24
- package/src/unstable/cli/Argument.ts +226 -134
- package/src/unstable/cli/CliError.ts +96 -26
- package/src/unstable/cli/CliOutput.ts +43 -13
- package/src/unstable/cli/Command.ts +225 -125
- package/src/unstable/cli/Completions.ts +7 -7
- package/src/unstable/cli/Flag.ts +235 -142
- package/src/unstable/cli/GlobalFlag.ts +42 -14
- package/src/unstable/cli/HelpDoc.ts +35 -10
- package/src/unstable/cli/Param.ts +328 -190
- package/src/unstable/cli/Primitive.ts +79 -42
- package/src/unstable/cli/Prompt.ts +210 -58
- package/src/unstable/cli/internal/ansi.ts +13 -0
- package/src/unstable/cli/internal/command.ts +17 -15
- package/src/unstable/cli/internal/config.ts +3 -0
- package/src/unstable/cli/internal/lexer.ts +11 -0
- package/src/unstable/cluster/ClusterCron.ts +35 -1
- package/src/unstable/cluster/ClusterError.ts +56 -7
- package/src/unstable/cluster/ClusterMetrics.ts +39 -5
- package/src/unstable/cluster/ClusterSchema.ts +61 -8
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +36 -3
- package/src/unstable/cluster/DeliverAt.ts +39 -4
- package/src/unstable/cluster/Entity.ts +110 -19
- package/src/unstable/cluster/EntityAddress.ts +30 -2
- package/src/unstable/cluster/EntityId.ts +18 -3
- package/src/unstable/cluster/EntityProxy.ts +34 -2
- package/src/unstable/cluster/EntityProxyServer.ts +44 -8
- package/src/unstable/cluster/EntityResource.ts +43 -6
- package/src/unstable/cluster/EntityType.ts +27 -3
- package/src/unstable/cluster/Envelope.ts +128 -23
- package/src/unstable/cluster/HttpRunner.ts +88 -13
- package/src/unstable/cluster/K8sHttpClient.ts +49 -6
- package/src/unstable/cluster/MachineId.ts +24 -3
- package/src/unstable/cluster/Message.ts +102 -13
- package/src/unstable/cluster/MessageStorage.ts +128 -22
- package/src/unstable/cluster/Reply.ts +101 -12
- package/src/unstable/cluster/Runner.ts +47 -17
- package/src/unstable/cluster/RunnerAddress.ts +34 -2
- package/src/unstable/cluster/RunnerHealth.ts +40 -12
- package/src/unstable/cluster/RunnerServer.ts +31 -4
- package/src/unstable/cluster/RunnerStorage.ts +42 -5
- package/src/unstable/cluster/Runners.ts +73 -10
- package/src/unstable/cluster/ShardId.ts +51 -5
- package/src/unstable/cluster/Sharding.ts +35 -4
- package/src/unstable/cluster/ShardingConfig.ts +76 -11
- package/src/unstable/cluster/ShardingRegistrationEvent.ts +31 -7
- package/src/unstable/cluster/SingleRunner.ts +23 -1
- package/src/unstable/cluster/Singleton.ts +15 -1
- package/src/unstable/cluster/SingletonAddress.ts +21 -1
- package/src/unstable/cluster/Snowflake.ts +89 -19
- package/src/unstable/cluster/SocketRunner.ts +29 -2
- package/src/unstable/cluster/SqlMessageStorage.ts +27 -3
- package/src/unstable/cluster/SqlRunnerStorage.ts +46 -7
- package/src/unstable/cluster/TestRunner.ts +18 -1
- package/src/unstable/cluster/internal/hash.ts +12 -0
- package/src/unstable/devtools/DevTools.ts +26 -3
- package/src/unstable/devtools/DevToolsClient.ts +32 -5
- package/src/unstable/devtools/DevToolsSchema.ts +201 -44
- package/src/unstable/devtools/DevToolsServer.ts +27 -2
- package/src/unstable/encoding/Msgpack.ts +97 -12
- package/src/unstable/encoding/Ndjson.ts +149 -21
- package/src/unstable/encoding/Sse.ts +109 -18
- package/src/unstable/eventlog/Event.ts +131 -30
- package/src/unstable/eventlog/EventGroup.ts +50 -17
- package/src/unstable/eventlog/EventJournal.ts +120 -20
- package/src/unstable/eventlog/EventLog.ts +151 -31
- package/src/unstable/eventlog/EventLogEncryption.ts +42 -6
- package/src/unstable/eventlog/EventLogMessage.ts +92 -18
- package/src/unstable/eventlog/EventLogRemote.ts +54 -8
- package/src/unstable/eventlog/EventLogServer.ts +33 -3
- package/src/unstable/eventlog/EventLogServerEncrypted.ts +52 -6
- package/src/unstable/eventlog/EventLogServerUnencrypted.ts +90 -16
- package/src/unstable/eventlog/EventLogSessionAuth.ts +77 -15
- package/src/unstable/eventlog/SqlEventJournal.ts +28 -2
- package/src/unstable/eventlog/SqlEventLogServerEncrypted.ts +32 -3
- package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +28 -2
- package/src/unstable/http/Cookies.ts +156 -77
- package/src/unstable/http/Etag.ts +40 -7
- package/src/unstable/http/FetchHttpClient.ts +33 -4
- package/src/unstable/http/FindMyWay.ts +1 -1
- package/src/unstable/http/Headers.ts +252 -50
- package/src/unstable/http/HttpBody.ts +130 -28
- package/src/unstable/http/HttpClient.ts +206 -97
- package/src/unstable/http/HttpClientError.ts +80 -12
- package/src/unstable/http/HttpClientRequest.ts +320 -102
- package/src/unstable/http/HttpClientResponse.ts +59 -16
- package/src/unstable/http/HttpEffect.ts +66 -18
- package/src/unstable/http/HttpIncomingMessage.ts +47 -7
- package/src/unstable/http/HttpMethod.ts +35 -5
- package/src/unstable/http/HttpMiddleware.ts +63 -16
- package/src/unstable/http/HttpPlatform.ts +35 -4
- package/src/unstable/http/HttpRouter.ts +221 -57
- package/src/unstable/http/HttpServer.ts +152 -23
- package/src/unstable/http/HttpServerError.ts +90 -10
- package/src/unstable/http/HttpServerRequest.ts +136 -32
- package/src/unstable/http/HttpServerRespondable.ts +49 -6
- package/src/unstable/http/HttpServerResponse.ts +395 -72
- package/src/unstable/http/HttpStaticServer.ts +22 -4
- package/src/unstable/http/HttpTraceContext.ts +53 -6
- package/src/unstable/http/Multipart.ts +179 -29
- package/src/unstable/http/Multipasta/HeadersParser.ts +1 -1
- package/src/unstable/http/Multipasta/Node.ts +1 -1
- package/src/unstable/http/Multipasta/Search.ts +1 -1
- package/src/unstable/http/Multipasta/Web.ts +1 -1
- package/src/unstable/http/Multipasta.ts +1 -1
- package/src/unstable/http/Template.ts +53 -0
- package/src/unstable/http/Url.ts +56 -42
- package/src/unstable/http/UrlParams.ts +233 -49
- package/src/unstable/httpapi/HttpApi.ts +49 -14
- package/src/unstable/httpapi/HttpApiBuilder.ts +86 -20
- package/src/unstable/httpapi/HttpApiClient.ts +80 -16
- package/src/unstable/httpapi/HttpApiEndpoint.ts +238 -59
- package/src/unstable/httpapi/HttpApiError.ts +100 -1
- package/src/unstable/httpapi/HttpApiGroup.ts +87 -20
- package/src/unstable/httpapi/HttpApiMiddleware.ts +113 -23
- package/src/unstable/httpapi/HttpApiScalar.ts +38 -4
- package/src/unstable/httpapi/HttpApiSchema.ts +67 -30
- package/src/unstable/httpapi/HttpApiSecurity.ts +74 -17
- package/src/unstable/httpapi/HttpApiSwagger.ts +24 -2
- package/src/unstable/httpapi/HttpApiTest.ts +31 -3
- package/src/unstable/httpapi/OpenApi.ts +115 -15
- package/src/unstable/observability/Otlp.ts +33 -3
- package/src/unstable/observability/OtlpExporter.ts +32 -1
- package/src/unstable/observability/OtlpLogger.ts +31 -2
- package/src/unstable/observability/OtlpMetrics.ts +37 -4
- package/src/unstable/observability/OtlpResource.ts +68 -12
- package/src/unstable/observability/OtlpSerialization.ts +28 -3
- package/src/unstable/observability/OtlpTracer.ts +38 -2
- package/src/unstable/observability/PrometheusMetrics.ts +32 -12
- package/src/unstable/observability/index.ts +2 -1
- package/src/unstable/persistence/KeyValueStore.ts +108 -28
- package/src/unstable/persistence/Persistable.ts +76 -15
- package/src/unstable/persistence/PersistedCache.ts +27 -2
- package/src/unstable/persistence/PersistedQueue.ts +98 -16
- package/src/unstable/persistence/Persistence.ts +97 -16
- package/src/unstable/persistence/RateLimiter.ts +98 -22
- package/src/unstable/persistence/Redis.ts +42 -5
- package/src/unstable/process/ChildProcess.ts +100 -79
- package/src/unstable/process/ChildProcessSpawner.ts +22 -11
- package/src/unstable/process/index.ts +2 -1
- package/src/unstable/reactivity/AsyncResult.ts +202 -61
- package/src/unstable/reactivity/Atom.ts +597 -143
- package/src/unstable/reactivity/AtomHttpApi.ts +41 -2
- package/src/unstable/reactivity/AtomRef.ts +51 -7
- package/src/unstable/reactivity/AtomRegistry.ts +141 -22
- package/src/unstable/reactivity/AtomRpc.ts +36 -2
- package/src/unstable/reactivity/Hydration.ts +45 -5
- package/src/unstable/reactivity/Reactivity.ts +95 -13
- package/src/unstable/rpc/Rpc.ts +255 -56
- package/src/unstable/rpc/RpcClient.ts +108 -20
- package/src/unstable/rpc/RpcClientError.ts +26 -2
- package/src/unstable/rpc/RpcGroup.ts +51 -8
- package/src/unstable/rpc/RpcMessage.ts +128 -32
- package/src/unstable/rpc/RpcMiddleware.ts +100 -20
- package/src/unstable/rpc/RpcSchema.ts +38 -4
- package/src/unstable/rpc/RpcSerialization.ts +60 -13
- package/src/unstable/rpc/RpcServer.ts +108 -25
- package/src/unstable/rpc/RpcTest.ts +20 -1
- package/src/unstable/rpc/RpcWorker.ts +42 -8
- package/src/unstable/rpc/Utils.ts +31 -0
- package/src/unstable/schema/Model.ts +148 -52
- package/src/unstable/schema/VariantSchema.ts +104 -24
- package/src/unstable/socket/Socket.ts +168 -35
- package/src/unstable/socket/SocketServer.ts +58 -10
- package/src/unstable/sql/Migrator.ts +57 -5
- package/src/unstable/sql/SqlClient.ts +55 -2
- package/src/unstable/sql/SqlConnection.ts +31 -0
- package/src/unstable/sql/SqlError.ts +117 -0
- package/src/unstable/sql/SqlModel.ts +26 -5
- package/src/unstable/sql/SqlResolver.ts +56 -13
- package/src/unstable/sql/SqlSchema.ts +29 -8
- package/src/unstable/sql/SqlStream.ts +23 -0
- package/src/unstable/sql/Statement.ts +141 -0
- package/src/unstable/sql/index.ts +1 -1
- package/src/unstable/workers/Transferable.ts +65 -13
- package/src/unstable/workers/Worker.ts +60 -8
- package/src/unstable/workers/WorkerError.ts +50 -9
- package/src/unstable/workers/WorkerRunner.ts +32 -3
- package/src/unstable/workers/index.ts +1 -1
- package/src/unstable/workflow/Activity.ts +62 -11
- package/src/unstable/workflow/DurableClock.ts +26 -3
- package/src/unstable/workflow/DurableDeferred.ts +146 -31
- package/src/unstable/workflow/DurableQueue.ts +366 -0
- package/src/unstable/workflow/Workflow.ts +122 -32
- package/src/unstable/workflow/WorkflowEngine.ts +40 -5
- package/src/unstable/workflow/WorkflowProxy.ts +32 -2
- package/src/unstable/workflow/WorkflowProxyServer.ts +40 -6
- package/src/unstable/workflow/index.ts +5 -0
package/src/Schedule.ts
CHANGED
|
@@ -6,7 +6,8 @@
|
|
|
6
6
|
* along with a delay duration. Schedules can be combined, transformed, and used to implement
|
|
7
7
|
* sophisticated retry and repetition logic.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
9
|
+
* **Example** (Retrying and repeating effects)
|
|
10
|
+
*
|
|
10
11
|
* ```ts
|
|
11
12
|
* import { Effect, Schedule } from "effect"
|
|
12
13
|
*
|
|
@@ -53,9 +54,14 @@ const randomNext: Effect<number> = random.Random.useSync((random) => random.next
|
|
|
53
54
|
/**
|
|
54
55
|
* A Schedule defines a strategy for repeating or retrying effects based on some policy.
|
|
55
56
|
*
|
|
56
|
-
*
|
|
57
|
+
* **Example** (Defining retry and repeat schedules)
|
|
58
|
+
*
|
|
57
59
|
* ```ts
|
|
58
|
-
* import { Console, Effect, Schedule } from "effect"
|
|
60
|
+
* import { Console, Data, Effect, Schedule } from "effect"
|
|
61
|
+
*
|
|
62
|
+
* class NetworkError extends Data.TaggedError("NetworkError")<{
|
|
63
|
+
* readonly attempt: number
|
|
64
|
+
* }> {}
|
|
59
65
|
*
|
|
60
66
|
* // Basic retry schedule - retry up to 3 times with exponential backoff
|
|
61
67
|
* const retrySchedule = Schedule.exponential("100 millis").pipe(
|
|
@@ -66,25 +72,29 @@ const randomNext: Effect<number> = random.Random.useSync((random) => random.next
|
|
|
66
72
|
* const repeatSchedule: Schedule.Schedule<number, unknown, never> = Schedule
|
|
67
73
|
* .spaced("30 seconds")
|
|
68
74
|
*
|
|
69
|
-
* // Advanced schedule with custom logic
|
|
70
|
-
* const smartRetry = Schedule.exponential("1 second")
|
|
71
|
-
*
|
|
72
75
|
* const program = Effect.gen(function*() {
|
|
73
|
-
*
|
|
76
|
+
* let attempts = 0
|
|
77
|
+
*
|
|
74
78
|
* const result1 = yield* Effect.retry(
|
|
75
|
-
* Effect.
|
|
79
|
+
* Effect.gen(function*() {
|
|
80
|
+
* attempts++
|
|
81
|
+
* if (attempts < 3) {
|
|
82
|
+
* return yield* Effect.fail(new NetworkError({ attempt: attempts }))
|
|
83
|
+
* }
|
|
84
|
+
* return "Success"
|
|
85
|
+
* }),
|
|
76
86
|
* retrySchedule
|
|
77
87
|
* )
|
|
88
|
+
* console.log(result1) // "Success"
|
|
78
89
|
*
|
|
79
|
-
* // Using repeat schedule
|
|
80
90
|
* yield* Console.log("heartbeat").pipe(
|
|
81
91
|
* Effect.repeat(repeatSchedule.pipe(Schedule.take(5)))
|
|
82
92
|
* )
|
|
83
93
|
* })
|
|
84
94
|
* ```
|
|
85
95
|
*
|
|
86
|
-
* @since 2.0.0
|
|
87
96
|
* @category Models
|
|
97
|
+
* @since 2.0.0
|
|
88
98
|
*/
|
|
89
99
|
export interface Schedule<out Output, in Input = unknown, out Error = never, out Env = never>
|
|
90
100
|
extends Schedule.Variance<Output, Input, Error, Env>, Pipeable
|
|
@@ -93,7 +103,8 @@ export interface Schedule<out Output, in Input = unknown, out Error = never, out
|
|
|
93
103
|
/**
|
|
94
104
|
* Metadata provided to schedule functions containing timing and input information.
|
|
95
105
|
*
|
|
96
|
-
*
|
|
106
|
+
* **Example** (Reading schedule input metadata)
|
|
107
|
+
*
|
|
97
108
|
* ```ts
|
|
98
109
|
* import { Console, Effect, Schedule } from "effect"
|
|
99
110
|
*
|
|
@@ -112,8 +123,8 @@ export interface Schedule<out Output, in Input = unknown, out Error = never, out
|
|
|
112
123
|
* })
|
|
113
124
|
* ```
|
|
114
125
|
*
|
|
115
|
-
* @since 4.0.0
|
|
116
126
|
* @category Metadata
|
|
127
|
+
* @since 4.0.0
|
|
117
128
|
*/
|
|
118
129
|
export interface InputMetadata<Input> {
|
|
119
130
|
readonly input: Input
|
|
@@ -127,18 +138,19 @@ export interface InputMetadata<Input> {
|
|
|
127
138
|
/**
|
|
128
139
|
* Extended metadata that includes both input metadata and the output value from the schedule.
|
|
129
140
|
*
|
|
130
|
-
*
|
|
141
|
+
* **Example** (Logging schedule output metadata)
|
|
142
|
+
*
|
|
131
143
|
* ```ts
|
|
132
144
|
* import { Console, Duration, Effect, Schedule } from "effect"
|
|
133
145
|
*
|
|
134
|
-
* // Custom schedule that logs metadata
|
|
146
|
+
* // Custom schedule that logs metadata and output for each recurrence
|
|
135
147
|
* const loggingSchedule = Schedule.unfold(0, (n) => Effect.succeed(n + 1)).pipe(
|
|
136
148
|
* Schedule.addDelay(() => Effect.succeed(Duration.millis(100))),
|
|
137
|
-
* Schedule.
|
|
138
|
-
*
|
|
139
|
-
* `Output: ${output}`
|
|
140
|
-
* )
|
|
141
|
-
*
|
|
149
|
+
* Schedule.collectWhile((metadata) =>
|
|
150
|
+
* Console.log(
|
|
151
|
+
* `Output: ${metadata.output}, attempt: ${metadata.attempt}, elapsed: ${metadata.elapsed}ms`
|
|
152
|
+
* ).pipe(Effect.as(metadata.attempt <= 3))
|
|
153
|
+
* )
|
|
142
154
|
* )
|
|
143
155
|
*
|
|
144
156
|
* const program = Effect.gen(function*() {
|
|
@@ -149,13 +161,13 @@ export interface InputMetadata<Input> {
|
|
|
149
161
|
* })
|
|
150
162
|
*
|
|
151
163
|
* // Output logs will show:
|
|
152
|
-
* //
|
|
153
|
-
* //
|
|
154
|
-
* //
|
|
164
|
+
* // Output: 0, attempt: 1, elapsed: 0ms
|
|
165
|
+
* // Output: 1, attempt: 2, elapsed: 100ms
|
|
166
|
+
* // Output: 2, attempt: 3, elapsed: 200ms
|
|
155
167
|
* ```
|
|
156
168
|
*
|
|
157
|
-
* @since 4.0.0
|
|
158
169
|
* @category Metadata
|
|
170
|
+
* @since 4.0.0
|
|
159
171
|
*/
|
|
160
172
|
export interface Metadata<Output = unknown, Input = unknown> extends InputMetadata<Input> {
|
|
161
173
|
readonly output: Output
|
|
@@ -163,8 +175,16 @@ export interface Metadata<Output = unknown, Input = unknown> extends InputMetada
|
|
|
163
175
|
}
|
|
164
176
|
|
|
165
177
|
/**
|
|
166
|
-
*
|
|
178
|
+
* Context reference containing metadata for the currently running schedule step.
|
|
179
|
+
*
|
|
180
|
+
* **Details**
|
|
181
|
+
* Repeat, retry, stream, and channel scheduling operations provide this service
|
|
182
|
+
* to effects run between schedule steps. The default value contains undefined
|
|
183
|
+
* input and output values, zero duration, and zeroed timing fields before any
|
|
184
|
+
* schedule step has produced metadata.
|
|
185
|
+
*
|
|
167
186
|
* @category Metadata
|
|
187
|
+
* @since 4.0.0
|
|
168
188
|
*/
|
|
169
189
|
export const CurrentMetadata = Context.Reference<Metadata>("effect/Schedule/CurrentMetadata", {
|
|
170
190
|
defaultValue: constant({
|
|
@@ -182,7 +202,8 @@ export const CurrentMetadata = Context.Reference<Metadata>("effect/Schedule/Curr
|
|
|
182
202
|
/**
|
|
183
203
|
* The Schedule namespace contains types and utilities for working with schedules.
|
|
184
204
|
*
|
|
185
|
-
*
|
|
205
|
+
* **Example** (Creating custom schedules with the namespace)
|
|
206
|
+
*
|
|
186
207
|
* ```ts
|
|
187
208
|
* import { Duration, Effect, Schedule } from "effect"
|
|
188
209
|
*
|
|
@@ -209,14 +230,15 @@ export const CurrentMetadata = Context.Reference<Metadata>("effect/Schedule/Curr
|
|
|
209
230
|
* })
|
|
210
231
|
* ```
|
|
211
232
|
*
|
|
212
|
-
* @since 2.0.0
|
|
213
233
|
* @category models
|
|
234
|
+
* @since 2.0.0
|
|
214
235
|
*/
|
|
215
236
|
export declare namespace Schedule {
|
|
216
237
|
/**
|
|
217
238
|
* Variance interface that defines the type parameter relationships for Schedule.
|
|
218
239
|
*
|
|
219
|
-
*
|
|
240
|
+
* **Example** (Understanding schedule variance)
|
|
241
|
+
*
|
|
220
242
|
* ```ts
|
|
221
243
|
* import { Effect, Schedule } from "effect"
|
|
222
244
|
*
|
|
@@ -240,44 +262,23 @@ export declare namespace Schedule {
|
|
|
240
262
|
* const serviceSchedule = Schedule.spaced("5 seconds")
|
|
241
263
|
* ```
|
|
242
264
|
*
|
|
243
|
-
* @since 2.0.0
|
|
244
265
|
* @category Models
|
|
266
|
+
* @since 2.0.0
|
|
245
267
|
*/
|
|
246
268
|
export interface Variance<out Output, in Input, out Error, out Env> {
|
|
247
269
|
readonly [TypeId]: VarianceStruct<Output, Input, Error, Env>
|
|
248
270
|
}
|
|
249
271
|
|
|
250
272
|
/**
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
* @example
|
|
254
|
-
* ```ts
|
|
255
|
-
* import { Effect, Schedule } from "effect"
|
|
256
|
-
*
|
|
257
|
-
* // The variance struct defines how Schedule's type parameters behave
|
|
258
|
-
* // This internal interface is used for type variance annotations
|
|
273
|
+
* Type-level marker used by `Schedule.Variance` to record the variance of
|
|
274
|
+
* `Schedule` type parameters.
|
|
259
275
|
*
|
|
260
|
-
*
|
|
261
|
-
* interface
|
|
262
|
-
*
|
|
263
|
-
* }
|
|
264
|
-
* interface Dog extends Animal {
|
|
265
|
-
* breed: string
|
|
266
|
-
* }
|
|
276
|
+
* **Notes**
|
|
277
|
+
* This interface exists for TypeScript inference and assignability. Users
|
|
278
|
+
* normally do not construct or inspect it directly.
|
|
267
279
|
*
|
|
268
|
-
* // Output is covariant - more specific types can be substituted
|
|
269
|
-
* const stringSchedule = Schedule.spaced("1 second").pipe(
|
|
270
|
-
* Schedule.map(() => Effect.succeed("output"))
|
|
271
|
-
* )
|
|
272
|
-
*
|
|
273
|
-
* // Input is contravariant - more general types can be accepted
|
|
274
|
-
* const numberSchedule = Schedule.exponential("100 millis")
|
|
275
|
-
*
|
|
276
|
-
* // This enables proper type relationships where schedules can be composed safely
|
|
277
|
-
* ```
|
|
278
|
-
*
|
|
279
|
-
* @since 2.0.0
|
|
280
280
|
* @category Models
|
|
281
|
+
* @since 2.0.0
|
|
281
282
|
*/
|
|
282
283
|
export interface VarianceStruct<out Output, in Input, out Error, out Env> {
|
|
283
284
|
readonly _Out: Covariant<Output>
|
|
@@ -301,7 +302,8 @@ const ScheduleProto = {
|
|
|
301
302
|
/**
|
|
302
303
|
* Type guard that checks if a value is a Schedule.
|
|
303
304
|
*
|
|
304
|
-
*
|
|
305
|
+
* **Example** (Checking for schedules)
|
|
306
|
+
*
|
|
305
307
|
* ```ts
|
|
306
308
|
* import { Schedule } from "effect"
|
|
307
309
|
*
|
|
@@ -314,34 +316,33 @@ const ScheduleProto = {
|
|
|
314
316
|
* console.log(Schedule.isSchedule(undefined)) // false
|
|
315
317
|
* ```
|
|
316
318
|
*
|
|
317
|
-
* @since 2.0.0
|
|
318
319
|
* @category guards
|
|
320
|
+
* @since 2.0.0
|
|
319
321
|
*/
|
|
320
322
|
export const isSchedule = (u: unknown): u is Schedule<unknown, never, unknown, unknown> => hasProperty(u, TypeId)
|
|
321
323
|
|
|
322
324
|
/**
|
|
323
325
|
* Creates a Schedule from a step function that returns a Pull.
|
|
324
326
|
*
|
|
325
|
-
*
|
|
326
|
-
* ```ts
|
|
327
|
-
* import { Schedule } from "effect"
|
|
327
|
+
* **Example** (Creating a custom schedule from a step function)
|
|
328
328
|
*
|
|
329
|
-
*
|
|
330
|
-
*
|
|
329
|
+
* ```ts
|
|
330
|
+
* import { Cause, Duration, Effect, Schedule } from "effect"
|
|
331
331
|
*
|
|
332
|
-
*
|
|
333
|
-
*
|
|
334
|
-
* const spacedSchedule = Schedule.spaced("1 second")
|
|
335
|
-
* const recurringSchedule = Schedule.recurs(5)
|
|
332
|
+
* const schedule = Schedule.fromStep(Effect.sync(() => {
|
|
333
|
+
* let count = 0
|
|
336
334
|
*
|
|
337
|
-
*
|
|
338
|
-
*
|
|
339
|
-
*
|
|
340
|
-
*
|
|
335
|
+
* return (_now: number, _input: string) => {
|
|
336
|
+
* if (count >= 3) {
|
|
337
|
+
* return Cause.done(count)
|
|
338
|
+
* }
|
|
339
|
+
* return Effect.succeed([count++, Duration.millis(100)] as [number, Duration.Duration])
|
|
340
|
+
* }
|
|
341
|
+
* }))
|
|
341
342
|
* ```
|
|
342
343
|
*
|
|
343
|
-
* @since 4.0.0
|
|
344
344
|
* @category constructors
|
|
345
|
+
* @since 4.0.0
|
|
345
346
|
*/
|
|
346
347
|
export const fromStep = <Input, Output, EnvX, Error, ErrorX, Env>(
|
|
347
348
|
step: Effect<
|
|
@@ -371,26 +372,25 @@ const metadataFn = () => {
|
|
|
371
372
|
/**
|
|
372
373
|
* Creates a Schedule from a step function that receives metadata about the schedule's execution.
|
|
373
374
|
*
|
|
374
|
-
*
|
|
375
|
-
* ```ts
|
|
376
|
-
* import { Effect, Schedule } from "effect"
|
|
375
|
+
* **Example** (Creating a metadata-aware schedule)
|
|
377
376
|
*
|
|
378
|
-
*
|
|
379
|
-
*
|
|
377
|
+
* ```ts
|
|
378
|
+
* import { Cause, Duration, Effect, Schedule } from "effect"
|
|
380
379
|
*
|
|
381
|
-
*
|
|
382
|
-
*
|
|
383
|
-
*
|
|
384
|
-
*
|
|
380
|
+
* const firstThreeInputs = Schedule.fromStepWithMetadata(Effect.succeed((metadata: Schedule.InputMetadata<string>) => {
|
|
381
|
+
* if (metadata.attempt > 3) {
|
|
382
|
+
* return Cause.done("finished")
|
|
383
|
+
* }
|
|
385
384
|
*
|
|
386
|
-
*
|
|
387
|
-
*
|
|
388
|
-
*
|
|
389
|
-
* )
|
|
385
|
+
* return Effect.succeed([
|
|
386
|
+
* `attempt ${metadata.attempt}: ${metadata.input}`,
|
|
387
|
+
* Duration.millis(250)
|
|
388
|
+
* ] as [string, Duration.Duration])
|
|
389
|
+
* }))
|
|
390
390
|
* ```
|
|
391
391
|
*
|
|
392
|
-
* @since 4.0.0
|
|
393
392
|
* @category constructors
|
|
393
|
+
* @since 4.0.0
|
|
394
394
|
*/
|
|
395
395
|
export const fromStepWithMetadata = <Input, Output, EnvX, ErrorX, Error, Env>(
|
|
396
396
|
step: Effect<
|
|
@@ -407,7 +407,8 @@ export const fromStepWithMetadata = <Input, Output, EnvX, ErrorX, Error, Env>(
|
|
|
407
407
|
/**
|
|
408
408
|
* Extracts the step function from a Schedule.
|
|
409
409
|
*
|
|
410
|
-
*
|
|
410
|
+
* **Example** (Extracting a schedule step function)
|
|
411
|
+
*
|
|
411
412
|
* ```ts
|
|
412
413
|
* import { Effect, Schedule } from "effect"
|
|
413
414
|
*
|
|
@@ -417,16 +418,17 @@ export const fromStepWithMetadata = <Input, Output, EnvX, ErrorX, Error, Env>(
|
|
|
417
418
|
* const program = Effect.gen(function*() {
|
|
418
419
|
* const stepFn = yield* Schedule.toStep(schedule)
|
|
419
420
|
*
|
|
420
|
-
* // Use the step function directly for custom logic
|
|
421
|
-
*
|
|
421
|
+
* // Use the step function directly for custom logic. The timestamp is
|
|
422
|
+
* // supplied by the caller, so tests can pass a deterministic value.
|
|
423
|
+
* const now = 0
|
|
422
424
|
* const result = yield* stepFn(now, "input")
|
|
423
425
|
*
|
|
424
426
|
* console.log(`Step result: ${result}`)
|
|
425
427
|
* })
|
|
426
428
|
* ```
|
|
427
429
|
*
|
|
428
|
-
* @since 4.0.0
|
|
429
430
|
* @category destructors
|
|
431
|
+
* @since 4.0.0
|
|
430
432
|
*/
|
|
431
433
|
export const toStep = <Output, Input, Error, Env>(
|
|
432
434
|
schedule: Schedule<Output, Input, Error, Env>
|
|
@@ -444,8 +446,8 @@ export const toStep = <Output, Input, Error, Env>(
|
|
|
444
446
|
* Extracts a step function from a Schedule that provides metadata about each
|
|
445
447
|
* execution. It will also handle sleeping for the computed delay.
|
|
446
448
|
*
|
|
447
|
-
* @since 4.0.0
|
|
448
449
|
* @category destructors
|
|
450
|
+
* @since 4.0.0
|
|
449
451
|
*/
|
|
450
452
|
export const toStepWithMetadata = <Output, Input, Error, Env>(
|
|
451
453
|
schedule: Schedule<Output, Input, Error, Env>
|
|
@@ -479,7 +481,8 @@ export const toStepWithMetadata = <Output, Input, Error, Env>(
|
|
|
479
481
|
/**
|
|
480
482
|
* Extracts a step function from a Schedule that automatically handles sleep delays.
|
|
481
483
|
*
|
|
482
|
-
*
|
|
484
|
+
* **Example** (Extracting a sleeping step function)
|
|
485
|
+
*
|
|
483
486
|
* ```ts
|
|
484
487
|
* import { Effect, Schedule } from "effect"
|
|
485
488
|
*
|
|
@@ -502,8 +505,8 @@ export const toStepWithMetadata = <Output, Input, Error, Env>(
|
|
|
502
505
|
* })
|
|
503
506
|
* ```
|
|
504
507
|
*
|
|
505
|
-
* @since 4.0.0
|
|
506
508
|
* @category destructors
|
|
509
|
+
* @since 4.0.0
|
|
507
510
|
*/
|
|
508
511
|
export const toStepWithSleep = <Output, Input, Error, Env>(
|
|
509
512
|
schedule: Schedule<Output, Input, Error, Env>
|
|
@@ -521,29 +524,26 @@ export const toStepWithSleep = <Output, Input, Error, Env>(
|
|
|
521
524
|
* Returns a new `Schedule` that adds the delay computed by the specified
|
|
522
525
|
* effectful function to the the next recurrence of the schedule.
|
|
523
526
|
*
|
|
524
|
-
*
|
|
527
|
+
* **Example** (Adding extra delay to a schedule)
|
|
528
|
+
*
|
|
525
529
|
* ```ts
|
|
526
530
|
* import { Console, Data, Duration, Effect, Schedule } from "effect"
|
|
527
531
|
*
|
|
528
532
|
* class RetryAttemptError extends Data.TaggedError("RetryAttemptError")<{ readonly message: string }> {}
|
|
529
533
|
*
|
|
530
|
-
* // Add
|
|
531
|
-
* const
|
|
534
|
+
* // Add a deterministic extra delay based on the schedule output
|
|
535
|
+
* const delayedSchedule = Schedule.addDelay(
|
|
532
536
|
* Schedule.exponential("100 millis").pipe(Schedule.take(5)),
|
|
533
537
|
* (output) =>
|
|
534
|
-
*
|
|
535
|
-
* Effect.succeed(Duration.millis(Math.random() * 50))
|
|
538
|
+
* Effect.succeed(Duration.millis(Duration.toMillis(output) * 0.25))
|
|
536
539
|
* )
|
|
537
540
|
*
|
|
538
|
-
* const
|
|
541
|
+
* const repeatProgram = Effect.gen(function*() {
|
|
539
542
|
* yield* Effect.repeat(
|
|
540
|
-
* Effect.
|
|
541
|
-
*
|
|
542
|
-
* return "jittered task"
|
|
543
|
-
* }),
|
|
544
|
-
* jitteredSchedule.pipe(
|
|
543
|
+
* Effect.succeed("delayed task"),
|
|
544
|
+
* delayedSchedule.pipe(
|
|
545
545
|
* Schedule.tapOutput((delay) =>
|
|
546
|
-
* Console.log(`Base delay
|
|
546
|
+
* Console.log(`Base delay: ${delay}`)
|
|
547
547
|
* )
|
|
548
548
|
* )
|
|
549
549
|
* )
|
|
@@ -571,12 +571,15 @@ export const toStepWithSleep = <Output, Input, Error, Env>(
|
|
|
571
571
|
* )
|
|
572
572
|
* })
|
|
573
573
|
*
|
|
574
|
-
* // Add effectful delay computation
|
|
574
|
+
* // Add effectful delay computation from deterministic service data
|
|
575
|
+
* const loadByExecution = [1, 3, 2, 4] as const
|
|
576
|
+
*
|
|
575
577
|
* const dynamicSchedule = Schedule.addDelay(
|
|
576
578
|
* Schedule.spaced("1 second").pipe(Schedule.take(4)),
|
|
577
|
-
* (executionNumber) =>
|
|
578
|
-
*
|
|
579
|
-
* Effect.succeed(Duration.millis(
|
|
579
|
+
* (executionNumber) => {
|
|
580
|
+
* const load = loadByExecution[executionNumber] ?? 1
|
|
581
|
+
* return Effect.succeed(Duration.millis(load * 100))
|
|
582
|
+
* }
|
|
580
583
|
* )
|
|
581
584
|
*
|
|
582
585
|
* const dynamicProgram = Effect.gen(function*() {
|
|
@@ -589,25 +592,6 @@ export const toStepWithSleep = <Output, Input, Error, Env>(
|
|
|
589
592
|
* )
|
|
590
593
|
* })
|
|
591
594
|
*
|
|
592
|
-
* // Add delay based on previous execution results (30% extra)
|
|
593
|
-
* const resultBasedSchedule = Schedule.addDelay(
|
|
594
|
-
* Schedule.fibonacci("200 millis").pipe(Schedule.take(5)),
|
|
595
|
-
* (fibonacciDelay) =>
|
|
596
|
-
* Effect.succeed(Duration.millis(Duration.toMillis(fibonacciDelay) * 0.3))
|
|
597
|
-
* )
|
|
598
|
-
*
|
|
599
|
-
* const resultProgram = Effect.gen(function*() {
|
|
600
|
-
* yield* Effect.repeat(
|
|
601
|
-
* Effect.gen(function*() {
|
|
602
|
-
* yield* Console.log("Result-based delay task")
|
|
603
|
-
* return Math.random()
|
|
604
|
-
* }),
|
|
605
|
-
* resultBasedSchedule.pipe(
|
|
606
|
-
* Schedule.tapOutput((delay) => Console.log(`Fibonacci delay: ${delay}`))
|
|
607
|
-
* )
|
|
608
|
-
* )
|
|
609
|
-
* })
|
|
610
|
-
*
|
|
611
595
|
* // Combine with retry for progressive backoff
|
|
612
596
|
* const progressiveRetrySchedule = Schedule.addDelay(
|
|
613
597
|
* Schedule.exponential("50 millis").pipe(Schedule.take(4)),
|
|
@@ -632,37 +616,34 @@ export const toStepWithSleep = <Output, Input, Error, Env>(
|
|
|
632
616
|
* })
|
|
633
617
|
* ```
|
|
634
618
|
*
|
|
635
|
-
* @since 2.0.0
|
|
636
619
|
* @category utils
|
|
620
|
+
* @since 2.0.0
|
|
637
621
|
*/
|
|
638
622
|
export const addDelay: {
|
|
639
623
|
/**
|
|
640
624
|
* Returns a new `Schedule` that adds the delay computed by the specified
|
|
641
625
|
* effectful function to the the next recurrence of the schedule.
|
|
642
626
|
*
|
|
643
|
-
*
|
|
627
|
+
* **Example** (Adding extra delay to a schedule)
|
|
628
|
+
*
|
|
644
629
|
* ```ts
|
|
645
630
|
* import { Console, Data, Duration, Effect, Schedule } from "effect"
|
|
646
631
|
*
|
|
647
632
|
* class RetryAttemptError extends Data.TaggedError("RetryAttemptError")<{ readonly message: string }> {}
|
|
648
633
|
*
|
|
649
|
-
* // Add
|
|
650
|
-
* const
|
|
634
|
+
* // Add a deterministic extra delay based on the schedule output
|
|
635
|
+
* const delayedSchedule = Schedule.addDelay(
|
|
651
636
|
* Schedule.exponential("100 millis").pipe(Schedule.take(5)),
|
|
652
637
|
* (output) =>
|
|
653
|
-
*
|
|
654
|
-
* Effect.succeed(Duration.millis(Math.random() * 50))
|
|
638
|
+
* Effect.succeed(Duration.millis(Duration.toMillis(output) * 0.25))
|
|
655
639
|
* )
|
|
656
640
|
*
|
|
657
|
-
* const
|
|
641
|
+
* const repeatProgram = Effect.gen(function*() {
|
|
658
642
|
* yield* Effect.repeat(
|
|
659
|
-
* Effect.
|
|
660
|
-
*
|
|
661
|
-
* return "jittered task"
|
|
662
|
-
* }),
|
|
663
|
-
* jitteredSchedule.pipe(
|
|
643
|
+
* Effect.succeed("delayed task"),
|
|
644
|
+
* delayedSchedule.pipe(
|
|
664
645
|
* Schedule.tapOutput((delay) =>
|
|
665
|
-
* Console.log(`Base delay
|
|
646
|
+
* Console.log(`Base delay: ${delay}`)
|
|
666
647
|
* )
|
|
667
648
|
* )
|
|
668
649
|
* )
|
|
@@ -690,12 +671,15 @@ export const addDelay: {
|
|
|
690
671
|
* )
|
|
691
672
|
* })
|
|
692
673
|
*
|
|
693
|
-
* // Add effectful delay computation
|
|
674
|
+
* // Add effectful delay computation from deterministic service data
|
|
675
|
+
* const loadByExecution = [1, 3, 2, 4] as const
|
|
676
|
+
*
|
|
694
677
|
* const dynamicSchedule = Schedule.addDelay(
|
|
695
678
|
* Schedule.spaced("1 second").pipe(Schedule.take(4)),
|
|
696
|
-
* (executionNumber) =>
|
|
697
|
-
*
|
|
698
|
-
* Effect.succeed(Duration.millis(
|
|
679
|
+
* (executionNumber) => {
|
|
680
|
+
* const load = loadByExecution[executionNumber] ?? 1
|
|
681
|
+
* return Effect.succeed(Duration.millis(load * 100))
|
|
682
|
+
* }
|
|
699
683
|
* )
|
|
700
684
|
*
|
|
701
685
|
* const dynamicProgram = Effect.gen(function*() {
|
|
@@ -708,25 +692,6 @@ export const addDelay: {
|
|
|
708
692
|
* )
|
|
709
693
|
* })
|
|
710
694
|
*
|
|
711
|
-
* // Add delay based on previous execution results (30% extra)
|
|
712
|
-
* const resultBasedSchedule = Schedule.addDelay(
|
|
713
|
-
* Schedule.fibonacci("200 millis").pipe(Schedule.take(5)),
|
|
714
|
-
* (fibonacciDelay) =>
|
|
715
|
-
* Effect.succeed(Duration.millis(Duration.toMillis(fibonacciDelay) * 0.3))
|
|
716
|
-
* )
|
|
717
|
-
*
|
|
718
|
-
* const resultProgram = Effect.gen(function*() {
|
|
719
|
-
* yield* Effect.repeat(
|
|
720
|
-
* Effect.gen(function*() {
|
|
721
|
-
* yield* Console.log("Result-based delay task")
|
|
722
|
-
* return Math.random()
|
|
723
|
-
* }),
|
|
724
|
-
* resultBasedSchedule.pipe(
|
|
725
|
-
* Schedule.tapOutput((delay) => Console.log(`Fibonacci delay: ${delay}`))
|
|
726
|
-
* )
|
|
727
|
-
* )
|
|
728
|
-
* })
|
|
729
|
-
*
|
|
730
695
|
* // Combine with retry for progressive backoff
|
|
731
696
|
* const progressiveRetrySchedule = Schedule.addDelay(
|
|
732
697
|
* Schedule.exponential("50 millis").pipe(Schedule.take(4)),
|
|
@@ -751,8 +716,8 @@ export const addDelay: {
|
|
|
751
716
|
* })
|
|
752
717
|
* ```
|
|
753
718
|
*
|
|
754
|
-
* @since 2.0.0
|
|
755
719
|
* @category utils
|
|
720
|
+
* @since 2.0.0
|
|
756
721
|
*/
|
|
757
722
|
<Output, Error2 = never, Env2 = never>(f: (output: Output) => Effect<Duration.Input, Error2, Env2>): <Input, Error, Env>(
|
|
758
723
|
self: Schedule<Output, Input, Error, Env>
|
|
@@ -761,29 +726,26 @@ export const addDelay: {
|
|
|
761
726
|
* Returns a new `Schedule` that adds the delay computed by the specified
|
|
762
727
|
* effectful function to the the next recurrence of the schedule.
|
|
763
728
|
*
|
|
764
|
-
*
|
|
729
|
+
* **Example** (Adding extra delay to a schedule)
|
|
730
|
+
*
|
|
765
731
|
* ```ts
|
|
766
732
|
* import { Console, Data, Duration, Effect, Schedule } from "effect"
|
|
767
733
|
*
|
|
768
734
|
* class RetryAttemptError extends Data.TaggedError("RetryAttemptError")<{ readonly message: string }> {}
|
|
769
735
|
*
|
|
770
|
-
* // Add
|
|
771
|
-
* const
|
|
736
|
+
* // Add a deterministic extra delay based on the schedule output
|
|
737
|
+
* const delayedSchedule = Schedule.addDelay(
|
|
772
738
|
* Schedule.exponential("100 millis").pipe(Schedule.take(5)),
|
|
773
739
|
* (output) =>
|
|
774
|
-
*
|
|
775
|
-
* Effect.succeed(Duration.millis(Math.random() * 50))
|
|
740
|
+
* Effect.succeed(Duration.millis(Duration.toMillis(output) * 0.25))
|
|
776
741
|
* )
|
|
777
742
|
*
|
|
778
|
-
* const
|
|
743
|
+
* const repeatProgram = Effect.gen(function*() {
|
|
779
744
|
* yield* Effect.repeat(
|
|
780
|
-
* Effect.
|
|
781
|
-
*
|
|
782
|
-
* return "jittered task"
|
|
783
|
-
* }),
|
|
784
|
-
* jitteredSchedule.pipe(
|
|
745
|
+
* Effect.succeed("delayed task"),
|
|
746
|
+
* delayedSchedule.pipe(
|
|
785
747
|
* Schedule.tapOutput((delay) =>
|
|
786
|
-
* Console.log(`Base delay
|
|
748
|
+
* Console.log(`Base delay: ${delay}`)
|
|
787
749
|
* )
|
|
788
750
|
* )
|
|
789
751
|
* )
|
|
@@ -811,12 +773,15 @@ export const addDelay: {
|
|
|
811
773
|
* )
|
|
812
774
|
* })
|
|
813
775
|
*
|
|
814
|
-
* // Add effectful delay computation
|
|
776
|
+
* // Add effectful delay computation from deterministic service data
|
|
777
|
+
* const loadByExecution = [1, 3, 2, 4] as const
|
|
778
|
+
*
|
|
815
779
|
* const dynamicSchedule = Schedule.addDelay(
|
|
816
780
|
* Schedule.spaced("1 second").pipe(Schedule.take(4)),
|
|
817
|
-
* (executionNumber) =>
|
|
818
|
-
*
|
|
819
|
-
* Effect.succeed(Duration.millis(
|
|
781
|
+
* (executionNumber) => {
|
|
782
|
+
* const load = loadByExecution[executionNumber] ?? 1
|
|
783
|
+
* return Effect.succeed(Duration.millis(load * 100))
|
|
784
|
+
* }
|
|
820
785
|
* )
|
|
821
786
|
*
|
|
822
787
|
* const dynamicProgram = Effect.gen(function*() {
|
|
@@ -829,25 +794,6 @@ export const addDelay: {
|
|
|
829
794
|
* )
|
|
830
795
|
* })
|
|
831
796
|
*
|
|
832
|
-
* // Add delay based on previous execution results (30% extra)
|
|
833
|
-
* const resultBasedSchedule = Schedule.addDelay(
|
|
834
|
-
* Schedule.fibonacci("200 millis").pipe(Schedule.take(5)),
|
|
835
|
-
* (fibonacciDelay) =>
|
|
836
|
-
* Effect.succeed(Duration.millis(Duration.toMillis(fibonacciDelay) * 0.3))
|
|
837
|
-
* )
|
|
838
|
-
*
|
|
839
|
-
* const resultProgram = Effect.gen(function*() {
|
|
840
|
-
* yield* Effect.repeat(
|
|
841
|
-
* Effect.gen(function*() {
|
|
842
|
-
* yield* Console.log("Result-based delay task")
|
|
843
|
-
* return Math.random()
|
|
844
|
-
* }),
|
|
845
|
-
* resultBasedSchedule.pipe(
|
|
846
|
-
* Schedule.tapOutput((delay) => Console.log(`Fibonacci delay: ${delay}`))
|
|
847
|
-
* )
|
|
848
|
-
* )
|
|
849
|
-
* })
|
|
850
|
-
*
|
|
851
797
|
* // Combine with retry for progressive backoff
|
|
852
798
|
* const progressiveRetrySchedule = Schedule.addDelay(
|
|
853
799
|
* Schedule.exponential("50 millis").pipe(Schedule.take(4)),
|
|
@@ -872,8 +818,8 @@ export const addDelay: {
|
|
|
872
818
|
* })
|
|
873
819
|
* ```
|
|
874
820
|
*
|
|
875
|
-
* @since 2.0.0
|
|
876
821
|
* @category utils
|
|
822
|
+
* @since 2.0.0
|
|
877
823
|
*/
|
|
878
824
|
<Output, Input, Error, Env, Error2 = never, Env2 = never>(
|
|
879
825
|
self: Schedule<Output, Input, Error, Env>,
|
|
@@ -894,7 +840,8 @@ export const addDelay: {
|
|
|
894
840
|
* schedule to completion. Once the left schedule is complete, the right (i.e.
|
|
895
841
|
* `other`) schedule will be executed to completion.
|
|
896
842
|
*
|
|
897
|
-
*
|
|
843
|
+
* **Example** (Sequencing quick and slow retries)
|
|
844
|
+
*
|
|
898
845
|
* ```ts
|
|
899
846
|
* import { Console, Data, Effect, Schedule } from "effect"
|
|
900
847
|
*
|
|
@@ -926,8 +873,8 @@ export const addDelay: {
|
|
|
926
873
|
* })
|
|
927
874
|
* ```
|
|
928
875
|
*
|
|
929
|
-
* @since 2.0.0
|
|
930
876
|
* @category sequencing
|
|
877
|
+
* @since 2.0.0
|
|
931
878
|
*/
|
|
932
879
|
export const andThen: {
|
|
933
880
|
/**
|
|
@@ -935,7 +882,8 @@ export const andThen: {
|
|
|
935
882
|
* schedule to completion. Once the left schedule is complete, the right (i.e.
|
|
936
883
|
* `other`) schedule will be executed to completion.
|
|
937
884
|
*
|
|
938
|
-
*
|
|
885
|
+
* **Example** (Sequencing quick and slow retries)
|
|
886
|
+
*
|
|
939
887
|
* ```ts
|
|
940
888
|
* import { Console, Data, Effect, Schedule } from "effect"
|
|
941
889
|
*
|
|
@@ -967,8 +915,8 @@ export const andThen: {
|
|
|
967
915
|
* })
|
|
968
916
|
* ```
|
|
969
917
|
*
|
|
970
|
-
* @since 2.0.0
|
|
971
918
|
* @category sequencing
|
|
919
|
+
* @since 2.0.0
|
|
972
920
|
*/
|
|
973
921
|
<Output2, Input2, Error2, Env2>(other: Schedule<Output2, Input2, Error2, Env2>): <Output, Input, Error, Env>(
|
|
974
922
|
self: Schedule<Output, Input, Error, Env>
|
|
@@ -978,7 +926,8 @@ export const andThen: {
|
|
|
978
926
|
* schedule to completion. Once the left schedule is complete, the right (i.e.
|
|
979
927
|
* `other`) schedule will be executed to completion.
|
|
980
928
|
*
|
|
981
|
-
*
|
|
929
|
+
* **Example** (Sequencing quick and slow retries)
|
|
930
|
+
*
|
|
982
931
|
* ```ts
|
|
983
932
|
* import { Console, Data, Effect, Schedule } from "effect"
|
|
984
933
|
*
|
|
@@ -1010,8 +959,8 @@ export const andThen: {
|
|
|
1010
959
|
* })
|
|
1011
960
|
* ```
|
|
1012
961
|
*
|
|
1013
|
-
* @since 2.0.0
|
|
1014
962
|
* @category sequencing
|
|
963
|
+
* @since 2.0.0
|
|
1015
964
|
*/
|
|
1016
965
|
<Output, Input, Error, Env, Output2, Input2, Error2, Env2>(
|
|
1017
966
|
self: Schedule<Output, Input, Error, Env>,
|
|
@@ -1028,11 +977,12 @@ export const andThen: {
|
|
|
1028
977
|
* schedule to completion. Once the left schedule is complete, the right (i.e.
|
|
1029
978
|
* `other`) schedule will be executed to completion.
|
|
1030
979
|
*
|
|
1031
|
-
* The
|
|
1032
|
-
*
|
|
1033
|
-
*
|
|
980
|
+
* The resulting schedule emits a `Result` to indicate which phase produced
|
|
981
|
+
* each output: outputs from `self` are emitted as `Failure`, and outputs from
|
|
982
|
+
* `other` are emitted as `Success`.
|
|
983
|
+
*
|
|
984
|
+
* **Example** (Tracking sequential schedule phases)
|
|
1034
985
|
*
|
|
1035
|
-
* @example
|
|
1036
986
|
* ```ts
|
|
1037
987
|
* import { Console, Effect, Result, Schedule } from "effect"
|
|
1038
988
|
*
|
|
@@ -1060,8 +1010,8 @@ export const andThen: {
|
|
|
1060
1010
|
* })
|
|
1061
1011
|
* ```
|
|
1062
1012
|
*
|
|
1063
|
-
* @since 2.0.0
|
|
1064
1013
|
* @category sequencing
|
|
1014
|
+
* @since 2.0.0
|
|
1065
1015
|
*/
|
|
1066
1016
|
export const andThenResult: {
|
|
1067
1017
|
/**
|
|
@@ -1069,11 +1019,12 @@ export const andThenResult: {
|
|
|
1069
1019
|
* schedule to completion. Once the left schedule is complete, the right (i.e.
|
|
1070
1020
|
* `other`) schedule will be executed to completion.
|
|
1071
1021
|
*
|
|
1072
|
-
* The
|
|
1073
|
-
*
|
|
1074
|
-
*
|
|
1022
|
+
* The resulting schedule emits a `Result` to indicate which phase produced
|
|
1023
|
+
* each output: outputs from `self` are emitted as `Failure`, and outputs from
|
|
1024
|
+
* `other` are emitted as `Success`.
|
|
1025
|
+
*
|
|
1026
|
+
* **Example** (Tracking sequential schedule phases)
|
|
1075
1027
|
*
|
|
1076
|
-
* @example
|
|
1077
1028
|
* ```ts
|
|
1078
1029
|
* import { Console, Effect, Result, Schedule } from "effect"
|
|
1079
1030
|
*
|
|
@@ -1101,8 +1052,8 @@ export const andThenResult: {
|
|
|
1101
1052
|
* })
|
|
1102
1053
|
* ```
|
|
1103
1054
|
*
|
|
1104
|
-
* @since 2.0.0
|
|
1105
1055
|
* @category sequencing
|
|
1056
|
+
* @since 2.0.0
|
|
1106
1057
|
*/
|
|
1107
1058
|
<Output2, Input2, Error2, Env2>(other: Schedule<Output2, Input2, Error2, Env2>): <Output, Input, Error, Env>(
|
|
1108
1059
|
self: Schedule<Output, Input, Error, Env>
|
|
@@ -1112,11 +1063,12 @@ export const andThenResult: {
|
|
|
1112
1063
|
* schedule to completion. Once the left schedule is complete, the right (i.e.
|
|
1113
1064
|
* `other`) schedule will be executed to completion.
|
|
1114
1065
|
*
|
|
1115
|
-
* The
|
|
1116
|
-
*
|
|
1117
|
-
*
|
|
1066
|
+
* The resulting schedule emits a `Result` to indicate which phase produced
|
|
1067
|
+
* each output: outputs from `self` are emitted as `Failure`, and outputs from
|
|
1068
|
+
* `other` are emitted as `Success`.
|
|
1069
|
+
*
|
|
1070
|
+
* **Example** (Tracking sequential schedule phases)
|
|
1118
1071
|
*
|
|
1119
|
-
* @example
|
|
1120
1072
|
* ```ts
|
|
1121
1073
|
* import { Console, Effect, Result, Schedule } from "effect"
|
|
1122
1074
|
*
|
|
@@ -1144,8 +1096,8 @@ export const andThenResult: {
|
|
|
1144
1096
|
* })
|
|
1145
1097
|
* ```
|
|
1146
1098
|
*
|
|
1147
|
-
* @since 2.0.0
|
|
1148
1099
|
* @category sequencing
|
|
1100
|
+
* @since 2.0.0
|
|
1149
1101
|
*/
|
|
1150
1102
|
<Output, Input, Error, Env, Output2, Input2, Error2, Env2>(
|
|
1151
1103
|
self: Schedule<Output, Input, Error, Env>,
|
|
@@ -1183,11 +1135,12 @@ export const andThenResult: {
|
|
|
1183
1135
|
* schedule to completion. Once the left schedule is complete, the right (i.e.
|
|
1184
1136
|
* `other`) schedule will be executed to completion.
|
|
1185
1137
|
*
|
|
1186
|
-
* The
|
|
1187
|
-
*
|
|
1188
|
-
*
|
|
1138
|
+
* The resulting schedule emits a `Result` to indicate which phase produced
|
|
1139
|
+
* each output: outputs from `self` are emitted as `Failure`, and outputs from
|
|
1140
|
+
* `other` are emitted as `Success`.
|
|
1141
|
+
*
|
|
1142
|
+
* **Example** (Tracking sequential schedule phases)
|
|
1189
1143
|
*
|
|
1190
|
-
* @example
|
|
1191
1144
|
* ```ts
|
|
1192
1145
|
* import { Console, Effect, Result, Schedule } from "effect"
|
|
1193
1146
|
*
|
|
@@ -1215,8 +1168,8 @@ export const andThenResult: {
|
|
|
1215
1168
|
* })
|
|
1216
1169
|
* ```
|
|
1217
1170
|
*
|
|
1218
|
-
* @since 2.0.0
|
|
1219
1171
|
* @category sequencing
|
|
1172
|
+
* @since 2.0.0
|
|
1220
1173
|
*/
|
|
1221
1174
|
Result.Result<Output, Output2>,
|
|
1222
1175
|
/**
|
|
@@ -1224,11 +1177,12 @@ export const andThenResult: {
|
|
|
1224
1177
|
* schedule to completion. Once the left schedule is complete, the right (i.e.
|
|
1225
1178
|
* `other`) schedule will be executed to completion.
|
|
1226
1179
|
*
|
|
1227
|
-
* The
|
|
1228
|
-
*
|
|
1229
|
-
*
|
|
1180
|
+
* The resulting schedule emits a `Result` to indicate which phase produced
|
|
1181
|
+
* each output: outputs from `self` are emitted as `Failure`, and outputs from
|
|
1182
|
+
* `other` are emitted as `Success`.
|
|
1183
|
+
*
|
|
1184
|
+
* **Example** (Tracking sequential schedule phases)
|
|
1230
1185
|
*
|
|
1231
|
-
* @example
|
|
1232
1186
|
* ```ts
|
|
1233
1187
|
* import { Console, Effect, Result, Schedule } from "effect"
|
|
1234
1188
|
*
|
|
@@ -1256,8 +1210,8 @@ export const andThenResult: {
|
|
|
1256
1210
|
* })
|
|
1257
1211
|
* ```
|
|
1258
1212
|
*
|
|
1259
|
-
* @since 2.0.0
|
|
1260
1213
|
* @category sequencing
|
|
1214
|
+
* @since 2.0.0
|
|
1261
1215
|
*/
|
|
1262
1216
|
Input & Input2,
|
|
1263
1217
|
/**
|
|
@@ -1265,11 +1219,12 @@ export const andThenResult: {
|
|
|
1265
1219
|
* schedule to completion. Once the left schedule is complete, the right (i.e.
|
|
1266
1220
|
* `other`) schedule will be executed to completion.
|
|
1267
1221
|
*
|
|
1268
|
-
* The
|
|
1269
|
-
*
|
|
1270
|
-
*
|
|
1222
|
+
* The resulting schedule emits a `Result` to indicate which phase produced
|
|
1223
|
+
* each output: outputs from `self` are emitted as `Failure`, and outputs from
|
|
1224
|
+
* `other` are emitted as `Success`.
|
|
1225
|
+
*
|
|
1226
|
+
* **Example** (Tracking sequential schedule phases)
|
|
1271
1227
|
*
|
|
1272
|
-
* @example
|
|
1273
1228
|
* ```ts
|
|
1274
1229
|
* import { Console, Effect, Result, Schedule } from "effect"
|
|
1275
1230
|
*
|
|
@@ -1297,8 +1252,8 @@ export const andThenResult: {
|
|
|
1297
1252
|
* })
|
|
1298
1253
|
* ```
|
|
1299
1254
|
*
|
|
1300
|
-
* @since 2.0.0
|
|
1301
1255
|
* @category sequencing
|
|
1256
|
+
* @since 2.0.0
|
|
1302
1257
|
*/
|
|
1303
1258
|
Error | Error2,
|
|
1304
1259
|
/**
|
|
@@ -1306,11 +1261,12 @@ export const andThenResult: {
|
|
|
1306
1261
|
* schedule to completion. Once the left schedule is complete, the right (i.e.
|
|
1307
1262
|
* `other`) schedule will be executed to completion.
|
|
1308
1263
|
*
|
|
1309
|
-
* The
|
|
1310
|
-
*
|
|
1311
|
-
*
|
|
1264
|
+
* The resulting schedule emits a `Result` to indicate which phase produced
|
|
1265
|
+
* each output: outputs from `self` are emitted as `Failure`, and outputs from
|
|
1266
|
+
* `other` are emitted as `Success`.
|
|
1267
|
+
*
|
|
1268
|
+
* **Example** (Tracking sequential schedule phases)
|
|
1312
1269
|
*
|
|
1313
|
-
* @example
|
|
1314
1270
|
* ```ts
|
|
1315
1271
|
* import { Console, Effect, Result, Schedule } from "effect"
|
|
1316
1272
|
*
|
|
@@ -1338,8 +1294,8 @@ export const andThenResult: {
|
|
|
1338
1294
|
* })
|
|
1339
1295
|
* ```
|
|
1340
1296
|
*
|
|
1341
|
-
* @since 2.0.0
|
|
1342
1297
|
* @category sequencing
|
|
1298
|
+
* @since 2.0.0
|
|
1343
1299
|
*/
|
|
1344
1300
|
Env | Env2
|
|
1345
1301
|
>(currentSide === 0 ? left : right).pipe(
|
|
@@ -1365,7 +1321,8 @@ export const andThenResult: {
|
|
|
1365
1321
|
* to recur, using the maximum of the two durations between recurrences and
|
|
1366
1322
|
* outputting a tuple of the outputs of both schedules.
|
|
1367
1323
|
*
|
|
1368
|
-
*
|
|
1324
|
+
* **Example** (Combining time and attempt limits)
|
|
1325
|
+
*
|
|
1369
1326
|
* ```ts
|
|
1370
1327
|
* import { Console, Data, Effect, Schedule } from "effect"
|
|
1371
1328
|
*
|
|
@@ -1382,7 +1339,7 @@ export const andThenResult: {
|
|
|
1382
1339
|
* const program = Effect.gen(function*() {
|
|
1383
1340
|
* const results = yield* Effect.repeat(
|
|
1384
1341
|
* Effect.gen(function*() {
|
|
1385
|
-
* yield* Console.log(
|
|
1342
|
+
* yield* Console.log("Task executed")
|
|
1386
1343
|
* return "task completed"
|
|
1387
1344
|
* }),
|
|
1388
1345
|
* bothSchedule.pipe(
|
|
@@ -1426,8 +1383,8 @@ export const andThenResult: {
|
|
|
1426
1383
|
* // Compare with either which provides union semantics (OR logic)
|
|
1427
1384
|
* ```
|
|
1428
1385
|
*
|
|
1429
|
-
* @since 2.0.0
|
|
1430
1386
|
* @category utilities
|
|
1387
|
+
* @since 2.0.0
|
|
1431
1388
|
*/
|
|
1432
1389
|
export const both: {
|
|
1433
1390
|
/**
|
|
@@ -1435,7 +1392,8 @@ export const both: {
|
|
|
1435
1392
|
* to recur, using the maximum of the two durations between recurrences and
|
|
1436
1393
|
* outputting a tuple of the outputs of both schedules.
|
|
1437
1394
|
*
|
|
1438
|
-
*
|
|
1395
|
+
* **Example** (Combining time and attempt limits)
|
|
1396
|
+
*
|
|
1439
1397
|
* ```ts
|
|
1440
1398
|
* import { Console, Data, Effect, Schedule } from "effect"
|
|
1441
1399
|
*
|
|
@@ -1452,7 +1410,7 @@ export const both: {
|
|
|
1452
1410
|
* const program = Effect.gen(function*() {
|
|
1453
1411
|
* const results = yield* Effect.repeat(
|
|
1454
1412
|
* Effect.gen(function*() {
|
|
1455
|
-
* yield* Console.log(
|
|
1413
|
+
* yield* Console.log("Task executed")
|
|
1456
1414
|
* return "task completed"
|
|
1457
1415
|
* }),
|
|
1458
1416
|
* bothSchedule.pipe(
|
|
@@ -1496,8 +1454,8 @@ export const both: {
|
|
|
1496
1454
|
* // Compare with either which provides union semantics (OR logic)
|
|
1497
1455
|
* ```
|
|
1498
1456
|
*
|
|
1499
|
-
* @since 2.0.0
|
|
1500
1457
|
* @category utilities
|
|
1458
|
+
* @since 2.0.0
|
|
1501
1459
|
*/
|
|
1502
1460
|
<Output2, Input2, Error2, Env2, Output>(other: Schedule<Output2, Input2, Error2, Env2>): <Input, Error, Env>(
|
|
1503
1461
|
self: Schedule<Output, Input, Error, Env>
|
|
@@ -1507,7 +1465,8 @@ export const both: {
|
|
|
1507
1465
|
* to recur, using the maximum of the two durations between recurrences and
|
|
1508
1466
|
* outputting a tuple of the outputs of both schedules.
|
|
1509
1467
|
*
|
|
1510
|
-
*
|
|
1468
|
+
* **Example** (Combining time and attempt limits)
|
|
1469
|
+
*
|
|
1511
1470
|
* ```ts
|
|
1512
1471
|
* import { Console, Data, Effect, Schedule } from "effect"
|
|
1513
1472
|
*
|
|
@@ -1524,7 +1483,7 @@ export const both: {
|
|
|
1524
1483
|
* const program = Effect.gen(function*() {
|
|
1525
1484
|
* const results = yield* Effect.repeat(
|
|
1526
1485
|
* Effect.gen(function*() {
|
|
1527
|
-
* yield* Console.log(
|
|
1486
|
+
* yield* Console.log("Task executed")
|
|
1528
1487
|
* return "task completed"
|
|
1529
1488
|
* }),
|
|
1530
1489
|
* bothSchedule.pipe(
|
|
@@ -1568,8 +1527,8 @@ export const both: {
|
|
|
1568
1527
|
* // Compare with either which provides union semantics (OR logic)
|
|
1569
1528
|
* ```
|
|
1570
1529
|
*
|
|
1571
|
-
* @since 2.0.0
|
|
1572
1530
|
* @category utilities
|
|
1531
|
+
* @since 2.0.0
|
|
1573
1532
|
*/
|
|
1574
1533
|
<Output, Input, Error, Env, Output2, Input2, Error2, Env2>(
|
|
1575
1534
|
self: Schedule<Output, Input, Error, Env>,
|
|
@@ -1586,7 +1545,8 @@ export const both: {
|
|
|
1586
1545
|
* to recur, using the maximum of the two durations between recurrences and
|
|
1587
1546
|
* outputting the result of the left schedule (i.e. `self`).
|
|
1588
1547
|
*
|
|
1589
|
-
*
|
|
1548
|
+
* **Example** (Combining schedules and keeping the left output)
|
|
1549
|
+
*
|
|
1590
1550
|
* ```ts
|
|
1591
1551
|
* import { Console, Effect, Schedule } from "effect"
|
|
1592
1552
|
*
|
|
@@ -1609,8 +1569,8 @@ export const both: {
|
|
|
1609
1569
|
* })
|
|
1610
1570
|
* ```
|
|
1611
1571
|
*
|
|
1612
|
-
* @since 2.0.0
|
|
1613
1572
|
* @category utilities
|
|
1573
|
+
* @since 2.0.0
|
|
1614
1574
|
*/
|
|
1615
1575
|
export const bothLeft: {
|
|
1616
1576
|
/**
|
|
@@ -1618,7 +1578,8 @@ export const bothLeft: {
|
|
|
1618
1578
|
* to recur, using the maximum of the two durations between recurrences and
|
|
1619
1579
|
* outputting the result of the left schedule (i.e. `self`).
|
|
1620
1580
|
*
|
|
1621
|
-
*
|
|
1581
|
+
* **Example** (Combining schedules and keeping the left output)
|
|
1582
|
+
*
|
|
1622
1583
|
* ```ts
|
|
1623
1584
|
* import { Console, Effect, Schedule } from "effect"
|
|
1624
1585
|
*
|
|
@@ -1641,8 +1602,8 @@ export const bothLeft: {
|
|
|
1641
1602
|
* })
|
|
1642
1603
|
* ```
|
|
1643
1604
|
*
|
|
1644
|
-
* @since 2.0.0
|
|
1645
1605
|
* @category utilities
|
|
1606
|
+
* @since 2.0.0
|
|
1646
1607
|
*/
|
|
1647
1608
|
<Output2, Input2, Error2, Env2>(other: Schedule<Output2, Input2, Error2, Env2>): <Output, Input, Error, Env>(
|
|
1648
1609
|
self: Schedule<Output, Input, Error, Env>
|
|
@@ -1652,7 +1613,8 @@ export const bothLeft: {
|
|
|
1652
1613
|
* to recur, using the maximum of the two durations between recurrences and
|
|
1653
1614
|
* outputting the result of the left schedule (i.e. `self`).
|
|
1654
1615
|
*
|
|
1655
|
-
*
|
|
1616
|
+
* **Example** (Combining schedules and keeping the left output)
|
|
1617
|
+
*
|
|
1656
1618
|
* ```ts
|
|
1657
1619
|
* import { Console, Effect, Schedule } from "effect"
|
|
1658
1620
|
*
|
|
@@ -1675,8 +1637,8 @@ export const bothLeft: {
|
|
|
1675
1637
|
* })
|
|
1676
1638
|
* ```
|
|
1677
1639
|
*
|
|
1678
|
-
* @since 2.0.0
|
|
1679
1640
|
* @category utilities
|
|
1641
|
+
* @since 2.0.0
|
|
1680
1642
|
*/
|
|
1681
1643
|
<Output, Input, Error, Env, Output2, Input2, Error2, Env2>(
|
|
1682
1644
|
self: Schedule<Output, Input, Error, Env>,
|
|
@@ -1692,7 +1654,8 @@ export const bothLeft: {
|
|
|
1692
1654
|
* to recur, using the maximum of the two durations between recurrences and
|
|
1693
1655
|
* outputting the result of the right schedule (i.e. `other`).
|
|
1694
1656
|
*
|
|
1695
|
-
*
|
|
1657
|
+
* **Example** (Combining schedules and keeping the right output)
|
|
1658
|
+
*
|
|
1696
1659
|
* ```ts
|
|
1697
1660
|
* import { Console, Effect, Schedule } from "effect"
|
|
1698
1661
|
*
|
|
@@ -1717,8 +1680,8 @@ export const bothLeft: {
|
|
|
1717
1680
|
* })
|
|
1718
1681
|
* ```
|
|
1719
1682
|
*
|
|
1720
|
-
* @since 2.0.0
|
|
1721
1683
|
* @category utilities
|
|
1684
|
+
* @since 2.0.0
|
|
1722
1685
|
*/
|
|
1723
1686
|
export const bothRight: {
|
|
1724
1687
|
/**
|
|
@@ -1726,7 +1689,8 @@ export const bothRight: {
|
|
|
1726
1689
|
* to recur, using the maximum of the two durations between recurrences and
|
|
1727
1690
|
* outputting the result of the right schedule (i.e. `other`).
|
|
1728
1691
|
*
|
|
1729
|
-
*
|
|
1692
|
+
* **Example** (Combining schedules and keeping the right output)
|
|
1693
|
+
*
|
|
1730
1694
|
* ```ts
|
|
1731
1695
|
* import { Console, Effect, Schedule } from "effect"
|
|
1732
1696
|
*
|
|
@@ -1751,8 +1715,8 @@ export const bothRight: {
|
|
|
1751
1715
|
* })
|
|
1752
1716
|
* ```
|
|
1753
1717
|
*
|
|
1754
|
-
* @since 2.0.0
|
|
1755
1718
|
* @category utilities
|
|
1719
|
+
* @since 2.0.0
|
|
1756
1720
|
*/
|
|
1757
1721
|
<Output2, Input2, Error2, Env2>(other: Schedule<Output2, Input2, Error2, Env2>): <Output, Input, Error, Env>(
|
|
1758
1722
|
self: Schedule<Output, Input, Error, Env>
|
|
@@ -1762,7 +1726,8 @@ export const bothRight: {
|
|
|
1762
1726
|
* to recur, using the maximum of the two durations between recurrences and
|
|
1763
1727
|
* outputting the result of the right schedule (i.e. `other`).
|
|
1764
1728
|
*
|
|
1765
|
-
*
|
|
1729
|
+
* **Example** (Combining schedules and keeping the right output)
|
|
1730
|
+
*
|
|
1766
1731
|
* ```ts
|
|
1767
1732
|
* import { Console, Effect, Schedule } from "effect"
|
|
1768
1733
|
*
|
|
@@ -1787,8 +1752,8 @@ export const bothRight: {
|
|
|
1787
1752
|
* })
|
|
1788
1753
|
* ```
|
|
1789
1754
|
*
|
|
1790
|
-
* @since 2.0.0
|
|
1791
1755
|
* @category utilities
|
|
1756
|
+
* @since 2.0.0
|
|
1792
1757
|
*/
|
|
1793
1758
|
<Output, Input, Error, Env, Output2, Input2, Error2, Env2>(
|
|
1794
1759
|
self: Schedule<Output, Input, Error, Env>,
|
|
@@ -1805,7 +1770,8 @@ export const bothRight: {
|
|
|
1805
1770
|
* outputting the result of the combination of both schedule outputs using the
|
|
1806
1771
|
* specified `combine` function.
|
|
1807
1772
|
*
|
|
1808
|
-
*
|
|
1773
|
+
* **Example** (Combining schedule outputs)
|
|
1774
|
+
*
|
|
1809
1775
|
* ```ts
|
|
1810
1776
|
* import { Console, Effect, Schedule } from "effect"
|
|
1811
1777
|
*
|
|
@@ -1834,8 +1800,8 @@ export const bothRight: {
|
|
|
1834
1800
|
* })
|
|
1835
1801
|
* ```
|
|
1836
1802
|
*
|
|
1837
|
-
* @since 2.0.0
|
|
1838
1803
|
* @category utilities
|
|
1804
|
+
* @since 2.0.0
|
|
1839
1805
|
*/
|
|
1840
1806
|
export const bothWith: {
|
|
1841
1807
|
/**
|
|
@@ -1844,7 +1810,8 @@ export const bothWith: {
|
|
|
1844
1810
|
* outputting the result of the combination of both schedule outputs using the
|
|
1845
1811
|
* specified `combine` function.
|
|
1846
1812
|
*
|
|
1847
|
-
*
|
|
1813
|
+
* **Example** (Combining schedule outputs)
|
|
1814
|
+
*
|
|
1848
1815
|
* ```ts
|
|
1849
1816
|
* import { Console, Effect, Schedule } from "effect"
|
|
1850
1817
|
*
|
|
@@ -1873,8 +1840,8 @@ export const bothWith: {
|
|
|
1873
1840
|
* })
|
|
1874
1841
|
* ```
|
|
1875
1842
|
*
|
|
1876
|
-
* @since 2.0.0
|
|
1877
1843
|
* @category utilities
|
|
1844
|
+
* @since 2.0.0
|
|
1878
1845
|
*/
|
|
1879
1846
|
<Output2, Input2, Error2, Env2, Output, Output3>(
|
|
1880
1847
|
other: Schedule<Output2, Input2, Error2, Env2>,
|
|
@@ -1888,7 +1855,8 @@ export const bothWith: {
|
|
|
1888
1855
|
* outputting the result of the combination of both schedule outputs using the
|
|
1889
1856
|
* specified `combine` function.
|
|
1890
1857
|
*
|
|
1891
|
-
*
|
|
1858
|
+
* **Example** (Combining schedule outputs)
|
|
1859
|
+
*
|
|
1892
1860
|
* ```ts
|
|
1893
1861
|
* import { Console, Effect, Schedule } from "effect"
|
|
1894
1862
|
*
|
|
@@ -1917,8 +1885,8 @@ export const bothWith: {
|
|
|
1917
1885
|
* })
|
|
1918
1886
|
* ```
|
|
1919
1887
|
*
|
|
1920
|
-
* @since 2.0.0
|
|
1921
1888
|
* @category utilities
|
|
1889
|
+
* @since 2.0.0
|
|
1922
1890
|
*/
|
|
1923
1891
|
<Output, Input, Error, Env, Output2, Input2, Error2, Env2, Output3>(
|
|
1924
1892
|
self: Schedule<Output, Input, Error, Env>,
|
|
@@ -1954,10 +1922,15 @@ export const bothWith: {
|
|
|
1954
1922
|
)))
|
|
1955
1923
|
|
|
1956
1924
|
/**
|
|
1957
|
-
* Returns a new `Schedule` that
|
|
1958
|
-
*
|
|
1925
|
+
* Returns a new `Schedule` that follows `self` and outputs the inputs seen so
|
|
1926
|
+
* far as an array.
|
|
1927
|
+
*
|
|
1928
|
+
* **Details**
|
|
1929
|
+
* This does not make the schedule run forever. The collected schedule stops
|
|
1930
|
+
* when `self` stops and fails when `self` fails.
|
|
1931
|
+
*
|
|
1932
|
+
* **Example** (Collecting schedule inputs)
|
|
1959
1933
|
*
|
|
1960
|
-
* @example
|
|
1961
1934
|
* ```ts
|
|
1962
1935
|
* import { Console, Effect, Schedule } from "effect"
|
|
1963
1936
|
*
|
|
@@ -1979,18 +1952,23 @@ export const bothWith: {
|
|
|
1979
1952
|
* })
|
|
1980
1953
|
* ```
|
|
1981
1954
|
*
|
|
1982
|
-
* @since 2.0.0
|
|
1983
1955
|
* @category utilities
|
|
1956
|
+
* @since 2.0.0
|
|
1984
1957
|
*/
|
|
1985
1958
|
export const collectInputs = <Output, Input, Error, Env>(
|
|
1986
1959
|
self: Schedule<Output, Input, Error, Env>
|
|
1987
1960
|
): Schedule<Array<Input>, Input, Error, Env> => collectWhile(passthrough(self), () => effect.succeed(true))
|
|
1988
1961
|
|
|
1989
1962
|
/**
|
|
1990
|
-
* Returns a new `Schedule` that
|
|
1991
|
-
*
|
|
1963
|
+
* Returns a new `Schedule` that follows `self` and outputs the schedule outputs
|
|
1964
|
+
* seen so far as an array.
|
|
1965
|
+
*
|
|
1966
|
+
* **Details**
|
|
1967
|
+
* This does not make the schedule run forever. The collected schedule stops
|
|
1968
|
+
* when `self` stops and fails when `self` fails.
|
|
1969
|
+
*
|
|
1970
|
+
* **Example** (Collecting schedule outputs)
|
|
1992
1971
|
*
|
|
1993
|
-
* @example
|
|
1994
1972
|
* ```ts
|
|
1995
1973
|
* import { Console, Effect, Schedule } from "effect"
|
|
1996
1974
|
*
|
|
@@ -2010,8 +1988,8 @@ export const collectInputs = <Output, Input, Error, Env>(
|
|
|
2010
1988
|
* })
|
|
2011
1989
|
* ```
|
|
2012
1990
|
*
|
|
2013
|
-
* @since 2.0.0
|
|
2014
1991
|
* @category utilities
|
|
1992
|
+
* @since 2.0.0
|
|
2015
1993
|
*/
|
|
2016
1994
|
export const collectOutputs = <Output, Input, Error, Env>(
|
|
2017
1995
|
self: Schedule<Output, Input, Error, Env>
|
|
@@ -2021,31 +1999,11 @@ export const collectOutputs = <Output, Input, Error, Env>(
|
|
|
2021
1999
|
* Returns a new `Schedule` that recurs as long as the specified `predicate`
|
|
2022
2000
|
* returns `true`, collecting all outputs of the schedule into an array.
|
|
2023
2001
|
*
|
|
2024
|
-
*
|
|
2002
|
+
* **Example** (Collecting outputs while a condition holds)
|
|
2003
|
+
*
|
|
2025
2004
|
* ```ts
|
|
2026
2005
|
* import { Console, Effect, Schedule } from "effect"
|
|
2027
2006
|
*
|
|
2028
|
-
* // Collect outputs while under time limit
|
|
2029
|
-
* const collectForTime = Schedule.collectWhile(
|
|
2030
|
-
* Schedule.spaced("500 millis"),
|
|
2031
|
-
* (metadata) => Effect.succeed(metadata.elapsed < 3000) // Stop after 3 seconds
|
|
2032
|
-
* )
|
|
2033
|
-
*
|
|
2034
|
-
* const timeBasedProgram = Effect.gen(function*() {
|
|
2035
|
-
* const results = yield* Effect.repeat(
|
|
2036
|
-
* Effect.gen(function*() {
|
|
2037
|
-
* const value = Math.floor(Math.random() * 100)
|
|
2038
|
-
* yield* Console.log(`Generated value: ${value}`)
|
|
2039
|
-
* return value
|
|
2040
|
-
* }),
|
|
2041
|
-
* collectForTime
|
|
2042
|
-
* )
|
|
2043
|
-
*
|
|
2044
|
-
* yield* Console.log(
|
|
2045
|
-
* `Collected ${results.length} values: [${results.join(", ")}]`
|
|
2046
|
-
* )
|
|
2047
|
-
* })
|
|
2048
|
-
*
|
|
2049
2007
|
* // Collect outputs while condition is met
|
|
2050
2008
|
* const collectWhileSmall = Schedule.collectWhile(
|
|
2051
2009
|
* Schedule.exponential("100 millis"),
|
|
@@ -2056,16 +2014,16 @@ export const collectOutputs = <Output, Input, Error, Env>(
|
|
|
2056
2014
|
* const conditionalProgram = Effect.gen(function*() {
|
|
2057
2015
|
* let attempt = 0
|
|
2058
2016
|
*
|
|
2059
|
-
* const
|
|
2017
|
+
* const attempts = yield* Effect.repeat(
|
|
2060
2018
|
* Effect.gen(function*() {
|
|
2061
2019
|
* attempt++
|
|
2062
2020
|
* yield* Console.log(`Retry attempt ${attempt}`)
|
|
2063
|
-
* return
|
|
2021
|
+
* return `attempt-${attempt}`
|
|
2064
2022
|
* }),
|
|
2065
2023
|
* collectWhileSmall
|
|
2066
2024
|
* )
|
|
2067
2025
|
*
|
|
2068
|
-
* yield* Console.log(`Collected attempts: [${
|
|
2026
|
+
* yield* Console.log(`Collected attempts: [${attempts.join(", ")}]`)
|
|
2069
2027
|
* })
|
|
2070
2028
|
*
|
|
2071
2029
|
* // Collect with effectful predicate
|
|
@@ -2082,19 +2040,17 @@ export const collectOutputs = <Output, Input, Error, Env>(
|
|
|
2082
2040
|
* )
|
|
2083
2041
|
*
|
|
2084
2042
|
* const effectfulProgram = Effect.gen(function*() {
|
|
2085
|
-
* const
|
|
2086
|
-
* Effect.
|
|
2087
|
-
* const now = new Date().toISOString()
|
|
2088
|
-
* yield* Console.log(`Task at ${now}`)
|
|
2089
|
-
* return now
|
|
2090
|
-
* }),
|
|
2043
|
+
* const results = yield* Effect.repeat(
|
|
2044
|
+
* Effect.succeed("checked"),
|
|
2091
2045
|
* collectWithCheck
|
|
2092
2046
|
* )
|
|
2093
2047
|
*
|
|
2094
|
-
* yield* Console.log(`Final collection: ${
|
|
2048
|
+
* yield* Console.log(`Final collection: ${results.length} items`)
|
|
2095
2049
|
* })
|
|
2096
2050
|
*
|
|
2097
2051
|
* // Collect samples with condition
|
|
2052
|
+
* const samples = [12, 18, 24, 30, 36]
|
|
2053
|
+
*
|
|
2098
2054
|
* const collectSamples = Schedule.collectWhile(
|
|
2099
2055
|
* Schedule.spaced("200 millis"),
|
|
2100
2056
|
* (metadata) =>
|
|
@@ -2102,55 +2058,36 @@ export const collectOutputs = <Output, Input, Error, Env>(
|
|
|
2102
2058
|
* )
|
|
2103
2059
|
*
|
|
2104
2060
|
* const samplingProgram = Effect.gen(function*() {
|
|
2105
|
-
*
|
|
2061
|
+
* let index = 0
|
|
2062
|
+
* const collected = yield* Effect.repeat(
|
|
2106
2063
|
* Effect.gen(function*() {
|
|
2107
|
-
* const sample =
|
|
2108
|
-
* yield* Console.log(`Sample: ${sample
|
|
2064
|
+
* const sample = samples[index++]
|
|
2065
|
+
* yield* Console.log(`Sample: ${sample}`)
|
|
2109
2066
|
* return sample
|
|
2110
2067
|
* }),
|
|
2111
2068
|
* collectSamples
|
|
2112
2069
|
* )
|
|
2113
2070
|
*
|
|
2114
|
-
* const average =
|
|
2071
|
+
* const average = collected.reduce((sum, s) => sum + s, 0) / collected.length
|
|
2115
2072
|
* yield* Console.log(
|
|
2116
|
-
* `Collected ${
|
|
2073
|
+
* `Collected ${collected.length} samples, average: ${average.toFixed(1)}`
|
|
2117
2074
|
* )
|
|
2118
2075
|
* })
|
|
2119
2076
|
* ```
|
|
2120
2077
|
*
|
|
2121
|
-
* @since 2.0.0
|
|
2122
2078
|
* @category utilities
|
|
2079
|
+
* @since 2.0.0
|
|
2123
2080
|
*/
|
|
2124
2081
|
export const collectWhile: {
|
|
2125
2082
|
/**
|
|
2126
2083
|
* Returns a new `Schedule` that recurs as long as the specified `predicate`
|
|
2127
2084
|
* returns `true`, collecting all outputs of the schedule into an array.
|
|
2128
2085
|
*
|
|
2129
|
-
*
|
|
2086
|
+
* **Example** (Collecting outputs while a condition holds)
|
|
2087
|
+
*
|
|
2130
2088
|
* ```ts
|
|
2131
2089
|
* import { Console, Effect, Schedule } from "effect"
|
|
2132
2090
|
*
|
|
2133
|
-
* // Collect outputs while under time limit
|
|
2134
|
-
* const collectForTime = Schedule.collectWhile(
|
|
2135
|
-
* Schedule.spaced("500 millis"),
|
|
2136
|
-
* (metadata) => Effect.succeed(metadata.elapsed < 3000) // Stop after 3 seconds
|
|
2137
|
-
* )
|
|
2138
|
-
*
|
|
2139
|
-
* const timeBasedProgram = Effect.gen(function*() {
|
|
2140
|
-
* const results = yield* Effect.repeat(
|
|
2141
|
-
* Effect.gen(function*() {
|
|
2142
|
-
* const value = Math.floor(Math.random() * 100)
|
|
2143
|
-
* yield* Console.log(`Generated value: ${value}`)
|
|
2144
|
-
* return value
|
|
2145
|
-
* }),
|
|
2146
|
-
* collectForTime
|
|
2147
|
-
* )
|
|
2148
|
-
*
|
|
2149
|
-
* yield* Console.log(
|
|
2150
|
-
* `Collected ${results.length} values: [${results.join(", ")}]`
|
|
2151
|
-
* )
|
|
2152
|
-
* })
|
|
2153
|
-
*
|
|
2154
2091
|
* // Collect outputs while condition is met
|
|
2155
2092
|
* const collectWhileSmall = Schedule.collectWhile(
|
|
2156
2093
|
* Schedule.exponential("100 millis"),
|
|
@@ -2161,16 +2098,16 @@ export const collectWhile: {
|
|
|
2161
2098
|
* const conditionalProgram = Effect.gen(function*() {
|
|
2162
2099
|
* let attempt = 0
|
|
2163
2100
|
*
|
|
2164
|
-
* const
|
|
2101
|
+
* const attempts = yield* Effect.repeat(
|
|
2165
2102
|
* Effect.gen(function*() {
|
|
2166
2103
|
* attempt++
|
|
2167
2104
|
* yield* Console.log(`Retry attempt ${attempt}`)
|
|
2168
|
-
* return
|
|
2105
|
+
* return `attempt-${attempt}`
|
|
2169
2106
|
* }),
|
|
2170
2107
|
* collectWhileSmall
|
|
2171
2108
|
* )
|
|
2172
2109
|
*
|
|
2173
|
-
* yield* Console.log(`Collected attempts: [${
|
|
2110
|
+
* yield* Console.log(`Collected attempts: [${attempts.join(", ")}]`)
|
|
2174
2111
|
* })
|
|
2175
2112
|
*
|
|
2176
2113
|
* // Collect with effectful predicate
|
|
@@ -2187,19 +2124,17 @@ export const collectWhile: {
|
|
|
2187
2124
|
* )
|
|
2188
2125
|
*
|
|
2189
2126
|
* const effectfulProgram = Effect.gen(function*() {
|
|
2190
|
-
* const
|
|
2191
|
-
* Effect.
|
|
2192
|
-
* const now = new Date().toISOString()
|
|
2193
|
-
* yield* Console.log(`Task at ${now}`)
|
|
2194
|
-
* return now
|
|
2195
|
-
* }),
|
|
2127
|
+
* const results = yield* Effect.repeat(
|
|
2128
|
+
* Effect.succeed("checked"),
|
|
2196
2129
|
* collectWithCheck
|
|
2197
2130
|
* )
|
|
2198
2131
|
*
|
|
2199
|
-
* yield* Console.log(`Final collection: ${
|
|
2132
|
+
* yield* Console.log(`Final collection: ${results.length} items`)
|
|
2200
2133
|
* })
|
|
2201
2134
|
*
|
|
2202
2135
|
* // Collect samples with condition
|
|
2136
|
+
* const samples = [12, 18, 24, 30, 36]
|
|
2137
|
+
*
|
|
2203
2138
|
* const collectSamples = Schedule.collectWhile(
|
|
2204
2139
|
* Schedule.spaced("200 millis"),
|
|
2205
2140
|
* (metadata) =>
|
|
@@ -2207,24 +2142,25 @@ export const collectWhile: {
|
|
|
2207
2142
|
* )
|
|
2208
2143
|
*
|
|
2209
2144
|
* const samplingProgram = Effect.gen(function*() {
|
|
2210
|
-
*
|
|
2145
|
+
* let index = 0
|
|
2146
|
+
* const collected = yield* Effect.repeat(
|
|
2211
2147
|
* Effect.gen(function*() {
|
|
2212
|
-
* const sample =
|
|
2213
|
-
* yield* Console.log(`Sample: ${sample
|
|
2148
|
+
* const sample = samples[index++]
|
|
2149
|
+
* yield* Console.log(`Sample: ${sample}`)
|
|
2214
2150
|
* return sample
|
|
2215
2151
|
* }),
|
|
2216
2152
|
* collectSamples
|
|
2217
2153
|
* )
|
|
2218
2154
|
*
|
|
2219
|
-
* const average =
|
|
2155
|
+
* const average = collected.reduce((sum, s) => sum + s, 0) / collected.length
|
|
2220
2156
|
* yield* Console.log(
|
|
2221
|
-
* `Collected ${
|
|
2157
|
+
* `Collected ${collected.length} samples, average: ${average.toFixed(1)}`
|
|
2222
2158
|
* )
|
|
2223
2159
|
* })
|
|
2224
2160
|
* ```
|
|
2225
2161
|
*
|
|
2226
|
-
* @since 2.0.0
|
|
2227
2162
|
* @category utilities
|
|
2163
|
+
* @since 2.0.0
|
|
2228
2164
|
*/
|
|
2229
2165
|
<Input, Output, Error2 = never, Env2 = never>(
|
|
2230
2166
|
predicate: (
|
|
@@ -2237,31 +2173,11 @@ export const collectWhile: {
|
|
|
2237
2173
|
* Returns a new `Schedule` that recurs as long as the specified `predicate`
|
|
2238
2174
|
* returns `true`, collecting all outputs of the schedule into an array.
|
|
2239
2175
|
*
|
|
2240
|
-
*
|
|
2176
|
+
* **Example** (Collecting outputs while a condition holds)
|
|
2177
|
+
*
|
|
2241
2178
|
* ```ts
|
|
2242
2179
|
* import { Console, Effect, Schedule } from "effect"
|
|
2243
2180
|
*
|
|
2244
|
-
* // Collect outputs while under time limit
|
|
2245
|
-
* const collectForTime = Schedule.collectWhile(
|
|
2246
|
-
* Schedule.spaced("500 millis"),
|
|
2247
|
-
* (metadata) => Effect.succeed(metadata.elapsed < 3000) // Stop after 3 seconds
|
|
2248
|
-
* )
|
|
2249
|
-
*
|
|
2250
|
-
* const timeBasedProgram = Effect.gen(function*() {
|
|
2251
|
-
* const results = yield* Effect.repeat(
|
|
2252
|
-
* Effect.gen(function*() {
|
|
2253
|
-
* const value = Math.floor(Math.random() * 100)
|
|
2254
|
-
* yield* Console.log(`Generated value: ${value}`)
|
|
2255
|
-
* return value
|
|
2256
|
-
* }),
|
|
2257
|
-
* collectForTime
|
|
2258
|
-
* )
|
|
2259
|
-
*
|
|
2260
|
-
* yield* Console.log(
|
|
2261
|
-
* `Collected ${results.length} values: [${results.join(", ")}]`
|
|
2262
|
-
* )
|
|
2263
|
-
* })
|
|
2264
|
-
*
|
|
2265
2181
|
* // Collect outputs while condition is met
|
|
2266
2182
|
* const collectWhileSmall = Schedule.collectWhile(
|
|
2267
2183
|
* Schedule.exponential("100 millis"),
|
|
@@ -2272,16 +2188,16 @@ export const collectWhile: {
|
|
|
2272
2188
|
* const conditionalProgram = Effect.gen(function*() {
|
|
2273
2189
|
* let attempt = 0
|
|
2274
2190
|
*
|
|
2275
|
-
* const
|
|
2191
|
+
* const attempts = yield* Effect.repeat(
|
|
2276
2192
|
* Effect.gen(function*() {
|
|
2277
2193
|
* attempt++
|
|
2278
2194
|
* yield* Console.log(`Retry attempt ${attempt}`)
|
|
2279
|
-
* return
|
|
2195
|
+
* return `attempt-${attempt}`
|
|
2280
2196
|
* }),
|
|
2281
2197
|
* collectWhileSmall
|
|
2282
2198
|
* )
|
|
2283
2199
|
*
|
|
2284
|
-
* yield* Console.log(`Collected attempts: [${
|
|
2200
|
+
* yield* Console.log(`Collected attempts: [${attempts.join(", ")}]`)
|
|
2285
2201
|
* })
|
|
2286
2202
|
*
|
|
2287
2203
|
* // Collect with effectful predicate
|
|
@@ -2298,19 +2214,17 @@ export const collectWhile: {
|
|
|
2298
2214
|
* )
|
|
2299
2215
|
*
|
|
2300
2216
|
* const effectfulProgram = Effect.gen(function*() {
|
|
2301
|
-
* const
|
|
2302
|
-
* Effect.
|
|
2303
|
-
* const now = new Date().toISOString()
|
|
2304
|
-
* yield* Console.log(`Task at ${now}`)
|
|
2305
|
-
* return now
|
|
2306
|
-
* }),
|
|
2217
|
+
* const results = yield* Effect.repeat(
|
|
2218
|
+
* Effect.succeed("checked"),
|
|
2307
2219
|
* collectWithCheck
|
|
2308
2220
|
* )
|
|
2309
2221
|
*
|
|
2310
|
-
* yield* Console.log(`Final collection: ${
|
|
2222
|
+
* yield* Console.log(`Final collection: ${results.length} items`)
|
|
2311
2223
|
* })
|
|
2312
2224
|
*
|
|
2313
2225
|
* // Collect samples with condition
|
|
2226
|
+
* const samples = [12, 18, 24, 30, 36]
|
|
2227
|
+
*
|
|
2314
2228
|
* const collectSamples = Schedule.collectWhile(
|
|
2315
2229
|
* Schedule.spaced("200 millis"),
|
|
2316
2230
|
* (metadata) =>
|
|
@@ -2318,24 +2232,25 @@ export const collectWhile: {
|
|
|
2318
2232
|
* )
|
|
2319
2233
|
*
|
|
2320
2234
|
* const samplingProgram = Effect.gen(function*() {
|
|
2321
|
-
*
|
|
2235
|
+
* let index = 0
|
|
2236
|
+
* const collected = yield* Effect.repeat(
|
|
2322
2237
|
* Effect.gen(function*() {
|
|
2323
|
-
* const sample =
|
|
2324
|
-
* yield* Console.log(`Sample: ${sample
|
|
2238
|
+
* const sample = samples[index++]
|
|
2239
|
+
* yield* Console.log(`Sample: ${sample}`)
|
|
2325
2240
|
* return sample
|
|
2326
2241
|
* }),
|
|
2327
2242
|
* collectSamples
|
|
2328
2243
|
* )
|
|
2329
2244
|
*
|
|
2330
|
-
* const average =
|
|
2245
|
+
* const average = collected.reduce((sum, s) => sum + s, 0) / collected.length
|
|
2331
2246
|
* yield* Console.log(
|
|
2332
|
-
* `Collected ${
|
|
2247
|
+
* `Collected ${collected.length} samples, average: ${average.toFixed(1)}`
|
|
2333
2248
|
* )
|
|
2334
2249
|
* })
|
|
2335
2250
|
* ```
|
|
2336
2251
|
*
|
|
2337
|
-
* @since 2.0.0
|
|
2338
2252
|
* @category utilities
|
|
2253
|
+
* @since 2.0.0
|
|
2339
2254
|
*/
|
|
2340
2255
|
<Output, Input, Error, Env, Error2 = never, Env2 = never>(
|
|
2341
2256
|
self: Schedule<Output, Input, Error, Env>,
|
|
@@ -2358,7 +2273,8 @@ export const collectWhile: {
|
|
|
2358
2273
|
* Returns a new `Schedule` that recurs on the specified `Cron` schedule and
|
|
2359
2274
|
* outputs the duration between recurrences.
|
|
2360
2275
|
*
|
|
2361
|
-
*
|
|
2276
|
+
* **Example** (Scheduling work with cron expressions)
|
|
2277
|
+
*
|
|
2362
2278
|
* ```ts
|
|
2363
2279
|
* import { Console, Data, Effect, Schedule } from "effect"
|
|
2364
2280
|
*
|
|
@@ -2370,7 +2286,7 @@ export const collectWhile: {
|
|
|
2370
2286
|
* const minutelyProgram = Effect.gen(function*() {
|
|
2371
2287
|
* yield* Effect.repeat(
|
|
2372
2288
|
* Effect.gen(function*() {
|
|
2373
|
-
* yield* Console.log(
|
|
2289
|
+
* yield* Console.log("Running minutely task")
|
|
2374
2290
|
* return "minute"
|
|
2375
2291
|
* }),
|
|
2376
2292
|
* everyMinute.pipe(
|
|
@@ -2408,8 +2324,8 @@ export const collectWhile: {
|
|
|
2408
2324
|
* Effect.gen(function*() {
|
|
2409
2325
|
* yield* Console.log("Generating weekly report...")
|
|
2410
2326
|
* const report = {
|
|
2411
|
-
* week:
|
|
2412
|
-
*
|
|
2327
|
+
* week: 42,
|
|
2328
|
+
* status: "ready" as const
|
|
2413
2329
|
* }
|
|
2414
2330
|
* yield* Console.log(`Report generated: ${JSON.stringify(report)}`)
|
|
2415
2331
|
* return report
|
|
@@ -2422,10 +2338,13 @@ export const collectWhile: {
|
|
|
2422
2338
|
* const businessHoursCheck = Schedule.cron("0,15,30,45 9-17 * * 1-5")
|
|
2423
2339
|
*
|
|
2424
2340
|
* const businessProgram = Effect.gen(function*() {
|
|
2341
|
+
* const statuses = ["healthy", "healthy", "degraded", "healthy"] as const
|
|
2342
|
+
* let index = 0
|
|
2343
|
+
*
|
|
2425
2344
|
* yield* Effect.repeat(
|
|
2426
2345
|
* Effect.gen(function*() {
|
|
2427
2346
|
* yield* Console.log("Business hours health check...")
|
|
2428
|
-
* const status =
|
|
2347
|
+
* const status = statuses[index++]
|
|
2429
2348
|
* yield* Console.log(`System status: ${status}`)
|
|
2430
2349
|
* return status
|
|
2431
2350
|
* }),
|
|
@@ -2442,9 +2361,9 @@ export const collectWhile: {
|
|
|
2442
2361
|
* yield* Effect.repeat(
|
|
2443
2362
|
* Effect.gen(function*() {
|
|
2444
2363
|
* yield* Console.log("Processing monthly invoices...")
|
|
2445
|
-
* const invoiceCount =
|
|
2364
|
+
* const invoiceCount = 72
|
|
2446
2365
|
* yield* Console.log(`Processed ${invoiceCount} invoices`)
|
|
2447
|
-
* return { count: invoiceCount,
|
|
2366
|
+
* return { count: invoiceCount, batch: "2024-01-a" }
|
|
2448
2367
|
* }),
|
|
2449
2368
|
* monthlyInvoice.pipe(Schedule.take(1))
|
|
2450
2369
|
* )
|
|
@@ -2458,11 +2377,13 @@ export const collectWhile: {
|
|
|
2458
2377
|
* )
|
|
2459
2378
|
*
|
|
2460
2379
|
* const robustProgram = Effect.gen(function*() {
|
|
2380
|
+
* let attempt = 0
|
|
2381
|
+
*
|
|
2461
2382
|
* yield* Effect.repeat(
|
|
2462
2383
|
* Effect.gen(function*() {
|
|
2384
|
+
* attempt++
|
|
2463
2385
|
* yield* Console.log("Complex scheduled task...")
|
|
2464
|
-
*
|
|
2465
|
-
* if (Math.random() < 0.3) {
|
|
2386
|
+
* if (attempt === 1) {
|
|
2466
2387
|
* return yield* Effect.fail(new ScheduledTaskError({ message: "Scheduled task failed" }))
|
|
2467
2388
|
* }
|
|
2468
2389
|
* return "success"
|
|
@@ -2476,15 +2397,16 @@ export const collectWhile: {
|
|
|
2476
2397
|
* })
|
|
2477
2398
|
* ```
|
|
2478
2399
|
*
|
|
2479
|
-
* @since 4.0.0
|
|
2480
2400
|
* @category constructors
|
|
2401
|
+
* @since 4.0.0
|
|
2481
2402
|
*/
|
|
2482
2403
|
export const cron: {
|
|
2483
2404
|
/**
|
|
2484
2405
|
* Returns a new `Schedule` that recurs on the specified `Cron` schedule and
|
|
2485
2406
|
* outputs the duration between recurrences.
|
|
2486
2407
|
*
|
|
2487
|
-
*
|
|
2408
|
+
* **Example** (Scheduling work with cron expressions)
|
|
2409
|
+
*
|
|
2488
2410
|
* ```ts
|
|
2489
2411
|
* import { Console, Data, Effect, Schedule } from "effect"
|
|
2490
2412
|
*
|
|
@@ -2496,7 +2418,7 @@ export const cron: {
|
|
|
2496
2418
|
* const minutelyProgram = Effect.gen(function*() {
|
|
2497
2419
|
* yield* Effect.repeat(
|
|
2498
2420
|
* Effect.gen(function*() {
|
|
2499
|
-
* yield* Console.log(
|
|
2421
|
+
* yield* Console.log("Running minutely task")
|
|
2500
2422
|
* return "minute"
|
|
2501
2423
|
* }),
|
|
2502
2424
|
* everyMinute.pipe(
|
|
@@ -2534,8 +2456,8 @@ export const cron: {
|
|
|
2534
2456
|
* Effect.gen(function*() {
|
|
2535
2457
|
* yield* Console.log("Generating weekly report...")
|
|
2536
2458
|
* const report = {
|
|
2537
|
-
* week:
|
|
2538
|
-
*
|
|
2459
|
+
* week: 42,
|
|
2460
|
+
* status: "ready" as const
|
|
2539
2461
|
* }
|
|
2540
2462
|
* yield* Console.log(`Report generated: ${JSON.stringify(report)}`)
|
|
2541
2463
|
* return report
|
|
@@ -2548,10 +2470,13 @@ export const cron: {
|
|
|
2548
2470
|
* const businessHoursCheck = Schedule.cron("0,15,30,45 9-17 * * 1-5")
|
|
2549
2471
|
*
|
|
2550
2472
|
* const businessProgram = Effect.gen(function*() {
|
|
2473
|
+
* const statuses = ["healthy", "healthy", "degraded", "healthy"] as const
|
|
2474
|
+
* let index = 0
|
|
2475
|
+
*
|
|
2551
2476
|
* yield* Effect.repeat(
|
|
2552
2477
|
* Effect.gen(function*() {
|
|
2553
2478
|
* yield* Console.log("Business hours health check...")
|
|
2554
|
-
* const status =
|
|
2479
|
+
* const status = statuses[index++]
|
|
2555
2480
|
* yield* Console.log(`System status: ${status}`)
|
|
2556
2481
|
* return status
|
|
2557
2482
|
* }),
|
|
@@ -2568,9 +2493,9 @@ export const cron: {
|
|
|
2568
2493
|
* yield* Effect.repeat(
|
|
2569
2494
|
* Effect.gen(function*() {
|
|
2570
2495
|
* yield* Console.log("Processing monthly invoices...")
|
|
2571
|
-
* const invoiceCount =
|
|
2496
|
+
* const invoiceCount = 72
|
|
2572
2497
|
* yield* Console.log(`Processed ${invoiceCount} invoices`)
|
|
2573
|
-
* return { count: invoiceCount,
|
|
2498
|
+
* return { count: invoiceCount, batch: "2024-01-a" }
|
|
2574
2499
|
* }),
|
|
2575
2500
|
* monthlyInvoice.pipe(Schedule.take(1))
|
|
2576
2501
|
* )
|
|
@@ -2584,11 +2509,13 @@ export const cron: {
|
|
|
2584
2509
|
* )
|
|
2585
2510
|
*
|
|
2586
2511
|
* const robustProgram = Effect.gen(function*() {
|
|
2512
|
+
* let attempt = 0
|
|
2513
|
+
*
|
|
2587
2514
|
* yield* Effect.repeat(
|
|
2588
2515
|
* Effect.gen(function*() {
|
|
2516
|
+
* attempt++
|
|
2589
2517
|
* yield* Console.log("Complex scheduled task...")
|
|
2590
|
-
*
|
|
2591
|
-
* if (Math.random() < 0.3) {
|
|
2518
|
+
* if (attempt === 1) {
|
|
2592
2519
|
* return yield* Effect.fail(new ScheduledTaskError({ message: "Scheduled task failed" }))
|
|
2593
2520
|
* }
|
|
2594
2521
|
* return "success"
|
|
@@ -2602,15 +2529,16 @@ export const cron: {
|
|
|
2602
2529
|
* })
|
|
2603
2530
|
* ```
|
|
2604
2531
|
*
|
|
2605
|
-
* @since 4.0.0
|
|
2606
2532
|
* @category constructors
|
|
2533
|
+
* @since 4.0.0
|
|
2607
2534
|
*/
|
|
2608
2535
|
(expression: Cron.Cron): Schedule<Duration.Duration, unknown, Cron.CronParseError>
|
|
2609
2536
|
/**
|
|
2610
2537
|
* Returns a new `Schedule` that recurs on the specified `Cron` schedule and
|
|
2611
2538
|
* outputs the duration between recurrences.
|
|
2612
2539
|
*
|
|
2613
|
-
*
|
|
2540
|
+
* **Example** (Scheduling work with cron expressions)
|
|
2541
|
+
*
|
|
2614
2542
|
* ```ts
|
|
2615
2543
|
* import { Console, Data, Effect, Schedule } from "effect"
|
|
2616
2544
|
*
|
|
@@ -2622,7 +2550,7 @@ export const cron: {
|
|
|
2622
2550
|
* const minutelyProgram = Effect.gen(function*() {
|
|
2623
2551
|
* yield* Effect.repeat(
|
|
2624
2552
|
* Effect.gen(function*() {
|
|
2625
|
-
* yield* Console.log(
|
|
2553
|
+
* yield* Console.log("Running minutely task")
|
|
2626
2554
|
* return "minute"
|
|
2627
2555
|
* }),
|
|
2628
2556
|
* everyMinute.pipe(
|
|
@@ -2660,8 +2588,8 @@ export const cron: {
|
|
|
2660
2588
|
* Effect.gen(function*() {
|
|
2661
2589
|
* yield* Console.log("Generating weekly report...")
|
|
2662
2590
|
* const report = {
|
|
2663
|
-
* week:
|
|
2664
|
-
*
|
|
2591
|
+
* week: 42,
|
|
2592
|
+
* status: "ready" as const
|
|
2665
2593
|
* }
|
|
2666
2594
|
* yield* Console.log(`Report generated: ${JSON.stringify(report)}`)
|
|
2667
2595
|
* return report
|
|
@@ -2674,10 +2602,13 @@ export const cron: {
|
|
|
2674
2602
|
* const businessHoursCheck = Schedule.cron("0,15,30,45 9-17 * * 1-5")
|
|
2675
2603
|
*
|
|
2676
2604
|
* const businessProgram = Effect.gen(function*() {
|
|
2605
|
+
* const statuses = ["healthy", "healthy", "degraded", "healthy"] as const
|
|
2606
|
+
* let index = 0
|
|
2607
|
+
*
|
|
2677
2608
|
* yield* Effect.repeat(
|
|
2678
2609
|
* Effect.gen(function*() {
|
|
2679
2610
|
* yield* Console.log("Business hours health check...")
|
|
2680
|
-
* const status =
|
|
2611
|
+
* const status = statuses[index++]
|
|
2681
2612
|
* yield* Console.log(`System status: ${status}`)
|
|
2682
2613
|
* return status
|
|
2683
2614
|
* }),
|
|
@@ -2694,9 +2625,9 @@ export const cron: {
|
|
|
2694
2625
|
* yield* Effect.repeat(
|
|
2695
2626
|
* Effect.gen(function*() {
|
|
2696
2627
|
* yield* Console.log("Processing monthly invoices...")
|
|
2697
|
-
* const invoiceCount =
|
|
2628
|
+
* const invoiceCount = 72
|
|
2698
2629
|
* yield* Console.log(`Processed ${invoiceCount} invoices`)
|
|
2699
|
-
* return { count: invoiceCount,
|
|
2630
|
+
* return { count: invoiceCount, batch: "2024-01-a" }
|
|
2700
2631
|
* }),
|
|
2701
2632
|
* monthlyInvoice.pipe(Schedule.take(1))
|
|
2702
2633
|
* )
|
|
@@ -2710,11 +2641,13 @@ export const cron: {
|
|
|
2710
2641
|
* )
|
|
2711
2642
|
*
|
|
2712
2643
|
* const robustProgram = Effect.gen(function*() {
|
|
2644
|
+
* let attempt = 0
|
|
2645
|
+
*
|
|
2713
2646
|
* yield* Effect.repeat(
|
|
2714
2647
|
* Effect.gen(function*() {
|
|
2648
|
+
* attempt++
|
|
2715
2649
|
* yield* Console.log("Complex scheduled task...")
|
|
2716
|
-
*
|
|
2717
|
-
* if (Math.random() < 0.3) {
|
|
2650
|
+
* if (attempt === 1) {
|
|
2718
2651
|
* return yield* Effect.fail(new ScheduledTaskError({ message: "Scheduled task failed" }))
|
|
2719
2652
|
* }
|
|
2720
2653
|
* return "success"
|
|
@@ -2728,13 +2661,13 @@ export const cron: {
|
|
|
2728
2661
|
* })
|
|
2729
2662
|
* ```
|
|
2730
2663
|
*
|
|
2731
|
-
* @since 4.0.0
|
|
2732
2664
|
* @category constructors
|
|
2665
|
+
* @since 4.0.0
|
|
2733
2666
|
*/
|
|
2734
2667
|
(expression: string, tz?: string | DateTime.TimeZone): Schedule<Duration.Duration, unknown, Cron.CronParseError>
|
|
2735
2668
|
} = (expression: string | Cron.Cron, tz?: string | DateTime.TimeZone) => {
|
|
2736
2669
|
const parsed = Cron.isCron(expression) ? Result.succeed(expression) : Cron.parse(expression, tz)
|
|
2737
|
-
return fromStep(effect.map(
|
|
2670
|
+
return fromStep(effect.map(effect.fromResult(parsed), (cron) => (now, _) =>
|
|
2738
2671
|
effect.sync(() => {
|
|
2739
2672
|
const next = Cron.next(cron, now).getTime()
|
|
2740
2673
|
const duration = Duration.millis(next - now)
|
|
@@ -2745,7 +2678,8 @@ export const cron: {
|
|
|
2745
2678
|
/**
|
|
2746
2679
|
* Returns a new schedule that outputs the delay between each occurence.
|
|
2747
2680
|
*
|
|
2748
|
-
*
|
|
2681
|
+
* **Example** (Extracting schedule delays)
|
|
2682
|
+
*
|
|
2749
2683
|
* ```ts
|
|
2750
2684
|
* import { Console, Effect, Schedule } from "effect"
|
|
2751
2685
|
*
|
|
@@ -2805,7 +2739,7 @@ export const cron: {
|
|
|
2805
2739
|
* yield* Effect.repeat(
|
|
2806
2740
|
* Effect.gen(function*() {
|
|
2807
2741
|
* yield* Console.log("Adaptive task execution")
|
|
2808
|
-
* return
|
|
2742
|
+
* return "completed"
|
|
2809
2743
|
* }),
|
|
2810
2744
|
* adaptiveDelays.pipe(
|
|
2811
2745
|
* Schedule.tapOutput((delay) => Console.log(`Adaptive delay: ${delay}`))
|
|
@@ -2822,8 +2756,8 @@ export const cron: {
|
|
|
2822
2756
|
* )
|
|
2823
2757
|
* ```
|
|
2824
2758
|
*
|
|
2825
|
-
* @since 2.0.0
|
|
2826
2759
|
* @category constructors
|
|
2760
|
+
* @since 2.0.0
|
|
2827
2761
|
*/
|
|
2828
2762
|
export const delays = <Out, In, E, R>(self: Schedule<Out, In, E, R>): Schedule<Duration.Duration, In, E, R> =>
|
|
2829
2763
|
fromStep(
|
|
@@ -2843,8 +2777,8 @@ export const delays = <Out, In, E, R>(self: Schedule<Out, In, E, R>): Schedule<D
|
|
|
2843
2777
|
* The schedule outputs the configured duration for its first recurrence and
|
|
2844
2778
|
* then completes.
|
|
2845
2779
|
*
|
|
2846
|
-
* @since 2.0.0
|
|
2847
2780
|
* @category constructors
|
|
2781
|
+
* @since 2.0.0
|
|
2848
2782
|
*/
|
|
2849
2783
|
export const duration = (durationInput: Duration.Input): Schedule<Duration.Duration> => {
|
|
2850
2784
|
const duration = Duration.fromInputUnsafe(durationInput)
|
|
@@ -2859,7 +2793,8 @@ export const duration = (durationInput: Duration.Input): Schedule<Duration.Durat
|
|
|
2859
2793
|
* Returns a new `Schedule` that will always recur, but only during the
|
|
2860
2794
|
* specified `duration` of time.
|
|
2861
2795
|
*
|
|
2862
|
-
*
|
|
2796
|
+
* **Example** (Repeating work during a duration)
|
|
2797
|
+
*
|
|
2863
2798
|
* ```ts
|
|
2864
2799
|
* import { Console, Data, Effect, Schedule } from "effect"
|
|
2865
2800
|
*
|
|
@@ -2869,12 +2804,9 @@ export const duration = (durationInput: Duration.Input): Schedule<Duration.Durat
|
|
|
2869
2804
|
* const fiveSecondSchedule = Schedule.during("5 seconds")
|
|
2870
2805
|
*
|
|
2871
2806
|
* const timedProgram = Effect.gen(function*() {
|
|
2872
|
-
* const startTime = Date.now()
|
|
2873
|
-
*
|
|
2874
2807
|
* yield* Effect.repeat(
|
|
2875
2808
|
* Effect.gen(function*() {
|
|
2876
|
-
*
|
|
2877
|
-
* yield* Console.log(`Task executed after ${elapsed}ms`)
|
|
2809
|
+
* yield* Console.log("Task executed inside the time window")
|
|
2878
2810
|
* yield* Effect.sleep("500 millis") // Each task takes 500ms
|
|
2879
2811
|
* return "task done"
|
|
2880
2812
|
* }),
|
|
@@ -2902,8 +2834,8 @@ export const duration = (durationInput: Duration.Input): Schedule<Duration.Durat
|
|
|
2902
2834
|
*
|
|
2903
2835
|
* yield* Effect.repeat(
|
|
2904
2836
|
* Effect.gen(function*() {
|
|
2905
|
-
* yield* Console.log(
|
|
2906
|
-
* return
|
|
2837
|
+
* yield* Console.log("Burst task")
|
|
2838
|
+
* return "burst"
|
|
2907
2839
|
* }),
|
|
2908
2840
|
* burstWindow
|
|
2909
2841
|
* )
|
|
@@ -2924,7 +2856,7 @@ export const duration = (durationInput: Duration.Input): Schedule<Duration.Durat
|
|
|
2924
2856
|
* attempt++
|
|
2925
2857
|
* yield* Console.log(`Retry attempt ${attempt}`)
|
|
2926
2858
|
*
|
|
2927
|
-
* if (
|
|
2859
|
+
* if (attempt < 4) {
|
|
2928
2860
|
* return yield* Effect.fail(new RetryAttemptError({ message: `Attempt ${attempt} failed` }))
|
|
2929
2861
|
* }
|
|
2930
2862
|
*
|
|
@@ -2939,8 +2871,8 @@ export const duration = (durationInput: Duration.Input): Schedule<Duration.Durat
|
|
|
2939
2871
|
* )
|
|
2940
2872
|
* ```
|
|
2941
2873
|
*
|
|
2942
|
-
* @since 4.0.0
|
|
2943
2874
|
* @category constructors
|
|
2875
|
+
* @since 4.0.0
|
|
2944
2876
|
*/
|
|
2945
2877
|
export const during = (duration: Duration.Input): Schedule<Duration.Duration> =>
|
|
2946
2878
|
while_(
|
|
@@ -2953,7 +2885,8 @@ export const during = (duration: Duration.Input): Schedule<Duration.Duration> =>
|
|
|
2953
2885
|
* to recur, using the minimum of the two durations between recurrences and
|
|
2954
2886
|
* outputting a tuple of the outputs of both schedules.
|
|
2955
2887
|
*
|
|
2956
|
-
*
|
|
2888
|
+
* **Example** (Combining schedules with either semantics)
|
|
2889
|
+
*
|
|
2957
2890
|
* ```ts
|
|
2958
2891
|
* import { Console, Data, Effect, Schedule } from "effect"
|
|
2959
2892
|
*
|
|
@@ -2970,7 +2903,7 @@ export const during = (duration: Duration.Input): Schedule<Duration.Duration> =>
|
|
|
2970
2903
|
* const program = Effect.gen(function*() {
|
|
2971
2904
|
* const results = yield* Effect.repeat(
|
|
2972
2905
|
* Effect.gen(function*() {
|
|
2973
|
-
* yield* Console.log(
|
|
2906
|
+
* yield* Console.log("Task executed")
|
|
2974
2907
|
* return "task completed"
|
|
2975
2908
|
* }),
|
|
2976
2909
|
* eitherSchedule.pipe(
|
|
@@ -3016,8 +2949,8 @@ export const during = (duration: Duration.Input): Schedule<Duration.Duration> =>
|
|
|
3016
2949
|
* // Compare with intersect which provides intersection semantics (AND logic)
|
|
3017
2950
|
* ```
|
|
3018
2951
|
*
|
|
3019
|
-
* @since 2.0.0
|
|
3020
2952
|
* @category utilities
|
|
2953
|
+
* @since 2.0.0
|
|
3021
2954
|
*/
|
|
3022
2955
|
export const either: {
|
|
3023
2956
|
/**
|
|
@@ -3025,7 +2958,8 @@ export const either: {
|
|
|
3025
2958
|
* to recur, using the minimum of the two durations between recurrences and
|
|
3026
2959
|
* outputting a tuple of the outputs of both schedules.
|
|
3027
2960
|
*
|
|
3028
|
-
*
|
|
2961
|
+
* **Example** (Combining schedules with either semantics)
|
|
2962
|
+
*
|
|
3029
2963
|
* ```ts
|
|
3030
2964
|
* import { Console, Data, Effect, Schedule } from "effect"
|
|
3031
2965
|
*
|
|
@@ -3042,7 +2976,7 @@ export const either: {
|
|
|
3042
2976
|
* const program = Effect.gen(function*() {
|
|
3043
2977
|
* const results = yield* Effect.repeat(
|
|
3044
2978
|
* Effect.gen(function*() {
|
|
3045
|
-
* yield* Console.log(
|
|
2979
|
+
* yield* Console.log("Task executed")
|
|
3046
2980
|
* return "task completed"
|
|
3047
2981
|
* }),
|
|
3048
2982
|
* eitherSchedule.pipe(
|
|
@@ -3088,8 +3022,8 @@ export const either: {
|
|
|
3088
3022
|
* // Compare with intersect which provides intersection semantics (AND logic)
|
|
3089
3023
|
* ```
|
|
3090
3024
|
*
|
|
3091
|
-
* @since 2.0.0
|
|
3092
3025
|
* @category utilities
|
|
3026
|
+
* @since 2.0.0
|
|
3093
3027
|
*/
|
|
3094
3028
|
<Output2, Input2, Error2, Env2>(other: Schedule<Output2, Input2, Error2, Env2>): <Output, Input, Error, Env>(
|
|
3095
3029
|
self: Schedule<Output, Input, Error, Env>
|
|
@@ -3099,7 +3033,8 @@ export const either: {
|
|
|
3099
3033
|
* to recur, using the minimum of the two durations between recurrences and
|
|
3100
3034
|
* outputting a tuple of the outputs of both schedules.
|
|
3101
3035
|
*
|
|
3102
|
-
*
|
|
3036
|
+
* **Example** (Combining schedules with either semantics)
|
|
3037
|
+
*
|
|
3103
3038
|
* ```ts
|
|
3104
3039
|
* import { Console, Data, Effect, Schedule } from "effect"
|
|
3105
3040
|
*
|
|
@@ -3116,7 +3051,7 @@ export const either: {
|
|
|
3116
3051
|
* const program = Effect.gen(function*() {
|
|
3117
3052
|
* const results = yield* Effect.repeat(
|
|
3118
3053
|
* Effect.gen(function*() {
|
|
3119
|
-
* yield* Console.log(
|
|
3054
|
+
* yield* Console.log("Task executed")
|
|
3120
3055
|
* return "task completed"
|
|
3121
3056
|
* }),
|
|
3122
3057
|
* eitherSchedule.pipe(
|
|
@@ -3162,8 +3097,8 @@ export const either: {
|
|
|
3162
3097
|
* // Compare with intersect which provides intersection semantics (AND logic)
|
|
3163
3098
|
* ```
|
|
3164
3099
|
*
|
|
3165
|
-
* @since 2.0.0
|
|
3166
3100
|
* @category utilities
|
|
3101
|
+
* @since 2.0.0
|
|
3167
3102
|
*/
|
|
3168
3103
|
<Output, Input, Error, Env, Output2, Input2, Error2, Env2>(
|
|
3169
3104
|
self: Schedule<Output, Input, Error, Env>,
|
|
@@ -3180,7 +3115,8 @@ export const either: {
|
|
|
3180
3115
|
* to recur, using the minimum of the two durations between recurrences and
|
|
3181
3116
|
* outputting the result of the left schedule (i.e. `self`).
|
|
3182
3117
|
*
|
|
3183
|
-
*
|
|
3118
|
+
* **Example** (Combining either schedules and keeping the left output)
|
|
3119
|
+
*
|
|
3184
3120
|
* ```ts
|
|
3185
3121
|
* import { Console, Effect, Schedule } from "effect"
|
|
3186
3122
|
*
|
|
@@ -3206,8 +3142,8 @@ export const either: {
|
|
|
3206
3142
|
* })
|
|
3207
3143
|
* ```
|
|
3208
3144
|
*
|
|
3209
|
-
* @since 2.0.0
|
|
3210
3145
|
* @category utilities
|
|
3146
|
+
* @since 2.0.0
|
|
3211
3147
|
*/
|
|
3212
3148
|
export const eitherLeft: {
|
|
3213
3149
|
/**
|
|
@@ -3215,7 +3151,8 @@ export const eitherLeft: {
|
|
|
3215
3151
|
* to recur, using the minimum of the two durations between recurrences and
|
|
3216
3152
|
* outputting the result of the left schedule (i.e. `self`).
|
|
3217
3153
|
*
|
|
3218
|
-
*
|
|
3154
|
+
* **Example** (Combining either schedules and keeping the left output)
|
|
3155
|
+
*
|
|
3219
3156
|
* ```ts
|
|
3220
3157
|
* import { Console, Effect, Schedule } from "effect"
|
|
3221
3158
|
*
|
|
@@ -3241,8 +3178,8 @@ export const eitherLeft: {
|
|
|
3241
3178
|
* })
|
|
3242
3179
|
* ```
|
|
3243
3180
|
*
|
|
3244
|
-
* @since 2.0.0
|
|
3245
3181
|
* @category utilities
|
|
3182
|
+
* @since 2.0.0
|
|
3246
3183
|
*/
|
|
3247
3184
|
<Output2, Input2, Error2, Env2>(other: Schedule<Output2, Input2, Error2, Env2>): <Output, Input, Error, Env>(
|
|
3248
3185
|
self: Schedule<Output, Input, Error, Env>
|
|
@@ -3252,7 +3189,8 @@ export const eitherLeft: {
|
|
|
3252
3189
|
* to recur, using the minimum of the two durations between recurrences and
|
|
3253
3190
|
* outputting the result of the left schedule (i.e. `self`).
|
|
3254
3191
|
*
|
|
3255
|
-
*
|
|
3192
|
+
* **Example** (Combining either schedules and keeping the left output)
|
|
3193
|
+
*
|
|
3256
3194
|
* ```ts
|
|
3257
3195
|
* import { Console, Effect, Schedule } from "effect"
|
|
3258
3196
|
*
|
|
@@ -3278,8 +3216,8 @@ export const eitherLeft: {
|
|
|
3278
3216
|
* })
|
|
3279
3217
|
* ```
|
|
3280
3218
|
*
|
|
3281
|
-
* @since 2.0.0
|
|
3282
3219
|
* @category utilities
|
|
3220
|
+
* @since 2.0.0
|
|
3283
3221
|
*/
|
|
3284
3222
|
<Output, Input, Error, Env, Output2, Input2, Error2, Env2>(
|
|
3285
3223
|
self: Schedule<Output, Input, Error, Env>,
|
|
@@ -3295,7 +3233,8 @@ export const eitherLeft: {
|
|
|
3295
3233
|
* to recur, using the minimum of the two durations between recurrences and
|
|
3296
3234
|
* outputting the result of the right schedule (i.e. `other`).
|
|
3297
3235
|
*
|
|
3298
|
-
*
|
|
3236
|
+
* **Example** (Combining either schedules and keeping the right output)
|
|
3237
|
+
*
|
|
3299
3238
|
* ```ts
|
|
3300
3239
|
* import { Console, Effect, Schedule } from "effect"
|
|
3301
3240
|
*
|
|
@@ -3321,8 +3260,8 @@ export const eitherLeft: {
|
|
|
3321
3260
|
* })
|
|
3322
3261
|
* ```
|
|
3323
3262
|
*
|
|
3324
|
-
* @since 2.0.0
|
|
3325
3263
|
* @category utilities
|
|
3264
|
+
* @since 2.0.0
|
|
3326
3265
|
*/
|
|
3327
3266
|
export const eitherRight: {
|
|
3328
3267
|
/**
|
|
@@ -3330,7 +3269,8 @@ export const eitherRight: {
|
|
|
3330
3269
|
* to recur, using the minimum of the two durations between recurrences and
|
|
3331
3270
|
* outputting the result of the right schedule (i.e. `other`).
|
|
3332
3271
|
*
|
|
3333
|
-
*
|
|
3272
|
+
* **Example** (Combining either schedules and keeping the right output)
|
|
3273
|
+
*
|
|
3334
3274
|
* ```ts
|
|
3335
3275
|
* import { Console, Effect, Schedule } from "effect"
|
|
3336
3276
|
*
|
|
@@ -3356,8 +3296,8 @@ export const eitherRight: {
|
|
|
3356
3296
|
* })
|
|
3357
3297
|
* ```
|
|
3358
3298
|
*
|
|
3359
|
-
* @since 2.0.0
|
|
3360
3299
|
* @category utilities
|
|
3300
|
+
* @since 2.0.0
|
|
3361
3301
|
*/
|
|
3362
3302
|
<Output2, Input2, Error2, Env2>(other: Schedule<Output2, Input2, Error2, Env2>): <Output, Input, Error, Env>(
|
|
3363
3303
|
self: Schedule<Output, Input, Error, Env>
|
|
@@ -3367,7 +3307,8 @@ export const eitherRight: {
|
|
|
3367
3307
|
* to recur, using the minimum of the two durations between recurrences and
|
|
3368
3308
|
* outputting the result of the right schedule (i.e. `other`).
|
|
3369
3309
|
*
|
|
3370
|
-
*
|
|
3310
|
+
* **Example** (Combining either schedules and keeping the right output)
|
|
3311
|
+
*
|
|
3371
3312
|
* ```ts
|
|
3372
3313
|
* import { Console, Effect, Schedule } from "effect"
|
|
3373
3314
|
*
|
|
@@ -3393,8 +3334,8 @@ export const eitherRight: {
|
|
|
3393
3334
|
* })
|
|
3394
3335
|
* ```
|
|
3395
3336
|
*
|
|
3396
|
-
* @since 2.0.0
|
|
3397
3337
|
* @category utilities
|
|
3338
|
+
* @since 2.0.0
|
|
3398
3339
|
*/
|
|
3399
3340
|
<Output, Input, Error, Env, Output2, Input2, Error2, Env2>(
|
|
3400
3341
|
self: Schedule<Output, Input, Error, Env>,
|
|
@@ -3411,7 +3352,8 @@ export const eitherRight: {
|
|
|
3411
3352
|
* outputting the result of the combination of both schedule outputs using the
|
|
3412
3353
|
* specified `combine` function.
|
|
3413
3354
|
*
|
|
3414
|
-
*
|
|
3355
|
+
* **Example** (Combining either schedule outputs)
|
|
3356
|
+
*
|
|
3415
3357
|
* ```ts
|
|
3416
3358
|
* import { Console, Effect, Schedule } from "effect"
|
|
3417
3359
|
*
|
|
@@ -3441,8 +3383,8 @@ export const eitherRight: {
|
|
|
3441
3383
|
* })
|
|
3442
3384
|
* ```
|
|
3443
3385
|
*
|
|
3444
|
-
* @since 2.0.0
|
|
3445
3386
|
* @category utilities
|
|
3387
|
+
* @since 2.0.0
|
|
3446
3388
|
*/
|
|
3447
3389
|
export const eitherWith: {
|
|
3448
3390
|
/**
|
|
@@ -3451,7 +3393,8 @@ export const eitherWith: {
|
|
|
3451
3393
|
* outputting the result of the combination of both schedule outputs using the
|
|
3452
3394
|
* specified `combine` function.
|
|
3453
3395
|
*
|
|
3454
|
-
*
|
|
3396
|
+
* **Example** (Combining either schedule outputs)
|
|
3397
|
+
*
|
|
3455
3398
|
* ```ts
|
|
3456
3399
|
* import { Console, Effect, Schedule } from "effect"
|
|
3457
3400
|
*
|
|
@@ -3481,8 +3424,8 @@ export const eitherWith: {
|
|
|
3481
3424
|
* })
|
|
3482
3425
|
* ```
|
|
3483
3426
|
*
|
|
3484
|
-
* @since 2.0.0
|
|
3485
3427
|
* @category utilities
|
|
3428
|
+
* @since 2.0.0
|
|
3486
3429
|
*/
|
|
3487
3430
|
<Output2, Input2, Error2, Env2, Output, Output3>(
|
|
3488
3431
|
other: Schedule<Output2, Input2, Error2, Env2>,
|
|
@@ -3496,7 +3439,8 @@ export const eitherWith: {
|
|
|
3496
3439
|
* outputting the result of the combination of both schedule outputs using the
|
|
3497
3440
|
* specified `combine` function.
|
|
3498
3441
|
*
|
|
3499
|
-
*
|
|
3442
|
+
* **Example** (Combining either schedule outputs)
|
|
3443
|
+
*
|
|
3500
3444
|
* ```ts
|
|
3501
3445
|
* import { Console, Effect, Schedule } from "effect"
|
|
3502
3446
|
*
|
|
@@ -3526,8 +3470,8 @@ export const eitherWith: {
|
|
|
3526
3470
|
* })
|
|
3527
3471
|
* ```
|
|
3528
3472
|
*
|
|
3529
|
-
* @since 2.0.0
|
|
3530
3473
|
* @category utilities
|
|
3474
|
+
* @since 2.0.0
|
|
3531
3475
|
*/
|
|
3532
3476
|
<Output, Input, Error, Env, Output2, Input2, Error2, Env2, Output3>(
|
|
3533
3477
|
self: Schedule<Output, Input, Error, Env>,
|
|
@@ -3558,7 +3502,8 @@ export const eitherWith: {
|
|
|
3558
3502
|
* outputting the result of the combination of both schedule outputs using the
|
|
3559
3503
|
* specified `combine` function.
|
|
3560
3504
|
*
|
|
3561
|
-
*
|
|
3505
|
+
* **Example** (Combining either schedule outputs)
|
|
3506
|
+
*
|
|
3562
3507
|
* ```ts
|
|
3563
3508
|
* import { Console, Effect, Schedule } from "effect"
|
|
3564
3509
|
*
|
|
@@ -3588,8 +3533,8 @@ export const eitherWith: {
|
|
|
3588
3533
|
* })
|
|
3589
3534
|
* ```
|
|
3590
3535
|
*
|
|
3591
|
-
* @since 2.0.0
|
|
3592
3536
|
* @category utilities
|
|
3537
|
+
* @since 2.0.0
|
|
3593
3538
|
*/
|
|
3594
3539
|
[Output3, Duration.Duration]>([
|
|
3595
3540
|
combine(leftResult[0], rightDone as Output2),
|
|
@@ -3619,7 +3564,8 @@ export const eitherWith: {
|
|
|
3619
3564
|
*
|
|
3620
3565
|
* @returns A schedule that outputs the elapsed duration and never stops
|
|
3621
3566
|
*
|
|
3622
|
-
*
|
|
3567
|
+
* **Example** (Measuring elapsed schedule time)
|
|
3568
|
+
*
|
|
3623
3569
|
* ```ts
|
|
3624
3570
|
* import { Console, Duration, Effect, Schedule } from "effect"
|
|
3625
3571
|
*
|
|
@@ -3637,8 +3583,8 @@ export const eitherWith: {
|
|
|
3637
3583
|
* })
|
|
3638
3584
|
* ```
|
|
3639
3585
|
*
|
|
3640
|
-
* @since 2.0.0
|
|
3641
3586
|
* @category constructors
|
|
3587
|
+
* @since 2.0.0
|
|
3642
3588
|
*/
|
|
3643
3589
|
export const elapsed: Schedule<Duration.Duration> = fromStepWithMetadata(
|
|
3644
3590
|
effect.succeed((meta) => effect.succeed([Duration.millis(meta.elapsed), Duration.zero] as const))
|
|
@@ -3649,7 +3595,8 @@ export const elapsed: Schedule<Duration.Duration> = fromStepWithMetadata(
|
|
|
3649
3595
|
* repetitions, given by `base * factor.pow(n)`, where `n` is the number of
|
|
3650
3596
|
* repetitions so far. Returns the current duration between recurrences.
|
|
3651
3597
|
*
|
|
3652
|
-
*
|
|
3598
|
+
* **Example** (Retrying with exponential backoff)
|
|
3599
|
+
*
|
|
3653
3600
|
* ```ts
|
|
3654
3601
|
* import { Console, Data, Effect, Schedule } from "effect"
|
|
3655
3602
|
*
|
|
@@ -3689,8 +3636,8 @@ export const elapsed: Schedule<Duration.Duration> = fromStepWithMetadata(
|
|
|
3689
3636
|
* // Will retry with delays: 50ms, 100ms, 200ms before success
|
|
3690
3637
|
* ```
|
|
3691
3638
|
*
|
|
3692
|
-
* @since 2.0.0
|
|
3693
3639
|
* @category constructors
|
|
3640
|
+
* @since 2.0.0
|
|
3694
3641
|
*/
|
|
3695
3642
|
export const exponential = (
|
|
3696
3643
|
base: Duration.Input,
|
|
@@ -3708,7 +3655,8 @@ export const exponential = (
|
|
|
3708
3655
|
* two delays (similar to the fibonacci sequence). Returns the current
|
|
3709
3656
|
* duration between recurrences.
|
|
3710
3657
|
*
|
|
3711
|
-
*
|
|
3658
|
+
* **Example** (Retrying with fibonacci backoff)
|
|
3659
|
+
*
|
|
3712
3660
|
* ```ts
|
|
3713
3661
|
* import { Console, Data, Effect, Schedule } from "effect"
|
|
3714
3662
|
*
|
|
@@ -3744,7 +3692,7 @@ export const exponential = (
|
|
|
3744
3692
|
*
|
|
3745
3693
|
* // Heartbeat with fibonacci intervals (starts fast, gets slower)
|
|
3746
3694
|
* const adaptiveHeartbeat = Effect.gen(function*() {
|
|
3747
|
-
* yield* Console.log(
|
|
3695
|
+
* yield* Console.log("Heartbeat")
|
|
3748
3696
|
* return "pulse"
|
|
3749
3697
|
* }).pipe(
|
|
3750
3698
|
* Effect.repeat(
|
|
@@ -3766,8 +3714,8 @@ export const exponential = (
|
|
|
3766
3714
|
* })
|
|
3767
3715
|
* ```
|
|
3768
3716
|
*
|
|
3769
|
-
* @since 2.0.0
|
|
3770
3717
|
* @category constructors
|
|
3718
|
+
* @since 2.0.0
|
|
3771
3719
|
*/
|
|
3772
3720
|
export const fibonacci = (one: Duration.Input): Schedule<Duration.Duration> => {
|
|
3773
3721
|
const oneMillis = Duration.toMillis(Duration.fromInputUnsafe(one))
|
|
@@ -3796,7 +3744,8 @@ export const fibonacci = (one: Duration.Input): Schedule<Duration.Duration> => {
|
|
|
3796
3744
|
* |---------action--------||action|-----|action|-----------|
|
|
3797
3745
|
* ```
|
|
3798
3746
|
*
|
|
3799
|
-
*
|
|
3747
|
+
* **Example** (Repeating on fixed intervals)
|
|
3748
|
+
*
|
|
3800
3749
|
* ```ts
|
|
3801
3750
|
* import { Console, Effect, Schedule } from "effect"
|
|
3802
3751
|
*
|
|
@@ -3805,7 +3754,7 @@ export const fibonacci = (one: Duration.Input): Schedule<Duration.Duration> => {
|
|
|
3805
3754
|
*
|
|
3806
3755
|
* // Health check that runs at fixed intervals
|
|
3807
3756
|
* const healthCheck = Effect.gen(function*() {
|
|
3808
|
-
* yield* Console.log(
|
|
3757
|
+
* yield* Console.log("Health check")
|
|
3809
3758
|
* yield* Effect.sleep("200 millis") // simulate health check work
|
|
3810
3759
|
* return "healthy"
|
|
3811
3760
|
* }).pipe(
|
|
@@ -3843,8 +3792,8 @@ export const fibonacci = (one: Duration.Input): Schedule<Duration.Duration> => {
|
|
|
3843
3792
|
* })
|
|
3844
3793
|
* ```
|
|
3845
3794
|
*
|
|
3846
|
-
* @since 2.0.0
|
|
3847
3795
|
* @category constructors
|
|
3796
|
+
* @since 2.0.0
|
|
3848
3797
|
*/
|
|
3849
3798
|
export const fixed = (interval: Duration.Input): Schedule<number> => {
|
|
3850
3799
|
const window = Duration.toMillis(Duration.fromInputUnsafe(interval))
|
|
@@ -3874,7 +3823,8 @@ export const fixed = (interval: Duration.Input): Schedule<number> => {
|
|
|
3874
3823
|
* Returns a new `Schedule` that maps the output of this schedule using the
|
|
3875
3824
|
* specified function.
|
|
3876
3825
|
*
|
|
3877
|
-
*
|
|
3826
|
+
* **Example** (Mapping schedule outputs)
|
|
3827
|
+
*
|
|
3878
3828
|
* ```ts
|
|
3879
3829
|
* import { Console, Effect, Schedule } from "effect"
|
|
3880
3830
|
*
|
|
@@ -3892,7 +3842,6 @@ export const fixed = (interval: Duration.Input): Schedule<number> => {
|
|
|
3892
3842
|
* const structuredSchedule = Schedule.spaced("1 second").pipe(
|
|
3893
3843
|
* Schedule.map((recurrence) => Effect.succeed({
|
|
3894
3844
|
* iteration: recurrence + 1,
|
|
3895
|
-
* timestamp: new Date().toISOString(),
|
|
3896
3845
|
* phase: recurrence < 5 ? "warmup" as const : "steady" as const
|
|
3897
3846
|
* }))
|
|
3898
3847
|
* )
|
|
@@ -3904,7 +3853,7 @@ export const fixed = (interval: Duration.Input): Schedule<number> => {
|
|
|
3904
3853
|
* Schedule.take(8),
|
|
3905
3854
|
* Schedule.tapOutput((info) =>
|
|
3906
3855
|
* Console.log(
|
|
3907
|
-
* `${info.phase} phase - iteration ${info.iteration}
|
|
3856
|
+
* `${info.phase} phase - iteration ${info.iteration}`
|
|
3908
3857
|
* )
|
|
3909
3858
|
* )
|
|
3910
3859
|
* )
|
|
@@ -3929,15 +3878,16 @@ export const fixed = (interval: Duration.Input): Schedule<number> => {
|
|
|
3929
3878
|
* )
|
|
3930
3879
|
* ```
|
|
3931
3880
|
*
|
|
3932
|
-
* @since 2.0.0
|
|
3933
3881
|
* @category mapping
|
|
3882
|
+
* @since 2.0.0
|
|
3934
3883
|
*/
|
|
3935
3884
|
export const map: {
|
|
3936
3885
|
/**
|
|
3937
3886
|
* Returns a new `Schedule` that maps the output of this schedule using the
|
|
3938
3887
|
* specified function.
|
|
3939
3888
|
*
|
|
3940
|
-
*
|
|
3889
|
+
* **Example** (Mapping schedule outputs)
|
|
3890
|
+
*
|
|
3941
3891
|
* ```ts
|
|
3942
3892
|
* import { Console, Effect, Schedule } from "effect"
|
|
3943
3893
|
*
|
|
@@ -3955,7 +3905,6 @@ export const map: {
|
|
|
3955
3905
|
* const structuredSchedule = Schedule.spaced("1 second").pipe(
|
|
3956
3906
|
* Schedule.map((recurrence) => Effect.succeed({
|
|
3957
3907
|
* iteration: recurrence + 1,
|
|
3958
|
-
* timestamp: new Date().toISOString(),
|
|
3959
3908
|
* phase: recurrence < 5 ? "warmup" as const : "steady" as const
|
|
3960
3909
|
* }))
|
|
3961
3910
|
* )
|
|
@@ -3967,7 +3916,7 @@ export const map: {
|
|
|
3967
3916
|
* Schedule.take(8),
|
|
3968
3917
|
* Schedule.tapOutput((info) =>
|
|
3969
3918
|
* Console.log(
|
|
3970
|
-
* `${info.phase} phase - iteration ${info.iteration}
|
|
3919
|
+
* `${info.phase} phase - iteration ${info.iteration}`
|
|
3971
3920
|
* )
|
|
3972
3921
|
* )
|
|
3973
3922
|
* )
|
|
@@ -3992,8 +3941,8 @@ export const map: {
|
|
|
3992
3941
|
* )
|
|
3993
3942
|
* ```
|
|
3994
3943
|
*
|
|
3995
|
-
* @since 2.0.0
|
|
3996
3944
|
* @category mapping
|
|
3945
|
+
* @since 2.0.0
|
|
3997
3946
|
*/
|
|
3998
3947
|
<Output, Output2, Error2 = never, Env2 = never>(f: (output: Output) => Output2 | Effect<Output2, Error2, Env2>): <Input, Error, Env>(
|
|
3999
3948
|
self: Schedule<Output, Input, Error, Env>
|
|
@@ -4002,7 +3951,8 @@ export const map: {
|
|
|
4002
3951
|
* Returns a new `Schedule` that maps the output of this schedule using the
|
|
4003
3952
|
* specified function.
|
|
4004
3953
|
*
|
|
4005
|
-
*
|
|
3954
|
+
* **Example** (Mapping schedule outputs)
|
|
3955
|
+
*
|
|
4006
3956
|
* ```ts
|
|
4007
3957
|
* import { Console, Effect, Schedule } from "effect"
|
|
4008
3958
|
*
|
|
@@ -4020,7 +3970,6 @@ export const map: {
|
|
|
4020
3970
|
* const structuredSchedule = Schedule.spaced("1 second").pipe(
|
|
4021
3971
|
* Schedule.map((recurrence) => Effect.succeed({
|
|
4022
3972
|
* iteration: recurrence + 1,
|
|
4023
|
-
* timestamp: new Date().toISOString(),
|
|
4024
3973
|
* phase: recurrence < 5 ? "warmup" as const : "steady" as const
|
|
4025
3974
|
* }))
|
|
4026
3975
|
* )
|
|
@@ -4032,7 +3981,7 @@ export const map: {
|
|
|
4032
3981
|
* Schedule.take(8),
|
|
4033
3982
|
* Schedule.tapOutput((info) =>
|
|
4034
3983
|
* Console.log(
|
|
4035
|
-
* `${info.phase} phase - iteration ${info.iteration}
|
|
3984
|
+
* `${info.phase} phase - iteration ${info.iteration}`
|
|
4036
3985
|
* )
|
|
4037
3986
|
* )
|
|
4038
3987
|
* )
|
|
@@ -4057,8 +4006,8 @@ export const map: {
|
|
|
4057
4006
|
* )
|
|
4058
4007
|
* ```
|
|
4059
4008
|
*
|
|
4060
|
-
* @since 2.0.0
|
|
4061
4009
|
* @category mapping
|
|
4010
|
+
* @since 2.0.0
|
|
4062
4011
|
*/
|
|
4063
4012
|
<Output, Input, Error, Env, Output2, Error2 = never, Env2 = never>(
|
|
4064
4013
|
self: Schedule<Output, Input, Error, Env>,
|
|
@@ -4088,7 +4037,8 @@ export const map: {
|
|
|
4088
4037
|
* Returns a new `Schedule` that modifies the delay of the next recurrence
|
|
4089
4038
|
* of the schedule using the specified effectual function.
|
|
4090
4039
|
*
|
|
4091
|
-
*
|
|
4040
|
+
* **Example** (Modifying delays from schedule output)
|
|
4041
|
+
*
|
|
4092
4042
|
* ```ts
|
|
4093
4043
|
* import { Console, Duration, Effect, Schedule } from "effect"
|
|
4094
4044
|
*
|
|
@@ -4113,15 +4063,16 @@ export const map: {
|
|
|
4113
4063
|
* })
|
|
4114
4064
|
* ```
|
|
4115
4065
|
*
|
|
4116
|
-
* @since 2.0.0
|
|
4117
4066
|
* @category utilities
|
|
4067
|
+
* @since 2.0.0
|
|
4118
4068
|
*/
|
|
4119
4069
|
export const modifyDelay: {
|
|
4120
4070
|
/**
|
|
4121
4071
|
* Returns a new `Schedule` that modifies the delay of the next recurrence
|
|
4122
4072
|
* of the schedule using the specified effectual function.
|
|
4123
4073
|
*
|
|
4124
|
-
*
|
|
4074
|
+
* **Example** (Modifying delays from schedule output)
|
|
4075
|
+
*
|
|
4125
4076
|
* ```ts
|
|
4126
4077
|
* import { Console, Duration, Effect, Schedule } from "effect"
|
|
4127
4078
|
*
|
|
@@ -4146,8 +4097,8 @@ export const modifyDelay: {
|
|
|
4146
4097
|
* })
|
|
4147
4098
|
* ```
|
|
4148
4099
|
*
|
|
4149
|
-
* @since 2.0.0
|
|
4150
4100
|
* @category utilities
|
|
4101
|
+
* @since 2.0.0
|
|
4151
4102
|
*/
|
|
4152
4103
|
<Output, Error2 = never, Env2 = never>(
|
|
4153
4104
|
f: (
|
|
@@ -4161,7 +4112,8 @@ export const modifyDelay: {
|
|
|
4161
4112
|
* Returns a new `Schedule` that modifies the delay of the next recurrence
|
|
4162
4113
|
* of the schedule using the specified effectual function.
|
|
4163
4114
|
*
|
|
4164
|
-
*
|
|
4115
|
+
* **Example** (Modifying delays from schedule output)
|
|
4116
|
+
*
|
|
4165
4117
|
* ```ts
|
|
4166
4118
|
* import { Console, Duration, Effect, Schedule } from "effect"
|
|
4167
4119
|
*
|
|
@@ -4186,8 +4138,8 @@ export const modifyDelay: {
|
|
|
4186
4138
|
* })
|
|
4187
4139
|
* ```
|
|
4188
4140
|
*
|
|
4189
|
-
* @since 2.0.0
|
|
4190
4141
|
* @category utilities
|
|
4142
|
+
* @since 2.0.0
|
|
4191
4143
|
*/
|
|
4192
4144
|
<Output, Input, Error, Env, Error2 = never, Env2 = never>(
|
|
4193
4145
|
self: Schedule<Output, Input, Error, Env>,
|
|
@@ -4214,8 +4166,8 @@ export const modifyDelay: {
|
|
|
4214
4166
|
*
|
|
4215
4167
|
* Delays are jittered between `80%` and `120%` of the original delay.
|
|
4216
4168
|
*
|
|
4217
|
-
* @since 2.0.0
|
|
4218
4169
|
* @category utilities
|
|
4170
|
+
* @since 2.0.0
|
|
4219
4171
|
*/
|
|
4220
4172
|
export const jittered = <Output, Input, Error, Env>(
|
|
4221
4173
|
self: Schedule<Output, Input, Error, Env>
|
|
@@ -4229,7 +4181,8 @@ export const jittered = <Output, Input, Error, Env>(
|
|
|
4229
4181
|
/**
|
|
4230
4182
|
* Returns a new `Schedule` that outputs the inputs of the specified schedule.
|
|
4231
4183
|
*
|
|
4232
|
-
*
|
|
4184
|
+
* **Example** (Passing inputs through as outputs)
|
|
4185
|
+
*
|
|
4233
4186
|
* ```ts
|
|
4234
4187
|
* import { Console, Effect, Schedule } from "effect"
|
|
4235
4188
|
*
|
|
@@ -4251,8 +4204,8 @@ export const jittered = <Output, Input, Error, Env>(
|
|
|
4251
4204
|
* })
|
|
4252
4205
|
* ```
|
|
4253
4206
|
*
|
|
4254
|
-
* @since 2.0.0
|
|
4255
4207
|
* @category utilities
|
|
4208
|
+
* @since 2.0.0
|
|
4256
4209
|
*/
|
|
4257
4210
|
export const passthrough = <Output, Input, Error, Env>(
|
|
4258
4211
|
self: Schedule<Output, Input, Error, Env>
|
|
@@ -4268,7 +4221,8 @@ export const passthrough = <Output, Input, Error, Env>(
|
|
|
4268
4221
|
* Returns a `Schedule` which can only be stepped the specified number of
|
|
4269
4222
|
* `times` before it terminates.
|
|
4270
4223
|
*
|
|
4271
|
-
*
|
|
4224
|
+
* **Example** (Limiting recurrences)
|
|
4225
|
+
*
|
|
4272
4226
|
* ```ts
|
|
4273
4227
|
* import { Console, Data, Effect, Schedule } from "effect"
|
|
4274
4228
|
*
|
|
@@ -4306,7 +4260,7 @@ export const passthrough = <Output, Input, Error, Env>(
|
|
|
4306
4260
|
* // Repeat an effect exactly 10 times
|
|
4307
4261
|
* const exactlyTenTimes = Effect.gen(function*() {
|
|
4308
4262
|
* yield* Console.log("Executing task...")
|
|
4309
|
-
* return
|
|
4263
|
+
* return "completed"
|
|
4310
4264
|
* }).pipe(
|
|
4311
4265
|
* Effect.repeat(Schedule.recurs(10))
|
|
4312
4266
|
* )
|
|
@@ -4328,7 +4282,8 @@ export const recurs = (times: number): Schedule<number> =>
|
|
|
4328
4282
|
* using the specified effectful `combine` function and starting from the
|
|
4329
4283
|
* specified `initial` state.
|
|
4330
4284
|
*
|
|
4331
|
-
*
|
|
4285
|
+
* **Example** (Reducing schedule outputs)
|
|
4286
|
+
*
|
|
4332
4287
|
* ```ts
|
|
4333
4288
|
* import { Console, Effect, Schedule } from "effect"
|
|
4334
4289
|
*
|
|
@@ -4353,24 +4308,24 @@ export const recurs = (times: number): Schedule<number> =>
|
|
|
4353
4308
|
* yield* Console.log(`Final sum: ${finalSum}`)
|
|
4354
4309
|
* })
|
|
4355
4310
|
*
|
|
4356
|
-
* // Build a history of execution
|
|
4311
|
+
* // Build a history of execution counts
|
|
4357
4312
|
* const historySchedule = Schedule.reduce(
|
|
4358
4313
|
* Schedule.spaced("1 second").pipe(Schedule.take(4)),
|
|
4359
4314
|
* () => [] as Array<number>, // Initial empty array
|
|
4360
|
-
* (history, executionNumber) => Effect.succeed([...history,
|
|
4315
|
+
* (history, executionNumber) => Effect.succeed([...history, executionNumber])
|
|
4361
4316
|
* )
|
|
4362
4317
|
*
|
|
4363
4318
|
* const historyProgram = Effect.gen(function*() {
|
|
4364
4319
|
* const timeline = yield* Effect.repeat(
|
|
4365
4320
|
* Effect.gen(function*() {
|
|
4366
|
-
* yield* Console.log("Recording
|
|
4321
|
+
* yield* Console.log("Recording execution...")
|
|
4367
4322
|
* return "recorded"
|
|
4368
4323
|
* }),
|
|
4369
4324
|
* historySchedule
|
|
4370
4325
|
* )
|
|
4371
4326
|
*
|
|
4372
4327
|
* yield* Console.log(
|
|
4373
|
-
* `Execution timeline: ${timeline.
|
|
4328
|
+
* `Execution timeline: ${timeline.join(", ")}`
|
|
4374
4329
|
* )
|
|
4375
4330
|
* })
|
|
4376
4331
|
*
|
|
@@ -4431,8 +4386,8 @@ export const recurs = (times: number): Schedule<number> =>
|
|
|
4431
4386
|
* })
|
|
4432
4387
|
* ```
|
|
4433
4388
|
*
|
|
4434
|
-
* @since 2.0.0
|
|
4435
4389
|
* @category utilities
|
|
4390
|
+
* @since 2.0.0
|
|
4436
4391
|
*/
|
|
4437
4392
|
export const reduce: {
|
|
4438
4393
|
/**
|
|
@@ -4440,7 +4395,8 @@ export const reduce: {
|
|
|
4440
4395
|
* using the specified effectful `combine` function and starting from the
|
|
4441
4396
|
* specified `initial` state.
|
|
4442
4397
|
*
|
|
4443
|
-
*
|
|
4398
|
+
* **Example** (Reducing schedule outputs)
|
|
4399
|
+
*
|
|
4444
4400
|
* ```ts
|
|
4445
4401
|
* import { Console, Effect, Schedule } from "effect"
|
|
4446
4402
|
*
|
|
@@ -4465,24 +4421,24 @@ export const reduce: {
|
|
|
4465
4421
|
* yield* Console.log(`Final sum: ${finalSum}`)
|
|
4466
4422
|
* })
|
|
4467
4423
|
*
|
|
4468
|
-
* // Build a history of execution
|
|
4424
|
+
* // Build a history of execution counts
|
|
4469
4425
|
* const historySchedule = Schedule.reduce(
|
|
4470
4426
|
* Schedule.spaced("1 second").pipe(Schedule.take(4)),
|
|
4471
4427
|
* () => [] as Array<number>, // Initial empty array
|
|
4472
|
-
* (history, executionNumber) => Effect.succeed([...history,
|
|
4428
|
+
* (history, executionNumber) => Effect.succeed([...history, executionNumber])
|
|
4473
4429
|
* )
|
|
4474
4430
|
*
|
|
4475
4431
|
* const historyProgram = Effect.gen(function*() {
|
|
4476
4432
|
* const timeline = yield* Effect.repeat(
|
|
4477
4433
|
* Effect.gen(function*() {
|
|
4478
|
-
* yield* Console.log("Recording
|
|
4434
|
+
* yield* Console.log("Recording execution...")
|
|
4479
4435
|
* return "recorded"
|
|
4480
4436
|
* }),
|
|
4481
4437
|
* historySchedule
|
|
4482
4438
|
* )
|
|
4483
4439
|
*
|
|
4484
4440
|
* yield* Console.log(
|
|
4485
|
-
* `Execution timeline: ${timeline.
|
|
4441
|
+
* `Execution timeline: ${timeline.join(", ")}`
|
|
4486
4442
|
* )
|
|
4487
4443
|
* })
|
|
4488
4444
|
*
|
|
@@ -4543,8 +4499,8 @@ export const reduce: {
|
|
|
4543
4499
|
* })
|
|
4544
4500
|
* ```
|
|
4545
4501
|
*
|
|
4546
|
-
* @since 2.0.0
|
|
4547
4502
|
* @category utilities
|
|
4503
|
+
* @since 2.0.0
|
|
4548
4504
|
*/
|
|
4549
4505
|
<State, Output, Error2 = never, Env2 = never>(
|
|
4550
4506
|
initial: LazyArg<State>,
|
|
@@ -4557,7 +4513,8 @@ export const reduce: {
|
|
|
4557
4513
|
* using the specified effectful `combine` function and starting from the
|
|
4558
4514
|
* specified `initial` state.
|
|
4559
4515
|
*
|
|
4560
|
-
*
|
|
4516
|
+
* **Example** (Reducing schedule outputs)
|
|
4517
|
+
*
|
|
4561
4518
|
* ```ts
|
|
4562
4519
|
* import { Console, Effect, Schedule } from "effect"
|
|
4563
4520
|
*
|
|
@@ -4582,24 +4539,24 @@ export const reduce: {
|
|
|
4582
4539
|
* yield* Console.log(`Final sum: ${finalSum}`)
|
|
4583
4540
|
* })
|
|
4584
4541
|
*
|
|
4585
|
-
* // Build a history of execution
|
|
4542
|
+
* // Build a history of execution counts
|
|
4586
4543
|
* const historySchedule = Schedule.reduce(
|
|
4587
4544
|
* Schedule.spaced("1 second").pipe(Schedule.take(4)),
|
|
4588
4545
|
* () => [] as Array<number>, // Initial empty array
|
|
4589
|
-
* (history, executionNumber) => Effect.succeed([...history,
|
|
4546
|
+
* (history, executionNumber) => Effect.succeed([...history, executionNumber])
|
|
4590
4547
|
* )
|
|
4591
4548
|
*
|
|
4592
4549
|
* const historyProgram = Effect.gen(function*() {
|
|
4593
4550
|
* const timeline = yield* Effect.repeat(
|
|
4594
4551
|
* Effect.gen(function*() {
|
|
4595
|
-
* yield* Console.log("Recording
|
|
4552
|
+
* yield* Console.log("Recording execution...")
|
|
4596
4553
|
* return "recorded"
|
|
4597
4554
|
* }),
|
|
4598
4555
|
* historySchedule
|
|
4599
4556
|
* )
|
|
4600
4557
|
*
|
|
4601
4558
|
* yield* Console.log(
|
|
4602
|
-
* `Execution timeline: ${timeline.
|
|
4559
|
+
* `Execution timeline: ${timeline.join(", ")}`
|
|
4603
4560
|
* )
|
|
4604
4561
|
* })
|
|
4605
4562
|
*
|
|
@@ -4660,8 +4617,8 @@ export const reduce: {
|
|
|
4660
4617
|
* })
|
|
4661
4618
|
* ```
|
|
4662
4619
|
*
|
|
4663
|
-
* @since 2.0.0
|
|
4664
4620
|
* @category utilities
|
|
4621
|
+
* @since 2.0.0
|
|
4665
4622
|
*/
|
|
4666
4623
|
<Output, Input, Error, Env, State, Error2 = never, Env2 = never>(
|
|
4667
4624
|
self: Schedule<Output, Input, Error, Env>,
|
|
@@ -4700,7 +4657,8 @@ export const reduce: {
|
|
|
4700
4657
|
* Returns a schedule that recurs continuously, each repetition spaced the
|
|
4701
4658
|
* specified duration from the last run.
|
|
4702
4659
|
*
|
|
4703
|
-
*
|
|
4660
|
+
* **Example** (Repeating with fixed spacing)
|
|
4661
|
+
*
|
|
4704
4662
|
* ```ts
|
|
4705
4663
|
* import { Console, Effect, Schedule } from "effect"
|
|
4706
4664
|
*
|
|
@@ -4709,7 +4667,7 @@ export const reduce: {
|
|
|
4709
4667
|
*
|
|
4710
4668
|
* // Heartbeat that runs indefinitely with fixed spacing
|
|
4711
4669
|
* const heartbeat = Effect.gen(function*() {
|
|
4712
|
-
* yield* Console.log(
|
|
4670
|
+
* yield* Console.log("Heartbeat")
|
|
4713
4671
|
* }).pipe(
|
|
4714
4672
|
* Effect.repeat(everyTwoSeconds)
|
|
4715
4673
|
* )
|
|
@@ -4742,8 +4700,8 @@ export const reduce: {
|
|
|
4742
4700
|
* })
|
|
4743
4701
|
* ```
|
|
4744
4702
|
*
|
|
4745
|
-
* @since 2.0.0
|
|
4746
4703
|
* @category constructors
|
|
4704
|
+
* @since 2.0.0
|
|
4747
4705
|
*/
|
|
4748
4706
|
export const spaced = (duration: Duration.Input): Schedule<number> => {
|
|
4749
4707
|
const decoded = Duration.fromInputUnsafe(duration)
|
|
@@ -4755,7 +4713,8 @@ export const spaced = (duration: Duration.Input): Schedule<number> => {
|
|
|
4755
4713
|
* every input to the schedule, but does not alter the inputs and outputs of
|
|
4756
4714
|
* the schedule.
|
|
4757
4715
|
*
|
|
4758
|
-
*
|
|
4716
|
+
* **Example** (Tapping retry inputs)
|
|
4717
|
+
*
|
|
4759
4718
|
* ```ts
|
|
4760
4719
|
* import { Console, Data, Effect, Schedule } from "effect"
|
|
4761
4720
|
*
|
|
@@ -4791,7 +4750,6 @@ export const spaced = (duration: Duration.Input): Schedule<number> => {
|
|
|
4791
4750
|
* Schedule.take(5),
|
|
4792
4751
|
* Schedule.tapInput((input: unknown) =>
|
|
4793
4752
|
* Effect.gen(function*() {
|
|
4794
|
-
* yield* Console.log(`Processing input at ${new Date().toISOString()}`)
|
|
4795
4753
|
* yield* Console.log(`Input type: ${typeof input}`)
|
|
4796
4754
|
* // In real applications, might send metrics to monitoring system
|
|
4797
4755
|
* })
|
|
@@ -4813,10 +4771,13 @@ export const spaced = (duration: Duration.Input): Schedule<number> => {
|
|
|
4813
4771
|
* )
|
|
4814
4772
|
*
|
|
4815
4773
|
* const validationProgram = Effect.gen(function*() {
|
|
4774
|
+
* let count = 0
|
|
4775
|
+
*
|
|
4816
4776
|
* yield* Effect.repeat(
|
|
4817
4777
|
* Effect.gen(function*() {
|
|
4778
|
+
* count++
|
|
4818
4779
|
* yield* Console.log("Task with validation")
|
|
4819
|
-
* return { data:
|
|
4780
|
+
* return { data: `sample-${count}` }
|
|
4820
4781
|
* }),
|
|
4821
4782
|
* validatingSchedule
|
|
4822
4783
|
* )
|
|
@@ -4828,10 +4789,10 @@ export const spaced = (duration: Duration.Input): Schedule<number> => {
|
|
|
4828
4789
|
* Schedule.tapInput((error: RetryError) =>
|
|
4829
4790
|
* Effect.gen(function*() {
|
|
4830
4791
|
* if (String(error).includes("critical")) {
|
|
4831
|
-
* yield* Console.log(
|
|
4792
|
+
* yield* Console.log(`Critical error: ${String(error)}`)
|
|
4832
4793
|
* // In real applications, might trigger alerts or notifications
|
|
4833
4794
|
* } else {
|
|
4834
|
-
* yield* Console.log(
|
|
4795
|
+
* yield* Console.log(`Regular error: ${String(error)}`)
|
|
4835
4796
|
* }
|
|
4836
4797
|
* })
|
|
4837
4798
|
* )
|
|
@@ -4865,14 +4826,14 @@ export const spaced = (duration: Duration.Input): Schedule<number> => {
|
|
|
4865
4826
|
* ),
|
|
4866
4827
|
* Schedule.tapInput((error: RetryError) =>
|
|
4867
4828
|
* String(error).length > 20
|
|
4868
|
-
* ? Console.log("
|
|
4829
|
+
* ? Console.log("Long error message detected")
|
|
4869
4830
|
* : Effect.void
|
|
4870
4831
|
* )
|
|
4871
4832
|
* )
|
|
4872
4833
|
* ```
|
|
4873
4834
|
*
|
|
4874
|
-
* @since 2.0.0
|
|
4875
4835
|
* @category sequencing
|
|
4836
|
+
* @since 2.0.0
|
|
4876
4837
|
*/
|
|
4877
4838
|
export const tapInput: {
|
|
4878
4839
|
/**
|
|
@@ -4880,7 +4841,8 @@ export const tapInput: {
|
|
|
4880
4841
|
* every input to the schedule, but does not alter the inputs and outputs of
|
|
4881
4842
|
* the schedule.
|
|
4882
4843
|
*
|
|
4883
|
-
*
|
|
4844
|
+
* **Example** (Tapping retry inputs)
|
|
4845
|
+
*
|
|
4884
4846
|
* ```ts
|
|
4885
4847
|
* import { Console, Data, Effect, Schedule } from "effect"
|
|
4886
4848
|
*
|
|
@@ -4916,7 +4878,6 @@ export const tapInput: {
|
|
|
4916
4878
|
* Schedule.take(5),
|
|
4917
4879
|
* Schedule.tapInput((input: unknown) =>
|
|
4918
4880
|
* Effect.gen(function*() {
|
|
4919
|
-
* yield* Console.log(`Processing input at ${new Date().toISOString()}`)
|
|
4920
4881
|
* yield* Console.log(`Input type: ${typeof input}`)
|
|
4921
4882
|
* // In real applications, might send metrics to monitoring system
|
|
4922
4883
|
* })
|
|
@@ -4938,10 +4899,13 @@ export const tapInput: {
|
|
|
4938
4899
|
* )
|
|
4939
4900
|
*
|
|
4940
4901
|
* const validationProgram = Effect.gen(function*() {
|
|
4902
|
+
* let count = 0
|
|
4903
|
+
*
|
|
4941
4904
|
* yield* Effect.repeat(
|
|
4942
4905
|
* Effect.gen(function*() {
|
|
4906
|
+
* count++
|
|
4943
4907
|
* yield* Console.log("Task with validation")
|
|
4944
|
-
* return { data:
|
|
4908
|
+
* return { data: `sample-${count}` }
|
|
4945
4909
|
* }),
|
|
4946
4910
|
* validatingSchedule
|
|
4947
4911
|
* )
|
|
@@ -4953,10 +4917,10 @@ export const tapInput: {
|
|
|
4953
4917
|
* Schedule.tapInput((error: RetryError) =>
|
|
4954
4918
|
* Effect.gen(function*() {
|
|
4955
4919
|
* if (String(error).includes("critical")) {
|
|
4956
|
-
* yield* Console.log(
|
|
4920
|
+
* yield* Console.log(`Critical error: ${String(error)}`)
|
|
4957
4921
|
* // In real applications, might trigger alerts or notifications
|
|
4958
4922
|
* } else {
|
|
4959
|
-
* yield* Console.log(
|
|
4923
|
+
* yield* Console.log(`Regular error: ${String(error)}`)
|
|
4960
4924
|
* }
|
|
4961
4925
|
* })
|
|
4962
4926
|
* )
|
|
@@ -4990,14 +4954,14 @@ export const tapInput: {
|
|
|
4990
4954
|
* ),
|
|
4991
4955
|
* Schedule.tapInput((error: RetryError) =>
|
|
4992
4956
|
* String(error).length > 20
|
|
4993
|
-
* ? Console.log("
|
|
4957
|
+
* ? Console.log("Long error message detected")
|
|
4994
4958
|
* : Effect.void
|
|
4995
4959
|
* )
|
|
4996
4960
|
* )
|
|
4997
4961
|
* ```
|
|
4998
4962
|
*
|
|
4999
|
-
* @since 2.0.0
|
|
5000
4963
|
* @category sequencing
|
|
4964
|
+
* @since 2.0.0
|
|
5001
4965
|
*/
|
|
5002
4966
|
<Input, X, Error2, Env2>(f: (input: Input) => Effect<X, Error2, Env2>): <Output, Error, Env>(
|
|
5003
4967
|
self: Schedule<Output, Input, Error, Env>
|
|
@@ -5007,7 +4971,8 @@ export const tapInput: {
|
|
|
5007
4971
|
* every input to the schedule, but does not alter the inputs and outputs of
|
|
5008
4972
|
* the schedule.
|
|
5009
4973
|
*
|
|
5010
|
-
*
|
|
4974
|
+
* **Example** (Tapping retry inputs)
|
|
4975
|
+
*
|
|
5011
4976
|
* ```ts
|
|
5012
4977
|
* import { Console, Data, Effect, Schedule } from "effect"
|
|
5013
4978
|
*
|
|
@@ -5043,7 +5008,6 @@ export const tapInput: {
|
|
|
5043
5008
|
* Schedule.take(5),
|
|
5044
5009
|
* Schedule.tapInput((input: unknown) =>
|
|
5045
5010
|
* Effect.gen(function*() {
|
|
5046
|
-
* yield* Console.log(`Processing input at ${new Date().toISOString()}`)
|
|
5047
5011
|
* yield* Console.log(`Input type: ${typeof input}`)
|
|
5048
5012
|
* // In real applications, might send metrics to monitoring system
|
|
5049
5013
|
* })
|
|
@@ -5065,10 +5029,13 @@ export const tapInput: {
|
|
|
5065
5029
|
* )
|
|
5066
5030
|
*
|
|
5067
5031
|
* const validationProgram = Effect.gen(function*() {
|
|
5032
|
+
* let count = 0
|
|
5033
|
+
*
|
|
5068
5034
|
* yield* Effect.repeat(
|
|
5069
5035
|
* Effect.gen(function*() {
|
|
5036
|
+
* count++
|
|
5070
5037
|
* yield* Console.log("Task with validation")
|
|
5071
|
-
* return { data:
|
|
5038
|
+
* return { data: `sample-${count}` }
|
|
5072
5039
|
* }),
|
|
5073
5040
|
* validatingSchedule
|
|
5074
5041
|
* )
|
|
@@ -5080,10 +5047,10 @@ export const tapInput: {
|
|
|
5080
5047
|
* Schedule.tapInput((error: RetryError) =>
|
|
5081
5048
|
* Effect.gen(function*() {
|
|
5082
5049
|
* if (String(error).includes("critical")) {
|
|
5083
|
-
* yield* Console.log(
|
|
5050
|
+
* yield* Console.log(`Critical error: ${String(error)}`)
|
|
5084
5051
|
* // In real applications, might trigger alerts or notifications
|
|
5085
5052
|
* } else {
|
|
5086
|
-
* yield* Console.log(
|
|
5053
|
+
* yield* Console.log(`Regular error: ${String(error)}`)
|
|
5087
5054
|
* }
|
|
5088
5055
|
* })
|
|
5089
5056
|
* )
|
|
@@ -5117,14 +5084,14 @@ export const tapInput: {
|
|
|
5117
5084
|
* ),
|
|
5118
5085
|
* Schedule.tapInput((error: RetryError) =>
|
|
5119
5086
|
* String(error).length > 20
|
|
5120
|
-
* ? Console.log("
|
|
5087
|
+
* ? Console.log("Long error message detected")
|
|
5121
5088
|
* : Effect.void
|
|
5122
5089
|
* )
|
|
5123
5090
|
* )
|
|
5124
5091
|
* ```
|
|
5125
5092
|
*
|
|
5126
|
-
* @since 2.0.0
|
|
5127
5093
|
* @category sequencing
|
|
5094
|
+
* @since 2.0.0
|
|
5128
5095
|
*/
|
|
5129
5096
|
<Output, Input, Error, Env, X, Error2, Env2>(
|
|
5130
5097
|
self: Schedule<Output, Input, Error, Env>,
|
|
@@ -5144,7 +5111,8 @@ export const tapInput: {
|
|
|
5144
5111
|
* every output of the schedule, but does not alter the inputs and outputs of
|
|
5145
5112
|
* the schedule.
|
|
5146
5113
|
*
|
|
5147
|
-
*
|
|
5114
|
+
* **Example** (Tapping schedule outputs)
|
|
5115
|
+
*
|
|
5148
5116
|
* ```ts
|
|
5149
5117
|
* import { Console, Data, Effect, Schedule } from "effect"
|
|
5150
5118
|
*
|
|
@@ -5192,7 +5160,7 @@ export const tapInput: {
|
|
|
5192
5160
|
* Effect.gen(function*() {
|
|
5193
5161
|
* const delayMs = delay.toString()
|
|
5194
5162
|
* if (delayMs.includes("1000")) { // Alert on delays >= 1 second
|
|
5195
|
-
* yield* Console.log(
|
|
5163
|
+
* yield* Console.log(`High delay detected: ${delay}`)
|
|
5196
5164
|
* }
|
|
5197
5165
|
* })
|
|
5198
5166
|
* )
|
|
@@ -5202,8 +5170,7 @@ export const tapInput: {
|
|
|
5202
5170
|
* yield* Effect.repeat(
|
|
5203
5171
|
* Effect.gen(function*() {
|
|
5204
5172
|
* yield* Console.log("Performing health check...")
|
|
5205
|
-
*
|
|
5206
|
-
* return Math.random() > 0.7 ? "healthy" : "degraded"
|
|
5173
|
+
* return "healthy"
|
|
5207
5174
|
* }),
|
|
5208
5175
|
* alertingSchedule
|
|
5209
5176
|
* )
|
|
@@ -5215,14 +5182,14 @@ export const tapInput: {
|
|
|
5215
5182
|
* Schedule.tapOutput((count) => Console.log(`Execution ${count + 1}`)),
|
|
5216
5183
|
* Schedule.tapOutput((count) =>
|
|
5217
5184
|
* count % 3 === 0
|
|
5218
|
-
* ? Console.log("
|
|
5185
|
+
* ? Console.log("Checkpoint reached")
|
|
5219
5186
|
* : Effect.void
|
|
5220
5187
|
* )
|
|
5221
5188
|
* )
|
|
5222
5189
|
* ```
|
|
5223
5190
|
*
|
|
5224
|
-
* @since 2.0.0
|
|
5225
5191
|
* @category sequencing
|
|
5192
|
+
* @since 2.0.0
|
|
5226
5193
|
*/
|
|
5227
5194
|
export const tapOutput: {
|
|
5228
5195
|
/**
|
|
@@ -5230,7 +5197,8 @@ export const tapOutput: {
|
|
|
5230
5197
|
* every output of the schedule, but does not alter the inputs and outputs of
|
|
5231
5198
|
* the schedule.
|
|
5232
5199
|
*
|
|
5233
|
-
*
|
|
5200
|
+
* **Example** (Tapping schedule outputs)
|
|
5201
|
+
*
|
|
5234
5202
|
* ```ts
|
|
5235
5203
|
* import { Console, Data, Effect, Schedule } from "effect"
|
|
5236
5204
|
*
|
|
@@ -5278,7 +5246,7 @@ export const tapOutput: {
|
|
|
5278
5246
|
* Effect.gen(function*() {
|
|
5279
5247
|
* const delayMs = delay.toString()
|
|
5280
5248
|
* if (delayMs.includes("1000")) { // Alert on delays >= 1 second
|
|
5281
|
-
* yield* Console.log(
|
|
5249
|
+
* yield* Console.log(`High delay detected: ${delay}`)
|
|
5282
5250
|
* }
|
|
5283
5251
|
* })
|
|
5284
5252
|
* )
|
|
@@ -5288,8 +5256,7 @@ export const tapOutput: {
|
|
|
5288
5256
|
* yield* Effect.repeat(
|
|
5289
5257
|
* Effect.gen(function*() {
|
|
5290
5258
|
* yield* Console.log("Performing health check...")
|
|
5291
|
-
*
|
|
5292
|
-
* return Math.random() > 0.7 ? "healthy" : "degraded"
|
|
5259
|
+
* return "healthy"
|
|
5293
5260
|
* }),
|
|
5294
5261
|
* alertingSchedule
|
|
5295
5262
|
* )
|
|
@@ -5301,14 +5268,14 @@ export const tapOutput: {
|
|
|
5301
5268
|
* Schedule.tapOutput((count) => Console.log(`Execution ${count + 1}`)),
|
|
5302
5269
|
* Schedule.tapOutput((count) =>
|
|
5303
5270
|
* count % 3 === 0
|
|
5304
|
-
* ? Console.log("
|
|
5271
|
+
* ? Console.log("Checkpoint reached")
|
|
5305
5272
|
* : Effect.void
|
|
5306
5273
|
* )
|
|
5307
5274
|
* )
|
|
5308
5275
|
* ```
|
|
5309
5276
|
*
|
|
5310
|
-
* @since 2.0.0
|
|
5311
5277
|
* @category sequencing
|
|
5278
|
+
* @since 2.0.0
|
|
5312
5279
|
*/
|
|
5313
5280
|
<Output, X, Error2, Env2>(f: (output: Output) => Effect<X, Error2, Env2>): <Input, Error, Env>(
|
|
5314
5281
|
self: Schedule<Output, Input, Error, Env>
|
|
@@ -5318,7 +5285,8 @@ export const tapOutput: {
|
|
|
5318
5285
|
* every output of the schedule, but does not alter the inputs and outputs of
|
|
5319
5286
|
* the schedule.
|
|
5320
5287
|
*
|
|
5321
|
-
*
|
|
5288
|
+
* **Example** (Tapping schedule outputs)
|
|
5289
|
+
*
|
|
5322
5290
|
* ```ts
|
|
5323
5291
|
* import { Console, Data, Effect, Schedule } from "effect"
|
|
5324
5292
|
*
|
|
@@ -5366,7 +5334,7 @@ export const tapOutput: {
|
|
|
5366
5334
|
* Effect.gen(function*() {
|
|
5367
5335
|
* const delayMs = delay.toString()
|
|
5368
5336
|
* if (delayMs.includes("1000")) { // Alert on delays >= 1 second
|
|
5369
|
-
* yield* Console.log(
|
|
5337
|
+
* yield* Console.log(`High delay detected: ${delay}`)
|
|
5370
5338
|
* }
|
|
5371
5339
|
* })
|
|
5372
5340
|
* )
|
|
@@ -5376,8 +5344,7 @@ export const tapOutput: {
|
|
|
5376
5344
|
* yield* Effect.repeat(
|
|
5377
5345
|
* Effect.gen(function*() {
|
|
5378
5346
|
* yield* Console.log("Performing health check...")
|
|
5379
|
-
*
|
|
5380
|
-
* return Math.random() > 0.7 ? "healthy" : "degraded"
|
|
5347
|
+
* return "healthy"
|
|
5381
5348
|
* }),
|
|
5382
5349
|
* alertingSchedule
|
|
5383
5350
|
* )
|
|
@@ -5389,14 +5356,14 @@ export const tapOutput: {
|
|
|
5389
5356
|
* Schedule.tapOutput((count) => Console.log(`Execution ${count + 1}`)),
|
|
5390
5357
|
* Schedule.tapOutput((count) =>
|
|
5391
5358
|
* count % 3 === 0
|
|
5392
|
-
* ? Console.log("
|
|
5359
|
+
* ? Console.log("Checkpoint reached")
|
|
5393
5360
|
* : Effect.void
|
|
5394
5361
|
* )
|
|
5395
5362
|
* )
|
|
5396
5363
|
* ```
|
|
5397
5364
|
*
|
|
5398
|
-
* @since 2.0.0
|
|
5399
5365
|
* @category sequencing
|
|
5366
|
+
* @since 2.0.0
|
|
5400
5367
|
*/
|
|
5401
5368
|
<Output, Input, Error, Env, X, Error2, Env2>(
|
|
5402
5369
|
self: Schedule<Output, Input, Error, Env>,
|
|
@@ -5416,7 +5383,8 @@ export const tapOutput: {
|
|
|
5416
5383
|
* from the schedule. Once the specified number of outputs is reached, the
|
|
5417
5384
|
* schedule will stop.
|
|
5418
5385
|
*
|
|
5419
|
-
*
|
|
5386
|
+
* **Example** (Taking a limited number of recurrences)
|
|
5387
|
+
*
|
|
5420
5388
|
* ```ts
|
|
5421
5389
|
* import { Console, Data, Effect, Schedule } from "effect"
|
|
5422
5390
|
*
|
|
@@ -5430,7 +5398,7 @@ export const tapOutput: {
|
|
|
5430
5398
|
* const heartbeatProgram = Effect.gen(function*() {
|
|
5431
5399
|
* yield* Effect.repeat(
|
|
5432
5400
|
* Effect.gen(function*() {
|
|
5433
|
-
* yield* Console.log(
|
|
5401
|
+
* yield* Console.log("Heartbeat")
|
|
5434
5402
|
* return "pulse"
|
|
5435
5403
|
* }),
|
|
5436
5404
|
* limitedHeartbeat
|
|
@@ -5477,8 +5445,8 @@ export const tapOutput: {
|
|
|
5477
5445
|
* const samplingProgram = Effect.gen(function*() {
|
|
5478
5446
|
* yield* Effect.repeat(
|
|
5479
5447
|
* Effect.gen(function*() {
|
|
5480
|
-
* const value =
|
|
5481
|
-
* yield* Console.log(`Sampled value: ${value
|
|
5448
|
+
* const value = "sample"
|
|
5449
|
+
* yield* Console.log(`Sampled value: ${value}`)
|
|
5482
5450
|
* return value
|
|
5483
5451
|
* }),
|
|
5484
5452
|
* samplingSchedule.pipe(
|
|
@@ -5488,8 +5456,8 @@ export const tapOutput: {
|
|
|
5488
5456
|
* })
|
|
5489
5457
|
* ```
|
|
5490
5458
|
*
|
|
5491
|
-
* @since 2.0.0
|
|
5492
5459
|
* @category utilities
|
|
5460
|
+
* @since 2.0.0
|
|
5493
5461
|
*/
|
|
5494
5462
|
export const take: {
|
|
5495
5463
|
/**
|
|
@@ -5497,7 +5465,8 @@ export const take: {
|
|
|
5497
5465
|
* from the schedule. Once the specified number of outputs is reached, the
|
|
5498
5466
|
* schedule will stop.
|
|
5499
5467
|
*
|
|
5500
|
-
*
|
|
5468
|
+
* **Example** (Taking a limited number of recurrences)
|
|
5469
|
+
*
|
|
5501
5470
|
* ```ts
|
|
5502
5471
|
* import { Console, Data, Effect, Schedule } from "effect"
|
|
5503
5472
|
*
|
|
@@ -5511,7 +5480,7 @@ export const take: {
|
|
|
5511
5480
|
* const heartbeatProgram = Effect.gen(function*() {
|
|
5512
5481
|
* yield* Effect.repeat(
|
|
5513
5482
|
* Effect.gen(function*() {
|
|
5514
|
-
* yield* Console.log(
|
|
5483
|
+
* yield* Console.log("Heartbeat")
|
|
5515
5484
|
* return "pulse"
|
|
5516
5485
|
* }),
|
|
5517
5486
|
* limitedHeartbeat
|
|
@@ -5558,8 +5527,8 @@ export const take: {
|
|
|
5558
5527
|
* const samplingProgram = Effect.gen(function*() {
|
|
5559
5528
|
* yield* Effect.repeat(
|
|
5560
5529
|
* Effect.gen(function*() {
|
|
5561
|
-
* const value =
|
|
5562
|
-
* yield* Console.log(`Sampled value: ${value
|
|
5530
|
+
* const value = "sample"
|
|
5531
|
+
* yield* Console.log(`Sampled value: ${value}`)
|
|
5563
5532
|
* return value
|
|
5564
5533
|
* }),
|
|
5565
5534
|
* samplingSchedule.pipe(
|
|
@@ -5569,8 +5538,8 @@ export const take: {
|
|
|
5569
5538
|
* })
|
|
5570
5539
|
* ```
|
|
5571
5540
|
*
|
|
5572
|
-
* @since 2.0.0
|
|
5573
5541
|
* @category utilities
|
|
5542
|
+
* @since 2.0.0
|
|
5574
5543
|
*/
|
|
5575
5544
|
(n: number): <Output, Input, Error, Env>(
|
|
5576
5545
|
self: Schedule<Output, Input, Error, Env>
|
|
@@ -5580,7 +5549,8 @@ export const take: {
|
|
|
5580
5549
|
* from the schedule. Once the specified number of outputs is reached, the
|
|
5581
5550
|
* schedule will stop.
|
|
5582
5551
|
*
|
|
5583
|
-
*
|
|
5552
|
+
* **Example** (Taking a limited number of recurrences)
|
|
5553
|
+
*
|
|
5584
5554
|
* ```ts
|
|
5585
5555
|
* import { Console, Data, Effect, Schedule } from "effect"
|
|
5586
5556
|
*
|
|
@@ -5594,7 +5564,7 @@ export const take: {
|
|
|
5594
5564
|
* const heartbeatProgram = Effect.gen(function*() {
|
|
5595
5565
|
* yield* Effect.repeat(
|
|
5596
5566
|
* Effect.gen(function*() {
|
|
5597
|
-
* yield* Console.log(
|
|
5567
|
+
* yield* Console.log("Heartbeat")
|
|
5598
5568
|
* return "pulse"
|
|
5599
5569
|
* }),
|
|
5600
5570
|
* limitedHeartbeat
|
|
@@ -5641,8 +5611,8 @@ export const take: {
|
|
|
5641
5611
|
* const samplingProgram = Effect.gen(function*() {
|
|
5642
5612
|
* yield* Effect.repeat(
|
|
5643
5613
|
* Effect.gen(function*() {
|
|
5644
|
-
* const value =
|
|
5645
|
-
* yield* Console.log(`Sampled value: ${value
|
|
5614
|
+
* const value = "sample"
|
|
5615
|
+
* yield* Console.log(`Sampled value: ${value}`)
|
|
5646
5616
|
* return value
|
|
5647
5617
|
* }),
|
|
5648
5618
|
* samplingSchedule.pipe(
|
|
@@ -5652,8 +5622,8 @@ export const take: {
|
|
|
5652
5622
|
* })
|
|
5653
5623
|
* ```
|
|
5654
5624
|
*
|
|
5655
|
-
* @since 2.0.0
|
|
5656
5625
|
* @category utilities
|
|
5626
|
+
* @since 2.0.0
|
|
5657
5627
|
*/
|
|
5658
5628
|
<Output, Input, Error, Env>(self: Schedule<Output, Input, Error, Env>, n: number): Schedule<Output, Input, Error, Env>
|
|
5659
5629
|
} = dual(2, <Output, Input, Error, Env>(
|
|
@@ -5665,7 +5635,8 @@ export const take: {
|
|
|
5665
5635
|
* Creates a schedule that unfolds a state by repeatedly applying a function,
|
|
5666
5636
|
* outputting the current state and computing the next state.
|
|
5667
5637
|
*
|
|
5668
|
-
*
|
|
5638
|
+
* **Example** (Unfolding schedule state)
|
|
5639
|
+
*
|
|
5669
5640
|
* ```ts
|
|
5670
5641
|
* import { Console, Effect, Schedule } from "effect"
|
|
5671
5642
|
*
|
|
@@ -5713,15 +5684,14 @@ export const take: {
|
|
|
5713
5684
|
* })
|
|
5714
5685
|
* )
|
|
5715
5686
|
*
|
|
5716
|
-
* //
|
|
5717
|
-
* const
|
|
5718
|
-
* 1000,
|
|
5719
|
-
* (
|
|
5687
|
+
* // Deterministic delay adjustment schedule
|
|
5688
|
+
* const adjustedDelaySchedule = Schedule.unfold(
|
|
5689
|
+
* { delay: 1000, adjustment: 100 },
|
|
5690
|
+
* ({ delay, adjustment }) =>
|
|
5720
5691
|
* Effect.gen(function*() {
|
|
5721
|
-
* const
|
|
5722
|
-
*
|
|
5723
|
-
*
|
|
5724
|
-
* return nextDelay
|
|
5692
|
+
* const nextDelay = Math.max(100, delay + adjustment)
|
|
5693
|
+
* yield* Console.log(`Adjusted delay: ${nextDelay}ms`)
|
|
5694
|
+
* return { delay: nextDelay, adjustment: adjustment * -1 }
|
|
5725
5695
|
* })
|
|
5726
5696
|
* )
|
|
5727
5697
|
*
|
|
@@ -5754,8 +5724,8 @@ export const take: {
|
|
|
5754
5724
|
* })
|
|
5755
5725
|
* ```
|
|
5756
5726
|
*
|
|
5757
|
-
* @since 2.0.0
|
|
5758
5727
|
* @category constructors
|
|
5728
|
+
* @since 2.0.0
|
|
5759
5729
|
*/
|
|
5760
5730
|
export const unfold = <State, Error = never, Env = never>(
|
|
5761
5731
|
initial: State,
|
|
@@ -5814,8 +5784,8 @@ export {
|
|
|
5814
5784
|
* If the `predicate` returns `true`, the schedule will continue, otherwise
|
|
5815
5785
|
* the schedule will stop.
|
|
5816
5786
|
*
|
|
5817
|
-
* @since 2.0.0
|
|
5818
5787
|
* @category utilities
|
|
5788
|
+
* @since 2.0.0
|
|
5819
5789
|
*/
|
|
5820
5790
|
while_ as while
|
|
5821
5791
|
}
|
|
@@ -5833,7 +5803,8 @@ export {
|
|
|
5833
5803
|
* |action------|sleep---|act|-sleep|action----|
|
|
5834
5804
|
* ```
|
|
5835
5805
|
*
|
|
5836
|
-
*
|
|
5806
|
+
* **Example** (Repeating on aligned windows)
|
|
5807
|
+
*
|
|
5837
5808
|
* ```ts
|
|
5838
5809
|
* import { Console, Effect, Schedule } from "effect"
|
|
5839
5810
|
*
|
|
@@ -5843,8 +5814,7 @@ export {
|
|
|
5843
5814
|
* const program = Effect.gen(function*() {
|
|
5844
5815
|
* yield* Effect.repeat(
|
|
5845
5816
|
* Effect.gen(function*() {
|
|
5846
|
-
*
|
|
5847
|
-
* yield* Console.log(`Window task executed at: ${now}`)
|
|
5817
|
+
* yield* Console.log("Window task executed")
|
|
5848
5818
|
* return "window-task"
|
|
5849
5819
|
* }),
|
|
5850
5820
|
* windowSchedule.pipe(Schedule.take(4))
|
|
@@ -5852,8 +5822,8 @@ export {
|
|
|
5852
5822
|
* })
|
|
5853
5823
|
* ```
|
|
5854
5824
|
*
|
|
5855
|
-
* @since 2.0.0
|
|
5856
5825
|
* @category constructors
|
|
5826
|
+
* @since 2.0.0
|
|
5857
5827
|
*/
|
|
5858
5828
|
export const windowed = (interval: Duration.Input): Schedule<number> => {
|
|
5859
5829
|
const window = Duration.toMillis(Duration.fromInputUnsafe(interval))
|
|
@@ -5871,7 +5841,8 @@ export const windowed = (interval: Duration.Input): Schedule<number> => {
|
|
|
5871
5841
|
* The output of the schedule is the current count of its repetitions thus far
|
|
5872
5842
|
* (i.e. `0, 1, 2, ...`).
|
|
5873
5843
|
*
|
|
5874
|
-
*
|
|
5844
|
+
* **Example** (Repeating forever)
|
|
5845
|
+
*
|
|
5875
5846
|
* ```ts
|
|
5876
5847
|
* import { Console, Effect, Schedule } from "effect"
|
|
5877
5848
|
*
|
|
@@ -5889,8 +5860,8 @@ export const windowed = (interval: Duration.Input): Schedule<number> => {
|
|
|
5889
5860
|
* })
|
|
5890
5861
|
* ```
|
|
5891
5862
|
*
|
|
5892
|
-
* @since 2.0.0
|
|
5893
5863
|
* @category constructors
|
|
5864
|
+
* @since 2.0.0
|
|
5894
5865
|
*/
|
|
5895
5866
|
export const forever: Schedule<number> = spaced(Duration.zero)
|
|
5896
5867
|
|
|
@@ -5910,8 +5881,8 @@ export {
|
|
|
5910
5881
|
* without modification. It effectively acts as a pass-through that simply
|
|
5911
5882
|
* echoes its input values at each step.
|
|
5912
5883
|
*
|
|
5913
|
-
* @since 2.0.0
|
|
5914
5884
|
* @category Constructors
|
|
5885
|
+
* @since 2.0.0
|
|
5915
5886
|
*/
|
|
5916
5887
|
identity_ as identity
|
|
5917
5888
|
}
|
|
@@ -5919,7 +5890,8 @@ export {
|
|
|
5919
5890
|
/**
|
|
5920
5891
|
* Ensures that the provided schedule respects a specified input type.
|
|
5921
5892
|
*
|
|
5922
|
-
*
|
|
5893
|
+
* **Example** (Constraining schedule input types)
|
|
5894
|
+
*
|
|
5923
5895
|
* ```ts
|
|
5924
5896
|
* import { Schedule } from "effect"
|
|
5925
5897
|
*
|
|
@@ -5938,8 +5910,8 @@ export {
|
|
|
5938
5910
|
* // where CustomType doesn't match the schedule's input type
|
|
5939
5911
|
* ```
|
|
5940
5912
|
*
|
|
5941
|
-
* @since 2.0.0
|
|
5942
5913
|
* @category ensuring types
|
|
5914
|
+
* @since 2.0.0
|
|
5943
5915
|
*/
|
|
5944
5916
|
export const satisfiesInputType = <T>() =>
|
|
5945
5917
|
<Input extends T, Output = never, Error = never, Env = never>(
|
|
@@ -5950,8 +5922,8 @@ export const satisfiesInputType = <T>() =>
|
|
|
5950
5922
|
* Sets the input type of the provided schedule to a specified type, without
|
|
5951
5923
|
* altering the schedule's behavior.
|
|
5952
5924
|
*
|
|
5953
|
-
* @since 2.0.0
|
|
5954
5925
|
* @category ensuring types
|
|
5926
|
+
* @since 2.0.0
|
|
5955
5927
|
*/
|
|
5956
5928
|
export const setInputType =
|
|
5957
5929
|
<T>() => <Output, Error, Env>(self: Schedule<Output, T, Error, Env>): Schedule<Output, T, Error, Env> => self
|
|
@@ -5959,7 +5931,8 @@ export const setInputType =
|
|
|
5959
5931
|
/**
|
|
5960
5932
|
* Ensures that the provided schedule respects a specified output type.
|
|
5961
5933
|
*
|
|
5962
|
-
*
|
|
5934
|
+
* **Example** (Constraining schedule output types)
|
|
5935
|
+
*
|
|
5963
5936
|
* ```ts
|
|
5964
5937
|
* import { Effect, Schedule } from "effect"
|
|
5965
5938
|
*
|
|
@@ -5973,8 +5946,8 @@ export const setInputType =
|
|
|
5973
5946
|
* )
|
|
5974
5947
|
* ```
|
|
5975
5948
|
*
|
|
5976
|
-
* @since 2.0.0
|
|
5977
5949
|
* @category ensuring types
|
|
5950
|
+
* @since 2.0.0
|
|
5978
5951
|
*/
|
|
5979
5952
|
export const satisfiesOutputType = <T>() =>
|
|
5980
5953
|
<Output extends T, Error = never, Input = unknown, Env = never>(
|
|
@@ -5984,7 +5957,8 @@ export const satisfiesOutputType = <T>() =>
|
|
|
5984
5957
|
/**
|
|
5985
5958
|
* Ensures that the provided schedule respects a specified error type.
|
|
5986
5959
|
*
|
|
5987
|
-
*
|
|
5960
|
+
* **Example** (Constraining schedule error types)
|
|
5961
|
+
*
|
|
5988
5962
|
* ```ts
|
|
5989
5963
|
* import { Data, Schedule } from "effect"
|
|
5990
5964
|
*
|
|
@@ -6004,8 +5978,8 @@ export const satisfiesOutputType = <T>() =>
|
|
|
6004
5978
|
* )
|
|
6005
5979
|
* ```
|
|
6006
5980
|
*
|
|
6007
|
-
* @since 2.0.0
|
|
6008
5981
|
* @category ensuring types
|
|
5982
|
+
* @since 2.0.0
|
|
6009
5983
|
*/
|
|
6010
5984
|
export const satisfiesErrorType = <T>() =>
|
|
6011
5985
|
<Error extends T, Output = never, Input = unknown, Env = never>(
|
|
@@ -6015,9 +5989,10 @@ export const satisfiesErrorType = <T>() =>
|
|
|
6015
5989
|
/**
|
|
6016
5990
|
* Ensures that the provided schedule respects a specified context type.
|
|
6017
5991
|
*
|
|
6018
|
-
*
|
|
5992
|
+
* **Example** (Constraining schedule service types)
|
|
5993
|
+
*
|
|
6019
5994
|
* ```ts
|
|
6020
|
-
* import { Schedule } from "effect"
|
|
5995
|
+
* import { Effect, Schedule } from "effect"
|
|
6021
5996
|
*
|
|
6022
5997
|
* // Define service interfaces (type-level only)
|
|
6023
5998
|
* interface Logger {
|
|
@@ -6025,7 +6000,7 @@ export const satisfiesErrorType = <T>() =>
|
|
|
6025
6000
|
* }
|
|
6026
6001
|
*
|
|
6027
6002
|
* interface Database {
|
|
6028
|
-
* readonly query: (sql: string) =>
|
|
6003
|
+
* readonly query: (sql: string) => Effect.Effect<ReadonlyArray<unknown>>
|
|
6029
6004
|
* }
|
|
6030
6005
|
*
|
|
6031
6006
|
* // Ensure schedule requires Logger service
|
|
@@ -6039,8 +6014,8 @@ export const satisfiesErrorType = <T>() =>
|
|
|
6039
6014
|
* )
|
|
6040
6015
|
* ```
|
|
6041
6016
|
*
|
|
6042
|
-
* @since 2.0.0
|
|
6043
6017
|
* @category ensuring types
|
|
6018
|
+
* @since 2.0.0
|
|
6044
6019
|
*/
|
|
6045
6020
|
export const satisfiesServicesType = <T>() =>
|
|
6046
6021
|
<Env extends T, Output = never, Input = unknown, Error = never>(
|