@navios/commander 1.5.0 → 1.5.1
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/.turbo/turbo-build.log +49 -0
- package/.turbo/turbo-check.log +2 -0
- package/.turbo/turbo-lint.log +3 -0
- package/.turbo/turbo-test$colon$ci.log +117 -0
- package/CHANGELOG.md +3 -3
- package/README.md +8 -16
- package/dist/src/commander.factory.d.mts +126 -122
- package/dist/src/commander.factory.d.mts.map +1 -1
- package/dist/src/commands/help.command.d.mts +15 -11
- package/dist/src/commands/help.command.d.mts.map +1 -1
- package/dist/src/commands/index.d.mts +2 -2
- package/dist/src/decorators/cli-module.decorator.d.mts +51 -40
- package/dist/src/decorators/cli-module.decorator.d.mts.map +1 -1
- package/dist/src/decorators/command.decorator.d.mts +49 -37
- package/dist/src/decorators/command.decorator.d.mts.map +1 -1
- package/dist/src/decorators/index.d.mts +3 -3
- package/dist/src/define-environment.d.mts +9 -8
- package/dist/src/define-environment.d.mts.map +1 -1
- package/dist/src/index.d.mts +10 -10
- package/dist/src/interfaces/abstract-cli-adapter.interface.d.mts +45 -45
- package/dist/src/interfaces/command-handler.interface.d.mts +9 -9
- package/dist/src/interfaces/commander-execution-context.interface.d.mts +30 -30
- package/dist/src/interfaces/commander-execution-context.interface.d.mts.map +1 -1
- package/dist/src/interfaces/environment.interface.d.mts +7 -7
- package/dist/src/interfaces/index.d.mts +5 -5
- package/dist/src/legacy-compat/decorators/cli-module.decorator.d.mts +6 -5
- package/dist/src/legacy-compat/decorators/cli-module.decorator.d.mts.map +1 -1
- package/dist/src/legacy-compat/decorators/command.decorator.d.mts +7 -6
- package/dist/src/legacy-compat/decorators/command.decorator.d.mts.map +1 -1
- package/dist/src/legacy-compat/decorators/index.d.mts +3 -3
- package/dist/src/legacy-compat/index.d.mts +3 -3
- package/dist/src/metadata/command-entry.metadata.d.mts +5 -5
- package/dist/src/metadata/command-entry.metadata.d.mts.map +1 -1
- package/dist/src/metadata/command.metadata.d.mts +30 -24
- package/dist/src/metadata/command.metadata.d.mts.map +1 -1
- package/dist/src/metadata/index.d.mts +3 -3
- package/dist/src/overrides/help.command.d.mts +15 -11
- package/dist/src/overrides/help.command.d.mts.map +1 -1
- package/dist/src/services/cli-parser.service.d.mts +54 -54
- package/dist/src/services/cli-parser.service.d.mts.map +1 -1
- package/dist/src/services/command-registry.service.d.mts +75 -74
- package/dist/src/services/command-registry.service.d.mts.map +1 -1
- package/dist/src/services/commander-adapter.service.d.mts +49 -48
- package/dist/src/services/commander-adapter.service.d.mts.map +1 -1
- package/dist/src/services/index.d.mts +4 -4
- package/dist/src/tokens/execution-context.token.d.mts +9 -4
- package/dist/src/tokens/execution-context.token.d.mts.map +1 -1
- package/dist/src/tokens/help-command.token.d.mts +5 -4
- package/dist/src/tokens/index.d.mts +2 -2
- package/dist/src/utils/index.d.mts +2 -2
- package/dist/src/utils/runtime.d.mts +2 -2
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/tsdown.config.d.mts +3 -3
- package/dist/vitest.config.d.mts +3 -3
- package/lib/{cli-module.decorator-CRaNGvgl.d.cts → cli-module.decorator-BzsOEMPH.d.cts} +54 -53
- package/lib/cli-module.decorator-BzsOEMPH.d.cts.map +1 -0
- package/lib/{cli-module.decorator-bsP5gEn7.d.mts → cli-module.decorator-CCV_elPP.d.mts} +116 -115
- package/lib/cli-module.decorator-CCV_elPP.d.mts.map +1 -0
- package/lib/{cli-module.decorator-CkP22084.cjs → cli-module.decorator-CXt38aqF.cjs} +2 -2
- package/lib/cli-module.decorator-CXt38aqF.cjs.map +1 -0
- package/lib/{cli-module.decorator-UGbtkRYc.mjs → cli-module.decorator-DAjf_r_W.mjs} +2 -2
- package/lib/cli-module.decorator-DAjf_r_W.mjs.map +1 -0
- package/lib/{command.decorator-UrNJmQN0.cjs → command.decorator-HziankUv.cjs} +3 -3
- package/lib/command.decorator-HziankUv.cjs.map +1 -0
- package/lib/{command.decorator-DVLSAqYZ.mjs → command.decorator-QiRU7ny3.mjs} +3 -3
- package/lib/command.decorator-QiRU7ny3.mjs.map +1 -0
- package/lib/{help-command.token-CMWYI6em.cjs → help-command.token-DamE31Aw.cjs} +4 -4
- package/lib/{help-command.token-CMWYI6em.cjs.map → help-command.token-DamE31Aw.cjs.map} +1 -1
- package/lib/{help-command.token-C0Kgj60o.mjs → help-command.token-XHx3WkoD.mjs} +4 -4
- package/lib/{help-command.token-C0Kgj60o.mjs.map → help-command.token-XHx3WkoD.mjs.map} +1 -1
- package/lib/{help.command-dtZbhq0w.mjs → help.command-Bynoll_7.mjs} +5 -8
- package/lib/help.command-Bynoll_7.mjs.map +1 -0
- package/lib/{help.command-DQyv6ali.cjs → help.command-DvKmMpB7.cjs} +6 -9
- package/lib/help.command-DvKmMpB7.cjs.map +1 -0
- package/lib/index.cjs +102 -102
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +283 -283
- package/lib/index.d.cts.map +1 -1
- package/lib/index.d.mts +221 -221
- package/lib/index.d.mts.map +1 -1
- package/lib/index.mjs +101 -101
- package/lib/index.mjs.map +1 -1
- package/lib/legacy-compat/index.cjs +6 -28
- package/lib/legacy-compat/index.cjs.map +1 -1
- package/lib/legacy-compat/index.d.cts +3 -2
- package/lib/legacy-compat/index.d.cts.map +1 -1
- package/lib/legacy-compat/index.d.mts +3 -2
- package/lib/legacy-compat/index.d.mts.map +1 -1
- package/lib/legacy-compat/index.mjs +4 -25
- package/lib/legacy-compat/index.mjs.map +1 -1
- package/package.json +26 -16
- package/src/__tests__/commander.factory.e2e.spec.mts +22 -66
- package/src/commands/help.command.mts +1 -1
- package/src/decorators/cli-module.decorator.mts +4 -9
- package/src/decorators/command.decorator.mts +4 -4
- package/src/define-environment.mts +4 -4
- package/src/interfaces/command-handler.interface.mts +1 -1
- package/src/interfaces/commander-execution-context.interface.mts +1 -1
- package/src/legacy-compat/decorators/cli-module.decorator.mts +2 -1
- package/src/legacy-compat/decorators/command.decorator.mts +3 -2
- package/src/metadata/command-entry.metadata.mts +3 -6
- package/src/metadata/command.metadata.mts +6 -8
- package/src/overrides/help.command.mts +2 -2
- package/src/services/__tests__/cli-parser.service.spec.mts +23 -178
- package/src/services/cli-parser.service.mts +23 -27
- package/src/services/command-registry.service.mts +5 -5
- package/src/services/commander-adapter.service.mts +10 -27
- package/src/tokens/execution-context.token.mts +4 -6
- package/tsconfig.json +3 -0
- package/lib/cli-module.decorator-CRaNGvgl.d.cts.map +0 -1
- package/lib/cli-module.decorator-CkP22084.cjs.map +0 -1
- package/lib/cli-module.decorator-UGbtkRYc.mjs.map +0 -1
- package/lib/cli-module.decorator-bsP5gEn7.d.mts.map +0 -1
- package/lib/command.decorator-DVLSAqYZ.mjs.map +0 -1
- package/lib/command.decorator-UrNJmQN0.cjs.map +0 -1
- package/lib/help.command-DQyv6ali.cjs.map +0 -1
- package/lib/help.command-dtZbhq0w.mjs.map +0 -1
- package/project.json +0 -66
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import type { ClassType, Registry } from '@navios/core'
|
|
1
|
+
import type { ClassType, Registry } from '@navios/core'
|
|
2
2
|
/**
|
|
3
3
|
* Options for the `@CliModule` decorator.
|
|
4
4
|
*
|
|
5
5
|
* @public
|
|
6
6
|
*/
|
|
7
7
|
export interface CliModuleOptions {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
8
|
+
/**
|
|
9
|
+
* Array or Set of command classes to register in this module.
|
|
10
|
+
* Commands must be decorated with `@Command`.
|
|
11
|
+
*/
|
|
12
|
+
commands?: ClassType[] | Set<ClassType>
|
|
13
|
+
/**
|
|
14
|
+
* Array or Set of controller classes for HTTP endpoints.
|
|
15
|
+
* Allows mixing HTTP and CLI functionality in the same module.
|
|
16
|
+
*/
|
|
17
|
+
controllers?: ClassType[] | Set<ClassType>
|
|
18
|
+
/**
|
|
19
|
+
* Array or Set of other modules to import.
|
|
20
|
+
* Imported modules' commands and controllers will be available.
|
|
21
|
+
*/
|
|
22
|
+
imports?: ClassType[] | Set<ClassType>
|
|
23
|
+
/**
|
|
24
|
+
* Guards to apply to all controllers in this module.
|
|
25
|
+
* Guards are executed in reverse order (last guard first).
|
|
26
|
+
*/
|
|
27
|
+
guards?: ClassType[] | Set<ClassType>
|
|
28
|
+
/**
|
|
29
|
+
* Service override classes to import for side effects.
|
|
30
|
+
* These classes are imported to ensure their @Injectable decorators execute,
|
|
31
|
+
* allowing them to register with the DI system. Overrides should use the same
|
|
32
|
+
* InjectionToken as the original service with a higher priority.
|
|
33
|
+
*/
|
|
34
|
+
overrides?: ClassType[] | Set<ClassType>
|
|
35
|
+
/**
|
|
36
|
+
* Priority level for the module.
|
|
37
|
+
* Higher priority modules will be loaded first.
|
|
38
|
+
*/
|
|
39
|
+
priority?: number
|
|
40
|
+
/**
|
|
41
|
+
* Registry to use for the module.
|
|
42
|
+
* Registry is used to store the module and its commands.
|
|
43
|
+
*/
|
|
44
|
+
registry?: Registry
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
47
|
* Decorator that marks a class as a CLI module.
|
|
@@ -80,5 +80,16 @@ export interface CliModuleOptions {
|
|
|
80
80
|
* export class AppModule {}
|
|
81
81
|
* ```
|
|
82
82
|
*/
|
|
83
|
-
export declare function CliModule({
|
|
84
|
-
|
|
83
|
+
export declare function CliModule({
|
|
84
|
+
commands,
|
|
85
|
+
controllers,
|
|
86
|
+
imports,
|
|
87
|
+
guards,
|
|
88
|
+
overrides,
|
|
89
|
+
priority,
|
|
90
|
+
registry,
|
|
91
|
+
}?: CliModuleOptions): (
|
|
92
|
+
target: ClassType,
|
|
93
|
+
context: ClassDecoratorContext<abstract new (...args: any) => any>,
|
|
94
|
+
) => ClassType
|
|
95
|
+
//# sourceMappingURL=cli-module.decorator.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-module.decorator.d.mts","sourceRoot":"","sources":["../../../src/decorators/cli-module.decorator.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli-module.decorator.d.mts","sourceRoot":"","sources":["../../../src/decorators/cli-module.decorator.mts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAIvD;;;;GAIG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,EAAE,GAAG,GAAG,CAAC,SAAS,CAAC,CAAA;IACvC;;;OAGG;IACH,WAAW,CAAC,EAAE,SAAS,EAAE,GAAG,GAAG,CAAC,SAAS,CAAC,CAAA;IAC1C;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,EAAE,GAAG,GAAG,CAAC,SAAS,CAAC,CAAA;IACtC;;;OAGG;IACH,MAAM,CAAC,EAAE,SAAS,EAAE,GAAG,GAAG,CAAC,SAAS,CAAC,CAAA;IACrC;;;;;OAKG;IACH,SAAS,CAAC,EAAE,SAAS,EAAE,GAAG,GAAG,CAAC,SAAS,CAAC,CAAA;IACxC;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAA;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,wBAAgB,SAAS,CACvB,EACE,QAAa,EACb,WAAgB,EAChB,OAAY,EACZ,MAAW,EACX,SAAc,EACd,QAAQ,EACR,QAAQ,EACT,GAAE,gBAMF,wGAgCF"}
|
|
@@ -1,43 +1,45 @@
|
|
|
1
|
-
import { InjectionToken } from '@navios/core'
|
|
2
|
-
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
1
|
+
import { InjectionToken } from '@navios/core'
|
|
2
|
+
|
|
3
|
+
import type { ClassType, ClassTypeWithInstance, Registry } from '@navios/core'
|
|
4
|
+
import type { z } from 'zod/v4'
|
|
5
|
+
|
|
6
|
+
import type { CommandHandler } from '../interfaces/index.mjs'
|
|
5
7
|
/**
|
|
6
8
|
* Options for the `@Command` decorator.
|
|
7
9
|
*
|
|
8
10
|
* @public
|
|
9
11
|
*/
|
|
10
12
|
export interface CommandOptions {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
13
|
+
/**
|
|
14
|
+
* The token to use for the command.
|
|
15
|
+
* If provided, the command will be registered with this token.
|
|
16
|
+
*/
|
|
17
|
+
token?: InjectionToken<ClassTypeWithInstance<CommandHandler<any>>>
|
|
18
|
+
/**
|
|
19
|
+
* The command path that users will invoke from the CLI.
|
|
20
|
+
* Can be a single word (e.g., 'greet') or multi-word with colons (e.g., 'user:create', 'db:migrate').
|
|
21
|
+
*/
|
|
22
|
+
path: string
|
|
23
|
+
/**
|
|
24
|
+
* Optional description of the command for help text.
|
|
25
|
+
* Displayed when users run `help` or `--help`.
|
|
26
|
+
*/
|
|
27
|
+
description?: string
|
|
28
|
+
/**
|
|
29
|
+
* Optional zod/v4 schema for validating command options.
|
|
30
|
+
* If provided, options will be validated and parsed according to this schema.
|
|
31
|
+
*/
|
|
32
|
+
optionsSchema?: z.ZodObject
|
|
33
|
+
/**
|
|
34
|
+
* Priority level for the command.
|
|
35
|
+
* Higher priority commands will be loaded first.
|
|
36
|
+
*/
|
|
37
|
+
priority?: number
|
|
38
|
+
/**
|
|
39
|
+
* Registry to use for the command.
|
|
40
|
+
* Registry is used to store the command and its options schema.
|
|
41
|
+
*/
|
|
42
|
+
registry?: Registry
|
|
41
43
|
}
|
|
42
44
|
/**
|
|
43
45
|
* Decorator that marks a class as a CLI command.
|
|
@@ -51,7 +53,7 @@ export interface CommandOptions {
|
|
|
51
53
|
* @example
|
|
52
54
|
* ```typescript
|
|
53
55
|
* import { Command, CommandHandler } from '@navios/commander'
|
|
54
|
-
* import { z } from 'zod'
|
|
56
|
+
* import { z } from 'zod/v4'
|
|
55
57
|
*
|
|
56
58
|
* const optionsSchema = z.object({
|
|
57
59
|
* name: z.string(),
|
|
@@ -69,5 +71,15 @@ export interface CommandOptions {
|
|
|
69
71
|
* }
|
|
70
72
|
* ```
|
|
71
73
|
*/
|
|
72
|
-
export declare function Command({
|
|
73
|
-
|
|
74
|
+
export declare function Command({
|
|
75
|
+
path,
|
|
76
|
+
description,
|
|
77
|
+
token,
|
|
78
|
+
optionsSchema,
|
|
79
|
+
priority,
|
|
80
|
+
registry,
|
|
81
|
+
}: CommandOptions): (
|
|
82
|
+
target: ClassType,
|
|
83
|
+
context: ClassDecoratorContext<abstract new (...args: any) => any>,
|
|
84
|
+
) => any
|
|
85
|
+
//# sourceMappingURL=command.decorator.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.decorator.d.mts","sourceRoot":"","sources":["../../../src/decorators/command.decorator.mts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,cAAc,EAAE,MAAM,cAAc,CAAA;AAE1E,OAAO,KAAK,EAAE,SAAS,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAC9E,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"command.decorator.d.mts","sourceRoot":"","sources":["../../../src/decorators/command.decorator.mts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,cAAc,EAAE,MAAM,cAAc,CAAA;AAE1E,OAAO,KAAK,EAAE,SAAS,EAAE,qBAAqB,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAA;AAC9E,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,QAAQ,CAAA;AAI/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAE7D;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC7B;;;OAGG;IACH,KAAK,CAAC,EAAE,cAAc,CAAC,qBAAqB,CAAC,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,CAAA;IAClE;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB;;;OAGG;IACH,aAAa,CAAC,EAAE,CAAC,CAAC,SAAS,CAAA;IAC3B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB;;;OAGG;IACH,QAAQ,CAAC,EAAE,QAAQ,CAAA;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,OAAO,CAAC,EACtB,IAAI,EACJ,WAAW,EACX,KAAK,EACL,aAAa,EACb,QAAQ,EACR,QAAQ,EACT,EAAE,cAAc,kGAmBhB"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './command.decorator.mjs'
|
|
2
|
-
export * from './cli-module.decorator.mjs'
|
|
3
|
-
//# sourceMappingURL=index.d.mts.map
|
|
1
|
+
export * from './command.decorator.mjs'
|
|
2
|
+
export * from './cli-module.decorator.mjs'
|
|
3
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import type { AnyInjectableType, InjectionToken } from '@navios/core'
|
|
2
|
-
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import type { AnyInjectableType, InjectionToken } from '@navios/core'
|
|
2
|
+
|
|
3
|
+
import { CliParserService } from './services/cli-parser.service.mjs'
|
|
4
|
+
import { CommandRegistryService } from './services/command-registry.service.mjs'
|
|
5
|
+
import { CommanderAdapterService } from './services/commander-adapter.service.mjs'
|
|
5
6
|
/**
|
|
6
7
|
* Defines the CLI environment configuration for use with NaviosFactory.
|
|
7
8
|
*
|
|
@@ -25,7 +26,7 @@ import { CliParserService } from './services/cli-parser.service.mjs';
|
|
|
25
26
|
* ```
|
|
26
27
|
*/
|
|
27
28
|
export declare function defineCliEnvironment(): {
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
export { CommanderAdapterService, CommandRegistryService, CliParserService }
|
|
31
|
-
//# sourceMappingURL=define-environment.d.mts.map
|
|
29
|
+
tokens: Map<InjectionToken<any, undefined, false>, AnyInjectableType>
|
|
30
|
+
}
|
|
31
|
+
export { CommanderAdapterService, CommandRegistryService, CliParserService }
|
|
32
|
+
//# sourceMappingURL=define-environment.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"define-environment.d.mts","sourceRoot":"","sources":["../../src/define-environment.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"define-environment.d.mts","sourceRoot":"","sources":["../../src/define-environment.mts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAErE,OAAO,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAA;AACpE,OAAO,EAAE,sBAAsB,EAAE,MAAM,yCAAyC,CAAA;AAChF,OAAO,EAAE,uBAAuB,EAAE,MAAM,0CAA0C,CAAA;AAElF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,oBAAoB;;EAKnC;AAGD,OAAO,EAAE,uBAAuB,EAAE,sBAAsB,EAAE,gBAAgB,EAAE,CAAA"}
|
package/dist/src/index.d.mts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
export * from '@navios/core'
|
|
2
|
-
export * from './commands/index.mjs'
|
|
3
|
-
export * from './commander.factory.mjs'
|
|
4
|
-
export * from './decorators/index.mjs'
|
|
5
|
-
export * from './define-environment.mjs'
|
|
6
|
-
export * from './interfaces/index.mjs'
|
|
7
|
-
export * from './metadata/index.mjs'
|
|
8
|
-
export * from './services/index.mjs'
|
|
9
|
-
export * from './tokens/index.mjs'
|
|
10
|
-
//# sourceMappingURL=index.d.mts.map
|
|
1
|
+
export * from '@navios/core'
|
|
2
|
+
export * from './commands/index.mjs'
|
|
3
|
+
export * from './commander.factory.mjs'
|
|
4
|
+
export * from './decorators/index.mjs'
|
|
5
|
+
export * from './define-environment.mjs'
|
|
6
|
+
export * from './interfaces/index.mjs'
|
|
7
|
+
export * from './metadata/index.mjs'
|
|
8
|
+
export * from './services/index.mjs'
|
|
9
|
+
export * from './tokens/index.mjs'
|
|
10
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AbstractAdapterInterface } from '@navios/core'
|
|
1
|
+
import type { AbstractAdapterInterface } from '@navios/core'
|
|
2
2
|
/**
|
|
3
3
|
* Interface for CLI adapters.
|
|
4
4
|
* Extends the base adapter interface with CLI-specific methods.
|
|
@@ -6,48 +6,48 @@ import type { AbstractAdapterInterface } from '@navios/core';
|
|
|
6
6
|
* @public
|
|
7
7
|
*/
|
|
8
8
|
export interface AbstractCliAdapterInterface extends AbstractAdapterInterface {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Run the CLI application with the given arguments.
|
|
11
|
+
* Parses arguments and executes the matching command.
|
|
12
|
+
*
|
|
13
|
+
* @param argv - Command-line arguments array (defaults to `process.argv`)
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* ```typescript
|
|
17
|
+
* const adapter = app.getAdapter() as AbstractCliAdapterInterface
|
|
18
|
+
* await adapter.run(process.argv)
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
run(argv?: string[]): Promise<void>
|
|
22
|
+
/**
|
|
23
|
+
* Execute a command programmatically with the provided options.
|
|
24
|
+
*
|
|
25
|
+
* @param path - The command path (e.g., 'greet', 'user:create')
|
|
26
|
+
* @param options - The command options object
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```typescript
|
|
30
|
+
* await adapter.executeCommand('user:create', {
|
|
31
|
+
* name: 'John',
|
|
32
|
+
* email: 'john@example.com',
|
|
33
|
+
* })
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
executeCommand(path: string, options: Record<string, unknown>): Promise<void>
|
|
37
|
+
/**
|
|
38
|
+
* Get all registered command paths and their class references.
|
|
39
|
+
*
|
|
40
|
+
* @returns Array of objects containing path and class
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const commands = adapter.getAllCommands()
|
|
45
|
+
* commands.forEach(({ path }) => console.log(path))
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
48
|
+
getAllCommands(): Array<{
|
|
49
|
+
path: string
|
|
50
|
+
class: unknown
|
|
51
|
+
}>
|
|
52
52
|
}
|
|
53
|
-
//# sourceMappingURL=abstract-cli-adapter.interface.d.mts.map
|
|
53
|
+
//# sourceMappingURL=abstract-cli-adapter.interface.d.mts.map
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
* @example
|
|
10
10
|
* ```typescript
|
|
11
11
|
* import { Command, CommandHandler } from '@navios/commander'
|
|
12
|
-
* import { z } from 'zod'
|
|
12
|
+
* import { z } from 'zod/v4'
|
|
13
13
|
*
|
|
14
14
|
* const optionsSchema = z.object({
|
|
15
15
|
* name: z.string()
|
|
@@ -26,12 +26,12 @@
|
|
|
26
26
|
* ```
|
|
27
27
|
*/
|
|
28
28
|
export interface CommandHandler<TOptions = any> {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
29
|
+
/**
|
|
30
|
+
* Executes the command with the provided options.
|
|
31
|
+
*
|
|
32
|
+
* @param options - The validated command options (validated against the command's schema if provided)
|
|
33
|
+
* @returns A promise or void
|
|
34
|
+
*/
|
|
35
|
+
execute(options: TOptions): void | Promise<void>
|
|
36
36
|
}
|
|
37
|
-
//# sourceMappingURL=command-handler.interface.d.mts.map
|
|
37
|
+
//# sourceMappingURL=command-handler.interface.d.mts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CommandMetadata } from '../metadata/command.metadata.mjs'
|
|
1
|
+
import type { CommandMetadata } from '../metadata/command.metadata.mjs'
|
|
2
2
|
/**
|
|
3
3
|
* Execution context for a command execution.
|
|
4
4
|
*
|
|
@@ -22,33 +22,33 @@ import type { CommandMetadata } from '../metadata/command.metadata.mjs';
|
|
|
22
22
|
* ```
|
|
23
23
|
*/
|
|
24
24
|
export declare class CommanderExecutionContext {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
25
|
+
private readonly command
|
|
26
|
+
private readonly commandPath
|
|
27
|
+
private readonly options
|
|
28
|
+
/**
|
|
29
|
+
* @internal
|
|
30
|
+
* Creates a new execution context.
|
|
31
|
+
*/
|
|
32
|
+
constructor(command: CommandMetadata, commandPath: string, options: any)
|
|
33
|
+
/**
|
|
34
|
+
* Gets the command metadata.
|
|
35
|
+
*
|
|
36
|
+
* @returns The command metadata including path and options schema
|
|
37
|
+
*/
|
|
38
|
+
getCommand(): CommandMetadata
|
|
39
|
+
/**
|
|
40
|
+
* Gets the command path that was invoked.
|
|
41
|
+
*
|
|
42
|
+
* @returns The command path (e.g., 'greet', 'user:create')
|
|
43
|
+
*/
|
|
44
|
+
getCommandPath(): string
|
|
45
|
+
/**
|
|
46
|
+
* Gets the validated command options.
|
|
47
|
+
*
|
|
48
|
+
* Options are validated against the command's zod/v4 schema if one was provided.
|
|
49
|
+
*
|
|
50
|
+
* @returns The validated options object
|
|
51
|
+
*/
|
|
52
|
+
getOptions(): any
|
|
53
53
|
}
|
|
54
|
-
//# sourceMappingURL=commander-execution-context.interface.d.mts.map
|
|
54
|
+
//# sourceMappingURL=commander-execution-context.interface.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commander-execution-context.interface.d.mts","sourceRoot":"","sources":["../../../src/interfaces/commander-execution-context.interface.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAEvE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,yBAAyB;IAMlC,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,OAAO;IAP1B;;;OAGG;
|
|
1
|
+
{"version":3,"file":"commander-execution-context.interface.d.mts","sourceRoot":"","sources":["../../../src/interfaces/commander-execution-context.interface.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kCAAkC,CAAA;AAEvE;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,qBAAa,yBAAyB;IAMlC,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ,CAAC,OAAO;IAP1B;;;OAGG;IACH,YACmB,OAAO,EAAE,eAAe,EACxB,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,GAAG,EAC3B;IAEJ;;;;OAIG;IACH,UAAU,IAAI,eAAe,CAE5B;IAED;;;;OAIG;IACH,cAAc,IAAI,MAAM,CAEvB;IAED;;;;;;OAMG;IACH,UAAU,IAAI,GAAG,CAEhB;CACF"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import type { AdapterEnvironment } from '@navios/core'
|
|
2
|
-
|
|
1
|
+
import type { AdapterEnvironment } from '@navios/core'
|
|
2
|
+
|
|
3
|
+
import type { AbstractCliAdapterInterface } from './abstract-cli-adapter.interface.mjs'
|
|
3
4
|
/**
|
|
4
5
|
* Options for configuring the CLI adapter.
|
|
5
6
|
*
|
|
6
7
|
* @public
|
|
7
8
|
*/
|
|
8
|
-
export interface CliAdapterOptions {
|
|
9
|
-
}
|
|
9
|
+
export interface CliAdapterOptions {}
|
|
10
10
|
/**
|
|
11
11
|
* Environment type definition for CLI adapters.
|
|
12
12
|
* Used with NaviosFactory.create<CliEnvironment>() for type-safe CLI applications.
|
|
@@ -24,7 +24,7 @@ export interface CliAdapterOptions {
|
|
|
24
24
|
* ```
|
|
25
25
|
*/
|
|
26
26
|
export interface CliEnvironment extends AdapterEnvironment {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
options: CliAdapterOptions
|
|
28
|
+
adapter: AbstractCliAdapterInterface
|
|
29
29
|
}
|
|
30
|
-
//# sourceMappingURL=environment.interface.d.mts.map
|
|
30
|
+
//# sourceMappingURL=environment.interface.d.mts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export * from './command-handler.interface.mjs'
|
|
2
|
-
export * from './commander-execution-context.interface.mjs'
|
|
3
|
-
export * from './abstract-cli-adapter.interface.mjs'
|
|
4
|
-
export * from './environment.interface.mjs'
|
|
5
|
-
//# sourceMappingURL=index.d.mts.map
|
|
1
|
+
export * from './command-handler.interface.mjs'
|
|
2
|
+
export * from './commander-execution-context.interface.mjs'
|
|
3
|
+
export * from './abstract-cli-adapter.interface.mjs'
|
|
4
|
+
export * from './environment.interface.mjs'
|
|
5
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { ClassType } from '@navios/core'
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { ClassType } from '@navios/core'
|
|
2
|
+
|
|
3
|
+
import { type CliModuleOptions } from '../../decorators/cli-module.decorator.mjs'
|
|
4
|
+
export type { CliModuleOptions }
|
|
4
5
|
/**
|
|
5
6
|
* Legacy-compatible CliModule decorator.
|
|
6
7
|
*
|
|
@@ -22,5 +23,5 @@ export type { CliModuleOptions };
|
|
|
22
23
|
* export class AppModule {}
|
|
23
24
|
* ```
|
|
24
25
|
*/
|
|
25
|
-
export declare function CliModule(options?: CliModuleOptions): (target: ClassType) => ClassType
|
|
26
|
-
//# sourceMappingURL=cli-module.decorator.d.mts.map
|
|
26
|
+
export declare function CliModule(options?: CliModuleOptions): (target: ClassType) => ClassType
|
|
27
|
+
//# sourceMappingURL=cli-module.decorator.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-module.decorator.d.mts","sourceRoot":"","sources":["../../../../src/legacy-compat/decorators/cli-module.decorator.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli-module.decorator.d.mts","sourceRoot":"","sources":["../../../../src/legacy-compat/decorators/cli-module.decorator.mts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,OAAO,EAEL,KAAK,gBAAgB,EACtB,MAAM,2CAA2C,CAAA;AAElD,YAAY,EAAE,gBAAgB,EAAE,CAAA;AAEhC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAgB,SAAS,CACvB,OAAO,GAAE,gBAMR,oCAOF"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { ClassType } from '@navios/core'
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import type { ClassType } from '@navios/core'
|
|
2
|
+
|
|
3
|
+
import { type CommandOptions } from '../../decorators/command.decorator.mjs'
|
|
4
|
+
export type { CommandOptions }
|
|
4
5
|
/**
|
|
5
6
|
* Legacy-compatible Command decorator.
|
|
6
7
|
*
|
|
@@ -12,7 +13,7 @@ export type { CommandOptions };
|
|
|
12
13
|
* @example
|
|
13
14
|
* ```typescript
|
|
14
15
|
* import { Command, CommandHandler } from '@navios/commander/legacy-compat'
|
|
15
|
-
* import { z } from 'zod'
|
|
16
|
+
* import { z } from 'zod/v4'
|
|
16
17
|
*
|
|
17
18
|
* const optionsSchema = z.object({
|
|
18
19
|
* name: z.string(),
|
|
@@ -30,5 +31,5 @@ export type { CommandOptions };
|
|
|
30
31
|
* }
|
|
31
32
|
* ```
|
|
32
33
|
*/
|
|
33
|
-
export declare function Command(options: CommandOptions): (target: ClassType) => any
|
|
34
|
-
//# sourceMappingURL=command.decorator.d.mts.map
|
|
34
|
+
export declare function Command(options: CommandOptions): (target: ClassType) => any
|
|
35
|
+
//# sourceMappingURL=command.decorator.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.decorator.d.mts","sourceRoot":"","sources":["../../../../src/legacy-compat/decorators/command.decorator.mts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"command.decorator.d.mts","sourceRoot":"","sources":["../../../../src/legacy-compat/decorators/command.decorator.mts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C,OAAO,EAEL,KAAK,cAAc,EACpB,MAAM,wCAAwC,CAAA;AAE/C,YAAY,EAAE,cAAc,EAAE,CAAA;AAE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,cAAc,8BAM9C"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export * from './command.decorator.mjs'
|
|
2
|
-
export * from './cli-module.decorator.mjs'
|
|
3
|
-
//# sourceMappingURL=index.d.mts.map
|
|
1
|
+
export * from './command.decorator.mjs'
|
|
2
|
+
export * from './cli-module.decorator.mjs'
|
|
3
|
+
//# sourceMappingURL=index.d.mts.map
|
|
@@ -23,6 +23,6 @@
|
|
|
23
23
|
*
|
|
24
24
|
* @packageDocumentation
|
|
25
25
|
*/
|
|
26
|
-
export * from './decorators/index.mjs'
|
|
27
|
-
export * from '@navios/core/legacy-compat'
|
|
28
|
-
//# sourceMappingURL=index.d.mts.map
|
|
26
|
+
export * from './decorators/index.mjs'
|
|
27
|
+
export * from '@navios/core/legacy-compat'
|
|
28
|
+
//# sourceMappingURL=index.d.mts.map
|