effect 4.0.0-beta.25 → 4.0.0-beta.26
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/Config.js +4 -4
- package/dist/Config.js.map +1 -1
- package/dist/Effect.d.ts +20 -13
- package/dist/Effect.d.ts.map +1 -1
- package/dist/Effect.js +2 -1
- package/dist/Effect.js.map +1 -1
- package/dist/Runtime.d.ts +66 -0
- package/dist/Runtime.d.ts.map +1 -1
- package/dist/Runtime.js +72 -5
- package/dist/Runtime.js.map +1 -1
- package/dist/Schema.d.ts +15 -32
- package/dist/Schema.d.ts.map +1 -1
- package/dist/Schema.js +9 -17
- package/dist/Schema.js.map +1 -1
- package/dist/SchemaAST.js +91 -2
- package/dist/SchemaAST.js.map +1 -1
- package/dist/SchemaGetter.d.ts +3 -3
- package/dist/SchemaRepresentation.d.ts.map +1 -1
- package/dist/SchemaRepresentation.js +12 -8
- package/dist/SchemaRepresentation.js.map +1 -1
- package/dist/Stdio.d.ts +10 -2
- package/dist/Stdio.d.ts.map +1 -1
- package/dist/Stdio.js +18 -0
- package/dist/Stdio.js.map +1 -1
- package/dist/internal/schema/representation.js +7 -3
- package/dist/internal/schema/representation.js.map +1 -1
- package/dist/internal/schema/to-codec.js +7 -10
- package/dist/internal/schema/to-codec.js.map +1 -1
- package/dist/unstable/ai/AiError.d.ts +6 -3
- package/dist/unstable/ai/AiError.d.ts.map +1 -1
- package/dist/unstable/ai/AiError.js +8 -4
- package/dist/unstable/ai/AiError.js.map +1 -1
- package/dist/unstable/ai/LanguageModel.js +7 -5
- package/dist/unstable/ai/LanguageModel.js.map +1 -1
- package/dist/unstable/cli/CliError.d.ts +19 -52
- package/dist/unstable/cli/CliError.d.ts.map +1 -1
- package/dist/unstable/cli/CliError.js +21 -53
- package/dist/unstable/cli/CliError.js.map +1 -1
- package/dist/unstable/cli/Command.d.ts +117 -62
- package/dist/unstable/cli/Command.d.ts.map +1 -1
- package/dist/unstable/cli/Command.js +95 -32
- package/dist/unstable/cli/Command.js.map +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts +1 -1
- package/dist/unstable/cli/GlobalFlag.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.d.ts +27 -10
- package/dist/unstable/cli/internal/command.d.ts.map +1 -1
- package/dist/unstable/cli/internal/command.js +40 -23
- package/dist/unstable/cli/internal/command.js.map +1 -1
- package/dist/unstable/cli/internal/config.js +42 -0
- package/dist/unstable/cli/internal/config.js.map +1 -1
- package/dist/unstable/cli/internal/help.d.ts +4 -4
- package/dist/unstable/cli/internal/help.d.ts.map +1 -1
- package/dist/unstable/cli/internal/help.js +25 -7
- package/dist/unstable/cli/internal/help.js.map +1 -1
- package/dist/unstable/cli/internal/parser.js +26 -6
- package/dist/unstable/cli/internal/parser.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiBuilder.js +1 -7
- package/dist/unstable/httpapi/HttpApiBuilder.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiClient.d.ts +6 -6
- 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 +10 -10
- package/dist/unstable/httpapi/HttpApiEndpoint.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiEndpoint.js +2 -2
- package/dist/unstable/httpapi/HttpApiEndpoint.js.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.d.ts +6 -15
- package/dist/unstable/httpapi/HttpApiError.d.ts.map +1 -1
- package/dist/unstable/httpapi/HttpApiError.js +16 -21
- package/dist/unstable/httpapi/HttpApiError.js.map +1 -1
- package/dist/unstable/reactivity/Atom.d.ts +56 -0
- package/dist/unstable/reactivity/Atom.d.ts.map +1 -1
- package/dist/unstable/reactivity/Atom.js +66 -0
- package/dist/unstable/reactivity/Atom.js.map +1 -1
- package/dist/unstable/reactivity/AtomHttpApi.d.ts +2 -2
- package/dist/unstable/reactivity/AtomHttpApi.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.d.ts +3 -0
- package/dist/unstable/rpc/RpcServer.d.ts.map +1 -1
- package/dist/unstable/rpc/RpcServer.js.map +1 -1
- package/dist/unstable/sql/SqlSchema.d.ts +2 -2
- package/dist/unstable/sql/SqlSchema.d.ts.map +1 -1
- package/dist/unstable/sql/SqlSchema.js.map +1 -1
- package/package.json +1 -1
- package/src/Config.ts +4 -4
- package/src/Effect.ts +29 -9
- package/src/Runtime.ts +95 -5
- package/src/Schema.ts +20 -52
- package/src/SchemaAST.ts +127 -2
- package/src/SchemaGetter.ts +3 -3
- package/src/SchemaRepresentation.ts +12 -8
- package/src/Stdio.ts +21 -2
- package/src/internal/schema/representation.ts +8 -4
- package/src/internal/schema/to-codec.ts +7 -17
- package/src/unstable/ai/AiError.ts +8 -4
- package/src/unstable/ai/LanguageModel.ts +8 -5
- package/src/unstable/cli/CliError.ts +43 -55
- package/src/unstable/cli/Command.ts +348 -180
- package/src/unstable/cli/GlobalFlag.ts +1 -1
- package/src/unstable/cli/internal/command.ts +62 -32
- package/src/unstable/cli/internal/config.ts +49 -0
- package/src/unstable/cli/internal/help.ts +41 -16
- package/src/unstable/cli/internal/parser.ts +36 -10
- package/src/unstable/httpapi/HttpApiBuilder.ts +1 -7
- package/src/unstable/httpapi/HttpApiClient.ts +6 -6
- package/src/unstable/httpapi/HttpApiEndpoint.ts +4 -4
- package/src/unstable/httpapi/HttpApiError.ts +23 -21
- package/src/unstable/reactivity/Atom.ts +132 -0
- package/src/unstable/reactivity/AtomHttpApi.ts +2 -2
- package/src/unstable/rpc/RpcServer.ts +5 -0
- package/src/unstable/sql/SqlSchema.ts +2 -2
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* @since 4.0.0
|
|
3
3
|
*/
|
|
4
4
|
import * as Predicate from "../../Predicate.ts"
|
|
5
|
+
import * as Runtime from "../../Runtime.ts"
|
|
5
6
|
import * as Schema from "../../Schema.ts"
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -386,61 +387,6 @@ export class UnknownSubcommand extends Schema.ErrorClass(`${TypeId}/UnknownSubco
|
|
|
386
387
|
}
|
|
387
388
|
}
|
|
388
389
|
|
|
389
|
-
/**
|
|
390
|
-
* Control flow indicator when help is requested via --help flag.
|
|
391
|
-
* This is not an error but uses the error channel for control flow.
|
|
392
|
-
*
|
|
393
|
-
* @example
|
|
394
|
-
* ```ts
|
|
395
|
-
* import { Effect } from "effect"
|
|
396
|
-
* import { CliError } from "effect/unstable/cli"
|
|
397
|
-
*
|
|
398
|
-
* const showHelpIndicator = new CliError.ShowHelp({
|
|
399
|
-
* commandPath: ["myapp", "deploy", "production"]
|
|
400
|
-
* })
|
|
401
|
-
*
|
|
402
|
-
* console.log(showHelpIndicator.message)
|
|
403
|
-
* // "Help requested"
|
|
404
|
-
*
|
|
405
|
-
* // In help flag handling
|
|
406
|
-
* const handleHelpFlag = (hasHelpFlag: boolean) =>
|
|
407
|
-
* Effect.gen(function*() {
|
|
408
|
-
* if (hasHelpFlag) {
|
|
409
|
-
* return yield* Effect.fail(showHelpIndicator)
|
|
410
|
-
* }
|
|
411
|
-
* return "continuing with command"
|
|
412
|
-
* })
|
|
413
|
-
*
|
|
414
|
-
* // In error handling
|
|
415
|
-
* const handleCliErrors = (error: CliError.CliError): void => {
|
|
416
|
-
* if (error._tag === "ShowHelp") {
|
|
417
|
-
* // Display help for the command path
|
|
418
|
-
* console.log(`Displaying help for: ${error.commandPath.join(" ")}`)
|
|
419
|
-
* }
|
|
420
|
-
* // Handle other errors...
|
|
421
|
-
* }
|
|
422
|
-
* ```
|
|
423
|
-
*
|
|
424
|
-
* @since 4.0.0
|
|
425
|
-
* @category models
|
|
426
|
-
*/
|
|
427
|
-
export class ShowHelp extends Schema.ErrorClass(`${TypeId}/ShowHelp`)({
|
|
428
|
-
_tag: Schema.tag("ShowHelp"),
|
|
429
|
-
commandPath: Schema.Array(Schema.String)
|
|
430
|
-
}) {
|
|
431
|
-
/**
|
|
432
|
-
* @since 4.0.0
|
|
433
|
-
*/
|
|
434
|
-
readonly [TypeId] = TypeId
|
|
435
|
-
|
|
436
|
-
/**
|
|
437
|
-
* @since 4.0.0
|
|
438
|
-
*/
|
|
439
|
-
override get message() {
|
|
440
|
-
return "Help requested"
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
|
|
444
390
|
/**
|
|
445
391
|
* Wrapper for user (handler) errors to unify under CLI error channel when desired.
|
|
446
392
|
*
|
|
@@ -485,3 +431,45 @@ export class UserError extends Schema.ErrorClass(`${TypeId}/UserError`)({
|
|
|
485
431
|
*/
|
|
486
432
|
readonly [TypeId] = TypeId
|
|
487
433
|
}
|
|
434
|
+
|
|
435
|
+
const NonShowHelpErrors: Schema.Union<
|
|
436
|
+
readonly [
|
|
437
|
+
typeof UnrecognizedOption,
|
|
438
|
+
typeof DuplicateOption,
|
|
439
|
+
typeof MissingOption,
|
|
440
|
+
typeof MissingArgument,
|
|
441
|
+
typeof InvalidValue,
|
|
442
|
+
typeof UnknownSubcommand,
|
|
443
|
+
typeof UserError
|
|
444
|
+
]
|
|
445
|
+
> = Schema.Union([
|
|
446
|
+
UnrecognizedOption,
|
|
447
|
+
DuplicateOption,
|
|
448
|
+
MissingOption,
|
|
449
|
+
MissingArgument,
|
|
450
|
+
InvalidValue,
|
|
451
|
+
UnknownSubcommand,
|
|
452
|
+
UserError
|
|
453
|
+
])
|
|
454
|
+
|
|
455
|
+
/**
|
|
456
|
+
* Control flow indicator when help is requested via --help flag.
|
|
457
|
+
* This is not an error but uses the error channel for control flow.
|
|
458
|
+
*
|
|
459
|
+
* @since 4.0.0
|
|
460
|
+
* @category models
|
|
461
|
+
*/
|
|
462
|
+
export class ShowHelp extends Schema.ErrorClass(`${TypeId}/ShowHelp`)({
|
|
463
|
+
_tag: Schema.tag("ShowHelp"),
|
|
464
|
+
commandPath: Schema.Array(Schema.String),
|
|
465
|
+
errors: Schema.Array(NonShowHelpErrors)
|
|
466
|
+
}) {
|
|
467
|
+
readonly [TypeId] = TypeId
|
|
468
|
+
|
|
469
|
+
override readonly [Runtime.errorExitCode] = this.errors.length ? 1 : 0
|
|
470
|
+
override readonly [Runtime.errorReported] = false
|
|
471
|
+
|
|
472
|
+
override get message() {
|
|
473
|
+
return "Help requested"
|
|
474
|
+
}
|
|
475
|
+
}
|