effect 4.0.0-beta.66 → 4.0.0-beta.68
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 +151 -106
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +50 -40
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +620 -553
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +298 -254
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts +342 -274
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +168 -126
- package/dist/BigInt.js.map +1 -1
- package/dist/Boolean.d.ts +189 -156
- package/dist/Boolean.d.ts.map +1 -1
- package/dist/Boolean.js +85 -68
- package/dist/Boolean.js.map +1 -1
- package/dist/Brand.d.ts +30 -5
- package/dist/Brand.d.ts.map +1 -1
- package/dist/Brand.js +19 -2
- package/dist/Brand.js.map +1 -1
- package/dist/Cache.d.ts +239 -135
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +135 -59
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +84 -73
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Cause.js +51 -44
- package/dist/Cause.js.map +1 -1
- package/dist/Channel.d.ts +1568 -632
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +685 -315
- package/dist/Channel.js.map +1 -1
- package/dist/ChannelSchema.d.ts +119 -10
- package/dist/ChannelSchema.d.ts.map +1 -1
- package/dist/ChannelSchema.js +45 -6
- package/dist/ChannelSchema.js.map +1 -1
- package/dist/Chunk.d.ts +574 -428
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +250 -191
- package/dist/Chunk.js.map +1 -1
- package/dist/Clock.d.ts +16 -9
- package/dist/Clock.d.ts.map +1 -1
- package/dist/Clock.js +9 -5
- package/dist/Clock.js.map +1 -1
- package/dist/Combiner.d.ts +11 -5
- package/dist/Combiner.d.ts.map +1 -1
- package/dist/Combiner.js +10 -4
- package/dist/Combiner.js.map +1 -1
- package/dist/Config.d.ts +80 -68
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +53 -49
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +33 -32
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +19 -18
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Console.d.ts +76 -50
- package/dist/Console.d.ts.map +1 -1
- package/dist/Console.js +69 -46
- package/dist/Console.js.map +1 -1
- package/dist/Context.d.ts +400 -189
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +143 -77
- package/dist/Context.js.map +1 -1
- package/dist/Cron.d.ts +67 -48
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +94 -36
- package/dist/Cron.js.map +1 -1
- package/dist/Crypto.d.ts +208 -0
- package/dist/Crypto.d.ts.map +1 -0
- package/dist/Crypto.js +157 -0
- package/dist/Crypto.js.map +1 -0
- package/dist/Data.d.ts +9 -3
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js.map +1 -1
- package/dist/DateTime.d.ts +893 -464
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +387 -228
- package/dist/DateTime.js.map +1 -1
- package/dist/Deferred.d.ts +367 -175
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +146 -72
- package/dist/Deferred.js.map +1 -1
- package/dist/Differ.d.ts +44 -2
- package/dist/Differ.d.ts.map +1 -1
- package/dist/Differ.js +36 -0
- package/dist/Duration.d.ts +333 -186
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +178 -107
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +2181 -2275
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +935 -850
- package/dist/Effect.js.map +1 -1
- package/dist/Effectable.d.ts +38 -3
- package/dist/Effectable.d.ts.map +1 -1
- package/dist/Effectable.js +3 -3
- package/dist/Effectable.js.map +1 -1
- package/dist/Encoding.d.ts +78 -28
- package/dist/Encoding.d.ts.map +1 -1
- package/dist/Encoding.js +75 -27
- package/dist/Encoding.js.map +1 -1
- package/dist/Equal.d.ts +4 -3
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +4 -3
- package/dist/Equal.js.map +1 -1
- package/dist/Equivalence.d.ts +18 -24
- package/dist/Equivalence.d.ts.map +1 -1
- package/dist/Equivalence.js +16 -21
- package/dist/Equivalence.js.map +1 -1
- package/dist/ErrorReporter.d.ts +66 -82
- package/dist/ErrorReporter.d.ts.map +1 -1
- package/dist/ErrorReporter.js +38 -29
- package/dist/ErrorReporter.js.map +1 -1
- package/dist/ExecutionPlan.d.ts +106 -12
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/ExecutionPlan.js +23 -6
- package/dist/ExecutionPlan.js.map +1 -1
- package/dist/Exit.d.ts +6 -5
- package/dist/Exit.d.ts.map +1 -1
- package/dist/Exit.js.map +1 -1
- package/dist/Fiber.d.ts +71 -40
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js +39 -21
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +118 -57
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +121 -39
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +287 -159
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +175 -73
- package/dist/FiberMap.js.map +1 -1
- package/dist/FiberSet.d.ts +93 -52
- package/dist/FiberSet.d.ts.map +1 -1
- package/dist/FiberSet.js +97 -34
- package/dist/FiberSet.js.map +1 -1
- package/dist/FileSystem.d.ts +102 -73
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +53 -39
- package/dist/FileSystem.js.map +1 -1
- package/dist/Filter.d.ts +166 -88
- package/dist/Filter.d.ts.map +1 -1
- package/dist/Filter.js +68 -42
- package/dist/Filter.js.map +1 -1
- package/dist/Formatter.d.ts +4 -2
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +3 -69
- package/dist/Formatter.js.map +1 -1
- package/dist/Function.d.ts +218 -151
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +94 -78
- package/dist/Function.js.map +1 -1
- package/dist/Graph.d.ts +714 -415
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +325 -182
- package/dist/Graph.js.map +1 -1
- package/dist/HKT.d.ts +29 -13
- package/dist/HKT.d.ts.map +1 -1
- package/dist/Hash.d.ts +35 -24
- package/dist/Hash.d.ts.map +1 -1
- package/dist/Hash.js +27 -17
- package/dist/Hash.js.map +1 -1
- package/dist/HashMap.d.ts +540 -388
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashMap.js +262 -156
- package/dist/HashMap.js.map +1 -1
- package/dist/HashRing.d.ts +53 -34
- package/dist/HashRing.d.ts.map +1 -1
- package/dist/HashRing.js +83 -16
- package/dist/HashRing.js.map +1 -1
- package/dist/HashSet.d.ts +239 -153
- package/dist/HashSet.d.ts.map +1 -1
- package/dist/HashSet.js +110 -56
- package/dist/HashSet.js.map +1 -1
- package/dist/Inspectable.d.ts +26 -13
- package/dist/Inspectable.d.ts.map +1 -1
- package/dist/Inspectable.js +22 -10
- package/dist/Inspectable.js.map +1 -1
- package/dist/Iterable.d.ts +336 -222
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +146 -100
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonPatch.d.ts +12 -9
- package/dist/JsonPatch.d.ts.map +1 -1
- package/dist/JsonPatch.js +9 -6
- package/dist/JsonPatch.js.map +1 -1
- package/dist/JsonPointer.d.ts +13 -11
- package/dist/JsonPointer.d.ts.map +1 -1
- package/dist/JsonPointer.js +13 -11
- package/dist/JsonPointer.js.map +1 -1
- package/dist/JsonSchema.d.ts +16 -0
- package/dist/JsonSchema.d.ts.map +1 -1
- package/dist/JsonSchema.js +10 -0
- package/dist/JsonSchema.js.map +1 -1
- package/dist/Latch.d.ts +97 -26
- package/dist/Latch.d.ts.map +1 -1
- package/dist/Latch.js +39 -20
- package/dist/Latch.js.map +1 -1
- package/dist/Layer.d.ts +472 -410
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +290 -226
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +99 -26
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +58 -14
- package/dist/LayerMap.js.map +1 -1
- package/dist/LogLevel.d.ts +92 -131
- package/dist/LogLevel.d.ts.map +1 -1
- package/dist/LogLevel.js +25 -15
- package/dist/LogLevel.js.map +1 -1
- package/dist/Logger.d.ts +159 -104
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +215 -189
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +78 -19
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/ManagedRuntime.js +24 -17
- package/dist/ManagedRuntime.js.map +1 -1
- package/dist/Match.d.ts +135 -161
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js +86 -78
- package/dist/Match.js.map +1 -1
- package/dist/Metric.d.ts +330 -291
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +219 -214
- package/dist/Metric.js.map +1 -1
- package/dist/MutableHashMap.d.ts +146 -87
- package/dist/MutableHashMap.d.ts.map +1 -1
- package/dist/MutableHashMap.js +67 -43
- package/dist/MutableHashMap.js.map +1 -1
- package/dist/MutableHashSet.d.ts +52 -30
- package/dist/MutableHashSet.d.ts.map +1 -1
- package/dist/MutableHashSet.js +92 -38
- package/dist/MutableHashSet.js.map +1 -1
- package/dist/MutableList.d.ts +110 -68
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +135 -85
- package/dist/MutableList.js.map +1 -1
- package/dist/MutableRef.d.ts +99 -62
- package/dist/MutableRef.d.ts.map +1 -1
- package/dist/MutableRef.js +78 -60
- package/dist/MutableRef.js.map +1 -1
- package/dist/Newtype.d.ts +15 -2
- package/dist/Newtype.d.ts.map +1 -1
- package/dist/Newtype.js +8 -2
- package/dist/Newtype.js.map +1 -1
- package/dist/NonEmptyIterable.d.ts +38 -48
- package/dist/NonEmptyIterable.d.ts.map +1 -1
- package/dist/NonEmptyIterable.js +34 -25
- package/dist/NonEmptyIterable.js.map +1 -1
- package/dist/Number.d.ts +261 -205
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +119 -91
- package/dist/Number.js.map +1 -1
- package/dist/Optic.d.ts +6 -7
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +5 -6
- package/dist/Optic.js.map +1 -1
- package/dist/Option.d.ts +133 -156
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +64 -64
- package/dist/Option.js.map +1 -1
- package/dist/Order.d.ts +6 -6
- package/dist/Order.js +6 -6
- package/dist/Ordering.d.ts +56 -45
- package/dist/Ordering.d.ts.map +1 -1
- package/dist/Ordering.js +10 -8
- package/dist/Ordering.js.map +1 -1
- package/dist/PartitionedSemaphore.d.ts +225 -40
- package/dist/PartitionedSemaphore.d.ts.map +1 -1
- package/dist/PartitionedSemaphore.js +113 -17
- package/dist/PartitionedSemaphore.js.map +1 -1
- package/dist/Path.d.ts +77 -13
- package/dist/Path.d.ts.map +1 -1
- package/dist/Path.js +49 -4
- package/dist/Path.js.map +1 -1
- package/dist/Pipeable.d.ts +77 -18
- package/dist/Pipeable.d.ts.map +1 -1
- package/dist/Pipeable.js +63 -14
- package/dist/Pipeable.js.map +1 -1
- package/dist/PlatformError.d.ts +74 -6
- package/dist/PlatformError.d.ts.map +1 -1
- package/dist/PlatformError.js +68 -5
- package/dist/PlatformError.js.map +1 -1
- package/dist/Pool.d.ts +66 -31
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +26 -24
- package/dist/Pool.js.map +1 -1
- package/dist/Predicate.d.ts +16 -23
- package/dist/Predicate.d.ts.map +1 -1
- package/dist/Predicate.js +12 -17
- package/dist/Predicate.js.map +1 -1
- package/dist/PrimaryKey.d.ts +11 -3
- package/dist/PrimaryKey.d.ts.map +1 -1
- package/dist/PrimaryKey.js +9 -2
- package/dist/PrimaryKey.js.map +1 -1
- package/dist/PubSub.d.ts +385 -309
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +260 -207
- package/dist/PubSub.js.map +1 -1
- package/dist/Pull.d.ts +94 -25
- package/dist/Pull.d.ts.map +1 -1
- package/dist/Pull.js +61 -13
- package/dist/Pull.js.map +1 -1
- package/dist/Queue.d.ts +303 -184
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +231 -134
- package/dist/Queue.js.map +1 -1
- package/dist/Random.d.ts +65 -57
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +41 -66
- package/dist/Random.js.map +1 -1
- package/dist/RcMap.d.ts +151 -141
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +66 -20
- package/dist/RcMap.js.map +1 -1
- package/dist/RcRef.d.ts +68 -32
- package/dist/RcRef.d.ts.map +1 -1
- package/dist/RcRef.js +33 -16
- package/dist/RcRef.js.map +1 -1
- package/dist/Record.d.ts +282 -137
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +124 -62
- package/dist/Record.js.map +1 -1
- package/dist/Redactable.d.ts +7 -5
- package/dist/Redactable.d.ts.map +1 -1
- package/dist/Redactable.js +5 -3
- package/dist/Redactable.js.map +1 -1
- package/dist/Redacted.d.ts +63 -34
- package/dist/Redacted.d.ts.map +1 -1
- package/dist/Redacted.js +31 -15
- package/dist/Redacted.js.map +1 -1
- package/dist/Reducer.d.ts +3 -1
- package/dist/Reducer.d.ts.map +1 -1
- package/dist/Reducer.js +2 -0
- package/dist/Reducer.js.map +1 -1
- package/dist/Ref.d.ts +85 -66
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +57 -45
- package/dist/Ref.js.map +1 -1
- package/dist/References.d.ts +73 -31
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +66 -30
- package/dist/References.js.map +1 -1
- package/dist/RegExp.d.ts +12 -6
- package/dist/RegExp.d.ts.map +1 -1
- package/dist/RegExp.js +12 -6
- package/dist/RegExp.js.map +1 -1
- package/dist/Request.d.ts +159 -34
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js +68 -12
- package/dist/Request.js.map +1 -1
- package/dist/RequestResolver.d.ts +262 -118
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +78 -42
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Resource.d.ts +13 -7
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +44 -6
- package/dist/Resource.js.map +1 -1
- package/dist/Result.d.ts +135 -151
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +56 -68
- package/dist/Result.js.map +1 -1
- package/dist/Runtime.d.ts +40 -20
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +34 -17
- package/dist/Runtime.js.map +1 -1
- package/dist/Schedule.d.ts +556 -590
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +265 -253
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts +44 -7
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +34 -5
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +1293 -602
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +501 -361
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +122 -92
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +102 -77
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +49 -36
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +42 -29
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.d.ts +19 -24
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js +16 -14
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.d.ts +231 -63
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +266 -75
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +89 -77
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +47 -37
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +97 -46
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +89 -38
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/SchemaUtils.d.ts +8 -1
- package/dist/SchemaUtils.d.ts.map +1 -1
- package/dist/SchemaUtils.js +24 -1
- package/dist/SchemaUtils.js.map +1 -1
- package/dist/Scope.d.ts +107 -65
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +61 -32
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.d.ts +141 -49
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedCache.js +82 -21
- package/dist/ScopedCache.js.map +1 -1
- package/dist/ScopedRef.d.ts +28 -8
- package/dist/ScopedRef.d.ts.map +1 -1
- package/dist/ScopedRef.js +25 -5
- package/dist/ScopedRef.js.map +1 -1
- package/dist/Semaphore.d.ts +61 -37
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js +18 -21
- package/dist/Semaphore.js.map +1 -1
- package/dist/Sink.d.ts +461 -206
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +241 -90
- package/dist/Sink.js.map +1 -1
- package/dist/Stdio.d.ts +43 -6
- package/dist/Stdio.d.ts.map +1 -1
- package/dist/Stdio.js +33 -4
- package/dist/Stdio.js.map +1 -1
- package/dist/Stream.d.ts +2117 -1541
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +951 -682
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +174 -97
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +128 -69
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts +20 -18
- package/dist/Struct.d.ts.map +1 -1
- package/dist/Struct.js +10 -8
- package/dist/Struct.js.map +1 -1
- package/dist/SubscriptionRef.d.ts +309 -204
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +126 -77
- package/dist/SubscriptionRef.js.map +1 -1
- package/dist/Symbol.d.ts +13 -5
- package/dist/Symbol.d.ts.map +1 -1
- package/dist/Symbol.js +13 -5
- package/dist/Symbol.js.map +1 -1
- package/dist/SynchronizedRef.d.ts +278 -62
- package/dist/SynchronizedRef.d.ts.map +1 -1
- package/dist/SynchronizedRef.js +116 -23
- package/dist/SynchronizedRef.js.map +1 -1
- package/dist/Take.d.ts +26 -2
- package/dist/Take.d.ts.map +1 -1
- package/dist/Take.js +4 -1
- package/dist/Take.js.map +1 -1
- package/dist/Terminal.d.ts +39 -7
- package/dist/Terminal.d.ts.map +1 -1
- package/dist/Terminal.js +10 -4
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +233 -59
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +94 -18
- package/dist/Tracer.js.map +1 -1
- package/dist/Trie.d.ts +280 -245
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js +116 -102
- package/dist/Trie.js.map +1 -1
- package/dist/Tuple.d.ts +34 -32
- package/dist/Tuple.d.ts.map +1 -1
- package/dist/Tuple.js +16 -14
- package/dist/Tuple.js.map +1 -1
- package/dist/TxChunk.d.ts +200 -155
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxChunk.js +83 -61
- package/dist/TxChunk.js.map +1 -1
- package/dist/TxDeferred.d.ts +43 -29
- package/dist/TxDeferred.d.ts.map +1 -1
- package/dist/TxDeferred.js +22 -15
- package/dist/TxDeferred.js.map +1 -1
- package/dist/TxHashMap.d.ts +362 -223
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +171 -98
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxHashSet.d.ts +181 -111
- package/dist/TxHashSet.d.ts.map +1 -1
- package/dist/TxHashSet.js +87 -49
- package/dist/TxHashSet.js.map +1 -1
- package/dist/TxPriorityQueue.d.ts +94 -63
- package/dist/TxPriorityQueue.d.ts.map +1 -1
- package/dist/TxPriorityQueue.js +55 -37
- package/dist/TxPriorityQueue.js.map +1 -1
- package/dist/TxPubSub.d.ts +77 -49
- package/dist/TxPubSub.d.ts.map +1 -1
- package/dist/TxPubSub.js +60 -37
- package/dist/TxPubSub.js.map +1 -1
- package/dist/TxQueue.d.ts +277 -242
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxQueue.js +147 -101
- package/dist/TxQueue.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +69 -46
- package/dist/TxReentrantLock.d.ts.map +1 -1
- package/dist/TxReentrantLock.js +48 -32
- package/dist/TxReentrantLock.js.map +1 -1
- package/dist/TxRef.d.ts +69 -40
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +34 -19
- package/dist/TxRef.js.map +1 -1
- package/dist/TxSemaphore.d.ts +101 -115
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +76 -77
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/TxSubscriptionRef.d.ts +74 -50
- package/dist/TxSubscriptionRef.d.ts.map +1 -1
- package/dist/TxSubscriptionRef.js +34 -23
- package/dist/TxSubscriptionRef.js.map +1 -1
- package/dist/Types.d.ts +31 -34
- package/dist/Types.d.ts.map +1 -1
- package/dist/UndefinedOr.d.ts +62 -25
- package/dist/UndefinedOr.d.ts.map +1 -1
- package/dist/UndefinedOr.js +36 -25
- package/dist/UndefinedOr.js.map +1 -1
- package/dist/Unify.d.ts +72 -117
- package/dist/Unify.d.ts.map +1 -1
- package/dist/Unify.js +20 -6
- package/dist/Unify.js.map +1 -1
- package/dist/Utils.d.ts +5 -2
- package/dist/Utils.d.ts.map +1 -1
- package/dist/Utils.js +4 -0
- package/dist/Utils.js.map +1 -1
- package/dist/index.d.ts +1973 -418
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1973 -418
- package/dist/index.js.map +1 -1
- package/dist/internal/schema/schema.js +1 -1
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/testing/FastCheck.d.ts +9 -6
- package/dist/testing/FastCheck.d.ts.map +1 -1
- package/dist/testing/FastCheck.js +9 -6
- package/dist/testing/FastCheck.js.map +1 -1
- package/dist/testing/TestClock.d.ts +39 -35
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestClock.js +42 -12
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/testing/TestConsole.d.ts +44 -36
- package/dist/testing/TestConsole.d.ts.map +1 -1
- package/dist/testing/TestConsole.js +30 -15
- package/dist/testing/TestConsole.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +2 -0
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/testing/TestSchema.js +9 -7
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/testing/index.d.ts +34 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +34 -0
- package/dist/testing/index.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +205 -147
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +164 -109
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +2 -2
- package/dist/unstable/ai/Chat.d.ts +64 -41
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +51 -33
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.d.ts +12 -11
- package/dist/unstable/ai/EmbeddingModel.d.ts.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.js +9 -8
- package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
- package/dist/unstable/ai/IdGenerator.d.ts +28 -18
- package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
- package/dist/unstable/ai/IdGenerator.js +18 -11
- package/dist/unstable/ai/IdGenerator.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +31 -25
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +20 -14
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +342 -119
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +266 -98
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +56 -20
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +64 -16
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Model.d.ts +10 -12
- package/dist/unstable/ai/Model.d.ts.map +1 -1
- package/dist/unstable/ai/Model.js +9 -7
- package/dist/unstable/ai/Model.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +2 -2
- package/dist/unstable/ai/Prompt.d.ts +200 -176
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Prompt.js +77 -68
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +173 -160
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js +43 -48
- package/dist/unstable/ai/Response.js.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.d.ts +43 -4
- package/dist/unstable/ai/ResponseIdTracker.d.ts.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.js +27 -2
- package/dist/unstable/ai/ResponseIdTracker.js.map +1 -1
- package/dist/unstable/ai/Telemetry.d.ts +43 -33
- package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
- package/dist/unstable/ai/Telemetry.js +15 -11
- package/dist/unstable/ai/Telemetry.js.map +1 -1
- package/dist/unstable/ai/Tokenizer.d.ts +14 -9
- package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
- package/dist/unstable/ai/Tokenizer.js +10 -6
- package/dist/unstable/ai/Tokenizer.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +167 -96
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +107 -53
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +32 -39
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +7 -5
- package/dist/unstable/ai/Toolkit.js.map +1 -1
- package/dist/unstable/ai/index.d.ts +121 -29
- package/dist/unstable/ai/index.d.ts.map +1 -1
- package/dist/unstable/ai/index.js +121 -29
- package/dist/unstable/ai/index.js.map +1 -1
- package/dist/unstable/cli/Argument.d.ts +226 -134
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js +101 -65
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +72 -26
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +86 -23
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/CliOutput.d.ts +48 -19
- package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
- package/dist/unstable/cli/CliOutput.js +32 -9
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +196 -115
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +45 -31
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Completions.d.ts +7 -7
- package/dist/unstable/cli/Completions.js +1 -1
- package/dist/unstable/cli/Flag.d.ts +235 -142
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +111 -71
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +41 -13
- package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
- package/dist/unstable/cli/GlobalFlag.js +30 -7
- package/dist/unstable/cli/GlobalFlag.js.map +1 -1
- package/dist/unstable/cli/HelpDoc.d.ts +39 -14
- package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
- package/dist/unstable/cli/HelpDoc.js +21 -0
- package/dist/unstable/cli/Param.d.ts +110 -32
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +196 -135
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +79 -42
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js +66 -35
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/Prompt.d.ts +183 -59
- package/dist/unstable/cli/Prompt.d.ts.map +1 -1
- package/dist/unstable/cli/Prompt.js +105 -23
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/index.d.ts +182 -0
- package/dist/unstable/cli/index.d.ts.map +1 -1
- package/dist/unstable/cli/index.js +205 -6
- package/dist/unstable/cli/index.js.map +1 -1
- package/dist/unstable/cli/internal/ansi.d.ts.map +1 -1
- package/dist/unstable/cli/internal/ansi.js +13 -0
- package/dist/unstable/cli/internal/ansi.js.map +1 -1
- package/dist/unstable/cli/internal/command.d.ts +5 -1
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +5 -1
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/config.d.ts +3 -0
- package/dist/unstable/cli/internal/config.d.ts.map +1 -1
- package/dist/unstable/cli/internal/config.js.map +1 -1
- package/dist/unstable/cli/internal/lexer.js.map +1 -1
- package/dist/unstable/cli/internal/parser.js +0 -1
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cluster/ClusterCron.d.ts +35 -1
- package/dist/unstable/cluster/ClusterCron.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterCron.js +35 -1
- package/dist/unstable/cluster/ClusterCron.js.map +1 -1
- package/dist/unstable/cluster/ClusterError.d.ts +56 -7
- package/dist/unstable/cluster/ClusterError.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterError.js +56 -7
- package/dist/unstable/cluster/ClusterError.js.map +1 -1
- package/dist/unstable/cluster/ClusterMetrics.d.ts +39 -5
- package/dist/unstable/cluster/ClusterMetrics.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterMetrics.js +39 -5
- package/dist/unstable/cluster/ClusterMetrics.js.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.d.ts +61 -8
- package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.js +61 -8
- package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +14 -2
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +35 -2
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/DeliverAt.d.ts +39 -4
- package/dist/unstable/cluster/DeliverAt.d.ts.map +1 -1
- package/dist/unstable/cluster/DeliverAt.js +11 -3
- package/dist/unstable/cluster/DeliverAt.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +74 -16
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +75 -10
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/EntityAddress.d.ts +30 -2
- package/dist/unstable/cluster/EntityAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityAddress.js +30 -2
- package/dist/unstable/cluster/EntityAddress.js.map +1 -1
- package/dist/unstable/cluster/EntityId.d.ts +18 -3
- package/dist/unstable/cluster/EntityId.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityId.js +15 -2
- package/dist/unstable/cluster/EntityId.js.map +1 -1
- package/dist/unstable/cluster/EntityProxy.d.ts +42 -14
- package/dist/unstable/cluster/EntityProxy.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxy.js +30 -14
- package/dist/unstable/cluster/EntityProxy.js.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.d.ts +18 -2
- package/dist/unstable/cluster/EntityProxyServer.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.js +40 -8
- package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
- package/dist/unstable/cluster/EntityResource.d.ts +43 -6
- package/dist/unstable/cluster/EntityResource.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityResource.js +11 -4
- package/dist/unstable/cluster/EntityResource.js.map +1 -1
- package/dist/unstable/cluster/EntityType.d.ts +27 -3
- package/dist/unstable/cluster/EntityType.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityType.js +24 -2
- package/dist/unstable/cluster/EntityType.js.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts +105 -23
- package/dist/unstable/cluster/Envelope.d.ts.map +1 -1
- package/dist/unstable/cluster/Envelope.js +88 -14
- package/dist/unstable/cluster/Envelope.js.map +1 -1
- package/dist/unstable/cluster/HttpRunner.d.ts +88 -13
- package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/HttpRunner.js +88 -13
- package/dist/unstable/cluster/HttpRunner.js.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.d.ts +49 -6
- package/dist/unstable/cluster/K8sHttpClient.d.ts.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.js +31 -6
- package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
- package/dist/unstable/cluster/MachineId.d.ts +24 -3
- package/dist/unstable/cluster/MachineId.d.ts.map +1 -1
- package/dist/unstable/cluster/MachineId.js +21 -2
- package/dist/unstable/cluster/MachineId.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +102 -13
- package/dist/unstable/cluster/Message.d.ts.map +1 -1
- package/dist/unstable/cluster/Message.js +86 -10
- package/dist/unstable/cluster/Message.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +126 -21
- package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/MessageStorage.js +70 -10
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts +101 -12
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +64 -8
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/Runner.d.ts +47 -17
- package/dist/unstable/cluster/Runner.d.ts.map +1 -1
- package/dist/unstable/cluster/Runner.js +47 -17
- package/dist/unstable/cluster/Runner.js.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.d.ts +34 -2
- package/dist/unstable/cluster/RunnerAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.js +34 -2
- package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.d.ts +40 -12
- package/dist/unstable/cluster/RunnerHealth.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.js +40 -12
- package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts +7 -4
- package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +31 -4
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.d.ts +42 -5
- package/dist/unstable/cluster/RunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.js +38 -4
- package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +76 -13
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +73 -12
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/ShardId.d.ts +53 -5
- package/dist/unstable/cluster/ShardId.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardId.js +49 -4
- package/dist/unstable/cluster/ShardId.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts +10 -2
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +35 -4
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +65 -9
- package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.js +66 -9
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/ShardingRegistrationEvent.d.ts +27 -6
- package/dist/unstable/cluster/ShardingRegistrationEvent.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingRegistrationEvent.js +28 -4
- package/dist/unstable/cluster/ShardingRegistrationEvent.js.map +1 -1
- package/dist/unstable/cluster/SingleRunner.d.ts +23 -1
- package/dist/unstable/cluster/SingleRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/SingleRunner.js +23 -1
- package/dist/unstable/cluster/SingleRunner.js.map +1 -1
- package/dist/unstable/cluster/Singleton.d.ts +15 -1
- package/dist/unstable/cluster/Singleton.d.ts.map +1 -1
- package/dist/unstable/cluster/Singleton.js +15 -1
- package/dist/unstable/cluster/Singleton.js.map +1 -1
- package/dist/unstable/cluster/SingletonAddress.d.ts +21 -1
- package/dist/unstable/cluster/SingletonAddress.d.ts.map +1 -1
- package/dist/unstable/cluster/SingletonAddress.js +21 -1
- package/dist/unstable/cluster/SingletonAddress.js.map +1 -1
- package/dist/unstable/cluster/Snowflake.d.ts +90 -19
- package/dist/unstable/cluster/Snowflake.d.ts.map +1 -1
- package/dist/unstable/cluster/Snowflake.js +49 -13
- package/dist/unstable/cluster/Snowflake.js.map +1 -1
- package/dist/unstable/cluster/SocketRunner.d.ts +8 -2
- package/dist/unstable/cluster/SocketRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/SocketRunner.js +29 -2
- package/dist/unstable/cluster/SocketRunner.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.d.ts +11 -3
- package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +27 -3
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts +11 -3
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js +46 -7
- package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/TestRunner.d.ts +18 -1
- package/dist/unstable/cluster/TestRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/TestRunner.js +18 -1
- package/dist/unstable/cluster/TestRunner.js.map +1 -1
- package/dist/unstable/cluster/index.d.ts +790 -0
- package/dist/unstable/cluster/index.d.ts.map +1 -1
- package/dist/unstable/cluster/index.js +790 -0
- package/dist/unstable/cluster/index.js.map +1 -1
- package/dist/unstable/cluster/internal/hash.js +12 -0
- package/dist/unstable/cluster/internal/hash.js.map +1 -1
- package/dist/unstable/devtools/DevTools.d.ts +26 -3
- package/dist/unstable/devtools/DevTools.d.ts.map +1 -1
- package/dist/unstable/devtools/DevTools.js +26 -3
- package/dist/unstable/devtools/DevTools.js.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.d.ts +20 -5
- package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.js +32 -5
- package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.d.ts +184 -44
- package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js +102 -20
- package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
- package/dist/unstable/devtools/DevToolsServer.d.ts +27 -2
- package/dist/unstable/devtools/DevToolsServer.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsServer.js +21 -1
- package/dist/unstable/devtools/DevToolsServer.js.map +1 -1
- package/dist/unstable/devtools/index.d.ts +58 -0
- package/dist/unstable/devtools/index.d.ts.map +1 -1
- package/dist/unstable/devtools/index.js +58 -0
- package/dist/unstable/devtools/index.js.map +1 -1
- package/dist/unstable/encoding/Msgpack.d.ts +81 -12
- package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
- package/dist/unstable/encoding/Msgpack.js +75 -9
- package/dist/unstable/encoding/Msgpack.js.map +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts +149 -21
- package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
- package/dist/unstable/encoding/Ndjson.js +97 -13
- package/dist/unstable/encoding/Ndjson.js.map +1 -1
- package/dist/unstable/encoding/Sse.d.ts +109 -18
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.js +69 -13
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/encoding/index.d.ts +49 -0
- package/dist/unstable/encoding/index.d.ts.map +1 -1
- package/dist/unstable/encoding/index.js +49 -0
- package/dist/unstable/encoding/index.js.map +1 -1
- package/dist/unstable/eventlog/Event.d.ts +115 -30
- package/dist/unstable/eventlog/Event.d.ts.map +1 -1
- package/dist/unstable/eventlog/Event.js +22 -2
- package/dist/unstable/eventlog/Event.js.map +1 -1
- package/dist/unstable/eventlog/EventGroup.d.ts +50 -17
- package/dist/unstable/eventlog/EventGroup.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventGroup.js +24 -6
- package/dist/unstable/eventlog/EventGroup.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +104 -20
- package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventJournal.js +108 -16
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts +150 -31
- package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLog.js +111 -20
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.d.ts +42 -6
- package/dist/unstable/eventlog/EventLogEncryption.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js +38 -5
- package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +92 -18
- package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.js +72 -16
- package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +35 -8
- package/dist/unstable/eventlog/EventLogRemote.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.js +54 -8
- package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.d.ts +17 -3
- package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.js +17 -3
- package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +32 -6
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.js +52 -6
- package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +74 -16
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js +90 -16
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +59 -15
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.js +73 -14
- package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.d.ts +10 -2
- package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.js +28 -2
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts +32 -3
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js +32 -3
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts +10 -2
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +28 -2
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/index.d.ts +240 -0
- package/dist/unstable/eventlog/index.d.ts.map +1 -1
- package/dist/unstable/eventlog/index.js +240 -0
- package/dist/unstable/eventlog/index.js.map +1 -1
- package/dist/unstable/http/Cookies.d.ts +156 -77
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +93 -39
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Etag.d.ts +40 -7
- package/dist/unstable/http/Etag.d.ts.map +1 -1
- package/dist/unstable/http/Etag.js +27 -4
- package/dist/unstable/http/Etag.js.map +1 -1
- package/dist/unstable/http/FetchHttpClient.d.ts +29 -3
- package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/unstable/http/FetchHttpClient.js +33 -4
- package/dist/unstable/http/FetchHttpClient.js.map +1 -1
- package/dist/unstable/http/FindMyWay.d.ts +1 -1
- package/dist/unstable/http/FindMyWay.js +1 -1
- package/dist/unstable/http/Headers.d.ts +182 -36
- package/dist/unstable/http/Headers.d.ts.map +1 -1
- package/dist/unstable/http/Headers.js +86 -16
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpBody.d.ts +114 -26
- package/dist/unstable/http/HttpBody.d.ts.map +1 -1
- package/dist/unstable/http/HttpBody.js +98 -20
- package/dist/unstable/http/HttpBody.js.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts +204 -96
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +85 -38
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientError.d.ts +68 -12
- package/dist/unstable/http/HttpClientError.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientError.js +71 -9
- package/dist/unstable/http/HttpClientError.js.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts +318 -100
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +151 -45
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts +59 -16
- package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientResponse.js +44 -11
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts +42 -16
- package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
- package/dist/unstable/http/HttpEffect.js +33 -13
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.d.ts +48 -7
- package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js +45 -6
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMethod.d.ts +38 -6
- package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
- package/dist/unstable/http/HttpMethod.js +27 -2
- package/dist/unstable/http/HttpMethod.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts +38 -11
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +52 -10
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpPlatform.d.ts +34 -3
- package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
- package/dist/unstable/http/HttpPlatform.js +34 -3
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +209 -62
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +136 -41
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServer.d.ts +151 -22
- package/dist/unstable/http/HttpServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpServer.js +76 -11
- package/dist/unstable/http/HttpServer.js.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +93 -10
- package/dist/unstable/http/HttpServerError.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerError.js +85 -8
- package/dist/unstable/http/HttpServerError.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +125 -21
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +101 -20
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.d.ts +32 -6
- package/dist/unstable/http/HttpServerRespondable.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.js +43 -5
- package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +391 -67
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +205 -33
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpStaticServer.d.ts +24 -8
- package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpStaticServer.js +24 -8
- package/dist/unstable/http/HttpStaticServer.js.map +1 -1
- package/dist/unstable/http/HttpTraceContext.d.ts +53 -6
- package/dist/unstable/http/HttpTraceContext.d.ts.map +1 -1
- package/dist/unstable/http/HttpTraceContext.js +47 -5
- package/dist/unstable/http/HttpTraceContext.js.map +1 -1
- package/dist/unstable/http/Multipart.d.ts +179 -28
- package/dist/unstable/http/Multipart.d.ts.map +1 -1
- package/dist/unstable/http/Multipart.js +131 -19
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/Multipasta/HeadersParser.d.ts +1 -1
- package/dist/unstable/http/Multipasta/HeadersParser.js +1 -1
- package/dist/unstable/http/Multipasta/Node.d.ts +1 -1
- package/dist/unstable/http/Multipasta/Node.js +1 -1
- package/dist/unstable/http/Multipasta/Search.d.ts +1 -1
- package/dist/unstable/http/Multipasta/Search.js +1 -1
- package/dist/unstable/http/Multipasta/Web.d.ts +1 -1
- package/dist/unstable/http/Multipasta/Web.js +1 -1
- package/dist/unstable/http/Multipasta.d.ts +1 -1
- package/dist/unstable/http/Multipasta.js +1 -1
- package/dist/unstable/http/Template.d.ts +53 -1
- package/dist/unstable/http/Template.d.ts.map +1 -1
- package/dist/unstable/http/Template.js +26 -0
- package/dist/unstable/http/Template.js.map +1 -1
- package/dist/unstable/http/Url.d.ts +70 -56
- package/dist/unstable/http/Url.d.ts.map +1 -1
- package/dist/unstable/http/Url.js +35 -21
- package/dist/unstable/http/Url.js.map +1 -1
- package/dist/unstable/http/UrlParams.d.ts +237 -51
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +120 -25
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/http/index.d.ts +452 -0
- package/dist/unstable/http/index.d.ts.map +1 -1
- package/dist/unstable/http/index.js +452 -0
- package/dist/unstable/http/index.js.map +1 -1
- package/dist/unstable/httpapi/HttpApi.d.ts +49 -14
- package/dist/unstable/httpapi/HttpApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js +14 -8
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +54 -16
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +44 -6
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +57 -15
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +42 -6
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +214 -59
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.js +53 -9
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +81 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.js +98 -1
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.d.ts +87 -20
- package/dist/unstable/httpapi/HttpApiGroup.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.js +5 -2
- package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +113 -22
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js +49 -5
- package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts +19 -4
- package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.js +32 -2
- package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +86 -38
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.js +59 -35
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts +73 -17
- package/dist/unstable/httpapi/HttpApiSecurity.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.js +38 -5
- package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.d.ts +4 -3
- package/dist/unstable/httpapi/HttpApiSwagger.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.js +23 -3
- package/dist/unstable/httpapi/HttpApiSwagger.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiTest.d.ts +6 -1
- package/dist/unstable/httpapi/HttpApiTest.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiTest.js +26 -1
- package/dist/unstable/httpapi/HttpApiTest.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts +86 -15
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +73 -15
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/httpapi/index.d.ts +310 -25
- package/dist/unstable/httpapi/index.d.ts.map +1 -1
- package/dist/unstable/httpapi/index.js +310 -25
- package/dist/unstable/httpapi/index.js.map +1 -1
- package/dist/unstable/observability/Otlp.d.ts +33 -3
- package/dist/unstable/observability/Otlp.d.ts.map +1 -1
- package/dist/unstable/observability/Otlp.js +14 -3
- package/dist/unstable/observability/Otlp.js.map +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts +8 -1
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +32 -1
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.d.ts +15 -2
- package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js +29 -2
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts +17 -5
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.js +32 -2
- package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
- package/dist/unstable/observability/OtlpResource.d.ts +49 -12
- package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpResource.js +47 -5
- package/dist/unstable/observability/OtlpResource.js.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.d.ts +28 -3
- package/dist/unstable/observability/OtlpSerialization.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.js +28 -3
- package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.d.ts +19 -2
- package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js +32 -2
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.d.ts +36 -16
- package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.js +9 -7
- package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
- package/dist/unstable/observability/index.d.ts +160 -3
- package/dist/unstable/observability/index.d.ts.map +1 -1
- package/dist/unstable/observability/index.js +160 -3
- package/dist/unstable/observability/index.js.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +93 -18
- package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.js +81 -21
- package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
- package/dist/unstable/persistence/Persistable.d.ts +76 -15
- package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistable.js +22 -5
- package/dist/unstable/persistence/Persistable.js.map +1 -1
- package/dist/unstable/persistence/PersistedCache.d.ts +27 -2
- package/dist/unstable/persistence/PersistedCache.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedCache.js +24 -1
- package/dist/unstable/persistence/PersistedCache.js.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts +73 -16
- package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.js +60 -13
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/Persistence.d.ts +98 -16
- package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistence.js +91 -14
- package/dist/unstable/persistence/Persistence.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +101 -21
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +85 -16
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/persistence/Redis.d.ts +26 -5
- package/dist/unstable/persistence/Redis.d.ts.map +1 -1
- package/dist/unstable/persistence/Redis.js +36 -4
- package/dist/unstable/persistence/Redis.js.map +1 -1
- package/dist/unstable/persistence/index.d.ts +147 -0
- package/dist/unstable/persistence/index.d.ts.map +1 -1
- package/dist/unstable/persistence/index.js +147 -0
- package/dist/unstable/persistence/index.js.map +1 -1
- package/dist/unstable/process/ChildProcess.d.ts +87 -64
- package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcess.js +25 -18
- package/dist/unstable/process/ChildProcess.js.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.d.ts +23 -12
- package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js +11 -6
- package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
- package/dist/unstable/process/index.d.ts +2 -1
- package/dist/unstable/process/index.d.ts.map +1 -1
- package/dist/unstable/process/index.js +2 -1
- package/dist/unstable/process/index.js.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.d.ts +198 -59
- package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.js +121 -36
- package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +544 -130
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +252 -58
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +41 -2
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.js +35 -1
- package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/unstable/reactivity/AtomRef.d.ts +51 -7
- package/dist/unstable/reactivity/AtomRef.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRef.js +29 -3
- package/dist/unstable/reactivity/AtomRef.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.d.ts +135 -21
- package/dist/unstable/reactivity/AtomRegistry.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +69 -10
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts +36 -2
- package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.js +29 -1
- package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
- package/dist/unstable/reactivity/Hydration.d.ts +28 -5
- package/dist/unstable/reactivity/Hydration.d.ts.map +1 -1
- package/dist/unstable/reactivity/Hydration.js +35 -3
- package/dist/unstable/reactivity/Hydration.js.map +1 -1
- package/dist/unstable/reactivity/Reactivity.d.ts +94 -13
- package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
- package/dist/unstable/reactivity/Reactivity.js +60 -7
- package/dist/unstable/reactivity/Reactivity.js.map +1 -1
- package/dist/unstable/reactivity/index.d.ts +167 -0
- package/dist/unstable/reactivity/index.d.ts.map +1 -1
- package/dist/unstable/reactivity/index.js +167 -0
- package/dist/unstable/reactivity/index.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +254 -56
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js +44 -11
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts +80 -19
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +52 -12
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcClientError.d.ts +26 -2
- package/dist/unstable/rpc/RpcClientError.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClientError.js +26 -2
- package/dist/unstable/rpc/RpcClientError.js.map +1 -1
- package/dist/unstable/rpc/RpcGroup.d.ts +51 -8
- package/dist/unstable/rpc/RpcGroup.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcGroup.js +3 -1
- package/dist/unstable/rpc/RpcGroup.js.map +1 -1
- package/dist/unstable/rpc/RpcMessage.d.ts +128 -32
- package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMessage.js +23 -7
- package/dist/unstable/rpc/RpcMessage.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts +100 -20
- package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js +39 -3
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts +38 -4
- package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSchema.js +34 -3
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts +60 -13
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +56 -12
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +73 -23
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +69 -22
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/rpc/RpcTest.d.ts +20 -1
- package/dist/unstable/rpc/RpcTest.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcTest.js +20 -1
- package/dist/unstable/rpc/RpcTest.js.map +1 -1
- package/dist/unstable/rpc/RpcWorker.d.ts +39 -6
- package/dist/unstable/rpc/RpcWorker.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcWorker.js +16 -4
- package/dist/unstable/rpc/RpcWorker.js.map +1 -1
- package/dist/unstable/rpc/Utils.d.ts +10 -0
- package/dist/unstable/rpc/Utils.d.ts.map +1 -1
- package/dist/unstable/rpc/Utils.js +10 -0
- package/dist/unstable/rpc/Utils.js.map +1 -1
- package/dist/unstable/rpc/index.d.ts +272 -0
- package/dist/unstable/rpc/index.d.ts.map +1 -1
- package/dist/unstable/rpc/index.js +272 -0
- package/dist/unstable/rpc/index.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts +192 -59
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js +122 -38
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +101 -24
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.js +22 -6
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/schema/index.d.ts +37 -0
- package/dist/unstable/schema/index.d.ts.map +1 -1
- package/dist/unstable/schema/index.js +37 -0
- package/dist/unstable/schema/index.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +168 -34
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +124 -28
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/socket/SocketServer.d.ts +58 -10
- package/dist/unstable/socket/SocketServer.d.ts.map +1 -1
- package/dist/unstable/socket/SocketServer.js +43 -5
- package/dist/unstable/socket/SocketServer.js.map +1 -1
- package/dist/unstable/socket/index.d.ts +44 -0
- package/dist/unstable/socket/index.d.ts.map +1 -1
- package/dist/unstable/socket/index.js +44 -0
- package/dist/unstable/socket/index.js.map +1 -1
- package/dist/unstable/sql/Migrator.d.ts +40 -9
- package/dist/unstable/sql/Migrator.d.ts.map +1 -1
- package/dist/unstable/sql/Migrator.js +45 -5
- package/dist/unstable/sql/Migrator.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts +38 -2
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +40 -1
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/sql/SqlConnection.d.ts +34 -3
- package/dist/unstable/sql/SqlConnection.d.ts.map +1 -1
- package/dist/unstable/sql/SqlConnection.js +22 -0
- package/dist/unstable/sql/SqlConnection.js.map +1 -1
- package/dist/unstable/sql/SqlError.d.ts +117 -0
- package/dist/unstable/sql/SqlError.d.ts.map +1 -1
- package/dist/unstable/sql/SqlError.js +131 -0
- package/dist/unstable/sql/SqlError.js.map +1 -1
- package/dist/unstable/sql/SqlModel.d.ts +25 -5
- package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
- package/dist/unstable/sql/SqlModel.js +8 -4
- package/dist/unstable/sql/SqlModel.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.d.ts +56 -13
- package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
- package/dist/unstable/sql/SqlResolver.js +44 -10
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/sql/SqlSchema.d.ts +29 -8
- package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
- package/dist/unstable/sql/SqlSchema.js +29 -8
- package/dist/unstable/sql/SqlSchema.js.map +1 -1
- package/dist/unstable/sql/SqlStream.d.ts +4 -0
- package/dist/unstable/sql/SqlStream.d.ts.map +1 -1
- package/dist/unstable/sql/SqlStream.js +24 -0
- package/dist/unstable/sql/SqlStream.js.map +1 -1
- package/dist/unstable/sql/Statement.d.ts +151 -24
- package/dist/unstable/sql/Statement.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.js +91 -6
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/sql/index.d.ts +179 -1
- package/dist/unstable/sql/index.d.ts.map +1 -1
- package/dist/unstable/sql/index.js +179 -1
- package/dist/unstable/sql/index.js.map +1 -1
- package/dist/unstable/workers/Transferable.d.ts +72 -20
- package/dist/unstable/workers/Transferable.d.ts.map +1 -1
- package/dist/unstable/workers/Transferable.js +57 -14
- package/dist/unstable/workers/Transferable.js.map +1 -1
- package/dist/unstable/workers/Worker.d.ts +61 -8
- package/dist/unstable/workers/Worker.d.ts.map +1 -1
- package/dist/unstable/workers/Worker.js +44 -4
- package/dist/unstable/workers/Worker.js.map +1 -1
- package/dist/unstable/workers/WorkerError.d.ts +31 -9
- package/dist/unstable/workers/WorkerError.d.ts.map +1 -1
- package/dist/unstable/workers/WorkerError.js +44 -7
- package/dist/unstable/workers/WorkerError.js.map +1 -1
- package/dist/unstable/workers/WorkerRunner.d.ts +32 -3
- package/dist/unstable/workers/WorkerRunner.d.ts.map +1 -1
- package/dist/unstable/workers/WorkerRunner.js +24 -1
- package/dist/unstable/workers/WorkerRunner.js.map +1 -1
- package/dist/unstable/workers/index.d.ts +81 -1
- package/dist/unstable/workers/index.d.ts.map +1 -1
- package/dist/unstable/workers/index.js +81 -1
- package/dist/unstable/workers/index.js.map +1 -1
- package/dist/unstable/workflow/Activity.d.ts +61 -10
- package/dist/unstable/workflow/Activity.d.ts.map +1 -1
- package/dist/unstable/workflow/Activity.js +20 -5
- package/dist/unstable/workflow/Activity.js.map +1 -1
- package/dist/unstable/workflow/DurableClock.d.ts +12 -3
- package/dist/unstable/workflow/DurableClock.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableClock.js +22 -2
- package/dist/unstable/workflow/DurableClock.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts +128 -31
- package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.js +77 -13
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/DurableQueue.d.ts +33 -8
- package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableQueue.js +26 -6
- package/dist/unstable/workflow/DurableQueue.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +102 -31
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js +75 -19
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +40 -5
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +16 -4
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.d.ts +40 -12
- package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.js +8 -12
- package/dist/unstable/workflow/WorkflowProxy.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.d.ts +37 -2
- package/dist/unstable/workflow/WorkflowProxyServer.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.js +12 -6
- package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
- package/dist/unstable/workflow/index.d.ts +160 -0
- package/dist/unstable/workflow/index.d.ts.map +1 -1
- package/dist/unstable/workflow/index.js +160 -0
- package/dist/unstable/workflow/index.js.map +1 -1
- package/package.json +11 -11
- package/src/Array.ts +151 -106
- package/src/BigDecimal.ts +620 -553
- package/src/BigInt.ts +342 -274
- package/src/Boolean.ts +189 -156
- package/src/Brand.ts +30 -5
- package/src/Cache.ts +334 -167
- package/src/Cause.ts +84 -73
- package/src/Channel.ts +1639 -667
- package/src/ChannelSchema.ts +137 -12
- package/src/Chunk.ts +575 -429
- package/src/Clock.ts +16 -9
- package/src/Combiner.ts +11 -5
- package/src/Config.ts +80 -68
- package/src/ConfigProvider.ts +33 -32
- package/src/Console.ts +88 -58
- package/src/Context.ts +401 -190
- package/src/Cron.ts +109 -48
- package/src/Crypto.ts +327 -0
- package/src/Data.ts +9 -3
- package/src/DateTime.ts +893 -464
- package/src/Deferred.ts +367 -175
- package/src/Differ.ts +44 -2
- package/src/Duration.ts +333 -186
- package/src/Effect.ts +2201 -2289
- package/src/Effectable.ts +38 -3
- package/src/Encoding.ts +78 -28
- package/src/Equal.ts +4 -3
- package/src/Equivalence.ts +18 -24
- package/src/ErrorReporter.ts +66 -82
- package/src/ExecutionPlan.ts +106 -12
- package/src/Exit.ts +6 -5
- package/src/Fiber.ts +71 -40
- package/src/FiberHandle.ts +157 -57
- package/src/FiberMap.ts +328 -163
- package/src/FiberSet.ts +130 -52
- package/src/FileSystem.ts +104 -74
- package/src/Filter.ts +166 -88
- package/src/Formatter.ts +4 -70
- package/src/Function.ts +218 -151
- package/src/Graph.ts +714 -415
- package/src/HKT.ts +29 -13
- package/src/Hash.ts +35 -24
- package/src/HashMap.ts +540 -388
- package/src/HashRing.ts +111 -34
- package/src/HashSet.ts +239 -153
- package/src/Inspectable.ts +30 -17
- package/src/Iterable.ts +336 -222
- package/src/JsonPatch.ts +13 -10
- package/src/JsonPointer.ts +13 -11
- package/src/JsonSchema.ts +16 -0
- package/src/Latch.ts +97 -26
- package/src/Layer.ts +547 -445
- package/src/LayerMap.ts +99 -26
- package/src/LogLevel.ts +92 -131
- package/src/Logger.ts +365 -297
- package/src/ManagedRuntime.ts +78 -19
- package/src/Match.ts +135 -161
- package/src/Metric.ts +362 -313
- package/src/MutableHashMap.ts +202 -127
- package/src/MutableHashSet.ts +120 -52
- package/src/MutableList.ts +157 -100
- package/src/MutableRef.ts +129 -90
- package/src/Newtype.ts +15 -2
- package/src/NonEmptyIterable.ts +38 -48
- package/src/Number.ts +261 -205
- package/src/Optic.ts +6 -7
- package/src/Option.ts +133 -156
- package/src/Order.ts +6 -6
- package/src/Ordering.ts +56 -45
- package/src/PartitionedSemaphore.ts +225 -40
- package/src/Path.ts +77 -13
- package/src/Pipeable.ts +82 -24
- package/src/PlatformError.ts +74 -6
- package/src/Pool.ts +94 -31
- package/src/Predicate.ts +17 -24
- package/src/PrimaryKey.ts +11 -3
- package/src/PubSub.ts +385 -309
- package/src/Pull.ts +94 -25
- package/src/Queue.ts +303 -184
- package/src/Random.ts +69 -93
- package/src/RcMap.ts +151 -141
- package/src/RcRef.ts +68 -32
- package/src/Record.ts +282 -137
- package/src/Redactable.ts +7 -5
- package/src/Redacted.ts +63 -34
- package/src/Reducer.ts +3 -1
- package/src/Ref.ts +173 -134
- package/src/References.ts +73 -31
- package/src/RegExp.ts +12 -6
- package/src/Request.ts +159 -34
- package/src/RequestResolver.ts +278 -121
- package/src/Resource.ts +45 -7
- package/src/Result.ts +137 -153
- package/src/Runtime.ts +42 -21
- package/src/Schedule.ts +585 -613
- package/src/Scheduler.ts +44 -7
- package/src/Schema.ts +1309 -615
- package/src/SchemaAST.ts +123 -93
- package/src/SchemaGetter.ts +52 -37
- package/src/SchemaIssue.ts +19 -24
- package/src/SchemaParser.ts +306 -85
- package/src/SchemaRepresentation.ts +89 -77
- package/src/SchemaTransformation.ts +97 -46
- package/src/SchemaUtils.ts +24 -1
- package/src/Scope.ts +107 -65
- package/src/ScopedCache.ts +195 -59
- package/src/ScopedRef.ts +28 -8
- package/src/Semaphore.ts +61 -37
- package/src/Sink.ts +461 -206
- package/src/Stdio.ts +43 -6
- package/src/Stream.ts +2361 -1613
- package/src/String.ts +174 -97
- package/src/Struct.ts +20 -18
- package/src/SubscriptionRef.ts +309 -204
- package/src/Symbol.ts +13 -5
- package/src/SynchronizedRef.ts +278 -62
- package/src/Take.ts +26 -2
- package/src/Terminal.ts +40 -7
- package/src/Tracer.ts +233 -59
- package/src/Trie.ts +280 -245
- package/src/Tuple.ts +34 -32
- package/src/TxChunk.ts +200 -155
- package/src/TxDeferred.ts +43 -29
- package/src/TxHashMap.ts +370 -231
- package/src/TxHashSet.ts +253 -159
- package/src/TxPriorityQueue.ts +97 -65
- package/src/TxPubSub.ts +77 -49
- package/src/TxQueue.ts +277 -242
- package/src/TxReentrantLock.ts +70 -47
- package/src/TxRef.ts +69 -40
- package/src/TxSemaphore.ts +101 -115
- package/src/TxSubscriptionRef.ts +74 -50
- package/src/Types.ts +31 -34
- package/src/UndefinedOr.ts +62 -25
- package/src/Unify.ts +72 -117
- package/src/Utils.ts +5 -2
- package/src/index.ts +1976 -420
- package/src/internal/schema/schema.ts +1 -1
- package/src/testing/FastCheck.ts +9 -6
- package/src/testing/TestClock.ts +63 -35
- package/src/testing/TestConsole.ts +54 -36
- package/src/testing/TestSchema.ts +10 -8
- package/src/testing/index.ts +34 -0
- package/src/unstable/ai/AiError.ts +195 -137
- package/src/unstable/ai/AnthropicStructuredOutput.ts +2 -2
- package/src/unstable/ai/Chat.ts +68 -43
- package/src/unstable/ai/EmbeddingModel.ts +12 -11
- package/src/unstable/ai/IdGenerator.ts +28 -18
- package/src/unstable/ai/LanguageModel.ts +35 -27
- package/src/unstable/ai/McpSchema.ts +342 -119
- package/src/unstable/ai/McpServer.ts +79 -20
- package/src/unstable/ai/Model.ts +10 -12
- package/src/unstable/ai/OpenAiStructuredOutput.ts +2 -2
- package/src/unstable/ai/Prompt.ts +216 -192
- package/src/unstable/ai/Response.ts +179 -167
- package/src/unstable/ai/ResponseIdTracker.ts +43 -4
- package/src/unstable/ai/Telemetry.ts +43 -33
- package/src/unstable/ai/Tokenizer.ts +14 -9
- package/src/unstable/ai/Tool.ts +168 -97
- package/src/unstable/ai/Toolkit.ts +51 -46
- package/src/unstable/ai/index.ts +121 -29
- package/src/unstable/cli/Argument.ts +226 -134
- package/src/unstable/cli/CliError.ts +96 -26
- package/src/unstable/cli/CliOutput.ts +48 -19
- package/src/unstable/cli/Command.ts +196 -115
- package/src/unstable/cli/Completions.ts +7 -7
- package/src/unstable/cli/Flag.ts +235 -142
- package/src/unstable/cli/GlobalFlag.ts +41 -13
- package/src/unstable/cli/HelpDoc.ts +39 -14
- package/src/unstable/cli/Param.ts +395 -260
- package/src/unstable/cli/Primitive.ts +79 -42
- package/src/unstable/cli/Prompt.ts +207 -59
- package/src/unstable/cli/index.ts +205 -6
- package/src/unstable/cli/internal/ansi.ts +13 -0
- package/src/unstable/cli/internal/command.ts +5 -1
- package/src/unstable/cli/internal/config.ts +3 -0
- package/src/unstable/cli/internal/lexer.ts +11 -0
- package/src/unstable/cli/internal/parser.ts +0 -1
- package/src/unstable/cluster/ClusterCron.ts +35 -1
- package/src/unstable/cluster/ClusterError.ts +56 -7
- package/src/unstable/cluster/ClusterMetrics.ts +39 -5
- package/src/unstable/cluster/ClusterSchema.ts +61 -8
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +35 -2
- package/src/unstable/cluster/DeliverAt.ts +39 -4
- package/src/unstable/cluster/Entity.ts +106 -16
- package/src/unstable/cluster/EntityAddress.ts +30 -2
- package/src/unstable/cluster/EntityId.ts +18 -3
- package/src/unstable/cluster/EntityProxy.ts +42 -14
- package/src/unstable/cluster/EntityProxyServer.ts +45 -8
- package/src/unstable/cluster/EntityResource.ts +43 -6
- package/src/unstable/cluster/EntityType.ts +27 -3
- package/src/unstable/cluster/Envelope.ts +128 -23
- package/src/unstable/cluster/HttpRunner.ts +88 -13
- package/src/unstable/cluster/K8sHttpClient.ts +49 -6
- package/src/unstable/cluster/MachineId.ts +24 -3
- package/src/unstable/cluster/Message.ts +102 -13
- package/src/unstable/cluster/MessageStorage.ts +126 -21
- package/src/unstable/cluster/Reply.ts +101 -12
- package/src/unstable/cluster/Runner.ts +47 -17
- package/src/unstable/cluster/RunnerAddress.ts +34 -2
- package/src/unstable/cluster/RunnerHealth.ts +40 -12
- package/src/unstable/cluster/RunnerServer.ts +31 -4
- package/src/unstable/cluster/RunnerStorage.ts +42 -5
- package/src/unstable/cluster/Runners.ts +76 -13
- package/src/unstable/cluster/ShardId.ts +53 -5
- package/src/unstable/cluster/Sharding.ts +35 -4
- package/src/unstable/cluster/ShardingConfig.ts +75 -10
- package/src/unstable/cluster/ShardingRegistrationEvent.ts +31 -7
- package/src/unstable/cluster/SingleRunner.ts +23 -1
- package/src/unstable/cluster/Singleton.ts +15 -1
- package/src/unstable/cluster/SingletonAddress.ts +21 -1
- package/src/unstable/cluster/Snowflake.ts +90 -19
- package/src/unstable/cluster/SocketRunner.ts +29 -2
- package/src/unstable/cluster/SqlMessageStorage.ts +27 -3
- package/src/unstable/cluster/SqlRunnerStorage.ts +46 -7
- package/src/unstable/cluster/TestRunner.ts +18 -1
- package/src/unstable/cluster/index.ts +790 -0
- package/src/unstable/cluster/internal/hash.ts +12 -0
- package/src/unstable/devtools/DevTools.ts +26 -3
- package/src/unstable/devtools/DevToolsClient.ts +32 -5
- package/src/unstable/devtools/DevToolsSchema.ts +201 -44
- package/src/unstable/devtools/DevToolsServer.ts +27 -2
- package/src/unstable/devtools/index.ts +58 -0
- package/src/unstable/encoding/Msgpack.ts +97 -12
- package/src/unstable/encoding/Ndjson.ts +149 -21
- package/src/unstable/encoding/Sse.ts +109 -18
- package/src/unstable/encoding/index.ts +49 -0
- package/src/unstable/eventlog/Event.ts +131 -30
- package/src/unstable/eventlog/EventGroup.ts +50 -17
- package/src/unstable/eventlog/EventJournal.ts +120 -20
- package/src/unstable/eventlog/EventLog.ts +150 -31
- package/src/unstable/eventlog/EventLogEncryption.ts +42 -6
- package/src/unstable/eventlog/EventLogMessage.ts +92 -18
- package/src/unstable/eventlog/EventLogRemote.ts +54 -8
- package/src/unstable/eventlog/EventLogServer.ts +33 -3
- package/src/unstable/eventlog/EventLogServerEncrypted.ts +52 -6
- package/src/unstable/eventlog/EventLogServerUnencrypted.ts +90 -16
- package/src/unstable/eventlog/EventLogSessionAuth.ts +77 -15
- package/src/unstable/eventlog/SqlEventJournal.ts +28 -2
- package/src/unstable/eventlog/SqlEventLogServerEncrypted.ts +32 -3
- package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +28 -2
- package/src/unstable/eventlog/index.ts +240 -0
- package/src/unstable/http/Cookies.ts +156 -77
- package/src/unstable/http/Etag.ts +40 -7
- package/src/unstable/http/FetchHttpClient.ts +33 -4
- package/src/unstable/http/FindMyWay.ts +1 -1
- package/src/unstable/http/Headers.ts +252 -50
- package/src/unstable/http/HttpBody.ts +128 -26
- package/src/unstable/http/HttpClient.ts +204 -96
- package/src/unstable/http/HttpClientError.ts +80 -12
- package/src/unstable/http/HttpClientRequest.ts +318 -100
- package/src/unstable/http/HttpClientResponse.ts +59 -16
- package/src/unstable/http/HttpEffect.ts +66 -18
- package/src/unstable/http/HttpIncomingMessage.ts +48 -7
- package/src/unstable/http/HttpMethod.ts +38 -6
- package/src/unstable/http/HttpMiddleware.ts +60 -11
- package/src/unstable/http/HttpPlatform.ts +34 -3
- package/src/unstable/http/HttpRouter.ts +232 -69
- package/src/unstable/http/HttpServer.ts +151 -22
- package/src/unstable/http/HttpServerError.ts +93 -10
- package/src/unstable/http/HttpServerRequest.ts +125 -21
- package/src/unstable/http/HttpServerRespondable.ts +49 -6
- package/src/unstable/http/HttpServerResponse.ts +391 -67
- package/src/unstable/http/HttpStaticServer.ts +24 -8
- package/src/unstable/http/HttpTraceContext.ts +53 -6
- package/src/unstable/http/Multipart.ts +179 -28
- package/src/unstable/http/Multipasta/HeadersParser.ts +1 -1
- package/src/unstable/http/Multipasta/Node.ts +1 -1
- package/src/unstable/http/Multipasta/Search.ts +1 -1
- package/src/unstable/http/Multipasta/Web.ts +1 -1
- package/src/unstable/http/Multipasta.ts +1 -1
- package/src/unstable/http/Template.ts +53 -1
- package/src/unstable/http/Url.ts +70 -56
- package/src/unstable/http/UrlParams.ts +237 -51
- package/src/unstable/http/index.ts +452 -0
- package/src/unstable/httpapi/HttpApi.ts +49 -14
- package/src/unstable/httpapi/HttpApiBuilder.ts +81 -16
- package/src/unstable/httpapi/HttpApiClient.ts +78 -15
- package/src/unstable/httpapi/HttpApiEndpoint.ts +238 -59
- package/src/unstable/httpapi/HttpApiError.ts +100 -1
- package/src/unstable/httpapi/HttpApiGroup.ts +87 -20
- package/src/unstable/httpapi/HttpApiMiddleware.ts +113 -22
- package/src/unstable/httpapi/HttpApiScalar.ts +38 -4
- package/src/unstable/httpapi/HttpApiSchema.ts +86 -38
- package/src/unstable/httpapi/HttpApiSecurity.ts +73 -17
- package/src/unstable/httpapi/HttpApiSwagger.ts +23 -3
- package/src/unstable/httpapi/HttpApiTest.ts +26 -1
- package/src/unstable/httpapi/OpenApi.ts +115 -15
- package/src/unstable/httpapi/index.ts +310 -25
- package/src/unstable/observability/Otlp.ts +33 -3
- package/src/unstable/observability/OtlpExporter.ts +32 -1
- package/src/unstable/observability/OtlpLogger.ts +32 -2
- package/src/unstable/observability/OtlpMetrics.ts +39 -5
- package/src/unstable/observability/OtlpResource.ts +68 -12
- package/src/unstable/observability/OtlpSerialization.ts +28 -3
- package/src/unstable/observability/OtlpTracer.ts +41 -2
- package/src/unstable/observability/PrometheusMetrics.ts +36 -16
- package/src/unstable/observability/index.ts +160 -3
- package/src/unstable/persistence/KeyValueStore.ts +108 -28
- package/src/unstable/persistence/Persistable.ts +76 -15
- package/src/unstable/persistence/PersistedCache.ts +27 -2
- package/src/unstable/persistence/PersistedQueue.ts +98 -16
- package/src/unstable/persistence/Persistence.ts +98 -16
- package/src/unstable/persistence/RateLimiter.ts +101 -21
- package/src/unstable/persistence/Redis.ts +42 -5
- package/src/unstable/persistence/index.ts +147 -0
- package/src/unstable/process/ChildProcess.ts +90 -66
- package/src/unstable/process/ChildProcessSpawner.ts +23 -12
- package/src/unstable/process/index.ts +2 -1
- package/src/unstable/reactivity/AsyncResult.ts +204 -61
- package/src/unstable/reactivity/Atom.ts +598 -139
- package/src/unstable/reactivity/AtomHttpApi.ts +41 -2
- package/src/unstable/reactivity/AtomRef.ts +51 -7
- package/src/unstable/reactivity/AtomRegistry.ts +141 -22
- package/src/unstable/reactivity/AtomRpc.ts +36 -2
- package/src/unstable/reactivity/Hydration.ts +45 -5
- package/src/unstable/reactivity/Reactivity.ts +94 -13
- package/src/unstable/reactivity/index.ts +167 -0
- package/src/unstable/rpc/Rpc.ts +254 -56
- package/src/unstable/rpc/RpcClient.ts +106 -19
- package/src/unstable/rpc/RpcClientError.ts +26 -2
- package/src/unstable/rpc/RpcGroup.ts +51 -8
- package/src/unstable/rpc/RpcMessage.ts +128 -32
- package/src/unstable/rpc/RpcMiddleware.ts +100 -20
- package/src/unstable/rpc/RpcSchema.ts +38 -4
- package/src/unstable/rpc/RpcSerialization.ts +60 -13
- package/src/unstable/rpc/RpcServer.ts +107 -23
- package/src/unstable/rpc/RpcTest.ts +20 -1
- package/src/unstable/rpc/RpcWorker.ts +39 -6
- package/src/unstable/rpc/Utils.ts +33 -0
- package/src/unstable/rpc/index.ts +272 -0
- package/src/unstable/schema/Model.ts +245 -61
- package/src/unstable/schema/VariantSchema.ts +101 -24
- package/src/unstable/schema/index.ts +37 -0
- package/src/unstable/socket/Socket.ts +168 -34
- package/src/unstable/socket/SocketServer.ts +58 -10
- package/src/unstable/socket/index.ts +44 -0
- package/src/unstable/sql/Migrator.ts +61 -9
- package/src/unstable/sql/SqlClient.ts +59 -2
- package/src/unstable/sql/SqlConnection.ts +34 -3
- package/src/unstable/sql/SqlError.ts +135 -0
- package/src/unstable/sql/SqlModel.ts +25 -5
- package/src/unstable/sql/SqlResolver.ts +56 -13
- package/src/unstable/sql/SqlSchema.ts +29 -8
- package/src/unstable/sql/SqlStream.ts +24 -0
- package/src/unstable/sql/Statement.ts +168 -24
- package/src/unstable/sql/index.ts +179 -1
- package/src/unstable/workers/Transferable.ts +72 -20
- package/src/unstable/workers/Worker.ts +61 -8
- package/src/unstable/workers/WorkerError.ts +50 -9
- package/src/unstable/workers/WorkerRunner.ts +32 -3
- package/src/unstable/workers/index.ts +81 -1
- package/src/unstable/workflow/Activity.ts +61 -10
- package/src/unstable/workflow/DurableClock.ts +26 -3
- package/src/unstable/workflow/DurableDeferred.ts +148 -31
- package/src/unstable/workflow/DurableQueue.ts +33 -8
- package/src/unstable/workflow/Workflow.ts +123 -31
- package/src/unstable/workflow/WorkflowEngine.ts +40 -5
- package/src/unstable/workflow/WorkflowProxy.ts +40 -12
- package/src/unstable/workflow/WorkflowProxyServer.ts +41 -6
- package/src/unstable/workflow/index.ts +160 -0
package/dist/index.js
CHANGED
|
@@ -152,6 +152,41 @@ export * as Boolean from "./Boolean.js";
|
|
|
152
152
|
*/
|
|
153
153
|
export * as Brand from "./Brand.js";
|
|
154
154
|
/**
|
|
155
|
+
* The `Cache` module provides an effectful, mutable key-value cache for values
|
|
156
|
+
* that are computed by a lookup function. A `Cache<Key, A, E, R>` stores lookup
|
|
157
|
+
* results for keys, shares concurrent lookups for the same key, and manages
|
|
158
|
+
* entry lifetime with capacity limits and optional time-to-live policies.
|
|
159
|
+
*
|
|
160
|
+
* **Mental model**
|
|
161
|
+
*
|
|
162
|
+
* - A cache is created from a lookup function and a maximum capacity
|
|
163
|
+
* - {@link get} returns a cached value when present, or runs the lookup on a miss
|
|
164
|
+
* - Concurrent misses for the same key share one pending lookup
|
|
165
|
+
* - Lookup failures are cached as failures until the entry expires, is invalidated, or is refreshed
|
|
166
|
+
* - Entries can live forever, expire after a fixed duration, or use a dynamic TTL based on the lookup `Exit`
|
|
167
|
+
* - Capacity is enforced by removing the oldest stored entries when new entries are added
|
|
168
|
+
*
|
|
169
|
+
* **Common tasks**
|
|
170
|
+
*
|
|
171
|
+
* - Create a cache: {@link make}, {@link makeWith}
|
|
172
|
+
* - Read values: {@link get}, {@link getOption}, {@link getSuccess}
|
|
173
|
+
* - Seed or overwrite values: {@link set}
|
|
174
|
+
* - Refresh values: {@link refresh}
|
|
175
|
+
* - Remove entries: {@link invalidate}, {@link invalidateWhen}, {@link invalidateAll}
|
|
176
|
+
* - Inspect contents: {@link has}, {@link size}, {@link keys}, {@link values}, {@link entries}
|
|
177
|
+
*
|
|
178
|
+
* **Gotchas**
|
|
179
|
+
*
|
|
180
|
+
* - {@link getOption} does not run the lookup; it only reads an existing non-expired entry
|
|
181
|
+
* - {@link size} may include expired entries until they are observed and removed
|
|
182
|
+
* - {@link values} and {@link entries} include only successfully resolved entries
|
|
183
|
+
* - Use `Data` or another `Equal`-compatible key type when keys need structural equality
|
|
184
|
+
*
|
|
185
|
+
* **See also**
|
|
186
|
+
*
|
|
187
|
+
* - {@link Duration} for configuring fixed or dynamic time-to-live values
|
|
188
|
+
* - {@link Effect} for the lookup effects used to compute cached values
|
|
189
|
+
*
|
|
155
190
|
* @since 4.0.0
|
|
156
191
|
*/
|
|
157
192
|
export * as Cache from "./Cache.js";
|
|
@@ -265,7 +300,8 @@ export * as Cause from "./Cause.js";
|
|
|
265
300
|
* 2. **Sequencing**: Use the result of one channel to create another
|
|
266
301
|
* 3. **Concatenating**: Combine multiple channels into a single channel
|
|
267
302
|
*
|
|
268
|
-
*
|
|
303
|
+
* **Example** (Creating a simple channel)
|
|
304
|
+
*
|
|
269
305
|
* ```ts
|
|
270
306
|
* import { Channel } from "effect"
|
|
271
307
|
*
|
|
@@ -278,7 +314,8 @@ export * as Cause from "./Cause.js";
|
|
|
278
314
|
* // Running the channel would output: 84
|
|
279
315
|
* ```
|
|
280
316
|
*
|
|
281
|
-
*
|
|
317
|
+
* **Example** (Transforming array-backed channels)
|
|
318
|
+
*
|
|
282
319
|
* ```ts
|
|
283
320
|
* import { Channel } from "effect"
|
|
284
321
|
*
|
|
@@ -295,6 +332,48 @@ export * as Cause from "./Cause.js";
|
|
|
295
332
|
*/
|
|
296
333
|
export * as Channel from "./Channel.js";
|
|
297
334
|
/**
|
|
335
|
+
* The `ChannelSchema` module provides helpers for applying `Schema` encoding
|
|
336
|
+
* and decoding at `Channel` boundaries. It is useful when a channel should
|
|
337
|
+
* expose typed values to application code while communicating with an upstream
|
|
338
|
+
* or downstream component through an encoded representation such as JSON-ready
|
|
339
|
+
* data, wire protocol values, or any other schema-defined format.
|
|
340
|
+
*
|
|
341
|
+
* **Mental model**
|
|
342
|
+
*
|
|
343
|
+
* - A channel schema adapter is a streaming boundary: chunks flow through a
|
|
344
|
+
* `Channel`, and each non-empty chunk is validated and transformed with a
|
|
345
|
+
* `Schema`
|
|
346
|
+
* - `encode` turns typed schema values into their encoded representation before
|
|
347
|
+
* they leave a typed part of a pipeline
|
|
348
|
+
* - `decode` turns encoded input into typed schema values before application
|
|
349
|
+
* code consumes them
|
|
350
|
+
* - `duplex` wraps a bidirectional channel so callers work with typed input and
|
|
351
|
+
* output while the wrapped channel continues to operate on encoded chunks
|
|
352
|
+
* - Schema failures are surfaced through the channel error type as
|
|
353
|
+
* `SchemaError`, and schema services are reflected in the channel
|
|
354
|
+
* requirements
|
|
355
|
+
*
|
|
356
|
+
* **Common tasks**
|
|
357
|
+
*
|
|
358
|
+
* - Encode typed channel input before sending it to an encoded transport:
|
|
359
|
+
* {@link encode}
|
|
360
|
+
* - Decode encoded channel output before handling it as domain data:
|
|
361
|
+
* {@link decode}
|
|
362
|
+
* - Use unknown encoded boundaries when static encoded types are intentionally
|
|
363
|
+
* erased: {@link encodeUnknown} and {@link decodeUnknown}
|
|
364
|
+
* - Wrap a bidirectional encoded channel with typed input and output schemas:
|
|
365
|
+
* {@link duplex} or {@link duplexUnknown}
|
|
366
|
+
*
|
|
367
|
+
* **Gotchas**
|
|
368
|
+
*
|
|
369
|
+
* - These helpers operate on `NonEmptyReadonlyArray` chunks, so schemas are
|
|
370
|
+
* applied to non-empty batches rather than individual scalar values
|
|
371
|
+
* - Encoding and decoding can require services from the schema; those
|
|
372
|
+
* requirements become part of the resulting channel type
|
|
373
|
+
* - `duplex` encodes values flowing into the wrapped channel and decodes values
|
|
374
|
+
* emitted by it, so choose `inputSchema` and `outputSchema` from the
|
|
375
|
+
* perspective of the typed caller
|
|
376
|
+
*
|
|
298
377
|
* @since 4.0.0
|
|
299
378
|
*/
|
|
300
379
|
export * as ChannelSchema from "./ChannelSchema.js";
|
|
@@ -328,7 +407,8 @@ export * as ChannelSchema from "./ChannelSchema.js";
|
|
|
328
407
|
* - **Iteration**: O(n)
|
|
329
408
|
* - **Memory**: Structural sharing minimizes allocation
|
|
330
409
|
*
|
|
331
|
-
*
|
|
410
|
+
* **Example** (Creating and combining chunks)
|
|
411
|
+
*
|
|
332
412
|
* ```ts
|
|
333
413
|
* import { Chunk } from "effect"
|
|
334
414
|
*
|
|
@@ -342,7 +422,8 @@ export * as ChannelSchema from "./ChannelSchema.js";
|
|
|
342
422
|
* console.log(Chunk.toReadonlyArray(combined)) // [1, 2, 3, 4, 5, 6]
|
|
343
423
|
* ```
|
|
344
424
|
*
|
|
345
|
-
*
|
|
425
|
+
* **Example** (Transforming chunks)
|
|
426
|
+
*
|
|
346
427
|
* ```ts
|
|
347
428
|
* import { Chunk } from "effect"
|
|
348
429
|
*
|
|
@@ -353,17 +434,17 @@ export * as ChannelSchema from "./ChannelSchema.js";
|
|
|
353
434
|
* const sum = Chunk.reduce(evens, 0, (acc, n) => acc + n) // 12
|
|
354
435
|
* ```
|
|
355
436
|
*
|
|
356
|
-
*
|
|
437
|
+
* **Example** (Processing chunks with Effect)
|
|
438
|
+
*
|
|
357
439
|
* ```ts
|
|
358
440
|
* import { Chunk, Effect } from "effect"
|
|
359
441
|
*
|
|
360
442
|
* // Working with Effects
|
|
361
|
-
* const processChunk = (chunk: Chunk.Chunk<number>)
|
|
362
|
-
*
|
|
363
|
-
*
|
|
364
|
-
*
|
|
365
|
-
*
|
|
366
|
-
* })
|
|
443
|
+
* const processChunk = Effect.fnUntraced(function*(chunk: Chunk.Chunk<number>) {
|
|
444
|
+
* const mapped = Chunk.map(chunk, (n) => n * 2)
|
|
445
|
+
* const filtered = Chunk.filter(mapped, (n) => n > 5)
|
|
446
|
+
* return Chunk.toReadonlyArray(filtered)
|
|
447
|
+
* })
|
|
367
448
|
* ```
|
|
368
449
|
*
|
|
369
450
|
* @since 2.0.0
|
|
@@ -388,7 +469,8 @@ export * as Chunk from "./Chunk.js";
|
|
|
388
469
|
* - **Testable**: Mock time control for deterministic testing
|
|
389
470
|
* - **Resource-safe**: Automatic cleanup of time-based resources
|
|
390
471
|
*
|
|
391
|
-
*
|
|
472
|
+
* **Example** (Measuring elapsed time)
|
|
473
|
+
*
|
|
392
474
|
* ```ts
|
|
393
475
|
* import { Clock, Effect } from "effect"
|
|
394
476
|
*
|
|
@@ -407,7 +489,8 @@ export * as Chunk from "./Chunk.js";
|
|
|
407
489
|
* })
|
|
408
490
|
* ```
|
|
409
491
|
*
|
|
410
|
-
*
|
|
492
|
+
* **Example** (Using the Clock service)
|
|
493
|
+
*
|
|
411
494
|
* ```ts
|
|
412
495
|
* import { Clock, Effect } from "effect"
|
|
413
496
|
*
|
|
@@ -668,7 +751,8 @@ export * as ConfigProvider from "./ConfigProvider.js";
|
|
|
668
751
|
* - **Data display**: `table`, `dir`, `dirxml` for structured data visualization
|
|
669
752
|
* - **Utilities**: `clear`, `count`, `countReset`, `trace`
|
|
670
753
|
*
|
|
671
|
-
*
|
|
754
|
+
* **Example** (Logging basic messages)
|
|
755
|
+
*
|
|
672
756
|
* ```ts
|
|
673
757
|
* import { Console, Effect } from "effect"
|
|
674
758
|
*
|
|
@@ -681,7 +765,8 @@ export * as ConfigProvider from "./ConfigProvider.js";
|
|
|
681
765
|
* })
|
|
682
766
|
* ```
|
|
683
767
|
*
|
|
684
|
-
*
|
|
768
|
+
* **Example** (Grouping timed logs)
|
|
769
|
+
*
|
|
685
770
|
* ```ts
|
|
686
771
|
* import { Console, Effect } from "effect"
|
|
687
772
|
*
|
|
@@ -698,7 +783,8 @@ export * as ConfigProvider from "./ConfigProvider.js";
|
|
|
698
783
|
* )
|
|
699
784
|
* ```
|
|
700
785
|
*
|
|
701
|
-
*
|
|
786
|
+
* **Example** (Displaying structured data)
|
|
787
|
+
*
|
|
702
788
|
* ```ts
|
|
703
789
|
* import { Console, Effect } from "effect"
|
|
704
790
|
*
|
|
@@ -732,9 +818,105 @@ export * as Console from "./Console.js";
|
|
|
732
818
|
*/
|
|
733
819
|
export * as Context from "./Context.js";
|
|
734
820
|
/**
|
|
821
|
+
* The `Cron` module provides utilities for representing recurring calendar
|
|
822
|
+
* schedules with cron expressions. A `Cron` value stores allowed seconds,
|
|
823
|
+
* minutes, hours, days of month, months, weekdays, and an optional time zone,
|
|
824
|
+
* then uses those constraints to test dates and find scheduled occurrences.
|
|
825
|
+
*
|
|
826
|
+
* **Mental model**
|
|
827
|
+
*
|
|
828
|
+
* - A cron schedule is a set of allowed values for each time field
|
|
829
|
+
* - Expressions may use five fields (`minute hour day month weekday`) or six
|
|
830
|
+
* fields (`second minute hour day month weekday`); five-field expressions
|
|
831
|
+
* default seconds to `0`
|
|
832
|
+
* - Each field supports `*`, comma-separated values, ranges, and step syntax
|
|
833
|
+
* - Month and weekday fields support aliases such as `JAN`, `DEC`, `SUN`, and
|
|
834
|
+
* `MON`
|
|
835
|
+
* - Empty internal field sets represent an unconstrained field, the same idea
|
|
836
|
+
* as `*`
|
|
837
|
+
* - When both day-of-month and weekday are constrained, matching uses cron's
|
|
838
|
+
* inclusive behavior: either field may match
|
|
839
|
+
*
|
|
840
|
+
* **Common tasks**
|
|
841
|
+
*
|
|
842
|
+
* - Build directly from field constraints: {@link make}
|
|
843
|
+
* - Parse expressions safely: {@link parse}
|
|
844
|
+
* - Parse expressions and throw on invalid input: {@link parseUnsafe}
|
|
845
|
+
* - Check whether a date satisfies a schedule: {@link match}
|
|
846
|
+
* - Find adjacent scheduled dates: {@link next}, {@link prev}
|
|
847
|
+
* - Iterate future scheduled dates: {@link sequence}
|
|
848
|
+
* - Compare schedule constraints: {@link equals}, {@link Equivalence}
|
|
849
|
+
* - Detect parse failures: {@link CronParseError}, {@link isCronParseError}
|
|
850
|
+
*
|
|
851
|
+
* **Gotchas**
|
|
852
|
+
*
|
|
853
|
+
* - Weekdays are numbered `0` through `6`, with `0` representing Sunday
|
|
854
|
+
* - Months are numbered `1` through `12`, while JavaScript `Date` months are
|
|
855
|
+
* zero-based
|
|
856
|
+
* - `*` normalizes to an empty set internally, so inspect schedules with the
|
|
857
|
+
* public helpers instead of assuming every allowed value is stored
|
|
858
|
+
* - `next` and `prev` search strictly after or before the provided instant
|
|
859
|
+
* - Time-zone-aware schedules account for daylight saving transitions; during
|
|
860
|
+
* a fall-back transition, repeated local times are emitted once when moving
|
|
861
|
+
* forward
|
|
862
|
+
*
|
|
735
863
|
* @since 2.0.0
|
|
736
864
|
*/
|
|
737
865
|
export * as Cron from "./Cron.js";
|
|
866
|
+
/**
|
|
867
|
+
* The `Crypto` module provides a platform-agnostic service for cryptographic
|
|
868
|
+
* operations. Runtime packages such as `@effect/platform-node`,
|
|
869
|
+
* `@effect/platform-bun`, and `@effect/platform-browser` provide concrete
|
|
870
|
+
* implementations backed by the host platform's cryptography APIs.
|
|
871
|
+
*
|
|
872
|
+
* Use `Crypto` for cryptographic randomness, UUID generation, random values,
|
|
873
|
+
* and message digests. The base `Random` service is not cryptographically
|
|
874
|
+
* secure unless you replace it with a cryptographically secure implementation.
|
|
875
|
+
*
|
|
876
|
+
* @example
|
|
877
|
+
* ```ts
|
|
878
|
+
* import { Console, Crypto, Effect, Layer } from "effect"
|
|
879
|
+
*
|
|
880
|
+
* const TestCrypto = Layer.succeed(
|
|
881
|
+
* Crypto.Crypto,
|
|
882
|
+
* Crypto.make({
|
|
883
|
+
* randomBytes: (size) => new Uint8Array(size),
|
|
884
|
+
* digest: (_algorithm, data) => Effect.succeed(data)
|
|
885
|
+
* })
|
|
886
|
+
* )
|
|
887
|
+
*
|
|
888
|
+
* const program = Effect.gen(function*() {
|
|
889
|
+
* const crypto = yield* Crypto.Crypto
|
|
890
|
+
* const id = yield* crypto.randomUUIDv4
|
|
891
|
+
* yield* Console.log(`Created id: ${id}`)
|
|
892
|
+
* })
|
|
893
|
+
*
|
|
894
|
+
* Effect.runPromise(Effect.provide(program, TestCrypto))
|
|
895
|
+
* ```
|
|
896
|
+
*
|
|
897
|
+
* @example
|
|
898
|
+
* ```ts
|
|
899
|
+
* import { Crypto, Effect, Layer } from "effect"
|
|
900
|
+
*
|
|
901
|
+
* const TestCrypto = Layer.succeed(
|
|
902
|
+
* Crypto.Crypto,
|
|
903
|
+
* Crypto.make({
|
|
904
|
+
* randomBytes: (size) => new Uint8Array(size),
|
|
905
|
+
* digest: (_algorithm, data) => Effect.succeed(data)
|
|
906
|
+
* })
|
|
907
|
+
* )
|
|
908
|
+
*
|
|
909
|
+
* const program = Effect.gen(function*() {
|
|
910
|
+
* const crypto = yield* Crypto.Crypto
|
|
911
|
+
* return yield* crypto.randomBytes(32)
|
|
912
|
+
* })
|
|
913
|
+
*
|
|
914
|
+
* Effect.runPromise(Effect.provide(program, TestCrypto))
|
|
915
|
+
* ```
|
|
916
|
+
*
|
|
917
|
+
* @since 4.0.0
|
|
918
|
+
*/
|
|
919
|
+
export * as Crypto from "./Crypto.js";
|
|
738
920
|
/**
|
|
739
921
|
* Immutable data constructors with discriminated-union support.
|
|
740
922
|
*
|
|
@@ -810,6 +992,55 @@ export * as Cron from "./Cron.js";
|
|
|
810
992
|
*/
|
|
811
993
|
export * as Data from "./Data.js";
|
|
812
994
|
/**
|
|
995
|
+
* The `DateTime` module provides immutable data types and utilities for working
|
|
996
|
+
* with instants, UTC date-times, zoned date-times, and time zones. A
|
|
997
|
+
* `DateTime` is always an absolute point in time, represented internally by
|
|
998
|
+
* epoch milliseconds, and may also carry a `TimeZone` for zone-aware calendar
|
|
999
|
+
* parts and formatting.
|
|
1000
|
+
*
|
|
1001
|
+
* **Mental model**
|
|
1002
|
+
*
|
|
1003
|
+
* - `DateTime` is a discriminated union: `Utc | Zoned`
|
|
1004
|
+
* - `Utc` stores an absolute instant without an associated time zone
|
|
1005
|
+
* - `Zoned` stores the same kind of absolute instant plus a `TimeZone`
|
|
1006
|
+
* - Time zones can be fixed offsets or named IANA zones such as `"Europe/Rome"`
|
|
1007
|
+
* - Comparison and ordering use the instant, so two values in different zones
|
|
1008
|
+
* can still be equivalent
|
|
1009
|
+
* - Calendar parts and formatted output depend on whether you ask for UTC parts
|
|
1010
|
+
* or zone-adjusted parts
|
|
1011
|
+
*
|
|
1012
|
+
* **Common tasks**
|
|
1013
|
+
*
|
|
1014
|
+
* - Construct values: {@link make}, {@link makeUnsafe}, {@link makeZoned}, {@link makeZonedUnsafe}
|
|
1015
|
+
* - Get the current instant: {@link now}, {@link nowInCurrentZone}
|
|
1016
|
+
* - Create time zones: {@link zoneMakeOffset}, {@link zoneMakeNamed}, {@link zoneFromString}
|
|
1017
|
+
* - Attach or change zones: {@link setZone}, {@link setZoneNamed}, {@link setZoneCurrent}, {@link toUtc}
|
|
1018
|
+
* - Convert to platform values or parts: {@link toDate}, {@link toDateUtc}, {@link toEpochMillis}, {@link toParts}, {@link toPartsUtc}
|
|
1019
|
+
* - Compare and bound values: {@link Equivalence}, {@link Order}, {@link distance}, {@link min}, {@link max}, {@link clamp}, {@link between}
|
|
1020
|
+
* - Transform values: {@link add}, {@link subtract}, {@link startOf}, {@link endOf}, {@link nearest}, {@link setParts}, {@link mutate}
|
|
1021
|
+
* - Format values: {@link format}, {@link formatUtc}, {@link formatLocal}, {@link formatIntl}, {@link formatIso}, {@link formatIsoZoned}
|
|
1022
|
+
* - Provide an application time zone: {@link CurrentTimeZone}, {@link withCurrentZone}, {@link layerCurrentZone}
|
|
1023
|
+
*
|
|
1024
|
+
* **Gotchas**
|
|
1025
|
+
*
|
|
1026
|
+
* - `make` and `makeZoned` return `Option`; unsafe constructors throw on invalid
|
|
1027
|
+
* input
|
|
1028
|
+
* - `DateTime` equality is instant-based, not display-time-based
|
|
1029
|
+
* - `setZone` changes the zone used for local parts and formatting without
|
|
1030
|
+
* changing the represented instant
|
|
1031
|
+
* - Use `adjustForTimeZone` with {@link makeZoned} when input parts should be
|
|
1032
|
+
* interpreted as wall-clock time in the target zone
|
|
1033
|
+
* - Daylight-saving gaps and repeated local times are resolved with
|
|
1034
|
+
* `Disambiguation`
|
|
1035
|
+
* - Prefer the Clock-backed {@link now} and `CurrentTimeZone` services in
|
|
1036
|
+
* Effect workflows; unsafe helpers read from the host environment directly
|
|
1037
|
+
*
|
|
1038
|
+
* **See also**
|
|
1039
|
+
*
|
|
1040
|
+
* - {@link DateTime} for the UTC/zoned data model
|
|
1041
|
+
* - {@link TimeZone} for offset and named time-zone values
|
|
1042
|
+
* - {@link Disambiguation} for daylight-saving ambiguity handling
|
|
1043
|
+
*
|
|
813
1044
|
* @since 3.6.0
|
|
814
1045
|
*/
|
|
815
1046
|
export * as DateTime from "./DateTime.js";
|
|
@@ -830,7 +1061,8 @@ export * as DateTime from "./DateTime.js";
|
|
|
830
1061
|
* - **Fiber-safe**: Thread-safe operations across concurrent fibers
|
|
831
1062
|
* - **Composable**: Works seamlessly with other Effect operations
|
|
832
1063
|
*
|
|
833
|
-
*
|
|
1064
|
+
* **Example** (Coordinating fibers with a Deferred)
|
|
1065
|
+
*
|
|
834
1066
|
* ```ts
|
|
835
1067
|
* import { Deferred, Effect, Fiber } from "effect"
|
|
836
1068
|
*
|
|
@@ -883,6 +1115,42 @@ export * as DateTime from "./DateTime.js";
|
|
|
883
1115
|
*/
|
|
884
1116
|
export * as Deferred from "./Deferred.js";
|
|
885
1117
|
/**
|
|
1118
|
+
* The `Differ` module defines the core abstraction for describing changes to a
|
|
1119
|
+
* value. A `Differ<T, Patch>` knows how to compare two `T` values, produce a
|
|
1120
|
+
* patch that represents the difference, combine multiple patches, and apply a
|
|
1121
|
+
* patch to an old value to obtain the updated value.
|
|
1122
|
+
*
|
|
1123
|
+
* **Mental model**
|
|
1124
|
+
*
|
|
1125
|
+
* - A differ separates "what changed" from "the value after the change"
|
|
1126
|
+
* - `diff(oldValue, newValue)` produces a `Patch` that can later be applied
|
|
1127
|
+
* - `patch(oldValue, patch)` replays a patch against a value of the same domain
|
|
1128
|
+
* - `empty` is the identity patch: applying it should leave the value unchanged
|
|
1129
|
+
* - `combine(first, second)` composes patches in sequence, where `second`
|
|
1130
|
+
* represents changes that happen after `first`
|
|
1131
|
+
* - Patch types are chosen by the differ implementation and may be compact,
|
|
1132
|
+
* domain-specific, or compatible with a serialization format such as JSON
|
|
1133
|
+
* Patch
|
|
1134
|
+
*
|
|
1135
|
+
* **Common tasks**
|
|
1136
|
+
*
|
|
1137
|
+
* - Construct a differ by providing the four operations of the {@link Differ}
|
|
1138
|
+
* interface
|
|
1139
|
+
* - Compute a patch with `diff` when you have an old value and a new value
|
|
1140
|
+
* - Store, transmit, or aggregate patches instead of storing full replacement
|
|
1141
|
+
* values
|
|
1142
|
+
* - Combine incremental updates with `combine` before applying them
|
|
1143
|
+
* - Apply updates with `patch` to reconstruct the next value from a previous
|
|
1144
|
+
* value and a patch
|
|
1145
|
+
*
|
|
1146
|
+
* **Gotchas**
|
|
1147
|
+
*
|
|
1148
|
+
* - `combine` is order-sensitive for most patch formats
|
|
1149
|
+
* - A patch is generally meaningful only for values that belong to the same
|
|
1150
|
+
* domain and assumptions used by the differ that created it
|
|
1151
|
+
* - Differs should make `empty` a true identity and should make combined
|
|
1152
|
+
* patches behave the same as applying the original patches in order
|
|
1153
|
+
*
|
|
886
1154
|
* @since 4.0.0
|
|
887
1155
|
*/
|
|
888
1156
|
export * as Differ from "./Differ.js";
|
|
@@ -924,7 +1192,8 @@ export * as Duration from "./Duration.js";
|
|
|
924
1192
|
* - **Testable**: Built-in support for testing with controlled environments
|
|
925
1193
|
* - **Interruptible**: Effects can be safely interrupted and cancelled
|
|
926
1194
|
*
|
|
927
|
-
*
|
|
1195
|
+
* **Example** (Usage)
|
|
1196
|
+
*
|
|
928
1197
|
* ```ts
|
|
929
1198
|
* import { Console, Effect } from "effect"
|
|
930
1199
|
*
|
|
@@ -942,7 +1211,8 @@ export * as Duration from "./Duration.js";
|
|
|
942
1211
|
* Effect.runPromise(program).then(console.log) // 13
|
|
943
1212
|
* ```
|
|
944
1213
|
*
|
|
945
|
-
*
|
|
1214
|
+
* **Example** (Usage)
|
|
1215
|
+
*
|
|
946
1216
|
* ```ts
|
|
947
1217
|
* import { Data, Effect } from "effect"
|
|
948
1218
|
*
|
|
@@ -974,6 +1244,41 @@ export * as Duration from "./Duration.js";
|
|
|
974
1244
|
*/
|
|
975
1245
|
export * as Effect from "./Effect.js";
|
|
976
1246
|
/**
|
|
1247
|
+
* The `Effectable` module provides low-level building blocks for defining
|
|
1248
|
+
* custom values that behave like `Effect`s. It is primarily used by library
|
|
1249
|
+
* authors who need domain-specific effect-like data types, such as service
|
|
1250
|
+
* keys, configuration descriptions, prompts, or other declarative programs
|
|
1251
|
+
* that can be yielded inside `Effect.gen`.
|
|
1252
|
+
*
|
|
1253
|
+
* **Mental model**
|
|
1254
|
+
*
|
|
1255
|
+
* - `Effectable` does not run effects by itself; it provides prototypes that
|
|
1256
|
+
* implement the internal Effect protocol.
|
|
1257
|
+
* - {@link Prototype} creates a primitive Effect prototype with a custom
|
|
1258
|
+
* evaluation function that receives the current `Fiber`.
|
|
1259
|
+
* - {@link Class} is an abstract base class for defining custom classes whose
|
|
1260
|
+
* instances are also `Effect` values.
|
|
1261
|
+
* - The success, error, and service requirements of the custom type are
|
|
1262
|
+
* preserved through the `Effect.Effect<A, E, R>` type parameters.
|
|
1263
|
+
*
|
|
1264
|
+
* **Common tasks**
|
|
1265
|
+
*
|
|
1266
|
+
* - Build an effect-like interface around a declarative data structure.
|
|
1267
|
+
* - Implement a custom `evaluate` hook that interprets the value in terms of
|
|
1268
|
+
* the current fiber and returns the underlying `Effect`.
|
|
1269
|
+
* - Extend {@link Class} when a nominal class-based API is more convenient
|
|
1270
|
+
* than manually wiring a prototype.
|
|
1271
|
+
*
|
|
1272
|
+
* **Gotchas**
|
|
1273
|
+
*
|
|
1274
|
+
* - This module is intentionally low-level; most application code should use
|
|
1275
|
+
* `Effect` constructors and combinators instead.
|
|
1276
|
+
* - `evaluate` must return an `Effect` with the same success, error, and
|
|
1277
|
+
* service types as the custom value.
|
|
1278
|
+
* - Because these APIs participate in the internal Effect protocol, keep
|
|
1279
|
+
* implementations small and follow existing modules such as `Config` and
|
|
1280
|
+
* `Context` when adding new effect-like types.
|
|
1281
|
+
*
|
|
977
1282
|
* @since 4.0.0
|
|
978
1283
|
*/
|
|
979
1284
|
export * as Effectable from "./Effectable.js";
|
|
@@ -1124,7 +1429,8 @@ export * as Equivalence from "./Equivalence.js";
|
|
|
1124
1429
|
* Use the annotation symbols (`ignore`, `severity`, `attributes`) on your
|
|
1125
1430
|
* error classes to control reporting behavior per-error.
|
|
1126
1431
|
*
|
|
1127
|
-
*
|
|
1432
|
+
* **Example** (Reporting errors with annotations)
|
|
1433
|
+
*
|
|
1128
1434
|
* ```ts
|
|
1129
1435
|
* import { Data, Effect, ErrorReporter } from "effect"
|
|
1130
1436
|
*
|
|
@@ -1161,6 +1467,43 @@ export * as Equivalence from "./Equivalence.js";
|
|
|
1161
1467
|
*/
|
|
1162
1468
|
export * as ErrorReporter from "./ErrorReporter.js";
|
|
1163
1469
|
/**
|
|
1470
|
+
* The `ExecutionPlan` module provides a way to describe ordered fallback
|
|
1471
|
+
* strategies for effects and streams that need different resources across
|
|
1472
|
+
* repeated attempts. An `ExecutionPlan` is a non-empty list of steps, where
|
|
1473
|
+
* each step supplies a `Context` or `Layer` and may control retries with an
|
|
1474
|
+
* attempt limit, a `Schedule`, or a `while` predicate.
|
|
1475
|
+
*
|
|
1476
|
+
* **Mental model**
|
|
1477
|
+
*
|
|
1478
|
+
* - A plan is evaluated step by step until the wrapped effect or stream
|
|
1479
|
+
* succeeds, or until every step has been exhausted
|
|
1480
|
+
* - Each step provides the services used while that step is active
|
|
1481
|
+
* - `attempts` limits how many times a step may be tried
|
|
1482
|
+
* - `schedule` controls retry timing and receives the failure input
|
|
1483
|
+
* - `while` can stop retrying a step based on the failure input
|
|
1484
|
+
* - `CurrentMetadata` exposes the current 1-based attempt and 0-based step
|
|
1485
|
+
* index to code running under a plan
|
|
1486
|
+
*
|
|
1487
|
+
* **Common tasks**
|
|
1488
|
+
*
|
|
1489
|
+
* - Build a plan with {@link make}
|
|
1490
|
+
* - Run an effect with a plan using `Effect.withExecutionPlan`
|
|
1491
|
+
* - Run a stream with a plan using `Stream.withExecutionPlan`
|
|
1492
|
+
* - Combine plans in order with {@link merge}
|
|
1493
|
+
* - Capture required services up front with `captureRequirements`
|
|
1494
|
+
* - Inspect the current attempt and step with {@link CurrentMetadata}
|
|
1495
|
+
*
|
|
1496
|
+
* **Gotchas**
|
|
1497
|
+
*
|
|
1498
|
+
* - Plans must contain at least one step
|
|
1499
|
+
* - `attempts` must be greater than zero when provided
|
|
1500
|
+
* - If `attempts` is omitted, a step is attempted once unless a `schedule` is
|
|
1501
|
+
* provided
|
|
1502
|
+
* - A `while` predicate returning `false` skips the remaining retries for that
|
|
1503
|
+
* step and moves the plan forward
|
|
1504
|
+
* - Layer, schedule, and predicate requirements are tracked in the plan type
|
|
1505
|
+
* until they are provided or captured
|
|
1506
|
+
*
|
|
1164
1507
|
* @since 3.16.0
|
|
1165
1508
|
*/
|
|
1166
1509
|
export * as ExecutionPlan from "./ExecutionPlan.js";
|
|
@@ -1241,7 +1584,8 @@ export * as Exit from "./Exit.js";
|
|
|
1241
1584
|
* - **Supervision**: Monitor and restart failed fibers
|
|
1242
1585
|
* - **Resource management**: Ensure proper cleanup on interruption
|
|
1243
1586
|
*
|
|
1244
|
-
*
|
|
1587
|
+
* **Example** (Running effects in fibers)
|
|
1588
|
+
*
|
|
1245
1589
|
* ```ts
|
|
1246
1590
|
* import { Console, Effect, Fiber } from "effect"
|
|
1247
1591
|
*
|
|
@@ -1299,14 +1643,125 @@ export * as Exit from "./Exit.js";
|
|
|
1299
1643
|
*/
|
|
1300
1644
|
export * as Fiber from "./Fiber.js";
|
|
1301
1645
|
/**
|
|
1646
|
+
* The `FiberHandle` module provides a scoped handle for managing the lifecycle
|
|
1647
|
+
* of at most one fiber at a time. A `FiberHandle<A, E>` can hold one
|
|
1648
|
+
* `Fiber<A, E>`; when a new fiber is installed, the previous fiber is
|
|
1649
|
+
* interrupted unless the operation is configured with `onlyIfMissing`.
|
|
1650
|
+
*
|
|
1651
|
+
* **Mental model**
|
|
1652
|
+
*
|
|
1653
|
+
* - A handle is either open with zero or one current fiber, or closed by its
|
|
1654
|
+
* surrounding `Scope`
|
|
1655
|
+
* - Closing the scope interrupts the current fiber and prevents new work from
|
|
1656
|
+
* being accepted
|
|
1657
|
+
* - Completed fibers remove themselves from the handle, so the handle can be
|
|
1658
|
+
* reused for later work
|
|
1659
|
+
* - Replacing a fiber uses the handle's internal interruption id, allowing
|
|
1660
|
+
* expected replacement interruptions to be distinguished from real failures
|
|
1661
|
+
*
|
|
1662
|
+
* **Common tasks**
|
|
1663
|
+
*
|
|
1664
|
+
* - Create a scoped handle: {@link make}
|
|
1665
|
+
* - Fork an effect into the handle: {@link run}
|
|
1666
|
+
* - Store an existing fiber: {@link set}
|
|
1667
|
+
* - Read or clear the current fiber: {@link get}, {@link clear}
|
|
1668
|
+
* - Capture runtime-specific runners: {@link makeRuntime}, {@link runtime}
|
|
1669
|
+
* - Run handled effects as Promises: {@link makeRuntimePromise},
|
|
1670
|
+
* {@link runtimePromise}
|
|
1671
|
+
* - Wait for failure or closure: {@link join}
|
|
1672
|
+
* - Wait until the current fiber is gone: {@link awaitEmpty}
|
|
1673
|
+
*
|
|
1674
|
+
* **Gotchas**
|
|
1675
|
+
*
|
|
1676
|
+
* - The handle never contains more than one live fiber; starting or setting
|
|
1677
|
+
* another fiber interrupts the previous one by default
|
|
1678
|
+
* - Use `onlyIfMissing` when a call should leave an already running fiber in
|
|
1679
|
+
* place instead of replacing it
|
|
1680
|
+
* - `join` observes the handle's failure/close signal; successful fiber
|
|
1681
|
+
* completion only empties the handle
|
|
1682
|
+
* - `awaitEmpty` waits for the fiber that is current when it starts; later
|
|
1683
|
+
* calls to {@link run} or {@link set} can install new work
|
|
1684
|
+
*
|
|
1302
1685
|
* @since 2.0.0
|
|
1303
1686
|
*/
|
|
1304
1687
|
export * as FiberHandle from "./FiberHandle.js";
|
|
1305
1688
|
/**
|
|
1689
|
+
* The `FiberMap` module provides a scoped, mutable collection for managing
|
|
1690
|
+
* fibers by key. A `FiberMap<K, A, E>` owns a set of running fibers, interrupts
|
|
1691
|
+
* them when its scope closes, and automatically removes each entry when the
|
|
1692
|
+
* corresponding fiber completes.
|
|
1693
|
+
*
|
|
1694
|
+
* **Mental model**
|
|
1695
|
+
*
|
|
1696
|
+
* - A `FiberMap` is a keyed registry of fibers with lifecycle management
|
|
1697
|
+
* - Keys identify the currently active fiber for a logical task or resource
|
|
1698
|
+
* - Adding a fiber under an existing key interrupts the previous fiber by default
|
|
1699
|
+
* - Completed fibers remove themselves from the map if they are still current
|
|
1700
|
+
* - Closing the map's scope interrupts every fiber that remains in the map
|
|
1701
|
+
* - The map can surface the first non-ignored managed fiber failure via {@link join}
|
|
1702
|
+
*
|
|
1703
|
+
* **Common tasks**
|
|
1704
|
+
*
|
|
1705
|
+
* - Create a scoped map: {@link make}
|
|
1706
|
+
* - Fork effects into the map: {@link run}
|
|
1707
|
+
* - Add existing fibers: {@link set}
|
|
1708
|
+
* - Create captured runners: {@link makeRuntime}, {@link runtime}
|
|
1709
|
+
* - Bridge to Promise-based callers: {@link makeRuntimePromise}, {@link runtimePromise}
|
|
1710
|
+
* - Inspect entries: {@link get}, {@link has}, {@link size}
|
|
1711
|
+
* - Stop work: {@link remove}, {@link clear}
|
|
1712
|
+
* - Coordinate completion or failure: {@link awaitEmpty}, {@link join}
|
|
1713
|
+
*
|
|
1714
|
+
* **Gotchas**
|
|
1715
|
+
*
|
|
1716
|
+
* - `FiberMap` is scoped; use it with `Effect.scoped` or another scope owner so
|
|
1717
|
+
* managed fibers are interrupted when the scope closes
|
|
1718
|
+
* - Reusing a key is a replacement operation unless `onlyIfMissing` is enabled
|
|
1719
|
+
* - `join` waits for the map to fail or close; use {@link awaitEmpty} to wait
|
|
1720
|
+
* until all currently managed fibers have completed
|
|
1721
|
+
* - The `Unsafe` variants mutate synchronously and should only be used when the
|
|
1722
|
+
* caller already controls the surrounding execution context
|
|
1723
|
+
*
|
|
1306
1724
|
* @since 2.0.0
|
|
1307
1725
|
*/
|
|
1308
1726
|
export * as FiberMap from "./FiberMap.js";
|
|
1309
1727
|
/**
|
|
1728
|
+
* The `FiberSet` module provides a scoped container for managing many fibers as
|
|
1729
|
+
* one lifecycle. A `FiberSet<A, E>` tracks fibers whose successful values are
|
|
1730
|
+
* compatible with `A` and whose failures are compatible with `E`, removes each
|
|
1731
|
+
* fiber when it completes, and interrupts all still-running fibers when the
|
|
1732
|
+
* owning `Scope` closes.
|
|
1733
|
+
*
|
|
1734
|
+
* **Mental model**
|
|
1735
|
+
*
|
|
1736
|
+
* - A `FiberSet` is an owned, scoped collection of fibers
|
|
1737
|
+
* - Fibers can be added directly with {@link add} / {@link addUnsafe}
|
|
1738
|
+
* - Effects can be forked into the set with {@link run}, {@link runtime}, or
|
|
1739
|
+
* {@link runtimePromise}
|
|
1740
|
+
* - Completed fibers are automatically removed from the set
|
|
1741
|
+
* - Closing the scope or calling {@link clear} interrupts the currently tracked
|
|
1742
|
+
* fibers
|
|
1743
|
+
* - {@link join} waits for the set's first non-ignored failure, while
|
|
1744
|
+
* {@link awaitEmpty} waits until all tracked fibers have completed
|
|
1745
|
+
*
|
|
1746
|
+
* **Common tasks**
|
|
1747
|
+
*
|
|
1748
|
+
* - Create a scoped set: {@link make}
|
|
1749
|
+
* - Create scoped runners: {@link makeRuntime}, {@link makeRuntimePromise}
|
|
1750
|
+
* - Add an existing fiber: {@link add}
|
|
1751
|
+
* - Fork an effect into the set: {@link run}
|
|
1752
|
+
* - Interrupt tracked fibers: {@link clear}
|
|
1753
|
+
* - Observe the set: {@link size}, {@link awaitEmpty}, {@link join}
|
|
1754
|
+
* - Check a value: {@link isFiberSet}
|
|
1755
|
+
*
|
|
1756
|
+
* **Gotchas**
|
|
1757
|
+
*
|
|
1758
|
+
* - `FiberSet` values are scoped; use them inside `Effect.scoped` or another
|
|
1759
|
+
* scope owner so their fibers are interrupted reliably
|
|
1760
|
+
* - Adding or running into a closed set interrupts the fiber immediately
|
|
1761
|
+
* - By default, interruptions are not treated as failures for {@link join};
|
|
1762
|
+
* use the `propagateInterruption` option when interruption should be
|
|
1763
|
+
* propagated
|
|
1764
|
+
*
|
|
1310
1765
|
* @since 2.0.0
|
|
1311
1766
|
*/
|
|
1312
1767
|
export * as FiberSet from "./FiberSet.js";
|
|
@@ -1319,7 +1774,8 @@ export * as FiberSet from "./FiberSet.js";
|
|
|
1319
1774
|
* allowing you to work with files and directories in a functional, composable way. All operations
|
|
1320
1775
|
* return `Effect` values that can be composed, transformed, and executed safely.
|
|
1321
1776
|
*
|
|
1322
|
-
*
|
|
1777
|
+
* **Example** (Working with files and directories)
|
|
1778
|
+
*
|
|
1323
1779
|
* ```ts
|
|
1324
1780
|
* import { Console, Effect, FileSystem } from "effect"
|
|
1325
1781
|
*
|
|
@@ -1349,6 +1805,40 @@ export * as FiberSet from "./FiberSet.js";
|
|
|
1349
1805
|
*/
|
|
1350
1806
|
export * as FileSystem from "./FileSystem.js";
|
|
1351
1807
|
/**
|
|
1808
|
+
* The `Filter` module provides composable functions for accepting, rejecting,
|
|
1809
|
+
* narrowing, and transforming values. A `Filter<Input, Pass, Fail>` receives an
|
|
1810
|
+
* input and returns a `Result`: success means the value passed the filter, while
|
|
1811
|
+
* failure means the value was filtered out.
|
|
1812
|
+
*
|
|
1813
|
+
* **Mental model**
|
|
1814
|
+
*
|
|
1815
|
+
* - A filter is a typed predicate that can also transform the successful value
|
|
1816
|
+
* - Predicate-based filters pass the original input when the predicate returns `true`
|
|
1817
|
+
* - Refinement-based filters narrow the successful type, for example from `unknown` to `string`
|
|
1818
|
+
* - Custom filters return `Result.succeed(pass)` or `Result.fail(fail)` directly
|
|
1819
|
+
* - Filters compose with logical and sequential combinators instead of throwing exceptions
|
|
1820
|
+
* - `FilterEffect` is the effectful form for filters that need asynchronous work, errors, or services
|
|
1821
|
+
*
|
|
1822
|
+
* **Common tasks**
|
|
1823
|
+
*
|
|
1824
|
+
* - Build filters: {@link make}, {@link makeEffect}, {@link fromPredicate}, {@link fromPredicateOption}
|
|
1825
|
+
* - Narrow unknown values: {@link string}, {@link number}, {@link boolean}, {@link bigint}, {@link symbol}, {@link date}
|
|
1826
|
+
* - Match shapes and variants: {@link instanceOf}, {@link tagged}, {@link reason}, {@link has}
|
|
1827
|
+
* - Match exact values: {@link equals}, {@link equalsStrict}
|
|
1828
|
+
* - Combine alternatives: {@link or}
|
|
1829
|
+
* - Require multiple filters: {@link zip}, {@link zipWith}, {@link andLeft}, {@link andRight}
|
|
1830
|
+
* - Run filters in sequence: {@link compose}, {@link composePassthrough}
|
|
1831
|
+
* - Convert results: {@link toPredicate}, {@link toOption}, {@link toResult}
|
|
1832
|
+
* - Adjust failure values: {@link mapFail}
|
|
1833
|
+
*
|
|
1834
|
+
* **Gotchas**
|
|
1835
|
+
*
|
|
1836
|
+
* - A failed filter is data in the `Result` failure channel; it is not an exception
|
|
1837
|
+
* - `compose` preserves intermediate failure values, while {@link composePassthrough} fails with the original input
|
|
1838
|
+
* - `equalsStrict` uses JavaScript `===`; use {@link equals} for structural equality
|
|
1839
|
+
* - `fromPredicateOption` fails with the original input when the returned `Option` is `None`
|
|
1840
|
+
* - Prefer refinement predicates when you want TypeScript to narrow the successful value type
|
|
1841
|
+
*
|
|
1352
1842
|
* @since 4.0.0
|
|
1353
1843
|
*/
|
|
1354
1844
|
export * as Filter from "./Filter.js";
|
|
@@ -1408,10 +1898,105 @@ export * as Filter from "./Filter.js";
|
|
|
1408
1898
|
*/
|
|
1409
1899
|
export * as Formatter from "./Formatter.js";
|
|
1410
1900
|
/**
|
|
1901
|
+
* The `Function` module provides small, pure helpers for defining, composing,
|
|
1902
|
+
* adapting, and reusing TypeScript functions. It is the foundation for the
|
|
1903
|
+
* data-first and data-last APIs used throughout Effect, and it includes the
|
|
1904
|
+
* core pipeline utilities that make those APIs ergonomic.
|
|
1905
|
+
*
|
|
1906
|
+
* **Mental model**
|
|
1907
|
+
*
|
|
1908
|
+
* - {@link pipe} starts with a value and passes it through one unary function at
|
|
1909
|
+
* a time
|
|
1910
|
+
* - {@link flow} composes unary functions into a reusable function
|
|
1911
|
+
* - {@link dual} builds APIs that support both direct calls and `pipe`-friendly
|
|
1912
|
+
* data-last calls
|
|
1913
|
+
* - {@link identity}, {@link constant}, and the `const*` helpers model common
|
|
1914
|
+
* identity and thunk patterns without allocating ad hoc callbacks
|
|
1915
|
+
* - {@link tupled}, {@link untupled}, {@link flip}, and {@link apply} adapt
|
|
1916
|
+
* call shapes without changing the underlying behavior
|
|
1917
|
+
* - Type helpers such as {@link LazyArg}, {@link FunctionN}, {@link satisfies},
|
|
1918
|
+
* and {@link cast} describe or constrain functions at the type level
|
|
1919
|
+
*
|
|
1920
|
+
* **Common tasks**
|
|
1921
|
+
*
|
|
1922
|
+
* - Build readable transformation pipelines: {@link pipe}
|
|
1923
|
+
* - Create reusable composed functions: {@link flow}, {@link compose}
|
|
1924
|
+
* - Define functions callable in both data-first and data-last style: {@link dual}
|
|
1925
|
+
* - Return a value unchanged: {@link identity}
|
|
1926
|
+
* - Create thunks and common constant functions: {@link constant},
|
|
1927
|
+
* {@link constTrue}, {@link constFalse}, {@link constNull},
|
|
1928
|
+
* {@link constUndefined}, {@link constVoid}
|
|
1929
|
+
* - Convert between rest-argument and tuple-argument functions: {@link tupled},
|
|
1930
|
+
* {@link untupled}
|
|
1931
|
+
* - Express impossible branches: {@link absurd}
|
|
1932
|
+
* - Cache results for object keys: {@link memoize}
|
|
1933
|
+
*
|
|
1934
|
+
* **Gotchas**
|
|
1935
|
+
*
|
|
1936
|
+
* - Functions passed to {@link pipe} and {@link flow} are applied left-to-right
|
|
1937
|
+
* and should be unary at each step
|
|
1938
|
+
* - {@link dual} uses either an arity or a predicate to decide whether a call is
|
|
1939
|
+
* data-first or data-last; use a predicate when optional arguments make arity
|
|
1940
|
+
* ambiguous
|
|
1941
|
+
* - {@link cast} changes only the static TypeScript type and performs no runtime
|
|
1942
|
+
* validation
|
|
1943
|
+
* - {@link memoize} is intended for object keys and stores cached values in a
|
|
1944
|
+
* `WeakMap`
|
|
1945
|
+
*
|
|
1411
1946
|
* @since 2.0.0
|
|
1412
1947
|
*/
|
|
1413
1948
|
export * as Function from "./Function.js";
|
|
1414
1949
|
/**
|
|
1950
|
+
* The `Graph` module provides immutable and scoped-mutable graph data
|
|
1951
|
+
* structures for modeling relationships between indexed nodes and edges. A
|
|
1952
|
+
* graph can be directed or undirected, stores user-defined data on both nodes
|
|
1953
|
+
* and edges, and exposes traversal, analysis, path finding, transformation, and
|
|
1954
|
+
* diagram export utilities.
|
|
1955
|
+
*
|
|
1956
|
+
* **Mental model**
|
|
1957
|
+
*
|
|
1958
|
+
* - Nodes and edges are addressed by stable numeric indices: {@link NodeIndex}
|
|
1959
|
+
* and {@link EdgeIndex}
|
|
1960
|
+
* - Node data has type `N`; edge data has type `E`
|
|
1961
|
+
* - {@link Graph} values are immutable snapshots; use {@link MutableGraph}
|
|
1962
|
+
* through {@link mutate}, {@link beginMutation}, or constructor callbacks to
|
|
1963
|
+
* add, remove, or update nodes and edges
|
|
1964
|
+
* - Directed graphs follow edge direction for neighbors and traversals, while
|
|
1965
|
+
* undirected graphs treat each edge as connecting both endpoints
|
|
1966
|
+
* - Missing lookups return `Option`, while structurally invalid operations such
|
|
1967
|
+
* as adding an edge to a missing node throw {@link GraphError}
|
|
1968
|
+
*
|
|
1969
|
+
* **Common tasks**
|
|
1970
|
+
*
|
|
1971
|
+
* - Create graphs: {@link directed}, {@link undirected}
|
|
1972
|
+
* - Mutate safely: {@link mutate}, {@link addNode}, {@link addEdge},
|
|
1973
|
+
* {@link removeNode}, {@link removeEdge}
|
|
1974
|
+
* - Query contents: {@link getNode}, {@link getEdge}, {@link hasNode},
|
|
1975
|
+
* {@link hasEdge}, {@link nodeCount}, {@link edgeCount}, {@link neighbors}
|
|
1976
|
+
* - Transform data: {@link updateNode}, {@link updateEdge}, {@link mapNodes},
|
|
1977
|
+
* {@link mapEdges}, {@link filterNodes}, {@link filterEdges},
|
|
1978
|
+
* {@link filterMapNodes}, {@link filterMapEdges}
|
|
1979
|
+
* - Traverse lazily: {@link dfs}, {@link bfs}, {@link topo},
|
|
1980
|
+
* {@link dfsPostOrder}, {@link nodes}, {@link edges}, {@link Walker}
|
|
1981
|
+
* - Analyze structure: {@link isAcyclic}, {@link isBipartite},
|
|
1982
|
+
* {@link connectedComponents}, {@link stronglyConnectedComponents},
|
|
1983
|
+
* {@link externals}
|
|
1984
|
+
* - Find paths: {@link dijkstra}, {@link astar}, {@link bellmanFord},
|
|
1985
|
+
* {@link floydWarshall}
|
|
1986
|
+
* - Export diagrams: {@link toGraphViz}, {@link toMermaid}
|
|
1987
|
+
*
|
|
1988
|
+
* **Gotchas**
|
|
1989
|
+
*
|
|
1990
|
+
* - Only mutable graphs can be changed. Create one with {@link mutate} or by
|
|
1991
|
+
* passing a callback to {@link directed} / {@link undirected}.
|
|
1992
|
+
* - Traversal APIs return lazy {@link Walker} values. Use {@link indices},
|
|
1993
|
+
* {@link values}, or {@link entries} to choose what each iteration yields.
|
|
1994
|
+
* - `NodeIndex` and `EdgeIndex` values are identifiers, not array offsets. They
|
|
1995
|
+
* are not reused after removals.
|
|
1996
|
+
* - Shortest-path algorithms require a cost function. {@link dijkstra} and
|
|
1997
|
+
* {@link astar} reject negative weights; use {@link bellmanFord} or
|
|
1998
|
+
* {@link floydWarshall} when negative weights are part of the model.
|
|
1999
|
+
*
|
|
1415
2000
|
* @since 4.0.0
|
|
1416
2001
|
*/
|
|
1417
2002
|
export * as Graph from "./Graph.js";
|
|
@@ -1426,14 +2011,182 @@ export * as Graph from "./Graph.js";
|
|
|
1426
2011
|
*/
|
|
1427
2012
|
export * as Hash from "./Hash.js";
|
|
1428
2013
|
/**
|
|
2014
|
+
* The `HashMap` module provides an immutable key-value data structure with
|
|
2015
|
+
* efficient lookup, insertion, removal, and transformation operations. A
|
|
2016
|
+
* `HashMap<Key, Value>` stores entries by hashing keys and resolving matches
|
|
2017
|
+
* with Effect's structural equality semantics.
|
|
2018
|
+
*
|
|
2019
|
+
* **Mental model**
|
|
2020
|
+
*
|
|
2021
|
+
* - A `HashMap<Key, Value>` is an immutable collection of key-value pairs
|
|
2022
|
+
* - Operations such as {@link set}, {@link remove}, and {@link modifyAt} return
|
|
2023
|
+
* new maps; existing maps are not mutated
|
|
2024
|
+
* - Keys are compared using the `Equal` protocol and are grouped by hashes from
|
|
2025
|
+
* the `Hash` protocol
|
|
2026
|
+
* - Plain JavaScript primitives work as keys, and custom objects can define
|
|
2027
|
+
* `Equal` / `Hash` behavior for structural lookup
|
|
2028
|
+
* - Lookups with {@link get} return an `Option`, making missing keys explicit
|
|
2029
|
+
* - Iteration order is based on the map's internal hash structure and should
|
|
2030
|
+
* not be treated as insertion order
|
|
2031
|
+
*
|
|
2032
|
+
* **Common tasks**
|
|
2033
|
+
*
|
|
2034
|
+
* - Create maps: {@link empty}, {@link make}, {@link fromIterable}
|
|
2035
|
+
* - Read values: {@link get}, {@link getUnsafe}, {@link has}, {@link hasBy}
|
|
2036
|
+
* - Add or update entries: {@link set}, {@link modify}, {@link modifyAt}, {@link setMany}
|
|
2037
|
+
* - Remove entries: {@link remove}, {@link removeMany}
|
|
2038
|
+
* - Combine maps: {@link union}
|
|
2039
|
+
* - Iterate or convert: {@link keys}, {@link values}, {@link entries}, {@link toValues}, {@link toEntries}
|
|
2040
|
+
* - Transform values: {@link map}, {@link flatMap}, {@link filter}, {@link filterMap}, {@link compact}
|
|
2041
|
+
* - Fold and search: {@link reduce}, {@link findFirst}, {@link some}, {@link every}
|
|
2042
|
+
* - Batch updates efficiently: {@link mutate}, {@link beginMutation}, {@link endMutation}
|
|
2043
|
+
*
|
|
2044
|
+
* **Gotchas**
|
|
2045
|
+
*
|
|
2046
|
+
* - {@link getUnsafe} throws when the key is absent; prefer {@link get} unless
|
|
2047
|
+
* absence is impossible by construction
|
|
2048
|
+
* - Mutating a key object after insertion can make future lookups fail if its
|
|
2049
|
+
* equality or hash changes
|
|
2050
|
+
* - Hash collisions are handled by equality checks, so matching hashes alone do
|
|
2051
|
+
* not make two keys equal
|
|
2052
|
+
* - Use {@link getHash} and {@link hasHash} only when you already have the
|
|
2053
|
+
* correct hash for the same key
|
|
2054
|
+
* - Convert entries to an array and sort them when deterministic presentation is
|
|
2055
|
+
* required
|
|
2056
|
+
*
|
|
2057
|
+
* **Quickstart**
|
|
2058
|
+
*
|
|
2059
|
+
* **Example** (Working with immutable maps)
|
|
2060
|
+
*
|
|
2061
|
+
* ```ts
|
|
2062
|
+
* import { HashMap, Option } from "effect"
|
|
2063
|
+
*
|
|
2064
|
+
* const scores = HashMap.make(["alice", 10], ["bob", 15])
|
|
2065
|
+
*
|
|
2066
|
+
* const updated = scores.pipe(
|
|
2067
|
+
* HashMap.set("carol", 20),
|
|
2068
|
+
* HashMap.modify("alice", (score) => score + 1)
|
|
2069
|
+
* )
|
|
2070
|
+
*
|
|
2071
|
+
* console.log(HashMap.get(updated, "alice"))
|
|
2072
|
+
* // Output: Option.some(11)
|
|
2073
|
+
*
|
|
2074
|
+
* console.log(HashMap.get(scores, "carol"))
|
|
2075
|
+
* // Output: Option.none()
|
|
2076
|
+
*
|
|
2077
|
+
* console.log(Option.getOrElse(HashMap.get(updated, "dave"), () => 0))
|
|
2078
|
+
* // Output: 0
|
|
2079
|
+
* ```
|
|
2080
|
+
*
|
|
2081
|
+
* **See also**
|
|
2082
|
+
*
|
|
2083
|
+
* - {@link HashSet} for immutable sets backed by hash semantics
|
|
2084
|
+
* - {@link Equal} for structural equality
|
|
2085
|
+
* - {@link Hash} for hash implementations used by hashed collections
|
|
2086
|
+
*
|
|
1429
2087
|
* @since 2.0.0
|
|
1430
2088
|
*/
|
|
1431
2089
|
export * as HashMap from "./HashMap.js";
|
|
1432
2090
|
/**
|
|
2091
|
+
* The `HashRing` module provides a weighted consistent-hashing data structure
|
|
2092
|
+
* for assigning arbitrary string inputs to a changing set of nodes. A hash ring
|
|
2093
|
+
* minimizes remapping when nodes are added, removed, or reweighted, which makes
|
|
2094
|
+
* it useful for routing requests, partitioning keys, and distributing shards
|
|
2095
|
+
* across service instances or storage backends.
|
|
2096
|
+
*
|
|
2097
|
+
* **Mental model**
|
|
2098
|
+
*
|
|
2099
|
+
* - Each node is identified by its {@link PrimaryKey.PrimaryKey} value
|
|
2100
|
+
* - {@link add} and {@link addMany} place weighted virtual points on the ring
|
|
2101
|
+
* - {@link get} hashes an input string and returns the nearest node on the ring
|
|
2102
|
+
* - {@link getShards} assigns a fixed number of shard indexes across the nodes
|
|
2103
|
+
* - Higher weights receive proportionally more virtual points and shard
|
|
2104
|
+
* allocations
|
|
2105
|
+
* - Operations mutate and return the same ring instance
|
|
2106
|
+
*
|
|
2107
|
+
* **Common tasks**
|
|
2108
|
+
*
|
|
2109
|
+
* - Create an empty ring: {@link make}
|
|
2110
|
+
* - Add or update nodes: {@link add}, {@link addMany}
|
|
2111
|
+
* - Remove nodes: {@link remove}
|
|
2112
|
+
* - Check membership by primary key: {@link has}
|
|
2113
|
+
* - Route an input key to a node: {@link get}
|
|
2114
|
+
* - Precompute shard ownership: {@link getShards}
|
|
2115
|
+
* - Guard unknown values: {@link isHashRing}
|
|
2116
|
+
*
|
|
2117
|
+
* **Gotchas**
|
|
2118
|
+
*
|
|
2119
|
+
* - Empty rings return `undefined` from {@link get} and {@link getShards}
|
|
2120
|
+
* - Nodes with the same primary key represent the same ring member
|
|
2121
|
+
* - Weights are clamped to a positive minimum so a node remains represented
|
|
2122
|
+
* - Mutating a ring in place is intentional; create a new ring when independent
|
|
2123
|
+
* snapshots are required
|
|
2124
|
+
*
|
|
2125
|
+
* **Quickstart**
|
|
2126
|
+
*
|
|
2127
|
+
* **Example** (Routing keys across nodes)
|
|
2128
|
+
*
|
|
2129
|
+
* ```ts
|
|
2130
|
+
* import { HashRing, PrimaryKey } from "effect"
|
|
2131
|
+
*
|
|
2132
|
+
* class Node implements PrimaryKey.PrimaryKey {
|
|
2133
|
+
* constructor(readonly id: string) {}
|
|
2134
|
+
*
|
|
2135
|
+
* [PrimaryKey.symbol](): string {
|
|
2136
|
+
* return this.id
|
|
2137
|
+
* }
|
|
2138
|
+
* }
|
|
2139
|
+
*
|
|
2140
|
+
* const ring = HashRing.make<Node>().pipe(
|
|
2141
|
+
* HashRing.add(new Node("node-a")),
|
|
2142
|
+
* HashRing.add(new Node("node-b"), { weight: 2 })
|
|
2143
|
+
* )
|
|
2144
|
+
*
|
|
2145
|
+
* const owner = HashRing.get(ring, "user:123")
|
|
2146
|
+
* console.log(owner ? PrimaryKey.value(owner) : undefined)
|
|
2147
|
+
* ```
|
|
2148
|
+
*
|
|
1433
2149
|
* @since 4.0.0
|
|
1434
2150
|
*/
|
|
1435
2151
|
export * as HashRing from "./HashRing.js";
|
|
1436
2152
|
/**
|
|
2153
|
+
* The `HashSet` module provides an immutable set data structure for storing
|
|
2154
|
+
* unique values with efficient membership checks, additions, removals, and set
|
|
2155
|
+
* operations. A `HashSet<A>` contains at most one value for each equality class
|
|
2156
|
+
* as determined by Effect's `Equal` / `Hash` semantics.
|
|
2157
|
+
*
|
|
2158
|
+
* **Mental model**
|
|
2159
|
+
*
|
|
2160
|
+
* - `HashSet<A>` is an immutable collection of unique values of type `A`
|
|
2161
|
+
* - Operations such as {@link add}, {@link remove}, {@link union}, and
|
|
2162
|
+
* {@link difference} return new sets; the input set is never mutated
|
|
2163
|
+
* - Membership is checked with {@link has}, using Effect equality and hashing
|
|
2164
|
+
* rather than array-style linear scanning
|
|
2165
|
+
* - Duplicate values are collapsed when using {@link make}, {@link fromIterable},
|
|
2166
|
+
* {@link add}, or {@link map}
|
|
2167
|
+
* - `HashSet` is iterable, but iteration order is not a sorting guarantee
|
|
2168
|
+
*
|
|
2169
|
+
* **Common tasks**
|
|
2170
|
+
*
|
|
2171
|
+
* - Create sets: {@link empty}, {@link make}, {@link fromIterable}
|
|
2172
|
+
* - Check membership and size: {@link has}, {@link size}, {@link isEmpty}
|
|
2173
|
+
* - Add or remove values: {@link add}, {@link remove}
|
|
2174
|
+
* - Combine sets: {@link union}, {@link intersection}, {@link difference}
|
|
2175
|
+
* - Compare sets: {@link isSubset}
|
|
2176
|
+
* - Transform or select values: {@link map}, {@link filter}
|
|
2177
|
+
* - Test values: {@link some}, {@link every}
|
|
2178
|
+
* - Fold values: {@link reduce}
|
|
2179
|
+
*
|
|
2180
|
+
* **Gotchas**
|
|
2181
|
+
*
|
|
2182
|
+
* - Values that should compare structurally should implement compatible
|
|
2183
|
+
* `Equal` and `Hash` behavior; otherwise object identity may affect whether
|
|
2184
|
+
* values are considered distinct
|
|
2185
|
+
* - {@link map} may reduce the set size when multiple input values map to the
|
|
2186
|
+
* same output value
|
|
2187
|
+
* - Do not rely on iteration order for deterministic presentation; sort the
|
|
2188
|
+
* values after converting to an array when order matters
|
|
2189
|
+
*
|
|
1437
2190
|
* @since 2.0.0
|
|
1438
2191
|
*/
|
|
1439
2192
|
export * as HashSet from "./HashSet.js";
|
|
@@ -1449,7 +2202,8 @@ export * as HashSet from "./HashSet.js";
|
|
|
1449
2202
|
* can represent complex type relationships with multiple type parameters, including
|
|
1450
2203
|
* contravariant, covariant, and invariant positions.
|
|
1451
2204
|
*
|
|
1452
|
-
*
|
|
2205
|
+
* **Example** (Encoding type lambdas)
|
|
2206
|
+
*
|
|
1453
2207
|
* ```ts
|
|
1454
2208
|
* import type { HKT } from "effect"
|
|
1455
2209
|
*
|
|
@@ -1484,7 +2238,8 @@ export * as HKT from "./HKT.js";
|
|
|
1484
2238
|
* The module also includes redaction capabilities for sensitive data, allowing objects
|
|
1485
2239
|
* to provide different representations based on the current execution context.
|
|
1486
2240
|
*
|
|
1487
|
-
*
|
|
2241
|
+
* **Example** (Creating inspectable values)
|
|
2242
|
+
*
|
|
1488
2243
|
* ```ts
|
|
1489
2244
|
* import { Inspectable } from "effect"
|
|
1490
2245
|
* import { format } from "effect/Formatter"
|
|
@@ -1526,7 +2281,8 @@ export * as Inspectable from "./Inspectable.js";
|
|
|
1526
2281
|
* for stream processing and memory-efficient data manipulation. All functions in this
|
|
1527
2282
|
* module preserve the lazy nature of iterables where possible.
|
|
1528
2283
|
*
|
|
1529
|
-
*
|
|
2284
|
+
* **Example** (Working with iterables)
|
|
2285
|
+
*
|
|
1530
2286
|
* ```ts
|
|
1531
2287
|
* import { Iterable, Option } from "effect"
|
|
1532
2288
|
*
|
|
@@ -1743,6 +2499,38 @@ export * as JsonPointer from "./JsonPointer.js";
|
|
|
1743
2499
|
*/
|
|
1744
2500
|
export * as JsonSchema from "./JsonSchema.js";
|
|
1745
2501
|
/**
|
|
2502
|
+
* The `Latch` module provides a reusable synchronization primitive for
|
|
2503
|
+
* coordinating fibers. A `Latch` is either open or closed: when it is closed,
|
|
2504
|
+
* fibers that use {@link await} or {@link whenOpen} suspend until the latch is
|
|
2505
|
+
* opened or the current waiters are released.
|
|
2506
|
+
*
|
|
2507
|
+
* **Mental model**
|
|
2508
|
+
*
|
|
2509
|
+
* - An open latch lets current and future waiters continue immediately
|
|
2510
|
+
* - A closed latch causes `await` and `whenOpen` to suspend
|
|
2511
|
+
* - {@link open} permanently opens the latch until it is closed again
|
|
2512
|
+
* - {@link release} wakes only the fibers currently waiting and leaves the
|
|
2513
|
+
* latch closed for future waiters
|
|
2514
|
+
* - {@link close} resets the latch so later waiters suspend again
|
|
2515
|
+
*
|
|
2516
|
+
* **Common tasks**
|
|
2517
|
+
*
|
|
2518
|
+
* - Create a latch inside `Effect`: {@link make}
|
|
2519
|
+
* - Create a latch synchronously: {@link makeUnsafe}
|
|
2520
|
+
* - Wait for a signal before continuing: {@link await}
|
|
2521
|
+
* - Guard an effect so it runs only after the latch is open: {@link whenOpen}
|
|
2522
|
+
* - Let all current and future waiters proceed: {@link open}
|
|
2523
|
+
* - Let only the current waiters proceed: {@link release}
|
|
2524
|
+
* - Re-enable waiting after opening: {@link close}
|
|
2525
|
+
*
|
|
2526
|
+
* **Gotchas**
|
|
2527
|
+
*
|
|
2528
|
+
* - `release` is not the same as `open`; new waiters still suspend after the
|
|
2529
|
+
* current waiters are released
|
|
2530
|
+
* - `open` and `close` report whether they changed the latch state
|
|
2531
|
+
* - Prefer the effectful APIs unless synchronous allocation or mutation is
|
|
2532
|
+
* required
|
|
2533
|
+
*
|
|
1746
2534
|
* @since 3.8.0
|
|
1747
2535
|
*/
|
|
1748
2536
|
export * as Latch from "./Latch.js";
|
|
@@ -1767,212 +2555,207 @@ export * as Latch from "./Latch.js";
|
|
|
1767
2555
|
*/
|
|
1768
2556
|
export * as Layer from "./Layer.js";
|
|
1769
2557
|
/**
|
|
1770
|
-
*
|
|
1771
|
-
|
|
1772
|
-
|
|
1773
|
-
|
|
1774
|
-
*
|
|
2558
|
+
* The `LayerMap` module provides utilities for managing scoped resources that
|
|
2559
|
+
* are selected by key and built from `Layer` values. A `LayerMap<K, I, E>` turns
|
|
2560
|
+
* a key into a cached service `Context<I>`, so applications can lazily acquire
|
|
2561
|
+
* and reuse different resource instances such as tenant clients, regional
|
|
2562
|
+
* connections, environment-specific services, or other keyed infrastructure.
|
|
1775
2563
|
*
|
|
1776
|
-
*
|
|
1777
|
-
* It offers structured logging, multiple output formats, and seamless integration with the
|
|
1778
|
-
* Effect runtime's tracing and context management.
|
|
2564
|
+
* **Mental model**
|
|
1779
2565
|
*
|
|
1780
|
-
*
|
|
2566
|
+
* - A `LayerMap` is a scoped, reference-counted cache of contexts produced by layers
|
|
2567
|
+
* - Keys identify which layer-backed resource set should be acquired
|
|
2568
|
+
* - Resources are acquired on demand when a key is requested
|
|
2569
|
+
* - The same key reuses the cached context while it remains live
|
|
2570
|
+
* - Cached resources are finalized when invalidated, when their scope closes, or after idle expiration
|
|
2571
|
+
* - The layers built by a `LayerMap` share the current layer memoization map
|
|
1781
2572
|
*
|
|
1782
|
-
*
|
|
1783
|
-
* - **Multiple Formats**: JSON, LogFmt, Pretty, and custom formatting options
|
|
1784
|
-
* - **Context Integration**: Automatic capture of fiber context, spans, and annotations
|
|
1785
|
-
* - **Batching**: Efficient log aggregation and batch processing
|
|
1786
|
-
* - **File Output**: Direct file writing with configurable batch windows
|
|
1787
|
-
* - **Composable**: Transform and compose loggers using functional patterns
|
|
2573
|
+
* **Common tasks**
|
|
1788
2574
|
*
|
|
1789
|
-
*
|
|
2575
|
+
* - Create from a lookup function: {@link make}
|
|
2576
|
+
* - Create from a fixed record of layers: {@link fromRecord}
|
|
2577
|
+
* - Define a service wrapper with accessor helpers: {@link Service}
|
|
2578
|
+
* - Retrieve a layer for a key: {@link LayerMap.get}
|
|
2579
|
+
* - Retrieve a scoped context directly: {@link LayerMap.contextEffect}
|
|
2580
|
+
* - Force a cached entry to be rebuilt later: {@link LayerMap.invalidate}
|
|
2581
|
+
* - Remove idle entries automatically with the `idleTimeToLive` option
|
|
2582
|
+
* - Eagerly build known entries with `preloadKeys` or `preload`
|
|
1790
2583
|
*
|
|
1791
|
-
*
|
|
1792
|
-
* import { Effect } from "effect"
|
|
2584
|
+
* **Gotchas**
|
|
1793
2585
|
*
|
|
1794
|
-
*
|
|
1795
|
-
*
|
|
1796
|
-
*
|
|
1797
|
-
*
|
|
1798
|
-
* yield* Effect.logWarning("Resource limit approaching")
|
|
1799
|
-
* yield* Effect.logError("Database connection failed")
|
|
1800
|
-
* })
|
|
2586
|
+
* - `contextEffect` requires a `Scope.Scope` because it exposes the acquired context directly
|
|
2587
|
+
* - `get` returns a `Layer` that can be provided to programs expecting the keyed services
|
|
2588
|
+
* - Invalidating a key finalizes the current cached resources for that key; the next access rebuilds them
|
|
2589
|
+
* - Preloading moves layer construction errors to `LayerMap` creation instead of first use
|
|
1801
2590
|
*
|
|
1802
|
-
*
|
|
1803
|
-
|
|
1804
|
-
*
|
|
1805
|
-
|
|
1806
|
-
*
|
|
1807
|
-
*
|
|
2591
|
+
* @since 3.14.0
|
|
2592
|
+
*/
|
|
2593
|
+
export * as LayerMap from "./LayerMap.js";
|
|
2594
|
+
/**
|
|
2595
|
+
* The `Logger` module defines the logging model used by the Effect runtime and
|
|
2596
|
+
* provides constructors for formatting, routing, batching, and installing
|
|
2597
|
+
* loggers. A `Logger<Message, Output>` receives each runtime log event as an
|
|
2598
|
+
* {@link Options} value and transforms it into an output such as a string,
|
|
2599
|
+
* structured object, JSON line, console write, file write, or trace span event.
|
|
1808
2600
|
*
|
|
1809
|
-
*
|
|
2601
|
+
* **Mental model**
|
|
1810
2602
|
*
|
|
1811
|
-
*
|
|
1812
|
-
*
|
|
2603
|
+
* - Effect programs emit log events with APIs such as `Effect.log`,
|
|
2604
|
+
* `Effect.logInfo`, `Effect.logWarning`, and `Effect.logError`
|
|
2605
|
+
* - Each event contains a message, log level, cause, fiber, and timestamp
|
|
2606
|
+
* - Loggers are ordinary values created with {@link make} and installed with
|
|
2607
|
+
* {@link layer}
|
|
2608
|
+
* - Multiple loggers can be active at once by providing a layer with several
|
|
2609
|
+
* logger values
|
|
2610
|
+
* - Formatter loggers such as {@link formatLogFmt}, {@link formatStructured},
|
|
2611
|
+
* and {@link formatJson} return formatted data without writing it anywhere
|
|
2612
|
+
* - Console loggers such as {@link consolePretty}, {@link consoleLogFmt},
|
|
2613
|
+
* {@link consoleStructured}, and {@link consoleJson} write formatted output
|
|
2614
|
+
* to the active Effect console
|
|
2615
|
+
*
|
|
2616
|
+
* **Log output structure**
|
|
2617
|
+
*
|
|
2618
|
+
* Built-in formatters include the log level, timestamp, fiber identifier, and
|
|
2619
|
+
* logged message. When present, they also include the pretty-printed cause,
|
|
2620
|
+
* active log annotations, and active log spans. Structured and JSON loggers keep
|
|
2621
|
+
* these fields as machine-readable data, while logfmt and pretty loggers render
|
|
2622
|
+
* them as human-readable text.
|
|
1813
2623
|
*
|
|
1814
|
-
*
|
|
1815
|
-
* const customLogger = Logger.make((options) => {
|
|
1816
|
-
* console.log(`[${options.logLevel}] ${options.message}`)
|
|
1817
|
-
* })
|
|
2624
|
+
* **Common tasks**
|
|
1818
2625
|
*
|
|
1819
|
-
*
|
|
1820
|
-
*
|
|
2626
|
+
* - Create a custom logger: {@link make}
|
|
2627
|
+
* - Transform logger output: {@link map}
|
|
2628
|
+
* - Write formatter output to the console: {@link withConsoleLog},
|
|
2629
|
+
* {@link withConsoleError}, {@link withLeveledConsole}
|
|
2630
|
+
* - Use built-in console loggers: {@link consolePretty}, {@link consoleLogFmt},
|
|
2631
|
+
* {@link consoleStructured}, {@link consoleJson}
|
|
2632
|
+
* - Use built-in formatter loggers: {@link formatSimple}, {@link formatLogFmt},
|
|
2633
|
+
* {@link formatStructured}, {@link formatJson}
|
|
2634
|
+
* - Batch logger output before flushing to a sink: {@link batched}
|
|
2635
|
+
* - Write string logger output to a file: {@link toFile}
|
|
2636
|
+
* - Preserve trace correlation by including {@link tracerLogger}
|
|
2637
|
+
* - Install or replace loggers for an effect: {@link layer}
|
|
1821
2638
|
*
|
|
1822
|
-
*
|
|
1823
|
-
* const prettyLogger = Logger.consolePretty()
|
|
2639
|
+
* **Gotchas**
|
|
1824
2640
|
*
|
|
1825
|
-
*
|
|
1826
|
-
*
|
|
1827
|
-
*
|
|
1828
|
-
*
|
|
2641
|
+
* - {@link layer} replaces the current logger set by default; pass
|
|
2642
|
+
* `mergeWithExisting: true` when adding loggers to the existing runtime
|
|
2643
|
+
* loggers
|
|
2644
|
+
* - Formatter loggers only produce values; wrap them with console, file, batch,
|
|
2645
|
+
* or custom sink loggers when output should be written somewhere
|
|
2646
|
+
* - {@link batched} and {@link toFile} are scoped; keep their scope open while
|
|
2647
|
+
* logs are being emitted so buffered entries can flush reliably
|
|
2648
|
+
* - {@link toFile} accepts only loggers that output strings, so pair it with
|
|
2649
|
+
* string formatters such as {@link formatJson} or {@link formatLogFmt}
|
|
2650
|
+
* - The default runtime logger set includes {@link tracerLogger}; replacing
|
|
2651
|
+
* loggers without merging may remove automatic log-to-trace-span recording
|
|
1829
2652
|
*
|
|
1830
|
-
*
|
|
2653
|
+
* **Quickstart**
|
|
2654
|
+
*
|
|
2655
|
+
* **Example** (Installing a JSON console logger)
|
|
1831
2656
|
*
|
|
1832
2657
|
* ```ts
|
|
1833
2658
|
* import { Effect, Logger } from "effect"
|
|
1834
2659
|
*
|
|
1835
|
-
*
|
|
1836
|
-
*
|
|
1837
|
-
*
|
|
1838
|
-
*
|
|
1839
|
-
*
|
|
1840
|
-
*
|
|
1841
|
-
*
|
|
1842
|
-
* Effect.provide(CombinedLoggerLive)
|
|
2660
|
+
* const program = Effect.gen(function*() {
|
|
2661
|
+
* yield* Effect.logInfo("request started", { method: "GET", path: "/users" })
|
|
2662
|
+
* yield* Effect.logError("request failed", { status: 500 })
|
|
2663
|
+
* }).pipe(
|
|
2664
|
+
* Effect.annotateLogs("service", "users-api"),
|
|
2665
|
+
* Effect.withLogSpan("http.request"),
|
|
2666
|
+
* Effect.provide(Logger.layer([Logger.consoleJson]))
|
|
1843
2667
|
* )
|
|
1844
2668
|
* ```
|
|
1845
2669
|
*
|
|
1846
|
-
*
|
|
2670
|
+
* **See also**
|
|
1847
2671
|
*
|
|
1848
|
-
*
|
|
1849
|
-
*
|
|
1850
|
-
*
|
|
1851
|
-
*
|
|
1852
|
-
* window: Duration.seconds(5),
|
|
1853
|
-
* flush: (messages) =>
|
|
1854
|
-
* Effect.sync(() => {
|
|
1855
|
-
* // Process batch of log messages
|
|
1856
|
-
* console.log("Flushing", messages.length, "log entries")
|
|
1857
|
-
* })
|
|
1858
|
-
* })
|
|
2672
|
+
* - {@link make} for defining custom loggers
|
|
2673
|
+
* - {@link layer} for installing loggers
|
|
2674
|
+
* - {@link formatJson} and {@link consoleJson} for structured production logs
|
|
2675
|
+
* - {@link consolePretty} for readable local logs
|
|
1859
2676
|
*
|
|
1860
|
-
*
|
|
1861
|
-
* const logger = yield* batchedLogger
|
|
1862
|
-
* yield* Effect.provide(
|
|
1863
|
-
* Effect.all([
|
|
1864
|
-
* Effect.log("Event 1"),
|
|
1865
|
-
* Effect.log("Event 2"),
|
|
1866
|
-
* Effect.log("Event 3")
|
|
1867
|
-
* ]),
|
|
1868
|
-
* Logger.layer([logger])
|
|
1869
|
-
* )
|
|
1870
|
-
* })
|
|
1871
|
-
* ```
|
|
2677
|
+
* @since 2.0.0
|
|
1872
2678
|
*/
|
|
1873
2679
|
export * as Logger from "./Logger.js";
|
|
1874
2680
|
/**
|
|
1875
|
-
*
|
|
1876
|
-
*
|
|
1877
|
-
* The `LogLevel` module provides utilities for managing log levels in Effect applications.
|
|
1878
|
-
* It defines a hierarchy of log levels and provides functions for comparing and filtering logs
|
|
1879
|
-
* based on their severity.
|
|
1880
|
-
*
|
|
1881
|
-
* ## Log Level Hierarchy
|
|
1882
|
-
*
|
|
1883
|
-
* The log levels are ordered from most severe to least severe:
|
|
1884
|
-
*
|
|
1885
|
-
* 1. **All** - Special level that allows all messages
|
|
1886
|
-
* 2. **Fatal** - System is unusable, immediate attention required
|
|
1887
|
-
* 3. **Error** - Error conditions that should be investigated
|
|
1888
|
-
* 4. **Warn** - Warning conditions that may indicate problems
|
|
1889
|
-
* 5. **Info** - Informational messages about normal operation
|
|
1890
|
-
* 6. **Debug** - Debug information useful during development
|
|
1891
|
-
* 7. **Trace** - Very detailed trace information
|
|
1892
|
-
* 8. **None** - Special level that suppresses all messages
|
|
1893
|
-
*
|
|
1894
|
-
* ## Basic Usage
|
|
1895
|
-
*
|
|
1896
|
-
* ```ts
|
|
1897
|
-
* import { Effect } from "effect"
|
|
1898
|
-
*
|
|
1899
|
-
* // Basic log level usage
|
|
1900
|
-
* const program = Effect.gen(function*() {
|
|
1901
|
-
* yield* Effect.logFatal("System is shutting down")
|
|
1902
|
-
* yield* Effect.logError("Database connection failed")
|
|
1903
|
-
* yield* Effect.logWarning("Memory usage is high")
|
|
1904
|
-
* yield* Effect.logInfo("User logged in")
|
|
1905
|
-
* yield* Effect.logDebug("Processing request")
|
|
1906
|
-
* yield* Effect.logTrace("Variable value: xyz")
|
|
1907
|
-
* })
|
|
1908
|
-
* ```
|
|
2681
|
+
* The `LogLevel` module defines the levels used by Effect logging and the
|
|
2682
|
+
* ordering operations used to compare, filter, and enable log output.
|
|
1909
2683
|
*
|
|
1910
|
-
*
|
|
2684
|
+
* **Mental model**
|
|
1911
2685
|
*
|
|
1912
|
-
*
|
|
1913
|
-
*
|
|
2686
|
+
* - A `LogLevel` is one of `All`, `Fatal`, `Error`, `Warn`, `Info`, `Debug`,
|
|
2687
|
+
* `Trace`, or `None`
|
|
2688
|
+
* - `Fatal` is the most severe concrete level and `Trace` is the least severe
|
|
2689
|
+
* - `All` and `None` are sentinel levels: `All` enables every message and
|
|
2690
|
+
* `None` disables every message
|
|
2691
|
+
* - Ordering follows logging severity, so higher levels are more important and
|
|
2692
|
+
* lower levels are more verbose
|
|
2693
|
+
* - Filtering is usually expressed as "log this message when its level is
|
|
2694
|
+
* greater than or equal to the configured minimum"
|
|
1914
2695
|
*
|
|
1915
|
-
*
|
|
1916
|
-
* console.log(LogLevel.isGreaterThan("Error", "Info")) // true
|
|
1917
|
-
* console.log(LogLevel.isGreaterThan("Debug", "Error")) // false
|
|
2696
|
+
* **Common tasks**
|
|
1918
2697
|
*
|
|
1919
|
-
*
|
|
1920
|
-
*
|
|
1921
|
-
*
|
|
1922
|
-
*
|
|
2698
|
+
* - Enumerate levels with {@link values}
|
|
2699
|
+
* - Compare exact levels with {@link Equivalence}
|
|
2700
|
+
* - Sort or compare by severity with {@link Order} and {@link getOrdinal}
|
|
2701
|
+
* - Check thresholds with {@link isGreaterThanOrEqualTo} and
|
|
2702
|
+
* {@link isLessThanOrEqualTo}
|
|
2703
|
+
* - Test whether a level is enabled for the current fiber with
|
|
2704
|
+
* {@link isEnabled}
|
|
1923
2705
|
*
|
|
1924
|
-
*
|
|
2706
|
+
* **Gotchas**
|
|
1925
2707
|
*
|
|
1926
|
-
*
|
|
1927
|
-
*
|
|
2708
|
+
* - `All` and `None` are useful for configuration boundaries, but they are not
|
|
2709
|
+
* concrete message severities; use {@link Severity} when only emitted message
|
|
2710
|
+
* levels are valid
|
|
2711
|
+
* - The comparison helpers compare severity, not declaration position in source
|
|
2712
|
+
* code or alphabetical order
|
|
2713
|
+
* - `isEnabled` reads the current fiber's `MinimumLogLevel` reference, so it is
|
|
2714
|
+
* context-sensitive; use the pure comparison helpers when checking an
|
|
2715
|
+
* explicit threshold
|
|
1928
2716
|
*
|
|
1929
|
-
*
|
|
1930
|
-
|
|
1931
|
-
*
|
|
1932
|
-
|
|
1933
|
-
*
|
|
1934
|
-
*
|
|
2717
|
+
* @since 2.0.0
|
|
2718
|
+
*/
|
|
2719
|
+
export * as LogLevel from "./LogLevel.js";
|
|
2720
|
+
/**
|
|
2721
|
+
* The `ManagedRuntime` module provides a way to build a reusable runtime from
|
|
2722
|
+
* a `Layer` and use it to run effects that require the services produced by
|
|
2723
|
+
* that layer. A `ManagedRuntime<R, ER>` owns the lifecycle of the layer-built
|
|
2724
|
+
* resources, caches the resulting `Context<R>`, and exposes runners for
|
|
2725
|
+
* integrating Effect programs with JavaScript entry points.
|
|
1935
2726
|
*
|
|
1936
|
-
*
|
|
1937
|
-
* const productionLogger = Logger.make((options) => {
|
|
1938
|
-
* if (LogLevel.isGreaterThanOrEqualTo(options.logLevel, "Info")) {
|
|
1939
|
-
* console.log(
|
|
1940
|
-
* `${options.date.toISOString()} [${options.logLevel}] ${options.message}`
|
|
1941
|
-
* )
|
|
1942
|
-
* }
|
|
1943
|
-
* })
|
|
2727
|
+
* **Mental model**
|
|
1944
2728
|
*
|
|
1945
|
-
*
|
|
1946
|
-
*
|
|
1947
|
-
*
|
|
1948
|
-
*
|
|
1949
|
-
*
|
|
1950
|
-
*
|
|
1951
|
-
* ```
|
|
2729
|
+
* - A managed runtime is created from a `Layer` with {@link make}
|
|
2730
|
+
* - The layer is built lazily the first time the runtime is used
|
|
2731
|
+
* - The built context is cached and reused for subsequent effect executions
|
|
2732
|
+
* - Resources acquired by the layer are owned by the runtime's internal scope
|
|
2733
|
+
* - Disposing the runtime closes that scope and releases all managed resources
|
|
2734
|
+
* - Effects run through the runtime receive the layer's services automatically
|
|
1952
2735
|
*
|
|
1953
|
-
*
|
|
2736
|
+
* **Common tasks**
|
|
1954
2737
|
*
|
|
1955
|
-
*
|
|
1956
|
-
*
|
|
2738
|
+
* - Create a runtime from application services: {@link make}
|
|
2739
|
+
* - Run an effect as a `Promise`: {@link ManagedRuntime.runPromise}
|
|
2740
|
+
* - Run an effect and keep its `Exit`: {@link ManagedRuntime.runPromiseExit}
|
|
2741
|
+
* - Fork an effect into a `Fiber`: {@link ManagedRuntime.runFork}
|
|
2742
|
+
* - Bridge callback-style APIs: {@link ManagedRuntime.runCallback}
|
|
2743
|
+
* - Run synchronous effects at program boundaries: {@link ManagedRuntime.runSync},
|
|
2744
|
+
* {@link ManagedRuntime.runSyncExit}
|
|
2745
|
+
* - Access the cached service context: {@link ManagedRuntime.context}
|
|
2746
|
+
* - Release layer resources: {@link ManagedRuntime.dispose},
|
|
2747
|
+
* {@link ManagedRuntime.disposeEffect}
|
|
1957
2748
|
*
|
|
1958
|
-
*
|
|
1959
|
-
* const logLevelConfig = Config.string("LOG_LEVEL").pipe(
|
|
1960
|
-
* Config.withDefault("Info")
|
|
1961
|
-
* )
|
|
2749
|
+
* **Gotchas**
|
|
1962
2750
|
*
|
|
1963
|
-
*
|
|
1964
|
-
*
|
|
2751
|
+
* - Always dispose a managed runtime when it is no longer needed, especially
|
|
2752
|
+
* when the layer acquires resources such as connections, servers, or files
|
|
2753
|
+
* - Layer construction errors are included in the error channel of runtime
|
|
2754
|
+
* runners, so `ER` is combined with the effect's own error type
|
|
2755
|
+
* - `runSync` can only execute effects without asynchronous boundaries; use
|
|
2756
|
+
* `runPromise` for asynchronous programs
|
|
2757
|
+
* - After disposal, the runtime cannot be reused
|
|
1965
2758
|
*
|
|
1966
|
-
* return Logger.make((options) => {
|
|
1967
|
-
* if (LogLevel.isGreaterThanOrEqualTo(options.logLevel, minLevel)) {
|
|
1968
|
-
* console.log(`[${options.logLevel}] ${options.message}`)
|
|
1969
|
-
* }
|
|
1970
|
-
* })
|
|
1971
|
-
* })
|
|
1972
|
-
* ```
|
|
1973
|
-
*/
|
|
1974
|
-
export * as LogLevel from "./LogLevel.js";
|
|
1975
|
-
/**
|
|
1976
2759
|
* @since 2.0.0
|
|
1977
2760
|
*/
|
|
1978
2761
|
export * as ManagedRuntime from "./ManagedRuntime.js";
|
|
@@ -2006,49 +2789,56 @@ export * as ManagedRuntime from "./ManagedRuntime.js";
|
|
|
2006
2789
|
*/
|
|
2007
2790
|
export * as Match from "./Match.js";
|
|
2008
2791
|
/**
|
|
2009
|
-
*
|
|
2010
|
-
*
|
|
2011
|
-
*
|
|
2012
|
-
*
|
|
2013
|
-
* be used to monitor performance, track business metrics, and gain insights into application behavior.
|
|
2792
|
+
* The `Metric` module provides tools for defining, updating, tagging, and
|
|
2793
|
+
* reading application metrics from Effect programs. A `Metric<Input, State>`
|
|
2794
|
+
* accepts typed input values and aggregates them into a typed state that can be
|
|
2795
|
+
* read directly or exported from a snapshot.
|
|
2014
2796
|
*
|
|
2015
|
-
*
|
|
2016
|
-
*
|
|
2017
|
-
* - **Five Metric Types**: Counters, Gauges, Frequencies, Histograms, and Summaries
|
|
2018
|
-
* - **Type Safety**: Fully typed metrics with compile-time guarantees
|
|
2019
|
-
* - **Concurrency Safe**: Thread-safe metrics that work with Effect's concurrency model
|
|
2020
|
-
* - **Attributes**: Tag metrics with key-value attributes for filtering and grouping
|
|
2021
|
-
* - **Snapshots**: Take point-in-time snapshots of all metrics for reporting
|
|
2022
|
-
* - **Runtime Integration**: Automatic fiber runtime metrics collection
|
|
2797
|
+
* **Mental model**
|
|
2023
2798
|
*
|
|
2024
|
-
*
|
|
2799
|
+
* - A metric has an identifier, a type, an optional description, optional attributes, and mutable aggregate state
|
|
2800
|
+
* - Use counters for cumulative values such as requests, errors, retries, or bytes processed
|
|
2801
|
+
* - Use gauges for point-in-time values that can rise or fall, such as active connections or queue size
|
|
2802
|
+
* - Use frequencies to count occurrences of discrete string values, such as status codes or action names
|
|
2803
|
+
* - Use histograms to bucket numeric observations and inspect count, min, max, and sum
|
|
2804
|
+
* - Use summaries to calculate quantiles over a bounded, time-based observation window
|
|
2805
|
+
* - Metrics are updated from effects with {@link update} and {@link modify}, and read with {@link value}
|
|
2806
|
+
* - Attributes tag metrics with key-value dimensions so the same logical metric can be grouped by service, endpoint, method, or other labels
|
|
2807
|
+
* - Snapshots capture the currently registered metrics and their aggregate states for reporting or export
|
|
2025
2808
|
*
|
|
2026
|
-
*
|
|
2027
|
-
* Tracks cumulative values that only increase or can be reset to zero.
|
|
2028
|
-
* Perfect for counting events, requests, errors, etc.
|
|
2809
|
+
* **Common tasks**
|
|
2029
2810
|
*
|
|
2030
|
-
*
|
|
2031
|
-
*
|
|
2032
|
-
*
|
|
2811
|
+
* - Create counters: {@link counter}
|
|
2812
|
+
* - Create gauges: {@link gauge}
|
|
2813
|
+
* - Create frequencies: {@link frequency}
|
|
2814
|
+
* - Create histograms: {@link histogram}, {@link linearBoundaries}, {@link exponentialBoundaries}
|
|
2815
|
+
* - Create summaries: {@link summary}, {@link summaryWithTimestamp}
|
|
2816
|
+
* - Measure effect duration: {@link timer}
|
|
2817
|
+
* - Update a metric: {@link update}
|
|
2818
|
+
* - Apply relative updates where supported: {@link modify}
|
|
2819
|
+
* - Read one metric: {@link value}
|
|
2820
|
+
* - Tag a metric: {@link withAttributes}
|
|
2821
|
+
* - Transform accepted input values: {@link mapInput}
|
|
2822
|
+
* - Record a constant input for repeated events: {@link withConstantInput}
|
|
2823
|
+
* - Inspect all registered metrics: {@link snapshot}, {@link dump}
|
|
2824
|
+
* - Enable fiber runtime metrics: {@link enableRuntimeMetrics}
|
|
2033
2825
|
*
|
|
2034
|
-
*
|
|
2035
|
-
* Counts occurrences of discrete string values.
|
|
2036
|
-
* Useful for tracking categorical data like HTTP status codes, user actions, etc.
|
|
2826
|
+
* **Gotchas**
|
|
2037
2827
|
*
|
|
2038
|
-
*
|
|
2039
|
-
*
|
|
2040
|
-
*
|
|
2828
|
+
* - Counter and gauge metrics can use `number` inputs by default or `bigint` inputs with the `bigint` option
|
|
2829
|
+
* - Incremental counters ignore negative updates; use non-incremental counters only when decreases are meaningful
|
|
2830
|
+
* - {@link update} sets a gauge to an absolute value, while {@link modify} changes it relative to its current value
|
|
2831
|
+
* - Histogram buckets are cumulative and depend on the boundaries supplied when the metric is created
|
|
2832
|
+
* - Summary quantiles are calculated from the configured sliding window, so old observations expire
|
|
2833
|
+
* - Prefer low-cardinality attributes; using unbounded values such as request IDs can create too many metric series
|
|
2041
2834
|
*
|
|
2042
|
-
*
|
|
2043
|
-
* Calculates quantiles over a sliding time window.
|
|
2044
|
-
* Provides statistical insights into value distributions over time.
|
|
2835
|
+
* **Quickstart**
|
|
2045
2836
|
*
|
|
2046
|
-
*
|
|
2837
|
+
* **Example** (Creating and updating metrics)
|
|
2047
2838
|
*
|
|
2048
2839
|
* ```ts
|
|
2049
2840
|
* import { Effect, Metric } from "effect"
|
|
2050
2841
|
*
|
|
2051
|
-
* // Create metrics
|
|
2052
2842
|
* const requestCount = Metric.counter("http_requests_total", {
|
|
2053
2843
|
* description: "Total number of HTTP requests"
|
|
2054
2844
|
* })
|
|
@@ -2058,31 +2848,7 @@ export * as Match from "./Match.js";
|
|
|
2058
2848
|
* boundaries: Metric.linearBoundaries({ start: 0, width: 50, count: 20 })
|
|
2059
2849
|
* })
|
|
2060
2850
|
*
|
|
2061
|
-
* // Use metrics in your application
|
|
2062
2851
|
* const handleRequest = Effect.gen(function*() {
|
|
2063
|
-
* yield* Metric.update(requestCount, 1)
|
|
2064
|
-
*
|
|
2065
|
-
* const startTime = yield* Effect.clockWith((clock) => clock.currentTimeMillis)
|
|
2066
|
-
*
|
|
2067
|
-
* // Process request...
|
|
2068
|
-
* yield* Effect.sleep("100 millis")
|
|
2069
|
-
*
|
|
2070
|
-
* const endTime = yield* Effect.clockWith((clock) => clock.currentTimeMillis)
|
|
2071
|
-
* yield* Metric.update(responseTime, endTime - startTime)
|
|
2072
|
-
* })
|
|
2073
|
-
* ```
|
|
2074
|
-
*
|
|
2075
|
-
* ## Attributes and Tagging
|
|
2076
|
-
*
|
|
2077
|
-
* ```ts
|
|
2078
|
-
* import { Effect, Metric } from "effect"
|
|
2079
|
-
*
|
|
2080
|
-
* const requestCount = Metric.counter("requests", {
|
|
2081
|
-
* description: "Number of requests by endpoint and method"
|
|
2082
|
-
* })
|
|
2083
|
-
*
|
|
2084
|
-
* const program = Effect.gen(function*() {
|
|
2085
|
-
* // Add attributes to metrics
|
|
2086
2852
|
* yield* Metric.update(
|
|
2087
2853
|
* Metric.withAttributes(requestCount, {
|
|
2088
2854
|
* endpoint: "/api/users",
|
|
@@ -2091,57 +2857,21 @@ export * as Match from "./Match.js";
|
|
|
2091
2857
|
* 1
|
|
2092
2858
|
* )
|
|
2093
2859
|
*
|
|
2094
|
-
*
|
|
2095
|
-
* const taggedCounter = Metric.withAttributes(requestCount, {
|
|
2096
|
-
* endpoint: "/api/posts",
|
|
2097
|
-
* method: "POST"
|
|
2098
|
-
* })
|
|
2099
|
-
* yield* Metric.update(taggedCounter, 1)
|
|
2100
|
-
* })
|
|
2101
|
-
* ```
|
|
2102
|
-
*
|
|
2103
|
-
* ## Advanced Examples
|
|
2104
|
-
*
|
|
2105
|
-
* ```ts
|
|
2106
|
-
* import { Effect, Metric } from "effect"
|
|
2860
|
+
* yield* Metric.update(responseTime, 125)
|
|
2107
2861
|
*
|
|
2108
|
-
*
|
|
2109
|
-
* const userSignups = Metric.counter("user_signups_total")
|
|
2110
|
-
* const activeUsers = Metric.gauge("active_users_current")
|
|
2111
|
-
* const featureUsage = Metric.frequency("feature_usage")
|
|
2112
|
-
*
|
|
2113
|
-
* // Performance metrics
|
|
2114
|
-
* const dbQueryTime = Metric.summary("db_query_duration", {
|
|
2115
|
-
* maxAge: "5 minutes",
|
|
2116
|
-
* maxSize: 1000,
|
|
2117
|
-
* quantiles: [0.5, 0.9, 0.95, 0.99]
|
|
2862
|
+
* return yield* Metric.value(requestCount)
|
|
2118
2863
|
* })
|
|
2864
|
+
* ```
|
|
2119
2865
|
*
|
|
2120
|
-
*
|
|
2121
|
-
* // Track user signup
|
|
2122
|
-
* yield* Metric.update(userSignups, 1)
|
|
2123
|
-
*
|
|
2124
|
-
* // Update active user count
|
|
2125
|
-
* yield* Metric.update(activeUsers, 1250)
|
|
2126
|
-
*
|
|
2127
|
-
* // Record feature usage
|
|
2128
|
-
* yield* Metric.update(featureUsage, "dashboard_view")
|
|
2129
|
-
*
|
|
2130
|
-
* // Measure database query time
|
|
2131
|
-
* yield* Effect.timed(performDatabaseQuery).pipe(
|
|
2132
|
-
* Effect.tap(([duration]) => Metric.update(dbQueryTime, duration))
|
|
2133
|
-
* )
|
|
2134
|
-
* })
|
|
2866
|
+
* **See also**
|
|
2135
2867
|
*
|
|
2136
|
-
*
|
|
2137
|
-
*
|
|
2138
|
-
*
|
|
2868
|
+
* - {@link counter} / {@link gauge} / {@link frequency} for common metric types
|
|
2869
|
+
* - {@link histogram} / {@link summary} for distribution metrics
|
|
2870
|
+
* - {@link update} / {@link modify} / {@link value} for working with metric state
|
|
2871
|
+
* - {@link withAttributes} for adding dimensions
|
|
2872
|
+
* - {@link snapshot} for exporting all registered metric values
|
|
2139
2873
|
*
|
|
2140
|
-
*
|
|
2141
|
-
* console.log(`${metric.id}: ${JSON.stringify(metric.state)}`)
|
|
2142
|
-
* }
|
|
2143
|
-
* })
|
|
2144
|
-
* ```
|
|
2874
|
+
* @since 2.0.0
|
|
2145
2875
|
*/
|
|
2146
2876
|
export * as Metric from "./Metric.js";
|
|
2147
2877
|
/**
|
|
@@ -2167,105 +2897,172 @@ export * as Metric from "./Metric.js";
|
|
|
2167
2897
|
* - Size: O(1)
|
|
2168
2898
|
* - Iteration: O(n)
|
|
2169
2899
|
*
|
|
2170
|
-
* @since 2.0.0
|
|
2171
2900
|
* @category data-structures
|
|
2901
|
+
* @since 2.0.0
|
|
2172
2902
|
*/
|
|
2173
2903
|
export * as MutableHashMap from "./MutableHashMap.js";
|
|
2174
2904
|
/**
|
|
2175
|
-
*
|
|
2176
|
-
*
|
|
2177
|
-
*
|
|
2178
|
-
*
|
|
2905
|
+
* The `MutableHashSet` module provides a mutable hash set for storing unique
|
|
2906
|
+
* values with efficient membership checks, insertion, removal, and iteration.
|
|
2907
|
+
* It is built on {@link MutableHashMap}: each set value is stored as a map key,
|
|
2908
|
+
* so uniqueness follows the same hashing and equality rules as the underlying
|
|
2909
|
+
* mutable hash map.
|
|
2179
2910
|
*
|
|
2180
|
-
*
|
|
2181
|
-
* boolean flag, providing O(1) average-case performance for all operations.
|
|
2911
|
+
* **Mental model**
|
|
2182
2912
|
*
|
|
2183
|
-
*
|
|
2184
|
-
* -
|
|
2185
|
-
*
|
|
2186
|
-
* -
|
|
2187
|
-
* -
|
|
2188
|
-
* -
|
|
2189
|
-
*
|
|
2913
|
+
* - `MutableHashSet<V>` is a mutable collection of unique values of type `V`
|
|
2914
|
+
* - Operations such as {@link add}, {@link remove}, and {@link clear} mutate
|
|
2915
|
+
* the set in place
|
|
2916
|
+
* - Duplicate values are ignored according to Effect equality and hashing semantics
|
|
2917
|
+
* - Values that implement `Equal` / `Hash` are compared structurally
|
|
2918
|
+
* - Primitive values and references that do not implement Effect equality use
|
|
2919
|
+
* the normal hash map behavior
|
|
2920
|
+
* - The set is iterable, so `Array.from(set)` or `for...of` can be used to
|
|
2921
|
+
* inspect its values
|
|
2190
2922
|
*
|
|
2191
|
-
*
|
|
2192
|
-
* - Add/Has/Remove: O(1) average, O(n) worst case (hash collisions)
|
|
2193
|
-
* - Clear: O(1)
|
|
2194
|
-
* - Size: O(1)
|
|
2195
|
-
* - Iteration: O(n)
|
|
2923
|
+
* **Common tasks**
|
|
2196
2924
|
*
|
|
2197
|
-
* @
|
|
2925
|
+
* - Create an empty set: {@link empty}
|
|
2926
|
+
* - Create from values: {@link make}
|
|
2927
|
+
* - Create from any iterable: {@link fromIterable}
|
|
2928
|
+
* - Add a value: {@link add}
|
|
2929
|
+
* - Check membership: {@link has}
|
|
2930
|
+
* - Remove a value: {@link remove}
|
|
2931
|
+
* - Remove all values: {@link clear}
|
|
2932
|
+
* - Count unique values: {@link size}
|
|
2933
|
+
* - Narrow unknown values: {@link isMutableHashSet}
|
|
2934
|
+
*
|
|
2935
|
+
* **Gotchas**
|
|
2936
|
+
*
|
|
2937
|
+
* - This data structure is intentionally mutable; keep ownership clear when
|
|
2938
|
+
* sharing it between callers
|
|
2939
|
+
* - Mutating operations return the same set instance for convenient piping, not
|
|
2940
|
+
* a copy
|
|
2941
|
+
* - Iteration order should not be used as a stable sorting mechanism
|
|
2942
|
+
* - For immutable set operations, use Effect's immutable collection modules
|
|
2943
|
+
* instead
|
|
2944
|
+
*
|
|
2945
|
+
* **Performance**
|
|
2946
|
+
*
|
|
2947
|
+
* - Add, membership checks, and removal are O(1) on average and O(n) in the
|
|
2948
|
+
* presence of hash collisions
|
|
2949
|
+
* - Clearing and reading the size are O(1)
|
|
2950
|
+
* - Iteration is O(n)
|
|
2951
|
+
*
|
|
2952
|
+
* **Quickstart**
|
|
2953
|
+
*
|
|
2954
|
+
* **Example** (Tracking unique values)
|
|
2955
|
+
*
|
|
2956
|
+
* ```ts
|
|
2957
|
+
* import { MutableHashSet } from "effect"
|
|
2958
|
+
*
|
|
2959
|
+
* const set = MutableHashSet.make("apple", "banana", "apple")
|
|
2960
|
+
*
|
|
2961
|
+
* MutableHashSet.add(set, "cherry")
|
|
2962
|
+
* MutableHashSet.remove(set, "banana")
|
|
2963
|
+
*
|
|
2964
|
+
* console.log(MutableHashSet.has(set, "apple"))
|
|
2965
|
+
* // Output: true
|
|
2966
|
+
*
|
|
2967
|
+
* console.log(MutableHashSet.size(set))
|
|
2968
|
+
* // Output: 2
|
|
2969
|
+
*
|
|
2970
|
+
* console.log(Array.from(set))
|
|
2971
|
+
* // Output: ["apple", "cherry"]
|
|
2972
|
+
* ```
|
|
2973
|
+
*
|
|
2974
|
+
* @fileoverview
|
|
2198
2975
|
* @category data-structures
|
|
2976
|
+
* @since 2.0.0
|
|
2199
2977
|
*/
|
|
2200
2978
|
export * as MutableHashSet from "./MutableHashSet.js";
|
|
2201
2979
|
/**
|
|
2202
|
-
*
|
|
2203
|
-
*
|
|
2204
|
-
*
|
|
2205
|
-
*
|
|
2206
|
-
*
|
|
2980
|
+
* The `MutableList` module provides a mutable linked list for accumulating,
|
|
2981
|
+
* ordering, inspecting, and draining values with efficient operations at both
|
|
2982
|
+
* ends of the list.
|
|
2983
|
+
*
|
|
2984
|
+
* A `MutableList<A>` stores values in linked buckets of arrays. Appending adds
|
|
2985
|
+
* values to the tail, prepending adds values to the head, and taking removes
|
|
2986
|
+
* values from the head. Unlike persistent collections, every mutation updates
|
|
2987
|
+
* the list object in place: operations such as {@link append}, {@link prepend},
|
|
2988
|
+
* {@link take}, {@link takeN}, {@link clear}, {@link filter}, and {@link remove}
|
|
2989
|
+
* change the same `MutableList` instance and update its `length`.
|
|
2207
2990
|
*
|
|
2208
|
-
*
|
|
2209
|
-
* - Each bucket contains an array of elements with an offset pointer
|
|
2210
|
-
* - Buckets can be marked as mutable or immutable for optimization
|
|
2211
|
-
* - Elements are taken from the head and added to the tail
|
|
2212
|
-
* - Memory is efficiently managed through bucket reuse and cleanup
|
|
2991
|
+
* **Mental model**
|
|
2213
2992
|
*
|
|
2214
|
-
*
|
|
2215
|
-
* -
|
|
2216
|
-
*
|
|
2217
|
-
* -
|
|
2218
|
-
*
|
|
2219
|
-
* -
|
|
2993
|
+
* - `MutableList<A>` is a stateful container with `head`, `tail`, and `length`
|
|
2994
|
+
* - Values are consumed from the head with {@link take}, {@link takeN}, or
|
|
2995
|
+
* {@link takeAll}
|
|
2996
|
+
* - {@link append} and {@link appendAll} preserve FIFO queue order for normal
|
|
2997
|
+
* producer-consumer use cases
|
|
2998
|
+
* - {@link prepend} and {@link prependAll} place values before the current
|
|
2999
|
+
* contents, which is useful for priority work or restoring items to the front
|
|
3000
|
+
* - {@link toArray} and {@link toArrayN} copy values without modifying the list
|
|
3001
|
+
* - The `head` and `tail` bucket fields are exposed for advanced use, but most
|
|
3002
|
+
* code should treat them as implementation details
|
|
2220
3003
|
*
|
|
2221
|
-
*
|
|
2222
|
-
* - Append/Prepend: O(1) amortized
|
|
2223
|
-
* - Take/TakeN: O(1) per element taken
|
|
2224
|
-
* - Length: O(1)
|
|
2225
|
-
* - Clear: O(1)
|
|
2226
|
-
* - Filter: O(n)
|
|
3004
|
+
* **Common tasks**
|
|
2227
3005
|
*
|
|
2228
|
-
*
|
|
2229
|
-
* -
|
|
2230
|
-
* -
|
|
2231
|
-
* -
|
|
2232
|
-
* -
|
|
3006
|
+
* - Create an empty list: {@link make}
|
|
3007
|
+
* - Add one value: {@link append}, {@link prepend}
|
|
3008
|
+
* - Add many values: {@link appendAll}, {@link prependAll}
|
|
3009
|
+
* - Drain one value: {@link take}
|
|
3010
|
+
* - Drain many values: {@link takeN}, {@link takeAll}
|
|
3011
|
+
* - Inspect without draining: {@link toArrayN}, {@link toArray}
|
|
3012
|
+
* - Reset the list: {@link clear}
|
|
3013
|
+
* - Mutate contents in place: {@link filter}, {@link remove}
|
|
2233
3014
|
*
|
|
2234
|
-
*
|
|
3015
|
+
* **Gotchas**
|
|
3016
|
+
*
|
|
3017
|
+
* - `MutableList` is intentionally mutable; sharing a list means sharing its
|
|
3018
|
+
* changing state
|
|
3019
|
+
* - {@link take} returns the {@link Empty} symbol when the list has no value, so
|
|
3020
|
+
* compare with `MutableList.Empty` instead of relying on falsy checks
|
|
3021
|
+
* - {@link appendAllUnsafe} and {@link prependAllUnsafe} may reuse the provided
|
|
3022
|
+
* array when `mutable` is `true`; only enable that optimization when callers
|
|
3023
|
+
* will not keep using the array independently
|
|
3024
|
+
* - {@link remove} uses JavaScript strict equality semantics, not structural
|
|
3025
|
+
* equality
|
|
3026
|
+
*
|
|
3027
|
+
* @fileoverview
|
|
2235
3028
|
* @category data-structures
|
|
3029
|
+
* @since 4.0.0
|
|
2236
3030
|
*/
|
|
2237
3031
|
export * as MutableList from "./MutableList.js";
|
|
2238
3032
|
/**
|
|
2239
|
-
*
|
|
2240
|
-
*
|
|
2241
|
-
*
|
|
2242
|
-
*
|
|
3033
|
+
* The `MutableRef` module provides a small synchronous container for mutable
|
|
3034
|
+
* state. A `MutableRef<A>` stores one current value of type `A`, exposes that
|
|
3035
|
+
* value through `.current`, and offers pipeable helpers for reading, replacing,
|
|
3036
|
+
* and transforming the value in place.
|
|
2243
3037
|
*
|
|
2244
|
-
*
|
|
2245
|
-
* access through a standardized API. It supports atomic compare-and-set operations for
|
|
2246
|
-
* thread-safe updates and integrates seamlessly with Effect's ecosystem.
|
|
3038
|
+
* **Mental model**
|
|
2247
3039
|
*
|
|
2248
|
-
*
|
|
2249
|
-
* -
|
|
2250
|
-
* -
|
|
2251
|
-
* -
|
|
2252
|
-
* -
|
|
2253
|
-
* -
|
|
2254
|
-
*
|
|
2255
|
-
* Common Use Cases:
|
|
2256
|
-
* - State containers in functional applications
|
|
2257
|
-
* - Counters and accumulators
|
|
2258
|
-
* - Configuration that needs to be updated at runtime
|
|
2259
|
-
* - Caching and memoization scenarios
|
|
2260
|
-
* - Inter-module communication via shared references
|
|
3040
|
+
* - `MutableRef<A>` is a stable reference whose `.current` field may change over time
|
|
3041
|
+
* - Reads and writes are synchronous and return immediately
|
|
3042
|
+
* - `set`, `update`, `increment`, `decrement`, and `toggle` mutate the same reference in place
|
|
3043
|
+
* - `getAnd*` helpers return the previous value, while `*AndGet` helpers return the new value
|
|
3044
|
+
* - `compareAndSet` updates only when the current value is equal to the expected value using `Equal.equals`
|
|
3045
|
+
* - A `MutableRef` is useful for local mutable state, but it does not make updates transactional or effectful
|
|
2261
3046
|
*
|
|
2262
|
-
*
|
|
2263
|
-
*
|
|
2264
|
-
* -
|
|
2265
|
-
* -
|
|
3047
|
+
* **Common tasks**
|
|
3048
|
+
*
|
|
3049
|
+
* - Create a reference: {@link make}
|
|
3050
|
+
* - Read the current value: {@link get} or `.current`
|
|
3051
|
+
* - Replace the current value: {@link set}, {@link setAndGet}, {@link getAndSet}
|
|
3052
|
+
* - Transform the current value: {@link update}, {@link updateAndGet}, {@link getAndUpdate}
|
|
3053
|
+
* - Coordinate conditional replacement: {@link compareAndSet}
|
|
3054
|
+
* - Work with counters: {@link increment}, {@link decrement}, {@link incrementAndGet}, {@link decrementAndGet}
|
|
3055
|
+
* - Work with boolean flags: {@link toggle}
|
|
3056
|
+
*
|
|
3057
|
+
* **Gotchas**
|
|
3058
|
+
*
|
|
3059
|
+
* - All updates are imperative mutations; aliases to the same `MutableRef` observe the same changing value
|
|
3060
|
+
* - Updating object or array values does not clone them unless the update function creates a new value
|
|
3061
|
+
* - `compareAndSet` compares with Effect equality semantics, not only JavaScript reference equality
|
|
3062
|
+
* - For state that must participate in `Effect` workflows, interruption, or fiber coordination, prefer higher-level Effect data types
|
|
2266
3063
|
*
|
|
2267
|
-
* @since 2.0.0
|
|
2268
3064
|
* @category data-structures
|
|
3065
|
+
* @since 2.0.0
|
|
2269
3066
|
*/
|
|
2270
3067
|
export * as MutableRef from "./MutableRef.js";
|
|
2271
3068
|
/**
|
|
@@ -2335,28 +3132,36 @@ export * as MutableRef from "./MutableRef.js";
|
|
|
2335
3132
|
*/
|
|
2336
3133
|
export * as Newtype from "./Newtype.js";
|
|
2337
3134
|
/**
|
|
2338
|
-
*
|
|
3135
|
+
* The `NonEmptyIterable` module provides a type-level representation of any
|
|
3136
|
+
* JavaScript `Iterable` that is known to contain at least one element. A
|
|
3137
|
+
* `NonEmptyIterable<A>` can be consumed anywhere an `Iterable<A>` is expected,
|
|
3138
|
+
* while also carrying the guarantee that reading the first element is safe.
|
|
3139
|
+
*
|
|
3140
|
+
* **Mental model**
|
|
2339
3141
|
*
|
|
2340
|
-
*
|
|
2341
|
-
*
|
|
2342
|
-
*
|
|
3142
|
+
* - `NonEmptyIterable<A>` is an `Iterable<A>` branded with a non-empty guarantee
|
|
3143
|
+
* - The guarantee is static: values should only be typed this way when construction or validation proves at least one element exists
|
|
3144
|
+
* - The iterable can be an array, string, set, map, generator, or any custom iterable
|
|
3145
|
+
* - `unprepend` safely separates the first element from an iterator for the remaining elements
|
|
3146
|
+
* - Operations that may remove elements, such as filtering, usually return ordinary collections because they can become empty
|
|
2343
3147
|
*
|
|
2344
|
-
*
|
|
3148
|
+
* **Common tasks**
|
|
3149
|
+
*
|
|
3150
|
+
* - Accept inputs that must contain at least one value
|
|
3151
|
+
* - Extract a head element and process the remaining iterator with {@link unprepend}
|
|
3152
|
+
* - Model APIs such as reductions, comparisons, or aggregation that are undefined for empty inputs
|
|
3153
|
+
* - Preserve compatibility with the JavaScript iteration protocol while documenting the stronger invariant
|
|
2345
3154
|
*
|
|
2346
|
-
*
|
|
2347
|
-
* - **Iterator Protocol**: Fully compatible with JavaScript's built-in iteration protocol
|
|
2348
|
-
* - **Functional Operations**: Safe operations that preserve the non-empty property
|
|
2349
|
-
* - **Lightweight**: Minimal overhead with maximum type safety
|
|
3155
|
+
* **Gotchas**
|
|
2350
3156
|
*
|
|
2351
|
-
*
|
|
3157
|
+
* - A type assertion does not make an empty iterable non-empty; only assert after a trusted check or constructor
|
|
3158
|
+
* - Iterators are stateful, so calling {@link unprepend} consumes the first yielded value from that iterator
|
|
3159
|
+
* - The order of the first element follows the source iterable's iteration order, for example insertion order for `Map` and `Set`
|
|
3160
|
+
* - Some transformations preserve non-emptiness, but transformations that can discard elements must account for the empty case
|
|
2352
3161
|
*
|
|
2353
|
-
*
|
|
2354
|
-
* - Finding the maximum or minimum value
|
|
2355
|
-
* - Getting the first or last element
|
|
2356
|
-
* - Reducing without an initial value
|
|
2357
|
-
* - Operations that would otherwise need runtime checks
|
|
3162
|
+
* **Quickstart**
|
|
2358
3163
|
*
|
|
2359
|
-
*
|
|
3164
|
+
* **Example** (Requiring a non-empty iterable)
|
|
2360
3165
|
*
|
|
2361
3166
|
* ```ts
|
|
2362
3167
|
* import * as NonEmptyIterable from "effect/NonEmptyIterable"
|
|
@@ -2394,6 +3199,8 @@ export * as Newtype from "./Newtype.js";
|
|
|
2394
3199
|
*
|
|
2395
3200
|
* ## Working with Different Iterable Types
|
|
2396
3201
|
*
|
|
3202
|
+
* **Example** (Adapting iterable inputs)
|
|
3203
|
+
*
|
|
2397
3204
|
* ```ts
|
|
2398
3205
|
* import { Array } from "effect"
|
|
2399
3206
|
*
|
|
@@ -2439,10 +3246,11 @@ export * as Newtype from "./Newtype.js";
|
|
|
2439
3246
|
*
|
|
2440
3247
|
* ## Integration with Effect Arrays
|
|
2441
3248
|
*
|
|
3249
|
+
* **Example** (Processing non-empty iterables with Array)
|
|
3250
|
+
*
|
|
2442
3251
|
* ```ts
|
|
2443
3252
|
* import { Array, pipe } from "effect"
|
|
2444
3253
|
* import type * as NonEmptyIterable from "effect/NonEmptyIterable"
|
|
2445
|
-
* import type * as NonEmptyIterable from "effect/NonEmptyIterable"
|
|
2446
3254
|
*
|
|
2447
3255
|
* // Many Array functions work with NonEmptyIterable
|
|
2448
3256
|
* declare const nonEmptyData: NonEmptyIterable.NonEmptyIterable<number>
|
|
@@ -2463,6 +3271,8 @@ export * as Newtype from "./Newtype.js";
|
|
|
2463
3271
|
* // This would still be non-empty if the source was non-empty
|
|
2464
3272
|
* )
|
|
2465
3273
|
* ```
|
|
3274
|
+
*
|
|
3275
|
+
* @since 2.0.0
|
|
2466
3276
|
*/
|
|
2467
3277
|
export * as NonEmptyIterable from "./NonEmptyIterable.js";
|
|
2468
3278
|
/**
|
|
@@ -2566,7 +3376,6 @@ export * as Number from "./Number.js";
|
|
|
2566
3376
|
* - {@link some} / {@link success} / {@link failure} — built-in prisms
|
|
2567
3377
|
*
|
|
2568
3378
|
* @since 4.0.0
|
|
2569
|
-
* @module
|
|
2570
3379
|
*/
|
|
2571
3380
|
export * as Optic from "./Optic.js";
|
|
2572
3381
|
/**
|
|
@@ -2641,7 +3450,6 @@ export * as Optic from "./Optic.js";
|
|
|
2641
3450
|
* - {@link gen} for generator-based syntax
|
|
2642
3451
|
*
|
|
2643
3452
|
* @since 2.0.0
|
|
2644
|
-
* @module
|
|
2645
3453
|
*/
|
|
2646
3454
|
export * as Option from "./Option.js";
|
|
2647
3455
|
/**
|
|
@@ -2697,50 +3505,202 @@ export * as Option from "./Option.js";
|
|
|
2697
3505
|
*/
|
|
2698
3506
|
export * as Order from "./Order.js";
|
|
2699
3507
|
/**
|
|
2700
|
-
*
|
|
2701
|
-
*
|
|
2702
|
-
*
|
|
2703
|
-
*
|
|
3508
|
+
* The `Ordering` module provides the standard representation for the result of
|
|
3509
|
+
* comparing two values. An `Ordering` is one of three numeric literals: `-1`
|
|
3510
|
+
* when the first value is less than the second, `0` when both values compare as
|
|
3511
|
+
* equal, and `1` when the first value is greater than the second.
|
|
2704
3512
|
*
|
|
2705
|
-
*
|
|
2706
|
-
* ordered data structures. It provides composable operations for combining multiple comparison results
|
|
2707
|
-
* and pattern matching on ordering outcomes.
|
|
3513
|
+
* **Mental model**
|
|
2708
3514
|
*
|
|
2709
|
-
*
|
|
2710
|
-
*
|
|
2711
|
-
* -
|
|
2712
|
-
*
|
|
2713
|
-
* -
|
|
2714
|
-
*
|
|
2715
|
-
*
|
|
2716
|
-
*
|
|
2717
|
-
* - Implementing custom comparison functions
|
|
2718
|
-
* - Building complex sorting criteria
|
|
2719
|
-
* - Combining multiple comparison results
|
|
2720
|
-
* - Creating ordered data structures
|
|
2721
|
-
* - Pattern matching on comparison outcomes
|
|
3515
|
+
* - `Ordering` describes the relationship between two compared values, not the
|
|
3516
|
+
* values themselves
|
|
3517
|
+
* - Negative means "less than", zero means "equal", and positive means "greater
|
|
3518
|
+
* than"
|
|
3519
|
+
* - Unlike JavaScript comparators, this type is normalized to exactly `-1`, `0`,
|
|
3520
|
+
* or `1`
|
|
3521
|
+
* - `0` is neutral when combining comparisons; the first non-zero ordering
|
|
3522
|
+
* determines the result
|
|
2722
3523
|
*
|
|
2723
|
-
*
|
|
3524
|
+
* **Common tasks**
|
|
3525
|
+
*
|
|
3526
|
+
* - Interpret a comparison result with {@link match}
|
|
3527
|
+
* - Reverse ascending and descending order with {@link reverse}
|
|
3528
|
+
* - Combine multiple comparison criteria with {@link Reducer}
|
|
3529
|
+
* - Build custom comparison functions for sorting, ordered collections, and
|
|
3530
|
+
* domain-specific ordering rules
|
|
3531
|
+
*
|
|
3532
|
+
* **Gotchas**
|
|
3533
|
+
*
|
|
3534
|
+
* - Do not cast arbitrary comparator results such as `a.localeCompare(b)`
|
|
3535
|
+
* directly unless they have been normalized to `-1`, `0`, or `1`
|
|
3536
|
+
* - In comparator-style APIs, `-1` means the left value should come before the
|
|
3537
|
+
* right value, while `1` means it should come after
|
|
3538
|
+
* - Reversing an `Ordering` swaps `-1` and `1`, but leaves `0` unchanged
|
|
3539
|
+
*
|
|
3540
|
+
* @fileoverview
|
|
2724
3541
|
* @category utilities
|
|
3542
|
+
* @since 2.0.0
|
|
2725
3543
|
*/
|
|
2726
3544
|
export * as Ordering from "./Ordering.js";
|
|
2727
3545
|
/**
|
|
3546
|
+
* The `PartitionedSemaphore` module provides a semaphore for limiting
|
|
3547
|
+
* concurrency across a shared permit pool while keeping waiters grouped by
|
|
3548
|
+
* partition key. A `PartitionedSemaphore<K>` is useful when many independent
|
|
3549
|
+
* groups of work compete for the same bounded resource and each group should
|
|
3550
|
+
* make progress without one busy group monopolizing released permits.
|
|
3551
|
+
*
|
|
3552
|
+
* **Mental model**
|
|
3553
|
+
*
|
|
3554
|
+
* - The semaphore has a fixed shared capacity measured in permits
|
|
3555
|
+
* - Work acquires permits with a partition key of type `K`
|
|
3556
|
+
* - Waiting acquisitions are tracked per partition
|
|
3557
|
+
* - Released permits are assigned to waiting partitions in round-robin order
|
|
3558
|
+
* - `withPermit` and `withPermits` acquire permits around an effect and
|
|
3559
|
+
* release them when the effect exits, fails, or is interrupted
|
|
3560
|
+
*
|
|
3561
|
+
* **Common tasks**
|
|
3562
|
+
*
|
|
3563
|
+
* - Create a semaphore: {@link make}, {@link makeUnsafe}
|
|
3564
|
+
* - Inspect capacity and availability: {@link capacity}, {@link available}
|
|
3565
|
+
* - Acquire and release manually: {@link take}, {@link release}
|
|
3566
|
+
* - Limit a single operation per partition: {@link withPermit}
|
|
3567
|
+
* - Limit weighted work per partition: {@link withPermits}
|
|
3568
|
+
* - Run only when permits are immediately available:
|
|
3569
|
+
* {@link withPermitsIfAvailable}
|
|
3570
|
+
*
|
|
3571
|
+
* **Gotchas**
|
|
3572
|
+
*
|
|
3573
|
+
* - `withPermitsIfAvailable` does not use a partition key; it only succeeds
|
|
3574
|
+
* when the shared pool has enough permits immediately
|
|
3575
|
+
* - Acquiring more permits than the semaphore capacity never completes
|
|
3576
|
+
* - Requests for zero or negative permits complete without acquiring anything
|
|
3577
|
+
* - Non-finite capacities create an unbounded semaphore whose acquire and
|
|
3578
|
+
* release operations complete immediately
|
|
3579
|
+
*
|
|
2728
3580
|
* @since 4.0.0
|
|
2729
3581
|
*/
|
|
2730
3582
|
export * as PartitionedSemaphore from "./PartitionedSemaphore.js";
|
|
2731
3583
|
/**
|
|
3584
|
+
* The `Path` module provides a platform path service for manipulating file
|
|
3585
|
+
* system paths through Effect's environment. It models path operations as a
|
|
3586
|
+
* replaceable service so programs can depend on path behavior without directly
|
|
3587
|
+
* coupling to a particular runtime implementation.
|
|
3588
|
+
*
|
|
3589
|
+
* **Mental model**
|
|
3590
|
+
*
|
|
3591
|
+
* - `Path.Path` is a `Context.Service` tag used to access the current path implementation
|
|
3592
|
+
* - The service offers familiar path operations such as joining, resolving, parsing, and formatting
|
|
3593
|
+
* - Most operations are pure string transformations and follow POSIX-style path semantics
|
|
3594
|
+
* - File URL conversions return `Effect`s because invalid paths or URLs can fail with `BadArgument`
|
|
3595
|
+
* - Custom implementations can be provided with `Layer.succeed` for alternate platforms or tests
|
|
3596
|
+
*
|
|
3597
|
+
* **Common tasks**
|
|
3598
|
+
*
|
|
3599
|
+
* - Combine path segments with `join` or turn segments into an absolute path with `resolve`
|
|
3600
|
+
* - Normalize `.` and `..` segments with `normalize`
|
|
3601
|
+
* - Inspect paths with `basename`, `dirname`, `extname`, and `isAbsolute`
|
|
3602
|
+
* - Convert between structured path parts and strings with `parse` and `format`
|
|
3603
|
+
* - Compute relative paths with `relative`
|
|
3604
|
+
* - Convert between file paths and `file:` URLs with `toFileUrl` and `fromFileUrl`
|
|
3605
|
+
*
|
|
3606
|
+
* **Gotchas**
|
|
3607
|
+
*
|
|
3608
|
+
* - Path strings are not checked against the file system; these operations only manipulate syntax
|
|
3609
|
+
* - `resolve` may consult the host current working directory when no absolute segment is supplied
|
|
3610
|
+
* - `fromFileUrl` only accepts valid `file:` URLs and rejects encoded path separators
|
|
3611
|
+
* - Use the service from the environment when writing portable Effect code instead of importing
|
|
3612
|
+
* host-specific path APIs directly
|
|
3613
|
+
*
|
|
2732
3614
|
* @since 4.0.0
|
|
2733
3615
|
*/
|
|
2734
3616
|
export * as Path from "./Path.js";
|
|
2735
3617
|
/**
|
|
3618
|
+
* The `Pipeable` module defines the shared interface and implementation helpers
|
|
3619
|
+
* for values that support Effect-style method chaining with `.pipe(...)`.
|
|
3620
|
+
*
|
|
3621
|
+
* A `Pipeable` value can pass itself through a sequence of unary functions from
|
|
3622
|
+
* left to right, so code can be written as `value.pipe(f, g, h)` instead of
|
|
3623
|
+
* deeply nesting calls. This is the method form used by many Effect data types
|
|
3624
|
+
* to compose transformations, validations, and effectful operations while
|
|
3625
|
+
* keeping the original value as the starting point of the pipeline.
|
|
3626
|
+
*
|
|
3627
|
+
* **Common tasks**
|
|
3628
|
+
*
|
|
3629
|
+
* - Type values that expose a `.pipe(...)` method with the {@link Pipeable} interface
|
|
3630
|
+
* - Implement a custom `.pipe(...)` method with {@link pipeArguments}
|
|
3631
|
+
* - Reuse the standard implementation through {@link Prototype}, {@link Class}, or {@link Mixin}
|
|
3632
|
+
*
|
|
3633
|
+
* **Gotchas**
|
|
3634
|
+
*
|
|
3635
|
+
* - Each function receives the result of the previous function, not the original value
|
|
3636
|
+
* - The overloads preserve precise types for long pipelines, but very long chains may be easier to read when split
|
|
3637
|
+
*
|
|
2736
3638
|
* @since 2.0.0
|
|
2737
3639
|
*/
|
|
2738
3640
|
export * as Pipeable from "./Pipeable.js";
|
|
2739
3641
|
/**
|
|
3642
|
+
* The `PlatformError` module defines the normalized error model used by
|
|
3643
|
+
* platform APIs when adapting host operations into Effect programs. It gives
|
|
3644
|
+
* callers a stable `PlatformError` wrapper whose `reason` is either a
|
|
3645
|
+
* `BadArgument`, for invalid inputs rejected before an operation runs, or a
|
|
3646
|
+
* `SystemError`, for failures reported by the host platform or operating
|
|
3647
|
+
* system.
|
|
3648
|
+
*
|
|
3649
|
+
* Use this module when implementing or consuming platform services such as
|
|
3650
|
+
* file systems, terminal access, sockets, or other environment-specific APIs.
|
|
3651
|
+
* `SystemError` intentionally groups many low-level failures into a small set
|
|
3652
|
+
* of portable tags like `NotFound`, `PermissionDenied`, and `TimedOut`, while
|
|
3653
|
+
* still preserving operation details such as the module, method, syscall, path
|
|
3654
|
+
* or descriptor, description, and original cause when available.
|
|
3655
|
+
*
|
|
3656
|
+
* **Common tasks**
|
|
3657
|
+
*
|
|
3658
|
+
* - Create platform failures from system operations with {@link systemError}
|
|
3659
|
+
* - Report rejected caller input with {@link badArgument}
|
|
3660
|
+
* - Inspect the underlying reason via {@link PlatformError.reason}
|
|
3661
|
+
* - Match normalized system failures with {@link SystemErrorTag}
|
|
3662
|
+
*
|
|
3663
|
+
* **Gotchas**
|
|
3664
|
+
*
|
|
3665
|
+
* - `PlatformError` is a wrapper; inspect `reason` to distinguish
|
|
3666
|
+
* `BadArgument` from `SystemError`
|
|
3667
|
+
* - `SystemErrorTag` values are normalized categories, not necessarily raw
|
|
3668
|
+
* platform error codes
|
|
3669
|
+
* - The original cause is preserved when provided, but portable handling
|
|
3670
|
+
* should rely on the normalized fields
|
|
3671
|
+
*
|
|
2740
3672
|
* @since 4.0.0
|
|
2741
3673
|
*/
|
|
2742
3674
|
export * as PlatformError from "./PlatformError.js";
|
|
2743
3675
|
/**
|
|
3676
|
+
* The `Pool` module provides scoped resource pools for sharing expensive or
|
|
3677
|
+
* limited resources across fibers. A `Pool<A, E>` manages values of type `A`
|
|
3678
|
+
* acquired by an effect that may fail with `E`, automatically releasing all
|
|
3679
|
+
* allocated resources when the surrounding `Scope` closes.
|
|
3680
|
+
*
|
|
3681
|
+
* **Mental model**
|
|
3682
|
+
*
|
|
3683
|
+
* - A pool owns a bounded set of acquired items and hands them out with {@link get}
|
|
3684
|
+
* - Each checkout is scoped; leaving the scope returns the item to the pool
|
|
3685
|
+
* - `concurrency` controls how many fibers may use the same item at once
|
|
3686
|
+
* - `targetUtilization` controls when the pool grows between its minimum and maximum sizes
|
|
3687
|
+
* - {@link invalidate} removes a specific item so it can be replaced lazily
|
|
3688
|
+
*
|
|
3689
|
+
* **Common tasks**
|
|
3690
|
+
*
|
|
3691
|
+
* - Create a fixed-size pool with {@link make}
|
|
3692
|
+
* - Create an elastic pool with time-to-live reclamation using {@link makeWithTTL}
|
|
3693
|
+
* - Implement custom resizing and reclamation behavior with {@link makeWithStrategy}
|
|
3694
|
+
* - Borrow resources safely in scoped effects with {@link get}
|
|
3695
|
+
*
|
|
3696
|
+
* **Gotchas**
|
|
3697
|
+
*
|
|
3698
|
+
* - Pool construction and item checkout require `Scope`; closing the scope shuts
|
|
3699
|
+
* down the pool or returns the borrowed item
|
|
3700
|
+
* - Failed acquisitions are represented by the `get` effect failing with the
|
|
3701
|
+
* acquisition error, and retrying `get` can retry acquisition
|
|
3702
|
+
* - Resource finalization order during shutdown is unspecified
|
|
3703
|
+
*
|
|
2744
3704
|
* @since 2.0.0
|
|
2745
3705
|
*/
|
|
2746
3706
|
export * as Pool from "./Pool.js";
|
|
@@ -2805,20 +3765,22 @@ export * as PrimaryKey from "./PrimaryKey.js";
|
|
|
2805
3765
|
* can subscribe to receive those messages. PubSub supports various backpressure strategies,
|
|
2806
3766
|
* message replay, and concurrent access from multiple producers and consumers.
|
|
2807
3767
|
*
|
|
2808
|
-
*
|
|
3768
|
+
* **Example** (Creating and using a PubSub)
|
|
3769
|
+
*
|
|
2809
3770
|
* ```ts
|
|
2810
3771
|
* import { Effect, PubSub } from "effect"
|
|
2811
3772
|
*
|
|
2812
3773
|
* const program = Effect.gen(function*() {
|
|
2813
3774
|
* const pubsub = yield* PubSub.bounded<string>(10)
|
|
2814
3775
|
*
|
|
2815
|
-
* // Publisher
|
|
2816
|
-
* yield* PubSub.publish(pubsub, "Hello")
|
|
2817
|
-
* yield* PubSub.publish(pubsub, "World")
|
|
2818
|
-
*
|
|
2819
|
-
* // Subscriber
|
|
2820
3776
|
* yield* Effect.scoped(Effect.gen(function*() {
|
|
2821
3777
|
* const subscription = yield* PubSub.subscribe(pubsub)
|
|
3778
|
+
*
|
|
3779
|
+
* // Publisher
|
|
3780
|
+
* yield* PubSub.publish(pubsub, "Hello")
|
|
3781
|
+
* yield* PubSub.publish(pubsub, "World")
|
|
3782
|
+
*
|
|
3783
|
+
* // Subscriber
|
|
2822
3784
|
* const message1 = yield* PubSub.take(subscription)
|
|
2823
3785
|
* const message2 = yield* PubSub.take(subscription)
|
|
2824
3786
|
* console.log(message1, message2) // "Hello", "World"
|
|
@@ -2830,19 +3792,106 @@ export * as PrimaryKey from "./PrimaryKey.js";
|
|
|
2830
3792
|
*/
|
|
2831
3793
|
export * as PubSub from "./PubSub.js";
|
|
2832
3794
|
/**
|
|
3795
|
+
* The `Pull` module provides the low-level pull-step abstraction used by
|
|
3796
|
+
* stream-like consumers. A `Pull<A, E, Done, R>` is an `Effect` that can
|
|
3797
|
+
* produce one value of type `A`, fail with an ordinary error `E`, or signal
|
|
3798
|
+
* end-of-input with a `Cause.Done<Done>` value.
|
|
3799
|
+
*
|
|
3800
|
+
* **Mental model**
|
|
3801
|
+
*
|
|
3802
|
+
* - `Pull` is an `Effect` with a distinguished completion signal in the error channel
|
|
3803
|
+
* - ordinary failures and completion are both represented by `Cause`, but can be separated with the helpers in this module
|
|
3804
|
+
* - the `Done` value can carry leftover state or a final value needed by a downstream consumer
|
|
3805
|
+
* - `Pull` is useful when repeatedly evaluating an effect until it either produces values, fails, or reports that no more input is available
|
|
3806
|
+
*
|
|
3807
|
+
* **Common tasks**
|
|
3808
|
+
*
|
|
3809
|
+
* - Extract type parameters from a pull: {@link Success}, {@link Error}, {@link Leftover}, {@link Services}
|
|
3810
|
+
* - Detect and filter completion: {@link isDoneCause}, {@link filterDone}, {@link filterNoDone}
|
|
3811
|
+
* - Recover from completion while preserving ordinary failures: {@link catchDone}
|
|
3812
|
+
* - Convert done causes to successful exits: {@link doneExitFromCause}
|
|
3813
|
+
* - Handle all outcomes explicitly: {@link matchEffect}
|
|
3814
|
+
*
|
|
3815
|
+
* **Gotchas**
|
|
3816
|
+
*
|
|
3817
|
+
* - `Cause.Done` is not an ordinary failure; use this module's helpers before treating a pull failure as an error
|
|
3818
|
+
* - `Done` lives in the error channel, so generic `Effect` error handling can catch it unless you filter it deliberately
|
|
3819
|
+
* - `Pull` is a low-level primitive; most user-facing stream workflows should prefer higher-level stream APIs when available
|
|
3820
|
+
*
|
|
2833
3821
|
* @since 4.0.0
|
|
2834
3822
|
*/
|
|
2835
3823
|
export * as Pull from "./Pull.js";
|
|
2836
3824
|
/**
|
|
3825
|
+
* The `Queue` module provides asynchronous queues for communicating between
|
|
3826
|
+
* fibers. A `Queue<A, E>` can receive values of type `A`, deliver them to
|
|
3827
|
+
* consumers in order, and eventually complete or fail with an error of type
|
|
3828
|
+
* `E`.
|
|
3829
|
+
*
|
|
3830
|
+
* **Mental model**
|
|
3831
|
+
*
|
|
3832
|
+
* - A queue is a fiber-aware channel with one write side ({@link Enqueue}) and
|
|
3833
|
+
* one read side ({@link Dequeue})
|
|
3834
|
+
* - Producers add values with {@link offer} or {@link offerAll}; consumers
|
|
3835
|
+
* remove values with {@link take}, {@link takeN}, {@link takeBetween}, or
|
|
3836
|
+
* {@link takeAll}
|
|
3837
|
+
* - Bounded queues use an overflow strategy: {@link bounded} suspends
|
|
3838
|
+
* producers, {@link dropping} rejects new values, and {@link sliding} drops
|
|
3839
|
+
* old values
|
|
3840
|
+
* - Queues can be completed with {@link end}, failed with {@link fail} or
|
|
3841
|
+
* {@link failCause}, interrupted with {@link interrupt}, and shut down with
|
|
3842
|
+
* {@link shutdown}
|
|
3843
|
+
* - Operations are expressed as `Effect` values so waiting producers and
|
|
3844
|
+
* consumers compose with interruption, scheduling, and structured
|
|
3845
|
+
* concurrency
|
|
3846
|
+
*
|
|
3847
|
+
* **Common tasks**
|
|
3848
|
+
*
|
|
3849
|
+
* - Create queues: {@link make}, {@link bounded}, {@link dropping},
|
|
3850
|
+
* {@link sliding}, {@link unbounded}
|
|
3851
|
+
* - Restrict capabilities: {@link asEnqueue}, {@link asDequeue}
|
|
3852
|
+
* - Produce values: {@link offer}, {@link offerAll}
|
|
3853
|
+
* - Consume values: {@link take}, {@link takeN}, {@link takeBetween},
|
|
3854
|
+
* {@link takeAll}, {@link poll}, {@link peek}
|
|
3855
|
+
* - Drain or reset buffered values: {@link collect}, {@link clear}
|
|
3856
|
+
* - Signal lifecycle: {@link end}, {@link fail}, {@link failCause},
|
|
3857
|
+
* {@link interrupt}, {@link shutdown}
|
|
3858
|
+
* - Inspect state: {@link size}, {@link isFull}
|
|
3859
|
+
*
|
|
3860
|
+
* **Gotchas**
|
|
3861
|
+
*
|
|
3862
|
+
* - `take` waits when the queue is empty; use {@link poll} when absence should
|
|
3863
|
+
* be represented as `Option.None`
|
|
3864
|
+
* - `dropping` and `sliding` queues can lose values by design; use
|
|
3865
|
+
* {@link bounded} when every offered value must be preserved
|
|
3866
|
+
* - Completion and failure are observed by consumers through the queue's error
|
|
3867
|
+
* channel, so include `Cause.Done` in the error type when using {@link end}
|
|
3868
|
+
* - The `Unsafe` variants are synchronous, low-level operations; prefer the
|
|
3869
|
+
* effectful APIs in application code
|
|
3870
|
+
*
|
|
3871
|
+
* **See also**
|
|
3872
|
+
*
|
|
3873
|
+
* - {@link Enqueue} for write-only queue handles
|
|
3874
|
+
* - {@link Dequeue} for read-only queue handles
|
|
3875
|
+
* - {@link Pull} for stream-style completion errors
|
|
3876
|
+
*
|
|
2837
3877
|
* @since 3.8.0
|
|
2838
3878
|
*/
|
|
2839
3879
|
export * as Queue from "./Queue.js";
|
|
2840
3880
|
/**
|
|
2841
|
-
* The Random module provides a service for generating random numbers
|
|
2842
|
-
* programs. It offers a testable and composable way to work with
|
|
2843
|
-
* supporting integers, floating-point numbers, and range-based
|
|
3881
|
+
* The `Random` module provides a service for generating pseudo-random numbers
|
|
3882
|
+
* in Effect programs. It offers a testable and composable way to work with
|
|
3883
|
+
* randomness, supporting integers, floating-point numbers, and range-based
|
|
3884
|
+
* generation.
|
|
3885
|
+
*
|
|
3886
|
+
* The default `Random` service is not cryptographically secure. Do not use it
|
|
3887
|
+
* for secrets, tokens, UUIDs, session identifiers, or other security-sensitive
|
|
3888
|
+
* values. For cryptographically secure random generation, replace the service
|
|
3889
|
+
* with a cryptographically secure implementation such as the platform `Crypto`
|
|
3890
|
+
* service. `Random.withSeed` also replaces the service, but predictable seeds
|
|
3891
|
+
* remain deterministic and must not be treated as cryptographically secure.
|
|
3892
|
+
*
|
|
3893
|
+
* **Example** (Generating random values)
|
|
2844
3894
|
*
|
|
2845
|
-
* @example
|
|
2846
3895
|
* ```ts
|
|
2847
3896
|
* import { Effect, Random } from "effect"
|
|
2848
3897
|
*
|
|
@@ -2862,10 +3911,44 @@ export * as Queue from "./Queue.js";
|
|
|
2862
3911
|
*/
|
|
2863
3912
|
export * as Random from "./Random.js";
|
|
2864
3913
|
/**
|
|
3914
|
+
* The `RcMap` module provides a scoped, reference-counted map for sharing
|
|
3915
|
+
* resources by key. It is useful when many fibers may request the same
|
|
3916
|
+
* resource, such as a connection, client, session, or cached handle, and the
|
|
3917
|
+
* resource should be acquired once, reused while it has active references, and
|
|
3918
|
+
* released automatically when it is no longer needed.
|
|
3919
|
+
*
|
|
3920
|
+
* Each key is resolved with a user-provided lookup effect on first access via
|
|
3921
|
+
* {@link get}. Further accesses to the same key share the in-flight or acquired
|
|
3922
|
+
* resource and increment its reference count for the caller's current
|
|
3923
|
+
* `Scope`. When those scopes close, references are released; resources can be
|
|
3924
|
+
* closed immediately, kept alive for an idle time-to-live, invalidated
|
|
3925
|
+
* explicitly, or bounded by a maximum capacity.
|
|
3926
|
+
*
|
|
3927
|
+
* `RcMap` is designed for Effect resource lifecycles rather than general
|
|
3928
|
+
* mutable caching. The map itself is scoped, lookups require a `Scope`, and
|
|
3929
|
+
* complex keys should provide `Equal` / `Hash` behavior when they need
|
|
3930
|
+
* value-based lookup semantics.
|
|
3931
|
+
*
|
|
2865
3932
|
* @since 3.5.0
|
|
2866
3933
|
*/
|
|
2867
3934
|
export * as RcMap from "./RcMap.js";
|
|
2868
3935
|
/**
|
|
3936
|
+
* The `RcRef` module provides reference-counted access to a shared resource
|
|
3937
|
+
* whose lifecycle is managed by `Scope`. An `RcRef<A, E>` lazily acquires its
|
|
3938
|
+
* resource the first time it is requested, shares that resource across active
|
|
3939
|
+
* users, and releases it when the final scope holding a reference closes.
|
|
3940
|
+
*
|
|
3941
|
+
* Use `RcRef` when several scoped operations should reuse the same expensive
|
|
3942
|
+
* or stateful resource, such as a connection, client, cache, or worker, without
|
|
3943
|
+
* making each operation acquire and release its own copy. `make` defines how
|
|
3944
|
+
* the resource is acquired, `get` borrows the current resource for the active
|
|
3945
|
+
* scope, and `invalidate` forces a future `get` to acquire a fresh resource.
|
|
3946
|
+
*
|
|
3947
|
+
* The resource is tied to scopes rather than ordinary object reachability:
|
|
3948
|
+
* every `get` must run with a `Scope`, and the reference count is decremented
|
|
3949
|
+
* when that scope closes. If `idleTimeToLive` is configured, a resource whose
|
|
3950
|
+
* reference count reaches zero can remain cached briefly before release.
|
|
3951
|
+
*
|
|
2869
3952
|
* @since 3.5.0
|
|
2870
3953
|
*/
|
|
2871
3954
|
export * as RcRef from "./RcRef.js";
|
|
@@ -3029,7 +4112,8 @@ export * as Reducer from "./Reducer.js";
|
|
|
3029
4112
|
* mutable variables, Refs are thread-safe and work seamlessly with Effect's concurrency model.
|
|
3030
4113
|
* They provide atomic operations for safe state management in concurrent programs.
|
|
3031
4114
|
*
|
|
3032
|
-
*
|
|
4115
|
+
* **Example** (Managing shared state with refs)
|
|
4116
|
+
*
|
|
3033
4117
|
* ```ts
|
|
3034
4118
|
* import { Effect, Ref } from "effect"
|
|
3035
4119
|
*
|
|
@@ -3089,10 +4173,85 @@ export * as RegExp from "./RegExp.js";
|
|
|
3089
4173
|
*/
|
|
3090
4174
|
export * as Request from "./Request.js";
|
|
3091
4175
|
/**
|
|
4176
|
+
* The `RequestResolver` module provides the data-loading side of
|
|
4177
|
+
* `Effect.request`. A `Request` describes what a fiber needs, while a
|
|
4178
|
+
* `RequestResolver` describes how to collect, batch, execute, cache, trace,
|
|
4179
|
+
* and complete those requests.
|
|
4180
|
+
*
|
|
4181
|
+
* **Mental model**
|
|
4182
|
+
*
|
|
4183
|
+
* - A resolver receives one or more `Request.Entry` values and must complete
|
|
4184
|
+
* each entry with either a success or failure
|
|
4185
|
+
* - Concurrent requests made with the same resolver can be gathered into a
|
|
4186
|
+
* batch before the resolver is run
|
|
4187
|
+
* - Batch keys split pending requests into independent groups, which is useful
|
|
4188
|
+
* when different backends, tenants, or query shapes must be resolved
|
|
4189
|
+
* separately
|
|
4190
|
+
* - Delays and `batchN` tune how long requests are collected and how large
|
|
4191
|
+
* each batch may become
|
|
4192
|
+
* - Resolvers can be wrapped with tracing, in-memory caching, cache services,
|
|
4193
|
+
* and persistence without changing the request type
|
|
4194
|
+
*
|
|
4195
|
+
* **Common tasks**
|
|
4196
|
+
*
|
|
4197
|
+
* - Create a resolver from batch logic: {@link make}
|
|
4198
|
+
* - Create grouped batch logic: {@link makeGrouped} or {@link grouped}
|
|
4199
|
+
* - Create a resolver from pure logic: {@link fromFunction} or
|
|
4200
|
+
* {@link fromFunctionBatched}
|
|
4201
|
+
* - Create a resolver from effectful logic: {@link fromEffect} or
|
|
4202
|
+
* {@link fromEffectTagged}
|
|
4203
|
+
* - Control batching: {@link setDelay}, {@link setDelayEffect},
|
|
4204
|
+
* {@link batchN}
|
|
4205
|
+
* - Add operational behavior: {@link around}, {@link race}, {@link withSpan}
|
|
4206
|
+
* - Reuse results: {@link withCache}, {@link asCache}, {@link persisted}
|
|
4207
|
+
*
|
|
4208
|
+
* **Gotchas**
|
|
4209
|
+
*
|
|
4210
|
+
* - Every entry passed to a resolver must be completed; leaving an entry
|
|
4211
|
+
* incomplete causes the waiting request to fail
|
|
4212
|
+
* - Batched result collections must line up with the input entries in order
|
|
4213
|
+
* and length when using the batched helper constructors
|
|
4214
|
+
* - Grouping controls which requests share a resolver run; choose stable keys
|
|
4215
|
+
* for requests that can safely be handled together
|
|
4216
|
+
* - Caching and persistence depend on request identity and the request's
|
|
4217
|
+
* equality semantics, so model request values deliberately when cached
|
|
4218
|
+
*
|
|
3092
4219
|
* @since 2.0.0
|
|
3093
4220
|
*/
|
|
3094
4221
|
export * as RequestResolver from "./RequestResolver.js";
|
|
3095
4222
|
/**
|
|
4223
|
+
* The `Resource` module provides refreshable, scoped values. A
|
|
4224
|
+
* `Resource<A, E>` stores the latest successful or failed acquisition result and
|
|
4225
|
+
* can be read with {@link get}, refreshed manually with {@link refresh}, or
|
|
4226
|
+
* refreshed automatically with {@link auto}.
|
|
4227
|
+
*
|
|
4228
|
+
* **Mental model**
|
|
4229
|
+
*
|
|
4230
|
+
* - A `Resource` wraps an acquisition `Effect` whose result is kept in a
|
|
4231
|
+
* `ScopedRef`
|
|
4232
|
+
* - Each refresh re-runs acquisition and replaces the stored `Exit`
|
|
4233
|
+
* - Replacing the stored value releases resources associated with the previous
|
|
4234
|
+
* scoped value
|
|
4235
|
+
* - Reading a resource returns the current acquired value or fails with the
|
|
4236
|
+
* current acquisition error
|
|
4237
|
+
*
|
|
4238
|
+
* **Common tasks**
|
|
4239
|
+
*
|
|
4240
|
+
* - Create a manually refreshed resource with {@link manual}
|
|
4241
|
+
* - Create a schedule-driven resource with {@link auto}
|
|
4242
|
+
* - Read the current value with {@link get}
|
|
4243
|
+
* - Force a reload with {@link refresh}
|
|
4244
|
+
* - Check whether an unknown value is a resource with {@link isResource}
|
|
4245
|
+
*
|
|
4246
|
+
* **Gotchas**
|
|
4247
|
+
*
|
|
4248
|
+
* - Creating a resource requires a `Scope`; when the scope closes, scoped
|
|
4249
|
+
* values held by the resource are released
|
|
4250
|
+
* - Failed acquisitions are stored too, so subsequent {@link get} calls fail
|
|
4251
|
+
* until a refresh succeeds
|
|
4252
|
+
* - Automatic refreshes run in the resource scope and stop when that scope is
|
|
4253
|
+
* closed
|
|
4254
|
+
*
|
|
3096
4255
|
* @since 2.0.0
|
|
3097
4256
|
*/
|
|
3098
4257
|
export * as Resource from "./Resource.js";
|
|
@@ -3173,7 +4332,8 @@ export * as Result from "./Result.js";
|
|
|
3173
4332
|
* teardown, error reporting, and exit code management. These utilities are particularly useful
|
|
3174
4333
|
* for creating CLI applications and server processes that need to manage their lifecycle properly.
|
|
3175
4334
|
*
|
|
3176
|
-
*
|
|
4335
|
+
* **Example** (Creating a main runner)
|
|
4336
|
+
*
|
|
3177
4337
|
* ```ts
|
|
3178
4338
|
* import { Effect, Fiber, Runtime } from "effect"
|
|
3179
4339
|
*
|
|
@@ -3203,7 +4363,8 @@ export * as Runtime from "./Runtime.js";
|
|
|
3203
4363
|
* along with a delay duration. Schedules can be combined, transformed, and used to implement
|
|
3204
4364
|
* sophisticated retry and repetition logic.
|
|
3205
4365
|
*
|
|
3206
|
-
*
|
|
4366
|
+
* **Example** (Retrying and repeating effects)
|
|
4367
|
+
*
|
|
3207
4368
|
* ```ts
|
|
3208
4369
|
* import { Effect, Schedule } from "effect"
|
|
3209
4370
|
*
|
|
@@ -3228,6 +4389,25 @@ export * as Runtime from "./Runtime.js";
|
|
|
3228
4389
|
*/
|
|
3229
4390
|
export * as Schedule from "./Schedule.js";
|
|
3230
4391
|
/**
|
|
4392
|
+
* The `Scheduler` module defines the runtime scheduling services used by
|
|
4393
|
+
* Effect fibers. A scheduler decides how runnable tasks are enqueued, when they
|
|
4394
|
+
* are dispatched, and whether a fiber should yield after consuming its
|
|
4395
|
+
* operation budget.
|
|
4396
|
+
*
|
|
4397
|
+
* **Common tasks**
|
|
4398
|
+
*
|
|
4399
|
+
* - Use {@link Scheduler} to provide a custom runtime scheduler
|
|
4400
|
+
* - Use {@link MixedScheduler} for the default priority-aware scheduler
|
|
4401
|
+
* - Use {@link MaxOpsBeforeYield} to tune fairness for CPU-bound fibers
|
|
4402
|
+
* - Use {@link PreventSchedulerYield} only when a runtime should bypass yield checks
|
|
4403
|
+
*
|
|
4404
|
+
* **Gotchas**
|
|
4405
|
+
*
|
|
4406
|
+
* - Scheduler priorities affect the order of queued runtime tasks, not the
|
|
4407
|
+
* semantic result of an `Effect`
|
|
4408
|
+
* - Disabling scheduler yields can improve throughput for controlled workloads,
|
|
4409
|
+
* but it can also let long-running fibers monopolize the JavaScript thread
|
|
4410
|
+
*
|
|
3231
4411
|
* @since 2.0.0
|
|
3232
4412
|
*/
|
|
3233
4413
|
export * as Scheduler from "./Scheduler.js";
|
|
@@ -3562,6 +4742,25 @@ export * as SchemaGetter from "./SchemaGetter.js";
|
|
|
3562
4742
|
*/
|
|
3563
4743
|
export * as SchemaIssue from "./SchemaIssue.js";
|
|
3564
4744
|
/**
|
|
4745
|
+
* The `SchemaParser` module turns schemas into reusable runtime operations for
|
|
4746
|
+
* constructing, validating, decoding, and encoding values. It is the execution
|
|
4747
|
+
* layer behind a schema's AST: parsers walk the schema structure, apply
|
|
4748
|
+
* transformations, honor parse options, run checks, and report failures as
|
|
4749
|
+
* `SchemaIssue.Issue` values.
|
|
4750
|
+
*
|
|
4751
|
+
* Use this module when you need a parser with a specific result shape:
|
|
4752
|
+
* `Effect` for effectful parsing and service requirements, `Promise` for
|
|
4753
|
+
* JavaScript interop, `Exit` or `Result` when failures should stay in data,
|
|
4754
|
+
* `Option` for yes/no validation, and synchronous helpers when throwing is the
|
|
4755
|
+
* desired boundary.
|
|
4756
|
+
*
|
|
4757
|
+
* Decoding reads from the encoded/input side of a schema into its decoded
|
|
4758
|
+
* `Type`, while encoding runs the schema in the opposite direction. The
|
|
4759
|
+
* `make*` helpers construct decoded values and apply constructor defaults before
|
|
4760
|
+
* validation. Parse options supplied when a parser is created are merged with
|
|
4761
|
+
* options supplied at call time, and schema-level parse annotations can further
|
|
4762
|
+
* refine behavior.
|
|
4763
|
+
*
|
|
3565
4764
|
* @since 4.0.0
|
|
3566
4765
|
*/
|
|
3567
4766
|
export * as SchemaParser from "./SchemaParser.js";
|
|
@@ -3742,6 +4941,22 @@ export * as SchemaRepresentation from "./SchemaRepresentation.js";
|
|
|
3742
4941
|
*/
|
|
3743
4942
|
export * as SchemaTransformation from "./SchemaTransformation.js";
|
|
3744
4943
|
/**
|
|
4944
|
+
* The `SchemaUtils` module contains focused helpers for schema patterns that
|
|
4945
|
+
* are useful but too specialized for the core `Schema` API surface.
|
|
4946
|
+
*
|
|
4947
|
+
* Use this module when you need to describe a native class with a schema while
|
|
4948
|
+
* keeping a plain struct as its encoded representation. This is especially
|
|
4949
|
+
* useful for classes such as `Data.Error` subclasses that should decode from
|
|
4950
|
+
* structured data, encode back to that data, and still preserve class identity
|
|
4951
|
+
* for instance checks and schema optics.
|
|
4952
|
+
*
|
|
4953
|
+
* **Gotchas**
|
|
4954
|
+
*
|
|
4955
|
+
* - The constructor is called with the decoded struct fields as a single
|
|
4956
|
+
* argument, so the class constructor must accept that shape.
|
|
4957
|
+
* - Encoding uses the instance itself as the encoded shape, so the instance
|
|
4958
|
+
* should expose properties compatible with the provided struct schema.
|
|
4959
|
+
*
|
|
3745
4960
|
* @since 4.0.0
|
|
3746
4961
|
*/
|
|
3747
4962
|
export * as SchemaUtils from "./SchemaUtils.js";
|
|
@@ -3762,26 +4977,174 @@ export * as SchemaUtils from "./SchemaUtils.js";
|
|
|
3762
4977
|
*/
|
|
3763
4978
|
export * as Scope from "./Scope.js";
|
|
3764
4979
|
/**
|
|
4980
|
+
* The `ScopedCache` module provides a cache for values that acquire scoped
|
|
4981
|
+
* resources during lookup. Each cached entry owns a `Scope`, so resources
|
|
4982
|
+
* created while computing a value stay alive for as long as that entry remains
|
|
4983
|
+
* cached and are released when the entry is removed.
|
|
4984
|
+
*
|
|
4985
|
+
* A `ScopedCache` is itself created inside a scope. Calls to {@link get} run the
|
|
4986
|
+
* lookup effect on cache misses, share the same in-flight lookup among
|
|
4987
|
+
* concurrent callers for the same key, and store the resulting exit according
|
|
4988
|
+
* to a time-to-live policy. Entries can be inserted manually with {@link set},
|
|
4989
|
+
* refreshed with {@link refresh}, inspected without triggering lookup with
|
|
4990
|
+
* {@link getOption}, and removed with {@link invalidate} or
|
|
4991
|
+
* {@link invalidateAll}. Capacity limits evict the oldest entries.
|
|
4992
|
+
*
|
|
4993
|
+
* **Lifecycle notes**
|
|
4994
|
+
*
|
|
4995
|
+
* - Entry scopes are closed when entries expire, are invalidated, are evicted,
|
|
4996
|
+
* are replaced, or when the cache's owning scope closes
|
|
4997
|
+
* - Successful and failed lookup exits are both cached according to the
|
|
4998
|
+
* configured TTL
|
|
4999
|
+
* - Expired entries may remain counted by {@link size} until a cache operation
|
|
5000
|
+
* observes and removes them
|
|
5001
|
+
* - Once the owning scope closes, the cache is closed and lookup-style
|
|
5002
|
+
* operations interrupt instead of acquiring new values
|
|
5003
|
+
*
|
|
3765
5004
|
* @since 4.0.0
|
|
3766
5005
|
*/
|
|
3767
5006
|
export * as ScopedCache from "./ScopedCache.js";
|
|
3768
5007
|
/**
|
|
5008
|
+
* The `ScopedRef` module provides a mutable reference for values that are tied
|
|
5009
|
+
* to scoped resources. Each value stored in a `ScopedRef` is acquired within its
|
|
5010
|
+
* own `Scope`, and replacing the value safely releases the resources associated
|
|
5011
|
+
* with the previous value.
|
|
5012
|
+
*
|
|
5013
|
+
* Use `ScopedRef` when an application needs to keep a current resource-backed
|
|
5014
|
+
* value, such as a live client, connection, subscription, or cached handle, and
|
|
5015
|
+
* later swap it for a newly acquired value without leaking the old resources.
|
|
5016
|
+
* Reads are simple, while updates are synchronized and resource-safe.
|
|
5017
|
+
*
|
|
5018
|
+
* **Gotchas**
|
|
5019
|
+
*
|
|
5020
|
+
* - A `ScopedRef` must itself be created and used within a `Scope`; when that
|
|
5021
|
+
* scope closes, the currently stored value is finalized.
|
|
5022
|
+
* - Use {@link fromAcquire} or {@link set} for resourceful values so acquisition
|
|
5023
|
+
* and finalization are tracked correctly.
|
|
5024
|
+
* - Use {@link make} only for values that do not acquire resources.
|
|
5025
|
+
* - Updating a `ScopedRef` waits for the replacement acquisition and old
|
|
5026
|
+
* finalization to complete before returning.
|
|
5027
|
+
*
|
|
3769
5028
|
* @since 2.0.0
|
|
3770
5029
|
*/
|
|
3771
5030
|
export * as ScopedRef from "./ScopedRef.js";
|
|
3772
5031
|
/**
|
|
5032
|
+
* The `Semaphore` module provides a counting semaphore for coordinating
|
|
5033
|
+
* concurrent access to shared or limited resources. A semaphore tracks a fixed
|
|
5034
|
+
* number of permits: effects acquire permits before entering a critical section
|
|
5035
|
+
* and release them when they leave.
|
|
5036
|
+
*
|
|
5037
|
+
* Use semaphores to bound parallel work, protect rate-limited services, or
|
|
5038
|
+
* serialize access to resources that cannot safely handle unlimited
|
|
5039
|
+
* concurrency. Prefer {@link withPermit} and {@link withPermits} when possible,
|
|
5040
|
+
* because they release permits automatically when the protected effect exits.
|
|
5041
|
+
* Use {@link take} and {@link release} for lower-level protocols that need
|
|
5042
|
+
* manual control.
|
|
5043
|
+
*
|
|
5044
|
+
* **Gotchas**
|
|
5045
|
+
*
|
|
5046
|
+
* - Pending acquisitions wait until enough permits are available.
|
|
5047
|
+
* - {@link withPermitsIfAvailable} does not wait; it returns `Option.none` when
|
|
5048
|
+
* the requested permits cannot be acquired immediately.
|
|
5049
|
+
* - Manual `take` / `release` usage must keep permit counts balanced.
|
|
5050
|
+
*
|
|
3773
5051
|
* @since 2.0.0
|
|
3774
5052
|
*/
|
|
3775
5053
|
export * as Semaphore from "./Semaphore.js";
|
|
3776
5054
|
/**
|
|
5055
|
+
* The `Sink` module provides composable consumers for `Stream` values. A
|
|
5056
|
+
* `Sink<A, In, L, E, R>` pulls input elements of type `In`, may require
|
|
5057
|
+
* services `R`, may fail with `E`, and eventually produces a result `A` plus
|
|
5058
|
+
* any leftover input `L` that was read but not consumed.
|
|
5059
|
+
*
|
|
5060
|
+
* **Mental model**
|
|
5061
|
+
*
|
|
5062
|
+
* - A sink is the terminal consumer used by `Stream.run`
|
|
5063
|
+
* - Sinks can consume zero, one, many, or all input elements before finishing
|
|
5064
|
+
* - Leftovers allow one sink to stop early without losing already-pulled input
|
|
5065
|
+
* - Sink composition preserves typed errors and service requirements
|
|
5066
|
+
* - Most sinks are built from `Channel` internally, but users compose them with
|
|
5067
|
+
* the higher-level APIs in this module
|
|
5068
|
+
*
|
|
5069
|
+
* **Common tasks**
|
|
5070
|
+
*
|
|
5071
|
+
* - Create simple sinks: {@link succeed}, {@link fail}, {@link fromEffect}
|
|
5072
|
+
* - Fold input: {@link fold}, {@link foldEffect}, {@link foldLeft}
|
|
5073
|
+
* - Collect values: {@link collectAll}, {@link collectAllN}, {@link collectAllWhile}
|
|
5074
|
+
* - Count or drain input: {@link count}, {@link drain}
|
|
5075
|
+
* - Transform results: {@link map}, {@link mapEffect}, {@link as}
|
|
5076
|
+
* - Combine sinks: {@link zip}, {@link zipWith}, {@link race}
|
|
5077
|
+
* - Filter and refine input: {@link filterInput}, {@link filterInputEffect}
|
|
5078
|
+
*
|
|
5079
|
+
* **Gotchas**
|
|
5080
|
+
*
|
|
5081
|
+
* - A sink can finish before the stream is exhausted; check leftover-aware
|
|
5082
|
+
* combinators when composing parsers or protocol decoders
|
|
5083
|
+
* - `In` is contravariant, so a sink that accepts broader input can be used
|
|
5084
|
+
* where narrower input is expected
|
|
5085
|
+
* - Resource and service requirements are tracked in the `R` type parameter
|
|
5086
|
+
*
|
|
3777
5087
|
* @since 2.0.0
|
|
3778
5088
|
*/
|
|
3779
5089
|
export * as Sink from "./Sink.js";
|
|
3780
5090
|
/**
|
|
5091
|
+
* The `Stdio` module defines the service interface used by Effect programs to
|
|
5092
|
+
* interact with process standard I/O. It models command-line arguments,
|
|
5093
|
+
* standard output, standard error, and standard input as Effects, Sinks, and
|
|
5094
|
+
* Streams so programs can depend on console I/O through `Context` instead of
|
|
5095
|
+
* directly coupling to a specific runtime.
|
|
5096
|
+
*
|
|
5097
|
+
* Use this module when building command-line programs, tests, or platform
|
|
5098
|
+
* integrations that need to read bytes from stdin, write text or bytes to
|
|
5099
|
+
* stdout/stderr, or provide deterministic replacements for those capabilities.
|
|
5100
|
+
* The `layerTest` helper is useful for tests because it supplies inert defaults
|
|
5101
|
+
* and lets individual fields be overridden.
|
|
5102
|
+
*
|
|
5103
|
+
* Standard I/O operations are platform capabilities and may fail with
|
|
5104
|
+
* `PlatformError`; handle those failures in the Effect error channel rather than
|
|
5105
|
+
* assuming writes or reads are infallible.
|
|
5106
|
+
*
|
|
3781
5107
|
* @since 4.0.0
|
|
3782
5108
|
*/
|
|
3783
5109
|
export * as Stdio from "./Stdio.js";
|
|
3784
5110
|
/**
|
|
5111
|
+
* The `Stream` module provides a typed, composable way to describe effectful
|
|
5112
|
+
* sequences of values. A `Stream<A, E, R>` can emit zero or more `A` values,
|
|
5113
|
+
* fail with an `E`, and require services from `R` while preserving
|
|
5114
|
+
* backpressure and resource safety.
|
|
5115
|
+
*
|
|
5116
|
+
* **Mental model**
|
|
5117
|
+
*
|
|
5118
|
+
* - A stream is a lazy description; it runs only when consumed with a `run*` function
|
|
5119
|
+
* - Streams are pull-based and emit chunks internally for efficient throughput
|
|
5120
|
+
* - `A` is the element type, `E` is the failure type, and `R` is the required context
|
|
5121
|
+
* - Stream composition mirrors `Effect`: use `map`, `flatMap`, error handling, and `pipe`
|
|
5122
|
+
* - Resource scopes, interruption, and finalizers are tracked by the Effect runtime
|
|
5123
|
+
* - Interop functions connect streams to queues, pub/subs, web streams, async iterables, and channels
|
|
5124
|
+
*
|
|
5125
|
+
* **Common tasks**
|
|
5126
|
+
*
|
|
5127
|
+
* - Create streams: {@link make}, {@link fromIterable}, {@link fromEffect}, {@link fromQueue}
|
|
5128
|
+
* - Transform values: {@link map}, {@link mapEffect}, {@link flatMap}, {@link filter}
|
|
5129
|
+
* - Combine streams: {@link concat}, {@link merge}, {@link zip}, {@link race}
|
|
5130
|
+
* - Control demand and timing: {@link take}, {@link drop}, {@link debounce}, {@link throttle}
|
|
5131
|
+
* - Manage errors: {@link catchCause}, {@link catchIf}, {@link mapError}, {@link retry}
|
|
5132
|
+
* - Manage resources and services: {@link scoped}, {@link ensuring}, {@link provide}
|
|
5133
|
+
* - Consume streams: {@link runCollect}, {@link runForEach}, {@link runFold}, {@link runDrain}
|
|
5134
|
+
*
|
|
5135
|
+
* **Gotchas**
|
|
5136
|
+
*
|
|
5137
|
+
* - A stream is not a collection; constructors and operators build a description until it is run
|
|
5138
|
+
* - Re-running a stream re-executes its effects unless it is explicitly shared or backed by external state
|
|
5139
|
+
* - Operators such as {@link merge}, {@link race}, and {@link broadcast} introduce concurrency and interruption semantics
|
|
5140
|
+
* - Prefer bounded constructors and sinks for large or infinite streams instead of collecting everything into memory
|
|
5141
|
+
*
|
|
5142
|
+
* **See also**
|
|
5143
|
+
*
|
|
5144
|
+
* - {@link Effect.Effect} for single-result effectful programs
|
|
5145
|
+
* - {@link Sink.Sink} for consuming and folding streams
|
|
5146
|
+
* - {@link Channel.Channel} for the lower-level primitive underlying streams
|
|
5147
|
+
*
|
|
3785
5148
|
* @since 2.0.0
|
|
3786
5149
|
*/
|
|
3787
5150
|
export * as Stream from "./Stream.js";
|
|
@@ -3869,26 +5232,142 @@ export * as String from "./String.js";
|
|
|
3869
5232
|
*/
|
|
3870
5233
|
export * as Struct from "./Struct.js";
|
|
3871
5234
|
/**
|
|
5235
|
+
* The `SubscriptionRef` module provides a mutable reference that can be read
|
|
5236
|
+
* and updated like a `Ref`, while also exposing a stream of its current value
|
|
5237
|
+
* and every subsequent change. It is useful when one part of an application
|
|
5238
|
+
* owns evolving state and many fibers need to subscribe to consistent updates,
|
|
5239
|
+
* such as configuration, coordination state, cached snapshots, or UI models.
|
|
5240
|
+
*
|
|
5241
|
+
* Updates are serialized with an internal semaphore and each update is
|
|
5242
|
+
* published to subscribers. The {@link changes} stream replays the latest value
|
|
5243
|
+
* first, then emits future updates, so new subscribers can start from the
|
|
5244
|
+
* current state without performing a separate read. Prefer the effectful
|
|
5245
|
+
* getters and update operations for concurrent code; the unsafe helpers bypass
|
|
5246
|
+
* synchronization and should only be used when the caller already controls
|
|
5247
|
+
* access.
|
|
5248
|
+
*
|
|
3872
5249
|
* @since 2.0.0
|
|
3873
5250
|
*/
|
|
3874
5251
|
export * as SubscriptionRef from "./SubscriptionRef.js";
|
|
3875
5252
|
/**
|
|
5253
|
+
* The `Symbol` module provides a small runtime guard for working with
|
|
5254
|
+
* JavaScript `symbol` values. Use {@link isSymbol} when validating unknown
|
|
5255
|
+
* input, narrowing union types, or building predicates that need to recognize
|
|
5256
|
+
* primitive symbols such as those created by `Symbol()` or `Symbol.for`.
|
|
5257
|
+
*
|
|
5258
|
+
* The guard checks for the primitive `symbol` type; boxed objects created with
|
|
5259
|
+
* `Object(Symbol())` are objects and do not satisfy this predicate.
|
|
5260
|
+
*
|
|
3876
5261
|
* @since 2.0.0
|
|
3877
5262
|
*/
|
|
3878
5263
|
export * as Symbol from "./Symbol.js";
|
|
3879
5264
|
/**
|
|
5265
|
+
* The `SynchronizedRef` module provides mutable references whose updates are
|
|
5266
|
+
* serialized, including updates that run effects before deciding the next
|
|
5267
|
+
* value. A `SynchronizedRef<A>` behaves like a `Ref<A>` for reading and basic
|
|
5268
|
+
* updates, but uses an internal semaphore so concurrent modifications observe a
|
|
5269
|
+
* consistent current value and apply one at a time.
|
|
5270
|
+
*
|
|
5271
|
+
* **When to use**
|
|
5272
|
+
*
|
|
5273
|
+
* - Coordinating shared state that may be updated by many fibers
|
|
5274
|
+
* - Running effectful state transitions that must not overlap
|
|
5275
|
+
* - Computing both a return value and a new stored value atomically
|
|
5276
|
+
* - Applying partial updates with `Option`, where `None` leaves the value
|
|
5277
|
+
* unchanged
|
|
5278
|
+
*
|
|
5279
|
+
* **Gotchas**
|
|
5280
|
+
*
|
|
5281
|
+
* - Effectful update functions run while the semaphore is held, so long-running
|
|
5282
|
+
* effects delay other updates to the same ref
|
|
5283
|
+
* - Failed effectful updates do not replace the stored value
|
|
5284
|
+
* - `getUnsafe` and `makeUnsafe` bypass the `Effect` API and should be reserved
|
|
5285
|
+
* for low-level or carefully controlled code
|
|
5286
|
+
*
|
|
3880
5287
|
* @since 2.0.0
|
|
3881
5288
|
*/
|
|
3882
5289
|
export * as SynchronizedRef from "./SynchronizedRef.js";
|
|
3883
5290
|
/**
|
|
5291
|
+
* The `Take` module provides the representation used by stream-like producers
|
|
5292
|
+
* to describe a single pull result. A `Take<A, E, Done>` is either a
|
|
5293
|
+
* non-empty batch of emitted values, a failed `Exit`, or a successful `Exit`
|
|
5294
|
+
* carrying the stream's completion value.
|
|
5295
|
+
*
|
|
5296
|
+
* `Take` is useful at boundaries where pull results need to be stored,
|
|
5297
|
+
* transferred, or interpreted later while preserving the distinction between
|
|
5298
|
+
* emitted elements, failures, and normal completion. Use {@link toPull} to turn
|
|
5299
|
+
* a `Take` back into a `Pull`: value batches become successful pulls, failure
|
|
5300
|
+
* exits are propagated, and successful exits signal completion with `Done`.
|
|
5301
|
+
*
|
|
5302
|
+
* **Gotchas**
|
|
5303
|
+
*
|
|
5304
|
+
* - A value batch is always represented by a `NonEmptyReadonlyArray`; empty
|
|
5305
|
+
* batches are not valid `Take` values.
|
|
5306
|
+
* - Successful `Exit` values do not emit elements. They represent pull
|
|
5307
|
+
* completion and carry the `Done` value.
|
|
5308
|
+
*
|
|
3884
5309
|
* @since 2.0.0
|
|
3885
5310
|
*/
|
|
3886
5311
|
export * as Take from "./Take.js";
|
|
3887
5312
|
/**
|
|
5313
|
+
* The `Terminal` module defines the service interface used by platform
|
|
5314
|
+
* integrations to model command-line input and output. It gives programs a
|
|
5315
|
+
* uniform way to query terminal dimensions, read lines, stream low-level key
|
|
5316
|
+
* events, and write text without depending directly on Node, the browser, or a
|
|
5317
|
+
* test-specific console implementation.
|
|
5318
|
+
*
|
|
5319
|
+
* Use this module when building interactive command-line tools, prompts, or
|
|
5320
|
+
* platform abstractions that need terminal capabilities as an Effect service.
|
|
5321
|
+
* Implementations are supplied through context, so application code can depend
|
|
5322
|
+
* on `Terminal` while tests and runtimes provide the concrete behavior.
|
|
5323
|
+
*
|
|
5324
|
+
* `readLine` can fail with {@link QuitError} when the user requests to quit,
|
|
5325
|
+
* commonly via `Ctrl+C`. For lower-level interaction, `readInput` returns a
|
|
5326
|
+
* scoped stream of {@link UserInput} values containing parsed key metadata and
|
|
5327
|
+
* any raw character input.
|
|
5328
|
+
*
|
|
3888
5329
|
* @since 4.0.0
|
|
3889
5330
|
*/
|
|
3890
5331
|
export * as Terminal from "./Terminal.js";
|
|
3891
5332
|
/**
|
|
5333
|
+
* The `Tracer` module defines the low-level tracing model used by Effect to
|
|
5334
|
+
* describe and propagate spans. A span records the lifetime of an operation,
|
|
5335
|
+
* including its name, parent, attributes, links, annotations, sampling decision,
|
|
5336
|
+
* kind, and completion status.
|
|
5337
|
+
*
|
|
5338
|
+
* **Mental model**
|
|
5339
|
+
*
|
|
5340
|
+
* - `Tracer` is the backend interface responsible for creating spans
|
|
5341
|
+
* - `Span` values represent Effect-managed operations with mutable lifecycle
|
|
5342
|
+
* hooks for ending spans and adding attributes, events, or links
|
|
5343
|
+
* - `ExternalSpan` represents trace context imported from another tracing
|
|
5344
|
+
* system so Effect spans can be parented by or linked to external work
|
|
5345
|
+
* - `ParentSpan`, `Tracer`, and related context references control propagation,
|
|
5346
|
+
* sampling, and trace-level filtering through the Effect context
|
|
5347
|
+
*
|
|
5348
|
+
* **Common tasks**
|
|
5349
|
+
*
|
|
5350
|
+
* - Implement a custom tracing backend with {@link make}
|
|
5351
|
+
* - Provide or inspect parent span context with {@link ParentSpan}
|
|
5352
|
+
* - Convert external trace identifiers into Effect span values with
|
|
5353
|
+
* {@link externalSpan}
|
|
5354
|
+
* - Configure span metadata with {@link SpanOptions}, {@link SpanKind}, and
|
|
5355
|
+
* {@link SpanLink}
|
|
5356
|
+
* - Disable propagation or adjust trace filtering with
|
|
5357
|
+
* {@link DisablePropagation}, {@link CurrentTraceLevel}, and
|
|
5358
|
+
* {@link MinimumTraceLevel}
|
|
5359
|
+
*
|
|
5360
|
+
* **Gotchas**
|
|
5361
|
+
*
|
|
5362
|
+
* - This module exposes the tracing data model and backend hooks; most
|
|
5363
|
+
* application code should create spans through higher-level Effect APIs such
|
|
5364
|
+
* as `Effect.withSpan`
|
|
5365
|
+
* - `ExternalSpan` only carries identity and metadata from another system; it
|
|
5366
|
+
* does not have lifecycle methods like `Span`
|
|
5367
|
+
* - Propagation and sampling are context-dependent, so parent selection can be
|
|
5368
|
+
* affected by disabled propagation, root span options, and trace-level
|
|
5369
|
+
* thresholds
|
|
5370
|
+
*
|
|
3892
5371
|
* @since 2.0.0
|
|
3893
5372
|
*/
|
|
3894
5373
|
export * as Tracer from "./Tracer.js";
|
|
@@ -4002,10 +5481,55 @@ export * as TxChunk from "./TxChunk.js";
|
|
|
4002
5481
|
*/
|
|
4003
5482
|
export * as TxDeferred from "./TxDeferred.js";
|
|
4004
5483
|
/**
|
|
5484
|
+
* The `TxHashMap` module provides a transactional hash map for storing and
|
|
5485
|
+
* updating key-value pairs inside Effect transactions. It is useful when
|
|
5486
|
+
* multiple fibers need to coordinate shared map state and each read-modify-write
|
|
5487
|
+
* sequence must be committed atomically.
|
|
5488
|
+
*
|
|
5489
|
+
* A `TxHashMap<K, V>` has the familiar shape of a `HashMap<K, V>`, but every
|
|
5490
|
+
* operation returns an `Effect` and participates in transaction semantics
|
|
5491
|
+
* through `TxRef`. Use it for concurrent registries, caches, counters, indexes,
|
|
5492
|
+
* and other mutable maps whose updates should compose safely with other
|
|
5493
|
+
* transactional references.
|
|
5494
|
+
*
|
|
5495
|
+
* **Common tasks**
|
|
5496
|
+
*
|
|
5497
|
+
* - Create maps with {@link empty}, {@link fromIterable}, or {@link make}
|
|
5498
|
+
* - Read entries with {@link get}, {@link has}, {@link keys}, {@link values}, and {@link entries}
|
|
5499
|
+
* - Update entries with {@link set}, {@link modify}, {@link modifyAt}, and {@link remove}
|
|
5500
|
+
* - Inspect aggregate state with {@link size}, {@link isEmpty}, and {@link reduce}
|
|
5501
|
+
*
|
|
5502
|
+
* **Gotchas**
|
|
5503
|
+
*
|
|
5504
|
+
* - Operations are effectful; run them in `Effect.gen` and wrap multi-step
|
|
5505
|
+
* transactions with `Effect.tx` when the whole sequence must commit together.
|
|
5506
|
+
* - Reads that may be absent return `Option`, so handle both `Some` and `None`
|
|
5507
|
+
* instead of assuming a key exists.
|
|
5508
|
+
*
|
|
4005
5509
|
* @since 2.0.0
|
|
4006
5510
|
*/
|
|
4007
5511
|
export * as TxHashMap from "./TxHashMap.js";
|
|
4008
5512
|
/**
|
|
5513
|
+
* The `TxHashSet` module provides a transactional hash set for storing unique
|
|
5514
|
+
* values inside Effect transactions. A `TxHashSet<A>` wraps a `HashSet<A>` in a
|
|
5515
|
+
* transactional reference, so reads and writes can be composed with other
|
|
5516
|
+
* transactional operations and committed atomically.
|
|
5517
|
+
*
|
|
5518
|
+
* **Common tasks**
|
|
5519
|
+
*
|
|
5520
|
+
* - Create transactional sets with {@link empty}, {@link make}, or {@link fromIterable}
|
|
5521
|
+
* - Mutate an existing set with {@link add}, {@link remove}, and {@link clear}
|
|
5522
|
+
* - Query membership and size with {@link has}, {@link size}, and {@link isEmpty}
|
|
5523
|
+
* - Derive new sets with {@link map}, {@link filter}, {@link union}, {@link intersection}, and {@link difference}
|
|
5524
|
+
* - Fold or collect values with {@link reduce}, {@link toArray}, and {@link toHashSet}
|
|
5525
|
+
*
|
|
5526
|
+
* **Gotchas**
|
|
5527
|
+
*
|
|
5528
|
+
* - Mutation operations update the same transactional set; transform operations
|
|
5529
|
+
* return a new `TxHashSet`
|
|
5530
|
+
* - Operations are `Effect` values and must be yielded, piped, or run to take effect
|
|
5531
|
+
* - Use `Effect.tx` when several operations must observe and commit one atomic transaction
|
|
5532
|
+
*
|
|
4009
5533
|
* @since 2.0.0
|
|
4010
5534
|
*/
|
|
4011
5535
|
export * as TxHashSet from "./TxHashSet.js";
|
|
@@ -4059,6 +5583,24 @@ export * as TxReentrantLock from "./TxReentrantLock.js";
|
|
|
4059
5583
|
*/
|
|
4060
5584
|
export * as TxRef from "./TxRef.js";
|
|
4061
5585
|
/**
|
|
5586
|
+
* The `TxSemaphore` module provides a transactional semaphore for coordinating
|
|
5587
|
+
* access to limited resources from within Effect transactions. A semaphore
|
|
5588
|
+
* tracks a fixed number of permits, and transactional operations can acquire,
|
|
5589
|
+
* release, or inspect those permits atomically with other transactional state.
|
|
5590
|
+
*
|
|
5591
|
+
* Use `TxSemaphore` when permit accounting needs to compose with `TxRef` and
|
|
5592
|
+
* other transactional updates, such as guarding resource pools, rate-limited
|
|
5593
|
+
* sections, or workflows that must reserve capacity consistently before
|
|
5594
|
+
* committing related state changes.
|
|
5595
|
+
*
|
|
5596
|
+
* **Gotchas**
|
|
5597
|
+
*
|
|
5598
|
+
* - Permit operations are intended for transactional workflows and are wrapped
|
|
5599
|
+
* with `Effect.tx`.
|
|
5600
|
+
* - The semaphore capacity is fixed at construction time; releasing more
|
|
5601
|
+
* permits than the original capacity fails.
|
|
5602
|
+
* - Creating a semaphore with a negative number of permits defects.
|
|
5603
|
+
*
|
|
4062
5604
|
* @since 4.0.0
|
|
4063
5605
|
*/
|
|
4064
5606
|
export * as TxSemaphore from "./TxSemaphore.js";
|
|
@@ -4155,6 +5697,19 @@ export * as Types from "./Types.js";
|
|
|
4155
5697
|
*/
|
|
4156
5698
|
export * as UndefinedOr from "./UndefinedOr.js";
|
|
4157
5699
|
/**
|
|
5700
|
+
* The `Unify` module contains the type-level protocol Effect uses to normalize
|
|
5701
|
+
* unions of data types that opt in to unification. It is primarily a library
|
|
5702
|
+
* authoring tool: data types expose hidden symbol properties describing how
|
|
5703
|
+
* their variants should be widened, and {@link Unify} turns those protocol
|
|
5704
|
+
* entries into the user-facing union type that TypeScript should infer.
|
|
5705
|
+
*
|
|
5706
|
+
* Most application code does not need to interact with these symbols directly.
|
|
5707
|
+
* The main runtime helper, {@link unify}, is an identity function that preserves
|
|
5708
|
+
* values and functions at runtime while applying {@link Unify} to the relevant
|
|
5709
|
+
* static type. This is useful when authoring APIs that return branded or
|
|
5710
|
+
* protocol-enabled values and need inference to collapse to the public Effect
|
|
5711
|
+
* data type rather than exposing implementation details.
|
|
5712
|
+
*
|
|
4158
5713
|
* @since 2.0.0
|
|
4159
5714
|
*/
|
|
4160
5715
|
export * as Unify from "./Unify.js";
|