@navios/commander 0.5.2 → 0.7.0
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/CHANGELOG.md +32 -0
- package/README.md +24 -13
- package/dist/src/commander.application.d.mts +124 -6
- package/dist/src/commander.application.d.mts.map +1 -1
- package/dist/src/commander.factory.d.mts +31 -3
- package/dist/src/commander.factory.d.mts.map +1 -1
- package/dist/src/decorators/cli-module.decorator.d.mts +36 -1
- package/dist/src/decorators/cli-module.decorator.d.mts.map +1 -1
- package/dist/src/decorators/command.decorator.d.mts +44 -1
- package/dist/src/decorators/command.decorator.d.mts.map +1 -1
- package/dist/src/index.d.mts +1 -1
- package/dist/src/index.d.mts.map +1 -1
- package/dist/src/interfaces/command-handler.interface.d.mts +33 -0
- package/dist/src/interfaces/command-handler.interface.d.mts.map +1 -1
- package/dist/src/interfaces/commander-execution-context.interface.d.mts +43 -0
- package/dist/src/interfaces/commander-execution-context.interface.d.mts.map +1 -1
- package/dist/src/interfaces/index.d.mts +0 -1
- package/dist/src/interfaces/index.d.mts.map +1 -1
- package/dist/src/interfaces/module.interface.d.mts +1 -4
- package/dist/src/interfaces/module.interface.d.mts.map +1 -1
- package/dist/src/metadata/cli-module.metadata.d.mts +46 -1
- package/dist/src/metadata/cli-module.metadata.d.mts.map +1 -1
- package/dist/src/metadata/command.metadata.d.mts +48 -1
- package/dist/src/metadata/command.metadata.d.mts.map +1 -1
- package/dist/src/services/cli-parser.service.d.mts +32 -1
- package/dist/src/services/cli-parser.service.d.mts.map +1 -1
- package/dist/src/services/module-loader.service.d.mts +44 -5
- package/dist/src/services/module-loader.service.d.mts.map +1 -1
- package/dist/src/tokens/execution-context.token.d.mts +25 -3
- package/dist/src/tokens/execution-context.token.d.mts.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/tsdown.config.d.mts +3 -0
- package/dist/tsdown.config.d.mts.map +1 -0
- package/lib/index.cjs +7721 -0
- package/lib/index.cjs.map +1 -0
- package/lib/index.d.cts +670 -0
- package/lib/index.d.cts.map +1 -0
- package/lib/index.d.mts +670 -101
- package/lib/index.d.mts.map +1 -0
- package/lib/index.mjs +7509 -598
- package/lib/index.mjs.map +1 -1
- package/package.json +5 -5
- package/project.json +2 -2
- package/src/commander.application.mts +138 -18
- package/src/commander.factory.mts +32 -4
- package/src/decorators/cli-module.decorator.mts +37 -2
- package/src/decorators/command.decorator.mts +45 -2
- package/src/index.mts +4 -1
- package/src/interfaces/command-handler.interface.mts +33 -0
- package/src/interfaces/commander-execution-context.interface.mts +43 -0
- package/src/interfaces/index.mts +0 -1
- package/src/metadata/cli-module.metadata.mts +48 -7
- package/src/metadata/command.metadata.mts +48 -1
- package/src/services/__tests__/cli-parser.service.spec.mts +15 -11
- package/src/services/cli-parser.service.mts +35 -3
- package/src/services/module-loader.service.mts +45 -6
- package/src/tokens/execution-context.token.mts +29 -5
- package/tsdown.config.mts +33 -0
- package/lib/_tsup-dts-rollup.d.mts +0 -489
- package/lib/_tsup-dts-rollup.d.ts +0 -489
- package/lib/index.d.ts +0 -101
- package/lib/index.js +0 -642
- package/lib/index.js.map +0 -1
- package/src/interfaces/module.interface.mts +0 -4
- package/tsup.config.mts +0 -12
|
@@ -1,11 +1,56 @@
|
|
|
1
|
-
import type { ClassType } from '@navios/
|
|
1
|
+
import type { ClassType } from '@navios/core';
|
|
2
|
+
/**
|
|
3
|
+
* @internal
|
|
4
|
+
* Symbol key used to store CLI module metadata on classes.
|
|
5
|
+
*/
|
|
2
6
|
export declare const CliModuleMetadataKey: unique symbol;
|
|
7
|
+
/**
|
|
8
|
+
* Metadata associated with a CLI module.
|
|
9
|
+
*
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
3
12
|
export interface CliModuleMetadata {
|
|
13
|
+
/**
|
|
14
|
+
* Set of command classes registered in this module.
|
|
15
|
+
*/
|
|
4
16
|
commands: Set<ClassType>;
|
|
17
|
+
/**
|
|
18
|
+
* Set of other modules imported by this module.
|
|
19
|
+
*/
|
|
5
20
|
imports: Set<ClassType>;
|
|
21
|
+
/**
|
|
22
|
+
* Map of custom attributes that can be attached to the module.
|
|
23
|
+
*/
|
|
6
24
|
customAttributes: Map<string | symbol, any>;
|
|
7
25
|
}
|
|
26
|
+
/**
|
|
27
|
+
* Gets or creates CLI module metadata for a class.
|
|
28
|
+
*
|
|
29
|
+
* @internal
|
|
30
|
+
* @param target - The module class
|
|
31
|
+
* @param context - The decorator context
|
|
32
|
+
* @returns The module metadata
|
|
33
|
+
*/
|
|
8
34
|
export declare function getCliModuleMetadata(target: ClassType, context: ClassDecoratorContext): CliModuleMetadata;
|
|
35
|
+
/**
|
|
36
|
+
* Extracts CLI module metadata from a class.
|
|
37
|
+
*
|
|
38
|
+
* @param target - The module class
|
|
39
|
+
* @returns The module metadata
|
|
40
|
+
* @throws {Error} If the class is not decorated with @CliModule
|
|
41
|
+
*
|
|
42
|
+
* @example
|
|
43
|
+
* ```typescript
|
|
44
|
+
* const metadata = extractCliModuleMetadata(AppModule)
|
|
45
|
+
* console.log(metadata.commands.size) // Number of commands
|
|
46
|
+
* ```
|
|
47
|
+
*/
|
|
9
48
|
export declare function extractCliModuleMetadata(target: ClassType): CliModuleMetadata;
|
|
49
|
+
/**
|
|
50
|
+
* Checks if a class has CLI module metadata.
|
|
51
|
+
*
|
|
52
|
+
* @param target - The class to check
|
|
53
|
+
* @returns `true` if the class is decorated with @CliModule, `false` otherwise
|
|
54
|
+
*/
|
|
10
55
|
export declare function hasCliModuleMetadata(target: ClassType): boolean;
|
|
11
56
|
//# sourceMappingURL=cli-module.metadata.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-module.metadata.d.mts","sourceRoot":"","sources":["../../../src/metadata/cli-module.metadata.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"cli-module.metadata.d.mts","sourceRoot":"","sources":["../../../src/metadata/cli-module.metadata.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAE7C;;;GAGG;AACH,eAAO,MAAM,oBAAoB,eAAiC,CAAA;AAElE;;;;GAIG;AACH,MAAM,WAAW,iBAAiB;IAChC;;OAEG;IACH,QAAQ,EAAE,GAAG,CAAC,SAAS,CAAC,CAAA;IACxB;;OAEG;IACH,OAAO,EAAE,GAAG,CAAC,SAAS,CAAC,CAAA;IACvB;;OAEG;IACH,gBAAgB,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,CAAA;CAC5C;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,qBAAqB,GAC7B,iBAAiB,CAoBnB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,wBAAwB,CAAC,MAAM,EAAE,SAAS,GAAG,iBAAiB,CAS7E;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAG/D"}
|
|
@@ -1,12 +1,59 @@
|
|
|
1
|
-
import type { ClassType } from '@navios/
|
|
1
|
+
import type { ClassType } from '@navios/core';
|
|
2
2
|
import type { ZodObject } from 'zod';
|
|
3
|
+
/**
|
|
4
|
+
* @internal
|
|
5
|
+
* Symbol key used to store command metadata on classes.
|
|
6
|
+
*/
|
|
3
7
|
export declare const CommandMetadataKey: unique symbol;
|
|
8
|
+
/**
|
|
9
|
+
* Metadata associated with a command.
|
|
10
|
+
*
|
|
11
|
+
* @public
|
|
12
|
+
*/
|
|
4
13
|
export interface CommandMetadata {
|
|
14
|
+
/**
|
|
15
|
+
* The command path (e.g., 'greet', 'user:create').
|
|
16
|
+
*/
|
|
5
17
|
path: string;
|
|
18
|
+
/**
|
|
19
|
+
* Optional Zod schema for validating command options.
|
|
20
|
+
*/
|
|
6
21
|
optionsSchema?: ZodObject;
|
|
22
|
+
/**
|
|
23
|
+
* Map of custom attributes that can be attached to the command.
|
|
24
|
+
*/
|
|
7
25
|
customAttributes: Map<string | symbol, any>;
|
|
8
26
|
}
|
|
27
|
+
/**
|
|
28
|
+
* Gets or creates command metadata for a class.
|
|
29
|
+
*
|
|
30
|
+
* @internal
|
|
31
|
+
* @param target - The command class
|
|
32
|
+
* @param context - The decorator context
|
|
33
|
+
* @param path - The command path
|
|
34
|
+
* @param optionsSchema - Optional Zod schema
|
|
35
|
+
* @returns The command metadata
|
|
36
|
+
*/
|
|
9
37
|
export declare function getCommandMetadata(target: ClassType, context: ClassDecoratorContext, path: string, optionsSchema?: ZodObject): CommandMetadata;
|
|
38
|
+
/**
|
|
39
|
+
* Extracts command metadata from a class.
|
|
40
|
+
*
|
|
41
|
+
* @param target - The command class
|
|
42
|
+
* @returns The command metadata
|
|
43
|
+
* @throws {Error} If the class is not decorated with @Command
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* const metadata = extractCommandMetadata(GreetCommand)
|
|
48
|
+
* console.log(metadata.path) // 'greet'
|
|
49
|
+
* ```
|
|
50
|
+
*/
|
|
10
51
|
export declare function extractCommandMetadata(target: ClassType): CommandMetadata;
|
|
52
|
+
/**
|
|
53
|
+
* Checks if a class has command metadata.
|
|
54
|
+
*
|
|
55
|
+
* @param target - The class to check
|
|
56
|
+
* @returns `true` if the class is decorated with @Command, `false` otherwise
|
|
57
|
+
*/
|
|
11
58
|
export declare function hasCommandMetadata(target: ClassType): boolean;
|
|
12
59
|
//# sourceMappingURL=command.metadata.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"command.metadata.d.mts","sourceRoot":"","sources":["../../../src/metadata/command.metadata.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"command.metadata.d.mts","sourceRoot":"","sources":["../../../src/metadata/command.metadata.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AAEpC;;;GAGG;AACH,eAAO,MAAM,kBAAkB,eAA+B,CAAA;AAE9D;;;;GAIG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,IAAI,EAAE,MAAM,CAAA;IACZ;;OAEG;IACH,aAAa,CAAC,EAAE,SAAS,CAAA;IACzB;;OAEG;IACH,gBAAgB,EAAE,GAAG,CAAC,MAAM,GAAG,MAAM,EAAE,GAAG,CAAC,CAAA;CAC5C;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,qBAAqB,EAC9B,IAAI,EAAE,MAAM,EACZ,aAAa,CAAC,EAAE,SAAS,GACxB,eAAe,CAoBjB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,GAAG,eAAe,CASzE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,SAAS,GAAG,OAAO,CAI7D"}
|
|
@@ -1,9 +1,37 @@
|
|
|
1
1
|
import type { ZodObject } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Result of parsing command-line arguments.
|
|
4
|
+
*
|
|
5
|
+
* @public
|
|
6
|
+
*/
|
|
2
7
|
export interface ParsedCliArgs {
|
|
8
|
+
/**
|
|
9
|
+
* The command path (e.g., 'greet', 'user:create').
|
|
10
|
+
* Multi-word commands are joined with spaces.
|
|
11
|
+
*/
|
|
3
12
|
command: string;
|
|
13
|
+
/**
|
|
14
|
+
* Parsed options as key-value pairs.
|
|
15
|
+
* Keys are converted from kebab-case to camelCase.
|
|
16
|
+
*/
|
|
4
17
|
options: Record<string, any>;
|
|
18
|
+
/**
|
|
19
|
+
* Positional arguments that don't match any option flags.
|
|
20
|
+
*/
|
|
5
21
|
positionals: string[];
|
|
6
22
|
}
|
|
23
|
+
/**
|
|
24
|
+
* Service for parsing command-line arguments.
|
|
25
|
+
*
|
|
26
|
+
* Handles parsing of various CLI argument formats including:
|
|
27
|
+
* - Long options: `--key value` or `--key=value`
|
|
28
|
+
* - Short options: `-k value` or `-abc` (multiple flags)
|
|
29
|
+
* - Boolean flags
|
|
30
|
+
* - Array options
|
|
31
|
+
* - Positional arguments
|
|
32
|
+
*
|
|
33
|
+
* @public
|
|
34
|
+
*/
|
|
7
35
|
export declare class CliParserService {
|
|
8
36
|
/**
|
|
9
37
|
* Parses command-line arguments from process.argv
|
|
@@ -44,7 +72,10 @@ export declare class CliParserService {
|
|
|
44
72
|
*/
|
|
45
73
|
private isSchemaArray;
|
|
46
74
|
/**
|
|
47
|
-
* Formats help text
|
|
75
|
+
* Formats help text listing all available commands.
|
|
76
|
+
*
|
|
77
|
+
* @param commands - Array of command objects with path and class
|
|
78
|
+
* @returns Formatted string listing all commands
|
|
48
79
|
*/
|
|
49
80
|
formatCommandList(commands: Array<{
|
|
50
81
|
path: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli-parser.service.d.mts","sourceRoot":"","sources":["../../../src/services/cli-parser.service.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAW,MAAM,KAAK,CAAA;AAI7C,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,MAAM,CAAA;IACf,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC5B,WAAW,EAAE,MAAM,EAAE,CAAA;CACtB;AAED,qBACa,gBAAgB;IAC3B;;;;;;;;OAQG;IACH,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,aAAa,CAAC,EAAE,SAAS,GAAG,aAAa;
|
|
1
|
+
{"version":3,"file":"cli-parser.service.d.mts","sourceRoot":"","sources":["../../../src/services/cli-parser.service.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAW,MAAM,KAAK,CAAA;AAI7C;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC5B;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAA;IACf;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC5B;;OAEG;IACH,WAAW,EAAE,MAAM,EAAE,CAAA;CACtB;AAED;;;;;;;;;;;GAWG;AACH,qBACa,gBAAgB;IAC3B;;;;;;;;OAQG;IACH,KAAK,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,aAAa,CAAC,EAAE,SAAS,GAAG,aAAa;IAuI/D;;OAEG;IACH,OAAO,CAAC,SAAS;IAIjB;;OAEG;IACH,OAAO,CAAC,UAAU;IAkClB;;;OAGG;IACH,OAAO,CAAC,oBAAoB;IA0B5B;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAwB1B;;;OAGG;IACH,OAAO,CAAC,eAAe;IAiBvB;;;OAGG;IACH,OAAO,CAAC,aAAa;IAiBrB;;;;;OAKG;IACH,iBAAiB,CAAC,QAAQ,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,GAAG,CAAA;KAAE,CAAC,GAAG,MAAM;CAOzE"}
|
|
@@ -1,21 +1,57 @@
|
|
|
1
|
-
import type { ClassTypeWithInstance } from '@navios/
|
|
2
|
-
import { Container } from '@navios/
|
|
3
|
-
import type { CommandHandler
|
|
1
|
+
import type { ClassTypeWithInstance, NaviosModule } from '@navios/core';
|
|
2
|
+
import { Container } from '@navios/core';
|
|
3
|
+
import type { CommandHandler } from '../interfaces/index.mjs';
|
|
4
4
|
import type { CliModuleMetadata, CommandMetadata } from '../metadata/index.mjs';
|
|
5
|
+
/**
|
|
6
|
+
* Command class with its associated metadata.
|
|
7
|
+
*
|
|
8
|
+
* @public
|
|
9
|
+
*/
|
|
5
10
|
export interface CommandWithMetadata {
|
|
11
|
+
/**
|
|
12
|
+
* The command class constructor.
|
|
13
|
+
*/
|
|
6
14
|
class: ClassTypeWithInstance<CommandHandler>;
|
|
15
|
+
/**
|
|
16
|
+
* The command metadata including path and options schema.
|
|
17
|
+
*/
|
|
7
18
|
metadata: CommandMetadata;
|
|
8
19
|
}
|
|
9
|
-
|
|
20
|
+
/**
|
|
21
|
+
* Service for loading and managing CLI modules and commands.
|
|
22
|
+
*
|
|
23
|
+
* Handles module traversal, command registration, and metadata collection.
|
|
24
|
+
* This service is used internally by CommanderApplication.
|
|
25
|
+
*
|
|
26
|
+
* @public
|
|
27
|
+
*/
|
|
28
|
+
export declare class CliModuleLoaderService {
|
|
10
29
|
protected container: Container;
|
|
11
30
|
private modulesMetadata;
|
|
12
31
|
private loadedModules;
|
|
13
32
|
private commandsMetadata;
|
|
14
33
|
private initialized;
|
|
15
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Loads all modules starting from the root app module.
|
|
36
|
+
*
|
|
37
|
+
* Traverses the module tree, loads imported modules, and collects command metadata.
|
|
38
|
+
*
|
|
39
|
+
* @param appModule - The root CLI module
|
|
40
|
+
*/
|
|
41
|
+
loadModules(appModule: ClassTypeWithInstance<NaviosModule>): Promise<void>;
|
|
16
42
|
private traverseModules;
|
|
17
43
|
private mergeMetadata;
|
|
44
|
+
/**
|
|
45
|
+
* Gets all loaded module metadata.
|
|
46
|
+
*
|
|
47
|
+
* @returns Map of module names to their metadata
|
|
48
|
+
*/
|
|
18
49
|
getAllModules(): Map<string, CliModuleMetadata>;
|
|
50
|
+
/**
|
|
51
|
+
* Gets all command classes indexed by command class name.
|
|
52
|
+
*
|
|
53
|
+
* @returns Map of command class names to command classes
|
|
54
|
+
*/
|
|
19
55
|
getAllCommands(): Map<string, ClassTypeWithInstance<any>>;
|
|
20
56
|
/**
|
|
21
57
|
* Get all commands with their metadata, indexed by command path.
|
|
@@ -28,6 +64,9 @@ export declare class ModuleLoaderService {
|
|
|
28
64
|
* Returns undefined if command is not found.
|
|
29
65
|
*/
|
|
30
66
|
getCommandByPath(path: string): CommandWithMetadata | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Disposes of all loaded modules and commands, clearing internal state.
|
|
69
|
+
*/
|
|
31
70
|
dispose(): void;
|
|
32
71
|
}
|
|
33
72
|
//# sourceMappingURL=module-loader.service.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"module-loader.service.d.mts","sourceRoot":"","sources":["../../../src/services/module-loader.service.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"module-loader.service.d.mts","sourceRoot":"","sources":["../../../src/services/module-loader.service.mts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,cAAc,CAAA;AAEvE,OAAO,EAAE,SAAS,EAAsB,MAAM,cAAc,CAAA;AAE5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAC7D,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAO/E;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAClC;;OAEG;IACH,KAAK,EAAE,qBAAqB,CAAC,cAAc,CAAC,CAAA;IAC5C;;OAEG;IACH,QAAQ,EAAE,eAAe,CAAA;CAC1B;AAED;;;;;;;GAOG;AACH,qBACa,sBAAsB;IACjC,SAAS,CAAC,SAAS,YAAoB;IACvC,OAAO,CAAC,eAAe,CAA4C;IACnE,OAAO,CAAC,aAAa,CAA8B;IACnD,OAAO,CAAC,gBAAgB,CAA8C;IACtE,OAAO,CAAC,WAAW,CAAQ;IAE3B;;;;;;OAMG;IACG,WAAW,CAAC,SAAS,EAAE,qBAAqB,CAAC,YAAY,CAAC;YAQlD,eAAe;IAmC7B,OAAO,CAAC,aAAa;IAcrB;;;;OAIG;IACH,aAAa,IAAI,GAAG,CAAC,MAAM,EAAE,iBAAiB,CAAC;IAI/C;;;;OAIG;IACH,cAAc,IAAI,GAAG,CAAC,MAAM,EAAE,qBAAqB,CAAC,GAAG,CAAC,CAAC;IAUzD;;;;OAIG;IACH,0BAA0B,IAAI,GAAG,CAAC,MAAM,EAAE,mBAAmB,CAAC;IAI9D;;;OAGG;IACH,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,mBAAmB,GAAG,SAAS;IAI/D;;OAEG;IACH,OAAO;CAMR"}
|
|
@@ -1,5 +1,27 @@
|
|
|
1
|
-
import { InjectionToken } from '@navios/
|
|
1
|
+
import { InjectionToken } from '@navios/core';
|
|
2
2
|
import type { CommanderExecutionContext } from '../interfaces/index.mjs';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* Injection token for accessing the current command execution context.
|
|
5
|
+
*
|
|
6
|
+
* Use this token with `inject()` to access the `CommanderExecutionContext` in services
|
|
7
|
+
* that need information about the currently executing command.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { inject, Injectable } from '@navios/di'
|
|
12
|
+
* import { CommandExecutionContext } from '@navios/commander'
|
|
13
|
+
*
|
|
14
|
+
* @Injectable()
|
|
15
|
+
* class MyService {
|
|
16
|
+
* private ctx = inject(CommandExecutionContext)
|
|
17
|
+
*
|
|
18
|
+
* doSomething() {
|
|
19
|
+
* const commandPath = this.ctx.getCommandPath()
|
|
20
|
+
* const options = this.ctx.getOptions()
|
|
21
|
+
* // Use context information...
|
|
22
|
+
* }
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare const CommandExecutionContext: InjectionToken<CommanderExecutionContext, undefined, false>;
|
|
5
27
|
//# sourceMappingURL=execution-context.token.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"execution-context.token.d.mts","sourceRoot":"","sources":["../../../src/tokens/execution-context.token.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"execution-context.token.d.mts","sourceRoot":"","sources":["../../../src/tokens/execution-context.token.mts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAA;AAE7C,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,yBAAyB,CAAA;AAKxE;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,uBAAuB,6DAGjC,CAAA"}
|