effect 4.0.0-beta.102 → 4.0.0-beta.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Array.d.ts +971 -1037
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +381 -407
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +433 -756
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +200 -325
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts +207 -267
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +107 -135
- package/dist/BigInt.js.map +1 -1
- package/dist/Boolean.d.ts +146 -188
- package/dist/Boolean.d.ts.map +1 -1
- package/dist/Boolean.js +64 -84
- package/dist/Boolean.js.map +1 -1
- package/dist/Brand.js.map +1 -1
- package/dist/Cache.d.ts +405 -254
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +166 -101
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +167 -277
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Cause.js +122 -176
- package/dist/Cause.js.map +1 -1
- package/dist/Channel.d.ts +729 -768
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +514 -440
- package/dist/Channel.js.map +1 -1
- package/dist/ChannelSchema.d.ts +1 -1
- package/dist/ChannelSchema.d.ts.map +1 -1
- package/dist/ChannelSchema.js.map +1 -1
- package/dist/Chunk.d.ts +834 -1173
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +326 -439
- package/dist/Chunk.js.map +1 -1
- package/dist/Clock.d.ts +180 -49
- package/dist/Clock.d.ts.map +1 -1
- package/dist/Clock.js +96 -31
- package/dist/Clock.js.map +1 -1
- package/dist/Combiner.d.ts +20 -33
- package/dist/Combiner.d.ts.map +1 -1
- package/dist/Combiner.js +18 -30
- package/dist/Combiner.js.map +1 -1
- package/dist/Config.d.ts +225 -173
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +336 -265
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +194 -68
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +115 -80
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Console.d.ts +233 -33
- package/dist/Console.d.ts.map +1 -1
- package/dist/Console.js +232 -32
- package/dist/Console.js.map +1 -1
- package/dist/Context.d.ts +151 -274
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +171 -214
- package/dist/Context.js.map +1 -1
- package/dist/Cron.d.ts +68 -77
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +57 -66
- package/dist/Cron.js.map +1 -1
- package/dist/Crypto.d.ts +13 -15
- package/dist/Crypto.d.ts.map +1 -1
- package/dist/Crypto.js +9 -10
- package/dist/Crypto.js.map +1 -1
- package/dist/Data.d.ts +60 -80
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js +16 -23
- package/dist/Data.js.map +1 -1
- package/dist/DateTime.d.ts +562 -660
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +307 -362
- package/dist/DateTime.js.map +1 -1
- package/dist/Deferred.d.ts +253 -256
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +104 -96
- package/dist/Deferred.js.map +1 -1
- package/dist/Duration.d.ts +216 -308
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +132 -186
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +2841 -3247
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +1322 -1546
- package/dist/Effect.js.map +1 -1
- package/dist/Effectable.js.map +1 -1
- package/dist/Encoding.d.ts +22 -40
- package/dist/Encoding.d.ts.map +1 -1
- package/dist/Encoding.js +22 -40
- package/dist/Encoding.js.map +1 -1
- package/dist/Equal.d.ts +33 -37
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +29 -21
- package/dist/Equal.js.map +1 -1
- package/dist/Equivalence.d.ts +103 -105
- package/dist/Equivalence.d.ts.map +1 -1
- package/dist/Equivalence.js +77 -79
- package/dist/Equivalence.js.map +1 -1
- package/dist/ErrorReporter.d.ts +51 -27
- package/dist/ErrorReporter.d.ts.map +1 -1
- package/dist/ErrorReporter.js +50 -26
- package/dist/ErrorReporter.js.map +1 -1
- package/dist/ExecutionPlan.d.ts +13 -55
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/ExecutionPlan.js +7 -28
- package/dist/ExecutionPlan.js.map +1 -1
- package/dist/Exit.d.ts +116 -192
- package/dist/Exit.d.ts.map +1 -1
- package/dist/Exit.js +82 -130
- package/dist/Exit.js.map +1 -1
- package/dist/Fiber.d.ts +82 -146
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js +48 -87
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +152 -105
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +106 -73
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +213 -168
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +114 -89
- package/dist/FiberMap.js.map +1 -1
- package/dist/FiberSet.d.ts +123 -81
- package/dist/FiberSet.d.ts.map +1 -1
- package/dist/FiberSet.js +85 -59
- package/dist/FiberSet.js.map +1 -1
- package/dist/FileSystem.d.ts +153 -264
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +42 -147
- package/dist/FileSystem.js.map +1 -1
- package/dist/Filter.d.ts +61 -33
- package/dist/Filter.d.ts.map +1 -1
- package/dist/Filter.js +26 -15
- package/dist/Filter.js.map +1 -1
- package/dist/Formatter.d.ts +25 -33
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +48 -49
- package/dist/Formatter.js.map +1 -1
- package/dist/Function.d.ts +76 -145
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +40 -57
- package/dist/Function.js.map +1 -1
- package/dist/Graph.d.ts +360 -714
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +168 -297
- package/dist/Graph.js.map +1 -1
- package/dist/HKT.d.ts +12 -6
- package/dist/HKT.d.ts.map +1 -1
- package/dist/Hash.d.ts +47 -83
- package/dist/Hash.d.ts.map +1 -1
- package/dist/Hash.js +46 -68
- package/dist/Hash.js.map +1 -1
- package/dist/HashMap.d.ts +319 -411
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashMap.js +122 -166
- package/dist/HashMap.js.map +1 -1
- package/dist/HashRing.d.ts.map +1 -1
- package/dist/HashRing.js +1 -0
- package/dist/HashRing.js.map +1 -1
- package/dist/HashSet.d.ts +177 -284
- package/dist/HashSet.d.ts.map +1 -1
- package/dist/HashSet.js +68 -109
- package/dist/HashSet.js.map +1 -1
- package/dist/Inspectable.d.ts +12 -12
- package/dist/Inspectable.js +8 -8
- package/dist/Inspectable.js.map +1 -1
- package/dist/Iterable.d.ts +620 -786
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +228 -306
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonPatch.d.ts +11 -13
- package/dist/JsonPatch.d.ts.map +1 -1
- package/dist/JsonPatch.js +44 -102
- package/dist/JsonPatch.js.map +1 -1
- package/dist/JsonPointer.d.ts +8 -8
- package/dist/JsonPointer.js +8 -8
- package/dist/JsonPointer.js.map +1 -1
- package/dist/JsonSchema.d.ts +98 -44
- package/dist/JsonSchema.d.ts.map +1 -1
- package/dist/JsonSchema.js +297 -234
- package/dist/JsonSchema.js.map +1 -1
- package/dist/Latch.d.ts +23 -35
- package/dist/Latch.d.ts.map +1 -1
- package/dist/Latch.js +16 -28
- package/dist/Latch.js.map +1 -1
- package/dist/Layer.d.ts +359 -260
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +195 -175
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +42 -29
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +31 -21
- package/dist/LayerMap.js.map +1 -1
- package/dist/LayerRef.d.ts +6 -2
- package/dist/LayerRef.d.ts.map +1 -1
- package/dist/LayerRef.js +6 -2
- package/dist/LayerRef.js.map +1 -1
- package/dist/LogLevel.d.ts +114 -214
- package/dist/LogLevel.d.ts.map +1 -1
- package/dist/LogLevel.js +41 -76
- package/dist/LogLevel.js.map +1 -1
- package/dist/Logger.d.ts +218 -467
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +204 -450
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +7 -5
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/ManagedRuntime.js +7 -5
- package/dist/ManagedRuntime.js.map +1 -1
- package/dist/Match.d.ts +217 -252
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js +150 -183
- package/dist/Match.js.map +1 -1
- package/dist/Metric.d.ts +442 -993
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +198 -642
- package/dist/Metric.js.map +1 -1
- package/dist/MutableHashMap.d.ts +144 -173
- package/dist/MutableHashMap.d.ts.map +1 -1
- package/dist/MutableHashMap.js +68 -79
- package/dist/MutableHashMap.js.map +1 -1
- package/dist/MutableHashSet.d.ts +84 -89
- package/dist/MutableHashSet.d.ts.map +1 -1
- package/dist/MutableHashSet.js +44 -47
- package/dist/MutableHashSet.js.map +1 -1
- package/dist/MutableList.d.ts +71 -370
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +59 -284
- package/dist/MutableList.js.map +1 -1
- package/dist/MutableRef.d.ts +420 -243
- package/dist/MutableRef.d.ts.map +1 -1
- package/dist/MutableRef.js +209 -120
- package/dist/MutableRef.js.map +1 -1
- package/dist/Newtype.d.ts +21 -14
- package/dist/Newtype.d.ts.map +1 -1
- package/dist/Newtype.js +15 -13
- package/dist/Newtype.js.map +1 -1
- package/dist/NonEmptyIterable.d.ts +7 -137
- package/dist/NonEmptyIterable.d.ts.map +1 -1
- package/dist/NonEmptyIterable.js +5 -93
- package/dist/NonEmptyIterable.js.map +1 -1
- package/dist/Number.d.ts +196 -233
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +90 -109
- package/dist/Number.js.map +1 -1
- package/dist/Optic.d.ts +97 -189
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +187 -290
- package/dist/Optic.js.map +1 -1
- package/dist/Option.d.ts +447 -812
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +211 -392
- package/dist/Option.js.map +1 -1
- package/dist/Order.d.ts +109 -109
- package/dist/Order.js +91 -91
- package/dist/Order.js.map +1 -1
- package/dist/Ordering.d.ts +20 -23
- package/dist/Ordering.d.ts.map +1 -1
- package/dist/Ordering.js +8 -9
- package/dist/Ordering.js.map +1 -1
- package/dist/PartitionedSemaphore.js.map +1 -1
- package/dist/Path.d.ts +38 -41
- package/dist/Path.d.ts.map +1 -1
- package/dist/Path.js +3 -4
- package/dist/Path.js.map +1 -1
- package/dist/Pipeable.d.ts +6 -5
- package/dist/Pipeable.d.ts.map +1 -1
- package/dist/Pipeable.js +2 -2
- package/dist/Pipeable.js.map +1 -1
- package/dist/PlatformError.d.ts +4 -4
- package/dist/PlatformError.js +3 -3
- package/dist/PlatformError.js.map +1 -1
- package/dist/Pool.d.ts +4 -2
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +4 -2
- package/dist/Pool.js.map +1 -1
- package/dist/Predicate.d.ts +200 -181
- package/dist/Predicate.d.ts.map +1 -1
- package/dist/Predicate.js +100 -108
- package/dist/Predicate.js.map +1 -1
- package/dist/PrimaryKey.d.ts +7 -7
- package/dist/PrimaryKey.js +5 -5
- package/dist/PrimaryKey.js.map +1 -1
- package/dist/PubSub.d.ts +425 -494
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +373 -362
- package/dist/PubSub.js.map +1 -1
- package/dist/Pull.d.ts +24 -18
- package/dist/Pull.d.ts.map +1 -1
- package/dist/Pull.js +11 -9
- package/dist/Pull.js.map +1 -1
- package/dist/Queue.d.ts +200 -159
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +162 -132
- package/dist/Queue.js.map +1 -1
- package/dist/Random.d.ts +49 -74
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +35 -54
- package/dist/Random.js.map +1 -1
- package/dist/RcMap.d.ts +121 -63
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +42 -21
- package/dist/RcMap.js.map +1 -1
- package/dist/RcRef.d.ts +24 -13
- package/dist/RcRef.d.ts.map +1 -1
- package/dist/RcRef.js +15 -9
- package/dist/RcRef.js.map +1 -1
- package/dist/Record.d.ts +291 -488
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +111 -202
- package/dist/Record.js.map +1 -1
- package/dist/Redactable.d.ts +6 -2
- package/dist/Redactable.d.ts.map +1 -1
- package/dist/Redactable.js +7 -2
- package/dist/Redactable.js.map +1 -1
- package/dist/Redacted.d.ts +25 -25
- package/dist/Redacted.d.ts.map +1 -1
- package/dist/Redacted.js +19 -20
- package/dist/Redacted.js.map +1 -1
- package/dist/Reducer.d.ts +8 -15
- package/dist/Reducer.d.ts.map +1 -1
- package/dist/Reducer.js +6 -12
- package/dist/Reducer.js.map +1 -1
- package/dist/Ref.d.ts +95 -165
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +75 -122
- package/dist/Ref.js.map +1 -1
- package/dist/References.d.ts +102 -168
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +102 -168
- package/dist/References.js.map +1 -1
- package/dist/RegExp.d.ts +10 -14
- package/dist/RegExp.d.ts.map +1 -1
- package/dist/RegExp.js +10 -14
- package/dist/RegExp.js.map +1 -1
- package/dist/Request.d.ts +31 -21
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js +16 -13
- package/dist/Request.js.map +1 -1
- package/dist/RequestResolver.d.ts +201 -90
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +87 -41
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Resource.js.map +1 -1
- package/dist/Result.d.ts +302 -470
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +133 -217
- package/dist/Result.js.map +1 -1
- package/dist/Runtime.d.ts +50 -75
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +39 -60
- package/dist/Runtime.js.map +1 -1
- package/dist/Schedule.d.ts +290 -1636
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +162 -803
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts +5 -5
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +18 -6
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +644 -642
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +491 -527
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +27 -50
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +366 -279
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaError.d.ts +7 -6
- package/dist/SchemaError.d.ts.map +1 -1
- package/dist/SchemaError.js +7 -6
- package/dist/SchemaError.js.map +1 -1
- package/dist/SchemaGetter.d.ts +217 -174
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +218 -185
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.d.ts +62 -190
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js +73 -265
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.d.ts +2 -2
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +123 -75
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +22 -36
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +20 -26
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +114 -74
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +120 -85
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/Scope.d.ts +123 -151
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +72 -92
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.js.map +1 -1
- package/dist/ScopedRef.d.ts +3 -3
- package/dist/ScopedRef.js +2 -2
- package/dist/ScopedRef.js.map +1 -1
- package/dist/Semaphore.d.ts +96 -10
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js +78 -39
- package/dist/Semaphore.js.map +1 -1
- package/dist/Sink.d.ts +117 -107
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +107 -100
- package/dist/Sink.js.map +1 -1
- package/dist/Stdio.d.ts +1 -1
- package/dist/Stdio.js.map +1 -1
- package/dist/Stream.d.ts +2415 -2949
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +1078 -1381
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +262 -308
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +184 -215
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts +109 -114
- package/dist/Struct.d.ts.map +1 -1
- package/dist/Struct.js +41 -50
- package/dist/Struct.js.map +1 -1
- package/dist/SubscriptionRef.d.ts +282 -250
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +104 -92
- package/dist/SubscriptionRef.js.map +1 -1
- package/dist/Symbol.d.ts +3 -3
- package/dist/Symbol.js +3 -3
- package/dist/Symbol.js.map +1 -1
- package/dist/SynchronizedRef.js.map +1 -1
- package/dist/Take.js.map +1 -1
- package/dist/Terminal.d.ts +2 -2
- package/dist/Terminal.js +1 -1
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +100 -54
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +41 -24
- package/dist/Tracer.js.map +1 -1
- package/dist/Trie.d.ts +287 -679
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js +109 -251
- package/dist/Trie.js.map +1 -1
- package/dist/Tuple.d.ts +92 -127
- package/dist/Tuple.d.ts.map +1 -1
- package/dist/Tuple.js +42 -57
- package/dist/Tuple.js.map +1 -1
- package/dist/TxChunk.d.ts +201 -121
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxChunk.js +85 -56
- package/dist/TxChunk.js.map +1 -1
- package/dist/TxDeferred.d.ts +62 -46
- package/dist/TxDeferred.d.ts.map +1 -1
- package/dist/TxDeferred.js +30 -22
- package/dist/TxDeferred.js.map +1 -1
- package/dist/TxHashMap.d.ts +631 -779
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +268 -330
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxHashSet.d.ts +297 -236
- package/dist/TxHashSet.d.ts.map +1 -1
- package/dist/TxHashSet.js +130 -100
- package/dist/TxHashSet.js.map +1 -1
- package/dist/TxPriorityQueue.d.ts +126 -95
- package/dist/TxPriorityQueue.d.ts.map +1 -1
- package/dist/TxPriorityQueue.js +74 -56
- package/dist/TxPriorityQueue.js.map +1 -1
- package/dist/TxPubSub.d.ts +101 -88
- package/dist/TxPubSub.d.ts.map +1 -1
- package/dist/TxPubSub.js +87 -66
- package/dist/TxPubSub.js.map +1 -1
- package/dist/TxQueue.d.ts +200 -180
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxQueue.js +160 -136
- package/dist/TxQueue.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +97 -66
- package/dist/TxReentrantLock.d.ts.map +1 -1
- package/dist/TxReentrantLock.js +67 -45
- package/dist/TxReentrantLock.js.map +1 -1
- package/dist/TxRef.d.ts +51 -32
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +23 -15
- package/dist/TxRef.js.map +1 -1
- package/dist/TxSemaphore.d.ts +129 -95
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +85 -70
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/TxSubscriptionRef.d.ts +97 -70
- package/dist/TxSubscriptionRef.d.ts.map +1 -1
- package/dist/TxSubscriptionRef.js +44 -34
- package/dist/TxSubscriptionRef.js.map +1 -1
- package/dist/Types.d.ts +126 -67
- package/dist/Types.d.ts.map +1 -1
- package/dist/UndefinedOr.js.map +1 -1
- package/dist/Unify.d.ts +45 -65
- package/dist/Unify.d.ts.map +1 -1
- package/dist/Unify.js +6 -9
- package/dist/Unify.js.map +1 -1
- package/dist/Utils.d.ts +23 -16
- package/dist/Utils.d.ts.map +1 -1
- package/dist/Utils.js +3 -7
- package/dist/Utils.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/array.js.map +1 -1
- package/dist/internal/core.js +1 -1
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/dateTime.js +4 -0
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/doNotation.js.map +1 -1
- package/dist/internal/effect.js +77 -40
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/equal.js.map +1 -1
- package/dist/internal/errors.js.map +1 -1
- package/dist/internal/executionPlan.js.map +1 -1
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/hashSet.js.map +1 -1
- package/dist/internal/layer.js.map +1 -1
- package/dist/internal/matcher.js.map +1 -1
- package/dist/internal/metric.js.map +1 -1
- package/dist/internal/option.js.map +1 -1
- package/dist/internal/persistence.d.ts +2 -0
- package/dist/internal/persistence.d.ts.map +1 -0
- package/dist/internal/persistence.js +3 -0
- package/dist/internal/persistence.js.map +1 -0
- package/dist/internal/random.js.map +1 -1
- package/dist/internal/rcRef.js.map +1 -1
- package/dist/internal/record.js.map +1 -1
- package/dist/internal/redacted.js.map +1 -1
- package/dist/internal/references.js +3 -0
- package/dist/internal/references.js.map +1 -1
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/result.js.map +1 -1
- package/dist/internal/schedule.js.map +1 -1
- package/dist/internal/schema/annotations.js.map +1 -1
- package/dist/internal/schema/cause.js.map +1 -1
- package/dist/internal/schema/fromJsonSchemaDocument.js +13 -11
- package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -1
- package/dist/internal/schema/fromRepresentation.js +8 -15
- package/dist/internal/schema/fromRepresentation.js.map +1 -1
- package/dist/internal/schema/parser.d.ts +14 -0
- package/dist/internal/schema/parser.d.ts.map +1 -0
- package/dist/internal/schema/parser.js +13 -0
- package/dist/internal/schema/parser.js.map +1 -0
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/internal/schema/toArbitrary.js.map +1 -1
- package/dist/internal/schema/toCodeDocument.js.map +1 -1
- package/dist/internal/schema/toEquivalence.js.map +1 -1
- package/dist/internal/schema/toJsonSchemaDocument.js +48 -6
- package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -1
- package/dist/internal/schema/toRepresentation.js +87 -107
- package/dist/internal/schema/toRepresentation.js.map +1 -1
- package/dist/internal/stackTraceLimit.js.map +1 -1
- package/dist/internal/stream.js.map +1 -1
- package/dist/internal/tracer.js.map +1 -1
- package/dist/internal/trie.js +13 -9
- package/dist/internal/trie.js.map +1 -1
- package/dist/testing/FastCheck.d.ts +8 -7
- package/dist/testing/FastCheck.d.ts.map +1 -1
- package/dist/testing/FastCheck.js +8 -7
- package/dist/testing/FastCheck.js.map +1 -1
- package/dist/testing/TestClock.d.ts +57 -28
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestClock.js +50 -18
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/testing/TestConsole.d.ts +32 -31
- package/dist/testing/TestConsole.d.ts.map +1 -1
- package/dist/testing/TestConsole.js +24 -22
- package/dist/testing/TestConsole.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +29 -29
- package/dist/testing/TestSchema.js +25 -25
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +95 -118
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +94 -117
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +132 -97
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +55 -51
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
- package/dist/unstable/ai/IdGenerator.d.ts +32 -28
- package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
- package/dist/unstable/ai/IdGenerator.js +26 -21
- package/dist/unstable/ai/IdGenerator.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +107 -67
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +104 -64
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpProtocol.d.ts +30 -0
- package/dist/unstable/ai/McpProtocol.d.ts.map +1 -0
- package/dist/unstable/ai/McpProtocol.js +20 -0
- package/dist/unstable/ai/McpProtocol.js.map +1 -0
- package/dist/unstable/ai/McpSchema.d.ts +141 -75
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +58 -50
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +68 -59
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +694 -241
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Model.d.ts +8 -19
- package/dist/unstable/ai/Model.d.ts.map +1 -1
- package/dist/unstable/ai/Model.js +9 -20
- package/dist/unstable/ai/Model.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Prompt.d.ts +112 -38
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Prompt.js +53 -17
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +28 -14
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js +9 -4
- package/dist/unstable/ai/Response.js.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.js.map +1 -1
- package/dist/unstable/ai/Telemetry.d.ts +46 -13
- package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
- package/dist/unstable/ai/Telemetry.js +18 -7
- package/dist/unstable/ai/Telemetry.js.map +1 -1
- package/dist/unstable/ai/Tokenizer.d.ts +14 -3
- package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
- package/dist/unstable/ai/Tokenizer.js +10 -2
- package/dist/unstable/ai/Tokenizer.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +59 -44
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +48 -39
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +26 -8
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +18 -4
- package/dist/unstable/ai/Toolkit.js.map +1 -1
- package/dist/unstable/ai/index.d.ts +4 -0
- package/dist/unstable/ai/index.d.ts.map +1 -1
- package/dist/unstable/ai/index.js +4 -0
- package/dist/unstable/ai/index.js.map +1 -1
- package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
- package/dist/unstable/ai/internal/mcpProtocol.d.ts +21 -0
- package/dist/unstable/ai/internal/mcpProtocol.d.ts.map +1 -0
- package/dist/unstable/ai/internal/mcpProtocol.js +22 -0
- package/dist/unstable/ai/internal/mcpProtocol.js.map +1 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.d.ts +2 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.d.ts.map +1 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.js +32 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.js.map +1 -0
- package/dist/unstable/ai/internal/structured-output.js +14 -15
- package/dist/unstable/ai/internal/structured-output.js.map +1 -1
- package/dist/unstable/cli/Argument.d.ts +273 -69
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js +111 -33
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/CliConfig.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +69 -76
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +57 -61
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/CliOutput.d.ts +35 -54
- package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
- package/dist/unstable/cli/CliOutput.js +26 -42
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +705 -107
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +238 -42
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Completions.js.map +1 -1
- package/dist/unstable/cli/Flag.d.ts +418 -138
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +197 -71
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +1 -1
- package/dist/unstable/cli/GlobalFlag.js.map +1 -1
- package/dist/unstable/cli/HelpDoc.d.ts +12 -4
- package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
- package/dist/unstable/cli/Param.d.ts +292 -78
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +128 -46
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +370 -149
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js +344 -136
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/Prompt.d.ts +23 -14
- package/dist/unstable/cli/Prompt.d.ts.map +1 -1
- package/dist/unstable/cli/Prompt.js +23 -14
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/index.js.map +1 -1
- package/dist/unstable/cli/internal/ansi.js.map +1 -1
- package/dist/unstable/cli/internal/auto-suggest.js.map +1 -1
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/completions/bash.js.map +1 -1
- package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -1
- package/dist/unstable/cli/internal/completions/fish.js.map +1 -1
- package/dist/unstable/cli/internal/completions/zsh.js.map +1 -1
- package/dist/unstable/cli/internal/config.js.map +1 -1
- package/dist/unstable/cli/internal/help.js.map +1 -1
- package/dist/unstable/cli/internal/lexer.js +17 -7
- package/dist/unstable/cli/internal/lexer.js.map +1 -1
- package/dist/unstable/cli/internal/parser.js +2 -2
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cli/internal/wizard.js.map +1 -1
- package/dist/unstable/cluster/ClusterCron.js.map +1 -1
- package/dist/unstable/cluster/ClusterError.js.map +1 -1
- package/dist/unstable/cluster/ClusterMetrics.js.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.d.ts +8 -8
- package/dist/unstable/cluster/ClusterSchema.js +8 -8
- package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +5 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/DeliverAt.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +10 -10
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +8 -8
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/EntityAddress.js.map +1 -1
- package/dist/unstable/cluster/EntityId.js.map +1 -1
- package/dist/unstable/cluster/EntityProxy.d.ts +4 -2
- package/dist/unstable/cluster/EntityProxy.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxy.js +4 -2
- package/dist/unstable/cluster/EntityProxy.js.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
- package/dist/unstable/cluster/EntityResource.d.ts +2 -2
- package/dist/unstable/cluster/EntityResource.js +2 -2
- package/dist/unstable/cluster/EntityResource.js.map +1 -1
- package/dist/unstable/cluster/EntityType.js.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts +3 -3
- package/dist/unstable/cluster/Envelope.js +3 -3
- package/dist/unstable/cluster/Envelope.js.map +1 -1
- package/dist/unstable/cluster/HttpRunner.d.ts +2 -2
- package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/HttpRunner.js +6 -4
- package/dist/unstable/cluster/HttpRunner.js.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
- package/dist/unstable/cluster/MachineId.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +9 -9
- package/dist/unstable/cluster/Message.js +6 -6
- package/dist/unstable/cluster/Message.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +15 -15
- package/dist/unstable/cluster/MessageStorage.js +5 -5
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +4 -4
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/Runner.js.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.d.ts +1 -1
- package/dist/unstable/cluster/RunnerHealth.js +1 -1
- package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts +2 -1
- package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +16 -16
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.d.ts +2 -2
- package/dist/unstable/cluster/RunnerStorage.js +1 -1
- package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +6 -6
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +19 -10
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/ShardId.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +3 -2
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +3 -3
- package/dist/unstable/cluster/ShardingConfig.js +3 -3
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/ShardingRegistrationEvent.js.map +1 -1
- package/dist/unstable/cluster/SingleRunner.js.map +1 -1
- package/dist/unstable/cluster/Singleton.js.map +1 -1
- package/dist/unstable/cluster/SingletonAddress.d.ts +1 -1
- package/dist/unstable/cluster/SingletonAddress.js +1 -1
- package/dist/unstable/cluster/SingletonAddress.js.map +1 -1
- package/dist/unstable/cluster/Snowflake.d.ts +8 -8
- package/dist/unstable/cluster/Snowflake.js +8 -8
- package/dist/unstable/cluster/Snowflake.js.map +1 -1
- package/dist/unstable/cluster/SocketRunner.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js +20 -5
- package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/TestRunner.js.map +1 -1
- package/dist/unstable/cluster/index.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +5 -5
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/cluster/internal/entityReaper.js.map +1 -1
- package/dist/unstable/cluster/internal/hash.js.map +1 -1
- package/dist/unstable/cluster/internal/interruptors.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
- package/dist/unstable/cluster/internal/shardLock.js.map +1 -1
- package/dist/unstable/devtools/DevTools.js.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
- package/dist/unstable/devtools/DevToolsServer.js.map +1 -1
- package/dist/unstable/devtools/index.js.map +1 -1
- package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
- package/dist/unstable/encoding/Msgpack.js +6 -8
- package/dist/unstable/encoding/Msgpack.js.map +1 -1
- package/dist/unstable/encoding/Ndjson.js.map +1 -1
- package/dist/unstable/encoding/Sse.d.ts +72 -8
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.js +58 -8
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/encoding/index.js.map +1 -1
- package/dist/unstable/eventlog/Event.d.ts +20 -20
- package/dist/unstable/eventlog/Event.js.map +1 -1
- package/dist/unstable/eventlog/EventGroup.d.ts +4 -4
- package/dist/unstable/eventlog/EventGroup.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +15 -15
- package/dist/unstable/eventlog/EventJournal.js +13 -13
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts +3 -3
- package/dist/unstable/eventlog/EventLog.js +3 -3
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.d.ts +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +2 -2
- package/dist/unstable/eventlog/EventLogMessage.js +1 -1
- package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +15 -15
- package/dist/unstable/eventlog/EventLogRemote.js +1 -1
- package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.d.ts +11 -2
- package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.js +45 -21
- package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +4 -4
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.js +13 -5
- package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +5 -5
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js +14 -6
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.js +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/index.js.map +1 -1
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js.map +1 -1
- package/dist/unstable/http/Cookies.d.ts +2 -2
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +30 -18
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Etag.d.ts +1 -1
- package/dist/unstable/http/Etag.js +1 -1
- package/dist/unstable/http/Etag.js.map +1 -1
- package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/unstable/http/FetchHttpClient.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts +2 -2
- package/dist/unstable/http/Headers.js +2 -2
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpBody.d.ts +5 -3
- package/dist/unstable/http/HttpBody.d.ts.map +1 -1
- package/dist/unstable/http/HttpBody.js +11 -5
- package/dist/unstable/http/HttpBody.js.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts +51 -44
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +46 -17
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientError.js.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +2 -0
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts +4 -4
- package/dist/unstable/http/HttpClientResponse.js +2 -2
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts +6 -6
- package/dist/unstable/http/HttpEffect.js +3 -3
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMethod.d.ts +6 -9
- package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
- package/dist/unstable/http/HttpMethod.js +6 -9
- package/dist/unstable/http/HttpMethod.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts +75 -9
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +164 -39
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpPlatform.d.ts +76 -0
- package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
- package/dist/unstable/http/HttpPlatform.js +32 -0
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +88 -89
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +78 -79
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServer.d.ts +13 -13
- package/dist/unstable/http/HttpServer.js +6 -6
- package/dist/unstable/http/HttpServer.js.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +2 -2
- package/dist/unstable/http/HttpServerError.js +2 -2
- package/dist/unstable/http/HttpServerError.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +4 -4
- package/dist/unstable/http/HttpServerRequest.js +4 -4
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +22 -0
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +10 -0
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpStaticServer.d.ts +35 -7
- package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpStaticServer.js +35 -7
- package/dist/unstable/http/HttpStaticServer.js.map +1 -1
- package/dist/unstable/http/HttpTraceContext.js.map +1 -1
- package/dist/unstable/http/Multipart.d.ts +6 -6
- package/dist/unstable/http/Multipart.js +5 -5
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/Template.js.map +1 -1
- package/dist/unstable/http/Url.d.ts +33 -63
- package/dist/unstable/http/Url.d.ts.map +1 -1
- package/dist/unstable/http/Url.js +14 -28
- package/dist/unstable/http/Url.js.map +1 -1
- package/dist/unstable/http/UrlParams.d.ts +10 -18
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +9 -17
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/http/index.js.map +1 -1
- package/dist/unstable/http/internal/compression.d.ts +2 -0
- package/dist/unstable/http/internal/compression.d.ts.map +1 -0
- package/dist/unstable/http/internal/compression.js +155 -0
- package/dist/unstable/http/internal/compression.js.map +1 -0
- package/dist/unstable/http/internal/preResponseHandler.js.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +10 -11
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +4 -5
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +11 -13
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +42 -42
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +13 -13
- package/dist/unstable/httpapi/HttpApiError.js +13 -13
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.d.ts +15 -15
- package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +71 -24
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js +57 -10
- package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts +0 -12
- package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +6 -6
- package/dist/unstable/httpapi/HttpApiSchema.js +4 -4
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiTest.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts +13 -13
- package/dist/unstable/httpapi/OpenApi.js +13 -13
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/httpapi/index.js.map +1 -1
- package/dist/unstable/httpapi/internal/html.js.map +1 -1
- package/dist/unstable/httpapi/internal/httpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/internal/httpApiSwagger.js.map +1 -1
- package/dist/unstable/httpapi/internal/mediaType.js.map +1 -1
- package/dist/unstable/observability/Otlp.js.map +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts +12 -14
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +17 -4
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts +4 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
- package/dist/unstable/observability/OtlpResource.d.ts +16 -7
- package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpResource.js +21 -12
- package/dist/unstable/observability/OtlpResource.js.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.d.ts +13 -4
- package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.js +10 -3
- package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
- package/dist/unstable/observability/index.js.map +1 -1
- package/dist/unstable/observability/internal/otlpEnv.js +1 -1
- package/dist/unstable/observability/internal/otlpEnv.js.map +1 -1
- package/dist/unstable/observability/internal/otlpProtobuf.js.map +1 -1
- package/dist/unstable/observability/internal/protobuf.js +3 -0
- package/dist/unstable/observability/internal/protobuf.js.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +8 -3
- package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.js +22 -13
- package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
- package/dist/unstable/persistence/Persistable.d.ts +8 -8
- package/dist/unstable/persistence/Persistable.js.map +1 -1
- package/dist/unstable/persistence/PersistedCache.js.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts +6 -6
- package/dist/unstable/persistence/PersistedQueue.js +6 -6
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/Persistence.d.ts +3 -3
- package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistence.js +91 -15
- package/dist/unstable/persistence/Persistence.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +26 -15
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +24 -13
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/persistence/Redis.d.ts +2 -2
- package/dist/unstable/persistence/Redis.js +1 -1
- package/dist/unstable/persistence/Redis.js.map +1 -1
- package/dist/unstable/persistence/index.js.map +1 -1
- package/dist/unstable/process/ChildProcess.d.ts +64 -21
- package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcess.js +14 -5
- package/dist/unstable/process/ChildProcess.js.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.d.ts +21 -10
- package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
- package/dist/unstable/process/index.js.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.d.ts +8 -8
- package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.js +10 -10
- package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +25 -22
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +14 -13
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.js +4 -1
- package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/unstable/reactivity/AtomRef.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +24 -3
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.js +4 -1
- package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
- package/dist/unstable/reactivity/Hydration.d.ts +1 -1
- package/dist/unstable/reactivity/Hydration.js +1 -1
- package/dist/unstable/reactivity/Hydration.js.map +1 -1
- package/dist/unstable/reactivity/Reactivity.js.map +1 -1
- package/dist/unstable/reactivity/index.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +35 -33
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js +4 -2
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts +12 -12
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +12 -11
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcClientError.js.map +1 -1
- package/dist/unstable/rpc/RpcGroup.d.ts +8 -8
- package/dist/unstable/rpc/RpcGroup.js +1 -1
- package/dist/unstable/rpc/RpcGroup.js.map +1 -1
- package/dist/unstable/rpc/RpcMessage.d.ts +31 -30
- package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMessage.js +6 -6
- package/dist/unstable/rpc/RpcMessage.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts +10 -10
- package/dist/unstable/rpc/RpcMiddleware.js +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts +4 -4
- package/dist/unstable/rpc/RpcSchema.js +3 -3
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts +58 -7
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +175 -96
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +13 -13
- package/dist/unstable/rpc/RpcServer.js +17 -13
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/rpc/RpcTest.js.map +1 -1
- package/dist/unstable/rpc/RpcWorker.d.ts +5 -5
- package/dist/unstable/rpc/RpcWorker.js +4 -4
- package/dist/unstable/rpc/RpcWorker.js.map +1 -1
- package/dist/unstable/rpc/Utils.js.map +1 -1
- package/dist/unstable/rpc/index.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts +52 -50
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js +35 -33
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +5 -5
- package/dist/unstable/schema/VariantSchema.js +2 -2
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/schema/index.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +11 -3
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +9 -4
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/socket/SocketServer.js.map +1 -1
- package/dist/unstable/socket/index.js.map +1 -1
- package/dist/unstable/sql/Migrator.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts +1 -1
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +2 -2
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/sql/SqlConnection.js.map +1 -1
- package/dist/unstable/sql/SqlError.js.map +1 -1
- package/dist/unstable/sql/SqlModel.d.ts +2 -2
- package/dist/unstable/sql/SqlModel.js +2 -2
- package/dist/unstable/sql/SqlModel.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.d.ts +5 -5
- package/dist/unstable/sql/SqlResolver.js +2 -2
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/sql/SqlSchema.js.map +1 -1
- package/dist/unstable/sql/SqlStream.js.map +1 -1
- package/dist/unstable/sql/Statement.d.ts +6 -6
- package/dist/unstable/sql/Statement.js +15 -15
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/sql/index.js.map +1 -1
- package/dist/unstable/workers/Transferable.d.ts +1 -1
- package/dist/unstable/workers/Transferable.js +1 -1
- package/dist/unstable/workers/Transferable.js.map +1 -1
- package/dist/unstable/workers/Worker.d.ts +2 -2
- package/dist/unstable/workers/Worker.js +2 -2
- package/dist/unstable/workers/Worker.js.map +1 -1
- package/dist/unstable/workers/WorkerError.d.ts +7 -7
- package/dist/unstable/workers/WorkerError.js +6 -6
- package/dist/unstable/workers/WorkerError.js.map +1 -1
- package/dist/unstable/workers/WorkerRunner.d.ts +1 -1
- package/dist/unstable/workers/WorkerRunner.js +1 -1
- package/dist/unstable/workers/WorkerRunner.js.map +1 -1
- package/dist/unstable/workers/index.js.map +1 -1
- package/dist/unstable/workflow/Activity.d.ts +2 -2
- package/dist/unstable/workflow/Activity.js +2 -2
- package/dist/unstable/workflow/Activity.js.map +1 -1
- package/dist/unstable/workflow/DurableClock.d.ts +1 -1
- package/dist/unstable/workflow/DurableClock.js +1 -1
- package/dist/unstable/workflow/DurableClock.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts +10 -10
- package/dist/unstable/workflow/DurableDeferred.js +5 -5
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/DurableQueue.d.ts +22 -20
- package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableQueue.js +22 -20
- package/dist/unstable/workflow/DurableQueue.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +21 -21
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js +13 -14
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.d.ts +4 -2
- package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.js +4 -2
- package/dist/unstable/workflow/WorkflowProxy.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
- package/dist/unstable/workflow/index.js.map +1 -1
- package/dist/unstable/workflow/internal/crypto.js.map +1 -1
- package/package.json +5 -6
- package/src/Array.ts +982 -1045
- package/src/BigDecimal.ts +433 -756
- package/src/BigInt.ts +213 -269
- package/src/Boolean.ts +146 -188
- package/src/Cache.ts +409 -255
- package/src/Cause.ts +167 -277
- package/src/Channel.ts +891 -816
- package/src/ChannelSchema.ts +1 -1
- package/src/Chunk.ts +841 -1181
- package/src/Clock.ts +181 -49
- package/src/Combiner.ts +20 -33
- package/src/Config.ts +615 -332
- package/src/ConfigProvider.ts +214 -120
- package/src/Console.ts +289 -39
- package/src/Context.ts +319 -378
- package/src/Cron.ts +68 -77
- package/src/Crypto.ts +13 -15
- package/src/Data.ts +60 -80
- package/src/DateTime.ts +564 -660
- package/src/Deferred.ts +253 -256
- package/src/Duration.ts +216 -308
- package/src/Effect.ts +2893 -3279
- package/src/Encoding.ts +22 -40
- package/src/Equal.ts +49 -39
- package/src/Equivalence.ts +103 -105
- package/src/ErrorReporter.ts +51 -27
- package/src/ExecutionPlan.ts +13 -55
- package/src/Exit.ts +116 -192
- package/src/Fiber.ts +81 -148
- package/src/FiberHandle.ts +152 -105
- package/src/FiberMap.ts +225 -174
- package/src/FiberSet.ts +124 -82
- package/src/FileSystem.ts +155 -263
- package/src/Filter.ts +61 -33
- package/src/Formatter.ts +54 -56
- package/src/Function.ts +76 -145
- package/src/Graph.ts +416 -770
- package/src/HKT.ts +12 -6
- package/src/Hash.ts +52 -83
- package/src/HashMap.ts +319 -411
- package/src/HashRing.ts +1 -0
- package/src/HashSet.ts +177 -284
- package/src/Inspectable.ts +12 -12
- package/src/Iterable.ts +620 -786
- package/src/JsonPatch.ts +58 -112
- package/src/JsonPointer.ts +8 -8
- package/src/JsonSchema.ts +402 -244
- package/src/Latch.ts +23 -35
- package/src/Layer.ts +359 -260
- package/src/LayerMap.ts +49 -29
- package/src/LayerRef.ts +6 -2
- package/src/LogLevel.ts +114 -214
- package/src/Logger.ts +344 -697
- package/src/ManagedRuntime.ts +7 -5
- package/src/Match.ts +217 -252
- package/src/Metric.ts +516 -1089
- package/src/MutableHashMap.ts +218 -255
- package/src/MutableHashSet.ts +84 -89
- package/src/MutableList.ts +73 -370
- package/src/MutableRef.ts +420 -243
- package/src/Newtype.ts +21 -14
- package/src/NonEmptyIterable.ts +7 -137
- package/src/Number.ts +196 -233
- package/src/Optic.ts +243 -383
- package/src/Option.ts +447 -812
- package/src/Order.ts +109 -109
- package/src/Ordering.ts +20 -23
- package/src/Path.ts +38 -41
- package/src/Pipeable.ts +6 -5
- package/src/PlatformError.ts +4 -4
- package/src/Pool.ts +4 -2
- package/src/Predicate.ts +200 -181
- package/src/PrimaryKey.ts +7 -7
- package/src/PubSub.ts +526 -552
- package/src/Pull.ts +24 -18
- package/src/Queue.ts +200 -159
- package/src/Random.ts +49 -74
- package/src/RcMap.ts +121 -63
- package/src/RcRef.ts +24 -13
- package/src/Record.ts +291 -488
- package/src/Redactable.ts +10 -3
- package/src/Redacted.ts +25 -25
- package/src/Reducer.ts +8 -15
- package/src/Ref.ts +221 -361
- package/src/References.ts +102 -168
- package/src/RegExp.ts +10 -14
- package/src/Request.ts +31 -21
- package/src/RequestResolver.ts +202 -91
- package/src/Result.ts +312 -484
- package/src/Runtime.ts +50 -75
- package/src/Schedule.ts +308 -1734
- package/src/Scheduler.ts +20 -7
- package/src/Schema.ts +716 -745
- package/src/SchemaAST.ts +466 -358
- package/src/SchemaError.ts +7 -6
- package/src/SchemaGetter.ts +242 -190
- package/src/SchemaIssue.ts +89 -275
- package/src/SchemaParser.ts +180 -93
- package/src/SchemaRepresentation.ts +22 -40
- package/src/SchemaTransformation.ts +129 -88
- package/src/Scope.ts +123 -151
- package/src/ScopedRef.ts +4 -4
- package/src/Semaphore.ts +152 -51
- package/src/Sink.ts +128 -113
- package/src/Stdio.ts +1 -1
- package/src/Stream.ts +2602 -3123
- package/src/String.ts +275 -312
- package/src/Struct.ts +109 -114
- package/src/SubscriptionRef.ts +284 -252
- package/src/Symbol.ts +3 -3
- package/src/Terminal.ts +2 -2
- package/src/Tracer.ts +102 -55
- package/src/Trie.ts +287 -679
- package/src/Tuple.ts +92 -127
- package/src/TxChunk.ts +201 -121
- package/src/TxDeferred.ts +62 -46
- package/src/TxHashMap.ts +645 -799
- package/src/TxHashSet.ts +443 -356
- package/src/TxPriorityQueue.ts +130 -98
- package/src/TxPubSub.ts +107 -80
- package/src/TxQueue.ts +214 -183
- package/src/TxReentrantLock.ts +97 -66
- package/src/TxRef.ts +51 -32
- package/src/TxSemaphore.ts +129 -95
- package/src/TxSubscriptionRef.ts +97 -70
- package/src/Types.ts +126 -67
- package/src/Unify.ts +45 -65
- package/src/Utils.ts +23 -16
- package/src/internal/core.ts +2 -2
- package/src/internal/dateTime.ts +6 -0
- package/src/internal/effect.ts +93 -48
- package/src/internal/persistence.ts +2 -0
- package/src/internal/references.ts +3 -2
- package/src/internal/schema/fromJsonSchemaDocument.ts +15 -13
- package/src/internal/schema/fromRepresentation.ts +10 -16
- package/src/internal/schema/parser.ts +22 -0
- package/src/internal/schema/toJsonSchemaDocument.ts +60 -6
- package/src/internal/schema/toRepresentation.ts +104 -119
- package/src/internal/trie.ts +10 -11
- package/src/testing/FastCheck.ts +8 -7
- package/src/testing/TestClock.ts +72 -30
- package/src/testing/TestConsole.ts +32 -31
- package/src/testing/TestSchema.ts +29 -29
- package/src/unstable/ai/AiError.ts +95 -118
- package/src/unstable/ai/AnthropicStructuredOutput.ts +1 -1
- package/src/unstable/ai/Chat.ts +132 -97
- package/src/unstable/ai/IdGenerator.ts +32 -28
- package/src/unstable/ai/LanguageModel.ts +107 -67
- package/src/unstable/ai/McpProtocol.ts +48 -0
- package/src/unstable/ai/McpSchema.ts +60 -50
- package/src/unstable/ai/McpServer.ts +930 -304
- package/src/unstable/ai/Model.ts +9 -20
- package/src/unstable/ai/OpenAiStructuredOutput.ts +1 -1
- package/src/unstable/ai/Prompt.ts +145 -43
- package/src/unstable/ai/Response.ts +28 -14
- package/src/unstable/ai/Telemetry.ts +46 -13
- package/src/unstable/ai/Tokenizer.ts +14 -3
- package/src/unstable/ai/Tool.ts +59 -44
- package/src/unstable/ai/Toolkit.ts +26 -8
- package/src/unstable/ai/index.ts +5 -0
- package/src/unstable/ai/internal/mcpProtocol.ts +85 -0
- package/src/unstable/ai/internal/mcpProtocolRegistry.ts +70 -0
- package/src/unstable/ai/internal/structured-output.ts +13 -18
- package/src/unstable/cli/Argument.ts +273 -69
- package/src/unstable/cli/CliError.ts +69 -76
- package/src/unstable/cli/CliOutput.ts +44 -58
- package/src/unstable/cli/Command.ts +705 -107
- package/src/unstable/cli/Flag.ts +418 -138
- package/src/unstable/cli/GlobalFlag.ts +1 -1
- package/src/unstable/cli/HelpDoc.ts +12 -4
- package/src/unstable/cli/Param.ts +292 -78
- package/src/unstable/cli/Primitive.ts +370 -149
- package/src/unstable/cli/Prompt.ts +28 -14
- package/src/unstable/cli/internal/lexer.ts +8 -2
- package/src/unstable/cli/internal/parser.ts +2 -2
- package/src/unstable/cluster/ClusterSchema.ts +8 -8
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +5 -1
- package/src/unstable/cluster/Entity.ts +15 -16
- package/src/unstable/cluster/EntityProxy.ts +4 -2
- package/src/unstable/cluster/EntityResource.ts +2 -2
- package/src/unstable/cluster/Envelope.ts +3 -3
- package/src/unstable/cluster/HttpRunner.ts +6 -4
- package/src/unstable/cluster/Message.ts +9 -9
- package/src/unstable/cluster/MessageStorage.ts +15 -15
- package/src/unstable/cluster/Reply.ts +4 -6
- package/src/unstable/cluster/RunnerHealth.ts +1 -1
- package/src/unstable/cluster/RunnerServer.ts +41 -8
- package/src/unstable/cluster/RunnerStorage.ts +2 -2
- package/src/unstable/cluster/Runners.ts +23 -12
- package/src/unstable/cluster/Sharding.ts +7 -8
- package/src/unstable/cluster/ShardingConfig.ts +3 -3
- package/src/unstable/cluster/SingletonAddress.ts +1 -1
- package/src/unstable/cluster/Snowflake.ts +8 -8
- package/src/unstable/cluster/SqlMessageStorage.ts +1 -1
- package/src/unstable/cluster/SqlRunnerStorage.ts +21 -5
- package/src/unstable/cluster/internal/entityManager.ts +11 -15
- package/src/unstable/encoding/Msgpack.ts +6 -8
- package/src/unstable/encoding/Sse.ts +98 -16
- package/src/unstable/eventlog/Event.ts +20 -20
- package/src/unstable/eventlog/EventGroup.ts +4 -4
- package/src/unstable/eventlog/EventJournal.ts +15 -15
- package/src/unstable/eventlog/EventLog.ts +3 -3
- package/src/unstable/eventlog/EventLogEncryption.ts +1 -1
- package/src/unstable/eventlog/EventLogMessage.ts +2 -2
- package/src/unstable/eventlog/EventLogRemote.ts +1 -1
- package/src/unstable/eventlog/EventLogServer.ts +41 -7
- package/src/unstable/eventlog/EventLogServerEncrypted.ts +13 -5
- package/src/unstable/eventlog/EventLogServerUnencrypted.ts +14 -6
- package/src/unstable/eventlog/EventLogSessionAuth.ts +1 -1
- package/src/unstable/http/Cookies.ts +35 -21
- package/src/unstable/http/Etag.ts +1 -1
- package/src/unstable/http/FetchHttpClient.ts +3 -1
- package/src/unstable/http/Headers.ts +2 -2
- package/src/unstable/http/HttpBody.ts +20 -5
- package/src/unstable/http/HttpClient.ts +83 -55
- package/src/unstable/http/HttpClientRequest.ts +2 -0
- package/src/unstable/http/HttpClientResponse.ts +4 -4
- package/src/unstable/http/HttpEffect.ts +8 -8
- package/src/unstable/http/HttpMethod.ts +6 -9
- package/src/unstable/http/HttpMiddleware.ts +202 -39
- package/src/unstable/http/HttpPlatform.ts +95 -0
- package/src/unstable/http/HttpRouter.ts +102 -98
- package/src/unstable/http/HttpServer.ts +13 -13
- package/src/unstable/http/HttpServerError.ts +2 -2
- package/src/unstable/http/HttpServerRequest.ts +4 -4
- package/src/unstable/http/HttpServerResponse.ts +30 -0
- package/src/unstable/http/HttpStaticServer.ts +35 -7
- package/src/unstable/http/Multipart.ts +6 -6
- package/src/unstable/http/Url.ts +33 -63
- package/src/unstable/http/UrlParams.ts +10 -18
- package/src/unstable/http/internal/compression.ts +196 -0
- package/src/unstable/httpapi/HttpApiBuilder.ts +10 -9
- package/src/unstable/httpapi/HttpApiClient.ts +14 -14
- package/src/unstable/httpapi/HttpApiEndpoint.ts +42 -42
- package/src/unstable/httpapi/HttpApiError.ts +13 -13
- package/src/unstable/httpapi/HttpApiGroup.ts +15 -15
- package/src/unstable/httpapi/HttpApiMiddleware.ts +71 -24
- package/src/unstable/httpapi/HttpApiScalar.ts +0 -12
- package/src/unstable/httpapi/HttpApiSchema.ts +6 -6
- package/src/unstable/httpapi/OpenApi.ts +13 -13
- package/src/unstable/observability/OtlpExporter.ts +31 -19
- package/src/unstable/observability/OtlpMetrics.ts +4 -1
- package/src/unstable/observability/OtlpResource.ts +26 -17
- package/src/unstable/observability/PrometheusMetrics.ts +13 -4
- package/src/unstable/observability/internal/otlpEnv.ts +1 -1
- package/src/unstable/observability/internal/protobuf.ts +3 -0
- package/src/unstable/persistence/KeyValueStore.ts +72 -49
- package/src/unstable/persistence/Persistable.ts +8 -8
- package/src/unstable/persistence/PersistedQueue.ts +6 -6
- package/src/unstable/persistence/Persistence.ts +126 -19
- package/src/unstable/persistence/RateLimiter.ts +26 -15
- package/src/unstable/persistence/Redis.ts +2 -2
- package/src/unstable/process/ChildProcess.ts +64 -21
- package/src/unstable/process/ChildProcessSpawner.ts +21 -10
- package/src/unstable/reactivity/AsyncResult.ts +12 -13
- package/src/unstable/reactivity/Atom.ts +28 -25
- package/src/unstable/reactivity/AtomHttpApi.ts +5 -4
- package/src/unstable/reactivity/AtomRegistry.ts +24 -3
- package/src/unstable/reactivity/AtomRpc.ts +5 -4
- package/src/unstable/reactivity/Hydration.ts +1 -1
- package/src/unstable/rpc/Rpc.ts +35 -33
- package/src/unstable/rpc/RpcClient.ts +16 -15
- package/src/unstable/rpc/RpcGroup.ts +8 -8
- package/src/unstable/rpc/RpcMessage.ts +31 -30
- package/src/unstable/rpc/RpcMiddleware.ts +10 -10
- package/src/unstable/rpc/RpcSchema.ts +4 -4
- package/src/unstable/rpc/RpcSerialization.ts +167 -68
- package/src/unstable/rpc/RpcServer.ts +18 -15
- package/src/unstable/rpc/RpcWorker.ts +5 -5
- package/src/unstable/schema/Model.ts +52 -50
- package/src/unstable/schema/VariantSchema.ts +5 -5
- package/src/unstable/socket/Socket.ts +17 -4
- package/src/unstable/sql/SqlClient.ts +5 -6
- package/src/unstable/sql/SqlModel.ts +2 -2
- package/src/unstable/sql/SqlResolver.ts +5 -5
- package/src/unstable/sql/Statement.ts +24 -23
- package/src/unstable/workers/Transferable.ts +1 -1
- package/src/unstable/workers/Worker.ts +2 -2
- package/src/unstable/workers/WorkerError.ts +7 -7
- package/src/unstable/workers/WorkerRunner.ts +1 -1
- package/src/unstable/workflow/Activity.ts +2 -2
- package/src/unstable/workflow/DurableClock.ts +1 -1
- package/src/unstable/workflow/DurableDeferred.ts +10 -10
- package/src/unstable/workflow/DurableQueue.ts +22 -20
- package/src/unstable/workflow/Workflow.ts +23 -23
- package/src/unstable/workflow/WorkflowEngine.ts +1 -1
- package/src/unstable/workflow/WorkflowProxy.ts +4 -2
- package/dist/internal/version.d.ts +0 -3
- package/dist/internal/version.d.ts.map +0 -1
- package/dist/internal/version.js +0 -2
- package/dist/internal/version.js.map +0 -1
- package/src/internal/version.ts +0 -2
package/dist/Schema.js
CHANGED
|
@@ -80,8 +80,8 @@ const TypeId = InternalSchema.TypeId;
|
|
|
80
80
|
*
|
|
81
81
|
* **Example** (Schema for a parametric `Box<A>` type)
|
|
82
82
|
*
|
|
83
|
-
* ```ts
|
|
84
|
-
* import { Effect,
|
|
83
|
+
* ```ts import.meta.vitest
|
|
84
|
+
* import { Effect, Schema, SchemaIssue as Issue, SchemaParser } from "effect"
|
|
85
85
|
*
|
|
86
86
|
* interface Box<A> {
|
|
87
87
|
* readonly value: A
|
|
@@ -96,7 +96,7 @@ const TypeId = InternalSchema.TypeId;
|
|
|
96
96
|
* ([itemCodec]) =>
|
|
97
97
|
* (u, ast, options) => {
|
|
98
98
|
* if (!isBox(u)) {
|
|
99
|
-
* return Effect.fail(new SchemaIssue.InvalidType(ast
|
|
99
|
+
* return Effect.fail(new SchemaIssue.InvalidType(ast))
|
|
100
100
|
* }
|
|
101
101
|
* return Effect.map(
|
|
102
102
|
* SchemaParser.decodeUnknownEffect(itemCodec)(u.value, options),
|
|
@@ -106,6 +106,7 @@ const TypeId = InternalSchema.TypeId;
|
|
|
106
106
|
* )
|
|
107
107
|
*
|
|
108
108
|
* const schema = Box(Schema.Number)
|
|
109
|
+
* Effect.runSync(Schema.decodeUnknownEffect(schema)({ value: 1 })) // => { value: 1 }
|
|
109
110
|
* ```
|
|
110
111
|
*
|
|
111
112
|
* @category constructors
|
|
@@ -128,7 +129,7 @@ export function declareConstructor() {
|
|
|
128
129
|
*
|
|
129
130
|
* **Example** (Defining a schema for a custom `UserId` branded type)
|
|
130
131
|
*
|
|
131
|
-
* ```ts
|
|
132
|
+
* ```ts import.meta.vitest
|
|
132
133
|
* import { Schema } from "effect"
|
|
133
134
|
*
|
|
134
135
|
* type UserId = string & { readonly _tag: "UserId" }
|
|
@@ -140,6 +141,7 @@ export function declareConstructor() {
|
|
|
140
141
|
* title: "UserId",
|
|
141
142
|
* description: "A user identifier starting with 'user_'"
|
|
142
143
|
* })
|
|
144
|
+
* Schema.decodeUnknownSync(UserId)("user_123") // => "user_123"
|
|
143
145
|
* ```
|
|
144
146
|
*
|
|
145
147
|
* @see {@link declareConstructor} for creating schemas for parametric types.
|
|
@@ -148,7 +150,7 @@ export function declareConstructor() {
|
|
|
148
150
|
* @since 3.10.0
|
|
149
151
|
*/
|
|
150
152
|
export function declare(is, annotations) {
|
|
151
|
-
return declareConstructor()([], () => (input, ast) => is(input) ? Effect.succeed(input) : Effect.fail(new SchemaIssue.InvalidType(ast
|
|
153
|
+
return declareConstructor()([], () => (input, ast) => is(input) ? Effect.succeed(input) : Effect.fail(new SchemaIssue.InvalidType(ast)), annotations);
|
|
152
154
|
}
|
|
153
155
|
/**
|
|
154
156
|
* Returns a schema widened to the fully-parameterized {@link Bottom} interface,
|
|
@@ -162,7 +164,7 @@ export function declare(is, annotations) {
|
|
|
162
164
|
*
|
|
163
165
|
* **Example** (Inspecting all type parameters of a schema)
|
|
164
166
|
*
|
|
165
|
-
* ```ts
|
|
167
|
+
* ```ts import.meta.vitest
|
|
166
168
|
* import { Schema } from "effect"
|
|
167
169
|
*
|
|
168
170
|
* const schema = Schema.String
|
|
@@ -194,7 +196,7 @@ export function revealBottom(bottom) {
|
|
|
194
196
|
*
|
|
195
197
|
* **Example** (Adding a title and description)
|
|
196
198
|
*
|
|
197
|
-
* ```ts
|
|
199
|
+
* ```ts import.meta.vitest
|
|
198
200
|
* import { Schema } from "effect"
|
|
199
201
|
*
|
|
200
202
|
* const Age = Schema.Natural.pipe(
|
|
@@ -203,6 +205,7 @@ export function revealBottom(bottom) {
|
|
|
203
205
|
* description: "A non-negative integer representing age in years"
|
|
204
206
|
* })
|
|
205
207
|
* )
|
|
208
|
+
* Schema.resolveAnnotations(Age)?.title // => "Age"
|
|
206
209
|
* ```
|
|
207
210
|
*
|
|
208
211
|
* @see {@link annotateEncoded} to annotate the encoded side instead.
|
|
@@ -225,7 +228,7 @@ export function annotate(annotations) {
|
|
|
225
228
|
*
|
|
226
229
|
* **Example** (Adding a title to the encoded representation)
|
|
227
230
|
*
|
|
228
|
-
* ```ts
|
|
231
|
+
* ```ts import.meta.vitest
|
|
229
232
|
* import { Schema } from "effect"
|
|
230
233
|
*
|
|
231
234
|
* const schema = Schema.NumberFromString.pipe(
|
|
@@ -234,8 +237,7 @@ export function annotate(annotations) {
|
|
|
234
237
|
* })
|
|
235
238
|
* )
|
|
236
239
|
*
|
|
237
|
-
*
|
|
238
|
-
* // "my title"
|
|
240
|
+
* Schema.toEncoded(schema).ast.annotations?.title // => "my title"
|
|
239
241
|
* ```
|
|
240
242
|
*
|
|
241
243
|
* @see {@link annotate} to annotate the type side instead.
|
|
@@ -260,7 +262,7 @@ export function annotateEncoded(annotations) {
|
|
|
260
262
|
*
|
|
261
263
|
* **Example** (Customizing the missing-key message for a required field)
|
|
262
264
|
*
|
|
263
|
-
* ```ts
|
|
265
|
+
* ```ts import.meta.vitest
|
|
264
266
|
* import { Schema } from "effect"
|
|
265
267
|
*
|
|
266
268
|
* const schema = Schema.Struct({
|
|
@@ -271,6 +273,7 @@ export function annotateEncoded(annotations) {
|
|
|
271
273
|
* })
|
|
272
274
|
* )
|
|
273
275
|
* })
|
|
276
|
+
* schema.fields.username.ast.context?.annotations?.messageMissingKey // => "Username is required"
|
|
274
277
|
* ```
|
|
275
278
|
*
|
|
276
279
|
* @category annotations
|
|
@@ -293,7 +296,7 @@ export function annotateKey(annotations) {
|
|
|
293
296
|
*
|
|
294
297
|
* **Example** (Recovering encoded type from a schema variable)
|
|
295
298
|
*
|
|
296
|
-
* ```ts
|
|
299
|
+
* ```ts import.meta.vitest
|
|
297
300
|
* import { Schema } from "effect"
|
|
298
301
|
*
|
|
299
302
|
* const schema: Schema.Schema<number> = Schema.NumberFromString
|
|
@@ -313,18 +316,14 @@ export {
|
|
|
313
316
|
/**
|
|
314
317
|
* Returns `true` if `u` is a {@link SchemaError}.
|
|
315
318
|
*
|
|
316
|
-
* **Example** (Narrowing Schema errors
|
|
319
|
+
* **Example** (Narrowing Schema errors)
|
|
317
320
|
*
|
|
318
|
-
* ```ts
|
|
319
|
-
* import { Schema } from "effect"
|
|
321
|
+
* ```ts import.meta.vitest
|
|
322
|
+
* import { Result, Schema } from "effect"
|
|
320
323
|
*
|
|
321
|
-
* try
|
|
322
|
-
*
|
|
323
|
-
*
|
|
324
|
-
* if (Schema.isSchemaError(err)) {
|
|
325
|
-
* console.log(err._tag) // "SchemaError"
|
|
326
|
-
* }
|
|
327
|
-
* }
|
|
324
|
+
* const result = Result.try(() => Schema.decodeUnknownSync(Schema.Number)("oops"))
|
|
325
|
+
* const error: unknown = Result.isFailure(result) ? result.failure : undefined
|
|
326
|
+
* Schema.isSchemaError(error) // => true
|
|
328
327
|
* ```
|
|
329
328
|
*
|
|
330
329
|
* @category guards
|
|
@@ -338,25 +337,22 @@ isSchemaError,
|
|
|
338
337
|
* **Details**
|
|
339
338
|
*
|
|
340
339
|
* The `issue` field contains a structured {@link SchemaIssue.Issue} tree describing
|
|
341
|
-
* every validation failure, including the path to the problematic value
|
|
342
|
-
* expected
|
|
343
|
-
*
|
|
340
|
+
* every validation failure, including the path to the problematic value and
|
|
341
|
+
* the expected type or constraint. Built-in issues have no `actual` field,
|
|
342
|
+
* and built-in messages do not include the rejected value. Other Issue fields
|
|
343
|
+
* and custom annotations or messages are not sanitized. `message` renders the
|
|
344
|
+
* issue tree as a human-readable string.
|
|
344
345
|
*
|
|
345
346
|
* Use {@link isSchemaError} to narrow an unknown value to `SchemaError`.
|
|
346
347
|
*
|
|
347
|
-
* **Example** (
|
|
348
|
+
* **Example** (Inspecting a SchemaError)
|
|
348
349
|
*
|
|
349
|
-
* ```ts
|
|
350
|
-
* import { Schema } from "effect"
|
|
350
|
+
* ```ts import.meta.vitest
|
|
351
|
+
* import { Result, Schema } from "effect"
|
|
351
352
|
*
|
|
352
|
-
*
|
|
353
|
-
*
|
|
354
|
-
*
|
|
355
|
-
* if (Schema.isSchemaError(err)) {
|
|
356
|
-
* console.log(err.message)
|
|
357
|
-
* // Expected number, actual "not a number"
|
|
358
|
-
* }
|
|
359
|
-
* }
|
|
353
|
+
* const result = Schema.decodeUnknownResult(Schema.Number)("not a number")
|
|
354
|
+
* const message = Result.isFailure(result) ? result.failure.message : ""
|
|
355
|
+
* message // => "Expected number"
|
|
360
356
|
* ```
|
|
361
357
|
*
|
|
362
358
|
* @category errors
|
|
@@ -383,7 +379,7 @@ function makeStandardResult(exit) {
|
|
|
383
379
|
*
|
|
384
380
|
* **Example** (Creating a standard schema from a regular schema)
|
|
385
381
|
*
|
|
386
|
-
* ```ts
|
|
382
|
+
* ```ts import.meta.vitest
|
|
387
383
|
* import { Schema } from "effect"
|
|
388
384
|
*
|
|
389
385
|
* // Define custom hook functions for error formatting
|
|
@@ -421,16 +417,21 @@ function makeStandardResult(exit) {
|
|
|
421
417
|
* name: "Alice",
|
|
422
418
|
* age: 30
|
|
423
419
|
* })
|
|
424
|
-
* console.log(validResult) // { value: { name: "Alice", age: 30 } }
|
|
425
|
-
*
|
|
426
420
|
* const invalidResult = standardSchema["~standard"].validate({
|
|
427
421
|
* name: "",
|
|
428
422
|
* age: 200
|
|
429
423
|
* })
|
|
430
|
-
*
|
|
424
|
+
*
|
|
425
|
+
* if (validResult instanceof Promise || invalidResult instanceof Promise) {
|
|
426
|
+
* throw new Error("Expected synchronous validation")
|
|
427
|
+
* }
|
|
428
|
+
* if ("value" in validResult) {
|
|
429
|
+
* validResult.value // => { name: "Alice", age: 30 }
|
|
430
|
+
* }
|
|
431
|
+
* invalidResult.issues?.map((issue) => issue.path) // => [["name"], ["age"]]
|
|
431
432
|
* ```
|
|
432
433
|
*
|
|
433
|
-
* @category
|
|
434
|
+
* @category converting
|
|
434
435
|
* @since 4.0.0
|
|
435
436
|
*/
|
|
436
437
|
export function toStandardSchemaV1(self, options) {
|
|
@@ -441,7 +442,7 @@ export function toStandardSchemaV1(self, options) {
|
|
|
441
442
|
};
|
|
442
443
|
const formatter = SchemaIssue.makeFormatterStandardSchemaV1(options);
|
|
443
444
|
const validate = value => {
|
|
444
|
-
const scheduler = new Scheduler.MixedScheduler();
|
|
445
|
+
const scheduler = new Scheduler.MixedScheduler("sync");
|
|
445
446
|
const fiber = Effect.runFork(Effect.match(decodeUnknownEffect(value, parseOptions), {
|
|
446
447
|
onFailure: formatter,
|
|
447
448
|
onSuccess: value => ({
|
|
@@ -503,7 +504,7 @@ function toBaseStandardJSONSchemaV1(self, target) {
|
|
|
503
504
|
*
|
|
504
505
|
* https://github.com/standard-schema/standard-schema/pull/134
|
|
505
506
|
*
|
|
506
|
-
* @category
|
|
507
|
+
* @category converting
|
|
507
508
|
* @since 4.0.0
|
|
508
509
|
*/
|
|
509
510
|
export function toStandardJSONSchemaV1(self) {
|
|
@@ -550,19 +551,19 @@ export function toStandardJSONSchemaV1(self) {
|
|
|
550
551
|
*
|
|
551
552
|
* **Example** (Defining a basic type guard)
|
|
552
553
|
*
|
|
553
|
-
* ```ts
|
|
554
|
+
* ```ts import.meta.vitest
|
|
554
555
|
* import { Schema } from "effect"
|
|
555
556
|
*
|
|
556
557
|
* const isString = Schema.is(Schema.String)
|
|
557
558
|
*
|
|
558
|
-
*
|
|
559
|
-
*
|
|
559
|
+
* isString("hello") // => true
|
|
560
|
+
* isString(42) // => false
|
|
560
561
|
*
|
|
561
562
|
* // Type narrowing in action
|
|
562
563
|
* const value: unknown = "hello"
|
|
563
564
|
* if (isString(value)) {
|
|
564
565
|
* // value is now typed as string
|
|
565
|
-
*
|
|
566
|
+
* value.toUpperCase() // => "HELLO"
|
|
566
567
|
* }
|
|
567
568
|
* ```
|
|
568
569
|
*
|
|
@@ -592,21 +593,23 @@ export const is = SchemaParser.is;
|
|
|
592
593
|
*
|
|
593
594
|
* **Example** (Asserting and narrowing an input)
|
|
594
595
|
*
|
|
595
|
-
* ```ts
|
|
596
|
-
* import { Schema } from "effect"
|
|
596
|
+
* ```ts import.meta.vitest
|
|
597
|
+
* import { Schema, SchemaIssue } from "effect"
|
|
597
598
|
*
|
|
598
599
|
* const input: unknown = "hello"
|
|
599
600
|
*
|
|
600
601
|
* // This will pass silently (no return value) and narrow input to string
|
|
601
602
|
* Schema.asserts(Schema.String, input)
|
|
602
|
-
*
|
|
603
|
+
* input.toUpperCase() // => "HELLO"
|
|
603
604
|
*
|
|
604
605
|
* // This will throw an error
|
|
605
606
|
* try {
|
|
606
607
|
* const invalid: unknown = 123
|
|
607
608
|
* Schema.asserts(Schema.String, invalid)
|
|
608
609
|
* } catch (error) {
|
|
609
|
-
*
|
|
610
|
+
* if (error instanceof Error) {
|
|
611
|
+
* SchemaIssue.isIssue(error.cause) // => true
|
|
612
|
+
* }
|
|
610
613
|
* }
|
|
611
614
|
* ```
|
|
612
615
|
*
|
|
@@ -732,7 +735,7 @@ export function decodeUnknownExit(schema, options) {
|
|
|
732
735
|
};
|
|
733
736
|
}
|
|
734
737
|
function fromIssueExit(exit) {
|
|
735
|
-
return Exit_.isSuccess(exit) ?
|
|
738
|
+
return Exit_.isSuccess(exit) ? exit : Exit_.failCause(Cause_.map(exit.cause, issue => new SchemaError(issue)));
|
|
736
739
|
}
|
|
737
740
|
/**
|
|
738
741
|
* Decodes a typed input (the schema's `Encoded` type) against a schema
|
|
@@ -967,19 +970,12 @@ export const decodePromise = decodeUnknownPromise;
|
|
|
967
970
|
*
|
|
968
971
|
* **Example** (Decoding with a transformation schema)
|
|
969
972
|
*
|
|
970
|
-
* ```ts
|
|
973
|
+
* ```ts import.meta.vitest
|
|
971
974
|
* import { Schema } from "effect"
|
|
972
975
|
*
|
|
973
976
|
* const NumberFromString = Schema.NumberFromString
|
|
974
977
|
*
|
|
975
|
-
*
|
|
976
|
-
* // Output: 42
|
|
977
|
-
*
|
|
978
|
-
* Schema.decodeUnknownSync(NumberFromString)("not a number")
|
|
979
|
-
* // throws SchemaError: NumberFromString
|
|
980
|
-
* // └─ Encoded side transformation failure
|
|
981
|
-
* // └─ NumberFromString
|
|
982
|
-
* // └─ Expected a numeric string, actual "not a number"
|
|
978
|
+
* Schema.decodeUnknownSync(NumberFromString)("42") // => 42
|
|
983
979
|
* ```
|
|
984
980
|
*
|
|
985
981
|
* @see {@link SchemaParser.decodeUnknownSync} for the adapter that throws an `Error` whose cause is `SchemaIssue.Issue`
|
|
@@ -1038,13 +1034,12 @@ export const decodeSync = decodeUnknownSync;
|
|
|
1038
1034
|
*
|
|
1039
1035
|
* **Example** (Encoding a value to a string)
|
|
1040
1036
|
*
|
|
1041
|
-
* ```ts
|
|
1037
|
+
* ```ts import.meta.vitest
|
|
1042
1038
|
* import { Effect, Schema } from "effect"
|
|
1043
1039
|
*
|
|
1044
1040
|
* const NumberFromString = Schema.NumberFromString
|
|
1045
1041
|
*
|
|
1046
|
-
* Effect.runPromise(Schema.encodeUnknownEffect(NumberFromString)(42))
|
|
1047
|
-
* // Output: "42"
|
|
1042
|
+
* await Effect.runPromise(Schema.encodeUnknownEffect(NumberFromString)(42)) // => "42"
|
|
1048
1043
|
* ```
|
|
1049
1044
|
*
|
|
1050
1045
|
* @see {@link SchemaParser.encodeUnknownEffect} for the adapter that fails with `SchemaIssue.Issue` directly
|
|
@@ -1413,7 +1408,7 @@ export function isSchema(u) {
|
|
|
1413
1408
|
*
|
|
1414
1409
|
* **Example** (Creating a struct with optional key)
|
|
1415
1410
|
*
|
|
1416
|
-
* ```ts
|
|
1411
|
+
* ```ts import.meta.vitest
|
|
1417
1412
|
* import { Schema } from "effect"
|
|
1418
1413
|
*
|
|
1419
1414
|
* const schema = Schema.Struct({
|
|
@@ -1457,7 +1452,7 @@ export const requiredKey = /*#__PURE__*/Struct_.lambda(self => self.schema);
|
|
|
1457
1452
|
*
|
|
1458
1453
|
* **Example** (Defining an optional field accepting undefined)
|
|
1459
1454
|
*
|
|
1460
|
-
* ```ts
|
|
1455
|
+
* ```ts import.meta.vitest
|
|
1461
1456
|
* import { Schema } from "effect"
|
|
1462
1457
|
*
|
|
1463
1458
|
* const schema = Schema.Struct({
|
|
@@ -1549,11 +1544,12 @@ export function flip(schema) {
|
|
|
1549
1544
|
*
|
|
1550
1545
|
* **Example** (Defining a string literal)
|
|
1551
1546
|
*
|
|
1552
|
-
* ```ts
|
|
1547
|
+
* ```ts import.meta.vitest
|
|
1553
1548
|
* import { Schema } from "effect"
|
|
1554
1549
|
*
|
|
1555
1550
|
* const schema = Schema.Literal("hello")
|
|
1556
1551
|
* // Type: Schema.Literal<"hello">
|
|
1552
|
+
* Schema.decodeSync(schema)("hello") // => "hello"
|
|
1557
1553
|
* ```
|
|
1558
1554
|
*
|
|
1559
1555
|
* @see {@link Literals} for a schema that represents a union of literals.
|
|
@@ -1594,11 +1590,11 @@ function templateLiteralFromParts(parts) {
|
|
|
1594
1590
|
*
|
|
1595
1591
|
* **Example** (Defining a URL path pattern)
|
|
1596
1592
|
*
|
|
1597
|
-
* ```ts
|
|
1593
|
+
* ```ts import.meta.vitest
|
|
1598
1594
|
* import { Schema } from "effect"
|
|
1599
1595
|
*
|
|
1600
1596
|
* const schema = Schema.TemplateLiteral(["/user/", Schema.Number])
|
|
1601
|
-
*
|
|
1597
|
+
* Schema.is(schema)("/user/123") // => true
|
|
1602
1598
|
* ```
|
|
1603
1599
|
*
|
|
1604
1600
|
* @see {@link TemplateLiteralParser} for a schema that also parses matched parts into a tuple.
|
|
@@ -1626,11 +1622,11 @@ export function TemplateLiteral(parts) {
|
|
|
1626
1622
|
*
|
|
1627
1623
|
* **Example** (Parsing path parameters)
|
|
1628
1624
|
*
|
|
1629
|
-
* ```ts
|
|
1625
|
+
* ```ts import.meta.vitest
|
|
1630
1626
|
* import { Schema } from "effect"
|
|
1631
1627
|
*
|
|
1632
1628
|
* const schema = Schema.TemplateLiteralParser(["/user/", Schema.NumberFromString])
|
|
1633
|
-
*
|
|
1629
|
+
* Schema.decodeSync(schema)("/user/42") // => ["/user/", 42]
|
|
1634
1630
|
* ```
|
|
1635
1631
|
*
|
|
1636
1632
|
* @see {@link TemplateLiteral} for a validation-only version that keeps the string encoded.
|
|
@@ -1647,7 +1643,7 @@ export function TemplateLiteralParser(parts) {
|
|
|
1647
1643
|
*
|
|
1648
1644
|
* **Example** (Defining a direction enum)
|
|
1649
1645
|
*
|
|
1650
|
-
* ```ts
|
|
1646
|
+
* ```ts import.meta.vitest
|
|
1651
1647
|
* import { Schema } from "effect"
|
|
1652
1648
|
*
|
|
1653
1649
|
* enum Direction {
|
|
@@ -1656,7 +1652,7 @@ export function TemplateLiteralParser(parts) {
|
|
|
1656
1652
|
* }
|
|
1657
1653
|
*
|
|
1658
1654
|
* const schema = Schema.Enum(Direction)
|
|
1659
|
-
* //
|
|
1655
|
+
* Schema.decodeSync(schema)(Direction.Up) // => "Up"
|
|
1660
1656
|
* ```
|
|
1661
1657
|
*
|
|
1662
1658
|
* @category constructors
|
|
@@ -1742,7 +1738,7 @@ export const Number = /*#__PURE__*/make(SchemaAST.number);
|
|
|
1742
1738
|
*
|
|
1743
1739
|
* @see {@link BooleanFromBit} for a schema that decodes bit literals `0` or `1` into a boolean
|
|
1744
1740
|
*
|
|
1745
|
-
* @category
|
|
1741
|
+
* @category schemas
|
|
1746
1742
|
* @since 4.0.0
|
|
1747
1743
|
*/
|
|
1748
1744
|
export const Boolean = /*#__PURE__*/make(SchemaAST.boolean);
|
|
@@ -1801,11 +1797,12 @@ export const ObjectKeyword = /*#__PURE__*/make(SchemaAST.objectKeyword);
|
|
|
1801
1797
|
*
|
|
1802
1798
|
* **Example** (Defining a specific symbol)
|
|
1803
1799
|
*
|
|
1804
|
-
* ```ts
|
|
1800
|
+
* ```ts import.meta.vitest
|
|
1805
1801
|
* import { Schema } from "effect"
|
|
1806
1802
|
*
|
|
1807
1803
|
* const mySymbol = Symbol.for("mySymbol")
|
|
1808
1804
|
* const schema = Schema.UniqueSymbol(mySymbol)
|
|
1805
|
+
* Schema.decodeSync(schema)(mySymbol) === mySymbol // => true
|
|
1809
1806
|
* ```
|
|
1810
1807
|
*
|
|
1811
1808
|
* @see {@link Symbol} for a schema that accepts any symbol.
|
|
@@ -1837,7 +1834,7 @@ function makeStruct(ast, fields) {
|
|
|
1837
1834
|
*
|
|
1838
1835
|
* **Example** (Defining a basic struct)
|
|
1839
1836
|
*
|
|
1840
|
-
* ```ts
|
|
1837
|
+
* ```ts import.meta.vitest
|
|
1841
1838
|
* import { Schema } from "effect"
|
|
1842
1839
|
*
|
|
1843
1840
|
* const Person = Schema.Struct({
|
|
@@ -1849,9 +1846,7 @@ function makeStruct(ast, fields) {
|
|
|
1849
1846
|
* // { readonly name: string; readonly age: number; readonly email?: string }
|
|
1850
1847
|
* type Person = typeof Person.Type
|
|
1851
1848
|
*
|
|
1852
|
-
*
|
|
1853
|
-
* console.log(alice)
|
|
1854
|
-
* // { name: 'Alice', age: 30 }
|
|
1849
|
+
* Schema.decodeUnknownSync(Person)({ name: "Alice", age: 30 }) // => { name: "Alice", age: 30 }
|
|
1855
1850
|
* ```
|
|
1856
1851
|
*
|
|
1857
1852
|
* @category constructors
|
|
@@ -1874,7 +1869,7 @@ export function Struct(fields) {
|
|
|
1874
1869
|
*
|
|
1875
1870
|
* **Example** (Adding fields to a union of structs)
|
|
1876
1871
|
*
|
|
1877
|
-
* ```ts
|
|
1872
|
+
* ```ts import.meta.vitest
|
|
1878
1873
|
* import { Schema, Tuple } from "effect"
|
|
1879
1874
|
*
|
|
1880
1875
|
* // Add a new field to all members of a union of structs
|
|
@@ -1882,6 +1877,7 @@ export function Struct(fields) {
|
|
|
1882
1877
|
* Schema.Struct({ a: Schema.String }),
|
|
1883
1878
|
* Schema.Struct({ b: Schema.Number })
|
|
1884
1879
|
* ]).mapMembers(Tuple.map(Schema.fieldsAssign({ c: Schema.Number })))
|
|
1880
|
+
* Schema.decodeSync(schema)({ a: "a", c: 1 }) // => { a: "a", c: 1 }
|
|
1885
1881
|
* ```
|
|
1886
1882
|
*
|
|
1887
1883
|
* @category combinators
|
|
@@ -1904,16 +1900,14 @@ const canonicalPropertyKey = key => typeof key === "symbol" ? key : globalThis.S
|
|
|
1904
1900
|
*
|
|
1905
1901
|
* **Example** (Renaming `name` to `full_name` in the encoded form)
|
|
1906
1902
|
*
|
|
1907
|
-
* ```ts
|
|
1903
|
+
* ```ts import.meta.vitest
|
|
1908
1904
|
* import { Schema } from "effect"
|
|
1909
1905
|
*
|
|
1910
1906
|
* const Person = Schema.Struct({ name: Schema.String, age: Schema.Number })
|
|
1911
1907
|
* const Encoded = Person.pipe(Schema.encodeKeys({ name: "full_name" }))
|
|
1912
1908
|
*
|
|
1913
1909
|
* // Decodes { full_name: "Alice", age: 30 } → { name: "Alice", age: 30 }
|
|
1914
|
-
*
|
|
1915
|
-
* console.log(alice)
|
|
1916
|
-
* // { name: 'Alice', age: 30 }
|
|
1910
|
+
* Schema.decodeUnknownSync(Encoded)({ full_name: "Alice", age: 30 }) // => { name: "Alice", age: 30 }
|
|
1917
1911
|
* ```
|
|
1918
1912
|
*
|
|
1919
1913
|
* @category transforming
|
|
@@ -1958,7 +1952,7 @@ export function encodeKeys(mapping) {
|
|
|
1958
1952
|
*
|
|
1959
1953
|
* **Example** (Adding a computed `fullName` field)
|
|
1960
1954
|
*
|
|
1961
|
-
* ```ts
|
|
1955
|
+
* ```ts import.meta.vitest
|
|
1962
1956
|
* import { Option, Schema } from "effect"
|
|
1963
1957
|
*
|
|
1964
1958
|
* const Person = Schema.Struct({ first: Schema.String, last: Schema.String })
|
|
@@ -1970,8 +1964,7 @@ export function encodeKeys(mapping) {
|
|
|
1970
1964
|
* )
|
|
1971
1965
|
*
|
|
1972
1966
|
* const alice = Schema.decodeUnknownSync(Extended)({ first: "Alice", last: "Smith" })
|
|
1973
|
-
*
|
|
1974
|
-
* // Alice Smith
|
|
1967
|
+
* alice.fullName // => "Alice Smith"
|
|
1975
1968
|
* ```
|
|
1976
1969
|
*
|
|
1977
1970
|
* @category transforming
|
|
@@ -2026,9 +2019,16 @@ derive) {
|
|
|
2026
2019
|
* For transformed key schemas, property selection is based on encoded property
|
|
2027
2020
|
* names before the selected key is decoded.
|
|
2028
2021
|
*
|
|
2022
|
+
* **Gotchas**
|
|
2023
|
+
*
|
|
2024
|
+
* When decoded or encoded key transformations produce the same property key,
|
|
2025
|
+
* sequential parsing applies selected own properties in selection order, so
|
|
2026
|
+
* the later selected property overwrites the earlier value. With concurrency
|
|
2027
|
+
* greater than `1`, completion order determines which value is retained.
|
|
2028
|
+
*
|
|
2029
2029
|
* **Example** (Defining a string-keyed record of numbers)
|
|
2030
2030
|
*
|
|
2031
|
-
* ```ts
|
|
2031
|
+
* ```ts import.meta.vitest
|
|
2032
2032
|
* import { Schema } from "effect"
|
|
2033
2033
|
*
|
|
2034
2034
|
* const schema = Schema.Record(Schema.String, Schema.Number)
|
|
@@ -2036,17 +2036,14 @@ derive) {
|
|
|
2036
2036
|
* // { readonly [x: string]: number }
|
|
2037
2037
|
* type R = typeof schema.Type
|
|
2038
2038
|
*
|
|
2039
|
-
*
|
|
2040
|
-
* console.log(result)
|
|
2041
|
-
* // { a: 1, b: 2 }
|
|
2039
|
+
* Schema.decodeUnknownSync(schema)({ a: 1, b: 2 }) // => { a: 1, b: 2 }
|
|
2042
2040
|
* ```
|
|
2043
2041
|
*
|
|
2044
2042
|
* @category constructors
|
|
2045
2043
|
* @since 3.10.0
|
|
2046
2044
|
*/
|
|
2047
|
-
export function Record(key, value
|
|
2048
|
-
|
|
2049
|
-
return make(SchemaAST.record(key.ast, value.ast, keyValueCombiner), {
|
|
2045
|
+
export function Record(key, value) {
|
|
2046
|
+
return make(SchemaAST.record(key.ast, value.ast), {
|
|
2050
2047
|
key,
|
|
2051
2048
|
value
|
|
2052
2049
|
});
|
|
@@ -2064,7 +2061,7 @@ export function Record(key, value, options) {
|
|
|
2064
2061
|
*
|
|
2065
2062
|
* **Example** (Defining structs with string-indexed extra keys)
|
|
2066
2063
|
*
|
|
2067
|
-
* ```ts
|
|
2064
|
+
* ```ts import.meta.vitest
|
|
2068
2065
|
* import { Schema } from "effect"
|
|
2069
2066
|
*
|
|
2070
2067
|
* const schema = Schema.StructWithRest(
|
|
@@ -2099,14 +2096,12 @@ function makeTuple(ast, elements) {
|
|
|
2099
2096
|
*
|
|
2100
2097
|
* **Example** (Defining a pair of string and number)
|
|
2101
2098
|
*
|
|
2102
|
-
* ```ts
|
|
2099
|
+
* ```ts import.meta.vitest
|
|
2103
2100
|
* import { Schema } from "effect"
|
|
2104
2101
|
*
|
|
2105
2102
|
* const schema = Schema.Tuple([Schema.String, Schema.Number])
|
|
2106
2103
|
*
|
|
2107
|
-
*
|
|
2108
|
-
* console.log(pair)
|
|
2109
|
-
* // [ 'hello', 42 ]
|
|
2104
|
+
* Schema.decodeUnknownSync(schema)(["hello", 42]) // => ["hello", 42]
|
|
2110
2105
|
* ```
|
|
2111
2106
|
*
|
|
2112
2107
|
* @category constructors
|
|
@@ -2128,7 +2123,7 @@ export function Tuple(elements) {
|
|
|
2128
2123
|
*
|
|
2129
2124
|
* **Example** (Defining tuples with rest elements)
|
|
2130
2125
|
*
|
|
2131
|
-
* ```ts
|
|
2126
|
+
* ```ts import.meta.vitest
|
|
2132
2127
|
* import { Schema } from "effect"
|
|
2133
2128
|
*
|
|
2134
2129
|
* // [string, number, ...boolean[]]
|
|
@@ -2137,9 +2132,7 @@ export function Tuple(elements) {
|
|
|
2137
2132
|
* [Schema.Boolean]
|
|
2138
2133
|
* )
|
|
2139
2134
|
*
|
|
2140
|
-
*
|
|
2141
|
-
* console.log(result)
|
|
2142
|
-
* // [ 'hello', 1, true, false ]
|
|
2135
|
+
* Schema.decodeUnknownSync(schema)(["hello", 1, true, false]) // => ["hello", 1, true, false]
|
|
2143
2136
|
* ```
|
|
2144
2137
|
*
|
|
2145
2138
|
* @category constructors
|
|
@@ -2164,14 +2157,12 @@ export {
|
|
|
2164
2157
|
*
|
|
2165
2158
|
* **Example** (Defining an array of strings)
|
|
2166
2159
|
*
|
|
2167
|
-
* ```ts
|
|
2160
|
+
* ```ts import.meta.vitest
|
|
2168
2161
|
* import { Schema } from "effect"
|
|
2169
2162
|
*
|
|
2170
2163
|
* const schema = Schema.Array(Schema.String)
|
|
2171
2164
|
*
|
|
2172
|
-
*
|
|
2173
|
-
* console.log(result)
|
|
2174
|
-
* // [ 'a', 'b', 'c' ]
|
|
2165
|
+
* Schema.decodeUnknownSync(schema)(["a", "b", "c"]) // => ["a", "b", "c"]
|
|
2175
2166
|
* ```
|
|
2176
2167
|
*
|
|
2177
2168
|
* @category constructors
|
|
@@ -2184,13 +2175,12 @@ ArraySchema as Array };
|
|
|
2184
2175
|
*
|
|
2185
2176
|
* **Example** (Defining a non-empty array of numbers)
|
|
2186
2177
|
*
|
|
2187
|
-
* ```ts
|
|
2178
|
+
* ```ts import.meta.vitest
|
|
2188
2179
|
* import { Schema } from "effect"
|
|
2189
2180
|
*
|
|
2190
2181
|
* const schema = Schema.NonEmptyArray(Schema.Number)
|
|
2191
2182
|
*
|
|
2192
|
-
* Schema.decodeUnknownSync(schema)([1, 2, 3])
|
|
2193
|
-
* Schema.decodeUnknownSync(schema)([]) // throws
|
|
2183
|
+
* Schema.decodeUnknownSync(schema)([1, 2, 3]) // => [1, 2, 3]
|
|
2194
2184
|
* ```
|
|
2195
2185
|
*
|
|
2196
2186
|
* @category constructors
|
|
@@ -2250,13 +2240,16 @@ export function UniqueArray(item) {
|
|
|
2250
2240
|
*
|
|
2251
2241
|
* **Example** (Defining mutable arrays)
|
|
2252
2242
|
*
|
|
2253
|
-
* ```ts
|
|
2243
|
+
* ```ts import.meta.vitest
|
|
2254
2244
|
* import { Schema } from "effect"
|
|
2255
2245
|
*
|
|
2256
2246
|
* const schema = Schema.mutable(Schema.Array(Schema.Number))
|
|
2257
2247
|
*
|
|
2258
2248
|
* // number[] (mutable)
|
|
2259
2249
|
* type T = typeof schema.Type
|
|
2250
|
+
* const value: T = [1, 2]
|
|
2251
|
+
* value.push(3)
|
|
2252
|
+
* value // => [1, 2, 3]
|
|
2260
2253
|
* ```
|
|
2261
2254
|
*
|
|
2262
2255
|
* @category transforming
|
|
@@ -2288,13 +2281,13 @@ function makeUnion(ast, members) {
|
|
|
2288
2281
|
*
|
|
2289
2282
|
* **Example** (Defining a string or number union)
|
|
2290
2283
|
*
|
|
2291
|
-
* ```ts
|
|
2284
|
+
* ```ts import.meta.vitest
|
|
2292
2285
|
* import { Schema } from "effect"
|
|
2293
2286
|
*
|
|
2294
2287
|
* const schema = Schema.Union([Schema.String, Schema.Number])
|
|
2295
2288
|
*
|
|
2296
|
-
* Schema.decodeUnknownSync(schema)("hello") // "hello"
|
|
2297
|
-
* Schema.decodeUnknownSync(schema)(42)
|
|
2289
|
+
* Schema.decodeUnknownSync(schema)("hello") // => "hello"
|
|
2290
|
+
* Schema.decodeUnknownSync(schema)(42) // => 42
|
|
2298
2291
|
* ```
|
|
2299
2292
|
*
|
|
2300
2293
|
* @category constructors
|
|
@@ -2308,11 +2301,11 @@ export function Union(members, options) {
|
|
|
2308
2301
|
*
|
|
2309
2302
|
* **Example** (Defining status codes)
|
|
2310
2303
|
*
|
|
2311
|
-
* ```ts
|
|
2304
|
+
* ```ts import.meta.vitest
|
|
2312
2305
|
* import { Schema } from "effect"
|
|
2313
2306
|
*
|
|
2314
2307
|
* const schema = Schema.Literals(["active", "inactive", "pending"])
|
|
2315
|
-
*
|
|
2308
|
+
* Schema.decodeSync(schema)("active") // => "active"
|
|
2316
2309
|
* ```
|
|
2317
2310
|
*
|
|
2318
2311
|
* @see {@link Literal} for a schema that represents a single literal.
|
|
@@ -2363,7 +2356,7 @@ export const NullishOr = /*#__PURE__*/Struct_.lambda(self => Union([self, Null,
|
|
|
2363
2356
|
*
|
|
2364
2357
|
* **Example** (Defining recursive tree schemas)
|
|
2365
2358
|
*
|
|
2366
|
-
* ```ts
|
|
2359
|
+
* ```ts import.meta.vitest
|
|
2367
2360
|
* import { Schema } from "effect"
|
|
2368
2361
|
*
|
|
2369
2362
|
* interface Tree {
|
|
@@ -2375,6 +2368,7 @@ export const NullishOr = /*#__PURE__*/Struct_.lambda(self => Union([self, Null,
|
|
|
2375
2368
|
* value: Schema.Number,
|
|
2376
2369
|
* children: Schema.Array(Schema.suspend((): Schema.Codec<Tree> => Tree))
|
|
2377
2370
|
* })
|
|
2371
|
+
* Schema.decodeSync(Tree)({ value: 1, children: [] }) // => { value: 1, children: [] }
|
|
2378
2372
|
* ```
|
|
2379
2373
|
*
|
|
2380
2374
|
* @category constructors
|
|
@@ -2389,12 +2383,14 @@ export function suspend(f) {
|
|
|
2389
2383
|
*
|
|
2390
2384
|
* **Example** (Adding checks to a schema)
|
|
2391
2385
|
*
|
|
2392
|
-
* ```ts
|
|
2386
|
+
* ```ts import.meta.vitest
|
|
2393
2387
|
* import { Schema } from "effect"
|
|
2394
2388
|
*
|
|
2395
2389
|
* const AgeSchema = Schema.Finite.pipe(
|
|
2396
2390
|
* Schema.check(Schema.isGreaterThanOrEqualTo(0), Schema.isLessThanOrEqualTo(120))
|
|
2397
2391
|
* )
|
|
2392
|
+
* Schema.is(AgeSchema)(42) // => true
|
|
2393
|
+
* Schema.is(AgeSchema)(121) // => false
|
|
2398
2394
|
* ```
|
|
2399
2395
|
*
|
|
2400
2396
|
* @category filtering
|
|
@@ -2471,14 +2467,17 @@ export function fromBrand(identifier, ctor) {
|
|
|
2471
2467
|
*
|
|
2472
2468
|
* **Example** (Logging decode failures)
|
|
2473
2469
|
*
|
|
2474
|
-
* ```ts
|
|
2470
|
+
* ```ts import.meta.vitest
|
|
2475
2471
|
* import { Effect, Schema } from "effect"
|
|
2476
2472
|
*
|
|
2473
|
+
* const events: Array<string> = []
|
|
2477
2474
|
* const Logged = Schema.String.pipe(
|
|
2478
2475
|
* Schema.middlewareDecoding((effect) =>
|
|
2479
|
-
* Effect.tapError(effect, (
|
|
2476
|
+
* Effect.tapError(effect, () => Effect.sync(() => events.push("decode failed")))
|
|
2480
2477
|
* )
|
|
2481
2478
|
* )
|
|
2479
|
+
* Effect.runSync(Effect.result(Schema.decodeUnknownEffect(Logged)(42)))
|
|
2480
|
+
* events // => ["decode failed"]
|
|
2482
2481
|
* ```
|
|
2483
2482
|
*
|
|
2484
2483
|
* @see {@link catchDecoding} for a simpler error-recovery variant
|
|
@@ -2501,14 +2500,17 @@ export function middlewareDecoding(decode) {
|
|
|
2501
2500
|
*
|
|
2502
2501
|
* **Example** (Logging encode failures)
|
|
2503
2502
|
*
|
|
2504
|
-
* ```ts
|
|
2503
|
+
* ```ts import.meta.vitest
|
|
2505
2504
|
* import { Effect, Schema } from "effect"
|
|
2506
2505
|
*
|
|
2506
|
+
* const events: Array<string> = []
|
|
2507
2507
|
* const Logged = Schema.String.pipe(
|
|
2508
2508
|
* Schema.middlewareEncoding((effect) =>
|
|
2509
|
-
* Effect.tapError(effect, (
|
|
2509
|
+
* Effect.tapError(effect, () => Effect.sync(() => events.push("encode failed")))
|
|
2510
2510
|
* )
|
|
2511
2511
|
* )
|
|
2512
|
+
* Effect.runSync(Effect.result(Schema.encodeUnknownEffect(Logged)(42)))
|
|
2513
|
+
* events // => ["encode failed"]
|
|
2512
2514
|
* ```
|
|
2513
2515
|
*
|
|
2514
2516
|
* @see {@link catchEncoding} for a simpler error-recovery variant
|
|
@@ -2530,12 +2532,13 @@ export function middlewareEncoding(encode) {
|
|
|
2530
2532
|
*
|
|
2531
2533
|
* **Example** (Returning a default on decode failure)
|
|
2532
2534
|
*
|
|
2533
|
-
* ```ts
|
|
2535
|
+
* ```ts import.meta.vitest
|
|
2534
2536
|
* import { Effect, Option, Schema } from "effect"
|
|
2535
2537
|
*
|
|
2536
2538
|
* const schema = Schema.Number.pipe(
|
|
2537
2539
|
* Schema.catchDecoding((_issue) => Effect.succeed(Option.some(0)))
|
|
2538
2540
|
* )
|
|
2541
|
+
* Effect.runSync(Schema.decodeUnknownEffect(schema)("invalid")) // => 0
|
|
2539
2542
|
* ```
|
|
2540
2543
|
*
|
|
2541
2544
|
* @see {@link catchDecodingWithContext} to add service requirements to the handler
|
|
@@ -2640,7 +2643,7 @@ export function decodeTo(to, transformation) {
|
|
|
2640
2643
|
*
|
|
2641
2644
|
* **Example** (Trimming string values during encoding/decoding)
|
|
2642
2645
|
*
|
|
2643
|
-
* ```ts
|
|
2646
|
+
* ```ts import.meta.vitest
|
|
2644
2647
|
* import { Schema, SchemaGetter } from "effect"
|
|
2645
2648
|
*
|
|
2646
2649
|
* const Trimmed = Schema.String.pipe(
|
|
@@ -2650,8 +2653,7 @@ export function decodeTo(to, transformation) {
|
|
|
2650
2653
|
* })
|
|
2651
2654
|
* )
|
|
2652
2655
|
*
|
|
2653
|
-
*
|
|
2654
|
-
* // result: "hello"
|
|
2656
|
+
* Schema.decodeUnknownSync(Trimmed)(" hello ") // => "hello"
|
|
2655
2657
|
* ```
|
|
2656
2658
|
*
|
|
2657
2659
|
* @category transforming
|
|
@@ -2678,7 +2680,7 @@ export function encodeTo(to, transformation) {
|
|
|
2678
2680
|
*
|
|
2679
2681
|
* **Example** (Upper-casing encoded strings)
|
|
2680
2682
|
*
|
|
2681
|
-
* ```ts
|
|
2683
|
+
* ```ts import.meta.vitest
|
|
2682
2684
|
* import { Schema, SchemaGetter } from "effect"
|
|
2683
2685
|
*
|
|
2684
2686
|
* const UpperFromLower = Schema.String.pipe(
|
|
@@ -2687,6 +2689,7 @@ export function encodeTo(to, transformation) {
|
|
|
2687
2689
|
* encode: SchemaGetter.transform((s: string) => s.toUpperCase())
|
|
2688
2690
|
* })
|
|
2689
2691
|
* )
|
|
2692
|
+
* Schema.encodeSync(UpperFromLower)("hello") // => "HELLO"
|
|
2690
2693
|
* ```
|
|
2691
2694
|
*
|
|
2692
2695
|
* @category transforming
|
|
@@ -2707,7 +2710,7 @@ export function encode(transformation) {
|
|
|
2707
2710
|
*
|
|
2708
2711
|
* **Example** (Defining an optional field with a static default)
|
|
2709
2712
|
*
|
|
2710
|
-
* ```ts
|
|
2713
|
+
* ```ts import.meta.vitest
|
|
2711
2714
|
* import { Effect, Schema } from "effect"
|
|
2712
2715
|
*
|
|
2713
2716
|
* const MySchema = Schema.Struct({
|
|
@@ -2717,8 +2720,7 @@ export function encode(transformation) {
|
|
|
2717
2720
|
* )
|
|
2718
2721
|
* })
|
|
2719
2722
|
*
|
|
2720
|
-
*
|
|
2721
|
-
* // value: { name: "anonymous" }
|
|
2723
|
+
* MySchema.make({}).name // => "anonymous"
|
|
2722
2724
|
* ```
|
|
2723
2725
|
*
|
|
2724
2726
|
* @category constructors
|
|
@@ -2753,15 +2755,14 @@ function toIssueEffect(self) {
|
|
|
2753
2755
|
*
|
|
2754
2756
|
* **Example** (Providing a default for a missing struct key)
|
|
2755
2757
|
*
|
|
2756
|
-
* ```ts
|
|
2758
|
+
* ```ts import.meta.vitest
|
|
2757
2759
|
* import { Effect, Schema } from "effect"
|
|
2758
2760
|
*
|
|
2759
2761
|
* const MySchema = Schema.Struct({
|
|
2760
2762
|
* name: Schema.String.pipe(Schema.withDecodingDefaultKey(Effect.succeed("anonymous")))
|
|
2761
2763
|
* })
|
|
2762
2764
|
*
|
|
2763
|
-
*
|
|
2764
|
-
* // result: { name: "anonymous" }
|
|
2765
|
+
* Schema.decodeUnknownSync(MySchema)({}).name // => "anonymous"
|
|
2765
2766
|
* ```
|
|
2766
2767
|
*
|
|
2767
2768
|
* @see {@link withDecodingDefault} for the value-level variant (key absent **or** `undefined`)
|
|
@@ -2828,15 +2829,14 @@ export function withDecodingDefaultTypeKey(defaultValue, options) {
|
|
|
2828
2829
|
*
|
|
2829
2830
|
* **Example** (Providing a default for an optional field value)
|
|
2830
2831
|
*
|
|
2831
|
-
* ```ts
|
|
2832
|
+
* ```ts import.meta.vitest
|
|
2832
2833
|
* import { Effect, Schema } from "effect"
|
|
2833
2834
|
*
|
|
2834
2835
|
* const MySchema = Schema.Struct({
|
|
2835
2836
|
* name: Schema.String.pipe(Schema.optional, Schema.withDecodingDefault(Effect.succeed("anonymous")))
|
|
2836
2837
|
* })
|
|
2837
2838
|
*
|
|
2838
|
-
*
|
|
2839
|
-
* // result: { name: "anonymous" }
|
|
2839
|
+
* Schema.decodeUnknownSync(MySchema)({ name: undefined }).name // => "anonymous"
|
|
2840
2840
|
* ```
|
|
2841
2841
|
*
|
|
2842
2842
|
* @see {@link withDecodingDefaultKey} for the key-level variant (key absent only, not `undefined`)
|
|
@@ -2892,14 +2892,14 @@ export function withDecodingDefaultType(defaultValue, options) {
|
|
|
2892
2892
|
*
|
|
2893
2893
|
* **Example** (Defining a discriminated union tag)
|
|
2894
2894
|
*
|
|
2895
|
-
* ```ts
|
|
2895
|
+
* ```ts import.meta.vitest
|
|
2896
2896
|
* import { Schema } from "effect"
|
|
2897
2897
|
*
|
|
2898
2898
|
* const A = Schema.Struct({ _tag: Schema.tag("A"), value: Schema.Number })
|
|
2899
2899
|
*
|
|
2900
2900
|
* // _tag is optional in make, auto-filled to "A"
|
|
2901
2901
|
* const a = A.make({ value: 42 })
|
|
2902
|
-
* //
|
|
2902
|
+
* a // => { _tag: "A", value: 42 }
|
|
2903
2903
|
* ```
|
|
2904
2904
|
*
|
|
2905
2905
|
* @see {@link tagDefaultOmit} to also omit the tag during encoding
|
|
@@ -2925,7 +2925,7 @@ export function tag(literal) {
|
|
|
2925
2925
|
*
|
|
2926
2926
|
* **Example** (Omitting tags during encoding)
|
|
2927
2927
|
*
|
|
2928
|
-
* ```ts
|
|
2928
|
+
* ```ts import.meta.vitest
|
|
2929
2929
|
* import { Schema } from "effect"
|
|
2930
2930
|
*
|
|
2931
2931
|
* const A = Schema.Struct({
|
|
@@ -2934,8 +2934,7 @@ export function tag(literal) {
|
|
|
2934
2934
|
* })
|
|
2935
2935
|
*
|
|
2936
2936
|
* // Encode strips the _tag field
|
|
2937
|
-
*
|
|
2938
|
-
* // encoded: { value: 1 }
|
|
2937
|
+
* Schema.encodeUnknownSync(A)({ _tag: "A", value: 1 }) // => { value: 1 }
|
|
2939
2938
|
* ```
|
|
2940
2939
|
*
|
|
2941
2940
|
* @see {@link tag} for the variant that keeps the tag during encoding
|
|
@@ -2962,7 +2961,7 @@ export function tagDefaultOmit(literal) {
|
|
|
2962
2961
|
*
|
|
2963
2962
|
* **Example** (Defining a tagged struct shorthand)
|
|
2964
2963
|
*
|
|
2965
|
-
* ```ts
|
|
2964
|
+
* ```ts import.meta.vitest
|
|
2966
2965
|
* import { Schema } from "effect"
|
|
2967
2966
|
*
|
|
2968
2967
|
* // Defines a struct with a fixed `_tag` field
|
|
@@ -2975,19 +2974,20 @@ export function tagDefaultOmit(literal) {
|
|
|
2975
2974
|
* _tag: Schema.tag("A"),
|
|
2976
2975
|
* a: Schema.String
|
|
2977
2976
|
* })
|
|
2977
|
+
* void tagged
|
|
2978
|
+
* void equivalent
|
|
2978
2979
|
* ```
|
|
2979
2980
|
*
|
|
2980
2981
|
* **Example** (Accessing the literal value of the tag)
|
|
2981
2982
|
*
|
|
2982
|
-
* ```ts
|
|
2983
|
+
* ```ts import.meta.vitest
|
|
2983
2984
|
* import { Schema } from "effect"
|
|
2984
2985
|
*
|
|
2985
2986
|
* const tagged = Schema.TaggedStruct("A", {
|
|
2986
2987
|
* a: Schema.String
|
|
2987
2988
|
* })
|
|
2988
2989
|
*
|
|
2989
|
-
* //
|
|
2990
|
-
* const literal = tagged.fields._tag.schema.literal
|
|
2990
|
+
* tagged.fields._tag.schema.literal // => "A"
|
|
2991
2991
|
* ```
|
|
2992
2992
|
*
|
|
2993
2993
|
* @category constructors
|
|
@@ -3009,7 +3009,7 @@ export function TaggedStruct(value, fields) {
|
|
|
3009
3009
|
*
|
|
3010
3010
|
* **Example** (Adding tagged-union utilities to an existing union)
|
|
3011
3011
|
*
|
|
3012
|
-
* ```ts
|
|
3012
|
+
* ```ts import.meta.vitest
|
|
3013
3013
|
* import { Schema } from "effect"
|
|
3014
3014
|
*
|
|
3015
3015
|
* const A = Schema.TaggedStruct("A", { value: Schema.Number })
|
|
@@ -3022,6 +3022,7 @@ export function TaggedStruct(value, fields) {
|
|
|
3022
3022
|
* A: (a) => `number: ${a.value}`,
|
|
3023
3023
|
* B: (b) => `name: ${b.name}`
|
|
3024
3024
|
* })
|
|
3025
|
+
* result // => "number: 1"
|
|
3025
3026
|
* ```
|
|
3026
3027
|
*
|
|
3027
3028
|
* @see {@link TaggedUnion} for a shorthand that builds the union from scratch
|
|
@@ -3089,7 +3090,7 @@ export function toTaggedUnion(tag) {
|
|
|
3089
3090
|
*
|
|
3090
3091
|
* **Example** (Pattern matching a discriminated union)
|
|
3091
3092
|
*
|
|
3092
|
-
* ```ts
|
|
3093
|
+
* ```ts import.meta.vitest
|
|
3093
3094
|
* import { Schema } from "effect"
|
|
3094
3095
|
*
|
|
3095
3096
|
* const Shape = Schema.TaggedUnion({
|
|
@@ -3102,6 +3103,7 @@ export function toTaggedUnion(tag) {
|
|
|
3102
3103
|
* Circle: (c) => Math.PI * c.radius ** 2,
|
|
3103
3104
|
* Rectangle: (r) => r.width * r.height
|
|
3104
3105
|
* })
|
|
3106
|
+
* Math.round(area * 100) / 100 // => 78.54
|
|
3105
3107
|
* ```
|
|
3106
3108
|
*
|
|
3107
3109
|
* @see {@link toTaggedUnion} to augment an existing union instead
|
|
@@ -3136,7 +3138,7 @@ export function TaggedUnion(casesByTag) {
|
|
|
3136
3138
|
*
|
|
3137
3139
|
* **Example** (Defining opaque structs)
|
|
3138
3140
|
*
|
|
3139
|
-
* ```ts
|
|
3141
|
+
* ```ts import.meta.vitest
|
|
3140
3142
|
* import { Schema } from "effect"
|
|
3141
3143
|
*
|
|
3142
3144
|
* class Person extends Schema.Opaque<Person>()(
|
|
@@ -3147,7 +3149,7 @@ export function TaggedUnion(casesByTag) {
|
|
|
3147
3149
|
*
|
|
3148
3150
|
* // Decoded value is Person, not { name: string }
|
|
3149
3151
|
* const person = Schema.decodeUnknownSync(Person)({ name: "Alice" })
|
|
3150
|
-
* //
|
|
3152
|
+
* person.name // => "Alice"
|
|
3151
3153
|
* ```
|
|
3152
3154
|
*
|
|
3153
3155
|
* @category constructors
|
|
@@ -3164,13 +3166,13 @@ export function Opaque() {
|
|
|
3164
3166
|
*
|
|
3165
3167
|
* **Example** (Defining a schema for a built-in class)
|
|
3166
3168
|
*
|
|
3167
|
-
* ```ts
|
|
3169
|
+
* ```ts import.meta.vitest
|
|
3168
3170
|
* import { Schema } from "effect"
|
|
3169
3171
|
*
|
|
3170
3172
|
* const DateSchema = Schema.instanceOf(Date)
|
|
3171
3173
|
*
|
|
3172
3174
|
* const decoded = Schema.decodeUnknownSync(DateSchema)(new Date("2024-01-01"))
|
|
3173
|
-
* //
|
|
3175
|
+
* decoded.toISOString() // => "2024-01-01T00:00:00.000Z"
|
|
3174
3176
|
* ```
|
|
3175
3177
|
*
|
|
3176
3178
|
* @category constructors
|
|
@@ -3210,8 +3212,8 @@ export function link() {
|
|
|
3210
3212
|
*
|
|
3211
3213
|
* **Example** (Reporting failure at a nested path)
|
|
3212
3214
|
*
|
|
3213
|
-
* ```ts
|
|
3214
|
-
* import { Schema } from "effect"
|
|
3215
|
+
* ```ts import.meta.vitest
|
|
3216
|
+
* import { Result, Schema } from "effect"
|
|
3215
3217
|
*
|
|
3216
3218
|
* const schema = Schema.Struct({ password: Schema.String, confirmPassword: Schema.String }).check(
|
|
3217
3219
|
* Schema.makeFilter((o) =>
|
|
@@ -3221,15 +3223,16 @@ export function link() {
|
|
|
3221
3223
|
* )
|
|
3222
3224
|
* )
|
|
3223
3225
|
*
|
|
3224
|
-
*
|
|
3225
|
-
*
|
|
3226
|
-
* //
|
|
3226
|
+
* const result = Schema.decodeUnknownResult(schema)({ password: "123456", confirmPassword: "1234567" })
|
|
3227
|
+
* if (Result.isFailure(result) && result.failure.issue._tag === "Filter" && result.failure.issue.issue._tag === "Pointer") {
|
|
3228
|
+
* result.failure.issue.issue.path // => ["password"]
|
|
3229
|
+
* }
|
|
3227
3230
|
* ```
|
|
3228
3231
|
*
|
|
3229
3232
|
* **Example** (Reporting multiple failures at once)
|
|
3230
3233
|
*
|
|
3231
|
-
* ```ts
|
|
3232
|
-
* import { Schema } from "effect"
|
|
3234
|
+
* ```ts import.meta.vitest
|
|
3235
|
+
* import { Result, Schema } from "effect"
|
|
3233
3236
|
*
|
|
3234
3237
|
* const schema = Schema.Struct({ a: Schema.Finite, b: Schema.Finite, c: Schema.Finite }).check(
|
|
3235
3238
|
* Schema.makeFilter((o) => {
|
|
@@ -3242,11 +3245,10 @@ export function link() {
|
|
|
3242
3245
|
* })
|
|
3243
3246
|
* )
|
|
3244
3247
|
*
|
|
3245
|
-
*
|
|
3246
|
-
*
|
|
3247
|
-
* //
|
|
3248
|
-
*
|
|
3249
|
-
* // at ["c"])]))
|
|
3248
|
+
* const result = Schema.decodeUnknownResult(schema)({ a: 1, b: 0, c: 0 })
|
|
3249
|
+
* if (Result.isFailure(result) && result.failure.issue._tag === "Filter" && result.failure.issue.issue._tag === "Composite") {
|
|
3250
|
+
* result.failure.issue.issue.issues.map((issue) => issue._tag === "Pointer" ? issue.path : []) // => [["b"], ["c"]]
|
|
3251
|
+
* }
|
|
3250
3252
|
* ```
|
|
3251
3253
|
*
|
|
3252
3254
|
* @category constructors
|
|
@@ -3284,7 +3286,7 @@ const TRIMMED_PATTERN = "^\\S[\\s\\S]*\\S$|^\\S$|^$";
|
|
|
3284
3286
|
* When generating test data with fast-check, this applies a `patterns`
|
|
3285
3287
|
* constraint to ensure generated strings match the trimmed pattern.
|
|
3286
3288
|
*
|
|
3287
|
-
* @category
|
|
3289
|
+
* @category validation
|
|
3288
3290
|
* @since 4.0.0
|
|
3289
3291
|
*/
|
|
3290
3292
|
export function isTrimmed(annotations) {
|
|
@@ -3318,7 +3320,7 @@ export function isTrimmed(annotations) {
|
|
|
3318
3320
|
*
|
|
3319
3321
|
* @see {@link isTrimmed} for creating the corresponding check
|
|
3320
3322
|
*
|
|
3321
|
-
* @category
|
|
3323
|
+
* @category validation
|
|
3322
3324
|
* @since 4.0.0
|
|
3323
3325
|
*/
|
|
3324
3326
|
export const isTrimmedReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isTrimmed", Null, ({
|
|
@@ -3338,7 +3340,7 @@ export const isTrimmedReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("e
|
|
|
3338
3340
|
* When generating test data with fast-check, this applies a `patterns`
|
|
3339
3341
|
* constraint to ensure generated strings match the specified RegExp pattern.
|
|
3340
3342
|
*
|
|
3341
|
-
* @category
|
|
3343
|
+
* @category validation
|
|
3342
3344
|
* @since 4.0.0
|
|
3343
3345
|
*/
|
|
3344
3346
|
export function isPattern(regExp, annotations) {
|
|
@@ -3368,7 +3370,7 @@ const IsPatternPayload = /*#__PURE__*/Struct({
|
|
|
3368
3370
|
*
|
|
3369
3371
|
* @see {@link isPattern} for creating the corresponding check
|
|
3370
3372
|
*
|
|
3371
|
-
* @category
|
|
3373
|
+
* @category validation
|
|
3372
3374
|
* @since 4.0.0
|
|
3373
3375
|
*/
|
|
3374
3376
|
export const isPatternReviver = {
|
|
@@ -3394,7 +3396,7 @@ export const isPatternReviver = {
|
|
|
3394
3396
|
* When generating test data with fast-check, this applies a `patterns`
|
|
3395
3397
|
* constraint to ensure generated strings match the number string pattern.
|
|
3396
3398
|
*
|
|
3397
|
-
* @category
|
|
3399
|
+
* @category validation
|
|
3398
3400
|
* @since 4.0.0
|
|
3399
3401
|
*/
|
|
3400
3402
|
export function isStringFinite(annotations) {
|
|
@@ -3414,7 +3416,7 @@ export function isStringFinite(annotations) {
|
|
|
3414
3416
|
*
|
|
3415
3417
|
* @see {@link isStringFinite} for creating the corresponding check
|
|
3416
3418
|
*
|
|
3417
|
-
* @category
|
|
3419
|
+
* @category validation
|
|
3418
3420
|
* @since 4.0.0
|
|
3419
3421
|
*/
|
|
3420
3422
|
export const isStringFiniteReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isStringFinite", Null, ({
|
|
@@ -3434,7 +3436,7 @@ export const isStringFiniteReviver = /*#__PURE__*/InternalSchema.makeFilterReviv
|
|
|
3434
3436
|
* This check corresponds to a `pattern` constraint with the same signed
|
|
3435
3437
|
* base-10 integer pattern.
|
|
3436
3438
|
*
|
|
3437
|
-
* @category
|
|
3439
|
+
* @category validation
|
|
3438
3440
|
* @since 4.0.0
|
|
3439
3441
|
*/
|
|
3440
3442
|
export function isStringBigInt(annotations) {
|
|
@@ -3454,7 +3456,7 @@ export function isStringBigInt(annotations) {
|
|
|
3454
3456
|
*
|
|
3455
3457
|
* @see {@link isStringBigInt} for creating the corresponding check
|
|
3456
3458
|
*
|
|
3457
|
-
* @category
|
|
3459
|
+
* @category validation
|
|
3458
3460
|
* @since 4.0.0
|
|
3459
3461
|
*/
|
|
3460
3462
|
export const isStringBigIntReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isStringBigInt", Null, ({
|
|
@@ -3469,7 +3471,7 @@ export const isStringBigIntReviver = /*#__PURE__*/InternalSchema.makeFilterReviv
|
|
|
3469
3471
|
* The check uses the pattern `^Symbol\((.*)\)$`. It is not a general test for
|
|
3470
3472
|
* whether a string can be passed to JavaScript's `Symbol()` function.
|
|
3471
3473
|
*
|
|
3472
|
-
* @category
|
|
3474
|
+
* @category validation
|
|
3473
3475
|
* @since 4.0.0
|
|
3474
3476
|
*/
|
|
3475
3477
|
export function isStringSymbol(annotations) {
|
|
@@ -3489,7 +3491,7 @@ export function isStringSymbol(annotations) {
|
|
|
3489
3491
|
*
|
|
3490
3492
|
* @see {@link isStringSymbol} for creating the corresponding check
|
|
3491
3493
|
*
|
|
3492
|
-
* @category
|
|
3494
|
+
* @category validation
|
|
3493
3495
|
* @since 4.0.0
|
|
3494
3496
|
*/
|
|
3495
3497
|
export const isStringSymbolReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isStringSymbol", Null, ({
|
|
@@ -3533,7 +3535,7 @@ const getUUIDRegExp = version => {
|
|
|
3533
3535
|
* constraint to ensure generated strings match the UUID pattern.
|
|
3534
3536
|
*
|
|
3535
3537
|
* @see {@link isGUID} for shape-only GUID validation.
|
|
3536
|
-
* @category
|
|
3538
|
+
* @category validation
|
|
3537
3539
|
* @since 4.0.0
|
|
3538
3540
|
*/
|
|
3539
3541
|
export function isUUID(version, annotations) {
|
|
@@ -3565,7 +3567,7 @@ export function isUUID(version, annotations) {
|
|
|
3565
3567
|
*
|
|
3566
3568
|
* @see {@link isUUID} for creating the corresponding check
|
|
3567
3569
|
*
|
|
3568
|
-
* @category
|
|
3570
|
+
* @category validation
|
|
3569
3571
|
* @since 4.0.0
|
|
3570
3572
|
*/
|
|
3571
3573
|
export const isUUIDReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isUUID", /*#__PURE__*/Struct({
|
|
@@ -3596,7 +3598,7 @@ const GUID_REGEXP = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{
|
|
|
3596
3598
|
* constraint to ensure generated strings match the GUID pattern.
|
|
3597
3599
|
*
|
|
3598
3600
|
* @see {@link isUUID} for strict UUID validation.
|
|
3599
|
-
* @category
|
|
3601
|
+
* @category validation
|
|
3600
3602
|
* @since 4.0.0
|
|
3601
3603
|
*/
|
|
3602
3604
|
export function isGUID(annotations) {
|
|
@@ -3624,7 +3626,7 @@ export function isGUID(annotations) {
|
|
|
3624
3626
|
*
|
|
3625
3627
|
* @see {@link isGUID} for creating the corresponding check
|
|
3626
3628
|
*
|
|
3627
|
-
* @category
|
|
3629
|
+
* @category validation
|
|
3628
3630
|
* @since 4.0.0
|
|
3629
3631
|
*/
|
|
3630
3632
|
export const isGUIDReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isGUID", Null, ({
|
|
@@ -3646,7 +3648,7 @@ export const isGUIDReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effe
|
|
|
3646
3648
|
* When generating test data with fast-check, this applies a `patterns`
|
|
3647
3649
|
* constraint to ensure generated strings match the ULID pattern.
|
|
3648
3650
|
*
|
|
3649
|
-
* @category
|
|
3651
|
+
* @category validation
|
|
3650
3652
|
* @since 4.0.0
|
|
3651
3653
|
*/
|
|
3652
3654
|
export function isULID(annotations) {
|
|
@@ -3674,7 +3676,7 @@ export function isULID(annotations) {
|
|
|
3674
3676
|
*
|
|
3675
3677
|
* @see {@link isULID} for creating the corresponding check
|
|
3676
3678
|
*
|
|
3677
|
-
* @category
|
|
3679
|
+
* @category validation
|
|
3678
3680
|
* @since 4.0.0
|
|
3679
3681
|
*/
|
|
3680
3682
|
export const isULIDReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isULID", Null, ({
|
|
@@ -3695,7 +3697,7 @@ export const isULIDReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effe
|
|
|
3695
3697
|
* When generating test data with fast-check, this applies a `patterns`
|
|
3696
3698
|
* constraint to ensure generated strings match the Base64 pattern.
|
|
3697
3699
|
*
|
|
3698
|
-
* @category
|
|
3700
|
+
* @category validation
|
|
3699
3701
|
* @since 4.0.0
|
|
3700
3702
|
*/
|
|
3701
3703
|
export function isBase64(annotations) {
|
|
@@ -3724,7 +3726,7 @@ export function isBase64(annotations) {
|
|
|
3724
3726
|
*
|
|
3725
3727
|
* @see {@link isBase64} for creating the corresponding check
|
|
3726
3728
|
*
|
|
3727
|
-
* @category
|
|
3729
|
+
* @category validation
|
|
3728
3730
|
* @since 4.0.0
|
|
3729
3731
|
*/
|
|
3730
3732
|
export const isBase64Reviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isBase64", Null, ({
|
|
@@ -3746,7 +3748,7 @@ export const isBase64Reviver = /*#__PURE__*/InternalSchema.makeFilterReviver("ef
|
|
|
3746
3748
|
* When generating test data with fast-check, this applies a `patterns`
|
|
3747
3749
|
* constraint to ensure generated strings match the Base64URL pattern.
|
|
3748
3750
|
*
|
|
3749
|
-
* @category
|
|
3751
|
+
* @category validation
|
|
3750
3752
|
* @since 4.0.0
|
|
3751
3753
|
*/
|
|
3752
3754
|
export function isBase64Url(annotations) {
|
|
@@ -3775,7 +3777,7 @@ export function isBase64Url(annotations) {
|
|
|
3775
3777
|
*
|
|
3776
3778
|
* @see {@link isBase64Url} for creating the corresponding check
|
|
3777
3779
|
*
|
|
3778
|
-
* @category
|
|
3780
|
+
* @category validation
|
|
3779
3781
|
* @since 4.0.0
|
|
3780
3782
|
*/
|
|
3781
3783
|
export const isBase64UrlReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isBase64Url", Null, ({
|
|
@@ -3789,7 +3791,7 @@ export const isBase64UrlReviver = /*#__PURE__*/InternalSchema.makeFilterReviver(
|
|
|
3789
3791
|
* RegExp metacharacters in the prefix are escaped in JSON Schema and arbitrary
|
|
3790
3792
|
* metadata so that the generated patterns retain literal `startsWith` semantics.
|
|
3791
3793
|
*
|
|
3792
|
-
* @category
|
|
3794
|
+
* @category validation
|
|
3793
3795
|
* @since 4.0.0
|
|
3794
3796
|
*/
|
|
3795
3797
|
export function isStartsWith(startsWith, annotations) {
|
|
@@ -3826,7 +3828,7 @@ export function isStartsWith(startsWith, annotations) {
|
|
|
3826
3828
|
*
|
|
3827
3829
|
* @see {@link isStartsWith} for creating the corresponding check
|
|
3828
3830
|
*
|
|
3829
|
-
* @category
|
|
3831
|
+
* @category validation
|
|
3830
3832
|
* @since 4.0.0
|
|
3831
3833
|
*/
|
|
3832
3834
|
export const isStartsWithReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isStartsWith", /*#__PURE__*/Struct({
|
|
@@ -3843,7 +3845,7 @@ export const isStartsWithReviver = /*#__PURE__*/InternalSchema.makeFilterReviver
|
|
|
3843
3845
|
* RegExp metacharacters in the suffix are escaped in JSON Schema and arbitrary
|
|
3844
3846
|
* metadata so that the generated patterns retain literal `endsWith` semantics.
|
|
3845
3847
|
*
|
|
3846
|
-
* @category
|
|
3848
|
+
* @category validation
|
|
3847
3849
|
* @since 4.0.0
|
|
3848
3850
|
*/
|
|
3849
3851
|
export function isEndsWith(endsWith, annotations) {
|
|
@@ -3880,7 +3882,7 @@ export function isEndsWith(endsWith, annotations) {
|
|
|
3880
3882
|
*
|
|
3881
3883
|
* @see {@link isEndsWith} for creating the corresponding check
|
|
3882
3884
|
*
|
|
3883
|
-
* @category
|
|
3885
|
+
* @category validation
|
|
3884
3886
|
* @since 4.0.0
|
|
3885
3887
|
*/
|
|
3886
3888
|
export const isEndsWithReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isEndsWith", /*#__PURE__*/Struct({
|
|
@@ -3898,7 +3900,7 @@ export const isEndsWithReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("
|
|
|
3898
3900
|
* arbitrary metadata so that the generated patterns retain literal `includes`
|
|
3899
3901
|
* semantics.
|
|
3900
3902
|
*
|
|
3901
|
-
* @category
|
|
3903
|
+
* @category validation
|
|
3902
3904
|
* @since 4.0.0
|
|
3903
3905
|
*/
|
|
3904
3906
|
export function isIncludes(includes, annotations) {
|
|
@@ -3935,7 +3937,7 @@ export function isIncludes(includes, annotations) {
|
|
|
3935
3937
|
*
|
|
3936
3938
|
* @see {@link isIncludes} for creating the corresponding check
|
|
3937
3939
|
*
|
|
3938
|
-
* @category
|
|
3940
|
+
* @category validation
|
|
3939
3941
|
* @since 4.0.0
|
|
3940
3942
|
*/
|
|
3941
3943
|
export const isIncludesReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isIncludes", /*#__PURE__*/Struct({
|
|
@@ -3954,7 +3956,7 @@ const UPPERCASED_PATTERN = "^[^a-z]*$";
|
|
|
3954
3956
|
* such as digits, punctuation, and whitespace. It rejects strings that would
|
|
3955
3957
|
* change when uppercased.
|
|
3956
3958
|
*
|
|
3957
|
-
* @category
|
|
3959
|
+
* @category validation
|
|
3958
3960
|
* @since 4.0.0
|
|
3959
3961
|
*/
|
|
3960
3962
|
export function isUppercased(annotations) {
|
|
@@ -3988,7 +3990,7 @@ export function isUppercased(annotations) {
|
|
|
3988
3990
|
*
|
|
3989
3991
|
* @see {@link isUppercased} for creating the corresponding check
|
|
3990
3992
|
*
|
|
3991
|
-
* @category
|
|
3993
|
+
* @category validation
|
|
3992
3994
|
* @since 4.0.0
|
|
3993
3995
|
*/
|
|
3994
3996
|
export const isUppercasedReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isUppercased", Null, ({
|
|
@@ -4004,7 +4006,7 @@ const LOWERCASED_PATTERN = "^[^A-Z]*$";
|
|
|
4004
4006
|
* such as digits, punctuation, and whitespace. It rejects strings that would
|
|
4005
4007
|
* change when lowercased.
|
|
4006
4008
|
*
|
|
4007
|
-
* @category
|
|
4009
|
+
* @category validation
|
|
4008
4010
|
* @since 4.0.0
|
|
4009
4011
|
*/
|
|
4010
4012
|
export function isLowercased(annotations) {
|
|
@@ -4038,7 +4040,7 @@ export function isLowercased(annotations) {
|
|
|
4038
4040
|
*
|
|
4039
4041
|
* @see {@link isLowercased} for creating the corresponding check
|
|
4040
4042
|
*
|
|
4041
|
-
* @category
|
|
4043
|
+
* @category validation
|
|
4042
4044
|
* @since 4.0.0
|
|
4043
4045
|
*/
|
|
4044
4046
|
export const isLowercasedReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isLowercased", Null, ({
|
|
@@ -4054,7 +4056,7 @@ const CAPITALIZED_PATTERN = "^[^a-z]?.*$";
|
|
|
4054
4056
|
* Empty strings pass. Strings whose first character has no lowercase form, such
|
|
4055
4057
|
* as a digit, punctuation mark, or whitespace, also pass.
|
|
4056
4058
|
*
|
|
4057
|
-
* @category
|
|
4059
|
+
* @category validation
|
|
4058
4060
|
* @since 4.0.0
|
|
4059
4061
|
*/
|
|
4060
4062
|
export function isCapitalized(annotations) {
|
|
@@ -4088,7 +4090,7 @@ export function isCapitalized(annotations) {
|
|
|
4088
4090
|
*
|
|
4089
4091
|
* @see {@link isCapitalized} for creating the corresponding check
|
|
4090
4092
|
*
|
|
4091
|
-
* @category
|
|
4093
|
+
* @category validation
|
|
4092
4094
|
* @since 4.0.0
|
|
4093
4095
|
*/
|
|
4094
4096
|
export const isCapitalizedReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isCapitalized", Null, ({
|
|
@@ -4104,7 +4106,7 @@ const UNCAPITALIZED_PATTERN = "^[^A-Z]?.*$";
|
|
|
4104
4106
|
* Empty strings pass. Strings whose first character has no uppercase form, such
|
|
4105
4107
|
* as a digit, punctuation mark, or whitespace, also pass.
|
|
4106
4108
|
*
|
|
4107
|
-
* @category
|
|
4109
|
+
* @category validation
|
|
4108
4110
|
* @since 4.0.0
|
|
4109
4111
|
*/
|
|
4110
4112
|
export function isUncapitalized(annotations) {
|
|
@@ -4138,7 +4140,7 @@ export function isUncapitalized(annotations) {
|
|
|
4138
4140
|
*
|
|
4139
4141
|
* @see {@link isUncapitalized} for creating the corresponding check
|
|
4140
4142
|
*
|
|
4141
|
-
* @category
|
|
4143
|
+
* @category validation
|
|
4142
4144
|
* @since 4.0.0
|
|
4143
4145
|
*/
|
|
4144
4146
|
export const isUncapitalizedReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isUncapitalized", Null, ({
|
|
@@ -4147,7 +4149,7 @@ export const isUncapitalizedReviver = /*#__PURE__*/InternalSchema.makeFilterRevi
|
|
|
4147
4149
|
/**
|
|
4148
4150
|
* Schema for finite numbers, rejecting `NaN`, `Infinity`, and `-Infinity`.
|
|
4149
4151
|
*
|
|
4150
|
-
* @category
|
|
4152
|
+
* @category schemas
|
|
4151
4153
|
* @since 3.10.0
|
|
4152
4154
|
*/
|
|
4153
4155
|
export const Finite = /*#__PURE__*/make(SchemaAST.finite);
|
|
@@ -4166,7 +4168,7 @@ export const Finite = /*#__PURE__*/make(SchemaAST.finite);
|
|
|
4166
4168
|
* When generating test data with fast-check, this applies `noNaN: true` and
|
|
4167
4169
|
* `noInfinity: true` constraints to ensure generated numbers are finite.
|
|
4168
4170
|
*
|
|
4169
|
-
* @category
|
|
4171
|
+
* @category validation
|
|
4170
4172
|
* @since 4.0.0
|
|
4171
4173
|
*/
|
|
4172
4174
|
export const isFinite = SchemaAST.isFinite;
|
|
@@ -4179,7 +4181,7 @@ export const isFinite = SchemaAST.isFinite;
|
|
|
4179
4181
|
*
|
|
4180
4182
|
* @see {@link isFinite} for creating the corresponding check
|
|
4181
4183
|
*
|
|
4182
|
-
* @category
|
|
4184
|
+
* @category validation
|
|
4183
4185
|
* @since 4.0.0
|
|
4184
4186
|
*/
|
|
4185
4187
|
export const isFiniteReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isFinite", Null, ({
|
|
@@ -4189,7 +4191,7 @@ export const isFiniteReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("ef
|
|
|
4189
4191
|
* Creates a greater-than (`>`) check for any ordered type from an
|
|
4190
4192
|
* `Order.Order` instance.
|
|
4191
4193
|
*
|
|
4192
|
-
* @category
|
|
4194
|
+
* @category validation
|
|
4193
4195
|
* @since 4.0.0
|
|
4194
4196
|
*/
|
|
4195
4197
|
export function makeIsGreaterThan(options) {
|
|
@@ -4216,7 +4218,7 @@ export function makeIsGreaterThan(options) {
|
|
|
4216
4218
|
* Creates a greater-than-or-equal-to (`>=`) check for any ordered type from an
|
|
4217
4219
|
* `Order.Order` instance.
|
|
4218
4220
|
*
|
|
4219
|
-
* @category
|
|
4221
|
+
* @category validation
|
|
4220
4222
|
* @since 4.0.0
|
|
4221
4223
|
*/
|
|
4222
4224
|
export function makeIsGreaterThanOrEqualTo(options) {
|
|
@@ -4242,7 +4244,7 @@ export function makeIsGreaterThanOrEqualTo(options) {
|
|
|
4242
4244
|
* Creates a less-than (`<`) check for any ordered type from an `Order.Order`
|
|
4243
4245
|
* instance.
|
|
4244
4246
|
*
|
|
4245
|
-
* @category
|
|
4247
|
+
* @category validation
|
|
4246
4248
|
* @since 4.0.0
|
|
4247
4249
|
*/
|
|
4248
4250
|
export function makeIsLessThan(options) {
|
|
@@ -4269,7 +4271,7 @@ export function makeIsLessThan(options) {
|
|
|
4269
4271
|
* Creates a less-than-or-equal-to (`<=`) check for any ordered type from an
|
|
4270
4272
|
* `Order.Order` instance.
|
|
4271
4273
|
*
|
|
4272
|
-
* @category
|
|
4274
|
+
* @category validation
|
|
4273
4275
|
* @since 4.0.0
|
|
4274
4276
|
*/
|
|
4275
4277
|
export function makeIsLessThanOrEqualTo(options) {
|
|
@@ -4295,7 +4297,7 @@ export function makeIsLessThanOrEqualTo(options) {
|
|
|
4295
4297
|
* Creates an inclusive or exclusive range check for any ordered type from an
|
|
4296
4298
|
* `Order.Order` instance.
|
|
4297
4299
|
*
|
|
4298
|
-
* @category
|
|
4300
|
+
* @category validation
|
|
4299
4301
|
* @since 4.0.0
|
|
4300
4302
|
*/
|
|
4301
4303
|
export function makeIsBetween(deriveOptions) {
|
|
@@ -4333,7 +4335,7 @@ export function makeIsBetween(deriveOptions) {
|
|
|
4333
4335
|
* Creates a divisibility check for any numeric type from a remainder function
|
|
4334
4336
|
* and a zero value.
|
|
4335
4337
|
*
|
|
4336
|
-
* @category
|
|
4338
|
+
* @category validation
|
|
4337
4339
|
* @since 4.0.0
|
|
4338
4340
|
*/
|
|
4339
4341
|
export function makeIsMultipleOf(options) {
|
|
@@ -4367,7 +4369,7 @@ function encodeNumberPayload(number) {
|
|
|
4367
4369
|
* `exclusiveMinimum` constraint to ensure generated numbers are greater than
|
|
4368
4370
|
* the specified value.
|
|
4369
4371
|
*
|
|
4370
|
-
* @category
|
|
4372
|
+
* @category validation
|
|
4371
4373
|
* @since 4.0.0
|
|
4372
4374
|
*/
|
|
4373
4375
|
export const isGreaterThan = /*#__PURE__*/makeIsGreaterThan({
|
|
@@ -4396,7 +4398,7 @@ export const isGreaterThan = /*#__PURE__*/makeIsGreaterThan({
|
|
|
4396
4398
|
*
|
|
4397
4399
|
* @see {@link isGreaterThan} for creating the corresponding check
|
|
4398
4400
|
*
|
|
4399
|
-
* @category
|
|
4401
|
+
* @category validation
|
|
4400
4402
|
* @since 4.0.0
|
|
4401
4403
|
*/
|
|
4402
4404
|
export const isGreaterThanReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isGreaterThan", /*#__PURE__*/Struct({
|
|
@@ -4420,7 +4422,7 @@ export const isGreaterThanReviver = /*#__PURE__*/InternalSchema.makeFilterRevive
|
|
|
4420
4422
|
* When generating test data with fast-check, this applies a `minimum` constraint
|
|
4421
4423
|
* to ensure generated numbers are greater than or equal to the specified value.
|
|
4422
4424
|
*
|
|
4423
|
-
* @category
|
|
4425
|
+
* @category validation
|
|
4424
4426
|
* @since 4.0.0
|
|
4425
4427
|
*/
|
|
4426
4428
|
export const isGreaterThanOrEqualTo = /*#__PURE__*/makeIsGreaterThanOrEqualTo({
|
|
@@ -4449,7 +4451,7 @@ export const isGreaterThanOrEqualTo = /*#__PURE__*/makeIsGreaterThanOrEqualTo({
|
|
|
4449
4451
|
*
|
|
4450
4452
|
* @see {@link isGreaterThanOrEqualTo} for creating the corresponding check
|
|
4451
4453
|
*
|
|
4452
|
-
* @category
|
|
4454
|
+
* @category validation
|
|
4453
4455
|
* @since 4.0.0
|
|
4454
4456
|
*/
|
|
4455
4457
|
export const isGreaterThanOrEqualToReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isGreaterThanOrEqualTo", /*#__PURE__*/Struct({
|
|
@@ -4473,7 +4475,7 @@ export const isGreaterThanOrEqualToReviver = /*#__PURE__*/InternalSchema.makeFil
|
|
|
4473
4475
|
* `exclusiveMaximum` constraint to ensure generated numbers are less than the
|
|
4474
4476
|
* specified value.
|
|
4475
4477
|
*
|
|
4476
|
-
* @category
|
|
4478
|
+
* @category validation
|
|
4477
4479
|
* @since 4.0.0
|
|
4478
4480
|
*/
|
|
4479
4481
|
export const isLessThan = /*#__PURE__*/makeIsLessThan({
|
|
@@ -4502,7 +4504,7 @@ export const isLessThan = /*#__PURE__*/makeIsLessThan({
|
|
|
4502
4504
|
*
|
|
4503
4505
|
* @see {@link isLessThan} for creating the corresponding check
|
|
4504
4506
|
*
|
|
4505
|
-
* @category
|
|
4507
|
+
* @category validation
|
|
4506
4508
|
* @since 4.0.0
|
|
4507
4509
|
*/
|
|
4508
4510
|
export const isLessThanReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isLessThan", /*#__PURE__*/Struct({
|
|
@@ -4526,7 +4528,7 @@ export const isLessThanReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("
|
|
|
4526
4528
|
* When generating test data with fast-check, this applies a `maximum` constraint
|
|
4527
4529
|
* to ensure generated numbers are less than or equal to the specified value.
|
|
4528
4530
|
*
|
|
4529
|
-
* @category
|
|
4531
|
+
* @category validation
|
|
4530
4532
|
* @since 4.0.0
|
|
4531
4533
|
*/
|
|
4532
4534
|
export const isLessThanOrEqualTo = /*#__PURE__*/makeIsLessThanOrEqualTo({
|
|
@@ -4555,7 +4557,7 @@ export const isLessThanOrEqualTo = /*#__PURE__*/makeIsLessThanOrEqualTo({
|
|
|
4555
4557
|
*
|
|
4556
4558
|
* @see {@link isLessThanOrEqualTo} for creating the corresponding check
|
|
4557
4559
|
*
|
|
4558
|
-
* @category
|
|
4560
|
+
* @category validation
|
|
4559
4561
|
* @since 4.0.0
|
|
4560
4562
|
*/
|
|
4561
4563
|
export const isLessThanOrEqualToReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isLessThanOrEqualTo", /*#__PURE__*/Struct({
|
|
@@ -4582,7 +4584,7 @@ export const isLessThanOrEqualToReviver = /*#__PURE__*/InternalSchema.makeFilter
|
|
|
4582
4584
|
* `exclusiveMaximum` flags to ensure generated numbers fall within the
|
|
4583
4585
|
* specified range.
|
|
4584
4586
|
*
|
|
4585
|
-
* @category
|
|
4587
|
+
* @category validation
|
|
4586
4588
|
* @since 4.0.0
|
|
4587
4589
|
*/
|
|
4588
4590
|
export const isBetween = /*#__PURE__*/makeIsBetween({
|
|
@@ -4624,7 +4626,7 @@ export const isBetween = /*#__PURE__*/makeIsBetween({
|
|
|
4624
4626
|
*
|
|
4625
4627
|
* @see {@link isBetween} for creating the corresponding check
|
|
4626
4628
|
*
|
|
4627
|
-
* @category
|
|
4629
|
+
* @category validation
|
|
4628
4630
|
* @since 4.0.0
|
|
4629
4631
|
*/
|
|
4630
4632
|
export const isBetweenReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isBetween", /*#__PURE__*/Struct({
|
|
@@ -4650,7 +4652,7 @@ export const isBetweenReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("e
|
|
|
4650
4652
|
* When generating test data with fast-check, this applies constraints to ensure
|
|
4651
4653
|
* generated numbers are multiples of the specified divisor.
|
|
4652
4654
|
*
|
|
4653
|
-
* @category
|
|
4655
|
+
* @category validation
|
|
4654
4656
|
* @since 4.0.0
|
|
4655
4657
|
*/
|
|
4656
4658
|
export const isMultipleOf = /*#__PURE__*/makeIsMultipleOf({
|
|
@@ -4681,7 +4683,7 @@ export const isMultipleOf = /*#__PURE__*/makeIsMultipleOf({
|
|
|
4681
4683
|
*
|
|
4682
4684
|
* @see {@link isMultipleOf} for creating the corresponding check
|
|
4683
4685
|
*
|
|
4684
|
-
* @category
|
|
4686
|
+
* @category validation
|
|
4685
4687
|
* @since 4.0.0
|
|
4686
4688
|
*/
|
|
4687
4689
|
export const isMultipleOfReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isMultipleOf", /*#__PURE__*/Struct({
|
|
@@ -4705,7 +4707,7 @@ export const isMultipleOfReviver = /*#__PURE__*/InternalSchema.makeFilterReviver
|
|
|
4705
4707
|
* When generating test data with fast-check, this applies an `integer: true`
|
|
4706
4708
|
* constraint to ensure generated numbers are integers.
|
|
4707
4709
|
*
|
|
4708
|
-
* @category
|
|
4710
|
+
* @category validation
|
|
4709
4711
|
* @since 4.0.0
|
|
4710
4712
|
*/
|
|
4711
4713
|
export function isInt(annotations) {
|
|
@@ -4738,7 +4740,7 @@ export function isInt(annotations) {
|
|
|
4738
4740
|
*
|
|
4739
4741
|
* @see {@link isInt} for creating the corresponding check
|
|
4740
4742
|
*
|
|
4741
|
-
* @category
|
|
4743
|
+
* @category validation
|
|
4742
4744
|
* @since 4.0.0
|
|
4743
4745
|
*/
|
|
4744
4746
|
export const isIntReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isInt", Null, ({
|
|
@@ -4747,7 +4749,7 @@ export const isIntReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effec
|
|
|
4747
4749
|
/**
|
|
4748
4750
|
* Schema for integers, rejecting `NaN`, `Infinity`, and `-Infinity`.
|
|
4749
4751
|
*
|
|
4750
|
-
* @category
|
|
4752
|
+
* @category schemas
|
|
4751
4753
|
* @since 3.10.0
|
|
4752
4754
|
*/
|
|
4753
4755
|
export const Int = /*#__PURE__*/Number.check(/*#__PURE__*/isInt());
|
|
@@ -4760,7 +4762,7 @@ export const Int = /*#__PURE__*/Number.check(/*#__PURE__*/isInt());
|
|
|
4760
4762
|
*
|
|
4761
4763
|
* @see {@link Int} for safe integers that may be negative
|
|
4762
4764
|
*
|
|
4763
|
-
* @category
|
|
4765
|
+
* @category schemas
|
|
4764
4766
|
* @since 4.0.0
|
|
4765
4767
|
*/
|
|
4766
4768
|
export const Natural = /*#__PURE__*/Int.check(/*#__PURE__*/isGreaterThanOrEqualTo(0));
|
|
@@ -4780,7 +4782,7 @@ export const Natural = /*#__PURE__*/Int.check(/*#__PURE__*/isGreaterThanOrEqualT
|
|
|
4780
4782
|
* When generating test data with fast-check, this applies integer and range
|
|
4781
4783
|
* constraints to ensure generated numbers are 32-bit signed integers.
|
|
4782
4784
|
*
|
|
4783
|
-
* @category
|
|
4785
|
+
* @category validation
|
|
4784
4786
|
* @since 4.0.0
|
|
4785
4787
|
*/
|
|
4786
4788
|
export function isInt32(annotations) {
|
|
@@ -4808,7 +4810,7 @@ export function isInt32(annotations) {
|
|
|
4808
4810
|
* When generating test data with fast-check, this applies integer and range
|
|
4809
4811
|
* constraints to ensure generated numbers are 32-bit unsigned integers.
|
|
4810
4812
|
*
|
|
4811
|
-
* @category
|
|
4813
|
+
* @category validation
|
|
4812
4814
|
* @since 4.0.0
|
|
4813
4815
|
*/
|
|
4814
4816
|
export function isUint32(annotations) {
|
|
@@ -4840,7 +4842,7 @@ function formatDateRuntime(date) {
|
|
|
4840
4842
|
* one millisecond after the specified value to ensure generated Date objects are
|
|
4841
4843
|
* greater than it.
|
|
4842
4844
|
*
|
|
4843
|
-
* @category
|
|
4845
|
+
* @category validation
|
|
4844
4846
|
* @since 4.0.0
|
|
4845
4847
|
*/
|
|
4846
4848
|
export const isGreaterThanDate = /*#__PURE__*/makeIsGreaterThan({
|
|
@@ -4878,7 +4880,7 @@ export const isGreaterThanDate = /*#__PURE__*/makeIsGreaterThan({
|
|
|
4878
4880
|
* to ensure generated Date objects are greater than or equal to the specified
|
|
4879
4881
|
* date.
|
|
4880
4882
|
*
|
|
4881
|
-
* @category
|
|
4883
|
+
* @category validation
|
|
4882
4884
|
* @since 4.0.0
|
|
4883
4885
|
*/
|
|
4884
4886
|
export const isGreaterThanOrEqualToDate = /*#__PURE__*/makeIsGreaterThanOrEqualTo({
|
|
@@ -4910,7 +4912,7 @@ export const isGreaterThanOrEqualToDate = /*#__PURE__*/makeIsGreaterThanOrEqualT
|
|
|
4910
4912
|
* one millisecond before the specified value to ensure generated Date objects
|
|
4911
4913
|
* are less than it.
|
|
4912
4914
|
*
|
|
4913
|
-
* @category
|
|
4915
|
+
* @category validation
|
|
4914
4916
|
* @since 4.0.0
|
|
4915
4917
|
*/
|
|
4916
4918
|
export const isLessThanDate = /*#__PURE__*/makeIsLessThan({
|
|
@@ -4948,7 +4950,7 @@ export const isLessThanDate = /*#__PURE__*/makeIsLessThan({
|
|
|
4948
4950
|
* to ensure generated Date objects are less than or equal to the specified
|
|
4949
4951
|
* date.
|
|
4950
4952
|
*
|
|
4951
|
-
* @category
|
|
4953
|
+
* @category validation
|
|
4952
4954
|
* @since 4.0.0
|
|
4953
4955
|
*/
|
|
4954
4956
|
export const isLessThanOrEqualToDate = /*#__PURE__*/makeIsLessThanOrEqualTo({
|
|
@@ -4986,7 +4988,7 @@ export const isLessThanOrEqualToDate = /*#__PURE__*/makeIsLessThanOrEqualTo({
|
|
|
4986
4988
|
* constraints to ensure generated Date objects fall within the specified range,
|
|
4987
4989
|
* shifting exclusive bounds by one millisecond.
|
|
4988
4990
|
*
|
|
4989
|
-
* @category
|
|
4991
|
+
* @category validation
|
|
4990
4992
|
* @since 4.0.0
|
|
4991
4993
|
*/
|
|
4992
4994
|
export const isBetweenDate = /*#__PURE__*/makeIsBetween({
|
|
@@ -5027,7 +5029,7 @@ export const isBetweenDate = /*#__PURE__*/makeIsBetween({
|
|
|
5027
5029
|
* `exclusiveMinimum + 1n` to ensure generated BigInts are greater than the
|
|
5028
5030
|
* specified value.
|
|
5029
5031
|
*
|
|
5030
|
-
* @category
|
|
5032
|
+
* @category validation
|
|
5031
5033
|
* @since 4.0.0
|
|
5032
5034
|
*/
|
|
5033
5035
|
export const isGreaterThanBigInt = /*#__PURE__*/makeIsGreaterThan({
|
|
@@ -5060,7 +5062,7 @@ export const isGreaterThanBigInt = /*#__PURE__*/makeIsGreaterThan({
|
|
|
5060
5062
|
* to ensure generated BigInt values are greater than or equal to the specified
|
|
5061
5063
|
* value.
|
|
5062
5064
|
*
|
|
5063
|
-
* @category
|
|
5065
|
+
* @category validation
|
|
5064
5066
|
* @since 4.0.0
|
|
5065
5067
|
*/
|
|
5066
5068
|
export const isGreaterThanOrEqualToBigInt = /*#__PURE__*/makeIsGreaterThanOrEqualTo({
|
|
@@ -5092,7 +5094,7 @@ export const isGreaterThanOrEqualToBigInt = /*#__PURE__*/makeIsGreaterThanOrEqua
|
|
|
5092
5094
|
* `exclusiveMaximum - 1n` to ensure generated BigInts are less than the
|
|
5093
5095
|
* specified value.
|
|
5094
5096
|
*
|
|
5095
|
-
* @category
|
|
5097
|
+
* @category validation
|
|
5096
5098
|
* @since 4.0.0
|
|
5097
5099
|
*/
|
|
5098
5100
|
export const isLessThanBigInt = /*#__PURE__*/makeIsLessThan({
|
|
@@ -5125,7 +5127,7 @@ export const isLessThanBigInt = /*#__PURE__*/makeIsLessThan({
|
|
|
5125
5127
|
* to ensure generated BigInt values are less than or equal to the specified
|
|
5126
5128
|
* value.
|
|
5127
5129
|
*
|
|
5128
|
-
* @category
|
|
5130
|
+
* @category validation
|
|
5129
5131
|
* @since 4.0.0
|
|
5130
5132
|
*/
|
|
5131
5133
|
export const isLessThanOrEqualToBigInt = /*#__PURE__*/makeIsLessThanOrEqualTo({
|
|
@@ -5158,7 +5160,7 @@ export const isLessThanOrEqualToBigInt = /*#__PURE__*/makeIsLessThanOrEqualTo({
|
|
|
5158
5160
|
* constraints to ensure generated BigInt values fall within the specified
|
|
5159
5161
|
* range.
|
|
5160
5162
|
*
|
|
5161
|
-
* @category
|
|
5163
|
+
* @category validation
|
|
5162
5164
|
* @since 4.0.0
|
|
5163
5165
|
*/
|
|
5164
5166
|
export const isBetweenBigInt = /*#__PURE__*/makeIsBetween({
|
|
@@ -5191,7 +5193,7 @@ export const isBetweenBigInt = /*#__PURE__*/makeIsBetween({
|
|
|
5191
5193
|
/**
|
|
5192
5194
|
* Validates that a BigDecimal is greater than the specified value (exclusive).
|
|
5193
5195
|
*
|
|
5194
|
-
* @category
|
|
5196
|
+
* @category validation
|
|
5195
5197
|
* @since 4.0.0
|
|
5196
5198
|
*/
|
|
5197
5199
|
export const isGreaterThanBigDecimal = /*#__PURE__*/makeIsGreaterThan({
|
|
@@ -5202,7 +5204,7 @@ export const isGreaterThanBigDecimal = /*#__PURE__*/makeIsGreaterThan({
|
|
|
5202
5204
|
* Validates that a BigDecimal is greater than or equal to the specified value
|
|
5203
5205
|
* (inclusive).
|
|
5204
5206
|
*
|
|
5205
|
-
* @category
|
|
5207
|
+
* @category validation
|
|
5206
5208
|
* @since 4.0.0
|
|
5207
5209
|
*/
|
|
5208
5210
|
export const isGreaterThanOrEqualToBigDecimal = /*#__PURE__*/makeIsGreaterThanOrEqualTo({
|
|
@@ -5212,7 +5214,7 @@ export const isGreaterThanOrEqualToBigDecimal = /*#__PURE__*/makeIsGreaterThanOr
|
|
|
5212
5214
|
/**
|
|
5213
5215
|
* Validates that a BigDecimal is less than the specified value (exclusive).
|
|
5214
5216
|
*
|
|
5215
|
-
* @category
|
|
5217
|
+
* @category validation
|
|
5216
5218
|
* @since 4.0.0
|
|
5217
5219
|
*/
|
|
5218
5220
|
export const isLessThanBigDecimal = /*#__PURE__*/makeIsLessThan({
|
|
@@ -5223,7 +5225,7 @@ export const isLessThanBigDecimal = /*#__PURE__*/makeIsLessThan({
|
|
|
5223
5225
|
* Validates that a BigDecimal is less than or equal to the specified value
|
|
5224
5226
|
* (inclusive).
|
|
5225
5227
|
*
|
|
5226
|
-
* @category
|
|
5228
|
+
* @category validation
|
|
5227
5229
|
* @since 4.0.0
|
|
5228
5230
|
*/
|
|
5229
5231
|
export const isLessThanOrEqualToBigDecimal = /*#__PURE__*/makeIsLessThanOrEqualTo({
|
|
@@ -5238,7 +5240,7 @@ export const isLessThanOrEqualToBigDecimal = /*#__PURE__*/makeIsLessThanOrEqualT
|
|
|
5238
5240
|
* The minimum and maximum boundaries are inclusive by default. Pass
|
|
5239
5241
|
* `exclusiveMinimum` or `exclusiveMaximum` to exclude either boundary.
|
|
5240
5242
|
*
|
|
5241
|
-
* @category
|
|
5243
|
+
* @category validation
|
|
5242
5244
|
* @since 4.0.0
|
|
5243
5245
|
*/
|
|
5244
5246
|
export const isBetweenBigDecimal = /*#__PURE__*/makeIsBetween({
|
|
@@ -5264,14 +5266,16 @@ export const isBetweenBigDecimal = /*#__PURE__*/makeIsBetween({
|
|
|
5264
5266
|
*
|
|
5265
5267
|
* **Example** (Checking minimum length)
|
|
5266
5268
|
*
|
|
5267
|
-
* ```ts
|
|
5269
|
+
* ```ts import.meta.vitest
|
|
5268
5270
|
* import { Schema } from "effect"
|
|
5269
5271
|
*
|
|
5270
5272
|
* const NonEmptyStringSchema = Schema.String.check(Schema.isMinLength(1))
|
|
5271
5273
|
* const NonEmptyArraySchema = Schema.Array(Schema.Number).check(Schema.isMinLength(1))
|
|
5274
|
+
* Schema.is(NonEmptyStringSchema)("a") // => true
|
|
5275
|
+
* Schema.is(NonEmptyArraySchema)([1]) // => true
|
|
5272
5276
|
* ```
|
|
5273
5277
|
*
|
|
5274
|
-
* @category
|
|
5278
|
+
* @category validation
|
|
5275
5279
|
* @since 4.0.0
|
|
5276
5280
|
*/
|
|
5277
5281
|
export function isMinLength(minLength, annotations) {
|
|
@@ -5312,7 +5316,7 @@ export function isMinLength(minLength, annotations) {
|
|
|
5312
5316
|
*
|
|
5313
5317
|
* @see {@link isMinLength} for creating the corresponding check
|
|
5314
5318
|
*
|
|
5315
|
-
* @category
|
|
5319
|
+
* @category validation
|
|
5316
5320
|
* @since 4.0.0
|
|
5317
5321
|
*/
|
|
5318
5322
|
export const isMinLengthReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isMinLength", /*#__PURE__*/Struct({
|
|
@@ -5337,7 +5341,7 @@ export const isMinLengthReviver = /*#__PURE__*/InternalSchema.makeFilterReviver(
|
|
|
5337
5341
|
* When generating test data with fast-check, this applies a `minLength: 1`
|
|
5338
5342
|
* constraint to ensure generated strings or arrays are non-empty.
|
|
5339
5343
|
*
|
|
5340
|
-
* @category
|
|
5344
|
+
* @category validation
|
|
5341
5345
|
* @since 4.0.0
|
|
5342
5346
|
*/
|
|
5343
5347
|
export function isNonEmpty(annotations) {
|
|
@@ -5360,7 +5364,7 @@ export function isNonEmpty(annotations) {
|
|
|
5360
5364
|
* constraint to ensure generated strings or arrays have at most the required
|
|
5361
5365
|
* length.
|
|
5362
5366
|
*
|
|
5363
|
-
* @category
|
|
5367
|
+
* @category validation
|
|
5364
5368
|
* @since 4.0.0
|
|
5365
5369
|
*/
|
|
5366
5370
|
export function isMaxLength(maxLength, annotations) {
|
|
@@ -5401,7 +5405,7 @@ export function isMaxLength(maxLength, annotations) {
|
|
|
5401
5405
|
*
|
|
5402
5406
|
* @see {@link isMaxLength} for creating the corresponding check
|
|
5403
5407
|
*
|
|
5404
|
-
* @category
|
|
5408
|
+
* @category validation
|
|
5405
5409
|
* @since 4.0.0
|
|
5406
5410
|
*/
|
|
5407
5411
|
export const isMaxLengthReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isMaxLength", /*#__PURE__*/Struct({
|
|
@@ -5427,7 +5431,7 @@ export const isMaxLengthReviver = /*#__PURE__*/InternalSchema.makeFilterReviver(
|
|
|
5427
5431
|
* `maxLength` constraints to ensure generated strings or arrays have a length
|
|
5428
5432
|
* within the specified range.
|
|
5429
5433
|
*
|
|
5430
|
-
* @category
|
|
5434
|
+
* @category validation
|
|
5431
5435
|
* @since 4.0.0
|
|
5432
5436
|
*/
|
|
5433
5437
|
export function isLengthBetween(minimum, maximum, annotations) {
|
|
@@ -5479,7 +5483,7 @@ export function isLengthBetween(minimum, maximum, annotations) {
|
|
|
5479
5483
|
*
|
|
5480
5484
|
* @see {@link isLengthBetween} for creating the corresponding check
|
|
5481
5485
|
*
|
|
5482
|
-
* @category
|
|
5486
|
+
* @category validation
|
|
5483
5487
|
* @since 4.0.0
|
|
5484
5488
|
*/
|
|
5485
5489
|
export const isLengthBetweenReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isLengthBetween", /*#__PURE__*/Struct({
|
|
@@ -5506,7 +5510,7 @@ export const isLengthBetweenReviver = /*#__PURE__*/InternalSchema.makeFilterRevi
|
|
|
5506
5510
|
* `minLength` constraint. Generators for values with a final `.size`, such as
|
|
5507
5511
|
* sets and maps, interpret it as final cardinality.
|
|
5508
5512
|
*
|
|
5509
|
-
* @category
|
|
5513
|
+
* @category validation
|
|
5510
5514
|
* @since 4.0.0
|
|
5511
5515
|
*/
|
|
5512
5516
|
export function isMinSize(minSize, annotations) {
|
|
@@ -5541,7 +5545,7 @@ export function isMinSize(minSize, annotations) {
|
|
|
5541
5545
|
*
|
|
5542
5546
|
* @see {@link isMinSize} for creating the corresponding check
|
|
5543
5547
|
*
|
|
5544
|
-
* @category
|
|
5548
|
+
* @category validation
|
|
5545
5549
|
* @since 4.0.0
|
|
5546
5550
|
*/
|
|
5547
5551
|
export const isMinSizeReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isMinSize", /*#__PURE__*/Struct({
|
|
@@ -5567,7 +5571,7 @@ export const isMinSizeReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("e
|
|
|
5567
5571
|
* `maxLength` constraint. Generators for values with a final `.size`, such as
|
|
5568
5572
|
* sets and maps, interpret it as final cardinality.
|
|
5569
5573
|
*
|
|
5570
|
-
* @category
|
|
5574
|
+
* @category validation
|
|
5571
5575
|
* @since 4.0.0
|
|
5572
5576
|
*/
|
|
5573
5577
|
export function isMaxSize(maxSize, annotations) {
|
|
@@ -5602,7 +5606,7 @@ export function isMaxSize(maxSize, annotations) {
|
|
|
5602
5606
|
*
|
|
5603
5607
|
* @see {@link isMaxSize} for creating the corresponding check
|
|
5604
5608
|
*
|
|
5605
|
-
* @category
|
|
5609
|
+
* @category validation
|
|
5606
5610
|
* @since 4.0.0
|
|
5607
5611
|
*/
|
|
5608
5612
|
export const isMaxSizeReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isMaxSize", /*#__PURE__*/Struct({
|
|
@@ -5628,7 +5632,7 @@ export const isMaxSizeReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("e
|
|
|
5628
5632
|
* `minLength` and `maxLength` constraints. Generators for values with a final
|
|
5629
5633
|
* `.size`, such as sets and maps, interpret them as final cardinality.
|
|
5630
5634
|
*
|
|
5631
|
-
* @category
|
|
5635
|
+
* @category validation
|
|
5632
5636
|
* @since 4.0.0
|
|
5633
5637
|
*/
|
|
5634
5638
|
export function isSizeBetween(minimum, maximum, annotations) {
|
|
@@ -5666,7 +5670,7 @@ export function isSizeBetween(minimum, maximum, annotations) {
|
|
|
5666
5670
|
*
|
|
5667
5671
|
* @see {@link isSizeBetween} for creating the corresponding check
|
|
5668
5672
|
*
|
|
5669
|
-
* @category
|
|
5673
|
+
* @category validation
|
|
5670
5674
|
* @since 4.0.0
|
|
5671
5675
|
*/
|
|
5672
5676
|
export const isSizeBetweenReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isSizeBetween", /*#__PURE__*/Struct({
|
|
@@ -5693,7 +5697,7 @@ export const isSizeBetweenReviver = /*#__PURE__*/InternalSchema.makeFilterRevive
|
|
|
5693
5697
|
* `minLength` constraint. Object generators interpret it as the final number
|
|
5694
5698
|
* of own properties.
|
|
5695
5699
|
*
|
|
5696
|
-
* @category
|
|
5700
|
+
* @category validation
|
|
5697
5701
|
* @since 4.0.0
|
|
5698
5702
|
*/
|
|
5699
5703
|
export function isMinProperties(minProperties, annotations) {
|
|
@@ -5730,7 +5734,7 @@ export function isMinProperties(minProperties, annotations) {
|
|
|
5730
5734
|
*
|
|
5731
5735
|
* @see {@link isMinProperties} for creating the corresponding check
|
|
5732
5736
|
*
|
|
5733
|
-
* @category
|
|
5737
|
+
* @category validation
|
|
5734
5738
|
* @since 4.0.0
|
|
5735
5739
|
*/
|
|
5736
5740
|
export const isMinPropertiesReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isMinProperties", /*#__PURE__*/Struct({
|
|
@@ -5755,7 +5759,7 @@ export const isMinPropertiesReviver = /*#__PURE__*/InternalSchema.makeFilterRevi
|
|
|
5755
5759
|
* `maxLength` constraint. Object generators interpret it as the final number
|
|
5756
5760
|
* of own properties.
|
|
5757
5761
|
*
|
|
5758
|
-
* @category
|
|
5762
|
+
* @category validation
|
|
5759
5763
|
* @since 4.0.0
|
|
5760
5764
|
*/
|
|
5761
5765
|
export function isMaxProperties(maxProperties, annotations) {
|
|
@@ -5792,7 +5796,7 @@ export function isMaxProperties(maxProperties, annotations) {
|
|
|
5792
5796
|
*
|
|
5793
5797
|
* @see {@link isMaxProperties} for creating the corresponding check
|
|
5794
5798
|
*
|
|
5795
|
-
* @category
|
|
5799
|
+
* @category validation
|
|
5796
5800
|
* @since 4.0.0
|
|
5797
5801
|
*/
|
|
5798
5802
|
export const isMaxPropertiesReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isMaxProperties", /*#__PURE__*/Struct({
|
|
@@ -5818,7 +5822,7 @@ export const isMaxPropertiesReviver = /*#__PURE__*/InternalSchema.makeFilterRevi
|
|
|
5818
5822
|
* `minLength` and `maxLength` constraints. Object generators interpret them as
|
|
5819
5823
|
* the final number of own properties.
|
|
5820
5824
|
*
|
|
5821
|
-
* @category
|
|
5825
|
+
* @category validation
|
|
5822
5826
|
* @since 4.0.0
|
|
5823
5827
|
*/
|
|
5824
5828
|
export function isPropertiesLengthBetween(minimum, maximum, annotations) {
|
|
@@ -5859,7 +5863,7 @@ export function isPropertiesLengthBetween(minimum, maximum, annotations) {
|
|
|
5859
5863
|
*
|
|
5860
5864
|
* @see {@link isPropertiesLengthBetween} for creating the corresponding check
|
|
5861
5865
|
*
|
|
5862
|
-
* @category
|
|
5866
|
+
* @category validation
|
|
5863
5867
|
* @since 4.0.0
|
|
5864
5868
|
*/
|
|
5865
5869
|
export const isPropertiesLengthBetweenReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isPropertiesLengthBetween", /*#__PURE__*/Struct({
|
|
@@ -5882,7 +5886,7 @@ export const isPropertiesLengthBetweenReviver = /*#__PURE__*/InternalSchema.make
|
|
|
5882
5886
|
* For string property names, this corresponds to the `propertyNames` constraint
|
|
5883
5887
|
* in JSON Schema.
|
|
5884
5888
|
*
|
|
5885
|
-
* @category
|
|
5889
|
+
* @category validation
|
|
5886
5890
|
* @since 4.0.0
|
|
5887
5891
|
*/
|
|
5888
5892
|
export function isPropertyNames(keySchema, annotations) {
|
|
@@ -5899,7 +5903,7 @@ export function isPropertyNames(keySchema, annotations) {
|
|
|
5899
5903
|
}
|
|
5900
5904
|
}
|
|
5901
5905
|
if (Arr.isArrayNonEmpty(issues)) {
|
|
5902
|
-
return new SchemaIssue.Composite(ast,
|
|
5906
|
+
return new SchemaIssue.Composite(ast, issues);
|
|
5903
5907
|
}
|
|
5904
5908
|
return true;
|
|
5905
5909
|
}, {
|
|
@@ -5932,7 +5936,7 @@ export function isPropertyNames(keySchema, annotations) {
|
|
|
5932
5936
|
*
|
|
5933
5937
|
* @see {@link isPropertyNames} for creating the corresponding check
|
|
5934
5938
|
*
|
|
5935
|
-
* @category
|
|
5939
|
+
* @category validation
|
|
5936
5940
|
* @since 4.0.0
|
|
5937
5941
|
*/
|
|
5938
5942
|
export const isPropertyNamesReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isPropertyNames", Null, ({
|
|
@@ -5952,7 +5956,7 @@ export const isPropertyNamesReviver = /*#__PURE__*/InternalSchema.makeFilterRevi
|
|
|
5952
5956
|
* `unique: true` constraint. Array generators translate it to `fast-check`
|
|
5953
5957
|
* `uniqueArray` using Effect equality.
|
|
5954
5958
|
*
|
|
5955
|
-
* @category
|
|
5959
|
+
* @category validation
|
|
5956
5960
|
* @since 4.0.0
|
|
5957
5961
|
*/
|
|
5958
5962
|
export function isUnique(annotations) {
|
|
@@ -5985,7 +5989,7 @@ export function isUnique(annotations) {
|
|
|
5985
5989
|
*
|
|
5986
5990
|
* @see {@link isUnique} for creating the corresponding check
|
|
5987
5991
|
*
|
|
5988
|
-
* @category
|
|
5992
|
+
* @category validation
|
|
5989
5993
|
* @since 4.0.0
|
|
5990
5994
|
*/
|
|
5991
5995
|
export const isUniqueReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isUnique", Null, ({
|
|
@@ -5995,7 +5999,7 @@ export const isUniqueReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("ef
|
|
|
5995
5999
|
* Schema for non-empty strings. Validates that a string has at least one
|
|
5996
6000
|
* character.
|
|
5997
6001
|
*
|
|
5998
|
-
* @category
|
|
6002
|
+
* @category schemas
|
|
5999
6003
|
* @since 3.10.0
|
|
6000
6004
|
*/
|
|
6001
6005
|
export const NonEmptyString = /*#__PURE__*/String.check(/*#__PURE__*/isNonEmpty());
|
|
@@ -6015,14 +6019,14 @@ export const NonEmptyString = /*#__PURE__*/String.check(/*#__PURE__*/isNonEmpty(
|
|
|
6015
6019
|
* @see {@link NonEmptyString} for strings with length greater than zero
|
|
6016
6020
|
* @see {@link isLengthBetween} for the underlying length check
|
|
6017
6021
|
*
|
|
6018
|
-
* @category
|
|
6022
|
+
* @category schemas
|
|
6019
6023
|
* @since 3.10.0
|
|
6020
6024
|
*/
|
|
6021
6025
|
export const Char = /*#__PURE__*/String.check(/*#__PURE__*/isLengthBetween(1, 1));
|
|
6022
6026
|
/**
|
|
6023
6027
|
* Schema for `Option<A>` values.
|
|
6024
6028
|
*
|
|
6025
|
-
* @category
|
|
6029
|
+
* @category schemas
|
|
6026
6030
|
* @since 3.10.0
|
|
6027
6031
|
*/
|
|
6028
6032
|
export function Option(value) {
|
|
@@ -6033,10 +6037,10 @@ export function Option(value) {
|
|
|
6033
6037
|
}
|
|
6034
6038
|
return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(value)(input.value, options), {
|
|
6035
6039
|
onSuccess: Option_.some,
|
|
6036
|
-
onFailure: issue => new SchemaIssue.Composite(ast,
|
|
6040
|
+
onFailure: issue => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["value"], issue)])
|
|
6037
6041
|
});
|
|
6038
6042
|
}
|
|
6039
|
-
return Effect.fail(new SchemaIssue.InvalidType(ast
|
|
6043
|
+
return Effect.fail(new SchemaIssue.InvalidType(ast));
|
|
6040
6044
|
}, {
|
|
6041
6045
|
representation: {
|
|
6042
6046
|
id: "effect/schema/Option",
|
|
@@ -6088,7 +6092,7 @@ export function Option(value) {
|
|
|
6088
6092
|
*
|
|
6089
6093
|
* @see {@link Option} for creating the corresponding schema
|
|
6090
6094
|
*
|
|
6091
|
-
* @category
|
|
6095
|
+
* @category schemas
|
|
6092
6096
|
* @since 4.0.0
|
|
6093
6097
|
*/
|
|
6094
6098
|
export const OptionReviver = /*#__PURE__*/InternalSchema.makeDeclarationReviver("effect/schema/Option", Null, ({
|
|
@@ -6106,7 +6110,7 @@ export const OptionReviver = /*#__PURE__*/InternalSchema.makeDeclarationReviver(
|
|
|
6106
6110
|
* Decoding maps `null` to `None` and all other values to `Some`. Encoding maps
|
|
6107
6111
|
* `None` to `null` and maps `Some` to its value.
|
|
6108
6112
|
*
|
|
6109
|
-
* @category
|
|
6113
|
+
* @category schemas
|
|
6110
6114
|
* @since 3.10.0
|
|
6111
6115
|
*/
|
|
6112
6116
|
export function OptionFromNullOr(schema) {
|
|
@@ -6121,7 +6125,7 @@ export function OptionFromNullOr(schema) {
|
|
|
6121
6125
|
* Decoding maps `undefined` to `None` and all other values to `Some`. Encoding
|
|
6122
6126
|
* maps `None` to `undefined` and maps `Some` to its value.
|
|
6123
6127
|
*
|
|
6124
|
-
* @category
|
|
6128
|
+
* @category schemas
|
|
6125
6129
|
* @since 3.10.0
|
|
6126
6130
|
*/
|
|
6127
6131
|
export function OptionFromUndefinedOr(schema) {
|
|
@@ -6137,7 +6141,7 @@ export function OptionFromUndefinedOr(schema) {
|
|
|
6137
6141
|
* `options.onNoneEncoding`, which defaults to `undefined`, and maps `Some` to
|
|
6138
6142
|
* its value.
|
|
6139
6143
|
*
|
|
6140
|
-
* @category
|
|
6144
|
+
* @category schemas
|
|
6141
6145
|
* @since 3.10.0
|
|
6142
6146
|
*/
|
|
6143
6147
|
export function OptionFromNullishOr(schema, options) {
|
|
@@ -6151,7 +6155,7 @@ export function OptionFromNullishOr(schema, options) {
|
|
|
6151
6155
|
* Decoding maps a missing key to `None` and a present value to `Some`.
|
|
6152
6156
|
* Encoding maps `None` to a missing key and maps `Some` to its value.
|
|
6153
6157
|
*
|
|
6154
|
-
* @category
|
|
6158
|
+
* @category schemas
|
|
6155
6159
|
* @since 4.0.0
|
|
6156
6160
|
*/
|
|
6157
6161
|
export function OptionFromOptionalKey(schema) {
|
|
@@ -6167,7 +6171,7 @@ export function OptionFromOptionalKey(schema) {
|
|
|
6167
6171
|
* maps all other values to `Some`. Encoding maps `None` to a missing key and
|
|
6168
6172
|
* maps `Some` to its value.
|
|
6169
6173
|
*
|
|
6170
|
-
* @category
|
|
6174
|
+
* @category schemas
|
|
6171
6175
|
* @since 4.0.0
|
|
6172
6176
|
*/
|
|
6173
6177
|
export function OptionFromOptional(schema) {
|
|
@@ -6184,7 +6188,7 @@ export function OptionFromOptional(schema) {
|
|
|
6184
6188
|
* according to `options.onNoneEncoding`: `"omit"` encodes a missing key,
|
|
6185
6189
|
* `null` encodes `null`, and `undefined` encodes `undefined`.
|
|
6186
6190
|
*
|
|
6187
|
-
* @category
|
|
6191
|
+
* @category schemas
|
|
6188
6192
|
* @since 4.0.0
|
|
6189
6193
|
*/
|
|
6190
6194
|
export function OptionFromOptionalNullOr(schema, options) {
|
|
@@ -6204,18 +6208,18 @@ export function OptionFromOptionalNullOr(schema, options) {
|
|
|
6204
6208
|
export function Result(success, failure) {
|
|
6205
6209
|
const schema = declareConstructor()([success, failure], ([success, failure]) => (input, ast, options) => {
|
|
6206
6210
|
if (!Result_.isResult(input)) {
|
|
6207
|
-
return Effect.fail(new SchemaIssue.InvalidType(ast
|
|
6211
|
+
return Effect.fail(new SchemaIssue.InvalidType(ast));
|
|
6208
6212
|
}
|
|
6209
6213
|
switch (input._tag) {
|
|
6210
6214
|
case "Success":
|
|
6211
6215
|
return Effect.mapBothEager(SchemaParser.decodeEffect(success)(input.success, options), {
|
|
6212
6216
|
onSuccess: Result_.succeed,
|
|
6213
|
-
onFailure: issue => new SchemaIssue.Composite(ast,
|
|
6217
|
+
onFailure: issue => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["success"], issue)])
|
|
6214
6218
|
});
|
|
6215
6219
|
case "Failure":
|
|
6216
6220
|
return Effect.mapBothEager(SchemaParser.decodeEffect(failure)(input.failure, options), {
|
|
6217
6221
|
onSuccess: Result_.fail,
|
|
6218
|
-
onFailure: issue => new SchemaIssue.Composite(ast,
|
|
6222
|
+
onFailure: issue => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["failure"], issue)])
|
|
6219
6223
|
});
|
|
6220
6224
|
}
|
|
6221
6225
|
}, {
|
|
@@ -6300,13 +6304,7 @@ const RedactedOptionsPayload = /*#__PURE__*/declare(input => {
|
|
|
6300
6304
|
});
|
|
6301
6305
|
const RedactedRepresentationPayload = /*#__PURE__*/Union([Null, RedactedOptionsPayload]);
|
|
6302
6306
|
/**
|
|
6303
|
-
* Schema for values
|
|
6304
|
-
* inspection.
|
|
6305
|
-
*
|
|
6306
|
-
* **Details**
|
|
6307
|
-
*
|
|
6308
|
-
* If the wrapped schema fails, the issue will be redacted to prevent both
|
|
6309
|
-
* the actual value and the schema details from being exposed.
|
|
6307
|
+
* Schema for `Redacted` values, which hide their contents from inspection.
|
|
6310
6308
|
*
|
|
6311
6309
|
* Options:
|
|
6312
6310
|
*
|
|
@@ -6320,7 +6318,7 @@ const RedactedRepresentationPayload = /*#__PURE__*/Union([Null, RedactedOptionsP
|
|
|
6320
6318
|
* sensitive and should not be exposed in JSON.
|
|
6321
6319
|
*
|
|
6322
6320
|
* @see {@link RedactedFromValue} for decoding raw values and wrapping them in `Redacted`.
|
|
6323
|
-
* @category
|
|
6321
|
+
* @category schemas
|
|
6324
6322
|
* @since 3.10.0
|
|
6325
6323
|
*/
|
|
6326
6324
|
export function Redacted(value, options) {
|
|
@@ -6340,14 +6338,13 @@ export function Redacted(value, options) {
|
|
|
6340
6338
|
const label = decodeLabel !== undefined ? Effect.mapErrorEager(decodeLabel(input.label, poptions), issue => new SchemaIssue.Pointer(["label"], issue)) : Effect.void;
|
|
6341
6339
|
return Effect.flatMapEager(label, () => Effect.mapBothEager(SchemaParser.decodeUnknownEffect(value)(Redacted_.value(input), poptions), {
|
|
6342
6340
|
onSuccess: () => input,
|
|
6343
|
-
onFailure: (/** ignore the
|
|
6341
|
+
onFailure: (/** ignore the issue because of security reasons */
|
|
6344
6342
|
) => {
|
|
6345
|
-
|
|
6346
|
-
return new SchemaIssue.Composite(ast, oinput, [new SchemaIssue.Pointer(["value"], new SchemaIssue.InvalidValue(oinput))]);
|
|
6343
|
+
return new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["value"], new SchemaIssue.InvalidValue())]);
|
|
6347
6344
|
}
|
|
6348
6345
|
}));
|
|
6349
6346
|
}
|
|
6350
|
-
return Effect.fail(new SchemaIssue.InvalidType(ast
|
|
6347
|
+
return Effect.fail(new SchemaIssue.InvalidType(ast));
|
|
6351
6348
|
}, {
|
|
6352
6349
|
representation: {
|
|
6353
6350
|
id: "effect/schema/Redacted",
|
|
@@ -6361,7 +6358,7 @@ export function Redacted(value, options) {
|
|
|
6361
6358
|
importDeclarations: [`import * as Redacted from "effect/Redacted"`]
|
|
6362
6359
|
}),
|
|
6363
6360
|
expected: "Redacted",
|
|
6364
|
-
toCodecJson: ([value]) => link()(
|
|
6361
|
+
toCodecJson: ([value]) => link()(value, {
|
|
6365
6362
|
decode: SchemaGetter.transform(e => Redacted_.make(e, {
|
|
6366
6363
|
label
|
|
6367
6364
|
})),
|
|
@@ -6391,7 +6388,7 @@ export function Redacted(value, options) {
|
|
|
6391
6388
|
*
|
|
6392
6389
|
* @see {@link Redacted} for creating the corresponding schema
|
|
6393
6390
|
*
|
|
6394
|
-
* @category
|
|
6391
|
+
* @category schemas
|
|
6395
6392
|
* @since 4.0.0
|
|
6396
6393
|
*/
|
|
6397
6394
|
export const RedactedReviver = /*#__PURE__*/InternalSchema.makeDeclarationReviver("effect/schema/Redacted", RedactedRepresentationPayload, ({
|
|
@@ -6402,27 +6399,17 @@ export const RedactedReviver = /*#__PURE__*/InternalSchema.makeDeclarationRevive
|
|
|
6402
6399
|
const schema = Redacted(typeParameters[0], payload ?? undefined);
|
|
6403
6400
|
return annotations === undefined ? schema : schema.annotate(annotations);
|
|
6404
6401
|
});
|
|
6405
|
-
/**
|
|
6406
|
-
* Middleware that wraps decoded errors in `Redacted`, preventing sensitive
|
|
6407
|
-
* schema details from leaking in error messages.
|
|
6408
|
-
*
|
|
6409
|
-
* @category Redacted
|
|
6410
|
-
* @since 4.0.0
|
|
6411
|
-
*/
|
|
6412
|
-
export function redact(schema) {
|
|
6413
|
-
return middlewareDecoding(Effect.mapErrorEager(SchemaIssue.redact))(schema);
|
|
6414
|
-
}
|
|
6415
6402
|
/**
|
|
6416
6403
|
* Decodes a value and wraps it in `Redacted<A>`. Unlike {@link Redacted} which
|
|
6417
6404
|
* expects the input to already be a `Redacted` instance, this schema decodes
|
|
6418
6405
|
* the raw value and wraps it.
|
|
6419
6406
|
*
|
|
6420
6407
|
* @see {@link Redacted} for schemas whose input is already a `Redacted` value.
|
|
6421
|
-
* @category
|
|
6408
|
+
* @category schemas
|
|
6422
6409
|
* @since 4.0.0
|
|
6423
6410
|
*/
|
|
6424
6411
|
export function RedactedFromValue(value, options) {
|
|
6425
|
-
return
|
|
6412
|
+
return decodeTo(Redacted(toType(value), {
|
|
6426
6413
|
label: options?.label,
|
|
6427
6414
|
disallowJsonEncode: options?.disallowEncode
|
|
6428
6415
|
}), {
|
|
@@ -6430,7 +6417,7 @@ export function RedactedFromValue(value, options) {
|
|
|
6430
6417
|
label: options?.label
|
|
6431
6418
|
})),
|
|
6432
6419
|
encode: options?.disallowEncode ? SchemaGetter.forbidden(oe => "Cannot encode Redacted" + (Option_.isSome(oe) && typeof oe.value.label === "string" ? ` with label: "${oe.value.label}"` : "")) : SchemaGetter.transform(Redacted_.value)
|
|
6433
|
-
}));
|
|
6420
|
+
})(value);
|
|
6434
6421
|
}
|
|
6435
6422
|
/**
|
|
6436
6423
|
* Creates a schema for `Cause.Reason` values using separate schemas for typed
|
|
@@ -6449,24 +6436,24 @@ export function RedactedFromValue(value, options) {
|
|
|
6449
6436
|
* @see {@link Cause} for constructing schemas for full Cause values
|
|
6450
6437
|
* @see {@link CauseReasonIso} for the ISO shape of each cause reason
|
|
6451
6438
|
*
|
|
6452
|
-
* @category
|
|
6439
|
+
* @category schemas
|
|
6453
6440
|
* @since 4.0.0
|
|
6454
6441
|
*/
|
|
6455
6442
|
export function CauseReason(error, defect) {
|
|
6456
6443
|
const schema = declareConstructor()([error, defect], ([error, defect]) => (input, ast, options) => {
|
|
6457
6444
|
if (!Cause_.isReason(input)) {
|
|
6458
|
-
return Effect.fail(new SchemaIssue.InvalidType(ast
|
|
6445
|
+
return Effect.fail(new SchemaIssue.InvalidType(ast));
|
|
6459
6446
|
}
|
|
6460
6447
|
switch (input._tag) {
|
|
6461
6448
|
case "Fail":
|
|
6462
6449
|
return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(error)(input.error, options), {
|
|
6463
6450
|
onSuccess: Cause_.makeFailReason,
|
|
6464
|
-
onFailure: issue => new SchemaIssue.Composite(ast,
|
|
6451
|
+
onFailure: issue => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["error"], issue)])
|
|
6465
6452
|
});
|
|
6466
6453
|
case "Die":
|
|
6467
6454
|
return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(defect)(input.defect, options), {
|
|
6468
6455
|
onSuccess: Cause_.makeDieReason,
|
|
6469
|
-
onFailure: issue => new SchemaIssue.Composite(ast,
|
|
6456
|
+
onFailure: issue => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["defect"], issue)])
|
|
6470
6457
|
});
|
|
6471
6458
|
case "Interrupt":
|
|
6472
6459
|
return Effect.succeed(input);
|
|
@@ -6524,7 +6511,7 @@ export function CauseReason(error, defect) {
|
|
|
6524
6511
|
*
|
|
6525
6512
|
* @see {@link CauseReason} for creating the corresponding schema
|
|
6526
6513
|
*
|
|
6527
|
-
* @category
|
|
6514
|
+
* @category schemas
|
|
6528
6515
|
* @since 4.0.0
|
|
6529
6516
|
*/
|
|
6530
6517
|
export const CauseReasonReviver = /*#__PURE__*/InternalSchema.makeDeclarationReviver("effect/schema/CauseReason", Null, ({
|
|
@@ -6586,7 +6573,7 @@ function causeReasonToFormatter(error, defect) {
|
|
|
6586
6573
|
* @see {@link CauseReason} for the schema used by each individual cause reason
|
|
6587
6574
|
* @see {@link CauseIso} for the ordered array representation used by the schema ISO
|
|
6588
6575
|
*
|
|
6589
|
-
* @category
|
|
6576
|
+
* @category schemas
|
|
6590
6577
|
* @since 3.10.0
|
|
6591
6578
|
*/
|
|
6592
6579
|
export function Cause(error, defect) {
|
|
@@ -6594,11 +6581,11 @@ export function Cause(error, defect) {
|
|
|
6594
6581
|
const failures = ArraySchema(CauseReason(error, defect));
|
|
6595
6582
|
return (input, ast, options) => {
|
|
6596
6583
|
if (!Cause_.isCause(input)) {
|
|
6597
|
-
return Effect.fail(new SchemaIssue.InvalidType(ast
|
|
6584
|
+
return Effect.fail(new SchemaIssue.InvalidType(ast));
|
|
6598
6585
|
}
|
|
6599
6586
|
return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(failures)(input.reasons, options), {
|
|
6600
6587
|
onSuccess: Cause_.fromReasons,
|
|
6601
|
-
onFailure: issue => new SchemaIssue.Composite(ast,
|
|
6588
|
+
onFailure: issue => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["failures"], issue)])
|
|
6602
6589
|
});
|
|
6603
6590
|
};
|
|
6604
6591
|
}, {
|
|
@@ -6638,7 +6625,7 @@ export function Cause(error, defect) {
|
|
|
6638
6625
|
*
|
|
6639
6626
|
* @see {@link Cause} for creating the corresponding schema
|
|
6640
6627
|
*
|
|
6641
|
-
* @category
|
|
6628
|
+
* @category schemas
|
|
6642
6629
|
* @since 4.0.0
|
|
6643
6630
|
*/
|
|
6644
6631
|
export const CauseReviver = /*#__PURE__*/InternalSchema.makeDeclarationReviver("effect/schema/Cause", Null, ({
|
|
@@ -6705,7 +6692,7 @@ const errorSchemaCache = [];
|
|
|
6705
6692
|
* traces are omitted by default for security. Pass `{ includeStack: true }` to
|
|
6706
6693
|
* include stack traces, or `{ excludeCause: true }` to omit causes.
|
|
6707
6694
|
*
|
|
6708
|
-
* @category
|
|
6695
|
+
* @category schemas
|
|
6709
6696
|
* @since 4.0.0
|
|
6710
6697
|
*/
|
|
6711
6698
|
export function Error(options) {
|
|
@@ -6740,7 +6727,7 @@ export function Error(options) {
|
|
|
6740
6727
|
*
|
|
6741
6728
|
* @see {@link Error} for creating the corresponding schema
|
|
6742
6729
|
*
|
|
6743
|
-
* @category
|
|
6730
|
+
* @category schemas
|
|
6744
6731
|
* @since 4.0.0
|
|
6745
6732
|
*/
|
|
6746
6733
|
export const ErrorReviver = /*#__PURE__*/InternalSchema.makeDeclarationReviver("effect/schema/Error", ErrorRepresentationPayload, ({
|
|
@@ -6789,7 +6776,7 @@ const defectSchemaCache = [];
|
|
|
6789
6776
|
* string representation.
|
|
6790
6777
|
*
|
|
6791
6778
|
* @see {@link Error} for a schema that only accepts JavaScript `Error` values.
|
|
6792
|
-
* @category
|
|
6779
|
+
* @category schemas
|
|
6793
6780
|
* @since 4.0.0
|
|
6794
6781
|
*/
|
|
6795
6782
|
export function Defect(options) {
|
|
@@ -6811,7 +6798,7 @@ export function Defect(options) {
|
|
|
6811
6798
|
* Use when serializing or validating an effect outcome where success, typed
|
|
6812
6799
|
* failure, and defects each need their own schema.
|
|
6813
6800
|
*
|
|
6814
|
-
* @category
|
|
6801
|
+
* @category schemas
|
|
6815
6802
|
* @since 3.10.0
|
|
6816
6803
|
*/
|
|
6817
6804
|
export function Exit(value, error, defect) {
|
|
@@ -6819,18 +6806,18 @@ export function Exit(value, error, defect) {
|
|
|
6819
6806
|
const cause = Cause(error, defect);
|
|
6820
6807
|
return (input, ast, options) => {
|
|
6821
6808
|
if (!Exit_.isExit(input)) {
|
|
6822
|
-
return Effect.fail(new SchemaIssue.InvalidType(ast
|
|
6809
|
+
return Effect.fail(new SchemaIssue.InvalidType(ast));
|
|
6823
6810
|
}
|
|
6824
6811
|
switch (input._tag) {
|
|
6825
6812
|
case "Success":
|
|
6826
6813
|
return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(value)(input.value, options), {
|
|
6827
6814
|
onSuccess: Exit_.succeed,
|
|
6828
|
-
onFailure: issue => new SchemaIssue.Composite(ast,
|
|
6815
|
+
onFailure: issue => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["value"], issue)])
|
|
6829
6816
|
});
|
|
6830
6817
|
case "Failure":
|
|
6831
6818
|
return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(cause)(input.cause, options), {
|
|
6832
6819
|
onSuccess: Exit_.failCause,
|
|
6833
|
-
onFailure: issue => new SchemaIssue.Composite(ast,
|
|
6820
|
+
onFailure: issue => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["cause"], issue)])
|
|
6834
6821
|
});
|
|
6835
6822
|
}
|
|
6836
6823
|
};
|
|
@@ -6908,7 +6895,7 @@ export function Exit(value, error, defect) {
|
|
|
6908
6895
|
*
|
|
6909
6896
|
* @see {@link Exit} for creating the corresponding schema
|
|
6910
6897
|
*
|
|
6911
|
-
* @category
|
|
6898
|
+
* @category schemas
|
|
6912
6899
|
* @since 4.0.0
|
|
6913
6900
|
*/
|
|
6914
6901
|
export const ExitReviver = /*#__PURE__*/InternalSchema.makeDeclarationReviver("effect/schema/Exit", Null, ({
|
|
@@ -6964,7 +6951,7 @@ function entriesArbitrary(fc, ctx, key, value, fromIterable) {
|
|
|
6964
6951
|
* Schema for readonly maps whose keys and values conform to the provided
|
|
6965
6952
|
* schemas.
|
|
6966
6953
|
*
|
|
6967
|
-
* @category
|
|
6954
|
+
* @category schemas
|
|
6968
6955
|
* @since 3.10.0
|
|
6969
6956
|
*/
|
|
6970
6957
|
export function ReadonlyMap(key, value) {
|
|
@@ -6974,10 +6961,10 @@ export function ReadonlyMap(key, value) {
|
|
|
6974
6961
|
if (input instanceof globalThis.Map) {
|
|
6975
6962
|
return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(array)([...input], options), {
|
|
6976
6963
|
onSuccess: array => new globalThis.Map(array),
|
|
6977
|
-
onFailure: issue => new SchemaIssue.Composite(ast,
|
|
6964
|
+
onFailure: issue => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["entries"], issue)])
|
|
6978
6965
|
});
|
|
6979
6966
|
}
|
|
6980
|
-
return Effect.fail(new SchemaIssue.InvalidType(ast
|
|
6967
|
+
return Effect.fail(new SchemaIssue.InvalidType(ast));
|
|
6981
6968
|
};
|
|
6982
6969
|
}, {
|
|
6983
6970
|
representation: {
|
|
@@ -7020,7 +7007,7 @@ export function ReadonlyMap(key, value) {
|
|
|
7020
7007
|
*
|
|
7021
7008
|
* @see {@link ReadonlyMap} for creating the corresponding schema
|
|
7022
7009
|
*
|
|
7023
|
-
* @category
|
|
7010
|
+
* @category schemas
|
|
7024
7011
|
* @since 4.0.0
|
|
7025
7012
|
*/
|
|
7026
7013
|
export const ReadonlyMapReviver = /*#__PURE__*/InternalSchema.makeDeclarationReviver("effect/schema/ReadonlyMap", Null, ({
|
|
@@ -7033,7 +7020,7 @@ export const ReadonlyMapReviver = /*#__PURE__*/InternalSchema.makeDeclarationRev
|
|
|
7033
7020
|
/**
|
|
7034
7021
|
* Schema for hash maps whose keys and values conform to the provided schemas.
|
|
7035
7022
|
*
|
|
7036
|
-
* @category
|
|
7023
|
+
* @category schemas
|
|
7037
7024
|
* @since 3.10.0
|
|
7038
7025
|
*/
|
|
7039
7026
|
export function HashMap(key, value) {
|
|
@@ -7043,10 +7030,10 @@ export function HashMap(key, value) {
|
|
|
7043
7030
|
if (HashMap_.isHashMap(input)) {
|
|
7044
7031
|
return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(entries)(HashMap_.toEntries(input), options), {
|
|
7045
7032
|
onSuccess: HashMap_.fromIterable,
|
|
7046
|
-
onFailure: issue => new SchemaIssue.Composite(ast,
|
|
7033
|
+
onFailure: issue => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["entries"], issue)])
|
|
7047
7034
|
});
|
|
7048
7035
|
}
|
|
7049
|
-
return Effect.fail(new SchemaIssue.InvalidType(ast
|
|
7036
|
+
return Effect.fail(new SchemaIssue.InvalidType(ast));
|
|
7050
7037
|
};
|
|
7051
7038
|
}, {
|
|
7052
7039
|
representation: {
|
|
@@ -7090,7 +7077,7 @@ export function HashMap(key, value) {
|
|
|
7090
7077
|
*
|
|
7091
7078
|
* @see {@link HashMap} for creating the corresponding schema
|
|
7092
7079
|
*
|
|
7093
|
-
* @category
|
|
7080
|
+
* @category schemas
|
|
7094
7081
|
* @since 4.0.0
|
|
7095
7082
|
*/
|
|
7096
7083
|
export const HashMapReviver = /*#__PURE__*/InternalSchema.makeDeclarationReviver("effect/schema/HashMap", Null, ({
|
|
@@ -7103,7 +7090,7 @@ export const HashMapReviver = /*#__PURE__*/InternalSchema.makeDeclarationReviver
|
|
|
7103
7090
|
/**
|
|
7104
7091
|
* Schema for readonly sets whose values conform to the provided element schema.
|
|
7105
7092
|
*
|
|
7106
|
-
* @category
|
|
7093
|
+
* @category schemas
|
|
7107
7094
|
* @since 3.10.0
|
|
7108
7095
|
*/
|
|
7109
7096
|
export function ReadonlySet(value) {
|
|
@@ -7113,10 +7100,10 @@ export function ReadonlySet(value) {
|
|
|
7113
7100
|
if (input instanceof globalThis.Set) {
|
|
7114
7101
|
return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(array)([...input], options), {
|
|
7115
7102
|
onSuccess: array => new globalThis.Set(array),
|
|
7116
|
-
onFailure: issue => new SchemaIssue.Composite(ast,
|
|
7103
|
+
onFailure: issue => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["values"], issue)])
|
|
7117
7104
|
});
|
|
7118
7105
|
}
|
|
7119
|
-
return Effect.fail(new SchemaIssue.InvalidType(ast
|
|
7106
|
+
return Effect.fail(new SchemaIssue.InvalidType(ast));
|
|
7120
7107
|
};
|
|
7121
7108
|
}, {
|
|
7122
7109
|
representation: {
|
|
@@ -7158,7 +7145,7 @@ export function ReadonlySet(value) {
|
|
|
7158
7145
|
*
|
|
7159
7146
|
* @see {@link ReadonlySet} for creating the corresponding schema
|
|
7160
7147
|
*
|
|
7161
|
-
* @category
|
|
7148
|
+
* @category schemas
|
|
7162
7149
|
* @since 4.0.0
|
|
7163
7150
|
*/
|
|
7164
7151
|
export const ReadonlySetReviver = /*#__PURE__*/InternalSchema.makeDeclarationReviver("effect/schema/ReadonlySet", Null, ({
|
|
@@ -7171,7 +7158,7 @@ export const ReadonlySetReviver = /*#__PURE__*/InternalSchema.makeDeclarationRev
|
|
|
7171
7158
|
/**
|
|
7172
7159
|
* Schema for hash sets whose values conform to the provided element schema.
|
|
7173
7160
|
*
|
|
7174
|
-
* @category
|
|
7161
|
+
* @category schemas
|
|
7175
7162
|
* @since 3.10.0
|
|
7176
7163
|
*/
|
|
7177
7164
|
export function HashSet(value) {
|
|
@@ -7181,10 +7168,10 @@ export function HashSet(value) {
|
|
|
7181
7168
|
if (HashSet_.isHashSet(input)) {
|
|
7182
7169
|
return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(values)(Arr.fromIterable(input), options), {
|
|
7183
7170
|
onSuccess: HashSet_.fromIterable,
|
|
7184
|
-
onFailure: issue => new SchemaIssue.Composite(ast,
|
|
7171
|
+
onFailure: issue => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["values"], issue)])
|
|
7185
7172
|
});
|
|
7186
7173
|
}
|
|
7187
|
-
return Effect.fail(new SchemaIssue.InvalidType(ast
|
|
7174
|
+
return Effect.fail(new SchemaIssue.InvalidType(ast));
|
|
7188
7175
|
};
|
|
7189
7176
|
}, {
|
|
7190
7177
|
representation: {
|
|
@@ -7226,7 +7213,7 @@ export function HashSet(value) {
|
|
|
7226
7213
|
*
|
|
7227
7214
|
* @see {@link HashSet} for creating the corresponding schema
|
|
7228
7215
|
*
|
|
7229
|
-
* @category
|
|
7216
|
+
* @category schemas
|
|
7230
7217
|
* @since 4.0.0
|
|
7231
7218
|
*/
|
|
7232
7219
|
export const HashSetReviver = /*#__PURE__*/InternalSchema.makeDeclarationReviver("effect/schema/HashSet", Null, ({
|
|
@@ -7239,7 +7226,7 @@ export const HashSetReviver = /*#__PURE__*/InternalSchema.makeDeclarationReviver
|
|
|
7239
7226
|
/**
|
|
7240
7227
|
* Schema for chunks whose values conform to the provided element schema.
|
|
7241
7228
|
*
|
|
7242
|
-
* @category
|
|
7229
|
+
* @category schemas
|
|
7243
7230
|
* @since 3.10.0
|
|
7244
7231
|
*/
|
|
7245
7232
|
export function Chunk(value) {
|
|
@@ -7249,10 +7236,10 @@ export function Chunk(value) {
|
|
|
7249
7236
|
if (Chunk_.isChunk(input)) {
|
|
7250
7237
|
return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(values)(Arr.fromIterable(input), options), {
|
|
7251
7238
|
onSuccess: Chunk_.fromIterable,
|
|
7252
|
-
onFailure: issue => new SchemaIssue.Composite(ast,
|
|
7239
|
+
onFailure: issue => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["values"], issue)])
|
|
7253
7240
|
});
|
|
7254
7241
|
}
|
|
7255
|
-
return Effect.fail(new SchemaIssue.InvalidType(ast
|
|
7242
|
+
return Effect.fail(new SchemaIssue.InvalidType(ast));
|
|
7256
7243
|
};
|
|
7257
7244
|
}, {
|
|
7258
7245
|
representation: {
|
|
@@ -7294,7 +7281,7 @@ export function Chunk(value) {
|
|
|
7294
7281
|
*
|
|
7295
7282
|
* @see {@link Chunk} for creating the corresponding schema
|
|
7296
7283
|
*
|
|
7297
|
-
* @category
|
|
7284
|
+
* @category schemas
|
|
7298
7285
|
* @since 4.0.0
|
|
7299
7286
|
*/
|
|
7300
7287
|
export const ChunkReviver = /*#__PURE__*/InternalSchema.makeDeclarationReviver("effect/schema/Chunk", Null, ({
|
|
@@ -7311,7 +7298,7 @@ export const ChunkReviver = /*#__PURE__*/InternalSchema.makeDeclarationReviver("
|
|
|
7311
7298
|
*
|
|
7312
7299
|
* The default JSON serializer encodes a `RegExp` as `{ source, flags }`.
|
|
7313
7300
|
*
|
|
7314
|
-
* @category
|
|
7301
|
+
* @category schemas
|
|
7315
7302
|
* @since 4.0.0
|
|
7316
7303
|
*/
|
|
7317
7304
|
export const RegExp = /*#__PURE__*/instanceOf(globalThis.RegExp, {
|
|
@@ -7330,8 +7317,8 @@ export const RegExp = /*#__PURE__*/instanceOf(globalThis.RegExp, {
|
|
|
7330
7317
|
}), SchemaTransformation.transformOrFail({
|
|
7331
7318
|
decode: e => Effect.try({
|
|
7332
7319
|
try: () => new globalThis.RegExp(e.source, e.flags),
|
|
7333
|
-
catch:
|
|
7334
|
-
message:
|
|
7320
|
+
catch: () => new SchemaIssue.InvalidValue({
|
|
7321
|
+
message: "Expected valid RegExp source and flags"
|
|
7335
7322
|
})
|
|
7336
7323
|
}),
|
|
7337
7324
|
encode: regExp => Effect.succeed({
|
|
@@ -7355,7 +7342,7 @@ export const RegExp = /*#__PURE__*/instanceOf(globalThis.RegExp, {
|
|
|
7355
7342
|
*
|
|
7356
7343
|
* @see {@link RegExp} for the corresponding schema
|
|
7357
7344
|
*
|
|
7358
|
-
* @category
|
|
7345
|
+
* @category schemas
|
|
7359
7346
|
* @since 4.0.0
|
|
7360
7347
|
*/
|
|
7361
7348
|
export const RegExpReviver = /*#__PURE__*/makeFixedDeclarationReviver("effect/schema/RegExp", RegExp);
|
|
@@ -7371,7 +7358,7 @@ const URLString = /*#__PURE__*/String.annotate({
|
|
|
7371
7358
|
*
|
|
7372
7359
|
* - encodes `URL` as a `string`
|
|
7373
7360
|
*
|
|
7374
|
-
* @category
|
|
7361
|
+
* @category schemas
|
|
7375
7362
|
* @since 4.0.0
|
|
7376
7363
|
*/
|
|
7377
7364
|
export const URL = /*#__PURE__*/instanceOf(globalThis.URL, {
|
|
@@ -7397,7 +7384,7 @@ export const URL = /*#__PURE__*/instanceOf(globalThis.URL, {
|
|
|
7397
7384
|
*
|
|
7398
7385
|
* @see {@link URL} for the corresponding schema
|
|
7399
7386
|
*
|
|
7400
|
-
* @category
|
|
7387
|
+
* @category schemas
|
|
7401
7388
|
* @since 4.0.0
|
|
7402
7389
|
*/
|
|
7403
7390
|
export const URLReviver = /*#__PURE__*/makeFixedDeclarationReviver("effect/schema/URL", URL);
|
|
@@ -7412,7 +7399,7 @@ export const URLReviver = /*#__PURE__*/makeFixedDeclarationReviver("effect/schem
|
|
|
7412
7399
|
* Encoding:
|
|
7413
7400
|
* - A `URL` is encoded as a `string`
|
|
7414
7401
|
*
|
|
7415
|
-
* @category
|
|
7402
|
+
* @category schemas
|
|
7416
7403
|
* @since 4.0.0
|
|
7417
7404
|
*/
|
|
7418
7405
|
export const URLFromString = /*#__PURE__*/URLString.pipe(/*#__PURE__*/decodeTo(URL, SchemaTransformation.urlFromString));
|
|
@@ -7454,17 +7441,17 @@ const DateString = /*#__PURE__*/String.annotate({
|
|
|
7454
7441
|
*
|
|
7455
7442
|
* **Example** (Defining a Date schema)
|
|
7456
7443
|
*
|
|
7457
|
-
* ```ts
|
|
7444
|
+
* ```ts import.meta.vitest
|
|
7458
7445
|
* import { Schema } from "effect"
|
|
7459
7446
|
*
|
|
7460
|
-
* Schema.decodeUnknownSync(Schema.Date)(new Date("2024-01-01"))
|
|
7461
|
-
* // =>
|
|
7447
|
+
* const date = Schema.decodeUnknownSync(Schema.Date)(new Date("2024-01-01"))
|
|
7448
|
+
* date.toISOString() // => "2024-01-01T00:00:00.000Z"
|
|
7462
7449
|
* ```
|
|
7463
7450
|
*
|
|
7464
7451
|
* @see {@link DateFromString} for decoding strings into Date instances
|
|
7465
7452
|
* @see {@link DateFromMillis} for decoding epoch milliseconds into Date instances
|
|
7466
7453
|
*
|
|
7467
|
-
* @category
|
|
7454
|
+
* @category schemas
|
|
7468
7455
|
* @since 4.0.0
|
|
7469
7456
|
*/
|
|
7470
7457
|
export const Date = /*#__PURE__*/declare(input => input instanceof globalThis.Date && !globalThis.Number.isNaN(input.getTime()), {
|
|
@@ -7491,7 +7478,7 @@ export const Date = /*#__PURE__*/declare(input => input instanceof globalThis.Da
|
|
|
7491
7478
|
*
|
|
7492
7479
|
* @see {@link Date} for the corresponding schema
|
|
7493
7480
|
*
|
|
7494
|
-
* @category
|
|
7481
|
+
* @category schemas
|
|
7495
7482
|
* @since 4.0.0
|
|
7496
7483
|
*/
|
|
7497
7484
|
export const DateReviver = /*#__PURE__*/makeFixedDeclarationReviver("effect/schema/Date", Date);
|
|
@@ -7517,7 +7504,7 @@ export const DateReviver = /*#__PURE__*/makeFixedDeclarationReviver("effect/sche
|
|
|
7517
7504
|
* @see {@link DateTimeUtcFromString} for decoding date-time strings into UTC values
|
|
7518
7505
|
* @see {@link Date} for accepting Date instances directly
|
|
7519
7506
|
*
|
|
7520
|
-
* @category
|
|
7507
|
+
* @category schemas
|
|
7521
7508
|
* @since 3.10.0
|
|
7522
7509
|
*/
|
|
7523
7510
|
export const DateFromString = /*#__PURE__*/DateString.pipe(/*#__PURE__*/decodeTo(Date, SchemaTransformation.dateFromString));
|
|
@@ -7546,7 +7533,7 @@ export const DateFromString = /*#__PURE__*/DateString.pipe(/*#__PURE__*/decodeTo
|
|
|
7546
7533
|
* @see {@link DateFromString} for decoding string-encoded dates
|
|
7547
7534
|
* @see {@link DateTimeUtcFromMillis} for decoding epoch milliseconds into UTC values
|
|
7548
7535
|
*
|
|
7549
|
-
* @category
|
|
7536
|
+
* @category schemas
|
|
7550
7537
|
* @since 4.0.0
|
|
7551
7538
|
*/
|
|
7552
7539
|
export const DateFromMillis = /*#__PURE__*/Int.pipe(/*#__PURE__*/decodeTo(Date, SchemaTransformation.dateFromMillis));
|
|
@@ -7560,14 +7547,13 @@ export const DateFromMillis = /*#__PURE__*/Int.pipe(/*#__PURE__*/decodeTo(Date,
|
|
|
7560
7547
|
*
|
|
7561
7548
|
* **Example** (Defining a Duration schema)
|
|
7562
7549
|
*
|
|
7563
|
-
* ```ts
|
|
7550
|
+
* ```ts import.meta.vitest
|
|
7564
7551
|
* import { Duration, Schema } from "effect"
|
|
7565
7552
|
*
|
|
7566
|
-
* Schema.decodeUnknownSync(Schema.Duration)(Duration.seconds(5))
|
|
7567
|
-
* // => Duration(5s)
|
|
7553
|
+
* Schema.decodeUnknownSync(Schema.Duration)(Duration.seconds(5)) // => Duration.seconds(5)
|
|
7568
7554
|
* ```
|
|
7569
7555
|
*
|
|
7570
|
-
* @category
|
|
7556
|
+
* @category schemas
|
|
7571
7557
|
*
|
|
7572
7558
|
* @since 3.10.0
|
|
7573
7559
|
*/
|
|
@@ -7641,7 +7627,7 @@ export const Duration = /*#__PURE__*/declare(Duration_.isDuration, {
|
|
|
7641
7627
|
*
|
|
7642
7628
|
* @see {@link Duration} for the corresponding schema
|
|
7643
7629
|
*
|
|
7644
|
-
* @category
|
|
7630
|
+
* @category schemas
|
|
7645
7631
|
* @since 4.0.0
|
|
7646
7632
|
*/
|
|
7647
7633
|
export const DurationReviver = /*#__PURE__*/makeFixedDeclarationReviver("effect/schema/Duration", Duration);
|
|
@@ -7660,7 +7646,7 @@ const DurationString = /*#__PURE__*/String.annotate({
|
|
|
7660
7646
|
* Encoding:
|
|
7661
7647
|
* - A `Duration` is encoded as a parseable `string`.
|
|
7662
7648
|
*
|
|
7663
|
-
* @category
|
|
7649
|
+
* @category schemas
|
|
7664
7650
|
* @since 4.0.0
|
|
7665
7651
|
*/
|
|
7666
7652
|
export const DurationFromString = /*#__PURE__*/DurationString.pipe(/*#__PURE__*/decodeTo(Duration, SchemaTransformation.durationFromString));
|
|
@@ -7678,7 +7664,7 @@ export const DurationFromString = /*#__PURE__*/DurationString.pipe(/*#__PURE__*/
|
|
|
7678
7664
|
* fails when the duration cannot be represented as nanoseconds, such as
|
|
7679
7665
|
* `Duration.infinity` or `Duration.negativeInfinity`.
|
|
7680
7666
|
*
|
|
7681
|
-
* @category
|
|
7667
|
+
* @category schemas
|
|
7682
7668
|
* @since 3.10.0
|
|
7683
7669
|
*/
|
|
7684
7670
|
export const DurationFromNanos = /*#__PURE__*/BigInt.pipe(/*#__PURE__*/decodeTo(Duration, SchemaTransformation.durationFromNanos));
|
|
@@ -7698,7 +7684,7 @@ export const DurationFromNanos = /*#__PURE__*/BigInt.pipe(/*#__PURE__*/decodeTo(
|
|
|
7698
7684
|
*
|
|
7699
7685
|
* `NaN` is decoded as `Duration.zero`, matching `Duration.millis`.
|
|
7700
7686
|
*
|
|
7701
|
-
* @category
|
|
7687
|
+
* @category schemas
|
|
7702
7688
|
* @since 3.10.0
|
|
7703
7689
|
*/
|
|
7704
7690
|
export const DurationFromMillis = /*#__PURE__*/Number.pipe(/*#__PURE__*/decodeTo(Duration, SchemaTransformation.durationFromMillis));
|
|
@@ -7768,7 +7754,7 @@ function bigDecimalScaleConstraints(ordered) {
|
|
|
7768
7754
|
*
|
|
7769
7755
|
* @see {@link BigDecimalFromString} for parsing string input into a BigDecimal
|
|
7770
7756
|
*
|
|
7771
|
-
* @category
|
|
7757
|
+
* @category schemas
|
|
7772
7758
|
* @since 3.10.0
|
|
7773
7759
|
*/
|
|
7774
7760
|
export const BigDecimal = /*#__PURE__*/declare(BigDecimal_.isBigDecimal, {
|
|
@@ -7811,7 +7797,7 @@ export const BigDecimal = /*#__PURE__*/declare(BigDecimal_.isBigDecimal, {
|
|
|
7811
7797
|
*
|
|
7812
7798
|
* @see {@link BigDecimal} for the corresponding schema
|
|
7813
7799
|
*
|
|
7814
|
-
* @category
|
|
7800
|
+
* @category schemas
|
|
7815
7801
|
* @since 4.0.0
|
|
7816
7802
|
*/
|
|
7817
7803
|
export const BigDecimalReviver = /*#__PURE__*/makeFixedDeclarationReviver("effect/schema/BigDecimal", BigDecimal);
|
|
@@ -7839,7 +7825,7 @@ export const BigDecimalReviver = /*#__PURE__*/makeFixedDeclarationReviver("effec
|
|
|
7839
7825
|
* @see {@link BigIntFromString} for parsing base-10 integer strings into bigint values
|
|
7840
7826
|
* @see {@link NumberFromString} for parsing JavaScript number strings
|
|
7841
7827
|
*
|
|
7842
|
-
* @category
|
|
7828
|
+
* @category schemas
|
|
7843
7829
|
* @since 4.0.0
|
|
7844
7830
|
*/
|
|
7845
7831
|
export const BigDecimalFromString = /*#__PURE__*/BigDecimalString.pipe(/*#__PURE__*/decodeTo(BigDecimal, SchemaTransformation.bigDecimalFromString));
|
|
@@ -7847,32 +7833,6 @@ const JsonString = /*#__PURE__*/String.annotate({
|
|
|
7847
7833
|
expected: "a string that will be decoded as JSON",
|
|
7848
7834
|
contentMediaType: "application/json"
|
|
7849
7835
|
});
|
|
7850
|
-
/**
|
|
7851
|
-
* Schema that decodes a JSON-encoded string into an `unknown` value.
|
|
7852
|
-
*
|
|
7853
|
-
* **Details**
|
|
7854
|
-
*
|
|
7855
|
-
* Decoding:
|
|
7856
|
-
* - A `string` is decoded as an `unknown` value.
|
|
7857
|
-
* - If the string is not valid JSON, decoding fails.
|
|
7858
|
-
*
|
|
7859
|
-
* Encoding:
|
|
7860
|
-
* - Any value is encoded as a JSON string using `JSON.stringify`.
|
|
7861
|
-
* - If the value is not a valid JSON value, encoding fails.
|
|
7862
|
-
*
|
|
7863
|
-
* **Example** (Decoding unknown JSON strings)
|
|
7864
|
-
*
|
|
7865
|
-
* ```ts
|
|
7866
|
-
* import { Schema } from "effect"
|
|
7867
|
-
*
|
|
7868
|
-
* Schema.decodeUnknownSync(Schema.UnknownFromJsonString)(`{"a":1,"b":2}`)
|
|
7869
|
-
* // => { a: 1, b: 2 }
|
|
7870
|
-
* ```
|
|
7871
|
-
*
|
|
7872
|
-
* @category schemas
|
|
7873
|
-
* @since 4.0.0
|
|
7874
|
-
*/
|
|
7875
|
-
export const UnknownFromJsonString = /*#__PURE__*/fromJsonString(Unknown);
|
|
7876
7836
|
/**
|
|
7877
7837
|
* Returns a schema that decodes a JSON string and then decodes the parsed value
|
|
7878
7838
|
* using the given schema.
|
|
@@ -7882,27 +7842,31 @@ export const UnknownFromJsonString = /*#__PURE__*/fromJsonString(Unknown);
|
|
|
7882
7842
|
* This is useful when working with JSON-encoded strings where the actual
|
|
7883
7843
|
* structure of the value is known and described by an existing schema.
|
|
7884
7844
|
*
|
|
7885
|
-
*
|
|
7886
|
-
* provided schema on the
|
|
7845
|
+
* During decoding, the resulting schema first parses the input string as JSON,
|
|
7846
|
+
* using `reviver` when provided, and then runs the provided schema on the
|
|
7847
|
+
* parsed result. During encoding, it first encodes with the provided schema and
|
|
7848
|
+
* then passes the result to `JSON.stringify` with the optional `replacer` and
|
|
7849
|
+
* `space`.
|
|
7887
7850
|
*
|
|
7888
|
-
* **Example** (
|
|
7851
|
+
* **Example** (Formatting encoded JSON)
|
|
7889
7852
|
*
|
|
7890
|
-
* ```ts
|
|
7853
|
+
* ```ts import.meta.vitest
|
|
7891
7854
|
* import { Schema } from "effect"
|
|
7892
7855
|
*
|
|
7893
7856
|
* const schema = Schema.Struct({ a: Schema.Number })
|
|
7894
|
-
* const schemaFromJsonString = Schema.fromJsonString(schema)
|
|
7857
|
+
* const schemaFromJsonString = Schema.fromJsonString(schema, { space: 2 })
|
|
7895
7858
|
*
|
|
7896
|
-
* Schema.
|
|
7897
|
-
* // => { a: 1 }
|
|
7859
|
+
* Schema.encodeSync(schemaFromJsonString)({ a: 1 }) // => "{\n \"a\": 1\n}"
|
|
7898
7860
|
* ```
|
|
7899
7861
|
*
|
|
7900
|
-
* @category
|
|
7862
|
+
* @category schemas
|
|
7901
7863
|
* @since 4.0.0
|
|
7902
7864
|
*/
|
|
7903
|
-
export function fromJsonString(schema) {
|
|
7904
|
-
return JsonString.pipe(decodeTo(schema, SchemaTransformation.fromJsonString));
|
|
7865
|
+
export function fromJsonString(schema, options) {
|
|
7866
|
+
return JsonString.pipe(decodeTo(schema, SchemaTransformation.fromJsonString(options)));
|
|
7905
7867
|
}
|
|
7868
|
+
/** @internal */
|
|
7869
|
+
export const UnknownFromJsonString = /*#__PURE__*/fromJsonString(Unknown);
|
|
7906
7870
|
/**
|
|
7907
7871
|
* Schema for JavaScript `File` objects.
|
|
7908
7872
|
*
|
|
@@ -7911,7 +7875,7 @@ export function fromJsonString(schema) {
|
|
|
7911
7875
|
* The default JSON serializer encodes a `File` as `{ data, type, name, lastModified }`
|
|
7912
7876
|
* where `data` is base64-encoded.
|
|
7913
7877
|
*
|
|
7914
|
-
* @category
|
|
7878
|
+
* @category schemas
|
|
7915
7879
|
* @since 4.0.0
|
|
7916
7880
|
*/
|
|
7917
7881
|
export const File = /*#__PURE__*/instanceOf(globalThis.File, {
|
|
@@ -7931,8 +7895,8 @@ export const File = /*#__PURE__*/instanceOf(globalThis.File, {
|
|
|
7931
7895
|
lastModified: Int
|
|
7932
7896
|
}), SchemaTransformation.transformOrFail({
|
|
7933
7897
|
decode: e => Result_.match(Encoding.decodeBase64(e.data), {
|
|
7934
|
-
onFailure:
|
|
7935
|
-
message:
|
|
7898
|
+
onFailure: () => Effect.fail(new SchemaIssue.InvalidValue({
|
|
7899
|
+
message: "Expected a valid Base64 string"
|
|
7936
7900
|
})),
|
|
7937
7901
|
onSuccess: bytes => {
|
|
7938
7902
|
const buffer = new globalThis.Uint8Array(bytes);
|
|
@@ -7952,8 +7916,8 @@ export const File = /*#__PURE__*/instanceOf(globalThis.File, {
|
|
|
7952
7916
|
lastModified: file.lastModified
|
|
7953
7917
|
};
|
|
7954
7918
|
},
|
|
7955
|
-
catch:
|
|
7956
|
-
message:
|
|
7919
|
+
catch: () => new SchemaIssue.InvalidValue({
|
|
7920
|
+
message: "Expected File to be readable"
|
|
7957
7921
|
})
|
|
7958
7922
|
})
|
|
7959
7923
|
}))
|
|
@@ -7967,7 +7931,7 @@ export const File = /*#__PURE__*/instanceOf(globalThis.File, {
|
|
|
7967
7931
|
*
|
|
7968
7932
|
* @see {@link File} for the corresponding schema
|
|
7969
7933
|
*
|
|
7970
|
-
* @category
|
|
7934
|
+
* @category schemas
|
|
7971
7935
|
* @since 4.0.0
|
|
7972
7936
|
*/
|
|
7973
7937
|
export const FileReviver = /*#__PURE__*/makeFixedDeclarationReviver("effect/schema/File", File);
|
|
@@ -7979,7 +7943,7 @@ export const FileReviver = /*#__PURE__*/makeFixedDeclarationReviver("effect/sche
|
|
|
7979
7943
|
* The default JSON serializer encodes a `FormData` as an array of `[key, entry]`
|
|
7980
7944
|
* pairs where each entry is tagged as `"String"` or `"File"`.
|
|
7981
7945
|
*
|
|
7982
|
-
* @category
|
|
7946
|
+
* @category schemas
|
|
7983
7947
|
* @since 4.0.0
|
|
7984
7948
|
*/
|
|
7985
7949
|
export const FormData = /*#__PURE__*/instanceOf(globalThis.FormData, {
|
|
@@ -8032,7 +7996,7 @@ export const FormData = /*#__PURE__*/instanceOf(globalThis.FormData, {
|
|
|
8032
7996
|
*
|
|
8033
7997
|
* @see {@link FormData} for the corresponding schema
|
|
8034
7998
|
*
|
|
8035
|
-
* @category
|
|
7999
|
+
* @category schemas
|
|
8036
8000
|
* @since 4.0.0
|
|
8037
8001
|
*/
|
|
8038
8002
|
export const FormDataReviver = /*#__PURE__*/makeFixedDeclarationReviver("effect/schema/FormData", FormData);
|
|
@@ -8057,7 +8021,7 @@ export const FormDataReviver = /*#__PURE__*/makeFixedDeclarationReviver("effect/
|
|
|
8057
8021
|
*
|
|
8058
8022
|
* **Example** (Decoding a flat structure)
|
|
8059
8023
|
*
|
|
8060
|
-
* ```ts
|
|
8024
|
+
* ```ts import.meta.vitest
|
|
8061
8025
|
* import { Schema } from "effect"
|
|
8062
8026
|
*
|
|
8063
8027
|
* const schema = Schema.fromFormData(
|
|
@@ -8070,13 +8034,12 @@ export const FormDataReviver = /*#__PURE__*/makeFixedDeclarationReviver("effect/
|
|
|
8070
8034
|
* formData.append("a", "1")
|
|
8071
8035
|
* formData.append("b", "2")
|
|
8072
8036
|
*
|
|
8073
|
-
*
|
|
8074
|
-
* // Success({"a":"1"})
|
|
8037
|
+
* Schema.decodeUnknownSync(schema)(formData) // => { a: "1" }
|
|
8075
8038
|
* ```
|
|
8076
8039
|
*
|
|
8077
8040
|
* **Example** (Decoding nested fields)
|
|
8078
8041
|
*
|
|
8079
|
-
* ```ts
|
|
8042
|
+
* ```ts import.meta.vitest
|
|
8080
8043
|
* import { Schema } from "effect"
|
|
8081
8044
|
*
|
|
8082
8045
|
* const schema = Schema.fromFormData(
|
|
@@ -8094,13 +8057,12 @@ export const FormDataReviver = /*#__PURE__*/makeFixedDeclarationReviver("effect/
|
|
|
8094
8057
|
* formData.append("b[c]", "2")
|
|
8095
8058
|
* formData.append("b[d]", "3")
|
|
8096
8059
|
*
|
|
8097
|
-
*
|
|
8098
|
-
* // Success({"a":"1","b":{"c":"2","d":"3"}})
|
|
8060
|
+
* Schema.decodeUnknownSync(schema)(formData) // => { a: "1", b: { c: "2", d: "3" } }
|
|
8099
8061
|
* ```
|
|
8100
8062
|
*
|
|
8101
8063
|
* **Example** (Parsing non-string values)
|
|
8102
8064
|
*
|
|
8103
|
-
* ```ts
|
|
8065
|
+
* ```ts import.meta.vitest
|
|
8104
8066
|
* import { Schema } from "effect"
|
|
8105
8067
|
*
|
|
8106
8068
|
* const schema = Schema.fromFormData(
|
|
@@ -8114,8 +8076,7 @@ export const FormDataReviver = /*#__PURE__*/makeFixedDeclarationReviver("effect/
|
|
|
8114
8076
|
* const formData = new FormData()
|
|
8115
8077
|
* formData.append("a", "1")
|
|
8116
8078
|
*
|
|
8117
|
-
*
|
|
8118
|
-
* // Success({"a":1}) // Note: the value is a number
|
|
8079
|
+
* Schema.decodeUnknownSync(schema)(formData) // => { a: 1 }
|
|
8119
8080
|
* ```
|
|
8120
8081
|
*
|
|
8121
8082
|
* @category decoding
|
|
@@ -8131,7 +8092,7 @@ export function fromFormData(schema) {
|
|
|
8131
8092
|
*
|
|
8132
8093
|
* The default JSON serializer encodes a `URLSearchParams` as a query string.
|
|
8133
8094
|
*
|
|
8134
|
-
* @category
|
|
8095
|
+
* @category schemas
|
|
8135
8096
|
* @since 4.0.0
|
|
8136
8097
|
*/
|
|
8137
8098
|
export const URLSearchParams = /*#__PURE__*/instanceOf(globalThis.URLSearchParams, {
|
|
@@ -8160,7 +8121,7 @@ export const URLSearchParams = /*#__PURE__*/instanceOf(globalThis.URLSearchParam
|
|
|
8160
8121
|
*
|
|
8161
8122
|
* @see {@link URLSearchParams} for the corresponding schema
|
|
8162
8123
|
*
|
|
8163
|
-
* @category
|
|
8124
|
+
* @category schemas
|
|
8164
8125
|
* @since 4.0.0
|
|
8165
8126
|
*/
|
|
8166
8127
|
export const URLSearchParamsReviver = /*#__PURE__*/makeFixedDeclarationReviver("effect/schema/URLSearchParams", URLSearchParams);
|
|
@@ -8186,7 +8147,7 @@ export const URLSearchParamsReviver = /*#__PURE__*/makeFixedDeclarationReviver("
|
|
|
8186
8147
|
*
|
|
8187
8148
|
* **Example** (Decoding a flat structure)
|
|
8188
8149
|
*
|
|
8189
|
-
* ```ts
|
|
8150
|
+
* ```ts import.meta.vitest
|
|
8190
8151
|
* import { Schema } from "effect"
|
|
8191
8152
|
*
|
|
8192
8153
|
* const schema = Schema.fromURLSearchParams(
|
|
@@ -8197,13 +8158,12 @@ export const URLSearchParamsReviver = /*#__PURE__*/makeFixedDeclarationReviver("
|
|
|
8197
8158
|
*
|
|
8198
8159
|
* const urlSearchParams = new URLSearchParams("a=1&b=2")
|
|
8199
8160
|
*
|
|
8200
|
-
*
|
|
8201
|
-
* // Success({"a":"1"})
|
|
8161
|
+
* Schema.decodeUnknownSync(schema)(urlSearchParams) // => { a: "1" }
|
|
8202
8162
|
* ```
|
|
8203
8163
|
*
|
|
8204
8164
|
* **Example** (Decoding nested fields)
|
|
8205
8165
|
*
|
|
8206
|
-
* ```ts
|
|
8166
|
+
* ```ts import.meta.vitest
|
|
8207
8167
|
* import { Schema } from "effect"
|
|
8208
8168
|
*
|
|
8209
8169
|
* const schema = Schema.fromURLSearchParams(
|
|
@@ -8218,13 +8178,12 @@ export const URLSearchParamsReviver = /*#__PURE__*/makeFixedDeclarationReviver("
|
|
|
8218
8178
|
*
|
|
8219
8179
|
* const urlSearchParams = new URLSearchParams("a=1&b[c]=2&b[d]=3")
|
|
8220
8180
|
*
|
|
8221
|
-
*
|
|
8222
|
-
* // Success({"a":"1","b":{"c":"2","d":"3"}})
|
|
8181
|
+
* Schema.decodeUnknownSync(schema)(urlSearchParams) // => { a: "1", b: { c: "2", d: "3" } }
|
|
8223
8182
|
* ```
|
|
8224
8183
|
*
|
|
8225
8184
|
* **Example** (Parsing non-string values)
|
|
8226
8185
|
*
|
|
8227
|
-
* ```ts
|
|
8186
|
+
* ```ts import.meta.vitest
|
|
8228
8187
|
* import { Schema } from "effect"
|
|
8229
8188
|
*
|
|
8230
8189
|
* const schema = Schema.fromURLSearchParams(
|
|
@@ -8237,8 +8196,7 @@ export const URLSearchParamsReviver = /*#__PURE__*/makeFixedDeclarationReviver("
|
|
|
8237
8196
|
*
|
|
8238
8197
|
* const urlSearchParams = new URLSearchParams("a=1&b=2")
|
|
8239
8198
|
*
|
|
8240
|
-
*
|
|
8241
|
-
* // Success({"a":1}) // Note: the value is a number
|
|
8199
|
+
* Schema.decodeUnknownSync(schema)(urlSearchParams) // => { a: 1 }
|
|
8242
8200
|
* ```
|
|
8243
8201
|
*
|
|
8244
8202
|
* @category decoding
|
|
@@ -8261,7 +8219,7 @@ export function fromURLSearchParams(schema) {
|
|
|
8261
8219
|
* Encoding:
|
|
8262
8220
|
* A number is encoded as a `string`.
|
|
8263
8221
|
*
|
|
8264
|
-
* @category
|
|
8222
|
+
* @category schemas
|
|
8265
8223
|
* @since 3.10.0
|
|
8266
8224
|
*/
|
|
8267
8225
|
export const NumberFromString = /*#__PURE__*/String.annotate({
|
|
@@ -8279,7 +8237,7 @@ export const NumberFromString = /*#__PURE__*/String.annotate({
|
|
|
8279
8237
|
* Encoding:
|
|
8280
8238
|
* - A finite number is encoded as a `string`.
|
|
8281
8239
|
*
|
|
8282
|
-
* @category
|
|
8240
|
+
* @category schemas
|
|
8283
8241
|
* @since 4.0.0
|
|
8284
8242
|
*/
|
|
8285
8243
|
export const FiniteFromString = /*#__PURE__*/String.annotate({
|
|
@@ -8310,14 +8268,14 @@ export const FiniteFromString = /*#__PURE__*/String.annotate({
|
|
|
8310
8268
|
* @see {@link NumberFromString} for parsing JavaScript number strings, including non-finite values
|
|
8311
8269
|
* @see {@link BigDecimalFromString} for parsing decimal number strings
|
|
8312
8270
|
*
|
|
8313
|
-
* @category
|
|
8271
|
+
* @category schemas
|
|
8314
8272
|
* @since 4.0.0
|
|
8315
8273
|
*/
|
|
8316
8274
|
export const BigIntFromString = /*#__PURE__*/make(SchemaAST.bigIntString).pipe(/*#__PURE__*/decodeTo(BigInt, SchemaTransformation.bigintFromString));
|
|
8317
8275
|
/**
|
|
8318
8276
|
* Schema for strings that contains no leading or trailing whitespaces.
|
|
8319
8277
|
*
|
|
8320
|
-
* @category
|
|
8278
|
+
* @category schemas
|
|
8321
8279
|
* @since 3.10.0
|
|
8322
8280
|
*/
|
|
8323
8281
|
export const Trimmed = /*#__PURE__*/String.check(/*#__PURE__*/isTrimmed());
|
|
@@ -8332,7 +8290,7 @@ export const Trimmed = /*#__PURE__*/String.check(/*#__PURE__*/isTrimmed());
|
|
|
8332
8290
|
* Encoding:
|
|
8333
8291
|
* - The trimmed string is encoded as is.
|
|
8334
8292
|
*
|
|
8335
|
-
* @category
|
|
8293
|
+
* @category schemas
|
|
8336
8294
|
* @since 3.10.0
|
|
8337
8295
|
*/
|
|
8338
8296
|
export const Trim = /*#__PURE__*/String.annotate({
|
|
@@ -8349,7 +8307,7 @@ export const Trim = /*#__PURE__*/String.annotate({
|
|
|
8349
8307
|
* Encoding:
|
|
8350
8308
|
* - A `string` is encoded as a base64-encoded string.
|
|
8351
8309
|
*
|
|
8352
|
-
* @category
|
|
8310
|
+
* @category schemas
|
|
8353
8311
|
* @since 3.10.0
|
|
8354
8312
|
*/
|
|
8355
8313
|
export const StringFromBase64 = /*#__PURE__*/String.annotate({
|
|
@@ -8366,7 +8324,7 @@ export const StringFromBase64 = /*#__PURE__*/String.annotate({
|
|
|
8366
8324
|
* Encoding:
|
|
8367
8325
|
* - A `string` is encoded as a base64 (URL) encoded string.
|
|
8368
8326
|
*
|
|
8369
|
-
* @category
|
|
8327
|
+
* @category schemas
|
|
8370
8328
|
* @since 3.10.0
|
|
8371
8329
|
*/
|
|
8372
8330
|
export const StringFromBase64Url = /*#__PURE__*/String.annotate({
|
|
@@ -8383,7 +8341,7 @@ export const StringFromBase64Url = /*#__PURE__*/String.annotate({
|
|
|
8383
8341
|
* Encoding:
|
|
8384
8342
|
* - A `string` is encoded as a hex string.
|
|
8385
8343
|
*
|
|
8386
|
-
* @category
|
|
8344
|
+
* @category schemas
|
|
8387
8345
|
* @since 3.10.0
|
|
8388
8346
|
*/
|
|
8389
8347
|
export const StringFromHex = /*#__PURE__*/String.annotate({
|
|
@@ -8403,7 +8361,7 @@ export const StringFromHex = /*#__PURE__*/String.annotate({
|
|
|
8403
8361
|
*
|
|
8404
8362
|
* **Example** (Decoding URI component strings)
|
|
8405
8363
|
*
|
|
8406
|
-
* ```ts
|
|
8364
|
+
* ```ts import.meta.vitest
|
|
8407
8365
|
* import { Schema } from "effect"
|
|
8408
8366
|
*
|
|
8409
8367
|
* const PaginationSchema = Schema.Struct({
|
|
@@ -8415,11 +8373,10 @@ export const StringFromHex = /*#__PURE__*/String.annotate({
|
|
|
8415
8373
|
* Schema.decodeTo(Schema.fromJsonString(PaginationSchema))
|
|
8416
8374
|
* )
|
|
8417
8375
|
*
|
|
8418
|
-
*
|
|
8419
|
-
* // %7B%22maxItemPerPage%22%3A10%2C%22page%22%3A1%7D
|
|
8376
|
+
* Schema.encodeSync(UrlSchema)({ maxItemPerPage: 10, page: 1 }) // => "%7B%22maxItemPerPage%22%3A10%2C%22page%22%3A1%7D"
|
|
8420
8377
|
* ```
|
|
8421
8378
|
*
|
|
8422
|
-
* @category
|
|
8379
|
+
* @category schemas
|
|
8423
8380
|
* @since 3.12.0
|
|
8424
8381
|
*/
|
|
8425
8382
|
export const StringFromUriComponent = /*#__PURE__*/String.annotate({
|
|
@@ -8429,7 +8386,7 @@ export const StringFromUriComponent = /*#__PURE__*/String.annotate({
|
|
|
8429
8386
|
* Schema for property keys accepted by Effect schemas: finite `number`,
|
|
8430
8387
|
* `symbol`, or `string`.
|
|
8431
8388
|
*
|
|
8432
|
-
* @category
|
|
8389
|
+
* @category schemas
|
|
8433
8390
|
* @since 4.0.0
|
|
8434
8391
|
*/
|
|
8435
8392
|
export const PropertyKey = /*#__PURE__*/Union([Finite, Symbol, String]);
|
|
@@ -8441,7 +8398,7 @@ export const PropertyKey = /*#__PURE__*/Union([Finite, Symbol, String]);
|
|
|
8441
8398
|
* The result contains an `issues` array where each issue has a message and an
|
|
8442
8399
|
* optional path made of property keys or keyed path segments.
|
|
8443
8400
|
*
|
|
8444
|
-
* @category
|
|
8401
|
+
* @category schemas
|
|
8445
8402
|
* @since 4.0.0
|
|
8446
8403
|
*/
|
|
8447
8404
|
export const StandardSchemaV1FailureResult = /*#__PURE__*/Struct({
|
|
@@ -8468,7 +8425,7 @@ export const StandardSchemaV1FailureResult = /*#__PURE__*/Struct({
|
|
|
8468
8425
|
* @see {@link Boolean} for validating values that are already booleans
|
|
8469
8426
|
* @see {@link Literals} for keeping bit literals instead of decoding them
|
|
8470
8427
|
*
|
|
8471
|
-
* @category
|
|
8428
|
+
* @category schemas
|
|
8472
8429
|
* @since 4.0.0
|
|
8473
8430
|
*/
|
|
8474
8431
|
export const BooleanFromBit = /*#__PURE__*/Literals([0, 1]).pipe(/*#__PURE__*/decodeTo(Boolean, /*#__PURE__*/SchemaTransformation.transform({
|
|
@@ -8489,7 +8446,7 @@ const Base64String = /*#__PURE__*/String.annotate({
|
|
|
8489
8446
|
*
|
|
8490
8447
|
* The default JSON serializer encodes Uint8Array as a Base64 encoded string.
|
|
8491
8448
|
*
|
|
8492
|
-
* @category
|
|
8449
|
+
* @category schemas
|
|
8493
8450
|
* @since 4.0.0
|
|
8494
8451
|
*/
|
|
8495
8452
|
export const Uint8Array = /*#__PURE__*/instanceOf(globalThis.Uint8Array, {
|
|
@@ -8514,7 +8471,7 @@ export const Uint8Array = /*#__PURE__*/instanceOf(globalThis.Uint8Array, {
|
|
|
8514
8471
|
*
|
|
8515
8472
|
* @see {@link Uint8Array} for the corresponding schema
|
|
8516
8473
|
*
|
|
8517
|
-
* @category
|
|
8474
|
+
* @category schemas
|
|
8518
8475
|
* @since 4.0.0
|
|
8519
8476
|
*/
|
|
8520
8477
|
export const Uint8ArrayReviver = /*#__PURE__*/makeFixedDeclarationReviver("effect/schema/Uint8Array", Uint8Array);
|
|
@@ -8530,7 +8487,7 @@ export const Uint8ArrayReviver = /*#__PURE__*/makeFixedDeclarationReviver("effec
|
|
|
8530
8487
|
* Encoding:
|
|
8531
8488
|
* - A `Uint8Array` is encoded as a base64-encoded string.
|
|
8532
8489
|
*
|
|
8533
|
-
* @category
|
|
8490
|
+
* @category schemas
|
|
8534
8491
|
* @since 3.10.0
|
|
8535
8492
|
*/
|
|
8536
8493
|
export const Uint8ArrayFromBase64 = /*#__PURE__*/Base64String.pipe(/*#__PURE__*/decodeTo(Uint8Array, SchemaTransformation.uint8ArrayFromBase64String));
|
|
@@ -8546,7 +8503,7 @@ export const Uint8ArrayFromBase64 = /*#__PURE__*/Base64String.pipe(/*#__PURE__*/
|
|
|
8546
8503
|
* Encoding:
|
|
8547
8504
|
* - A `Uint8Array` is encoded as a base64 (URL) encoded string.
|
|
8548
8505
|
*
|
|
8549
|
-
* @category
|
|
8506
|
+
* @category schemas
|
|
8550
8507
|
* @since 3.10.0
|
|
8551
8508
|
*/
|
|
8552
8509
|
export const Uint8ArrayFromBase64Url = /*#__PURE__*/String.annotate({
|
|
@@ -8567,7 +8524,7 @@ export const Uint8ArrayFromBase64Url = /*#__PURE__*/String.annotate({
|
|
|
8567
8524
|
* Encoding:
|
|
8568
8525
|
* - A `Uint8Array` is encoded as a hex encoded string.
|
|
8569
8526
|
*
|
|
8570
|
-
* @category
|
|
8527
|
+
* @category schemas
|
|
8571
8528
|
* @since 3.10.0
|
|
8572
8529
|
*/
|
|
8573
8530
|
export const Uint8ArrayFromHex = /*#__PURE__*/String.annotate({
|
|
@@ -8594,7 +8551,7 @@ export const Uint8ArrayFromHex = /*#__PURE__*/String.annotate({
|
|
|
8594
8551
|
* @see {@link DateTimeUtcFromMillis} for decoding epoch milliseconds into UTC values
|
|
8595
8552
|
* @see {@link DateTimeZoned} for preserving zoned DateTime values
|
|
8596
8553
|
*
|
|
8597
|
-
* @category
|
|
8554
|
+
* @category schemas
|
|
8598
8555
|
* @since 3.10.0
|
|
8599
8556
|
*/
|
|
8600
8557
|
export const DateTimeUtc = /*#__PURE__*/declare(u => DateTime.isDateTime(u) && DateTime.isUtc(u), {
|
|
@@ -8624,7 +8581,7 @@ export const DateTimeUtc = /*#__PURE__*/declare(u => DateTime.isDateTime(u) && D
|
|
|
8624
8581
|
*
|
|
8625
8582
|
* @see {@link DateTimeUtc} for the corresponding schema
|
|
8626
8583
|
*
|
|
8627
|
-
* @category
|
|
8584
|
+
* @category schemas
|
|
8628
8585
|
* @since 4.0.0
|
|
8629
8586
|
*/
|
|
8630
8587
|
export const DateTimeUtcReviver = /*#__PURE__*/makeFixedDeclarationReviver("effect/schema/DateTimeUtc", DateTimeUtc);
|
|
@@ -8649,7 +8606,7 @@ export const DateTimeUtcReviver = /*#__PURE__*/makeFixedDeclarationReviver("effe
|
|
|
8649
8606
|
* @see {@link DateTimeUtcFromMillis} for decoding epoch milliseconds into UTC values
|
|
8650
8607
|
* @see {@link Date} for validating Date instances without converting them
|
|
8651
8608
|
*
|
|
8652
|
-
* @category
|
|
8609
|
+
* @category schemas
|
|
8653
8610
|
* @since 3.12.0
|
|
8654
8611
|
*/
|
|
8655
8612
|
export const DateTimeUtcFromDate = /*#__PURE__*/Date.pipe(/*#__PURE__*/decodeTo(DateTimeUtc, {
|
|
@@ -8674,7 +8631,7 @@ export const DateTimeUtcFromDate = /*#__PURE__*/Date.pipe(/*#__PURE__*/decodeTo(
|
|
|
8674
8631
|
* @see {@link DateTimeUtcFromMillis} for decoding epoch milliseconds into UTC values
|
|
8675
8632
|
* @see {@link DateFromString} for decoding strings into JavaScript Date instances
|
|
8676
8633
|
*
|
|
8677
|
-
* @category
|
|
8634
|
+
* @category schemas
|
|
8678
8635
|
* @since 4.0.0
|
|
8679
8636
|
*/
|
|
8680
8637
|
export const DateTimeUtcFromString = /*#__PURE__*/String.annotate({
|
|
@@ -8695,7 +8652,7 @@ export const DateTimeUtcFromString = /*#__PURE__*/String.annotate({
|
|
|
8695
8652
|
* @see {@link DateTimeUtcFromString} for decoding date-time strings into UTC values
|
|
8696
8653
|
* @see {@link DateFromMillis} for decoding epoch milliseconds into JavaScript Date instances
|
|
8697
8654
|
*
|
|
8698
|
-
* @category
|
|
8655
|
+
* @category schemas
|
|
8699
8656
|
* @since 4.0.0
|
|
8700
8657
|
*/
|
|
8701
8658
|
export const DateTimeUtcFromMillis = /*#__PURE__*/Int.pipe(/*#__PURE__*/decodeTo(DateTimeUtc, {
|
|
@@ -8711,7 +8668,7 @@ export const DateTimeUtcFromMillis = /*#__PURE__*/Int.pipe(/*#__PURE__*/decodeTo
|
|
|
8711
8668
|
*
|
|
8712
8669
|
* - encodes `DateTime.TimeZone.Offset` as a number (offset in milliseconds)
|
|
8713
8670
|
*
|
|
8714
|
-
* @category
|
|
8671
|
+
* @category schemas
|
|
8715
8672
|
* @since 3.10.0
|
|
8716
8673
|
*/
|
|
8717
8674
|
export const TimeZoneOffset = /*#__PURE__*/declare(DateTime.isTimeZoneOffset, {
|
|
@@ -8742,7 +8699,7 @@ export const TimeZoneOffset = /*#__PURE__*/declare(DateTime.isTimeZoneOffset, {
|
|
|
8742
8699
|
*
|
|
8743
8700
|
* @see {@link TimeZoneOffset} for the corresponding schema
|
|
8744
8701
|
*
|
|
8745
|
-
* @category
|
|
8702
|
+
* @category schemas
|
|
8746
8703
|
* @since 4.0.0
|
|
8747
8704
|
*/
|
|
8748
8705
|
export const TimeZoneOffsetReviver = /*#__PURE__*/makeFixedDeclarationReviver("effect/schema/TimeZoneOffset", TimeZoneOffset);
|
|
@@ -8758,7 +8715,7 @@ const TimeZoneNamedString = /*#__PURE__*/String.annotate({
|
|
|
8758
8715
|
*
|
|
8759
8716
|
* - encodes `DateTime.TimeZone.Named` as a string (IANA time zone identifier)
|
|
8760
8717
|
*
|
|
8761
|
-
* @category
|
|
8718
|
+
* @category schemas
|
|
8762
8719
|
* @since 3.10.0
|
|
8763
8720
|
*/
|
|
8764
8721
|
export const TimeZoneNamed = /*#__PURE__*/declare(DateTime.isTimeZoneNamed, {
|
|
@@ -8786,7 +8743,7 @@ export const TimeZoneNamed = /*#__PURE__*/declare(DateTime.isTimeZoneNamed, {
|
|
|
8786
8743
|
*
|
|
8787
8744
|
* @see {@link TimeZoneNamed} for the corresponding schema
|
|
8788
8745
|
*
|
|
8789
|
-
* @category
|
|
8746
|
+
* @category schemas
|
|
8790
8747
|
* @since 4.0.0
|
|
8791
8748
|
*/
|
|
8792
8749
|
export const TimeZoneNamedReviver = /*#__PURE__*/makeFixedDeclarationReviver("effect/schema/TimeZoneNamed", TimeZoneNamed);
|
|
@@ -8801,7 +8758,7 @@ export const TimeZoneNamedReviver = /*#__PURE__*/makeFixedDeclarationReviver("ef
|
|
|
8801
8758
|
* Encoding:
|
|
8802
8759
|
* - A `DateTime.TimeZone.Named` is encoded as a `string`.
|
|
8803
8760
|
*
|
|
8804
|
-
* @category
|
|
8761
|
+
* @category schemas
|
|
8805
8762
|
* @since 4.0.0
|
|
8806
8763
|
*/
|
|
8807
8764
|
export const TimeZoneNamedFromString = /*#__PURE__*/TimeZoneNamedString.pipe(/*#__PURE__*/decodeTo(TimeZoneNamed, SchemaTransformation.timeZoneNamedFromString));
|
|
@@ -8818,7 +8775,7 @@ const TimeZoneString = /*#__PURE__*/String.annotate({
|
|
|
8818
8775
|
* - encodes `DateTime.TimeZone` as a string (IANA identifier or offset like
|
|
8819
8776
|
* `+03:00`)
|
|
8820
8777
|
*
|
|
8821
|
-
* @category
|
|
8778
|
+
* @category schemas
|
|
8822
8779
|
* @since 3.10.0
|
|
8823
8780
|
*/
|
|
8824
8781
|
export const TimeZone = /*#__PURE__*/declare(DateTime.isTimeZone, {
|
|
@@ -8849,7 +8806,7 @@ export const TimeZone = /*#__PURE__*/declare(DateTime.isTimeZone, {
|
|
|
8849
8806
|
*
|
|
8850
8807
|
* @see {@link TimeZone} for the corresponding schema
|
|
8851
8808
|
*
|
|
8852
|
-
* @category
|
|
8809
|
+
* @category schemas
|
|
8853
8810
|
* @since 4.0.0
|
|
8854
8811
|
*/
|
|
8855
8812
|
export const TimeZoneReviver = /*#__PURE__*/makeFixedDeclarationReviver("effect/schema/TimeZone", TimeZone);
|
|
@@ -8864,7 +8821,7 @@ export const TimeZoneReviver = /*#__PURE__*/makeFixedDeclarationReviver("effect/
|
|
|
8864
8821
|
* Encoding:
|
|
8865
8822
|
* - A `DateTime.TimeZone` is encoded as a `string`.
|
|
8866
8823
|
*
|
|
8867
|
-
* @category
|
|
8824
|
+
* @category schemas
|
|
8868
8825
|
* @since 4.0.0
|
|
8869
8826
|
*/
|
|
8870
8827
|
export const TimeZoneFromString = /*#__PURE__*/TimeZoneString.pipe(/*#__PURE__*/decodeTo(TimeZone, SchemaTransformation.timeZoneFromString));
|
|
@@ -8883,7 +8840,7 @@ const DateTimeZonedString = /*#__PURE__*/String.annotate({
|
|
|
8883
8840
|
* - encodes named zones by appending the IANA identifier in brackets, such as
|
|
8884
8841
|
* `YYYY-MM-DDTHH:mm:ss.sss+HH:MM[Time/Zone]`
|
|
8885
8842
|
*
|
|
8886
|
-
* @category
|
|
8843
|
+
* @category schemas
|
|
8887
8844
|
* @since 3.10.0
|
|
8888
8845
|
*/
|
|
8889
8846
|
export const DateTimeZoned = /*#__PURE__*/declare(u => DateTime.isDateTime(u) && DateTime.isZoned(u), {
|
|
@@ -8917,7 +8874,7 @@ export const DateTimeZoned = /*#__PURE__*/declare(u => DateTime.isDateTime(u) &&
|
|
|
8917
8874
|
*
|
|
8918
8875
|
* @see {@link DateTimeZoned} for the corresponding schema
|
|
8919
8876
|
*
|
|
8920
|
-
* @category
|
|
8877
|
+
* @category schemas
|
|
8921
8878
|
* @since 4.0.0
|
|
8922
8879
|
*/
|
|
8923
8880
|
export const DateTimeZonedReviver = /*#__PURE__*/makeFixedDeclarationReviver("effect/schema/DateTimeZoned", DateTimeZoned);
|
|
@@ -8932,7 +8889,7 @@ export const DateTimeZonedReviver = /*#__PURE__*/makeFixedDeclarationReviver("ef
|
|
|
8932
8889
|
* Encoding:
|
|
8933
8890
|
* - A `DateTime.Zoned` is encoded as a `string`.
|
|
8934
8891
|
*
|
|
8935
|
-
* @category
|
|
8892
|
+
* @category schemas
|
|
8936
8893
|
* @since 4.0.0
|
|
8937
8894
|
*/
|
|
8938
8895
|
export const DateTimeZonedFromString = /*#__PURE__*/DateTimeZonedString.pipe(/*#__PURE__*/decodeTo(DateTimeZoned, SchemaTransformation.dateTimeZonedFromString));
|
|
@@ -9012,7 +8969,12 @@ function makeClass(Inherited, identifier, struct, annotations, proto) {
|
|
|
9012
8969
|
return out;
|
|
9013
8970
|
}
|
|
9014
8971
|
function getClassTransformation(self) {
|
|
9015
|
-
return new SchemaTransformation.Transformation(SchemaGetter.transform(input => new self(input
|
|
8972
|
+
return new SchemaTransformation.Transformation(SchemaGetter.transform(input => new self(input, {
|
|
8973
|
+
"~payload": {
|
|
8974
|
+
token: payloadToken,
|
|
8975
|
+
value: input
|
|
8976
|
+
}
|
|
8977
|
+
})), SchemaGetter.passthrough());
|
|
9016
8978
|
}
|
|
9017
8979
|
function getClassTypeId(identifier) {
|
|
9018
8980
|
return `~effect/Schema/Class/${identifier}`;
|
|
@@ -9025,7 +8987,7 @@ function getClassSchemaFactory(from, identifier, annotations) {
|
|
|
9025
8987
|
}
|
|
9026
8988
|
const transformation = getClassTransformation(self);
|
|
9027
8989
|
const to = make(new SchemaAST.Declaration([from.ast], () => (input, ast) => {
|
|
9028
|
-
return input instanceof self || Predicate.hasProperty(input, getClassTypeId(identifier)) ? Effect.succeed(input) : Effect.fail(new SchemaIssue.InvalidType(ast
|
|
8990
|
+
return input instanceof self || Predicate.hasProperty(input, getClassTypeId(identifier)) ? Effect.succeed(input) : Effect.fail(new SchemaIssue.InvalidType(ast));
|
|
9029
8991
|
}, {
|
|
9030
8992
|
identifier,
|
|
9031
8993
|
[SchemaAST.ClassTypeId]: ([from]) => new SchemaAST.Link(from, transformation),
|
|
@@ -9059,13 +9021,23 @@ function isStruct(schema) {
|
|
|
9059
9021
|
* Pass the desired class type as the first type parameter. The second optional
|
|
9060
9022
|
* type parameter can be used to add nominal brands.
|
|
9061
9023
|
*
|
|
9024
|
+
* The `identifier` is the schema's stable runtime name. It is exposed on the
|
|
9025
|
+
* class, stored in the schema AST, and used to label diagnostics and generated
|
|
9026
|
+
* references as well as to format class instances.
|
|
9027
|
+
*
|
|
9028
|
+
* It also derives a runtime marker that recognizes instances across hot module
|
|
9029
|
+
* reloads, where `instanceof` can fail because the constructor has been
|
|
9030
|
+
* replaced. The identifier is explicit because the outer JavaScript class name
|
|
9031
|
+
* is not available while the `extends` expression is evaluated and may change
|
|
9032
|
+
* through renaming or minification.
|
|
9033
|
+
*
|
|
9062
9034
|
* **Gotchas**
|
|
9063
9035
|
*
|
|
9064
9036
|
* Passing `disableChecks` in the options skips constructor validation.
|
|
9065
9037
|
*
|
|
9066
9038
|
* **Example** (Defining a basic class)
|
|
9067
9039
|
*
|
|
9068
|
-
* ```ts
|
|
9040
|
+
* ```ts import.meta.vitest
|
|
9069
9041
|
* import { Schema } from "effect"
|
|
9070
9042
|
*
|
|
9071
9043
|
* class Person extends Schema.Class<Person>("Person")({
|
|
@@ -9074,13 +9046,13 @@ function isStruct(schema) {
|
|
|
9074
9046
|
* }) {}
|
|
9075
9047
|
*
|
|
9076
9048
|
* const alice = new Person({ name: "Alice", age: 30 })
|
|
9077
|
-
*
|
|
9078
|
-
*
|
|
9049
|
+
* alice.name // => "Alice"
|
|
9050
|
+
* String(alice) // => "Person({\"name\":\"Alice\",\"age\":30})"
|
|
9079
9051
|
* ```
|
|
9080
9052
|
*
|
|
9081
9053
|
* **Example** (Extending a class)
|
|
9082
9054
|
*
|
|
9083
|
-
* ```ts
|
|
9055
|
+
* ```ts import.meta.vitest
|
|
9084
9056
|
* import { Schema } from "effect"
|
|
9085
9057
|
*
|
|
9086
9058
|
* class Animal extends Schema.Class<Animal>("Animal")({
|
|
@@ -9092,8 +9064,8 @@ function isStruct(schema) {
|
|
|
9092
9064
|
* }) {}
|
|
9093
9065
|
*
|
|
9094
9066
|
* const dog = new Dog({ name: "Rex", breed: "Labrador" })
|
|
9095
|
-
*
|
|
9096
|
-
*
|
|
9067
|
+
* dog.name // => "Rex"
|
|
9068
|
+
* dog.breed // => "Labrador"
|
|
9097
9069
|
* ```
|
|
9098
9070
|
*
|
|
9099
9071
|
* @see {@link TaggedClass} for adding a `_tag` literal field to the class schema
|
|
@@ -9128,7 +9100,7 @@ export const Class = identifier => (schema, annotations) => {
|
|
|
9128
9100
|
*
|
|
9129
9101
|
* **Example** (Defining a tagged class)
|
|
9130
9102
|
*
|
|
9131
|
-
* ```ts
|
|
9103
|
+
* ```ts import.meta.vitest
|
|
9132
9104
|
* import { Schema } from "effect"
|
|
9133
9105
|
*
|
|
9134
9106
|
* class Circle extends Schema.TaggedClass<Circle>()("Circle", {
|
|
@@ -9136,8 +9108,8 @@ export const Class = identifier => (schema, annotations) => {
|
|
|
9136
9108
|
* }) {}
|
|
9137
9109
|
*
|
|
9138
9110
|
* const c = new Circle({ radius: 5 })
|
|
9139
|
-
*
|
|
9140
|
-
*
|
|
9111
|
+
* c._tag // => "Circle"
|
|
9112
|
+
* c.radius // => 5
|
|
9141
9113
|
* ```
|
|
9142
9114
|
*
|
|
9143
9115
|
* @category constructors
|
|
@@ -9162,7 +9134,7 @@ export const TaggedClass = identifier => {
|
|
|
9162
9134
|
*
|
|
9163
9135
|
* **Example** (Schema-backed error)
|
|
9164
9136
|
*
|
|
9165
|
-
* ```ts
|
|
9137
|
+
* ```ts import.meta.vitest
|
|
9166
9138
|
* import { Effect, Schema } from "effect"
|
|
9167
9139
|
*
|
|
9168
9140
|
* class NotFound extends Schema.ErrorClass<NotFound>("NotFound")({
|
|
@@ -9172,6 +9144,8 @@ export const TaggedClass = identifier => {
|
|
|
9172
9144
|
* const program = Effect.gen(function*() {
|
|
9173
9145
|
* yield* new NotFound({ id: 1 })
|
|
9174
9146
|
* })
|
|
9147
|
+
* const error = await Effect.runPromise(Effect.flip(program))
|
|
9148
|
+
* error.id // => 1
|
|
9175
9149
|
* ```
|
|
9176
9150
|
*
|
|
9177
9151
|
* @category constructors
|
|
@@ -9195,7 +9169,7 @@ export const ErrorClass = identifier => (schema, annotations) => {
|
|
|
9195
9169
|
*
|
|
9196
9170
|
* **Example** (Defining a tagged error class)
|
|
9197
9171
|
*
|
|
9198
|
-
* ```ts
|
|
9172
|
+
* ```ts import.meta.vitest
|
|
9199
9173
|
* import { Effect, Schema } from "effect"
|
|
9200
9174
|
*
|
|
9201
9175
|
* class NotFound extends Schema.TaggedErrorClass<NotFound>()("NotFound", {
|
|
@@ -9205,6 +9179,9 @@ export const ErrorClass = identifier => (schema, annotations) => {
|
|
|
9205
9179
|
* const program = Effect.gen(function*() {
|
|
9206
9180
|
* yield* new NotFound({ id: 42 })
|
|
9207
9181
|
* })
|
|
9182
|
+
* const error = await Effect.runPromise(Effect.flip(program))
|
|
9183
|
+
* error._tag // => "NotFound"
|
|
9184
|
+
* error.id // => 42
|
|
9208
9185
|
* ```
|
|
9209
9186
|
*
|
|
9210
9187
|
* @category constructors
|
|
@@ -9232,7 +9209,7 @@ export const TaggedErrorClass = identifier => {
|
|
|
9232
9209
|
* nodes, impossible constraints, invalid candidates, and recursive schemas
|
|
9233
9210
|
* without a finite terminal path fail immediately.
|
|
9234
9211
|
*
|
|
9235
|
-
* @category
|
|
9212
|
+
* @category generators
|
|
9236
9213
|
* @since 4.0.0
|
|
9237
9214
|
*/
|
|
9238
9215
|
export function toArbitraryLazy(schema) {
|
|
@@ -9263,7 +9240,7 @@ export function toArbitrary(schema, options) {
|
|
|
9263
9240
|
* The annotation is applied through this helper because adding it directly to
|
|
9264
9241
|
* `Annotations.Bottom` would make schemas invariant.
|
|
9265
9242
|
*
|
|
9266
|
-
* @category
|
|
9243
|
+
* @category formatting
|
|
9267
9244
|
* @since 4.0.0
|
|
9268
9245
|
*/
|
|
9269
9246
|
export function overrideToFormatter(toFormatter) {
|
|
@@ -9283,7 +9260,7 @@ export function overrideToFormatter(toFormatter) {
|
|
|
9283
9260
|
* The optional `onBefore` hook lets you intercept specific AST nodes before
|
|
9284
9261
|
* the default formatting logic runs.
|
|
9285
9262
|
*
|
|
9286
|
-
* @category
|
|
9263
|
+
* @category formatting
|
|
9287
9264
|
* @since 4.0.0
|
|
9288
9265
|
*/
|
|
9289
9266
|
export function toFormatter(schema, options) {
|
|
@@ -9444,13 +9421,13 @@ export function overrideToEquivalence(toEquivalence) {
|
|
|
9444
9421
|
*
|
|
9445
9422
|
* **Example** (Comparing structs)
|
|
9446
9423
|
*
|
|
9447
|
-
* ```ts
|
|
9424
|
+
* ```ts import.meta.vitest
|
|
9448
9425
|
* import { Schema } from "effect"
|
|
9449
9426
|
*
|
|
9450
9427
|
* const eq = Schema.toEquivalence(Schema.Struct({ id: Schema.Number, name: Schema.String }))
|
|
9451
9428
|
*
|
|
9452
|
-
*
|
|
9453
|
-
*
|
|
9429
|
+
* eq({ id: 1, name: "Alice" }, { id: 1, name: "Alice" }) // => true
|
|
9430
|
+
* eq({ id: 1, name: "Alice" }, { id: 2, name: "Alice" }) // => false
|
|
9454
9431
|
* ```
|
|
9455
9432
|
*
|
|
9456
9433
|
* @category instances
|
|
@@ -9470,7 +9447,7 @@ export function toEquivalence(schema) {
|
|
|
9470
9447
|
*
|
|
9471
9448
|
* Use {@link toType} before this function to represent the type side instead.
|
|
9472
9449
|
*
|
|
9473
|
-
* @category
|
|
9450
|
+
* @category converting
|
|
9474
9451
|
* @since 4.0.0
|
|
9475
9452
|
*/
|
|
9476
9453
|
export function toRepresentation(schema) {
|
|
@@ -9513,7 +9490,7 @@ export function toJsonSchemaDocument(schema, options) {
|
|
|
9513
9490
|
* `toCodecJson` callback can return `undefined` when the declaration is already
|
|
9514
9491
|
* in canonical JSON form.
|
|
9515
9492
|
*
|
|
9516
|
-
* @category
|
|
9493
|
+
* @category converting
|
|
9517
9494
|
* @since 4.0.0
|
|
9518
9495
|
*/
|
|
9519
9496
|
export function toCodecJson(schema) {
|
|
@@ -9528,19 +9505,7 @@ const toCodecJsonASTBase = /*#__PURE__*/SchemaAST.applyToSelfOrLastLinkEncoding(
|
|
|
9528
9505
|
return SchemaAST.replaceContextLastLink(out, withoutConstructorDefault(context));
|
|
9529
9506
|
});
|
|
9530
9507
|
/** @internal */
|
|
9531
|
-
export const toCodecJsonAST = /*#__PURE__*/memoize(
|
|
9532
|
-
const identifier = InternalAnnotations.resolveIdentifier(ast);
|
|
9533
|
-
const out = toCodecJsonASTBase(ast);
|
|
9534
|
-
if (identifier === undefined || out.encoding === undefined) return out;
|
|
9535
|
-
const encoded = SchemaAST.getLastEncoding(out);
|
|
9536
|
-
if (InternalAnnotations.resolveIdentifier(encoded) !== undefined || InternalAnnotations.resolveIdentifierFallback(encoded) === identifier) {
|
|
9537
|
-
return out;
|
|
9538
|
-
}
|
|
9539
|
-
const annotated = SchemaAST.annotate(encoded, {
|
|
9540
|
-
[InternalAnnotations.IDENTIFIER_FALLBACK_KEY]: identifier
|
|
9541
|
-
});
|
|
9542
|
-
return SchemaAST.applyToSelfOrLastLinkEncoding(() => annotated)(out);
|
|
9543
|
-
});
|
|
9508
|
+
export const toCodecJsonAST = /*#__PURE__*/memoize(toCodecJsonASTBase);
|
|
9544
9509
|
function withoutConstructorDefault(context) {
|
|
9545
9510
|
return context.defaultValue === undefined ? context : new SchemaAST.Context(context.isOptional, context.isMutable, undefined, context.annotations);
|
|
9546
9511
|
}
|
|
@@ -9633,7 +9598,7 @@ function toCodecJsonBase(ast, recur) {
|
|
|
9633
9598
|
* Derives an isomorphism codec from a schema. The encoded form is the
|
|
9634
9599
|
* schema's `Iso` type — the intermediate representation used for round-tripping.
|
|
9635
9600
|
*
|
|
9636
|
-
* @category
|
|
9601
|
+
* @category converting
|
|
9637
9602
|
* @since 4.0.0
|
|
9638
9603
|
*/
|
|
9639
9604
|
export function toCodecIso(schema) {
|
|
@@ -9672,7 +9637,7 @@ function toCodecIsoBase(ast, recur) {
|
|
|
9672
9637
|
* `toCodec` encoding. A callback can return `undefined` when the declaration is
|
|
9673
9638
|
* already in canonical StringTree form.
|
|
9674
9639
|
*
|
|
9675
|
-
* @category
|
|
9640
|
+
* @category converting
|
|
9676
9641
|
* @since 4.0.0
|
|
9677
9642
|
*/
|
|
9678
9643
|
export function toCodecStringTree(schema) {
|
|
@@ -9695,7 +9660,7 @@ export function toCodecStringTree(schema) {
|
|
|
9695
9660
|
* decoding convenience rather than a canonical StringTree representation. It
|
|
9696
9661
|
* does not parse comma-separated strings.
|
|
9697
9662
|
*
|
|
9698
|
-
* @category
|
|
9663
|
+
* @category converting
|
|
9699
9664
|
* @since 4.0.0
|
|
9700
9665
|
*/
|
|
9701
9666
|
export function toCodecArrayFromSingle(schema) {
|
|
@@ -9710,7 +9675,7 @@ export function toCodecArrayFromSingle(schema) {
|
|
|
9710
9675
|
* an `Effect` that succeeds with the XML string or fails with `SchemaError` if
|
|
9711
9676
|
* codec encoding fails.
|
|
9712
9677
|
*
|
|
9713
|
-
* @category
|
|
9678
|
+
* @category encoding
|
|
9714
9679
|
* @since 4.0.0
|
|
9715
9680
|
*/
|
|
9716
9681
|
export function toEncoderXml(codec, options) {
|
|
@@ -9919,7 +9884,7 @@ function onSerializerArrayFromSingle(ast) {
|
|
|
9919
9884
|
*
|
|
9920
9885
|
* @see {@link isGreaterThanDate} for creating the corresponding check
|
|
9921
9886
|
*
|
|
9922
|
-
* @category
|
|
9887
|
+
* @category validation
|
|
9923
9888
|
* @since 4.0.0
|
|
9924
9889
|
*/
|
|
9925
9890
|
export const isGreaterThanDateReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isGreaterThanDate", /*#__PURE__*/Struct({
|
|
@@ -9937,7 +9902,7 @@ export const isGreaterThanDateReviver = /*#__PURE__*/InternalSchema.makeFilterRe
|
|
|
9937
9902
|
*
|
|
9938
9903
|
* @see {@link isGreaterThanOrEqualToDate} for creating the corresponding check
|
|
9939
9904
|
*
|
|
9940
|
-
* @category
|
|
9905
|
+
* @category validation
|
|
9941
9906
|
* @since 4.0.0
|
|
9942
9907
|
*/
|
|
9943
9908
|
export const isGreaterThanOrEqualToDateReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isGreaterThanOrEqualToDate", /*#__PURE__*/Struct({
|
|
@@ -9955,7 +9920,7 @@ export const isGreaterThanOrEqualToDateReviver = /*#__PURE__*/InternalSchema.mak
|
|
|
9955
9920
|
*
|
|
9956
9921
|
* @see {@link isLessThanDate} for creating the corresponding check
|
|
9957
9922
|
*
|
|
9958
|
-
* @category
|
|
9923
|
+
* @category validation
|
|
9959
9924
|
* @since 4.0.0
|
|
9960
9925
|
*/
|
|
9961
9926
|
export const isLessThanDateReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isLessThanDate", /*#__PURE__*/Struct({
|
|
@@ -9973,7 +9938,7 @@ export const isLessThanDateReviver = /*#__PURE__*/InternalSchema.makeFilterReviv
|
|
|
9973
9938
|
*
|
|
9974
9939
|
* @see {@link isLessThanOrEqualToDate} for creating the corresponding check
|
|
9975
9940
|
*
|
|
9976
|
-
* @category
|
|
9941
|
+
* @category validation
|
|
9977
9942
|
* @since 4.0.0
|
|
9978
9943
|
*/
|
|
9979
9944
|
export const isLessThanOrEqualToDateReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isLessThanOrEqualToDate", /*#__PURE__*/Struct({
|
|
@@ -9991,7 +9956,7 @@ export const isLessThanOrEqualToDateReviver = /*#__PURE__*/InternalSchema.makeFi
|
|
|
9991
9956
|
*
|
|
9992
9957
|
* @see {@link isBetweenDate} for creating the corresponding check
|
|
9993
9958
|
*
|
|
9994
|
-
* @category
|
|
9959
|
+
* @category validation
|
|
9995
9960
|
* @since 4.0.0
|
|
9996
9961
|
*/
|
|
9997
9962
|
export const isBetweenDateReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isBetweenDate", /*#__PURE__*/Struct({
|
|
@@ -10012,7 +9977,7 @@ export const isBetweenDateReviver = /*#__PURE__*/InternalSchema.makeFilterRevive
|
|
|
10012
9977
|
*
|
|
10013
9978
|
* @see {@link isGreaterThanBigInt} for creating the corresponding check
|
|
10014
9979
|
*
|
|
10015
|
-
* @category
|
|
9980
|
+
* @category validation
|
|
10016
9981
|
* @since 4.0.0
|
|
10017
9982
|
*/
|
|
10018
9983
|
export const isGreaterThanBigIntReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isGreaterThanBigInt", /*#__PURE__*/Struct({
|
|
@@ -10030,7 +9995,7 @@ export const isGreaterThanBigIntReviver = /*#__PURE__*/InternalSchema.makeFilter
|
|
|
10030
9995
|
*
|
|
10031
9996
|
* @see {@link isGreaterThanOrEqualToBigInt} for creating the corresponding check
|
|
10032
9997
|
*
|
|
10033
|
-
* @category
|
|
9998
|
+
* @category validation
|
|
10034
9999
|
* @since 4.0.0
|
|
10035
10000
|
*/
|
|
10036
10001
|
export const isGreaterThanOrEqualToBigIntReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isGreaterThanOrEqualToBigInt", /*#__PURE__*/Struct({
|
|
@@ -10048,7 +10013,7 @@ export const isGreaterThanOrEqualToBigIntReviver = /*#__PURE__*/InternalSchema.m
|
|
|
10048
10013
|
*
|
|
10049
10014
|
* @see {@link isLessThanBigInt} for creating the corresponding check
|
|
10050
10015
|
*
|
|
10051
|
-
* @category
|
|
10016
|
+
* @category validation
|
|
10052
10017
|
* @since 4.0.0
|
|
10053
10018
|
*/
|
|
10054
10019
|
export const isLessThanBigIntReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isLessThanBigInt", /*#__PURE__*/Struct({
|
|
@@ -10066,7 +10031,7 @@ export const isLessThanBigIntReviver = /*#__PURE__*/InternalSchema.makeFilterRev
|
|
|
10066
10031
|
*
|
|
10067
10032
|
* @see {@link isLessThanOrEqualToBigInt} for creating the corresponding check
|
|
10068
10033
|
*
|
|
10069
|
-
* @category
|
|
10034
|
+
* @category validation
|
|
10070
10035
|
* @since 4.0.0
|
|
10071
10036
|
*/
|
|
10072
10037
|
export const isLessThanOrEqualToBigIntReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isLessThanOrEqualToBigInt", /*#__PURE__*/Struct({
|
|
@@ -10084,7 +10049,7 @@ export const isLessThanOrEqualToBigIntReviver = /*#__PURE__*/InternalSchema.make
|
|
|
10084
10049
|
*
|
|
10085
10050
|
* @see {@link isBetweenBigInt} for creating the corresponding check
|
|
10086
10051
|
*
|
|
10087
|
-
* @category
|
|
10052
|
+
* @category validation
|
|
10088
10053
|
* @since 4.0.0
|
|
10089
10054
|
*/
|
|
10090
10055
|
export const isBetweenBigIntReviver = /*#__PURE__*/InternalSchema.makeFilterReviver("effect/schema/isBetweenBigInt", /*#__PURE__*/Struct({
|
|
@@ -10103,7 +10068,7 @@ export const isBetweenBigIntReviver = /*#__PURE__*/InternalSchema.makeFilterRevi
|
|
|
10103
10068
|
* Derives an `Iso` optic from a schema that isomorphically converts between
|
|
10104
10069
|
* the schema's `Type` and its `Iso` (intermediate / serialized form).
|
|
10105
10070
|
*
|
|
10106
|
-
* @category
|
|
10071
|
+
* @category converting
|
|
10107
10072
|
* @since 4.0.0
|
|
10108
10073
|
*/
|
|
10109
10074
|
export function toIso(schema) {
|
|
@@ -10113,7 +10078,7 @@ export function toIso(schema) {
|
|
|
10113
10078
|
/**
|
|
10114
10079
|
* Returns an identity `Iso` over the schema's source (`Type`) side.
|
|
10115
10080
|
*
|
|
10116
|
-
* @category
|
|
10081
|
+
* @category constructors
|
|
10117
10082
|
* @since 4.0.0
|
|
10118
10083
|
*/
|
|
10119
10084
|
export function toIsoSource(_) {
|
|
@@ -10122,7 +10087,7 @@ export function toIsoSource(_) {
|
|
|
10122
10087
|
/**
|
|
10123
10088
|
* Returns an identity `Iso` over the schema's focus (`Iso`) side.
|
|
10124
10089
|
*
|
|
10125
|
-
* @category
|
|
10090
|
+
* @category constructors
|
|
10126
10091
|
* @since 4.0.0
|
|
10127
10092
|
*/
|
|
10128
10093
|
export function toIsoFocus(_) {
|
|
@@ -10142,7 +10107,7 @@ export function toIsoFocus(_) {
|
|
|
10142
10107
|
* provided `decode` and `encode` getters to transform between the schema type
|
|
10143
10108
|
* and the target codec.
|
|
10144
10109
|
*
|
|
10145
|
-
* @category
|
|
10110
|
+
* @category transforming
|
|
10146
10111
|
* @since 4.0.0
|
|
10147
10112
|
*/
|
|
10148
10113
|
export function overrideToCodecIso(to, transformation) {
|
|
@@ -10185,7 +10150,7 @@ export function toDifferJsonPatch(schema) {
|
|
|
10185
10150
|
* The resulting schema accepts a single node value, an array of trees, or an
|
|
10186
10151
|
* object whose values are trees.
|
|
10187
10152
|
*
|
|
10188
|
-
* @category
|
|
10153
|
+
* @category schemas
|
|
10189
10154
|
* @since 4.0.0
|
|
10190
10155
|
*/
|
|
10191
10156
|
export function Tree(node) {
|
|
@@ -10198,11 +10163,10 @@ export function Tree(node) {
|
|
|
10198
10163
|
*
|
|
10199
10164
|
* **Example** (Validating a JSON value)
|
|
10200
10165
|
*
|
|
10201
|
-
* ```ts
|
|
10202
|
-
* import { Schema } from "effect"
|
|
10166
|
+
* ```ts import.meta.vitest
|
|
10167
|
+
* import { Option, Schema } from "effect"
|
|
10203
10168
|
*
|
|
10204
|
-
*
|
|
10205
|
-
* console.log(result._tag) // "Some"
|
|
10169
|
+
* Schema.decodeUnknownOption(Schema.Json)({ key: [1, true, null] }) // => Option.some({ key: [1, true, null] })
|
|
10206
10170
|
* ```
|
|
10207
10171
|
*
|
|
10208
10172
|
* @category schemas
|
|
@@ -10268,7 +10232,7 @@ export const MutableJsonReviver = /*#__PURE__*/makeFixedDeclarationReviver("effe
|
|
|
10268
10232
|
* annotations are taken from the last check; otherwise they are taken from
|
|
10269
10233
|
* the base schema instance.
|
|
10270
10234
|
*
|
|
10271
|
-
* @category
|
|
10235
|
+
* @category getters
|
|
10272
10236
|
* @since 4.0.0
|
|
10273
10237
|
*/
|
|
10274
10238
|
export function resolveAnnotations(schema) {
|
|
@@ -10279,7 +10243,7 @@ export function resolveAnnotations(schema) {
|
|
|
10279
10243
|
* annotations are those attached via `annotateKey` and live on the AST's
|
|
10280
10244
|
* `context` rather than on the schema node itself.
|
|
10281
10245
|
*
|
|
10282
|
-
* @category
|
|
10246
|
+
* @category getters
|
|
10283
10247
|
* @since 4.0.0
|
|
10284
10248
|
*/
|
|
10285
10249
|
export function resolveAnnotationsKey(schema) {
|