effect 4.0.1 → 4.0.3
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/ai-docs/package.json +2 -2
- package/ai-docs/tsconfig.json +2 -1
- package/dist/Array.d.ts +339 -0
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +143 -3
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +88 -0
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +44 -0
- package/dist/BigDecimal.js.map +1 -1
- package/dist/BigInt.d.ts +68 -0
- package/dist/BigInt.d.ts.map +1 -1
- package/dist/BigInt.js +36 -0
- package/dist/BigInt.js.map +1 -1
- package/dist/Boolean.d.ts +34 -0
- package/dist/Boolean.d.ts.map +1 -1
- package/dist/Boolean.js +18 -0
- package/dist/Boolean.js.map +1 -1
- package/dist/Brand.d.ts +9 -0
- package/dist/Brand.d.ts.map +1 -1
- package/dist/Brand.js +6 -0
- package/dist/Brand.js.map +1 -1
- package/dist/ByteSize.d.ts +86 -0
- package/dist/ByteSize.d.ts.map +1 -1
- package/dist/ByteSize.js +51 -0
- package/dist/ByteSize.js.map +1 -1
- package/dist/Cache.d.ts +38 -1
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +27 -7
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +82 -0
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Cause.js +60 -0
- package/dist/Cause.js.map +1 -1
- package/dist/Channel.d.ts +327 -4
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +168 -8
- package/dist/Channel.js.map +1 -1
- package/dist/ChannelSchema.d.ts +11 -0
- package/dist/ChannelSchema.d.ts.map +1 -1
- package/dist/ChannelSchema.js +6 -0
- package/dist/ChannelSchema.js.map +1 -1
- package/dist/Chunk.d.ts +192 -0
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +78 -0
- package/dist/Chunk.js.map +1 -1
- package/dist/Clock.d.ts +7 -0
- package/dist/Clock.d.ts.map +1 -1
- package/dist/Clock.js +5 -0
- package/dist/Clock.js.map +1 -1
- package/dist/Combiner.d.ts +10 -0
- package/dist/Combiner.d.ts.map +1 -1
- package/dist/Combiner.js +8 -0
- package/dist/Combiner.js.map +1 -1
- package/dist/Config.d.ts +52 -12
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +55 -5
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +28 -0
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +19 -0
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Console.d.ts +22 -0
- package/dist/Console.d.ts.map +1 -1
- package/dist/Console.js +20 -0
- package/dist/Console.js.map +1 -1
- package/dist/Context.d.ts +50 -0
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js +24 -3
- package/dist/Context.js.map +1 -1
- package/dist/Cron.d.ts +16 -0
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +26 -1
- package/dist/Cron.js.map +1 -1
- package/dist/Crypto.d.ts +38 -5
- package/dist/Crypto.d.ts.map +1 -1
- package/dist/Crypto.js +11 -2
- package/dist/Crypto.js.map +1 -1
- package/dist/Data.d.ts +13 -0
- package/dist/Data.d.ts.map +1 -1
- package/dist/Data.js +5 -0
- package/dist/Data.js.map +1 -1
- package/dist/DateTime.d.ts +180 -6
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/DateTime.js +98 -6
- package/dist/DateTime.js.map +1 -1
- package/dist/Deferred.d.ts +51 -0
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +22 -0
- package/dist/Deferred.js.map +1 -1
- package/dist/Differ.d.ts +2 -0
- package/dist/Differ.d.ts.map +1 -1
- package/dist/Differ.js +1 -0
- package/dist/Duration.d.ts +96 -6
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +80 -8
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +527 -0
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +240 -5
- package/dist/Effect.js.map +1 -1
- package/dist/Effectable.d.ts +4 -0
- package/dist/Effectable.d.ts.map +1 -1
- package/dist/Effectable.js +3 -0
- package/dist/Effectable.js.map +1 -1
- package/dist/Equal.d.ts +8 -0
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +9 -1
- package/dist/Equal.js.map +1 -1
- package/dist/Equivalence.d.ts +21 -0
- package/dist/Equivalence.d.ts.map +1 -1
- package/dist/Equivalence.js +16 -0
- package/dist/Equivalence.js.map +1 -1
- package/dist/ErrorReporter.d.ts +36 -0
- package/dist/ErrorReporter.d.ts.map +1 -1
- package/dist/ErrorReporter.js +11 -0
- package/dist/ErrorReporter.js.map +1 -1
- package/dist/ExecutionPlan.d.ts +49 -8
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/ExecutionPlan.js +7 -0
- package/dist/ExecutionPlan.js.map +1 -1
- package/dist/Exit.d.ts +40 -0
- package/dist/Exit.d.ts.map +1 -1
- package/dist/Exit.js +27 -0
- package/dist/Exit.js.map +1 -1
- package/dist/Fiber.d.ts +20 -0
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js +11 -0
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.d.ts +21 -0
- package/dist/FiberHandle.d.ts.map +1 -1
- package/dist/FiberHandle.js +21 -4
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +35 -0
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +19 -0
- package/dist/FiberMap.js.map +1 -1
- package/dist/FiberSet.d.ts +20 -0
- package/dist/FiberSet.d.ts.map +1 -1
- package/dist/FiberSet.js +14 -0
- package/dist/FiberSet.js.map +1 -1
- package/dist/FileSystem.d.ts +59 -2
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +8 -0
- package/dist/FileSystem.js.map +1 -1
- package/dist/Filter.d.ts +55 -0
- package/dist/Filter.d.ts.map +1 -1
- package/dist/Filter.js +28 -0
- package/dist/Filter.js.map +1 -1
- package/dist/Formatter.d.ts +3 -0
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +39 -1
- package/dist/Formatter.js.map +1 -1
- package/dist/Function.d.ts +30 -0
- package/dist/Function.d.ts.map +1 -1
- package/dist/Function.js +20 -0
- package/dist/Function.js.map +1 -1
- package/dist/Graph.d.ts +247 -12
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +149 -28
- package/dist/Graph.js.map +1 -1
- package/dist/HKT.d.ts +5 -0
- package/dist/HKT.d.ts.map +1 -1
- package/dist/Hash.d.ts +14 -0
- package/dist/Hash.d.ts.map +1 -1
- package/dist/Hash.js +12 -0
- package/dist/Hash.js.map +1 -1
- package/dist/HashMap.d.ts +91 -0
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashMap.js +39 -0
- package/dist/HashMap.js.map +1 -1
- package/dist/HashRing.d.ts +17 -0
- package/dist/HashRing.d.ts.map +1 -1
- package/dist/HashRing.js +9 -0
- package/dist/HashRing.js.map +1 -1
- package/dist/HashSet.d.ts +49 -0
- package/dist/HashSet.d.ts.map +1 -1
- package/dist/HashSet.js +19 -0
- package/dist/HashSet.js.map +1 -1
- package/dist/Inspectable.d.ts +7 -0
- package/dist/Inspectable.d.ts.map +1 -1
- package/dist/Inspectable.js +6 -0
- package/dist/Inspectable.js.map +1 -1
- package/dist/Iterable.d.ts +127 -0
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +51 -0
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonPatch.d.ts +4 -0
- package/dist/JsonPatch.d.ts.map +1 -1
- package/dist/JsonPatch.js +3 -0
- package/dist/JsonPatch.js.map +1 -1
- package/dist/JsonPointer.d.ts +5 -0
- package/dist/JsonPointer.d.ts.map +1 -1
- package/dist/JsonPointer.js +5 -0
- package/dist/JsonPointer.js.map +1 -1
- package/dist/JsonSchema.d.ts +16 -0
- package/dist/JsonSchema.d.ts.map +1 -1
- package/dist/JsonSchema.js +11 -0
- package/dist/JsonSchema.js.map +1 -1
- package/dist/Latch.d.ts +14 -0
- package/dist/Latch.d.ts.map +1 -1
- package/dist/Latch.js +10 -0
- package/dist/Latch.js.map +1 -1
- package/dist/Layer.d.ts +100 -0
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +45 -1
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +7 -0
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +4 -0
- package/dist/LayerMap.js.map +1 -1
- package/dist/LayerRef.d.ts +5 -0
- package/dist/LayerRef.d.ts.map +1 -1
- package/dist/LayerRef.js +3 -0
- package/dist/LayerRef.js.map +1 -1
- package/dist/LogLevel.d.ts +20 -0
- package/dist/LogLevel.d.ts.map +1 -1
- package/dist/LogLevel.js +9 -0
- package/dist/LogLevel.js.map +1 -1
- package/dist/Logger.d.ts +25 -0
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +30 -4
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.d.ts +5 -0
- package/dist/ManagedRuntime.d.ts.map +1 -1
- package/dist/ManagedRuntime.js +9 -1
- package/dist/ManagedRuntime.js.map +1 -1
- package/dist/Match.d.ts +51 -0
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js +39 -0
- package/dist/Match.js.map +1 -1
- package/dist/Metric.d.ts +59 -0
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +31 -0
- package/dist/Metric.js.map +1 -1
- package/dist/MutableHashMap.d.ts +32 -0
- package/dist/MutableHashMap.d.ts.map +1 -1
- package/dist/MutableHashMap.js +16 -0
- package/dist/MutableHashMap.js.map +1 -1
- package/dist/MutableHashSet.d.ts +16 -0
- package/dist/MutableHashSet.d.ts.map +1 -1
- package/dist/MutableHashSet.js +10 -0
- package/dist/MutableHashSet.js.map +1 -1
- package/dist/MutableList.d.ts +20 -0
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +18 -0
- package/dist/MutableList.js.map +1 -1
- package/dist/MutableRef.d.ts +31 -0
- package/dist/MutableRef.d.ts.map +1 -1
- package/dist/MutableRef.js +17 -0
- package/dist/MutableRef.js.map +1 -1
- package/dist/Newtype.d.ts +9 -0
- package/dist/Newtype.d.ts.map +1 -1
- package/dist/Newtype.js +6 -0
- package/dist/Newtype.js.map +1 -1
- package/dist/NonEmptyIterable.d.ts +4 -0
- package/dist/NonEmptyIterable.d.ts.map +1 -1
- package/dist/NonEmptyIterable.js +2 -0
- package/dist/NonEmptyIterable.js.map +1 -1
- package/dist/Number.d.ts +61 -0
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +31 -0
- package/dist/Number.js.map +1 -1
- package/dist/Optic.d.ts +41 -0
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +20 -0
- package/dist/Optic.js.map +1 -1
- package/dist/Option.d.ts +134 -0
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +61 -0
- package/dist/Option.js.map +1 -1
- package/dist/Order.d.ts +29 -0
- package/dist/Order.d.ts.map +1 -1
- package/dist/Order.js +24 -0
- package/dist/Order.js.map +1 -1
- package/dist/Ordering.d.ts +7 -0
- package/dist/Ordering.d.ts.map +1 -1
- package/dist/Ordering.js +3 -0
- package/dist/Ordering.js.map +1 -1
- package/dist/PartitionedSemaphore.d.ts +24 -0
- package/dist/PartitionedSemaphore.d.ts.map +1 -1
- package/dist/PartitionedSemaphore.js +47 -21
- package/dist/PartitionedSemaphore.js.map +1 -1
- package/dist/Path.d.ts +6 -0
- package/dist/Path.d.ts.map +1 -1
- package/dist/Path.js +4 -0
- package/dist/Path.js.map +1 -1
- package/dist/Pipeable.d.ts +7 -0
- package/dist/Pipeable.d.ts.map +1 -1
- package/dist/Pipeable.js +5 -0
- package/dist/Pipeable.js.map +1 -1
- package/dist/PlatformError.d.ts +8 -0
- package/dist/PlatformError.d.ts.map +1 -1
- package/dist/PlatformError.js +7 -0
- package/dist/PlatformError.js.map +1 -1
- package/dist/Pool.d.ts +19 -0
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +8 -1
- package/dist/Pool.js.map +1 -1
- package/dist/Predicate.d.ts +84 -0
- package/dist/Predicate.d.ts.map +1 -1
- package/dist/Predicate.js +48 -0
- package/dist/Predicate.js.map +1 -1
- package/dist/PrimaryKey.d.ts +5 -0
- package/dist/PrimaryKey.d.ts.map +1 -1
- package/dist/PrimaryKey.js +4 -0
- package/dist/PrimaryKey.js.map +1 -1
- package/dist/PubSub.d.ts +67 -5
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +60 -8
- package/dist/PubSub.js.map +1 -1
- package/dist/Pull.d.ts +20 -0
- package/dist/Pull.d.ts.map +1 -1
- package/dist/Pull.js +10 -0
- package/dist/Pull.js.map +1 -1
- package/dist/Queue.d.ts +60 -0
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +58 -8
- package/dist/Queue.js.map +1 -1
- package/dist/Random.d.ts +13 -0
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +9 -0
- package/dist/Random.js.map +1 -1
- package/dist/RcMap.d.ts +23 -0
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +8 -0
- package/dist/RcMap.js.map +1 -1
- package/dist/RcRef.d.ts +6 -0
- package/dist/RcRef.d.ts.map +1 -1
- package/dist/RcRef.js +3 -0
- package/dist/RcRef.js.map +1 -1
- package/dist/Record.d.ts +100 -0
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js +43 -0
- package/dist/Record.js.map +1 -1
- package/dist/Redactable.d.ts +6 -0
- package/dist/Redactable.d.ts.map +1 -1
- package/dist/Redactable.js +4 -0
- package/dist/Redactable.js.map +1 -1
- package/dist/Redacted.d.ts +8 -0
- package/dist/Redacted.d.ts.map +1 -1
- package/dist/Redacted.js +6 -0
- package/dist/Redacted.js.map +1 -1
- package/dist/Reducer.d.ts +4 -0
- package/dist/Reducer.d.ts.map +1 -1
- package/dist/Reducer.js +3 -0
- package/dist/Reducer.js.map +1 -1
- package/dist/Ref.d.ts +20 -0
- package/dist/Ref.d.ts.map +1 -1
- package/dist/Ref.js +16 -0
- package/dist/Ref.js.map +1 -1
- package/dist/References.d.ts +21 -0
- package/dist/References.d.ts.map +1 -1
- package/dist/References.js +19 -0
- package/dist/References.js.map +1 -1
- package/dist/RegExp.d.ts +3 -0
- package/dist/RegExp.d.ts.map +1 -1
- package/dist/RegExp.js +4 -0
- package/dist/RegExp.js.map +1 -1
- package/dist/Request.d.ts +32 -0
- package/dist/Request.d.ts.map +1 -1
- package/dist/Request.js +12 -0
- package/dist/Request.js.map +1 -1
- package/dist/RequestResolver.d.ts +42 -0
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +27 -6
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Resource.d.ts +6 -0
- package/dist/Resource.d.ts.map +1 -1
- package/dist/Resource.js +6 -0
- package/dist/Resource.js.map +1 -1
- package/dist/Result.d.ts +91 -0
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +41 -0
- package/dist/Result.js.map +1 -1
- package/dist/Runtime.d.ts +9 -0
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +7 -0
- package/dist/Runtime.js.map +1 -1
- package/dist/Schedule.d.ts +57 -0
- package/dist/Schedule.d.ts.map +1 -1
- package/dist/Schedule.js +32 -0
- package/dist/Schedule.js.map +1 -1
- package/dist/Scheduler.d.ts +7 -0
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +5 -0
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +969 -2
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +635 -5
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +107 -0
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +81 -1
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +69 -2
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +63 -4
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.d.ts +33 -0
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js +18 -0
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.d.ts +25 -0
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +26 -0
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +147 -0
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +99 -0
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +53 -0
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +46 -0
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/Scope.d.ts +19 -0
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js +12 -0
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.d.ts +34 -0
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedCache.js +26 -3
- package/dist/ScopedCache.js.map +1 -1
- package/dist/ScopedRef.d.ts +9 -0
- package/dist/ScopedRef.d.ts.map +1 -1
- package/dist/ScopedRef.js +6 -0
- package/dist/ScopedRef.js.map +1 -1
- package/dist/Semaphore.d.ts +26 -0
- package/dist/Semaphore.d.ts.map +1 -1
- package/dist/Semaphore.js +10 -0
- package/dist/Semaphore.js.map +1 -1
- package/dist/Sink.d.ts +125 -1
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +75 -1
- package/dist/Sink.js.map +1 -1
- package/dist/StandardSchema.d.ts +1 -0
- package/dist/StandardSchema.d.ts.map +1 -1
- package/dist/StandardSchema.js +1 -0
- package/dist/Stdio.d.ts +14 -1
- package/dist/Stdio.d.ts.map +1 -1
- package/dist/Stdio.js +6 -0
- package/dist/Stdio.js.map +1 -1
- package/dist/Stream.d.ts +569 -11
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +266 -18
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +87 -0
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +61 -0
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts +46 -0
- package/dist/Struct.d.ts.map +1 -1
- package/dist/Struct.js +19 -0
- package/dist/Struct.js.map +1 -1
- package/dist/SubscriptionRef.d.ts +65 -0
- package/dist/SubscriptionRef.d.ts.map +1 -1
- package/dist/SubscriptionRef.js +25 -0
- package/dist/SubscriptionRef.js.map +1 -1
- package/dist/Symbol.d.ts +2 -0
- package/dist/Symbol.d.ts.map +1 -1
- package/dist/Symbol.js +2 -0
- package/dist/Symbol.js.map +1 -1
- package/dist/SynchronizedRef.d.ts +63 -0
- package/dist/SynchronizedRef.d.ts.map +1 -1
- package/dist/SynchronizedRef.js +24 -0
- package/dist/SynchronizedRef.js.map +1 -1
- package/dist/Take.d.ts +3 -0
- package/dist/Take.d.ts.map +1 -1
- package/dist/Take.js +1 -0
- package/dist/Take.js.map +1 -1
- package/dist/Terminal.d.ts +8 -0
- package/dist/Terminal.d.ts.map +1 -1
- package/dist/Terminal.js +4 -0
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +23 -0
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +12 -0
- package/dist/Tracer.js.map +1 -1
- package/dist/Trie.d.ts +68 -0
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Trie.js +28 -0
- package/dist/Trie.js.map +1 -1
- package/dist/Tuple.d.ts +38 -0
- package/dist/Tuple.d.ts.map +1 -1
- package/dist/Tuple.js +18 -0
- package/dist/Tuple.js.map +1 -1
- package/dist/TxChunk.d.ts +52 -0
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxChunk.js +23 -0
- package/dist/TxChunk.js.map +1 -1
- package/dist/TxDeferred.d.ts +15 -0
- package/dist/TxDeferred.d.ts.map +1 -1
- package/dist/TxDeferred.js +8 -0
- package/dist/TxDeferred.js.map +1 -1
- package/dist/TxHashMap.d.ts +83 -0
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +52 -7
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxHashSet.d.ts +51 -0
- package/dist/TxHashSet.d.ts.map +1 -1
- package/dist/TxHashSet.js +29 -4
- package/dist/TxHashSet.js.map +1 -1
- package/dist/TxPriorityQueue.d.ts +30 -0
- package/dist/TxPriorityQueue.d.ts.map +1 -1
- package/dist/TxPriorityQueue.js +22 -1
- package/dist/TxPriorityQueue.js.map +1 -1
- package/dist/TxPubSub.d.ts +25 -0
- package/dist/TxPubSub.d.ts.map +1 -1
- package/dist/TxPubSub.js +19 -0
- package/dist/TxPubSub.js.map +1 -1
- package/dist/TxQueue.d.ts +51 -0
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxQueue.js +30 -0
- package/dist/TxQueue.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +24 -0
- package/dist/TxReentrantLock.d.ts.map +1 -1
- package/dist/TxReentrantLock.js +32 -18
- package/dist/TxReentrantLock.js.map +1 -1
- package/dist/TxRef.d.ts +14 -0
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +7 -0
- package/dist/TxRef.js.map +1 -1
- package/dist/TxSemaphore.d.ts +25 -0
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +29 -13
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/TxSubscriptionRef.d.ts +25 -0
- package/dist/TxSubscriptionRef.d.ts.map +1 -1
- package/dist/TxSubscriptionRef.js +12 -0
- package/dist/TxSubscriptionRef.js.map +1 -1
- package/dist/Types.d.ts +36 -0
- package/dist/Types.d.ts.map +1 -1
- package/dist/Types.js +1 -0
- package/dist/UndefinedOr.d.ts +15 -0
- package/dist/UndefinedOr.d.ts.map +1 -1
- package/dist/UndefinedOr.js +9 -0
- package/dist/UndefinedOr.js.map +1 -1
- package/dist/Unify.d.ts +15 -0
- package/dist/Unify.d.ts.map +1 -1
- package/dist/Unify.js +2 -0
- package/dist/Unify.js.map +1 -1
- package/dist/Utils.d.ts +4 -0
- package/dist/Utils.d.ts.map +1 -1
- package/dist/Utils.js +1 -0
- package/dist/Utils.js.map +1 -1
- package/dist/Version.d.ts +26 -0
- package/dist/Version.d.ts.map +1 -0
- package/dist/Version.js +36 -0
- package/dist/Version.js.map +1 -0
- package/dist/ai/Chat.js +1 -1
- package/dist/ai/Chat.js.map +1 -1
- package/dist/ai/DecisionModel.d.ts +22 -0
- package/dist/ai/DecisionModel.d.ts.map +1 -1
- package/dist/ai/DecisionModel.js +22 -4
- package/dist/ai/DecisionModel.js.map +1 -1
- package/dist/ai/LanguageModel.d.ts.map +1 -1
- package/dist/ai/LanguageModel.js +14 -13
- package/dist/ai/LanguageModel.js.map +1 -1
- package/dist/ai/McpServer.d.ts +38 -11
- package/dist/ai/McpServer.d.ts.map +1 -1
- package/dist/ai/McpServer.js +276 -190
- package/dist/ai/McpServer.js.map +1 -1
- package/dist/ai/Telemetry.d.ts +49 -41
- package/dist/ai/Telemetry.d.ts.map +1 -1
- package/dist/ai/Telemetry.js +6 -8
- package/dist/ai/Telemetry.js.map +1 -1
- package/dist/ai/internal/mcpProtocol/v2026_07_28.js +5 -0
- package/dist/ai/internal/mcpProtocol/v2026_07_28.js.map +1 -1
- package/dist/ai/internal/mcpProtocol.js.map +1 -1
- package/dist/ai/internal/mcpRuntime.js +80 -46
- package/dist/ai/internal/mcpRuntime.js.map +1 -1
- package/dist/ai/internal/mcpStatefulRuntime.js +1 -0
- package/dist/ai/internal/mcpStatefulRuntime.js.map +1 -1
- package/dist/cli/CliOutput.d.ts +27 -0
- package/dist/cli/CliOutput.d.ts.map +1 -1
- package/dist/cli/CliOutput.js +33 -10
- package/dist/cli/CliOutput.js.map +1 -1
- package/dist/cli/Command.d.ts.map +1 -1
- package/dist/cli/Command.js +6 -3
- package/dist/cli/Command.js.map +1 -1
- package/dist/cli/Completions.d.ts +3 -3
- package/dist/cli/Completions.d.ts.map +1 -1
- package/dist/cli/Completions.js +8 -5
- package/dist/cli/Completions.js.map +1 -1
- package/dist/cli/GlobalFlag.d.ts +5 -4
- package/dist/cli/GlobalFlag.d.ts.map +1 -1
- package/dist/cli/GlobalFlag.js +3 -3
- package/dist/cli/GlobalFlag.js.map +1 -1
- package/dist/cli/Prompt.d.ts +17 -1
- package/dist/cli/Prompt.d.ts.map +1 -1
- package/dist/cli/Prompt.js +119 -114
- package/dist/cli/Prompt.js.map +1 -1
- package/dist/cli/internal/ansi.d.ts +0 -1
- package/dist/cli/internal/ansi.d.ts.map +1 -1
- package/dist/cli/internal/ansi.js +20 -3
- package/dist/cli/internal/ansi.js.map +1 -1
- package/dist/cli/internal/completions/powershell.d.ts +2 -0
- package/dist/cli/internal/completions/powershell.d.ts.map +1 -0
- package/dist/cli/internal/completions/powershell.js +273 -0
- package/dist/cli/internal/completions/powershell.js.map +1 -0
- package/dist/cli/internal/completions/zsh.js +3 -2
- package/dist/cli/internal/completions/zsh.js.map +1 -1
- package/dist/cli/internal/wizard.d.ts +3 -3
- package/dist/cli/internal/wizard.d.ts.map +1 -1
- package/dist/cli/internal/wizard.js +21 -18
- package/dist/cli/internal/wizard.js.map +1 -1
- package/dist/cluster/ClusterSchema.d.ts +28 -0
- package/dist/cluster/ClusterSchema.d.ts.map +1 -1
- package/dist/cluster/ClusterSchema.js +30 -0
- package/dist/cluster/ClusterSchema.js.map +1 -1
- package/dist/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/cluster/ClusterWorkflowEngine.js +10 -18
- package/dist/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/cluster/K8sHttpClient.d.ts.map +1 -1
- package/dist/cluster/K8sHttpClient.js +5 -2
- package/dist/cluster/K8sHttpClient.js.map +1 -1
- package/dist/cluster/MessageStorage.d.ts +18 -3
- package/dist/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/cluster/MessageStorage.js +31 -11
- package/dist/cluster/MessageStorage.js.map +1 -1
- package/dist/cluster/Runners.d.ts.map +1 -1
- package/dist/cluster/Runners.js +8 -2
- package/dist/cluster/Runners.js.map +1 -1
- package/dist/cluster/Sharding.d.ts.map +1 -1
- package/dist/cluster/Sharding.js +181 -62
- package/dist/cluster/Sharding.js.map +1 -1
- package/dist/cluster/SqlMessageStorage.d.ts +59 -19
- package/dist/cluster/SqlMessageStorage.d.ts.map +1 -1
- package/dist/cluster/SqlMessageStorage.js +84 -55
- package/dist/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/cluster/SqlRunnerStorage.d.ts +68 -19
- package/dist/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/cluster/SqlRunnerStorage.js +191 -113
- package/dist/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/cluster/internal/entityManager.js +104 -37
- package/dist/cluster/internal/entityManager.js.map +1 -1
- package/dist/encoding/Base64.d.ts +4 -0
- package/dist/encoding/Base64.d.ts.map +1 -1
- package/dist/encoding/Base64.js +4 -0
- package/dist/encoding/Base64.js.map +1 -1
- package/dist/encoding/Base64Url.d.ts +4 -0
- package/dist/encoding/Base64Url.d.ts.map +1 -1
- package/dist/encoding/Base64Url.js +4 -0
- package/dist/encoding/Base64Url.js.map +1 -1
- package/dist/encoding/EncodingError.d.ts +4 -0
- package/dist/encoding/EncodingError.d.ts.map +1 -1
- package/dist/encoding/EncodingError.js +4 -0
- package/dist/encoding/EncodingError.js.map +1 -1
- package/dist/encoding/Hex.d.ts +5 -0
- package/dist/encoding/Hex.d.ts.map +1 -1
- package/dist/encoding/Hex.js +5 -0
- package/dist/encoding/Hex.js.map +1 -1
- package/dist/encoding/Toml.js +2 -2
- package/dist/encoding/Toml.js.map +1 -1
- package/dist/encoding/Yaml.d.ts.map +1 -1
- package/dist/encoding/Yaml.js +6 -4
- package/dist/encoding/Yaml.js.map +1 -1
- package/dist/encoding/index.d.ts +4 -0
- package/dist/encoding/index.d.ts.map +1 -1
- package/dist/encoding/index.js +4 -0
- package/dist/encoding/index.js.map +1 -1
- package/dist/eventlog/SqlEventJournal.js +8 -4
- package/dist/eventlog/SqlEventJournal.js.map +1 -1
- package/dist/eventlog/SqlEventLogServerUnencrypted.d.ts +27 -10
- package/dist/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/eventlog/SqlEventLogServerUnencrypted.js +49 -7
- package/dist/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
- package/dist/http/FindMyWay/internal/router.js +3 -6
- package/dist/http/FindMyWay/internal/router.js.map +1 -1
- package/dist/http/Headers.d.ts +3 -1
- package/dist/http/Headers.d.ts.map +1 -1
- package/dist/http/Headers.js +4 -2
- package/dist/http/Headers.js.map +1 -1
- package/dist/http/HttpClient.d.ts +15 -0
- package/dist/http/HttpClient.d.ts.map +1 -1
- package/dist/http/HttpClient.js +79 -23
- package/dist/http/HttpClient.js.map +1 -1
- package/dist/http/HttpClientResponse.js +3 -1
- package/dist/http/HttpClientResponse.js.map +1 -1
- package/dist/http/HttpEffect.d.ts +3 -0
- package/dist/http/HttpEffect.d.ts.map +1 -1
- package/dist/http/HttpEffect.js +5 -2
- package/dist/http/HttpEffect.js.map +1 -1
- package/dist/http/HttpMiddleware.d.ts +17 -0
- package/dist/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/http/HttpMiddleware.js +56 -39
- package/dist/http/HttpMiddleware.js.map +1 -1
- package/dist/http/HttpServer.d.ts +1 -1
- package/dist/http/HttpServer.d.ts.map +1 -1
- package/dist/http/HttpTraceContext.d.ts.map +1 -1
- package/dist/http/HttpTraceContext.js +4 -2
- package/dist/http/HttpTraceContext.js.map +1 -1
- package/dist/http/internal/tracing.d.ts +2 -0
- package/dist/http/internal/tracing.d.ts.map +1 -0
- package/dist/http/internal/tracing.js +37 -0
- package/dist/http/internal/tracing.js.map +1 -0
- package/dist/http-api/HttpApiBuilder.js +2 -1
- package/dist/http-api/HttpApiBuilder.js.map +1 -1
- package/dist/http-api/HttpApiClient.d.ts +12 -3
- package/dist/http-api/HttpApiClient.d.ts.map +1 -1
- package/dist/http-api/HttpApiClient.js.map +1 -1
- package/dist/http-api/HttpApiError.d.ts +4 -3
- package/dist/http-api/HttpApiError.d.ts.map +1 -1
- package/dist/http-api/HttpApiError.js +7 -4
- package/dist/http-api/HttpApiError.js.map +1 -1
- package/dist/http-api/HttpApiSecurity.d.ts +8 -8
- package/dist/http-api/HttpApiSecurity.js +8 -8
- package/dist/index.d.ts +155 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +155 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/arbitrary/array.js +3 -3
- package/dist/internal/arbitrary/array.js.map +1 -1
- package/dist/internal/arbitrary/model.js +26 -11
- package/dist/internal/arbitrary/model.js.map +1 -1
- package/dist/internal/arbitrary/runner.js +8 -8
- package/dist/internal/arbitrary/runner.js.map +1 -1
- package/dist/internal/arbitrary/schema.js +4 -5
- package/dist/internal/arbitrary/schema.js.map +1 -1
- package/dist/internal/effect.js +53 -46
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/schedule.js +7 -5
- package/dist/internal/schedule.js.map +1 -1
- package/dist/internal/schema/standardSchema.js +2 -2
- package/dist/internal/schema/standardSchema.js.map +1 -1
- package/dist/internal/version.d.ts +2 -0
- package/dist/internal/version.d.ts.map +1 -0
- package/dist/internal/version.js +3 -0
- package/dist/internal/version.js.map +1 -0
- package/dist/net/AddressResolver.d.ts +145 -0
- package/dist/net/AddressResolver.d.ts.map +1 -0
- package/dist/net/AddressResolver.js +114 -0
- package/dist/net/AddressResolver.js.map +1 -0
- package/dist/net/Dns.d.ts +596 -0
- package/dist/net/Dns.d.ts.map +1 -0
- package/dist/net/Dns.js +549 -0
- package/dist/net/Dns.js.map +1 -0
- package/dist/net/Host.d.ts +320 -0
- package/dist/net/Host.d.ts.map +1 -0
- package/dist/net/Host.js +342 -0
- package/dist/net/Host.js.map +1 -0
- package/dist/net/IpInterface.d.ts +76 -3
- package/dist/net/IpInterface.d.ts.map +1 -1
- package/dist/net/IpInterface.js +53 -4
- package/dist/net/IpInterface.js.map +1 -1
- package/dist/net/IpNetwork.d.ts +82 -8
- package/dist/net/IpNetwork.d.ts.map +1 -1
- package/dist/net/IpNetwork.js +60 -4
- package/dist/net/IpNetwork.js.map +1 -1
- package/dist/net/NetAddress.d.ts +388 -35
- package/dist/net/NetAddress.d.ts.map +1 -1
- package/dist/net/NetAddress.js +350 -34
- package/dist/net/NetAddress.js.map +1 -1
- package/dist/net/index.d.ts +15 -0
- package/dist/net/index.d.ts.map +1 -1
- package/dist/net/index.js +15 -0
- package/dist/net/index.js.map +1 -1
- package/dist/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/observability/OtlpExporter.js +5 -6
- package/dist/observability/OtlpExporter.js.map +1 -1
- package/dist/observability/OtlpLogger.d.ts.map +1 -1
- package/dist/observability/OtlpLogger.js +23 -27
- package/dist/observability/OtlpLogger.js.map +1 -1
- package/dist/observability/OtlpMetrics.d.ts +5 -3
- package/dist/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/observability/OtlpMetrics.js +36 -115
- package/dist/observability/OtlpMetrics.js.map +1 -1
- package/dist/observability/OtlpResource.d.ts +4 -3
- package/dist/observability/OtlpResource.d.ts.map +1 -1
- package/dist/observability/OtlpResource.js +20 -23
- package/dist/observability/OtlpResource.js.map +1 -1
- package/dist/observability/OtlpTracer.d.ts +1 -0
- package/dist/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/observability/OtlpTracer.js +32 -36
- package/dist/observability/OtlpTracer.js.map +1 -1
- package/dist/observability/PrometheusMetrics.js +1 -0
- package/dist/observability/PrometheusMetrics.js.map +1 -1
- package/dist/observability/internal/otlpProtobuf.js +32 -1
- package/dist/observability/internal/otlpProtobuf.js.map +1 -1
- package/dist/persistence/PersistedQueue.d.ts +32 -3
- package/dist/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/persistence/PersistedQueue.js +75 -16
- package/dist/persistence/PersistedQueue.js.map +1 -1
- package/dist/reactivity/AsyncResult.d.ts +1 -1
- package/dist/reactivity/Atom.d.ts +5 -5
- package/dist/reactivity/Atom.d.ts.map +1 -1
- package/dist/reactivity/Atom.js +9 -5
- package/dist/reactivity/Atom.js.map +1 -1
- package/dist/reactivity/AtomHttpApi.d.ts +2 -2
- package/dist/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/reactivity/AtomRegistry.d.ts +8 -0
- package/dist/reactivity/AtomRegistry.d.ts.map +1 -1
- package/dist/reactivity/AtomRegistry.js.map +1 -1
- package/dist/rpc/RpcClient.d.ts +41 -7
- package/dist/rpc/RpcClient.d.ts.map +1 -1
- package/dist/rpc/RpcClient.js +50 -25
- package/dist/rpc/RpcClient.js.map +1 -1
- package/dist/rpc/RpcServer.d.ts +6 -0
- package/dist/rpc/RpcServer.d.ts.map +1 -1
- package/dist/rpc/RpcServer.js +59 -40
- package/dist/rpc/RpcServer.js.map +1 -1
- package/dist/rpc/internal/tracing.d.ts +2 -0
- package/dist/rpc/internal/tracing.d.ts.map +1 -0
- package/dist/rpc/internal/tracing.js +18 -0
- package/dist/rpc/internal/tracing.js.map +1 -0
- package/dist/schema/SchemaCompiler/runtime.js +9 -1
- package/dist/schema/SchemaCompiler/runtime.js.map +1 -1
- package/dist/socket/DatagramSocket.d.ts +456 -0
- package/dist/socket/DatagramSocket.d.ts.map +1 -0
- package/dist/socket/DatagramSocket.js +535 -0
- package/dist/socket/DatagramSocket.js.map +1 -0
- package/dist/socket/Socket.d.ts +14 -1
- package/dist/socket/Socket.d.ts.map +1 -1
- package/dist/socket/Socket.js +9 -1
- package/dist/socket/Socket.js.map +1 -1
- package/dist/socket/index.d.ts +5 -0
- package/dist/socket/index.d.ts.map +1 -1
- package/dist/socket/index.js +5 -0
- package/dist/socket/index.js.map +1 -1
- package/dist/sql/Migrator.d.ts.map +1 -1
- package/dist/sql/Migrator.js +7 -2
- package/dist/sql/Migrator.js.map +1 -1
- package/dist/sql/SqlClient.d.ts +7 -1
- package/dist/sql/SqlClient.d.ts.map +1 -1
- package/dist/sql/SqlClient.js +35 -10
- package/dist/sql/SqlClient.js.map +1 -1
- package/dist/sql/Statement.d.ts +21 -1
- package/dist/sql/Statement.d.ts.map +1 -1
- package/dist/sql/Statement.js +55 -7
- package/dist/sql/Statement.js.map +1 -1
- package/dist/testing/TestClock.d.ts +8 -0
- package/dist/testing/TestClock.d.ts.map +1 -1
- package/dist/testing/TestClock.js +7 -0
- package/dist/testing/TestClock.js.map +1 -1
- package/dist/testing/TestConsole.d.ts +7 -0
- package/dist/testing/TestConsole.d.ts.map +1 -1
- package/dist/testing/TestConsole.js +6 -0
- package/dist/testing/TestConsole.js.map +1 -1
- package/dist/testing/TestCrypto.d.ts +73 -0
- package/dist/testing/TestCrypto.d.ts.map +1 -0
- package/dist/testing/TestCrypto.js +87 -0
- package/dist/testing/TestCrypto.js.map +1 -0
- package/dist/testing/index.d.ts +8 -0
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +8 -0
- package/dist/testing/index.js.map +1 -1
- package/dist/workflow/DurableDeferred.d.ts +54 -0
- package/dist/workflow/DurableDeferred.d.ts.map +1 -1
- package/dist/workflow/DurableDeferred.js +78 -49
- package/dist/workflow/DurableDeferred.js.map +1 -1
- package/dist/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/workflow/WorkflowEngine.js +2 -1
- package/dist/workflow/WorkflowEngine.js.map +1 -1
- package/package.json +3 -3
- package/src/Array.ts +351 -3
- package/src/BigDecimal.ts +88 -0
- package/src/BigInt.ts +68 -0
- package/src/Boolean.ts +34 -0
- package/src/Brand.ts +10 -0
- package/src/ByteSize.ts +87 -0
- package/src/Cache.ts +50 -8
- package/src/Cause.ts +82 -0
- package/src/Channel.ts +368 -18
- package/src/ChannelSchema.ts +13 -0
- package/src/Chunk.ts +193 -0
- package/src/Clock.ts +7 -0
- package/src/Combiner.ts +10 -0
- package/src/Config.ts +82 -8
- package/src/ConfigProvider.ts +28 -0
- package/src/Console.ts +26 -0
- package/src/Context.ts +53 -3
- package/src/Cron.ts +32 -1
- package/src/Crypto.ts +48 -9
- package/src/Data.ts +13 -0
- package/src/DateTime.ts +180 -6
- package/src/Deferred.ts +51 -0
- package/src/Differ.ts +2 -0
- package/src/Duration.ts +126 -16
- package/src/Effect.ts +539 -5
- package/src/Effectable.ts +4 -0
- package/src/Equal.ts +12 -1
- package/src/Equivalence.ts +22 -0
- package/src/ErrorReporter.ts +36 -0
- package/src/ExecutionPlan.ts +58 -14
- package/src/Exit.ts +40 -0
- package/src/Fiber.ts +20 -0
- package/src/FiberHandle.ts +29 -4
- package/src/FiberMap.ts +38 -0
- package/src/FiberSet.ts +21 -0
- package/src/FileSystem.ts +64 -2
- package/src/Filter.ts +55 -0
- package/src/Formatter.ts +42 -1
- package/src/Function.ts +30 -0
- package/src/Graph.ts +317 -36
- package/src/HKT.ts +5 -0
- package/src/Hash.ts +15 -0
- package/src/HashMap.ts +91 -0
- package/src/HashRing.ts +18 -0
- package/src/HashSet.ts +53 -0
- package/src/Inspectable.ts +8 -0
- package/src/Iterable.ts +127 -0
- package/src/JsonPatch.ts +5 -0
- package/src/JsonPointer.ts +5 -0
- package/src/JsonSchema.ts +17 -0
- package/src/Latch.ts +14 -0
- package/src/Layer.ts +101 -1
- package/src/LayerMap.ts +7 -0
- package/src/LayerRef.ts +5 -0
- package/src/LogLevel.ts +20 -0
- package/src/Logger.ts +41 -5
- package/src/ManagedRuntime.ts +12 -1
- package/src/Match.ts +52 -0
- package/src/Metric.ts +69 -0
- package/src/MutableHashMap.ts +44 -0
- package/src/MutableHashSet.ts +17 -0
- package/src/MutableList.ts +21 -0
- package/src/MutableRef.ts +32 -0
- package/src/Newtype.ts +9 -0
- package/src/NonEmptyIterable.ts +4 -0
- package/src/Number.ts +61 -0
- package/src/Optic.ts +57 -0
- package/src/Option.ts +134 -0
- package/src/Order.ts +30 -0
- package/src/Ordering.ts +7 -0
- package/src/PartitionedSemaphore.ts +61 -22
- package/src/Path.ts +6 -0
- package/src/Pipeable.ts +7 -0
- package/src/PlatformError.ts +8 -0
- package/src/Pool.ts +20 -1
- package/src/Predicate.ts +85 -0
- package/src/PrimaryKey.ts +5 -0
- package/src/PubSub.ts +90 -9
- package/src/Pull.ts +20 -0
- package/src/Queue.ts +80 -10
- package/src/Random.ts +13 -0
- package/src/RcMap.ts +23 -0
- package/src/RcRef.ts +6 -0
- package/src/Record.ts +100 -0
- package/src/Redactable.ts +6 -0
- package/src/Redacted.ts +8 -0
- package/src/Reducer.ts +4 -0
- package/src/Ref.ts +42 -0
- package/src/References.ts +21 -0
- package/src/RegExp.ts +4 -0
- package/src/Request.ts +32 -0
- package/src/RequestResolver.ts +59 -10
- package/src/Resource.ts +7 -0
- package/src/Result.ts +93 -0
- package/src/Runtime.ts +10 -0
- package/src/Schedule.ts +61 -0
- package/src/Scheduler.ts +7 -0
- package/src/Schema.ts +1168 -9
- package/src/SchemaAST.ts +115 -1
- package/src/SchemaGetter.ts +80 -4
- package/src/SchemaIssue.ts +34 -0
- package/src/SchemaParser.ts +26 -0
- package/src/SchemaRepresentation.ts +148 -0
- package/src/SchemaTransformation.ts +53 -0
- package/src/Scope.ts +19 -0
- package/src/ScopedCache.ts +55 -3
- package/src/ScopedRef.ts +9 -0
- package/src/Semaphore.ts +26 -0
- package/src/Sink.ts +126 -2
- package/src/StandardSchema.ts +1 -0
- package/src/Stdio.ts +16 -2
- package/src/Stream.ts +633 -26
- package/src/String.ts +87 -0
- package/src/Struct.ts +46 -0
- package/src/SubscriptionRef.ts +65 -0
- package/src/Symbol.ts +2 -0
- package/src/SynchronizedRef.ts +63 -0
- package/src/Take.ts +3 -0
- package/src/Terminal.ts +8 -0
- package/src/Tracer.ts +23 -0
- package/src/Trie.ts +68 -0
- package/src/Tuple.ts +38 -0
- package/src/TxChunk.ts +52 -0
- package/src/TxDeferred.ts +15 -0
- package/src/TxHashMap.ts +97 -6
- package/src/TxHashSet.ts +83 -3
- package/src/TxPriorityQueue.ts +34 -2
- package/src/TxPubSub.ts +26 -0
- package/src/TxQueue.ts +51 -0
- package/src/TxReentrantLock.ts +53 -36
- package/src/TxRef.ts +14 -0
- package/src/TxSemaphore.ts +47 -31
- package/src/TxSubscriptionRef.ts +25 -0
- package/src/Types.ts +36 -0
- package/src/UndefinedOr.ts +15 -0
- package/src/Unify.ts +15 -0
- package/src/Utils.ts +4 -0
- package/src/Version.ts +38 -0
- package/src/ai/Chat.ts +1 -1
- package/src/ai/DecisionModel.ts +42 -1
- package/src/ai/LanguageModel.ts +16 -19
- package/src/ai/McpServer.ts +169 -58
- package/src/ai/Telemetry.ts +62 -58
- package/src/ai/internal/mcpProtocol/v2026_07_28.ts +5 -0
- package/src/ai/internal/mcpProtocol.ts +3 -0
- package/src/ai/internal/mcpRuntime.ts +86 -43
- package/src/ai/internal/mcpStatefulRuntime.ts +2 -0
- package/src/cli/CliOutput.ts +33 -16
- package/src/cli/Command.ts +4 -3
- package/src/cli/Completions.ts +9 -6
- package/src/cli/GlobalFlag.ts +19 -11
- package/src/cli/Prompt.ts +159 -149
- package/src/cli/internal/ansi.ts +26 -3
- package/src/cli/internal/completions/powershell.ts +322 -0
- package/src/cli/internal/completions/zsh.ts +4 -2
- package/src/cli/internal/wizard.ts +34 -26
- package/src/cluster/ClusterSchema.ts +32 -0
- package/src/cluster/ClusterWorkflowEngine.ts +13 -24
- package/src/cluster/K8sHttpClient.ts +12 -2
- package/src/cluster/MessageStorage.ts +45 -14
- package/src/cluster/Runners.ts +8 -2
- package/src/cluster/Sharding.ts +207 -49
- package/src/cluster/SqlMessageStorage.ts +118 -84
- package/src/cluster/SqlRunnerStorage.ts +224 -128
- package/src/cluster/internal/entityManager.ts +151 -55
- package/src/encoding/Base64.ts +4 -0
- package/src/encoding/Base64Url.ts +4 -0
- package/src/encoding/EncodingError.ts +5 -0
- package/src/encoding/Hex.ts +5 -0
- package/src/encoding/Toml.ts +2 -2
- package/src/encoding/Yaml.ts +8 -4
- package/src/encoding/index.ts +4 -0
- package/src/eventlog/SqlEventJournal.ts +18 -4
- package/src/eventlog/SqlEventLogServerUnencrypted.ts +282 -235
- package/src/http/FindMyWay/internal/router.ts +4 -7
- package/src/http/Headers.ts +8 -2
- package/src/http/HttpClient.ts +100 -29
- package/src/http/HttpClientResponse.ts +3 -1
- package/src/http/HttpEffect.ts +11 -2
- package/src/http/HttpMiddleware.ts +60 -45
- package/src/http/HttpServer.ts +1 -1
- package/src/http/HttpTraceContext.ts +8 -2
- package/src/http/internal/tracing.ts +52 -0
- package/src/http-api/HttpApiBuilder.ts +5 -1
- package/src/http-api/HttpApiClient.ts +13 -4
- package/src/http-api/HttpApiError.ts +8 -4
- package/src/http-api/HttpApiSecurity.ts +8 -8
- package/src/index.ts +156 -0
- package/src/internal/arbitrary/array.ts +3 -3
- package/src/internal/arbitrary/model.ts +37 -14
- package/src/internal/arbitrary/runner.ts +7 -7
- package/src/internal/arbitrary/schema.ts +4 -3
- package/src/internal/effect.ts +62 -58
- package/src/internal/schedule.ts +23 -17
- package/src/internal/schema/standardSchema.ts +2 -2
- package/src/internal/version.ts +2 -0
- package/src/net/AddressResolver.ts +222 -0
- package/src/net/Dns.ts +1035 -0
- package/src/net/Host.ts +472 -0
- package/src/net/IpInterface.ts +117 -7
- package/src/net/IpNetwork.ts +116 -17
- package/src/net/NetAddress.ts +611 -76
- package/src/net/index.ts +18 -0
- package/src/observability/OtlpExporter.ts +9 -6
- package/src/observability/OtlpLogger.ts +20 -21
- package/src/observability/OtlpMetrics.ts +46 -116
- package/src/observability/OtlpResource.ts +18 -27
- package/src/observability/OtlpTracer.ts +34 -40
- package/src/observability/PrometheusMetrics.ts +1 -0
- package/src/observability/internal/otlpProtobuf.ts +60 -0
- package/src/persistence/PersistedQueue.ts +146 -53
- package/src/reactivity/AsyncResult.ts +1 -1
- package/src/reactivity/Atom.ts +10 -6
- package/src/reactivity/AtomHttpApi.ts +2 -4
- package/src/reactivity/AtomRegistry.ts +7 -0
- package/src/rpc/RpcClient.ts +87 -41
- package/src/rpc/RpcServer.ts +85 -48
- package/src/rpc/internal/tracing.ts +22 -0
- package/src/schema/SchemaCompiler/runtime.ts +4 -1
- package/src/socket/DatagramSocket.ts +919 -0
- package/src/socket/Socket.ts +22 -2
- package/src/socket/index.ts +6 -0
- package/src/sql/Migrator.ts +21 -5
- package/src/sql/SqlClient.ts +43 -19
- package/src/sql/Statement.ts +59 -7
- package/src/testing/TestClock.ts +9 -0
- package/src/testing/TestConsole.ts +8 -0
- package/src/testing/TestCrypto.ts +94 -0
- package/src/testing/index.ts +9 -0
- package/src/workflow/DurableDeferred.ts +123 -48
- package/src/workflow/WorkflowEngine.ts +2 -1
package/src/net/NetAddress.ts
CHANGED
|
@@ -9,10 +9,11 @@ import * as Data from "../Data.ts"
|
|
|
9
9
|
import * as Equal from "../Equal.ts"
|
|
10
10
|
import { dual } from "../Function.ts"
|
|
11
11
|
import * as Hash from "../Hash.ts"
|
|
12
|
-
import
|
|
12
|
+
import * as Inspectable from "../Inspectable.ts"
|
|
13
13
|
import * as Option from "../Option.ts"
|
|
14
|
-
import { hasProperty } from "../Predicate.ts"
|
|
14
|
+
import { hasProperty, isTupleOf } from "../Predicate.ts"
|
|
15
15
|
import * as Result from "../Result.ts"
|
|
16
|
+
import type { TupleOf } from "../Types.ts"
|
|
16
17
|
|
|
17
18
|
const TypeId = "~effect/net/NetAddress" as const
|
|
18
19
|
|
|
@@ -23,11 +24,9 @@ const TypeId = "~effect/net/NetAddress" as const
|
|
|
23
24
|
* @category models
|
|
24
25
|
* @since 4.0.0
|
|
25
26
|
*/
|
|
26
|
-
export interface Ipv4Address extends Equal.Equal, Hash.Hash {
|
|
27
|
+
export interface Ipv4Address extends Equal.Equal, Hash.Hash, Inspectable.Inspectable {
|
|
27
28
|
readonly _tag: "Ipv4Address"
|
|
28
29
|
readonly [TypeId]: typeof TypeId
|
|
29
|
-
toString(): string
|
|
30
|
-
toJSON(): string
|
|
31
30
|
}
|
|
32
31
|
|
|
33
32
|
/**
|
|
@@ -37,11 +36,9 @@ export interface Ipv4Address extends Equal.Equal, Hash.Hash {
|
|
|
37
36
|
* @category models
|
|
38
37
|
* @since 4.0.0
|
|
39
38
|
*/
|
|
40
|
-
export interface Ipv6Address extends Equal.Equal, Hash.Hash {
|
|
39
|
+
export interface Ipv6Address extends Equal.Equal, Hash.Hash, Inspectable.Inspectable {
|
|
41
40
|
readonly _tag: "Ipv6Address"
|
|
42
41
|
readonly [TypeId]: typeof TypeId
|
|
43
|
-
toString(): string
|
|
44
|
-
toJSON(): string
|
|
45
42
|
}
|
|
46
43
|
|
|
47
44
|
/**
|
|
@@ -53,6 +50,89 @@ export interface Ipv6Address extends Equal.Equal, Hash.Hash {
|
|
|
53
50
|
*/
|
|
54
51
|
export type IpAddress = Ipv4Address | Ipv6Address
|
|
55
52
|
|
|
53
|
+
/**
|
|
54
|
+
* The four octets of an IPv4 address in network order.
|
|
55
|
+
*
|
|
56
|
+
* @stability unstable
|
|
57
|
+
* @category models
|
|
58
|
+
* @since 4.0.0
|
|
59
|
+
*/
|
|
60
|
+
export type Ipv4Octets = Readonly<TupleOf<4, number>>
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* The eight 16-bit segments of an IPv6 address in network order.
|
|
64
|
+
*
|
|
65
|
+
* @stability unstable
|
|
66
|
+
* @category models
|
|
67
|
+
* @since 4.0.0
|
|
68
|
+
*/
|
|
69
|
+
export type Ipv6Segments = Readonly<TupleOf<8, number>>
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* The six octets of a MAC address in transmission order.
|
|
73
|
+
*
|
|
74
|
+
* @stability unstable
|
|
75
|
+
* @category models
|
|
76
|
+
* @since 4.0.0
|
|
77
|
+
*/
|
|
78
|
+
export type MacAddressOctets = Readonly<TupleOf<6, number>>
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* An IPv4 address, or a string, four octets, or four network-order bytes to
|
|
82
|
+
* convert to one.
|
|
83
|
+
*
|
|
84
|
+
* @stability unstable
|
|
85
|
+
* @category models
|
|
86
|
+
* @since 4.0.0
|
|
87
|
+
*/
|
|
88
|
+
export type Ipv4AddressInput = Ipv4Address | string | Ipv4Octets | Uint8Array
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* An IPv6 address, or a string, eight 16-bit segments, or sixteen
|
|
92
|
+
* network-order bytes to convert to one.
|
|
93
|
+
*
|
|
94
|
+
* @stability unstable
|
|
95
|
+
* @category models
|
|
96
|
+
* @since 4.0.0
|
|
97
|
+
*/
|
|
98
|
+
export type Ipv6AddressInput = Ipv6Address | string | Ipv6Segments | Uint8Array
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* An IP address, or any `Ipv4AddressInput` or `Ipv6AddressInput` to convert to
|
|
102
|
+
* one.
|
|
103
|
+
*
|
|
104
|
+
* @stability unstable
|
|
105
|
+
* @category models
|
|
106
|
+
* @since 4.0.0
|
|
107
|
+
*/
|
|
108
|
+
export type IpAddressInput = Ipv4AddressInput | Ipv6AddressInput
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* An IPv6 literal with a zone, such as `fe80::1%eth0` or `fe80::1%3`.
|
|
112
|
+
*
|
|
113
|
+
* **Details**
|
|
114
|
+
*
|
|
115
|
+
* Named zones are kept as written because mapping an interface name to a
|
|
116
|
+
* numeric scope ID requires the operating system's interface table. Numeric
|
|
117
|
+
* zones must be unsigned 32-bit integers and are stored without leading zeros,
|
|
118
|
+
* and the address part is stored in canonical form.
|
|
119
|
+
*
|
|
120
|
+
* @see {@link scopedIpv6LiteralFromString} for parsing scoped IPv6 literals
|
|
121
|
+
* @stability experimental
|
|
122
|
+
* @category models
|
|
123
|
+
* @since 4.0.0
|
|
124
|
+
*/
|
|
125
|
+
export type ScopedIpv6Literal = Brand.Branded<string, "~effect/net/NetAddress/ScopedIpv6Literal">
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* A scoped IPv6 literal or a string to parse as one.
|
|
129
|
+
*
|
|
130
|
+
* @stability experimental
|
|
131
|
+
* @category models
|
|
132
|
+
* @since 4.0.0
|
|
133
|
+
*/
|
|
134
|
+
export type ScopedIpv6LiteralInput = ScopedIpv6Literal | string
|
|
135
|
+
|
|
56
136
|
/**
|
|
57
137
|
* An immutable 48-bit IEEE 802 MAC address.
|
|
58
138
|
*
|
|
@@ -60,13 +140,20 @@ export type IpAddress = Ipv4Address | Ipv6Address
|
|
|
60
140
|
* @category models
|
|
61
141
|
* @since 4.0.0
|
|
62
142
|
*/
|
|
63
|
-
export interface MacAddress extends Equal.Equal, Hash.Hash {
|
|
143
|
+
export interface MacAddress extends Equal.Equal, Hash.Hash, Inspectable.Inspectable {
|
|
64
144
|
readonly _tag: "MacAddress"
|
|
65
145
|
readonly [TypeId]: typeof TypeId
|
|
66
|
-
toString(): string
|
|
67
|
-
toJSON(): string
|
|
68
146
|
}
|
|
69
147
|
|
|
148
|
+
/**
|
|
149
|
+
* A MAC address, or a string or six octets to convert to one.
|
|
150
|
+
*
|
|
151
|
+
* @stability unstable
|
|
152
|
+
* @category models
|
|
153
|
+
* @since 4.0.0
|
|
154
|
+
*/
|
|
155
|
+
export type MacAddressInput = MacAddress | string | MacAddressOctets
|
|
156
|
+
|
|
70
157
|
const MulticastTypeId = "~effect/net/NetAddress/MulticastAddress" as const
|
|
71
158
|
const UnicastTypeId = "~effect/net/NetAddress/UnicastAddress" as const
|
|
72
159
|
const BroadcastTypeId = "~effect/net/NetAddress/BroadcastAddress" as const
|
|
@@ -228,13 +315,11 @@ const getMacBytes = (self: MacAddress): Uint8Array => (self as any).bytes
|
|
|
228
315
|
* @category models
|
|
229
316
|
* @since 4.0.0
|
|
230
317
|
*/
|
|
231
|
-
export interface InetAddressV4 extends Equal.Equal, Hash.Hash {
|
|
318
|
+
export interface InetAddressV4 extends Equal.Equal, Hash.Hash, Inspectable.Inspectable {
|
|
232
319
|
readonly _tag: "InetAddressV4"
|
|
233
320
|
readonly address: Ipv4Address
|
|
234
321
|
readonly port: number
|
|
235
322
|
readonly [TypeId]: typeof TypeId
|
|
236
|
-
toString(): string
|
|
237
|
-
toJSON(): string
|
|
238
323
|
}
|
|
239
324
|
|
|
240
325
|
/**
|
|
@@ -244,14 +329,12 @@ export interface InetAddressV4 extends Equal.Equal, Hash.Hash {
|
|
|
244
329
|
* @category models
|
|
245
330
|
* @since 4.0.0
|
|
246
331
|
*/
|
|
247
|
-
export interface InetAddressV6 extends Equal.Equal, Hash.Hash {
|
|
332
|
+
export interface InetAddressV6 extends Equal.Equal, Hash.Hash, Inspectable.Inspectable {
|
|
248
333
|
readonly _tag: "InetAddressV6"
|
|
249
334
|
readonly address: Ipv6Address
|
|
250
335
|
readonly port: number
|
|
251
336
|
readonly scopeId: number
|
|
252
337
|
readonly [TypeId]: typeof TypeId
|
|
253
|
-
toString(): string
|
|
254
|
-
toJSON(): string
|
|
255
338
|
}
|
|
256
339
|
|
|
257
340
|
/**
|
|
@@ -263,6 +346,32 @@ export interface InetAddressV6 extends Equal.Equal, Hash.Hash {
|
|
|
263
346
|
*/
|
|
264
347
|
export type InetAddress = InetAddressV4 | InetAddressV6
|
|
265
348
|
|
|
349
|
+
/**
|
|
350
|
+
* The address, port, and optional IPv6 scope identifier of an internet address.
|
|
351
|
+
*
|
|
352
|
+
* **Details**
|
|
353
|
+
*
|
|
354
|
+
* A nonzero `scopeId` is only valid with an IPv6 address.
|
|
355
|
+
*
|
|
356
|
+
* @stability unstable
|
|
357
|
+
* @category models
|
|
358
|
+
* @since 4.0.0
|
|
359
|
+
*/
|
|
360
|
+
export interface InetAddressParts<A extends IpAddressInput = IpAddressInput> {
|
|
361
|
+
readonly address: A
|
|
362
|
+
readonly port: number
|
|
363
|
+
readonly scopeId?: number | undefined
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
/**
|
|
367
|
+
* An internet address and port, or a string or parts to convert to one.
|
|
368
|
+
*
|
|
369
|
+
* @stability unstable
|
|
370
|
+
* @category models
|
|
371
|
+
* @since 4.0.0
|
|
372
|
+
*/
|
|
373
|
+
export type InetAddressInput = InetAddress | string | InetAddressParts
|
|
374
|
+
|
|
266
375
|
/**
|
|
267
376
|
* An opaque Unix-domain filesystem socket path.
|
|
268
377
|
*
|
|
@@ -270,12 +379,10 @@ export type InetAddress = InetAddressV4 | InetAddressV6
|
|
|
270
379
|
* @category models
|
|
271
380
|
* @since 4.0.0
|
|
272
381
|
*/
|
|
273
|
-
export interface UnixPathAddress extends Equal.Equal, Hash.Hash {
|
|
382
|
+
export interface UnixPathAddress extends Equal.Equal, Hash.Hash, Inspectable.Inspectable {
|
|
274
383
|
readonly _tag: "UnixPathAddress"
|
|
275
384
|
readonly path: string
|
|
276
385
|
readonly [TypeId]: typeof TypeId
|
|
277
|
-
toString(): string
|
|
278
|
-
toJSON(): string
|
|
279
386
|
}
|
|
280
387
|
|
|
281
388
|
/**
|
|
@@ -287,6 +394,17 @@ export interface UnixPathAddress extends Equal.Equal, Hash.Hash {
|
|
|
287
394
|
*/
|
|
288
395
|
export type SocketAddress = InetAddress | UnixPathAddress
|
|
289
396
|
|
|
397
|
+
/**
|
|
398
|
+
* The path of a Unix-domain socket address.
|
|
399
|
+
*
|
|
400
|
+
* @stability unstable
|
|
401
|
+
* @category models
|
|
402
|
+
* @since 4.0.0
|
|
403
|
+
*/
|
|
404
|
+
export interface UnixPathAddressParts {
|
|
405
|
+
readonly path: string
|
|
406
|
+
}
|
|
407
|
+
|
|
290
408
|
/**
|
|
291
409
|
* Companion types for constructing socket addresses.
|
|
292
410
|
*
|
|
@@ -300,18 +418,14 @@ export declare namespace SocketAddress {
|
|
|
300
418
|
*
|
|
301
419
|
* **Details**
|
|
302
420
|
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
421
|
+
* Accepts any `InetAddressInput` or a Unix path. String inputs must use
|
|
422
|
+
* `IPv4:port` or `[IPv6]:port` notation.
|
|
305
423
|
*
|
|
306
424
|
* @stability unstable
|
|
307
425
|
* @category models
|
|
308
426
|
* @since 4.0.0
|
|
309
427
|
*/
|
|
310
|
-
export type Input =
|
|
311
|
-
| SocketAddress
|
|
312
|
-
| string
|
|
313
|
-
| { readonly address: IpAddress | string; readonly port: number }
|
|
314
|
-
| { readonly path: string }
|
|
428
|
+
export type Input = SocketAddress | InetAddressInput | UnixPathAddressParts
|
|
315
429
|
}
|
|
316
430
|
|
|
317
431
|
/**
|
|
@@ -338,6 +452,29 @@ export declare namespace SocketAddress {
|
|
|
338
452
|
export type Family<A extends IpAddress | InetAddress> = A extends Ipv4Address | InetAddressV4 ? Ipv4Address
|
|
339
453
|
: Ipv6Address
|
|
340
454
|
|
|
455
|
+
/**
|
|
456
|
+
* The name of an IP address family, spelled as in `os.networkInterfaces()` and
|
|
457
|
+
* socket address information on Node.js, Deno, and Bun.
|
|
458
|
+
*
|
|
459
|
+
* @see {@link familyOf} for reading the family of an address
|
|
460
|
+
* @see {@link FamilyAddress} for the address type of a family
|
|
461
|
+
* @stability experimental
|
|
462
|
+
* @category models
|
|
463
|
+
* @since 4.0.0
|
|
464
|
+
*/
|
|
465
|
+
export type IpFamily = "IPv4" | "IPv6"
|
|
466
|
+
|
|
467
|
+
/**
|
|
468
|
+
* The IP address type for an IP address family name. `FamilyAddress<IpFamily>`
|
|
469
|
+
* is `IpAddress`.
|
|
470
|
+
*
|
|
471
|
+
* @see {@link Family} for the inverse mapping from an address type
|
|
472
|
+
* @stability experimental
|
|
473
|
+
* @category models
|
|
474
|
+
* @since 4.0.0
|
|
475
|
+
*/
|
|
476
|
+
export type FamilyAddress<F extends IpFamily> = F extends "IPv4" ? Ipv4Address : Ipv6Address
|
|
477
|
+
|
|
341
478
|
/**
|
|
342
479
|
* The internet address type for an IP address family.
|
|
343
480
|
*
|
|
@@ -444,6 +581,93 @@ export const isIpAddress = (u: unknown): u is IpAddress => isIpv4Address(u) || i
|
|
|
444
581
|
*/
|
|
445
582
|
export const width = (address: IpAddress): 32 | 128 => isIpv4Address(address) ? 32 : 128
|
|
446
583
|
|
|
584
|
+
/**
|
|
585
|
+
* Returns the family of an IP address or internet address.
|
|
586
|
+
*
|
|
587
|
+
* **Example** (Reading address families)
|
|
588
|
+
*
|
|
589
|
+
* ```ts import.meta.vitest
|
|
590
|
+
* import { NetAddress } from "effect/net"
|
|
591
|
+
*
|
|
592
|
+
* NetAddress.familyOf(NetAddress.ipv4Loopback) // => "IPv4"
|
|
593
|
+
* NetAddress.familyOf(NetAddress.inetAddressFromStringUnsafe("[::1]:80")) // => "IPv6"
|
|
594
|
+
* ```
|
|
595
|
+
*
|
|
596
|
+
* @stability experimental
|
|
597
|
+
* @category getters
|
|
598
|
+
* @since 4.0.0
|
|
599
|
+
*/
|
|
600
|
+
export const familyOf = (self: IpAddress | InetAddress): IpFamily =>
|
|
601
|
+
isIpv4Address(self) || isInetAddressV4(self) ? "IPv4" : "IPv6"
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Returns `true` when an IP address or internet address belongs to a family,
|
|
605
|
+
* narrowing it to that family.
|
|
606
|
+
*
|
|
607
|
+
* @stability experimental
|
|
608
|
+
* @category predicates
|
|
609
|
+
* @since 4.0.0
|
|
610
|
+
*/
|
|
611
|
+
export const isFamily: {
|
|
612
|
+
/**
|
|
613
|
+
* Returns `true` when an IP address or internet address belongs to a family,
|
|
614
|
+
* narrowing it to that family.
|
|
615
|
+
*
|
|
616
|
+
* @stability experimental
|
|
617
|
+
* @category predicates
|
|
618
|
+
* @since 4.0.0
|
|
619
|
+
*/
|
|
620
|
+
(family: "IPv4"): <A extends IpAddress | InetAddress>(self: A) => self is Extract<A, Ipv4Address | InetAddressV4>
|
|
621
|
+
/**
|
|
622
|
+
* Returns `true` when an IP address or internet address belongs to a family,
|
|
623
|
+
* narrowing it to that family.
|
|
624
|
+
*
|
|
625
|
+
* @stability experimental
|
|
626
|
+
* @category predicates
|
|
627
|
+
* @since 4.0.0
|
|
628
|
+
*/
|
|
629
|
+
(family: "IPv6"): <A extends IpAddress | InetAddress>(self: A) => self is Extract<A, Ipv6Address | InetAddressV6>
|
|
630
|
+
/**
|
|
631
|
+
* Returns `true` when an IP address or internet address belongs to a family,
|
|
632
|
+
* narrowing it to that family.
|
|
633
|
+
*
|
|
634
|
+
* @stability experimental
|
|
635
|
+
* @category predicates
|
|
636
|
+
* @since 4.0.0
|
|
637
|
+
*/
|
|
638
|
+
(family: IpFamily): (self: IpAddress | InetAddress) => boolean
|
|
639
|
+
/**
|
|
640
|
+
* Returns `true` when an IP address or internet address belongs to a family,
|
|
641
|
+
* narrowing it to that family.
|
|
642
|
+
*
|
|
643
|
+
* @stability experimental
|
|
644
|
+
* @category predicates
|
|
645
|
+
* @since 4.0.0
|
|
646
|
+
*/
|
|
647
|
+
<A extends IpAddress | InetAddress>(self: A, family: "IPv4"): self is Extract<A, Ipv4Address | InetAddressV4>
|
|
648
|
+
/**
|
|
649
|
+
* Returns `true` when an IP address or internet address belongs to a family,
|
|
650
|
+
* narrowing it to that family.
|
|
651
|
+
*
|
|
652
|
+
* @stability experimental
|
|
653
|
+
* @category predicates
|
|
654
|
+
* @since 4.0.0
|
|
655
|
+
*/
|
|
656
|
+
<A extends IpAddress | InetAddress>(self: A, family: "IPv6"): self is Extract<A, Ipv6Address | InetAddressV6>
|
|
657
|
+
/**
|
|
658
|
+
* Returns `true` when an IP address or internet address belongs to a family,
|
|
659
|
+
* narrowing it to that family.
|
|
660
|
+
*
|
|
661
|
+
* @stability experimental
|
|
662
|
+
* @category predicates
|
|
663
|
+
* @since 4.0.0
|
|
664
|
+
*/
|
|
665
|
+
(self: IpAddress | InetAddress, family: IpFamily): boolean
|
|
666
|
+
} = dual(
|
|
667
|
+
2,
|
|
668
|
+
<A extends IpAddress | InetAddress>(self: A, family: IpFamily): self is A => familyOf(self) === family
|
|
669
|
+
)
|
|
670
|
+
|
|
447
671
|
/**
|
|
448
672
|
* Returns `true` when a value is a MAC address.
|
|
449
673
|
*
|
|
@@ -499,6 +723,7 @@ export const isUnixPathAddress = (u: unknown): u is UnixPathAddress => isAddress
|
|
|
499
723
|
export const isSocketAddress = (u: unknown): u is SocketAddress => isInetAddress(u) || isUnixPathAddress(u)
|
|
500
724
|
|
|
501
725
|
const Ipv4Proto = {
|
|
726
|
+
...Inspectable.BaseProto,
|
|
502
727
|
_tag: "Ipv4Address",
|
|
503
728
|
[TypeId]: TypeId,
|
|
504
729
|
[Equal.symbol](this: Ipv4Address, that: Equal.Equal): boolean {
|
|
@@ -512,13 +737,11 @@ const Ipv4Proto = {
|
|
|
512
737
|
},
|
|
513
738
|
toJSON(this: Ipv4Address): string {
|
|
514
739
|
return this.toString()
|
|
515
|
-
},
|
|
516
|
-
[NodeInspectSymbol](this: Ipv4Address): string {
|
|
517
|
-
return this.toJSON()
|
|
518
740
|
}
|
|
519
741
|
}
|
|
520
742
|
|
|
521
743
|
const Ipv6Proto = {
|
|
744
|
+
...Inspectable.BaseProto,
|
|
522
745
|
_tag: "Ipv6Address",
|
|
523
746
|
[TypeId]: TypeId,
|
|
524
747
|
[Equal.symbol](this: Ipv6Address, that: Equal.Equal): boolean {
|
|
@@ -539,13 +762,11 @@ const Ipv6Proto = {
|
|
|
539
762
|
},
|
|
540
763
|
toJSON(this: Ipv6Address): string {
|
|
541
764
|
return this.toString()
|
|
542
|
-
},
|
|
543
|
-
[NodeInspectSymbol](this: Ipv6Address): string {
|
|
544
|
-
return this.toJSON()
|
|
545
765
|
}
|
|
546
766
|
}
|
|
547
767
|
|
|
548
768
|
const MacProto = {
|
|
769
|
+
...Inspectable.BaseProto,
|
|
549
770
|
_tag: "MacAddress",
|
|
550
771
|
[TypeId]: TypeId,
|
|
551
772
|
[Equal.symbol](this: MacAddress, that: Equal.Equal): boolean {
|
|
@@ -559,9 +780,6 @@ const MacProto = {
|
|
|
559
780
|
},
|
|
560
781
|
toJSON(this: MacAddress): string {
|
|
561
782
|
return this.toString()
|
|
562
|
-
},
|
|
563
|
-
[NodeInspectSymbol](this: MacAddress): string {
|
|
564
|
-
return this.toJSON()
|
|
565
783
|
}
|
|
566
784
|
}
|
|
567
785
|
|
|
@@ -597,7 +815,7 @@ const packOctets = (a: number, b: number, c: number, d: number): number => ((a <
|
|
|
597
815
|
const packBytes = (bytes: Uint8Array, offset: number): number =>
|
|
598
816
|
packOctets(bytes[offset], bytes[offset + 1], bytes[offset + 2], bytes[offset + 3])
|
|
599
817
|
|
|
600
|
-
const wordToOctets = (word: number):
|
|
818
|
+
const wordToOctets = (word: number): Ipv4Octets => [
|
|
601
819
|
word >>> 24,
|
|
602
820
|
(word >>> 16) & 0xff,
|
|
603
821
|
(word >>> 8) & 0xff,
|
|
@@ -676,6 +894,15 @@ export const ipv4Broadcast: Ipv4Address = makeIpv4(0xffffffff)
|
|
|
676
894
|
const addressError = (input: unknown, message: string): Result.Result<never, NetAddressError> =>
|
|
677
895
|
Result.fail(new NetAddressError({ input, message }))
|
|
678
896
|
|
|
897
|
+
// Checks by index because `every` skips holes in sparse arrays.
|
|
898
|
+
const allIntegersInRange = (values: ReadonlyArray<number>, max: number): boolean => {
|
|
899
|
+
for (let i = 0; i < values.length; i++) {
|
|
900
|
+
const n = values[i]
|
|
901
|
+
if (!Number.isInteger(n) || n < 0 || n > max) return false
|
|
902
|
+
}
|
|
903
|
+
return true
|
|
904
|
+
}
|
|
905
|
+
|
|
679
906
|
/**
|
|
680
907
|
* Creates an IPv4 address from four checked octets.
|
|
681
908
|
*
|
|
@@ -684,9 +911,9 @@ const addressError = (input: unknown, message: string): Result.Result<never, Net
|
|
|
684
911
|
* @since 4.0.0
|
|
685
912
|
*/
|
|
686
913
|
export const ipv4FromOctets = (
|
|
687
|
-
octets:
|
|
914
|
+
octets: Ipv4Octets
|
|
688
915
|
): Result.Result<Ipv4Address, NetAddressError> => {
|
|
689
|
-
if (!octets
|
|
916
|
+
if (!allIntegersInRange(octets, 255)) {
|
|
690
917
|
return addressError(octets, "octets must be integers from 0 through 255")
|
|
691
918
|
}
|
|
692
919
|
return Result.succeed(makeIpv4(packOctets(octets[0], octets[1], octets[2], octets[3])))
|
|
@@ -700,9 +927,9 @@ export const ipv4FromOctets = (
|
|
|
700
927
|
* @since 4.0.0
|
|
701
928
|
*/
|
|
702
929
|
export const ipv6FromSegments = (
|
|
703
|
-
segments:
|
|
930
|
+
segments: Ipv6Segments
|
|
704
931
|
): Result.Result<Ipv6Address, NetAddressError> => {
|
|
705
|
-
if (!segments
|
|
932
|
+
if (!allIntegersInRange(segments, 0xffff)) {
|
|
706
933
|
return addressError(segments, "segments must be integers from 0 through 65535")
|
|
707
934
|
}
|
|
708
935
|
return Result.succeed(makeIpv6(
|
|
@@ -721,9 +948,9 @@ export const ipv6FromSegments = (
|
|
|
721
948
|
* @since 4.0.0
|
|
722
949
|
*/
|
|
723
950
|
export const macAddressFromOctets = (
|
|
724
|
-
octets:
|
|
951
|
+
octets: MacAddressOctets
|
|
725
952
|
): Result.Result<MacAddress, NetAddressError> => {
|
|
726
|
-
if (!octets
|
|
953
|
+
if (!allIntegersInRange(octets, 255)) {
|
|
727
954
|
return addressError(octets, "octets must be integers from 0 through 255")
|
|
728
955
|
}
|
|
729
956
|
return Result.succeed(makeMac(new Uint8Array(octets)))
|
|
@@ -752,6 +979,32 @@ export const macAddressFromString = (input: string): Result.Result<MacAddress, N
|
|
|
752
979
|
*/
|
|
753
980
|
export const macAddressFromStringUnsafe = (input: string): MacAddress => Result.getOrThrow(macAddressFromString(input))
|
|
754
981
|
|
|
982
|
+
/**
|
|
983
|
+
* Converts a `MacAddressInput` to a MAC address, parsing strings like
|
|
984
|
+
* `macAddressFromString`, checking octets like `macAddressFromOctets`, and
|
|
985
|
+
* returning MAC addresses unchanged.
|
|
986
|
+
*
|
|
987
|
+
* @stability unstable
|
|
988
|
+
* @category constructors
|
|
989
|
+
* @since 4.0.0
|
|
990
|
+
*/
|
|
991
|
+
export const macAddressFromInput = (input: MacAddressInput): Result.Result<MacAddress, NetAddressError> => {
|
|
992
|
+
if (isMacAddress(input)) return Result.succeed(input)
|
|
993
|
+
if (typeof input === "string") return macAddressFromString(input)
|
|
994
|
+
if (Array.isArray(input) && isTupleOf(input, 6)) return macAddressFromOctets(input)
|
|
995
|
+
return addressError(input, "expected a MAC address, string, or 6 octets")
|
|
996
|
+
}
|
|
997
|
+
|
|
998
|
+
/**
|
|
999
|
+
* Converts a trusted `MacAddressInput` to a MAC address, throwing on failure.
|
|
1000
|
+
*
|
|
1001
|
+
* @stability unstable
|
|
1002
|
+
* @category unsafe
|
|
1003
|
+
* @since 4.0.0
|
|
1004
|
+
*/
|
|
1005
|
+
export const macAddressFromInputUnsafe = (input: MacAddressInput): MacAddress =>
|
|
1006
|
+
Result.getOrThrow(macAddressFromInput(input))
|
|
1007
|
+
|
|
755
1008
|
/**
|
|
756
1009
|
* Parses a strict dotted-decimal IPv4 address.
|
|
757
1010
|
*
|
|
@@ -875,6 +1128,141 @@ export const ipFromString = (input: string): Result.Result<IpAddress, NetAddress
|
|
|
875
1128
|
*/
|
|
876
1129
|
export const ipFromStringUnsafe = (input: string): IpAddress => Result.getOrThrow(ipFromString(input))
|
|
877
1130
|
|
|
1131
|
+
/**
|
|
1132
|
+
* Converts an `IpAddressInput` to an IP address, returning IP addresses
|
|
1133
|
+
* unchanged.
|
|
1134
|
+
*
|
|
1135
|
+
* **Details**
|
|
1136
|
+
*
|
|
1137
|
+
* Strings are parsed like `ipFromString`. Four octets or bytes make an IPv4
|
|
1138
|
+
* address, and eight segments or sixteen bytes make an IPv6 address.
|
|
1139
|
+
*
|
|
1140
|
+
* **Example** (Converting IP address inputs)
|
|
1141
|
+
*
|
|
1142
|
+
* ```ts import.meta.vitest
|
|
1143
|
+
* import { Result } from "effect"
|
|
1144
|
+
* import { NetAddress } from "effect/net"
|
|
1145
|
+
*
|
|
1146
|
+
* const address = Result.getOrThrow(NetAddress.ipFromInput("192.0.2.1"))
|
|
1147
|
+
* NetAddress.formatIp(address) // => "192.0.2.1"
|
|
1148
|
+
* Result.getOrThrow(NetAddress.ipFromInput(address)) === address // => true
|
|
1149
|
+
* NetAddress.formatIp(Result.getOrThrow(NetAddress.ipFromInput([192, 0, 2, 1]))) // => "192.0.2.1"
|
|
1150
|
+
* Result.isFailure(NetAddress.ipFromInput("example.com")) // => true
|
|
1151
|
+
* ```
|
|
1152
|
+
*
|
|
1153
|
+
* @stability unstable
|
|
1154
|
+
* @category constructors
|
|
1155
|
+
* @since 4.0.0
|
|
1156
|
+
*/
|
|
1157
|
+
export const ipFromInput = (input: IpAddressInput): Result.Result<IpAddress, NetAddressError> => {
|
|
1158
|
+
if (isIpAddress(input)) return Result.succeed(input)
|
|
1159
|
+
if (typeof input === "string") return ipFromString(input)
|
|
1160
|
+
if (input instanceof Uint8Array && input.length === 4) return Result.succeed(ipv4FromBytesUnsafe(input))
|
|
1161
|
+
if (input instanceof Uint8Array && input.length === 16) return Result.succeed(ipv6FromBytesUnsafe(input))
|
|
1162
|
+
if (Array.isArray(input) && isTupleOf(input, 4)) return ipv4FromOctets(input)
|
|
1163
|
+
if (Array.isArray(input) && isTupleOf(input, 8)) return ipv6FromSegments(input)
|
|
1164
|
+
return addressError(input, "expected an IP address, string, 4 octets, 8 segments, or 4 or 16 bytes")
|
|
1165
|
+
}
|
|
1166
|
+
|
|
1167
|
+
/**
|
|
1168
|
+
* Converts a trusted `IpAddressInput` to an IP address, throwing on failure.
|
|
1169
|
+
*
|
|
1170
|
+
* @stability unstable
|
|
1171
|
+
* @category unsafe
|
|
1172
|
+
* @since 4.0.0
|
|
1173
|
+
*/
|
|
1174
|
+
export const ipFromInputUnsafe = (input: IpAddressInput): IpAddress => Result.getOrThrow(ipFromInput(input))
|
|
1175
|
+
|
|
1176
|
+
/**
|
|
1177
|
+
* Converts an `Ipv4AddressInput` to an IPv4 address, parsing strings like
|
|
1178
|
+
* `ipv4FromString`, checking octets like `ipv4FromOctets`, and returning IPv4
|
|
1179
|
+
* addresses unchanged.
|
|
1180
|
+
*
|
|
1181
|
+
* @stability unstable
|
|
1182
|
+
* @category constructors
|
|
1183
|
+
* @since 4.0.0
|
|
1184
|
+
*/
|
|
1185
|
+
export const ipv4FromInput = (input: Ipv4AddressInput): Result.Result<Ipv4Address, NetAddressError> => {
|
|
1186
|
+
if (isIpv4Address(input)) return Result.succeed(input)
|
|
1187
|
+
if (typeof input === "string") return ipv4FromString(input)
|
|
1188
|
+
if (input instanceof Uint8Array && input.length === 4) return Result.succeed(ipv4FromBytesUnsafe(input))
|
|
1189
|
+
if (Array.isArray(input) && isTupleOf(input, 4)) return ipv4FromOctets(input)
|
|
1190
|
+
return addressError(input, "expected an IPv4 address, string, 4 octets, or 4 bytes")
|
|
1191
|
+
}
|
|
1192
|
+
|
|
1193
|
+
/**
|
|
1194
|
+
* Converts an `Ipv6AddressInput` to an IPv6 address, parsing strings like
|
|
1195
|
+
* `ipv6FromString`, checking segments like `ipv6FromSegments`, and returning
|
|
1196
|
+
* IPv6 addresses unchanged.
|
|
1197
|
+
*
|
|
1198
|
+
* @stability unstable
|
|
1199
|
+
* @category constructors
|
|
1200
|
+
* @since 4.0.0
|
|
1201
|
+
*/
|
|
1202
|
+
export const ipv6FromInput = (input: Ipv6AddressInput): Result.Result<Ipv6Address, NetAddressError> => {
|
|
1203
|
+
if (isIpv6Address(input)) return Result.succeed(input)
|
|
1204
|
+
if (typeof input === "string") return ipv6FromString(input)
|
|
1205
|
+
if (input instanceof Uint8Array && input.length === 16) return Result.succeed(ipv6FromBytesUnsafe(input))
|
|
1206
|
+
if (Array.isArray(input) && isTupleOf(input, 8)) return ipv6FromSegments(input)
|
|
1207
|
+
return addressError(input, "expected an IPv6 address, string, 8 segments, or 16 bytes")
|
|
1208
|
+
}
|
|
1209
|
+
|
|
1210
|
+
/**
|
|
1211
|
+
* Returns `true` when a value is a canonical scoped IPv6 literal.
|
|
1212
|
+
*
|
|
1213
|
+
* @stability experimental
|
|
1214
|
+
* @category guards
|
|
1215
|
+
* @since 4.0.0
|
|
1216
|
+
*/
|
|
1217
|
+
export const isScopedIpv6Literal = (u: unknown): u is ScopedIpv6Literal => {
|
|
1218
|
+
if (typeof u !== "string" || !u.includes("%")) return false
|
|
1219
|
+
const result = scopedIpv6LiteralFromString(u)
|
|
1220
|
+
return Result.isSuccess(result) && result.success === u
|
|
1221
|
+
}
|
|
1222
|
+
|
|
1223
|
+
/**
|
|
1224
|
+
* Parses an IPv6 literal with a numeric or named zone, such as `fe80::1%eth0`.
|
|
1225
|
+
*
|
|
1226
|
+
* @stability experimental
|
|
1227
|
+
* @category decoding
|
|
1228
|
+
* @since 4.0.0
|
|
1229
|
+
*/
|
|
1230
|
+
export const scopedIpv6LiteralFromString = (
|
|
1231
|
+
input: string
|
|
1232
|
+
): Result.Result<ScopedIpv6Literal, NetAddressError> => {
|
|
1233
|
+
const separator = input.indexOf("%")
|
|
1234
|
+
if (separator === -1) return addressError(input, "expected an IPv6 zone")
|
|
1235
|
+
let zone = input.slice(separator + 1)
|
|
1236
|
+
if (zone.length === 0 || /[%[\]/\s\p{Cc}]/u.test(zone)) {
|
|
1237
|
+
return addressError(input, "invalid IPv6 scope identifier")
|
|
1238
|
+
}
|
|
1239
|
+
if (/^\d+$/.test(zone)) {
|
|
1240
|
+
const scopeId = Number(zone)
|
|
1241
|
+
if (scopeId > 0xffffffff) return addressError(input, "scope identifier must be an unsigned 32-bit integer")
|
|
1242
|
+
zone = String(scopeId)
|
|
1243
|
+
}
|
|
1244
|
+
return Result.map(
|
|
1245
|
+
ipv6FromString(input.slice(0, separator)),
|
|
1246
|
+
(address) => `${formatIp(address)}%${zone}` as ScopedIpv6Literal
|
|
1247
|
+
)
|
|
1248
|
+
}
|
|
1249
|
+
|
|
1250
|
+
/**
|
|
1251
|
+
* Converts a `ScopedIpv6LiteralInput` to a scoped IPv6 literal, parsing it
|
|
1252
|
+
* like `scopedIpv6LiteralFromString`.
|
|
1253
|
+
*
|
|
1254
|
+
* **Details**
|
|
1255
|
+
*
|
|
1256
|
+
* Scoped IPv6 literals are strings, so every input is parsed.
|
|
1257
|
+
*
|
|
1258
|
+
* @stability experimental
|
|
1259
|
+
* @category constructors
|
|
1260
|
+
* @since 4.0.0
|
|
1261
|
+
*/
|
|
1262
|
+
export const scopedIpv6LiteralFromInput = (
|
|
1263
|
+
input: ScopedIpv6LiteralInput
|
|
1264
|
+
): Result.Result<ScopedIpv6Literal, NetAddressError> => scopedIpv6LiteralFromString(input)
|
|
1265
|
+
|
|
878
1266
|
/**
|
|
879
1267
|
* Returns the four numeric octets of an IPv4 address in a fresh tuple.
|
|
880
1268
|
*
|
|
@@ -882,8 +1270,7 @@ export const ipFromStringUnsafe = (input: string): IpAddress => Result.getOrThro
|
|
|
882
1270
|
* @category getters
|
|
883
1271
|
* @since 4.0.0
|
|
884
1272
|
*/
|
|
885
|
-
export const ipv4ToOctets = (self: Ipv4Address):
|
|
886
|
-
wordToOctets(ipv4Value(self))
|
|
1273
|
+
export const ipv4ToOctets = (self: Ipv4Address): Ipv4Octets => wordToOctets(ipv4Value(self))
|
|
887
1274
|
|
|
888
1275
|
/**
|
|
889
1276
|
* Returns the eight numeric segments of an IPv6 address in a fresh tuple.
|
|
@@ -892,9 +1279,7 @@ export const ipv4ToOctets = (self: Ipv4Address): readonly [number, number, numbe
|
|
|
892
1279
|
* @category getters
|
|
893
1280
|
* @since 4.0.0
|
|
894
1281
|
*/
|
|
895
|
-
export const ipv6ToSegments = (
|
|
896
|
-
self: Ipv6Address
|
|
897
|
-
): readonly [number, number, number, number, number, number, number, number] => {
|
|
1282
|
+
export const ipv6ToSegments = (self: Ipv6Address): Ipv6Segments => {
|
|
898
1283
|
const { w0, w1, w2, w3 } = ipv6Words(self)
|
|
899
1284
|
return [w0 >>> 16, w0 & 0xffff, w1 >>> 16, w1 & 0xffff, w2 >>> 16, w2 & 0xffff, w3 >>> 16, w3 & 0xffff]
|
|
900
1285
|
}
|
|
@@ -920,9 +1305,7 @@ export const ipv6ToOctets = (
|
|
|
920
1305
|
* @category getters
|
|
921
1306
|
* @since 4.0.0
|
|
922
1307
|
*/
|
|
923
|
-
export const macAddressToOctets = (
|
|
924
|
-
self: MacAddress
|
|
925
|
-
): readonly [number, number, number, number, number, number] => {
|
|
1308
|
+
export const macAddressToOctets = (self: MacAddress): MacAddressOctets => {
|
|
926
1309
|
const bytes = getMacBytes(self)
|
|
927
1310
|
return [bytes[0], bytes[1], bytes[2], bytes[3], bytes[4], bytes[5]]
|
|
928
1311
|
}
|
|
@@ -1254,6 +1637,7 @@ export function toCanonical(self: IpAddress | InetAddress): IpAddress | InetAddr
|
|
|
1254
1637
|
}
|
|
1255
1638
|
|
|
1256
1639
|
const InetV4Proto = {
|
|
1640
|
+
...Inspectable.BaseProto,
|
|
1257
1641
|
_tag: "InetAddressV4",
|
|
1258
1642
|
[TypeId]: TypeId,
|
|
1259
1643
|
[Equal.symbol](this: InetAddressV4, that: Equal.Equal): boolean {
|
|
@@ -1267,13 +1651,11 @@ const InetV4Proto = {
|
|
|
1267
1651
|
},
|
|
1268
1652
|
toJSON(this: InetAddressV4): string {
|
|
1269
1653
|
return this.toString()
|
|
1270
|
-
},
|
|
1271
|
-
[NodeInspectSymbol](this: InetAddressV4): string {
|
|
1272
|
-
return this.toJSON()
|
|
1273
1654
|
}
|
|
1274
1655
|
}
|
|
1275
1656
|
|
|
1276
1657
|
const InetV6Proto = {
|
|
1658
|
+
...Inspectable.BaseProto,
|
|
1277
1659
|
_tag: "InetAddressV6",
|
|
1278
1660
|
[TypeId]: TypeId,
|
|
1279
1661
|
[Equal.symbol](this: InetAddressV6, that: Equal.Equal): boolean {
|
|
@@ -1291,9 +1673,6 @@ const InetV6Proto = {
|
|
|
1291
1673
|
},
|
|
1292
1674
|
toJSON(this: InetAddressV6): string {
|
|
1293
1675
|
return this.toString()
|
|
1294
|
-
},
|
|
1295
|
-
[NodeInspectSymbol](this: InetAddressV6): string {
|
|
1296
|
-
return this.toJSON()
|
|
1297
1676
|
}
|
|
1298
1677
|
}
|
|
1299
1678
|
|
|
@@ -1396,6 +1775,112 @@ export const inetAddressFromIpString = (
|
|
|
1396
1775
|
export const inetAddressFromIpStringUnsafe = (address: string, port: number): InetAddress =>
|
|
1397
1776
|
Result.getOrThrow(inetAddressFromIpString(address, port))
|
|
1398
1777
|
|
|
1778
|
+
/**
|
|
1779
|
+
* Creates an internet address from a trusted native numeric host and port.
|
|
1780
|
+
* Named IPv6 zones are resolved using the supplied interface-to-scope map.
|
|
1781
|
+
* Use only for runtime-supplied socket addresses: this skips input validation,
|
|
1782
|
+
* so malformed strings or ports may silently produce incorrect values. An
|
|
1783
|
+
* unknown named IPv6 zone throws rather than losing its scope.
|
|
1784
|
+
*
|
|
1785
|
+
* @stability unstable
|
|
1786
|
+
* @category unsafe
|
|
1787
|
+
* @since 4.0.0
|
|
1788
|
+
*/
|
|
1789
|
+
export const inetAddressFromNativeUnsafe = (
|
|
1790
|
+
host: string,
|
|
1791
|
+
port: number,
|
|
1792
|
+
scopeIds?: ReadonlyMap<string, number>
|
|
1793
|
+
): InetAddress => {
|
|
1794
|
+
const zoneStart = host.indexOf("%")
|
|
1795
|
+
const end = zoneStart === -1 ? host.length : zoneStart
|
|
1796
|
+
if (host.indexOf(":") === -1) {
|
|
1797
|
+
const self = Object.create(InetV4Proto)
|
|
1798
|
+
self.address = makeIpv4(parseNativeIpv4(host, 0, end))
|
|
1799
|
+
self.port = port
|
|
1800
|
+
return Object.freeze(self)
|
|
1801
|
+
}
|
|
1802
|
+
|
|
1803
|
+
let scopeId = 0
|
|
1804
|
+
if (zoneStart !== -1) {
|
|
1805
|
+
const zone = host.slice(zoneStart + 1)
|
|
1806
|
+
const resolved = numericZone.test(zone) ? Number(zone) : scopeIds?.get(zone)
|
|
1807
|
+
if (resolved === undefined) throw new Error(`unknown IPv6 interface: ${zone}`)
|
|
1808
|
+
scopeId = resolved
|
|
1809
|
+
}
|
|
1810
|
+
|
|
1811
|
+
let w0 = 0
|
|
1812
|
+
let w1 = 0
|
|
1813
|
+
let w2 = 0
|
|
1814
|
+
let w3 = 0
|
|
1815
|
+
let segment = 0
|
|
1816
|
+
let i = 0
|
|
1817
|
+
while (i < end) {
|
|
1818
|
+
if (host.charCodeAt(i) === 58) {
|
|
1819
|
+
// The rest of a compressed address is anchored at the last segment.
|
|
1820
|
+
i += 2
|
|
1821
|
+
if (i === end) break
|
|
1822
|
+
let remaining = 1
|
|
1823
|
+
for (let j = i; j < end; j++) {
|
|
1824
|
+
if (host.charCodeAt(j) === 58) remaining++
|
|
1825
|
+
}
|
|
1826
|
+
const dot = host.indexOf(".", i)
|
|
1827
|
+
if (dot !== -1 && dot < end) remaining++
|
|
1828
|
+
segment = 8 - remaining
|
|
1829
|
+
}
|
|
1830
|
+
const start = i
|
|
1831
|
+
let value = 0
|
|
1832
|
+
while (i < end) {
|
|
1833
|
+
const ch = host.charCodeAt(i)
|
|
1834
|
+
if (ch === 58 || ch === 46) break
|
|
1835
|
+
value = (value << 4) | (ch <= 57 ? ch - 48 : (ch & 0x5f) - 55)
|
|
1836
|
+
i++
|
|
1837
|
+
}
|
|
1838
|
+
if (i < end && host.charCodeAt(i) === 46) {
|
|
1839
|
+
w3 = parseNativeIpv4(host, start, end)
|
|
1840
|
+
break
|
|
1841
|
+
}
|
|
1842
|
+
// even segments fill the high half of their 32-bit word
|
|
1843
|
+
const shifted = value << ((1 - (segment & 1)) * 16)
|
|
1844
|
+
switch (segment >>> 1) {
|
|
1845
|
+
case 0:
|
|
1846
|
+
w0 |= shifted
|
|
1847
|
+
break
|
|
1848
|
+
case 1:
|
|
1849
|
+
w1 |= shifted
|
|
1850
|
+
break
|
|
1851
|
+
case 2:
|
|
1852
|
+
w2 |= shifted
|
|
1853
|
+
break
|
|
1854
|
+
default:
|
|
1855
|
+
w3 |= shifted
|
|
1856
|
+
}
|
|
1857
|
+
segment++
|
|
1858
|
+
if (i < end && host.charCodeAt(i + 1) !== 58) i++
|
|
1859
|
+
}
|
|
1860
|
+
const self = Object.create(InetV6Proto)
|
|
1861
|
+
self.address = makeIpv6(w0, w1, w2, w3)
|
|
1862
|
+
self.port = port
|
|
1863
|
+
self.scopeId = scopeId
|
|
1864
|
+
return Object.freeze(self)
|
|
1865
|
+
}
|
|
1866
|
+
|
|
1867
|
+
const numericZone = /^\d+$/
|
|
1868
|
+
|
|
1869
|
+
const parseNativeIpv4 = (host: string, start: number, end: number): number => {
|
|
1870
|
+
let value = 0
|
|
1871
|
+
let octet = 0
|
|
1872
|
+
for (let i = start; i < end; i++) {
|
|
1873
|
+
const ch = host.charCodeAt(i)
|
|
1874
|
+
if (ch === 46) {
|
|
1875
|
+
value = (value << 8) | octet
|
|
1876
|
+
octet = 0
|
|
1877
|
+
} else {
|
|
1878
|
+
octet = octet * 10 + ch - 48
|
|
1879
|
+
}
|
|
1880
|
+
}
|
|
1881
|
+
return ((value << 8) | octet) >>> 0
|
|
1882
|
+
}
|
|
1883
|
+
|
|
1399
1884
|
/**
|
|
1400
1885
|
* Parses an unbracketed numeric host and port, resolving named IPv6 zones using
|
|
1401
1886
|
* a supplied map of interface names to numeric scope IDs.
|
|
@@ -1443,7 +1928,33 @@ export const inetAddressFromHostString = (
|
|
|
1443
1928
|
*/
|
|
1444
1929
|
export interface NetworkInterfaceAddress {
|
|
1445
1930
|
readonly family: string
|
|
1446
|
-
readonly scopeid?: number | undefined
|
|
1931
|
+
readonly scopeid?: number | null | undefined
|
|
1932
|
+
}
|
|
1933
|
+
|
|
1934
|
+
/**
|
|
1935
|
+
* Returns the IPv6 scope ID of a network interface from its addresses.
|
|
1936
|
+
*
|
|
1937
|
+
* **Details**
|
|
1938
|
+
*
|
|
1939
|
+
* The first IPv6 address with a positive scope ID supplies the result. Accepts
|
|
1940
|
+
* the addresses of one interface, such as `os.networkInterfaces()[name]` or the
|
|
1941
|
+
* entries of `Deno.networkInterfaces()` with that name, without performing any
|
|
1942
|
+
* operating-system lookup itself.
|
|
1943
|
+
*
|
|
1944
|
+
* @see {@link scopeIdsFromInterfaces} for mapping every interface at once
|
|
1945
|
+
* @stability experimental
|
|
1946
|
+
* @category converting
|
|
1947
|
+
* @since 4.0.0
|
|
1948
|
+
*/
|
|
1949
|
+
export const scopeIdFromInterface = (
|
|
1950
|
+
addresses: ReadonlyArray<NetworkInterfaceAddress> | undefined
|
|
1951
|
+
): Option.Option<number> => {
|
|
1952
|
+
for (const address of addresses ?? []) {
|
|
1953
|
+
if (address.family === "IPv6" && typeof address.scopeid === "number" && address.scopeid > 0) {
|
|
1954
|
+
return Option.some(address.scopeid)
|
|
1955
|
+
}
|
|
1956
|
+
}
|
|
1957
|
+
return Option.none()
|
|
1447
1958
|
}
|
|
1448
1959
|
|
|
1449
1960
|
/**
|
|
@@ -1468,8 +1979,8 @@ export const scopeIdsFromInterfaces = (
|
|
|
1468
1979
|
): Map<string, number> => {
|
|
1469
1980
|
const scopeIds = new Map<string, number>()
|
|
1470
1981
|
for (const [name, addresses] of interfaces) {
|
|
1471
|
-
const
|
|
1472
|
-
if (
|
|
1982
|
+
const scopeId = scopeIdFromInterface(addresses)
|
|
1983
|
+
if (Option.isSome(scopeId)) scopeIds.set(name, scopeId.value)
|
|
1473
1984
|
}
|
|
1474
1985
|
return scopeIds
|
|
1475
1986
|
}
|
|
@@ -1539,6 +2050,40 @@ export const inetAddressFromString = (input: string): Result.Result<InetAddress,
|
|
|
1539
2050
|
export const inetAddressFromStringUnsafe = (input: string): InetAddress =>
|
|
1540
2051
|
Result.getOrThrow(inetAddressFromString(input))
|
|
1541
2052
|
|
|
2053
|
+
/**
|
|
2054
|
+
* Converts an `InetAddressInput` to an internet address, parsing strings like
|
|
2055
|
+
* `inetAddressFromString`, converting parts like `inetAddressV4` and
|
|
2056
|
+
* `inetAddressV6`, and returning internet addresses unchanged.
|
|
2057
|
+
*
|
|
2058
|
+
* @stability unstable
|
|
2059
|
+
* @category constructors
|
|
2060
|
+
* @since 4.0.0
|
|
2061
|
+
*/
|
|
2062
|
+
export const inetAddressFromInput = (input: InetAddressInput): Result.Result<InetAddress, NetAddressError> => {
|
|
2063
|
+
if (isInetAddress(input)) return Result.succeed(input)
|
|
2064
|
+
if (typeof input === "string") return inetAddressFromString(input)
|
|
2065
|
+
if (!hasProperty(input, "address") || !hasProperty(input, "port")) {
|
|
2066
|
+
return addressError(input, "expected an address and port")
|
|
2067
|
+
}
|
|
2068
|
+
const { port, scopeId } = input
|
|
2069
|
+
return Result.flatMap(ipFromInput(input.address), (address): Result.Result<InetAddress, NetAddressError> => {
|
|
2070
|
+
if (isIpv6Address(address)) return inetAddressV6(address, port, { scopeId })
|
|
2071
|
+
return (scopeId ?? 0) === 0
|
|
2072
|
+
? inetAddressV4(address, port)
|
|
2073
|
+
: addressError(input, "scopeId requires an IPv6 address")
|
|
2074
|
+
})
|
|
2075
|
+
}
|
|
2076
|
+
|
|
2077
|
+
/**
|
|
2078
|
+
* Converts a trusted `InetAddressInput` to an internet address, throwing on failure.
|
|
2079
|
+
*
|
|
2080
|
+
* @stability unstable
|
|
2081
|
+
* @category unsafe
|
|
2082
|
+
* @since 4.0.0
|
|
2083
|
+
*/
|
|
2084
|
+
export const inetAddressFromInputUnsafe = (input: InetAddressInput): InetAddress =>
|
|
2085
|
+
Result.getOrThrow(inetAddressFromInput(input))
|
|
2086
|
+
|
|
1542
2087
|
/**
|
|
1543
2088
|
* Formats the numeric host of an internet address without brackets or a port,
|
|
1544
2089
|
* preserving a nonzero IPv6 scope ID as a `%` suffix.
|
|
@@ -1722,6 +2267,7 @@ export const formatUrlHostString = (host: string): string =>
|
|
|
1722
2267
|
host.includes(":") && !host.startsWith("[") ? `[${host}]` : host
|
|
1723
2268
|
|
|
1724
2269
|
const UnixPathProto = {
|
|
2270
|
+
...Inspectable.BaseProto,
|
|
1725
2271
|
_tag: "UnixPathAddress",
|
|
1726
2272
|
[TypeId]: TypeId,
|
|
1727
2273
|
[Equal.symbol](this: UnixPathAddress, that: Equal.Equal): boolean {
|
|
@@ -1735,9 +2281,6 @@ const UnixPathProto = {
|
|
|
1735
2281
|
},
|
|
1736
2282
|
toJSON(this: UnixPathAddress): string {
|
|
1737
2283
|
return this.toString()
|
|
1738
|
-
},
|
|
1739
|
-
[NodeInspectSymbol](this: UnixPathAddress): string {
|
|
1740
|
-
return this.toJSON()
|
|
1741
2284
|
}
|
|
1742
2285
|
}
|
|
1743
2286
|
|
|
@@ -1773,8 +2316,9 @@ export const formatUnixPath = (self: UnixPathAddress): string => `unix://${self.
|
|
|
1773
2316
|
*
|
|
1774
2317
|
* **Details**
|
|
1775
2318
|
*
|
|
1776
|
-
*
|
|
1777
|
-
* literals, ports, and input shapes return a
|
|
2319
|
+
* Internet addresses are converted like `inetAddressFromInput`, without
|
|
2320
|
+
* hostname resolution. Invalid IP literals, ports, and input shapes return a
|
|
2321
|
+
* `NetAddressError`.
|
|
1778
2322
|
*
|
|
1779
2323
|
* @stability unstable
|
|
1780
2324
|
* @category constructors
|
|
@@ -1783,22 +2327,13 @@ export const formatUnixPath = (self: UnixPathAddress): string => `unix://${self.
|
|
|
1783
2327
|
export const socketAddressFromInput = (
|
|
1784
2328
|
input: SocketAddress.Input
|
|
1785
2329
|
): Result.Result<SocketAddress, NetAddressError> => {
|
|
1786
|
-
if (
|
|
1787
|
-
if (typeof input === "string") return inetAddressFromString(input)
|
|
2330
|
+
if (isUnixPathAddress(input)) return Result.succeed(input)
|
|
1788
2331
|
if (hasProperty(input, "path")) {
|
|
1789
2332
|
return typeof input.path === "string"
|
|
1790
2333
|
? Result.succeed(unixPathAddress(input.path))
|
|
1791
2334
|
: addressError(input, "path must be a string")
|
|
1792
2335
|
}
|
|
1793
|
-
|
|
1794
|
-
return addressError(input, "expected an address and port or a Unix path")
|
|
1795
|
-
}
|
|
1796
|
-
const address = typeof input.address === "string"
|
|
1797
|
-
? ipFromString(input.address)
|
|
1798
|
-
: isIpAddress(input.address)
|
|
1799
|
-
? Result.succeed(input.address)
|
|
1800
|
-
: addressError(input, "address must be an IP address or numeric IP string")
|
|
1801
|
-
return Result.flatMap(address, (address) => inetAddress(address, input.port as number))
|
|
2336
|
+
return inetAddressFromInput(input)
|
|
1802
2337
|
}
|
|
1803
2338
|
|
|
1804
2339
|
/**
|