effect 4.0.0-rc.111 → 4.0.0-rc.113
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/AGENTS.md +24 -9
- package/CLAUDE.md +24 -9
- package/ai-docs/package.json +2 -2
- package/ai-docs/src/01_effect/01_basics/02_effect-fn.ts +18 -5
- package/ai-docs/src/01_effect/01_basics/index.md +5 -3
- package/ai-docs/src/01_effect/03_services/20_layer-composition.ts +1 -1
- package/ai-docs/src/01_effect/03_services/20_layer-unwrap.ts +2 -2
- package/ai-docs/src/01_effect/05_resources/10_acquire-release.ts +2 -2
- package/ai-docs/src/03_stream/30_encoding.ts +5 -7
- package/ai-docs/src/08_observability/10_logging.ts +1 -1
- package/ai-docs/src/70_cli/10_basics.ts +7 -7
- package/ai-docs/src/71_ai/10_language-model.ts +2 -2
- package/ai-docs/src/71_ai/20_tools.ts +1 -1
- package/ai-docs/src/71_ai/30_chat.ts +1 -1
- package/dist/Array.d.ts +109 -52
- package/dist/Array.d.ts.map +1 -1
- package/dist/Array.js +65 -32
- package/dist/Array.js.map +1 -1
- package/dist/BigDecimal.d.ts +5 -1
- package/dist/BigDecimal.d.ts.map +1 -1
- package/dist/BigDecimal.js +40 -23
- package/dist/BigDecimal.js.map +1 -1
- package/dist/ByteSize.d.ts +633 -0
- package/dist/ByteSize.d.ts.map +1 -0
- package/dist/ByteSize.js +524 -0
- package/dist/ByteSize.js.map +1 -0
- package/dist/Cache.d.ts.map +1 -1
- package/dist/Cache.js +17 -3
- package/dist/Cache.js.map +1 -1
- package/dist/Cause.d.ts +1 -1
- package/dist/Cause.d.ts.map +1 -1
- package/dist/Channel.d.ts +97 -24
- package/dist/Channel.d.ts.map +1 -1
- package/dist/Channel.js +68 -41
- package/dist/Channel.js.map +1 -1
- package/dist/Chunk.d.ts +49 -28
- package/dist/Chunk.d.ts.map +1 -1
- package/dist/Chunk.js +27 -18
- package/dist/Chunk.js.map +1 -1
- package/dist/Config.d.ts +162 -201
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +103 -212
- package/dist/Config.js.map +1 -1
- package/dist/ConfigProvider.d.ts +4 -4
- package/dist/ConfigProvider.d.ts.map +1 -1
- package/dist/ConfigProvider.js +7 -7
- package/dist/ConfigProvider.js.map +1 -1
- package/dist/Context.d.ts +31 -0
- package/dist/Context.d.ts.map +1 -1
- package/dist/Context.js.map +1 -1
- package/dist/Cron.d.ts +2 -2
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +2 -2
- package/dist/Cron.js.map +1 -1
- package/dist/Crypto.d.ts +1 -1
- package/dist/Crypto.d.ts.map +1 -1
- package/dist/Crypto.js +3 -2
- package/dist/Crypto.js.map +1 -1
- package/dist/DateTime.d.ts +2 -2
- package/dist/DateTime.d.ts.map +1 -1
- package/dist/Deferred.d.ts.map +1 -1
- package/dist/Deferred.js +6 -6
- package/dist/Deferred.js.map +1 -1
- package/dist/Duration.d.ts +1 -1
- package/dist/Duration.d.ts.map +1 -1
- package/dist/Duration.js +1 -1
- package/dist/Duration.js.map +1 -1
- package/dist/Effect.d.ts +220 -113
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +27 -26
- package/dist/Effect.js.map +1 -1
- package/dist/Effectable.d.ts +58 -2
- package/dist/Effectable.d.ts.map +1 -1
- package/dist/Effectable.js +58 -6
- package/dist/Effectable.js.map +1 -1
- package/dist/Encoding.d.ts +3 -1
- package/dist/Encoding.d.ts.map +1 -1
- package/dist/Encoding.js +40 -10
- package/dist/Encoding.js.map +1 -1
- package/dist/Equal.d.ts +1 -1
- package/dist/Equal.d.ts.map +1 -1
- package/dist/Equal.js +1 -1
- package/dist/Equal.js.map +1 -1
- package/dist/ExecutionPlan.d.ts.map +1 -1
- package/dist/ExecutionPlan.js +1 -0
- package/dist/ExecutionPlan.js.map +1 -1
- package/dist/Fiber.d.ts +32 -8
- package/dist/Fiber.d.ts.map +1 -1
- package/dist/Fiber.js.map +1 -1
- package/dist/FiberHandle.js +3 -3
- package/dist/FiberHandle.js.map +1 -1
- package/dist/FiberMap.d.ts +12 -6
- package/dist/FiberMap.d.ts.map +1 -1
- package/dist/FiberMap.js +11 -6
- package/dist/FiberMap.js.map +1 -1
- package/dist/FileSystem.d.ts +42 -210
- package/dist/FileSystem.d.ts.map +1 -1
- package/dist/FileSystem.js +16 -148
- package/dist/FileSystem.js.map +1 -1
- package/dist/Formatter.d.ts +1 -0
- package/dist/Formatter.d.ts.map +1 -1
- package/dist/Formatter.js +19 -3
- package/dist/Formatter.js.map +1 -1
- package/dist/Graph.d.ts +48 -20
- package/dist/Graph.d.ts.map +1 -1
- package/dist/Graph.js +20 -5
- package/dist/Graph.js.map +1 -1
- package/dist/Hash.d.ts +1 -1
- package/dist/Hash.d.ts.map +1 -1
- package/dist/Hash.js +5 -14
- package/dist/Hash.js.map +1 -1
- package/dist/HashMap.d.ts +1 -1
- package/dist/HashMap.d.ts.map +1 -1
- package/dist/HashRing.d.ts +6 -1
- package/dist/HashRing.d.ts.map +1 -1
- package/dist/HashRing.js +9 -2
- package/dist/HashRing.js.map +1 -1
- package/dist/HashSet.d.ts +1 -1
- package/dist/HashSet.d.ts.map +1 -1
- package/dist/HashSet.js.map +1 -1
- package/dist/Iterable.d.ts +56 -17
- package/dist/Iterable.d.ts.map +1 -1
- package/dist/Iterable.js +65 -45
- package/dist/Iterable.js.map +1 -1
- package/dist/JsonPatch.js +4 -4
- package/dist/JsonPatch.js.map +1 -1
- package/dist/JsonPointer.d.ts +68 -4
- package/dist/JsonPointer.d.ts.map +1 -1
- package/dist/JsonPointer.js +90 -4
- package/dist/JsonPointer.js.map +1 -1
- package/dist/JsonSchema.d.ts +67 -94
- package/dist/JsonSchema.d.ts.map +1 -1
- package/dist/JsonSchema.js +752 -397
- package/dist/JsonSchema.js.map +1 -1
- package/dist/Layer.d.ts +47 -4
- package/dist/Layer.d.ts.map +1 -1
- package/dist/Layer.js +4 -6
- package/dist/Layer.js.map +1 -1
- package/dist/LayerMap.d.ts +24 -3
- package/dist/LayerMap.d.ts.map +1 -1
- package/dist/LayerMap.js +9 -5
- package/dist/LayerMap.js.map +1 -1
- package/dist/LayerRef.d.ts.map +1 -1
- package/dist/LayerRef.js +7 -5
- package/dist/LayerRef.js.map +1 -1
- package/dist/Logger.d.ts +114 -9
- package/dist/Logger.d.ts.map +1 -1
- package/dist/Logger.js +109 -9
- package/dist/Logger.js.map +1 -1
- package/dist/ManagedRuntime.js +1 -1
- package/dist/ManagedRuntime.js.map +1 -1
- package/dist/Match.d.ts +43 -31
- package/dist/Match.d.ts.map +1 -1
- package/dist/Match.js +5 -2
- package/dist/Match.js.map +1 -1
- package/dist/Metric.d.ts +11 -4
- package/dist/Metric.d.ts.map +1 -1
- package/dist/Metric.js +14 -18
- package/dist/Metric.js.map +1 -1
- package/dist/MutableHashMap.d.ts +1 -1
- package/dist/MutableHashMap.d.ts.map +1 -1
- package/dist/MutableHashMap.js +1 -1
- package/dist/MutableHashMap.js.map +1 -1
- package/dist/MutableHashSet.d.ts +1 -1
- package/dist/MutableHashSet.d.ts.map +1 -1
- package/dist/MutableHashSet.js +1 -1
- package/dist/MutableHashSet.js.map +1 -1
- package/dist/MutableList.d.ts +13 -2
- package/dist/MutableList.d.ts.map +1 -1
- package/dist/MutableList.js +18 -2
- package/dist/MutableList.js.map +1 -1
- package/dist/Number.d.ts +6 -0
- package/dist/Number.d.ts.map +1 -1
- package/dist/Number.js +3 -1
- package/dist/Number.js.map +1 -1
- package/dist/Optic.d.ts.map +1 -1
- package/dist/Optic.js +5 -4
- package/dist/Optic.js.map +1 -1
- package/dist/Option.d.ts +1 -1
- package/dist/Option.d.ts.map +1 -1
- package/dist/Option.js +1 -1
- package/dist/Option.js.map +1 -1
- package/dist/Order.d.ts +1 -0
- package/dist/Order.d.ts.map +1 -1
- package/dist/Order.js +3 -1
- package/dist/Order.js.map +1 -1
- package/dist/PartitionedSemaphore.d.ts.map +1 -1
- package/dist/PartitionedSemaphore.js +1 -2
- package/dist/PartitionedSemaphore.js.map +1 -1
- package/dist/Path.d.ts +1 -1
- package/dist/Path.d.ts.map +1 -1
- package/dist/Path.js +1 -1
- package/dist/Path.js.map +1 -1
- package/dist/PlatformError.d.ts +1 -1
- package/dist/PlatformError.d.ts.map +1 -1
- package/dist/PlatformError.js +1 -1
- package/dist/PlatformError.js.map +1 -1
- package/dist/Pool.d.ts +137 -10
- package/dist/Pool.d.ts.map +1 -1
- package/dist/Pool.js +332 -75
- package/dist/Pool.js.map +1 -1
- package/dist/PrimaryKey.d.ts +1 -1
- package/dist/PrimaryKey.d.ts.map +1 -1
- package/dist/PrimaryKey.js +1 -1
- package/dist/PrimaryKey.js.map +1 -1
- package/dist/PubSub.d.ts +21 -9
- package/dist/PubSub.d.ts.map +1 -1
- package/dist/PubSub.js +18 -14
- package/dist/PubSub.js.map +1 -1
- package/dist/Queue.d.ts +82 -6
- package/dist/Queue.d.ts.map +1 -1
- package/dist/Queue.js +116 -27
- package/dist/Queue.js.map +1 -1
- package/dist/Random.d.ts +17 -4
- package/dist/Random.d.ts.map +1 -1
- package/dist/Random.js +1 -1
- package/dist/Random.js.map +1 -1
- package/dist/RcMap.d.ts +137 -0
- package/dist/RcMap.d.ts.map +1 -1
- package/dist/RcMap.js +72 -9
- package/dist/RcMap.js.map +1 -1
- package/dist/Record.d.ts +13 -0
- package/dist/Record.d.ts.map +1 -1
- package/dist/Record.js.map +1 -1
- package/dist/Redacted.d.ts +1 -1
- package/dist/Redacted.d.ts.map +1 -1
- package/dist/Redacted.js +1 -1
- package/dist/Redacted.js.map +1 -1
- package/dist/RequestResolver.d.ts +15 -9
- package/dist/RequestResolver.d.ts.map +1 -1
- package/dist/RequestResolver.js +33 -15
- package/dist/RequestResolver.js.map +1 -1
- package/dist/Result.d.ts +1 -1
- package/dist/Result.d.ts.map +1 -1
- package/dist/Result.js +1 -1
- package/dist/Result.js.map +1 -1
- package/dist/Scheduler.d.ts.map +1 -1
- package/dist/Scheduler.js +19 -10
- package/dist/Scheduler.js.map +1 -1
- package/dist/Schema.d.ts +2200 -2433
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +2797 -4184
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts +359 -176
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +373 -630
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +46 -22
- package/dist/SchemaGetter.d.ts.map +1 -1
- package/dist/SchemaGetter.js +56 -53
- package/dist/SchemaGetter.js.map +1 -1
- package/dist/SchemaIssue.d.ts +123 -200
- package/dist/SchemaIssue.d.ts.map +1 -1
- package/dist/SchemaIssue.js +59 -263
- package/dist/SchemaIssue.js.map +1 -1
- package/dist/SchemaParser.js +2 -9
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +1276 -172
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +1371 -29
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/SchemaTransformation.d.ts +49 -16
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +75 -98
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/Scope.d.ts +9 -2
- package/dist/Scope.d.ts.map +1 -1
- package/dist/Scope.js.map +1 -1
- package/dist/ScopedCache.d.ts.map +1 -1
- package/dist/ScopedCache.js +10 -3
- package/dist/ScopedCache.js.map +1 -1
- package/dist/Sink.d.ts +9 -4
- package/dist/Sink.d.ts.map +1 -1
- package/dist/Sink.js +49 -31
- package/dist/Sink.js.map +1 -1
- package/dist/StandardSchema.d.ts +125 -0
- package/dist/StandardSchema.d.ts.map +1 -0
- package/dist/StandardSchema.js +9 -0
- package/dist/StandardSchema.js.map +1 -0
- package/dist/Stream.d.ts +221 -35
- package/dist/Stream.d.ts.map +1 -1
- package/dist/Stream.js +168 -84
- package/dist/Stream.js.map +1 -1
- package/dist/String.d.ts +16 -6
- package/dist/String.d.ts.map +1 -1
- package/dist/String.js +12 -5
- package/dist/String.js.map +1 -1
- package/dist/Struct.d.ts.map +1 -1
- package/dist/Struct.js +7 -4
- package/dist/Struct.js.map +1 -1
- package/dist/SynchronizedRef.d.ts +3 -2
- package/dist/SynchronizedRef.d.ts.map +1 -1
- package/dist/SynchronizedRef.js.map +1 -1
- package/dist/Terminal.d.ts +3 -3
- package/dist/Terminal.d.ts.map +1 -1
- package/dist/Terminal.js +3 -3
- package/dist/Terminal.js.map +1 -1
- package/dist/Tracer.d.ts +27 -7
- package/dist/Tracer.d.ts.map +1 -1
- package/dist/Tracer.js +38 -13
- package/dist/Tracer.js.map +1 -1
- package/dist/Trie.d.ts +1 -1
- package/dist/Trie.d.ts.map +1 -1
- package/dist/Tuple.d.ts +2 -1
- package/dist/Tuple.d.ts.map +1 -1
- package/dist/Tuple.js.map +1 -1
- package/dist/TxChunk.d.ts +1 -1
- package/dist/TxChunk.d.ts.map +1 -1
- package/dist/TxChunk.js +1 -1
- package/dist/TxChunk.js.map +1 -1
- package/dist/TxDeferred.d.ts +1 -1
- package/dist/TxDeferred.d.ts.map +1 -1
- package/dist/TxDeferred.js +1 -1
- package/dist/TxDeferred.js.map +1 -1
- package/dist/TxHashMap.d.ts +1 -1
- package/dist/TxHashMap.d.ts.map +1 -1
- package/dist/TxHashMap.js +1 -1
- package/dist/TxHashMap.js.map +1 -1
- package/dist/TxHashSet.d.ts +1 -1
- package/dist/TxHashSet.d.ts.map +1 -1
- package/dist/TxHashSet.js +1 -1
- package/dist/TxHashSet.js.map +1 -1
- package/dist/TxPriorityQueue.d.ts +1 -1
- package/dist/TxPriorityQueue.d.ts.map +1 -1
- package/dist/TxPriorityQueue.js +1 -1
- package/dist/TxPriorityQueue.js.map +1 -1
- package/dist/TxPubSub.d.ts +1 -1
- package/dist/TxPubSub.d.ts.map +1 -1
- package/dist/TxPubSub.js +1 -1
- package/dist/TxPubSub.js.map +1 -1
- package/dist/TxQueue.d.ts +9 -9
- package/dist/TxQueue.d.ts.map +1 -1
- package/dist/TxQueue.js +93 -86
- package/dist/TxQueue.js.map +1 -1
- package/dist/TxReentrantLock.d.ts +29 -1
- package/dist/TxReentrantLock.d.ts.map +1 -1
- package/dist/TxReentrantLock.js +29 -1
- package/dist/TxReentrantLock.js.map +1 -1
- package/dist/TxRef.d.ts +1 -1
- package/dist/TxRef.d.ts.map +1 -1
- package/dist/TxRef.js +1 -1
- package/dist/TxRef.js.map +1 -1
- package/dist/TxSemaphore.d.ts +1 -1
- package/dist/TxSemaphore.d.ts.map +1 -1
- package/dist/TxSemaphore.js +1 -1
- package/dist/TxSemaphore.js.map +1 -1
- package/dist/TxSubscriptionRef.d.ts +1 -1
- package/dist/TxSubscriptionRef.d.ts.map +1 -1
- package/dist/TxSubscriptionRef.js +1 -1
- package/dist/TxSubscriptionRef.js.map +1 -1
- package/dist/Types.d.ts +33 -19
- package/dist/Types.d.ts.map +1 -1
- package/dist/Utils.d.ts.map +1 -1
- package/dist/Utils.js +2 -1
- package/dist/Utils.js.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/internal/arbitrary/model.d.ts +2 -0
- package/dist/internal/arbitrary/model.d.ts.map +1 -0
- package/dist/internal/arbitrary/model.js +495 -0
- package/dist/internal/arbitrary/model.js.map +1 -0
- package/dist/internal/arbitrary/regexp.d.ts +2 -0
- package/dist/internal/arbitrary/regexp.d.ts.map +1 -0
- package/dist/internal/arbitrary/regexp.js +789 -0
- package/dist/internal/arbitrary/regexp.js.map +1 -0
- package/dist/internal/arbitrary/runner.d.ts +2 -0
- package/dist/internal/arbitrary/runner.d.ts.map +1 -0
- package/dist/internal/arbitrary/runner.js +496 -0
- package/dist/internal/arbitrary/runner.js.map +1 -0
- package/dist/internal/arbitrary/schema.d.ts.map +1 -0
- package/dist/internal/arbitrary/schema.js +1340 -0
- package/dist/internal/arbitrary/schema.js.map +1 -0
- package/dist/internal/core.js +27 -13
- package/dist/internal/core.js.map +1 -1
- package/dist/internal/count.d.ts +2 -0
- package/dist/internal/count.d.ts.map +1 -0
- package/dist/internal/count.js +14 -0
- package/dist/internal/count.js.map +1 -0
- package/dist/internal/dateTime.js +4 -10
- package/dist/internal/dateTime.js.map +1 -1
- package/dist/internal/effect.js +416 -258
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/graph.js +3 -1
- package/dist/internal/graph.js.map +1 -1
- package/dist/internal/hashMap.js +5 -3
- package/dist/internal/hashMap.js.map +1 -1
- package/dist/internal/hashSet.js +1 -1
- package/dist/internal/hashSet.js.map +1 -1
- package/dist/internal/matcher.js +1 -1
- package/dist/internal/matcher.js.map +1 -1
- package/dist/internal/metric.js +1 -1
- package/dist/internal/metric.js.map +1 -1
- package/dist/internal/option.js +6 -5
- package/dist/internal/option.js.map +1 -1
- package/dist/internal/random.js +17 -0
- package/dist/internal/random.js.map +1 -1
- package/dist/internal/rcRef.js +10 -7
- package/dist/internal/rcRef.js.map +1 -1
- package/dist/internal/references.js +1 -0
- package/dist/internal/references.js.map +1 -1
- package/dist/internal/request.js +13 -6
- package/dist/internal/request.js.map +1 -1
- package/dist/internal/result.js +11 -9
- package/dist/internal/result.js.map +1 -1
- package/dist/internal/schema/annotations.js +1 -1
- package/dist/internal/schema/annotations.js.map +1 -1
- package/dist/internal/schema/fromJsonSchemaDocument.js +238 -132
- package/dist/internal/schema/fromJsonSchemaDocument.js.map +1 -1
- package/dist/internal/schema/fromRepresentation.js +5 -5
- package/dist/internal/schema/fromRepresentation.js.map +1 -1
- package/dist/internal/schema/make.d.ts +2 -0
- package/dist/internal/schema/make.d.ts.map +1 -0
- package/dist/internal/schema/{schema.js → make.js} +1 -25
- package/dist/internal/schema/make.js.map +1 -0
- package/dist/internal/schema/parser.d.ts +0 -12
- package/dist/internal/schema/parser.d.ts.map +1 -1
- package/dist/internal/schema/parser.js +7 -0
- package/dist/internal/schema/parser.js.map +1 -1
- package/dist/internal/schema/standardSchema.d.ts +2 -0
- package/dist/internal/schema/standardSchema.d.ts.map +1 -0
- package/dist/internal/schema/standardSchema.js +112 -0
- package/dist/internal/schema/standardSchema.js.map +1 -0
- package/dist/internal/schema/toCodeDocument.js +34 -22
- package/dist/internal/schema/toCodeDocument.js.map +1 -1
- package/dist/internal/schema/toCodec.d.ts +2 -0
- package/dist/internal/schema/toCodec.d.ts.map +1 -0
- package/dist/internal/schema/toCodec.js +242 -0
- package/dist/internal/schema/toCodec.js.map +1 -0
- package/dist/internal/schema/toDifferJsonPatch.d.ts +2 -0
- package/dist/internal/schema/toDifferJsonPatch.d.ts.map +1 -0
- package/dist/internal/schema/toDifferJsonPatch.js +20 -0
- package/dist/internal/schema/toDifferJsonPatch.js.map +1 -0
- package/dist/internal/schema/toEncoderXml.d.ts +2 -0
- package/dist/internal/schema/toEncoderXml.d.ts.map +1 -0
- package/dist/internal/schema/toEncoderXml.js +104 -0
- package/dist/internal/schema/toEncoderXml.js.map +1 -0
- package/dist/internal/schema/toEquivalence.js +66 -0
- package/dist/internal/schema/toEquivalence.js.map +1 -1
- package/dist/internal/schema/toFormatter.d.ts +2 -0
- package/dist/internal/schema/toFormatter.d.ts.map +1 -0
- package/dist/internal/schema/toFormatter.js +227 -0
- package/dist/internal/schema/toFormatter.js.map +1 -0
- package/dist/internal/schema/toIso.d.ts +2 -0
- package/dist/internal/schema/toIso.d.ts.map +1 -0
- package/dist/internal/schema/toIso.js +17 -0
- package/dist/internal/schema/toIso.js.map +1 -0
- package/dist/internal/schema/toJsonSchemaDocument.js +122 -71
- package/dist/internal/schema/toJsonSchemaDocument.js.map +1 -1
- package/dist/internal/schema/toRepresentation.js +3 -1
- package/dist/internal/schema/toRepresentation.js.map +1 -1
- package/dist/internal/schemaError.d.ts +4 -0
- package/dist/internal/schemaError.d.ts.map +1 -0
- package/dist/internal/schemaError.js +6 -0
- package/dist/internal/schemaError.js.map +1 -0
- package/dist/internal/stream.js +5 -6
- package/dist/internal/stream.js.map +1 -1
- package/dist/internal/tracer.d.ts +1 -3
- package/dist/internal/tracer.d.ts.map +1 -1
- package/dist/internal/tracer.js +6 -0
- package/dist/internal/tracer.js.map +1 -1
- package/dist/internal/trie.js +2 -2
- package/dist/internal/trie.js.map +1 -1
- package/dist/internal/uuid.d.ts +1 -2
- package/dist/internal/uuid.d.ts.map +1 -1
- package/dist/internal/uuid.js +2 -0
- package/dist/internal/uuid.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +9 -11
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/testing/TestSchema.js +20 -18
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/testing/index.d.ts +0 -4
- package/dist/testing/index.d.ts.map +1 -1
- package/dist/testing/index.js +0 -4
- package/dist/testing/index.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +98 -23
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +98 -6
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js +5 -16
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +27 -32
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/Chat.js +10 -13
- package/dist/unstable/ai/Chat.js.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.d.ts +23 -16
- package/dist/unstable/ai/EmbeddingModel.d.ts.map +1 -1
- package/dist/unstable/ai/EmbeddingModel.js +13 -11
- package/dist/unstable/ai/EmbeddingModel.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +48 -37
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +150 -47
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +2 -2
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js +87 -78
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js +3 -14
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Prompt.d.ts +2 -2
- package/dist/unstable/ai/Prompt.d.ts.map +1 -1
- package/dist/unstable/ai/Prompt.js +15 -4
- package/dist/unstable/ai/Prompt.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +37 -94
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js +46 -96
- package/dist/unstable/ai/Response.js.map +1 -1
- package/dist/unstable/ai/Tokenizer.js +4 -5
- package/dist/unstable/ai/Tokenizer.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +38 -20
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js +27 -1
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/ai/Toolkit.d.ts +1 -1
- package/dist/unstable/ai/Toolkit.d.ts.map +1 -1
- package/dist/unstable/ai/Toolkit.js +30 -18
- package/dist/unstable/ai/Toolkit.js.map +1 -1
- package/dist/unstable/ai/internal/codec-transformer.js +2 -2
- package/dist/unstable/ai/internal/codec-transformer.js.map +1 -1
- package/dist/unstable/ai/internal/structured-output.js +28 -5
- package/dist/unstable/ai/internal/structured-output.js.map +1 -1
- package/dist/unstable/arbitrary/Arbitrary.d.ts +626 -0
- package/dist/unstable/arbitrary/Arbitrary.d.ts.map +1 -0
- package/dist/unstable/arbitrary/Arbitrary.js +238 -0
- package/dist/unstable/arbitrary/Arbitrary.js.map +1 -0
- package/dist/unstable/arbitrary/index.d.ts +8 -0
- package/dist/unstable/arbitrary/index.d.ts.map +1 -0
- package/dist/unstable/arbitrary/index.js +9 -0
- package/dist/unstable/arbitrary/index.js.map +1 -0
- package/dist/unstable/cli/Argument.d.ts +104 -108
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js +56 -57
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +2 -0
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +2 -0
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/CliOutput.js +27 -4
- package/dist/unstable/cli/CliOutput.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +73 -73
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +22 -22
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/Completions.d.ts +4 -4
- package/dist/unstable/cli/Completions.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.d.ts +150 -161
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js +79 -90
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +3 -3
- package/dist/unstable/cli/GlobalFlag.js +13 -13
- package/dist/unstable/cli/GlobalFlag.js.map +1 -1
- package/dist/unstable/cli/Param.d.ts +118 -126
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +104 -113
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +69 -58
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js +65 -66
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/Prompt.d.ts +113 -59
- package/dist/unstable/cli/Prompt.d.ts.map +1 -1
- package/dist/unstable/cli/Prompt.js +391 -327
- package/dist/unstable/cli/Prompt.js.map +1 -1
- package/dist/unstable/cli/internal/completions/bash.js +109 -38
- package/dist/unstable/cli/internal/completions/bash.js.map +1 -1
- package/dist/unstable/cli/internal/completions/descriptor.js +23 -11
- package/dist/unstable/cli/internal/completions/descriptor.js.map +1 -1
- package/dist/unstable/cli/internal/completions/fish.js +15 -7
- package/dist/unstable/cli/internal/completions/fish.js.map +1 -1
- package/dist/unstable/cli/internal/completions/zsh.js +6 -4
- package/dist/unstable/cli/internal/completions/zsh.js.map +1 -1
- package/dist/unstable/cli/internal/config.js +4 -4
- package/dist/unstable/cli/internal/parser.js +1 -1
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/cli/internal/wizard.d.ts +5 -1
- package/dist/unstable/cli/internal/wizard.d.ts.map +1 -1
- package/dist/unstable/cli/internal/wizard.js +34 -26
- package/dist/unstable/cli/internal/wizard.js.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.d.ts +13 -0
- package/dist/unstable/cluster/ClusterSchema.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterSchema.js +16 -1
- package/dist/unstable/cluster/ClusterSchema.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.js +57 -14
- package/dist/unstable/cluster/ClusterWorkflowEngine.js.map +1 -1
- package/dist/unstable/cluster/Entity.d.ts.map +1 -1
- package/dist/unstable/cluster/Entity.js +2 -0
- package/dist/unstable/cluster/Entity.js.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.d.ts +2 -2
- package/dist/unstable/cluster/EntityProxyServer.d.ts.map +1 -1
- package/dist/unstable/cluster/EntityProxyServer.js.map +1 -1
- package/dist/unstable/cluster/Envelope.d.ts +22 -5
- package/dist/unstable/cluster/Envelope.d.ts.map +1 -1
- package/dist/unstable/cluster/Envelope.js +23 -3
- package/dist/unstable/cluster/Envelope.js.map +1 -1
- package/dist/unstable/cluster/HttpRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/HttpRunner.js +32 -13
- package/dist/unstable/cluster/HttpRunner.js.map +1 -1
- package/dist/unstable/cluster/Message.d.ts +17 -5
- package/dist/unstable/cluster/Message.d.ts.map +1 -1
- package/dist/unstable/cluster/Message.js +21 -8
- package/dist/unstable/cluster/Message.js.map +1 -1
- package/dist/unstable/cluster/MessageStorage.d.ts +34 -4
- package/dist/unstable/cluster/MessageStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/MessageStorage.js +33 -12
- package/dist/unstable/cluster/MessageStorage.js.map +1 -1
- package/dist/unstable/cluster/Reply.d.ts +5 -4
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js +21 -12
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts +1 -1
- package/dist/unstable/cluster/RunnerServer.d.ts.map +1 -1
- package/dist/unstable/cluster/RunnerServer.js +12 -6
- package/dist/unstable/cluster/RunnerServer.js.map +1 -1
- package/dist/unstable/cluster/Runners.d.ts +11 -5
- package/dist/unstable/cluster/Runners.d.ts.map +1 -1
- package/dist/unstable/cluster/Runners.js +56 -35
- package/dist/unstable/cluster/Runners.js.map +1 -1
- package/dist/unstable/cluster/Sharding.d.ts +1 -1
- package/dist/unstable/cluster/Sharding.d.ts.map +1 -1
- package/dist/unstable/cluster/Sharding.js +32 -17
- package/dist/unstable/cluster/Sharding.js.map +1 -1
- package/dist/unstable/cluster/ShardingConfig.js +23 -23
- package/dist/unstable/cluster/ShardingConfig.js.map +1 -1
- package/dist/unstable/cluster/SocketRunner.d.ts +2 -2
- package/dist/unstable/cluster/SocketRunner.d.ts.map +1 -1
- package/dist/unstable/cluster/SocketRunner.js +4 -3
- package/dist/unstable/cluster/SocketRunner.js.map +1 -1
- package/dist/unstable/cluster/SqlMessageStorage.js +11 -8
- package/dist/unstable/cluster/SqlMessageStorage.js.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.d.ts.map +1 -1
- package/dist/unstable/cluster/SqlRunnerStorage.js +11 -4
- package/dist/unstable/cluster/SqlRunnerStorage.js.map +1 -1
- package/dist/unstable/cluster/internal/clusterAbandon.d.ts +5 -0
- package/dist/unstable/cluster/internal/clusterAbandon.d.ts.map +1 -0
- package/dist/unstable/cluster/internal/clusterAbandon.js +9 -0
- package/dist/unstable/cluster/internal/clusterAbandon.js.map +1 -0
- package/dist/unstable/cluster/internal/entityManager.js +10 -6
- package/dist/unstable/cluster/internal/entityManager.js.map +1 -1
- package/dist/unstable/cluster/internal/interruptors.js +30 -1
- package/dist/unstable/cluster/internal/interruptors.js.map +1 -1
- package/dist/unstable/cluster/internal/resourceRef.js +12 -7
- package/dist/unstable/cluster/internal/resourceRef.js.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.d.ts.map +1 -1
- package/dist/unstable/devtools/DevToolsClient.js +12 -7
- package/dist/unstable/devtools/DevToolsClient.js.map +1 -1
- package/dist/unstable/encoding/Ini.d.ts +2 -0
- package/dist/unstable/encoding/Ini.d.ts.map +1 -1
- package/dist/unstable/encoding/Ini.js +2 -0
- package/dist/unstable/encoding/Ini.js.map +1 -1
- package/dist/unstable/encoding/SchemaBinary.d.ts +273 -0
- package/dist/unstable/encoding/SchemaBinary.d.ts.map +1 -0
- package/dist/unstable/encoding/SchemaBinary.js +4573 -0
- package/dist/unstable/encoding/SchemaBinary.js.map +1 -0
- package/dist/unstable/encoding/Sse.js +1 -1
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/encoding/Toml.d.ts +2 -0
- package/dist/unstable/encoding/Toml.d.ts.map +1 -1
- package/dist/unstable/encoding/Toml.js +6 -4
- package/dist/unstable/encoding/Toml.js.map +1 -1
- package/dist/unstable/encoding/Yaml.d.ts +2 -0
- package/dist/unstable/encoding/Yaml.d.ts.map +1 -1
- package/dist/unstable/encoding/Yaml.js +16 -5
- package/dist/unstable/encoding/Yaml.js.map +1 -1
- package/dist/unstable/encoding/index.d.ts +2 -2
- package/dist/unstable/encoding/index.d.ts.map +1 -1
- package/dist/unstable/encoding/index.js +2 -2
- package/dist/unstable/encoding/index.js.map +1 -1
- package/dist/unstable/eventlog/Event.d.ts +5 -5
- package/dist/unstable/eventlog/Event.d.ts.map +1 -1
- package/dist/unstable/eventlog/Event.js +3 -3
- package/dist/unstable/eventlog/Event.js.map +1 -1
- package/dist/unstable/eventlog/EventJournal.d.ts +15 -9
- package/dist/unstable/eventlog/EventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventJournal.js +26 -12
- package/dist/unstable/eventlog/EventJournal.js.map +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts +1 -1
- package/dist/unstable/eventlog/EventLog.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLog.js +13 -9
- package/dist/unstable/eventlog/EventLog.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +11 -5
- package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.js +25 -15
- package/dist/unstable/eventlog/EventLogMessage.js.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +7 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.js +13 -3
- package/dist/unstable/eventlog/EventLogRemote.js.map +1 -1
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js +2 -2
- package/dist/unstable/eventlog/EventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.d.ts +0 -10
- package/dist/unstable/eventlog/SqlEventJournal.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventJournal.js +29 -14
- package/dist/unstable/eventlog/SqlEventJournal.js.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.d.ts.map +1 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js +5 -1
- package/dist/unstable/eventlog/SqlEventLogServerUnencrypted.js.map +1 -1
- package/dist/unstable/http/Cookies.d.ts +1 -45
- package/dist/unstable/http/Cookies.d.ts.map +1 -1
- package/dist/unstable/http/Cookies.js +2 -64
- package/dist/unstable/http/Cookies.js.map +1 -1
- package/dist/unstable/http/FetchHttpClient.js +1 -1
- package/dist/unstable/http/FetchHttpClient.js.map +1 -1
- package/dist/unstable/http/FindMyWay/internal/router.js +124 -33
- package/dist/unstable/http/FindMyWay/internal/router.js.map +1 -1
- package/dist/unstable/http/FindMyWay.d.ts +15 -5
- package/dist/unstable/http/FindMyWay.d.ts.map +1 -1
- package/dist/unstable/http/FindMyWay.js +3 -1
- package/dist/unstable/http/FindMyWay.js.map +1 -1
- package/dist/unstable/http/Headers.d.ts +0 -22
- package/dist/unstable/http/Headers.d.ts.map +1 -1
- package/dist/unstable/http/Headers.js +3 -34
- package/dist/unstable/http/Headers.js.map +1 -1
- package/dist/unstable/http/HttpBody.d.ts +41 -10
- package/dist/unstable/http/HttpBody.d.ts.map +1 -1
- package/dist/unstable/http/HttpBody.js +64 -10
- package/dist/unstable/http/HttpBody.js.map +1 -1
- package/dist/unstable/http/HttpClient.d.ts +1 -1
- package/dist/unstable/http/HttpClient.d.ts.map +1 -1
- package/dist/unstable/http/HttpClient.js +28 -18
- package/dist/unstable/http/HttpClient.js.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts +28 -6
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.js +8 -19
- package/dist/unstable/http/HttpClientRequest.js.map +1 -1
- package/dist/unstable/http/HttpClientResponse.d.ts +6 -1
- package/dist/unstable/http/HttpClientResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientResponse.js +10 -6
- package/dist/unstable/http/HttpClientResponse.js.map +1 -1
- package/dist/unstable/http/HttpEffect.d.ts +16 -0
- package/dist/unstable/http/HttpEffect.d.ts.map +1 -1
- package/dist/unstable/http/HttpEffect.js +121 -65
- package/dist/unstable/http/HttpEffect.js.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.d.ts +3 -3
- package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js +1 -13
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +29 -21
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/http/HttpPlatform.d.ts +12 -11
- package/dist/unstable/http/HttpPlatform.d.ts.map +1 -1
- package/dist/unstable/http/HttpPlatform.js +36 -10
- package/dist/unstable/http/HttpPlatform.js.map +1 -1
- package/dist/unstable/http/HttpRouter.d.ts +5 -1
- package/dist/unstable/http/HttpRouter.d.ts.map +1 -1
- package/dist/unstable/http/HttpRouter.js +22 -8
- package/dist/unstable/http/HttpRouter.js.map +1 -1
- package/dist/unstable/http/HttpServer.d.ts +11 -42
- package/dist/unstable/http/HttpServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpServer.js +16 -20
- package/dist/unstable/http/HttpServer.js.map +1 -1
- package/dist/unstable/http/HttpServerRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerRequest.js +11 -11
- package/dist/unstable/http/HttpServerRequest.js.map +1 -1
- package/dist/unstable/http/HttpServerRespondable.js +1 -1
- package/dist/unstable/http/HttpServerRespondable.js.map +1 -1
- package/dist/unstable/http/HttpServerResponse.d.ts +9 -13
- package/dist/unstable/http/HttpServerResponse.d.ts.map +1 -1
- package/dist/unstable/http/HttpServerResponse.js +34 -44
- package/dist/unstable/http/HttpServerResponse.js.map +1 -1
- package/dist/unstable/http/HttpStaticServer.d.ts +2 -2
- package/dist/unstable/http/HttpStaticServer.d.ts.map +1 -1
- package/dist/unstable/http/HttpStaticServer.js +19 -19
- package/dist/unstable/http/HttpStaticServer.js.map +1 -1
- package/dist/unstable/http/Mime.d.ts +28 -0
- package/dist/unstable/http/Mime.d.ts.map +1 -0
- package/dist/unstable/http/Mime.js +72 -0
- package/dist/unstable/http/Mime.js.map +1 -0
- package/dist/unstable/http/Multipart.d.ts +22 -9
- package/dist/unstable/http/Multipart.d.ts.map +1 -1
- package/dist/unstable/http/Multipart.js +26 -10
- package/dist/unstable/http/Multipart.js.map +1 -1
- package/dist/unstable/http/MultipartParser/internal/multipart.d.ts +1 -1
- package/dist/unstable/http/MultipartParser/internal/multipart.d.ts.map +1 -1
- package/dist/unstable/http/MultipartParser/internal/multipart.js +8 -3
- package/dist/unstable/http/MultipartParser/internal/multipart.js.map +1 -1
- package/dist/unstable/http/MultipartParser.d.ts +4 -3
- package/dist/unstable/http/MultipartParser.d.ts.map +1 -1
- package/dist/unstable/http/MultipartParser.js.map +1 -1
- package/dist/unstable/http/UrlParams.d.ts +0 -97
- package/dist/unstable/http/UrlParams.d.ts.map +1 -1
- package/dist/unstable/http/UrlParams.js +3 -104
- package/dist/unstable/http/UrlParams.js.map +1 -1
- package/dist/unstable/http/index.d.ts +4 -0
- package/dist/unstable/http/index.d.ts.map +1 -1
- package/dist/unstable/http/index.js +4 -0
- package/dist/unstable/http/index.js.map +1 -1
- package/dist/unstable/http/internal/compression.js +8 -11
- package/dist/unstable/http/internal/compression.js.map +1 -1
- package/dist/unstable/http/internal/headers.d.ts +2 -0
- package/dist/unstable/http/internal/headers.d.ts.map +1 -0
- package/dist/unstable/http/internal/headers.js +5 -0
- package/dist/unstable/http/internal/headers.js.map +1 -0
- package/dist/unstable/http/internal/httpBody.js +8 -0
- package/dist/unstable/http/internal/httpBody.js.map +1 -1
- package/dist/unstable/http/internal/mimeTypes.d.ts +361 -0
- package/dist/unstable/http/internal/mimeTypes.d.ts.map +1 -0
- package/dist/unstable/http/internal/mimeTypes.js +363 -0
- package/dist/unstable/http/internal/mimeTypes.js.map +1 -0
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts +13 -0
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +28 -11
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +4 -3
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js +25 -13
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +8 -3
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.js +9 -6
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.js +3 -1
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.js +7 -5
- package/dist/unstable/httpapi/HttpApiMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiScalar.js +15 -12
- package/dist/unstable/httpapi/HttpApiScalar.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +12 -0
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.js +8 -10
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSwagger.js +6 -3
- package/dist/unstable/httpapi/HttpApiSwagger.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiTest.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiTest.js +8 -2
- package/dist/unstable/httpapi/HttpApiTest.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.d.ts.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js +31 -20
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/net/IpInterface.d.ts +140 -0
- package/dist/unstable/net/IpInterface.d.ts.map +1 -0
- package/dist/unstable/net/IpInterface.js +149 -0
- package/dist/unstable/net/IpInterface.js.map +1 -0
- package/dist/unstable/net/IpNetwork.d.ts +227 -0
- package/dist/unstable/net/IpNetwork.d.ts.map +1 -0
- package/dist/unstable/net/IpNetwork.js +239 -0
- package/dist/unstable/net/IpNetwork.js.map +1 -0
- package/dist/unstable/net/NetAddress.d.ts +705 -0
- package/dist/unstable/net/NetAddress.d.ts.map +1 -0
- package/dist/unstable/net/NetAddress.js +956 -0
- package/dist/unstable/net/NetAddress.js.map +1 -0
- package/dist/unstable/net/index.d.ts +16 -0
- package/dist/unstable/net/index.d.ts.map +1 -0
- package/dist/unstable/net/index.js +17 -0
- package/dist/unstable/net/index.js.map +1 -0
- package/dist/unstable/observability/OtlpExporter.d.ts +1 -0
- package/dist/unstable/observability/OtlpExporter.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpExporter.js +4 -6
- package/dist/unstable/observability/OtlpExporter.js.map +1 -1
- package/dist/unstable/observability/OtlpLogger.js +9 -9
- package/dist/unstable/observability/OtlpLogger.js.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpMetrics.js +9 -8
- package/dist/unstable/observability/OtlpMetrics.js.map +1 -1
- package/dist/unstable/observability/OtlpResource.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpResource.js +2 -2
- package/dist/unstable/observability/OtlpResource.js.map +1 -1
- package/dist/unstable/observability/OtlpTracer.d.ts.map +1 -1
- package/dist/unstable/observability/OtlpTracer.js +82 -55
- package/dist/unstable/observability/OtlpTracer.js.map +1 -1
- package/dist/unstable/observability/internal/otlpEnv.d.ts +1 -1
- package/dist/unstable/observability/internal/otlpEnv.d.ts.map +1 -1
- package/dist/unstable/observability/internal/otlpEnv.js +5 -9
- package/dist/unstable/observability/internal/otlpEnv.js.map +1 -1
- package/dist/unstable/persistence/PersistedCache.js +1 -1
- package/dist/unstable/persistence/PersistedCache.js.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts +114 -14
- package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.js +799 -234
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/RateLimiter.d.ts +28 -15
- package/dist/unstable/persistence/RateLimiter.d.ts.map +1 -1
- package/dist/unstable/persistence/RateLimiter.js +33 -41
- package/dist/unstable/persistence/RateLimiter.js.map +1 -1
- package/dist/unstable/process/ChildProcess.d.ts +8 -2
- package/dist/unstable/process/ChildProcess.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcess.js +7 -2
- package/dist/unstable/process/ChildProcess.js.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.d.ts +1 -1
- package/dist/unstable/process/ChildProcessSpawner.d.ts.map +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js +1 -1
- package/dist/unstable/process/ChildProcessSpawner.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +6 -3
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +3 -6
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.js +6 -3
- package/dist/unstable/reactivity/AtomHttpApi.js.map +1 -1
- package/dist/unstable/reactivity/AtomRegistry.js +2 -3
- package/dist/unstable/reactivity/AtomRegistry.js.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.d.ts +2 -2
- package/dist/unstable/reactivity/AtomRpc.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomRpc.js +1 -1
- package/dist/unstable/reactivity/AtomRpc.js.map +1 -1
- package/dist/unstable/reactivity/Hydration.d.ts +6 -4
- package/dist/unstable/reactivity/Hydration.d.ts.map +1 -1
- package/dist/unstable/reactivity/Hydration.js +20 -6
- package/dist/unstable/reactivity/Hydration.js.map +1 -1
- package/dist/unstable/reactivity/Reactivity.d.ts +26 -26
- package/dist/unstable/reactivity/Reactivity.d.ts.map +1 -1
- package/dist/unstable/reactivity/Reactivity.js +10 -12
- package/dist/unstable/reactivity/Reactivity.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts +5 -0
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +94 -81
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcClientError.d.ts +1 -1
- package/dist/unstable/rpc/RpcMessage.d.ts +66 -7
- package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMessage.js +68 -9
- package/dist/unstable/rpc/RpcMessage.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.js +7 -5
- package/dist/unstable/rpc/RpcMiddleware.js.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.d.ts +28 -33
- package/dist/unstable/rpc/RpcSerialization.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSerialization.js +56 -92
- package/dist/unstable/rpc/RpcSerialization.js.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +25 -0
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js +125 -68
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js +7 -6
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.js +3 -0
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/socket/Socket.d.ts +287 -102
- package/dist/unstable/socket/Socket.d.ts.map +1 -1
- package/dist/unstable/socket/Socket.js +408 -215
- package/dist/unstable/socket/Socket.js.map +1 -1
- package/dist/unstable/socket/SocketServer.d.ts +5 -32
- package/dist/unstable/socket/SocketServer.d.ts.map +1 -1
- package/dist/unstable/socket/SocketServer.js +3 -3
- package/dist/unstable/socket/SocketServer.js.map +1 -1
- package/dist/unstable/sql/SqlClient.d.ts +20 -0
- package/dist/unstable/sql/SqlClient.d.ts.map +1 -1
- package/dist/unstable/sql/SqlClient.js +14 -7
- package/dist/unstable/sql/SqlClient.js.map +1 -1
- package/dist/unstable/sql/SqlConnection.d.ts +15 -0
- package/dist/unstable/sql/SqlConnection.d.ts.map +1 -1
- package/dist/unstable/sql/SqlConnection.js.map +1 -1
- package/dist/unstable/sql/SqlModel.d.ts +1 -1
- package/dist/unstable/sql/SqlModel.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.d.ts +13 -5
- package/dist/unstable/sql/Statement.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.js +29 -15
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/workers/Transferable.js +1 -1
- package/dist/unstable/workers/Worker.d.ts.map +1 -1
- package/dist/unstable/workers/Worker.js +3 -1
- package/dist/unstable/workers/Worker.js.map +1 -1
- package/dist/unstable/workflow/Activity.d.ts +7 -0
- package/dist/unstable/workflow/Activity.d.ts.map +1 -1
- package/dist/unstable/workflow/Activity.js +14 -4
- package/dist/unstable/workflow/Activity.js.map +1 -1
- package/dist/unstable/workflow/DurableClock.js +1 -1
- package/dist/unstable/workflow/DurableClock.js.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts +2 -2
- package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.js.map +1 -1
- package/dist/unstable/workflow/DurableQueue.d.ts +8 -0
- package/dist/unstable/workflow/DurableQueue.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableQueue.js +8 -0
- package/dist/unstable/workflow/DurableQueue.js.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +5 -0
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js +70 -12
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +6 -0
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.js +11 -0
- package/dist/unstable/workflow/WorkflowEngine.js.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.d.ts +2 -2
- package/dist/unstable/workflow/WorkflowProxy.d.ts.map +1 -1
- package/dist/unstable/workflow/WorkflowProxy.js +4 -2
- package/dist/unstable/workflow/WorkflowProxy.js.map +1 -1
- package/package.json +8 -10
- package/src/Array.ts +142 -70
- package/src/BigDecimal.ts +50 -28
- package/src/ByteSize.ts +838 -0
- package/src/Cache.ts +17 -3
- package/src/Cause.ts +1 -1
- package/src/Channel.ts +185 -50
- package/src/Chunk.ts +65 -36
- package/src/Config.ts +237 -248
- package/src/ConfigProvider.ts +7 -8
- package/src/Context.ts +31 -0
- package/src/Cron.ts +2 -2
- package/src/Crypto.ts +3 -2
- package/src/Deferred.ts +7 -6
- package/src/Duration.ts +1 -1
- package/src/Effect.ts +226 -122
- package/src/Effectable.ts +78 -9
- package/src/Encoding.ts +101 -11
- package/src/Equal.ts +1 -1
- package/src/ExecutionPlan.ts +3 -0
- package/src/Fiber.ts +33 -8
- package/src/FiberHandle.ts +3 -3
- package/src/FiberMap.ts +19 -10
- package/src/FileSystem.ts +55 -230
- package/src/Formatter.ts +21 -3
- package/src/Graph.ts +55 -25
- package/src/Hash.ts +5 -16
- package/src/HashRing.ts +9 -2
- package/src/HashSet.ts +56 -0
- package/src/Iterable.ts +90 -44
- package/src/JsonPatch.ts +4 -4
- package/src/JsonPointer.ts +97 -4
- package/src/JsonSchema.ts +998 -476
- package/src/Layer.ts +59 -18
- package/src/LayerMap.ts +38 -6
- package/src/LayerRef.ts +7 -5
- package/src/Logger.ts +125 -18
- package/src/ManagedRuntime.ts +1 -1
- package/src/Match.ts +33 -14
- package/src/Metric.ts +24 -21
- package/src/MutableHashMap.ts +1 -1
- package/src/MutableHashSet.ts +1 -1
- package/src/MutableList.ts +18 -2
- package/src/Number.ts +7 -1
- package/src/Optic.ts +8 -4
- package/src/Option.ts +1 -1
- package/src/Order.ts +3 -1
- package/src/PartitionedSemaphore.ts +1 -2
- package/src/Path.ts +1 -1
- package/src/PlatformError.ts +1 -1
- package/src/Pool.ts +535 -134
- package/src/PrimaryKey.ts +1 -1
- package/src/PubSub.ts +32 -20
- package/src/Queue.ts +119 -28
- package/src/Random.ts +20 -6
- package/src/RcMap.ts +176 -13
- package/src/Record.ts +15 -0
- package/src/Redacted.ts +1 -1
- package/src/RequestResolver.ts +49 -26
- package/src/Result.ts +1 -1
- package/src/Scheduler.ts +21 -11
- package/src/Schema.ts +5032 -6518
- package/src/SchemaAST.ts +1156 -316
- package/src/SchemaGetter.ts +75 -21
- package/src/SchemaIssue.ts +260 -16
- package/src/SchemaParser.ts +2 -12
- package/src/SchemaRepresentation.ts +1774 -189
- package/src/SchemaTransformation.ts +145 -22
- package/src/Scope.ts +9 -2
- package/src/ScopedCache.ts +10 -3
- package/src/Sink.ts +31 -15
- package/src/StandardSchema.ts +207 -0
- package/src/Stream.ts +294 -76
- package/src/String.ts +20 -9
- package/src/Struct.ts +8 -4
- package/src/SynchronizedRef.ts +3 -5
- package/src/Terminal.ts +3 -3
- package/src/Tracer.ts +43 -14
- package/src/Tuple.ts +3 -1
- package/src/TxChunk.ts +1 -1
- package/src/TxDeferred.ts +1 -1
- package/src/TxHashMap.ts +1 -1
- package/src/TxHashSet.ts +92 -11
- package/src/TxPriorityQueue.ts +1 -1
- package/src/TxPubSub.ts +1 -1
- package/src/TxQueue.ts +22 -17
- package/src/TxReentrantLock.ts +29 -1
- package/src/TxRef.ts +1 -1
- package/src/TxSemaphore.ts +1 -1
- package/src/TxSubscriptionRef.ts +1 -1
- package/src/Types.ts +40 -17
- package/src/Utils.ts +3 -1
- package/src/index.ts +10 -0
- package/src/internal/arbitrary/model.ts +701 -0
- package/src/internal/arbitrary/regexp.ts +855 -0
- package/src/internal/arbitrary/runner.ts +608 -0
- package/src/internal/arbitrary/schema.ts +1800 -0
- package/src/internal/core.ts +48 -22
- package/src/internal/count.ts +14 -0
- package/src/internal/dateTime.ts +8 -10
- package/src/internal/effect.ts +510 -301
- package/src/internal/graph.ts +6 -1
- package/src/internal/hashMap.ts +5 -3
- package/src/internal/hashSet.ts +1 -1
- package/src/internal/matcher.ts +34 -19
- package/src/internal/metric.ts +1 -1
- package/src/internal/option.ts +8 -6
- package/src/internal/random.ts +20 -7
- package/src/internal/rcRef.ts +10 -7
- package/src/internal/references.ts +1 -0
- package/src/internal/request.ts +12 -7
- package/src/internal/result.ts +15 -11
- package/src/internal/schema/annotations.ts +3 -3
- package/src/internal/schema/fromJsonSchemaDocument.ts +326 -160
- package/src/internal/schema/fromRepresentation.ts +5 -3
- package/src/internal/schema/{schema.ts → make.ts} +0 -40
- package/src/internal/schema/parser.ts +8 -0
- package/src/internal/schema/standardSchema.ts +125 -0
- package/src/internal/schema/toCodeDocument.ts +58 -44
- package/src/internal/schema/toCodec.ts +312 -0
- package/src/internal/schema/toDifferJsonPatch.ts +24 -0
- package/src/internal/schema/toEncoderXml.ts +110 -0
- package/src/internal/schema/toEquivalence.ts +76 -0
- package/src/internal/schema/toFormatter.ts +230 -0
- package/src/internal/schema/toIso.ts +20 -0
- package/src/internal/schema/toJsonSchemaDocument.ts +125 -67
- package/src/internal/schema/toRepresentation.ts +1 -1
- package/src/internal/schemaError.ts +8 -0
- package/src/internal/stream.ts +14 -6
- package/src/internal/tracer.ts +4 -0
- package/src/internal/trie.ts +5 -2
- package/src/internal/uuid.ts +4 -0
- package/src/testing/TestSchema.ts +36 -30
- package/src/testing/index.ts +0 -5
- package/src/unstable/ai/AiError.ts +126 -6
- package/src/unstable/ai/AnthropicStructuredOutput.ts +8 -5
- package/src/unstable/ai/Chat.ts +35 -36
- package/src/unstable/ai/EmbeddingModel.ts +27 -15
- package/src/unstable/ai/LanguageModel.ts +283 -100
- package/src/unstable/ai/McpServer.ts +105 -92
- package/src/unstable/ai/OpenAiStructuredOutput.ts +6 -3
- package/src/unstable/ai/Prompt.ts +20 -5
- package/src/unstable/ai/Response.ts +107 -189
- package/src/unstable/ai/Tokenizer.ts +4 -5
- package/src/unstable/ai/Tool.ts +58 -35
- package/src/unstable/ai/Toolkit.ts +43 -37
- package/src/unstable/ai/internal/codec-transformer.ts +3 -2
- package/src/unstable/ai/internal/structured-output.ts +29 -6
- package/src/unstable/arbitrary/Arbitrary.ts +715 -0
- package/src/unstable/arbitrary/index.ts +10 -0
- package/src/unstable/cli/Argument.ts +111 -115
- package/src/unstable/cli/CliError.ts +2 -0
- package/src/unstable/cli/CliOutput.ts +41 -4
- package/src/unstable/cli/Command.ts +79 -78
- package/src/unstable/cli/Completions.ts +4 -4
- package/src/unstable/cli/Flag.ts +158 -169
- package/src/unstable/cli/GlobalFlag.ts +13 -13
- package/src/unstable/cli/Param.ts +150 -159
- package/src/unstable/cli/Primitive.ts +75 -76
- package/src/unstable/cli/Prompt.ts +543 -408
- package/src/unstable/cli/internal/completions/bash.ts +113 -38
- package/src/unstable/cli/internal/completions/descriptor.ts +23 -11
- package/src/unstable/cli/internal/completions/fish.ts +17 -9
- package/src/unstable/cli/internal/completions/zsh.ts +7 -4
- package/src/unstable/cli/internal/config.ts +4 -4
- package/src/unstable/cli/internal/parser.ts +1 -1
- package/src/unstable/cli/internal/wizard.ts +60 -32
- package/src/unstable/cluster/ClusterSchema.ts +19 -1
- package/src/unstable/cluster/ClusterWorkflowEngine.ts +66 -16
- package/src/unstable/cluster/Entity.ts +3 -0
- package/src/unstable/cluster/EntityProxyServer.ts +6 -2
- package/src/unstable/cluster/Envelope.ts +32 -3
- package/src/unstable/cluster/HttpRunner.ts +52 -25
- package/src/unstable/cluster/Message.ts +35 -13
- package/src/unstable/cluster/MessageStorage.ts +69 -24
- package/src/unstable/cluster/Reply.ts +36 -19
- package/src/unstable/cluster/RunnerServer.ts +21 -11
- package/src/unstable/cluster/Runners.ts +93 -80
- package/src/unstable/cluster/Sharding.ts +44 -19
- package/src/unstable/cluster/ShardingConfig.ts +23 -23
- package/src/unstable/cluster/SocketRunner.ts +5 -4
- package/src/unstable/cluster/SqlMessageStorage.ts +12 -8
- package/src/unstable/cluster/SqlRunnerStorage.ts +18 -10
- package/src/unstable/cluster/internal/clusterAbandon.ts +14 -0
- package/src/unstable/cluster/internal/entityManager.ts +15 -6
- package/src/unstable/cluster/internal/interruptors.ts +58 -1
- package/src/unstable/cluster/internal/resourceRef.ts +15 -7
- package/src/unstable/devtools/DevToolsClient.ts +13 -3
- package/src/unstable/encoding/Ini.ts +2 -0
- package/src/unstable/encoding/SchemaBinary.ts +5308 -0
- package/src/unstable/encoding/Sse.ts +1 -1
- package/src/unstable/encoding/Toml.ts +7 -5
- package/src/unstable/encoding/Yaml.ts +18 -5
- package/src/unstable/encoding/index.ts +2 -2
- package/src/unstable/eventlog/Event.ts +7 -7
- package/src/unstable/eventlog/EventJournal.ts +22 -15
- package/src/unstable/eventlog/EventLog.ts +24 -14
- package/src/unstable/eventlog/EventLogMessage.ts +25 -15
- package/src/unstable/eventlog/EventLogRemote.ts +15 -4
- package/src/unstable/eventlog/EventLogServerUnencrypted.ts +2 -2
- package/src/unstable/eventlog/SqlEventJournal.ts +35 -10
- package/src/unstable/eventlog/SqlEventLogServerUnencrypted.ts +11 -1
- package/src/unstable/http/Cookies.ts +2 -102
- package/src/unstable/http/FetchHttpClient.ts +1 -1
- package/src/unstable/http/FindMyWay/internal/router.ts +139 -33
- package/src/unstable/http/FindMyWay.ts +15 -5
- package/src/unstable/http/Headers.ts +3 -48
- package/src/unstable/http/HttpBody.ts +107 -36
- package/src/unstable/http/HttpClient.ts +41 -30
- package/src/unstable/http/HttpClientRequest.ts +32 -18
- package/src/unstable/http/HttpClientResponse.ts +16 -3
- package/src/unstable/http/HttpEffect.ts +145 -73
- package/src/unstable/http/HttpIncomingMessage.ts +4 -4
- package/src/unstable/http/HttpMiddleware.ts +43 -24
- package/src/unstable/http/HttpPlatform.ts +62 -20
- package/src/unstable/http/HttpRouter.ts +27 -16
- package/src/unstable/http/HttpServer.ts +18 -57
- package/src/unstable/http/HttpServerRequest.ts +17 -15
- package/src/unstable/http/HttpServerRespondable.ts +1 -1
- package/src/unstable/http/HttpServerResponse.ts +49 -40
- package/src/unstable/http/HttpStaticServer.ts +30 -28
- package/src/unstable/http/Mime.ts +76 -0
- package/src/unstable/http/Multipart.ts +35 -18
- package/src/unstable/http/MultipartParser/internal/multipart.ts +10 -3
- package/src/unstable/http/MultipartParser.ts +4 -3
- package/src/unstable/http/UrlParams.ts +3 -161
- package/src/unstable/http/index.ts +5 -0
- package/src/unstable/http/internal/compression.ts +11 -12
- package/src/unstable/http/internal/headers.ts +7 -0
- package/src/unstable/http/internal/httpBody.ts +9 -0
- package/src/unstable/http/internal/mimeTypes.ts +395 -0
- package/src/unstable/httpapi/HttpApiBuilder.ts +63 -11
- package/src/unstable/httpapi/HttpApiClient.ts +44 -24
- package/src/unstable/httpapi/HttpApiEndpoint.ts +24 -11
- package/src/unstable/httpapi/HttpApiError.ts +3 -1
- package/src/unstable/httpapi/HttpApiMiddleware.ts +7 -5
- package/src/unstable/httpapi/HttpApiScalar.ts +30 -27
- package/src/unstable/httpapi/HttpApiSchema.ts +14 -7
- package/src/unstable/httpapi/HttpApiSwagger.ts +6 -3
- package/src/unstable/httpapi/HttpApiTest.ts +6 -1
- package/src/unstable/httpapi/OpenApi.ts +32 -22
- package/src/unstable/net/IpInterface.ts +242 -0
- package/src/unstable/net/IpNetwork.ts +357 -0
- package/src/unstable/net/NetAddress.ts +1271 -0
- package/src/unstable/net/index.ts +20 -0
- package/src/unstable/observability/OtlpExporter.ts +5 -6
- package/src/unstable/observability/OtlpLogger.ts +9 -9
- package/src/unstable/observability/OtlpMetrics.ts +9 -8
- package/src/unstable/observability/OtlpResource.ts +5 -4
- package/src/unstable/observability/OtlpTracer.ts +103 -81
- package/src/unstable/observability/internal/otlpEnv.ts +10 -13
- package/src/unstable/persistence/PersistedCache.ts +1 -1
- package/src/unstable/persistence/PersistedQueue.ts +1100 -291
- package/src/unstable/persistence/RateLimiter.ts +64 -58
- package/src/unstable/process/ChildProcess.ts +15 -4
- package/src/unstable/process/ChildProcessSpawner.ts +1 -1
- package/src/unstable/reactivity/Atom.ts +6 -3
- package/src/unstable/reactivity/AtomHttpApi.ts +21 -10
- package/src/unstable/reactivity/AtomRegistry.ts +2 -4
- package/src/unstable/reactivity/AtomRpc.ts +6 -5
- package/src/unstable/reactivity/Hydration.ts +26 -7
- package/src/unstable/reactivity/Reactivity.ts +49 -36
- package/src/unstable/rpc/RpcClient.ts +100 -82
- package/src/unstable/rpc/RpcMessage.ts +78 -11
- package/src/unstable/rpc/RpcMiddleware.ts +7 -5
- package/src/unstable/rpc/RpcSerialization.ts +82 -92
- package/src/unstable/rpc/RpcServer.ts +171 -93
- package/src/unstable/schema/Model.ts +8 -7
- package/src/unstable/schema/VariantSchema.ts +3 -0
- package/src/unstable/socket/Socket.ts +714 -383
- package/src/unstable/socket/SocketServer.ts +5 -35
- package/src/unstable/sql/SqlClient.ts +42 -7
- package/src/unstable/sql/SqlConnection.ts +18 -0
- package/src/unstable/sql/SqlModel.ts +1 -1
- package/src/unstable/sql/Statement.ts +46 -20
- package/src/unstable/workers/Transferable.ts +1 -1
- package/src/unstable/workers/Worker.ts +3 -1
- package/src/unstable/workflow/Activity.ts +20 -9
- package/src/unstable/workflow/DurableClock.ts +1 -1
- package/src/unstable/workflow/DurableDeferred.ts +6 -0
- package/src/unstable/workflow/DurableQueue.ts +8 -0
- package/src/unstable/workflow/Workflow.ts +105 -28
- package/src/unstable/workflow/WorkflowEngine.ts +22 -0
- package/src/unstable/workflow/WorkflowProxy.ts +8 -4
- package/dist/internal/schema/schema.d.ts.map +0 -1
- package/dist/internal/schema/schema.js.map +0 -1
- package/dist/internal/schema/toArbitrary.d.ts +0 -2
- package/dist/internal/schema/toArbitrary.d.ts.map +0 -1
- package/dist/internal/schema/toArbitrary.js +0 -705
- package/dist/internal/schema/toArbitrary.js.map +0 -1
- package/dist/testing/FastCheck.d.ts +0 -90
- package/dist/testing/FastCheck.d.ts.map +0 -1
- package/dist/testing/FastCheck.js +0 -90
- package/dist/testing/FastCheck.js.map +0 -1
- package/dist/unstable/encoding/Msgpack.d.ts +0 -185
- package/dist/unstable/encoding/Msgpack.d.ts.map +0 -1
- package/dist/unstable/encoding/Msgpack.js +0 -227
- package/dist/unstable/encoding/Msgpack.js.map +0 -1
- package/src/internal/schema/toArbitrary.ts +0 -843
- package/src/testing/FastCheck.ts +0 -90
- package/src/unstable/encoding/Msgpack.ts +0 -432
- /package/dist/internal/{schema → arbitrary}/schema.d.ts +0 -0
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
* @since 4.0.0
|
|
12
12
|
*/
|
|
13
13
|
import * as Arr from "../../Array.js";
|
|
14
|
+
import * as Context from "../../Context.js";
|
|
14
15
|
import * as Data from "../../Data.js";
|
|
15
16
|
import * as Effect from "../../Effect.js";
|
|
16
17
|
import * as Effectable from "../../Effectable.js";
|
|
@@ -32,41 +33,62 @@ const TypeId = "~effect/cli/Prompt";
|
|
|
32
33
|
* @since 4.0.0
|
|
33
34
|
*/
|
|
34
35
|
export const isPrompt = u => Predicate.hasProperty(u, TypeId);
|
|
35
|
-
const
|
|
36
|
+
const defaultTheme = {
|
|
37
|
+
prefix: "?",
|
|
36
38
|
arrowUp: "↑",
|
|
37
39
|
arrowDown: "↓",
|
|
38
|
-
arrowLeft: "←",
|
|
39
|
-
arrowRight: "→",
|
|
40
|
-
radioOn: "◉",
|
|
41
|
-
radioOff: "◯",
|
|
42
40
|
checkboxOn: "☒",
|
|
43
41
|
checkboxOff: "☐",
|
|
44
42
|
tick: "✔",
|
|
45
|
-
cross: "✖",
|
|
46
43
|
ellipsis: "…",
|
|
47
44
|
pointerSmall: "›",
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
45
|
+
pointer: "❯",
|
|
46
|
+
descriptionSeparator: "- ",
|
|
47
|
+
passwordMask: "*",
|
|
48
|
+
toggleSeparator: "/",
|
|
49
|
+
primaryColor: Ansi.cyanBright,
|
|
50
|
+
mutedColor: Ansi.blackBright,
|
|
51
|
+
successColor: Ansi.green,
|
|
52
|
+
errorColor: Ansi.red,
|
|
53
|
+
submittedColor: Ansi.white
|
|
54
|
+
};
|
|
55
|
+
const windowsTheme = {
|
|
56
|
+
...defaultTheme,
|
|
59
57
|
checkboxOn: "[*]",
|
|
60
58
|
checkboxOff: "[ ]",
|
|
61
59
|
tick: "√",
|
|
62
|
-
cross: "×",
|
|
63
60
|
ellipsis: "...",
|
|
64
61
|
pointerSmall: "»",
|
|
65
|
-
line: "─",
|
|
66
62
|
pointer: ">"
|
|
67
63
|
};
|
|
68
|
-
/**
|
|
69
|
-
|
|
64
|
+
/**
|
|
65
|
+
* Creates a prompt theme using the current platform defaults.
|
|
66
|
+
*
|
|
67
|
+
* @category constructors
|
|
68
|
+
* @since 4.0.0
|
|
69
|
+
*/
|
|
70
|
+
export const makeTheme = options => ({
|
|
71
|
+
...(process.platform === "win32" ? windowsTheme : defaultTheme),
|
|
72
|
+
...options
|
|
73
|
+
});
|
|
74
|
+
/**
|
|
75
|
+
* Context reference for the theme used by built-in prompts.
|
|
76
|
+
*
|
|
77
|
+
* **Details**
|
|
78
|
+
*
|
|
79
|
+
* Provide this reference once to theme every prompt in an application. A
|
|
80
|
+
* prompt's `theme` option takes precedence over the context value.
|
|
81
|
+
*
|
|
82
|
+
* @category services
|
|
83
|
+
* @since 4.0.0
|
|
84
|
+
*/
|
|
85
|
+
export const Theme = /*#__PURE__*/Context.Reference("effect/unstable/cli/Prompt/Theme", {
|
|
86
|
+
defaultValue: makeTheme
|
|
87
|
+
});
|
|
88
|
+
const getTheme = options => Effect.map(Theme, theme => ({
|
|
89
|
+
...theme,
|
|
90
|
+
...options.theme
|
|
91
|
+
}));
|
|
70
92
|
/**
|
|
71
93
|
* Runs all the provided prompts in sequence respecting the structure provided
|
|
72
94
|
* in input.
|
|
@@ -139,7 +161,19 @@ export const all = function () {
|
|
|
139
161
|
return allTupled(arguments[0]);
|
|
140
162
|
};
|
|
141
163
|
const annotateLine = line => Ansi.annotate(line, Ansi.bold);
|
|
142
|
-
const annotateErrorLine = line => Ansi.annotate(line, Ansi.combine(Ansi.italicized,
|
|
164
|
+
const annotateErrorLine = (line, color) => Ansi.annotate(line, Ansi.combine(Ansi.italicized, color));
|
|
165
|
+
const annotateSymbol = (symbol, ...styles) => symbol.length === 0 ? "" : Ansi.annotate(symbol, ...styles);
|
|
166
|
+
const separateSymbol = (symbol, text) => symbol.length === 0 ? text : symbol + " " + text;
|
|
167
|
+
const renderPagingPrefix = (theme, showArrowUp, showArrowDown) => {
|
|
168
|
+
const width = Math.max(theme.arrowUp.length, theme.arrowDown.length);
|
|
169
|
+
if (showArrowUp) {
|
|
170
|
+
return theme.arrowUp.padEnd(width);
|
|
171
|
+
}
|
|
172
|
+
if (showArrowDown) {
|
|
173
|
+
return theme.arrowDown.padEnd(width);
|
|
174
|
+
}
|
|
175
|
+
return " ".repeat(width);
|
|
176
|
+
};
|
|
143
177
|
/**
|
|
144
178
|
* Creates a confirmation prompt that asks the user to choose a boolean yes/no
|
|
145
179
|
* value.
|
|
@@ -153,16 +187,15 @@ const annotateErrorLine = line => Ansi.annotate(line, Ansi.combine(Ansi.italiciz
|
|
|
153
187
|
* `initial` defaults to `false`. Enter submits the current default, yes-style
|
|
154
188
|
* input submits `true`, no-style input submits `false`, and other input beeps.
|
|
155
189
|
*
|
|
156
|
-
* @see {@link
|
|
190
|
+
* @see {@link Toggle} for an interactive switch-before-submit boolean prompt
|
|
157
191
|
*
|
|
158
192
|
* @category constructors
|
|
159
193
|
* @since 4.0.0
|
|
160
194
|
*/
|
|
161
|
-
export const
|
|
195
|
+
export const Confirm = options => {
|
|
162
196
|
const opts = {
|
|
163
197
|
initial: false,
|
|
164
198
|
...options,
|
|
165
|
-
prefix: options.prefix ?? DEFAULT_PREFIX,
|
|
166
199
|
label: {
|
|
167
200
|
confirm: "yes",
|
|
168
201
|
deny: "no",
|
|
@@ -177,7 +210,7 @@ export const confirm = options => {
|
|
|
177
210
|
const initialState = {
|
|
178
211
|
value: opts.initial
|
|
179
212
|
};
|
|
180
|
-
return
|
|
213
|
+
return Custom(initialState, {
|
|
181
214
|
render: handleConfirmRender(opts),
|
|
182
215
|
process: input => handleConfirmProcess(input, opts.initial),
|
|
183
216
|
clear: handleConfirmClear(opts)
|
|
@@ -205,7 +238,7 @@ export const confirm = options => {
|
|
|
205
238
|
* @category constructors
|
|
206
239
|
* @since 4.0.0
|
|
207
240
|
*/
|
|
208
|
-
export const
|
|
241
|
+
export const Custom = (initialState, ...args) => {
|
|
209
242
|
const [events, handlers] = args.length === 1 ? [undefined, args[0]] : [args[0], args[1]];
|
|
210
243
|
const op = Object.create(proto);
|
|
211
244
|
op._tag = "Loop";
|
|
@@ -237,13 +270,12 @@ export const custom = (initialState, ...args) => {
|
|
|
237
270
|
* @category constructors
|
|
238
271
|
* @since 4.0.0
|
|
239
272
|
*/
|
|
240
|
-
export const
|
|
273
|
+
export const Date = options => {
|
|
241
274
|
const opts = {
|
|
242
|
-
initial: new Date(),
|
|
275
|
+
initial: new globalThis.Date(),
|
|
243
276
|
dateMask: "YYYY-MM-DD HH:mm:ss",
|
|
244
277
|
validate: Effect.succeed,
|
|
245
278
|
...options,
|
|
246
|
-
prefix: options.prefix ?? DEFAULT_PREFIX,
|
|
247
279
|
locales: {
|
|
248
280
|
...defaultLocales,
|
|
249
281
|
...options.locales
|
|
@@ -258,7 +290,7 @@ export const date = options => {
|
|
|
258
290
|
value: opts.initial,
|
|
259
291
|
error: Option.none()
|
|
260
292
|
};
|
|
261
|
-
return
|
|
293
|
+
return Custom(initialState, {
|
|
262
294
|
render: handleDateRender(opts),
|
|
263
295
|
process: handleDateProcess(opts),
|
|
264
296
|
clear: handleDateClear(opts)
|
|
@@ -272,14 +304,19 @@ export const date = options => {
|
|
|
272
304
|
* The prompt can be configured to select files, directories, or either path
|
|
273
305
|
* type.
|
|
274
306
|
*
|
|
307
|
+
* You can also type to filter the listed entries. Every printable character is
|
|
308
|
+
* appended to the filter query, so navigation is bound to the arrow keys,
|
|
309
|
+
* `tab`, and the `Ctrl+P` / `Ctrl+N` chords used by `readline` and `fzf`
|
|
310
|
+
* (`Ctrl+K` also moves up). `Ctrl+U` clears the query.
|
|
311
|
+
*
|
|
275
312
|
* @category constructors
|
|
276
313
|
* @since 4.0.0
|
|
277
314
|
*/
|
|
278
|
-
export const
|
|
315
|
+
export const File = (options = {}) => {
|
|
279
316
|
const opts = {
|
|
317
|
+
...options,
|
|
280
318
|
type: options.type ?? "file",
|
|
281
319
|
message: options.message ?? `Choose a file`,
|
|
282
|
-
prefix: options.prefix ?? DEFAULT_PREFIX,
|
|
283
320
|
startingPath: Option.fromUndefinedOr(options.startingPath),
|
|
284
321
|
default: Option.fromUndefinedOr(options.default),
|
|
285
322
|
maxPerPage: options.maxPerPage ?? 10,
|
|
@@ -301,7 +338,7 @@ export const file = (options = {}) => {
|
|
|
301
338
|
return index === -1 ? 0 : index;
|
|
302
339
|
}
|
|
303
340
|
});
|
|
304
|
-
const confirm =
|
|
341
|
+
const confirm = FileConfirm.Hide();
|
|
305
342
|
return {
|
|
306
343
|
cursor,
|
|
307
344
|
files,
|
|
@@ -311,7 +348,7 @@ export const file = (options = {}) => {
|
|
|
311
348
|
confirm
|
|
312
349
|
};
|
|
313
350
|
});
|
|
314
|
-
return
|
|
351
|
+
return Custom(initialState, {
|
|
315
352
|
render: handleFileRender(opts),
|
|
316
353
|
process: handleFileProcess(opts),
|
|
317
354
|
clear: handleFileClear(opts)
|
|
@@ -341,11 +378,11 @@ export const flatMap = /*#__PURE__*/dual(2, (self, f) => {
|
|
|
341
378
|
* @category constructors
|
|
342
379
|
* @since 4.0.0
|
|
343
380
|
*/
|
|
344
|
-
export const
|
|
381
|
+
export const Number = options => {
|
|
345
382
|
const opts = {
|
|
346
383
|
default: 0,
|
|
347
|
-
min: Number.NEGATIVE_INFINITY,
|
|
348
|
-
max: Number.POSITIVE_INFINITY,
|
|
384
|
+
min: globalThis.Number.NEGATIVE_INFINITY,
|
|
385
|
+
max: globalThis.Number.POSITIVE_INFINITY,
|
|
349
386
|
incrementBy: 1,
|
|
350
387
|
decrementBy: 1,
|
|
351
388
|
precision: 2,
|
|
@@ -358,8 +395,7 @@ export const float = options => {
|
|
|
358
395
|
}
|
|
359
396
|
return Effect.succeed(n);
|
|
360
397
|
},
|
|
361
|
-
...options
|
|
362
|
-
prefix: options.prefix ?? DEFAULT_PREFIX
|
|
398
|
+
...options
|
|
363
399
|
};
|
|
364
400
|
const initialValue = options.default === undefined ? "" : `${opts.default}`;
|
|
365
401
|
const initialState = {
|
|
@@ -367,7 +403,7 @@ export const float = options => {
|
|
|
367
403
|
value: initialValue,
|
|
368
404
|
error: Option.none()
|
|
369
405
|
};
|
|
370
|
-
return
|
|
406
|
+
return Custom(initialState, {
|
|
371
407
|
render: handleRenderFloat(opts),
|
|
372
408
|
process: handleProcessFloat(opts),
|
|
373
409
|
clear: handleNumberClear(opts)
|
|
@@ -380,7 +416,7 @@ export const float = options => {
|
|
|
380
416
|
* @category constructors
|
|
381
417
|
* @since 4.0.0
|
|
382
418
|
*/
|
|
383
|
-
export const
|
|
419
|
+
export const Hidden = options => basePrompt(options, "hidden").pipe(map(Redacted.make));
|
|
384
420
|
/**
|
|
385
421
|
* Creates an integer prompt.
|
|
386
422
|
*
|
|
@@ -392,11 +428,11 @@ export const hidden = options => basePrompt(options, "hidden").pipe(map(Redacted
|
|
|
392
428
|
* @category constructors
|
|
393
429
|
* @since 4.0.0
|
|
394
430
|
*/
|
|
395
|
-
export const
|
|
431
|
+
export const Int = options => {
|
|
396
432
|
const opts = {
|
|
397
433
|
default: 0,
|
|
398
|
-
min: Number.NEGATIVE_INFINITY,
|
|
399
|
-
max: Number.POSITIVE_INFINITY,
|
|
434
|
+
min: globalThis.Number.NEGATIVE_INFINITY,
|
|
435
|
+
max: globalThis.Number.POSITIVE_INFINITY,
|
|
400
436
|
incrementBy: 1,
|
|
401
437
|
decrementBy: 1,
|
|
402
438
|
validate: n => {
|
|
@@ -408,8 +444,7 @@ export const integer = options => {
|
|
|
408
444
|
}
|
|
409
445
|
return Effect.succeed(n);
|
|
410
446
|
},
|
|
411
|
-
...options
|
|
412
|
-
prefix: options.prefix ?? DEFAULT_PREFIX
|
|
447
|
+
...options
|
|
413
448
|
};
|
|
414
449
|
const initialValue = options.default === undefined ? "" : `${opts.default}`;
|
|
415
450
|
const initialState = {
|
|
@@ -417,7 +452,7 @@ export const integer = options => {
|
|
|
417
452
|
value: initialValue,
|
|
418
453
|
error: Option.none()
|
|
419
454
|
};
|
|
420
|
-
return
|
|
455
|
+
return Custom(initialState, {
|
|
421
456
|
render: handleRenderInteger(opts),
|
|
422
457
|
process: handleProcessInteger(opts),
|
|
423
458
|
clear: handleNumberClear(opts)
|
|
@@ -430,7 +465,7 @@ export const integer = options => {
|
|
|
430
465
|
* @category constructors
|
|
431
466
|
* @since 4.0.0
|
|
432
467
|
*/
|
|
433
|
-
export const
|
|
468
|
+
export const List = options => String(options).pipe(map(output => output.split(options.delimiter || ",")));
|
|
434
469
|
/**
|
|
435
470
|
* Transforms the output value produced by a prompt.
|
|
436
471
|
*
|
|
@@ -445,7 +480,7 @@ export const map = /*#__PURE__*/dual(2, (self, f) => flatMap(self, a => succeed(
|
|
|
445
480
|
* @category constructors
|
|
446
481
|
* @since 4.0.0
|
|
447
482
|
*/
|
|
448
|
-
export const
|
|
483
|
+
export const Password = options => basePrompt(options, "password").pipe(map(Redacted.make));
|
|
449
484
|
/**
|
|
450
485
|
* Runs a prompt by reading terminal input and rendering prompt frames until the
|
|
451
486
|
* prompt submits a value.
|
|
@@ -470,7 +505,7 @@ const getSelectInitialIndex = choices => {
|
|
|
470
505
|
const choice = choices[i];
|
|
471
506
|
if (choice.selected === true) {
|
|
472
507
|
if (seenSelected !== -1) {
|
|
473
|
-
throw new Error("InvalidArgumentException: only a single choice can be selected by default for Prompt.
|
|
508
|
+
throw new Error("InvalidArgumentException: only a single choice can be selected by default for Prompt.Select");
|
|
474
509
|
}
|
|
475
510
|
seenSelected = i;
|
|
476
511
|
}
|
|
@@ -491,14 +526,13 @@ const getSelectInitialIndex = choices => {
|
|
|
491
526
|
* @category constructors
|
|
492
527
|
* @since 4.0.0
|
|
493
528
|
*/
|
|
494
|
-
export const
|
|
529
|
+
export const Select = options => {
|
|
495
530
|
const opts = {
|
|
496
531
|
maxPerPage: 10,
|
|
497
|
-
...options
|
|
498
|
-
prefix: options.prefix ?? DEFAULT_PREFIX
|
|
532
|
+
...options
|
|
499
533
|
};
|
|
500
534
|
const initialIndex = getSelectInitialIndex(opts.choices);
|
|
501
|
-
return
|
|
535
|
+
return Custom(initialIndex, {
|
|
502
536
|
render: handleSelectRender(opts),
|
|
503
537
|
process: handleSelectProcess(opts),
|
|
504
538
|
clear: handleSelectClear(opts)
|
|
@@ -507,12 +541,18 @@ export const select = options => {
|
|
|
507
541
|
/**
|
|
508
542
|
* Creates a prompt that lets users filter select choices by typing.
|
|
509
543
|
*
|
|
544
|
+
* **Details**
|
|
545
|
+
*
|
|
546
|
+
* Every printable character is appended to the filter query, so navigation is
|
|
547
|
+
* bound to the arrow keys, `tab`, and the `Ctrl+P` / `Ctrl+N` chords used by
|
|
548
|
+
* `readline` and `fzf` (`Ctrl+K` also moves up). `Ctrl+U` clears the query.
|
|
549
|
+
*
|
|
510
550
|
* **Example** (Filtering choices with autocomplete)
|
|
511
551
|
*
|
|
512
552
|
* ```ts import.meta.vitest
|
|
513
553
|
* import { Prompt } from "effect/unstable/cli"
|
|
514
554
|
*
|
|
515
|
-
* const language = Prompt.
|
|
555
|
+
* const language = Prompt.AutoComplete({
|
|
516
556
|
* message: "Choose a language",
|
|
517
557
|
* choices: [
|
|
518
558
|
* { title: "TypeScript", value: "ts" },
|
|
@@ -527,14 +567,13 @@ export const select = options => {
|
|
|
527
567
|
* @category constructors
|
|
528
568
|
* @since 4.0.0
|
|
529
569
|
*/
|
|
530
|
-
export const
|
|
570
|
+
export const AutoComplete = options => {
|
|
531
571
|
const opts = {
|
|
532
572
|
maxPerPage: 10,
|
|
533
573
|
filterLabel: "filter",
|
|
534
574
|
filterPlaceholder: "type to filter",
|
|
535
575
|
emptyMessage: "No matches",
|
|
536
|
-
...options
|
|
537
|
-
prefix: options.prefix ?? DEFAULT_PREFIX
|
|
576
|
+
...options
|
|
538
577
|
};
|
|
539
578
|
const initialIndex = getSelectInitialIndex(opts.choices);
|
|
540
579
|
const filtered = filterAutoCompleteChoices(opts.choices, "");
|
|
@@ -544,7 +583,7 @@ export const autoComplete = options => {
|
|
|
544
583
|
index,
|
|
545
584
|
filtered
|
|
546
585
|
};
|
|
547
|
-
return
|
|
586
|
+
return Custom(initialState, {
|
|
548
587
|
render: handleAutoCompleteRender(opts),
|
|
549
588
|
process: handleAutoCompleteProcess(opts),
|
|
550
589
|
clear: handleAutoCompleteClear(opts)
|
|
@@ -562,11 +601,10 @@ export const autoComplete = options => {
|
|
|
562
601
|
* @category constructors
|
|
563
602
|
* @since 4.0.0
|
|
564
603
|
*/
|
|
565
|
-
export const
|
|
604
|
+
export const MultiSelect = options => {
|
|
566
605
|
const opts = {
|
|
567
606
|
maxPerPage: 10,
|
|
568
|
-
...options
|
|
569
|
-
prefix: options.prefix ?? DEFAULT_PREFIX
|
|
607
|
+
...options
|
|
570
608
|
};
|
|
571
609
|
// Seed initial selection from choices marked as selected: true
|
|
572
610
|
const initialSelected = new Set();
|
|
@@ -581,7 +619,7 @@ export const multiSelect = options => {
|
|
|
581
619
|
selectedIndices: initialSelected,
|
|
582
620
|
error: Option.none()
|
|
583
621
|
};
|
|
584
|
-
return
|
|
622
|
+
return Custom(initialState, {
|
|
585
623
|
render: handleMultiSelectRender(opts),
|
|
586
624
|
process: handleMultiSelectProcess(opts),
|
|
587
625
|
clear: handleMultiSelectClear(opts)
|
|
@@ -611,7 +649,7 @@ export const succeed = value => {
|
|
|
611
649
|
* @category constructors
|
|
612
650
|
* @since 4.0.0
|
|
613
651
|
*/
|
|
614
|
-
export const
|
|
652
|
+
export const String = options => basePrompt(options, "text");
|
|
615
653
|
/**
|
|
616
654
|
* Creates a toggle prompt that lets the user switch between active and inactive
|
|
617
655
|
* states and returns the selected boolean value.
|
|
@@ -619,15 +657,14 @@ export const text = options => basePrompt(options, "text");
|
|
|
619
657
|
* @category constructors
|
|
620
658
|
* @since 4.0.0
|
|
621
659
|
*/
|
|
622
|
-
export const
|
|
660
|
+
export const Toggle = options => {
|
|
623
661
|
const opts = {
|
|
624
662
|
initial: false,
|
|
625
663
|
active: "on",
|
|
626
664
|
inactive: "off",
|
|
627
|
-
...options
|
|
628
|
-
prefix: options.prefix ?? DEFAULT_PREFIX
|
|
665
|
+
...options
|
|
629
666
|
};
|
|
630
|
-
return
|
|
667
|
+
return Custom(opts.initial, {
|
|
631
668
|
render: handleToggleRender(opts),
|
|
632
669
|
process: handleToggleProcess,
|
|
633
670
|
clear: () => handleToggleClear(opts)
|
|
@@ -680,9 +717,11 @@ const runLoop = /*#__PURE__*/Effect.fnUntraced(function* (loop, terminal, input)
|
|
|
680
717
|
let action = Action.NextFrame({
|
|
681
718
|
state
|
|
682
719
|
});
|
|
720
|
+
let clear = "";
|
|
683
721
|
while (true) {
|
|
684
722
|
const msg = yield* loop.render(state, action);
|
|
685
|
-
yield* Effect.orDie(terminal.display(msg));
|
|
723
|
+
yield* Effect.orDie(terminal.display(clear + msg));
|
|
724
|
+
clear = "";
|
|
686
725
|
if (loop.events) {
|
|
687
726
|
const takeInput = Queue.take(input).pipe(Effect.map(input => ({
|
|
688
727
|
_tag: "Input",
|
|
@@ -702,15 +741,15 @@ const runLoop = /*#__PURE__*/Effect.fnUntraced(function* (loop, terminal, input)
|
|
|
702
741
|
continue;
|
|
703
742
|
case "NextFrame":
|
|
704
743
|
{
|
|
705
|
-
|
|
744
|
+
clear = yield* loop.clear(state, action);
|
|
706
745
|
state = action.state;
|
|
707
746
|
continue;
|
|
708
747
|
}
|
|
709
748
|
case "Submit":
|
|
710
749
|
{
|
|
711
|
-
|
|
750
|
+
clear = yield* loop.clear(state, action);
|
|
712
751
|
const msg = yield* loop.render(state, action);
|
|
713
|
-
yield* Effect.orDie(terminal.display(msg));
|
|
752
|
+
yield* Effect.orDie(terminal.display(clear + msg));
|
|
714
753
|
return action.value;
|
|
715
754
|
}
|
|
716
755
|
}
|
|
@@ -747,9 +786,9 @@ const handleConfirmClear = options => {
|
|
|
747
786
|
return Effect.fnUntraced(function* (state, _) {
|
|
748
787
|
const terminal = yield* Terminal.Terminal;
|
|
749
788
|
const columns = yield* terminal.columns;
|
|
750
|
-
const figures = yield*
|
|
789
|
+
const figures = yield* getTheme(options);
|
|
751
790
|
const confirmMessage = state.value ? options.placeholder.defaultConfirm : options.placeholder.defaultDeny;
|
|
752
|
-
const promptText = renderConfirmOutput(confirmMessage,
|
|
791
|
+
const promptText = renderConfirmOutput(confirmMessage, figures.prefix, figures.pointerSmall, options, {
|
|
753
792
|
plain: true
|
|
754
793
|
});
|
|
755
794
|
const clearOutput = eraseText(promptText, columns);
|
|
@@ -759,21 +798,21 @@ const handleConfirmClear = options => {
|
|
|
759
798
|
};
|
|
760
799
|
const renderConfirmOutput = (confirm, leadingSymbol, trailingSymbol, options, renderOptions) => renderPrompt(confirm, options.message, leadingSymbol, trailingSymbol, renderOptions);
|
|
761
800
|
const renderConfirmNextFrame = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {
|
|
762
|
-
const figures = yield*
|
|
763
|
-
const leadingSymbol =
|
|
764
|
-
const trailingSymbol =
|
|
801
|
+
const figures = yield* getTheme(options);
|
|
802
|
+
const leadingSymbol = annotateSymbol(figures.prefix, figures.primaryColor);
|
|
803
|
+
const trailingSymbol = annotateSymbol(figures.pointerSmall, figures.mutedColor);
|
|
765
804
|
// Marking these explicitly as present with `!` because they always will be
|
|
766
805
|
// and there is really no value in adding a `DeepRequired` type helper just
|
|
767
806
|
// for these internal cases
|
|
768
807
|
const confirmMessage = state.value ? options.placeholder.defaultConfirm : options.placeholder.defaultDeny;
|
|
769
|
-
const confirm = Ansi.annotate(confirmMessage,
|
|
808
|
+
const confirm = Ansi.annotate(confirmMessage, figures.mutedColor);
|
|
770
809
|
const promptMsg = renderConfirmOutput(confirm, leadingSymbol, trailingSymbol, options);
|
|
771
810
|
return Ansi.cursorHide + promptMsg;
|
|
772
811
|
});
|
|
773
812
|
const renderConfirmSubmission = /*#__PURE__*/Effect.fnUntraced(function* (value, options) {
|
|
774
|
-
const figures = yield*
|
|
775
|
-
const leadingSymbol =
|
|
776
|
-
const trailingSymbol =
|
|
813
|
+
const figures = yield* getTheme(options);
|
|
814
|
+
const leadingSymbol = annotateSymbol(figures.tick, figures.successColor);
|
|
815
|
+
const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor);
|
|
777
816
|
const confirmMessage = value ? options.label.confirm : options.label.deny;
|
|
778
817
|
const promptMsg = renderConfirmOutput(confirmMessage, leadingSymbol, trailingSymbol, options);
|
|
779
818
|
return promptMsg + "\n";
|
|
@@ -816,36 +855,36 @@ const handleDateClear = options => {
|
|
|
816
855
|
return Effect.fnUntraced(function* (state, _) {
|
|
817
856
|
const terminal = yield* Terminal.Terminal;
|
|
818
857
|
const columns = yield* terminal.columns;
|
|
819
|
-
const figures = yield*
|
|
858
|
+
const figures = yield* getTheme(options);
|
|
820
859
|
const resetCurrentLine = Ansi.eraseLine + Ansi.cursorLeft;
|
|
821
860
|
const parts = Arr.reduce(state.dateParts, "", (doc, part) => doc + part.toString());
|
|
822
|
-
const promptText = renderDateOutput(
|
|
861
|
+
const promptText = renderDateOutput(figures.prefix, figures.pointerSmall, parts, options, {
|
|
823
862
|
plain: true
|
|
824
863
|
});
|
|
825
864
|
const errorText = Option.isSome(state.error) ? Arr.match(state.error.value.split(NEWLINE_REGEXP), {
|
|
826
865
|
onEmpty: () => "",
|
|
827
|
-
onNonEmpty: errorLines =>
|
|
866
|
+
onNonEmpty: errorLines => separateSymbol(figures.pointerSmall, errorLines.join("\n"))
|
|
828
867
|
}) : "";
|
|
829
868
|
const clearOutput = clearOutputWithError(promptText, columns, errorText);
|
|
830
869
|
return clearOutput + resetCurrentLine;
|
|
831
870
|
});
|
|
832
871
|
};
|
|
833
|
-
const renderDateError = (state, pointer) => {
|
|
872
|
+
const renderDateError = (state, pointer, theme) => {
|
|
834
873
|
if (Option.isSome(state.error)) {
|
|
835
874
|
const errorLines = state.error.value.split(NEWLINE_REGEXP);
|
|
836
875
|
if (Arr.isReadonlyArrayNonEmpty(errorLines)) {
|
|
837
|
-
const prefix =
|
|
838
|
-
const lines = Arr.map(errorLines, str => annotateErrorLine(str));
|
|
839
|
-
return Ansi.cursorSavePosition + "\n" + prefix
|
|
876
|
+
const prefix = annotateSymbol(pointer, theme.errorColor);
|
|
877
|
+
const lines = Arr.map(errorLines, str => annotateErrorLine(str, theme.errorColor));
|
|
878
|
+
return Ansi.cursorSavePosition + "\n" + separateSymbol(prefix, lines.join("\n")) + Ansi.cursorRestorePosition;
|
|
840
879
|
}
|
|
841
880
|
}
|
|
842
881
|
return "";
|
|
843
882
|
};
|
|
844
|
-
const renderParts = (state, submitted = false) => {
|
|
883
|
+
const renderParts = (state, theme, submitted = false) => {
|
|
845
884
|
return Arr.reduce(state.dateParts, "", (doc, part, currentIndex) => {
|
|
846
885
|
const partDoc = part.toString();
|
|
847
886
|
if (currentIndex === state.cursor && !submitted) {
|
|
848
|
-
const annotation = Ansi.combine(Ansi.underlined,
|
|
887
|
+
const annotation = Ansi.combine(Ansi.underlined, theme.primaryColor);
|
|
849
888
|
return doc + Ansi.annotate(partDoc, annotation);
|
|
850
889
|
}
|
|
851
890
|
return doc + partDoc;
|
|
@@ -853,19 +892,19 @@ const renderParts = (state, submitted = false) => {
|
|
|
853
892
|
};
|
|
854
893
|
const renderDateOutput = (leadingSymbol, trailingSymbol, parts, options, renderOptions) => renderPrompt(parts, options.message, leadingSymbol, trailingSymbol, renderOptions);
|
|
855
894
|
const renderDateNextFrame = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {
|
|
856
|
-
const figures = yield*
|
|
857
|
-
const leadingSymbol =
|
|
858
|
-
const trailingSymbol =
|
|
859
|
-
const parts = renderParts(state);
|
|
895
|
+
const figures = yield* getTheme(options);
|
|
896
|
+
const leadingSymbol = annotateSymbol(figures.prefix, figures.primaryColor);
|
|
897
|
+
const trailingSymbol = annotateSymbol(figures.pointerSmall, figures.mutedColor);
|
|
898
|
+
const parts = renderParts(state, figures);
|
|
860
899
|
const promptMsg = renderDateOutput(leadingSymbol, trailingSymbol, parts, options);
|
|
861
|
-
const errorMsg = renderDateError(state, figures.pointerSmall);
|
|
900
|
+
const errorMsg = renderDateError(state, figures.pointerSmall, figures);
|
|
862
901
|
return Ansi.cursorHide + promptMsg + errorMsg;
|
|
863
902
|
});
|
|
864
903
|
const renderDateSubmission = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {
|
|
865
|
-
const figures = yield*
|
|
866
|
-
const leadingSymbol =
|
|
867
|
-
const trailingSymbol =
|
|
868
|
-
const parts = renderParts(state, true);
|
|
904
|
+
const figures = yield* getTheme(options);
|
|
905
|
+
const leadingSymbol = annotateSymbol(figures.tick, figures.successColor);
|
|
906
|
+
const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor);
|
|
907
|
+
const parts = renderParts(state, figures, true);
|
|
869
908
|
const promptMsg = renderDateOutput(leadingSymbol, trailingSymbol, parts, options);
|
|
870
909
|
return promptMsg + "\n";
|
|
871
910
|
});
|
|
@@ -922,6 +961,7 @@ const processDateNext = state => {
|
|
|
922
961
|
return Action.NextFrame({
|
|
923
962
|
state: {
|
|
924
963
|
...state,
|
|
964
|
+
typed: "",
|
|
925
965
|
cursor
|
|
926
966
|
}
|
|
927
967
|
});
|
|
@@ -1065,7 +1105,7 @@ class DatePart {
|
|
|
1065
1105
|
constructor(params) {
|
|
1066
1106
|
this.token = params.token;
|
|
1067
1107
|
this.locales = params.locales;
|
|
1068
|
-
this.date = params.date || new Date();
|
|
1108
|
+
this.date = params.date || new globalThis.Date();
|
|
1069
1109
|
this.parts = params.parts || [this];
|
|
1070
1110
|
}
|
|
1071
1111
|
/**
|
|
@@ -1092,7 +1132,7 @@ class DatePart {
|
|
|
1092
1132
|
return Option.none();
|
|
1093
1133
|
}
|
|
1094
1134
|
toString() {
|
|
1095
|
-
return String(this.date);
|
|
1135
|
+
return globalThis.String(this.date);
|
|
1096
1136
|
}
|
|
1097
1137
|
}
|
|
1098
1138
|
class Token extends DatePart {
|
|
@@ -1116,7 +1156,7 @@ class Milliseconds extends DatePart {
|
|
|
1116
1156
|
this.date.setMilliseconds(this.date.getMilliseconds() - 1);
|
|
1117
1157
|
}
|
|
1118
1158
|
setValue(value) {
|
|
1119
|
-
this.date.setMilliseconds(Number.parseInt(value.slice(-this.token.length)));
|
|
1159
|
+
this.date.setMilliseconds(globalThis.Number.parseInt(value.slice(-this.token.length)));
|
|
1120
1160
|
}
|
|
1121
1161
|
toString() {
|
|
1122
1162
|
const millis = `${this.date.getMilliseconds()}`;
|
|
@@ -1131,7 +1171,7 @@ class Seconds extends DatePart {
|
|
|
1131
1171
|
this.date.setSeconds(this.date.getSeconds() - 1);
|
|
1132
1172
|
}
|
|
1133
1173
|
setValue(value) {
|
|
1134
|
-
this.date.setSeconds(Number.parseInt(value.slice(-2)));
|
|
1174
|
+
this.date.setSeconds(globalThis.Number.parseInt(value.slice(-2)));
|
|
1135
1175
|
}
|
|
1136
1176
|
toString() {
|
|
1137
1177
|
const seconds = `${this.date.getSeconds()}`;
|
|
@@ -1146,7 +1186,7 @@ class Minutes extends DatePart {
|
|
|
1146
1186
|
this.date.setMinutes(this.date.getMinutes() - 1);
|
|
1147
1187
|
}
|
|
1148
1188
|
setValue(value) {
|
|
1149
|
-
this.date.setMinutes(Number.parseInt(value.slice(-2)));
|
|
1189
|
+
this.date.setMinutes(globalThis.Number.parseInt(value.slice(-2)));
|
|
1150
1190
|
}
|
|
1151
1191
|
toString() {
|
|
1152
1192
|
const minutes = `${this.date.getMinutes()}`;
|
|
@@ -1161,7 +1201,7 @@ class Hours extends DatePart {
|
|
|
1161
1201
|
this.date.setHours(this.date.getHours() - 1);
|
|
1162
1202
|
}
|
|
1163
1203
|
setValue(value) {
|
|
1164
|
-
this.date.setHours(Number.parseInt(value.slice(-2)));
|
|
1204
|
+
this.date.setHours(globalThis.Number.parseInt(value.slice(-2)));
|
|
1165
1205
|
}
|
|
1166
1206
|
toString() {
|
|
1167
1207
|
const hours = /h/.test(this.token) ? this.date.getHours() % 12 || 12 : this.date.getHours();
|
|
@@ -1176,7 +1216,7 @@ class Day extends DatePart {
|
|
|
1176
1216
|
this.date.setDate(this.date.getDate() - 1);
|
|
1177
1217
|
}
|
|
1178
1218
|
setValue(value) {
|
|
1179
|
-
this.date.setDate(Number.parseInt(value.slice(-2)));
|
|
1219
|
+
this.date.setDate(globalThis.Number.parseInt(value.slice(-2)));
|
|
1180
1220
|
}
|
|
1181
1221
|
toString() {
|
|
1182
1222
|
const date = this.date.getDate();
|
|
@@ -1220,7 +1260,7 @@ class Month extends DatePart {
|
|
|
1220
1260
|
this.date.setMonth(this.date.getMonth() - 1);
|
|
1221
1261
|
}
|
|
1222
1262
|
setValue(value) {
|
|
1223
|
-
const month = Number.parseInt(value.slice(-2)) - 1;
|
|
1263
|
+
const month = globalThis.Number.parseInt(value.slice(-2)) - 1;
|
|
1224
1264
|
this.date.setMonth(month < 0 ? 0 : month);
|
|
1225
1265
|
}
|
|
1226
1266
|
toString() {
|
|
@@ -1245,7 +1285,7 @@ class Year extends DatePart {
|
|
|
1245
1285
|
this.date.setFullYear(this.date.getFullYear() - 1);
|
|
1246
1286
|
}
|
|
1247
1287
|
setValue(value) {
|
|
1248
|
-
this.date.setFullYear(Number.parseInt(value.slice(-4)));
|
|
1288
|
+
this.date.setFullYear(globalThis.Number.parseInt(value.slice(-4)));
|
|
1249
1289
|
}
|
|
1250
1290
|
toString() {
|
|
1251
1291
|
const year = `${this.date.getFullYear()}`.padStart(4, "0");
|
|
@@ -1269,8 +1309,8 @@ const CONFIRM_MESSAGE = "The selected directory contains files. Would you like t
|
|
|
1269
1309
|
const FILE_FILTER_LABEL = "filter";
|
|
1270
1310
|
const FILE_FILTER_PLACEHOLDER = "type to filter";
|
|
1271
1311
|
const FILE_EMPTY_MESSAGE = "No matches";
|
|
1272
|
-
const
|
|
1273
|
-
const showConfirmation = /*#__PURE__*/
|
|
1312
|
+
const FileConfirm = /*#__PURE__*/Data.taggedEnum();
|
|
1313
|
+
const showConfirmation = /*#__PURE__*/FileConfirm.$is("Show");
|
|
1274
1314
|
const resolveCurrentPath = (path, options) => {
|
|
1275
1315
|
if (Option.isSome(path)) {
|
|
1276
1316
|
return Effect.succeed(path.value);
|
|
@@ -1338,15 +1378,15 @@ const handleFileClear = options => {
|
|
|
1338
1378
|
const terminal = yield* Terminal.Terminal;
|
|
1339
1379
|
const columns = yield* terminal.columns;
|
|
1340
1380
|
const path = yield* Path.Path;
|
|
1341
|
-
const figures = yield*
|
|
1381
|
+
const figures = yield* getTheme(options);
|
|
1342
1382
|
const currentPath = yield* resolveCurrentPath(state.path, options);
|
|
1343
1383
|
const selectedPath = state.files[state.cursor];
|
|
1344
1384
|
const resolvedPath = selectedPath === undefined ? currentPath : path.resolve(currentPath, selectedPath);
|
|
1345
|
-
const resolvedPathText =
|
|
1385
|
+
const resolvedPathText = separateSymbol(figures.pointerSmall, resolvedPath);
|
|
1346
1386
|
const isConfirming = showConfirmation(state.confirm);
|
|
1347
|
-
const promptText = isConfirming ? renderPrompt("(Y/n)", CONFIRM_MESSAGE,
|
|
1387
|
+
const promptText = isConfirming ? renderPrompt("(Y/n)", CONFIRM_MESSAGE, figures.prefix, figures.pointerSmall, {
|
|
1348
1388
|
plain: true
|
|
1349
|
-
}) : renderPrompt(renderFileFilter(state, {
|
|
1389
|
+
}) : renderPrompt(renderFileFilter(state, figures, {
|
|
1350
1390
|
plain: true
|
|
1351
1391
|
}), options.message, figures.tick, figures.ellipsis, {
|
|
1352
1392
|
plain: true
|
|
@@ -1361,79 +1401,86 @@ const handleFileClear = options => {
|
|
|
1361
1401
|
});
|
|
1362
1402
|
};
|
|
1363
1403
|
const renderPrompt = (confirm, message, leadingSymbol, trailingSymbol, options) => {
|
|
1364
|
-
const prefix = leadingSymbol + " ";
|
|
1404
|
+
const prefix = leadingSymbol.length === 0 ? "" : leadingSymbol + " ";
|
|
1405
|
+
const renderLine = line => {
|
|
1406
|
+
let output = prefix + line;
|
|
1407
|
+
if (trailingSymbol.length > 0) {
|
|
1408
|
+
output += " " + trailingSymbol;
|
|
1409
|
+
}
|
|
1410
|
+
if (confirm.length > 0) {
|
|
1411
|
+
output += " " + confirm;
|
|
1412
|
+
} else if (trailingSymbol.length > 0) {
|
|
1413
|
+
output += " ";
|
|
1414
|
+
}
|
|
1415
|
+
return output;
|
|
1416
|
+
};
|
|
1365
1417
|
const annotate = options?.plain === true ? line => line : annotateLine;
|
|
1366
1418
|
return Arr.match(message.split(NEWLINE_REGEXP), {
|
|
1367
|
-
onEmpty: () =>
|
|
1419
|
+
onEmpty: () => renderLine(""),
|
|
1368
1420
|
onNonEmpty: promptLines => {
|
|
1369
1421
|
const lines = Arr.map(promptLines, line => annotate(line));
|
|
1370
|
-
return
|
|
1422
|
+
return renderLine(lines.join("\n"));
|
|
1371
1423
|
}
|
|
1372
1424
|
});
|
|
1373
1425
|
};
|
|
1374
1426
|
const renderPrefix = (state, toDisplay, currentIndex, length, figures, renderOptions) => {
|
|
1375
|
-
|
|
1376
|
-
if (currentIndex === toDisplay.startIndex && toDisplay.startIndex > 0) {
|
|
1377
|
-
prefix = figures.arrowUp;
|
|
1378
|
-
} else if (currentIndex === toDisplay.endIndex - 1 && toDisplay.endIndex < length) {
|
|
1379
|
-
prefix = figures.arrowDown;
|
|
1380
|
-
}
|
|
1427
|
+
const prefix = renderPagingPrefix(figures, currentIndex === toDisplay.startIndex && toDisplay.startIndex > 0, currentIndex === toDisplay.endIndex - 1 && toDisplay.endIndex < length);
|
|
1381
1428
|
if (state.cursor === currentIndex) {
|
|
1382
|
-
return renderOptions?.plain === true ? figures.pointer + prefix :
|
|
1429
|
+
return renderOptions?.plain === true ? figures.pointer + prefix : annotateSymbol(figures.pointer, figures.primaryColor) + prefix;
|
|
1383
1430
|
}
|
|
1384
|
-
return prefix + " ";
|
|
1431
|
+
return prefix + " ".repeat(figures.pointer.length);
|
|
1385
1432
|
};
|
|
1386
|
-
const renderFileName = (file, isSelected, renderOptions) => {
|
|
1433
|
+
const renderFileName = (file, isSelected, theme, renderOptions) => {
|
|
1387
1434
|
if (renderOptions?.plain === true) {
|
|
1388
1435
|
return file;
|
|
1389
1436
|
}
|
|
1390
|
-
return isSelected ? Ansi.annotate(file, Ansi.combine(Ansi.underlined,
|
|
1437
|
+
return isSelected ? Ansi.annotate(file, Ansi.combine(Ansi.underlined, theme.primaryColor)) : file;
|
|
1391
1438
|
};
|
|
1392
|
-
const renderFileFilter = (state, renderOptions) => {
|
|
1393
|
-
const filterValue = state.query.length === 0 ? renderOptions?.plain === true ? FILE_FILTER_PLACEHOLDER : Ansi.annotate(FILE_FILTER_PLACEHOLDER,
|
|
1439
|
+
const renderFileFilter = (state, theme, renderOptions) => {
|
|
1440
|
+
const filterValue = state.query.length === 0 ? renderOptions?.plain === true ? FILE_FILTER_PLACEHOLDER : Ansi.annotate(FILE_FILTER_PLACEHOLDER, theme.mutedColor) : renderOptions?.plain === true ? state.query : Ansi.annotate(state.query, Ansi.combine(Ansi.underlined, theme.primaryColor));
|
|
1394
1441
|
return `[${FILE_FILTER_LABEL}: ${filterValue}]`;
|
|
1395
1442
|
};
|
|
1396
1443
|
const renderFiles = (state, files, figures, options, renderOptions) => {
|
|
1397
1444
|
const length = files.length;
|
|
1398
1445
|
if (length === 0) {
|
|
1399
|
-
return renderOptions?.plain === true ? FILE_EMPTY_MESSAGE : Ansi.annotate(FILE_EMPTY_MESSAGE,
|
|
1446
|
+
return renderOptions?.plain === true ? FILE_EMPTY_MESSAGE : Ansi.annotate(FILE_EMPTY_MESSAGE, figures.mutedColor);
|
|
1400
1447
|
}
|
|
1401
1448
|
const toDisplay = entriesToDisplay(state.cursor, length, options.maxPerPage);
|
|
1402
1449
|
const documents = [];
|
|
1403
1450
|
for (let index = toDisplay.startIndex; index < toDisplay.endIndex; index++) {
|
|
1404
1451
|
const isSelected = state.cursor === index;
|
|
1405
1452
|
const prefix = renderPrefix(state, toDisplay, index, length, figures, renderOptions);
|
|
1406
|
-
const fileName = renderFileName(files[index], isSelected, renderOptions);
|
|
1453
|
+
const fileName = renderFileName(files[index], isSelected, figures, renderOptions);
|
|
1407
1454
|
documents.push(prefix + fileName);
|
|
1408
1455
|
}
|
|
1409
1456
|
return documents.join("\n");
|
|
1410
1457
|
};
|
|
1411
1458
|
const renderFileNextFrame = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {
|
|
1412
1459
|
const path = yield* Path.Path;
|
|
1413
|
-
const figures = yield*
|
|
1460
|
+
const figures = yield* getTheme(options);
|
|
1414
1461
|
const currentPath = yield* resolveCurrentPath(state.path, options);
|
|
1415
1462
|
const selectedPath = state.files[state.cursor];
|
|
1416
1463
|
const resolvedPath = selectedPath === undefined ? currentPath : path.resolve(currentPath, selectedPath);
|
|
1417
|
-
const resolvedPathMsg = Ansi.annotate(figures.pointerSmall
|
|
1464
|
+
const resolvedPathMsg = Ansi.annotate(separateSymbol(figures.pointerSmall, resolvedPath), figures.mutedColor);
|
|
1418
1465
|
if (showConfirmation(state.confirm)) {
|
|
1419
|
-
const leadingSymbol =
|
|
1420
|
-
const trailingSymbol =
|
|
1421
|
-
const confirm = Ansi.annotate("(Y/n)",
|
|
1466
|
+
const leadingSymbol = annotateSymbol(figures.prefix, figures.primaryColor);
|
|
1467
|
+
const trailingSymbol = annotateSymbol(figures.pointerSmall, figures.mutedColor);
|
|
1468
|
+
const confirm = Ansi.annotate("(Y/n)", figures.mutedColor);
|
|
1422
1469
|
const promptMsg = renderPrompt(confirm, CONFIRM_MESSAGE, leadingSymbol, trailingSymbol);
|
|
1423
1470
|
return Ansi.cursorHide + promptMsg + "\n" + resolvedPathMsg;
|
|
1424
1471
|
}
|
|
1425
|
-
const leadingSymbol =
|
|
1426
|
-
const trailingSymbol =
|
|
1427
|
-
const promptMsg = renderPrompt(renderFileFilter(state), options.message, leadingSymbol, trailingSymbol);
|
|
1472
|
+
const leadingSymbol = annotateSymbol(figures.tick, figures.successColor);
|
|
1473
|
+
const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor);
|
|
1474
|
+
const promptMsg = renderPrompt(renderFileFilter(state, figures), options.message, leadingSymbol, trailingSymbol);
|
|
1428
1475
|
const files = renderFiles(state, state.files, figures, options);
|
|
1429
1476
|
return Ansi.cursorHide + promptMsg + "\n" + resolvedPathMsg + "\n" + files;
|
|
1430
1477
|
});
|
|
1431
1478
|
const renderFileSubmission = /*#__PURE__*/Effect.fnUntraced(function* (state, value, options) {
|
|
1432
|
-
const figures = yield*
|
|
1433
|
-
const leadingSymbol =
|
|
1434
|
-
const trailingSymbol =
|
|
1435
|
-
const promptMsg = renderPrompt(renderFileFilter(state), options.message, leadingSymbol, trailingSymbol);
|
|
1436
|
-
return promptMsg + " " + Ansi.annotate(value,
|
|
1479
|
+
const figures = yield* getTheme(options);
|
|
1480
|
+
const leadingSymbol = annotateSymbol(figures.tick, figures.successColor);
|
|
1481
|
+
const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor);
|
|
1482
|
+
const promptMsg = renderPrompt(renderFileFilter(state, figures), options.message, leadingSymbol, trailingSymbol);
|
|
1483
|
+
return promptMsg + " " + Ansi.annotate(value, figures.submittedColor) + "\n";
|
|
1437
1484
|
});
|
|
1438
1485
|
const handleFileRender = options => {
|
|
1439
1486
|
return (state, action) => {
|
|
@@ -1519,7 +1566,7 @@ const processSelection = /*#__PURE__*/Effect.fnUntraced(function* (state, option
|
|
|
1519
1566
|
: Action.NextFrame({
|
|
1520
1567
|
state: {
|
|
1521
1568
|
...state,
|
|
1522
|
-
confirm:
|
|
1569
|
+
confirm: FileConfirm.Show()
|
|
1523
1570
|
}
|
|
1524
1571
|
});
|
|
1525
1572
|
}
|
|
@@ -1530,7 +1577,7 @@ const processSelection = /*#__PURE__*/Effect.fnUntraced(function* (state, option
|
|
|
1530
1577
|
allFiles: files,
|
|
1531
1578
|
query: "",
|
|
1532
1579
|
path: Option.some(resolvedPath),
|
|
1533
|
-
confirm:
|
|
1580
|
+
confirm: FileConfirm.Hide()
|
|
1534
1581
|
}
|
|
1535
1582
|
});
|
|
1536
1583
|
}
|
|
@@ -1540,22 +1587,37 @@ const processSelection = /*#__PURE__*/Effect.fnUntraced(function* (state, option
|
|
|
1540
1587
|
});
|
|
1541
1588
|
const handleFileProcess = options => {
|
|
1542
1589
|
return Effect.fnUntraced(function* (input, state) {
|
|
1590
|
+
// Navigation is bound to ctrl chords rather than bare `j`/`k`, so that every
|
|
1591
|
+
// printable character reaches the filter input.
|
|
1543
1592
|
if (input.key.ctrl) {
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
|
|
1548
|
-
|
|
1593
|
+
switch (input.key.name) {
|
|
1594
|
+
case "u":
|
|
1595
|
+
{
|
|
1596
|
+
if (showConfirmation(state.confirm)) {
|
|
1597
|
+
return Action.Beep();
|
|
1598
|
+
}
|
|
1599
|
+
return yield* processFileClear(state);
|
|
1600
|
+
}
|
|
1601
|
+
case "p":
|
|
1602
|
+
case "k":
|
|
1603
|
+
{
|
|
1604
|
+
return yield* processFileCursorUp(state);
|
|
1605
|
+
}
|
|
1606
|
+
case "n":
|
|
1607
|
+
{
|
|
1608
|
+
return yield* processFileCursorDown(state);
|
|
1609
|
+
}
|
|
1610
|
+
default:
|
|
1611
|
+
{
|
|
1612
|
+
return Action.Beep();
|
|
1613
|
+
}
|
|
1549
1614
|
}
|
|
1550
|
-
return Action.Beep();
|
|
1551
1615
|
}
|
|
1552
1616
|
switch (input.key.name) {
|
|
1553
|
-
case "k":
|
|
1554
1617
|
case "up":
|
|
1555
1618
|
{
|
|
1556
1619
|
return yield* processFileCursorUp(state);
|
|
1557
1620
|
}
|
|
1558
|
-
case "j":
|
|
1559
1621
|
case "down":
|
|
1560
1622
|
case "tab":
|
|
1561
1623
|
{
|
|
@@ -1589,7 +1651,7 @@ const handleFileProcess = options => {
|
|
|
1589
1651
|
allFiles: files,
|
|
1590
1652
|
query: "",
|
|
1591
1653
|
path: Option.some(resolvedPath),
|
|
1592
|
-
confirm:
|
|
1654
|
+
confirm: FileConfirm.Hide()
|
|
1593
1655
|
}
|
|
1594
1656
|
});
|
|
1595
1657
|
}
|
|
@@ -1619,37 +1681,39 @@ const handleFileProcess = options => {
|
|
|
1619
1681
|
}
|
|
1620
1682
|
});
|
|
1621
1683
|
};
|
|
1622
|
-
const renderMultiSelectError = (state, pointer, renderOptions) => {
|
|
1684
|
+
const renderMultiSelectError = (state, pointer, theme, renderOptions) => {
|
|
1623
1685
|
if (Option.isSome(state.error)) {
|
|
1624
1686
|
return Arr.match(state.error.value.split(NEWLINE_REGEXP), {
|
|
1625
1687
|
onEmpty: () => "",
|
|
1626
1688
|
onNonEmpty: errorLines => {
|
|
1627
1689
|
if (renderOptions?.plain === true) {
|
|
1628
|
-
return
|
|
1690
|
+
return separateSymbol(pointer, errorLines.join("\n"));
|
|
1629
1691
|
}
|
|
1630
|
-
const prefix =
|
|
1631
|
-
const lines = Arr.map(errorLines, str => annotateErrorLine(str));
|
|
1632
|
-
return Ansi.cursorSavePosition + "\n" + prefix
|
|
1692
|
+
const prefix = annotateSymbol(pointer, theme.errorColor);
|
|
1693
|
+
const lines = Arr.map(errorLines, str => annotateErrorLine(str, theme.errorColor));
|
|
1694
|
+
return Ansi.cursorSavePosition + "\n" + separateSymbol(prefix, lines.join("\n")) + Ansi.cursorRestorePosition;
|
|
1633
1695
|
}
|
|
1634
1696
|
});
|
|
1635
1697
|
}
|
|
1636
1698
|
return "";
|
|
1637
1699
|
};
|
|
1638
|
-
const renderChoiceDescription = (choice, isActive, renderOptions) => {
|
|
1700
|
+
const renderChoiceDescription = (choice, isActive, theme, renderOptions) => {
|
|
1639
1701
|
if (!choice.disabled && choice.description && isActive) {
|
|
1640
|
-
|
|
1702
|
+
const text = theme.descriptionSeparator + choice.description;
|
|
1703
|
+
return renderOptions?.plain === true ? text : Ansi.annotate(text, theme.mutedColor);
|
|
1641
1704
|
}
|
|
1642
1705
|
return "";
|
|
1643
1706
|
};
|
|
1644
1707
|
const metaOptionsCount = 2;
|
|
1645
|
-
const renderMultiSelectTitle = (title, isHighlighted, renderOptions) => {
|
|
1708
|
+
const renderMultiSelectTitle = (title, isHighlighted, theme, renderOptions) => {
|
|
1646
1709
|
if (renderOptions?.plain === true || !isHighlighted) {
|
|
1647
1710
|
return title;
|
|
1648
1711
|
}
|
|
1649
|
-
return Ansi.annotate(title, Ansi.combine(Ansi.underlined,
|
|
1712
|
+
return Ansi.annotate(title, Ansi.combine(Ansi.underlined, theme.primaryColor));
|
|
1650
1713
|
};
|
|
1651
1714
|
const renderMultiSelectChoices = (state, options, figures, renderOptions) => {
|
|
1652
1715
|
const choices = options.choices;
|
|
1716
|
+
const checkboxWidth = Math.max(figures.checkboxOn.length, figures.checkboxOff.length);
|
|
1653
1717
|
const selectableCount = choices.filter(choice => !choice.disabled).length;
|
|
1654
1718
|
const selectedCount = Array.from(state.selectedIndices).filter(index => !choices[index].disabled).length;
|
|
1655
1719
|
const allSelected = selectedCount === selectableCount;
|
|
@@ -1666,47 +1730,43 @@ const renderMultiSelectChoices = (state, options, figures, renderOptions) => {
|
|
|
1666
1730
|
for (let index = toDisplay.startIndex; index < toDisplay.endIndex; index++) {
|
|
1667
1731
|
const choice = allChoices[index];
|
|
1668
1732
|
const isHighlighted = state.index === index;
|
|
1669
|
-
|
|
1670
|
-
if (index === toDisplay.startIndex && toDisplay.startIndex > 0) {
|
|
1671
|
-
prefix = figures.arrowUp;
|
|
1672
|
-
} else if (index === toDisplay.endIndex - 1 && toDisplay.endIndex < allChoices.length) {
|
|
1673
|
-
prefix = figures.arrowDown;
|
|
1674
|
-
}
|
|
1733
|
+
const prefix = renderPagingPrefix(figures, index === toDisplay.startIndex && toDisplay.startIndex > 0, index === toDisplay.endIndex - 1 && toDisplay.endIndex < allChoices.length);
|
|
1675
1734
|
if (index < metaOptions.length) {
|
|
1676
1735
|
// Meta options
|
|
1677
|
-
const title = renderMultiSelectTitle(choice.title, isHighlighted, renderOptions);
|
|
1678
|
-
documents.push(prefix + " " + title);
|
|
1736
|
+
const title = renderMultiSelectTitle(choice.title, isHighlighted, figures, renderOptions);
|
|
1737
|
+
documents.push(prefix + (prefix.length === 0 ? "" : " ") + title);
|
|
1679
1738
|
} else {
|
|
1680
1739
|
// Regular choices
|
|
1681
1740
|
const choiceIndex = index - metaOptions.length;
|
|
1682
1741
|
const isSelected = state.selectedIndices.has(choiceIndex);
|
|
1683
1742
|
const checkbox = isSelected ? figures.checkboxOn : figures.checkboxOff;
|
|
1684
|
-
const annotatedCheckbox = isHighlighted && renderOptions?.plain !== true ? Ansi.annotate(checkbox,
|
|
1743
|
+
const annotatedCheckbox = isHighlighted && renderOptions?.plain !== true ? Ansi.annotate(checkbox, figures.primaryColor) : checkbox;
|
|
1685
1744
|
const selectChoice = choice;
|
|
1686
|
-
const title = renderChoiceTitle(selectChoice, isHighlighted, renderOptions);
|
|
1687
|
-
const description = renderChoiceDescription(selectChoice, isHighlighted, renderOptions);
|
|
1688
|
-
|
|
1745
|
+
const title = renderChoiceTitle(selectChoice, isHighlighted, figures, renderOptions);
|
|
1746
|
+
const description = renderChoiceDescription(selectChoice, isHighlighted, figures, renderOptions);
|
|
1747
|
+
const checkboxPrefix = checkboxWidth === 0 ? "" : annotatedCheckbox + " ".repeat(checkboxWidth - checkbox.length + 1);
|
|
1748
|
+
documents.push(prefix + (prefix.length === 0 ? "" : " ") + checkboxPrefix + title + " " + description);
|
|
1689
1749
|
}
|
|
1690
1750
|
}
|
|
1691
1751
|
return documents.join("\n");
|
|
1692
1752
|
};
|
|
1693
1753
|
const renderMultiSelectNextFrame = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {
|
|
1694
|
-
const figures = yield*
|
|
1754
|
+
const figures = yield* getTheme(options);
|
|
1695
1755
|
const choices = renderMultiSelectChoices(state, options, figures);
|
|
1696
|
-
const leadingSymbol =
|
|
1697
|
-
const trailingSymbol =
|
|
1756
|
+
const leadingSymbol = annotateSymbol(figures.prefix, figures.primaryColor);
|
|
1757
|
+
const trailingSymbol = annotateSymbol(figures.pointerSmall, figures.mutedColor);
|
|
1698
1758
|
const promptMsg = renderSelectOutput(leadingSymbol, trailingSymbol, options);
|
|
1699
|
-
const error = renderMultiSelectError(state, figures.pointer);
|
|
1759
|
+
const error = renderMultiSelectError(state, figures.pointer, figures);
|
|
1700
1760
|
return Ansi.cursorHide + promptMsg + "\n" + choices + error;
|
|
1701
1761
|
});
|
|
1702
1762
|
const renderMultiSelectSubmission = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {
|
|
1703
|
-
const figures = yield*
|
|
1763
|
+
const figures = yield* getTheme(options);
|
|
1704
1764
|
const selectedChoices = Array.from(state.selectedIndices).sort(EffectNumber.Order).map(index => options.choices[index].title);
|
|
1705
1765
|
const selectedText = selectedChoices.join(", ");
|
|
1706
|
-
const leadingSymbol =
|
|
1707
|
-
const trailingSymbol =
|
|
1766
|
+
const leadingSymbol = annotateSymbol(figures.tick, figures.successColor);
|
|
1767
|
+
const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor);
|
|
1708
1768
|
const promptMsg = renderSelectOutput(leadingSymbol, trailingSymbol, options);
|
|
1709
|
-
return promptMsg + " " + Ansi.annotate(selectedText,
|
|
1769
|
+
return promptMsg + " " + Ansi.annotate(selectedText, figures.submittedColor) + "\n";
|
|
1710
1770
|
});
|
|
1711
1771
|
const processMultiSelectCursorUp = (state, totalChoices) => {
|
|
1712
1772
|
const newIndex = state.index === 0 ? totalChoices - 1 : state.index - 1;
|
|
@@ -1768,15 +1828,15 @@ const processSpace = (state, options) => {
|
|
|
1768
1828
|
const handleMultiSelectClear = options => Effect.fnUntraced(function* (state, _) {
|
|
1769
1829
|
const terminal = yield* Terminal.Terminal;
|
|
1770
1830
|
const columns = yield* terminal.columns;
|
|
1771
|
-
const figures = yield*
|
|
1831
|
+
const figures = yield* getTheme(options);
|
|
1772
1832
|
const clearPrompt = Ansi.eraseLine + Ansi.cursorLeft;
|
|
1773
|
-
const promptText = renderSelectOutput(
|
|
1833
|
+
const promptText = renderSelectOutput(figures.prefix, figures.pointerSmall, options, {
|
|
1774
1834
|
plain: true
|
|
1775
1835
|
});
|
|
1776
1836
|
const choicesText = renderMultiSelectChoices(state, options, figures, {
|
|
1777
1837
|
plain: true
|
|
1778
1838
|
});
|
|
1779
|
-
const errorText = renderMultiSelectError(state, figures.pointer, {
|
|
1839
|
+
const errorText = renderMultiSelectError(state, figures.pointer, figures, {
|
|
1780
1840
|
plain: true
|
|
1781
1841
|
});
|
|
1782
1842
|
const clearOutput = clearOutputWithError(`${promptText}\n${choicesText}`, columns, errorText);
|
|
@@ -1855,59 +1915,59 @@ const handleNumberClear = options => {
|
|
|
1855
1915
|
return Effect.fnUntraced(function* (state, _) {
|
|
1856
1916
|
const terminal = yield* Terminal.Terminal;
|
|
1857
1917
|
const columns = yield* terminal.columns;
|
|
1858
|
-
const figures = yield*
|
|
1918
|
+
const figures = yield* getTheme(options);
|
|
1859
1919
|
const resetCurrentLine = Ansi.eraseLine + Ansi.cursorLeft;
|
|
1860
|
-
const errorText = renderNumberError(state, figures.pointerSmall, {
|
|
1920
|
+
const errorText = renderNumberError(state, figures.pointerSmall, figures, {
|
|
1861
1921
|
plain: true
|
|
1862
1922
|
});
|
|
1863
|
-
const promptText = renderNumberOutput(state,
|
|
1923
|
+
const promptText = renderNumberOutput(state, figures.prefix, figures.pointerSmall, options, figures, {
|
|
1864
1924
|
plain: true
|
|
1865
1925
|
});
|
|
1866
1926
|
const clearOutput = clearOutputWithError(promptText, columns, errorText);
|
|
1867
1927
|
return clearOutput + resetCurrentLine;
|
|
1868
1928
|
});
|
|
1869
1929
|
};
|
|
1870
|
-
const renderNumberInput = (state, submitted, renderOptions) => {
|
|
1930
|
+
const renderNumberInput = (state, submitted, theme, renderOptions) => {
|
|
1871
1931
|
const value = state.value === "" ? "" : `${state.value}`;
|
|
1872
1932
|
if (submitted || renderOptions?.plain === true) {
|
|
1873
1933
|
return value;
|
|
1874
1934
|
}
|
|
1875
|
-
const annotation = Option.isSome(state.error) ?
|
|
1935
|
+
const annotation = Option.isSome(state.error) ? theme.errorColor : Ansi.combine(Ansi.underlined, theme.primaryColor);
|
|
1876
1936
|
return Ansi.annotate(value, annotation);
|
|
1877
1937
|
};
|
|
1878
|
-
const renderNumberError = (state, pointer, renderOptions) => {
|
|
1938
|
+
const renderNumberError = (state, pointer, theme, renderOptions) => {
|
|
1879
1939
|
if (Option.isSome(state.error)) {
|
|
1880
1940
|
return Arr.match(state.error.value.split(NEWLINE_REGEXP), {
|
|
1881
1941
|
onEmpty: () => "",
|
|
1882
1942
|
onNonEmpty: errorLines => {
|
|
1883
1943
|
if (renderOptions?.plain === true) {
|
|
1884
|
-
return
|
|
1944
|
+
return separateSymbol(pointer, errorLines.join("\n"));
|
|
1885
1945
|
}
|
|
1886
|
-
const prefix =
|
|
1887
|
-
const lines = Arr.map(errorLines, str => annotateErrorLine(str));
|
|
1888
|
-
return Ansi.cursorSavePosition + "\n" + prefix
|
|
1946
|
+
const prefix = annotateSymbol(pointer, theme.errorColor);
|
|
1947
|
+
const lines = Arr.map(errorLines, str => annotateErrorLine(str, theme.errorColor));
|
|
1948
|
+
return Ansi.cursorSavePosition + "\n" + separateSymbol(prefix, lines.join("\n")) + Ansi.cursorRestorePosition;
|
|
1889
1949
|
}
|
|
1890
1950
|
});
|
|
1891
1951
|
}
|
|
1892
1952
|
return "";
|
|
1893
1953
|
};
|
|
1894
|
-
const renderNumberOutput = (state, leadingSymbol, trailingSymbol, options, renderOptions, submitted = false) => {
|
|
1895
|
-
const value = renderNumberInput(state, submitted, renderOptions);
|
|
1954
|
+
const renderNumberOutput = (state, leadingSymbol, trailingSymbol, options, theme, renderOptions, submitted = false) => {
|
|
1955
|
+
const value = renderNumberInput(state, submitted, theme, renderOptions);
|
|
1896
1956
|
return renderPrompt(value, options.message, leadingSymbol, trailingSymbol, renderOptions);
|
|
1897
1957
|
};
|
|
1898
1958
|
const renderNumberNextFrame = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {
|
|
1899
|
-
const figures = yield*
|
|
1900
|
-
const leadingSymbol =
|
|
1901
|
-
const trailingSymbol =
|
|
1902
|
-
const errorMsg = renderNumberError(state, figures.pointerSmall);
|
|
1903
|
-
const promptMsg = renderNumberOutput(state, leadingSymbol, trailingSymbol, options);
|
|
1959
|
+
const figures = yield* getTheme(options);
|
|
1960
|
+
const leadingSymbol = annotateSymbol(figures.prefix, figures.primaryColor);
|
|
1961
|
+
const trailingSymbol = annotateSymbol(figures.pointerSmall, figures.mutedColor);
|
|
1962
|
+
const errorMsg = renderNumberError(state, figures.pointerSmall, figures);
|
|
1963
|
+
const promptMsg = renderNumberOutput(state, leadingSymbol, trailingSymbol, options, figures);
|
|
1904
1964
|
return promptMsg + errorMsg;
|
|
1905
1965
|
});
|
|
1906
1966
|
const renderNumberSubmission = /*#__PURE__*/Effect.fnUntraced(function* (nextState, options) {
|
|
1907
|
-
const figures = yield*
|
|
1908
|
-
const leadingSymbol =
|
|
1909
|
-
const trailingSymbol =
|
|
1910
|
-
const promptMsg = renderNumberOutput(nextState, leadingSymbol, trailingSymbol, options, undefined, true);
|
|
1967
|
+
const figures = yield* getTheme(options);
|
|
1968
|
+
const leadingSymbol = annotateSymbol(figures.tick, figures.successColor);
|
|
1969
|
+
const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor);
|
|
1970
|
+
const promptMsg = renderNumberOutput(nextState, leadingSymbol, trailingSymbol, options, figures, undefined, true);
|
|
1911
1971
|
return promptMsg + "\n";
|
|
1912
1972
|
});
|
|
1913
1973
|
const processNumberBackspace = state => {
|
|
@@ -1941,8 +2001,8 @@ const defaultIntProcessor = (input, state) => {
|
|
|
1941
2001
|
}
|
|
1942
2002
|
}));
|
|
1943
2003
|
}
|
|
1944
|
-
const parsed = Number.parseInt(state.value + input);
|
|
1945
|
-
if (Number.isNaN(parsed)) {
|
|
2004
|
+
const parsed = globalThis.Number.parseInt(state.value + input);
|
|
2005
|
+
if (globalThis.Number.isNaN(parsed)) {
|
|
1946
2006
|
return Effect.succeed(Action.Beep());
|
|
1947
2007
|
} else {
|
|
1948
2008
|
return Effect.succeed(Action.NextFrame({
|
|
@@ -1967,8 +2027,8 @@ const defaultFloatProcessor = (input, state) => {
|
|
|
1967
2027
|
}
|
|
1968
2028
|
}));
|
|
1969
2029
|
}
|
|
1970
|
-
const parsed = Number.parseFloat(state.value + input);
|
|
1971
|
-
if (Number.isNaN(parsed)) {
|
|
2030
|
+
const parsed = globalThis.Number.parseFloat(state.value + input);
|
|
2031
|
+
if (globalThis.Number.isNaN(parsed)) {
|
|
1972
2032
|
return Effect.succeed(Action.Beep());
|
|
1973
2033
|
} else {
|
|
1974
2034
|
return Effect.succeed(Action.NextFrame({
|
|
@@ -2007,7 +2067,7 @@ const handleProcessInteger = options => {
|
|
|
2007
2067
|
return Effect.succeed(Action.NextFrame({
|
|
2008
2068
|
state: {
|
|
2009
2069
|
...state,
|
|
2010
|
-
value: state.value === "" || state.value === "-" ? `${options.incrementBy}` : `${Number.parseInt(state.value) + options.incrementBy}`,
|
|
2070
|
+
value: state.value === "" || state.value === "-" ? `${options.incrementBy}` : `${globalThis.Number.parseInt(state.value) + options.incrementBy}`,
|
|
2011
2071
|
error: Option.none()
|
|
2012
2072
|
}
|
|
2013
2073
|
}));
|
|
@@ -2018,7 +2078,7 @@ const handleProcessInteger = options => {
|
|
|
2018
2078
|
return Effect.succeed(Action.NextFrame({
|
|
2019
2079
|
state: {
|
|
2020
2080
|
...state,
|
|
2021
|
-
value: state.value === "" || state.value === "-" ? `-${options.decrementBy}` : `${Number.parseInt(state.value) - options.decrementBy}`,
|
|
2081
|
+
value: state.value === "" || state.value === "-" ? `-${options.decrementBy}` : `${globalThis.Number.parseInt(state.value) - options.decrementBy}`,
|
|
2022
2082
|
error: Option.none()
|
|
2023
2083
|
}
|
|
2024
2084
|
}));
|
|
@@ -2026,8 +2086,8 @@ const handleProcessInteger = options => {
|
|
|
2026
2086
|
case "enter":
|
|
2027
2087
|
case "return":
|
|
2028
2088
|
{
|
|
2029
|
-
const parsed = Number.parseInt(state.value);
|
|
2030
|
-
if (Number.isNaN(parsed)) {
|
|
2089
|
+
const parsed = globalThis.Number.parseInt(state.value);
|
|
2090
|
+
if (globalThis.Number.isNaN(parsed)) {
|
|
2031
2091
|
return Effect.succeed(Action.NextFrame({
|
|
2032
2092
|
state: {
|
|
2033
2093
|
...state,
|
|
@@ -2082,7 +2142,7 @@ const handleProcessFloat = options => {
|
|
|
2082
2142
|
return Effect.succeed(Action.NextFrame({
|
|
2083
2143
|
state: {
|
|
2084
2144
|
...state,
|
|
2085
|
-
value: state.value === "" || state.value === "-" ? `${options.incrementBy}` : `${Number.parseFloat(state.value) + options.incrementBy}`,
|
|
2145
|
+
value: state.value === "" || state.value === "-" ? `${options.incrementBy}` : `${globalThis.Number.parseFloat(state.value) + options.incrementBy}`,
|
|
2086
2146
|
error: Option.none()
|
|
2087
2147
|
}
|
|
2088
2148
|
}));
|
|
@@ -2093,7 +2153,7 @@ const handleProcessFloat = options => {
|
|
|
2093
2153
|
return Effect.succeed(Action.NextFrame({
|
|
2094
2154
|
state: {
|
|
2095
2155
|
...state,
|
|
2096
|
-
value: state.value === "" || state.value === "-" ? `-${options.decrementBy}` : `${Number.parseFloat(state.value) - options.decrementBy}`,
|
|
2156
|
+
value: state.value === "" || state.value === "-" ? `-${options.decrementBy}` : `${globalThis.Number.parseFloat(state.value) - options.decrementBy}`,
|
|
2097
2157
|
error: Option.none()
|
|
2098
2158
|
}
|
|
2099
2159
|
}));
|
|
@@ -2101,8 +2161,8 @@ const handleProcessFloat = options => {
|
|
|
2101
2161
|
case "enter":
|
|
2102
2162
|
case "return":
|
|
2103
2163
|
{
|
|
2104
|
-
const parsed = Number.parseFloat(state.value);
|
|
2105
|
-
if (Number.isNaN(parsed)) {
|
|
2164
|
+
const parsed = globalThis.Number.parseFloat(state.value);
|
|
2165
|
+
if (globalThis.Number.isNaN(parsed)) {
|
|
2106
2166
|
return Effect.succeed(Action.NextFrame({
|
|
2107
2167
|
state: {
|
|
2108
2168
|
...state,
|
|
@@ -2166,57 +2226,47 @@ const updateAutoCompleteState = (state, options, query) => {
|
|
|
2166
2226
|
};
|
|
2167
2227
|
const autoCompleteCursor = state => Option.getOrElse(Arr.findFirstIndex(state.filtered, index => index === state.index), () => 0);
|
|
2168
2228
|
const renderSelectOutput = (leadingSymbol, trailingSymbol, options, renderOptions) => renderPrompt("", options.message, leadingSymbol, trailingSymbol, renderOptions);
|
|
2169
|
-
const renderAutoCompleteFilter = (state, options, renderOptions) => {
|
|
2170
|
-
const filterValue = state.query.length === 0 ? renderOptions?.plain === true ? options.filterPlaceholder : Ansi.annotate(options.filterPlaceholder,
|
|
2229
|
+
const renderAutoCompleteFilter = (state, options, theme, renderOptions) => {
|
|
2230
|
+
const filterValue = state.query.length === 0 ? renderOptions?.plain === true ? options.filterPlaceholder : Ansi.annotate(options.filterPlaceholder, theme.mutedColor) : renderOptions?.plain === true ? state.query : Ansi.annotate(state.query, Ansi.combine(Ansi.underlined, theme.primaryColor));
|
|
2171
2231
|
return `[${options.filterLabel}: ${filterValue}]`;
|
|
2172
2232
|
};
|
|
2173
|
-
const renderAutoCompleteOutput = (state, leadingSymbol, trailingSymbol, options, renderOptions) => {
|
|
2174
|
-
const filter = renderAutoCompleteFilter(state, options, renderOptions);
|
|
2233
|
+
const renderAutoCompleteOutput = (state, leadingSymbol, trailingSymbol, options, theme, renderOptions) => {
|
|
2234
|
+
const filter = renderAutoCompleteFilter(state, options, theme, renderOptions);
|
|
2175
2235
|
return renderPrompt(filter, options.message, leadingSymbol, trailingSymbol, renderOptions);
|
|
2176
2236
|
};
|
|
2177
2237
|
const renderChoicePrefix = (state, choices, toDisplay, currentIndex, figures, renderOptions) => {
|
|
2178
|
-
|
|
2179
|
-
if (currentIndex === toDisplay.startIndex && toDisplay.startIndex > 0) {
|
|
2180
|
-
prefix = figures.arrowUp;
|
|
2181
|
-
} else if (currentIndex === toDisplay.endIndex - 1 && toDisplay.endIndex < choices.length) {
|
|
2182
|
-
prefix = figures.arrowDown;
|
|
2183
|
-
}
|
|
2238
|
+
const prefix = renderPagingPrefix(figures, currentIndex === toDisplay.startIndex && toDisplay.startIndex > 0, currentIndex === toDisplay.endIndex - 1 && toDisplay.endIndex < choices.length);
|
|
2184
2239
|
if (renderOptions?.plain === true) {
|
|
2185
|
-
return state === currentIndex ? figures.pointer + prefix : prefix + " ";
|
|
2240
|
+
return state === currentIndex ? figures.pointer + prefix : prefix + " ".repeat(figures.pointer.length);
|
|
2186
2241
|
}
|
|
2187
2242
|
if (choices[currentIndex].disabled) {
|
|
2188
|
-
const annotation = Ansi.combine(Ansi.bold,
|
|
2189
|
-
return state === currentIndex ?
|
|
2243
|
+
const annotation = Ansi.combine(Ansi.bold, figures.mutedColor);
|
|
2244
|
+
return state === currentIndex ? annotateSymbol(figures.pointer, annotation) + prefix : prefix + " ".repeat(figures.pointer.length);
|
|
2190
2245
|
}
|
|
2191
|
-
return state === currentIndex ?
|
|
2246
|
+
return state === currentIndex ? annotateSymbol(figures.pointer, figures.primaryColor) + prefix : prefix + " ".repeat(figures.pointer.length);
|
|
2192
2247
|
};
|
|
2193
2248
|
const renderAutoCompleteChoicePrefix = (state, options, toDisplay, currentIndex, figures, renderOptions) => {
|
|
2194
|
-
|
|
2195
|
-
if (currentIndex === toDisplay.startIndex && toDisplay.startIndex > 0) {
|
|
2196
|
-
prefix = figures.arrowUp;
|
|
2197
|
-
} else if (currentIndex === toDisplay.endIndex - 1 && toDisplay.endIndex < state.filtered.length) {
|
|
2198
|
-
prefix = figures.arrowDown;
|
|
2199
|
-
}
|
|
2249
|
+
const prefix = renderPagingPrefix(figures, currentIndex === toDisplay.startIndex && toDisplay.startIndex > 0, currentIndex === toDisplay.endIndex - 1 && toDisplay.endIndex < state.filtered.length);
|
|
2200
2250
|
const choiceIndex = state.filtered[currentIndex];
|
|
2201
2251
|
if (renderOptions?.plain === true) {
|
|
2202
|
-
return state.index === choiceIndex ? figures.pointer + prefix : prefix + " ";
|
|
2252
|
+
return state.index === choiceIndex ? figures.pointer + prefix : prefix + " ".repeat(figures.pointer.length);
|
|
2203
2253
|
}
|
|
2204
2254
|
const choice = options.choices[choiceIndex];
|
|
2205
2255
|
if (choice.disabled) {
|
|
2206
|
-
const annotation = Ansi.combine(Ansi.bold,
|
|
2207
|
-
return state.index === choiceIndex ?
|
|
2256
|
+
const annotation = Ansi.combine(Ansi.bold, figures.mutedColor);
|
|
2257
|
+
return state.index === choiceIndex ? annotateSymbol(figures.pointer, annotation) + prefix : prefix + " ".repeat(figures.pointer.length);
|
|
2208
2258
|
}
|
|
2209
|
-
return state.index === choiceIndex ?
|
|
2259
|
+
return state.index === choiceIndex ? annotateSymbol(figures.pointer, figures.primaryColor) + prefix : prefix + " ".repeat(figures.pointer.length);
|
|
2210
2260
|
};
|
|
2211
|
-
const renderChoiceTitle = (choice, isSelected, renderOptions) => {
|
|
2261
|
+
const renderChoiceTitle = (choice, isSelected, theme, renderOptions) => {
|
|
2212
2262
|
if (renderOptions?.plain === true) {
|
|
2213
2263
|
return choice.title;
|
|
2214
2264
|
}
|
|
2215
2265
|
const title = choice.title;
|
|
2216
2266
|
if (isSelected) {
|
|
2217
|
-
return choice.disabled ? Ansi.annotate(title, Ansi.combine(Ansi.underlined,
|
|
2267
|
+
return choice.disabled ? Ansi.annotate(title, Ansi.combine(Ansi.underlined, theme.mutedColor)) : Ansi.annotate(title, Ansi.combine(Ansi.underlined, theme.primaryColor));
|
|
2218
2268
|
}
|
|
2219
|
-
return choice.disabled ? Ansi.annotate(title, Ansi.combine(Ansi.strikethrough,
|
|
2269
|
+
return choice.disabled ? Ansi.annotate(title, Ansi.combine(Ansi.strikethrough, theme.mutedColor)) : title;
|
|
2220
2270
|
};
|
|
2221
2271
|
const renderSelectChoices = (state, options, figures, renderOptions) => {
|
|
2222
2272
|
const choices = options.choices;
|
|
@@ -2226,15 +2276,15 @@ const renderSelectChoices = (state, options, figures, renderOptions) => {
|
|
|
2226
2276
|
const choice = choices[index];
|
|
2227
2277
|
const isSelected = state === index;
|
|
2228
2278
|
const prefix = renderChoicePrefix(state, choices, toDisplay, index, figures, renderOptions);
|
|
2229
|
-
const title = renderChoiceTitle(choice, isSelected, renderOptions);
|
|
2230
|
-
const description = renderChoiceDescription(choice, isSelected, renderOptions);
|
|
2279
|
+
const title = renderChoiceTitle(choice, isSelected, figures, renderOptions);
|
|
2280
|
+
const description = renderChoiceDescription(choice, isSelected, figures, renderOptions);
|
|
2231
2281
|
documents.push(prefix + title + " " + description);
|
|
2232
2282
|
}
|
|
2233
2283
|
return documents.join("\n");
|
|
2234
2284
|
};
|
|
2235
2285
|
const renderAutoCompleteChoices = (state, options, figures, renderOptions) => {
|
|
2236
2286
|
if (state.filtered.length === 0) {
|
|
2237
|
-
return renderOptions?.plain === true ? options.emptyMessage : Ansi.annotate(options.emptyMessage,
|
|
2287
|
+
return renderOptions?.plain === true ? options.emptyMessage : Ansi.annotate(options.emptyMessage, figures.mutedColor);
|
|
2238
2288
|
}
|
|
2239
2289
|
const cursor = autoCompleteCursor(state);
|
|
2240
2290
|
const toDisplay = entriesToDisplay(cursor, state.filtered.length, options.maxPerPage);
|
|
@@ -2244,43 +2294,43 @@ const renderAutoCompleteChoices = (state, options, figures, renderOptions) => {
|
|
|
2244
2294
|
const choice = options.choices[choiceIndex];
|
|
2245
2295
|
const isSelected = state.index === choiceIndex;
|
|
2246
2296
|
const prefix = renderAutoCompleteChoicePrefix(state, options, toDisplay, index, figures, renderOptions);
|
|
2247
|
-
const title = renderChoiceTitle(choice, isSelected, renderOptions);
|
|
2248
|
-
const description = renderChoiceDescription(choice, isSelected, renderOptions);
|
|
2297
|
+
const title = renderChoiceTitle(choice, isSelected, figures, renderOptions);
|
|
2298
|
+
const description = renderChoiceDescription(choice, isSelected, figures, renderOptions);
|
|
2249
2299
|
documents.push(prefix + title + " " + description);
|
|
2250
2300
|
}
|
|
2251
2301
|
return documents.join("\n");
|
|
2252
2302
|
};
|
|
2253
2303
|
const renderSelectNextFrame = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {
|
|
2254
|
-
const figures = yield*
|
|
2304
|
+
const figures = yield* getTheme(options);
|
|
2255
2305
|
const choices = renderSelectChoices(state, options, figures);
|
|
2256
|
-
const leadingSymbol =
|
|
2257
|
-
const trailingSymbol =
|
|
2306
|
+
const leadingSymbol = annotateSymbol(figures.prefix, figures.primaryColor);
|
|
2307
|
+
const trailingSymbol = annotateSymbol(figures.pointerSmall, figures.mutedColor);
|
|
2258
2308
|
const promptMsg = renderSelectOutput(leadingSymbol, trailingSymbol, options);
|
|
2259
2309
|
return Ansi.cursorHide + promptMsg + "\n" + choices;
|
|
2260
2310
|
});
|
|
2261
2311
|
const renderAutoCompleteNextFrame = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {
|
|
2262
|
-
const figures = yield*
|
|
2312
|
+
const figures = yield* getTheme(options);
|
|
2263
2313
|
const choices = renderAutoCompleteChoices(state, options, figures);
|
|
2264
|
-
const leadingSymbol =
|
|
2265
|
-
const trailingSymbol =
|
|
2266
|
-
const promptMsg = renderAutoCompleteOutput(state, leadingSymbol, trailingSymbol, options);
|
|
2314
|
+
const leadingSymbol = annotateSymbol(figures.prefix, figures.primaryColor);
|
|
2315
|
+
const trailingSymbol = annotateSymbol(figures.pointerSmall, figures.mutedColor);
|
|
2316
|
+
const promptMsg = renderAutoCompleteOutput(state, leadingSymbol, trailingSymbol, options, figures);
|
|
2267
2317
|
return Ansi.cursorHide + promptMsg + "\n" + choices;
|
|
2268
2318
|
});
|
|
2269
2319
|
const renderSelectSubmission = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {
|
|
2270
|
-
const figures = yield*
|
|
2320
|
+
const figures = yield* getTheme(options);
|
|
2271
2321
|
const selected = options.choices[state].title;
|
|
2272
|
-
const leadingSymbol =
|
|
2273
|
-
const trailingSymbol =
|
|
2322
|
+
const leadingSymbol = annotateSymbol(figures.tick, figures.successColor);
|
|
2323
|
+
const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor);
|
|
2274
2324
|
const promptMsg = renderSelectOutput(leadingSymbol, trailingSymbol, options);
|
|
2275
|
-
return promptMsg + " " + Ansi.annotate(selected,
|
|
2325
|
+
return promptMsg + " " + Ansi.annotate(selected, figures.submittedColor) + "\n";
|
|
2276
2326
|
});
|
|
2277
2327
|
const renderAutoCompleteSubmission = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {
|
|
2278
|
-
const figures = yield*
|
|
2328
|
+
const figures = yield* getTheme(options);
|
|
2279
2329
|
const selected = options.choices[state.index].title;
|
|
2280
|
-
const leadingSymbol =
|
|
2281
|
-
const trailingSymbol =
|
|
2282
|
-
const promptMsg = renderAutoCompleteOutput(state, leadingSymbol, trailingSymbol, options);
|
|
2283
|
-
return promptMsg + " " + Ansi.annotate(selected,
|
|
2330
|
+
const leadingSymbol = annotateSymbol(figures.tick, figures.successColor);
|
|
2331
|
+
const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor);
|
|
2332
|
+
const promptMsg = renderAutoCompleteOutput(state, leadingSymbol, trailingSymbol, options, figures);
|
|
2333
|
+
return promptMsg + " " + Ansi.annotate(selected, figures.submittedColor) + "\n";
|
|
2284
2334
|
});
|
|
2285
2335
|
const processSelectCursorUp = (state, choices) => {
|
|
2286
2336
|
if (state === 0) {
|
|
@@ -2380,9 +2430,9 @@ const handleAutoCompleteRender = options => {
|
|
|
2380
2430
|
const handleSelectClear = options => Effect.fnUntraced(function* (state, _) {
|
|
2381
2431
|
const terminal = yield* Terminal.Terminal;
|
|
2382
2432
|
const columns = yield* terminal.columns;
|
|
2383
|
-
const figures = yield*
|
|
2433
|
+
const figures = yield* getTheme(options);
|
|
2384
2434
|
const clearPrompt = Ansi.eraseLine + Ansi.cursorLeft;
|
|
2385
|
-
const promptText = renderSelectOutput(
|
|
2435
|
+
const promptText = renderSelectOutput(figures.prefix, figures.pointerSmall, options, {
|
|
2386
2436
|
plain: true
|
|
2387
2437
|
});
|
|
2388
2438
|
const choicesText = renderSelectChoices(state, options, figures, {
|
|
@@ -2394,9 +2444,9 @@ const handleSelectClear = options => Effect.fnUntraced(function* (state, _) {
|
|
|
2394
2444
|
const handleAutoCompleteClear = options => Effect.fnUntraced(function* (state, _) {
|
|
2395
2445
|
const terminal = yield* Terminal.Terminal;
|
|
2396
2446
|
const columns = yield* terminal.columns;
|
|
2397
|
-
const figures = yield*
|
|
2447
|
+
const figures = yield* getTheme(options);
|
|
2398
2448
|
const clearPrompt = Ansi.eraseLine + Ansi.cursorLeft;
|
|
2399
|
-
const promptText = renderAutoCompleteOutput(state,
|
|
2449
|
+
const promptText = renderAutoCompleteOutput(state, figures.prefix, figures.pointerSmall, options, figures, {
|
|
2400
2450
|
plain: true
|
|
2401
2451
|
});
|
|
2402
2452
|
const choicesText = renderAutoCompleteChoices(state, options, figures, {
|
|
@@ -2442,19 +2492,34 @@ const handleSelectProcess = options => {
|
|
|
2442
2492
|
};
|
|
2443
2493
|
const handleAutoCompleteProcess = options => {
|
|
2444
2494
|
return (input, state) => {
|
|
2495
|
+
// Navigation is bound to ctrl chords rather than bare `j`/`k`, so that every
|
|
2496
|
+
// printable character reaches the filter input.
|
|
2445
2497
|
if (input.key.ctrl) {
|
|
2446
|
-
|
|
2447
|
-
|
|
2498
|
+
switch (input.key.name) {
|
|
2499
|
+
case "u":
|
|
2500
|
+
{
|
|
2501
|
+
return processAutoCompleteClear(state, options);
|
|
2502
|
+
}
|
|
2503
|
+
case "p":
|
|
2504
|
+
case "k":
|
|
2505
|
+
{
|
|
2506
|
+
return processAutoCompleteCursorUp(state);
|
|
2507
|
+
}
|
|
2508
|
+
case "n":
|
|
2509
|
+
{
|
|
2510
|
+
return processAutoCompleteCursorDown(state);
|
|
2511
|
+
}
|
|
2512
|
+
default:
|
|
2513
|
+
{
|
|
2514
|
+
return Effect.succeed(Action.Beep());
|
|
2515
|
+
}
|
|
2448
2516
|
}
|
|
2449
|
-
return Effect.succeed(Action.Beep());
|
|
2450
2517
|
}
|
|
2451
2518
|
switch (input.key.name) {
|
|
2452
|
-
case "k":
|
|
2453
2519
|
case "up":
|
|
2454
2520
|
{
|
|
2455
2521
|
return processAutoCompleteCursorUp(state);
|
|
2456
2522
|
}
|
|
2457
|
-
case "j":
|
|
2458
2523
|
case "down":
|
|
2459
2524
|
{
|
|
2460
2525
|
return processAutoCompleteCursorDown(state);
|
|
@@ -2491,17 +2556,17 @@ const handleAutoCompleteProcess = options => {
|
|
|
2491
2556
|
const renderClearScreen = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {
|
|
2492
2557
|
const terminal = yield* Terminal.Terminal;
|
|
2493
2558
|
const columns = yield* terminal.columns;
|
|
2494
|
-
const figures = yield*
|
|
2559
|
+
const figures = yield* getTheme(options);
|
|
2495
2560
|
const resetCurrentLine = Ansi.eraseLine + Ansi.cursorLeft;
|
|
2496
|
-
const errorText = renderTextError(state, figures.pointerSmall, {
|
|
2561
|
+
const errorText = renderTextError(state, figures.pointerSmall, figures, {
|
|
2497
2562
|
plain: true
|
|
2498
2563
|
});
|
|
2499
|
-
const clearOutput = clearOutputWithError(renderTextOutput(state,
|
|
2564
|
+
const clearOutput = clearOutputWithError(renderTextOutput(state, figures.prefix, figures.pointerSmall, options, figures, {
|
|
2500
2565
|
plain: true
|
|
2501
2566
|
}), columns, errorText);
|
|
2502
2567
|
return clearOutput + resetCurrentLine;
|
|
2503
2568
|
});
|
|
2504
|
-
const renderTextInput = (nextState, options, submitted, renderOptions) => {
|
|
2569
|
+
const renderTextInput = (nextState, options, theme, submitted, renderOptions) => {
|
|
2505
2570
|
const text = nextState.value;
|
|
2506
2571
|
if (renderOptions?.plain === true) {
|
|
2507
2572
|
switch (options.type) {
|
|
@@ -2511,7 +2576,7 @@ const renderTextInput = (nextState, options, submitted, renderOptions) => {
|
|
|
2511
2576
|
}
|
|
2512
2577
|
case "password":
|
|
2513
2578
|
{
|
|
2514
|
-
return
|
|
2579
|
+
return theme.passwordMask.repeat(text.length);
|
|
2515
2580
|
}
|
|
2516
2581
|
case "text":
|
|
2517
2582
|
{
|
|
@@ -2519,7 +2584,12 @@ const renderTextInput = (nextState, options, submitted, renderOptions) => {
|
|
|
2519
2584
|
}
|
|
2520
2585
|
}
|
|
2521
2586
|
}
|
|
2522
|
-
|
|
2587
|
+
if (text.length === 0) {
|
|
2588
|
+
// Avoid wrapping an empty value in ANSI codes, which would make renderPrompt
|
|
2589
|
+
// add spacing for content that occupies no terminal columns.
|
|
2590
|
+
return "";
|
|
2591
|
+
}
|
|
2592
|
+
const annotation = Option.isSome(nextState.error) ? theme.errorColor : submitted ? theme.submittedColor : Ansi.combine(Ansi.underlined, theme.primaryColor);
|
|
2523
2593
|
switch (options.type) {
|
|
2524
2594
|
case "hidden":
|
|
2525
2595
|
{
|
|
@@ -2527,7 +2597,7 @@ const renderTextInput = (nextState, options, submitted, renderOptions) => {
|
|
|
2527
2597
|
}
|
|
2528
2598
|
case "password":
|
|
2529
2599
|
{
|
|
2530
|
-
return
|
|
2600
|
+
return annotateSymbol(theme.passwordMask.repeat(text.length), annotation);
|
|
2531
2601
|
}
|
|
2532
2602
|
case "text":
|
|
2533
2603
|
{
|
|
@@ -2535,40 +2605,41 @@ const renderTextInput = (nextState, options, submitted, renderOptions) => {
|
|
|
2535
2605
|
}
|
|
2536
2606
|
}
|
|
2537
2607
|
};
|
|
2538
|
-
const renderTextError = (nextState, pointer, renderOptions) => {
|
|
2608
|
+
const renderTextError = (nextState, pointer, theme, renderOptions) => {
|
|
2539
2609
|
if (Option.isSome(nextState.error)) {
|
|
2540
2610
|
return Arr.match(nextState.error.value.split(NEWLINE_REGEXP), {
|
|
2541
2611
|
onEmpty: () => "",
|
|
2542
2612
|
onNonEmpty: errorLines => {
|
|
2543
2613
|
if (renderOptions?.plain === true) {
|
|
2544
|
-
return
|
|
2614
|
+
return separateSymbol(pointer, errorLines.join("\n"));
|
|
2545
2615
|
}
|
|
2546
|
-
const prefix =
|
|
2547
|
-
const lines = Arr.map(errorLines, str => annotateErrorLine(str));
|
|
2548
|
-
return Ansi.cursorSavePosition + "\n" + prefix
|
|
2616
|
+
const prefix = annotateSymbol(pointer, theme.errorColor);
|
|
2617
|
+
const lines = Arr.map(errorLines, str => annotateErrorLine(str, theme.errorColor));
|
|
2618
|
+
return Ansi.cursorSavePosition + "\n" + separateSymbol(prefix, lines.join("\n")) + Ansi.cursorRestorePosition;
|
|
2549
2619
|
}
|
|
2550
2620
|
});
|
|
2551
2621
|
}
|
|
2552
2622
|
return "";
|
|
2553
2623
|
};
|
|
2554
|
-
const renderTextOutput = (nextState, leadingSymbol, trailingSymbol, options, renderOptions, submitted = false) => {
|
|
2555
|
-
const value = renderTextInput(nextState, options, submitted, renderOptions);
|
|
2624
|
+
const renderTextOutput = (nextState, leadingSymbol, trailingSymbol, options, theme, renderOptions, submitted = false) => {
|
|
2625
|
+
const value = renderTextInput(nextState, options, theme, submitted, renderOptions);
|
|
2556
2626
|
return renderPrompt(value, options.message, leadingSymbol, trailingSymbol, renderOptions);
|
|
2557
2627
|
};
|
|
2558
2628
|
const renderTextNextFrame = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {
|
|
2559
|
-
const figures = yield*
|
|
2560
|
-
const leadingSymbol =
|
|
2561
|
-
const trailingSymbol =
|
|
2562
|
-
const promptMsg = renderTextOutput(state, leadingSymbol, trailingSymbol, options);
|
|
2563
|
-
const errorMsg = renderTextError(state, figures.pointerSmall);
|
|
2564
|
-
const
|
|
2629
|
+
const figures = yield* getTheme(options);
|
|
2630
|
+
const leadingSymbol = annotateSymbol(figures.prefix, figures.primaryColor);
|
|
2631
|
+
const trailingSymbol = annotateSymbol(figures.pointerSmall, figures.mutedColor);
|
|
2632
|
+
const promptMsg = renderTextOutput(state, leadingSymbol, trailingSymbol, options, figures);
|
|
2633
|
+
const errorMsg = renderTextError(state, figures.pointerSmall, figures);
|
|
2634
|
+
const cursorWidth = options.type === "password" ? figures.passwordMask.length : 1;
|
|
2635
|
+
const offset = (state.cursor - state.value.length) * cursorWidth;
|
|
2565
2636
|
return promptMsg + errorMsg + Ansi.cursorMove(offset);
|
|
2566
2637
|
});
|
|
2567
2638
|
const renderTextSubmission = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {
|
|
2568
|
-
const figures = yield*
|
|
2569
|
-
const leadingSymbol =
|
|
2570
|
-
const trailingSymbol =
|
|
2571
|
-
const promptMsg = renderTextOutput(state, leadingSymbol, trailingSymbol, options, undefined, true);
|
|
2639
|
+
const figures = yield* getTheme(options);
|
|
2640
|
+
const leadingSymbol = annotateSymbol(figures.tick, figures.successColor);
|
|
2641
|
+
const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor);
|
|
2642
|
+
const promptMsg = renderTextOutput(state, leadingSymbol, trailingSymbol, options, figures, undefined, true);
|
|
2572
2643
|
return promptMsg + "\n";
|
|
2573
2644
|
});
|
|
2574
2645
|
const processTextBackspace = state => {
|
|
@@ -2756,15 +2827,14 @@ const basePrompt = (options, type) => {
|
|
|
2756
2827
|
default: "",
|
|
2757
2828
|
type,
|
|
2758
2829
|
validate: Effect.succeed,
|
|
2759
|
-
...options
|
|
2760
|
-
prefix: options.prefix ?? DEFAULT_PREFIX
|
|
2830
|
+
...options
|
|
2761
2831
|
};
|
|
2762
2832
|
const initialState = {
|
|
2763
2833
|
cursor: opts.default.length,
|
|
2764
2834
|
value: opts.default,
|
|
2765
2835
|
error: Option.none()
|
|
2766
2836
|
};
|
|
2767
|
-
return
|
|
2837
|
+
return Custom(initialState, {
|
|
2768
2838
|
render: handleTextRender(opts),
|
|
2769
2839
|
process: handleTextProcess(opts),
|
|
2770
2840
|
clear: handleTextClear(opts)
|
|
@@ -2773,44 +2843,38 @@ const basePrompt = (options, type) => {
|
|
|
2773
2843
|
const handleToggleClear = /*#__PURE__*/Effect.fnUntraced(function* (options) {
|
|
2774
2844
|
const terminal = yield* Terminal.Terminal;
|
|
2775
2845
|
const columns = yield* terminal.columns;
|
|
2776
|
-
const figures = yield*
|
|
2846
|
+
const figures = yield* getTheme(options);
|
|
2777
2847
|
const clearPrompt = Ansi.eraseLine + Ansi.cursorLeft;
|
|
2778
|
-
const toggleText =
|
|
2779
|
-
const promptText = renderPrompt(toggleText, options.message,
|
|
2848
|
+
const toggleText = options.active + " " + separateSymbol(figures.toggleSeparator, options.inactive);
|
|
2849
|
+
const promptText = renderPrompt(toggleText, options.message, figures.prefix, figures.pointerSmall, {
|
|
2780
2850
|
plain: true
|
|
2781
2851
|
});
|
|
2782
2852
|
const clearOutput = eraseText(promptText, columns);
|
|
2783
2853
|
return clearOutput + clearPrompt;
|
|
2784
2854
|
});
|
|
2785
|
-
const renderToggle = (value, options, submitted = false) => {
|
|
2786
|
-
const separator =
|
|
2787
|
-
const selectedAnnotation = Ansi.combine(Ansi.underlined, submitted ?
|
|
2855
|
+
const renderToggle = (value, options, theme, submitted = false) => {
|
|
2856
|
+
const separator = annotateSymbol(theme.toggleSeparator, theme.mutedColor);
|
|
2857
|
+
const selectedAnnotation = Ansi.combine(Ansi.underlined, submitted ? theme.submittedColor : theme.primaryColor);
|
|
2788
2858
|
const inactive = value ? options.inactive : Ansi.annotate(options.inactive, selectedAnnotation);
|
|
2789
2859
|
const active = value ? Ansi.annotate(options.active, selectedAnnotation) : options.active;
|
|
2790
|
-
return active + " " + separator
|
|
2860
|
+
return active + " " + separateSymbol(separator, inactive);
|
|
2791
2861
|
};
|
|
2792
2862
|
const renderToggleOutput = (toggle, leadingSymbol, trailingSymbol, options) => {
|
|
2793
|
-
|
|
2794
|
-
const prefix = leadingSymbol + " ";
|
|
2795
|
-
if (Arr.isReadonlyArrayNonEmpty(promptLines)) {
|
|
2796
|
-
const lines = Arr.map(promptLines, line => annotateLine(line));
|
|
2797
|
-
return prefix + lines.join("\n") + " " + trailingSymbol + " " + toggle;
|
|
2798
|
-
}
|
|
2799
|
-
return prefix + " " + trailingSymbol + " " + toggle;
|
|
2863
|
+
return renderPrompt(toggle, options.message, leadingSymbol, trailingSymbol);
|
|
2800
2864
|
};
|
|
2801
2865
|
const renderToggleNextFrame = /*#__PURE__*/Effect.fnUntraced(function* (state, options) {
|
|
2802
|
-
const figures = yield*
|
|
2803
|
-
const leadingSymbol =
|
|
2804
|
-
const trailingSymbol =
|
|
2805
|
-
const toggle = renderToggle(state, options);
|
|
2866
|
+
const figures = yield* getTheme(options);
|
|
2867
|
+
const leadingSymbol = annotateSymbol(figures.prefix, figures.primaryColor);
|
|
2868
|
+
const trailingSymbol = annotateSymbol(figures.pointerSmall, figures.mutedColor);
|
|
2869
|
+
const toggle = renderToggle(state, options, figures);
|
|
2806
2870
|
const promptMsg = renderToggleOutput(toggle, leadingSymbol, trailingSymbol, options);
|
|
2807
2871
|
return Ansi.cursorHide + promptMsg;
|
|
2808
2872
|
});
|
|
2809
2873
|
const renderToggleSubmission = /*#__PURE__*/Effect.fnUntraced(function* (value, options) {
|
|
2810
|
-
const figures = yield*
|
|
2811
|
-
const leadingSymbol =
|
|
2812
|
-
const trailingSymbol =
|
|
2813
|
-
const toggle = renderToggle(value, options, true);
|
|
2874
|
+
const figures = yield* getTheme(options);
|
|
2875
|
+
const leadingSymbol = annotateSymbol(figures.tick, figures.successColor);
|
|
2876
|
+
const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor);
|
|
2877
|
+
const toggle = renderToggle(value, options, figures, true);
|
|
2814
2878
|
const promptMsg = renderToggleOutput(toggle, leadingSymbol, trailingSymbol, options);
|
|
2815
2879
|
return promptMsg + "\n";
|
|
2816
2880
|
});
|