effect 4.0.0-beta.101 → 4.0.0-beta.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Array.d.ts +971 -1037
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +462 -412
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +433 -756
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +200 -325
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts +207 -267
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +107 -135
- package/dist/BigInt.js.map +1 -1
- package/dist/Boolean.d.ts +146 -188
- package/dist/Boolean.d.ts.map +1 -1
- package/dist/Boolean.js +64 -84
- package/dist/Boolean.js.map +1 -1
- package/dist/Brand.js.map +1 -1
- package/dist/Cache.d.ts +405 -254
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +166 -101
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +167 -277
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Cause.js +122 -176
- package/dist/Cause.js.map +1 -1
- package/dist/Channel.d.ts +729 -768
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +541 -449
- package/dist/Channel.js.map +1 -1
- package/dist/ChannelSchema.d.ts +1 -1
- package/dist/ChannelSchema.d.ts.map +1 -1
- package/dist/ChannelSchema.js.map +1 -1
- package/dist/Chunk.d.ts +834 -1173
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +326 -439
- package/dist/Chunk.js.map +1 -1
- package/dist/Clock.d.ts +180 -49
- package/dist/Clock.d.ts.map +1 -1
- package/dist/Clock.js +96 -31
- package/dist/Clock.js.map +1 -1
- package/dist/Combiner.d.ts +20 -33
- package/dist/Combiner.d.ts.map +1 -1
- package/dist/Combiner.js +18 -30
- package/dist/Combiner.js.map +1 -1
- package/dist/Config.d.ts +226 -174
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +339 -267
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +194 -68
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +122 -87
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Console.d.ts +233 -33
- package/dist/Console.d.ts.map +1 -1
- package/dist/Console.js +232 -32
- package/dist/Console.js.map +1 -1
- package/dist/Context.d.ts +151 -274
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +171 -214
- package/dist/Context.js.map +1 -1
- package/dist/Cron.d.ts +68 -77
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +57 -66
- package/dist/Cron.js.map +1 -1
- package/dist/Crypto.d.ts +13 -15
- package/dist/Crypto.d.ts.map +1 -1
- package/dist/Crypto.js +9 -10
- package/dist/Crypto.js.map +1 -1
- package/dist/Data.d.ts +60 -80
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js +18 -24
- package/dist/Data.js.map +1 -1
- package/dist/DateTime.d.ts +562 -660
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +307 -362
- package/dist/DateTime.js.map +1 -1
- package/dist/Deferred.d.ts +253 -256
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +104 -96
- package/dist/Deferred.js.map +1 -1
- package/dist/Duration.d.ts +216 -308
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +132 -186
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +2897 -3342
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +1383 -1580
- package/dist/Effect.js.map +1 -1
- package/dist/Effectable.js.map +1 -1
- package/dist/Encoding.d.ts +22 -40
- package/dist/Encoding.d.ts.map +1 -1
- package/dist/Encoding.js +22 -40
- package/dist/Encoding.js.map +1 -1
- package/dist/Equal.d.ts +33 -37
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +29 -21
- package/dist/Equal.js.map +1 -1
- package/dist/Equivalence.d.ts +103 -105
- package/dist/Equivalence.d.ts.map +1 -1
- package/dist/Equivalence.js +77 -79
- package/dist/Equivalence.js.map +1 -1
- package/dist/ErrorReporter.d.ts +51 -27
- package/dist/ErrorReporter.d.ts.map +1 -1
- package/dist/ErrorReporter.js +50 -26
- package/dist/ErrorReporter.js.map +1 -1
- package/dist/ExecutionPlan.d.ts +13 -55
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/ExecutionPlan.js +7 -28
- package/dist/ExecutionPlan.js.map +1 -1
- package/dist/Exit.d.ts +116 -192
- package/dist/Exit.d.ts.map +1 -1
- package/dist/Exit.js +82 -130
- package/dist/Exit.js.map +1 -1
- package/dist/Fiber.d.ts +82 -146
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js +48 -87
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +152 -105
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +109 -75
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +213 -168
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +114 -89
- package/dist/FiberMap.js.map +1 -1
- package/dist/FiberSet.d.ts +123 -81
- package/dist/FiberSet.d.ts.map +1 -1
- package/dist/FiberSet.js +85 -59
- package/dist/FiberSet.js.map +1 -1
- package/dist/FileSystem.d.ts +153 -264
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +42 -147
- package/dist/FileSystem.js.map +1 -1
- package/dist/Filter.d.ts +61 -33
- package/dist/Filter.d.ts.map +1 -1
- package/dist/Filter.js +26 -15
- package/dist/Filter.js.map +1 -1
- package/dist/Formatter.d.ts +25 -33
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +48 -49
- package/dist/Formatter.js.map +1 -1
- package/dist/Function.d.ts +76 -145
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +40 -57
- package/dist/Function.js.map +1 -1
- package/dist/Graph.d.ts +360 -714
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +168 -297
- package/dist/Graph.js.map +1 -1
- package/dist/HKT.d.ts +12 -6
- package/dist/HKT.d.ts.map +1 -1
- package/dist/Hash.d.ts +47 -83
- package/dist/Hash.d.ts.map +1 -1
- package/dist/Hash.js +46 -68
- package/dist/Hash.js.map +1 -1
- package/dist/HashMap.d.ts +319 -411
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashMap.js +122 -166
- package/dist/HashMap.js.map +1 -1
- package/dist/HashRing.d.ts.map +1 -1
- package/dist/HashRing.js +1 -0
- package/dist/HashRing.js.map +1 -1
- package/dist/HashSet.d.ts +177 -284
- package/dist/HashSet.d.ts.map +1 -1
- package/dist/HashSet.js +68 -109
- package/dist/HashSet.js.map +1 -1
- package/dist/Inspectable.d.ts +12 -12
- package/dist/Inspectable.js +8 -8
- package/dist/Inspectable.js.map +1 -1
- package/dist/Iterable.d.ts +620 -786
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +230 -307
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonPatch.d.ts +11 -13
- package/dist/JsonPatch.d.ts.map +1 -1
- package/dist/JsonPatch.js +46 -103
- package/dist/JsonPatch.js.map +1 -1
- package/dist/JsonPointer.d.ts +8 -8
- package/dist/JsonPointer.js +8 -8
- package/dist/JsonPointer.js.map +1 -1
- package/dist/JsonSchema.d.ts +98 -44
- package/dist/JsonSchema.d.ts.map +1 -1
- package/dist/JsonSchema.js +300 -239
- package/dist/JsonSchema.js.map +1 -1
- package/dist/Latch.d.ts +23 -35
- package/dist/Latch.d.ts.map +1 -1
- package/dist/Latch.js +16 -28
- package/dist/Latch.js.map +1 -1
- package/dist/Layer.d.ts +359 -260
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +195 -175
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +42 -29
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +31 -21
- package/dist/LayerMap.js.map +1 -1
- package/dist/LayerRef.d.ts +6 -2
- package/dist/LayerRef.d.ts.map +1 -1
- package/dist/LayerRef.js +6 -2
- package/dist/LayerRef.js.map +1 -1
- package/dist/LogLevel.d.ts +114 -214
- package/dist/LogLevel.d.ts.map +1 -1
- package/dist/LogLevel.js +41 -76
- package/dist/LogLevel.js.map +1 -1
- package/dist/Logger.d.ts +218 -467
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +207 -452
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +16 -5
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/ManagedRuntime.js +10 -5
- package/dist/ManagedRuntime.js.map +1 -1
- package/dist/Match.d.ts +217 -252
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js +150 -183
- package/dist/Match.js.map +1 -1
- package/dist/Metric.d.ts +442 -993
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +202 -645
- package/dist/Metric.js.map +1 -1
- package/dist/MutableHashMap.d.ts +144 -173
- package/dist/MutableHashMap.d.ts.map +1 -1
- package/dist/MutableHashMap.js +68 -79
- package/dist/MutableHashMap.js.map +1 -1
- package/dist/MutableHashSet.d.ts +84 -89
- package/dist/MutableHashSet.d.ts.map +1 -1
- package/dist/MutableHashSet.js +44 -47
- package/dist/MutableHashSet.js.map +1 -1
- package/dist/MutableList.d.ts +71 -370
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +59 -284
- package/dist/MutableList.js.map +1 -1
- package/dist/MutableRef.d.ts +420 -243
- package/dist/MutableRef.d.ts.map +1 -1
- package/dist/MutableRef.js +209 -120
- package/dist/MutableRef.js.map +1 -1
- package/dist/Newtype.d.ts +21 -14
- package/dist/Newtype.d.ts.map +1 -1
- package/dist/Newtype.js +15 -13
- package/dist/Newtype.js.map +1 -1
- package/dist/NonEmptyIterable.d.ts +7 -137
- package/dist/NonEmptyIterable.d.ts.map +1 -1
- package/dist/NonEmptyIterable.js +5 -93
- package/dist/NonEmptyIterable.js.map +1 -1
- package/dist/Number.d.ts +196 -233
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +90 -109
- package/dist/Number.js.map +1 -1
- package/dist/Optic.d.ts +97 -189
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +190 -292
- package/dist/Optic.js.map +1 -1
- package/dist/Option.d.ts +447 -812
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +213 -393
- package/dist/Option.js.map +1 -1
- package/dist/Order.d.ts +109 -109
- package/dist/Order.js +91 -91
- package/dist/Order.js.map +1 -1
- package/dist/Ordering.d.ts +20 -23
- package/dist/Ordering.d.ts.map +1 -1
- package/dist/Ordering.js +8 -9
- package/dist/Ordering.js.map +1 -1
- package/dist/PartitionedSemaphore.d.ts.map +1 -1
- package/dist/PartitionedSemaphore.js +1 -4
- package/dist/PartitionedSemaphore.js.map +1 -1
- package/dist/Path.d.ts +38 -41
- package/dist/Path.d.ts.map +1 -1
- package/dist/Path.js +3 -4
- package/dist/Path.js.map +1 -1
- package/dist/Pipeable.d.ts +6 -5
- package/dist/Pipeable.d.ts.map +1 -1
- package/dist/Pipeable.js +2 -2
- package/dist/Pipeable.js.map +1 -1
- package/dist/PlatformError.d.ts +4 -4
- package/dist/PlatformError.js +3 -3
- package/dist/PlatformError.js.map +1 -1
- package/dist/Pool.d.ts +4 -2
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +4 -2
- package/dist/Pool.js.map +1 -1
- package/dist/Predicate.d.ts +200 -181
- package/dist/Predicate.d.ts.map +1 -1
- package/dist/Predicate.js +100 -108
- package/dist/Predicate.js.map +1 -1
- package/dist/PrimaryKey.d.ts +7 -7
- package/dist/PrimaryKey.js +5 -5
- package/dist/PrimaryKey.js.map +1 -1
- package/dist/PubSub.d.ts +425 -494
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +373 -362
- package/dist/PubSub.js.map +1 -1
- package/dist/Pull.d.ts +24 -18
- package/dist/Pull.d.ts.map +1 -1
- package/dist/Pull.js +11 -9
- package/dist/Pull.js.map +1 -1
- package/dist/Queue.d.ts +200 -159
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +162 -132
- package/dist/Queue.js.map +1 -1
- package/dist/Random.d.ts +49 -74
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +35 -54
- package/dist/Random.js.map +1 -1
- package/dist/RcMap.d.ts +121 -63
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +42 -21
- package/dist/RcMap.js.map +1 -1
- package/dist/RcRef.d.ts +24 -13
- package/dist/RcRef.d.ts.map +1 -1
- package/dist/RcRef.js +15 -9
- package/dist/RcRef.js.map +1 -1
- package/dist/Record.d.ts +361 -466
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +163 -216
- package/dist/Record.js.map +1 -1
- package/dist/Redactable.d.ts +6 -2
- package/dist/Redactable.d.ts.map +1 -1
- package/dist/Redactable.js +7 -2
- package/dist/Redactable.js.map +1 -1
- package/dist/Redacted.d.ts +25 -25
- package/dist/Redacted.d.ts.map +1 -1
- package/dist/Redacted.js +19 -20
- package/dist/Redacted.js.map +1 -1
- package/dist/Reducer.d.ts +8 -15
- package/dist/Reducer.d.ts.map +1 -1
- package/dist/Reducer.js +6 -12
- package/dist/Reducer.js.map +1 -1
- package/dist/Ref.d.ts +95 -165
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +75 -122
- package/dist/Ref.js.map +1 -1
- package/dist/References.d.ts +102 -213
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +102 -213
- package/dist/References.js.map +1 -1
- package/dist/RegExp.d.ts +10 -14
- package/dist/RegExp.d.ts.map +1 -1
- package/dist/RegExp.js +10 -14
- package/dist/RegExp.js.map +1 -1
- package/dist/Request.d.ts +31 -21
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js +25 -19
- package/dist/Request.js.map +1 -1
- package/dist/RequestResolver.d.ts +201 -90
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +87 -41
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Resource.js.map +1 -1
- package/dist/Result.d.ts +302 -470
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +135 -218
- package/dist/Result.js.map +1 -1
- package/dist/Runtime.d.ts +50 -75
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +39 -60
- package/dist/Runtime.js.map +1 -1
- package/dist/Schedule.d.ts +290 -1636
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +162 -803
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts +5 -5
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +18 -6
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +1835 -1060
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +2708 -1050
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +29 -52
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +537 -391
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaError.d.ts +7 -6
- package/dist/SchemaError.d.ts.map +1 -1
- package/dist/SchemaError.js +8 -7
- package/dist/SchemaError.js.map +1 -1
- package/dist/SchemaGetter.d.ts +230 -185
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +252 -209
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.d.ts +62 -190
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js +74 -266
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.d.ts +2 -2
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +123 -86
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +398 -1513
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +290 -2854
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +116 -76
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +123 -88
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/Scope.d.ts +123 -151
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +72 -92
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.js.map +1 -1
- package/dist/ScopedRef.d.ts +3 -3
- package/dist/ScopedRef.js +2 -2
- package/dist/ScopedRef.js.map +1 -1
- package/dist/Semaphore.d.ts +101 -13
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js +78 -39
- package/dist/Semaphore.js.map +1 -1
- package/dist/Sink.d.ts +117 -107
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +107 -100
- package/dist/Sink.js.map +1 -1
- package/dist/Stdio.d.ts +1 -1
- package/dist/Stdio.js.map +1 -1
- package/dist/Stream.d.ts +2430 -2958
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +1124 -1397
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +262 -308
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +184 -215
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts +109 -114
- package/dist/Struct.d.ts.map +1 -1
- package/dist/Struct.js +46 -54
- package/dist/Struct.js.map +1 -1
- package/dist/SubscriptionRef.d.ts +282 -250
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +104 -92
- package/dist/SubscriptionRef.js.map +1 -1
- package/dist/Symbol.d.ts +3 -3
- package/dist/Symbol.js +3 -3
- package/dist/Symbol.js.map +1 -1
- package/dist/SynchronizedRef.js.map +1 -1
- package/dist/Take.js.map +1 -1
- package/dist/Terminal.d.ts +2 -2
- package/dist/Terminal.js +1 -1
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +100 -54
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +41 -24
- package/dist/Tracer.js.map +1 -1
- package/dist/Trie.d.ts +287 -679
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js +109 -251
- package/dist/Trie.js.map +1 -1
- package/dist/Tuple.d.ts +92 -127
- package/dist/Tuple.d.ts.map +1 -1
- package/dist/Tuple.js +42 -57
- package/dist/Tuple.js.map +1 -1
- package/dist/TxChunk.d.ts +201 -121
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxChunk.js +85 -56
- package/dist/TxChunk.js.map +1 -1
- package/dist/TxDeferred.d.ts +62 -46
- package/dist/TxDeferred.d.ts.map +1 -1
- package/dist/TxDeferred.js +30 -22
- package/dist/TxDeferred.js.map +1 -1
- package/dist/TxHashMap.d.ts +631 -779
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +268 -330
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxHashSet.d.ts +297 -236
- package/dist/TxHashSet.d.ts.map +1 -1
- package/dist/TxHashSet.js +130 -100
- package/dist/TxHashSet.js.map +1 -1
- package/dist/TxPriorityQueue.d.ts +126 -95
- package/dist/TxPriorityQueue.d.ts.map +1 -1
- package/dist/TxPriorityQueue.js +74 -56
- package/dist/TxPriorityQueue.js.map +1 -1
- package/dist/TxPubSub.d.ts +101 -88
- package/dist/TxPubSub.d.ts.map +1 -1
- package/dist/TxPubSub.js +87 -66
- package/dist/TxPubSub.js.map +1 -1
- package/dist/TxQueue.d.ts +200 -180
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxQueue.js +160 -136
- package/dist/TxQueue.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +97 -66
- package/dist/TxReentrantLock.d.ts.map +1 -1
- package/dist/TxReentrantLock.js +67 -45
- package/dist/TxReentrantLock.js.map +1 -1
- package/dist/TxRef.d.ts +51 -32
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +23 -15
- package/dist/TxRef.js.map +1 -1
- package/dist/TxSemaphore.d.ts +129 -95
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +85 -70
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/TxSubscriptionRef.d.ts +97 -70
- package/dist/TxSubscriptionRef.d.ts.map +1 -1
- package/dist/TxSubscriptionRef.js +44 -34
- package/dist/TxSubscriptionRef.js.map +1 -1
- package/dist/Types.d.ts +127 -70
- package/dist/Types.d.ts.map +1 -1
- package/dist/UndefinedOr.js.map +1 -1
- package/dist/Unify.d.ts +45 -65
- package/dist/Unify.d.ts.map +1 -1
- package/dist/Unify.js +6 -9
- package/dist/Unify.js.map +1 -1
- package/dist/Utils.d.ts +23 -16
- package/dist/Utils.d.ts.map +1 -1
- package/dist/Utils.js +3 -7
- package/dist/Utils.js.map +1 -1
- package/dist/index.d.ts +0 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -4
- package/dist/index.js.map +1 -1
- package/dist/internal/array.js.map +1 -1
- package/dist/internal/core.js +3 -2
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/dateTime.js +4 -0
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/doNotation.js.map +1 -1
- package/dist/internal/effect.js +141 -61
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/equal.js.map +1 -1
- package/dist/internal/errors.js.map +1 -1
- package/dist/internal/executionPlan.js.map +1 -1
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/hashSet.js.map +1 -1
- package/dist/internal/layer.js.map +1 -1
- package/dist/internal/matcher.js +1 -1
- package/dist/internal/matcher.js.map +1 -1
- package/dist/internal/metric.js.map +1 -1
- package/dist/internal/option.js.map +1 -1
- package/dist/internal/persistence.d.ts +2 -0
- package/dist/internal/persistence.d.ts.map +1 -0
- package/dist/internal/persistence.js +3 -0
- package/dist/internal/persistence.js.map +1 -0
- package/dist/internal/random.js.map +1 -1
- package/dist/internal/rcRef.js.map +1 -1
- package/dist/internal/record.d.ts +0 -3
- package/dist/internal/record.d.ts.map +1 -1
- package/dist/internal/record.js +10 -5
- package/dist/internal/record.js.map +1 -1
- package/dist/internal/redacted.js.map +1 -1
- package/dist/internal/references.js +3 -4
- package/dist/internal/references.js.map +1 -1
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/result.js.map +1 -1
- package/dist/internal/schedule.js.map +1 -1
- package/dist/internal/schema/annotations.js +12 -0
- package/dist/internal/schema/annotations.js.map +1 -1
- package/dist/internal/schema/cause.js.map +1 -1
- package/dist/internal/schema/fromJsonSchemaDocument.d.ts +2 -0
- package/dist/internal/schema/fromJsonSchemaDocument.d.ts.map +1 -0
- package/dist/internal/schema/fromJsonSchemaDocument.js +745 -0
- package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -0
- package/dist/internal/schema/fromRepresentation.d.ts +2 -0
- package/dist/internal/schema/fromRepresentation.d.ts.map +1 -0
- package/dist/internal/schema/fromRepresentation.js +245 -0
- package/dist/internal/schema/fromRepresentation.js.map +1 -0
- package/dist/internal/schema/parser.d.ts +14 -0
- package/dist/internal/schema/parser.d.ts.map +1 -0
- package/dist/internal/schema/parser.js +13 -0
- package/dist/internal/schema/parser.js.map +1 -0
- package/dist/internal/schema/schema.js +28 -40
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/internal/schema/{arbitrary.d.ts → toArbitrary.d.ts} +1 -1
- package/dist/internal/schema/toArbitrary.d.ts.map +1 -0
- package/dist/internal/schema/{arbitrary.js → toArbitrary.js} +8 -9
- package/dist/internal/schema/toArbitrary.js.map +1 -0
- package/dist/internal/schema/toCodeDocument.d.ts +2 -0
- package/dist/internal/schema/toCodeDocument.d.ts.map +1 -0
- package/dist/internal/schema/toCodeDocument.js +438 -0
- package/dist/internal/schema/toCodeDocument.js.map +1 -0
- package/dist/internal/schema/toEquivalence.d.ts +2 -0
- package/dist/internal/schema/toEquivalence.d.ts.map +1 -0
- package/dist/internal/schema/{equivalence.js → toEquivalence.js} +15 -13
- package/dist/internal/schema/toEquivalence.js.map +1 -0
- package/dist/internal/schema/toJsonSchemaDocument.d.ts +2 -0
- package/dist/internal/schema/toJsonSchemaDocument.d.ts.map +1 -0
- package/dist/internal/schema/toJsonSchemaDocument.js +508 -0
- package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -0
- package/dist/internal/schema/toRepresentation.d.ts +2 -0
- package/dist/internal/schema/toRepresentation.d.ts.map +1 -0
- package/dist/internal/schema/toRepresentation.js +349 -0
- package/dist/internal/schema/toRepresentation.js.map +1 -0
- package/dist/internal/stackTraceLimit.js +3 -6
- package/dist/internal/stackTraceLimit.js.map +1 -1
- package/dist/internal/stream.js.map +1 -1
- package/dist/internal/tracer.js.map +1 -1
- package/dist/internal/trie.js +13 -9
- package/dist/internal/trie.js.map +1 -1
- package/dist/testing/FastCheck.d.ts +8 -7
- package/dist/testing/FastCheck.d.ts.map +1 -1
- package/dist/testing/FastCheck.js +8 -7
- package/dist/testing/FastCheck.js.map +1 -1
- package/dist/testing/TestClock.d.ts +57 -28
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestClock.js +54 -19
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/testing/TestConsole.d.ts +32 -31
- package/dist/testing/TestConsole.d.ts.map +1 -1
- package/dist/testing/TestConsole.js +24 -22
- package/dist/testing/TestConsole.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +29 -29
- package/dist/testing/TestSchema.js +25 -25
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +121 -144
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +99 -121
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +22 -7
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +87 -317
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +132 -97
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +55 -51
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.d.ts +1 -1
- package/dist/unstable/ai/EmbeddingModel.js +1 -1
- package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
- package/dist/unstable/ai/IdGenerator.d.ts +32 -28
- package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
- package/dist/unstable/ai/IdGenerator.js +26 -21
- package/dist/unstable/ai/IdGenerator.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +111 -68
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +123 -81
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpProtocol.d.ts +30 -0
- package/dist/unstable/ai/McpProtocol.d.ts.map +1 -0
- package/dist/unstable/ai/McpProtocol.js +20 -0
- package/dist/unstable/ai/McpProtocol.js.map +1 -0
- package/dist/unstable/ai/McpSchema.d.ts +316 -250
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +71 -63
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +71 -62
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +765 -245
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Model.d.ts +8 -19
- package/dist/unstable/ai/Model.d.ts.map +1 -1
- package/dist/unstable/ai/Model.js +9 -20
- package/dist/unstable/ai/Model.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +33 -11
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +194 -378
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Prompt.d.ts +112 -38
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Prompt.js +53 -17
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +47 -33
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js +23 -18
- package/dist/unstable/ai/Response.js.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.js.map +1 -1
- package/dist/unstable/ai/Telemetry.d.ts +46 -13
- package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
- package/dist/unstable/ai/Telemetry.js +18 -7
- package/dist/unstable/ai/Telemetry.js.map +1 -1
- package/dist/unstable/ai/Tokenizer.d.ts +14 -3
- package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
- package/dist/unstable/ai/Tokenizer.js +10 -2
- package/dist/unstable/ai/Tokenizer.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +63 -44
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +59 -42
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +35 -9
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +32 -14
- package/dist/unstable/ai/Toolkit.js.map +1 -1
- package/dist/unstable/ai/index.d.ts +4 -0
- package/dist/unstable/ai/index.d.ts.map +1 -1
- package/dist/unstable/ai/index.js +4 -0
- package/dist/unstable/ai/index.js.map +1 -1
- package/dist/unstable/ai/internal/codec-transformer.js +15 -12
- package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
- package/dist/unstable/ai/internal/mcpProtocol.d.ts +21 -0
- package/dist/unstable/ai/internal/mcpProtocol.d.ts.map +1 -0
- package/dist/unstable/ai/internal/mcpProtocol.js +22 -0
- package/dist/unstable/ai/internal/mcpProtocol.js.map +1 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.d.ts +2 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.d.ts.map +1 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.js +32 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.js.map +1 -0
- package/dist/unstable/ai/internal/structured-output.d.ts +2 -0
- package/dist/unstable/ai/internal/structured-output.d.ts.map +1 -0
- package/dist/unstable/ai/internal/structured-output.js +315 -0
- package/dist/unstable/ai/internal/structured-output.js.map +1 -0
- package/dist/unstable/cli/Argument.d.ts +273 -69
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js +111 -33
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/CliConfig.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +105 -74
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +98 -63
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/CliOutput.d.ts +35 -54
- package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
- package/dist/unstable/cli/CliOutput.js +26 -42
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +705 -107
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +252 -47
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Completions.js.map +1 -1
- package/dist/unstable/cli/Flag.d.ts +418 -138
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +197 -71
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +1 -1
- package/dist/unstable/cli/GlobalFlag.js.map +1 -1
- package/dist/unstable/cli/HelpDoc.d.ts +12 -4
- package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
- package/dist/unstable/cli/Param.d.ts +292 -78
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +131 -49
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +370 -149
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js +345 -137
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/Prompt.d.ts +23 -14
- package/dist/unstable/cli/Prompt.d.ts.map +1 -1
- package/dist/unstable/cli/Prompt.js +23 -14
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/index.js.map +1 -1
- package/dist/unstable/cli/internal/ansi.js.map +1 -1
- package/dist/unstable/cli/internal/auto-suggest.js.map +1 -1
- package/dist/unstable/cli/internal/command.d.ts +3 -1
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +11 -4
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/completions/bash.js.map +1 -1
- package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -1
- package/dist/unstable/cli/internal/completions/fish.js.map +1 -1
- package/dist/unstable/cli/internal/completions/zsh.js.map +1 -1
- package/dist/unstable/cli/internal/config.d.ts +0 -48
- package/dist/unstable/cli/internal/config.d.ts.map +1 -1
- package/dist/unstable/cli/internal/config.js +8 -10
- package/dist/unstable/cli/internal/config.js.map +1 -1
- package/dist/unstable/cli/internal/help.js.map +1 -1
- package/dist/unstable/cli/internal/lexer.js +17 -7
- package/dist/unstable/cli/internal/lexer.js.map +1 -1
- package/dist/unstable/cli/internal/parser.js +2 -2
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cli/internal/wizard.js.map +1 -1
- package/dist/unstable/cluster/ClusterCron.js.map +1 -1
- package/dist/unstable/cluster/ClusterError.js.map +1 -1
- package/dist/unstable/cluster/ClusterMetrics.js.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.d.ts +8 -8
- package/dist/unstable/cluster/ClusterSchema.js +8 -8
- package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +6 -2
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/DeliverAt.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +10 -10
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +9 -9
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/EntityAddress.js.map +1 -1
- package/dist/unstable/cluster/EntityId.js.map +1 -1
- package/dist/unstable/cluster/EntityProxy.d.ts +4 -2
- package/dist/unstable/cluster/EntityProxy.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxy.js +4 -2
- package/dist/unstable/cluster/EntityProxy.js.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
- package/dist/unstable/cluster/EntityResource.d.ts +2 -2
- package/dist/unstable/cluster/EntityResource.js +2 -2
- package/dist/unstable/cluster/EntityResource.js.map +1 -1
- package/dist/unstable/cluster/EntityType.js.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts +3 -3
- package/dist/unstable/cluster/Envelope.d.ts.map +1 -1
- package/dist/unstable/cluster/Envelope.js +5 -4
- package/dist/unstable/cluster/Envelope.js.map +1 -1
- package/dist/unstable/cluster/HttpRunner.d.ts +2 -2
- package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/HttpRunner.js +6 -4
- package/dist/unstable/cluster/HttpRunner.js.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
- package/dist/unstable/cluster/MachineId.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +9 -9
- package/dist/unstable/cluster/Message.js +6 -6
- package/dist/unstable/cluster/Message.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +15 -15
- package/dist/unstable/cluster/MessageStorage.js +5 -5
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +5 -5
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/Runner.d.ts +1 -1
- package/dist/unstable/cluster/Runner.js +1 -1
- package/dist/unstable/cluster/Runner.js.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.d.ts +1 -1
- package/dist/unstable/cluster/RunnerAddress.js +1 -1
- package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.d.ts +1 -1
- package/dist/unstable/cluster/RunnerHealth.js +1 -1
- package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts +2 -1
- package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +16 -16
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.d.ts +2 -2
- package/dist/unstable/cluster/RunnerStorage.js +1 -1
- package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +6 -6
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +19 -10
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/ShardId.js +1 -1
- package/dist/unstable/cluster/ShardId.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +128 -26
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +13 -5
- package/dist/unstable/cluster/ShardingConfig.d.ts.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.js +3 -3
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/ShardingRegistrationEvent.js.map +1 -1
- package/dist/unstable/cluster/SingleRunner.d.ts +4 -2
- package/dist/unstable/cluster/SingleRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/SingleRunner.js +2 -1
- package/dist/unstable/cluster/SingleRunner.js.map +1 -1
- package/dist/unstable/cluster/Singleton.js.map +1 -1
- package/dist/unstable/cluster/SingletonAddress.d.ts +1 -1
- package/dist/unstable/cluster/SingletonAddress.js +1 -1
- package/dist/unstable/cluster/SingletonAddress.js.map +1 -1
- package/dist/unstable/cluster/Snowflake.d.ts +8 -8
- package/dist/unstable/cluster/Snowflake.js +8 -8
- package/dist/unstable/cluster/Snowflake.js.map +1 -1
- package/dist/unstable/cluster/SocketRunner.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.d.ts +7 -4
- package/dist/unstable/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +56 -25
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js +127 -65
- package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/TestRunner.js.map +1 -1
- package/dist/unstable/cluster/index.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +24 -12
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/cluster/internal/entityReaper.js.map +1 -1
- package/dist/unstable/cluster/internal/hash.js.map +1 -1
- package/dist/unstable/cluster/internal/interruptors.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
- package/dist/unstable/cluster/internal/shardLock.d.ts +2 -0
- package/dist/unstable/cluster/internal/shardLock.d.ts.map +1 -0
- package/dist/unstable/cluster/internal/shardLock.js +4 -0
- package/dist/unstable/cluster/internal/shardLock.js.map +1 -0
- package/dist/unstable/devtools/DevTools.js.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.d.ts +20 -20
- package/dist/unstable/devtools/DevToolsSchema.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js +8 -5
- package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
- package/dist/unstable/devtools/DevToolsServer.js.map +1 -1
- package/dist/unstable/devtools/index.js.map +1 -1
- package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
- package/dist/unstable/encoding/Msgpack.js +6 -8
- package/dist/unstable/encoding/Msgpack.js.map +1 -1
- package/dist/unstable/encoding/Ndjson.js.map +1 -1
- package/dist/unstable/encoding/Sse.d.ts +72 -8
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.js +58 -8
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/encoding/index.js.map +1 -1
- package/dist/unstable/eventlog/Event.d.ts +20 -20
- package/dist/unstable/eventlog/Event.js.map +1 -1
- package/dist/unstable/eventlog/EventGroup.d.ts +4 -4
- package/dist/unstable/eventlog/EventGroup.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +16 -16
- package/dist/unstable/eventlog/EventJournal.js +14 -14
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts +3 -3
- package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLog.js +18 -14
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.d.ts +2 -2
- package/dist/unstable/eventlog/EventLogEncryption.js +2 -2
- package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +6 -6
- package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.js +9 -4
- package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +15 -15
- package/dist/unstable/eventlog/EventLogRemote.js +1 -1
- package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.d.ts +11 -2
- package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.js +45 -21
- package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +4 -4
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.js +13 -5
- package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +5 -5
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js +14 -6
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.js +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.js +2 -2
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +3 -3
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/index.js.map +1 -1
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js.map +1 -1
- package/dist/unstable/http/Cookies.d.ts +2 -2
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +54 -40
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Etag.d.ts +1 -1
- package/dist/unstable/http/Etag.js +1 -1
- package/dist/unstable/http/Etag.js.map +1 -1
- package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/unstable/http/FetchHttpClient.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts +2 -2
- package/dist/unstable/http/Headers.js +10 -10
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpBody.d.ts +5 -3
- package/dist/unstable/http/HttpBody.d.ts.map +1 -1
- package/dist/unstable/http/HttpBody.js +11 -5
- package/dist/unstable/http/HttpBody.js.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts +51 -44
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +46 -17
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientError.js.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts +44 -0
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +16 -0
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts +4 -4
- package/dist/unstable/http/HttpClientResponse.js +2 -2
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts +6 -6
- package/dist/unstable/http/HttpEffect.js +3 -3
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMethod.d.ts +6 -9
- package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
- package/dist/unstable/http/HttpMethod.js +6 -9
- package/dist/unstable/http/HttpMethod.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts +75 -9
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +164 -39
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpPlatform.d.ts +76 -0
- package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
- package/dist/unstable/http/HttpPlatform.js +32 -0
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +88 -89
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +78 -79
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServer.d.ts +13 -13
- package/dist/unstable/http/HttpServer.js +6 -6
- package/dist/unstable/http/HttpServer.js.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +2 -2
- package/dist/unstable/http/HttpServerError.js +2 -2
- package/dist/unstable/http/HttpServerError.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +4 -4
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +9 -8
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +22 -0
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +10 -0
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpStaticServer.d.ts +35 -7
- package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpStaticServer.js +35 -7
- package/dist/unstable/http/HttpStaticServer.js.map +1 -1
- package/dist/unstable/http/HttpTraceContext.js.map +1 -1
- package/dist/unstable/http/Multipart.d.ts +6 -6
- package/dist/unstable/http/Multipart.d.ts.map +1 -1
- package/dist/unstable/http/Multipart.js +22 -20
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/Template.js +1 -1
- package/dist/unstable/http/Template.js.map +1 -1
- package/dist/unstable/http/Url.d.ts +33 -63
- package/dist/unstable/http/Url.d.ts.map +1 -1
- package/dist/unstable/http/Url.js +14 -28
- package/dist/unstable/http/Url.js.map +1 -1
- package/dist/unstable/http/UrlParams.d.ts +10 -18
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +26 -31
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/http/index.js.map +1 -1
- package/dist/unstable/http/internal/compression.d.ts +2 -0
- package/dist/unstable/http/internal/compression.d.ts.map +1 -0
- package/dist/unstable/http/internal/compression.js +155 -0
- package/dist/unstable/http/internal/compression.js.map +1 -0
- package/dist/unstable/http/internal/preResponseHandler.js.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js +3 -3
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +10 -11
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +4 -5
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +16 -18
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +42 -42
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +13 -13
- package/dist/unstable/httpapi/HttpApiError.js +13 -13
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.d.ts +15 -15
- package/dist/unstable/httpapi/HttpApiGroup.js +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +71 -24
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js +57 -10
- package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts +0 -12
- package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +6 -6
- package/dist/unstable/httpapi/HttpApiSchema.js +4 -4
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiTest.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts +13 -13
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +50 -37
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/httpapi/index.js.map +1 -1
- package/dist/unstable/httpapi/internal/html.js.map +1 -1
- package/dist/unstable/httpapi/internal/httpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/internal/httpApiSwagger.js.map +1 -1
- package/dist/unstable/httpapi/internal/mediaType.js.map +1 -1
- package/dist/unstable/observability/Otlp.js.map +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts +70 -1
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +84 -6
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.d.ts +4 -3
- package/dist/unstable/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js +2 -2
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts +11 -4
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.js +5 -2
- package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
- package/dist/unstable/observability/OtlpResource.d.ts +16 -7
- package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpResource.js +21 -12
- package/dist/unstable/observability/OtlpResource.js.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.d.ts +4 -3
- package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js +2 -2
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.d.ts +13 -4
- package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.js +10 -3
- package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
- package/dist/unstable/observability/index.js.map +1 -1
- package/dist/unstable/observability/internal/otlpEnv.js +1 -1
- package/dist/unstable/observability/internal/otlpEnv.js.map +1 -1
- package/dist/unstable/observability/internal/otlpProtobuf.js.map +1 -1
- package/dist/unstable/observability/internal/protobuf.js +3 -0
- package/dist/unstable/observability/internal/protobuf.js.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +8 -3
- package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.js +22 -13
- package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
- package/dist/unstable/persistence/Persistable.d.ts +8 -8
- package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistable.js +2 -1
- package/dist/unstable/persistence/Persistable.js.map +1 -1
- package/dist/unstable/persistence/PersistedCache.js.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts +6 -6
- package/dist/unstable/persistence/PersistedQueue.js +6 -6
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/Persistence.d.ts +3 -3
- package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistence.js +91 -15
- package/dist/unstable/persistence/Persistence.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +28 -17
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +26 -15
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/persistence/Redis.d.ts +2 -2
- package/dist/unstable/persistence/Redis.d.ts.map +1 -1
- package/dist/unstable/persistence/Redis.js +3 -3
- package/dist/unstable/persistence/Redis.js.map +1 -1
- package/dist/unstable/persistence/index.js.map +1 -1
- package/dist/unstable/process/ChildProcess.d.ts +64 -21
- package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcess.js +14 -5
- package/dist/unstable/process/ChildProcess.js.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.d.ts +21 -10
- package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js +4 -2
- package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
- package/dist/unstable/process/index.js.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.d.ts +8 -8
- package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.js +14 -13
- package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +105 -19
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +44 -12
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.js +4 -1
- package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/unstable/reactivity/AtomRef.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +25 -4
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.js +4 -1
- package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
- package/dist/unstable/reactivity/Hydration.d.ts +1 -1
- package/dist/unstable/reactivity/Hydration.js +1 -1
- package/dist/unstable/reactivity/Hydration.js.map +1 -1
- package/dist/unstable/reactivity/Reactivity.js.map +1 -1
- package/dist/unstable/reactivity/index.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +35 -33
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js +4 -2
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts +12 -12
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +14 -12
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcClientError.js.map +1 -1
- package/dist/unstable/rpc/RpcGroup.d.ts +8 -8
- package/dist/unstable/rpc/RpcGroup.js +1 -1
- package/dist/unstable/rpc/RpcGroup.js.map +1 -1
- package/dist/unstable/rpc/RpcMessage.d.ts +31 -30
- package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMessage.js +6 -6
- package/dist/unstable/rpc/RpcMessage.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts +10 -10
- package/dist/unstable/rpc/RpcMiddleware.js +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts +4 -4
- package/dist/unstable/rpc/RpcSchema.js +3 -3
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts +58 -7
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +175 -96
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +13 -13
- package/dist/unstable/rpc/RpcServer.js +17 -13
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/rpc/RpcTest.js.map +1 -1
- package/dist/unstable/rpc/RpcWorker.d.ts +5 -5
- package/dist/unstable/rpc/RpcWorker.js +4 -4
- package/dist/unstable/rpc/RpcWorker.js.map +1 -1
- package/dist/unstable/rpc/Utils.js.map +1 -1
- package/dist/unstable/rpc/index.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts +52 -50
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js +35 -33
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +6 -7
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.js +15 -12
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/schema/index.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +12 -4
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +10 -5
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/socket/SocketServer.js.map +1 -1
- package/dist/unstable/socket/index.js.map +1 -1
- package/dist/unstable/sql/Migrator.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts +1 -1
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +2 -2
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/sql/SqlConnection.js.map +1 -1
- package/dist/unstable/sql/SqlError.d.ts +2 -2
- package/dist/unstable/sql/SqlError.js +2 -2
- package/dist/unstable/sql/SqlError.js.map +1 -1
- package/dist/unstable/sql/SqlModel.d.ts +2 -2
- package/dist/unstable/sql/SqlModel.js +2 -2
- package/dist/unstable/sql/SqlModel.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.d.ts +5 -5
- package/dist/unstable/sql/SqlResolver.js +2 -2
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/sql/SqlSchema.js.map +1 -1
- package/dist/unstable/sql/SqlStream.js.map +1 -1
- package/dist/unstable/sql/Statement.d.ts +6 -6
- package/dist/unstable/sql/Statement.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.js +22 -21
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/sql/index.js.map +1 -1
- package/dist/unstable/workers/Transferable.d.ts +1 -1
- package/dist/unstable/workers/Transferable.js +1 -1
- package/dist/unstable/workers/Transferable.js.map +1 -1
- package/dist/unstable/workers/Worker.d.ts +2 -2
- package/dist/unstable/workers/Worker.js +2 -2
- package/dist/unstable/workers/Worker.js.map +1 -1
- package/dist/unstable/workers/WorkerError.d.ts +7 -7
- package/dist/unstable/workers/WorkerError.js +6 -6
- package/dist/unstable/workers/WorkerError.js.map +1 -1
- package/dist/unstable/workers/WorkerRunner.d.ts +1 -1
- package/dist/unstable/workers/WorkerRunner.js +1 -1
- package/dist/unstable/workers/WorkerRunner.js.map +1 -1
- package/dist/unstable/workers/index.js.map +1 -1
- package/dist/unstable/workflow/Activity.d.ts +2 -2
- package/dist/unstable/workflow/Activity.js +2 -2
- package/dist/unstable/workflow/Activity.js.map +1 -1
- package/dist/unstable/workflow/DurableClock.d.ts +1 -1
- package/dist/unstable/workflow/DurableClock.js +1 -1
- package/dist/unstable/workflow/DurableClock.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts +10 -10
- package/dist/unstable/workflow/DurableDeferred.js +5 -5
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/DurableQueue.d.ts +22 -20
- package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableQueue.js +22 -20
- package/dist/unstable/workflow/DurableQueue.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +21 -21
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js +13 -14
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.d.ts +4 -2
- package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.js +4 -2
- package/dist/unstable/workflow/WorkflowProxy.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
- package/dist/unstable/workflow/index.js.map +1 -1
- package/dist/unstable/workflow/internal/crypto.js.map +1 -1
- package/package.json +5 -6
- package/src/Array.ts +1068 -1070
- package/src/BigDecimal.ts +433 -756
- package/src/BigInt.ts +213 -269
- package/src/Boolean.ts +146 -188
- package/src/Cache.ts +409 -255
- package/src/Cause.ts +167 -277
- package/src/Channel.ts +923 -830
- package/src/ChannelSchema.ts +1 -1
- package/src/Chunk.ts +841 -1181
- package/src/Clock.ts +181 -49
- package/src/Combiner.ts +20 -33
- package/src/Config.ts +618 -334
- package/src/ConfigProvider.ts +221 -127
- package/src/Console.ts +289 -39
- package/src/Context.ts +319 -378
- package/src/Cron.ts +68 -77
- package/src/Crypto.ts +13 -15
- package/src/Data.ts +63 -82
- package/src/DateTime.ts +564 -660
- package/src/Deferred.ts +253 -256
- package/src/Duration.ts +216 -308
- package/src/Effect.ts +2958 -3390
- package/src/Encoding.ts +22 -40
- package/src/Equal.ts +49 -39
- package/src/Equivalence.ts +103 -105
- package/src/ErrorReporter.ts +51 -27
- package/src/ExecutionPlan.ts +13 -55
- package/src/Exit.ts +116 -192
- package/src/Fiber.ts +81 -148
- package/src/FiberHandle.ts +155 -107
- package/src/FiberMap.ts +225 -174
- package/src/FiberSet.ts +124 -82
- package/src/FileSystem.ts +155 -263
- package/src/Filter.ts +61 -33
- package/src/Formatter.ts +54 -56
- package/src/Function.ts +76 -145
- package/src/Graph.ts +416 -770
- package/src/HKT.ts +12 -6
- package/src/Hash.ts +52 -83
- package/src/HashMap.ts +319 -411
- package/src/HashRing.ts +1 -0
- package/src/HashSet.ts +177 -284
- package/src/Inspectable.ts +12 -12
- package/src/Iterable.ts +622 -787
- package/src/JsonPatch.ts +60 -113
- package/src/JsonPointer.ts +8 -8
- package/src/JsonSchema.ts +405 -249
- package/src/Latch.ts +23 -35
- package/src/Layer.ts +359 -260
- package/src/LayerMap.ts +49 -29
- package/src/LayerRef.ts +6 -2
- package/src/LogLevel.ts +114 -214
- package/src/Logger.ts +347 -699
- package/src/ManagedRuntime.ts +20 -5
- package/src/Match.ts +217 -252
- package/src/Metric.ts +520 -1092
- package/src/MutableHashMap.ts +218 -255
- package/src/MutableHashSet.ts +84 -89
- package/src/MutableList.ts +73 -370
- package/src/MutableRef.ts +420 -243
- package/src/Newtype.ts +21 -14
- package/src/NonEmptyIterable.ts +7 -137
- package/src/Number.ts +196 -233
- package/src/Optic.ts +246 -385
- package/src/Option.ts +449 -813
- package/src/Order.ts +109 -109
- package/src/Ordering.ts +20 -23
- package/src/PartitionedSemaphore.ts +1 -4
- package/src/Path.ts +38 -41
- package/src/Pipeable.ts +6 -5
- package/src/PlatformError.ts +4 -4
- package/src/Pool.ts +4 -2
- package/src/Predicate.ts +200 -181
- package/src/PrimaryKey.ts +7 -7
- package/src/PubSub.ts +526 -552
- package/src/Pull.ts +24 -18
- package/src/Queue.ts +200 -159
- package/src/Random.ts +49 -74
- package/src/RcMap.ts +121 -63
- package/src/RcRef.ts +24 -13
- package/src/Record.ts +387 -487
- package/src/Redactable.ts +10 -3
- package/src/Redacted.ts +25 -25
- package/src/Reducer.ts +8 -15
- package/src/Ref.ts +221 -361
- package/src/References.ts +102 -214
- package/src/RegExp.ts +10 -14
- package/src/Request.ts +36 -28
- package/src/RequestResolver.ts +202 -91
- package/src/Result.ts +314 -485
- package/src/Runtime.ts +50 -75
- package/src/Schedule.ts +308 -1734
- package/src/Scheduler.ts +20 -7
- package/src/Schema.ts +3156 -1634
- package/src/SchemaAST.ts +676 -489
- package/src/SchemaError.ts +8 -7
- package/src/SchemaGetter.ts +277 -218
- package/src/SchemaIssue.ts +90 -276
- package/src/SchemaParser.ts +179 -116
- package/src/SchemaRepresentation.ts +698 -3417
- package/src/SchemaTransformation.ts +132 -91
- package/src/Scope.ts +123 -151
- package/src/ScopedRef.ts +4 -4
- package/src/Semaphore.ts +157 -54
- package/src/Sink.ts +128 -113
- package/src/Stdio.ts +1 -1
- package/src/Stream.ts +2665 -3142
- package/src/String.ts +275 -312
- package/src/Struct.ts +114 -118
- package/src/SubscriptionRef.ts +284 -252
- package/src/Symbol.ts +3 -3
- package/src/Terminal.ts +2 -2
- package/src/Tracer.ts +102 -55
- package/src/Trie.ts +287 -679
- package/src/Tuple.ts +92 -127
- package/src/TxChunk.ts +201 -121
- package/src/TxDeferred.ts +62 -46
- package/src/TxHashMap.ts +645 -799
- package/src/TxHashSet.ts +443 -356
- package/src/TxPriorityQueue.ts +130 -98
- package/src/TxPubSub.ts +107 -80
- package/src/TxQueue.ts +214 -183
- package/src/TxReentrantLock.ts +97 -66
- package/src/TxRef.ts +51 -32
- package/src/TxSemaphore.ts +129 -95
- package/src/TxSubscriptionRef.ts +97 -70
- package/src/Types.ts +127 -70
- package/src/Unify.ts +45 -65
- package/src/Utils.ts +23 -16
- package/src/index.ts +0 -5
- package/src/internal/core.ts +5 -4
- package/src/internal/dateTime.ts +6 -0
- package/src/internal/effect.ts +160 -79
- package/src/internal/matcher.ts +1 -1
- package/src/internal/persistence.ts +2 -0
- package/src/internal/record.ts +11 -7
- package/src/internal/references.ts +3 -7
- package/src/internal/schema/annotations.ts +44 -0
- package/src/internal/schema/fromJsonSchemaDocument.ts +959 -0
- package/src/internal/schema/fromRepresentation.ts +339 -0
- package/src/internal/schema/parser.ts +22 -0
- package/src/internal/schema/schema.ts +45 -46
- package/src/internal/schema/{arbitrary.ts → toArbitrary.ts} +8 -10
- package/src/internal/schema/toCodeDocument.ts +572 -0
- package/src/internal/schema/{equivalence.ts → toEquivalence.ts} +12 -7
- package/src/internal/schema/toJsonSchemaDocument.ts +529 -0
- package/src/internal/schema/toRepresentation.ts +386 -0
- package/src/internal/stackTraceLimit.ts +3 -7
- package/src/internal/trie.ts +10 -11
- package/src/testing/FastCheck.ts +8 -7
- package/src/testing/TestClock.ts +73 -31
- package/src/testing/TestConsole.ts +32 -31
- package/src/testing/TestSchema.ts +29 -29
- package/src/unstable/ai/AiError.ts +100 -122
- package/src/unstable/ai/AnthropicStructuredOutput.ts +103 -334
- package/src/unstable/ai/Chat.ts +132 -97
- package/src/unstable/ai/EmbeddingModel.ts +1 -1
- package/src/unstable/ai/IdGenerator.ts +32 -28
- package/src/unstable/ai/LanguageModel.ts +137 -95
- package/src/unstable/ai/McpProtocol.ts +48 -0
- package/src/unstable/ai/McpSchema.ts +75 -65
- package/src/unstable/ai/McpServer.ts +1045 -303
- package/src/unstable/ai/Model.ts +9 -20
- package/src/unstable/ai/OpenAiStructuredOutput.ts +231 -396
- package/src/unstable/ai/Prompt.ts +145 -43
- package/src/unstable/ai/Response.ts +52 -38
- package/src/unstable/ai/Telemetry.ts +46 -13
- package/src/unstable/ai/Tokenizer.ts +14 -3
- package/src/unstable/ai/Tool.ts +81 -48
- package/src/unstable/ai/Toolkit.ts +45 -15
- package/src/unstable/ai/index.ts +5 -0
- package/src/unstable/ai/internal/codec-transformer.ts +13 -7
- package/src/unstable/ai/internal/mcpProtocol.ts +85 -0
- package/src/unstable/ai/internal/mcpProtocolRegistry.ts +70 -0
- package/src/unstable/ai/internal/structured-output.ts +453 -0
- package/src/unstable/cli/Argument.ts +273 -69
- package/src/unstable/cli/CliError.ts +116 -77
- package/src/unstable/cli/CliOutput.ts +44 -58
- package/src/unstable/cli/Command.ts +709 -111
- package/src/unstable/cli/Flag.ts +418 -138
- package/src/unstable/cli/GlobalFlag.ts +1 -1
- package/src/unstable/cli/HelpDoc.ts +12 -4
- package/src/unstable/cli/Param.ts +295 -81
- package/src/unstable/cli/Primitive.ts +371 -150
- package/src/unstable/cli/Prompt.ts +28 -14
- package/src/unstable/cli/internal/command.ts +13 -5
- package/src/unstable/cli/internal/config.ts +8 -10
- package/src/unstable/cli/internal/lexer.ts +8 -2
- package/src/unstable/cli/internal/parser.ts +2 -2
- package/src/unstable/cluster/ClusterSchema.ts +8 -8
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +8 -4
- package/src/unstable/cluster/Entity.ts +16 -17
- package/src/unstable/cluster/EntityProxy.ts +4 -2
- package/src/unstable/cluster/EntityResource.ts +2 -2
- package/src/unstable/cluster/Envelope.ts +5 -4
- package/src/unstable/cluster/HttpRunner.ts +6 -4
- package/src/unstable/cluster/Message.ts +9 -9
- package/src/unstable/cluster/MessageStorage.ts +15 -15
- package/src/unstable/cluster/Reply.ts +5 -7
- package/src/unstable/cluster/Runner.ts +1 -1
- package/src/unstable/cluster/RunnerAddress.ts +1 -1
- package/src/unstable/cluster/RunnerHealth.ts +1 -1
- package/src/unstable/cluster/RunnerServer.ts +41 -8
- package/src/unstable/cluster/RunnerStorage.ts +2 -2
- package/src/unstable/cluster/Runners.ts +23 -12
- package/src/unstable/cluster/ShardId.ts +1 -1
- package/src/unstable/cluster/Sharding.ts +168 -42
- package/src/unstable/cluster/ShardingConfig.ts +8 -4
- package/src/unstable/cluster/SingleRunner.ts +4 -2
- package/src/unstable/cluster/SingletonAddress.ts +1 -1
- package/src/unstable/cluster/Snowflake.ts +8 -8
- package/src/unstable/cluster/SqlMessageStorage.ts +84 -36
- package/src/unstable/cluster/SqlRunnerStorage.ts +205 -119
- package/src/unstable/cluster/internal/entityManager.ts +42 -25
- package/src/unstable/cluster/internal/shardLock.ts +9 -0
- package/src/unstable/devtools/DevToolsSchema.ts +10 -5
- package/src/unstable/encoding/Msgpack.ts +6 -8
- package/src/unstable/encoding/Sse.ts +98 -16
- package/src/unstable/eventlog/Event.ts +20 -20
- package/src/unstable/eventlog/EventGroup.ts +4 -4
- package/src/unstable/eventlog/EventJournal.ts +16 -16
- package/src/unstable/eventlog/EventLog.ts +24 -14
- package/src/unstable/eventlog/EventLogEncryption.ts +2 -2
- package/src/unstable/eventlog/EventLogMessage.ts +12 -5
- package/src/unstable/eventlog/EventLogRemote.ts +1 -1
- package/src/unstable/eventlog/EventLogServer.ts +41 -7
- package/src/unstable/eventlog/EventLogServerEncrypted.ts +13 -5
- package/src/unstable/eventlog/EventLogServerUnencrypted.ts +14 -6
- package/src/unstable/eventlog/EventLogSessionAuth.ts +1 -1
- package/src/unstable/eventlog/SqlEventJournal.ts +2 -2
- package/src/unstable/eventlog/SqlEventLogServerEncrypted.ts +1 -1
- package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +6 -3
- package/src/unstable/http/Cookies.ts +64 -45
- package/src/unstable/http/Etag.ts +1 -1
- package/src/unstable/http/FetchHttpClient.ts +3 -1
- package/src/unstable/http/Headers.ts +10 -10
- package/src/unstable/http/HttpBody.ts +20 -5
- package/src/unstable/http/HttpClient.ts +83 -55
- package/src/unstable/http/HttpClientRequest.ts +59 -0
- package/src/unstable/http/HttpClientResponse.ts +4 -4
- package/src/unstable/http/HttpEffect.ts +8 -8
- package/src/unstable/http/HttpMethod.ts +6 -9
- package/src/unstable/http/HttpMiddleware.ts +202 -39
- package/src/unstable/http/HttpPlatform.ts +95 -0
- package/src/unstable/http/HttpRouter.ts +102 -98
- package/src/unstable/http/HttpServer.ts +13 -13
- package/src/unstable/http/HttpServerError.ts +2 -2
- package/src/unstable/http/HttpServerRequest.ts +9 -8
- package/src/unstable/http/HttpServerResponse.ts +30 -0
- package/src/unstable/http/HttpStaticServer.ts +35 -7
- package/src/unstable/http/Multipart.ts +22 -19
- package/src/unstable/http/Template.ts +1 -1
- package/src/unstable/http/Url.ts +33 -63
- package/src/unstable/http/UrlParams.ts +27 -32
- package/src/unstable/http/internal/compression.ts +196 -0
- package/src/unstable/httpapi/HttpApi.ts +3 -3
- package/src/unstable/httpapi/HttpApiBuilder.ts +10 -9
- package/src/unstable/httpapi/HttpApiClient.ts +19 -19
- package/src/unstable/httpapi/HttpApiEndpoint.ts +42 -42
- package/src/unstable/httpapi/HttpApiError.ts +13 -13
- package/src/unstable/httpapi/HttpApiGroup.ts +16 -16
- package/src/unstable/httpapi/HttpApiMiddleware.ts +71 -24
- package/src/unstable/httpapi/HttpApiScalar.ts +0 -12
- package/src/unstable/httpapi/HttpApiSchema.ts +6 -6
- package/src/unstable/httpapi/OpenApi.ts +65 -41
- package/src/unstable/observability/OtlpExporter.ts +126 -10
- package/src/unstable/observability/OtlpLogger.ts +5 -5
- package/src/unstable/observability/OtlpMetrics.ts +12 -5
- package/src/unstable/observability/OtlpResource.ts +26 -17
- package/src/unstable/observability/OtlpTracer.ts +8 -4
- package/src/unstable/observability/PrometheusMetrics.ts +13 -4
- package/src/unstable/observability/internal/otlpEnv.ts +1 -1
- package/src/unstable/observability/internal/protobuf.ts +3 -0
- package/src/unstable/persistence/KeyValueStore.ts +72 -49
- package/src/unstable/persistence/Persistable.ts +11 -10
- package/src/unstable/persistence/PersistedQueue.ts +6 -6
- package/src/unstable/persistence/Persistence.ts +126 -19
- package/src/unstable/persistence/RateLimiter.ts +28 -17
- package/src/unstable/persistence/Redis.ts +4 -4
- package/src/unstable/process/ChildProcess.ts +64 -21
- package/src/unstable/process/ChildProcessSpawner.ts +22 -11
- package/src/unstable/reactivity/AsyncResult.ts +16 -16
- package/src/unstable/reactivity/Atom.ts +117 -22
- package/src/unstable/reactivity/AtomHttpApi.ts +5 -4
- package/src/unstable/reactivity/AtomRegistry.ts +25 -4
- package/src/unstable/reactivity/AtomRpc.ts +5 -4
- package/src/unstable/reactivity/Hydration.ts +1 -1
- package/src/unstable/rpc/Rpc.ts +35 -33
- package/src/unstable/rpc/RpcClient.ts +18 -16
- package/src/unstable/rpc/RpcGroup.ts +8 -8
- package/src/unstable/rpc/RpcMessage.ts +31 -30
- package/src/unstable/rpc/RpcMiddleware.ts +10 -10
- package/src/unstable/rpc/RpcSchema.ts +4 -4
- package/src/unstable/rpc/RpcSerialization.ts +167 -68
- package/src/unstable/rpc/RpcServer.ts +18 -15
- package/src/unstable/rpc/RpcWorker.ts +5 -5
- package/src/unstable/schema/Model.ts +52 -50
- package/src/unstable/schema/VariantSchema.ts +19 -29
- package/src/unstable/socket/Socket.ts +18 -5
- package/src/unstable/sql/SqlClient.ts +5 -6
- package/src/unstable/sql/SqlError.ts +2 -2
- package/src/unstable/sql/SqlModel.ts +2 -2
- package/src/unstable/sql/SqlResolver.ts +5 -5
- package/src/unstable/sql/Statement.ts +31 -29
- package/src/unstable/workers/Transferable.ts +1 -1
- package/src/unstable/workers/Worker.ts +2 -2
- package/src/unstable/workers/WorkerError.ts +7 -7
- package/src/unstable/workers/WorkerRunner.ts +1 -1
- package/src/unstable/workflow/Activity.ts +2 -2
- package/src/unstable/workflow/DurableClock.ts +1 -1
- package/src/unstable/workflow/DurableDeferred.ts +10 -10
- package/src/unstable/workflow/DurableQueue.ts +22 -20
- package/src/unstable/workflow/Workflow.ts +23 -23
- package/src/unstable/workflow/WorkflowEngine.ts +1 -1
- package/src/unstable/workflow/WorkflowProxy.ts +4 -2
- package/dist/SchemaUtils.d.ts +0 -28
- package/dist/SchemaUtils.d.ts.map +0 -1
- package/dist/SchemaUtils.js +0 -45
- package/dist/SchemaUtils.js.map +0 -1
- package/dist/internal/schema/arbitrary.d.ts.map +0 -1
- package/dist/internal/schema/arbitrary.js.map +0 -1
- package/dist/internal/schema/equivalence.d.ts +0 -2
- package/dist/internal/schema/equivalence.d.ts.map +0 -1
- package/dist/internal/schema/equivalence.js.map +0 -1
- package/dist/internal/schema/representation.d.ts +0 -2
- package/dist/internal/schema/representation.d.ts.map +0 -1
- package/dist/internal/schema/representation.js +0 -865
- package/dist/internal/schema/representation.js.map +0 -1
- package/dist/internal/version.d.ts +0 -3
- package/dist/internal/version.d.ts.map +0 -1
- package/dist/internal/version.js +0 -2
- package/dist/internal/version.js.map +0 -1
- package/src/SchemaUtils.ts +0 -51
- package/src/internal/schema/representation.ts +0 -795
- package/src/internal/version.ts +0 -2
package/src/Optic.ts
CHANGED
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
import { format } from "./Formatter.ts"
|
|
16
|
-
import { identity
|
|
16
|
+
import { identity } from "./Function.ts"
|
|
17
|
+
import * as InternalRecord from "./internal/record.ts"
|
|
17
18
|
import * as Option from "./Option.ts"
|
|
18
19
|
import * as Predicate from "./Predicate.ts"
|
|
19
20
|
import * as Result from "./Result.ts"
|
|
@@ -41,7 +42,7 @@ import type { IsUnion } from "./Types.ts"
|
|
|
41
42
|
*
|
|
42
43
|
* **Example** (Converting between Celsius and Fahrenheit)
|
|
43
44
|
*
|
|
44
|
-
* ```ts
|
|
45
|
+
* ```ts import.meta.vitest
|
|
45
46
|
* import { Optic } from "effect"
|
|
46
47
|
*
|
|
47
48
|
* const fahrenheit = Optic.makeIso<number, number>(
|
|
@@ -49,18 +50,16 @@ import type { IsUnion } from "./Types.ts"
|
|
|
49
50
|
* (f) => (f - 32) * 5 / 9
|
|
50
51
|
* )
|
|
51
52
|
*
|
|
52
|
-
*
|
|
53
|
-
* // Output: 212
|
|
53
|
+
* fahrenheit.get(100) // => 212
|
|
54
54
|
*
|
|
55
|
-
*
|
|
56
|
-
* // Output: 0
|
|
55
|
+
* fahrenheit.set(32) // => 0
|
|
57
56
|
* ```
|
|
58
57
|
*
|
|
59
58
|
* @see {@link makeIso} — constructor
|
|
60
59
|
* @see {@link Lens} — when you only need a one-directional focus into a whole
|
|
61
60
|
* @see {@link Prism} — when the focus may not be present
|
|
62
61
|
*
|
|
63
|
-
* @category
|
|
62
|
+
* @category models
|
|
64
63
|
* @since 4.0.0
|
|
65
64
|
*/
|
|
66
65
|
export interface Iso<in out S, in out A> extends Lens<S, A>, Prism<S, A> {}
|
|
@@ -79,7 +78,7 @@ export interface Iso<in out S, in out A> extends Lens<S, A>, Prism<S, A> {}
|
|
|
79
78
|
*
|
|
80
79
|
* **Example** (Wrapping and unwrapping a branded type)
|
|
81
80
|
*
|
|
82
|
-
* ```ts
|
|
81
|
+
* ```ts import.meta.vitest
|
|
83
82
|
* import { Optic } from "effect"
|
|
84
83
|
*
|
|
85
84
|
* type Meters = { readonly value: number }
|
|
@@ -88,11 +87,9 @@ export interface Iso<in out S, in out A> extends Lens<S, A>, Prism<S, A> {}
|
|
|
88
87
|
* (n) => ({ value: n })
|
|
89
88
|
* )
|
|
90
89
|
*
|
|
91
|
-
*
|
|
92
|
-
* // Output: 100
|
|
90
|
+
* meters.get({ value: 100 }) // => 100
|
|
93
91
|
*
|
|
94
|
-
*
|
|
95
|
-
* // Output: { value: 42 }
|
|
92
|
+
* meters.set(42) // => { value: 42 }
|
|
96
93
|
* ```
|
|
97
94
|
*
|
|
98
95
|
* @see {@link Iso} — the type this function returns
|
|
@@ -102,7 +99,7 @@ export interface Iso<in out S, in out A> extends Lens<S, A>, Prism<S, A> {}
|
|
|
102
99
|
* @since 4.0.0
|
|
103
100
|
*/
|
|
104
101
|
export function makeIso<S, A>(get: (s: S) => A, set: (a: A) => S): Iso<S, A> {
|
|
105
|
-
return make(
|
|
102
|
+
return make(primitiveNode("Iso", get, set))
|
|
106
103
|
}
|
|
107
104
|
|
|
108
105
|
/**
|
|
@@ -123,22 +120,21 @@ export function makeIso<S, A>(get: (s: S) => A, set: (a: A) => S): Iso<S, A> {
|
|
|
123
120
|
*
|
|
124
121
|
* **Example** (Focusing on a struct field)
|
|
125
122
|
*
|
|
126
|
-
* ```ts
|
|
123
|
+
* ```ts import.meta.vitest
|
|
127
124
|
* import { Optic } from "effect"
|
|
128
125
|
*
|
|
129
126
|
* type Person = { readonly name: string; readonly age: number }
|
|
130
127
|
*
|
|
131
128
|
* const _name = Optic.id<Person>().key("name")
|
|
132
129
|
*
|
|
133
|
-
*
|
|
134
|
-
* // Output: "Alice"
|
|
130
|
+
* _name.get({ name: "Alice", age: 30 }) // => "Alice"
|
|
135
131
|
* ```
|
|
136
132
|
*
|
|
137
133
|
* @see {@link makeLens} — constructor
|
|
138
134
|
* @see {@link Iso} — when conversion is lossless in both directions
|
|
139
135
|
* @see {@link Optional} — when reading can also fail
|
|
140
136
|
*
|
|
141
|
-
* @category
|
|
137
|
+
* @category models
|
|
142
138
|
* @since 4.0.0
|
|
143
139
|
*/
|
|
144
140
|
export interface Lens<in out S, in out A> extends Optional<S, A> {
|
|
@@ -160,7 +156,7 @@ export interface Lens<in out S, in out A> extends Optional<S, A> {
|
|
|
160
156
|
*
|
|
161
157
|
* **Example** (Focusing on the first element of a pair)
|
|
162
158
|
*
|
|
163
|
-
* ```ts
|
|
159
|
+
* ```ts import.meta.vitest
|
|
164
160
|
* import { Optic } from "effect"
|
|
165
161
|
*
|
|
166
162
|
* const _first = Optic.makeLens<readonly [string, number], string>(
|
|
@@ -168,11 +164,9 @@ export interface Lens<in out S, in out A> extends Optional<S, A> {
|
|
|
168
164
|
* (s, pair) => [s, pair[1]]
|
|
169
165
|
* )
|
|
170
166
|
*
|
|
171
|
-
*
|
|
172
|
-
* // Output: "hello"
|
|
167
|
+
* _first.get(["hello", 42]) // => "hello"
|
|
173
168
|
*
|
|
174
|
-
*
|
|
175
|
-
* // Output: ["world", 42]
|
|
169
|
+
* _first.replace("world", ["hello", 42]) // => ["world", 42]
|
|
176
170
|
* ```
|
|
177
171
|
*
|
|
178
172
|
* @see {@link Lens} — the type this function returns
|
|
@@ -182,7 +176,7 @@ export interface Lens<in out S, in out A> extends Optional<S, A> {
|
|
|
182
176
|
* @since 4.0.0
|
|
183
177
|
*/
|
|
184
178
|
export function makeLens<S, A>(get: (s: S) => A, replace: (a: A, s: S) => S): Lens<S, A> {
|
|
185
|
-
return make(
|
|
179
|
+
return make(primitiveNode("Lens", get, replace))
|
|
186
180
|
}
|
|
187
181
|
|
|
188
182
|
/**
|
|
@@ -206,7 +200,7 @@ export function makeLens<S, A>(get: (s: S) => A, replace: (a: A, s: S) => S): Le
|
|
|
206
200
|
*
|
|
207
201
|
* **Example** (Narrowing a tagged union)
|
|
208
202
|
*
|
|
209
|
-
* ```ts
|
|
203
|
+
* ```ts import.meta.vitest
|
|
210
204
|
* import { Optic, Result } from "effect"
|
|
211
205
|
*
|
|
212
206
|
* type Shape =
|
|
@@ -215,18 +209,16 @@ export function makeLens<S, A>(get: (s: S) => A, replace: (a: A, s: S) => S): Le
|
|
|
215
209
|
*
|
|
216
210
|
* const _circle = Optic.id<Shape>().tag("Circle")
|
|
217
211
|
*
|
|
218
|
-
*
|
|
219
|
-
* // Output: true
|
|
212
|
+
* _circle.getResult({ _tag: "Circle", radius: 5 }) // => Result.succeed({ _tag: "Circle", radius: 5 })
|
|
220
213
|
*
|
|
221
|
-
*
|
|
222
|
-
* // Output: true
|
|
214
|
+
* Result.isFailure(_circle.getResult({ _tag: "Rect", width: 10 })) // => true
|
|
223
215
|
* ```
|
|
224
216
|
*
|
|
225
217
|
* @see {@link makePrism} — constructor
|
|
226
218
|
* @see {@link fromChecks} — build a Prism from schema checks
|
|
227
219
|
* @see {@link Lens} — when reading always succeeds
|
|
228
220
|
*
|
|
229
|
-
* @category
|
|
221
|
+
* @category models
|
|
230
222
|
* @since 4.0.0
|
|
231
223
|
*/
|
|
232
224
|
export interface Prism<in out S, in out A> extends Optional<S, A> {
|
|
@@ -247,7 +239,7 @@ export interface Prism<in out S, in out A> extends Optional<S, A> {
|
|
|
247
239
|
*
|
|
248
240
|
* **Example** (Parsing a string to a number)
|
|
249
241
|
*
|
|
250
|
-
* ```ts
|
|
242
|
+
* ```ts import.meta.vitest
|
|
251
243
|
* import { Optic, Result } from "effect"
|
|
252
244
|
*
|
|
253
245
|
* const numeric = Optic.makePrism<string, number>(
|
|
@@ -258,11 +250,9 @@ export interface Prism<in out S, in out A> extends Optional<S, A> {
|
|
|
258
250
|
* String
|
|
259
251
|
* )
|
|
260
252
|
*
|
|
261
|
-
*
|
|
262
|
-
* // Output: true
|
|
253
|
+
* numeric.getResult("42") // => Result.succeed(42)
|
|
263
254
|
*
|
|
264
|
-
*
|
|
265
|
-
* // Output: "42"
|
|
255
|
+
* numeric.set(42) // => "42"
|
|
266
256
|
* ```
|
|
267
257
|
*
|
|
268
258
|
* @see {@link Prism} — the type this function returns
|
|
@@ -272,7 +262,7 @@ export interface Prism<in out S, in out A> extends Optional<S, A> {
|
|
|
272
262
|
* @since 4.0.0
|
|
273
263
|
*/
|
|
274
264
|
export function makePrism<S, A>(getResult: (s: S) => Result.Result<A, string>, set: (a: A) => S): Prism<S, A> {
|
|
275
|
-
return make(
|
|
265
|
+
return make(primitiveNode("Prism", getResult, set))
|
|
276
266
|
}
|
|
277
267
|
|
|
278
268
|
/**
|
|
@@ -292,7 +282,7 @@ export function makePrism<S, A>(getResult: (s: S) => Result.Result<A, string>, s
|
|
|
292
282
|
*
|
|
293
283
|
* **Example** (Creating a positive integer prism)
|
|
294
284
|
*
|
|
295
|
-
* ```ts
|
|
285
|
+
* ```ts import.meta.vitest
|
|
296
286
|
* import { Optic, Result, Schema } from "effect"
|
|
297
287
|
*
|
|
298
288
|
* const posInt = Optic.fromChecks<number>(
|
|
@@ -300,11 +290,9 @@ export function makePrism<S, A>(getResult: (s: S) => Result.Result<A, string>, s
|
|
|
300
290
|
* Schema.isInt()
|
|
301
291
|
* )
|
|
302
292
|
*
|
|
303
|
-
*
|
|
304
|
-
* // Output: true
|
|
293
|
+
* posInt.getResult(3) // => Result.succeed(3)
|
|
305
294
|
*
|
|
306
|
-
*
|
|
307
|
-
* // Output: true
|
|
295
|
+
* Result.isFailure(posInt.getResult(-1)) // => true
|
|
308
296
|
* ```
|
|
309
297
|
*
|
|
310
298
|
* @see {@link makePrism} — constructor with custom getter/setter
|
|
@@ -314,142 +302,95 @@ export function makePrism<S, A>(getResult: (s: S) => Result.Result<A, string>, s
|
|
|
314
302
|
* @since 4.0.0
|
|
315
303
|
*/
|
|
316
304
|
export function fromChecks<T>(...checks: readonly [SchemaAST.Check<T>, ...Array<SchemaAST.Check<T>>]): Prism<T, T> {
|
|
317
|
-
return make(new CheckNode(checks))
|
|
305
|
+
return make([new CheckNode(checks)])
|
|
318
306
|
}
|
|
319
307
|
|
|
320
|
-
type
|
|
321
|
-
| IdentityNode
|
|
322
|
-
| IsoNode<any, any>
|
|
323
|
-
| LensNode<any, any>
|
|
324
|
-
| PrismNode<any, any>
|
|
325
|
-
| OptionalNode<any, any>
|
|
326
|
-
| PathNode
|
|
327
|
-
| CheckNode<any>
|
|
328
|
-
| CompositionNode
|
|
308
|
+
type Kind = "Iso" | "Lens" | "Prism" | "Optional"
|
|
329
309
|
|
|
330
|
-
|
|
331
|
-
readonly
|
|
310
|
+
type Operation = {
|
|
311
|
+
readonly kind: Kind
|
|
312
|
+
readonly get: (s: any) => any
|
|
313
|
+
readonly set: (a: any, s?: any) => any
|
|
332
314
|
}
|
|
333
315
|
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
class CompositionNode {
|
|
337
|
-
readonly _tag = "CompositionNode"
|
|
338
|
-
readonly nodes: readonly [Node, ...Array<Node>]
|
|
339
|
-
|
|
340
|
-
constructor(nodes: readonly [Node, ...Array<Node>]) {
|
|
341
|
-
this.nodes = nodes
|
|
342
|
-
}
|
|
316
|
+
type PrimitiveStep = Operation & {
|
|
317
|
+
readonly _tag: "PrimitiveNode"
|
|
343
318
|
}
|
|
344
319
|
|
|
345
|
-
|
|
346
|
-
readonly _tag = "IsoNode"
|
|
347
|
-
readonly get: (s: S) => A
|
|
348
|
-
readonly set: (a: A) => S
|
|
349
|
-
|
|
350
|
-
constructor(get: (s: S) => A, set: (a: A) => S) {
|
|
351
|
-
this.get = get
|
|
352
|
-
this.set = set
|
|
353
|
-
}
|
|
354
|
-
}
|
|
320
|
+
type Step = PrimitiveStep | PathNode | CheckNode<any>
|
|
355
321
|
|
|
356
|
-
|
|
357
|
-
readonly _tag = "LensNode"
|
|
358
|
-
readonly get: (s: S) => A
|
|
359
|
-
readonly set: (a: A, s: S) => S
|
|
322
|
+
type Node = ReadonlyArray<Step>
|
|
360
323
|
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
this.set = set
|
|
364
|
-
}
|
|
324
|
+
function primitiveNode(kind: Kind, get: (s: any) => any, set: (a: any, s?: any) => any): Node {
|
|
325
|
+
return [{ _tag: "PrimitiveNode", kind, get, set }]
|
|
365
326
|
}
|
|
366
327
|
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
constructor(get: (s: S) => Result.Result<A, string>, set: (a: A) => S) {
|
|
373
|
-
this.get = get
|
|
374
|
-
this.set = set
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
|
|
378
|
-
class OptionalNode<S, A> {
|
|
379
|
-
readonly _tag = "OptionalNode"
|
|
380
|
-
readonly get: (s: S) => Result.Result<A, string>
|
|
381
|
-
readonly set: (a: A, s: S) => Result.Result<S, string>
|
|
382
|
-
|
|
383
|
-
constructor(get: (s: S) => Result.Result<A, string>, set: (a: A, s: S) => Result.Result<S, string>) {
|
|
384
|
-
this.get = get
|
|
385
|
-
this.set = set
|
|
386
|
-
}
|
|
328
|
+
const identityOperation: Operation = {
|
|
329
|
+
kind: "Iso",
|
|
330
|
+
get: identity,
|
|
331
|
+
set: identity
|
|
387
332
|
}
|
|
388
333
|
|
|
389
334
|
class PathNode {
|
|
390
335
|
readonly _tag = "PathNode"
|
|
336
|
+
readonly kind = "Lens"
|
|
391
337
|
readonly path: ReadonlyArray<PropertyKey>
|
|
338
|
+
readonly get: (s: any) => any
|
|
339
|
+
readonly set: (a: any, s?: any) => any
|
|
392
340
|
|
|
393
341
|
constructor(path: ReadonlyArray<PropertyKey>) {
|
|
394
342
|
this.path = path
|
|
343
|
+
this.get = (s) => {
|
|
344
|
+
let out = s
|
|
345
|
+
for (let i = 0; i < path.length; i++) {
|
|
346
|
+
out = out[path[i]]
|
|
347
|
+
}
|
|
348
|
+
return out
|
|
349
|
+
}
|
|
350
|
+
this.set = (a, s) => {
|
|
351
|
+
const out = cloneShallow(s)
|
|
352
|
+
let current = out
|
|
353
|
+
let i = 0
|
|
354
|
+
for (; i < path.length - 1; i++) {
|
|
355
|
+
const key = path[i]
|
|
356
|
+
InternalRecord.assignProperty(current, key, cloneShallow(current[key]))
|
|
357
|
+
current = current[key]
|
|
358
|
+
}
|
|
359
|
+
InternalRecord.assignProperty(current, path[i], a)
|
|
360
|
+
return out
|
|
361
|
+
}
|
|
395
362
|
}
|
|
396
363
|
}
|
|
397
364
|
|
|
398
365
|
class CheckNode<T> {
|
|
399
366
|
readonly _tag = "CheckNode"
|
|
367
|
+
readonly kind = "Prism"
|
|
400
368
|
readonly checks: readonly [SchemaAST.Check<T>, ...Array<SchemaAST.Check<T>>]
|
|
369
|
+
readonly get: (s: T) => Result.Result<T, string>
|
|
370
|
+
readonly set = identity
|
|
401
371
|
|
|
402
372
|
constructor(checks: readonly [SchemaAST.Check<T>, ...Array<SchemaAST.Check<T>>]) {
|
|
403
373
|
this.checks = checks
|
|
374
|
+
this.get = (s) => Result.mapError(SchemaAST.runChecks(checks, s), String)
|
|
404
375
|
}
|
|
405
376
|
}
|
|
406
377
|
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
378
|
+
function compose(a: Node, b: Node): Node {
|
|
379
|
+
if (a.length === 0) return b
|
|
380
|
+
if (b.length === 0) return a
|
|
381
|
+
const nodes = a.slice()
|
|
382
|
+
for (let i = 0; i < b.length; i++) {
|
|
383
|
+
const node = b[i]
|
|
384
|
+
const last = nodes[nodes.length - 1]
|
|
414
385
|
if (last._tag === "PathNode" && node._tag === "PathNode") {
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
// fuse Checks
|
|
421
|
-
acc[acc.length - 1] = new CheckNode<any>([...last.checks, ...node.checks])
|
|
422
|
-
return
|
|
386
|
+
nodes[nodes.length - 1] = new PathNode([...last.path, ...node.path])
|
|
387
|
+
} else if (last._tag === "CheckNode" && node._tag === "CheckNode") {
|
|
388
|
+
nodes[nodes.length - 1] = new CheckNode<any>([...last.checks, ...node.checks])
|
|
389
|
+
} else {
|
|
390
|
+
nodes.push(node)
|
|
423
391
|
}
|
|
424
392
|
}
|
|
425
|
-
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
// Collect nodes from a node into `acc`, flattening & normalizing on the fly.
|
|
429
|
-
function collect(node: Node, acc: Array<NormalizedNode>): void {
|
|
430
|
-
if (node._tag === "IdentityNode") return
|
|
431
|
-
if (node._tag === "CompositionNode") {
|
|
432
|
-
// flatten without extra arrays
|
|
433
|
-
for (let i = 0; i < node.nodes.length; i++) collect(node.nodes[i], acc)
|
|
434
|
-
return
|
|
435
|
-
}
|
|
436
|
-
// primitive node
|
|
437
|
-
pushNormalized(acc, node)
|
|
438
|
-
}
|
|
439
|
-
|
|
440
|
-
function compose(a: Node, b: Node): Node {
|
|
441
|
-
const nodes: Array<NormalizedNode> = []
|
|
442
|
-
collect(a, nodes)
|
|
443
|
-
collect(b, nodes)
|
|
444
|
-
|
|
445
|
-
switch (nodes.length) {
|
|
446
|
-
case 0:
|
|
447
|
-
return identityNode
|
|
448
|
-
case 1:
|
|
449
|
-
return nodes[0]
|
|
450
|
-
default:
|
|
451
|
-
return new CompositionNode(nodes as [Node, ...Array<Node>])
|
|
452
|
-
}
|
|
393
|
+
return nodes
|
|
453
394
|
}
|
|
454
395
|
|
|
455
396
|
type ForbidUnion<A, Message extends string> = IsUnion<A> extends true ? [Message] : []
|
|
@@ -475,32 +416,28 @@ type ForbidUnion<A, Message extends string> = IsUnion<A> extends true ? [Message
|
|
|
475
416
|
*
|
|
476
417
|
* **Example** (Focusing on an optional record key)
|
|
477
418
|
*
|
|
478
|
-
* ```ts
|
|
419
|
+
* ```ts import.meta.vitest
|
|
479
420
|
* import { Optic, Result } from "effect"
|
|
480
421
|
*
|
|
481
422
|
* type Env = { [key: string]: string }
|
|
482
423
|
* const _home = Optic.id<Env>().at("HOME")
|
|
483
424
|
*
|
|
484
|
-
*
|
|
485
|
-
* // Output: true
|
|
425
|
+
* _home.getResult({ HOME: "/root" }) // => Result.succeed("/root")
|
|
486
426
|
*
|
|
487
|
-
*
|
|
488
|
-
* // Output: true
|
|
427
|
+
* Result.isFailure(_home.getResult({ PATH: "/bin" })) // => true
|
|
489
428
|
*
|
|
490
429
|
* // replace returns original on failure
|
|
491
|
-
*
|
|
492
|
-
* // Output: { PATH: "/bin" }
|
|
430
|
+
* _home.replace("/new", { PATH: "/bin" }) // => { PATH: "/bin" }
|
|
493
431
|
* ```
|
|
494
432
|
*
|
|
495
433
|
* @see {@link makeOptional} — constructor
|
|
496
434
|
* @see {@link Lens} — when reading always succeeds
|
|
497
435
|
* @see {@link Prism} — when writing always succeeds
|
|
498
436
|
*
|
|
499
|
-
* @category
|
|
437
|
+
* @category models
|
|
500
438
|
* @since 4.0.0
|
|
501
439
|
*/
|
|
502
440
|
export interface Optional<in out S, in out A> {
|
|
503
|
-
readonly node: Node
|
|
504
441
|
/**
|
|
505
442
|
* Attempts to read the focus `A` from the whole `S`. Returns
|
|
506
443
|
* `Result.Success<A>` when the focus exists, or
|
|
@@ -523,13 +460,14 @@ export interface Optional<in out S, in out A> {
|
|
|
523
460
|
*
|
|
524
461
|
* **Example** (Composing a lens with a prism)
|
|
525
462
|
*
|
|
526
|
-
* ```ts
|
|
527
|
-
* import { Optic, Option } from "effect"
|
|
463
|
+
* ```ts import.meta.vitest
|
|
464
|
+
* import { Optic, Option, Result } from "effect"
|
|
528
465
|
*
|
|
529
466
|
* type State = { value: Option.Option<number> }
|
|
530
467
|
*
|
|
531
468
|
* const _inner = Optic.id<State>().key("value").compose(Optic.some())
|
|
532
469
|
* // _inner is Optional<State, number>
|
|
470
|
+
* _inner.getResult({ value: Option.some(1) }) // => Result.succeed(1)
|
|
533
471
|
* ```
|
|
534
472
|
*
|
|
535
473
|
* @see {@link id} — start a composition chain
|
|
@@ -545,15 +483,14 @@ export interface Optional<in out S, in out A> {
|
|
|
545
483
|
*
|
|
546
484
|
* **Example** (Incrementing a nested field)
|
|
547
485
|
*
|
|
548
|
-
* ```ts
|
|
486
|
+
* ```ts import.meta.vitest
|
|
549
487
|
* import { Optic } from "effect"
|
|
550
488
|
*
|
|
551
489
|
* type S = { readonly a: { readonly b: number } }
|
|
552
490
|
* const _b = Optic.id<S>().key("a").key("b")
|
|
553
491
|
*
|
|
554
492
|
* const inc = _b.modify((n) => n + 1)
|
|
555
|
-
*
|
|
556
|
-
* // Output: { a: { b: 2 } }
|
|
493
|
+
* inc({ a: { b: 1 } }) // => { a: { b: 2 } }
|
|
557
494
|
* ```
|
|
558
495
|
*/
|
|
559
496
|
modify(f: (a: A) => A): (s: S) => S
|
|
@@ -569,14 +506,13 @@ export interface Optional<in out S, in out A> {
|
|
|
569
506
|
*
|
|
570
507
|
* **Example** (Drilling into nested structs)
|
|
571
508
|
*
|
|
572
|
-
* ```ts
|
|
509
|
+
* ```ts import.meta.vitest
|
|
573
510
|
* import { Optic } from "effect"
|
|
574
511
|
*
|
|
575
512
|
* type S = { readonly a: { readonly b: number } }
|
|
576
513
|
* const _b = Optic.id<S>().key("a").key("b")
|
|
577
514
|
*
|
|
578
|
-
*
|
|
579
|
-
* // Output: 42
|
|
515
|
+
* _b.get({ a: { b: 42 } }) // => 42
|
|
580
516
|
* ```
|
|
581
517
|
*/
|
|
582
518
|
key<S, A extends object, Key extends keyof A>(
|
|
@@ -601,17 +537,15 @@ export interface Optional<in out S, in out A> {
|
|
|
601
537
|
*
|
|
602
538
|
* **Example** (Deleting an optional key)
|
|
603
539
|
*
|
|
604
|
-
* ```ts
|
|
540
|
+
* ```ts import.meta.vitest
|
|
605
541
|
* import { Optic } from "effect"
|
|
606
542
|
*
|
|
607
543
|
* type S = { readonly a?: number }
|
|
608
544
|
* const _a = Optic.id<S>().optionalKey("a")
|
|
609
545
|
*
|
|
610
|
-
*
|
|
611
|
-
* // Output: {}
|
|
546
|
+
* _a.replace(undefined, { a: 1 }) // => {}
|
|
612
547
|
*
|
|
613
|
-
*
|
|
614
|
-
* // Output: { a: 2 }
|
|
548
|
+
* _a.replace(2, {}) // => { a: 2 }
|
|
615
549
|
* ```
|
|
616
550
|
*/
|
|
617
551
|
optionalKey<S, A extends object, Key extends keyof A>(
|
|
@@ -636,16 +570,14 @@ export interface Optional<in out S, in out A> {
|
|
|
636
570
|
*
|
|
637
571
|
* **Example** (Focusing only on positive numbers)
|
|
638
572
|
*
|
|
639
|
-
* ```ts
|
|
573
|
+
* ```ts import.meta.vitest
|
|
640
574
|
* import { Optic, Result, Schema } from "effect"
|
|
641
575
|
*
|
|
642
576
|
* const _pos = Optic.id<number>().check(Schema.isGreaterThan(0))
|
|
643
577
|
*
|
|
644
|
-
*
|
|
645
|
-
* // Output: true
|
|
578
|
+
* _pos.getResult(5) // => Result.succeed(5)
|
|
646
579
|
*
|
|
647
|
-
*
|
|
648
|
-
* // Output: true
|
|
580
|
+
* Result.isFailure(_pos.getResult(-1)) // => true
|
|
649
581
|
* ```
|
|
650
582
|
*
|
|
651
583
|
* @see {@link fromChecks} — standalone prism from checks
|
|
@@ -667,7 +599,7 @@ export interface Optional<in out S, in out A> {
|
|
|
667
599
|
*
|
|
668
600
|
* **Example** (Narrowing a union)
|
|
669
601
|
*
|
|
670
|
-
* ```ts
|
|
602
|
+
* ```ts import.meta.vitest
|
|
671
603
|
* import { Optic, Result } from "effect"
|
|
672
604
|
*
|
|
673
605
|
* type B = { readonly _tag: "b"; readonly b: number }
|
|
@@ -678,8 +610,7 @@ export interface Optional<in out S, in out A> {
|
|
|
678
610
|
* { expected: `"b" tag` }
|
|
679
611
|
* )
|
|
680
612
|
*
|
|
681
|
-
*
|
|
682
|
-
* // Output: true
|
|
613
|
+
* _b.getResult({ _tag: "b", b: 1 }) // => Result.succeed({ _tag: "b", b: 1 })
|
|
683
614
|
* ```
|
|
684
615
|
*
|
|
685
616
|
* @see `.tag()` — shorthand for narrowing by `_tag`
|
|
@@ -707,7 +638,7 @@ export interface Optional<in out S, in out A> {
|
|
|
707
638
|
*
|
|
708
639
|
* **Example** (Focusing a tagged variant)
|
|
709
640
|
*
|
|
710
|
-
* ```ts
|
|
641
|
+
* ```ts import.meta.vitest
|
|
711
642
|
* import { Optic, Result } from "effect"
|
|
712
643
|
*
|
|
713
644
|
* type Shape =
|
|
@@ -716,11 +647,9 @@ export interface Optional<in out S, in out A> {
|
|
|
716
647
|
*
|
|
717
648
|
* const _radius = Optic.id<Shape>().tag("Circle").key("radius")
|
|
718
649
|
*
|
|
719
|
-
*
|
|
720
|
-
* // Output: true
|
|
650
|
+
* _radius.getResult({ _tag: "Circle", radius: 5 }) // => Result.succeed(5)
|
|
721
651
|
*
|
|
722
|
-
*
|
|
723
|
-
* // Output: true
|
|
652
|
+
* Result.isFailure(_radius.getResult({ _tag: "Rect", width: 10 })) // => true
|
|
724
653
|
* ```
|
|
725
654
|
*
|
|
726
655
|
* @see `.refine()` — for arbitrary type guards
|
|
@@ -748,17 +677,15 @@ export interface Optional<in out S, in out A> {
|
|
|
748
677
|
*
|
|
749
678
|
* **Example** (Accessing records safely)
|
|
750
679
|
*
|
|
751
|
-
* ```ts
|
|
680
|
+
* ```ts import.meta.vitest
|
|
752
681
|
* import { Optic, Result } from "effect"
|
|
753
682
|
*
|
|
754
683
|
* type Env = { [key: string]: number }
|
|
755
684
|
* const _x = Optic.id<Env>().at("x")
|
|
756
685
|
*
|
|
757
|
-
*
|
|
758
|
-
* // Output: true
|
|
686
|
+
* _x.getResult({ x: 1 }) // => Result.succeed(1)
|
|
759
687
|
*
|
|
760
|
-
*
|
|
761
|
-
* // Output: true
|
|
688
|
+
* Result.isFailure(_x.getResult({ y: 2 })) // => true
|
|
762
689
|
* ```
|
|
763
690
|
*
|
|
764
691
|
* @see `.key()` — when the key is always present
|
|
@@ -780,15 +707,14 @@ export interface Optional<in out S, in out A> {
|
|
|
780
707
|
*
|
|
781
708
|
* **Example** (Picking keys)
|
|
782
709
|
*
|
|
783
|
-
* ```ts
|
|
710
|
+
* ```ts import.meta.vitest
|
|
784
711
|
* import { Optic } from "effect"
|
|
785
712
|
*
|
|
786
713
|
* type S = { readonly a: string; readonly b: number; readonly c: boolean }
|
|
787
714
|
*
|
|
788
715
|
* const _ac = Optic.id<S>().pick(["a", "c"])
|
|
789
716
|
*
|
|
790
|
-
*
|
|
791
|
-
* // Output: { a: "hi", c: true }
|
|
717
|
+
* _ac.get({ a: "hi", b: 1, c: true }) // => { a: "hi", c: true }
|
|
792
718
|
* ```
|
|
793
719
|
*
|
|
794
720
|
* @see `.omit()` — the inverse operation
|
|
@@ -815,15 +741,14 @@ export interface Optional<in out S, in out A> {
|
|
|
815
741
|
*
|
|
816
742
|
* **Example** (Omitting keys)
|
|
817
743
|
*
|
|
818
|
-
* ```ts
|
|
744
|
+
* ```ts import.meta.vitest
|
|
819
745
|
* import { Optic } from "effect"
|
|
820
746
|
*
|
|
821
747
|
* type S = { readonly a: string; readonly b: number; readonly c: boolean }
|
|
822
748
|
*
|
|
823
749
|
* const _ac = Optic.id<S>().omit(["b"])
|
|
824
750
|
*
|
|
825
|
-
*
|
|
826
|
-
* // Output: { a: "hi", c: true }
|
|
751
|
+
* _ac.get({ a: "hi", b: 1, c: true }) // => { a: "hi", c: true }
|
|
827
752
|
* ```
|
|
828
753
|
*
|
|
829
754
|
* @see `.pick()` — the inverse operation
|
|
@@ -847,22 +772,20 @@ export interface Optional<in out S, in out A> {
|
|
|
847
772
|
*
|
|
848
773
|
* **Example** (Filtering undefined values)
|
|
849
774
|
*
|
|
850
|
-
* ```ts
|
|
775
|
+
* ```ts import.meta.vitest
|
|
851
776
|
* import { Optic, Result } from "effect"
|
|
852
777
|
*
|
|
853
778
|
* const _defined = Optic.id<number | undefined>().notUndefined()
|
|
854
779
|
*
|
|
855
|
-
*
|
|
856
|
-
* // Output: true
|
|
780
|
+
* _defined.getResult(42) // => Result.succeed(42)
|
|
857
781
|
*
|
|
858
|
-
*
|
|
859
|
-
* // Output: true
|
|
782
|
+
* Result.isFailure(_defined.getResult(undefined)) // => true
|
|
860
783
|
* ```
|
|
861
784
|
*
|
|
862
785
|
* @since 4.0.0
|
|
863
786
|
*/
|
|
864
|
-
notUndefined(): Prism<S, Exclude<A, undefined>>
|
|
865
|
-
notUndefined(): Optional<S, Exclude<A, undefined>>
|
|
787
|
+
notUndefined<S, A>(this: Prism<S, A>): Prism<S, Exclude<A, undefined>>
|
|
788
|
+
notUndefined<S, A>(this: Optional<S, A>): Optional<S, Exclude<A, undefined>>
|
|
866
789
|
|
|
867
790
|
/**
|
|
868
791
|
* Focuses **all elements** of an array-like focus and optionally narrows
|
|
@@ -881,7 +804,7 @@ export interface Optional<in out S, in out A> {
|
|
|
881
804
|
*
|
|
882
805
|
* **Example** (Incrementing liked posts)
|
|
883
806
|
*
|
|
884
|
-
* ```ts
|
|
807
|
+
* ```ts import.meta.vitest
|
|
885
808
|
* import { Optic, Schema } from "effect"
|
|
886
809
|
*
|
|
887
810
|
* type Post = { title: string; likes: number }
|
|
@@ -894,12 +817,10 @@ export interface Optional<in out S, in out A> {
|
|
|
894
817
|
*
|
|
895
818
|
* const addLike = _likes.modifyAll((n) => n + 1)
|
|
896
819
|
*
|
|
897
|
-
*
|
|
898
|
-
*
|
|
899
|
-
*
|
|
900
|
-
*
|
|
901
|
-
* )
|
|
902
|
-
* // Output: { user: { posts: [{ title: "a", likes: 0 }, { title: "b", likes: 2 }] } }
|
|
820
|
+
* const result = addLike({
|
|
821
|
+
* user: { posts: [{ title: "a", likes: 0 }, { title: "b", likes: 1 }] }
|
|
822
|
+
* })
|
|
823
|
+
* result.user.posts // => [{ title: "a", likes: 0 }, { title: "b", likes: 2 }]
|
|
903
824
|
* ```
|
|
904
825
|
*
|
|
905
826
|
* @see {@link getAll} — extract all focused elements as an array
|
|
@@ -920,7 +841,7 @@ export interface Optional<in out S, in out A> {
|
|
|
920
841
|
*
|
|
921
842
|
* **Example** (Doubling all focused values)
|
|
922
843
|
*
|
|
923
|
-
* ```ts
|
|
844
|
+
* ```ts import.meta.vitest
|
|
924
845
|
* import { Optic, Schema } from "effect"
|
|
925
846
|
*
|
|
926
847
|
* type S = { readonly items: ReadonlyArray<number> }
|
|
@@ -931,8 +852,7 @@ export interface Optional<in out S, in out A> {
|
|
|
931
852
|
*
|
|
932
853
|
* const doubled = _positive.modifyAll((n) => n * 2)
|
|
933
854
|
*
|
|
934
|
-
*
|
|
935
|
-
* // Output: { items: [2, -2, 6] }
|
|
855
|
+
* doubled({ items: [1, -2, 3] }) // => { items: [2, -2, 6] }
|
|
936
856
|
* ```
|
|
937
857
|
*
|
|
938
858
|
* @see `.forEach()` — create a sub-traversal
|
|
@@ -957,7 +877,7 @@ export interface Optional<in out S, in out A> {
|
|
|
957
877
|
*
|
|
958
878
|
* **Example** (Accessing record keys safely)
|
|
959
879
|
*
|
|
960
|
-
* ```ts
|
|
880
|
+
* ```ts import.meta.vitest
|
|
961
881
|
* import { Optic, Result } from "effect"
|
|
962
882
|
*
|
|
963
883
|
* const atKey = (key: string) =>
|
|
@@ -972,8 +892,7 @@ export interface Optional<in out S, in out A> {
|
|
|
972
892
|
* : Result.fail(`Key "${key}" not found`)
|
|
973
893
|
* )
|
|
974
894
|
*
|
|
975
|
-
*
|
|
976
|
-
* // Output: true
|
|
895
|
+
* atKey("x").getResult({ x: 1 }) // => Result.succeed(1)
|
|
977
896
|
* ```
|
|
978
897
|
*
|
|
979
898
|
* @see {@link Optional} — the type this function returns
|
|
@@ -987,7 +906,7 @@ export function makeOptional<S, A>(
|
|
|
987
906
|
getResult: (s: S) => Result.Result<A, string>,
|
|
988
907
|
set: (a: A, s: S) => Result.Result<S, string>
|
|
989
908
|
): Optional<S, A> {
|
|
990
|
-
return make(
|
|
909
|
+
return make(primitiveNode("Optional", getResult, set))
|
|
991
910
|
}
|
|
992
911
|
|
|
993
912
|
/**
|
|
@@ -1009,7 +928,7 @@ export function makeOptional<S, A>(
|
|
|
1009
928
|
*
|
|
1010
929
|
* **Example** (Traversing array elements with a filter)
|
|
1011
930
|
*
|
|
1012
|
-
* ```ts
|
|
931
|
+
* ```ts import.meta.vitest
|
|
1013
932
|
* import { Optic, Schema } from "effect"
|
|
1014
933
|
*
|
|
1015
934
|
* type S = { readonly items: ReadonlyArray<number> }
|
|
@@ -1020,19 +939,19 @@ export function makeOptional<S, A>(
|
|
|
1020
939
|
*
|
|
1021
940
|
* const getPositive = Optic.getAll(_positive)
|
|
1022
941
|
*
|
|
1023
|
-
*
|
|
1024
|
-
* // Output: [1, 3]
|
|
942
|
+
* getPositive({ items: [1, -2, 3] }) // => [1, 3]
|
|
1025
943
|
* ```
|
|
1026
944
|
*
|
|
1027
945
|
* @see {@link getAll} — extract focused elements
|
|
1028
946
|
* @see {@link Optional} — the base type
|
|
1029
947
|
*
|
|
1030
|
-
* @category
|
|
948
|
+
* @category models
|
|
1031
949
|
* @since 4.0.0
|
|
1032
950
|
*/
|
|
1033
951
|
export interface Traversal<in out S, in out A> extends Optional<S, ReadonlyArray<A>> {}
|
|
1034
952
|
|
|
1035
953
|
class OptionalImpl<S, A> implements Optional<S, A> {
|
|
954
|
+
/** @internal */
|
|
1036
955
|
readonly node: Node
|
|
1037
956
|
readonly getResult: (s: S) => Result.Result<A, string>
|
|
1038
957
|
readonly replaceResult: (a: A, s: S) => Result.Result<S, string>
|
|
@@ -1055,13 +974,14 @@ class OptionalImpl<S, A> implements Optional<S, A> {
|
|
|
1055
974
|
return make(compose(this.node, that.node))
|
|
1056
975
|
}
|
|
1057
976
|
key(key: PropertyKey): any {
|
|
1058
|
-
return make(compose(this.node, new PathNode([key])))
|
|
977
|
+
return make(compose(this.node, [new PathNode([key])]))
|
|
1059
978
|
}
|
|
1060
979
|
optionalKey(key: PropertyKey): any {
|
|
1061
980
|
return make(
|
|
1062
981
|
compose(
|
|
1063
982
|
this.node,
|
|
1064
|
-
|
|
983
|
+
primitiveNode(
|
|
984
|
+
"Lens",
|
|
1065
985
|
(s) => s[key],
|
|
1066
986
|
(a, s) => {
|
|
1067
987
|
const copy = cloneShallow(s)
|
|
@@ -1072,7 +992,7 @@ class OptionalImpl<S, A> implements Optional<S, A> {
|
|
|
1072
992
|
delete copy[key]
|
|
1073
993
|
}
|
|
1074
994
|
} else {
|
|
1075
|
-
copy
|
|
995
|
+
InternalRecord.assignProperty(copy, key, a)
|
|
1076
996
|
}
|
|
1077
997
|
return copy
|
|
1078
998
|
}
|
|
@@ -1081,16 +1001,17 @@ class OptionalImpl<S, A> implements Optional<S, A> {
|
|
|
1081
1001
|
)
|
|
1082
1002
|
}
|
|
1083
1003
|
check(...checks: readonly [SchemaAST.Check<any>, ...Array<SchemaAST.Check<any>>]): any {
|
|
1084
|
-
return make(compose(this.node, new CheckNode(checks)))
|
|
1004
|
+
return make(compose(this.node, [new CheckNode(checks)]))
|
|
1085
1005
|
}
|
|
1086
1006
|
refine<B extends A>(refinement: (a: A) => a is B, annotations?: Schema.Annotations.Filter): any {
|
|
1087
|
-
return make(compose(this.node, new CheckNode([SchemaAST.makeFilterByGuard(refinement, annotations)])))
|
|
1007
|
+
return make(compose(this.node, [new CheckNode([SchemaAST.makeFilterByGuard(refinement, annotations)])]))
|
|
1088
1008
|
}
|
|
1089
1009
|
tag(tag: string): any {
|
|
1090
1010
|
return make(
|
|
1091
1011
|
compose(
|
|
1092
1012
|
this.node,
|
|
1093
|
-
|
|
1013
|
+
primitiveNode(
|
|
1014
|
+
"Prism",
|
|
1094
1015
|
(s) =>
|
|
1095
1016
|
s._tag === tag
|
|
1096
1017
|
? Result.succeed(s)
|
|
@@ -1105,12 +1026,13 @@ class OptionalImpl<S, A> implements Optional<S, A> {
|
|
|
1105
1026
|
return make(
|
|
1106
1027
|
compose(
|
|
1107
1028
|
this.node,
|
|
1108
|
-
|
|
1029
|
+
primitiveNode(
|
|
1030
|
+
"Optional",
|
|
1109
1031
|
(s) => Object.hasOwn(s, key) ? Result.succeed(s[key]) : err,
|
|
1110
1032
|
(a, s) => {
|
|
1111
1033
|
if (Object.hasOwn(s, key)) {
|
|
1112
1034
|
const copy = cloneShallow(s)
|
|
1113
|
-
copy
|
|
1035
|
+
InternalRecord.assignProperty(copy, key, a)
|
|
1114
1036
|
return Result.succeed(copy)
|
|
1115
1037
|
} else {
|
|
1116
1038
|
return err
|
|
@@ -1126,7 +1048,7 @@ class OptionalImpl<S, A> implements Optional<S, A> {
|
|
|
1126
1048
|
omit(keys: any) {
|
|
1127
1049
|
return this.compose(makeLens(Struct.omit(keys), (o, a) => ({ ...a, ...o })))
|
|
1128
1050
|
}
|
|
1129
|
-
notUndefined():
|
|
1051
|
+
notUndefined(): any {
|
|
1130
1052
|
return this.refine(Predicate.isNotUndefined, { expected: "a value other than `undefined`" })
|
|
1131
1053
|
}
|
|
1132
1054
|
forEach<S, A, B>(this: Traversal<S, A>, f: (iso: Iso<A, A>) => Optional<A, B>): Traversal<S, B> {
|
|
@@ -1224,15 +1146,23 @@ class PrismImpl<S, A> extends OptionalImpl<S, A> implements Prism<S, A> {
|
|
|
1224
1146
|
}
|
|
1225
1147
|
|
|
1226
1148
|
function make(node: Node): any {
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1149
|
+
let op: Operation = node[0] ?? identityOperation
|
|
1150
|
+
if (node.length > 1) {
|
|
1151
|
+
const kind = node.reduce<Kind>((kind, step) => composeKind(kind, step.kind), "Iso")
|
|
1152
|
+
op = {
|
|
1153
|
+
kind,
|
|
1154
|
+
get: compileGet(node, kind),
|
|
1155
|
+
set: compileSet(node, kind)
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
switch (op.kind) {
|
|
1159
|
+
case "Iso":
|
|
1230
1160
|
return new IsoImpl(node, op.get, op.set)
|
|
1231
|
-
case "
|
|
1161
|
+
case "Lens":
|
|
1232
1162
|
return new LensImpl(node, op.get, op.set)
|
|
1233
|
-
case "
|
|
1163
|
+
case "Prism":
|
|
1234
1164
|
return new PrismImpl(node, op.get, op.set)
|
|
1235
|
-
case "
|
|
1165
|
+
case "Optional":
|
|
1236
1166
|
return new OptionalImpl(node, op.get, op.set)
|
|
1237
1167
|
}
|
|
1238
1168
|
}
|
|
@@ -1249,135 +1179,79 @@ function cloneShallow<T>(pojo: T): T {
|
|
|
1249
1179
|
return pojo
|
|
1250
1180
|
}
|
|
1251
1181
|
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1182
|
+
function compileGet(nodes: Node, kind: Kind): (s: any) => any {
|
|
1183
|
+
return (s) => {
|
|
1184
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
1185
|
+
const op = nodes[i]
|
|
1186
|
+
const result = op.get(s)
|
|
1187
|
+
if (hasFailingGet(op.kind)) {
|
|
1188
|
+
if (Result.isFailure(result)) {
|
|
1189
|
+
return result
|
|
1190
|
+
}
|
|
1191
|
+
s = result.success
|
|
1192
|
+
} else {
|
|
1193
|
+
s = result
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
return hasFailingGet(kind) ? Result.succeed(s) : s
|
|
1197
|
+
}
|
|
1256
1198
|
}
|
|
1257
1199
|
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
case "LensNode":
|
|
1264
|
-
case "PrismNode":
|
|
1265
|
-
case "OptionalNode":
|
|
1266
|
-
return { _tag: node._tag, get: node.get, set: node.set }
|
|
1267
|
-
case "PathNode": {
|
|
1268
|
-
return {
|
|
1269
|
-
_tag: "LensNode",
|
|
1270
|
-
get: (s: any) => {
|
|
1271
|
-
const path = node.path
|
|
1272
|
-
let out: any = s
|
|
1273
|
-
for (let i = 0, n = path.length; i < n; i++) {
|
|
1274
|
-
out = out[path[i]]
|
|
1275
|
-
}
|
|
1276
|
-
return out
|
|
1277
|
-
},
|
|
1278
|
-
set: (a: any, s: any) => {
|
|
1279
|
-
const path = node.path
|
|
1280
|
-
const out = cloneShallow(s)
|
|
1281
|
-
|
|
1282
|
-
let current = out
|
|
1283
|
-
let i = 0
|
|
1284
|
-
for (; i < path.length - 1; i++) {
|
|
1285
|
-
const key = path[i]
|
|
1286
|
-
current[key] = cloneShallow(current[key])
|
|
1287
|
-
current = current[key]
|
|
1288
|
-
}
|
|
1289
|
-
|
|
1290
|
-
const finalKey = path[i]
|
|
1291
|
-
current[finalKey] = a
|
|
1292
|
-
|
|
1293
|
-
return out
|
|
1294
|
-
}
|
|
1200
|
+
function compileSet(nodes: Node, kind: Kind): (a: any, s: any) => any {
|
|
1201
|
+
if (hasSourceFreeSet(kind)) {
|
|
1202
|
+
return (a) => {
|
|
1203
|
+
for (let i = nodes.length - 1; i >= 0; i--) {
|
|
1204
|
+
a = nodes[i].set(a)
|
|
1295
1205
|
}
|
|
1206
|
+
return a
|
|
1296
1207
|
}
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1208
|
+
}
|
|
1209
|
+
return (a, s) => {
|
|
1210
|
+
const len = nodes.length
|
|
1211
|
+
const sources = new Array(len)
|
|
1212
|
+
for (let i = 0; i < len; i++) {
|
|
1213
|
+
sources[i] = s
|
|
1214
|
+
const op = nodes[i]
|
|
1215
|
+
if (hasFailingGet(op.kind)) {
|
|
1216
|
+
const result = op.get(s)
|
|
1217
|
+
if (Result.isFailure(result)) {
|
|
1218
|
+
return result
|
|
1219
|
+
}
|
|
1220
|
+
s = result.success
|
|
1221
|
+
} else {
|
|
1222
|
+
s = op.get(s)
|
|
1302
1223
|
}
|
|
1303
|
-
|
|
1304
|
-
|
|
1305
|
-
const
|
|
1306
|
-
|
|
1307
|
-
|
|
1308
|
-
|
|
1309
|
-
|
|
1310
|
-
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
return result
|
|
1315
|
-
}
|
|
1316
|
-
s = result.success
|
|
1317
|
-
} else {
|
|
1318
|
-
s = result
|
|
1319
|
-
}
|
|
1320
|
-
}
|
|
1321
|
-
return hasFailingGet(_tag) ? Result.succeed(s) : s
|
|
1322
|
-
},
|
|
1323
|
-
set: (a: any, s: any) => {
|
|
1324
|
-
const source = s
|
|
1325
|
-
const len = ops.length
|
|
1326
|
-
const ss = new Array(len + 1)
|
|
1327
|
-
ss[0] = s
|
|
1328
|
-
for (let i = 0; i < len; i++) {
|
|
1329
|
-
const op = ops[i]
|
|
1330
|
-
if (hasFailingGet(op._tag)) {
|
|
1331
|
-
const result = op.get(s)
|
|
1332
|
-
if (Result.isFailure(result)) {
|
|
1333
|
-
return _tag === "OptionalNode" ? result : source
|
|
1334
|
-
}
|
|
1335
|
-
s = result.success
|
|
1336
|
-
} else {
|
|
1337
|
-
s = op.get(s)
|
|
1338
|
-
}
|
|
1339
|
-
ss[i + 1] = s
|
|
1340
|
-
}
|
|
1341
|
-
for (let i = len - 1; i >= 0; i--) {
|
|
1342
|
-
const op = ops[i]
|
|
1343
|
-
if (hasSet(op._tag)) {
|
|
1344
|
-
a = op.set(a)
|
|
1345
|
-
} else if (op._tag === "LensNode") {
|
|
1346
|
-
a = op.set(a, ss[i])
|
|
1347
|
-
} else {
|
|
1348
|
-
const result = op.set(a, ss[i])
|
|
1349
|
-
if (Result.isFailure(result)) {
|
|
1350
|
-
return result
|
|
1351
|
-
}
|
|
1352
|
-
a = result.success
|
|
1353
|
-
}
|
|
1354
|
-
}
|
|
1355
|
-
return _tag === "OptionalNode" ? Result.succeed(a) : a
|
|
1224
|
+
}
|
|
1225
|
+
for (let i = len - 1; i >= 0; i--) {
|
|
1226
|
+
const op = nodes[i]
|
|
1227
|
+
if (hasSourceFreeSet(op.kind)) {
|
|
1228
|
+
a = op.set(a)
|
|
1229
|
+
} else if (op.kind === "Lens") {
|
|
1230
|
+
a = op.set(a, sources[i])
|
|
1231
|
+
} else {
|
|
1232
|
+
const result = op.set(a, sources[i])
|
|
1233
|
+
if (Result.isFailure(result)) {
|
|
1234
|
+
return result
|
|
1356
1235
|
}
|
|
1236
|
+
a = result.success
|
|
1357
1237
|
}
|
|
1358
1238
|
}
|
|
1239
|
+
return kind === "Optional" ? Result.succeed(a) : a
|
|
1359
1240
|
}
|
|
1360
|
-
}
|
|
1241
|
+
}
|
|
1361
1242
|
|
|
1362
|
-
function hasFailingGet(
|
|
1363
|
-
return
|
|
1243
|
+
function hasFailingGet(kind: Kind): boolean {
|
|
1244
|
+
return kind === "Prism" || kind === "Optional"
|
|
1364
1245
|
}
|
|
1365
1246
|
|
|
1366
|
-
function
|
|
1367
|
-
return
|
|
1247
|
+
function hasSourceFreeSet(kind: Kind): boolean {
|
|
1248
|
+
return kind === "Iso" || kind === "Prism"
|
|
1368
1249
|
}
|
|
1369
1250
|
|
|
1370
|
-
function
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
case "LensNode":
|
|
1375
|
-
return hasFailingGet(b) ? "OptionalNode" : "LensNode"
|
|
1376
|
-
case "PrismNode":
|
|
1377
|
-
return hasSet(b) ? "PrismNode" : "OptionalNode"
|
|
1378
|
-
case "OptionalNode":
|
|
1379
|
-
return "OptionalNode"
|
|
1380
|
-
}
|
|
1251
|
+
function composeKind(a: Kind, b: Kind): Kind {
|
|
1252
|
+
if (a === "Iso") return b
|
|
1253
|
+
if (b === "Iso" || a === b) return a
|
|
1254
|
+
return "Optional"
|
|
1381
1255
|
}
|
|
1382
1256
|
// ---------------------------------------------
|
|
1383
1257
|
// Derived APIs
|
|
@@ -1399,7 +1273,7 @@ function getCompositionTag(a: Op["_tag"], b: Op["_tag"]): Op["_tag"] {
|
|
|
1399
1273
|
*
|
|
1400
1274
|
* **Example** (Collecting positive numbers)
|
|
1401
1275
|
*
|
|
1402
|
-
* ```ts
|
|
1276
|
+
* ```ts import.meta.vitest
|
|
1403
1277
|
* import { Optic, Schema } from "effect"
|
|
1404
1278
|
*
|
|
1405
1279
|
* type S = { readonly values: ReadonlyArray<number> }
|
|
@@ -1410,16 +1284,14 @@ function getCompositionTag(a: Op["_tag"], b: Op["_tag"]): Op["_tag"] {
|
|
|
1410
1284
|
*
|
|
1411
1285
|
* const getPositive = Optic.getAll(_pos)
|
|
1412
1286
|
*
|
|
1413
|
-
*
|
|
1414
|
-
* // Output: [3, 5]
|
|
1287
|
+
* getPositive({ values: [3, -1, 5] }) // => [3, 5]
|
|
1415
1288
|
*
|
|
1416
|
-
*
|
|
1417
|
-
* // Output: []
|
|
1289
|
+
* getPositive({ values: [-1, -2] }) // => []
|
|
1418
1290
|
* ```
|
|
1419
1291
|
*
|
|
1420
1292
|
* @see {@link Traversal} — the optic type this operates on
|
|
1421
1293
|
*
|
|
1422
|
-
* @category
|
|
1294
|
+
* @category getters
|
|
1423
1295
|
* @since 4.0.0
|
|
1424
1296
|
*/
|
|
1425
1297
|
export function getAll<S, A>(traversal: Traversal<S, A>): (s: S) => Array<A> {
|
|
@@ -1434,7 +1306,7 @@ export function getAll<S, A>(traversal: Traversal<S, A>): (s: S) => Array<A> {
|
|
|
1434
1306
|
// Built-in Optics
|
|
1435
1307
|
// ---------------------------------------------
|
|
1436
1308
|
|
|
1437
|
-
const identityIso = make(
|
|
1309
|
+
const identityIso = make([])
|
|
1438
1310
|
|
|
1439
1311
|
/**
|
|
1440
1312
|
* Iso that focuses on the whole value unchanged.
|
|
@@ -1451,20 +1323,19 @@ const identityIso = make(identityNode)
|
|
|
1451
1323
|
*
|
|
1452
1324
|
* **Example** (Starting an optic chain)
|
|
1453
1325
|
*
|
|
1454
|
-
* ```ts
|
|
1326
|
+
* ```ts import.meta.vitest
|
|
1455
1327
|
* import { Optic } from "effect"
|
|
1456
1328
|
*
|
|
1457
1329
|
* type S = { readonly x: number }
|
|
1458
1330
|
*
|
|
1459
1331
|
* const _x = Optic.id<S>().key("x")
|
|
1460
1332
|
*
|
|
1461
|
-
*
|
|
1462
|
-
* // Output: 42
|
|
1333
|
+
* _x.get({ x: 42 }) // => 42
|
|
1463
1334
|
* ```
|
|
1464
1335
|
*
|
|
1465
1336
|
* @see {@link Iso} — the type this function returns
|
|
1466
1337
|
*
|
|
1467
|
-
* @category
|
|
1338
|
+
* @category constructors
|
|
1468
1339
|
* @since 4.0.0
|
|
1469
1340
|
*/
|
|
1470
1341
|
export function id<S>(): Iso<S, S> {
|
|
@@ -1488,7 +1359,7 @@ export function id<S>(): Iso<S, S> {
|
|
|
1488
1359
|
*
|
|
1489
1360
|
* **Example** (Traversing record values)
|
|
1490
1361
|
*
|
|
1491
|
-
* ```ts
|
|
1362
|
+
* ```ts import.meta.vitest
|
|
1492
1363
|
* import { Optic, Schema } from "effect"
|
|
1493
1364
|
*
|
|
1494
1365
|
* const _positiveValues = Optic.entries<number>()
|
|
@@ -1496,18 +1367,17 @@ export function id<S>(): Iso<S, S> {
|
|
|
1496
1367
|
*
|
|
1497
1368
|
* const inc = _positiveValues.modifyAll((n) => n + 1)
|
|
1498
1369
|
*
|
|
1499
|
-
*
|
|
1500
|
-
* // Output: { a: 0, b: 4, c: -1 }
|
|
1370
|
+
* inc({ a: 0, b: 3, c: -1 }) // => { a: 0, b: 4, c: -1 }
|
|
1501
1371
|
* ```
|
|
1502
1372
|
*
|
|
1503
1373
|
* @see {@link Iso} — the type this function returns
|
|
1504
1374
|
* @see {@link id} — identity iso
|
|
1505
1375
|
*
|
|
1506
|
-
* @category
|
|
1376
|
+
* @category constructors
|
|
1507
1377
|
* @since 4.0.0
|
|
1508
1378
|
*/
|
|
1509
1379
|
export function entries<A>(): Iso<Record<string, A>, ReadonlyArray<readonly [string, A]>> {
|
|
1510
|
-
return make(
|
|
1380
|
+
return make(primitiveNode("Iso", Object.entries, Object.fromEntries))
|
|
1511
1381
|
}
|
|
1512
1382
|
|
|
1513
1383
|
/**
|
|
@@ -1525,25 +1395,22 @@ export function entries<A>(): Iso<Record<string, A>, ReadonlyArray<readonly [str
|
|
|
1525
1395
|
*
|
|
1526
1396
|
* **Example** (Accessing Some value)
|
|
1527
1397
|
*
|
|
1528
|
-
* ```ts
|
|
1398
|
+
* ```ts import.meta.vitest
|
|
1529
1399
|
* import { Optic, Option, Result } from "effect"
|
|
1530
1400
|
*
|
|
1531
1401
|
* const _some = Optic.id<Option.Option<number>>().compose(Optic.some())
|
|
1532
1402
|
*
|
|
1533
|
-
*
|
|
1534
|
-
* // Output: true
|
|
1403
|
+
* _some.getResult(Option.some(42)) // => Result.succeed(42)
|
|
1535
1404
|
*
|
|
1536
|
-
*
|
|
1537
|
-
* // Output: true
|
|
1405
|
+
* Result.isFailure(_some.getResult(Option.none())) // => true
|
|
1538
1406
|
*
|
|
1539
|
-
*
|
|
1540
|
-
* // Output: { _tag: "Some", value: 10 }
|
|
1407
|
+
* _some.set(10) // => Option.some(10)
|
|
1541
1408
|
* ```
|
|
1542
1409
|
*
|
|
1543
1410
|
* @see {@link none} — focuses on `None` instead
|
|
1544
1411
|
* @see {@link Prism} — the type this function returns
|
|
1545
1412
|
*
|
|
1546
|
-
* @category
|
|
1413
|
+
* @category constructors
|
|
1547
1414
|
* @since 4.0.0
|
|
1548
1415
|
*/
|
|
1549
1416
|
export function some<A>(): Prism<Option.Option<A>, A> {
|
|
@@ -1573,22 +1440,20 @@ export function some<A>(): Prism<Option.Option<A>, A> {
|
|
|
1573
1440
|
*
|
|
1574
1441
|
* **Example** (Matching None)
|
|
1575
1442
|
*
|
|
1576
|
-
* ```ts
|
|
1443
|
+
* ```ts import.meta.vitest
|
|
1577
1444
|
* import { Optic, Option, Result } from "effect"
|
|
1578
1445
|
*
|
|
1579
1446
|
* const _none = Optic.id<Option.Option<number>>().compose(Optic.none())
|
|
1580
1447
|
*
|
|
1581
|
-
*
|
|
1582
|
-
* // Output: true
|
|
1448
|
+
* _none.getResult(Option.none()) // => Result.succeed(undefined)
|
|
1583
1449
|
*
|
|
1584
|
-
*
|
|
1585
|
-
* // Output: true
|
|
1450
|
+
* Result.isFailure(_none.getResult(Option.some(1))) // => true
|
|
1586
1451
|
* ```
|
|
1587
1452
|
*
|
|
1588
1453
|
* @see {@link some} — focuses on `Some` instead
|
|
1589
1454
|
* @see {@link Prism} — the type this function returns
|
|
1590
1455
|
*
|
|
1591
|
-
* @category
|
|
1456
|
+
* @category constructors
|
|
1592
1457
|
* @since 4.0.0
|
|
1593
1458
|
*/
|
|
1594
1459
|
export function none<A>(): Prism<Option.Option<A>, undefined> {
|
|
@@ -1618,22 +1483,20 @@ export function none<A>(): Prism<Option.Option<A>, undefined> {
|
|
|
1618
1483
|
*
|
|
1619
1484
|
* **Example** (Accessing success)
|
|
1620
1485
|
*
|
|
1621
|
-
* ```ts
|
|
1486
|
+
* ```ts import.meta.vitest
|
|
1622
1487
|
* import { Optic, Result } from "effect"
|
|
1623
1488
|
*
|
|
1624
1489
|
* const _ok = Optic.id<Result.Result<number, string>>().compose(Optic.success())
|
|
1625
1490
|
*
|
|
1626
|
-
*
|
|
1627
|
-
* // Output: true
|
|
1491
|
+
* _ok.getResult(Result.succeed(42)) // => Result.succeed(42)
|
|
1628
1492
|
*
|
|
1629
|
-
*
|
|
1630
|
-
* // Output: true
|
|
1493
|
+
* Result.isFailure(_ok.getResult(Result.fail("err"))) // => true
|
|
1631
1494
|
* ```
|
|
1632
1495
|
*
|
|
1633
1496
|
* @see {@link failure} — focuses on the failure side
|
|
1634
1497
|
* @see {@link Prism} — the type this function returns
|
|
1635
1498
|
*
|
|
1636
|
-
* @category
|
|
1499
|
+
* @category constructors
|
|
1637
1500
|
* @since 4.0.0
|
|
1638
1501
|
*/
|
|
1639
1502
|
export function success<A, E>(): Prism<Result.Result<A, E>, A> {
|
|
@@ -1663,22 +1526,20 @@ export function success<A, E>(): Prism<Result.Result<A, E>, A> {
|
|
|
1663
1526
|
*
|
|
1664
1527
|
* **Example** (Accessing failure)
|
|
1665
1528
|
*
|
|
1666
|
-
* ```ts
|
|
1529
|
+
* ```ts import.meta.vitest
|
|
1667
1530
|
* import { Optic, Result } from "effect"
|
|
1668
1531
|
*
|
|
1669
1532
|
* const _err = Optic.id<Result.Result<number, string>>().compose(Optic.failure())
|
|
1670
1533
|
*
|
|
1671
|
-
*
|
|
1672
|
-
* // Output: true
|
|
1534
|
+
* _err.getResult(Result.fail("oops")) // => Result.succeed("oops")
|
|
1673
1535
|
*
|
|
1674
|
-
*
|
|
1675
|
-
* // Output: true
|
|
1536
|
+
* Result.isFailure(_err.getResult(Result.succeed(42))) // => true
|
|
1676
1537
|
* ```
|
|
1677
1538
|
*
|
|
1678
1539
|
* @see {@link success} — focuses on the success side
|
|
1679
1540
|
* @see {@link Prism} — the type this function returns
|
|
1680
1541
|
*
|
|
1681
|
-
* @category
|
|
1542
|
+
* @category constructors
|
|
1682
1543
|
* @since 4.0.0
|
|
1683
1544
|
*/
|
|
1684
1545
|
export function failure<A, E>(): Prism<Result.Result<A, E>, E> {
|