effect 4.0.0-beta.85 → 4.0.0-beta.87
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/dist/ChannelSchema.d.ts +8 -8
- package/dist/ChannelSchema.d.ts.map +1 -1
- package/dist/Config.d.ts +2 -2
- package/dist/Config.d.ts.map +1 -1
- package/dist/Config.js +10 -3
- package/dist/Config.js.map +1 -1
- package/dist/Cron.d.ts.map +1 -1
- package/dist/Cron.js +4 -0
- package/dist/Cron.js.map +1 -1
- package/dist/Schema.d.ts +749 -393
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +95 -65
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.d.ts.map +1 -1
- package/dist/SchemaAST.js +20 -29
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaParser.d.ts +24 -24
- package/dist/SchemaParser.d.ts.map +1 -1
- package/dist/SchemaParser.js +43 -39
- package/dist/SchemaParser.js.map +1 -1
- package/dist/SchemaRepresentation.d.ts +300 -300
- package/dist/SchemaTransformation.d.ts +2 -2
- package/dist/SchemaTransformation.d.ts.map +1 -1
- package/dist/SchemaTransformation.js +5 -8
- package/dist/SchemaTransformation.js.map +1 -1
- package/dist/internal/effect.js +6 -7
- package/dist/internal/effect.js.map +1 -1
- package/dist/internal/matcher.js +0 -2
- package/dist/internal/matcher.js.map +1 -1
- package/dist/internal/schema/representation.js +1 -5
- package/dist/internal/schema/representation.js.map +1 -1
- package/dist/internal/schema/schema.js.map +1 -1
- package/dist/testing/TestSchema.d.ts +9 -9
- package/dist/testing/TestSchema.d.ts.map +1 -1
- package/dist/testing/TestSchema.js +3 -2
- package/dist/testing/TestSchema.js.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts +2 -2
- package/dist/unstable/ai/AnthropicStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/AnthropicStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Chat.d.ts +1 -1
- package/dist/unstable/ai/Chat.d.ts.map +1 -1
- package/dist/unstable/ai/LanguageModel.d.ts +4 -4
- package/dist/unstable/ai/LanguageModel.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.d.ts +13 -6
- package/dist/unstable/ai/McpSchema.d.ts.map +1 -1
- package/dist/unstable/ai/McpSchema.js.map +1 -1
- package/dist/unstable/ai/McpServer.d.ts +4 -4
- package/dist/unstable/ai/McpServer.d.ts.map +1 -1
- package/dist/unstable/ai/McpServer.js.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts +2 -2
- package/dist/unstable/ai/OpenAiStructuredOutput.d.ts.map +1 -1
- package/dist/unstable/ai/OpenAiStructuredOutput.js.map +1 -1
- package/dist/unstable/ai/Response.d.ts +2 -2
- package/dist/unstable/ai/Response.d.ts.map +1 -1
- package/dist/unstable/ai/Response.js.map +1 -1
- package/dist/unstable/ai/Tool.d.ts +26 -26
- package/dist/unstable/ai/Tool.d.ts.map +1 -1
- package/dist/unstable/ai/Tool.js.map +1 -1
- package/dist/unstable/cli/Argument.d.ts +8 -7
- package/dist/unstable/cli/Argument.d.ts.map +1 -1
- package/dist/unstable/cli/Argument.js.map +1 -1
- package/dist/unstable/cli/Flag.d.ts +8 -7
- package/dist/unstable/cli/Flag.d.ts.map +1 -1
- package/dist/unstable/cli/Flag.js.map +1 -1
- package/dist/unstable/cli/Param.d.ts +1806 -168
- package/dist/unstable/cli/Param.d.ts.map +1 -1
- package/dist/unstable/cli/Param.js +0 -70
- package/dist/unstable/cli/Param.js.map +1 -1
- package/dist/unstable/cli/Primitive.d.ts +3 -4
- package/dist/unstable/cli/Primitive.d.ts.map +1 -1
- package/dist/unstable/cli/Primitive.js.map +1 -1
- package/dist/unstable/cli/internal/ansi.d.ts.map +1 -1
- package/dist/unstable/cli/internal/ansi.js +0 -22
- package/dist/unstable/cli/internal/ansi.js.map +1 -1
- package/dist/unstable/cli/internal/config.d.ts +48 -0
- package/dist/unstable/cli/internal/config.d.ts.map +1 -1
- package/dist/unstable/cli/internal/config.js +0 -6
- package/dist/unstable/cli/internal/config.js.map +1 -1
- package/dist/unstable/cluster/ClusterWorkflowEngine.d.ts +3 -3
- package/dist/unstable/cluster/Reply.d.ts +2 -2
- package/dist/unstable/cluster/Reply.d.ts.map +1 -1
- package/dist/unstable/cluster/Reply.js.map +1 -1
- package/dist/unstable/devtools/DevToolsSchema.js.map +1 -1
- package/dist/unstable/encoding/Msgpack.d.ts +6 -6
- package/dist/unstable/encoding/Msgpack.d.ts.map +1 -1
- package/dist/unstable/encoding/Msgpack.js.map +1 -1
- package/dist/unstable/encoding/Ndjson.d.ts +8 -8
- package/dist/unstable/encoding/Ndjson.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.d.ts +1 -1
- package/dist/unstable/encoding/Sse.d.ts.map +1 -1
- package/dist/unstable/encoding/Sse.js.map +1 -1
- package/dist/unstable/eventlog/EventLogMessage.d.ts +22 -22
- package/dist/unstable/eventlog/EventLogMessage.d.ts.map +1 -1
- package/dist/unstable/eventlog/EventLogRemote.d.ts +15 -15
- package/dist/unstable/http/HttpBody.d.ts +1 -1
- package/dist/unstable/http/HttpBody.d.ts.map +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts +1 -1
- package/dist/unstable/http/HttpClientRequest.d.ts.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.d.ts +1 -1
- package/dist/unstable/http/HttpIncomingMessage.d.ts.map +1 -1
- package/dist/unstable/http/HttpIncomingMessage.js.map +1 -1
- package/dist/unstable/http/HttpMiddleware.d.ts.map +1 -1
- package/dist/unstable/http/HttpMiddleware.js +12 -3
- package/dist/unstable/http/HttpMiddleware.js.map +1 -1
- package/dist/unstable/httpapi/HttpApi.d.ts +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +2 -2
- package/dist/unstable/httpapi/HttpApiClient.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts +32 -32
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts +1 -1
- package/dist/unstable/httpapi/HttpApiMiddleware.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.d.ts +13 -6
- package/dist/unstable/httpapi/HttpApiSchema.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiSchema.js +0 -13
- package/dist/unstable/httpapi/HttpApiSchema.js.map +1 -1
- package/dist/unstable/httpapi/OpenApi.js.map +1 -1
- package/dist/unstable/observability/internal/otlpProtobuf.js +0 -68
- package/dist/unstable/observability/internal/otlpProtobuf.js.map +1 -1
- package/dist/unstable/observability/internal/protobuf.js +0 -28
- package/dist/unstable/observability/internal/protobuf.js.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.d.ts +2 -2
- package/dist/unstable/persistence/KeyValueStore.d.ts.map +1 -1
- package/dist/unstable/persistence/KeyValueStore.js.map +1 -1
- package/dist/unstable/persistence/Persistable.d.ts +6 -6
- package/dist/unstable/persistence/Persistable.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.d.ts +3 -3
- package/dist/unstable/persistence/PersistedQueue.d.ts.map +1 -1
- package/dist/unstable/persistence/PersistedQueue.js.map +1 -1
- package/dist/unstable/persistence/Persistence.d.ts +5 -5
- package/dist/unstable/persistence/Persistence.d.ts.map +1 -1
- package/dist/unstable/reactivity/AsyncResult.d.ts +2 -2
- package/dist/unstable/reactivity/AsyncResult.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +1 -1
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.d.ts +3 -4
- package/dist/unstable/rpc/Rpc.d.ts.map +1 -1
- package/dist/unstable/rpc/Rpc.js +1 -1
- package/dist/unstable/rpc/Rpc.js.map +1 -1
- package/dist/unstable/rpc/RpcClient.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcClient.js +25 -4
- package/dist/unstable/rpc/RpcClient.js.map +1 -1
- package/dist/unstable/rpc/RpcMessage.d.ts +7 -0
- package/dist/unstable/rpc/RpcMessage.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcMessage.js +20 -0
- package/dist/unstable/rpc/RpcMessage.js.map +1 -1
- package/dist/unstable/rpc/RpcMiddleware.d.ts +2 -2
- package/dist/unstable/rpc/RpcMiddleware.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSchema.d.ts +10 -3
- package/dist/unstable/rpc/RpcSchema.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcSchema.js.map +1 -1
- package/dist/unstable/rpc/RpcWorker.d.ts +3 -3
- package/dist/unstable/rpc/RpcWorker.d.ts.map +1 -1
- package/dist/unstable/schema/Model.d.ts +2 -2
- package/dist/unstable/schema/Model.d.ts.map +1 -1
- package/dist/unstable/schema/Model.js.map +1 -1
- package/dist/unstable/schema/VariantSchema.d.ts +16 -2
- package/dist/unstable/schema/VariantSchema.d.ts.map +1 -1
- package/dist/unstable/schema/VariantSchema.js.map +1 -1
- package/dist/unstable/sql/SqlConnection.d.ts +1 -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.js.map +1 -1
- package/dist/unstable/sql/SqlResolver.d.ts +4 -4
- package/dist/unstable/sql/SqlResolver.d.ts.map +1 -1
- package/dist/unstable/sql/SqlResolver.js.map +1 -1
- package/dist/unstable/sql/SqlSchema.d.ts +5 -5
- package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.d.ts +1 -0
- package/dist/unstable/sql/Statement.d.ts.map +1 -1
- package/dist/unstable/sql/Statement.js +3 -0
- package/dist/unstable/sql/Statement.js.map +1 -1
- package/dist/unstable/workflow/Activity.d.ts +2 -2
- package/dist/unstable/workflow/Activity.d.ts.map +1 -1
- package/dist/unstable/workflow/DurableDeferred.d.ts +18 -18
- package/dist/unstable/workflow/DurableDeferred.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.d.ts +3 -3
- package/dist/unstable/workflow/Workflow.d.ts.map +1 -1
- package/dist/unstable/workflow/Workflow.js.map +1 -1
- package/dist/unstable/workflow/WorkflowEngine.d.ts +3 -3
- package/dist/unstable/workflow/WorkflowEngine.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/ChannelSchema.ts +9 -9
- package/src/Config.ts +12 -5
- package/src/Cron.ts +4 -0
- package/src/Schema.ts +968 -689
- package/src/SchemaAST.ts +25 -35
- package/src/SchemaParser.ts +85 -77
- package/src/SchemaTransformation.ts +5 -6
- package/src/internal/effect.ts +6 -22
- package/src/internal/matcher.ts +0 -5
- package/src/internal/schema/arbitrary.ts +1 -1
- package/src/internal/schema/representation.ts +1 -5
- package/src/internal/schema/schema.ts +1 -1
- package/src/testing/TestSchema.ts +14 -13
- package/src/unstable/ai/AnthropicStructuredOutput.ts +2 -2
- package/src/unstable/ai/Chat.ts +1 -1
- package/src/unstable/ai/LanguageModel.ts +7 -7
- package/src/unstable/ai/McpSchema.ts +16 -14
- package/src/unstable/ai/McpServer.ts +7 -7
- package/src/unstable/ai/OpenAiStructuredOutput.ts +2 -2
- package/src/unstable/ai/Response.ts +9 -5
- package/src/unstable/ai/Tool.ts +49 -47
- package/src/unstable/cli/Argument.ts +9 -8
- package/src/unstable/cli/Flag.ts +9 -8
- package/src/unstable/cli/Param.ts +6 -146
- package/src/unstable/cli/Primitive.ts +5 -6
- package/src/unstable/cli/internal/ansi.ts +0 -33
- package/src/unstable/cli/internal/config.ts +0 -8
- package/src/unstable/cli/internal/parser.ts +2 -2
- package/src/unstable/cluster/MessageStorage.ts +1 -1
- package/src/unstable/cluster/Reply.ts +6 -2
- package/src/unstable/devtools/DevToolsSchema.ts +1 -1
- package/src/unstable/encoding/Msgpack.ts +9 -7
- package/src/unstable/encoding/Ndjson.ts +10 -10
- package/src/unstable/encoding/Sse.ts +1 -1
- package/src/unstable/eventlog/Event.ts +3 -3
- package/src/unstable/http/HttpBody.ts +1 -1
- package/src/unstable/http/HttpClientRequest.ts +1 -1
- package/src/unstable/http/HttpIncomingMessage.ts +1 -1
- package/src/unstable/http/HttpMiddleware.ts +12 -3
- package/src/unstable/httpapi/HttpApi.ts +1 -1
- package/src/unstable/httpapi/HttpApiBuilder.ts +9 -5
- package/src/unstable/httpapi/HttpApiClient.ts +10 -10
- package/src/unstable/httpapi/HttpApiEndpoint.ts +45 -33
- package/src/unstable/httpapi/HttpApiMiddleware.ts +2 -2
- package/src/unstable/httpapi/HttpApiSchema.ts +16 -43
- package/src/unstable/httpapi/OpenApi.ts +5 -5
- package/src/unstable/observability/internal/otlpProtobuf.ts +0 -75
- package/src/unstable/observability/internal/protobuf.ts +0 -42
- package/src/unstable/persistence/KeyValueStore.ts +2 -2
- package/src/unstable/persistence/Persistable.ts +7 -7
- package/src/unstable/persistence/PersistedQueue.ts +3 -3
- package/src/unstable/persistence/Persistence.ts +5 -5
- package/src/unstable/reactivity/AsyncResult.ts +4 -4
- package/src/unstable/reactivity/Atom.ts +1 -1
- package/src/unstable/reactivity/AtomHttpApi.ts +1 -1
- package/src/unstable/rpc/Rpc.ts +7 -8
- package/src/unstable/rpc/RpcClient.ts +26 -4
- package/src/unstable/rpc/RpcMessage.ts +19 -0
- package/src/unstable/rpc/RpcMiddleware.ts +2 -2
- package/src/unstable/rpc/RpcSchema.ts +12 -9
- package/src/unstable/rpc/RpcWorker.ts +3 -3
- package/src/unstable/schema/Model.ts +2 -2
- package/src/unstable/schema/VariantSchema.ts +19 -17
- package/src/unstable/sql/SqlConnection.ts +5 -0
- package/src/unstable/sql/SqlModel.ts +2 -2
- package/src/unstable/sql/SqlResolver.ts +6 -6
- package/src/unstable/sql/SqlSchema.ts +5 -5
- package/src/unstable/sql/Statement.ts +11 -0
- package/src/unstable/workflow/Activity.ts +6 -6
- package/src/unstable/workflow/DurableDeferred.ts +33 -33
- package/src/unstable/workflow/Workflow.ts +5 -5
- package/src/unstable/workflow/WorkflowEngine.ts +10 -10
- package/dist/internal/concurrency.d.ts +0 -2
- package/dist/internal/concurrency.d.ts.map +0 -1
- package/dist/internal/concurrency.js +0 -29
- package/dist/internal/concurrency.js.map +0 -1
- package/src/internal/concurrency.ts +0 -52
|
@@ -12,19 +12,16 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import * as Config from "../../Config.ts"
|
|
14
14
|
import * as Effect from "../../Effect.ts"
|
|
15
|
-
import type * as FileSystem from "../../FileSystem.ts"
|
|
16
15
|
import { dual, identity } from "../../Function.ts"
|
|
17
16
|
import * as Option from "../../Option.ts"
|
|
18
|
-
import type * as Path from "../../Path.ts"
|
|
19
17
|
import { type Pipeable, pipeArguments } from "../../Pipeable.ts"
|
|
20
18
|
import * as Predicate from "../../Predicate.ts"
|
|
21
19
|
import type * as Redacted from "../../Redacted.ts"
|
|
22
20
|
import * as Result from "../../Result.ts"
|
|
23
21
|
import * as Schema from "../../Schema.ts"
|
|
24
|
-
import type * as Terminal from "../../Terminal.ts"
|
|
25
22
|
import type { Covariant } from "../../Types.ts"
|
|
26
|
-
import type { ChildProcessSpawner } from "../process/ChildProcessSpawner.ts"
|
|
27
23
|
import * as CliError from "./CliError.ts"
|
|
24
|
+
import type { Environment } from "./Command.ts"
|
|
28
25
|
import * as Primitive from "./Primitive.ts"
|
|
29
26
|
import * as Prompt from "./Prompt.ts"
|
|
30
27
|
|
|
@@ -56,15 +53,6 @@ export interface Param<Kind extends ParamKind, out A> extends Param.Variance<A>
|
|
|
56
53
|
*/
|
|
57
54
|
export type ParamKind = "argument" | "flag"
|
|
58
55
|
|
|
59
|
-
/**
|
|
60
|
-
* Services that parameter parsing can require, such as filesystem, path,
|
|
61
|
-
* terminal, and child-process support.
|
|
62
|
-
*
|
|
63
|
-
* @category models
|
|
64
|
-
* @since 4.0.0
|
|
65
|
-
*/
|
|
66
|
-
export type Environment = FileSystem.FileSystem | Path.Path | Terminal.Terminal | ChildProcessSpawner
|
|
67
|
-
|
|
68
56
|
/**
|
|
69
57
|
* Defines the kind discriminator for positional argument parameters.
|
|
70
58
|
*
|
|
@@ -287,8 +275,6 @@ const Proto = {
|
|
|
287
275
|
* ```ts
|
|
288
276
|
* import { Param } from "effect/unstable/cli"
|
|
289
277
|
*
|
|
290
|
-
* // @internal - this module is not exported publicly
|
|
291
|
-
*
|
|
292
278
|
* const maybeParam = Param.string(Param.flagKind, "name")
|
|
293
279
|
*
|
|
294
280
|
* if (Param.isParam(maybeParam)) {
|
|
@@ -309,8 +295,6 @@ export const isParam = (u: unknown): u is Param<any, ParamKind> => Predicate.has
|
|
|
309
295
|
* ```ts
|
|
310
296
|
* import { Param } from "effect/unstable/cli"
|
|
311
297
|
*
|
|
312
|
-
* // @internal - this module is not exported publicly
|
|
313
|
-
*
|
|
314
298
|
* const nameParam = Param.string(Param.flagKind, "name")
|
|
315
299
|
* const optionalParam = Param.optional(nameParam)
|
|
316
300
|
*
|
|
@@ -377,8 +361,6 @@ export const makeSingle = <const Kind extends ParamKind, A>(params: {
|
|
|
377
361
|
* ```ts
|
|
378
362
|
* import { Param } from "effect/unstable/cli"
|
|
379
363
|
*
|
|
380
|
-
* // @internal - this module is not exported publicly
|
|
381
|
-
*
|
|
382
364
|
* // Create a string flag
|
|
383
365
|
* const nameFlag = Param.string(Param.flagKind, "name")
|
|
384
366
|
*
|
|
@@ -409,8 +391,6 @@ export const string = <const Kind extends ParamKind>(
|
|
|
409
391
|
* ```ts
|
|
410
392
|
* import { Param } from "effect/unstable/cli"
|
|
411
393
|
*
|
|
412
|
-
* // @internal - this module is not exported publicly
|
|
413
|
-
*
|
|
414
394
|
* // Create a boolean flag
|
|
415
395
|
* const verboseFlag = Param.boolean(Param.flagKind, "verbose")
|
|
416
396
|
*
|
|
@@ -442,8 +422,6 @@ export const boolean = <const Kind extends ParamKind>(
|
|
|
442
422
|
* ```ts
|
|
443
423
|
* import { Param } from "effect/unstable/cli"
|
|
444
424
|
*
|
|
445
|
-
* // @internal - this module is not exported publicly
|
|
446
|
-
*
|
|
447
425
|
* // Create an integer flag
|
|
448
426
|
* const portFlag = Param.integer(Param.flagKind, "port")
|
|
449
427
|
*
|
|
@@ -474,8 +452,6 @@ export const integer = <const Kind extends ParamKind>(
|
|
|
474
452
|
* ```ts
|
|
475
453
|
* import { Param } from "effect/unstable/cli"
|
|
476
454
|
*
|
|
477
|
-
* // @internal - this module is not exported publicly
|
|
478
|
-
*
|
|
479
455
|
* // Create a float flag
|
|
480
456
|
* const rateFlag = Param.float(Param.flagKind, "rate")
|
|
481
457
|
*
|
|
@@ -506,8 +482,6 @@ export const float = <const Kind extends ParamKind>(
|
|
|
506
482
|
* ```ts
|
|
507
483
|
* import { Param } from "effect/unstable/cli"
|
|
508
484
|
*
|
|
509
|
-
* // @internal - this module is not exported publicly
|
|
510
|
-
*
|
|
511
485
|
* // Create a date flag
|
|
512
486
|
* const startFlag = Param.date(Param.flagKind, "start-date")
|
|
513
487
|
*
|
|
@@ -540,8 +514,6 @@ export const date = <const Kind extends ParamKind>(
|
|
|
540
514
|
* ```ts
|
|
541
515
|
* import { Param } from "effect/unstable/cli"
|
|
542
516
|
*
|
|
543
|
-
* // @internal - this module is not exported publicly
|
|
544
|
-
*
|
|
545
517
|
* type Animal = Dog | Cat
|
|
546
518
|
*
|
|
547
519
|
* interface Dog {
|
|
@@ -580,8 +552,6 @@ export const choiceWithValue = <
|
|
|
580
552
|
* ```ts
|
|
581
553
|
* import { Param } from "effect/unstable/cli"
|
|
582
554
|
*
|
|
583
|
-
* // @internal - this module is not exported publicly
|
|
584
|
-
*
|
|
585
555
|
* const logLevel = Param.choice(Param.flagKind, "log-level", [
|
|
586
556
|
* "debug",
|
|
587
557
|
* "info",
|
|
@@ -609,8 +579,6 @@ export const choice = <
|
|
|
609
579
|
* ```ts
|
|
610
580
|
* import { Param } from "effect/unstable/cli"
|
|
611
581
|
*
|
|
612
|
-
* // @internal - this module is not exported publicly
|
|
613
|
-
*
|
|
614
582
|
* // Basic path parameter
|
|
615
583
|
* const outputPath = Param.path(Param.flagKind, "output")
|
|
616
584
|
*
|
|
@@ -657,8 +625,6 @@ export const path = <Kind extends ParamKind>(
|
|
|
657
625
|
* ```ts
|
|
658
626
|
* import { Param } from "effect/unstable/cli"
|
|
659
627
|
*
|
|
660
|
-
* // @internal - this module is not exported publicly
|
|
661
|
-
*
|
|
662
628
|
* // Basic directory parameter
|
|
663
629
|
* const outputDir = Param.directory(Param.flagKind, "output-dir")
|
|
664
630
|
*
|
|
@@ -697,8 +663,6 @@ export const directory = <Kind extends ParamKind>(
|
|
|
697
663
|
* ```ts
|
|
698
664
|
* import { Param } from "effect/unstable/cli"
|
|
699
665
|
*
|
|
700
|
-
* // @internal - this module is not exported publicly
|
|
701
|
-
*
|
|
702
666
|
* // Basic file parameter
|
|
703
667
|
* const outputFile = Param.file(Param.flagKind, "output")
|
|
704
668
|
*
|
|
@@ -733,8 +697,6 @@ export const file = <Kind extends ParamKind>(
|
|
|
733
697
|
* ```ts
|
|
734
698
|
* import { Param } from "effect/unstable/cli"
|
|
735
699
|
*
|
|
736
|
-
* // @internal - this module is not exported publicly
|
|
737
|
-
*
|
|
738
700
|
* // Create a password parameter
|
|
739
701
|
* const password = Param.redacted(Param.flagKind, "password")
|
|
740
702
|
*
|
|
@@ -765,8 +727,6 @@ export const redacted = <Kind extends ParamKind>(
|
|
|
765
727
|
* ```ts
|
|
766
728
|
* import { Param } from "effect/unstable/cli"
|
|
767
729
|
*
|
|
768
|
-
* // @internal - this module is not exported publicly
|
|
769
|
-
*
|
|
770
730
|
* // Read a config file as string
|
|
771
731
|
* const configContent = Param.fileText(Param.flagKind, "config")
|
|
772
732
|
*
|
|
@@ -799,8 +759,6 @@ export const fileText = <Kind extends ParamKind>(kind: Kind, name: string): Para
|
|
|
799
759
|
* ```ts
|
|
800
760
|
* import { Param } from "effect/unstable/cli"
|
|
801
761
|
*
|
|
802
|
-
* // @internal - this module is not exported publicly
|
|
803
|
-
*
|
|
804
762
|
* // Will use the extension of the file passed on the command line to determine
|
|
805
763
|
* // the parser to use
|
|
806
764
|
* const config = Param.fileParse(Param.flagKind, "config")
|
|
@@ -833,8 +791,6 @@ export const fileParse = <Kind extends ParamKind>(
|
|
|
833
791
|
* ```ts
|
|
834
792
|
* import { Schema } from "effect"
|
|
835
793
|
* import { Param } from "effect/unstable/cli"
|
|
836
|
-
* // @internal - this module is not exported publicly
|
|
837
|
-
*
|
|
838
794
|
* // Parse JSON config file
|
|
839
795
|
* const configSchema = Schema.Struct({
|
|
840
796
|
* port: Schema.Number,
|
|
@@ -859,7 +815,7 @@ export const fileParse = <Kind extends ParamKind>(
|
|
|
859
815
|
export const fileSchema = <Kind extends ParamKind, A>(
|
|
860
816
|
kind: Kind,
|
|
861
817
|
name: string,
|
|
862
|
-
schema: Schema.
|
|
818
|
+
schema: Schema.ConstraintDecoder<A, Environment>,
|
|
863
819
|
options?: Primitive.FileSchemaOptions | undefined
|
|
864
820
|
): Param<Kind, A> =>
|
|
865
821
|
makeSingle({
|
|
@@ -886,8 +842,6 @@ export const fileSchema = <Kind extends ParamKind, A>(
|
|
|
886
842
|
* ```ts
|
|
887
843
|
* import { Param } from "effect/unstable/cli"
|
|
888
844
|
*
|
|
889
|
-
* // @internal - this module is not exported publicly
|
|
890
|
-
*
|
|
891
845
|
* const env = Param.keyValuePair(Param.flagKind, "env")
|
|
892
846
|
* // --env FOO=bar --env BAZ=qux will parse to { FOO: "bar", BAZ: "qux" }
|
|
893
847
|
*
|
|
@@ -927,8 +881,6 @@ export const keyValuePair = <Kind extends ParamKind>(
|
|
|
927
881
|
* ```ts
|
|
928
882
|
* import { Param } from "effect/unstable/cli"
|
|
929
883
|
*
|
|
930
|
-
* // @internal - this module is not exported publicly
|
|
931
|
-
*
|
|
932
884
|
* const disabledDebugParam = Param.none(Param.flagKind)
|
|
933
885
|
*
|
|
934
886
|
* const makeDebugParam = (enableDebug: boolean) =>
|
|
@@ -968,8 +920,6 @@ const FLAG_DASH_REGEXP = /^-+/
|
|
|
968
920
|
* ```ts
|
|
969
921
|
* import { Param } from "effect/unstable/cli"
|
|
970
922
|
*
|
|
971
|
-
* // @internal - this module is not exported publicly
|
|
972
|
-
*
|
|
973
923
|
* const force = Param.boolean(Param.flagKind, "force").pipe(
|
|
974
924
|
* Param.withAlias("-f"),
|
|
975
925
|
* Param.withAlias("-F")
|
|
@@ -1004,8 +954,6 @@ export const withAlias: {
|
|
|
1004
954
|
* ```ts
|
|
1005
955
|
* import { Param } from "effect/unstable/cli"
|
|
1006
956
|
*
|
|
1007
|
-
* // @internal - this module is not exported publicly
|
|
1008
|
-
*
|
|
1009
957
|
* const force = Param.boolean(Param.flagKind, "force").pipe(
|
|
1010
958
|
* Param.withAlias("-f"),
|
|
1011
959
|
* Param.withAlias("-F")
|
|
@@ -1040,8 +988,6 @@ export const withAlias: {
|
|
|
1040
988
|
* ```ts
|
|
1041
989
|
* import { Param } from "effect/unstable/cli"
|
|
1042
990
|
*
|
|
1043
|
-
* // @internal - this module is not exported publicly
|
|
1044
|
-
*
|
|
1045
991
|
* const force = Param.boolean(Param.flagKind, "force").pipe(
|
|
1046
992
|
* Param.withAlias("-f"),
|
|
1047
993
|
* Param.withAlias("-F")
|
|
@@ -1079,8 +1025,6 @@ export const withAlias: {
|
|
|
1079
1025
|
* ```ts
|
|
1080
1026
|
* import { Param } from "effect/unstable/cli"
|
|
1081
1027
|
*
|
|
1082
|
-
* // @internal - this module is not exported publicly
|
|
1083
|
-
*
|
|
1084
1028
|
* const verbose = Param.boolean(Param.flagKind, "verbose").pipe(
|
|
1085
1029
|
* Param.withAlias("-v"),
|
|
1086
1030
|
* Param.withDescription("Enable verbose output")
|
|
@@ -1104,8 +1048,6 @@ export const withDescription: {
|
|
|
1104
1048
|
* ```ts
|
|
1105
1049
|
* import { Param } from "effect/unstable/cli"
|
|
1106
1050
|
*
|
|
1107
|
-
* // @internal - this module is not exported publicly
|
|
1108
|
-
*
|
|
1109
1051
|
* const verbose = Param.boolean(Param.flagKind, "verbose").pipe(
|
|
1110
1052
|
* Param.withAlias("-v"),
|
|
1111
1053
|
* Param.withDescription("Enable verbose output")
|
|
@@ -1129,8 +1071,6 @@ export const withDescription: {
|
|
|
1129
1071
|
* ```ts
|
|
1130
1072
|
* import { Param } from "effect/unstable/cli"
|
|
1131
1073
|
*
|
|
1132
|
-
* // @internal - this module is not exported publicly
|
|
1133
|
-
*
|
|
1134
1074
|
* const verbose = Param.boolean(Param.flagKind, "verbose").pipe(
|
|
1135
1075
|
* Param.withAlias("-v"),
|
|
1136
1076
|
* Param.withDescription("Enable verbose output")
|
|
@@ -1163,8 +1103,6 @@ export const withDescription: {
|
|
|
1163
1103
|
* ```ts
|
|
1164
1104
|
* import { Param } from "effect/unstable/cli"
|
|
1165
1105
|
*
|
|
1166
|
-
* // @internal - this module is not exported publicly
|
|
1167
|
-
*
|
|
1168
1106
|
* const experimental = Param.boolean(Param.flagKind, "experimental-foo").pipe(
|
|
1169
1107
|
* Param.withHidden
|
|
1170
1108
|
* )
|
|
@@ -1188,8 +1126,6 @@ export const withHidden = <Kind extends ParamKind, A>(self: Param<Kind, A>): Par
|
|
|
1188
1126
|
* ```ts
|
|
1189
1127
|
* import { Param } from "effect/unstable/cli"
|
|
1190
1128
|
*
|
|
1191
|
-
* // @internal - this module is not exported publicly
|
|
1192
|
-
*
|
|
1193
1129
|
* const port = Param.integer(Param.flagKind, "port").pipe(
|
|
1194
1130
|
* Param.map((n) => ({ port: n, url: `http://localhost:${n}` }))
|
|
1195
1131
|
* )
|
|
@@ -1207,8 +1143,6 @@ export const map: {
|
|
|
1207
1143
|
* ```ts
|
|
1208
1144
|
* import { Param } from "effect/unstable/cli"
|
|
1209
1145
|
*
|
|
1210
|
-
* // @internal - this module is not exported publicly
|
|
1211
|
-
*
|
|
1212
1146
|
* const port = Param.integer(Param.flagKind, "port").pipe(
|
|
1213
1147
|
* Param.map((n) => ({ port: n, url: `http://localhost:${n}` }))
|
|
1214
1148
|
* )
|
|
@@ -1226,8 +1160,6 @@ export const map: {
|
|
|
1226
1160
|
* ```ts
|
|
1227
1161
|
* import { Param } from "effect/unstable/cli"
|
|
1228
1162
|
*
|
|
1229
|
-
* // @internal - this module is not exported publicly
|
|
1230
|
-
*
|
|
1231
1163
|
* const port = Param.integer(Param.flagKind, "port").pipe(
|
|
1232
1164
|
* Param.map((n) => ({ port: n, url: `http://localhost:${n}` }))
|
|
1233
1165
|
* )
|
|
@@ -1273,8 +1205,6 @@ const transform = <Kind extends ParamKind, A, B>(
|
|
|
1273
1205
|
* import { Effect } from "effect"
|
|
1274
1206
|
* import { CliError, Param } from "effect/unstable/cli"
|
|
1275
1207
|
*
|
|
1276
|
-
* // @internal - this module is not exported publicly
|
|
1277
|
-
*
|
|
1278
1208
|
* const validatedEmail = Param.string(Param.flagKind, "email").pipe(
|
|
1279
1209
|
* Param.mapEffect((email) =>
|
|
1280
1210
|
* email.includes("@")
|
|
@@ -1304,8 +1234,6 @@ export const mapEffect: {
|
|
|
1304
1234
|
* import { Effect } from "effect"
|
|
1305
1235
|
* import { CliError, Param } from "effect/unstable/cli"
|
|
1306
1236
|
*
|
|
1307
|
-
* // @internal - this module is not exported publicly
|
|
1308
|
-
*
|
|
1309
1237
|
* const validatedEmail = Param.string(Param.flagKind, "email").pipe(
|
|
1310
1238
|
* Param.mapEffect((email) =>
|
|
1311
1239
|
* email.includes("@")
|
|
@@ -1335,8 +1263,6 @@ export const mapEffect: {
|
|
|
1335
1263
|
* import { Effect } from "effect"
|
|
1336
1264
|
* import { CliError, Param } from "effect/unstable/cli"
|
|
1337
1265
|
*
|
|
1338
|
-
* // @internal - this module is not exported publicly
|
|
1339
|
-
*
|
|
1340
1266
|
* const validatedEmail = Param.string(Param.flagKind, "email").pipe(
|
|
1341
1267
|
* Param.mapEffect((email) =>
|
|
1342
1268
|
* email.includes("@")
|
|
@@ -1382,8 +1308,6 @@ export const mapEffect: {
|
|
|
1382
1308
|
* ```ts
|
|
1383
1309
|
* import { Param } from "effect/unstable/cli"
|
|
1384
1310
|
*
|
|
1385
|
-
* // @internal - this module is not exported publicly
|
|
1386
|
-
*
|
|
1387
1311
|
* const parsedJson = Param.string(Param.flagKind, "config").pipe(
|
|
1388
1312
|
* Param.mapTryCatch(
|
|
1389
1313
|
* (str) => JSON.parse(str),
|
|
@@ -1406,8 +1330,6 @@ export const mapTryCatch: {
|
|
|
1406
1330
|
* ```ts
|
|
1407
1331
|
* import { Param } from "effect/unstable/cli"
|
|
1408
1332
|
*
|
|
1409
|
-
* // @internal - this module is not exported publicly
|
|
1410
|
-
*
|
|
1411
1333
|
* const parsedJson = Param.string(Param.flagKind, "config").pipe(
|
|
1412
1334
|
* Param.mapTryCatch(
|
|
1413
1335
|
* (str) => JSON.parse(str),
|
|
@@ -1430,8 +1352,6 @@ export const mapTryCatch: {
|
|
|
1430
1352
|
* ```ts
|
|
1431
1353
|
* import { Param } from "effect/unstable/cli"
|
|
1432
1354
|
*
|
|
1433
|
-
* // @internal - this module is not exported publicly
|
|
1434
|
-
*
|
|
1435
1355
|
* const parsedJson = Param.string(Param.flagKind, "config").pipe(
|
|
1436
1356
|
* Param.mapTryCatch(
|
|
1437
1357
|
* (str) => JSON.parse(str),
|
|
@@ -1544,8 +1464,6 @@ export const optional = <Kind extends ParamKind, A>(
|
|
|
1544
1464
|
* ```ts
|
|
1545
1465
|
* import { Param } from "effect/unstable/cli"
|
|
1546
1466
|
*
|
|
1547
|
-
* // @internal - this module is not exported publicly
|
|
1548
|
-
*
|
|
1549
1467
|
* // Using the pipe operator to make an option optional
|
|
1550
1468
|
* const port = Param.integer(Param.flagKind, "port").pipe(
|
|
1551
1469
|
* Param.withDefault(8080)
|
|
@@ -1576,8 +1494,6 @@ export const withDefault: {
|
|
|
1576
1494
|
* ```ts
|
|
1577
1495
|
* import { Param } from "effect/unstable/cli"
|
|
1578
1496
|
*
|
|
1579
|
-
* // @internal - this module is not exported publicly
|
|
1580
|
-
*
|
|
1581
1497
|
* // Using the pipe operator to make an option optional
|
|
1582
1498
|
* const port = Param.integer(Param.flagKind, "port").pipe(
|
|
1583
1499
|
* Param.withDefault(8080)
|
|
@@ -1608,8 +1524,6 @@ export const withDefault: {
|
|
|
1608
1524
|
* ```ts
|
|
1609
1525
|
* import { Param } from "effect/unstable/cli"
|
|
1610
1526
|
*
|
|
1611
|
-
* // @internal - this module is not exported publicly
|
|
1612
|
-
*
|
|
1613
1527
|
* // Using the pipe operator to make an option optional
|
|
1614
1528
|
* const port = Param.integer(Param.flagKind, "port").pipe(
|
|
1615
1529
|
* Param.withDefault(8080)
|
|
@@ -1879,8 +1793,6 @@ export type VariadicParamOptions = {
|
|
|
1879
1793
|
* ```ts
|
|
1880
1794
|
* import { Param } from "effect/unstable/cli"
|
|
1881
1795
|
*
|
|
1882
|
-
* // @internal - this module is not exported publicly
|
|
1883
|
-
*
|
|
1884
1796
|
* // Basic variadic parameter (0 to infinity)
|
|
1885
1797
|
* const tags = Param.variadic(Param.string(Param.flagKind, "tag"))
|
|
1886
1798
|
*
|
|
@@ -1935,8 +1847,6 @@ export const variadic = <Kind extends ParamKind, A>(
|
|
|
1935
1847
|
* ```ts
|
|
1936
1848
|
* import { Param } from "effect/unstable/cli"
|
|
1937
1849
|
*
|
|
1938
|
-
* // @internal - this module is not exported publicly
|
|
1939
|
-
*
|
|
1940
1850
|
* // Allow 1-3 file inputs
|
|
1941
1851
|
* const files = Param.string(Param.flagKind, "file").pipe(
|
|
1942
1852
|
* Param.between(1, 3),
|
|
@@ -1972,8 +1882,6 @@ export const between: {
|
|
|
1972
1882
|
* ```ts
|
|
1973
1883
|
* import { Param } from "effect/unstable/cli"
|
|
1974
1884
|
*
|
|
1975
|
-
* // @internal - this module is not exported publicly
|
|
1976
|
-
*
|
|
1977
1885
|
* // Allow 1-3 file inputs
|
|
1978
1886
|
* const files = Param.string(Param.flagKind, "file").pipe(
|
|
1979
1887
|
* Param.between(1, 3),
|
|
@@ -2009,8 +1917,6 @@ export const between: {
|
|
|
2009
1917
|
* ```ts
|
|
2010
1918
|
* import { Param } from "effect/unstable/cli"
|
|
2011
1919
|
*
|
|
2012
|
-
* // @internal - this module is not exported publicly
|
|
2013
|
-
*
|
|
2014
1920
|
* // Allow 1-3 file inputs
|
|
2015
1921
|
* const files = Param.string(Param.flagKind, "file").pipe(
|
|
2016
1922
|
* Param.between(1, 3),
|
|
@@ -2057,8 +1963,6 @@ export const between: {
|
|
|
2057
1963
|
* ```ts
|
|
2058
1964
|
* import { Param } from "effect/unstable/cli"
|
|
2059
1965
|
*
|
|
2060
|
-
* // @internal - this module is not exported publicly
|
|
2061
|
-
*
|
|
2062
1966
|
* // Allow at most 3 warning suppressions
|
|
2063
1967
|
* const suppressions = Param.string(Param.flagKind, "suppress").pipe(
|
|
2064
1968
|
* Param.atMost(3)
|
|
@@ -2085,8 +1989,6 @@ export const atMost: {
|
|
|
2085
1989
|
* ```ts
|
|
2086
1990
|
* import { Param } from "effect/unstable/cli"
|
|
2087
1991
|
*
|
|
2088
|
-
* // @internal - this module is not exported publicly
|
|
2089
|
-
*
|
|
2090
1992
|
* // Allow at most 3 warning suppressions
|
|
2091
1993
|
* const suppressions = Param.string(Param.flagKind, "suppress").pipe(
|
|
2092
1994
|
* Param.atMost(3)
|
|
@@ -2113,8 +2015,6 @@ export const atMost: {
|
|
|
2113
2015
|
* ```ts
|
|
2114
2016
|
* import { Param } from "effect/unstable/cli"
|
|
2115
2017
|
*
|
|
2116
|
-
* // @internal - this module is not exported publicly
|
|
2117
|
-
*
|
|
2118
2018
|
* // Allow at most 3 warning suppressions
|
|
2119
2019
|
* const suppressions = Param.string(Param.flagKind, "suppress").pipe(
|
|
2120
2020
|
* Param.atMost(3)
|
|
@@ -2148,8 +2048,6 @@ export const atMost: {
|
|
|
2148
2048
|
* ```ts
|
|
2149
2049
|
* import { Param } from "effect/unstable/cli"
|
|
2150
2050
|
*
|
|
2151
|
-
* // @internal - this module is not exported publicly
|
|
2152
|
-
*
|
|
2153
2051
|
* // Require at least 2 input files
|
|
2154
2052
|
* const inputs = Param.string(Param.flagKind, "input").pipe(
|
|
2155
2053
|
* Param.atLeast(2),
|
|
@@ -2177,8 +2075,6 @@ export const atLeast: {
|
|
|
2177
2075
|
* ```ts
|
|
2178
2076
|
* import { Param } from "effect/unstable/cli"
|
|
2179
2077
|
*
|
|
2180
|
-
* // @internal - this module is not exported publicly
|
|
2181
|
-
*
|
|
2182
2078
|
* // Require at least 2 input files
|
|
2183
2079
|
* const inputs = Param.string(Param.flagKind, "input").pipe(
|
|
2184
2080
|
* Param.atLeast(2),
|
|
@@ -2206,8 +2102,6 @@ export const atLeast: {
|
|
|
2206
2102
|
* ```ts
|
|
2207
2103
|
* import { Param } from "effect/unstable/cli"
|
|
2208
2104
|
*
|
|
2209
|
-
* // @internal - this module is not exported publicly
|
|
2210
|
-
*
|
|
2211
2105
|
* // Require at least 2 input files
|
|
2212
2106
|
* const inputs = Param.string(Param.flagKind, "input").pipe(
|
|
2213
2107
|
* Param.atLeast(2),
|
|
@@ -2243,8 +2137,6 @@ export const atLeast: {
|
|
|
2243
2137
|
* ```ts
|
|
2244
2138
|
* import { Option } from "effect"
|
|
2245
2139
|
* import { Param } from "effect/unstable/cli"
|
|
2246
|
-
* // @internal - this module is not exported publicly
|
|
2247
|
-
*
|
|
2248
2140
|
* const positiveInt = Param.integer(Param.flagKind, "count").pipe(
|
|
2249
2141
|
* Param.filterMap(
|
|
2250
2142
|
* (n) => n > 0 ? Option.some(n) : Option.none(),
|
|
@@ -2271,8 +2163,6 @@ export const filterMap: {
|
|
|
2271
2163
|
* ```ts
|
|
2272
2164
|
* import { Option } from "effect"
|
|
2273
2165
|
* import { Param } from "effect/unstable/cli"
|
|
2274
|
-
* // @internal - this module is not exported publicly
|
|
2275
|
-
*
|
|
2276
2166
|
* const positiveInt = Param.integer(Param.flagKind, "count").pipe(
|
|
2277
2167
|
* Param.filterMap(
|
|
2278
2168
|
* (n) => n > 0 ? Option.some(n) : Option.none(),
|
|
@@ -2299,8 +2189,6 @@ export const filterMap: {
|
|
|
2299
2189
|
* ```ts
|
|
2300
2190
|
* import { Option } from "effect"
|
|
2301
2191
|
* import { Param } from "effect/unstable/cli"
|
|
2302
|
-
* // @internal - this module is not exported publicly
|
|
2303
|
-
*
|
|
2304
2192
|
* const positiveInt = Param.integer(Param.flagKind, "count").pipe(
|
|
2305
2193
|
* Param.filterMap(
|
|
2306
2194
|
* (n) => n > 0 ? Option.some(n) : Option.none(),
|
|
@@ -2347,8 +2235,6 @@ export const filterMap: {
|
|
|
2347
2235
|
* ```ts
|
|
2348
2236
|
* import { Param } from "effect/unstable/cli"
|
|
2349
2237
|
*
|
|
2350
|
-
* // @internal - this module is not exported publicly
|
|
2351
|
-
*
|
|
2352
2238
|
* const evenNumber = Param.integer(Param.flagKind, "num").pipe(
|
|
2353
2239
|
* Param.filter(
|
|
2354
2240
|
* (n) => n % 2 === 0,
|
|
@@ -2369,8 +2255,6 @@ export const filter: {
|
|
|
2369
2255
|
* ```ts
|
|
2370
2256
|
* import { Param } from "effect/unstable/cli"
|
|
2371
2257
|
*
|
|
2372
|
-
* // @internal - this module is not exported publicly
|
|
2373
|
-
*
|
|
2374
2258
|
* const evenNumber = Param.integer(Param.flagKind, "num").pipe(
|
|
2375
2259
|
* Param.filter(
|
|
2376
2260
|
* (n) => n % 2 === 0,
|
|
@@ -2391,8 +2275,6 @@ export const filter: {
|
|
|
2391
2275
|
* ```ts
|
|
2392
2276
|
* import { Param } from "effect/unstable/cli"
|
|
2393
2277
|
*
|
|
2394
|
-
* // @internal - this module is not exported publicly
|
|
2395
|
-
*
|
|
2396
2278
|
* const evenNumber = Param.integer(Param.flagKind, "num").pipe(
|
|
2397
2279
|
* Param.filter(
|
|
2398
2280
|
* (n) => n % 2 === 0,
|
|
@@ -2428,8 +2310,6 @@ export const filter: {
|
|
|
2428
2310
|
* ```ts
|
|
2429
2311
|
* import { Param } from "effect/unstable/cli"
|
|
2430
2312
|
*
|
|
2431
|
-
* // @internal - this module is not exported publicly
|
|
2432
|
-
*
|
|
2433
2313
|
* const port = Param.integer(Param.flagKind, "port").pipe(
|
|
2434
2314
|
* Param.withMetavar("PORT"),
|
|
2435
2315
|
* Param.filter(
|
|
@@ -2456,8 +2336,6 @@ export const withMetavar: {
|
|
|
2456
2336
|
* ```ts
|
|
2457
2337
|
* import { Param } from "effect/unstable/cli"
|
|
2458
2338
|
*
|
|
2459
|
-
* // @internal - this module is not exported publicly
|
|
2460
|
-
*
|
|
2461
2339
|
* const port = Param.integer(Param.flagKind, "port").pipe(
|
|
2462
2340
|
* Param.withMetavar("PORT"),
|
|
2463
2341
|
* Param.filter(
|
|
@@ -2484,8 +2362,6 @@ export const withMetavar: {
|
|
|
2484
2362
|
* ```ts
|
|
2485
2363
|
* import { Param } from "effect/unstable/cli"
|
|
2486
2364
|
*
|
|
2487
|
-
* // @internal - this module is not exported publicly
|
|
2488
|
-
*
|
|
2489
2365
|
* const port = Param.integer(Param.flagKind, "port").pipe(
|
|
2490
2366
|
* Param.withMetavar("PORT"),
|
|
2491
2367
|
* Param.filter(
|
|
@@ -2517,8 +2393,6 @@ export const withMetavar: {
|
|
|
2517
2393
|
* ```ts
|
|
2518
2394
|
* import { Schema } from "effect"
|
|
2519
2395
|
* import { Param } from "effect/unstable/cli"
|
|
2520
|
-
* // @internal - this module is not exported publicly
|
|
2521
|
-
*
|
|
2522
2396
|
* const isEmail = Schema.isPattern(/^[^\s@]+@[^\s@]+\.[^\s@]+$/)
|
|
2523
2397
|
*
|
|
2524
2398
|
* const Email = Schema.String.pipe(
|
|
@@ -2542,8 +2416,6 @@ export const withSchema: {
|
|
|
2542
2416
|
* ```ts
|
|
2543
2417
|
* import { Schema } from "effect"
|
|
2544
2418
|
* import { Param } from "effect/unstable/cli"
|
|
2545
|
-
* // @internal - this module is not exported publicly
|
|
2546
|
-
*
|
|
2547
2419
|
* const isEmail = Schema.isPattern(/^[^\s@]+@[^\s@]+\.[^\s@]+$/)
|
|
2548
2420
|
*
|
|
2549
2421
|
* const Email = Schema.String.pipe(
|
|
@@ -2558,7 +2430,9 @@ export const withSchema: {
|
|
|
2558
2430
|
* @category combinators
|
|
2559
2431
|
* @since 4.0.0
|
|
2560
2432
|
*/
|
|
2561
|
-
<A, B>(schema: Schema.Codec<B, A>): <Kind extends ParamKind>(
|
|
2433
|
+
<A, B>(schema: Schema.Codec<B, A, Environment, Environment>): <Kind extends ParamKind>(
|
|
2434
|
+
self: Param<Kind, A>
|
|
2435
|
+
) => Param<Kind, B>
|
|
2562
2436
|
/**
|
|
2563
2437
|
* Validates parsed values against a Schema, providing detailed error messages.
|
|
2564
2438
|
*
|
|
@@ -2567,8 +2441,6 @@ export const withSchema: {
|
|
|
2567
2441
|
* ```ts
|
|
2568
2442
|
* import { Schema } from "effect"
|
|
2569
2443
|
* import { Param } from "effect/unstable/cli"
|
|
2570
|
-
* // @internal - this module is not exported publicly
|
|
2571
|
-
*
|
|
2572
2444
|
* const isEmail = Schema.isPattern(/^[^\s@]+@[^\s@]+\.[^\s@]+$/)
|
|
2573
2445
|
*
|
|
2574
2446
|
* const Email = Schema.String.pipe(
|
|
@@ -2583,7 +2455,7 @@ export const withSchema: {
|
|
|
2583
2455
|
* @category combinators
|
|
2584
2456
|
* @since 4.0.0
|
|
2585
2457
|
*/
|
|
2586
|
-
<Kind extends ParamKind, A, B>(self: Param<Kind, A>, schema: Schema.Codec<B, A>): Param<Kind, B>
|
|
2458
|
+
<Kind extends ParamKind, A, B>(self: Param<Kind, A>, schema: Schema.Codec<B, A, Environment, Environment>): Param<Kind, B>
|
|
2587
2459
|
} = dual(2, <Kind extends ParamKind, A, B>(
|
|
2588
2460
|
self: Param<Kind, A>,
|
|
2589
2461
|
schema: Schema.Codec<B, A>
|
|
@@ -2609,8 +2481,6 @@ export const withSchema: {
|
|
|
2609
2481
|
* ```ts
|
|
2610
2482
|
* import { Param } from "effect/unstable/cli"
|
|
2611
2483
|
*
|
|
2612
|
-
* // @internal - this module is not exported publicly
|
|
2613
|
-
*
|
|
2614
2484
|
* const config = Param.file(Param.flagKind, "config").pipe(
|
|
2615
2485
|
* Param.orElse(() => Param.string(Param.flagKind, "config-url"))
|
|
2616
2486
|
* )
|
|
@@ -2628,8 +2498,6 @@ export const orElse: {
|
|
|
2628
2498
|
* ```ts
|
|
2629
2499
|
* import { Param } from "effect/unstable/cli"
|
|
2630
2500
|
*
|
|
2631
|
-
* // @internal - this module is not exported publicly
|
|
2632
|
-
*
|
|
2633
2501
|
* const config = Param.file(Param.flagKind, "config").pipe(
|
|
2634
2502
|
* Param.orElse(() => Param.string(Param.flagKind, "config-url"))
|
|
2635
2503
|
* )
|
|
@@ -2647,8 +2515,6 @@ export const orElse: {
|
|
|
2647
2515
|
* ```ts
|
|
2648
2516
|
* import { Param } from "effect/unstable/cli"
|
|
2649
2517
|
*
|
|
2650
|
-
* // @internal - this module is not exported publicly
|
|
2651
|
-
*
|
|
2652
2518
|
* const config = Param.file(Param.flagKind, "config").pipe(
|
|
2653
2519
|
* Param.orElse(() => Param.string(Param.flagKind, "config-url"))
|
|
2654
2520
|
* )
|
|
@@ -2681,8 +2547,6 @@ export const orElse: {
|
|
|
2681
2547
|
* ```ts
|
|
2682
2548
|
* import { Param } from "effect/unstable/cli"
|
|
2683
2549
|
*
|
|
2684
|
-
* // @internal - this module is not exported publicly
|
|
2685
|
-
*
|
|
2686
2550
|
* const configSource = Param.file(Param.flagKind, "config").pipe(
|
|
2687
2551
|
* Param.orElseResult(() => Param.string(Param.flagKind, "config-url"))
|
|
2688
2552
|
* )
|
|
@@ -2707,8 +2571,6 @@ export const orElseResult: {
|
|
|
2707
2571
|
* ```ts
|
|
2708
2572
|
* import { Param } from "effect/unstable/cli"
|
|
2709
2573
|
*
|
|
2710
|
-
* // @internal - this module is not exported publicly
|
|
2711
|
-
*
|
|
2712
2574
|
* const configSource = Param.file(Param.flagKind, "config").pipe(
|
|
2713
2575
|
* Param.orElseResult(() => Param.string(Param.flagKind, "config-url"))
|
|
2714
2576
|
* )
|
|
@@ -2733,8 +2595,6 @@ export const orElseResult: {
|
|
|
2733
2595
|
* ```ts
|
|
2734
2596
|
* import { Param } from "effect/unstable/cli"
|
|
2735
2597
|
*
|
|
2736
|
-
* // @internal - this module is not exported publicly
|
|
2737
|
-
*
|
|
2738
2598
|
* const configSource = Param.file(Param.flagKind, "config").pipe(
|
|
2739
2599
|
* Param.orElseResult(() => Param.string(Param.flagKind, "config-url"))
|
|
2740
2600
|
* )
|
|
@@ -24,6 +24,7 @@ import * as Schema from "../../Schema.ts"
|
|
|
24
24
|
import type { Formatter } from "../../SchemaIssue.ts"
|
|
25
25
|
import type * as Struct from "../../Struct.ts"
|
|
26
26
|
import type { Covariant } from "../../Types.ts"
|
|
27
|
+
import type { Environment } from "./Command.ts"
|
|
27
28
|
|
|
28
29
|
const TypeId = "~effect/cli/Primitive"
|
|
29
30
|
|
|
@@ -58,7 +59,7 @@ const TypeId = "~effect/cli/Primitive"
|
|
|
58
59
|
*/
|
|
59
60
|
export interface Primitive<out A> extends Primitive.Variance<A> {
|
|
60
61
|
readonly _tag: string
|
|
61
|
-
readonly parse: (value: string) => Effect.Effect<A, string,
|
|
62
|
+
readonly parse: (value: string) => Effect.Effect<A, string, Environment>
|
|
62
63
|
}
|
|
63
64
|
|
|
64
65
|
/**
|
|
@@ -97,9 +98,7 @@ export const isBoolean = (p: Primitive<unknown>): p is Primitive<boolean> => p._
|
|
|
97
98
|
|
|
98
99
|
const makePrimitive = <A>(
|
|
99
100
|
tag: string,
|
|
100
|
-
parse: (
|
|
101
|
-
value: string
|
|
102
|
-
) => Effect.Effect<A, string, FileSystem.FileSystem | Path.Path>
|
|
101
|
+
parse: (value: string) => Effect.Effect<A, string, Environment>
|
|
103
102
|
): Primitive<A> =>
|
|
104
103
|
Object.assign(Object.create(Proto), {
|
|
105
104
|
_tag: tag,
|
|
@@ -108,7 +107,7 @@ const makePrimitive = <A>(
|
|
|
108
107
|
|
|
109
108
|
const makeSchemaPrimitive = <T, E>(
|
|
110
109
|
tag: string,
|
|
111
|
-
schema: Schema.Codec<T, E>
|
|
110
|
+
schema: Schema.Codec<T, E, Environment, Environment>
|
|
112
111
|
): Primitive<T> => {
|
|
113
112
|
const toCodecStringTree = Schema.toCodecStringTree(schema)
|
|
114
113
|
const decode = Schema.decodeUnknownEffect(toCodecStringTree)
|
|
@@ -614,7 +613,7 @@ export type FileSchemaOptions = Struct.Simplify<
|
|
|
614
613
|
* @since 4.0.0
|
|
615
614
|
*/
|
|
616
615
|
export const fileSchema = <A>(
|
|
617
|
-
schema: Schema.
|
|
616
|
+
schema: Schema.ConstraintDecoder<A, Environment>,
|
|
618
617
|
options?: FileSchemaOptions | undefined
|
|
619
618
|
): Primitive<A> => {
|
|
620
619
|
const decode = Schema.decodeUnknownEffect(schema)
|