@navios/commander 1.5.0 → 1.6.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.
Files changed (121) hide show
  1. package/.turbo/turbo-build.log +48 -0
  2. package/.turbo/turbo-check.log +0 -0
  3. package/.turbo/turbo-lint.log +2 -0
  4. package/.turbo/turbo-test$colon$ci.log +109 -0
  5. package/.turbo/turbo-test.log +107 -0
  6. package/CHANGELOG.md +15 -3
  7. package/README.md +8 -16
  8. package/dist/src/commander.factory.d.mts +126 -122
  9. package/dist/src/commander.factory.d.mts.map +1 -1
  10. package/dist/src/commands/help.command.d.mts +15 -11
  11. package/dist/src/commands/help.command.d.mts.map +1 -1
  12. package/dist/src/commands/index.d.mts +2 -2
  13. package/dist/src/decorators/cli-module.decorator.d.mts +51 -40
  14. package/dist/src/decorators/cli-module.decorator.d.mts.map +1 -1
  15. package/dist/src/decorators/command.decorator.d.mts +49 -37
  16. package/dist/src/decorators/command.decorator.d.mts.map +1 -1
  17. package/dist/src/decorators/index.d.mts +3 -3
  18. package/dist/src/define-environment.d.mts +9 -8
  19. package/dist/src/define-environment.d.mts.map +1 -1
  20. package/dist/src/index.d.mts +10 -10
  21. package/dist/src/interfaces/abstract-cli-adapter.interface.d.mts +45 -45
  22. package/dist/src/interfaces/command-handler.interface.d.mts +14 -10
  23. package/dist/src/interfaces/command-handler.interface.d.mts.map +1 -1
  24. package/dist/src/interfaces/commander-execution-context.interface.d.mts +40 -30
  25. package/dist/src/interfaces/commander-execution-context.interface.d.mts.map +1 -1
  26. package/dist/src/interfaces/environment.interface.d.mts +7 -7
  27. package/dist/src/interfaces/index.d.mts +5 -5
  28. package/dist/src/legacy-compat/decorators/cli-module.decorator.d.mts +6 -5
  29. package/dist/src/legacy-compat/decorators/cli-module.decorator.d.mts.map +1 -1
  30. package/dist/src/legacy-compat/decorators/command.decorator.d.mts +7 -6
  31. package/dist/src/legacy-compat/decorators/command.decorator.d.mts.map +1 -1
  32. package/dist/src/legacy-compat/decorators/index.d.mts +3 -3
  33. package/dist/src/legacy-compat/index.d.mts +3 -3
  34. package/dist/src/metadata/command-entry.metadata.d.mts +5 -5
  35. package/dist/src/metadata/command-entry.metadata.d.mts.map +1 -1
  36. package/dist/src/metadata/command.metadata.d.mts +30 -24
  37. package/dist/src/metadata/command.metadata.d.mts.map +1 -1
  38. package/dist/src/metadata/index.d.mts +3 -3
  39. package/dist/src/overrides/help.command.d.mts +15 -11
  40. package/dist/src/overrides/help.command.d.mts.map +1 -1
  41. package/dist/src/services/cli-parser.service.d.mts +54 -54
  42. package/dist/src/services/cli-parser.service.d.mts.map +1 -1
  43. package/dist/src/services/command-registry.service.d.mts +75 -74
  44. package/dist/src/services/command-registry.service.d.mts.map +1 -1
  45. package/dist/src/services/commander-adapter.service.d.mts +53 -48
  46. package/dist/src/services/commander-adapter.service.d.mts.map +1 -1
  47. package/dist/src/services/index.d.mts +4 -4
  48. package/dist/src/tokens/execution-context.token.d.mts +9 -4
  49. package/dist/src/tokens/execution-context.token.d.mts.map +1 -1
  50. package/dist/src/tokens/help-command.token.d.mts +5 -4
  51. package/dist/src/tokens/index.d.mts +2 -2
  52. package/dist/src/utils/index.d.mts +2 -2
  53. package/dist/src/utils/runtime.d.mts +2 -2
  54. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  55. package/dist/tsconfig.tsbuildinfo +1 -1
  56. package/dist/tsdown.config.d.mts +3 -3
  57. package/dist/vitest.config.d.mts +3 -3
  58. package/lib/{cli-module.decorator-CRaNGvgl.d.cts → cli-module.decorator-BV3vVKlR.d.cts} +60 -55
  59. package/lib/cli-module.decorator-BV3vVKlR.d.cts.map +1 -0
  60. package/lib/{cli-module.decorator-CkP22084.cjs → cli-module.decorator-CXt38aqF.cjs} +2 -2
  61. package/lib/cli-module.decorator-CXt38aqF.cjs.map +1 -0
  62. package/lib/{cli-module.decorator-UGbtkRYc.mjs → cli-module.decorator-DAjf_r_W.mjs} +2 -2
  63. package/lib/cli-module.decorator-DAjf_r_W.mjs.map +1 -0
  64. package/lib/{cli-module.decorator-bsP5gEn7.d.mts → cli-module.decorator-DDlgpTgI.d.mts} +133 -118
  65. package/lib/cli-module.decorator-DDlgpTgI.d.mts.map +1 -0
  66. package/lib/{command.decorator-UrNJmQN0.cjs → command.decorator-HziankUv.cjs} +3 -3
  67. package/lib/command.decorator-HziankUv.cjs.map +1 -0
  68. package/lib/{command.decorator-DVLSAqYZ.mjs → command.decorator-QiRU7ny3.mjs} +3 -3
  69. package/lib/command.decorator-QiRU7ny3.mjs.map +1 -0
  70. package/lib/{help-command.token-CMWYI6em.cjs → help-command.token-DamE31Aw.cjs} +4 -4
  71. package/lib/{help-command.token-CMWYI6em.cjs.map → help-command.token-DamE31Aw.cjs.map} +1 -1
  72. package/lib/{help-command.token-C0Kgj60o.mjs → help-command.token-XHx3WkoD.mjs} +4 -4
  73. package/lib/{help-command.token-C0Kgj60o.mjs.map → help-command.token-XHx3WkoD.mjs.map} +1 -1
  74. package/lib/{help.command-dtZbhq0w.mjs → help.command-Bynoll_7.mjs} +5 -8
  75. package/lib/help.command-Bynoll_7.mjs.map +1 -0
  76. package/lib/{help.command-DQyv6ali.cjs → help.command-DvKmMpB7.cjs} +6 -9
  77. package/lib/help.command-DvKmMpB7.cjs.map +1 -0
  78. package/lib/index.cjs +118 -106
  79. package/lib/index.cjs.map +1 -1
  80. package/lib/index.d.cts +294 -284
  81. package/lib/index.d.cts.map +1 -1
  82. package/lib/index.d.mts +221 -221
  83. package/lib/index.d.mts.map +1 -1
  84. package/lib/index.mjs +117 -105
  85. package/lib/index.mjs.map +1 -1
  86. package/lib/legacy-compat/index.cjs +6 -28
  87. package/lib/legacy-compat/index.cjs.map +1 -1
  88. package/lib/legacy-compat/index.d.cts +3 -2
  89. package/lib/legacy-compat/index.d.cts.map +1 -1
  90. package/lib/legacy-compat/index.d.mts +3 -2
  91. package/lib/legacy-compat/index.d.mts.map +1 -1
  92. package/lib/legacy-compat/index.mjs +4 -25
  93. package/lib/legacy-compat/index.mjs.map +1 -1
  94. package/package.json +26 -16
  95. package/src/__tests__/commander.factory.e2e.spec.mts +127 -79
  96. package/src/commands/help.command.mts +1 -1
  97. package/src/decorators/cli-module.decorator.mts +4 -9
  98. package/src/decorators/command.decorator.mts +4 -4
  99. package/src/define-environment.mts +4 -4
  100. package/src/interfaces/command-handler.interface.mts +8 -4
  101. package/src/interfaces/commander-execution-context.interface.mts +14 -1
  102. package/src/legacy-compat/decorators/cli-module.decorator.mts +2 -1
  103. package/src/legacy-compat/decorators/command.decorator.mts +3 -2
  104. package/src/metadata/command-entry.metadata.mts +3 -6
  105. package/src/metadata/command.metadata.mts +6 -8
  106. package/src/overrides/help.command.mts +2 -2
  107. package/src/services/__tests__/cli-parser.service.spec.mts +23 -178
  108. package/src/services/cli-parser.service.mts +23 -27
  109. package/src/services/command-registry.service.mts +5 -5
  110. package/src/services/commander-adapter.service.mts +12 -20
  111. package/src/tokens/execution-context.token.mts +4 -6
  112. package/tsconfig.json +3 -0
  113. package/lib/cli-module.decorator-CRaNGvgl.d.cts.map +0 -1
  114. package/lib/cli-module.decorator-CkP22084.cjs.map +0 -1
  115. package/lib/cli-module.decorator-UGbtkRYc.mjs.map +0 -1
  116. package/lib/cli-module.decorator-bsP5gEn7.d.mts.map +0 -1
  117. package/lib/command.decorator-DVLSAqYZ.mjs.map +0 -1
  118. package/lib/command.decorator-UrNJmQN0.cjs.map +0 -1
  119. package/lib/help.command-DQyv6ali.cjs.map +0 -1
  120. package/lib/help.command-dtZbhq0w.mjs.map +0 -1
  121. package/project.json +0 -66
