effect 4.0.0-beta.102 → 4.0.0-beta.103
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Array.d.ts +971 -1037
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +381 -407
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +433 -756
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +200 -325
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts +207 -267
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +107 -135
- package/dist/BigInt.js.map +1 -1
- package/dist/Boolean.d.ts +146 -188
- package/dist/Boolean.d.ts.map +1 -1
- package/dist/Boolean.js +64 -84
- package/dist/Boolean.js.map +1 -1
- package/dist/Brand.js.map +1 -1
- package/dist/Cache.d.ts +405 -254
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +166 -101
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +167 -277
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Cause.js +122 -176
- package/dist/Cause.js.map +1 -1
- package/dist/Channel.d.ts +729 -768
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +514 -440
- package/dist/Channel.js.map +1 -1
- package/dist/ChannelSchema.d.ts +1 -1
- package/dist/ChannelSchema.d.ts.map +1 -1
- package/dist/ChannelSchema.js.map +1 -1
- package/dist/Chunk.d.ts +834 -1173
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +326 -439
- package/dist/Chunk.js.map +1 -1
- package/dist/Clock.d.ts +180 -49
- package/dist/Clock.d.ts.map +1 -1
- package/dist/Clock.js +96 -31
- package/dist/Clock.js.map +1 -1
- package/dist/Combiner.d.ts +20 -33
- package/dist/Combiner.d.ts.map +1 -1
- package/dist/Combiner.js +18 -30
- package/dist/Combiner.js.map +1 -1
- package/dist/Config.d.ts +225 -173
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +336 -265
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +194 -68
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +115 -80
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Console.d.ts +233 -33
- package/dist/Console.d.ts.map +1 -1
- package/dist/Console.js +232 -32
- package/dist/Console.js.map +1 -1
- package/dist/Context.d.ts +151 -274
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +171 -214
- package/dist/Context.js.map +1 -1
- package/dist/Cron.d.ts +68 -77
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +57 -66
- package/dist/Cron.js.map +1 -1
- package/dist/Crypto.d.ts +13 -15
- package/dist/Crypto.d.ts.map +1 -1
- package/dist/Crypto.js +9 -10
- package/dist/Crypto.js.map +1 -1
- package/dist/Data.d.ts +60 -80
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js +16 -23
- package/dist/Data.js.map +1 -1
- package/dist/DateTime.d.ts +562 -660
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +307 -362
- package/dist/DateTime.js.map +1 -1
- package/dist/Deferred.d.ts +253 -256
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +104 -96
- package/dist/Deferred.js.map +1 -1
- package/dist/Duration.d.ts +216 -308
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +132 -186
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +2841 -3247
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +1322 -1546
- package/dist/Effect.js.map +1 -1
- package/dist/Effectable.js.map +1 -1
- package/dist/Encoding.d.ts +22 -40
- package/dist/Encoding.d.ts.map +1 -1
- package/dist/Encoding.js +22 -40
- package/dist/Encoding.js.map +1 -1
- package/dist/Equal.d.ts +33 -37
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +29 -21
- package/dist/Equal.js.map +1 -1
- package/dist/Equivalence.d.ts +103 -105
- package/dist/Equivalence.d.ts.map +1 -1
- package/dist/Equivalence.js +77 -79
- package/dist/Equivalence.js.map +1 -1
- package/dist/ErrorReporter.d.ts +51 -27
- package/dist/ErrorReporter.d.ts.map +1 -1
- package/dist/ErrorReporter.js +50 -26
- package/dist/ErrorReporter.js.map +1 -1
- package/dist/ExecutionPlan.d.ts +13 -55
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/ExecutionPlan.js +7 -28
- package/dist/ExecutionPlan.js.map +1 -1
- package/dist/Exit.d.ts +116 -192
- package/dist/Exit.d.ts.map +1 -1
- package/dist/Exit.js +82 -130
- package/dist/Exit.js.map +1 -1
- package/dist/Fiber.d.ts +82 -146
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js +48 -87
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +152 -105
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +106 -73
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +213 -168
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +114 -89
- package/dist/FiberMap.js.map +1 -1
- package/dist/FiberSet.d.ts +123 -81
- package/dist/FiberSet.d.ts.map +1 -1
- package/dist/FiberSet.js +85 -59
- package/dist/FiberSet.js.map +1 -1
- package/dist/FileSystem.d.ts +153 -264
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +42 -147
- package/dist/FileSystem.js.map +1 -1
- package/dist/Filter.d.ts +61 -33
- package/dist/Filter.d.ts.map +1 -1
- package/dist/Filter.js +26 -15
- package/dist/Filter.js.map +1 -1
- package/dist/Formatter.d.ts +25 -33
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +48 -49
- package/dist/Formatter.js.map +1 -1
- package/dist/Function.d.ts +76 -145
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +40 -57
- package/dist/Function.js.map +1 -1
- package/dist/Graph.d.ts +360 -714
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +168 -297
- package/dist/Graph.js.map +1 -1
- package/dist/HKT.d.ts +12 -6
- package/dist/HKT.d.ts.map +1 -1
- package/dist/Hash.d.ts +47 -83
- package/dist/Hash.d.ts.map +1 -1
- package/dist/Hash.js +46 -68
- package/dist/Hash.js.map +1 -1
- package/dist/HashMap.d.ts +319 -411
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashMap.js +122 -166
- package/dist/HashMap.js.map +1 -1
- package/dist/HashRing.d.ts.map +1 -1
- package/dist/HashRing.js +1 -0
- package/dist/HashRing.js.map +1 -1
- package/dist/HashSet.d.ts +177 -284
- package/dist/HashSet.d.ts.map +1 -1
- package/dist/HashSet.js +68 -109
- package/dist/HashSet.js.map +1 -1
- package/dist/Inspectable.d.ts +12 -12
- package/dist/Inspectable.js +8 -8
- package/dist/Inspectable.js.map +1 -1
- package/dist/Iterable.d.ts +620 -786
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +228 -306
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonPatch.d.ts +11 -13
- package/dist/JsonPatch.d.ts.map +1 -1
- package/dist/JsonPatch.js +44 -102
- package/dist/JsonPatch.js.map +1 -1
- package/dist/JsonPointer.d.ts +8 -8
- package/dist/JsonPointer.js +8 -8
- package/dist/JsonPointer.js.map +1 -1
- package/dist/JsonSchema.d.ts +98 -44
- package/dist/JsonSchema.d.ts.map +1 -1
- package/dist/JsonSchema.js +297 -234
- package/dist/JsonSchema.js.map +1 -1
- package/dist/Latch.d.ts +23 -35
- package/dist/Latch.d.ts.map +1 -1
- package/dist/Latch.js +16 -28
- package/dist/Latch.js.map +1 -1
- package/dist/Layer.d.ts +359 -260
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +195 -175
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +42 -29
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +31 -21
- package/dist/LayerMap.js.map +1 -1
- package/dist/LayerRef.d.ts +6 -2
- package/dist/LayerRef.d.ts.map +1 -1
- package/dist/LayerRef.js +6 -2
- package/dist/LayerRef.js.map +1 -1
- package/dist/LogLevel.d.ts +114 -214
- package/dist/LogLevel.d.ts.map +1 -1
- package/dist/LogLevel.js +41 -76
- package/dist/LogLevel.js.map +1 -1
- package/dist/Logger.d.ts +218 -467
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +204 -450
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +7 -5
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/ManagedRuntime.js +7 -5
- package/dist/ManagedRuntime.js.map +1 -1
- package/dist/Match.d.ts +217 -252
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js +150 -183
- package/dist/Match.js.map +1 -1
- package/dist/Metric.d.ts +442 -993
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +198 -642
- package/dist/Metric.js.map +1 -1
- package/dist/MutableHashMap.d.ts +144 -173
- package/dist/MutableHashMap.d.ts.map +1 -1
- package/dist/MutableHashMap.js +68 -79
- package/dist/MutableHashMap.js.map +1 -1
- package/dist/MutableHashSet.d.ts +84 -89
- package/dist/MutableHashSet.d.ts.map +1 -1
- package/dist/MutableHashSet.js +44 -47
- package/dist/MutableHashSet.js.map +1 -1
- package/dist/MutableList.d.ts +71 -370
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +59 -284
- package/dist/MutableList.js.map +1 -1
- package/dist/MutableRef.d.ts +420 -243
- package/dist/MutableRef.d.ts.map +1 -1
- package/dist/MutableRef.js +209 -120
- package/dist/MutableRef.js.map +1 -1
- package/dist/Newtype.d.ts +21 -14
- package/dist/Newtype.d.ts.map +1 -1
- package/dist/Newtype.js +15 -13
- package/dist/Newtype.js.map +1 -1
- package/dist/NonEmptyIterable.d.ts +7 -137
- package/dist/NonEmptyIterable.d.ts.map +1 -1
- package/dist/NonEmptyIterable.js +5 -93
- package/dist/NonEmptyIterable.js.map +1 -1
- package/dist/Number.d.ts +196 -233
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +90 -109
- package/dist/Number.js.map +1 -1
- package/dist/Optic.d.ts +97 -189
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +187 -290
- package/dist/Optic.js.map +1 -1
- package/dist/Option.d.ts +447 -812
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +211 -392
- package/dist/Option.js.map +1 -1
- package/dist/Order.d.ts +109 -109
- package/dist/Order.js +91 -91
- package/dist/Order.js.map +1 -1
- package/dist/Ordering.d.ts +20 -23
- package/dist/Ordering.d.ts.map +1 -1
- package/dist/Ordering.js +8 -9
- package/dist/Ordering.js.map +1 -1
- package/dist/PartitionedSemaphore.js.map +1 -1
- package/dist/Path.d.ts +38 -41
- package/dist/Path.d.ts.map +1 -1
- package/dist/Path.js +3 -4
- package/dist/Path.js.map +1 -1
- package/dist/Pipeable.d.ts +6 -5
- package/dist/Pipeable.d.ts.map +1 -1
- package/dist/Pipeable.js +2 -2
- package/dist/Pipeable.js.map +1 -1
- package/dist/PlatformError.d.ts +4 -4
- package/dist/PlatformError.js +3 -3
- package/dist/PlatformError.js.map +1 -1
- package/dist/Pool.d.ts +4 -2
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +4 -2
- package/dist/Pool.js.map +1 -1
- package/dist/Predicate.d.ts +200 -181
- package/dist/Predicate.d.ts.map +1 -1
- package/dist/Predicate.js +100 -108
- package/dist/Predicate.js.map +1 -1
- package/dist/PrimaryKey.d.ts +7 -7
- package/dist/PrimaryKey.js +5 -5
- package/dist/PrimaryKey.js.map +1 -1
- package/dist/PubSub.d.ts +425 -494
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +373 -362
- package/dist/PubSub.js.map +1 -1
- package/dist/Pull.d.ts +24 -18
- package/dist/Pull.d.ts.map +1 -1
- package/dist/Pull.js +11 -9
- package/dist/Pull.js.map +1 -1
- package/dist/Queue.d.ts +200 -159
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +162 -132
- package/dist/Queue.js.map +1 -1
- package/dist/Random.d.ts +49 -74
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +35 -54
- package/dist/Random.js.map +1 -1
- package/dist/RcMap.d.ts +121 -63
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +42 -21
- package/dist/RcMap.js.map +1 -1
- package/dist/RcRef.d.ts +24 -13
- package/dist/RcRef.d.ts.map +1 -1
- package/dist/RcRef.js +15 -9
- package/dist/RcRef.js.map +1 -1
- package/dist/Record.d.ts +291 -488
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +111 -202
- package/dist/Record.js.map +1 -1
- package/dist/Redactable.d.ts +6 -2
- package/dist/Redactable.d.ts.map +1 -1
- package/dist/Redactable.js +7 -2
- package/dist/Redactable.js.map +1 -1
- package/dist/Redacted.d.ts +25 -25
- package/dist/Redacted.d.ts.map +1 -1
- package/dist/Redacted.js +19 -20
- package/dist/Redacted.js.map +1 -1
- package/dist/Reducer.d.ts +8 -15
- package/dist/Reducer.d.ts.map +1 -1
- package/dist/Reducer.js +6 -12
- package/dist/Reducer.js.map +1 -1
- package/dist/Ref.d.ts +95 -165
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +75 -122
- package/dist/Ref.js.map +1 -1
- package/dist/References.d.ts +102 -168
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +102 -168
- package/dist/References.js.map +1 -1
- package/dist/RegExp.d.ts +10 -14
- package/dist/RegExp.d.ts.map +1 -1
- package/dist/RegExp.js +10 -14
- package/dist/RegExp.js.map +1 -1
- package/dist/Request.d.ts +31 -21
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js +16 -13
- package/dist/Request.js.map +1 -1
- package/dist/RequestResolver.d.ts +201 -90
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +87 -41
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Resource.js.map +1 -1
- package/dist/Result.d.ts +302 -470
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +133 -217
- package/dist/Result.js.map +1 -1
- package/dist/Runtime.d.ts +50 -75
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +39 -60
- package/dist/Runtime.js.map +1 -1
- package/dist/Schedule.d.ts +290 -1636
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +162 -803
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts +5 -5
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +18 -6
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +644 -642
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +491 -527
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +27 -50
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +366 -279
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaError.d.ts +7 -6
- package/dist/SchemaError.d.ts.map +1 -1
- package/dist/SchemaError.js +7 -6
- package/dist/SchemaError.js.map +1 -1
- package/dist/SchemaGetter.d.ts +217 -174
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +218 -185
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.d.ts +62 -190
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js +73 -265
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.d.ts +2 -2
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +123 -75
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +22 -36
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +20 -26
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +114 -74
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +120 -85
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/Scope.d.ts +123 -151
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +72 -92
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.js.map +1 -1
- package/dist/ScopedRef.d.ts +3 -3
- package/dist/ScopedRef.js +2 -2
- package/dist/ScopedRef.js.map +1 -1
- package/dist/Semaphore.d.ts +96 -10
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js +78 -39
- package/dist/Semaphore.js.map +1 -1
- package/dist/Sink.d.ts +117 -107
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +107 -100
- package/dist/Sink.js.map +1 -1
- package/dist/Stdio.d.ts +1 -1
- package/dist/Stdio.js.map +1 -1
- package/dist/Stream.d.ts +2415 -2949
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +1078 -1381
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +262 -308
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +184 -215
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts +109 -114
- package/dist/Struct.d.ts.map +1 -1
- package/dist/Struct.js +41 -50
- package/dist/Struct.js.map +1 -1
- package/dist/SubscriptionRef.d.ts +282 -250
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +104 -92
- package/dist/SubscriptionRef.js.map +1 -1
- package/dist/Symbol.d.ts +3 -3
- package/dist/Symbol.js +3 -3
- package/dist/Symbol.js.map +1 -1
- package/dist/SynchronizedRef.js.map +1 -1
- package/dist/Take.js.map +1 -1
- package/dist/Terminal.d.ts +2 -2
- package/dist/Terminal.js +1 -1
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +100 -54
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +41 -24
- package/dist/Tracer.js.map +1 -1
- package/dist/Trie.d.ts +287 -679
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js +109 -251
- package/dist/Trie.js.map +1 -1
- package/dist/Tuple.d.ts +92 -127
- package/dist/Tuple.d.ts.map +1 -1
- package/dist/Tuple.js +42 -57
- package/dist/Tuple.js.map +1 -1
- package/dist/TxChunk.d.ts +201 -121
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxChunk.js +85 -56
- package/dist/TxChunk.js.map +1 -1
- package/dist/TxDeferred.d.ts +62 -46
- package/dist/TxDeferred.d.ts.map +1 -1
- package/dist/TxDeferred.js +30 -22
- package/dist/TxDeferred.js.map +1 -1
- package/dist/TxHashMap.d.ts +631 -779
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +268 -330
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxHashSet.d.ts +297 -236
- package/dist/TxHashSet.d.ts.map +1 -1
- package/dist/TxHashSet.js +130 -100
- package/dist/TxHashSet.js.map +1 -1
- package/dist/TxPriorityQueue.d.ts +126 -95
- package/dist/TxPriorityQueue.d.ts.map +1 -1
- package/dist/TxPriorityQueue.js +74 -56
- package/dist/TxPriorityQueue.js.map +1 -1
- package/dist/TxPubSub.d.ts +101 -88
- package/dist/TxPubSub.d.ts.map +1 -1
- package/dist/TxPubSub.js +87 -66
- package/dist/TxPubSub.js.map +1 -1
- package/dist/TxQueue.d.ts +200 -180
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxQueue.js +160 -136
- package/dist/TxQueue.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +97 -66
- package/dist/TxReentrantLock.d.ts.map +1 -1
- package/dist/TxReentrantLock.js +67 -45
- package/dist/TxReentrantLock.js.map +1 -1
- package/dist/TxRef.d.ts +51 -32
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +23 -15
- package/dist/TxRef.js.map +1 -1
- package/dist/TxSemaphore.d.ts +129 -95
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +85 -70
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/TxSubscriptionRef.d.ts +97 -70
- package/dist/TxSubscriptionRef.d.ts.map +1 -1
- package/dist/TxSubscriptionRef.js +44 -34
- package/dist/TxSubscriptionRef.js.map +1 -1
- package/dist/Types.d.ts +126 -67
- package/dist/Types.d.ts.map +1 -1
- package/dist/UndefinedOr.js.map +1 -1
- package/dist/Unify.d.ts +45 -65
- package/dist/Unify.d.ts.map +1 -1
- package/dist/Unify.js +6 -9
- package/dist/Unify.js.map +1 -1
- package/dist/Utils.d.ts +23 -16
- package/dist/Utils.d.ts.map +1 -1
- package/dist/Utils.js +3 -7
- package/dist/Utils.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/array.js.map +1 -1
- package/dist/internal/core.js +1 -1
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/dateTime.js +4 -0
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/doNotation.js.map +1 -1
- package/dist/internal/effect.js +77 -40
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/equal.js.map +1 -1
- package/dist/internal/errors.js.map +1 -1
- package/dist/internal/executionPlan.js.map +1 -1
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/hashSet.js.map +1 -1
- package/dist/internal/layer.js.map +1 -1
- package/dist/internal/matcher.js.map +1 -1
- package/dist/internal/metric.js.map +1 -1
- package/dist/internal/option.js.map +1 -1
- package/dist/internal/persistence.d.ts +2 -0
- package/dist/internal/persistence.d.ts.map +1 -0
- package/dist/internal/persistence.js +3 -0
- package/dist/internal/persistence.js.map +1 -0
- package/dist/internal/random.js.map +1 -1
- package/dist/internal/rcRef.js.map +1 -1
- package/dist/internal/record.js.map +1 -1
- package/dist/internal/redacted.js.map +1 -1
- package/dist/internal/references.js +3 -0
- package/dist/internal/references.js.map +1 -1
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/result.js.map +1 -1
- package/dist/internal/schedule.js.map +1 -1
- package/dist/internal/schema/annotations.js.map +1 -1
- package/dist/internal/schema/cause.js.map +1 -1
- package/dist/internal/schema/fromJsonSchemaDocument.js +13 -11
- package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -1
- package/dist/internal/schema/fromRepresentation.js +8 -15
- package/dist/internal/schema/fromRepresentation.js.map +1 -1
- package/dist/internal/schema/parser.d.ts +14 -0
- package/dist/internal/schema/parser.d.ts.map +1 -0
- package/dist/internal/schema/parser.js +13 -0
- package/dist/internal/schema/parser.js.map +1 -0
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/internal/schema/toArbitrary.js.map +1 -1
- package/dist/internal/schema/toCodeDocument.js.map +1 -1
- package/dist/internal/schema/toEquivalence.js.map +1 -1
- package/dist/internal/schema/toJsonSchemaDocument.js +48 -6
- package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -1
- package/dist/internal/schema/toRepresentation.js +87 -107
- package/dist/internal/schema/toRepresentation.js.map +1 -1
- package/dist/internal/stackTraceLimit.js.map +1 -1
- package/dist/internal/stream.js.map +1 -1
- package/dist/internal/tracer.js.map +1 -1
- package/dist/internal/trie.js +13 -9
- package/dist/internal/trie.js.map +1 -1
- package/dist/testing/FastCheck.d.ts +8 -7
- package/dist/testing/FastCheck.d.ts.map +1 -1
- package/dist/testing/FastCheck.js +8 -7
- package/dist/testing/FastCheck.js.map +1 -1
- package/dist/testing/TestClock.d.ts +57 -28
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestClock.js +50 -18
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/testing/TestConsole.d.ts +32 -31
- package/dist/testing/TestConsole.d.ts.map +1 -1
- package/dist/testing/TestConsole.js +24 -22
- package/dist/testing/TestConsole.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +29 -29
- package/dist/testing/TestSchema.js +25 -25
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/testing/index.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +95 -118
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +94 -117
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +132 -97
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +55 -51
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
- package/dist/unstable/ai/IdGenerator.d.ts +32 -28
- package/dist/unstable/ai/IdGenerator.d.ts.map +1 -1
- package/dist/unstable/ai/IdGenerator.js +26 -21
- package/dist/unstable/ai/IdGenerator.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +107 -67
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +104 -64
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpProtocol.d.ts +30 -0
- package/dist/unstable/ai/McpProtocol.d.ts.map +1 -0
- package/dist/unstable/ai/McpProtocol.js +20 -0
- package/dist/unstable/ai/McpProtocol.js.map +1 -0
- package/dist/unstable/ai/McpSchema.d.ts +141 -75
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js +58 -50
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +68 -59
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +694 -241
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/Model.d.ts +8 -19
- package/dist/unstable/ai/Model.d.ts.map +1 -1
- package/dist/unstable/ai/Model.js +9 -20
- package/dist/unstable/ai/Model.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Prompt.d.ts +112 -38
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Prompt.js +53 -17
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +28 -14
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js +9 -4
- package/dist/unstable/ai/Response.js.map +1 -1
- package/dist/unstable/ai/ResponseIdTracker.js.map +1 -1
- package/dist/unstable/ai/Telemetry.d.ts +46 -13
- package/dist/unstable/ai/Telemetry.d.ts.map +1 -1
- package/dist/unstable/ai/Telemetry.js +18 -7
- package/dist/unstable/ai/Telemetry.js.map +1 -1
- package/dist/unstable/ai/Tokenizer.d.ts +14 -3
- package/dist/unstable/ai/Tokenizer.d.ts.map +1 -1
- package/dist/unstable/ai/Tokenizer.js +10 -2
- package/dist/unstable/ai/Tokenizer.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +59 -44
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +48 -39
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +26 -8
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +18 -4
- package/dist/unstable/ai/Toolkit.js.map +1 -1
- package/dist/unstable/ai/index.d.ts +4 -0
- package/dist/unstable/ai/index.d.ts.map +1 -1
- package/dist/unstable/ai/index.js +4 -0
- package/dist/unstable/ai/index.js.map +1 -1
- package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
- package/dist/unstable/ai/internal/mcpProtocol.d.ts +21 -0
- package/dist/unstable/ai/internal/mcpProtocol.d.ts.map +1 -0
- package/dist/unstable/ai/internal/mcpProtocol.js +22 -0
- package/dist/unstable/ai/internal/mcpProtocol.js.map +1 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.d.ts +2 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.d.ts.map +1 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.js +32 -0
- package/dist/unstable/ai/internal/mcpProtocolRegistry.js.map +1 -0
- package/dist/unstable/ai/internal/structured-output.js +14 -15
- package/dist/unstable/ai/internal/structured-output.js.map +1 -1
- package/dist/unstable/cli/Argument.d.ts +273 -69
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js +111 -33
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/CliConfig.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +69 -76
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +57 -61
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/CliOutput.d.ts +35 -54
- package/dist/unstable/cli/CliOutput.d.ts.map +1 -1
- package/dist/unstable/cli/CliOutput.js +26 -42
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +705 -107
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +238 -42
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Completions.js.map +1 -1
- package/dist/unstable/cli/Flag.d.ts +418 -138
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +197 -71
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +1 -1
- package/dist/unstable/cli/GlobalFlag.js.map +1 -1
- package/dist/unstable/cli/HelpDoc.d.ts +12 -4
- package/dist/unstable/cli/HelpDoc.d.ts.map +1 -1
- package/dist/unstable/cli/Param.d.ts +292 -78
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +128 -46
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +370 -149
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js +344 -136
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/Prompt.d.ts +23 -14
- package/dist/unstable/cli/Prompt.d.ts.map +1 -1
- package/dist/unstable/cli/Prompt.js +23 -14
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/index.js.map +1 -1
- package/dist/unstable/cli/internal/ansi.js.map +1 -1
- package/dist/unstable/cli/internal/auto-suggest.js.map +1 -1
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/completions/bash.js.map +1 -1
- package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -1
- package/dist/unstable/cli/internal/completions/fish.js.map +1 -1
- package/dist/unstable/cli/internal/completions/zsh.js.map +1 -1
- package/dist/unstable/cli/internal/config.js.map +1 -1
- package/dist/unstable/cli/internal/help.js.map +1 -1
- package/dist/unstable/cli/internal/lexer.js +17 -7
- package/dist/unstable/cli/internal/lexer.js.map +1 -1
- package/dist/unstable/cli/internal/parser.js +2 -2
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cli/internal/wizard.js.map +1 -1
- package/dist/unstable/cluster/ClusterCron.js.map +1 -1
- package/dist/unstable/cluster/ClusterError.js.map +1 -1
- package/dist/unstable/cluster/ClusterMetrics.js.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.d.ts +8 -8
- package/dist/unstable/cluster/ClusterSchema.js +8 -8
- package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +5 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/DeliverAt.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts +10 -10
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +8 -8
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/EntityAddress.js.map +1 -1
- package/dist/unstable/cluster/EntityId.js.map +1 -1
- package/dist/unstable/cluster/EntityProxy.d.ts +4 -2
- package/dist/unstable/cluster/EntityProxy.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxy.js +4 -2
- package/dist/unstable/cluster/EntityProxy.js.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
- package/dist/unstable/cluster/EntityResource.d.ts +2 -2
- package/dist/unstable/cluster/EntityResource.js +2 -2
- package/dist/unstable/cluster/EntityResource.js.map +1 -1
- package/dist/unstable/cluster/EntityType.js.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts +3 -3
- package/dist/unstable/cluster/Envelope.js +3 -3
- package/dist/unstable/cluster/Envelope.js.map +1 -1
- package/dist/unstable/cluster/HttpRunner.d.ts +2 -2
- package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/HttpRunner.js +6 -4
- package/dist/unstable/cluster/HttpRunner.js.map +1 -1
- package/dist/unstable/cluster/K8sHttpClient.js.map +1 -1
- package/dist/unstable/cluster/MachineId.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +9 -9
- package/dist/unstable/cluster/Message.js +6 -6
- package/dist/unstable/cluster/Message.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +15 -15
- package/dist/unstable/cluster/MessageStorage.js +5 -5
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +4 -4
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/Runner.js.map +1 -1
- package/dist/unstable/cluster/RunnerAddress.js.map +1 -1
- package/dist/unstable/cluster/RunnerHealth.d.ts +1 -1
- package/dist/unstable/cluster/RunnerHealth.js +1 -1
- package/dist/unstable/cluster/RunnerHealth.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts +2 -1
- package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +16 -16
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/RunnerStorage.d.ts +2 -2
- package/dist/unstable/cluster/RunnerStorage.js +1 -1
- package/dist/unstable/cluster/RunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +6 -6
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +19 -10
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/ShardId.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +3 -2
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.d.ts +3 -3
- package/dist/unstable/cluster/ShardingConfig.js +3 -3
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/ShardingRegistrationEvent.js.map +1 -1
- package/dist/unstable/cluster/SingleRunner.js.map +1 -1
- package/dist/unstable/cluster/Singleton.js.map +1 -1
- package/dist/unstable/cluster/SingletonAddress.d.ts +1 -1
- package/dist/unstable/cluster/SingletonAddress.js +1 -1
- package/dist/unstable/cluster/SingletonAddress.js.map +1 -1
- package/dist/unstable/cluster/Snowflake.d.ts +8 -8
- package/dist/unstable/cluster/Snowflake.js +8 -8
- package/dist/unstable/cluster/Snowflake.js.map +1 -1
- package/dist/unstable/cluster/SocketRunner.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js +20 -5
- package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/TestRunner.js.map +1 -1
- package/dist/unstable/cluster/index.js.map +1 -1
- package/dist/unstable/cluster/internal/entityManager.js +5 -5
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/cluster/internal/entityReaper.js.map +1 -1
- package/dist/unstable/cluster/internal/hash.js.map +1 -1
- package/dist/unstable/cluster/internal/interruptors.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceMap.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
- package/dist/unstable/cluster/internal/shardLock.js.map +1 -1
- package/dist/unstable/devtools/DevTools.js.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
- package/dist/unstable/devtools/DevToolsServer.js.map +1 -1
- package/dist/unstable/devtools/index.js.map +1 -1
- package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
- package/dist/unstable/encoding/Msgpack.js +6 -8
- package/dist/unstable/encoding/Msgpack.js.map +1 -1
- package/dist/unstable/encoding/Ndjson.js.map +1 -1
- package/dist/unstable/encoding/Sse.d.ts +72 -8
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.js +58 -8
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/encoding/index.js.map +1 -1
- package/dist/unstable/eventlog/Event.d.ts +20 -20
- package/dist/unstable/eventlog/Event.js.map +1 -1
- package/dist/unstable/eventlog/EventGroup.d.ts +4 -4
- package/dist/unstable/eventlog/EventGroup.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +15 -15
- package/dist/unstable/eventlog/EventJournal.js +13 -13
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts +3 -3
- package/dist/unstable/eventlog/EventLog.js +3 -3
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.d.ts +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js +1 -1
- package/dist/unstable/eventlog/EventLogEncryption.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +2 -2
- package/dist/unstable/eventlog/EventLogMessage.js +1 -1
- package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +15 -15
- package/dist/unstable/eventlog/EventLogRemote.js +1 -1
- package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.d.ts +11 -2
- package/dist/unstable/eventlog/EventLogServer.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServer.js +45 -21
- package/dist/unstable/eventlog/EventLogServer.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts +4 -4
- package/dist/unstable/eventlog/EventLogServerEncrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerEncrypted.js +13 -5
- package/dist/unstable/eventlog/EventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts +5 -5
- package/dist/unstable/eventlog/EventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js +14 -6
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.d.ts +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.js +1 -1
- package/dist/unstable/eventlog/EventLogSessionAuth.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerEncrypted.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/index.js.map +1 -1
- package/dist/unstable/eventlog/internal/identityRootSecretDerivation.js.map +1 -1
- package/dist/unstable/http/Cookies.d.ts +2 -2
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +30 -18
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/Etag.d.ts +1 -1
- package/dist/unstable/http/Etag.js +1 -1
- package/dist/unstable/http/Etag.js.map +1 -1
- package/dist/unstable/http/FetchHttpClient.d.ts.map +1 -1
- package/dist/unstable/http/FetchHttpClient.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts +2 -2
- package/dist/unstable/http/Headers.js +2 -2
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpBody.d.ts +5 -3
- package/dist/unstable/http/HttpBody.d.ts.map +1 -1
- package/dist/unstable/http/HttpBody.js +11 -5
- package/dist/unstable/http/HttpBody.js.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts +51 -44
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +46 -17
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientError.js.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +2 -0
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts +4 -4
- package/dist/unstable/http/HttpClientResponse.js +2 -2
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts +6 -6
- package/dist/unstable/http/HttpEffect.js +3 -3
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMethod.d.ts +6 -9
- package/dist/unstable/http/HttpMethod.d.ts.map +1 -1
- package/dist/unstable/http/HttpMethod.js +6 -9
- package/dist/unstable/http/HttpMethod.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts +75 -9
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +164 -39
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpPlatform.d.ts +76 -0
- package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
- package/dist/unstable/http/HttpPlatform.js +32 -0
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +88 -89
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +78 -79
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServer.d.ts +13 -13
- package/dist/unstable/http/HttpServer.js +6 -6
- package/dist/unstable/http/HttpServer.js.map +1 -1
- package/dist/unstable/http/HttpServerError.d.ts +2 -2
- package/dist/unstable/http/HttpServerError.js +2 -2
- package/dist/unstable/http/HttpServerError.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts +4 -4
- package/dist/unstable/http/HttpServerRequest.js +4 -4
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +22 -0
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +10 -0
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpStaticServer.d.ts +35 -7
- package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpStaticServer.js +35 -7
- package/dist/unstable/http/HttpStaticServer.js.map +1 -1
- package/dist/unstable/http/HttpTraceContext.js.map +1 -1
- package/dist/unstable/http/Multipart.d.ts +6 -6
- package/dist/unstable/http/Multipart.js +5 -5
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/Template.js.map +1 -1
- package/dist/unstable/http/Url.d.ts +33 -63
- package/dist/unstable/http/Url.d.ts.map +1 -1
- package/dist/unstable/http/Url.js +14 -28
- package/dist/unstable/http/Url.js.map +1 -1
- package/dist/unstable/http/UrlParams.d.ts +10 -18
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +9 -17
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/http/index.js.map +1 -1
- package/dist/unstable/http/internal/compression.d.ts +2 -0
- package/dist/unstable/http/internal/compression.d.ts.map +1 -0
- package/dist/unstable/http/internal/compression.js +155 -0
- package/dist/unstable/http/internal/compression.js.map +1 -0
- package/dist/unstable/http/internal/preResponseHandler.js.map +1 -1
- package/dist/unstable/httpapi/HttpApi.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +10 -11
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +4 -5
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +11 -13
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +42 -42
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +13 -13
- package/dist/unstable/httpapi/HttpApiError.js +13 -13
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiGroup.d.ts +15 -15
- package/dist/unstable/httpapi/HttpApiGroup.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +71 -24
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js +57 -10
- package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts +0 -12
- package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +6 -6
- package/dist/unstable/httpapi/HttpApiSchema.js +4 -4
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSecurity.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiTest.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts +13 -13
- package/dist/unstable/httpapi/OpenApi.js +13 -13
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/httpapi/index.js.map +1 -1
- package/dist/unstable/httpapi/internal/html.js.map +1 -1
- package/dist/unstable/httpapi/internal/httpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/internal/httpApiSwagger.js.map +1 -1
- package/dist/unstable/httpapi/internal/mediaType.js.map +1 -1
- package/dist/unstable/observability/Otlp.js.map +1 -1
- package/dist/unstable/observability/OtlpExporter.d.ts +12 -14
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +17 -4
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts +4 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
- package/dist/unstable/observability/OtlpResource.d.ts +16 -7
- package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpResource.js +21 -12
- package/dist/unstable/observability/OtlpResource.js.map +1 -1
- package/dist/unstable/observability/OtlpSerialization.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.d.ts +13 -4
- package/dist/unstable/observability/PrometheusMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/PrometheusMetrics.js +10 -3
- package/dist/unstable/observability/PrometheusMetrics.js.map +1 -1
- package/dist/unstable/observability/index.js.map +1 -1
- package/dist/unstable/observability/internal/otlpEnv.js +1 -1
- package/dist/unstable/observability/internal/otlpEnv.js.map +1 -1
- package/dist/unstable/observability/internal/otlpProtobuf.js.map +1 -1
- package/dist/unstable/observability/internal/protobuf.js +3 -0
- package/dist/unstable/observability/internal/protobuf.js.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +8 -3
- package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.js +22 -13
- package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
- package/dist/unstable/persistence/Persistable.d.ts +8 -8
- package/dist/unstable/persistence/Persistable.js.map +1 -1
- package/dist/unstable/persistence/PersistedCache.js.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts +6 -6
- package/dist/unstable/persistence/PersistedQueue.js +6 -6
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/Persistence.d.ts +3 -3
- package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
- package/dist/unstable/persistence/Persistence.js +91 -15
- package/dist/unstable/persistence/Persistence.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +26 -15
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +24 -13
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/persistence/Redis.d.ts +2 -2
- package/dist/unstable/persistence/Redis.js +1 -1
- package/dist/unstable/persistence/Redis.js.map +1 -1
- package/dist/unstable/persistence/index.js.map +1 -1
- package/dist/unstable/process/ChildProcess.d.ts +64 -21
- package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcess.js +14 -5
- package/dist/unstable/process/ChildProcess.js.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.d.ts +21 -10
- package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
- package/dist/unstable/process/index.js.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.d.ts +8 -8
- package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.js +10 -10
- package/dist/unstable/reactivity/AsyncResult.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +25 -22
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +14 -13
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.js +4 -1
- package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/unstable/reactivity/AtomRef.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +24 -3
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.js +4 -1
- package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
- package/dist/unstable/reactivity/Hydration.d.ts +1 -1
- package/dist/unstable/reactivity/Hydration.js +1 -1
- package/dist/unstable/reactivity/Hydration.js.map +1 -1
- package/dist/unstable/reactivity/Reactivity.js.map +1 -1
- package/dist/unstable/reactivity/index.js.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +35 -33
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js +4 -2
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts +12 -12
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +12 -11
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcClientError.js.map +1 -1
- package/dist/unstable/rpc/RpcGroup.d.ts +8 -8
- package/dist/unstable/rpc/RpcGroup.js +1 -1
- package/dist/unstable/rpc/RpcGroup.js.map +1 -1
- package/dist/unstable/rpc/RpcMessage.d.ts +31 -30
- package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMessage.js +6 -6
- package/dist/unstable/rpc/RpcMessage.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts +10 -10
- package/dist/unstable/rpc/RpcMiddleware.js +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts +4 -4
- package/dist/unstable/rpc/RpcSchema.js +3 -3
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts +58 -7
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +175 -96
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +13 -13
- package/dist/unstable/rpc/RpcServer.js +17 -13
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/rpc/RpcTest.js.map +1 -1
- package/dist/unstable/rpc/RpcWorker.d.ts +5 -5
- package/dist/unstable/rpc/RpcWorker.js +4 -4
- package/dist/unstable/rpc/RpcWorker.js.map +1 -1
- package/dist/unstable/rpc/Utils.js.map +1 -1
- package/dist/unstable/rpc/index.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts +52 -50
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js +35 -33
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +5 -5
- package/dist/unstable/schema/VariantSchema.js +2 -2
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/schema/index.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +11 -3
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +9 -4
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/socket/SocketServer.js.map +1 -1
- package/dist/unstable/socket/index.js.map +1 -1
- package/dist/unstable/sql/Migrator.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts +1 -1
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +2 -2
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/sql/SqlConnection.js.map +1 -1
- package/dist/unstable/sql/SqlError.js.map +1 -1
- package/dist/unstable/sql/SqlModel.d.ts +2 -2
- package/dist/unstable/sql/SqlModel.js +2 -2
- package/dist/unstable/sql/SqlModel.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.d.ts +5 -5
- package/dist/unstable/sql/SqlResolver.js +2 -2
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/sql/SqlSchema.js.map +1 -1
- package/dist/unstable/sql/SqlStream.js.map +1 -1
- package/dist/unstable/sql/Statement.d.ts +6 -6
- package/dist/unstable/sql/Statement.js +15 -15
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/sql/index.js.map +1 -1
- package/dist/unstable/workers/Transferable.d.ts +1 -1
- package/dist/unstable/workers/Transferable.js +1 -1
- package/dist/unstable/workers/Transferable.js.map +1 -1
- package/dist/unstable/workers/Worker.d.ts +2 -2
- package/dist/unstable/workers/Worker.js +2 -2
- package/dist/unstable/workers/Worker.js.map +1 -1
- package/dist/unstable/workers/WorkerError.d.ts +7 -7
- package/dist/unstable/workers/WorkerError.js +6 -6
- package/dist/unstable/workers/WorkerError.js.map +1 -1
- package/dist/unstable/workers/WorkerRunner.d.ts +1 -1
- package/dist/unstable/workers/WorkerRunner.js +1 -1
- package/dist/unstable/workers/WorkerRunner.js.map +1 -1
- package/dist/unstable/workers/index.js.map +1 -1
- package/dist/unstable/workflow/Activity.d.ts +2 -2
- package/dist/unstable/workflow/Activity.js +2 -2
- package/dist/unstable/workflow/Activity.js.map +1 -1
- package/dist/unstable/workflow/DurableClock.d.ts +1 -1
- package/dist/unstable/workflow/DurableClock.js +1 -1
- package/dist/unstable/workflow/DurableClock.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts +10 -10
- package/dist/unstable/workflow/DurableDeferred.js +5 -5
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/DurableQueue.d.ts +22 -20
- package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableQueue.js +22 -20
- package/dist/unstable/workflow/DurableQueue.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +21 -21
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js +13 -14
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.d.ts +4 -2
- package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.js +4 -2
- package/dist/unstable/workflow/WorkflowProxy.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxyServer.js.map +1 -1
- package/dist/unstable/workflow/index.js.map +1 -1
- package/dist/unstable/workflow/internal/crypto.js.map +1 -1
- package/package.json +5 -6
- package/src/Array.ts +982 -1045
- package/src/BigDecimal.ts +433 -756
- package/src/BigInt.ts +213 -269
- package/src/Boolean.ts +146 -188
- package/src/Cache.ts +409 -255
- package/src/Cause.ts +167 -277
- package/src/Channel.ts +891 -816
- package/src/ChannelSchema.ts +1 -1
- package/src/Chunk.ts +841 -1181
- package/src/Clock.ts +181 -49
- package/src/Combiner.ts +20 -33
- package/src/Config.ts +615 -332
- package/src/ConfigProvider.ts +214 -120
- package/src/Console.ts +289 -39
- package/src/Context.ts +319 -378
- package/src/Cron.ts +68 -77
- package/src/Crypto.ts +13 -15
- package/src/Data.ts +60 -80
- package/src/DateTime.ts +564 -660
- package/src/Deferred.ts +253 -256
- package/src/Duration.ts +216 -308
- package/src/Effect.ts +2893 -3279
- package/src/Encoding.ts +22 -40
- package/src/Equal.ts +49 -39
- package/src/Equivalence.ts +103 -105
- package/src/ErrorReporter.ts +51 -27
- package/src/ExecutionPlan.ts +13 -55
- package/src/Exit.ts +116 -192
- package/src/Fiber.ts +81 -148
- package/src/FiberHandle.ts +152 -105
- package/src/FiberMap.ts +225 -174
- package/src/FiberSet.ts +124 -82
- package/src/FileSystem.ts +155 -263
- package/src/Filter.ts +61 -33
- package/src/Formatter.ts +54 -56
- package/src/Function.ts +76 -145
- package/src/Graph.ts +416 -770
- package/src/HKT.ts +12 -6
- package/src/Hash.ts +52 -83
- package/src/HashMap.ts +319 -411
- package/src/HashRing.ts +1 -0
- package/src/HashSet.ts +177 -284
- package/src/Inspectable.ts +12 -12
- package/src/Iterable.ts +620 -786
- package/src/JsonPatch.ts +58 -112
- package/src/JsonPointer.ts +8 -8
- package/src/JsonSchema.ts +402 -244
- package/src/Latch.ts +23 -35
- package/src/Layer.ts +359 -260
- package/src/LayerMap.ts +49 -29
- package/src/LayerRef.ts +6 -2
- package/src/LogLevel.ts +114 -214
- package/src/Logger.ts +344 -697
- package/src/ManagedRuntime.ts +7 -5
- package/src/Match.ts +217 -252
- package/src/Metric.ts +516 -1089
- package/src/MutableHashMap.ts +218 -255
- package/src/MutableHashSet.ts +84 -89
- package/src/MutableList.ts +73 -370
- package/src/MutableRef.ts +420 -243
- package/src/Newtype.ts +21 -14
- package/src/NonEmptyIterable.ts +7 -137
- package/src/Number.ts +196 -233
- package/src/Optic.ts +243 -383
- package/src/Option.ts +447 -812
- package/src/Order.ts +109 -109
- package/src/Ordering.ts +20 -23
- package/src/Path.ts +38 -41
- package/src/Pipeable.ts +6 -5
- package/src/PlatformError.ts +4 -4
- package/src/Pool.ts +4 -2
- package/src/Predicate.ts +200 -181
- package/src/PrimaryKey.ts +7 -7
- package/src/PubSub.ts +526 -552
- package/src/Pull.ts +24 -18
- package/src/Queue.ts +200 -159
- package/src/Random.ts +49 -74
- package/src/RcMap.ts +121 -63
- package/src/RcRef.ts +24 -13
- package/src/Record.ts +291 -488
- package/src/Redactable.ts +10 -3
- package/src/Redacted.ts +25 -25
- package/src/Reducer.ts +8 -15
- package/src/Ref.ts +221 -361
- package/src/References.ts +102 -168
- package/src/RegExp.ts +10 -14
- package/src/Request.ts +31 -21
- package/src/RequestResolver.ts +202 -91
- package/src/Result.ts +312 -484
- package/src/Runtime.ts +50 -75
- package/src/Schedule.ts +308 -1734
- package/src/Scheduler.ts +20 -7
- package/src/Schema.ts +716 -745
- package/src/SchemaAST.ts +466 -358
- package/src/SchemaError.ts +7 -6
- package/src/SchemaGetter.ts +242 -190
- package/src/SchemaIssue.ts +89 -275
- package/src/SchemaParser.ts +180 -93
- package/src/SchemaRepresentation.ts +22 -40
- package/src/SchemaTransformation.ts +129 -88
- package/src/Scope.ts +123 -151
- package/src/ScopedRef.ts +4 -4
- package/src/Semaphore.ts +152 -51
- package/src/Sink.ts +128 -113
- package/src/Stdio.ts +1 -1
- package/src/Stream.ts +2602 -3123
- package/src/String.ts +275 -312
- package/src/Struct.ts +109 -114
- package/src/SubscriptionRef.ts +284 -252
- package/src/Symbol.ts +3 -3
- package/src/Terminal.ts +2 -2
- package/src/Tracer.ts +102 -55
- package/src/Trie.ts +287 -679
- package/src/Tuple.ts +92 -127
- package/src/TxChunk.ts +201 -121
- package/src/TxDeferred.ts +62 -46
- package/src/TxHashMap.ts +645 -799
- package/src/TxHashSet.ts +443 -356
- package/src/TxPriorityQueue.ts +130 -98
- package/src/TxPubSub.ts +107 -80
- package/src/TxQueue.ts +214 -183
- package/src/TxReentrantLock.ts +97 -66
- package/src/TxRef.ts +51 -32
- package/src/TxSemaphore.ts +129 -95
- package/src/TxSubscriptionRef.ts +97 -70
- package/src/Types.ts +126 -67
- package/src/Unify.ts +45 -65
- package/src/Utils.ts +23 -16
- package/src/internal/core.ts +2 -2
- package/src/internal/dateTime.ts +6 -0
- package/src/internal/effect.ts +93 -48
- package/src/internal/persistence.ts +2 -0
- package/src/internal/references.ts +3 -2
- package/src/internal/schema/fromJsonSchemaDocument.ts +15 -13
- package/src/internal/schema/fromRepresentation.ts +10 -16
- package/src/internal/schema/parser.ts +22 -0
- package/src/internal/schema/toJsonSchemaDocument.ts +60 -6
- package/src/internal/schema/toRepresentation.ts +104 -119
- package/src/internal/trie.ts +10 -11
- package/src/testing/FastCheck.ts +8 -7
- package/src/testing/TestClock.ts +72 -30
- package/src/testing/TestConsole.ts +32 -31
- package/src/testing/TestSchema.ts +29 -29
- package/src/unstable/ai/AiError.ts +95 -118
- package/src/unstable/ai/AnthropicStructuredOutput.ts +1 -1
- package/src/unstable/ai/Chat.ts +132 -97
- package/src/unstable/ai/IdGenerator.ts +32 -28
- package/src/unstable/ai/LanguageModel.ts +107 -67
- package/src/unstable/ai/McpProtocol.ts +48 -0
- package/src/unstable/ai/McpSchema.ts +60 -50
- package/src/unstable/ai/McpServer.ts +930 -304
- package/src/unstable/ai/Model.ts +9 -20
- package/src/unstable/ai/OpenAiStructuredOutput.ts +1 -1
- package/src/unstable/ai/Prompt.ts +145 -43
- package/src/unstable/ai/Response.ts +28 -14
- package/src/unstable/ai/Telemetry.ts +46 -13
- package/src/unstable/ai/Tokenizer.ts +14 -3
- package/src/unstable/ai/Tool.ts +59 -44
- package/src/unstable/ai/Toolkit.ts +26 -8
- package/src/unstable/ai/index.ts +5 -0
- package/src/unstable/ai/internal/mcpProtocol.ts +85 -0
- package/src/unstable/ai/internal/mcpProtocolRegistry.ts +70 -0
- package/src/unstable/ai/internal/structured-output.ts +13 -18
- package/src/unstable/cli/Argument.ts +273 -69
- package/src/unstable/cli/CliError.ts +69 -76
- package/src/unstable/cli/CliOutput.ts +44 -58
- package/src/unstable/cli/Command.ts +705 -107
- package/src/unstable/cli/Flag.ts +418 -138
- package/src/unstable/cli/GlobalFlag.ts +1 -1
- package/src/unstable/cli/HelpDoc.ts +12 -4
- package/src/unstable/cli/Param.ts +292 -78
- package/src/unstable/cli/Primitive.ts +370 -149
- package/src/unstable/cli/Prompt.ts +28 -14
- package/src/unstable/cli/internal/lexer.ts +8 -2
- package/src/unstable/cli/internal/parser.ts +2 -2
- package/src/unstable/cluster/ClusterSchema.ts +8 -8
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +5 -1
- package/src/unstable/cluster/Entity.ts +15 -16
- package/src/unstable/cluster/EntityProxy.ts +4 -2
- package/src/unstable/cluster/EntityResource.ts +2 -2
- package/src/unstable/cluster/Envelope.ts +3 -3
- package/src/unstable/cluster/HttpRunner.ts +6 -4
- package/src/unstable/cluster/Message.ts +9 -9
- package/src/unstable/cluster/MessageStorage.ts +15 -15
- package/src/unstable/cluster/Reply.ts +4 -6
- package/src/unstable/cluster/RunnerHealth.ts +1 -1
- package/src/unstable/cluster/RunnerServer.ts +41 -8
- package/src/unstable/cluster/RunnerStorage.ts +2 -2
- package/src/unstable/cluster/Runners.ts +23 -12
- package/src/unstable/cluster/Sharding.ts +7 -8
- package/src/unstable/cluster/ShardingConfig.ts +3 -3
- package/src/unstable/cluster/SingletonAddress.ts +1 -1
- package/src/unstable/cluster/Snowflake.ts +8 -8
- package/src/unstable/cluster/SqlMessageStorage.ts +1 -1
- package/src/unstable/cluster/SqlRunnerStorage.ts +21 -5
- package/src/unstable/cluster/internal/entityManager.ts +11 -15
- package/src/unstable/encoding/Msgpack.ts +6 -8
- package/src/unstable/encoding/Sse.ts +98 -16
- package/src/unstable/eventlog/Event.ts +20 -20
- package/src/unstable/eventlog/EventGroup.ts +4 -4
- package/src/unstable/eventlog/EventJournal.ts +15 -15
- package/src/unstable/eventlog/EventLog.ts +3 -3
- package/src/unstable/eventlog/EventLogEncryption.ts +1 -1
- package/src/unstable/eventlog/EventLogMessage.ts +2 -2
- package/src/unstable/eventlog/EventLogRemote.ts +1 -1
- package/src/unstable/eventlog/EventLogServer.ts +41 -7
- package/src/unstable/eventlog/EventLogServerEncrypted.ts +13 -5
- package/src/unstable/eventlog/EventLogServerUnencrypted.ts +14 -6
- package/src/unstable/eventlog/EventLogSessionAuth.ts +1 -1
- package/src/unstable/http/Cookies.ts +35 -21
- package/src/unstable/http/Etag.ts +1 -1
- package/src/unstable/http/FetchHttpClient.ts +3 -1
- package/src/unstable/http/Headers.ts +2 -2
- package/src/unstable/http/HttpBody.ts +20 -5
- package/src/unstable/http/HttpClient.ts +83 -55
- package/src/unstable/http/HttpClientRequest.ts +2 -0
- package/src/unstable/http/HttpClientResponse.ts +4 -4
- package/src/unstable/http/HttpEffect.ts +8 -8
- package/src/unstable/http/HttpMethod.ts +6 -9
- package/src/unstable/http/HttpMiddleware.ts +202 -39
- package/src/unstable/http/HttpPlatform.ts +95 -0
- package/src/unstable/http/HttpRouter.ts +102 -98
- package/src/unstable/http/HttpServer.ts +13 -13
- package/src/unstable/http/HttpServerError.ts +2 -2
- package/src/unstable/http/HttpServerRequest.ts +4 -4
- package/src/unstable/http/HttpServerResponse.ts +30 -0
- package/src/unstable/http/HttpStaticServer.ts +35 -7
- package/src/unstable/http/Multipart.ts +6 -6
- package/src/unstable/http/Url.ts +33 -63
- package/src/unstable/http/UrlParams.ts +10 -18
- package/src/unstable/http/internal/compression.ts +196 -0
- package/src/unstable/httpapi/HttpApiBuilder.ts +10 -9
- package/src/unstable/httpapi/HttpApiClient.ts +14 -14
- package/src/unstable/httpapi/HttpApiEndpoint.ts +42 -42
- package/src/unstable/httpapi/HttpApiError.ts +13 -13
- package/src/unstable/httpapi/HttpApiGroup.ts +15 -15
- package/src/unstable/httpapi/HttpApiMiddleware.ts +71 -24
- package/src/unstable/httpapi/HttpApiScalar.ts +0 -12
- package/src/unstable/httpapi/HttpApiSchema.ts +6 -6
- package/src/unstable/httpapi/OpenApi.ts +13 -13
- package/src/unstable/observability/OtlpExporter.ts +31 -19
- package/src/unstable/observability/OtlpMetrics.ts +4 -1
- package/src/unstable/observability/OtlpResource.ts +26 -17
- package/src/unstable/observability/PrometheusMetrics.ts +13 -4
- package/src/unstable/observability/internal/otlpEnv.ts +1 -1
- package/src/unstable/observability/internal/protobuf.ts +3 -0
- package/src/unstable/persistence/KeyValueStore.ts +72 -49
- package/src/unstable/persistence/Persistable.ts +8 -8
- package/src/unstable/persistence/PersistedQueue.ts +6 -6
- package/src/unstable/persistence/Persistence.ts +126 -19
- package/src/unstable/persistence/RateLimiter.ts +26 -15
- package/src/unstable/persistence/Redis.ts +2 -2
- package/src/unstable/process/ChildProcess.ts +64 -21
- package/src/unstable/process/ChildProcessSpawner.ts +21 -10
- package/src/unstable/reactivity/AsyncResult.ts +12 -13
- package/src/unstable/reactivity/Atom.ts +28 -25
- package/src/unstable/reactivity/AtomHttpApi.ts +5 -4
- package/src/unstable/reactivity/AtomRegistry.ts +24 -3
- package/src/unstable/reactivity/AtomRpc.ts +5 -4
- package/src/unstable/reactivity/Hydration.ts +1 -1
- package/src/unstable/rpc/Rpc.ts +35 -33
- package/src/unstable/rpc/RpcClient.ts +16 -15
- package/src/unstable/rpc/RpcGroup.ts +8 -8
- package/src/unstable/rpc/RpcMessage.ts +31 -30
- package/src/unstable/rpc/RpcMiddleware.ts +10 -10
- package/src/unstable/rpc/RpcSchema.ts +4 -4
- package/src/unstable/rpc/RpcSerialization.ts +167 -68
- package/src/unstable/rpc/RpcServer.ts +18 -15
- package/src/unstable/rpc/RpcWorker.ts +5 -5
- package/src/unstable/schema/Model.ts +52 -50
- package/src/unstable/schema/VariantSchema.ts +5 -5
- package/src/unstable/socket/Socket.ts +17 -4
- package/src/unstable/sql/SqlClient.ts +5 -6
- package/src/unstable/sql/SqlModel.ts +2 -2
- package/src/unstable/sql/SqlResolver.ts +5 -5
- package/src/unstable/sql/Statement.ts +24 -23
- package/src/unstable/workers/Transferable.ts +1 -1
- package/src/unstable/workers/Worker.ts +2 -2
- package/src/unstable/workers/WorkerError.ts +7 -7
- package/src/unstable/workers/WorkerRunner.ts +1 -1
- package/src/unstable/workflow/Activity.ts +2 -2
- package/src/unstable/workflow/DurableClock.ts +1 -1
- package/src/unstable/workflow/DurableDeferred.ts +10 -10
- package/src/unstable/workflow/DurableQueue.ts +22 -20
- package/src/unstable/workflow/Workflow.ts +23 -23
- package/src/unstable/workflow/WorkflowEngine.ts +1 -1
- package/src/unstable/workflow/WorkflowProxy.ts +4 -2
- package/dist/internal/version.d.ts +0 -3
- package/dist/internal/version.d.ts.map +0 -1
- package/dist/internal/version.js +0 -2
- package/dist/internal/version.js.map +0 -1
- package/src/internal/version.ts +0 -2
package/src/Schema.ts
CHANGED
|
@@ -19,7 +19,6 @@ import * as BigDecimal_ from "./BigDecimal.ts"
|
|
|
19
19
|
import type * as Brand from "./Brand.ts"
|
|
20
20
|
import * as Cause_ from "./Cause.ts"
|
|
21
21
|
import * as Chunk_ from "./Chunk.ts"
|
|
22
|
-
import type * as Combiner from "./Combiner.ts"
|
|
23
22
|
import * as Data from "./Data.ts"
|
|
24
23
|
import * as DateTime from "./DateTime.ts"
|
|
25
24
|
import type { Differ } from "./Differ.ts"
|
|
@@ -449,8 +448,8 @@ export interface declareConstructor<T, E, TypeParameters extends ReadonlyArray<C
|
|
|
449
448
|
*
|
|
450
449
|
* **Example** (Schema for a parametric `Box<A>` type)
|
|
451
450
|
*
|
|
452
|
-
* ```ts
|
|
453
|
-
* import { Effect,
|
|
451
|
+
* ```ts import.meta.vitest
|
|
452
|
+
* import { Effect, Schema, SchemaIssue as Issue, SchemaParser } from "effect"
|
|
454
453
|
*
|
|
455
454
|
* interface Box<A> {
|
|
456
455
|
* readonly value: A
|
|
@@ -465,7 +464,7 @@ export interface declareConstructor<T, E, TypeParameters extends ReadonlyArray<C
|
|
|
465
464
|
* ([itemCodec]) =>
|
|
466
465
|
* (u, ast, options) => {
|
|
467
466
|
* if (!isBox(u)) {
|
|
468
|
-
* return Effect.fail(new SchemaIssue.InvalidType(ast
|
|
467
|
+
* return Effect.fail(new SchemaIssue.InvalidType(ast))
|
|
469
468
|
* }
|
|
470
469
|
* return Effect.map(
|
|
471
470
|
* SchemaParser.decodeUnknownEffect(itemCodec)(u.value, options),
|
|
@@ -475,6 +474,7 @@ export interface declareConstructor<T, E, TypeParameters extends ReadonlyArray<C
|
|
|
475
474
|
* )
|
|
476
475
|
*
|
|
477
476
|
* const schema = Box(Schema.Number)
|
|
477
|
+
* Effect.runSync(Schema.decodeUnknownEffect(schema)({ value: 1 })) // => { value: 1 }
|
|
478
478
|
* ```
|
|
479
479
|
*
|
|
480
480
|
* @category constructors
|
|
@@ -526,7 +526,7 @@ export interface declare<T, Iso = T> extends declareConstructor<T, T, readonly [
|
|
|
526
526
|
*
|
|
527
527
|
* **Example** (Defining a schema for a custom `UserId` branded type)
|
|
528
528
|
*
|
|
529
|
-
* ```ts
|
|
529
|
+
* ```ts import.meta.vitest
|
|
530
530
|
* import { Schema } from "effect"
|
|
531
531
|
*
|
|
532
532
|
* type UserId = string & { readonly _tag: "UserId" }
|
|
@@ -538,6 +538,7 @@ export interface declare<T, Iso = T> extends declareConstructor<T, T, readonly [
|
|
|
538
538
|
* title: "UserId",
|
|
539
539
|
* description: "A user identifier starting with 'user_'"
|
|
540
540
|
* })
|
|
541
|
+
* Schema.decodeUnknownSync(UserId)("user_123") // => "user_123"
|
|
541
542
|
* ```
|
|
542
543
|
*
|
|
543
544
|
* @see {@link declareConstructor} for creating schemas for parametric types.
|
|
@@ -554,7 +555,7 @@ export function declare<T, Iso = T>(
|
|
|
554
555
|
() => (input, ast) =>
|
|
555
556
|
is(input) ?
|
|
556
557
|
Effect.succeed(input) :
|
|
557
|
-
Effect.fail(new SchemaIssue.InvalidType(ast
|
|
558
|
+
Effect.fail(new SchemaIssue.InvalidType(ast)),
|
|
558
559
|
annotations
|
|
559
560
|
)
|
|
560
561
|
}
|
|
@@ -571,7 +572,7 @@ export function declare<T, Iso = T>(
|
|
|
571
572
|
*
|
|
572
573
|
* **Example** (Inspecting all type parameters of a schema)
|
|
573
574
|
*
|
|
574
|
-
* ```ts
|
|
575
|
+
* ```ts import.meta.vitest
|
|
575
576
|
* import { Schema } from "effect"
|
|
576
577
|
*
|
|
577
578
|
* const schema = Schema.String
|
|
@@ -622,7 +623,7 @@ export function revealBottom<S extends Top>(
|
|
|
622
623
|
*
|
|
623
624
|
* **Example** (Adding a title and description)
|
|
624
625
|
*
|
|
625
|
-
* ```ts
|
|
626
|
+
* ```ts import.meta.vitest
|
|
626
627
|
* import { Schema } from "effect"
|
|
627
628
|
*
|
|
628
629
|
* const Age = Schema.Natural.pipe(
|
|
@@ -631,6 +632,7 @@ export function revealBottom<S extends Top>(
|
|
|
631
632
|
* description: "A non-negative integer representing age in years"
|
|
632
633
|
* })
|
|
633
634
|
* )
|
|
635
|
+
* Schema.resolveAnnotations(Age)?.title // => "Age"
|
|
634
636
|
* ```
|
|
635
637
|
*
|
|
636
638
|
* @see {@link annotateEncoded} to annotate the encoded side instead.
|
|
@@ -654,7 +656,7 @@ export function annotate<S extends Top>(annotations: Annotations.Bottom<S["Type"
|
|
|
654
656
|
*
|
|
655
657
|
* **Example** (Adding a title to the encoded representation)
|
|
656
658
|
*
|
|
657
|
-
* ```ts
|
|
659
|
+
* ```ts import.meta.vitest
|
|
658
660
|
* import { Schema } from "effect"
|
|
659
661
|
*
|
|
660
662
|
* const schema = Schema.NumberFromString.pipe(
|
|
@@ -663,8 +665,7 @@ export function annotate<S extends Top>(annotations: Annotations.Bottom<S["Type"
|
|
|
663
665
|
* })
|
|
664
666
|
* )
|
|
665
667
|
*
|
|
666
|
-
*
|
|
667
|
-
* // "my title"
|
|
668
|
+
* Schema.toEncoded(schema).ast.annotations?.title // => "my title"
|
|
668
669
|
* ```
|
|
669
670
|
*
|
|
670
671
|
* @see {@link annotate} to annotate the type side instead.
|
|
@@ -690,7 +691,7 @@ export function annotateEncoded<S extends Top>(annotations: Annotations.Bottom<S
|
|
|
690
691
|
*
|
|
691
692
|
* **Example** (Customizing the missing-key message for a required field)
|
|
692
693
|
*
|
|
693
|
-
* ```ts
|
|
694
|
+
* ```ts import.meta.vitest
|
|
694
695
|
* import { Schema } from "effect"
|
|
695
696
|
*
|
|
696
697
|
* const schema = Schema.Struct({
|
|
@@ -701,6 +702,7 @@ export function annotateEncoded<S extends Top>(annotations: Annotations.Bottom<S
|
|
|
701
702
|
* })
|
|
702
703
|
* )
|
|
703
704
|
* })
|
|
705
|
+
* schema.fields.username.ast.context?.annotations?.messageMissingKey // => "Username is required"
|
|
704
706
|
* ```
|
|
705
707
|
*
|
|
706
708
|
* @category annotations
|
|
@@ -882,7 +884,7 @@ export declare namespace Schema {
|
|
|
882
884
|
*
|
|
883
885
|
* **Example** (Extracting the decoded type)
|
|
884
886
|
*
|
|
885
|
-
* ```ts
|
|
887
|
+
* ```ts import.meta.vitest
|
|
886
888
|
* import { Schema } from "effect"
|
|
887
889
|
*
|
|
888
890
|
* const Person = Schema.Struct({ name: Schema.String, age: Schema.Number })
|
|
@@ -911,13 +913,13 @@ export declare namespace Schema {
|
|
|
911
913
|
*
|
|
912
914
|
* **Example** (Accepting any schema decoding to `string`)
|
|
913
915
|
*
|
|
914
|
-
* ```ts
|
|
916
|
+
* ```ts import.meta.vitest
|
|
915
917
|
* import { Schema } from "effect"
|
|
916
918
|
*
|
|
917
|
-
*
|
|
919
|
+
* const accept = (_schema: Schema.Schema<string>): void => {}
|
|
918
920
|
*
|
|
919
|
-
*
|
|
920
|
-
*
|
|
921
|
+
* accept(Schema.String)
|
|
922
|
+
* accept(Schema.NonEmptyString)
|
|
921
923
|
* ```
|
|
922
924
|
*
|
|
923
925
|
* @see {@link Codec} — also tracks Encoded, DecodingServices, EncodingServices
|
|
@@ -942,7 +944,7 @@ export declare namespace Codec {
|
|
|
942
944
|
*
|
|
943
945
|
* **Example** (Extracting the encoded type)
|
|
944
946
|
*
|
|
945
|
-
* ```ts
|
|
947
|
+
* ```ts import.meta.vitest
|
|
946
948
|
* import { Schema } from "effect"
|
|
947
949
|
*
|
|
948
950
|
* const schema = Schema.NumberFromString
|
|
@@ -960,7 +962,7 @@ export declare namespace Codec {
|
|
|
960
962
|
*
|
|
961
963
|
* **Example** (Checking decoding service requirements)
|
|
962
964
|
*
|
|
963
|
-
* ```ts
|
|
965
|
+
* ```ts import.meta.vitest
|
|
964
966
|
* import { Schema } from "effect"
|
|
965
967
|
*
|
|
966
968
|
* const schema = Schema.String
|
|
@@ -978,7 +980,7 @@ export declare namespace Codec {
|
|
|
978
980
|
*
|
|
979
981
|
* **Example** (Checking encoding service requirements)
|
|
980
982
|
*
|
|
981
|
-
* ```ts
|
|
983
|
+
* ```ts import.meta.vitest
|
|
982
984
|
* import { Schema } from "effect"
|
|
983
985
|
*
|
|
984
986
|
* const schema = Schema.String
|
|
@@ -1009,12 +1011,13 @@ export declare namespace Codec {
|
|
|
1009
1011
|
*
|
|
1010
1012
|
* **Example** (Accepting a codec that decodes to `number` from `string`)
|
|
1011
1013
|
*
|
|
1012
|
-
* ```ts
|
|
1014
|
+
* ```ts import.meta.vitest
|
|
1013
1015
|
* import { Schema } from "effect"
|
|
1014
1016
|
*
|
|
1015
|
-
*
|
|
1017
|
+
* const serialize = <T>(codec: Schema.Codec<T, string>, value: T): string =>
|
|
1018
|
+
* Schema.encodeSync(codec)(value)
|
|
1016
1019
|
*
|
|
1017
|
-
* serialize(Schema.NumberFromString) //
|
|
1020
|
+
* serialize(Schema.NumberFromString, 42) // => "42"
|
|
1018
1021
|
* ```
|
|
1019
1022
|
*
|
|
1020
1023
|
* @see {@link Codec.Encoded} — extract the encoded type
|
|
@@ -1090,7 +1093,7 @@ export interface Encoder<out E, out RE = never> extends Schema<unknown> {
|
|
|
1090
1093
|
*
|
|
1091
1094
|
* **Example** (Recovering encoded type from a schema variable)
|
|
1092
1095
|
*
|
|
1093
|
-
* ```ts
|
|
1096
|
+
* ```ts import.meta.vitest
|
|
1094
1097
|
* import { Schema } from "effect"
|
|
1095
1098
|
*
|
|
1096
1099
|
* const schema: Schema.Schema<number> = Schema.NumberFromString
|
|
@@ -1136,18 +1139,14 @@ export {
|
|
|
1136
1139
|
/**
|
|
1137
1140
|
* Returns `true` if `u` is a {@link SchemaError}.
|
|
1138
1141
|
*
|
|
1139
|
-
* **Example** (Narrowing Schema errors
|
|
1142
|
+
* **Example** (Narrowing Schema errors)
|
|
1140
1143
|
*
|
|
1141
|
-
* ```ts
|
|
1142
|
-
* import { Schema } from "effect"
|
|
1144
|
+
* ```ts import.meta.vitest
|
|
1145
|
+
* import { Result, Schema } from "effect"
|
|
1143
1146
|
*
|
|
1144
|
-
* try
|
|
1145
|
-
*
|
|
1146
|
-
*
|
|
1147
|
-
* if (Schema.isSchemaError(err)) {
|
|
1148
|
-
* console.log(err._tag) // "SchemaError"
|
|
1149
|
-
* }
|
|
1150
|
-
* }
|
|
1147
|
+
* const result = Result.try(() => Schema.decodeUnknownSync(Schema.Number)("oops"))
|
|
1148
|
+
* const error: unknown = Result.isFailure(result) ? result.failure : undefined
|
|
1149
|
+
* Schema.isSchemaError(error) // => true
|
|
1151
1150
|
* ```
|
|
1152
1151
|
*
|
|
1153
1152
|
* @category guards
|
|
@@ -1161,25 +1160,22 @@ export {
|
|
|
1161
1160
|
* **Details**
|
|
1162
1161
|
*
|
|
1163
1162
|
* The `issue` field contains a structured {@link SchemaIssue.Issue} tree describing
|
|
1164
|
-
* every validation failure, including the path to the problematic value
|
|
1165
|
-
* expected
|
|
1166
|
-
*
|
|
1163
|
+
* every validation failure, including the path to the problematic value and
|
|
1164
|
+
* the expected type or constraint. Built-in issues have no `actual` field,
|
|
1165
|
+
* and built-in messages do not include the rejected value. Other Issue fields
|
|
1166
|
+
* and custom annotations or messages are not sanitized. `message` renders the
|
|
1167
|
+
* issue tree as a human-readable string.
|
|
1167
1168
|
*
|
|
1168
1169
|
* Use {@link isSchemaError} to narrow an unknown value to `SchemaError`.
|
|
1169
1170
|
*
|
|
1170
|
-
* **Example** (
|
|
1171
|
+
* **Example** (Inspecting a SchemaError)
|
|
1171
1172
|
*
|
|
1172
|
-
* ```ts
|
|
1173
|
-
* import { Schema } from "effect"
|
|
1173
|
+
* ```ts import.meta.vitest
|
|
1174
|
+
* import { Result, Schema } from "effect"
|
|
1174
1175
|
*
|
|
1175
|
-
*
|
|
1176
|
-
*
|
|
1177
|
-
*
|
|
1178
|
-
* if (Schema.isSchemaError(err)) {
|
|
1179
|
-
* console.log(err.message)
|
|
1180
|
-
* // Expected number, actual "not a number"
|
|
1181
|
-
* }
|
|
1182
|
-
* }
|
|
1176
|
+
* const result = Schema.decodeUnknownResult(Schema.Number)("not a number")
|
|
1177
|
+
* const message = Result.isFailure(result) ? result.failure.message : ""
|
|
1178
|
+
* message // => "Expected number"
|
|
1183
1179
|
* ```
|
|
1184
1180
|
*
|
|
1185
1181
|
* @category errors
|
|
@@ -1207,7 +1203,7 @@ function makeStandardResult<A>(exit: Exit_.Exit<StandardSchemaV1.Result<A>>): St
|
|
|
1207
1203
|
*
|
|
1208
1204
|
* **Example** (Creating a standard schema from a regular schema)
|
|
1209
1205
|
*
|
|
1210
|
-
* ```ts
|
|
1206
|
+
* ```ts import.meta.vitest
|
|
1211
1207
|
* import { Schema } from "effect"
|
|
1212
1208
|
*
|
|
1213
1209
|
* // Define custom hook functions for error formatting
|
|
@@ -1245,16 +1241,21 @@ function makeStandardResult<A>(exit: Exit_.Exit<StandardSchemaV1.Result<A>>): St
|
|
|
1245
1241
|
* name: "Alice",
|
|
1246
1242
|
* age: 30
|
|
1247
1243
|
* })
|
|
1248
|
-
* console.log(validResult) // { value: { name: "Alice", age: 30 } }
|
|
1249
|
-
*
|
|
1250
1244
|
* const invalidResult = standardSchema["~standard"].validate({
|
|
1251
1245
|
* name: "",
|
|
1252
1246
|
* age: 200
|
|
1253
1247
|
* })
|
|
1254
|
-
*
|
|
1248
|
+
*
|
|
1249
|
+
* if (validResult instanceof Promise || invalidResult instanceof Promise) {
|
|
1250
|
+
* throw new Error("Expected synchronous validation")
|
|
1251
|
+
* }
|
|
1252
|
+
* if ("value" in validResult) {
|
|
1253
|
+
* validResult.value // => { name: "Alice", age: 30 }
|
|
1254
|
+
* }
|
|
1255
|
+
* invalidResult.issues?.map((issue) => issue.path) // => [["name"], ["age"]]
|
|
1255
1256
|
* ```
|
|
1256
1257
|
*
|
|
1257
|
-
* @category
|
|
1258
|
+
* @category converting
|
|
1258
1259
|
* @since 4.0.0
|
|
1259
1260
|
*/
|
|
1260
1261
|
export function toStandardSchemaV1<S extends ConstraintDecoder<unknown>>(
|
|
@@ -1272,7 +1273,7 @@ export function toStandardSchemaV1<S extends ConstraintDecoder<unknown>>(
|
|
|
1272
1273
|
const parseOptions: SchemaAST.ParseOptions = { errors: "all", ...options?.parseOptions }
|
|
1273
1274
|
const formatter = SchemaIssue.makeFormatterStandardSchemaV1(options)
|
|
1274
1275
|
const validate: StandardSchemaV1<S["Encoded"], S["Type"]>["~standard"]["validate"] = (value: unknown) => {
|
|
1275
|
-
const scheduler = new Scheduler.MixedScheduler()
|
|
1276
|
+
const scheduler = new Scheduler.MixedScheduler("sync")
|
|
1276
1277
|
const fiber = Effect.runFork(
|
|
1277
1278
|
Effect.match(decodeUnknownEffect(value, parseOptions), {
|
|
1278
1279
|
onFailure: formatter,
|
|
@@ -1333,7 +1334,7 @@ function toBaseStandardJSONSchemaV1(self: Constraint, target: StandardJSONSchema
|
|
|
1333
1334
|
*
|
|
1334
1335
|
* https://github.com/standard-schema/standard-schema/pull/134
|
|
1335
1336
|
*
|
|
1336
|
-
* @category
|
|
1337
|
+
* @category converting
|
|
1337
1338
|
* @since 4.0.0
|
|
1338
1339
|
*/
|
|
1339
1340
|
export function toStandardJSONSchemaV1<S extends Constraint>(
|
|
@@ -1381,19 +1382,19 @@ export function toStandardJSONSchemaV1<S extends Constraint>(
|
|
|
1381
1382
|
*
|
|
1382
1383
|
* **Example** (Defining a basic type guard)
|
|
1383
1384
|
*
|
|
1384
|
-
* ```ts
|
|
1385
|
+
* ```ts import.meta.vitest
|
|
1385
1386
|
* import { Schema } from "effect"
|
|
1386
1387
|
*
|
|
1387
1388
|
* const isString = Schema.is(Schema.String)
|
|
1388
1389
|
*
|
|
1389
|
-
*
|
|
1390
|
-
*
|
|
1390
|
+
* isString("hello") // => true
|
|
1391
|
+
* isString(42) // => false
|
|
1391
1392
|
*
|
|
1392
1393
|
* // Type narrowing in action
|
|
1393
1394
|
* const value: unknown = "hello"
|
|
1394
1395
|
* if (isString(value)) {
|
|
1395
1396
|
* // value is now typed as string
|
|
1396
|
-
*
|
|
1397
|
+
* value.toUpperCase() // => "HELLO"
|
|
1397
1398
|
* }
|
|
1398
1399
|
* ```
|
|
1399
1400
|
*
|
|
@@ -1424,21 +1425,23 @@ export const is = SchemaParser.is
|
|
|
1424
1425
|
*
|
|
1425
1426
|
* **Example** (Asserting and narrowing an input)
|
|
1426
1427
|
*
|
|
1427
|
-
* ```ts
|
|
1428
|
-
* import { Schema } from "effect"
|
|
1428
|
+
* ```ts import.meta.vitest
|
|
1429
|
+
* import { Schema, SchemaIssue } from "effect"
|
|
1429
1430
|
*
|
|
1430
1431
|
* const input: unknown = "hello"
|
|
1431
1432
|
*
|
|
1432
1433
|
* // This will pass silently (no return value) and narrow input to string
|
|
1433
1434
|
* Schema.asserts(Schema.String, input)
|
|
1434
|
-
*
|
|
1435
|
+
* input.toUpperCase() // => "HELLO"
|
|
1435
1436
|
*
|
|
1436
1437
|
* // This will throw an error
|
|
1437
1438
|
* try {
|
|
1438
1439
|
* const invalid: unknown = 123
|
|
1439
1440
|
* Schema.asserts(Schema.String, invalid)
|
|
1440
1441
|
* } catch (error) {
|
|
1441
|
-
*
|
|
1442
|
+
* if (error instanceof Error) {
|
|
1443
|
+
* SchemaIssue.isIssue(error.cause) // => true
|
|
1444
|
+
* }
|
|
1442
1445
|
* }
|
|
1443
1446
|
* ```
|
|
1444
1447
|
*
|
|
@@ -1585,7 +1588,7 @@ export function decodeUnknownExit<S extends ConstraintDecoder<unknown>>(schema:
|
|
|
1585
1588
|
|
|
1586
1589
|
function fromIssueExit<A>(exit: Exit_.Exit<A, SchemaIssue.Issue>): Exit_.Exit<A, SchemaError> {
|
|
1587
1590
|
return Exit_.isSuccess(exit)
|
|
1588
|
-
? Exit_.
|
|
1591
|
+
? exit as unknown as Exit_.Exit<A, SchemaError>
|
|
1589
1592
|
: Exit_.failCause(Cause_.map(exit.cause, (issue) => new SchemaError(issue)))
|
|
1590
1593
|
}
|
|
1591
1594
|
|
|
@@ -1848,19 +1851,12 @@ export const decodePromise: <S extends ConstraintDecoder<unknown>>(
|
|
|
1848
1851
|
*
|
|
1849
1852
|
* **Example** (Decoding with a transformation schema)
|
|
1850
1853
|
*
|
|
1851
|
-
* ```ts
|
|
1854
|
+
* ```ts import.meta.vitest
|
|
1852
1855
|
* import { Schema } from "effect"
|
|
1853
1856
|
*
|
|
1854
1857
|
* const NumberFromString = Schema.NumberFromString
|
|
1855
1858
|
*
|
|
1856
|
-
*
|
|
1857
|
-
* // Output: 42
|
|
1858
|
-
*
|
|
1859
|
-
* Schema.decodeUnknownSync(NumberFromString)("not a number")
|
|
1860
|
-
* // throws SchemaError: NumberFromString
|
|
1861
|
-
* // └─ Encoded side transformation failure
|
|
1862
|
-
* // └─ NumberFromString
|
|
1863
|
-
* // └─ Expected a numeric string, actual "not a number"
|
|
1859
|
+
* Schema.decodeUnknownSync(NumberFromString)("42") // => 42
|
|
1864
1860
|
* ```
|
|
1865
1861
|
*
|
|
1866
1862
|
* @see {@link SchemaParser.decodeUnknownSync} for the adapter that throws an `Error` whose cause is `SchemaIssue.Issue`
|
|
@@ -1924,13 +1920,12 @@ export const decodeSync: <S extends ConstraintDecoder<unknown>>(
|
|
|
1924
1920
|
*
|
|
1925
1921
|
* **Example** (Encoding a value to a string)
|
|
1926
1922
|
*
|
|
1927
|
-
* ```ts
|
|
1923
|
+
* ```ts import.meta.vitest
|
|
1928
1924
|
* import { Effect, Schema } from "effect"
|
|
1929
1925
|
*
|
|
1930
1926
|
* const NumberFromString = Schema.NumberFromString
|
|
1931
1927
|
*
|
|
1932
|
-
* Effect.runPromise(Schema.encodeUnknownEffect(NumberFromString)(42))
|
|
1933
|
-
* // Output: "42"
|
|
1928
|
+
* await Effect.runPromise(Schema.encodeUnknownEffect(NumberFromString)(42)) // => "42"
|
|
1934
1929
|
* ```
|
|
1935
1930
|
*
|
|
1936
1931
|
* @see {@link SchemaParser.encodeUnknownEffect} for the adapter that fails with `SchemaIssue.Issue` directly
|
|
@@ -2378,7 +2373,7 @@ interface optionalKeyLambda extends Lambda {
|
|
|
2378
2373
|
*
|
|
2379
2374
|
* **Example** (Creating a struct with optional key)
|
|
2380
2375
|
*
|
|
2381
|
-
* ```ts
|
|
2376
|
+
* ```ts import.meta.vitest
|
|
2382
2377
|
* import { Schema } from "effect"
|
|
2383
2378
|
*
|
|
2384
2379
|
* const schema = Schema.Struct({
|
|
@@ -2445,7 +2440,7 @@ interface optionalLambda extends Lambda {
|
|
|
2445
2440
|
*
|
|
2446
2441
|
* **Example** (Defining an optional field accepting undefined)
|
|
2447
2442
|
*
|
|
2448
|
-
* ```ts
|
|
2443
|
+
* ```ts import.meta.vitest
|
|
2449
2444
|
* import { Schema } from "effect"
|
|
2450
2445
|
*
|
|
2451
2446
|
* const schema = Schema.Struct({
|
|
@@ -2680,12 +2675,12 @@ function isFlip$(schema: Top): schema is flip<any> {
|
|
|
2680
2675
|
*
|
|
2681
2676
|
* **Example** (Flipping a number-from-string schema)
|
|
2682
2677
|
*
|
|
2683
|
-
* ```ts
|
|
2678
|
+
* ```ts import.meta.vitest
|
|
2684
2679
|
* import { Schema } from "effect"
|
|
2685
2680
|
*
|
|
2686
2681
|
* // NumberFromString: decodes string → number
|
|
2687
2682
|
* const flipped = Schema.flip(Schema.NumberFromString)
|
|
2688
|
-
*
|
|
2683
|
+
* Schema.decodeSync(flipped)(42) // => "42"
|
|
2689
2684
|
* ```
|
|
2690
2685
|
*
|
|
2691
2686
|
* @category transforming
|
|
@@ -2717,11 +2712,12 @@ export interface Literal<L extends SchemaAST.LiteralValue>
|
|
|
2717
2712
|
*
|
|
2718
2713
|
* **Example** (Defining a string literal)
|
|
2719
2714
|
*
|
|
2720
|
-
* ```ts
|
|
2715
|
+
* ```ts import.meta.vitest
|
|
2721
2716
|
* import { Schema } from "effect"
|
|
2722
2717
|
*
|
|
2723
2718
|
* const schema = Schema.Literal("hello")
|
|
2724
2719
|
* // Type: Schema.Literal<"hello">
|
|
2720
|
+
* Schema.decodeSync(schema)("hello") // => "hello"
|
|
2725
2721
|
* ```
|
|
2726
2722
|
*
|
|
2727
2723
|
* @see {@link Literals} for a schema that represents a union of literals.
|
|
@@ -2849,11 +2845,11 @@ function templateLiteralFromParts<Parts extends TemplateLiteral.Parts>(parts: Pa
|
|
|
2849
2845
|
*
|
|
2850
2846
|
* **Example** (Defining a URL path pattern)
|
|
2851
2847
|
*
|
|
2852
|
-
* ```ts
|
|
2848
|
+
* ```ts import.meta.vitest
|
|
2853
2849
|
* import { Schema } from "effect"
|
|
2854
2850
|
*
|
|
2855
2851
|
* const schema = Schema.TemplateLiteral(["/user/", Schema.Number])
|
|
2856
|
-
*
|
|
2852
|
+
* Schema.is(schema)("/user/123") // => true
|
|
2857
2853
|
* ```
|
|
2858
2854
|
*
|
|
2859
2855
|
* @see {@link TemplateLiteralParser} for a schema that also parses matched parts into a tuple.
|
|
@@ -2928,11 +2924,11 @@ export interface TemplateLiteralParser<Parts extends TemplateLiteral.Parts> exte
|
|
|
2928
2924
|
*
|
|
2929
2925
|
* **Example** (Parsing path parameters)
|
|
2930
2926
|
*
|
|
2931
|
-
* ```ts
|
|
2927
|
+
* ```ts import.meta.vitest
|
|
2932
2928
|
* import { Schema } from "effect"
|
|
2933
2929
|
*
|
|
2934
2930
|
* const schema = Schema.TemplateLiteralParser(["/user/", Schema.NumberFromString])
|
|
2935
|
-
*
|
|
2931
|
+
* Schema.decodeSync(schema)("/user/42") // => ["/user/", 42]
|
|
2936
2932
|
* ```
|
|
2937
2933
|
*
|
|
2938
2934
|
* @see {@link TemplateLiteral} for a validation-only version that keeps the string encoded.
|
|
@@ -2962,7 +2958,7 @@ export interface Enum<A extends { [x: string]: string | number }>
|
|
|
2962
2958
|
*
|
|
2963
2959
|
* **Example** (Defining a direction enum)
|
|
2964
2960
|
*
|
|
2965
|
-
* ```ts
|
|
2961
|
+
* ```ts import.meta.vitest
|
|
2966
2962
|
* import { Schema } from "effect"
|
|
2967
2963
|
*
|
|
2968
2964
|
* enum Direction {
|
|
@@ -2971,7 +2967,7 @@ export interface Enum<A extends { [x: string]: string | number }>
|
|
|
2971
2967
|
* }
|
|
2972
2968
|
*
|
|
2973
2969
|
* const schema = Schema.Enum(Direction)
|
|
2974
|
-
* //
|
|
2970
|
+
* Schema.decodeSync(schema)(Direction.Up) // => "Up"
|
|
2975
2971
|
* ```
|
|
2976
2972
|
*
|
|
2977
2973
|
* @category constructors
|
|
@@ -3134,7 +3130,7 @@ export interface Boolean extends Bottom<boolean, boolean, never, never, SchemaAS
|
|
|
3134
3130
|
*
|
|
3135
3131
|
* @see {@link BooleanFromBit} for a schema that decodes bit literals `0` or `1` into a boolean
|
|
3136
3132
|
*
|
|
3137
|
-
* @category
|
|
3133
|
+
* @category schemas
|
|
3138
3134
|
* @since 4.0.0
|
|
3139
3135
|
*/
|
|
3140
3136
|
export const Boolean: Boolean = make(SchemaAST.boolean)
|
|
@@ -3240,11 +3236,12 @@ export interface UniqueSymbol<sym extends symbol>
|
|
|
3240
3236
|
*
|
|
3241
3237
|
* **Example** (Defining a specific symbol)
|
|
3242
3238
|
*
|
|
3243
|
-
* ```ts
|
|
3239
|
+
* ```ts import.meta.vitest
|
|
3244
3240
|
* import { Schema } from "effect"
|
|
3245
3241
|
*
|
|
3246
3242
|
* const mySymbol = Symbol.for("mySymbol")
|
|
3247
3243
|
* const schema = Schema.UniqueSymbol(mySymbol)
|
|
3244
|
+
* Schema.decodeSync(schema)(mySymbol) === mySymbol // => true
|
|
3248
3245
|
* ```
|
|
3249
3246
|
*
|
|
3250
3247
|
* @see {@link Symbol} for a schema that accepts any symbol.
|
|
@@ -3401,7 +3398,7 @@ export declare namespace Struct {
|
|
|
3401
3398
|
type MakeInView<
|
|
3402
3399
|
F extends Fields,
|
|
3403
3400
|
O extends keyof F = TypeOptionalKeys<F> | TypeConstructorDefaultedKeys<F>
|
|
3404
|
-
> = [O] extends [never] ? ReadonlyMakeIn<F
|
|
3401
|
+
> = [O] extends [never] ? Simplify<ReadonlyMakeIn<F>> : Simplify<SetOptional<ReadonlyMakeIn<F>, O>>
|
|
3405
3402
|
|
|
3406
3403
|
/**
|
|
3407
3404
|
* Computes the input object type accepted when constructing a struct value.
|
|
@@ -3437,7 +3434,7 @@ export interface Struct<Fields extends Struct.Fields> extends BottomLazy<SchemaA
|
|
|
3437
3434
|
*
|
|
3438
3435
|
* **Example** (Reusing fields across structs)
|
|
3439
3436
|
*
|
|
3440
|
-
* ```ts
|
|
3437
|
+
* ```ts import.meta.vitest
|
|
3441
3438
|
* import { Schema } from "effect"
|
|
3442
3439
|
*
|
|
3443
3440
|
* const Timestamped = Schema.Struct({
|
|
@@ -3450,6 +3447,7 @@ export interface Struct<Fields extends Struct.Fields> extends BottomLazy<SchemaA
|
|
|
3450
3447
|
* name: Schema.String,
|
|
3451
3448
|
* email: Schema.String
|
|
3452
3449
|
* })
|
|
3450
|
+
* Object.keys(User.fields) // => ["createdAt", "updatedAt", "name", "email"]
|
|
3453
3451
|
* ```
|
|
3454
3452
|
*/
|
|
3455
3453
|
readonly fields: Fields
|
|
@@ -3506,7 +3504,7 @@ function makeStruct<const Fields extends Struct.Fields>(ast: SchemaAST.Objects,
|
|
|
3506
3504
|
*
|
|
3507
3505
|
* **Example** (Defining a basic struct)
|
|
3508
3506
|
*
|
|
3509
|
-
* ```ts
|
|
3507
|
+
* ```ts import.meta.vitest
|
|
3510
3508
|
* import { Schema } from "effect"
|
|
3511
3509
|
*
|
|
3512
3510
|
* const Person = Schema.Struct({
|
|
@@ -3518,9 +3516,7 @@ function makeStruct<const Fields extends Struct.Fields>(ast: SchemaAST.Objects,
|
|
|
3518
3516
|
* // { readonly name: string; readonly age: number; readonly email?: string }
|
|
3519
3517
|
* type Person = typeof Person.Type
|
|
3520
3518
|
*
|
|
3521
|
-
*
|
|
3522
|
-
* console.log(alice)
|
|
3523
|
-
* // { name: 'Alice', age: 30 }
|
|
3519
|
+
* Schema.decodeUnknownSync(Person)({ name: "Alice", age: 30 }) // => { name: "Alice", age: 30 }
|
|
3524
3520
|
* ```
|
|
3525
3521
|
*
|
|
3526
3522
|
* @category constructors
|
|
@@ -3553,7 +3549,7 @@ interface fieldsAssign<NewFields extends Struct.Fields> extends Lambda {
|
|
|
3553
3549
|
*
|
|
3554
3550
|
* **Example** (Adding fields to a union of structs)
|
|
3555
3551
|
*
|
|
3556
|
-
* ```ts
|
|
3552
|
+
* ```ts import.meta.vitest
|
|
3557
3553
|
* import { Schema, Tuple } from "effect"
|
|
3558
3554
|
*
|
|
3559
3555
|
* // Add a new field to all members of a union of structs
|
|
@@ -3561,6 +3557,7 @@ interface fieldsAssign<NewFields extends Struct.Fields> extends Lambda {
|
|
|
3561
3557
|
* Schema.Struct({ a: Schema.String }),
|
|
3562
3558
|
* Schema.Struct({ b: Schema.Number })
|
|
3563
3559
|
* ]).mapMembers(Tuple.map(Schema.fieldsAssign({ c: Schema.Number })))
|
|
3560
|
+
* Schema.decodeSync(schema)({ a: "a", c: 1 }) // => { a: "a", c: 1 }
|
|
3564
3561
|
* ```
|
|
3565
3562
|
*
|
|
3566
3563
|
* @category combinators
|
|
@@ -3608,16 +3605,14 @@ const canonicalPropertyKey = (key: PropertyKey): string | symbol =>
|
|
|
3608
3605
|
*
|
|
3609
3606
|
* **Example** (Renaming `name` to `full_name` in the encoded form)
|
|
3610
3607
|
*
|
|
3611
|
-
* ```ts
|
|
3608
|
+
* ```ts import.meta.vitest
|
|
3612
3609
|
* import { Schema } from "effect"
|
|
3613
3610
|
*
|
|
3614
3611
|
* const Person = Schema.Struct({ name: Schema.String, age: Schema.Number })
|
|
3615
3612
|
* const Encoded = Person.pipe(Schema.encodeKeys({ name: "full_name" }))
|
|
3616
3613
|
*
|
|
3617
3614
|
* // Decodes { full_name: "Alice", age: 30 } → { name: "Alice", age: 30 }
|
|
3618
|
-
*
|
|
3619
|
-
* console.log(alice)
|
|
3620
|
-
* // { name: 'Alice', age: 30 }
|
|
3615
|
+
* Schema.decodeUnknownSync(Encoded)({ full_name: "Alice", age: 30 }) // => { name: "Alice", age: 30 }
|
|
3621
3616
|
* ```
|
|
3622
3617
|
*
|
|
3623
3618
|
* @category transforming
|
|
@@ -3669,7 +3664,7 @@ export function encodeKeys<
|
|
|
3669
3664
|
*
|
|
3670
3665
|
* **Example** (Adding a computed `fullName` field)
|
|
3671
3666
|
*
|
|
3672
|
-
* ```ts
|
|
3667
|
+
* ```ts import.meta.vitest
|
|
3673
3668
|
* import { Option, Schema } from "effect"
|
|
3674
3669
|
*
|
|
3675
3670
|
* const Person = Schema.Struct({ first: Schema.String, last: Schema.String })
|
|
@@ -3681,8 +3676,7 @@ export function encodeKeys<
|
|
|
3681
3676
|
* )
|
|
3682
3677
|
*
|
|
3683
3678
|
* const alice = Schema.decodeUnknownSync(Extended)({ first: "Alice", last: "Smith" })
|
|
3684
|
-
*
|
|
3685
|
-
* // Alice Smith
|
|
3679
|
+
* alice.fullName // => "Alice Smith"
|
|
3686
3680
|
* ```
|
|
3687
3681
|
*
|
|
3688
3682
|
* @category transforming
|
|
@@ -3885,9 +3879,16 @@ export interface $Record<Key extends Record.Key, Value extends Constraint> exten
|
|
|
3885
3879
|
* For transformed key schemas, property selection is based on encoded property
|
|
3886
3880
|
* names before the selected key is decoded.
|
|
3887
3881
|
*
|
|
3882
|
+
* **Gotchas**
|
|
3883
|
+
*
|
|
3884
|
+
* When decoded or encoded key transformations produce the same property key,
|
|
3885
|
+
* sequential parsing applies selected own properties in selection order, so
|
|
3886
|
+
* the later selected property overwrites the earlier value. With concurrency
|
|
3887
|
+
* greater than `1`, completion order determines which value is retained.
|
|
3888
|
+
*
|
|
3888
3889
|
* **Example** (Defining a string-keyed record of numbers)
|
|
3889
3890
|
*
|
|
3890
|
-
* ```ts
|
|
3891
|
+
* ```ts import.meta.vitest
|
|
3891
3892
|
* import { Schema } from "effect"
|
|
3892
3893
|
*
|
|
3893
3894
|
* const schema = Schema.Record(Schema.String, Schema.Number)
|
|
@@ -3895,9 +3896,7 @@ export interface $Record<Key extends Record.Key, Value extends Constraint> exten
|
|
|
3895
3896
|
* // { readonly [x: string]: number }
|
|
3896
3897
|
* type R = typeof schema.Type
|
|
3897
3898
|
*
|
|
3898
|
-
*
|
|
3899
|
-
* console.log(result)
|
|
3900
|
-
* // { a: 1, b: 2 }
|
|
3899
|
+
* Schema.decodeUnknownSync(schema)({ a: 1, b: 2 }) // => { a: 1, b: 2 }
|
|
3901
3900
|
* ```
|
|
3902
3901
|
*
|
|
3903
3902
|
* @category constructors
|
|
@@ -3905,18 +3904,9 @@ export interface $Record<Key extends Record.Key, Value extends Constraint> exten
|
|
|
3905
3904
|
*/
|
|
3906
3905
|
export function Record<Key extends Record.Key, Value extends Constraint>(
|
|
3907
3906
|
key: Key,
|
|
3908
|
-
value: Value
|
|
3909
|
-
options?: {
|
|
3910
|
-
readonly keyValueCombiner: {
|
|
3911
|
-
readonly decode?: Combiner.Combiner<readonly [Key["Type"], Value["Type"]]> | undefined
|
|
3912
|
-
readonly encode?: Combiner.Combiner<readonly [Key["Encoded"], Value["Encoded"]]> | undefined
|
|
3913
|
-
}
|
|
3914
|
-
}
|
|
3907
|
+
value: Value
|
|
3915
3908
|
): $Record<Key, Value> {
|
|
3916
|
-
|
|
3917
|
-
? new SchemaAST.KeyValueCombiner(options.keyValueCombiner.decode, options.keyValueCombiner.encode)
|
|
3918
|
-
: undefined
|
|
3919
|
-
return make(SchemaAST.record(key.ast, value.ast, keyValueCombiner), { key, value })
|
|
3909
|
+
return make(SchemaAST.record(key.ast, value.ast), { key, value })
|
|
3920
3910
|
}
|
|
3921
3911
|
|
|
3922
3912
|
/**
|
|
@@ -4060,7 +4050,7 @@ export declare namespace StructWithRest {
|
|
|
4060
4050
|
*
|
|
4061
4051
|
* **Example** (Checking record compatibility)
|
|
4062
4052
|
*
|
|
4063
|
-
* ```ts
|
|
4053
|
+
* ```ts import.meta.vitest
|
|
4064
4054
|
* import { Schema } from "effect"
|
|
4065
4055
|
*
|
|
4066
4056
|
* const user = Schema.Struct({ id: Schema.String })
|
|
@@ -4131,7 +4121,7 @@ export interface StructWithRest<
|
|
|
4131
4121
|
*
|
|
4132
4122
|
* **Example** (Defining structs with string-indexed extra keys)
|
|
4133
4123
|
*
|
|
4134
|
-
* ```ts
|
|
4124
|
+
* ```ts import.meta.vitest
|
|
4135
4125
|
* import { Schema } from "effect"
|
|
4136
4126
|
*
|
|
4137
4127
|
* const schema = Schema.StructWithRest(
|
|
@@ -4352,14 +4342,12 @@ function makeTuple<Elements extends Tuple.Elements>(ast: SchemaAST.Arrays, eleme
|
|
|
4352
4342
|
*
|
|
4353
4343
|
* **Example** (Defining a pair of string and number)
|
|
4354
4344
|
*
|
|
4355
|
-
* ```ts
|
|
4345
|
+
* ```ts import.meta.vitest
|
|
4356
4346
|
* import { Schema } from "effect"
|
|
4357
4347
|
*
|
|
4358
4348
|
* const schema = Schema.Tuple([Schema.String, Schema.Number])
|
|
4359
4349
|
*
|
|
4360
|
-
*
|
|
4361
|
-
* console.log(pair)
|
|
4362
|
-
* // [ 'hello', 42 ]
|
|
4350
|
+
* Schema.decodeUnknownSync(schema)(["hello", 42]) // => ["hello", 42]
|
|
4363
4351
|
* ```
|
|
4364
4352
|
*
|
|
4365
4353
|
* @category constructors
|
|
@@ -4530,7 +4518,7 @@ export interface TupleWithRest<
|
|
|
4530
4518
|
*
|
|
4531
4519
|
* **Example** (Defining tuples with rest elements)
|
|
4532
4520
|
*
|
|
4533
|
-
* ```ts
|
|
4521
|
+
* ```ts import.meta.vitest
|
|
4534
4522
|
* import { Schema } from "effect"
|
|
4535
4523
|
*
|
|
4536
4524
|
* // [string, number, ...boolean[]]
|
|
@@ -4539,9 +4527,7 @@ export interface TupleWithRest<
|
|
|
4539
4527
|
* [Schema.Boolean]
|
|
4540
4528
|
* )
|
|
4541
4529
|
*
|
|
4542
|
-
*
|
|
4543
|
-
* console.log(result)
|
|
4544
|
-
* // [ 'hello', 1, true, false ]
|
|
4530
|
+
* Schema.decodeUnknownSync(schema)(["hello", 1, true, false]) // => ["hello", 1, true, false]
|
|
4545
4531
|
* ```
|
|
4546
4532
|
*
|
|
4547
4533
|
* @category constructors
|
|
@@ -4595,14 +4581,12 @@ export {
|
|
|
4595
4581
|
*
|
|
4596
4582
|
* **Example** (Defining an array of strings)
|
|
4597
4583
|
*
|
|
4598
|
-
* ```ts
|
|
4584
|
+
* ```ts import.meta.vitest
|
|
4599
4585
|
* import { Schema } from "effect"
|
|
4600
4586
|
*
|
|
4601
4587
|
* const schema = Schema.Array(Schema.String)
|
|
4602
4588
|
*
|
|
4603
|
-
*
|
|
4604
|
-
* console.log(result)
|
|
4605
|
-
* // [ 'a', 'b', 'c' ]
|
|
4589
|
+
* Schema.decodeUnknownSync(schema)(["a", "b", "c"]) // => ["a", "b", "c"]
|
|
4606
4590
|
* ```
|
|
4607
4591
|
*
|
|
4608
4592
|
* @category constructors
|
|
@@ -4644,13 +4628,12 @@ interface NonEmptyArrayLambda extends Lambda {
|
|
|
4644
4628
|
*
|
|
4645
4629
|
* **Example** (Defining a non-empty array of numbers)
|
|
4646
4630
|
*
|
|
4647
|
-
* ```ts
|
|
4631
|
+
* ```ts import.meta.vitest
|
|
4648
4632
|
* import { Schema } from "effect"
|
|
4649
4633
|
*
|
|
4650
4634
|
* const schema = Schema.NonEmptyArray(Schema.Number)
|
|
4651
4635
|
*
|
|
4652
|
-
* Schema.decodeUnknownSync(schema)([1, 2, 3])
|
|
4653
|
-
* Schema.decodeUnknownSync(schema)([]) // throws
|
|
4636
|
+
* Schema.decodeUnknownSync(schema)([1, 2, 3]) // => [1, 2, 3]
|
|
4654
4637
|
* ```
|
|
4655
4638
|
*
|
|
4656
4639
|
* @category constructors
|
|
@@ -4772,13 +4755,16 @@ interface mutableLambda extends Lambda {
|
|
|
4772
4755
|
*
|
|
4773
4756
|
* **Example** (Defining mutable arrays)
|
|
4774
4757
|
*
|
|
4775
|
-
* ```ts
|
|
4758
|
+
* ```ts import.meta.vitest
|
|
4776
4759
|
* import { Schema } from "effect"
|
|
4777
4760
|
*
|
|
4778
4761
|
* const schema = Schema.mutable(Schema.Array(Schema.Number))
|
|
4779
4762
|
*
|
|
4780
4763
|
* // number[] (mutable)
|
|
4781
4764
|
* type T = typeof schema.Type
|
|
4765
|
+
* const value: T = [1, 2]
|
|
4766
|
+
* value.push(3)
|
|
4767
|
+
* value // => [1, 2, 3]
|
|
4782
4768
|
* ```
|
|
4783
4769
|
*
|
|
4784
4770
|
* @category transforming
|
|
@@ -4866,13 +4852,13 @@ function makeUnion<Members extends ReadonlyArray<Constraint>>(
|
|
|
4866
4852
|
*
|
|
4867
4853
|
* **Example** (Defining a string or number union)
|
|
4868
4854
|
*
|
|
4869
|
-
* ```ts
|
|
4855
|
+
* ```ts import.meta.vitest
|
|
4870
4856
|
* import { Schema } from "effect"
|
|
4871
4857
|
*
|
|
4872
4858
|
* const schema = Schema.Union([Schema.String, Schema.Number])
|
|
4873
4859
|
*
|
|
4874
|
-
* Schema.decodeUnknownSync(schema)("hello") // "hello"
|
|
4875
|
-
* Schema.decodeUnknownSync(schema)(42)
|
|
4860
|
+
* Schema.decodeUnknownSync(schema)("hello") // => "hello"
|
|
4861
|
+
* Schema.decodeUnknownSync(schema)(42) // => 42
|
|
4876
4862
|
* ```
|
|
4877
4863
|
*
|
|
4878
4864
|
* @category constructors
|
|
@@ -4913,11 +4899,11 @@ export interface Literals<L extends ReadonlyArray<SchemaAST.LiteralValue>>
|
|
|
4913
4899
|
*
|
|
4914
4900
|
* **Example** (Defining status codes)
|
|
4915
4901
|
*
|
|
4916
|
-
* ```ts
|
|
4902
|
+
* ```ts import.meta.vitest
|
|
4917
4903
|
* import { Schema } from "effect"
|
|
4918
4904
|
*
|
|
4919
4905
|
* const schema = Schema.Literals(["active", "inactive", "pending"])
|
|
4920
|
-
*
|
|
4906
|
+
* Schema.decodeSync(schema)("active") // => "active"
|
|
4921
4907
|
* ```
|
|
4922
4908
|
*
|
|
4923
4909
|
* @see {@link Literal} for a schema that represents a single literal.
|
|
@@ -5049,7 +5035,7 @@ export interface suspend<S extends Constraint> extends
|
|
|
5049
5035
|
*
|
|
5050
5036
|
* **Example** (Defining recursive tree schemas)
|
|
5051
5037
|
*
|
|
5052
|
-
* ```ts
|
|
5038
|
+
* ```ts import.meta.vitest
|
|
5053
5039
|
* import { Schema } from "effect"
|
|
5054
5040
|
*
|
|
5055
5041
|
* interface Tree {
|
|
@@ -5061,6 +5047,7 @@ export interface suspend<S extends Constraint> extends
|
|
|
5061
5047
|
* value: Schema.Number,
|
|
5062
5048
|
* children: Schema.Array(Schema.suspend((): Schema.Codec<Tree> => Tree))
|
|
5063
5049
|
* })
|
|
5050
|
+
* Schema.decodeSync(Tree)({ value: 1, children: [] }) // => { value: 1, children: [] }
|
|
5064
5051
|
* ```
|
|
5065
5052
|
*
|
|
5066
5053
|
* @category constructors
|
|
@@ -5076,12 +5063,14 @@ export function suspend<S extends Constraint>(f: () => S): suspend<S> {
|
|
|
5076
5063
|
*
|
|
5077
5064
|
* **Example** (Adding checks to a schema)
|
|
5078
5065
|
*
|
|
5079
|
-
* ```ts
|
|
5066
|
+
* ```ts import.meta.vitest
|
|
5080
5067
|
* import { Schema } from "effect"
|
|
5081
5068
|
*
|
|
5082
5069
|
* const AgeSchema = Schema.Finite.pipe(
|
|
5083
5070
|
* Schema.check(Schema.isGreaterThanOrEqualTo(0), Schema.isLessThanOrEqualTo(120))
|
|
5084
5071
|
* )
|
|
5072
|
+
* Schema.is(AgeSchema)(42) // => true
|
|
5073
|
+
* Schema.is(AgeSchema)(121) // => false
|
|
5085
5074
|
* ```
|
|
5086
5075
|
*
|
|
5087
5076
|
* @category filtering
|
|
@@ -5253,14 +5242,17 @@ export interface middlewareDecoding<S extends Constraint, RD> extends
|
|
|
5253
5242
|
*
|
|
5254
5243
|
* **Example** (Logging decode failures)
|
|
5255
5244
|
*
|
|
5256
|
-
* ```ts
|
|
5245
|
+
* ```ts import.meta.vitest
|
|
5257
5246
|
* import { Effect, Schema } from "effect"
|
|
5258
5247
|
*
|
|
5248
|
+
* const events: Array<string> = []
|
|
5259
5249
|
* const Logged = Schema.String.pipe(
|
|
5260
5250
|
* Schema.middlewareDecoding((effect) =>
|
|
5261
|
-
* Effect.tapError(effect, (
|
|
5251
|
+
* Effect.tapError(effect, () => Effect.sync(() => events.push("decode failed")))
|
|
5262
5252
|
* )
|
|
5263
5253
|
* )
|
|
5254
|
+
* Effect.runSync(Effect.result(Schema.decodeUnknownEffect(Logged)(42)))
|
|
5255
|
+
* events // => ["decode failed"]
|
|
5264
5256
|
* ```
|
|
5265
5257
|
*
|
|
5266
5258
|
* @see {@link catchDecoding} for a simpler error-recovery variant
|
|
@@ -5319,14 +5311,17 @@ export interface middlewareEncoding<S extends Constraint, RE> extends
|
|
|
5319
5311
|
*
|
|
5320
5312
|
* **Example** (Logging encode failures)
|
|
5321
5313
|
*
|
|
5322
|
-
* ```ts
|
|
5314
|
+
* ```ts import.meta.vitest
|
|
5323
5315
|
* import { Effect, Schema } from "effect"
|
|
5324
5316
|
*
|
|
5317
|
+
* const events: Array<string> = []
|
|
5325
5318
|
* const Logged = Schema.String.pipe(
|
|
5326
5319
|
* Schema.middlewareEncoding((effect) =>
|
|
5327
|
-
* Effect.tapError(effect, (
|
|
5320
|
+
* Effect.tapError(effect, () => Effect.sync(() => events.push("encode failed")))
|
|
5328
5321
|
* )
|
|
5329
5322
|
* )
|
|
5323
|
+
* Effect.runSync(Effect.result(Schema.encodeUnknownEffect(Logged)(42)))
|
|
5324
|
+
* events // => ["encode failed"]
|
|
5330
5325
|
* ```
|
|
5331
5326
|
*
|
|
5332
5327
|
* @see {@link catchEncoding} for a simpler error-recovery variant
|
|
@@ -5356,12 +5351,13 @@ export function middlewareEncoding<S extends Constraint, RE>(
|
|
|
5356
5351
|
*
|
|
5357
5352
|
* **Example** (Returning a default on decode failure)
|
|
5358
5353
|
*
|
|
5359
|
-
* ```ts
|
|
5354
|
+
* ```ts import.meta.vitest
|
|
5360
5355
|
* import { Effect, Option, Schema } from "effect"
|
|
5361
5356
|
*
|
|
5362
5357
|
* const schema = Schema.Number.pipe(
|
|
5363
5358
|
* Schema.catchDecoding((_issue) => Effect.succeed(Option.some(0)))
|
|
5364
5359
|
* )
|
|
5360
|
+
* Effect.runSync(Schema.decodeUnknownEffect(schema)("invalid")) // => 0
|
|
5365
5361
|
* ```
|
|
5366
5362
|
*
|
|
5367
5363
|
* @see {@link catchDecodingWithContext} to add service requirements to the handler
|
|
@@ -5511,7 +5507,7 @@ export interface compose<To extends Constraint, From extends Constraint> extends
|
|
|
5511
5507
|
*
|
|
5512
5508
|
* **Example** (Transforming strings to numbers with a schema transformation)
|
|
5513
5509
|
*
|
|
5514
|
-
* ```ts
|
|
5510
|
+
* ```ts import.meta.vitest
|
|
5515
5511
|
* import { Schema, SchemaGetter } from "effect"
|
|
5516
5512
|
*
|
|
5517
5513
|
* const NumberFromString = Schema.String.pipe(
|
|
@@ -5524,8 +5520,7 @@ export interface compose<To extends Constraint, From extends Constraint> extends
|
|
|
5524
5520
|
* )
|
|
5525
5521
|
* )
|
|
5526
5522
|
*
|
|
5527
|
-
*
|
|
5528
|
-
* // result: 123
|
|
5523
|
+
* Schema.decodeUnknownSync(NumberFromString)("123") // => 123
|
|
5529
5524
|
* ```
|
|
5530
5525
|
*
|
|
5531
5526
|
* @category transforming
|
|
@@ -5587,7 +5582,7 @@ export function decodeTo<To extends Constraint, From extends Constraint, RD = ne
|
|
|
5587
5582
|
*
|
|
5588
5583
|
* **Example** (Trimming string values during encoding/decoding)
|
|
5589
5584
|
*
|
|
5590
|
-
* ```ts
|
|
5585
|
+
* ```ts import.meta.vitest
|
|
5591
5586
|
* import { Schema, SchemaGetter } from "effect"
|
|
5592
5587
|
*
|
|
5593
5588
|
* const Trimmed = Schema.String.pipe(
|
|
@@ -5597,8 +5592,7 @@ export function decodeTo<To extends Constraint, From extends Constraint, RD = ne
|
|
|
5597
5592
|
* })
|
|
5598
5593
|
* )
|
|
5599
5594
|
*
|
|
5600
|
-
*
|
|
5601
|
-
* // result: "hello"
|
|
5595
|
+
* Schema.decodeUnknownSync(Trimmed)(" hello ") // => "hello"
|
|
5602
5596
|
* ```
|
|
5603
5597
|
*
|
|
5604
5598
|
* @category transforming
|
|
@@ -5628,7 +5622,7 @@ export function decode<S extends Constraint, RD = never, RE = never>(transformat
|
|
|
5628
5622
|
*
|
|
5629
5623
|
* **Example** (Encoding a number back to a string)
|
|
5630
5624
|
*
|
|
5631
|
-
* ```ts
|
|
5625
|
+
* ```ts import.meta.vitest
|
|
5632
5626
|
* import { Schema, SchemaGetter } from "effect"
|
|
5633
5627
|
*
|
|
5634
5628
|
* const NumberFromString = Schema.Number.pipe(
|
|
@@ -5637,6 +5631,7 @@ export function decode<S extends Constraint, RD = never, RE = never>(transformat
|
|
|
5637
5631
|
* encode: SchemaGetter.transform((n: number) => String(n))
|
|
5638
5632
|
* })
|
|
5639
5633
|
* )
|
|
5634
|
+
* Schema.decodeSync(NumberFromString)("42") // => 42
|
|
5640
5635
|
* ```
|
|
5641
5636
|
*
|
|
5642
5637
|
* @category transforming
|
|
@@ -5677,7 +5672,7 @@ export function encodeTo<To extends Constraint, From extends Constraint, RD = ne
|
|
|
5677
5672
|
*
|
|
5678
5673
|
* **Example** (Upper-casing encoded strings)
|
|
5679
5674
|
*
|
|
5680
|
-
* ```ts
|
|
5675
|
+
* ```ts import.meta.vitest
|
|
5681
5676
|
* import { Schema, SchemaGetter } from "effect"
|
|
5682
5677
|
*
|
|
5683
5678
|
* const UpperFromLower = Schema.String.pipe(
|
|
@@ -5686,6 +5681,7 @@ export function encodeTo<To extends Constraint, From extends Constraint, RD = ne
|
|
|
5686
5681
|
* encode: SchemaGetter.transform((s: string) => s.toUpperCase())
|
|
5687
5682
|
* })
|
|
5688
5683
|
* )
|
|
5684
|
+
* Schema.encodeSync(UpperFromLower)("hello") // => "HELLO"
|
|
5689
5685
|
* ```
|
|
5690
5686
|
*
|
|
5691
5687
|
* @category transforming
|
|
@@ -5752,7 +5748,7 @@ export interface withConstructorDefault<S extends Constraint & WithoutConstructo
|
|
|
5752
5748
|
*
|
|
5753
5749
|
* **Example** (Defining an optional field with a static default)
|
|
5754
5750
|
*
|
|
5755
|
-
* ```ts
|
|
5751
|
+
* ```ts import.meta.vitest
|
|
5756
5752
|
* import { Effect, Schema } from "effect"
|
|
5757
5753
|
*
|
|
5758
5754
|
* const MySchema = Schema.Struct({
|
|
@@ -5762,8 +5758,7 @@ export interface withConstructorDefault<S extends Constraint & WithoutConstructo
|
|
|
5762
5758
|
* )
|
|
5763
5759
|
* })
|
|
5764
5760
|
*
|
|
5765
|
-
*
|
|
5766
|
-
* // value: { name: "anonymous" }
|
|
5761
|
+
* MySchema.make({}).name // => "anonymous"
|
|
5767
5762
|
* ```
|
|
5768
5763
|
*
|
|
5769
5764
|
* @category constructors
|
|
@@ -5830,15 +5825,14 @@ export type DecodingDefaultOptions = {
|
|
|
5830
5825
|
*
|
|
5831
5826
|
* **Example** (Providing a default for a missing struct key)
|
|
5832
5827
|
*
|
|
5833
|
-
* ```ts
|
|
5828
|
+
* ```ts import.meta.vitest
|
|
5834
5829
|
* import { Effect, Schema } from "effect"
|
|
5835
5830
|
*
|
|
5836
5831
|
* const MySchema = Schema.Struct({
|
|
5837
5832
|
* name: Schema.String.pipe(Schema.withDecodingDefaultKey(Effect.succeed("anonymous")))
|
|
5838
5833
|
* })
|
|
5839
5834
|
*
|
|
5840
|
-
*
|
|
5841
|
-
* // result: { name: "anonymous" }
|
|
5835
|
+
* Schema.decodeUnknownSync(MySchema)({}).name // => "anonymous"
|
|
5842
5836
|
* ```
|
|
5843
5837
|
*
|
|
5844
5838
|
* @see {@link withDecodingDefault} for the value-level variant (key absent **or** `undefined`)
|
|
@@ -5938,15 +5932,14 @@ export interface withDecodingDefault<S extends Constraint, R = never> extends de
|
|
|
5938
5932
|
*
|
|
5939
5933
|
* **Example** (Providing a default for an optional field value)
|
|
5940
5934
|
*
|
|
5941
|
-
* ```ts
|
|
5935
|
+
* ```ts import.meta.vitest
|
|
5942
5936
|
* import { Effect, Schema } from "effect"
|
|
5943
5937
|
*
|
|
5944
5938
|
* const MySchema = Schema.Struct({
|
|
5945
5939
|
* name: Schema.String.pipe(Schema.optional, Schema.withDecodingDefault(Effect.succeed("anonymous")))
|
|
5946
5940
|
* })
|
|
5947
5941
|
*
|
|
5948
|
-
*
|
|
5949
|
-
* // result: { name: "anonymous" }
|
|
5942
|
+
* Schema.decodeUnknownSync(MySchema)({ name: undefined }).name // => "anonymous"
|
|
5950
5943
|
* ```
|
|
5951
5944
|
*
|
|
5952
5945
|
* @see {@link withDecodingDefaultKey} for the key-level variant (key absent only, not `undefined`)
|
|
@@ -6033,14 +6026,14 @@ export interface tag<Tag extends SchemaAST.LiteralValue> extends withConstructor
|
|
|
6033
6026
|
*
|
|
6034
6027
|
* **Example** (Defining a discriminated union tag)
|
|
6035
6028
|
*
|
|
6036
|
-
* ```ts
|
|
6029
|
+
* ```ts import.meta.vitest
|
|
6037
6030
|
* import { Schema } from "effect"
|
|
6038
6031
|
*
|
|
6039
6032
|
* const A = Schema.Struct({ _tag: Schema.tag("A"), value: Schema.Number })
|
|
6040
6033
|
*
|
|
6041
6034
|
* // _tag is optional in make, auto-filled to "A"
|
|
6042
6035
|
* const a = A.make({ value: 42 })
|
|
6043
|
-
* //
|
|
6036
|
+
* a // => { _tag: "A", value: 42 }
|
|
6044
6037
|
* ```
|
|
6045
6038
|
*
|
|
6046
6039
|
* @see {@link tagDefaultOmit} to also omit the tag during encoding
|
|
@@ -6067,7 +6060,7 @@ export function tag<Tag extends SchemaAST.LiteralValue>(literal: Tag): tag<Tag>
|
|
|
6067
6060
|
*
|
|
6068
6061
|
* **Example** (Omitting tags during encoding)
|
|
6069
6062
|
*
|
|
6070
|
-
* ```ts
|
|
6063
|
+
* ```ts import.meta.vitest
|
|
6071
6064
|
* import { Schema } from "effect"
|
|
6072
6065
|
*
|
|
6073
6066
|
* const A = Schema.Struct({
|
|
@@ -6076,8 +6069,7 @@ export function tag<Tag extends SchemaAST.LiteralValue>(literal: Tag): tag<Tag>
|
|
|
6076
6069
|
* })
|
|
6077
6070
|
*
|
|
6078
6071
|
* // Encode strips the _tag field
|
|
6079
|
-
*
|
|
6080
|
-
* // encoded: { value: 1 }
|
|
6072
|
+
* Schema.encodeUnknownSync(A)({ _tag: "A", value: 1 }) // => { value: 1 }
|
|
6081
6073
|
* ```
|
|
6082
6074
|
*
|
|
6083
6075
|
* @see {@link tag} for the variant that keeps the tag during encoding
|
|
@@ -6113,7 +6105,7 @@ export type TaggedStruct<Tag extends SchemaAST.LiteralValue, Fields extends Stru
|
|
|
6113
6105
|
*
|
|
6114
6106
|
* **Example** (Defining a tagged struct shorthand)
|
|
6115
6107
|
*
|
|
6116
|
-
* ```ts
|
|
6108
|
+
* ```ts import.meta.vitest
|
|
6117
6109
|
* import { Schema } from "effect"
|
|
6118
6110
|
*
|
|
6119
6111
|
* // Defines a struct with a fixed `_tag` field
|
|
@@ -6126,19 +6118,20 @@ export type TaggedStruct<Tag extends SchemaAST.LiteralValue, Fields extends Stru
|
|
|
6126
6118
|
* _tag: Schema.tag("A"),
|
|
6127
6119
|
* a: Schema.String
|
|
6128
6120
|
* })
|
|
6121
|
+
* void tagged
|
|
6122
|
+
* void equivalent
|
|
6129
6123
|
* ```
|
|
6130
6124
|
*
|
|
6131
6125
|
* **Example** (Accessing the literal value of the tag)
|
|
6132
6126
|
*
|
|
6133
|
-
* ```ts
|
|
6127
|
+
* ```ts import.meta.vitest
|
|
6134
6128
|
* import { Schema } from "effect"
|
|
6135
6129
|
*
|
|
6136
6130
|
* const tagged = Schema.TaggedStruct("A", {
|
|
6137
6131
|
* a: Schema.String
|
|
6138
6132
|
* })
|
|
6139
6133
|
*
|
|
6140
|
-
* //
|
|
6141
|
-
* const literal = tagged.fields._tag.schema.literal
|
|
6134
|
+
* tagged.fields._tag.schema.literal // => "A"
|
|
6142
6135
|
* ```
|
|
6143
6136
|
*
|
|
6144
6137
|
* @category constructors
|
|
@@ -6213,7 +6206,7 @@ export type toTaggedUnion<
|
|
|
6213
6206
|
*
|
|
6214
6207
|
* **Example** (Adding tagged-union utilities to an existing union)
|
|
6215
6208
|
*
|
|
6216
|
-
* ```ts
|
|
6209
|
+
* ```ts import.meta.vitest
|
|
6217
6210
|
* import { Schema } from "effect"
|
|
6218
6211
|
*
|
|
6219
6212
|
* const A = Schema.TaggedStruct("A", { value: Schema.Number })
|
|
@@ -6226,6 +6219,7 @@ export type toTaggedUnion<
|
|
|
6226
6219
|
* A: (a) => `number: ${a.value}`,
|
|
6227
6220
|
* B: (b) => `name: ${b.name}`
|
|
6228
6221
|
* })
|
|
6222
|
+
* result // => "number: 1"
|
|
6229
6223
|
* ```
|
|
6230
6224
|
*
|
|
6231
6225
|
* @see {@link TaggedUnion} for a shorthand that builds the union from scratch
|
|
@@ -6335,7 +6329,7 @@ export interface TaggedUnion<Cases extends Record<string, Constraint>> extends
|
|
|
6335
6329
|
*
|
|
6336
6330
|
* **Example** (Pattern matching a discriminated union)
|
|
6337
6331
|
*
|
|
6338
|
-
* ```ts
|
|
6332
|
+
* ```ts import.meta.vitest
|
|
6339
6333
|
* import { Schema } from "effect"
|
|
6340
6334
|
*
|
|
6341
6335
|
* const Shape = Schema.TaggedUnion({
|
|
@@ -6348,6 +6342,7 @@ export interface TaggedUnion<Cases extends Record<string, Constraint>> extends
|
|
|
6348
6342
|
* Circle: (c) => Math.PI * c.radius ** 2,
|
|
6349
6343
|
* Rectangle: (r) => r.width * r.height
|
|
6350
6344
|
* })
|
|
6345
|
+
* Math.round(area * 100) / 100 // => 78.54
|
|
6351
6346
|
* ```
|
|
6352
6347
|
*
|
|
6353
6348
|
* @see {@link toTaggedUnion} to augment an existing union instead
|
|
@@ -6404,7 +6399,7 @@ export interface Opaque<Self, S extends Top, Brand> extends
|
|
|
6404
6399
|
*
|
|
6405
6400
|
* **Example** (Defining opaque structs)
|
|
6406
6401
|
*
|
|
6407
|
-
* ```ts
|
|
6402
|
+
* ```ts import.meta.vitest
|
|
6408
6403
|
* import { Schema } from "effect"
|
|
6409
6404
|
*
|
|
6410
6405
|
* class Person extends Schema.Opaque<Person>()(
|
|
@@ -6415,7 +6410,7 @@ export interface Opaque<Self, S extends Top, Brand> extends
|
|
|
6415
6410
|
*
|
|
6416
6411
|
* // Decoded value is Person, not { name: string }
|
|
6417
6412
|
* const person = Schema.decodeUnknownSync(Person)({ name: "Alice" })
|
|
6418
|
-
* //
|
|
6413
|
+
* person.name // => "Alice"
|
|
6419
6414
|
* ```
|
|
6420
6415
|
*
|
|
6421
6416
|
* @category constructors
|
|
@@ -6443,13 +6438,13 @@ export interface instanceOf<T, Iso = T> extends declare<T, Iso> {
|
|
|
6443
6438
|
*
|
|
6444
6439
|
* **Example** (Defining a schema for a built-in class)
|
|
6445
6440
|
*
|
|
6446
|
-
* ```ts
|
|
6441
|
+
* ```ts import.meta.vitest
|
|
6447
6442
|
* import { Schema } from "effect"
|
|
6448
6443
|
*
|
|
6449
6444
|
* const DateSchema = Schema.instanceOf(Date)
|
|
6450
6445
|
*
|
|
6451
6446
|
* const decoded = Schema.decodeUnknownSync(DateSchema)(new Date("2024-01-01"))
|
|
6452
|
-
* //
|
|
6447
|
+
* decoded.toISOString() // => "2024-01-01T00:00:00.000Z"
|
|
6453
6448
|
* ```
|
|
6454
6449
|
*
|
|
6455
6450
|
* @category constructors
|
|
@@ -6501,8 +6496,8 @@ export function link<T>() {
|
|
|
6501
6496
|
*
|
|
6502
6497
|
* **Example** (Reporting failure at a nested path)
|
|
6503
6498
|
*
|
|
6504
|
-
* ```ts
|
|
6505
|
-
* import { Schema } from "effect"
|
|
6499
|
+
* ```ts import.meta.vitest
|
|
6500
|
+
* import { Result, Schema } from "effect"
|
|
6506
6501
|
*
|
|
6507
6502
|
* const schema = Schema.Struct({ password: Schema.String, confirmPassword: Schema.String }).check(
|
|
6508
6503
|
* Schema.makeFilter((o) =>
|
|
@@ -6512,15 +6507,16 @@ export function link<T>() {
|
|
|
6512
6507
|
* )
|
|
6513
6508
|
* )
|
|
6514
6509
|
*
|
|
6515
|
-
*
|
|
6516
|
-
*
|
|
6517
|
-
* //
|
|
6510
|
+
* const result = Schema.decodeUnknownResult(schema)({ password: "123456", confirmPassword: "1234567" })
|
|
6511
|
+
* if (Result.isFailure(result) && result.failure.issue._tag === "Filter" && result.failure.issue.issue._tag === "Pointer") {
|
|
6512
|
+
* result.failure.issue.issue.path // => ["password"]
|
|
6513
|
+
* }
|
|
6518
6514
|
* ```
|
|
6519
6515
|
*
|
|
6520
6516
|
* **Example** (Reporting multiple failures at once)
|
|
6521
6517
|
*
|
|
6522
|
-
* ```ts
|
|
6523
|
-
* import { Schema } from "effect"
|
|
6518
|
+
* ```ts import.meta.vitest
|
|
6519
|
+
* import { Result, Schema } from "effect"
|
|
6524
6520
|
*
|
|
6525
6521
|
* const schema = Schema.Struct({ a: Schema.Finite, b: Schema.Finite, c: Schema.Finite }).check(
|
|
6526
6522
|
* Schema.makeFilter((o) => {
|
|
@@ -6533,11 +6529,10 @@ export function link<T>() {
|
|
|
6533
6529
|
* })
|
|
6534
6530
|
* )
|
|
6535
6531
|
*
|
|
6536
|
-
*
|
|
6537
|
-
*
|
|
6538
|
-
* //
|
|
6539
|
-
*
|
|
6540
|
-
* // at ["c"])]))
|
|
6532
|
+
* const result = Schema.decodeUnknownResult(schema)({ a: 1, b: 0, c: 0 })
|
|
6533
|
+
* if (Result.isFailure(result) && result.failure.issue._tag === "Filter" && result.failure.issue.issue._tag === "Composite") {
|
|
6534
|
+
* result.failure.issue.issue.issues.map((issue) => issue._tag === "Pointer" ? issue.path : []) // => [["b"], ["c"]]
|
|
6535
|
+
* }
|
|
6541
6536
|
* ```
|
|
6542
6537
|
*
|
|
6543
6538
|
* @category constructors
|
|
@@ -6556,8 +6551,8 @@ export const makeFilter: <T>(
|
|
|
6556
6551
|
* **Details**
|
|
6557
6552
|
*
|
|
6558
6553
|
* - `string`: failure with that string as the message. Produces an
|
|
6559
|
-
* {@link SchemaIssue.InvalidValue}
|
|
6560
|
-
*
|
|
6554
|
+
* {@link SchemaIssue.InvalidValue} with the string used as the issue's
|
|
6555
|
+
* `message` annotation.
|
|
6561
6556
|
* - {@link SchemaIssue.Issue}: a fully-formed issue, returned as-is.
|
|
6562
6557
|
* - `{ path, issue }`: failure attached to a nested path. `issue` is either
|
|
6563
6558
|
* a `string` (wrapped in an {@link SchemaIssue.InvalidValue}) or a full
|
|
@@ -6583,8 +6578,8 @@ export type FilterIssue = string | SchemaIssue.Issue | {
|
|
|
6583
6578
|
* - `undefined`: success. The input satisfies the filter.
|
|
6584
6579
|
* - `true`: success. Equivalent to `undefined`, useful when the predicate is
|
|
6585
6580
|
* a plain boolean expression.
|
|
6586
|
-
* - `false`: generic failure. Produces an {@link SchemaIssue.InvalidValue}
|
|
6587
|
-
*
|
|
6581
|
+
* - `false`: generic failure. Produces an {@link SchemaIssue.InvalidValue}
|
|
6582
|
+
* with no custom message.
|
|
6588
6583
|
* - {@link FilterIssue}: a single failure. See {@link FilterIssue} for the
|
|
6589
6584
|
* shapes (`string`, {@link SchemaIssue.Issue}, or `{ path, issue }`).
|
|
6590
6585
|
* - `ReadonlyArray<FilterIssue>`: several failures reported together. An
|
|
@@ -6643,7 +6638,7 @@ const TRIMMED_PATTERN = "^\\S[\\s\\S]*\\S$|^\\S$|^$"
|
|
|
6643
6638
|
* When generating test data with fast-check, this applies a `patterns`
|
|
6644
6639
|
* constraint to ensure generated strings match the trimmed pattern.
|
|
6645
6640
|
*
|
|
6646
|
-
* @category
|
|
6641
|
+
* @category validation
|
|
6647
6642
|
* @since 4.0.0
|
|
6648
6643
|
*/
|
|
6649
6644
|
export function isTrimmed(annotations?: Annotations.Filter) {
|
|
@@ -6677,7 +6672,7 @@ export function isTrimmed(annotations?: Annotations.Filter) {
|
|
|
6677
6672
|
*
|
|
6678
6673
|
* @see {@link isTrimmed} for creating the corresponding check
|
|
6679
6674
|
*
|
|
6680
|
-
* @category
|
|
6675
|
+
* @category validation
|
|
6681
6676
|
* @since 4.0.0
|
|
6682
6677
|
*/
|
|
6683
6678
|
export const isTrimmedReviver: SchemaRepresentation.FilterReviver<null> = InternalSchema.makeFilterReviver(
|
|
@@ -6700,7 +6695,7 @@ export const isTrimmedReviver: SchemaRepresentation.FilterReviver<null> = Intern
|
|
|
6700
6695
|
* When generating test data with fast-check, this applies a `patterns`
|
|
6701
6696
|
* constraint to ensure generated strings match the specified RegExp pattern.
|
|
6702
6697
|
*
|
|
6703
|
-
* @category
|
|
6698
|
+
* @category validation
|
|
6704
6699
|
* @since 4.0.0
|
|
6705
6700
|
*/
|
|
6706
6701
|
export function isPattern(
|
|
@@ -6737,7 +6732,7 @@ const IsPatternPayload = Struct({
|
|
|
6737
6732
|
*
|
|
6738
6733
|
* @see {@link isPattern} for creating the corresponding check
|
|
6739
6734
|
*
|
|
6740
|
-
* @category
|
|
6735
|
+
* @category validation
|
|
6741
6736
|
* @since 4.0.0
|
|
6742
6737
|
*/
|
|
6743
6738
|
export const isPatternReviver: SchemaRepresentation.FilterReviver<{
|
|
@@ -6764,7 +6759,7 @@ export const isPatternReviver: SchemaRepresentation.FilterReviver<{
|
|
|
6764
6759
|
* When generating test data with fast-check, this applies a `patterns`
|
|
6765
6760
|
* constraint to ensure generated strings match the number string pattern.
|
|
6766
6761
|
*
|
|
6767
|
-
* @category
|
|
6762
|
+
* @category validation
|
|
6768
6763
|
* @since 4.0.0
|
|
6769
6764
|
*/
|
|
6770
6765
|
export function isStringFinite(annotations?: Annotations.Filter): SchemaAST.Filter<string> {
|
|
@@ -6783,7 +6778,7 @@ export function isStringFinite(annotations?: Annotations.Filter): SchemaAST.Filt
|
|
|
6783
6778
|
*
|
|
6784
6779
|
* @see {@link isStringFinite} for creating the corresponding check
|
|
6785
6780
|
*
|
|
6786
|
-
* @category
|
|
6781
|
+
* @category validation
|
|
6787
6782
|
* @since 4.0.0
|
|
6788
6783
|
*/
|
|
6789
6784
|
export const isStringFiniteReviver: SchemaRepresentation.FilterReviver<null> = InternalSchema.makeFilterReviver(
|
|
@@ -6806,7 +6801,7 @@ export const isStringFiniteReviver: SchemaRepresentation.FilterReviver<null> = I
|
|
|
6806
6801
|
* This check corresponds to a `pattern` constraint with the same signed
|
|
6807
6802
|
* base-10 integer pattern.
|
|
6808
6803
|
*
|
|
6809
|
-
* @category
|
|
6804
|
+
* @category validation
|
|
6810
6805
|
* @since 4.0.0
|
|
6811
6806
|
*/
|
|
6812
6807
|
export function isStringBigInt(annotations?: Annotations.Filter): SchemaAST.Filter<string> {
|
|
@@ -6825,7 +6820,7 @@ export function isStringBigInt(annotations?: Annotations.Filter): SchemaAST.Filt
|
|
|
6825
6820
|
*
|
|
6826
6821
|
* @see {@link isStringBigInt} for creating the corresponding check
|
|
6827
6822
|
*
|
|
6828
|
-
* @category
|
|
6823
|
+
* @category validation
|
|
6829
6824
|
* @since 4.0.0
|
|
6830
6825
|
*/
|
|
6831
6826
|
export const isStringBigIntReviver: SchemaRepresentation.FilterReviver<null> = InternalSchema.makeFilterReviver(
|
|
@@ -6843,7 +6838,7 @@ export const isStringBigIntReviver: SchemaRepresentation.FilterReviver<null> = I
|
|
|
6843
6838
|
* The check uses the pattern `^Symbol\((.*)\)$`. It is not a general test for
|
|
6844
6839
|
* whether a string can be passed to JavaScript's `Symbol()` function.
|
|
6845
6840
|
*
|
|
6846
|
-
* @category
|
|
6841
|
+
* @category validation
|
|
6847
6842
|
* @since 4.0.0
|
|
6848
6843
|
*/
|
|
6849
6844
|
export function isStringSymbol(annotations?: Annotations.Filter): SchemaAST.Filter<string> {
|
|
@@ -6862,7 +6857,7 @@ export function isStringSymbol(annotations?: Annotations.Filter): SchemaAST.Filt
|
|
|
6862
6857
|
*
|
|
6863
6858
|
* @see {@link isStringSymbol} for creating the corresponding check
|
|
6864
6859
|
*
|
|
6865
|
-
* @category
|
|
6860
|
+
* @category validation
|
|
6866
6861
|
* @since 4.0.0
|
|
6867
6862
|
*/
|
|
6868
6863
|
export const isStringSymbolReviver: SchemaRepresentation.FilterReviver<null> = InternalSchema.makeFilterReviver(
|
|
@@ -6912,7 +6907,7 @@ const getUUIDRegExp = (version?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8): globalThis.RegE
|
|
|
6912
6907
|
* constraint to ensure generated strings match the UUID pattern.
|
|
6913
6908
|
*
|
|
6914
6909
|
* @see {@link isGUID} for shape-only GUID validation.
|
|
6915
|
-
* @category
|
|
6910
|
+
* @category validation
|
|
6916
6911
|
* @since 4.0.0
|
|
6917
6912
|
*/
|
|
6918
6913
|
export function isUUID(version?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8, annotations?: Annotations.Filter) {
|
|
@@ -6941,7 +6936,7 @@ export function isUUID(version?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8, annotations?: An
|
|
|
6941
6936
|
*
|
|
6942
6937
|
* @see {@link isUUID} for creating the corresponding check
|
|
6943
6938
|
*
|
|
6944
|
-
* @category
|
|
6939
|
+
* @category validation
|
|
6945
6940
|
* @since 4.0.0
|
|
6946
6941
|
*/
|
|
6947
6942
|
export const isUUIDReviver: SchemaRepresentation.FilterReviver<{
|
|
@@ -6975,7 +6970,7 @@ const GUID_REGEXP = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{
|
|
|
6975
6970
|
* constraint to ensure generated strings match the GUID pattern.
|
|
6976
6971
|
*
|
|
6977
6972
|
* @see {@link isUUID} for strict UUID validation.
|
|
6978
|
-
* @category
|
|
6973
|
+
* @category validation
|
|
6979
6974
|
* @since 4.0.0
|
|
6980
6975
|
*/
|
|
6981
6976
|
export function isGUID(annotations?: Annotations.Filter) {
|
|
@@ -7003,7 +6998,7 @@ export function isGUID(annotations?: Annotations.Filter) {
|
|
|
7003
6998
|
*
|
|
7004
6999
|
* @see {@link isGUID} for creating the corresponding check
|
|
7005
7000
|
*
|
|
7006
|
-
* @category
|
|
7001
|
+
* @category validation
|
|
7007
7002
|
* @since 4.0.0
|
|
7008
7003
|
*/
|
|
7009
7004
|
export const isGUIDReviver: SchemaRepresentation.FilterReviver<null> = InternalSchema.makeFilterReviver(
|
|
@@ -7028,7 +7023,7 @@ export const isGUIDReviver: SchemaRepresentation.FilterReviver<null> = InternalS
|
|
|
7028
7023
|
* When generating test data with fast-check, this applies a `patterns`
|
|
7029
7024
|
* constraint to ensure generated strings match the ULID pattern.
|
|
7030
7025
|
*
|
|
7031
|
-
* @category
|
|
7026
|
+
* @category validation
|
|
7032
7027
|
* @since 4.0.0
|
|
7033
7028
|
*/
|
|
7034
7029
|
export function isULID(annotations?: Annotations.Filter) {
|
|
@@ -7056,7 +7051,7 @@ export function isULID(annotations?: Annotations.Filter) {
|
|
|
7056
7051
|
*
|
|
7057
7052
|
* @see {@link isULID} for creating the corresponding check
|
|
7058
7053
|
*
|
|
7059
|
-
* @category
|
|
7054
|
+
* @category validation
|
|
7060
7055
|
* @since 4.0.0
|
|
7061
7056
|
*/
|
|
7062
7057
|
export const isULIDReviver: SchemaRepresentation.FilterReviver<null> = InternalSchema.makeFilterReviver(
|
|
@@ -7080,7 +7075,7 @@ export const isULIDReviver: SchemaRepresentation.FilterReviver<null> = InternalS
|
|
|
7080
7075
|
* When generating test data with fast-check, this applies a `patterns`
|
|
7081
7076
|
* constraint to ensure generated strings match the Base64 pattern.
|
|
7082
7077
|
*
|
|
7083
|
-
* @category
|
|
7078
|
+
* @category validation
|
|
7084
7079
|
* @since 4.0.0
|
|
7085
7080
|
*/
|
|
7086
7081
|
export function isBase64(annotations?: Annotations.Filter) {
|
|
@@ -7109,7 +7104,7 @@ export function isBase64(annotations?: Annotations.Filter) {
|
|
|
7109
7104
|
*
|
|
7110
7105
|
* @see {@link isBase64} for creating the corresponding check
|
|
7111
7106
|
*
|
|
7112
|
-
* @category
|
|
7107
|
+
* @category validation
|
|
7113
7108
|
* @since 4.0.0
|
|
7114
7109
|
*/
|
|
7115
7110
|
export const isBase64Reviver: SchemaRepresentation.FilterReviver<null> = InternalSchema.makeFilterReviver(
|
|
@@ -7134,7 +7129,7 @@ export const isBase64Reviver: SchemaRepresentation.FilterReviver<null> = Interna
|
|
|
7134
7129
|
* When generating test data with fast-check, this applies a `patterns`
|
|
7135
7130
|
* constraint to ensure generated strings match the Base64URL pattern.
|
|
7136
7131
|
*
|
|
7137
|
-
* @category
|
|
7132
|
+
* @category validation
|
|
7138
7133
|
* @since 4.0.0
|
|
7139
7134
|
*/
|
|
7140
7135
|
export function isBase64Url(annotations?: Annotations.Filter) {
|
|
@@ -7163,7 +7158,7 @@ export function isBase64Url(annotations?: Annotations.Filter) {
|
|
|
7163
7158
|
*
|
|
7164
7159
|
* @see {@link isBase64Url} for creating the corresponding check
|
|
7165
7160
|
*
|
|
7166
|
-
* @category
|
|
7161
|
+
* @category validation
|
|
7167
7162
|
* @since 4.0.0
|
|
7168
7163
|
*/
|
|
7169
7164
|
export const isBase64UrlReviver: SchemaRepresentation.FilterReviver<null> = InternalSchema.makeFilterReviver(
|
|
@@ -7180,7 +7175,7 @@ export const isBase64UrlReviver: SchemaRepresentation.FilterReviver<null> = Inte
|
|
|
7180
7175
|
* RegExp metacharacters in the prefix are escaped in JSON Schema and arbitrary
|
|
7181
7176
|
* metadata so that the generated patterns retain literal `startsWith` semantics.
|
|
7182
7177
|
*
|
|
7183
|
-
* @category
|
|
7178
|
+
* @category validation
|
|
7184
7179
|
* @since 4.0.0
|
|
7185
7180
|
*/
|
|
7186
7181
|
export function isStartsWith(startsWith: string, annotations?: Annotations.Filter) {
|
|
@@ -7215,7 +7210,7 @@ export function isStartsWith(startsWith: string, annotations?: Annotations.Filte
|
|
|
7215
7210
|
*
|
|
7216
7211
|
* @see {@link isStartsWith} for creating the corresponding check
|
|
7217
7212
|
*
|
|
7218
|
-
* @category
|
|
7213
|
+
* @category validation
|
|
7219
7214
|
* @since 4.0.0
|
|
7220
7215
|
*/
|
|
7221
7216
|
export const isStartsWithReviver: SchemaRepresentation.FilterReviver<{
|
|
@@ -7234,7 +7229,7 @@ export const isStartsWithReviver: SchemaRepresentation.FilterReviver<{
|
|
|
7234
7229
|
* RegExp metacharacters in the suffix are escaped in JSON Schema and arbitrary
|
|
7235
7230
|
* metadata so that the generated patterns retain literal `endsWith` semantics.
|
|
7236
7231
|
*
|
|
7237
|
-
* @category
|
|
7232
|
+
* @category validation
|
|
7238
7233
|
* @since 4.0.0
|
|
7239
7234
|
*/
|
|
7240
7235
|
export function isEndsWith(endsWith: string, annotations?: Annotations.Filter) {
|
|
@@ -7269,7 +7264,7 @@ export function isEndsWith(endsWith: string, annotations?: Annotations.Filter) {
|
|
|
7269
7264
|
*
|
|
7270
7265
|
* @see {@link isEndsWith} for creating the corresponding check
|
|
7271
7266
|
*
|
|
7272
|
-
* @category
|
|
7267
|
+
* @category validation
|
|
7273
7268
|
* @since 4.0.0
|
|
7274
7269
|
*/
|
|
7275
7270
|
export const isEndsWithReviver: SchemaRepresentation.FilterReviver<{
|
|
@@ -7289,7 +7284,7 @@ export const isEndsWithReviver: SchemaRepresentation.FilterReviver<{
|
|
|
7289
7284
|
* arbitrary metadata so that the generated patterns retain literal `includes`
|
|
7290
7285
|
* semantics.
|
|
7291
7286
|
*
|
|
7292
|
-
* @category
|
|
7287
|
+
* @category validation
|
|
7293
7288
|
* @since 4.0.0
|
|
7294
7289
|
*/
|
|
7295
7290
|
export function isIncludes(includes: string, annotations?: Annotations.Filter) {
|
|
@@ -7324,7 +7319,7 @@ export function isIncludes(includes: string, annotations?: Annotations.Filter) {
|
|
|
7324
7319
|
*
|
|
7325
7320
|
* @see {@link isIncludes} for creating the corresponding check
|
|
7326
7321
|
*
|
|
7327
|
-
* @category
|
|
7322
|
+
* @category validation
|
|
7328
7323
|
* @since 4.0.0
|
|
7329
7324
|
*/
|
|
7330
7325
|
export const isIncludesReviver: SchemaRepresentation.FilterReviver<{
|
|
@@ -7346,7 +7341,7 @@ const UPPERCASED_PATTERN = "^[^a-z]*$"
|
|
|
7346
7341
|
* such as digits, punctuation, and whitespace. It rejects strings that would
|
|
7347
7342
|
* change when uppercased.
|
|
7348
7343
|
*
|
|
7349
|
-
* @category
|
|
7344
|
+
* @category validation
|
|
7350
7345
|
* @since 4.0.0
|
|
7351
7346
|
*/
|
|
7352
7347
|
export function isUppercased(annotations?: Annotations.Filter) {
|
|
@@ -7380,7 +7375,7 @@ export function isUppercased(annotations?: Annotations.Filter) {
|
|
|
7380
7375
|
*
|
|
7381
7376
|
* @see {@link isUppercased} for creating the corresponding check
|
|
7382
7377
|
*
|
|
7383
|
-
* @category
|
|
7378
|
+
* @category validation
|
|
7384
7379
|
* @since 4.0.0
|
|
7385
7380
|
*/
|
|
7386
7381
|
export const isUppercasedReviver: SchemaRepresentation.FilterReviver<null> = InternalSchema.makeFilterReviver(
|
|
@@ -7400,7 +7395,7 @@ const LOWERCASED_PATTERN = "^[^A-Z]*$"
|
|
|
7400
7395
|
* such as digits, punctuation, and whitespace. It rejects strings that would
|
|
7401
7396
|
* change when lowercased.
|
|
7402
7397
|
*
|
|
7403
|
-
* @category
|
|
7398
|
+
* @category validation
|
|
7404
7399
|
* @since 4.0.0
|
|
7405
7400
|
*/
|
|
7406
7401
|
export function isLowercased(annotations?: Annotations.Filter) {
|
|
@@ -7434,7 +7429,7 @@ export function isLowercased(annotations?: Annotations.Filter) {
|
|
|
7434
7429
|
*
|
|
7435
7430
|
* @see {@link isLowercased} for creating the corresponding check
|
|
7436
7431
|
*
|
|
7437
|
-
* @category
|
|
7432
|
+
* @category validation
|
|
7438
7433
|
* @since 4.0.0
|
|
7439
7434
|
*/
|
|
7440
7435
|
export const isLowercasedReviver: SchemaRepresentation.FilterReviver<null> = InternalSchema.makeFilterReviver(
|
|
@@ -7454,7 +7449,7 @@ const CAPITALIZED_PATTERN = "^[^a-z]?.*$"
|
|
|
7454
7449
|
* Empty strings pass. Strings whose first character has no lowercase form, such
|
|
7455
7450
|
* as a digit, punctuation mark, or whitespace, also pass.
|
|
7456
7451
|
*
|
|
7457
|
-
* @category
|
|
7452
|
+
* @category validation
|
|
7458
7453
|
* @since 4.0.0
|
|
7459
7454
|
*/
|
|
7460
7455
|
export function isCapitalized(annotations?: Annotations.Filter) {
|
|
@@ -7488,7 +7483,7 @@ export function isCapitalized(annotations?: Annotations.Filter) {
|
|
|
7488
7483
|
*
|
|
7489
7484
|
* @see {@link isCapitalized} for creating the corresponding check
|
|
7490
7485
|
*
|
|
7491
|
-
* @category
|
|
7486
|
+
* @category validation
|
|
7492
7487
|
* @since 4.0.0
|
|
7493
7488
|
*/
|
|
7494
7489
|
export const isCapitalizedReviver: SchemaRepresentation.FilterReviver<null> = InternalSchema.makeFilterReviver(
|
|
@@ -7508,7 +7503,7 @@ const UNCAPITALIZED_PATTERN = "^[^A-Z]?.*$"
|
|
|
7508
7503
|
* Empty strings pass. Strings whose first character has no uppercase form, such
|
|
7509
7504
|
* as a digit, punctuation mark, or whitespace, also pass.
|
|
7510
7505
|
*
|
|
7511
|
-
* @category
|
|
7506
|
+
* @category validation
|
|
7512
7507
|
* @since 4.0.0
|
|
7513
7508
|
*/
|
|
7514
7509
|
export function isUncapitalized(annotations?: Annotations.Filter) {
|
|
@@ -7542,7 +7537,7 @@ export function isUncapitalized(annotations?: Annotations.Filter) {
|
|
|
7542
7537
|
*
|
|
7543
7538
|
* @see {@link isUncapitalized} for creating the corresponding check
|
|
7544
7539
|
*
|
|
7545
|
-
* @category
|
|
7540
|
+
* @category validation
|
|
7546
7541
|
* @since 4.0.0
|
|
7547
7542
|
*/
|
|
7548
7543
|
export const isUncapitalizedReviver: SchemaRepresentation.FilterReviver<null> = InternalSchema.makeFilterReviver(
|
|
@@ -7554,7 +7549,7 @@ export const isUncapitalizedReviver: SchemaRepresentation.FilterReviver<null> =
|
|
|
7554
7549
|
/**
|
|
7555
7550
|
* Type-level representation of {@link Finite}.
|
|
7556
7551
|
*
|
|
7557
|
-
* @category
|
|
7552
|
+
* @category models
|
|
7558
7553
|
* @since 3.10.0
|
|
7559
7554
|
*/
|
|
7560
7555
|
export interface Finite extends Number {
|
|
@@ -7564,7 +7559,7 @@ export interface Finite extends Number {
|
|
|
7564
7559
|
/**
|
|
7565
7560
|
* Schema for finite numbers, rejecting `NaN`, `Infinity`, and `-Infinity`.
|
|
7566
7561
|
*
|
|
7567
|
-
* @category
|
|
7562
|
+
* @category schemas
|
|
7568
7563
|
* @since 3.10.0
|
|
7569
7564
|
*/
|
|
7570
7565
|
export const Finite: Finite = make(SchemaAST.finite)
|
|
@@ -7584,7 +7579,7 @@ export const Finite: Finite = make(SchemaAST.finite)
|
|
|
7584
7579
|
* When generating test data with fast-check, this applies `noNaN: true` and
|
|
7585
7580
|
* `noInfinity: true` constraints to ensure generated numbers are finite.
|
|
7586
7581
|
*
|
|
7587
|
-
* @category
|
|
7582
|
+
* @category validation
|
|
7588
7583
|
* @since 4.0.0
|
|
7589
7584
|
*/
|
|
7590
7585
|
export const isFinite: (annotations?: Annotations.Filter) => SchemaAST.Filter<number> = SchemaAST.isFinite
|
|
@@ -7598,7 +7593,7 @@ export const isFinite: (annotations?: Annotations.Filter) => SchemaAST.Filter<nu
|
|
|
7598
7593
|
*
|
|
7599
7594
|
* @see {@link isFinite} for creating the corresponding check
|
|
7600
7595
|
*
|
|
7601
|
-
* @category
|
|
7596
|
+
* @category validation
|
|
7602
7597
|
* @since 4.0.0
|
|
7603
7598
|
*/
|
|
7604
7599
|
export const isFiniteReviver: SchemaRepresentation.FilterReviver<null> = InternalSchema.makeFilterReviver(
|
|
@@ -7611,7 +7606,7 @@ export const isFiniteReviver: SchemaRepresentation.FilterReviver<null> = Interna
|
|
|
7611
7606
|
* Creates a greater-than (`>`) check for any ordered type from an
|
|
7612
7607
|
* `Order.Order` instance.
|
|
7613
7608
|
*
|
|
7614
|
-
* @category
|
|
7609
|
+
* @category validation
|
|
7615
7610
|
* @since 4.0.0
|
|
7616
7611
|
*/
|
|
7617
7612
|
export function makeIsGreaterThan<T>(options: {
|
|
@@ -7646,7 +7641,7 @@ export function makeIsGreaterThan<T>(options: {
|
|
|
7646
7641
|
* Creates a greater-than-or-equal-to (`>=`) check for any ordered type from an
|
|
7647
7642
|
* `Order.Order` instance.
|
|
7648
7643
|
*
|
|
7649
|
-
* @category
|
|
7644
|
+
* @category validation
|
|
7650
7645
|
* @since 4.0.0
|
|
7651
7646
|
*/
|
|
7652
7647
|
export function makeIsGreaterThanOrEqualTo<T>(options: {
|
|
@@ -7680,7 +7675,7 @@ export function makeIsGreaterThanOrEqualTo<T>(options: {
|
|
|
7680
7675
|
* Creates a less-than (`<`) check for any ordered type from an `Order.Order`
|
|
7681
7676
|
* instance.
|
|
7682
7677
|
*
|
|
7683
|
-
* @category
|
|
7678
|
+
* @category validation
|
|
7684
7679
|
* @since 4.0.0
|
|
7685
7680
|
*/
|
|
7686
7681
|
export function makeIsLessThan<T>(options: {
|
|
@@ -7715,7 +7710,7 @@ export function makeIsLessThan<T>(options: {
|
|
|
7715
7710
|
* Creates a less-than-or-equal-to (`<=`) check for any ordered type from an
|
|
7716
7711
|
* `Order.Order` instance.
|
|
7717
7712
|
*
|
|
7718
|
-
* @category
|
|
7713
|
+
* @category validation
|
|
7719
7714
|
* @since 4.0.0
|
|
7720
7715
|
*/
|
|
7721
7716
|
export function makeIsLessThanOrEqualTo<T>(options: {
|
|
@@ -7749,7 +7744,7 @@ export function makeIsLessThanOrEqualTo<T>(options: {
|
|
|
7749
7744
|
* Creates an inclusive or exclusive range check for any ordered type from an
|
|
7750
7745
|
* `Order.Order` instance.
|
|
7751
7746
|
*
|
|
7752
|
-
* @category
|
|
7747
|
+
* @category validation
|
|
7753
7748
|
* @since 4.0.0
|
|
7754
7749
|
*/
|
|
7755
7750
|
export function makeIsBetween<T>(deriveOptions: {
|
|
@@ -7805,7 +7800,7 @@ export function makeIsBetween<T>(deriveOptions: {
|
|
|
7805
7800
|
* Creates a divisibility check for any numeric type from a remainder function
|
|
7806
7801
|
* and a zero value.
|
|
7807
7802
|
*
|
|
7808
|
-
* @category
|
|
7803
|
+
* @category validation
|
|
7809
7804
|
* @since 4.0.0
|
|
7810
7805
|
*/
|
|
7811
7806
|
export function makeIsMultipleOf<T>(options: {
|
|
@@ -7849,7 +7844,7 @@ function encodeNumberPayload(number: number): number {
|
|
|
7849
7844
|
* `exclusiveMinimum` constraint to ensure generated numbers are greater than
|
|
7850
7845
|
* the specified value.
|
|
7851
7846
|
*
|
|
7852
|
-
* @category
|
|
7847
|
+
* @category validation
|
|
7853
7848
|
* @since 4.0.0
|
|
7854
7849
|
*/
|
|
7855
7850
|
export const isGreaterThan = makeIsGreaterThan({
|
|
@@ -7873,7 +7868,7 @@ export const isGreaterThan = makeIsGreaterThan({
|
|
|
7873
7868
|
*
|
|
7874
7869
|
* @see {@link isGreaterThan} for creating the corresponding check
|
|
7875
7870
|
*
|
|
7876
|
-
* @category
|
|
7871
|
+
* @category validation
|
|
7877
7872
|
* @since 4.0.0
|
|
7878
7873
|
*/
|
|
7879
7874
|
export const isGreaterThanReviver: SchemaRepresentation.FilterReviver<{
|
|
@@ -7899,7 +7894,7 @@ export const isGreaterThanReviver: SchemaRepresentation.FilterReviver<{
|
|
|
7899
7894
|
* When generating test data with fast-check, this applies a `minimum` constraint
|
|
7900
7895
|
* to ensure generated numbers are greater than or equal to the specified value.
|
|
7901
7896
|
*
|
|
7902
|
-
* @category
|
|
7897
|
+
* @category validation
|
|
7903
7898
|
* @since 4.0.0
|
|
7904
7899
|
*/
|
|
7905
7900
|
export const isGreaterThanOrEqualTo = makeIsGreaterThanOrEqualTo({
|
|
@@ -7923,7 +7918,7 @@ export const isGreaterThanOrEqualTo = makeIsGreaterThanOrEqualTo({
|
|
|
7923
7918
|
*
|
|
7924
7919
|
* @see {@link isGreaterThanOrEqualTo} for creating the corresponding check
|
|
7925
7920
|
*
|
|
7926
|
-
* @category
|
|
7921
|
+
* @category validation
|
|
7927
7922
|
* @since 4.0.0
|
|
7928
7923
|
*/
|
|
7929
7924
|
export const isGreaterThanOrEqualToReviver: SchemaRepresentation.FilterReviver<{
|
|
@@ -7949,7 +7944,7 @@ export const isGreaterThanOrEqualToReviver: SchemaRepresentation.FilterReviver<{
|
|
|
7949
7944
|
* `exclusiveMaximum` constraint to ensure generated numbers are less than the
|
|
7950
7945
|
* specified value.
|
|
7951
7946
|
*
|
|
7952
|
-
* @category
|
|
7947
|
+
* @category validation
|
|
7953
7948
|
* @since 4.0.0
|
|
7954
7949
|
*/
|
|
7955
7950
|
export const isLessThan = makeIsLessThan({
|
|
@@ -7973,7 +7968,7 @@ export const isLessThan = makeIsLessThan({
|
|
|
7973
7968
|
*
|
|
7974
7969
|
* @see {@link isLessThan} for creating the corresponding check
|
|
7975
7970
|
*
|
|
7976
|
-
* @category
|
|
7971
|
+
* @category validation
|
|
7977
7972
|
* @since 4.0.0
|
|
7978
7973
|
*/
|
|
7979
7974
|
export const isLessThanReviver: SchemaRepresentation.FilterReviver<{
|
|
@@ -7999,7 +7994,7 @@ export const isLessThanReviver: SchemaRepresentation.FilterReviver<{
|
|
|
7999
7994
|
* When generating test data with fast-check, this applies a `maximum` constraint
|
|
8000
7995
|
* to ensure generated numbers are less than or equal to the specified value.
|
|
8001
7996
|
*
|
|
8002
|
-
* @category
|
|
7997
|
+
* @category validation
|
|
8003
7998
|
* @since 4.0.0
|
|
8004
7999
|
*/
|
|
8005
8000
|
export const isLessThanOrEqualTo = makeIsLessThanOrEqualTo({
|
|
@@ -8023,7 +8018,7 @@ export const isLessThanOrEqualTo = makeIsLessThanOrEqualTo({
|
|
|
8023
8018
|
*
|
|
8024
8019
|
* @see {@link isLessThanOrEqualTo} for creating the corresponding check
|
|
8025
8020
|
*
|
|
8026
|
-
* @category
|
|
8021
|
+
* @category validation
|
|
8027
8022
|
* @since 4.0.0
|
|
8028
8023
|
*/
|
|
8029
8024
|
export const isLessThanOrEqualToReviver: SchemaRepresentation.FilterReviver<{
|
|
@@ -8052,7 +8047,7 @@ export const isLessThanOrEqualToReviver: SchemaRepresentation.FilterReviver<{
|
|
|
8052
8047
|
* `exclusiveMaximum` flags to ensure generated numbers fall within the
|
|
8053
8048
|
* specified range.
|
|
8054
8049
|
*
|
|
8055
|
-
* @category
|
|
8050
|
+
* @category validation
|
|
8056
8051
|
* @since 4.0.0
|
|
8057
8052
|
*/
|
|
8058
8053
|
export const isBetween = makeIsBetween({
|
|
@@ -8093,7 +8088,7 @@ export const isBetween = makeIsBetween({
|
|
|
8093
8088
|
*
|
|
8094
8089
|
* @see {@link isBetween} for creating the corresponding check
|
|
8095
8090
|
*
|
|
8096
|
-
* @category
|
|
8091
|
+
* @category validation
|
|
8097
8092
|
* @since 4.0.0
|
|
8098
8093
|
*/
|
|
8099
8094
|
export const isBetweenReviver: SchemaRepresentation.FilterReviver<{
|
|
@@ -8126,7 +8121,7 @@ export const isBetweenReviver: SchemaRepresentation.FilterReviver<{
|
|
|
8126
8121
|
* When generating test data with fast-check, this applies constraints to ensure
|
|
8127
8122
|
* generated numbers are multiples of the specified divisor.
|
|
8128
8123
|
*
|
|
8129
|
-
* @category
|
|
8124
|
+
* @category validation
|
|
8130
8125
|
* @since 4.0.0
|
|
8131
8126
|
*/
|
|
8132
8127
|
export const isMultipleOf = makeIsMultipleOf({
|
|
@@ -8152,7 +8147,7 @@ export const isMultipleOf = makeIsMultipleOf({
|
|
|
8152
8147
|
*
|
|
8153
8148
|
* @see {@link isMultipleOf} for creating the corresponding check
|
|
8154
8149
|
*
|
|
8155
|
-
* @category
|
|
8150
|
+
* @category validation
|
|
8156
8151
|
* @since 4.0.0
|
|
8157
8152
|
*/
|
|
8158
8153
|
export const isMultipleOfReviver: SchemaRepresentation.FilterReviver<{
|
|
@@ -8178,7 +8173,7 @@ export const isMultipleOfReviver: SchemaRepresentation.FilterReviver<{
|
|
|
8178
8173
|
* When generating test data with fast-check, this applies an `integer: true`
|
|
8179
8174
|
* constraint to ensure generated numbers are integers.
|
|
8180
8175
|
*
|
|
8181
|
-
* @category
|
|
8176
|
+
* @category validation
|
|
8182
8177
|
* @since 4.0.0
|
|
8183
8178
|
*/
|
|
8184
8179
|
export function isInt(annotations?: Annotations.Filter) {
|
|
@@ -8211,7 +8206,7 @@ export function isInt(annotations?: Annotations.Filter) {
|
|
|
8211
8206
|
*
|
|
8212
8207
|
* @see {@link isInt} for creating the corresponding check
|
|
8213
8208
|
*
|
|
8214
|
-
* @category
|
|
8209
|
+
* @category validation
|
|
8215
8210
|
* @since 4.0.0
|
|
8216
8211
|
*/
|
|
8217
8212
|
export const isIntReviver: SchemaRepresentation.FilterReviver<null> = InternalSchema.makeFilterReviver(
|
|
@@ -8223,7 +8218,7 @@ export const isIntReviver: SchemaRepresentation.FilterReviver<null> = InternalSc
|
|
|
8223
8218
|
/**
|
|
8224
8219
|
* Type-level representation of {@link Int}.
|
|
8225
8220
|
*
|
|
8226
|
-
* @category
|
|
8221
|
+
* @category models
|
|
8227
8222
|
* @since 3.10.0
|
|
8228
8223
|
*/
|
|
8229
8224
|
export interface Int extends Number {
|
|
@@ -8233,7 +8228,7 @@ export interface Int extends Number {
|
|
|
8233
8228
|
/**
|
|
8234
8229
|
* Schema for integers, rejecting `NaN`, `Infinity`, and `-Infinity`.
|
|
8235
8230
|
*
|
|
8236
|
-
* @category
|
|
8231
|
+
* @category schemas
|
|
8237
8232
|
* @since 3.10.0
|
|
8238
8233
|
*/
|
|
8239
8234
|
export const Int: Int = Number.check(isInt())
|
|
@@ -8241,7 +8236,7 @@ export const Int: Int = Number.check(isInt())
|
|
|
8241
8236
|
/**
|
|
8242
8237
|
* Type-level representation of {@link Natural}.
|
|
8243
8238
|
*
|
|
8244
|
-
* @category
|
|
8239
|
+
* @category models
|
|
8245
8240
|
* @since 4.0.0
|
|
8246
8241
|
*/
|
|
8247
8242
|
export interface Natural extends Int {
|
|
@@ -8257,7 +8252,7 @@ export interface Natural extends Int {
|
|
|
8257
8252
|
*
|
|
8258
8253
|
* @see {@link Int} for safe integers that may be negative
|
|
8259
8254
|
*
|
|
8260
|
-
* @category
|
|
8255
|
+
* @category schemas
|
|
8261
8256
|
* @since 4.0.0
|
|
8262
8257
|
*/
|
|
8263
8258
|
export const Natural: Natural = Int.check(isGreaterThanOrEqualTo(0))
|
|
@@ -8278,7 +8273,7 @@ export const Natural: Natural = Int.check(isGreaterThanOrEqualTo(0))
|
|
|
8278
8273
|
* When generating test data with fast-check, this applies integer and range
|
|
8279
8274
|
* constraints to ensure generated numbers are 32-bit signed integers.
|
|
8280
8275
|
*
|
|
8281
|
-
* @category
|
|
8276
|
+
* @category validation
|
|
8282
8277
|
* @since 4.0.0
|
|
8283
8278
|
*/
|
|
8284
8279
|
export function isInt32(annotations?: Annotations.Filter) {
|
|
@@ -8310,7 +8305,7 @@ export function isInt32(annotations?: Annotations.Filter) {
|
|
|
8310
8305
|
* When generating test data with fast-check, this applies integer and range
|
|
8311
8306
|
* constraints to ensure generated numbers are 32-bit unsigned integers.
|
|
8312
8307
|
*
|
|
8313
|
-
* @category
|
|
8308
|
+
* @category validation
|
|
8314
8309
|
* @since 4.0.0
|
|
8315
8310
|
*/
|
|
8316
8311
|
export function isUint32(annotations?: Annotations.Filter) {
|
|
@@ -8348,7 +8343,7 @@ function formatDateRuntime(date: globalThis.Date): string {
|
|
|
8348
8343
|
* one millisecond after the specified value to ensure generated Date objects are
|
|
8349
8344
|
* greater than it.
|
|
8350
8345
|
*
|
|
8351
|
-
* @category
|
|
8346
|
+
* @category validation
|
|
8352
8347
|
* @since 4.0.0
|
|
8353
8348
|
*/
|
|
8354
8349
|
export const isGreaterThanDate = makeIsGreaterThan({
|
|
@@ -8383,7 +8378,7 @@ export const isGreaterThanDate = makeIsGreaterThan({
|
|
|
8383
8378
|
* to ensure generated Date objects are greater than or equal to the specified
|
|
8384
8379
|
* date.
|
|
8385
8380
|
*
|
|
8386
|
-
* @category
|
|
8381
|
+
* @category validation
|
|
8387
8382
|
* @since 4.0.0
|
|
8388
8383
|
*/
|
|
8389
8384
|
export const isGreaterThanOrEqualToDate = makeIsGreaterThanOrEqualTo({
|
|
@@ -8412,7 +8407,7 @@ export const isGreaterThanOrEqualToDate = makeIsGreaterThanOrEqualTo({
|
|
|
8412
8407
|
* one millisecond before the specified value to ensure generated Date objects
|
|
8413
8408
|
* are less than it.
|
|
8414
8409
|
*
|
|
8415
|
-
* @category
|
|
8410
|
+
* @category validation
|
|
8416
8411
|
* @since 4.0.0
|
|
8417
8412
|
*/
|
|
8418
8413
|
export const isLessThanDate = makeIsLessThan({
|
|
@@ -8447,7 +8442,7 @@ export const isLessThanDate = makeIsLessThan({
|
|
|
8447
8442
|
* to ensure generated Date objects are less than or equal to the specified
|
|
8448
8443
|
* date.
|
|
8449
8444
|
*
|
|
8450
|
-
* @category
|
|
8445
|
+
* @category validation
|
|
8451
8446
|
* @since 4.0.0
|
|
8452
8447
|
*/
|
|
8453
8448
|
export const isLessThanOrEqualToDate = makeIsLessThanOrEqualTo({
|
|
@@ -8482,7 +8477,7 @@ export const isLessThanOrEqualToDate = makeIsLessThanOrEqualTo({
|
|
|
8482
8477
|
* constraints to ensure generated Date objects fall within the specified range,
|
|
8483
8478
|
* shifting exclusive bounds by one millisecond.
|
|
8484
8479
|
*
|
|
8485
|
-
* @category
|
|
8480
|
+
* @category validation
|
|
8486
8481
|
* @since 4.0.0
|
|
8487
8482
|
*/
|
|
8488
8483
|
export const isBetweenDate = makeIsBetween({
|
|
@@ -8522,7 +8517,7 @@ export const isBetweenDate = makeIsBetween({
|
|
|
8522
8517
|
* `exclusiveMinimum + 1n` to ensure generated BigInts are greater than the
|
|
8523
8518
|
* specified value.
|
|
8524
8519
|
*
|
|
8525
|
-
* @category
|
|
8520
|
+
* @category validation
|
|
8526
8521
|
* @since 4.0.0
|
|
8527
8522
|
*/
|
|
8528
8523
|
export const isGreaterThanBigInt = makeIsGreaterThan({
|
|
@@ -8552,7 +8547,7 @@ export const isGreaterThanBigInt = makeIsGreaterThan({
|
|
|
8552
8547
|
* to ensure generated BigInt values are greater than or equal to the specified
|
|
8553
8548
|
* value.
|
|
8554
8549
|
*
|
|
8555
|
-
* @category
|
|
8550
|
+
* @category validation
|
|
8556
8551
|
* @since 4.0.0
|
|
8557
8552
|
*/
|
|
8558
8553
|
export const isGreaterThanOrEqualToBigInt = makeIsGreaterThanOrEqualTo({
|
|
@@ -8581,7 +8576,7 @@ export const isGreaterThanOrEqualToBigInt = makeIsGreaterThanOrEqualTo({
|
|
|
8581
8576
|
* `exclusiveMaximum - 1n` to ensure generated BigInts are less than the
|
|
8582
8577
|
* specified value.
|
|
8583
8578
|
*
|
|
8584
|
-
* @category
|
|
8579
|
+
* @category validation
|
|
8585
8580
|
* @since 4.0.0
|
|
8586
8581
|
*/
|
|
8587
8582
|
export const isLessThanBigInt = makeIsLessThan({
|
|
@@ -8611,7 +8606,7 @@ export const isLessThanBigInt = makeIsLessThan({
|
|
|
8611
8606
|
* to ensure generated BigInt values are less than or equal to the specified
|
|
8612
8607
|
* value.
|
|
8613
8608
|
*
|
|
8614
|
-
* @category
|
|
8609
|
+
* @category validation
|
|
8615
8610
|
* @since 4.0.0
|
|
8616
8611
|
*/
|
|
8617
8612
|
export const isLessThanOrEqualToBigInt = makeIsLessThanOrEqualTo({
|
|
@@ -8641,7 +8636,7 @@ export const isLessThanOrEqualToBigInt = makeIsLessThanOrEqualTo({
|
|
|
8641
8636
|
* constraints to ensure generated BigInt values fall within the specified
|
|
8642
8637
|
* range.
|
|
8643
8638
|
*
|
|
8644
|
-
* @category
|
|
8639
|
+
* @category validation
|
|
8645
8640
|
* @since 4.0.0
|
|
8646
8641
|
*/
|
|
8647
8642
|
export const isBetweenBigInt = makeIsBetween({
|
|
@@ -8673,7 +8668,7 @@ export const isBetweenBigInt = makeIsBetween({
|
|
|
8673
8668
|
/**
|
|
8674
8669
|
* Validates that a BigDecimal is greater than the specified value (exclusive).
|
|
8675
8670
|
*
|
|
8676
|
-
* @category
|
|
8671
|
+
* @category validation
|
|
8677
8672
|
* @since 4.0.0
|
|
8678
8673
|
*/
|
|
8679
8674
|
export const isGreaterThanBigDecimal = makeIsGreaterThan({
|
|
@@ -8685,7 +8680,7 @@ export const isGreaterThanBigDecimal = makeIsGreaterThan({
|
|
|
8685
8680
|
* Validates that a BigDecimal is greater than or equal to the specified value
|
|
8686
8681
|
* (inclusive).
|
|
8687
8682
|
*
|
|
8688
|
-
* @category
|
|
8683
|
+
* @category validation
|
|
8689
8684
|
* @since 4.0.0
|
|
8690
8685
|
*/
|
|
8691
8686
|
export const isGreaterThanOrEqualToBigDecimal = makeIsGreaterThanOrEqualTo({
|
|
@@ -8696,7 +8691,7 @@ export const isGreaterThanOrEqualToBigDecimal = makeIsGreaterThanOrEqualTo({
|
|
|
8696
8691
|
/**
|
|
8697
8692
|
* Validates that a BigDecimal is less than the specified value (exclusive).
|
|
8698
8693
|
*
|
|
8699
|
-
* @category
|
|
8694
|
+
* @category validation
|
|
8700
8695
|
* @since 4.0.0
|
|
8701
8696
|
*/
|
|
8702
8697
|
export const isLessThanBigDecimal = makeIsLessThan({
|
|
@@ -8708,7 +8703,7 @@ export const isLessThanBigDecimal = makeIsLessThan({
|
|
|
8708
8703
|
* Validates that a BigDecimal is less than or equal to the specified value
|
|
8709
8704
|
* (inclusive).
|
|
8710
8705
|
*
|
|
8711
|
-
* @category
|
|
8706
|
+
* @category validation
|
|
8712
8707
|
* @since 4.0.0
|
|
8713
8708
|
*/
|
|
8714
8709
|
export const isLessThanOrEqualToBigDecimal = makeIsLessThanOrEqualTo({
|
|
@@ -8724,7 +8719,7 @@ export const isLessThanOrEqualToBigDecimal = makeIsLessThanOrEqualTo({
|
|
|
8724
8719
|
* The minimum and maximum boundaries are inclusive by default. Pass
|
|
8725
8720
|
* `exclusiveMinimum` or `exclusiveMaximum` to exclude either boundary.
|
|
8726
8721
|
*
|
|
8727
|
-
* @category
|
|
8722
|
+
* @category validation
|
|
8728
8723
|
* @since 4.0.0
|
|
8729
8724
|
*/
|
|
8730
8725
|
export const isBetweenBigDecimal = makeIsBetween({
|
|
@@ -8751,14 +8746,16 @@ export const isBetweenBigDecimal = makeIsBetween({
|
|
|
8751
8746
|
*
|
|
8752
8747
|
* **Example** (Checking minimum length)
|
|
8753
8748
|
*
|
|
8754
|
-
* ```ts
|
|
8749
|
+
* ```ts import.meta.vitest
|
|
8755
8750
|
* import { Schema } from "effect"
|
|
8756
8751
|
*
|
|
8757
8752
|
* const NonEmptyStringSchema = Schema.String.check(Schema.isMinLength(1))
|
|
8758
8753
|
* const NonEmptyArraySchema = Schema.Array(Schema.Number).check(Schema.isMinLength(1))
|
|
8754
|
+
* Schema.is(NonEmptyStringSchema)("a") // => true
|
|
8755
|
+
* Schema.is(NonEmptyArraySchema)([1]) // => true
|
|
8759
8756
|
* ```
|
|
8760
8757
|
*
|
|
8761
|
-
* @category
|
|
8758
|
+
* @category validation
|
|
8762
8759
|
* @since 4.0.0
|
|
8763
8760
|
*/
|
|
8764
8761
|
export function isMinLength(minLength: number, annotations?: Annotations.Filter) {
|
|
@@ -8793,7 +8790,7 @@ export function isMinLength(minLength: number, annotations?: Annotations.Filter)
|
|
|
8793
8790
|
*
|
|
8794
8791
|
* @see {@link isMinLength} for creating the corresponding check
|
|
8795
8792
|
*
|
|
8796
|
-
* @category
|
|
8793
|
+
* @category validation
|
|
8797
8794
|
* @since 4.0.0
|
|
8798
8795
|
*/
|
|
8799
8796
|
export const isMinLengthReviver: SchemaRepresentation.FilterReviver<{
|
|
@@ -8820,7 +8817,7 @@ export const isMinLengthReviver: SchemaRepresentation.FilterReviver<{
|
|
|
8820
8817
|
* When generating test data with fast-check, this applies a `minLength: 1`
|
|
8821
8818
|
* constraint to ensure generated strings or arrays are non-empty.
|
|
8822
8819
|
*
|
|
8823
|
-
* @category
|
|
8820
|
+
* @category validation
|
|
8824
8821
|
* @since 4.0.0
|
|
8825
8822
|
*/
|
|
8826
8823
|
export function isNonEmpty(annotations?: Annotations.Filter) {
|
|
@@ -8844,7 +8841,7 @@ export function isNonEmpty(annotations?: Annotations.Filter) {
|
|
|
8844
8841
|
* constraint to ensure generated strings or arrays have at most the required
|
|
8845
8842
|
* length.
|
|
8846
8843
|
*
|
|
8847
|
-
* @category
|
|
8844
|
+
* @category validation
|
|
8848
8845
|
* @since 4.0.0
|
|
8849
8846
|
*/
|
|
8850
8847
|
export function isMaxLength(maxLength: number, annotations?: Annotations.Filter) {
|
|
@@ -8879,7 +8876,7 @@ export function isMaxLength(maxLength: number, annotations?: Annotations.Filter)
|
|
|
8879
8876
|
*
|
|
8880
8877
|
* @see {@link isMaxLength} for creating the corresponding check
|
|
8881
8878
|
*
|
|
8882
|
-
* @category
|
|
8879
|
+
* @category validation
|
|
8883
8880
|
* @since 4.0.0
|
|
8884
8881
|
*/
|
|
8885
8882
|
export const isMaxLengthReviver: SchemaRepresentation.FilterReviver<{
|
|
@@ -8907,7 +8904,7 @@ export const isMaxLengthReviver: SchemaRepresentation.FilterReviver<{
|
|
|
8907
8904
|
* `maxLength` constraints to ensure generated strings or arrays have a length
|
|
8908
8905
|
* within the specified range.
|
|
8909
8906
|
*
|
|
8910
|
-
* @category
|
|
8907
|
+
* @category validation
|
|
8911
8908
|
* @since 4.0.0
|
|
8912
8909
|
*/
|
|
8913
8910
|
export function isLengthBetween(minimum: number, maximum: number, annotations?: Annotations.Filter) {
|
|
@@ -8950,7 +8947,7 @@ export function isLengthBetween(minimum: number, maximum: number, annotations?:
|
|
|
8950
8947
|
*
|
|
8951
8948
|
* @see {@link isLengthBetween} for creating the corresponding check
|
|
8952
8949
|
*
|
|
8953
|
-
* @category
|
|
8950
|
+
* @category validation
|
|
8954
8951
|
* @since 4.0.0
|
|
8955
8952
|
*/
|
|
8956
8953
|
export const isLengthBetweenReviver: SchemaRepresentation.FilterReviver<{
|
|
@@ -8979,7 +8976,7 @@ export const isLengthBetweenReviver: SchemaRepresentation.FilterReviver<{
|
|
|
8979
8976
|
* `minLength` constraint. Generators for values with a final `.size`, such as
|
|
8980
8977
|
* sets and maps, interpret it as final cardinality.
|
|
8981
8978
|
*
|
|
8982
|
-
* @category
|
|
8979
|
+
* @category validation
|
|
8983
8980
|
* @since 4.0.0
|
|
8984
8981
|
*/
|
|
8985
8982
|
export function isMinSize(minSize: number, annotations?: Annotations.Filter) {
|
|
@@ -9014,7 +9011,7 @@ export function isMinSize(minSize: number, annotations?: Annotations.Filter) {
|
|
|
9014
9011
|
*
|
|
9015
9012
|
* @see {@link isMinSize} for creating the corresponding check
|
|
9016
9013
|
*
|
|
9017
|
-
* @category
|
|
9014
|
+
* @category validation
|
|
9018
9015
|
* @since 4.0.0
|
|
9019
9016
|
*/
|
|
9020
9017
|
export const isMinSizeReviver: SchemaRepresentation.FilterReviver<{
|
|
@@ -9042,7 +9039,7 @@ export const isMinSizeReviver: SchemaRepresentation.FilterReviver<{
|
|
|
9042
9039
|
* `maxLength` constraint. Generators for values with a final `.size`, such as
|
|
9043
9040
|
* sets and maps, interpret it as final cardinality.
|
|
9044
9041
|
*
|
|
9045
|
-
* @category
|
|
9042
|
+
* @category validation
|
|
9046
9043
|
* @since 4.0.0
|
|
9047
9044
|
*/
|
|
9048
9045
|
export function isMaxSize(maxSize: number, annotations?: Annotations.Filter) {
|
|
@@ -9077,7 +9074,7 @@ export function isMaxSize(maxSize: number, annotations?: Annotations.Filter) {
|
|
|
9077
9074
|
*
|
|
9078
9075
|
* @see {@link isMaxSize} for creating the corresponding check
|
|
9079
9076
|
*
|
|
9080
|
-
* @category
|
|
9077
|
+
* @category validation
|
|
9081
9078
|
* @since 4.0.0
|
|
9082
9079
|
*/
|
|
9083
9080
|
export const isMaxSizeReviver: SchemaRepresentation.FilterReviver<{
|
|
@@ -9105,7 +9102,7 @@ export const isMaxSizeReviver: SchemaRepresentation.FilterReviver<{
|
|
|
9105
9102
|
* `minLength` and `maxLength` constraints. Generators for values with a final
|
|
9106
9103
|
* `.size`, such as sets and maps, interpret them as final cardinality.
|
|
9107
9104
|
*
|
|
9108
|
-
* @category
|
|
9105
|
+
* @category validation
|
|
9109
9106
|
* @since 4.0.0
|
|
9110
9107
|
*/
|
|
9111
9108
|
export function isSizeBetween(minimum: number, maximum: number, annotations?: Annotations.Filter) {
|
|
@@ -9145,7 +9142,7 @@ export function isSizeBetween(minimum: number, maximum: number, annotations?: An
|
|
|
9145
9142
|
*
|
|
9146
9143
|
* @see {@link isSizeBetween} for creating the corresponding check
|
|
9147
9144
|
*
|
|
9148
|
-
* @category
|
|
9145
|
+
* @category validation
|
|
9149
9146
|
* @since 4.0.0
|
|
9150
9147
|
*/
|
|
9151
9148
|
export const isSizeBetweenReviver: SchemaRepresentation.FilterReviver<{
|
|
@@ -9174,7 +9171,7 @@ export const isSizeBetweenReviver: SchemaRepresentation.FilterReviver<{
|
|
|
9174
9171
|
* `minLength` constraint. Object generators interpret it as the final number
|
|
9175
9172
|
* of own properties.
|
|
9176
9173
|
*
|
|
9177
|
-
* @category
|
|
9174
|
+
* @category validation
|
|
9178
9175
|
* @since 4.0.0
|
|
9179
9176
|
*/
|
|
9180
9177
|
export function isMinProperties(minProperties: number, annotations?: Annotations.Filter) {
|
|
@@ -9209,7 +9206,7 @@ export function isMinProperties(minProperties: number, annotations?: Annotations
|
|
|
9209
9206
|
*
|
|
9210
9207
|
* @see {@link isMinProperties} for creating the corresponding check
|
|
9211
9208
|
*
|
|
9212
|
-
* @category
|
|
9209
|
+
* @category validation
|
|
9213
9210
|
* @since 4.0.0
|
|
9214
9211
|
*/
|
|
9215
9212
|
export const isMinPropertiesReviver: SchemaRepresentation.FilterReviver<{
|
|
@@ -9236,7 +9233,7 @@ export const isMinPropertiesReviver: SchemaRepresentation.FilterReviver<{
|
|
|
9236
9233
|
* `maxLength` constraint. Object generators interpret it as the final number
|
|
9237
9234
|
* of own properties.
|
|
9238
9235
|
*
|
|
9239
|
-
* @category
|
|
9236
|
+
* @category validation
|
|
9240
9237
|
* @since 4.0.0
|
|
9241
9238
|
*/
|
|
9242
9239
|
export function isMaxProperties(maxProperties: number, annotations?: Annotations.Filter) {
|
|
@@ -9271,7 +9268,7 @@ export function isMaxProperties(maxProperties: number, annotations?: Annotations
|
|
|
9271
9268
|
*
|
|
9272
9269
|
* @see {@link isMaxProperties} for creating the corresponding check
|
|
9273
9270
|
*
|
|
9274
|
-
* @category
|
|
9271
|
+
* @category validation
|
|
9275
9272
|
* @since 4.0.0
|
|
9276
9273
|
*/
|
|
9277
9274
|
export const isMaxPropertiesReviver: SchemaRepresentation.FilterReviver<{
|
|
@@ -9299,7 +9296,7 @@ export const isMaxPropertiesReviver: SchemaRepresentation.FilterReviver<{
|
|
|
9299
9296
|
* `minLength` and `maxLength` constraints. Object generators interpret them as
|
|
9300
9297
|
* the final number of own properties.
|
|
9301
9298
|
*
|
|
9302
|
-
* @category
|
|
9299
|
+
* @category validation
|
|
9303
9300
|
* @since 4.0.0
|
|
9304
9301
|
*/
|
|
9305
9302
|
export function isPropertiesLengthBetween(minimum: number, maximum: number, annotations?: Annotations.Filter) {
|
|
@@ -9339,7 +9336,7 @@ export function isPropertiesLengthBetween(minimum: number, maximum: number, anno
|
|
|
9339
9336
|
*
|
|
9340
9337
|
* @see {@link isPropertiesLengthBetween} for creating the corresponding check
|
|
9341
9338
|
*
|
|
9342
|
-
* @category
|
|
9339
|
+
* @category validation
|
|
9343
9340
|
* @since 4.0.0
|
|
9344
9341
|
*/
|
|
9345
9342
|
export const isPropertiesLengthBetweenReviver: SchemaRepresentation.FilterReviver<{
|
|
@@ -9364,7 +9361,7 @@ export const isPropertiesLengthBetweenReviver: SchemaRepresentation.FilterRevive
|
|
|
9364
9361
|
* For string property names, this corresponds to the `propertyNames` constraint
|
|
9365
9362
|
* in JSON Schema.
|
|
9366
9363
|
*
|
|
9367
|
-
* @category
|
|
9364
|
+
* @category validation
|
|
9368
9365
|
* @since 4.0.0
|
|
9369
9366
|
*/
|
|
9370
9367
|
export function isPropertyNames(keySchema: Constraint, annotations?: Annotations.Filter) {
|
|
@@ -9382,7 +9379,7 @@ export function isPropertyNames(keySchema: Constraint, annotations?: Annotations
|
|
|
9382
9379
|
}
|
|
9383
9380
|
}
|
|
9384
9381
|
if (Arr.isArrayNonEmpty(issues)) {
|
|
9385
|
-
return new SchemaIssue.Composite(ast,
|
|
9382
|
+
return new SchemaIssue.Composite(ast, issues)
|
|
9386
9383
|
}
|
|
9387
9384
|
return true
|
|
9388
9385
|
},
|
|
@@ -9410,7 +9407,7 @@ export function isPropertyNames(keySchema: Constraint, annotations?: Annotations
|
|
|
9410
9407
|
*
|
|
9411
9408
|
* @see {@link isPropertyNames} for creating the corresponding check
|
|
9412
9409
|
*
|
|
9413
|
-
* @category
|
|
9410
|
+
* @category validation
|
|
9414
9411
|
* @since 4.0.0
|
|
9415
9412
|
*/
|
|
9416
9413
|
export const isPropertyNamesReviver: SchemaRepresentation.FilterReviver<null> = InternalSchema.makeFilterReviver(
|
|
@@ -9432,7 +9429,7 @@ export const isPropertyNamesReviver: SchemaRepresentation.FilterReviver<null> =
|
|
|
9432
9429
|
* `unique: true` constraint. Array generators translate it to `fast-check`
|
|
9433
9430
|
* `uniqueArray` using Effect equality.
|
|
9434
9431
|
*
|
|
9435
|
-
* @category
|
|
9432
|
+
* @category validation
|
|
9436
9433
|
* @since 4.0.0
|
|
9437
9434
|
*/
|
|
9438
9435
|
export function isUnique<T>(annotations?: Annotations.Filter) {
|
|
@@ -9465,7 +9462,7 @@ export function isUnique<T>(annotations?: Annotations.Filter) {
|
|
|
9465
9462
|
*
|
|
9466
9463
|
* @see {@link isUnique} for creating the corresponding check
|
|
9467
9464
|
*
|
|
9468
|
-
* @category
|
|
9465
|
+
* @category validation
|
|
9469
9466
|
* @since 4.0.0
|
|
9470
9467
|
*/
|
|
9471
9468
|
export const isUniqueReviver: SchemaRepresentation.FilterReviver<null> = InternalSchema.makeFilterReviver(
|
|
@@ -9481,7 +9478,7 @@ export const isUniqueReviver: SchemaRepresentation.FilterReviver<null> = Interna
|
|
|
9481
9478
|
/**
|
|
9482
9479
|
* Type-level representation of {@link NonEmptyString}.
|
|
9483
9480
|
*
|
|
9484
|
-
* @category
|
|
9481
|
+
* @category models
|
|
9485
9482
|
* @since 3.10.0
|
|
9486
9483
|
*/
|
|
9487
9484
|
export interface NonEmptyString extends String {
|
|
@@ -9492,7 +9489,7 @@ export interface NonEmptyString extends String {
|
|
|
9492
9489
|
* Schema for non-empty strings. Validates that a string has at least one
|
|
9493
9490
|
* character.
|
|
9494
9491
|
*
|
|
9495
|
-
* @category
|
|
9492
|
+
* @category schemas
|
|
9496
9493
|
* @since 3.10.0
|
|
9497
9494
|
*/
|
|
9498
9495
|
export const NonEmptyString: NonEmptyString = String.check(isNonEmpty())
|
|
@@ -9500,7 +9497,7 @@ export const NonEmptyString: NonEmptyString = String.check(isNonEmpty())
|
|
|
9500
9497
|
/**
|
|
9501
9498
|
* Type-level representation of {@link Char}.
|
|
9502
9499
|
*
|
|
9503
|
-
* @category
|
|
9500
|
+
* @category models
|
|
9504
9501
|
* @since 3.10.0
|
|
9505
9502
|
*/
|
|
9506
9503
|
export interface Char extends String {
|
|
@@ -9523,7 +9520,7 @@ export interface Char extends String {
|
|
|
9523
9520
|
* @see {@link NonEmptyString} for strings with length greater than zero
|
|
9524
9521
|
* @see {@link isLengthBetween} for the underlying length check
|
|
9525
9522
|
*
|
|
9526
|
-
* @category
|
|
9523
|
+
* @category schemas
|
|
9527
9524
|
* @since 3.10.0
|
|
9528
9525
|
*/
|
|
9529
9526
|
export const Char: Char = String.check(isLengthBetween(1, 1))
|
|
@@ -9531,7 +9528,7 @@ export const Char: Char = String.check(isLengthBetween(1, 1))
|
|
|
9531
9528
|
/**
|
|
9532
9529
|
* Type-level representation returned by {@link Option}.
|
|
9533
9530
|
*
|
|
9534
|
-
* @category
|
|
9531
|
+
* @category models
|
|
9535
9532
|
* @since 3.10.0
|
|
9536
9533
|
*/
|
|
9537
9534
|
export interface Option<A extends Constraint> extends
|
|
@@ -9554,7 +9551,7 @@ export interface Option<A extends Constraint> extends
|
|
|
9554
9551
|
* `None` is represented as `{ _tag: "None" }`, while `Some` is represented as
|
|
9555
9552
|
* `{ _tag: "Some", value }` using the wrapped schema's `Iso` type.
|
|
9556
9553
|
*
|
|
9557
|
-
* @category
|
|
9554
|
+
* @category utility types
|
|
9558
9555
|
* @since 4.0.0
|
|
9559
9556
|
*/
|
|
9560
9557
|
export type OptionIso<A extends Constraint> =
|
|
@@ -9564,7 +9561,7 @@ export type OptionIso<A extends Constraint> =
|
|
|
9564
9561
|
/**
|
|
9565
9562
|
* Schema for `Option<A>` values.
|
|
9566
9563
|
*
|
|
9567
|
-
* @category
|
|
9564
|
+
* @category schemas
|
|
9568
9565
|
* @since 3.10.0
|
|
9569
9566
|
*/
|
|
9570
9567
|
export function Option<A extends Constraint>(value: A): Option<A> {
|
|
@@ -9583,12 +9580,11 @@ export function Option<A extends Constraint>(value: A): Option<A> {
|
|
|
9583
9580
|
SchemaParser.decodeUnknownEffect(value)(input.value, options),
|
|
9584
9581
|
{
|
|
9585
9582
|
onSuccess: Option_.some,
|
|
9586
|
-
onFailure: (issue) =>
|
|
9587
|
-
new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["value"], issue)])
|
|
9583
|
+
onFailure: (issue) => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["value"], issue)])
|
|
9588
9584
|
}
|
|
9589
9585
|
)
|
|
9590
9586
|
}
|
|
9591
|
-
return Effect.fail(new SchemaIssue.InvalidType(ast
|
|
9587
|
+
return Effect.fail(new SchemaIssue.InvalidType(ast))
|
|
9592
9588
|
},
|
|
9593
9589
|
{
|
|
9594
9590
|
representation: {
|
|
@@ -9640,7 +9636,7 @@ export function Option<A extends Constraint>(value: A): Option<A> {
|
|
|
9640
9636
|
*
|
|
9641
9637
|
* @see {@link Option} for creating the corresponding schema
|
|
9642
9638
|
*
|
|
9643
|
-
* @category
|
|
9639
|
+
* @category schemas
|
|
9644
9640
|
* @since 4.0.0
|
|
9645
9641
|
*/
|
|
9646
9642
|
export const OptionReviver = InternalSchema.makeDeclarationReviver(
|
|
@@ -9655,7 +9651,7 @@ export const OptionReviver = InternalSchema.makeDeclarationReviver(
|
|
|
9655
9651
|
/**
|
|
9656
9652
|
* Type-level representation returned by {@link OptionFromNullOr}.
|
|
9657
9653
|
*
|
|
9658
|
-
* @category
|
|
9654
|
+
* @category models
|
|
9659
9655
|
* @since 3.10.0
|
|
9660
9656
|
*/
|
|
9661
9657
|
export interface OptionFromNullOr<S extends Constraint> extends decodeTo<Option<toType<S>>, NullOr<S>> {
|
|
@@ -9670,7 +9666,7 @@ export interface OptionFromNullOr<S extends Constraint> extends decodeTo<Option<
|
|
|
9670
9666
|
* Decoding maps `null` to `None` and all other values to `Some`. Encoding maps
|
|
9671
9667
|
* `None` to `null` and maps `Some` to its value.
|
|
9672
9668
|
*
|
|
9673
|
-
* @category
|
|
9669
|
+
* @category schemas
|
|
9674
9670
|
* @since 3.10.0
|
|
9675
9671
|
*/
|
|
9676
9672
|
export function OptionFromNullOr<S extends Constraint>(schema: S): OptionFromNullOr<S> {
|
|
@@ -9683,7 +9679,7 @@ export function OptionFromNullOr<S extends Constraint>(schema: S): OptionFromNul
|
|
|
9683
9679
|
/**
|
|
9684
9680
|
* Type-level representation returned by {@link OptionFromUndefinedOr}.
|
|
9685
9681
|
*
|
|
9686
|
-
* @category
|
|
9682
|
+
* @category models
|
|
9687
9683
|
* @since 3.10.0
|
|
9688
9684
|
*/
|
|
9689
9685
|
export interface OptionFromUndefinedOr<S extends Constraint> extends decodeTo<Option<toType<S>>, UndefinedOr<S>> {
|
|
@@ -9699,7 +9695,7 @@ export interface OptionFromUndefinedOr<S extends Constraint> extends decodeTo<Op
|
|
|
9699
9695
|
* Decoding maps `undefined` to `None` and all other values to `Some`. Encoding
|
|
9700
9696
|
* maps `None` to `undefined` and maps `Some` to its value.
|
|
9701
9697
|
*
|
|
9702
|
-
* @category
|
|
9698
|
+
* @category schemas
|
|
9703
9699
|
* @since 3.10.0
|
|
9704
9700
|
*/
|
|
9705
9701
|
export function OptionFromUndefinedOr<S extends Constraint>(schema: S): OptionFromUndefinedOr<S> {
|
|
@@ -9712,7 +9708,7 @@ export function OptionFromUndefinedOr<S extends Constraint>(schema: S): OptionFr
|
|
|
9712
9708
|
/**
|
|
9713
9709
|
* Type-level representation returned by {@link OptionFromNullishOr}.
|
|
9714
9710
|
*
|
|
9715
|
-
* @category
|
|
9711
|
+
* @category models
|
|
9716
9712
|
* @since 3.10.0
|
|
9717
9713
|
*/
|
|
9718
9714
|
export interface OptionFromNullishOr<S extends Constraint> extends decodeTo<Option<toType<S>>, NullishOr<S>> {
|
|
@@ -9729,7 +9725,7 @@ export interface OptionFromNullishOr<S extends Constraint> extends decodeTo<Opti
|
|
|
9729
9725
|
* `options.onNoneEncoding`, which defaults to `undefined`, and maps `Some` to
|
|
9730
9726
|
* its value.
|
|
9731
9727
|
*
|
|
9732
|
-
* @category
|
|
9728
|
+
* @category schemas
|
|
9733
9729
|
* @since 3.10.0
|
|
9734
9730
|
*/
|
|
9735
9731
|
export function OptionFromNullishOr<S extends Constraint>(
|
|
@@ -9747,7 +9743,7 @@ export function OptionFromNullishOr<S extends Constraint>(
|
|
|
9747
9743
|
/**
|
|
9748
9744
|
* Type-level representation returned by {@link OptionFromOptionalKey}.
|
|
9749
9745
|
*
|
|
9750
|
-
* @category
|
|
9746
|
+
* @category models
|
|
9751
9747
|
* @since 4.0.0
|
|
9752
9748
|
*/
|
|
9753
9749
|
export interface OptionFromOptionalKey<S extends Constraint> extends decodeTo<Option<toType<S>>, optionalKey<S>> {
|
|
@@ -9762,7 +9758,7 @@ export interface OptionFromOptionalKey<S extends Constraint> extends decodeTo<Op
|
|
|
9762
9758
|
* Decoding maps a missing key to `None` and a present value to `Some`.
|
|
9763
9759
|
* Encoding maps `None` to a missing key and maps `Some` to its value.
|
|
9764
9760
|
*
|
|
9765
|
-
* @category
|
|
9761
|
+
* @category schemas
|
|
9766
9762
|
* @since 4.0.0
|
|
9767
9763
|
*/
|
|
9768
9764
|
export function OptionFromOptionalKey<S extends Constraint>(schema: S): OptionFromOptionalKey<S> {
|
|
@@ -9775,7 +9771,7 @@ export function OptionFromOptionalKey<S extends Constraint>(schema: S): OptionFr
|
|
|
9775
9771
|
/**
|
|
9776
9772
|
* Type-level representation returned by {@link OptionFromOptional}.
|
|
9777
9773
|
*
|
|
9778
|
-
* @category
|
|
9774
|
+
* @category models
|
|
9779
9775
|
* @since 4.0.0
|
|
9780
9776
|
*/
|
|
9781
9777
|
export interface OptionFromOptional<S extends Constraint> extends decodeTo<Option<toType<S>>, optional<S>> {
|
|
@@ -9792,7 +9788,7 @@ export interface OptionFromOptional<S extends Constraint> extends decodeTo<Optio
|
|
|
9792
9788
|
* maps all other values to `Some`. Encoding maps `None` to a missing key and
|
|
9793
9789
|
* maps `Some` to its value.
|
|
9794
9790
|
*
|
|
9795
|
-
* @category
|
|
9791
|
+
* @category schemas
|
|
9796
9792
|
* @since 4.0.0
|
|
9797
9793
|
*/
|
|
9798
9794
|
export function OptionFromOptional<S extends Constraint>(schema: S): OptionFromOptional<S> {
|
|
@@ -9805,7 +9801,7 @@ export function OptionFromOptional<S extends Constraint>(schema: S): OptionFromO
|
|
|
9805
9801
|
/**
|
|
9806
9802
|
* Type-level representation returned by {@link OptionFromOptionalNullOr}.
|
|
9807
9803
|
*
|
|
9808
|
-
* @category
|
|
9804
|
+
* @category models
|
|
9809
9805
|
* @since 4.0.0
|
|
9810
9806
|
*/
|
|
9811
9807
|
export interface OptionFromOptionalNullOr<S extends Constraint>
|
|
@@ -9825,7 +9821,7 @@ export interface OptionFromOptionalNullOr<S extends Constraint>
|
|
|
9825
9821
|
* according to `options.onNoneEncoding`: `"omit"` encodes a missing key,
|
|
9826
9822
|
* `null` encodes `null`, and `undefined` encodes `undefined`.
|
|
9827
9823
|
*
|
|
9828
|
-
* @category
|
|
9824
|
+
* @category schemas
|
|
9829
9825
|
* @since 4.0.0
|
|
9830
9826
|
*/
|
|
9831
9827
|
export function OptionFromOptionalNullOr<S extends Constraint>(
|
|
@@ -9852,7 +9848,7 @@ export function OptionFromOptionalNullOr<S extends Constraint>(
|
|
|
9852
9848
|
/**
|
|
9853
9849
|
* Type-level representation returned by {@link Result}.
|
|
9854
9850
|
*
|
|
9855
|
-
* @category
|
|
9851
|
+
* @category models
|
|
9856
9852
|
* @since 4.0.0
|
|
9857
9853
|
*/
|
|
9858
9854
|
export interface Result<A extends Constraint, E extends Constraint> extends
|
|
@@ -9876,7 +9872,7 @@ export interface Result<A extends Constraint, E extends Constraint> extends
|
|
|
9876
9872
|
* Successful results are represented as `{ _tag: "Success", success }`, while
|
|
9877
9873
|
* failed results are represented as `{ _tag: "Failure", failure }`.
|
|
9878
9874
|
*
|
|
9879
|
-
* @category
|
|
9875
|
+
* @category utility types
|
|
9880
9876
|
* @since 4.0.0
|
|
9881
9877
|
*/
|
|
9882
9878
|
export type ResultIso<A extends Constraint, E extends Constraint> =
|
|
@@ -9901,20 +9897,18 @@ export function Result<A extends Constraint, E extends Constraint>(
|
|
|
9901
9897
|
[success, failure],
|
|
9902
9898
|
([success, failure]) => (input, ast, options) => {
|
|
9903
9899
|
if (!Result_.isResult(input)) {
|
|
9904
|
-
return Effect.fail(new SchemaIssue.InvalidType(ast
|
|
9900
|
+
return Effect.fail(new SchemaIssue.InvalidType(ast))
|
|
9905
9901
|
}
|
|
9906
9902
|
switch (input._tag) {
|
|
9907
9903
|
case "Success":
|
|
9908
9904
|
return Effect.mapBothEager(SchemaParser.decodeEffect(success)(input.success, options), {
|
|
9909
9905
|
onSuccess: Result_.succeed,
|
|
9910
|
-
onFailure: (issue) =>
|
|
9911
|
-
new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["success"], issue)])
|
|
9906
|
+
onFailure: (issue) => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["success"], issue)])
|
|
9912
9907
|
})
|
|
9913
9908
|
case "Failure":
|
|
9914
9909
|
return Effect.mapBothEager(SchemaParser.decodeEffect(failure)(input.failure, options), {
|
|
9915
9910
|
onSuccess: Result_.fail,
|
|
9916
|
-
onFailure: (issue) =>
|
|
9917
|
-
new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["failure"], issue)])
|
|
9911
|
+
onFailure: (issue) => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["failure"], issue)])
|
|
9918
9912
|
})
|
|
9919
9913
|
}
|
|
9920
9914
|
},
|
|
@@ -9991,7 +9985,7 @@ export const ResultReviver = InternalSchema.makeDeclarationReviver(
|
|
|
9991
9985
|
/**
|
|
9992
9986
|
* Type-level representation returned by {@link Redacted}.
|
|
9993
9987
|
*
|
|
9994
|
-
* @category
|
|
9988
|
+
* @category models
|
|
9995
9989
|
* @since 3.10.0
|
|
9996
9990
|
*/
|
|
9997
9991
|
export interface Redacted<S extends Constraint> extends
|
|
@@ -10037,13 +10031,7 @@ const RedactedOptionsPayload = declare((input): input is RedactedRepresentationO
|
|
|
10037
10031
|
const RedactedRepresentationPayload: Decoder<RedactedRepresentationPayload> = Union([Null, RedactedOptionsPayload])
|
|
10038
10032
|
|
|
10039
10033
|
/**
|
|
10040
|
-
* Schema for values
|
|
10041
|
-
* inspection.
|
|
10042
|
-
*
|
|
10043
|
-
* **Details**
|
|
10044
|
-
*
|
|
10045
|
-
* If the wrapped schema fails, the issue will be redacted to prevent both
|
|
10046
|
-
* the actual value and the schema details from being exposed.
|
|
10034
|
+
* Schema for `Redacted` values, which hide their contents from inspection.
|
|
10047
10035
|
*
|
|
10048
10036
|
* Options:
|
|
10049
10037
|
*
|
|
@@ -10057,7 +10045,7 @@ const RedactedRepresentationPayload: Decoder<RedactedRepresentationPayload> = Un
|
|
|
10057
10045
|
* sensitive and should not be exposed in JSON.
|
|
10058
10046
|
*
|
|
10059
10047
|
* @see {@link RedactedFromValue} for decoding raw values and wrapping them in `Redacted`.
|
|
10060
|
-
* @category
|
|
10048
|
+
* @category schemas
|
|
10061
10049
|
* @since 3.10.0
|
|
10062
10050
|
*/
|
|
10063
10051
|
export function Redacted<S extends Constraint>(value: S, options?: {
|
|
@@ -10091,17 +10079,16 @@ export function Redacted<S extends Constraint>(value: S, options?: {
|
|
|
10091
10079
|
SchemaParser.decodeUnknownEffect(value)(Redacted_.value(input), poptions),
|
|
10092
10080
|
{
|
|
10093
10081
|
onSuccess: () => input,
|
|
10094
|
-
onFailure: (/** ignore the
|
|
10095
|
-
|
|
10096
|
-
|
|
10097
|
-
new SchemaIssue.Pointer(["value"], new SchemaIssue.InvalidValue(oinput))
|
|
10082
|
+
onFailure: (/** ignore the issue because of security reasons */) => {
|
|
10083
|
+
return new SchemaIssue.Composite(ast, [
|
|
10084
|
+
new SchemaIssue.Pointer(["value"], new SchemaIssue.InvalidValue())
|
|
10098
10085
|
])
|
|
10099
10086
|
}
|
|
10100
10087
|
}
|
|
10101
10088
|
)
|
|
10102
10089
|
)
|
|
10103
10090
|
}
|
|
10104
|
-
return Effect.fail(new SchemaIssue.InvalidType(ast
|
|
10091
|
+
return Effect.fail(new SchemaIssue.InvalidType(ast))
|
|
10105
10092
|
},
|
|
10106
10093
|
{
|
|
10107
10094
|
representation: {
|
|
@@ -10118,7 +10105,7 @@ export function Redacted<S extends Constraint>(value: S, options?: {
|
|
|
10118
10105
|
expected: "Redacted",
|
|
10119
10106
|
toCodecJson: ([value]) =>
|
|
10120
10107
|
link<Redacted_.Redacted<S["Encoded"]>>()(
|
|
10121
|
-
|
|
10108
|
+
value,
|
|
10122
10109
|
{
|
|
10123
10110
|
decode: SchemaGetter.transform((e) => Redacted_.make(e, { label })),
|
|
10124
10111
|
encode: disallowJsonEncode ?
|
|
@@ -10149,7 +10136,7 @@ export function Redacted<S extends Constraint>(value: S, options?: {
|
|
|
10149
10136
|
*
|
|
10150
10137
|
* @see {@link Redacted} for creating the corresponding schema
|
|
10151
10138
|
*
|
|
10152
|
-
* @category
|
|
10139
|
+
* @category schemas
|
|
10153
10140
|
* @since 4.0.0
|
|
10154
10141
|
*/
|
|
10155
10142
|
export const RedactedReviver = InternalSchema.makeDeclarationReviver(
|
|
@@ -10164,62 +10151,47 @@ export const RedactedReviver = InternalSchema.makeDeclarationReviver(
|
|
|
10164
10151
|
/**
|
|
10165
10152
|
* Type-level representation returned by {@link RedactedFromValue}.
|
|
10166
10153
|
*
|
|
10167
|
-
* @category
|
|
10154
|
+
* @category models
|
|
10168
10155
|
* @since 4.0.0
|
|
10169
10156
|
*/
|
|
10170
|
-
export interface RedactedFromValue<S extends Constraint>
|
|
10171
|
-
extends decodeTo<Redacted<toType<S>>, middlewareDecoding<S, S["DecodingServices"]>>
|
|
10172
|
-
{
|
|
10157
|
+
export interface RedactedFromValue<S extends Constraint> extends decodeTo<Redacted<toType<S>>, S> {
|
|
10173
10158
|
readonly "Rebuild": RedactedFromValue<S>
|
|
10174
10159
|
}
|
|
10175
10160
|
|
|
10176
|
-
/**
|
|
10177
|
-
* Middleware that wraps decoded errors in `Redacted`, preventing sensitive
|
|
10178
|
-
* schema details from leaking in error messages.
|
|
10179
|
-
*
|
|
10180
|
-
* @category Redacted
|
|
10181
|
-
* @since 4.0.0
|
|
10182
|
-
*/
|
|
10183
|
-
export function redact<S extends Constraint>(schema: S): middlewareDecoding<S, S["DecodingServices"]> {
|
|
10184
|
-
return middlewareDecoding<S, S["DecodingServices"]>(Effect.mapErrorEager(SchemaIssue.redact))(schema)
|
|
10185
|
-
}
|
|
10186
|
-
|
|
10187
10161
|
/**
|
|
10188
10162
|
* Decodes a value and wraps it in `Redacted<A>`. Unlike {@link Redacted} which
|
|
10189
10163
|
* expects the input to already be a `Redacted` instance, this schema decodes
|
|
10190
10164
|
* the raw value and wraps it.
|
|
10191
10165
|
*
|
|
10192
10166
|
* @see {@link Redacted} for schemas whose input is already a `Redacted` value.
|
|
10193
|
-
* @category
|
|
10167
|
+
* @category schemas
|
|
10194
10168
|
* @since 4.0.0
|
|
10195
10169
|
*/
|
|
10196
10170
|
export function RedactedFromValue<S extends Constraint>(value: S, options?: {
|
|
10197
10171
|
readonly label?: string | undefined
|
|
10198
10172
|
readonly disallowEncode?: boolean | undefined
|
|
10199
10173
|
}): RedactedFromValue<S> {
|
|
10200
|
-
return
|
|
10201
|
-
|
|
10202
|
-
|
|
10203
|
-
|
|
10204
|
-
|
|
10205
|
-
|
|
10206
|
-
{
|
|
10207
|
-
|
|
10208
|
-
|
|
10209
|
-
|
|
10210
|
-
|
|
10211
|
-
|
|
10212
|
-
|
|
10213
|
-
|
|
10214
|
-
|
|
10215
|
-
)
|
|
10216
|
-
)
|
|
10174
|
+
return decodeTo<Redacted<toType<S>>, S>(
|
|
10175
|
+
Redacted(toType(value), {
|
|
10176
|
+
label: options?.label,
|
|
10177
|
+
disallowJsonEncode: options?.disallowEncode
|
|
10178
|
+
}),
|
|
10179
|
+
{
|
|
10180
|
+
decode: SchemaGetter.transform((t) => Redacted_.make(t, { label: options?.label })),
|
|
10181
|
+
encode: options?.disallowEncode ?
|
|
10182
|
+
SchemaGetter.forbidden((oe) =>
|
|
10183
|
+
"Cannot encode Redacted" +
|
|
10184
|
+
(Option_.isSome(oe) && typeof oe.value.label === "string" ? ` with label: "${oe.value.label}"` : "")
|
|
10185
|
+
) :
|
|
10186
|
+
SchemaGetter.transform(Redacted_.value)
|
|
10187
|
+
}
|
|
10188
|
+
)(value)
|
|
10217
10189
|
}
|
|
10218
10190
|
|
|
10219
10191
|
/**
|
|
10220
10192
|
* Type-level representation returned by {@link CauseReason}.
|
|
10221
10193
|
*
|
|
10222
|
-
* @category
|
|
10194
|
+
* @category models
|
|
10223
10195
|
* @since 4.0.0
|
|
10224
10196
|
*/
|
|
10225
10197
|
export interface CauseReason<E extends Constraint, D extends Constraint> extends
|
|
@@ -10243,7 +10215,7 @@ export interface CauseReason<E extends Constraint, D extends Constraint> extends
|
|
|
10243
10215
|
* Failures are represented with a `Fail` tag and encoded error, defects with a
|
|
10244
10216
|
* `Die` tag and encoded defect, and interrupts with an optional `fiberId`.
|
|
10245
10217
|
*
|
|
10246
|
-
* @category
|
|
10218
|
+
* @category utility types
|
|
10247
10219
|
* @since 4.0.0
|
|
10248
10220
|
*/
|
|
10249
10221
|
export type CauseReasonIso<E extends Constraint, D extends Constraint> = {
|
|
@@ -10274,7 +10246,7 @@ export type CauseReasonIso<E extends Constraint, D extends Constraint> = {
|
|
|
10274
10246
|
* @see {@link Cause} for constructing schemas for full Cause values
|
|
10275
10247
|
* @see {@link CauseReasonIso} for the ISO shape of each cause reason
|
|
10276
10248
|
*
|
|
10277
|
-
* @category
|
|
10249
|
+
* @category schemas
|
|
10278
10250
|
* @since 4.0.0
|
|
10279
10251
|
*/
|
|
10280
10252
|
export function CauseReason<E extends Constraint, D extends Constraint>(error: E, defect: D): CauseReason<E, D> {
|
|
@@ -10282,7 +10254,7 @@ export function CauseReason<E extends Constraint, D extends Constraint>(error: E
|
|
|
10282
10254
|
[error, defect],
|
|
10283
10255
|
([error, defect]) => (input, ast, options) => {
|
|
10284
10256
|
if (!Cause_.isReason(input)) {
|
|
10285
|
-
return Effect.fail(new SchemaIssue.InvalidType(ast
|
|
10257
|
+
return Effect.fail(new SchemaIssue.InvalidType(ast))
|
|
10286
10258
|
}
|
|
10287
10259
|
switch (input._tag) {
|
|
10288
10260
|
case "Fail":
|
|
@@ -10290,8 +10262,7 @@ export function CauseReason<E extends Constraint, D extends Constraint>(error: E
|
|
|
10290
10262
|
SchemaParser.decodeUnknownEffect(error)(input.error, options),
|
|
10291
10263
|
{
|
|
10292
10264
|
onSuccess: Cause_.makeFailReason,
|
|
10293
|
-
onFailure: (issue) =>
|
|
10294
|
-
new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["error"], issue)])
|
|
10265
|
+
onFailure: (issue) => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["error"], issue)])
|
|
10295
10266
|
}
|
|
10296
10267
|
)
|
|
10297
10268
|
case "Die":
|
|
@@ -10299,8 +10270,7 @@ export function CauseReason<E extends Constraint, D extends Constraint>(error: E
|
|
|
10299
10270
|
SchemaParser.decodeUnknownEffect(defect)(input.defect, options),
|
|
10300
10271
|
{
|
|
10301
10272
|
onSuccess: Cause_.makeDieReason,
|
|
10302
|
-
onFailure: (issue) =>
|
|
10303
|
-
new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["defect"], issue)])
|
|
10273
|
+
onFailure: (issue) => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["defect"], issue)])
|
|
10304
10274
|
}
|
|
10305
10275
|
)
|
|
10306
10276
|
case "Interrupt":
|
|
@@ -10356,7 +10326,7 @@ export function CauseReason<E extends Constraint, D extends Constraint>(error: E
|
|
|
10356
10326
|
*
|
|
10357
10327
|
* @see {@link CauseReason} for creating the corresponding schema
|
|
10358
10328
|
*
|
|
10359
|
-
* @category
|
|
10329
|
+
* @category schemas
|
|
10360
10330
|
* @since 4.0.0
|
|
10361
10331
|
*/
|
|
10362
10332
|
export const CauseReasonReviver = InternalSchema.makeDeclarationReviver(
|
|
@@ -10414,7 +10384,7 @@ function causeReasonToFormatter<E>(error: Formatter<E>, defect: Formatter<unknow
|
|
|
10414
10384
|
/**
|
|
10415
10385
|
* Type-level representation returned by {@link Cause}.
|
|
10416
10386
|
*
|
|
10417
|
-
* @category
|
|
10387
|
+
* @category models
|
|
10418
10388
|
* @since 3.10.0
|
|
10419
10389
|
*/
|
|
10420
10390
|
export interface Cause<E extends Constraint, D extends Constraint> extends
|
|
@@ -10442,7 +10412,7 @@ export interface Cause<E extends Constraint, D extends Constraint> extends
|
|
|
10442
10412
|
* @see {@link Cause} for constructing schemas for full Cause values
|
|
10443
10413
|
* @see {@link CauseReasonIso} for the ISO shape of each array element
|
|
10444
10414
|
*
|
|
10445
|
-
* @category
|
|
10415
|
+
* @category utility types
|
|
10446
10416
|
* @since 4.0.0
|
|
10447
10417
|
*/
|
|
10448
10418
|
export type CauseIso<E extends Constraint, D extends Constraint> = ReadonlyArray<CauseReasonIso<E, D>>
|
|
@@ -10465,7 +10435,7 @@ export type CauseIso<E extends Constraint, D extends Constraint> = ReadonlyArray
|
|
|
10465
10435
|
* @see {@link CauseReason} for the schema used by each individual cause reason
|
|
10466
10436
|
* @see {@link CauseIso} for the ordered array representation used by the schema ISO
|
|
10467
10437
|
*
|
|
10468
|
-
* @category
|
|
10438
|
+
* @category schemas
|
|
10469
10439
|
* @since 3.10.0
|
|
10470
10440
|
*/
|
|
10471
10441
|
export function Cause<E extends Constraint, D extends Constraint>(error: E, defect: D): Cause<E, D> {
|
|
@@ -10475,12 +10445,11 @@ export function Cause<E extends Constraint, D extends Constraint>(error: E, defe
|
|
|
10475
10445
|
const failures = ArraySchema(CauseReason(error, defect))
|
|
10476
10446
|
return (input, ast, options) => {
|
|
10477
10447
|
if (!Cause_.isCause(input)) {
|
|
10478
|
-
return Effect.fail(new SchemaIssue.InvalidType(ast
|
|
10448
|
+
return Effect.fail(new SchemaIssue.InvalidType(ast))
|
|
10479
10449
|
}
|
|
10480
10450
|
return Effect.mapBothEager(SchemaParser.decodeUnknownEffect(failures)(input.reasons, options), {
|
|
10481
10451
|
onSuccess: Cause_.fromReasons,
|
|
10482
|
-
onFailure: (issue) =>
|
|
10483
|
-
new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["failures"], issue)])
|
|
10452
|
+
onFailure: (issue) => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["failures"], issue)])
|
|
10484
10453
|
})
|
|
10485
10454
|
}
|
|
10486
10455
|
},
|
|
@@ -10520,7 +10489,7 @@ export function Cause<E extends Constraint, D extends Constraint>(error: E, defe
|
|
|
10520
10489
|
*
|
|
10521
10490
|
* @see {@link Cause} for creating the corresponding schema
|
|
10522
10491
|
*
|
|
10523
|
-
* @category
|
|
10492
|
+
* @category schemas
|
|
10524
10493
|
* @since 4.0.0
|
|
10525
10494
|
*/
|
|
10526
10495
|
export const CauseReviver = InternalSchema.makeDeclarationReviver(
|
|
@@ -10557,7 +10526,7 @@ function causeToFormatter<E>(error: Formatter<E>, defect: Formatter<unknown>) {
|
|
|
10557
10526
|
/**
|
|
10558
10527
|
* Type-level representation of {@link Error}.
|
|
10559
10528
|
*
|
|
10560
|
-
* @category
|
|
10529
|
+
* @category models
|
|
10561
10530
|
* @since 4.0.0
|
|
10562
10531
|
*/
|
|
10563
10532
|
export interface Error extends instanceOf<globalThis.Error> {
|
|
@@ -10642,7 +10611,7 @@ const errorSchemaCache: Array<Error | undefined> = []
|
|
|
10642
10611
|
* traces are omitted by default for security. Pass `{ includeStack: true }` to
|
|
10643
10612
|
* include stack traces, or `{ excludeCause: true }` to omit causes.
|
|
10644
10613
|
*
|
|
10645
|
-
* @category
|
|
10614
|
+
* @category schemas
|
|
10646
10615
|
* @since 4.0.0
|
|
10647
10616
|
*/
|
|
10648
10617
|
export function Error(options?: ErrorOptions): Error {
|
|
@@ -10678,7 +10647,7 @@ export function Error(options?: ErrorOptions): Error {
|
|
|
10678
10647
|
*
|
|
10679
10648
|
* @see {@link Error} for creating the corresponding schema
|
|
10680
10649
|
*
|
|
10681
|
-
* @category
|
|
10650
|
+
* @category schemas
|
|
10682
10651
|
* @since 4.0.0
|
|
10683
10652
|
*/
|
|
10684
10653
|
export const ErrorReviver = InternalSchema.makeDeclarationReviver(
|
|
@@ -10693,7 +10662,7 @@ export const ErrorReviver = InternalSchema.makeDeclarationReviver(
|
|
|
10693
10662
|
/**
|
|
10694
10663
|
* Type-level representation of {@link Defect}.
|
|
10695
10664
|
*
|
|
10696
|
-
* @category
|
|
10665
|
+
* @category models
|
|
10697
10666
|
* @since 3.10.0
|
|
10698
10667
|
*/
|
|
10699
10668
|
export interface Defect extends decodeTo<Unknown, typeof Json> {
|
|
@@ -10740,7 +10709,7 @@ const defectSchemaCache: Array<Defect | undefined> = []
|
|
|
10740
10709
|
* string representation.
|
|
10741
10710
|
*
|
|
10742
10711
|
* @see {@link Error} for a schema that only accepts JavaScript `Error` values.
|
|
10743
|
-
* @category
|
|
10712
|
+
* @category schemas
|
|
10744
10713
|
* @since 4.0.0
|
|
10745
10714
|
*/
|
|
10746
10715
|
export function Defect(options?: ErrorOptions): Defect {
|
|
@@ -10757,7 +10726,7 @@ export function Defect(options?: ErrorOptions): Defect {
|
|
|
10757
10726
|
/**
|
|
10758
10727
|
* Type-level representation returned by {@link Exit}.
|
|
10759
10728
|
*
|
|
10760
|
-
* @category
|
|
10729
|
+
* @category models
|
|
10761
10730
|
* @since 3.10.0
|
|
10762
10731
|
*/
|
|
10763
10732
|
export interface Exit<A extends Constraint, E extends Constraint, D extends Constraint> extends
|
|
@@ -10782,7 +10751,7 @@ export interface Exit<A extends Constraint, E extends Constraint, D extends Cons
|
|
|
10782
10751
|
* Successful exits are represented as `{ _tag: "Success", value }`, while failed
|
|
10783
10752
|
* exits are represented as `{ _tag: "Failure", cause }`.
|
|
10784
10753
|
*
|
|
10785
|
-
* @category
|
|
10754
|
+
* @category utility types
|
|
10786
10755
|
* @since 4.0.0
|
|
10787
10756
|
*/
|
|
10788
10757
|
export type ExitIso<A extends Constraint, E extends Constraint, D extends Constraint> = {
|
|
@@ -10802,7 +10771,7 @@ export type ExitIso<A extends Constraint, E extends Constraint, D extends Constr
|
|
|
10802
10771
|
* Use when serializing or validating an effect outcome where success, typed
|
|
10803
10772
|
* failure, and defects each need their own schema.
|
|
10804
10773
|
*
|
|
10805
|
-
* @category
|
|
10774
|
+
* @category schemas
|
|
10806
10775
|
* @since 3.10.0
|
|
10807
10776
|
*/
|
|
10808
10777
|
export function Exit<A extends Constraint, E extends Constraint, D extends Constraint>(
|
|
@@ -10820,7 +10789,7 @@ export function Exit<A extends Constraint, E extends Constraint, D extends Const
|
|
|
10820
10789
|
const cause = Cause(error, defect)
|
|
10821
10790
|
return (input, ast, options) => {
|
|
10822
10791
|
if (!Exit_.isExit(input)) {
|
|
10823
|
-
return Effect.fail(new SchemaIssue.InvalidType(ast
|
|
10792
|
+
return Effect.fail(new SchemaIssue.InvalidType(ast))
|
|
10824
10793
|
}
|
|
10825
10794
|
switch (input._tag) {
|
|
10826
10795
|
case "Success":
|
|
@@ -10828,8 +10797,7 @@ export function Exit<A extends Constraint, E extends Constraint, D extends Const
|
|
|
10828
10797
|
SchemaParser.decodeUnknownEffect(value)(input.value, options),
|
|
10829
10798
|
{
|
|
10830
10799
|
onSuccess: Exit_.succeed,
|
|
10831
|
-
onFailure: (issue) =>
|
|
10832
|
-
new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["value"], issue)])
|
|
10800
|
+
onFailure: (issue) => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["value"], issue)])
|
|
10833
10801
|
}
|
|
10834
10802
|
)
|
|
10835
10803
|
case "Failure":
|
|
@@ -10837,8 +10805,7 @@ export function Exit<A extends Constraint, E extends Constraint, D extends Const
|
|
|
10837
10805
|
SchemaParser.decodeUnknownEffect(cause)(input.cause, options),
|
|
10838
10806
|
{
|
|
10839
10807
|
onSuccess: Exit_.failCause,
|
|
10840
|
-
onFailure: (issue) =>
|
|
10841
|
-
new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["cause"], issue)])
|
|
10808
|
+
onFailure: (issue) => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["cause"], issue)])
|
|
10842
10809
|
}
|
|
10843
10810
|
)
|
|
10844
10811
|
}
|
|
@@ -10922,7 +10889,7 @@ export function Exit<A extends Constraint, E extends Constraint, D extends Const
|
|
|
10922
10889
|
*
|
|
10923
10890
|
* @see {@link Exit} for creating the corresponding schema
|
|
10924
10891
|
*
|
|
10925
|
-
* @category
|
|
10892
|
+
* @category schemas
|
|
10926
10893
|
* @since 4.0.0
|
|
10927
10894
|
*/
|
|
10928
10895
|
export const ExitReviver = InternalSchema.makeDeclarationReviver(
|
|
@@ -10937,7 +10904,7 @@ export const ExitReviver = InternalSchema.makeDeclarationReviver(
|
|
|
10937
10904
|
/**
|
|
10938
10905
|
* Type-level representation returned by {@link ReadonlyMap}.
|
|
10939
10906
|
*
|
|
10940
|
-
* @category
|
|
10907
|
+
* @category models
|
|
10941
10908
|
* @since 4.0.0
|
|
10942
10909
|
*/
|
|
10943
10910
|
export interface $ReadonlyMap<Key extends Constraint, Value extends Constraint> extends
|
|
@@ -10957,7 +10924,7 @@ export interface $ReadonlyMap<Key extends Constraint, Value extends Constraint>
|
|
|
10957
10924
|
* Iso representation used for `ReadonlyMap` schemas: an array of readonly
|
|
10958
10925
|
* `[key, value]` tuples using each entry schema's `Iso` type.
|
|
10959
10926
|
*
|
|
10960
|
-
* @category
|
|
10927
|
+
* @category utility types
|
|
10961
10928
|
* @since 4.0.0
|
|
10962
10929
|
*/
|
|
10963
10930
|
export type ReadonlyMapIso<Key extends Constraint, Value extends Constraint> = ReadonlyArray<
|
|
@@ -11058,7 +11025,7 @@ function entriesArbitrary<K, V, Out>(
|
|
|
11058
11025
|
* Schema for readonly maps whose keys and values conform to the provided
|
|
11059
11026
|
* schemas.
|
|
11060
11027
|
*
|
|
11061
|
-
* @category
|
|
11028
|
+
* @category schemas
|
|
11062
11029
|
* @since 3.10.0
|
|
11063
11030
|
*/
|
|
11064
11031
|
export function ReadonlyMap<Key extends Constraint, Value extends Constraint>(
|
|
@@ -11079,12 +11046,11 @@ export function ReadonlyMap<Key extends Constraint, Value extends Constraint>(
|
|
|
11079
11046
|
SchemaParser.decodeUnknownEffect(array)([...input], options),
|
|
11080
11047
|
{
|
|
11081
11048
|
onSuccess: (array: ReadonlyArray<readonly [Key["Type"], Value["Type"]]>) => new globalThis.Map(array),
|
|
11082
|
-
onFailure: (issue) =>
|
|
11083
|
-
new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["entries"], issue)])
|
|
11049
|
+
onFailure: (issue) => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["entries"], issue)])
|
|
11084
11050
|
}
|
|
11085
11051
|
)
|
|
11086
11052
|
}
|
|
11087
|
-
return Effect.fail(new SchemaIssue.InvalidType(ast
|
|
11053
|
+
return Effect.fail(new SchemaIssue.InvalidType(ast))
|
|
11088
11054
|
}
|
|
11089
11055
|
},
|
|
11090
11056
|
{
|
|
@@ -11129,7 +11095,7 @@ export function ReadonlyMap<Key extends Constraint, Value extends Constraint>(
|
|
|
11129
11095
|
*
|
|
11130
11096
|
* @see {@link ReadonlyMap} for creating the corresponding schema
|
|
11131
11097
|
*
|
|
11132
|
-
* @category
|
|
11098
|
+
* @category schemas
|
|
11133
11099
|
* @since 4.0.0
|
|
11134
11100
|
*/
|
|
11135
11101
|
export const ReadonlyMapReviver = InternalSchema.makeDeclarationReviver(
|
|
@@ -11144,7 +11110,7 @@ export const ReadonlyMapReviver = InternalSchema.makeDeclarationReviver(
|
|
|
11144
11110
|
/**
|
|
11145
11111
|
* Type-level representation returned by {@link HashMap}.
|
|
11146
11112
|
*
|
|
11147
|
-
* @category
|
|
11113
|
+
* @category models
|
|
11148
11114
|
* @since 3.10.0
|
|
11149
11115
|
*/
|
|
11150
11116
|
export interface HashMap<Key extends Constraint, Value extends Constraint> extends
|
|
@@ -11164,7 +11130,7 @@ export interface HashMap<Key extends Constraint, Value extends Constraint> exten
|
|
|
11164
11130
|
* Iso representation used for `HashMap` schemas: an array of readonly
|
|
11165
11131
|
* `[key, value]` tuples using each entry schema's `Iso` type.
|
|
11166
11132
|
*
|
|
11167
|
-
* @category
|
|
11133
|
+
* @category utility types
|
|
11168
11134
|
* @since 4.0.0
|
|
11169
11135
|
*/
|
|
11170
11136
|
export type HashMapIso<Key extends Constraint, Value extends Constraint> = ReadonlyArray<
|
|
@@ -11174,7 +11140,7 @@ export type HashMapIso<Key extends Constraint, Value extends Constraint> = Reado
|
|
|
11174
11140
|
/**
|
|
11175
11141
|
* Schema for hash maps whose keys and values conform to the provided schemas.
|
|
11176
11142
|
*
|
|
11177
|
-
* @category
|
|
11143
|
+
* @category schemas
|
|
11178
11144
|
* @since 3.10.0
|
|
11179
11145
|
*/
|
|
11180
11146
|
export function HashMap<Key extends Constraint, Value extends Constraint>(key: Key, value: Value): HashMap<Key, Value> {
|
|
@@ -11192,12 +11158,11 @@ export function HashMap<Key extends Constraint, Value extends Constraint>(key: K
|
|
|
11192
11158
|
SchemaParser.decodeUnknownEffect(entries)(HashMap_.toEntries(input), options),
|
|
11193
11159
|
{
|
|
11194
11160
|
onSuccess: HashMap_.fromIterable,
|
|
11195
|
-
onFailure: (issue) =>
|
|
11196
|
-
new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["entries"], issue)])
|
|
11161
|
+
onFailure: (issue) => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["entries"], issue)])
|
|
11197
11162
|
}
|
|
11198
11163
|
)
|
|
11199
11164
|
}
|
|
11200
|
-
return Effect.fail(new SchemaIssue.InvalidType(ast
|
|
11165
|
+
return Effect.fail(new SchemaIssue.InvalidType(ast))
|
|
11201
11166
|
}
|
|
11202
11167
|
},
|
|
11203
11168
|
{
|
|
@@ -11243,7 +11208,7 @@ export function HashMap<Key extends Constraint, Value extends Constraint>(key: K
|
|
|
11243
11208
|
*
|
|
11244
11209
|
* @see {@link HashMap} for creating the corresponding schema
|
|
11245
11210
|
*
|
|
11246
|
-
* @category
|
|
11211
|
+
* @category schemas
|
|
11247
11212
|
* @since 4.0.0
|
|
11248
11213
|
*/
|
|
11249
11214
|
export const HashMapReviver = InternalSchema.makeDeclarationReviver(
|
|
@@ -11258,7 +11223,7 @@ export const HashMapReviver = InternalSchema.makeDeclarationReviver(
|
|
|
11258
11223
|
/**
|
|
11259
11224
|
* Type-level representation returned by {@link ReadonlySet}.
|
|
11260
11225
|
*
|
|
11261
|
-
* @category
|
|
11226
|
+
* @category models
|
|
11262
11227
|
* @since 4.0.0
|
|
11263
11228
|
*/
|
|
11264
11229
|
export interface $ReadonlySet<Value extends Constraint> extends
|
|
@@ -11277,7 +11242,7 @@ export interface $ReadonlySet<Value extends Constraint> extends
|
|
|
11277
11242
|
* Iso representation used for `ReadonlySet` schemas: an array of element values
|
|
11278
11243
|
* using the element schema's `Iso` type.
|
|
11279
11244
|
*
|
|
11280
|
-
* @category
|
|
11245
|
+
* @category utility types
|
|
11281
11246
|
* @since 4.0.0
|
|
11282
11247
|
*/
|
|
11283
11248
|
export type ReadonlySetIso<Value extends Constraint> = ReadonlyArray<Value["Iso"]>
|
|
@@ -11285,7 +11250,7 @@ export type ReadonlySetIso<Value extends Constraint> = ReadonlyArray<Value["Iso"
|
|
|
11285
11250
|
/**
|
|
11286
11251
|
* Schema for readonly sets whose values conform to the provided element schema.
|
|
11287
11252
|
*
|
|
11288
|
-
* @category
|
|
11253
|
+
* @category schemas
|
|
11289
11254
|
* @since 3.10.0
|
|
11290
11255
|
*/
|
|
11291
11256
|
export function ReadonlySet<Value extends Constraint>(value: Value): $ReadonlySet<Value> {
|
|
@@ -11303,12 +11268,11 @@ export function ReadonlySet<Value extends Constraint>(value: Value): $ReadonlySe
|
|
|
11303
11268
|
SchemaParser.decodeUnknownEffect(array)([...input], options),
|
|
11304
11269
|
{
|
|
11305
11270
|
onSuccess: (array: ReadonlyArray<Value["Type"]>) => new globalThis.Set(array),
|
|
11306
|
-
onFailure: (issue) =>
|
|
11307
|
-
new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["values"], issue)])
|
|
11271
|
+
onFailure: (issue) => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["values"], issue)])
|
|
11308
11272
|
}
|
|
11309
11273
|
)
|
|
11310
11274
|
}
|
|
11311
|
-
return Effect.fail(new SchemaIssue.InvalidType(ast
|
|
11275
|
+
return Effect.fail(new SchemaIssue.InvalidType(ast))
|
|
11312
11276
|
}
|
|
11313
11277
|
},
|
|
11314
11278
|
{
|
|
@@ -11354,7 +11318,7 @@ export function ReadonlySet<Value extends Constraint>(value: Value): $ReadonlySe
|
|
|
11354
11318
|
*
|
|
11355
11319
|
* @see {@link ReadonlySet} for creating the corresponding schema
|
|
11356
11320
|
*
|
|
11357
|
-
* @category
|
|
11321
|
+
* @category schemas
|
|
11358
11322
|
* @since 4.0.0
|
|
11359
11323
|
*/
|
|
11360
11324
|
export const ReadonlySetReviver = InternalSchema.makeDeclarationReviver(
|
|
@@ -11369,7 +11333,7 @@ export const ReadonlySetReviver = InternalSchema.makeDeclarationReviver(
|
|
|
11369
11333
|
/**
|
|
11370
11334
|
* Type-level representation returned by {@link HashSet}.
|
|
11371
11335
|
*
|
|
11372
|
-
* @category
|
|
11336
|
+
* @category models
|
|
11373
11337
|
* @since 3.10.0
|
|
11374
11338
|
*/
|
|
11375
11339
|
export interface HashSet<Value extends Constraint> extends
|
|
@@ -11388,7 +11352,7 @@ export interface HashSet<Value extends Constraint> extends
|
|
|
11388
11352
|
* Iso representation used for `HashSet` schemas: an array of element values
|
|
11389
11353
|
* using the element schema's `Iso` type.
|
|
11390
11354
|
*
|
|
11391
|
-
* @category
|
|
11355
|
+
* @category utility types
|
|
11392
11356
|
* @since 4.0.0
|
|
11393
11357
|
*/
|
|
11394
11358
|
export type HashSetIso<Value extends Constraint> = ReadonlyArray<Value["Iso"]>
|
|
@@ -11396,7 +11360,7 @@ export type HashSetIso<Value extends Constraint> = ReadonlyArray<Value["Iso"]>
|
|
|
11396
11360
|
/**
|
|
11397
11361
|
* Schema for hash sets whose values conform to the provided element schema.
|
|
11398
11362
|
*
|
|
11399
|
-
* @category
|
|
11363
|
+
* @category schemas
|
|
11400
11364
|
* @since 3.10.0
|
|
11401
11365
|
*/
|
|
11402
11366
|
export function HashSet<Value extends Constraint>(value: Value): HashSet<Value> {
|
|
@@ -11414,12 +11378,11 @@ export function HashSet<Value extends Constraint>(value: Value): HashSet<Value>
|
|
|
11414
11378
|
SchemaParser.decodeUnknownEffect(values)(Arr.fromIterable(input), options),
|
|
11415
11379
|
{
|
|
11416
11380
|
onSuccess: HashSet_.fromIterable,
|
|
11417
|
-
onFailure: (issue) =>
|
|
11418
|
-
new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["values"], issue)])
|
|
11381
|
+
onFailure: (issue) => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["values"], issue)])
|
|
11419
11382
|
}
|
|
11420
11383
|
)
|
|
11421
11384
|
}
|
|
11422
|
-
return Effect.fail(new SchemaIssue.InvalidType(ast
|
|
11385
|
+
return Effect.fail(new SchemaIssue.InvalidType(ast))
|
|
11423
11386
|
}
|
|
11424
11387
|
},
|
|
11425
11388
|
{
|
|
@@ -11465,7 +11428,7 @@ export function HashSet<Value extends Constraint>(value: Value): HashSet<Value>
|
|
|
11465
11428
|
*
|
|
11466
11429
|
* @see {@link HashSet} for creating the corresponding schema
|
|
11467
11430
|
*
|
|
11468
|
-
* @category
|
|
11431
|
+
* @category schemas
|
|
11469
11432
|
* @since 4.0.0
|
|
11470
11433
|
*/
|
|
11471
11434
|
export const HashSetReviver = InternalSchema.makeDeclarationReviver(
|
|
@@ -11480,7 +11443,7 @@ export const HashSetReviver = InternalSchema.makeDeclarationReviver(
|
|
|
11480
11443
|
/**
|
|
11481
11444
|
* Type-level representation returned by {@link Chunk}.
|
|
11482
11445
|
*
|
|
11483
|
-
* @category
|
|
11446
|
+
* @category models
|
|
11484
11447
|
* @since 3.10.0
|
|
11485
11448
|
*/
|
|
11486
11449
|
export interface Chunk<Value extends Constraint> extends
|
|
@@ -11506,7 +11469,7 @@ export interface Chunk<Value extends Constraint> extends
|
|
|
11506
11469
|
*
|
|
11507
11470
|
* @see {@link Chunk} for the schema interface and constructor that use this ISO representation
|
|
11508
11471
|
*
|
|
11509
|
-
* @category
|
|
11472
|
+
* @category utility types
|
|
11510
11473
|
* @since 4.0.0
|
|
11511
11474
|
*/
|
|
11512
11475
|
export type ChunkIso<Value extends Constraint> = ReadonlyArray<Value["Iso"]>
|
|
@@ -11514,7 +11477,7 @@ export type ChunkIso<Value extends Constraint> = ReadonlyArray<Value["Iso"]>
|
|
|
11514
11477
|
/**
|
|
11515
11478
|
* Schema for chunks whose values conform to the provided element schema.
|
|
11516
11479
|
*
|
|
11517
|
-
* @category
|
|
11480
|
+
* @category schemas
|
|
11518
11481
|
* @since 3.10.0
|
|
11519
11482
|
*/
|
|
11520
11483
|
export function Chunk<Value extends Constraint>(value: Value): Chunk<Value> {
|
|
@@ -11532,12 +11495,11 @@ export function Chunk<Value extends Constraint>(value: Value): Chunk<Value> {
|
|
|
11532
11495
|
SchemaParser.decodeUnknownEffect(values)(Arr.fromIterable(input), options),
|
|
11533
11496
|
{
|
|
11534
11497
|
onSuccess: Chunk_.fromIterable,
|
|
11535
|
-
onFailure: (issue) =>
|
|
11536
|
-
new SchemaIssue.Composite(ast, Option_.some(input), [new SchemaIssue.Pointer(["values"], issue)])
|
|
11498
|
+
onFailure: (issue) => new SchemaIssue.Composite(ast, [new SchemaIssue.Pointer(["values"], issue)])
|
|
11537
11499
|
}
|
|
11538
11500
|
)
|
|
11539
11501
|
}
|
|
11540
|
-
return Effect.fail(new SchemaIssue.InvalidType(ast
|
|
11502
|
+
return Effect.fail(new SchemaIssue.InvalidType(ast))
|
|
11541
11503
|
}
|
|
11542
11504
|
},
|
|
11543
11505
|
{
|
|
@@ -11583,7 +11545,7 @@ export function Chunk<Value extends Constraint>(value: Value): Chunk<Value> {
|
|
|
11583
11545
|
*
|
|
11584
11546
|
* @see {@link Chunk} for creating the corresponding schema
|
|
11585
11547
|
*
|
|
11586
|
-
* @category
|
|
11548
|
+
* @category schemas
|
|
11587
11549
|
* @since 4.0.0
|
|
11588
11550
|
*/
|
|
11589
11551
|
export const ChunkReviver = InternalSchema.makeDeclarationReviver(
|
|
@@ -11598,7 +11560,7 @@ export const ChunkReviver = InternalSchema.makeDeclarationReviver(
|
|
|
11598
11560
|
/**
|
|
11599
11561
|
* Type-level representation of {@link RegExp}.
|
|
11600
11562
|
*
|
|
11601
|
-
* @category
|
|
11563
|
+
* @category models
|
|
11602
11564
|
* @since 4.0.0
|
|
11603
11565
|
*/
|
|
11604
11566
|
export interface RegExp extends instanceOf<globalThis.RegExp> {
|
|
@@ -11612,7 +11574,7 @@ export interface RegExp extends instanceOf<globalThis.RegExp> {
|
|
|
11612
11574
|
*
|
|
11613
11575
|
* The default JSON serializer encodes a `RegExp` as `{ source, flags }`.
|
|
11614
11576
|
*
|
|
11615
|
-
* @category
|
|
11577
|
+
* @category schemas
|
|
11616
11578
|
* @since 4.0.0
|
|
11617
11579
|
*/
|
|
11618
11580
|
export const RegExp: RegExp = instanceOf(
|
|
@@ -11637,7 +11599,7 @@ export const RegExp: RegExp = instanceOf(
|
|
|
11637
11599
|
decode: (e) =>
|
|
11638
11600
|
Effect.try({
|
|
11639
11601
|
try: () => new globalThis.RegExp(e.source, e.flags),
|
|
11640
|
-
catch: (
|
|
11602
|
+
catch: () => new SchemaIssue.InvalidValue({ message: "Expected valid RegExp source and flags" })
|
|
11641
11603
|
}),
|
|
11642
11604
|
encode: (regExp) =>
|
|
11643
11605
|
Effect.succeed({
|
|
@@ -11681,7 +11643,7 @@ export const RegExp: RegExp = instanceOf(
|
|
|
11681
11643
|
*
|
|
11682
11644
|
* @see {@link RegExp} for the corresponding schema
|
|
11683
11645
|
*
|
|
11684
|
-
* @category
|
|
11646
|
+
* @category schemas
|
|
11685
11647
|
* @since 4.0.0
|
|
11686
11648
|
*/
|
|
11687
11649
|
export const RegExpReviver = makeFixedDeclarationReviver(
|
|
@@ -11692,7 +11654,7 @@ export const RegExpReviver = makeFixedDeclarationReviver(
|
|
|
11692
11654
|
/**
|
|
11693
11655
|
* Type-level representation of {@link URL}.
|
|
11694
11656
|
*
|
|
11695
|
-
* @category
|
|
11657
|
+
* @category models
|
|
11696
11658
|
* @since 4.0.0
|
|
11697
11659
|
*/
|
|
11698
11660
|
export interface URL extends instanceOf<globalThis.URL> {
|
|
@@ -11710,7 +11672,7 @@ const URLString = String.annotate({ expected: "a string that will be decoded as
|
|
|
11710
11672
|
*
|
|
11711
11673
|
* - encodes `URL` as a `string`
|
|
11712
11674
|
*
|
|
11713
|
-
* @category
|
|
11675
|
+
* @category schemas
|
|
11714
11676
|
* @since 4.0.0
|
|
11715
11677
|
*/
|
|
11716
11678
|
export const URL: URL = instanceOf(
|
|
@@ -11744,7 +11706,7 @@ export const URL: URL = instanceOf(
|
|
|
11744
11706
|
*
|
|
11745
11707
|
* @see {@link URL} for the corresponding schema
|
|
11746
11708
|
*
|
|
11747
|
-
* @category
|
|
11709
|
+
* @category schemas
|
|
11748
11710
|
* @since 4.0.0
|
|
11749
11711
|
*/
|
|
11750
11712
|
export const URLReviver = makeFixedDeclarationReviver(
|
|
@@ -11755,7 +11717,7 @@ export const URLReviver = makeFixedDeclarationReviver(
|
|
|
11755
11717
|
/**
|
|
11756
11718
|
* Type-level representation of {@link URLFromString}.
|
|
11757
11719
|
*
|
|
11758
|
-
* @category
|
|
11720
|
+
* @category models
|
|
11759
11721
|
* @since 4.0.0
|
|
11760
11722
|
*/
|
|
11761
11723
|
export interface URLFromString extends decodeTo<URL, String> {
|
|
@@ -11773,7 +11735,7 @@ export interface URLFromString extends decodeTo<URL, String> {
|
|
|
11773
11735
|
* Encoding:
|
|
11774
11736
|
* - A `URL` is encoded as a `string`
|
|
11775
11737
|
*
|
|
11776
|
-
* @category
|
|
11738
|
+
* @category schemas
|
|
11777
11739
|
* @since 4.0.0
|
|
11778
11740
|
*/
|
|
11779
11741
|
export const URLFromString: URLFromString = URLString.pipe(decodeTo(URL, SchemaTransformation.urlFromString))
|
|
@@ -11781,7 +11743,7 @@ export const URLFromString: URLFromString = URLString.pipe(decodeTo(URL, SchemaT
|
|
|
11781
11743
|
/**
|
|
11782
11744
|
* Type-level representation of {@link Date}.
|
|
11783
11745
|
*
|
|
11784
|
-
* @category
|
|
11746
|
+
* @category models
|
|
11785
11747
|
* @since 4.0.0
|
|
11786
11748
|
*/
|
|
11787
11749
|
export interface Date extends declare<globalThis.Date> {
|
|
@@ -11828,17 +11790,17 @@ const DateString = String.annotate({ expected: "a string that will be decoded as
|
|
|
11828
11790
|
*
|
|
11829
11791
|
* **Example** (Defining a Date schema)
|
|
11830
11792
|
*
|
|
11831
|
-
* ```ts
|
|
11793
|
+
* ```ts import.meta.vitest
|
|
11832
11794
|
* import { Schema } from "effect"
|
|
11833
11795
|
*
|
|
11834
|
-
* Schema.decodeUnknownSync(Schema.Date)(new Date("2024-01-01"))
|
|
11835
|
-
* // =>
|
|
11796
|
+
* const date = Schema.decodeUnknownSync(Schema.Date)(new Date("2024-01-01"))
|
|
11797
|
+
* date.toISOString() // => "2024-01-01T00:00:00.000Z"
|
|
11836
11798
|
* ```
|
|
11837
11799
|
*
|
|
11838
11800
|
* @see {@link DateFromString} for decoding strings into Date instances
|
|
11839
11801
|
* @see {@link DateFromMillis} for decoding epoch milliseconds into Date instances
|
|
11840
11802
|
*
|
|
11841
|
-
* @category
|
|
11803
|
+
* @category schemas
|
|
11842
11804
|
* @since 4.0.0
|
|
11843
11805
|
*/
|
|
11844
11806
|
export const Date: Date = declare(
|
|
@@ -11875,7 +11837,7 @@ export const Date: Date = declare(
|
|
|
11875
11837
|
*
|
|
11876
11838
|
* @see {@link Date} for the corresponding schema
|
|
11877
11839
|
*
|
|
11878
|
-
* @category
|
|
11840
|
+
* @category schemas
|
|
11879
11841
|
* @since 4.0.0
|
|
11880
11842
|
*/
|
|
11881
11843
|
export const DateReviver = makeFixedDeclarationReviver(
|
|
@@ -11886,7 +11848,7 @@ export const DateReviver = makeFixedDeclarationReviver(
|
|
|
11886
11848
|
/**
|
|
11887
11849
|
* Type-level representation of {@link DateFromString}.
|
|
11888
11850
|
*
|
|
11889
|
-
* @category
|
|
11851
|
+
* @category models
|
|
11890
11852
|
* @since 3.10.0
|
|
11891
11853
|
*/
|
|
11892
11854
|
export interface DateFromString extends decodeTo<Date, String> {
|
|
@@ -11915,7 +11877,7 @@ export interface DateFromString extends decodeTo<Date, String> {
|
|
|
11915
11877
|
* @see {@link DateTimeUtcFromString} for decoding date-time strings into UTC values
|
|
11916
11878
|
* @see {@link Date} for accepting Date instances directly
|
|
11917
11879
|
*
|
|
11918
|
-
* @category
|
|
11880
|
+
* @category schemas
|
|
11919
11881
|
* @since 3.10.0
|
|
11920
11882
|
*/
|
|
11921
11883
|
export const DateFromString: DateFromString = DateString.pipe(decodeTo(Date, SchemaTransformation.dateFromString))
|
|
@@ -11923,7 +11885,7 @@ export const DateFromString: DateFromString = DateString.pipe(decodeTo(Date, Sch
|
|
|
11923
11885
|
/**
|
|
11924
11886
|
* Type-level representation of {@link DateFromMillis}.
|
|
11925
11887
|
*
|
|
11926
|
-
* @category
|
|
11888
|
+
* @category models
|
|
11927
11889
|
* @since 4.0.0
|
|
11928
11890
|
*/
|
|
11929
11891
|
export interface DateFromMillis extends decodeTo<Date, Int> {
|
|
@@ -11955,7 +11917,7 @@ export interface DateFromMillis extends decodeTo<Date, Int> {
|
|
|
11955
11917
|
* @see {@link DateFromString} for decoding string-encoded dates
|
|
11956
11918
|
* @see {@link DateTimeUtcFromMillis} for decoding epoch milliseconds into UTC values
|
|
11957
11919
|
*
|
|
11958
|
-
* @category
|
|
11920
|
+
* @category schemas
|
|
11959
11921
|
* @since 4.0.0
|
|
11960
11922
|
*/
|
|
11961
11923
|
export const DateFromMillis: DateFromMillis = Int.pipe(
|
|
@@ -11965,7 +11927,7 @@ export const DateFromMillis: DateFromMillis = Int.pipe(
|
|
|
11965
11927
|
/**
|
|
11966
11928
|
* Type-level representation of {@link Duration}.
|
|
11967
11929
|
*
|
|
11968
|
-
* @category
|
|
11930
|
+
* @category models
|
|
11969
11931
|
* @since 3.10.0
|
|
11970
11932
|
*/
|
|
11971
11933
|
export interface Duration extends declare<Duration_.Duration> {
|
|
@@ -11982,14 +11944,13 @@ export interface Duration extends declare<Duration_.Duration> {
|
|
|
11982
11944
|
*
|
|
11983
11945
|
* **Example** (Defining a Duration schema)
|
|
11984
11946
|
*
|
|
11985
|
-
* ```ts
|
|
11947
|
+
* ```ts import.meta.vitest
|
|
11986
11948
|
* import { Duration, Schema } from "effect"
|
|
11987
11949
|
*
|
|
11988
|
-
* Schema.decodeUnknownSync(Schema.Duration)(Duration.seconds(5))
|
|
11989
|
-
* // => Duration(5s)
|
|
11950
|
+
* Schema.decodeUnknownSync(Schema.Duration)(Duration.seconds(5)) // => Duration.seconds(5)
|
|
11990
11951
|
* ```
|
|
11991
11952
|
*
|
|
11992
|
-
* @category
|
|
11953
|
+
* @category schemas
|
|
11993
11954
|
*
|
|
11994
11955
|
* @since 3.10.0
|
|
11995
11956
|
*/
|
|
@@ -12062,7 +12023,7 @@ export const Duration: Duration = declare(
|
|
|
12062
12023
|
*
|
|
12063
12024
|
* @see {@link Duration} for the corresponding schema
|
|
12064
12025
|
*
|
|
12065
|
-
* @category
|
|
12026
|
+
* @category schemas
|
|
12066
12027
|
* @since 4.0.0
|
|
12067
12028
|
*/
|
|
12068
12029
|
export const DurationReviver = makeFixedDeclarationReviver(
|
|
@@ -12075,7 +12036,7 @@ const DurationString = String.annotate({ expected: "a string that will be decode
|
|
|
12075
12036
|
/**
|
|
12076
12037
|
* Type-level representation of {@link DurationFromString}.
|
|
12077
12038
|
*
|
|
12078
|
-
* @category
|
|
12039
|
+
* @category models
|
|
12079
12040
|
* @since 4.0.0
|
|
12080
12041
|
*/
|
|
12081
12042
|
export interface DurationFromString extends decodeTo<Duration, String> {
|
|
@@ -12094,7 +12055,7 @@ export interface DurationFromString extends decodeTo<Duration, String> {
|
|
|
12094
12055
|
* Encoding:
|
|
12095
12056
|
* - A `Duration` is encoded as a parseable `string`.
|
|
12096
12057
|
*
|
|
12097
|
-
* @category
|
|
12058
|
+
* @category schemas
|
|
12098
12059
|
* @since 4.0.0
|
|
12099
12060
|
*/
|
|
12100
12061
|
export const DurationFromString: DurationFromString = DurationString.pipe(
|
|
@@ -12104,7 +12065,7 @@ export const DurationFromString: DurationFromString = DurationString.pipe(
|
|
|
12104
12065
|
/**
|
|
12105
12066
|
* Type-level representation of {@link DurationFromNanos}.
|
|
12106
12067
|
*
|
|
12107
|
-
* @category
|
|
12068
|
+
* @category models
|
|
12108
12069
|
* @since 3.10.0
|
|
12109
12070
|
*/
|
|
12110
12071
|
export interface DurationFromNanos extends decodeTo<Duration, BigInt> {
|
|
@@ -12125,7 +12086,7 @@ export interface DurationFromNanos extends decodeTo<Duration, BigInt> {
|
|
|
12125
12086
|
* fails when the duration cannot be represented as nanoseconds, such as
|
|
12126
12087
|
* `Duration.infinity` or `Duration.negativeInfinity`.
|
|
12127
12088
|
*
|
|
12128
|
-
* @category
|
|
12089
|
+
* @category schemas
|
|
12129
12090
|
* @since 3.10.0
|
|
12130
12091
|
*/
|
|
12131
12092
|
export const DurationFromNanos: DurationFromNanos = BigInt.pipe(
|
|
@@ -12135,7 +12096,7 @@ export const DurationFromNanos: DurationFromNanos = BigInt.pipe(
|
|
|
12135
12096
|
/**
|
|
12136
12097
|
* Type-level representation of {@link DurationFromMillis}.
|
|
12137
12098
|
*
|
|
12138
|
-
* @category
|
|
12099
|
+
* @category models
|
|
12139
12100
|
* @since 3.10.0
|
|
12140
12101
|
*/
|
|
12141
12102
|
export interface DurationFromMillis extends decodeTo<Duration, Number> {
|
|
@@ -12158,7 +12119,7 @@ export interface DurationFromMillis extends decodeTo<Duration, Number> {
|
|
|
12158
12119
|
*
|
|
12159
12120
|
* `NaN` is decoded as `Duration.zero`, matching `Duration.millis`.
|
|
12160
12121
|
*
|
|
12161
|
-
* @category
|
|
12122
|
+
* @category schemas
|
|
12162
12123
|
* @since 3.10.0
|
|
12163
12124
|
*/
|
|
12164
12125
|
export const DurationFromMillis: DurationFromMillis = Number.pipe(
|
|
@@ -12168,7 +12129,7 @@ export const DurationFromMillis: DurationFromMillis = Number.pipe(
|
|
|
12168
12129
|
/**
|
|
12169
12130
|
* Type-level representation of {@link BigDecimal}.
|
|
12170
12131
|
*
|
|
12171
|
-
* @category
|
|
12132
|
+
* @category models
|
|
12172
12133
|
* @since 3.10.0
|
|
12173
12134
|
*/
|
|
12174
12135
|
export interface BigDecimal extends declare<BigDecimal_.BigDecimal> {
|
|
@@ -12268,7 +12229,7 @@ function bigDecimalScaleConstraints(
|
|
|
12268
12229
|
*
|
|
12269
12230
|
* @see {@link BigDecimalFromString} for parsing string input into a BigDecimal
|
|
12270
12231
|
*
|
|
12271
|
-
* @category
|
|
12232
|
+
* @category schemas
|
|
12272
12233
|
* @since 3.10.0
|
|
12273
12234
|
*/
|
|
12274
12235
|
export const BigDecimal: BigDecimal = declare(
|
|
@@ -12320,7 +12281,7 @@ export const BigDecimal: BigDecimal = declare(
|
|
|
12320
12281
|
*
|
|
12321
12282
|
* @see {@link BigDecimal} for the corresponding schema
|
|
12322
12283
|
*
|
|
12323
|
-
* @category
|
|
12284
|
+
* @category schemas
|
|
12324
12285
|
* @since 4.0.0
|
|
12325
12286
|
*/
|
|
12326
12287
|
export const BigDecimalReviver = makeFixedDeclarationReviver(
|
|
@@ -12331,7 +12292,7 @@ export const BigDecimalReviver = makeFixedDeclarationReviver(
|
|
|
12331
12292
|
/**
|
|
12332
12293
|
* Type-level representation of {@link BigDecimalFromString}.
|
|
12333
12294
|
*
|
|
12334
|
-
* @category
|
|
12295
|
+
* @category models
|
|
12335
12296
|
* @since 4.0.0
|
|
12336
12297
|
*/
|
|
12337
12298
|
export interface BigDecimalFromString extends decodeTo<BigDecimal, String> {
|
|
@@ -12362,7 +12323,7 @@ export interface BigDecimalFromString extends decodeTo<BigDecimal, String> {
|
|
|
12362
12323
|
* @see {@link BigIntFromString} for parsing base-10 integer strings into bigint values
|
|
12363
12324
|
* @see {@link NumberFromString} for parsing JavaScript number strings
|
|
12364
12325
|
*
|
|
12365
|
-
* @category
|
|
12326
|
+
* @category schemas
|
|
12366
12327
|
* @since 4.0.0
|
|
12367
12328
|
*/
|
|
12368
12329
|
export const BigDecimalFromString: BigDecimalFromString = BigDecimalString.pipe(
|
|
@@ -12374,43 +12335,6 @@ const JsonString = String.annotate({
|
|
|
12374
12335
|
contentMediaType: "application/json"
|
|
12375
12336
|
})
|
|
12376
12337
|
|
|
12377
|
-
/**
|
|
12378
|
-
* Type-level representation of {@link UnknownFromJsonString}.
|
|
12379
|
-
*
|
|
12380
|
-
* @category models
|
|
12381
|
-
* @since 4.0.0
|
|
12382
|
-
*/
|
|
12383
|
-
export interface UnknownFromJsonString extends fromJsonString<Unknown> {
|
|
12384
|
-
readonly "Rebuild": UnknownFromJsonString
|
|
12385
|
-
}
|
|
12386
|
-
|
|
12387
|
-
/**
|
|
12388
|
-
* Schema that decodes a JSON-encoded string into an `unknown` value.
|
|
12389
|
-
*
|
|
12390
|
-
* **Details**
|
|
12391
|
-
*
|
|
12392
|
-
* Decoding:
|
|
12393
|
-
* - A `string` is decoded as an `unknown` value.
|
|
12394
|
-
* - If the string is not valid JSON, decoding fails.
|
|
12395
|
-
*
|
|
12396
|
-
* Encoding:
|
|
12397
|
-
* - Any value is encoded as a JSON string using `JSON.stringify`.
|
|
12398
|
-
* - If the value is not a valid JSON value, encoding fails.
|
|
12399
|
-
*
|
|
12400
|
-
* **Example** (Decoding unknown JSON strings)
|
|
12401
|
-
*
|
|
12402
|
-
* ```ts
|
|
12403
|
-
* import { Schema } from "effect"
|
|
12404
|
-
*
|
|
12405
|
-
* Schema.decodeUnknownSync(Schema.UnknownFromJsonString)(`{"a":1,"b":2}`)
|
|
12406
|
-
* // => { a: 1, b: 2 }
|
|
12407
|
-
* ```
|
|
12408
|
-
*
|
|
12409
|
-
* @category schemas
|
|
12410
|
-
* @since 4.0.0
|
|
12411
|
-
*/
|
|
12412
|
-
export const UnknownFromJsonString: UnknownFromJsonString = fromJsonString(Unknown)
|
|
12413
|
-
|
|
12414
12338
|
/**
|
|
12415
12339
|
* Type-level representation returned by {@link fromJsonString}.
|
|
12416
12340
|
*
|
|
@@ -12430,32 +12354,44 @@ export interface fromJsonString<S extends Constraint> extends decodeTo<S, String
|
|
|
12430
12354
|
* This is useful when working with JSON-encoded strings where the actual
|
|
12431
12355
|
* structure of the value is known and described by an existing schema.
|
|
12432
12356
|
*
|
|
12433
|
-
*
|
|
12434
|
-
* provided schema on the
|
|
12357
|
+
* During decoding, the resulting schema first parses the input string as JSON,
|
|
12358
|
+
* using `reviver` when provided, and then runs the provided schema on the
|
|
12359
|
+
* parsed result. During encoding, it first encodes with the provided schema and
|
|
12360
|
+
* then passes the result to `JSON.stringify` with the optional `replacer` and
|
|
12361
|
+
* `space`.
|
|
12435
12362
|
*
|
|
12436
|
-
* **Example** (
|
|
12363
|
+
* **Example** (Formatting encoded JSON)
|
|
12437
12364
|
*
|
|
12438
|
-
* ```ts
|
|
12365
|
+
* ```ts import.meta.vitest
|
|
12439
12366
|
* import { Schema } from "effect"
|
|
12440
12367
|
*
|
|
12441
12368
|
* const schema = Schema.Struct({ a: Schema.Number })
|
|
12442
|
-
* const schemaFromJsonString = Schema.fromJsonString(schema)
|
|
12369
|
+
* const schemaFromJsonString = Schema.fromJsonString(schema, { space: 2 })
|
|
12443
12370
|
*
|
|
12444
|
-
* Schema.
|
|
12445
|
-
* // => { a: 1 }
|
|
12371
|
+
* Schema.encodeSync(schemaFromJsonString)({ a: 1 }) // => "{\n \"a\": 1\n}"
|
|
12446
12372
|
* ```
|
|
12447
12373
|
*
|
|
12448
|
-
* @category
|
|
12374
|
+
* @category schemas
|
|
12449
12375
|
* @since 4.0.0
|
|
12450
12376
|
*/
|
|
12451
|
-
export function fromJsonString<S extends Constraint>(
|
|
12452
|
-
|
|
12377
|
+
export function fromJsonString<S extends Constraint>(
|
|
12378
|
+
schema: S,
|
|
12379
|
+
options?: {
|
|
12380
|
+
readonly reviver?: Parameters<typeof JSON.parse>[1] | undefined
|
|
12381
|
+
readonly replacer?: SchemaGetter.JsonReplacer | undefined
|
|
12382
|
+
readonly space?: Parameters<typeof JSON.stringify>[2] | undefined
|
|
12383
|
+
}
|
|
12384
|
+
): fromJsonString<S> {
|
|
12385
|
+
return JsonString.pipe(decodeTo(schema, SchemaTransformation.fromJsonString(options)))
|
|
12453
12386
|
}
|
|
12454
12387
|
|
|
12388
|
+
/** @internal */
|
|
12389
|
+
export const UnknownFromJsonString: fromJsonString<Unknown> = fromJsonString(Unknown)
|
|
12390
|
+
|
|
12455
12391
|
/**
|
|
12456
12392
|
* Type-level representation of {@link File}.
|
|
12457
12393
|
*
|
|
12458
|
-
* @category
|
|
12394
|
+
* @category models
|
|
12459
12395
|
* @since 4.0.0
|
|
12460
12396
|
*/
|
|
12461
12397
|
export interface File extends instanceOf<globalThis.File> {
|
|
@@ -12470,7 +12406,7 @@ export interface File extends instanceOf<globalThis.File> {
|
|
|
12470
12406
|
* The default JSON serializer encodes a `File` as `{ data, type, name, lastModified }`
|
|
12471
12407
|
* where `data` is base64-encoded.
|
|
12472
12408
|
*
|
|
12473
|
-
* @category
|
|
12409
|
+
* @category schemas
|
|
12474
12410
|
* @since 4.0.0
|
|
12475
12411
|
*/
|
|
12476
12412
|
export const File: File = instanceOf(globalThis.File, {
|
|
@@ -12494,10 +12430,10 @@ export const File: File = instanceOf(globalThis.File, {
|
|
|
12494
12430
|
SchemaTransformation.transformOrFail({
|
|
12495
12431
|
decode: (e) =>
|
|
12496
12432
|
Result_.match(Encoding.decodeBase64(e.data), {
|
|
12497
|
-
onFailure: (
|
|
12433
|
+
onFailure: () =>
|
|
12498
12434
|
Effect.fail(
|
|
12499
|
-
new SchemaIssue.InvalidValue(
|
|
12500
|
-
message:
|
|
12435
|
+
new SchemaIssue.InvalidValue({
|
|
12436
|
+
message: "Expected a valid Base64 string"
|
|
12501
12437
|
})
|
|
12502
12438
|
),
|
|
12503
12439
|
onSuccess: (bytes) => {
|
|
@@ -12518,9 +12454,9 @@ export const File: File = instanceOf(globalThis.File, {
|
|
|
12518
12454
|
lastModified: file.lastModified
|
|
12519
12455
|
}
|
|
12520
12456
|
},
|
|
12521
|
-
catch: (
|
|
12522
|
-
new SchemaIssue.InvalidValue(
|
|
12523
|
-
message:
|
|
12457
|
+
catch: () =>
|
|
12458
|
+
new SchemaIssue.InvalidValue({
|
|
12459
|
+
message: "Expected File to be readable"
|
|
12524
12460
|
})
|
|
12525
12461
|
})
|
|
12526
12462
|
})
|
|
@@ -12536,7 +12472,7 @@ export const File: File = instanceOf(globalThis.File, {
|
|
|
12536
12472
|
*
|
|
12537
12473
|
* @see {@link File} for the corresponding schema
|
|
12538
12474
|
*
|
|
12539
|
-
* @category
|
|
12475
|
+
* @category schemas
|
|
12540
12476
|
* @since 4.0.0
|
|
12541
12477
|
*/
|
|
12542
12478
|
export const FileReviver = makeFixedDeclarationReviver(
|
|
@@ -12547,7 +12483,7 @@ export const FileReviver = makeFixedDeclarationReviver(
|
|
|
12547
12483
|
/**
|
|
12548
12484
|
* Type-level representation of {@link FormData}.
|
|
12549
12485
|
*
|
|
12550
|
-
* @category
|
|
12486
|
+
* @category models
|
|
12551
12487
|
* @since 4.0.0
|
|
12552
12488
|
*/
|
|
12553
12489
|
export interface FormData extends instanceOf<globalThis.FormData> {
|
|
@@ -12562,7 +12498,7 @@ export interface FormData extends instanceOf<globalThis.FormData> {
|
|
|
12562
12498
|
* The default JSON serializer encodes a `FormData` as an array of `[key, entry]`
|
|
12563
12499
|
* pairs where each entry is tagged as `"String"` or `"File"`.
|
|
12564
12500
|
*
|
|
12565
|
-
* @category
|
|
12501
|
+
* @category schemas
|
|
12566
12502
|
* @since 4.0.0
|
|
12567
12503
|
*/
|
|
12568
12504
|
export const FormData: FormData = instanceOf(globalThis.FormData, {
|
|
@@ -12618,7 +12554,7 @@ export const FormData: FormData = instanceOf(globalThis.FormData, {
|
|
|
12618
12554
|
*
|
|
12619
12555
|
* @see {@link FormData} for the corresponding schema
|
|
12620
12556
|
*
|
|
12621
|
-
* @category
|
|
12557
|
+
* @category schemas
|
|
12622
12558
|
* @since 4.0.0
|
|
12623
12559
|
*/
|
|
12624
12560
|
export const FormDataReviver = makeFixedDeclarationReviver(
|
|
@@ -12629,7 +12565,7 @@ export const FormDataReviver = makeFixedDeclarationReviver(
|
|
|
12629
12565
|
/**
|
|
12630
12566
|
* Type-level representation returned by {@link fromFormData}.
|
|
12631
12567
|
*
|
|
12632
|
-
* @category
|
|
12568
|
+
* @category models
|
|
12633
12569
|
* @since 4.0.0
|
|
12634
12570
|
*/
|
|
12635
12571
|
export interface fromFormData<S extends Constraint> extends decodeTo<S, FormData> {
|
|
@@ -12657,7 +12593,7 @@ export interface fromFormData<S extends Constraint> extends decodeTo<S, FormData
|
|
|
12657
12593
|
*
|
|
12658
12594
|
* **Example** (Decoding a flat structure)
|
|
12659
12595
|
*
|
|
12660
|
-
* ```ts
|
|
12596
|
+
* ```ts import.meta.vitest
|
|
12661
12597
|
* import { Schema } from "effect"
|
|
12662
12598
|
*
|
|
12663
12599
|
* const schema = Schema.fromFormData(
|
|
@@ -12670,13 +12606,12 @@ export interface fromFormData<S extends Constraint> extends decodeTo<S, FormData
|
|
|
12670
12606
|
* formData.append("a", "1")
|
|
12671
12607
|
* formData.append("b", "2")
|
|
12672
12608
|
*
|
|
12673
|
-
*
|
|
12674
|
-
* // Success({"a":"1"})
|
|
12609
|
+
* Schema.decodeUnknownSync(schema)(formData) // => { a: "1" }
|
|
12675
12610
|
* ```
|
|
12676
12611
|
*
|
|
12677
12612
|
* **Example** (Decoding nested fields)
|
|
12678
12613
|
*
|
|
12679
|
-
* ```ts
|
|
12614
|
+
* ```ts import.meta.vitest
|
|
12680
12615
|
* import { Schema } from "effect"
|
|
12681
12616
|
*
|
|
12682
12617
|
* const schema = Schema.fromFormData(
|
|
@@ -12694,13 +12629,12 @@ export interface fromFormData<S extends Constraint> extends decodeTo<S, FormData
|
|
|
12694
12629
|
* formData.append("b[c]", "2")
|
|
12695
12630
|
* formData.append("b[d]", "3")
|
|
12696
12631
|
*
|
|
12697
|
-
*
|
|
12698
|
-
* // Success({"a":"1","b":{"c":"2","d":"3"}})
|
|
12632
|
+
* Schema.decodeUnknownSync(schema)(formData) // => { a: "1", b: { c: "2", d: "3" } }
|
|
12699
12633
|
* ```
|
|
12700
12634
|
*
|
|
12701
12635
|
* **Example** (Parsing non-string values)
|
|
12702
12636
|
*
|
|
12703
|
-
* ```ts
|
|
12637
|
+
* ```ts import.meta.vitest
|
|
12704
12638
|
* import { Schema } from "effect"
|
|
12705
12639
|
*
|
|
12706
12640
|
* const schema = Schema.fromFormData(
|
|
@@ -12714,8 +12648,7 @@ export interface fromFormData<S extends Constraint> extends decodeTo<S, FormData
|
|
|
12714
12648
|
* const formData = new FormData()
|
|
12715
12649
|
* formData.append("a", "1")
|
|
12716
12650
|
*
|
|
12717
|
-
*
|
|
12718
|
-
* // Success({"a":1}) // Note: the value is a number
|
|
12651
|
+
* Schema.decodeUnknownSync(schema)(formData) // => { a: 1 }
|
|
12719
12652
|
* ```
|
|
12720
12653
|
*
|
|
12721
12654
|
* @category decoding
|
|
@@ -12728,7 +12661,7 @@ export function fromFormData<S extends Constraint>(schema: S): fromFormData<S> {
|
|
|
12728
12661
|
/**
|
|
12729
12662
|
* Type-level representation of {@link URLSearchParams}.
|
|
12730
12663
|
*
|
|
12731
|
-
* @category
|
|
12664
|
+
* @category models
|
|
12732
12665
|
* @since 4.0.0
|
|
12733
12666
|
*/
|
|
12734
12667
|
export interface URLSearchParams extends instanceOf<globalThis.URLSearchParams> {
|
|
@@ -12742,7 +12675,7 @@ export interface URLSearchParams extends instanceOf<globalThis.URLSearchParams>
|
|
|
12742
12675
|
*
|
|
12743
12676
|
* The default JSON serializer encodes a `URLSearchParams` as a query string.
|
|
12744
12677
|
*
|
|
12745
|
-
* @category
|
|
12678
|
+
* @category schemas
|
|
12746
12679
|
* @since 4.0.0
|
|
12747
12680
|
*/
|
|
12748
12681
|
export const URLSearchParams: URLSearchParams = instanceOf(globalThis.URLSearchParams, {
|
|
@@ -12774,7 +12707,7 @@ export const URLSearchParams: URLSearchParams = instanceOf(globalThis.URLSearchP
|
|
|
12774
12707
|
*
|
|
12775
12708
|
* @see {@link URLSearchParams} for the corresponding schema
|
|
12776
12709
|
*
|
|
12777
|
-
* @category
|
|
12710
|
+
* @category schemas
|
|
12778
12711
|
* @since 4.0.0
|
|
12779
12712
|
*/
|
|
12780
12713
|
export const URLSearchParamsReviver = makeFixedDeclarationReviver(
|
|
@@ -12785,7 +12718,7 @@ export const URLSearchParamsReviver = makeFixedDeclarationReviver(
|
|
|
12785
12718
|
/**
|
|
12786
12719
|
* Type-level representation returned by {@link fromURLSearchParams}.
|
|
12787
12720
|
*
|
|
12788
|
-
* @category
|
|
12721
|
+
* @category models
|
|
12789
12722
|
* @since 4.0.0
|
|
12790
12723
|
*/
|
|
12791
12724
|
export interface fromURLSearchParams<S extends Constraint> extends decodeTo<S, URLSearchParams> {
|
|
@@ -12814,7 +12747,7 @@ export interface fromURLSearchParams<S extends Constraint> extends decodeTo<S, U
|
|
|
12814
12747
|
*
|
|
12815
12748
|
* **Example** (Decoding a flat structure)
|
|
12816
12749
|
*
|
|
12817
|
-
* ```ts
|
|
12750
|
+
* ```ts import.meta.vitest
|
|
12818
12751
|
* import { Schema } from "effect"
|
|
12819
12752
|
*
|
|
12820
12753
|
* const schema = Schema.fromURLSearchParams(
|
|
@@ -12825,13 +12758,12 @@ export interface fromURLSearchParams<S extends Constraint> extends decodeTo<S, U
|
|
|
12825
12758
|
*
|
|
12826
12759
|
* const urlSearchParams = new URLSearchParams("a=1&b=2")
|
|
12827
12760
|
*
|
|
12828
|
-
*
|
|
12829
|
-
* // Success({"a":"1"})
|
|
12761
|
+
* Schema.decodeUnknownSync(schema)(urlSearchParams) // => { a: "1" }
|
|
12830
12762
|
* ```
|
|
12831
12763
|
*
|
|
12832
12764
|
* **Example** (Decoding nested fields)
|
|
12833
12765
|
*
|
|
12834
|
-
* ```ts
|
|
12766
|
+
* ```ts import.meta.vitest
|
|
12835
12767
|
* import { Schema } from "effect"
|
|
12836
12768
|
*
|
|
12837
12769
|
* const schema = Schema.fromURLSearchParams(
|
|
@@ -12846,13 +12778,12 @@ export interface fromURLSearchParams<S extends Constraint> extends decodeTo<S, U
|
|
|
12846
12778
|
*
|
|
12847
12779
|
* const urlSearchParams = new URLSearchParams("a=1&b[c]=2&b[d]=3")
|
|
12848
12780
|
*
|
|
12849
|
-
*
|
|
12850
|
-
* // Success({"a":"1","b":{"c":"2","d":"3"}})
|
|
12781
|
+
* Schema.decodeUnknownSync(schema)(urlSearchParams) // => { a: "1", b: { c: "2", d: "3" } }
|
|
12851
12782
|
* ```
|
|
12852
12783
|
*
|
|
12853
12784
|
* **Example** (Parsing non-string values)
|
|
12854
12785
|
*
|
|
12855
|
-
* ```ts
|
|
12786
|
+
* ```ts import.meta.vitest
|
|
12856
12787
|
* import { Schema } from "effect"
|
|
12857
12788
|
*
|
|
12858
12789
|
* const schema = Schema.fromURLSearchParams(
|
|
@@ -12865,8 +12796,7 @@ export interface fromURLSearchParams<S extends Constraint> extends decodeTo<S, U
|
|
|
12865
12796
|
*
|
|
12866
12797
|
* const urlSearchParams = new URLSearchParams("a=1&b=2")
|
|
12867
12798
|
*
|
|
12868
|
-
*
|
|
12869
|
-
* // Success({"a":1}) // Note: the value is a number
|
|
12799
|
+
* Schema.decodeUnknownSync(schema)(urlSearchParams) // => { a: 1 }
|
|
12870
12800
|
* ```
|
|
12871
12801
|
*
|
|
12872
12802
|
* @category decoding
|
|
@@ -12879,7 +12809,7 @@ export function fromURLSearchParams<S extends Constraint>(schema: S): fromURLSea
|
|
|
12879
12809
|
/**
|
|
12880
12810
|
* Type-level representation of {@link NumberFromString}.
|
|
12881
12811
|
*
|
|
12882
|
-
* @category
|
|
12812
|
+
* @category models
|
|
12883
12813
|
* @since 3.10.0
|
|
12884
12814
|
*/
|
|
12885
12815
|
export interface NumberFromString extends decodeTo<Number, String> {
|
|
@@ -12900,7 +12830,7 @@ export interface NumberFromString extends decodeTo<Number, String> {
|
|
|
12900
12830
|
* Encoding:
|
|
12901
12831
|
* A number is encoded as a `string`.
|
|
12902
12832
|
*
|
|
12903
|
-
* @category
|
|
12833
|
+
* @category schemas
|
|
12904
12834
|
* @since 3.10.0
|
|
12905
12835
|
*/
|
|
12906
12836
|
export const NumberFromString: NumberFromString = String.annotate({
|
|
@@ -12910,7 +12840,7 @@ export const NumberFromString: NumberFromString = String.annotate({
|
|
|
12910
12840
|
/**
|
|
12911
12841
|
* Type-level representation of {@link FiniteFromString}.
|
|
12912
12842
|
*
|
|
12913
|
-
* @category
|
|
12843
|
+
* @category models
|
|
12914
12844
|
* @since 4.0.0
|
|
12915
12845
|
*/
|
|
12916
12846
|
export interface FiniteFromString extends decodeTo<Finite, String> {
|
|
@@ -12929,7 +12859,7 @@ export interface FiniteFromString extends decodeTo<Finite, String> {
|
|
|
12929
12859
|
* Encoding:
|
|
12930
12860
|
* - A finite number is encoded as a `string`.
|
|
12931
12861
|
*
|
|
12932
|
-
* @category
|
|
12862
|
+
* @category schemas
|
|
12933
12863
|
* @since 4.0.0
|
|
12934
12864
|
*/
|
|
12935
12865
|
export const FiniteFromString: FiniteFromString = String.annotate({
|
|
@@ -12939,7 +12869,7 @@ export const FiniteFromString: FiniteFromString = String.annotate({
|
|
|
12939
12869
|
/**
|
|
12940
12870
|
* Type-level representation of {@link BigIntFromString}.
|
|
12941
12871
|
*
|
|
12942
|
-
* @category
|
|
12872
|
+
* @category models
|
|
12943
12873
|
* @since 4.0.0
|
|
12944
12874
|
*/
|
|
12945
12875
|
export interface BigIntFromString extends decodeTo<BigInt, String> {
|
|
@@ -12971,7 +12901,7 @@ export interface BigIntFromString extends decodeTo<BigInt, String> {
|
|
|
12971
12901
|
* @see {@link NumberFromString} for parsing JavaScript number strings, including non-finite values
|
|
12972
12902
|
* @see {@link BigDecimalFromString} for parsing decimal number strings
|
|
12973
12903
|
*
|
|
12974
|
-
* @category
|
|
12904
|
+
* @category schemas
|
|
12975
12905
|
* @since 4.0.0
|
|
12976
12906
|
*/
|
|
12977
12907
|
export const BigIntFromString: BigIntFromString = make<String>(SchemaAST.bigIntString).pipe(
|
|
@@ -12981,7 +12911,7 @@ export const BigIntFromString: BigIntFromString = make<String>(SchemaAST.bigIntS
|
|
|
12981
12911
|
/**
|
|
12982
12912
|
* Type-level representation of {@link Trimmed}.
|
|
12983
12913
|
*
|
|
12984
|
-
* @category
|
|
12914
|
+
* @category models
|
|
12985
12915
|
* @since 3.10.0
|
|
12986
12916
|
*/
|
|
12987
12917
|
export interface Trimmed extends String {
|
|
@@ -12991,7 +12921,7 @@ export interface Trimmed extends String {
|
|
|
12991
12921
|
/**
|
|
12992
12922
|
* Schema for strings that contains no leading or trailing whitespaces.
|
|
12993
12923
|
*
|
|
12994
|
-
* @category
|
|
12924
|
+
* @category schemas
|
|
12995
12925
|
* @since 3.10.0
|
|
12996
12926
|
*/
|
|
12997
12927
|
export const Trimmed: Trimmed = String.check(isTrimmed())
|
|
@@ -12999,7 +12929,7 @@ export const Trimmed: Trimmed = String.check(isTrimmed())
|
|
|
12999
12929
|
/**
|
|
13000
12930
|
* Type-level representation of {@link Trim}.
|
|
13001
12931
|
*
|
|
13002
|
-
* @category
|
|
12932
|
+
* @category models
|
|
13003
12933
|
* @since 3.10.0
|
|
13004
12934
|
*/
|
|
13005
12935
|
export interface Trim extends decodeTo<Trimmed, String> {
|
|
@@ -13017,7 +12947,7 @@ export interface Trim extends decodeTo<Trimmed, String> {
|
|
|
13017
12947
|
* Encoding:
|
|
13018
12948
|
* - The trimmed string is encoded as is.
|
|
13019
12949
|
*
|
|
13020
|
-
* @category
|
|
12950
|
+
* @category schemas
|
|
13021
12951
|
* @since 3.10.0
|
|
13022
12952
|
*/
|
|
13023
12953
|
export const Trim: Trim = String.annotate({
|
|
@@ -13027,7 +12957,7 @@ export const Trim: Trim = String.annotate({
|
|
|
13027
12957
|
/**
|
|
13028
12958
|
* Type-level representation of {@link StringFromBase64}.
|
|
13029
12959
|
*
|
|
13030
|
-
* @category
|
|
12960
|
+
* @category models
|
|
13031
12961
|
* @since 3.10.0
|
|
13032
12962
|
*/
|
|
13033
12963
|
export interface StringFromBase64 extends decodeTo<String, String> {
|
|
@@ -13045,7 +12975,7 @@ export interface StringFromBase64 extends decodeTo<String, String> {
|
|
|
13045
12975
|
* Encoding:
|
|
13046
12976
|
* - A `string` is encoded as a base64-encoded string.
|
|
13047
12977
|
*
|
|
13048
|
-
* @category
|
|
12978
|
+
* @category schemas
|
|
13049
12979
|
* @since 3.10.0
|
|
13050
12980
|
*/
|
|
13051
12981
|
export const StringFromBase64: StringFromBase64 = String.annotate({
|
|
@@ -13057,7 +12987,7 @@ export const StringFromBase64: StringFromBase64 = String.annotate({
|
|
|
13057
12987
|
/**
|
|
13058
12988
|
* Type-level representation of {@link StringFromBase64Url}.
|
|
13059
12989
|
*
|
|
13060
|
-
* @category
|
|
12990
|
+
* @category models
|
|
13061
12991
|
* @since 3.10.0
|
|
13062
12992
|
*/
|
|
13063
12993
|
export interface StringFromBase64Url extends decodeTo<String, String> {
|
|
@@ -13075,7 +13005,7 @@ export interface StringFromBase64Url extends decodeTo<String, String> {
|
|
|
13075
13005
|
* Encoding:
|
|
13076
13006
|
* - A `string` is encoded as a base64 (URL) encoded string.
|
|
13077
13007
|
*
|
|
13078
|
-
* @category
|
|
13008
|
+
* @category schemas
|
|
13079
13009
|
* @since 3.10.0
|
|
13080
13010
|
*/
|
|
13081
13011
|
export const StringFromBase64Url: StringFromBase64Url = String.annotate({
|
|
@@ -13087,7 +13017,7 @@ export const StringFromBase64Url: StringFromBase64Url = String.annotate({
|
|
|
13087
13017
|
/**
|
|
13088
13018
|
* Type-level representation of {@link StringFromHex}.
|
|
13089
13019
|
*
|
|
13090
|
-
* @category
|
|
13020
|
+
* @category models
|
|
13091
13021
|
* @since 3.10.0
|
|
13092
13022
|
*/
|
|
13093
13023
|
export interface StringFromHex extends decodeTo<String, String> {
|
|
@@ -13105,7 +13035,7 @@ export interface StringFromHex extends decodeTo<String, String> {
|
|
|
13105
13035
|
* Encoding:
|
|
13106
13036
|
* - A `string` is encoded as a hex string.
|
|
13107
13037
|
*
|
|
13108
|
-
* @category
|
|
13038
|
+
* @category schemas
|
|
13109
13039
|
* @since 3.10.0
|
|
13110
13040
|
*/
|
|
13111
13041
|
export const StringFromHex: StringFromHex = String.annotate({
|
|
@@ -13117,7 +13047,7 @@ export const StringFromHex: StringFromHex = String.annotate({
|
|
|
13117
13047
|
/**
|
|
13118
13048
|
* Type-level representation of {@link StringFromUriComponent}.
|
|
13119
13049
|
*
|
|
13120
|
-
* @category
|
|
13050
|
+
* @category models
|
|
13121
13051
|
* @since 3.12.0
|
|
13122
13052
|
*/
|
|
13123
13053
|
export interface StringFromUriComponent extends decodeTo<String, String> {
|
|
@@ -13138,7 +13068,7 @@ export interface StringFromUriComponent extends decodeTo<String, String> {
|
|
|
13138
13068
|
*
|
|
13139
13069
|
* **Example** (Decoding URI component strings)
|
|
13140
13070
|
*
|
|
13141
|
-
* ```ts
|
|
13071
|
+
* ```ts import.meta.vitest
|
|
13142
13072
|
* import { Schema } from "effect"
|
|
13143
13073
|
*
|
|
13144
13074
|
* const PaginationSchema = Schema.Struct({
|
|
@@ -13150,11 +13080,10 @@ export interface StringFromUriComponent extends decodeTo<String, String> {
|
|
|
13150
13080
|
* Schema.decodeTo(Schema.fromJsonString(PaginationSchema))
|
|
13151
13081
|
* )
|
|
13152
13082
|
*
|
|
13153
|
-
*
|
|
13154
|
-
* // %7B%22maxItemPerPage%22%3A10%2C%22page%22%3A1%7D
|
|
13083
|
+
* Schema.encodeSync(UrlSchema)({ maxItemPerPage: 10, page: 1 }) // => "%7B%22maxItemPerPage%22%3A10%2C%22page%22%3A1%7D"
|
|
13155
13084
|
* ```
|
|
13156
13085
|
*
|
|
13157
|
-
* @category
|
|
13086
|
+
* @category schemas
|
|
13158
13087
|
* @since 3.12.0
|
|
13159
13088
|
*/
|
|
13160
13089
|
export const StringFromUriComponent: StringFromUriComponent = String.annotate({
|
|
@@ -13167,7 +13096,7 @@ export const StringFromUriComponent: StringFromUriComponent = String.annotate({
|
|
|
13167
13096
|
* Schema for property keys accepted by Effect schemas: finite `number`,
|
|
13168
13097
|
* `symbol`, or `string`.
|
|
13169
13098
|
*
|
|
13170
|
-
* @category
|
|
13099
|
+
* @category schemas
|
|
13171
13100
|
* @since 4.0.0
|
|
13172
13101
|
*/
|
|
13173
13102
|
export const PropertyKey = Union([Finite, Symbol, String])
|
|
@@ -13180,7 +13109,7 @@ export const PropertyKey = Union([Finite, Symbol, String])
|
|
|
13180
13109
|
* The result contains an `issues` array where each issue has a message and an
|
|
13181
13110
|
* optional path made of property keys or keyed path segments.
|
|
13182
13111
|
*
|
|
13183
|
-
* @category
|
|
13112
|
+
* @category schemas
|
|
13184
13113
|
* @since 4.0.0
|
|
13185
13114
|
*/
|
|
13186
13115
|
export const StandardSchemaV1FailureResult = Struct({
|
|
@@ -13193,7 +13122,7 @@ export const StandardSchemaV1FailureResult = Struct({
|
|
|
13193
13122
|
/**
|
|
13194
13123
|
* Type-level representation of {@link BooleanFromBit}.
|
|
13195
13124
|
*
|
|
13196
|
-
* @category
|
|
13125
|
+
* @category models
|
|
13197
13126
|
* @since 4.0.0
|
|
13198
13127
|
*/
|
|
13199
13128
|
export interface BooleanFromBit extends decodeTo<Boolean, Literals<readonly [0, 1]>> {
|
|
@@ -13216,7 +13145,7 @@ export interface BooleanFromBit extends decodeTo<Boolean, Literals<readonly [0,
|
|
|
13216
13145
|
* @see {@link Boolean} for validating values that are already booleans
|
|
13217
13146
|
* @see {@link Literals} for keeping bit literals instead of decoding them
|
|
13218
13147
|
*
|
|
13219
|
-
* @category
|
|
13148
|
+
* @category schemas
|
|
13220
13149
|
* @since 4.0.0
|
|
13221
13150
|
*/
|
|
13222
13151
|
export const BooleanFromBit: BooleanFromBit = Literals([0, 1]).pipe(
|
|
@@ -13232,7 +13161,7 @@ export const BooleanFromBit: BooleanFromBit = Literals([0, 1]).pipe(
|
|
|
13232
13161
|
/**
|
|
13233
13162
|
* Type-level representation of {@link Uint8Array}.
|
|
13234
13163
|
*
|
|
13235
|
-
* @category
|
|
13164
|
+
* @category models
|
|
13236
13165
|
* @since 4.0.0
|
|
13237
13166
|
*/
|
|
13238
13167
|
export interface Uint8Array extends instanceOf<globalThis.Uint8Array<ArrayBufferLike>> {
|
|
@@ -13254,7 +13183,7 @@ const Base64String = String.annotate({
|
|
|
13254
13183
|
*
|
|
13255
13184
|
* The default JSON serializer encodes Uint8Array as a Base64 encoded string.
|
|
13256
13185
|
*
|
|
13257
|
-
* @category
|
|
13186
|
+
* @category schemas
|
|
13258
13187
|
* @since 4.0.0
|
|
13259
13188
|
*/
|
|
13260
13189
|
export const Uint8Array: Uint8Array = instanceOf(globalThis.Uint8Array<ArrayBufferLike>, {
|
|
@@ -13284,7 +13213,7 @@ export const Uint8Array: Uint8Array = instanceOf(globalThis.Uint8Array<ArrayBuff
|
|
|
13284
13213
|
*
|
|
13285
13214
|
* @see {@link Uint8Array} for the corresponding schema
|
|
13286
13215
|
*
|
|
13287
|
-
* @category
|
|
13216
|
+
* @category schemas
|
|
13288
13217
|
* @since 4.0.0
|
|
13289
13218
|
*/
|
|
13290
13219
|
export const Uint8ArrayReviver = makeFixedDeclarationReviver(
|
|
@@ -13295,7 +13224,7 @@ export const Uint8ArrayReviver = makeFixedDeclarationReviver(
|
|
|
13295
13224
|
/**
|
|
13296
13225
|
* Type-level representation of {@link Uint8ArrayFromBase64}.
|
|
13297
13226
|
*
|
|
13298
|
-
* @category
|
|
13227
|
+
* @category models
|
|
13299
13228
|
* @since 3.10.0
|
|
13300
13229
|
*/
|
|
13301
13230
|
export interface Uint8ArrayFromBase64 extends decodeTo<Uint8Array, String> {
|
|
@@ -13314,7 +13243,7 @@ export interface Uint8ArrayFromBase64 extends decodeTo<Uint8Array, String> {
|
|
|
13314
13243
|
* Encoding:
|
|
13315
13244
|
* - A `Uint8Array` is encoded as a base64-encoded string.
|
|
13316
13245
|
*
|
|
13317
|
-
* @category
|
|
13246
|
+
* @category schemas
|
|
13318
13247
|
* @since 3.10.0
|
|
13319
13248
|
*/
|
|
13320
13249
|
export const Uint8ArrayFromBase64: Uint8ArrayFromBase64 = Base64String.pipe(
|
|
@@ -13324,7 +13253,7 @@ export const Uint8ArrayFromBase64: Uint8ArrayFromBase64 = Base64String.pipe(
|
|
|
13324
13253
|
/**
|
|
13325
13254
|
* Type-level representation of {@link Uint8ArrayFromBase64Url}.
|
|
13326
13255
|
*
|
|
13327
|
-
* @category
|
|
13256
|
+
* @category models
|
|
13328
13257
|
* @since 3.10.0
|
|
13329
13258
|
*/
|
|
13330
13259
|
export interface Uint8ArrayFromBase64Url extends decodeTo<Uint8Array, String> {
|
|
@@ -13343,7 +13272,7 @@ export interface Uint8ArrayFromBase64Url extends decodeTo<Uint8Array, String> {
|
|
|
13343
13272
|
* Encoding:
|
|
13344
13273
|
* - A `Uint8Array` is encoded as a base64 (URL) encoded string.
|
|
13345
13274
|
*
|
|
13346
|
-
* @category
|
|
13275
|
+
* @category schemas
|
|
13347
13276
|
* @since 3.10.0
|
|
13348
13277
|
*/
|
|
13349
13278
|
export const Uint8ArrayFromBase64Url: Uint8ArrayFromBase64Url = String.annotate({
|
|
@@ -13358,7 +13287,7 @@ export const Uint8ArrayFromBase64Url: Uint8ArrayFromBase64Url = String.annotate(
|
|
|
13358
13287
|
/**
|
|
13359
13288
|
* Type-level representation of {@link Uint8ArrayFromHex}.
|
|
13360
13289
|
*
|
|
13361
|
-
* @category
|
|
13290
|
+
* @category models
|
|
13362
13291
|
* @since 3.10.0
|
|
13363
13292
|
*/
|
|
13364
13293
|
export interface Uint8ArrayFromHex extends decodeTo<Uint8Array, String> {
|
|
@@ -13377,7 +13306,7 @@ export interface Uint8ArrayFromHex extends decodeTo<Uint8Array, String> {
|
|
|
13377
13306
|
* Encoding:
|
|
13378
13307
|
* - A `Uint8Array` is encoded as a hex encoded string.
|
|
13379
13308
|
*
|
|
13380
|
-
* @category
|
|
13309
|
+
* @category schemas
|
|
13381
13310
|
* @since 3.10.0
|
|
13382
13311
|
*/
|
|
13383
13312
|
export const Uint8ArrayFromHex: Uint8ArrayFromHex = String.annotate({
|
|
@@ -13392,7 +13321,7 @@ export const Uint8ArrayFromHex: Uint8ArrayFromHex = String.annotate({
|
|
|
13392
13321
|
/**
|
|
13393
13322
|
* Type-level representation of {@link DateTimeUtc}.
|
|
13394
13323
|
*
|
|
13395
|
-
* @category
|
|
13324
|
+
* @category models
|
|
13396
13325
|
* @since 3.10.0
|
|
13397
13326
|
*/
|
|
13398
13327
|
export interface DateTimeUtc extends declare<DateTime.Utc> {
|
|
@@ -13417,7 +13346,7 @@ export interface DateTimeUtc extends declare<DateTime.Utc> {
|
|
|
13417
13346
|
* @see {@link DateTimeUtcFromMillis} for decoding epoch milliseconds into UTC values
|
|
13418
13347
|
* @see {@link DateTimeZoned} for preserving zoned DateTime values
|
|
13419
13348
|
*
|
|
13420
|
-
* @category
|
|
13349
|
+
* @category schemas
|
|
13421
13350
|
* @since 3.10.0
|
|
13422
13351
|
*/
|
|
13423
13352
|
export const DateTimeUtc: DateTimeUtc = declare(
|
|
@@ -13459,7 +13388,7 @@ export const DateTimeUtc: DateTimeUtc = declare(
|
|
|
13459
13388
|
*
|
|
13460
13389
|
* @see {@link DateTimeUtc} for the corresponding schema
|
|
13461
13390
|
*
|
|
13462
|
-
* @category
|
|
13391
|
+
* @category schemas
|
|
13463
13392
|
* @since 4.0.0
|
|
13464
13393
|
*/
|
|
13465
13394
|
export const DateTimeUtcReviver = makeFixedDeclarationReviver(
|
|
@@ -13470,7 +13399,7 @@ export const DateTimeUtcReviver = makeFixedDeclarationReviver(
|
|
|
13470
13399
|
/**
|
|
13471
13400
|
* Type-level representation of {@link DateTimeUtcFromDate}.
|
|
13472
13401
|
*
|
|
13473
|
-
* @category
|
|
13402
|
+
* @category models
|
|
13474
13403
|
* @since 3.12.0
|
|
13475
13404
|
*/
|
|
13476
13405
|
export interface DateTimeUtcFromDate extends decodeTo<DateTimeUtc, Date> {
|
|
@@ -13498,7 +13427,7 @@ export interface DateTimeUtcFromDate extends decodeTo<DateTimeUtc, Date> {
|
|
|
13498
13427
|
* @see {@link DateTimeUtcFromMillis} for decoding epoch milliseconds into UTC values
|
|
13499
13428
|
* @see {@link Date} for validating Date instances without converting them
|
|
13500
13429
|
*
|
|
13501
|
-
* @category
|
|
13430
|
+
* @category schemas
|
|
13502
13431
|
* @since 3.12.0
|
|
13503
13432
|
*/
|
|
13504
13433
|
export const DateTimeUtcFromDate: DateTimeUtcFromDate = Date.pipe(
|
|
@@ -13511,7 +13440,7 @@ export const DateTimeUtcFromDate: DateTimeUtcFromDate = Date.pipe(
|
|
|
13511
13440
|
/**
|
|
13512
13441
|
* Type-level representation of {@link DateTimeUtcFromString}.
|
|
13513
13442
|
*
|
|
13514
|
-
* @category
|
|
13443
|
+
* @category models
|
|
13515
13444
|
* @since 4.0.0
|
|
13516
13445
|
*/
|
|
13517
13446
|
export interface DateTimeUtcFromString extends decodeTo<DateTimeUtc, String> {
|
|
@@ -13536,7 +13465,7 @@ export interface DateTimeUtcFromString extends decodeTo<DateTimeUtc, String> {
|
|
|
13536
13465
|
* @see {@link DateTimeUtcFromMillis} for decoding epoch milliseconds into UTC values
|
|
13537
13466
|
* @see {@link DateFromString} for decoding strings into JavaScript Date instances
|
|
13538
13467
|
*
|
|
13539
|
-
* @category
|
|
13468
|
+
* @category schemas
|
|
13540
13469
|
* @since 4.0.0
|
|
13541
13470
|
*/
|
|
13542
13471
|
export const DateTimeUtcFromString: DateTimeUtcFromString = String.annotate({
|
|
@@ -13551,7 +13480,7 @@ export const DateTimeUtcFromString: DateTimeUtcFromString = String.annotate({
|
|
|
13551
13480
|
/**
|
|
13552
13481
|
* Type-level representation of {@link DateTimeUtcFromMillis}.
|
|
13553
13482
|
*
|
|
13554
|
-
* @category
|
|
13483
|
+
* @category models
|
|
13555
13484
|
* @since 4.0.0
|
|
13556
13485
|
*/
|
|
13557
13486
|
export interface DateTimeUtcFromMillis extends decodeTo<instanceOf<DateTime.Utc>, Int> {
|
|
@@ -13573,7 +13502,7 @@ export interface DateTimeUtcFromMillis extends decodeTo<instanceOf<DateTime.Utc>
|
|
|
13573
13502
|
* @see {@link DateTimeUtcFromString} for decoding date-time strings into UTC values
|
|
13574
13503
|
* @see {@link DateFromMillis} for decoding epoch milliseconds into JavaScript Date instances
|
|
13575
13504
|
*
|
|
13576
|
-
* @category
|
|
13505
|
+
* @category schemas
|
|
13577
13506
|
* @since 4.0.0
|
|
13578
13507
|
*/
|
|
13579
13508
|
export const DateTimeUtcFromMillis: DateTimeUtcFromMillis = Int.pipe(
|
|
@@ -13586,7 +13515,7 @@ export const DateTimeUtcFromMillis: DateTimeUtcFromMillis = Int.pipe(
|
|
|
13586
13515
|
/**
|
|
13587
13516
|
* Type-level representation of {@link TimeZoneOffset}.
|
|
13588
13517
|
*
|
|
13589
|
-
* @category
|
|
13518
|
+
* @category models
|
|
13590
13519
|
* @since 3.10.0
|
|
13591
13520
|
*/
|
|
13592
13521
|
export interface TimeZoneOffset extends declare<DateTime.TimeZone.Offset> {
|
|
@@ -13602,7 +13531,7 @@ export interface TimeZoneOffset extends declare<DateTime.TimeZone.Offset> {
|
|
|
13602
13531
|
*
|
|
13603
13532
|
* - encodes `DateTime.TimeZone.Offset` as a number (offset in milliseconds)
|
|
13604
13533
|
*
|
|
13605
|
-
* @category
|
|
13534
|
+
* @category schemas
|
|
13606
13535
|
* @since 3.10.0
|
|
13607
13536
|
*/
|
|
13608
13537
|
export const TimeZoneOffset: TimeZoneOffset = declare(
|
|
@@ -13639,7 +13568,7 @@ export const TimeZoneOffset: TimeZoneOffset = declare(
|
|
|
13639
13568
|
*
|
|
13640
13569
|
* @see {@link TimeZoneOffset} for the corresponding schema
|
|
13641
13570
|
*
|
|
13642
|
-
* @category
|
|
13571
|
+
* @category schemas
|
|
13643
13572
|
* @since 4.0.0
|
|
13644
13573
|
*/
|
|
13645
13574
|
export const TimeZoneOffsetReviver = makeFixedDeclarationReviver(
|
|
@@ -13650,7 +13579,7 @@ export const TimeZoneOffsetReviver = makeFixedDeclarationReviver(
|
|
|
13650
13579
|
/**
|
|
13651
13580
|
* Type-level representation of {@link TimeZoneNamed}.
|
|
13652
13581
|
*
|
|
13653
|
-
* @category
|
|
13582
|
+
* @category models
|
|
13654
13583
|
* @since 3.10.0
|
|
13655
13584
|
*/
|
|
13656
13585
|
export interface TimeZoneNamed extends declare<DateTime.TimeZone.Named> {
|
|
@@ -13668,7 +13597,7 @@ const TimeZoneNamedString = String.annotate({ expected: "an IANA time zone ident
|
|
|
13668
13597
|
*
|
|
13669
13598
|
* - encodes `DateTime.TimeZone.Named` as a string (IANA time zone identifier)
|
|
13670
13599
|
*
|
|
13671
|
-
* @category
|
|
13600
|
+
* @category schemas
|
|
13672
13601
|
* @since 3.10.0
|
|
13673
13602
|
*/
|
|
13674
13603
|
export const TimeZoneNamed: TimeZoneNamed = declare(
|
|
@@ -13709,7 +13638,7 @@ export const TimeZoneNamed: TimeZoneNamed = declare(
|
|
|
13709
13638
|
*
|
|
13710
13639
|
* @see {@link TimeZoneNamed} for the corresponding schema
|
|
13711
13640
|
*
|
|
13712
|
-
* @category
|
|
13641
|
+
* @category schemas
|
|
13713
13642
|
* @since 4.0.0
|
|
13714
13643
|
*/
|
|
13715
13644
|
export const TimeZoneNamedReviver = makeFixedDeclarationReviver(
|
|
@@ -13720,7 +13649,7 @@ export const TimeZoneNamedReviver = makeFixedDeclarationReviver(
|
|
|
13720
13649
|
/**
|
|
13721
13650
|
* Type-level representation of {@link TimeZoneNamedFromString}.
|
|
13722
13651
|
*
|
|
13723
|
-
* @category
|
|
13652
|
+
* @category models
|
|
13724
13653
|
* @since 4.0.0
|
|
13725
13654
|
*/
|
|
13726
13655
|
export interface TimeZoneNamedFromString extends decodeTo<TimeZoneNamed, String> {
|
|
@@ -13738,7 +13667,7 @@ export interface TimeZoneNamedFromString extends decodeTo<TimeZoneNamed, String>
|
|
|
13738
13667
|
* Encoding:
|
|
13739
13668
|
* - A `DateTime.TimeZone.Named` is encoded as a `string`.
|
|
13740
13669
|
*
|
|
13741
|
-
* @category
|
|
13670
|
+
* @category schemas
|
|
13742
13671
|
* @since 4.0.0
|
|
13743
13672
|
*/
|
|
13744
13673
|
export const TimeZoneNamedFromString: TimeZoneNamedFromString = TimeZoneNamedString.pipe(
|
|
@@ -13748,7 +13677,7 @@ export const TimeZoneNamedFromString: TimeZoneNamedFromString = TimeZoneNamedStr
|
|
|
13748
13677
|
/**
|
|
13749
13678
|
* Type-level representation of {@link TimeZone}.
|
|
13750
13679
|
*
|
|
13751
|
-
* @category
|
|
13680
|
+
* @category models
|
|
13752
13681
|
* @since 3.10.0
|
|
13753
13682
|
*/
|
|
13754
13683
|
export interface TimeZone extends declare<DateTime.TimeZone> {
|
|
@@ -13769,7 +13698,7 @@ const TimeZoneString = String.annotate({
|
|
|
13769
13698
|
* - encodes `DateTime.TimeZone` as a string (IANA identifier or offset like
|
|
13770
13699
|
* `+03:00`)
|
|
13771
13700
|
*
|
|
13772
|
-
* @category
|
|
13701
|
+
* @category schemas
|
|
13773
13702
|
* @since 3.10.0
|
|
13774
13703
|
*/
|
|
13775
13704
|
export const TimeZone: TimeZone = declare(
|
|
@@ -13813,7 +13742,7 @@ export const TimeZone: TimeZone = declare(
|
|
|
13813
13742
|
*
|
|
13814
13743
|
* @see {@link TimeZone} for the corresponding schema
|
|
13815
13744
|
*
|
|
13816
|
-
* @category
|
|
13745
|
+
* @category schemas
|
|
13817
13746
|
* @since 4.0.0
|
|
13818
13747
|
*/
|
|
13819
13748
|
export const TimeZoneReviver = makeFixedDeclarationReviver(
|
|
@@ -13824,7 +13753,7 @@ export const TimeZoneReviver = makeFixedDeclarationReviver(
|
|
|
13824
13753
|
/**
|
|
13825
13754
|
* Type-level representation of {@link TimeZoneFromString}.
|
|
13826
13755
|
*
|
|
13827
|
-
* @category
|
|
13756
|
+
* @category models
|
|
13828
13757
|
* @since 4.0.0
|
|
13829
13758
|
*/
|
|
13830
13759
|
export interface TimeZoneFromString extends decodeTo<TimeZone, String> {
|
|
@@ -13842,7 +13771,7 @@ export interface TimeZoneFromString extends decodeTo<TimeZone, String> {
|
|
|
13842
13771
|
* Encoding:
|
|
13843
13772
|
* - A `DateTime.TimeZone` is encoded as a `string`.
|
|
13844
13773
|
*
|
|
13845
|
-
* @category
|
|
13774
|
+
* @category schemas
|
|
13846
13775
|
* @since 4.0.0
|
|
13847
13776
|
*/
|
|
13848
13777
|
export const TimeZoneFromString: TimeZoneFromString = TimeZoneString.pipe(
|
|
@@ -13852,7 +13781,7 @@ export const TimeZoneFromString: TimeZoneFromString = TimeZoneString.pipe(
|
|
|
13852
13781
|
/**
|
|
13853
13782
|
* Type-level representation of {@link DateTimeZoned}.
|
|
13854
13783
|
*
|
|
13855
|
-
* @category
|
|
13784
|
+
* @category models
|
|
13856
13785
|
* @since 3.10.0
|
|
13857
13786
|
*/
|
|
13858
13787
|
export interface DateTimeZoned extends declare<DateTime.Zoned> {
|
|
@@ -13875,7 +13804,7 @@ const DateTimeZonedString = String.annotate({
|
|
|
13875
13804
|
* - encodes named zones by appending the IANA identifier in brackets, such as
|
|
13876
13805
|
* `YYYY-MM-DDTHH:mm:ss.sss+HH:MM[Time/Zone]`
|
|
13877
13806
|
*
|
|
13878
|
-
* @category
|
|
13807
|
+
* @category schemas
|
|
13879
13808
|
* @since 3.10.0
|
|
13880
13809
|
*/
|
|
13881
13810
|
export const DateTimeZoned: DateTimeZoned = declare(
|
|
@@ -13923,7 +13852,7 @@ export const DateTimeZoned: DateTimeZoned = declare(
|
|
|
13923
13852
|
*
|
|
13924
13853
|
* @see {@link DateTimeZoned} for the corresponding schema
|
|
13925
13854
|
*
|
|
13926
|
-
* @category
|
|
13855
|
+
* @category schemas
|
|
13927
13856
|
* @since 4.0.0
|
|
13928
13857
|
*/
|
|
13929
13858
|
export const DateTimeZonedReviver = makeFixedDeclarationReviver(
|
|
@@ -13934,7 +13863,7 @@ export const DateTimeZonedReviver = makeFixedDeclarationReviver(
|
|
|
13934
13863
|
/**
|
|
13935
13864
|
* Type-level representation of {@link DateTimeZonedFromString}.
|
|
13936
13865
|
*
|
|
13937
|
-
* @category
|
|
13866
|
+
* @category models
|
|
13938
13867
|
* @since 4.0.0
|
|
13939
13868
|
*/
|
|
13940
13869
|
export interface DateTimeZonedFromString extends decodeTo<DateTimeZoned, String> {
|
|
@@ -13952,7 +13881,7 @@ export interface DateTimeZonedFromString extends decodeTo<DateTimeZoned, String>
|
|
|
13952
13881
|
* Encoding:
|
|
13953
13882
|
* - A `DateTime.Zoned` is encoded as a `string`.
|
|
13954
13883
|
*
|
|
13955
|
-
* @category
|
|
13884
|
+
* @category schemas
|
|
13956
13885
|
* @since 4.0.0
|
|
13957
13886
|
*/
|
|
13958
13887
|
export const DateTimeZonedFromString: DateTimeZonedFromString = DateTimeZonedString.pipe(
|
|
@@ -14172,7 +14101,14 @@ function makeClass<
|
|
|
14172
14101
|
|
|
14173
14102
|
function getClassTransformation(self: new(...args: ReadonlyArray<any>) => any) {
|
|
14174
14103
|
return new SchemaTransformation.Transformation<any, any, never, never>(
|
|
14175
|
-
SchemaGetter.transform((input) =>
|
|
14104
|
+
SchemaGetter.transform((input) =>
|
|
14105
|
+
new self(input, {
|
|
14106
|
+
"~payload": {
|
|
14107
|
+
token: payloadToken,
|
|
14108
|
+
value: input
|
|
14109
|
+
}
|
|
14110
|
+
})
|
|
14111
|
+
),
|
|
14176
14112
|
SchemaGetter.passthrough()
|
|
14177
14113
|
)
|
|
14178
14114
|
}
|
|
@@ -14201,7 +14137,7 @@ function getClassSchemaFactory<S extends Constraint>(
|
|
|
14201
14137
|
return input instanceof self ||
|
|
14202
14138
|
Predicate.hasProperty(input, getClassTypeId(identifier)) ?
|
|
14203
14139
|
Effect.succeed(input) :
|
|
14204
|
-
Effect.fail(new SchemaIssue.InvalidType(ast
|
|
14140
|
+
Effect.fail(new SchemaIssue.InvalidType(ast))
|
|
14205
14141
|
},
|
|
14206
14142
|
{
|
|
14207
14143
|
identifier,
|
|
@@ -14244,13 +14180,23 @@ type MissingSelfGeneric<Usage extends string> =
|
|
|
14244
14180
|
* Pass the desired class type as the first type parameter. The second optional
|
|
14245
14181
|
* type parameter can be used to add nominal brands.
|
|
14246
14182
|
*
|
|
14183
|
+
* The `identifier` is the schema's stable runtime name. It is exposed on the
|
|
14184
|
+
* class, stored in the schema AST, and used to label diagnostics and generated
|
|
14185
|
+
* references as well as to format class instances.
|
|
14186
|
+
*
|
|
14187
|
+
* It also derives a runtime marker that recognizes instances across hot module
|
|
14188
|
+
* reloads, where `instanceof` can fail because the constructor has been
|
|
14189
|
+
* replaced. The identifier is explicit because the outer JavaScript class name
|
|
14190
|
+
* is not available while the `extends` expression is evaluated and may change
|
|
14191
|
+
* through renaming or minification.
|
|
14192
|
+
*
|
|
14247
14193
|
* **Gotchas**
|
|
14248
14194
|
*
|
|
14249
14195
|
* Passing `disableChecks` in the options skips constructor validation.
|
|
14250
14196
|
*
|
|
14251
14197
|
* **Example** (Defining a basic class)
|
|
14252
14198
|
*
|
|
14253
|
-
* ```ts
|
|
14199
|
+
* ```ts import.meta.vitest
|
|
14254
14200
|
* import { Schema } from "effect"
|
|
14255
14201
|
*
|
|
14256
14202
|
* class Person extends Schema.Class<Person>("Person")({
|
|
@@ -14259,13 +14205,13 @@ type MissingSelfGeneric<Usage extends string> =
|
|
|
14259
14205
|
* }) {}
|
|
14260
14206
|
*
|
|
14261
14207
|
* const alice = new Person({ name: "Alice", age: 30 })
|
|
14262
|
-
*
|
|
14263
|
-
*
|
|
14208
|
+
* alice.name // => "Alice"
|
|
14209
|
+
* String(alice) // => "Person({\"name\":\"Alice\",\"age\":30})"
|
|
14264
14210
|
* ```
|
|
14265
14211
|
*
|
|
14266
14212
|
* **Example** (Extending a class)
|
|
14267
14213
|
*
|
|
14268
|
-
* ```ts
|
|
14214
|
+
* ```ts import.meta.vitest
|
|
14269
14215
|
* import { Schema } from "effect"
|
|
14270
14216
|
*
|
|
14271
14217
|
* class Animal extends Schema.Class<Animal>("Animal")({
|
|
@@ -14277,8 +14223,8 @@ type MissingSelfGeneric<Usage extends string> =
|
|
|
14277
14223
|
* }) {}
|
|
14278
14224
|
*
|
|
14279
14225
|
* const dog = new Dog({ name: "Rex", breed: "Labrador" })
|
|
14280
|
-
*
|
|
14281
|
-
*
|
|
14226
|
+
* dog.name // => "Rex"
|
|
14227
|
+
* dog.breed // => "Labrador"
|
|
14282
14228
|
* ```
|
|
14283
14229
|
*
|
|
14284
14230
|
* @see {@link TaggedClass} for adding a `_tag` literal field to the class schema
|
|
@@ -14304,13 +14250,23 @@ export const Class: {
|
|
|
14304
14250
|
* Pass the desired class type as the first type parameter. The second optional
|
|
14305
14251
|
* type parameter can be used to add nominal brands.
|
|
14306
14252
|
*
|
|
14253
|
+
* The `identifier` is the schema's stable runtime name. It is exposed on the
|
|
14254
|
+
* class, stored in the schema AST, and used to label diagnostics and generated
|
|
14255
|
+
* references as well as to format class instances.
|
|
14256
|
+
*
|
|
14257
|
+
* It also derives a runtime marker that recognizes instances across hot module
|
|
14258
|
+
* reloads, where `instanceof` can fail because the constructor has been
|
|
14259
|
+
* replaced. The identifier is explicit because the outer JavaScript class name
|
|
14260
|
+
* is not available while the `extends` expression is evaluated and may change
|
|
14261
|
+
* through renaming or minification.
|
|
14262
|
+
*
|
|
14307
14263
|
* **Gotchas**
|
|
14308
14264
|
*
|
|
14309
14265
|
* Passing `disableChecks` in the options skips constructor validation.
|
|
14310
14266
|
*
|
|
14311
14267
|
* **Example** (Defining a basic class)
|
|
14312
14268
|
*
|
|
14313
|
-
* ```ts
|
|
14269
|
+
* ```ts import.meta.vitest
|
|
14314
14270
|
* import { Schema } from "effect"
|
|
14315
14271
|
*
|
|
14316
14272
|
* class Person extends Schema.Class<Person>("Person")({
|
|
@@ -14319,13 +14275,13 @@ export const Class: {
|
|
|
14319
14275
|
* }) {}
|
|
14320
14276
|
*
|
|
14321
14277
|
* const alice = new Person({ name: "Alice", age: 30 })
|
|
14322
|
-
*
|
|
14323
|
-
*
|
|
14278
|
+
* alice.name // => "Alice"
|
|
14279
|
+
* String(alice) // => "Person({\"name\":\"Alice\",\"age\":30})"
|
|
14324
14280
|
* ```
|
|
14325
14281
|
*
|
|
14326
14282
|
* **Example** (Extending a class)
|
|
14327
14283
|
*
|
|
14328
|
-
* ```ts
|
|
14284
|
+
* ```ts import.meta.vitest
|
|
14329
14285
|
* import { Schema } from "effect"
|
|
14330
14286
|
*
|
|
14331
14287
|
* class Animal extends Schema.Class<Animal>("Animal")({
|
|
@@ -14337,8 +14293,8 @@ export const Class: {
|
|
|
14337
14293
|
* }) {}
|
|
14338
14294
|
*
|
|
14339
14295
|
* const dog = new Dog({ name: "Rex", breed: "Labrador" })
|
|
14340
|
-
*
|
|
14341
|
-
*
|
|
14296
|
+
* dog.name // => "Rex"
|
|
14297
|
+
* dog.breed // => "Labrador"
|
|
14342
14298
|
* ```
|
|
14343
14299
|
*
|
|
14344
14300
|
* @see {@link TaggedClass} for adding a `_tag` literal field to the class schema
|
|
@@ -14364,13 +14320,23 @@ export const Class: {
|
|
|
14364
14320
|
* Pass the desired class type as the first type parameter. The second optional
|
|
14365
14321
|
* type parameter can be used to add nominal brands.
|
|
14366
14322
|
*
|
|
14323
|
+
* The `identifier` is the schema's stable runtime name. It is exposed on the
|
|
14324
|
+
* class, stored in the schema AST, and used to label diagnostics and generated
|
|
14325
|
+
* references as well as to format class instances.
|
|
14326
|
+
*
|
|
14327
|
+
* It also derives a runtime marker that recognizes instances across hot module
|
|
14328
|
+
* reloads, where `instanceof` can fail because the constructor has been
|
|
14329
|
+
* replaced. The identifier is explicit because the outer JavaScript class name
|
|
14330
|
+
* is not available while the `extends` expression is evaluated and may change
|
|
14331
|
+
* through renaming or minification.
|
|
14332
|
+
*
|
|
14367
14333
|
* **Gotchas**
|
|
14368
14334
|
*
|
|
14369
14335
|
* Passing `disableChecks` in the options skips constructor validation.
|
|
14370
14336
|
*
|
|
14371
14337
|
* **Example** (Defining a basic class)
|
|
14372
14338
|
*
|
|
14373
|
-
* ```ts
|
|
14339
|
+
* ```ts import.meta.vitest
|
|
14374
14340
|
* import { Schema } from "effect"
|
|
14375
14341
|
*
|
|
14376
14342
|
* class Person extends Schema.Class<Person>("Person")({
|
|
@@ -14379,13 +14345,13 @@ export const Class: {
|
|
|
14379
14345
|
* }) {}
|
|
14380
14346
|
*
|
|
14381
14347
|
* const alice = new Person({ name: "Alice", age: 30 })
|
|
14382
|
-
*
|
|
14383
|
-
*
|
|
14348
|
+
* alice.name // => "Alice"
|
|
14349
|
+
* String(alice) // => "Person({\"name\":\"Alice\",\"age\":30})"
|
|
14384
14350
|
* ```
|
|
14385
14351
|
*
|
|
14386
14352
|
* **Example** (Extending a class)
|
|
14387
14353
|
*
|
|
14388
|
-
* ```ts
|
|
14354
|
+
* ```ts import.meta.vitest
|
|
14389
14355
|
* import { Schema } from "effect"
|
|
14390
14356
|
*
|
|
14391
14357
|
* class Animal extends Schema.Class<Animal>("Animal")({
|
|
@@ -14397,8 +14363,8 @@ export const Class: {
|
|
|
14397
14363
|
* }) {}
|
|
14398
14364
|
*
|
|
14399
14365
|
* const dog = new Dog({ name: "Rex", breed: "Labrador" })
|
|
14400
|
-
*
|
|
14401
|
-
*
|
|
14366
|
+
* dog.name // => "Rex"
|
|
14367
|
+
* dog.breed // => "Labrador"
|
|
14402
14368
|
* ```
|
|
14403
14369
|
*
|
|
14404
14370
|
* @see {@link TaggedClass} for adding a `_tag` literal field to the class schema
|
|
@@ -14427,13 +14393,23 @@ export const Class: {
|
|
|
14427
14393
|
* Pass the desired class type as the first type parameter. The second optional
|
|
14428
14394
|
* type parameter can be used to add nominal brands.
|
|
14429
14395
|
*
|
|
14396
|
+
* The `identifier` is the schema's stable runtime name. It is exposed on the
|
|
14397
|
+
* class, stored in the schema AST, and used to label diagnostics and generated
|
|
14398
|
+
* references as well as to format class instances.
|
|
14399
|
+
*
|
|
14400
|
+
* It also derives a runtime marker that recognizes instances across hot module
|
|
14401
|
+
* reloads, where `instanceof` can fail because the constructor has been
|
|
14402
|
+
* replaced. The identifier is explicit because the outer JavaScript class name
|
|
14403
|
+
* is not available while the `extends` expression is evaluated and may change
|
|
14404
|
+
* through renaming or minification.
|
|
14405
|
+
*
|
|
14430
14406
|
* **Gotchas**
|
|
14431
14407
|
*
|
|
14432
14408
|
* Passing `disableChecks` in the options skips constructor validation.
|
|
14433
14409
|
*
|
|
14434
14410
|
* **Example** (Defining a basic class)
|
|
14435
14411
|
*
|
|
14436
|
-
* ```ts
|
|
14412
|
+
* ```ts import.meta.vitest
|
|
14437
14413
|
* import { Schema } from "effect"
|
|
14438
14414
|
*
|
|
14439
14415
|
* class Person extends Schema.Class<Person>("Person")({
|
|
@@ -14442,13 +14418,13 @@ export const Class: {
|
|
|
14442
14418
|
* }) {}
|
|
14443
14419
|
*
|
|
14444
14420
|
* const alice = new Person({ name: "Alice", age: 30 })
|
|
14445
|
-
*
|
|
14446
|
-
*
|
|
14421
|
+
* alice.name // => "Alice"
|
|
14422
|
+
* String(alice) // => "Person({\"name\":\"Alice\",\"age\":30})"
|
|
14447
14423
|
* ```
|
|
14448
14424
|
*
|
|
14449
14425
|
* **Example** (Extending a class)
|
|
14450
14426
|
*
|
|
14451
|
-
* ```ts
|
|
14427
|
+
* ```ts import.meta.vitest
|
|
14452
14428
|
* import { Schema } from "effect"
|
|
14453
14429
|
*
|
|
14454
14430
|
* class Animal extends Schema.Class<Animal>("Animal")({
|
|
@@ -14460,8 +14436,8 @@ export const Class: {
|
|
|
14460
14436
|
* }) {}
|
|
14461
14437
|
*
|
|
14462
14438
|
* const dog = new Dog({ name: "Rex", breed: "Labrador" })
|
|
14463
|
-
*
|
|
14464
|
-
*
|
|
14439
|
+
* dog.name // => "Rex"
|
|
14440
|
+
* dog.breed // => "Labrador"
|
|
14465
14441
|
* ```
|
|
14466
14442
|
*
|
|
14467
14443
|
* @see {@link TaggedClass} for adding a `_tag` literal field to the class schema
|
|
@@ -14507,7 +14483,7 @@ export const Class: {
|
|
|
14507
14483
|
*
|
|
14508
14484
|
* **Example** (Defining a tagged class)
|
|
14509
14485
|
*
|
|
14510
|
-
* ```ts
|
|
14486
|
+
* ```ts import.meta.vitest
|
|
14511
14487
|
* import { Schema } from "effect"
|
|
14512
14488
|
*
|
|
14513
14489
|
* class Circle extends Schema.TaggedClass<Circle>()("Circle", {
|
|
@@ -14515,8 +14491,8 @@ export const Class: {
|
|
|
14515
14491
|
* }) {}
|
|
14516
14492
|
*
|
|
14517
14493
|
* const c = new Circle({ radius: 5 })
|
|
14518
|
-
*
|
|
14519
|
-
*
|
|
14494
|
+
* c._tag // => "Circle"
|
|
14495
|
+
* c.radius // => 5
|
|
14520
14496
|
* ```
|
|
14521
14497
|
*
|
|
14522
14498
|
* @category constructors
|
|
@@ -14538,7 +14514,7 @@ export const TaggedClass: {
|
|
|
14538
14514
|
*
|
|
14539
14515
|
* **Example** (Defining a tagged class)
|
|
14540
14516
|
*
|
|
14541
|
-
* ```ts
|
|
14517
|
+
* ```ts import.meta.vitest
|
|
14542
14518
|
* import { Schema } from "effect"
|
|
14543
14519
|
*
|
|
14544
14520
|
* class Circle extends Schema.TaggedClass<Circle>()("Circle", {
|
|
@@ -14546,8 +14522,8 @@ export const TaggedClass: {
|
|
|
14546
14522
|
* }) {}
|
|
14547
14523
|
*
|
|
14548
14524
|
* const c = new Circle({ radius: 5 })
|
|
14549
|
-
*
|
|
14550
|
-
*
|
|
14525
|
+
* c._tag // => "Circle"
|
|
14526
|
+
* c.radius // => 5
|
|
14551
14527
|
* ```
|
|
14552
14528
|
*
|
|
14553
14529
|
* @category constructors
|
|
@@ -14569,7 +14545,7 @@ export const TaggedClass: {
|
|
|
14569
14545
|
*
|
|
14570
14546
|
* **Example** (Defining a tagged class)
|
|
14571
14547
|
*
|
|
14572
|
-
* ```ts
|
|
14548
|
+
* ```ts import.meta.vitest
|
|
14573
14549
|
* import { Schema } from "effect"
|
|
14574
14550
|
*
|
|
14575
14551
|
* class Circle extends Schema.TaggedClass<Circle>()("Circle", {
|
|
@@ -14577,8 +14553,8 @@ export const TaggedClass: {
|
|
|
14577
14553
|
* }) {}
|
|
14578
14554
|
*
|
|
14579
14555
|
* const c = new Circle({ radius: 5 })
|
|
14580
|
-
*
|
|
14581
|
-
*
|
|
14556
|
+
* c._tag // => "Circle"
|
|
14557
|
+
* c.radius // => 5
|
|
14582
14558
|
* ```
|
|
14583
14559
|
*
|
|
14584
14560
|
* @category constructors
|
|
@@ -14604,7 +14580,7 @@ export const TaggedClass: {
|
|
|
14604
14580
|
*
|
|
14605
14581
|
* **Example** (Defining a tagged class)
|
|
14606
14582
|
*
|
|
14607
|
-
* ```ts
|
|
14583
|
+
* ```ts import.meta.vitest
|
|
14608
14584
|
* import { Schema } from "effect"
|
|
14609
14585
|
*
|
|
14610
14586
|
* class Circle extends Schema.TaggedClass<Circle>()("Circle", {
|
|
@@ -14612,8 +14588,8 @@ export const TaggedClass: {
|
|
|
14612
14588
|
* }) {}
|
|
14613
14589
|
*
|
|
14614
14590
|
* const c = new Circle({ radius: 5 })
|
|
14615
|
-
*
|
|
14616
|
-
*
|
|
14591
|
+
* c._tag // => "Circle"
|
|
14592
|
+
* c.radius // => 5
|
|
14617
14593
|
* ```
|
|
14618
14594
|
*
|
|
14619
14595
|
* @category constructors
|
|
@@ -14655,7 +14631,7 @@ export const TaggedClass: {
|
|
|
14655
14631
|
*
|
|
14656
14632
|
* **Example** (Schema-backed error)
|
|
14657
14633
|
*
|
|
14658
|
-
* ```ts
|
|
14634
|
+
* ```ts import.meta.vitest
|
|
14659
14635
|
* import { Effect, Schema } from "effect"
|
|
14660
14636
|
*
|
|
14661
14637
|
* class NotFound extends Schema.ErrorClass<NotFound>("NotFound")({
|
|
@@ -14665,6 +14641,8 @@ export const TaggedClass: {
|
|
|
14665
14641
|
* const program = Effect.gen(function*() {
|
|
14666
14642
|
* yield* new NotFound({ id: 1 })
|
|
14667
14643
|
* })
|
|
14644
|
+
* const error = await Effect.runPromise(Effect.flip(program))
|
|
14645
|
+
* error.id // => 1
|
|
14668
14646
|
* ```
|
|
14669
14647
|
*
|
|
14670
14648
|
* @category constructors
|
|
@@ -14679,7 +14657,7 @@ export const ErrorClass: {
|
|
|
14679
14657
|
*
|
|
14680
14658
|
* **Example** (Schema-backed error)
|
|
14681
14659
|
*
|
|
14682
|
-
* ```ts
|
|
14660
|
+
* ```ts import.meta.vitest
|
|
14683
14661
|
* import { Effect, Schema } from "effect"
|
|
14684
14662
|
*
|
|
14685
14663
|
* class NotFound extends Schema.ErrorClass<NotFound>("NotFound")({
|
|
@@ -14689,6 +14667,8 @@ export const ErrorClass: {
|
|
|
14689
14667
|
* const program = Effect.gen(function*() {
|
|
14690
14668
|
* yield* new NotFound({ id: 1 })
|
|
14691
14669
|
* })
|
|
14670
|
+
* const error = await Effect.runPromise(Effect.flip(program))
|
|
14671
|
+
* error.id // => 1
|
|
14692
14672
|
* ```
|
|
14693
14673
|
*
|
|
14694
14674
|
* @category constructors
|
|
@@ -14703,7 +14683,7 @@ export const ErrorClass: {
|
|
|
14703
14683
|
*
|
|
14704
14684
|
* **Example** (Schema-backed error)
|
|
14705
14685
|
*
|
|
14706
|
-
* ```ts
|
|
14686
|
+
* ```ts import.meta.vitest
|
|
14707
14687
|
* import { Effect, Schema } from "effect"
|
|
14708
14688
|
*
|
|
14709
14689
|
* class NotFound extends Schema.ErrorClass<NotFound>("NotFound")({
|
|
@@ -14713,6 +14693,8 @@ export const ErrorClass: {
|
|
|
14713
14693
|
* const program = Effect.gen(function*() {
|
|
14714
14694
|
* yield* new NotFound({ id: 1 })
|
|
14715
14695
|
* })
|
|
14696
|
+
* const error = await Effect.runPromise(Effect.flip(program))
|
|
14697
|
+
* error.id // => 1
|
|
14716
14698
|
* ```
|
|
14717
14699
|
*
|
|
14718
14700
|
* @category constructors
|
|
@@ -14731,7 +14713,7 @@ export const ErrorClass: {
|
|
|
14731
14713
|
*
|
|
14732
14714
|
* **Example** (Schema-backed error)
|
|
14733
14715
|
*
|
|
14734
|
-
* ```ts
|
|
14716
|
+
* ```ts import.meta.vitest
|
|
14735
14717
|
* import { Effect, Schema } from "effect"
|
|
14736
14718
|
*
|
|
14737
14719
|
* class NotFound extends Schema.ErrorClass<NotFound>("NotFound")({
|
|
@@ -14741,6 +14723,8 @@ export const ErrorClass: {
|
|
|
14741
14723
|
* const program = Effect.gen(function*() {
|
|
14742
14724
|
* yield* new NotFound({ id: 1 })
|
|
14743
14725
|
* })
|
|
14726
|
+
* const error = await Effect.runPromise(Effect.flip(program))
|
|
14727
|
+
* error.id // => 1
|
|
14744
14728
|
* ```
|
|
14745
14729
|
*
|
|
14746
14730
|
* @category constructors
|
|
@@ -14779,7 +14763,7 @@ export const ErrorClass: {
|
|
|
14779
14763
|
*
|
|
14780
14764
|
* **Example** (Defining a tagged error class)
|
|
14781
14765
|
*
|
|
14782
|
-
* ```ts
|
|
14766
|
+
* ```ts import.meta.vitest
|
|
14783
14767
|
* import { Effect, Schema } from "effect"
|
|
14784
14768
|
*
|
|
14785
14769
|
* class NotFound extends Schema.TaggedErrorClass<NotFound>()("NotFound", {
|
|
@@ -14789,6 +14773,9 @@ export const ErrorClass: {
|
|
|
14789
14773
|
* const program = Effect.gen(function*() {
|
|
14790
14774
|
* yield* new NotFound({ id: 42 })
|
|
14791
14775
|
* })
|
|
14776
|
+
* const error = await Effect.runPromise(Effect.flip(program))
|
|
14777
|
+
* error._tag // => "NotFound"
|
|
14778
|
+
* error.id // => 42
|
|
14792
14779
|
* ```
|
|
14793
14780
|
*
|
|
14794
14781
|
* @category constructors
|
|
@@ -14806,7 +14793,7 @@ export const TaggedErrorClass: {
|
|
|
14806
14793
|
*
|
|
14807
14794
|
* **Example** (Defining a tagged error class)
|
|
14808
14795
|
*
|
|
14809
|
-
* ```ts
|
|
14796
|
+
* ```ts import.meta.vitest
|
|
14810
14797
|
* import { Effect, Schema } from "effect"
|
|
14811
14798
|
*
|
|
14812
14799
|
* class NotFound extends Schema.TaggedErrorClass<NotFound>()("NotFound", {
|
|
@@ -14816,6 +14803,9 @@ export const TaggedErrorClass: {
|
|
|
14816
14803
|
* const program = Effect.gen(function*() {
|
|
14817
14804
|
* yield* new NotFound({ id: 42 })
|
|
14818
14805
|
* })
|
|
14806
|
+
* const error = await Effect.runPromise(Effect.flip(program))
|
|
14807
|
+
* error._tag // => "NotFound"
|
|
14808
|
+
* error.id // => 42
|
|
14819
14809
|
* ```
|
|
14820
14810
|
*
|
|
14821
14811
|
* @category constructors
|
|
@@ -14833,7 +14823,7 @@ export const TaggedErrorClass: {
|
|
|
14833
14823
|
*
|
|
14834
14824
|
* **Example** (Defining a tagged error class)
|
|
14835
14825
|
*
|
|
14836
|
-
* ```ts
|
|
14826
|
+
* ```ts import.meta.vitest
|
|
14837
14827
|
* import { Effect, Schema } from "effect"
|
|
14838
14828
|
*
|
|
14839
14829
|
* class NotFound extends Schema.TaggedErrorClass<NotFound>()("NotFound", {
|
|
@@ -14843,6 +14833,9 @@ export const TaggedErrorClass: {
|
|
|
14843
14833
|
* const program = Effect.gen(function*() {
|
|
14844
14834
|
* yield* new NotFound({ id: 42 })
|
|
14845
14835
|
* })
|
|
14836
|
+
* const error = await Effect.runPromise(Effect.flip(program))
|
|
14837
|
+
* error._tag // => "NotFound"
|
|
14838
|
+
* error.id // => 42
|
|
14846
14839
|
* ```
|
|
14847
14840
|
*
|
|
14848
14841
|
* @category constructors
|
|
@@ -14865,7 +14858,7 @@ export const TaggedErrorClass: {
|
|
|
14865
14858
|
*
|
|
14866
14859
|
* **Example** (Defining a tagged error class)
|
|
14867
14860
|
*
|
|
14868
|
-
* ```ts
|
|
14861
|
+
* ```ts import.meta.vitest
|
|
14869
14862
|
* import { Effect, Schema } from "effect"
|
|
14870
14863
|
*
|
|
14871
14864
|
* class NotFound extends Schema.TaggedErrorClass<NotFound>()("NotFound", {
|
|
@@ -14875,6 +14868,9 @@ export const TaggedErrorClass: {
|
|
|
14875
14868
|
* const program = Effect.gen(function*() {
|
|
14876
14869
|
* yield* new NotFound({ id: 42 })
|
|
14877
14870
|
* })
|
|
14871
|
+
* const error = await Effect.runPromise(Effect.flip(program))
|
|
14872
|
+
* error._tag // => "NotFound"
|
|
14873
|
+
* error.id // => 42
|
|
14878
14874
|
* ```
|
|
14879
14875
|
*
|
|
14880
14876
|
* @category constructors
|
|
@@ -14917,7 +14913,7 @@ export const TaggedErrorClass: {
|
|
|
14917
14913
|
* Use this type when you need to defer instantiation of the arbitrary, for
|
|
14918
14914
|
* example to support recursive schemas.
|
|
14919
14915
|
*
|
|
14920
|
-
* @category
|
|
14916
|
+
* @category utility types
|
|
14921
14917
|
* @since 4.0.0
|
|
14922
14918
|
*/
|
|
14923
14919
|
export type LazyArbitrary<T> = (fc: typeof FastCheck) => FastCheck.Arbitrary<T>
|
|
@@ -14933,7 +14929,7 @@ export type LazyArbitrary<T> = (fc: typeof FastCheck) => FastCheck.Arbitrary<T>
|
|
|
14933
14929
|
* nodes, impossible constraints, invalid candidates, and recursive schemas
|
|
14934
14930
|
* without a finite terminal path fail immediately.
|
|
14935
14931
|
*
|
|
14936
|
-
* @category
|
|
14932
|
+
* @category generators
|
|
14937
14933
|
* @since 4.0.0
|
|
14938
14934
|
*/
|
|
14939
14935
|
export function toArbitraryLazy<S extends Constraint>(schema: S): LazyArbitrary<S["Type"]> {
|
|
@@ -14954,7 +14950,7 @@ export function toArbitraryLazy<S extends Constraint>(schema: S): LazyArbitrary<
|
|
|
14954
14950
|
*
|
|
14955
14951
|
* **Example** (Generating arbitrary values)
|
|
14956
14952
|
*
|
|
14957
|
-
* ```ts
|
|
14953
|
+
* ```ts import.meta.vitest
|
|
14958
14954
|
* import { Schema } from "effect"
|
|
14959
14955
|
* import * as FastCheck from "fast-check"
|
|
14960
14956
|
*
|
|
@@ -14963,11 +14959,10 @@ export function toArbitraryLazy<S extends Constraint>(schema: S): LazyArbitrary<
|
|
|
14963
14959
|
* )
|
|
14964
14960
|
*
|
|
14965
14961
|
* // Sample a random value
|
|
14966
|
-
*
|
|
14967
|
-
* console.log(typeof sample.name) // "string"
|
|
14962
|
+
* FastCheck.sample(PersonArb, 1)
|
|
14968
14963
|
* ```
|
|
14969
14964
|
*
|
|
14970
|
-
* @category
|
|
14965
|
+
* @category generators
|
|
14971
14966
|
* @since 4.0.0
|
|
14972
14967
|
*/
|
|
14973
14968
|
export function toArbitrary<S extends Constraint>(schema: S): FastCheck.Arbitrary<S["Type"]>
|
|
@@ -15004,7 +14999,7 @@ export function toArbitrary<S extends Constraint>(
|
|
|
15004
14999
|
* The annotation is applied through this helper because adding it directly to
|
|
15005
15000
|
* `Annotations.Bottom` would make schemas invariant.
|
|
15006
15001
|
*
|
|
15007
|
-
* @category
|
|
15002
|
+
* @category formatting
|
|
15008
15003
|
* @since 4.0.0
|
|
15009
15004
|
*/
|
|
15010
15005
|
export function overrideToFormatter<S extends Top>(toFormatter: () => Formatter<S["Type"]>) {
|
|
@@ -15023,7 +15018,7 @@ export function overrideToFormatter<S extends Top>(toFormatter: () => Formatter<
|
|
|
15023
15018
|
* The optional `onBefore` hook lets you intercept specific AST nodes before
|
|
15024
15019
|
* the default formatting logic runs.
|
|
15025
15020
|
*
|
|
15026
|
-
* @category
|
|
15021
|
+
* @category formatting
|
|
15027
15022
|
* @since 4.0.0
|
|
15028
15023
|
*/
|
|
15029
15024
|
export function toFormatter<S extends Constraint>(schema: S, options?: {
|
|
@@ -15191,13 +15186,13 @@ export function overrideToEquivalence<S extends Top>(toEquivalence: () => Equiva
|
|
|
15191
15186
|
*
|
|
15192
15187
|
* **Example** (Comparing structs)
|
|
15193
15188
|
*
|
|
15194
|
-
* ```ts
|
|
15189
|
+
* ```ts import.meta.vitest
|
|
15195
15190
|
* import { Schema } from "effect"
|
|
15196
15191
|
*
|
|
15197
15192
|
* const eq = Schema.toEquivalence(Schema.Struct({ id: Schema.Number, name: Schema.String }))
|
|
15198
15193
|
*
|
|
15199
|
-
*
|
|
15200
|
-
*
|
|
15194
|
+
* eq({ id: 1, name: "Alice" }, { id: 1, name: "Alice" }) // => true
|
|
15195
|
+
* eq({ id: 1, name: "Alice" }, { id: 2, name: "Alice" }) // => false
|
|
15201
15196
|
* ```
|
|
15202
15197
|
*
|
|
15203
15198
|
* @category instances
|
|
@@ -15219,7 +15214,7 @@ export function toEquivalence<T>(schema: Schema<T>): Equivalence.Equivalence<T>
|
|
|
15219
15214
|
*
|
|
15220
15215
|
* Use {@link toType} before this function to represent the type side instead.
|
|
15221
15216
|
*
|
|
15222
|
-
* @category
|
|
15217
|
+
* @category converting
|
|
15223
15218
|
* @since 4.0.0
|
|
15224
15219
|
*/
|
|
15225
15220
|
export function toRepresentation(schema: Constraint): SchemaRepresentation.Document {
|
|
@@ -15280,7 +15275,7 @@ export interface ToJsonSchemaOptions {
|
|
|
15280
15275
|
*
|
|
15281
15276
|
* **Example** (Including custom annotations)
|
|
15282
15277
|
*
|
|
15283
|
-
* ```ts
|
|
15278
|
+
* ```ts import.meta.vitest
|
|
15284
15279
|
* import { Schema } from "effect"
|
|
15285
15280
|
*
|
|
15286
15281
|
* const schema = Schema.String.annotate({
|
|
@@ -15293,12 +15288,7 @@ export interface ToJsonSchemaOptions {
|
|
|
15293
15288
|
* key === "markdownDescription" || key.startsWith("x-")
|
|
15294
15289
|
* })
|
|
15295
15290
|
*
|
|
15296
|
-
*
|
|
15297
|
-
* // {
|
|
15298
|
-
* // type: "string",
|
|
15299
|
-
* // description: "A name",
|
|
15300
|
-
* // markdownDescription: "The **name** field"
|
|
15301
|
-
* // }
|
|
15291
|
+
* doc.schema // => { type: "string", description: "A name", markdownDescription: "The **name** field" }
|
|
15302
15292
|
* ```
|
|
15303
15293
|
*/
|
|
15304
15294
|
readonly includeAnnotationKey?: ((key: string) => boolean) | undefined
|
|
@@ -15340,7 +15330,7 @@ export function toJsonSchemaDocument(
|
|
|
15340
15330
|
/**
|
|
15341
15331
|
* Type-level representation returned by {@link toCodecJson}.
|
|
15342
15332
|
*
|
|
15343
|
-
* @category
|
|
15333
|
+
* @category converting
|
|
15344
15334
|
* @since 4.0.0
|
|
15345
15335
|
*/
|
|
15346
15336
|
export interface toCodecJson<S extends Constraint> extends
|
|
@@ -15377,7 +15367,7 @@ export interface toCodecJson<S extends Constraint> extends
|
|
|
15377
15367
|
* `toCodecJson` callback can return `undefined` when the declaration is already
|
|
15378
15368
|
* in canonical JSON form.
|
|
15379
15369
|
*
|
|
15380
|
-
* @category
|
|
15370
|
+
* @category converting
|
|
15381
15371
|
* @since 4.0.0
|
|
15382
15372
|
*/
|
|
15383
15373
|
export function toCodecJson<S extends Constraint>(schema: S): toCodecJson<S> {
|
|
@@ -15392,24 +15382,7 @@ const toCodecJsonASTBase = SchemaAST.applyToSelfOrLastLinkEncoding((ast) => {
|
|
|
15392
15382
|
})
|
|
15393
15383
|
|
|
15394
15384
|
/** @internal */
|
|
15395
|
-
export const toCodecJsonAST = memoize(
|
|
15396
|
-
const identifier = InternalAnnotations.resolveIdentifier(ast)
|
|
15397
|
-
const out = toCodecJsonASTBase(ast)
|
|
15398
|
-
if (identifier === undefined || out.encoding === undefined) return out
|
|
15399
|
-
|
|
15400
|
-
const encoded = SchemaAST.getLastEncoding(out)
|
|
15401
|
-
if (
|
|
15402
|
-
InternalAnnotations.resolveIdentifier(encoded) !== undefined ||
|
|
15403
|
-
InternalAnnotations.resolveIdentifierFallback(encoded) === identifier
|
|
15404
|
-
) {
|
|
15405
|
-
return out
|
|
15406
|
-
}
|
|
15407
|
-
|
|
15408
|
-
const annotated = SchemaAST.annotate(encoded, {
|
|
15409
|
-
[InternalAnnotations.IDENTIFIER_FALLBACK_KEY]: identifier
|
|
15410
|
-
})
|
|
15411
|
-
return SchemaAST.applyToSelfOrLastLinkEncoding(() => annotated)(out)
|
|
15412
|
-
})
|
|
15385
|
+
export const toCodecJsonAST = memoize(toCodecJsonASTBase)
|
|
15413
15386
|
|
|
15414
15387
|
function withoutConstructorDefault(context: SchemaAST.Context): SchemaAST.Context {
|
|
15415
15388
|
return context.defaultValue === undefined ?
|
|
@@ -15516,7 +15489,7 @@ function toCodecJsonBase(ast: SchemaAST.AST, recur: (ast: SchemaAST.AST) => Sche
|
|
|
15516
15489
|
* Derives an isomorphism codec from a schema. The encoded form is the
|
|
15517
15490
|
* schema's `Iso` type — the intermediate representation used for round-tripping.
|
|
15518
15491
|
*
|
|
15519
|
-
* @category
|
|
15492
|
+
* @category converting
|
|
15520
15493
|
* @since 4.0.0
|
|
15521
15494
|
*/
|
|
15522
15495
|
export function toCodecIso<S extends Constraint>(schema: S): Codec<S["Type"], S["Iso"]> {
|
|
@@ -15553,7 +15526,7 @@ function toCodecIsoBase(ast: SchemaAST.AST, recur: (ast: SchemaAST.AST) => Schem
|
|
|
15553
15526
|
* A {@link Tree} of `string | undefined` nodes. Leaf values are either a
|
|
15554
15527
|
* string representation or `undefined` for opaque/declaration types.
|
|
15555
15528
|
*
|
|
15556
|
-
* @category
|
|
15529
|
+
* @category models
|
|
15557
15530
|
* @since 4.0.0
|
|
15558
15531
|
*/
|
|
15559
15532
|
export type StringTree = Tree<string | undefined>
|
|
@@ -15561,7 +15534,7 @@ export type StringTree = Tree<string | undefined>
|
|
|
15561
15534
|
/**
|
|
15562
15535
|
* Type-level representation returned by {@link toCodecStringTree}.
|
|
15563
15536
|
*
|
|
15564
|
-
* @category
|
|
15537
|
+
* @category converting
|
|
15565
15538
|
* @since 4.0.0
|
|
15566
15539
|
*/
|
|
15567
15540
|
export interface toCodecStringTree<S extends Constraint> extends
|
|
@@ -15596,7 +15569,7 @@ export interface toCodecStringTree<S extends Constraint> extends
|
|
|
15596
15569
|
* `toCodec` encoding. A callback can return `undefined` when the declaration is
|
|
15597
15570
|
* already in canonical StringTree form.
|
|
15598
15571
|
*
|
|
15599
|
-
* @category
|
|
15572
|
+
* @category converting
|
|
15600
15573
|
* @since 4.0.0
|
|
15601
15574
|
*/
|
|
15602
15575
|
export function toCodecStringTree<S extends Constraint>(schema: S): toCodecStringTree<S> {
|
|
@@ -15606,7 +15579,7 @@ export function toCodecStringTree<S extends Constraint>(schema: S): toCodecStrin
|
|
|
15606
15579
|
/**
|
|
15607
15580
|
* Type-level representation returned by {@link toCodecArrayFromSingle}.
|
|
15608
15581
|
*
|
|
15609
|
-
* @category
|
|
15582
|
+
* @category converting
|
|
15610
15583
|
* @since 4.0.0
|
|
15611
15584
|
*/
|
|
15612
15585
|
export interface toCodecArrayFromSingle<S extends Constraint> extends
|
|
@@ -15645,7 +15618,7 @@ export interface toCodecArrayFromSingle<S extends Constraint> extends
|
|
|
15645
15618
|
* decoding convenience rather than a canonical StringTree representation. It
|
|
15646
15619
|
* does not parse comma-separated strings.
|
|
15647
15620
|
*
|
|
15648
|
-
* @category
|
|
15621
|
+
* @category converting
|
|
15649
15622
|
* @since 4.0.0
|
|
15650
15623
|
*/
|
|
15651
15624
|
export function toCodecArrayFromSingle<S extends Constraint>(schema: S): toCodecArrayFromSingle<S> {
|
|
@@ -15674,7 +15647,7 @@ type XmlEncoderOptions = {
|
|
|
15674
15647
|
* an `Effect` that succeeds with the XML string or fails with `SchemaError` if
|
|
15675
15648
|
* codec encoding fails.
|
|
15676
15649
|
*
|
|
15677
|
-
* @category
|
|
15650
|
+
* @category encoding
|
|
15678
15651
|
* @since 4.0.0
|
|
15679
15652
|
*/
|
|
15680
15653
|
export function toEncoderXml<T, RE>(
|
|
@@ -15934,7 +15907,7 @@ function onSerializerArrayFromSingle(ast: SchemaAST.AST): SchemaAST.AST {
|
|
|
15934
15907
|
*
|
|
15935
15908
|
* @see {@link isGreaterThanDate} for creating the corresponding check
|
|
15936
15909
|
*
|
|
15937
|
-
* @category
|
|
15910
|
+
* @category validation
|
|
15938
15911
|
* @since 4.0.0
|
|
15939
15912
|
*/
|
|
15940
15913
|
export const isGreaterThanDateReviver: SchemaRepresentation.FilterReviver<{
|
|
@@ -15954,7 +15927,7 @@ export const isGreaterThanDateReviver: SchemaRepresentation.FilterReviver<{
|
|
|
15954
15927
|
*
|
|
15955
15928
|
* @see {@link isGreaterThanOrEqualToDate} for creating the corresponding check
|
|
15956
15929
|
*
|
|
15957
|
-
* @category
|
|
15930
|
+
* @category validation
|
|
15958
15931
|
* @since 4.0.0
|
|
15959
15932
|
*/
|
|
15960
15933
|
export const isGreaterThanOrEqualToDateReviver: SchemaRepresentation.FilterReviver<{
|
|
@@ -15974,7 +15947,7 @@ export const isGreaterThanOrEqualToDateReviver: SchemaRepresentation.FilterReviv
|
|
|
15974
15947
|
*
|
|
15975
15948
|
* @see {@link isLessThanDate} for creating the corresponding check
|
|
15976
15949
|
*
|
|
15977
|
-
* @category
|
|
15950
|
+
* @category validation
|
|
15978
15951
|
* @since 4.0.0
|
|
15979
15952
|
*/
|
|
15980
15953
|
export const isLessThanDateReviver: SchemaRepresentation.FilterReviver<{
|
|
@@ -15994,7 +15967,7 @@ export const isLessThanDateReviver: SchemaRepresentation.FilterReviver<{
|
|
|
15994
15967
|
*
|
|
15995
15968
|
* @see {@link isLessThanOrEqualToDate} for creating the corresponding check
|
|
15996
15969
|
*
|
|
15997
|
-
* @category
|
|
15970
|
+
* @category validation
|
|
15998
15971
|
* @since 4.0.0
|
|
15999
15972
|
*/
|
|
16000
15973
|
export const isLessThanOrEqualToDateReviver: SchemaRepresentation.FilterReviver<{
|
|
@@ -16014,7 +15987,7 @@ export const isLessThanOrEqualToDateReviver: SchemaRepresentation.FilterReviver<
|
|
|
16014
15987
|
*
|
|
16015
15988
|
* @see {@link isBetweenDate} for creating the corresponding check
|
|
16016
15989
|
*
|
|
16017
|
-
* @category
|
|
15990
|
+
* @category validation
|
|
16018
15991
|
* @since 4.0.0
|
|
16019
15992
|
*/
|
|
16020
15993
|
export const isBetweenDateReviver: SchemaRepresentation.FilterReviver<{
|
|
@@ -16042,7 +16015,7 @@ export const isBetweenDateReviver: SchemaRepresentation.FilterReviver<{
|
|
|
16042
16015
|
*
|
|
16043
16016
|
* @see {@link isGreaterThanBigInt} for creating the corresponding check
|
|
16044
16017
|
*
|
|
16045
|
-
* @category
|
|
16018
|
+
* @category validation
|
|
16046
16019
|
* @since 4.0.0
|
|
16047
16020
|
*/
|
|
16048
16021
|
export const isGreaterThanBigIntReviver: SchemaRepresentation.FilterReviver<{
|
|
@@ -16062,7 +16035,7 @@ export const isGreaterThanBigIntReviver: SchemaRepresentation.FilterReviver<{
|
|
|
16062
16035
|
*
|
|
16063
16036
|
* @see {@link isGreaterThanOrEqualToBigInt} for creating the corresponding check
|
|
16064
16037
|
*
|
|
16065
|
-
* @category
|
|
16038
|
+
* @category validation
|
|
16066
16039
|
* @since 4.0.0
|
|
16067
16040
|
*/
|
|
16068
16041
|
export const isGreaterThanOrEqualToBigIntReviver: SchemaRepresentation.FilterReviver<{
|
|
@@ -16082,7 +16055,7 @@ export const isGreaterThanOrEqualToBigIntReviver: SchemaRepresentation.FilterRev
|
|
|
16082
16055
|
*
|
|
16083
16056
|
* @see {@link isLessThanBigInt} for creating the corresponding check
|
|
16084
16057
|
*
|
|
16085
|
-
* @category
|
|
16058
|
+
* @category validation
|
|
16086
16059
|
* @since 4.0.0
|
|
16087
16060
|
*/
|
|
16088
16061
|
export const isLessThanBigIntReviver: SchemaRepresentation.FilterReviver<{
|
|
@@ -16102,7 +16075,7 @@ export const isLessThanBigIntReviver: SchemaRepresentation.FilterReviver<{
|
|
|
16102
16075
|
*
|
|
16103
16076
|
* @see {@link isLessThanOrEqualToBigInt} for creating the corresponding check
|
|
16104
16077
|
*
|
|
16105
|
-
* @category
|
|
16078
|
+
* @category validation
|
|
16106
16079
|
* @since 4.0.0
|
|
16107
16080
|
*/
|
|
16108
16081
|
export const isLessThanOrEqualToBigIntReviver: SchemaRepresentation.FilterReviver<{
|
|
@@ -16122,7 +16095,7 @@ export const isLessThanOrEqualToBigIntReviver: SchemaRepresentation.FilterRevive
|
|
|
16122
16095
|
*
|
|
16123
16096
|
* @see {@link isBetweenBigInt} for creating the corresponding check
|
|
16124
16097
|
*
|
|
16125
|
-
* @category
|
|
16098
|
+
* @category validation
|
|
16126
16099
|
* @since 4.0.0
|
|
16127
16100
|
*/
|
|
16128
16101
|
export const isBetweenBigIntReviver: SchemaRepresentation.FilterReviver<{
|
|
@@ -16149,7 +16122,7 @@ export const isBetweenBigIntReviver: SchemaRepresentation.FilterReviver<{
|
|
|
16149
16122
|
* Derives an `Iso` optic from a schema that isomorphically converts between
|
|
16150
16123
|
* the schema's `Type` and its `Iso` (intermediate / serialized form).
|
|
16151
16124
|
*
|
|
16152
|
-
* @category
|
|
16125
|
+
* @category converting
|
|
16153
16126
|
* @since 4.0.0
|
|
16154
16127
|
*/
|
|
16155
16128
|
export function toIso<S extends Constraint>(schema: S): Optic_.Iso<S["Type"], S["Iso"]> {
|
|
@@ -16160,7 +16133,7 @@ export function toIso<S extends Constraint>(schema: S): Optic_.Iso<S["Type"], S[
|
|
|
16160
16133
|
/**
|
|
16161
16134
|
* Returns an identity `Iso` over the schema's source (`Type`) side.
|
|
16162
16135
|
*
|
|
16163
|
-
* @category
|
|
16136
|
+
* @category constructors
|
|
16164
16137
|
* @since 4.0.0
|
|
16165
16138
|
*/
|
|
16166
16139
|
export function toIsoSource<S extends Constraint>(_: S): Optic_.Iso<S["Type"], S["Type"]> {
|
|
@@ -16170,7 +16143,7 @@ export function toIsoSource<S extends Constraint>(_: S): Optic_.Iso<S["Type"], S
|
|
|
16170
16143
|
/**
|
|
16171
16144
|
* Returns an identity `Iso` over the schema's focus (`Iso`) side.
|
|
16172
16145
|
*
|
|
16173
|
-
* @category
|
|
16146
|
+
* @category constructors
|
|
16174
16147
|
* @since 4.0.0
|
|
16175
16148
|
*/
|
|
16176
16149
|
export function toIsoFocus<S extends Constraint>(_: S): Optic_.Iso<S["Iso"], S["Iso"]> {
|
|
@@ -16180,7 +16153,7 @@ export function toIsoFocus<S extends Constraint>(_: S): Optic_.Iso<S["Iso"], S["
|
|
|
16180
16153
|
/**
|
|
16181
16154
|
* Type-level representation returned by {@link overrideToCodecIso}.
|
|
16182
16155
|
*
|
|
16183
|
-
* @category
|
|
16156
|
+
* @category transforming
|
|
16184
16157
|
* @since 4.0.0
|
|
16185
16158
|
*/
|
|
16186
16159
|
export interface overrideToCodecIso<S extends Constraint, Iso> extends
|
|
@@ -16219,7 +16192,7 @@ export interface overrideToCodecIso<S extends Constraint, Iso> extends
|
|
|
16219
16192
|
* provided `decode` and `encode` getters to transform between the schema type
|
|
16220
16193
|
* and the target codec.
|
|
16221
16194
|
*
|
|
16222
|
-
* @category
|
|
16195
|
+
* @category transforming
|
|
16223
16196
|
* @since 4.0.0
|
|
16224
16197
|
*/
|
|
16225
16198
|
export function overrideToCodecIso<S extends Constraint, Iso>(
|
|
@@ -16271,7 +16244,7 @@ export function toDifferJsonPatch<T>(schema: ConstraintCodec<T, unknown>): Diffe
|
|
|
16271
16244
|
* Recursive tree type whose leaves are `Node` values and whose branches are
|
|
16272
16245
|
* readonly arrays or string-keyed records of child trees.
|
|
16273
16246
|
*
|
|
16274
|
-
* @category
|
|
16247
|
+
* @category models
|
|
16275
16248
|
* @since 4.0.0
|
|
16276
16249
|
*/
|
|
16277
16250
|
export type Tree<Node> = Node | TreeRecord<Node> | ReadonlyArray<Tree<Node>>
|
|
@@ -16280,7 +16253,7 @@ export type Tree<Node> = Node | TreeRecord<Node> | ReadonlyArray<Tree<Node>>
|
|
|
16280
16253
|
* A record node in a {@link Tree}: an object mapping string keys to child
|
|
16281
16254
|
* `Tree` nodes.
|
|
16282
16255
|
*
|
|
16283
|
-
* @category
|
|
16256
|
+
* @category models
|
|
16284
16257
|
* @since 4.0.0
|
|
16285
16258
|
*/
|
|
16286
16259
|
export interface TreeRecord<A> {
|
|
@@ -16292,7 +16265,7 @@ export interface TreeRecord<A> {
|
|
|
16292
16265
|
* The resulting schema accepts a single node value, an array of trees, or an
|
|
16293
16266
|
* object whose values are trees.
|
|
16294
16267
|
*
|
|
16295
|
-
* @category
|
|
16268
|
+
* @category schemas
|
|
16296
16269
|
* @since 4.0.0
|
|
16297
16270
|
*/
|
|
16298
16271
|
export function Tree<S extends Constraint>(node: S) {
|
|
@@ -16344,11 +16317,10 @@ export interface JsonObject {
|
|
|
16344
16317
|
*
|
|
16345
16318
|
* **Example** (Validating a JSON value)
|
|
16346
16319
|
*
|
|
16347
|
-
* ```ts
|
|
16348
|
-
* import { Schema } from "effect"
|
|
16320
|
+
* ```ts import.meta.vitest
|
|
16321
|
+
* import { Option, Schema } from "effect"
|
|
16349
16322
|
*
|
|
16350
|
-
*
|
|
16351
|
-
* console.log(result._tag) // "Some"
|
|
16323
|
+
* Schema.decodeUnknownOption(Schema.Json)({ key: [1, true, null] }) // => Option.some({ key: [1, true, null] })
|
|
16352
16324
|
* ```
|
|
16353
16325
|
*
|
|
16354
16326
|
* @category schemas
|
|
@@ -16453,7 +16425,7 @@ export const MutableJsonReviver = makeFixedDeclarationReviver(
|
|
|
16453
16425
|
* annotations are taken from the last check; otherwise they are taken from
|
|
16454
16426
|
* the base schema instance.
|
|
16455
16427
|
*
|
|
16456
|
-
* @category
|
|
16428
|
+
* @category getters
|
|
16457
16429
|
* @since 4.0.0
|
|
16458
16430
|
*/
|
|
16459
16431
|
export function resolveAnnotations<S extends Constraint>(
|
|
@@ -16467,7 +16439,7 @@ export function resolveAnnotations<S extends Constraint>(
|
|
|
16467
16439
|
* annotations are those attached via `annotateKey` and live on the AST's
|
|
16468
16440
|
* `context` rather than on the schema node itself.
|
|
16469
16441
|
*
|
|
16470
|
-
* @category
|
|
16442
|
+
* @category getters
|
|
16471
16443
|
* @since 4.0.0
|
|
16472
16444
|
*/
|
|
16473
16445
|
export function resolveAnnotationsKey<S extends Constraint>(schema: S): Annotations.Key<S["Type"]> | undefined {
|
|
@@ -16500,7 +16472,7 @@ export declare namespace Annotations {
|
|
|
16500
16472
|
*
|
|
16501
16473
|
* **Example** (Defining your own annotations)
|
|
16502
16474
|
*
|
|
16503
|
-
* ```ts
|
|
16475
|
+
* ```ts import.meta.vitest
|
|
16504
16476
|
* import { Schema } from "effect"
|
|
16505
16477
|
*
|
|
16506
16478
|
* // Extend the Annotations interface with a custom `version` annotation
|
|
@@ -16522,8 +16494,7 @@ export declare namespace Annotations {
|
|
|
16522
16494
|
*
|
|
16523
16495
|
* if (version) {
|
|
16524
16496
|
* // Access individual parts of the version
|
|
16525
|
-
*
|
|
16526
|
-
* // Output: 2
|
|
16497
|
+
* version[1] // => 2
|
|
16527
16498
|
* }
|
|
16528
16499
|
* ```
|
|
16529
16500
|
*
|
|
@@ -16551,7 +16522,7 @@ export declare namespace Annotations {
|
|
|
16551
16522
|
* `message` first, then `expected`, and finally falls back to `<filter>`.
|
|
16552
16523
|
*
|
|
16553
16524
|
* Use this to name a failed filter in the default message:
|
|
16554
|
-
* `Expected <expected
|
|
16525
|
+
* `Expected <expected>`.
|
|
16555
16526
|
*/
|
|
16556
16527
|
readonly expected?: string | undefined
|
|
16557
16528
|
readonly title?: string | undefined
|
|
@@ -16610,7 +16581,7 @@ export declare namespace Annotations {
|
|
|
16610
16581
|
* only changing the expected label. For a filter or refinement failure,
|
|
16611
16582
|
* annotate the filter with `message` to replace the whole filter failure
|
|
16612
16583
|
* message, or `expected` to keep the default
|
|
16613
|
-
* `Expected <expected
|
|
16584
|
+
* `Expected <expected>` shape.
|
|
16614
16585
|
*/
|
|
16615
16586
|
readonly message?: string | undefined
|
|
16616
16587
|
/**
|
|
@@ -16625,7 +16596,7 @@ export declare namespace Annotations {
|
|
|
16625
16596
|
* Identifiers are used by schema tooling, including JSON Schema
|
|
16626
16597
|
* generation, to name references. The default formatter also uses
|
|
16627
16598
|
* `identifier` as the expected label for type-level failures, such as
|
|
16628
|
-
* `Expected UserId
|
|
16599
|
+
* `Expected UserId`.
|
|
16629
16600
|
*
|
|
16630
16601
|
* `identifier` does not name a failed filter or refinement. If the base
|
|
16631
16602
|
* type matches and a filter fails, put `expected` or `message` on the
|