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
|
@@ -0,0 +1,956 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pure, platform-neutral values for MAC, IP, internet socket, and Unix path addresses.
|
|
3
|
+
*
|
|
4
|
+
* @since 4.0.0
|
|
5
|
+
*/
|
|
6
|
+
import * as Data from "../../Data.js";
|
|
7
|
+
import * as Equal from "../../Equal.js";
|
|
8
|
+
import { dual } from "../../Function.js";
|
|
9
|
+
import * as Hash from "../../Hash.js";
|
|
10
|
+
import { NodeInspectSymbol } from "../../Inspectable.js";
|
|
11
|
+
import * as Option from "../../Option.js";
|
|
12
|
+
import { hasProperty } from "../../Predicate.js";
|
|
13
|
+
import * as Result from "../../Result.js";
|
|
14
|
+
const TypeId = "~effect/net/NetAddress";
|
|
15
|
+
const getBytes = self => self.bytes;
|
|
16
|
+
/**
|
|
17
|
+
* A checked network-address operation failure retaining the address or supplied input.
|
|
18
|
+
*
|
|
19
|
+
* **Details**
|
|
20
|
+
*
|
|
21
|
+
* Address-based operations retain the address value. Parsing and numeric
|
|
22
|
+
* construction retain the supplied string or array. Composed operations forward
|
|
23
|
+
* errors from the failing operation unchanged. Failures from external operations
|
|
24
|
+
* retain the original exception in `cause` when available.
|
|
25
|
+
*
|
|
26
|
+
* @category errors
|
|
27
|
+
* @since 4.0.0
|
|
28
|
+
*/
|
|
29
|
+
export class NetAddressError extends /*#__PURE__*/Data.TaggedError("NetAddressError") {}
|
|
30
|
+
const isAddress = u => hasProperty(u, TypeId);
|
|
31
|
+
/**
|
|
32
|
+
* Returns `true` when a value is an IPv4 address.
|
|
33
|
+
*
|
|
34
|
+
* @category guards
|
|
35
|
+
* @since 4.0.0
|
|
36
|
+
*/
|
|
37
|
+
export const isIpv4Address = u => isAddress(u) && u._tag === "Ipv4Address";
|
|
38
|
+
/**
|
|
39
|
+
* Returns `true` when a value is an IPv6 address.
|
|
40
|
+
*
|
|
41
|
+
* @category guards
|
|
42
|
+
* @since 4.0.0
|
|
43
|
+
*/
|
|
44
|
+
export const isIpv6Address = u => isAddress(u) && u._tag === "Ipv6Address";
|
|
45
|
+
/**
|
|
46
|
+
* Returns `true` when a value is an IPv4 or IPv6 address.
|
|
47
|
+
*
|
|
48
|
+
* @category guards
|
|
49
|
+
* @since 4.0.0
|
|
50
|
+
*/
|
|
51
|
+
export const isIpAddress = u => isIpv4Address(u) || isIpv6Address(u);
|
|
52
|
+
/**
|
|
53
|
+
* Returns the bit width of an IP address.
|
|
54
|
+
*
|
|
55
|
+
* @category getters
|
|
56
|
+
* @since 4.0.0
|
|
57
|
+
*/
|
|
58
|
+
export const width = address => isIpv4Address(address) ? 32 : 128;
|
|
59
|
+
/**
|
|
60
|
+
* Returns `true` when a value is a MAC address.
|
|
61
|
+
*
|
|
62
|
+
* @category guards
|
|
63
|
+
* @since 4.0.0
|
|
64
|
+
*/
|
|
65
|
+
export const isMacAddress = u => isAddress(u) && u._tag === "MacAddress";
|
|
66
|
+
/**
|
|
67
|
+
* Returns `true` when a value is a resolved IPv4 internet address.
|
|
68
|
+
*
|
|
69
|
+
* @category guards
|
|
70
|
+
* @since 4.0.0
|
|
71
|
+
*/
|
|
72
|
+
export const isInetAddressV4 = u => isAddress(u) && u._tag === "InetAddressV4";
|
|
73
|
+
/**
|
|
74
|
+
* Returns `true` when a value is a resolved IPv6 internet address.
|
|
75
|
+
*
|
|
76
|
+
* @category guards
|
|
77
|
+
* @since 4.0.0
|
|
78
|
+
*/
|
|
79
|
+
export const isInetAddressV6 = u => isAddress(u) && u._tag === "InetAddressV6";
|
|
80
|
+
/**
|
|
81
|
+
* Returns `true` when a value is a resolved internet address.
|
|
82
|
+
*
|
|
83
|
+
* @category guards
|
|
84
|
+
* @since 4.0.0
|
|
85
|
+
*/
|
|
86
|
+
export const isInetAddress = u => isInetAddressV4(u) || isInetAddressV6(u);
|
|
87
|
+
/**
|
|
88
|
+
* Returns `true` when a value is a Unix-domain filesystem address.
|
|
89
|
+
*
|
|
90
|
+
* @category guards
|
|
91
|
+
* @since 4.0.0
|
|
92
|
+
*/
|
|
93
|
+
export const isUnixPathAddress = u => isAddress(u) && u._tag === "UnixPathAddress";
|
|
94
|
+
/**
|
|
95
|
+
* Returns `true` when a value is a portable concrete socket address.
|
|
96
|
+
*
|
|
97
|
+
* @category guards
|
|
98
|
+
* @since 4.0.0
|
|
99
|
+
*/
|
|
100
|
+
export const isSocketAddress = u => isInetAddress(u) || isUnixPathAddress(u);
|
|
101
|
+
const Ipv4Proto = {
|
|
102
|
+
_tag: "Ipv4Address",
|
|
103
|
+
[TypeId]: TypeId,
|
|
104
|
+
[Equal.symbol](that) {
|
|
105
|
+
return isIpv4Address(that) && bytesEqual(getBytes(this), getBytes(that));
|
|
106
|
+
},
|
|
107
|
+
[Hash.symbol]() {
|
|
108
|
+
return hashBytes("Ipv4Address", getBytes(this));
|
|
109
|
+
},
|
|
110
|
+
toString() {
|
|
111
|
+
return formatIp(this);
|
|
112
|
+
},
|
|
113
|
+
toJSON() {
|
|
114
|
+
return this.toString();
|
|
115
|
+
},
|
|
116
|
+
[NodeInspectSymbol]() {
|
|
117
|
+
return this.toJSON();
|
|
118
|
+
}
|
|
119
|
+
};
|
|
120
|
+
const Ipv6Proto = {
|
|
121
|
+
_tag: "Ipv6Address",
|
|
122
|
+
[TypeId]: TypeId,
|
|
123
|
+
[Equal.symbol](that) {
|
|
124
|
+
return isIpv6Address(that) && bytesEqual(getBytes(this), getBytes(that));
|
|
125
|
+
},
|
|
126
|
+
[Hash.symbol]() {
|
|
127
|
+
return hashBytes("Ipv6Address", getBytes(this));
|
|
128
|
+
},
|
|
129
|
+
toString() {
|
|
130
|
+
return formatIp(this);
|
|
131
|
+
},
|
|
132
|
+
toJSON() {
|
|
133
|
+
return this.toString();
|
|
134
|
+
},
|
|
135
|
+
[NodeInspectSymbol]() {
|
|
136
|
+
return this.toJSON();
|
|
137
|
+
}
|
|
138
|
+
};
|
|
139
|
+
const MacProto = {
|
|
140
|
+
_tag: "MacAddress",
|
|
141
|
+
[TypeId]: TypeId,
|
|
142
|
+
[Equal.symbol](that) {
|
|
143
|
+
return isMacAddress(that) && bytesEqual(getBytes(this), getBytes(that));
|
|
144
|
+
},
|
|
145
|
+
[Hash.symbol]() {
|
|
146
|
+
return hashBytes("MacAddress", getBytes(this));
|
|
147
|
+
},
|
|
148
|
+
toString() {
|
|
149
|
+
return formatMacAddress(this);
|
|
150
|
+
},
|
|
151
|
+
toJSON() {
|
|
152
|
+
return this.toString();
|
|
153
|
+
},
|
|
154
|
+
[NodeInspectSymbol]() {
|
|
155
|
+
return this.toJSON();
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
const bytesEqual = (self, that) => {
|
|
159
|
+
if (self.length !== that.length) return false;
|
|
160
|
+
for (let index = 0; index < self.length; index++) {
|
|
161
|
+
if (self[index] !== that[index]) return false;
|
|
162
|
+
}
|
|
163
|
+
return true;
|
|
164
|
+
};
|
|
165
|
+
const hashBytes = (tag, bytes) => {
|
|
166
|
+
return Hash.combine(Hash.string(tag), Hash.array(bytes));
|
|
167
|
+
};
|
|
168
|
+
const makeIpv4 = bytes => {
|
|
169
|
+
const self = Object.assign(Object.create(Ipv4Proto), {
|
|
170
|
+
bytes: new Uint8Array(bytes)
|
|
171
|
+
});
|
|
172
|
+
return Object.freeze(self);
|
|
173
|
+
};
|
|
174
|
+
const makeIpv6 = bytes => {
|
|
175
|
+
const self = Object.assign(Object.create(Ipv6Proto), {
|
|
176
|
+
bytes: new Uint8Array(bytes)
|
|
177
|
+
});
|
|
178
|
+
return Object.freeze(self);
|
|
179
|
+
};
|
|
180
|
+
const makeMac = bytes => {
|
|
181
|
+
const self = Object.assign(Object.create(MacProto), {
|
|
182
|
+
bytes: new Uint8Array(bytes)
|
|
183
|
+
});
|
|
184
|
+
return Object.freeze(self);
|
|
185
|
+
};
|
|
186
|
+
/**
|
|
187
|
+
* Creates an IPv4 address from trusted network-order bytes without validation.
|
|
188
|
+
*
|
|
189
|
+
* @category unsafe
|
|
190
|
+
* @since 4.0.0
|
|
191
|
+
*/
|
|
192
|
+
export const ipv4FromBytesUnsafe = bytes => makeIpv4(bytes);
|
|
193
|
+
/**
|
|
194
|
+
* Creates an IPv6 address from trusted network-order bytes without validation.
|
|
195
|
+
*
|
|
196
|
+
* @category unsafe
|
|
197
|
+
* @since 4.0.0
|
|
198
|
+
*/
|
|
199
|
+
export const ipv6FromBytesUnsafe = bytes => makeIpv6(bytes);
|
|
200
|
+
/**
|
|
201
|
+
* The IPv4 loopback address `127.0.0.1`.
|
|
202
|
+
*
|
|
203
|
+
* @category constants
|
|
204
|
+
* @since 4.0.0
|
|
205
|
+
*/
|
|
206
|
+
export const ipv4Loopback = /*#__PURE__*/makeIpv4(/*#__PURE__*/new Uint8Array([127, 0, 0, 1]));
|
|
207
|
+
/**
|
|
208
|
+
* The IPv6 loopback address `::1`.
|
|
209
|
+
*
|
|
210
|
+
* @category constants
|
|
211
|
+
* @since 4.0.0
|
|
212
|
+
*/
|
|
213
|
+
export const ipv6Loopback = /*#__PURE__*/makeIpv6(/*#__PURE__*/new Uint8Array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]));
|
|
214
|
+
/**
|
|
215
|
+
* The unspecified IPv4 address `0.0.0.0`.
|
|
216
|
+
*
|
|
217
|
+
* @category constants
|
|
218
|
+
* @since 4.0.0
|
|
219
|
+
*/
|
|
220
|
+
export const ipv4Unspecified = /*#__PURE__*/makeIpv4(/*#__PURE__*/new Uint8Array(4));
|
|
221
|
+
/**
|
|
222
|
+
* The unspecified IPv6 address `::`.
|
|
223
|
+
*
|
|
224
|
+
* @category constants
|
|
225
|
+
* @since 4.0.0
|
|
226
|
+
*/
|
|
227
|
+
export const ipv6Unspecified = /*#__PURE__*/makeIpv6(/*#__PURE__*/new Uint8Array(16));
|
|
228
|
+
/**
|
|
229
|
+
* The IPv4 broadcast address `255.255.255.255`.
|
|
230
|
+
*
|
|
231
|
+
* @category constants
|
|
232
|
+
* @since 4.0.0
|
|
233
|
+
*/
|
|
234
|
+
export const ipv4Broadcast = /*#__PURE__*/makeIpv4(/*#__PURE__*/new Uint8Array([255, 255, 255, 255]));
|
|
235
|
+
const addressError = (input, message) => Result.fail(new NetAddressError({
|
|
236
|
+
input,
|
|
237
|
+
message
|
|
238
|
+
}));
|
|
239
|
+
/**
|
|
240
|
+
* Creates an IPv4 address from four checked octets.
|
|
241
|
+
*
|
|
242
|
+
* @category constructors
|
|
243
|
+
* @since 4.0.0
|
|
244
|
+
*/
|
|
245
|
+
export const ipv4FromOctets = octets => {
|
|
246
|
+
if (!octets.every(n => Number.isInteger(n) && n >= 0 && n <= 255)) {
|
|
247
|
+
return addressError(octets, "octets must be integers from 0 through 255");
|
|
248
|
+
}
|
|
249
|
+
return Result.succeed(makeIpv4(new Uint8Array(octets)));
|
|
250
|
+
};
|
|
251
|
+
/**
|
|
252
|
+
* Creates an IPv6 address from eight checked 16-bit segments.
|
|
253
|
+
*
|
|
254
|
+
* @category constructors
|
|
255
|
+
* @since 4.0.0
|
|
256
|
+
*/
|
|
257
|
+
export const ipv6FromSegments = segments => {
|
|
258
|
+
if (!segments.every(n => Number.isInteger(n) && n >= 0 && n <= 0xffff)) {
|
|
259
|
+
return addressError(segments, "segments must be integers from 0 through 65535");
|
|
260
|
+
}
|
|
261
|
+
const bytes = new Uint8Array(16);
|
|
262
|
+
for (let index = 0; index < 8; index++) {
|
|
263
|
+
bytes[index * 2] = segments[index] >> 8;
|
|
264
|
+
bytes[index * 2 + 1] = segments[index];
|
|
265
|
+
}
|
|
266
|
+
return Result.succeed(makeIpv6(bytes));
|
|
267
|
+
};
|
|
268
|
+
/**
|
|
269
|
+
* Creates a MAC address from six checked octets.
|
|
270
|
+
*
|
|
271
|
+
* @category constructors
|
|
272
|
+
* @since 4.0.0
|
|
273
|
+
*/
|
|
274
|
+
export const macAddressFromOctets = octets => {
|
|
275
|
+
if (!octets.every(n => Number.isInteger(n) && n >= 0 && n <= 255)) {
|
|
276
|
+
return addressError(octets, "octets must be integers from 0 through 255");
|
|
277
|
+
}
|
|
278
|
+
return Result.succeed(makeMac(new Uint8Array(octets)));
|
|
279
|
+
};
|
|
280
|
+
/**
|
|
281
|
+
* Parses a colon-separated MAC address containing six two-digit hexadecimal octets.
|
|
282
|
+
*
|
|
283
|
+
* @category decoding
|
|
284
|
+
* @since 4.0.0
|
|
285
|
+
*/
|
|
286
|
+
export const macAddressFromString = input => {
|
|
287
|
+
if (!/^(?:[0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$/.test(input)) {
|
|
288
|
+
return addressError(input, "expected six two-digit hexadecimal octets separated by colons");
|
|
289
|
+
}
|
|
290
|
+
return Result.succeed(makeMac(new Uint8Array(input.split(":").map(part => Number.parseInt(part, 16)))));
|
|
291
|
+
};
|
|
292
|
+
/**
|
|
293
|
+
* Parses a trusted colon-separated MAC address, throwing on failure.
|
|
294
|
+
*
|
|
295
|
+
* @category unsafe
|
|
296
|
+
* @since 4.0.0
|
|
297
|
+
*/
|
|
298
|
+
export const macAddressFromStringUnsafe = input => Result.getOrThrow(macAddressFromString(input));
|
|
299
|
+
/**
|
|
300
|
+
* Parses a strict dotted-decimal IPv4 address.
|
|
301
|
+
*
|
|
302
|
+
* **Details**
|
|
303
|
+
*
|
|
304
|
+
* Multi-digit octets with a leading zero are rejected to avoid octal ambiguity.
|
|
305
|
+
*
|
|
306
|
+
* @category decoding
|
|
307
|
+
* @since 4.0.0
|
|
308
|
+
*/
|
|
309
|
+
export const ipv4FromString = input => {
|
|
310
|
+
const parts = input.split(".");
|
|
311
|
+
if (parts.length !== 4 || parts.some(part => !/^\d{1,3}$/.test(part))) {
|
|
312
|
+
return addressError(input, "expected exactly four decimal octets");
|
|
313
|
+
}
|
|
314
|
+
if (parts.some(part => part.length > 1 && part[0] === "0")) {
|
|
315
|
+
return addressError(input, "leading zeroes are not allowed");
|
|
316
|
+
}
|
|
317
|
+
const octets = parts.map(Number);
|
|
318
|
+
if (octets.some(part => part > 255)) {
|
|
319
|
+
return addressError(input, "octets must be at most 255");
|
|
320
|
+
}
|
|
321
|
+
return ipv4FromOctets([octets[0], octets[1], octets[2], octets[3]]);
|
|
322
|
+
};
|
|
323
|
+
const parseIpv6Segments = input => {
|
|
324
|
+
if (input.includes("[") || input.includes("]") || input.includes("%")) {
|
|
325
|
+
return addressError(input, "brackets and zone identifiers are not valid in a bare IPv6 address");
|
|
326
|
+
}
|
|
327
|
+
const halves = input.split("::");
|
|
328
|
+
if (halves.length > 2) return addressError(input, "only one compression marker is allowed");
|
|
329
|
+
const head = halves[0] === "" ? [] : halves[0].split(":");
|
|
330
|
+
const tail = halves.length === 2 && halves[1] !== "" ? halves[1].split(":") : [];
|
|
331
|
+
if (head.some(part => part === "") || tail.some(part => part === "")) {
|
|
332
|
+
return addressError(input, "empty segments are only valid in the compression marker");
|
|
333
|
+
}
|
|
334
|
+
const trailing = tail.length > 0 ? tail[tail.length - 1] : head.length > 0 ? head[head.length - 1] : "";
|
|
335
|
+
let embedded;
|
|
336
|
+
if (trailing.includes(".")) {
|
|
337
|
+
if (halves.length === 2 && tail.length === 0) {
|
|
338
|
+
return addressError(input, "embedded IPv4 syntax must be trailing");
|
|
339
|
+
}
|
|
340
|
+
const parsed = Result.map(ipv4FromString(trailing), address => {
|
|
341
|
+
const octets = ipv4ToOctets(address);
|
|
342
|
+
return [octets[0] * 256 + octets[1], octets[2] * 256 + octets[3]];
|
|
343
|
+
});
|
|
344
|
+
if (Result.isFailure(parsed)) return parsed;
|
|
345
|
+
embedded = parsed.success;
|
|
346
|
+
if (tail.length > 0) tail.pop();else head.pop();
|
|
347
|
+
}
|
|
348
|
+
const explicit = head.length + tail.length + (embedded ? 2 : 0);
|
|
349
|
+
if (halves.length === 1 ? explicit !== 8 : explicit >= 8) {
|
|
350
|
+
return addressError(input, halves.length === 1 ? "expected eight segments" : "compression must replace at least one segment");
|
|
351
|
+
}
|
|
352
|
+
const parse = part => /^[0-9a-fA-F]{1,4}$/.test(part) ? Number.parseInt(part, 16) : undefined;
|
|
353
|
+
const parsedHead = head.map(parse);
|
|
354
|
+
const parsedTail = tail.map(parse);
|
|
355
|
+
if (parsedHead.some(part => part === undefined) || parsedTail.some(part => part === undefined)) {
|
|
356
|
+
return addressError(input, "segments must contain one through four hexadecimal digits");
|
|
357
|
+
}
|
|
358
|
+
return Result.succeed([...parsedHead, ...Array(8 - explicit).fill(0), ...parsedTail, ...(embedded ?? [])]);
|
|
359
|
+
};
|
|
360
|
+
/**
|
|
361
|
+
* Parses an IPv6 address with optional compression and trailing embedded IPv4.
|
|
362
|
+
*
|
|
363
|
+
* @category decoding
|
|
364
|
+
* @since 4.0.0
|
|
365
|
+
*/
|
|
366
|
+
export const ipv6FromString = input => {
|
|
367
|
+
return Result.flatMap(parseIpv6Segments(input), segments => ipv6FromSegments(segments));
|
|
368
|
+
};
|
|
369
|
+
/**
|
|
370
|
+
* Parses a bare numeric IPv4 or IPv6 address.
|
|
371
|
+
*
|
|
372
|
+
* @category decoding
|
|
373
|
+
* @since 4.0.0
|
|
374
|
+
*/
|
|
375
|
+
export const ipFromString = input => {
|
|
376
|
+
const result = input.includes(":") ? ipv6FromString(input) : ipv4FromString(input);
|
|
377
|
+
return result;
|
|
378
|
+
};
|
|
379
|
+
/**
|
|
380
|
+
* Parses a trusted bare numeric IPv4 or IPv6 address, throwing on failure.
|
|
381
|
+
*
|
|
382
|
+
* @category unsafe
|
|
383
|
+
* @since 4.0.0
|
|
384
|
+
*/
|
|
385
|
+
export const ipFromStringUnsafe = input => Result.getOrThrow(ipFromString(input));
|
|
386
|
+
/**
|
|
387
|
+
* Returns the four numeric octets of an IPv4 address in a fresh tuple.
|
|
388
|
+
*
|
|
389
|
+
* @category getters
|
|
390
|
+
* @since 4.0.0
|
|
391
|
+
*/
|
|
392
|
+
export const ipv4ToOctets = self => {
|
|
393
|
+
const bytes = getBytes(self);
|
|
394
|
+
return [bytes[0], bytes[1], bytes[2], bytes[3]];
|
|
395
|
+
};
|
|
396
|
+
/**
|
|
397
|
+
* Returns the eight numeric segments of an IPv6 address in a fresh tuple.
|
|
398
|
+
*
|
|
399
|
+
* @category getters
|
|
400
|
+
* @since 4.0.0
|
|
401
|
+
*/
|
|
402
|
+
export const ipv6ToSegments = self => {
|
|
403
|
+
const bytes = getBytes(self);
|
|
404
|
+
const output = Array(8);
|
|
405
|
+
for (let index = 0; index < 8; index++) {
|
|
406
|
+
output[index] = bytes[index * 2] * 256 + bytes[index * 2 + 1];
|
|
407
|
+
}
|
|
408
|
+
return output;
|
|
409
|
+
};
|
|
410
|
+
/**
|
|
411
|
+
* Returns the sixteen numeric octets of an IPv6 address in a fresh array.
|
|
412
|
+
*
|
|
413
|
+
* @category getters
|
|
414
|
+
* @since 4.0.0
|
|
415
|
+
*/
|
|
416
|
+
export const ipv6ToOctets = self => Array.from(getBytes(self));
|
|
417
|
+
/**
|
|
418
|
+
* Returns the six numeric octets of a MAC address in a fresh tuple.
|
|
419
|
+
*
|
|
420
|
+
* @category getters
|
|
421
|
+
* @since 4.0.0
|
|
422
|
+
*/
|
|
423
|
+
export const macAddressToOctets = self => {
|
|
424
|
+
const bytes = getBytes(self);
|
|
425
|
+
return [bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5]];
|
|
426
|
+
};
|
|
427
|
+
/**
|
|
428
|
+
* Formats a MAC address as six lowercase hexadecimal octets separated by colons.
|
|
429
|
+
*
|
|
430
|
+
* @category encoding
|
|
431
|
+
* @since 4.0.0
|
|
432
|
+
*/
|
|
433
|
+
export const formatMacAddress = self => Array.from(getBytes(self), byte => byte.toString(16).padStart(2, "0")).join(":");
|
|
434
|
+
/**
|
|
435
|
+
* Returns `true` when the MAC address is the all-ones broadcast address.
|
|
436
|
+
*
|
|
437
|
+
* @category predicates
|
|
438
|
+
* @since 4.0.0
|
|
439
|
+
*/
|
|
440
|
+
export const isMacBroadcast = self => getBytes(self).every(byte => byte === 0xff);
|
|
441
|
+
/**
|
|
442
|
+
* Returns `true` when the MAC address has the IEEE group-address bit set.
|
|
443
|
+
*
|
|
444
|
+
* @category predicates
|
|
445
|
+
* @since 4.0.0
|
|
446
|
+
*/
|
|
447
|
+
export const isMacMulticast = self => (getBytes(self)[0] & 1) !== 0;
|
|
448
|
+
/**
|
|
449
|
+
* Returns `true` when the MAC address has the IEEE group-address bit clear.
|
|
450
|
+
*
|
|
451
|
+
* @category predicates
|
|
452
|
+
* @since 4.0.0
|
|
453
|
+
*/
|
|
454
|
+
export const isMacUnicast = self => (getBytes(self)[0] & 1) === 0;
|
|
455
|
+
/**
|
|
456
|
+
* Returns `true` when the MAC address has the IEEE local-administration bit set.
|
|
457
|
+
*
|
|
458
|
+
* @category predicates
|
|
459
|
+
* @since 4.0.0
|
|
460
|
+
*/
|
|
461
|
+
export const isMacLocallyAdministered = self => (getBytes(self)[0] & 2) !== 0;
|
|
462
|
+
/**
|
|
463
|
+
* Returns `true` when the MAC address has the IEEE local-administration bit clear.
|
|
464
|
+
*
|
|
465
|
+
* @category predicates
|
|
466
|
+
* @since 4.0.0
|
|
467
|
+
*/
|
|
468
|
+
export const isMacUniversallyAdministered = self => (getBytes(self)[0] & 2) === 0;
|
|
469
|
+
/**
|
|
470
|
+
* Folds an IP address by its numeric version.
|
|
471
|
+
*
|
|
472
|
+
* @category pattern matching
|
|
473
|
+
* @since 4.0.0
|
|
474
|
+
*/
|
|
475
|
+
export const match = /*#__PURE__*/dual(2, (self, options) => isIpv4Address(self) ? options.onIpv4(self) : options.onIpv6(self));
|
|
476
|
+
/**
|
|
477
|
+
* Formats an IP address in canonical numeric form.
|
|
478
|
+
*
|
|
479
|
+
* @category encoding
|
|
480
|
+
* @since 4.0.0
|
|
481
|
+
*/
|
|
482
|
+
export const formatIp = self => {
|
|
483
|
+
if (isIpv4Address(self)) return ipv4ToOctets(self).join(".");
|
|
484
|
+
const segments = ipv6ToSegments(self);
|
|
485
|
+
if (isIpv4Mapped(self)) {
|
|
486
|
+
return `::ffff:${segments[6] >> 8}.${segments[6] & 0xff}.${segments[7] >> 8}.${segments[7] & 0xff}`;
|
|
487
|
+
}
|
|
488
|
+
let bestStart = -1;
|
|
489
|
+
let bestLength = 0;
|
|
490
|
+
let start = -1;
|
|
491
|
+
for (let index = 0; index <= 8; index++) {
|
|
492
|
+
if (index < 8 && segments[index] === 0) {
|
|
493
|
+
if (start === -1) start = index;
|
|
494
|
+
} else if (start !== -1) {
|
|
495
|
+
if (index - start > bestLength) {
|
|
496
|
+
bestStart = start;
|
|
497
|
+
bestLength = index - start;
|
|
498
|
+
}
|
|
499
|
+
start = -1;
|
|
500
|
+
}
|
|
501
|
+
}
|
|
502
|
+
if (bestLength < 2) return segments.map(segment => segment.toString(16)).join(":");
|
|
503
|
+
const head = segments.slice(0, bestStart).map(segment => segment.toString(16)).join(":");
|
|
504
|
+
const tail = segments.slice(bestStart + bestLength).map(segment => segment.toString(16)).join(":");
|
|
505
|
+
return `${head}::${tail}`;
|
|
506
|
+
};
|
|
507
|
+
/**
|
|
508
|
+
* Returns `true` for the all-zero address of either IP version.
|
|
509
|
+
*
|
|
510
|
+
* @category predicates
|
|
511
|
+
* @since 4.0.0
|
|
512
|
+
*/
|
|
513
|
+
export const isUnspecified = self => getBytes(self).every(byte => byte === 0);
|
|
514
|
+
/**
|
|
515
|
+
* Returns `true` for IPv4 `127.0.0.0/8` or IPv6 `::1`.
|
|
516
|
+
*
|
|
517
|
+
* @category predicates
|
|
518
|
+
* @since 4.0.0
|
|
519
|
+
*/
|
|
520
|
+
export const isLoopback = self => {
|
|
521
|
+
if (isIpv4Address(self)) return getBytes(self)[0] === 127;
|
|
522
|
+
const bytes = getBytes(self);
|
|
523
|
+
for (let index = 0; index < 15; index++) {
|
|
524
|
+
if (bytes[index] !== 0) return false;
|
|
525
|
+
}
|
|
526
|
+
return bytes[15] === 1;
|
|
527
|
+
};
|
|
528
|
+
/**
|
|
529
|
+
* Returns `true` for IPv4 `224.0.0.0/4` or IPv6 `ff00::/8`.
|
|
530
|
+
*
|
|
531
|
+
* @category predicates
|
|
532
|
+
* @since 4.0.0
|
|
533
|
+
*/
|
|
534
|
+
export const isMulticast = self => {
|
|
535
|
+
if (isIpv4Address(self)) return getBytes(self)[0] >> 4 === 0xe;
|
|
536
|
+
return getBytes(self)[0] === 0xff;
|
|
537
|
+
};
|
|
538
|
+
/**
|
|
539
|
+
* Returns `true` for the IPv4 broadcast address `255.255.255.255`.
|
|
540
|
+
*
|
|
541
|
+
* @category predicates
|
|
542
|
+
* @since 4.0.0
|
|
543
|
+
*/
|
|
544
|
+
export const isBroadcast = self => getBytes(self).every(byte => byte === 0xff);
|
|
545
|
+
/**
|
|
546
|
+
* Returns `true` for IPv4 `169.254.0.0/16` or IPv6 `fe80::/10`.
|
|
547
|
+
*
|
|
548
|
+
* @category predicates
|
|
549
|
+
* @since 4.0.0
|
|
550
|
+
*/
|
|
551
|
+
export const isLinkLocal = self => {
|
|
552
|
+
if (isIpv4Address(self)) {
|
|
553
|
+
const bytes = getBytes(self);
|
|
554
|
+
return bytes[0] === 0xa9 && bytes[1] === 0xfe;
|
|
555
|
+
}
|
|
556
|
+
const bytes = getBytes(self);
|
|
557
|
+
return bytes[0] === 0xfe && (bytes[1] & 0xc0) === 0x80;
|
|
558
|
+
};
|
|
559
|
+
/**
|
|
560
|
+
* Returns `true` for IPv4 private-use ranges defined by RFC 1918.
|
|
561
|
+
*
|
|
562
|
+
* @category predicates
|
|
563
|
+
* @since 4.0.0
|
|
564
|
+
*/
|
|
565
|
+
export const isPrivate = self => {
|
|
566
|
+
const bytes = getBytes(self);
|
|
567
|
+
return bytes[0] === 10 || bytes[0] === 172 && (bytes[1] & 0xf0) === 16 || bytes[0] === 192 && bytes[1] === 168;
|
|
568
|
+
};
|
|
569
|
+
/**
|
|
570
|
+
* Returns `true` for IPv6 unique-local addresses in `fc00::/7`.
|
|
571
|
+
*
|
|
572
|
+
* @category predicates
|
|
573
|
+
* @since 4.0.0
|
|
574
|
+
*/
|
|
575
|
+
export const isUniqueLocal = self => (getBytes(self)[0] & 0xfe) === 0xfc;
|
|
576
|
+
/**
|
|
577
|
+
* Returns `true` when an IPv6 address is in the `::ffff:0:0/96` mapped range.
|
|
578
|
+
*
|
|
579
|
+
* @category predicates
|
|
580
|
+
* @since 4.0.0
|
|
581
|
+
*/
|
|
582
|
+
export const isIpv4Mapped = self => {
|
|
583
|
+
const bytes = getBytes(self);
|
|
584
|
+
for (let index = 0; index < 10; index++) {
|
|
585
|
+
if (bytes[index] !== 0) return false;
|
|
586
|
+
}
|
|
587
|
+
return bytes[10] === 0xff && bytes[11] === 0xff;
|
|
588
|
+
};
|
|
589
|
+
/**
|
|
590
|
+
* Converts an IPv4 address to its IPv4-mapped IPv6 representation.
|
|
591
|
+
*
|
|
592
|
+
* @category converting
|
|
593
|
+
* @since 4.0.0
|
|
594
|
+
*/
|
|
595
|
+
export const toIpv4Mapped = self => {
|
|
596
|
+
const bytes = new Uint8Array(16);
|
|
597
|
+
bytes[10] = 0xff;
|
|
598
|
+
bytes[11] = 0xff;
|
|
599
|
+
bytes.set(getBytes(self), 12);
|
|
600
|
+
return makeIpv6(bytes);
|
|
601
|
+
};
|
|
602
|
+
/**
|
|
603
|
+
* Extracts the IPv4 value from an IPv4-mapped IPv6 address.
|
|
604
|
+
*
|
|
605
|
+
* @category converting
|
|
606
|
+
* @since 4.0.0
|
|
607
|
+
*/
|
|
608
|
+
export const fromIpv4Mapped = self => isIpv4Mapped(self) ? Option.some(makeIpv4(getBytes(self).slice(12))) : Option.none();
|
|
609
|
+
/**
|
|
610
|
+
* Converts an IPv4-mapped IPv6 address to IPv4, leaving all other addresses unchanged.
|
|
611
|
+
*
|
|
612
|
+
* @category converting
|
|
613
|
+
* @since 4.0.0
|
|
614
|
+
*/
|
|
615
|
+
export const toCanonical = self => isIpv6Address(self) ? Option.getOrElse(fromIpv4Mapped(self), () => self) : self;
|
|
616
|
+
const InetV4Proto = {
|
|
617
|
+
_tag: "InetAddressV4",
|
|
618
|
+
[TypeId]: TypeId,
|
|
619
|
+
[Equal.symbol](that) {
|
|
620
|
+
return isInetAddressV4(that) && this.port === that.port && Equal.equals(this.address, that.address);
|
|
621
|
+
},
|
|
622
|
+
[Hash.symbol]() {
|
|
623
|
+
return Hash.combine(Hash.hash(this.address), Hash.number(this.port));
|
|
624
|
+
},
|
|
625
|
+
toString() {
|
|
626
|
+
return formatInet(this);
|
|
627
|
+
},
|
|
628
|
+
toJSON() {
|
|
629
|
+
return this.toString();
|
|
630
|
+
},
|
|
631
|
+
[NodeInspectSymbol]() {
|
|
632
|
+
return this.toJSON();
|
|
633
|
+
}
|
|
634
|
+
};
|
|
635
|
+
const InetV6Proto = {
|
|
636
|
+
_tag: "InetAddressV6",
|
|
637
|
+
[TypeId]: TypeId,
|
|
638
|
+
[Equal.symbol](that) {
|
|
639
|
+
return isInetAddressV6(that) && this.port === that.port && this.scopeId === that.scopeId && Equal.equals(this.address, that.address);
|
|
640
|
+
},
|
|
641
|
+
[Hash.symbol]() {
|
|
642
|
+
return Hash.combine(Hash.combine(Hash.hash(this.address), Hash.number(this.port)), Hash.number(this.scopeId));
|
|
643
|
+
},
|
|
644
|
+
toString() {
|
|
645
|
+
return formatInet(this);
|
|
646
|
+
},
|
|
647
|
+
toJSON() {
|
|
648
|
+
return this.toString();
|
|
649
|
+
},
|
|
650
|
+
[NodeInspectSymbol]() {
|
|
651
|
+
return this.toJSON();
|
|
652
|
+
}
|
|
653
|
+
};
|
|
654
|
+
const checkPort = port => Number.isInteger(port) && port >= 0 && port <= 0xffff;
|
|
655
|
+
/**
|
|
656
|
+
* Creates a checked IPv4 internet address.
|
|
657
|
+
*
|
|
658
|
+
* @category constructors
|
|
659
|
+
* @since 4.0.0
|
|
660
|
+
*/
|
|
661
|
+
export const inetAddressV4 = (address, port) => {
|
|
662
|
+
if (!checkPort(port)) {
|
|
663
|
+
return addressError(address, "port must be an integer from 0 through 65535");
|
|
664
|
+
}
|
|
665
|
+
const self = Object.create(InetV4Proto);
|
|
666
|
+
self.address = address;
|
|
667
|
+
self.port = port;
|
|
668
|
+
return Result.succeed(Object.freeze(self));
|
|
669
|
+
};
|
|
670
|
+
/**
|
|
671
|
+
* Creates a checked IPv6 internet address with an optional scope identifier.
|
|
672
|
+
*
|
|
673
|
+
* @category constructors
|
|
674
|
+
* @since 4.0.0
|
|
675
|
+
*/
|
|
676
|
+
export const inetAddressV6 = (address, port, options) => {
|
|
677
|
+
if (!checkPort(port)) {
|
|
678
|
+
return addressError(address, "port must be an integer from 0 through 65535");
|
|
679
|
+
}
|
|
680
|
+
const scopeId = options?.scopeId ?? 0;
|
|
681
|
+
if (!Number.isInteger(scopeId) || scopeId < 0 || scopeId > 0xffffffff) {
|
|
682
|
+
return addressError(address, "scopeId must be an unsigned 32-bit integer");
|
|
683
|
+
}
|
|
684
|
+
const self = Object.create(InetV6Proto);
|
|
685
|
+
self.address = address;
|
|
686
|
+
self.port = port;
|
|
687
|
+
self.scopeId = scopeId;
|
|
688
|
+
return Result.succeed(Object.freeze(self));
|
|
689
|
+
};
|
|
690
|
+
/**
|
|
691
|
+
* Creates a checked internet address for an IP address and port.
|
|
692
|
+
*
|
|
693
|
+
* @category constructors
|
|
694
|
+
* @since 4.0.0
|
|
695
|
+
*/
|
|
696
|
+
export const inetAddress = (address, port) => isIpv4Address(address) ? inetAddressV4(address, port) : inetAddressV6(address, port);
|
|
697
|
+
/**
|
|
698
|
+
* Creates an internet address from a trusted IP address and port, throwing on failure.
|
|
699
|
+
*
|
|
700
|
+
* @category unsafe
|
|
701
|
+
* @since 4.0.0
|
|
702
|
+
*/
|
|
703
|
+
export const inetAddressUnsafe = (address, port) => Result.getOrThrow(inetAddress(address, port));
|
|
704
|
+
/**
|
|
705
|
+
* Creates a checked internet address from a numeric IP string and port.
|
|
706
|
+
*
|
|
707
|
+
* **Gotchas**
|
|
708
|
+
*
|
|
709
|
+
* The address must be a numeric IPv4 or IPv6 literal. This function does not
|
|
710
|
+
* resolve hostnames or accept IPv6 brackets.
|
|
711
|
+
*
|
|
712
|
+
* @category constructors
|
|
713
|
+
* @since 4.0.0
|
|
714
|
+
*/
|
|
715
|
+
export const inetAddressFromIpString = (address, port) => {
|
|
716
|
+
return Result.flatMap(ipFromString(address), address => inetAddress(address, port));
|
|
717
|
+
};
|
|
718
|
+
/**
|
|
719
|
+
* Creates an internet address from a trusted numeric IP string and port.
|
|
720
|
+
*
|
|
721
|
+
* **Gotchas**
|
|
722
|
+
*
|
|
723
|
+
* This function throws when either input is invalid. Use only when both values
|
|
724
|
+
* are already known to satisfy the checked constructor's requirements.
|
|
725
|
+
*
|
|
726
|
+
* @category unsafe
|
|
727
|
+
* @since 4.0.0
|
|
728
|
+
*/
|
|
729
|
+
export const inetAddressFromIpStringUnsafe = (address, port) => Result.getOrThrow(inetAddressFromIpString(address, port));
|
|
730
|
+
/**
|
|
731
|
+
* Parses `IPv4:port` or `[IPv6]:port` without DNS resolution.
|
|
732
|
+
*
|
|
733
|
+
* @category decoding
|
|
734
|
+
* @since 4.0.0
|
|
735
|
+
*/
|
|
736
|
+
export const inetAddressFromString = input => {
|
|
737
|
+
let host;
|
|
738
|
+
let portText;
|
|
739
|
+
let scopeId = 0;
|
|
740
|
+
const bracketed = input.startsWith("[");
|
|
741
|
+
if (bracketed) {
|
|
742
|
+
const end = input.indexOf("]");
|
|
743
|
+
if (end < 0 || input[end + 1] !== ":" || input.indexOf("]", end + 1) !== -1) {
|
|
744
|
+
return addressError(input, "expected [IPv6]:port");
|
|
745
|
+
}
|
|
746
|
+
host = input.slice(1, end);
|
|
747
|
+
portText = input.slice(end + 2);
|
|
748
|
+
const scopeSeparator = host.indexOf("%");
|
|
749
|
+
if (scopeSeparator !== -1) {
|
|
750
|
+
const scopeText = host.slice(scopeSeparator + 1);
|
|
751
|
+
if (host.indexOf("%", scopeSeparator + 1) !== -1 || !/^\d+$/.test(scopeText)) {
|
|
752
|
+
return addressError(input, "scope identifier must be decimal");
|
|
753
|
+
}
|
|
754
|
+
scopeId = Number(scopeText);
|
|
755
|
+
if (!Number.isInteger(scopeId) || scopeId > 0xffffffff) {
|
|
756
|
+
return addressError(input, "scope identifier must be an unsigned 32-bit integer");
|
|
757
|
+
}
|
|
758
|
+
host = host.slice(0, scopeSeparator);
|
|
759
|
+
}
|
|
760
|
+
} else {
|
|
761
|
+
const separator = input.lastIndexOf(":");
|
|
762
|
+
if (separator < 0) {
|
|
763
|
+
return addressError(input, "expected host:port or [IPv6]:port");
|
|
764
|
+
}
|
|
765
|
+
if (input.indexOf(":") !== separator) {
|
|
766
|
+
return addressError(input, "IPv6 addresses must be bracketed");
|
|
767
|
+
}
|
|
768
|
+
host = input.slice(0, separator);
|
|
769
|
+
portText = input.slice(separator + 1);
|
|
770
|
+
}
|
|
771
|
+
if (!/^(0|[1-9]\d*)$/.test(portText)) {
|
|
772
|
+
return addressError(input, "port must be an unpadded decimal integer");
|
|
773
|
+
}
|
|
774
|
+
return Result.flatMap(ipFromString(host), address => {
|
|
775
|
+
if (bracketed !== isIpv6Address(address)) {
|
|
776
|
+
return addressError(input, "only IPv6 addresses use brackets");
|
|
777
|
+
}
|
|
778
|
+
return isIpv6Address(address) ? inetAddressV6(address, Number(portText), {
|
|
779
|
+
scopeId
|
|
780
|
+
}) : inetAddressV4(address, Number(portText));
|
|
781
|
+
});
|
|
782
|
+
};
|
|
783
|
+
/**
|
|
784
|
+
* Parses a trusted numeric internet address and port, throwing on failure.
|
|
785
|
+
*
|
|
786
|
+
* @category unsafe
|
|
787
|
+
* @since 4.0.0
|
|
788
|
+
*/
|
|
789
|
+
export const inetAddressFromStringUnsafe = input => Result.getOrThrow(inetAddressFromString(input));
|
|
790
|
+
/**
|
|
791
|
+
* Formats a resolved internet address, bracketing IPv6 around its port.
|
|
792
|
+
*
|
|
793
|
+
* @category encoding
|
|
794
|
+
* @since 4.0.0
|
|
795
|
+
*/
|
|
796
|
+
export const formatInet = self => {
|
|
797
|
+
if (self._tag === "InetAddressV4") return `${formatIp(self.address)}:${self.port}`;
|
|
798
|
+
const scope = self.scopeId === 0 ? "" : `%${self.scopeId}`;
|
|
799
|
+
return `[${formatIp(self.address)}${scope}]:${self.port}`;
|
|
800
|
+
};
|
|
801
|
+
/**
|
|
802
|
+
* Formats an IP address for use as a URL authority host.
|
|
803
|
+
*
|
|
804
|
+
* @category encoding
|
|
805
|
+
* @since 4.0.0
|
|
806
|
+
*/
|
|
807
|
+
export const formatUrlHost = self => isIpv4Address(self) ? formatIp(self) : `[${formatIp(self)}]`;
|
|
808
|
+
/**
|
|
809
|
+
* Converts an IP address or internet socket address to a WHATWG `URL`.
|
|
810
|
+
*
|
|
811
|
+
* **Details**
|
|
812
|
+
*
|
|
813
|
+
* Defaults to the HTTP scheme and uses standard URL normalization, including
|
|
814
|
+
* IPv6 brackets and omission of default ports. Bare IP addresses have no
|
|
815
|
+
* explicit port; internet socket addresses retain their port, including zero.
|
|
816
|
+
* Unspecified addresses are preserved.
|
|
817
|
+
*
|
|
818
|
+
* **Gotchas**
|
|
819
|
+
*
|
|
820
|
+
* Returns a `NetAddressError` for scoped IPv6 addresses or inputs that the URL
|
|
821
|
+
* constructor rejects. Supply the scheme without a trailing colon, for example
|
|
822
|
+
* `"https"`.
|
|
823
|
+
*
|
|
824
|
+
* @category conversions
|
|
825
|
+
* @since 4.0.0
|
|
826
|
+
*/
|
|
827
|
+
export const toUrl = (self, scheme = "http") => {
|
|
828
|
+
if (self._tag === "InetAddressV6" && self.scopeId !== 0) {
|
|
829
|
+
return addressError(self, "scoped IPv6 addresses are not supported by WHATWG URLs");
|
|
830
|
+
}
|
|
831
|
+
return Result.try({
|
|
832
|
+
try: () => new URL(`${scheme}://${isInetAddress(self) ? formatInet(self) : formatUrlHost(self)}`),
|
|
833
|
+
catch: cause => new NetAddressError({
|
|
834
|
+
input: self,
|
|
835
|
+
message: "failed to construct URL",
|
|
836
|
+
cause
|
|
837
|
+
})
|
|
838
|
+
});
|
|
839
|
+
};
|
|
840
|
+
/**
|
|
841
|
+
* Formats an IP or socket address as a URL display string.
|
|
842
|
+
*
|
|
843
|
+
* **Details**
|
|
844
|
+
*
|
|
845
|
+
* Defaults to HTTP, brackets IPv6 addresses, and omits default ports and the
|
|
846
|
+
* trailing slash. Custom schemes such as `"tcp"` retain their scheme and host.
|
|
847
|
+
* Unix socket addresses use {@link formatUnixPath}, preserving the raw path
|
|
848
|
+
* with a `unix://` prefix regardless of the supplied scheme.
|
|
849
|
+
*
|
|
850
|
+
* **Gotchas**
|
|
851
|
+
*
|
|
852
|
+
* Returns a `NetAddressError` when URL conversion fails, including for scoped
|
|
853
|
+
* IPv6 addresses.
|
|
854
|
+
*
|
|
855
|
+
* @category encoding
|
|
856
|
+
* @since 4.0.0
|
|
857
|
+
*/
|
|
858
|
+
export const formatUrl = (self, scheme = "http") => isUnixPathAddress(self) ? Result.succeed(formatUnixPath(self)) : Result.map(toUrl(self, scheme), url => `${url.protocol}//${url.host}`);
|
|
859
|
+
/**
|
|
860
|
+
* Formats an IP or socket address as a URL display string,
|
|
861
|
+
* throwing a `NetAddressError` when conversion fails.
|
|
862
|
+
*
|
|
863
|
+
* @see {@link formatUrl} for the checked version and formatting behavior.
|
|
864
|
+
*
|
|
865
|
+
* @category unsafe
|
|
866
|
+
* @since 4.0.0
|
|
867
|
+
*/
|
|
868
|
+
export const formatUrlUnsafe = (self, scheme = "http") => Result.getOrThrow(formatUrl(self, scheme));
|
|
869
|
+
/**
|
|
870
|
+
* Formats a hostname or numeric IP address for use as a URL authority host.
|
|
871
|
+
*
|
|
872
|
+
* @category encoding
|
|
873
|
+
* @since 4.0.0
|
|
874
|
+
*/
|
|
875
|
+
export const formatUrlHostString = host => host.includes(":") && !host.startsWith("[") ? `[${host}]` : host;
|
|
876
|
+
const UnixPathProto = {
|
|
877
|
+
_tag: "UnixPathAddress",
|
|
878
|
+
[TypeId]: TypeId,
|
|
879
|
+
[Equal.symbol](that) {
|
|
880
|
+
return isUnixPathAddress(that) && this.path === that.path;
|
|
881
|
+
},
|
|
882
|
+
[Hash.symbol]() {
|
|
883
|
+
return Hash.combine(Hash.string("UnixPathAddress"), Hash.string(this.path));
|
|
884
|
+
},
|
|
885
|
+
toString() {
|
|
886
|
+
return this.path;
|
|
887
|
+
},
|
|
888
|
+
toJSON() {
|
|
889
|
+
return this.toString();
|
|
890
|
+
},
|
|
891
|
+
[NodeInspectSymbol]() {
|
|
892
|
+
return this.toJSON();
|
|
893
|
+
}
|
|
894
|
+
};
|
|
895
|
+
/**
|
|
896
|
+
* Creates a Unix-domain filesystem address without normalizing its opaque path.
|
|
897
|
+
*
|
|
898
|
+
* @category constructors
|
|
899
|
+
* @since 4.0.0
|
|
900
|
+
*/
|
|
901
|
+
export const unixPathAddress = path => {
|
|
902
|
+
const self = Object.create(UnixPathProto);
|
|
903
|
+
self.path = path;
|
|
904
|
+
return Object.freeze(self);
|
|
905
|
+
};
|
|
906
|
+
/**
|
|
907
|
+
* Formats a Unix-domain socket path as a readable `unix://path` display string.
|
|
908
|
+
*
|
|
909
|
+
* **Details**
|
|
910
|
+
*
|
|
911
|
+
* Preserves the raw path without URL encoding or normalization. The resulting
|
|
912
|
+
* string is intended for display.
|
|
913
|
+
*
|
|
914
|
+
* @category encoding
|
|
915
|
+
* @since 4.0.0
|
|
916
|
+
*/
|
|
917
|
+
export const formatUnixPath = self => `unix://${self.path}`;
|
|
918
|
+
/**
|
|
919
|
+
* Converts a `SocketAddress.Input` to a concrete socket address.
|
|
920
|
+
*
|
|
921
|
+
* **Details**
|
|
922
|
+
*
|
|
923
|
+
* Numeric IP strings are parsed without hostname resolution. Invalid IP
|
|
924
|
+
* literals, ports, and input shapes return a `NetAddressError`.
|
|
925
|
+
*
|
|
926
|
+
* @category constructors
|
|
927
|
+
* @since 4.0.0
|
|
928
|
+
*/
|
|
929
|
+
export const socketAddressFromInput = input => {
|
|
930
|
+
if (isSocketAddress(input)) return Result.succeed(input);
|
|
931
|
+
if (typeof input === "string") return inetAddressFromString(input);
|
|
932
|
+
if (hasProperty(input, "path")) {
|
|
933
|
+
return typeof input.path === "string" ? Result.succeed(unixPathAddress(input.path)) : addressError(input, "path must be a string");
|
|
934
|
+
}
|
|
935
|
+
if (!hasProperty(input, "address") || !hasProperty(input, "port")) {
|
|
936
|
+
return addressError(input, "expected an address and port or a Unix path");
|
|
937
|
+
}
|
|
938
|
+
const address = typeof input.address === "string" ? ipFromString(input.address) : isIpAddress(input.address) ? Result.succeed(input.address) : addressError(input, "address must be an IP address or numeric IP string");
|
|
939
|
+
return Result.flatMap(address, address => inetAddress(address, input.port));
|
|
940
|
+
};
|
|
941
|
+
/**
|
|
942
|
+
* Converts a trusted `SocketAddress.Input` to a concrete socket address,
|
|
943
|
+
* throwing on failure.
|
|
944
|
+
*
|
|
945
|
+
* @category unsafe
|
|
946
|
+
* @since 4.0.0
|
|
947
|
+
*/
|
|
948
|
+
export const socketAddressFromInputUnsafe = input => Result.getOrThrow(socketAddressFromInput(input));
|
|
949
|
+
/**
|
|
950
|
+
* Formats a portable socket address for human-readable output.
|
|
951
|
+
*
|
|
952
|
+
* @category encoding
|
|
953
|
+
* @since 4.0.0
|
|
954
|
+
*/
|
|
955
|
+
export const formatSocketAddress = self => self._tag === "UnixPathAddress" ? self.path : formatInet(self);
|
|
956
|
+
//# sourceMappingURL=NetAddress.js.map
|