effect 4.0.0-beta.102 → 4.0.0-beta.104
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Array.d.ts +971 -1037
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +381 -407
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +433 -756
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +200 -325
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts +207 -267
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +107 -135
- package/dist/BigInt.js.map +1 -1
- package/dist/Boolean.d.ts +146 -188
- package/dist/Boolean.d.ts.map +1 -1
- package/dist/Boolean.js +64 -84
- package/dist/Boolean.js.map +1 -1
- package/dist/Brand.js.map +1 -1
- package/dist/Cache.d.ts +405 -254
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +167 -102
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +167 -277
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Cause.js +122 -176
- package/dist/Cause.js.map +1 -1
- package/dist/Channel.d.ts +730 -769
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +514 -440
- package/dist/Channel.js.map +1 -1
- package/dist/ChannelSchema.d.ts +1 -1
- package/dist/ChannelSchema.d.ts.map +1 -1
- package/dist/ChannelSchema.js.map +1 -1
- package/dist/Chunk.d.ts +834 -1173
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +326 -439
- package/dist/Chunk.js.map +1 -1
- package/dist/Clock.d.ts +180 -49
- package/dist/Clock.d.ts.map +1 -1
- package/dist/Clock.js +96 -31
- package/dist/Clock.js.map +1 -1
- package/dist/Combiner.d.ts +20 -33
- package/dist/Combiner.d.ts.map +1 -1
- package/dist/Combiner.js +18 -30
- package/dist/Combiner.js.map +1 -1
- package/dist/Config.d.ts +225 -173
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +357 -265
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +194 -68
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +117 -81
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Console.d.ts +233 -33
- package/dist/Console.d.ts.map +1 -1
- package/dist/Console.js +232 -32
- package/dist/Console.js.map +1 -1
- package/dist/Context.d.ts +153 -276
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +171 -214
- package/dist/Context.js.map +1 -1
- package/dist/Cron.d.ts +68 -77
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +57 -66
- package/dist/Cron.js.map +1 -1
- package/dist/Crypto.d.ts +13 -15
- package/dist/Crypto.d.ts.map +1 -1
- package/dist/Crypto.js +22 -15
- package/dist/Crypto.js.map +1 -1
- package/dist/Data.d.ts +60 -80
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js +16 -23
- package/dist/Data.js.map +1 -1
- package/dist/DateTime.d.ts +562 -660
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +307 -362
- package/dist/DateTime.js.map +1 -1
- package/dist/Deferred.d.ts +253 -256
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +104 -96
- package/dist/Deferred.js.map +1 -1
- package/dist/Duration.d.ts +216 -308
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +144 -187
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +2993 -3281
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +1360 -1546
- package/dist/Effect.js.map +1 -1
- package/dist/Effectable.js.map +1 -1
- package/dist/Encoding.d.ts +22 -40
- package/dist/Encoding.d.ts.map +1 -1
- package/dist/Encoding.js +22 -40
- package/dist/Encoding.js.map +1 -1
- package/dist/Equal.d.ts +33 -37
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +39 -23
- package/dist/Equal.js.map +1 -1
- package/dist/Equivalence.d.ts +103 -105
- package/dist/Equivalence.d.ts.map +1 -1
- package/dist/Equivalence.js +77 -79
- package/dist/Equivalence.js.map +1 -1
- package/dist/ErrorReporter.d.ts +51 -27
- package/dist/ErrorReporter.d.ts.map +1 -1
- package/dist/ErrorReporter.js +50 -26
- package/dist/ErrorReporter.js.map +1 -1
- package/dist/ExecutionPlan.d.ts +86 -55
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/ExecutionPlan.js +8 -29
- package/dist/ExecutionPlan.js.map +1 -1
- package/dist/Exit.d.ts +116 -192
- package/dist/Exit.d.ts.map +1 -1
- package/dist/Exit.js +82 -130
- package/dist/Exit.js.map +1 -1
- package/dist/Fiber.d.ts +82 -146
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js +48 -87
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +152 -105
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +106 -73
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +213 -168
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +114 -89
- package/dist/FiberMap.js.map +1 -1
- package/dist/FiberSet.d.ts +123 -81
- package/dist/FiberSet.d.ts.map +1 -1
- package/dist/FiberSet.js +86 -60
- package/dist/FiberSet.js.map +1 -1
- package/dist/FileSystem.d.ts +154 -265
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +42 -147
- package/dist/FileSystem.js.map +1 -1
- package/dist/Filter.d.ts +61 -33
- package/dist/Filter.d.ts.map +1 -1
- package/dist/Filter.js +26 -15
- package/dist/Filter.js.map +1 -1
- package/dist/Formatter.d.ts +25 -33
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +48 -49
- package/dist/Formatter.js.map +1 -1
- package/dist/Function.d.ts +80 -148
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +45 -62
- package/dist/Function.js.map +1 -1
- package/dist/Graph.d.ts +360 -714
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +168 -297
- package/dist/Graph.js.map +1 -1
- package/dist/HKT.d.ts +12 -6
- package/dist/HKT.d.ts.map +1 -1
- package/dist/Hash.d.ts +47 -83
- package/dist/Hash.d.ts.map +1 -1
- package/dist/Hash.js +46 -68
- package/dist/Hash.js.map +1 -1
- package/dist/HashMap.d.ts +319 -411
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashMap.js +122 -166
- package/dist/HashMap.js.map +1 -1
- package/dist/HashRing.d.ts.map +1 -1
- package/dist/HashRing.js +1 -0
- package/dist/HashRing.js.map +1 -1
- package/dist/HashSet.d.ts +177 -284
- package/dist/HashSet.d.ts.map +1 -1
- package/dist/HashSet.js +68 -109
- package/dist/HashSet.js.map +1 -1
- package/dist/Inspectable.d.ts +12 -12
- package/dist/Inspectable.js +8 -8
- package/dist/Inspectable.js.map +1 -1
- package/dist/Iterable.d.ts +620 -786
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +239 -316
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonPatch.d.ts +11 -13
- package/dist/JsonPatch.d.ts.map +1 -1
- package/dist/JsonPatch.js +44 -102
- package/dist/JsonPatch.js.map +1 -1
- package/dist/JsonPointer.d.ts +8 -8
- package/dist/JsonPointer.js +8 -8
- package/dist/JsonPointer.js.map +1 -1
- package/dist/JsonSchema.d.ts +98 -44
- package/dist/JsonSchema.d.ts.map +1 -1
- package/dist/JsonSchema.js +297 -234
- package/dist/JsonSchema.js.map +1 -1
- package/dist/Latch.d.ts +23 -35
- package/dist/Latch.d.ts.map +1 -1
- package/dist/Latch.js +16 -28
- package/dist/Latch.js.map +1 -1
- package/dist/Layer.d.ts +359 -260
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +202 -180
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +42 -29
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +31 -21
- package/dist/LayerMap.js.map +1 -1
- package/dist/LayerRef.d.ts +6 -2
- package/dist/LayerRef.d.ts.map +1 -1
- package/dist/LayerRef.js +6 -2
- package/dist/LayerRef.js.map +1 -1
- package/dist/LogLevel.d.ts +114 -214
- package/dist/LogLevel.d.ts.map +1 -1
- package/dist/LogLevel.js +41 -76
- package/dist/LogLevel.js.map +1 -1
- package/dist/Logger.d.ts +218 -467
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +204 -450
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +7 -5
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/ManagedRuntime.js +7 -5
- package/dist/ManagedRuntime.js.map +1 -1
- package/dist/Match.d.ts +217 -252
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js +150 -183
- package/dist/Match.js.map +1 -1
- package/dist/Metric.d.ts +442 -993
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +198 -642
- package/dist/Metric.js.map +1 -1
- package/dist/MutableHashMap.d.ts +144 -173
- package/dist/MutableHashMap.d.ts.map +1 -1
- package/dist/MutableHashMap.js +68 -79
- package/dist/MutableHashMap.js.map +1 -1
- package/dist/MutableHashSet.d.ts +84 -89
- package/dist/MutableHashSet.d.ts.map +1 -1
- package/dist/MutableHashSet.js +44 -47
- package/dist/MutableHashSet.js.map +1 -1
- package/dist/MutableList.d.ts +71 -370
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +59 -284
- package/dist/MutableList.js.map +1 -1
- package/dist/MutableRef.d.ts +420 -243
- package/dist/MutableRef.d.ts.map +1 -1
- package/dist/MutableRef.js +209 -120
- package/dist/MutableRef.js.map +1 -1
- package/dist/Newtype.d.ts +21 -14
- package/dist/Newtype.d.ts.map +1 -1
- package/dist/Newtype.js +15 -13
- package/dist/Newtype.js.map +1 -1
- package/dist/NonEmptyIterable.d.ts +7 -137
- package/dist/NonEmptyIterable.d.ts.map +1 -1
- package/dist/NonEmptyIterable.js +5 -93
- package/dist/NonEmptyIterable.js.map +1 -1
- package/dist/Number.d.ts +196 -233
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +90 -109
- package/dist/Number.js.map +1 -1
- package/dist/Optic.d.ts +97 -189
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +187 -290
- package/dist/Optic.js.map +1 -1
- package/dist/Option.d.ts +447 -812
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +211 -392
- package/dist/Option.js.map +1 -1
- package/dist/Order.d.ts +109 -109
- package/dist/Order.js +91 -91
- package/dist/Order.js.map +1 -1
- package/dist/Ordering.d.ts +20 -23
- package/dist/Ordering.d.ts.map +1 -1
- package/dist/Ordering.js +8 -9
- package/dist/Ordering.js.map +1 -1
- package/dist/PartitionedSemaphore.js.map +1 -1
- package/dist/Path.d.ts +38 -41
- package/dist/Path.d.ts.map +1 -1
- package/dist/Path.js +3 -4
- package/dist/Path.js.map +1 -1
- package/dist/Pipeable.d.ts +6 -5
- package/dist/Pipeable.d.ts.map +1 -1
- package/dist/Pipeable.js +2 -2
- package/dist/Pipeable.js.map +1 -1
- package/dist/PlatformError.d.ts +4 -4
- package/dist/PlatformError.js +3 -3
- package/dist/PlatformError.js.map +1 -1
- package/dist/Pool.d.ts +4 -2
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +4 -2
- package/dist/Pool.js.map +1 -1
- package/dist/Predicate.d.ts +200 -181
- package/dist/Predicate.d.ts.map +1 -1
- package/dist/Predicate.js +100 -108
- package/dist/Predicate.js.map +1 -1
- package/dist/PrimaryKey.d.ts +7 -7
- package/dist/PrimaryKey.js +5 -5
- package/dist/PrimaryKey.js.map +1 -1
- package/dist/PubSub.d.ts +425 -494
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +373 -362
- package/dist/PubSub.js.map +1 -1
- package/dist/Pull.d.ts +24 -18
- package/dist/Pull.d.ts.map +1 -1
- package/dist/Pull.js +11 -9
- package/dist/Pull.js.map +1 -1
- package/dist/Queue.d.ts +200 -159
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +162 -132
- package/dist/Queue.js.map +1 -1
- package/dist/Random.d.ts +49 -74
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +35 -54
- package/dist/Random.js.map +1 -1
- package/dist/RcMap.d.ts +121 -63
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +42 -21
- package/dist/RcMap.js.map +1 -1
- package/dist/RcRef.d.ts +24 -13
- package/dist/RcRef.d.ts.map +1 -1
- package/dist/RcRef.js +15 -9
- package/dist/RcRef.js.map +1 -1
- package/dist/Record.d.ts +291 -488
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +111 -202
- package/dist/Record.js.map +1 -1
- package/dist/Redactable.d.ts +6 -2
- package/dist/Redactable.d.ts.map +1 -1
- package/dist/Redactable.js +7 -2
- package/dist/Redactable.js.map +1 -1
- package/dist/Redacted.d.ts +25 -25
- package/dist/Redacted.d.ts.map +1 -1
- package/dist/Redacted.js +19 -20
- package/dist/Redacted.js.map +1 -1
- package/dist/Reducer.d.ts +8 -15
- package/dist/Reducer.d.ts.map +1 -1
- package/dist/Reducer.js +6 -12
- package/dist/Reducer.js.map +1 -1
- package/dist/Ref.d.ts +95 -165
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +75 -122
- package/dist/Ref.js.map +1 -1
- package/dist/References.d.ts +102 -168
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +102 -168
- package/dist/References.js.map +1 -1
- package/dist/RegExp.d.ts +10 -14
- package/dist/RegExp.d.ts.map +1 -1
- package/dist/RegExp.js +10 -14
- package/dist/RegExp.js.map +1 -1
- package/dist/Request.d.ts +31 -21
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js +16 -13
- package/dist/Request.js.map +1 -1
- package/dist/RequestResolver.d.ts +201 -90
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +87 -41
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Resource.js.map +1 -1
- package/dist/Result.d.ts +302 -470
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +133 -217
- package/dist/Result.js.map +1 -1
- package/dist/Runtime.d.ts +50 -75
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +39 -60
- package/dist/Runtime.js.map +1 -1
- package/dist/Schedule.d.ts +292 -1638
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +164 -805
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts +5 -5
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +18 -6
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +676 -674
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +513 -544
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +30 -53
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +404 -301
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaError.d.ts +7 -6
- package/dist/SchemaError.d.ts.map +1 -1
- package/dist/SchemaError.js +7 -6
- package/dist/SchemaError.js.map +1 -1
- package/dist/SchemaGetter.d.ts +217 -174
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +218 -185
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.d.ts +62 -190
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js +73 -265
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.d.ts +2 -2
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +137 -107
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +22 -36
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +20 -26
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +114 -74
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +120 -85
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/Scope.d.ts +123 -151
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +72 -92
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.js +1 -1
- package/dist/ScopedCache.js.map +1 -1
- package/dist/ScopedRef.d.ts +3 -3
- package/dist/ScopedRef.js +2 -2
- package/dist/ScopedRef.js.map +1 -1
- package/dist/Semaphore.d.ts +96 -10
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js +78 -39
- package/dist/Semaphore.js.map +1 -1
- package/dist/Sink.d.ts +118 -108
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +107 -100
- package/dist/Sink.js.map +1 -1
- package/dist/Stdio.d.ts +1 -1
- package/dist/Stdio.js.map +1 -1
- package/dist/Stream.d.ts +2442 -2953
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +1105 -1383
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +262 -308
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +184 -215
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts +109 -114
- package/dist/Struct.d.ts.map +1 -1
- package/dist/Struct.js +41 -50
- package/dist/Struct.js.map +1 -1
- package/dist/SubscriptionRef.d.ts +282 -250
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +104 -92
- package/dist/SubscriptionRef.js.map +1 -1
- package/dist/Symbol.d.ts +3 -3
- package/dist/Symbol.js +3 -3
- package/dist/Symbol.js.map +1 -1
- package/dist/SynchronizedRef.js +1 -1
- package/dist/SynchronizedRef.js.map +1 -1
- package/dist/Take.js.map +1 -1
- package/dist/Terminal.d.ts +2 -2
- package/dist/Terminal.js +2 -2
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +100 -54
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +41 -24
- package/dist/Tracer.js.map +1 -1
- package/dist/Trie.d.ts +287 -679
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js +109 -251
- package/dist/Trie.js.map +1 -1
- package/dist/Tuple.d.ts +98 -131
- package/dist/Tuple.d.ts.map +1 -1
- package/dist/Tuple.js +42 -57
- package/dist/Tuple.js.map +1 -1
- package/dist/TxChunk.d.ts +201 -121
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxChunk.js +85 -56
- package/dist/TxChunk.js.map +1 -1
- package/dist/TxDeferred.d.ts +62 -46
- package/dist/TxDeferred.d.ts.map +1 -1
- package/dist/TxDeferred.js +30 -22
- package/dist/TxDeferred.js.map +1 -1
- package/dist/TxHashMap.d.ts +631 -779
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +268 -330
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxHashSet.d.ts +297 -236
- package/dist/TxHashSet.d.ts.map +1 -1
- package/dist/TxHashSet.js +130 -100
- package/dist/TxHashSet.js.map +1 -1
- package/dist/TxPriorityQueue.d.ts +126 -95
- package/dist/TxPriorityQueue.d.ts.map +1 -1
- package/dist/TxPriorityQueue.js +74 -56
- package/dist/TxPriorityQueue.js.map +1 -1
- package/dist/TxPubSub.d.ts +101 -88
- package/dist/TxPubSub.d.ts.map +1 -1
- package/dist/TxPubSub.js +87 -66
- package/dist/TxPubSub.js.map +1 -1
- package/dist/TxQueue.d.ts +200 -180
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxQueue.js +160 -136
- package/dist/TxQueue.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +89 -114
- package/dist/TxReentrantLock.d.ts.map +1 -1
- package/dist/TxReentrantLock.js +75 -53
- package/dist/TxReentrantLock.js.map +1 -1
- package/dist/TxRef.d.ts +51 -32
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +23 -15
- package/dist/TxRef.js.map +1 -1
- package/dist/TxSemaphore.d.ts +129 -95
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +85 -70
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/TxSubscriptionRef.d.ts +97 -70
- package/dist/TxSubscriptionRef.d.ts.map +1 -1
- package/dist/TxSubscriptionRef.js +44 -34
- package/dist/TxSubscriptionRef.js.map +1 -1
- package/dist/Types.d.ts +126 -67
- package/dist/Types.d.ts.map +1 -1
- package/dist/UndefinedOr.js.map +1 -1
- package/dist/Unify.d.ts +45 -65
- package/dist/Unify.d.ts.map +1 -1
- package/dist/Unify.js +6 -9
- package/dist/Unify.js.map +1 -1
- package/dist/Utils.d.ts +23 -16
- package/dist/Utils.d.ts.map +1 -1
- package/dist/Utils.js +3 -7
- package/dist/Utils.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/array.js.map +1 -1
- package/dist/internal/core.js +1 -1
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/dateTime.js +5 -1
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/doNotation.js.map +1 -1
- package/dist/internal/effect.js +77 -40
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/equal.js.map +1 -1
- package/dist/internal/errors.js.map +1 -1
- package/dist/internal/executionPlan.js +51 -3
- package/dist/internal/executionPlan.js.map +1 -1
- package/dist/internal/hashMap.js +12 -8
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/hashSet.js.map +1 -1
- package/dist/internal/layer.js.map +1 -1
- package/dist/internal/matcher.js +1 -1
- package/dist/internal/matcher.js.map +1 -1
- package/dist/internal/metric.js.map +1 -1
- package/dist/internal/option.js.map +1 -1
- package/dist/internal/persistence.d.ts +2 -0
- package/dist/internal/persistence.d.ts.map +1 -0
- package/dist/internal/persistence.js +3 -0
- package/dist/internal/persistence.js.map +1 -0
- package/dist/internal/random.js.map +1 -1
- package/dist/internal/rcRef.js.map +1 -1
- package/dist/internal/record.js.map +1 -1
- package/dist/internal/redacted.js.map +1 -1
- package/dist/internal/references.js +3 -0
- package/dist/internal/references.js.map +1 -1
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/result.js.map +1 -1
- package/dist/internal/schedule.js.map +1 -1
- package/dist/internal/schema/annotations.js +2 -0
- package/dist/internal/schema/annotations.js.map +1 -1
- package/dist/internal/schema/cause.js.map +1 -1
- package/dist/internal/schema/fromJsonSchemaDocument.js +13 -11
- package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -1
- package/dist/internal/schema/fromRepresentation.js +8 -15
- package/dist/internal/schema/fromRepresentation.js.map +1 -1
- package/dist/internal/schema/parser.d.ts +14 -0
- package/dist/internal/schema/parser.d.ts.map +1 -0
- package/dist/internal/schema/parser.js +13 -0
- package/dist/internal/schema/parser.js.map +1 -0
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/internal/schema/toArbitrary.js +1 -1
- package/dist/internal/schema/toArbitrary.js.map +1 -1
- package/dist/internal/schema/toCodeDocument.js.map +1 -1
- package/dist/internal/schema/toEquivalence.js.map +1 -1
- package/dist/internal/schema/toJsonSchemaDocument.js +48 -6
- package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -1
- package/dist/internal/schema/toRepresentation.js +87 -107
- package/dist/internal/schema/toRepresentation.js.map +1 -1
- package/dist/internal/stackTraceLimit.js.map +1 -1
- package/dist/internal/stream.js.map +1 -1
- package/dist/internal/tracer.js.map +1 -1
- package/dist/internal/trie.js +24 -10
- package/dist/internal/trie.js.map +1 -1
- package/dist/testing/FastCheck.d.ts +8 -7
- package/dist/testing/FastCheck.d.ts.map +1 -1
- package/dist/testing/FastCheck.js +8 -7
- package/dist/testing/FastCheck.js.map +1 -1
- package/dist/testing/TestClock.d.ts +57 -28
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestClock.js +61 -19
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/testing/TestConsole.d.ts +32 -31
- package/dist/testing/TestConsole.d.ts.map +1 -1
- package/dist/testing/TestConsole.js +24 -22
- package/dist/testing/TestConsole.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +30 -30
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/testing/TestSchema.js +25 -25
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +95 -118
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +113 -136
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +132 -97
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +56 -52
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
- package/dist/unstable/ai/IdGenerator.d.ts +32 -28
- package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
- package/dist/unstable/ai/IdGenerator.js +26 -21
- package/dist/unstable/ai/IdGenerator.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +107 -67
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +108 -66
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpProtocol.d.ts +30 -0
- package/dist/unstable/ai/McpProtocol.d.ts.map +1 -0
- package/dist/unstable/ai/McpProtocol.js +20 -0
- package/dist/unstable/ai/McpProtocol.js.map +1 -0
- package/dist/unstable/ai/McpSchema.d.ts +251 -185
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +66 -58
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +68 -59
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +695 -242
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Model.d.ts +8 -19
- package/dist/unstable/ai/Model.d.ts.map +1 -1
- package/dist/unstable/ai/Model.js +9 -20
- package/dist/unstable/ai/Model.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Prompt.d.ts +127 -41
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Prompt.js +59 -20
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +28 -14
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js +9 -4
- package/dist/unstable/ai/Response.js.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.js.map +1 -1
- package/dist/unstable/ai/Telemetry.d.ts +46 -13
- package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
- package/dist/unstable/ai/Telemetry.js +18 -7
- package/dist/unstable/ai/Telemetry.js.map +1 -1
- package/dist/unstable/ai/Tokenizer.d.ts +14 -3
- package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
- package/dist/unstable/ai/Tokenizer.js +10 -2
- package/dist/unstable/ai/Tokenizer.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +59 -44
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +48 -39
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +26 -8
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +18 -4
- package/dist/unstable/ai/Toolkit.js.map +1 -1
- package/dist/unstable/ai/index.d.ts +4 -0
- package/dist/unstable/ai/index.d.ts.map +1 -1
- package/dist/unstable/ai/index.js +4 -0
- package/dist/unstable/ai/index.js.map +1 -1
- package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
- package/dist/unstable/ai/internal/mcpProtocol.d.ts +21 -0
- package/dist/unstable/ai/internal/mcpProtocol.d.ts.map +1 -0
- package/dist/unstable/ai/internal/mcpProtocol.js +22 -0
- package/dist/unstable/ai/internal/mcpProtocol.js.map +1 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.d.ts +2 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.d.ts.map +1 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.js +32 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.js.map +1 -0
- package/dist/unstable/ai/internal/structured-output.js +14 -15
- package/dist/unstable/ai/internal/structured-output.js.map +1 -1
- package/dist/unstable/cli/Argument.d.ts +273 -69
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js +111 -33
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/CliConfig.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +70 -77
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +66 -70
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/CliOutput.d.ts +35 -54
- package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
- package/dist/unstable/cli/CliOutput.js +26 -42
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +713 -115
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +245 -47
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Completions.js.map +1 -1
- package/dist/unstable/cli/Flag.d.ts +418 -138
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +197 -71
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +1 -1
- package/dist/unstable/cli/GlobalFlag.js.map +1 -1
- package/dist/unstable/cli/HelpDoc.d.ts +12 -4
- package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
- package/dist/unstable/cli/Param.d.ts +299 -83
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +143 -57
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +370 -149
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js +375 -160
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/Prompt.d.ts +23 -14
- package/dist/unstable/cli/Prompt.d.ts.map +1 -1
- package/dist/unstable/cli/Prompt.js +54 -31
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/index.js.map +1 -1
- package/dist/unstable/cli/internal/ansi.js +2 -2
- package/dist/unstable/cli/internal/ansi.js.map +1 -1
- package/dist/unstable/cli/internal/auto-suggest.js.map +1 -1
- package/dist/unstable/cli/internal/command.d.ts +2 -2
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +10 -9
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/completions/bash.js +69 -9
- package/dist/unstable/cli/internal/completions/bash.js.map +1 -1
- package/dist/unstable/cli/internal/completions/descriptor.js +24 -18
- package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -1
- package/dist/unstable/cli/internal/completions/fish.js +5 -5
- package/dist/unstable/cli/internal/completions/fish.js.map +1 -1
- package/dist/unstable/cli/internal/completions/zsh.js.map +1 -1
- package/dist/unstable/cli/internal/config.js.map +1 -1
- package/dist/unstable/cli/internal/help.d.ts.map +1 -1
- package/dist/unstable/cli/internal/help.js +4 -2
- package/dist/unstable/cli/internal/help.js.map +1 -1
- package/dist/unstable/cli/internal/lexer.js +17 -7
- package/dist/unstable/cli/internal/lexer.js.map +1 -1
- package/dist/unstable/cli/internal/parser.js +5 -5
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cli/internal/wizard.js +2 -2
- package/dist/unstable/cli/internal/wizard.js.map +1 -1
- package/dist/unstable/cluster/ClusterCron.js.map +1 -1
- package/dist/unstable/cluster/ClusterError.js +7 -7
- package/dist/unstable/cluster/ClusterError.js.map +1 -1
- package/dist/unstable/cluster/ClusterMetrics.js.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.d.ts +8 -8
- package/dist/unstable/cluster/ClusterSchema.js +8 -8
- package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +6 -2
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/DeliverAt.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +10 -10
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +8 -8
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/EntityAddress.js.map +1 -1
- package/dist/unstable/cluster/EntityId.js.map +1 -1
- package/dist/unstable/cluster/EntityProxy.d.ts +4 -2
- package/dist/unstable/cluster/EntityProxy.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxy.js +4 -2
- package/dist/unstable/cluster/EntityProxy.js.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
- package/dist/unstable/cluster/EntityResource.d.ts +2 -2
- package/dist/unstable/cluster/EntityResource.js +2 -2
- package/dist/unstable/cluster/EntityResource.js.map +1 -1
- package/dist/unstable/cluster/EntityType.js.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts +3 -3
- package/dist/unstable/cluster/Envelope.js +3 -3
- package/dist/unstable/cluster/Envelope.js.map +1 -1
- package/dist/unstable/cluster/HttpRunner.d.ts +2 -2
- package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/HttpRunner.js +6 -4
- package/dist/unstable/cluster/HttpRunner.js.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
- package/dist/unstable/cluster/MachineId.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +9 -9
- package/dist/unstable/cluster/Message.js +6 -6
- package/dist/unstable/cluster/Message.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +15 -15
- package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/MessageStorage.js +13 -6
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts +8 -0
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +16 -4
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/Runner.js.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.d.ts +1 -1
- package/dist/unstable/cluster/RunnerHealth.js +1 -1
- package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts +2 -1
- package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +18 -16
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.d.ts +3 -4
- package/dist/unstable/cluster/RunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.js +8 -7
- package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +6 -6
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +19 -10
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/ShardId.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +25 -6
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +3 -3
- package/dist/unstable/cluster/ShardingConfig.js +3 -3
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/ShardingRegistrationEvent.js.map +1 -1
- package/dist/unstable/cluster/SingleRunner.js.map +1 -1
- package/dist/unstable/cluster/Singleton.js.map +1 -1
- package/dist/unstable/cluster/SingletonAddress.d.ts +1 -1
- package/dist/unstable/cluster/SingletonAddress.js +1 -1
- package/dist/unstable/cluster/SingletonAddress.js.map +1 -1
- package/dist/unstable/cluster/Snowflake.d.ts +8 -8
- package/dist/unstable/cluster/Snowflake.js +8 -8
- package/dist/unstable/cluster/Snowflake.js.map +1 -1
- package/dist/unstable/cluster/SocketRunner.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js +20 -5
- package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/TestRunner.js.map +1 -1
- package/dist/unstable/cluster/index.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +6 -6
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/cluster/internal/entityReaper.js.map +1 -1
- package/dist/unstable/cluster/internal/hash.js.map +1 -1
- package/dist/unstable/cluster/internal/interruptors.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceMap.js +2 -2
- package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceRef.js +17 -0
- package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
- package/dist/unstable/cluster/internal/shardLock.js.map +1 -1
- package/dist/unstable/devtools/DevTools.js.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.js +7 -2
- package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
- package/dist/unstable/devtools/DevToolsServer.js.map +1 -1
- package/dist/unstable/devtools/index.js.map +1 -1
- package/dist/unstable/encoding/Ini.d.ts +20 -0
- package/dist/unstable/encoding/Ini.d.ts.map +1 -0
- package/dist/unstable/encoding/Ini.js +153 -0
- package/dist/unstable/encoding/Ini.js.map +1 -0
- package/dist/unstable/encoding/Msgpack.d.ts +2 -1
- package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
- package/dist/unstable/encoding/Msgpack.js +27 -15
- package/dist/unstable/encoding/Msgpack.js.map +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
- package/dist/unstable/encoding/Ndjson.js +7 -1
- package/dist/unstable/encoding/Ndjson.js.map +1 -1
- package/dist/unstable/encoding/Sse.d.ts +72 -8
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.js +72 -31
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/encoding/Toml.d.ts +19 -0
- package/dist/unstable/encoding/Toml.d.ts.map +1 -0
- package/dist/unstable/encoding/Toml.js +434 -0
- package/dist/unstable/encoding/Toml.js.map +1 -0
- package/dist/unstable/encoding/Yaml.d.ts +19 -0
- package/dist/unstable/encoding/Yaml.d.ts.map +1 -0
- package/dist/unstable/encoding/Yaml.js +461 -0
- package/dist/unstable/encoding/Yaml.js.map +1 -0
- package/dist/unstable/encoding/index.d.ts +12 -0
- package/dist/unstable/encoding/index.d.ts.map +1 -1
- package/dist/unstable/encoding/index.js +12 -0
- package/dist/unstable/encoding/index.js.map +1 -1
- package/dist/unstable/eventlog/Event.d.ts +20 -20
- package/dist/unstable/eventlog/Event.js.map +1 -1
- package/dist/unstable/eventlog/EventGroup.d.ts +4 -4
- package/dist/unstable/eventlog/EventGroup.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +16 -16
- package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventJournal.js +26 -18
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts +3 -3
- package/dist/unstable/eventlog/EventLog.js +3 -3
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.d.ts +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +2 -2
- package/dist/unstable/eventlog/EventLogMessage.js +2 -2
- package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +15 -15
- package/dist/unstable/eventlog/EventLogRemote.js +1 -1
- package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.d.ts +11 -2
- package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.js +45 -21
- package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +4 -4
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.js +13 -5
- package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +5 -5
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js +15 -7
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.js +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.js +1 -4
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/index.js.map +1 -1
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js.map +1 -1
- package/dist/unstable/http/Cookies.d.ts +2 -2
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +30 -18
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Etag.d.ts +1 -1
- package/dist/unstable/http/Etag.js +1 -1
- package/dist/unstable/http/Etag.js.map +1 -1
- package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/unstable/http/FetchHttpClient.js.map +1 -1
- package/dist/unstable/http/FindMyWay/internal/queryString.d.ts +11 -0
- package/dist/unstable/http/FindMyWay/internal/queryString.d.ts.map +1 -0
- package/dist/unstable/http/FindMyWay/internal/queryString.js +259 -0
- package/dist/unstable/http/FindMyWay/internal/queryString.js.map +1 -0
- package/dist/unstable/http/FindMyWay/internal/router.d.ts +2 -0
- package/dist/unstable/http/FindMyWay/internal/router.d.ts.map +1 -0
- package/dist/unstable/http/FindMyWay/internal/router.js +665 -0
- package/dist/unstable/http/FindMyWay/internal/router.js.map +1 -0
- package/dist/unstable/http/FindMyWay.d.ts +33 -8
- package/dist/unstable/http/FindMyWay.d.ts.map +1 -1
- package/dist/unstable/http/FindMyWay.js +4 -7
- package/dist/unstable/http/FindMyWay.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts +2 -2
- package/dist/unstable/http/Headers.js +2 -2
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpBody.d.ts +5 -3
- package/dist/unstable/http/HttpBody.d.ts.map +1 -1
- package/dist/unstable/http/HttpBody.js +11 -5
- package/dist/unstable/http/HttpBody.js.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts +51 -44
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +46 -17
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientError.js +1 -1
- package/dist/unstable/http/HttpClientError.js.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +2 -12
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts +4 -4
- package/dist/unstable/http/HttpClientResponse.js +3 -18
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts +6 -6
- package/dist/unstable/http/HttpEffect.js +3 -3
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMethod.d.ts +6 -9
- package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
- package/dist/unstable/http/HttpMethod.js +6 -9
- package/dist/unstable/http/HttpMethod.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts +75 -9
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +164 -39
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpPlatform.d.ts +76 -0
- package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
- package/dist/unstable/http/HttpPlatform.js +53 -3
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +88 -89
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +78 -79
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServer.d.ts +13 -13
- package/dist/unstable/http/HttpServer.js +6 -6
- package/dist/unstable/http/HttpServer.js.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +2 -2
- package/dist/unstable/http/HttpServerError.js +2 -2
- package/dist/unstable/http/HttpServerError.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +4 -4
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +11 -10
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +22 -0
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +17 -5
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpStaticServer.d.ts +35 -7
- package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpStaticServer.js +35 -7
- package/dist/unstable/http/HttpStaticServer.js.map +1 -1
- package/dist/unstable/http/HttpTraceContext.js.map +1 -1
- package/dist/unstable/http/Multipart.d.ts +7 -7
- package/dist/unstable/http/Multipart.d.ts.map +1 -1
- package/dist/unstable/http/Multipart.js +14 -7
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/MultipartParser/HeadersParser.d.ts +53 -0
- package/dist/unstable/http/MultipartParser/HeadersParser.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser/HeadersParser.js +14 -0
- package/dist/unstable/http/MultipartParser/HeadersParser.js.map +1 -0
- package/dist/unstable/http/MultipartParser/Search.d.ts +11 -0
- package/dist/unstable/http/MultipartParser/Search.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser/Search.js +14 -0
- package/dist/unstable/http/MultipartParser/Search.js.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/contentType.d.ts +5 -0
- package/dist/unstable/http/MultipartParser/internal/contentType.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/contentType.js +82 -0
- package/dist/unstable/http/MultipartParser/internal/contentType.js.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/headers.d.ts +3 -0
- package/dist/unstable/http/MultipartParser/internal/headers.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/headers.js +194 -0
- package/dist/unstable/http/MultipartParser/internal/headers.js.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/multipart.d.ts +8 -0
- package/dist/unstable/http/MultipartParser/internal/multipart.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/multipart.js +226 -0
- package/dist/unstable/http/MultipartParser/internal/multipart.js.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/search.d.ts +5 -0
- package/dist/unstable/http/MultipartParser/internal/search.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser/internal/search.js +120 -0
- package/dist/unstable/http/MultipartParser/internal/search.js.map +1 -0
- package/dist/unstable/http/MultipartParser.d.ts +98 -0
- package/dist/unstable/http/MultipartParser.d.ts.map +1 -0
- package/dist/unstable/http/MultipartParser.js +23 -0
- package/dist/unstable/http/MultipartParser.js.map +1 -0
- package/dist/unstable/http/Template.d.ts.map +1 -1
- package/dist/unstable/http/Template.js +2 -2
- package/dist/unstable/http/Template.js.map +1 -1
- package/dist/unstable/http/Url.d.ts +33 -63
- package/dist/unstable/http/Url.d.ts.map +1 -1
- package/dist/unstable/http/Url.js +14 -28
- package/dist/unstable/http/Url.js.map +1 -1
- package/dist/unstable/http/UrlParams.d.ts +10 -18
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +9 -17
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/http/index.d.ts +1 -1
- package/dist/unstable/http/index.d.ts.map +1 -1
- package/dist/unstable/http/index.js +1 -1
- package/dist/unstable/http/index.js.map +1 -1
- package/dist/unstable/http/internal/compression.d.ts +2 -0
- package/dist/unstable/http/internal/compression.d.ts.map +1 -0
- package/dist/unstable/http/internal/compression.js +155 -0
- package/dist/unstable/http/internal/compression.js.map +1 -0
- package/dist/unstable/http/internal/httpBody.d.ts +2 -0
- package/dist/unstable/http/internal/httpBody.d.ts.map +1 -0
- package/dist/unstable/http/internal/httpBody.js +10 -0
- package/dist/unstable/http/internal/httpBody.js.map +1 -0
- package/dist/unstable/http/internal/preResponseHandler.js.map +1 -1
- package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js +5 -5
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +78 -26
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +4 -5
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +76 -38
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +48 -46
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.js +73 -16
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +18 -18
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.js +30 -30
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.d.ts +15 -15
- package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +71 -24
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js +57 -10
- package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts +0 -12
- package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +225 -6
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.js +174 -4
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiTest.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts +21 -13
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +58 -31
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/httpapi/index.js.map +1 -1
- package/dist/unstable/httpapi/internal/html.js.map +1 -1
- package/dist/unstable/httpapi/internal/httpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/internal/httpApiSwagger.js.map +1 -1
- package/dist/unstable/httpapi/internal/mediaType.js.map +1 -1
- package/dist/unstable/observability/Otlp.js.map +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts +13 -15
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +19 -5
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js +2 -2
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts +6 -3
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.js +28 -15
- package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
- package/dist/unstable/observability/OtlpResource.d.ts +16 -7
- package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpResource.js +21 -12
- package/dist/unstable/observability/OtlpResource.js.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js +1 -1
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.d.ts +13 -4
- package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.js +10 -3
- package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
- package/dist/unstable/observability/index.js.map +1 -1
- package/dist/unstable/observability/internal/otlpEnv.js +1 -1
- package/dist/unstable/observability/internal/otlpEnv.js.map +1 -1
- package/dist/unstable/observability/internal/otlpProtobuf.js.map +1 -1
- package/dist/unstable/observability/internal/protobuf.js +3 -0
- package/dist/unstable/observability/internal/protobuf.js.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +8 -3
- package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.js +22 -13
- package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
- package/dist/unstable/persistence/Persistable.d.ts +8 -8
- package/dist/unstable/persistence/Persistable.js.map +1 -1
- package/dist/unstable/persistence/PersistedCache.js.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts +6 -6
- package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.js +15 -15
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/Persistence.d.ts +3 -3
- package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistence.js +108 -22
- package/dist/unstable/persistence/Persistence.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +45 -24
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +29 -45
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/persistence/Redis.d.ts +2 -2
- package/dist/unstable/persistence/Redis.js +2 -2
- package/dist/unstable/persistence/Redis.js.map +1 -1
- package/dist/unstable/persistence/index.js.map +1 -1
- package/dist/unstable/process/ChildProcess.d.ts +64 -21
- package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcess.js +14 -5
- package/dist/unstable/process/ChildProcess.js.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.d.ts +21 -10
- package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
- package/dist/unstable/process/index.js.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.d.ts +8 -8
- package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.js +10 -10
- package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +25 -22
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +14 -13
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.js +4 -1
- package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/unstable/reactivity/AtomRef.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +24 -3
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.js +4 -1
- package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
- package/dist/unstable/reactivity/Hydration.d.ts +1 -1
- package/dist/unstable/reactivity/Hydration.js +1 -1
- package/dist/unstable/reactivity/Hydration.js.map +1 -1
- package/dist/unstable/reactivity/Reactivity.js.map +1 -1
- package/dist/unstable/reactivity/index.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +35 -33
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js +4 -2
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts +26 -12
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +30 -20
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcClientError.js +2 -2
- package/dist/unstable/rpc/RpcClientError.js.map +1 -1
- package/dist/unstable/rpc/RpcGroup.d.ts +8 -8
- package/dist/unstable/rpc/RpcGroup.js +1 -1
- package/dist/unstable/rpc/RpcGroup.js.map +1 -1
- package/dist/unstable/rpc/RpcMessage.d.ts +31 -30
- package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMessage.js +6 -6
- package/dist/unstable/rpc/RpcMessage.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts +10 -10
- package/dist/unstable/rpc/RpcMiddleware.js +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts +4 -4
- package/dist/unstable/rpc/RpcSchema.js +3 -3
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts +58 -7
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +177 -96
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +13 -13
- package/dist/unstable/rpc/RpcServer.js +17 -13
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/rpc/RpcTest.js.map +1 -1
- package/dist/unstable/rpc/RpcWorker.d.ts +5 -5
- package/dist/unstable/rpc/RpcWorker.js +4 -4
- package/dist/unstable/rpc/RpcWorker.js.map +1 -1
- package/dist/unstable/rpc/Utils.js.map +1 -1
- package/dist/unstable/rpc/index.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts +53 -51
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js +35 -33
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +10 -10
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.js +19 -11
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/schema/index.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +11 -3
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +37 -16
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/socket/SocketServer.js.map +1 -1
- package/dist/unstable/socket/index.js.map +1 -1
- package/dist/unstable/sql/Migrator.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts +1 -1
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +8 -4
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/sql/SqlConnection.js.map +1 -1
- package/dist/unstable/sql/SqlError.js +13 -13
- package/dist/unstable/sql/SqlError.js.map +1 -1
- package/dist/unstable/sql/SqlModel.d.ts +2 -2
- package/dist/unstable/sql/SqlModel.js +2 -2
- package/dist/unstable/sql/SqlModel.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.d.ts +5 -5
- package/dist/unstable/sql/SqlResolver.js +10 -8
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/sql/SqlSchema.js.map +1 -1
- package/dist/unstable/sql/SqlStream.js.map +1 -1
- package/dist/unstable/sql/Statement.d.ts +6 -6
- package/dist/unstable/sql/Statement.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.js +23 -21
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/sql/index.js.map +1 -1
- package/dist/unstable/workers/Transferable.d.ts +1 -1
- package/dist/unstable/workers/Transferable.js +1 -1
- package/dist/unstable/workers/Transferable.js.map +1 -1
- package/dist/unstable/workers/Worker.d.ts +2 -2
- package/dist/unstable/workers/Worker.js +2 -2
- package/dist/unstable/workers/Worker.js.map +1 -1
- package/dist/unstable/workers/WorkerError.d.ts +7 -7
- package/dist/unstable/workers/WorkerError.js +11 -11
- package/dist/unstable/workers/WorkerError.js.map +1 -1
- package/dist/unstable/workers/WorkerRunner.d.ts +1 -1
- package/dist/unstable/workers/WorkerRunner.js +1 -1
- package/dist/unstable/workers/WorkerRunner.js.map +1 -1
- package/dist/unstable/workers/index.js.map +1 -1
- package/dist/unstable/workflow/Activity.d.ts +2 -2
- package/dist/unstable/workflow/Activity.js +2 -2
- package/dist/unstable/workflow/Activity.js.map +1 -1
- package/dist/unstable/workflow/DurableClock.d.ts +1 -1
- package/dist/unstable/workflow/DurableClock.js +1 -1
- package/dist/unstable/workflow/DurableClock.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts +10 -10
- package/dist/unstable/workflow/DurableDeferred.js +5 -5
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/DurableQueue.d.ts +22 -20
- package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableQueue.js +22 -20
- package/dist/unstable/workflow/DurableQueue.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +21 -21
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js +13 -14
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +2 -2
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +3 -3
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.d.ts +4 -2
- package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.js +4 -2
- package/dist/unstable/workflow/WorkflowProxy.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
- package/dist/unstable/workflow/index.js.map +1 -1
- package/dist/unstable/workflow/internal/crypto.js.map +1 -1
- package/package.json +6 -13
- package/src/Array.ts +982 -1045
- package/src/BigDecimal.ts +433 -756
- package/src/BigInt.ts +213 -269
- package/src/Boolean.ts +146 -188
- package/src/Cache.ts +410 -256
- package/src/Cause.ts +167 -277
- package/src/Channel.ts +892 -817
- package/src/ChannelSchema.ts +1 -1
- package/src/Chunk.ts +841 -1181
- package/src/Clock.ts +181 -49
- package/src/Combiner.ts +20 -33
- package/src/Config.ts +636 -332
- package/src/ConfigProvider.ts +218 -121
- package/src/Console.ts +289 -39
- package/src/Context.ts +322 -381
- package/src/Cron.ts +68 -77
- package/src/Crypto.ts +30 -23
- package/src/Data.ts +60 -80
- package/src/DateTime.ts +564 -660
- package/src/Deferred.ts +253 -256
- package/src/Duration.ts +232 -310
- package/src/Effect.ts +3034 -3296
- package/src/Encoding.ts +22 -40
- package/src/Equal.ts +59 -41
- package/src/Equivalence.ts +103 -105
- package/src/ErrorReporter.ts +51 -27
- package/src/ExecutionPlan.ts +91 -56
- package/src/Exit.ts +116 -192
- package/src/Fiber.ts +81 -148
- package/src/FiberHandle.ts +152 -105
- package/src/FiberMap.ts +225 -174
- package/src/FiberSet.ts +125 -83
- package/src/FileSystem.ts +156 -264
- package/src/Filter.ts +61 -33
- package/src/Formatter.ts +54 -56
- package/src/Function.ts +82 -151
- package/src/Graph.ts +416 -770
- package/src/HKT.ts +12 -6
- package/src/Hash.ts +52 -83
- package/src/HashMap.ts +319 -411
- package/src/HashRing.ts +1 -0
- package/src/HashSet.ts +177 -284
- package/src/Inspectable.ts +12 -12
- package/src/Iterable.ts +631 -796
- package/src/JsonPatch.ts +58 -112
- package/src/JsonPointer.ts +8 -8
- package/src/JsonSchema.ts +402 -244
- package/src/Latch.ts +23 -35
- package/src/Layer.ts +366 -265
- package/src/LayerMap.ts +49 -29
- package/src/LayerRef.ts +6 -2
- package/src/LogLevel.ts +114 -214
- package/src/Logger.ts +344 -697
- package/src/ManagedRuntime.ts +7 -5
- package/src/Match.ts +217 -252
- package/src/Metric.ts +516 -1089
- package/src/MutableHashMap.ts +218 -255
- package/src/MutableHashSet.ts +84 -89
- package/src/MutableList.ts +73 -370
- package/src/MutableRef.ts +420 -243
- package/src/Newtype.ts +21 -14
- package/src/NonEmptyIterable.ts +7 -137
- package/src/Number.ts +196 -233
- package/src/Optic.ts +243 -383
- package/src/Option.ts +447 -812
- package/src/Order.ts +109 -109
- package/src/Ordering.ts +20 -23
- package/src/Path.ts +38 -41
- package/src/Pipeable.ts +6 -5
- package/src/PlatformError.ts +4 -4
- package/src/Pool.ts +4 -2
- package/src/Predicate.ts +200 -181
- package/src/PrimaryKey.ts +7 -7
- package/src/PubSub.ts +526 -552
- package/src/Pull.ts +24 -18
- package/src/Queue.ts +200 -159
- package/src/Random.ts +49 -74
- package/src/RcMap.ts +121 -63
- package/src/RcRef.ts +24 -13
- package/src/Record.ts +291 -488
- package/src/Redactable.ts +10 -3
- package/src/Redacted.ts +25 -25
- package/src/Reducer.ts +8 -15
- package/src/Ref.ts +221 -361
- package/src/References.ts +102 -168
- package/src/RegExp.ts +10 -14
- package/src/Request.ts +31 -21
- package/src/RequestResolver.ts +202 -91
- package/src/Result.ts +312 -484
- package/src/Runtime.ts +50 -75
- package/src/Schedule.ts +311 -1737
- package/src/Scheduler.ts +20 -7
- package/src/Schema.ts +766 -786
- package/src/SchemaAST.ts +522 -382
- package/src/SchemaError.ts +7 -6
- package/src/SchemaGetter.ts +242 -190
- package/src/SchemaIssue.ts +89 -275
- package/src/SchemaParser.ts +217 -124
- package/src/SchemaRepresentation.ts +22 -40
- package/src/SchemaTransformation.ts +129 -88
- package/src/Scope.ts +123 -151
- package/src/ScopedCache.ts +1 -1
- package/src/ScopedRef.ts +4 -4
- package/src/Semaphore.ts +152 -51
- package/src/Sink.ts +129 -114
- package/src/Stdio.ts +1 -1
- package/src/Stream.ts +2679 -3133
- package/src/String.ts +275 -312
- package/src/Struct.ts +109 -114
- package/src/SubscriptionRef.ts +284 -252
- package/src/Symbol.ts +3 -3
- package/src/SynchronizedRef.ts +1 -1
- package/src/Terminal.ts +3 -3
- package/src/Tracer.ts +102 -55
- package/src/Trie.ts +287 -679
- package/src/Tuple.ts +99 -131
- package/src/TxChunk.ts +201 -121
- package/src/TxDeferred.ts +62 -46
- package/src/TxHashMap.ts +645 -799
- package/src/TxHashSet.ts +443 -356
- package/src/TxPriorityQueue.ts +130 -98
- package/src/TxPubSub.ts +107 -80
- package/src/TxQueue.ts +214 -183
- package/src/TxReentrantLock.ts +136 -101
- package/src/TxRef.ts +51 -32
- package/src/TxSemaphore.ts +129 -95
- package/src/TxSubscriptionRef.ts +97 -70
- package/src/Types.ts +126 -67
- package/src/Unify.ts +45 -65
- package/src/Utils.ts +23 -16
- package/src/internal/core.ts +2 -2
- package/src/internal/dateTime.ts +7 -1
- package/src/internal/effect.ts +93 -48
- package/src/internal/executionPlan.ts +105 -10
- package/src/internal/hashMap.ts +20 -14
- package/src/internal/matcher.ts +2 -2
- package/src/internal/persistence.ts +2 -0
- package/src/internal/references.ts +3 -2
- package/src/internal/schedule.ts +4 -4
- package/src/internal/schema/annotations.ts +3 -0
- package/src/internal/schema/fromJsonSchemaDocument.ts +15 -13
- package/src/internal/schema/fromRepresentation.ts +10 -16
- package/src/internal/schema/parser.ts +22 -0
- package/src/internal/schema/toArbitrary.ts +3 -1
- package/src/internal/schema/toJsonSchemaDocument.ts +60 -6
- package/src/internal/schema/toRepresentation.ts +104 -119
- package/src/internal/trie.ts +21 -12
- package/src/testing/FastCheck.ts +8 -7
- package/src/testing/TestClock.ts +85 -31
- package/src/testing/TestConsole.ts +32 -31
- package/src/testing/TestSchema.ts +30 -30
- package/src/unstable/ai/AiError.ts +114 -137
- package/src/unstable/ai/AnthropicStructuredOutput.ts +1 -1
- package/src/unstable/ai/Chat.ts +133 -98
- package/src/unstable/ai/IdGenerator.ts +32 -28
- package/src/unstable/ai/LanguageModel.ts +111 -69
- package/src/unstable/ai/McpProtocol.ts +48 -0
- package/src/unstable/ai/McpSchema.ts +77 -66
- package/src/unstable/ai/McpServer.ts +931 -305
- package/src/unstable/ai/Model.ts +9 -20
- package/src/unstable/ai/OpenAiStructuredOutput.ts +1 -1
- package/src/unstable/ai/Prompt.ts +166 -49
- package/src/unstable/ai/Response.ts +28 -14
- package/src/unstable/ai/Telemetry.ts +46 -13
- package/src/unstable/ai/Tokenizer.ts +14 -3
- package/src/unstable/ai/Tool.ts +59 -44
- package/src/unstable/ai/Toolkit.ts +26 -8
- package/src/unstable/ai/index.ts +5 -0
- package/src/unstable/ai/internal/mcpProtocol.ts +85 -0
- package/src/unstable/ai/internal/mcpProtocolRegistry.ts +70 -0
- package/src/unstable/ai/internal/structured-output.ts +13 -18
- package/src/unstable/cli/Argument.ts +273 -69
- package/src/unstable/cli/CliError.ts +79 -86
- package/src/unstable/cli/CliOutput.ts +44 -58
- package/src/unstable/cli/Command.ts +716 -116
- package/src/unstable/cli/Flag.ts +418 -138
- package/src/unstable/cli/GlobalFlag.ts +1 -1
- package/src/unstable/cli/HelpDoc.ts +12 -4
- package/src/unstable/cli/Param.ts +333 -97
- package/src/unstable/cli/Primitive.ts +381 -154
- package/src/unstable/cli/Prompt.ts +64 -34
- package/src/unstable/cli/internal/ansi.ts +2 -2
- package/src/unstable/cli/internal/command.ts +15 -10
- package/src/unstable/cli/internal/completions/bash.ts +59 -9
- package/src/unstable/cli/internal/completions/descriptor.ts +14 -20
- package/src/unstable/cli/internal/completions/fish.ts +5 -7
- package/src/unstable/cli/internal/help.ts +4 -2
- package/src/unstable/cli/internal/lexer.ts +8 -2
- package/src/unstable/cli/internal/parser.ts +5 -5
- package/src/unstable/cli/internal/wizard.ts +2 -2
- package/src/unstable/cluster/ClusterError.ts +7 -7
- package/src/unstable/cluster/ClusterSchema.ts +8 -8
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +9 -2
- package/src/unstable/cluster/Entity.ts +15 -16
- package/src/unstable/cluster/EntityProxy.ts +4 -2
- package/src/unstable/cluster/EntityResource.ts +2 -2
- package/src/unstable/cluster/Envelope.ts +3 -3
- package/src/unstable/cluster/HttpRunner.ts +6 -4
- package/src/unstable/cluster/Message.ts +9 -9
- package/src/unstable/cluster/MessageStorage.ts +24 -20
- package/src/unstable/cluster/Reply.ts +25 -6
- package/src/unstable/cluster/RunnerHealth.ts +1 -1
- package/src/unstable/cluster/RunnerServer.ts +35 -8
- package/src/unstable/cluster/RunnerStorage.ts +11 -9
- package/src/unstable/cluster/Runners.ts +23 -12
- package/src/unstable/cluster/Sharding.ts +42 -15
- package/src/unstable/cluster/ShardingConfig.ts +3 -3
- package/src/unstable/cluster/SingletonAddress.ts +1 -1
- package/src/unstable/cluster/Snowflake.ts +8 -8
- package/src/unstable/cluster/SqlMessageStorage.ts +1 -1
- package/src/unstable/cluster/SqlRunnerStorage.ts +21 -5
- package/src/unstable/cluster/internal/entityManager.ts +12 -16
- package/src/unstable/cluster/internal/resourceMap.ts +5 -2
- package/src/unstable/cluster/internal/resourceRef.ts +27 -5
- package/src/unstable/devtools/DevToolsClient.ts +3 -2
- package/src/unstable/encoding/Ini.ts +174 -0
- package/src/unstable/encoding/Msgpack.ts +53 -36
- package/src/unstable/encoding/Ndjson.ts +9 -1
- package/src/unstable/encoding/Sse.ts +109 -37
- package/src/unstable/encoding/Toml.ts +504 -0
- package/src/unstable/encoding/Yaml.ts +541 -0
- package/src/unstable/encoding/index.ts +15 -0
- package/src/unstable/eventlog/Event.ts +20 -20
- package/src/unstable/eventlog/EventGroup.ts +4 -4
- package/src/unstable/eventlog/EventJournal.ts +29 -21
- package/src/unstable/eventlog/EventLog.ts +3 -3
- package/src/unstable/eventlog/EventLogEncryption.ts +1 -1
- package/src/unstable/eventlog/EventLogMessage.ts +3 -3
- package/src/unstable/eventlog/EventLogRemote.ts +1 -1
- package/src/unstable/eventlog/EventLogServer.ts +41 -7
- package/src/unstable/eventlog/EventLogServerEncrypted.ts +13 -5
- package/src/unstable/eventlog/EventLogServerUnencrypted.ts +15 -7
- package/src/unstable/eventlog/EventLogSessionAuth.ts +1 -1
- package/src/unstable/eventlog/SqlEventJournal.ts +6 -4
- package/src/unstable/http/Cookies.ts +35 -21
- package/src/unstable/http/Etag.ts +1 -1
- package/src/unstable/http/FetchHttpClient.ts +3 -1
- package/src/unstable/http/FindMyWay/internal/queryString.ts +420 -0
- package/src/unstable/http/FindMyWay/internal/router.ts +950 -0
- package/src/unstable/http/FindMyWay.ts +65 -6
- package/src/unstable/http/Headers.ts +2 -2
- package/src/unstable/http/HttpBody.ts +20 -5
- package/src/unstable/http/HttpClient.ts +83 -55
- package/src/unstable/http/HttpClientError.ts +1 -1
- package/src/unstable/http/HttpClientRequest.ts +2 -12
- package/src/unstable/http/HttpClientResponse.ts +5 -21
- package/src/unstable/http/HttpEffect.ts +8 -8
- package/src/unstable/http/HttpMethod.ts +6 -9
- package/src/unstable/http/HttpMiddleware.ts +202 -39
- package/src/unstable/http/HttpPlatform.ts +129 -6
- package/src/unstable/http/HttpRouter.ts +102 -98
- package/src/unstable/http/HttpServer.ts +13 -13
- package/src/unstable/http/HttpServerError.ts +2 -2
- package/src/unstable/http/HttpServerRequest.ts +18 -10
- package/src/unstable/http/HttpServerResponse.ts +38 -6
- package/src/unstable/http/HttpStaticServer.ts +35 -7
- package/src/unstable/http/Multipart.ts +15 -8
- package/src/unstable/http/MultipartParser/HeadersParser.ts +68 -0
- package/src/unstable/http/MultipartParser/Search.ts +17 -0
- package/src/unstable/http/MultipartParser/internal/contentType.ts +103 -0
- package/src/unstable/http/MultipartParser/internal/headers.ts +615 -0
- package/src/unstable/http/MultipartParser/internal/multipart.ts +262 -0
- package/src/unstable/http/MultipartParser/internal/search.ts +167 -0
- package/src/unstable/http/MultipartParser.ts +115 -0
- package/src/unstable/http/Template.ts +6 -5
- package/src/unstable/http/Url.ts +33 -63
- package/src/unstable/http/UrlParams.ts +10 -18
- package/src/unstable/http/index.ts +1 -1
- package/src/unstable/http/internal/compression.ts +196 -0
- package/src/unstable/http/internal/httpBody.ts +15 -0
- package/src/unstable/httpapi/HttpApi.ts +6 -7
- package/src/unstable/httpapi/HttpApiBuilder.ts +129 -30
- package/src/unstable/httpapi/HttpApiClient.ts +117 -54
- package/src/unstable/httpapi/HttpApiEndpoint.ts +159 -71
- package/src/unstable/httpapi/HttpApiError.ts +46 -52
- package/src/unstable/httpapi/HttpApiGroup.ts +15 -15
- package/src/unstable/httpapi/HttpApiMiddleware.ts +71 -24
- package/src/unstable/httpapi/HttpApiScalar.ts +0 -12
- package/src/unstable/httpapi/HttpApiSchema.ts +359 -6
- package/src/unstable/httpapi/OpenApi.ts +83 -33
- package/src/unstable/observability/OtlpExporter.ts +35 -21
- package/src/unstable/observability/OtlpLogger.ts +3 -1
- package/src/unstable/observability/OtlpMetrics.ts +36 -19
- package/src/unstable/observability/OtlpResource.ts +26 -17
- package/src/unstable/observability/OtlpTracer.ts +1 -1
- package/src/unstable/observability/PrometheusMetrics.ts +13 -4
- package/src/unstable/observability/internal/otlpEnv.ts +1 -1
- package/src/unstable/observability/internal/protobuf.ts +3 -0
- package/src/unstable/persistence/KeyValueStore.ts +72 -49
- package/src/unstable/persistence/Persistable.ts +8 -8
- package/src/unstable/persistence/PersistedQueue.ts +18 -15
- package/src/unstable/persistence/Persistence.ts +153 -26
- package/src/unstable/persistence/RateLimiter.ts +77 -43
- package/src/unstable/persistence/Redis.ts +3 -3
- package/src/unstable/process/ChildProcess.ts +64 -21
- package/src/unstable/process/ChildProcessSpawner.ts +21 -10
- package/src/unstable/reactivity/AsyncResult.ts +12 -13
- package/src/unstable/reactivity/Atom.ts +28 -25
- package/src/unstable/reactivity/AtomHttpApi.ts +5 -4
- package/src/unstable/reactivity/AtomRegistry.ts +24 -3
- package/src/unstable/reactivity/AtomRpc.ts +5 -4
- package/src/unstable/reactivity/Hydration.ts +1 -1
- package/src/unstable/rpc/Rpc.ts +35 -33
- package/src/unstable/rpc/RpcClient.ts +54 -27
- package/src/unstable/rpc/RpcClientError.ts +2 -2
- package/src/unstable/rpc/RpcGroup.ts +8 -8
- package/src/unstable/rpc/RpcMessage.ts +31 -30
- package/src/unstable/rpc/RpcMiddleware.ts +10 -10
- package/src/unstable/rpc/RpcSchema.ts +4 -4
- package/src/unstable/rpc/RpcSerialization.ts +167 -68
- package/src/unstable/rpc/RpcServer.ts +18 -15
- package/src/unstable/rpc/RpcWorker.ts +5 -5
- package/src/unstable/schema/Model.ts +52 -50
- package/src/unstable/schema/VariantSchema.ts +41 -23
- package/src/unstable/socket/Socket.ts +41 -18
- package/src/unstable/sql/SqlClient.ts +64 -56
- package/src/unstable/sql/SqlError.ts +13 -13
- package/src/unstable/sql/SqlModel.ts +2 -2
- package/src/unstable/sql/SqlResolver.ts +13 -11
- package/src/unstable/sql/Statement.ts +37 -31
- package/src/unstable/workers/Transferable.ts +1 -1
- package/src/unstable/workers/Worker.ts +2 -2
- package/src/unstable/workers/WorkerError.ts +12 -12
- package/src/unstable/workers/WorkerRunner.ts +1 -1
- package/src/unstable/workflow/Activity.ts +2 -2
- package/src/unstable/workflow/DurableClock.ts +1 -1
- package/src/unstable/workflow/DurableDeferred.ts +10 -10
- package/src/unstable/workflow/DurableQueue.ts +22 -20
- package/src/unstable/workflow/Workflow.ts +23 -23
- package/src/unstable/workflow/WorkflowEngine.ts +9 -4
- package/src/unstable/workflow/WorkflowProxy.ts +4 -2
- package/dist/internal/version.d.ts +0 -3
- package/dist/internal/version.d.ts.map +0 -1
- package/dist/internal/version.js +0 -2
- package/dist/internal/version.js.map +0 -1
- package/dist/unstable/http/Multipasta/HeadersParser.d.ts +0 -14
- package/dist/unstable/http/Multipasta/HeadersParser.d.ts.map +0 -1
- package/dist/unstable/http/Multipasta/HeadersParser.js +0 -14
- package/dist/unstable/http/Multipasta/HeadersParser.js.map +0 -1
- package/dist/unstable/http/Multipasta/Node.d.ts +0 -14
- package/dist/unstable/http/Multipasta/Node.d.ts.map +0 -1
- package/dist/unstable/http/Multipasta/Node.js +0 -14
- package/dist/unstable/http/Multipasta/Node.js.map +0 -1
- package/dist/unstable/http/Multipasta/Search.d.ts +0 -14
- package/dist/unstable/http/Multipasta/Search.d.ts.map +0 -1
- package/dist/unstable/http/Multipasta/Search.js +0 -14
- package/dist/unstable/http/Multipasta/Search.js.map +0 -1
- package/dist/unstable/http/Multipasta/Web.d.ts +0 -14
- package/dist/unstable/http/Multipasta/Web.d.ts.map +0 -1
- package/dist/unstable/http/Multipasta/Web.js +0 -14
- package/dist/unstable/http/Multipasta/Web.js.map +0 -1
- package/dist/unstable/http/Multipasta.d.ts +0 -15
- package/dist/unstable/http/Multipasta.d.ts.map +0 -1
- package/dist/unstable/http/Multipasta.js +0 -15
- package/dist/unstable/http/Multipasta.js.map +0 -1
- package/src/internal/version.ts +0 -2
- package/src/unstable/http/Multipasta/HeadersParser.ts +0 -14
- package/src/unstable/http/Multipasta/Node.ts +0 -14
- package/src/unstable/http/Multipasta/Search.ts +0 -14
- package/src/unstable/http/Multipasta/Web.ts +0 -14
- package/src/unstable/http/Multipasta.ts +0 -15
package/src/Layer.ts
CHANGED
|
@@ -192,7 +192,7 @@ const MemoMapTypeId = "~effect/Layer/MemoMap"
|
|
|
192
192
|
*
|
|
193
193
|
* **Example** (Sharing layer construction with a memo map)
|
|
194
194
|
*
|
|
195
|
-
* ```ts
|
|
195
|
+
* ```ts import.meta.vitest
|
|
196
196
|
* import { Context, Effect, Layer } from "effect"
|
|
197
197
|
*
|
|
198
198
|
* class Database extends Context.Service<Database, {
|
|
@@ -211,6 +211,9 @@ const MemoMapTypeId = "~effect/Layer/MemoMap"
|
|
|
211
211
|
*
|
|
212
212
|
* return Context.get(context, Database)
|
|
213
213
|
* })
|
|
214
|
+
*
|
|
215
|
+
* const database = Effect.runSync(Effect.scoped(program))
|
|
216
|
+
* Effect.runSync(database.query("SELECT 1")) // => "result"
|
|
214
217
|
* ```
|
|
215
218
|
*
|
|
216
219
|
* @category models
|
|
@@ -251,7 +254,7 @@ const memoMapReuse = <RIn, E, ROut>(
|
|
|
251
254
|
*
|
|
252
255
|
* **Example** (Checking whether a value is a layer)
|
|
253
256
|
*
|
|
254
|
-
* ```ts
|
|
257
|
+
* ```ts import.meta.vitest
|
|
255
258
|
* import { Context, Effect, Layer } from "effect"
|
|
256
259
|
*
|
|
257
260
|
* class Database extends Context.Service<Database, {
|
|
@@ -263,11 +266,11 @@ const memoMapReuse = <RIn, E, ROut>(
|
|
|
263
266
|
* })
|
|
264
267
|
* const notALayer = { someProperty: "value" }
|
|
265
268
|
*
|
|
266
|
-
*
|
|
267
|
-
*
|
|
269
|
+
* Layer.isLayer(dbLayer) // => true
|
|
270
|
+
* Layer.isLayer(notALayer) // => false
|
|
268
271
|
* ```
|
|
269
272
|
*
|
|
270
|
-
* @category
|
|
273
|
+
* @category guards
|
|
271
274
|
* @since 2.0.0
|
|
272
275
|
*/
|
|
273
276
|
export const isLayer = (u: unknown): u is Layer<unknown, unknown, unknown> => hasProperty(u, TypeId)
|
|
@@ -305,7 +308,7 @@ const fromBuildUnsafe = <ROut, E, RIn>(
|
|
|
305
308
|
*
|
|
306
309
|
* **Example** (Constructing a layer from a build function)
|
|
307
310
|
*
|
|
308
|
-
* ```ts
|
|
311
|
+
* ```ts import.meta.vitest
|
|
309
312
|
* import { Context, Effect, Layer } from "effect"
|
|
310
313
|
*
|
|
311
314
|
* class Database extends Context.Service<Database, {
|
|
@@ -319,6 +322,9 @@ const fromBuildUnsafe = <ROut, E, RIn>(
|
|
|
319
322
|
* })
|
|
320
323
|
* )
|
|
321
324
|
* )
|
|
325
|
+
*
|
|
326
|
+
* const program = Database.use((database) => database.query("SELECT 1"))
|
|
327
|
+
* Effect.runSync(Effect.provide(program, databaseLayer)) // => "result"
|
|
322
328
|
* ```
|
|
323
329
|
*
|
|
324
330
|
* @category constructors
|
|
@@ -349,7 +355,7 @@ export const fromBuild = <ROut, E, RIn>(
|
|
|
349
355
|
*
|
|
350
356
|
* **Example** (Memoizing layer construction)
|
|
351
357
|
*
|
|
352
|
-
* ```ts
|
|
358
|
+
* ```ts import.meta.vitest
|
|
353
359
|
* import { Context, Effect, Layer } from "effect"
|
|
354
360
|
*
|
|
355
361
|
* class Database extends Context.Service<Database, {
|
|
@@ -363,6 +369,9 @@ export const fromBuild = <ROut, E, RIn>(
|
|
|
363
369
|
* })
|
|
364
370
|
* )
|
|
365
371
|
* )
|
|
372
|
+
*
|
|
373
|
+
* const program = Database.use((database) => database.query("SELECT 1"))
|
|
374
|
+
* Effect.runSync(Effect.provide(program, databaseLayer)) // => "result"
|
|
366
375
|
* ```
|
|
367
376
|
*
|
|
368
377
|
* @category constructors
|
|
@@ -438,11 +447,13 @@ class MemoMapImpl implements MemoMap {
|
|
|
438
447
|
scope: Scope.Scope,
|
|
439
448
|
build: (memoMap: MemoMap, scope: Scope.Scope) => Effect<Context.Context<ROut>, E, RIn>
|
|
440
449
|
): Effect<Context.Context<ROut>, E, RIn> {
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
450
|
+
return internalEffect.suspend(() => {
|
|
451
|
+
const existing = this.get(layer, scope)
|
|
452
|
+
if (existing) {
|
|
453
|
+
return existing
|
|
454
|
+
}
|
|
455
|
+
return memoMapBuild(this, layer, scope, build)
|
|
456
|
+
})
|
|
446
457
|
}
|
|
447
458
|
}
|
|
448
459
|
|
|
@@ -451,7 +462,7 @@ class MemoMapImpl implements MemoMap {
|
|
|
451
462
|
*
|
|
452
463
|
* **Example** (Creating a memo map unsafely)
|
|
453
464
|
*
|
|
454
|
-
* ```ts
|
|
465
|
+
* ```ts import.meta.vitest
|
|
455
466
|
* import { Context, Effect, Layer } from "effect"
|
|
456
467
|
*
|
|
457
468
|
* class Database extends Context.Service<Database, {
|
|
@@ -470,9 +481,12 @@ class MemoMapImpl implements MemoMap {
|
|
|
470
481
|
*
|
|
471
482
|
* return Context.get(context, Database)
|
|
472
483
|
* })
|
|
484
|
+
*
|
|
485
|
+
* const database = Effect.runSync(Effect.scoped(program))
|
|
486
|
+
* Effect.runSync(database.query("SELECT 1")) // => "result"
|
|
473
487
|
* ```
|
|
474
488
|
*
|
|
475
|
-
* @category
|
|
489
|
+
* @category constructors
|
|
476
490
|
* @since 4.0.0
|
|
477
491
|
*/
|
|
478
492
|
export const makeMemoMapUnsafe = (): MemoMap => new MemoMapImpl()
|
|
@@ -491,7 +505,7 @@ export const makeMemoMapUnsafe = (): MemoMap => new MemoMapImpl()
|
|
|
491
505
|
* @see {@link forkMemoMap} for allocating the child memo map inside `Effect`
|
|
492
506
|
* @see {@link makeMemoMapUnsafe} for creating a root memo map without a parent
|
|
493
507
|
*
|
|
494
|
-
* @category
|
|
508
|
+
* @category constructors
|
|
495
509
|
* @since 4.0.0
|
|
496
510
|
*/
|
|
497
511
|
export const forkMemoMapUnsafe = (parent: MemoMap): MemoMap => new MemoMapImpl(parent)
|
|
@@ -501,7 +515,7 @@ export const forkMemoMapUnsafe = (parent: MemoMap): MemoMap => new MemoMapImpl(p
|
|
|
501
515
|
*
|
|
502
516
|
* **Example** (Creating a memo map in an effect)
|
|
503
517
|
*
|
|
504
|
-
* ```ts
|
|
518
|
+
* ```ts import.meta.vitest
|
|
505
519
|
* import { Context, Effect, Layer } from "effect"
|
|
506
520
|
*
|
|
507
521
|
* class Database extends Context.Service<Database, {
|
|
@@ -520,9 +534,12 @@ export const forkMemoMapUnsafe = (parent: MemoMap): MemoMap => new MemoMapImpl(p
|
|
|
520
534
|
*
|
|
521
535
|
* return Context.get(context, Database)
|
|
522
536
|
* })
|
|
537
|
+
*
|
|
538
|
+
* const database = Effect.runSync(Effect.scoped(program))
|
|
539
|
+
* Effect.runSync(database.query("SELECT 1")) // => "result"
|
|
523
540
|
* ```
|
|
524
541
|
*
|
|
525
|
-
* @category
|
|
542
|
+
* @category constructors
|
|
526
543
|
* @since 2.0.0
|
|
527
544
|
*/
|
|
528
545
|
export const makeMemoMap: Effect<MemoMap> = internalEffect.sync(makeMemoMapUnsafe)
|
|
@@ -541,7 +558,7 @@ export const makeMemoMap: Effect<MemoMap> = internalEffect.sync(makeMemoMapUnsaf
|
|
|
541
558
|
* @see {@link forkMemoMapUnsafe} for the synchronous constructor variant
|
|
542
559
|
* @see {@link buildWithMemoMap} for building layers with an explicit memo map
|
|
543
560
|
*
|
|
544
|
-
* @category
|
|
561
|
+
* @category constructors
|
|
545
562
|
* @since 4.0.0
|
|
546
563
|
*/
|
|
547
564
|
export const forkMemoMap = (parent: MemoMap): Effect<MemoMap> => internalEffect.sync(() => forkMemoMapUnsafe(parent))
|
|
@@ -561,7 +578,7 @@ export const forkMemoMap = (parent: MemoMap): Effect<MemoMap> => internalEffect.
|
|
|
561
578
|
*
|
|
562
579
|
* @see {@link MemoMap} the memoization map type wrapped by this service
|
|
563
580
|
*
|
|
564
|
-
* @category
|
|
581
|
+
* @category services
|
|
565
582
|
* @since 3.13.0
|
|
566
583
|
*/
|
|
567
584
|
export class CurrentMemoMap extends Context.Service<CurrentMemoMap, MemoMap>()("effect/Layer/CurrentMemoMap") {
|
|
@@ -577,7 +594,7 @@ export class CurrentMemoMap extends Context.Service<CurrentMemoMap, MemoMap>()("
|
|
|
577
594
|
*
|
|
578
595
|
* **Example** (Building layers with an explicit memo map)
|
|
579
596
|
*
|
|
580
|
-
* ```ts
|
|
597
|
+
* ```ts import.meta.vitest
|
|
581
598
|
* import { Context, Effect, Layer } from "effect"
|
|
582
599
|
*
|
|
583
600
|
* class Database extends Context.Service<Database, {
|
|
@@ -588,6 +605,8 @@ export class CurrentMemoMap extends Context.Service<CurrentMemoMap, MemoMap>()("
|
|
|
588
605
|
* readonly log: (msg: string) => Effect.Effect<void>
|
|
589
606
|
* }>()("Logger") {}
|
|
590
607
|
*
|
|
608
|
+
* const logs: Array<string> = []
|
|
609
|
+
*
|
|
591
610
|
* // Build layers with explicit memoization control
|
|
592
611
|
* const program = Effect.gen(function*() {
|
|
593
612
|
* const memoMap = yield* Layer.makeMemoMap
|
|
@@ -601,7 +620,7 @@ export class CurrentMemoMap extends Context.Service<CurrentMemoMap, MemoMap>()("
|
|
|
601
620
|
*
|
|
602
621
|
* // Build logger layer with same memoization (reuses memo if same layer)
|
|
603
622
|
* const loggerLayer = Layer.succeed(Logger, {
|
|
604
|
-
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() =>
|
|
623
|
+
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => logs.push(msg)))
|
|
605
624
|
* })
|
|
606
625
|
* const loggerContext = yield* Layer.buildWithMemoMap(
|
|
607
626
|
* loggerLayer,
|
|
@@ -614,9 +633,13 @@ export class CurrentMemoMap extends Context.Service<CurrentMemoMap, MemoMap>()("
|
|
|
614
633
|
* logger: Context.get(loggerContext, Logger)
|
|
615
634
|
* }
|
|
616
635
|
* })
|
|
636
|
+
*
|
|
637
|
+
* const services = Effect.runSync(Effect.scoped(program))
|
|
638
|
+
* Effect.runSync(services.logger.log("ready"))
|
|
639
|
+
* logs // => ["ready"]
|
|
617
640
|
* ```
|
|
618
641
|
*
|
|
619
|
-
* @category
|
|
642
|
+
* @category destructors
|
|
620
643
|
* @since 2.0.0
|
|
621
644
|
*/
|
|
622
645
|
export const buildWithMemoMap: {
|
|
@@ -626,7 +649,7 @@ export const buildWithMemoMap: {
|
|
|
626
649
|
*
|
|
627
650
|
* **Example** (Building layers with an explicit memo map)
|
|
628
651
|
*
|
|
629
|
-
* ```ts
|
|
652
|
+
* ```ts import.meta.vitest
|
|
630
653
|
* import { Context, Effect, Layer } from "effect"
|
|
631
654
|
*
|
|
632
655
|
* class Database extends Context.Service<Database, {
|
|
@@ -637,6 +660,8 @@ export const buildWithMemoMap: {
|
|
|
637
660
|
* readonly log: (msg: string) => Effect.Effect<void>
|
|
638
661
|
* }>()("Logger") {}
|
|
639
662
|
*
|
|
663
|
+
* const logs: Array<string> = []
|
|
664
|
+
*
|
|
640
665
|
* // Build layers with explicit memoization control
|
|
641
666
|
* const program = Effect.gen(function*() {
|
|
642
667
|
* const memoMap = yield* Layer.makeMemoMap
|
|
@@ -650,7 +675,7 @@ export const buildWithMemoMap: {
|
|
|
650
675
|
*
|
|
651
676
|
* // Build logger layer with same memoization (reuses memo if same layer)
|
|
652
677
|
* const loggerLayer = Layer.succeed(Logger, {
|
|
653
|
-
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() =>
|
|
678
|
+
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => logs.push(msg)))
|
|
654
679
|
* })
|
|
655
680
|
* const loggerContext = yield* Layer.buildWithMemoMap(
|
|
656
681
|
* loggerLayer,
|
|
@@ -663,9 +688,13 @@ export const buildWithMemoMap: {
|
|
|
663
688
|
* logger: Context.get(loggerContext, Logger)
|
|
664
689
|
* }
|
|
665
690
|
* })
|
|
691
|
+
*
|
|
692
|
+
* const services = Effect.runSync(Effect.scoped(program))
|
|
693
|
+
* Effect.runSync(services.logger.log("ready"))
|
|
694
|
+
* logs // => ["ready"]
|
|
666
695
|
* ```
|
|
667
696
|
*
|
|
668
|
-
* @category
|
|
697
|
+
* @category destructors
|
|
669
698
|
* @since 2.0.0
|
|
670
699
|
*/
|
|
671
700
|
(memoMap: MemoMap, scope: Scope.Scope): <RIn, E, ROut>(self: Layer<ROut, E, RIn>) => Effect<Context.Context<ROut>, E, RIn>
|
|
@@ -675,7 +704,7 @@ export const buildWithMemoMap: {
|
|
|
675
704
|
*
|
|
676
705
|
* **Example** (Building layers with an explicit memo map)
|
|
677
706
|
*
|
|
678
|
-
* ```ts
|
|
707
|
+
* ```ts import.meta.vitest
|
|
679
708
|
* import { Context, Effect, Layer } from "effect"
|
|
680
709
|
*
|
|
681
710
|
* class Database extends Context.Service<Database, {
|
|
@@ -686,6 +715,8 @@ export const buildWithMemoMap: {
|
|
|
686
715
|
* readonly log: (msg: string) => Effect.Effect<void>
|
|
687
716
|
* }>()("Logger") {}
|
|
688
717
|
*
|
|
718
|
+
* const logs: Array<string> = []
|
|
719
|
+
*
|
|
689
720
|
* // Build layers with explicit memoization control
|
|
690
721
|
* const program = Effect.gen(function*() {
|
|
691
722
|
* const memoMap = yield* Layer.makeMemoMap
|
|
@@ -699,7 +730,7 @@ export const buildWithMemoMap: {
|
|
|
699
730
|
*
|
|
700
731
|
* // Build logger layer with same memoization (reuses memo if same layer)
|
|
701
732
|
* const loggerLayer = Layer.succeed(Logger, {
|
|
702
|
-
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() =>
|
|
733
|
+
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => logs.push(msg)))
|
|
703
734
|
* })
|
|
704
735
|
* const loggerContext = yield* Layer.buildWithMemoMap(
|
|
705
736
|
* loggerLayer,
|
|
@@ -712,9 +743,13 @@ export const buildWithMemoMap: {
|
|
|
712
743
|
* logger: Context.get(loggerContext, Logger)
|
|
713
744
|
* }
|
|
714
745
|
* })
|
|
746
|
+
*
|
|
747
|
+
* const services = Effect.runSync(Effect.scoped(program))
|
|
748
|
+
* Effect.runSync(services.logger.log("ready"))
|
|
749
|
+
* logs // => ["ready"]
|
|
715
750
|
* ```
|
|
716
751
|
*
|
|
717
|
-
* @category
|
|
752
|
+
* @category destructors
|
|
718
753
|
* @since 2.0.0
|
|
719
754
|
*/
|
|
720
755
|
<RIn, E, ROut>(self: Layer<ROut, E, RIn>, memoMap: MemoMap, scope: Scope.Scope): Effect<Context.Context<ROut>, E, RIn>
|
|
@@ -734,7 +769,7 @@ export const buildWithMemoMap: {
|
|
|
734
769
|
*
|
|
735
770
|
* **Example** (Building a layer into a context)
|
|
736
771
|
*
|
|
737
|
-
* ```ts
|
|
772
|
+
* ```ts import.meta.vitest
|
|
738
773
|
* import { Context, Effect, Layer } from "effect"
|
|
739
774
|
*
|
|
740
775
|
* class Database extends Context.Service<Database, {
|
|
@@ -755,6 +790,8 @@ export const buildWithMemoMap: {
|
|
|
755
790
|
*
|
|
756
791
|
* return yield* database.query("SELECT * FROM users")
|
|
757
792
|
* })
|
|
793
|
+
*
|
|
794
|
+
* Effect.runSync(Effect.scoped(program)) // => "result"
|
|
758
795
|
* ```
|
|
759
796
|
*
|
|
760
797
|
* @category destructors
|
|
@@ -786,22 +823,24 @@ export const build = <RIn, E, ROut>(
|
|
|
786
823
|
*
|
|
787
824
|
* **Example** (Building a layer with an explicit scope)
|
|
788
825
|
*
|
|
789
|
-
* ```ts
|
|
826
|
+
* ```ts import.meta.vitest
|
|
790
827
|
* import { Context, Effect, Layer, Scope } from "effect"
|
|
791
828
|
*
|
|
792
829
|
* class Database extends Context.Service<Database, {
|
|
793
830
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
794
831
|
* }>()("Database") {}
|
|
795
832
|
*
|
|
833
|
+
* const logs: Array<string> = []
|
|
834
|
+
*
|
|
796
835
|
* // Build a layer with explicit scope control
|
|
797
836
|
* const program = Effect.gen(function*() {
|
|
798
837
|
* const scope = yield* Effect.scope
|
|
799
838
|
*
|
|
800
839
|
* const dbLayer = Layer.effect(Database, Effect.gen(function*() {
|
|
801
|
-
*
|
|
840
|
+
* logs.push("Initializing database...")
|
|
802
841
|
* yield* Scope.addFinalizer(
|
|
803
842
|
* scope,
|
|
804
|
-
* Effect.sync(() =>
|
|
843
|
+
* Effect.sync(() => logs.push("Database closed"))
|
|
805
844
|
* )
|
|
806
845
|
* return { query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result: ${sql}`)) }
|
|
807
846
|
* }))
|
|
@@ -813,6 +852,9 @@ export const build = <RIn, E, ROut>(
|
|
|
813
852
|
* return yield* database.query("SELECT * FROM users")
|
|
814
853
|
* // Database will be closed when scope is closed
|
|
815
854
|
* })
|
|
855
|
+
*
|
|
856
|
+
* Effect.runSync(Effect.scoped(program)) // => "Result: SELECT * FROM users"
|
|
857
|
+
* logs // => ["Initializing database...", "Database closed"]
|
|
816
858
|
* ```
|
|
817
859
|
*
|
|
818
860
|
* @category destructors
|
|
@@ -834,22 +876,24 @@ export const buildWithScope: {
|
|
|
834
876
|
*
|
|
835
877
|
* **Example** (Building a layer with an explicit scope)
|
|
836
878
|
*
|
|
837
|
-
* ```ts
|
|
879
|
+
* ```ts import.meta.vitest
|
|
838
880
|
* import { Context, Effect, Layer, Scope } from "effect"
|
|
839
881
|
*
|
|
840
882
|
* class Database extends Context.Service<Database, {
|
|
841
883
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
842
884
|
* }>()("Database") {}
|
|
843
885
|
*
|
|
886
|
+
* const logs: Array<string> = []
|
|
887
|
+
*
|
|
844
888
|
* // Build a layer with explicit scope control
|
|
845
889
|
* const program = Effect.gen(function*() {
|
|
846
890
|
* const scope = yield* Effect.scope
|
|
847
891
|
*
|
|
848
892
|
* const dbLayer = Layer.effect(Database, Effect.gen(function*() {
|
|
849
|
-
*
|
|
893
|
+
* logs.push("Initializing database...")
|
|
850
894
|
* yield* Scope.addFinalizer(
|
|
851
895
|
* scope,
|
|
852
|
-
* Effect.sync(() =>
|
|
896
|
+
* Effect.sync(() => logs.push("Database closed"))
|
|
853
897
|
* )
|
|
854
898
|
* return { query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result: ${sql}`)) }
|
|
855
899
|
* }))
|
|
@@ -861,6 +905,9 @@ export const buildWithScope: {
|
|
|
861
905
|
* return yield* database.query("SELECT * FROM users")
|
|
862
906
|
* // Database will be closed when scope is closed
|
|
863
907
|
* })
|
|
908
|
+
*
|
|
909
|
+
* Effect.runSync(Effect.scoped(program)) // => "Result: SELECT * FROM users"
|
|
910
|
+
* logs // => ["Initializing database...", "Database closed"]
|
|
864
911
|
* ```
|
|
865
912
|
*
|
|
866
913
|
* @category destructors
|
|
@@ -882,22 +929,24 @@ export const buildWithScope: {
|
|
|
882
929
|
*
|
|
883
930
|
* **Example** (Building a layer with an explicit scope)
|
|
884
931
|
*
|
|
885
|
-
* ```ts
|
|
932
|
+
* ```ts import.meta.vitest
|
|
886
933
|
* import { Context, Effect, Layer, Scope } from "effect"
|
|
887
934
|
*
|
|
888
935
|
* class Database extends Context.Service<Database, {
|
|
889
936
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
890
937
|
* }>()("Database") {}
|
|
891
938
|
*
|
|
939
|
+
* const logs: Array<string> = []
|
|
940
|
+
*
|
|
892
941
|
* // Build a layer with explicit scope control
|
|
893
942
|
* const program = Effect.gen(function*() {
|
|
894
943
|
* const scope = yield* Effect.scope
|
|
895
944
|
*
|
|
896
945
|
* const dbLayer = Layer.effect(Database, Effect.gen(function*() {
|
|
897
|
-
*
|
|
946
|
+
* logs.push("Initializing database...")
|
|
898
947
|
* yield* Scope.addFinalizer(
|
|
899
948
|
* scope,
|
|
900
|
-
* Effect.sync(() =>
|
|
949
|
+
* Effect.sync(() => logs.push("Database closed"))
|
|
901
950
|
* )
|
|
902
951
|
* return { query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result: ${sql}`)) }
|
|
903
952
|
* }))
|
|
@@ -909,6 +958,9 @@ export const buildWithScope: {
|
|
|
909
958
|
* return yield* database.query("SELECT * FROM users")
|
|
910
959
|
* // Database will be closed when scope is closed
|
|
911
960
|
* })
|
|
961
|
+
*
|
|
962
|
+
* Effect.runSync(Effect.scoped(program)) // => "Result: SELECT * FROM users"
|
|
963
|
+
* logs // => ["Initializing database...", "Database closed"]
|
|
912
964
|
* ```
|
|
913
965
|
*
|
|
914
966
|
* @category destructors
|
|
@@ -938,7 +990,7 @@ export const buildWithScope: {
|
|
|
938
990
|
*
|
|
939
991
|
* **Example** (Creating a layer from a service implementation)
|
|
940
992
|
*
|
|
941
|
-
* ```ts
|
|
993
|
+
* ```ts import.meta.vitest
|
|
942
994
|
* import { Context, Effect, Layer } from "effect"
|
|
943
995
|
*
|
|
944
996
|
* class Database extends Context.Service<Database, {
|
|
@@ -948,6 +1000,8 @@ export const buildWithScope: {
|
|
|
948
1000
|
* const DatabaseLive = Layer.succeed(Database, {
|
|
949
1001
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Query result: ${sql}`))
|
|
950
1002
|
* })
|
|
1003
|
+
* const program = Database.use((database) => database.query("SELECT 1"))
|
|
1004
|
+
* Effect.runSync(Effect.provide(program, DatabaseLive)) // => "Query result: SELECT 1"
|
|
951
1005
|
* ```
|
|
952
1006
|
*
|
|
953
1007
|
* @see {@link sync} for constructing layers from lazy values
|
|
@@ -967,7 +1021,7 @@ export const succeed: {
|
|
|
967
1021
|
*
|
|
968
1022
|
* **Example** (Creating a layer from a service implementation)
|
|
969
1023
|
*
|
|
970
|
-
* ```ts
|
|
1024
|
+
* ```ts import.meta.vitest
|
|
971
1025
|
* import { Context, Effect, Layer } from "effect"
|
|
972
1026
|
*
|
|
973
1027
|
* class Database extends Context.Service<Database, {
|
|
@@ -977,6 +1031,8 @@ export const succeed: {
|
|
|
977
1031
|
* const DatabaseLive = Layer.succeed(Database, {
|
|
978
1032
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Query result: ${sql}`))
|
|
979
1033
|
* })
|
|
1034
|
+
* const program = Database.use((database) => database.query("SELECT 1"))
|
|
1035
|
+
* Effect.runSync(Effect.provide(program, DatabaseLive)) // => "Query result: SELECT 1"
|
|
980
1036
|
* ```
|
|
981
1037
|
*
|
|
982
1038
|
* @see {@link sync} for constructing layers from lazy values
|
|
@@ -996,7 +1052,7 @@ export const succeed: {
|
|
|
996
1052
|
*
|
|
997
1053
|
* **Example** (Creating a layer from a service implementation)
|
|
998
1054
|
*
|
|
999
|
-
* ```ts
|
|
1055
|
+
* ```ts import.meta.vitest
|
|
1000
1056
|
* import { Context, Effect, Layer } from "effect"
|
|
1001
1057
|
*
|
|
1002
1058
|
* class Database extends Context.Service<Database, {
|
|
@@ -1006,6 +1062,8 @@ export const succeed: {
|
|
|
1006
1062
|
* const DatabaseLive = Layer.succeed(Database, {
|
|
1007
1063
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Query result: ${sql}`))
|
|
1008
1064
|
* })
|
|
1065
|
+
* const program = Database.use((database) => database.query("SELECT 1"))
|
|
1066
|
+
* Effect.runSync(Effect.provide(program, DatabaseLive)) // => "Query result: SELECT 1"
|
|
1009
1067
|
* ```
|
|
1010
1068
|
*
|
|
1011
1069
|
* @see {@link sync} for constructing layers from lazy values
|
|
@@ -1037,7 +1095,7 @@ export const succeed: {
|
|
|
1037
1095
|
*
|
|
1038
1096
|
* **Example** (Providing multiple services from a context)
|
|
1039
1097
|
*
|
|
1040
|
-
* ```ts
|
|
1098
|
+
* ```ts import.meta.vitest
|
|
1041
1099
|
* import { Context, Effect, Layer } from "effect"
|
|
1042
1100
|
*
|
|
1043
1101
|
* class Database extends Context.Service<Database, {
|
|
@@ -1048,15 +1106,19 @@ export const succeed: {
|
|
|
1048
1106
|
* readonly log: (msg: string) => Effect.Effect<void>
|
|
1049
1107
|
* }>()("Logger") {}
|
|
1050
1108
|
*
|
|
1109
|
+
* const logs: Array<string> = []
|
|
1051
1110
|
* const context = Context.make(Database, {
|
|
1052
1111
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
|
1053
1112
|
* }).pipe(
|
|
1054
1113
|
* Context.add(Logger, {
|
|
1055
|
-
* log: (msg: string) => Effect.sync(() =>
|
|
1114
|
+
* log: (msg: string) => Effect.sync(() => logs.push(msg))
|
|
1056
1115
|
* })
|
|
1057
1116
|
* )
|
|
1058
1117
|
*
|
|
1059
1118
|
* const layer = Layer.succeedContext(context)
|
|
1119
|
+
* const program = Logger.use((logger) => logger.log("ready"))
|
|
1120
|
+
* Effect.runSync(Effect.provide(program, layer))
|
|
1121
|
+
* logs // => ["ready"]
|
|
1060
1122
|
* ```
|
|
1061
1123
|
*
|
|
1062
1124
|
* @see {@link succeed} for providing a single service from a value
|
|
@@ -1077,14 +1139,12 @@ export const succeedContext = <A>(context: Context.Context<A>): Layer<A> =>
|
|
|
1077
1139
|
*
|
|
1078
1140
|
* **Example** (Disabling optional lifecycle work)
|
|
1079
1141
|
*
|
|
1080
|
-
* ```ts
|
|
1081
|
-
* import {
|
|
1082
|
-
*
|
|
1083
|
-
* declare const flag: boolean
|
|
1142
|
+
* ```ts import.meta.vitest
|
|
1143
|
+
* import { Context, Effect, Layer, Option } from "effect"
|
|
1084
1144
|
*
|
|
1085
|
-
* const
|
|
1086
|
-
*
|
|
1087
|
-
*
|
|
1145
|
+
* const Service = Context.Service<string>("Service")
|
|
1146
|
+
* const context = Effect.runSync(Effect.scoped(Layer.build(Layer.empty)))
|
|
1147
|
+
* Context.getOption(context, Service) // => Option.none()
|
|
1088
1148
|
* ```
|
|
1089
1149
|
*
|
|
1090
1150
|
* @see {@link effectDiscard} for running an effect while providing no services
|
|
@@ -1109,7 +1169,7 @@ export const empty: Layer<never> = succeedContext(Context.empty())
|
|
|
1109
1169
|
*
|
|
1110
1170
|
* **Example** (Lazily providing a service)
|
|
1111
1171
|
*
|
|
1112
|
-
* ```ts
|
|
1172
|
+
* ```ts import.meta.vitest
|
|
1113
1173
|
* import { Context, Effect, Layer } from "effect"
|
|
1114
1174
|
*
|
|
1115
1175
|
* class Database extends Context.Service<Database, {
|
|
@@ -1119,6 +1179,8 @@ export const empty: Layer<never> = succeedContext(Context.empty())
|
|
|
1119
1179
|
* const layer = Layer.sync(Database, () => ({
|
|
1120
1180
|
* query: (sql: string) => Effect.succeed(`Query: ${sql}`)
|
|
1121
1181
|
* }))
|
|
1182
|
+
* const program = Database.use((database) => database.query("SELECT 1"))
|
|
1183
|
+
* Effect.runSync(Effect.provide(program, layer)) // => "Query: SELECT 1"
|
|
1122
1184
|
* ```
|
|
1123
1185
|
*
|
|
1124
1186
|
* @see {@link succeed} for constructing layers from static values
|
|
@@ -1142,7 +1204,7 @@ export const sync: {
|
|
|
1142
1204
|
*
|
|
1143
1205
|
* **Example** (Lazily providing a service)
|
|
1144
1206
|
*
|
|
1145
|
-
* ```ts
|
|
1207
|
+
* ```ts import.meta.vitest
|
|
1146
1208
|
* import { Context, Effect, Layer } from "effect"
|
|
1147
1209
|
*
|
|
1148
1210
|
* class Database extends Context.Service<Database, {
|
|
@@ -1152,6 +1214,8 @@ export const sync: {
|
|
|
1152
1214
|
* const layer = Layer.sync(Database, () => ({
|
|
1153
1215
|
* query: (sql: string) => Effect.succeed(`Query: ${sql}`)
|
|
1154
1216
|
* }))
|
|
1217
|
+
* const program = Database.use((database) => database.query("SELECT 1"))
|
|
1218
|
+
* Effect.runSync(Effect.provide(program, layer)) // => "Query: SELECT 1"
|
|
1155
1219
|
* ```
|
|
1156
1220
|
*
|
|
1157
1221
|
* @see {@link succeed} for constructing layers from static values
|
|
@@ -1175,7 +1239,7 @@ export const sync: {
|
|
|
1175
1239
|
*
|
|
1176
1240
|
* **Example** (Lazily providing a service)
|
|
1177
1241
|
*
|
|
1178
|
-
* ```ts
|
|
1242
|
+
* ```ts import.meta.vitest
|
|
1179
1243
|
* import { Context, Effect, Layer } from "effect"
|
|
1180
1244
|
*
|
|
1181
1245
|
* class Database extends Context.Service<Database, {
|
|
@@ -1185,6 +1249,8 @@ export const sync: {
|
|
|
1185
1249
|
* const layer = Layer.sync(Database, () => ({
|
|
1186
1250
|
* query: (sql: string) => Effect.succeed(`Query: ${sql}`)
|
|
1187
1251
|
* }))
|
|
1252
|
+
* const program = Database.use((database) => database.query("SELECT 1"))
|
|
1253
|
+
* Effect.runSync(Effect.provide(program, layer)) // => "Query: SELECT 1"
|
|
1188
1254
|
* ```
|
|
1189
1255
|
*
|
|
1190
1256
|
* @see {@link succeed} for constructing layers from static values
|
|
@@ -1215,7 +1281,7 @@ export const sync: {
|
|
|
1215
1281
|
*
|
|
1216
1282
|
* **Example** (Lazily providing a context)
|
|
1217
1283
|
*
|
|
1218
|
-
* ```ts
|
|
1284
|
+
* ```ts import.meta.vitest
|
|
1219
1285
|
* import { Context, Effect, Layer } from "effect"
|
|
1220
1286
|
*
|
|
1221
1287
|
* class Database extends Context.Service<Database, {
|
|
@@ -1227,6 +1293,8 @@ export const sync: {
|
|
|
1227
1293
|
* query: (sql: string) => Effect.succeed(`Query: ${sql}`)
|
|
1228
1294
|
* })
|
|
1229
1295
|
* )
|
|
1296
|
+
* const program = Database.use((database) => database.query("SELECT 1"))
|
|
1297
|
+
* Effect.runSync(Effect.provide(program, layer)) // => "Query: SELECT 1"
|
|
1230
1298
|
* ```
|
|
1231
1299
|
*
|
|
1232
1300
|
* @see {@link sync} for lazily providing a single service
|
|
@@ -1254,7 +1322,7 @@ export const syncContext = <A>(evaluate: LazyArg<Context.Context<A>>): Layer<A>
|
|
|
1254
1322
|
*
|
|
1255
1323
|
* **Example** (Creating a layer from an effect)
|
|
1256
1324
|
*
|
|
1257
|
-
* ```ts
|
|
1325
|
+
* ```ts import.meta.vitest
|
|
1258
1326
|
* import { Context, Effect, Layer } from "effect"
|
|
1259
1327
|
*
|
|
1260
1328
|
* class Database extends Context.Service<Database, {
|
|
@@ -1266,6 +1334,8 @@ export const syncContext = <A>(evaluate: LazyArg<Context.Context<A>>): Layer<A>
|
|
|
1266
1334
|
* query: (sql: string) => Effect.succeed(`Query: ${sql}`)
|
|
1267
1335
|
* }))
|
|
1268
1336
|
* )
|
|
1337
|
+
* const program = Database.use((database) => database.query("SELECT 1"))
|
|
1338
|
+
* Effect.runSync(Effect.provide(program, layer)) // => "Query: SELECT 1"
|
|
1269
1339
|
* ```
|
|
1270
1340
|
*
|
|
1271
1341
|
* @see {@link effectContext} for effectfully providing multiple services
|
|
@@ -1291,7 +1361,7 @@ export const effect: {
|
|
|
1291
1361
|
*
|
|
1292
1362
|
* **Example** (Creating a layer from an effect)
|
|
1293
1363
|
*
|
|
1294
|
-
* ```ts
|
|
1364
|
+
* ```ts import.meta.vitest
|
|
1295
1365
|
* import { Context, Effect, Layer } from "effect"
|
|
1296
1366
|
*
|
|
1297
1367
|
* class Database extends Context.Service<Database, {
|
|
@@ -1303,6 +1373,8 @@ export const effect: {
|
|
|
1303
1373
|
* query: (sql: string) => Effect.succeed(`Query: ${sql}`)
|
|
1304
1374
|
* }))
|
|
1305
1375
|
* )
|
|
1376
|
+
* const program = Database.use((database) => database.query("SELECT 1"))
|
|
1377
|
+
* Effect.runSync(Effect.provide(program, layer)) // => "Query: SELECT 1"
|
|
1306
1378
|
* ```
|
|
1307
1379
|
*
|
|
1308
1380
|
* @see {@link effectContext} for effectfully providing multiple services
|
|
@@ -1330,7 +1402,7 @@ export const effect: {
|
|
|
1330
1402
|
*
|
|
1331
1403
|
* **Example** (Creating a layer from an effect)
|
|
1332
1404
|
*
|
|
1333
|
-
* ```ts
|
|
1405
|
+
* ```ts import.meta.vitest
|
|
1334
1406
|
* import { Context, Effect, Layer } from "effect"
|
|
1335
1407
|
*
|
|
1336
1408
|
* class Database extends Context.Service<Database, {
|
|
@@ -1342,6 +1414,8 @@ export const effect: {
|
|
|
1342
1414
|
* query: (sql: string) => Effect.succeed(`Query: ${sql}`)
|
|
1343
1415
|
* }))
|
|
1344
1416
|
* )
|
|
1417
|
+
* const program = Database.use((database) => database.query("SELECT 1"))
|
|
1418
|
+
* Effect.runSync(Effect.provide(program, layer)) // => "Query: SELECT 1"
|
|
1345
1419
|
* ```
|
|
1346
1420
|
*
|
|
1347
1421
|
* @see {@link effectContext} for effectfully providing multiple services
|
|
@@ -1380,7 +1454,7 @@ const effectImpl = <I, S, E, R>(
|
|
|
1380
1454
|
*
|
|
1381
1455
|
* **Example** (Creating a layer from an effectful context)
|
|
1382
1456
|
*
|
|
1383
|
-
* ```ts
|
|
1457
|
+
* ```ts import.meta.vitest
|
|
1384
1458
|
* import { Context, Effect, Layer } from "effect"
|
|
1385
1459
|
*
|
|
1386
1460
|
* class Database extends Context.Service<
|
|
@@ -1393,6 +1467,8 @@ const effectImpl = <I, S, E, R>(
|
|
|
1393
1467
|
* query: (sql: string) => Effect.succeed(`Query: ${sql}`)
|
|
1394
1468
|
* }))
|
|
1395
1469
|
* )
|
|
1470
|
+
* const program = Database.use((database) => database.query("SELECT 1"))
|
|
1471
|
+
* Effect.runSync(Effect.provide(program, layer)) // => "Query: SELECT 1"
|
|
1396
1472
|
* ```
|
|
1397
1473
|
*
|
|
1398
1474
|
* @see {@link effect} for effectfully providing a single service
|
|
@@ -1415,14 +1491,17 @@ export const effectContext = <A, E, R>(
|
|
|
1415
1491
|
*
|
|
1416
1492
|
* **Example** (Running an effect during layer construction)
|
|
1417
1493
|
*
|
|
1418
|
-
* ```ts
|
|
1494
|
+
* ```ts import.meta.vitest
|
|
1419
1495
|
* import { Effect, Layer } from "effect"
|
|
1420
1496
|
*
|
|
1497
|
+
* const logs: Array<string> = []
|
|
1421
1498
|
* const initLayer = Layer.effectDiscard(
|
|
1422
1499
|
* Effect.sync(() => {
|
|
1423
|
-
*
|
|
1500
|
+
* logs.push("Initializing application...")
|
|
1424
1501
|
* })
|
|
1425
1502
|
* )
|
|
1503
|
+
* Effect.runSync(Effect.scoped(Layer.build(initLayer)))
|
|
1504
|
+
* logs // => ["Initializing application..."]
|
|
1426
1505
|
* ```
|
|
1427
1506
|
*
|
|
1428
1507
|
* @see {@link empty} for a no-op layer that performs no construction work
|
|
@@ -1443,8 +1522,8 @@ export const effectDiscard = <X, E, R>(effect: Effect<X, E, R>): Layer<never, E,
|
|
|
1443
1522
|
*
|
|
1444
1523
|
* **Example** (Choosing a layer lazily)
|
|
1445
1524
|
*
|
|
1446
|
-
* ```ts
|
|
1447
|
-
* import { Context, Layer } from "effect"
|
|
1525
|
+
* ```ts import.meta.vitest
|
|
1526
|
+
* import { Context, Effect, Layer } from "effect"
|
|
1448
1527
|
*
|
|
1449
1528
|
* class Config extends Context.Service<Config, string>()("Config") {}
|
|
1450
1529
|
*
|
|
@@ -1455,6 +1534,7 @@ export const effectDiscard = <X, E, R>(effect: Effect<X, E, R>): Layer<never, E,
|
|
|
1455
1534
|
* ? Layer.succeed(Config, "https://api.example.com")
|
|
1456
1535
|
* : Layer.succeed(Config, "http://localhost:3000")
|
|
1457
1536
|
* )
|
|
1537
|
+
* Effect.runSync(Effect.provide(Config, layer)) // => "https://api.example.com"
|
|
1458
1538
|
* ```
|
|
1459
1539
|
*
|
|
1460
1540
|
* @category constructors
|
|
@@ -1478,7 +1558,7 @@ export const suspend = <A, E, R>(evaluate: LazyArg<Layer<A, E, R>>): Layer<A, E,
|
|
|
1478
1558
|
*
|
|
1479
1559
|
* **Example** (Unwrapping an effectful layer)
|
|
1480
1560
|
*
|
|
1481
|
-
* ```ts
|
|
1561
|
+
* ```ts import.meta.vitest
|
|
1482
1562
|
* import { Context, Effect, Layer } from "effect"
|
|
1483
1563
|
*
|
|
1484
1564
|
* class Database extends Context.Service<Database, {
|
|
@@ -1490,6 +1570,8 @@ export const suspend = <A, E, R>(evaluate: LazyArg<Layer<A, E, R>>): Layer<A, E,
|
|
|
1490
1570
|
* )
|
|
1491
1571
|
*
|
|
1492
1572
|
* const unwrappedLayer = Layer.unwrap(layerEffect)
|
|
1573
|
+
* const program = Database.use((database) => database.query("SELECT 1"))
|
|
1574
|
+
* Effect.runSync(Effect.provide(program, unwrappedLayer)) // => "result"
|
|
1493
1575
|
* ```
|
|
1494
1576
|
*
|
|
1495
1577
|
* @category converting
|
|
@@ -1537,7 +1619,7 @@ const mergeAllEffect = <Layers extends [Layer<never, any, any>, ...Array<Layer<n
|
|
|
1537
1619
|
*
|
|
1538
1620
|
* **Example** (Merging independent layers)
|
|
1539
1621
|
*
|
|
1540
|
-
* ```ts
|
|
1622
|
+
* ```ts import.meta.vitest
|
|
1541
1623
|
* import { Context, Effect, Layer } from "effect"
|
|
1542
1624
|
*
|
|
1543
1625
|
* class Database extends Context.Service<Database, {
|
|
@@ -1551,11 +1633,15 @@ const mergeAllEffect = <Layers extends [Layer<never, any, any>, ...Array<Layer<n
|
|
|
1551
1633
|
* const dbLayer = Layer.succeed(Database, {
|
|
1552
1634
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
|
1553
1635
|
* })
|
|
1636
|
+
* const logs: Array<string> = []
|
|
1554
1637
|
* const loggerLayer = Layer.succeed(Logger, {
|
|
1555
|
-
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() =>
|
|
1638
|
+
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => logs.push(msg)))
|
|
1556
1639
|
* })
|
|
1557
1640
|
*
|
|
1558
1641
|
* const mergedLayer = Layer.mergeAll(dbLayer, loggerLayer)
|
|
1642
|
+
* const program = Logger.use((logger) => logger.log("ready"))
|
|
1643
|
+
* Effect.runSync(Effect.provide(program, mergedLayer))
|
|
1644
|
+
* logs // => ["ready"]
|
|
1559
1645
|
* ```
|
|
1560
1646
|
*
|
|
1561
1647
|
* @see {@link merge} for merging one layer with another layer or array
|
|
@@ -1588,7 +1674,7 @@ export const mergeAll = <Layers extends [Layer<never, any, any>, ...Array<Layer<
|
|
|
1588
1674
|
*
|
|
1589
1675
|
* **Example** (Merging two layers)
|
|
1590
1676
|
*
|
|
1591
|
-
* ```ts
|
|
1677
|
+
* ```ts import.meta.vitest
|
|
1592
1678
|
* import { Context, Effect, Layer } from "effect"
|
|
1593
1679
|
*
|
|
1594
1680
|
* class Database extends Context.Service<Database, {
|
|
@@ -1603,10 +1689,12 @@ export const mergeAll = <Layers extends [Layer<never, any, any>, ...Array<Layer<
|
|
|
1603
1689
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
|
1604
1690
|
* })
|
|
1605
1691
|
* const loggerLayer = Layer.succeed(Logger, {
|
|
1606
|
-
* log: Effect.fn("Logger.log")((
|
|
1692
|
+
* log: Effect.fn("Logger.log")((_msg: string) => Effect.void)
|
|
1607
1693
|
* })
|
|
1608
1694
|
*
|
|
1609
1695
|
* const mergedLayer = Layer.merge(dbLayer, loggerLayer)
|
|
1696
|
+
* const program = Database.use((database) => database.query("SELECT 1"))
|
|
1697
|
+
* Effect.runSync(Effect.provide(program, mergedLayer)) // => "result"
|
|
1610
1698
|
* ```
|
|
1611
1699
|
*
|
|
1612
1700
|
* @see {@link mergeAll} for merging several layers at once
|
|
@@ -1632,7 +1720,7 @@ export const merge: {
|
|
|
1632
1720
|
*
|
|
1633
1721
|
* **Example** (Merging two layers)
|
|
1634
1722
|
*
|
|
1635
|
-
* ```ts
|
|
1723
|
+
* ```ts import.meta.vitest
|
|
1636
1724
|
* import { Context, Effect, Layer } from "effect"
|
|
1637
1725
|
*
|
|
1638
1726
|
* class Database extends Context.Service<Database, {
|
|
@@ -1647,10 +1735,12 @@ export const merge: {
|
|
|
1647
1735
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
|
1648
1736
|
* })
|
|
1649
1737
|
* const loggerLayer = Layer.succeed(Logger, {
|
|
1650
|
-
* log: Effect.fn("Logger.log")((
|
|
1738
|
+
* log: Effect.fn("Logger.log")((_msg: string) => Effect.void)
|
|
1651
1739
|
* })
|
|
1652
1740
|
*
|
|
1653
1741
|
* const mergedLayer = Layer.merge(dbLayer, loggerLayer)
|
|
1742
|
+
* const program = Database.use((database) => database.query("SELECT 1"))
|
|
1743
|
+
* Effect.runSync(Effect.provide(program, mergedLayer)) // => "result"
|
|
1654
1744
|
* ```
|
|
1655
1745
|
*
|
|
1656
1746
|
* @see {@link mergeAll} for merging several layers at once
|
|
@@ -1676,7 +1766,7 @@ export const merge: {
|
|
|
1676
1766
|
*
|
|
1677
1767
|
* **Example** (Merging two layers)
|
|
1678
1768
|
*
|
|
1679
|
-
* ```ts
|
|
1769
|
+
* ```ts import.meta.vitest
|
|
1680
1770
|
* import { Context, Effect, Layer } from "effect"
|
|
1681
1771
|
*
|
|
1682
1772
|
* class Database extends Context.Service<Database, {
|
|
@@ -1691,10 +1781,12 @@ export const merge: {
|
|
|
1691
1781
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
|
1692
1782
|
* })
|
|
1693
1783
|
* const loggerLayer = Layer.succeed(Logger, {
|
|
1694
|
-
* log: Effect.fn("Logger.log")((
|
|
1784
|
+
* log: Effect.fn("Logger.log")((_msg: string) => Effect.void)
|
|
1695
1785
|
* })
|
|
1696
1786
|
*
|
|
1697
1787
|
* const mergedLayer = Layer.merge(dbLayer, loggerLayer)
|
|
1788
|
+
* const program = Database.use((database) => database.query("SELECT 1"))
|
|
1789
|
+
* Effect.runSync(Effect.provide(program, mergedLayer)) // => "result"
|
|
1698
1790
|
* ```
|
|
1699
1791
|
*
|
|
1700
1792
|
* @see {@link mergeAll} for merging several layers at once
|
|
@@ -1727,7 +1819,7 @@ export const merge: {
|
|
|
1727
1819
|
*
|
|
1728
1820
|
* **Example** (Merging two layers)
|
|
1729
1821
|
*
|
|
1730
|
-
* ```ts
|
|
1822
|
+
* ```ts import.meta.vitest
|
|
1731
1823
|
* import { Context, Effect, Layer } from "effect"
|
|
1732
1824
|
*
|
|
1733
1825
|
* class Database extends Context.Service<Database, {
|
|
@@ -1742,10 +1834,12 @@ export const merge: {
|
|
|
1742
1834
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
|
1743
1835
|
* })
|
|
1744
1836
|
* const loggerLayer = Layer.succeed(Logger, {
|
|
1745
|
-
* log: Effect.fn("Logger.log")((
|
|
1837
|
+
* log: Effect.fn("Logger.log")((_msg: string) => Effect.void)
|
|
1746
1838
|
* })
|
|
1747
1839
|
*
|
|
1748
1840
|
* const mergedLayer = Layer.merge(dbLayer, loggerLayer)
|
|
1841
|
+
* const program = Database.use((database) => database.query("SELECT 1"))
|
|
1842
|
+
* Effect.runSync(Effect.provide(program, mergedLayer)) // => "result"
|
|
1749
1843
|
* ```
|
|
1750
1844
|
*
|
|
1751
1845
|
* @see {@link mergeAll} for merging several layers at once
|
|
@@ -1771,7 +1865,7 @@ export const merge: {
|
|
|
1771
1865
|
*
|
|
1772
1866
|
* **Example** (Merging two layers)
|
|
1773
1867
|
*
|
|
1774
|
-
* ```ts
|
|
1868
|
+
* ```ts import.meta.vitest
|
|
1775
1869
|
* import { Context, Effect, Layer } from "effect"
|
|
1776
1870
|
*
|
|
1777
1871
|
* class Database extends Context.Service<Database, {
|
|
@@ -1786,10 +1880,12 @@ export const merge: {
|
|
|
1786
1880
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed("result"))
|
|
1787
1881
|
* })
|
|
1788
1882
|
* const loggerLayer = Layer.succeed(Logger, {
|
|
1789
|
-
* log: Effect.fn("Logger.log")((
|
|
1883
|
+
* log: Effect.fn("Logger.log")((_msg: string) => Effect.void)
|
|
1790
1884
|
* })
|
|
1791
1885
|
*
|
|
1792
1886
|
* const mergedLayer = Layer.merge(dbLayer, loggerLayer)
|
|
1887
|
+
* const program = Database.use((database) => database.query("SELECT 1"))
|
|
1888
|
+
* Effect.runSync(Effect.provide(program, mergedLayer)) // => "result"
|
|
1793
1889
|
* ```
|
|
1794
1890
|
*
|
|
1795
1891
|
* @see {@link mergeAll} for merging several layers at once
|
|
@@ -1844,7 +1940,7 @@ const provideWith = (
|
|
|
1844
1940
|
*
|
|
1845
1941
|
* **Example** (Providing layer dependencies)
|
|
1846
1942
|
*
|
|
1847
|
-
* ```ts
|
|
1943
|
+
* ```ts import.meta.vitest
|
|
1848
1944
|
* import { Context, Effect, Layer } from "effect"
|
|
1849
1945
|
*
|
|
1850
1946
|
* class Database extends Context.Service<Database, {
|
|
@@ -1867,8 +1963,9 @@ const provideWith = (
|
|
|
1867
1963
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`DB: ${sql}`))
|
|
1868
1964
|
* })
|
|
1869
1965
|
*
|
|
1966
|
+
* const logs: Array<string> = []
|
|
1870
1967
|
* const loggerLayer = Layer.succeed(Logger, {
|
|
1871
|
-
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() =>
|
|
1968
|
+
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => logs.push(`[LOG] ${msg}`)))
|
|
1872
1969
|
* })
|
|
1873
1970
|
*
|
|
1874
1971
|
* // UserService depends on Database and Logger
|
|
@@ -1899,6 +1996,8 @@ const provideWith = (
|
|
|
1899
1996
|
* }).pipe(
|
|
1900
1997
|
* Effect.provide(userServiceWithDependencies)
|
|
1901
1998
|
* )
|
|
1999
|
+
* Effect.runSync(program) // => { id: "123", name: "DB: SELECT * FROM users WHERE id = 123" }
|
|
2000
|
+
* logs // => ["[LOG] Looking up user 123"]
|
|
1902
2001
|
* ```
|
|
1903
2002
|
*
|
|
1904
2003
|
* @see {@link provideMerge} for retaining the dependency services
|
|
@@ -1922,7 +2021,7 @@ export const provide: {
|
|
|
1922
2021
|
*
|
|
1923
2022
|
* **Example** (Providing layer dependencies)
|
|
1924
2023
|
*
|
|
1925
|
-
* ```ts
|
|
2024
|
+
* ```ts import.meta.vitest
|
|
1926
2025
|
* import { Context, Effect, Layer } from "effect"
|
|
1927
2026
|
*
|
|
1928
2027
|
* class Database extends Context.Service<Database, {
|
|
@@ -1945,8 +2044,9 @@ export const provide: {
|
|
|
1945
2044
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`DB: ${sql}`))
|
|
1946
2045
|
* })
|
|
1947
2046
|
*
|
|
2047
|
+
* const logs: Array<string> = []
|
|
1948
2048
|
* const loggerLayer = Layer.succeed(Logger, {
|
|
1949
|
-
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() =>
|
|
2049
|
+
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => logs.push(`[LOG] ${msg}`)))
|
|
1950
2050
|
* })
|
|
1951
2051
|
*
|
|
1952
2052
|
* // UserService depends on Database and Logger
|
|
@@ -1977,6 +2077,8 @@ export const provide: {
|
|
|
1977
2077
|
* }).pipe(
|
|
1978
2078
|
* Effect.provide(userServiceWithDependencies)
|
|
1979
2079
|
* )
|
|
2080
|
+
* Effect.runSync(program) // => { id: "123", name: "DB: SELECT * FROM users WHERE id = 123" }
|
|
2081
|
+
* logs // => ["[LOG] Looking up user 123"]
|
|
1980
2082
|
* ```
|
|
1981
2083
|
*
|
|
1982
2084
|
* @see {@link provideMerge} for retaining the dependency services
|
|
@@ -2000,7 +2102,7 @@ export const provide: {
|
|
|
2000
2102
|
*
|
|
2001
2103
|
* **Example** (Providing layer dependencies)
|
|
2002
2104
|
*
|
|
2003
|
-
* ```ts
|
|
2105
|
+
* ```ts import.meta.vitest
|
|
2004
2106
|
* import { Context, Effect, Layer } from "effect"
|
|
2005
2107
|
*
|
|
2006
2108
|
* class Database extends Context.Service<Database, {
|
|
@@ -2023,8 +2125,9 @@ export const provide: {
|
|
|
2023
2125
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`DB: ${sql}`))
|
|
2024
2126
|
* })
|
|
2025
2127
|
*
|
|
2128
|
+
* const logs: Array<string> = []
|
|
2026
2129
|
* const loggerLayer = Layer.succeed(Logger, {
|
|
2027
|
-
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() =>
|
|
2130
|
+
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => logs.push(`[LOG] ${msg}`)))
|
|
2028
2131
|
* })
|
|
2029
2132
|
*
|
|
2030
2133
|
* // UserService depends on Database and Logger
|
|
@@ -2055,6 +2158,8 @@ export const provide: {
|
|
|
2055
2158
|
* }).pipe(
|
|
2056
2159
|
* Effect.provide(userServiceWithDependencies)
|
|
2057
2160
|
* )
|
|
2161
|
+
* Effect.runSync(program) // => { id: "123", name: "DB: SELECT * FROM users WHERE id = 123" }
|
|
2162
|
+
* logs // => ["[LOG] Looking up user 123"]
|
|
2058
2163
|
* ```
|
|
2059
2164
|
*
|
|
2060
2165
|
* @see {@link provideMerge} for retaining the dependency services
|
|
@@ -2085,7 +2190,7 @@ export const provide: {
|
|
|
2085
2190
|
*
|
|
2086
2191
|
* **Example** (Providing layer dependencies)
|
|
2087
2192
|
*
|
|
2088
|
-
* ```ts
|
|
2193
|
+
* ```ts import.meta.vitest
|
|
2089
2194
|
* import { Context, Effect, Layer } from "effect"
|
|
2090
2195
|
*
|
|
2091
2196
|
* class Database extends Context.Service<Database, {
|
|
@@ -2108,8 +2213,9 @@ export const provide: {
|
|
|
2108
2213
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`DB: ${sql}`))
|
|
2109
2214
|
* })
|
|
2110
2215
|
*
|
|
2216
|
+
* const logs: Array<string> = []
|
|
2111
2217
|
* const loggerLayer = Layer.succeed(Logger, {
|
|
2112
|
-
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() =>
|
|
2218
|
+
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => logs.push(`[LOG] ${msg}`)))
|
|
2113
2219
|
* })
|
|
2114
2220
|
*
|
|
2115
2221
|
* // UserService depends on Database and Logger
|
|
@@ -2140,6 +2246,8 @@ export const provide: {
|
|
|
2140
2246
|
* }).pipe(
|
|
2141
2247
|
* Effect.provide(userServiceWithDependencies)
|
|
2142
2248
|
* )
|
|
2249
|
+
* Effect.runSync(program) // => { id: "123", name: "DB: SELECT * FROM users WHERE id = 123" }
|
|
2250
|
+
* logs // => ["[LOG] Looking up user 123"]
|
|
2143
2251
|
* ```
|
|
2144
2252
|
*
|
|
2145
2253
|
* @see {@link provideMerge} for retaining the dependency services
|
|
@@ -2163,7 +2271,7 @@ export const provide: {
|
|
|
2163
2271
|
*
|
|
2164
2272
|
* **Example** (Providing layer dependencies)
|
|
2165
2273
|
*
|
|
2166
|
-
* ```ts
|
|
2274
|
+
* ```ts import.meta.vitest
|
|
2167
2275
|
* import { Context, Effect, Layer } from "effect"
|
|
2168
2276
|
*
|
|
2169
2277
|
* class Database extends Context.Service<Database, {
|
|
@@ -2186,8 +2294,9 @@ export const provide: {
|
|
|
2186
2294
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`DB: ${sql}`))
|
|
2187
2295
|
* })
|
|
2188
2296
|
*
|
|
2297
|
+
* const logs: Array<string> = []
|
|
2189
2298
|
* const loggerLayer = Layer.succeed(Logger, {
|
|
2190
|
-
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() =>
|
|
2299
|
+
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => logs.push(`[LOG] ${msg}`)))
|
|
2191
2300
|
* })
|
|
2192
2301
|
*
|
|
2193
2302
|
* // UserService depends on Database and Logger
|
|
@@ -2218,6 +2327,8 @@ export const provide: {
|
|
|
2218
2327
|
* }).pipe(
|
|
2219
2328
|
* Effect.provide(userServiceWithDependencies)
|
|
2220
2329
|
* )
|
|
2330
|
+
* Effect.runSync(program) // => { id: "123", name: "DB: SELECT * FROM users WHERE id = 123" }
|
|
2331
|
+
* logs // => ["[LOG] Looking up user 123"]
|
|
2221
2332
|
* ```
|
|
2222
2333
|
*
|
|
2223
2334
|
* @see {@link provideMerge} for retaining the dependency services
|
|
@@ -2251,7 +2362,7 @@ export const provide: {
|
|
|
2251
2362
|
*
|
|
2252
2363
|
* **Example** (Providing dependencies while retaining services)
|
|
2253
2364
|
*
|
|
2254
|
-
* ```ts
|
|
2365
|
+
* ```ts import.meta.vitest
|
|
2255
2366
|
* import { Context, Effect, Layer } from "effect"
|
|
2256
2367
|
*
|
|
2257
2368
|
* class Database extends Context.Service<Database, {
|
|
@@ -2274,8 +2385,9 @@ export const provide: {
|
|
|
2274
2385
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`DB: ${sql}`))
|
|
2275
2386
|
* })
|
|
2276
2387
|
*
|
|
2388
|
+
* const logs: Array<string> = []
|
|
2277
2389
|
* const loggerLayer = Layer.succeed(Logger, {
|
|
2278
|
-
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() =>
|
|
2390
|
+
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => logs.push(`[LOG] ${msg}`)))
|
|
2279
2391
|
* })
|
|
2280
2392
|
*
|
|
2281
2393
|
* // UserService depends on Database and Logger
|
|
@@ -2312,6 +2424,8 @@ export const provide: {
|
|
|
2312
2424
|
* }).pipe(
|
|
2313
2425
|
* Effect.provide(allServicesLayer)
|
|
2314
2426
|
* )
|
|
2427
|
+
* Effect.runSync(program) // => { id: "123", name: "DB: SELECT * FROM users WHERE id = 123" }
|
|
2428
|
+
* logs // => ["[LOG] Looking up user 123", "[LOG] Found user: DB: SELECT * FROM users WHERE id = 123"]
|
|
2315
2429
|
* ```
|
|
2316
2430
|
*
|
|
2317
2431
|
* @see {@link provide} for keeping dependency services private
|
|
@@ -2335,7 +2449,7 @@ export const provideMerge: {
|
|
|
2335
2449
|
*
|
|
2336
2450
|
* **Example** (Providing dependencies while retaining services)
|
|
2337
2451
|
*
|
|
2338
|
-
* ```ts
|
|
2452
|
+
* ```ts import.meta.vitest
|
|
2339
2453
|
* import { Context, Effect, Layer } from "effect"
|
|
2340
2454
|
*
|
|
2341
2455
|
* class Database extends Context.Service<Database, {
|
|
@@ -2358,8 +2472,9 @@ export const provideMerge: {
|
|
|
2358
2472
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`DB: ${sql}`))
|
|
2359
2473
|
* })
|
|
2360
2474
|
*
|
|
2475
|
+
* const logs: Array<string> = []
|
|
2361
2476
|
* const loggerLayer = Layer.succeed(Logger, {
|
|
2362
|
-
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() =>
|
|
2477
|
+
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => logs.push(`[LOG] ${msg}`)))
|
|
2363
2478
|
* })
|
|
2364
2479
|
*
|
|
2365
2480
|
* // UserService depends on Database and Logger
|
|
@@ -2396,6 +2511,8 @@ export const provideMerge: {
|
|
|
2396
2511
|
* }).pipe(
|
|
2397
2512
|
* Effect.provide(allServicesLayer)
|
|
2398
2513
|
* )
|
|
2514
|
+
* Effect.runSync(program) // => { id: "123", name: "DB: SELECT * FROM users WHERE id = 123" }
|
|
2515
|
+
* logs // => ["[LOG] Looking up user 123", "[LOG] Found user: DB: SELECT * FROM users WHERE id = 123"]
|
|
2399
2516
|
* ```
|
|
2400
2517
|
*
|
|
2401
2518
|
* @see {@link provide} for keeping dependency services private
|
|
@@ -2419,7 +2536,7 @@ export const provideMerge: {
|
|
|
2419
2536
|
*
|
|
2420
2537
|
* **Example** (Providing dependencies while retaining services)
|
|
2421
2538
|
*
|
|
2422
|
-
* ```ts
|
|
2539
|
+
* ```ts import.meta.vitest
|
|
2423
2540
|
* import { Context, Effect, Layer } from "effect"
|
|
2424
2541
|
*
|
|
2425
2542
|
* class Database extends Context.Service<Database, {
|
|
@@ -2442,8 +2559,9 @@ export const provideMerge: {
|
|
|
2442
2559
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`DB: ${sql}`))
|
|
2443
2560
|
* })
|
|
2444
2561
|
*
|
|
2562
|
+
* const logs: Array<string> = []
|
|
2445
2563
|
* const loggerLayer = Layer.succeed(Logger, {
|
|
2446
|
-
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() =>
|
|
2564
|
+
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => logs.push(`[LOG] ${msg}`)))
|
|
2447
2565
|
* })
|
|
2448
2566
|
*
|
|
2449
2567
|
* // UserService depends on Database and Logger
|
|
@@ -2480,6 +2598,8 @@ export const provideMerge: {
|
|
|
2480
2598
|
* }).pipe(
|
|
2481
2599
|
* Effect.provide(allServicesLayer)
|
|
2482
2600
|
* )
|
|
2601
|
+
* Effect.runSync(program) // => { id: "123", name: "DB: SELECT * FROM users WHERE id = 123" }
|
|
2602
|
+
* logs // => ["[LOG] Looking up user 123", "[LOG] Found user: DB: SELECT * FROM users WHERE id = 123"]
|
|
2483
2603
|
* ```
|
|
2484
2604
|
*
|
|
2485
2605
|
* @see {@link provide} for keeping dependency services private
|
|
@@ -2510,7 +2630,7 @@ export const provideMerge: {
|
|
|
2510
2630
|
*
|
|
2511
2631
|
* **Example** (Providing dependencies while retaining services)
|
|
2512
2632
|
*
|
|
2513
|
-
* ```ts
|
|
2633
|
+
* ```ts import.meta.vitest
|
|
2514
2634
|
* import { Context, Effect, Layer } from "effect"
|
|
2515
2635
|
*
|
|
2516
2636
|
* class Database extends Context.Service<Database, {
|
|
@@ -2533,8 +2653,9 @@ export const provideMerge: {
|
|
|
2533
2653
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`DB: ${sql}`))
|
|
2534
2654
|
* })
|
|
2535
2655
|
*
|
|
2656
|
+
* const logs: Array<string> = []
|
|
2536
2657
|
* const loggerLayer = Layer.succeed(Logger, {
|
|
2537
|
-
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() =>
|
|
2658
|
+
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => logs.push(`[LOG] ${msg}`)))
|
|
2538
2659
|
* })
|
|
2539
2660
|
*
|
|
2540
2661
|
* // UserService depends on Database and Logger
|
|
@@ -2571,6 +2692,8 @@ export const provideMerge: {
|
|
|
2571
2692
|
* }).pipe(
|
|
2572
2693
|
* Effect.provide(allServicesLayer)
|
|
2573
2694
|
* )
|
|
2695
|
+
* Effect.runSync(program) // => { id: "123", name: "DB: SELECT * FROM users WHERE id = 123" }
|
|
2696
|
+
* logs // => ["[LOG] Looking up user 123", "[LOG] Found user: DB: SELECT * FROM users WHERE id = 123"]
|
|
2574
2697
|
* ```
|
|
2575
2698
|
*
|
|
2576
2699
|
* @see {@link provide} for keeping dependency services private
|
|
@@ -2594,7 +2717,7 @@ export const provideMerge: {
|
|
|
2594
2717
|
*
|
|
2595
2718
|
* **Example** (Providing dependencies while retaining services)
|
|
2596
2719
|
*
|
|
2597
|
-
* ```ts
|
|
2720
|
+
* ```ts import.meta.vitest
|
|
2598
2721
|
* import { Context, Effect, Layer } from "effect"
|
|
2599
2722
|
*
|
|
2600
2723
|
* class Database extends Context.Service<Database, {
|
|
@@ -2617,8 +2740,9 @@ export const provideMerge: {
|
|
|
2617
2740
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`DB: ${sql}`))
|
|
2618
2741
|
* })
|
|
2619
2742
|
*
|
|
2743
|
+
* const logs: Array<string> = []
|
|
2620
2744
|
* const loggerLayer = Layer.succeed(Logger, {
|
|
2621
|
-
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() =>
|
|
2745
|
+
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => logs.push(`[LOG] ${msg}`)))
|
|
2622
2746
|
* })
|
|
2623
2747
|
*
|
|
2624
2748
|
* // UserService depends on Database and Logger
|
|
@@ -2655,6 +2779,8 @@ export const provideMerge: {
|
|
|
2655
2779
|
* }).pipe(
|
|
2656
2780
|
* Effect.provide(allServicesLayer)
|
|
2657
2781
|
* )
|
|
2782
|
+
* Effect.runSync(program) // => { id: "123", name: "DB: SELECT * FROM users WHERE id = 123" }
|
|
2783
|
+
* logs // => ["[LOG] Looking up user 123", "[LOG] Found user: DB: SELECT * FROM users WHERE id = 123"]
|
|
2658
2784
|
* ```
|
|
2659
2785
|
*
|
|
2660
2786
|
* @see {@link provide} for keeping dependency services private
|
|
@@ -2683,7 +2809,7 @@ export const provideMerge: {
|
|
|
2683
2809
|
*
|
|
2684
2810
|
* **Example** (Creating services from layer output)
|
|
2685
2811
|
*
|
|
2686
|
-
* ```ts
|
|
2812
|
+
* ```ts import.meta.vitest
|
|
2687
2813
|
* import { Context, Effect, Layer } from "effect"
|
|
2688
2814
|
*
|
|
2689
2815
|
* class Config extends Context.Service<Config, {
|
|
@@ -2699,6 +2825,8 @@ export const provideMerge: {
|
|
|
2699
2825
|
* readonly log: (msg: string) => Effect.Effect<void>
|
|
2700
2826
|
* }>()("Logger") {}
|
|
2701
2827
|
*
|
|
2828
|
+
* const logs: Array<string> = []
|
|
2829
|
+
*
|
|
2702
2830
|
* // Base config layer
|
|
2703
2831
|
* const configLayer = Layer.succeed(Config, {
|
|
2704
2832
|
* dbUrl: "postgres://localhost:5432/mydb",
|
|
@@ -2722,8 +2850,8 @@ export const provideMerge: {
|
|
|
2722
2850
|
* const loggerLayer = Layer.succeed(Logger, {
|
|
2723
2851
|
* log: Effect.fn("Logger.log")((msg: string) =>
|
|
2724
2852
|
* config.logLevel === "debug"
|
|
2725
|
-
* ? Effect.sync(() =>
|
|
2726
|
-
* : Effect.sync(() =>
|
|
2853
|
+
* ? Effect.sync(() => logs.push(`[DEBUG] ${msg}`))
|
|
2854
|
+
* : Effect.sync(() => logs.push(msg))
|
|
2727
2855
|
* )
|
|
2728
2856
|
* })
|
|
2729
2857
|
*
|
|
@@ -2744,6 +2872,8 @@ export const provideMerge: {
|
|
|
2744
2872
|
* }).pipe(
|
|
2745
2873
|
* Effect.provide(dynamicServiceLayer)
|
|
2746
2874
|
* )
|
|
2875
|
+
* Effect.runSync(program) // => "Querying postgres://localhost:5432/mydb: SELECT * FROM users"
|
|
2876
|
+
* logs // => ["[DEBUG] Starting database query"]
|
|
2747
2877
|
* ```
|
|
2748
2878
|
*
|
|
2749
2879
|
* @category sequencing
|
|
@@ -2755,7 +2885,7 @@ export const flatMap: {
|
|
|
2755
2885
|
*
|
|
2756
2886
|
* **Example** (Creating services from layer output)
|
|
2757
2887
|
*
|
|
2758
|
-
* ```ts
|
|
2888
|
+
* ```ts import.meta.vitest
|
|
2759
2889
|
* import { Context, Effect, Layer } from "effect"
|
|
2760
2890
|
*
|
|
2761
2891
|
* class Config extends Context.Service<Config, {
|
|
@@ -2771,6 +2901,8 @@ export const flatMap: {
|
|
|
2771
2901
|
* readonly log: (msg: string) => Effect.Effect<void>
|
|
2772
2902
|
* }>()("Logger") {}
|
|
2773
2903
|
*
|
|
2904
|
+
* const logs: Array<string> = []
|
|
2905
|
+
*
|
|
2774
2906
|
* // Base config layer
|
|
2775
2907
|
* const configLayer = Layer.succeed(Config, {
|
|
2776
2908
|
* dbUrl: "postgres://localhost:5432/mydb",
|
|
@@ -2794,8 +2926,8 @@ export const flatMap: {
|
|
|
2794
2926
|
* const loggerLayer = Layer.succeed(Logger, {
|
|
2795
2927
|
* log: Effect.fn("Logger.log")((msg: string) =>
|
|
2796
2928
|
* config.logLevel === "debug"
|
|
2797
|
-
* ? Effect.sync(() =>
|
|
2798
|
-
* : Effect.sync(() =>
|
|
2929
|
+
* ? Effect.sync(() => logs.push(`[DEBUG] ${msg}`))
|
|
2930
|
+
* : Effect.sync(() => logs.push(msg))
|
|
2799
2931
|
* )
|
|
2800
2932
|
* })
|
|
2801
2933
|
*
|
|
@@ -2816,6 +2948,8 @@ export const flatMap: {
|
|
|
2816
2948
|
* }).pipe(
|
|
2817
2949
|
* Effect.provide(dynamicServiceLayer)
|
|
2818
2950
|
* )
|
|
2951
|
+
* Effect.runSync(program) // => "Querying postgres://localhost:5432/mydb: SELECT * FROM users"
|
|
2952
|
+
* logs // => ["[DEBUG] Starting database query"]
|
|
2819
2953
|
* ```
|
|
2820
2954
|
*
|
|
2821
2955
|
* @category sequencing
|
|
@@ -2827,7 +2961,7 @@ export const flatMap: {
|
|
|
2827
2961
|
*
|
|
2828
2962
|
* **Example** (Creating services from layer output)
|
|
2829
2963
|
*
|
|
2830
|
-
* ```ts
|
|
2964
|
+
* ```ts import.meta.vitest
|
|
2831
2965
|
* import { Context, Effect, Layer } from "effect"
|
|
2832
2966
|
*
|
|
2833
2967
|
* class Config extends Context.Service<Config, {
|
|
@@ -2843,6 +2977,8 @@ export const flatMap: {
|
|
|
2843
2977
|
* readonly log: (msg: string) => Effect.Effect<void>
|
|
2844
2978
|
* }>()("Logger") {}
|
|
2845
2979
|
*
|
|
2980
|
+
* const logs: Array<string> = []
|
|
2981
|
+
*
|
|
2846
2982
|
* // Base config layer
|
|
2847
2983
|
* const configLayer = Layer.succeed(Config, {
|
|
2848
2984
|
* dbUrl: "postgres://localhost:5432/mydb",
|
|
@@ -2866,8 +3002,8 @@ export const flatMap: {
|
|
|
2866
3002
|
* const loggerLayer = Layer.succeed(Logger, {
|
|
2867
3003
|
* log: Effect.fn("Logger.log")((msg: string) =>
|
|
2868
3004
|
* config.logLevel === "debug"
|
|
2869
|
-
* ? Effect.sync(() =>
|
|
2870
|
-
* : Effect.sync(() =>
|
|
3005
|
+
* ? Effect.sync(() => logs.push(`[DEBUG] ${msg}`))
|
|
3006
|
+
* : Effect.sync(() => logs.push(msg))
|
|
2871
3007
|
* )
|
|
2872
3008
|
* })
|
|
2873
3009
|
*
|
|
@@ -2888,6 +3024,8 @@ export const flatMap: {
|
|
|
2888
3024
|
* }).pipe(
|
|
2889
3025
|
* Effect.provide(dynamicServiceLayer)
|
|
2890
3026
|
* )
|
|
3027
|
+
* Effect.runSync(program) // => "Querying postgres://localhost:5432/mydb: SELECT * FROM users"
|
|
3028
|
+
* logs // => ["[DEBUG] Starting database query"]
|
|
2891
3029
|
* ```
|
|
2892
3030
|
*
|
|
2893
3031
|
* @category sequencing
|
|
@@ -3151,8 +3289,8 @@ export const tapCause: {
|
|
|
3151
3289
|
*
|
|
3152
3290
|
* **Example** (Converting layer failures to defects)
|
|
3153
3291
|
*
|
|
3154
|
-
* ```ts
|
|
3155
|
-
* import { Context, Data, Effect, Layer } from "effect"
|
|
3292
|
+
* ```ts import.meta.vitest
|
|
3293
|
+
* import { Context, Data, Effect, Exit, Layer } from "effect"
|
|
3156
3294
|
*
|
|
3157
3295
|
* class DatabaseError extends Data.TaggedError("DatabaseError")<{
|
|
3158
3296
|
* message: string
|
|
@@ -3163,10 +3301,11 @@ export const tapCause: {
|
|
|
3163
3301
|
* }>()("Database") {}
|
|
3164
3302
|
*
|
|
3165
3303
|
* // Layer that can fail during construction
|
|
3166
|
-
* const
|
|
3167
|
-
*
|
|
3168
|
-
*
|
|
3169
|
-
*
|
|
3304
|
+
* const error = new DatabaseError({ message: "Connection failed" })
|
|
3305
|
+
* const flakyDatabaseLayer = Layer.effect(
|
|
3306
|
+
* Database,
|
|
3307
|
+
* Effect.fail(error)
|
|
3308
|
+
* )
|
|
3170
3309
|
*
|
|
3171
3310
|
* // Convert failures to fiber death - removes error from type
|
|
3172
3311
|
* const reliableDatabaseLayer = flakyDatabaseLayer.pipe(Layer.orDie)
|
|
@@ -3179,8 +3318,7 @@ export const tapCause: {
|
|
|
3179
3318
|
* Effect.provide(reliableDatabaseLayer)
|
|
3180
3319
|
* )
|
|
3181
3320
|
*
|
|
3182
|
-
*
|
|
3183
|
-
* // converted into a fiber defect instead of remaining a typed error.
|
|
3321
|
+
* Effect.runSync(Effect.exit(program)) // => Exit.die(error)
|
|
3184
3322
|
* ```
|
|
3185
3323
|
*
|
|
3186
3324
|
* @category error handling
|
|
@@ -3235,7 +3373,7 @@ export {
|
|
|
3235
3373
|
*
|
|
3236
3374
|
* **Example** (Recovering from tagged layer errors)
|
|
3237
3375
|
*
|
|
3238
|
-
* ```ts
|
|
3376
|
+
* ```ts import.meta.vitest
|
|
3239
3377
|
* import { Context, Data, Effect, Layer } from "effect"
|
|
3240
3378
|
*
|
|
3241
3379
|
* class ConfigError extends Data.TaggedError("ConfigError") {}
|
|
@@ -3251,6 +3389,8 @@ export {
|
|
|
3251
3389
|
* const recovered = configLayer.pipe(
|
|
3252
3390
|
* Layer.catchTag("ConfigError", () => fallbackLayer)
|
|
3253
3391
|
* )
|
|
3392
|
+
* const program = Config.useSync((config) => config.apiUrl)
|
|
3393
|
+
* Effect.runSync(Effect.provide(program, recovered)) // => "http://localhost"
|
|
3254
3394
|
* ```
|
|
3255
3395
|
*
|
|
3256
3396
|
* @see {@link catchCause} for recovering with access to the full cause
|
|
@@ -3268,7 +3408,7 @@ export const catchTag: {
|
|
|
3268
3408
|
*
|
|
3269
3409
|
* **Example** (Recovering from tagged layer errors)
|
|
3270
3410
|
*
|
|
3271
|
-
* ```ts
|
|
3411
|
+
* ```ts import.meta.vitest
|
|
3272
3412
|
* import { Context, Data, Effect, Layer } from "effect"
|
|
3273
3413
|
*
|
|
3274
3414
|
* class ConfigError extends Data.TaggedError("ConfigError") {}
|
|
@@ -3284,6 +3424,8 @@ export const catchTag: {
|
|
|
3284
3424
|
* const recovered = configLayer.pipe(
|
|
3285
3425
|
* Layer.catchTag("ConfigError", () => fallbackLayer)
|
|
3286
3426
|
* )
|
|
3427
|
+
* const program = Config.useSync((config) => config.apiUrl)
|
|
3428
|
+
* Effect.runSync(Effect.provide(program, recovered)) // => "http://localhost"
|
|
3287
3429
|
* ```
|
|
3288
3430
|
*
|
|
3289
3431
|
* @see {@link catchCause} for recovering with access to the full cause
|
|
@@ -3312,7 +3454,7 @@ export const catchTag: {
|
|
|
3312
3454
|
*
|
|
3313
3455
|
* **Example** (Recovering from tagged layer errors)
|
|
3314
3456
|
*
|
|
3315
|
-
* ```ts
|
|
3457
|
+
* ```ts import.meta.vitest
|
|
3316
3458
|
* import { Context, Data, Effect, Layer } from "effect"
|
|
3317
3459
|
*
|
|
3318
3460
|
* class ConfigError extends Data.TaggedError("ConfigError") {}
|
|
@@ -3328,6 +3470,8 @@ export const catchTag: {
|
|
|
3328
3470
|
* const recovered = configLayer.pipe(
|
|
3329
3471
|
* Layer.catchTag("ConfigError", () => fallbackLayer)
|
|
3330
3472
|
* )
|
|
3473
|
+
* const program = Config.useSync((config) => config.apiUrl)
|
|
3474
|
+
* Effect.runSync(Effect.provide(program, recovered)) // => "http://localhost"
|
|
3331
3475
|
* ```
|
|
3332
3476
|
*
|
|
3333
3477
|
* @see {@link catchCause} for recovering with access to the full cause
|
|
@@ -3390,7 +3534,7 @@ export const catchTag: {
|
|
|
3390
3534
|
*
|
|
3391
3535
|
* **Example** (Recovering from layer failures by cause)
|
|
3392
3536
|
*
|
|
3393
|
-
* ```ts
|
|
3537
|
+
* ```ts import.meta.vitest
|
|
3394
3538
|
* import { Context, Data, Effect, Layer } from "effect"
|
|
3395
3539
|
*
|
|
3396
3540
|
* class DatabaseError extends Data.TaggedError("DatabaseError")<{
|
|
@@ -3415,14 +3559,12 @@ export const catchTag: {
|
|
|
3415
3559
|
*
|
|
3416
3560
|
* const program = Effect.gen(function*() {
|
|
3417
3561
|
* const database = yield* Database
|
|
3418
|
-
*
|
|
3419
|
-
* console.log(result)
|
|
3562
|
+
* return yield* database.query("SELECT * FROM users")
|
|
3420
3563
|
* }).pipe(
|
|
3421
3564
|
* Effect.provide(databaseWithFallback)
|
|
3422
3565
|
* )
|
|
3423
3566
|
*
|
|
3424
|
-
* Effect.runPromise(program)
|
|
3425
|
-
* // Memory: SELECT * FROM users
|
|
3567
|
+
* await Effect.runPromise(program) // => "Memory: SELECT * FROM users"
|
|
3426
3568
|
* ```
|
|
3427
3569
|
*
|
|
3428
3570
|
* @see {@link catchTag} for recovering from specific tagged errors
|
|
@@ -3448,7 +3590,7 @@ export const catchCause: {
|
|
|
3448
3590
|
*
|
|
3449
3591
|
* **Example** (Recovering from layer failures by cause)
|
|
3450
3592
|
*
|
|
3451
|
-
* ```ts
|
|
3593
|
+
* ```ts import.meta.vitest
|
|
3452
3594
|
* import { Context, Data, Effect, Layer } from "effect"
|
|
3453
3595
|
*
|
|
3454
3596
|
* class DatabaseError extends Data.TaggedError("DatabaseError")<{
|
|
@@ -3473,14 +3615,12 @@ export const catchCause: {
|
|
|
3473
3615
|
*
|
|
3474
3616
|
* const program = Effect.gen(function*() {
|
|
3475
3617
|
* const database = yield* Database
|
|
3476
|
-
*
|
|
3477
|
-
* console.log(result)
|
|
3618
|
+
* return yield* database.query("SELECT * FROM users")
|
|
3478
3619
|
* }).pipe(
|
|
3479
3620
|
* Effect.provide(databaseWithFallback)
|
|
3480
3621
|
* )
|
|
3481
3622
|
*
|
|
3482
|
-
* Effect.runPromise(program)
|
|
3483
|
-
* // Memory: SELECT * FROM users
|
|
3623
|
+
* await Effect.runPromise(program) // => "Memory: SELECT * FROM users"
|
|
3484
3624
|
* ```
|
|
3485
3625
|
*
|
|
3486
3626
|
* @see {@link catchTag} for recovering from specific tagged errors
|
|
@@ -3506,7 +3646,7 @@ export const catchCause: {
|
|
|
3506
3646
|
*
|
|
3507
3647
|
* **Example** (Recovering from layer failures by cause)
|
|
3508
3648
|
*
|
|
3509
|
-
* ```ts
|
|
3649
|
+
* ```ts import.meta.vitest
|
|
3510
3650
|
* import { Context, Data, Effect, Layer } from "effect"
|
|
3511
3651
|
*
|
|
3512
3652
|
* class DatabaseError extends Data.TaggedError("DatabaseError")<{
|
|
@@ -3531,14 +3671,12 @@ export const catchCause: {
|
|
|
3531
3671
|
*
|
|
3532
3672
|
* const program = Effect.gen(function*() {
|
|
3533
3673
|
* const database = yield* Database
|
|
3534
|
-
*
|
|
3535
|
-
* console.log(result)
|
|
3674
|
+
* return yield* database.query("SELECT * FROM users")
|
|
3536
3675
|
* }).pipe(
|
|
3537
3676
|
* Effect.provide(databaseWithFallback)
|
|
3538
3677
|
* )
|
|
3539
3678
|
*
|
|
3540
|
-
* Effect.runPromise(program)
|
|
3541
|
-
* // Memory: SELECT * FROM users
|
|
3679
|
+
* await Effect.runPromise(program) // => "Memory: SELECT * FROM users"
|
|
3542
3680
|
* ```
|
|
3543
3681
|
*
|
|
3544
3682
|
* @see {@link catchTag} for recovering from specific tagged errors
|
|
@@ -3646,7 +3784,7 @@ export const updateService: {
|
|
|
3646
3784
|
*
|
|
3647
3785
|
* **Example** (Creating non-shared layer instances)
|
|
3648
3786
|
*
|
|
3649
|
-
* ```ts
|
|
3787
|
+
* ```ts import.meta.vitest
|
|
3650
3788
|
* import { Context, Effect, Layer, Ref } from "effect"
|
|
3651
3789
|
*
|
|
3652
3790
|
* class Counter extends Context.Service<Counter, {
|
|
@@ -3671,10 +3809,10 @@ export const updateService: {
|
|
|
3671
3809
|
* return { counterId: counter.id }
|
|
3672
3810
|
* }))
|
|
3673
3811
|
*
|
|
3674
|
-
* const
|
|
3812
|
+
* const compareIds = Effect.gen(function*() {
|
|
3675
3813
|
* const left = yield* Left
|
|
3676
3814
|
* const right = yield* Right
|
|
3677
|
-
*
|
|
3815
|
+
* return left.counterId === right.counterId
|
|
3678
3816
|
* })
|
|
3679
3817
|
*
|
|
3680
3818
|
* const program = Effect.gen(function*() {
|
|
@@ -3682,7 +3820,6 @@ export const updateService: {
|
|
|
3682
3820
|
*
|
|
3683
3821
|
* const counterLayer = Layer.effect(Counter, Effect.gen(function*() {
|
|
3684
3822
|
* const id = yield* Ref.updateAndGet(nextId, (n) => n + 1)
|
|
3685
|
-
* console.log("constructed Counter")
|
|
3686
3823
|
* return { id }
|
|
3687
3824
|
* }))
|
|
3688
3825
|
*
|
|
@@ -3691,7 +3828,7 @@ export const updateService: {
|
|
|
3691
3828
|
* Layer.provide(rightLayer, counterLayer)
|
|
3692
3829
|
* )
|
|
3693
3830
|
*
|
|
3694
|
-
* yield* Effect.provide(
|
|
3831
|
+
* const sharedResult = yield* Effect.provide(compareIds, shared)
|
|
3695
3832
|
*
|
|
3696
3833
|
* const freshCounterLayer = Layer.fresh(counterLayer)
|
|
3697
3834
|
* const fresh = Layer.merge(
|
|
@@ -3699,15 +3836,12 @@ export const updateService: {
|
|
|
3699
3836
|
* Layer.provide(rightLayer, freshCounterLayer)
|
|
3700
3837
|
* )
|
|
3701
3838
|
*
|
|
3702
|
-
* yield* Effect.provide(
|
|
3839
|
+
* const freshResult = yield* Effect.provide(compareIds, fresh)
|
|
3840
|
+
*
|
|
3841
|
+
* return { shared: sharedResult, fresh: freshResult }
|
|
3703
3842
|
* })
|
|
3704
3843
|
*
|
|
3705
|
-
* Effect.runPromise(program)
|
|
3706
|
-
* // constructed Counter
|
|
3707
|
-
* // same Counter: true
|
|
3708
|
-
* // constructed Counter
|
|
3709
|
-
* // constructed Counter
|
|
3710
|
-
* // same Counter: false
|
|
3844
|
+
* await Effect.runPromise(program) // => { shared: true, fresh: false }
|
|
3711
3845
|
* ```
|
|
3712
3846
|
*
|
|
3713
3847
|
* @category layers
|
|
@@ -3731,50 +3865,30 @@ export const fresh = <A, E, R>(self: Layer<A, E, R>): Layer<A, E, R> =>
|
|
|
3731
3865
|
*
|
|
3732
3866
|
* **Example** (Launching an application layer)
|
|
3733
3867
|
*
|
|
3734
|
-
* ```ts
|
|
3735
|
-
* import {
|
|
3868
|
+
* ```ts import.meta.vitest
|
|
3869
|
+
* import { Context, Deferred, Effect, Fiber, Layer, Ref } from "effect"
|
|
3736
3870
|
*
|
|
3737
3871
|
* class HttpServer extends Context.Service<HttpServer, {
|
|
3738
|
-
* readonly
|
|
3739
|
-
* readonly stop: () => Effect.Effect<string>
|
|
3872
|
+
* readonly port: number
|
|
3740
3873
|
* }>()("HttpServer") {}
|
|
3741
3874
|
*
|
|
3742
|
-
*
|
|
3743
|
-
*
|
|
3744
|
-
*
|
|
3745
|
-
*
|
|
3746
|
-
* // Server layer that starts an HTTP server
|
|
3747
|
-
* const serverLayer = Layer.effect(HttpServer, Effect.gen(function*() {
|
|
3748
|
-
* yield* Console.log("Starting HTTP server...")
|
|
3875
|
+
* const program = Effect.gen(function*() {
|
|
3876
|
+
* const events = yield* Ref.make<Array<string>>([])
|
|
3877
|
+
* const started = yield* Deferred.make<void>()
|
|
3749
3878
|
*
|
|
3750
|
-
*
|
|
3751
|
-
*
|
|
3752
|
-
*
|
|
3753
|
-
*
|
|
3754
|
-
*
|
|
3755
|
-
* stop: Effect.fn("HttpServer.stop")(function*() {
|
|
3756
|
-
* yield* Console.log("Server stopped gracefully")
|
|
3757
|
-
* return "Server stopped"
|
|
3758
|
-
* })
|
|
3759
|
-
* }
|
|
3760
|
-
* }))
|
|
3879
|
+
* const serverLayer = Layer.effect(HttpServer, Effect.gen(function*() {
|
|
3880
|
+
* yield* Ref.update(events, (events) => [...events, "Starting HTTP server..."])
|
|
3881
|
+
* yield* Deferred.succeed(started, undefined)
|
|
3882
|
+
* return { port: 3000 }
|
|
3883
|
+
* }))
|
|
3761
3884
|
*
|
|
3762
|
-
*
|
|
3763
|
-
*
|
|
3885
|
+
* const fiber = yield* Effect.forkChild(Layer.launch(serverLayer))
|
|
3886
|
+
* yield* Deferred.await(started)
|
|
3887
|
+
* yield* Fiber.interrupt(fiber)
|
|
3888
|
+
* return yield* Ref.get(events)
|
|
3764
3889
|
* })
|
|
3765
3890
|
*
|
|
3766
|
-
* //
|
|
3767
|
-
* const appLayer = Layer.mergeAll(serverLayer, loggerLayer)
|
|
3768
|
-
*
|
|
3769
|
-
* // Launch the application - runs until interrupted
|
|
3770
|
-
* const application = appLayer.pipe(
|
|
3771
|
-
* Layer.launch,
|
|
3772
|
-
* Effect.tapError((error) => Console.log(`Application failed: ${error}`)),
|
|
3773
|
-
* Effect.tap(() => Console.log("Application completed"))
|
|
3774
|
-
* )
|
|
3775
|
-
*
|
|
3776
|
-
* // This will run forever until externally interrupted
|
|
3777
|
-
* // Effect.runFork(application)
|
|
3891
|
+
* await Effect.runPromise(program) // => ["Starting HTTP server..."]
|
|
3778
3892
|
* ```
|
|
3779
3893
|
*
|
|
3780
3894
|
* @category converting
|
|
@@ -3835,7 +3949,7 @@ type AnyEffectOrStream =
|
|
|
3835
3949
|
*
|
|
3836
3950
|
* **Example** (Mocking services for tests)
|
|
3837
3951
|
*
|
|
3838
|
-
* ```ts
|
|
3952
|
+
* ```ts import.meta.vitest
|
|
3839
3953
|
* import { Context, Effect, Layer } from "effect"
|
|
3840
3954
|
*
|
|
3841
3955
|
* class UserService extends Context.Service<UserService, {
|
|
@@ -3863,13 +3977,15 @@ type AnyEffectOrStream =
|
|
|
3863
3977
|
*
|
|
3864
3978
|
* // This works - we provided an implementation
|
|
3865
3979
|
* const user = yield* userService.getUser("123")
|
|
3866
|
-
* console.log(user.name) // "Test User"
|
|
3867
3980
|
*
|
|
3868
3981
|
* // This would throw - we didn't implement deleteUser
|
|
3869
3982
|
* // yield* userService.deleteUser("123") // UnimplementedError
|
|
3983
|
+
*
|
|
3984
|
+
* return user.name
|
|
3870
3985
|
* }).pipe(
|
|
3871
3986
|
* Effect.provide(testUserLayer)
|
|
3872
3987
|
* )
|
|
3988
|
+
* Effect.runSync(testProgram) // => "Test User"
|
|
3873
3989
|
* ```
|
|
3874
3990
|
*
|
|
3875
3991
|
* @category testing
|
|
@@ -3891,7 +4007,7 @@ export const mock: {
|
|
|
3891
4007
|
*
|
|
3892
4008
|
* **Example** (Mocking services for tests)
|
|
3893
4009
|
*
|
|
3894
|
-
* ```ts
|
|
4010
|
+
* ```ts import.meta.vitest
|
|
3895
4011
|
* import { Context, Effect, Layer } from "effect"
|
|
3896
4012
|
*
|
|
3897
4013
|
* class UserService extends Context.Service<UserService, {
|
|
@@ -3919,13 +4035,15 @@ export const mock: {
|
|
|
3919
4035
|
*
|
|
3920
4036
|
* // This works - we provided an implementation
|
|
3921
4037
|
* const user = yield* userService.getUser("123")
|
|
3922
|
-
* console.log(user.name) // "Test User"
|
|
3923
4038
|
*
|
|
3924
4039
|
* // This would throw - we didn't implement deleteUser
|
|
3925
4040
|
* // yield* userService.deleteUser("123") // UnimplementedError
|
|
4041
|
+
*
|
|
4042
|
+
* return user.name
|
|
3926
4043
|
* }).pipe(
|
|
3927
4044
|
* Effect.provide(testUserLayer)
|
|
3928
4045
|
* )
|
|
4046
|
+
* Effect.runSync(testProgram) // => "Test User"
|
|
3929
4047
|
* ```
|
|
3930
4048
|
*
|
|
3931
4049
|
* @category testing
|
|
@@ -3947,7 +4065,7 @@ export const mock: {
|
|
|
3947
4065
|
*
|
|
3948
4066
|
* **Example** (Mocking services for tests)
|
|
3949
4067
|
*
|
|
3950
|
-
* ```ts
|
|
4068
|
+
* ```ts import.meta.vitest
|
|
3951
4069
|
* import { Context, Effect, Layer } from "effect"
|
|
3952
4070
|
*
|
|
3953
4071
|
* class UserService extends Context.Service<UserService, {
|
|
@@ -3975,13 +4093,15 @@ export const mock: {
|
|
|
3975
4093
|
*
|
|
3976
4094
|
* // This works - we provided an implementation
|
|
3977
4095
|
* const user = yield* userService.getUser("123")
|
|
3978
|
-
* console.log(user.name) // "Test User"
|
|
3979
4096
|
*
|
|
3980
4097
|
* // This would throw - we didn't implement deleteUser
|
|
3981
4098
|
* // yield* userService.deleteUser("123") // UnimplementedError
|
|
4099
|
+
*
|
|
4100
|
+
* return user.name
|
|
3982
4101
|
* }).pipe(
|
|
3983
4102
|
* Effect.provide(testUserLayer)
|
|
3984
4103
|
* )
|
|
4104
|
+
* Effect.runSync(testProgram) // => "Test User"
|
|
3985
4105
|
* ```
|
|
3986
4106
|
*
|
|
3987
4107
|
* @category testing
|
|
@@ -4055,22 +4175,17 @@ const ChannelTypeId: Channel.TypeId = "~effect/Channel"
|
|
|
4055
4175
|
*
|
|
4056
4176
|
* **Example** (Constraining layer success types)
|
|
4057
4177
|
*
|
|
4058
|
-
* ```ts
|
|
4059
|
-
* import { Layer } from "effect"
|
|
4178
|
+
* ```ts import.meta.vitest
|
|
4179
|
+
* import { Context, Layer } from "effect"
|
|
4060
4180
|
*
|
|
4061
|
-
*
|
|
4062
|
-
*
|
|
4181
|
+
* const NumberService = Context.Service<number>("Number")
|
|
4182
|
+
* const numberLayer = Layer.succeed(NumberService, 42)
|
|
4063
4183
|
*
|
|
4064
4184
|
* // Define a constraint that the success type must be a number
|
|
4065
4185
|
* const satisfiesNumber = Layer.satisfiesSuccessType<number>()
|
|
4066
4186
|
*
|
|
4067
4187
|
* // This works - Layer<42, never, never> extends Layer<number, never, never>
|
|
4068
|
-
* const validLayer = satisfiesNumber(
|
|
4069
|
-
*
|
|
4070
|
-
* // This would cause a TypeScript compilation error:
|
|
4071
|
-
* // const invalidLayer = satisfiesNumber(StringLayer)
|
|
4072
|
-
* // ^^^^^^^^^^^
|
|
4073
|
-
* // Type 'string' is not assignable to type 'number'
|
|
4188
|
+
* const validLayer = satisfiesNumber(numberLayer)
|
|
4074
4189
|
* ```
|
|
4075
4190
|
*
|
|
4076
4191
|
* @category utility types
|
|
@@ -4089,23 +4204,16 @@ export const satisfiesSuccessType =
|
|
|
4089
4204
|
*
|
|
4090
4205
|
* **Example** (Constraining layer error types)
|
|
4091
4206
|
*
|
|
4092
|
-
* ```ts
|
|
4093
|
-
* import { Layer } from "effect"
|
|
4207
|
+
* ```ts import.meta.vitest
|
|
4208
|
+
* import { Effect, Layer } from "effect"
|
|
4094
4209
|
*
|
|
4095
|
-
*
|
|
4096
|
-
* declare const TypeErrorLayer: Layer.Layer<never, TypeError, never>
|
|
4097
|
-
* declare const StringLayer: Layer.Layer<never, string, never>
|
|
4210
|
+
* const typeErrorLayer = Layer.effectDiscard(Effect.fail(new TypeError("boom")))
|
|
4098
4211
|
*
|
|
4099
4212
|
* // Define a constraint that the error type must be an Error
|
|
4100
4213
|
* const satisfiesError = Layer.satisfiesErrorType<Error>()
|
|
4101
4214
|
*
|
|
4102
4215
|
* // This works - Layer<never, TypeError, never> extends Layer<never, Error, never>
|
|
4103
|
-
* const validLayer = satisfiesError(
|
|
4104
|
-
*
|
|
4105
|
-
* // This would cause a TypeScript compilation error:
|
|
4106
|
-
* // const invalidLayer = satisfiesError(StringLayer)
|
|
4107
|
-
* // ^^^^^^^^^^^
|
|
4108
|
-
* // Type 'string' is not assignable to type 'Error'
|
|
4216
|
+
* const validLayer = satisfiesError(typeErrorLayer)
|
|
4109
4217
|
* ```
|
|
4110
4218
|
*
|
|
4111
4219
|
* @category utility types
|
|
@@ -4124,22 +4232,17 @@ export const satisfiesErrorType =
|
|
|
4124
4232
|
*
|
|
4125
4233
|
* **Example** (Constraining layer service requirements)
|
|
4126
4234
|
*
|
|
4127
|
-
* ```ts
|
|
4128
|
-
* import { Layer } from "effect"
|
|
4235
|
+
* ```ts import.meta.vitest
|
|
4236
|
+
* import { Context, Effect, Layer } from "effect"
|
|
4129
4237
|
*
|
|
4130
|
-
*
|
|
4131
|
-
*
|
|
4238
|
+
* const NumberService = Context.Service<number>("Number")
|
|
4239
|
+
* const numberLayer = Layer.effectDiscard(Effect.asVoid(NumberService))
|
|
4132
4240
|
*
|
|
4133
4241
|
* // Define a constraint that the service requirements must be numbers
|
|
4134
4242
|
* const satisfiesNumber = Layer.satisfiesServicesType<number>()
|
|
4135
4243
|
*
|
|
4136
4244
|
* // This works - Layer<never, never, 42> extends Layer<never, never, number>
|
|
4137
|
-
* const validLayer = satisfiesNumber(
|
|
4138
|
-
*
|
|
4139
|
-
* // This would cause a TypeScript compilation error:
|
|
4140
|
-
* // const invalidLayer = satisfiesNumber(StringLayer)
|
|
4141
|
-
* // ^^^^^^^^^^^
|
|
4142
|
-
* // Type 'string' is not assignable to type 'number'
|
|
4245
|
+
* const validLayer = satisfiesNumber(numberLayer)
|
|
4143
4246
|
* ```
|
|
4144
4247
|
*
|
|
4145
4248
|
* @category utility types
|
|
@@ -4197,38 +4300,37 @@ export interface SpanOptions extends Tracer.SpanOptions {
|
|
|
4197
4300
|
*
|
|
4198
4301
|
* **Example** (Tracing layer construction with a span)
|
|
4199
4302
|
*
|
|
4200
|
-
* ```ts
|
|
4201
|
-
* import {
|
|
4303
|
+
* ```ts import.meta.vitest
|
|
4304
|
+
* import { Context, Effect, Layer } from "effect"
|
|
4202
4305
|
* import type { Tracer } from "effect"
|
|
4203
4306
|
*
|
|
4204
4307
|
* class Database extends Context.Service<Database, {
|
|
4205
4308
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
4206
4309
|
* }>()("Database") {}
|
|
4207
4310
|
*
|
|
4311
|
+
* const logs: Array<string> = []
|
|
4312
|
+
*
|
|
4208
4313
|
* // Create a traced layer - all operations performed during construction of
|
|
4209
4314
|
* // the `Database` service are part of the "database-init" span
|
|
4210
4315
|
* const databaseLayer = Layer.effect(Database, Effect.gen(function*() {
|
|
4211
4316
|
* // These operations are traced under "database-init" span
|
|
4212
|
-
*
|
|
4213
|
-
*
|
|
4214
|
-
* yield* Effect.log("Database connected")
|
|
4317
|
+
* logs.push("Connecting to database")
|
|
4318
|
+
* logs.push("Database connected")
|
|
4215
4319
|
*
|
|
4216
4320
|
* const parentSpan = yield* Effect.currentParentSpan
|
|
4217
|
-
*
|
|
4321
|
+
* logs.push((parentSpan as Tracer.Span).name)
|
|
4218
4322
|
*
|
|
4219
4323
|
* return {
|
|
4220
4324
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result: ${sql}`))
|
|
4221
4325
|
* }
|
|
4222
|
-
* })).pipe(Layer.provide(Layer.span("database-init"
|
|
4223
|
-
*
|
|
4224
|
-
* // Can also use the `onEnd` callback to execute logic when the span ends
|
|
4225
|
-
* const tracedLayer = Layer.span("service-initialization", {
|
|
4226
|
-
* attributes: { version: "1.0.0" },
|
|
4326
|
+
* })).pipe(Layer.provide(Layer.span("database-init", {
|
|
4227
4327
|
* onEnd: (span, exit) =>
|
|
4228
|
-
* Effect.sync(() => {
|
|
4229
|
-
*
|
|
4230
|
-
*
|
|
4231
|
-
*
|
|
4328
|
+
* Effect.sync(() => logs.push(`Span ${span.name} ended with: ${exit._tag}`))
|
|
4329
|
+
* })))
|
|
4330
|
+
*
|
|
4331
|
+
* const program = Database.use((database) => database.query("SELECT 1"))
|
|
4332
|
+
* Effect.runSync(Effect.provide(program, databaseLayer)) // => "Result: SELECT 1"
|
|
4333
|
+
* logs // => ["Connecting to database", "Database connected", "database-init", "Span database-init ended with: Success"]
|
|
4232
4334
|
* ```
|
|
4233
4335
|
*
|
|
4234
4336
|
* @category tracing
|
|
@@ -4261,10 +4363,11 @@ export const span = (
|
|
|
4261
4363
|
*
|
|
4262
4364
|
* **Example** (Referencing an existing parent span)
|
|
4263
4365
|
*
|
|
4264
|
-
* ```ts
|
|
4265
|
-
* import {
|
|
4366
|
+
* ```ts import.meta.vitest
|
|
4367
|
+
* import { Context, Effect, Layer, Tracer } from "effect"
|
|
4266
4368
|
*
|
|
4267
4369
|
* class Database extends Context.Service<Database, {
|
|
4370
|
+
* readonly spanId: string
|
|
4268
4371
|
* readonly query: (sql: string) => Effect.Effect<string>
|
|
4269
4372
|
* }>()("Database") {}
|
|
4270
4373
|
*
|
|
@@ -4272,12 +4375,10 @@ export const span = (
|
|
|
4272
4375
|
* const databaseLayer = Layer.effect(
|
|
4273
4376
|
* Database,
|
|
4274
4377
|
* Effect.gen(function*() {
|
|
4275
|
-
* yield* Effect.log("Initializing database")
|
|
4276
|
-
*
|
|
4277
4378
|
* const parentSpan = yield* Effect.currentParentSpan
|
|
4278
|
-
* yield* Console.log(parentSpan.spanId) // "42"
|
|
4279
4379
|
*
|
|
4280
4380
|
* return {
|
|
4381
|
+
* spanId: parentSpan.spanId,
|
|
4281
4382
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result: ${sql}`))
|
|
4282
4383
|
* }
|
|
4283
4384
|
* })
|
|
@@ -4285,6 +4386,9 @@ export const span = (
|
|
|
4285
4386
|
* spanId: "42",
|
|
4286
4387
|
* traceId: "000"
|
|
4287
4388
|
* }))))
|
|
4389
|
+
* const program = Database.use((database) =>
|
|
4390
|
+
* Effect.map(database.query("SELECT 1"), (result) => ({ spanId: database.spanId, result })))
|
|
4391
|
+
* Effect.runSync(Effect.provide(program, databaseLayer)) // => { spanId: "42", result: "Result: SELECT 1" }
|
|
4288
4392
|
* ```
|
|
4289
4393
|
*
|
|
4290
4394
|
* @category tracing
|
|
@@ -4305,7 +4409,7 @@ export const parentSpan = (span: Tracer.AnySpan): Layer<Tracer.ParentSpan> =>
|
|
|
4305
4409
|
*
|
|
4306
4410
|
* **Example** (Wrapping a layer with a span)
|
|
4307
4411
|
*
|
|
4308
|
-
* ```ts
|
|
4412
|
+
* ```ts import.meta.vitest
|
|
4309
4413
|
* import { Context, Effect, Layer } from "effect"
|
|
4310
4414
|
*
|
|
4311
4415
|
* class Database extends Context.Service<Database, {
|
|
@@ -4316,10 +4420,10 @@ export const parentSpan = (span: Tracer.AnySpan): Layer<Tracer.ParentSpan> =>
|
|
|
4316
4420
|
* readonly log: (msg: string) => Effect.Effect<void>
|
|
4317
4421
|
* }>()("Logger") {}
|
|
4318
4422
|
*
|
|
4423
|
+
* const logs: Array<string> = []
|
|
4424
|
+
*
|
|
4319
4425
|
* // Create layers with tracing
|
|
4320
4426
|
* const databaseLayer = Layer.effect(Database, Effect.gen(function*() {
|
|
4321
|
-
* yield* Effect.log("Connecting to database")
|
|
4322
|
-
* yield* Effect.sleep("100 millis")
|
|
4323
4427
|
* return {
|
|
4324
4428
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result: ${sql}`))
|
|
4325
4429
|
* }
|
|
@@ -4328,16 +4432,14 @@ export const parentSpan = (span: Tracer.AnySpan): Layer<Tracer.ParentSpan> =>
|
|
|
4328
4432
|
* }))
|
|
4329
4433
|
*
|
|
4330
4434
|
* const loggerLayer = Layer.succeed(Logger, {
|
|
4331
|
-
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() =>
|
|
4435
|
+
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => logs.push(msg)))
|
|
4332
4436
|
* }).pipe(Layer.withSpan("logger-initialization"))
|
|
4333
4437
|
*
|
|
4334
4438
|
* // Combine traced layers
|
|
4335
4439
|
* const appLayer = Layer.mergeAll(databaseLayer, loggerLayer).pipe(
|
|
4336
4440
|
* Layer.withSpan("app-initialization", {
|
|
4337
4441
|
* onEnd: (span, exit) =>
|
|
4338
|
-
* Effect.sync(() => {
|
|
4339
|
-
* console.log(`Application initialization completed: ${exit._tag}`)
|
|
4340
|
-
* })
|
|
4442
|
+
* Effect.sync(() => logs.push(`Application initialization completed: ${exit._tag}`))
|
|
4341
4443
|
* })
|
|
4342
4444
|
* )
|
|
4343
4445
|
*
|
|
@@ -4348,6 +4450,8 @@ export const parentSpan = (span: Tracer.AnySpan): Layer<Tracer.ParentSpan> =>
|
|
|
4348
4450
|
* yield* logger.log("Application ready")
|
|
4349
4451
|
* return yield* database.query("SELECT * FROM users")
|
|
4350
4452
|
* }).pipe(Effect.provide(appLayer))
|
|
4453
|
+
* Effect.runSync(program) // => "Result: SELECT * FROM users"
|
|
4454
|
+
* logs // => ["Application ready", "Application initialization completed: Success"]
|
|
4351
4455
|
* ```
|
|
4352
4456
|
*
|
|
4353
4457
|
* @category tracing
|
|
@@ -4366,7 +4470,7 @@ export const withSpan: {
|
|
|
4366
4470
|
*
|
|
4367
4471
|
* **Example** (Wrapping a layer with a span)
|
|
4368
4472
|
*
|
|
4369
|
-
* ```ts
|
|
4473
|
+
* ```ts import.meta.vitest
|
|
4370
4474
|
* import { Context, Effect, Layer } from "effect"
|
|
4371
4475
|
*
|
|
4372
4476
|
* class Database extends Context.Service<Database, {
|
|
@@ -4377,10 +4481,10 @@ export const withSpan: {
|
|
|
4377
4481
|
* readonly log: (msg: string) => Effect.Effect<void>
|
|
4378
4482
|
* }>()("Logger") {}
|
|
4379
4483
|
*
|
|
4484
|
+
* const logs: Array<string> = []
|
|
4485
|
+
*
|
|
4380
4486
|
* // Create layers with tracing
|
|
4381
4487
|
* const databaseLayer = Layer.effect(Database, Effect.gen(function*() {
|
|
4382
|
-
* yield* Effect.log("Connecting to database")
|
|
4383
|
-
* yield* Effect.sleep("100 millis")
|
|
4384
4488
|
* return {
|
|
4385
4489
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result: ${sql}`))
|
|
4386
4490
|
* }
|
|
@@ -4389,16 +4493,14 @@ export const withSpan: {
|
|
|
4389
4493
|
* }))
|
|
4390
4494
|
*
|
|
4391
4495
|
* const loggerLayer = Layer.succeed(Logger, {
|
|
4392
|
-
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() =>
|
|
4496
|
+
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => logs.push(msg)))
|
|
4393
4497
|
* }).pipe(Layer.withSpan("logger-initialization"))
|
|
4394
4498
|
*
|
|
4395
4499
|
* // Combine traced layers
|
|
4396
4500
|
* const appLayer = Layer.mergeAll(databaseLayer, loggerLayer).pipe(
|
|
4397
4501
|
* Layer.withSpan("app-initialization", {
|
|
4398
4502
|
* onEnd: (span, exit) =>
|
|
4399
|
-
* Effect.sync(() => {
|
|
4400
|
-
* console.log(`Application initialization completed: ${exit._tag}`)
|
|
4401
|
-
* })
|
|
4503
|
+
* Effect.sync(() => logs.push(`Application initialization completed: ${exit._tag}`))
|
|
4402
4504
|
* })
|
|
4403
4505
|
* )
|
|
4404
4506
|
*
|
|
@@ -4409,6 +4511,8 @@ export const withSpan: {
|
|
|
4409
4511
|
* yield* logger.log("Application ready")
|
|
4410
4512
|
* return yield* database.query("SELECT * FROM users")
|
|
4411
4513
|
* }).pipe(Effect.provide(appLayer))
|
|
4514
|
+
* Effect.runSync(program) // => "Result: SELECT * FROM users"
|
|
4515
|
+
* logs // => ["Application ready", "Application initialization completed: Success"]
|
|
4412
4516
|
* ```
|
|
4413
4517
|
*
|
|
4414
4518
|
* @category tracing
|
|
@@ -4429,7 +4533,7 @@ export const withSpan: {
|
|
|
4429
4533
|
*
|
|
4430
4534
|
* **Example** (Wrapping a layer with a span)
|
|
4431
4535
|
*
|
|
4432
|
-
* ```ts
|
|
4536
|
+
* ```ts import.meta.vitest
|
|
4433
4537
|
* import { Context, Effect, Layer } from "effect"
|
|
4434
4538
|
*
|
|
4435
4539
|
* class Database extends Context.Service<Database, {
|
|
@@ -4440,10 +4544,10 @@ export const withSpan: {
|
|
|
4440
4544
|
* readonly log: (msg: string) => Effect.Effect<void>
|
|
4441
4545
|
* }>()("Logger") {}
|
|
4442
4546
|
*
|
|
4547
|
+
* const logs: Array<string> = []
|
|
4548
|
+
*
|
|
4443
4549
|
* // Create layers with tracing
|
|
4444
4550
|
* const databaseLayer = Layer.effect(Database, Effect.gen(function*() {
|
|
4445
|
-
* yield* Effect.log("Connecting to database")
|
|
4446
|
-
* yield* Effect.sleep("100 millis")
|
|
4447
4551
|
* return {
|
|
4448
4552
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`Result: ${sql}`))
|
|
4449
4553
|
* }
|
|
@@ -4452,16 +4556,14 @@ export const withSpan: {
|
|
|
4452
4556
|
* }))
|
|
4453
4557
|
*
|
|
4454
4558
|
* const loggerLayer = Layer.succeed(Logger, {
|
|
4455
|
-
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() =>
|
|
4559
|
+
* log: Effect.fn("Logger.log")((msg: string) => Effect.sync(() => logs.push(msg)))
|
|
4456
4560
|
* }).pipe(Layer.withSpan("logger-initialization"))
|
|
4457
4561
|
*
|
|
4458
4562
|
* // Combine traced layers
|
|
4459
4563
|
* const appLayer = Layer.mergeAll(databaseLayer, loggerLayer).pipe(
|
|
4460
4564
|
* Layer.withSpan("app-initialization", {
|
|
4461
4565
|
* onEnd: (span, exit) =>
|
|
4462
|
-
* Effect.sync(() => {
|
|
4463
|
-
* console.log(`Application initialization completed: ${exit._tag}`)
|
|
4464
|
-
* })
|
|
4566
|
+
* Effect.sync(() => logs.push(`Application initialization completed: ${exit._tag}`))
|
|
4465
4567
|
* })
|
|
4466
4568
|
* )
|
|
4467
4569
|
*
|
|
@@ -4472,6 +4574,8 @@ export const withSpan: {
|
|
|
4472
4574
|
* yield* logger.log("Application ready")
|
|
4473
4575
|
* return yield* database.query("SELECT * FROM users")
|
|
4474
4576
|
* }).pipe(Effect.provide(appLayer))
|
|
4577
|
+
* Effect.runSync(program) // => "Result: SELECT * FROM users"
|
|
4578
|
+
* logs // => ["Application ready", "Application initialization completed: Success"]
|
|
4475
4579
|
* ```
|
|
4476
4580
|
*
|
|
4477
4581
|
* @category tracing
|
|
@@ -4526,7 +4630,7 @@ export const withSpan: {
|
|
|
4526
4630
|
*
|
|
4527
4631
|
* **Example** (Attaching layers to an existing parent span)
|
|
4528
4632
|
*
|
|
4529
|
-
* ```ts
|
|
4633
|
+
* ```ts import.meta.vitest
|
|
4530
4634
|
* import { Context, Effect, Layer, Tracer } from "effect"
|
|
4531
4635
|
*
|
|
4532
4636
|
* class Database extends Context.Service<Database, {
|
|
@@ -4539,14 +4643,12 @@ export const withSpan: {
|
|
|
4539
4643
|
*
|
|
4540
4644
|
* // Create layers
|
|
4541
4645
|
* const DatabaseLayer = Layer.effect(Database, Effect.gen(function*() {
|
|
4542
|
-
* yield* Effect.log("Connecting to database")
|
|
4543
4646
|
* return {
|
|
4544
4647
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`DB: ${sql}`))
|
|
4545
4648
|
* }
|
|
4546
4649
|
* }))
|
|
4547
4650
|
*
|
|
4548
4651
|
* const CacheLayer = Layer.effect(Cache, Effect.gen(function*() {
|
|
4549
|
-
* yield* Effect.log("Connecting to cache")
|
|
4550
4652
|
* return {
|
|
4551
4653
|
* get: Effect.fn("Cache.get")((key: string) => Effect.succeed(`Cache: ${key}`))
|
|
4552
4654
|
* }
|
|
@@ -4572,6 +4674,7 @@ export const withSpan: {
|
|
|
4572
4674
|
* return { dbResult, cacheResult }
|
|
4573
4675
|
* })
|
|
4574
4676
|
* )
|
|
4677
|
+
* Effect.runSync(Effect.scoped(program)) // => { dbResult: "DB: SELECT * FROM users", cacheResult: "Cache: user:123" }
|
|
4575
4678
|
* ```
|
|
4576
4679
|
*
|
|
4577
4680
|
* @category tracing
|
|
@@ -4594,7 +4697,7 @@ export const withParentSpan: {
|
|
|
4594
4697
|
*
|
|
4595
4698
|
* **Example** (Attaching layers to an existing parent span)
|
|
4596
4699
|
*
|
|
4597
|
-
* ```ts
|
|
4700
|
+
* ```ts import.meta.vitest
|
|
4598
4701
|
* import { Context, Effect, Layer, Tracer } from "effect"
|
|
4599
4702
|
*
|
|
4600
4703
|
* class Database extends Context.Service<Database, {
|
|
@@ -4607,14 +4710,12 @@ export const withParentSpan: {
|
|
|
4607
4710
|
*
|
|
4608
4711
|
* // Create layers
|
|
4609
4712
|
* const DatabaseLayer = Layer.effect(Database, Effect.gen(function*() {
|
|
4610
|
-
* yield* Effect.log("Connecting to database")
|
|
4611
4713
|
* return {
|
|
4612
4714
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`DB: ${sql}`))
|
|
4613
4715
|
* }
|
|
4614
4716
|
* }))
|
|
4615
4717
|
*
|
|
4616
4718
|
* const CacheLayer = Layer.effect(Cache, Effect.gen(function*() {
|
|
4617
|
-
* yield* Effect.log("Connecting to cache")
|
|
4618
4719
|
* return {
|
|
4619
4720
|
* get: Effect.fn("Cache.get")((key: string) => Effect.succeed(`Cache: ${key}`))
|
|
4620
4721
|
* }
|
|
@@ -4640,6 +4741,7 @@ export const withParentSpan: {
|
|
|
4640
4741
|
* return { dbResult, cacheResult }
|
|
4641
4742
|
* })
|
|
4642
4743
|
* )
|
|
4744
|
+
* Effect.runSync(Effect.scoped(program)) // => { dbResult: "DB: SELECT * FROM users", cacheResult: "Cache: user:123" }
|
|
4643
4745
|
* ```
|
|
4644
4746
|
*
|
|
4645
4747
|
* @category tracing
|
|
@@ -4664,7 +4766,7 @@ export const withParentSpan: {
|
|
|
4664
4766
|
*
|
|
4665
4767
|
* **Example** (Attaching layers to an existing parent span)
|
|
4666
4768
|
*
|
|
4667
|
-
* ```ts
|
|
4769
|
+
* ```ts import.meta.vitest
|
|
4668
4770
|
* import { Context, Effect, Layer, Tracer } from "effect"
|
|
4669
4771
|
*
|
|
4670
4772
|
* class Database extends Context.Service<Database, {
|
|
@@ -4677,14 +4779,12 @@ export const withParentSpan: {
|
|
|
4677
4779
|
*
|
|
4678
4780
|
* // Create layers
|
|
4679
4781
|
* const DatabaseLayer = Layer.effect(Database, Effect.gen(function*() {
|
|
4680
|
-
* yield* Effect.log("Connecting to database")
|
|
4681
4782
|
* return {
|
|
4682
4783
|
* query: Effect.fn("Database.query")((sql: string) => Effect.succeed(`DB: ${sql}`))
|
|
4683
4784
|
* }
|
|
4684
4785
|
* }))
|
|
4685
4786
|
*
|
|
4686
4787
|
* const CacheLayer = Layer.effect(Cache, Effect.gen(function*() {
|
|
4687
|
-
* yield* Effect.log("Connecting to cache")
|
|
4688
4788
|
* return {
|
|
4689
4789
|
* get: Effect.fn("Cache.get")((key: string) => Effect.succeed(`Cache: ${key}`))
|
|
4690
4790
|
* }
|
|
@@ -4710,6 +4810,7 @@ export const withParentSpan: {
|
|
|
4710
4810
|
* return { dbResult, cacheResult }
|
|
4711
4811
|
* })
|
|
4712
4812
|
* )
|
|
4813
|
+
* Effect.runSync(Effect.scoped(program)) // => { dbResult: "DB: SELECT * FROM users", cacheResult: "Cache: user:123" }
|
|
4713
4814
|
* ```
|
|
4714
4815
|
*
|
|
4715
4816
|
* @category tracing
|