effect 4.0.0-beta.101 → 4.0.0-beta.103
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 +462 -412
- 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 +166 -101
- 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 +729 -768
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +541 -449
- 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 +226 -174
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +339 -267
- 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 +122 -87
- 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 +151 -274
- 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 +9 -10
- 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 +18 -24
- 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 +132 -186
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +2897 -3342
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +1383 -1580
- 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 +29 -21
- 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 +13 -55
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/ExecutionPlan.js +7 -28
- 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 +109 -75
- 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 +85 -59
- package/dist/FiberSet.js.map +1 -1
- package/dist/FileSystem.d.ts +153 -264
- 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 +76 -145
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +40 -57
- 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 +230 -307
- 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 +46 -103
- 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 +300 -239
- 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 +195 -175
- 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 +207 -452
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +16 -5
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/ManagedRuntime.js +10 -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 +202 -645
- 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 +190 -292
- 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 +213 -393
- 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.d.ts.map +1 -1
- package/dist/PartitionedSemaphore.js +1 -4
- 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 +361 -466
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +163 -216
- 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 -213
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +102 -213
- 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 +25 -19
- 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 +135 -218
- 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 +290 -1636
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +162 -803
- 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 +1835 -1060
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +2708 -1050
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +29 -52
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +537 -391
- 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 +8 -7
- package/dist/SchemaError.js.map +1 -1
- package/dist/SchemaGetter.d.ts +230 -185
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +252 -209
- 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 +74 -266
- 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 +123 -86
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +398 -1513
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +290 -2854
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +116 -76
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +123 -88
- 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.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 +101 -13
- 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 +117 -107
- 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 +2430 -2958
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +1124 -1397
- 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 +46 -54
- 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.map +1 -1
- package/dist/Take.js.map +1 -1
- package/dist/Terminal.d.ts +2 -2
- package/dist/Terminal.js +1 -1
- 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 +92 -127
- 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 +97 -66
- package/dist/TxReentrantLock.d.ts.map +1 -1
- package/dist/TxReentrantLock.js +67 -45
- 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 +127 -70
- 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.d.ts +0 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -4
- package/dist/index.js.map +1 -1
- package/dist/internal/array.js.map +1 -1
- package/dist/internal/core.js +3 -2
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/dateTime.js +4 -0
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/doNotation.js.map +1 -1
- package/dist/internal/effect.js +141 -61
- 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.map +1 -1
- 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.d.ts +0 -3
- package/dist/internal/record.d.ts.map +1 -1
- package/dist/internal/record.js +10 -5
- package/dist/internal/record.js.map +1 -1
- package/dist/internal/redacted.js.map +1 -1
- package/dist/internal/references.js +3 -4
- 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 +12 -0
- package/dist/internal/schema/annotations.js.map +1 -1
- package/dist/internal/schema/cause.js.map +1 -1
- package/dist/internal/schema/fromJsonSchemaDocument.d.ts +2 -0
- package/dist/internal/schema/fromJsonSchemaDocument.d.ts.map +1 -0
- package/dist/internal/schema/fromJsonSchemaDocument.js +745 -0
- package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -0
- package/dist/internal/schema/fromRepresentation.d.ts +2 -0
- package/dist/internal/schema/fromRepresentation.d.ts.map +1 -0
- package/dist/internal/schema/fromRepresentation.js +245 -0
- package/dist/internal/schema/fromRepresentation.js.map +1 -0
- 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 +28 -40
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/internal/schema/{arbitrary.d.ts → toArbitrary.d.ts} +1 -1
- package/dist/internal/schema/toArbitrary.d.ts.map +1 -0
- package/dist/internal/schema/{arbitrary.js → toArbitrary.js} +8 -9
- package/dist/internal/schema/toArbitrary.js.map +1 -0
- package/dist/internal/schema/toCodeDocument.d.ts +2 -0
- package/dist/internal/schema/toCodeDocument.d.ts.map +1 -0
- package/dist/internal/schema/toCodeDocument.js +438 -0
- package/dist/internal/schema/toCodeDocument.js.map +1 -0
- package/dist/internal/schema/toEquivalence.d.ts +2 -0
- package/dist/internal/schema/toEquivalence.d.ts.map +1 -0
- package/dist/internal/schema/{equivalence.js → toEquivalence.js} +15 -13
- package/dist/internal/schema/toEquivalence.js.map +1 -0
- package/dist/internal/schema/toJsonSchemaDocument.d.ts +2 -0
- package/dist/internal/schema/toJsonSchemaDocument.d.ts.map +1 -0
- package/dist/internal/schema/toJsonSchemaDocument.js +508 -0
- package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -0
- package/dist/internal/schema/toRepresentation.d.ts +2 -0
- package/dist/internal/schema/toRepresentation.d.ts.map +1 -0
- package/dist/internal/schema/toRepresentation.js +349 -0
- package/dist/internal/schema/toRepresentation.js.map +1 -0
- package/dist/internal/stackTraceLimit.js +3 -6
- 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 +13 -9
- 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 +54 -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 +29 -29
- 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 +121 -144
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +99 -121
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +22 -7
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +87 -317
- 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 +55 -51
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.d.ts +1 -1
- package/dist/unstable/ai/EmbeddingModel.js +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 +111 -68
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +123 -81
- 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 +316 -250
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +71 -63
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +71 -62
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +765 -245
- 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 +33 -11
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +194 -378
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Prompt.d.ts +112 -38
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Prompt.js +53 -17
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +47 -33
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js +23 -18
- 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 +63 -44
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +59 -42
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +35 -9
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +32 -14
- 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 +15 -12
- 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.d.ts +2 -0
- package/dist/unstable/ai/internal/structured-output.d.ts.map +1 -0
- package/dist/unstable/ai/internal/structured-output.js +315 -0
- package/dist/unstable/ai/internal/structured-output.js.map +1 -0
- 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 +105 -74
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +98 -63
- 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 +705 -107
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +252 -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 +292 -78
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +131 -49
- 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 +345 -137
- 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 +23 -14
- 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.map +1 -1
- package/dist/unstable/cli/internal/auto-suggest.js.map +1 -1
- package/dist/unstable/cli/internal/command.d.ts +3 -1
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +11 -4
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/completions/bash.js.map +1 -1
- package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -1
- 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.d.ts +0 -48
- package/dist/unstable/cli/internal/config.d.ts.map +1 -1
- package/dist/unstable/cli/internal/config.js +8 -10
- package/dist/unstable/cli/internal/config.js.map +1 -1
- 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 +2 -2
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- 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.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 +9 -9
- 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.d.ts.map +1 -1
- package/dist/unstable/cluster/Envelope.js +5 -4
- 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.js +5 -5
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +5 -5
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/Runner.d.ts +1 -1
- package/dist/unstable/cluster/Runner.js +1 -1
- package/dist/unstable/cluster/Runner.js.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.d.ts +1 -1
- package/dist/unstable/cluster/RunnerAddress.js +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 +16 -16
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.d.ts +2 -2
- package/dist/unstable/cluster/RunnerStorage.js +1 -1
- 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 +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 +128 -26
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +13 -5
- package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
- 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.d.ts +4 -2
- package/dist/unstable/cluster/SingleRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/SingleRunner.js +2 -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.d.ts +7 -4
- package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +56 -25
- 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 +127 -65
- 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 +24 -12
- 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.map +1 -1
- package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
- package/dist/unstable/cluster/internal/shardLock.d.ts +2 -0
- package/dist/unstable/cluster/internal/shardLock.d.ts.map +1 -0
- package/dist/unstable/cluster/internal/shardLock.js +4 -0
- package/dist/unstable/cluster/internal/shardLock.js.map +1 -0
- package/dist/unstable/devtools/DevTools.js.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.d.ts +20 -20
- package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js +8 -5
- 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/Msgpack.d.ts.map +1 -1
- package/dist/unstable/encoding/Msgpack.js +6 -8
- package/dist/unstable/encoding/Msgpack.js.map +1 -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 +58 -8
- package/dist/unstable/encoding/Sse.js.map +1 -1
- 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.js +14 -14
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts +3 -3
- package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLog.js +18 -14
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.d.ts +2 -2
- package/dist/unstable/eventlog/EventLogEncryption.js +2 -2
- package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +6 -6
- package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.js +9 -4
- 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 +14 -6
- 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.js +2 -2
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +3 -3
- 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 +54 -40
- 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/Headers.d.ts +2 -2
- package/dist/unstable/http/Headers.js +10 -10
- 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.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts +44 -0
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +16 -0
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts +4 -4
- package/dist/unstable/http/HttpClientResponse.js +2 -2
- 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 +32 -0
- 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 +9 -8
- 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 +10 -0
- 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 +6 -6
- package/dist/unstable/http/Multipart.d.ts.map +1 -1
- package/dist/unstable/http/Multipart.js +22 -20
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/Template.js +1 -1
- 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 +26 -31
- package/dist/unstable/http/UrlParams.js.map +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/preResponseHandler.js.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js +3 -3
- 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 +10 -11
- 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 +16 -18
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +42 -42
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +13 -13
- package/dist/unstable/httpapi/HttpApiError.js +13 -13
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.d.ts +15 -15
- package/dist/unstable/httpapi/HttpApiGroup.js +1 -1
- 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 +6 -6
- package/dist/unstable/httpapi/HttpApiSchema.js +4 -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 +13 -13
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +50 -37
- 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 +70 -1
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +84 -6
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.d.ts +4 -3
- 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 +11 -4
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.js +5 -2
- 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.d.ts +4 -3
- package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js +2 -2
- 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.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistable.js +2 -1
- 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.js +6 -6
- 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 +91 -15
- package/dist/unstable/persistence/Persistence.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +28 -17
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +26 -15
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/persistence/Redis.d.ts +2 -2
- package/dist/unstable/persistence/Redis.d.ts.map +1 -1
- package/dist/unstable/persistence/Redis.js +3 -3
- 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 +4 -2
- 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 +14 -13
- package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +105 -19
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +44 -12
- 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 +25 -4
- 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 +12 -12
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +14 -12
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- 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 +175 -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 +52 -50
- 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 +6 -7
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.js +15 -12
- 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 +12 -4
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +10 -5
- 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 +2 -2
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/sql/SqlConnection.js.map +1 -1
- package/dist/unstable/sql/SqlError.d.ts +2 -2
- package/dist/unstable/sql/SqlError.js +2 -2
- 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 +2 -2
- 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 +22 -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 +6 -6
- 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 +1 -1
- 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 +5 -6
- package/src/Array.ts +1068 -1070
- package/src/BigDecimal.ts +433 -756
- package/src/BigInt.ts +213 -269
- package/src/Boolean.ts +146 -188
- package/src/Cache.ts +409 -255
- package/src/Cause.ts +167 -277
- package/src/Channel.ts +923 -830
- 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 +618 -334
- package/src/ConfigProvider.ts +221 -127
- package/src/Console.ts +289 -39
- package/src/Context.ts +319 -378
- package/src/Cron.ts +68 -77
- package/src/Crypto.ts +13 -15
- package/src/Data.ts +63 -82
- package/src/DateTime.ts +564 -660
- package/src/Deferred.ts +253 -256
- package/src/Duration.ts +216 -308
- package/src/Effect.ts +2958 -3390
- package/src/Encoding.ts +22 -40
- package/src/Equal.ts +49 -39
- package/src/Equivalence.ts +103 -105
- package/src/ErrorReporter.ts +51 -27
- package/src/ExecutionPlan.ts +13 -55
- package/src/Exit.ts +116 -192
- package/src/Fiber.ts +81 -148
- package/src/FiberHandle.ts +155 -107
- package/src/FiberMap.ts +225 -174
- package/src/FiberSet.ts +124 -82
- package/src/FileSystem.ts +155 -263
- package/src/Filter.ts +61 -33
- package/src/Formatter.ts +54 -56
- package/src/Function.ts +76 -145
- 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 +622 -787
- package/src/JsonPatch.ts +60 -113
- package/src/JsonPointer.ts +8 -8
- package/src/JsonSchema.ts +405 -249
- package/src/Latch.ts +23 -35
- package/src/Layer.ts +359 -260
- package/src/LayerMap.ts +49 -29
- package/src/LayerRef.ts +6 -2
- package/src/LogLevel.ts +114 -214
- package/src/Logger.ts +347 -699
- package/src/ManagedRuntime.ts +20 -5
- package/src/Match.ts +217 -252
- package/src/Metric.ts +520 -1092
- 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 +246 -385
- package/src/Option.ts +449 -813
- package/src/Order.ts +109 -109
- package/src/Ordering.ts +20 -23
- package/src/PartitionedSemaphore.ts +1 -4
- 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 +387 -487
- 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 -214
- package/src/RegExp.ts +10 -14
- package/src/Request.ts +36 -28
- package/src/RequestResolver.ts +202 -91
- package/src/Result.ts +314 -485
- package/src/Runtime.ts +50 -75
- package/src/Schedule.ts +308 -1734
- package/src/Scheduler.ts +20 -7
- package/src/Schema.ts +3156 -1634
- package/src/SchemaAST.ts +676 -489
- package/src/SchemaError.ts +8 -7
- package/src/SchemaGetter.ts +277 -218
- package/src/SchemaIssue.ts +90 -276
- package/src/SchemaParser.ts +179 -116
- package/src/SchemaRepresentation.ts +698 -3417
- package/src/SchemaTransformation.ts +132 -91
- package/src/Scope.ts +123 -151
- package/src/ScopedRef.ts +4 -4
- package/src/Semaphore.ts +157 -54
- package/src/Sink.ts +128 -113
- package/src/Stdio.ts +1 -1
- package/src/Stream.ts +2665 -3142
- package/src/String.ts +275 -312
- package/src/Struct.ts +114 -118
- package/src/SubscriptionRef.ts +284 -252
- package/src/Symbol.ts +3 -3
- package/src/Terminal.ts +2 -2
- package/src/Tracer.ts +102 -55
- package/src/Trie.ts +287 -679
- package/src/Tuple.ts +92 -127
- 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 +97 -66
- package/src/TxRef.ts +51 -32
- package/src/TxSemaphore.ts +129 -95
- package/src/TxSubscriptionRef.ts +97 -70
- package/src/Types.ts +127 -70
- package/src/Unify.ts +45 -65
- package/src/Utils.ts +23 -16
- package/src/index.ts +0 -5
- package/src/internal/core.ts +5 -4
- package/src/internal/dateTime.ts +6 -0
- package/src/internal/effect.ts +160 -79
- package/src/internal/matcher.ts +1 -1
- package/src/internal/persistence.ts +2 -0
- package/src/internal/record.ts +11 -7
- package/src/internal/references.ts +3 -7
- package/src/internal/schema/annotations.ts +44 -0
- package/src/internal/schema/fromJsonSchemaDocument.ts +959 -0
- package/src/internal/schema/fromRepresentation.ts +339 -0
- package/src/internal/schema/parser.ts +22 -0
- package/src/internal/schema/schema.ts +45 -46
- package/src/internal/schema/{arbitrary.ts → toArbitrary.ts} +8 -10
- package/src/internal/schema/toCodeDocument.ts +572 -0
- package/src/internal/schema/{equivalence.ts → toEquivalence.ts} +12 -7
- package/src/internal/schema/toJsonSchemaDocument.ts +529 -0
- package/src/internal/schema/toRepresentation.ts +386 -0
- package/src/internal/stackTraceLimit.ts +3 -7
- package/src/internal/trie.ts +10 -11
- package/src/testing/FastCheck.ts +8 -7
- package/src/testing/TestClock.ts +73 -31
- package/src/testing/TestConsole.ts +32 -31
- package/src/testing/TestSchema.ts +29 -29
- package/src/unstable/ai/AiError.ts +100 -122
- package/src/unstable/ai/AnthropicStructuredOutput.ts +103 -334
- package/src/unstable/ai/Chat.ts +132 -97
- package/src/unstable/ai/EmbeddingModel.ts +1 -1
- package/src/unstable/ai/IdGenerator.ts +32 -28
- package/src/unstable/ai/LanguageModel.ts +137 -95
- package/src/unstable/ai/McpProtocol.ts +48 -0
- package/src/unstable/ai/McpSchema.ts +75 -65
- package/src/unstable/ai/McpServer.ts +1045 -303
- package/src/unstable/ai/Model.ts +9 -20
- package/src/unstable/ai/OpenAiStructuredOutput.ts +231 -396
- package/src/unstable/ai/Prompt.ts +145 -43
- package/src/unstable/ai/Response.ts +52 -38
- package/src/unstable/ai/Telemetry.ts +46 -13
- package/src/unstable/ai/Tokenizer.ts +14 -3
- package/src/unstable/ai/Tool.ts +81 -48
- package/src/unstable/ai/Toolkit.ts +45 -15
- package/src/unstable/ai/index.ts +5 -0
- package/src/unstable/ai/internal/codec-transformer.ts +13 -7
- 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 +453 -0
- package/src/unstable/cli/Argument.ts +273 -69
- package/src/unstable/cli/CliError.ts +116 -77
- package/src/unstable/cli/CliOutput.ts +44 -58
- package/src/unstable/cli/Command.ts +709 -111
- 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 +295 -81
- package/src/unstable/cli/Primitive.ts +371 -150
- package/src/unstable/cli/Prompt.ts +28 -14
- package/src/unstable/cli/internal/command.ts +13 -5
- package/src/unstable/cli/internal/config.ts +8 -10
- package/src/unstable/cli/internal/lexer.ts +8 -2
- package/src/unstable/cli/internal/parser.ts +2 -2
- package/src/unstable/cluster/ClusterSchema.ts +8 -8
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +8 -4
- package/src/unstable/cluster/Entity.ts +16 -17
- package/src/unstable/cluster/EntityProxy.ts +4 -2
- package/src/unstable/cluster/EntityResource.ts +2 -2
- package/src/unstable/cluster/Envelope.ts +5 -4
- package/src/unstable/cluster/HttpRunner.ts +6 -4
- package/src/unstable/cluster/Message.ts +9 -9
- package/src/unstable/cluster/MessageStorage.ts +15 -15
- package/src/unstable/cluster/Reply.ts +5 -7
- package/src/unstable/cluster/Runner.ts +1 -1
- package/src/unstable/cluster/RunnerAddress.ts +1 -1
- package/src/unstable/cluster/RunnerHealth.ts +1 -1
- package/src/unstable/cluster/RunnerServer.ts +41 -8
- package/src/unstable/cluster/RunnerStorage.ts +2 -2
- package/src/unstable/cluster/Runners.ts +23 -12
- package/src/unstable/cluster/ShardId.ts +1 -1
- package/src/unstable/cluster/Sharding.ts +168 -42
- package/src/unstable/cluster/ShardingConfig.ts +8 -4
- package/src/unstable/cluster/SingleRunner.ts +4 -2
- package/src/unstable/cluster/SingletonAddress.ts +1 -1
- package/src/unstable/cluster/Snowflake.ts +8 -8
- package/src/unstable/cluster/SqlMessageStorage.ts +84 -36
- package/src/unstable/cluster/SqlRunnerStorage.ts +205 -119
- package/src/unstable/cluster/internal/entityManager.ts +42 -25
- package/src/unstable/cluster/internal/shardLock.ts +9 -0
- package/src/unstable/devtools/DevToolsSchema.ts +10 -5
- package/src/unstable/encoding/Msgpack.ts +6 -8
- package/src/unstable/encoding/Sse.ts +98 -16
- package/src/unstable/eventlog/Event.ts +20 -20
- package/src/unstable/eventlog/EventGroup.ts +4 -4
- package/src/unstable/eventlog/EventJournal.ts +16 -16
- package/src/unstable/eventlog/EventLog.ts +24 -14
- package/src/unstable/eventlog/EventLogEncryption.ts +2 -2
- package/src/unstable/eventlog/EventLogMessage.ts +12 -5
- 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 +14 -6
- package/src/unstable/eventlog/EventLogSessionAuth.ts +1 -1
- package/src/unstable/eventlog/SqlEventJournal.ts +2 -2
- package/src/unstable/eventlog/SqlEventLogServerEncrypted.ts +1 -1
- package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +6 -3
- package/src/unstable/http/Cookies.ts +64 -45
- package/src/unstable/http/Etag.ts +1 -1
- package/src/unstable/http/FetchHttpClient.ts +3 -1
- package/src/unstable/http/Headers.ts +10 -10
- package/src/unstable/http/HttpBody.ts +20 -5
- package/src/unstable/http/HttpClient.ts +83 -55
- package/src/unstable/http/HttpClientRequest.ts +59 -0
- package/src/unstable/http/HttpClientResponse.ts +4 -4
- 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 +95 -0
- 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 +9 -8
- package/src/unstable/http/HttpServerResponse.ts +30 -0
- package/src/unstable/http/HttpStaticServer.ts +35 -7
- package/src/unstable/http/Multipart.ts +22 -19
- package/src/unstable/http/Template.ts +1 -1
- package/src/unstable/http/Url.ts +33 -63
- package/src/unstable/http/UrlParams.ts +27 -32
- package/src/unstable/http/internal/compression.ts +196 -0
- package/src/unstable/httpapi/HttpApi.ts +3 -3
- package/src/unstable/httpapi/HttpApiBuilder.ts +10 -9
- package/src/unstable/httpapi/HttpApiClient.ts +19 -19
- package/src/unstable/httpapi/HttpApiEndpoint.ts +42 -42
- package/src/unstable/httpapi/HttpApiError.ts +13 -13
- package/src/unstable/httpapi/HttpApiGroup.ts +16 -16
- package/src/unstable/httpapi/HttpApiMiddleware.ts +71 -24
- package/src/unstable/httpapi/HttpApiScalar.ts +0 -12
- package/src/unstable/httpapi/HttpApiSchema.ts +6 -6
- package/src/unstable/httpapi/OpenApi.ts +65 -41
- package/src/unstable/observability/OtlpExporter.ts +126 -10
- package/src/unstable/observability/OtlpLogger.ts +5 -5
- package/src/unstable/observability/OtlpMetrics.ts +12 -5
- package/src/unstable/observability/OtlpResource.ts +26 -17
- package/src/unstable/observability/OtlpTracer.ts +8 -4
- 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 +11 -10
- package/src/unstable/persistence/PersistedQueue.ts +6 -6
- package/src/unstable/persistence/Persistence.ts +126 -19
- package/src/unstable/persistence/RateLimiter.ts +28 -17
- package/src/unstable/persistence/Redis.ts +4 -4
- package/src/unstable/process/ChildProcess.ts +64 -21
- package/src/unstable/process/ChildProcessSpawner.ts +22 -11
- package/src/unstable/reactivity/AsyncResult.ts +16 -16
- package/src/unstable/reactivity/Atom.ts +117 -22
- package/src/unstable/reactivity/AtomHttpApi.ts +5 -4
- package/src/unstable/reactivity/AtomRegistry.ts +25 -4
- 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 +18 -16
- 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 +19 -29
- package/src/unstable/socket/Socket.ts +18 -5
- package/src/unstable/sql/SqlClient.ts +5 -6
- package/src/unstable/sql/SqlError.ts +2 -2
- package/src/unstable/sql/SqlModel.ts +2 -2
- package/src/unstable/sql/SqlResolver.ts +5 -5
- package/src/unstable/sql/Statement.ts +31 -29
- package/src/unstable/workers/Transferable.ts +1 -1
- package/src/unstable/workers/Worker.ts +2 -2
- package/src/unstable/workers/WorkerError.ts +7 -7
- 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 +1 -1
- package/src/unstable/workflow/WorkflowProxy.ts +4 -2
- package/dist/SchemaUtils.d.ts +0 -28
- package/dist/SchemaUtils.d.ts.map +0 -1
- package/dist/SchemaUtils.js +0 -45
- package/dist/SchemaUtils.js.map +0 -1
- package/dist/internal/schema/arbitrary.d.ts.map +0 -1
- package/dist/internal/schema/arbitrary.js.map +0 -1
- package/dist/internal/schema/equivalence.d.ts +0 -2
- package/dist/internal/schema/equivalence.d.ts.map +0 -1
- package/dist/internal/schema/equivalence.js.map +0 -1
- package/dist/internal/schema/representation.d.ts +0 -2
- package/dist/internal/schema/representation.d.ts.map +0 -1
- package/dist/internal/schema/representation.js +0 -865
- package/dist/internal/schema/representation.js.map +0 -1
- 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/src/SchemaUtils.ts +0 -51
- package/src/internal/schema/representation.ts +0 -795
- package/src/internal/version.ts +0 -2
package/dist/Iterable.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import * as Equal from "./Equal.js";
|
|
12
12
|
import { dual } from "./Function.js";
|
|
13
|
+
import * as InternalRecord from "./internal/record.js";
|
|
13
14
|
import * as O from "./Option.js";
|
|
14
15
|
import { isBoolean } from "./Predicate.js";
|
|
15
16
|
import * as R from "./Result.js";
|
|
@@ -25,21 +26,21 @@ import * as Tuple from "./Tuple.js";
|
|
|
25
26
|
*
|
|
26
27
|
* **Example** (Generating values by index)
|
|
27
28
|
*
|
|
28
|
-
* ```ts
|
|
29
|
+
* ```ts import.meta.vitest
|
|
29
30
|
* import { Iterable } from "effect"
|
|
30
31
|
*
|
|
31
32
|
* // Generate first 5 even numbers
|
|
32
33
|
* const evens = Iterable.makeBy((n) => n * 2, { length: 5 })
|
|
33
|
-
*
|
|
34
|
+
* Array.from(evens) // => [0, 2, 4, 6, 8]
|
|
34
35
|
*
|
|
35
36
|
* // Generate squares
|
|
36
37
|
* const squares = Iterable.makeBy((n) => n * n, { length: 4 })
|
|
37
|
-
*
|
|
38
|
+
* Array.from(squares) // => [0, 1, 4, 9]
|
|
38
39
|
*
|
|
39
40
|
* // Infinite sequence (be careful when consuming!)
|
|
40
41
|
* const naturals = Iterable.makeBy((n) => n)
|
|
41
42
|
* const first10 = Iterable.take(naturals, 10)
|
|
42
|
-
*
|
|
43
|
+
* Array.from(first10) // => [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
43
44
|
* ```
|
|
44
45
|
*
|
|
45
46
|
* @category constructors
|
|
@@ -78,11 +79,10 @@ export const makeBy = (f, options) => {
|
|
|
78
79
|
*
|
|
79
80
|
* **Example** (Creating a range)
|
|
80
81
|
*
|
|
81
|
-
* ```ts
|
|
82
|
+
* ```ts import.meta.vitest
|
|
82
83
|
* import { Iterable } from "effect"
|
|
83
|
-
* import * as assert from "node:assert"
|
|
84
84
|
*
|
|
85
|
-
*
|
|
85
|
+
* Array.from(Iterable.range(1, 3)) // => [1, 2, 3]
|
|
86
86
|
* ```
|
|
87
87
|
*
|
|
88
88
|
* @category constructors
|
|
@@ -105,11 +105,10 @@ export const range = (start, end) => {
|
|
|
105
105
|
*
|
|
106
106
|
* **Example** (Repeating a value)
|
|
107
107
|
*
|
|
108
|
-
* ```ts
|
|
108
|
+
* ```ts import.meta.vitest
|
|
109
109
|
* import { Iterable } from "effect"
|
|
110
|
-
* import * as assert from "node:assert"
|
|
111
110
|
*
|
|
112
|
-
*
|
|
111
|
+
* Array.from(Iterable.replicate("a", 3)) // => ["a", "a", "a"]
|
|
113
112
|
* ```
|
|
114
113
|
*
|
|
115
114
|
* @category constructors
|
|
@@ -163,15 +162,11 @@ export const forever = self => repeat(self, Infinity);
|
|
|
163
162
|
*
|
|
164
163
|
* **Example** (Converting a record to entries)
|
|
165
164
|
*
|
|
166
|
-
* ```ts
|
|
165
|
+
* ```ts import.meta.vitest
|
|
167
166
|
* import { Iterable } from "effect"
|
|
168
|
-
* import * as assert from "node:assert"
|
|
169
167
|
*
|
|
170
168
|
* const x = { a: 1, b: 2, c: 3 }
|
|
171
|
-
*
|
|
172
|
-
* "c",
|
|
173
|
-
* 3
|
|
174
|
-
* ]])
|
|
169
|
+
* Array.from(Iterable.fromRecord(x)) // => [["a", 1], ["b", 2], ["c", 3]]
|
|
175
170
|
* ```
|
|
176
171
|
*
|
|
177
172
|
* @category converting
|
|
@@ -191,17 +186,17 @@ export const fromRecord = self => ({
|
|
|
191
186
|
*
|
|
192
187
|
* **Example** (Prepending an element)
|
|
193
188
|
*
|
|
194
|
-
* ```ts
|
|
189
|
+
* ```ts import.meta.vitest
|
|
195
190
|
* import { Iterable } from "effect"
|
|
196
191
|
*
|
|
197
192
|
* const numbers = [2, 3, 4]
|
|
198
193
|
* const withOne = Iterable.prepend(numbers, 1)
|
|
199
|
-
*
|
|
194
|
+
* Array.from(withOne) // => [1, 2, 3, 4]
|
|
200
195
|
*
|
|
201
196
|
* // Works with any iterable
|
|
202
197
|
* const letters = "abc"
|
|
203
198
|
* const withZ = Iterable.prepend(letters, "z")
|
|
204
|
-
*
|
|
199
|
+
* Array.from(withZ) // => ["z", "a", "b", "c"]
|
|
205
200
|
* ```
|
|
206
201
|
*
|
|
207
202
|
* @category combining
|
|
@@ -213,14 +208,10 @@ export const prepend = /*#__PURE__*/dual(2, (self, head) => prependAll(self, [he
|
|
|
213
208
|
*
|
|
214
209
|
* **Example** (Prepending another iterable)
|
|
215
210
|
*
|
|
216
|
-
* ```ts
|
|
211
|
+
* ```ts import.meta.vitest
|
|
217
212
|
* import { Iterable } from "effect"
|
|
218
|
-
* import * as assert from "node:assert"
|
|
219
213
|
*
|
|
220
|
-
*
|
|
221
|
-
* Array.from(Iterable.prependAll([1, 2], ["a", "b"])),
|
|
222
|
-
* ["a", "b", 1, 2]
|
|
223
|
-
* )
|
|
214
|
+
* Array.from(Iterable.prependAll([1, 2], ["a", "b"])) // => ["a", "b", 1, 2]
|
|
224
215
|
* ```
|
|
225
216
|
*
|
|
226
217
|
* @category combining
|
|
@@ -247,19 +238,11 @@ export const prependAll = /*#__PURE__*/dual(2, (self, that) => appendAll(that, s
|
|
|
247
238
|
*
|
|
248
239
|
* **Example** (Appending an element)
|
|
249
240
|
*
|
|
250
|
-
* ```ts
|
|
241
|
+
* ```ts import.meta.vitest
|
|
251
242
|
* import { Iterable } from "effect"
|
|
252
243
|
*
|
|
253
244
|
* const numbers = [1, 2, 3]
|
|
254
|
-
*
|
|
255
|
-
* console.log(Array.from(withFour)) // [1, 2, 3, 4]
|
|
256
|
-
*
|
|
257
|
-
* // Chain multiple appends
|
|
258
|
-
* const result = Iterable.append(
|
|
259
|
-
* Iterable.append([1, 2], 3),
|
|
260
|
-
* 4
|
|
261
|
-
* )
|
|
262
|
-
* console.log(Array.from(result)) // [1, 2, 3, 4]
|
|
245
|
+
* Array.from(Iterable.append(numbers, 4)) // => [1, 2, 3, 4]
|
|
263
246
|
* ```
|
|
264
247
|
*
|
|
265
248
|
* @see {@link prepend} for adding one element before the existing elements
|
|
@@ -288,25 +271,21 @@ export const append = /*#__PURE__*/dual(2, (self, last) => appendAll(self, [last
|
|
|
288
271
|
*
|
|
289
272
|
* **Example** (Concatenating iterables)
|
|
290
273
|
*
|
|
291
|
-
* ```ts
|
|
274
|
+
* ```ts import.meta.vitest
|
|
292
275
|
* import { Iterable } from "effect"
|
|
293
276
|
*
|
|
294
|
-
*
|
|
295
|
-
* const second = [4, 5, 6]
|
|
296
|
-
* const combined = Iterable.appendAll(first, second)
|
|
297
|
-
* console.log(Array.from(combined)) // [1, 2, 3, 4, 5, 6]
|
|
277
|
+
* Array.from(Iterable.appendAll([1, 2, 3], [4, 5, 6])) // => [1, 2, 3, 4, 5, 6]
|
|
298
278
|
*
|
|
299
279
|
* // Works with different iterable types
|
|
300
280
|
* const numbers = [1, 2]
|
|
301
281
|
* const letters = "abc"
|
|
302
282
|
* const mixed = Iterable.appendAll(numbers, letters)
|
|
303
|
-
*
|
|
283
|
+
* Array.from(mixed) // => [1, 2, "a", "b", "c"]
|
|
304
284
|
*
|
|
305
285
|
* // Lazy evaluation - only consumes what's needed
|
|
306
286
|
* const infinite = Iterable.range(1)
|
|
307
287
|
* const finite = [0, -1, -2]
|
|
308
|
-
*
|
|
309
|
-
* console.log(Array.from(result)) // [0, -1, -2, 1, 2]
|
|
288
|
+
* Array.from(Iterable.take(Iterable.appendAll(finite, infinite), 5)) // => [0, -1, -2, 1, 2]
|
|
310
289
|
* ```
|
|
311
290
|
*
|
|
312
291
|
* @see {@link append} for appending one value instead of another iterable
|
|
@@ -341,23 +320,23 @@ export const appendAll = /*#__PURE__*/dual(2, (self, that) => ({
|
|
|
341
320
|
*
|
|
342
321
|
* **Example** (Tracking running results)
|
|
343
322
|
*
|
|
344
|
-
* ```ts
|
|
323
|
+
* ```ts import.meta.vitest
|
|
345
324
|
* import { Iterable } from "effect"
|
|
346
325
|
*
|
|
347
326
|
* // Running sum of numbers
|
|
348
327
|
* const numbers = [1, 2, 3, 4, 5]
|
|
349
328
|
* const runningSum = Iterable.scan(numbers, 0, (acc, n) => acc + n)
|
|
350
|
-
*
|
|
329
|
+
* Array.from(runningSum) // => [0, 1, 3, 6, 10, 15]
|
|
351
330
|
*
|
|
352
331
|
* // Build strings progressively
|
|
353
332
|
* const letters = ["a", "b", "c"]
|
|
354
333
|
* const progressive = Iterable.scan(letters, "", (acc, letter) => acc + letter)
|
|
355
|
-
*
|
|
334
|
+
* Array.from(progressive) // => ["", "a", "ab", "abc"]
|
|
356
335
|
*
|
|
357
336
|
* // Track maximum values seen so far
|
|
358
337
|
* const values = [3, 1, 4, 1, 5, 9, 2]
|
|
359
338
|
* const runningMax = Iterable.scan(values, -Infinity, Math.max)
|
|
360
|
-
*
|
|
339
|
+
* Array.from(runningMax) // => [-Infinity, 3, 3, 4, 4, 5, 9, 9]
|
|
361
340
|
* ```
|
|
362
341
|
*
|
|
363
342
|
* @category folding
|
|
@@ -395,12 +374,11 @@ export const scan = /*#__PURE__*/dual(3, (self, b, f) => ({
|
|
|
395
374
|
*
|
|
396
375
|
* **Example** (Checking for emptiness)
|
|
397
376
|
*
|
|
398
|
-
* ```ts
|
|
377
|
+
* ```ts import.meta.vitest
|
|
399
378
|
* import { Iterable } from "effect"
|
|
400
|
-
* import * as assert from "node:assert"
|
|
401
379
|
*
|
|
402
|
-
*
|
|
403
|
-
*
|
|
380
|
+
* Iterable.isEmpty([]) // => true
|
|
381
|
+
* Iterable.isEmpty([1, 2, 3]) // => false
|
|
404
382
|
* ```
|
|
405
383
|
*
|
|
406
384
|
* @category guards
|
|
@@ -415,22 +393,22 @@ export const isEmpty = self => {
|
|
|
415
393
|
*
|
|
416
394
|
* **Example** (Counting iterable elements)
|
|
417
395
|
*
|
|
418
|
-
* ```ts
|
|
396
|
+
* ```ts import.meta.vitest
|
|
419
397
|
* import { Iterable } from "effect"
|
|
420
398
|
*
|
|
421
399
|
* const numbers = [1, 2, 3, 4, 5]
|
|
422
|
-
*
|
|
400
|
+
* Iterable.size(numbers) // => 5
|
|
423
401
|
*
|
|
424
402
|
* const empty = Iterable.empty<number>()
|
|
425
|
-
*
|
|
403
|
+
* Iterable.size(empty) // => 0
|
|
426
404
|
*
|
|
427
405
|
* // Works with any iterable
|
|
428
406
|
* const letters = "hello"
|
|
429
|
-
*
|
|
407
|
+
* Iterable.size(letters) // => 5
|
|
430
408
|
*
|
|
431
409
|
* // Note: This consumes the entire iterable
|
|
432
410
|
* const range = Iterable.range(1, 100)
|
|
433
|
-
*
|
|
411
|
+
* Iterable.size(range) // => 100
|
|
434
412
|
* ```
|
|
435
413
|
*
|
|
436
414
|
* @category getters
|
|
@@ -449,24 +427,24 @@ export const size = self => {
|
|
|
449
427
|
*
|
|
450
428
|
* **Example** (Getting the first element)
|
|
451
429
|
*
|
|
452
|
-
* ```ts
|
|
430
|
+
* ```ts import.meta.vitest
|
|
453
431
|
* import { Iterable, Option } from "effect"
|
|
454
432
|
*
|
|
455
433
|
* const numbers = [1, 2, 3]
|
|
456
|
-
*
|
|
434
|
+
* Iterable.head(numbers) // => Option.some(1)
|
|
457
435
|
*
|
|
458
436
|
* const empty = Iterable.empty<number>()
|
|
459
|
-
*
|
|
437
|
+
* Iterable.head(empty) // => Option.none()
|
|
460
438
|
*
|
|
461
439
|
* // Safe way to get first element
|
|
462
440
|
* const firstEven = Iterable.head(
|
|
463
441
|
* Iterable.filter([1, 3, 4, 5], (x) => x % 2 === 0)
|
|
464
442
|
* )
|
|
465
|
-
*
|
|
443
|
+
* firstEven // => Option.some(4)
|
|
466
444
|
*
|
|
467
445
|
* // Use with Option methods
|
|
468
446
|
* const doubled = Option.map(Iterable.head([5, 10, 15]), (x) => x * 2)
|
|
469
|
-
*
|
|
447
|
+
* doubled // => Option.some(10)
|
|
470
448
|
* ```
|
|
471
449
|
*
|
|
472
450
|
* @category getters
|
|
@@ -491,21 +469,21 @@ export const head = self => {
|
|
|
491
469
|
*
|
|
492
470
|
* **Example** (Getting the first element unsafely)
|
|
493
471
|
*
|
|
494
|
-
* ```ts
|
|
472
|
+
* ```ts import.meta.vitest
|
|
495
473
|
* import { Iterable } from "effect"
|
|
496
474
|
*
|
|
497
475
|
* const numbers = [1, 2, 3]
|
|
498
|
-
*
|
|
476
|
+
* Iterable.headUnsafe(numbers) // => 1
|
|
499
477
|
*
|
|
500
478
|
* const letters = "hello"
|
|
501
|
-
*
|
|
479
|
+
* Iterable.headUnsafe(letters) // => "h"
|
|
502
480
|
*
|
|
503
481
|
* // Iterable.headUnsafe(Iterable.empty<number>())
|
|
504
482
|
* // throws Error: "headUnsafe: empty iterable"
|
|
505
483
|
*
|
|
506
484
|
* // Use only when you're certain the iterable is non-empty
|
|
507
485
|
* const nonEmpty = Iterable.range(1, 10)
|
|
508
|
-
*
|
|
486
|
+
* Iterable.headUnsafe(nonEmpty) // => 1
|
|
509
487
|
* ```
|
|
510
488
|
*
|
|
511
489
|
* @category getters
|
|
@@ -526,25 +504,25 @@ export const headUnsafe = self => {
|
|
|
526
504
|
*
|
|
527
505
|
* **Example** (Taking from the start)
|
|
528
506
|
*
|
|
529
|
-
* ```ts
|
|
507
|
+
* ```ts import.meta.vitest
|
|
530
508
|
* import { Iterable } from "effect"
|
|
531
509
|
*
|
|
532
510
|
* const numbers = [1, 2, 3, 4, 5]
|
|
533
511
|
* const firstThree = Iterable.take(numbers, 3)
|
|
534
|
-
*
|
|
512
|
+
* Array.from(firstThree) // => [1, 2, 3]
|
|
535
513
|
*
|
|
536
514
|
* // Taking more than available returns all elements
|
|
537
515
|
* const firstTen = Iterable.take(numbers, 10)
|
|
538
|
-
*
|
|
516
|
+
* Array.from(firstTen) // => [1, 2, 3, 4, 5]
|
|
539
517
|
*
|
|
540
518
|
* // Taking 0 or negative returns empty
|
|
541
519
|
* const none = Iterable.take(numbers, 0)
|
|
542
|
-
*
|
|
520
|
+
* Array.from(none) // => []
|
|
543
521
|
*
|
|
544
522
|
* // Useful with infinite iterables
|
|
545
523
|
* const naturals = Iterable.range(1)
|
|
546
524
|
* const firstFive = Iterable.take(naturals, 5)
|
|
547
|
-
*
|
|
525
|
+
* Array.from(firstFive) // => [1, 2, 3, 4, 5]
|
|
548
526
|
* ```
|
|
549
527
|
*
|
|
550
528
|
* @category getters
|
|
@@ -574,22 +552,22 @@ export const take = /*#__PURE__*/dual(2, (self, n) => ({
|
|
|
574
552
|
*
|
|
575
553
|
* **Example** (Taking while a predicate holds)
|
|
576
554
|
*
|
|
577
|
-
* ```ts
|
|
555
|
+
* ```ts import.meta.vitest
|
|
578
556
|
* import { Iterable } from "effect"
|
|
579
557
|
*
|
|
580
558
|
* const numbers = [2, 4, 6, 8, 3, 10, 12]
|
|
581
559
|
* const evenPrefix = Iterable.takeWhile(numbers, (x) => x % 2 === 0)
|
|
582
|
-
*
|
|
560
|
+
* Array.from(evenPrefix) // => [2, 4, 6, 8]
|
|
583
561
|
*
|
|
584
562
|
* // With index
|
|
585
563
|
* const letters = ["a", "b", "c", "d", "e"]
|
|
586
564
|
* const firstThreeByIndex = Iterable.takeWhile(letters, (_, i) => i < 3)
|
|
587
|
-
*
|
|
565
|
+
* Array.from(firstThreeByIndex) // => ["a", "b", "c"]
|
|
588
566
|
*
|
|
589
567
|
* // Stops at first non-matching element
|
|
590
568
|
* const mixed = [1, 3, 5, 4, 7, 9]
|
|
591
569
|
* const oddPrefix = Iterable.takeWhile(mixed, (x) => x % 2 === 1)
|
|
592
|
-
*
|
|
570
|
+
* Array.from(oddPrefix) // => [1, 3, 5]
|
|
593
571
|
*
|
|
594
572
|
* // Type refinement
|
|
595
573
|
* const values: Array<string | number> = ["a", "b", "c", 1, "d"]
|
|
@@ -597,7 +575,7 @@ export const take = /*#__PURE__*/dual(2, (self, n) => ({
|
|
|
597
575
|
* values,
|
|
598
576
|
* (x): x is string => typeof x === "string"
|
|
599
577
|
* )
|
|
600
|
-
*
|
|
578
|
+
* Array.from(stringPrefix) // => ["a", "b", "c"]
|
|
601
579
|
* ```
|
|
602
580
|
*
|
|
603
581
|
* @category getters
|
|
@@ -630,24 +608,24 @@ export const takeWhile = /*#__PURE__*/dual(2, (self, predicate) => ({
|
|
|
630
608
|
*
|
|
631
609
|
* **Example** (Dropping from the start)
|
|
632
610
|
*
|
|
633
|
-
* ```ts
|
|
611
|
+
* ```ts import.meta.vitest
|
|
634
612
|
* import { Iterable } from "effect"
|
|
635
613
|
*
|
|
636
614
|
* const numbers = [1, 2, 3, 4, 5]
|
|
637
615
|
* const withoutFirstTwo = Iterable.drop(numbers, 2)
|
|
638
|
-
*
|
|
616
|
+
* Array.from(withoutFirstTwo) // => [3, 4, 5]
|
|
639
617
|
*
|
|
640
618
|
* // Dropping more than available returns empty
|
|
641
619
|
* const withoutFirstTen = Iterable.drop(numbers, 10)
|
|
642
|
-
*
|
|
620
|
+
* Array.from(withoutFirstTen) // => []
|
|
643
621
|
*
|
|
644
622
|
* // Dropping 0 or negative returns all elements
|
|
645
623
|
* const all = Iterable.drop(numbers, 0)
|
|
646
|
-
*
|
|
624
|
+
* Array.from(all) // => [1, 2, 3, 4, 5]
|
|
647
625
|
*
|
|
648
626
|
* // Combine with take for slicing
|
|
649
627
|
* const slice = Iterable.take(Iterable.drop(numbers, 1), 3)
|
|
650
|
-
*
|
|
628
|
+
* Array.from(slice) // => [2, 3, 4]
|
|
651
629
|
* ```
|
|
652
630
|
*
|
|
653
631
|
* @category getters
|
|
@@ -680,20 +658,20 @@ export const drop = /*#__PURE__*/dual(2, (self, n) => ({
|
|
|
680
658
|
*
|
|
681
659
|
* **Example** (Finding the first match)
|
|
682
660
|
*
|
|
683
|
-
* ```ts
|
|
661
|
+
* ```ts import.meta.vitest
|
|
684
662
|
* import { Iterable, Option } from "effect"
|
|
685
663
|
*
|
|
686
664
|
* const numbers = [1, 3, 4, 6, 8]
|
|
687
665
|
* const firstEven = Iterable.findFirst(numbers, (x) => x % 2 === 0)
|
|
688
|
-
*
|
|
666
|
+
* firstEven // => Option.some(4)
|
|
689
667
|
*
|
|
690
668
|
* const firstGreaterThan10 = Iterable.findFirst(numbers, (x) => x > 10)
|
|
691
|
-
*
|
|
669
|
+
* firstGreaterThan10 // => Option.none()
|
|
692
670
|
*
|
|
693
671
|
* // With index
|
|
694
672
|
* const letters = ["a", "b", "c", "d"]
|
|
695
673
|
* const atEvenIndex = Iterable.findFirst(letters, (_, i) => i % 2 === 0)
|
|
696
|
-
*
|
|
674
|
+
* atEvenIndex // => Option.some("a")
|
|
697
675
|
*
|
|
698
676
|
* // Type refinement
|
|
699
677
|
* const mixed: Array<string | number> = [1, "hello", 2, "world"]
|
|
@@ -701,17 +679,17 @@ export const drop = /*#__PURE__*/dual(2, (self, n) => ({
|
|
|
701
679
|
* mixed,
|
|
702
680
|
* (x): x is string => typeof x === "string"
|
|
703
681
|
* )
|
|
704
|
-
*
|
|
682
|
+
* firstString // => Option.some("hello")
|
|
705
683
|
*
|
|
706
684
|
* // Transform during search
|
|
707
685
|
* const findSquareRoot = Iterable.findFirst([1, 4, 9, 16], (x) => {
|
|
708
686
|
* const sqrt = Math.sqrt(x)
|
|
709
687
|
* return Number.isInteger(sqrt) ? Option.some(sqrt) : Option.none()
|
|
710
688
|
* })
|
|
711
|
-
*
|
|
689
|
+
* findSquareRoot // => Option.some(1)
|
|
712
690
|
* ```
|
|
713
691
|
*
|
|
714
|
-
* @category
|
|
692
|
+
* @category searching
|
|
715
693
|
* @since 2.0.0
|
|
716
694
|
*/
|
|
717
695
|
export const findFirst = /*#__PURE__*/dual(2, (self, f) => {
|
|
@@ -736,20 +714,20 @@ export const findFirst = /*#__PURE__*/dual(2, (self, f) => {
|
|
|
736
714
|
*
|
|
737
715
|
* **Example** (Finding the last match)
|
|
738
716
|
*
|
|
739
|
-
* ```ts
|
|
740
|
-
* import { Iterable } from "effect"
|
|
717
|
+
* ```ts import.meta.vitest
|
|
718
|
+
* import { Iterable, Option } from "effect"
|
|
741
719
|
*
|
|
742
720
|
* const numbers = [1, 3, 4, 6, 8, 2]
|
|
743
721
|
* const lastEven = Iterable.findLast(numbers, (x) => x % 2 === 0)
|
|
744
|
-
*
|
|
722
|
+
* lastEven // => Option.some(2)
|
|
745
723
|
*
|
|
746
724
|
* const lastGreaterThan10 = Iterable.findLast(numbers, (x) => x > 10)
|
|
747
|
-
*
|
|
725
|
+
* lastGreaterThan10 // => Option.none()
|
|
748
726
|
*
|
|
749
727
|
* // With index
|
|
750
728
|
* const letters = ["a", "b", "c", "d", "e"]
|
|
751
729
|
* const lastAtEvenIndex = Iterable.findLast(letters, (_, i) => i % 2 === 0)
|
|
752
|
-
*
|
|
730
|
+
* lastAtEvenIndex // => Option.some("e")
|
|
753
731
|
*
|
|
754
732
|
* // Type refinement
|
|
755
733
|
* const mixed: Array<string | number> = [1, "hello", 2, "world", 3]
|
|
@@ -757,10 +735,10 @@ export const findFirst = /*#__PURE__*/dual(2, (self, f) => {
|
|
|
757
735
|
* mixed,
|
|
758
736
|
* (x): x is string => typeof x === "string"
|
|
759
737
|
* )
|
|
760
|
-
*
|
|
738
|
+
* lastString // => Option.some("world")
|
|
761
739
|
* ```
|
|
762
740
|
*
|
|
763
|
-
* @category
|
|
741
|
+
* @category searching
|
|
764
742
|
* @since 2.0.0
|
|
765
743
|
*/
|
|
766
744
|
export const findLast = /*#__PURE__*/dual(2, (self, f) => {
|
|
@@ -786,31 +764,31 @@ export const findLast = /*#__PURE__*/dual(2, (self, f) => {
|
|
|
786
764
|
*
|
|
787
765
|
* **Example** (Zipping iterables)
|
|
788
766
|
*
|
|
789
|
-
* ```ts
|
|
767
|
+
* ```ts import.meta.vitest
|
|
790
768
|
* import { Iterable } from "effect"
|
|
791
769
|
*
|
|
792
770
|
* const numbers = [1, 2, 3]
|
|
793
771
|
* const letters = ["a", "b", "c"]
|
|
794
772
|
* const zipped = Iterable.zip(numbers, letters)
|
|
795
|
-
*
|
|
773
|
+
* Array.from(zipped) // => [[1, "a"], [2, "b"], [3, "c"]]
|
|
796
774
|
*
|
|
797
775
|
* // Different lengths - shorter one determines result length
|
|
798
776
|
* const short = [1, 2]
|
|
799
777
|
* const long = ["a", "b", "c", "d"]
|
|
800
778
|
* const partial = Iterable.zip(short, long)
|
|
801
|
-
*
|
|
779
|
+
* Array.from(partial) // => [[1, "a"], [2, "b"]]
|
|
802
780
|
*
|
|
803
781
|
* // Works with any iterables
|
|
804
782
|
* const range = Iterable.range(1, 3)
|
|
805
783
|
* const word = "abc"
|
|
806
784
|
* const mixed = Iterable.zip(range, word)
|
|
807
|
-
*
|
|
785
|
+
* Array.from(mixed) // => [[1, "a"], [2, "b"], [3, "c"]]
|
|
808
786
|
*
|
|
809
787
|
* // Create indexed pairs
|
|
810
788
|
* const values = ["apple", "banana", "cherry"]
|
|
811
789
|
* const indices = Iterable.range(0, 2)
|
|
812
790
|
* const indexed = Iterable.zip(indices, values)
|
|
813
|
-
*
|
|
791
|
+
* Array.from(indexed) // => [[0, "apple"], [1, "banana"], [2, "cherry"]]
|
|
814
792
|
* ```
|
|
815
793
|
*
|
|
816
794
|
* @category zipping
|
|
@@ -823,14 +801,14 @@ export const zip = /*#__PURE__*/dual(2, (self, that) => zipWith(self, that, Tupl
|
|
|
823
801
|
*
|
|
824
802
|
* **Example** (Zipping with a combining function)
|
|
825
803
|
*
|
|
826
|
-
* ```ts
|
|
804
|
+
* ```ts import.meta.vitest
|
|
827
805
|
* import { Iterable } from "effect"
|
|
828
806
|
*
|
|
829
807
|
* // Add corresponding elements
|
|
830
808
|
* const a = [1, 2, 3, 4]
|
|
831
809
|
* const b = [10, 20, 30, 40]
|
|
832
810
|
* const sums = Iterable.zipWith(a, b, (x, y) => x + y)
|
|
833
|
-
*
|
|
811
|
+
* Array.from(sums) // => [11, 22, 33, 44]
|
|
834
812
|
*
|
|
835
813
|
* // Combine strings
|
|
836
814
|
* const firstNames = ["John", "Jane", "Bob"]
|
|
@@ -840,7 +818,7 @@ export const zip = /*#__PURE__*/dual(2, (self, that) => zipWith(self, that, Tupl
|
|
|
840
818
|
* lastNames,
|
|
841
819
|
* (first, last) => `${first} ${last}`
|
|
842
820
|
* )
|
|
843
|
-
*
|
|
821
|
+
* Array.from(fullNames) // => ["John Doe", "Jane Smith", "Bob Johnson"]
|
|
844
822
|
*
|
|
845
823
|
* // Different lengths - stops at shorter
|
|
846
824
|
* const short = [1, 2]
|
|
@@ -850,7 +828,7 @@ export const zip = /*#__PURE__*/dual(2, (self, that) => zipWith(self, that, Tupl
|
|
|
850
828
|
* long,
|
|
851
829
|
* (num, letter) => `${num}${letter}`
|
|
852
830
|
* )
|
|
853
|
-
*
|
|
831
|
+
* Array.from(combined) // => ["1a", "2b"]
|
|
854
832
|
*
|
|
855
833
|
* // Complex transformations
|
|
856
834
|
* const prices = [10.99, 25.50, 5.00]
|
|
@@ -858,7 +836,7 @@ export const zip = /*#__PURE__*/dual(2, (self, that) => zipWith(self, that, Tupl
|
|
|
858
836
|
* const totals = Iterable.zipWith(prices, quantities, (price, qty) => {
|
|
859
837
|
* return Math.round(price * qty * 100) / 100 // round to 2 decimal places
|
|
860
838
|
* })
|
|
861
|
-
*
|
|
839
|
+
* Array.from(totals) // => [21.98, 25.5, 15]
|
|
862
840
|
* ```
|
|
863
841
|
*
|
|
864
842
|
* @category zipping
|
|
@@ -899,33 +877,33 @@ export const zipWith = /*#__PURE__*/dual(3, (self, that, f) => ({
|
|
|
899
877
|
*
|
|
900
878
|
* **Example** (Interspersing separators)
|
|
901
879
|
*
|
|
902
|
-
* ```ts
|
|
880
|
+
* ```ts import.meta.vitest
|
|
903
881
|
* import { Iterable } from "effect"
|
|
904
882
|
*
|
|
905
883
|
* // Join numbers with separator
|
|
906
884
|
* const numbers = [1, 2, 3, 4]
|
|
907
885
|
* const withCommas = Iterable.intersperse(numbers, ",")
|
|
908
|
-
*
|
|
886
|
+
* Array.from(withCommas) // => [1, ",", 2, ",", 3, ",", 4]
|
|
909
887
|
*
|
|
910
888
|
* // Join words with spaces
|
|
911
889
|
* const words = ["hello", "world", "from", "effect"]
|
|
912
890
|
* const sentence = Iterable.intersperse(words, " ")
|
|
913
|
-
*
|
|
891
|
+
* Array.from(sentence).join("") // => "hello world from effect"
|
|
914
892
|
*
|
|
915
893
|
* // Empty iterable remains empty
|
|
916
894
|
* const empty = Iterable.empty<string>()
|
|
917
895
|
* const stillEmpty = Iterable.intersperse(empty, "-")
|
|
918
|
-
*
|
|
896
|
+
* Array.from(stillEmpty) // => []
|
|
919
897
|
*
|
|
920
898
|
* // Single element has no separators added
|
|
921
899
|
* const single = [42]
|
|
922
900
|
* const noSeparator = Iterable.intersperse(single, "|")
|
|
923
|
-
*
|
|
901
|
+
* Array.from(noSeparator) // => [42]
|
|
924
902
|
*
|
|
925
903
|
* // Build CSS-like strings
|
|
926
904
|
* const styles = ["color: red", "font-size: 14px", "margin: 10px"]
|
|
927
905
|
* const css = Iterable.intersperse(styles, "; ")
|
|
928
|
-
*
|
|
906
|
+
* Array.from(css).join("") // => "color: red; font-size: 14px; margin: 10px"
|
|
929
907
|
* ```
|
|
930
908
|
*
|
|
931
909
|
* @category combining
|
|
@@ -960,7 +938,7 @@ export const intersperse = /*#__PURE__*/dual(2, (self, middle) => ({
|
|
|
960
938
|
*
|
|
961
939
|
* **Example** (Checking membership with custom equivalence)
|
|
962
940
|
*
|
|
963
|
-
* ```ts
|
|
941
|
+
* ```ts import.meta.vitest
|
|
964
942
|
* import { Iterable } from "effect"
|
|
965
943
|
*
|
|
966
944
|
* // Custom equivalence for objects
|
|
@@ -969,7 +947,7 @@ export const intersperse = /*#__PURE__*/dual(2, (self, middle) => ({
|
|
|
969
947
|
*
|
|
970
948
|
* const users = [{ id: 1 }, { id: 2 }]
|
|
971
949
|
* const hasUser1 = containsById(users, { id: 1 })
|
|
972
|
-
*
|
|
950
|
+
* hasUser1 // => true
|
|
973
951
|
*
|
|
974
952
|
* // Case-insensitive string comparison
|
|
975
953
|
* const caseInsensitive = (a: string, b: string) =>
|
|
@@ -978,7 +956,7 @@ export const intersperse = /*#__PURE__*/dual(2, (self, middle) => ({
|
|
|
978
956
|
*
|
|
979
957
|
* const words = ["Hello", "World"]
|
|
980
958
|
* const hasHello = containsCaseInsensitive(words, "hello")
|
|
981
|
-
*
|
|
959
|
+
* hasHello // => true
|
|
982
960
|
*
|
|
983
961
|
* // Approximate number comparison
|
|
984
962
|
* const approxEqual = (a: number, b: number) => Math.abs(a - b) < 0.1
|
|
@@ -986,10 +964,10 @@ export const intersperse = /*#__PURE__*/dual(2, (self, middle) => ({
|
|
|
986
964
|
*
|
|
987
965
|
* const values = [1.0, 2.0, 3.0]
|
|
988
966
|
* const hasAlmostTwo = containsApprox(values, 2.05)
|
|
989
|
-
*
|
|
967
|
+
* hasAlmostTwo // => true
|
|
990
968
|
* ```
|
|
991
969
|
*
|
|
992
|
-
* @category
|
|
970
|
+
* @category predicates
|
|
993
971
|
* @since 2.0.0
|
|
994
972
|
*/
|
|
995
973
|
export const containsWith = isEquivalent => dual(2, (self, a) => {
|
|
@@ -1011,29 +989,29 @@ export const containsWith = isEquivalent => dual(2, (self, a) => {
|
|
|
1011
989
|
*
|
|
1012
990
|
* **Example** (Checking membership)
|
|
1013
991
|
*
|
|
1014
|
-
* ```ts
|
|
992
|
+
* ```ts import.meta.vitest
|
|
1015
993
|
* import { Iterable } from "effect"
|
|
1016
994
|
*
|
|
1017
995
|
* const numbers = [1, 2, 3, 4, 5]
|
|
1018
|
-
*
|
|
1019
|
-
*
|
|
996
|
+
* Iterable.contains(numbers, 3) // => true
|
|
997
|
+
* Iterable.contains(numbers, 6) // => false
|
|
1020
998
|
*
|
|
1021
999
|
* const letters = "hello"
|
|
1022
|
-
*
|
|
1023
|
-
*
|
|
1000
|
+
* Iterable.contains(letters, "l") // => true
|
|
1001
|
+
* Iterable.contains(letters, "x") // => false
|
|
1024
1002
|
*
|
|
1025
1003
|
* // Works with any iterable
|
|
1026
1004
|
* const range = Iterable.range(1, 100)
|
|
1027
|
-
*
|
|
1028
|
-
*
|
|
1005
|
+
* Iterable.contains(range, 50) // => true
|
|
1006
|
+
* Iterable.contains(range, 150) // => false
|
|
1029
1007
|
*
|
|
1030
1008
|
* // Curried version
|
|
1031
1009
|
* const containsThree = Iterable.contains(3)
|
|
1032
|
-
*
|
|
1033
|
-
*
|
|
1010
|
+
* containsThree([1, 2, 3]) // => true
|
|
1011
|
+
* containsThree([4, 5, 6]) // => false
|
|
1034
1012
|
* ```
|
|
1035
1013
|
*
|
|
1036
|
-
* @category
|
|
1014
|
+
* @category predicates
|
|
1037
1015
|
* @since 2.0.0
|
|
1038
1016
|
*/
|
|
1039
1017
|
export const contains = /*#__PURE__*/containsWith(/*#__PURE__*/Equal.asEquivalence());
|
|
@@ -1043,25 +1021,22 @@ export const contains = /*#__PURE__*/containsWith(/*#__PURE__*/Equal.asEquivalen
|
|
|
1043
1021
|
*
|
|
1044
1022
|
* **Example** (Chunking an iterable)
|
|
1045
1023
|
*
|
|
1046
|
-
* ```ts
|
|
1024
|
+
* ```ts import.meta.vitest
|
|
1047
1025
|
* import { Iterable } from "effect"
|
|
1048
1026
|
*
|
|
1049
1027
|
* const numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9]
|
|
1050
1028
|
* const chunks = Iterable.chunksOf(numbers, 3)
|
|
1051
|
-
*
|
|
1052
|
-
* // [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
|
|
1029
|
+
* Array.from(chunks) // => [[1, 2, 3], [4, 5, 6], [7, 8, 9]]
|
|
1053
1030
|
*
|
|
1054
1031
|
* // Last chunk can be shorter
|
|
1055
1032
|
* const uneven = [1, 2, 3, 4, 5, 6, 7]
|
|
1056
1033
|
* const chunks2 = Iterable.chunksOf(uneven, 3)
|
|
1057
|
-
*
|
|
1058
|
-
* // [[1, 2, 3], [4, 5, 6], [7]]
|
|
1034
|
+
* Array.from(chunks2) // => [[1, 2, 3], [4, 5, 6], [7]]
|
|
1059
1035
|
*
|
|
1060
1036
|
* // Chunk size larger than iterable
|
|
1061
1037
|
* const small = [1, 2]
|
|
1062
1038
|
* const chunks3 = Iterable.chunksOf(small, 5)
|
|
1063
|
-
*
|
|
1064
|
-
* // [[1, 2]]
|
|
1039
|
+
* Array.from(chunks3) // => [[1, 2]]
|
|
1065
1040
|
*
|
|
1066
1041
|
* // Process data in batches
|
|
1067
1042
|
* const data = Iterable.range(1, 100)
|
|
@@ -1070,7 +1045,7 @@ export const contains = /*#__PURE__*/containsWith(/*#__PURE__*/Equal.asEquivalen
|
|
|
1070
1045
|
* batches,
|
|
1071
1046
|
* (batch) => Iterable.reduce(batch, 0, (sum, n) => sum + n)
|
|
1072
1047
|
* )
|
|
1073
|
-
*
|
|
1048
|
+
* Array.from(Iterable.take(batchSums, 3)) // => [55, 155, 255]
|
|
1074
1049
|
* ```
|
|
1075
1050
|
*
|
|
1076
1051
|
* @category splitting
|
|
@@ -1118,35 +1093,31 @@ export const chunksOf = /*#__PURE__*/dual(2, (self, n) => {
|
|
|
1118
1093
|
*
|
|
1119
1094
|
* **Example** (Grouping consecutive elements with custom equivalence)
|
|
1120
1095
|
*
|
|
1121
|
-
* ```ts
|
|
1096
|
+
* ```ts import.meta.vitest
|
|
1122
1097
|
* import { Iterable } from "effect"
|
|
1123
1098
|
*
|
|
1124
1099
|
* // Group consecutive equal numbers
|
|
1125
1100
|
* const numbers = [1, 1, 2, 2, 2, 3, 1, 1]
|
|
1126
1101
|
* const grouped = Iterable.groupWith(numbers, (a, b) => a === b)
|
|
1127
|
-
*
|
|
1128
|
-
* // [[1, 1], [2, 2, 2], [3], [1, 1]]
|
|
1102
|
+
* Array.from(grouped) // => [[1, 1], [2, 2, 2], [3], [1, 1]]
|
|
1129
1103
|
*
|
|
1130
1104
|
* // Case-insensitive grouping of strings
|
|
1131
1105
|
* const words = ["Apple", "APPLE", "banana", "Banana", "cherry"]
|
|
1132
1106
|
* const caseInsensitive = (a: string, b: string) =>
|
|
1133
1107
|
* a.toLowerCase() === b.toLowerCase()
|
|
1134
1108
|
* const groupedWords = Iterable.groupWith(words, caseInsensitive)
|
|
1135
|
-
*
|
|
1136
|
-
* // [["Apple", "APPLE"], ["banana", "Banana"], ["cherry"]]
|
|
1109
|
+
* Array.from(groupedWords) // => [["Apple", "APPLE"], ["banana", "Banana"], ["cherry"]]
|
|
1137
1110
|
*
|
|
1138
1111
|
* // Group by approximate equality
|
|
1139
1112
|
* const floats = [1.1, 1.12, 1.9, 2.01, 2.05, 3.5]
|
|
1140
1113
|
* const approxEqual = (a: number, b: number) => Math.abs(a - b) < 0.2
|
|
1141
1114
|
* const groupedFloats = Iterable.groupWith(floats, approxEqual)
|
|
1142
|
-
*
|
|
1143
|
-
* // [[1.1, 1.12], [1.9, 2.01, 2.05], [3.5]]
|
|
1115
|
+
* Array.from(groupedFloats) // => [[1.1, 1.12], [1.9, 2.01, 2.05], [3.5]]
|
|
1144
1116
|
*
|
|
1145
1117
|
* // Only groups consecutive elements
|
|
1146
1118
|
* const scattered = [1, 2, 1, 2, 1]
|
|
1147
1119
|
* const scatteredGroups = Iterable.groupWith(scattered, (a, b) => a === b)
|
|
1148
|
-
*
|
|
1149
|
-
* // [[1], [2], [1], [2], [1]] (no grouping since none are consecutive)
|
|
1120
|
+
* Array.from(scatteredGroups) // => [[1], [2], [1], [2], [1]]
|
|
1150
1121
|
* ```
|
|
1151
1122
|
*
|
|
1152
1123
|
* @category grouping
|
|
@@ -1198,18 +1169,16 @@ export const groupWith = /*#__PURE__*/dual(2, (self, isEquivalent) => ({
|
|
|
1198
1169
|
*
|
|
1199
1170
|
* **Example** (Grouping consecutive elements)
|
|
1200
1171
|
*
|
|
1201
|
-
* ```ts
|
|
1172
|
+
* ```ts import.meta.vitest
|
|
1202
1173
|
* import { Iterable } from "effect"
|
|
1203
1174
|
*
|
|
1204
1175
|
* const numbers = [1, 1, 2, 2, 2, 3, 1, 1]
|
|
1205
1176
|
* const grouped = Iterable.group(numbers)
|
|
1206
|
-
*
|
|
1207
|
-
* // [[1, 1], [2, 2, 2], [3], [1, 1]]
|
|
1177
|
+
* Array.from(grouped) // => [[1, 1], [2, 2, 2], [3], [1, 1]]
|
|
1208
1178
|
*
|
|
1209
1179
|
* const letters = "aabbccaa"
|
|
1210
1180
|
* const groupedLetters = Iterable.group(letters)
|
|
1211
|
-
*
|
|
1212
|
-
* // [["a", "a"], ["b", "b"], ["c", "c"], ["a", "a"]]
|
|
1181
|
+
* Array.from(groupedLetters) // => [["a", "a"], ["b", "b"], ["c", "c"], ["a", "a"]]
|
|
1213
1182
|
*
|
|
1214
1183
|
* // Works with objects using deep equality
|
|
1215
1184
|
* const objects = [
|
|
@@ -1219,7 +1188,7 @@ export const groupWith = /*#__PURE__*/dual(2, (self, isEquivalent) => ({
|
|
|
1219
1188
|
* { type: "A", value: 1 }
|
|
1220
1189
|
* ]
|
|
1221
1190
|
* const groupedObjects = Iterable.group(objects)
|
|
1222
|
-
*
|
|
1191
|
+
* Array.from(groupedObjects).length // => 3
|
|
1223
1192
|
* // Note: Only consecutive equal objects are grouped together
|
|
1224
1193
|
* ```
|
|
1225
1194
|
*
|
|
@@ -1238,20 +1207,18 @@ export const group = /*#__PURE__*/groupWith(/*#__PURE__*/Equal.asEquivalence());
|
|
|
1238
1207
|
*
|
|
1239
1208
|
* **Example** (Grouping by a key)
|
|
1240
1209
|
*
|
|
1241
|
-
* ```ts
|
|
1210
|
+
* ```ts import.meta.vitest
|
|
1242
1211
|
* import { Iterable } from "effect"
|
|
1243
1212
|
*
|
|
1244
1213
|
* // Group by string length
|
|
1245
1214
|
* const words = ["a", "bb", "ccc", "dd", "eee", "f"]
|
|
1246
1215
|
* const byLength = Iterable.groupBy(words, (word) => word.length.toString())
|
|
1247
|
-
*
|
|
1248
|
-
* // { "1": ["a", "f"], "2": ["bb", "dd"], "3": ["ccc", "eee"] }
|
|
1216
|
+
* byLength // => { "1": ["a", "f"], "2": ["bb", "dd"], "3": ["ccc", "eee"] }
|
|
1249
1217
|
*
|
|
1250
1218
|
* // Group by first letter
|
|
1251
1219
|
* const names = ["Alice", "Bob", "Charlie", "David", "Anna", "Betty"]
|
|
1252
1220
|
* const byFirstLetter = Iterable.groupBy(names, (name) => name[0])
|
|
1253
|
-
*
|
|
1254
|
-
* // { "A": ["Alice", "Anna"], "B": ["Bob", "Betty"], "C": ["Charlie"], "D": ["David"] }
|
|
1221
|
+
* byFirstLetter // => { A: ["Alice", "Anna"], B: ["Bob", "Betty"], C: ["Charlie"], D: ["David"] }
|
|
1255
1222
|
*
|
|
1256
1223
|
* // Group by category
|
|
1257
1224
|
* const items = [
|
|
@@ -1261,17 +1228,12 @@ export const group = /*#__PURE__*/groupWith(/*#__PURE__*/Equal.asEquivalence());
|
|
|
1261
1228
|
* { name: "broccoli", category: "vegetable" }
|
|
1262
1229
|
* ]
|
|
1263
1230
|
* const byCategory = Iterable.groupBy(items, (item) => item.category)
|
|
1264
|
-
*
|
|
1265
|
-
* // {
|
|
1266
|
-
* // "fruit": [{ name: "apple", category: "fruit" }, { name: "banana", category: "fruit" }],
|
|
1267
|
-
* // "vegetable": [{ name: "carrot", category: "vegetable" }, { name: "broccoli", category: "vegetable" }]
|
|
1268
|
-
* // }
|
|
1231
|
+
* Object.keys(byCategory) // => ["fruit", "vegetable"]
|
|
1269
1232
|
*
|
|
1270
1233
|
* // Group numbers by even/odd
|
|
1271
1234
|
* const numbers = [1, 2, 3, 4, 5, 6]
|
|
1272
1235
|
* const evenOdd = Iterable.groupBy(numbers, (n) => n % 2 === 0 ? "even" : "odd")
|
|
1273
|
-
*
|
|
1274
|
-
* // { "odd": [1, 3, 5], "even": [2, 4, 6] }
|
|
1236
|
+
* evenOdd // => { odd: [1, 3, 5], even: [2, 4, 6] }
|
|
1275
1237
|
* ```
|
|
1276
1238
|
*
|
|
1277
1239
|
* @category grouping
|
|
@@ -1284,7 +1246,7 @@ export const groupBy = /*#__PURE__*/dual(2, (self, f) => {
|
|
|
1284
1246
|
if (Object.hasOwn(out, k)) {
|
|
1285
1247
|
out[k].push(a);
|
|
1286
1248
|
} else {
|
|
1287
|
-
out
|
|
1249
|
+
InternalRecord.assignProperty(out, k, [a]);
|
|
1288
1250
|
}
|
|
1289
1251
|
}
|
|
1290
1252
|
return out;
|
|
@@ -1312,18 +1274,10 @@ const constEmptyIterator = {
|
|
|
1312
1274
|
*
|
|
1313
1275
|
* **Example** (Creating an empty iterable)
|
|
1314
1276
|
*
|
|
1315
|
-
* ```ts
|
|
1277
|
+
* ```ts import.meta.vitest
|
|
1316
1278
|
* import { Iterable } from "effect"
|
|
1317
1279
|
*
|
|
1318
|
-
*
|
|
1319
|
-
* console.log(Array.from(empty)) // []
|
|
1320
|
-
* console.log(Iterable.isEmpty(empty)) // true
|
|
1321
|
-
*
|
|
1322
|
-
* // Useful as base case for reductions
|
|
1323
|
-
* const hasData = true
|
|
1324
|
-
* const result = hasData
|
|
1325
|
-
* ? Iterable.range(1, 5)
|
|
1326
|
-
* : Iterable.empty<number>()
|
|
1280
|
+
* Array.from(Iterable.empty<string>()) // => []
|
|
1327
1281
|
* ```
|
|
1328
1282
|
*
|
|
1329
1283
|
* @category constructors
|
|
@@ -1340,11 +1294,11 @@ export const empty = () => constEmpty;
|
|
|
1340
1294
|
*
|
|
1341
1295
|
* **Example** (Wrapping a single value)
|
|
1342
1296
|
*
|
|
1343
|
-
* ```ts
|
|
1297
|
+
* ```ts import.meta.vitest
|
|
1344
1298
|
* import { Iterable } from "effect"
|
|
1345
1299
|
*
|
|
1346
1300
|
* const single = Iterable.of(42)
|
|
1347
|
-
*
|
|
1301
|
+
* Array.from(single) // => [42]
|
|
1348
1302
|
*
|
|
1349
1303
|
* // Useful for creating homogeneous sequences
|
|
1350
1304
|
* const sequences = [
|
|
@@ -1359,7 +1313,7 @@ export const empty = () => constEmpty;
|
|
|
1359
1313
|
* numbers,
|
|
1360
1314
|
* (n) => n % 2 === 0 ? Iterable.of(n) : Iterable.empty()
|
|
1361
1315
|
* )
|
|
1362
|
-
*
|
|
1316
|
+
* Array.from(evensOnly) // => [2, 4]
|
|
1363
1317
|
* ```
|
|
1364
1318
|
*
|
|
1365
1319
|
* @category constructors
|
|
@@ -1378,24 +1332,22 @@ export const of = a => [a];
|
|
|
1378
1332
|
*
|
|
1379
1333
|
* **Example** (Mapping elements)
|
|
1380
1334
|
*
|
|
1381
|
-
* ```ts
|
|
1335
|
+
* ```ts import.meta.vitest
|
|
1382
1336
|
* import { Iterable } from "effect"
|
|
1383
1337
|
*
|
|
1384
1338
|
* // Transform numbers to their squares
|
|
1385
1339
|
* const numbers = [1, 2, 3, 4, 5]
|
|
1386
1340
|
* const squares = Iterable.map(numbers, (x) => x * x)
|
|
1387
|
-
*
|
|
1341
|
+
* Array.from(squares) // => [1, 4, 9, 16, 25]
|
|
1388
1342
|
*
|
|
1389
1343
|
* // Use index in transformation
|
|
1390
1344
|
* const indexed = Iterable.map(["a", "b", "c"], (char, i) => `${i}: ${char}`)
|
|
1391
|
-
*
|
|
1345
|
+
* Array.from(indexed) // => ["0: a", "1: b", "2: c"]
|
|
1392
1346
|
*
|
|
1393
|
-
*
|
|
1394
|
-
* const result = Iterable.map(
|
|
1347
|
+
* Array.from(Iterable.map(
|
|
1395
1348
|
* Iterable.map([1, 2, 3], (x) => x * 2),
|
|
1396
1349
|
* (x) => x + 1
|
|
1397
|
-
* )
|
|
1398
|
-
* console.log(Array.from(result)) // [3, 5, 7]
|
|
1350
|
+
* )) // => [3, 5, 7]
|
|
1399
1351
|
* ```
|
|
1400
1352
|
*
|
|
1401
1353
|
* @category mapping
|
|
@@ -1427,18 +1379,18 @@ export const map = /*#__PURE__*/dual(2, (self, f) => ({
|
|
|
1427
1379
|
*
|
|
1428
1380
|
* **Example** (Flat mapping iterables)
|
|
1429
1381
|
*
|
|
1430
|
-
* ```ts
|
|
1382
|
+
* ```ts import.meta.vitest
|
|
1431
1383
|
* import { Iterable } from "effect"
|
|
1432
1384
|
*
|
|
1433
1385
|
* // Expand each number to a range
|
|
1434
1386
|
* const numbers = [1, 2, 3]
|
|
1435
1387
|
* const expanded = Iterable.flatMap(numbers, (n) => Iterable.range(1, n))
|
|
1436
|
-
*
|
|
1388
|
+
* Array.from(expanded) // => [1, 1, 2, 1, 2, 3]
|
|
1437
1389
|
*
|
|
1438
1390
|
* // Split strings into characters
|
|
1439
1391
|
* const words = ["hi", "bye"]
|
|
1440
1392
|
* const chars = Iterable.flatMap(words, (word) => word)
|
|
1441
|
-
*
|
|
1393
|
+
* Array.from(chars) // => ["h", "i", "b", "y", "e"]
|
|
1442
1394
|
*
|
|
1443
1395
|
* // Conditional expansion with empty iterables
|
|
1444
1396
|
* const values = [1, 2, 3, 4, 5]
|
|
@@ -1446,7 +1398,7 @@ export const map = /*#__PURE__*/dual(2, (self, f) => ({
|
|
|
1446
1398
|
* values,
|
|
1447
1399
|
* (n) => n % 2 === 0 ? [n, n * 2, n * 3] : []
|
|
1448
1400
|
* )
|
|
1449
|
-
*
|
|
1401
|
+
* Array.from(evenMultiples) // => [2, 4, 6, 4, 8, 12]
|
|
1450
1402
|
*
|
|
1451
1403
|
* // Use index in transformation
|
|
1452
1404
|
* const letters = ["a", "b", "c"]
|
|
@@ -1454,7 +1406,7 @@ export const map = /*#__PURE__*/dual(2, (self, f) => ({
|
|
|
1454
1406
|
* letters,
|
|
1455
1407
|
* (letter, i) => Iterable.replicate(letter, i + 1)
|
|
1456
1408
|
* )
|
|
1457
|
-
*
|
|
1409
|
+
* Array.from(indexed) // => ["a", "b", "b", "c", "c", "c"]
|
|
1458
1410
|
* ```
|
|
1459
1411
|
*
|
|
1460
1412
|
* @category sequencing
|
|
@@ -1466,29 +1418,29 @@ export const flatMap = /*#__PURE__*/dual(2, (self, f) => flatten(map(self, f)));
|
|
|
1466
1418
|
*
|
|
1467
1419
|
* **Example** (Flattening nested iterables)
|
|
1468
1420
|
*
|
|
1469
|
-
* ```ts
|
|
1421
|
+
* ```ts import.meta.vitest
|
|
1470
1422
|
* import { Iterable } from "effect"
|
|
1471
1423
|
*
|
|
1472
1424
|
* // Flatten nested arrays
|
|
1473
1425
|
* const nested = [[1, 2], [3, 4], [5, 6]]
|
|
1474
1426
|
* const flat = Iterable.flatten(nested)
|
|
1475
|
-
*
|
|
1427
|
+
* Array.from(flat) // => [1, 2, 3, 4, 5, 6]
|
|
1476
1428
|
*
|
|
1477
1429
|
* // Flatten different iterable types
|
|
1478
1430
|
* const mixed: Array<Iterable<string>> = ["ab", "cd"]
|
|
1479
1431
|
* const flatMixed = Iterable.flatten(mixed)
|
|
1480
|
-
*
|
|
1432
|
+
* Array.from(flatMixed) // => ["a", "b", "c", "d"]
|
|
1481
1433
|
*
|
|
1482
1434
|
* // Flatten deeply nested (only one level)
|
|
1483
1435
|
* const deepNested = [[[1, 2]], [[3, 4]]]
|
|
1484
1436
|
* const oneLevelFlat = Iterable.flatten(deepNested)
|
|
1485
|
-
*
|
|
1437
|
+
* Array.from(oneLevelFlat) // => [[1, 2], [3, 4]]
|
|
1486
1438
|
* // [[1, 2], [3, 4]] (still contains arrays)
|
|
1487
1439
|
*
|
|
1488
1440
|
* // Empty iterables are handled correctly
|
|
1489
1441
|
* const withEmpty = [[1, 2], [], [3, 4], []]
|
|
1490
1442
|
* const flatWithEmpty = Iterable.flatten(withEmpty)
|
|
1491
|
-
*
|
|
1443
|
+
* Array.from(flatWithEmpty) // => [1, 2, 3, 4]
|
|
1492
1444
|
* ```
|
|
1493
1445
|
*
|
|
1494
1446
|
* @category sequencing
|
|
@@ -1529,7 +1481,7 @@ export const flatten = self => ({
|
|
|
1529
1481
|
*
|
|
1530
1482
|
* **Example** (Filtering and transforming Result values)
|
|
1531
1483
|
*
|
|
1532
|
-
* ```ts
|
|
1484
|
+
* ```ts import.meta.vitest
|
|
1533
1485
|
* import { Iterable, Result } from "effect"
|
|
1534
1486
|
*
|
|
1535
1487
|
* // Parse strings to numbers, keeping only valid ones
|
|
@@ -1538,7 +1490,7 @@ export const flatten = self => ({
|
|
|
1538
1490
|
* const num = parseInt(s)
|
|
1539
1491
|
* return isNaN(num) ? Result.failVoid : Result.succeed(num)
|
|
1540
1492
|
* })
|
|
1541
|
-
*
|
|
1493
|
+
* Array.from(numbers) // => [1, 2, 4]
|
|
1542
1494
|
*
|
|
1543
1495
|
* // Extract specific properties from objects
|
|
1544
1496
|
* const users = [
|
|
@@ -1552,7 +1504,7 @@ export const flatten = self => ({
|
|
|
1552
1504
|
* (user) =>
|
|
1553
1505
|
* user.age >= 18 && user.email ? Result.succeed(user.email) : Result.failVoid
|
|
1554
1506
|
* )
|
|
1555
|
-
*
|
|
1507
|
+
* Array.from(adultEmails) // => ["alice@example.com", "charlie@example.com"]
|
|
1556
1508
|
*
|
|
1557
1509
|
* // Use index in transformation
|
|
1558
1510
|
* const items = ["a", "b", "c", "d", "e"]
|
|
@@ -1560,7 +1512,7 @@ export const flatten = self => ({
|
|
|
1560
1512
|
* items,
|
|
1561
1513
|
* (item, i) => i % 2 === 0 ? Result.succeed(`${i}: ${item}`) : Result.failVoid
|
|
1562
1514
|
* )
|
|
1563
|
-
*
|
|
1515
|
+
* Array.from(evenIndexItems) // => ["0: a", "2: c", "4: e"]
|
|
1564
1516
|
* ```
|
|
1565
1517
|
*
|
|
1566
1518
|
* @category filtering
|
|
@@ -1596,7 +1548,7 @@ export const filterMap = /*#__PURE__*/dual(2, (self, f) => ({
|
|
|
1596
1548
|
*
|
|
1597
1549
|
* **Example** (Filtering and transforming until failure)
|
|
1598
1550
|
*
|
|
1599
|
-
* ```ts
|
|
1551
|
+
* ```ts import.meta.vitest
|
|
1600
1552
|
* import { Iterable, Result } from "effect"
|
|
1601
1553
|
*
|
|
1602
1554
|
* // Parse numbers until we hit an invalid one
|
|
@@ -1605,7 +1557,7 @@ export const filterMap = /*#__PURE__*/dual(2, (self, f) => ({
|
|
|
1605
1557
|
* const num = parseInt(s)
|
|
1606
1558
|
* return isNaN(num) ? Result.failVoid : Result.succeed(num)
|
|
1607
1559
|
* })
|
|
1608
|
-
*
|
|
1560
|
+
* Array.from(numbers) // => [1, 2, 3]
|
|
1609
1561
|
*
|
|
1610
1562
|
* // Take elements while they meet a condition and transform them
|
|
1611
1563
|
* const values = [2, 4, 6, 7, 8, 10]
|
|
@@ -1613,7 +1565,7 @@ export const filterMap = /*#__PURE__*/dual(2, (self, f) => ({
|
|
|
1613
1565
|
* values,
|
|
1614
1566
|
* (n) => n % 2 === 0 ? Result.succeed(n * 2) : Result.failVoid
|
|
1615
1567
|
* )
|
|
1616
|
-
*
|
|
1568
|
+
* Array.from(doubledEvens) // => [4, 8, 12]
|
|
1617
1569
|
*
|
|
1618
1570
|
* // Process with index until condition fails
|
|
1619
1571
|
* const letters = ["a", "b", "c", "d", "e"]
|
|
@@ -1621,7 +1573,7 @@ export const filterMap = /*#__PURE__*/dual(2, (self, f) => ({
|
|
|
1621
1573
|
* letters,
|
|
1622
1574
|
* (letter, i) => letter !== "c" ? Result.succeed(`${i}: ${letter}`) : Result.failVoid
|
|
1623
1575
|
* )
|
|
1624
|
-
*
|
|
1576
|
+
* Array.from(indexedUntilC) // => ["0: a", "1: b"]
|
|
1625
1577
|
* ```
|
|
1626
1578
|
*
|
|
1627
1579
|
* @category filtering
|
|
@@ -1660,16 +1612,10 @@ export const filterMapWhile = /*#__PURE__*/dual(2, (self, f) => ({
|
|
|
1660
1612
|
*
|
|
1661
1613
|
* **Example** (Extracting Some values)
|
|
1662
1614
|
*
|
|
1663
|
-
* ```ts
|
|
1615
|
+
* ```ts import.meta.vitest
|
|
1664
1616
|
* import { Iterable, Option } from "effect"
|
|
1665
|
-
* import * as assert from "node:assert"
|
|
1666
1617
|
*
|
|
1667
|
-
*
|
|
1668
|
-
* Array.from(
|
|
1669
|
-
* Iterable.getSomes([Option.some(1), Option.none(), Option.some(2)])
|
|
1670
|
-
* ),
|
|
1671
|
-
* [1, 2]
|
|
1672
|
-
* )
|
|
1618
|
+
* Array.from(Iterable.getSomes([Option.some(1), Option.none(), Option.some(2)])) // => [1, 2]
|
|
1673
1619
|
* ```
|
|
1674
1620
|
*
|
|
1675
1621
|
* @category filtering
|
|
@@ -1706,20 +1652,14 @@ export const getSomes = self => {
|
|
|
1706
1652
|
*
|
|
1707
1653
|
* **Example** (Extracting failures)
|
|
1708
1654
|
*
|
|
1709
|
-
* ```ts
|
|
1655
|
+
* ```ts import.meta.vitest
|
|
1710
1656
|
* import { Iterable, Result } from "effect"
|
|
1711
|
-
*
|
|
1712
|
-
*
|
|
1713
|
-
*
|
|
1714
|
-
*
|
|
1715
|
-
*
|
|
1716
|
-
*
|
|
1717
|
-
* Result.fail("err"),
|
|
1718
|
-
* Result.succeed(2)
|
|
1719
|
-
* ])
|
|
1720
|
-
* ),
|
|
1721
|
-
* ["err"]
|
|
1722
|
-
* )
|
|
1657
|
+
*
|
|
1658
|
+
* Array.from(Iterable.getFailures([
|
|
1659
|
+
* Result.succeed(1),
|
|
1660
|
+
* Result.fail("err"),
|
|
1661
|
+
* Result.succeed(2)
|
|
1662
|
+
* ])) // => ["err"]
|
|
1723
1663
|
* ```
|
|
1724
1664
|
*
|
|
1725
1665
|
* @category filtering
|
|
@@ -1756,20 +1696,14 @@ export const getFailures = self => {
|
|
|
1756
1696
|
*
|
|
1757
1697
|
* **Example** (Extracting successes)
|
|
1758
1698
|
*
|
|
1759
|
-
* ```ts
|
|
1699
|
+
* ```ts import.meta.vitest
|
|
1760
1700
|
* import { Iterable, Result } from "effect"
|
|
1761
|
-
*
|
|
1762
|
-
*
|
|
1763
|
-
*
|
|
1764
|
-
*
|
|
1765
|
-
*
|
|
1766
|
-
*
|
|
1767
|
-
* Result.fail("err"),
|
|
1768
|
-
* Result.succeed(2)
|
|
1769
|
-
* ])
|
|
1770
|
-
* ),
|
|
1771
|
-
* [1, 2]
|
|
1772
|
-
* )
|
|
1701
|
+
*
|
|
1702
|
+
* Array.from(Iterable.getSuccesses([
|
|
1703
|
+
* Result.succeed(1),
|
|
1704
|
+
* Result.fail("err"),
|
|
1705
|
+
* Result.succeed(2)
|
|
1706
|
+
* ])) // => [1, 2]
|
|
1773
1707
|
* ```
|
|
1774
1708
|
*
|
|
1775
1709
|
* @category filtering
|
|
@@ -1811,18 +1745,18 @@ export const getSuccesses = self => {
|
|
|
1811
1745
|
*
|
|
1812
1746
|
* **Example** (Filtering elements)
|
|
1813
1747
|
*
|
|
1814
|
-
* ```ts
|
|
1748
|
+
* ```ts import.meta.vitest
|
|
1815
1749
|
* import { Iterable } from "effect"
|
|
1816
1750
|
*
|
|
1817
1751
|
* // Filter even numbers
|
|
1818
1752
|
* const numbers = [1, 2, 3, 4, 5, 6]
|
|
1819
1753
|
* const evens = Iterable.filter(numbers, (x) => x % 2 === 0)
|
|
1820
|
-
*
|
|
1754
|
+
* Array.from(evens) // => [2, 4, 6]
|
|
1821
1755
|
*
|
|
1822
1756
|
* // Filter with index
|
|
1823
1757
|
* const items = ["a", "b", "c", "d"]
|
|
1824
1758
|
* const oddPositions = Iterable.filter(items, (_, i) => i % 2 === 1)
|
|
1825
|
-
*
|
|
1759
|
+
* Array.from(oddPositions) // => ["b", "d"]
|
|
1826
1760
|
*
|
|
1827
1761
|
* // Type refinement
|
|
1828
1762
|
* const mixed: Array<string | number> = ["hello", 42, "world", 100]
|
|
@@ -1830,14 +1764,14 @@ export const getSuccesses = self => {
|
|
|
1830
1764
|
* mixed,
|
|
1831
1765
|
* (x): x is string => typeof x === "string"
|
|
1832
1766
|
* )
|
|
1833
|
-
*
|
|
1767
|
+
* Array.from(onlyStrings) // => ["hello", "world"]
|
|
1834
1768
|
*
|
|
1835
1769
|
* // Combine with map
|
|
1836
1770
|
* const processed = Iterable.map(
|
|
1837
1771
|
* Iterable.filter([1, 2, 3, 4, 5], (x) => x > 2),
|
|
1838
1772
|
* (x) => x * 10
|
|
1839
1773
|
* )
|
|
1840
|
-
*
|
|
1774
|
+
* Array.from(processed) // => [30, 40, 50]
|
|
1841
1775
|
* ```
|
|
1842
1776
|
*
|
|
1843
1777
|
* @category filtering
|
|
@@ -1877,7 +1811,7 @@ export const filter = /*#__PURE__*/dual(2, (self, predicate) => ({
|
|
|
1877
1811
|
*
|
|
1878
1812
|
* **Example** (Flat mapping nullable results)
|
|
1879
1813
|
*
|
|
1880
|
-
* ```ts
|
|
1814
|
+
* ```ts import.meta.vitest
|
|
1881
1815
|
* import { Iterable } from "effect"
|
|
1882
1816
|
*
|
|
1883
1817
|
* // Extract valid elements from nullable function results
|
|
@@ -1886,7 +1820,7 @@ export const filter = /*#__PURE__*/dual(2, (self, predicate) => ({
|
|
|
1886
1820
|
* const num = parseInt(s)
|
|
1887
1821
|
* return isNaN(num) ? null : num * 2
|
|
1888
1822
|
* })
|
|
1889
|
-
*
|
|
1823
|
+
* Array.from(parsed) // => [2, 4, 8]
|
|
1890
1824
|
*
|
|
1891
1825
|
* // Safe property access
|
|
1892
1826
|
* const objects = [
|
|
@@ -1896,7 +1830,7 @@ export const filter = /*#__PURE__*/dual(2, (self, predicate) => ({
|
|
|
1896
1830
|
* {}
|
|
1897
1831
|
* ]
|
|
1898
1832
|
* const values = Iterable.flatMapNullishOr(objects, (obj) => obj.nested?.value)
|
|
1899
|
-
*
|
|
1833
|
+
* Array.from(values) // => [10, 20]
|
|
1900
1834
|
*
|
|
1901
1835
|
* // Working with Map.get (returns undefined for missing keys)
|
|
1902
1836
|
* const map = new Map([
|
|
@@ -1906,7 +1840,7 @@ export const filter = /*#__PURE__*/dual(2, (self, predicate) => ({
|
|
|
1906
1840
|
* ])
|
|
1907
1841
|
* const keys = ["a", "x", "b", "y", "c"]
|
|
1908
1842
|
* const foundValues = Iterable.flatMapNullishOr(keys, (key) => map.get(key))
|
|
1909
|
-
*
|
|
1843
|
+
* Array.from(foundValues) // => [1, 2, 3]
|
|
1910
1844
|
* ```
|
|
1911
1845
|
*
|
|
1912
1846
|
* @category sequencing
|
|
@@ -1921,21 +1855,21 @@ export const flatMapNullishOr = /*#__PURE__*/dual(2, (self, f) => filterMap(self
|
|
|
1921
1855
|
*
|
|
1922
1856
|
* **Example** (Checking whether some element matches)
|
|
1923
1857
|
*
|
|
1924
|
-
* ```ts
|
|
1858
|
+
* ```ts import.meta.vitest
|
|
1925
1859
|
* import { Iterable } from "effect"
|
|
1926
1860
|
*
|
|
1927
1861
|
* const numbers = [1, 3, 5, 7, 8]
|
|
1928
1862
|
* const hasEven = Iterable.some(numbers, (x) => x % 2 === 0)
|
|
1929
|
-
*
|
|
1863
|
+
* hasEven // => true
|
|
1930
1864
|
*
|
|
1931
1865
|
* const allOdd = [1, 3, 5, 7]
|
|
1932
1866
|
* const hasEvenInAllOdd = Iterable.some(allOdd, (x) => x % 2 === 0)
|
|
1933
|
-
*
|
|
1867
|
+
* hasEvenInAllOdd // => false
|
|
1934
1868
|
*
|
|
1935
1869
|
* // With index
|
|
1936
1870
|
* const letters = ["a", "b", "c"]
|
|
1937
1871
|
* const hasElementAtIndex2 = Iterable.some(letters, (_, i) => i === 2)
|
|
1938
|
-
*
|
|
1872
|
+
* hasElementAtIndex2 // => true
|
|
1939
1873
|
*
|
|
1940
1874
|
* // Early termination - stops at first match
|
|
1941
1875
|
* const infiniteOdds = Iterable.filter(Iterable.range(1), (x) => x % 2 === 1)
|
|
@@ -1943,7 +1877,7 @@ export const flatMapNullishOr = /*#__PURE__*/dual(2, (self, f) => filterMap(self
|
|
|
1943
1877
|
* Iterable.take(infiniteOdds, 1000),
|
|
1944
1878
|
* (x) => x % 2 === 0
|
|
1945
1879
|
* )
|
|
1946
|
-
*
|
|
1880
|
+
* hasEvenInInfiniteOdds // => false
|
|
1947
1881
|
*
|
|
1948
1882
|
* // Type guard usage
|
|
1949
1883
|
* const mixed: Array<string | number> = [1, 2, "hello"]
|
|
@@ -1951,10 +1885,10 @@ export const flatMapNullishOr = /*#__PURE__*/dual(2, (self, f) => filterMap(self
|
|
|
1951
1885
|
* mixed,
|
|
1952
1886
|
* (x): x is string => typeof x === "string"
|
|
1953
1887
|
* )
|
|
1954
|
-
*
|
|
1888
|
+
* hasString // => true
|
|
1955
1889
|
* ```
|
|
1956
1890
|
*
|
|
1957
|
-
* @category
|
|
1891
|
+
* @category predicates
|
|
1958
1892
|
* @since 2.0.0
|
|
1959
1893
|
*/
|
|
1960
1894
|
export const some = /*#__PURE__*/dual(2, (self, predicate) => {
|
|
@@ -1978,21 +1912,21 @@ export const some = /*#__PURE__*/dual(2, (self, predicate) => {
|
|
|
1978
1912
|
*
|
|
1979
1913
|
* **Example** (Unfolding state into values)
|
|
1980
1914
|
*
|
|
1981
|
-
* ```ts
|
|
1915
|
+
* ```ts import.meta.vitest
|
|
1982
1916
|
* import { Iterable, Option } from "effect"
|
|
1983
1917
|
*
|
|
1984
1918
|
* // Generate Fibonacci sequence
|
|
1985
1919
|
* const fibonacci = Iterable.unfold([0, 1], ([a, b]) => Option.some([a, [b, a + b]]))
|
|
1986
1920
|
* const first10Fib = Iterable.take(fibonacci, 10)
|
|
1987
|
-
*
|
|
1921
|
+
* Array.from(first10Fib) // => [0, 1, 1, 2, 3, 5, 8, 13, 21, 34]
|
|
1988
1922
|
*
|
|
1989
1923
|
* // Generate powers of 2 up to a limit
|
|
1990
1924
|
* const powersOf2 = Iterable.unfold(1, (n) => n <= 1000 ? Option.some([n, n * 2]) : Option.none())
|
|
1991
|
-
*
|
|
1925
|
+
* Array.from(powersOf2) // => [1, 2, 4, 8, 16, 32, 64, 128, 256, 512]
|
|
1992
1926
|
*
|
|
1993
1927
|
* // Generate countdown
|
|
1994
1928
|
* const countdown = Iterable.unfold(5, (n) => n > 0 ? Option.some([n, n - 1]) : Option.none())
|
|
1995
|
-
*
|
|
1929
|
+
* Array.from(countdown) // => [5, 4, 3, 2, 1]
|
|
1996
1930
|
*
|
|
1997
1931
|
* // Generate collatz sequence
|
|
1998
1932
|
* const collatz = Iterable.unfold(7, (n) => {
|
|
@@ -2000,7 +1934,7 @@ export const some = /*#__PURE__*/dual(2, (self, predicate) => {
|
|
|
2000
1934
|
* const next = n % 2 === 0 ? n / 2 : n * 3 + 1
|
|
2001
1935
|
* return Option.some([n, next])
|
|
2002
1936
|
* })
|
|
2003
|
-
*
|
|
1937
|
+
* Array.from(collatz) // => [7, 22, 11, 34, 17, 52, 26, 13, 40, 20, 10, 5, 16, 8, 4, 2]
|
|
2004
1938
|
* ```
|
|
2005
1939
|
*
|
|
2006
1940
|
* @category constructors
|
|
@@ -2033,37 +1967,40 @@ export const unfold = (b, f) => ({
|
|
|
2033
1967
|
*
|
|
2034
1968
|
* **Example** (Iterating with side effects)
|
|
2035
1969
|
*
|
|
2036
|
-
* ```ts
|
|
1970
|
+
* ```ts import.meta.vitest
|
|
2037
1971
|
* import { Iterable } from "effect"
|
|
2038
1972
|
*
|
|
2039
|
-
* //
|
|
1973
|
+
* // Collect each visited element
|
|
2040
1974
|
* const numbers = [1, 2, 3, 4, 5]
|
|
2041
|
-
*
|
|
2042
|
-
*
|
|
1975
|
+
* const visited: Array<number> = []
|
|
1976
|
+
* Iterable.forEach(numbers, (n) => visited.push(n))
|
|
1977
|
+
* visited // => [1, 2, 3, 4, 5]
|
|
2043
1978
|
*
|
|
2044
1979
|
* // Use index in the callback
|
|
2045
1980
|
* const letters = ["a", "b", "c"]
|
|
1981
|
+
* const indexed: Array<string> = []
|
|
2046
1982
|
* Iterable.forEach(letters, (letter, i) => {
|
|
2047
|
-
*
|
|
1983
|
+
* indexed.push(`${i}: ${letter}`)
|
|
2048
1984
|
* })
|
|
2049
|
-
* //
|
|
1985
|
+
* indexed // => ["0: a", "1: b", "2: c"]
|
|
2050
1986
|
*
|
|
2051
1987
|
* // Side effects with any iterable
|
|
2052
1988
|
* const results: Array<number> = []
|
|
2053
1989
|
* Iterable.forEach(Iterable.range(1, 5), (n) => {
|
|
2054
1990
|
* results.push(n * n)
|
|
2055
1991
|
* })
|
|
2056
|
-
*
|
|
1992
|
+
* results // => [1, 4, 9, 16, 25]
|
|
2057
1993
|
*
|
|
2058
1994
|
* // Process in chunks
|
|
2059
1995
|
* const data = Iterable.chunksOf([1, 2, 3, 4, 5, 6], 2)
|
|
1996
|
+
* const processed: Array<Array<number>> = []
|
|
2060
1997
|
* Iterable.forEach(data, (chunk) => {
|
|
2061
|
-
*
|
|
1998
|
+
* processed.push(Array.from(chunk))
|
|
2062
1999
|
* })
|
|
2063
|
-
* //
|
|
2000
|
+
* processed // => [[1, 2], [3, 4], [5, 6]]
|
|
2064
2001
|
* ```
|
|
2065
2002
|
*
|
|
2066
|
-
* @category
|
|
2003
|
+
* @category traversing
|
|
2067
2004
|
* @since 2.0.0
|
|
2068
2005
|
*/
|
|
2069
2006
|
export const forEach = /*#__PURE__*/dual(2, (self, f) => {
|
|
@@ -2082,18 +2019,17 @@ export const forEach = /*#__PURE__*/dual(2, (self, f) => {
|
|
|
2082
2019
|
*
|
|
2083
2020
|
* **Example** (Reducing an iterable)
|
|
2084
2021
|
*
|
|
2085
|
-
* ```ts
|
|
2022
|
+
* ```ts import.meta.vitest
|
|
2086
2023
|
* import { Iterable } from "effect"
|
|
2087
2024
|
*
|
|
2088
2025
|
* // Sum all numbers
|
|
2089
2026
|
* const numbers = [1, 2, 3, 4, 5]
|
|
2090
2027
|
* const sum = Iterable.reduce(numbers, 0, (acc, n) => acc + n)
|
|
2091
|
-
*
|
|
2028
|
+
* sum // => 15
|
|
2092
2029
|
*
|
|
2093
2030
|
* // Find maximum value
|
|
2094
2031
|
* const values = [3, 1, 4, 1, 5, 9, 2]
|
|
2095
|
-
*
|
|
2096
|
-
* console.log(max) // 9
|
|
2032
|
+
* Iterable.reduce(values, -Infinity, (max, value) => Math.max(max, value)) // => 9
|
|
2097
2033
|
*
|
|
2098
2034
|
* // Build an object from key-value pairs
|
|
2099
2035
|
* const pairs = [["a", 1], ["b", 2], ["c", 3]] as const
|
|
@@ -2105,7 +2041,7 @@ export const forEach = /*#__PURE__*/dual(2, (self, f) => {
|
|
|
2105
2041
|
* return acc
|
|
2106
2042
|
* }
|
|
2107
2043
|
* )
|
|
2108
|
-
*
|
|
2044
|
+
* obj // => { a: 1, b: 2, c: 3 }
|
|
2109
2045
|
*
|
|
2110
2046
|
* // Use index in the reducer
|
|
2111
2047
|
* const letters = ["a", "b", "c"]
|
|
@@ -2117,7 +2053,7 @@ export const forEach = /*#__PURE__*/dual(2, (self, f) => {
|
|
|
2117
2053
|
* return acc
|
|
2118
2054
|
* }
|
|
2119
2055
|
* )
|
|
2120
|
-
*
|
|
2056
|
+
* indexed // => ["0: a", "1: b", "2: c"]
|
|
2121
2057
|
* ```
|
|
2122
2058
|
*
|
|
2123
2059
|
* @category folding
|
|
@@ -2139,20 +2075,20 @@ export const reduce = /*#__PURE__*/dual(3, (self, b, f) => {
|
|
|
2139
2075
|
*
|
|
2140
2076
|
* **Example** (Deduplicating adjacent elements with custom equivalence)
|
|
2141
2077
|
*
|
|
2142
|
-
* ```ts
|
|
2078
|
+
* ```ts import.meta.vitest
|
|
2143
2079
|
* import { Iterable } from "effect"
|
|
2144
2080
|
*
|
|
2145
2081
|
* // Remove adjacent duplicates with custom equality
|
|
2146
2082
|
* const numbers = [1, 1, 2, 2, 3, 1, 1]
|
|
2147
2083
|
* const dedupedNumbers = Iterable.dedupeAdjacentWith(numbers, (a, b) => a === b)
|
|
2148
|
-
*
|
|
2084
|
+
* Array.from(dedupedNumbers) // => [1, 2, 3, 1]
|
|
2149
2085
|
*
|
|
2150
2086
|
* // Case-insensitive deduplication
|
|
2151
2087
|
* const words = ["Hello", "HELLO", "world", "World", "test"]
|
|
2152
2088
|
* const caseInsensitive = (a: string, b: string) =>
|
|
2153
2089
|
* a.toLowerCase() === b.toLowerCase()
|
|
2154
2090
|
* const dedupedWords = Iterable.dedupeAdjacentWith(words, caseInsensitive)
|
|
2155
|
-
*
|
|
2091
|
+
* Array.from(dedupedWords) // => ["Hello", "world", "test"]
|
|
2156
2092
|
*
|
|
2157
2093
|
* // Deduplication by object property
|
|
2158
2094
|
* const users = [
|
|
@@ -2164,13 +2100,13 @@ export const reduce = /*#__PURE__*/dual(3, (self, b, f) => {
|
|
|
2164
2100
|
* ]
|
|
2165
2101
|
* const byId = (a: typeof users[0], b: typeof users[0]) => a.id === b.id
|
|
2166
2102
|
* const dedupedUsers = Iterable.dedupeAdjacentWith(users, byId)
|
|
2167
|
-
*
|
|
2103
|
+
* Array.from(dedupedUsers, (user) => user.id) // => [1, 2, 3]
|
|
2168
2104
|
*
|
|
2169
2105
|
* // Approximate numeric equality
|
|
2170
2106
|
* const floats = [1.0, 1.01, 1.02, 2.0, 2.01, 3.0]
|
|
2171
2107
|
* const approxEqual = (a: number, b: number) => Math.abs(a - b) < 0.1
|
|
2172
2108
|
* const dedupedFloats = Iterable.dedupeAdjacentWith(floats, approxEqual)
|
|
2173
|
-
*
|
|
2109
|
+
* Array.from(dedupedFloats) // => [1, 2, 3]
|
|
2174
2110
|
* ```
|
|
2175
2111
|
*
|
|
2176
2112
|
* @category filtering
|
|
@@ -2211,18 +2147,18 @@ export const dedupeAdjacentWith = /*#__PURE__*/dual(2, (self, isEquivalent) => (
|
|
|
2211
2147
|
*
|
|
2212
2148
|
* **Example** (Deduplicating adjacent elements)
|
|
2213
2149
|
*
|
|
2214
|
-
* ```ts
|
|
2150
|
+
* ```ts import.meta.vitest
|
|
2215
2151
|
* import { Iterable } from "effect"
|
|
2216
2152
|
*
|
|
2217
2153
|
* // Remove adjacent duplicate numbers
|
|
2218
2154
|
* const numbers = [1, 1, 2, 2, 2, 3, 1, 1]
|
|
2219
2155
|
* const deduped = Iterable.dedupeAdjacent(numbers)
|
|
2220
|
-
*
|
|
2156
|
+
* Array.from(deduped) // => [1, 2, 3, 1]
|
|
2221
2157
|
*
|
|
2222
2158
|
* // Remove adjacent duplicate characters
|
|
2223
2159
|
* const letters = "aabbccaa"
|
|
2224
2160
|
* const dedupedLetters = Iterable.dedupeAdjacent(letters)
|
|
2225
|
-
*
|
|
2161
|
+
* Array.from(dedupedLetters) // => ["a", "b", "c", "a"]
|
|
2226
2162
|
*
|
|
2227
2163
|
* // Works with objects using deep equality
|
|
2228
2164
|
* const objects = [
|
|
@@ -2233,12 +2169,12 @@ export const dedupeAdjacentWith = /*#__PURE__*/dual(2, (self, isEquivalent) => (
|
|
|
2233
2169
|
* { type: "A" }
|
|
2234
2170
|
* ]
|
|
2235
2171
|
* const dedupedObjects = Iterable.dedupeAdjacent(objects)
|
|
2236
|
-
*
|
|
2172
|
+
* Array.from(dedupedObjects, (object) => object.type) // => ["A", "B", "A"]
|
|
2237
2173
|
*
|
|
2238
2174
|
* // Clean up streaming data
|
|
2239
2175
|
* const sensorData = [100, 100, 100, 101, 101, 102, 102, 102, 100]
|
|
2240
2176
|
* const cleanedData = Iterable.dedupeAdjacent(sensorData)
|
|
2241
|
-
*
|
|
2177
|
+
* Array.from(cleanedData) // => [100, 101, 102, 100]
|
|
2242
2178
|
* ```
|
|
2243
2179
|
*
|
|
2244
2180
|
* @category filtering
|
|
@@ -2250,14 +2186,14 @@ export const dedupeAdjacent = /*#__PURE__*/dedupeAdjacentWith(/*#__PURE__*/Equal
|
|
|
2250
2186
|
*
|
|
2251
2187
|
* **Example** (Combining cartesian products)
|
|
2252
2188
|
*
|
|
2253
|
-
* ```ts
|
|
2189
|
+
* ```ts import.meta.vitest
|
|
2254
2190
|
* import { Iterable } from "effect"
|
|
2255
2191
|
*
|
|
2256
2192
|
* // Create coordinate pairs
|
|
2257
2193
|
* const xs = [1, 2]
|
|
2258
2194
|
* const ys = ["a", "b", "c"]
|
|
2259
2195
|
* const coordinates = Iterable.cartesianWith(xs, ys, (x, y) => `(${x},${y})`)
|
|
2260
|
-
*
|
|
2196
|
+
* Array.from(coordinates) // => ["(1,a)", "(1,b)", "(1,c)", "(2,a)", "(2,b)", "(2,c)"]
|
|
2261
2197
|
*
|
|
2262
2198
|
* // Generate all combinations of options
|
|
2263
2199
|
* const sizes = ["S", "M", "L"]
|
|
@@ -2267,18 +2203,13 @@ export const dedupeAdjacent = /*#__PURE__*/dedupeAdjacentWith(/*#__PURE__*/Equal
|
|
|
2267
2203
|
* colors,
|
|
2268
2204
|
* (size, color) => ({ size, color })
|
|
2269
2205
|
* )
|
|
2270
|
-
*
|
|
2271
|
-
* // [
|
|
2272
|
-
* // { size: "S", color: "red" }, { size: "S", color: "blue" },
|
|
2273
|
-
* // { size: "M", color: "red" }, { size: "M", color: "blue" },
|
|
2274
|
-
* // { size: "L", color: "red" }, { size: "L", color: "blue" }
|
|
2275
|
-
* // ]
|
|
2206
|
+
* Array.from(products, ({ color, size }) => `${size}:${color}`) // => ["S:red", "S:blue", "M:red", "M:blue", "L:red", "L:blue"]
|
|
2276
2207
|
*
|
|
2277
2208
|
* // Mathematical operations on all pairs
|
|
2278
2209
|
* const a = [1, 2, 3]
|
|
2279
2210
|
* const b = [10, 20]
|
|
2280
2211
|
* const mathProducts = Iterable.cartesianWith(a, b, (x, y) => x * y)
|
|
2281
|
-
*
|
|
2212
|
+
* Array.from(mathProducts) // => [10, 20, 20, 40, 30, 60]
|
|
2282
2213
|
*
|
|
2283
2214
|
* // Create test data combinations
|
|
2284
2215
|
* const userTypes = ["admin", "user"]
|
|
@@ -2288,11 +2219,10 @@ export const dedupeAdjacent = /*#__PURE__*/dedupeAdjacentWith(/*#__PURE__*/Equal
|
|
|
2288
2219
|
* features,
|
|
2289
2220
|
* (user, feature) => `${user}_can_${feature}`
|
|
2290
2221
|
* )
|
|
2291
|
-
*
|
|
2292
|
-
* // ["admin_can_read", "admin_can_write", "admin_can_delete", "user_can_read", "user_can_write", "user_can_delete"]
|
|
2222
|
+
* Array.from(testCases) // => ["admin_can_read", "admin_can_write", "admin_can_delete", "user_can_read", "user_can_write", "user_can_delete"]
|
|
2293
2223
|
* ```
|
|
2294
2224
|
*
|
|
2295
|
-
* @category
|
|
2225
|
+
* @category combining
|
|
2296
2226
|
* @since 2.0.0
|
|
2297
2227
|
*/
|
|
2298
2228
|
export const cartesianWith = /*#__PURE__*/dual(3, (self, that, f) => ({
|
|
@@ -2341,40 +2271,34 @@ export const cartesianWith = /*#__PURE__*/dual(3, (self, that, f) => ({
|
|
|
2341
2271
|
*
|
|
2342
2272
|
* **Example** (Generating cartesian pairs)
|
|
2343
2273
|
*
|
|
2344
|
-
* ```ts
|
|
2274
|
+
* ```ts import.meta.vitest
|
|
2345
2275
|
* import { Iterable } from "effect"
|
|
2346
2276
|
*
|
|
2347
2277
|
* // All pairs of numbers and letters
|
|
2348
2278
|
* const numbers = [1, 2, 3]
|
|
2349
2279
|
* const letters = ["a", "b"]
|
|
2350
2280
|
* const pairs = Iterable.cartesian(numbers, letters)
|
|
2351
|
-
*
|
|
2352
|
-
* // [[1, "a"], [1, "b"], [2, "a"], [2, "b"], [3, "a"], [3, "b"]]
|
|
2281
|
+
* Array.from(pairs) // => [[1, "a"], [1, "b"], [2, "a"], [2, "b"], [3, "a"], [3, "b"]]
|
|
2353
2282
|
*
|
|
2354
2283
|
* // Generate coordinate grid
|
|
2355
2284
|
* const x = [0, 1, 2]
|
|
2356
2285
|
* const y = [0, 1]
|
|
2357
2286
|
* const grid = Iterable.cartesian(x, y)
|
|
2358
|
-
*
|
|
2359
|
-
* // [[0, 0], [0, 1], [1, 0], [1, 1], [2, 0], [2, 1]]
|
|
2287
|
+
* Array.from(grid) // => [[0, 0], [0, 1], [1, 0], [1, 1], [2, 0], [2, 1]]
|
|
2360
2288
|
*
|
|
2361
2289
|
* // All combinations for testing
|
|
2362
2290
|
* const browsers = ["chrome", "firefox"]
|
|
2363
2291
|
* const devices = ["desktop", "mobile", "tablet"]
|
|
2364
2292
|
* const testMatrix = Iterable.cartesian(browsers, devices)
|
|
2365
|
-
*
|
|
2366
|
-
* // [
|
|
2367
|
-
* // ["chrome", "desktop"], ["chrome", "mobile"], ["chrome", "tablet"],
|
|
2368
|
-
* // ["firefox", "desktop"], ["firefox", "mobile"], ["firefox", "tablet"]
|
|
2369
|
-
* // ]
|
|
2293
|
+
* Array.from(testMatrix, ([browser, device]) => `${browser}:${device}`) // => ["chrome:desktop", "chrome:mobile", "chrome:tablet", "firefox:desktop", "firefox:mobile", "firefox:tablet"]
|
|
2370
2294
|
*
|
|
2371
2295
|
* // Empty iterable results in empty cartesian product
|
|
2372
2296
|
* const empty = Iterable.empty<number>()
|
|
2373
2297
|
* const withEmpty = Iterable.cartesian([1, 2], empty)
|
|
2374
|
-
*
|
|
2298
|
+
* Array.from(withEmpty) // => []
|
|
2375
2299
|
* ```
|
|
2376
2300
|
*
|
|
2377
|
-
* @category
|
|
2301
|
+
* @category combining
|
|
2378
2302
|
* @since 2.0.0
|
|
2379
2303
|
*/
|
|
2380
2304
|
export const cartesian = /*#__PURE__*/dual(2, (self, that) => cartesianWith(self, that, (a, b) => [a, b]));
|
|
@@ -2383,11 +2307,10 @@ export const cartesian = /*#__PURE__*/dual(2, (self, that) => cartesianWith(self
|
|
|
2383
2307
|
*
|
|
2384
2308
|
* **Example** (Counting matching elements)
|
|
2385
2309
|
*
|
|
2386
|
-
* ```ts
|
|
2310
|
+
* ```ts import.meta.vitest
|
|
2387
2311
|
* import { Iterable } from "effect"
|
|
2388
2312
|
*
|
|
2389
|
-
*
|
|
2390
|
-
* console.log(result) // 2
|
|
2313
|
+
* Iterable.countBy([1, 2, 3, 4, 5], (n) => n % 2 === 0) // => 2
|
|
2391
2314
|
* ```
|
|
2392
2315
|
*
|
|
2393
2316
|
* @category folding
|