@@ -1,3 +1,3 @@
1
- declare const _default: import("tsdown").UserConfig;
2
- export default _default;
3
- //# sourceMappingURL=tsdown.config.d.mts.map
1
+ declare const _default: import('tsdown').UserConfig
2
+ export default _default
3
+ //# sourceMappingURL=tsdown.config.d.mts.map
@@ -1,3 +1,3 @@
1
- declare const _default: import("vitest/config").UserWorkspaceConfig;
2
- export default _default;
3
- //# sourceMappingURL=vitest.config.d.mts.map
1
+ declare const _default: import('vitest/config').UserWorkspaceConfig
2
+ export default _default
3
+ //# sourceMappingURL=vitest.config.d.mts.map
@@ -1,7 +1,8 @@
1
1
  import { ClassType, ClassTypeWithInstance, InjectionToken, Registry } from "@navios/core";
2
- import { ZodObject } from "zod";
2
+ import { z } from "zod/v4";
3
3
 
4
4
  //#region src/interfaces/command-handler.interface.d.mts
5
+
5
6
  /**
6
7
  * Interface that all command classes must implement.
7
8
  *
@@ -13,7 +14,7 @@ import { ZodObject } from "zod";
13
14
  * @example
14
15
  * ```typescript
15
16
  * import { Command, CommandHandler } from '@navios/commander'
16
- * import { z } from 'zod'
17
+ * import { z } from 'zod/v4'
17
18
  *
18
19
  * const optionsSchema = z.object({
19
20
  * name: z.string()
@@ -23,20 +24,24 @@ import { ZodObject } from "zod";
23
24
  *
24
25
  * @Command({ path: 'greet', optionsSchema })
25
26
  * export class GreetCommand implements CommandHandler<Options> {
26
- * async execute(options: Options) {
27
+ * async execute(options: Options, positionals?: string[]) {
27
28
  * console.log(`Hello, ${options.name}!`)
29
+ * if (positionals?.length) {
30
+ * console.log(`Files: ${positionals.join(', ')}`)
31
+ * }
28
32
  * }
29
33
  * }
30
34
  * ```
31
35
  */
