effect 4.0.0-rc.112 → 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 +86 -50
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +58 -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 +66 -39
- 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 +33 -15
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +58 -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.js +8 -22
- 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 +1 -3
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +7 -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 +38 -1
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +81 -5
- 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.map +1 -1
- package/dist/RcMap.js +15 -9
- package/dist/RcMap.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 +2155 -2415
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +2755 -4174
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +354 -183
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +277 -601
- 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 +122 -188
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js +48 -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 +1099 -16
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +1341 -20
- 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/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/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 +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -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 +386 -251
- 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 +14 -12
- 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 +74 -23
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +59 -5
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +2 -1
- 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 +21 -12
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +2 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Prompt.d.ts +1 -1
- 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/structured-output.js +8 -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 +26 -3
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +73 -73
- package/dist/unstable/cli/Command.js +18 -18
- 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 +23 -24
- package/dist/unstable/cli/Prompt.d.ts.map +1 -1
- package/dist/unstable/cli/Prompt.js +68 -63
- package/dist/unstable/cli/Prompt.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/zsh.js +2 -2
- 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.map +1 -1
- package/dist/unstable/cli/internal/wizard.js +14 -13
- 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 +4 -4
- package/dist/unstable/cluster/Envelope.d.ts.map +1 -1
- package/dist/unstable/cluster/Envelope.js +2 -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 +5 -2
- package/dist/unstable/cluster/HttpRunner.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 +28 -9
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts +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 +7 -4
- 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 +27 -3
- package/dist/unstable/encoding/SchemaBinary.d.ts.map +1 -1
- package/dist/unstable/encoding/SchemaBinary.js +108 -39
- package/dist/unstable/encoding/SchemaBinary.js.map +1 -1
- 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 +0 -4
- package/dist/unstable/encoding/index.d.ts.map +1 -1
- package/dist/unstable/encoding/index.js +0 -4
- 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 +7 -7
- package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventJournal.js +9 -9
- 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 +4 -4
- 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.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.js +26 -13
- 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 +23 -6
- 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/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/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.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +64 -64
- 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 +3 -1
- package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMessage.js +1 -1
- 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 +5 -39
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +22 -115
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +104 -57
- 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/package.json +7 -9
- package/src/Array.ts +118 -67
- 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 +183 -48
- 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 +66 -41
- package/src/JsonPatch.ts +4 -4
- package/src/JsonPointer.ts +97 -4
- package/src/JsonSchema.ts +8 -26
- package/src/Layer.ts +59 -18
- package/src/LayerMap.ts +8 -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 +125 -8
- 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 +20 -13
- 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 +4809 -6368
- package/src/SchemaAST.ts +1031 -284
- package/src/SchemaGetter.ts +75 -21
- package/src/SchemaIssue.ts +259 -15
- package/src/SchemaParser.ts +2 -12
- package/src/SchemaRepresentation.ts +1593 -29
- package/src/SchemaTransformation.ts +145 -22
- package/src/ScopedCache.ts +10 -3
- package/src/Sink.ts +31 -15
- 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 +5 -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 +475 -295
- 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 +14 -29
- 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 +69 -5
- package/src/unstable/ai/AnthropicStructuredOutput.ts +4 -1
- 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 +36 -20
- package/src/unstable/ai/OpenAiStructuredOutput.ts +4 -1
- package/src/unstable/ai/Prompt.ts +19 -4
- 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/structured-output.ts +5 -5
- 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 +40 -3
- package/src/unstable/cli/Command.ts +74 -74
- 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 +88 -87
- package/src/unstable/cli/internal/completions/descriptor.ts +23 -11
- package/src/unstable/cli/internal/completions/zsh.ts +2 -2
- 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 +18 -13
- 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 +3 -3
- package/src/unstable/cluster/HttpRunner.ts +7 -2
- package/src/unstable/cluster/MessageStorage.ts +62 -21
- package/src/unstable/cluster/Reply.ts +2 -2
- 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 +12 -4
- 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 +150 -44
- 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 +0 -5
- package/src/unstable/eventlog/Event.ts +7 -7
- package/src/unstable/eventlog/EventJournal.ts +9 -9
- package/src/unstable/eventlog/EventLog.ts +5 -5
- 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 +32 -9
- 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 +52 -6
- 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/HttpApiSchema.ts +14 -7
- 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 +62 -59
- package/src/unstable/rpc/RpcMessage.ts +3 -1
- package/src/unstable/rpc/RpcMiddleware.ts +7 -5
- package/src/unstable/rpc/RpcSerialization.ts +27 -117
- package/src/unstable/rpc/RpcServer.ts +143 -80
- 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/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
|
-
*
|
|
330
|
+
* Constructs a {@link Context}.
|
|
344
331
|
*
|
|
345
|
-
*
|
|
346
|
-
*
|
|
347
|
-
* Tracks whether a property key is optional, mutable, has a constructor
|
|
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,32 +364,19 @@ export class Base {
|
|
|
412
364
|
}
|
|
413
365
|
}
|
|
414
366
|
/**
|
|
415
|
-
*
|
|
416
|
-
*
|
|
417
|
-
* **When to use**
|
|
418
|
-
*
|
|
419
|
-
* Use when you need a custom schema AST node because none of the built-in
|
|
420
|
-
* nodes fit.
|
|
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.
|
|
367
|
+
* Constructs a {@link Declaration}.
|
|
428
368
|
*
|
|
429
|
-
* @
|
|
430
|
-
* @
|
|
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
|
/**
|
|
439
378
|
* Parser factory {@link flip} swaps in, so a declaration can behave
|
|
440
|
-
* differently when encoding. `undefined` reuses
|
|
379
|
+
* differently when encoding. `undefined` reuses `run`.
|
|
441
380
|
*/
|
|
442
381
|
encodingRun;
|
|
443
382
|
constructor(typeParameters, run, annotations, checks, encoding, context, encodingChecks, encodingRun) {
|
|
@@ -473,20 +412,14 @@ export class Declaration extends Base {
|
|
|
473
412
|
if (typeof expected === "string") return expected;
|
|
474
413
|
return "<Declaration>";
|
|
475
414
|
}
|
|
476
|
-
}
|
|
415
|
+
};
|
|
477
416
|
/**
|
|
478
|
-
*
|
|
479
|
-
*
|
|
480
|
-
* **Details**
|
|
417
|
+
* Constructs a {@link Null}.
|
|
481
418
|
*
|
|
482
|
-
*
|
|
483
|
-
*
|
|
484
|
-
* @see {@link null_ null}
|
|
485
|
-
* @see {@link isNull}
|
|
486
|
-
* @category models
|
|
419
|
+
* @category constructors
|
|
487
420
|
* @since 4.0.0
|
|
488
421
|
*/
|
|
489
|
-
export
|
|
422
|
+
export const Null = class extends ASTNodeImpl {
|
|
490
423
|
_tag = "Null";
|
|
491
424
|
/** @internal */
|
|
492
425
|
getParser() {
|
|
@@ -496,7 +429,7 @@ export class Null extends Base {
|
|
|
496
429
|
getExpected() {
|
|
497
430
|
return "null";
|
|
498
431
|
}
|
|
499
|
-
}
|
|
432
|
+
};
|
|
500
433
|
const null_ = /*#__PURE__*/new Null();
|
|
501
434
|
export {
|
|
502
435
|
/**
|
|
@@ -512,18 +445,12 @@ export {
|
|
|
512
445
|
*/
|
|
513
446
|
null_ as null };
|
|
514
447
|
/**
|
|
515
|
-
*
|
|
516
|
-
*
|
|
517
|
-
* **Details**
|
|
448
|
+
* Constructs a {@link Undefined}.
|
|
518
449
|
*
|
|
519
|
-
*
|
|
520
|
-
*
|
|
521
|
-
* @see {@link undefined}
|
|
522
|
-
* @see {@link isUndefined}
|
|
523
|
-
* @category models
|
|
450
|
+
* @category constructors
|
|
524
451
|
* @since 4.0.0
|
|
525
452
|
*/
|
|
526
|
-
export
|
|
453
|
+
export const Undefined = class extends ASTNodeImpl {
|
|
527
454
|
_tag = "Undefined";
|
|
528
455
|
/** @internal */
|
|
529
456
|
getParser() {
|
|
@@ -537,7 +464,7 @@ export class Undefined extends Base {
|
|
|
537
464
|
getExpected() {
|
|
538
465
|
return "undefined";
|
|
539
466
|
}
|
|
540
|
-
}
|
|
467
|
+
};
|
|
541
468
|
const undefinedToNull = /*#__PURE__*/new Link(null_, /*#__PURE__*/new SchemaTransformation.Transformation(/*#__PURE__*/SchemaGetter.transform(() => undefined), /*#__PURE__*/SchemaGetter.transform(() => null)));
|
|
542
469
|
const undefined_ = /*#__PURE__*/new Undefined();
|
|
543
470
|
export {
|
|
@@ -554,26 +481,12 @@ export {
|
|
|
554
481
|
*/
|
|
555
482
|
undefined_ as undefined };
|
|
556
483
|
/**
|
|
557
|
-
*
|
|
558
|
-
*
|
|
559
|
-
* **When to use**
|
|
560
|
-
*
|
|
561
|
-
* Use when you need an AST node for a value whose result is intentionally
|
|
562
|
-
* ignored.
|
|
563
|
-
*
|
|
564
|
-
* **Details**
|
|
484
|
+
* Constructs a {@link Void}.
|
|
565
485
|
*
|
|
566
|
-
*
|
|
567
|
-
* `undefined`. Public schemas built from it may still expose `void` as their
|
|
568
|
-
* typed decoded and encoded representation.
|
|
569
|
-
*
|
|
570
|
-
* @see {@link undefined} for the AST singleton that matches only exact `undefined`
|
|
571
|
-
* @see {@link void_ void}
|
|
572
|
-
* @see {@link isVoid}
|
|
573
|
-
* @category models
|
|
486
|
+
* @category constructors
|
|
574
487
|
* @since 4.0.0
|
|
575
488
|
*/
|
|
576
|
-
export
|
|
489
|
+
export const Void = class extends ASTNodeImpl {
|
|
577
490
|
_tag = "Void";
|
|
578
491
|
/** @internal */
|
|
579
492
|
getParser() {
|
|
@@ -588,7 +501,7 @@ export class Void extends Base {
|
|
|
588
501
|
getExpected() {
|
|
589
502
|
return "void";
|
|
590
503
|
}
|
|
591
|
-
}
|
|
504
|
+
};
|
|
592
505
|
const void_ = /*#__PURE__*/new Void();
|
|
593
506
|
export {
|
|
594
507
|
/**
|
|
@@ -613,19 +526,12 @@ export {
|
|
|
613
526
|
*/
|
|
614
527
|
void_ as void };
|
|
615
528
|
/**
|
|
616
|
-
*
|
|
529
|
+
* Constructs a {@link Never}.
|
|
617
530
|
*
|
|
618
|
-
*
|
|
619
|
-
*
|
|
620
|
-
* Parsing always fails. Useful as a placeholder in unions or as the result
|
|
621
|
-
* of narrowing that eliminates all options.
|
|
622
|
-
*
|
|
623
|
-
* @see {@link never}
|
|
624
|
-
* @see {@link isNever}
|
|
625
|
-
* @category models
|
|
531
|
+
* @category constructors
|
|
626
532
|
* @since 4.0.0
|
|
627
533
|
*/
|
|
628
|
-
export
|
|
534
|
+
export const Never = class extends ASTNodeImpl {
|
|
629
535
|
_tag = "Never";
|
|
630
536
|
/** @internal */
|
|
631
537
|
getParser() {
|
|
@@ -635,7 +541,7 @@ export class Never extends Base {
|
|
|
635
541
|
getExpected() {
|
|
636
542
|
return "never";
|
|
637
543
|
}
|
|
638
|
-
}
|
|
544
|
+
};
|
|
639
545
|
/**
|
|
640
546
|
* Provides the singleton {@link Never} AST instance.
|
|
641
547
|
*
|
|
@@ -652,15 +558,12 @@ export class Never extends Base {
|
|
|
652
558
|
*/
|
|
653
559
|
export const never = /*#__PURE__*/new Never();
|
|
654
560
|
/**
|
|
655
|
-
*
|
|
656
|
-
*
|
|
657
|
-
* @see {@link any}
|
|
658
|
-
* @see {@link isAny}
|
|
561
|
+
* Constructs a {@link Any}.
|
|
659
562
|
*
|
|
660
|
-
* @category
|
|
563
|
+
* @category constructors
|
|
661
564
|
* @since 4.0.0
|
|
662
565
|
*/
|
|
663
|
-
export
|
|
566
|
+
export const Any = class extends ASTNodeImpl {
|
|
664
567
|
_tag = "Any";
|
|
665
568
|
/** @internal */
|
|
666
569
|
getParser() {
|
|
@@ -670,7 +573,7 @@ export class Any extends Base {
|
|
|
670
573
|
getExpected() {
|
|
671
574
|
return "any";
|
|
672
575
|
}
|
|
673
|
-
}
|
|
576
|
+
};
|
|
674
577
|
/**
|
|
675
578
|
* Provides the singleton {@link Any} AST instance.
|
|
676
579
|
*
|
|
@@ -686,19 +589,12 @@ export class Any extends Base {
|
|
|
686
589
|
*/
|
|
687
590
|
export const any = /*#__PURE__*/new Any();
|
|
688
591
|
/**
|
|
689
|
-
*
|
|
592
|
+
* Constructs a {@link Unknown}.
|
|
690
593
|
*
|
|
691
|
-
*
|
|
692
|
-
*
|
|
693
|
-
* Unlike {@link Any}, this is type-safe: the parsed result is typed as
|
|
694
|
-
* `unknown` rather than `any`.
|
|
695
|
-
*
|
|
696
|
-
* @see {@link unknown}
|
|
697
|
-
* @see {@link isUnknown}
|
|
698
|
-
* @category models
|
|
594
|
+
* @category constructors
|
|
699
595
|
* @since 4.0.0
|
|
700
596
|
*/
|
|
701
|
-
export
|
|
597
|
+
export const Unknown = class extends ASTNodeImpl {
|
|
702
598
|
_tag = "Unknown";
|
|
703
599
|
/** @internal */
|
|
704
600
|
getParser() {
|
|
@@ -708,7 +604,7 @@ export class Unknown extends Base {
|
|
|
708
604
|
getExpected() {
|
|
709
605
|
return "unknown";
|
|
710
606
|
}
|
|
711
|
-
}
|
|
607
|
+
};
|
|
712
608
|
/**
|
|
713
609
|
* Provides the singleton {@link Unknown} AST instance.
|
|
714
610
|
*
|
|
@@ -724,16 +620,12 @@ export class Unknown extends Base {
|
|
|
724
620
|
*/
|
|
725
621
|
export const unknown = /*#__PURE__*/new Unknown();
|
|
726
622
|
/**
|
|
727
|
-
*
|
|
728
|
-
* and functions (anything non-primitive and non-null).
|
|
729
|
-
*
|
|
730
|
-
* @see {@link objectKeyword}
|
|
731
|
-
* @see {@link isObjectKeyword}
|
|
623
|
+
* Constructs a {@link ObjectKeyword}.
|
|
732
624
|
*
|
|
733
|
-
* @category
|
|
734
|
-
* @since
|
|
625
|
+
* @category constructors
|
|
626
|
+
* @since 4.0.0
|
|
735
627
|
*/
|
|
736
|
-
export
|
|
628
|
+
export const ObjectKeyword = class extends ASTNodeImpl {
|
|
737
629
|
_tag = "ObjectKeyword";
|
|
738
630
|
/** @internal */
|
|
739
631
|
getParser() {
|
|
@@ -743,7 +635,7 @@ export class ObjectKeyword extends Base {
|
|
|
743
635
|
getExpected() {
|
|
744
636
|
return "object | array | function";
|
|
745
637
|
}
|
|
746
|
-
}
|
|
638
|
+
};
|
|
747
639
|
/**
|
|
748
640
|
* Provides the singleton {@link ObjectKeyword} AST instance.
|
|
749
641
|
*
|
|
@@ -760,22 +652,21 @@ export class ObjectKeyword extends Base {
|
|
|
760
652
|
*/
|
|
761
653
|
export const objectKeyword = /*#__PURE__*/new ObjectKeyword();
|
|
762
654
|
/**
|
|
763
|
-
*
|
|
764
|
-
*
|
|
765
|
-
* **Details**
|
|
766
|
-
*
|
|
767
|
-
* Holds `enums` as an array of `[name, value]` pairs where values are
|
|
768
|
-
* `string | number`. Parsing succeeds when the input matches any enum value.
|
|
655
|
+
* Constructs a {@link Enum}. Numeric values must be finite.
|
|
769
656
|
*
|
|
770
|
-
* @
|
|
771
|
-
* @category models
|
|
657
|
+
* @category constructors
|
|
772
658
|
* @since 4.0.0
|
|
773
659
|
*/
|
|
774
|
-
export
|
|
660
|
+
export const Enum = class extends ASTNodeImpl {
|
|
775
661
|
_tag = "Enum";
|
|
776
662
|
enums;
|
|
777
663
|
constructor(enums, annotations, checks, encoding, context) {
|
|
778
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
|
+
}
|
|
779
670
|
this.enums = enums;
|
|
780
671
|
}
|
|
781
672
|
/** @internal */
|
|
@@ -787,7 +678,7 @@ export class Enum extends Base {
|
|
|
787
678
|
toCodecStringTree() {
|
|
788
679
|
if (this.enums.some(([_, v]) => typeof v === "number")) {
|
|
789
680
|
const coercions = Object.fromEntries(this.enums.map(([_, v]) => [globalThis.String(v), v]));
|
|
790
|
-
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()))]);
|
|
791
682
|
}
|
|
792
683
|
return this;
|
|
793
684
|
}
|
|
@@ -795,36 +686,46 @@ export class Enum extends Base {
|
|
|
795
686
|
getExpected() {
|
|
796
687
|
return this.enums.map(([_, value]) => JSON.stringify(value)).join(" | ");
|
|
797
688
|
}
|
|
798
|
-
}
|
|
799
|
-
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;
|
|
800
696
|
switch (ast._tag) {
|
|
801
697
|
case "String":
|
|
802
698
|
case "Number":
|
|
803
699
|
case "BigInt":
|
|
804
|
-
|
|
700
|
+
valid = true;
|
|
701
|
+
break;
|
|
805
702
|
case "Literal":
|
|
703
|
+
valid = !ast.checks;
|
|
704
|
+
break;
|
|
806
705
|
case "TemplateLiteral":
|
|
807
|
-
|
|
706
|
+
valid = !ast.checks && ast.parts.every((part, index) => isTemplateLiteralPart(part, `${path}.parts[${index}]`, validated));
|
|
707
|
+
break;
|
|
808
708
|
case "Union":
|
|
809
|
-
|
|
709
|
+
valid = !ast.checks && ast.types.every((part, index) => isTemplateLiteralPart(part, `${path}.types[${index}]`, validated));
|
|
710
|
+
break;
|
|
810
711
|
default:
|
|
811
712
|
return false;
|
|
812
713
|
}
|
|
714
|
+
if (valid) validated.add(ast);
|
|
715
|
+
return valid;
|
|
813
716
|
}
|
|
814
717
|
/**
|
|
815
|
-
*
|
|
816
|
-
* (e.g. `` `user_${string}` ``).
|
|
718
|
+
* Constructs a {@link TemplateLiteral}.
|
|
817
719
|
*
|
|
818
|
-
* **
|
|
720
|
+
* **Gotchas**
|
|
819
721
|
*
|
|
820
|
-
*
|
|
821
|
-
*
|
|
722
|
+
* Throws if a part contains an encoding, including inside unions or nested
|
|
723
|
+
* template literals. Parts must describe their values without transformations.
|
|
822
724
|
*
|
|
823
|
-
* @
|
|
824
|
-
* @
|
|
825
|
-
* @since 3.10.0
|
|
725
|
+
* @category constructors
|
|
726
|
+
* @since 4.0.0
|
|
826
727
|
*/
|
|
827
|
-
export
|
|
728
|
+
export const TemplateLiteral = class extends ASTNodeImpl {
|
|
828
729
|
_tag = "TemplateLiteral";
|
|
829
730
|
parts;
|
|
830
731
|
/** @internal */
|
|
@@ -837,14 +738,14 @@ export class TemplateLiteral extends Base {
|
|
|
837
738
|
super(annotations, checks, encoding, context);
|
|
838
739
|
const encodedParts = [];
|
|
839
740
|
const literals = [];
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
} else {
|
|
846
|
-
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}`);
|
|
847
746
|
}
|
|
747
|
+
encodedParts.push(part);
|
|
748
|
+
literals.push(part._tag === "Literal" ? globalThis.String(part.literal) : undefined);
|
|
848
749
|
}
|
|
849
750
|
const suffixLengths = new Array(encodedParts.length + 1);
|
|
850
751
|
suffixLengths[encodedParts.length] = 0;
|
|
@@ -858,7 +759,8 @@ export class TemplateLiteral extends Base {
|
|
|
858
759
|
}
|
|
859
760
|
/** @internal */
|
|
860
761
|
getParser(compile) {
|
|
861
|
-
const
|
|
762
|
+
const tuple = new Arrays(false, this.parts.map(partFromString), []);
|
|
763
|
+
const parser = compile(decodeTo(string, tuple, templateLiteralTransformation(this)));
|
|
862
764
|
return (input, options) => {
|
|
863
765
|
if (input === InternalParser.missing) return InternalParser.missingExit;
|
|
864
766
|
const result = parser(input, options);
|
|
@@ -879,31 +781,39 @@ export class TemplateLiteral extends Base {
|
|
|
879
781
|
matchPart(s, options) {
|
|
880
782
|
return segmentTemplateLiteralParts(this, s, options) === undefined ? undefined : s;
|
|
881
783
|
}
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
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("")));
|
|
893
809
|
}
|
|
894
810
|
/**
|
|
895
|
-
*
|
|
896
|
-
*
|
|
897
|
-
* **Details**
|
|
898
|
-
*
|
|
899
|
-
* Parsing succeeds only when the input is reference-equal to the stored
|
|
900
|
-
* `symbol`.
|
|
811
|
+
* Constructs a {@link UniqueSymbol}.
|
|
901
812
|
*
|
|
902
|
-
* @
|
|
903
|
-
* @
|
|
904
|
-
* @since 3.10.0
|
|
813
|
+
* @category constructors
|
|
814
|
+
* @since 4.0.0
|
|
905
815
|
*/
|
|
906
|
-
export
|
|
816
|
+
export const UniqueSymbol = class extends ASTNodeImpl {
|
|
907
817
|
_tag = "UniqueSymbol";
|
|
908
818
|
symbol;
|
|
909
819
|
constructor(symbol, annotations, checks, encoding, context) {
|
|
@@ -916,38 +826,21 @@ export class UniqueSymbol extends Base {
|
|
|
916
826
|
}
|
|
917
827
|
/** @internal */
|
|
918
828
|
toCodecStringTree() {
|
|
919
|
-
|
|
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)]);
|
|
920
831
|
}
|
|
921
832
|
/** @internal */
|
|
922
833
|
getExpected() {
|
|
923
834
|
return globalThis.String(this.symbol);
|
|
924
835
|
}
|
|
925
|
-
}
|
|
836
|
+
};
|
|
926
837
|
/**
|
|
927
|
-
*
|
|
928
|
-
* bigint).
|
|
929
|
-
*
|
|
930
|
-
* **Details**
|
|
931
|
-
*
|
|
932
|
-
* Parsing succeeds only when the input is strictly equal (`===`) to the
|
|
933
|
-
* stored `literal`. Numeric literals must be finite — `Infinity`, `-Infinity`,
|
|
934
|
-
* and `NaN` are rejected at construction time.
|
|
838
|
+
* Constructs a {@link Literal}.
|
|
935
839
|
*
|
|
936
|
-
*
|
|
937
|
-
*
|
|
938
|
-
* ```ts import.meta.vitest
|
|
939
|
-
* import { SchemaAST } from "effect"
|
|
940
|
-
*
|
|
941
|
-
* const ast = new SchemaAST.Literal("active")
|
|
942
|
-
* ast.literal // => "active"
|
|
943
|
-
* ```
|
|
944
|
-
*
|
|
945
|
-
* @see {@link LiteralValue}
|
|
946
|
-
* @see {@link isLiteral}
|
|
947
|
-
* @category models
|
|
948
|
-
* @since 3.10.0
|
|
840
|
+
* @category constructors
|
|
841
|
+
* @since 4.0.0
|
|
949
842
|
*/
|
|
950
|
-
export
|
|
843
|
+
export const Literal = class extends ASTNodeImpl {
|
|
951
844
|
_tag = "Literal";
|
|
952
845
|
literal;
|
|
953
846
|
constructor(literal, annotations, checks, encoding, context) {
|
|
@@ -977,21 +870,18 @@ export class Literal extends Base {
|
|
|
977
870
|
getExpected() {
|
|
978
871
|
return typeof this.literal === "string" ? JSON.stringify(this.literal) : globalThis.String(this.literal);
|
|
979
872
|
}
|
|
980
|
-
}
|
|
873
|
+
};
|
|
981
874
|
function literalToString(ast) {
|
|
982
875
|
const literalAsString = globalThis.String(ast.literal);
|
|
983
876
|
return replaceEncoding(ast, [new Link(new Literal(literalAsString), new SchemaTransformation.Transformation(SchemaGetter.transform(() => ast.literal), SchemaGetter.transform(() => literalAsString)))]);
|
|
984
877
|
}
|
|
985
878
|
/**
|
|
986
|
-
*
|
|
987
|
-
*
|
|
988
|
-
* @see {@link string}
|
|
989
|
-
* @see {@link isString}
|
|
879
|
+
* Constructs a {@link String}.
|
|
990
880
|
*
|
|
991
|
-
* @category
|
|
881
|
+
* @category constructors
|
|
992
882
|
* @since 4.0.0
|
|
993
883
|
*/
|
|
994
|
-
export
|
|
884
|
+
export const String = class extends ASTNodeImpl {
|
|
995
885
|
_tag = "String";
|
|
996
886
|
/** @internal */
|
|
997
887
|
getParser() {
|
|
@@ -1006,7 +896,7 @@ export class String extends Base {
|
|
|
1006
896
|
getExpected() {
|
|
1007
897
|
return "string";
|
|
1008
898
|
}
|
|
1009
|
-
}
|
|
899
|
+
};
|
|
1010
900
|
/**
|
|
1011
901
|
* Provides the singleton {@link String} AST instance.
|
|
1012
902
|
*
|
|
@@ -1022,25 +912,12 @@ export class String extends Base {
|
|
|
1022
912
|
*/
|
|
1023
913
|
export const string = /*#__PURE__*/new String();
|
|
1024
914
|
/**
|
|
1025
|
-
*
|
|
1026
|
-
* `-Infinity`).
|
|
1027
|
-
*
|
|
1028
|
-
* **Details**
|
|
1029
|
-
*
|
|
1030
|
-
* Default JSON serialization:
|
|
915
|
+
* Constructs a {@link Number}.
|
|
1031
916
|
*
|
|
1032
|
-
*
|
|
1033
|
-
* - `Infinity`, `-Infinity`, and `NaN` are serialized as JSON strings.
|
|
1034
|
-
*
|
|
1035
|
-
* If the node has an `isFinite` or `isInt` check, the string fallback is
|
|
1036
|
-
* skipped since non-finite values cannot occur.
|
|
1037
|
-
*
|
|
1038
|
-
* @see {@link number}
|
|
1039
|
-
* @see {@link isNumber}
|
|
1040
|
-
* @category models
|
|
917
|
+
* @category constructors
|
|
1041
918
|
* @since 4.0.0
|
|
1042
919
|
*/
|
|
1043
|
-
export
|
|
920
|
+
export const Number = class extends ASTNodeImpl {
|
|
1044
921
|
_tag = "Number";
|
|
1045
922
|
/** @internal */
|
|
1046
923
|
getParser() {
|
|
@@ -1078,7 +955,7 @@ export class Number extends Base {
|
|
|
1078
955
|
getExpected() {
|
|
1079
956
|
return "number";
|
|
1080
957
|
}
|
|
1081
|
-
}
|
|
958
|
+
};
|
|
1082
959
|
function hasCheck(checks, id) {
|
|
1083
960
|
return checks.some(check => check.annotations?.representation?.id === id || check._tag === "FilterGroup" && hasCheck(check.checks, id));
|
|
1084
961
|
}
|
|
@@ -1098,15 +975,12 @@ function hasCheck(checks, id) {
|
|
|
1098
975
|
*/
|
|
1099
976
|
export const number = /*#__PURE__*/new Number();
|
|
1100
977
|
/**
|
|
1101
|
-
*
|
|
978
|
+
* Constructs a {@link Boolean}.
|
|
1102
979
|
*
|
|
1103
|
-
* @
|
|
1104
|
-
* @see {@link isBoolean}
|
|
1105
|
-
*
|
|
1106
|
-
* @category models
|
|
980
|
+
* @category constructors
|
|
1107
981
|
* @since 4.0.0
|
|
1108
982
|
*/
|
|
1109
|
-
export
|
|
983
|
+
export const Boolean = class extends ASTNodeImpl {
|
|
1110
984
|
_tag = "Boolean";
|
|
1111
985
|
/** @internal */
|
|
1112
986
|
getParser() {
|
|
@@ -1116,7 +990,7 @@ export class Boolean extends Base {
|
|
|
1116
990
|
getExpected() {
|
|
1117
991
|
return "boolean";
|
|
1118
992
|
}
|
|
1119
|
-
}
|
|
993
|
+
};
|
|
1120
994
|
/**
|
|
1121
995
|
* Provides the singleton {@link Boolean} AST instance.
|
|
1122
996
|
*
|
|
@@ -1133,24 +1007,12 @@ export class Boolean extends Base {
|
|
|
1133
1007
|
*/
|
|
1134
1008
|
export const boolean = /*#__PURE__*/new Boolean();
|
|
1135
1009
|
/**
|
|
1136
|
-
*
|
|
1010
|
+
* Constructs a {@link Symbol}.
|
|
1137
1011
|
*
|
|
1138
|
-
*
|
|
1139
|
-
*
|
|
1140
|
-
* Use when you need the AST node class for schemas that match any JavaScript
|
|
1141
|
-
* symbol value.
|
|
1142
|
-
*
|
|
1143
|
-
* **Details**
|
|
1144
|
-
*
|
|
1145
|
-
* When serialized to a string-based codec, symbols are converted via
|
|
1146
|
-
* `Symbol.keyFor` and must be registered with `Symbol.for`.
|
|
1147
|
-
*
|
|
1148
|
-
* @see {@link symbol}
|
|
1149
|
-
* @see {@link isSymbol}
|
|
1150
|
-
* @category models
|
|
1012
|
+
* @category constructors
|
|
1151
1013
|
* @since 4.0.0
|
|
1152
1014
|
*/
|
|
1153
|
-
export
|
|
1015
|
+
export const Symbol = class extends ASTNodeImpl {
|
|
1154
1016
|
_tag = "Symbol";
|
|
1155
1017
|
/** @internal */
|
|
1156
1018
|
getParser() {
|
|
@@ -1169,7 +1031,7 @@ export class Symbol extends Base {
|
|
|
1169
1031
|
getExpected() {
|
|
1170
1032
|
return "symbol";
|
|
1171
1033
|
}
|
|
1172
|
-
}
|
|
1034
|
+
};
|
|
1173
1035
|
/**
|
|
1174
1036
|
* Provides the singleton {@link Symbol} AST instance.
|
|
1175
1037
|
*
|
|
@@ -1190,19 +1052,12 @@ export class Symbol extends Base {
|
|
|
1190
1052
|
*/
|
|
1191
1053
|
export const symbol = /*#__PURE__*/new Symbol();
|
|
1192
1054
|
/**
|
|
1193
|
-
*
|
|
1194
|
-
*
|
|
1195
|
-
* **Details**
|
|
1055
|
+
* Constructs a {@link BigInt}.
|
|
1196
1056
|
*
|
|
1197
|
-
*
|
|
1198
|
-
* their decimal string representation.
|
|
1199
|
-
*
|
|
1200
|
-
* @see {@link bigInt}
|
|
1201
|
-
* @see {@link isBigInt}
|
|
1202
|
-
* @category models
|
|
1057
|
+
* @category constructors
|
|
1203
1058
|
* @since 4.0.0
|
|
1204
1059
|
*/
|
|
1205
|
-
export
|
|
1060
|
+
export const BigInt = class extends ASTNodeImpl {
|
|
1206
1061
|
_tag = "BigInt";
|
|
1207
1062
|
/** @internal */
|
|
1208
1063
|
getParser() {
|
|
@@ -1223,7 +1078,7 @@ export class BigInt extends Base {
|
|
|
1223
1078
|
getExpected() {
|
|
1224
1079
|
return "bigint";
|
|
1225
1080
|
}
|
|
1226
|
-
}
|
|
1081
|
+
};
|
|
1227
1082
|
/**
|
|
1228
1083
|
* Provides the singleton {@link BigInt} AST instance.
|
|
1229
1084
|
*
|
|
@@ -1240,48 +1095,12 @@ export class BigInt extends Base {
|
|
|
1240
1095
|
*/
|
|
1241
1096
|
export const bigInt = /*#__PURE__*/new BigInt();
|
|
1242
1097
|
/**
|
|
1243
|
-
*
|
|
1244
|
-
*
|
|
1245
|
-
* **When to use**
|
|
1098
|
+
* Constructs a {@link Arrays}.
|
|
1246
1099
|
*
|
|
1247
|
-
*
|
|
1248
|
-
* including rest elements.
|
|
1249
|
-
*
|
|
1250
|
-
* **Details**
|
|
1251
|
-
*
|
|
1252
|
-
* - `elements` — positional element types (tuple elements). An element is
|
|
1253
|
-
* optional if its {@link Context.isOptional} is `true`.
|
|
1254
|
-
* - `rest` — the rest/variadic element types. When non-empty, the first
|
|
1255
|
-
* entry is the "spread" type (e.g. `...Array<string>`), and subsequent
|
|
1256
|
-
* entries are trailing positional elements after the spread.
|
|
1257
|
-
* - `isMutable` — whether the resulting array is `readonly` (`false`) or
|
|
1258
|
-
* mutable (`true`).
|
|
1259
|
-
*
|
|
1260
|
-
* **Gotchas**
|
|
1261
|
-
*
|
|
1262
|
-
* Construction enforces TypeScript ordering rules: a required element
|
|
1263
|
-
* cannot follow an optional one, and an optional element cannot follow a
|
|
1264
|
-
* rest element.
|
|
1265
|
-
*
|
|
1266
|
-
* **Example** (Inspecting a tuple AST)
|
|
1267
|
-
*
|
|
1268
|
-
* ```ts import.meta.vitest
|
|
1269
|
-
* import { Schema, SchemaAST } from "effect"
|
|
1270
|
-
*
|
|
1271
|
-
* const schema = Schema.Tuple([Schema.String, Schema.Number])
|
|
1272
|
-
* const ast = schema.ast
|
|
1273
|
-
*
|
|
1274
|
-
* if (SchemaAST.isArrays(ast)) {
|
|
1275
|
-
* [ast.elements.length, ast.rest.length] // => [2, 0]
|
|
1276
|
-
* }
|
|
1277
|
-
* ```
|
|
1278
|
-
*
|
|
1279
|
-
* @see {@link isArrays}
|
|
1280
|
-
* @see {@link Objects}
|
|
1281
|
-
* @category models
|
|
1100
|
+
* @category constructors
|
|
1282
1101
|
* @since 4.0.0
|
|
1283
1102
|
*/
|
|
1284
|
-
export
|
|
1103
|
+
export const Arrays = class extends ASTNodeImpl {
|
|
1285
1104
|
_tag = "Arrays";
|
|
1286
1105
|
isMutable;
|
|
1287
1106
|
elements;
|
|
@@ -1356,10 +1175,11 @@ export class Arrays extends Base {
|
|
|
1356
1175
|
issues: undefined,
|
|
1357
1176
|
options
|
|
1358
1177
|
};
|
|
1359
|
-
const
|
|
1360
|
-
const
|
|
1361
|
-
|
|
1362
|
-
|
|
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
|
|
1363
1183
|
});
|
|
1364
1184
|
if (eff) yield* eff;
|
|
1365
1185
|
// ---------------------------------------------
|
|
@@ -1399,8 +1219,8 @@ export class Arrays extends Base {
|
|
|
1399
1219
|
getExpected() {
|
|
1400
1220
|
return "array";
|
|
1401
1221
|
}
|
|
1402
|
-
}
|
|
1403
|
-
const
|
|
1222
|
+
};
|
|
1223
|
+
const parseArrayOptions = {
|
|
1404
1224
|
onItem(s, item, i) {
|
|
1405
1225
|
const value = i < s.len ? item : InternalParser.missing;
|
|
1406
1226
|
return s.getParser(s.tailThreshold, i).parser(value, s.options);
|
|
@@ -1423,13 +1243,9 @@ const parseArray = /*#__PURE__*/iterateEager()({
|
|
|
1423
1243
|
}
|
|
1424
1244
|
}
|
|
1425
1245
|
}
|
|
1426
|
-
});
|
|
1427
|
-
const resolveConcurrency = value => {
|
|
1428
|
-
value = value === "unbounded" ? Infinity : value ?? 1;
|
|
1429
|
-
return value > 1 ? {
|
|
1430
|
-
concurrency: value
|
|
1431
|
-
} : undefined;
|
|
1432
1246
|
};
|
|
1247
|
+
const parseArray = /*#__PURE__*/iterateEager()(parseArrayOptions);
|
|
1248
|
+
const parseArrayConcurrent = /*#__PURE__*/iterateConcurrent()(parseArrayOptions);
|
|
1433
1249
|
const wrapPropertyKeyIssue = (s, ast, key, exit) => {
|
|
1434
1250
|
if (exit.cause.reasons.length === 0) {
|
|
1435
1251
|
return exit;
|
|
@@ -1475,26 +1291,19 @@ export function getIndexSignatureKeys(input, parameter, options = defaultParseOp
|
|
|
1475
1291
|
return go(parameterFromPropertyKey(toEncoded(parameter)));
|
|
1476
1292
|
}
|
|
1477
1293
|
/**
|
|
1478
|
-
*
|
|
1294
|
+
* Constructs a {@link PropertySignature}.
|
|
1479
1295
|
*
|
|
1480
|
-
*
|
|
1481
|
-
*
|
|
1482
|
-
* Pairs a `name` (any `PropertyKey`) with a `type` ({@link AST}). The
|
|
1483
|
-
* property's optionality and mutability are determined by the `type`'s
|
|
1484
|
-
* {@link Context}.
|
|
1485
|
-
*
|
|
1486
|
-
* @see {@link Objects}
|
|
1487
|
-
* @category models
|
|
1488
|
-
* @since 3.10.0
|
|
1296
|
+
* @category constructors
|
|
1297
|
+
* @since 4.0.0
|
|
1489
1298
|
*/
|
|
1490
|
-
export
|
|
1299
|
+
export const PropertySignature = class {
|
|
1491
1300
|
name;
|
|
1492
1301
|
type;
|
|
1493
1302
|
constructor(name, type) {
|
|
1494
1303
|
this.name = name;
|
|
1495
1304
|
this.type = type;
|
|
1496
1305
|
}
|
|
1497
|
-
}
|
|
1306
|
+
};
|
|
1498
1307
|
function isIndexSignatureParameterSide(ast) {
|
|
1499
1308
|
switch (ast._tag) {
|
|
1500
1309
|
case "String":
|
|
@@ -1512,30 +1321,12 @@ function isIndexSignatureParameter(ast) {
|
|
|
1512
1321
|
return isIndexSignatureParameterSide(ast) && isIndexSignatureParameterSide(toEncoded(ast));
|
|
1513
1322
|
}
|
|
1514
1323
|
/**
|
|
1515
|
-
*
|
|
1516
|
-
*
|
|
1517
|
-
* **When to use**
|
|
1518
|
-
*
|
|
1519
|
-
* Use when constructing or inspecting object AST entries for record-like keys
|
|
1520
|
-
* and values.
|
|
1521
|
-
*
|
|
1522
|
-
* **Details**
|
|
1523
|
-
*
|
|
1524
|
-
* - `parameter` — the key type AST (e.g. {@link String} for `string` keys,
|
|
1525
|
-
* {@link TemplateLiteral} for patterned keys).
|
|
1526
|
-
* - `type` — the value type SchemaAST.
|
|
1324
|
+
* Constructs a {@link IndexSignature}.
|
|
1527
1325
|
*
|
|
1528
|
-
*
|
|
1529
|
-
*
|
|
1530
|
-
* Using `Schema.optionalKey` on the value type is not allowed for index
|
|
1531
|
-
* signatures (throws at construction); use `Schema.optional` instead.
|
|
1532
|
-
*
|
|
1533
|
-
* @see {@link Objects}
|
|
1534
|
-
* @see {@link PropertySignature}
|
|
1535
|
-
* @category models
|
|
1536
|
-
* @since 3.10.0
|
|
1326
|
+
* @category constructors
|
|
1327
|
+
* @since 4.0.0
|
|
1537
1328
|
*/
|
|
1538
|
-
export
|
|
1329
|
+
export const IndexSignature = class {
|
|
1539
1330
|
parameter;
|
|
1540
1331
|
type;
|
|
1541
1332
|
constructor(parameter, type) {
|
|
@@ -1548,50 +1339,14 @@ export class IndexSignature {
|
|
|
1548
1339
|
throw new Error("Cannot use `Schema.optionalKey` with index signatures, use `Schema.optional` instead.");
|
|
1549
1340
|
}
|
|
1550
1341
|
}
|
|
1551
|
-
}
|
|
1342
|
+
};
|
|
1552
1343
|
/**
|
|
1553
|
-
*
|
|
1554
|
-
*
|
|
1555
|
-
* **When to use**
|
|
1556
|
-
*
|
|
1557
|
-
* Use when constructing or inspecting AST nodes for structs or records rather
|
|
1558
|
-
* than array-like schemas.
|
|
1559
|
-
*
|
|
1560
|
-
* **Details**
|
|
1561
|
-
*
|
|
1562
|
-
* - `propertySignatures` — named properties with their types (struct fields).
|
|
1563
|
-
* - `indexSignatures` — index signature entries (record patterns), each with
|
|
1564
|
-
* a `parameter` AST for matching keys and a `type` AST for values.
|
|
1565
|
-
*
|
|
1566
|
-
* An `Objects` node with no properties and no index signatures performs only a
|
|
1567
|
-
* non-nullish check: it accepts any value except `null` and `undefined`,
|
|
1568
|
-
* including primitive values.
|
|
1569
|
-
*
|
|
1570
|
-
* **Gotchas**
|
|
1571
|
-
*
|
|
1572
|
-
* Duplicate property names throw at construction time.
|
|
1573
|
-
*
|
|
1574
|
-
* **Example** (Inspecting a struct AST)
|
|
1575
|
-
*
|
|
1576
|
-
* ```ts import.meta.vitest
|
|
1577
|
-
* import { Schema, SchemaAST } from "effect"
|
|
1344
|
+
* Constructs a {@link Objects}.
|
|
1578
1345
|
*
|
|
1579
|
-
*
|
|
1580
|
-
* const ast = schema.ast
|
|
1581
|
-
*
|
|
1582
|
-
* if (SchemaAST.isObjects(ast)) {
|
|
1583
|
-
* ast.propertySignatures.map((ps) => [ps.name, ps.type._tag]) // => [["name", "String"]]
|
|
1584
|
-
* }
|
|
1585
|
-
* ```
|
|
1586
|
-
*
|
|
1587
|
-
* @see {@link isObjects}
|
|
1588
|
-
* @see {@link PropertySignature}
|
|
1589
|
-
* @see {@link IndexSignature}
|
|
1590
|
-
* @see {@link Arrays}
|
|
1591
|
-
* @category models
|
|
1346
|
+
* @category constructors
|
|
1592
1347
|
* @since 4.0.0
|
|
1593
1348
|
*/
|
|
1594
|
-
export
|
|
1349
|
+
export const Objects = class extends ASTNodeImpl {
|
|
1595
1350
|
_tag = "Objects";
|
|
1596
1351
|
propertySignatures;
|
|
1597
1352
|
indexSignatures;
|
|
@@ -1613,7 +1368,7 @@ export class Objects extends Base {
|
|
|
1613
1368
|
const ast = this;
|
|
1614
1369
|
const expectedKeys = [];
|
|
1615
1370
|
for (const ps of ast.propertySignatures) {
|
|
1616
|
-
expectedKeys.push(ps.name);
|
|
1371
|
+
expectedKeys.push(typeof ps.name === "number" ? globalThis.String(ps.name) : ps.name);
|
|
1617
1372
|
}
|
|
1618
1373
|
const hasProperties = expectedKeys.length;
|
|
1619
1374
|
const indexCount = ast.indexSignatures.length;
|
|
@@ -1632,7 +1387,7 @@ export class Objects extends Base {
|
|
|
1632
1387
|
}
|
|
1633
1388
|
const value = exitValue === InternalParser.sameExit ? inputValue : exitValue[InternalParser.args];
|
|
1634
1389
|
if (k2 !== InternalParser.missing && value !== InternalParser.missing) {
|
|
1635
|
-
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;
|
|
1636
1391
|
InternalRecord.assignProperty(s.out, k2, value);
|
|
1637
1392
|
}
|
|
1638
1393
|
return Exit.void;
|
|
@@ -1658,9 +1413,9 @@ export class Objects extends Base {
|
|
|
1658
1413
|
const result = index.parserValue(inputValue, s.options);
|
|
1659
1414
|
return effectIsExit(result) ? finishIndex(s, key, key, inputValue, result) : Effect.flatMap(Effect.exit(result), exit => finishIndex(s, key, key, inputValue, exit));
|
|
1660
1415
|
};
|
|
1661
|
-
const parseIndexes = indexCount ?
|
|
1662
|
-
onItem: (s, [key, index]) => parseIndex(s, key, index),
|
|
1663
|
-
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
|
|
1664
1419
|
}) : undefined;
|
|
1665
1420
|
const compileMembers = () => {
|
|
1666
1421
|
if (!properties) {
|
|
@@ -1697,54 +1452,56 @@ export class Objects extends Base {
|
|
|
1697
1452
|
};
|
|
1698
1453
|
const errorsAllOption = options.errors === "all";
|
|
1699
1454
|
const onExcessPropertyError = options.onExcessProperty === "error";
|
|
1700
|
-
const
|
|
1455
|
+
const concurrency = options.concurrency === undefined ? 1 : resolveConcurrency(options.concurrency);
|
|
1701
1456
|
// ---------------------------------------------
|
|
1702
1457
|
// handle excess properties
|
|
1703
1458
|
// ---------------------------------------------
|
|
1704
|
-
|
|
1705
|
-
if (
|
|
1459
|
+
const indexKeys = indexCount && onExcessPropertyError ? ast.indexSignatures.map(index => getIndexSignatureKeys(record, index.parameter, options)) : undefined;
|
|
1460
|
+
if (onExcessPropertyError) {
|
|
1706
1461
|
expectedKeysSet ??= new Set(expectedKeys);
|
|
1707
|
-
|
|
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);
|
|
1708
1469
|
for (let i = 0; i < inputKeys.length; i++) {
|
|
1709
1470
|
const key = inputKeys[i];
|
|
1710
|
-
if (!
|
|
1471
|
+
if (!coveredKeys.has(key)) {
|
|
1711
1472
|
// key is unexpected
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
if (
|
|
1716
|
-
|
|
1717
|
-
state.issues.push(issue);
|
|
1718
|
-
} else {
|
|
1719
|
-
state.issues = [issue];
|
|
1720
|
-
}
|
|
1721
|
-
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);
|
|
1722
1478
|
} else {
|
|
1723
|
-
|
|
1479
|
+
state.issues = [issue];
|
|
1724
1480
|
}
|
|
1481
|
+
continue;
|
|
1725
1482
|
} else {
|
|
1726
|
-
|
|
1727
|
-
InternalRecord.assignProperty(out, key, record[key]);
|
|
1483
|
+
return yield* Effect.fail(new SchemaIssue.Composite(ast, [issue], input, options));
|
|
1728
1484
|
}
|
|
1729
1485
|
}
|
|
1730
1486
|
}
|
|
1731
1487
|
}
|
|
1732
|
-
const concurrency = resolveConcurrency(options?.concurrency);
|
|
1733
1488
|
// ---------------------------------------------
|
|
1734
1489
|
// handle property signatures
|
|
1735
1490
|
// ---------------------------------------------
|
|
1736
1491
|
if (hasProperties) {
|
|
1737
|
-
const eff = parseProperties(state, properties,
|
|
1492
|
+
const eff = concurrency === 1 ? parseProperties(state, properties) : parsePropertiesConcurrent(state, properties, {
|
|
1493
|
+
concurrency
|
|
1494
|
+
});
|
|
1738
1495
|
if (eff) yield* eff;
|
|
1739
1496
|
}
|
|
1740
1497
|
// ---------------------------------------------
|
|
1741
1498
|
// handle index signatures
|
|
1742
1499
|
// ---------------------------------------------
|
|
1743
|
-
if (indexCount &&
|
|
1500
|
+
if (indexCount && concurrency === 1) {
|
|
1744
1501
|
for (let i = 0; i < indexCount; i++) {
|
|
1745
1502
|
const index = indexes[i];
|
|
1746
1503
|
const parse = index.is.parameter === string ? parseStringIndex : parseIndex;
|
|
1747
|
-
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));
|
|
1748
1505
|
for (let j = 0; j < keys.length; j++) {
|
|
1749
1506
|
const eff = parse(state, keys[j], index);
|
|
1750
1507
|
if (!effectIsExit(eff)) yield* eff;else if (eff._tag === "Failure") return yield* eff;
|
|
@@ -1754,28 +1511,19 @@ export class Objects extends Base {
|
|
|
1754
1511
|
const keyPairs = Arr.empty();
|
|
1755
1512
|
for (let i = 0; i < indexCount; i++) {
|
|
1756
1513
|
const index = indexes[i];
|
|
1757
|
-
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));
|
|
1758
1515
|
for (let j = 0; j < keys.length; j++) {
|
|
1759
1516
|
keyPairs.push([keys[j], index]);
|
|
1760
1517
|
}
|
|
1761
1518
|
}
|
|
1762
|
-
const eff = parseIndexes(state, keyPairs,
|
|
1519
|
+
const eff = parseIndexes(state, keyPairs, {
|
|
1520
|
+
concurrency
|
|
1521
|
+
});
|
|
1763
1522
|
if (eff) yield* eff;
|
|
1764
1523
|
}
|
|
1765
1524
|
if (state.issues) {
|
|
1766
1525
|
return yield* Effect.fail(new SchemaIssue.Composite(ast, state.issues, input, options));
|
|
1767
1526
|
}
|
|
1768
|
-
if (options.propertyOrder === "original") {
|
|
1769
|
-
// preserve input keys order
|
|
1770
|
-
const keys = (inputKeys ?? Reflect.ownKeys(record)).concat(expectedKeys);
|
|
1771
|
-
const preserved = {};
|
|
1772
|
-
for (const key of keys) {
|
|
1773
|
-
if (Object.hasOwn(out, key)) {
|
|
1774
|
-
InternalRecord.assignProperty(preserved, key, out[key]);
|
|
1775
|
-
}
|
|
1776
|
-
}
|
|
1777
|
-
return preserved;
|
|
1778
|
-
}
|
|
1779
1527
|
return out;
|
|
1780
1528
|
});
|
|
1781
1529
|
if (indexCount) return fallback;
|
|
@@ -1795,7 +1543,7 @@ export class Objects extends Base {
|
|
|
1795
1543
|
// options, needs none of the generator the fallback runs per value.
|
|
1796
1544
|
return (input, options) => {
|
|
1797
1545
|
if (input === InternalParser.missing) return InternalParser.missingExit;
|
|
1798
|
-
if (options.errors === "all" || options.onExcessProperty !== undefined || options.
|
|
1546
|
+
if (options.errors === "all" || options.onExcessProperty !== undefined || options.concurrency !== undefined && resolveConcurrency(options.concurrency) !== 1) {
|
|
1799
1547
|
return fallback(input, options);
|
|
1800
1548
|
}
|
|
1801
1549
|
if (!(typeof input === "object" && input !== null && !Array.isArray(input))) {
|
|
@@ -1815,7 +1563,7 @@ export class Objects extends Base {
|
|
|
1815
1563
|
for (let index = 0; index < props.length; index++) {
|
|
1816
1564
|
const property = props[index];
|
|
1817
1565
|
const name = property.name;
|
|
1818
|
-
const hasKey =
|
|
1566
|
+
const hasKey = hasPropertySignature(record, name);
|
|
1819
1567
|
const value = hasKey ? record[name] : InternalParser.missing;
|
|
1820
1568
|
const exit = property.parser(value, options);
|
|
1821
1569
|
if (!effectIsExit(exit)) {
|
|
@@ -1860,7 +1608,7 @@ export class Objects extends Base {
|
|
|
1860
1608
|
if (this.propertySignatures.length === 0 && this.indexSignatures.length === 0) return "object | array";
|
|
1861
1609
|
return "object";
|
|
1862
1610
|
}
|
|
1863
|
-
}
|
|
1611
|
+
};
|
|
1864
1612
|
function stepProperty(s, p, exit) {
|
|
1865
1613
|
if (exit._tag === "Failure") {
|
|
1866
1614
|
return wrapPropertyKeyIssue(s, s.ast, p.name, exit);
|
|
@@ -1882,9 +1630,9 @@ function stepProperty(s, p, exit) {
|
|
|
1882
1630
|
}
|
|
1883
1631
|
}
|
|
1884
1632
|
}
|
|
1885
|
-
const
|
|
1633
|
+
const parsePropertiesOptions = {
|
|
1886
1634
|
onItem(s, p) {
|
|
1887
|
-
if (!
|
|
1635
|
+
if (!hasPropertySignature(s.input, p.name)) {
|
|
1888
1636
|
return p.parser(InternalParser.missing, s.options);
|
|
1889
1637
|
}
|
|
1890
1638
|
const value = s.input[p.name];
|
|
@@ -1892,7 +1640,9 @@ const parseProperties = /*#__PURE__*/iterateEager()({
|
|
|
1892
1640
|
return p.parser(value, s.options);
|
|
1893
1641
|
},
|
|
1894
1642
|
step: stepProperty
|
|
1895
|
-
}
|
|
1643
|
+
};
|
|
1644
|
+
const parseProperties = /*#__PURE__*/iterateEager()(parsePropertiesOptions);
|
|
1645
|
+
const parsePropertiesConcurrent = /*#__PURE__*/iterateConcurrent()(parsePropertiesOptions);
|
|
1896
1646
|
function combineChecks(a, b) {
|
|
1897
1647
|
if (!a) return b;
|
|
1898
1648
|
if (!b) return a;
|
|
@@ -1913,8 +1663,8 @@ export function tuple(elements, checks = undefined) {
|
|
|
1913
1663
|
return new Arrays(false, elements.map(e => e.ast), [], undefined, checks);
|
|
1914
1664
|
}
|
|
1915
1665
|
/** @internal */
|
|
1916
|
-
export function union(members,
|
|
1917
|
-
return new Union(members.map(getAST),
|
|
1666
|
+
export function union(members, options, checks) {
|
|
1667
|
+
return new Union(members.map(getAST), options, undefined, checks);
|
|
1918
1668
|
}
|
|
1919
1669
|
/** @internal */
|
|
1920
1670
|
export function structWithRest(ast, records) {
|
|
@@ -1938,6 +1688,13 @@ export function tupleWithRest(ast, rest) {
|
|
|
1938
1688
|
}
|
|
1939
1689
|
return new Arrays(ast.isMutable, ast.elements, rest, undefined, ast.checks);
|
|
1940
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
|
+
}
|
|
1941
1698
|
const toCandidate = /*#__PURE__*/memoizeIdempotent(ast => {
|
|
1942
1699
|
while (true) {
|
|
1943
1700
|
if (isSuspend(ast)) return unknown;
|
|
@@ -2043,6 +1800,7 @@ export function collectSentinels(ast) {
|
|
|
2043
1800
|
}
|
|
2044
1801
|
const candidateIndexCache = /*#__PURE__*/new WeakMap();
|
|
2045
1802
|
const emptyCandidates = /*#__PURE__*/Object.freeze([]);
|
|
1803
|
+
const hasPropertySignature = (input, key) => key === "__proto__" ? Object.hasOwn(input, key) : key in input;
|
|
2046
1804
|
function getIndex(types) {
|
|
2047
1805
|
let index = candidateIndexCache.get(types);
|
|
2048
1806
|
if (index) return index;
|
|
@@ -2100,7 +1858,7 @@ function getIndex(types) {
|
|
|
2100
1858
|
}
|
|
2101
1859
|
index = (input, isConstructor) => {
|
|
2102
1860
|
if (Predicate.isObjectKeyword(input)) {
|
|
2103
|
-
const value =
|
|
1861
|
+
const value = hasPropertySignature(input, key) ? input[key] : undefined;
|
|
2104
1862
|
if (value !== undefined) return candidates.get(value) ?? emptyCandidates;
|
|
2105
1863
|
if (isConstructor) return types;
|
|
2106
1864
|
}
|
|
@@ -2127,7 +1885,7 @@ function getIndex(types) {
|
|
|
2127
1885
|
// discriminated candidate.
|
|
2128
1886
|
if (commonSentinel) {
|
|
2129
1887
|
const [key, [byValue]] = commonSentinel;
|
|
2130
|
-
const hasKey =
|
|
1888
|
+
const hasKey = hasPropertySignature(input, key);
|
|
2131
1889
|
const value = hasKey ? input[key] : undefined;
|
|
2132
1890
|
if (hasKey && (!isConstructor || value !== undefined)) {
|
|
2133
1891
|
const match = byValue.get(value);
|
|
@@ -2140,7 +1898,7 @@ function getIndex(types) {
|
|
|
2140
1898
|
// absent and undefined keys as unconstrained and therefore selects every candidate that owns the key.
|
|
2141
1899
|
if (directKey === undefined) {
|
|
2142
1900
|
for (const [key, [byValue, all]] of bySentinel) {
|
|
2143
|
-
const hasKey =
|
|
1901
|
+
const hasKey = hasPropertySignature(input, key);
|
|
2144
1902
|
const value = hasKey ? input[key] : undefined;
|
|
2145
1903
|
if (hasKey && (!isConstructor || value !== undefined)) {
|
|
2146
1904
|
const match = byValue.get(value);
|
|
@@ -2155,7 +1913,7 @@ function getIndex(types) {
|
|
|
2155
1913
|
// Missing keys are neutral. An observed key rejects only selected candidates that own it and do not match.
|
|
2156
1914
|
for (const [key, [byValue, all]] of bySentinel) {
|
|
2157
1915
|
if (key === directKey) continue;
|
|
2158
|
-
const hasKey =
|
|
1916
|
+
const hasKey = hasPropertySignature(input, key);
|
|
2159
1917
|
const value = hasKey ? input[key] : undefined;
|
|
2160
1918
|
if (hasKey && (!isConstructor || value !== undefined)) {
|
|
2161
1919
|
const match = byValue.get(value);
|
|
@@ -2191,44 +1949,20 @@ export function getCandidates(input, types, isConstructor = false) {
|
|
|
2191
1949
|
return getIndex(types)(input, isConstructor);
|
|
2192
1950
|
}
|
|
2193
1951
|
/**
|
|
2194
|
-
*
|
|
2195
|
-
*
|
|
2196
|
-
* **Details**
|
|
2197
|
-
*
|
|
2198
|
-
* - `types` — the member AST nodes.
|
|
2199
|
-
* - `mode` — `"anyOf"` succeeds on the first match (like TypeScript unions);
|
|
2200
|
-
* `"oneOf"` requires exactly one member to match (fails if multiple do).
|
|
2201
|
-
*
|
|
2202
|
-
* During parsing, members are tried in order. An internal candidate index
|
|
2203
|
-
* narrows which members to try based on the runtime type of the input and
|
|
2204
|
-
* discriminant ("sentinel") fields, making large unions efficient.
|
|
2205
|
-
*
|
|
2206
|
-
* **Example** (Inspecting a union AST)
|
|
2207
|
-
*
|
|
2208
|
-
* ```ts import.meta.vitest
|
|
2209
|
-
* import { Schema, SchemaAST } from "effect"
|
|
1952
|
+
* Constructs a {@link Union}.
|
|
2210
1953
|
*
|
|
2211
|
-
*
|
|
2212
|
-
*
|
|
2213
|
-
*
|
|
2214
|
-
* if (SchemaAST.isUnion(ast)) {
|
|
2215
|
-
* [ast.types.length, ast.mode] // => [2, "anyOf"]
|
|
2216
|
-
* }
|
|
2217
|
-
* ```
|
|
2218
|
-
*
|
|
2219
|
-
* @see {@link isUnion}
|
|
2220
|
-
* @category models
|
|
2221
|
-
* @since 3.10.0
|
|
1954
|
+
* @category constructors
|
|
1955
|
+
* @since 4.0.0
|
|
2222
1956
|
*/
|
|
2223
|
-
export
|
|
1957
|
+
export const Union = class extends ASTNodeImpl {
|
|
2224
1958
|
_tag = "Union";
|
|
2225
1959
|
types;
|
|
2226
|
-
|
|
1960
|
+
options;
|
|
2227
1961
|
encodingChecks;
|
|
2228
|
-
constructor(types,
|
|
1962
|
+
constructor(types, options, annotations, checks, encoding, context, encodingChecks) {
|
|
2229
1963
|
super(annotations, checks, encoding, context);
|
|
2230
1964
|
this.types = types;
|
|
2231
|
-
this.
|
|
1965
|
+
this.options = options;
|
|
2232
1966
|
this.encodingChecks = encodingChecks;
|
|
2233
1967
|
}
|
|
2234
1968
|
/** @internal */
|
|
@@ -2240,6 +1974,9 @@ export class Union extends Base {
|
|
|
2240
1974
|
return InternalParser.missingExit;
|
|
2241
1975
|
}
|
|
2242
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
|
+
}
|
|
2243
1980
|
if (candidates.length === 1) {
|
|
2244
1981
|
const result = compile(candidates[0])(input, options);
|
|
2245
1982
|
if (result._tag === "Success") return result;
|
|
@@ -2250,15 +1987,11 @@ export class Union extends Base {
|
|
|
2250
1987
|
compile,
|
|
2251
1988
|
input,
|
|
2252
1989
|
out: undefined,
|
|
2253
|
-
successes: ast.mode === "oneOf" ? [] : undefined,
|
|
1990
|
+
successes: ast.options?.mode === "oneOf" ? [] : undefined,
|
|
2254
1991
|
issues: undefined,
|
|
2255
1992
|
options
|
|
2256
1993
|
};
|
|
2257
|
-
const
|
|
2258
|
-
const eff = parseUnion(state, candidates, concurrency ? {
|
|
2259
|
-
...concurrency,
|
|
2260
|
-
orderedStep: true
|
|
2261
|
-
} : undefined);
|
|
1994
|
+
const eff = parseUnion(state, candidates);
|
|
2262
1995
|
if (!eff) {
|
|
2263
1996
|
if (state.out) return state.out;
|
|
2264
1997
|
return Effect.fail(new SchemaIssue.AnyOf(ast, state.issues ?? [], input, options));
|
|
@@ -2272,7 +2005,7 @@ export class Union extends Base {
|
|
|
2272
2005
|
}
|
|
2273
2006
|
_rebuild(recur, checks, encodingChecks) {
|
|
2274
2007
|
const types = mapOrSame(this.types, recur);
|
|
2275
|
-
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);
|
|
2276
2009
|
}
|
|
2277
2010
|
/** @internal */
|
|
2278
2011
|
recur(recur) {
|
|
@@ -2319,7 +2052,7 @@ export class Union extends Base {
|
|
|
2319
2052
|
});
|
|
2320
2053
|
return Array.from(new Set(types)).join(" | ");
|
|
2321
2054
|
}
|
|
2322
|
-
}
|
|
2055
|
+
};
|
|
2323
2056
|
function failSingleUnionCandidate(ast, cause, input, options) {
|
|
2324
2057
|
const issue = InternalSchemaCause.getSchemaIssue(cause);
|
|
2325
2058
|
if (!issue) return Exit.failCause(cause);
|
|
@@ -2351,7 +2084,7 @@ const parseUnion = /*#__PURE__*/iterateEager()({
|
|
|
2351
2084
|
}
|
|
2352
2085
|
}
|
|
2353
2086
|
});
|
|
2354
|
-
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")]);
|
|
2355
2088
|
function formatIsMutable(isMutable) {
|
|
2356
2089
|
return isMutable ? "" : "readonly ";
|
|
2357
2090
|
}
|
|
@@ -2372,37 +2105,12 @@ export function memoizeThunk(f) {
|
|
|
2372
2105
|
};
|
|
2373
2106
|
}
|
|
2374
2107
|
/**
|
|
2375
|
-
*
|
|
2108
|
+
* Constructs a {@link Suspend}.
|
|
2376
2109
|
*
|
|
2377
|
-
*
|
|
2378
|
-
*
|
|
2379
|
-
* Wraps a thunk (`() => AST`) that is memoized on first call. Use this to
|
|
2380
|
-
* define recursive or mutually recursive schemas without infinite loops at
|
|
2381
|
-
* construction time.
|
|
2382
|
-
*
|
|
2383
|
-
* **Example** (Defining recursive schema ASTs)
|
|
2384
|
-
*
|
|
2385
|
-
* ```ts import.meta.vitest
|
|
2386
|
-
* import { Schema, SchemaAST } from "effect"
|
|
2387
|
-
*
|
|
2388
|
-
* interface Category {
|
|
2389
|
-
* readonly name: string
|
|
2390
|
-
* readonly children: ReadonlyArray<Category>
|
|
2391
|
-
* }
|
|
2392
|
-
*
|
|
2393
|
-
* const Category = Schema.Struct({
|
|
2394
|
-
* name: Schema.String,
|
|
2395
|
-
* children: Schema.Array(Schema.suspend((): Schema.Codec<Category> => Category))
|
|
2396
|
-
* })
|
|
2397
|
-
*
|
|
2398
|
-
* SchemaAST.isObjects(Category.ast) // => true
|
|
2399
|
-
* ```
|
|
2400
|
-
*
|
|
2401
|
-
* @see {@link isSuspend}
|
|
2402
|
-
* @category models
|
|
2403
|
-
* @since 3.10.0
|
|
2110
|
+
* @category constructors
|
|
2111
|
+
* @since 4.0.0
|
|
2404
2112
|
*/
|
|
2405
|
-
export
|
|
2113
|
+
export const Suspend = class extends ASTNodeImpl {
|
|
2406
2114
|
_tag = "Suspend";
|
|
2407
2115
|
thunk;
|
|
2408
2116
|
constructor(thunk, annotations, checks, encoding, context) {
|
|
@@ -2425,32 +2133,14 @@ export class Suspend extends Base {
|
|
|
2425
2133
|
getExpected(getExpected) {
|
|
2426
2134
|
return getExpected(this.thunk());
|
|
2427
2135
|
}
|
|
2428
|
-
}
|
|
2429
|
-
// -----------------------------------------------------------------------------
|
|
2430
|
-
// Checks
|
|
2431
|
-
// -----------------------------------------------------------------------------
|
|
2136
|
+
};
|
|
2432
2137
|
/**
|
|
2433
|
-
*
|
|
2434
|
-
*
|
|
2435
|
-
* **Details**
|
|
2138
|
+
* Constructs a {@link Filter}.
|
|
2436
2139
|
*
|
|
2437
|
-
*
|
|
2438
|
-
* `Issue` on failure.
|
|
2439
|
-
* - `annotations` — optional filter-level annotations (expected message,
|
|
2440
|
-
* representation, arbitrary constraint hints).
|
|
2441
|
-
* - `aborted` — when `true`, parsing stops immediately after this filter
|
|
2442
|
-
* fails (no further checks run).
|
|
2443
|
-
*
|
|
2444
|
-
* Use `.annotate()` to add metadata and `.abort()` to mark as aborting.
|
|
2445
|
-
* Combine with another check via `.and()` to form a {@link FilterGroup}.
|
|
2446
|
-
*
|
|
2447
|
-
* @see {@link FilterGroup}
|
|
2448
|
-
* @see {@link Check}
|
|
2449
|
-
* @see {@link isPattern}
|
|
2450
|
-
* @category models
|
|
2140
|
+
* @category constructors
|
|
2451
2141
|
* @since 4.0.0
|
|
2452
2142
|
*/
|
|
2453
|
-
export
|
|
2143
|
+
export const Filter = class extends Pipeable.Class {
|
|
2454
2144
|
_tag = "Filter";
|
|
2455
2145
|
run;
|
|
2456
2146
|
annotations;
|
|
@@ -2480,22 +2170,14 @@ export class Filter extends Pipeable.Class {
|
|
|
2480
2170
|
and(other, annotations) {
|
|
2481
2171
|
return new FilterGroup([this, other], annotations);
|
|
2482
2172
|
}
|
|
2483
|
-
}
|
|
2173
|
+
};
|
|
2484
2174
|
/**
|
|
2485
|
-
*
|
|
2175
|
+
* Constructs a {@link FilterGroup}.
|
|
2486
2176
|
*
|
|
2487
|
-
*
|
|
2488
|
-
*
|
|
2489
|
-
* Created by calling `.and()` on a {@link Filter} or another `FilterGroup`.
|
|
2490
|
-
* All inner checks are run; failures from aborted filters still stop
|
|
2491
|
-
* evaluation.
|
|
2492
|
-
*
|
|
2493
|
-
* @see {@link Filter}
|
|
2494
|
-
* @see {@link Check}
|
|
2495
|
-
* @category models
|
|
2177
|
+
* @category constructors
|
|
2496
2178
|
* @since 4.0.0
|
|
2497
2179
|
*/
|
|
2498
|
-
export
|
|
2180
|
+
export const FilterGroup = class extends Pipeable.Class {
|
|
2499
2181
|
_tag = "FilterGroup";
|
|
2500
2182
|
checks;
|
|
2501
2183
|
annotations;
|
|
@@ -2513,7 +2195,7 @@ export class FilterGroup extends Pipeable.Class {
|
|
|
2513
2195
|
and(other, annotations) {
|
|
2514
2196
|
return new FilterGroup([this, other], annotations);
|
|
2515
2197
|
}
|
|
2516
|
-
}
|
|
2198
|
+
};
|
|
2517
2199
|
/** @internal */
|
|
2518
2200
|
export function makeFilter(filter, annotations, aborted = false) {
|
|
2519
2201
|
return new Filter((input, ast, options) => SchemaIssue.normalizeFilterOutput(ast, filter(input, ast, options), input, options), annotations, aborted);
|
|
@@ -2537,18 +2219,15 @@ export function isFinite(annotations) {
|
|
|
2537
2219
|
toCode: () => ({
|
|
2538
2220
|
runtime: "Schema.isFinite()"
|
|
2539
2221
|
}),
|
|
2540
|
-
|
|
2541
|
-
|
|
2542
|
-
noInfinity: true,
|
|
2543
|
-
noNaN: true
|
|
2544
|
-
}
|
|
2222
|
+
arbitraryConstraint: {
|
|
2223
|
+
number: "finite"
|
|
2545
2224
|
},
|
|
2546
2225
|
...annotations
|
|
2547
2226
|
});
|
|
2548
2227
|
}
|
|
2549
2228
|
/** @internal */
|
|
2550
2229
|
export const finite = /*#__PURE__*/appendChecks(number, [/*#__PURE__*/isFinite()]);
|
|
2551
|
-
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))));
|
|
2552
2231
|
/**
|
|
2553
2232
|
* Creates a {@link Filter} that validates strings by running `RegExp.test`.
|
|
2554
2233
|
*
|
|
@@ -2568,8 +2247,12 @@ const numberToJson = /*#__PURE__*/new Link(/*#__PURE__*/new Union([finite, nonFi
|
|
|
2568
2247
|
*
|
|
2569
2248
|
* **Gotchas**
|
|
2570
2249
|
*
|
|
2571
|
-
*
|
|
2572
|
-
* 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.
|
|
2573
2256
|
*
|
|
2574
2257
|
* **Example** (Validating an email pattern)
|
|
2575
2258
|
*
|
|
@@ -2603,10 +2286,11 @@ export function isPattern(regExp, annotations) {
|
|
|
2603
2286
|
toJsonSchema: () => ({
|
|
2604
2287
|
pattern: source
|
|
2605
2288
|
}),
|
|
2606
|
-
|
|
2607
|
-
|
|
2608
|
-
|
|
2609
|
-
|
|
2289
|
+
arbitraryConstraint: {
|
|
2290
|
+
patterns: [{
|
|
2291
|
+
source: regExp.source,
|
|
2292
|
+
flags: regExp.flags
|
|
2293
|
+
}]
|
|
2610
2294
|
},
|
|
2611
2295
|
...annotations
|
|
2612
2296
|
});
|
|
@@ -2763,7 +2447,7 @@ export const optionalKey = /*#__PURE__*/memoizeIdempotent(ast => {
|
|
|
2763
2447
|
});
|
|
2764
2448
|
const optionalKeyLastLink = /*#__PURE__*/applyToLastLink(optionalKey);
|
|
2765
2449
|
/** @internal */
|
|
2766
|
-
export const optional = /*#__PURE__*/memoize(ast => optionalKey(new Union([ast, undefined_]
|
|
2450
|
+
export const optional = /*#__PURE__*/memoize(ast => optionalKey(new Union([ast, undefined_])));
|
|
2767
2451
|
/** @internal */
|
|
2768
2452
|
export const mutableKey = /*#__PURE__*/memoizeIdempotent(ast => {
|
|
2769
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);
|
|
@@ -2783,9 +2467,8 @@ export function withConstructorDefault(ast, defaultValue) {
|
|
|
2783
2467
|
*
|
|
2784
2468
|
* **Details**
|
|
2785
2469
|
*
|
|
2786
|
-
* This is the low-level primitive behind `Schema.
|
|
2787
|
-
*
|
|
2788
|
-
* 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.
|
|
2789
2472
|
*
|
|
2790
2473
|
* - Returns a new AST with the same type as `to`.
|
|
2791
2474
|
*
|
|
@@ -2847,7 +2530,7 @@ export function record(key, value) {
|
|
|
2847
2530
|
* Checks `ast.context?.isOptional`. Defaults to `false` when no
|
|
2848
2531
|
* {@link Context} is set.
|
|
2849
2532
|
*
|
|
2850
|
-
* @see
|
|
2533
|
+
* @see `Schema.optionalKey`
|
|
2851
2534
|
* @see {@link Context}
|
|
2852
2535
|
* @category predicates
|
|
2853
2536
|
* @since 4.0.0
|
|
@@ -2991,7 +2674,7 @@ export function containsUndefined(ast) {
|
|
|
2991
2674
|
}
|
|
2992
2675
|
}
|
|
2993
2676
|
function fromConst(ast, value) {
|
|
2994
|
-
const succeed = InternalParser.succeed(value);
|
|
2677
|
+
const succeed = value === 0 ? InternalParser.sameExit : InternalParser.succeed(value);
|
|
2995
2678
|
return (input, options) => {
|
|
2996
2679
|
if (input === InternalParser.missing) return InternalParser.missingExit;
|
|
2997
2680
|
if (input === value) return succeed;
|
|
@@ -3053,12 +2736,6 @@ function segmentTemplateLiteralParts(ast, input, options) {
|
|
|
3053
2736
|
}
|
|
3054
2737
|
return go(0, 0) ? out : undefined;
|
|
3055
2738
|
}
|
|
3056
|
-
/** @internal */
|
|
3057
|
-
export const enumsToLiterals = /*#__PURE__*/memoize(ast => {
|
|
3058
|
-
return new Union(ast.enums.map(e => new Literal(e[1], {
|
|
3059
|
-
title: e[0]
|
|
3060
|
-
})), "anyOf");
|
|
3061
|
-
});
|
|
3062
2739
|
const parameterFromPropertyKey = /*#__PURE__*/applyToSelfOrLastLinkEncodingIdempotent(ast => {
|
|
3063
2740
|
switch (ast._tag) {
|
|
3064
2741
|
default:
|
|
@@ -3116,7 +2793,7 @@ export function isStringFinite(annotations) {
|
|
|
3116
2793
|
}
|
|
3117
2794
|
const finiteString = /*#__PURE__*/appendChecks(string, [/*#__PURE__*/isStringFinite()]);
|
|
3118
2795
|
const finiteToString = /*#__PURE__*/new Link(finiteString, SchemaTransformation.numberFromString);
|
|
3119
|
-
const numberToString = /*#__PURE__*/new Link(/*#__PURE__*/new Union([finiteString, nonFiniteLiterals]
|
|
2796
|
+
const numberToString = /*#__PURE__*/new Link(/*#__PURE__*/new Union([finiteString, nonFiniteLiterals]), SchemaTransformation.numberFromString);
|
|
3120
2797
|
/**
|
|
3121
2798
|
* signed integer only (no leading "+" because TypeScript doesn't support it)
|
|
3122
2799
|
*/
|
|
@@ -3141,14 +2818,14 @@ export const bigIntString = /*#__PURE__*/appendChecks(string, [/*#__PURE__*/isSt
|
|
|
3141
2818
|
expected: "a string representing a bigint"
|
|
3142
2819
|
})]);
|
|
3143
2820
|
const bigIntToString = /*#__PURE__*/new Link(bigIntString, SchemaTransformation.bigintFromString);
|
|
3144
|
-
const REGEXP_PATTERN = "Symbol\\((
|
|
2821
|
+
const REGEXP_PATTERN = "Symbol\\(([\\s\\S]*)\\)";
|
|
3145
2822
|
const isStringSymbolRegExp = /*#__PURE__*/new globalThis.RegExp(`^${REGEXP_PATTERN}$`);
|
|
3146
2823
|
/** @internal */
|
|
3147
2824
|
export const symbolString = /*#__PURE__*/appendChecks(string, [/*#__PURE__*/isStringSymbol()]);
|
|
3148
2825
|
/**
|
|
3149
2826
|
* to distinguish between Symbol and String, we need to add a check to the string keyword
|
|
3150
2827
|
*/
|
|
3151
|
-
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) => {
|
|
3152
2829
|
const key = globalThis.Symbol.keyFor(sym);
|
|
3153
2830
|
if (key !== undefined) {
|
|
3154
2831
|
return Effect.succeed(globalThis.String(sym));
|
|
@@ -3217,7 +2894,7 @@ export function getConstructorDescriptor(ast) {
|
|
|
3217
2894
|
*
|
|
3218
2895
|
* If the node has {@link Checks}, returns annotations from the last check
|
|
3219
2896
|
* (which is where user-supplied annotations end up after `.pipe(Schema.annotations(...))`).
|
|
3220
|
-
* Otherwise returns `
|
|
2897
|
+
* Otherwise returns the node's `annotations` directly.
|
|
3221
2898
|
*
|
|
3222
2899
|
* **Example** (Reading annotations)
|
|
3223
2900
|
*
|
|
@@ -3364,8 +3041,7 @@ export const Json = /*#__PURE__*/new Declaration([], () => (input, ast, options)
|
|
|
3364
3041
|
},
|
|
3365
3042
|
expected: "JSON value",
|
|
3366
3043
|
toCodecJson: () => undefined,
|
|
3367
|
-
toCodecStringTree: () => unknownToStringTree
|
|
3368
|
-
toArbitrary: () => fc => fc.jsonValue()
|
|
3044
|
+
toCodecStringTree: () => unknownToStringTree
|
|
3369
3045
|
});
|
|
3370
3046
|
/** @internal */
|
|
3371
3047
|
export const MutableJson = /*#__PURE__*/annotate(Json, {
|
|
@@ -3377,7 +3053,7 @@ export const MutableJson = /*#__PURE__*/annotate(Json, {
|
|
|
3377
3053
|
/** @internal */
|
|
3378
3054
|
export const unknownToJson = /*#__PURE__*/new Link(Json, /*#__PURE__*/SchemaTransformation.passthrough());
|
|
3379
3055
|
/** @internal */
|
|
3380
|
-
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());
|
|
3381
3057
|
/**
|
|
3382
3058
|
* Returns true if the value is a StringTree value.
|
|
3383
3059
|
*
|