effect 4.0.0-beta.102 → 4.0.0-beta.104
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 +971 -1037
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +381 -407
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +433 -756
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +200 -325
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts +207 -267
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +107 -135
- package/dist/BigInt.js.map +1 -1
- package/dist/Boolean.d.ts +146 -188
- package/dist/Boolean.d.ts.map +1 -1
- package/dist/Boolean.js +64 -84
- package/dist/Boolean.js.map +1 -1
- package/dist/Brand.js.map +1 -1
- package/dist/Cache.d.ts +405 -254
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +167 -102
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +167 -277
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Cause.js +122 -176
- package/dist/Cause.js.map +1 -1
- package/dist/Channel.d.ts +730 -769
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +514 -440
- package/dist/Channel.js.map +1 -1
- package/dist/ChannelSchema.d.ts +1 -1
- package/dist/ChannelSchema.d.ts.map +1 -1
- package/dist/ChannelSchema.js.map +1 -1
- package/dist/Chunk.d.ts +834 -1173
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +326 -439
- package/dist/Chunk.js.map +1 -1
- package/dist/Clock.d.ts +180 -49
- package/dist/Clock.d.ts.map +1 -1
- package/dist/Clock.js +96 -31
- package/dist/Clock.js.map +1 -1
- package/dist/Combiner.d.ts +20 -33
- package/dist/Combiner.d.ts.map +1 -1
- package/dist/Combiner.js +18 -30
- package/dist/Combiner.js.map +1 -1
- package/dist/Config.d.ts +225 -173
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +357 -265
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +194 -68
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +117 -81
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Console.d.ts +233 -33
- package/dist/Console.d.ts.map +1 -1
- package/dist/Console.js +232 -32
- package/dist/Console.js.map +1 -1
- package/dist/Context.d.ts +153 -276
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +171 -214
- package/dist/Context.js.map +1 -1
- package/dist/Cron.d.ts +68 -77
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +57 -66
- package/dist/Cron.js.map +1 -1
- package/dist/Crypto.d.ts +13 -15
- package/dist/Crypto.d.ts.map +1 -1
- package/dist/Crypto.js +22 -15
- package/dist/Crypto.js.map +1 -1
- package/dist/Data.d.ts +60 -80
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js +16 -23
- package/dist/Data.js.map +1 -1
- package/dist/DateTime.d.ts +562 -660
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +307 -362
- package/dist/DateTime.js.map +1 -1
- package/dist/Deferred.d.ts +253 -256
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +104 -96
- package/dist/Deferred.js.map +1 -1
- package/dist/Duration.d.ts +216 -308
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +144 -187
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +2993 -3281
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +1360 -1546
- package/dist/Effect.js.map +1 -1
- package/dist/Effectable.js.map +1 -1
- package/dist/Encoding.d.ts +22 -40
- package/dist/Encoding.d.ts.map +1 -1
- package/dist/Encoding.js +22 -40
- package/dist/Encoding.js.map +1 -1
- package/dist/Equal.d.ts +33 -37
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +39 -23
- package/dist/Equal.js.map +1 -1
- package/dist/Equivalence.d.ts +103 -105
- package/dist/Equivalence.d.ts.map +1 -1
- package/dist/Equivalence.js +77 -79
- package/dist/Equivalence.js.map +1 -1
- package/dist/ErrorReporter.d.ts +51 -27
- package/dist/ErrorReporter.d.ts.map +1 -1
- package/dist/ErrorReporter.js +50 -26
- package/dist/ErrorReporter.js.map +1 -1
- package/dist/ExecutionPlan.d.ts +86 -55
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/ExecutionPlan.js +8 -29
- package/dist/ExecutionPlan.js.map +1 -1
- package/dist/Exit.d.ts +116 -192
- package/dist/Exit.d.ts.map +1 -1
- package/dist/Exit.js +82 -130
- package/dist/Exit.js.map +1 -1
- package/dist/Fiber.d.ts +82 -146
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js +48 -87
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +152 -105
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +106 -73
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +213 -168
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +114 -89
- package/dist/FiberMap.js.map +1 -1
- package/dist/FiberSet.d.ts +123 -81
- package/dist/FiberSet.d.ts.map +1 -1
- package/dist/FiberSet.js +86 -60
- package/dist/FiberSet.js.map +1 -1
- package/dist/FileSystem.d.ts +154 -265
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +42 -147
- package/dist/FileSystem.js.map +1 -1
- package/dist/Filter.d.ts +61 -33
- package/dist/Filter.d.ts.map +1 -1
- package/dist/Filter.js +26 -15
- package/dist/Filter.js.map +1 -1
- package/dist/Formatter.d.ts +25 -33
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +48 -49
- package/dist/Formatter.js.map +1 -1
- package/dist/Function.d.ts +80 -148
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +45 -62
- package/dist/Function.js.map +1 -1
- package/dist/Graph.d.ts +360 -714
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +168 -297
- package/dist/Graph.js.map +1 -1
- package/dist/HKT.d.ts +12 -6
- package/dist/HKT.d.ts.map +1 -1
- package/dist/Hash.d.ts +47 -83
- package/dist/Hash.d.ts.map +1 -1
- package/dist/Hash.js +46 -68
- package/dist/Hash.js.map +1 -1
- package/dist/HashMap.d.ts +319 -411
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashMap.js +122 -166
- package/dist/HashMap.js.map +1 -1
- package/dist/HashRing.d.ts.map +1 -1
- package/dist/HashRing.js +1 -0
- package/dist/HashRing.js.map +1 -1
- package/dist/HashSet.d.ts +177 -284
- package/dist/HashSet.d.ts.map +1 -1
- package/dist/HashSet.js +68 -109
- package/dist/HashSet.js.map +1 -1
- package/dist/Inspectable.d.ts +12 -12
- package/dist/Inspectable.js +8 -8
- package/dist/Inspectable.js.map +1 -1
- package/dist/Iterable.d.ts +620 -786
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +239 -316
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonPatch.d.ts +11 -13
- package/dist/JsonPatch.d.ts.map +1 -1
- package/dist/JsonPatch.js +44 -102
- package/dist/JsonPatch.js.map +1 -1
- package/dist/JsonPointer.d.ts +8 -8
- package/dist/JsonPointer.js +8 -8
- package/dist/JsonPointer.js.map +1 -1
- package/dist/JsonSchema.d.ts +98 -44
- package/dist/JsonSchema.d.ts.map +1 -1
- package/dist/JsonSchema.js +297 -234
- package/dist/JsonSchema.js.map +1 -1
- package/dist/Latch.d.ts +23 -35
- package/dist/Latch.d.ts.map +1 -1
- package/dist/Latch.js +16 -28
- package/dist/Latch.js.map +1 -1
- package/dist/Layer.d.ts +359 -260
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +202 -180
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +42 -29
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +31 -21
- package/dist/LayerMap.js.map +1 -1
- package/dist/LayerRef.d.ts +6 -2
- package/dist/LayerRef.d.ts.map +1 -1
- package/dist/LayerRef.js +6 -2
- package/dist/LayerRef.js.map +1 -1
- package/dist/LogLevel.d.ts +114 -214
- package/dist/LogLevel.d.ts.map +1 -1
- package/dist/LogLevel.js +41 -76
- package/dist/LogLevel.js.map +1 -1
- package/dist/Logger.d.ts +218 -467
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +204 -450
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +7 -5
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/ManagedRuntime.js +7 -5
- package/dist/ManagedRuntime.js.map +1 -1
- package/dist/Match.d.ts +217 -252
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js +150 -183
- package/dist/Match.js.map +1 -1
- package/dist/Metric.d.ts +442 -993
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +198 -642
- package/dist/Metric.js.map +1 -1
- package/dist/MutableHashMap.d.ts +144 -173
- package/dist/MutableHashMap.d.ts.map +1 -1
- package/dist/MutableHashMap.js +68 -79
- package/dist/MutableHashMap.js.map +1 -1
- package/dist/MutableHashSet.d.ts +84 -89
- package/dist/MutableHashSet.d.ts.map +1 -1
- package/dist/MutableHashSet.js +44 -47
- package/dist/MutableHashSet.js.map +1 -1
- package/dist/MutableList.d.ts +71 -370
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +59 -284
- package/dist/MutableList.js.map +1 -1
- package/dist/MutableRef.d.ts +420 -243
- package/dist/MutableRef.d.ts.map +1 -1
- package/dist/MutableRef.js +209 -120
- package/dist/MutableRef.js.map +1 -1
- package/dist/Newtype.d.ts +21 -14
- package/dist/Newtype.d.ts.map +1 -1
- package/dist/Newtype.js +15 -13
- package/dist/Newtype.js.map +1 -1
- package/dist/NonEmptyIterable.d.ts +7 -137
- package/dist/NonEmptyIterable.d.ts.map +1 -1
- package/dist/NonEmptyIterable.js +5 -93
- package/dist/NonEmptyIterable.js.map +1 -1
- package/dist/Number.d.ts +196 -233
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +90 -109
- package/dist/Number.js.map +1 -1
- package/dist/Optic.d.ts +97 -189
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +187 -290
- package/dist/Optic.js.map +1 -1
- package/dist/Option.d.ts +447 -812
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +211 -392
- package/dist/Option.js.map +1 -1
- package/dist/Order.d.ts +109 -109
- package/dist/Order.js +91 -91
- package/dist/Order.js.map +1 -1
- package/dist/Ordering.d.ts +20 -23
- package/dist/Ordering.d.ts.map +1 -1
- package/dist/Ordering.js +8 -9
- package/dist/Ordering.js.map +1 -1
- package/dist/PartitionedSemaphore.js.map +1 -1
- package/dist/Path.d.ts +38 -41
- package/dist/Path.d.ts.map +1 -1
- package/dist/Path.js +3 -4
- package/dist/Path.js.map +1 -1
- package/dist/Pipeable.d.ts +6 -5
- package/dist/Pipeable.d.ts.map +1 -1
- package/dist/Pipeable.js +2 -2
- package/dist/Pipeable.js.map +1 -1
- package/dist/PlatformError.d.ts +4 -4
- package/dist/PlatformError.js +3 -3
- package/dist/PlatformError.js.map +1 -1
- package/dist/Pool.d.ts +4 -2
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +4 -2
- package/dist/Pool.js.map +1 -1
- package/dist/Predicate.d.ts +200 -181
- package/dist/Predicate.d.ts.map +1 -1
- package/dist/Predicate.js +100 -108
- package/dist/Predicate.js.map +1 -1
- package/dist/PrimaryKey.d.ts +7 -7
- package/dist/PrimaryKey.js +5 -5
- package/dist/PrimaryKey.js.map +1 -1
- package/dist/PubSub.d.ts +425 -494
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +373 -362
- package/dist/PubSub.js.map +1 -1
- package/dist/Pull.d.ts +24 -18
- package/dist/Pull.d.ts.map +1 -1
- package/dist/Pull.js +11 -9
- package/dist/Pull.js.map +1 -1
- package/dist/Queue.d.ts +200 -159
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +162 -132
- package/dist/Queue.js.map +1 -1
- package/dist/Random.d.ts +49 -74
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +35 -54
- package/dist/Random.js.map +1 -1
- package/dist/RcMap.d.ts +121 -63
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +42 -21
- package/dist/RcMap.js.map +1 -1
- package/dist/RcRef.d.ts +24 -13
- package/dist/RcRef.d.ts.map +1 -1
- package/dist/RcRef.js +15 -9
- package/dist/RcRef.js.map +1 -1
- package/dist/Record.d.ts +291 -488
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +111 -202
- package/dist/Record.js.map +1 -1
- package/dist/Redactable.d.ts +6 -2
- package/dist/Redactable.d.ts.map +1 -1
- package/dist/Redactable.js +7 -2
- package/dist/Redactable.js.map +1 -1
- package/dist/Redacted.d.ts +25 -25
- package/dist/Redacted.d.ts.map +1 -1
- package/dist/Redacted.js +19 -20
- package/dist/Redacted.js.map +1 -1
- package/dist/Reducer.d.ts +8 -15
- package/dist/Reducer.d.ts.map +1 -1
- package/dist/Reducer.js +6 -12
- package/dist/Reducer.js.map +1 -1
- package/dist/Ref.d.ts +95 -165
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +75 -122
- package/dist/Ref.js.map +1 -1
- package/dist/References.d.ts +102 -168
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +102 -168
- package/dist/References.js.map +1 -1
- package/dist/RegExp.d.ts +10 -14
- package/dist/RegExp.d.ts.map +1 -1
- package/dist/RegExp.js +10 -14
- package/dist/RegExp.js.map +1 -1
- package/dist/Request.d.ts +31 -21
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js +16 -13
- package/dist/Request.js.map +1 -1
- package/dist/RequestResolver.d.ts +201 -90
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +87 -41
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Resource.js.map +1 -1
- package/dist/Result.d.ts +302 -470
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +133 -217
- package/dist/Result.js.map +1 -1
- package/dist/Runtime.d.ts +50 -75
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +39 -60
- package/dist/Runtime.js.map +1 -1
- package/dist/Schedule.d.ts +292 -1638
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +164 -805
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts +5 -5
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +18 -6
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +676 -674
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +513 -544
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +30 -53
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +404 -301
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaError.d.ts +7 -6
- package/dist/SchemaError.d.ts.map +1 -1
- package/dist/SchemaError.js +7 -6
- package/dist/SchemaError.js.map +1 -1
- package/dist/SchemaGetter.d.ts +217 -174
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +218 -185
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.d.ts +62 -190
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js +73 -265
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.d.ts +2 -2
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +137 -107
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +22 -36
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +20 -26
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +114 -74
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +120 -85
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/Scope.d.ts +123 -151
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +72 -92
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.js +1 -1
- package/dist/ScopedCache.js.map +1 -1
- package/dist/ScopedRef.d.ts +3 -3
- package/dist/ScopedRef.js +2 -2
- package/dist/ScopedRef.js.map +1 -1
- package/dist/Semaphore.d.ts +96 -10
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js +78 -39
- package/dist/Semaphore.js.map +1 -1
- package/dist/Sink.d.ts +118 -108
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +107 -100
- package/dist/Sink.js.map +1 -1
- package/dist/Stdio.d.ts +1 -1
- package/dist/Stdio.js.map +1 -1
- package/dist/Stream.d.ts +2442 -2953
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +1105 -1383
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +262 -308
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +184 -215
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts +109 -114
- package/dist/Struct.d.ts.map +1 -1
- package/dist/Struct.js +41 -50
- package/dist/Struct.js.map +1 -1
- package/dist/SubscriptionRef.d.ts +282 -250
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +104 -92
- package/dist/SubscriptionRef.js.map +1 -1
- package/dist/Symbol.d.ts +3 -3
- package/dist/Symbol.js +3 -3
- package/dist/Symbol.js.map +1 -1
- package/dist/SynchronizedRef.js +1 -1
- package/dist/SynchronizedRef.js.map +1 -1
- package/dist/Take.js.map +1 -1
- package/dist/Terminal.d.ts +2 -2
- package/dist/Terminal.js +2 -2
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +100 -54
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +41 -24
- package/dist/Tracer.js.map +1 -1
- package/dist/Trie.d.ts +287 -679
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js +109 -251
- package/dist/Trie.js.map +1 -1
- package/dist/Tuple.d.ts +98 -131
- package/dist/Tuple.d.ts.map +1 -1
- package/dist/Tuple.js +42 -57
- package/dist/Tuple.js.map +1 -1
- package/dist/TxChunk.d.ts +201 -121
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxChunk.js +85 -56
- package/dist/TxChunk.js.map +1 -1
- package/dist/TxDeferred.d.ts +62 -46
- package/dist/TxDeferred.d.ts.map +1 -1
- package/dist/TxDeferred.js +30 -22
- package/dist/TxDeferred.js.map +1 -1
- package/dist/TxHashMap.d.ts +631 -779
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +268 -330
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxHashSet.d.ts +297 -236
- package/dist/TxHashSet.d.ts.map +1 -1
- package/dist/TxHashSet.js +130 -100
- package/dist/TxHashSet.js.map +1 -1
- package/dist/TxPriorityQueue.d.ts +126 -95
- package/dist/TxPriorityQueue.d.ts.map +1 -1
- package/dist/TxPriorityQueue.js +74 -56
- package/dist/TxPriorityQueue.js.map +1 -1
- package/dist/TxPubSub.d.ts +101 -88
- package/dist/TxPubSub.d.ts.map +1 -1
- package/dist/TxPubSub.js +87 -66
- package/dist/TxPubSub.js.map +1 -1
- package/dist/TxQueue.d.ts +200 -180
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxQueue.js +160 -136
- package/dist/TxQueue.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +89 -114
- package/dist/TxReentrantLock.d.ts.map +1 -1
- package/dist/TxReentrantLock.js +75 -53
- package/dist/TxReentrantLock.js.map +1 -1
- package/dist/TxRef.d.ts +51 -32
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +23 -15
- package/dist/TxRef.js.map +1 -1
- package/dist/TxSemaphore.d.ts +129 -95
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +85 -70
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/TxSubscriptionRef.d.ts +97 -70
- package/dist/TxSubscriptionRef.d.ts.map +1 -1
- package/dist/TxSubscriptionRef.js +44 -34
- package/dist/TxSubscriptionRef.js.map +1 -1
- package/dist/Types.d.ts +126 -67
- package/dist/Types.d.ts.map +1 -1
- package/dist/UndefinedOr.js.map +1 -1
- package/dist/Unify.d.ts +45 -65
- package/dist/Unify.d.ts.map +1 -1
- package/dist/Unify.js +6 -9
- package/dist/Unify.js.map +1 -1
- package/dist/Utils.d.ts +23 -16
- package/dist/Utils.d.ts.map +1 -1
- package/dist/Utils.js +3 -7
- package/dist/Utils.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/array.js.map +1 -1
- package/dist/internal/core.js +1 -1
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/dateTime.js +5 -1
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/doNotation.js.map +1 -1
- package/dist/internal/effect.js +77 -40
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/equal.js.map +1 -1
- package/dist/internal/errors.js.map +1 -1
- package/dist/internal/executionPlan.js +51 -3
- package/dist/internal/executionPlan.js.map +1 -1
- package/dist/internal/hashMap.js +12 -8
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/hashSet.js.map +1 -1
- package/dist/internal/layer.js.map +1 -1
- package/dist/internal/matcher.js +1 -1
- package/dist/internal/matcher.js.map +1 -1
- package/dist/internal/metric.js.map +1 -1
- package/dist/internal/option.js.map +1 -1
- package/dist/internal/persistence.d.ts +2 -0
- package/dist/internal/persistence.d.ts.map +1 -0
- package/dist/internal/persistence.js +3 -0
- package/dist/internal/persistence.js.map +1 -0
- package/dist/internal/random.js.map +1 -1
- package/dist/internal/rcRef.js.map +1 -1
- package/dist/internal/record.js.map +1 -1
- package/dist/internal/redacted.js.map +1 -1
- package/dist/internal/references.js +3 -0
- package/dist/internal/references.js.map +1 -1
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/result.js.map +1 -1
- package/dist/internal/schedule.js.map +1 -1
- package/dist/internal/schema/annotations.js +2 -0
- package/dist/internal/schema/annotations.js.map +1 -1
- package/dist/internal/schema/cause.js.map +1 -1
- package/dist/internal/schema/fromJsonSchemaDocument.js +13 -11
- package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -1
- package/dist/internal/schema/fromRepresentation.js +8 -15
- package/dist/internal/schema/fromRepresentation.js.map +1 -1
- package/dist/internal/schema/parser.d.ts +14 -0
- package/dist/internal/schema/parser.d.ts.map +1 -0
- package/dist/internal/schema/parser.js +13 -0
- package/dist/internal/schema/parser.js.map +1 -0
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/internal/schema/toArbitrary.js +1 -1
- package/dist/internal/schema/toArbitrary.js.map +1 -1
- package/dist/internal/schema/toCodeDocument.js.map +1 -1
- package/dist/internal/schema/toEquivalence.js.map +1 -1
- package/dist/internal/schema/toJsonSchemaDocument.js +48 -6
- package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -1
- package/dist/internal/schema/toRepresentation.js +87 -107
- package/dist/internal/schema/toRepresentation.js.map +1 -1
- package/dist/internal/stackTraceLimit.js.map +1 -1
- package/dist/internal/stream.js.map +1 -1
- package/dist/internal/tracer.js.map +1 -1
- package/dist/internal/trie.js +24 -10
- package/dist/internal/trie.js.map +1 -1
- package/dist/testing/FastCheck.d.ts +8 -7
- package/dist/testing/FastCheck.d.ts.map +1 -1
- package/dist/testing/FastCheck.js +8 -7
- package/dist/testing/FastCheck.js.map +1 -1
- package/dist/testing/TestClock.d.ts +57 -28
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestClock.js +61 -19
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/testing/TestConsole.d.ts +32 -31
- package/dist/testing/TestConsole.d.ts.map +1 -1
- package/dist/testing/TestConsole.js +24 -22
- package/dist/testing/TestConsole.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +30 -30
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/testing/TestSchema.js +25 -25
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +95 -118
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +113 -136
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +132 -97
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +56 -52
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
- package/dist/unstable/ai/IdGenerator.d.ts +32 -28
- package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
- package/dist/unstable/ai/IdGenerator.js +26 -21
- package/dist/unstable/ai/IdGenerator.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +107 -67
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +108 -66
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpProtocol.d.ts +30 -0
- package/dist/unstable/ai/McpProtocol.d.ts.map +1 -0
- package/dist/unstable/ai/McpProtocol.js +20 -0
- package/dist/unstable/ai/McpProtocol.js.map +1 -0
- package/dist/unstable/ai/McpSchema.d.ts +251 -185
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +66 -58
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +68 -59
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +695 -242
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Model.d.ts +8 -19
- package/dist/unstable/ai/Model.d.ts.map +1 -1
- package/dist/unstable/ai/Model.js +9 -20
- package/dist/unstable/ai/Model.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Prompt.d.ts +127 -41
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Prompt.js +59 -20
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +28 -14
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js +9 -4
- package/dist/unstable/ai/Response.js.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.js.map +1 -1
- package/dist/unstable/ai/Telemetry.d.ts +46 -13
- package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
- package/dist/unstable/ai/Telemetry.js +18 -7
- package/dist/unstable/ai/Telemetry.js.map +1 -1
- package/dist/unstable/ai/Tokenizer.d.ts +14 -3
- package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
- package/dist/unstable/ai/Tokenizer.js +10 -2
- package/dist/unstable/ai/Tokenizer.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +59 -44
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +48 -39
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +26 -8
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +18 -4
- package/dist/unstable/ai/Toolkit.js.map +1 -1
- package/dist/unstable/ai/index.d.ts +4 -0
- package/dist/unstable/ai/index.d.ts.map +1 -1
- package/dist/unstable/ai/index.js +4 -0
- package/dist/unstable/ai/index.js.map +1 -1
- package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
- package/dist/unstable/ai/internal/mcpProtocol.d.ts +21 -0
- package/dist/unstable/ai/internal/mcpProtocol.d.ts.map +1 -0
- package/dist/unstable/ai/internal/mcpProtocol.js +22 -0
- package/dist/unstable/ai/internal/mcpProtocol.js.map +1 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.d.ts +2 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.d.ts.map +1 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.js +32 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.js.map +1 -0
- package/dist/unstable/ai/internal/structured-output.js +14 -15
- package/dist/unstable/ai/internal/structured-output.js.map +1 -1
- package/dist/unstable/cli/Argument.d.ts +273 -69
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js +111 -33
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/CliConfig.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +70 -77
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +66 -70
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/CliOutput.d.ts +35 -54
- package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
- package/dist/unstable/cli/CliOutput.js +26 -42
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +713 -115
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +245 -47
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Completions.js.map +1 -1
- package/dist/unstable/cli/Flag.d.ts +418 -138
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +197 -71
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +1 -1
- package/dist/unstable/cli/GlobalFlag.js.map +1 -1
- package/dist/unstable/cli/HelpDoc.d.ts +12 -4
- package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
- package/dist/unstable/cli/Param.d.ts +299 -83
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +143 -57
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +370 -149
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js +375 -160
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/Prompt.d.ts +23 -14
- package/dist/unstable/cli/Prompt.d.ts.map +1 -1
- package/dist/unstable/cli/Prompt.js +54 -31
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/index.js.map +1 -1
- package/dist/unstable/cli/internal/ansi.js +2 -2
- package/dist/unstable/cli/internal/ansi.js.map +1 -1
- package/dist/unstable/cli/internal/auto-suggest.js.map +1 -1
- package/dist/unstable/cli/internal/command.d.ts +2 -2
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +10 -9
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/completions/bash.js +69 -9
- package/dist/unstable/cli/internal/completions/bash.js.map +1 -1
- package/dist/unstable/cli/internal/completions/descriptor.js +24 -18
- package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -1
- package/dist/unstable/cli/internal/completions/fish.js +5 -5
- package/dist/unstable/cli/internal/completions/fish.js.map +1 -1
- package/dist/unstable/cli/internal/completions/zsh.js.map +1 -1
- package/dist/unstable/cli/internal/config.js.map +1 -1
- package/dist/unstable/cli/internal/help.d.ts.map +1 -1
- package/dist/unstable/cli/internal/help.js +4 -2
- package/dist/unstable/cli/internal/help.js.map +1 -1
- package/dist/unstable/cli/internal/lexer.js +17 -7
- package/dist/unstable/cli/internal/lexer.js.map +1 -1
- package/dist/unstable/cli/internal/parser.js +5 -5
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cli/internal/wizard.js +2 -2
- package/dist/unstable/cli/internal/wizard.js.map +1 -1
- package/dist/unstable/cluster/ClusterCron.js.map +1 -1
- package/dist/unstable/cluster/ClusterError.js +7 -7
- package/dist/unstable/cluster/ClusterError.js.map +1 -1
- package/dist/unstable/cluster/ClusterMetrics.js.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.d.ts +8 -8
- package/dist/unstable/cluster/ClusterSchema.js +8 -8
- package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +6 -2
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/DeliverAt.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +10 -10
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +8 -8
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/EntityAddress.js.map +1 -1
- package/dist/unstable/cluster/EntityId.js.map +1 -1
- package/dist/unstable/cluster/EntityProxy.d.ts +4 -2
- package/dist/unstable/cluster/EntityProxy.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxy.js +4 -2
- package/dist/unstable/cluster/EntityProxy.js.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
- package/dist/unstable/cluster/EntityResource.d.ts +2 -2
- package/dist/unstable/cluster/EntityResource.js +2 -2
- package/dist/unstable/cluster/EntityResource.js.map +1 -1
- package/dist/unstable/cluster/EntityType.js.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts +3 -3
- package/dist/unstable/cluster/Envelope.js +3 -3
- package/dist/unstable/cluster/Envelope.js.map +1 -1
- package/dist/unstable/cluster/HttpRunner.d.ts +2 -2
- package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/HttpRunner.js +6 -4
- package/dist/unstable/cluster/HttpRunner.js.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
- package/dist/unstable/cluster/MachineId.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +9 -9
- package/dist/unstable/cluster/Message.js +6 -6
- package/dist/unstable/cluster/Message.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +15 -15
- package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/MessageStorage.js +13 -6
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts +8 -0
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +16 -4
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/Runner.js.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.d.ts +1 -1
- package/dist/unstable/cluster/RunnerHealth.js +1 -1
- package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts +2 -1
- package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +18 -16
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.d.ts +3 -4
- package/dist/unstable/cluster/RunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.js +8 -7
- package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +6 -6
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +19 -10
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/ShardId.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +25 -6
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +3 -3
- package/dist/unstable/cluster/ShardingConfig.js +3 -3
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/ShardingRegistrationEvent.js.map +1 -1
- package/dist/unstable/cluster/SingleRunner.js.map +1 -1
- package/dist/unstable/cluster/Singleton.js.map +1 -1
- package/dist/unstable/cluster/SingletonAddress.d.ts +1 -1
- package/dist/unstable/cluster/SingletonAddress.js +1 -1
- package/dist/unstable/cluster/SingletonAddress.js.map +1 -1
- package/dist/unstable/cluster/Snowflake.d.ts +8 -8
- package/dist/unstable/cluster/Snowflake.js +8 -8
- package/dist/unstable/cluster/Snowflake.js.map +1 -1
- package/dist/unstable/cluster/SocketRunner.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js +20 -5
- package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/TestRunner.js.map +1 -1
- package/dist/unstable/cluster/index.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +6 -6
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/cluster/internal/entityReaper.js.map +1 -1
- package/dist/unstable/cluster/internal/hash.js.map +1 -1
- package/dist/unstable/cluster/internal/interruptors.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceMap.js +2 -2
- package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceRef.js +17 -0
- package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
- package/dist/unstable/cluster/internal/shardLock.js.map +1 -1
- package/dist/unstable/devtools/DevTools.js.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.js +7 -2
- package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
- package/dist/unstable/devtools/DevToolsServer.js.map +1 -1
- package/dist/unstable/devtools/index.js.map +1 -1
- package/dist/unstable/encoding/Ini.d.ts +20 -0
- package/dist/unstable/encoding/Ini.d.ts.map +1 -0
- package/dist/unstable/encoding/Ini.js +153 -0
- package/dist/unstable/encoding/Ini.js.map +1 -0
- package/dist/unstable/encoding/Msgpack.d.ts +2 -1
- package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
- package/dist/unstable/encoding/Msgpack.js +27 -15
- package/dist/unstable/encoding/Msgpack.js.map +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
- package/dist/unstable/encoding/Ndjson.js +7 -1
- package/dist/unstable/encoding/Ndjson.js.map +1 -1
- package/dist/unstable/encoding/Sse.d.ts +72 -8
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.js +72 -31
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/encoding/Toml.d.ts +19 -0
- package/dist/unstable/encoding/Toml.d.ts.map +1 -0
- package/dist/unstable/encoding/Toml.js +434 -0
- package/dist/unstable/encoding/Toml.js.map +1 -0
- package/dist/unstable/encoding/Yaml.d.ts +19 -0
- package/dist/unstable/encoding/Yaml.d.ts.map +1 -0
- package/dist/unstable/encoding/Yaml.js +461 -0
- package/dist/unstable/encoding/Yaml.js.map +1 -0
- package/dist/unstable/encoding/index.d.ts +12 -0
- package/dist/unstable/encoding/index.d.ts.map +1 -1
- package/dist/unstable/encoding/index.js +12 -0
- package/dist/unstable/encoding/index.js.map +1 -1
- package/dist/unstable/eventlog/Event.d.ts +20 -20
- package/dist/unstable/eventlog/Event.js.map +1 -1
- package/dist/unstable/eventlog/EventGroup.d.ts +4 -4
- package/dist/unstable/eventlog/EventGroup.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +16 -16
- package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventJournal.js +26 -18
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts +3 -3
- package/dist/unstable/eventlog/EventLog.js +3 -3
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.d.ts +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +2 -2
- package/dist/unstable/eventlog/EventLogMessage.js +2 -2
- package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +15 -15
- package/dist/unstable/eventlog/EventLogRemote.js +1 -1
- package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.d.ts +11 -2
- package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.js +45 -21
- package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +4 -4
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.js +13 -5
- package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +5 -5
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js +15 -7
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.js +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.js +1 -4
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/index.js.map +1 -1
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js.map +1 -1
- package/dist/unstable/http/Cookies.d.ts +2 -2
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +30 -18
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Etag.d.ts +1 -1
- package/dist/unstable/http/Etag.js +1 -1
- package/dist/unstable/http/Etag.js.map +1 -1
- package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/unstable/http/FetchHttpClient.js.map +1 -1
- package/dist/unstable/http/FindMyWay/internal/queryString.d.ts +11 -0
- package/dist/unstable/http/FindMyWay/internal/queryString.d.ts.map +1 -0
- package/dist/unstable/http/FindMyWay/internal/queryString.js +259 -0
- package/dist/unstable/http/FindMyWay/internal/queryString.js.map +1 -0
- package/dist/unstable/http/FindMyWay/internal/router.d.ts +2 -0
- package/dist/unstable/http/FindMyWay/internal/router.d.ts.map +1 -0
- package/dist/unstable/http/FindMyWay/internal/router.js +665 -0
- package/dist/unstable/http/FindMyWay/internal/router.js.map +1 -0
- package/dist/unstable/http/FindMyWay.d.ts +33 -8
- package/dist/unstable/http/FindMyWay.d.ts.map +1 -1
- package/dist/unstable/http/FindMyWay.js +4 -7
- package/dist/unstable/http/FindMyWay.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts +2 -2
- package/dist/unstable/http/Headers.js +2 -2
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpBody.d.ts +5 -3
- package/dist/unstable/http/HttpBody.d.ts.map +1 -1
- package/dist/unstable/http/HttpBody.js +11 -5
- package/dist/unstable/http/HttpBody.js.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts +51 -44
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +46 -17
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientError.js +1 -1
- package/dist/unstable/http/HttpClientError.js.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +2 -12
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts +4 -4
- package/dist/unstable/http/HttpClientResponse.js +3 -18
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts +6 -6
- package/dist/unstable/http/HttpEffect.js +3 -3
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMethod.d.ts +6 -9
- package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
- package/dist/unstable/http/HttpMethod.js +6 -9
- package/dist/unstable/http/HttpMethod.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts +75 -9
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +164 -39
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpPlatform.d.ts +76 -0
- package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
- package/dist/unstable/http/HttpPlatform.js +53 -3
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +88 -89
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +78 -79
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServer.d.ts +13 -13
- package/dist/unstable/http/HttpServer.js +6 -6
- package/dist/unstable/http/HttpServer.js.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +2 -2
- package/dist/unstable/http/HttpServerError.js +2 -2
- package/dist/unstable/http/HttpServerError.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +4 -4
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +11 -10
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +22 -0
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +17 -5
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpStaticServer.d.ts +35 -7
- package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpStaticServer.js +35 -7
- package/dist/unstable/http/HttpStaticServer.js.map +1 -1
- package/dist/unstable/http/HttpTraceContext.js.map +1 -1
- package/dist/unstable/http/Multipart.d.ts +7 -7
- package/dist/unstable/http/Multipart.d.ts.map +1 -1
- package/dist/unstable/http/Multipart.js +14 -7
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/MultipartParser/HeadersParser.d.ts +53 -0
- package/dist/unstable/http/MultipartParser/HeadersParser.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser/HeadersParser.js +14 -0
- package/dist/unstable/http/MultipartParser/HeadersParser.js.map +1 -0
- package/dist/unstable/http/MultipartParser/Search.d.ts +11 -0
- package/dist/unstable/http/MultipartParser/Search.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser/Search.js +14 -0
- package/dist/unstable/http/MultipartParser/Search.js.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/contentType.d.ts +5 -0
- package/dist/unstable/http/MultipartParser/internal/contentType.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/contentType.js +82 -0
- package/dist/unstable/http/MultipartParser/internal/contentType.js.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/headers.d.ts +3 -0
- package/dist/unstable/http/MultipartParser/internal/headers.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/headers.js +194 -0
- package/dist/unstable/http/MultipartParser/internal/headers.js.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/multipart.d.ts +8 -0
- package/dist/unstable/http/MultipartParser/internal/multipart.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/multipart.js +226 -0
- package/dist/unstable/http/MultipartParser/internal/multipart.js.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/search.d.ts +5 -0
- package/dist/unstable/http/MultipartParser/internal/search.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/search.js +120 -0
- package/dist/unstable/http/MultipartParser/internal/search.js.map +1 -0
- package/dist/unstable/http/MultipartParser.d.ts +98 -0
- package/dist/unstable/http/MultipartParser.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser.js +23 -0
- package/dist/unstable/http/MultipartParser.js.map +1 -0
- package/dist/unstable/http/Template.d.ts.map +1 -1
- package/dist/unstable/http/Template.js +2 -2
- package/dist/unstable/http/Template.js.map +1 -1
- package/dist/unstable/http/Url.d.ts +33 -63
- package/dist/unstable/http/Url.d.ts.map +1 -1
- package/dist/unstable/http/Url.js +14 -28
- package/dist/unstable/http/Url.js.map +1 -1
- package/dist/unstable/http/UrlParams.d.ts +10 -18
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +9 -17
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/http/index.d.ts +1 -1
- package/dist/unstable/http/index.d.ts.map +1 -1
- package/dist/unstable/http/index.js +1 -1
- package/dist/unstable/http/index.js.map +1 -1
- package/dist/unstable/http/internal/compression.d.ts +2 -0
- package/dist/unstable/http/internal/compression.d.ts.map +1 -0
- package/dist/unstable/http/internal/compression.js +155 -0
- package/dist/unstable/http/internal/compression.js.map +1 -0
- package/dist/unstable/http/internal/httpBody.d.ts +2 -0
- package/dist/unstable/http/internal/httpBody.d.ts.map +1 -0
- package/dist/unstable/http/internal/httpBody.js +10 -0
- package/dist/unstable/http/internal/httpBody.js.map +1 -0
- package/dist/unstable/http/internal/preResponseHandler.js.map +1 -1
- package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js +5 -5
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +78 -26
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +4 -5
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +76 -38
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +48 -46
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.js +73 -16
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +18 -18
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.js +30 -30
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.d.ts +15 -15
- package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +71 -24
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js +57 -10
- package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts +0 -12
- package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +225 -6
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.js +174 -4
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiTest.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts +21 -13
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +58 -31
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/httpapi/index.js.map +1 -1
- package/dist/unstable/httpapi/internal/html.js.map +1 -1
- package/dist/unstable/httpapi/internal/httpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/internal/httpApiSwagger.js.map +1 -1
- package/dist/unstable/httpapi/internal/mediaType.js.map +1 -1
- package/dist/unstable/observability/Otlp.js.map +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts +13 -15
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +19 -5
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js +2 -2
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts +6 -3
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.js +28 -15
- package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
- package/dist/unstable/observability/OtlpResource.d.ts +16 -7
- package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpResource.js +21 -12
- package/dist/unstable/observability/OtlpResource.js.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js +1 -1
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.d.ts +13 -4
- package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.js +10 -3
- package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
- package/dist/unstable/observability/index.js.map +1 -1
- package/dist/unstable/observability/internal/otlpEnv.js +1 -1
- package/dist/unstable/observability/internal/otlpEnv.js.map +1 -1
- package/dist/unstable/observability/internal/otlpProtobuf.js.map +1 -1
- package/dist/unstable/observability/internal/protobuf.js +3 -0
- package/dist/unstable/observability/internal/protobuf.js.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +8 -3
- package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.js +22 -13
- package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
- package/dist/unstable/persistence/Persistable.d.ts +8 -8
- package/dist/unstable/persistence/Persistable.js.map +1 -1
- package/dist/unstable/persistence/PersistedCache.js.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts +6 -6
- package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.js +15 -15
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/Persistence.d.ts +3 -3
- package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistence.js +108 -22
- package/dist/unstable/persistence/Persistence.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +45 -24
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +29 -45
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/persistence/Redis.d.ts +2 -2
- package/dist/unstable/persistence/Redis.js +2 -2
- package/dist/unstable/persistence/Redis.js.map +1 -1
- package/dist/unstable/persistence/index.js.map +1 -1
- package/dist/unstable/process/ChildProcess.d.ts +64 -21
- package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcess.js +14 -5
- package/dist/unstable/process/ChildProcess.js.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.d.ts +21 -10
- package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
- package/dist/unstable/process/index.js.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.d.ts +8 -8
- package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.js +10 -10
- package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +25 -22
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +14 -13
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.js +4 -1
- package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/unstable/reactivity/AtomRef.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +24 -3
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.js +4 -1
- package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
- package/dist/unstable/reactivity/Hydration.d.ts +1 -1
- package/dist/unstable/reactivity/Hydration.js +1 -1
- package/dist/unstable/reactivity/Hydration.js.map +1 -1
- package/dist/unstable/reactivity/Reactivity.js.map +1 -1
- package/dist/unstable/reactivity/index.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +35 -33
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js +4 -2
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts +26 -12
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +30 -20
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcClientError.js +2 -2
- package/dist/unstable/rpc/RpcClientError.js.map +1 -1
- package/dist/unstable/rpc/RpcGroup.d.ts +8 -8
- package/dist/unstable/rpc/RpcGroup.js +1 -1
- package/dist/unstable/rpc/RpcGroup.js.map +1 -1
- package/dist/unstable/rpc/RpcMessage.d.ts +31 -30
- package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMessage.js +6 -6
- package/dist/unstable/rpc/RpcMessage.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts +10 -10
- package/dist/unstable/rpc/RpcMiddleware.js +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts +4 -4
- package/dist/unstable/rpc/RpcSchema.js +3 -3
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts +58 -7
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +177 -96
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +13 -13
- package/dist/unstable/rpc/RpcServer.js +17 -13
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/rpc/RpcTest.js.map +1 -1
- package/dist/unstable/rpc/RpcWorker.d.ts +5 -5
- package/dist/unstable/rpc/RpcWorker.js +4 -4
- package/dist/unstable/rpc/RpcWorker.js.map +1 -1
- package/dist/unstable/rpc/Utils.js.map +1 -1
- package/dist/unstable/rpc/index.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts +53 -51
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js +35 -33
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +10 -10
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.js +19 -11
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/schema/index.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +11 -3
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +37 -16
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/socket/SocketServer.js.map +1 -1
- package/dist/unstable/socket/index.js.map +1 -1
- package/dist/unstable/sql/Migrator.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts +1 -1
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +8 -4
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/sql/SqlConnection.js.map +1 -1
- package/dist/unstable/sql/SqlError.js +13 -13
- package/dist/unstable/sql/SqlError.js.map +1 -1
- package/dist/unstable/sql/SqlModel.d.ts +2 -2
- package/dist/unstable/sql/SqlModel.js +2 -2
- package/dist/unstable/sql/SqlModel.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.d.ts +5 -5
- package/dist/unstable/sql/SqlResolver.js +10 -8
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/sql/SqlSchema.js.map +1 -1
- package/dist/unstable/sql/SqlStream.js.map +1 -1
- package/dist/unstable/sql/Statement.d.ts +6 -6
- package/dist/unstable/sql/Statement.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.js +23 -21
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/sql/index.js.map +1 -1
- package/dist/unstable/workers/Transferable.d.ts +1 -1
- package/dist/unstable/workers/Transferable.js +1 -1
- package/dist/unstable/workers/Transferable.js.map +1 -1
- package/dist/unstable/workers/Worker.d.ts +2 -2
- package/dist/unstable/workers/Worker.js +2 -2
- package/dist/unstable/workers/Worker.js.map +1 -1
- package/dist/unstable/workers/WorkerError.d.ts +7 -7
- package/dist/unstable/workers/WorkerError.js +11 -11
- package/dist/unstable/workers/WorkerError.js.map +1 -1
- package/dist/unstable/workers/WorkerRunner.d.ts +1 -1
- package/dist/unstable/workers/WorkerRunner.js +1 -1
- package/dist/unstable/workers/WorkerRunner.js.map +1 -1
- package/dist/unstable/workers/index.js.map +1 -1
- package/dist/unstable/workflow/Activity.d.ts +2 -2
- package/dist/unstable/workflow/Activity.js +2 -2
- package/dist/unstable/workflow/Activity.js.map +1 -1
- package/dist/unstable/workflow/DurableClock.d.ts +1 -1
- package/dist/unstable/workflow/DurableClock.js +1 -1
- package/dist/unstable/workflow/DurableClock.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts +10 -10
- package/dist/unstable/workflow/DurableDeferred.js +5 -5
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/DurableQueue.d.ts +22 -20
- package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableQueue.js +22 -20
- package/dist/unstable/workflow/DurableQueue.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +21 -21
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js +13 -14
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +2 -2
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +3 -3
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.d.ts +4 -2
- package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.js +4 -2
- package/dist/unstable/workflow/WorkflowProxy.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
- package/dist/unstable/workflow/index.js.map +1 -1
- package/dist/unstable/workflow/internal/crypto.js.map +1 -1
- package/package.json +6 -13
- package/src/Array.ts +982 -1045
- package/src/BigDecimal.ts +433 -756
- package/src/BigInt.ts +213 -269
- package/src/Boolean.ts +146 -188
- package/src/Cache.ts +410 -256
- package/src/Cause.ts +167 -277
- package/src/Channel.ts +892 -817
- package/src/ChannelSchema.ts +1 -1
- package/src/Chunk.ts +841 -1181
- package/src/Clock.ts +181 -49
- package/src/Combiner.ts +20 -33
- package/src/Config.ts +636 -332
- package/src/ConfigProvider.ts +218 -121
- package/src/Console.ts +289 -39
- package/src/Context.ts +322 -381
- package/src/Cron.ts +68 -77
- package/src/Crypto.ts +30 -23
- package/src/Data.ts +60 -80
- package/src/DateTime.ts +564 -660
- package/src/Deferred.ts +253 -256
- package/src/Duration.ts +232 -310
- package/src/Effect.ts +3034 -3296
- package/src/Encoding.ts +22 -40
- package/src/Equal.ts +59 -41
- package/src/Equivalence.ts +103 -105
- package/src/ErrorReporter.ts +51 -27
- package/src/ExecutionPlan.ts +91 -56
- package/src/Exit.ts +116 -192
- package/src/Fiber.ts +81 -148
- package/src/FiberHandle.ts +152 -105
- package/src/FiberMap.ts +225 -174
- package/src/FiberSet.ts +125 -83
- package/src/FileSystem.ts +156 -264
- package/src/Filter.ts +61 -33
- package/src/Formatter.ts +54 -56
- package/src/Function.ts +82 -151
- package/src/Graph.ts +416 -770
- package/src/HKT.ts +12 -6
- package/src/Hash.ts +52 -83
- package/src/HashMap.ts +319 -411
- package/src/HashRing.ts +1 -0
- package/src/HashSet.ts +177 -284
- package/src/Inspectable.ts +12 -12
- package/src/Iterable.ts +631 -796
- package/src/JsonPatch.ts +58 -112
- package/src/JsonPointer.ts +8 -8
- package/src/JsonSchema.ts +402 -244
- package/src/Latch.ts +23 -35
- package/src/Layer.ts +366 -265
- package/src/LayerMap.ts +49 -29
- package/src/LayerRef.ts +6 -2
- package/src/LogLevel.ts +114 -214
- package/src/Logger.ts +344 -697
- package/src/ManagedRuntime.ts +7 -5
- package/src/Match.ts +217 -252
- package/src/Metric.ts +516 -1089
- package/src/MutableHashMap.ts +218 -255
- package/src/MutableHashSet.ts +84 -89
- package/src/MutableList.ts +73 -370
- package/src/MutableRef.ts +420 -243
- package/src/Newtype.ts +21 -14
- package/src/NonEmptyIterable.ts +7 -137
- package/src/Number.ts +196 -233
- package/src/Optic.ts +243 -383
- package/src/Option.ts +447 -812
- package/src/Order.ts +109 -109
- package/src/Ordering.ts +20 -23
- package/src/Path.ts +38 -41
- package/src/Pipeable.ts +6 -5
- package/src/PlatformError.ts +4 -4
- package/src/Pool.ts +4 -2
- package/src/Predicate.ts +200 -181
- package/src/PrimaryKey.ts +7 -7
- package/src/PubSub.ts +526 -552
- package/src/Pull.ts +24 -18
- package/src/Queue.ts +200 -159
- package/src/Random.ts +49 -74
- package/src/RcMap.ts +121 -63
- package/src/RcRef.ts +24 -13
- package/src/Record.ts +291 -488
- package/src/Redactable.ts +10 -3
- package/src/Redacted.ts +25 -25
- package/src/Reducer.ts +8 -15
- package/src/Ref.ts +221 -361
- package/src/References.ts +102 -168
- package/src/RegExp.ts +10 -14
- package/src/Request.ts +31 -21
- package/src/RequestResolver.ts +202 -91
- package/src/Result.ts +312 -484
- package/src/Runtime.ts +50 -75
- package/src/Schedule.ts +311 -1737
- package/src/Scheduler.ts +20 -7
- package/src/Schema.ts +766 -786
- package/src/SchemaAST.ts +522 -382
- package/src/SchemaError.ts +7 -6
- package/src/SchemaGetter.ts +242 -190
- package/src/SchemaIssue.ts +89 -275
- package/src/SchemaParser.ts +217 -124
- package/src/SchemaRepresentation.ts +22 -40
- package/src/SchemaTransformation.ts +129 -88
- package/src/Scope.ts +123 -151
- package/src/ScopedCache.ts +1 -1
- package/src/ScopedRef.ts +4 -4
- package/src/Semaphore.ts +152 -51
- package/src/Sink.ts +129 -114
- package/src/Stdio.ts +1 -1
- package/src/Stream.ts +2679 -3133
- package/src/String.ts +275 -312
- package/src/Struct.ts +109 -114
- package/src/SubscriptionRef.ts +284 -252
- package/src/Symbol.ts +3 -3
- package/src/SynchronizedRef.ts +1 -1
- package/src/Terminal.ts +3 -3
- package/src/Tracer.ts +102 -55
- package/src/Trie.ts +287 -679
- package/src/Tuple.ts +99 -131
- package/src/TxChunk.ts +201 -121
- package/src/TxDeferred.ts +62 -46
- package/src/TxHashMap.ts +645 -799
- package/src/TxHashSet.ts +443 -356
- package/src/TxPriorityQueue.ts +130 -98
- package/src/TxPubSub.ts +107 -80
- package/src/TxQueue.ts +214 -183
- package/src/TxReentrantLock.ts +136 -101
- package/src/TxRef.ts +51 -32
- package/src/TxSemaphore.ts +129 -95
- package/src/TxSubscriptionRef.ts +97 -70
- package/src/Types.ts +126 -67
- package/src/Unify.ts +45 -65
- package/src/Utils.ts +23 -16
- package/src/internal/core.ts +2 -2
- package/src/internal/dateTime.ts +7 -1
- package/src/internal/effect.ts +93 -48
- package/src/internal/executionPlan.ts +105 -10
- package/src/internal/hashMap.ts +20 -14
- package/src/internal/matcher.ts +2 -2
- package/src/internal/persistence.ts +2 -0
- package/src/internal/references.ts +3 -2
- package/src/internal/schedule.ts +4 -4
- package/src/internal/schema/annotations.ts +3 -0
- package/src/internal/schema/fromJsonSchemaDocument.ts +15 -13
- package/src/internal/schema/fromRepresentation.ts +10 -16
- package/src/internal/schema/parser.ts +22 -0
- package/src/internal/schema/toArbitrary.ts +3 -1
- package/src/internal/schema/toJsonSchemaDocument.ts +60 -6
- package/src/internal/schema/toRepresentation.ts +104 -119
- package/src/internal/trie.ts +21 -12
- package/src/testing/FastCheck.ts +8 -7
- package/src/testing/TestClock.ts +85 -31
- package/src/testing/TestConsole.ts +32 -31
- package/src/testing/TestSchema.ts +30 -30
- package/src/unstable/ai/AiError.ts +114 -137
- package/src/unstable/ai/AnthropicStructuredOutput.ts +1 -1
- package/src/unstable/ai/Chat.ts +133 -98
- package/src/unstable/ai/IdGenerator.ts +32 -28
- package/src/unstable/ai/LanguageModel.ts +111 -69
- package/src/unstable/ai/McpProtocol.ts +48 -0
- package/src/unstable/ai/McpSchema.ts +77 -66
- package/src/unstable/ai/McpServer.ts +931 -305
- package/src/unstable/ai/Model.ts +9 -20
- package/src/unstable/ai/OpenAiStructuredOutput.ts +1 -1
- package/src/unstable/ai/Prompt.ts +166 -49
- package/src/unstable/ai/Response.ts +28 -14
- package/src/unstable/ai/Telemetry.ts +46 -13
- package/src/unstable/ai/Tokenizer.ts +14 -3
- package/src/unstable/ai/Tool.ts +59 -44
- package/src/unstable/ai/Toolkit.ts +26 -8
- package/src/unstable/ai/index.ts +5 -0
- package/src/unstable/ai/internal/mcpProtocol.ts +85 -0
- package/src/unstable/ai/internal/mcpProtocolRegistry.ts +70 -0
- package/src/unstable/ai/internal/structured-output.ts +13 -18
- package/src/unstable/cli/Argument.ts +273 -69
- package/src/unstable/cli/CliError.ts +79 -86
- package/src/unstable/cli/CliOutput.ts +44 -58
- package/src/unstable/cli/Command.ts +716 -116
- package/src/unstable/cli/Flag.ts +418 -138
- package/src/unstable/cli/GlobalFlag.ts +1 -1
- package/src/unstable/cli/HelpDoc.ts +12 -4
- package/src/unstable/cli/Param.ts +333 -97
- package/src/unstable/cli/Primitive.ts +381 -154
- package/src/unstable/cli/Prompt.ts +64 -34
- package/src/unstable/cli/internal/ansi.ts +2 -2
- package/src/unstable/cli/internal/command.ts +15 -10
- package/src/unstable/cli/internal/completions/bash.ts +59 -9
- package/src/unstable/cli/internal/completions/descriptor.ts +14 -20
- package/src/unstable/cli/internal/completions/fish.ts +5 -7
- package/src/unstable/cli/internal/help.ts +4 -2
- package/src/unstable/cli/internal/lexer.ts +8 -2
- package/src/unstable/cli/internal/parser.ts +5 -5
- package/src/unstable/cli/internal/wizard.ts +2 -2
- package/src/unstable/cluster/ClusterError.ts +7 -7
- package/src/unstable/cluster/ClusterSchema.ts +8 -8
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +9 -2
- package/src/unstable/cluster/Entity.ts +15 -16
- package/src/unstable/cluster/EntityProxy.ts +4 -2
- package/src/unstable/cluster/EntityResource.ts +2 -2
- package/src/unstable/cluster/Envelope.ts +3 -3
- package/src/unstable/cluster/HttpRunner.ts +6 -4
- package/src/unstable/cluster/Message.ts +9 -9
- package/src/unstable/cluster/MessageStorage.ts +24 -20
- package/src/unstable/cluster/Reply.ts +25 -6
- package/src/unstable/cluster/RunnerHealth.ts +1 -1
- package/src/unstable/cluster/RunnerServer.ts +35 -8
- package/src/unstable/cluster/RunnerStorage.ts +11 -9
- package/src/unstable/cluster/Runners.ts +23 -12
- package/src/unstable/cluster/Sharding.ts +42 -15
- package/src/unstable/cluster/ShardingConfig.ts +3 -3
- package/src/unstable/cluster/SingletonAddress.ts +1 -1
- package/src/unstable/cluster/Snowflake.ts +8 -8
- package/src/unstable/cluster/SqlMessageStorage.ts +1 -1
- package/src/unstable/cluster/SqlRunnerStorage.ts +21 -5
- package/src/unstable/cluster/internal/entityManager.ts +12 -16
- package/src/unstable/cluster/internal/resourceMap.ts +5 -2
- package/src/unstable/cluster/internal/resourceRef.ts +27 -5
- package/src/unstable/devtools/DevToolsClient.ts +3 -2
- package/src/unstable/encoding/Ini.ts +174 -0
- package/src/unstable/encoding/Msgpack.ts +53 -36
- package/src/unstable/encoding/Ndjson.ts +9 -1
- package/src/unstable/encoding/Sse.ts +109 -37
- package/src/unstable/encoding/Toml.ts +504 -0
- package/src/unstable/encoding/Yaml.ts +541 -0
- package/src/unstable/encoding/index.ts +15 -0
- package/src/unstable/eventlog/Event.ts +20 -20
- package/src/unstable/eventlog/EventGroup.ts +4 -4
- package/src/unstable/eventlog/EventJournal.ts +29 -21
- package/src/unstable/eventlog/EventLog.ts +3 -3
- package/src/unstable/eventlog/EventLogEncryption.ts +1 -1
- package/src/unstable/eventlog/EventLogMessage.ts +3 -3
- package/src/unstable/eventlog/EventLogRemote.ts +1 -1
- package/src/unstable/eventlog/EventLogServer.ts +41 -7
- package/src/unstable/eventlog/EventLogServerEncrypted.ts +13 -5
- package/src/unstable/eventlog/EventLogServerUnencrypted.ts +15 -7
- package/src/unstable/eventlog/EventLogSessionAuth.ts +1 -1
- package/src/unstable/eventlog/SqlEventJournal.ts +6 -4
- package/src/unstable/http/Cookies.ts +35 -21
- package/src/unstable/http/Etag.ts +1 -1
- package/src/unstable/http/FetchHttpClient.ts +3 -1
- package/src/unstable/http/FindMyWay/internal/queryString.ts +420 -0
- package/src/unstable/http/FindMyWay/internal/router.ts +950 -0
- package/src/unstable/http/FindMyWay.ts +65 -6
- package/src/unstable/http/Headers.ts +2 -2
- package/src/unstable/http/HttpBody.ts +20 -5
- package/src/unstable/http/HttpClient.ts +83 -55
- package/src/unstable/http/HttpClientError.ts +1 -1
- package/src/unstable/http/HttpClientRequest.ts +2 -12
- package/src/unstable/http/HttpClientResponse.ts +5 -21
- package/src/unstable/http/HttpEffect.ts +8 -8
- package/src/unstable/http/HttpMethod.ts +6 -9
- package/src/unstable/http/HttpMiddleware.ts +202 -39
- package/src/unstable/http/HttpPlatform.ts +129 -6
- package/src/unstable/http/HttpRouter.ts +102 -98
- package/src/unstable/http/HttpServer.ts +13 -13
- package/src/unstable/http/HttpServerError.ts +2 -2
- package/src/unstable/http/HttpServerRequest.ts +18 -10
- package/src/unstable/http/HttpServerResponse.ts +38 -6
- package/src/unstable/http/HttpStaticServer.ts +35 -7
- package/src/unstable/http/Multipart.ts +15 -8
- package/src/unstable/http/MultipartParser/HeadersParser.ts +68 -0
- package/src/unstable/http/MultipartParser/Search.ts +17 -0
- package/src/unstable/http/MultipartParser/internal/contentType.ts +103 -0
- package/src/unstable/http/MultipartParser/internal/headers.ts +615 -0
- package/src/unstable/http/MultipartParser/internal/multipart.ts +262 -0
- package/src/unstable/http/MultipartParser/internal/search.ts +167 -0
- package/src/unstable/http/MultipartParser.ts +115 -0
- package/src/unstable/http/Template.ts +6 -5
- package/src/unstable/http/Url.ts +33 -63
- package/src/unstable/http/UrlParams.ts +10 -18
- package/src/unstable/http/index.ts +1 -1
- package/src/unstable/http/internal/compression.ts +196 -0
- package/src/unstable/http/internal/httpBody.ts +15 -0
- package/src/unstable/httpapi/HttpApi.ts +6 -7
- package/src/unstable/httpapi/HttpApiBuilder.ts +129 -30
- package/src/unstable/httpapi/HttpApiClient.ts +117 -54
- package/src/unstable/httpapi/HttpApiEndpoint.ts +159 -71
- package/src/unstable/httpapi/HttpApiError.ts +46 -52
- package/src/unstable/httpapi/HttpApiGroup.ts +15 -15
- package/src/unstable/httpapi/HttpApiMiddleware.ts +71 -24
- package/src/unstable/httpapi/HttpApiScalar.ts +0 -12
- package/src/unstable/httpapi/HttpApiSchema.ts +359 -6
- package/src/unstable/httpapi/OpenApi.ts +83 -33
- package/src/unstable/observability/OtlpExporter.ts +35 -21
- package/src/unstable/observability/OtlpLogger.ts +3 -1
- package/src/unstable/observability/OtlpMetrics.ts +36 -19
- package/src/unstable/observability/OtlpResource.ts +26 -17
- package/src/unstable/observability/OtlpTracer.ts +1 -1
- package/src/unstable/observability/PrometheusMetrics.ts +13 -4
- package/src/unstable/observability/internal/otlpEnv.ts +1 -1
- package/src/unstable/observability/internal/protobuf.ts +3 -0
- package/src/unstable/persistence/KeyValueStore.ts +72 -49
- package/src/unstable/persistence/Persistable.ts +8 -8
- package/src/unstable/persistence/PersistedQueue.ts +18 -15
- package/src/unstable/persistence/Persistence.ts +153 -26
- package/src/unstable/persistence/RateLimiter.ts +77 -43
- package/src/unstable/persistence/Redis.ts +3 -3
- package/src/unstable/process/ChildProcess.ts +64 -21
- package/src/unstable/process/ChildProcessSpawner.ts +21 -10
- package/src/unstable/reactivity/AsyncResult.ts +12 -13
- package/src/unstable/reactivity/Atom.ts +28 -25
- package/src/unstable/reactivity/AtomHttpApi.ts +5 -4
- package/src/unstable/reactivity/AtomRegistry.ts +24 -3
- package/src/unstable/reactivity/AtomRpc.ts +5 -4
- package/src/unstable/reactivity/Hydration.ts +1 -1
- package/src/unstable/rpc/Rpc.ts +35 -33
- package/src/unstable/rpc/RpcClient.ts +54 -27
- package/src/unstable/rpc/RpcClientError.ts +2 -2
- package/src/unstable/rpc/RpcGroup.ts +8 -8
- package/src/unstable/rpc/RpcMessage.ts +31 -30
- package/src/unstable/rpc/RpcMiddleware.ts +10 -10
- package/src/unstable/rpc/RpcSchema.ts +4 -4
- package/src/unstable/rpc/RpcSerialization.ts +167 -68
- package/src/unstable/rpc/RpcServer.ts +18 -15
- package/src/unstable/rpc/RpcWorker.ts +5 -5
- package/src/unstable/schema/Model.ts +52 -50
- package/src/unstable/schema/VariantSchema.ts +41 -23
- package/src/unstable/socket/Socket.ts +41 -18
- package/src/unstable/sql/SqlClient.ts +64 -56
- package/src/unstable/sql/SqlError.ts +13 -13
- package/src/unstable/sql/SqlModel.ts +2 -2
- package/src/unstable/sql/SqlResolver.ts +13 -11
- package/src/unstable/sql/Statement.ts +37 -31
- package/src/unstable/workers/Transferable.ts +1 -1
- package/src/unstable/workers/Worker.ts +2 -2
- package/src/unstable/workers/WorkerError.ts +12 -12
- package/src/unstable/workers/WorkerRunner.ts +1 -1
- package/src/unstable/workflow/Activity.ts +2 -2
- package/src/unstable/workflow/DurableClock.ts +1 -1
- package/src/unstable/workflow/DurableDeferred.ts +10 -10
- package/src/unstable/workflow/DurableQueue.ts +22 -20
- package/src/unstable/workflow/Workflow.ts +23 -23
- package/src/unstable/workflow/WorkflowEngine.ts +9 -4
- package/src/unstable/workflow/WorkflowProxy.ts +4 -2
- package/dist/internal/version.d.ts +0 -3
- package/dist/internal/version.d.ts.map +0 -1
- package/dist/internal/version.js +0 -2
- package/dist/internal/version.js.map +0 -1
- package/dist/unstable/http/Multipasta/HeadersParser.d.ts +0 -14
- package/dist/unstable/http/Multipasta/HeadersParser.d.ts.map +0 -1
- package/dist/unstable/http/Multipasta/HeadersParser.js +0 -14
- package/dist/unstable/http/Multipasta/HeadersParser.js.map +0 -1
- package/dist/unstable/http/Multipasta/Node.d.ts +0 -14
- package/dist/unstable/http/Multipasta/Node.d.ts.map +0 -1
- package/dist/unstable/http/Multipasta/Node.js +0 -14
- package/dist/unstable/http/Multipasta/Node.js.map +0 -1
- package/dist/unstable/http/Multipasta/Search.d.ts +0 -14
- package/dist/unstable/http/Multipasta/Search.d.ts.map +0 -1
- package/dist/unstable/http/Multipasta/Search.js +0 -14
- package/dist/unstable/http/Multipasta/Search.js.map +0 -1
- package/dist/unstable/http/Multipasta/Web.d.ts +0 -14
- package/dist/unstable/http/Multipasta/Web.d.ts.map +0 -1
- package/dist/unstable/http/Multipasta/Web.js +0 -14
- package/dist/unstable/http/Multipasta/Web.js.map +0 -1
- package/dist/unstable/http/Multipasta.d.ts +0 -15
- package/dist/unstable/http/Multipasta.d.ts.map +0 -1
- package/dist/unstable/http/Multipasta.js +0 -15
- package/dist/unstable/http/Multipasta.js.map +0 -1
- package/src/internal/version.ts +0 -2
- package/src/unstable/http/Multipasta/HeadersParser.ts +0 -14
- package/src/unstable/http/Multipasta/Node.ts +0 -14
- package/src/unstable/http/Multipasta/Search.ts +0 -14
- package/src/unstable/http/Multipasta/Web.ts +0 -14
- package/src/unstable/http/Multipasta.ts +0 -15
package/src/PubSub.ts
CHANGED
|
@@ -35,26 +35,27 @@ const TypeId = "~effect/PubSub"
|
|
|
35
35
|
*
|
|
36
36
|
* **Example** (Publishing and subscribing to messages)
|
|
37
37
|
*
|
|
38
|
-
* ```ts
|
|
38
|
+
* ```ts import.meta.vitest
|
|
39
39
|
* import { Effect, PubSub } from "effect"
|
|
40
40
|
*
|
|
41
|
-
* const program = Effect.gen(function*() {
|
|
41
|
+
* const program = Effect.scoped(Effect.gen(function*() {
|
|
42
42
|
* // Create a bounded PubSub with capacity 10
|
|
43
43
|
* const pubsub = yield* PubSub.bounded<string>(10)
|
|
44
44
|
*
|
|
45
45
|
* // Subscribe and consume messages
|
|
46
|
-
* yield*
|
|
47
|
-
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
46
|
+
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
48
47
|
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
48
|
+
* // Publish messages
|
|
49
|
+
* yield* PubSub.publish(pubsub, "Hello")
|
|
50
|
+
* yield* PubSub.publish(pubsub, "World")
|
|
52
51
|
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
52
|
+
* const message1 = yield* PubSub.take(subscription)
|
|
53
|
+
* const message2 = yield* PubSub.take(subscription)
|
|
54
|
+
* return [message1, message2]
|
|
55
|
+
* }))
|
|
56
|
+
*
|
|
57
|
+
* const actual = await Effect.runPromise(program)
|
|
58
|
+
* actual // => ["Hello", "World"]
|
|
58
59
|
* ```
|
|
59
60
|
*
|
|
60
61
|
* @category models
|
|
@@ -139,6 +140,7 @@ export declare namespace PubSub {
|
|
|
139
140
|
take(): A | undefined
|
|
140
141
|
takeN(n: number): Array<A>
|
|
141
142
|
takeAll(): Array<A>
|
|
143
|
+
close(): void
|
|
142
144
|
readonly remaining: number
|
|
143
145
|
}
|
|
144
146
|
|
|
@@ -204,31 +206,28 @@ const SubscriptionTypeId = "~effect/PubSub/Subscription"
|
|
|
204
206
|
*
|
|
205
207
|
* **Example** (Taking messages from a subscription)
|
|
206
208
|
*
|
|
207
|
-
* ```ts
|
|
209
|
+
* ```ts import.meta.vitest
|
|
208
210
|
* import { Effect, PubSub } from "effect"
|
|
209
211
|
*
|
|
210
|
-
* const program = Effect.gen(function*() {
|
|
212
|
+
* const program = Effect.scoped(Effect.gen(function*() {
|
|
211
213
|
* const pubsub = yield* PubSub.bounded<string>(10)
|
|
212
214
|
*
|
|
213
215
|
* // Subscribe within a scope for automatic cleanup
|
|
214
|
-
* yield*
|
|
215
|
-
*
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
*
|
|
220
|
-
*
|
|
221
|
-
*
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
*
|
|
225
|
-
*
|
|
226
|
-
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
* console.log(allMessages) // ["msg3"]
|
|
230
|
-
* }))
|
|
231
|
-
* })
|
|
216
|
+
* const subscription: PubSub.Subscription<string> = yield* PubSub.subscribe(pubsub)
|
|
217
|
+
*
|
|
218
|
+
* yield* PubSub.publishAll(pubsub, ["msg1", "msg2", "msg3"])
|
|
219
|
+
*
|
|
220
|
+
* // Take individual messages
|
|
221
|
+
* const message = yield* PubSub.take(subscription)
|
|
222
|
+
*
|
|
223
|
+
* // Take multiple messages
|
|
224
|
+
* const messages = yield* PubSub.takeUpTo(subscription, 1)
|
|
225
|
+
* const allMessages = yield* PubSub.takeAll(subscription)
|
|
226
|
+
* return { message, messages, allMessages }
|
|
227
|
+
* }))
|
|
228
|
+
*
|
|
229
|
+
* const actual = await Effect.runPromise(program)
|
|
230
|
+
* actual // => { message: "msg1", messages: ["msg2"], allMessages: ["msg3"] }
|
|
232
231
|
* ```
|
|
233
232
|
*
|
|
234
233
|
* @category models
|
|
@@ -253,7 +252,7 @@ export interface Subscription<out A> extends Pipeable {
|
|
|
253
252
|
*
|
|
254
253
|
* **Example** (Creating a PubSub with a custom strategy)
|
|
255
254
|
*
|
|
256
|
-
* ```ts
|
|
255
|
+
* ```ts import.meta.vitest
|
|
257
256
|
* import { Effect, PubSub } from "effect"
|
|
258
257
|
*
|
|
259
258
|
* const program = Effect.gen(function*() {
|
|
@@ -264,8 +263,13 @@ export interface Subscription<out A> extends Pipeable {
|
|
|
264
263
|
* })
|
|
265
264
|
*
|
|
266
265
|
* // Use the created PubSub
|
|
267
|
-
* yield* PubSub.publish(pubsub, "Hello")
|
|
266
|
+
* const published = yield* PubSub.publish(pubsub, "Hello")
|
|
267
|
+
* yield* PubSub.shutdown(pubsub)
|
|
268
|
+
* return published
|
|
268
269
|
* })
|
|
270
|
+
*
|
|
271
|
+
* const actual = await Effect.runPromise(program)
|
|
272
|
+
* actual // => true
|
|
269
273
|
* ```
|
|
270
274
|
*
|
|
271
275
|
* @category constructors
|
|
@@ -301,7 +305,7 @@ export const make = <A>(
|
|
|
301
305
|
*
|
|
302
306
|
* **Example** (Creating a bounded PubSub)
|
|
303
307
|
*
|
|
304
|
-
* ```ts
|
|
308
|
+
* ```ts import.meta.vitest
|
|
305
309
|
* import { Effect, PubSub } from "effect"
|
|
306
310
|
*
|
|
307
311
|
* const program = Effect.gen(function*() {
|
|
@@ -313,7 +317,15 @@ export const make = <A>(
|
|
|
313
317
|
* capacity: 100,
|
|
314
318
|
* replay: 10 // Last 10 messages replayed to new subscribers
|
|
315
319
|
* })
|
|
320
|
+
*
|
|
321
|
+
* const capacities = [PubSub.capacity(pubsub), PubSub.capacity(pubsubWithReplay)]
|
|
322
|
+
* yield* PubSub.shutdown(pubsub)
|
|
323
|
+
* yield* PubSub.shutdown(pubsubWithReplay)
|
|
324
|
+
* return capacities
|
|
316
325
|
* })
|
|
326
|
+
*
|
|
327
|
+
* const actual = await Effect.runPromise(program)
|
|
328
|
+
* actual // => [100, 100]
|
|
317
329
|
* ```
|
|
318
330
|
*
|
|
319
331
|
* @category constructors
|
|
@@ -340,33 +352,27 @@ export const bounded = <A>(
|
|
|
340
352
|
*
|
|
341
353
|
* **Example** (Dropping messages when full)
|
|
342
354
|
*
|
|
343
|
-
* ```ts
|
|
355
|
+
* ```ts import.meta.vitest
|
|
344
356
|
* import { Effect, PubSub } from "effect"
|
|
345
357
|
*
|
|
346
|
-
* const program = Effect.gen(function*() {
|
|
358
|
+
* const program = Effect.scoped(Effect.gen(function*() {
|
|
347
359
|
* // Create dropping PubSub that drops new messages when full
|
|
348
360
|
* const pubsub = yield* PubSub.dropping<string>(3)
|
|
349
361
|
*
|
|
350
|
-
*
|
|
351
|
-
* const pubsubWithReplay = yield* PubSub.dropping<string>({
|
|
352
|
-
* capacity: 3,
|
|
353
|
-
* replay: 5
|
|
354
|
-
* })
|
|
362
|
+
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
355
363
|
*
|
|
356
|
-
*
|
|
357
|
-
*
|
|
364
|
+
* // Fill the PubSub and see dropping behavior
|
|
365
|
+
* yield* PubSub.publish(pubsub, "msg1") // succeeds
|
|
366
|
+
* yield* PubSub.publish(pubsub, "msg2") // succeeds
|
|
367
|
+
* yield* PubSub.publish(pubsub, "msg3") // succeeds
|
|
368
|
+
* const dropped = yield* PubSub.publish(pubsub, "msg4") // returns false (dropped)
|
|
358
369
|
*
|
|
359
|
-
*
|
|
360
|
-
*
|
|
361
|
-
*
|
|
362
|
-
* yield* PubSub.publish(pubsub, "msg3") // succeeds
|
|
363
|
-
* const dropped = yield* PubSub.publish(pubsub, "msg4") // returns false (dropped)
|
|
364
|
-
* console.log("Message dropped:", !dropped) // true
|
|
370
|
+
* const messages = yield* PubSub.takeAll(subscription)
|
|
371
|
+
* return { dropped: !dropped, messages }
|
|
372
|
+
* }))
|
|
365
373
|
*
|
|
366
|
-
*
|
|
367
|
-
*
|
|
368
|
-
* }))
|
|
369
|
-
* })
|
|
374
|
+
* const actual = await Effect.runPromise(program)
|
|
375
|
+
* actual // => { dropped: true, messages: ["msg1", "msg2", "msg3"] }
|
|
370
376
|
* ```
|
|
371
377
|
*
|
|
372
378
|
* @category constructors
|
|
@@ -393,32 +399,26 @@ export const dropping = <A>(
|
|
|
393
399
|
*
|
|
394
400
|
* **Example** (Sliding old messages when full)
|
|
395
401
|
*
|
|
396
|
-
* ```ts
|
|
402
|
+
* ```ts import.meta.vitest
|
|
397
403
|
* import { Effect, PubSub } from "effect"
|
|
398
404
|
*
|
|
399
|
-
* const program = Effect.gen(function*() {
|
|
405
|
+
* const program = Effect.scoped(Effect.gen(function*() {
|
|
400
406
|
* // Create sliding PubSub that evicts old messages when full
|
|
401
407
|
* const pubsub = yield* PubSub.sliding<string>(3)
|
|
402
408
|
*
|
|
403
|
-
*
|
|
404
|
-
* const pubsubWithReplay = yield* PubSub.sliding<string>({
|
|
405
|
-
* capacity: 3,
|
|
406
|
-
* replay: 2
|
|
407
|
-
* })
|
|
409
|
+
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
408
410
|
*
|
|
409
|
-
*
|
|
410
|
-
*
|
|
411
|
+
* // Fill and overflow the PubSub
|
|
412
|
+
* yield* PubSub.publish(pubsub, "msg1")
|
|
413
|
+
* yield* PubSub.publish(pubsub, "msg2")
|
|
414
|
+
* yield* PubSub.publish(pubsub, "msg3")
|
|
415
|
+
* yield* PubSub.publish(pubsub, "msg4") // "msg1" is evicted
|
|
411
416
|
*
|
|
412
|
-
*
|
|
413
|
-
*
|
|
414
|
-
* yield* PubSub.publish(pubsub, "msg2")
|
|
415
|
-
* yield* PubSub.publish(pubsub, "msg3")
|
|
416
|
-
* yield* PubSub.publish(pubsub, "msg4") // "msg1" is evicted
|
|
417
|
+
* return yield* PubSub.takeAll(subscription)
|
|
418
|
+
* }))
|
|
417
419
|
*
|
|
418
|
-
*
|
|
419
|
-
*
|
|
420
|
-
* }))
|
|
421
|
-
* })
|
|
420
|
+
* const actual = await Effect.runPromise(program)
|
|
421
|
+
* actual // => ["msg2", "msg3", "msg4"]
|
|
422
422
|
* ```
|
|
423
423
|
*
|
|
424
424
|
* @category constructors
|
|
@@ -440,30 +440,25 @@ export const sliding = <A>(
|
|
|
440
440
|
*
|
|
441
441
|
* **Example** (Creating an unbounded PubSub)
|
|
442
442
|
*
|
|
443
|
-
* ```ts
|
|
443
|
+
* ```ts import.meta.vitest
|
|
444
444
|
* import { Effect, PubSub } from "effect"
|
|
445
445
|
*
|
|
446
|
-
* const program = Effect.gen(function*() {
|
|
446
|
+
* const program = Effect.scoped(Effect.gen(function*() {
|
|
447
447
|
* // Create unbounded PubSub
|
|
448
448
|
* const pubsub = yield* PubSub.unbounded<string>()
|
|
449
449
|
*
|
|
450
|
-
*
|
|
451
|
-
* const pubsubWithReplay = yield* PubSub.unbounded<string>({
|
|
452
|
-
* replay: 10
|
|
453
|
-
* })
|
|
450
|
+
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
454
451
|
*
|
|
455
|
-
*
|
|
456
|
-
*
|
|
452
|
+
* // Can publish unlimited messages
|
|
453
|
+
* for (let i = 0; i < 3; i++) {
|
|
454
|
+
* yield* PubSub.publish(pubsub, `message-${i}`)
|
|
455
|
+
* }
|
|
457
456
|
*
|
|
458
|
-
*
|
|
459
|
-
*
|
|
460
|
-
* yield* PubSub.publish(pubsub, `message-${i}`)
|
|
461
|
-
* }
|
|
457
|
+
* return yield* PubSub.takeAll(subscription)
|
|
458
|
+
* }))
|
|
462
459
|
*
|
|
463
|
-
*
|
|
464
|
-
*
|
|
465
|
-
* }))
|
|
466
|
-
* })
|
|
460
|
+
* const actual = await Effect.runPromise(program)
|
|
461
|
+
* actual // => ["message-0", "message-1", "message-2"]
|
|
467
462
|
* ```
|
|
468
463
|
*
|
|
469
464
|
* @category constructors
|
|
@@ -552,18 +547,17 @@ export const makeAtomicUnbounded = <A>(options?: {
|
|
|
552
547
|
*
|
|
553
548
|
* **Example** (Getting PubSub capacity)
|
|
554
549
|
*
|
|
555
|
-
* ```ts
|
|
550
|
+
* ```ts import.meta.vitest
|
|
556
551
|
* import { Effect, PubSub } from "effect"
|
|
557
552
|
*
|
|
558
553
|
* const program = Effect.gen(function*() {
|
|
559
554
|
* const pubsub = yield* PubSub.bounded<string>(100)
|
|
560
|
-
* const cap = PubSub.capacity(pubsub)
|
|
561
|
-
* console.log("PubSub capacity:", cap) // 100
|
|
562
|
-
*
|
|
563
555
|
* const unboundedPubsub = yield* PubSub.unbounded<string>()
|
|
564
|
-
*
|
|
565
|
-
* console.log("Unbounded capacity:", unboundedCap) // Number.MAX_SAFE_INTEGER
|
|
556
|
+
* return [PubSub.capacity(pubsub), PubSub.capacity(unboundedPubsub)]
|
|
566
557
|
* })
|
|
558
|
+
*
|
|
559
|
+
* const actual = await Effect.runPromise(program)
|
|
560
|
+
* actual // => [100, Number.MAX_SAFE_INTEGER]
|
|
567
561
|
* ```
|
|
568
562
|
*
|
|
569
563
|
* @category getters
|
|
@@ -582,29 +576,28 @@ export const capacity = <A>(self: PubSub<A>): number => self.pubsub.capacity
|
|
|
582
576
|
*
|
|
583
577
|
* **Example** (Getting PubSub size)
|
|
584
578
|
*
|
|
585
|
-
* ```ts
|
|
579
|
+
* ```ts import.meta.vitest
|
|
586
580
|
* import { Effect, PubSub } from "effect"
|
|
587
581
|
*
|
|
588
|
-
* const program = Effect.gen(function*() {
|
|
582
|
+
* const program = Effect.scoped(Effect.gen(function*() {
|
|
589
583
|
* const pubsub = yield* PubSub.bounded<string>(10)
|
|
590
584
|
*
|
|
591
585
|
* // Initially empty
|
|
592
586
|
* const initialSize = yield* PubSub.size(pubsub)
|
|
593
|
-
* console.log("Initial size:", initialSize) // 0
|
|
594
587
|
*
|
|
595
|
-
* yield*
|
|
596
|
-
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
588
|
+
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
597
589
|
*
|
|
598
|
-
*
|
|
599
|
-
*
|
|
600
|
-
*
|
|
590
|
+
* // Publish some messages for the active subscription
|
|
591
|
+
* yield* PubSub.publish(pubsub, "msg1")
|
|
592
|
+
* yield* PubSub.publish(pubsub, "msg2")
|
|
601
593
|
*
|
|
602
|
-
*
|
|
603
|
-
*
|
|
594
|
+
* const afterPublish = yield* PubSub.size(pubsub)
|
|
595
|
+
* const messages = yield* PubSub.takeAll(subscription)
|
|
596
|
+
* return { initialSize, afterPublish, messages }
|
|
597
|
+
* }))
|
|
604
598
|
*
|
|
605
|
-
*
|
|
606
|
-
*
|
|
607
|
-
* })
|
|
599
|
+
* const actual = await Effect.runPromise(program)
|
|
600
|
+
* actual // => { initialSize: 0, afterPublish: 2, messages: ["msg1", "msg2"] }
|
|
608
601
|
* ```
|
|
609
602
|
*
|
|
610
603
|
* @category getters
|
|
@@ -627,14 +620,16 @@ export const size = <A>(self: PubSub<A>): Effect.Effect<number> => Effect.sync((
|
|
|
627
620
|
*
|
|
628
621
|
* **Example** (Reading size synchronously)
|
|
629
622
|
*
|
|
630
|
-
* ```ts
|
|
631
|
-
* import { PubSub } from "effect"
|
|
623
|
+
* ```ts import.meta.vitest
|
|
624
|
+
* import { Effect, PubSub } from "effect"
|
|
632
625
|
*
|
|
633
|
-
*
|
|
634
|
-
*
|
|
626
|
+
* const program = Effect.gen(function*() {
|
|
627
|
+
* const pubsub = yield* PubSub.bounded<string>(2)
|
|
628
|
+
* return PubSub.sizeUnsafe(pubsub)
|
|
629
|
+
* })
|
|
635
630
|
*
|
|
636
|
-
* const
|
|
637
|
-
*
|
|
631
|
+
* const actual = await Effect.runPromise(program)
|
|
632
|
+
* actual // => 0
|
|
638
633
|
* ```
|
|
639
634
|
*
|
|
640
635
|
* @category getters
|
|
@@ -656,29 +651,28 @@ export const sizeUnsafe = <A>(self: PubSub<A>): number => {
|
|
|
656
651
|
*
|
|
657
652
|
* **Example** (Checking whether a PubSub is full)
|
|
658
653
|
*
|
|
659
|
-
* ```ts
|
|
654
|
+
* ```ts import.meta.vitest
|
|
660
655
|
* import { Effect, PubSub } from "effect"
|
|
661
656
|
*
|
|
662
|
-
* const program = Effect.gen(function*() {
|
|
657
|
+
* const program = Effect.scoped(Effect.gen(function*() {
|
|
663
658
|
* const pubsub = yield* PubSub.bounded<string>(2)
|
|
664
659
|
*
|
|
665
660
|
* // Initially not full
|
|
666
661
|
* const initiallyFull = yield* PubSub.isFull(pubsub)
|
|
667
|
-
* console.log("Initially full:", initiallyFull) // false
|
|
668
662
|
*
|
|
669
|
-
* yield*
|
|
670
|
-
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
663
|
+
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
671
664
|
*
|
|
672
|
-
*
|
|
673
|
-
*
|
|
674
|
-
*
|
|
665
|
+
* // Fill the PubSub for the active subscription
|
|
666
|
+
* yield* PubSub.publish(pubsub, "msg1")
|
|
667
|
+
* yield* PubSub.publish(pubsub, "msg2")
|
|
675
668
|
*
|
|
676
|
-
*
|
|
677
|
-
*
|
|
669
|
+
* const nowFull = yield* PubSub.isFull(pubsub)
|
|
670
|
+
* const messages = yield* PubSub.takeAll(subscription)
|
|
671
|
+
* return { initiallyFull, nowFull, messages }
|
|
672
|
+
* }))
|
|
678
673
|
*
|
|
679
|
-
*
|
|
680
|
-
*
|
|
681
|
-
* })
|
|
674
|
+
* const actual = await Effect.runPromise(program)
|
|
675
|
+
* actual // => { initiallyFull: false, nowFull: true, messages: ["msg1", "msg2"] }
|
|
682
676
|
* ```
|
|
683
677
|
*
|
|
684
678
|
* @category predicates
|
|
@@ -692,28 +686,27 @@ export const isFull = <A>(self: PubSub<A>): Effect.Effect<boolean> =>
|
|
|
692
686
|
*
|
|
693
687
|
* **Example** (Checking whether a PubSub is empty)
|
|
694
688
|
*
|
|
695
|
-
* ```ts
|
|
689
|
+
* ```ts import.meta.vitest
|
|
696
690
|
* import { Effect, PubSub } from "effect"
|
|
697
691
|
*
|
|
698
|
-
* const program = Effect.gen(function*() {
|
|
692
|
+
* const program = Effect.scoped(Effect.gen(function*() {
|
|
699
693
|
* const pubsub = yield* PubSub.bounded<string>(10)
|
|
700
694
|
*
|
|
701
695
|
* // Initially empty
|
|
702
696
|
* const initiallyEmpty = yield* PubSub.isEmpty(pubsub)
|
|
703
|
-
* console.log("Initially empty:", initiallyEmpty) // true
|
|
704
697
|
*
|
|
705
|
-
* yield*
|
|
706
|
-
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
698
|
+
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
707
699
|
*
|
|
708
|
-
*
|
|
709
|
-
*
|
|
700
|
+
* // Publish a message for the active subscription
|
|
701
|
+
* yield* PubSub.publish(pubsub, "Hello")
|
|
710
702
|
*
|
|
711
|
-
*
|
|
712
|
-
*
|
|
703
|
+
* const nowEmpty = yield* PubSub.isEmpty(pubsub)
|
|
704
|
+
* const message = yield* PubSub.take(subscription)
|
|
705
|
+
* return { initiallyEmpty, nowEmpty, message }
|
|
706
|
+
* }))
|
|
713
707
|
*
|
|
714
|
-
*
|
|
715
|
-
*
|
|
716
|
-
* })
|
|
708
|
+
* const actual = await Effect.runPromise(program)
|
|
709
|
+
* actual // => { initiallyEmpty: true, nowEmpty: false, message: "Hello" }
|
|
717
710
|
* ```
|
|
718
711
|
*
|
|
719
712
|
* @category predicates
|
|
@@ -733,7 +726,7 @@ export const isEmpty = <A>(self: PubSub<A>): Effect.Effect<boolean> => Effect.ma
|
|
|
733
726
|
*
|
|
734
727
|
* **Example** (Shutting down a PubSub)
|
|
735
728
|
*
|
|
736
|
-
* ```ts
|
|
729
|
+
* ```ts import.meta.vitest
|
|
737
730
|
* import { Effect, PubSub } from "effect"
|
|
738
731
|
*
|
|
739
732
|
* const program = Effect.gen(function*() {
|
|
@@ -743,12 +736,14 @@ export const isEmpty = <A>(self: PubSub<A>): Effect.Effect<boolean> => Effect.ma
|
|
|
743
736
|
* yield* PubSub.shutdown(pubsub)
|
|
744
737
|
*
|
|
745
738
|
* const isShutdown = yield* PubSub.isShutdown(pubsub)
|
|
746
|
-
* console.log("Is shutdown:", isShutdown) // true
|
|
747
739
|
*
|
|
748
740
|
* // Publishing after shutdown returns false
|
|
749
741
|
* const published = yield* PubSub.publish(pubsub, "msg1")
|
|
750
|
-
*
|
|
742
|
+
* return { isShutdown, published }
|
|
751
743
|
* })
|
|
744
|
+
*
|
|
745
|
+
* const actual = await Effect.runPromise(program)
|
|
746
|
+
* actual // => { isShutdown: true, published: false }
|
|
752
747
|
* ```
|
|
753
748
|
*
|
|
754
749
|
* @category lifecycle
|
|
@@ -770,7 +765,7 @@ export const shutdown = <A>(self: PubSub<A>): Effect.Effect<void> =>
|
|
|
770
765
|
*
|
|
771
766
|
* **Example** (Checking whether a PubSub is shut down)
|
|
772
767
|
*
|
|
773
|
-
* ```ts
|
|
768
|
+
* ```ts import.meta.vitest
|
|
774
769
|
* import { Effect, PubSub } from "effect"
|
|
775
770
|
*
|
|
776
771
|
* const program = Effect.gen(function*() {
|
|
@@ -778,14 +773,16 @@ export const shutdown = <A>(self: PubSub<A>): Effect.Effect<void> =>
|
|
|
778
773
|
*
|
|
779
774
|
* // Initially not shutdown
|
|
780
775
|
* const initiallyShutdown = yield* PubSub.isShutdown(pubsub)
|
|
781
|
-
* console.log("Initially shutdown:", initiallyShutdown) // false
|
|
782
776
|
*
|
|
783
777
|
* // Shutdown the PubSub
|
|
784
778
|
* yield* PubSub.shutdown(pubsub)
|
|
785
779
|
*
|
|
786
780
|
* const nowShutdown = yield* PubSub.isShutdown(pubsub)
|
|
787
|
-
*
|
|
781
|
+
* return [initiallyShutdown, nowShutdown]
|
|
788
782
|
* })
|
|
783
|
+
*
|
|
784
|
+
* const actual = await Effect.runPromise(program)
|
|
785
|
+
* actual // => [false, true]
|
|
789
786
|
* ```
|
|
790
787
|
*
|
|
791
788
|
* @category predicates
|
|
@@ -804,18 +801,18 @@ export const isShutdown = <A>(self: PubSub<A>): Effect.Effect<boolean> => Effect
|
|
|
804
801
|
*
|
|
805
802
|
* **Example** (Checking shutdown synchronously)
|
|
806
803
|
*
|
|
807
|
-
* ```ts
|
|
808
|
-
* import { PubSub } from "effect"
|
|
804
|
+
* ```ts import.meta.vitest
|
|
805
|
+
* import { Effect, PubSub } from "effect"
|
|
809
806
|
*
|
|
810
|
-
*
|
|
807
|
+
* const program = Effect.gen(function*() {
|
|
808
|
+
* const pubsub = yield* PubSub.bounded<string>(2)
|
|
809
|
+
* const initiallyShutdown = PubSub.isShutdownUnsafe(pubsub)
|
|
810
|
+
* yield* PubSub.shutdown(pubsub)
|
|
811
|
+
* return [initiallyShutdown, PubSub.isShutdownUnsafe(pubsub)]
|
|
812
|
+
* })
|
|
811
813
|
*
|
|
812
|
-
*
|
|
813
|
-
*
|
|
814
|
-
* if (isDown) {
|
|
815
|
-
* console.log("PubSub is shutdown, cannot publish")
|
|
816
|
-
* } else {
|
|
817
|
-
* console.log("PubSub is active")
|
|
818
|
-
* }
|
|
814
|
+
* const actual = await Effect.runPromise(program)
|
|
815
|
+
* actual // => [false, true]
|
|
819
816
|
* ```
|
|
820
817
|
*
|
|
821
818
|
* @category predicates
|
|
@@ -830,7 +827,7 @@ export const isShutdownUnsafe = <A>(self: PubSub<A>): boolean => self.shutdownFl
|
|
|
830
827
|
*
|
|
831
828
|
* **Example** (Waiting for shutdown)
|
|
832
829
|
*
|
|
833
|
-
* ```ts
|
|
830
|
+
* ```ts import.meta.vitest
|
|
834
831
|
* import { Effect, Fiber, PubSub } from "effect"
|
|
835
832
|
*
|
|
836
833
|
* const program = Effect.gen(function*() {
|
|
@@ -840,19 +837,19 @@ export const isShutdownUnsafe = <A>(self: PubSub<A>): boolean => self.shutdownFl
|
|
|
840
837
|
* const waiterFiber = yield* Effect.forkChild(
|
|
841
838
|
* Effect.gen(function*() {
|
|
842
839
|
* yield* PubSub.awaitShutdown(pubsub)
|
|
843
|
-
*
|
|
840
|
+
* return "PubSub has been shutdown!"
|
|
844
841
|
* })
|
|
845
842
|
* )
|
|
846
843
|
*
|
|
847
|
-
* // Do some work...
|
|
848
|
-
* yield* Effect.sleep("100 millis")
|
|
849
|
-
*
|
|
850
844
|
* // Shutdown the PubSub
|
|
851
845
|
* yield* PubSub.shutdown(pubsub)
|
|
852
846
|
*
|
|
853
847
|
* // The waiter will now complete
|
|
854
|
-
* yield* Fiber.join(waiterFiber)
|
|
848
|
+
* return yield* Fiber.join(waiterFiber)
|
|
855
849
|
* })
|
|
850
|
+
*
|
|
851
|
+
* const actual = await Effect.runPromise(program)
|
|
852
|
+
* actual // => "PubSub has been shutdown!"
|
|
856
853
|
* ```
|
|
857
854
|
*
|
|
858
855
|
* @category lifecycle
|
|
@@ -877,24 +874,24 @@ export const awaitShutdown = <A>(self: PubSub<A>): Effect.Effect<void> => self.s
|
|
|
877
874
|
*
|
|
878
875
|
* **Example** (Publishing a message)
|
|
879
876
|
*
|
|
880
|
-
* ```ts
|
|
877
|
+
* ```ts import.meta.vitest
|
|
881
878
|
* import { Effect, PubSub } from "effect"
|
|
882
879
|
*
|
|
883
|
-
* const program = Effect.gen(function*() {
|
|
880
|
+
* const program = Effect.scoped(Effect.gen(function*() {
|
|
884
881
|
* const pubsub = yield* PubSub.bounded<string>(10)
|
|
885
882
|
*
|
|
886
883
|
* // Publish a message
|
|
887
884
|
* const published = yield* PubSub.publish(pubsub, "Hello World")
|
|
888
|
-
* console.log("Message published:", published) // true
|
|
889
885
|
*
|
|
890
|
-
* yield*
|
|
891
|
-
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
886
|
+
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
892
887
|
*
|
|
893
|
-
*
|
|
894
|
-
*
|
|
895
|
-
*
|
|
896
|
-
*
|
|
897
|
-
*
|
|
888
|
+
* yield* PubSub.publish(pubsub, "Hello")
|
|
889
|
+
* const message = yield* PubSub.take(subscription)
|
|
890
|
+
* return { published, message }
|
|
891
|
+
* }))
|
|
892
|
+
*
|
|
893
|
+
* const actual = await Effect.runPromise(program)
|
|
894
|
+
* actual // => { published: true, message: "Hello" }
|
|
898
895
|
* ```
|
|
899
896
|
*
|
|
900
897
|
* @see {@link publishUnsafe} for a synchronous non-blocking attempt that does not run effectful surplus handling
|
|
@@ -920,24 +917,24 @@ export const publish: {
|
|
|
920
917
|
*
|
|
921
918
|
* **Example** (Publishing a message)
|
|
922
919
|
*
|
|
923
|
-
* ```ts
|
|
920
|
+
* ```ts import.meta.vitest
|
|
924
921
|
* import { Effect, PubSub } from "effect"
|
|
925
922
|
*
|
|
926
|
-
* const program = Effect.gen(function*() {
|
|
923
|
+
* const program = Effect.scoped(Effect.gen(function*() {
|
|
927
924
|
* const pubsub = yield* PubSub.bounded<string>(10)
|
|
928
925
|
*
|
|
929
926
|
* // Publish a message
|
|
930
927
|
* const published = yield* PubSub.publish(pubsub, "Hello World")
|
|
931
|
-
* console.log("Message published:", published) // true
|
|
932
928
|
*
|
|
933
|
-
* yield*
|
|
934
|
-
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
929
|
+
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
935
930
|
*
|
|
936
|
-
*
|
|
937
|
-
*
|
|
938
|
-
*
|
|
939
|
-
*
|
|
940
|
-
*
|
|
931
|
+
* yield* PubSub.publish(pubsub, "Hello")
|
|
932
|
+
* const message = yield* PubSub.take(subscription)
|
|
933
|
+
* return { published, message }
|
|
934
|
+
* }))
|
|
935
|
+
*
|
|
936
|
+
* const actual = await Effect.runPromise(program)
|
|
937
|
+
* actual // => { published: true, message: "Hello" }
|
|
941
938
|
* ```
|
|
942
939
|
*
|
|
943
940
|
* @see {@link publishUnsafe} for a synchronous non-blocking attempt that does not run effectful surplus handling
|
|
@@ -963,24 +960,24 @@ export const publish: {
|
|
|
963
960
|
*
|
|
964
961
|
* **Example** (Publishing a message)
|
|
965
962
|
*
|
|
966
|
-
* ```ts
|
|
963
|
+
* ```ts import.meta.vitest
|
|
967
964
|
* import { Effect, PubSub } from "effect"
|
|
968
965
|
*
|
|
969
|
-
* const program = Effect.gen(function*() {
|
|
966
|
+
* const program = Effect.scoped(Effect.gen(function*() {
|
|
970
967
|
* const pubsub = yield* PubSub.bounded<string>(10)
|
|
971
968
|
*
|
|
972
969
|
* // Publish a message
|
|
973
970
|
* const published = yield* PubSub.publish(pubsub, "Hello World")
|
|
974
|
-
* console.log("Message published:", published) // true
|
|
975
971
|
*
|
|
976
|
-
* yield*
|
|
977
|
-
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
972
|
+
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
978
973
|
*
|
|
979
|
-
*
|
|
980
|
-
*
|
|
981
|
-
*
|
|
982
|
-
*
|
|
983
|
-
*
|
|
974
|
+
* yield* PubSub.publish(pubsub, "Hello")
|
|
975
|
+
* const message = yield* PubSub.take(subscription)
|
|
976
|
+
* return { published, message }
|
|
977
|
+
* }))
|
|
978
|
+
*
|
|
979
|
+
* const actual = await Effect.runPromise(program)
|
|
980
|
+
* actual // => { published: true, message: "Hello" }
|
|
984
981
|
* ```
|
|
985
982
|
*
|
|
986
983
|
* @see {@link publishUnsafe} for a synchronous non-blocking attempt that does not run effectful surplus handling
|
|
@@ -1025,24 +1022,16 @@ export const publish: {
|
|
|
1025
1022
|
*
|
|
1026
1023
|
* **Example** (Publishing without suspending)
|
|
1027
1024
|
*
|
|
1028
|
-
* ```ts
|
|
1029
|
-
* import { PubSub } from "effect"
|
|
1030
|
-
*
|
|
1031
|
-
* declare const pubsub: PubSub.PubSub<string>
|
|
1025
|
+
* ```ts import.meta.vitest
|
|
1026
|
+
* import { Effect, PubSub } from "effect"
|
|
1032
1027
|
*
|
|
1033
|
-
*
|
|
1034
|
-
*
|
|
1035
|
-
*
|
|
1036
|
-
*
|
|
1037
|
-
* } else {
|
|
1038
|
-
* console.log("Message dropped (PubSub full or shutdown)")
|
|
1039
|
-
* }
|
|
1028
|
+
* const program = Effect.gen(function*() {
|
|
1029
|
+
* const pubsub = yield* PubSub.bounded<string>(2)
|
|
1030
|
+
* return PubSub.publishUnsafe(pubsub, "Hello")
|
|
1031
|
+
* })
|
|
1040
1032
|
*
|
|
1041
|
-
*
|
|
1042
|
-
*
|
|
1043
|
-
* const publishedCount =
|
|
1044
|
-
* messages.filter((msg) => PubSub.publishUnsafe(pubsub, msg)).length
|
|
1045
|
-
* console.log(`Published ${publishedCount} out of ${messages.length} messages`)
|
|
1033
|
+
* const actual = await Effect.runPromise(program)
|
|
1034
|
+
* actual // => true
|
|
1046
1035
|
* ```
|
|
1047
1036
|
*
|
|
1048
1037
|
* @see {@link publish} for effectful publishing that honors the configured surplus strategy
|
|
@@ -1068,24 +1057,16 @@ export const publishUnsafe: {
|
|
|
1068
1057
|
*
|
|
1069
1058
|
* **Example** (Publishing without suspending)
|
|
1070
1059
|
*
|
|
1071
|
-
* ```ts
|
|
1072
|
-
* import { PubSub } from "effect"
|
|
1073
|
-
*
|
|
1074
|
-
* declare const pubsub: PubSub.PubSub<string>
|
|
1060
|
+
* ```ts import.meta.vitest
|
|
1061
|
+
* import { Effect, PubSub } from "effect"
|
|
1075
1062
|
*
|
|
1076
|
-
*
|
|
1077
|
-
*
|
|
1078
|
-
*
|
|
1079
|
-
*
|
|
1080
|
-
* } else {
|
|
1081
|
-
* console.log("Message dropped (PubSub full or shutdown)")
|
|
1082
|
-
* }
|
|
1063
|
+
* const program = Effect.gen(function*() {
|
|
1064
|
+
* const pubsub = yield* PubSub.bounded<string>(2)
|
|
1065
|
+
* return PubSub.publishUnsafe(pubsub, "Hello")
|
|
1066
|
+
* })
|
|
1083
1067
|
*
|
|
1084
|
-
*
|
|
1085
|
-
*
|
|
1086
|
-
* const publishedCount =
|
|
1087
|
-
* messages.filter((msg) => PubSub.publishUnsafe(pubsub, msg)).length
|
|
1088
|
-
* console.log(`Published ${publishedCount} out of ${messages.length} messages`)
|
|
1068
|
+
* const actual = await Effect.runPromise(program)
|
|
1069
|
+
* actual // => true
|
|
1089
1070
|
* ```
|
|
1090
1071
|
*
|
|
1091
1072
|
* @see {@link publish} for effectful publishing that honors the configured surplus strategy
|
|
@@ -1111,24 +1092,16 @@ export const publishUnsafe: {
|
|
|
1111
1092
|
*
|
|
1112
1093
|
* **Example** (Publishing without suspending)
|
|
1113
1094
|
*
|
|
1114
|
-
* ```ts
|
|
1115
|
-
* import { PubSub } from "effect"
|
|
1116
|
-
*
|
|
1117
|
-
* declare const pubsub: PubSub.PubSub<string>
|
|
1095
|
+
* ```ts import.meta.vitest
|
|
1096
|
+
* import { Effect, PubSub } from "effect"
|
|
1118
1097
|
*
|
|
1119
|
-
*
|
|
1120
|
-
*
|
|
1121
|
-
*
|
|
1122
|
-
*
|
|
1123
|
-
* } else {
|
|
1124
|
-
* console.log("Message dropped (PubSub full or shutdown)")
|
|
1125
|
-
* }
|
|
1098
|
+
* const program = Effect.gen(function*() {
|
|
1099
|
+
* const pubsub = yield* PubSub.bounded<string>(2)
|
|
1100
|
+
* return PubSub.publishUnsafe(pubsub, "Hello")
|
|
1101
|
+
* })
|
|
1126
1102
|
*
|
|
1127
|
-
*
|
|
1128
|
-
*
|
|
1129
|
-
* const publishedCount =
|
|
1130
|
-
* messages.filter((msg) => PubSub.publishUnsafe(pubsub, msg)).length
|
|
1131
|
-
* console.log(`Published ${publishedCount} out of ${messages.length} messages`)
|
|
1103
|
+
* const actual = await Effect.runPromise(program)
|
|
1104
|
+
* actual // => true
|
|
1132
1105
|
* ```
|
|
1133
1106
|
*
|
|
1134
1107
|
* @see {@link publish} for effectful publishing that honors the configured surplus strategy
|
|
@@ -1152,37 +1125,30 @@ export const publishUnsafe: {
|
|
|
1152
1125
|
*
|
|
1153
1126
|
* **Example** (Publishing multiple messages)
|
|
1154
1127
|
*
|
|
1155
|
-
* ```ts
|
|
1128
|
+
* ```ts import.meta.vitest
|
|
1156
1129
|
* import { Effect, Fiber, PubSub } from "effect"
|
|
1157
1130
|
*
|
|
1158
|
-
* const program = Effect.gen(function*() {
|
|
1131
|
+
* const program = Effect.scoped(Effect.gen(function*() {
|
|
1159
1132
|
* const pubsub = yield* PubSub.bounded<string>(10)
|
|
1160
1133
|
*
|
|
1161
1134
|
* // Publish multiple messages at once
|
|
1162
|
-
* const
|
|
1163
|
-
* const allPublished = yield* PubSub.publishAll(pubsub, messages)
|
|
1164
|
-
* console.log("All messages published:", allPublished) // true
|
|
1135
|
+
* const allPublished = yield* PubSub.publishAll(pubsub, ["Hello", "World", "from", "Effect"])
|
|
1165
1136
|
*
|
|
1166
1137
|
* // With a smaller capacity and an active subscription
|
|
1167
1138
|
* const smallPubsub = yield* PubSub.bounded<string>(2)
|
|
1168
|
-
* const
|
|
1169
|
-
*
|
|
1170
|
-
* yield* Effect.scoped(Effect.gen(function*() {
|
|
1171
|
-
* const subscription = yield* PubSub.subscribe(smallPubsub)
|
|
1172
|
-
*
|
|
1173
|
-
* // Will suspend until space becomes available for all messages
|
|
1174
|
-
* const fiber = yield* Effect.forkChild(PubSub.publishAll(smallPubsub, manyMessages))
|
|
1139
|
+
* const subscription = yield* PubSub.subscribe(smallPubsub)
|
|
1175
1140
|
*
|
|
1176
|
-
*
|
|
1177
|
-
*
|
|
1141
|
+
* // Will suspend until space becomes available for all messages
|
|
1142
|
+
* const fiber = yield* Effect.forkChild(PubSub.publishAll(smallPubsub, ["msg1", "msg2", "msg3", "msg4"]))
|
|
1178
1143
|
*
|
|
1179
|
-
*
|
|
1180
|
-
*
|
|
1144
|
+
* const firstBatch = yield* PubSub.takeBetween(subscription, 2, 2)
|
|
1145
|
+
* const result = yield* Fiber.join(fiber)
|
|
1146
|
+
* const secondBatch = yield* PubSub.takeAll(subscription)
|
|
1147
|
+
* return { allPublished, firstBatch, result, secondBatch }
|
|
1148
|
+
* }))
|
|
1181
1149
|
*
|
|
1182
|
-
*
|
|
1183
|
-
*
|
|
1184
|
-
* }))
|
|
1185
|
-
* })
|
|
1150
|
+
* const actual = await Effect.runPromise(program)
|
|
1151
|
+
* actual // => { allPublished: true, firstBatch: ["msg1", "msg2"], result: true, secondBatch: ["msg3", "msg4"] }
|
|
1186
1152
|
* ```
|
|
1187
1153
|
*
|
|
1188
1154
|
* @category publishing
|
|
@@ -1195,37 +1161,30 @@ export const publishAll: {
|
|
|
1195
1161
|
*
|
|
1196
1162
|
* **Example** (Publishing multiple messages)
|
|
1197
1163
|
*
|
|
1198
|
-
* ```ts
|
|
1164
|
+
* ```ts import.meta.vitest
|
|
1199
1165
|
* import { Effect, Fiber, PubSub } from "effect"
|
|
1200
1166
|
*
|
|
1201
|
-
* const program = Effect.gen(function*() {
|
|
1167
|
+
* const program = Effect.scoped(Effect.gen(function*() {
|
|
1202
1168
|
* const pubsub = yield* PubSub.bounded<string>(10)
|
|
1203
1169
|
*
|
|
1204
1170
|
* // Publish multiple messages at once
|
|
1205
|
-
* const
|
|
1206
|
-
* const allPublished = yield* PubSub.publishAll(pubsub, messages)
|
|
1207
|
-
* console.log("All messages published:", allPublished) // true
|
|
1171
|
+
* const allPublished = yield* PubSub.publishAll(pubsub, ["Hello", "World", "from", "Effect"])
|
|
1208
1172
|
*
|
|
1209
1173
|
* // With a smaller capacity and an active subscription
|
|
1210
1174
|
* const smallPubsub = yield* PubSub.bounded<string>(2)
|
|
1211
|
-
* const
|
|
1175
|
+
* const subscription = yield* PubSub.subscribe(smallPubsub)
|
|
1212
1176
|
*
|
|
1213
|
-
*
|
|
1214
|
-
*
|
|
1177
|
+
* // Will suspend until space becomes available for all messages
|
|
1178
|
+
* const fiber = yield* Effect.forkChild(PubSub.publishAll(smallPubsub, ["msg1", "msg2", "msg3", "msg4"]))
|
|
1215
1179
|
*
|
|
1216
|
-
*
|
|
1217
|
-
*
|
|
1180
|
+
* const firstBatch = yield* PubSub.takeBetween(subscription, 2, 2)
|
|
1181
|
+
* const result = yield* Fiber.join(fiber)
|
|
1182
|
+
* const secondBatch = yield* PubSub.takeAll(subscription)
|
|
1183
|
+
* return { allPublished, firstBatch, result, secondBatch }
|
|
1184
|
+
* }))
|
|
1218
1185
|
*
|
|
1219
|
-
*
|
|
1220
|
-
*
|
|
1221
|
-
*
|
|
1222
|
-
* const result = yield* Fiber.join(fiber)
|
|
1223
|
-
* console.log("All messages eventually published:", result) // true
|
|
1224
|
-
*
|
|
1225
|
-
* const secondBatch = yield* PubSub.takeAll(subscription)
|
|
1226
|
-
* console.log("Second batch:", secondBatch) // ["msg3", "msg4"]
|
|
1227
|
-
* }))
|
|
1228
|
-
* })
|
|
1186
|
+
* const actual = await Effect.runPromise(program)
|
|
1187
|
+
* actual // => { allPublished: true, firstBatch: ["msg1", "msg2"], result: true, secondBatch: ["msg3", "msg4"] }
|
|
1229
1188
|
* ```
|
|
1230
1189
|
*
|
|
1231
1190
|
* @category publishing
|
|
@@ -1238,37 +1197,30 @@ export const publishAll: {
|
|
|
1238
1197
|
*
|
|
1239
1198
|
* **Example** (Publishing multiple messages)
|
|
1240
1199
|
*
|
|
1241
|
-
* ```ts
|
|
1200
|
+
* ```ts import.meta.vitest
|
|
1242
1201
|
* import { Effect, Fiber, PubSub } from "effect"
|
|
1243
1202
|
*
|
|
1244
|
-
* const program = Effect.gen(function*() {
|
|
1203
|
+
* const program = Effect.scoped(Effect.gen(function*() {
|
|
1245
1204
|
* const pubsub = yield* PubSub.bounded<string>(10)
|
|
1246
1205
|
*
|
|
1247
1206
|
* // Publish multiple messages at once
|
|
1248
|
-
* const
|
|
1249
|
-
* const allPublished = yield* PubSub.publishAll(pubsub, messages)
|
|
1250
|
-
* console.log("All messages published:", allPublished) // true
|
|
1207
|
+
* const allPublished = yield* PubSub.publishAll(pubsub, ["Hello", "World", "from", "Effect"])
|
|
1251
1208
|
*
|
|
1252
1209
|
* // With a smaller capacity and an active subscription
|
|
1253
1210
|
* const smallPubsub = yield* PubSub.bounded<string>(2)
|
|
1254
|
-
* const
|
|
1211
|
+
* const subscription = yield* PubSub.subscribe(smallPubsub)
|
|
1255
1212
|
*
|
|
1256
|
-
*
|
|
1257
|
-
*
|
|
1213
|
+
* // Will suspend until space becomes available for all messages
|
|
1214
|
+
* const fiber = yield* Effect.forkChild(PubSub.publishAll(smallPubsub, ["msg1", "msg2", "msg3", "msg4"]))
|
|
1258
1215
|
*
|
|
1259
|
-
*
|
|
1260
|
-
*
|
|
1216
|
+
* const firstBatch = yield* PubSub.takeBetween(subscription, 2, 2)
|
|
1217
|
+
* const result = yield* Fiber.join(fiber)
|
|
1218
|
+
* const secondBatch = yield* PubSub.takeAll(subscription)
|
|
1219
|
+
* return { allPublished, firstBatch, result, secondBatch }
|
|
1220
|
+
* }))
|
|
1261
1221
|
*
|
|
1262
|
-
*
|
|
1263
|
-
*
|
|
1264
|
-
*
|
|
1265
|
-
* const result = yield* Fiber.join(fiber)
|
|
1266
|
-
* console.log("All messages eventually published:", result) // true
|
|
1267
|
-
*
|
|
1268
|
-
* const secondBatch = yield* PubSub.takeAll(subscription)
|
|
1269
|
-
* console.log("Second batch:", secondBatch) // ["msg3", "msg4"]
|
|
1270
|
-
* }))
|
|
1271
|
-
* })
|
|
1222
|
+
* const actual = await Effect.runPromise(program)
|
|
1223
|
+
* actual // => { allPublished: true, firstBatch: ["msg1", "msg2"], result: true, secondBatch: ["msg3", "msg4"] }
|
|
1272
1224
|
* ```
|
|
1273
1225
|
*
|
|
1274
1226
|
* @category publishing
|
|
@@ -1300,14 +1252,14 @@ export const publishAll: {
|
|
|
1300
1252
|
*
|
|
1301
1253
|
* **Example** (Subscribing to messages)
|
|
1302
1254
|
*
|
|
1303
|
-
* ```ts
|
|
1255
|
+
* ```ts import.meta.vitest
|
|
1304
1256
|
* import { Effect, PubSub } from "effect"
|
|
1305
1257
|
*
|
|
1306
1258
|
* const program = Effect.gen(function*() {
|
|
1307
1259
|
* const pubsub = yield* PubSub.bounded<string>(10)
|
|
1308
1260
|
*
|
|
1309
1261
|
* // Subscribe within a scope for automatic cleanup
|
|
1310
|
-
* yield* Effect.scoped(Effect.gen(function*() {
|
|
1262
|
+
* const first = yield* Effect.scoped(Effect.gen(function*() {
|
|
1311
1263
|
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
1312
1264
|
*
|
|
1313
1265
|
* // Publish some messages
|
|
@@ -1317,25 +1269,28 @@ export const publishAll: {
|
|
|
1317
1269
|
* // Take messages one by one
|
|
1318
1270
|
* const msg1 = yield* PubSub.take(subscription)
|
|
1319
1271
|
* const msg2 = yield* PubSub.take(subscription)
|
|
1320
|
-
* console.log(msg1, msg2) // "Hello", "World"
|
|
1321
1272
|
*
|
|
1322
1273
|
* // Subscription is automatically cleaned up when scope exits
|
|
1274
|
+
* return [msg1, msg2]
|
|
1323
1275
|
* }))
|
|
1324
1276
|
*
|
|
1325
|
-
* yield* Effect.scoped(Effect.gen(function*() {
|
|
1277
|
+
* const second = yield* Effect.scoped(Effect.gen(function*() {
|
|
1326
1278
|
* const sub1 = yield* PubSub.subscribe(pubsub)
|
|
1327
1279
|
* const sub2 = yield* PubSub.subscribe(pubsub)
|
|
1328
1280
|
*
|
|
1329
1281
|
* // Multiple subscribers can receive the same messages
|
|
1330
1282
|
* yield* PubSub.publish(pubsub, "Broadcast")
|
|
1331
1283
|
*
|
|
1332
|
-
*
|
|
1284
|
+
* return yield* Effect.all([
|
|
1333
1285
|
* PubSub.take(sub1),
|
|
1334
1286
|
* PubSub.take(sub2)
|
|
1335
1287
|
* ])
|
|
1336
|
-
* console.log("Both received:", msg1, msg2) // "Broadcast", "Broadcast"
|
|
1337
1288
|
* }))
|
|
1289
|
+
* return [first, second]
|
|
1338
1290
|
* })
|
|
1291
|
+
*
|
|
1292
|
+
* const actual = await Effect.runPromise(program)
|
|
1293
|
+
* actual // => [["Hello", "World"], ["Broadcast", "Broadcast"]]
|
|
1339
1294
|
* ```
|
|
1340
1295
|
*
|
|
1341
1296
|
* @category subscriptions
|
|
@@ -1367,6 +1322,7 @@ const unsubscribe = <A>(self: Subscription<A>): Effect.Effect<void> =>
|
|
|
1367
1322
|
Effect.sync(() => {
|
|
1368
1323
|
self.subscribers.delete(self.subscription)
|
|
1369
1324
|
self.subscription.unsubscribe()
|
|
1325
|
+
self.replayWindow.close()
|
|
1370
1326
|
self.strategy.onPubSubEmptySpaceUnsafe(self.pubsub, self.subscribers)
|
|
1371
1327
|
})
|
|
1372
1328
|
),
|
|
@@ -1382,28 +1338,26 @@ const unsubscribe = <A>(self: Subscription<A>): Effect.Effect<void> =>
|
|
|
1382
1338
|
*
|
|
1383
1339
|
* **Example** (Taking a message)
|
|
1384
1340
|
*
|
|
1385
|
-
* ```ts
|
|
1341
|
+
* ```ts import.meta.vitest
|
|
1386
1342
|
* import { Effect, Fiber, PubSub } from "effect"
|
|
1387
1343
|
*
|
|
1388
|
-
* const program = Effect.gen(function*() {
|
|
1344
|
+
* const program = Effect.scoped(Effect.gen(function*() {
|
|
1389
1345
|
* const pubsub = yield* PubSub.bounded<string>(10)
|
|
1390
1346
|
*
|
|
1391
|
-
* yield*
|
|
1392
|
-
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
1347
|
+
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
1393
1348
|
*
|
|
1394
|
-
*
|
|
1395
|
-
*
|
|
1396
|
-
* PubSub.take(subscription)
|
|
1397
|
-
* )
|
|
1349
|
+
* // Start a fiber to take a message (will suspend)
|
|
1350
|
+
* const takeFiber = yield* Effect.forkChild(PubSub.take(subscription))
|
|
1398
1351
|
*
|
|
1399
|
-
*
|
|
1400
|
-
*
|
|
1352
|
+
* // Publish a message
|
|
1353
|
+
* yield* PubSub.publish(pubsub, "Hello")
|
|
1401
1354
|
*
|
|
1402
|
-
*
|
|
1403
|
-
*
|
|
1404
|
-
*
|
|
1405
|
-
*
|
|
1406
|
-
*
|
|
1355
|
+
* // The take will now complete
|
|
1356
|
+
* return yield* Fiber.join(takeFiber)
|
|
1357
|
+
* }))
|
|
1358
|
+
*
|
|
1359
|
+
* const actual = await Effect.runPromise(program)
|
|
1360
|
+
* actual // => "Hello"
|
|
1407
1361
|
* ```
|
|
1408
1362
|
*
|
|
1409
1363
|
* @category subscriptions
|
|
@@ -1435,23 +1389,23 @@ export const take = <A>(self: Subscription<A>): Effect.Effect<A> =>
|
|
|
1435
1389
|
*
|
|
1436
1390
|
* **Example** (Taking all available messages)
|
|
1437
1391
|
*
|
|
1438
|
-
* ```ts
|
|
1392
|
+
* ```ts import.meta.vitest
|
|
1439
1393
|
* import { Effect, PubSub } from "effect"
|
|
1440
1394
|
*
|
|
1441
|
-
* const program = Effect.gen(function*() {
|
|
1395
|
+
* const program = Effect.scoped(Effect.gen(function*() {
|
|
1442
1396
|
* const pubsub = yield* PubSub.bounded<string>(10)
|
|
1443
1397
|
*
|
|
1444
|
-
* yield*
|
|
1445
|
-
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
1398
|
+
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
1446
1399
|
*
|
|
1447
|
-
*
|
|
1448
|
-
*
|
|
1400
|
+
* // Publish multiple messages
|
|
1401
|
+
* yield* PubSub.publishAll(pubsub, ["msg1", "msg2", "msg3"])
|
|
1449
1402
|
*
|
|
1450
|
-
*
|
|
1451
|
-
*
|
|
1452
|
-
*
|
|
1453
|
-
*
|
|
1454
|
-
*
|
|
1403
|
+
* // Take all available messages at once
|
|
1404
|
+
* return yield* PubSub.takeAll(subscription)
|
|
1405
|
+
* }))
|
|
1406
|
+
*
|
|
1407
|
+
* const actual = await Effect.runPromise(program)
|
|
1408
|
+
* actual // => ["msg1", "msg2", "msg3"]
|
|
1455
1409
|
* ```
|
|
1456
1410
|
*
|
|
1457
1411
|
* @category subscriptions
|
|
@@ -1506,31 +1460,30 @@ const pollForItem = <A>(self: Subscription<A>) => {
|
|
|
1506
1460
|
*
|
|
1507
1461
|
* **Example** (Taking up to a maximum number of messages)
|
|
1508
1462
|
*
|
|
1509
|
-
* ```ts
|
|
1463
|
+
* ```ts import.meta.vitest
|
|
1510
1464
|
* import { Effect, PubSub } from "effect"
|
|
1511
1465
|
*
|
|
1512
|
-
* const program = Effect.gen(function*() {
|
|
1466
|
+
* const program = Effect.scoped(Effect.gen(function*() {
|
|
1513
1467
|
* const pubsub = yield* PubSub.bounded<string>(10)
|
|
1514
1468
|
*
|
|
1515
|
-
* yield*
|
|
1516
|
-
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
1469
|
+
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
1517
1470
|
*
|
|
1518
|
-
*
|
|
1519
|
-
*
|
|
1471
|
+
* // Publish multiple messages
|
|
1472
|
+
* yield* PubSub.publishAll(pubsub, ["msg1", "msg2", "msg3", "msg4", "msg5"])
|
|
1520
1473
|
*
|
|
1521
|
-
*
|
|
1522
|
-
*
|
|
1523
|
-
* console.log("Up to 3:", upTo3) // ["msg1", "msg2", "msg3"]
|
|
1474
|
+
* // Take up to 3 messages
|
|
1475
|
+
* const upTo3 = yield* PubSub.takeUpTo(subscription, 3)
|
|
1524
1476
|
*
|
|
1525
|
-
*
|
|
1526
|
-
*
|
|
1527
|
-
* console.log("Up to 5:", upTo5) // ["msg4", "msg5"]
|
|
1477
|
+
* // Take up to 5 more (only 2 remaining)
|
|
1478
|
+
* const upTo5 = yield* PubSub.takeUpTo(subscription, 5)
|
|
1528
1479
|
*
|
|
1529
|
-
*
|
|
1530
|
-
*
|
|
1531
|
-
*
|
|
1532
|
-
*
|
|
1533
|
-
*
|
|
1480
|
+
* // No more messages available
|
|
1481
|
+
* const noMore = yield* PubSub.takeUpTo(subscription, 10)
|
|
1482
|
+
* return [upTo3, upTo5, noMore]
|
|
1483
|
+
* }))
|
|
1484
|
+
*
|
|
1485
|
+
* const actual = await Effect.runPromise(program)
|
|
1486
|
+
* actual // => [["msg1", "msg2", "msg3"], ["msg4", "msg5"], []]
|
|
1534
1487
|
* ```
|
|
1535
1488
|
*
|
|
1536
1489
|
* @category subscriptions
|
|
@@ -1542,31 +1495,30 @@ export const takeUpTo: {
|
|
|
1542
1495
|
*
|
|
1543
1496
|
* **Example** (Taking up to a maximum number of messages)
|
|
1544
1497
|
*
|
|
1545
|
-
* ```ts
|
|
1498
|
+
* ```ts import.meta.vitest
|
|
1546
1499
|
* import { Effect, PubSub } from "effect"
|
|
1547
1500
|
*
|
|
1548
|
-
* const program = Effect.gen(function*() {
|
|
1501
|
+
* const program = Effect.scoped(Effect.gen(function*() {
|
|
1549
1502
|
* const pubsub = yield* PubSub.bounded<string>(10)
|
|
1550
1503
|
*
|
|
1551
|
-
* yield*
|
|
1552
|
-
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
1504
|
+
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
1553
1505
|
*
|
|
1554
|
-
*
|
|
1555
|
-
*
|
|
1506
|
+
* // Publish multiple messages
|
|
1507
|
+
* yield* PubSub.publishAll(pubsub, ["msg1", "msg2", "msg3", "msg4", "msg5"])
|
|
1556
1508
|
*
|
|
1557
|
-
*
|
|
1558
|
-
*
|
|
1559
|
-
* console.log("Up to 3:", upTo3) // ["msg1", "msg2", "msg3"]
|
|
1509
|
+
* // Take up to 3 messages
|
|
1510
|
+
* const upTo3 = yield* PubSub.takeUpTo(subscription, 3)
|
|
1560
1511
|
*
|
|
1561
|
-
*
|
|
1562
|
-
*
|
|
1563
|
-
* console.log("Up to 5:", upTo5) // ["msg4", "msg5"]
|
|
1512
|
+
* // Take up to 5 more (only 2 remaining)
|
|
1513
|
+
* const upTo5 = yield* PubSub.takeUpTo(subscription, 5)
|
|
1564
1514
|
*
|
|
1565
|
-
*
|
|
1566
|
-
*
|
|
1567
|
-
*
|
|
1568
|
-
*
|
|
1569
|
-
*
|
|
1515
|
+
* // No more messages available
|
|
1516
|
+
* const noMore = yield* PubSub.takeUpTo(subscription, 10)
|
|
1517
|
+
* return [upTo3, upTo5, noMore]
|
|
1518
|
+
* }))
|
|
1519
|
+
*
|
|
1520
|
+
* const actual = await Effect.runPromise(program)
|
|
1521
|
+
* actual // => [["msg1", "msg2", "msg3"], ["msg4", "msg5"], []]
|
|
1570
1522
|
* ```
|
|
1571
1523
|
*
|
|
1572
1524
|
* @category subscriptions
|
|
@@ -1578,31 +1530,30 @@ export const takeUpTo: {
|
|
|
1578
1530
|
*
|
|
1579
1531
|
* **Example** (Taking up to a maximum number of messages)
|
|
1580
1532
|
*
|
|
1581
|
-
* ```ts
|
|
1533
|
+
* ```ts import.meta.vitest
|
|
1582
1534
|
* import { Effect, PubSub } from "effect"
|
|
1583
1535
|
*
|
|
1584
|
-
* const program = Effect.gen(function*() {
|
|
1536
|
+
* const program = Effect.scoped(Effect.gen(function*() {
|
|
1585
1537
|
* const pubsub = yield* PubSub.bounded<string>(10)
|
|
1586
1538
|
*
|
|
1587
|
-
* yield*
|
|
1588
|
-
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
1539
|
+
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
1589
1540
|
*
|
|
1590
|
-
*
|
|
1591
|
-
*
|
|
1541
|
+
* // Publish multiple messages
|
|
1542
|
+
* yield* PubSub.publishAll(pubsub, ["msg1", "msg2", "msg3", "msg4", "msg5"])
|
|
1592
1543
|
*
|
|
1593
|
-
*
|
|
1594
|
-
*
|
|
1595
|
-
* console.log("Up to 3:", upTo3) // ["msg1", "msg2", "msg3"]
|
|
1544
|
+
* // Take up to 3 messages
|
|
1545
|
+
* const upTo3 = yield* PubSub.takeUpTo(subscription, 3)
|
|
1596
1546
|
*
|
|
1597
|
-
*
|
|
1598
|
-
*
|
|
1599
|
-
* console.log("Up to 5:", upTo5) // ["msg4", "msg5"]
|
|
1547
|
+
* // Take up to 5 more (only 2 remaining)
|
|
1548
|
+
* const upTo5 = yield* PubSub.takeUpTo(subscription, 5)
|
|
1600
1549
|
*
|
|
1601
|
-
*
|
|
1602
|
-
*
|
|
1603
|
-
*
|
|
1604
|
-
*
|
|
1605
|
-
*
|
|
1550
|
+
* // No more messages available
|
|
1551
|
+
* const noMore = yield* PubSub.takeUpTo(subscription, 10)
|
|
1552
|
+
* return [upTo3, upTo5, noMore]
|
|
1553
|
+
* }))
|
|
1554
|
+
*
|
|
1555
|
+
* const actual = await Effect.runPromise(program)
|
|
1556
|
+
* actual // => [["msg1", "msg2", "msg3"], ["msg4", "msg5"], []]
|
|
1606
1557
|
* ```
|
|
1607
1558
|
*
|
|
1608
1559
|
* @category subscriptions
|
|
@@ -1632,28 +1583,26 @@ export const takeUpTo: {
|
|
|
1632
1583
|
*
|
|
1633
1584
|
* **Example** (Taking between a minimum and maximum)
|
|
1634
1585
|
*
|
|
1635
|
-
* ```ts
|
|
1586
|
+
* ```ts import.meta.vitest
|
|
1636
1587
|
* import { Effect, Fiber, PubSub } from "effect"
|
|
1637
1588
|
*
|
|
1638
|
-
* const program = Effect.gen(function*() {
|
|
1589
|
+
* const program = Effect.scoped(Effect.gen(function*() {
|
|
1639
1590
|
* const pubsub = yield* PubSub.bounded<string>(10)
|
|
1640
1591
|
*
|
|
1641
|
-
* yield*
|
|
1642
|
-
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
1592
|
+
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
1643
1593
|
*
|
|
1644
|
-
*
|
|
1645
|
-
*
|
|
1646
|
-
* PubSub.takeBetween(subscription, 2, 5)
|
|
1647
|
-
* )
|
|
1594
|
+
* // Start taking between 2 and 5 messages (will suspend)
|
|
1595
|
+
* const takeFiber = yield* Effect.forkChild(PubSub.takeBetween(subscription, 2, 5))
|
|
1648
1596
|
*
|
|
1649
|
-
*
|
|
1650
|
-
*
|
|
1597
|
+
* // Publish 3 messages
|
|
1598
|
+
* yield* PubSub.publishAll(pubsub, ["msg1", "msg2", "msg3"])
|
|
1651
1599
|
*
|
|
1652
|
-
*
|
|
1653
|
-
*
|
|
1654
|
-
*
|
|
1655
|
-
*
|
|
1656
|
-
*
|
|
1600
|
+
* // Now the take will complete with 3 messages
|
|
1601
|
+
* return yield* Fiber.join(takeFiber)
|
|
1602
|
+
* }))
|
|
1603
|
+
*
|
|
1604
|
+
* const actual = await Effect.runPromise(program)
|
|
1605
|
+
* actual // => ["msg1", "msg2", "msg3"]
|
|
1657
1606
|
* ```
|
|
1658
1607
|
*
|
|
1659
1608
|
* @category subscriptions
|
|
@@ -1666,28 +1615,26 @@ export const takeBetween: {
|
|
|
1666
1615
|
*
|
|
1667
1616
|
* **Example** (Taking between a minimum and maximum)
|
|
1668
1617
|
*
|
|
1669
|
-
* ```ts
|
|
1618
|
+
* ```ts import.meta.vitest
|
|
1670
1619
|
* import { Effect, Fiber, PubSub } from "effect"
|
|
1671
1620
|
*
|
|
1672
|
-
* const program = Effect.gen(function*() {
|
|
1621
|
+
* const program = Effect.scoped(Effect.gen(function*() {
|
|
1673
1622
|
* const pubsub = yield* PubSub.bounded<string>(10)
|
|
1674
1623
|
*
|
|
1675
|
-
* yield*
|
|
1676
|
-
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
1624
|
+
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
1677
1625
|
*
|
|
1678
|
-
*
|
|
1679
|
-
*
|
|
1680
|
-
* PubSub.takeBetween(subscription, 2, 5)
|
|
1681
|
-
* )
|
|
1626
|
+
* // Start taking between 2 and 5 messages (will suspend)
|
|
1627
|
+
* const takeFiber = yield* Effect.forkChild(PubSub.takeBetween(subscription, 2, 5))
|
|
1682
1628
|
*
|
|
1683
|
-
*
|
|
1684
|
-
*
|
|
1629
|
+
* // Publish 3 messages
|
|
1630
|
+
* yield* PubSub.publishAll(pubsub, ["msg1", "msg2", "msg3"])
|
|
1685
1631
|
*
|
|
1686
|
-
*
|
|
1687
|
-
*
|
|
1688
|
-
*
|
|
1689
|
-
*
|
|
1690
|
-
*
|
|
1632
|
+
* // Now the take will complete with 3 messages
|
|
1633
|
+
* return yield* Fiber.join(takeFiber)
|
|
1634
|
+
* }))
|
|
1635
|
+
*
|
|
1636
|
+
* const actual = await Effect.runPromise(program)
|
|
1637
|
+
* actual // => ["msg1", "msg2", "msg3"]
|
|
1691
1638
|
* ```
|
|
1692
1639
|
*
|
|
1693
1640
|
* @category subscriptions
|
|
@@ -1700,28 +1647,26 @@ export const takeBetween: {
|
|
|
1700
1647
|
*
|
|
1701
1648
|
* **Example** (Taking between a minimum and maximum)
|
|
1702
1649
|
*
|
|
1703
|
-
* ```ts
|
|
1650
|
+
* ```ts import.meta.vitest
|
|
1704
1651
|
* import { Effect, Fiber, PubSub } from "effect"
|
|
1705
1652
|
*
|
|
1706
|
-
* const program = Effect.gen(function*() {
|
|
1653
|
+
* const program = Effect.scoped(Effect.gen(function*() {
|
|
1707
1654
|
* const pubsub = yield* PubSub.bounded<string>(10)
|
|
1708
1655
|
*
|
|
1709
|
-
* yield*
|
|
1710
|
-
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
1656
|
+
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
1711
1657
|
*
|
|
1712
|
-
*
|
|
1713
|
-
*
|
|
1714
|
-
* PubSub.takeBetween(subscription, 2, 5)
|
|
1715
|
-
* )
|
|
1658
|
+
* // Start taking between 2 and 5 messages (will suspend)
|
|
1659
|
+
* const takeFiber = yield* Effect.forkChild(PubSub.takeBetween(subscription, 2, 5))
|
|
1716
1660
|
*
|
|
1717
|
-
*
|
|
1718
|
-
*
|
|
1661
|
+
* // Publish 3 messages
|
|
1662
|
+
* yield* PubSub.publishAll(pubsub, ["msg1", "msg2", "msg3"])
|
|
1719
1663
|
*
|
|
1720
|
-
*
|
|
1721
|
-
*
|
|
1722
|
-
*
|
|
1723
|
-
*
|
|
1724
|
-
*
|
|
1664
|
+
* // Now the take will complete with 3 messages
|
|
1665
|
+
* return yield* Fiber.join(takeFiber)
|
|
1666
|
+
* }))
|
|
1667
|
+
*
|
|
1668
|
+
* const actual = await Effect.runPromise(program)
|
|
1669
|
+
* actual // => ["msg1", "msg2", "msg3"]
|
|
1725
1670
|
* ```
|
|
1726
1671
|
*
|
|
1727
1672
|
* @category subscriptions
|
|
@@ -1783,29 +1728,29 @@ const takeRemainderLoop = <A>(
|
|
|
1783
1728
|
*
|
|
1784
1729
|
* **Example** (Checking remaining messages)
|
|
1785
1730
|
*
|
|
1786
|
-
* ```ts
|
|
1731
|
+
* ```ts import.meta.vitest
|
|
1787
1732
|
* import { Effect, PubSub } from "effect"
|
|
1788
1733
|
*
|
|
1789
|
-
* const program = Effect.gen(function*() {
|
|
1734
|
+
* const program = Effect.scoped(Effect.gen(function*() {
|
|
1790
1735
|
* const pubsub = yield* PubSub.bounded<string>(10)
|
|
1791
1736
|
*
|
|
1792
|
-
* yield*
|
|
1793
|
-
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
1737
|
+
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
1794
1738
|
*
|
|
1795
|
-
*
|
|
1796
|
-
*
|
|
1739
|
+
* // Publish some messages
|
|
1740
|
+
* yield* PubSub.publishAll(pubsub, ["msg1", "msg2", "msg3"])
|
|
1797
1741
|
*
|
|
1798
|
-
*
|
|
1799
|
-
*
|
|
1800
|
-
* console.log("Messages available:", count) // 3
|
|
1742
|
+
* // Check how many messages are available
|
|
1743
|
+
* const count = yield* PubSub.remaining(subscription)
|
|
1801
1744
|
*
|
|
1802
|
-
*
|
|
1803
|
-
*
|
|
1745
|
+
* // Take one message
|
|
1746
|
+
* const message = yield* PubSub.take(subscription)
|
|
1804
1747
|
*
|
|
1805
|
-
*
|
|
1806
|
-
*
|
|
1807
|
-
*
|
|
1808
|
-
*
|
|
1748
|
+
* const remaining = yield* PubSub.remaining(subscription)
|
|
1749
|
+
* return { count, message, remaining }
|
|
1750
|
+
* }))
|
|
1751
|
+
*
|
|
1752
|
+
* const actual = await Effect.runPromise(program)
|
|
1753
|
+
* actual // => { count: 3, message: "msg1", remaining: 2 }
|
|
1809
1754
|
* ```
|
|
1810
1755
|
*
|
|
1811
1756
|
* @see {@link remainingUnsafe} for a synchronous check that reports shutdown as `Option.none()`
|
|
@@ -1831,23 +1776,17 @@ export const remaining = <A>(self: Subscription<A>): Effect.Effect<number> =>
|
|
|
1831
1776
|
*
|
|
1832
1777
|
* **Example** (Checking remaining messages synchronously)
|
|
1833
1778
|
*
|
|
1834
|
-
* ```ts
|
|
1835
|
-
* import { PubSub } from "effect"
|
|
1779
|
+
* ```ts import.meta.vitest
|
|
1780
|
+
* import { Effect, Option, PubSub } from "effect"
|
|
1836
1781
|
*
|
|
1837
|
-
*
|
|
1838
|
-
*
|
|
1839
|
-
*
|
|
1840
|
-
*
|
|
1841
|
-
*
|
|
1842
|
-
* console.log("Messages available:", remainingOption.value)
|
|
1843
|
-
* } else {
|
|
1844
|
-
* console.log("Subscription is shutdown")
|
|
1845
|
-
* }
|
|
1782
|
+
* const program = Effect.scoped(Effect.gen(function*() {
|
|
1783
|
+
* const pubsub = yield* PubSub.bounded<string>(2)
|
|
1784
|
+
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
1785
|
+
* return PubSub.remainingUnsafe(subscription)
|
|
1786
|
+
* }))
|
|
1846
1787
|
*
|
|
1847
|
-
*
|
|
1848
|
-
*
|
|
1849
|
-
* // Process messages in batch
|
|
1850
|
-
* }
|
|
1788
|
+
* const actual = await Effect.runPromise(program)
|
|
1789
|
+
* actual // => Option.some(0)
|
|
1851
1790
|
* ```
|
|
1852
1791
|
*
|
|
1853
1792
|
* @see {@link remaining} for the effectful variant that interrupts on shutdown
|
|
@@ -1914,6 +1853,7 @@ const makeSubscriptionUnsafe = <A>(
|
|
|
1914
1853
|
|
|
1915
1854
|
class BoundedPubSubArb<in out A> implements PubSub.Atomic<A> {
|
|
1916
1855
|
array: Array<A>
|
|
1856
|
+
replayIndices: Array<number>
|
|
1917
1857
|
publisherIndex = 0
|
|
1918
1858
|
subscribers: Array<number>
|
|
1919
1859
|
subscriberCount = 0
|
|
@@ -1926,6 +1866,7 @@ class BoundedPubSubArb<in out A> implements PubSub.Atomic<A> {
|
|
|
1926
1866
|
this.capacity = capacity
|
|
1927
1867
|
this.replayBuffer = replayBuffer
|
|
1928
1868
|
this.array = Array.from({ length: capacity })
|
|
1869
|
+
this.replayIndices = replayBuffer ? Array.from({ length: capacity }) : []
|
|
1929
1870
|
this.subscribers = Array.from({ length: capacity })
|
|
1930
1871
|
}
|
|
1931
1872
|
|
|
@@ -1949,15 +1890,16 @@ class BoundedPubSubArb<in out A> implements PubSub.Atomic<A> {
|
|
|
1949
1890
|
if (this.isFull()) {
|
|
1950
1891
|
return false
|
|
1951
1892
|
}
|
|
1893
|
+
const replayIndex = this.replayBuffer?.offer(value)
|
|
1952
1894
|
if (this.subscriberCount !== 0) {
|
|
1953
1895
|
const index = this.publisherIndex % this.capacity
|
|
1954
1896
|
this.array[index] = value
|
|
1897
|
+
if (replayIndex !== undefined) {
|
|
1898
|
+
this.replayIndices[index] = replayIndex
|
|
1899
|
+
}
|
|
1955
1900
|
this.subscribers[index] = this.subscriberCount
|
|
1956
1901
|
this.publisherIndex += 1
|
|
1957
1902
|
}
|
|
1958
|
-
if (this.replayBuffer) {
|
|
1959
|
-
this.replayBuffer.offer(value)
|
|
1960
|
-
}
|
|
1961
1903
|
return true
|
|
1962
1904
|
}
|
|
1963
1905
|
|
|
@@ -1982,11 +1924,12 @@ class BoundedPubSubArb<in out A> implements PubSub.Atomic<A> {
|
|
|
1982
1924
|
const a = chunk[iteratorIndex++]
|
|
1983
1925
|
const index = this.publisherIndex % this.capacity
|
|
1984
1926
|
this.array[index] = a
|
|
1927
|
+
const replayIndex = this.replayBuffer?.offer(a)
|
|
1928
|
+
if (replayIndex !== undefined) {
|
|
1929
|
+
this.replayIndices[index] = replayIndex
|
|
1930
|
+
}
|
|
1985
1931
|
this.subscribers[index] = this.subscriberCount
|
|
1986
1932
|
this.publisherIndex += 1
|
|
1987
|
-
if (this.replayBuffer) {
|
|
1988
|
-
this.replayBuffer.offer(a)
|
|
1989
|
-
}
|
|
1990
1933
|
}
|
|
1991
1934
|
return chunk.slice(iteratorIndex)
|
|
1992
1935
|
}
|
|
@@ -1994,12 +1937,11 @@ class BoundedPubSubArb<in out A> implements PubSub.Atomic<A> {
|
|
|
1994
1937
|
slide(): void {
|
|
1995
1938
|
if (this.subscribersIndex !== this.publisherIndex) {
|
|
1996
1939
|
const index = this.subscribersIndex % this.capacity
|
|
1940
|
+
const value = this.array[index]
|
|
1997
1941
|
this.array[index] = AbsentValue as unknown as A
|
|
1998
1942
|
this.subscribers[index] = 0
|
|
1999
1943
|
this.subscribersIndex += 1
|
|
2000
|
-
|
|
2001
|
-
if (this.replayBuffer) {
|
|
2002
|
-
this.replayBuffer.slide()
|
|
1944
|
+
this.replayBuffer?.slide(value, this.replayIndices[index])
|
|
2003
1945
|
}
|
|
2004
1946
|
}
|
|
2005
1947
|
|
|
@@ -2105,6 +2047,7 @@ class BoundedPubSubArbSubscription<in out A> implements PubSub.BackingSubscripti
|
|
|
2105
2047
|
|
|
2106
2048
|
class BoundedPubSubPow2<in out A> implements PubSub.Atomic<A> {
|
|
2107
2049
|
array: Array<A>
|
|
2050
|
+
replayIndices: Array<number>
|
|
2108
2051
|
mask: number
|
|
2109
2052
|
publisherIndex = 0
|
|
2110
2053
|
subscribers: Array<number>
|
|
@@ -2118,6 +2061,7 @@ class BoundedPubSubPow2<in out A> implements PubSub.Atomic<A> {
|
|
|
2118
2061
|
this.capacity = capacity
|
|
2119
2062
|
this.replayBuffer = replayBuffer
|
|
2120
2063
|
this.array = Array.from({ length: capacity })
|
|
2064
|
+
this.replayIndices = replayBuffer ? Array.from({ length: capacity }) : []
|
|
2121
2065
|
this.mask = capacity - 1
|
|
2122
2066
|
this.subscribers = Array.from({ length: capacity })
|
|
2123
2067
|
}
|
|
@@ -2142,15 +2086,16 @@ class BoundedPubSubPow2<in out A> implements PubSub.Atomic<A> {
|
|
|
2142
2086
|
if (this.isFull()) {
|
|
2143
2087
|
return false
|
|
2144
2088
|
}
|
|
2089
|
+
const replayIndex = this.replayBuffer?.offer(value)
|
|
2145
2090
|
if (this.subscriberCount !== 0) {
|
|
2146
2091
|
const index = this.publisherIndex & this.mask
|
|
2147
2092
|
this.array[index] = value
|
|
2093
|
+
if (replayIndex !== undefined) {
|
|
2094
|
+
this.replayIndices[index] = replayIndex
|
|
2095
|
+
}
|
|
2148
2096
|
this.subscribers[index] = this.subscriberCount
|
|
2149
2097
|
this.publisherIndex += 1
|
|
2150
2098
|
}
|
|
2151
|
-
if (this.replayBuffer) {
|
|
2152
|
-
this.replayBuffer.offer(value)
|
|
2153
|
-
}
|
|
2154
2099
|
return true
|
|
2155
2100
|
}
|
|
2156
2101
|
|
|
@@ -2175,11 +2120,12 @@ class BoundedPubSubPow2<in out A> implements PubSub.Atomic<A> {
|
|
|
2175
2120
|
const elem = chunk[iteratorIndex++]
|
|
2176
2121
|
const index = this.publisherIndex & this.mask
|
|
2177
2122
|
this.array[index] = elem
|
|
2123
|
+
const replayIndex = this.replayBuffer?.offer(elem)
|
|
2124
|
+
if (replayIndex !== undefined) {
|
|
2125
|
+
this.replayIndices[index] = replayIndex
|
|
2126
|
+
}
|
|
2178
2127
|
this.subscribers[index] = this.subscriberCount
|
|
2179
2128
|
this.publisherIndex += 1
|
|
2180
|
-
if (this.replayBuffer) {
|
|
2181
|
-
this.replayBuffer.offer(elem)
|
|
2182
|
-
}
|
|
2183
2129
|
}
|
|
2184
2130
|
return chunk.slice(iteratorIndex)
|
|
2185
2131
|
}
|
|
@@ -2187,12 +2133,11 @@ class BoundedPubSubPow2<in out A> implements PubSub.Atomic<A> {
|
|
|
2187
2133
|
slide(): void {
|
|
2188
2134
|
if (this.subscribersIndex !== this.publisherIndex) {
|
|
2189
2135
|
const index = this.subscribersIndex & this.mask
|
|
2136
|
+
const value = this.array[index]
|
|
2190
2137
|
this.array[index] = AbsentValue as unknown as A
|
|
2191
2138
|
this.subscribers[index] = 0
|
|
2192
2139
|
this.subscribersIndex += 1
|
|
2193
|
-
|
|
2194
|
-
if (this.replayBuffer) {
|
|
2195
|
-
this.replayBuffer.slide()
|
|
2140
|
+
this.replayBuffer?.slide(value, this.replayIndices[index])
|
|
2196
2141
|
}
|
|
2197
2142
|
}
|
|
2198
2143
|
|
|
@@ -2300,6 +2245,7 @@ class BoundedPubSubSingle<in out A> implements PubSub.Atomic<A> {
|
|
|
2300
2245
|
subscriberCount = 0
|
|
2301
2246
|
subscribers = 0
|
|
2302
2247
|
value: A = AbsentValue as unknown as A
|
|
2248
|
+
replayIndex = 0
|
|
2303
2249
|
|
|
2304
2250
|
readonly capacity = 1
|
|
2305
2251
|
readonly replayBuffer: ReplayBuffer<A> | undefined
|
|
@@ -2332,14 +2278,15 @@ class BoundedPubSubSingle<in out A> implements PubSub.Atomic<A> {
|
|
|
2332
2278
|
if (this.isFull()) {
|
|
2333
2279
|
return false
|
|
2334
2280
|
}
|
|
2281
|
+
const replayIndex = this.replayBuffer?.offer(value)
|
|
2335
2282
|
if (this.subscriberCount !== 0) {
|
|
2336
2283
|
this.value = value
|
|
2284
|
+
if (replayIndex !== undefined) {
|
|
2285
|
+
this.replayIndex = replayIndex
|
|
2286
|
+
}
|
|
2337
2287
|
this.subscribers = this.subscriberCount
|
|
2338
2288
|
this.publisherIndex += 1
|
|
2339
2289
|
}
|
|
2340
|
-
if (this.replayBuffer) {
|
|
2341
|
-
this.replayBuffer.offer(value)
|
|
2342
|
-
}
|
|
2343
2290
|
return true
|
|
2344
2291
|
}
|
|
2345
2292
|
|
|
@@ -2363,11 +2310,10 @@ class BoundedPubSubSingle<in out A> implements PubSub.Atomic<A> {
|
|
|
2363
2310
|
|
|
2364
2311
|
slide(): void {
|
|
2365
2312
|
if (this.isFull()) {
|
|
2313
|
+
const value = this.value
|
|
2366
2314
|
this.subscribers = 0
|
|
2367
2315
|
this.value = AbsentValue as unknown as A
|
|
2368
|
-
|
|
2369
|
-
if (this.replayBuffer) {
|
|
2370
|
-
this.replayBuffer.slide()
|
|
2316
|
+
this.replayBuffer?.slide(value, this.replayIndex)
|
|
2371
2317
|
}
|
|
2372
2318
|
}
|
|
2373
2319
|
|
|
@@ -2446,6 +2392,7 @@ class BoundedPubSubSingleSubscription<in out A> implements PubSub.BackingSubscri
|
|
|
2446
2392
|
|
|
2447
2393
|
interface Node<out A> {
|
|
2448
2394
|
value: A | AbsentValue
|
|
2395
|
+
replayIndex: number | undefined
|
|
2449
2396
|
subscribers: number
|
|
2450
2397
|
next: Node<A> | null
|
|
2451
2398
|
}
|
|
@@ -2453,6 +2400,7 @@ interface Node<out A> {
|
|
|
2453
2400
|
class UnboundedPubSub<in out A> implements PubSub.Atomic<A> {
|
|
2454
2401
|
publisherHead: Node<A> = {
|
|
2455
2402
|
value: AbsentValue,
|
|
2403
|
+
replayIndex: undefined,
|
|
2456
2404
|
subscribers: 0,
|
|
2457
2405
|
next: null
|
|
2458
2406
|
}
|
|
@@ -2484,19 +2432,19 @@ class UnboundedPubSub<in out A> implements PubSub.Atomic<A> {
|
|
|
2484
2432
|
}
|
|
2485
2433
|
|
|
2486
2434
|
publish(value: A): boolean {
|
|
2435
|
+
const replayIndex = this.replayBuffer?.offer(value)
|
|
2487
2436
|
const subscribers = this.publisherTail.subscribers
|
|
2488
2437
|
if (subscribers !== 0) {
|
|
2489
|
-
|
|
2438
|
+
const node: Node<A> = {
|
|
2490
2439
|
value,
|
|
2440
|
+
replayIndex,
|
|
2491
2441
|
subscribers,
|
|
2492
2442
|
next: null
|
|
2493
2443
|
}
|
|
2444
|
+
this.publisherTail.next = node
|
|
2494
2445
|
this.publisherTail = this.publisherTail.next
|
|
2495
2446
|
this.publisherIndex += 1
|
|
2496
2447
|
}
|
|
2497
|
-
if (this.replayBuffer) {
|
|
2498
|
-
this.replayBuffer.offer(value)
|
|
2499
|
-
}
|
|
2500
2448
|
return true
|
|
2501
2449
|
}
|
|
2502
2450
|
|
|
@@ -2513,12 +2461,12 @@ class UnboundedPubSub<in out A> implements PubSub.Atomic<A> {
|
|
|
2513
2461
|
|
|
2514
2462
|
slide(): void {
|
|
2515
2463
|
if (this.publisherHead !== this.publisherTail) {
|
|
2464
|
+
const node = this.publisherHead.next!
|
|
2465
|
+
const value = node.value as A
|
|
2516
2466
|
this.publisherHead = this.publisherHead.next!
|
|
2517
2467
|
this.publisherHead.value = AbsentValue
|
|
2518
2468
|
this.subscribersIndex += 1
|
|
2519
|
-
|
|
2520
|
-
if (this.replayBuffer) {
|
|
2521
|
-
this.replayBuffer.slide()
|
|
2469
|
+
this.replayBuffer?.slide(value, node.replayIndex!)
|
|
2522
2470
|
}
|
|
2523
2471
|
}
|
|
2524
2472
|
|
|
@@ -2869,34 +2817,30 @@ export class BackPressureStrategy<in out A> implements PubSub.Strategy<A> {
|
|
|
2869
2817
|
*
|
|
2870
2818
|
* **Example** (Applying a dropping strategy)
|
|
2871
2819
|
*
|
|
2872
|
-
* ```ts
|
|
2820
|
+
* ```ts import.meta.vitest
|
|
2873
2821
|
* import { Effect, PubSub } from "effect"
|
|
2874
2822
|
*
|
|
2875
|
-
* const program = Effect.gen(function*() {
|
|
2876
|
-
* //
|
|
2877
|
-
* const pubsub = yield* PubSub.
|
|
2878
|
-
*
|
|
2879
|
-
* // Or explicitly create with dropping strategy
|
|
2880
|
-
* const customPubsub = yield* PubSub.make<string>({
|
|
2823
|
+
* const program = Effect.scoped(Effect.gen(function*() {
|
|
2824
|
+
* // Explicitly create a PubSub with a dropping strategy
|
|
2825
|
+
* const pubsub = yield* PubSub.make<string>({
|
|
2881
2826
|
* atomicPubSub: () => PubSub.makeAtomicBounded(2),
|
|
2882
2827
|
* strategy: () => new PubSub.DroppingStrategy()
|
|
2883
2828
|
* })
|
|
2884
2829
|
*
|
|
2885
|
-
* yield*
|
|
2886
|
-
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
2830
|
+
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
2887
2831
|
*
|
|
2888
|
-
*
|
|
2889
|
-
*
|
|
2890
|
-
*
|
|
2891
|
-
*
|
|
2832
|
+
* // Fill the PubSub
|
|
2833
|
+
* const pub1 = yield* PubSub.publish(pubsub, "msg1") // true
|
|
2834
|
+
* const pub2 = yield* PubSub.publish(pubsub, "msg2") // true
|
|
2835
|
+
* const pub3 = yield* PubSub.publish(pubsub, "msg3") // false (dropped)
|
|
2892
2836
|
*
|
|
2893
|
-
*
|
|
2837
|
+
* // Subscribers will only see the first two messages
|
|
2838
|
+
* const messages = yield* PubSub.takeAll(subscription)
|
|
2839
|
+
* return { published: [pub1, pub2, pub3], messages }
|
|
2840
|
+
* }))
|
|
2894
2841
|
*
|
|
2895
|
-
*
|
|
2896
|
-
*
|
|
2897
|
-
* console.log("Received messages:", messages) // ["msg1", "msg2"]
|
|
2898
|
-
* }))
|
|
2899
|
-
* })
|
|
2842
|
+
* const actual = await Effect.runPromise(program)
|
|
2843
|
+
* actual // => { published: [true, true, false], messages: ["msg1", "msg2"] }
|
|
2900
2844
|
* ```
|
|
2901
2845
|
*
|
|
2902
2846
|
* @category models
|
|
@@ -2956,33 +2900,30 @@ export class DroppingStrategy<in out A> implements PubSub.Strategy<A> {
|
|
|
2956
2900
|
*
|
|
2957
2901
|
* **Example** (Applying a sliding strategy)
|
|
2958
2902
|
*
|
|
2959
|
-
* ```ts
|
|
2903
|
+
* ```ts import.meta.vitest
|
|
2960
2904
|
* import { Effect, PubSub } from "effect"
|
|
2961
2905
|
*
|
|
2962
|
-
* const program = Effect.gen(function*() {
|
|
2963
|
-
* //
|
|
2964
|
-
* const pubsub = yield* PubSub.
|
|
2965
|
-
*
|
|
2966
|
-
* // Or explicitly create with sliding strategy
|
|
2967
|
-
* const customPubsub = yield* PubSub.make<string>({
|
|
2906
|
+
* const program = Effect.scoped(Effect.gen(function*() {
|
|
2907
|
+
* // Explicitly create a PubSub with a sliding strategy
|
|
2908
|
+
* const pubsub = yield* PubSub.make<string>({
|
|
2968
2909
|
* atomicPubSub: () => PubSub.makeAtomicBounded(2),
|
|
2969
2910
|
* strategy: () => new PubSub.SlidingStrategy()
|
|
2970
2911
|
* })
|
|
2971
2912
|
*
|
|
2972
|
-
* yield*
|
|
2973
|
-
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
2913
|
+
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
2974
2914
|
*
|
|
2975
|
-
*
|
|
2976
|
-
*
|
|
2977
|
-
*
|
|
2978
|
-
*
|
|
2979
|
-
*
|
|
2915
|
+
* // Publish messages that exceed capacity
|
|
2916
|
+
* yield* PubSub.publish(pubsub, "msg1") // stored
|
|
2917
|
+
* yield* PubSub.publish(pubsub, "msg2") // stored
|
|
2918
|
+
* yield* PubSub.publish(pubsub, "msg3") // "msg1" evicted, "msg3" stored
|
|
2919
|
+
* yield* PubSub.publish(pubsub, "msg4") // "msg2" evicted, "msg4" stored
|
|
2980
2920
|
*
|
|
2981
|
-
*
|
|
2982
|
-
*
|
|
2983
|
-
*
|
|
2984
|
-
*
|
|
2985
|
-
*
|
|
2921
|
+
* // Subscribers will see the most recent messages
|
|
2922
|
+
* return yield* PubSub.takeAll(subscription)
|
|
2923
|
+
* }))
|
|
2924
|
+
*
|
|
2925
|
+
* const actual = await Effect.runPromise(program)
|
|
2926
|
+
* actual // => ["msg3", "msg4"]
|
|
2986
2927
|
* ```
|
|
2987
2928
|
*
|
|
2988
2929
|
* @category models
|
|
@@ -3090,27 +3031,40 @@ const strategyCompleteSubscribersUnsafe = <A>(
|
|
|
3090
3031
|
|
|
3091
3032
|
interface ReplayNode<A> {
|
|
3092
3033
|
value: A | AbsentValue
|
|
3034
|
+
index: number
|
|
3093
3035
|
next: ReplayNode<A> | null
|
|
3094
3036
|
}
|
|
3095
3037
|
|
|
3096
3038
|
class ReplayBuffer<A> {
|
|
3097
3039
|
readonly capacity: number
|
|
3098
|
-
head: ReplayNode<A> = { value: AbsentValue, next: null }
|
|
3040
|
+
head: ReplayNode<A> = { value: AbsentValue, index: 0, next: null }
|
|
3099
3041
|
tail: ReplayNode<A> = this.head
|
|
3042
|
+
readonly slideValues: Array<{
|
|
3043
|
+
readonly value: A
|
|
3044
|
+
readonly index: number
|
|
3045
|
+
}> = []
|
|
3100
3046
|
size = 0
|
|
3101
3047
|
index = 0
|
|
3048
|
+
publisherIndex = 0
|
|
3102
3049
|
|
|
3103
3050
|
constructor(capacity: number) {
|
|
3104
3051
|
this.capacity = capacity
|
|
3105
3052
|
}
|
|
3106
3053
|
|
|
3107
|
-
slide() {
|
|
3054
|
+
slide(value: A, publisherIndex: number): void {
|
|
3055
|
+
this.slideValues[this.index % this.capacity] = {
|
|
3056
|
+
value,
|
|
3057
|
+
index: publisherIndex
|
|
3058
|
+
}
|
|
3108
3059
|
this.index++
|
|
3109
3060
|
}
|
|
3110
|
-
offer(a: A):
|
|
3061
|
+
offer(a: A): number {
|
|
3062
|
+
const index = this.publisherIndex++
|
|
3111
3063
|
this.tail.value = a
|
|
3064
|
+
this.tail.index = index
|
|
3112
3065
|
this.tail.next = {
|
|
3113
3066
|
value: AbsentValue,
|
|
3067
|
+
index: 0,
|
|
3114
3068
|
next: null
|
|
3115
3069
|
}
|
|
3116
3070
|
this.tail = this.tail.next
|
|
@@ -3119,6 +3073,7 @@ class ReplayBuffer<A> {
|
|
|
3119
3073
|
} else {
|
|
3120
3074
|
this.size += 1
|
|
3121
3075
|
}
|
|
3076
|
+
return index
|
|
3122
3077
|
}
|
|
3123
3078
|
offerAll(as: Iterable<A>): void {
|
|
3124
3079
|
for (const a of as) {
|
|
@@ -3128,48 +3083,66 @@ class ReplayBuffer<A> {
|
|
|
3128
3083
|
}
|
|
3129
3084
|
|
|
3130
3085
|
class ReplayWindowImpl<A> implements PubSub.ReplayWindow<A> {
|
|
3131
|
-
head: ReplayNode<A>
|
|
3132
|
-
index: number
|
|
3133
|
-
remaining: number
|
|
3134
3086
|
readonly buffer: ReplayBuffer<A>
|
|
3087
|
+
readonly values: Array<A>
|
|
3088
|
+
index = 0
|
|
3089
|
+
remaining: number
|
|
3090
|
+
slideIndex: number
|
|
3091
|
+
newestIndex = -1
|
|
3135
3092
|
|
|
3136
3093
|
constructor(buffer: ReplayBuffer<A>) {
|
|
3137
3094
|
this.buffer = buffer
|
|
3138
|
-
this.index = buffer.index
|
|
3139
3095
|
this.remaining = buffer.size
|
|
3140
|
-
this.
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
this.
|
|
3145
|
-
this.index
|
|
3096
|
+
this.slideIndex = buffer.index
|
|
3097
|
+
this.values = new Array(this.remaining)
|
|
3098
|
+
let node = buffer.head
|
|
3099
|
+
for (let i = 0; i < this.remaining; i++) {
|
|
3100
|
+
this.values[i] = node.value as A
|
|
3101
|
+
this.newestIndex = node.index
|
|
3102
|
+
node = node.next!
|
|
3103
|
+
}
|
|
3104
|
+
}
|
|
3105
|
+
close(): void {
|
|
3106
|
+
this.values.length = 0
|
|
3107
|
+
this.remaining = 0
|
|
3108
|
+
}
|
|
3109
|
+
sync(): void {
|
|
3110
|
+
const slides = this.buffer.index - this.slideIndex
|
|
3111
|
+
if (slides === 0 || this.remaining === 0) {
|
|
3112
|
+
return
|
|
3113
|
+
}
|
|
3114
|
+
const count = Math.min(slides, this.buffer.capacity)
|
|
3115
|
+
const start = this.buffer.index - count
|
|
3116
|
+
for (let i = 0; i < count; i++) {
|
|
3117
|
+
const entry = this.buffer.slideValues[(start + i) % this.buffer.capacity]
|
|
3118
|
+
if (entry.index > this.newestIndex) {
|
|
3119
|
+
this.index = (this.index + 1) % this.values.length
|
|
3120
|
+
this.values[(this.index + this.remaining - 1) % this.values.length] = entry.value
|
|
3121
|
+
this.newestIndex = entry.index
|
|
3122
|
+
}
|
|
3146
3123
|
}
|
|
3124
|
+
this.slideIndex = this.buffer.index
|
|
3147
3125
|
}
|
|
3148
3126
|
take(): A | undefined {
|
|
3149
3127
|
if (this.remaining === 0) {
|
|
3150
3128
|
return undefined
|
|
3151
|
-
} else if (this.index < this.buffer.index) {
|
|
3152
|
-
this.fastForward()
|
|
3153
3129
|
}
|
|
3130
|
+
this.sync()
|
|
3131
|
+
const value = this.values[this.index]
|
|
3132
|
+
this.values[this.index] = AbsentValue as unknown as A
|
|
3133
|
+
this.index = (this.index + 1) % this.values.length
|
|
3154
3134
|
this.remaining--
|
|
3155
|
-
|
|
3156
|
-
|
|
3135
|
+
if (this.remaining === 0) {
|
|
3136
|
+
this.close()
|
|
3137
|
+
}
|
|
3157
3138
|
return value as A
|
|
3158
3139
|
}
|
|
3159
3140
|
takeN(n: number): Array<A> {
|
|
3160
|
-
if (this.remaining === 0) {
|
|
3161
|
-
return []
|
|
3162
|
-
} else if (this.index < this.buffer.index) {
|
|
3163
|
-
this.fastForward()
|
|
3164
|
-
}
|
|
3165
3141
|
const len = Math.min(n, this.remaining)
|
|
3166
3142
|
const items = new Array(len)
|
|
3167
3143
|
for (let i = 0; i < len; i++) {
|
|
3168
|
-
|
|
3169
|
-
this.head = this.head.next!
|
|
3170
|
-
items[i] = value
|
|
3144
|
+
items[i] = this.take()!
|
|
3171
3145
|
}
|
|
3172
|
-
this.remaining -= len
|
|
3173
3146
|
return items
|
|
3174
3147
|
}
|
|
3175
3148
|
takeAll(): Array<A> {
|
|
@@ -3181,5 +3154,6 @@ const emptyReplayWindow: PubSub.ReplayWindow<never> = {
|
|
|
3181
3154
|
remaining: 0,
|
|
3182
3155
|
take: () => undefined,
|
|
3183
3156
|
takeN: () => [],
|
|
3184
|
-
takeAll: () => []
|
|
3157
|
+
takeAll: () => [],
|
|
3158
|
+
close: () => void 0
|
|
3185
3159
|
}
|