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/src/TxHashMap.ts
CHANGED
|
@@ -51,8 +51,8 @@ const TxHashMapProto = {
|
|
|
51
51
|
*
|
|
52
52
|
* **Example** (Using transactional hash maps)
|
|
53
53
|
*
|
|
54
|
-
* ```ts
|
|
55
|
-
* import { Effect, TxHashMap } from "effect"
|
|
54
|
+
* ```ts import.meta.vitest
|
|
55
|
+
* import { Effect, Option, TxHashMap } from "effect"
|
|
56
56
|
*
|
|
57
57
|
* const program = Effect.gen(function*() {
|
|
58
58
|
* // Create a transactional hash map
|
|
@@ -60,8 +60,7 @@ const TxHashMapProto = {
|
|
|
60
60
|
*
|
|
61
61
|
* // Single operations are automatically transactional
|
|
62
62
|
* yield* TxHashMap.set(txMap, "user3", "Charlie")
|
|
63
|
-
*
|
|
64
|
-
* console.log(user) // Option.some("Alice")
|
|
63
|
+
* yield* TxHashMap.get(txMap, "user1") // => Option.some("Alice")
|
|
65
64
|
*
|
|
66
65
|
* // Multi-step atomic operations
|
|
67
66
|
* yield* Effect.tx(
|
|
@@ -74,9 +73,10 @@ const TxHashMapProto = {
|
|
|
74
73
|
* })
|
|
75
74
|
* )
|
|
76
75
|
*
|
|
77
|
-
*
|
|
78
|
-
* console.log(size) // 2
|
|
76
|
+
* return yield* TxHashMap.size(txMap)
|
|
79
77
|
* })
|
|
78
|
+
*
|
|
79
|
+
* await Effect.runPromise(program) // => 2
|
|
80
80
|
* ```
|
|
81
81
|
*
|
|
82
82
|
* @category models
|
|
@@ -93,8 +93,8 @@ export interface TxHashMap<in out K, in out V> extends Inspectable, Pipeable {
|
|
|
93
93
|
*
|
|
94
94
|
* **Example** (Reusing extracted TxHashMap types)
|
|
95
95
|
*
|
|
96
|
-
* ```ts
|
|
97
|
-
* import { Effect, TxHashMap } from "effect"
|
|
96
|
+
* ```ts import.meta.vitest
|
|
97
|
+
* import { Effect, Option, TxHashMap } from "effect"
|
|
98
98
|
*
|
|
99
99
|
* const program = Effect.gen(function*() {
|
|
100
100
|
* // Create a transactional inventory map
|
|
@@ -117,7 +117,10 @@ export interface TxHashMap<in out K, in out V> extends Inspectable, Pipeable {
|
|
|
117
117
|
* )
|
|
118
118
|
*
|
|
119
119
|
* yield* updateStock("laptop", 3)
|
|
120
|
+
* return yield* TxHashMap.get(inventory, "laptop")
|
|
120
121
|
* })
|
|
122
|
+
*
|
|
123
|
+
* await Effect.runPromise(program) // => Option.some({ stock: 3, price: 999 })
|
|
121
124
|
* ```
|
|
122
125
|
*
|
|
123
126
|
* @since 4.0.0
|
|
@@ -128,8 +131,8 @@ export declare namespace TxHashMap {
|
|
|
128
131
|
*
|
|
129
132
|
* **Example** (Extracting key types)
|
|
130
133
|
*
|
|
131
|
-
* ```ts
|
|
132
|
-
* import { Effect, TxHashMap } from "effect"
|
|
134
|
+
* ```ts import.meta.vitest
|
|
135
|
+
* import { Effect, Option, TxHashMap } from "effect"
|
|
133
136
|
*
|
|
134
137
|
* const program = Effect.gen(function*() {
|
|
135
138
|
* // Create a user map to extract key type from
|
|
@@ -143,8 +146,10 @@ export declare namespace TxHashMap {
|
|
|
143
146
|
*
|
|
144
147
|
* // Use the extracted type in functions
|
|
145
148
|
* const getUserById = (id: UserKey) => TxHashMap.get(userMap, id)
|
|
146
|
-
*
|
|
149
|
+
* return yield* getUserById("alice")
|
|
147
150
|
* })
|
|
151
|
+
*
|
|
152
|
+
* await Effect.runPromise(program) // => Option.some({ name: "Alice", age: 30 })
|
|
148
153
|
* ```
|
|
149
154
|
*
|
|
150
155
|
* @category utility types
|
|
@@ -157,8 +162,8 @@ export declare namespace TxHashMap {
|
|
|
157
162
|
*
|
|
158
163
|
* **Example** (Extracting value types)
|
|
159
164
|
*
|
|
160
|
-
* ```ts
|
|
161
|
-
* import { Effect, TxHashMap } from "effect"
|
|
165
|
+
* ```ts import.meta.vitest
|
|
166
|
+
* import { Effect, Option, TxHashMap } from "effect"
|
|
162
167
|
*
|
|
163
168
|
* const program = Effect.gen(function*() {
|
|
164
169
|
* // Create a product catalog TxHashMap
|
|
@@ -175,9 +180,10 @@ export declare namespace TxHashMap {
|
|
|
175
180
|
* return `${product.category}: $${product.price}`
|
|
176
181
|
* }
|
|
177
182
|
*
|
|
178
|
-
*
|
|
179
|
-
* // laptop has type Option<Product> thanks to type extraction
|
|
183
|
+
* return Option.map(yield* TxHashMap.get(catalog, "laptop"), processProduct)
|
|
180
184
|
* })
|
|
185
|
+
*
|
|
186
|
+
* await Effect.runPromise(program) // => Option.some("electronics: $999")
|
|
181
187
|
* ```
|
|
182
188
|
*
|
|
183
189
|
* @category utility types
|
|
@@ -190,7 +196,7 @@ export declare namespace TxHashMap {
|
|
|
190
196
|
*
|
|
191
197
|
* **Example** (Extracting entry types)
|
|
192
198
|
*
|
|
193
|
-
* ```ts
|
|
199
|
+
* ```ts import.meta.vitest
|
|
194
200
|
* import { Effect, TxHashMap } from "effect"
|
|
195
201
|
*
|
|
196
202
|
* const program = Effect.gen(function*() {
|
|
@@ -210,10 +216,10 @@ export declare namespace TxHashMap {
|
|
|
210
216
|
* }
|
|
211
217
|
*
|
|
212
218
|
* // Get all entries and process them
|
|
213
|
-
*
|
|
214
|
-
* const configLines = entries.map(processEntry)
|
|
215
|
-
* console.log(configLines) // ["api_url=https://api.example.com", ...]
|
|
219
|
+
* return (yield* TxHashMap.entries(config)).map(processEntry).sort()
|
|
216
220
|
* })
|
|
221
|
+
*
|
|
222
|
+
* await Effect.runPromise(program) // => ["api_url=https://api.example.com", "retries=3", "timeout=5000"]
|
|
217
223
|
* ```
|
|
218
224
|
*
|
|
219
225
|
* @category utility types
|
|
@@ -227,7 +233,7 @@ export declare namespace TxHashMap {
|
|
|
227
233
|
*
|
|
228
234
|
* **Example** (Creating an empty map)
|
|
229
235
|
*
|
|
230
|
-
* ```ts
|
|
236
|
+
* ```ts import.meta.vitest
|
|
231
237
|
* import { Effect, TxHashMap } from "effect"
|
|
232
238
|
*
|
|
233
239
|
* const program = Effect.gen(function*() {
|
|
@@ -235,17 +241,15 @@ export declare namespace TxHashMap {
|
|
|
235
241
|
* const emptyMap = yield* TxHashMap.empty<string, number>()
|
|
236
242
|
*
|
|
237
243
|
* // Verify it's empty
|
|
238
|
-
*
|
|
239
|
-
*
|
|
240
|
-
*
|
|
241
|
-
* const size = yield* TxHashMap.size(emptyMap)
|
|
242
|
-
* console.log(size) // 0
|
|
244
|
+
* yield* TxHashMap.isEmpty(emptyMap) // => true
|
|
245
|
+
* yield* TxHashMap.size(emptyMap) // => 0
|
|
243
246
|
*
|
|
244
247
|
* // Start adding elements
|
|
245
248
|
* yield* TxHashMap.set(emptyMap, "first", 1)
|
|
246
|
-
*
|
|
247
|
-
* console.log(newSize) // 1
|
|
249
|
+
* return yield* TxHashMap.size(emptyMap)
|
|
248
250
|
* })
|
|
251
|
+
*
|
|
252
|
+
* await Effect.runPromise(program) // => 1
|
|
249
253
|
* ```
|
|
250
254
|
*
|
|
251
255
|
* @category constructors
|
|
@@ -262,8 +266,8 @@ export const empty = <K, V>(): Effect.Effect<TxHashMap<K, V>> =>
|
|
|
262
266
|
*
|
|
263
267
|
* **Example** (Creating a map from entries)
|
|
264
268
|
*
|
|
265
|
-
* ```ts
|
|
266
|
-
* import { Effect, TxHashMap } from "effect"
|
|
269
|
+
* ```ts import.meta.vitest
|
|
270
|
+
* import { Effect, Option, TxHashMap } from "effect"
|
|
267
271
|
*
|
|
268
272
|
* const program = Effect.gen(function*() {
|
|
269
273
|
* // Create a user directory
|
|
@@ -274,16 +278,14 @@ export const empty = <K, V>(): Effect.Effect<TxHashMap<K, V>> =>
|
|
|
274
278
|
* )
|
|
275
279
|
*
|
|
276
280
|
* // Check the initial size
|
|
277
|
-
*
|
|
278
|
-
* console.log(size) // 3
|
|
281
|
+
* yield* TxHashMap.size(userMap) // => 3
|
|
279
282
|
*
|
|
280
283
|
* // Access users
|
|
281
|
-
*
|
|
282
|
-
*
|
|
283
|
-
*
|
|
284
|
-
* const nonExistent = yield* TxHashMap.get(userMap, "david")
|
|
285
|
-
* console.log(nonExistent) // Option.none()
|
|
284
|
+
* yield* TxHashMap.get(userMap, "alice") // => Option.some({ name: "Alice Smith", role: "admin" })
|
|
285
|
+
* return yield* TxHashMap.get(userMap, "david")
|
|
286
286
|
* })
|
|
287
|
+
*
|
|
288
|
+
* await Effect.runPromise(program) // => Option.none()
|
|
287
289
|
* ```
|
|
288
290
|
*
|
|
289
291
|
* @category constructors
|
|
@@ -303,8 +305,8 @@ export const make = <K, V>(
|
|
|
303
305
|
*
|
|
304
306
|
* **Example** (Creating a map from an iterable)
|
|
305
307
|
*
|
|
306
|
-
* ```ts
|
|
307
|
-
* import { Effect, TxHashMap } from "effect"
|
|
308
|
+
* ```ts import.meta.vitest
|
|
309
|
+
* import { Effect, Option, TxHashMap } from "effect"
|
|
308
310
|
*
|
|
309
311
|
* const program = Effect.gen(function*() {
|
|
310
312
|
* // Create from various iterable sources
|
|
@@ -318,16 +320,15 @@ export const make = <K, V>(
|
|
|
318
320
|
* const configMap = yield* TxHashMap.fromIterable(configEntries)
|
|
319
321
|
*
|
|
320
322
|
* // Verify the configuration was loaded
|
|
321
|
-
*
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
* const dbHost = yield* TxHashMap.get(configMap, "database.host")
|
|
325
|
-
* console.log(dbHost) // Option.some("localhost")
|
|
323
|
+
* yield* TxHashMap.size(configMap) // => 4
|
|
324
|
+
* yield* TxHashMap.get(configMap, "database.host") // => Option.some("localhost")
|
|
326
325
|
*
|
|
327
326
|
* // Can also create from Map, Set of tuples, etc.
|
|
328
327
|
* const jsMap = new Map([["key1", "value1"], ["key2", "value2"]])
|
|
329
|
-
*
|
|
328
|
+
* return yield* TxHashMap.fromIterable(jsMap)
|
|
330
329
|
* })
|
|
330
|
+
*
|
|
331
|
+
* await Effect.runPromise(program)
|
|
331
332
|
* ```
|
|
332
333
|
*
|
|
333
334
|
* @category constructors
|
|
@@ -347,7 +348,7 @@ export const fromIterable = <K, V>(
|
|
|
347
348
|
*
|
|
348
349
|
* **Example** (Looking up values safely)
|
|
349
350
|
*
|
|
350
|
-
* ```ts
|
|
351
|
+
* ```ts import.meta.vitest
|
|
351
352
|
* import { Effect, Option, TxHashMap } from "effect"
|
|
352
353
|
*
|
|
353
354
|
* const program = Effect.gen(function*() {
|
|
@@ -357,18 +358,14 @@ export const fromIterable = <K, V>(
|
|
|
357
358
|
* )
|
|
358
359
|
*
|
|
359
360
|
* // Safe lookup - returns Option
|
|
360
|
-
*
|
|
361
|
-
*
|
|
362
|
-
*
|
|
363
|
-
* const nonExistent = yield* TxHashMap.get(userMap, "charlie")
|
|
364
|
-
* console.log(nonExistent) // Option.none()
|
|
361
|
+
* yield* TxHashMap.get(userMap, "alice") // => Option.some({ name: "Alice", role: "admin" })
|
|
362
|
+
* yield* TxHashMap.get(userMap, "charlie") // => Option.none()
|
|
365
363
|
*
|
|
366
364
|
* // Use with pipe syntax for type-safe access
|
|
367
|
-
*
|
|
368
|
-
* if (bobRole._tag === "Some") {
|
|
369
|
-
* console.log(bobRole.value.role) // "user"
|
|
370
|
-
* }
|
|
365
|
+
* return yield* TxHashMap.get(userMap, "bob")
|
|
371
366
|
* })
|
|
367
|
+
*
|
|
368
|
+
* await Effect.runPromise(program) // => Option.some({ name: "Bob", role: "user" })
|
|
372
369
|
* ```
|
|
373
370
|
*
|
|
374
371
|
* @category combinators
|
|
@@ -380,7 +377,7 @@ export const get: {
|
|
|
380
377
|
*
|
|
381
378
|
* **Example** (Looking up values safely)
|
|
382
379
|
*
|
|
383
|
-
* ```ts
|
|
380
|
+
* ```ts import.meta.vitest
|
|
384
381
|
* import { Effect, Option, TxHashMap } from "effect"
|
|
385
382
|
*
|
|
386
383
|
* const program = Effect.gen(function*() {
|
|
@@ -390,18 +387,14 @@ export const get: {
|
|
|
390
387
|
* )
|
|
391
388
|
*
|
|
392
389
|
* // Safe lookup - returns Option
|
|
393
|
-
*
|
|
394
|
-
*
|
|
395
|
-
*
|
|
396
|
-
* const nonExistent = yield* TxHashMap.get(userMap, "charlie")
|
|
397
|
-
* console.log(nonExistent) // Option.none()
|
|
390
|
+
* yield* TxHashMap.get(userMap, "alice") // => Option.some({ name: "Alice", role: "admin" })
|
|
391
|
+
* yield* TxHashMap.get(userMap, "charlie") // => Option.none()
|
|
398
392
|
*
|
|
399
393
|
* // Use with pipe syntax for type-safe access
|
|
400
|
-
*
|
|
401
|
-
* if (bobRole._tag === "Some") {
|
|
402
|
-
* console.log(bobRole.value.role) // "user"
|
|
403
|
-
* }
|
|
394
|
+
* return yield* TxHashMap.get(userMap, "bob")
|
|
404
395
|
* })
|
|
396
|
+
*
|
|
397
|
+
* await Effect.runPromise(program) // => Option.some({ name: "Bob", role: "user" })
|
|
405
398
|
* ```
|
|
406
399
|
*
|
|
407
400
|
* @category combinators
|
|
@@ -413,7 +406,7 @@ export const get: {
|
|
|
413
406
|
*
|
|
414
407
|
* **Example** (Looking up values safely)
|
|
415
408
|
*
|
|
416
|
-
* ```ts
|
|
409
|
+
* ```ts import.meta.vitest
|
|
417
410
|
* import { Effect, Option, TxHashMap } from "effect"
|
|
418
411
|
*
|
|
419
412
|
* const program = Effect.gen(function*() {
|
|
@@ -423,18 +416,14 @@ export const get: {
|
|
|
423
416
|
* )
|
|
424
417
|
*
|
|
425
418
|
* // Safe lookup - returns Option
|
|
426
|
-
*
|
|
427
|
-
*
|
|
428
|
-
*
|
|
429
|
-
* const nonExistent = yield* TxHashMap.get(userMap, "charlie")
|
|
430
|
-
* console.log(nonExistent) // Option.none()
|
|
419
|
+
* yield* TxHashMap.get(userMap, "alice") // => Option.some({ name: "Alice", role: "admin" })
|
|
420
|
+
* yield* TxHashMap.get(userMap, "charlie") // => Option.none()
|
|
431
421
|
*
|
|
432
422
|
* // Use with pipe syntax for type-safe access
|
|
433
|
-
*
|
|
434
|
-
* if (bobRole._tag === "Some") {
|
|
435
|
-
* console.log(bobRole.value.role) // "user"
|
|
436
|
-
* }
|
|
423
|
+
* return yield* TxHashMap.get(userMap, "bob")
|
|
437
424
|
* })
|
|
425
|
+
*
|
|
426
|
+
* await Effect.runPromise(program) // => Option.some({ name: "Bob", role: "user" })
|
|
438
427
|
* ```
|
|
439
428
|
*
|
|
440
429
|
* @category combinators
|
|
@@ -460,8 +449,8 @@ export const get: {
|
|
|
460
449
|
*
|
|
461
450
|
* **Example** (Setting values)
|
|
462
451
|
*
|
|
463
|
-
* ```ts
|
|
464
|
-
* import { Effect, TxHashMap } from "effect"
|
|
452
|
+
* ```ts import.meta.vitest
|
|
453
|
+
* import { Effect, Option, TxHashMap } from "effect"
|
|
465
454
|
*
|
|
466
455
|
* const program = Effect.gen(function*() {
|
|
467
456
|
* const inventory = yield* TxHashMap.make(
|
|
@@ -471,17 +460,18 @@ export const get: {
|
|
|
471
460
|
*
|
|
472
461
|
* // Update existing item
|
|
473
462
|
* yield* TxHashMap.set(inventory, "laptop", 3)
|
|
474
|
-
*
|
|
475
|
-
* console.log(laptopStock) // Option.some(3)
|
|
463
|
+
* yield* TxHashMap.get(inventory, "laptop") // => Option.some(3)
|
|
476
464
|
*
|
|
477
465
|
* // Add new item
|
|
478
466
|
* yield* TxHashMap.set(inventory, "keyboard", 15)
|
|
479
|
-
*
|
|
480
|
-
* console.log(keyboardStock) // Option.some(15)
|
|
467
|
+
* yield* TxHashMap.get(inventory, "keyboard") // => Option.some(15)
|
|
481
468
|
*
|
|
482
469
|
* // Use with pipe syntax
|
|
483
470
|
* yield* TxHashMap.set("tablet", 8)(inventory)
|
|
471
|
+
* return yield* TxHashMap.get(inventory, "tablet")
|
|
484
472
|
* })
|
|
473
|
+
*
|
|
474
|
+
* await Effect.runPromise(program) // => Option.some(8)
|
|
485
475
|
* ```
|
|
486
476
|
*
|
|
487
477
|
* @category combinators
|
|
@@ -498,8 +488,8 @@ export const set: {
|
|
|
498
488
|
*
|
|
499
489
|
* **Example** (Setting values)
|
|
500
490
|
*
|
|
501
|
-
* ```ts
|
|
502
|
-
* import { Effect, TxHashMap } from "effect"
|
|
491
|
+
* ```ts import.meta.vitest
|
|
492
|
+
* import { Effect, Option, TxHashMap } from "effect"
|
|
503
493
|
*
|
|
504
494
|
* const program = Effect.gen(function*() {
|
|
505
495
|
* const inventory = yield* TxHashMap.make(
|
|
@@ -509,17 +499,18 @@ export const set: {
|
|
|
509
499
|
*
|
|
510
500
|
* // Update existing item
|
|
511
501
|
* yield* TxHashMap.set(inventory, "laptop", 3)
|
|
512
|
-
*
|
|
513
|
-
* console.log(laptopStock) // Option.some(3)
|
|
502
|
+
* yield* TxHashMap.get(inventory, "laptop") // => Option.some(3)
|
|
514
503
|
*
|
|
515
504
|
* // Add new item
|
|
516
505
|
* yield* TxHashMap.set(inventory, "keyboard", 15)
|
|
517
|
-
*
|
|
518
|
-
* console.log(keyboardStock) // Option.some(15)
|
|
506
|
+
* yield* TxHashMap.get(inventory, "keyboard") // => Option.some(15)
|
|
519
507
|
*
|
|
520
508
|
* // Use with pipe syntax
|
|
521
509
|
* yield* TxHashMap.set("tablet", 8)(inventory)
|
|
510
|
+
* return yield* TxHashMap.get(inventory, "tablet")
|
|
522
511
|
* })
|
|
512
|
+
*
|
|
513
|
+
* await Effect.runPromise(program) // => Option.some(8)
|
|
523
514
|
* ```
|
|
524
515
|
*
|
|
525
516
|
* @category combinators
|
|
@@ -536,8 +527,8 @@ export const set: {
|
|
|
536
527
|
*
|
|
537
528
|
* **Example** (Setting values)
|
|
538
529
|
*
|
|
539
|
-
* ```ts
|
|
540
|
-
* import { Effect, TxHashMap } from "effect"
|
|
530
|
+
* ```ts import.meta.vitest
|
|
531
|
+
* import { Effect, Option, TxHashMap } from "effect"
|
|
541
532
|
*
|
|
542
533
|
* const program = Effect.gen(function*() {
|
|
543
534
|
* const inventory = yield* TxHashMap.make(
|
|
@@ -547,17 +538,18 @@ export const set: {
|
|
|
547
538
|
*
|
|
548
539
|
* // Update existing item
|
|
549
540
|
* yield* TxHashMap.set(inventory, "laptop", 3)
|
|
550
|
-
*
|
|
551
|
-
* console.log(laptopStock) // Option.some(3)
|
|
541
|
+
* yield* TxHashMap.get(inventory, "laptop") // => Option.some(3)
|
|
552
542
|
*
|
|
553
543
|
* // Add new item
|
|
554
544
|
* yield* TxHashMap.set(inventory, "keyboard", 15)
|
|
555
|
-
*
|
|
556
|
-
* console.log(keyboardStock) // Option.some(15)
|
|
545
|
+
* yield* TxHashMap.get(inventory, "keyboard") // => Option.some(15)
|
|
557
546
|
*
|
|
558
547
|
* // Use with pipe syntax
|
|
559
548
|
* yield* TxHashMap.set("tablet", 8)(inventory)
|
|
549
|
+
* return yield* TxHashMap.get(inventory, "tablet")
|
|
560
550
|
* })
|
|
551
|
+
*
|
|
552
|
+
* await Effect.runPromise(program) // => Option.some(8)
|
|
561
553
|
* ```
|
|
562
554
|
*
|
|
563
555
|
* @category combinators
|
|
@@ -575,7 +567,7 @@ export const set: {
|
|
|
575
567
|
*
|
|
576
568
|
* **Example** (Checking for keys)
|
|
577
569
|
*
|
|
578
|
-
* ```ts
|
|
570
|
+
* ```ts import.meta.vitest
|
|
579
571
|
* import { Effect, TxHashMap } from "effect"
|
|
580
572
|
*
|
|
581
573
|
* const program = Effect.gen(function*() {
|
|
@@ -586,19 +578,17 @@ export const set: {
|
|
|
586
578
|
* )
|
|
587
579
|
*
|
|
588
580
|
* // Check if users exist
|
|
589
|
-
*
|
|
590
|
-
*
|
|
591
|
-
*
|
|
592
|
-
* const hasDavid = yield* TxHashMap.has(permissions, "david")
|
|
593
|
-
* console.log(hasDavid) // false
|
|
581
|
+
* yield* TxHashMap.has(permissions, "alice") // => true
|
|
582
|
+
* yield* TxHashMap.has(permissions, "david") // => false
|
|
594
583
|
*
|
|
595
584
|
* // Use direct method call for type-safe access
|
|
596
|
-
*
|
|
597
|
-
* console.log(hasBob) // true
|
|
585
|
+
* return yield* TxHashMap.has(permissions, "bob")
|
|
598
586
|
* })
|
|
587
|
+
*
|
|
588
|
+
* await Effect.runPromise(program) // => true
|
|
599
589
|
* ```
|
|
600
590
|
*
|
|
601
|
-
* @category
|
|
591
|
+
* @category predicates
|
|
602
592
|
* @since 2.0.0
|
|
603
593
|
*/
|
|
604
594
|
export const has: {
|
|
@@ -607,7 +597,7 @@ export const has: {
|
|
|
607
597
|
*
|
|
608
598
|
* **Example** (Checking for keys)
|
|
609
599
|
*
|
|
610
|
-
* ```ts
|
|
600
|
+
* ```ts import.meta.vitest
|
|
611
601
|
* import { Effect, TxHashMap } from "effect"
|
|
612
602
|
*
|
|
613
603
|
* const program = Effect.gen(function*() {
|
|
@@ -618,19 +608,17 @@ export const has: {
|
|
|
618
608
|
* )
|
|
619
609
|
*
|
|
620
610
|
* // Check if users exist
|
|
621
|
-
*
|
|
622
|
-
*
|
|
623
|
-
*
|
|
624
|
-
* const hasDavid = yield* TxHashMap.has(permissions, "david")
|
|
625
|
-
* console.log(hasDavid) // false
|
|
611
|
+
* yield* TxHashMap.has(permissions, "alice") // => true
|
|
612
|
+
* yield* TxHashMap.has(permissions, "david") // => false
|
|
626
613
|
*
|
|
627
614
|
* // Use direct method call for type-safe access
|
|
628
|
-
*
|
|
629
|
-
* console.log(hasBob) // true
|
|
615
|
+
* return yield* TxHashMap.has(permissions, "bob")
|
|
630
616
|
* })
|
|
617
|
+
*
|
|
618
|
+
* await Effect.runPromise(program) // => true
|
|
631
619
|
* ```
|
|
632
620
|
*
|
|
633
|
-
* @category
|
|
621
|
+
* @category predicates
|
|
634
622
|
* @since 2.0.0
|
|
635
623
|
*/
|
|
636
624
|
<K1 extends K, K>(key: K1): <V>(self: TxHashMap<K, V>) => Effect.Effect<boolean>
|
|
@@ -639,7 +627,7 @@ export const has: {
|
|
|
639
627
|
*
|
|
640
628
|
* **Example** (Checking for keys)
|
|
641
629
|
*
|
|
642
|
-
* ```ts
|
|
630
|
+
* ```ts import.meta.vitest
|
|
643
631
|
* import { Effect, TxHashMap } from "effect"
|
|
644
632
|
*
|
|
645
633
|
* const program = Effect.gen(function*() {
|
|
@@ -650,19 +638,17 @@ export const has: {
|
|
|
650
638
|
* )
|
|
651
639
|
*
|
|
652
640
|
* // Check if users exist
|
|
653
|
-
*
|
|
654
|
-
*
|
|
655
|
-
*
|
|
656
|
-
* const hasDavid = yield* TxHashMap.has(permissions, "david")
|
|
657
|
-
* console.log(hasDavid) // false
|
|
641
|
+
* yield* TxHashMap.has(permissions, "alice") // => true
|
|
642
|
+
* yield* TxHashMap.has(permissions, "david") // => false
|
|
658
643
|
*
|
|
659
644
|
* // Use direct method call for type-safe access
|
|
660
|
-
*
|
|
661
|
-
* console.log(hasBob) // true
|
|
645
|
+
* return yield* TxHashMap.has(permissions, "bob")
|
|
662
646
|
* })
|
|
647
|
+
*
|
|
648
|
+
* await Effect.runPromise(program) // => true
|
|
663
649
|
* ```
|
|
664
650
|
*
|
|
665
|
-
* @category
|
|
651
|
+
* @category predicates
|
|
666
652
|
* @since 2.0.0
|
|
667
653
|
*/
|
|
668
654
|
<K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1): Effect.Effect<boolean>
|
|
@@ -685,7 +671,7 @@ export const has: {
|
|
|
685
671
|
*
|
|
686
672
|
* **Example** (Removing keys)
|
|
687
673
|
*
|
|
688
|
-
* ```ts
|
|
674
|
+
* ```ts import.meta.vitest
|
|
689
675
|
* import { Effect, TxHashMap } from "effect"
|
|
690
676
|
*
|
|
691
677
|
* const program = Effect.gen(function*() {
|
|
@@ -696,20 +682,17 @@ export const has: {
|
|
|
696
682
|
* )
|
|
697
683
|
*
|
|
698
684
|
* // Remove expired user
|
|
699
|
-
*
|
|
700
|
-
* console.log(removed) // true (key existed and was removed)
|
|
685
|
+
* yield* TxHashMap.remove(cache, "user:3") // => true
|
|
701
686
|
*
|
|
702
687
|
* // Try to remove non-existent key
|
|
703
|
-
*
|
|
704
|
-
* console.log(notRemoved) // false (key didn't exist)
|
|
688
|
+
* yield* TxHashMap.remove(cache, "user:999") // => false
|
|
705
689
|
*
|
|
706
690
|
* // Verify removal
|
|
707
|
-
*
|
|
708
|
-
*
|
|
709
|
-
*
|
|
710
|
-
* const size = yield* TxHashMap.size(cache)
|
|
711
|
-
* console.log(size) // 2
|
|
691
|
+
* yield* TxHashMap.has(cache, "user:3") // => false
|
|
692
|
+
* return yield* TxHashMap.size(cache)
|
|
712
693
|
* })
|
|
694
|
+
*
|
|
695
|
+
* await Effect.runPromise(program) // => 2
|
|
713
696
|
* ```
|
|
714
697
|
*
|
|
715
698
|
* @category combinators
|
|
@@ -726,7 +709,7 @@ export const remove: {
|
|
|
726
709
|
*
|
|
727
710
|
* **Example** (Removing keys)
|
|
728
711
|
*
|
|
729
|
-
* ```ts
|
|
712
|
+
* ```ts import.meta.vitest
|
|
730
713
|
* import { Effect, TxHashMap } from "effect"
|
|
731
714
|
*
|
|
732
715
|
* const program = Effect.gen(function*() {
|
|
@@ -737,20 +720,17 @@ export const remove: {
|
|
|
737
720
|
* )
|
|
738
721
|
*
|
|
739
722
|
* // Remove expired user
|
|
740
|
-
*
|
|
741
|
-
* console.log(removed) // true (key existed and was removed)
|
|
723
|
+
* yield* TxHashMap.remove(cache, "user:3") // => true
|
|
742
724
|
*
|
|
743
725
|
* // Try to remove non-existent key
|
|
744
|
-
*
|
|
745
|
-
* console.log(notRemoved) // false (key didn't exist)
|
|
726
|
+
* yield* TxHashMap.remove(cache, "user:999") // => false
|
|
746
727
|
*
|
|
747
728
|
* // Verify removal
|
|
748
|
-
*
|
|
749
|
-
*
|
|
750
|
-
*
|
|
751
|
-
* const size = yield* TxHashMap.size(cache)
|
|
752
|
-
* console.log(size) // 2
|
|
729
|
+
* yield* TxHashMap.has(cache, "user:3") // => false
|
|
730
|
+
* return yield* TxHashMap.size(cache)
|
|
753
731
|
* })
|
|
732
|
+
*
|
|
733
|
+
* await Effect.runPromise(program) // => 2
|
|
754
734
|
* ```
|
|
755
735
|
*
|
|
756
736
|
* @category combinators
|
|
@@ -767,7 +747,7 @@ export const remove: {
|
|
|
767
747
|
*
|
|
768
748
|
* **Example** (Removing keys)
|
|
769
749
|
*
|
|
770
|
-
* ```ts
|
|
750
|
+
* ```ts import.meta.vitest
|
|
771
751
|
* import { Effect, TxHashMap } from "effect"
|
|
772
752
|
*
|
|
773
753
|
* const program = Effect.gen(function*() {
|
|
@@ -778,20 +758,17 @@ export const remove: {
|
|
|
778
758
|
* )
|
|
779
759
|
*
|
|
780
760
|
* // Remove expired user
|
|
781
|
-
*
|
|
782
|
-
* console.log(removed) // true (key existed and was removed)
|
|
761
|
+
* yield* TxHashMap.remove(cache, "user:3") // => true
|
|
783
762
|
*
|
|
784
763
|
* // Try to remove non-existent key
|
|
785
|
-
*
|
|
786
|
-
* console.log(notRemoved) // false (key didn't exist)
|
|
764
|
+
* yield* TxHashMap.remove(cache, "user:999") // => false
|
|
787
765
|
*
|
|
788
766
|
* // Verify removal
|
|
789
|
-
*
|
|
790
|
-
*
|
|
791
|
-
*
|
|
792
|
-
* const size = yield* TxHashMap.size(cache)
|
|
793
|
-
* console.log(size) // 2
|
|
767
|
+
* yield* TxHashMap.has(cache, "user:3") // => false
|
|
768
|
+
* return yield* TxHashMap.size(cache)
|
|
794
769
|
* })
|
|
770
|
+
*
|
|
771
|
+
* await Effect.runPromise(program) // => 2
|
|
795
772
|
* ```
|
|
796
773
|
*
|
|
797
774
|
* @category combinators
|
|
@@ -821,7 +798,7 @@ export const remove: {
|
|
|
821
798
|
*
|
|
822
799
|
* **Example** (Clearing all entries)
|
|
823
800
|
*
|
|
824
|
-
* ```ts
|
|
801
|
+
* ```ts import.meta.vitest
|
|
825
802
|
* import { Effect, TxHashMap } from "effect"
|
|
826
803
|
*
|
|
827
804
|
* const program = Effect.gen(function*() {
|
|
@@ -832,19 +809,17 @@ export const remove: {
|
|
|
832
809
|
* )
|
|
833
810
|
*
|
|
834
811
|
* // Check initial state
|
|
835
|
-
*
|
|
836
|
-
* console.log(initialSize) // 3
|
|
812
|
+
* yield* TxHashMap.size(sessionMap) // => 3
|
|
837
813
|
*
|
|
838
814
|
* // Clear all sessions (e.g., during maintenance)
|
|
839
815
|
* yield* TxHashMap.clear(sessionMap)
|
|
840
816
|
*
|
|
841
817
|
* // Verify cleared
|
|
842
|
-
*
|
|
843
|
-
*
|
|
844
|
-
*
|
|
845
|
-
* const isEmpty = yield* TxHashMap.isEmpty(sessionMap)
|
|
846
|
-
* console.log(isEmpty) // true
|
|
818
|
+
* yield* TxHashMap.size(sessionMap) // => 0
|
|
819
|
+
* return yield* TxHashMap.isEmpty(sessionMap)
|
|
847
820
|
* })
|
|
821
|
+
*
|
|
822
|
+
* await Effect.runPromise(program) // => true
|
|
848
823
|
* ```
|
|
849
824
|
*
|
|
850
825
|
* @category combinators
|
|
@@ -857,7 +832,7 @@ export const clear = <K, V>(self: TxHashMap<K, V>): Effect.Effect<void> => TxRef
|
|
|
857
832
|
*
|
|
858
833
|
* **Example** (Counting entries)
|
|
859
834
|
*
|
|
860
|
-
* ```ts
|
|
835
|
+
* ```ts import.meta.vitest
|
|
861
836
|
* import { Effect, TxHashMap } from "effect"
|
|
862
837
|
*
|
|
863
838
|
* const program = Effect.gen(function*() {
|
|
@@ -867,19 +842,18 @@ export const clear = <K, V>(self: TxHashMap<K, V>): Effect.Effect<void> => TxRef
|
|
|
867
842
|
* ["users", 50]
|
|
868
843
|
* )
|
|
869
844
|
*
|
|
870
|
-
*
|
|
871
|
-
* console.log(count) // 3
|
|
845
|
+
* yield* TxHashMap.size(metrics) // => 3
|
|
872
846
|
*
|
|
873
847
|
* // Add more metrics
|
|
874
848
|
* yield* TxHashMap.set(metrics, "response_time", 250)
|
|
875
|
-
*
|
|
876
|
-
* console.log(newCount) // 4
|
|
849
|
+
* yield* TxHashMap.size(metrics) // => 4
|
|
877
850
|
*
|
|
878
851
|
* // Remove a metric
|
|
879
852
|
* yield* TxHashMap.remove(metrics, "errors")
|
|
880
|
-
*
|
|
881
|
-
* console.log(finalCount) // 3
|
|
853
|
+
* return yield* TxHashMap.size(metrics)
|
|
882
854
|
* })
|
|
855
|
+
*
|
|
856
|
+
* await Effect.runPromise(program) // => 3
|
|
883
857
|
* ```
|
|
884
858
|
*
|
|
885
859
|
* @category combinators
|
|
@@ -896,28 +870,27 @@ export const size = <K, V>(self: TxHashMap<K, V>): Effect.Effect<number> =>
|
|
|
896
870
|
*
|
|
897
871
|
* **Example** (Checking for an empty map)
|
|
898
872
|
*
|
|
899
|
-
* ```ts
|
|
873
|
+
* ```ts import.meta.vitest
|
|
900
874
|
* import { Effect, TxHashMap } from "effect"
|
|
901
875
|
*
|
|
902
876
|
* const program = Effect.gen(function*() {
|
|
903
877
|
* // Start with empty map
|
|
904
878
|
* const cache = yield* TxHashMap.empty<string, any>()
|
|
905
|
-
*
|
|
906
|
-
* console.log(empty) // true
|
|
879
|
+
* yield* TxHashMap.isEmpty(cache) // => true
|
|
907
880
|
*
|
|
908
881
|
* // Add an item
|
|
909
882
|
* yield* TxHashMap.set(cache, "key1", "value1")
|
|
910
|
-
*
|
|
911
|
-
* console.log(stillEmpty) // false
|
|
883
|
+
* yield* TxHashMap.isEmpty(cache) // => false
|
|
912
884
|
*
|
|
913
885
|
* // Clear and check again
|
|
914
886
|
* yield* TxHashMap.clear(cache)
|
|
915
|
-
*
|
|
916
|
-
* console.log(emptyAgain) // true
|
|
887
|
+
* return yield* TxHashMap.isEmpty(cache)
|
|
917
888
|
* })
|
|
889
|
+
*
|
|
890
|
+
* await Effect.runPromise(program) // => true
|
|
918
891
|
* ```
|
|
919
892
|
*
|
|
920
|
-
* @category
|
|
893
|
+
* @category predicates
|
|
921
894
|
* @since 2.0.0
|
|
922
895
|
*/
|
|
923
896
|
export const isEmpty = <K, V>(self: TxHashMap<K, V>): Effect.Effect<boolean> =>
|
|
@@ -931,23 +904,23 @@ export const isEmpty = <K, V>(self: TxHashMap<K, V>): Effect.Effect<boolean> =>
|
|
|
931
904
|
*
|
|
932
905
|
* **Example** (Checking for a non-empty map)
|
|
933
906
|
*
|
|
934
|
-
* ```ts
|
|
907
|
+
* ```ts import.meta.vitest
|
|
935
908
|
* import { Effect, TxHashMap } from "effect"
|
|
936
909
|
*
|
|
937
910
|
* const program = Effect.gen(function*() {
|
|
938
911
|
* const inventory = yield* TxHashMap.make(["laptop", 5])
|
|
939
912
|
*
|
|
940
|
-
*
|
|
941
|
-
* console.log(hasItems) // true
|
|
913
|
+
* yield* TxHashMap.isNonEmpty(inventory) // => true
|
|
942
914
|
*
|
|
943
915
|
* // Clear inventory
|
|
944
916
|
* yield* TxHashMap.clear(inventory)
|
|
945
|
-
*
|
|
946
|
-
* console.log(stillHasItems) // false
|
|
917
|
+
* return yield* TxHashMap.isNonEmpty(inventory)
|
|
947
918
|
* })
|
|
919
|
+
*
|
|
920
|
+
* await Effect.runPromise(program) // => false
|
|
948
921
|
* ```
|
|
949
922
|
*
|
|
950
|
-
* @category
|
|
923
|
+
* @category predicates
|
|
951
924
|
* @since 4.0.0
|
|
952
925
|
*/
|
|
953
926
|
export const isNonEmpty = <K, V>(self: TxHashMap<K, V>): Effect.Effect<boolean> =>
|
|
@@ -963,8 +936,8 @@ export const isNonEmpty = <K, V>(self: TxHashMap<K, V>): Effect.Effect<boolean>
|
|
|
963
936
|
*
|
|
964
937
|
* **Example** (Updating existing values)
|
|
965
938
|
*
|
|
966
|
-
* ```ts
|
|
967
|
-
* import { Effect, TxHashMap } from "effect"
|
|
939
|
+
* ```ts import.meta.vitest
|
|
940
|
+
* import { Effect, Option, TxHashMap } from "effect"
|
|
968
941
|
*
|
|
969
942
|
* const program = Effect.gen(function*() {
|
|
970
943
|
* const counters = yield* TxHashMap.make(
|
|
@@ -978,10 +951,9 @@ export const isNonEmpty = <K, V>(self: TxHashMap<K, V>): Effect.Effect<boolean>
|
|
|
978
951
|
* "downloads",
|
|
979
952
|
* (count) => count + 1
|
|
980
953
|
* )
|
|
981
|
-
*
|
|
954
|
+
* oldDownloads // => Option.some(100)
|
|
982
955
|
*
|
|
983
|
-
*
|
|
984
|
-
* console.log(newDownloads) // Option.some(101)
|
|
956
|
+
* yield* TxHashMap.get(counters, "downloads") // => Option.some(101)
|
|
985
957
|
*
|
|
986
958
|
* // Try to modify non-existent key
|
|
987
959
|
* const nonExistent = yield* TxHashMap.modify(
|
|
@@ -989,11 +961,14 @@ export const isNonEmpty = <K, V>(self: TxHashMap<K, V>): Effect.Effect<boolean>
|
|
|
989
961
|
* "clicks",
|
|
990
962
|
* (count) => count + 1
|
|
991
963
|
* )
|
|
992
|
-
*
|
|
964
|
+
* nonExistent // => Option.none()
|
|
993
965
|
*
|
|
994
966
|
* // Update views counter with direct method call
|
|
995
967
|
* yield* TxHashMap.modify(counters, "views", (views) => views * 2)
|
|
968
|
+
* return yield* TxHashMap.get(counters, "views")
|
|
996
969
|
* })
|
|
970
|
+
*
|
|
971
|
+
* await Effect.runPromise(program) // => Option.some(500)
|
|
997
972
|
* ```
|
|
998
973
|
*
|
|
999
974
|
* @category combinators
|
|
@@ -1010,8 +985,8 @@ export const modify: {
|
|
|
1010
985
|
*
|
|
1011
986
|
* **Example** (Updating existing values)
|
|
1012
987
|
*
|
|
1013
|
-
* ```ts
|
|
1014
|
-
* import { Effect, TxHashMap } from "effect"
|
|
988
|
+
* ```ts import.meta.vitest
|
|
989
|
+
* import { Effect, Option, TxHashMap } from "effect"
|
|
1015
990
|
*
|
|
1016
991
|
* const program = Effect.gen(function*() {
|
|
1017
992
|
* const counters = yield* TxHashMap.make(
|
|
@@ -1025,10 +1000,9 @@ export const modify: {
|
|
|
1025
1000
|
* "downloads",
|
|
1026
1001
|
* (count) => count + 1
|
|
1027
1002
|
* )
|
|
1028
|
-
*
|
|
1003
|
+
* oldDownloads // => Option.some(100)
|
|
1029
1004
|
*
|
|
1030
|
-
*
|
|
1031
|
-
* console.log(newDownloads) // Option.some(101)
|
|
1005
|
+
* yield* TxHashMap.get(counters, "downloads") // => Option.some(101)
|
|
1032
1006
|
*
|
|
1033
1007
|
* // Try to modify non-existent key
|
|
1034
1008
|
* const nonExistent = yield* TxHashMap.modify(
|
|
@@ -1036,11 +1010,14 @@ export const modify: {
|
|
|
1036
1010
|
* "clicks",
|
|
1037
1011
|
* (count) => count + 1
|
|
1038
1012
|
* )
|
|
1039
|
-
*
|
|
1013
|
+
* nonExistent // => Option.none()
|
|
1040
1014
|
*
|
|
1041
1015
|
* // Update views counter with direct method call
|
|
1042
1016
|
* yield* TxHashMap.modify(counters, "views", (views) => views * 2)
|
|
1017
|
+
* return yield* TxHashMap.get(counters, "views")
|
|
1043
1018
|
* })
|
|
1019
|
+
*
|
|
1020
|
+
* await Effect.runPromise(program) // => Option.some(500)
|
|
1044
1021
|
* ```
|
|
1045
1022
|
*
|
|
1046
1023
|
* @category combinators
|
|
@@ -1057,8 +1034,8 @@ export const modify: {
|
|
|
1057
1034
|
*
|
|
1058
1035
|
* **Example** (Updating existing values)
|
|
1059
1036
|
*
|
|
1060
|
-
* ```ts
|
|
1061
|
-
* import { Effect, TxHashMap } from "effect"
|
|
1037
|
+
* ```ts import.meta.vitest
|
|
1038
|
+
* import { Effect, Option, TxHashMap } from "effect"
|
|
1062
1039
|
*
|
|
1063
1040
|
* const program = Effect.gen(function*() {
|
|
1064
1041
|
* const counters = yield* TxHashMap.make(
|
|
@@ -1072,10 +1049,9 @@ export const modify: {
|
|
|
1072
1049
|
* "downloads",
|
|
1073
1050
|
* (count) => count + 1
|
|
1074
1051
|
* )
|
|
1075
|
-
*
|
|
1052
|
+
* oldDownloads // => Option.some(100)
|
|
1076
1053
|
*
|
|
1077
|
-
*
|
|
1078
|
-
* console.log(newDownloads) // Option.some(101)
|
|
1054
|
+
* yield* TxHashMap.get(counters, "downloads") // => Option.some(101)
|
|
1079
1055
|
*
|
|
1080
1056
|
* // Try to modify non-existent key
|
|
1081
1057
|
* const nonExistent = yield* TxHashMap.modify(
|
|
@@ -1083,11 +1059,14 @@ export const modify: {
|
|
|
1083
1059
|
* "clicks",
|
|
1084
1060
|
* (count) => count + 1
|
|
1085
1061
|
* )
|
|
1086
|
-
*
|
|
1062
|
+
* nonExistent // => Option.none()
|
|
1087
1063
|
*
|
|
1088
1064
|
* // Update views counter with direct method call
|
|
1089
1065
|
* yield* TxHashMap.modify(counters, "views", (views) => views * 2)
|
|
1066
|
+
* return yield* TxHashMap.get(counters, "views")
|
|
1090
1067
|
* })
|
|
1068
|
+
*
|
|
1069
|
+
* await Effect.runPromise(program) // => Option.some(500)
|
|
1091
1070
|
* ```
|
|
1092
1071
|
*
|
|
1093
1072
|
* @category combinators
|
|
@@ -1124,42 +1103,34 @@ export const modify: {
|
|
|
1124
1103
|
*
|
|
1125
1104
|
* **Example** (Updating values with Option)
|
|
1126
1105
|
*
|
|
1127
|
-
* ```ts
|
|
1128
|
-
* import { Effect, TxHashMap } from "effect"
|
|
1106
|
+
* ```ts import.meta.vitest
|
|
1107
|
+
* import { Effect, Option, TxHashMap } from "effect"
|
|
1129
1108
|
*
|
|
1130
1109
|
* const program = Effect.gen(function*() {
|
|
1131
1110
|
* const storage = yield* TxHashMap.make<string, string | number>([
|
|
1132
1111
|
* "file1.txt",
|
|
1133
1112
|
* "content1"
|
|
1134
1113
|
* ], ["access_count", 0])
|
|
1114
|
+
* const increment = Option.map((value: string | number) => typeof value === "number" ? value + 1 : value)
|
|
1135
1115
|
*
|
|
1136
1116
|
* // Increment existing counter
|
|
1137
|
-
* yield* TxHashMap.modifyAt(storage, "access_count",
|
|
1138
|
-
*
|
|
1139
|
-
* ? { ...current, value: current.value + 1 }
|
|
1140
|
-
* : current
|
|
1141
|
-
* )
|
|
1142
|
-
* const count1 = yield* TxHashMap.get(storage, "access_count")
|
|
1143
|
-
* console.log(count1) // Option.some(1)
|
|
1117
|
+
* yield* TxHashMap.modifyAt(storage, "access_count", increment)
|
|
1118
|
+
* yield* TxHashMap.get(storage, "access_count") // => Option.some(1)
|
|
1144
1119
|
*
|
|
1145
1120
|
* // Increment existing counter again
|
|
1146
|
-
* yield* TxHashMap.modifyAt(storage, "access_count",
|
|
1147
|
-
*
|
|
1148
|
-
* ? { ...current, value: current.value + 1 }
|
|
1149
|
-
* : current
|
|
1150
|
-
* )
|
|
1151
|
-
* const count2 = yield* TxHashMap.get(storage, "access_count")
|
|
1152
|
-
* console.log(count2) // Option.some(2)
|
|
1121
|
+
* yield* TxHashMap.modifyAt(storage, "access_count", increment)
|
|
1122
|
+
* yield* TxHashMap.get(storage, "access_count") // => Option.some(2)
|
|
1153
1123
|
*
|
|
1154
1124
|
* // Update an existing string entry
|
|
1155
|
-
* yield* TxHashMap.modifyAt(
|
|
1156
|
-
*
|
|
1157
|
-
*
|
|
1158
|
-
*
|
|
1125
|
+
* yield* TxHashMap.modifyAt(
|
|
1126
|
+
* storage,
|
|
1127
|
+
* "file1.txt",
|
|
1128
|
+
* Option.map((value) => typeof value === "string" ? `${value}.bak` : value)
|
|
1159
1129
|
* )
|
|
1160
|
-
*
|
|
1161
|
-
* console.log(backup) // Option.some("content1.bak")
|
|
1130
|
+
* return yield* TxHashMap.get(storage, "file1.txt")
|
|
1162
1131
|
* })
|
|
1132
|
+
*
|
|
1133
|
+
* await Effect.runPromise(program) // => Option.some("content1.bak")
|
|
1163
1134
|
* ```
|
|
1164
1135
|
*
|
|
1165
1136
|
* @category combinators
|
|
@@ -1177,42 +1148,34 @@ export const modifyAt: {
|
|
|
1177
1148
|
*
|
|
1178
1149
|
* **Example** (Updating values with Option)
|
|
1179
1150
|
*
|
|
1180
|
-
* ```ts
|
|
1181
|
-
* import { Effect, TxHashMap } from "effect"
|
|
1151
|
+
* ```ts import.meta.vitest
|
|
1152
|
+
* import { Effect, Option, TxHashMap } from "effect"
|
|
1182
1153
|
*
|
|
1183
1154
|
* const program = Effect.gen(function*() {
|
|
1184
1155
|
* const storage = yield* TxHashMap.make<string, string | number>([
|
|
1185
1156
|
* "file1.txt",
|
|
1186
1157
|
* "content1"
|
|
1187
1158
|
* ], ["access_count", 0])
|
|
1159
|
+
* const increment = Option.map((value: string | number) => typeof value === "number" ? value + 1 : value)
|
|
1188
1160
|
*
|
|
1189
1161
|
* // Increment existing counter
|
|
1190
|
-
* yield* TxHashMap.modifyAt(storage, "access_count",
|
|
1191
|
-
*
|
|
1192
|
-
* ? { ...current, value: current.value + 1 }
|
|
1193
|
-
* : current
|
|
1194
|
-
* )
|
|
1195
|
-
* const count1 = yield* TxHashMap.get(storage, "access_count")
|
|
1196
|
-
* console.log(count1) // Option.some(1)
|
|
1162
|
+
* yield* TxHashMap.modifyAt(storage, "access_count", increment)
|
|
1163
|
+
* yield* TxHashMap.get(storage, "access_count") // => Option.some(1)
|
|
1197
1164
|
*
|
|
1198
1165
|
* // Increment existing counter again
|
|
1199
|
-
* yield* TxHashMap.modifyAt(storage, "access_count",
|
|
1200
|
-
*
|
|
1201
|
-
* ? { ...current, value: current.value + 1 }
|
|
1202
|
-
* : current
|
|
1203
|
-
* )
|
|
1204
|
-
* const count2 = yield* TxHashMap.get(storage, "access_count")
|
|
1205
|
-
* console.log(count2) // Option.some(2)
|
|
1166
|
+
* yield* TxHashMap.modifyAt(storage, "access_count", increment)
|
|
1167
|
+
* yield* TxHashMap.get(storage, "access_count") // => Option.some(2)
|
|
1206
1168
|
*
|
|
1207
1169
|
* // Update an existing string entry
|
|
1208
|
-
* yield* TxHashMap.modifyAt(
|
|
1209
|
-
*
|
|
1210
|
-
*
|
|
1211
|
-
*
|
|
1170
|
+
* yield* TxHashMap.modifyAt(
|
|
1171
|
+
* storage,
|
|
1172
|
+
* "file1.txt",
|
|
1173
|
+
* Option.map((value) => typeof value === "string" ? `${value}.bak` : value)
|
|
1212
1174
|
* )
|
|
1213
|
-
*
|
|
1214
|
-
* console.log(backup) // Option.some("content1.bak")
|
|
1175
|
+
* return yield* TxHashMap.get(storage, "file1.txt")
|
|
1215
1176
|
* })
|
|
1177
|
+
*
|
|
1178
|
+
* await Effect.runPromise(program) // => Option.some("content1.bak")
|
|
1216
1179
|
* ```
|
|
1217
1180
|
*
|
|
1218
1181
|
* @category combinators
|
|
@@ -1230,42 +1193,34 @@ export const modifyAt: {
|
|
|
1230
1193
|
*
|
|
1231
1194
|
* **Example** (Updating values with Option)
|
|
1232
1195
|
*
|
|
1233
|
-
* ```ts
|
|
1234
|
-
* import { Effect, TxHashMap } from "effect"
|
|
1196
|
+
* ```ts import.meta.vitest
|
|
1197
|
+
* import { Effect, Option, TxHashMap } from "effect"
|
|
1235
1198
|
*
|
|
1236
1199
|
* const program = Effect.gen(function*() {
|
|
1237
1200
|
* const storage = yield* TxHashMap.make<string, string | number>([
|
|
1238
1201
|
* "file1.txt",
|
|
1239
1202
|
* "content1"
|
|
1240
1203
|
* ], ["access_count", 0])
|
|
1204
|
+
* const increment = Option.map((value: string | number) => typeof value === "number" ? value + 1 : value)
|
|
1241
1205
|
*
|
|
1242
1206
|
* // Increment existing counter
|
|
1243
|
-
* yield* TxHashMap.modifyAt(storage, "access_count",
|
|
1244
|
-
*
|
|
1245
|
-
* ? { ...current, value: current.value + 1 }
|
|
1246
|
-
* : current
|
|
1247
|
-
* )
|
|
1248
|
-
* const count1 = yield* TxHashMap.get(storage, "access_count")
|
|
1249
|
-
* console.log(count1) // Option.some(1)
|
|
1207
|
+
* yield* TxHashMap.modifyAt(storage, "access_count", increment)
|
|
1208
|
+
* yield* TxHashMap.get(storage, "access_count") // => Option.some(1)
|
|
1250
1209
|
*
|
|
1251
1210
|
* // Increment existing counter again
|
|
1252
|
-
* yield* TxHashMap.modifyAt(storage, "access_count",
|
|
1253
|
-
*
|
|
1254
|
-
* ? { ...current, value: current.value + 1 }
|
|
1255
|
-
* : current
|
|
1256
|
-
* )
|
|
1257
|
-
* const count2 = yield* TxHashMap.get(storage, "access_count")
|
|
1258
|
-
* console.log(count2) // Option.some(2)
|
|
1211
|
+
* yield* TxHashMap.modifyAt(storage, "access_count", increment)
|
|
1212
|
+
* yield* TxHashMap.get(storage, "access_count") // => Option.some(2)
|
|
1259
1213
|
*
|
|
1260
1214
|
* // Update an existing string entry
|
|
1261
|
-
* yield* TxHashMap.modifyAt(
|
|
1262
|
-
*
|
|
1263
|
-
*
|
|
1264
|
-
*
|
|
1215
|
+
* yield* TxHashMap.modifyAt(
|
|
1216
|
+
* storage,
|
|
1217
|
+
* "file1.txt",
|
|
1218
|
+
* Option.map((value) => typeof value === "string" ? `${value}.bak` : value)
|
|
1265
1219
|
* )
|
|
1266
|
-
*
|
|
1267
|
-
* console.log(backup) // Option.some("content1.bak")
|
|
1220
|
+
* return yield* TxHashMap.get(storage, "file1.txt")
|
|
1268
1221
|
* })
|
|
1222
|
+
*
|
|
1223
|
+
* await Effect.runPromise(program) // => Option.some("content1.bak")
|
|
1269
1224
|
* ```
|
|
1270
1225
|
*
|
|
1271
1226
|
* @category combinators
|
|
@@ -1301,7 +1256,7 @@ export const modifyAt: {
|
|
|
1301
1256
|
*
|
|
1302
1257
|
* **Example** (Reading keys)
|
|
1303
1258
|
*
|
|
1304
|
-
* ```ts
|
|
1259
|
+
* ```ts import.meta.vitest
|
|
1305
1260
|
* import { Effect, Option, TxHashMap } from "effect"
|
|
1306
1261
|
*
|
|
1307
1262
|
* const program = Effect.gen(function*() {
|
|
@@ -1311,17 +1266,21 @@ export const modifyAt: {
|
|
|
1311
1266
|
* ["charlie", "moderator"]
|
|
1312
1267
|
* )
|
|
1313
1268
|
*
|
|
1314
|
-
* const usernames = yield* TxHashMap.keys(userRoles)
|
|
1315
|
-
*
|
|
1269
|
+
* const usernames = (yield* TxHashMap.keys(userRoles)).sort()
|
|
1270
|
+
* usernames // => ["alice", "bob", "charlie"]
|
|
1316
1271
|
*
|
|
1317
1272
|
* // Useful for iteration
|
|
1273
|
+
* const assignments: Array<string> = []
|
|
1318
1274
|
* for (const username of usernames) {
|
|
1319
1275
|
* const role = yield* TxHashMap.get(userRoles, username)
|
|
1320
1276
|
* if (role._tag === "Some") {
|
|
1321
|
-
*
|
|
1277
|
+
* assignments.push(`${username}: ${role.value}`)
|
|
1322
1278
|
* }
|
|
1323
1279
|
* }
|
|
1280
|
+
* return assignments
|
|
1324
1281
|
* })
|
|
1282
|
+
*
|
|
1283
|
+
* await Effect.runPromise(program) // => ["alice: admin", "bob: user", "charlie: moderator"]
|
|
1325
1284
|
* ```
|
|
1326
1285
|
*
|
|
1327
1286
|
* @category combinators
|
|
@@ -1338,7 +1297,7 @@ export const keys = <K, V>(self: TxHashMap<K, V>): Effect.Effect<Array<K>> =>
|
|
|
1338
1297
|
*
|
|
1339
1298
|
* **Example** (Reading values)
|
|
1340
1299
|
*
|
|
1341
|
-
* ```ts
|
|
1300
|
+
* ```ts import.meta.vitest
|
|
1342
1301
|
* import { Effect, TxHashMap } from "effect"
|
|
1343
1302
|
*
|
|
1344
1303
|
* const program = Effect.gen(function*() {
|
|
@@ -1348,18 +1307,19 @@ export const keys = <K, V>(self: TxHashMap<K, V>): Effect.Effect<Array<K>> =>
|
|
|
1348
1307
|
* ["charlie", 92]
|
|
1349
1308
|
* )
|
|
1350
1309
|
*
|
|
1351
|
-
* const allScores = yield* TxHashMap.values(scores)
|
|
1352
|
-
*
|
|
1310
|
+
* const allScores = (yield* TxHashMap.values(scores)).sort((a, b) => a - b)
|
|
1311
|
+
* allScores // => [87, 92, 95]
|
|
1353
1312
|
*
|
|
1354
1313
|
* // Calculate average
|
|
1355
1314
|
* const average = allScores.reduce((sum, score) => sum + score, 0) /
|
|
1356
1315
|
* allScores.length
|
|
1357
|
-
*
|
|
1316
|
+
* average.toFixed(2) // => "91.33"
|
|
1358
1317
|
*
|
|
1359
1318
|
* // Find maximum
|
|
1360
|
-
*
|
|
1361
|
-
* console.log(maxScore) // 95
|
|
1319
|
+
* return Math.max(...allScores)
|
|
1362
1320
|
* })
|
|
1321
|
+
*
|
|
1322
|
+
* await Effect.runPromise(program) // => 95
|
|
1363
1323
|
* ```
|
|
1364
1324
|
*
|
|
1365
1325
|
* @category combinators
|
|
@@ -1376,7 +1336,7 @@ export const values = <K, V>(self: TxHashMap<K, V>): Effect.Effect<Array<V>> =>
|
|
|
1376
1336
|
*
|
|
1377
1337
|
* **Example** (Reading entries)
|
|
1378
1338
|
*
|
|
1379
|
-
* ```ts
|
|
1339
|
+
* ```ts import.meta.vitest
|
|
1380
1340
|
* import { Effect, TxHashMap } from "effect"
|
|
1381
1341
|
*
|
|
1382
1342
|
* const program = Effect.gen(function*() {
|
|
@@ -1386,19 +1346,10 @@ export const values = <K, V>(self: TxHashMap<K, V>): Effect.Effect<Array<V>> =>
|
|
|
1386
1346
|
* ["ssl", "false"]
|
|
1387
1347
|
* )
|
|
1388
1348
|
*
|
|
1389
|
-
*
|
|
1390
|
-
* const sortedEntries = allEntries.toSorted(([left], [right]) => left.localeCompare(right))
|
|
1391
|
-
* console.log(sortedEntries)
|
|
1392
|
-
* // [["host", "localhost"], ["port", "3000"], ["ssl", "false"]]
|
|
1393
|
-
*
|
|
1394
|
-
* // Process configuration entries
|
|
1395
|
-
* for (const [key, value] of sortedEntries) {
|
|
1396
|
-
* console.log(`${key}=${value}`)
|
|
1397
|
-
* }
|
|
1398
|
-
* // host=localhost
|
|
1399
|
-
* // port=3000
|
|
1400
|
-
* // ssl=false
|
|
1349
|
+
* return (yield* TxHashMap.entries(config)).toSorted(([left], [right]) => left.localeCompare(right))
|
|
1401
1350
|
* })
|
|
1351
|
+
*
|
|
1352
|
+
* await Effect.runPromise(program) // => [["host", "localhost"], ["port", "3000"], ["ssl", "false"]]
|
|
1402
1353
|
* ```
|
|
1403
1354
|
*
|
|
1404
1355
|
* @category combinators
|
|
@@ -1417,8 +1368,8 @@ export const entries = <K, V>(
|
|
|
1417
1368
|
*
|
|
1418
1369
|
* **Example** (Taking immutable snapshots)
|
|
1419
1370
|
*
|
|
1420
|
-
* ```ts
|
|
1421
|
-
* import { Effect, HashMap, TxHashMap } from "effect"
|
|
1371
|
+
* ```ts import.meta.vitest
|
|
1372
|
+
* import { Effect, HashMap, Option, TxHashMap } from "effect"
|
|
1422
1373
|
*
|
|
1423
1374
|
* const program = Effect.gen(function*() {
|
|
1424
1375
|
* const liveData = yield* TxHashMap.make(
|
|
@@ -1435,13 +1386,14 @@ export const entries = <K, V>(
|
|
|
1435
1386
|
* yield* TxHashMap.set(liveData, "wind_speed", 5.3)
|
|
1436
1387
|
*
|
|
1437
1388
|
* // Snapshot remains unchanged
|
|
1438
|
-
*
|
|
1439
|
-
*
|
|
1389
|
+
* HashMap.size(snapshot) // => 3
|
|
1390
|
+
* HashMap.get(snapshot, "temperature") // => Option.some(22.5)
|
|
1440
1391
|
*
|
|
1441
1392
|
* // Can use regular HashMap operations on snapshot
|
|
1442
|
-
*
|
|
1443
|
-
* const humidityReading = HashMap.get(snapshot, "humidity")
|
|
1393
|
+
* return HashMap.get(snapshot, "humidity")
|
|
1444
1394
|
* })
|
|
1395
|
+
*
|
|
1396
|
+
* await Effect.runPromise(program) // => Option.some(45.2)
|
|
1445
1397
|
* ```
|
|
1446
1398
|
*
|
|
1447
1399
|
* @category combinators
|
|
@@ -1462,8 +1414,8 @@ export const snapshot = <K, V>(
|
|
|
1462
1414
|
*
|
|
1463
1415
|
* **Example** (Merging HashMaps)
|
|
1464
1416
|
*
|
|
1465
|
-
* ```ts
|
|
1466
|
-
* import { Effect, HashMap, TxHashMap } from "effect"
|
|
1417
|
+
* ```ts import.meta.vitest
|
|
1418
|
+
* import { Effect, HashMap, Option, TxHashMap } from "effect"
|
|
1467
1419
|
*
|
|
1468
1420
|
* const program = Effect.gen(function*() {
|
|
1469
1421
|
* // Create initial user preferences
|
|
@@ -1484,18 +1436,13 @@ export const snapshot = <K, V>(
|
|
|
1484
1436
|
* yield* TxHashMap.union(userPrefs, newSettings)
|
|
1485
1437
|
*
|
|
1486
1438
|
* // Check the merged result
|
|
1487
|
-
*
|
|
1488
|
-
*
|
|
1489
|
-
*
|
|
1490
|
-
*
|
|
1491
|
-
* console.log(language) // Option.some("en") - preserved
|
|
1492
|
-
*
|
|
1493
|
-
* const timezone = yield* TxHashMap.get(userPrefs, "timezone")
|
|
1494
|
-
* console.log(timezone) // Option.some("UTC") - newly added
|
|
1495
|
-
*
|
|
1496
|
-
* const size = yield* TxHashMap.size(userPrefs)
|
|
1497
|
-
* console.log(size) // 5 total settings
|
|
1439
|
+
* yield* TxHashMap.get(userPrefs, "theme") // => Option.some("dark")
|
|
1440
|
+
* yield* TxHashMap.get(userPrefs, "language") // => Option.some("en")
|
|
1441
|
+
* yield* TxHashMap.get(userPrefs, "timezone") // => Option.some("UTC")
|
|
1442
|
+
* return yield* TxHashMap.size(userPrefs)
|
|
1498
1443
|
* })
|
|
1444
|
+
*
|
|
1445
|
+
* await Effect.runPromise(program) // => 5
|
|
1499
1446
|
* ```
|
|
1500
1447
|
*
|
|
1501
1448
|
* @category combinators
|
|
@@ -1513,8 +1460,8 @@ export const union: {
|
|
|
1513
1460
|
*
|
|
1514
1461
|
* **Example** (Merging HashMaps)
|
|
1515
1462
|
*
|
|
1516
|
-
* ```ts
|
|
1517
|
-
* import { Effect, HashMap, TxHashMap } from "effect"
|
|
1463
|
+
* ```ts import.meta.vitest
|
|
1464
|
+
* import { Effect, HashMap, Option, TxHashMap } from "effect"
|
|
1518
1465
|
*
|
|
1519
1466
|
* const program = Effect.gen(function*() {
|
|
1520
1467
|
* // Create initial user preferences
|
|
@@ -1535,18 +1482,13 @@ export const union: {
|
|
|
1535
1482
|
* yield* TxHashMap.union(userPrefs, newSettings)
|
|
1536
1483
|
*
|
|
1537
1484
|
* // Check the merged result
|
|
1538
|
-
*
|
|
1539
|
-
*
|
|
1540
|
-
*
|
|
1541
|
-
*
|
|
1542
|
-
* console.log(language) // Option.some("en") - preserved
|
|
1543
|
-
*
|
|
1544
|
-
* const timezone = yield* TxHashMap.get(userPrefs, "timezone")
|
|
1545
|
-
* console.log(timezone) // Option.some("UTC") - newly added
|
|
1546
|
-
*
|
|
1547
|
-
* const size = yield* TxHashMap.size(userPrefs)
|
|
1548
|
-
* console.log(size) // 5 total settings
|
|
1485
|
+
* yield* TxHashMap.get(userPrefs, "theme") // => Option.some("dark")
|
|
1486
|
+
* yield* TxHashMap.get(userPrefs, "language") // => Option.some("en")
|
|
1487
|
+
* yield* TxHashMap.get(userPrefs, "timezone") // => Option.some("UTC")
|
|
1488
|
+
* return yield* TxHashMap.size(userPrefs)
|
|
1549
1489
|
* })
|
|
1490
|
+
*
|
|
1491
|
+
* await Effect.runPromise(program) // => 5
|
|
1550
1492
|
* ```
|
|
1551
1493
|
*
|
|
1552
1494
|
* @category combinators
|
|
@@ -1564,8 +1506,8 @@ export const union: {
|
|
|
1564
1506
|
*
|
|
1565
1507
|
* **Example** (Merging HashMaps)
|
|
1566
1508
|
*
|
|
1567
|
-
* ```ts
|
|
1568
|
-
* import { Effect, HashMap, TxHashMap } from "effect"
|
|
1509
|
+
* ```ts import.meta.vitest
|
|
1510
|
+
* import { Effect, HashMap, Option, TxHashMap } from "effect"
|
|
1569
1511
|
*
|
|
1570
1512
|
* const program = Effect.gen(function*() {
|
|
1571
1513
|
* // Create initial user preferences
|
|
@@ -1586,18 +1528,13 @@ export const union: {
|
|
|
1586
1528
|
* yield* TxHashMap.union(userPrefs, newSettings)
|
|
1587
1529
|
*
|
|
1588
1530
|
* // Check the merged result
|
|
1589
|
-
*
|
|
1590
|
-
*
|
|
1591
|
-
*
|
|
1592
|
-
*
|
|
1593
|
-
* console.log(language) // Option.some("en") - preserved
|
|
1594
|
-
*
|
|
1595
|
-
* const timezone = yield* TxHashMap.get(userPrefs, "timezone")
|
|
1596
|
-
* console.log(timezone) // Option.some("UTC") - newly added
|
|
1597
|
-
*
|
|
1598
|
-
* const size = yield* TxHashMap.size(userPrefs)
|
|
1599
|
-
* console.log(size) // 5 total settings
|
|
1531
|
+
* yield* TxHashMap.get(userPrefs, "theme") // => Option.some("dark")
|
|
1532
|
+
* yield* TxHashMap.get(userPrefs, "language") // => Option.some("en")
|
|
1533
|
+
* yield* TxHashMap.get(userPrefs, "timezone") // => Option.some("UTC")
|
|
1534
|
+
* return yield* TxHashMap.size(userPrefs)
|
|
1600
1535
|
* })
|
|
1536
|
+
*
|
|
1537
|
+
* await Effect.runPromise(program) // => 5
|
|
1601
1538
|
* ```
|
|
1602
1539
|
*
|
|
1603
1540
|
* @category combinators
|
|
@@ -1622,8 +1559,8 @@ export const union: {
|
|
|
1622
1559
|
*
|
|
1623
1560
|
* **Example** (Removing multiple keys)
|
|
1624
1561
|
*
|
|
1625
|
-
* ```ts
|
|
1626
|
-
* import { Effect, TxHashMap } from "effect"
|
|
1562
|
+
* ```ts import.meta.vitest
|
|
1563
|
+
* import { Effect, Option, TxHashMap } from "effect"
|
|
1627
1564
|
*
|
|
1628
1565
|
* const program = Effect.gen(function*() {
|
|
1629
1566
|
* // Create a cache with temporary data
|
|
@@ -1635,23 +1572,24 @@ export const union: {
|
|
|
1635
1572
|
* ["temp_data_2", { value: "also_temporary" }]
|
|
1636
1573
|
* )
|
|
1637
1574
|
*
|
|
1638
|
-
*
|
|
1575
|
+
* yield* TxHashMap.size(cache) // => 5
|
|
1639
1576
|
*
|
|
1640
1577
|
* // Remove expired sessions and temporary data
|
|
1641
1578
|
* const keysToRemove = ["session_1", "session_2", "temp_data_1", "temp_data_2"]
|
|
1642
1579
|
* yield* TxHashMap.removeMany(cache, keysToRemove)
|
|
1643
1580
|
*
|
|
1644
|
-
*
|
|
1581
|
+
* yield* TxHashMap.size(cache) // => 1
|
|
1645
1582
|
*
|
|
1646
1583
|
* // Verify only the valid session remains
|
|
1647
|
-
*
|
|
1648
|
-
* console.log(remainingSession) // Option.some({ user: "charlie", expires: "2024-12-31" })
|
|
1584
|
+
* yield* TxHashMap.get(cache, "session_3") // => Option.some({ user: "charlie", expires: "2024-12-31" })
|
|
1649
1585
|
*
|
|
1650
1586
|
* // Can also remove from Set, Array, or any iterable
|
|
1651
1587
|
* const moreKeysToRemove = new Set(["session_3"])
|
|
1652
1588
|
* yield* TxHashMap.removeMany(cache, moreKeysToRemove)
|
|
1653
|
-
*
|
|
1589
|
+
* return yield* TxHashMap.isEmpty(cache)
|
|
1654
1590
|
* })
|
|
1591
|
+
*
|
|
1592
|
+
* await Effect.runPromise(program) // => true
|
|
1655
1593
|
* ```
|
|
1656
1594
|
*
|
|
1657
1595
|
* @category combinators
|
|
@@ -1668,8 +1606,8 @@ export const removeMany: {
|
|
|
1668
1606
|
*
|
|
1669
1607
|
* **Example** (Removing multiple keys)
|
|
1670
1608
|
*
|
|
1671
|
-
* ```ts
|
|
1672
|
-
* import { Effect, TxHashMap } from "effect"
|
|
1609
|
+
* ```ts import.meta.vitest
|
|
1610
|
+
* import { Effect, Option, TxHashMap } from "effect"
|
|
1673
1611
|
*
|
|
1674
1612
|
* const program = Effect.gen(function*() {
|
|
1675
1613
|
* // Create a cache with temporary data
|
|
@@ -1681,23 +1619,24 @@ export const removeMany: {
|
|
|
1681
1619
|
* ["temp_data_2", { value: "also_temporary" }]
|
|
1682
1620
|
* )
|
|
1683
1621
|
*
|
|
1684
|
-
*
|
|
1622
|
+
* yield* TxHashMap.size(cache) // => 5
|
|
1685
1623
|
*
|
|
1686
1624
|
* // Remove expired sessions and temporary data
|
|
1687
1625
|
* const keysToRemove = ["session_1", "session_2", "temp_data_1", "temp_data_2"]
|
|
1688
1626
|
* yield* TxHashMap.removeMany(cache, keysToRemove)
|
|
1689
1627
|
*
|
|
1690
|
-
*
|
|
1628
|
+
* yield* TxHashMap.size(cache) // => 1
|
|
1691
1629
|
*
|
|
1692
1630
|
* // Verify only the valid session remains
|
|
1693
|
-
*
|
|
1694
|
-
* console.log(remainingSession) // Option.some({ user: "charlie", expires: "2024-12-31" })
|
|
1631
|
+
* yield* TxHashMap.get(cache, "session_3") // => Option.some({ user: "charlie", expires: "2024-12-31" })
|
|
1695
1632
|
*
|
|
1696
1633
|
* // Can also remove from Set, Array, or any iterable
|
|
1697
1634
|
* const moreKeysToRemove = new Set(["session_3"])
|
|
1698
1635
|
* yield* TxHashMap.removeMany(cache, moreKeysToRemove)
|
|
1699
|
-
*
|
|
1636
|
+
* return yield* TxHashMap.isEmpty(cache)
|
|
1700
1637
|
* })
|
|
1638
|
+
*
|
|
1639
|
+
* await Effect.runPromise(program) // => true
|
|
1701
1640
|
* ```
|
|
1702
1641
|
*
|
|
1703
1642
|
* @category combinators
|
|
@@ -1714,8 +1653,8 @@ export const removeMany: {
|
|
|
1714
1653
|
*
|
|
1715
1654
|
* **Example** (Removing multiple keys)
|
|
1716
1655
|
*
|
|
1717
|
-
* ```ts
|
|
1718
|
-
* import { Effect, TxHashMap } from "effect"
|
|
1656
|
+
* ```ts import.meta.vitest
|
|
1657
|
+
* import { Effect, Option, TxHashMap } from "effect"
|
|
1719
1658
|
*
|
|
1720
1659
|
* const program = Effect.gen(function*() {
|
|
1721
1660
|
* // Create a cache with temporary data
|
|
@@ -1727,23 +1666,24 @@ export const removeMany: {
|
|
|
1727
1666
|
* ["temp_data_2", { value: "also_temporary" }]
|
|
1728
1667
|
* )
|
|
1729
1668
|
*
|
|
1730
|
-
*
|
|
1669
|
+
* yield* TxHashMap.size(cache) // => 5
|
|
1731
1670
|
*
|
|
1732
1671
|
* // Remove expired sessions and temporary data
|
|
1733
1672
|
* const keysToRemove = ["session_1", "session_2", "temp_data_1", "temp_data_2"]
|
|
1734
1673
|
* yield* TxHashMap.removeMany(cache, keysToRemove)
|
|
1735
1674
|
*
|
|
1736
|
-
*
|
|
1675
|
+
* yield* TxHashMap.size(cache) // => 1
|
|
1737
1676
|
*
|
|
1738
1677
|
* // Verify only the valid session remains
|
|
1739
|
-
*
|
|
1740
|
-
* console.log(remainingSession) // Option.some({ user: "charlie", expires: "2024-12-31" })
|
|
1678
|
+
* yield* TxHashMap.get(cache, "session_3") // => Option.some({ user: "charlie", expires: "2024-12-31" })
|
|
1741
1679
|
*
|
|
1742
1680
|
* // Can also remove from Set, Array, or any iterable
|
|
1743
1681
|
* const moreKeysToRemove = new Set(["session_3"])
|
|
1744
1682
|
* yield* TxHashMap.removeMany(cache, moreKeysToRemove)
|
|
1745
|
-
*
|
|
1683
|
+
* return yield* TxHashMap.isEmpty(cache)
|
|
1746
1684
|
* })
|
|
1685
|
+
*
|
|
1686
|
+
* await Effect.runPromise(program) // => true
|
|
1747
1687
|
* ```
|
|
1748
1688
|
*
|
|
1749
1689
|
* @category combinators
|
|
@@ -1766,8 +1706,8 @@ export const removeMany: {
|
|
|
1766
1706
|
*
|
|
1767
1707
|
* **Example** (Setting multiple entries)
|
|
1768
1708
|
*
|
|
1769
|
-
* ```ts
|
|
1770
|
-
* import { Effect, TxHashMap } from "effect"
|
|
1709
|
+
* ```ts import.meta.vitest
|
|
1710
|
+
* import { Effect, Option, TxHashMap } from "effect"
|
|
1771
1711
|
*
|
|
1772
1712
|
* const program = Effect.gen(function*() {
|
|
1773
1713
|
* // Create an empty product catalog
|
|
@@ -1788,7 +1728,7 @@ export const removeMany: {
|
|
|
1788
1728
|
*
|
|
1789
1729
|
* yield* TxHashMap.setMany(catalog, initialProducts)
|
|
1790
1730
|
*
|
|
1791
|
-
*
|
|
1731
|
+
* yield* TxHashMap.size(catalog) // => 4
|
|
1792
1732
|
*
|
|
1793
1733
|
* // Update prices with a new batch
|
|
1794
1734
|
* const priceUpdates: Array<
|
|
@@ -1801,16 +1741,18 @@ export const removeMany: {
|
|
|
1801
1741
|
*
|
|
1802
1742
|
* yield* TxHashMap.setMany(catalog, priceUpdates)
|
|
1803
1743
|
*
|
|
1804
|
-
*
|
|
1744
|
+
* yield* TxHashMap.size(catalog) // => 5
|
|
1805
1745
|
*
|
|
1806
1746
|
* // Verify the updates
|
|
1807
|
-
*
|
|
1808
|
-
* console.log(laptop) // Option.some({ price: 899, stock: 5 })
|
|
1747
|
+
* yield* TxHashMap.get(catalog, "laptop") // => Option.some({ price: 899, stock: 5 })
|
|
1809
1748
|
*
|
|
1810
1749
|
* // Can also use Map, Set of tuples, or any iterable of entries
|
|
1811
1750
|
* const jsMap = new Map([["tablet", { price: 399, stock: 3 }]])
|
|
1812
1751
|
* yield* TxHashMap.setMany(catalog, jsMap)
|
|
1752
|
+
* return yield* TxHashMap.get(catalog, "tablet")
|
|
1813
1753
|
* })
|
|
1754
|
+
*
|
|
1755
|
+
* await Effect.runPromise(program) // => Option.some({ price: 399, stock: 3 })
|
|
1814
1756
|
* ```
|
|
1815
1757
|
*
|
|
1816
1758
|
* @category combinators
|
|
@@ -1827,8 +1769,8 @@ export const setMany: {
|
|
|
1827
1769
|
*
|
|
1828
1770
|
* **Example** (Setting multiple entries)
|
|
1829
1771
|
*
|
|
1830
|
-
* ```ts
|
|
1831
|
-
* import { Effect, TxHashMap } from "effect"
|
|
1772
|
+
* ```ts import.meta.vitest
|
|
1773
|
+
* import { Effect, Option, TxHashMap } from "effect"
|
|
1832
1774
|
*
|
|
1833
1775
|
* const program = Effect.gen(function*() {
|
|
1834
1776
|
* // Create an empty product catalog
|
|
@@ -1849,7 +1791,7 @@ export const setMany: {
|
|
|
1849
1791
|
*
|
|
1850
1792
|
* yield* TxHashMap.setMany(catalog, initialProducts)
|
|
1851
1793
|
*
|
|
1852
|
-
*
|
|
1794
|
+
* yield* TxHashMap.size(catalog) // => 4
|
|
1853
1795
|
*
|
|
1854
1796
|
* // Update prices with a new batch
|
|
1855
1797
|
* const priceUpdates: Array<
|
|
@@ -1862,16 +1804,18 @@ export const setMany: {
|
|
|
1862
1804
|
*
|
|
1863
1805
|
* yield* TxHashMap.setMany(catalog, priceUpdates)
|
|
1864
1806
|
*
|
|
1865
|
-
*
|
|
1807
|
+
* yield* TxHashMap.size(catalog) // => 5
|
|
1866
1808
|
*
|
|
1867
1809
|
* // Verify the updates
|
|
1868
|
-
*
|
|
1869
|
-
* console.log(laptop) // Option.some({ price: 899, stock: 5 })
|
|
1810
|
+
* yield* TxHashMap.get(catalog, "laptop") // => Option.some({ price: 899, stock: 5 })
|
|
1870
1811
|
*
|
|
1871
1812
|
* // Can also use Map, Set of tuples, or any iterable of entries
|
|
1872
1813
|
* const jsMap = new Map([["tablet", { price: 399, stock: 3 }]])
|
|
1873
1814
|
* yield* TxHashMap.setMany(catalog, jsMap)
|
|
1815
|
+
* return yield* TxHashMap.get(catalog, "tablet")
|
|
1874
1816
|
* })
|
|
1817
|
+
*
|
|
1818
|
+
* await Effect.runPromise(program) // => Option.some({ price: 399, stock: 3 })
|
|
1875
1819
|
* ```
|
|
1876
1820
|
*
|
|
1877
1821
|
* @category combinators
|
|
@@ -1888,8 +1832,8 @@ export const setMany: {
|
|
|
1888
1832
|
*
|
|
1889
1833
|
* **Example** (Setting multiple entries)
|
|
1890
1834
|
*
|
|
1891
|
-
* ```ts
|
|
1892
|
-
* import { Effect, TxHashMap } from "effect"
|
|
1835
|
+
* ```ts import.meta.vitest
|
|
1836
|
+
* import { Effect, Option, TxHashMap } from "effect"
|
|
1893
1837
|
*
|
|
1894
1838
|
* const program = Effect.gen(function*() {
|
|
1895
1839
|
* // Create an empty product catalog
|
|
@@ -1910,7 +1854,7 @@ export const setMany: {
|
|
|
1910
1854
|
*
|
|
1911
1855
|
* yield* TxHashMap.setMany(catalog, initialProducts)
|
|
1912
1856
|
*
|
|
1913
|
-
*
|
|
1857
|
+
* yield* TxHashMap.size(catalog) // => 4
|
|
1914
1858
|
*
|
|
1915
1859
|
* // Update prices with a new batch
|
|
1916
1860
|
* const priceUpdates: Array<
|
|
@@ -1923,16 +1867,18 @@ export const setMany: {
|
|
|
1923
1867
|
*
|
|
1924
1868
|
* yield* TxHashMap.setMany(catalog, priceUpdates)
|
|
1925
1869
|
*
|
|
1926
|
-
*
|
|
1870
|
+
* yield* TxHashMap.size(catalog) // => 5
|
|
1927
1871
|
*
|
|
1928
1872
|
* // Verify the updates
|
|
1929
|
-
*
|
|
1930
|
-
* console.log(laptop) // Option.some({ price: 899, stock: 5 })
|
|
1873
|
+
* yield* TxHashMap.get(catalog, "laptop") // => Option.some({ price: 899, stock: 5 })
|
|
1931
1874
|
*
|
|
1932
1875
|
* // Can also use Map, Set of tuples, or any iterable of entries
|
|
1933
1876
|
* const jsMap = new Map([["tablet", { price: 399, stock: 3 }]])
|
|
1934
1877
|
* yield* TxHashMap.setMany(catalog, jsMap)
|
|
1878
|
+
* return yield* TxHashMap.get(catalog, "tablet")
|
|
1935
1879
|
* })
|
|
1880
|
+
*
|
|
1881
|
+
* await Effect.runPromise(program) // => Option.some({ price: 399, stock: 3 })
|
|
1936
1882
|
* ```
|
|
1937
1883
|
*
|
|
1938
1884
|
* @category combinators
|
|
@@ -1952,16 +1898,16 @@ export const setMany: {
|
|
|
1952
1898
|
*
|
|
1953
1899
|
* **Example** (Checking TxHashMap values)
|
|
1954
1900
|
*
|
|
1955
|
-
* ```ts
|
|
1956
|
-
* import { Effect, TxHashMap } from "effect"
|
|
1901
|
+
* ```ts import.meta.vitest
|
|
1902
|
+
* import { Effect, Exit, TxHashMap } from "effect"
|
|
1957
1903
|
*
|
|
1958
1904
|
* const program = Effect.gen(function*() {
|
|
1959
1905
|
* const txMap = yield* TxHashMap.make(["key", "value"])
|
|
1960
1906
|
*
|
|
1961
|
-
*
|
|
1962
|
-
*
|
|
1963
|
-
*
|
|
1964
|
-
*
|
|
1907
|
+
* TxHashMap.isTxHashMap(txMap) // => true
|
|
1908
|
+
* TxHashMap.isTxHashMap({}) // => false
|
|
1909
|
+
* TxHashMap.isTxHashMap(null) // => false
|
|
1910
|
+
* TxHashMap.isTxHashMap("not a map") // => false
|
|
1965
1911
|
*
|
|
1966
1912
|
* // Useful for type guards in runtime checks
|
|
1967
1913
|
* const validateInput = (value: unknown) => {
|
|
@@ -1971,7 +1917,12 @@ export const setMany: {
|
|
|
1971
1917
|
* }
|
|
1972
1918
|
* return Effect.fail("Invalid input")
|
|
1973
1919
|
* }
|
|
1920
|
+
*
|
|
1921
|
+
* yield* Effect.exit(validateInput(null)) // => Exit.fail("Invalid input")
|
|
1922
|
+
* return yield* Effect.exit(validateInput(txMap))
|
|
1974
1923
|
* })
|
|
1924
|
+
*
|
|
1925
|
+
* await Effect.runPromise(program) // => Exit.succeed("Valid TxHashMap")
|
|
1975
1926
|
* ```
|
|
1976
1927
|
*
|
|
1977
1928
|
* @category guards
|
|
@@ -1992,8 +1943,8 @@ export const isTxHashMap = <K, V>(value: unknown): value is TxHashMap<K, V> => {
|
|
|
1992
1943
|
*
|
|
1993
1944
|
* **Example** (Looking up values with precomputed hashes)
|
|
1994
1945
|
*
|
|
1995
|
-
* ```ts
|
|
1996
|
-
* import { Effect, Hash, TxHashMap } from "effect"
|
|
1946
|
+
* ```ts import.meta.vitest
|
|
1947
|
+
* import { Effect, Hash, Option, TxHashMap } from "effect"
|
|
1997
1948
|
*
|
|
1998
1949
|
* const program = Effect.gen(function*() {
|
|
1999
1950
|
* // Create a cache with user sessions
|
|
@@ -2008,16 +1959,17 @@ export const isTxHashMap = <K, V>(value: unknown): value is TxHashMap<K, V> => {
|
|
|
2008
1959
|
*
|
|
2009
1960
|
* // Use hash-optimized lookup for performance in hot paths
|
|
2010
1961
|
* const session = yield* TxHashMap.getHash(cache, sessionId, precomputedHash)
|
|
2011
|
-
*
|
|
1962
|
+
* session // => Option.some({ userId: "user1", lastActive: 1_700_000_000_000 })
|
|
2012
1963
|
*
|
|
2013
1964
|
* // This avoids recomputing the hash when you already have it
|
|
2014
|
-
*
|
|
1965
|
+
* return yield* TxHashMap.getHash(
|
|
2015
1966
|
* cache,
|
|
2016
1967
|
* "invalid",
|
|
2017
1968
|
* Hash.string("invalid")
|
|
2018
1969
|
* )
|
|
2019
|
-
* console.log(invalidSession) // Option.none()
|
|
2020
1970
|
* })
|
|
1971
|
+
*
|
|
1972
|
+
* await Effect.runPromise(program) // => Option.none()
|
|
2021
1973
|
* ```
|
|
2022
1974
|
*
|
|
2023
1975
|
* @category combinators
|
|
@@ -2035,8 +1987,8 @@ export const getHash: {
|
|
|
2035
1987
|
*
|
|
2036
1988
|
* **Example** (Looking up values with precomputed hashes)
|
|
2037
1989
|
*
|
|
2038
|
-
* ```ts
|
|
2039
|
-
* import { Effect, Hash, TxHashMap } from "effect"
|
|
1990
|
+
* ```ts import.meta.vitest
|
|
1991
|
+
* import { Effect, Hash, Option, TxHashMap } from "effect"
|
|
2040
1992
|
*
|
|
2041
1993
|
* const program = Effect.gen(function*() {
|
|
2042
1994
|
* // Create a cache with user sessions
|
|
@@ -2051,16 +2003,17 @@ export const getHash: {
|
|
|
2051
2003
|
*
|
|
2052
2004
|
* // Use hash-optimized lookup for performance in hot paths
|
|
2053
2005
|
* const session = yield* TxHashMap.getHash(cache, sessionId, precomputedHash)
|
|
2054
|
-
*
|
|
2006
|
+
* session // => Option.some({ userId: "user1", lastActive: 1_700_000_000_000 })
|
|
2055
2007
|
*
|
|
2056
2008
|
* // This avoids recomputing the hash when you already have it
|
|
2057
|
-
*
|
|
2009
|
+
* return yield* TxHashMap.getHash(
|
|
2058
2010
|
* cache,
|
|
2059
2011
|
* "invalid",
|
|
2060
2012
|
* Hash.string("invalid")
|
|
2061
2013
|
* )
|
|
2062
|
-
* console.log(invalidSession) // Option.none()
|
|
2063
2014
|
* })
|
|
2015
|
+
*
|
|
2016
|
+
* await Effect.runPromise(program) // => Option.none()
|
|
2064
2017
|
* ```
|
|
2065
2018
|
*
|
|
2066
2019
|
* @category combinators
|
|
@@ -2078,8 +2031,8 @@ export const getHash: {
|
|
|
2078
2031
|
*
|
|
2079
2032
|
* **Example** (Looking up values with precomputed hashes)
|
|
2080
2033
|
*
|
|
2081
|
-
* ```ts
|
|
2082
|
-
* import { Effect, Hash, TxHashMap } from "effect"
|
|
2034
|
+
* ```ts import.meta.vitest
|
|
2035
|
+
* import { Effect, Hash, Option, TxHashMap } from "effect"
|
|
2083
2036
|
*
|
|
2084
2037
|
* const program = Effect.gen(function*() {
|
|
2085
2038
|
* // Create a cache with user sessions
|
|
@@ -2094,16 +2047,17 @@ export const getHash: {
|
|
|
2094
2047
|
*
|
|
2095
2048
|
* // Use hash-optimized lookup for performance in hot paths
|
|
2096
2049
|
* const session = yield* TxHashMap.getHash(cache, sessionId, precomputedHash)
|
|
2097
|
-
*
|
|
2050
|
+
* session // => Option.some({ userId: "user1", lastActive: 1_700_000_000_000 })
|
|
2098
2051
|
*
|
|
2099
2052
|
* // This avoids recomputing the hash when you already have it
|
|
2100
|
-
*
|
|
2053
|
+
* return yield* TxHashMap.getHash(
|
|
2101
2054
|
* cache,
|
|
2102
2055
|
* "invalid",
|
|
2103
2056
|
* Hash.string("invalid")
|
|
2104
2057
|
* )
|
|
2105
|
-
* console.log(invalidSession) // Option.none()
|
|
2106
2058
|
* })
|
|
2059
|
+
*
|
|
2060
|
+
* await Effect.runPromise(program) // => Option.none()
|
|
2107
2061
|
* ```
|
|
2108
2062
|
*
|
|
2109
2063
|
* @category combinators
|
|
@@ -2130,7 +2084,7 @@ export const getHash: {
|
|
|
2130
2084
|
*
|
|
2131
2085
|
* **Example** (Checking keys with precomputed hashes)
|
|
2132
2086
|
*
|
|
2133
|
-
* ```ts
|
|
2087
|
+
* ```ts import.meta.vitest
|
|
2134
2088
|
* import { Effect, Hash, TxHashMap } from "effect"
|
|
2135
2089
|
*
|
|
2136
2090
|
* const program = Effect.gen(function*() {
|
|
@@ -2145,29 +2099,30 @@ export const getHash: {
|
|
|
2145
2099
|
* const roleHash = Hash.string(role)
|
|
2146
2100
|
*
|
|
2147
2101
|
* // Use hash-optimized existence check
|
|
2148
|
-
*
|
|
2149
|
-
* console.log(hasAdminRole) // true
|
|
2102
|
+
* yield* TxHashMap.hasHash(permissions, role, roleHash) // => true
|
|
2150
2103
|
*
|
|
2151
2104
|
* // Check non-existent role
|
|
2152
|
-
*
|
|
2105
|
+
* yield* TxHashMap.hasHash(
|
|
2153
2106
|
* permissions,
|
|
2154
2107
|
* "guest",
|
|
2155
2108
|
* Hash.string("guest")
|
|
2156
|
-
* )
|
|
2157
|
-
* console.log(hasGuestRole) // false
|
|
2109
|
+
* ) // => false
|
|
2158
2110
|
*
|
|
2159
2111
|
* // Useful in hot paths where hash is computed once and reused
|
|
2160
2112
|
* const roles = ["admin", "user", "moderator"]
|
|
2161
2113
|
* const roleHashes = roles.map((role) => [role, Hash.string(role)] as const)
|
|
2162
|
-
*
|
|
2114
|
+
* const results: Array<string> = []
|
|
2163
2115
|
* for (const [role, hash] of roleHashes) {
|
|
2164
2116
|
* const exists = yield* TxHashMap.hasHash(permissions, role, hash)
|
|
2165
|
-
*
|
|
2117
|
+
* results.push(`Role ${role}: ${exists}`)
|
|
2166
2118
|
* }
|
|
2119
|
+
* return results
|
|
2167
2120
|
* })
|
|
2121
|
+
*
|
|
2122
|
+
* await Effect.runPromise(program) // => ["Role admin: true", "Role user: true", "Role moderator: false"]
|
|
2168
2123
|
* ```
|
|
2169
2124
|
*
|
|
2170
|
-
* @category
|
|
2125
|
+
* @category predicates
|
|
2171
2126
|
* @since 4.0.0
|
|
2172
2127
|
*/
|
|
2173
2128
|
export const hasHash: {
|
|
@@ -2182,7 +2137,7 @@ export const hasHash: {
|
|
|
2182
2137
|
*
|
|
2183
2138
|
* **Example** (Checking keys with precomputed hashes)
|
|
2184
2139
|
*
|
|
2185
|
-
* ```ts
|
|
2140
|
+
* ```ts import.meta.vitest
|
|
2186
2141
|
* import { Effect, Hash, TxHashMap } from "effect"
|
|
2187
2142
|
*
|
|
2188
2143
|
* const program = Effect.gen(function*() {
|
|
@@ -2197,29 +2152,30 @@ export const hasHash: {
|
|
|
2197
2152
|
* const roleHash = Hash.string(role)
|
|
2198
2153
|
*
|
|
2199
2154
|
* // Use hash-optimized existence check
|
|
2200
|
-
*
|
|
2201
|
-
* console.log(hasAdminRole) // true
|
|
2155
|
+
* yield* TxHashMap.hasHash(permissions, role, roleHash) // => true
|
|
2202
2156
|
*
|
|
2203
2157
|
* // Check non-existent role
|
|
2204
|
-
*
|
|
2158
|
+
* yield* TxHashMap.hasHash(
|
|
2205
2159
|
* permissions,
|
|
2206
2160
|
* "guest",
|
|
2207
2161
|
* Hash.string("guest")
|
|
2208
|
-
* )
|
|
2209
|
-
* console.log(hasGuestRole) // false
|
|
2162
|
+
* ) // => false
|
|
2210
2163
|
*
|
|
2211
2164
|
* // Useful in hot paths where hash is computed once and reused
|
|
2212
2165
|
* const roles = ["admin", "user", "moderator"]
|
|
2213
2166
|
* const roleHashes = roles.map((role) => [role, Hash.string(role)] as const)
|
|
2214
|
-
*
|
|
2167
|
+
* const results: Array<string> = []
|
|
2215
2168
|
* for (const [role, hash] of roleHashes) {
|
|
2216
2169
|
* const exists = yield* TxHashMap.hasHash(permissions, role, hash)
|
|
2217
|
-
*
|
|
2170
|
+
* results.push(`Role ${role}: ${exists}`)
|
|
2218
2171
|
* }
|
|
2172
|
+
* return results
|
|
2219
2173
|
* })
|
|
2174
|
+
*
|
|
2175
|
+
* await Effect.runPromise(program) // => ["Role admin: true", "Role user: true", "Role moderator: false"]
|
|
2220
2176
|
* ```
|
|
2221
2177
|
*
|
|
2222
|
-
* @category
|
|
2178
|
+
* @category predicates
|
|
2223
2179
|
* @since 4.0.0
|
|
2224
2180
|
*/
|
|
2225
2181
|
<K1 extends K, K>(key: K1, hash: number): <V>(self: TxHashMap<K, V>) => Effect.Effect<boolean>
|
|
@@ -2234,7 +2190,7 @@ export const hasHash: {
|
|
|
2234
2190
|
*
|
|
2235
2191
|
* **Example** (Checking keys with precomputed hashes)
|
|
2236
2192
|
*
|
|
2237
|
-
* ```ts
|
|
2193
|
+
* ```ts import.meta.vitest
|
|
2238
2194
|
* import { Effect, Hash, TxHashMap } from "effect"
|
|
2239
2195
|
*
|
|
2240
2196
|
* const program = Effect.gen(function*() {
|
|
@@ -2249,29 +2205,30 @@ export const hasHash: {
|
|
|
2249
2205
|
* const roleHash = Hash.string(role)
|
|
2250
2206
|
*
|
|
2251
2207
|
* // Use hash-optimized existence check
|
|
2252
|
-
*
|
|
2253
|
-
* console.log(hasAdminRole) // true
|
|
2208
|
+
* yield* TxHashMap.hasHash(permissions, role, roleHash) // => true
|
|
2254
2209
|
*
|
|
2255
2210
|
* // Check non-existent role
|
|
2256
|
-
*
|
|
2211
|
+
* yield* TxHashMap.hasHash(
|
|
2257
2212
|
* permissions,
|
|
2258
2213
|
* "guest",
|
|
2259
2214
|
* Hash.string("guest")
|
|
2260
|
-
* )
|
|
2261
|
-
* console.log(hasGuestRole) // false
|
|
2215
|
+
* ) // => false
|
|
2262
2216
|
*
|
|
2263
2217
|
* // Useful in hot paths where hash is computed once and reused
|
|
2264
2218
|
* const roles = ["admin", "user", "moderator"]
|
|
2265
2219
|
* const roleHashes = roles.map((role) => [role, Hash.string(role)] as const)
|
|
2266
|
-
*
|
|
2220
|
+
* const results: Array<string> = []
|
|
2267
2221
|
* for (const [role, hash] of roleHashes) {
|
|
2268
2222
|
* const exists = yield* TxHashMap.hasHash(permissions, role, hash)
|
|
2269
|
-
*
|
|
2223
|
+
* results.push(`Role ${role}: ${exists}`)
|
|
2270
2224
|
* }
|
|
2225
|
+
* return results
|
|
2271
2226
|
* })
|
|
2227
|
+
*
|
|
2228
|
+
* await Effect.runPromise(program) // => ["Role admin: true", "Role user: true", "Role moderator: false"]
|
|
2272
2229
|
* ```
|
|
2273
2230
|
*
|
|
2274
|
-
* @category
|
|
2231
|
+
* @category predicates
|
|
2275
2232
|
* @since 4.0.0
|
|
2276
2233
|
*/
|
|
2277
2234
|
<K1 extends K, K, V>(self: TxHashMap<K, V>, key: K1, hash: number): Effect.Effect<boolean>
|
|
@@ -2294,8 +2251,8 @@ export const hasHash: {
|
|
|
2294
2251
|
*
|
|
2295
2252
|
* **Example** (Mapping values)
|
|
2296
2253
|
*
|
|
2297
|
-
* ```ts
|
|
2298
|
-
* import { Effect, TxHashMap } from "effect"
|
|
2254
|
+
* ```ts import.meta.vitest
|
|
2255
|
+
* import { Effect, Option, TxHashMap } from "effect"
|
|
2299
2256
|
*
|
|
2300
2257
|
* const program = Effect.gen(function*() {
|
|
2301
2258
|
* // Create a user profile map
|
|
@@ -2312,21 +2269,20 @@ export const hasHash: {
|
|
|
2312
2269
|
* )
|
|
2313
2270
|
*
|
|
2314
2271
|
* // Check the transformed values
|
|
2315
|
-
*
|
|
2316
|
-
* console.log(aliceGreeting) // Option.some("Hello, Alice! (User: alice)")
|
|
2272
|
+
* yield* TxHashMap.get(greetings, "alice") // => Option.some("Hello, Alice! (User: alice)")
|
|
2317
2273
|
*
|
|
2318
2274
|
* // Data-last usage with pipe
|
|
2319
2275
|
* const ages = yield* profiles.pipe(
|
|
2320
2276
|
* TxHashMap.map((profile) => profile.age)
|
|
2321
2277
|
* )
|
|
2322
2278
|
*
|
|
2323
|
-
*
|
|
2324
|
-
* console.log(aliceAge) // Option.some(30)
|
|
2279
|
+
* yield* TxHashMap.get(ages, "alice") // => Option.some(30)
|
|
2325
2280
|
*
|
|
2326
2281
|
* // Original map is unchanged
|
|
2327
|
-
*
|
|
2328
|
-
* console.log(originalAlice) // Option.some({ name: "Alice", age: 30, active: true })
|
|
2282
|
+
* return yield* TxHashMap.get(profiles, "alice")
|
|
2329
2283
|
* })
|
|
2284
|
+
*
|
|
2285
|
+
* await Effect.runPromise(program) // => Option.some({ name: "Alice", age: 30, active: true })
|
|
2330
2286
|
* ```
|
|
2331
2287
|
*
|
|
2332
2288
|
* @category combinators
|
|
@@ -2343,8 +2299,8 @@ export const map: {
|
|
|
2343
2299
|
*
|
|
2344
2300
|
* **Example** (Mapping values)
|
|
2345
2301
|
*
|
|
2346
|
-
* ```ts
|
|
2347
|
-
* import { Effect, TxHashMap } from "effect"
|
|
2302
|
+
* ```ts import.meta.vitest
|
|
2303
|
+
* import { Effect, Option, TxHashMap } from "effect"
|
|
2348
2304
|
*
|
|
2349
2305
|
* const program = Effect.gen(function*() {
|
|
2350
2306
|
* // Create a user profile map
|
|
@@ -2361,21 +2317,20 @@ export const map: {
|
|
|
2361
2317
|
* )
|
|
2362
2318
|
*
|
|
2363
2319
|
* // Check the transformed values
|
|
2364
|
-
*
|
|
2365
|
-
* console.log(aliceGreeting) // Option.some("Hello, Alice! (User: alice)")
|
|
2320
|
+
* yield* TxHashMap.get(greetings, "alice") // => Option.some("Hello, Alice! (User: alice)")
|
|
2366
2321
|
*
|
|
2367
2322
|
* // Data-last usage with pipe
|
|
2368
2323
|
* const ages = yield* profiles.pipe(
|
|
2369
2324
|
* TxHashMap.map((profile) => profile.age)
|
|
2370
2325
|
* )
|
|
2371
2326
|
*
|
|
2372
|
-
*
|
|
2373
|
-
* console.log(aliceAge) // Option.some(30)
|
|
2327
|
+
* yield* TxHashMap.get(ages, "alice") // => Option.some(30)
|
|
2374
2328
|
*
|
|
2375
2329
|
* // Original map is unchanged
|
|
2376
|
-
*
|
|
2377
|
-
* console.log(originalAlice) // Option.some({ name: "Alice", age: 30, active: true })
|
|
2330
|
+
* return yield* TxHashMap.get(profiles, "alice")
|
|
2378
2331
|
* })
|
|
2332
|
+
*
|
|
2333
|
+
* await Effect.runPromise(program) // => Option.some({ name: "Alice", age: 30, active: true })
|
|
2379
2334
|
* ```
|
|
2380
2335
|
*
|
|
2381
2336
|
* @category combinators
|
|
@@ -2392,8 +2347,8 @@ export const map: {
|
|
|
2392
2347
|
*
|
|
2393
2348
|
* **Example** (Mapping values)
|
|
2394
2349
|
*
|
|
2395
|
-
* ```ts
|
|
2396
|
-
* import { Effect, TxHashMap } from "effect"
|
|
2350
|
+
* ```ts import.meta.vitest
|
|
2351
|
+
* import { Effect, Option, TxHashMap } from "effect"
|
|
2397
2352
|
*
|
|
2398
2353
|
* const program = Effect.gen(function*() {
|
|
2399
2354
|
* // Create a user profile map
|
|
@@ -2410,21 +2365,20 @@ export const map: {
|
|
|
2410
2365
|
* )
|
|
2411
2366
|
*
|
|
2412
2367
|
* // Check the transformed values
|
|
2413
|
-
*
|
|
2414
|
-
* console.log(aliceGreeting) // Option.some("Hello, Alice! (User: alice)")
|
|
2368
|
+
* yield* TxHashMap.get(greetings, "alice") // => Option.some("Hello, Alice! (User: alice)")
|
|
2415
2369
|
*
|
|
2416
2370
|
* // Data-last usage with pipe
|
|
2417
2371
|
* const ages = yield* profiles.pipe(
|
|
2418
2372
|
* TxHashMap.map((profile) => profile.age)
|
|
2419
2373
|
* )
|
|
2420
2374
|
*
|
|
2421
|
-
*
|
|
2422
|
-
* console.log(aliceAge) // Option.some(30)
|
|
2375
|
+
* yield* TxHashMap.get(ages, "alice") // => Option.some(30)
|
|
2423
2376
|
*
|
|
2424
2377
|
* // Original map is unchanged
|
|
2425
|
-
*
|
|
2426
|
-
* console.log(originalAlice) // Option.some({ name: "Alice", age: 30, active: true })
|
|
2378
|
+
* return yield* TxHashMap.get(profiles, "alice")
|
|
2427
2379
|
* })
|
|
2380
|
+
*
|
|
2381
|
+
* await Effect.runPromise(program) // => Option.some({ name: "Alice", age: 30, active: true })
|
|
2428
2382
|
* ```
|
|
2429
2383
|
*
|
|
2430
2384
|
* @category combinators
|
|
@@ -2454,7 +2408,7 @@ export const map: {
|
|
|
2454
2408
|
*
|
|
2455
2409
|
* **Example** (Filtering entries)
|
|
2456
2410
|
*
|
|
2457
|
-
* ```ts
|
|
2411
|
+
* ```ts import.meta.vitest
|
|
2458
2412
|
* import { Effect, TxHashMap } from "effect"
|
|
2459
2413
|
*
|
|
2460
2414
|
* const program = Effect.gen(function*() {
|
|
@@ -2472,24 +2426,24 @@ export const map: {
|
|
|
2472
2426
|
* (product) => product.category === "electronics" && product.stock > 0
|
|
2473
2427
|
* )
|
|
2474
2428
|
*
|
|
2475
|
-
*
|
|
2476
|
-
* console.log(size) // 2 (laptop and mouse)
|
|
2429
|
+
* yield* TxHashMap.size(electronicsInStock) // => 2
|
|
2477
2430
|
*
|
|
2478
2431
|
* // Data-last usage with pipe
|
|
2479
2432
|
* const expensiveItems = yield* inventory.pipe(
|
|
2480
2433
|
* TxHashMap.filter((product) => product.price > 500)
|
|
2481
2434
|
* )
|
|
2482
2435
|
*
|
|
2483
|
-
*
|
|
2484
|
-
* console.log(expensiveSize) // 2 (laptop and phone)
|
|
2436
|
+
* yield* TxHashMap.size(expensiveItems) // => 2
|
|
2485
2437
|
*
|
|
2486
2438
|
* // Type guard usage
|
|
2487
|
-
*
|
|
2439
|
+
* return yield* TxHashMap.filter(
|
|
2488
2440
|
* inventory,
|
|
2489
2441
|
* (product): product is typeof product & { price: number } =>
|
|
2490
2442
|
* product.price > 50
|
|
2491
2443
|
* )
|
|
2492
2444
|
* })
|
|
2445
|
+
*
|
|
2446
|
+
* await Effect.runPromise(program)
|
|
2493
2447
|
* ```
|
|
2494
2448
|
*
|
|
2495
2449
|
* @category combinators
|
|
@@ -2506,7 +2460,7 @@ export const filter: {
|
|
|
2506
2460
|
*
|
|
2507
2461
|
* **Example** (Filtering entries)
|
|
2508
2462
|
*
|
|
2509
|
-
* ```ts
|
|
2463
|
+
* ```ts import.meta.vitest
|
|
2510
2464
|
* import { Effect, TxHashMap } from "effect"
|
|
2511
2465
|
*
|
|
2512
2466
|
* const program = Effect.gen(function*() {
|
|
@@ -2524,24 +2478,24 @@ export const filter: {
|
|
|
2524
2478
|
* (product) => product.category === "electronics" && product.stock > 0
|
|
2525
2479
|
* )
|
|
2526
2480
|
*
|
|
2527
|
-
*
|
|
2528
|
-
* console.log(size) // 2 (laptop and mouse)
|
|
2481
|
+
* yield* TxHashMap.size(electronicsInStock) // => 2
|
|
2529
2482
|
*
|
|
2530
2483
|
* // Data-last usage with pipe
|
|
2531
2484
|
* const expensiveItems = yield* inventory.pipe(
|
|
2532
2485
|
* TxHashMap.filter((product) => product.price > 500)
|
|
2533
2486
|
* )
|
|
2534
2487
|
*
|
|
2535
|
-
*
|
|
2536
|
-
* console.log(expensiveSize) // 2 (laptop and phone)
|
|
2488
|
+
* yield* TxHashMap.size(expensiveItems) // => 2
|
|
2537
2489
|
*
|
|
2538
2490
|
* // Type guard usage
|
|
2539
|
-
*
|
|
2491
|
+
* return yield* TxHashMap.filter(
|
|
2540
2492
|
* inventory,
|
|
2541
2493
|
* (product): product is typeof product & { price: number } =>
|
|
2542
2494
|
* product.price > 50
|
|
2543
2495
|
* )
|
|
2544
2496
|
* })
|
|
2497
|
+
*
|
|
2498
|
+
* await Effect.runPromise(program)
|
|
2545
2499
|
* ```
|
|
2546
2500
|
*
|
|
2547
2501
|
* @category combinators
|
|
@@ -2558,7 +2512,7 @@ export const filter: {
|
|
|
2558
2512
|
*
|
|
2559
2513
|
* **Example** (Filtering entries)
|
|
2560
2514
|
*
|
|
2561
|
-
* ```ts
|
|
2515
|
+
* ```ts import.meta.vitest
|
|
2562
2516
|
* import { Effect, TxHashMap } from "effect"
|
|
2563
2517
|
*
|
|
2564
2518
|
* const program = Effect.gen(function*() {
|
|
@@ -2576,24 +2530,24 @@ export const filter: {
|
|
|
2576
2530
|
* (product) => product.category === "electronics" && product.stock > 0
|
|
2577
2531
|
* )
|
|
2578
2532
|
*
|
|
2579
|
-
*
|
|
2580
|
-
* console.log(size) // 2 (laptop and mouse)
|
|
2533
|
+
* yield* TxHashMap.size(electronicsInStock) // => 2
|
|
2581
2534
|
*
|
|
2582
2535
|
* // Data-last usage with pipe
|
|
2583
2536
|
* const expensiveItems = yield* inventory.pipe(
|
|
2584
2537
|
* TxHashMap.filter((product) => product.price > 500)
|
|
2585
2538
|
* )
|
|
2586
2539
|
*
|
|
2587
|
-
*
|
|
2588
|
-
* console.log(expensiveSize) // 2 (laptop and phone)
|
|
2540
|
+
* yield* TxHashMap.size(expensiveItems) // => 2
|
|
2589
2541
|
*
|
|
2590
2542
|
* // Type guard usage
|
|
2591
|
-
*
|
|
2543
|
+
* return yield* TxHashMap.filter(
|
|
2592
2544
|
* inventory,
|
|
2593
2545
|
* (product): product is typeof product & { price: number } =>
|
|
2594
2546
|
* product.price > 50
|
|
2595
2547
|
* )
|
|
2596
2548
|
* })
|
|
2549
|
+
*
|
|
2550
|
+
* await Effect.runPromise(program)
|
|
2597
2551
|
* ```
|
|
2598
2552
|
*
|
|
2599
2553
|
* @category combinators
|
|
@@ -2610,7 +2564,7 @@ export const filter: {
|
|
|
2610
2564
|
*
|
|
2611
2565
|
* **Example** (Filtering entries)
|
|
2612
2566
|
*
|
|
2613
|
-
* ```ts
|
|
2567
|
+
* ```ts import.meta.vitest
|
|
2614
2568
|
* import { Effect, TxHashMap } from "effect"
|
|
2615
2569
|
*
|
|
2616
2570
|
* const program = Effect.gen(function*() {
|
|
@@ -2628,24 +2582,24 @@ export const filter: {
|
|
|
2628
2582
|
* (product) => product.category === "electronics" && product.stock > 0
|
|
2629
2583
|
* )
|
|
2630
2584
|
*
|
|
2631
|
-
*
|
|
2632
|
-
* console.log(size) // 2 (laptop and mouse)
|
|
2585
|
+
* yield* TxHashMap.size(electronicsInStock) // => 2
|
|
2633
2586
|
*
|
|
2634
2587
|
* // Data-last usage with pipe
|
|
2635
2588
|
* const expensiveItems = yield* inventory.pipe(
|
|
2636
2589
|
* TxHashMap.filter((product) => product.price > 500)
|
|
2637
2590
|
* )
|
|
2638
2591
|
*
|
|
2639
|
-
*
|
|
2640
|
-
* console.log(expensiveSize) // 2 (laptop and phone)
|
|
2592
|
+
* yield* TxHashMap.size(expensiveItems) // => 2
|
|
2641
2593
|
*
|
|
2642
2594
|
* // Type guard usage
|
|
2643
|
-
*
|
|
2595
|
+
* return yield* TxHashMap.filter(
|
|
2644
2596
|
* inventory,
|
|
2645
2597
|
* (product): product is typeof product & { price: number } =>
|
|
2646
2598
|
* product.price > 50
|
|
2647
2599
|
* )
|
|
2648
2600
|
* })
|
|
2601
|
+
*
|
|
2602
|
+
* await Effect.runPromise(program)
|
|
2649
2603
|
* ```
|
|
2650
2604
|
*
|
|
2651
2605
|
* @category combinators
|
|
@@ -2662,7 +2616,7 @@ export const filter: {
|
|
|
2662
2616
|
*
|
|
2663
2617
|
* **Example** (Filtering entries)
|
|
2664
2618
|
*
|
|
2665
|
-
* ```ts
|
|
2619
|
+
* ```ts import.meta.vitest
|
|
2666
2620
|
* import { Effect, TxHashMap } from "effect"
|
|
2667
2621
|
*
|
|
2668
2622
|
* const program = Effect.gen(function*() {
|
|
@@ -2680,24 +2634,24 @@ export const filter: {
|
|
|
2680
2634
|
* (product) => product.category === "electronics" && product.stock > 0
|
|
2681
2635
|
* )
|
|
2682
2636
|
*
|
|
2683
|
-
*
|
|
2684
|
-
* console.log(size) // 2 (laptop and mouse)
|
|
2637
|
+
* yield* TxHashMap.size(electronicsInStock) // => 2
|
|
2685
2638
|
*
|
|
2686
2639
|
* // Data-last usage with pipe
|
|
2687
2640
|
* const expensiveItems = yield* inventory.pipe(
|
|
2688
2641
|
* TxHashMap.filter((product) => product.price > 500)
|
|
2689
2642
|
* )
|
|
2690
2643
|
*
|
|
2691
|
-
*
|
|
2692
|
-
* console.log(expensiveSize) // 2 (laptop and phone)
|
|
2644
|
+
* yield* TxHashMap.size(expensiveItems) // => 2
|
|
2693
2645
|
*
|
|
2694
2646
|
* // Type guard usage
|
|
2695
|
-
*
|
|
2647
|
+
* return yield* TxHashMap.filter(
|
|
2696
2648
|
* inventory,
|
|
2697
2649
|
* (product): product is typeof product & { price: number } =>
|
|
2698
2650
|
* product.price > 50
|
|
2699
2651
|
* )
|
|
2700
2652
|
* })
|
|
2653
|
+
*
|
|
2654
|
+
* await Effect.runPromise(program)
|
|
2701
2655
|
* ```
|
|
2702
2656
|
*
|
|
2703
2657
|
* @category combinators
|
|
@@ -2723,7 +2677,7 @@ export const filter: {
|
|
|
2723
2677
|
*
|
|
2724
2678
|
* **Example** (Reducing entries)
|
|
2725
2679
|
*
|
|
2726
|
-
* ```ts
|
|
2680
|
+
* ```ts import.meta.vitest
|
|
2727
2681
|
* import { Effect, TxHashMap } from "effect"
|
|
2728
2682
|
*
|
|
2729
2683
|
* const program = Effect.gen(function*() {
|
|
@@ -2739,12 +2693,9 @@ export const filter: {
|
|
|
2739
2693
|
* const totalSales = yield* TxHashMap.reduce(
|
|
2740
2694
|
* sales,
|
|
2741
2695
|
* 0,
|
|
2742
|
-
* (total, amount
|
|
2743
|
-
* console.log(`Adding ${quarter}: ${amount}`)
|
|
2744
|
-
* return total + amount
|
|
2745
|
-
* }
|
|
2696
|
+
* (total, amount) => total + amount
|
|
2746
2697
|
* )
|
|
2747
|
-
*
|
|
2698
|
+
* totalSales // => 80000
|
|
2748
2699
|
*
|
|
2749
2700
|
* // Data-last usage with pipe
|
|
2750
2701
|
* const quarterlyReport = yield* sales.pipe(
|
|
@@ -2757,16 +2708,10 @@ export const filter: {
|
|
|
2757
2708
|
* })
|
|
2758
2709
|
* )
|
|
2759
2710
|
* )
|
|
2760
|
-
*
|
|
2761
|
-
*
|
|
2762
|
-
* // Build a summary string
|
|
2763
|
-
* const summary = yield* TxHashMap.reduce(
|
|
2764
|
-
* sales,
|
|
2765
|
-
* "",
|
|
2766
|
-
* (acc, amount, quarter) => acc + `${quarter}: $${amount.toLocaleString()}\n`
|
|
2767
|
-
* )
|
|
2768
|
-
* console.log(summary)
|
|
2711
|
+
* return quarterlyReport
|
|
2769
2712
|
* })
|
|
2713
|
+
*
|
|
2714
|
+
* await Effect.runPromise(program) // => { quarters: 4, total: 80000, max: 25000 }
|
|
2770
2715
|
* ```
|
|
2771
2716
|
*
|
|
2772
2717
|
* @category combinators
|
|
@@ -2779,7 +2724,7 @@ export const reduce: {
|
|
|
2779
2724
|
*
|
|
2780
2725
|
* **Example** (Reducing entries)
|
|
2781
2726
|
*
|
|
2782
|
-
* ```ts
|
|
2727
|
+
* ```ts import.meta.vitest
|
|
2783
2728
|
* import { Effect, TxHashMap } from "effect"
|
|
2784
2729
|
*
|
|
2785
2730
|
* const program = Effect.gen(function*() {
|
|
@@ -2795,12 +2740,9 @@ export const reduce: {
|
|
|
2795
2740
|
* const totalSales = yield* TxHashMap.reduce(
|
|
2796
2741
|
* sales,
|
|
2797
2742
|
* 0,
|
|
2798
|
-
* (total, amount
|
|
2799
|
-
* console.log(`Adding ${quarter}: ${amount}`)
|
|
2800
|
-
* return total + amount
|
|
2801
|
-
* }
|
|
2743
|
+
* (total, amount) => total + amount
|
|
2802
2744
|
* )
|
|
2803
|
-
*
|
|
2745
|
+
* totalSales // => 80000
|
|
2804
2746
|
*
|
|
2805
2747
|
* // Data-last usage with pipe
|
|
2806
2748
|
* const quarterlyReport = yield* sales.pipe(
|
|
@@ -2813,16 +2755,10 @@ export const reduce: {
|
|
|
2813
2755
|
* })
|
|
2814
2756
|
* )
|
|
2815
2757
|
* )
|
|
2816
|
-
*
|
|
2817
|
-
*
|
|
2818
|
-
* // Build a summary string
|
|
2819
|
-
* const summary = yield* TxHashMap.reduce(
|
|
2820
|
-
* sales,
|
|
2821
|
-
* "",
|
|
2822
|
-
* (acc, amount, quarter) => acc + `${quarter}: $${amount.toLocaleString()}\n`
|
|
2823
|
-
* )
|
|
2824
|
-
* console.log(summary)
|
|
2758
|
+
* return quarterlyReport
|
|
2825
2759
|
* })
|
|
2760
|
+
*
|
|
2761
|
+
* await Effect.runPromise(program) // => { quarters: 4, total: 80000, max: 25000 }
|
|
2826
2762
|
* ```
|
|
2827
2763
|
*
|
|
2828
2764
|
* @category combinators
|
|
@@ -2835,7 +2771,7 @@ export const reduce: {
|
|
|
2835
2771
|
*
|
|
2836
2772
|
* **Example** (Reducing entries)
|
|
2837
2773
|
*
|
|
2838
|
-
* ```ts
|
|
2774
|
+
* ```ts import.meta.vitest
|
|
2839
2775
|
* import { Effect, TxHashMap } from "effect"
|
|
2840
2776
|
*
|
|
2841
2777
|
* const program = Effect.gen(function*() {
|
|
@@ -2851,12 +2787,9 @@ export const reduce: {
|
|
|
2851
2787
|
* const totalSales = yield* TxHashMap.reduce(
|
|
2852
2788
|
* sales,
|
|
2853
2789
|
* 0,
|
|
2854
|
-
* (total, amount
|
|
2855
|
-
* console.log(`Adding ${quarter}: ${amount}`)
|
|
2856
|
-
* return total + amount
|
|
2857
|
-
* }
|
|
2790
|
+
* (total, amount) => total + amount
|
|
2858
2791
|
* )
|
|
2859
|
-
*
|
|
2792
|
+
* totalSales // => 80000
|
|
2860
2793
|
*
|
|
2861
2794
|
* // Data-last usage with pipe
|
|
2862
2795
|
* const quarterlyReport = yield* sales.pipe(
|
|
@@ -2869,16 +2802,10 @@ export const reduce: {
|
|
|
2869
2802
|
* })
|
|
2870
2803
|
* )
|
|
2871
2804
|
* )
|
|
2872
|
-
*
|
|
2873
|
-
*
|
|
2874
|
-
* // Build a summary string
|
|
2875
|
-
* const summary = yield* TxHashMap.reduce(
|
|
2876
|
-
* sales,
|
|
2877
|
-
* "",
|
|
2878
|
-
* (acc, amount, quarter) => acc + `${quarter}: $${amount.toLocaleString()}\n`
|
|
2879
|
-
* )
|
|
2880
|
-
* console.log(summary)
|
|
2805
|
+
* return quarterlyReport
|
|
2881
2806
|
* })
|
|
2807
|
+
*
|
|
2808
|
+
* await Effect.runPromise(program) // => { quarters: 4, total: 80000, max: 25000 }
|
|
2882
2809
|
* ```
|
|
2883
2810
|
*
|
|
2884
2811
|
* @category combinators
|
|
@@ -2905,7 +2832,7 @@ export const reduce: {
|
|
|
2905
2832
|
*
|
|
2906
2833
|
* **Example** (Filtering and mapping entries)
|
|
2907
2834
|
*
|
|
2908
|
-
* ```ts
|
|
2835
|
+
* ```ts import.meta.vitest
|
|
2909
2836
|
* import { Effect, Option, Result, TxHashMap } from "effect"
|
|
2910
2837
|
*
|
|
2911
2838
|
* const program = Effect.gen(function*() {
|
|
@@ -2933,10 +2860,8 @@ export const reduce: {
|
|
|
2933
2860
|
* )
|
|
2934
2861
|
*
|
|
2935
2862
|
* const aliceData = yield* TxHashMap.get(activeAdminAges, "alice")
|
|
2936
|
-
*
|
|
2937
|
-
*
|
|
2938
|
-
* const charlieData = yield* TxHashMap.get(activeAdminAges, "charlie")
|
|
2939
|
-
* console.log(charlieData) // Option.none() (not active)
|
|
2863
|
+
* aliceData // => Option.some({ username: "alice", age: 30, seniority: "senior" })
|
|
2864
|
+
* yield* TxHashMap.get(activeAdminAges, "charlie") // => Option.none()
|
|
2940
2865
|
*
|
|
2941
2866
|
* // Data-last usage with pipe
|
|
2942
2867
|
* const validAges = yield* userData.pipe(
|
|
@@ -2946,9 +2871,10 @@ export const reduce: {
|
|
|
2946
2871
|
* })
|
|
2947
2872
|
* )
|
|
2948
2873
|
*
|
|
2949
|
-
*
|
|
2950
|
-
* console.log(size) // 3 (alice, charlie, diana have valid ages)
|
|
2874
|
+
* return yield* TxHashMap.size(validAges)
|
|
2951
2875
|
* })
|
|
2876
|
+
*
|
|
2877
|
+
* await Effect.runPromise(program) // => 3
|
|
2952
2878
|
* ```
|
|
2953
2879
|
*
|
|
2954
2880
|
* @category combinators
|
|
@@ -2966,7 +2892,7 @@ export const filterMap: {
|
|
|
2966
2892
|
*
|
|
2967
2893
|
* **Example** (Filtering and mapping entries)
|
|
2968
2894
|
*
|
|
2969
|
-
* ```ts
|
|
2895
|
+
* ```ts import.meta.vitest
|
|
2970
2896
|
* import { Effect, Option, Result, TxHashMap } from "effect"
|
|
2971
2897
|
*
|
|
2972
2898
|
* const program = Effect.gen(function*() {
|
|
@@ -2994,10 +2920,8 @@ export const filterMap: {
|
|
|
2994
2920
|
* )
|
|
2995
2921
|
*
|
|
2996
2922
|
* const aliceData = yield* TxHashMap.get(activeAdminAges, "alice")
|
|
2997
|
-
*
|
|
2998
|
-
*
|
|
2999
|
-
* const charlieData = yield* TxHashMap.get(activeAdminAges, "charlie")
|
|
3000
|
-
* console.log(charlieData) // Option.none() (not active)
|
|
2923
|
+
* aliceData // => Option.some({ username: "alice", age: 30, seniority: "senior" })
|
|
2924
|
+
* yield* TxHashMap.get(activeAdminAges, "charlie") // => Option.none()
|
|
3001
2925
|
*
|
|
3002
2926
|
* // Data-last usage with pipe
|
|
3003
2927
|
* const validAges = yield* userData.pipe(
|
|
@@ -3007,9 +2931,10 @@ export const filterMap: {
|
|
|
3007
2931
|
* })
|
|
3008
2932
|
* )
|
|
3009
2933
|
*
|
|
3010
|
-
*
|
|
3011
|
-
* console.log(size) // 3 (alice, charlie, diana have valid ages)
|
|
2934
|
+
* return yield* TxHashMap.size(validAges)
|
|
3012
2935
|
* })
|
|
2936
|
+
*
|
|
2937
|
+
* await Effect.runPromise(program) // => 3
|
|
3013
2938
|
* ```
|
|
3014
2939
|
*
|
|
3015
2940
|
* @category combinators
|
|
@@ -3027,7 +2952,7 @@ export const filterMap: {
|
|
|
3027
2952
|
*
|
|
3028
2953
|
* **Example** (Filtering and mapping entries)
|
|
3029
2954
|
*
|
|
3030
|
-
* ```ts
|
|
2955
|
+
* ```ts import.meta.vitest
|
|
3031
2956
|
* import { Effect, Option, Result, TxHashMap } from "effect"
|
|
3032
2957
|
*
|
|
3033
2958
|
* const program = Effect.gen(function*() {
|
|
@@ -3055,10 +2980,8 @@ export const filterMap: {
|
|
|
3055
2980
|
* )
|
|
3056
2981
|
*
|
|
3057
2982
|
* const aliceData = yield* TxHashMap.get(activeAdminAges, "alice")
|
|
3058
|
-
*
|
|
3059
|
-
*
|
|
3060
|
-
* const charlieData = yield* TxHashMap.get(activeAdminAges, "charlie")
|
|
3061
|
-
* console.log(charlieData) // Option.none() (not active)
|
|
2983
|
+
* aliceData // => Option.some({ username: "alice", age: 30, seniority: "senior" })
|
|
2984
|
+
* yield* TxHashMap.get(activeAdminAges, "charlie") // => Option.none()
|
|
3062
2985
|
*
|
|
3063
2986
|
* // Data-last usage with pipe
|
|
3064
2987
|
* const validAges = yield* userData.pipe(
|
|
@@ -3068,9 +2991,10 @@ export const filterMap: {
|
|
|
3068
2991
|
* })
|
|
3069
2992
|
* )
|
|
3070
2993
|
*
|
|
3071
|
-
*
|
|
3072
|
-
* console.log(size) // 3 (alice, charlie, diana have valid ages)
|
|
2994
|
+
* return yield* TxHashMap.size(validAges)
|
|
3073
2995
|
* })
|
|
2996
|
+
*
|
|
2997
|
+
* await Effect.runPromise(program) // => 3
|
|
3074
2998
|
* ```
|
|
3075
2999
|
*
|
|
3076
3000
|
* @category combinators
|
|
@@ -3095,7 +3019,7 @@ export const filterMap: {
|
|
|
3095
3019
|
*
|
|
3096
3020
|
* **Example** (Checking entries with a predicate)
|
|
3097
3021
|
*
|
|
3098
|
-
* ```ts
|
|
3022
|
+
* ```ts import.meta.vitest
|
|
3099
3023
|
* import { Effect, TxHashMap } from "effect"
|
|
3100
3024
|
*
|
|
3101
3025
|
* const program = Effect.gen(function*() {
|
|
@@ -3108,28 +3032,27 @@ export const filterMap: {
|
|
|
3108
3032
|
* )
|
|
3109
3033
|
*
|
|
3110
3034
|
* // Check if any users are online
|
|
3111
|
-
*
|
|
3035
|
+
* yield* TxHashMap.hasBy(
|
|
3112
3036
|
* userStatuses,
|
|
3113
3037
|
* (user) => user.status === "online"
|
|
3114
|
-
* )
|
|
3115
|
-
* console.log(hasOnlineUsers) // true
|
|
3038
|
+
* ) // => true
|
|
3116
3039
|
*
|
|
3117
3040
|
* // Check if any users have specific username pattern
|
|
3118
|
-
*
|
|
3041
|
+
* yield* TxHashMap.hasBy(
|
|
3119
3042
|
* userStatuses,
|
|
3120
3043
|
* (user, username) => username.startsWith("admin")
|
|
3121
|
-
* )
|
|
3122
|
-
* console.log(hasAdminUser) // false
|
|
3044
|
+
* ) // => false
|
|
3123
3045
|
*
|
|
3124
3046
|
* // Data-last usage with pipe
|
|
3125
|
-
*
|
|
3047
|
+
* return yield* userStatuses.pipe(
|
|
3126
3048
|
* TxHashMap.hasBy((user) => currentTime - user.lastSeen < 1_800_000) // 30 minutes
|
|
3127
3049
|
* )
|
|
3128
|
-
* console.log(hasRecentActivity) // true
|
|
3129
3050
|
* })
|
|
3051
|
+
*
|
|
3052
|
+
* await Effect.runPromise(program) // => true
|
|
3130
3053
|
* ```
|
|
3131
3054
|
*
|
|
3132
|
-
* @category
|
|
3055
|
+
* @category predicates
|
|
3133
3056
|
* @since 4.0.0
|
|
3134
3057
|
*/
|
|
3135
3058
|
export const hasBy: {
|
|
@@ -3138,7 +3061,7 @@ export const hasBy: {
|
|
|
3138
3061
|
*
|
|
3139
3062
|
* **Example** (Checking entries with a predicate)
|
|
3140
3063
|
*
|
|
3141
|
-
* ```ts
|
|
3064
|
+
* ```ts import.meta.vitest
|
|
3142
3065
|
* import { Effect, TxHashMap } from "effect"
|
|
3143
3066
|
*
|
|
3144
3067
|
* const program = Effect.gen(function*() {
|
|
@@ -3151,28 +3074,27 @@ export const hasBy: {
|
|
|
3151
3074
|
* )
|
|
3152
3075
|
*
|
|
3153
3076
|
* // Check if any users are online
|
|
3154
|
-
*
|
|
3077
|
+
* yield* TxHashMap.hasBy(
|
|
3155
3078
|
* userStatuses,
|
|
3156
3079
|
* (user) => user.status === "online"
|
|
3157
|
-
* )
|
|
3158
|
-
* console.log(hasOnlineUsers) // true
|
|
3080
|
+
* ) // => true
|
|
3159
3081
|
*
|
|
3160
3082
|
* // Check if any users have specific username pattern
|
|
3161
|
-
*
|
|
3083
|
+
* yield* TxHashMap.hasBy(
|
|
3162
3084
|
* userStatuses,
|
|
3163
3085
|
* (user, username) => username.startsWith("admin")
|
|
3164
|
-
* )
|
|
3165
|
-
* console.log(hasAdminUser) // false
|
|
3086
|
+
* ) // => false
|
|
3166
3087
|
*
|
|
3167
3088
|
* // Data-last usage with pipe
|
|
3168
|
-
*
|
|
3089
|
+
* return yield* userStatuses.pipe(
|
|
3169
3090
|
* TxHashMap.hasBy((user) => currentTime - user.lastSeen < 1_800_000) // 30 minutes
|
|
3170
3091
|
* )
|
|
3171
|
-
* console.log(hasRecentActivity) // true
|
|
3172
3092
|
* })
|
|
3093
|
+
*
|
|
3094
|
+
* await Effect.runPromise(program) // => true
|
|
3173
3095
|
* ```
|
|
3174
3096
|
*
|
|
3175
|
-
* @category
|
|
3097
|
+
* @category predicates
|
|
3176
3098
|
* @since 4.0.0
|
|
3177
3099
|
*/
|
|
3178
3100
|
<K, V>(predicate: (value: V, key: K) => boolean): (self: TxHashMap<K, V>) => Effect.Effect<boolean>
|
|
@@ -3181,7 +3103,7 @@ export const hasBy: {
|
|
|
3181
3103
|
*
|
|
3182
3104
|
* **Example** (Checking entries with a predicate)
|
|
3183
3105
|
*
|
|
3184
|
-
* ```ts
|
|
3106
|
+
* ```ts import.meta.vitest
|
|
3185
3107
|
* import { Effect, TxHashMap } from "effect"
|
|
3186
3108
|
*
|
|
3187
3109
|
* const program = Effect.gen(function*() {
|
|
@@ -3194,28 +3116,27 @@ export const hasBy: {
|
|
|
3194
3116
|
* )
|
|
3195
3117
|
*
|
|
3196
3118
|
* // Check if any users are online
|
|
3197
|
-
*
|
|
3119
|
+
* yield* TxHashMap.hasBy(
|
|
3198
3120
|
* userStatuses,
|
|
3199
3121
|
* (user) => user.status === "online"
|
|
3200
|
-
* )
|
|
3201
|
-
* console.log(hasOnlineUsers) // true
|
|
3122
|
+
* ) // => true
|
|
3202
3123
|
*
|
|
3203
3124
|
* // Check if any users have specific username pattern
|
|
3204
|
-
*
|
|
3125
|
+
* yield* TxHashMap.hasBy(
|
|
3205
3126
|
* userStatuses,
|
|
3206
3127
|
* (user, username) => username.startsWith("admin")
|
|
3207
|
-
* )
|
|
3208
|
-
* console.log(hasAdminUser) // false
|
|
3128
|
+
* ) // => false
|
|
3209
3129
|
*
|
|
3210
3130
|
* // Data-last usage with pipe
|
|
3211
|
-
*
|
|
3131
|
+
* return yield* userStatuses.pipe(
|
|
3212
3132
|
* TxHashMap.hasBy((user) => currentTime - user.lastSeen < 1_800_000) // 30 minutes
|
|
3213
3133
|
* )
|
|
3214
|
-
* console.log(hasRecentActivity) // true
|
|
3215
3134
|
* })
|
|
3135
|
+
*
|
|
3136
|
+
* await Effect.runPromise(program) // => true
|
|
3216
3137
|
* ```
|
|
3217
3138
|
*
|
|
3218
|
-
* @category
|
|
3139
|
+
* @category predicates
|
|
3219
3140
|
* @since 4.0.0
|
|
3220
3141
|
*/
|
|
3221
3142
|
<K, V>(self: TxHashMap<K, V>, predicate: (value: V, key: K) => boolean): Effect.Effect<boolean>
|
|
@@ -3233,8 +3154,8 @@ export const hasBy: {
|
|
|
3233
3154
|
*
|
|
3234
3155
|
* **Example** (Finding the first matching entry)
|
|
3235
3156
|
*
|
|
3236
|
-
* ```ts
|
|
3237
|
-
* import { Effect, TxHashMap } from "effect"
|
|
3157
|
+
* ```ts import.meta.vitest
|
|
3158
|
+
* import { Effect, Option, TxHashMap } from "effect"
|
|
3238
3159
|
*
|
|
3239
3160
|
* const program = Effect.gen(function*() {
|
|
3240
3161
|
* // Create a task priority map
|
|
@@ -3250,21 +3171,15 @@ export const hasBy: {
|
|
|
3250
3171
|
* (task) => task.priority >= 2 && !task.completed
|
|
3251
3172
|
* )
|
|
3252
3173
|
*
|
|
3253
|
-
*
|
|
3254
|
-
* const [taskId, task] = highPriorityTask.value
|
|
3255
|
-
* console.log(`Found task: ${taskId}, priority: ${task.priority}`)
|
|
3256
|
-
* // "Found task: task3, priority: 2"
|
|
3257
|
-
* }
|
|
3174
|
+
* highPriorityTask // => Option.some(["task3", { priority: 2, assignee: "alice", completed: false }])
|
|
3258
3175
|
*
|
|
3259
3176
|
* // Find first task assigned to specific user
|
|
3260
|
-
*
|
|
3177
|
+
* return yield* tasks.pipe(
|
|
3261
3178
|
* TxHashMap.findFirst((task) => task.assignee === "alice")
|
|
3262
3179
|
* )
|
|
3263
|
-
*
|
|
3264
|
-
* if (aliceTask._tag === "Some") {
|
|
3265
|
-
* console.log(`Alice's task: ${aliceTask.value[0]}`)
|
|
3266
|
-
* }
|
|
3267
3180
|
* })
|
|
3181
|
+
*
|
|
3182
|
+
* await Effect.runPromise(program) // => Option.some(["task1", { priority: 1, assignee: "alice", completed: false }])
|
|
3268
3183
|
* ```
|
|
3269
3184
|
*
|
|
3270
3185
|
* @category combinators
|
|
@@ -3277,8 +3192,8 @@ export const findFirst: {
|
|
|
3277
3192
|
*
|
|
3278
3193
|
* **Example** (Finding the first matching entry)
|
|
3279
3194
|
*
|
|
3280
|
-
* ```ts
|
|
3281
|
-
* import { Effect, TxHashMap } from "effect"
|
|
3195
|
+
* ```ts import.meta.vitest
|
|
3196
|
+
* import { Effect, Option, TxHashMap } from "effect"
|
|
3282
3197
|
*
|
|
3283
3198
|
* const program = Effect.gen(function*() {
|
|
3284
3199
|
* // Create a task priority map
|
|
@@ -3294,21 +3209,15 @@ export const findFirst: {
|
|
|
3294
3209
|
* (task) => task.priority >= 2 && !task.completed
|
|
3295
3210
|
* )
|
|
3296
3211
|
*
|
|
3297
|
-
*
|
|
3298
|
-
* const [taskId, task] = highPriorityTask.value
|
|
3299
|
-
* console.log(`Found task: ${taskId}, priority: ${task.priority}`)
|
|
3300
|
-
* // "Found task: task3, priority: 2"
|
|
3301
|
-
* }
|
|
3212
|
+
* highPriorityTask // => Option.some(["task3", { priority: 2, assignee: "alice", completed: false }])
|
|
3302
3213
|
*
|
|
3303
3214
|
* // Find first task assigned to specific user
|
|
3304
|
-
*
|
|
3215
|
+
* return yield* tasks.pipe(
|
|
3305
3216
|
* TxHashMap.findFirst((task) => task.assignee === "alice")
|
|
3306
3217
|
* )
|
|
3307
|
-
*
|
|
3308
|
-
* if (aliceTask._tag === "Some") {
|
|
3309
|
-
* console.log(`Alice's task: ${aliceTask.value[0]}`)
|
|
3310
|
-
* }
|
|
3311
3218
|
* })
|
|
3219
|
+
*
|
|
3220
|
+
* await Effect.runPromise(program) // => Option.some(["task1", { priority: 1, assignee: "alice", completed: false }])
|
|
3312
3221
|
* ```
|
|
3313
3222
|
*
|
|
3314
3223
|
* @category combinators
|
|
@@ -3321,8 +3230,8 @@ export const findFirst: {
|
|
|
3321
3230
|
*
|
|
3322
3231
|
* **Example** (Finding the first matching entry)
|
|
3323
3232
|
*
|
|
3324
|
-
* ```ts
|
|
3325
|
-
* import { Effect, TxHashMap } from "effect"
|
|
3233
|
+
* ```ts import.meta.vitest
|
|
3234
|
+
* import { Effect, Option, TxHashMap } from "effect"
|
|
3326
3235
|
*
|
|
3327
3236
|
* const program = Effect.gen(function*() {
|
|
3328
3237
|
* // Create a task priority map
|
|
@@ -3338,21 +3247,15 @@ export const findFirst: {
|
|
|
3338
3247
|
* (task) => task.priority >= 2 && !task.completed
|
|
3339
3248
|
* )
|
|
3340
3249
|
*
|
|
3341
|
-
*
|
|
3342
|
-
* const [taskId, task] = highPriorityTask.value
|
|
3343
|
-
* console.log(`Found task: ${taskId}, priority: ${task.priority}`)
|
|
3344
|
-
* // "Found task: task3, priority: 2"
|
|
3345
|
-
* }
|
|
3250
|
+
* highPriorityTask // => Option.some(["task3", { priority: 2, assignee: "alice", completed: false }])
|
|
3346
3251
|
*
|
|
3347
3252
|
* // Find first task assigned to specific user
|
|
3348
|
-
*
|
|
3253
|
+
* return yield* tasks.pipe(
|
|
3349
3254
|
* TxHashMap.findFirst((task) => task.assignee === "alice")
|
|
3350
3255
|
* )
|
|
3351
|
-
*
|
|
3352
|
-
* if (aliceTask._tag === "Some") {
|
|
3353
|
-
* console.log(`Alice's task: ${aliceTask.value[0]}`)
|
|
3354
|
-
* }
|
|
3355
3256
|
* })
|
|
3257
|
+
*
|
|
3258
|
+
* await Effect.runPromise(program) // => Option.some(["task1", { priority: 1, assignee: "alice", completed: false }])
|
|
3356
3259
|
* ```
|
|
3357
3260
|
*
|
|
3358
3261
|
* @category combinators
|
|
@@ -3373,7 +3276,7 @@ export const findFirst: {
|
|
|
3373
3276
|
*
|
|
3374
3277
|
* **Example** (Checking whether some entries match)
|
|
3375
3278
|
*
|
|
3376
|
-
* ```ts
|
|
3279
|
+
* ```ts import.meta.vitest
|
|
3377
3280
|
* import { Effect, TxHashMap } from "effect"
|
|
3378
3281
|
*
|
|
3379
3282
|
* const program = Effect.gen(function*() {
|
|
@@ -3385,28 +3288,27 @@ export const findFirst: {
|
|
|
3385
3288
|
* )
|
|
3386
3289
|
*
|
|
3387
3290
|
* // Check if any products are expensive
|
|
3388
|
-
*
|
|
3291
|
+
* yield* TxHashMap.some(
|
|
3389
3292
|
* inventory,
|
|
3390
3293
|
* (product) => product.price > 500
|
|
3391
|
-
* )
|
|
3392
|
-
* console.log(hasExpensiveProducts) // true
|
|
3294
|
+
* ) // => true
|
|
3393
3295
|
*
|
|
3394
3296
|
* // Check if any products are out of stock
|
|
3395
|
-
*
|
|
3297
|
+
* yield* TxHashMap.some(
|
|
3396
3298
|
* inventory,
|
|
3397
3299
|
* (product) => product.stock === 0
|
|
3398
|
-
* )
|
|
3399
|
-
* console.log(hasOutOfStock) // true
|
|
3300
|
+
* ) // => true
|
|
3400
3301
|
*
|
|
3401
3302
|
* // Data-last usage with pipe
|
|
3402
|
-
*
|
|
3303
|
+
* return yield* inventory.pipe(
|
|
3403
3304
|
* TxHashMap.some((product) => product.price < 50)
|
|
3404
3305
|
* )
|
|
3405
|
-
* console.log(hasAffordableItems) // true (mouse is $29)
|
|
3406
3306
|
* })
|
|
3307
|
+
*
|
|
3308
|
+
* await Effect.runPromise(program) // => true
|
|
3407
3309
|
* ```
|
|
3408
3310
|
*
|
|
3409
|
-
* @category
|
|
3311
|
+
* @category predicates
|
|
3410
3312
|
* @since 4.0.0
|
|
3411
3313
|
*/
|
|
3412
3314
|
export const some: {
|
|
@@ -3415,7 +3317,7 @@ export const some: {
|
|
|
3415
3317
|
*
|
|
3416
3318
|
* **Example** (Checking whether some entries match)
|
|
3417
3319
|
*
|
|
3418
|
-
* ```ts
|
|
3320
|
+
* ```ts import.meta.vitest
|
|
3419
3321
|
* import { Effect, TxHashMap } from "effect"
|
|
3420
3322
|
*
|
|
3421
3323
|
* const program = Effect.gen(function*() {
|
|
@@ -3427,28 +3329,27 @@ export const some: {
|
|
|
3427
3329
|
* )
|
|
3428
3330
|
*
|
|
3429
3331
|
* // Check if any products are expensive
|
|
3430
|
-
*
|
|
3332
|
+
* yield* TxHashMap.some(
|
|
3431
3333
|
* inventory,
|
|
3432
3334
|
* (product) => product.price > 500
|
|
3433
|
-
* )
|
|
3434
|
-
* console.log(hasExpensiveProducts) // true
|
|
3335
|
+
* ) // => true
|
|
3435
3336
|
*
|
|
3436
3337
|
* // Check if any products are out of stock
|
|
3437
|
-
*
|
|
3338
|
+
* yield* TxHashMap.some(
|
|
3438
3339
|
* inventory,
|
|
3439
3340
|
* (product) => product.stock === 0
|
|
3440
|
-
* )
|
|
3441
|
-
* console.log(hasOutOfStock) // true
|
|
3341
|
+
* ) // => true
|
|
3442
3342
|
*
|
|
3443
3343
|
* // Data-last usage with pipe
|
|
3444
|
-
*
|
|
3344
|
+
* return yield* inventory.pipe(
|
|
3445
3345
|
* TxHashMap.some((product) => product.price < 50)
|
|
3446
3346
|
* )
|
|
3447
|
-
* console.log(hasAffordableItems) // true (mouse is $29)
|
|
3448
3347
|
* })
|
|
3348
|
+
*
|
|
3349
|
+
* await Effect.runPromise(program) // => true
|
|
3449
3350
|
* ```
|
|
3450
3351
|
*
|
|
3451
|
-
* @category
|
|
3352
|
+
* @category predicates
|
|
3452
3353
|
* @since 4.0.0
|
|
3453
3354
|
*/
|
|
3454
3355
|
<K, V>(predicate: (value: V, key: K) => boolean): (self: TxHashMap<K, V>) => Effect.Effect<boolean>
|
|
@@ -3457,7 +3358,7 @@ export const some: {
|
|
|
3457
3358
|
*
|
|
3458
3359
|
* **Example** (Checking whether some entries match)
|
|
3459
3360
|
*
|
|
3460
|
-
* ```ts
|
|
3361
|
+
* ```ts import.meta.vitest
|
|
3461
3362
|
* import { Effect, TxHashMap } from "effect"
|
|
3462
3363
|
*
|
|
3463
3364
|
* const program = Effect.gen(function*() {
|
|
@@ -3469,28 +3370,27 @@ export const some: {
|
|
|
3469
3370
|
* )
|
|
3470
3371
|
*
|
|
3471
3372
|
* // Check if any products are expensive
|
|
3472
|
-
*
|
|
3373
|
+
* yield* TxHashMap.some(
|
|
3473
3374
|
* inventory,
|
|
3474
3375
|
* (product) => product.price > 500
|
|
3475
|
-
* )
|
|
3476
|
-
* console.log(hasExpensiveProducts) // true
|
|
3376
|
+
* ) // => true
|
|
3477
3377
|
*
|
|
3478
3378
|
* // Check if any products are out of stock
|
|
3479
|
-
*
|
|
3379
|
+
* yield* TxHashMap.some(
|
|
3480
3380
|
* inventory,
|
|
3481
3381
|
* (product) => product.stock === 0
|
|
3482
|
-
* )
|
|
3483
|
-
* console.log(hasOutOfStock) // true
|
|
3382
|
+
* ) // => true
|
|
3484
3383
|
*
|
|
3485
3384
|
* // Data-last usage with pipe
|
|
3486
|
-
*
|
|
3385
|
+
* return yield* inventory.pipe(
|
|
3487
3386
|
* TxHashMap.some((product) => product.price < 50)
|
|
3488
3387
|
* )
|
|
3489
|
-
* console.log(hasAffordableItems) // true (mouse is $29)
|
|
3490
3388
|
* })
|
|
3389
|
+
*
|
|
3390
|
+
* await Effect.runPromise(program) // => true
|
|
3491
3391
|
* ```
|
|
3492
3392
|
*
|
|
3493
|
-
* @category
|
|
3393
|
+
* @category predicates
|
|
3494
3394
|
* @since 4.0.0
|
|
3495
3395
|
*/
|
|
3496
3396
|
<K, V>(self: TxHashMap<K, V>, predicate: (value: V, key: K) => boolean): Effect.Effect<boolean>
|
|
@@ -3507,7 +3407,7 @@ export const some: {
|
|
|
3507
3407
|
*
|
|
3508
3408
|
* **Example** (Checking whether every entry matches)
|
|
3509
3409
|
*
|
|
3510
|
-
* ```ts
|
|
3410
|
+
* ```ts import.meta.vitest
|
|
3511
3411
|
* import { Effect, TxHashMap } from "effect"
|
|
3512
3412
|
*
|
|
3513
3413
|
* const program = Effect.gen(function*() {
|
|
@@ -3519,28 +3419,27 @@ export const some: {
|
|
|
3519
3419
|
* )
|
|
3520
3420
|
*
|
|
3521
3421
|
* // Check if all users can read
|
|
3522
|
-
*
|
|
3422
|
+
* yield* TxHashMap.every(
|
|
3523
3423
|
* permissions,
|
|
3524
3424
|
* (perms) => perms.canRead
|
|
3525
|
-
* )
|
|
3526
|
-
* console.log(allCanRead) // true
|
|
3425
|
+
* ) // => true
|
|
3527
3426
|
*
|
|
3528
3427
|
* // Check if all users can write
|
|
3529
|
-
*
|
|
3428
|
+
* yield* TxHashMap.every(
|
|
3530
3429
|
* permissions,
|
|
3531
3430
|
* (perms) => perms.canWrite
|
|
3532
|
-
* )
|
|
3533
|
-
* console.log(allCanWrite) // false
|
|
3431
|
+
* ) // => false
|
|
3534
3432
|
*
|
|
3535
3433
|
* // Data-last usage with pipe
|
|
3536
|
-
*
|
|
3434
|
+
* return yield* permissions.pipe(
|
|
3537
3435
|
* TxHashMap.every((perms, username) => perms.canRead && username.length > 2)
|
|
3538
3436
|
* )
|
|
3539
|
-
* console.log(allHaveBasicAccess) // true
|
|
3540
3437
|
* })
|
|
3438
|
+
*
|
|
3439
|
+
* await Effect.runPromise(program) // => true
|
|
3541
3440
|
* ```
|
|
3542
3441
|
*
|
|
3543
|
-
* @category
|
|
3442
|
+
* @category predicates
|
|
3544
3443
|
* @since 4.0.0
|
|
3545
3444
|
*/
|
|
3546
3445
|
export const every: {
|
|
@@ -3549,7 +3448,7 @@ export const every: {
|
|
|
3549
3448
|
*
|
|
3550
3449
|
* **Example** (Checking whether every entry matches)
|
|
3551
3450
|
*
|
|
3552
|
-
* ```ts
|
|
3451
|
+
* ```ts import.meta.vitest
|
|
3553
3452
|
* import { Effect, TxHashMap } from "effect"
|
|
3554
3453
|
*
|
|
3555
3454
|
* const program = Effect.gen(function*() {
|
|
@@ -3561,28 +3460,27 @@ export const every: {
|
|
|
3561
3460
|
* )
|
|
3562
3461
|
*
|
|
3563
3462
|
* // Check if all users can read
|
|
3564
|
-
*
|
|
3463
|
+
* yield* TxHashMap.every(
|
|
3565
3464
|
* permissions,
|
|
3566
3465
|
* (perms) => perms.canRead
|
|
3567
|
-
* )
|
|
3568
|
-
* console.log(allCanRead) // true
|
|
3466
|
+
* ) // => true
|
|
3569
3467
|
*
|
|
3570
3468
|
* // Check if all users can write
|
|
3571
|
-
*
|
|
3469
|
+
* yield* TxHashMap.every(
|
|
3572
3470
|
* permissions,
|
|
3573
3471
|
* (perms) => perms.canWrite
|
|
3574
|
-
* )
|
|
3575
|
-
* console.log(allCanWrite) // false
|
|
3472
|
+
* ) // => false
|
|
3576
3473
|
*
|
|
3577
3474
|
* // Data-last usage with pipe
|
|
3578
|
-
*
|
|
3475
|
+
* return yield* permissions.pipe(
|
|
3579
3476
|
* TxHashMap.every((perms, username) => perms.canRead && username.length > 2)
|
|
3580
3477
|
* )
|
|
3581
|
-
* console.log(allHaveBasicAccess) // true
|
|
3582
3478
|
* })
|
|
3479
|
+
*
|
|
3480
|
+
* await Effect.runPromise(program) // => true
|
|
3583
3481
|
* ```
|
|
3584
3482
|
*
|
|
3585
|
-
* @category
|
|
3483
|
+
* @category predicates
|
|
3586
3484
|
* @since 4.0.0
|
|
3587
3485
|
*/
|
|
3588
3486
|
<K, V>(predicate: (value: V, key: K) => boolean): (self: TxHashMap<K, V>) => Effect.Effect<boolean>
|
|
@@ -3591,7 +3489,7 @@ export const every: {
|
|
|
3591
3489
|
*
|
|
3592
3490
|
* **Example** (Checking whether every entry matches)
|
|
3593
3491
|
*
|
|
3594
|
-
* ```ts
|
|
3492
|
+
* ```ts import.meta.vitest
|
|
3595
3493
|
* import { Effect, TxHashMap } from "effect"
|
|
3596
3494
|
*
|
|
3597
3495
|
* const program = Effect.gen(function*() {
|
|
@@ -3603,28 +3501,27 @@ export const every: {
|
|
|
3603
3501
|
* )
|
|
3604
3502
|
*
|
|
3605
3503
|
* // Check if all users can read
|
|
3606
|
-
*
|
|
3504
|
+
* yield* TxHashMap.every(
|
|
3607
3505
|
* permissions,
|
|
3608
3506
|
* (perms) => perms.canRead
|
|
3609
|
-
* )
|
|
3610
|
-
* console.log(allCanRead) // true
|
|
3507
|
+
* ) // => true
|
|
3611
3508
|
*
|
|
3612
3509
|
* // Check if all users can write
|
|
3613
|
-
*
|
|
3510
|
+
* yield* TxHashMap.every(
|
|
3614
3511
|
* permissions,
|
|
3615
3512
|
* (perms) => perms.canWrite
|
|
3616
|
-
* )
|
|
3617
|
-
* console.log(allCanWrite) // false
|
|
3513
|
+
* ) // => false
|
|
3618
3514
|
*
|
|
3619
3515
|
* // Data-last usage with pipe
|
|
3620
|
-
*
|
|
3516
|
+
* return yield* permissions.pipe(
|
|
3621
3517
|
* TxHashMap.every((perms, username) => perms.canRead && username.length > 2)
|
|
3622
3518
|
* )
|
|
3623
|
-
* console.log(allHaveBasicAccess) // true
|
|
3624
3519
|
* })
|
|
3520
|
+
*
|
|
3521
|
+
* await Effect.runPromise(program) // => true
|
|
3625
3522
|
* ```
|
|
3626
3523
|
*
|
|
3627
|
-
* @category
|
|
3524
|
+
* @category predicates
|
|
3628
3525
|
* @since 4.0.0
|
|
3629
3526
|
*/
|
|
3630
3527
|
<K, V>(self: TxHashMap<K, V>, predicate: (value: V, key: K) => boolean): Effect.Effect<boolean>
|
|
@@ -3642,8 +3539,8 @@ export const every: {
|
|
|
3642
3539
|
*
|
|
3643
3540
|
* **Example** (Running effects for each entry)
|
|
3644
3541
|
*
|
|
3645
|
-
* ```ts
|
|
3646
|
-
* import {
|
|
3542
|
+
* ```ts import.meta.vitest
|
|
3543
|
+
* import { Effect, TxHashMap } from "effect"
|
|
3647
3544
|
*
|
|
3648
3545
|
* const program = Effect.gen(function*() {
|
|
3649
3546
|
* // Create a log processing map
|
|
@@ -3653,26 +3550,17 @@ export const every: {
|
|
|
3653
3550
|
* ["debug.log", { size: 512, level: "debug" }]
|
|
3654
3551
|
* )
|
|
3655
3552
|
*
|
|
3656
|
-
*
|
|
3553
|
+
* const messages: Array<string> = []
|
|
3657
3554
|
* yield* TxHashMap.forEach(logs, (logInfo, filename) =>
|
|
3658
|
-
* Effect.
|
|
3659
|
-
*
|
|
3660
|
-
* `Processing ${filename}: ${logInfo.size} bytes, level: ${logInfo.level}`
|
|
3661
|
-
* )
|
|
3662
|
-
* if (logInfo.level === "error") {
|
|
3663
|
-
* yield* Console.log(`⚠️ Error log detected: ${filename}`)
|
|
3664
|
-
* }
|
|
3555
|
+
* Effect.sync(() => {
|
|
3556
|
+
* messages.push(`${filename}: ${logInfo.size} bytes (${logInfo.level})`)
|
|
3665
3557
|
* }))
|
|
3666
3558
|
*
|
|
3667
|
-
*
|
|
3668
|
-
* yield* logs.pipe(
|
|
3669
|
-
* TxHashMap.forEach((logInfo) =>
|
|
3670
|
-
* logInfo.size > 1000
|
|
3671
|
-
* ? Console.log(`Large log file: ${logInfo.size} bytes`)
|
|
3672
|
-
* : Effect.void
|
|
3673
|
-
* )
|
|
3674
|
-
* )
|
|
3559
|
+
* return messages.sort()
|
|
3675
3560
|
* })
|
|
3561
|
+
*
|
|
3562
|
+
* const result = await Effect.runPromise(program)
|
|
3563
|
+
* result // => ["access.log: 2048 bytes (info)", "debug.log: 512 bytes (debug)", "error.log: 1024 bytes (error)"]
|
|
3676
3564
|
* ```
|
|
3677
3565
|
*
|
|
3678
3566
|
* @category combinators
|
|
@@ -3685,8 +3573,8 @@ export const forEach: {
|
|
|
3685
3573
|
*
|
|
3686
3574
|
* **Example** (Running effects for each entry)
|
|
3687
3575
|
*
|
|
3688
|
-
* ```ts
|
|
3689
|
-
* import {
|
|
3576
|
+
* ```ts import.meta.vitest
|
|
3577
|
+
* import { Effect, TxHashMap } from "effect"
|
|
3690
3578
|
*
|
|
3691
3579
|
* const program = Effect.gen(function*() {
|
|
3692
3580
|
* // Create a log processing map
|
|
@@ -3696,26 +3584,17 @@ export const forEach: {
|
|
|
3696
3584
|
* ["debug.log", { size: 512, level: "debug" }]
|
|
3697
3585
|
* )
|
|
3698
3586
|
*
|
|
3699
|
-
*
|
|
3587
|
+
* const messages: Array<string> = []
|
|
3700
3588
|
* yield* TxHashMap.forEach(logs, (logInfo, filename) =>
|
|
3701
|
-
* Effect.
|
|
3702
|
-
*
|
|
3703
|
-
* `Processing ${filename}: ${logInfo.size} bytes, level: ${logInfo.level}`
|
|
3704
|
-
* )
|
|
3705
|
-
* if (logInfo.level === "error") {
|
|
3706
|
-
* yield* Console.log(`⚠️ Error log detected: ${filename}`)
|
|
3707
|
-
* }
|
|
3589
|
+
* Effect.sync(() => {
|
|
3590
|
+
* messages.push(`${filename}: ${logInfo.size} bytes (${logInfo.level})`)
|
|
3708
3591
|
* }))
|
|
3709
3592
|
*
|
|
3710
|
-
*
|
|
3711
|
-
* yield* logs.pipe(
|
|
3712
|
-
* TxHashMap.forEach((logInfo) =>
|
|
3713
|
-
* logInfo.size > 1000
|
|
3714
|
-
* ? Console.log(`Large log file: ${logInfo.size} bytes`)
|
|
3715
|
-
* : Effect.void
|
|
3716
|
-
* )
|
|
3717
|
-
* )
|
|
3593
|
+
* return messages.sort()
|
|
3718
3594
|
* })
|
|
3595
|
+
*
|
|
3596
|
+
* const result = await Effect.runPromise(program)
|
|
3597
|
+
* result // => ["access.log: 2048 bytes (info)", "debug.log: 512 bytes (debug)", "error.log: 1024 bytes (error)"]
|
|
3719
3598
|
* ```
|
|
3720
3599
|
*
|
|
3721
3600
|
* @category combinators
|
|
@@ -3728,8 +3607,8 @@ export const forEach: {
|
|
|
3728
3607
|
*
|
|
3729
3608
|
* **Example** (Running effects for each entry)
|
|
3730
3609
|
*
|
|
3731
|
-
* ```ts
|
|
3732
|
-
* import {
|
|
3610
|
+
* ```ts import.meta.vitest
|
|
3611
|
+
* import { Effect, TxHashMap } from "effect"
|
|
3733
3612
|
*
|
|
3734
3613
|
* const program = Effect.gen(function*() {
|
|
3735
3614
|
* // Create a log processing map
|
|
@@ -3739,26 +3618,17 @@ export const forEach: {
|
|
|
3739
3618
|
* ["debug.log", { size: 512, level: "debug" }]
|
|
3740
3619
|
* )
|
|
3741
3620
|
*
|
|
3742
|
-
*
|
|
3621
|
+
* const messages: Array<string> = []
|
|
3743
3622
|
* yield* TxHashMap.forEach(logs, (logInfo, filename) =>
|
|
3744
|
-
* Effect.
|
|
3745
|
-
*
|
|
3746
|
-
* `Processing ${filename}: ${logInfo.size} bytes, level: ${logInfo.level}`
|
|
3747
|
-
* )
|
|
3748
|
-
* if (logInfo.level === "error") {
|
|
3749
|
-
* yield* Console.log(`⚠️ Error log detected: ${filename}`)
|
|
3750
|
-
* }
|
|
3623
|
+
* Effect.sync(() => {
|
|
3624
|
+
* messages.push(`${filename}: ${logInfo.size} bytes (${logInfo.level})`)
|
|
3751
3625
|
* }))
|
|
3752
3626
|
*
|
|
3753
|
-
*
|
|
3754
|
-
* yield* logs.pipe(
|
|
3755
|
-
* TxHashMap.forEach((logInfo) =>
|
|
3756
|
-
* logInfo.size > 1000
|
|
3757
|
-
* ? Console.log(`Large log file: ${logInfo.size} bytes`)
|
|
3758
|
-
* : Effect.void
|
|
3759
|
-
* )
|
|
3760
|
-
* )
|
|
3627
|
+
* return messages.sort()
|
|
3761
3628
|
* })
|
|
3629
|
+
*
|
|
3630
|
+
* const result = await Effect.runPromise(program)
|
|
3631
|
+
* result // => ["access.log: 2048 bytes (info)", "debug.log: 512 bytes (debug)", "error.log: 1024 bytes (error)"]
|
|
3762
3632
|
* ```
|
|
3763
3633
|
*
|
|
3764
3634
|
* @category combinators
|
|
@@ -3788,8 +3658,8 @@ export const forEach: {
|
|
|
3788
3658
|
*
|
|
3789
3659
|
* **Example** (Flat mapping entries)
|
|
3790
3660
|
*
|
|
3791
|
-
* ```ts
|
|
3792
|
-
* import { Effect, TxHashMap } from "effect"
|
|
3661
|
+
* ```ts import.meta.vitest
|
|
3662
|
+
* import { Effect, Option, TxHashMap } from "effect"
|
|
3793
3663
|
*
|
|
3794
3664
|
* const program = Effect.gen(function*() {
|
|
3795
3665
|
* // Create a department-employee map
|
|
@@ -3817,15 +3687,12 @@ export const forEach: {
|
|
|
3817
3687
|
* )
|
|
3818
3688
|
*
|
|
3819
3689
|
* // Check the flattened result
|
|
3820
|
-
*
|
|
3821
|
-
*
|
|
3822
|
-
*
|
|
3823
|
-
* const charlie = yield* TxHashMap.get(employeeDetails, "charlie")
|
|
3824
|
-
* console.log(charlie) // Option.some({ department: "marketing", role: "lead" })
|
|
3825
|
-
*
|
|
3826
|
-
* const size = yield* TxHashMap.size(employeeDetails)
|
|
3827
|
-
* console.log(size) // 4 (all employees)
|
|
3690
|
+
* yield* TxHashMap.get(employeeDetails, "alice") // => Option.some({ department: "engineering", role: "lead" })
|
|
3691
|
+
* yield* TxHashMap.get(employeeDetails, "charlie") // => Option.some({ department: "marketing", role: "lead" })
|
|
3692
|
+
* return yield* TxHashMap.size(employeeDetails)
|
|
3828
3693
|
* })
|
|
3694
|
+
*
|
|
3695
|
+
* await Effect.runPromise(program) // => 4
|
|
3829
3696
|
* ```
|
|
3830
3697
|
*
|
|
3831
3698
|
* @category combinators
|
|
@@ -3842,8 +3709,8 @@ export const flatMap: {
|
|
|
3842
3709
|
*
|
|
3843
3710
|
* **Example** (Flat mapping entries)
|
|
3844
3711
|
*
|
|
3845
|
-
* ```ts
|
|
3846
|
-
* import { Effect, TxHashMap } from "effect"
|
|
3712
|
+
* ```ts import.meta.vitest
|
|
3713
|
+
* import { Effect, Option, TxHashMap } from "effect"
|
|
3847
3714
|
*
|
|
3848
3715
|
* const program = Effect.gen(function*() {
|
|
3849
3716
|
* // Create a department-employee map
|
|
@@ -3871,15 +3738,12 @@ export const flatMap: {
|
|
|
3871
3738
|
* )
|
|
3872
3739
|
*
|
|
3873
3740
|
* // Check the flattened result
|
|
3874
|
-
*
|
|
3875
|
-
*
|
|
3876
|
-
*
|
|
3877
|
-
* const charlie = yield* TxHashMap.get(employeeDetails, "charlie")
|
|
3878
|
-
* console.log(charlie) // Option.some({ department: "marketing", role: "lead" })
|
|
3879
|
-
*
|
|
3880
|
-
* const size = yield* TxHashMap.size(employeeDetails)
|
|
3881
|
-
* console.log(size) // 4 (all employees)
|
|
3741
|
+
* yield* TxHashMap.get(employeeDetails, "alice") // => Option.some({ department: "engineering", role: "lead" })
|
|
3742
|
+
* yield* TxHashMap.get(employeeDetails, "charlie") // => Option.some({ department: "marketing", role: "lead" })
|
|
3743
|
+
* return yield* TxHashMap.size(employeeDetails)
|
|
3882
3744
|
* })
|
|
3745
|
+
*
|
|
3746
|
+
* await Effect.runPromise(program) // => 4
|
|
3883
3747
|
* ```
|
|
3884
3748
|
*
|
|
3885
3749
|
* @category combinators
|
|
@@ -3896,8 +3760,8 @@ export const flatMap: {
|
|
|
3896
3760
|
*
|
|
3897
3761
|
* **Example** (Flat mapping entries)
|
|
3898
3762
|
*
|
|
3899
|
-
* ```ts
|
|
3900
|
-
* import { Effect, TxHashMap } from "effect"
|
|
3763
|
+
* ```ts import.meta.vitest
|
|
3764
|
+
* import { Effect, Option, TxHashMap } from "effect"
|
|
3901
3765
|
*
|
|
3902
3766
|
* const program = Effect.gen(function*() {
|
|
3903
3767
|
* // Create a department-employee map
|
|
@@ -3925,15 +3789,12 @@ export const flatMap: {
|
|
|
3925
3789
|
* )
|
|
3926
3790
|
*
|
|
3927
3791
|
* // Check the flattened result
|
|
3928
|
-
*
|
|
3929
|
-
*
|
|
3930
|
-
*
|
|
3931
|
-
* const charlie = yield* TxHashMap.get(employeeDetails, "charlie")
|
|
3932
|
-
* console.log(charlie) // Option.some({ department: "marketing", role: "lead" })
|
|
3933
|
-
*
|
|
3934
|
-
* const size = yield* TxHashMap.size(employeeDetails)
|
|
3935
|
-
* console.log(size) // 4 (all employees)
|
|
3792
|
+
* yield* TxHashMap.get(employeeDetails, "alice") // => Option.some({ department: "engineering", role: "lead" })
|
|
3793
|
+
* yield* TxHashMap.get(employeeDetails, "charlie") // => Option.some({ department: "marketing", role: "lead" })
|
|
3794
|
+
* return yield* TxHashMap.size(employeeDetails)
|
|
3936
3795
|
* })
|
|
3796
|
+
*
|
|
3797
|
+
* await Effect.runPromise(program) // => 4
|
|
3937
3798
|
* ```
|
|
3938
3799
|
*
|
|
3939
3800
|
* @category combinators
|
|
@@ -3961,8 +3822,8 @@ export const flatMap: {
|
|
|
3961
3822
|
*
|
|
3962
3823
|
* **Example** (Flat mapping entries)
|
|
3963
3824
|
*
|
|
3964
|
-
* ```ts
|
|
3965
|
-
* import { Effect, TxHashMap } from "effect"
|
|
3825
|
+
* ```ts import.meta.vitest
|
|
3826
|
+
* import { Effect, Option, TxHashMap } from "effect"
|
|
3966
3827
|
*
|
|
3967
3828
|
* const program = Effect.gen(function*() {
|
|
3968
3829
|
* // Create a department-employee map
|
|
@@ -3990,15 +3851,12 @@ export const flatMap: {
|
|
|
3990
3851
|
* )
|
|
3991
3852
|
*
|
|
3992
3853
|
* // Check the flattened result
|
|
3993
|
-
*
|
|
3994
|
-
*
|
|
3995
|
-
*
|
|
3996
|
-
* const charlie = yield* TxHashMap.get(employeeDetails, "charlie")
|
|
3997
|
-
* console.log(charlie) // Option.some({ department: "marketing", role: "lead" })
|
|
3998
|
-
*
|
|
3999
|
-
* const size = yield* TxHashMap.size(employeeDetails)
|
|
4000
|
-
* console.log(size) // 4 (all employees)
|
|
3854
|
+
* yield* TxHashMap.get(employeeDetails, "alice") // => Option.some({ department: "engineering", role: "lead" })
|
|
3855
|
+
* yield* TxHashMap.get(employeeDetails, "charlie") // => Option.some({ department: "marketing", role: "lead" })
|
|
3856
|
+
* return yield* TxHashMap.size(employeeDetails)
|
|
4001
3857
|
* })
|
|
3858
|
+
*
|
|
3859
|
+
* await Effect.runPromise(program) // => 4
|
|
4002
3860
|
* ```
|
|
4003
3861
|
*
|
|
4004
3862
|
* @category combinators
|
|
@@ -4014,8 +3872,8 @@ export const flatMap: {
|
|
|
4014
3872
|
*
|
|
4015
3873
|
* **Example** (Flat mapping entries)
|
|
4016
3874
|
*
|
|
4017
|
-
* ```ts
|
|
4018
|
-
* import { Effect, TxHashMap } from "effect"
|
|
3875
|
+
* ```ts import.meta.vitest
|
|
3876
|
+
* import { Effect, Option, TxHashMap } from "effect"
|
|
4019
3877
|
*
|
|
4020
3878
|
* const program = Effect.gen(function*() {
|
|
4021
3879
|
* // Create a department-employee map
|
|
@@ -4043,15 +3901,12 @@ export const flatMap: {
|
|
|
4043
3901
|
* )
|
|
4044
3902
|
*
|
|
4045
3903
|
* // Check the flattened result
|
|
4046
|
-
*
|
|
4047
|
-
*
|
|
4048
|
-
*
|
|
4049
|
-
* const charlie = yield* TxHashMap.get(employeeDetails, "charlie")
|
|
4050
|
-
* console.log(charlie) // Option.some({ department: "marketing", role: "lead" })
|
|
4051
|
-
*
|
|
4052
|
-
* const size = yield* TxHashMap.size(employeeDetails)
|
|
4053
|
-
* console.log(size) // 4 (all employees)
|
|
3904
|
+
* yield* TxHashMap.get(employeeDetails, "alice") // => Option.some({ department: "engineering", role: "lead" })
|
|
3905
|
+
* yield* TxHashMap.get(employeeDetails, "charlie") // => Option.some({ department: "marketing", role: "lead" })
|
|
3906
|
+
* return yield* TxHashMap.size(employeeDetails)
|
|
4054
3907
|
* })
|
|
3908
|
+
*
|
|
3909
|
+
* await Effect.runPromise(program) // => 4
|
|
4055
3910
|
* ```
|
|
4056
3911
|
*
|
|
4057
3912
|
* @category combinators
|
|
@@ -4080,7 +3935,7 @@ export const flatMap: {
|
|
|
4080
3935
|
*
|
|
4081
3936
|
* **Example** (Compacting optional values)
|
|
4082
3937
|
*
|
|
4083
|
-
* ```ts
|
|
3938
|
+
* ```ts import.meta.vitest
|
|
4084
3939
|
* import { Effect, Option, TxHashMap } from "effect"
|
|
4085
3940
|
*
|
|
4086
3941
|
* const program = Effect.gen(function*() {
|
|
@@ -4099,21 +3954,17 @@ export const flatMap: {
|
|
|
4099
3954
|
* // Remove all None values and unwrap Some values
|
|
4100
3955
|
* const validUsers = yield* TxHashMap.compact(userData)
|
|
4101
3956
|
*
|
|
4102
|
-
*
|
|
4103
|
-
* console.log(size) // 3 (alice, charlie, eve)
|
|
4104
|
-
*
|
|
4105
|
-
* const alice = yield* TxHashMap.get(validUsers, "alice")
|
|
4106
|
-
* console.log(alice) // Option.some({ age: 30, email: "alice@example.com" })
|
|
3957
|
+
* yield* TxHashMap.size(validUsers) // => 3
|
|
4107
3958
|
*
|
|
4108
|
-
*
|
|
4109
|
-
*
|
|
3959
|
+
* yield* TxHashMap.get(validUsers, "alice") // => Option.some({ age: 30, email: "alice@example.com" })
|
|
3960
|
+
* yield* TxHashMap.get(validUsers, "bob") // => Option.none()
|
|
4110
3961
|
*
|
|
4111
3962
|
* // Useful for cleaning up optional data processing results
|
|
4112
3963
|
* const userAges = yield* TxHashMap.map(validUsers, (user) => user.age)
|
|
4113
|
-
*
|
|
4114
|
-
* const sortedAgeEntries = ageEntries.toSorted(([left], [right]) => left.localeCompare(right))
|
|
4115
|
-
* console.log(sortedAgeEntries) // [["alice", 30], ["charlie", 25], ["eve", 28]]
|
|
3964
|
+
* return (yield* TxHashMap.entries(userAges)).toSorted(([left], [right]) => left.localeCompare(right))
|
|
4116
3965
|
* })
|
|
3966
|
+
*
|
|
3967
|
+
* await Effect.runPromise(program) // => [["alice", 30], ["charlie", 25], ["eve", 28]]
|
|
4117
3968
|
* ```
|
|
4118
3969
|
*
|
|
4119
3970
|
* @category combinators
|
|
@@ -4134,7 +3985,7 @@ export const compact = <K, A>(
|
|
|
4134
3985
|
*
|
|
4135
3986
|
* **Example** (Converting to entries)
|
|
4136
3987
|
*
|
|
4137
|
-
* ```ts
|
|
3988
|
+
* ```ts import.meta.vitest
|
|
4138
3989
|
* import { Effect, TxHashMap } from "effect"
|
|
4139
3990
|
*
|
|
4140
3991
|
* const program = Effect.gen(function*() {
|
|
@@ -4145,24 +3996,18 @@ export const compact = <K, A>(
|
|
|
4145
3996
|
* )
|
|
4146
3997
|
*
|
|
4147
3998
|
* // Get all entries as an array
|
|
4148
|
-
* const
|
|
4149
|
-
*
|
|
4150
|
-
*
|
|
4151
|
-
* // [["language", "en-US"], ["theme", "dark"], ["timezone", "UTC"]]
|
|
4152
|
-
*
|
|
4153
|
-
* // Process entries
|
|
4154
|
-
* for (const [setting, value] of sortedEntries) {
|
|
4155
|
-
* console.log(`${setting}: ${value}`)
|
|
4156
|
-
* }
|
|
3999
|
+
* const sortedEntries = (yield* TxHashMap.toEntries(settings))
|
|
4000
|
+
* .toSorted(([left], [right]) => left.localeCompare(right))
|
|
4001
|
+
* sortedEntries // => [["language", "en-US"], ["theme", "dark"], ["timezone", "UTC"]]
|
|
4157
4002
|
*
|
|
4158
|
-
* // Convert to object
|
|
4159
|
-
*
|
|
4160
|
-
* console.log(JSON.stringify(settingsObj))
|
|
4161
|
-
* // {"language":"en-US","theme":"dark","timezone":"UTC"}
|
|
4003
|
+
* // Convert to an object
|
|
4004
|
+
* return Object.fromEntries(sortedEntries)
|
|
4162
4005
|
* })
|
|
4006
|
+
*
|
|
4007
|
+
* await Effect.runPromise(program) // => { language: "en-US", theme: "dark", timezone: "UTC" }
|
|
4163
4008
|
* ```
|
|
4164
4009
|
*
|
|
4165
|
-
* @category
|
|
4010
|
+
* @category getters
|
|
4166
4011
|
* @since 4.0.0
|
|
4167
4012
|
*/
|
|
4168
4013
|
export const toEntries = <K, V>(
|
|
@@ -4175,7 +4020,7 @@ export const toEntries = <K, V>(
|
|
|
4175
4020
|
*
|
|
4176
4021
|
* **Example** (Converting to values)
|
|
4177
4022
|
*
|
|
4178
|
-
* ```ts
|
|
4023
|
+
* ```ts import.meta.vitest
|
|
4179
4024
|
* import { Effect, TxHashMap } from "effect"
|
|
4180
4025
|
*
|
|
4181
4026
|
* const program = Effect.gen(function*() {
|
|
@@ -4187,22 +4032,23 @@ export const toEntries = <K, V>(
|
|
|
4187
4032
|
*
|
|
4188
4033
|
* // Get all product information
|
|
4189
4034
|
* const products = yield* TxHashMap.toValues(inventory)
|
|
4190
|
-
*
|
|
4035
|
+
* products.length // => 3
|
|
4191
4036
|
*
|
|
4192
4037
|
* // Calculate total inventory value
|
|
4193
4038
|
* const totalValue = products.reduce(
|
|
4194
4039
|
* (sum, product) => sum + (product.price * product.stock),
|
|
4195
4040
|
* 0
|
|
4196
4041
|
* )
|
|
4197
|
-
*
|
|
4042
|
+
* totalValue // => 8025
|
|
4198
4043
|
*
|
|
4199
4044
|
* // Find products with low stock
|
|
4200
|
-
*
|
|
4201
|
-
* console.log(`${lowStockProducts.length} product with low stock`) // 1 product with low stock
|
|
4045
|
+
* return products.filter((product) => product.stock < 10).length
|
|
4202
4046
|
* })
|
|
4047
|
+
*
|
|
4048
|
+
* await Effect.runPromise(program) // => 1
|
|
4203
4049
|
* ```
|
|
4204
4050
|
*
|
|
4205
|
-
* @category
|
|
4051
|
+
* @category getters
|
|
4206
4052
|
* @since 4.0.0
|
|
4207
4053
|
*/
|
|
4208
4054
|
export const toValues = <K, V>(self: TxHashMap<K, V>): Effect.Effect<Array<V>> => values(self)
|