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