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
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
import * as Arr from "../../Array.ts"
|
|
14
14
|
import type { NoSuchElementError } from "../../Cause.ts"
|
|
15
15
|
import type * as Cause from "../../Cause.ts"
|
|
16
|
+
import * as Context from "../../Context.ts"
|
|
16
17
|
import * as Data from "../../Data.ts"
|
|
17
18
|
import * as Effect from "../../Effect.ts"
|
|
18
19
|
import * as Effectable from "../../Effectable.ts"
|
|
@@ -147,6 +148,67 @@ export interface Handlers<State, Output, Input = Terminal.UserInput> {
|
|
|
147
148
|
) => Effect.Effect<string, never, Environment>
|
|
148
149
|
}
|
|
149
150
|
|
|
151
|
+
/**
|
|
152
|
+
* Defines the symbols used to render built-in prompts.
|
|
153
|
+
*
|
|
154
|
+
* **Details**
|
|
155
|
+
*
|
|
156
|
+
* Set a symbol to an empty string to omit both the symbol and its adjacent
|
|
157
|
+
* spacing.
|
|
158
|
+
*
|
|
159
|
+
* @category models
|
|
160
|
+
* @since 4.0.0
|
|
161
|
+
*/
|
|
162
|
+
export interface Theme {
|
|
163
|
+
/** The leading symbol on an active prompt line. */
|
|
164
|
+
readonly prefix: string
|
|
165
|
+
/** The marker for the highlighted choice. */
|
|
166
|
+
readonly pointer: string
|
|
167
|
+
/** The trailing prompt and validation marker. */
|
|
168
|
+
readonly pointerSmall: string
|
|
169
|
+
/** The marker shown when a prompt has been submitted. */
|
|
170
|
+
readonly ellipsis: string
|
|
171
|
+
/** The leading symbol on a completed prompt line. */
|
|
172
|
+
readonly tick: string
|
|
173
|
+
/** The marker indicating choices above the current page. */
|
|
174
|
+
readonly arrowUp: string
|
|
175
|
+
/** The marker indicating choices below the current page. */
|
|
176
|
+
readonly arrowDown: string
|
|
177
|
+
/** The marker for a selected multi-select choice. */
|
|
178
|
+
readonly checkboxOn: string
|
|
179
|
+
/** The marker for an unselected multi-select choice. */
|
|
180
|
+
readonly checkboxOff: string
|
|
181
|
+
/** The separator between a choice and its description. */
|
|
182
|
+
readonly descriptionSeparator: string
|
|
183
|
+
/** The character used to mask password input. */
|
|
184
|
+
readonly passwordMask: string
|
|
185
|
+
/** The separator between toggle labels. */
|
|
186
|
+
readonly toggleSeparator: string
|
|
187
|
+
/** The color used for active prompt elements. */
|
|
188
|
+
readonly primaryColor: string
|
|
189
|
+
/** The color used for secondary prompt elements. */
|
|
190
|
+
readonly mutedColor: string
|
|
191
|
+
/** The color used for completed prompt markers. */
|
|
192
|
+
readonly successColor: string
|
|
193
|
+
/** The color used for validation errors. */
|
|
194
|
+
readonly errorColor: string
|
|
195
|
+
/** The color used for submitted values. */
|
|
196
|
+
readonly submittedColor: string
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
/**
|
|
200
|
+
* Options shared by built-in prompts that support theme overrides.
|
|
201
|
+
*
|
|
202
|
+
* @category options
|
|
203
|
+
* @since 4.0.0
|
|
204
|
+
*/
|
|
205
|
+
export interface ThemeOptions {
|
|
206
|
+
/** Overrides the context theme for this prompt. */
|
|
207
|
+
readonly theme?: Partial<Theme>
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
type OptionsReq<A> = Required<Omit<A, "theme">> & ThemeOptions
|
|
211
|
+
|
|
150
212
|
/**
|
|
151
213
|
* Options for a confirmation prompt that asks the user to choose a boolean
|
|
152
214
|
* yes/no value.
|
|
@@ -154,15 +216,11 @@ export interface Handlers<State, Output, Input = Terminal.UserInput> {
|
|
|
154
216
|
* @category options
|
|
155
217
|
* @since 4.0.0
|
|
156
218
|
*/
|
|
157
|
-
export interface ConfirmOptions {
|
|
219
|
+
export interface ConfirmOptions extends ThemeOptions {
|
|
158
220
|
/**
|
|
159
221
|
* The message to display in the prompt.
|
|
160
222
|
*/
|
|
161
223
|
readonly message: string
|
|
162
|
-
/**
|
|
163
|
-
* The single-column prefix to display at the start of the prompt (defaults to `"?"`).
|
|
164
|
-
*/
|
|
165
|
-
readonly prefix?: string
|
|
166
224
|
/**
|
|
167
225
|
* The initial value of the confirm prompt (defaults to `false`).
|
|
168
226
|
*/
|
|
@@ -204,15 +262,11 @@ export interface ConfirmOptions {
|
|
|
204
262
|
* @category options
|
|
205
263
|
* @since 4.0.0
|
|
206
264
|
*/
|
|
207
|
-
export interface DateOptions {
|
|
265
|
+
export interface DateOptions extends ThemeOptions {
|
|
208
266
|
/**
|
|
209
267
|
* The message to display in the prompt.
|
|
210
268
|
*/
|
|
211
269
|
readonly message: string
|
|
212
|
-
/**
|
|
213
|
-
* The single-column prefix to display at the start of the prompt (defaults to `"?"`).
|
|
214
|
-
*/
|
|
215
|
-
readonly prefix?: string
|
|
216
270
|
/**
|
|
217
271
|
* The initial date value to display in the prompt (defaults to the current
|
|
218
272
|
* date).
|
|
@@ -283,15 +337,11 @@ export interface DateOptions {
|
|
|
283
337
|
* @category options
|
|
284
338
|
* @since 4.0.0
|
|
285
339
|
*/
|
|
286
|
-
export interface
|
|
340
|
+
export interface IntOptions extends ThemeOptions {
|
|
287
341
|
/**
|
|
288
342
|
* The message to display in the prompt.
|
|
289
343
|
*/
|
|
290
344
|
readonly message: string
|
|
291
|
-
/**
|
|
292
|
-
* The single-column prefix to display at the start of the prompt (defaults to `"?"`).
|
|
293
|
-
*/
|
|
294
|
-
readonly prefix?: string
|
|
295
345
|
/**
|
|
296
346
|
* The default value of the integer prompt.
|
|
297
347
|
*/
|
|
@@ -322,17 +372,12 @@ export interface IntegerOptions {
|
|
|
322
372
|
}
|
|
323
373
|
|
|
324
374
|
/**
|
|
325
|
-
* Options for
|
|
326
|
-
*
|
|
327
|
-
* **Details**
|
|
328
|
-
*
|
|
329
|
-
* In addition to the numeric bounds and step settings from `IntegerOptions`,
|
|
330
|
-
* the prompt can be configured with a display precision.
|
|
375
|
+
* Options for `Number`, extending `IntOptions` with display precision.
|
|
331
376
|
*
|
|
332
377
|
* @category options
|
|
333
378
|
* @since 4.0.0
|
|
334
379
|
*/
|
|
335
|
-
export interface
|
|
380
|
+
export interface NumberOptions extends IntOptions {
|
|
336
381
|
/**
|
|
337
382
|
* The precision to use for the floating point value (defaults to `2`).
|
|
338
383
|
*/
|
|
@@ -364,7 +409,7 @@ export interface ListOptions extends TextOptions {
|
|
|
364
409
|
* @category options
|
|
365
410
|
* @since 4.0.0
|
|
366
411
|
*/
|
|
367
|
-
export interface FileOptions {
|
|
412
|
+
export interface FileOptions extends ThemeOptions {
|
|
368
413
|
/**
|
|
369
414
|
* The path type that will be selected, defaulting to `"file"`.
|
|
370
415
|
*/
|
|
@@ -373,11 +418,6 @@ export interface FileOptions {
|
|
|
373
418
|
* The message to display in the prompt, defaulting to `"Choose a file"`.
|
|
374
419
|
*/
|
|
375
420
|
readonly message?: string
|
|
376
|
-
/**
|
|
377
|
-
* The single-column prefix to display at the start of the directory traversal
|
|
378
|
-
* confirmation prompt (defaults to `"?"`).
|
|
379
|
-
*/
|
|
380
|
-
readonly prefix?: string
|
|
381
421
|
/**
|
|
382
422
|
* Where the user will initially be prompted to select files from, defaulting
|
|
383
423
|
* to the current working directory.
|
|
@@ -405,15 +445,11 @@ export interface FileOptions {
|
|
|
405
445
|
* @category options
|
|
406
446
|
* @since 4.0.0
|
|
407
447
|
*/
|
|
408
|
-
export interface SelectOptions<A> {
|
|
448
|
+
export interface SelectOptions<A> extends ThemeOptions {
|
|
409
449
|
/**
|
|
410
450
|
* The message to display in the prompt.
|
|
411
451
|
*/
|
|
412
452
|
readonly message: string
|
|
413
|
-
/**
|
|
414
|
-
* The single-column prefix to display at the start of the prompt (defaults to `"?"`).
|
|
415
|
-
*/
|
|
416
|
-
readonly prefix?: string
|
|
417
453
|
/**
|
|
418
454
|
* The choices to display to the user.
|
|
419
455
|
*/
|
|
@@ -514,15 +550,11 @@ export interface SelectChoice<A> {
|
|
|
514
550
|
* @category options
|
|
515
551
|
* @since 4.0.0
|
|
516
552
|
*/
|
|
517
|
-
export interface TextOptions {
|
|
553
|
+
export interface TextOptions extends ThemeOptions {
|
|
518
554
|
/**
|
|
519
555
|
* The message to display in the prompt.
|
|
520
556
|
*/
|
|
521
557
|
readonly message: string
|
|
522
|
-
/**
|
|
523
|
-
* The single-column prefix to display at the start of the prompt (defaults to `"?"`).
|
|
524
|
-
*/
|
|
525
|
-
readonly prefix?: string
|
|
526
558
|
/**
|
|
527
559
|
* The default value of the text option.
|
|
528
560
|
*/
|
|
@@ -541,15 +573,11 @@ export interface TextOptions {
|
|
|
541
573
|
* @category options
|
|
542
574
|
* @since 4.0.0
|
|
543
575
|
*/
|
|
544
|
-
export interface ToggleOptions {
|
|
576
|
+
export interface ToggleOptions extends ThemeOptions {
|
|
545
577
|
/**
|
|
546
578
|
* The message to display in the prompt.
|
|
547
579
|
*/
|
|
548
580
|
readonly message: string
|
|
549
|
-
/**
|
|
550
|
-
* The single-column prefix to display at the start of the prompt (defaults to `"?"`).
|
|
551
|
-
*/
|
|
552
|
-
readonly prefix?: string
|
|
553
581
|
/**
|
|
554
582
|
* The intitial value of the toggle prompt (defaults to `false`).
|
|
555
583
|
*/
|
|
@@ -566,47 +594,64 @@ export interface ToggleOptions {
|
|
|
566
594
|
readonly inactive?: string
|
|
567
595
|
}
|
|
568
596
|
|
|
569
|
-
const
|
|
597
|
+
const defaultTheme: Theme = {
|
|
598
|
+
prefix: "?",
|
|
570
599
|
arrowUp: "↑",
|
|
571
600
|
arrowDown: "↓",
|
|
572
|
-
arrowLeft: "←",
|
|
573
|
-
arrowRight: "→",
|
|
574
|
-
radioOn: "◉",
|
|
575
|
-
radioOff: "◯",
|
|
576
601
|
checkboxOn: "☒",
|
|
577
602
|
checkboxOff: "☐",
|
|
578
603
|
tick: "✔",
|
|
579
|
-
cross: "✖",
|
|
580
604
|
ellipsis: "…",
|
|
581
605
|
pointerSmall: "›",
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
606
|
+
pointer: "❯",
|
|
607
|
+
descriptionSeparator: "- ",
|
|
608
|
+
passwordMask: "*",
|
|
609
|
+
toggleSeparator: "/",
|
|
610
|
+
primaryColor: Ansi.cyanBright,
|
|
611
|
+
mutedColor: Ansi.blackBright,
|
|
612
|
+
successColor: Ansi.green,
|
|
613
|
+
errorColor: Ansi.red,
|
|
614
|
+
submittedColor: Ansi.white
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
const windowsTheme: Theme = {
|
|
618
|
+
...defaultTheme,
|
|
595
619
|
checkboxOn: "[*]",
|
|
596
620
|
checkboxOff: "[ ]",
|
|
597
621
|
tick: "√",
|
|
598
|
-
cross: "×",
|
|
599
622
|
ellipsis: "...",
|
|
600
623
|
pointerSmall: "»",
|
|
601
|
-
line: "─",
|
|
602
624
|
pointer: ">"
|
|
603
625
|
}
|
|
604
626
|
|
|
605
|
-
/**
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
627
|
+
/**
|
|
628
|
+
* Creates a prompt theme using the current platform defaults.
|
|
629
|
+
*
|
|
630
|
+
* @category constructors
|
|
631
|
+
* @since 4.0.0
|
|
632
|
+
*/
|
|
633
|
+
export const makeTheme = (options?: Partial<Theme>): Theme => ({
|
|
634
|
+
...(process.platform === "win32" ? windowsTheme : defaultTheme),
|
|
635
|
+
...options
|
|
636
|
+
})
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* Context reference for the theme used by built-in prompts.
|
|
640
|
+
*
|
|
641
|
+
* **Details**
|
|
642
|
+
*
|
|
643
|
+
* Provide this reference once to theme every prompt in an application. A
|
|
644
|
+
* prompt's `theme` option takes precedence over the context value.
|
|
645
|
+
*
|
|
646
|
+
* @category services
|
|
647
|
+
* @since 4.0.0
|
|
648
|
+
*/
|
|
649
|
+
export const Theme: Context.Reference<Theme> = Context.Reference("effect/unstable/cli/Prompt/Theme", {
|
|
650
|
+
defaultValue: makeTheme
|
|
651
|
+
})
|
|
652
|
+
|
|
653
|
+
const getTheme = (options: ThemeOptions): Effect.Effect<Theme> =>
|
|
654
|
+
Effect.map(Theme, (theme) => ({ ...theme, ...options.theme }))
|
|
610
655
|
|
|
611
656
|
/**
|
|
612
657
|
* Type alias for any `Prompt`, regardless of its output type.
|
|
@@ -753,7 +798,21 @@ export const all: <
|
|
|
753
798
|
}
|
|
754
799
|
|
|
755
800
|
const annotateLine = (line: string): string => Ansi.annotate(line, Ansi.bold)
|
|
756
|
-
const annotateErrorLine = (line: string): string =>
|
|
801
|
+
const annotateErrorLine = (line: string, color: string): string =>
|
|
802
|
+
Ansi.annotate(line, Ansi.combine(Ansi.italicized, color))
|
|
803
|
+
const annotateSymbol = (symbol: string, ...styles: Array<string | Array<string>>): string =>
|
|
804
|
+
symbol.length === 0 ? "" : Ansi.annotate(symbol, ...styles)
|
|
805
|
+
const separateSymbol = (symbol: string, text: string): string => symbol.length === 0 ? text : symbol + " " + text
|
|
806
|
+
const renderPagingPrefix = (theme: Theme, showArrowUp: boolean, showArrowDown: boolean): string => {
|
|
807
|
+
const width = Math.max(theme.arrowUp.length, theme.arrowDown.length)
|
|
808
|
+
if (showArrowUp) {
|
|
809
|
+
return theme.arrowUp.padEnd(width)
|
|
810
|
+
}
|
|
811
|
+
if (showArrowDown) {
|
|
812
|
+
return theme.arrowDown.padEnd(width)
|
|
813
|
+
}
|
|
814
|
+
return " ".repeat(width)
|
|
815
|
+
}
|
|
757
816
|
|
|
758
817
|
/**
|
|
759
818
|
* Creates a confirmation prompt that asks the user to choose a boolean yes/no
|
|
@@ -768,16 +827,15 @@ const annotateErrorLine = (line: string): string => Ansi.annotate(line, Ansi.com
|
|
|
768
827
|
* `initial` defaults to `false`. Enter submits the current default, yes-style
|
|
769
828
|
* input submits `true`, no-style input submits `false`, and other input beeps.
|
|
770
829
|
*
|
|
771
|
-
* @see {@link
|
|
830
|
+
* @see {@link Toggle} for an interactive switch-before-submit boolean prompt
|
|
772
831
|
*
|
|
773
832
|
* @category constructors
|
|
774
833
|
* @since 4.0.0
|
|
775
834
|
*/
|
|
776
|
-
export const
|
|
777
|
-
const opts:
|
|
835
|
+
export const Confirm = (options: ConfirmOptions): Prompt<boolean> => {
|
|
836
|
+
const opts: ConfirmOptionsReq = {
|
|
778
837
|
initial: false,
|
|
779
838
|
...options,
|
|
780
|
-
prefix: options.prefix ?? DEFAULT_PREFIX,
|
|
781
839
|
label: {
|
|
782
840
|
confirm: "yes",
|
|
783
841
|
deny: "no",
|
|
@@ -790,7 +848,7 @@ export const confirm = (options: ConfirmOptions): Prompt<boolean> => {
|
|
|
790
848
|
}
|
|
791
849
|
}
|
|
792
850
|
const initialState: ConfirmState = { value: opts.initial }
|
|
793
|
-
return
|
|
851
|
+
return Custom(initialState, {
|
|
794
852
|
render: handleConfirmRender(opts),
|
|
795
853
|
process: (input) => handleConfirmProcess(input, opts.initial),
|
|
796
854
|
clear: handleConfirmClear(opts)
|
|
@@ -819,7 +877,7 @@ export const confirm = (options: ConfirmOptions): Prompt<boolean> => {
|
|
|
819
877
|
* @category constructors
|
|
820
878
|
* @since 4.0.0
|
|
821
879
|
*/
|
|
822
|
-
export const
|
|
880
|
+
export const Custom: {
|
|
823
881
|
/**
|
|
824
882
|
* Creates a custom `Prompt` from the specified initial state and handlers.
|
|
825
883
|
*
|
|
@@ -913,13 +971,12 @@ export const custom: {
|
|
|
913
971
|
* @category constructors
|
|
914
972
|
* @since 4.0.0
|
|
915
973
|
*/
|
|
916
|
-
export const
|
|
917
|
-
const opts:
|
|
918
|
-
initial: new Date(),
|
|
974
|
+
export const Date = (options: DateOptions): Prompt<globalThis.Date> => {
|
|
975
|
+
const opts: DateOptionsReq = {
|
|
976
|
+
initial: new globalThis.Date(),
|
|
919
977
|
dateMask: "YYYY-MM-DD HH:mm:ss",
|
|
920
978
|
validate: Effect.succeed,
|
|
921
979
|
...options,
|
|
922
|
-
prefix: options.prefix ?? DEFAULT_PREFIX,
|
|
923
980
|
locales: {
|
|
924
981
|
...defaultLocales,
|
|
925
982
|
...options.locales
|
|
@@ -934,7 +991,7 @@ export const date = (options: DateOptions): Prompt<Date> => {
|
|
|
934
991
|
value: opts.initial,
|
|
935
992
|
error: Option.none()
|
|
936
993
|
}
|
|
937
|
-
return
|
|
994
|
+
return Custom(initialState, {
|
|
938
995
|
render: handleDateRender(opts),
|
|
939
996
|
process: handleDateProcess(opts),
|
|
940
997
|
clear: handleDateClear(opts)
|
|
@@ -949,14 +1006,19 @@ export const date = (options: DateOptions): Prompt<Date> => {
|
|
|
949
1006
|
* The prompt can be configured to select files, directories, or either path
|
|
950
1007
|
* type.
|
|
951
1008
|
*
|
|
1009
|
+
* You can also type to filter the listed entries. Every printable character is
|
|
1010
|
+
* appended to the filter query, so navigation is bound to the arrow keys,
|
|
1011
|
+
* `tab`, and the `Ctrl+P` / `Ctrl+N` chords used by `readline` and `fzf`
|
|
1012
|
+
* (`Ctrl+K` also moves up). `Ctrl+U` clears the query.
|
|
1013
|
+
*
|
|
952
1014
|
* @category constructors
|
|
953
1015
|
* @since 4.0.0
|
|
954
1016
|
*/
|
|
955
|
-
export const
|
|
1017
|
+
export const File = (options: FileOptions = {}): Prompt<string> => {
|
|
956
1018
|
const opts: FileOptionsReq = {
|
|
1019
|
+
...options,
|
|
957
1020
|
type: options.type ?? "file",
|
|
958
1021
|
message: options.message ?? `Choose a file`,
|
|
959
|
-
prefix: options.prefix ?? DEFAULT_PREFIX,
|
|
960
1022
|
startingPath: Option.fromUndefinedOr(options.startingPath),
|
|
961
1023
|
default: Option.fromUndefinedOr(options.default),
|
|
962
1024
|
maxPerPage: options.maxPerPage ?? 10,
|
|
@@ -982,10 +1044,10 @@ export const file = (options: FileOptions = {}): Prompt<string> => {
|
|
|
982
1044
|
return index === -1 ? 0 : index
|
|
983
1045
|
}
|
|
984
1046
|
})
|
|
985
|
-
const confirm =
|
|
1047
|
+
const confirm = FileConfirm.Hide()
|
|
986
1048
|
return { cursor, files, allFiles: files, query: "", path: Option.map(defaultPath, path.dirname), confirm }
|
|
987
1049
|
})
|
|
988
|
-
return
|
|
1050
|
+
return Custom(initialState, {
|
|
989
1051
|
render: handleFileRender(opts),
|
|
990
1052
|
process: handleFileProcess(opts),
|
|
991
1053
|
clear: handleFileClear(opts)
|
|
@@ -1035,11 +1097,11 @@ export const flatMap: {
|
|
|
1035
1097
|
* @category constructors
|
|
1036
1098
|
* @since 4.0.0
|
|
1037
1099
|
*/
|
|
1038
|
-
export const
|
|
1039
|
-
const opts:
|
|
1100
|
+
export const Number = (options: NumberOptions): Prompt<number> => {
|
|
1101
|
+
const opts: NumberOptionsReq = {
|
|
1040
1102
|
default: 0,
|
|
1041
|
-
min: Number.NEGATIVE_INFINITY,
|
|
1042
|
-
max: Number.POSITIVE_INFINITY,
|
|
1103
|
+
min: globalThis.Number.NEGATIVE_INFINITY,
|
|
1104
|
+
max: globalThis.Number.POSITIVE_INFINITY,
|
|
1043
1105
|
incrementBy: 1,
|
|
1044
1106
|
decrementBy: 1,
|
|
1045
1107
|
precision: 2,
|
|
@@ -1052,8 +1114,7 @@ export const float = (options: FloatOptions): Prompt<number> => {
|
|
|
1052
1114
|
}
|
|
1053
1115
|
return Effect.succeed(n)
|
|
1054
1116
|
},
|
|
1055
|
-
...options
|
|
1056
|
-
prefix: options.prefix ?? DEFAULT_PREFIX
|
|
1117
|
+
...options
|
|
1057
1118
|
}
|
|
1058
1119
|
const initialValue = options.default === undefined ? "" : `${opts.default}`
|
|
1059
1120
|
const initialState: NumberState = {
|
|
@@ -1061,7 +1122,7 @@ export const float = (options: FloatOptions): Prompt<number> => {
|
|
|
1061
1122
|
value: initialValue,
|
|
1062
1123
|
error: Option.none()
|
|
1063
1124
|
}
|
|
1064
|
-
return
|
|
1125
|
+
return Custom(initialState, {
|
|
1065
1126
|
render: handleRenderFloat(opts),
|
|
1066
1127
|
process: handleProcessFloat(opts),
|
|
1067
1128
|
clear: handleNumberClear(opts)
|
|
@@ -1074,7 +1135,7 @@ export const float = (options: FloatOptions): Prompt<number> => {
|
|
|
1074
1135
|
* @category constructors
|
|
1075
1136
|
* @since 4.0.0
|
|
1076
1137
|
*/
|
|
1077
|
-
export const
|
|
1138
|
+
export const Hidden = (
|
|
1078
1139
|
options: TextOptions
|
|
1079
1140
|
): Prompt<Redacted.Redacted> => basePrompt(options, "hidden").pipe(map(Redacted.make))
|
|
1080
1141
|
|
|
@@ -1089,11 +1150,11 @@ export const hidden = (
|
|
|
1089
1150
|
* @category constructors
|
|
1090
1151
|
* @since 4.0.0
|
|
1091
1152
|
*/
|
|
1092
|
-
export const
|
|
1093
|
-
const opts:
|
|
1153
|
+
export const Int = (options: IntOptions): Prompt<number> => {
|
|
1154
|
+
const opts: IntOptionsReq = {
|
|
1094
1155
|
default: 0,
|
|
1095
|
-
min: Number.NEGATIVE_INFINITY,
|
|
1096
|
-
max: Number.POSITIVE_INFINITY,
|
|
1156
|
+
min: globalThis.Number.NEGATIVE_INFINITY,
|
|
1157
|
+
max: globalThis.Number.POSITIVE_INFINITY,
|
|
1097
1158
|
incrementBy: 1,
|
|
1098
1159
|
decrementBy: 1,
|
|
1099
1160
|
validate: (n) => {
|
|
@@ -1105,8 +1166,7 @@ export const integer = (options: IntegerOptions): Prompt<number> => {
|
|
|
1105
1166
|
}
|
|
1106
1167
|
return Effect.succeed(n)
|
|
1107
1168
|
},
|
|
1108
|
-
...options
|
|
1109
|
-
prefix: options.prefix ?? DEFAULT_PREFIX
|
|
1169
|
+
...options
|
|
1110
1170
|
}
|
|
1111
1171
|
const initialValue = options.default === undefined ? "" : `${opts.default}`
|
|
1112
1172
|
const initialState: NumberState = {
|
|
@@ -1114,7 +1174,7 @@ export const integer = (options: IntegerOptions): Prompt<number> => {
|
|
|
1114
1174
|
value: initialValue,
|
|
1115
1175
|
error: Option.none()
|
|
1116
1176
|
}
|
|
1117
|
-
return
|
|
1177
|
+
return Custom(initialState, {
|
|
1118
1178
|
render: handleRenderInteger(opts),
|
|
1119
1179
|
process: handleProcessInteger(opts),
|
|
1120
1180
|
clear: handleNumberClear(opts)
|
|
@@ -1128,8 +1188,8 @@ export const integer = (options: IntegerOptions): Prompt<number> => {
|
|
|
1128
1188
|
* @category constructors
|
|
1129
1189
|
* @since 4.0.0
|
|
1130
1190
|
*/
|
|
1131
|
-
export const
|
|
1132
|
-
|
|
1191
|
+
export const List = (options: ListOptions): Prompt<Array<string>> =>
|
|
1192
|
+
String(options).pipe(
|
|
1133
1193
|
map((output) => output.split(options.delimiter || ","))
|
|
1134
1194
|
)
|
|
1135
1195
|
|
|
@@ -1166,7 +1226,7 @@ export const map: {
|
|
|
1166
1226
|
* @category constructors
|
|
1167
1227
|
* @since 4.0.0
|
|
1168
1228
|
*/
|
|
1169
|
-
export const
|
|
1229
|
+
export const Password = (
|
|
1170
1230
|
options: TextOptions
|
|
1171
1231
|
): Prompt<Redacted.Redacted> => basePrompt(options, "password").pipe(map(Redacted.make))
|
|
1172
1232
|
|
|
@@ -1205,7 +1265,7 @@ const getSelectInitialIndex = <A>(choices: ReadonlyArray<SelectChoice<A>>): numb
|
|
|
1205
1265
|
const choice = choices[i] as SelectChoice<A>
|
|
1206
1266
|
if (choice.selected === true) {
|
|
1207
1267
|
if (seenSelected !== -1) {
|
|
1208
|
-
throw new Error("InvalidArgumentException: only a single choice can be selected by default for Prompt.
|
|
1268
|
+
throw new Error("InvalidArgumentException: only a single choice can be selected by default for Prompt.Select")
|
|
1209
1269
|
}
|
|
1210
1270
|
seenSelected = i
|
|
1211
1271
|
}
|
|
@@ -1227,14 +1287,13 @@ const getSelectInitialIndex = <A>(choices: ReadonlyArray<SelectChoice<A>>): numb
|
|
|
1227
1287
|
* @category constructors
|
|
1228
1288
|
* @since 4.0.0
|
|
1229
1289
|
*/
|
|
1230
|
-
export const
|
|
1290
|
+
export const Select = <const A>(options: SelectOptions<A>): Prompt<A> => {
|
|
1231
1291
|
const opts: SelectOptionsReq<A> = {
|
|
1232
1292
|
maxPerPage: 10,
|
|
1233
|
-
...options
|
|
1234
|
-
prefix: options.prefix ?? DEFAULT_PREFIX
|
|
1293
|
+
...options
|
|
1235
1294
|
}
|
|
1236
1295
|
const initialIndex = getSelectInitialIndex(opts.choices)
|
|
1237
|
-
return
|
|
1296
|
+
return Custom(initialIndex, {
|
|
1238
1297
|
render: handleSelectRender(opts),
|
|
1239
1298
|
process: handleSelectProcess(opts),
|
|
1240
1299
|
clear: handleSelectClear(opts)
|
|
@@ -1244,12 +1303,18 @@ export const select = <const A>(options: SelectOptions<A>): Prompt<A> => {
|
|
|
1244
1303
|
/**
|
|
1245
1304
|
* Creates a prompt that lets users filter select choices by typing.
|
|
1246
1305
|
*
|
|
1306
|
+
* **Details**
|
|
1307
|
+
*
|
|
1308
|
+
* Every printable character is appended to the filter query, so navigation is
|
|
1309
|
+
* bound to the arrow keys, `tab`, and the `Ctrl+P` / `Ctrl+N` chords used by
|
|
1310
|
+
* `readline` and `fzf` (`Ctrl+K` also moves up). `Ctrl+U` clears the query.
|
|
1311
|
+
*
|
|
1247
1312
|
* **Example** (Filtering choices with autocomplete)
|
|
1248
1313
|
*
|
|
1249
1314
|
* ```ts import.meta.vitest
|
|
1250
1315
|
* import { Prompt } from "effect/unstable/cli"
|
|
1251
1316
|
*
|
|
1252
|
-
* const language = Prompt.
|
|
1317
|
+
* const language = Prompt.AutoComplete({
|
|
1253
1318
|
* message: "Choose a language",
|
|
1254
1319
|
* choices: [
|
|
1255
1320
|
* { title: "TypeScript", value: "ts" },
|
|
@@ -1264,14 +1329,13 @@ export const select = <const A>(options: SelectOptions<A>): Prompt<A> => {
|
|
|
1264
1329
|
* @category constructors
|
|
1265
1330
|
* @since 4.0.0
|
|
1266
1331
|
*/
|
|
1267
|
-
export const
|
|
1332
|
+
export const AutoComplete = <const A>(options: AutoCompleteOptions<A>): Prompt<A> => {
|
|
1268
1333
|
const opts: AutoCompleteOptionsReq<A> = {
|
|
1269
1334
|
maxPerPage: 10,
|
|
1270
1335
|
filterLabel: "filter",
|
|
1271
1336
|
filterPlaceholder: "type to filter",
|
|
1272
1337
|
emptyMessage: "No matches",
|
|
1273
|
-
...options
|
|
1274
|
-
prefix: options.prefix ?? DEFAULT_PREFIX
|
|
1338
|
+
...options
|
|
1275
1339
|
}
|
|
1276
1340
|
const initialIndex = getSelectInitialIndex(opts.choices)
|
|
1277
1341
|
const filtered = filterAutoCompleteChoices(opts.choices, "")
|
|
@@ -1285,7 +1349,7 @@ export const autoComplete = <const A>(options: AutoCompleteOptions<A>): Prompt<A
|
|
|
1285
1349
|
index,
|
|
1286
1350
|
filtered
|
|
1287
1351
|
}
|
|
1288
|
-
return
|
|
1352
|
+
return Custom(initialState, {
|
|
1289
1353
|
render: handleAutoCompleteRender(opts),
|
|
1290
1354
|
process: handleAutoCompleteProcess(opts),
|
|
1291
1355
|
clear: handleAutoCompleteClear(opts)
|
|
@@ -1304,13 +1368,12 @@ export const autoComplete = <const A>(options: AutoCompleteOptions<A>): Prompt<A
|
|
|
1304
1368
|
* @category constructors
|
|
1305
1369
|
* @since 4.0.0
|
|
1306
1370
|
*/
|
|
1307
|
-
export const
|
|
1371
|
+
export const MultiSelect = <const A>(
|
|
1308
1372
|
options: SelectOptions<A> & MultiSelectOptions
|
|
1309
1373
|
): Prompt<Array<A>> => {
|
|
1310
1374
|
const opts: SelectOptionsReq<A> & MultiSelectOptionsReq = {
|
|
1311
1375
|
maxPerPage: 10,
|
|
1312
|
-
...options
|
|
1313
|
-
prefix: options.prefix ?? DEFAULT_PREFIX
|
|
1376
|
+
...options
|
|
1314
1377
|
}
|
|
1315
1378
|
// Seed initial selection from choices marked as selected: true
|
|
1316
1379
|
const initialSelected = new Set<number>()
|
|
@@ -1321,7 +1384,7 @@ export const multiSelect = <const A>(
|
|
|
1321
1384
|
}
|
|
1322
1385
|
}
|
|
1323
1386
|
const initialState: MultiSelectState = { index: 0, selectedIndices: initialSelected, error: Option.none() }
|
|
1324
|
-
return
|
|
1387
|
+
return Custom(initialState, {
|
|
1325
1388
|
render: handleMultiSelectRender(opts),
|
|
1326
1389
|
process: handleMultiSelectProcess(opts),
|
|
1327
1390
|
clear: handleMultiSelectClear(opts)
|
|
@@ -1353,7 +1416,7 @@ export const succeed = <A>(value: A): Prompt<A> => {
|
|
|
1353
1416
|
* @category constructors
|
|
1354
1417
|
* @since 4.0.0
|
|
1355
1418
|
*/
|
|
1356
|
-
export const
|
|
1419
|
+
export const String = (
|
|
1357
1420
|
options: TextOptions
|
|
1358
1421
|
): Prompt<string> => basePrompt(options, "text")
|
|
1359
1422
|
|
|
@@ -1364,15 +1427,14 @@ export const text = (
|
|
|
1364
1427
|
* @category constructors
|
|
1365
1428
|
* @since 4.0.0
|
|
1366
1429
|
*/
|
|
1367
|
-
export const
|
|
1430
|
+
export const Toggle = (options: ToggleOptions): Prompt<boolean> => {
|
|
1368
1431
|
const opts: ToggleOptionsReq = {
|
|
1369
1432
|
initial: false,
|
|
1370
1433
|
active: "on",
|
|
1371
1434
|
inactive: "off",
|
|
1372
|
-
...options
|
|
1373
|
-
prefix: options.prefix ?? DEFAULT_PREFIX
|
|
1435
|
+
...options
|
|
1374
1436
|
}
|
|
1375
|
-
return
|
|
1437
|
+
return Custom(opts.initial, {
|
|
1376
1438
|
render: handleToggleRender(opts),
|
|
1377
1439
|
process: handleToggleProcess,
|
|
1378
1440
|
clear: () => handleToggleClear(opts)
|
|
@@ -1474,9 +1536,11 @@ const runLoop = Effect.fnUntraced(
|
|
|
1474
1536
|
) {
|
|
1475
1537
|
let state = Effect.isEffect(loop.initialState) ? yield* loop.initialState : loop.initialState
|
|
1476
1538
|
let action: Action<unknown, unknown> = Action.NextFrame({ state })
|
|
1539
|
+
let clear = ""
|
|
1477
1540
|
while (true) {
|
|
1478
1541
|
const msg = yield* loop.render(state, action)
|
|
1479
|
-
yield* Effect.orDie(terminal.display(msg))
|
|
1542
|
+
yield* Effect.orDie(terminal.display(clear + msg))
|
|
1543
|
+
clear = ""
|
|
1480
1544
|
if (loop.events) {
|
|
1481
1545
|
const takeInput = Queue.take(input).pipe(
|
|
1482
1546
|
Effect.map((input) => ({ _tag: "Input" as const, input }))
|
|
@@ -1494,14 +1558,14 @@ const runLoop = Effect.fnUntraced(
|
|
|
1494
1558
|
case "Beep":
|
|
1495
1559
|
continue
|
|
1496
1560
|
case "NextFrame": {
|
|
1497
|
-
|
|
1561
|
+
clear = yield* loop.clear(state, action)
|
|
1498
1562
|
state = action.state
|
|
1499
1563
|
continue
|
|
1500
1564
|
}
|
|
1501
1565
|
case "Submit": {
|
|
1502
|
-
|
|
1566
|
+
clear = yield* loop.clear(state, action)
|
|
1503
1567
|
const msg = yield* loop.render(state, action)
|
|
1504
|
-
yield* Effect.orDie(terminal.display(msg))
|
|
1568
|
+
yield* Effect.orDie(terminal.display(clear + msg))
|
|
1505
1569
|
return action.value
|
|
1506
1570
|
}
|
|
1507
1571
|
}
|
|
@@ -1546,7 +1610,7 @@ const clearOutputWithError = (outputText: string, columns: number, errorText?: s
|
|
|
1546
1610
|
return eraseText(outputText, columns)
|
|
1547
1611
|
}
|
|
1548
1612
|
|
|
1549
|
-
interface ConfirmOptionsReq extends
|
|
1613
|
+
interface ConfirmOptionsReq extends OptionsReq<ConfirmOptions> {}
|
|
1550
1614
|
|
|
1551
1615
|
interface ConfirmState {
|
|
1552
1616
|
readonly value: boolean
|
|
@@ -1560,13 +1624,13 @@ const handleConfirmClear = (options: ConfirmOptionsReq) => {
|
|
|
1560
1624
|
return Effect.fnUntraced(function*(state: ConfirmState, _: Action<ConfirmState, boolean>) {
|
|
1561
1625
|
const terminal = yield* Terminal.Terminal
|
|
1562
1626
|
const columns = yield* terminal.columns
|
|
1563
|
-
const figures = yield*
|
|
1627
|
+
const figures = yield* getTheme(options)
|
|
1564
1628
|
const confirmMessage = state.value
|
|
1565
1629
|
? options.placeholder.defaultConfirm!
|
|
1566
1630
|
: options.placeholder.defaultDeny!
|
|
1567
1631
|
const promptText = renderConfirmOutput(
|
|
1568
1632
|
confirmMessage,
|
|
1569
|
-
|
|
1633
|
+
figures.prefix,
|
|
1570
1634
|
figures.pointerSmall,
|
|
1571
1635
|
options,
|
|
1572
1636
|
{ plain: true }
|
|
@@ -1586,24 +1650,24 @@ const renderConfirmOutput = (
|
|
|
1586
1650
|
) => renderPrompt(confirm, options.message, leadingSymbol, trailingSymbol, renderOptions)
|
|
1587
1651
|
|
|
1588
1652
|
const renderConfirmNextFrame = Effect.fnUntraced(function*(state: ConfirmState, options: ConfirmOptionsReq) {
|
|
1589
|
-
const figures = yield*
|
|
1590
|
-
const leadingSymbol =
|
|
1591
|
-
const trailingSymbol =
|
|
1653
|
+
const figures = yield* getTheme(options)
|
|
1654
|
+
const leadingSymbol = annotateSymbol(figures.prefix, figures.primaryColor)
|
|
1655
|
+
const trailingSymbol = annotateSymbol(figures.pointerSmall, figures.mutedColor)
|
|
1592
1656
|
// Marking these explicitly as present with `!` because they always will be
|
|
1593
1657
|
// and there is really no value in adding a `DeepRequired` type helper just
|
|
1594
1658
|
// for these internal cases
|
|
1595
1659
|
const confirmMessage = state.value
|
|
1596
1660
|
? options.placeholder.defaultConfirm!
|
|
1597
1661
|
: options.placeholder.defaultDeny!
|
|
1598
|
-
const confirm = Ansi.annotate(confirmMessage,
|
|
1662
|
+
const confirm = Ansi.annotate(confirmMessage, figures.mutedColor)
|
|
1599
1663
|
const promptMsg = renderConfirmOutput(confirm, leadingSymbol, trailingSymbol, options)
|
|
1600
1664
|
return Ansi.cursorHide + promptMsg
|
|
1601
1665
|
})
|
|
1602
1666
|
|
|
1603
1667
|
const renderConfirmSubmission = Effect.fnUntraced(function*(value: boolean, options: ConfirmOptionsReq) {
|
|
1604
|
-
const figures = yield*
|
|
1605
|
-
const leadingSymbol =
|
|
1606
|
-
const trailingSymbol =
|
|
1668
|
+
const figures = yield* getTheme(options)
|
|
1669
|
+
const leadingSymbol = annotateSymbol(figures.tick, figures.successColor)
|
|
1670
|
+
const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor)
|
|
1607
1671
|
const confirmMessage = value ? options.label.confirm : options.label.deny
|
|
1608
1672
|
const promptMsg = renderConfirmOutput(confirmMessage, leadingSymbol, trailingSymbol, options)
|
|
1609
1673
|
return promptMsg + "\n"
|
|
@@ -1636,7 +1700,7 @@ const handleConfirmProcess = (input: Terminal.UserInput, defaultValue: boolean)
|
|
|
1636
1700
|
return Effect.succeed(Action.Beep())
|
|
1637
1701
|
}
|
|
1638
1702
|
|
|
1639
|
-
interface DateOptionsReq extends
|
|
1703
|
+
interface DateOptionsReq extends OptionsReq<DateOptions> {}
|
|
1640
1704
|
|
|
1641
1705
|
interface DateState {
|
|
1642
1706
|
readonly typed: string
|
|
@@ -1650,14 +1714,14 @@ const handleDateClear = (options: DateOptionsReq) => {
|
|
|
1650
1714
|
return Effect.fnUntraced(function*(state: DateState, _: Action<DateState, globalThis.Date>) {
|
|
1651
1715
|
const terminal = yield* Terminal.Terminal
|
|
1652
1716
|
const columns = yield* terminal.columns
|
|
1653
|
-
const figures = yield*
|
|
1717
|
+
const figures = yield* getTheme(options)
|
|
1654
1718
|
const resetCurrentLine = Ansi.eraseLine + Ansi.cursorLeft
|
|
1655
1719
|
const parts = Arr.reduce(state.dateParts, "", (doc, part) => doc + part.toString())
|
|
1656
|
-
const promptText = renderDateOutput(
|
|
1720
|
+
const promptText = renderDateOutput(figures.prefix, figures.pointerSmall, parts, options, { plain: true })
|
|
1657
1721
|
const errorText = Option.isSome(state.error)
|
|
1658
1722
|
? Arr.match(state.error.value.split(NEWLINE_REGEXP), {
|
|
1659
1723
|
onEmpty: () => "",
|
|
1660
|
-
onNonEmpty: (errorLines) =>
|
|
1724
|
+
onNonEmpty: (errorLines) => separateSymbol(figures.pointerSmall, errorLines.join("\n"))
|
|
1661
1725
|
})
|
|
1662
1726
|
: ""
|
|
1663
1727
|
const clearOutput = clearOutputWithError(promptText, columns, errorText)
|
|
@@ -1665,26 +1729,26 @@ const handleDateClear = (options: DateOptionsReq) => {
|
|
|
1665
1729
|
})
|
|
1666
1730
|
}
|
|
1667
1731
|
|
|
1668
|
-
const renderDateError = (state: DateState, pointer: string): string => {
|
|
1732
|
+
const renderDateError = (state: DateState, pointer: string, theme: Theme): string => {
|
|
1669
1733
|
if (Option.isSome(state.error)) {
|
|
1670
1734
|
const errorLines = state.error.value.split(NEWLINE_REGEXP)
|
|
1671
1735
|
if (Arr.isReadonlyArrayNonEmpty(errorLines)) {
|
|
1672
|
-
const prefix =
|
|
1673
|
-
const lines = Arr.map(errorLines, (str) => annotateErrorLine(str))
|
|
1674
|
-
return Ansi.cursorSavePosition + "\n" + prefix
|
|
1736
|
+
const prefix = annotateSymbol(pointer, theme.errorColor)
|
|
1737
|
+
const lines = Arr.map(errorLines, (str) => annotateErrorLine(str, theme.errorColor))
|
|
1738
|
+
return Ansi.cursorSavePosition + "\n" + separateSymbol(prefix, lines.join("\n")) + Ansi.cursorRestorePosition
|
|
1675
1739
|
}
|
|
1676
1740
|
}
|
|
1677
1741
|
return ""
|
|
1678
1742
|
}
|
|
1679
1743
|
|
|
1680
|
-
const renderParts = (state: DateState, submitted: boolean = false) => {
|
|
1744
|
+
const renderParts = (state: DateState, theme: Theme, submitted: boolean = false) => {
|
|
1681
1745
|
return Arr.reduce(
|
|
1682
1746
|
state.dateParts,
|
|
1683
1747
|
"",
|
|
1684
1748
|
(doc, part, currentIndex) => {
|
|
1685
1749
|
const partDoc = part.toString()
|
|
1686
1750
|
if (currentIndex === state.cursor && !submitted) {
|
|
1687
|
-
const annotation = Ansi.combine(Ansi.underlined,
|
|
1751
|
+
const annotation = Ansi.combine(Ansi.underlined, theme.primaryColor)
|
|
1688
1752
|
return doc + Ansi.annotate(partDoc, annotation)
|
|
1689
1753
|
}
|
|
1690
1754
|
return doc + partDoc
|
|
@@ -1701,20 +1765,20 @@ const renderDateOutput = (
|
|
|
1701
1765
|
) => renderPrompt(parts, options.message, leadingSymbol, trailingSymbol, renderOptions)
|
|
1702
1766
|
|
|
1703
1767
|
const renderDateNextFrame = Effect.fnUntraced(function*(state: DateState, options: DateOptionsReq) {
|
|
1704
|
-
const figures = yield*
|
|
1705
|
-
const leadingSymbol =
|
|
1706
|
-
const trailingSymbol =
|
|
1707
|
-
const parts = renderParts(state)
|
|
1768
|
+
const figures = yield* getTheme(options)
|
|
1769
|
+
const leadingSymbol = annotateSymbol(figures.prefix, figures.primaryColor)
|
|
1770
|
+
const trailingSymbol = annotateSymbol(figures.pointerSmall, figures.mutedColor)
|
|
1771
|
+
const parts = renderParts(state, figures)
|
|
1708
1772
|
const promptMsg = renderDateOutput(leadingSymbol, trailingSymbol, parts, options)
|
|
1709
|
-
const errorMsg = renderDateError(state, figures.pointerSmall)
|
|
1773
|
+
const errorMsg = renderDateError(state, figures.pointerSmall, figures)
|
|
1710
1774
|
return Ansi.cursorHide + promptMsg + errorMsg
|
|
1711
1775
|
})
|
|
1712
1776
|
|
|
1713
1777
|
const renderDateSubmission = Effect.fnUntraced(function*(state: DateState, options: DateOptionsReq) {
|
|
1714
|
-
const figures = yield*
|
|
1715
|
-
const leadingSymbol =
|
|
1716
|
-
const trailingSymbol =
|
|
1717
|
-
const parts = renderParts(state, true)
|
|
1778
|
+
const figures = yield* getTheme(options)
|
|
1779
|
+
const leadingSymbol = annotateSymbol(figures.tick, figures.successColor)
|
|
1780
|
+
const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor)
|
|
1781
|
+
const parts = renderParts(state, figures, true)
|
|
1718
1782
|
const promptMsg = renderDateOutput(leadingSymbol, trailingSymbol, parts, options)
|
|
1719
1783
|
return promptMsg + "\n"
|
|
1720
1784
|
})
|
|
@@ -1768,7 +1832,7 @@ const processDateNext = (state: DateState) => {
|
|
|
1768
1832
|
onSome: (next) => state.dateParts.indexOf(next)
|
|
1769
1833
|
})
|
|
1770
1834
|
return Action.NextFrame({
|
|
1771
|
-
state: { ...state, cursor }
|
|
1835
|
+
state: { ...state, typed: "", cursor }
|
|
1772
1836
|
})
|
|
1773
1837
|
}
|
|
1774
1838
|
|
|
@@ -1915,7 +1979,7 @@ abstract class DatePart {
|
|
|
1915
1979
|
constructor(params: DatePartParams) {
|
|
1916
1980
|
this.token = params.token
|
|
1917
1981
|
this.locales = params.locales
|
|
1918
|
-
this.date = params.date || new Date()
|
|
1982
|
+
this.date = params.date || new globalThis.Date()
|
|
1919
1983
|
this.parts = params.parts || [this]
|
|
1920
1984
|
}
|
|
1921
1985
|
|
|
@@ -1961,7 +2025,7 @@ abstract class DatePart {
|
|
|
1961
2025
|
}
|
|
1962
2026
|
|
|
1963
2027
|
toString() {
|
|
1964
|
-
return String(this.date)
|
|
2028
|
+
return globalThis.String(this.date)
|
|
1965
2029
|
}
|
|
1966
2030
|
}
|
|
1967
2031
|
|
|
@@ -1993,7 +2057,7 @@ class Milliseconds extends DatePart {
|
|
|
1993
2057
|
}
|
|
1994
2058
|
|
|
1995
2059
|
setValue(value: string): void {
|
|
1996
|
-
this.date.setMilliseconds(Number.parseInt(value.slice(-this.token.length)))
|
|
2060
|
+
this.date.setMilliseconds(globalThis.Number.parseInt(value.slice(-this.token.length)))
|
|
1997
2061
|
}
|
|
1998
2062
|
|
|
1999
2063
|
override toString() {
|
|
@@ -2012,7 +2076,7 @@ class Seconds extends DatePart {
|
|
|
2012
2076
|
}
|
|
2013
2077
|
|
|
2014
2078
|
setValue(value: string): void {
|
|
2015
|
-
this.date.setSeconds(Number.parseInt(value.slice(-2)))
|
|
2079
|
+
this.date.setSeconds(globalThis.Number.parseInt(value.slice(-2)))
|
|
2016
2080
|
}
|
|
2017
2081
|
|
|
2018
2082
|
override toString() {
|
|
@@ -2033,7 +2097,7 @@ class Minutes extends DatePart {
|
|
|
2033
2097
|
}
|
|
2034
2098
|
|
|
2035
2099
|
setValue(value: string): void {
|
|
2036
|
-
this.date.setMinutes(Number.parseInt(value.slice(-2)))
|
|
2100
|
+
this.date.setMinutes(globalThis.Number.parseInt(value.slice(-2)))
|
|
2037
2101
|
}
|
|
2038
2102
|
|
|
2039
2103
|
override toString() {
|
|
@@ -2054,7 +2118,7 @@ class Hours extends DatePart {
|
|
|
2054
2118
|
}
|
|
2055
2119
|
|
|
2056
2120
|
setValue(value: string): void {
|
|
2057
|
-
this.date.setHours(Number.parseInt(value.slice(-2)))
|
|
2121
|
+
this.date.setHours(globalThis.Number.parseInt(value.slice(-2)))
|
|
2058
2122
|
}
|
|
2059
2123
|
|
|
2060
2124
|
override toString() {
|
|
@@ -2077,7 +2141,7 @@ class Day extends DatePart {
|
|
|
2077
2141
|
}
|
|
2078
2142
|
|
|
2079
2143
|
setValue(value: string): void {
|
|
2080
|
-
this.date.setDate(Number.parseInt(value.slice(-2)))
|
|
2144
|
+
this.date.setDate(globalThis.Number.parseInt(value.slice(-2)))
|
|
2081
2145
|
}
|
|
2082
2146
|
|
|
2083
2147
|
override toString() {
|
|
@@ -2126,7 +2190,7 @@ class Month extends DatePart {
|
|
|
2126
2190
|
}
|
|
2127
2191
|
|
|
2128
2192
|
setValue(value: string): void {
|
|
2129
|
-
const month = Number.parseInt(value.slice(-2)) - 1
|
|
2193
|
+
const month = globalThis.Number.parseInt(value.slice(-2)) - 1
|
|
2130
2194
|
this.date.setMonth(month < 0 ? 0 : month)
|
|
2131
2195
|
}
|
|
2132
2196
|
|
|
@@ -2155,7 +2219,7 @@ class Year extends DatePart {
|
|
|
2155
2219
|
}
|
|
2156
2220
|
|
|
2157
2221
|
setValue(value: string): void {
|
|
2158
|
-
this.date.setFullYear(Number.parseInt(value.slice(-4)))
|
|
2222
|
+
this.date.setFullYear(globalThis.Number.parseInt(value.slice(-4)))
|
|
2159
2223
|
}
|
|
2160
2224
|
|
|
2161
2225
|
override toString() {
|
|
@@ -2185,7 +2249,7 @@ class Meridiem extends DatePart {
|
|
|
2185
2249
|
}
|
|
2186
2250
|
}
|
|
2187
2251
|
|
|
2188
|
-
interface FileOptionsReq extends
|
|
2252
|
+
interface FileOptionsReq extends OptionsReq<Omit<FileOptions, "startingPath" | "default">> {
|
|
2189
2253
|
readonly startingPath: Option.Option<string>
|
|
2190
2254
|
readonly default: Option.Option<string>
|
|
2191
2255
|
}
|
|
@@ -2196,20 +2260,20 @@ interface FileState {
|
|
|
2196
2260
|
readonly allFiles: ReadonlyArray<string>
|
|
2197
2261
|
readonly query: string
|
|
2198
2262
|
readonly path: Option.Option<string>
|
|
2199
|
-
readonly confirm:
|
|
2263
|
+
readonly confirm: FileConfirm
|
|
2200
2264
|
}
|
|
2201
2265
|
|
|
2202
2266
|
const CONFIRM_MESSAGE = "The selected directory contains files. Would you like to traverse the selected directory?"
|
|
2203
2267
|
const FILE_FILTER_LABEL = "filter"
|
|
2204
2268
|
const FILE_FILTER_PLACEHOLDER = "type to filter"
|
|
2205
2269
|
const FILE_EMPTY_MESSAGE = "No matches"
|
|
2206
|
-
type
|
|
2270
|
+
type FileConfirm = Data.TaggedEnum<{
|
|
2207
2271
|
readonly Show: {}
|
|
2208
2272
|
readonly Hide: {}
|
|
2209
2273
|
}>
|
|
2210
|
-
const
|
|
2274
|
+
const FileConfirm = Data.taggedEnum<FileConfirm>()
|
|
2211
2275
|
|
|
2212
|
-
const showConfirmation =
|
|
2276
|
+
const showConfirmation = FileConfirm.$is("Show")
|
|
2213
2277
|
|
|
2214
2278
|
const resolveCurrentPath = (
|
|
2215
2279
|
path: Option.Option<string>,
|
|
@@ -2296,17 +2360,23 @@ const handleFileClear = (options: FileOptionsReq) => {
|
|
|
2296
2360
|
const terminal = yield* Terminal.Terminal
|
|
2297
2361
|
const columns = yield* terminal.columns
|
|
2298
2362
|
const path = yield* Path.Path
|
|
2299
|
-
const figures = yield*
|
|
2363
|
+
const figures = yield* getTheme(options)
|
|
2300
2364
|
const currentPath = yield* resolveCurrentPath(state.path, options)
|
|
2301
2365
|
const selectedPath = state.files[state.cursor]
|
|
2302
2366
|
const resolvedPath = selectedPath === undefined ? currentPath : path.resolve(currentPath, selectedPath)
|
|
2303
|
-
const resolvedPathText =
|
|
2367
|
+
const resolvedPathText = separateSymbol(figures.pointerSmall, resolvedPath)
|
|
2304
2368
|
const isConfirming = showConfirmation(state.confirm)
|
|
2305
2369
|
const promptText = isConfirming
|
|
2306
|
-
? renderPrompt("(Y/n)", CONFIRM_MESSAGE,
|
|
2307
|
-
: renderPrompt(
|
|
2308
|
-
plain: true
|
|
2309
|
-
|
|
2370
|
+
? renderPrompt("(Y/n)", CONFIRM_MESSAGE, figures.prefix, figures.pointerSmall, { plain: true })
|
|
2371
|
+
: renderPrompt(
|
|
2372
|
+
renderFileFilter(state, figures, { plain: true }),
|
|
2373
|
+
options.message,
|
|
2374
|
+
figures.tick,
|
|
2375
|
+
figures.ellipsis,
|
|
2376
|
+
{
|
|
2377
|
+
plain: true
|
|
2378
|
+
}
|
|
2379
|
+
)
|
|
2310
2380
|
const filesText = isConfirming
|
|
2311
2381
|
? ""
|
|
2312
2382
|
: renderFiles(state, state.files, figures, options, { plain: true })
|
|
@@ -2330,15 +2400,27 @@ const renderPrompt = (
|
|
|
2330
2400
|
trailingSymbol: string,
|
|
2331
2401
|
options?: RenderOptions | undefined
|
|
2332
2402
|
) => {
|
|
2333
|
-
const prefix = leadingSymbol + " "
|
|
2403
|
+
const prefix = leadingSymbol.length === 0 ? "" : leadingSymbol + " "
|
|
2404
|
+
const renderLine = (line: string) => {
|
|
2405
|
+
let output = prefix + line
|
|
2406
|
+
if (trailingSymbol.length > 0) {
|
|
2407
|
+
output += " " + trailingSymbol
|
|
2408
|
+
}
|
|
2409
|
+
if (confirm.length > 0) {
|
|
2410
|
+
output += " " + confirm
|
|
2411
|
+
} else if (trailingSymbol.length > 0) {
|
|
2412
|
+
output += " "
|
|
2413
|
+
}
|
|
2414
|
+
return output
|
|
2415
|
+
}
|
|
2334
2416
|
const annotate = options?.plain === true
|
|
2335
2417
|
? (line: string) => line
|
|
2336
2418
|
: annotateLine
|
|
2337
2419
|
return Arr.match(message.split(NEWLINE_REGEXP), {
|
|
2338
|
-
onEmpty: () =>
|
|
2420
|
+
onEmpty: () => renderLine(""),
|
|
2339
2421
|
onNonEmpty: (promptLines) => {
|
|
2340
2422
|
const lines = Arr.map(promptLines, (line) => annotate(line))
|
|
2341
|
-
return
|
|
2423
|
+
return renderLine(lines.join("\n"))
|
|
2342
2424
|
}
|
|
2343
2425
|
})
|
|
2344
2426
|
}
|
|
@@ -2348,47 +2430,51 @@ const renderPrefix = (
|
|
|
2348
2430
|
toDisplay: { readonly startIndex: number; readonly endIndex: number },
|
|
2349
2431
|
currentIndex: number,
|
|
2350
2432
|
length: number,
|
|
2351
|
-
figures:
|
|
2433
|
+
figures: Theme,
|
|
2352
2434
|
renderOptions?: RenderOptions | undefined
|
|
2353
2435
|
) => {
|
|
2354
|
-
|
|
2355
|
-
|
|
2356
|
-
|
|
2357
|
-
|
|
2358
|
-
|
|
2359
|
-
}
|
|
2436
|
+
const prefix = renderPagingPrefix(
|
|
2437
|
+
figures,
|
|
2438
|
+
currentIndex === toDisplay.startIndex && toDisplay.startIndex > 0,
|
|
2439
|
+
currentIndex === toDisplay.endIndex - 1 && toDisplay.endIndex < length
|
|
2440
|
+
)
|
|
2360
2441
|
if (state.cursor === currentIndex) {
|
|
2361
2442
|
return renderOptions?.plain === true
|
|
2362
2443
|
? figures.pointer + prefix
|
|
2363
|
-
:
|
|
2444
|
+
: annotateSymbol(figures.pointer, figures.primaryColor) + prefix
|
|
2364
2445
|
}
|
|
2365
|
-
return prefix + " "
|
|
2446
|
+
return prefix + " ".repeat(figures.pointer.length)
|
|
2366
2447
|
}
|
|
2367
2448
|
|
|
2368
|
-
const renderFileName = (
|
|
2449
|
+
const renderFileName = (
|
|
2450
|
+
file: string,
|
|
2451
|
+
isSelected: boolean,
|
|
2452
|
+
theme: Theme,
|
|
2453
|
+
renderOptions?: RenderOptions | undefined
|
|
2454
|
+
) => {
|
|
2369
2455
|
if (renderOptions?.plain === true) {
|
|
2370
2456
|
return file
|
|
2371
2457
|
}
|
|
2372
2458
|
return isSelected
|
|
2373
|
-
? Ansi.annotate(file, Ansi.combine(Ansi.underlined,
|
|
2459
|
+
? Ansi.annotate(file, Ansi.combine(Ansi.underlined, theme.primaryColor))
|
|
2374
2460
|
: file
|
|
2375
2461
|
}
|
|
2376
2462
|
|
|
2377
|
-
const renderFileFilter = (state: FileState, renderOptions?: RenderOptions | undefined) => {
|
|
2463
|
+
const renderFileFilter = (state: FileState, theme: Theme, renderOptions?: RenderOptions | undefined) => {
|
|
2378
2464
|
const filterValue = state.query.length === 0
|
|
2379
2465
|
? renderOptions?.plain === true
|
|
2380
2466
|
? FILE_FILTER_PLACEHOLDER
|
|
2381
|
-
: Ansi.annotate(FILE_FILTER_PLACEHOLDER,
|
|
2467
|
+
: Ansi.annotate(FILE_FILTER_PLACEHOLDER, theme.mutedColor)
|
|
2382
2468
|
: renderOptions?.plain === true
|
|
2383
2469
|
? state.query
|
|
2384
|
-
: Ansi.annotate(state.query, Ansi.combine(Ansi.underlined,
|
|
2470
|
+
: Ansi.annotate(state.query, Ansi.combine(Ansi.underlined, theme.primaryColor))
|
|
2385
2471
|
return `[${FILE_FILTER_LABEL}: ${filterValue}]`
|
|
2386
2472
|
}
|
|
2387
2473
|
|
|
2388
2474
|
const renderFiles = (
|
|
2389
2475
|
state: FileState,
|
|
2390
2476
|
files: ReadonlyArray<string>,
|
|
2391
|
-
figures:
|
|
2477
|
+
figures: Theme,
|
|
2392
2478
|
options: FileOptionsReq,
|
|
2393
2479
|
renderOptions?: RenderOptions | undefined
|
|
2394
2480
|
) => {
|
|
@@ -2396,14 +2482,14 @@ const renderFiles = (
|
|
|
2396
2482
|
if (length === 0) {
|
|
2397
2483
|
return renderOptions?.plain === true
|
|
2398
2484
|
? FILE_EMPTY_MESSAGE
|
|
2399
|
-
: Ansi.annotate(FILE_EMPTY_MESSAGE,
|
|
2485
|
+
: Ansi.annotate(FILE_EMPTY_MESSAGE, figures.mutedColor)
|
|
2400
2486
|
}
|
|
2401
2487
|
const toDisplay = entriesToDisplay(state.cursor, length, options.maxPerPage)
|
|
2402
2488
|
const documents: Array<string> = []
|
|
2403
2489
|
for (let index = toDisplay.startIndex; index < toDisplay.endIndex; index++) {
|
|
2404
2490
|
const isSelected = state.cursor === index
|
|
2405
2491
|
const prefix = renderPrefix(state, toDisplay, index, length, figures, renderOptions)
|
|
2406
|
-
const fileName = renderFileName(files[index], isSelected, renderOptions)
|
|
2492
|
+
const fileName = renderFileName(files[index], isSelected, figures, renderOptions)
|
|
2407
2493
|
documents.push(prefix + fileName)
|
|
2408
2494
|
}
|
|
2409
2495
|
return documents.join("\n")
|
|
@@ -2411,32 +2497,32 @@ const renderFiles = (
|
|
|
2411
2497
|
|
|
2412
2498
|
const renderFileNextFrame = Effect.fnUntraced(function*(state: FileState, options: FileOptionsReq) {
|
|
2413
2499
|
const path = yield* Path.Path
|
|
2414
|
-
const figures = yield*
|
|
2500
|
+
const figures = yield* getTheme(options)
|
|
2415
2501
|
const currentPath = yield* resolveCurrentPath(state.path, options)
|
|
2416
2502
|
const selectedPath = state.files[state.cursor]
|
|
2417
2503
|
const resolvedPath = selectedPath === undefined ? currentPath : path.resolve(currentPath, selectedPath)
|
|
2418
|
-
const resolvedPathMsg = Ansi.annotate(figures.pointerSmall
|
|
2504
|
+
const resolvedPathMsg = Ansi.annotate(separateSymbol(figures.pointerSmall, resolvedPath), figures.mutedColor)
|
|
2419
2505
|
|
|
2420
2506
|
if (showConfirmation(state.confirm)) {
|
|
2421
|
-
const leadingSymbol =
|
|
2422
|
-
const trailingSymbol =
|
|
2423
|
-
const confirm = Ansi.annotate("(Y/n)",
|
|
2507
|
+
const leadingSymbol = annotateSymbol(figures.prefix, figures.primaryColor)
|
|
2508
|
+
const trailingSymbol = annotateSymbol(figures.pointerSmall, figures.mutedColor)
|
|
2509
|
+
const confirm = Ansi.annotate("(Y/n)", figures.mutedColor)
|
|
2424
2510
|
const promptMsg = renderPrompt(confirm, CONFIRM_MESSAGE, leadingSymbol, trailingSymbol)
|
|
2425
2511
|
return Ansi.cursorHide + promptMsg + "\n" + resolvedPathMsg
|
|
2426
2512
|
}
|
|
2427
|
-
const leadingSymbol =
|
|
2428
|
-
const trailingSymbol =
|
|
2429
|
-
const promptMsg = renderPrompt(renderFileFilter(state), options.message, leadingSymbol, trailingSymbol)
|
|
2513
|
+
const leadingSymbol = annotateSymbol(figures.tick, figures.successColor)
|
|
2514
|
+
const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor)
|
|
2515
|
+
const promptMsg = renderPrompt(renderFileFilter(state, figures), options.message, leadingSymbol, trailingSymbol)
|
|
2430
2516
|
const files = renderFiles(state, state.files, figures, options)
|
|
2431
2517
|
return Ansi.cursorHide + promptMsg + "\n" + resolvedPathMsg + "\n" + files
|
|
2432
2518
|
})
|
|
2433
2519
|
|
|
2434
2520
|
const renderFileSubmission = Effect.fnUntraced(function*(state: FileState, value: string, options: FileOptionsReq) {
|
|
2435
|
-
const figures = yield*
|
|
2436
|
-
const leadingSymbol =
|
|
2437
|
-
const trailingSymbol =
|
|
2438
|
-
const promptMsg = renderPrompt(renderFileFilter(state), options.message, leadingSymbol, trailingSymbol)
|
|
2439
|
-
return promptMsg + " " + Ansi.annotate(value,
|
|
2521
|
+
const figures = yield* getTheme(options)
|
|
2522
|
+
const leadingSymbol = annotateSymbol(figures.tick, figures.successColor)
|
|
2523
|
+
const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor)
|
|
2524
|
+
const promptMsg = renderPrompt(renderFileFilter(state, figures), options.message, leadingSymbol, trailingSymbol)
|
|
2525
|
+
return promptMsg + " " + Ansi.annotate(value, figures.submittedColor) + "\n"
|
|
2440
2526
|
})
|
|
2441
2527
|
|
|
2442
2528
|
const handleFileRender = (options: FileOptionsReq) => {
|
|
@@ -2512,7 +2598,7 @@ const processSelection = Effect.fnUntraced(function*(state: FileState, options:
|
|
|
2512
2598
|
? Action.Submit({ value: resolvedPath })
|
|
2513
2599
|
// Directory has contents - show confirmation to user
|
|
2514
2600
|
: Action.NextFrame({
|
|
2515
|
-
state: { ...state, confirm:
|
|
2601
|
+
state: { ...state, confirm: FileConfirm.Show() }
|
|
2516
2602
|
})
|
|
2517
2603
|
}
|
|
2518
2604
|
return Action.NextFrame({
|
|
@@ -2522,7 +2608,7 @@ const processSelection = Effect.fnUntraced(function*(state: FileState, options:
|
|
|
2522
2608
|
allFiles: files,
|
|
2523
2609
|
query: "",
|
|
2524
2610
|
path: Option.some(resolvedPath),
|
|
2525
|
-
confirm:
|
|
2611
|
+
confirm: FileConfirm.Hide()
|
|
2526
2612
|
}
|
|
2527
2613
|
})
|
|
2528
2614
|
}
|
|
@@ -2531,21 +2617,32 @@ const processSelection = Effect.fnUntraced(function*(state: FileState, options:
|
|
|
2531
2617
|
|
|
2532
2618
|
const handleFileProcess = (options: FileOptionsReq) => {
|
|
2533
2619
|
return Effect.fnUntraced(function*(input: Terminal.UserInput, state: FileState) {
|
|
2620
|
+
// Navigation is bound to ctrl chords rather than bare `j`/`k`, so that every
|
|
2621
|
+
// printable character reaches the filter input.
|
|
2534
2622
|
if (input.key.ctrl) {
|
|
2535
|
-
|
|
2536
|
-
|
|
2623
|
+
switch (input.key.name) {
|
|
2624
|
+
case "u": {
|
|
2625
|
+
if (showConfirmation(state.confirm)) {
|
|
2626
|
+
return Action.Beep()
|
|
2627
|
+
}
|
|
2628
|
+
return yield* processFileClear(state)
|
|
2629
|
+
}
|
|
2630
|
+
case "p":
|
|
2631
|
+
case "k": {
|
|
2632
|
+
return yield* processFileCursorUp(state)
|
|
2633
|
+
}
|
|
2634
|
+
case "n": {
|
|
2635
|
+
return yield* processFileCursorDown(state)
|
|
2636
|
+
}
|
|
2637
|
+
default: {
|
|
2537
2638
|
return Action.Beep()
|
|
2538
2639
|
}
|
|
2539
|
-
return yield* processFileClear(state)
|
|
2540
2640
|
}
|
|
2541
|
-
return Action.Beep()
|
|
2542
2641
|
}
|
|
2543
2642
|
switch (input.key.name) {
|
|
2544
|
-
case "k":
|
|
2545
2643
|
case "up": {
|
|
2546
2644
|
return yield* processFileCursorUp(state)
|
|
2547
2645
|
}
|
|
2548
|
-
case "j":
|
|
2549
2646
|
case "down":
|
|
2550
2647
|
case "tab": {
|
|
2551
2648
|
return yield* processFileCursorDown(state)
|
|
@@ -2575,7 +2672,7 @@ const handleFileProcess = (options: FileOptionsReq) => {
|
|
|
2575
2672
|
allFiles: files,
|
|
2576
2673
|
query: "",
|
|
2577
2674
|
path: Option.some(resolvedPath),
|
|
2578
|
-
confirm:
|
|
2675
|
+
confirm: FileConfirm.Hide()
|
|
2579
2676
|
}
|
|
2580
2677
|
})
|
|
2581
2678
|
}
|
|
@@ -2602,7 +2699,7 @@ const handleFileProcess = (options: FileOptionsReq) => {
|
|
|
2602
2699
|
})
|
|
2603
2700
|
}
|
|
2604
2701
|
|
|
2605
|
-
interface SelectOptionsReq<A> extends
|
|
2702
|
+
interface SelectOptionsReq<A> extends OptionsReq<SelectOptions<A>> {}
|
|
2606
2703
|
interface MultiSelectOptionsReq extends MultiSelectOptions {}
|
|
2607
2704
|
|
|
2608
2705
|
type MultiSelectState = {
|
|
@@ -2614,6 +2711,7 @@ type MultiSelectState = {
|
|
|
2614
2711
|
const renderMultiSelectError = (
|
|
2615
2712
|
state: MultiSelectState,
|
|
2616
2713
|
pointer: string,
|
|
2714
|
+
theme: Theme,
|
|
2617
2715
|
renderOptions?: RenderOptions | undefined
|
|
2618
2716
|
): string => {
|
|
2619
2717
|
if (Option.isSome(state.error)) {
|
|
@@ -2621,11 +2719,11 @@ const renderMultiSelectError = (
|
|
|
2621
2719
|
onEmpty: () => "",
|
|
2622
2720
|
onNonEmpty: (errorLines) => {
|
|
2623
2721
|
if (renderOptions?.plain === true) {
|
|
2624
|
-
return
|
|
2722
|
+
return separateSymbol(pointer, errorLines.join("\n"))
|
|
2625
2723
|
}
|
|
2626
|
-
const prefix =
|
|
2627
|
-
const lines = Arr.map(errorLines, (str) => annotateErrorLine(str))
|
|
2628
|
-
return Ansi.cursorSavePosition + "\n" + prefix
|
|
2724
|
+
const prefix = annotateSymbol(pointer, theme.errorColor)
|
|
2725
|
+
const lines = Arr.map(errorLines, (str) => annotateErrorLine(str, theme.errorColor))
|
|
2726
|
+
return Ansi.cursorSavePosition + "\n" + separateSymbol(prefix, lines.join("\n")) + Ansi.cursorRestorePosition
|
|
2629
2727
|
}
|
|
2630
2728
|
})
|
|
2631
2729
|
}
|
|
@@ -2635,12 +2733,14 @@ const renderMultiSelectError = (
|
|
|
2635
2733
|
const renderChoiceDescription = <A>(
|
|
2636
2734
|
choice: SelectChoice<A>,
|
|
2637
2735
|
isActive: boolean,
|
|
2736
|
+
theme: Theme,
|
|
2638
2737
|
renderOptions?: RenderOptions | undefined
|
|
2639
2738
|
) => {
|
|
2640
2739
|
if (!choice.disabled && choice.description && isActive) {
|
|
2740
|
+
const text = theme.descriptionSeparator + choice.description
|
|
2641
2741
|
return renderOptions?.plain === true
|
|
2642
|
-
?
|
|
2643
|
-
: Ansi.annotate(
|
|
2742
|
+
? text
|
|
2743
|
+
: Ansi.annotate(text, theme.mutedColor)
|
|
2644
2744
|
}
|
|
2645
2745
|
return ""
|
|
2646
2746
|
}
|
|
@@ -2650,21 +2750,23 @@ const metaOptionsCount = 2
|
|
|
2650
2750
|
const renderMultiSelectTitle = (
|
|
2651
2751
|
title: string,
|
|
2652
2752
|
isHighlighted: boolean,
|
|
2753
|
+
theme: Theme,
|
|
2653
2754
|
renderOptions?: RenderOptions | undefined
|
|
2654
2755
|
) => {
|
|
2655
2756
|
if (renderOptions?.plain === true || !isHighlighted) {
|
|
2656
2757
|
return title
|
|
2657
2758
|
}
|
|
2658
|
-
return Ansi.annotate(title, Ansi.combine(Ansi.underlined,
|
|
2759
|
+
return Ansi.annotate(title, Ansi.combine(Ansi.underlined, theme.primaryColor))
|
|
2659
2760
|
}
|
|
2660
2761
|
|
|
2661
2762
|
const renderMultiSelectChoices = <A>(
|
|
2662
2763
|
state: MultiSelectState,
|
|
2663
2764
|
options: SelectOptionsReq<A> & MultiSelectOptionsReq,
|
|
2664
|
-
figures:
|
|
2765
|
+
figures: Theme,
|
|
2665
2766
|
renderOptions?: RenderOptions | undefined
|
|
2666
2767
|
) => {
|
|
2667
2768
|
const choices = options.choices
|
|
2769
|
+
const checkboxWidth = Math.max(figures.checkboxOn.length, figures.checkboxOff.length)
|
|
2668
2770
|
const selectableCount = choices.filter((choice) => !choice.disabled).length
|
|
2669
2771
|
const selectedCount = Array.from(state.selectedIndices).filter((index) => !choices[index].disabled).length
|
|
2670
2772
|
const allSelected = selectedCount === selectableCount
|
|
@@ -2685,28 +2787,32 @@ const renderMultiSelectChoices = <A>(
|
|
|
2685
2787
|
for (let index = toDisplay.startIndex; index < toDisplay.endIndex; index++) {
|
|
2686
2788
|
const choice = allChoices[index]
|
|
2687
2789
|
const isHighlighted = state.index === index
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
|
|
2693
|
-
}
|
|
2790
|
+
const prefix = renderPagingPrefix(
|
|
2791
|
+
figures,
|
|
2792
|
+
index === toDisplay.startIndex && toDisplay.startIndex > 0,
|
|
2793
|
+
index === toDisplay.endIndex - 1 && toDisplay.endIndex < allChoices.length
|
|
2794
|
+
)
|
|
2694
2795
|
if (index < metaOptions.length) {
|
|
2695
2796
|
// Meta options
|
|
2696
|
-
const title = renderMultiSelectTitle(choice.title, isHighlighted, renderOptions)
|
|
2697
|
-
documents.push(prefix + " " + title)
|
|
2797
|
+
const title = renderMultiSelectTitle(choice.title, isHighlighted, figures, renderOptions)
|
|
2798
|
+
documents.push(prefix + (prefix.length === 0 ? "" : " ") + title)
|
|
2698
2799
|
} else {
|
|
2699
2800
|
// Regular choices
|
|
2700
2801
|
const choiceIndex = index - metaOptions.length
|
|
2701
2802
|
const isSelected = state.selectedIndices.has(choiceIndex)
|
|
2702
2803
|
const checkbox = isSelected ? figures.checkboxOn : figures.checkboxOff
|
|
2703
2804
|
const annotatedCheckbox = isHighlighted && renderOptions?.plain !== true
|
|
2704
|
-
? Ansi.annotate(checkbox,
|
|
2805
|
+
? Ansi.annotate(checkbox, figures.primaryColor)
|
|
2705
2806
|
: checkbox
|
|
2706
2807
|
const selectChoice = choice as SelectChoice<A>
|
|
2707
|
-
const title = renderChoiceTitle(selectChoice, isHighlighted, renderOptions)
|
|
2708
|
-
const description = renderChoiceDescription(selectChoice, isHighlighted, renderOptions)
|
|
2709
|
-
|
|
2808
|
+
const title = renderChoiceTitle(selectChoice, isHighlighted, figures, renderOptions)
|
|
2809
|
+
const description = renderChoiceDescription(selectChoice, isHighlighted, figures, renderOptions)
|
|
2810
|
+
const checkboxPrefix = checkboxWidth === 0
|
|
2811
|
+
? ""
|
|
2812
|
+
: annotatedCheckbox + " ".repeat(checkboxWidth - checkbox.length + 1)
|
|
2813
|
+
documents.push(
|
|
2814
|
+
prefix + (prefix.length === 0 ? "" : " ") + checkboxPrefix + title + " " + description
|
|
2815
|
+
)
|
|
2710
2816
|
}
|
|
2711
2817
|
}
|
|
2712
2818
|
return documents.join("\n")
|
|
@@ -2714,27 +2820,27 @@ const renderMultiSelectChoices = <A>(
|
|
|
2714
2820
|
|
|
2715
2821
|
const renderMultiSelectNextFrame = Effect.fnUntraced(
|
|
2716
2822
|
function*<A>(state: MultiSelectState, options: SelectOptionsReq<A>) {
|
|
2717
|
-
const figures = yield*
|
|
2823
|
+
const figures = yield* getTheme(options)
|
|
2718
2824
|
const choices = renderMultiSelectChoices(state, options, figures)
|
|
2719
|
-
const leadingSymbol =
|
|
2720
|
-
const trailingSymbol =
|
|
2825
|
+
const leadingSymbol = annotateSymbol(figures.prefix, figures.primaryColor)
|
|
2826
|
+
const trailingSymbol = annotateSymbol(figures.pointerSmall, figures.mutedColor)
|
|
2721
2827
|
const promptMsg = renderSelectOutput(leadingSymbol, trailingSymbol, options)
|
|
2722
|
-
const error = renderMultiSelectError(state, figures.pointer)
|
|
2828
|
+
const error = renderMultiSelectError(state, figures.pointer, figures)
|
|
2723
2829
|
return Ansi.cursorHide + promptMsg + "\n" + choices + error
|
|
2724
2830
|
}
|
|
2725
2831
|
)
|
|
2726
2832
|
|
|
2727
2833
|
const renderMultiSelectSubmission = Effect.fnUntraced(
|
|
2728
2834
|
function*<A>(state: MultiSelectState, options: SelectOptionsReq<A>) {
|
|
2729
|
-
const figures = yield*
|
|
2835
|
+
const figures = yield* getTheme(options)
|
|
2730
2836
|
const selectedChoices = Array.from(state.selectedIndices).sort(EffectNumber.Order).map((index) =>
|
|
2731
2837
|
options.choices[index].title
|
|
2732
2838
|
)
|
|
2733
2839
|
const selectedText = selectedChoices.join(", ")
|
|
2734
|
-
const leadingSymbol =
|
|
2735
|
-
const trailingSymbol =
|
|
2840
|
+
const leadingSymbol = annotateSymbol(figures.tick, figures.successColor)
|
|
2841
|
+
const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor)
|
|
2736
2842
|
const promptMsg = renderSelectOutput(leadingSymbol, trailingSymbol, options)
|
|
2737
|
-
return promptMsg + " " + Ansi.annotate(selectedText,
|
|
2843
|
+
return promptMsg + " " + Ansi.annotate(selectedText, figures.submittedColor) + "\n"
|
|
2738
2844
|
}
|
|
2739
2845
|
)
|
|
2740
2846
|
|
|
@@ -2790,11 +2896,11 @@ const handleMultiSelectClear = <A>(options: SelectOptionsReq<A>) =>
|
|
|
2790
2896
|
Effect.fnUntraced(function*(state: MultiSelectState, _: Action<MultiSelectState, Array<A>>) {
|
|
2791
2897
|
const terminal = yield* Terminal.Terminal
|
|
2792
2898
|
const columns = yield* terminal.columns
|
|
2793
|
-
const figures = yield*
|
|
2899
|
+
const figures = yield* getTheme(options)
|
|
2794
2900
|
const clearPrompt = Ansi.eraseLine + Ansi.cursorLeft
|
|
2795
|
-
const promptText = renderSelectOutput(
|
|
2901
|
+
const promptText = renderSelectOutput(figures.prefix, figures.pointerSmall, options, { plain: true })
|
|
2796
2902
|
const choicesText = renderMultiSelectChoices(state, options, figures, { plain: true })
|
|
2797
|
-
const errorText = renderMultiSelectError(state, figures.pointer, { plain: true })
|
|
2903
|
+
const errorText = renderMultiSelectError(state, figures.pointer, figures, { plain: true })
|
|
2798
2904
|
const clearOutput = clearOutputWithError(`${promptText}\n${choicesText}`, columns, errorText)
|
|
2799
2905
|
return clearOutput + clearPrompt
|
|
2800
2906
|
})
|
|
@@ -2849,8 +2955,8 @@ const handleMultiSelectRender = <A>(options: SelectOptionsReq<A>) => {
|
|
|
2849
2955
|
}
|
|
2850
2956
|
}
|
|
2851
2957
|
|
|
2852
|
-
interface
|
|
2853
|
-
interface
|
|
2958
|
+
interface IntOptionsReq extends OptionsReq<IntOptions> {}
|
|
2959
|
+
interface NumberOptionsReq extends OptionsReq<NumberOptions> {}
|
|
2854
2960
|
|
|
2855
2961
|
interface NumberState {
|
|
2856
2962
|
readonly cursor: number
|
|
@@ -2858,14 +2964,16 @@ interface NumberState {
|
|
|
2858
2964
|
readonly error: Option.Option<string>
|
|
2859
2965
|
}
|
|
2860
2966
|
|
|
2861
|
-
const handleNumberClear = (options:
|
|
2967
|
+
const handleNumberClear = (options: IntOptionsReq) => {
|
|
2862
2968
|
return Effect.fnUntraced(function*(state: NumberState, _: Action<NumberState, number>) {
|
|
2863
2969
|
const terminal = yield* Terminal.Terminal
|
|
2864
2970
|
const columns = yield* terminal.columns
|
|
2865
|
-
const figures = yield*
|
|
2971
|
+
const figures = yield* getTheme(options)
|
|
2866
2972
|
const resetCurrentLine = Ansi.eraseLine + Ansi.cursorLeft
|
|
2867
|
-
const errorText = renderNumberError(state, figures.pointerSmall, { plain: true })
|
|
2868
|
-
const promptText = renderNumberOutput(state,
|
|
2973
|
+
const errorText = renderNumberError(state, figures.pointerSmall, figures, { plain: true })
|
|
2974
|
+
const promptText = renderNumberOutput(state, figures.prefix, figures.pointerSmall, options, figures, {
|
|
2975
|
+
plain: true
|
|
2976
|
+
})
|
|
2869
2977
|
const clearOutput = clearOutputWithError(promptText, columns, errorText)
|
|
2870
2978
|
return clearOutput + resetCurrentLine
|
|
2871
2979
|
})
|
|
@@ -2874,6 +2982,7 @@ const handleNumberClear = (options: IntegerOptionsReq) => {
|
|
|
2874
2982
|
const renderNumberInput = (
|
|
2875
2983
|
state: NumberState,
|
|
2876
2984
|
submitted: boolean,
|
|
2985
|
+
theme: Theme,
|
|
2877
2986
|
renderOptions?: RenderOptions | undefined
|
|
2878
2987
|
): string => {
|
|
2879
2988
|
const value = state.value === "" ? "" : `${state.value}`
|
|
@@ -2881,14 +2990,15 @@ const renderNumberInput = (
|
|
|
2881
2990
|
return value
|
|
2882
2991
|
}
|
|
2883
2992
|
const annotation = Option.isSome(state.error) ?
|
|
2884
|
-
|
|
2885
|
-
Ansi.combine(Ansi.underlined,
|
|
2993
|
+
theme.errorColor :
|
|
2994
|
+
Ansi.combine(Ansi.underlined, theme.primaryColor)
|
|
2886
2995
|
return Ansi.annotate(value, annotation)
|
|
2887
2996
|
}
|
|
2888
2997
|
|
|
2889
2998
|
const renderNumberError = (
|
|
2890
2999
|
state: NumberState,
|
|
2891
3000
|
pointer: string,
|
|
3001
|
+
theme: Theme,
|
|
2892
3002
|
renderOptions?: RenderOptions | undefined
|
|
2893
3003
|
) => {
|
|
2894
3004
|
if (Option.isSome(state.error)) {
|
|
@@ -2896,11 +3006,11 @@ const renderNumberError = (
|
|
|
2896
3006
|
onEmpty: () => "",
|
|
2897
3007
|
onNonEmpty: (errorLines) => {
|
|
2898
3008
|
if (renderOptions?.plain === true) {
|
|
2899
|
-
return
|
|
3009
|
+
return separateSymbol(pointer, errorLines.join("\n"))
|
|
2900
3010
|
}
|
|
2901
|
-
const prefix =
|
|
2902
|
-
const lines = Arr.map(errorLines, (str) => annotateErrorLine(str))
|
|
2903
|
-
return Ansi.cursorSavePosition + "\n" + prefix
|
|
3011
|
+
const prefix = annotateSymbol(pointer, theme.errorColor)
|
|
3012
|
+
const lines = Arr.map(errorLines, (str) => annotateErrorLine(str, theme.errorColor))
|
|
3013
|
+
return Ansi.cursorSavePosition + "\n" + separateSymbol(prefix, lines.join("\n")) + Ansi.cursorRestorePosition
|
|
2904
3014
|
}
|
|
2905
3015
|
})
|
|
2906
3016
|
}
|
|
@@ -2911,28 +3021,29 @@ const renderNumberOutput = (
|
|
|
2911
3021
|
state: NumberState,
|
|
2912
3022
|
leadingSymbol: string,
|
|
2913
3023
|
trailingSymbol: string,
|
|
2914
|
-
options:
|
|
3024
|
+
options: IntOptionsReq,
|
|
3025
|
+
theme: Theme,
|
|
2915
3026
|
renderOptions?: RenderOptions | undefined,
|
|
2916
3027
|
submitted: boolean = false
|
|
2917
3028
|
) => {
|
|
2918
|
-
const value = renderNumberInput(state, submitted, renderOptions)
|
|
3029
|
+
const value = renderNumberInput(state, submitted, theme, renderOptions)
|
|
2919
3030
|
return renderPrompt(value, options.message, leadingSymbol, trailingSymbol, renderOptions)
|
|
2920
3031
|
}
|
|
2921
3032
|
|
|
2922
|
-
const renderNumberNextFrame = Effect.fnUntraced(function*(state: NumberState, options:
|
|
2923
|
-
const figures = yield*
|
|
2924
|
-
const leadingSymbol =
|
|
2925
|
-
const trailingSymbol =
|
|
2926
|
-
const errorMsg = renderNumberError(state, figures.pointerSmall)
|
|
2927
|
-
const promptMsg = renderNumberOutput(state, leadingSymbol, trailingSymbol, options)
|
|
3033
|
+
const renderNumberNextFrame = Effect.fnUntraced(function*(state: NumberState, options: IntOptionsReq) {
|
|
3034
|
+
const figures = yield* getTheme(options)
|
|
3035
|
+
const leadingSymbol = annotateSymbol(figures.prefix, figures.primaryColor)
|
|
3036
|
+
const trailingSymbol = annotateSymbol(figures.pointerSmall, figures.mutedColor)
|
|
3037
|
+
const errorMsg = renderNumberError(state, figures.pointerSmall, figures)
|
|
3038
|
+
const promptMsg = renderNumberOutput(state, leadingSymbol, trailingSymbol, options, figures)
|
|
2928
3039
|
return promptMsg + errorMsg
|
|
2929
3040
|
})
|
|
2930
3041
|
|
|
2931
|
-
const renderNumberSubmission = Effect.fnUntraced(function*(nextState: NumberState, options:
|
|
2932
|
-
const figures = yield*
|
|
2933
|
-
const leadingSymbol =
|
|
2934
|
-
const trailingSymbol =
|
|
2935
|
-
const promptMsg = renderNumberOutput(nextState, leadingSymbol, trailingSymbol, options, undefined, true)
|
|
3042
|
+
const renderNumberSubmission = Effect.fnUntraced(function*(nextState: NumberState, options: IntOptionsReq) {
|
|
3043
|
+
const figures = yield* getTheme(options)
|
|
3044
|
+
const leadingSymbol = annotateSymbol(figures.tick, figures.successColor)
|
|
3045
|
+
const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor)
|
|
3046
|
+
const promptMsg = renderNumberOutput(nextState, leadingSymbol, trailingSymbol, options, figures, undefined, true)
|
|
2936
3047
|
return promptMsg + "\n"
|
|
2937
3048
|
})
|
|
2938
3049
|
|
|
@@ -2958,8 +3069,8 @@ const defaultIntProcessor = (input: string, state: NumberState) => {
|
|
|
2958
3069
|
}))
|
|
2959
3070
|
}
|
|
2960
3071
|
|
|
2961
|
-
const parsed = Number.parseInt(state.value + input)
|
|
2962
|
-
if (Number.isNaN(parsed)) {
|
|
3072
|
+
const parsed = globalThis.Number.parseInt(state.value + input)
|
|
3073
|
+
if (globalThis.Number.isNaN(parsed)) {
|
|
2963
3074
|
return Effect.succeed(Action.Beep())
|
|
2964
3075
|
} else {
|
|
2965
3076
|
return Effect.succeed(Action.NextFrame({
|
|
@@ -2978,8 +3089,8 @@ const defaultFloatProcessor = (input: string, state: NumberState) => {
|
|
|
2978
3089
|
}))
|
|
2979
3090
|
}
|
|
2980
3091
|
|
|
2981
|
-
const parsed = Number.parseFloat(state.value + input)
|
|
2982
|
-
if (Number.isNaN(parsed)) {
|
|
3092
|
+
const parsed = globalThis.Number.parseFloat(state.value + input)
|
|
3093
|
+
if (globalThis.Number.isNaN(parsed)) {
|
|
2983
3094
|
return Effect.succeed(Action.Beep())
|
|
2984
3095
|
} else {
|
|
2985
3096
|
return Effect.succeed(Action.NextFrame({
|
|
@@ -2996,7 +3107,7 @@ const defaultFloatProcessor = (input: string, state: NumberState) => {
|
|
|
2996
3107
|
}
|
|
2997
3108
|
}
|
|
2998
3109
|
|
|
2999
|
-
const handleRenderInteger = (options:
|
|
3110
|
+
const handleRenderInteger = (options: IntOptionsReq) => {
|
|
3000
3111
|
return (state: NumberState, action: Action<NumberState, number>) => {
|
|
3001
3112
|
return Action.$match(action, {
|
|
3002
3113
|
Beep: () => Effect.succeed(renderBeep),
|
|
@@ -3006,7 +3117,7 @@ const handleRenderInteger = (options: IntegerOptionsReq) => {
|
|
|
3006
3117
|
}
|
|
3007
3118
|
}
|
|
3008
3119
|
|
|
3009
|
-
const handleProcessInteger = (options:
|
|
3120
|
+
const handleProcessInteger = (options: IntOptionsReq) => {
|
|
3010
3121
|
return (input: Terminal.UserInput, state: NumberState) => {
|
|
3011
3122
|
if (input.key.ctrl && input.key.name === "u") {
|
|
3012
3123
|
return processNumberClear(state)
|
|
@@ -3022,7 +3133,7 @@ const handleProcessInteger = (options: IntegerOptionsReq) => {
|
|
|
3022
3133
|
...state,
|
|
3023
3134
|
value: state.value === "" || state.value === "-"
|
|
3024
3135
|
? `${options.incrementBy}`
|
|
3025
|
-
: `${Number.parseInt(state.value) + options.incrementBy}`,
|
|
3136
|
+
: `${globalThis.Number.parseInt(state.value) + options.incrementBy}`,
|
|
3026
3137
|
error: Option.none()
|
|
3027
3138
|
}
|
|
3028
3139
|
}))
|
|
@@ -3034,15 +3145,15 @@ const handleProcessInteger = (options: IntegerOptionsReq) => {
|
|
|
3034
3145
|
...state,
|
|
3035
3146
|
value: state.value === "" || state.value === "-"
|
|
3036
3147
|
? `-${options.decrementBy}`
|
|
3037
|
-
: `${Number.parseInt(state.value) - options.decrementBy}`,
|
|
3148
|
+
: `${globalThis.Number.parseInt(state.value) - options.decrementBy}`,
|
|
3038
3149
|
error: Option.none()
|
|
3039
3150
|
}
|
|
3040
3151
|
}))
|
|
3041
3152
|
}
|
|
3042
3153
|
case "enter":
|
|
3043
3154
|
case "return": {
|
|
3044
|
-
const parsed = Number.parseInt(state.value)
|
|
3045
|
-
if (Number.isNaN(parsed)) {
|
|
3155
|
+
const parsed = globalThis.Number.parseInt(state.value)
|
|
3156
|
+
if (globalThis.Number.isNaN(parsed)) {
|
|
3046
3157
|
return Effect.succeed(Action.NextFrame({
|
|
3047
3158
|
state: {
|
|
3048
3159
|
...state,
|
|
@@ -3069,7 +3180,7 @@ const handleProcessInteger = (options: IntegerOptionsReq) => {
|
|
|
3069
3180
|
}
|
|
3070
3181
|
}
|
|
3071
3182
|
|
|
3072
|
-
const handleRenderFloat = (options:
|
|
3183
|
+
const handleRenderFloat = (options: NumberOptionsReq) => {
|
|
3073
3184
|
return (state: NumberState, action: Action<NumberState, number>) => {
|
|
3074
3185
|
return Action.$match(action, {
|
|
3075
3186
|
Beep: () => Effect.succeed(renderBeep),
|
|
@@ -3079,7 +3190,7 @@ const handleRenderFloat = (options: FloatOptionsReq) => {
|
|
|
3079
3190
|
}
|
|
3080
3191
|
}
|
|
3081
3192
|
|
|
3082
|
-
const handleProcessFloat = (options:
|
|
3193
|
+
const handleProcessFloat = (options: NumberOptionsReq) => {
|
|
3083
3194
|
return (input: Terminal.UserInput, state: NumberState) => {
|
|
3084
3195
|
if (input.key.ctrl && input.key.name === "u") {
|
|
3085
3196
|
return processNumberClear(state)
|
|
@@ -3095,7 +3206,7 @@ const handleProcessFloat = (options: FloatOptionsReq) => {
|
|
|
3095
3206
|
...state,
|
|
3096
3207
|
value: state.value === "" || state.value === "-"
|
|
3097
3208
|
? `${options.incrementBy}`
|
|
3098
|
-
: `${Number.parseFloat(state.value) + options.incrementBy}`,
|
|
3209
|
+
: `${globalThis.Number.parseFloat(state.value) + options.incrementBy}`,
|
|
3099
3210
|
error: Option.none()
|
|
3100
3211
|
}
|
|
3101
3212
|
}))
|
|
@@ -3107,15 +3218,15 @@ const handleProcessFloat = (options: FloatOptionsReq) => {
|
|
|
3107
3218
|
...state,
|
|
3108
3219
|
value: state.value === "" || state.value === "-"
|
|
3109
3220
|
? `-${options.decrementBy}`
|
|
3110
|
-
: `${Number.parseFloat(state.value) - options.decrementBy}`,
|
|
3221
|
+
: `${globalThis.Number.parseFloat(state.value) - options.decrementBy}`,
|
|
3111
3222
|
error: Option.none()
|
|
3112
3223
|
}
|
|
3113
3224
|
}))
|
|
3114
3225
|
}
|
|
3115
3226
|
case "enter":
|
|
3116
3227
|
case "return": {
|
|
3117
|
-
const parsed = Number.parseFloat(state.value)
|
|
3118
|
-
if (Number.isNaN(parsed)) {
|
|
3228
|
+
const parsed = globalThis.Number.parseFloat(state.value)
|
|
3229
|
+
if (globalThis.Number.isNaN(parsed)) {
|
|
3119
3230
|
return Effect.succeed(Action.NextFrame({
|
|
3120
3231
|
state: {
|
|
3121
3232
|
...state,
|
|
@@ -3154,8 +3265,8 @@ type AutoCompleteState = {
|
|
|
3154
3265
|
readonly filtered: ReadonlyArray<number>
|
|
3155
3266
|
}
|
|
3156
3267
|
|
|
3157
|
-
interface SelectOptionsReq<A> extends
|
|
3158
|
-
interface AutoCompleteOptionsReq<A> extends
|
|
3268
|
+
interface SelectOptionsReq<A> extends OptionsReq<SelectOptions<A>> {}
|
|
3269
|
+
interface AutoCompleteOptionsReq<A> extends OptionsReq<AutoCompleteOptions<A>> {}
|
|
3159
3270
|
|
|
3160
3271
|
const filterAutoCompleteChoices = <A>(choices: ReadonlyArray<SelectChoice<A>>, query: string) => {
|
|
3161
3272
|
const normalizedQuery = query.toLowerCase()
|
|
@@ -3196,15 +3307,16 @@ const renderSelectOutput = <A>(
|
|
|
3196
3307
|
const renderAutoCompleteFilter = <A>(
|
|
3197
3308
|
state: AutoCompleteState,
|
|
3198
3309
|
options: AutoCompleteOptionsReq<A>,
|
|
3310
|
+
theme: Theme,
|
|
3199
3311
|
renderOptions?: RenderOptions | undefined
|
|
3200
3312
|
) => {
|
|
3201
3313
|
const filterValue = state.query.length === 0
|
|
3202
3314
|
? renderOptions?.plain === true
|
|
3203
3315
|
? options.filterPlaceholder
|
|
3204
|
-
: Ansi.annotate(options.filterPlaceholder,
|
|
3316
|
+
: Ansi.annotate(options.filterPlaceholder, theme.mutedColor)
|
|
3205
3317
|
: renderOptions?.plain === true
|
|
3206
3318
|
? state.query
|
|
3207
|
-
: Ansi.annotate(state.query, Ansi.combine(Ansi.underlined,
|
|
3319
|
+
: Ansi.annotate(state.query, Ansi.combine(Ansi.underlined, theme.primaryColor))
|
|
3208
3320
|
return `[${options.filterLabel}: ${filterValue}]`
|
|
3209
3321
|
}
|
|
3210
3322
|
|
|
@@ -3213,9 +3325,10 @@ const renderAutoCompleteOutput = <A>(
|
|
|
3213
3325
|
leadingSymbol: string,
|
|
3214
3326
|
trailingSymbol: string,
|
|
3215
3327
|
options: AutoCompleteOptionsReq<A>,
|
|
3328
|
+
theme: Theme,
|
|
3216
3329
|
renderOptions?: RenderOptions | undefined
|
|
3217
3330
|
) => {
|
|
3218
|
-
const filter = renderAutoCompleteFilter(state, options, renderOptions)
|
|
3331
|
+
const filter = renderAutoCompleteFilter(state, options, theme, renderOptions)
|
|
3219
3332
|
return renderPrompt(filter, options.message, leadingSymbol, trailingSymbol, renderOptions)
|
|
3220
3333
|
}
|
|
3221
3334
|
|
|
@@ -3224,29 +3337,28 @@ const renderChoicePrefix = <A>(
|
|
|
3224
3337
|
choices: SelectOptionsReq<A>["choices"],
|
|
3225
3338
|
toDisplay: { readonly startIndex: number; readonly endIndex: number },
|
|
3226
3339
|
currentIndex: number,
|
|
3227
|
-
figures:
|
|
3340
|
+
figures: Theme,
|
|
3228
3341
|
renderOptions?: RenderOptions | undefined
|
|
3229
3342
|
) => {
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
}
|
|
3343
|
+
const prefix = renderPagingPrefix(
|
|
3344
|
+
figures,
|
|
3345
|
+
currentIndex === toDisplay.startIndex && toDisplay.startIndex > 0,
|
|
3346
|
+
currentIndex === toDisplay.endIndex - 1 && toDisplay.endIndex < choices.length
|
|
3347
|
+
)
|
|
3236
3348
|
if (renderOptions?.plain === true) {
|
|
3237
3349
|
return state === currentIndex
|
|
3238
3350
|
? figures.pointer + prefix
|
|
3239
|
-
: prefix + " "
|
|
3351
|
+
: prefix + " ".repeat(figures.pointer.length)
|
|
3240
3352
|
}
|
|
3241
3353
|
if (choices[currentIndex].disabled) {
|
|
3242
|
-
const annotation = Ansi.combine(Ansi.bold,
|
|
3354
|
+
const annotation = Ansi.combine(Ansi.bold, figures.mutedColor)
|
|
3243
3355
|
return state === currentIndex
|
|
3244
|
-
?
|
|
3245
|
-
: prefix + " "
|
|
3356
|
+
? annotateSymbol(figures.pointer, annotation) + prefix
|
|
3357
|
+
: prefix + " ".repeat(figures.pointer.length)
|
|
3246
3358
|
}
|
|
3247
3359
|
return state === currentIndex
|
|
3248
|
-
?
|
|
3249
|
-
: prefix + " "
|
|
3360
|
+
? annotateSymbol(figures.pointer, figures.primaryColor) + prefix
|
|
3361
|
+
: prefix + " ".repeat(figures.pointer.length)
|
|
3250
3362
|
}
|
|
3251
3363
|
|
|
3252
3364
|
const renderAutoCompleteChoicePrefix = <A>(
|
|
@@ -3254,36 +3366,36 @@ const renderAutoCompleteChoicePrefix = <A>(
|
|
|
3254
3366
|
options: AutoCompleteOptionsReq<A>,
|
|
3255
3367
|
toDisplay: { readonly startIndex: number; readonly endIndex: number },
|
|
3256
3368
|
currentIndex: number,
|
|
3257
|
-
figures:
|
|
3369
|
+
figures: Theme,
|
|
3258
3370
|
renderOptions?: RenderOptions | undefined
|
|
3259
3371
|
) => {
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
}
|
|
3372
|
+
const prefix = renderPagingPrefix(
|
|
3373
|
+
figures,
|
|
3374
|
+
currentIndex === toDisplay.startIndex && toDisplay.startIndex > 0,
|
|
3375
|
+
currentIndex === toDisplay.endIndex - 1 && toDisplay.endIndex < state.filtered.length
|
|
3376
|
+
)
|
|
3266
3377
|
const choiceIndex = state.filtered[currentIndex]
|
|
3267
3378
|
if (renderOptions?.plain === true) {
|
|
3268
3379
|
return state.index === choiceIndex
|
|
3269
3380
|
? figures.pointer + prefix
|
|
3270
|
-
: prefix + " "
|
|
3381
|
+
: prefix + " ".repeat(figures.pointer.length)
|
|
3271
3382
|
}
|
|
3272
3383
|
const choice = options.choices[choiceIndex]
|
|
3273
3384
|
if (choice.disabled) {
|
|
3274
|
-
const annotation = Ansi.combine(Ansi.bold,
|
|
3385
|
+
const annotation = Ansi.combine(Ansi.bold, figures.mutedColor)
|
|
3275
3386
|
return state.index === choiceIndex
|
|
3276
|
-
?
|
|
3277
|
-
: prefix + " "
|
|
3387
|
+
? annotateSymbol(figures.pointer, annotation) + prefix
|
|
3388
|
+
: prefix + " ".repeat(figures.pointer.length)
|
|
3278
3389
|
}
|
|
3279
3390
|
return state.index === choiceIndex
|
|
3280
|
-
?
|
|
3281
|
-
: prefix + " "
|
|
3391
|
+
? annotateSymbol(figures.pointer, figures.primaryColor) + prefix
|
|
3392
|
+
: prefix + " ".repeat(figures.pointer.length)
|
|
3282
3393
|
}
|
|
3283
3394
|
|
|
3284
3395
|
const renderChoiceTitle = <A>(
|
|
3285
3396
|
choice: SelectChoice<A>,
|
|
3286
3397
|
isSelected: boolean,
|
|
3398
|
+
theme: Theme,
|
|
3287
3399
|
renderOptions?: RenderOptions | undefined
|
|
3288
3400
|
) => {
|
|
3289
3401
|
if (renderOptions?.plain === true) {
|
|
@@ -3292,18 +3404,18 @@ const renderChoiceTitle = <A>(
|
|
|
3292
3404
|
const title = choice.title
|
|
3293
3405
|
if (isSelected) {
|
|
3294
3406
|
return choice.disabled
|
|
3295
|
-
? Ansi.annotate(title, Ansi.combine(Ansi.underlined,
|
|
3296
|
-
: Ansi.annotate(title, Ansi.combine(Ansi.underlined,
|
|
3407
|
+
? Ansi.annotate(title, Ansi.combine(Ansi.underlined, theme.mutedColor))
|
|
3408
|
+
: Ansi.annotate(title, Ansi.combine(Ansi.underlined, theme.primaryColor))
|
|
3297
3409
|
}
|
|
3298
3410
|
return choice.disabled
|
|
3299
|
-
? Ansi.annotate(title, Ansi.combine(Ansi.strikethrough,
|
|
3411
|
+
? Ansi.annotate(title, Ansi.combine(Ansi.strikethrough, theme.mutedColor))
|
|
3300
3412
|
: title
|
|
3301
3413
|
}
|
|
3302
3414
|
|
|
3303
3415
|
const renderSelectChoices = <A>(
|
|
3304
3416
|
state: SelectState,
|
|
3305
3417
|
options: SelectOptionsReq<A>,
|
|
3306
|
-
figures:
|
|
3418
|
+
figures: Theme,
|
|
3307
3419
|
renderOptions?: RenderOptions | undefined
|
|
3308
3420
|
) => {
|
|
3309
3421
|
const choices = options.choices
|
|
@@ -3313,8 +3425,8 @@ const renderSelectChoices = <A>(
|
|
|
3313
3425
|
const choice = choices[index]
|
|
3314
3426
|
const isSelected = state === index
|
|
3315
3427
|
const prefix = renderChoicePrefix(state, choices, toDisplay, index, figures, renderOptions)
|
|
3316
|
-
const title = renderChoiceTitle(choice, isSelected, renderOptions)
|
|
3317
|
-
const description = renderChoiceDescription(choice, isSelected, renderOptions)
|
|
3428
|
+
const title = renderChoiceTitle(choice, isSelected, figures, renderOptions)
|
|
3429
|
+
const description = renderChoiceDescription(choice, isSelected, figures, renderOptions)
|
|
3318
3430
|
documents.push(prefix + title + " " + description)
|
|
3319
3431
|
}
|
|
3320
3432
|
return documents.join("\n")
|
|
@@ -3323,13 +3435,13 @@ const renderSelectChoices = <A>(
|
|
|
3323
3435
|
const renderAutoCompleteChoices = <A>(
|
|
3324
3436
|
state: AutoCompleteState,
|
|
3325
3437
|
options: AutoCompleteOptionsReq<A>,
|
|
3326
|
-
figures:
|
|
3438
|
+
figures: Theme,
|
|
3327
3439
|
renderOptions?: RenderOptions | undefined
|
|
3328
3440
|
) => {
|
|
3329
3441
|
if (state.filtered.length === 0) {
|
|
3330
3442
|
return renderOptions?.plain === true
|
|
3331
3443
|
? options.emptyMessage
|
|
3332
|
-
: Ansi.annotate(options.emptyMessage,
|
|
3444
|
+
: Ansi.annotate(options.emptyMessage, figures.mutedColor)
|
|
3333
3445
|
}
|
|
3334
3446
|
const cursor = autoCompleteCursor(state)
|
|
3335
3447
|
const toDisplay = entriesToDisplay(cursor, state.filtered.length, options.maxPerPage)
|
|
@@ -3339,18 +3451,18 @@ const renderAutoCompleteChoices = <A>(
|
|
|
3339
3451
|
const choice = options.choices[choiceIndex]
|
|
3340
3452
|
const isSelected = state.index === choiceIndex
|
|
3341
3453
|
const prefix = renderAutoCompleteChoicePrefix(state, options, toDisplay, index, figures, renderOptions)
|
|
3342
|
-
const title = renderChoiceTitle(choice, isSelected, renderOptions)
|
|
3343
|
-
const description = renderChoiceDescription(choice, isSelected, renderOptions)
|
|
3454
|
+
const title = renderChoiceTitle(choice, isSelected, figures, renderOptions)
|
|
3455
|
+
const description = renderChoiceDescription(choice, isSelected, figures, renderOptions)
|
|
3344
3456
|
documents.push(prefix + title + " " + description)
|
|
3345
3457
|
}
|
|
3346
3458
|
return documents.join("\n")
|
|
3347
3459
|
}
|
|
3348
3460
|
|
|
3349
3461
|
const renderSelectNextFrame = Effect.fnUntraced(function*<A>(state: SelectState, options: SelectOptionsReq<A>) {
|
|
3350
|
-
const figures = yield*
|
|
3462
|
+
const figures = yield* getTheme(options)
|
|
3351
3463
|
const choices = renderSelectChoices(state, options, figures)
|
|
3352
|
-
const leadingSymbol =
|
|
3353
|
-
const trailingSymbol =
|
|
3464
|
+
const leadingSymbol = annotateSymbol(figures.prefix, figures.primaryColor)
|
|
3465
|
+
const trailingSymbol = annotateSymbol(figures.pointerSmall, figures.mutedColor)
|
|
3354
3466
|
const promptMsg = renderSelectOutput(leadingSymbol, trailingSymbol, options)
|
|
3355
3467
|
return Ansi.cursorHide + promptMsg + "\n" + choices
|
|
3356
3468
|
})
|
|
@@ -3359,33 +3471,33 @@ const renderAutoCompleteNextFrame = Effect.fnUntraced(function*<A>(
|
|
|
3359
3471
|
state: AutoCompleteState,
|
|
3360
3472
|
options: AutoCompleteOptionsReq<A>
|
|
3361
3473
|
) {
|
|
3362
|
-
const figures = yield*
|
|
3474
|
+
const figures = yield* getTheme(options)
|
|
3363
3475
|
const choices = renderAutoCompleteChoices(state, options, figures)
|
|
3364
|
-
const leadingSymbol =
|
|
3365
|
-
const trailingSymbol =
|
|
3366
|
-
const promptMsg = renderAutoCompleteOutput(state, leadingSymbol, trailingSymbol, options)
|
|
3476
|
+
const leadingSymbol = annotateSymbol(figures.prefix, figures.primaryColor)
|
|
3477
|
+
const trailingSymbol = annotateSymbol(figures.pointerSmall, figures.mutedColor)
|
|
3478
|
+
const promptMsg = renderAutoCompleteOutput(state, leadingSymbol, trailingSymbol, options, figures)
|
|
3367
3479
|
return Ansi.cursorHide + promptMsg + "\n" + choices
|
|
3368
3480
|
})
|
|
3369
3481
|
|
|
3370
3482
|
const renderSelectSubmission = Effect.fnUntraced(function*<A>(state: SelectState, options: SelectOptionsReq<A>) {
|
|
3371
|
-
const figures = yield*
|
|
3483
|
+
const figures = yield* getTheme(options)
|
|
3372
3484
|
const selected = options.choices[state].title
|
|
3373
|
-
const leadingSymbol =
|
|
3374
|
-
const trailingSymbol =
|
|
3485
|
+
const leadingSymbol = annotateSymbol(figures.tick, figures.successColor)
|
|
3486
|
+
const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor)
|
|
3375
3487
|
const promptMsg = renderSelectOutput(leadingSymbol, trailingSymbol, options)
|
|
3376
|
-
return promptMsg + " " + Ansi.annotate(selected,
|
|
3488
|
+
return promptMsg + " " + Ansi.annotate(selected, figures.submittedColor) + "\n"
|
|
3377
3489
|
})
|
|
3378
3490
|
|
|
3379
3491
|
const renderAutoCompleteSubmission = Effect.fnUntraced(function*<A>(
|
|
3380
3492
|
state: AutoCompleteState,
|
|
3381
3493
|
options: AutoCompleteOptionsReq<A>
|
|
3382
3494
|
) {
|
|
3383
|
-
const figures = yield*
|
|
3495
|
+
const figures = yield* getTheme(options)
|
|
3384
3496
|
const selected = options.choices[state.index].title
|
|
3385
|
-
const leadingSymbol =
|
|
3386
|
-
const trailingSymbol =
|
|
3387
|
-
const promptMsg = renderAutoCompleteOutput(state, leadingSymbol, trailingSymbol, options)
|
|
3388
|
-
return promptMsg + " " + Ansi.annotate(selected,
|
|
3497
|
+
const leadingSymbol = annotateSymbol(figures.tick, figures.successColor)
|
|
3498
|
+
const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor)
|
|
3499
|
+
const promptMsg = renderAutoCompleteOutput(state, leadingSymbol, trailingSymbol, options, figures)
|
|
3500
|
+
return promptMsg + " " + Ansi.annotate(selected, figures.submittedColor) + "\n"
|
|
3389
3501
|
})
|
|
3390
3502
|
|
|
3391
3503
|
const processSelectCursorUp = <A>(state: SelectState, choices: SelectOptionsReq<A>["choices"]) => {
|
|
@@ -3469,9 +3581,9 @@ const handleSelectClear = <A>(options: SelectOptionsReq<A>) =>
|
|
|
3469
3581
|
Effect.fnUntraced(function*(state: SelectState, _: Action<SelectState, A>) {
|
|
3470
3582
|
const terminal = yield* Terminal.Terminal
|
|
3471
3583
|
const columns = yield* terminal.columns
|
|
3472
|
-
const figures = yield*
|
|
3584
|
+
const figures = yield* getTheme(options)
|
|
3473
3585
|
const clearPrompt = Ansi.eraseLine + Ansi.cursorLeft
|
|
3474
|
-
const promptText = renderSelectOutput(
|
|
3586
|
+
const promptText = renderSelectOutput(figures.prefix, figures.pointerSmall, options, { plain: true })
|
|
3475
3587
|
const choicesText = renderSelectChoices(state, options, figures, { plain: true })
|
|
3476
3588
|
const clearOutput = eraseText(`${promptText}\n${choicesText}`, columns)
|
|
3477
3589
|
return clearOutput + clearPrompt
|
|
@@ -3481,9 +3593,16 @@ const handleAutoCompleteClear = <A>(options: AutoCompleteOptionsReq<A>) =>
|
|
|
3481
3593
|
Effect.fnUntraced(function*(state: AutoCompleteState, _: Action<AutoCompleteState, A>) {
|
|
3482
3594
|
const terminal = yield* Terminal.Terminal
|
|
3483
3595
|
const columns = yield* terminal.columns
|
|
3484
|
-
const figures = yield*
|
|
3596
|
+
const figures = yield* getTheme(options)
|
|
3485
3597
|
const clearPrompt = Ansi.eraseLine + Ansi.cursorLeft
|
|
3486
|
-
const promptText = renderAutoCompleteOutput(
|
|
3598
|
+
const promptText = renderAutoCompleteOutput(
|
|
3599
|
+
state,
|
|
3600
|
+
figures.prefix,
|
|
3601
|
+
figures.pointerSmall,
|
|
3602
|
+
options,
|
|
3603
|
+
figures,
|
|
3604
|
+
{ plain: true }
|
|
3605
|
+
)
|
|
3487
3606
|
const choicesText = renderAutoCompleteChoices(state, options, figures, { plain: true })
|
|
3488
3607
|
const clearOutput = eraseText(`${promptText}\n${choicesText}`, columns)
|
|
3489
3608
|
return clearOutput + clearPrompt
|
|
@@ -3520,18 +3639,29 @@ const handleSelectProcess = <A>(options: SelectOptionsReq<A>) => {
|
|
|
3520
3639
|
|
|
3521
3640
|
const handleAutoCompleteProcess = <A>(options: AutoCompleteOptionsReq<A>) => {
|
|
3522
3641
|
return (input: Terminal.UserInput, state: AutoCompleteState) => {
|
|
3642
|
+
// Navigation is bound to ctrl chords rather than bare `j`/`k`, so that every
|
|
3643
|
+
// printable character reaches the filter input.
|
|
3523
3644
|
if (input.key.ctrl) {
|
|
3524
|
-
|
|
3525
|
-
|
|
3645
|
+
switch (input.key.name) {
|
|
3646
|
+
case "u": {
|
|
3647
|
+
return processAutoCompleteClear(state, options)
|
|
3648
|
+
}
|
|
3649
|
+
case "p":
|
|
3650
|
+
case "k": {
|
|
3651
|
+
return processAutoCompleteCursorUp(state)
|
|
3652
|
+
}
|
|
3653
|
+
case "n": {
|
|
3654
|
+
return processAutoCompleteCursorDown(state)
|
|
3655
|
+
}
|
|
3656
|
+
default: {
|
|
3657
|
+
return Effect.succeed(Action.Beep())
|
|
3658
|
+
}
|
|
3526
3659
|
}
|
|
3527
|
-
return Effect.succeed(Action.Beep())
|
|
3528
3660
|
}
|
|
3529
3661
|
switch (input.key.name) {
|
|
3530
|
-
case "k":
|
|
3531
3662
|
case "up": {
|
|
3532
3663
|
return processAutoCompleteCursorUp(state)
|
|
3533
3664
|
}
|
|
3534
|
-
case "j":
|
|
3535
3665
|
case "down": {
|
|
3536
3666
|
return processAutoCompleteCursorDown(state)
|
|
3537
3667
|
}
|
|
@@ -3559,7 +3689,7 @@ const handleAutoCompleteProcess = <A>(options: AutoCompleteOptionsReq<A>) => {
|
|
|
3559
3689
|
}
|
|
3560
3690
|
}
|
|
3561
3691
|
|
|
3562
|
-
interface TextOptionsReq extends
|
|
3692
|
+
interface TextOptionsReq extends OptionsReq<TextOptions> {
|
|
3563
3693
|
/**
|
|
3564
3694
|
* The type of the text option.
|
|
3565
3695
|
*/
|
|
@@ -3575,11 +3705,11 @@ interface TextState {
|
|
|
3575
3705
|
const renderClearScreen = Effect.fnUntraced(function*(state: TextState, options: TextOptionsReq) {
|
|
3576
3706
|
const terminal = yield* Terminal.Terminal
|
|
3577
3707
|
const columns = yield* terminal.columns
|
|
3578
|
-
const figures = yield*
|
|
3708
|
+
const figures = yield* getTheme(options)
|
|
3579
3709
|
const resetCurrentLine = Ansi.eraseLine + Ansi.cursorLeft
|
|
3580
|
-
const errorText = renderTextError(state, figures.pointerSmall, { plain: true })
|
|
3710
|
+
const errorText = renderTextError(state, figures.pointerSmall, figures, { plain: true })
|
|
3581
3711
|
const clearOutput = clearOutputWithError(
|
|
3582
|
-
renderTextOutput(state,
|
|
3712
|
+
renderTextOutput(state, figures.prefix, figures.pointerSmall, options, figures, { plain: true }),
|
|
3583
3713
|
columns,
|
|
3584
3714
|
errorText
|
|
3585
3715
|
)
|
|
@@ -3589,6 +3719,7 @@ const renderClearScreen = Effect.fnUntraced(function*(state: TextState, options:
|
|
|
3589
3719
|
const renderTextInput = (
|
|
3590
3720
|
nextState: TextState,
|
|
3591
3721
|
options: TextOptionsReq,
|
|
3722
|
+
theme: Theme,
|
|
3592
3723
|
submitted: boolean,
|
|
3593
3724
|
renderOptions?: RenderOptions | undefined
|
|
3594
3725
|
) => {
|
|
@@ -3599,7 +3730,7 @@ const renderTextInput = (
|
|
|
3599
3730
|
return ""
|
|
3600
3731
|
}
|
|
3601
3732
|
case "password": {
|
|
3602
|
-
return
|
|
3733
|
+
return theme.passwordMask.repeat(text.length)
|
|
3603
3734
|
}
|
|
3604
3735
|
case "text": {
|
|
3605
3736
|
return text
|
|
@@ -3607,20 +3738,24 @@ const renderTextInput = (
|
|
|
3607
3738
|
}
|
|
3608
3739
|
}
|
|
3609
3740
|
|
|
3741
|
+
if (text.length === 0) {
|
|
3742
|
+
// Avoid wrapping an empty value in ANSI codes, which would make renderPrompt
|
|
3743
|
+
// add spacing for content that occupies no terminal columns.
|
|
3744
|
+
return ""
|
|
3745
|
+
}
|
|
3746
|
+
|
|
3610
3747
|
const annotation = Option.isSome(nextState.error) ?
|
|
3611
|
-
|
|
3748
|
+
theme.errorColor
|
|
3612
3749
|
: submitted ?
|
|
3613
|
-
|
|
3614
|
-
:
|
|
3615
|
-
Ansi.blackBright
|
|
3616
|
-
: Ansi.combine(Ansi.underlined, Ansi.cyanBright)
|
|
3750
|
+
theme.submittedColor
|
|
3751
|
+
: Ansi.combine(Ansi.underlined, theme.primaryColor)
|
|
3617
3752
|
|
|
3618
3753
|
switch (options.type) {
|
|
3619
3754
|
case "hidden": {
|
|
3620
3755
|
return ""
|
|
3621
3756
|
}
|
|
3622
3757
|
case "password": {
|
|
3623
|
-
return
|
|
3758
|
+
return annotateSymbol(theme.passwordMask.repeat(text.length), annotation)
|
|
3624
3759
|
}
|
|
3625
3760
|
case "text": {
|
|
3626
3761
|
return Ansi.annotate(text, annotation)
|
|
@@ -3631,6 +3766,7 @@ const renderTextInput = (
|
|
|
3631
3766
|
const renderTextError = (
|
|
3632
3767
|
nextState: TextState,
|
|
3633
3768
|
pointer: string,
|
|
3769
|
+
theme: Theme,
|
|
3634
3770
|
renderOptions?: RenderOptions | undefined
|
|
3635
3771
|
): string => {
|
|
3636
3772
|
if (Option.isSome(nextState.error)) {
|
|
@@ -3638,11 +3774,11 @@ const renderTextError = (
|
|
|
3638
3774
|
onEmpty: () => "",
|
|
3639
3775
|
onNonEmpty: (errorLines) => {
|
|
3640
3776
|
if (renderOptions?.plain === true) {
|
|
3641
|
-
return
|
|
3777
|
+
return separateSymbol(pointer, errorLines.join("\n"))
|
|
3642
3778
|
}
|
|
3643
|
-
const prefix =
|
|
3644
|
-
const lines = Arr.map(errorLines, (str) => annotateErrorLine(str))
|
|
3645
|
-
return Ansi.cursorSavePosition + "\n" + prefix
|
|
3779
|
+
const prefix = annotateSymbol(pointer, theme.errorColor)
|
|
3780
|
+
const lines = Arr.map(errorLines, (str) => annotateErrorLine(str, theme.errorColor))
|
|
3781
|
+
return Ansi.cursorSavePosition + "\n" + separateSymbol(prefix, lines.join("\n")) + Ansi.cursorRestorePosition
|
|
3646
3782
|
}
|
|
3647
3783
|
})
|
|
3648
3784
|
}
|
|
@@ -3654,28 +3790,30 @@ const renderTextOutput = (
|
|
|
3654
3790
|
leadingSymbol: string,
|
|
3655
3791
|
trailingSymbol: string,
|
|
3656
3792
|
options: TextOptionsReq,
|
|
3793
|
+
theme: Theme,
|
|
3657
3794
|
renderOptions?: RenderOptions | undefined,
|
|
3658
3795
|
submitted: boolean = false
|
|
3659
3796
|
) => {
|
|
3660
|
-
const value = renderTextInput(nextState, options, submitted, renderOptions)
|
|
3797
|
+
const value = renderTextInput(nextState, options, theme, submitted, renderOptions)
|
|
3661
3798
|
return renderPrompt(value, options.message, leadingSymbol, trailingSymbol, renderOptions)
|
|
3662
3799
|
}
|
|
3663
3800
|
|
|
3664
3801
|
const renderTextNextFrame = Effect.fnUntraced(function*(state: TextState, options: TextOptionsReq) {
|
|
3665
|
-
const figures = yield*
|
|
3666
|
-
const leadingSymbol =
|
|
3667
|
-
const trailingSymbol =
|
|
3668
|
-
const promptMsg = renderTextOutput(state, leadingSymbol, trailingSymbol, options)
|
|
3669
|
-
const errorMsg = renderTextError(state, figures.pointerSmall)
|
|
3670
|
-
const
|
|
3802
|
+
const figures = yield* getTheme(options)
|
|
3803
|
+
const leadingSymbol = annotateSymbol(figures.prefix, figures.primaryColor)
|
|
3804
|
+
const trailingSymbol = annotateSymbol(figures.pointerSmall, figures.mutedColor)
|
|
3805
|
+
const promptMsg = renderTextOutput(state, leadingSymbol, trailingSymbol, options, figures)
|
|
3806
|
+
const errorMsg = renderTextError(state, figures.pointerSmall, figures)
|
|
3807
|
+
const cursorWidth = options.type === "password" ? figures.passwordMask.length : 1
|
|
3808
|
+
const offset = (state.cursor - state.value.length) * cursorWidth
|
|
3671
3809
|
return promptMsg + errorMsg + Ansi.cursorMove(offset)
|
|
3672
3810
|
})
|
|
3673
3811
|
|
|
3674
3812
|
const renderTextSubmission = Effect.fnUntraced(function*(state: TextState, options: TextOptionsReq) {
|
|
3675
|
-
const figures = yield*
|
|
3676
|
-
const leadingSymbol =
|
|
3677
|
-
const trailingSymbol =
|
|
3678
|
-
const promptMsg = renderTextOutput(state, leadingSymbol, trailingSymbol, options, undefined, true)
|
|
3813
|
+
const figures = yield* getTheme(options)
|
|
3814
|
+
const leadingSymbol = annotateSymbol(figures.tick, figures.successColor)
|
|
3815
|
+
const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor)
|
|
3816
|
+
const promptMsg = renderTextOutput(state, leadingSymbol, trailingSymbol, options, figures, undefined, true)
|
|
3679
3817
|
return promptMsg + "\n"
|
|
3680
3818
|
})
|
|
3681
3819
|
|
|
@@ -3842,8 +3980,7 @@ const basePrompt = (
|
|
|
3842
3980
|
default: "",
|
|
3843
3981
|
type,
|
|
3844
3982
|
validate: Effect.succeed,
|
|
3845
|
-
...options
|
|
3846
|
-
prefix: options.prefix ?? DEFAULT_PREFIX
|
|
3983
|
+
...options
|
|
3847
3984
|
}
|
|
3848
3985
|
|
|
3849
3986
|
const initialState: TextState = {
|
|
@@ -3851,24 +3988,24 @@ const basePrompt = (
|
|
|
3851
3988
|
value: opts.default,
|
|
3852
3989
|
error: Option.none()
|
|
3853
3990
|
}
|
|
3854
|
-
return
|
|
3991
|
+
return Custom(initialState, {
|
|
3855
3992
|
render: handleTextRender(opts),
|
|
3856
3993
|
process: handleTextProcess(opts),
|
|
3857
3994
|
clear: handleTextClear(opts)
|
|
3858
3995
|
})
|
|
3859
3996
|
}
|
|
3860
3997
|
|
|
3861
|
-
interface ToggleOptionsReq extends
|
|
3998
|
+
interface ToggleOptionsReq extends OptionsReq<ToggleOptions> {}
|
|
3862
3999
|
|
|
3863
4000
|
type ToggleState = boolean
|
|
3864
4001
|
|
|
3865
4002
|
const handleToggleClear = Effect.fnUntraced(function*(options: ToggleOptionsReq) {
|
|
3866
4003
|
const terminal = yield* Terminal.Terminal
|
|
3867
4004
|
const columns = yield* terminal.columns
|
|
3868
|
-
const figures = yield*
|
|
4005
|
+
const figures = yield* getTheme(options)
|
|
3869
4006
|
const clearPrompt = Ansi.eraseLine + Ansi.cursorLeft
|
|
3870
|
-
const toggleText =
|
|
3871
|
-
const promptText = renderPrompt(toggleText, options.message,
|
|
4007
|
+
const toggleText = options.active + " " + separateSymbol(figures.toggleSeparator, options.inactive)
|
|
4008
|
+
const promptText = renderPrompt(toggleText, options.message, figures.prefix, figures.pointerSmall, { plain: true })
|
|
3872
4009
|
const clearOutput = eraseText(promptText, columns)
|
|
3873
4010
|
return clearOutput + clearPrompt
|
|
3874
4011
|
})
|
|
@@ -3876,17 +4013,21 @@ const handleToggleClear = Effect.fnUntraced(function*(options: ToggleOptionsReq)
|
|
|
3876
4013
|
const renderToggle = (
|
|
3877
4014
|
value: boolean,
|
|
3878
4015
|
options: ToggleOptionsReq,
|
|
4016
|
+
theme: Theme,
|
|
3879
4017
|
submitted: boolean = false
|
|
3880
4018
|
) => {
|
|
3881
|
-
const separator =
|
|
3882
|
-
const selectedAnnotation = Ansi.combine(
|
|
4019
|
+
const separator = annotateSymbol(theme.toggleSeparator, theme.mutedColor)
|
|
4020
|
+
const selectedAnnotation = Ansi.combine(
|
|
4021
|
+
Ansi.underlined,
|
|
4022
|
+
submitted ? theme.submittedColor : theme.primaryColor
|
|
4023
|
+
)
|
|
3883
4024
|
const inactive = value
|
|
3884
4025
|
? options.inactive
|
|
3885
4026
|
: Ansi.annotate(options.inactive, selectedAnnotation)
|
|
3886
4027
|
const active = value
|
|
3887
4028
|
? Ansi.annotate(options.active, selectedAnnotation)
|
|
3888
4029
|
: options.active
|
|
3889
|
-
return active + " " + separator
|
|
4030
|
+
return active + " " + separateSymbol(separator, inactive)
|
|
3890
4031
|
}
|
|
3891
4032
|
|
|
3892
4033
|
const renderToggleOutput = (
|
|
@@ -3895,29 +4036,23 @@ const renderToggleOutput = (
|
|
|
3895
4036
|
trailingSymbol: string,
|
|
3896
4037
|
options: ToggleOptionsReq
|
|
3897
4038
|
) => {
|
|
3898
|
-
|
|
3899
|
-
const prefix = leadingSymbol + " "
|
|
3900
|
-
if (Arr.isReadonlyArrayNonEmpty(promptLines)) {
|
|
3901
|
-
const lines = Arr.map(promptLines, (line) => annotateLine(line))
|
|
3902
|
-
return prefix + lines.join("\n") + " " + trailingSymbol + " " + toggle
|
|
3903
|
-
}
|
|
3904
|
-
return prefix + " " + trailingSymbol + " " + toggle
|
|
4039
|
+
return renderPrompt(toggle, options.message, leadingSymbol, trailingSymbol)
|
|
3905
4040
|
}
|
|
3906
4041
|
|
|
3907
4042
|
const renderToggleNextFrame = Effect.fnUntraced(function*(state: ToggleState, options: ToggleOptionsReq) {
|
|
3908
|
-
const figures = yield*
|
|
3909
|
-
const leadingSymbol =
|
|
3910
|
-
const trailingSymbol =
|
|
3911
|
-
const toggle = renderToggle(state, options)
|
|
4043
|
+
const figures = yield* getTheme(options)
|
|
4044
|
+
const leadingSymbol = annotateSymbol(figures.prefix, figures.primaryColor)
|
|
4045
|
+
const trailingSymbol = annotateSymbol(figures.pointerSmall, figures.mutedColor)
|
|
4046
|
+
const toggle = renderToggle(state, options, figures)
|
|
3912
4047
|
const promptMsg = renderToggleOutput(toggle, leadingSymbol, trailingSymbol, options)
|
|
3913
4048
|
return Ansi.cursorHide + promptMsg
|
|
3914
4049
|
})
|
|
3915
4050
|
|
|
3916
4051
|
const renderToggleSubmission = Effect.fnUntraced(function*(value: boolean, options: ToggleOptionsReq) {
|
|
3917
|
-
const figures = yield*
|
|
3918
|
-
const leadingSymbol =
|
|
3919
|
-
const trailingSymbol =
|
|
3920
|
-
const toggle = renderToggle(value, options, true)
|
|
4052
|
+
const figures = yield* getTheme(options)
|
|
4053
|
+
const leadingSymbol = annotateSymbol(figures.tick, figures.successColor)
|
|
4054
|
+
const trailingSymbol = annotateSymbol(figures.ellipsis, figures.mutedColor)
|
|
4055
|
+
const toggle = renderToggle(value, options, figures, true)
|
|
3921
4056
|
const promptMsg = renderToggleOutput(toggle, leadingSymbol, trailingSymbol, options)
|
|
3922
4057
|
return promptMsg + "\n"
|
|
3923
4058
|
})
|