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/Cache.ts
CHANGED
|
@@ -32,7 +32,7 @@ const TypeId = "~effect/Cache"
|
|
|
32
32
|
*
|
|
33
33
|
* **Example** (Creating a basic cache)
|
|
34
34
|
*
|
|
35
|
-
* ```ts
|
|
35
|
+
* ```ts import.meta.vitest
|
|
36
36
|
* import { Cache, Effect } from "effect"
|
|
37
37
|
*
|
|
38
38
|
* // Basic cache with string keys and number values
|
|
@@ -49,12 +49,15 @@ const TypeId = "~effect/Cache"
|
|
|
49
49
|
*
|
|
50
50
|
* return [value1, value2, value3]
|
|
51
51
|
* })
|
|
52
|
+
*
|
|
53
|
+
* const actual = await Effect.runPromise(program)
|
|
54
|
+
* actual // => [5, 5, 5]
|
|
52
55
|
* ```
|
|
53
56
|
*
|
|
54
57
|
* **Example** (Handling lookup failures)
|
|
55
58
|
*
|
|
56
|
-
* ```ts
|
|
57
|
-
* import { Cache, Effect } from "effect"
|
|
59
|
+
* ```ts import.meta.vitest
|
|
60
|
+
* import { Cache, Effect, Exit } from "effect"
|
|
58
61
|
*
|
|
59
62
|
* // Cache with error handling
|
|
60
63
|
* const program = Effect.gen(function*() {
|
|
@@ -67,16 +70,19 @@ const TypeId = "~effect/Cache"
|
|
|
67
70
|
* })
|
|
68
71
|
*
|
|
69
72
|
* // Handle successful and failed lookups
|
|
70
|
-
* const success = yield* Cache.get(cache, "test")
|
|
71
|
-
* const failure = yield* Effect.exit(Cache.get(cache, "error"))
|
|
73
|
+
* const success = yield* Cache.get(cache, "test")
|
|
74
|
+
* const failure = yield* Effect.exit(Cache.get(cache, "error"))
|
|
72
75
|
*
|
|
73
|
-
* return
|
|
76
|
+
* return [success, failure] as const
|
|
74
77
|
* })
|
|
78
|
+
*
|
|
79
|
+
* const actual = await Effect.runPromise(program)
|
|
80
|
+
* actual // => [4, Exit.fail("Lookup failed")]
|
|
75
81
|
* ```
|
|
76
82
|
*
|
|
77
83
|
* **Example** (Using complex keys with TTL)
|
|
78
84
|
*
|
|
79
|
-
* ```ts
|
|
85
|
+
* ```ts import.meta.vitest
|
|
80
86
|
* import { Cache, Data, Duration, Effect } from "effect"
|
|
81
87
|
*
|
|
82
88
|
* // Cache with complex key types and TTL
|
|
@@ -92,8 +98,11 @@ const TypeId = "~effect/Cache"
|
|
|
92
98
|
* const userId = new UserId({ id: 123 })
|
|
93
99
|
* const userName = yield* Cache.get(userCache, userId)
|
|
94
100
|
*
|
|
95
|
-
* return userName
|
|
101
|
+
* return userName
|
|
96
102
|
* })
|
|
103
|
+
*
|
|
104
|
+
* const actual = await Effect.runPromise(program)
|
|
105
|
+
* actual // => "User-123"
|
|
97
106
|
* ```
|
|
98
107
|
*
|
|
99
108
|
* @category models
|
|
@@ -148,11 +157,11 @@ export interface Entry<A, E> {
|
|
|
148
157
|
*
|
|
149
158
|
* **Example** (Configuring dynamic time to live)
|
|
150
159
|
*
|
|
151
|
-
* ```ts
|
|
160
|
+
* ```ts import.meta.vitest
|
|
152
161
|
* import { Cache, Effect, Exit } from "effect"
|
|
153
162
|
*
|
|
154
163
|
* // Cache with TTL based on computed value
|
|
155
|
-
* const
|
|
164
|
+
* const program = Effect.gen(function*() {
|
|
156
165
|
* const cache = yield* Cache.makeWith(
|
|
157
166
|
* (id: number) => Effect.succeed({ id, active: id % 2 === 0 }),
|
|
158
167
|
* {
|
|
@@ -167,8 +176,11 @@ export interface Entry<A, E> {
|
|
|
167
176
|
* }
|
|
168
177
|
* )
|
|
169
178
|
*
|
|
170
|
-
* return cache
|
|
179
|
+
* return cache.capacity
|
|
171
180
|
* })
|
|
181
|
+
*
|
|
182
|
+
* const actual = await Effect.runPromise(program)
|
|
183
|
+
* actual // => 1000
|
|
172
184
|
* ```
|
|
173
185
|
*
|
|
174
186
|
* @see {@link make} for a simpler cache constructor with a fixed time-to-live for all entries
|
|
@@ -215,7 +227,7 @@ export const makeWith = <
|
|
|
215
227
|
*
|
|
216
228
|
* **Example** (Creating a basic cache)
|
|
217
229
|
*
|
|
218
|
-
* ```ts
|
|
230
|
+
* ```ts import.meta.vitest
|
|
219
231
|
* import { Cache, Effect } from "effect"
|
|
220
232
|
*
|
|
221
233
|
* // Basic cache with string keys
|
|
@@ -227,13 +239,16 @@ export const makeWith = <
|
|
|
227
239
|
*
|
|
228
240
|
* const result1 = yield* Cache.get(cache, "hello")
|
|
229
241
|
* const result2 = yield* Cache.get(cache, "world")
|
|
230
|
-
*
|
|
242
|
+
* return { result1, result2 }
|
|
231
243
|
* })
|
|
244
|
+
*
|
|
245
|
+
* const actual = await Effect.runPromise(program)
|
|
246
|
+
* actual // => { result1: 5, result2: 5 }
|
|
232
247
|
* ```
|
|
233
248
|
*
|
|
234
249
|
* **Example** (Creating a cache with TTL)
|
|
235
250
|
*
|
|
236
|
-
* ```ts
|
|
251
|
+
* ```ts import.meta.vitest
|
|
237
252
|
* import { Cache, Effect } from "effect"
|
|
238
253
|
*
|
|
239
254
|
* const program = Effect.gen(function*() {
|
|
@@ -259,11 +274,12 @@ export const makeWith = <
|
|
|
259
274
|
* })
|
|
260
275
|
*
|
|
261
276
|
* const user1 = yield* Cache.get(cache, 123)
|
|
262
|
-
* console.log(user1) // { name: "Ada", email: "ada@example.com" }
|
|
263
|
-
*
|
|
264
277
|
* const user2 = yield* Cache.get(cache, 123)
|
|
265
|
-
*
|
|
278
|
+
* return [user1, user2, user1 === user2] as const
|
|
266
279
|
* })
|
|
280
|
+
*
|
|
281
|
+
* const actual = await Effect.runPromise(program)
|
|
282
|
+
* actual // => [{ name: "Ada", email: "ada@example.com" }, { name: "Ada", email: "ada@example.com" }, true]
|
|
267
283
|
* ```
|
|
268
284
|
*
|
|
269
285
|
* @category constructors
|
|
@@ -318,7 +334,7 @@ const defaultTimeToLive = <A, E>(_: Exit.Exit<A, E>, _key: unknown): Duration.Du
|
|
|
318
334
|
*
|
|
319
335
|
* **Example** (Getting cached values)
|
|
320
336
|
*
|
|
321
|
-
* ```ts
|
|
337
|
+
* ```ts import.meta.vitest
|
|
322
338
|
* import { Cache, Effect } from "effect"
|
|
323
339
|
*
|
|
324
340
|
* const program = Effect.gen(function*() {
|
|
@@ -329,20 +345,21 @@ const defaultTimeToLive = <A, E>(_: Exit.Exit<A, E>, _key: unknown): Duration.Du
|
|
|
329
345
|
*
|
|
330
346
|
* // Cache miss - triggers lookup function
|
|
331
347
|
* const result1 = yield* Cache.get(cache, "hello")
|
|
332
|
-
* console.log(result1) // 5
|
|
333
348
|
*
|
|
334
349
|
* // Cache hit - returns cached value without lookup
|
|
335
350
|
* const result2 = yield* Cache.get(cache, "hello")
|
|
336
|
-
* console.log(result2) // 5 (from cache)
|
|
337
351
|
*
|
|
338
352
|
* return { result1, result2 }
|
|
339
353
|
* })
|
|
354
|
+
*
|
|
355
|
+
* const actual = await Effect.runPromise(program)
|
|
356
|
+
* actual // => { result1: 5, result2: 5 }
|
|
340
357
|
* ```
|
|
341
358
|
*
|
|
342
359
|
* **Example** (Handling lookup failures)
|
|
343
360
|
*
|
|
344
|
-
* ```ts
|
|
345
|
-
* import { Cache, Effect } from "effect"
|
|
361
|
+
* ```ts import.meta.vitest
|
|
362
|
+
* import { Cache, Effect, Exit } from "effect"
|
|
346
363
|
*
|
|
347
364
|
* // Error handling when lookup fails
|
|
348
365
|
* const program = Effect.gen(function*() {
|
|
@@ -356,17 +373,19 @@ const defaultTimeToLive = <A, E>(_: Exit.Exit<A, E>, _key: unknown): Duration.Du
|
|
|
356
373
|
*
|
|
357
374
|
* // Successful lookup
|
|
358
375
|
* const success = yield* Cache.get(cache, "hello")
|
|
359
|
-
* console.log(success) // 5
|
|
360
376
|
*
|
|
361
377
|
* // Failed lookup - returns error
|
|
362
378
|
* const failure = yield* Effect.exit(Cache.get(cache, "error"))
|
|
363
|
-
*
|
|
379
|
+
* return [success, failure] as const
|
|
364
380
|
* })
|
|
381
|
+
*
|
|
382
|
+
* const actual = await Effect.runPromise(program)
|
|
383
|
+
* actual // => [5, Exit.fail("Lookup failed")]
|
|
365
384
|
* ```
|
|
366
385
|
*
|
|
367
386
|
* **Example** (Sharing concurrent lookups)
|
|
368
387
|
*
|
|
369
|
-
* ```ts
|
|
388
|
+
* ```ts import.meta.vitest
|
|
370
389
|
* import { Cache, Effect } from "effect"
|
|
371
390
|
*
|
|
372
391
|
* // Concurrent access - multiple gets of same key only invoke lookup once
|
|
@@ -388,9 +407,11 @@ const defaultTimeToLive = <A, E>(_: Exit.Exit<A, E>, _key: unknown): Duration.Du
|
|
|
388
407
|
* Cache.get(cache, "hello")
|
|
389
408
|
* ], { concurrency: "unbounded" })
|
|
390
409
|
*
|
|
391
|
-
*
|
|
392
|
-
* console.log(lookupCount) // 1 (lookup called only once)
|
|
410
|
+
* return { results, lookupCount }
|
|
393
411
|
* })
|
|
412
|
+
*
|
|
413
|
+
* const actual = await Effect.runPromise(program)
|
|
414
|
+
* actual // => { results: [5, 5, 5], lookupCount: 1 }
|
|
394
415
|
* ```
|
|
395
416
|
*
|
|
396
417
|
* @category combinators
|
|
@@ -409,7 +430,7 @@ export const get: {
|
|
|
409
430
|
*
|
|
410
431
|
* **Example** (Getting cached values)
|
|
411
432
|
*
|
|
412
|
-
* ```ts
|
|
433
|
+
* ```ts import.meta.vitest
|
|
413
434
|
* import { Cache, Effect } from "effect"
|
|
414
435
|
*
|
|
415
436
|
* const program = Effect.gen(function*() {
|
|
@@ -420,20 +441,21 @@ export const get: {
|
|
|
420
441
|
*
|
|
421
442
|
* // Cache miss - triggers lookup function
|
|
422
443
|
* const result1 = yield* Cache.get(cache, "hello")
|
|
423
|
-
* console.log(result1) // 5
|
|
424
444
|
*
|
|
425
445
|
* // Cache hit - returns cached value without lookup
|
|
426
446
|
* const result2 = yield* Cache.get(cache, "hello")
|
|
427
|
-
* console.log(result2) // 5 (from cache)
|
|
428
447
|
*
|
|
429
448
|
* return { result1, result2 }
|
|
430
449
|
* })
|
|
450
|
+
*
|
|
451
|
+
* const actual = await Effect.runPromise(program)
|
|
452
|
+
* actual // => { result1: 5, result2: 5 }
|
|
431
453
|
* ```
|
|
432
454
|
*
|
|
433
455
|
* **Example** (Handling lookup failures)
|
|
434
456
|
*
|
|
435
|
-
* ```ts
|
|
436
|
-
* import { Cache, Effect } from "effect"
|
|
457
|
+
* ```ts import.meta.vitest
|
|
458
|
+
* import { Cache, Effect, Exit } from "effect"
|
|
437
459
|
*
|
|
438
460
|
* // Error handling when lookup fails
|
|
439
461
|
* const program = Effect.gen(function*() {
|
|
@@ -447,17 +469,19 @@ export const get: {
|
|
|
447
469
|
*
|
|
448
470
|
* // Successful lookup
|
|
449
471
|
* const success = yield* Cache.get(cache, "hello")
|
|
450
|
-
* console.log(success) // 5
|
|
451
472
|
*
|
|
452
473
|
* // Failed lookup - returns error
|
|
453
474
|
* const failure = yield* Effect.exit(Cache.get(cache, "error"))
|
|
454
|
-
*
|
|
475
|
+
* return [success, failure] as const
|
|
455
476
|
* })
|
|
477
|
+
*
|
|
478
|
+
* const actual = await Effect.runPromise(program)
|
|
479
|
+
* actual // => [5, Exit.fail("Lookup failed")]
|
|
456
480
|
* ```
|
|
457
481
|
*
|
|
458
482
|
* **Example** (Sharing concurrent lookups)
|
|
459
483
|
*
|
|
460
|
-
* ```ts
|
|
484
|
+
* ```ts import.meta.vitest
|
|
461
485
|
* import { Cache, Effect } from "effect"
|
|
462
486
|
*
|
|
463
487
|
* // Concurrent access - multiple gets of same key only invoke lookup once
|
|
@@ -479,9 +503,11 @@ export const get: {
|
|
|
479
503
|
* Cache.get(cache, "hello")
|
|
480
504
|
* ], { concurrency: "unbounded" })
|
|
481
505
|
*
|
|
482
|
-
*
|
|
483
|
-
* console.log(lookupCount) // 1 (lookup called only once)
|
|
506
|
+
* return { results, lookupCount }
|
|
484
507
|
* })
|
|
508
|
+
*
|
|
509
|
+
* const actual = await Effect.runPromise(program)
|
|
510
|
+
* actual // => { results: [5, 5, 5], lookupCount: 1 }
|
|
485
511
|
* ```
|
|
486
512
|
*
|
|
487
513
|
* @category combinators
|
|
@@ -500,7 +526,7 @@ export const get: {
|
|
|
500
526
|
*
|
|
501
527
|
* **Example** (Getting cached values)
|
|
502
528
|
*
|
|
503
|
-
* ```ts
|
|
529
|
+
* ```ts import.meta.vitest
|
|
504
530
|
* import { Cache, Effect } from "effect"
|
|
505
531
|
*
|
|
506
532
|
* const program = Effect.gen(function*() {
|
|
@@ -511,20 +537,21 @@ export const get: {
|
|
|
511
537
|
*
|
|
512
538
|
* // Cache miss - triggers lookup function
|
|
513
539
|
* const result1 = yield* Cache.get(cache, "hello")
|
|
514
|
-
* console.log(result1) // 5
|
|
515
540
|
*
|
|
516
541
|
* // Cache hit - returns cached value without lookup
|
|
517
542
|
* const result2 = yield* Cache.get(cache, "hello")
|
|
518
|
-
* console.log(result2) // 5 (from cache)
|
|
519
543
|
*
|
|
520
544
|
* return { result1, result2 }
|
|
521
545
|
* })
|
|
546
|
+
*
|
|
547
|
+
* const actual = await Effect.runPromise(program)
|
|
548
|
+
* actual // => { result1: 5, result2: 5 }
|
|
522
549
|
* ```
|
|
523
550
|
*
|
|
524
551
|
* **Example** (Handling lookup failures)
|
|
525
552
|
*
|
|
526
|
-
* ```ts
|
|
527
|
-
* import { Cache, Effect } from "effect"
|
|
553
|
+
* ```ts import.meta.vitest
|
|
554
|
+
* import { Cache, Effect, Exit } from "effect"
|
|
528
555
|
*
|
|
529
556
|
* // Error handling when lookup fails
|
|
530
557
|
* const program = Effect.gen(function*() {
|
|
@@ -538,17 +565,19 @@ export const get: {
|
|
|
538
565
|
*
|
|
539
566
|
* // Successful lookup
|
|
540
567
|
* const success = yield* Cache.get(cache, "hello")
|
|
541
|
-
* console.log(success) // 5
|
|
542
568
|
*
|
|
543
569
|
* // Failed lookup - returns error
|
|
544
570
|
* const failure = yield* Effect.exit(Cache.get(cache, "error"))
|
|
545
|
-
*
|
|
571
|
+
* return [success, failure] as const
|
|
546
572
|
* })
|
|
573
|
+
*
|
|
574
|
+
* const actual = await Effect.runPromise(program)
|
|
575
|
+
* actual // => [5, Exit.fail("Lookup failed")]
|
|
547
576
|
* ```
|
|
548
577
|
*
|
|
549
578
|
* **Example** (Sharing concurrent lookups)
|
|
550
579
|
*
|
|
551
|
-
* ```ts
|
|
580
|
+
* ```ts import.meta.vitest
|
|
552
581
|
* import { Cache, Effect } from "effect"
|
|
553
582
|
*
|
|
554
583
|
* // Concurrent access - multiple gets of same key only invoke lookup once
|
|
@@ -570,9 +599,11 @@ export const get: {
|
|
|
570
599
|
* Cache.get(cache, "hello")
|
|
571
600
|
* ], { concurrency: "unbounded" })
|
|
572
601
|
*
|
|
573
|
-
*
|
|
574
|
-
* console.log(lookupCount) // 1 (lookup called only once)
|
|
602
|
+
* return { results, lookupCount }
|
|
575
603
|
* })
|
|
604
|
+
*
|
|
605
|
+
* const actual = await Effect.runPromise(program)
|
|
606
|
+
* actual // => { results: [5, 5, 5], lookupCount: 1 }
|
|
576
607
|
* ```
|
|
577
608
|
*
|
|
578
609
|
* @category combinators
|
|
@@ -593,7 +624,10 @@ export const get: {
|
|
|
593
624
|
const entry = new EntryImpl(fiber, self.lookup(key))
|
|
594
625
|
entry.fiber.addObserver((exit) => {
|
|
595
626
|
if (effect.exitHasInterrupts(exit)) {
|
|
596
|
-
MutableHashMap.
|
|
627
|
+
const current = MutableHashMap.get(self.map, key)
|
|
628
|
+
if (Option.isSome(current) && current.value === entry) {
|
|
629
|
+
MutableHashMap.remove(self.map, key)
|
|
630
|
+
}
|
|
597
631
|
return
|
|
598
632
|
}
|
|
599
633
|
const ttl = self.timeToLive(exit, key)
|
|
@@ -667,8 +701,8 @@ const checkCapacity = <K, A, E, R>(self: Cache<K, A, E, R>) => {
|
|
|
667
701
|
*
|
|
668
702
|
* **Example** (Reading cached values without lookup)
|
|
669
703
|
*
|
|
670
|
-
* ```ts
|
|
671
|
-
* import { Cache, Effect } from "effect"
|
|
704
|
+
* ```ts import.meta.vitest
|
|
705
|
+
* import { Cache, Effect, Option } from "effect"
|
|
672
706
|
*
|
|
673
707
|
* const program = Effect.gen(function*() {
|
|
674
708
|
* const cache = yield* Cache.make({
|
|
@@ -678,23 +712,23 @@ const checkCapacity = <K, A, E, R>(self: Cache<K, A, E, R>) => {
|
|
|
678
712
|
*
|
|
679
713
|
* // No value in cache yet - returns None without lookup
|
|
680
714
|
* const empty = yield* Cache.getOption(cache, "hello")
|
|
681
|
-
* console.log(empty) // Option.none()
|
|
682
715
|
*
|
|
683
716
|
* // Populate cache using get
|
|
684
717
|
* yield* Cache.get(cache, "hello")
|
|
685
718
|
*
|
|
686
719
|
* // Now getOption returns the cached value
|
|
687
720
|
* const cached = yield* Cache.getOption(cache, "hello")
|
|
688
|
-
*
|
|
689
|
-
*
|
|
690
|
-
* return { empty, cached }
|
|
721
|
+
* return [empty, cached] as const
|
|
691
722
|
* })
|
|
723
|
+
*
|
|
724
|
+
* const actual = await Effect.runPromise(program)
|
|
725
|
+
* actual // => [Option.none(), Option.some(5)]
|
|
692
726
|
* ```
|
|
693
727
|
*
|
|
694
728
|
* **Example** (Skipping expired entries)
|
|
695
729
|
*
|
|
696
|
-
* ```ts
|
|
697
|
-
* import { Cache, Effect } from "effect"
|
|
730
|
+
* ```ts import.meta.vitest
|
|
731
|
+
* import { Cache, Effect, Option } from "effect"
|
|
698
732
|
* import { TestClock } from "effect/testing"
|
|
699
733
|
*
|
|
700
734
|
* // Expired entries return None
|
|
@@ -710,21 +744,23 @@ const checkCapacity = <K, A, E, R>(self: Cache<K, A, E, R>) => {
|
|
|
710
744
|
*
|
|
711
745
|
* // Value exists before expiration
|
|
712
746
|
* const beforeExpiry = yield* Cache.getOption(cache, "hello")
|
|
713
|
-
* console.log(beforeExpiry) // Option.some(5)
|
|
714
747
|
*
|
|
715
748
|
* // Simulate time passing
|
|
716
749
|
* yield* TestClock.adjust("2 hours")
|
|
717
750
|
*
|
|
718
751
|
* // Value expired - returns None
|
|
719
752
|
* const afterExpiry = yield* Cache.getOption(cache, "hello")
|
|
720
|
-
*
|
|
753
|
+
* return [beforeExpiry, afterExpiry] as const
|
|
721
754
|
* })
|
|
755
|
+
*
|
|
756
|
+
* const actual = await Effect.runPromise(Effect.provide(program, TestClock.layer()))
|
|
757
|
+
* actual // => [Option.some(5), Option.none()]
|
|
722
758
|
* ```
|
|
723
759
|
*
|
|
724
760
|
* **Example** (Waiting for pending lookups)
|
|
725
761
|
*
|
|
726
|
-
* ```ts
|
|
727
|
-
* import { Cache, Deferred, Effect, Fiber } from "effect"
|
|
762
|
+
* ```ts import.meta.vitest
|
|
763
|
+
* import { Cache, Deferred, Effect, Fiber, Option } from "effect"
|
|
728
764
|
*
|
|
729
765
|
* // Waits for ongoing computation to complete
|
|
730
766
|
* const program = Effect.gen(function*() {
|
|
@@ -744,11 +780,12 @@ const checkCapacity = <K, A, E, R>(self: Cache<K, A, E, R>) => {
|
|
|
744
780
|
* yield* Deferred.succeed(deferred, void 0)
|
|
745
781
|
*
|
|
746
782
|
* const result = yield* Fiber.join(optionFiber)
|
|
747
|
-
* console.log(result) // Option.some(42)
|
|
748
|
-
*
|
|
749
783
|
* const value = yield* Fiber.join(getFiber)
|
|
750
|
-
*
|
|
784
|
+
* return [result, value] as const
|
|
751
785
|
* })
|
|
786
|
+
*
|
|
787
|
+
* const actual = await Effect.runPromise(program)
|
|
788
|
+
* actual // => [Option.some(42), 42]
|
|
752
789
|
* ```
|
|
753
790
|
*
|
|
754
791
|
* @category combinators
|
|
@@ -767,8 +804,8 @@ export const getOption: {
|
|
|
767
804
|
*
|
|
768
805
|
* **Example** (Reading cached values without lookup)
|
|
769
806
|
*
|
|
770
|
-
* ```ts
|
|
771
|
-
* import { Cache, Effect } from "effect"
|
|
807
|
+
* ```ts import.meta.vitest
|
|
808
|
+
* import { Cache, Effect, Option } from "effect"
|
|
772
809
|
*
|
|
773
810
|
* const program = Effect.gen(function*() {
|
|
774
811
|
* const cache = yield* Cache.make({
|
|
@@ -778,23 +815,23 @@ export const getOption: {
|
|
|
778
815
|
*
|
|
779
816
|
* // No value in cache yet - returns None without lookup
|
|
780
817
|
* const empty = yield* Cache.getOption(cache, "hello")
|
|
781
|
-
* console.log(empty) // Option.none()
|
|
782
818
|
*
|
|
783
819
|
* // Populate cache using get
|
|
784
820
|
* yield* Cache.get(cache, "hello")
|
|
785
821
|
*
|
|
786
822
|
* // Now getOption returns the cached value
|
|
787
823
|
* const cached = yield* Cache.getOption(cache, "hello")
|
|
788
|
-
*
|
|
789
|
-
*
|
|
790
|
-
* return { empty, cached }
|
|
824
|
+
* return [empty, cached] as const
|
|
791
825
|
* })
|
|
826
|
+
*
|
|
827
|
+
* const actual = await Effect.runPromise(program)
|
|
828
|
+
* actual // => [Option.none(), Option.some(5)]
|
|
792
829
|
* ```
|
|
793
830
|
*
|
|
794
831
|
* **Example** (Skipping expired entries)
|
|
795
832
|
*
|
|
796
|
-
* ```ts
|
|
797
|
-
* import { Cache, Effect } from "effect"
|
|
833
|
+
* ```ts import.meta.vitest
|
|
834
|
+
* import { Cache, Effect, Option } from "effect"
|
|
798
835
|
* import { TestClock } from "effect/testing"
|
|
799
836
|
*
|
|
800
837
|
* // Expired entries return None
|
|
@@ -810,21 +847,23 @@ export const getOption: {
|
|
|
810
847
|
*
|
|
811
848
|
* // Value exists before expiration
|
|
812
849
|
* const beforeExpiry = yield* Cache.getOption(cache, "hello")
|
|
813
|
-
* console.log(beforeExpiry) // Option.some(5)
|
|
814
850
|
*
|
|
815
851
|
* // Simulate time passing
|
|
816
852
|
* yield* TestClock.adjust("2 hours")
|
|
817
853
|
*
|
|
818
854
|
* // Value expired - returns None
|
|
819
855
|
* const afterExpiry = yield* Cache.getOption(cache, "hello")
|
|
820
|
-
*
|
|
856
|
+
* return [beforeExpiry, afterExpiry] as const
|
|
821
857
|
* })
|
|
858
|
+
*
|
|
859
|
+
* const actual = await Effect.runPromise(Effect.provide(program, TestClock.layer()))
|
|
860
|
+
* actual // => [Option.some(5), Option.none()]
|
|
822
861
|
* ```
|
|
823
862
|
*
|
|
824
863
|
* **Example** (Waiting for pending lookups)
|
|
825
864
|
*
|
|
826
|
-
* ```ts
|
|
827
|
-
* import { Cache, Deferred, Effect, Fiber } from "effect"
|
|
865
|
+
* ```ts import.meta.vitest
|
|
866
|
+
* import { Cache, Deferred, Effect, Fiber, Option } from "effect"
|
|
828
867
|
*
|
|
829
868
|
* // Waits for ongoing computation to complete
|
|
830
869
|
* const program = Effect.gen(function*() {
|
|
@@ -844,11 +883,12 @@ export const getOption: {
|
|
|
844
883
|
* yield* Deferred.succeed(deferred, void 0)
|
|
845
884
|
*
|
|
846
885
|
* const result = yield* Fiber.join(optionFiber)
|
|
847
|
-
* console.log(result) // Option.some(42)
|
|
848
|
-
*
|
|
849
886
|
* const value = yield* Fiber.join(getFiber)
|
|
850
|
-
*
|
|
887
|
+
* return [result, value] as const
|
|
851
888
|
* })
|
|
889
|
+
*
|
|
890
|
+
* const actual = await Effect.runPromise(program)
|
|
891
|
+
* actual // => [Option.some(42), 42]
|
|
852
892
|
* ```
|
|
853
893
|
*
|
|
854
894
|
* @category combinators
|
|
@@ -867,8 +907,8 @@ export const getOption: {
|
|
|
867
907
|
*
|
|
868
908
|
* **Example** (Reading cached values without lookup)
|
|
869
909
|
*
|
|
870
|
-
* ```ts
|
|
871
|
-
* import { Cache, Effect } from "effect"
|
|
910
|
+
* ```ts import.meta.vitest
|
|
911
|
+
* import { Cache, Effect, Option } from "effect"
|
|
872
912
|
*
|
|
873
913
|
* const program = Effect.gen(function*() {
|
|
874
914
|
* const cache = yield* Cache.make({
|
|
@@ -878,23 +918,23 @@ export const getOption: {
|
|
|
878
918
|
*
|
|
879
919
|
* // No value in cache yet - returns None without lookup
|
|
880
920
|
* const empty = yield* Cache.getOption(cache, "hello")
|
|
881
|
-
* console.log(empty) // Option.none()
|
|
882
921
|
*
|
|
883
922
|
* // Populate cache using get
|
|
884
923
|
* yield* Cache.get(cache, "hello")
|
|
885
924
|
*
|
|
886
925
|
* // Now getOption returns the cached value
|
|
887
926
|
* const cached = yield* Cache.getOption(cache, "hello")
|
|
888
|
-
*
|
|
889
|
-
*
|
|
890
|
-
* return { empty, cached }
|
|
927
|
+
* return [empty, cached] as const
|
|
891
928
|
* })
|
|
929
|
+
*
|
|
930
|
+
* const actual = await Effect.runPromise(program)
|
|
931
|
+
* actual // => [Option.none(), Option.some(5)]
|
|
892
932
|
* ```
|
|
893
933
|
*
|
|
894
934
|
* **Example** (Skipping expired entries)
|
|
895
935
|
*
|
|
896
|
-
* ```ts
|
|
897
|
-
* import { Cache, Effect } from "effect"
|
|
936
|
+
* ```ts import.meta.vitest
|
|
937
|
+
* import { Cache, Effect, Option } from "effect"
|
|
898
938
|
* import { TestClock } from "effect/testing"
|
|
899
939
|
*
|
|
900
940
|
* // Expired entries return None
|
|
@@ -910,21 +950,23 @@ export const getOption: {
|
|
|
910
950
|
*
|
|
911
951
|
* // Value exists before expiration
|
|
912
952
|
* const beforeExpiry = yield* Cache.getOption(cache, "hello")
|
|
913
|
-
* console.log(beforeExpiry) // Option.some(5)
|
|
914
953
|
*
|
|
915
954
|
* // Simulate time passing
|
|
916
955
|
* yield* TestClock.adjust("2 hours")
|
|
917
956
|
*
|
|
918
957
|
* // Value expired - returns None
|
|
919
958
|
* const afterExpiry = yield* Cache.getOption(cache, "hello")
|
|
920
|
-
*
|
|
959
|
+
* return [beforeExpiry, afterExpiry] as const
|
|
921
960
|
* })
|
|
961
|
+
*
|
|
962
|
+
* const actual = await Effect.runPromise(Effect.provide(program, TestClock.layer()))
|
|
963
|
+
* actual // => [Option.some(5), Option.none()]
|
|
922
964
|
* ```
|
|
923
965
|
*
|
|
924
966
|
* **Example** (Waiting for pending lookups)
|
|
925
967
|
*
|
|
926
|
-
* ```ts
|
|
927
|
-
* import { Cache, Deferred, Effect, Fiber } from "effect"
|
|
968
|
+
* ```ts import.meta.vitest
|
|
969
|
+
* import { Cache, Deferred, Effect, Fiber, Option } from "effect"
|
|
928
970
|
*
|
|
929
971
|
* // Waits for ongoing computation to complete
|
|
930
972
|
* const program = Effect.gen(function*() {
|
|
@@ -944,11 +986,12 @@ export const getOption: {
|
|
|
944
986
|
* yield* Deferred.succeed(deferred, void 0)
|
|
945
987
|
*
|
|
946
988
|
* const result = yield* Fiber.join(optionFiber)
|
|
947
|
-
* console.log(result) // Option.some(42)
|
|
948
|
-
*
|
|
949
989
|
* const value = yield* Fiber.join(getFiber)
|
|
950
|
-
*
|
|
990
|
+
* return [result, value] as const
|
|
951
991
|
* })
|
|
992
|
+
*
|
|
993
|
+
* const actual = await Effect.runPromise(program)
|
|
994
|
+
* actual // => [Option.some(42), 42]
|
|
952
995
|
* ```
|
|
953
996
|
*
|
|
954
997
|
* @category combinators
|
|
@@ -1052,7 +1095,7 @@ export const getSuccess: {
|
|
|
1052
1095
|
*
|
|
1053
1096
|
* **Example** (Setting values directly)
|
|
1054
1097
|
*
|
|
1055
|
-
* ```ts
|
|
1098
|
+
* ```ts import.meta.vitest
|
|
1056
1099
|
* import { Cache, Effect } from "effect"
|
|
1057
1100
|
*
|
|
1058
1101
|
* const program = Effect.gen(function*() {
|
|
@@ -1063,14 +1106,16 @@ export const getSuccess: {
|
|
|
1063
1106
|
*
|
|
1064
1107
|
* // Set a value directly without invoking lookup
|
|
1065
1108
|
* yield* Cache.set(cache, "hello", 42)
|
|
1066
|
-
*
|
|
1067
|
-
* console.log(result) // 42 (not 5 from lookup)
|
|
1109
|
+
* return yield* Cache.get(cache, "hello")
|
|
1068
1110
|
* })
|
|
1111
|
+
*
|
|
1112
|
+
* const actual = await Effect.runPromise(program)
|
|
1113
|
+
* actual // => 42
|
|
1069
1114
|
* ```
|
|
1070
1115
|
*
|
|
1071
1116
|
* **Example** (Overwriting cached values)
|
|
1072
1117
|
*
|
|
1073
|
-
* ```ts
|
|
1118
|
+
* ```ts import.meta.vitest
|
|
1074
1119
|
* import { Cache, Effect } from "effect"
|
|
1075
1120
|
*
|
|
1076
1121
|
* // Overwriting existing cached values
|
|
@@ -1087,13 +1132,16 @@ export const getSuccess: {
|
|
|
1087
1132
|
* yield* Cache.set(cache, "test", 999)
|
|
1088
1133
|
* const updated = yield* Cache.get(cache, "test") // 999
|
|
1089
1134
|
*
|
|
1090
|
-
*
|
|
1135
|
+
* return { original, updated }
|
|
1091
1136
|
* })
|
|
1137
|
+
*
|
|
1138
|
+
* const actual = await Effect.runPromise(program)
|
|
1139
|
+
* actual // => { original: 4, updated: 999 }
|
|
1092
1140
|
* ```
|
|
1093
1141
|
*
|
|
1094
1142
|
* **Example** (Applying TTL to set values)
|
|
1095
1143
|
*
|
|
1096
|
-
* ```ts
|
|
1144
|
+
* ```ts import.meta.vitest
|
|
1097
1145
|
* import { Cache, Effect } from "effect"
|
|
1098
1146
|
* import { TestClock } from "effect/testing"
|
|
1099
1147
|
*
|
|
@@ -1107,17 +1155,21 @@ export const getSuccess: {
|
|
|
1107
1155
|
*
|
|
1108
1156
|
* // Set value with TTL applied
|
|
1109
1157
|
* yield* Cache.set(cache, "temporary", 123)
|
|
1110
|
-
*
|
|
1158
|
+
* const beforeExpiry = yield* Cache.has(cache, "temporary")
|
|
1111
1159
|
*
|
|
1112
1160
|
* // Advance time past TTL
|
|
1113
1161
|
* yield* TestClock.adjust("2 hours")
|
|
1114
|
-
*
|
|
1162
|
+
* const afterExpiry = yield* Cache.has(cache, "temporary")
|
|
1163
|
+
* return [beforeExpiry, afterExpiry]
|
|
1115
1164
|
* })
|
|
1165
|
+
*
|
|
1166
|
+
* const actual = await Effect.runPromise(Effect.provide(program, TestClock.layer()))
|
|
1167
|
+
* actual // => [true, false]
|
|
1116
1168
|
* ```
|
|
1117
1169
|
*
|
|
1118
1170
|
* **Example** (Enforcing capacity when setting values)
|
|
1119
1171
|
*
|
|
1120
|
-
* ```ts
|
|
1172
|
+
* ```ts import.meta.vitest
|
|
1121
1173
|
* import { Cache, Effect } from "effect"
|
|
1122
1174
|
*
|
|
1123
1175
|
* // Capacity enforcement with set operations
|
|
@@ -1130,14 +1182,18 @@ export const getSuccess: {
|
|
|
1130
1182
|
* // Fill cache to capacity
|
|
1131
1183
|
* yield* Cache.set(cache, "a", 1)
|
|
1132
1184
|
* yield* Cache.set(cache, "b", 2)
|
|
1133
|
-
*
|
|
1185
|
+
* const sizeBeforeEviction = yield* Cache.size(cache)
|
|
1134
1186
|
*
|
|
1135
1187
|
* // Adding another entry evicts oldest
|
|
1136
1188
|
* yield* Cache.set(cache, "c", 3)
|
|
1137
|
-
*
|
|
1138
|
-
*
|
|
1139
|
-
*
|
|
1189
|
+
* const sizeAfterEviction = yield* Cache.size(cache)
|
|
1190
|
+
* const hasOldest = yield* Cache.has(cache, "a")
|
|
1191
|
+
* const hasNewest = yield* Cache.has(cache, "c")
|
|
1192
|
+
* return [sizeBeforeEviction, sizeAfterEviction, hasOldest, hasNewest]
|
|
1140
1193
|
* })
|
|
1194
|
+
*
|
|
1195
|
+
* const actual = await Effect.runPromise(program)
|
|
1196
|
+
* actual // => [2, 2, false, true]
|
|
1141
1197
|
* ```
|
|
1142
1198
|
*
|
|
1143
1199
|
* @category combinators
|
|
@@ -1150,7 +1206,7 @@ export const set: {
|
|
|
1150
1206
|
*
|
|
1151
1207
|
* **Example** (Setting values directly)
|
|
1152
1208
|
*
|
|
1153
|
-
* ```ts
|
|
1209
|
+
* ```ts import.meta.vitest
|
|
1154
1210
|
* import { Cache, Effect } from "effect"
|
|
1155
1211
|
*
|
|
1156
1212
|
* const program = Effect.gen(function*() {
|
|
@@ -1161,14 +1217,16 @@ export const set: {
|
|
|
1161
1217
|
*
|
|
1162
1218
|
* // Set a value directly without invoking lookup
|
|
1163
1219
|
* yield* Cache.set(cache, "hello", 42)
|
|
1164
|
-
*
|
|
1165
|
-
* console.log(result) // 42 (not 5 from lookup)
|
|
1220
|
+
* return yield* Cache.get(cache, "hello")
|
|
1166
1221
|
* })
|
|
1222
|
+
*
|
|
1223
|
+
* const actual = await Effect.runPromise(program)
|
|
1224
|
+
* actual // => 42
|
|
1167
1225
|
* ```
|
|
1168
1226
|
*
|
|
1169
1227
|
* **Example** (Overwriting cached values)
|
|
1170
1228
|
*
|
|
1171
|
-
* ```ts
|
|
1229
|
+
* ```ts import.meta.vitest
|
|
1172
1230
|
* import { Cache, Effect } from "effect"
|
|
1173
1231
|
*
|
|
1174
1232
|
* // Overwriting existing cached values
|
|
@@ -1185,13 +1243,16 @@ export const set: {
|
|
|
1185
1243
|
* yield* Cache.set(cache, "test", 999)
|
|
1186
1244
|
* const updated = yield* Cache.get(cache, "test") // 999
|
|
1187
1245
|
*
|
|
1188
|
-
*
|
|
1246
|
+
* return { original, updated }
|
|
1189
1247
|
* })
|
|
1248
|
+
*
|
|
1249
|
+
* const actual = await Effect.runPromise(program)
|
|
1250
|
+
* actual // => { original: 4, updated: 999 }
|
|
1190
1251
|
* ```
|
|
1191
1252
|
*
|
|
1192
1253
|
* **Example** (Applying TTL to set values)
|
|
1193
1254
|
*
|
|
1194
|
-
* ```ts
|
|
1255
|
+
* ```ts import.meta.vitest
|
|
1195
1256
|
* import { Cache, Effect } from "effect"
|
|
1196
1257
|
* import { TestClock } from "effect/testing"
|
|
1197
1258
|
*
|
|
@@ -1205,17 +1266,21 @@ export const set: {
|
|
|
1205
1266
|
*
|
|
1206
1267
|
* // Set value with TTL applied
|
|
1207
1268
|
* yield* Cache.set(cache, "temporary", 123)
|
|
1208
|
-
*
|
|
1269
|
+
* const beforeExpiry = yield* Cache.has(cache, "temporary")
|
|
1209
1270
|
*
|
|
1210
1271
|
* // Advance time past TTL
|
|
1211
1272
|
* yield* TestClock.adjust("2 hours")
|
|
1212
|
-
*
|
|
1273
|
+
* const afterExpiry = yield* Cache.has(cache, "temporary")
|
|
1274
|
+
* return [beforeExpiry, afterExpiry]
|
|
1213
1275
|
* })
|
|
1276
|
+
*
|
|
1277
|
+
* const actual = await Effect.runPromise(Effect.provide(program, TestClock.layer()))
|
|
1278
|
+
* actual // => [true, false]
|
|
1214
1279
|
* ```
|
|
1215
1280
|
*
|
|
1216
1281
|
* **Example** (Enforcing capacity when setting values)
|
|
1217
1282
|
*
|
|
1218
|
-
* ```ts
|
|
1283
|
+
* ```ts import.meta.vitest
|
|
1219
1284
|
* import { Cache, Effect } from "effect"
|
|
1220
1285
|
*
|
|
1221
1286
|
* // Capacity enforcement with set operations
|
|
@@ -1228,14 +1293,18 @@ export const set: {
|
|
|
1228
1293
|
* // Fill cache to capacity
|
|
1229
1294
|
* yield* Cache.set(cache, "a", 1)
|
|
1230
1295
|
* yield* Cache.set(cache, "b", 2)
|
|
1231
|
-
*
|
|
1296
|
+
* const sizeBeforeEviction = yield* Cache.size(cache)
|
|
1232
1297
|
*
|
|
1233
1298
|
* // Adding another entry evicts oldest
|
|
1234
1299
|
* yield* Cache.set(cache, "c", 3)
|
|
1235
|
-
*
|
|
1236
|
-
*
|
|
1237
|
-
*
|
|
1300
|
+
* const sizeAfterEviction = yield* Cache.size(cache)
|
|
1301
|
+
* const hasOldest = yield* Cache.has(cache, "a")
|
|
1302
|
+
* const hasNewest = yield* Cache.has(cache, "c")
|
|
1303
|
+
* return [sizeBeforeEviction, sizeAfterEviction, hasOldest, hasNewest]
|
|
1238
1304
|
* })
|
|
1305
|
+
*
|
|
1306
|
+
* const actual = await Effect.runPromise(program)
|
|
1307
|
+
* actual // => [2, 2, false, true]
|
|
1239
1308
|
* ```
|
|
1240
1309
|
*
|
|
1241
1310
|
* @category combinators
|
|
@@ -1248,7 +1317,7 @@ export const set: {
|
|
|
1248
1317
|
*
|
|
1249
1318
|
* **Example** (Setting values directly)
|
|
1250
1319
|
*
|
|
1251
|
-
* ```ts
|
|
1320
|
+
* ```ts import.meta.vitest
|
|
1252
1321
|
* import { Cache, Effect } from "effect"
|
|
1253
1322
|
*
|
|
1254
1323
|
* const program = Effect.gen(function*() {
|
|
@@ -1259,14 +1328,16 @@ export const set: {
|
|
|
1259
1328
|
*
|
|
1260
1329
|
* // Set a value directly without invoking lookup
|
|
1261
1330
|
* yield* Cache.set(cache, "hello", 42)
|
|
1262
|
-
*
|
|
1263
|
-
* console.log(result) // 42 (not 5 from lookup)
|
|
1331
|
+
* return yield* Cache.get(cache, "hello")
|
|
1264
1332
|
* })
|
|
1333
|
+
*
|
|
1334
|
+
* const actual = await Effect.runPromise(program)
|
|
1335
|
+
* actual // => 42
|
|
1265
1336
|
* ```
|
|
1266
1337
|
*
|
|
1267
1338
|
* **Example** (Overwriting cached values)
|
|
1268
1339
|
*
|
|
1269
|
-
* ```ts
|
|
1340
|
+
* ```ts import.meta.vitest
|
|
1270
1341
|
* import { Cache, Effect } from "effect"
|
|
1271
1342
|
*
|
|
1272
1343
|
* // Overwriting existing cached values
|
|
@@ -1283,13 +1354,16 @@ export const set: {
|
|
|
1283
1354
|
* yield* Cache.set(cache, "test", 999)
|
|
1284
1355
|
* const updated = yield* Cache.get(cache, "test") // 999
|
|
1285
1356
|
*
|
|
1286
|
-
*
|
|
1357
|
+
* return { original, updated }
|
|
1287
1358
|
* })
|
|
1359
|
+
*
|
|
1360
|
+
* const actual = await Effect.runPromise(program)
|
|
1361
|
+
* actual // => { original: 4, updated: 999 }
|
|
1288
1362
|
* ```
|
|
1289
1363
|
*
|
|
1290
1364
|
* **Example** (Applying TTL to set values)
|
|
1291
1365
|
*
|
|
1292
|
-
* ```ts
|
|
1366
|
+
* ```ts import.meta.vitest
|
|
1293
1367
|
* import { Cache, Effect } from "effect"
|
|
1294
1368
|
* import { TestClock } from "effect/testing"
|
|
1295
1369
|
*
|
|
@@ -1303,17 +1377,21 @@ export const set: {
|
|
|
1303
1377
|
*
|
|
1304
1378
|
* // Set value with TTL applied
|
|
1305
1379
|
* yield* Cache.set(cache, "temporary", 123)
|
|
1306
|
-
*
|
|
1380
|
+
* const beforeExpiry = yield* Cache.has(cache, "temporary")
|
|
1307
1381
|
*
|
|
1308
1382
|
* // Advance time past TTL
|
|
1309
1383
|
* yield* TestClock.adjust("2 hours")
|
|
1310
|
-
*
|
|
1384
|
+
* const afterExpiry = yield* Cache.has(cache, "temporary")
|
|
1385
|
+
* return [beforeExpiry, afterExpiry]
|
|
1311
1386
|
* })
|
|
1387
|
+
*
|
|
1388
|
+
* const actual = await Effect.runPromise(Effect.provide(program, TestClock.layer()))
|
|
1389
|
+
* actual // => [true, false]
|
|
1312
1390
|
* ```
|
|
1313
1391
|
*
|
|
1314
1392
|
* **Example** (Enforcing capacity when setting values)
|
|
1315
1393
|
*
|
|
1316
|
-
* ```ts
|
|
1394
|
+
* ```ts import.meta.vitest
|
|
1317
1395
|
* import { Cache, Effect } from "effect"
|
|
1318
1396
|
*
|
|
1319
1397
|
* // Capacity enforcement with set operations
|
|
@@ -1326,14 +1404,18 @@ export const set: {
|
|
|
1326
1404
|
* // Fill cache to capacity
|
|
1327
1405
|
* yield* Cache.set(cache, "a", 1)
|
|
1328
1406
|
* yield* Cache.set(cache, "b", 2)
|
|
1329
|
-
*
|
|
1407
|
+
* const sizeBeforeEviction = yield* Cache.size(cache)
|
|
1330
1408
|
*
|
|
1331
1409
|
* // Adding another entry evicts oldest
|
|
1332
1410
|
* yield* Cache.set(cache, "c", 3)
|
|
1333
|
-
*
|
|
1334
|
-
*
|
|
1335
|
-
*
|
|
1411
|
+
* const sizeAfterEviction = yield* Cache.size(cache)
|
|
1412
|
+
* const hasOldest = yield* Cache.has(cache, "a")
|
|
1413
|
+
* const hasNewest = yield* Cache.has(cache, "c")
|
|
1414
|
+
* return [sizeBeforeEviction, sizeAfterEviction, hasOldest, hasNewest]
|
|
1336
1415
|
* })
|
|
1416
|
+
*
|
|
1417
|
+
* const actual = await Effect.runPromise(program)
|
|
1418
|
+
* actual // => [2, 2, false, true]
|
|
1337
1419
|
* ```
|
|
1338
1420
|
*
|
|
1339
1421
|
* @category combinators
|
|
@@ -1370,7 +1452,7 @@ export const set: {
|
|
|
1370
1452
|
*
|
|
1371
1453
|
* **Example** (Checking for cached keys)
|
|
1372
1454
|
*
|
|
1373
|
-
* ```ts
|
|
1455
|
+
* ```ts import.meta.vitest
|
|
1374
1456
|
* import { Cache, Effect } from "effect"
|
|
1375
1457
|
*
|
|
1376
1458
|
* const program = Effect.gen(function*() {
|
|
@@ -1380,17 +1462,21 @@ export const set: {
|
|
|
1380
1462
|
* })
|
|
1381
1463
|
*
|
|
1382
1464
|
* // Check non-existent key
|
|
1383
|
-
*
|
|
1465
|
+
* const missing = yield* Cache.has(cache, "missing")
|
|
1384
1466
|
*
|
|
1385
1467
|
* // Add entry and check existence
|
|
1386
1468
|
* yield* Cache.get(cache, "hello")
|
|
1387
|
-
*
|
|
1469
|
+
* const present = yield* Cache.has(cache, "hello")
|
|
1470
|
+
* return [missing, present]
|
|
1388
1471
|
* })
|
|
1472
|
+
*
|
|
1473
|
+
* const actual = await Effect.runPromise(program)
|
|
1474
|
+
* actual // => [false, true]
|
|
1389
1475
|
* ```
|
|
1390
1476
|
*
|
|
1391
1477
|
* **Example** (Checking TTL expiration)
|
|
1392
1478
|
*
|
|
1393
|
-
* ```ts
|
|
1479
|
+
* ```ts import.meta.vitest
|
|
1394
1480
|
* import { Cache, Effect } from "effect"
|
|
1395
1481
|
* import { TestClock } from "effect/testing"
|
|
1396
1482
|
*
|
|
@@ -1404,21 +1490,25 @@ export const set: {
|
|
|
1404
1490
|
*
|
|
1405
1491
|
* // Add entry with TTL
|
|
1406
1492
|
* yield* Cache.get(cache, "expires")
|
|
1407
|
-
*
|
|
1493
|
+
* const initial = yield* Cache.has(cache, "expires")
|
|
1408
1494
|
*
|
|
1409
1495
|
* // Still valid before expiration
|
|
1410
1496
|
* yield* TestClock.adjust("30 minutes")
|
|
1411
|
-
*
|
|
1497
|
+
* const beforeExpiry = yield* Cache.has(cache, "expires")
|
|
1412
1498
|
*
|
|
1413
1499
|
* // Expired after TTL
|
|
1414
1500
|
* yield* TestClock.adjust("31 minutes")
|
|
1415
|
-
*
|
|
1501
|
+
* const afterExpiry = yield* Cache.has(cache, "expires")
|
|
1502
|
+
* return [initial, beforeExpiry, afterExpiry]
|
|
1416
1503
|
* })
|
|
1504
|
+
*
|
|
1505
|
+
* const actual = await Effect.runPromise(Effect.provide(program, TestClock.layer()))
|
|
1506
|
+
* actual // => [true, true, false]
|
|
1417
1507
|
* ```
|
|
1418
1508
|
*
|
|
1419
1509
|
* **Example** (Checking multiple keys)
|
|
1420
1510
|
*
|
|
1421
|
-
* ```ts
|
|
1511
|
+
* ```ts import.meta.vitest
|
|
1422
1512
|
* import { Cache, Effect } from "effect"
|
|
1423
1513
|
*
|
|
1424
1514
|
* // Checking multiple keys efficiently
|
|
@@ -1434,16 +1524,16 @@ export const set: {
|
|
|
1434
1524
|
*
|
|
1435
1525
|
* // Check multiple keys
|
|
1436
1526
|
* const keys = ["apple", "banana", "cherry", "date"]
|
|
1527
|
+
* const results: Array<string> = []
|
|
1437
1528
|
* for (const key of keys) {
|
|
1438
1529
|
* const exists = yield* Cache.has(cache, key)
|
|
1439
|
-
*
|
|
1530
|
+
* results.push(`${key}: ${exists}`)
|
|
1440
1531
|
* }
|
|
1441
|
-
*
|
|
1442
|
-
* // apple: true
|
|
1443
|
-
* // banana: true
|
|
1444
|
-
* // cherry: false
|
|
1445
|
-
* // date: false
|
|
1532
|
+
* return results
|
|
1446
1533
|
* })
|
|
1534
|
+
*
|
|
1535
|
+
* const actual = await Effect.runPromise(program)
|
|
1536
|
+
* actual // => ["apple: true", "banana: true", "cherry: false", "date: false"]
|
|
1447
1537
|
* ```
|
|
1448
1538
|
*
|
|
1449
1539
|
* @category combinators
|
|
@@ -1460,7 +1550,7 @@ export const has: {
|
|
|
1460
1550
|
*
|
|
1461
1551
|
* **Example** (Checking for cached keys)
|
|
1462
1552
|
*
|
|
1463
|
-
* ```ts
|
|
1553
|
+
* ```ts import.meta.vitest
|
|
1464
1554
|
* import { Cache, Effect } from "effect"
|
|
1465
1555
|
*
|
|
1466
1556
|
* const program = Effect.gen(function*() {
|
|
@@ -1470,17 +1560,21 @@ export const has: {
|
|
|
1470
1560
|
* })
|
|
1471
1561
|
*
|
|
1472
1562
|
* // Check non-existent key
|
|
1473
|
-
*
|
|
1563
|
+
* const missing = yield* Cache.has(cache, "missing")
|
|
1474
1564
|
*
|
|
1475
1565
|
* // Add entry and check existence
|
|
1476
1566
|
* yield* Cache.get(cache, "hello")
|
|
1477
|
-
*
|
|
1567
|
+
* const present = yield* Cache.has(cache, "hello")
|
|
1568
|
+
* return [missing, present]
|
|
1478
1569
|
* })
|
|
1570
|
+
*
|
|
1571
|
+
* const actual = await Effect.runPromise(program)
|
|
1572
|
+
* actual // => [false, true]
|
|
1479
1573
|
* ```
|
|
1480
1574
|
*
|
|
1481
1575
|
* **Example** (Checking TTL expiration)
|
|
1482
1576
|
*
|
|
1483
|
-
* ```ts
|
|
1577
|
+
* ```ts import.meta.vitest
|
|
1484
1578
|
* import { Cache, Effect } from "effect"
|
|
1485
1579
|
* import { TestClock } from "effect/testing"
|
|
1486
1580
|
*
|
|
@@ -1494,21 +1588,25 @@ export const has: {
|
|
|
1494
1588
|
*
|
|
1495
1589
|
* // Add entry with TTL
|
|
1496
1590
|
* yield* Cache.get(cache, "expires")
|
|
1497
|
-
*
|
|
1591
|
+
* const initial = yield* Cache.has(cache, "expires")
|
|
1498
1592
|
*
|
|
1499
1593
|
* // Still valid before expiration
|
|
1500
1594
|
* yield* TestClock.adjust("30 minutes")
|
|
1501
|
-
*
|
|
1595
|
+
* const beforeExpiry = yield* Cache.has(cache, "expires")
|
|
1502
1596
|
*
|
|
1503
1597
|
* // Expired after TTL
|
|
1504
1598
|
* yield* TestClock.adjust("31 minutes")
|
|
1505
|
-
*
|
|
1599
|
+
* const afterExpiry = yield* Cache.has(cache, "expires")
|
|
1600
|
+
* return [initial, beforeExpiry, afterExpiry]
|
|
1506
1601
|
* })
|
|
1602
|
+
*
|
|
1603
|
+
* const actual = await Effect.runPromise(Effect.provide(program, TestClock.layer()))
|
|
1604
|
+
* actual // => [true, true, false]
|
|
1507
1605
|
* ```
|
|
1508
1606
|
*
|
|
1509
1607
|
* **Example** (Checking multiple keys)
|
|
1510
1608
|
*
|
|
1511
|
-
* ```ts
|
|
1609
|
+
* ```ts import.meta.vitest
|
|
1512
1610
|
* import { Cache, Effect } from "effect"
|
|
1513
1611
|
*
|
|
1514
1612
|
* // Checking multiple keys efficiently
|
|
@@ -1524,16 +1622,16 @@ export const has: {
|
|
|
1524
1622
|
*
|
|
1525
1623
|
* // Check multiple keys
|
|
1526
1624
|
* const keys = ["apple", "banana", "cherry", "date"]
|
|
1625
|
+
* const results: Array<string> = []
|
|
1527
1626
|
* for (const key of keys) {
|
|
1528
1627
|
* const exists = yield* Cache.has(cache, key)
|
|
1529
|
-
*
|
|
1628
|
+
* results.push(`${key}: ${exists}`)
|
|
1530
1629
|
* }
|
|
1531
|
-
*
|
|
1532
|
-
* // apple: true
|
|
1533
|
-
* // banana: true
|
|
1534
|
-
* // cherry: false
|
|
1535
|
-
* // date: false
|
|
1630
|
+
* return results
|
|
1536
1631
|
* })
|
|
1632
|
+
*
|
|
1633
|
+
* const actual = await Effect.runPromise(program)
|
|
1634
|
+
* actual // => ["apple: true", "banana: true", "cherry: false", "date: false"]
|
|
1537
1635
|
* ```
|
|
1538
1636
|
*
|
|
1539
1637
|
* @category combinators
|
|
@@ -1550,7 +1648,7 @@ export const has: {
|
|
|
1550
1648
|
*
|
|
1551
1649
|
* **Example** (Checking for cached keys)
|
|
1552
1650
|
*
|
|
1553
|
-
* ```ts
|
|
1651
|
+
* ```ts import.meta.vitest
|
|
1554
1652
|
* import { Cache, Effect } from "effect"
|
|
1555
1653
|
*
|
|
1556
1654
|
* const program = Effect.gen(function*() {
|
|
@@ -1560,17 +1658,21 @@ export const has: {
|
|
|
1560
1658
|
* })
|
|
1561
1659
|
*
|
|
1562
1660
|
* // Check non-existent key
|
|
1563
|
-
*
|
|
1661
|
+
* const missing = yield* Cache.has(cache, "missing")
|
|
1564
1662
|
*
|
|
1565
1663
|
* // Add entry and check existence
|
|
1566
1664
|
* yield* Cache.get(cache, "hello")
|
|
1567
|
-
*
|
|
1665
|
+
* const present = yield* Cache.has(cache, "hello")
|
|
1666
|
+
* return [missing, present]
|
|
1568
1667
|
* })
|
|
1668
|
+
*
|
|
1669
|
+
* const actual = await Effect.runPromise(program)
|
|
1670
|
+
* actual // => [false, true]
|
|
1569
1671
|
* ```
|
|
1570
1672
|
*
|
|
1571
1673
|
* **Example** (Checking TTL expiration)
|
|
1572
1674
|
*
|
|
1573
|
-
* ```ts
|
|
1675
|
+
* ```ts import.meta.vitest
|
|
1574
1676
|
* import { Cache, Effect } from "effect"
|
|
1575
1677
|
* import { TestClock } from "effect/testing"
|
|
1576
1678
|
*
|
|
@@ -1584,21 +1686,25 @@ export const has: {
|
|
|
1584
1686
|
*
|
|
1585
1687
|
* // Add entry with TTL
|
|
1586
1688
|
* yield* Cache.get(cache, "expires")
|
|
1587
|
-
*
|
|
1689
|
+
* const initial = yield* Cache.has(cache, "expires")
|
|
1588
1690
|
*
|
|
1589
1691
|
* // Still valid before expiration
|
|
1590
1692
|
* yield* TestClock.adjust("30 minutes")
|
|
1591
|
-
*
|
|
1693
|
+
* const beforeExpiry = yield* Cache.has(cache, "expires")
|
|
1592
1694
|
*
|
|
1593
1695
|
* // Expired after TTL
|
|
1594
1696
|
* yield* TestClock.adjust("31 minutes")
|
|
1595
|
-
*
|
|
1697
|
+
* const afterExpiry = yield* Cache.has(cache, "expires")
|
|
1698
|
+
* return [initial, beforeExpiry, afterExpiry]
|
|
1596
1699
|
* })
|
|
1700
|
+
*
|
|
1701
|
+
* const actual = await Effect.runPromise(Effect.provide(program, TestClock.layer()))
|
|
1702
|
+
* actual // => [true, true, false]
|
|
1597
1703
|
* ```
|
|
1598
1704
|
*
|
|
1599
1705
|
* **Example** (Checking multiple keys)
|
|
1600
1706
|
*
|
|
1601
|
-
* ```ts
|
|
1707
|
+
* ```ts import.meta.vitest
|
|
1602
1708
|
* import { Cache, Effect } from "effect"
|
|
1603
1709
|
*
|
|
1604
1710
|
* // Checking multiple keys efficiently
|
|
@@ -1614,16 +1720,16 @@ export const has: {
|
|
|
1614
1720
|
*
|
|
1615
1721
|
* // Check multiple keys
|
|
1616
1722
|
* const keys = ["apple", "banana", "cherry", "date"]
|
|
1723
|
+
* const results: Array<string> = []
|
|
1617
1724
|
* for (const key of keys) {
|
|
1618
1725
|
* const exists = yield* Cache.has(cache, key)
|
|
1619
|
-
*
|
|
1726
|
+
* results.push(`${key}: ${exists}`)
|
|
1620
1727
|
* }
|
|
1621
|
-
*
|
|
1622
|
-
* // apple: true
|
|
1623
|
-
* // banana: true
|
|
1624
|
-
* // cherry: false
|
|
1625
|
-
* // date: false
|
|
1728
|
+
* return results
|
|
1626
1729
|
* })
|
|
1730
|
+
*
|
|
1731
|
+
* const actual = await Effect.runPromise(program)
|
|
1732
|
+
* actual // => ["apple: true", "banana: true", "cherry: false", "date: false"]
|
|
1627
1733
|
* ```
|
|
1628
1734
|
*
|
|
1629
1735
|
* @category combinators
|
|
@@ -1644,7 +1750,7 @@ export const has: {
|
|
|
1644
1750
|
*
|
|
1645
1751
|
* **Example** (Invalidating cached entries)
|
|
1646
1752
|
*
|
|
1647
|
-
* ```ts
|
|
1753
|
+
* ```ts import.meta.vitest
|
|
1648
1754
|
* import { Cache, Effect } from "effect"
|
|
1649
1755
|
*
|
|
1650
1756
|
* const program = Effect.gen(function*() {
|
|
@@ -1655,11 +1761,11 @@ export const has: {
|
|
|
1655
1761
|
*
|
|
1656
1762
|
* // Add a value to the cache
|
|
1657
1763
|
* yield* Cache.get(cache, "hello")
|
|
1658
|
-
*
|
|
1764
|
+
* const beforeInvalidation = yield* Cache.has(cache, "hello")
|
|
1659
1765
|
*
|
|
1660
1766
|
* // Invalidate the entry
|
|
1661
1767
|
* yield* Cache.invalidate(cache, "hello")
|
|
1662
|
-
*
|
|
1768
|
+
* const afterInvalidation = yield* Cache.has(cache, "hello")
|
|
1663
1769
|
*
|
|
1664
1770
|
* // Invalidating non-existent keys doesn't error
|
|
1665
1771
|
* yield* Cache.invalidate(cache, "nonexistent")
|
|
@@ -1678,7 +1784,11 @@ export const has: {
|
|
|
1678
1784
|
* yield* Cache.get(cache2, "test") // lookupCount = 1
|
|
1679
1785
|
* yield* Cache.invalidate(cache2, "test")
|
|
1680
1786
|
* yield* Cache.get(cache2, "test") // lookupCount = 2 (lookup called again)
|
|
1787
|
+
* return { beforeInvalidation, afterInvalidation, lookupCount }
|
|
1681
1788
|
* })
|
|
1789
|
+
*
|
|
1790
|
+
* const actual = await Effect.runPromise(program)
|
|
1791
|
+
* actual // => { beforeInvalidation: true, afterInvalidation: false, lookupCount: 2 }
|
|
1682
1792
|
* ```
|
|
1683
1793
|
*
|
|
1684
1794
|
* @category combinators
|
|
@@ -1690,7 +1800,7 @@ export const invalidate: {
|
|
|
1690
1800
|
*
|
|
1691
1801
|
* **Example** (Invalidating cached entries)
|
|
1692
1802
|
*
|
|
1693
|
-
* ```ts
|
|
1803
|
+
* ```ts import.meta.vitest
|
|
1694
1804
|
* import { Cache, Effect } from "effect"
|
|
1695
1805
|
*
|
|
1696
1806
|
* const program = Effect.gen(function*() {
|
|
@@ -1701,11 +1811,11 @@ export const invalidate: {
|
|
|
1701
1811
|
*
|
|
1702
1812
|
* // Add a value to the cache
|
|
1703
1813
|
* yield* Cache.get(cache, "hello")
|
|
1704
|
-
*
|
|
1814
|
+
* const beforeInvalidation = yield* Cache.has(cache, "hello")
|
|
1705
1815
|
*
|
|
1706
1816
|
* // Invalidate the entry
|
|
1707
1817
|
* yield* Cache.invalidate(cache, "hello")
|
|
1708
|
-
*
|
|
1818
|
+
* const afterInvalidation = yield* Cache.has(cache, "hello")
|
|
1709
1819
|
*
|
|
1710
1820
|
* // Invalidating non-existent keys doesn't error
|
|
1711
1821
|
* yield* Cache.invalidate(cache, "nonexistent")
|
|
@@ -1724,7 +1834,11 @@ export const invalidate: {
|
|
|
1724
1834
|
* yield* Cache.get(cache2, "test") // lookupCount = 1
|
|
1725
1835
|
* yield* Cache.invalidate(cache2, "test")
|
|
1726
1836
|
* yield* Cache.get(cache2, "test") // lookupCount = 2 (lookup called again)
|
|
1837
|
+
* return { beforeInvalidation, afterInvalidation, lookupCount }
|
|
1727
1838
|
* })
|
|
1839
|
+
*
|
|
1840
|
+
* const actual = await Effect.runPromise(program)
|
|
1841
|
+
* actual // => { beforeInvalidation: true, afterInvalidation: false, lookupCount: 2 }
|
|
1728
1842
|
* ```
|
|
1729
1843
|
*
|
|
1730
1844
|
* @category combinators
|
|
@@ -1736,7 +1850,7 @@ export const invalidate: {
|
|
|
1736
1850
|
*
|
|
1737
1851
|
* **Example** (Invalidating cached entries)
|
|
1738
1852
|
*
|
|
1739
|
-
* ```ts
|
|
1853
|
+
* ```ts import.meta.vitest
|
|
1740
1854
|
* import { Cache, Effect } from "effect"
|
|
1741
1855
|
*
|
|
1742
1856
|
* const program = Effect.gen(function*() {
|
|
@@ -1747,11 +1861,11 @@ export const invalidate: {
|
|
|
1747
1861
|
*
|
|
1748
1862
|
* // Add a value to the cache
|
|
1749
1863
|
* yield* Cache.get(cache, "hello")
|
|
1750
|
-
*
|
|
1864
|
+
* const beforeInvalidation = yield* Cache.has(cache, "hello")
|
|
1751
1865
|
*
|
|
1752
1866
|
* // Invalidate the entry
|
|
1753
1867
|
* yield* Cache.invalidate(cache, "hello")
|
|
1754
|
-
*
|
|
1868
|
+
* const afterInvalidation = yield* Cache.has(cache, "hello")
|
|
1755
1869
|
*
|
|
1756
1870
|
* // Invalidating non-existent keys doesn't error
|
|
1757
1871
|
* yield* Cache.invalidate(cache, "nonexistent")
|
|
@@ -1770,7 +1884,11 @@ export const invalidate: {
|
|
|
1770
1884
|
* yield* Cache.get(cache2, "test") // lookupCount = 1
|
|
1771
1885
|
* yield* Cache.invalidate(cache2, "test")
|
|
1772
1886
|
* yield* Cache.get(cache2, "test") // lookupCount = 2 (lookup called again)
|
|
1887
|
+
* return { beforeInvalidation, afterInvalidation, lookupCount }
|
|
1773
1888
|
* })
|
|
1889
|
+
*
|
|
1890
|
+
* const actual = await Effect.runPromise(program)
|
|
1891
|
+
* actual // => { beforeInvalidation: true, afterInvalidation: false, lookupCount: 2 }
|
|
1774
1892
|
* ```
|
|
1775
1893
|
*
|
|
1776
1894
|
* @category combinators
|
|
@@ -1788,7 +1906,7 @@ export const invalidate: {
|
|
|
1788
1906
|
*
|
|
1789
1907
|
* **Example** (Invalidating entries conditionally)
|
|
1790
1908
|
*
|
|
1791
|
-
* ```ts
|
|
1909
|
+
* ```ts import.meta.vitest
|
|
1792
1910
|
* import { Cache, Effect } from "effect"
|
|
1793
1911
|
*
|
|
1794
1912
|
* const program = Effect.gen(function*() {
|
|
@@ -1807,8 +1925,7 @@ export const invalidate: {
|
|
|
1807
1925
|
* "hello",
|
|
1808
1926
|
* (value) => value === 5
|
|
1809
1927
|
* )
|
|
1810
|
-
*
|
|
1811
|
-
* console.log(yield* Cache.has(cache, "hello")) // false
|
|
1928
|
+
* const hasHello = yield* Cache.has(cache, "hello")
|
|
1812
1929
|
*
|
|
1813
1930
|
* // Don't invalidate when predicate doesn't match
|
|
1814
1931
|
* const invalidated2 = yield* Cache.invalidateWhen(
|
|
@@ -1816,8 +1933,7 @@ export const invalidate: {
|
|
|
1816
1933
|
* "hi",
|
|
1817
1934
|
* (value) => value === 5
|
|
1818
1935
|
* )
|
|
1819
|
-
*
|
|
1820
|
-
* console.log(yield* Cache.has(cache, "hi")) // true (still present)
|
|
1936
|
+
* const hasHi = yield* Cache.has(cache, "hi")
|
|
1821
1937
|
*
|
|
1822
1938
|
* // Returns false for non-existent keys
|
|
1823
1939
|
* const invalidated3 = yield* Cache.invalidateWhen(
|
|
@@ -1825,7 +1941,6 @@ export const invalidate: {
|
|
|
1825
1941
|
* "nonexistent",
|
|
1826
1942
|
* () => true
|
|
1827
1943
|
* )
|
|
1828
|
-
* console.log(invalidated3) // false
|
|
1829
1944
|
*
|
|
1830
1945
|
* // Returns false for failed cached values
|
|
1831
1946
|
* const cacheWithErrors = yield* Cache.make<string, number, string>({
|
|
@@ -1840,8 +1955,11 @@ export const invalidate: {
|
|
|
1840
1955
|
* "fail",
|
|
1841
1956
|
* () => true
|
|
1842
1957
|
* )
|
|
1843
|
-
*
|
|
1958
|
+
* return [invalidated1, hasHello, invalidated2, hasHi, invalidated3, invalidated4]
|
|
1844
1959
|
* })
|
|
1960
|
+
*
|
|
1961
|
+
* const actual = await Effect.runPromise(program)
|
|
1962
|
+
* actual // => [true, false, false, true, false, false]
|
|
1845
1963
|
* ```
|
|
1846
1964
|
*
|
|
1847
1965
|
* @category combinators
|
|
@@ -1854,7 +1972,7 @@ export const invalidateWhen: {
|
|
|
1854
1972
|
*
|
|
1855
1973
|
* **Example** (Invalidating entries conditionally)
|
|
1856
1974
|
*
|
|
1857
|
-
* ```ts
|
|
1975
|
+
* ```ts import.meta.vitest
|
|
1858
1976
|
* import { Cache, Effect } from "effect"
|
|
1859
1977
|
*
|
|
1860
1978
|
* const program = Effect.gen(function*() {
|
|
@@ -1873,8 +1991,7 @@ export const invalidateWhen: {
|
|
|
1873
1991
|
* "hello",
|
|
1874
1992
|
* (value) => value === 5
|
|
1875
1993
|
* )
|
|
1876
|
-
*
|
|
1877
|
-
* console.log(yield* Cache.has(cache, "hello")) // false
|
|
1994
|
+
* const hasHello = yield* Cache.has(cache, "hello")
|
|
1878
1995
|
*
|
|
1879
1996
|
* // Don't invalidate when predicate doesn't match
|
|
1880
1997
|
* const invalidated2 = yield* Cache.invalidateWhen(
|
|
@@ -1882,8 +1999,7 @@ export const invalidateWhen: {
|
|
|
1882
1999
|
* "hi",
|
|
1883
2000
|
* (value) => value === 5
|
|
1884
2001
|
* )
|
|
1885
|
-
*
|
|
1886
|
-
* console.log(yield* Cache.has(cache, "hi")) // true (still present)
|
|
2002
|
+
* const hasHi = yield* Cache.has(cache, "hi")
|
|
1887
2003
|
*
|
|
1888
2004
|
* // Returns false for non-existent keys
|
|
1889
2005
|
* const invalidated3 = yield* Cache.invalidateWhen(
|
|
@@ -1891,7 +2007,6 @@ export const invalidateWhen: {
|
|
|
1891
2007
|
* "nonexistent",
|
|
1892
2008
|
* () => true
|
|
1893
2009
|
* )
|
|
1894
|
-
* console.log(invalidated3) // false
|
|
1895
2010
|
*
|
|
1896
2011
|
* // Returns false for failed cached values
|
|
1897
2012
|
* const cacheWithErrors = yield* Cache.make<string, number, string>({
|
|
@@ -1906,8 +2021,11 @@ export const invalidateWhen: {
|
|
|
1906
2021
|
* "fail",
|
|
1907
2022
|
* () => true
|
|
1908
2023
|
* )
|
|
1909
|
-
*
|
|
2024
|
+
* return [invalidated1, hasHello, invalidated2, hasHi, invalidated3, invalidated4]
|
|
1910
2025
|
* })
|
|
2026
|
+
*
|
|
2027
|
+
* const actual = await Effect.runPromise(program)
|
|
2028
|
+
* actual // => [true, false, false, true, false, false]
|
|
1911
2029
|
* ```
|
|
1912
2030
|
*
|
|
1913
2031
|
* @category combinators
|
|
@@ -1920,7 +2038,7 @@ export const invalidateWhen: {
|
|
|
1920
2038
|
*
|
|
1921
2039
|
* **Example** (Invalidating entries conditionally)
|
|
1922
2040
|
*
|
|
1923
|
-
* ```ts
|
|
2041
|
+
* ```ts import.meta.vitest
|
|
1924
2042
|
* import { Cache, Effect } from "effect"
|
|
1925
2043
|
*
|
|
1926
2044
|
* const program = Effect.gen(function*() {
|
|
@@ -1939,8 +2057,7 @@ export const invalidateWhen: {
|
|
|
1939
2057
|
* "hello",
|
|
1940
2058
|
* (value) => value === 5
|
|
1941
2059
|
* )
|
|
1942
|
-
*
|
|
1943
|
-
* console.log(yield* Cache.has(cache, "hello")) // false
|
|
2060
|
+
* const hasHello = yield* Cache.has(cache, "hello")
|
|
1944
2061
|
*
|
|
1945
2062
|
* // Don't invalidate when predicate doesn't match
|
|
1946
2063
|
* const invalidated2 = yield* Cache.invalidateWhen(
|
|
@@ -1948,8 +2065,7 @@ export const invalidateWhen: {
|
|
|
1948
2065
|
* "hi",
|
|
1949
2066
|
* (value) => value === 5
|
|
1950
2067
|
* )
|
|
1951
|
-
*
|
|
1952
|
-
* console.log(yield* Cache.has(cache, "hi")) // true (still present)
|
|
2068
|
+
* const hasHi = yield* Cache.has(cache, "hi")
|
|
1953
2069
|
*
|
|
1954
2070
|
* // Returns false for non-existent keys
|
|
1955
2071
|
* const invalidated3 = yield* Cache.invalidateWhen(
|
|
@@ -1957,7 +2073,6 @@ export const invalidateWhen: {
|
|
|
1957
2073
|
* "nonexistent",
|
|
1958
2074
|
* () => true
|
|
1959
2075
|
* )
|
|
1960
|
-
* console.log(invalidated3) // false
|
|
1961
2076
|
*
|
|
1962
2077
|
* // Returns false for failed cached values
|
|
1963
2078
|
* const cacheWithErrors = yield* Cache.make<string, number, string>({
|
|
@@ -1972,8 +2087,11 @@ export const invalidateWhen: {
|
|
|
1972
2087
|
* "fail",
|
|
1973
2088
|
* () => true
|
|
1974
2089
|
* )
|
|
1975
|
-
*
|
|
2090
|
+
* return [invalidated1, hasHello, invalidated2, hasHi, invalidated3, invalidated4]
|
|
1976
2091
|
* })
|
|
2092
|
+
*
|
|
2093
|
+
* const actual = await Effect.runPromise(program)
|
|
2094
|
+
* actual // => [true, false, false, true, false, false]
|
|
1977
2095
|
* ```
|
|
1978
2096
|
*
|
|
1979
2097
|
* @category combinators
|
|
@@ -2011,7 +2129,7 @@ export const invalidateWhen: {
|
|
|
2011
2129
|
*
|
|
2012
2130
|
* **Example** (Refreshing cached values)
|
|
2013
2131
|
*
|
|
2014
|
-
* ```ts
|
|
2132
|
+
* ```ts import.meta.vitest
|
|
2015
2133
|
* import { Cache, Effect } from "effect"
|
|
2016
2134
|
*
|
|
2017
2135
|
* // Force refresh of existing cached values
|
|
@@ -2024,25 +2142,25 @@ export const invalidateWhen: {
|
|
|
2024
2142
|
*
|
|
2025
2143
|
* // Initial cache population
|
|
2026
2144
|
* const value1 = yield* Cache.get(cache, "user")
|
|
2027
|
-
* console.log(value1) // "user-1"
|
|
2028
2145
|
*
|
|
2029
2146
|
* // Get from cache (no lookup)
|
|
2030
2147
|
* const value2 = yield* Cache.get(cache, "user")
|
|
2031
|
-
* console.log(value2) // "user-1" (same value)
|
|
2032
2148
|
*
|
|
2033
2149
|
* // Force refresh - always calls lookup
|
|
2034
2150
|
* const refreshed = yield* Cache.refresh(cache, "user")
|
|
2035
|
-
* console.log(refreshed) // "user-2" (new value)
|
|
2036
2151
|
*
|
|
2037
2152
|
* // Subsequent gets return refreshed value
|
|
2038
2153
|
* const value3 = yield* Cache.get(cache, "user")
|
|
2039
|
-
*
|
|
2154
|
+
* return [value1, value2, refreshed, value3, counter]
|
|
2040
2155
|
* })
|
|
2156
|
+
*
|
|
2157
|
+
* const actual = await Effect.runPromise(program)
|
|
2158
|
+
* actual // => ["user-1", "user-1", "user-2", "user-2", 2]
|
|
2041
2159
|
* ```
|
|
2042
2160
|
*
|
|
2043
2161
|
* **Example** (Resetting TTL on refresh)
|
|
2044
2162
|
*
|
|
2045
|
-
* ```ts
|
|
2163
|
+
* ```ts import.meta.vitest
|
|
2046
2164
|
* import { Cache, Effect } from "effect"
|
|
2047
2165
|
* import { TestClock } from "effect/testing"
|
|
2048
2166
|
*
|
|
@@ -2058,20 +2176,24 @@ export const invalidateWhen: {
|
|
|
2058
2176
|
* yield* TestClock.adjust("45 minutes")
|
|
2059
2177
|
*
|
|
2060
2178
|
* // Entry would normally expire in 15 minutes
|
|
2061
|
-
*
|
|
2179
|
+
* const beforeRefresh = yield* Cache.has(cache, "test")
|
|
2062
2180
|
*
|
|
2063
2181
|
* // Refresh resets the TTL to full 1 hour
|
|
2064
2182
|
* yield* Cache.refresh(cache, "test")
|
|
2065
2183
|
* yield* TestClock.adjust("30 minutes")
|
|
2066
2184
|
*
|
|
2067
2185
|
* // Still valid because TTL was reset
|
|
2068
|
-
*
|
|
2186
|
+
* const afterRefresh = yield* Cache.has(cache, "test")
|
|
2187
|
+
* return [beforeRefresh, afterRefresh]
|
|
2069
2188
|
* })
|
|
2189
|
+
*
|
|
2190
|
+
* const actual = await Effect.runPromise(Effect.provide(program, TestClock.layer()))
|
|
2191
|
+
* actual // => [true, true]
|
|
2070
2192
|
* ```
|
|
2071
2193
|
*
|
|
2072
2194
|
* **Example** (Refreshing missing keys)
|
|
2073
2195
|
*
|
|
2074
|
-
* ```ts
|
|
2196
|
+
* ```ts import.meta.vitest
|
|
2075
2197
|
* import { Cache, Effect } from "effect"
|
|
2076
2198
|
*
|
|
2077
2199
|
* // Refresh non-existent keys
|
|
@@ -2083,11 +2205,14 @@ export const invalidateWhen: {
|
|
|
2083
2205
|
*
|
|
2084
2206
|
* // Refresh non-existent key creates new entry
|
|
2085
2207
|
* const result = yield* Cache.refresh(cache, "newKey")
|
|
2086
|
-
* console.log(result) // "value-for-newKey"
|
|
2087
2208
|
*
|
|
2088
2209
|
* // Verify it's now cached
|
|
2089
|
-
*
|
|
2210
|
+
* const cached = yield* Cache.has(cache, "newKey")
|
|
2211
|
+
* return [result, cached]
|
|
2090
2212
|
* })
|
|
2213
|
+
*
|
|
2214
|
+
* const actual = await Effect.runPromise(program)
|
|
2215
|
+
* actual // => ["value-for-newKey", true]
|
|
2091
2216
|
* ```
|
|
2092
2217
|
*
|
|
2093
2218
|
* @category combinators
|
|
@@ -2104,7 +2229,7 @@ export const refresh: {
|
|
|
2104
2229
|
*
|
|
2105
2230
|
* **Example** (Refreshing cached values)
|
|
2106
2231
|
*
|
|
2107
|
-
* ```ts
|
|
2232
|
+
* ```ts import.meta.vitest
|
|
2108
2233
|
* import { Cache, Effect } from "effect"
|
|
2109
2234
|
*
|
|
2110
2235
|
* // Force refresh of existing cached values
|
|
@@ -2117,25 +2242,25 @@ export const refresh: {
|
|
|
2117
2242
|
*
|
|
2118
2243
|
* // Initial cache population
|
|
2119
2244
|
* const value1 = yield* Cache.get(cache, "user")
|
|
2120
|
-
* console.log(value1) // "user-1"
|
|
2121
2245
|
*
|
|
2122
2246
|
* // Get from cache (no lookup)
|
|
2123
2247
|
* const value2 = yield* Cache.get(cache, "user")
|
|
2124
|
-
* console.log(value2) // "user-1" (same value)
|
|
2125
2248
|
*
|
|
2126
2249
|
* // Force refresh - always calls lookup
|
|
2127
2250
|
* const refreshed = yield* Cache.refresh(cache, "user")
|
|
2128
|
-
* console.log(refreshed) // "user-2" (new value)
|
|
2129
2251
|
*
|
|
2130
2252
|
* // Subsequent gets return refreshed value
|
|
2131
2253
|
* const value3 = yield* Cache.get(cache, "user")
|
|
2132
|
-
*
|
|
2254
|
+
* return [value1, value2, refreshed, value3, counter]
|
|
2133
2255
|
* })
|
|
2256
|
+
*
|
|
2257
|
+
* const actual = await Effect.runPromise(program)
|
|
2258
|
+
* actual // => ["user-1", "user-1", "user-2", "user-2", 2]
|
|
2134
2259
|
* ```
|
|
2135
2260
|
*
|
|
2136
2261
|
* **Example** (Resetting TTL on refresh)
|
|
2137
2262
|
*
|
|
2138
|
-
* ```ts
|
|
2263
|
+
* ```ts import.meta.vitest
|
|
2139
2264
|
* import { Cache, Effect } from "effect"
|
|
2140
2265
|
* import { TestClock } from "effect/testing"
|
|
2141
2266
|
*
|
|
@@ -2151,20 +2276,24 @@ export const refresh: {
|
|
|
2151
2276
|
* yield* TestClock.adjust("45 minutes")
|
|
2152
2277
|
*
|
|
2153
2278
|
* // Entry would normally expire in 15 minutes
|
|
2154
|
-
*
|
|
2279
|
+
* const beforeRefresh = yield* Cache.has(cache, "test")
|
|
2155
2280
|
*
|
|
2156
2281
|
* // Refresh resets the TTL to full 1 hour
|
|
2157
2282
|
* yield* Cache.refresh(cache, "test")
|
|
2158
2283
|
* yield* TestClock.adjust("30 minutes")
|
|
2159
2284
|
*
|
|
2160
2285
|
* // Still valid because TTL was reset
|
|
2161
|
-
*
|
|
2286
|
+
* const afterRefresh = yield* Cache.has(cache, "test")
|
|
2287
|
+
* return [beforeRefresh, afterRefresh]
|
|
2162
2288
|
* })
|
|
2289
|
+
*
|
|
2290
|
+
* const actual = await Effect.runPromise(Effect.provide(program, TestClock.layer()))
|
|
2291
|
+
* actual // => [true, true]
|
|
2163
2292
|
* ```
|
|
2164
2293
|
*
|
|
2165
2294
|
* **Example** (Refreshing missing keys)
|
|
2166
2295
|
*
|
|
2167
|
-
* ```ts
|
|
2296
|
+
* ```ts import.meta.vitest
|
|
2168
2297
|
* import { Cache, Effect } from "effect"
|
|
2169
2298
|
*
|
|
2170
2299
|
* // Refresh non-existent keys
|
|
@@ -2176,11 +2305,14 @@ export const refresh: {
|
|
|
2176
2305
|
*
|
|
2177
2306
|
* // Refresh non-existent key creates new entry
|
|
2178
2307
|
* const result = yield* Cache.refresh(cache, "newKey")
|
|
2179
|
-
* console.log(result) // "value-for-newKey"
|
|
2180
2308
|
*
|
|
2181
2309
|
* // Verify it's now cached
|
|
2182
|
-
*
|
|
2310
|
+
* const cached = yield* Cache.has(cache, "newKey")
|
|
2311
|
+
* return [result, cached]
|
|
2183
2312
|
* })
|
|
2313
|
+
*
|
|
2314
|
+
* const actual = await Effect.runPromise(program)
|
|
2315
|
+
* actual // => ["value-for-newKey", true]
|
|
2184
2316
|
* ```
|
|
2185
2317
|
*
|
|
2186
2318
|
* @category combinators
|
|
@@ -2197,7 +2329,7 @@ export const refresh: {
|
|
|
2197
2329
|
*
|
|
2198
2330
|
* **Example** (Refreshing cached values)
|
|
2199
2331
|
*
|
|
2200
|
-
* ```ts
|
|
2332
|
+
* ```ts import.meta.vitest
|
|
2201
2333
|
* import { Cache, Effect } from "effect"
|
|
2202
2334
|
*
|
|
2203
2335
|
* // Force refresh of existing cached values
|
|
@@ -2210,25 +2342,25 @@ export const refresh: {
|
|
|
2210
2342
|
*
|
|
2211
2343
|
* // Initial cache population
|
|
2212
2344
|
* const value1 = yield* Cache.get(cache, "user")
|
|
2213
|
-
* console.log(value1) // "user-1"
|
|
2214
2345
|
*
|
|
2215
2346
|
* // Get from cache (no lookup)
|
|
2216
2347
|
* const value2 = yield* Cache.get(cache, "user")
|
|
2217
|
-
* console.log(value2) // "user-1" (same value)
|
|
2218
2348
|
*
|
|
2219
2349
|
* // Force refresh - always calls lookup
|
|
2220
2350
|
* const refreshed = yield* Cache.refresh(cache, "user")
|
|
2221
|
-
* console.log(refreshed) // "user-2" (new value)
|
|
2222
2351
|
*
|
|
2223
2352
|
* // Subsequent gets return refreshed value
|
|
2224
2353
|
* const value3 = yield* Cache.get(cache, "user")
|
|
2225
|
-
*
|
|
2354
|
+
* return [value1, value2, refreshed, value3, counter]
|
|
2226
2355
|
* })
|
|
2356
|
+
*
|
|
2357
|
+
* const actual = await Effect.runPromise(program)
|
|
2358
|
+
* actual // => ["user-1", "user-1", "user-2", "user-2", 2]
|
|
2227
2359
|
* ```
|
|
2228
2360
|
*
|
|
2229
2361
|
* **Example** (Resetting TTL on refresh)
|
|
2230
2362
|
*
|
|
2231
|
-
* ```ts
|
|
2363
|
+
* ```ts import.meta.vitest
|
|
2232
2364
|
* import { Cache, Effect } from "effect"
|
|
2233
2365
|
* import { TestClock } from "effect/testing"
|
|
2234
2366
|
*
|
|
@@ -2244,20 +2376,24 @@ export const refresh: {
|
|
|
2244
2376
|
* yield* TestClock.adjust("45 minutes")
|
|
2245
2377
|
*
|
|
2246
2378
|
* // Entry would normally expire in 15 minutes
|
|
2247
|
-
*
|
|
2379
|
+
* const beforeRefresh = yield* Cache.has(cache, "test")
|
|
2248
2380
|
*
|
|
2249
2381
|
* // Refresh resets the TTL to full 1 hour
|
|
2250
2382
|
* yield* Cache.refresh(cache, "test")
|
|
2251
2383
|
* yield* TestClock.adjust("30 minutes")
|
|
2252
2384
|
*
|
|
2253
2385
|
* // Still valid because TTL was reset
|
|
2254
|
-
*
|
|
2386
|
+
* const afterRefresh = yield* Cache.has(cache, "test")
|
|
2387
|
+
* return [beforeRefresh, afterRefresh]
|
|
2255
2388
|
* })
|
|
2389
|
+
*
|
|
2390
|
+
* const actual = await Effect.runPromise(Effect.provide(program, TestClock.layer()))
|
|
2391
|
+
* actual // => [true, true]
|
|
2256
2392
|
* ```
|
|
2257
2393
|
*
|
|
2258
2394
|
* **Example** (Refreshing missing keys)
|
|
2259
2395
|
*
|
|
2260
|
-
* ```ts
|
|
2396
|
+
* ```ts import.meta.vitest
|
|
2261
2397
|
* import { Cache, Effect } from "effect"
|
|
2262
2398
|
*
|
|
2263
2399
|
* // Refresh non-existent keys
|
|
@@ -2269,11 +2405,14 @@ export const refresh: {
|
|
|
2269
2405
|
*
|
|
2270
2406
|
* // Refresh non-existent key creates new entry
|
|
2271
2407
|
* const result = yield* Cache.refresh(cache, "newKey")
|
|
2272
|
-
* console.log(result) // "value-for-newKey"
|
|
2273
2408
|
*
|
|
2274
2409
|
* // Verify it's now cached
|
|
2275
|
-
*
|
|
2410
|
+
* const cached = yield* Cache.has(cache, "newKey")
|
|
2411
|
+
* return [result, cached]
|
|
2276
2412
|
* })
|
|
2413
|
+
*
|
|
2414
|
+
* const actual = await Effect.runPromise(program)
|
|
2415
|
+
* actual // => ["value-for-newKey", true]
|
|
2277
2416
|
* ```
|
|
2278
2417
|
*
|
|
2279
2418
|
* @category combinators
|
|
@@ -2316,7 +2455,7 @@ export const refresh: {
|
|
|
2316
2455
|
*
|
|
2317
2456
|
* **Example** (Invalidating all entries)
|
|
2318
2457
|
*
|
|
2319
|
-
* ```ts
|
|
2458
|
+
* ```ts import.meta.vitest
|
|
2320
2459
|
* import { Cache, Effect } from "effect"
|
|
2321
2460
|
*
|
|
2322
2461
|
* // Clear all cached entries at once
|
|
@@ -2331,18 +2470,29 @@ export const refresh: {
|
|
|
2331
2470
|
* yield* Cache.get(cache, "banana")
|
|
2332
2471
|
* yield* Cache.get(cache, "cherry")
|
|
2333
2472
|
*
|
|
2334
|
-
*
|
|
2335
|
-
*
|
|
2473
|
+
* const sizeBeforeInvalidation = yield* Cache.size(cache)
|
|
2474
|
+
* const hasAppleBeforeInvalidation = yield* Cache.has(cache, "apple")
|
|
2336
2475
|
*
|
|
2337
2476
|
* // Clear all entries
|
|
2338
2477
|
* yield* Cache.invalidateAll(cache)
|
|
2339
2478
|
*
|
|
2340
2479
|
* // Verify cache is empty
|
|
2341
|
-
*
|
|
2342
|
-
*
|
|
2343
|
-
*
|
|
2344
|
-
*
|
|
2480
|
+
* const sizeAfterInvalidation = yield* Cache.size(cache)
|
|
2481
|
+
* const hasAppleAfterInvalidation = yield* Cache.has(cache, "apple")
|
|
2482
|
+
* const hasBananaAfterInvalidation = yield* Cache.has(cache, "banana")
|
|
2483
|
+
* const hasCherryAfterInvalidation = yield* Cache.has(cache, "cherry")
|
|
2484
|
+
* return [
|
|
2485
|
+
* sizeBeforeInvalidation,
|
|
2486
|
+
* hasAppleBeforeInvalidation,
|
|
2487
|
+
* sizeAfterInvalidation,
|
|
2488
|
+
* hasAppleAfterInvalidation,
|
|
2489
|
+
* hasBananaAfterInvalidation,
|
|
2490
|
+
* hasCherryAfterInvalidation
|
|
2491
|
+
* ]
|
|
2345
2492
|
* })
|
|
2493
|
+
*
|
|
2494
|
+
* const actual = await Effect.runPromise(program)
|
|
2495
|
+
* actual // => [3, true, 0, false, false, false]
|
|
2346
2496
|
* ```
|
|
2347
2497
|
*
|
|
2348
2498
|
* @category combinators
|
|
@@ -2364,7 +2514,7 @@ export const invalidateAll = <Key, A, E, R>(self: Cache<Key, A, E, R>): Effect.E
|
|
|
2364
2514
|
*
|
|
2365
2515
|
* **Example** (Reading cache size)
|
|
2366
2516
|
*
|
|
2367
|
-
* ```ts
|
|
2517
|
+
* ```ts import.meta.vitest
|
|
2368
2518
|
* import { Cache, Effect } from "effect"
|
|
2369
2519
|
*
|
|
2370
2520
|
* const program = Effect.gen(function*() {
|
|
@@ -2375,19 +2525,20 @@ export const invalidateAll = <Key, A, E, R>(self: Cache<Key, A, E, R>): Effect.E
|
|
|
2375
2525
|
*
|
|
2376
2526
|
* // Empty cache has size 0
|
|
2377
2527
|
* const emptySize = yield* Cache.size(cache)
|
|
2378
|
-
* console.log(emptySize) // 0
|
|
2379
2528
|
*
|
|
2380
2529
|
* // Add entries and check size
|
|
2381
2530
|
* yield* Cache.get(cache, "hello")
|
|
2382
2531
|
* yield* Cache.get(cache, "world")
|
|
2383
2532
|
* const sizeAfterAdding = yield* Cache.size(cache)
|
|
2384
|
-
* console.log(sizeAfterAdding) // 2
|
|
2385
2533
|
*
|
|
2386
2534
|
* // Size decreases after invalidation
|
|
2387
2535
|
* yield* Cache.invalidate(cache, "hello")
|
|
2388
2536
|
* const sizeAfterInvalidation = yield* Cache.size(cache)
|
|
2389
|
-
*
|
|
2537
|
+
* return [emptySize, sizeAfterAdding, sizeAfterInvalidation]
|
|
2390
2538
|
* })
|
|
2539
|
+
*
|
|
2540
|
+
* const actual = await Effect.runPromise(program)
|
|
2541
|
+
* actual // => [0, 2, 1]
|
|
2391
2542
|
* ```
|
|
2392
2543
|
*
|
|
2393
2544
|
* @category combinators
|
|
@@ -2401,7 +2552,7 @@ export const size = <Key, A, E, R>(self: Cache<Key, A, E, R>): Effect.Effect<num
|
|
|
2401
2552
|
*
|
|
2402
2553
|
* **Example** (Reading active keys)
|
|
2403
2554
|
*
|
|
2404
|
-
* ```ts
|
|
2555
|
+
* ```ts import.meta.vitest
|
|
2405
2556
|
* import { Cache, Effect } from "effect"
|
|
2406
2557
|
*
|
|
2407
2558
|
* // Basic key enumeration
|
|
@@ -2418,9 +2569,11 @@ export const size = <Key, A, E, R>(self: Cache<Key, A, E, R>): Effect.Effect<num
|
|
|
2418
2569
|
*
|
|
2419
2570
|
* // Retrieve all active keys
|
|
2420
2571
|
* const keys = yield* Cache.keys(cache)
|
|
2421
|
-
*
|
|
2422
|
-
* console.log(Array.from(keys).sort()) // ["cache", "hello", "world"]
|
|
2572
|
+
* return Array.from(keys).sort()
|
|
2423
2573
|
* })
|
|
2574
|
+
*
|
|
2575
|
+
* const actual = await Effect.runPromise(program)
|
|
2576
|
+
* actual // => ["cache", "hello", "world"]
|
|
2424
2577
|
* ```
|
|
2425
2578
|
*
|
|
2426
2579
|
* @category combinators
|
|
@@ -2444,7 +2597,7 @@ export const keys = <Key, A, E, R>(self: Cache<Key, A, E, R>): Effect.Effect<Ite
|
|
|
2444
2597
|
*
|
|
2445
2598
|
* **Example** (Reading all cached values)
|
|
2446
2599
|
*
|
|
2447
|
-
* ```ts
|
|
2600
|
+
* ```ts import.meta.vitest
|
|
2448
2601
|
* import { Cache, Effect } from "effect"
|
|
2449
2602
|
*
|
|
2450
2603
|
* const program = Effect.gen(function*() {
|
|
@@ -2460,10 +2613,11 @@ export const keys = <Key, A, E, R>(self: Cache<Key, A, E, R>): Effect.Effect<Ite
|
|
|
2460
2613
|
*
|
|
2461
2614
|
* // Retrieve all cached values
|
|
2462
2615
|
* const values = yield* Cache.values(cache)
|
|
2463
|
-
*
|
|
2464
|
-
*
|
|
2465
|
-
* console.log(valuesArray) // [1, 2, 3]
|
|
2616
|
+
* return Array.from(values).sort()
|
|
2466
2617
|
* })
|
|
2618
|
+
*
|
|
2619
|
+
* const actual = await Effect.runPromise(program)
|
|
2620
|
+
* actual // => [1, 2, 3]
|
|
2467
2621
|
* ```
|
|
2468
2622
|
*
|
|
2469
2623
|
* @category combinators
|