32
36
  interface CommandHandler<TOptions = any> {
33
37
  /**
34
- * Executes the command with the provided options.
35
- *
36
- * @param options - The validated command options (validated against the command's schema if provided)
37
- * @returns A promise or void
38
- */
39
- execute(options: TOptions): void | Promise<void>;
38
+ * Executes the command with the provided options and positional arguments.
39
+ *
40
+ * @param options - The validated command options (validated against the command's schema if provided)
41
+ * @param positionals - Positional arguments that don't match any option flags
42
+ * @returns A promise or void
43
+ */
44
+ execute(options: TOptions, positionals?: string[]): void | Promise<void>;
40
45
  }
41
46
  //#endregion
42
47
  //#region src/decorators/command.decorator.d.mts
@@ -47,34 +52,34 @@ interface CommandHandler<TOptions = any> {
47
52
  */
48
53
  interface CommandOptions {
49
54
  /**
50
- * The token to use for the command.
51
- * If provided, the command will be registered with this token.
52
- */
55
+ * The token to use for the command.
56
+ * If provided, the command will be registered with this token.
57
+ */
53
58
  token?: InjectionToken<ClassTypeWithInstance<CommandHandler<any>>>;
54
59
  /**
55
- * The command path that users will invoke from the CLI.
56
- * Can be a single word (e.g., 'greet') or multi-word with colons (e.g., 'user:create', 'db:migrate').
57
- */
60
+ * The command path that users will invoke from the CLI.
61
+ * Can be a single word (e.g., 'greet') or multi-word with colons (e.g., 'user:create', 'db:migrate').
62
+ */
58
63
  path: string;
59
64
  /**
60
- * Optional description of the command for help text.
61
- * Displayed when users run `help` or `--help`.
62
- */
65
+ * Optional description of the command for help text.
66
+ * Displayed when users run `help` or `--help`.
67
+ */
63
68
  description?: string;
64
69
  /**
65
- * Optional Zod schema for validating command options.
66
- * If provided, options will be validated and parsed according to this schema.
67
- */
68
- optionsSchema?: ZodObject;
70
+ * Optional zod/v4 schema for validating command options.
71
+ * If provided, options will be validated and parsed according to this schema.
72
+ */
73
+ optionsSchema?: z.ZodObject;
69
74
  /**
70
- * Priority level for the command.
71
- * Higher priority commands will be loaded first.
72
- */
75
+ * Priority level for the command.
76
+ * Higher priority commands will be loaded first.
77
+ */
73
78
  priority?: number;
74
79
  /**
75
- * Registry to use for the command.
76
- * Registry is used to store the command and its options schema.
77
- */
80
+ * Registry to use for the command.
81
+ * Registry is used to store the command and its options schema.
82
+ */
78
83
  registry?: Registry;
79
84
  }
80
85
  /**
@@ -89,7 +94,7 @@ interface CommandOptions {
89
94
  * @example
90
95
  * ```typescript
91
96
  * import { Command, CommandHandler } from '@navios/commander'
92
- * import { z } from 'zod'
97
+ * import { z } from 'zod/v4'
93
98
  *
94
99
  * const optionsSchema = z.object({
95
100
  * name: z.string(),
@@ -114,7 +119,7 @@ declare function Command({
114
119
  optionsSchema,
115
120
  priority,
116
121
  registry
117
- }: CommandOptions): (target: ClassType, context: ClassDecoratorContext) => any;
122
+ }: CommandOptions): (target: ClassType, context: ClassDecoratorContext<abstract new (...args: any) => any>) => any;
118
123
  //#endregion
119
124
  //#region src/decorators/cli-module.decorator.d.mts
120
125
  /**
@@ -124,41 +129,41 @@ declare function Command({
124
129
  */
125
130
  interface CliModuleOptions {
126
131
  /**
127
- * Array or Set of command classes to register in this module.
128
- * Commands must be decorated with `@Command`.
129
- */
132
+ * Array or Set of command classes to register in this module.
133
+ * Commands must be decorated with `@Command`.
134
+ */
130
135
  commands?: ClassType[] | Set<ClassType>;
131
136
  /**
132
- * Array or Set of controller classes for HTTP endpoints.
133
- * Allows mixing HTTP and CLI functionality in the same module.
134
- */
137
+ * Array or Set of controller classes for HTTP endpoints.
138
+ * Allows mixing HTTP and CLI functionality in the same module.
139
+ */
135
140
  controllers?: ClassType[] | Set<ClassType>;
136
141
  /**
137
- * Array or Set of other modules to import.
138
- * Imported modules' commands and controllers will be available.
139
- */
142
+ * Array or Set of other modules to import.
143
+ * Imported modules' commands and controllers will be available.
144
+ */
140
145
  imports?: ClassType[] | Set<ClassType>;
141
146
  /**
142
- * Guards to apply to all controllers in this module.
143
- * Guards are executed in reverse order (last guard first).
144
- */
147
+ * Guards to apply to all controllers in this module.
148
+ * Guards are executed in reverse order (last guard first).
149
+ */
145
150
  guards?: ClassType[] | Set<ClassType>;
146
151
  /**
147
- * Service override classes to import for side effects.
148
- * These classes are imported to ensure their @Injectable decorators execute,
149
- * allowing them to register with the DI system. Overrides should use the same
150
- * InjectionToken as the original service with a higher priority.
151
- */
152
+ * Service override classes to import for side effects.
153
+ * These classes are imported to ensure their @Injectable decorators execute,
154
+ * allowing them to register with the DI system. Overrides should use the same
155
+ * InjectionToken as the original service with a higher priority.
156
+ */
152
157
  overrides?: ClassType[] | Set<ClassType>;
153
158
  /**
154
- * Priority level for the module.
155
- * Higher priority modules will be loaded first.
156
- */
159
+ * Priority level for the module.
160
+ * Higher priority modules will be loaded first.
161
+ */
157
162
  priority?: number;
158
163
  /**
159
- * Registry to use for the module.
160
- * Registry is used to store the module and its commands.
161
- */
164
+ * Registry to use for the module.
165
+ * Registry is used to store the module and its commands.
166
+ */
162
167
  registry?: Registry;
163
168
  }
164
169
  /**
@@ -206,7 +211,7 @@ declare function CliModule({
206
211
  overrides,
207
212
  priority,
208
213
  registry
209
- }?: CliModuleOptions): (target: ClassType, context: ClassDecoratorContext) => ClassType;
214
+ }?: CliModuleOptions): (target: ClassType, context: ClassDecoratorContext<abstract new (...args: any) => any>) => ClassType;
210
215
  //#endregion
211
216
  export { CommandHandler as a, CommandOptions as i, CliModuleOptions as n, Command as r, CliModule as t };
212
- //# sourceMappingURL=cli-module.decorator-CRaNGvgl.d.cts.map
217
+ //# sourceMappingURL=cli-module.decorator-BV3vVKlR.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-module.decorator-BV3vVKlR.d.cts","names":["CommandHandler","TOptions","Promise","InjectionToken","ClassType","ClassTypeWithInstance","Registry","z","CommandHandler","CommandOptions","ZodObject","Command","path","description","token","optionsSchema","priority","registry","ClassDecoratorContext","ClassType","Registry","CliModuleOptions","Set","CliModule","commands","controllers","imports","guards","overrides","priority","registry","ClassDecoratorContext"],"sources":["../src/interfaces/command-handler.interface.d.mts","../src/decorators/command.decorator.d.mts","../src/decorators/cli-module.decorator.d.mts"],"sourcesContent":["/**\n * Interface that all command classes must implement.\n *\n * Commands decorated with `@Command` must implement this interface.\n * The `execute` method is called when the command is invoked.\n *\n * @template TOptions - The type of options that the command accepts\n *\n * @example\n * ```typescript\n * import { Command, CommandHandler } from '@navios/commander'\n * import { z } from 'zod/v4'\n *\n * const optionsSchema = z.object({\n * name: z.string()\n * })\n *\n * type Options = z.infer<typeof optionsSchema>\n *\n * @Command({ path: 'greet', optionsSchema })\n * export class GreetCommand implements CommandHandler<Options> {\n * async execute(options: Options, positionals?: string[]) {\n * console.log(`Hello, ${options.name}!`)\n * if (positionals?.length) {\n * console.log(`Files: ${positionals.join(', ')}`)\n * }\n * }\n * }\n * ```\n */\nexport interface CommandHandler<TOptions = any> {\n /**\n * Executes the command with the provided options and positional arguments.\n *\n * @param options - The validated command options (validated against the command's schema if provided)\n * @param positionals - Positional arguments that don't match any option flags\n * @returns A promise or void\n */\n execute(options: TOptions, positionals?: string[]): void | Promise<void>\n}\n//# sourceMappingURL=command-handler.interface.d.mts.map\n","import { InjectionToken } from '@navios/core'\n\nimport type { ClassType, ClassTypeWithInstance, Registry } from '@navios/core'\nimport type { z } from 'zod/v4'\n\nimport type { CommandHandler } from '../interfaces/index.mjs'\n/**\n * Options for the `@Command` decorator.\n *\n * @public\n */\nexport interface CommandOptions {\n /**\n * The token to use for the command.\n * If provided, the command will be registered with this token.\n */\n token?: InjectionToken<ClassTypeWithInstance<CommandHandler<any>>>\n /**\n * The command path that users will invoke from the CLI.\n * Can be a single word (e.g., 'greet') or multi-word with colons (e.g., 'user:create', 'db:migrate').\n */\n path: string\n /**\n * Optional description of the command for help text.\n * Displayed when users run `help` or `--help`.\n */\n description?: string\n /**\n * Optional zod/v4 schema for validating command options.\n * If provided, options will be validated and parsed according to this schema.\n */\n optionsSchema?: z.ZodObject\n /**\n * Priority level for the command.\n * Higher priority commands will be loaded first.\n */\n priority?: number\n /**\n * Registry to use for the command.\n * Registry is used to store the command and its options schema.\n */\n registry?: Registry\n}\n/**\n * Decorator that marks a class as a CLI command.\n *\n * The decorated class must implement the `CommandHandler` interface with an `execute` method.\n * The command will be automatically registered when its module is loaded.\n *\n * @param options - Configuration options for the command\n * @returns A class decorator function\n *\n * @example\n * ```typescript\n * import { Command, CommandHandler } from '@navios/commander'\n * import { z } from 'zod/v4'\n *\n * const optionsSchema = z.object({\n * name: z.string(),\n * greeting: z.string().optional().default('Hello')\n * })\n *\n * @Command({\n * path: 'greet',\n * optionsSchema: optionsSchema\n * })\n * export class GreetCommand implements CommandHandler<z.infer<typeof optionsSchema>> {\n * async execute(options) {\n * console.log(`${options.greeting}, ${options.name}!`)\n * }\n * }\n * ```\n */\nexport declare function Command({\n path,\n description,\n token,\n optionsSchema,\n priority,\n registry,\n}: CommandOptions): (\n target: ClassType,\n context: ClassDecoratorContext<abstract new (...args: any) => any>,\n) => any\n//# sourceMappingURL=command.decorator.d.mts.map\n","import type { ClassType, Registry } from '@navios/core'\n/**\n * Options for the `@CliModule` decorator.\n *\n * @public\n */\nexport interface CliModuleOptions {\n /**\n * Array or Set of command classes to register in this module.\n * Commands must be decorated with `@Command`.\n */\n commands?: ClassType[] | Set<ClassType>\n /**\n * Array or Set of controller classes for HTTP endpoints.\n * Allows mixing HTTP and CLI functionality in the same module.\n */\n controllers?: ClassType[] | Set<ClassType>\n /**\n * Array or Set of other modules to import.\n * Imported modules' commands and controllers will be available.\n */\n imports?: ClassType[] | Set<ClassType>\n /**\n * Guards to apply to all controllers in this module.\n * Guards are executed in reverse order (last guard first).\n */\n guards?: ClassType[] | Set<ClassType>\n /**\n * Service override classes to import for side effects.\n * These classes are imported to ensure their @Injectable decorators execute,\n * allowing them to register with the DI system. Overrides should use the same\n * InjectionToken as the original service with a higher priority.\n */\n overrides?: ClassType[] | Set<ClassType>\n /**\n * Priority level for the module.\n * Higher priority modules will be loaded first.\n */\n priority?: number\n /**\n * Registry to use for the module.\n * Registry is used to store the module and its commands.\n */\n registry?: Registry\n}\n/**\n * Decorator that marks a class as a CLI module.\n *\n * This decorator extends the standard @Module decorator, adding support for\n * CLI commands while maintaining full compatibility with HTTP controllers.\n * Modules organize commands and can import other modules to compose larger\n * CLI applications.\n *\n * The module can optionally implement `NaviosModule` interface for lifecycle hooks.\n *\n * @param options - Configuration options for the module\n * @returns A class decorator function\n *\n * @example\n * ```typescript\n * import { CliModule } from '@navios/commander'\n * import { GreetCommand } from './greet.command'\n * import { UserModule } from './user.module'\n *\n * @CliModule({\n * commands: [GreetCommand],\n * imports: [UserModule]\n * })\n * export class AppModule {}\n * ```\n *\n * @example\n * ```typescript\n * // Mixed HTTP and CLI module\n * @CliModule({\n * controllers: [HealthController],\n * commands: [MigrateCommand],\n * imports: [DatabaseModule],\n * })\n * export class AppModule {}\n * ```\n */\nexport declare function CliModule({\n commands,\n controllers,\n imports,\n guards,\n overrides,\n priority,\n registry,\n}?: CliModuleOptions): (\n target: ClassType,\n context: ClassDecoratorContext<abstract new (...args: any) => any>,\n) => ClassType\n//# sourceMappingURL=cli-module.decorator.d.mts.map\n"],"mappings":";;;;;;;;;AA8BA;;;;ACnBA;;;;;;;AA8DA;;;;;;;;;;;;;;ACnEA;AAKamB,UFmBInB,cEnBJmB,CAAAA,WAAAA,GAAAA,CAAAA,CAAAA;EAAkBA;;;;;;;EAULG,OAAAA,CAAAA,OAAAA,EFiBPrB,QEjBOqB,EAAAA,WAAAA,CAAAA,EAAAA,MAAAA,EAAAA,CAAAA,EAAAA,IAAAA,GFiBmCpB,OEjBnCoB,CAAAA,IAAAA,CAAAA;;;;;;ADV1B;;;AAKUnB,UALOM,cAAAA,CAKPN;EAeQI;;;AA0ClB;EACEK,KAAAA,CAAAA,EA1DQT,cA0DRS,CA1DuBP,qBA0DvBO,CA1D6CJ,cA0D7CI,CAAAA,GAAAA,CAAAA,CAAAA,CAAAA;EACAC;;;;EAIAI,IAAAA,EAAAA,MAAAA;EACCR;;;;;;;AC1EH;;EAK+BU,aAAAA,CAAAA,EDoBbZ,CAAAA,CAAEG,SCpBWS;EAAJG;;;;EAUfH,QAAAA,CAAAA,EAAAA,MAAAA;EAAkBA;;;;EAKLG,QAAAA,CAAAA,EDeZhB,QCfYgB;;;;;;AAwDzB;;;;;;;;;;;;;;;;;;;;;;;;;;iBDTwBX,OAAAA;;;;;;;GAOrBF,0BACOL,oBACCc;;;;;;ADpDX;;UExBiBG,gBAAAA;;ADKjB;;;EAKUlB,QAAAA,CAAAA,ECLGgB,SDKHhB,EAAAA,GCLiBmB,GDKjBnB,CCLqBgB,SDKrBhB,CAAAA;EAeQI;;;AA0ClB;EACEK,WAAAA,CAAAA,EC1DcO,SD0DdP,EAAAA,GC1D4BU,GD0D5BV,CC1DgCO,SD0DhCP,CAAAA;EACAC;;;;EAIAI,OAAAA,CAAAA,EC1DUE,SD0DVF,EAAAA,GC1DwBK,GD0DxBL,CC1D4BE,SD0D5BF,CAAAA;EACCR;;;;WCtDQU,cAAcG,IAAIH;;;AApB7B;;;;EAUgBA,SAAAA,CAAAA,EAiBFA,SAjBEA,EAAAA,GAiBYG,GAjBZH,CAiBgBA,SAjBhBA,CAAAA;EAAkBA;;;;EAKRG,QAAAA,CAAAA,EAAAA,MAAAA;EAKfH;;;;EAOqBA,QAAAA,CAAAA,EAUnBC,QAVmBD;;;;AAiDhC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAAwBI,SAAAA;;;;;;;;IAQpBF,4BACMF,oBACCY,8DACNZ"}
@@ -1,4 +1,4 @@
1
- const require_command_decorator = require('./command.decorator-UrNJmQN0.cjs');
1
+ const require_command_decorator = require('./command.decorator-HziankUv.cjs');
2
2
  let _navios_core = require("@navios/core");
3
3
 
4
4
  //#region src/decorators/cli-module.decorator.mts
@@ -68,4 +68,4 @@ Object.defineProperty(exports, 'CliModule', {
68
68
  return CliModule;
69
69
  }
70
70
  });
71
- //# sourceMappingURL=cli-module.decorator-CkP22084.cjs.map
71
+ //# sourceMappingURL=cli-module.decorator-CXt38aqF.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-module.decorator-CXt38aqF.cjs","names":["Module","getModuleMetadata","getModuleCustomEntry","CommandEntryKey","CliModule","commands","controllers","imports","guards","overrides","priority","registry","target","context","kind","Error","result","metadata","commandSet","Set","command","add"],"sources":["../src/decorators/cli-module.decorator.mts"],"sourcesContent":["import { Module, getModuleMetadata, getModuleCustomEntry } from '@navios/core'\n\nimport type { ClassType, Registry } from '@navios/core'\n\nimport { CommandEntryKey, type CommandEntryValue } from '../metadata/command-entry.metadata.mjs'\n\n/**\n * Options for the `@CliModule` decorator.\n *\n * @public\n */\nexport interface CliModuleOptions {\n /**\n * Array or Set of command classes to register in this module.\n * Commands must be decorated with `@Command`.\n */\n commands?: ClassType[] | Set<ClassType>\n /**\n * Array or Set of controller classes for HTTP endpoints.\n * Allows mixing HTTP and CLI functionality in the same module.\n */\n controllers?: ClassType[] | Set<ClassType>\n /**\n * Array or Set of other modules to import.\n * Imported modules' commands and controllers will be available.\n */\n imports?: ClassType[] | Set<ClassType>\n /**\n * Guards to apply to all controllers in this module.\n * Guards are executed in reverse order (last guard first).\n */\n guards?: ClassType[] | Set<ClassType>\n /**\n * Service override classes to import for side effects.\n * These classes are imported to ensure their @Injectable decorators execute,\n * allowing them to register with the DI system. Overrides should use the same\n * InjectionToken as the original service with a higher priority.\n */\n overrides?: ClassType[] | Set<ClassType>\n /**\n * Priority level for the module.\n * Higher priority modules will be loaded first.\n */\n priority?: number\n /**\n * Registry to use for the module.\n * Registry is used to store the module and its commands.\n */\n registry?: Registry\n}\n\n/**\n * Decorator that marks a class as a CLI module.\n *\n * This decorator extends the standard @Module decorator, adding support for\n * CLI commands while maintaining full compatibility with HTTP controllers.\n * Modules organize commands and can import other modules to compose larger\n * CLI applications.\n *\n * The module can optionally implement `NaviosModule` interface for lifecycle hooks.\n *\n * @param options - Configuration options for the module\n * @returns A class decorator function\n *\n * @example\n * ```typescript\n * import { CliModule } from '@navios/commander'\n * import { GreetCommand } from './greet.command'\n * import { UserModule } from './user.module'\n *\n * @CliModule({\n * commands: [GreetCommand],\n * imports: [UserModule]\n * })\n * export class AppModule {}\n * ```\n *\n * @example\n * ```typescript\n * // Mixed HTTP and CLI module\n * @CliModule({\n * controllers: [HealthController],\n * commands: [MigrateCommand],\n * imports: [DatabaseModule],\n * })\n * export class AppModule {}\n * ```\n */\nexport function CliModule(\n {\n commands = [],\n controllers = [],\n imports = [],\n guards = [],\n overrides = [],\n priority,\n registry,\n }: CliModuleOptions = {\n commands: [],\n controllers: [],\n imports: [],\n guards: [],\n overrides: [],\n },\n) {\n return (target: ClassType, context: ClassDecoratorContext) => {\n if (context.kind !== 'class') {\n throw new Error('[Navios Commander] @CliModule decorator can only be used on classes.')\n }\n\n // Apply standard @Module decorator first\n const result = Module({\n controllers,\n imports,\n guards,\n overrides,\n priority,\n registry,\n })(target, context)\n\n // Get the module metadata that @Module just created\n const metadata = getModuleMetadata(target, context)\n\n // Store commands in customEntries\n const commandSet = getModuleCustomEntry<CommandEntryValue>(\n metadata,\n CommandEntryKey,\n () => new Set(),\n )\n for (const command of commands) {\n commandSet.add(command)\n }\n\n return result\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwFA,SAAgBI,UACd,EACEC,WAAW,EAAE,EACbC,cAAc,EAAE,EAChBC,UAAU,EAAE,EACZC,SAAS,EAAE,EACXC,YAAY,EAAE,EACdC,UACAC,aACoB;CACpBN,UAAU,EAAE;CACZC,aAAa,EAAE;CACfC,SAAS,EAAE;CACXC,QAAQ,EAAE;CACVC,WAAW,EAAE;CACd,EAAA;AAED,SAAQG,QAAmBC,YAAAA;AACzB,MAAIA,QAAQC,SAAS,QACnB,OAAM,IAAIC,MAAM,uEAAA;EAIlB,MAAMC,kCAAgB;GACpBV;GACAC;GACAC;GACAC;GACAC;GACAC;GACF,CAAA,CAAGC,QAAQC,QAAAA;EAMX,MAAMK,wFAH6BN,QAAQC,QAAAA,EAKzCV,iEACM,IAAIgB,KAAAA,CAAAA;AAEZ,OAAK,MAAMC,WAAWf,SACpBa,YAAWG,IAAID,QAAAA;AAGjB,SAAOJ"}
@@ -1,4 +1,4 @@
1
- import { n as CommandEntryKey } from "./command.decorator-DVLSAqYZ.mjs";
1
+ import { n as CommandEntryKey } from "./command.decorator-QiRU7ny3.mjs";
2
2
  import { Module, getModuleCustomEntry, getModuleMetadata } from "@navios/core";
3
3
 
4
4
  //#region src/decorators/cli-module.decorator.mts
@@ -63,4 +63,4 @@ import { Module, getModuleCustomEntry, getModuleMetadata } from "@navios/core";
63
63
 
64
64
  //#endregion
65
65
  export { CliModule as t };
66
- //# sourceMappingURL=cli-module.decorator-UGbtkRYc.mjs.map
66
+ //# sourceMappingURL=cli-module.decorator-DAjf_r_W.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cli-module.decorator-DAjf_r_W.mjs","names":["Module","getModuleMetadata","getModuleCustomEntry","CommandEntryKey","CliModule","commands","controllers","imports","guards","overrides","priority","registry","target","context","kind","Error","result","metadata","commandSet","Set","command","add"],"sources":["../src/decorators/cli-module.decorator.mts"],"sourcesContent":["import { Module, getModuleMetadata, getModuleCustomEntry } from '@navios/core'\n\nimport type { ClassType, Registry } from '@navios/core'\n\nimport { CommandEntryKey, type CommandEntryValue } from '../metadata/command-entry.metadata.mjs'\n\n/**\n * Options for the `@CliModule` decorator.\n *\n * @public\n */\nexport interface CliModuleOptions {\n /**\n * Array or Set of command classes to register in this module.\n * Commands must be decorated with `@Command`.\n */\n commands?: ClassType[] | Set<ClassType>\n /**\n * Array or Set of controller classes for HTTP endpoints.\n * Allows mixing HTTP and CLI functionality in the same module.\n */\n controllers?: ClassType[] | Set<ClassType>\n /**\n * Array or Set of other modules to import.\n * Imported modules' commands and controllers will be available.\n */\n imports?: ClassType[] | Set<ClassType>\n /**\n * Guards to apply to all controllers in this module.\n * Guards are executed in reverse order (last guard first).\n */\n guards?: ClassType[] | Set<ClassType>\n /**\n * Service override classes to import for side effects.\n * These classes are imported to ensure their @Injectable decorators execute,\n * allowing them to register with the DI system. Overrides should use the same\n * InjectionToken as the original service with a higher priority.\n */\n overrides?: ClassType[] | Set<ClassType>\n /**\n * Priority level for the module.\n * Higher priority modules will be loaded first.\n */\n priority?: number\n /**\n * Registry to use for the module.\n * Registry is used to store the module and its commands.\n */\n registry?: Registry\n}\n\n/**\n * Decorator that marks a class as a CLI module.\n *\n * This decorator extends the standard @Module decorator, adding support for\n * CLI commands while maintaining full compatibility with HTTP controllers.\n * Modules organize commands and can import other modules to compose larger\n * CLI applications.\n *\n * The module can optionally implement `NaviosModule` interface for lifecycle hooks.\n *\n * @param options - Configuration options for the module\n * @returns A class decorator function\n *\n * @example\n * ```typescript\n * import { CliModule } from '@navios/commander'\n * import { GreetCommand } from './greet.command'\n * import { UserModule } from './user.module'\n *\n * @CliModule({\n * commands: [GreetCommand],\n * imports: [UserModule]\n * })\n * export class AppModule {}\n * ```\n *\n * @example\n * ```typescript\n * // Mixed HTTP and CLI module\n * @CliModule({\n * controllers: [HealthController],\n * commands: [MigrateCommand],\n * imports: [DatabaseModule],\n * })\n * export class AppModule {}\n * ```\n */\nexport function CliModule(\n {\n commands = [],\n controllers = [],\n imports = [],\n guards = [],\n overrides = [],\n priority,\n registry,\n }: CliModuleOptions = {\n commands: [],\n controllers: [],\n imports: [],\n guards: [],\n overrides: [],\n },\n) {\n return (target: ClassType, context: ClassDecoratorContext) => {\n if (context.kind !== 'class') {\n throw new Error('[Navios Commander] @CliModule decorator can only be used on classes.')\n }\n\n // Apply standard @Module decorator first\n const result = Module({\n controllers,\n imports,\n guards,\n overrides,\n priority,\n registry,\n })(target, context)\n\n // Get the module metadata that @Module just created\n const metadata = getModuleMetadata(target, context)\n\n // Store commands in customEntries\n const commandSet = getModuleCustomEntry<CommandEntryValue>(\n metadata,\n CommandEntryKey,\n () => new Set(),\n )\n for (const command of commands) {\n commandSet.add(command)\n }\n\n return result\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwFA,SAAgBI,UACd,EACEC,WAAW,EAAE,EACbC,cAAc,EAAE,EAChBC,UAAU,EAAE,EACZC,SAAS,EAAE,EACXC,YAAY,EAAE,EACdC,UACAC,aACoB;CACpBN,UAAU,EAAE;CACZC,aAAa,EAAE;CACfC,SAAS,EAAE;CACXC,QAAQ,EAAE;CACVC,WAAW,EAAE;CACd,EAAA;AAED,SAAQG,QAAmBC,YAAAA;AACzB,MAAIA,QAAQC,SAAS,QACnB,OAAM,IAAIC,MAAM,uEAAA;EAIlB,MAAMC,SAAShB,OAAO;GACpBM;GACAC;GACAC;GACAC;GACAC;GACAC;GACF,CAAA,CAAGC,QAAQC,QAAAA;EAMX,MAAMK,aAAahB,qBAHFD,kBAAkBW,QAAQC,QAAAA,EAKzCV,uCACM,IAAIgB,KAAAA,CAAAA;AAEZ,OAAK,MAAMC,WAAWf,SACpBa,YAAWG,IAAID,QAAAA;AAGjB,SAAOJ"}