effect 4.0.0-rc.111 → 4.0.0-rc.113
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/AGENTS.md +24 -9
- package/CLAUDE.md +24 -9
- package/ai-docs/package.json +2 -2
- package/ai-docs/src/01_effect/01_basics/02_effect-fn.ts +18 -5
- package/ai-docs/src/01_effect/01_basics/index.md +5 -3
- package/ai-docs/src/01_effect/03_services/20_layer-composition.ts +1 -1
- package/ai-docs/src/01_effect/03_services/20_layer-unwrap.ts +2 -2
- package/ai-docs/src/01_effect/05_resources/10_acquire-release.ts +2 -2
- package/ai-docs/src/03_stream/30_encoding.ts +5 -7
- package/ai-docs/src/08_observability/10_logging.ts +1 -1
- package/ai-docs/src/70_cli/10_basics.ts +7 -7
- package/ai-docs/src/71_ai/10_language-model.ts +2 -2
- package/ai-docs/src/71_ai/20_tools.ts +1 -1
- package/ai-docs/src/71_ai/30_chat.ts +1 -1
- package/dist/Array.d.ts +109 -52
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +65 -32
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +5 -1
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +40 -23
- package/dist/BigDecimal.js.map +1 -1
- package/dist/ByteSize.d.ts +633 -0
- package/dist/ByteSize.d.ts.map +1 -0
- package/dist/ByteSize.js +524 -0
- package/dist/ByteSize.js.map +1 -0
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +17 -3
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +1 -1
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Channel.d.ts +97 -24
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +68 -41
- package/dist/Channel.js.map +1 -1
- package/dist/Chunk.d.ts +49 -28
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +27 -18
- package/dist/Chunk.js.map +1 -1
- package/dist/Config.d.ts +162 -201
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +103 -212
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +4 -4
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +7 -7
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Context.d.ts +31 -0
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js.map +1 -1
- package/dist/Cron.d.ts +2 -2
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +2 -2
- package/dist/Cron.js.map +1 -1
- package/dist/Crypto.d.ts +1 -1
- package/dist/Crypto.d.ts.map +1 -1
- package/dist/Crypto.js +3 -2
- package/dist/Crypto.js.map +1 -1
- package/dist/DateTime.d.ts +2 -2
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +6 -6
- package/dist/Deferred.js.map +1 -1
- package/dist/Duration.d.ts +1 -1
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +1 -1
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +220 -113
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +27 -26
- package/dist/Effect.js.map +1 -1
- package/dist/Effectable.d.ts +58 -2
- package/dist/Effectable.d.ts.map +1 -1
- package/dist/Effectable.js +58 -6
- package/dist/Effectable.js.map +1 -1
- package/dist/Encoding.d.ts +3 -1
- package/dist/Encoding.d.ts.map +1 -1
- package/dist/Encoding.js +40 -10
- package/dist/Encoding.js.map +1 -1
- package/dist/Equal.d.ts +1 -1
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +1 -1
- package/dist/Equal.js.map +1 -1
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/ExecutionPlan.js +1 -0
- package/dist/ExecutionPlan.js.map +1 -1
- package/dist/Fiber.d.ts +32 -8
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.js +3 -3
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +12 -6
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +11 -6
- package/dist/FiberMap.js.map +1 -1
- package/dist/FileSystem.d.ts +42 -210
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +16 -148
- package/dist/FileSystem.js.map +1 -1
- package/dist/Formatter.d.ts +1 -0
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +19 -3
- package/dist/Formatter.js.map +1 -1
- package/dist/Graph.d.ts +48 -20
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +20 -5
- package/dist/Graph.js.map +1 -1
- package/dist/Hash.d.ts +1 -1
- package/dist/Hash.d.ts.map +1 -1
- package/dist/Hash.js +5 -14
- package/dist/Hash.js.map +1 -1
- package/dist/HashMap.d.ts +1 -1
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashRing.d.ts +6 -1
- package/dist/HashRing.d.ts.map +1 -1
- package/dist/HashRing.js +9 -2
- package/dist/HashRing.js.map +1 -1
- package/dist/HashSet.d.ts +1 -1
- package/dist/HashSet.d.ts.map +1 -1
- package/dist/HashSet.js.map +1 -1
- package/dist/Iterable.d.ts +56 -17
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +65 -45
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonPatch.js +4 -4
- package/dist/JsonPatch.js.map +1 -1
- package/dist/JsonPointer.d.ts +68 -4
- package/dist/JsonPointer.d.ts.map +1 -1
- package/dist/JsonPointer.js +90 -4
- package/dist/JsonPointer.js.map +1 -1
- package/dist/JsonSchema.d.ts +67 -94
- package/dist/JsonSchema.d.ts.map +1 -1
- package/dist/JsonSchema.js +752 -397
- package/dist/JsonSchema.js.map +1 -1
- package/dist/Layer.d.ts +47 -4
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +4 -6
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +24 -3
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +9 -5
- package/dist/LayerMap.js.map +1 -1
- package/dist/LayerRef.d.ts.map +1 -1
- package/dist/LayerRef.js +7 -5
- package/dist/LayerRef.js.map +1 -1
- package/dist/Logger.d.ts +114 -9
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +109 -9
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.js +1 -1
- package/dist/ManagedRuntime.js.map +1 -1
- package/dist/Match.d.ts +43 -31
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js +5 -2
- package/dist/Match.js.map +1 -1
- package/dist/Metric.d.ts +11 -4
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +14 -18
- package/dist/Metric.js.map +1 -1
- package/dist/MutableHashMap.d.ts +1 -1
- package/dist/MutableHashMap.d.ts.map +1 -1
- package/dist/MutableHashMap.js +1 -1
- package/dist/MutableHashMap.js.map +1 -1
- package/dist/MutableHashSet.d.ts +1 -1
- package/dist/MutableHashSet.d.ts.map +1 -1
- package/dist/MutableHashSet.js +1 -1
- package/dist/MutableHashSet.js.map +1 -1
- package/dist/MutableList.d.ts +13 -2
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +18 -2
- package/dist/MutableList.js.map +1 -1
- package/dist/Number.d.ts +6 -0
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +3 -1
- package/dist/Number.js.map +1 -1
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +5 -4
- package/dist/Optic.js.map +1 -1
- package/dist/Option.d.ts +1 -1
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +1 -1
- package/dist/Option.js.map +1 -1
- package/dist/Order.d.ts +1 -0
- package/dist/Order.d.ts.map +1 -1
- package/dist/Order.js +3 -1
- package/dist/Order.js.map +1 -1
- package/dist/PartitionedSemaphore.d.ts.map +1 -1
- package/dist/PartitionedSemaphore.js +1 -2
- package/dist/PartitionedSemaphore.js.map +1 -1
- package/dist/Path.d.ts +1 -1
- package/dist/Path.d.ts.map +1 -1
- package/dist/Path.js +1 -1
- package/dist/Path.js.map +1 -1
- package/dist/PlatformError.d.ts +1 -1
- package/dist/PlatformError.d.ts.map +1 -1
- package/dist/PlatformError.js +1 -1
- package/dist/PlatformError.js.map +1 -1
- package/dist/Pool.d.ts +137 -10
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +332 -75
- package/dist/Pool.js.map +1 -1
- package/dist/PrimaryKey.d.ts +1 -1
- package/dist/PrimaryKey.d.ts.map +1 -1
- package/dist/PrimaryKey.js +1 -1
- package/dist/PrimaryKey.js.map +1 -1
- package/dist/PubSub.d.ts +21 -9
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +18 -14
- package/dist/PubSub.js.map +1 -1
- package/dist/Queue.d.ts +82 -6
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +116 -27
- package/dist/Queue.js.map +1 -1
- package/dist/Random.d.ts +17 -4
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +1 -1
- package/dist/Random.js.map +1 -1
- package/dist/RcMap.d.ts +137 -0
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +72 -9
- package/dist/RcMap.js.map +1 -1
- package/dist/Record.d.ts +13 -0
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js.map +1 -1
- package/dist/Redacted.d.ts +1 -1
- package/dist/Redacted.d.ts.map +1 -1
- package/dist/Redacted.js +1 -1
- package/dist/Redacted.js.map +1 -1
- package/dist/RequestResolver.d.ts +15 -9
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +33 -15
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Result.d.ts +1 -1
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +1 -1
- package/dist/Result.js.map +1 -1
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +19 -10
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +2200 -2433
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +2797 -4184
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +359 -176
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +373 -630
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +46 -22
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +56 -53
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.d.ts +123 -200
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js +59 -263
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.js +2 -9
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +1276 -172
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +1371 -29
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +49 -16
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +75 -98
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/Scope.d.ts +9 -2
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedCache.js +10 -3
- package/dist/ScopedCache.js.map +1 -1
- package/dist/Sink.d.ts +9 -4
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +49 -31
- package/dist/Sink.js.map +1 -1
- package/dist/StandardSchema.d.ts +125 -0
- package/dist/StandardSchema.d.ts.map +1 -0
- package/dist/StandardSchema.js +9 -0
- package/dist/StandardSchema.js.map +1 -0
- package/dist/Stream.d.ts +221 -35
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +168 -84
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +16 -6
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +12 -5
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts.map +1 -1
- package/dist/Struct.js +7 -4
- package/dist/Struct.js.map +1 -1
- package/dist/SynchronizedRef.d.ts +3 -2
- package/dist/SynchronizedRef.d.ts.map +1 -1
- package/dist/SynchronizedRef.js.map +1 -1
- package/dist/Terminal.d.ts +3 -3
- package/dist/Terminal.d.ts.map +1 -1
- package/dist/Terminal.js +3 -3
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +27 -7
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +38 -13
- package/dist/Tracer.js.map +1 -1
- package/dist/Trie.d.ts +1 -1
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Tuple.d.ts +2 -1
- package/dist/Tuple.d.ts.map +1 -1
- package/dist/Tuple.js.map +1 -1
- package/dist/TxChunk.d.ts +1 -1
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxChunk.js +1 -1
- package/dist/TxChunk.js.map +1 -1
- package/dist/TxDeferred.d.ts +1 -1
- package/dist/TxDeferred.d.ts.map +1 -1
- package/dist/TxDeferred.js +1 -1
- package/dist/TxDeferred.js.map +1 -1
- package/dist/TxHashMap.d.ts +1 -1
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +1 -1
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxHashSet.d.ts +1 -1
- package/dist/TxHashSet.d.ts.map +1 -1
- package/dist/TxHashSet.js +1 -1
- package/dist/TxHashSet.js.map +1 -1
- package/dist/TxPriorityQueue.d.ts +1 -1
- package/dist/TxPriorityQueue.d.ts.map +1 -1
- package/dist/TxPriorityQueue.js +1 -1
- package/dist/TxPriorityQueue.js.map +1 -1
- package/dist/TxPubSub.d.ts +1 -1
- package/dist/TxPubSub.d.ts.map +1 -1
- package/dist/TxPubSub.js +1 -1
- package/dist/TxPubSub.js.map +1 -1
- package/dist/TxQueue.d.ts +9 -9
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxQueue.js +93 -86
- package/dist/TxQueue.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +29 -1
- package/dist/TxReentrantLock.d.ts.map +1 -1
- package/dist/TxReentrantLock.js +29 -1
- package/dist/TxReentrantLock.js.map +1 -1
- package/dist/TxRef.d.ts +1 -1
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +1 -1
- package/dist/TxRef.js.map +1 -1
- package/dist/TxSemaphore.d.ts +1 -1
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +1 -1
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/TxSubscriptionRef.d.ts +1 -1
- package/dist/TxSubscriptionRef.d.ts.map +1 -1
- package/dist/TxSubscriptionRef.js +1 -1
- package/dist/TxSubscriptionRef.js.map +1 -1
- package/dist/Types.d.ts +33 -19
- package/dist/Types.d.ts.map +1 -1
- package/dist/Utils.d.ts.map +1 -1
- package/dist/Utils.js +2 -1
- package/dist/Utils.js.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/arbitrary/model.d.ts +2 -0
- package/dist/internal/arbitrary/model.d.ts.map +1 -0
- package/dist/internal/arbitrary/model.js +495 -0
- package/dist/internal/arbitrary/model.js.map +1 -0
- package/dist/internal/arbitrary/regexp.d.ts +2 -0
- package/dist/internal/arbitrary/regexp.d.ts.map +1 -0
- package/dist/internal/arbitrary/regexp.js +789 -0
- package/dist/internal/arbitrary/regexp.js.map +1 -0
- package/dist/internal/arbitrary/runner.d.ts +2 -0
- package/dist/internal/arbitrary/runner.d.ts.map +1 -0
- package/dist/internal/arbitrary/runner.js +496 -0
- package/dist/internal/arbitrary/runner.js.map +1 -0
- package/dist/internal/arbitrary/schema.d.ts.map +1 -0
- package/dist/internal/arbitrary/schema.js +1340 -0
- package/dist/internal/arbitrary/schema.js.map +1 -0
- package/dist/internal/core.js +27 -13
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/count.d.ts +2 -0
- package/dist/internal/count.d.ts.map +1 -0
- package/dist/internal/count.js +14 -0
- package/dist/internal/count.js.map +1 -0
- package/dist/internal/dateTime.js +4 -10
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/effect.js +416 -258
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/graph.js +3 -1
- package/dist/internal/graph.js.map +1 -1
- package/dist/internal/hashMap.js +5 -3
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/hashSet.js +1 -1
- package/dist/internal/hashSet.js.map +1 -1
- package/dist/internal/matcher.js +1 -1
- package/dist/internal/matcher.js.map +1 -1
- package/dist/internal/metric.js +1 -1
- package/dist/internal/metric.js.map +1 -1
- package/dist/internal/option.js +6 -5
- package/dist/internal/option.js.map +1 -1
- package/dist/internal/random.js +17 -0
- package/dist/internal/random.js.map +1 -1
- package/dist/internal/rcRef.js +10 -7
- package/dist/internal/rcRef.js.map +1 -1
- package/dist/internal/references.js +1 -0
- package/dist/internal/references.js.map +1 -1
- package/dist/internal/request.js +13 -6
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/result.js +11 -9
- package/dist/internal/result.js.map +1 -1
- package/dist/internal/schema/annotations.js +1 -1
- package/dist/internal/schema/annotations.js.map +1 -1
- package/dist/internal/schema/fromJsonSchemaDocument.js +238 -132
- package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -1
- package/dist/internal/schema/fromRepresentation.js +5 -5
- package/dist/internal/schema/fromRepresentation.js.map +1 -1
- package/dist/internal/schema/make.d.ts +2 -0
- package/dist/internal/schema/make.d.ts.map +1 -0
- package/dist/internal/schema/{schema.js → make.js} +1 -25
- package/dist/internal/schema/make.js.map +1 -0
- package/dist/internal/schema/parser.d.ts +0 -12
- package/dist/internal/schema/parser.d.ts.map +1 -1
- package/dist/internal/schema/parser.js +7 -0
- package/dist/internal/schema/parser.js.map +1 -1
- package/dist/internal/schema/standardSchema.d.ts +2 -0
- package/dist/internal/schema/standardSchema.d.ts.map +1 -0
- package/dist/internal/schema/standardSchema.js +112 -0
- package/dist/internal/schema/standardSchema.js.map +1 -0
- package/dist/internal/schema/toCodeDocument.js +34 -22
- package/dist/internal/schema/toCodeDocument.js.map +1 -1
- package/dist/internal/schema/toCodec.d.ts +2 -0
- package/dist/internal/schema/toCodec.d.ts.map +1 -0
- package/dist/internal/schema/toCodec.js +242 -0
- package/dist/internal/schema/toCodec.js.map +1 -0
- package/dist/internal/schema/toDifferJsonPatch.d.ts +2 -0
- package/dist/internal/schema/toDifferJsonPatch.d.ts.map +1 -0
- package/dist/internal/schema/toDifferJsonPatch.js +20 -0
- package/dist/internal/schema/toDifferJsonPatch.js.map +1 -0
- package/dist/internal/schema/toEncoderXml.d.ts +2 -0
- package/dist/internal/schema/toEncoderXml.d.ts.map +1 -0
- package/dist/internal/schema/toEncoderXml.js +104 -0
- package/dist/internal/schema/toEncoderXml.js.map +1 -0
- package/dist/internal/schema/toEquivalence.js +66 -0
- package/dist/internal/schema/toEquivalence.js.map +1 -1
- package/dist/internal/schema/toFormatter.d.ts +2 -0
- package/dist/internal/schema/toFormatter.d.ts.map +1 -0
- package/dist/internal/schema/toFormatter.js +227 -0
- package/dist/internal/schema/toFormatter.js.map +1 -0
- package/dist/internal/schema/toIso.d.ts +2 -0
- package/dist/internal/schema/toIso.d.ts.map +1 -0
- package/dist/internal/schema/toIso.js +17 -0
- package/dist/internal/schema/toIso.js.map +1 -0
- package/dist/internal/schema/toJsonSchemaDocument.js +122 -71
- package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -1
- package/dist/internal/schema/toRepresentation.js +3 -1
- package/dist/internal/schema/toRepresentation.js.map +1 -1
- package/dist/internal/schemaError.d.ts +4 -0
- package/dist/internal/schemaError.d.ts.map +1 -0
- package/dist/internal/schemaError.js +6 -0
- package/dist/internal/schemaError.js.map +1 -0
- package/dist/internal/stream.js +5 -6
- package/dist/internal/stream.js.map +1 -1
- package/dist/internal/tracer.d.ts +1 -3
- package/dist/internal/tracer.d.ts.map +1 -1
- package/dist/internal/tracer.js +6 -0
- package/dist/internal/tracer.js.map +1 -1
- package/dist/internal/trie.js +2 -2
- package/dist/internal/trie.js.map +1 -1
- package/dist/internal/uuid.d.ts +1 -2
- package/dist/internal/uuid.d.ts.map +1 -1
- package/dist/internal/uuid.js +2 -0
- package/dist/internal/uuid.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +9 -11
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/testing/TestSchema.js +20 -18
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/testing/index.d.ts +0 -4
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +0 -4
- package/dist/testing/index.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +98 -23
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +98 -6
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +5 -16
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +27 -32
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +10 -13
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.d.ts +23 -16
- package/dist/unstable/ai/EmbeddingModel.d.ts.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.js +13 -11
- package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +48 -37
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +150 -47
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +2 -2
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +87 -78
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +3 -14
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Prompt.d.ts +2 -2
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Prompt.js +15 -4
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +37 -94
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js +46 -96
- package/dist/unstable/ai/Response.js.map +1 -1
- package/dist/unstable/ai/Tokenizer.js +4 -5
- package/dist/unstable/ai/Tokenizer.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +38 -20
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +27 -1
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +1 -1
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +30 -18
- package/dist/unstable/ai/Toolkit.js.map +1 -1
- package/dist/unstable/ai/internal/codec-transformer.js +2 -2
- package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
- package/dist/unstable/ai/internal/structured-output.js +28 -5
- package/dist/unstable/ai/internal/structured-output.js.map +1 -1
- package/dist/unstable/arbitrary/Arbitrary.d.ts +626 -0
- package/dist/unstable/arbitrary/Arbitrary.d.ts.map +1 -0
- package/dist/unstable/arbitrary/Arbitrary.js +238 -0
- package/dist/unstable/arbitrary/Arbitrary.js.map +1 -0
- package/dist/unstable/arbitrary/index.d.ts +8 -0
- package/dist/unstable/arbitrary/index.d.ts.map +1 -0
- package/dist/unstable/arbitrary/index.js +9 -0
- package/dist/unstable/arbitrary/index.js.map +1 -0
- package/dist/unstable/cli/Argument.d.ts +104 -108
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js +56 -57
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +2 -0
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +2 -0
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/CliOutput.js +27 -4
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +73 -73
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +22 -22
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Completions.d.ts +4 -4
- package/dist/unstable/cli/Completions.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.d.ts +150 -161
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +79 -90
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +3 -3
- package/dist/unstable/cli/GlobalFlag.js +13 -13
- package/dist/unstable/cli/GlobalFlag.js.map +1 -1
- package/dist/unstable/cli/Param.d.ts +118 -126
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +104 -113
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +69 -58
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js +65 -66
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/Prompt.d.ts +113 -59
- package/dist/unstable/cli/Prompt.d.ts.map +1 -1
- package/dist/unstable/cli/Prompt.js +391 -327
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/internal/completions/bash.js +109 -38
- package/dist/unstable/cli/internal/completions/bash.js.map +1 -1
- package/dist/unstable/cli/internal/completions/descriptor.js +23 -11
- package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -1
- package/dist/unstable/cli/internal/completions/fish.js +15 -7
- package/dist/unstable/cli/internal/completions/fish.js.map +1 -1
- package/dist/unstable/cli/internal/completions/zsh.js +6 -4
- package/dist/unstable/cli/internal/completions/zsh.js.map +1 -1
- package/dist/unstable/cli/internal/config.js +4 -4
- package/dist/unstable/cli/internal/parser.js +1 -1
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cli/internal/wizard.d.ts +5 -1
- package/dist/unstable/cli/internal/wizard.d.ts.map +1 -1
- package/dist/unstable/cli/internal/wizard.js +34 -26
- package/dist/unstable/cli/internal/wizard.js.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.d.ts +13 -0
- package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.js +16 -1
- 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 +57 -14
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +2 -0
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.d.ts +2 -2
- package/dist/unstable/cluster/EntityProxyServer.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts +22 -5
- package/dist/unstable/cluster/Envelope.d.ts.map +1 -1
- package/dist/unstable/cluster/Envelope.js +23 -3
- package/dist/unstable/cluster/Envelope.js.map +1 -1
- package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/HttpRunner.js +32 -13
- package/dist/unstable/cluster/HttpRunner.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +17 -5
- package/dist/unstable/cluster/Message.d.ts.map +1 -1
- package/dist/unstable/cluster/Message.js +21 -8
- package/dist/unstable/cluster/Message.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +34 -4
- package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/MessageStorage.js +33 -12
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts +5 -4
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +21 -12
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +12 -6
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +11 -5
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +56 -35
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts +1 -1
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +32 -17
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.js +23 -23
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/SocketRunner.d.ts +2 -2
- package/dist/unstable/cluster/SocketRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/SocketRunner.js +4 -3
- package/dist/unstable/cluster/SocketRunner.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +11 -8
- 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 +11 -4
- package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/internal/clusterAbandon.d.ts +5 -0
- package/dist/unstable/cluster/internal/clusterAbandon.d.ts.map +1 -0
- package/dist/unstable/cluster/internal/clusterAbandon.js +9 -0
- package/dist/unstable/cluster/internal/clusterAbandon.js.map +1 -0
- package/dist/unstable/cluster/internal/entityManager.js +10 -6
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/cluster/internal/interruptors.js +30 -1
- package/dist/unstable/cluster/internal/interruptors.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceRef.js +12 -7
- package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.js +12 -7
- package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
- package/dist/unstable/encoding/Ini.d.ts +2 -0
- package/dist/unstable/encoding/Ini.d.ts.map +1 -1
- package/dist/unstable/encoding/Ini.js +2 -0
- package/dist/unstable/encoding/Ini.js.map +1 -1
- package/dist/unstable/encoding/SchemaBinary.d.ts +273 -0
- package/dist/unstable/encoding/SchemaBinary.d.ts.map +1 -0
- package/dist/unstable/encoding/SchemaBinary.js +4573 -0
- package/dist/unstable/encoding/SchemaBinary.js.map +1 -0
- package/dist/unstable/encoding/Sse.js +1 -1
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/encoding/Toml.d.ts +2 -0
- package/dist/unstable/encoding/Toml.d.ts.map +1 -1
- package/dist/unstable/encoding/Toml.js +6 -4
- package/dist/unstable/encoding/Toml.js.map +1 -1
- package/dist/unstable/encoding/Yaml.d.ts +2 -0
- package/dist/unstable/encoding/Yaml.d.ts.map +1 -1
- package/dist/unstable/encoding/Yaml.js +16 -5
- package/dist/unstable/encoding/Yaml.js.map +1 -1
- package/dist/unstable/encoding/index.d.ts +2 -2
- package/dist/unstable/encoding/index.d.ts.map +1 -1
- package/dist/unstable/encoding/index.js +2 -2
- package/dist/unstable/encoding/index.js.map +1 -1
- package/dist/unstable/eventlog/Event.d.ts +5 -5
- package/dist/unstable/eventlog/Event.d.ts.map +1 -1
- package/dist/unstable/eventlog/Event.js +3 -3
- package/dist/unstable/eventlog/Event.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +15 -9
- package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventJournal.js +26 -12
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLog.js +13 -9
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +11 -5
- package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.js +25 -15
- package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +7 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.js +13 -3
- package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js +2 -2
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.d.ts +0 -10
- package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.js +29 -14
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +5 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/http/Cookies.d.ts +1 -45
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +2 -64
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/FetchHttpClient.js +1 -1
- package/dist/unstable/http/FetchHttpClient.js.map +1 -1
- package/dist/unstable/http/FindMyWay/internal/router.js +124 -33
- package/dist/unstable/http/FindMyWay/internal/router.js.map +1 -1
- package/dist/unstable/http/FindMyWay.d.ts +15 -5
- package/dist/unstable/http/FindMyWay.d.ts.map +1 -1
- package/dist/unstable/http/FindMyWay.js +3 -1
- package/dist/unstable/http/FindMyWay.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts +0 -22
- package/dist/unstable/http/Headers.d.ts.map +1 -1
- package/dist/unstable/http/Headers.js +3 -34
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpBody.d.ts +41 -10
- package/dist/unstable/http/HttpBody.d.ts.map +1 -1
- package/dist/unstable/http/HttpBody.js +64 -10
- package/dist/unstable/http/HttpBody.js.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts +1 -1
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +28 -18
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts +28 -6
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +8 -19
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts +6 -1
- package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientResponse.js +10 -6
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts +16 -0
- package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
- package/dist/unstable/http/HttpEffect.js +121 -65
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.d.ts +3 -3
- package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js +1 -13
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +29 -21
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpPlatform.d.ts +12 -11
- package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
- package/dist/unstable/http/HttpPlatform.js +36 -10
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +5 -1
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +22 -8
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServer.d.ts +11 -42
- package/dist/unstable/http/HttpServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpServer.js +16 -20
- package/dist/unstable/http/HttpServer.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +11 -11
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.js +1 -1
- package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +9 -13
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +34 -44
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpStaticServer.d.ts +2 -2
- package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpStaticServer.js +19 -19
- package/dist/unstable/http/HttpStaticServer.js.map +1 -1
- package/dist/unstable/http/Mime.d.ts +28 -0
- package/dist/unstable/http/Mime.d.ts.map +1 -0
- package/dist/unstable/http/Mime.js +72 -0
- package/dist/unstable/http/Mime.js.map +1 -0
- package/dist/unstable/http/Multipart.d.ts +22 -9
- package/dist/unstable/http/Multipart.d.ts.map +1 -1
- package/dist/unstable/http/Multipart.js +26 -10
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/MultipartParser/internal/multipart.d.ts +1 -1
- package/dist/unstable/http/MultipartParser/internal/multipart.d.ts.map +1 -1
- package/dist/unstable/http/MultipartParser/internal/multipart.js +8 -3
- package/dist/unstable/http/MultipartParser/internal/multipart.js.map +1 -1
- package/dist/unstable/http/MultipartParser.d.ts +4 -3
- package/dist/unstable/http/MultipartParser.d.ts.map +1 -1
- package/dist/unstable/http/MultipartParser.js.map +1 -1
- package/dist/unstable/http/UrlParams.d.ts +0 -97
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +3 -104
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/http/index.d.ts +4 -0
- package/dist/unstable/http/index.d.ts.map +1 -1
- package/dist/unstable/http/index.js +4 -0
- package/dist/unstable/http/index.js.map +1 -1
- package/dist/unstable/http/internal/compression.js +8 -11
- package/dist/unstable/http/internal/compression.js.map +1 -1
- package/dist/unstable/http/internal/headers.d.ts +2 -0
- package/dist/unstable/http/internal/headers.d.ts.map +1 -0
- package/dist/unstable/http/internal/headers.js +5 -0
- package/dist/unstable/http/internal/headers.js.map +1 -0
- package/dist/unstable/http/internal/httpBody.js +8 -0
- package/dist/unstable/http/internal/httpBody.js.map +1 -1
- package/dist/unstable/http/internal/mimeTypes.d.ts +361 -0
- package/dist/unstable/http/internal/mimeTypes.d.ts.map +1 -0
- package/dist/unstable/http/internal/mimeTypes.js +363 -0
- package/dist/unstable/http/internal/mimeTypes.js.map +1 -0
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +13 -0
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +28 -11
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +4 -3
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +25 -13
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +8 -3
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.js +9 -6
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.js +3 -1
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js +7 -5
- package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.js +15 -12
- package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +12 -0
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.js +8 -10
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.js +6 -3
- package/dist/unstable/httpapi/HttpApiSwagger.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiTest.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiTest.js +8 -2
- package/dist/unstable/httpapi/HttpApiTest.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +31 -20
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/net/IpInterface.d.ts +140 -0
- package/dist/unstable/net/IpInterface.d.ts.map +1 -0
- package/dist/unstable/net/IpInterface.js +149 -0
- package/dist/unstable/net/IpInterface.js.map +1 -0
- package/dist/unstable/net/IpNetwork.d.ts +227 -0
- package/dist/unstable/net/IpNetwork.d.ts.map +1 -0
- package/dist/unstable/net/IpNetwork.js +239 -0
- package/dist/unstable/net/IpNetwork.js.map +1 -0
- package/dist/unstable/net/NetAddress.d.ts +705 -0
- package/dist/unstable/net/NetAddress.d.ts.map +1 -0
- package/dist/unstable/net/NetAddress.js +956 -0
- package/dist/unstable/net/NetAddress.js.map +1 -0
- package/dist/unstable/net/index.d.ts +16 -0
- package/dist/unstable/net/index.d.ts.map +1 -0
- package/dist/unstable/net/index.js +17 -0
- package/dist/unstable/net/index.js.map +1 -0
- package/dist/unstable/observability/OtlpExporter.d.ts +1 -0
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +4 -6
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js +9 -9
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.js +9 -8
- package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
- package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpResource.js +2 -2
- package/dist/unstable/observability/OtlpResource.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js +82 -55
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/observability/internal/otlpEnv.d.ts +1 -1
- package/dist/unstable/observability/internal/otlpEnv.d.ts.map +1 -1
- package/dist/unstable/observability/internal/otlpEnv.js +5 -9
- package/dist/unstable/observability/internal/otlpEnv.js.map +1 -1
- package/dist/unstable/persistence/PersistedCache.js +1 -1
- package/dist/unstable/persistence/PersistedCache.js.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts +114 -14
- package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.js +799 -234
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +28 -15
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +33 -41
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/process/ChildProcess.d.ts +8 -2
- package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcess.js +7 -2
- package/dist/unstable/process/ChildProcess.js.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.d.ts +1 -1
- 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/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +6 -3
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +3 -6
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.js +6 -3
- package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +2 -3
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts +2 -2
- package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.js +1 -1
- package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
- package/dist/unstable/reactivity/Hydration.d.ts +6 -4
- package/dist/unstable/reactivity/Hydration.d.ts.map +1 -1
- package/dist/unstable/reactivity/Hydration.js +20 -6
- package/dist/unstable/reactivity/Hydration.js.map +1 -1
- package/dist/unstable/reactivity/Reactivity.d.ts +26 -26
- package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
- package/dist/unstable/reactivity/Reactivity.js +10 -12
- package/dist/unstable/reactivity/Reactivity.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts +5 -0
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +94 -81
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcClientError.d.ts +1 -1
- package/dist/unstable/rpc/RpcMessage.d.ts +66 -7
- package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMessage.js +68 -9
- package/dist/unstable/rpc/RpcMessage.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js +7 -5
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts +28 -33
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +56 -92
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +25 -0
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +125 -68
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js +7 -6
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.js +3 -0
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +287 -102
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +408 -215
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/socket/SocketServer.d.ts +5 -32
- package/dist/unstable/socket/SocketServer.d.ts.map +1 -1
- package/dist/unstable/socket/SocketServer.js +3 -3
- package/dist/unstable/socket/SocketServer.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts +20 -0
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +14 -7
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/sql/SqlConnection.d.ts +15 -0
- package/dist/unstable/sql/SqlConnection.d.ts.map +1 -1
- package/dist/unstable/sql/SqlConnection.js.map +1 -1
- package/dist/unstable/sql/SqlModel.d.ts +1 -1
- package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.d.ts +13 -5
- package/dist/unstable/sql/Statement.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.js +29 -15
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/workers/Transferable.js +1 -1
- package/dist/unstable/workers/Worker.d.ts.map +1 -1
- package/dist/unstable/workers/Worker.js +3 -1
- package/dist/unstable/workers/Worker.js.map +1 -1
- package/dist/unstable/workflow/Activity.d.ts +7 -0
- package/dist/unstable/workflow/Activity.d.ts.map +1 -1
- package/dist/unstable/workflow/Activity.js +14 -4
- package/dist/unstable/workflow/Activity.js.map +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 +2 -2
- package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/DurableQueue.d.ts +8 -0
- package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableQueue.js +8 -0
- package/dist/unstable/workflow/DurableQueue.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +5 -0
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js +70 -12
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +6 -0
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +11 -0
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.d.ts +2 -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/package.json +8 -10
- package/src/Array.ts +142 -70
- package/src/BigDecimal.ts +50 -28
- package/src/ByteSize.ts +838 -0
- package/src/Cache.ts +17 -3
- package/src/Cause.ts +1 -1
- package/src/Channel.ts +185 -50
- package/src/Chunk.ts +65 -36
- package/src/Config.ts +237 -248
- package/src/ConfigProvider.ts +7 -8
- package/src/Context.ts +31 -0
- package/src/Cron.ts +2 -2
- package/src/Crypto.ts +3 -2
- package/src/Deferred.ts +7 -6
- package/src/Duration.ts +1 -1
- package/src/Effect.ts +226 -122
- package/src/Effectable.ts +78 -9
- package/src/Encoding.ts +101 -11
- package/src/Equal.ts +1 -1
- package/src/ExecutionPlan.ts +3 -0
- package/src/Fiber.ts +33 -8
- package/src/FiberHandle.ts +3 -3
- package/src/FiberMap.ts +19 -10
- package/src/FileSystem.ts +55 -230
- package/src/Formatter.ts +21 -3
- package/src/Graph.ts +55 -25
- package/src/Hash.ts +5 -16
- package/src/HashRing.ts +9 -2
- package/src/HashSet.ts +56 -0
- package/src/Iterable.ts +90 -44
- package/src/JsonPatch.ts +4 -4
- package/src/JsonPointer.ts +97 -4
- package/src/JsonSchema.ts +998 -476
- package/src/Layer.ts +59 -18
- package/src/LayerMap.ts +38 -6
- package/src/LayerRef.ts +7 -5
- package/src/Logger.ts +125 -18
- package/src/ManagedRuntime.ts +1 -1
- package/src/Match.ts +33 -14
- package/src/Metric.ts +24 -21
- package/src/MutableHashMap.ts +1 -1
- package/src/MutableHashSet.ts +1 -1
- package/src/MutableList.ts +18 -2
- package/src/Number.ts +7 -1
- package/src/Optic.ts +8 -4
- package/src/Option.ts +1 -1
- package/src/Order.ts +3 -1
- package/src/PartitionedSemaphore.ts +1 -2
- package/src/Path.ts +1 -1
- package/src/PlatformError.ts +1 -1
- package/src/Pool.ts +535 -134
- package/src/PrimaryKey.ts +1 -1
- package/src/PubSub.ts +32 -20
- package/src/Queue.ts +119 -28
- package/src/Random.ts +20 -6
- package/src/RcMap.ts +176 -13
- package/src/Record.ts +15 -0
- package/src/Redacted.ts +1 -1
- package/src/RequestResolver.ts +49 -26
- package/src/Result.ts +1 -1
- package/src/Scheduler.ts +21 -11
- package/src/Schema.ts +5032 -6518
- package/src/SchemaAST.ts +1156 -316
- package/src/SchemaGetter.ts +75 -21
- package/src/SchemaIssue.ts +260 -16
- package/src/SchemaParser.ts +2 -12
- package/src/SchemaRepresentation.ts +1774 -189
- package/src/SchemaTransformation.ts +145 -22
- package/src/Scope.ts +9 -2
- package/src/ScopedCache.ts +10 -3
- package/src/Sink.ts +31 -15
- package/src/StandardSchema.ts +207 -0
- package/src/Stream.ts +294 -76
- package/src/String.ts +20 -9
- package/src/Struct.ts +8 -4
- package/src/SynchronizedRef.ts +3 -5
- package/src/Terminal.ts +3 -3
- package/src/Tracer.ts +43 -14
- package/src/Tuple.ts +3 -1
- package/src/TxChunk.ts +1 -1
- package/src/TxDeferred.ts +1 -1
- package/src/TxHashMap.ts +1 -1
- package/src/TxHashSet.ts +92 -11
- package/src/TxPriorityQueue.ts +1 -1
- package/src/TxPubSub.ts +1 -1
- package/src/TxQueue.ts +22 -17
- package/src/TxReentrantLock.ts +29 -1
- package/src/TxRef.ts +1 -1
- package/src/TxSemaphore.ts +1 -1
- package/src/TxSubscriptionRef.ts +1 -1
- package/src/Types.ts +40 -17
- package/src/Utils.ts +3 -1
- package/src/index.ts +10 -0
- package/src/internal/arbitrary/model.ts +701 -0
- package/src/internal/arbitrary/regexp.ts +855 -0
- package/src/internal/arbitrary/runner.ts +608 -0
- package/src/internal/arbitrary/schema.ts +1800 -0
- package/src/internal/core.ts +48 -22
- package/src/internal/count.ts +14 -0
- package/src/internal/dateTime.ts +8 -10
- package/src/internal/effect.ts +510 -301
- package/src/internal/graph.ts +6 -1
- package/src/internal/hashMap.ts +5 -3
- package/src/internal/hashSet.ts +1 -1
- package/src/internal/matcher.ts +34 -19
- package/src/internal/metric.ts +1 -1
- package/src/internal/option.ts +8 -6
- package/src/internal/random.ts +20 -7
- package/src/internal/rcRef.ts +10 -7
- package/src/internal/references.ts +1 -0
- package/src/internal/request.ts +12 -7
- package/src/internal/result.ts +15 -11
- package/src/internal/schema/annotations.ts +3 -3
- package/src/internal/schema/fromJsonSchemaDocument.ts +326 -160
- package/src/internal/schema/fromRepresentation.ts +5 -3
- package/src/internal/schema/{schema.ts → make.ts} +0 -40
- package/src/internal/schema/parser.ts +8 -0
- package/src/internal/schema/standardSchema.ts +125 -0
- package/src/internal/schema/toCodeDocument.ts +58 -44
- package/src/internal/schema/toCodec.ts +312 -0
- package/src/internal/schema/toDifferJsonPatch.ts +24 -0
- package/src/internal/schema/toEncoderXml.ts +110 -0
- package/src/internal/schema/toEquivalence.ts +76 -0
- package/src/internal/schema/toFormatter.ts +230 -0
- package/src/internal/schema/toIso.ts +20 -0
- package/src/internal/schema/toJsonSchemaDocument.ts +125 -67
- package/src/internal/schema/toRepresentation.ts +1 -1
- package/src/internal/schemaError.ts +8 -0
- package/src/internal/stream.ts +14 -6
- package/src/internal/tracer.ts +4 -0
- package/src/internal/trie.ts +5 -2
- package/src/internal/uuid.ts +4 -0
- package/src/testing/TestSchema.ts +36 -30
- package/src/testing/index.ts +0 -5
- package/src/unstable/ai/AiError.ts +126 -6
- package/src/unstable/ai/AnthropicStructuredOutput.ts +8 -5
- package/src/unstable/ai/Chat.ts +35 -36
- package/src/unstable/ai/EmbeddingModel.ts +27 -15
- package/src/unstable/ai/LanguageModel.ts +283 -100
- package/src/unstable/ai/McpServer.ts +105 -92
- package/src/unstable/ai/OpenAiStructuredOutput.ts +6 -3
- package/src/unstable/ai/Prompt.ts +20 -5
- package/src/unstable/ai/Response.ts +107 -189
- package/src/unstable/ai/Tokenizer.ts +4 -5
- package/src/unstable/ai/Tool.ts +58 -35
- package/src/unstable/ai/Toolkit.ts +43 -37
- package/src/unstable/ai/internal/codec-transformer.ts +3 -2
- package/src/unstable/ai/internal/structured-output.ts +29 -6
- package/src/unstable/arbitrary/Arbitrary.ts +715 -0
- package/src/unstable/arbitrary/index.ts +10 -0
- package/src/unstable/cli/Argument.ts +111 -115
- package/src/unstable/cli/CliError.ts +2 -0
- package/src/unstable/cli/CliOutput.ts +41 -4
- package/src/unstable/cli/Command.ts +79 -78
- package/src/unstable/cli/Completions.ts +4 -4
- package/src/unstable/cli/Flag.ts +158 -169
- package/src/unstable/cli/GlobalFlag.ts +13 -13
- package/src/unstable/cli/Param.ts +150 -159
- package/src/unstable/cli/Primitive.ts +75 -76
- package/src/unstable/cli/Prompt.ts +543 -408
- package/src/unstable/cli/internal/completions/bash.ts +113 -38
- package/src/unstable/cli/internal/completions/descriptor.ts +23 -11
- package/src/unstable/cli/internal/completions/fish.ts +17 -9
- package/src/unstable/cli/internal/completions/zsh.ts +7 -4
- package/src/unstable/cli/internal/config.ts +4 -4
- package/src/unstable/cli/internal/parser.ts +1 -1
- package/src/unstable/cli/internal/wizard.ts +60 -32
- package/src/unstable/cluster/ClusterSchema.ts +19 -1
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +66 -16
- package/src/unstable/cluster/Entity.ts +3 -0
- package/src/unstable/cluster/EntityProxyServer.ts +6 -2
- package/src/unstable/cluster/Envelope.ts +32 -3
- package/src/unstable/cluster/HttpRunner.ts +52 -25
- package/src/unstable/cluster/Message.ts +35 -13
- package/src/unstable/cluster/MessageStorage.ts +69 -24
- package/src/unstable/cluster/Reply.ts +36 -19
- package/src/unstable/cluster/RunnerServer.ts +21 -11
- package/src/unstable/cluster/Runners.ts +93 -80
- package/src/unstable/cluster/Sharding.ts +44 -19
- package/src/unstable/cluster/ShardingConfig.ts +23 -23
- package/src/unstable/cluster/SocketRunner.ts +5 -4
- package/src/unstable/cluster/SqlMessageStorage.ts +12 -8
- package/src/unstable/cluster/SqlRunnerStorage.ts +18 -10
- package/src/unstable/cluster/internal/clusterAbandon.ts +14 -0
- package/src/unstable/cluster/internal/entityManager.ts +15 -6
- package/src/unstable/cluster/internal/interruptors.ts +58 -1
- package/src/unstable/cluster/internal/resourceRef.ts +15 -7
- package/src/unstable/devtools/DevToolsClient.ts +13 -3
- package/src/unstable/encoding/Ini.ts +2 -0
- package/src/unstable/encoding/SchemaBinary.ts +5308 -0
- package/src/unstable/encoding/Sse.ts +1 -1
- package/src/unstable/encoding/Toml.ts +7 -5
- package/src/unstable/encoding/Yaml.ts +18 -5
- package/src/unstable/encoding/index.ts +2 -2
- package/src/unstable/eventlog/Event.ts +7 -7
- package/src/unstable/eventlog/EventJournal.ts +22 -15
- package/src/unstable/eventlog/EventLog.ts +24 -14
- package/src/unstable/eventlog/EventLogMessage.ts +25 -15
- package/src/unstable/eventlog/EventLogRemote.ts +15 -4
- package/src/unstable/eventlog/EventLogServerUnencrypted.ts +2 -2
- package/src/unstable/eventlog/SqlEventJournal.ts +35 -10
- package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +11 -1
- package/src/unstable/http/Cookies.ts +2 -102
- package/src/unstable/http/FetchHttpClient.ts +1 -1
- package/src/unstable/http/FindMyWay/internal/router.ts +139 -33
- package/src/unstable/http/FindMyWay.ts +15 -5
- package/src/unstable/http/Headers.ts +3 -48
- package/src/unstable/http/HttpBody.ts +107 -36
- package/src/unstable/http/HttpClient.ts +41 -30
- package/src/unstable/http/HttpClientRequest.ts +32 -18
- package/src/unstable/http/HttpClientResponse.ts +16 -3
- package/src/unstable/http/HttpEffect.ts +145 -73
- package/src/unstable/http/HttpIncomingMessage.ts +4 -4
- package/src/unstable/http/HttpMiddleware.ts +43 -24
- package/src/unstable/http/HttpPlatform.ts +62 -20
- package/src/unstable/http/HttpRouter.ts +27 -16
- package/src/unstable/http/HttpServer.ts +18 -57
- package/src/unstable/http/HttpServerRequest.ts +17 -15
- package/src/unstable/http/HttpServerRespondable.ts +1 -1
- package/src/unstable/http/HttpServerResponse.ts +49 -40
- package/src/unstable/http/HttpStaticServer.ts +30 -28
- package/src/unstable/http/Mime.ts +76 -0
- package/src/unstable/http/Multipart.ts +35 -18
- package/src/unstable/http/MultipartParser/internal/multipart.ts +10 -3
- package/src/unstable/http/MultipartParser.ts +4 -3
- package/src/unstable/http/UrlParams.ts +3 -161
- package/src/unstable/http/index.ts +5 -0
- package/src/unstable/http/internal/compression.ts +11 -12
- package/src/unstable/http/internal/headers.ts +7 -0
- package/src/unstable/http/internal/httpBody.ts +9 -0
- package/src/unstable/http/internal/mimeTypes.ts +395 -0
- package/src/unstable/httpapi/HttpApiBuilder.ts +63 -11
- package/src/unstable/httpapi/HttpApiClient.ts +44 -24
- package/src/unstable/httpapi/HttpApiEndpoint.ts +24 -11
- package/src/unstable/httpapi/HttpApiError.ts +3 -1
- package/src/unstable/httpapi/HttpApiMiddleware.ts +7 -5
- package/src/unstable/httpapi/HttpApiScalar.ts +30 -27
- package/src/unstable/httpapi/HttpApiSchema.ts +14 -7
- package/src/unstable/httpapi/HttpApiSwagger.ts +6 -3
- package/src/unstable/httpapi/HttpApiTest.ts +6 -1
- package/src/unstable/httpapi/OpenApi.ts +32 -22
- package/src/unstable/net/IpInterface.ts +242 -0
- package/src/unstable/net/IpNetwork.ts +357 -0
- package/src/unstable/net/NetAddress.ts +1271 -0
- package/src/unstable/net/index.ts +20 -0
- package/src/unstable/observability/OtlpExporter.ts +5 -6
- package/src/unstable/observability/OtlpLogger.ts +9 -9
- package/src/unstable/observability/OtlpMetrics.ts +9 -8
- package/src/unstable/observability/OtlpResource.ts +5 -4
- package/src/unstable/observability/OtlpTracer.ts +103 -81
- package/src/unstable/observability/internal/otlpEnv.ts +10 -13
- package/src/unstable/persistence/PersistedCache.ts +1 -1
- package/src/unstable/persistence/PersistedQueue.ts +1100 -291
- package/src/unstable/persistence/RateLimiter.ts +64 -58
- package/src/unstable/process/ChildProcess.ts +15 -4
- package/src/unstable/process/ChildProcessSpawner.ts +1 -1
- package/src/unstable/reactivity/Atom.ts +6 -3
- package/src/unstable/reactivity/AtomHttpApi.ts +21 -10
- package/src/unstable/reactivity/AtomRegistry.ts +2 -4
- package/src/unstable/reactivity/AtomRpc.ts +6 -5
- package/src/unstable/reactivity/Hydration.ts +26 -7
- package/src/unstable/reactivity/Reactivity.ts +49 -36
- package/src/unstable/rpc/RpcClient.ts +100 -82
- package/src/unstable/rpc/RpcMessage.ts +78 -11
- package/src/unstable/rpc/RpcMiddleware.ts +7 -5
- package/src/unstable/rpc/RpcSerialization.ts +82 -92
- package/src/unstable/rpc/RpcServer.ts +171 -93
- package/src/unstable/schema/Model.ts +8 -7
- package/src/unstable/schema/VariantSchema.ts +3 -0
- package/src/unstable/socket/Socket.ts +714 -383
- package/src/unstable/socket/SocketServer.ts +5 -35
- package/src/unstable/sql/SqlClient.ts +42 -7
- package/src/unstable/sql/SqlConnection.ts +18 -0
- package/src/unstable/sql/SqlModel.ts +1 -1
- package/src/unstable/sql/Statement.ts +46 -20
- package/src/unstable/workers/Transferable.ts +1 -1
- package/src/unstable/workers/Worker.ts +3 -1
- package/src/unstable/workflow/Activity.ts +20 -9
- package/src/unstable/workflow/DurableClock.ts +1 -1
- package/src/unstable/workflow/DurableDeferred.ts +6 -0
- package/src/unstable/workflow/DurableQueue.ts +8 -0
- package/src/unstable/workflow/Workflow.ts +105 -28
- package/src/unstable/workflow/WorkflowEngine.ts +22 -0
- package/src/unstable/workflow/WorkflowProxy.ts +8 -4
- package/dist/internal/schema/schema.d.ts.map +0 -1
- package/dist/internal/schema/schema.js.map +0 -1
- package/dist/internal/schema/toArbitrary.d.ts +0 -2
- package/dist/internal/schema/toArbitrary.d.ts.map +0 -1
- package/dist/internal/schema/toArbitrary.js +0 -705
- package/dist/internal/schema/toArbitrary.js.map +0 -1
- package/dist/testing/FastCheck.d.ts +0 -90
- package/dist/testing/FastCheck.d.ts.map +0 -1
- package/dist/testing/FastCheck.js +0 -90
- package/dist/testing/FastCheck.js.map +0 -1
- package/dist/unstable/encoding/Msgpack.d.ts +0 -185
- package/dist/unstable/encoding/Msgpack.d.ts.map +0 -1
- package/dist/unstable/encoding/Msgpack.js +0 -227
- package/dist/unstable/encoding/Msgpack.js.map +0 -1
- package/src/internal/schema/toArbitrary.ts +0 -843
- package/src/testing/FastCheck.ts +0 -90
- package/src/unstable/encoding/Msgpack.ts +0 -432
- /package/dist/internal/{schema → arbitrary}/schema.d.ts +0 -0
package/dist/SchemaAST.js
CHANGED
|
@@ -16,7 +16,7 @@ import * as Effect from "./Effect.js";
|
|
|
16
16
|
import * as Exit from "./Exit.js";
|
|
17
17
|
import { format, formatPropertyKey } from "./Formatter.js";
|
|
18
18
|
import { identity, memoize, memoizeIdempotent } from "./Function.js";
|
|
19
|
-
import { effectIsExit, iterateEager } from "./internal/effect.js";
|
|
19
|
+
import { effectIsExit, iterateConcurrent, iterateEager, resolveConcurrency } from "./internal/effect.js";
|
|
20
20
|
import * as InternalRecord from "./internal/record.js";
|
|
21
21
|
import * as InternalAnnotations from "./internal/schema/annotations.js";
|
|
22
22
|
import * as InternalSchemaCause from "./internal/schema/cause.js";
|
|
@@ -311,56 +311,28 @@ export const isUnion = /*#__PURE__*/makeGuard("Union");
|
|
|
311
311
|
*/
|
|
312
312
|
export const isSuspend = /*#__PURE__*/makeGuard("Suspend");
|
|
313
313
|
/**
|
|
314
|
-
*
|
|
314
|
+
* Constructs a {@link Link}.
|
|
315
315
|
*
|
|
316
|
-
*
|
|
317
|
-
*
|
|
318
|
-
* A link pairs a target {@link AST} with a `Transformation` or `Middleware`
|
|
319
|
-
* that converts values between the current node and the target.
|
|
320
|
-
*
|
|
321
|
-
* - `to` — the AST node on the other side of this transformation step.
|
|
322
|
-
* - `transformation` — the bidirectional conversion logic (decode/encode).
|
|
323
|
-
*
|
|
324
|
-
* Links are composed into a non-empty array ({@link Encoding}) attached to
|
|
325
|
-
* AST nodes that have a different encoded representation.
|
|
326
|
-
*
|
|
327
|
-
* @see {@link Encoding}
|
|
328
|
-
* @see {@link decodeTo}
|
|
329
|
-
* @category models
|
|
316
|
+
* @category constructors
|
|
330
317
|
* @since 4.0.0
|
|
331
318
|
*/
|
|
332
|
-
export
|
|
319
|
+
export const Link = class {
|
|
333
320
|
to;
|
|
334
321
|
transformation;
|
|
335
322
|
constructor(to, transformation) {
|
|
336
323
|
this.to = to;
|
|
337
324
|
this.transformation = transformation;
|
|
338
325
|
}
|
|
339
|
-
}
|
|
326
|
+
};
|
|
340
327
|
/** @internal */
|
|
341
328
|
export const defaultParseOptions = {};
|
|
342
329
|
/**
|
|
343
|
-
*
|
|
344
|
-
*
|
|
345
|
-
* **Details**
|
|
330
|
+
* Constructs a {@link Context}.
|
|
346
331
|
*
|
|
347
|
-
*
|
|
348
|
-
* default, or carries key-level annotations. Typically set by helpers like
|
|
349
|
-
* {@link optionalKey} and `Schema.mutableKey`.
|
|
350
|
-
*
|
|
351
|
-
* - `isOptional` — the property key may be absent from the input.
|
|
352
|
-
* - `isMutable` — the property is `readonly` when `false`.
|
|
353
|
-
* - `constructorDefault` — a {@link Link} applied during construction to
|
|
354
|
-
* supply missing values.
|
|
355
|
-
* - `annotations` — key-level annotations (e.g. description of the key
|
|
356
|
-
* itself).
|
|
357
|
-
*
|
|
358
|
-
* @see {@link optionalKey}
|
|
359
|
-
* @see {@link isOptional}
|
|
360
|
-
* @category models
|
|
332
|
+
* @category constructors
|
|
361
333
|
* @since 4.0.0
|
|
362
334
|
*/
|
|
363
|
-
export
|
|
335
|
+
export const Context = class {
|
|
364
336
|
isOptional;
|
|
365
337
|
isMutable;
|
|
366
338
|
/** Used for constructor default values (e.g. `withConstructorDefault` API) */
|
|
@@ -373,29 +345,9 @@ export class Context {
|
|
|
373
345
|
this.constructorDefault = constructorDefault;
|
|
374
346
|
this.annotations = annotations;
|
|
375
347
|
}
|
|
376
|
-
}
|
|
348
|
+
};
|
|
377
349
|
const TypeId = "~effect/Schema";
|
|
378
|
-
|
|
379
|
-
* Represents the abstract base class for all {@link AST} node variants.
|
|
380
|
-
*
|
|
381
|
-
* **Details**
|
|
382
|
-
*
|
|
383
|
-
* Every AST node extends `Base` and inherits these fields:
|
|
384
|
-
*
|
|
385
|
-
* - `annotations` — user-supplied metadata (identifier, title, description,
|
|
386
|
-
* arbitrary keys).
|
|
387
|
-
* - `checks` — optional {@link Checks} for post-type-match validation.
|
|
388
|
-
* - `encoding` — optional {@link Encoding} chain for type ↔ wire
|
|
389
|
-
* transformations.
|
|
390
|
-
* - `context` — optional {@link Context} for per-property metadata.
|
|
391
|
-
*
|
|
392
|
-
* Subclasses add a `_tag` discriminant and variant-specific data.
|
|
393
|
-
*
|
|
394
|
-
* @see {@link AST}
|
|
395
|
-
* @category models
|
|
396
|
-
* @since 4.0.0
|
|
397
|
-
*/
|
|
398
|
-
export class Base {
|
|
350
|
+
class ASTNodeImpl {
|
|
399
351
|
[TypeId] = TypeId;
|
|
400
352
|
annotations;
|
|
401
353
|
checks;
|
|
@@ -412,34 +364,27 @@ export class Base {
|
|
|
412
364
|
}
|
|
413
365
|
}
|
|
414
366
|
/**
|
|
415
|
-
*
|
|
416
|
-
*
|
|
417
|
-
* **When to use**
|
|
367
|
+
* Constructs a {@link Declaration}.
|
|
418
368
|
*
|
|
419
|
-
*
|
|
420
|
-
*
|
|
421
|
-
*
|
|
422
|
-
* **Details**
|
|
423
|
-
*
|
|
424
|
-
* - `typeParameters` — inner schemas this declaration is parameterized over
|
|
425
|
-
* (e.g. the element type for a custom collection).
|
|
426
|
-
* - `run` — factory that receives `typeParameters` and returns a parser that
|
|
427
|
-
* validates or transforms raw input.
|
|
428
|
-
*
|
|
429
|
-
* @see {@link isDeclaration}
|
|
430
|
-
* @category models
|
|
431
|
-
* @since 3.10.0
|
|
369
|
+
* @category constructors
|
|
370
|
+
* @since 4.0.0
|
|
432
371
|
*/
|
|
433
|
-
export
|
|
372
|
+
export const Declaration = class extends ASTNodeImpl {
|
|
434
373
|
_tag = "Declaration";
|
|
435
374
|
typeParameters;
|
|
436
375
|
run;
|
|
437
376
|
encodingChecks;
|
|
438
|
-
|
|
377
|
+
/**
|
|
378
|
+
* Parser factory {@link flip} swaps in, so a declaration can behave
|
|
379
|
+
* differently when encoding. `undefined` reuses `run`.
|
|
380
|
+
*/
|
|
381
|
+
encodingRun;
|
|
382
|
+
constructor(typeParameters, run, annotations, checks, encoding, context, encodingChecks, encodingRun) {
|
|
439
383
|
super(annotations, checks, encoding, context);
|
|
440
384
|
this.typeParameters = typeParameters;
|
|
441
385
|
this.run = run;
|
|
442
386
|
this.encodingChecks = encodingChecks;
|
|
387
|
+
this.encodingRun = encodingRun;
|
|
443
388
|
}
|
|
444
389
|
/** @internal */
|
|
445
390
|
getParser() {
|
|
@@ -449,17 +394,17 @@ export class Declaration extends Base {
|
|
|
449
394
|
return (run ??= this.run(this.typeParameters))(input, this, options);
|
|
450
395
|
};
|
|
451
396
|
}
|
|
452
|
-
_rebuild(recur, checks, encodingChecks) {
|
|
397
|
+
_rebuild(recur, checks, encodingChecks, run, encodingRun) {
|
|
453
398
|
const tps = mapOrSame(this.typeParameters, recur);
|
|
454
|
-
return tps === this.typeParameters && checks === this.checks && encodingChecks === this.encodingChecks ? this : new Declaration(tps,
|
|
399
|
+
return tps === this.typeParameters && checks === this.checks && encodingChecks === this.encodingChecks && run === this.run && encodingRun === this.encodingRun ? this : new Declaration(tps, run, this.annotations, checks, undefined, this.context, encodingChecks, encodingRun);
|
|
455
400
|
}
|
|
456
401
|
/** @internal */
|
|
457
402
|
recur(recur) {
|
|
458
|
-
return this._rebuild(recur, this.checks, this.encodingChecks);
|
|
403
|
+
return this._rebuild(recur, this.checks, this.encodingChecks, this.run, this.encodingRun);
|
|
459
404
|
}
|
|
460
405
|
/** @internal */
|
|
461
406
|
flip(recur) {
|
|
462
|
-
return this._rebuild(recur, this.encodingChecks, this.checks);
|
|
407
|
+
return this._rebuild(recur, this.encodingChecks, this.checks, this.encodingRun ?? this.run, this.run);
|
|
463
408
|
}
|
|
464
409
|
/** @internal */
|
|
465
410
|
getExpected() {
|
|
@@ -467,20 +412,14 @@ export class Declaration extends Base {
|
|
|
467
412
|
if (typeof expected === "string") return expected;
|
|
468
413
|
return "<Declaration>";
|
|
469
414
|
}
|
|
470
|
-
}
|
|
415
|
+
};
|
|
471
416
|
/**
|
|
472
|
-
*
|
|
473
|
-
*
|
|
474
|
-
* **Details**
|
|
417
|
+
* Constructs a {@link Null}.
|
|
475
418
|
*
|
|
476
|
-
*
|
|
477
|
-
*
|
|
478
|
-
* @see {@link null_ null}
|
|
479
|
-
* @see {@link isNull}
|
|
480
|
-
* @category models
|
|
419
|
+
* @category constructors
|
|
481
420
|
* @since 4.0.0
|
|
482
421
|
*/
|
|
483
|
-
export
|
|
422
|
+
export const Null = class extends ASTNodeImpl {
|
|
484
423
|
_tag = "Null";
|
|
485
424
|
/** @internal */
|
|
486
425
|
getParser() {
|
|
@@ -490,7 +429,7 @@ export class Null extends Base {
|
|
|
490
429
|
getExpected() {
|
|
491
430
|
return "null";
|
|
492
431
|
}
|
|
493
|
-
}
|
|
432
|
+
};
|
|
494
433
|
const null_ = /*#__PURE__*/new Null();
|
|
495
434
|
export {
|
|
496
435
|
/**
|
|
@@ -506,18 +445,12 @@ export {
|
|
|
506
445
|
*/
|
|
507
446
|
null_ as null };
|
|
508
447
|
/**
|
|
509
|
-
*
|
|
510
|
-
*
|
|
511
|
-
* **Details**
|
|
448
|
+
* Constructs a {@link Undefined}.
|
|
512
449
|
*
|
|
513
|
-
*
|
|
514
|
-
*
|
|
515
|
-
* @see {@link undefined}
|
|
516
|
-
* @see {@link isUndefined}
|
|
517
|
-
* @category models
|
|
450
|
+
* @category constructors
|
|
518
451
|
* @since 4.0.0
|
|
519
452
|
*/
|
|
520
|
-
export
|
|
453
|
+
export const Undefined = class extends ASTNodeImpl {
|
|
521
454
|
_tag = "Undefined";
|
|
522
455
|
/** @internal */
|
|
523
456
|
getParser() {
|
|
@@ -531,7 +464,7 @@ export class Undefined extends Base {
|
|
|
531
464
|
getExpected() {
|
|
532
465
|
return "undefined";
|
|
533
466
|
}
|
|
534
|
-
}
|
|
467
|
+
};
|
|
535
468
|
const undefinedToNull = /*#__PURE__*/new Link(null_, /*#__PURE__*/new SchemaTransformation.Transformation(/*#__PURE__*/SchemaGetter.transform(() => undefined), /*#__PURE__*/SchemaGetter.transform(() => null)));
|
|
536
469
|
const undefined_ = /*#__PURE__*/new Undefined();
|
|
537
470
|
export {
|
|
@@ -548,26 +481,12 @@ export {
|
|
|
548
481
|
*/
|
|
549
482
|
undefined_ as undefined };
|
|
550
483
|
/**
|
|
551
|
-
*
|
|
552
|
-
*
|
|
553
|
-
* **When to use**
|
|
554
|
-
*
|
|
555
|
-
* Use when you need an AST node for a value whose result is intentionally
|
|
556
|
-
* ignored.
|
|
557
|
-
*
|
|
558
|
-
* **Details**
|
|
559
|
-
*
|
|
560
|
-
* Parsers built from this node accept any present runtime input and map it to
|
|
561
|
-
* `undefined`. Public schemas built from it may still expose `void` as their
|
|
562
|
-
* typed decoded and encoded representation.
|
|
484
|
+
* Constructs a {@link Void}.
|
|
563
485
|
*
|
|
564
|
-
* @
|
|
565
|
-
* @see {@link void_ void}
|
|
566
|
-
* @see {@link isVoid}
|
|
567
|
-
* @category models
|
|
486
|
+
* @category constructors
|
|
568
487
|
* @since 4.0.0
|
|
569
488
|
*/
|
|
570
|
-
export
|
|
489
|
+
export const Void = class extends ASTNodeImpl {
|
|
571
490
|
_tag = "Void";
|
|
572
491
|
/** @internal */
|
|
573
492
|
getParser() {
|
|
@@ -582,7 +501,7 @@ export class Void extends Base {
|
|
|
582
501
|
getExpected() {
|
|
583
502
|
return "void";
|
|
584
503
|
}
|
|
585
|
-
}
|
|
504
|
+
};
|
|
586
505
|
const void_ = /*#__PURE__*/new Void();
|
|
587
506
|
export {
|
|
588
507
|
/**
|
|
@@ -607,19 +526,12 @@ export {
|
|
|
607
526
|
*/
|
|
608
527
|
void_ as void };
|
|
609
528
|
/**
|
|
610
|
-
*
|
|
611
|
-
*
|
|
612
|
-
* **Details**
|
|
613
|
-
*
|
|
614
|
-
* Parsing always fails. Useful as a placeholder in unions or as the result
|
|
615
|
-
* of narrowing that eliminates all options.
|
|
529
|
+
* Constructs a {@link Never}.
|
|
616
530
|
*
|
|
617
|
-
* @
|
|
618
|
-
* @see {@link isNever}
|
|
619
|
-
* @category models
|
|
531
|
+
* @category constructors
|
|
620
532
|
* @since 4.0.0
|
|
621
533
|
*/
|
|
622
|
-
export
|
|
534
|
+
export const Never = class extends ASTNodeImpl {
|
|
623
535
|
_tag = "Never";
|
|
624
536
|
/** @internal */
|
|
625
537
|
getParser() {
|
|
@@ -629,7 +541,7 @@ export class Never extends Base {
|
|
|
629
541
|
getExpected() {
|
|
630
542
|
return "never";
|
|
631
543
|
}
|
|
632
|
-
}
|
|
544
|
+
};
|
|
633
545
|
/**
|
|
634
546
|
* Provides the singleton {@link Never} AST instance.
|
|
635
547
|
*
|
|
@@ -646,15 +558,12 @@ export class Never extends Base {
|
|
|
646
558
|
*/
|
|
647
559
|
export const never = /*#__PURE__*/new Never();
|
|
648
560
|
/**
|
|
649
|
-
*
|
|
561
|
+
* Constructs a {@link Any}.
|
|
650
562
|
*
|
|
651
|
-
* @
|
|
652
|
-
* @see {@link isAny}
|
|
653
|
-
*
|
|
654
|
-
* @category models
|
|
563
|
+
* @category constructors
|
|
655
564
|
* @since 4.0.0
|
|
656
565
|
*/
|
|
657
|
-
export
|
|
566
|
+
export const Any = class extends ASTNodeImpl {
|
|
658
567
|
_tag = "Any";
|
|
659
568
|
/** @internal */
|
|
660
569
|
getParser() {
|
|
@@ -664,7 +573,7 @@ export class Any extends Base {
|
|
|
664
573
|
getExpected() {
|
|
665
574
|
return "any";
|
|
666
575
|
}
|
|
667
|
-
}
|
|
576
|
+
};
|
|
668
577
|
/**
|
|
669
578
|
* Provides the singleton {@link Any} AST instance.
|
|
670
579
|
*
|
|
@@ -680,19 +589,12 @@ export class Any extends Base {
|
|
|
680
589
|
*/
|
|
681
590
|
export const any = /*#__PURE__*/new Any();
|
|
682
591
|
/**
|
|
683
|
-
*
|
|
684
|
-
*
|
|
685
|
-
* **Details**
|
|
592
|
+
* Constructs a {@link Unknown}.
|
|
686
593
|
*
|
|
687
|
-
*
|
|
688
|
-
* `unknown` rather than `any`.
|
|
689
|
-
*
|
|
690
|
-
* @see {@link unknown}
|
|
691
|
-
* @see {@link isUnknown}
|
|
692
|
-
* @category models
|
|
594
|
+
* @category constructors
|
|
693
595
|
* @since 4.0.0
|
|
694
596
|
*/
|
|
695
|
-
export
|
|
597
|
+
export const Unknown = class extends ASTNodeImpl {
|
|
696
598
|
_tag = "Unknown";
|
|
697
599
|
/** @internal */
|
|
698
600
|
getParser() {
|
|
@@ -702,7 +604,7 @@ export class Unknown extends Base {
|
|
|
702
604
|
getExpected() {
|
|
703
605
|
return "unknown";
|
|
704
606
|
}
|
|
705
|
-
}
|
|
607
|
+
};
|
|
706
608
|
/**
|
|
707
609
|
* Provides the singleton {@link Unknown} AST instance.
|
|
708
610
|
*
|
|
@@ -718,16 +620,12 @@ export class Unknown extends Base {
|
|
|
718
620
|
*/
|
|
719
621
|
export const unknown = /*#__PURE__*/new Unknown();
|
|
720
622
|
/**
|
|
721
|
-
*
|
|
722
|
-
* and functions (anything non-primitive and non-null).
|
|
723
|
-
*
|
|
724
|
-
* @see {@link objectKeyword}
|
|
725
|
-
* @see {@link isObjectKeyword}
|
|
623
|
+
* Constructs a {@link ObjectKeyword}.
|
|
726
624
|
*
|
|
727
|
-
* @category
|
|
728
|
-
* @since
|
|
625
|
+
* @category constructors
|
|
626
|
+
* @since 4.0.0
|
|
729
627
|
*/
|
|
730
|
-
export
|
|
628
|
+
export const ObjectKeyword = class extends ASTNodeImpl {
|
|
731
629
|
_tag = "ObjectKeyword";
|
|
732
630
|
/** @internal */
|
|
733
631
|
getParser() {
|
|
@@ -737,7 +635,7 @@ export class ObjectKeyword extends Base {
|
|
|
737
635
|
getExpected() {
|
|
738
636
|
return "object | array | function";
|
|
739
637
|
}
|
|
740
|
-
}
|
|
638
|
+
};
|
|
741
639
|
/**
|
|
742
640
|
* Provides the singleton {@link ObjectKeyword} AST instance.
|
|
743
641
|
*
|
|
@@ -754,22 +652,21 @@ export class ObjectKeyword extends Base {
|
|
|
754
652
|
*/
|
|
755
653
|
export const objectKeyword = /*#__PURE__*/new ObjectKeyword();
|
|
756
654
|
/**
|
|
757
|
-
*
|
|
758
|
-
*
|
|
759
|
-
* **Details**
|
|
655
|
+
* Constructs a {@link Enum}. Numeric values must be finite.
|
|
760
656
|
*
|
|
761
|
-
*
|
|
762
|
-
* `string | number`. Parsing succeeds when the input matches any enum value.
|
|
763
|
-
*
|
|
764
|
-
* @see {@link isEnum}
|
|
765
|
-
* @category models
|
|
657
|
+
* @category constructors
|
|
766
658
|
* @since 4.0.0
|
|
767
659
|
*/
|
|
768
|
-
export
|
|
660
|
+
export const Enum = class extends ASTNodeImpl {
|
|
769
661
|
_tag = "Enum";
|
|
770
662
|
enums;
|
|
771
663
|
constructor(enums, annotations, checks, encoding, context) {
|
|
772
664
|
super(annotations, checks, encoding, context);
|
|
665
|
+
for (const [, value] of enums) {
|
|
666
|
+
if (typeof value === "number" && !globalThis.Number.isFinite(value)) {
|
|
667
|
+
throw new Error(`A numeric enum value must be finite, got ${format(value)}`);
|
|
668
|
+
}
|
|
669
|
+
}
|
|
773
670
|
this.enums = enums;
|
|
774
671
|
}
|
|
775
672
|
/** @internal */
|
|
@@ -781,7 +678,7 @@ export class Enum extends Base {
|
|
|
781
678
|
toCodecStringTree() {
|
|
782
679
|
if (this.enums.some(([_, v]) => typeof v === "number")) {
|
|
783
680
|
const coercions = Object.fromEntries(this.enums.map(([_, v]) => [globalThis.String(v), v]));
|
|
784
|
-
return replaceEncoding(this, [new Link(new Union(Object.keys(coercions).map(k => new Literal(k))
|
|
681
|
+
return replaceEncoding(this, [new Link(new Union(Object.keys(coercions).map(k => new Literal(k))), new SchemaTransformation.Transformation(SchemaGetter.transform(s => coercions[s]), SchemaGetter.String()))]);
|
|
785
682
|
}
|
|
786
683
|
return this;
|
|
787
684
|
}
|
|
@@ -789,36 +686,46 @@ export class Enum extends Base {
|
|
|
789
686
|
getExpected() {
|
|
790
687
|
return this.enums.map(([_, value]) => JSON.stringify(value)).join(" | ");
|
|
791
688
|
}
|
|
792
|
-
}
|
|
793
|
-
function isTemplateLiteralPart(ast) {
|
|
689
|
+
};
|
|
690
|
+
function isTemplateLiteralPart(ast, path, validated) {
|
|
691
|
+
if (validated.has(ast)) return true;
|
|
692
|
+
if (ast.encoding) {
|
|
693
|
+
throw new Error(`TemplateLiteral parts cannot have an encoding at ${path}`);
|
|
694
|
+
}
|
|
695
|
+
let valid;
|
|
794
696
|
switch (ast._tag) {
|
|
795
697
|
case "String":
|
|
796
698
|
case "Number":
|
|
797
699
|
case "BigInt":
|
|
798
|
-
|
|
700
|
+
valid = true;
|
|
701
|
+
break;
|
|
799
702
|
case "Literal":
|
|
703
|
+
valid = !ast.checks;
|
|
704
|
+
break;
|
|
800
705
|
case "TemplateLiteral":
|
|
801
|
-
|
|
706
|
+
valid = !ast.checks && ast.parts.every((part, index) => isTemplateLiteralPart(part, `${path}.parts[${index}]`, validated));
|
|
707
|
+
break;
|
|
802
708
|
case "Union":
|
|
803
|
-
|
|
709
|
+
valid = !ast.checks && ast.types.every((part, index) => isTemplateLiteralPart(part, `${path}.types[${index}]`, validated));
|
|
710
|
+
break;
|
|
804
711
|
default:
|
|
805
712
|
return false;
|
|
806
713
|
}
|
|
714
|
+
if (valid) validated.add(ast);
|
|
715
|
+
return valid;
|
|
807
716
|
}
|
|
808
717
|
/**
|
|
809
|
-
*
|
|
810
|
-
* (e.g. `` `user_${string}` ``).
|
|
718
|
+
* Constructs a {@link TemplateLiteral}.
|
|
811
719
|
*
|
|
812
|
-
* **
|
|
720
|
+
* **Gotchas**
|
|
813
721
|
*
|
|
814
|
-
*
|
|
815
|
-
*
|
|
722
|
+
* Throws if a part contains an encoding, including inside unions or nested
|
|
723
|
+
* template literals. Parts must describe their values without transformations.
|
|
816
724
|
*
|
|
817
|
-
* @
|
|
818
|
-
* @
|
|
819
|
-
* @since 3.10.0
|
|
725
|
+
* @category constructors
|
|
726
|
+
* @since 4.0.0
|
|
820
727
|
*/
|
|
821
|
-
export
|
|
728
|
+
export const TemplateLiteral = class extends ASTNodeImpl {
|
|
822
729
|
_tag = "TemplateLiteral";
|
|
823
730
|
parts;
|
|
824
731
|
/** @internal */
|
|
@@ -831,14 +738,14 @@ export class TemplateLiteral extends Base {
|
|
|
831
738
|
super(annotations, checks, encoding, context);
|
|
832
739
|
const encodedParts = [];
|
|
833
740
|
const literals = [];
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
} else {
|
|
840
|
-
throw new Error(`Invalid TemplateLiteral part ${encoded._tag}`);
|
|
741
|
+
const validated = new WeakSet();
|
|
742
|
+
for (let index = 0; index < parts.length; index++) {
|
|
743
|
+
const part = parts[index];
|
|
744
|
+
if (!isTemplateLiteralPart(part, `parts[${index}]`, validated)) {
|
|
745
|
+
throw new Error(`Invalid TemplateLiteral part ${part._tag}`);
|
|
841
746
|
}
|
|
747
|
+
encodedParts.push(part);
|
|
748
|
+
literals.push(part._tag === "Literal" ? globalThis.String(part.literal) : undefined);
|
|
842
749
|
}
|
|
843
750
|
const suffixLengths = new Array(encodedParts.length + 1);
|
|
844
751
|
suffixLengths[encodedParts.length] = 0;
|
|
@@ -852,7 +759,8 @@ export class TemplateLiteral extends Base {
|
|
|
852
759
|
}
|
|
853
760
|
/** @internal */
|
|
854
761
|
getParser(compile) {
|
|
855
|
-
const
|
|
762
|
+
const tuple = new Arrays(false, this.parts.map(partFromString), []);
|
|
763
|
+
const parser = compile(decodeTo(string, tuple, templateLiteralTransformation(this)));
|
|
856
764
|
return (input, options) => {
|
|
857
765
|
if (input === InternalParser.missing) return InternalParser.missingExit;
|
|
858
766
|
const result = parser(input, options);
|
|
@@ -873,31 +781,39 @@ export class TemplateLiteral extends Base {
|
|
|
873
781
|
matchPart(s, options) {
|
|
874
782
|
return segmentTemplateLiteralParts(this, s, options) === undefined ? undefined : s;
|
|
875
783
|
}
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
784
|
+
};
|
|
785
|
+
/** @internal */
|
|
786
|
+
export function templateLiteralParser(parts) {
|
|
787
|
+
// Encoded members can overlap even when decoding selects exactly one member.
|
|
788
|
+
// Match their spellings here; the original tuple enforces the union's mode.
|
|
789
|
+
const normalize = memoize(encoded => {
|
|
790
|
+
if (encoded._tag !== "Union") return encoded;
|
|
791
|
+
const types = mapOrSame(encoded.types, normalize);
|
|
792
|
+
return (encoded.options?.mode ?? "anyOf") === "anyOf" && types === encoded.types ? encoded : new Union(types, encoded.options === undefined ? undefined : {
|
|
793
|
+
...encoded.options,
|
|
794
|
+
mode: "anyOf"
|
|
795
|
+
}, encoded.annotations, encoded.checks, undefined, encoded.context);
|
|
796
|
+
});
|
|
797
|
+
const template = new TemplateLiteral(parts.map(part => normalize(toEncoded(part))));
|
|
798
|
+
const tuple = new Arrays(false, parts.map(partFromString), []);
|
|
799
|
+
return decodeTo(template, tuple, templateLiteralTransformation(template));
|
|
800
|
+
}
|
|
801
|
+
function templateLiteralTransformation(template) {
|
|
802
|
+
return new SchemaTransformation.Transformation(SchemaGetter.transformEffect((s, options) => {
|
|
803
|
+
const segments = segmentTemplateLiteralParts(template, s, options);
|
|
804
|
+
if (segments) return Effect.succeed(segments);
|
|
805
|
+
return Effect.fail(new SchemaIssue.InvalidValue({
|
|
806
|
+
expected: "a string matching template literal parts"
|
|
807
|
+
}, s, options));
|
|
808
|
+
}), SchemaGetter.transform(parts => parts.join("")));
|
|
887
809
|
}
|
|
888
810
|
/**
|
|
889
|
-
*
|
|
890
|
-
*
|
|
891
|
-
* **Details**
|
|
811
|
+
* Constructs a {@link UniqueSymbol}.
|
|
892
812
|
*
|
|
893
|
-
*
|
|
894
|
-
*
|
|
895
|
-
*
|
|
896
|
-
* @see {@link isUniqueSymbol}
|
|
897
|
-
* @category models
|
|
898
|
-
* @since 3.10.0
|
|
813
|
+
* @category constructors
|
|
814
|
+
* @since 4.0.0
|
|
899
815
|
*/
|
|
900
|
-
export
|
|
816
|
+
export const UniqueSymbol = class extends ASTNodeImpl {
|
|
901
817
|
_tag = "UniqueSymbol";
|
|
902
818
|
symbol;
|
|
903
819
|
constructor(symbol, annotations, checks, encoding, context) {
|
|
@@ -910,38 +826,21 @@ export class UniqueSymbol extends Base {
|
|
|
910
826
|
}
|
|
911
827
|
/** @internal */
|
|
912
828
|
toCodecStringTree() {
|
|
913
|
-
|
|
829
|
+
const key = globalThis.Symbol.keyFor(this.symbol);
|
|
830
|
+
return replaceEncoding(this, [new Link(key === undefined ? never : new Literal(globalThis.String(this.symbol)), symbolToString.transformation)]);
|
|
914
831
|
}
|
|
915
832
|
/** @internal */
|
|
916
833
|
getExpected() {
|
|
917
834
|
return globalThis.String(this.symbol);
|
|
918
835
|
}
|
|
919
|
-
}
|
|
836
|
+
};
|
|
920
837
|
/**
|
|
921
|
-
*
|
|
922
|
-
* bigint).
|
|
923
|
-
*
|
|
924
|
-
* **Details**
|
|
925
|
-
*
|
|
926
|
-
* Parsing succeeds only when the input is strictly equal (`===`) to the
|
|
927
|
-
* stored `literal`. Numeric literals must be finite — `Infinity`, `-Infinity`,
|
|
928
|
-
* and `NaN` are rejected at construction time.
|
|
929
|
-
*
|
|
930
|
-
* **Example** (Creating a literal AST)
|
|
931
|
-
*
|
|
932
|
-
* ```ts import.meta.vitest
|
|
933
|
-
* import { SchemaAST } from "effect"
|
|
838
|
+
* Constructs a {@link Literal}.
|
|
934
839
|
*
|
|
935
|
-
*
|
|
936
|
-
*
|
|
937
|
-
* ```
|
|
938
|
-
*
|
|
939
|
-
* @see {@link LiteralValue}
|
|
940
|
-
* @see {@link isLiteral}
|
|
941
|
-
* @category models
|
|
942
|
-
* @since 3.10.0
|
|
840
|
+
* @category constructors
|
|
841
|
+
* @since 4.0.0
|
|
943
842
|
*/
|
|
944
|
-
export
|
|
843
|
+
export const Literal = class extends ASTNodeImpl {
|
|
945
844
|
_tag = "Literal";
|
|
946
845
|
literal;
|
|
947
846
|
constructor(literal, annotations, checks, encoding, context) {
|
|
@@ -971,21 +870,18 @@ export class Literal extends Base {
|
|
|
971
870
|
getExpected() {
|
|
972
871
|
return typeof this.literal === "string" ? JSON.stringify(this.literal) : globalThis.String(this.literal);
|
|
973
872
|
}
|
|
974
|
-
}
|
|
873
|
+
};
|
|
975
874
|
function literalToString(ast) {
|
|
976
875
|
const literalAsString = globalThis.String(ast.literal);
|
|
977
876
|
return replaceEncoding(ast, [new Link(new Literal(literalAsString), new SchemaTransformation.Transformation(SchemaGetter.transform(() => ast.literal), SchemaGetter.transform(() => literalAsString)))]);
|
|
978
877
|
}
|
|
979
878
|
/**
|
|
980
|
-
*
|
|
981
|
-
*
|
|
982
|
-
* @see {@link string}
|
|
983
|
-
* @see {@link isString}
|
|
879
|
+
* Constructs a {@link String}.
|
|
984
880
|
*
|
|
985
|
-
* @category
|
|
881
|
+
* @category constructors
|
|
986
882
|
* @since 4.0.0
|
|
987
883
|
*/
|
|
988
|
-
export
|
|
884
|
+
export const String = class extends ASTNodeImpl {
|
|
989
885
|
_tag = "String";
|
|
990
886
|
/** @internal */
|
|
991
887
|
getParser() {
|
|
@@ -1000,7 +896,7 @@ export class String extends Base {
|
|
|
1000
896
|
getExpected() {
|
|
1001
897
|
return "string";
|
|
1002
898
|
}
|
|
1003
|
-
}
|
|
899
|
+
};
|
|
1004
900
|
/**
|
|
1005
901
|
* Provides the singleton {@link String} AST instance.
|
|
1006
902
|
*
|
|
@@ -1016,25 +912,12 @@ export class String extends Base {
|
|
|
1016
912
|
*/
|
|
1017
913
|
export const string = /*#__PURE__*/new String();
|
|
1018
914
|
/**
|
|
1019
|
-
*
|
|
1020
|
-
* `-Infinity`).
|
|
1021
|
-
*
|
|
1022
|
-
* **Details**
|
|
1023
|
-
*
|
|
1024
|
-
* Default JSON serialization:
|
|
1025
|
-
*
|
|
1026
|
-
* - Finite numbers are serialized as JSON numbers.
|
|
1027
|
-
* - `Infinity`, `-Infinity`, and `NaN` are serialized as JSON strings.
|
|
1028
|
-
*
|
|
1029
|
-
* If the node has an `isFinite` or `isInt` check, the string fallback is
|
|
1030
|
-
* skipped since non-finite values cannot occur.
|
|
915
|
+
* Constructs a {@link Number}.
|
|
1031
916
|
*
|
|
1032
|
-
* @
|
|
1033
|
-
* @see {@link isNumber}
|
|
1034
|
-
* @category models
|
|
917
|
+
* @category constructors
|
|
1035
918
|
* @since 4.0.0
|
|
1036
919
|
*/
|
|
1037
|
-
export
|
|
920
|
+
export const Number = class extends ASTNodeImpl {
|
|
1038
921
|
_tag = "Number";
|
|
1039
922
|
/** @internal */
|
|
1040
923
|
getParser() {
|
|
@@ -1072,7 +955,7 @@ export class Number extends Base {
|
|
|
1072
955
|
getExpected() {
|
|
1073
956
|
return "number";
|
|
1074
957
|
}
|
|
1075
|
-
}
|
|
958
|
+
};
|
|
1076
959
|
function hasCheck(checks, id) {
|
|
1077
960
|
return checks.some(check => check.annotations?.representation?.id === id || check._tag === "FilterGroup" && hasCheck(check.checks, id));
|
|
1078
961
|
}
|
|
@@ -1092,15 +975,12 @@ function hasCheck(checks, id) {
|
|
|
1092
975
|
*/
|
|
1093
976
|
export const number = /*#__PURE__*/new Number();
|
|
1094
977
|
/**
|
|
1095
|
-
*
|
|
978
|
+
* Constructs a {@link Boolean}.
|
|
1096
979
|
*
|
|
1097
|
-
* @
|
|
1098
|
-
* @see {@link isBoolean}
|
|
1099
|
-
*
|
|
1100
|
-
* @category models
|
|
980
|
+
* @category constructors
|
|
1101
981
|
* @since 4.0.0
|
|
1102
982
|
*/
|
|
1103
|
-
export
|
|
983
|
+
export const Boolean = class extends ASTNodeImpl {
|
|
1104
984
|
_tag = "Boolean";
|
|
1105
985
|
/** @internal */
|
|
1106
986
|
getParser() {
|
|
@@ -1110,7 +990,7 @@ export class Boolean extends Base {
|
|
|
1110
990
|
getExpected() {
|
|
1111
991
|
return "boolean";
|
|
1112
992
|
}
|
|
1113
|
-
}
|
|
993
|
+
};
|
|
1114
994
|
/**
|
|
1115
995
|
* Provides the singleton {@link Boolean} AST instance.
|
|
1116
996
|
*
|
|
@@ -1127,24 +1007,12 @@ export class Boolean extends Base {
|
|
|
1127
1007
|
*/
|
|
1128
1008
|
export const boolean = /*#__PURE__*/new Boolean();
|
|
1129
1009
|
/**
|
|
1130
|
-
*
|
|
1131
|
-
*
|
|
1132
|
-
* **When to use**
|
|
1133
|
-
*
|
|
1134
|
-
* Use when you need the AST node class for schemas that match any JavaScript
|
|
1135
|
-
* symbol value.
|
|
1010
|
+
* Constructs a {@link Symbol}.
|
|
1136
1011
|
*
|
|
1137
|
-
*
|
|
1138
|
-
*
|
|
1139
|
-
* When serialized to a string-based codec, symbols are converted via
|
|
1140
|
-
* `Symbol.keyFor` and must be registered with `Symbol.for`.
|
|
1141
|
-
*
|
|
1142
|
-
* @see {@link symbol}
|
|
1143
|
-
* @see {@link isSymbol}
|
|
1144
|
-
* @category models
|
|
1012
|
+
* @category constructors
|
|
1145
1013
|
* @since 4.0.0
|
|
1146
1014
|
*/
|
|
1147
|
-
export
|
|
1015
|
+
export const Symbol = class extends ASTNodeImpl {
|
|
1148
1016
|
_tag = "Symbol";
|
|
1149
1017
|
/** @internal */
|
|
1150
1018
|
getParser() {
|
|
@@ -1163,7 +1031,7 @@ export class Symbol extends Base {
|
|
|
1163
1031
|
getExpected() {
|
|
1164
1032
|
return "symbol";
|
|
1165
1033
|
}
|
|
1166
|
-
}
|
|
1034
|
+
};
|
|
1167
1035
|
/**
|
|
1168
1036
|
* Provides the singleton {@link Symbol} AST instance.
|
|
1169
1037
|
*
|
|
@@ -1184,19 +1052,12 @@ export class Symbol extends Base {
|
|
|
1184
1052
|
*/
|
|
1185
1053
|
export const symbol = /*#__PURE__*/new Symbol();
|
|
1186
1054
|
/**
|
|
1187
|
-
*
|
|
1055
|
+
* Constructs a {@link BigInt}.
|
|
1188
1056
|
*
|
|
1189
|
-
*
|
|
1190
|
-
*
|
|
1191
|
-
* When serialized to a string-based codec, bigints are converted to/from
|
|
1192
|
-
* their decimal string representation.
|
|
1193
|
-
*
|
|
1194
|
-
* @see {@link bigInt}
|
|
1195
|
-
* @see {@link isBigInt}
|
|
1196
|
-
* @category models
|
|
1057
|
+
* @category constructors
|
|
1197
1058
|
* @since 4.0.0
|
|
1198
1059
|
*/
|
|
1199
|
-
export
|
|
1060
|
+
export const BigInt = class extends ASTNodeImpl {
|
|
1200
1061
|
_tag = "BigInt";
|
|
1201
1062
|
/** @internal */
|
|
1202
1063
|
getParser() {
|
|
@@ -1217,7 +1078,7 @@ export class BigInt extends Base {
|
|
|
1217
1078
|
getExpected() {
|
|
1218
1079
|
return "bigint";
|
|
1219
1080
|
}
|
|
1220
|
-
}
|
|
1081
|
+
};
|
|
1221
1082
|
/**
|
|
1222
1083
|
* Provides the singleton {@link BigInt} AST instance.
|
|
1223
1084
|
*
|
|
@@ -1234,48 +1095,12 @@ export class BigInt extends Base {
|
|
|
1234
1095
|
*/
|
|
1235
1096
|
export const bigInt = /*#__PURE__*/new BigInt();
|
|
1236
1097
|
/**
|
|
1237
|
-
*
|
|
1238
|
-
*
|
|
1239
|
-
* **When to use**
|
|
1240
|
-
*
|
|
1241
|
-
* Use when constructing or inspecting AST nodes for tuple or array-like schemas,
|
|
1242
|
-
* including rest elements.
|
|
1243
|
-
*
|
|
1244
|
-
* **Details**
|
|
1245
|
-
*
|
|
1246
|
-
* - `elements` — positional element types (tuple elements). An element is
|
|
1247
|
-
* optional if its {@link Context.isOptional} is `true`.
|
|
1248
|
-
* - `rest` — the rest/variadic element types. When non-empty, the first
|
|
1249
|
-
* entry is the "spread" type (e.g. `...Array<string>`), and subsequent
|
|
1250
|
-
* entries are trailing positional elements after the spread.
|
|
1251
|
-
* - `isMutable` — whether the resulting array is `readonly` (`false`) or
|
|
1252
|
-
* mutable (`true`).
|
|
1253
|
-
*
|
|
1254
|
-
* **Gotchas**
|
|
1255
|
-
*
|
|
1256
|
-
* Construction enforces TypeScript ordering rules: a required element
|
|
1257
|
-
* cannot follow an optional one, and an optional element cannot follow a
|
|
1258
|
-
* rest element.
|
|
1098
|
+
* Constructs a {@link Arrays}.
|
|
1259
1099
|
*
|
|
1260
|
-
*
|
|
1261
|
-
*
|
|
1262
|
-
* ```ts import.meta.vitest
|
|
1263
|
-
* import { Schema, SchemaAST } from "effect"
|
|
1264
|
-
*
|
|
1265
|
-
* const schema = Schema.Tuple([Schema.String, Schema.Number])
|
|
1266
|
-
* const ast = schema.ast
|
|
1267
|
-
*
|
|
1268
|
-
* if (SchemaAST.isArrays(ast)) {
|
|
1269
|
-
* [ast.elements.length, ast.rest.length] // => [2, 0]
|
|
1270
|
-
* }
|
|
1271
|
-
* ```
|
|
1272
|
-
*
|
|
1273
|
-
* @see {@link isArrays}
|
|
1274
|
-
* @see {@link Objects}
|
|
1275
|
-
* @category models
|
|
1100
|
+
* @category constructors
|
|
1276
1101
|
* @since 4.0.0
|
|
1277
1102
|
*/
|
|
1278
|
-
export
|
|
1103
|
+
export const Arrays = class extends ASTNodeImpl {
|
|
1279
1104
|
_tag = "Arrays";
|
|
1280
1105
|
isMutable;
|
|
1281
1106
|
elements;
|
|
@@ -1350,10 +1175,11 @@ export class Arrays extends Base {
|
|
|
1350
1175
|
issues: undefined,
|
|
1351
1176
|
options
|
|
1352
1177
|
};
|
|
1353
|
-
const
|
|
1354
|
-
const
|
|
1355
|
-
|
|
1356
|
-
|
|
1178
|
+
const end = ast.rest.length === 0 ? elementLen : Math.max(len, elementLen + tailLen);
|
|
1179
|
+
const concurrency = options.concurrency === undefined ? 1 : resolveConcurrency(options.concurrency);
|
|
1180
|
+
const eff = concurrency === 1 ? parseArray(state, input, 0, end) : parseArrayConcurrent(state, input, {
|
|
1181
|
+
concurrency,
|
|
1182
|
+
end
|
|
1357
1183
|
});
|
|
1358
1184
|
if (eff) yield* eff;
|
|
1359
1185
|
// ---------------------------------------------
|
|
@@ -1393,8 +1219,8 @@ export class Arrays extends Base {
|
|
|
1393
1219
|
getExpected() {
|
|
1394
1220
|
return "array";
|
|
1395
1221
|
}
|
|
1396
|
-
}
|
|
1397
|
-
const
|
|
1222
|
+
};
|
|
1223
|
+
const parseArrayOptions = {
|
|
1398
1224
|
onItem(s, item, i) {
|
|
1399
1225
|
const value = i < s.len ? item : InternalParser.missing;
|
|
1400
1226
|
return s.getParser(s.tailThreshold, i).parser(value, s.options);
|
|
@@ -1417,13 +1243,9 @@ const parseArray = /*#__PURE__*/iterateEager()({
|
|
|
1417
1243
|
}
|
|
1418
1244
|
}
|
|
1419
1245
|
}
|
|
1420
|
-
});
|
|
1421
|
-
const resolveConcurrency = value => {
|
|
1422
|
-
value = value === "unbounded" ? Infinity : value ?? 1;
|
|
1423
|
-
return value > 1 ? {
|
|
1424
|
-
concurrency: value
|
|
1425
|
-
} : undefined;
|
|
1426
1246
|
};
|
|
1247
|
+
const parseArray = /*#__PURE__*/iterateEager()(parseArrayOptions);
|
|
1248
|
+
const parseArrayConcurrent = /*#__PURE__*/iterateConcurrent()(parseArrayOptions);
|
|
1427
1249
|
const wrapPropertyKeyIssue = (s, ast, key, exit) => {
|
|
1428
1250
|
if (exit.cause.reasons.length === 0) {
|
|
1429
1251
|
return exit;
|
|
@@ -1469,26 +1291,19 @@ export function getIndexSignatureKeys(input, parameter, options = defaultParseOp
|
|
|
1469
1291
|
return go(parameterFromPropertyKey(toEncoded(parameter)));
|
|
1470
1292
|
}
|
|
1471
1293
|
/**
|
|
1472
|
-
*
|
|
1294
|
+
* Constructs a {@link PropertySignature}.
|
|
1473
1295
|
*
|
|
1474
|
-
*
|
|
1475
|
-
*
|
|
1476
|
-
* Pairs a `name` (any `PropertyKey`) with a `type` ({@link AST}). The
|
|
1477
|
-
* property's optionality and mutability are determined by the `type`'s
|
|
1478
|
-
* {@link Context}.
|
|
1479
|
-
*
|
|
1480
|
-
* @see {@link Objects}
|
|
1481
|
-
* @category models
|
|
1482
|
-
* @since 3.10.0
|
|
1296
|
+
* @category constructors
|
|
1297
|
+
* @since 4.0.0
|
|
1483
1298
|
*/
|
|
1484
|
-
export
|
|
1299
|
+
export const PropertySignature = class {
|
|
1485
1300
|
name;
|
|
1486
1301
|
type;
|
|
1487
1302
|
constructor(name, type) {
|
|
1488
1303
|
this.name = name;
|
|
1489
1304
|
this.type = type;
|
|
1490
1305
|
}
|
|
1491
|
-
}
|
|
1306
|
+
};
|
|
1492
1307
|
function isIndexSignatureParameterSide(ast) {
|
|
1493
1308
|
switch (ast._tag) {
|
|
1494
1309
|
case "String":
|
|
@@ -1506,30 +1321,12 @@ function isIndexSignatureParameter(ast) {
|
|
|
1506
1321
|
return isIndexSignatureParameterSide(ast) && isIndexSignatureParameterSide(toEncoded(ast));
|
|
1507
1322
|
}
|
|
1508
1323
|
/**
|
|
1509
|
-
*
|
|
1510
|
-
*
|
|
1511
|
-
* **When to use**
|
|
1512
|
-
*
|
|
1513
|
-
* Use when constructing or inspecting object AST entries for record-like keys
|
|
1514
|
-
* and values.
|
|
1324
|
+
* Constructs a {@link IndexSignature}.
|
|
1515
1325
|
*
|
|
1516
|
-
*
|
|
1517
|
-
*
|
|
1518
|
-
* - `parameter` — the key type AST (e.g. {@link String} for `string` keys,
|
|
1519
|
-
* {@link TemplateLiteral} for patterned keys).
|
|
1520
|
-
* - `type` — the value type SchemaAST.
|
|
1521
|
-
*
|
|
1522
|
-
* **Gotchas**
|
|
1523
|
-
*
|
|
1524
|
-
* Using `Schema.optionalKey` on the value type is not allowed for index
|
|
1525
|
-
* signatures (throws at construction); use `Schema.optional` instead.
|
|
1526
|
-
*
|
|
1527
|
-
* @see {@link Objects}
|
|
1528
|
-
* @see {@link PropertySignature}
|
|
1529
|
-
* @category models
|
|
1530
|
-
* @since 3.10.0
|
|
1326
|
+
* @category constructors
|
|
1327
|
+
* @since 4.0.0
|
|
1531
1328
|
*/
|
|
1532
|
-
export
|
|
1329
|
+
export const IndexSignature = class {
|
|
1533
1330
|
parameter;
|
|
1534
1331
|
type;
|
|
1535
1332
|
constructor(parameter, type) {
|
|
@@ -1542,50 +1339,14 @@ export class IndexSignature {
|
|
|
1542
1339
|
throw new Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.");
|
|
1543
1340
|
}
|
|
1544
1341
|
}
|
|
1545
|
-
}
|
|
1342
|
+
};
|
|
1546
1343
|
/**
|
|
1547
|
-
*
|
|
1548
|
-
*
|
|
1549
|
-
* **When to use**
|
|
1550
|
-
*
|
|
1551
|
-
* Use when constructing or inspecting AST nodes for structs or records rather
|
|
1552
|
-
* than array-like schemas.
|
|
1553
|
-
*
|
|
1554
|
-
* **Details**
|
|
1555
|
-
*
|
|
1556
|
-
* - `propertySignatures` — named properties with their types (struct fields).
|
|
1557
|
-
* - `indexSignatures` — index signature entries (record patterns), each with
|
|
1558
|
-
* a `parameter` AST for matching keys and a `type` AST for values.
|
|
1559
|
-
*
|
|
1560
|
-
* An `Objects` node with no properties and no index signatures performs only a
|
|
1561
|
-
* non-nullish check: it accepts any value except `null` and `undefined`,
|
|
1562
|
-
* including primitive values.
|
|
1563
|
-
*
|
|
1564
|
-
* **Gotchas**
|
|
1565
|
-
*
|
|
1566
|
-
* Duplicate property names throw at construction time.
|
|
1567
|
-
*
|
|
1568
|
-
* **Example** (Inspecting a struct AST)
|
|
1344
|
+
* Constructs a {@link Objects}.
|
|
1569
1345
|
*
|
|
1570
|
-
*
|
|
1571
|
-
* import { Schema, SchemaAST } from "effect"
|
|
1572
|
-
*
|
|
1573
|
-
* const schema = Schema.Struct({ name: Schema.String })
|
|
1574
|
-
* const ast = schema.ast
|
|
1575
|
-
*
|
|
1576
|
-
* if (SchemaAST.isObjects(ast)) {
|
|
1577
|
-
* ast.propertySignatures.map((ps) => [ps.name, ps.type._tag]) // => [["name", "String"]]
|
|
1578
|
-
* }
|
|
1579
|
-
* ```
|
|
1580
|
-
*
|
|
1581
|
-
* @see {@link isObjects}
|
|
1582
|
-
* @see {@link PropertySignature}
|
|
1583
|
-
* @see {@link IndexSignature}
|
|
1584
|
-
* @see {@link Arrays}
|
|
1585
|
-
* @category models
|
|
1346
|
+
* @category constructors
|
|
1586
1347
|
* @since 4.0.0
|
|
1587
1348
|
*/
|
|
1588
|
-
export
|
|
1349
|
+
export const Objects = class extends ASTNodeImpl {
|
|
1589
1350
|
_tag = "Objects";
|
|
1590
1351
|
propertySignatures;
|
|
1591
1352
|
indexSignatures;
|
|
@@ -1607,7 +1368,7 @@ export class Objects extends Base {
|
|
|
1607
1368
|
const ast = this;
|
|
1608
1369
|
const expectedKeys = [];
|
|
1609
1370
|
for (const ps of ast.propertySignatures) {
|
|
1610
|
-
expectedKeys.push(ps.name);
|
|
1371
|
+
expectedKeys.push(typeof ps.name === "number" ? globalThis.String(ps.name) : ps.name);
|
|
1611
1372
|
}
|
|
1612
1373
|
const hasProperties = expectedKeys.length;
|
|
1613
1374
|
const indexCount = ast.indexSignatures.length;
|
|
@@ -1626,7 +1387,7 @@ export class Objects extends Base {
|
|
|
1626
1387
|
}
|
|
1627
1388
|
const value = exitValue === InternalParser.sameExit ? inputValue : exitValue[InternalParser.args];
|
|
1628
1389
|
if (k2 !== InternalParser.missing && value !== InternalParser.missing) {
|
|
1629
|
-
if (hasProperties && (expectedKeysSet.has(key) || expectedKeysSet.has(k2))) return Exit.void;
|
|
1390
|
+
if (hasProperties && (expectedKeysSet.has(key) || expectedKeysSet.has(typeof k2 === "number" ? globalThis.String(k2) : k2))) return Exit.void;
|
|
1630
1391
|
InternalRecord.assignProperty(s.out, k2, value);
|
|
1631
1392
|
}
|
|
1632
1393
|
return Exit.void;
|
|
@@ -1652,18 +1413,11 @@ export class Objects extends Base {
|
|
|
1652
1413
|
const result = index.parserValue(inputValue, s.options);
|
|
1653
1414
|
return effectIsExit(result) ? finishIndex(s, key, key, inputValue, result) : Effect.flatMap(Effect.exit(result), exit => finishIndex(s, key, key, inputValue, exit));
|
|
1654
1415
|
};
|
|
1655
|
-
const parseIndexes = indexCount ?
|
|
1656
|
-
onItem: (s, [key, index]) => parseIndex(s, key, index),
|
|
1657
|
-
step: (_s,
|
|
1416
|
+
const parseIndexes = indexCount ? iterateConcurrent()({
|
|
1417
|
+
onItem: (s, [key, index]) => index.is.parameter === string ? parseStringIndex(s, key, index) : parseIndex(s, key, index),
|
|
1418
|
+
step: (_s, _item, exit) => exit._tag === "Failure" ? exit : undefined
|
|
1658
1419
|
}) : undefined;
|
|
1659
|
-
|
|
1660
|
-
if (input === InternalParser.missing) {
|
|
1661
|
-
return InternalParser.missing;
|
|
1662
|
-
}
|
|
1663
|
-
// If the input is not a record, return early with an error
|
|
1664
|
-
if (!(typeof input === "object" && input !== null && !Array.isArray(input))) {
|
|
1665
|
-
return yield* Effect.fail(new SchemaIssue.InvalidType(ast, input, options));
|
|
1666
|
-
}
|
|
1420
|
+
const compileMembers = () => {
|
|
1667
1421
|
if (!properties) {
|
|
1668
1422
|
properties = ast.propertySignatures.map(ps => ({
|
|
1669
1423
|
parser: compileConstructorDefault(ps.type),
|
|
@@ -1676,6 +1430,17 @@ export class Objects extends Base {
|
|
|
1676
1430
|
parserValue: compileConstructorDefault(is.type)
|
|
1677
1431
|
})) : undefined;
|
|
1678
1432
|
}
|
|
1433
|
+
return properties;
|
|
1434
|
+
};
|
|
1435
|
+
const fallback = Effect.fnUntracedEager(function* (input, options) {
|
|
1436
|
+
if (input === InternalParser.missing) {
|
|
1437
|
+
return InternalParser.missing;
|
|
1438
|
+
}
|
|
1439
|
+
// If the input is not a record, return early with an error
|
|
1440
|
+
if (!(typeof input === "object" && input !== null && !Array.isArray(input))) {
|
|
1441
|
+
return yield* Effect.fail(new SchemaIssue.InvalidType(ast, input, options));
|
|
1442
|
+
}
|
|
1443
|
+
compileMembers();
|
|
1679
1444
|
const record = input;
|
|
1680
1445
|
const out = {};
|
|
1681
1446
|
const state = {
|
|
@@ -1687,54 +1452,56 @@ export class Objects extends Base {
|
|
|
1687
1452
|
};
|
|
1688
1453
|
const errorsAllOption = options.errors === "all";
|
|
1689
1454
|
const onExcessPropertyError = options.onExcessProperty === "error";
|
|
1690
|
-
const
|
|
1455
|
+
const concurrency = options.concurrency === undefined ? 1 : resolveConcurrency(options.concurrency);
|
|
1691
1456
|
// ---------------------------------------------
|
|
1692
1457
|
// handle excess properties
|
|
1693
1458
|
// ---------------------------------------------
|
|
1694
|
-
|
|
1695
|
-
if (
|
|
1459
|
+
const indexKeys = indexCount && onExcessPropertyError ? ast.indexSignatures.map(index => getIndexSignatureKeys(record, index.parameter, options)) : undefined;
|
|
1460
|
+
if (onExcessPropertyError) {
|
|
1696
1461
|
expectedKeysSet ??= new Set(expectedKeys);
|
|
1697
|
-
|
|
1462
|
+
const coveredKeys = indexKeys ? new Set(expectedKeysSet) : expectedKeysSet;
|
|
1463
|
+
if (indexKeys) {
|
|
1464
|
+
for (const keys of indexKeys) {
|
|
1465
|
+
for (const key of keys) coveredKeys.add(key);
|
|
1466
|
+
}
|
|
1467
|
+
}
|
|
1468
|
+
const inputKeys = Reflect.ownKeys(record);
|
|
1698
1469
|
for (let i = 0; i < inputKeys.length; i++) {
|
|
1699
1470
|
const key = inputKeys[i];
|
|
1700
|
-
if (!
|
|
1471
|
+
if (!coveredKeys.has(key)) {
|
|
1701
1472
|
// key is unexpected
|
|
1702
|
-
|
|
1703
|
-
|
|
1704
|
-
|
|
1705
|
-
if (
|
|
1706
|
-
|
|
1707
|
-
state.issues.push(issue);
|
|
1708
|
-
} else {
|
|
1709
|
-
state.issues = [issue];
|
|
1710
|
-
}
|
|
1711
|
-
continue;
|
|
1473
|
+
const unexpected = new SchemaIssue.UnexpectedKey(ast, record[key], options);
|
|
1474
|
+
const issue = new SchemaIssue.Pointer([key], unexpected);
|
|
1475
|
+
if (errorsAllOption) {
|
|
1476
|
+
if (state.issues) {
|
|
1477
|
+
state.issues.push(issue);
|
|
1712
1478
|
} else {
|
|
1713
|
-
|
|
1479
|
+
state.issues = [issue];
|
|
1714
1480
|
}
|
|
1481
|
+
continue;
|
|
1715
1482
|
} else {
|
|
1716
|
-
|
|
1717
|
-
InternalRecord.assignProperty(out, key, record[key]);
|
|
1483
|
+
return yield* Effect.fail(new SchemaIssue.Composite(ast, [issue], input, options));
|
|
1718
1484
|
}
|
|
1719
1485
|
}
|
|
1720
1486
|
}
|
|
1721
1487
|
}
|
|
1722
|
-
const concurrency = resolveConcurrency(options?.concurrency);
|
|
1723
1488
|
// ---------------------------------------------
|
|
1724
1489
|
// handle property signatures
|
|
1725
1490
|
// ---------------------------------------------
|
|
1726
1491
|
if (hasProperties) {
|
|
1727
|
-
const eff = parseProperties(state, properties,
|
|
1492
|
+
const eff = concurrency === 1 ? parseProperties(state, properties) : parsePropertiesConcurrent(state, properties, {
|
|
1493
|
+
concurrency
|
|
1494
|
+
});
|
|
1728
1495
|
if (eff) yield* eff;
|
|
1729
1496
|
}
|
|
1730
1497
|
// ---------------------------------------------
|
|
1731
1498
|
// handle index signatures
|
|
1732
1499
|
// ---------------------------------------------
|
|
1733
|
-
if (indexCount &&
|
|
1500
|
+
if (indexCount && concurrency === 1) {
|
|
1734
1501
|
for (let i = 0; i < indexCount; i++) {
|
|
1735
1502
|
const index = indexes[i];
|
|
1736
1503
|
const parse = index.is.parameter === string ? parseStringIndex : parseIndex;
|
|
1737
|
-
const keys = index.is.parameter === string ? Object.keys(record) : getIndexSignatureKeys(record, index.is.parameter, options);
|
|
1504
|
+
const keys = indexKeys?.[i] ?? (index.is.parameter === string ? Object.keys(record) : getIndexSignatureKeys(record, index.is.parameter, options));
|
|
1738
1505
|
for (let j = 0; j < keys.length; j++) {
|
|
1739
1506
|
const eff = parse(state, keys[j], index);
|
|
1740
1507
|
if (!effectIsExit(eff)) yield* eff;else if (eff._tag === "Failure") return yield* eff;
|
|
@@ -1744,30 +1511,77 @@ export class Objects extends Base {
|
|
|
1744
1511
|
const keyPairs = Arr.empty();
|
|
1745
1512
|
for (let i = 0; i < indexCount; i++) {
|
|
1746
1513
|
const index = indexes[i];
|
|
1747
|
-
const keys = getIndexSignatureKeys(record, index.is.parameter, options);
|
|
1514
|
+
const keys = indexKeys?.[i] ?? (index.is.parameter === string ? Object.keys(record) : getIndexSignatureKeys(record, index.is.parameter, options));
|
|
1748
1515
|
for (let j = 0; j < keys.length; j++) {
|
|
1749
1516
|
keyPairs.push([keys[j], index]);
|
|
1750
1517
|
}
|
|
1751
1518
|
}
|
|
1752
|
-
const eff = parseIndexes(state, keyPairs,
|
|
1519
|
+
const eff = parseIndexes(state, keyPairs, {
|
|
1520
|
+
concurrency
|
|
1521
|
+
});
|
|
1753
1522
|
if (eff) yield* eff;
|
|
1754
1523
|
}
|
|
1755
1524
|
if (state.issues) {
|
|
1756
1525
|
return yield* Effect.fail(new SchemaIssue.Composite(ast, state.issues, input, options));
|
|
1757
1526
|
}
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1527
|
+
return out;
|
|
1528
|
+
});
|
|
1529
|
+
if (indexCount) return fallback;
|
|
1530
|
+
// Resumes at the property whose parser suspended, without replaying the
|
|
1531
|
+
// properties already parsed.
|
|
1532
|
+
const resume = (state, index, pending) => {
|
|
1533
|
+
const property = properties[index];
|
|
1534
|
+
return Effect.flatMap(Effect.exit(pending), exit => {
|
|
1535
|
+
const terminal = stepProperty(state, property, exit);
|
|
1536
|
+
if (terminal) return terminal;
|
|
1537
|
+
const done = () => InternalParser.succeed(state.out);
|
|
1538
|
+
const eff = parseProperties(state, properties.slice(index + 1));
|
|
1539
|
+
return eff ? Effect.flatMapEager(eff, done) : done();
|
|
1540
|
+
});
|
|
1541
|
+
};
|
|
1542
|
+
// Fast path: a struct without index signatures, under the default parse
|
|
1543
|
+
// options, needs none of the generator the fallback runs per value.
|
|
1544
|
+
return (input, options) => {
|
|
1545
|
+
if (input === InternalParser.missing) return InternalParser.missingExit;
|
|
1546
|
+
if (options.errors === "all" || options.onExcessProperty !== undefined || options.concurrency !== undefined && resolveConcurrency(options.concurrency) !== 1) {
|
|
1547
|
+
return fallback(input, options);
|
|
1548
|
+
}
|
|
1549
|
+
if (!(typeof input === "object" && input !== null && !Array.isArray(input))) {
|
|
1550
|
+
return Effect.fail(new SchemaIssue.InvalidType(ast, input, options));
|
|
1551
|
+
}
|
|
1552
|
+
const props = compileMembers();
|
|
1553
|
+
const record = input;
|
|
1554
|
+
const out = {};
|
|
1555
|
+
const state = {
|
|
1556
|
+
ast,
|
|
1557
|
+
input: record,
|
|
1558
|
+
out,
|
|
1559
|
+
issues: undefined,
|
|
1560
|
+
options
|
|
1561
|
+
};
|
|
1562
|
+
try {
|
|
1563
|
+
for (let index = 0; index < props.length; index++) {
|
|
1564
|
+
const property = props[index];
|
|
1565
|
+
const name = property.name;
|
|
1566
|
+
const hasKey = hasPropertySignature(record, name);
|
|
1567
|
+
const value = hasKey ? record[name] : InternalParser.missing;
|
|
1568
|
+
const exit = property.parser(value, options);
|
|
1569
|
+
if (!effectIsExit(exit)) {
|
|
1570
|
+
return resume(state, index, exit);
|
|
1571
|
+
}
|
|
1572
|
+
if (exit === InternalParser.sameExit) {
|
|
1573
|
+
if (hasKey) InternalRecord.assignProperty(out, name, value);
|
|
1574
|
+
continue;
|
|
1765
1575
|
}
|
|
1576
|
+
const terminal = stepProperty(state, property, exit);
|
|
1577
|
+
if (terminal) return terminal;
|
|
1766
1578
|
}
|
|
1767
|
-
|
|
1579
|
+
} catch (error) {
|
|
1580
|
+
// `Effect.fnUntracedEager` turns a synchronous throw into a defect
|
|
1581
|
+
return Effect.die(error);
|
|
1768
1582
|
}
|
|
1769
|
-
return out;
|
|
1770
|
-
}
|
|
1583
|
+
return InternalParser.succeed(out);
|
|
1584
|
+
};
|
|
1771
1585
|
}
|
|
1772
1586
|
_rebuild(recur, recurParameter, checks, encodingChecks) {
|
|
1773
1587
|
const props = mapOrSame(this.propertySignatures, ps => {
|
|
@@ -1794,38 +1608,41 @@ export class Objects extends Base {
|
|
|
1794
1608
|
if (this.propertySignatures.length === 0 && this.indexSignatures.length === 0) return "object | array";
|
|
1795
1609
|
return "object";
|
|
1796
1610
|
}
|
|
1611
|
+
};
|
|
1612
|
+
function stepProperty(s, p, exit) {
|
|
1613
|
+
if (exit._tag === "Failure") {
|
|
1614
|
+
return wrapPropertyKeyIssue(s, s.ast, p.name, exit);
|
|
1615
|
+
}
|
|
1616
|
+
if (exit === InternalParser.sameExit) return;
|
|
1617
|
+
const value = exit[InternalParser.args];
|
|
1618
|
+
if (value !== InternalParser.missing) {
|
|
1619
|
+
InternalRecord.assignProperty(s.out, p.name, value);
|
|
1620
|
+
return;
|
|
1621
|
+
}
|
|
1622
|
+
delete s.out[p.name];
|
|
1623
|
+
if (!isOptional(p.type)) {
|
|
1624
|
+
const issue = new SchemaIssue.Pointer([p.name], new SchemaIssue.MissingKey(p.type.context?.annotations));
|
|
1625
|
+
if (s.options.errors === "all") {
|
|
1626
|
+
if (s.issues) s.issues.push(issue);else s.issues = [issue];
|
|
1627
|
+
return;
|
|
1628
|
+
} else {
|
|
1629
|
+
return Exit.fail(new SchemaIssue.Composite(s.ast, [issue], s.input, s.options));
|
|
1630
|
+
}
|
|
1631
|
+
}
|
|
1797
1632
|
}
|
|
1798
|
-
const
|
|
1633
|
+
const parsePropertiesOptions = {
|
|
1799
1634
|
onItem(s, p) {
|
|
1800
|
-
if (!
|
|
1635
|
+
if (!hasPropertySignature(s.input, p.name)) {
|
|
1801
1636
|
return p.parser(InternalParser.missing, s.options);
|
|
1802
1637
|
}
|
|
1803
1638
|
const value = s.input[p.name];
|
|
1804
1639
|
InternalRecord.assignProperty(s.out, p.name, value);
|
|
1805
1640
|
return p.parser(value, s.options);
|
|
1806
1641
|
},
|
|
1807
|
-
step
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
if (exit === InternalParser.sameExit) return;
|
|
1812
|
-
const value = exit[InternalParser.args];
|
|
1813
|
-
if (value !== InternalParser.missing) {
|
|
1814
|
-
InternalRecord.assignProperty(s.out, p.name, value);
|
|
1815
|
-
return;
|
|
1816
|
-
}
|
|
1817
|
-
delete s.out[p.name];
|
|
1818
|
-
if (!isOptional(p.type)) {
|
|
1819
|
-
const issue = new SchemaIssue.Pointer([p.name], new SchemaIssue.MissingKey(p.type.context?.annotations));
|
|
1820
|
-
if (s.options.errors === "all") {
|
|
1821
|
-
if (s.issues) s.issues.push(issue);else s.issues = [issue];
|
|
1822
|
-
return;
|
|
1823
|
-
} else {
|
|
1824
|
-
return Exit.fail(new SchemaIssue.Composite(s.ast, [issue], s.input, s.options));
|
|
1825
|
-
}
|
|
1826
|
-
}
|
|
1827
|
-
}
|
|
1828
|
-
});
|
|
1642
|
+
step: stepProperty
|
|
1643
|
+
};
|
|
1644
|
+
const parseProperties = /*#__PURE__*/iterateEager()(parsePropertiesOptions);
|
|
1645
|
+
const parsePropertiesConcurrent = /*#__PURE__*/iterateConcurrent()(parsePropertiesOptions);
|
|
1829
1646
|
function combineChecks(a, b) {
|
|
1830
1647
|
if (!a) return b;
|
|
1831
1648
|
if (!b) return a;
|
|
@@ -1846,8 +1663,8 @@ export function tuple(elements, checks = undefined) {
|
|
|
1846
1663
|
return new Arrays(false, elements.map(e => e.ast), [], undefined, checks);
|
|
1847
1664
|
}
|
|
1848
1665
|
/** @internal */
|
|
1849
|
-
export function union(members,
|
|
1850
|
-
return new Union(members.map(getAST),
|
|
1666
|
+
export function union(members, options, checks) {
|
|
1667
|
+
return new Union(members.map(getAST), options, undefined, checks);
|
|
1851
1668
|
}
|
|
1852
1669
|
/** @internal */
|
|
1853
1670
|
export function structWithRest(ast, records) {
|
|
@@ -1871,6 +1688,13 @@ export function tupleWithRest(ast, rest) {
|
|
|
1871
1688
|
}
|
|
1872
1689
|
return new Arrays(ast.isMutable, ast.elements, rest, undefined, ast.checks);
|
|
1873
1690
|
}
|
|
1691
|
+
/** @internal */
|
|
1692
|
+
export function mutable(ast) {
|
|
1693
|
+
if (ast.encoding) {
|
|
1694
|
+
throw new Error("mutable does not support encodings");
|
|
1695
|
+
}
|
|
1696
|
+
return new Arrays(true, ast.elements, ast.rest, ast.annotations, ast.checks, undefined, ast.context, ast.encodingChecks);
|
|
1697
|
+
}
|
|
1874
1698
|
const toCandidate = /*#__PURE__*/memoizeIdempotent(ast => {
|
|
1875
1699
|
while (true) {
|
|
1876
1700
|
if (isSuspend(ast)) return unknown;
|
|
@@ -1976,6 +1800,7 @@ export function collectSentinels(ast) {
|
|
|
1976
1800
|
}
|
|
1977
1801
|
const candidateIndexCache = /*#__PURE__*/new WeakMap();
|
|
1978
1802
|
const emptyCandidates = /*#__PURE__*/Object.freeze([]);
|
|
1803
|
+
const hasPropertySignature = (input, key) => key === "__proto__" ? Object.hasOwn(input, key) : key in input;
|
|
1979
1804
|
function getIndex(types) {
|
|
1980
1805
|
let index = candidateIndexCache.get(types);
|
|
1981
1806
|
if (index) return index;
|
|
@@ -2033,7 +1858,7 @@ function getIndex(types) {
|
|
|
2033
1858
|
}
|
|
2034
1859
|
index = (input, isConstructor) => {
|
|
2035
1860
|
if (Predicate.isObjectKeyword(input)) {
|
|
2036
|
-
const value =
|
|
1861
|
+
const value = hasPropertySignature(input, key) ? input[key] : undefined;
|
|
2037
1862
|
if (value !== undefined) return candidates.get(value) ?? emptyCandidates;
|
|
2038
1863
|
if (isConstructor) return types;
|
|
2039
1864
|
}
|
|
@@ -2060,7 +1885,7 @@ function getIndex(types) {
|
|
|
2060
1885
|
// discriminated candidate.
|
|
2061
1886
|
if (commonSentinel) {
|
|
2062
1887
|
const [key, [byValue]] = commonSentinel;
|
|
2063
|
-
const hasKey =
|
|
1888
|
+
const hasKey = hasPropertySignature(input, key);
|
|
2064
1889
|
const value = hasKey ? input[key] : undefined;
|
|
2065
1890
|
if (hasKey && (!isConstructor || value !== undefined)) {
|
|
2066
1891
|
const match = byValue.get(value);
|
|
@@ -2073,7 +1898,7 @@ function getIndex(types) {
|
|
|
2073
1898
|
// absent and undefined keys as unconstrained and therefore selects every candidate that owns the key.
|
|
2074
1899
|
if (directKey === undefined) {
|
|
2075
1900
|
for (const [key, [byValue, all]] of bySentinel) {
|
|
2076
|
-
const hasKey =
|
|
1901
|
+
const hasKey = hasPropertySignature(input, key);
|
|
2077
1902
|
const value = hasKey ? input[key] : undefined;
|
|
2078
1903
|
if (hasKey && (!isConstructor || value !== undefined)) {
|
|
2079
1904
|
const match = byValue.get(value);
|
|
@@ -2088,7 +1913,7 @@ function getIndex(types) {
|
|
|
2088
1913
|
// Missing keys are neutral. An observed key rejects only selected candidates that own it and do not match.
|
|
2089
1914
|
for (const [key, [byValue, all]] of bySentinel) {
|
|
2090
1915
|
if (key === directKey) continue;
|
|
2091
|
-
const hasKey =
|
|
1916
|
+
const hasKey = hasPropertySignature(input, key);
|
|
2092
1917
|
const value = hasKey ? input[key] : undefined;
|
|
2093
1918
|
if (hasKey && (!isConstructor || value !== undefined)) {
|
|
2094
1919
|
const match = byValue.get(value);
|
|
@@ -2124,44 +1949,20 @@ export function getCandidates(input, types, isConstructor = false) {
|
|
|
2124
1949
|
return getIndex(types)(input, isConstructor);
|
|
2125
1950
|
}
|
|
2126
1951
|
/**
|
|
2127
|
-
*
|
|
2128
|
-
*
|
|
2129
|
-
* **Details**
|
|
2130
|
-
*
|
|
2131
|
-
* - `types` — the member AST nodes.
|
|
2132
|
-
* - `mode` — `"anyOf"` succeeds on the first match (like TypeScript unions);
|
|
2133
|
-
* `"oneOf"` requires exactly one member to match (fails if multiple do).
|
|
2134
|
-
*
|
|
2135
|
-
* During parsing, members are tried in order. An internal candidate index
|
|
2136
|
-
* narrows which members to try based on the runtime type of the input and
|
|
2137
|
-
* discriminant ("sentinel") fields, making large unions efficient.
|
|
2138
|
-
*
|
|
2139
|
-
* **Example** (Inspecting a union AST)
|
|
2140
|
-
*
|
|
2141
|
-
* ```ts import.meta.vitest
|
|
2142
|
-
* import { Schema, SchemaAST } from "effect"
|
|
2143
|
-
*
|
|
2144
|
-
* const schema = Schema.Union([Schema.String, Schema.Number])
|
|
2145
|
-
* const ast = schema.ast
|
|
1952
|
+
* Constructs a {@link Union}.
|
|
2146
1953
|
*
|
|
2147
|
-
*
|
|
2148
|
-
*
|
|
2149
|
-
* }
|
|
2150
|
-
* ```
|
|
2151
|
-
*
|
|
2152
|
-
* @see {@link isUnion}
|
|
2153
|
-
* @category models
|
|
2154
|
-
* @since 3.10.0
|
|
1954
|
+
* @category constructors
|
|
1955
|
+
* @since 4.0.0
|
|
2155
1956
|
*/
|
|
2156
|
-
export
|
|
1957
|
+
export const Union = class extends ASTNodeImpl {
|
|
2157
1958
|
_tag = "Union";
|
|
2158
1959
|
types;
|
|
2159
|
-
|
|
1960
|
+
options;
|
|
2160
1961
|
encodingChecks;
|
|
2161
|
-
constructor(types,
|
|
1962
|
+
constructor(types, options, annotations, checks, encoding, context, encodingChecks) {
|
|
2162
1963
|
super(annotations, checks, encoding, context);
|
|
2163
1964
|
this.types = types;
|
|
2164
|
-
this.
|
|
1965
|
+
this.options = options;
|
|
2165
1966
|
this.encodingChecks = encodingChecks;
|
|
2166
1967
|
}
|
|
2167
1968
|
/** @internal */
|
|
@@ -2173,6 +1974,9 @@ export class Union extends Base {
|
|
|
2173
1974
|
return InternalParser.missingExit;
|
|
2174
1975
|
}
|
|
2175
1976
|
const candidates = getCandidates(input, ast.types, compileConstructorDefault !== undefined);
|
|
1977
|
+
if (candidates.length === 0) {
|
|
1978
|
+
return Effect.fail(new SchemaIssue.AnyOf(ast, [], input, options));
|
|
1979
|
+
}
|
|
2176
1980
|
if (candidates.length === 1) {
|
|
2177
1981
|
const result = compile(candidates[0])(input, options);
|
|
2178
1982
|
if (result._tag === "Success") return result;
|
|
@@ -2183,15 +1987,11 @@ export class Union extends Base {
|
|
|
2183
1987
|
compile,
|
|
2184
1988
|
input,
|
|
2185
1989
|
out: undefined,
|
|
2186
|
-
successes: ast.mode === "oneOf" ? [] : undefined,
|
|
1990
|
+
successes: ast.options?.mode === "oneOf" ? [] : undefined,
|
|
2187
1991
|
issues: undefined,
|
|
2188
1992
|
options
|
|
2189
1993
|
};
|
|
2190
|
-
const
|
|
2191
|
-
const eff = parseUnion(state, candidates, concurrency ? {
|
|
2192
|
-
...concurrency,
|
|
2193
|
-
orderedStep: true
|
|
2194
|
-
} : undefined);
|
|
1994
|
+
const eff = parseUnion(state, candidates);
|
|
2195
1995
|
if (!eff) {
|
|
2196
1996
|
if (state.out) return state.out;
|
|
2197
1997
|
return Effect.fail(new SchemaIssue.AnyOf(ast, state.issues ?? [], input, options));
|
|
@@ -2205,7 +2005,7 @@ export class Union extends Base {
|
|
|
2205
2005
|
}
|
|
2206
2006
|
_rebuild(recur, checks, encodingChecks) {
|
|
2207
2007
|
const types = mapOrSame(this.types, recur);
|
|
2208
|
-
return types === this.types && checks === this.checks && encodingChecks === this.encodingChecks ? this : new Union(types, this.
|
|
2008
|
+
return types === this.types && checks === this.checks && encodingChecks === this.encodingChecks ? this : new Union(types, this.options, this.annotations, checks, undefined, this.context, encodingChecks);
|
|
2209
2009
|
}
|
|
2210
2010
|
/** @internal */
|
|
2211
2011
|
recur(recur) {
|
|
@@ -2252,7 +2052,7 @@ export class Union extends Base {
|
|
|
2252
2052
|
});
|
|
2253
2053
|
return Array.from(new Set(types)).join(" | ");
|
|
2254
2054
|
}
|
|
2255
|
-
}
|
|
2055
|
+
};
|
|
2256
2056
|
function failSingleUnionCandidate(ast, cause, input, options) {
|
|
2257
2057
|
const issue = InternalSchemaCause.getSchemaIssue(cause);
|
|
2258
2058
|
if (!issue) return Exit.failCause(cause);
|
|
@@ -2284,7 +2084,7 @@ const parseUnion = /*#__PURE__*/iterateEager()({
|
|
|
2284
2084
|
}
|
|
2285
2085
|
}
|
|
2286
2086
|
});
|
|
2287
|
-
const nonFiniteLiterals = /*#__PURE__*/new Union([/*#__PURE__*/new Literal("Infinity"), /*#__PURE__*/new Literal("-Infinity"), /*#__PURE__*/new Literal("NaN")]
|
|
2087
|
+
const nonFiniteLiterals = /*#__PURE__*/new Union([/*#__PURE__*/new Literal("Infinity"), /*#__PURE__*/new Literal("-Infinity"), /*#__PURE__*/new Literal("NaN")]);
|
|
2288
2088
|
function formatIsMutable(isMutable) {
|
|
2289
2089
|
return isMutable ? "" : "readonly ";
|
|
2290
2090
|
}
|
|
@@ -2305,37 +2105,12 @@ export function memoizeThunk(f) {
|
|
|
2305
2105
|
};
|
|
2306
2106
|
}
|
|
2307
2107
|
/**
|
|
2308
|
-
*
|
|
2309
|
-
*
|
|
2310
|
-
* **Details**
|
|
2311
|
-
*
|
|
2312
|
-
* Wraps a thunk (`() => AST`) that is memoized on first call. Use this to
|
|
2313
|
-
* define recursive or mutually recursive schemas without infinite loops at
|
|
2314
|
-
* construction time.
|
|
2108
|
+
* Constructs a {@link Suspend}.
|
|
2315
2109
|
*
|
|
2316
|
-
*
|
|
2317
|
-
*
|
|
2318
|
-
* ```ts import.meta.vitest
|
|
2319
|
-
* import { Schema, SchemaAST } from "effect"
|
|
2320
|
-
*
|
|
2321
|
-
* interface Category {
|
|
2322
|
-
* readonly name: string
|
|
2323
|
-
* readonly children: ReadonlyArray<Category>
|
|
2324
|
-
* }
|
|
2325
|
-
*
|
|
2326
|
-
* const Category = Schema.Struct({
|
|
2327
|
-
* name: Schema.String,
|
|
2328
|
-
* children: Schema.Array(Schema.suspend((): Schema.Codec<Category> => Category))
|
|
2329
|
-
* })
|
|
2330
|
-
*
|
|
2331
|
-
* SchemaAST.isObjects(Category.ast) // => true
|
|
2332
|
-
* ```
|
|
2333
|
-
*
|
|
2334
|
-
* @see {@link isSuspend}
|
|
2335
|
-
* @category models
|
|
2336
|
-
* @since 3.10.0
|
|
2110
|
+
* @category constructors
|
|
2111
|
+
* @since 4.0.0
|
|
2337
2112
|
*/
|
|
2338
|
-
export
|
|
2113
|
+
export const Suspend = class extends ASTNodeImpl {
|
|
2339
2114
|
_tag = "Suspend";
|
|
2340
2115
|
thunk;
|
|
2341
2116
|
constructor(thunk, annotations, checks, encoding, context) {
|
|
@@ -2358,32 +2133,14 @@ export class Suspend extends Base {
|
|
|
2358
2133
|
getExpected(getExpected) {
|
|
2359
2134
|
return getExpected(this.thunk());
|
|
2360
2135
|
}
|
|
2361
|
-
}
|
|
2362
|
-
// -----------------------------------------------------------------------------
|
|
2363
|
-
// Checks
|
|
2364
|
-
// -----------------------------------------------------------------------------
|
|
2136
|
+
};
|
|
2365
2137
|
/**
|
|
2366
|
-
*
|
|
2367
|
-
*
|
|
2368
|
-
* **Details**
|
|
2369
|
-
*
|
|
2370
|
-
* - `run` — the validation function. Returns `undefined` on success, or an
|
|
2371
|
-
* `Issue` on failure.
|
|
2372
|
-
* - `annotations` — optional filter-level annotations (expected message,
|
|
2373
|
-
* representation, arbitrary constraint hints).
|
|
2374
|
-
* - `aborted` — when `true`, parsing stops immediately after this filter
|
|
2375
|
-
* fails (no further checks run).
|
|
2376
|
-
*
|
|
2377
|
-
* Use `.annotate()` to add metadata and `.abort()` to mark as aborting.
|
|
2378
|
-
* Combine with another check via `.and()` to form a {@link FilterGroup}.
|
|
2138
|
+
* Constructs a {@link Filter}.
|
|
2379
2139
|
*
|
|
2380
|
-
* @
|
|
2381
|
-
* @see {@link Check}
|
|
2382
|
-
* @see {@link isPattern}
|
|
2383
|
-
* @category models
|
|
2140
|
+
* @category constructors
|
|
2384
2141
|
* @since 4.0.0
|
|
2385
2142
|
*/
|
|
2386
|
-
export
|
|
2143
|
+
export const Filter = class extends Pipeable.Class {
|
|
2387
2144
|
_tag = "Filter";
|
|
2388
2145
|
run;
|
|
2389
2146
|
annotations;
|
|
@@ -2413,22 +2170,14 @@ export class Filter extends Pipeable.Class {
|
|
|
2413
2170
|
and(other, annotations) {
|
|
2414
2171
|
return new FilterGroup([this, other], annotations);
|
|
2415
2172
|
}
|
|
2416
|
-
}
|
|
2173
|
+
};
|
|
2417
2174
|
/**
|
|
2418
|
-
*
|
|
2419
|
-
*
|
|
2420
|
-
* **Details**
|
|
2175
|
+
* Constructs a {@link FilterGroup}.
|
|
2421
2176
|
*
|
|
2422
|
-
*
|
|
2423
|
-
* All inner checks are run; failures from aborted filters still stop
|
|
2424
|
-
* evaluation.
|
|
2425
|
-
*
|
|
2426
|
-
* @see {@link Filter}
|
|
2427
|
-
* @see {@link Check}
|
|
2428
|
-
* @category models
|
|
2177
|
+
* @category constructors
|
|
2429
2178
|
* @since 4.0.0
|
|
2430
2179
|
*/
|
|
2431
|
-
export
|
|
2180
|
+
export const FilterGroup = class extends Pipeable.Class {
|
|
2432
2181
|
_tag = "FilterGroup";
|
|
2433
2182
|
checks;
|
|
2434
2183
|
annotations;
|
|
@@ -2446,7 +2195,7 @@ export class FilterGroup extends Pipeable.Class {
|
|
|
2446
2195
|
and(other, annotations) {
|
|
2447
2196
|
return new FilterGroup([this, other], annotations);
|
|
2448
2197
|
}
|
|
2449
|
-
}
|
|
2198
|
+
};
|
|
2450
2199
|
/** @internal */
|
|
2451
2200
|
export function makeFilter(filter, annotations, aborted = false) {
|
|
2452
2201
|
return new Filter((input, ast, options) => SchemaIssue.normalizeFilterOutput(ast, filter(input, ast, options), input, options), annotations, aborted);
|
|
@@ -2470,18 +2219,15 @@ export function isFinite(annotations) {
|
|
|
2470
2219
|
toCode: () => ({
|
|
2471
2220
|
runtime: "Schema.isFinite()"
|
|
2472
2221
|
}),
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
noInfinity: true,
|
|
2476
|
-
noNaN: true
|
|
2477
|
-
}
|
|
2222
|
+
arbitraryConstraint: {
|
|
2223
|
+
number: "finite"
|
|
2478
2224
|
},
|
|
2479
2225
|
...annotations
|
|
2480
2226
|
});
|
|
2481
2227
|
}
|
|
2482
2228
|
/** @internal */
|
|
2483
2229
|
export const finite = /*#__PURE__*/appendChecks(number, [/*#__PURE__*/isFinite()]);
|
|
2484
|
-
const numberToJson = /*#__PURE__*/new Link(/*#__PURE__*/new Union([finite, nonFiniteLiterals]
|
|
2230
|
+
const numberToJson = /*#__PURE__*/new Link(/*#__PURE__*/new Union([finite, nonFiniteLiterals]), /*#__PURE__*/new SchemaTransformation.Transformation(/*#__PURE__*/SchemaGetter.Number(), /*#__PURE__*/SchemaGetter.transform(n => globalThis.Number.isFinite(n) ? n : globalThis.String(n))));
|
|
2485
2231
|
/**
|
|
2486
2232
|
* Creates a {@link Filter} that validates strings by running `RegExp.test`.
|
|
2487
2233
|
*
|
|
@@ -2501,8 +2247,12 @@ const numberToJson = /*#__PURE__*/new Link(/*#__PURE__*/new Union([finite, nonFi
|
|
|
2501
2247
|
*
|
|
2502
2248
|
* **Gotchas**
|
|
2503
2249
|
*
|
|
2504
|
-
*
|
|
2505
|
-
* flags
|
|
2250
|
+
* Arbitrary metadata preserves both `regExp.source` and `regExp.flags`.
|
|
2251
|
+
* Implementations that cannot consume all flags may still use the source as a
|
|
2252
|
+
* generation hint because the Schema filter validates every generated value.
|
|
2253
|
+
* JSON Schema has no way to carry JavaScript regular-expression flags. The
|
|
2254
|
+
* generated `pattern` contains the source only, so validation can differ when
|
|
2255
|
+
* the RegExp uses flags or relies on JavaScript's non-Unicode behavior.
|
|
2506
2256
|
*
|
|
2507
2257
|
* **Example** (Validating an email pattern)
|
|
2508
2258
|
*
|
|
@@ -2536,10 +2286,11 @@ export function isPattern(regExp, annotations) {
|
|
|
2536
2286
|
toJsonSchema: () => ({
|
|
2537
2287
|
pattern: source
|
|
2538
2288
|
}),
|
|
2539
|
-
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
|
|
2289
|
+
arbitraryConstraint: {
|
|
2290
|
+
patterns: [{
|
|
2291
|
+
source: regExp.source,
|
|
2292
|
+
flags: regExp.flags
|
|
2293
|
+
}]
|
|
2543
2294
|
},
|
|
2544
2295
|
...annotations
|
|
2545
2296
|
});
|
|
@@ -2696,7 +2447,7 @@ export const optionalKey = /*#__PURE__*/memoizeIdempotent(ast => {
|
|
|
2696
2447
|
});
|
|
2697
2448
|
const optionalKeyLastLink = /*#__PURE__*/applyToLastLink(optionalKey);
|
|
2698
2449
|
/** @internal */
|
|
2699
|
-
export const optional = /*#__PURE__*/memoize(ast => optionalKey(new Union([ast, undefined_]
|
|
2450
|
+
export const optional = /*#__PURE__*/memoize(ast => optionalKey(new Union([ast, undefined_])));
|
|
2700
2451
|
/** @internal */
|
|
2701
2452
|
export const mutableKey = /*#__PURE__*/memoizeIdempotent(ast => {
|
|
2702
2453
|
const context = ast.context ? ast.context.isMutable === false ? new Context(ast.context.isOptional, true, ast.context.constructorDefault, ast.context.annotations) : ast.context : new Context(false, true);
|
|
@@ -2716,9 +2467,8 @@ export function withConstructorDefault(ast, defaultValue) {
|
|
|
2716
2467
|
*
|
|
2717
2468
|
* **Details**
|
|
2718
2469
|
*
|
|
2719
|
-
* This is the low-level primitive behind `Schema.
|
|
2720
|
-
*
|
|
2721
|
-
* encoding chain.
|
|
2470
|
+
* This is the low-level primitive behind `Schema.decodeTo`. It appends a
|
|
2471
|
+
* {@link Link} to the `to` node's encoding chain.
|
|
2722
2472
|
*
|
|
2723
2473
|
* - Returns a new AST with the same type as `to`.
|
|
2724
2474
|
*
|
|
@@ -2780,7 +2530,7 @@ export function record(key, value) {
|
|
|
2780
2530
|
* Checks `ast.context?.isOptional`. Defaults to `false` when no
|
|
2781
2531
|
* {@link Context} is set.
|
|
2782
2532
|
*
|
|
2783
|
-
* @see
|
|
2533
|
+
* @see `Schema.optionalKey`
|
|
2784
2534
|
* @see {@link Context}
|
|
2785
2535
|
* @category predicates
|
|
2786
2536
|
* @since 4.0.0
|
|
@@ -2924,7 +2674,7 @@ export function containsUndefined(ast) {
|
|
|
2924
2674
|
}
|
|
2925
2675
|
}
|
|
2926
2676
|
function fromConst(ast, value) {
|
|
2927
|
-
const succeed = InternalParser.succeed(value);
|
|
2677
|
+
const succeed = value === 0 ? InternalParser.sameExit : InternalParser.succeed(value);
|
|
2928
2678
|
return (input, options) => {
|
|
2929
2679
|
if (input === InternalParser.missing) return InternalParser.missingExit;
|
|
2930
2680
|
if (input === value) return succeed;
|
|
@@ -2986,12 +2736,6 @@ function segmentTemplateLiteralParts(ast, input, options) {
|
|
|
2986
2736
|
}
|
|
2987
2737
|
return go(0, 0) ? out : undefined;
|
|
2988
2738
|
}
|
|
2989
|
-
/** @internal */
|
|
2990
|
-
export const enumsToLiterals = /*#__PURE__*/memoize(ast => {
|
|
2991
|
-
return new Union(ast.enums.map(e => new Literal(e[1], {
|
|
2992
|
-
title: e[0]
|
|
2993
|
-
})), "anyOf");
|
|
2994
|
-
});
|
|
2995
2739
|
const parameterFromPropertyKey = /*#__PURE__*/applyToSelfOrLastLinkEncodingIdempotent(ast => {
|
|
2996
2740
|
switch (ast._tag) {
|
|
2997
2741
|
default:
|
|
@@ -3049,7 +2793,7 @@ export function isStringFinite(annotations) {
|
|
|
3049
2793
|
}
|
|
3050
2794
|
const finiteString = /*#__PURE__*/appendChecks(string, [/*#__PURE__*/isStringFinite()]);
|
|
3051
2795
|
const finiteToString = /*#__PURE__*/new Link(finiteString, SchemaTransformation.numberFromString);
|
|
3052
|
-
const numberToString = /*#__PURE__*/new Link(/*#__PURE__*/new Union([finiteString, nonFiniteLiterals]
|
|
2796
|
+
const numberToString = /*#__PURE__*/new Link(/*#__PURE__*/new Union([finiteString, nonFiniteLiterals]), SchemaTransformation.numberFromString);
|
|
3053
2797
|
/**
|
|
3054
2798
|
* signed integer only (no leading "+" because TypeScript doesn't support it)
|
|
3055
2799
|
*/
|
|
@@ -3074,14 +2818,14 @@ export const bigIntString = /*#__PURE__*/appendChecks(string, [/*#__PURE__*/isSt
|
|
|
3074
2818
|
expected: "a string representing a bigint"
|
|
3075
2819
|
})]);
|
|
3076
2820
|
const bigIntToString = /*#__PURE__*/new Link(bigIntString, SchemaTransformation.bigintFromString);
|
|
3077
|
-
const REGEXP_PATTERN = "Symbol\\((
|
|
2821
|
+
const REGEXP_PATTERN = "Symbol\\(([\\s\\S]*)\\)";
|
|
3078
2822
|
const isStringSymbolRegExp = /*#__PURE__*/new globalThis.RegExp(`^${REGEXP_PATTERN}$`);
|
|
3079
2823
|
/** @internal */
|
|
3080
2824
|
export const symbolString = /*#__PURE__*/appendChecks(string, [/*#__PURE__*/isStringSymbol()]);
|
|
3081
2825
|
/**
|
|
3082
2826
|
* to distinguish between Symbol and String, we need to add a check to the string keyword
|
|
3083
2827
|
*/
|
|
3084
|
-
const symbolToString = /*#__PURE__*/new Link(symbolString, /*#__PURE__*/new SchemaTransformation.Transformation(/*#__PURE__*/SchemaGetter.transform(description => globalThis.Symbol.for(isStringSymbolRegExp.exec(description)[1])), /*#__PURE__*/SchemaGetter.
|
|
2828
|
+
const symbolToString = /*#__PURE__*/new Link(symbolString, /*#__PURE__*/new SchemaTransformation.Transformation(/*#__PURE__*/SchemaGetter.transform(description => globalThis.Symbol.for(isStringSymbolRegExp.exec(description)[1])), /*#__PURE__*/SchemaGetter.transformEffect((sym, options) => {
|
|
3085
2829
|
const key = globalThis.Symbol.keyFor(sym);
|
|
3086
2830
|
if (key !== undefined) {
|
|
3087
2831
|
return Effect.succeed(globalThis.String(sym));
|
|
@@ -3150,7 +2894,7 @@ export function getConstructorDescriptor(ast) {
|
|
|
3150
2894
|
*
|
|
3151
2895
|
* If the node has {@link Checks}, returns annotations from the last check
|
|
3152
2896
|
* (which is where user-supplied annotations end up after `.pipe(Schema.annotations(...))`).
|
|
3153
|
-
* Otherwise returns `
|
|
2897
|
+
* Otherwise returns the node's `annotations` directly.
|
|
3154
2898
|
*
|
|
3155
2899
|
* **Example** (Reading annotations)
|
|
3156
2900
|
*
|
|
@@ -3297,8 +3041,7 @@ export const Json = /*#__PURE__*/new Declaration([], () => (input, ast, options)
|
|
|
3297
3041
|
},
|
|
3298
3042
|
expected: "JSON value",
|
|
3299
3043
|
toCodecJson: () => undefined,
|
|
3300
|
-
toCodecStringTree: () => unknownToStringTree
|
|
3301
|
-
toArbitrary: () => fc => fc.jsonValue()
|
|
3044
|
+
toCodecStringTree: () => unknownToStringTree
|
|
3302
3045
|
});
|
|
3303
3046
|
/** @internal */
|
|
3304
3047
|
export const MutableJson = /*#__PURE__*/annotate(Json, {
|
|
@@ -3310,7 +3053,7 @@ export const MutableJson = /*#__PURE__*/annotate(Json, {
|
|
|
3310
3053
|
/** @internal */
|
|
3311
3054
|
export const unknownToJson = /*#__PURE__*/new Link(Json, /*#__PURE__*/SchemaTransformation.passthrough());
|
|
3312
3055
|
/** @internal */
|
|
3313
|
-
export const objectKeywordToJson = /*#__PURE__*/new Link(/*#__PURE__*/new Union([/*#__PURE__*/new Arrays(false, [], [Json]), /*#__PURE__*/new Objects([], [/*#__PURE__*/new IndexSignature(string, Json)])]
|
|
3056
|
+
export const objectKeywordToJson = /*#__PURE__*/new Link(/*#__PURE__*/new Union([/*#__PURE__*/new Arrays(false, [], [Json]), /*#__PURE__*/new Objects([], [/*#__PURE__*/new IndexSignature(string, Json)])]), /*#__PURE__*/SchemaTransformation.passthrough());
|
|
3314
3057
|
/**
|
|
3315
3058
|
* Returns true if the value is a StringTree value.
|
|
3316
3059
|
*
|