@h3ravel/core 1.16.1 → 1.17.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/dist/index.cjs CHANGED
@@ -608,215 +608,6 @@ var Application = class Application extends Container {
608
608
  }
609
609
  };
610
610
 
611
- //#endregion
612
- //#region src/Console/ConsoleCommand.ts
613
- var ConsoleCommand = class {
614
- constructor(app, kernel) {
615
- this.app = app;
616
- this.kernel = kernel;
617
- }
618
- /**
619
- * The underlying commander instance.
620
- *
621
- * @var Command
622
- */
623
- program;
624
- /**
625
- * The name and signature of the console command.
626
- *
627
- * @var string
628
- */
629
- signature;
630
- /**
631
- * A dictionary of signatures or what not.
632
- *
633
- * @var object
634
- */
635
- dictionary = {};
636
- /**
637
- * The console command description.
638
- *
639
- * @var string
640
- */
641
- description;
642
- /**
643
- * The console command input.
644
- *
645
- * @var object
646
- */
647
- input = {
648
- options: {},
649
- arguments: {}
650
- };
651
- /**
652
- * Execute the console command.
653
- */
654
- async handle(..._args) {}
655
- setApplication(app) {
656
- this.app = app;
657
- }
658
- setInput(options, args, regArgs, dictionary, program) {
659
- this.program = program;
660
- this.dictionary = dictionary;
661
- this.input.options = options;
662
- this.input.arguments = regArgs.map((e, i) => ({ [e.name()]: args[i] })).reduce((e, x) => Object.assign(e, x), {});
663
- this.loadBaseFlags();
664
- __h3ravel_shared.Logger.configure({
665
- verbosity: this.option("verbose"),
666
- silent: this.option("silent"),
667
- quiet: this.option("quiet")
668
- });
669
- return this;
670
- }
671
- setOption(key, value) {
672
- this.program.setOptionValue(key, value);
673
- return this;
674
- }
675
- setProgram(program) {
676
- this.program = program;
677
- return this;
678
- }
679
- getSignature() {
680
- return this.signature;
681
- }
682
- getDescription() {
683
- return this.description;
684
- }
685
- option(key, def) {
686
- const option = this.input.options[key] ?? def;
687
- return option === "null" || option === "undefined" ? void 0 : option;
688
- }
689
- options(key) {
690
- if (key) return this.input.options[key];
691
- return this.input.options;
692
- }
693
- argument(key, def) {
694
- return this.input.arguments[key] ?? def;
695
- }
696
- arguments() {
697
- return this.input.arguments;
698
- }
699
- loadBaseFlags() {
700
- let verbose = 0;
701
- if (this.program.getOptionValue("verbose") == "v") verbose = 2;
702
- else if (this.program.getOptionValue("verbose") == "vv") verbose = 3;
703
- else Number(this.program.getOptionValue("verbose") ?? 0);
704
- this.input.options.quiet = this.program.getOptionValue("quiet") ?? false;
705
- this.input.options.silent = this.program.getOptionValue("silent") ?? false;
706
- this.input.options.verbose = verbose;
707
- this.input.options.interaction = this.program.getOptionValue("interaction") ?? false;
708
- }
709
- /**
710
- * Check if the command is quiet
711
- *
712
- * @returns
713
- */
714
- isQuiet() {
715
- return this.option("quiet");
716
- }
717
- /**
718
- * Check if the command is silent
719
- *
720
- * @returns
721
- */
722
- isSilent() {
723
- return this.option("silent");
724
- }
725
- /**
726
- * Check if the command is non interactive
727
- *
728
- * @returns
729
- */
730
- isNonInteractive() {
731
- return this.option("interaction") === false;
732
- }
733
- /**
734
- * Get the verbosity of the command
735
- *
736
- * @returns
737
- */
738
- getVerbosity() {
739
- return Number(this.option("verbose"));
740
- }
741
- /**
742
- * Log an info message
743
- */
744
- info(message) {
745
- __h3ravel_shared.Logger.info(message);
746
- return this;
747
- }
748
- /**
749
- * Log a warning message
750
- */
751
- warn(message) {
752
- __h3ravel_shared.Logger.warn(message);
753
- return this;
754
- }
755
- /**
756
- * Log a line message
757
- */
758
- line(message) {
759
- __h3ravel_shared.Logger.log(message, "white");
760
- return this;
761
- }
762
- /**
763
- * Log a new line
764
- */
765
- newLine(count = 1) {
766
- if (Number(this.getVerbosity()) >= 3 || !this.isSilent() && !this.isQuiet()) for (let i = 0; i < count; i++) console.log("");
767
- return this;
768
- }
769
- /**
770
- * Log a success message
771
- */
772
- success(message) {
773
- __h3ravel_shared.Logger.success(message);
774
- return this;
775
- }
776
- /**
777
- * Log an error message
778
- */
779
- error(message) {
780
- __h3ravel_shared.Logger.error(message, false);
781
- return this;
782
- }
783
- /**
784
- * Log an error message and terminate execution of the command
785
- * return an exit code of 1
786
- *
787
- * This method is not chainable
788
- */
789
- fail(message) {
790
- this.error(message);
791
- process.exit(1);
792
- }
793
- /**
794
- * Log a debug message
795
- */
796
- debug(message) {
797
- __h3ravel_shared.Logger.debug(message);
798
- return this;
799
- }
800
- };
801
-
802
- //#endregion
803
- //#region src/Console/ConsoleKernel.ts
804
- var ConsoleKernel = class {
805
- cwd;
806
- output = typeof __h3ravel_shared.Logger;
807
- basePath = "";
808
- modulePath;
809
- consolePath;
810
- modulePackage;
811
- consolePackage;
812
- constructor(app) {
813
- this.app = app;
814
- }
815
- async ensureDirectoryExists(dir) {
816
- await (0, node_fs_promises.mkdir)(dir, { recursive: true });
817
- }
818
- };
819
-
820
611
  //#endregion
821
612
  //#region src/Controller.ts
822
613
  /**
@@ -1034,8 +825,6 @@ var CoreServiceProvider = class extends ServiceProvider {
1034
825
  //#endregion
1035
826
  exports.Application = Application;
1036
827
  exports.ConfigException = ConfigException;
1037
- exports.ConsoleCommand = ConsoleCommand;
1038
- exports.ConsoleKernel = ConsoleKernel;
1039
828
  exports.Container = Container;
1040
829
  exports.ContainerResolver = ContainerResolver;
1041
830
  exports.Controller = Controller;
@@ -1045,5 +834,4 @@ exports.Injectable = Injectable;
1045
834
  exports.Kernel = Kernel;
1046
835
  exports.ProviderRegistry = ProviderRegistry;
1047
836
  exports.Registerer = Registerer;
1048
- exports.ServiceProvider = ServiceProvider;
1049
- //# sourceMappingURL=index.cjs.map
837
+ exports.ServiceProvider = ServiceProvider;
package/dist/index.d.cts CHANGED
@@ -1,8 +1,6 @@
1
1
  /// <reference path="./app.globals.d.ts" />
2
2
  import { Bindings, HttpContext, IApplication, IContainer, IController, IMiddleware, IPathName, IServiceProvider, PathLoader, UseKey } from "@h3ravel/shared";
3
3
  import { H3, H3Event } from "h3";
4
- import { Argument, Command } from "commander";
5
- import { XGeneric } from "@h3ravel/support";
6
4
 
7
5
  //#region src/Container.d.ts
8
6
  declare class Container implements IContainer {
@@ -220,135 +218,6 @@ declare class Application extends Container implements IApplication {
220
218
  static getVersion(key: string): string;
221
219
  }
222
220
  //#endregion
223
- //#region src/Console/ConsoleKernel.d.ts
224
- declare class ConsoleKernel {
225
- app: Application;
226
- cwd: string;
227
- output: "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
228
- basePath: string;
229
- modulePath: string;
230
- consolePath: string;
231
- modulePackage: XGeneric<{
232
- version: string;
233
- }>;
234
- consolePackage: XGeneric<{
235
- version: string;
236
- }>;
237
- constructor(app: Application);
238
- ensureDirectoryExists(dir: string): Promise<void>;
239
- }
240
- //#endregion
241
- //#region src/Console/ConsoleCommand.d.ts
242
- declare class ConsoleCommand {
243
- protected app: Application;
244
- protected kernel: ConsoleKernel;
245
- constructor(app: Application, kernel: ConsoleKernel);
246
- /**
247
- * The underlying commander instance.
248
- *
249
- * @var Command
250
- */
251
- program: Command;
252
- /**
253
- * The name and signature of the console command.
254
- *
255
- * @var string
256
- */
257
- protected signature: string;
258
- /**
259
- * A dictionary of signatures or what not.
260
- *
261
- * @var object
262
- */
263
- protected dictionary: Record<string, any>;
264
- /**
265
- * The console command description.
266
- *
267
- * @var string
268
- */
269
- protected description?: string;
270
- /**
271
- * The console command input.
272
- *
273
- * @var object
274
- */
275
- private input;
276
- /**
277
- * Execute the console command.
278
- */
279
- handle(..._args: any[]): Promise<void>;
280
- setApplication(app: Application): void;
281
- setInput(options: XGeneric, args: string[], regArgs: readonly Argument[], dictionary: Record<string, any>, program: Command): this;
282
- setOption(key: string, value: unknown): this;
283
- setProgram(program: Command): this;
284
- getSignature(): string;
285
- getDescription(): string | undefined;
286
- option(key: string, def?: any): any;
287
- options(key?: string): any;
288
- argument(key: string, def?: any): any;
289
- arguments(): Record<string, any>;
290
- loadBaseFlags(): void;
291
- /**
292
- * Check if the command is quiet
293
- *
294
- * @returns
295
- */
296
- isQuiet(): any;
297
- /**
298
- * Check if the command is silent
299
- *
300
- * @returns
301
- */
302
- isSilent(): any;
303
- /**
304
- * Check if the command is non interactive
305
- *
306
- * @returns
307
- */
308
- isNonInteractive(): boolean;
309
- /**
310
- * Get the verbosity of the command
311
- *
312
- * @returns
313
- */
314
- getVerbosity(): number;
315
- /**
316
- * Log an info message
317
- */
318
- info(message: string): this;
319
- /**
320
- * Log a warning message
321
- */
322
- warn(message: string): this;
323
- /**
324
- * Log a line message
325
- */
326
- line(message: string): this;
327
- /**
328
- * Log a new line
329
- */
330
- newLine(count?: number): this;
331
- /**
332
- * Log a success message
333
- */
334
- success(message: string): this;
335
- /**
336
- * Log an error message
337
- */
338
- error(message: string): this;
339
- /**
340
- * Log an error message and terminate execution of the command
341
- * return an exit code of 1
342
- *
343
- * This method is not chainable
344
- */
345
- fail(message: string): void;
346
- /**
347
- * Log a debug message
348
- */
349
- debug(message: string | string[]): this;
350
- }
351
- //#endregion
352
221
  //#region src/Contracts/ServiceProviderConstructor.d.ts
353
222
  type ServiceProviderConstructor = (new (app: Application) => ServiceProvider) & IServiceProvider;
354
223
  //#endregion
@@ -550,5 +419,4 @@ declare class Registerer {
550
419
  private databasePath;
551
420
  }
552
421
  //#endregion
553
- export { Application, ConfigException, ConsoleCommand, ConsoleKernel, Container, ContainerResolver, Controller, CoreServiceProvider, Inject, Injectable, Kernel, ProviderRegistry, Registerer, ServiceProvider, ServiceProviderConstructor };
554
- //# sourceMappingURL=index.d.cts.map
422
+ export { Application, ConfigException, Container, ContainerResolver, Controller, CoreServiceProvider, Inject, Injectable, Kernel, ProviderRegistry, Registerer, ServiceProvider, ServiceProviderConstructor };
package/dist/index.d.ts CHANGED
@@ -1,9 +1,7 @@
1
1
  /// <reference path="./app.globals.d.ts" />
2
2
  import "reflect-metadata";
3
3
  import { Bindings, HttpContext, IApplication, IContainer, IController, IMiddleware, IPathName, IServiceProvider, PathLoader, UseKey } from "@h3ravel/shared";
4
- import { XGeneric } from "@h3ravel/support";
5
4
  import { H3, H3Event } from "h3";
6
- import { Argument, Command } from "commander";
7
5
 
8
6
  //#region src/Container.d.ts
9
7
  declare class Container implements IContainer {
@@ -221,135 +219,6 @@ declare class Application extends Container implements IApplication {
221
219
  static getVersion(key: string): string;
222
220
  }
223
221
  //#endregion
224
- //#region src/Console/ConsoleKernel.d.ts
225
- declare class ConsoleKernel {
226
- app: Application;
227
- cwd: string;
228
- output: "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
229
- basePath: string;
230
- modulePath: string;
231
- consolePath: string;
232
- modulePackage: XGeneric<{
233
- version: string;
234
- }>;
235
- consolePackage: XGeneric<{
236
- version: string;
237
- }>;
238
- constructor(app: Application);
239
- ensureDirectoryExists(dir: string): Promise<void>;
240
- }
241
- //#endregion
242
- //#region src/Console/ConsoleCommand.d.ts
243
- declare class ConsoleCommand {
244
- protected app: Application;
245
- protected kernel: ConsoleKernel;
246
- constructor(app: Application, kernel: ConsoleKernel);
247
- /**
248
- * The underlying commander instance.
249
- *
250
- * @var Command
251
- */
252
- program: Command;
253
- /**
254
- * The name and signature of the console command.
255
- *
256
- * @var string
257
- */
258
- protected signature: string;
259
- /**
260
- * A dictionary of signatures or what not.
261
- *
262
- * @var object
263
- */
264
- protected dictionary: Record<string, any>;
265
- /**
266
- * The console command description.
267
- *
268
- * @var string
269
- */
270
- protected description?: string;
271
- /**
272
- * The console command input.
273
- *
274
- * @var object
275
- */
276
- private input;
277
- /**
278
- * Execute the console command.
279
- */
280
- handle(..._args: any[]): Promise<void>;
281
- setApplication(app: Application): void;
282
- setInput(options: XGeneric, args: string[], regArgs: readonly Argument[], dictionary: Record<string, any>, program: Command): this;
283
- setOption(key: string, value: unknown): this;
284
- setProgram(program: Command): this;
285
- getSignature(): string;
286
- getDescription(): string | undefined;
287
- option(key: string, def?: any): any;
288
- options(key?: string): any;
289
- argument(key: string, def?: any): any;
290
- arguments(): Record<string, any>;
291
- loadBaseFlags(): void;
292
- /**
293
- * Check if the command is quiet
294
- *
295
- * @returns
296
- */
297
- isQuiet(): any;
298
- /**
299
- * Check if the command is silent
300
- *
301
- * @returns
302
- */
303
- isSilent(): any;
304
- /**
305
- * Check if the command is non interactive
306
- *
307
- * @returns
308
- */
309
- isNonInteractive(): boolean;
310
- /**
311
- * Get the verbosity of the command
312
- *
313
- * @returns
314
- */
315
- getVerbosity(): number;
316
- /**
317
- * Log an info message
318
- */
319
- info(message: string): this;
320
- /**
321
- * Log a warning message
322
- */
323
- warn(message: string): this;
324
- /**
325
- * Log a line message
326
- */
327
- line(message: string): this;
328
- /**
329
- * Log a new line
330
- */
331
- newLine(count?: number): this;
332
- /**
333
- * Log a success message
334
- */
335
- success(message: string): this;
336
- /**
337
- * Log an error message
338
- */
339
- error(message: string): this;
340
- /**
341
- * Log an error message and terminate execution of the command
342
- * return an exit code of 1
343
- *
344
- * This method is not chainable
345
- */
346
- fail(message: string): void;
347
- /**
348
- * Log a debug message
349
- */
350
- debug(message: string | string[]): this;
351
- }
352
- //#endregion
353
222
  //#region src/Contracts/ServiceProviderConstructor.d.ts
354
223
  type ServiceProviderConstructor = (new (app: Application) => ServiceProvider) & IServiceProvider;
355
224
  //#endregion
@@ -551,5 +420,4 @@ declare class Registerer {
551
420
  private databasePath;
552
421
  }
553
422
  //#endregion
554
- export { Application, ConfigException, ConsoleCommand, ConsoleKernel, Container, ContainerResolver, Controller, CoreServiceProvider, Inject, Injectable, Kernel, ProviderRegistry, Registerer, ServiceProvider, ServiceProviderConstructor };
555
- //# sourceMappingURL=index.d.ts.map
423
+ export { Application, ConfigException, Container, ContainerResolver, Controller, CoreServiceProvider, Inject, Injectable, Kernel, ProviderRegistry, Registerer, ServiceProvider, ServiceProviderConstructor };
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import { Str, dd, dump, str } from "@h3ravel/support";
6
6
  import { detect } from "detect-port";
7
7
  import dotenv from "dotenv";
8
8
  import dotenvExpand from "dotenv-expand";
9
- import { mkdir, readFile } from "node:fs/promises";
9
+ import { readFile } from "node:fs/promises";
10
10
  import semver from "semver";
11
11
 
12
12
  //#region src/Container.ts
@@ -576,215 +576,6 @@ var Application = class Application extends Container {
576
576
  }
577
577
  };
578
578
 
579
- //#endregion
580
- //#region src/Console/ConsoleCommand.ts
581
- var ConsoleCommand = class {
582
- constructor(app, kernel) {
583
- this.app = app;
584
- this.kernel = kernel;
585
- }
586
- /**
587
- * The underlying commander instance.
588
- *
589
- * @var Command
590
- */
591
- program;
592
- /**
593
- * The name and signature of the console command.
594
- *
595
- * @var string
596
- */
597
- signature;
598
- /**
599
- * A dictionary of signatures or what not.
600
- *
601
- * @var object
602
- */
603
- dictionary = {};
604
- /**
605
- * The console command description.
606
- *
607
- * @var string
608
- */
609
- description;
610
- /**
611
- * The console command input.
612
- *
613
- * @var object
614
- */
615
- input = {
616
- options: {},
617
- arguments: {}
618
- };
619
- /**
620
- * Execute the console command.
621
- */
622
- async handle(..._args) {}
623
- setApplication(app) {
624
- this.app = app;
625
- }
626
- setInput(options, args, regArgs, dictionary, program) {
627
- this.program = program;
628
- this.dictionary = dictionary;
629
- this.input.options = options;
630
- this.input.arguments = regArgs.map((e, i) => ({ [e.name()]: args[i] })).reduce((e, x) => Object.assign(e, x), {});
631
- this.loadBaseFlags();
632
- Logger.configure({
633
- verbosity: this.option("verbose"),
634
- silent: this.option("silent"),
635
- quiet: this.option("quiet")
636
- });
637
- return this;
638
- }
639
- setOption(key, value) {
640
- this.program.setOptionValue(key, value);
641
- return this;
642
- }
643
- setProgram(program) {
644
- this.program = program;
645
- return this;
646
- }
647
- getSignature() {
648
- return this.signature;
649
- }
650
- getDescription() {
651
- return this.description;
652
- }
653
- option(key, def) {
654
- const option = this.input.options[key] ?? def;
655
- return option === "null" || option === "undefined" ? void 0 : option;
656
- }
657
- options(key) {
658
- if (key) return this.input.options[key];
659
- return this.input.options;
660
- }
661
- argument(key, def) {
662
- return this.input.arguments[key] ?? def;
663
- }
664
- arguments() {
665
- return this.input.arguments;
666
- }
667
- loadBaseFlags() {
668
- let verbose = 0;
669
- if (this.program.getOptionValue("verbose") == "v") verbose = 2;
670
- else if (this.program.getOptionValue("verbose") == "vv") verbose = 3;
671
- else Number(this.program.getOptionValue("verbose") ?? 0);
672
- this.input.options.quiet = this.program.getOptionValue("quiet") ?? false;
673
- this.input.options.silent = this.program.getOptionValue("silent") ?? false;
674
- this.input.options.verbose = verbose;
675
- this.input.options.interaction = this.program.getOptionValue("interaction") ?? false;
676
- }
677
- /**
678
- * Check if the command is quiet
679
- *
680
- * @returns
681
- */
682
- isQuiet() {
683
- return this.option("quiet");
684
- }
685
- /**
686
- * Check if the command is silent
687
- *
688
- * @returns
689
- */
690
- isSilent() {
691
- return this.option("silent");
692
- }
693
- /**
694
- * Check if the command is non interactive
695
- *
696
- * @returns
697
- */
698
- isNonInteractive() {
699
- return this.option("interaction") === false;
700
- }
701
- /**
702
- * Get the verbosity of the command
703
- *
704
- * @returns
705
- */
706
- getVerbosity() {
707
- return Number(this.option("verbose"));
708
- }
709
- /**
710
- * Log an info message
711
- */
712
- info(message) {
713
- Logger.info(message);
714
- return this;
715
- }
716
- /**
717
- * Log a warning message
718
- */
719
- warn(message) {
720
- Logger.warn(message);
721
- return this;
722
- }
723
- /**
724
- * Log a line message
725
- */
726
- line(message) {
727
- Logger.log(message, "white");
728
- return this;
729
- }
730
- /**
731
- * Log a new line
732
- */
733
- newLine(count = 1) {
734
- if (Number(this.getVerbosity()) >= 3 || !this.isSilent() && !this.isQuiet()) for (let i = 0; i < count; i++) console.log("");
735
- return this;
736
- }
737
- /**
738
- * Log a success message
739
- */
740
- success(message) {
741
- Logger.success(message);
742
- return this;
743
- }
744
- /**
745
- * Log an error message
746
- */
747
- error(message) {
748
- Logger.error(message, false);
749
- return this;
750
- }
751
- /**
752
- * Log an error message and terminate execution of the command
753
- * return an exit code of 1
754
- *
755
- * This method is not chainable
756
- */
757
- fail(message) {
758
- this.error(message);
759
- process.exit(1);
760
- }
761
- /**
762
- * Log a debug message
763
- */
764
- debug(message) {
765
- Logger.debug(message);
766
- return this;
767
- }
768
- };
769
-
770
- //#endregion
771
- //#region src/Console/ConsoleKernel.ts
772
- var ConsoleKernel = class {
773
- cwd;
774
- output = typeof Logger;
775
- basePath = "";
776
- modulePath;
777
- consolePath;
778
- modulePackage;
779
- consolePackage;
780
- constructor(app) {
781
- this.app = app;
782
- }
783
- async ensureDirectoryExists(dir) {
784
- await mkdir(dir, { recursive: true });
785
- }
786
- };
787
-
788
579
  //#endregion
789
580
  //#region src/Controller.ts
790
581
  /**
@@ -1000,5 +791,4 @@ var CoreServiceProvider = class extends ServiceProvider {
1000
791
  };
1001
792
 
1002
793
  //#endregion
1003
- export { Application, ConfigException, ConsoleCommand, ConsoleKernel, Container, ContainerResolver, Controller, CoreServiceProvider, Inject, Injectable, Kernel, ProviderRegistry, Registerer, ServiceProvider };
1004
- //# sourceMappingURL=index.js.map
794
+ export { Application, ConfigException, Container, ContainerResolver, Controller, CoreServiceProvider, Inject, Injectable, Kernel, ProviderRegistry, Registerer, ServiceProvider };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@h3ravel/core",
3
- "version": "1.16.1",
3
+ "version": "1.17.0",
4
4
  "description": "Core application container, lifecycle management and service providers for H3ravel.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -54,8 +54,8 @@
54
54
  "semver": "^7.7.2",
55
55
  "srvx": "^0.8.7",
56
56
  "tslib": "^2.8.1",
57
- "@h3ravel/shared": "^0.22.2",
58
- "@h3ravel/support": "^0.14.1"
57
+ "@h3ravel/shared": "^0.22.3",
58
+ "@h3ravel/support": "^0.14.2"
59
59
  },
60
60
  "devDependencies": {
61
61
  "@types/semver": "^7.7.1",
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.cjs","names":["dependencies: any[]","app: Application","params: any[]","args: any[]","providers: ProviderCtor[]","path","pkg: any","app: Application","dd","dump","path","nodepath","PathLoader","FileSystem","path","Str","port: number","tries: number","hostname: string","e: any","app: Application","kernel: ConsoleKernel","Logger","app: Application","Logger","context: (event: H3Event) => HttpContext","middleware: IMiddleware[]"],"sources":["../src/Container.ts","../src/Di/ContainerResolver.ts","../src/ProviderRegistry.ts","../src/Registerer.ts","../src/Application.ts","../src/Console/ConsoleCommand.ts","../src/Console/ConsoleKernel.ts","../src/Controller.ts","../src/Di/Inject.ts","../src/Exceptions/ConfigException.ts","../src/Http/Kernel.ts","../src/ServiceProvider.ts","../src/Providers/CoreServiceProvider.ts"],"sourcesContent":["import type { Bindings, IContainer, UseKey } from '@h3ravel/shared'\n\ntype IBinding = UseKey | (new (..._args: any[]) => unknown)\n\nexport class Container implements IContainer {\n private bindings = new Map<IBinding, () => unknown>()\n private singletons = new Map<IBinding, unknown>()\n\n /**\n * Check if the target has any decorators\n * \n * @param target \n * @returns \n */\n static hasAnyDecorator<C extends abstract new (...args: any[]) => any> (target: C): boolean\n static hasAnyDecorator<F extends (...args: any[]) => any> (target: F): boolean\n static hasAnyDecorator (target: (...args: any[]) => any): boolean {\n if (Reflect.getMetadataKeys(target).length > 0) return true\n\n const paramLength = target.length\n\n for (let i = 0; i < paramLength; i++) {\n if (Reflect.getMetadataKeys(target, `__param_${i}`).length > 0) {\n return true\n }\n }\n\n return false\n }\n\n /**\n * Bind a transient service to the container\n */\n bind<T> (key: new (...args: any[]) => T, factory: () => T): void\n bind<T extends UseKey> (key: T, factory: () => Bindings[T]): void\n bind<T extends UseKey> (\n key: T,\n factory: () => Bindings[T] | T\n ) {\n this.bindings.set(key, factory)\n }\n\n /**\n * Bind a singleton service to the container\n */\n singleton<T extends UseKey> (\n key: T | (new (..._args: any[]) => Bindings[T]),\n factory: (app: this) => Bindings[T]\n ) {\n this.bindings.set(key, () => {\n if (!this.singletons.has(key)) {\n this.singletons.set(key, factory(this))\n }\n return this.singletons.get(key)!\n })\n }\n\n /**\n * Resolve a service from the container\n */\n make<T extends UseKey> (key: T): Bindings[T]\n make<C extends abstract new (...args: any[]) => any> (key: C): InstanceType<C>\n make<F extends (...args: any[]) => any> (key: F): ReturnType<F>\n make (key: any): any {\n /**\n * Direct factory binding\n */\n if (this.bindings.has(key)) {\n return this.bindings.get(key)!()\n }\n\n /**\n * If this is a class constructor, auto-resolve via reflection\n */\n if (typeof key === 'function') {\n return this.build(key)\n }\n\n throw new Error(\n `No binding found for key: ${typeof key === 'string' ? key : (key as any)?.name}`\n )\n }\n\n /**\n * Automatically build a class with constructor dependency injection\n */\n private build<T extends UseKey> (ClassType: new (..._args: any[]) => Bindings[T]): Bindings[T] {\n let dependencies: any[] = []\n\n if (Array.isArray((ClassType as any).__inject__)) {\n dependencies = (ClassType as any).__inject__.map((alias: any) => {\n return this.make(alias)\n })\n } else {\n const paramTypes: any[] = Reflect.getMetadata('design:paramtypes', ClassType) || []\n dependencies = paramTypes.map((dep) => this.make(dep))\n }\n\n return new ClassType(...dependencies)\n }\n\n /**\n * Check if a service is registered\n */\n has (key: UseKey): boolean {\n return this.bindings.has(key)\n }\n}\n","import 'reflect-metadata'\n\nimport { Application } from '..'\n\nexport class ContainerResolver {\n constructor(private app: Application) { }\n\n async resolveMethodParams<I extends Record<string, any>> (instance: I, method: keyof I, ..._default: any[]) {\n /**\n * Get param types for instance method\n */\n let params: any[] = Reflect.getMetadata('design:paramtypes', instance, String(method)) || []\n\n /**\n * Ensure that the Application class is always available\n */\n if (params.length < 1 && _default.length > 0) {\n params = _default\n }\n\n /**\n * Resolve the bound dependencies\n */\n const args: any[] = params.filter(e => ContainerResolver.isClass(e)).map((type: any) => {\n return this.app.make(type)\n })\n\n return new Promise<I>((resolve) => {\n resolve(instance[method](...args))\n })\n }\n\n static isClass (C: any) {\n return typeof C === 'function' &&\n C.prototype !== undefined &&\n Object.toString.call(C).substring(0, 5) === 'class'\n }\n}\n","import type { Application } from './Application'\nimport { ContainerResolver } from '../src/Di/ContainerResolver'\nimport { ServiceProvider } from './ServiceProvider'\nimport fg from 'fast-glob'\nimport path from 'node:path'\n\ntype ProviderCtor = (new (_app: Application) => ServiceProvider) & Partial<ServiceProvider>\n\nexport class ProviderRegistry {\n private static providers = new Map<string, ProviderCtor>()\n private static priorityMap = new Map<string, number>()\n private static filteredProviders: string[] = []\n private static sortable = true\n\n /**\n * Set wether providers should be sorted or not.\n * \n * @returns \n */\n static setSortable (sort: boolean = true): void {\n this.sortable = sort\n }\n\n /**\n * Get a unique identifier for the Provider.\n * \n * @param provider \n * @returns \n */\n private static getKey (provider: ProviderCtor): string {\n // If provider has a declared static uid/id → prefer that\n const anyProvider = provider as any\n if (typeof anyProvider.uid === 'string') {\n return anyProvider.uid\n }\n if (typeof anyProvider.id === 'string') {\n return anyProvider.id\n }\n\n // Otherwise fallback to class name + source file (if available)\n // Works for both Node.js (filename from stack) and bundlers\n return provider.name || 'AnonymousProvider'\n }\n\n /**\n * Register one or more providers.\n * Duplicate constructors will be ignored.\n * \n * @param providers \n * @returns \n */\n static register (...providers: ProviderCtor[]): void {\n const list = this.sortable\n ? this.sort(providers.concat(...this.providers.values()))\n : providers.concat(...this.providers.values())\n\n for (const provider of list) {\n const key = this.getKey(provider)\n this.providers.set(key, provider)\n }\n }\n\n /**\n * Bulk register providers from an array.\n * \n * @param providers \n * @returns \n */\n static registerMany (providers: ProviderCtor[]): void {\n const list = this.sortable\n ? this.sort(providers.concat(...this.providers.values()))\n : providers.concat(...this.providers.values())\n\n for (const provider of list) {\n const key = this.getKey(provider)\n this.providers.set(key, provider)\n }\n }\n\n /**\n * Get all registered providers as an array.\n * \n * @returns \n */\n static setFiltered (filtered: string[]): void {\n this.filteredProviders = filtered\n }\n\n /**\n * Resolve (instantiate) all providers with the given application or Service Container.\n * \n * @param app \n * @returns \n */\n static async resolve (app: Application, useServiceContainer: boolean = false): Promise<ServiceProvider[]> {\n\n // Remove all filtered service providers \n const providers = Array.from(this.providers.values()).filter(e => {\n return !!e && (this.filteredProviders.length < 1 || !this.filteredProviders.includes(e.name))\n })\n\n return await Promise.all(providers.map(async (ProviderClass) => {\n // Don't bind to the service container if we don't have to\n const provider = new ProviderClass(app)\n if (!useServiceContainer) return Promise.resolve(provider)\n\n // Bind to the service container\n await new ContainerResolver(app).resolveMethodParams(provider, 'register', app)\n return provider\n }))\n }\n\n /**\n * Sort the service providers\n * \n * @param providers \n * @returns \n */\n static sort (providers: ProviderCtor[]) {\n /**\n * Base priority (default 0)\n */\n providers.forEach((Provider) => {\n const key = this.getKey(Provider)\n this.priorityMap.set(`${Provider.name}::${key}`, (Provider as any).priority ?? 0)\n })\n\n /**\n * Handle before/after adjustments\n */\n providers.forEach((Provider) => {\n const order = (Provider as any).order\n if (!order) return\n\n const [direction, target] = order.split(':')\n const targetPriority = this.priorityMap.get(target) ?? 0\n const key = this.getKey(Provider)\n\n if (direction === 'before') {\n this.priorityMap.set(`${Provider.name}::${key}`, targetPriority - 1)\n } else if (direction === 'after') {\n this.priorityMap.set(`${Provider.name}::${key}`, targetPriority + 1)\n }\n })\n\n /**\n * Return service providers sorted based on thier name and priority\n */\n return providers.sort(\n (A, B) => {\n const keyA = this.getKey(A)\n const keyB = this.getKey(B)\n return (this.priorityMap.get(`${B.name}::${keyB}`) ?? 0) - (this.priorityMap.get(`${A.name}::${keyA}`) ?? 0)\n }\n )\n }\n\n /**\n * Sort service providers\n */\n static doSort () {\n const raw = this.sort(Array.from(this.providers.values()))\n const providers = new Map<string, ProviderCtor>()\n\n for (const provider of raw) {\n const key = this.getKey(provider)\n providers.set(key, provider)\n }\n\n this.providers = providers\n }\n\n /**\n * Log the service providers in a table\n * \n * @param priorityMap \n */\n static log<P extends ServiceProvider> (providers?: Array<P> | Map<string, P>) {\n const sorted = Array.from(((providers as unknown as P[]) ?? this.providers).values())\n\n console.table(\n sorted.map((P: any) => ({\n Name: P.constructor.name,\n Order: P.constructor.order ?? 'N/A',\n Priority: P.constructor.priority,\n }))\n )\n\n console.info('')\n }\n\n /**\n * Get all registered providers as an array.\n * \n * @returns \n */\n static all (): ProviderCtor[] {\n return Array.from(this.providers.values())\n }\n\n /**\n * Check if a provider is already registered.\n * \n * @param provider \n * @returns \n */\n static has (provider: ProviderCtor): boolean {\n return this.providers.has(this.getKey(provider))\n }\n\n /**\n * Automatically search for and discover service providers in packages.\n * \n * @param autoRegister \n * @returns \n */\n public static async discoverProviders (autoRegister = true) {\n const manifests = await fg([\n 'node_modules/@h3ravel/*/package.json',\n 'node_modules/@h3ravel-community/*/package.json',\n 'node_modules/h3ravel-*/package.json',\n ])\n\n const providers: ProviderCtor[] = []\n\n for (const manifestPath of manifests) {\n const pkg = await this.getManifest(path.resolve(manifestPath))\n if (pkg.h3ravel?.providers) {\n providers.push(...await Promise.all(\n pkg.h3ravel.providers.map(\n async (name: string) => (await import(path.resolve(path.dirname(manifestPath), 'dist/index.js')))[name]\n )))\n }\n }\n\n if (autoRegister) {\n for (const provider of providers) {\n const key = this.getKey(provider)\n this.providers.set(key, provider)\n }\n }\n\n return providers\n }\n\n /**\n * Get the content of the package.json file\n * \n * @param manifestPath \n * @returns \n */\n private static async getManifest (manifestPath: string) {\n let pkg: any\n try {\n pkg = (await import(manifestPath)).default\n } catch {\n const { createRequire } = await import('module')\n const require = createRequire(import.meta.url)\n pkg = require(manifestPath)\n }\n return pkg\n }\n}\n","import { dd, dump } from '@h3ravel/support'\n\nimport { Application } from '.'\nimport nodepath from 'node:path'\n\nexport class Registerer {\n constructor(private app: Application) { }\n\n static register (app: Application) {\n const reg = new Registerer(app)\n reg.bootRegister()\n }\n\n bootRegister () {\n globalThis.dd = dd\n globalThis.dump = dump\n globalThis.app_path = (path?: string) => this.appPath(path)\n globalThis.base_path = (path?: string) => this.basePath(path)\n globalThis.public_path = (path?: string) => this.publicPath(path)\n globalThis.storage_path = (path?: string) => this.storagePath(path)\n globalThis.database_path = (path?: string) => this.databasePath(path)\n }\n\n private appPath (path?: string) {\n return this.app.getPath(\n 'base', nodepath.join(`/${process.env.DIST_DIR ?? 'src'}/`.replace(/([^:]\\/)\\/+/g, '$1'), 'app', path ?? '')\n )\n }\n\n private basePath (path?: string) {\n return this.app.getPath('base', path)\n }\n\n private publicPath (path?: string) {\n return this.app.getPath('public', path)\n }\n\n private storagePath (path?: string) {\n return this.app.getPath('base', nodepath.join('storage', path ?? ''))\n }\n\n private databasePath (path?: string) {\n return this.app.getPath('database', path)\n }\n}\n","import 'reflect-metadata'\n\nimport { FileSystem, IApplication, IPathName, Logger } from '@h3ravel/shared'\n\nimport { Container } from './Container'\nimport { ContainerResolver } from './Di/ContainerResolver'\nimport type { H3 } from 'h3'\nimport { PathLoader } from '@h3ravel/shared'\nimport { ProviderRegistry } from './ProviderRegistry'\nimport { Registerer } from './Registerer'\nimport { ServiceProvider } from './ServiceProvider'\nimport { Str } from '@h3ravel/support'\nimport { detect } from 'detect-port'\nimport dotenv from 'dotenv'\nimport dotenvExpand from 'dotenv-expand'\nimport path from 'node:path'\nimport { readFile } from 'node:fs/promises'\nimport semver from 'semver'\n\ntype AServiceProvider = (new (_app: Application) => ServiceProvider) & Partial<ServiceProvider>\n\nexport class Application extends Container implements IApplication {\n public paths = new PathLoader()\n private tries: number = 0\n private booted = false\n private versions: { [key: string]: string, app: string, ts: string } = { app: '0.0.0', ts: '0.0.0' }\n private static versions: { [key: string]: string, app: string, ts: string } = { app: '0.0.0', ts: '0.0.0' }\n private basePath: string\n\n private providers: ServiceProvider[] = []\n protected externalProviders: Array<AServiceProvider> = []\n protected filteredProviders: Array<string> = []\n\n /**\n * List of registered console commands\n */\n public registeredCommands: (new (app: any, kernel: any) => any)[] = []\n\n constructor(basePath: string) {\n super()\n\n dotenvExpand.expand(dotenv.config({ quiet: true }))\n\n this.basePath = basePath\n this.setPath('base', basePath)\n this.loadOptions()\n this.registerBaseBindings()\n Registerer.register(this)\n }\n\n /**\n * Register core bindings into the container\n */\n protected registerBaseBindings () {\n this.bind(Application, () => this)\n this.bind('path.base', () => this.basePath)\n this.bind('load.paths', () => this.paths)\n }\n\n protected async loadOptions () {\n try {\n const corePath = FileSystem.findModulePkg('@h3ravel/core', process.cwd()) ?? ''\n const app = JSON.parse(await readFile(path.join(process.cwd(), '/package.json'), { encoding: 'utf8' }))\n const core = JSON.parse(await readFile(path.join(corePath, 'package.json'), { encoding: 'utf8' }))\n\n if (core) {\n this.versions.app = semver.minVersion(core.version)?.version ?? this.versions.app\n Application.versions.app = this.versions.app\n }\n if (app && app.devDependencies) {\n this.versions.ts = semver.minVersion(app.devDependencies.typescript)?.version ?? this.versions.ts\n Application.versions.ts = this.versions.ts\n }\n if (app && app.dependencies) {\n const versions = Object.fromEntries(Object.entries(app.dependencies)\n .filter(([e]) => e.includes('@h3ravel'))\n .map(([name, ver]: [string, any]) => [\n Str.afterLast(name, '/'),\n semver.minVersion(ver.includes('work') ? this.versions.app : ver)?.version\n ]))\n\n Object.assign(this.versions, versions)\n Object.assign(Application.versions, versions)\n }\n } catch { /** */ }\n }\n\n /**\n * Get all registered providers\n */\n public getRegisteredProviders () {\n return this.providers\n }\n\n /**\n * Load default and optional providers dynamically\n * \n * Auto-Registration Behavior\n * \n * Minimal App: Loads only core, config, http, router by default.\n * Full-Stack App: Installs database, mail, queue, cache → they self-register via their providers.\n */\n protected async getConfiguredProviders (): Promise<Array<AServiceProvider>> {\n return [\n (await import('@h3ravel/core')).CoreServiceProvider,\n ]\n }\n\n protected async getAllProviders (): Promise<Array<AServiceProvider>> {\n const coreProviders = await this.getConfiguredProviders()\n return [...coreProviders, ...this.externalProviders]\n }\n\n /**\n * Configure and Dynamically register all configured service providers, then boot the app.\n * \n * @param providers All regitererable service providers\n * @param filtered A list of service provider name strings we do not want to register at all cost\n * @param autoRegisterProviders If set to false, service providers will not be auto discovered and registered.\n * \n * @returns \n */\n public async quickStartup (providers: Array<AServiceProvider>, filtered: string[] = [], autoRegisterProviders = true) {\n this.registerProviders(providers, filtered)\n await this.registerConfiguredProviders(autoRegisterProviders)\n return this.boot()\n }\n\n /**\n * Dynamically register all configured providers\n * \n * @param autoRegister If set to false, service providers will not be auto discovered and registered.\n */\n public async registerConfiguredProviders (autoRegister = true) {\n const providers = await this.getAllProviders()\n\n ProviderRegistry.setSortable(false)\n ProviderRegistry.setFiltered(this.filteredProviders)\n ProviderRegistry.registerMany(providers)\n\n if (autoRegister) {\n await ProviderRegistry.discoverProviders()\n }\n\n ProviderRegistry.doSort()\n\n for (const ProviderClass of ProviderRegistry.all()) {\n if (!ProviderClass) continue\n const provider = new ProviderClass(this)\n await this.register(provider)\n }\n }\n\n /**\n * Register service providers\n * \n * @param providers \n * @param filtered \n */\n registerProviders (providers: Array<AServiceProvider>, filtered: string[] = []): void {\n this.externalProviders.push(...providers)\n this.filteredProviders = filtered\n }\n\n /**\n * Register a provider\n */\n public async register (provider: ServiceProvider) {\n await new ContainerResolver(this).resolveMethodParams(provider, 'register', this)\n if (provider.registeredCommands && provider.registeredCommands.length > 0) {\n this.registeredCommands.push(...provider.registeredCommands)\n }\n this.providers.push(provider)\n }\n\n /**\n * Register the listed service providers.\n * \n * @param commands An array of console commands to register.\n */\n public withCommands (commands: (new (app: any, kernel: any) => any)[]) {\n this.registeredCommands = commands\n\n return this\n }\n\n /**\n * checks if the application is running in CLI\n */\n public runningInConsole (): boolean {\n return typeof process !== 'undefined'\n && !!process.stdout\n && !!process.stdin\n\n }\n\n public getRuntimeEnv (): 'browser' | 'node' | 'unknown' {\n if (typeof window !== 'undefined' && typeof document !== 'undefined') {\n return 'browser'\n }\n if (typeof process !== 'undefined' && process.versions?.node) {\n return 'node'\n }\n return 'unknown'\n }\n\n /**\n * Boot all service providers after registration\n */\n public async boot () {\n\n if (this.booted) return this\n\n /**\n * If debug is enabled, let's show the loaded service provider info\n */\n if (\n process.env.APP_DEBUG === 'true' &&\n process.env.EXTENDED_DEBUG !== 'false' &&\n !this.providers.some(e => e.runsInConsole)\n ) {\n ProviderRegistry.log(this.providers)\n }\n\n for (const provider of this.providers) {\n if (provider.boot) {\n if (Container.hasAnyDecorator(provider.boot)) {\n /**\n * If the service provider is decorated use the IoC container\n */\n await this.make<any>(provider.boot)\n } else {\n /**\n * Otherwise instantiate manually so that we can at least\n * pass the app instance\n */\n await provider.boot(this)\n }\n }\n }\n\n this.booted = true\n return this\n }\n\n /**\n * Fire up the developement server using the user provided arguments\n * \n * Port will be auto assigned if provided one is not available\n * \n * @param h3App The current H3 app instance\n * @param preferedPort If provided, this will overide the port set in the evironment\n */\n public async fire (h3App: H3, preferedPort?: number) {\n const serve = this.make('http.serve')\n\n const port: number = preferedPort ?? env('PORT', 3000)\n const tries: number = env('RETRIES', 1)\n const hostname: string = env('HOSTNAME', 'localhost')\n\n try {\n const realPort = await detect(port)\n\n if (port == realPort) {\n const server = serve(h3App, {\n port,\n hostname,\n silent: true,\n })\n\n Logger.parse([\n ['🚀 H3ravel running at:', 'green'],\n [`${server.options.protocol ?? 'http'}://${server.options.hostname}:${server.options.port}`, 'cyan']]\n )\n } else if (this.tries <= tries) {\n await this.fire(h3App, realPort)\n this.tries++\n } else {\n Logger.parse([\n ['ERROR:', 'bgRed'],\n ['No free port available', 'red'],\n ])\n }\n } catch (e: any) {\n Logger.parse([\n ['An error occured', 'bgRed'],\n [e.message, 'red'],\n [e.stack, 'red']\n ], '\\n')\n }\n }\n\n /**\n * Get the base path of the app\n * \n * @returns \n */\n getBasePath (): string {\n return this.basePath\n }\n\n /**\n * Dynamically retrieves a path property from the class.\n * Any property ending with \"Path\" is accessible automatically.\n *\n * @param name - The base name of the path property\n * @returns \n */\n getPath (name: IPathName, suffix?: string) {\n return path.join(this.paths.getPath(name, this.basePath), suffix ?? '')\n }\n\n /**\n * Programatically set the paths.\n *\n * @param name - The base name of the path property\n * @param path - The new path\n * @returns \n */\n setPath (name: IPathName, path: string) {\n return this.paths.setPath(name, path, this.basePath)\n }\n\n /**\n * Returns the installed version of the system core and typescript.\n *\n * @returns \n */\n getVersion (key: string) {\n return this.versions[key]?.replaceAll(/\\^|~/g, '')\n }\n\n /**\n * Returns the installed version of the system core and typescript.\n *\n * @returns \n */\n static getVersion (key: string) {\n return this.versions[key]?.replaceAll(/\\^|~/g, '')\n }\n}\n","import type { Argument, Command } from 'commander'\n\nimport { Application } from '../Application'\nimport { ConsoleKernel } from './ConsoleKernel'\nimport { Logger } from '@h3ravel/shared'\nimport { XGeneric } from '@h3ravel/support'\n\nexport class ConsoleCommand {\n constructor(protected app: Application, protected kernel: ConsoleKernel) { }\n\n /**\n * The underlying commander instance.\n *\n * @var Command\n */\n public program!: Command\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature!: string\n\n /**\n * A dictionary of signatures or what not.\n *\n * @var object\n */\n protected dictionary: Record<string, any> = {}\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected description?: string\n\n /**\n * The console command input.\n *\n * @var object\n */\n private input: XGeneric<{ options: Record<string, any>, arguments: Record<string, any> }> = {\n options: {},\n arguments: {},\n }\n\n /**\n * Execute the console command.\n */\n public async handle (..._args: any[]): Promise<void> { }\n\n setApplication (app: Application) {\n this.app = app\n }\n\n setInput (\n options: XGeneric,\n args: string[],\n regArgs: readonly Argument[],\n dictionary: Record<string, any>,\n program: Command,\n ) {\n this.program = program\n this.dictionary = dictionary\n this.input.options = options\n this.input.arguments = regArgs\n .map((e, i) => ({ [e.name()]: args[i] }))\n .reduce((e, x) => Object.assign(e, x), {})\n this.loadBaseFlags()\n\n Logger.configure({\n verbosity: this.option('verbose'),\n silent: this.option('silent'),\n quiet: this.option('quiet'),\n })\n\n return this\n }\n\n setOption (key: string, value: unknown) {\n this.program.setOptionValue(key, value)\n return this\n }\n\n setProgram (program: Command) {\n this.program = program\n return this\n }\n\n getSignature () {\n return this.signature\n }\n\n getDescription () {\n return this.description\n }\n\n option (key: string, def?: any) {\n const option = this.input.options[key] ?? def\n return option === 'null' || option === 'undefined' ? undefined : option\n }\n\n options (key?: string) {\n if (key) {\n return this.input.options[key]\n }\n return this.input.options\n }\n\n argument (key: string, def?: any) {\n return this.input.arguments[key] ?? def\n }\n\n arguments () {\n return this.input.arguments\n }\n\n public loadBaseFlags () {\n let verbose = 0\n if (this.program.getOptionValue('verbose') == 'v') verbose = 2\n else if (this.program.getOptionValue('verbose') == 'vv') verbose = 3\n else Number(this.program.getOptionValue('verbose') ?? 0)\n\n this.input.options.quiet = this.program.getOptionValue('quiet') ?? false\n this.input.options.silent = this.program.getOptionValue('silent') ?? false\n this.input.options.verbose = verbose\n this.input.options.interaction = this.program.getOptionValue('interaction') ?? false\n }\n\n /**\n * Check if the command is quiet\n * \n * @returns \n */\n isQuiet () {\n return this.option('quiet')\n }\n\n /**\n * Check if the command is silent\n * \n * @returns \n */\n isSilent () {\n return this.option('silent')\n }\n\n /**\n * Check if the command is non interactive\n * \n * @returns \n */\n isNonInteractive () {\n return this.option('interaction') === false\n }\n\n /**\n * Get the verbosity of the command\n * \n * @returns \n */\n getVerbosity () {\n return Number(this.option('verbose'))\n }\n\n /**\n * Log an info message\n */\n info (message: string) {\n Logger.info(message)\n return this\n }\n\n /**\n * Log a warning message\n */\n warn (message: string) {\n Logger.warn(message)\n return this\n }\n\n /**\n * Log a line message\n */\n line (message: string) {\n Logger.log(message, 'white')\n return this\n }\n\n /**\n * Log a new line\n */\n newLine (count: number = 1) {\n if (Number(this.getVerbosity()) >= 3 || (!this.isSilent() && !this.isQuiet()))\n for (let i = 0; i < count; i++)\n console.log('')\n return this\n }\n\n /**\n * Log a success message\n */\n success (message: string) {\n Logger.success(message)\n return this\n }\n\n /**\n * Log an error message\n */\n error (message: string) {\n Logger.error(message, false)\n return this\n }\n\n /**\n * Log an error message and terminate execution of the command\n * return an exit code of 1\n * \n * This method is not chainable\n */\n fail (message: string) {\n this.error(message)\n\n process.exit(1)\n }\n\n /**\n * Log a debug message\n */\n debug (message: string | string[]) {\n Logger.debug(message)\n return this\n }\n}\n","import { Application } from '../Application'\nimport { Logger } from '@h3ravel/shared'\nimport { XGeneric } from '@h3ravel/support'\nimport { mkdir } from 'node:fs/promises'\n\nexport class ConsoleKernel {\n public cwd!: string\n public output = typeof Logger\n public basePath: string = ''\n public modulePath!: string\n public consolePath!: string\n public modulePackage!: XGeneric<{ version: string }>\n public consolePackage!: XGeneric<{ version: string }>\n\n constructor(public app: Application) { }\n\n async ensureDirectoryExists (dir: string) {\n await mkdir(dir, { recursive: true })\n }\n}\n","import { Application } from '.'\nimport { IController } from '@h3ravel/shared'\n\n/**\n * Base controller class\n */\nexport abstract class Controller implements IController {\n protected app: Application\n\n constructor(app: Application) {\n this.app = app\n }\n\n public show?(..._ctx: any[]): any\n public index?(..._ctx: any[]): any\n public store?(..._ctx: any[]): any\n public update?(..._ctx: any[]): any\n public destroy?(..._ctx: any[]): any\n}\n","export function Inject (...dependencies: string[]) {\n return function (target: any) {\n target.__inject__ = dependencies\n }\n}\n\n/**\n * Allows binding dependencies to both class and class methods \n * \n * @returns \n */\nexport function Injectable (): ClassDecorator & MethodDecorator {\n return (...args: any[]) => {\n if (args.length === 1) {\n void args[0] // class target\n }\n if (args.length === 3) {\n void args[0] // target\n void args[1] // propertyKey\n void args[2] // descriptor\n }\n }\n}\n\n// export function Injectable (): MethodDecorator & ClassDecorator {\n// return ((_target: any, _propertyKey?: string, descriptor?: PropertyDescriptor) => {\n// if (descriptor) {\n// const original = descriptor.value;\n// descriptor.value = async function (...args: any[]) {\n// const resolvedArgs = await Promise.all(args);\n// return original.apply(this, resolvedArgs);\n// };\n// }\n// }) as any;\n// }\n","import { Logger } from '@h3ravel/shared'\n\nexport class ConfigException extends Error {\n key: string\n\n constructor(key: string, type: 'any' | 'config' | 'env' = 'config', cause?: unknown) {\n const info = {\n any: `${key} not configured`,\n env: `${key} environment variable not configured`,\n config: `${key} config not set`,\n }\n\n const message = Logger.log([['ERROR:', 'bgRed'], [info[type], 'white']], ' ', false)\n\n super(message, {\n cause\n })\n\n this.key = key\n }\n}\n","import { HttpContext, IMiddleware } from '@h3ravel/shared'\n\nimport type { H3Event } from 'h3'\n\n/**\n * Kernel class handles middleware execution and response transformations.\n * It acts as the core middleware pipeline for HTTP requests.\n */\nexport class Kernel {\n /**\n * @param context - A factory function that converts an H3Event into an HttpContext.\n * @param middleware - An array of middleware classes that will be executed in sequence.\n */\n constructor(\n protected context: (event: H3Event) => HttpContext,\n protected middleware: IMiddleware[] = [],\n ) { }\n\n /**\n * Handles an incoming request and passes it through middleware before invoking the next handler.\n * \n * @param event - The raw H3 event object.\n * @param next - A callback function that represents the next layer (usually the controller or final handler).\n * @returns A promise resolving to the result of the request pipeline.\n */\n async handle (\n event: H3Event,\n next: (ctx: HttpContext) => Promise<unknown>\n ): Promise<unknown> {\n /**\n * Convert the raw event into a standardized HttpContext\n */\n const ctx = this.context(event)\n\n const { app } = ctx.request\n\n /** \n * Bind HTTP Response instance to the service container\n */\n app.bind('http.response', () => {\n return ctx.response\n })\n\n /** \n * Bind HTTP Request instance to the service container\n */\n app.bind('http.request', () => {\n return ctx.request\n })\n\n /**\n * Run middleware stack and obtain result\n */\n const result = await this.runMiddleware(ctx, () => next(ctx))\n\n /**\n * If a plain object is returned from a controller or middleware,\n * automatically set the JSON Content-Type header for the response.\n */\n if (result !== undefined && this.isPlainObject(result)) {\n event.res.headers.set('Content-Type', 'application/json; charset=UTF-8')\n }\n\n return result\n }\n\n /**\n * Sequentially runs middleware in the order they were registered.\n * \n * @param context - The standardized HttpContext.\n * @param next - Callback to execute when middleware completes.\n * @returns A promise resolving to the final handler's result.\n */\n private async runMiddleware (\n context: HttpContext,\n next: (ctx: HttpContext) => Promise<unknown>\n ) {\n let index = -1\n\n const runner = async (i: number): Promise<unknown> => {\n if (i <= index) throw new Error('next() called multiple times')\n index = i\n const middleware = this.middleware[i]\n\n if (middleware) {\n /**\n * Execute the current middleware and proceed to the next one\n */\n return middleware.handle(context, () => runner(i + 1))\n } else {\n /**\n * If no more middleware, call the final handler\n */\n return next(context)\n }\n }\n\n return runner(0)\n }\n\n /**\n * Utility function to determine if a value is a plain object or array.\n * \n * @param value - The value to check.\n * @returns True if the value is a plain object or array, otherwise false.\n */\n private isPlainObject (value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' &&\n value !== null &&\n (value.constructor === Object || value.constructor === Array)\n }\n}\n","import { Application } from './Application'\nimport { IServiceProvider } from '@h3ravel/shared'\n\nconst Inference = class { } as { new(): IServiceProvider }\n\nexport abstract class ServiceProvider extends Inference {\n /**\n * The current app instance\n */\n protected app: Application\n\n /**\n * Unique Identifier for the service providers\n */\n public static uid?: number\n\n /**\n * Sort order\n */\n\n public static order?: `before:${string}` | `after:${string}` | string | undefined\n\n /**\n * Sort priority\n */\n public static priority = 0\n\n /**\n * Indicate that this service provider only runs in console\n */\n public static console = false\n\n /**\n * List of registered console commands\n */\n public registeredCommands?: (new (app: any, kernel: any) => any)[]\n\n constructor(app: Application) {\n super()\n this.app = app\n }\n\n /**\n * Register bindings to the container.\n * Runs before boot().\n */\n abstract register (...app: unknown[]): void | Promise<void>;\n\n /**\n * Perform post-registration booting of services.\n * Runs after all providers have been registered.\n */\n boot?(...app: unknown[]): void | Promise<void>;\n\n /**\n * Register the listed service providers.\n * \n * @param commands An array of console commands to register.\n * \n * @deprecated since version 1.16.0. Will be removed in future versions, use `registerCommands` instead\n */\n commands (commands: (new (app: any, kernel: any) => any)[]): void {\n this.registerCommands(commands)\n }\n\n /**\n * Register the listed service providers.\n * \n * @param commands An array of console commands to register.\n */\n registerCommands (commands: (new (app: any, kernel: any) => any)[]) {\n this.registeredCommands = commands\n }\n}\n","import 'reflect-metadata'\n\nimport { ServiceProvider } from '../ServiceProvider'\nimport { str } from '@h3ravel/support'\n\n/**\n * Bootstraps core services and bindings.\n * \n * Bind essential services to the container (logger, config repository).\n * Register app-level singletons.\n * Set up exception handling.\n * \n * Auto-Registered\n */\nexport class CoreServiceProvider extends ServiceProvider {\n public static priority = 999\n\n register () {\n Object.assign(globalThis, {\n str,\n })\n }\n\n boot (): void | Promise<void> {\n try {\n Object.assign(globalThis, {\n asset: this.app.make('asset'),\n })\n } catch {/** */ }\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,IAAa,YAAb,MAA6C;CACzC,AAAQ,2BAAW,IAAI,KAA8B;CACrD,AAAQ,6BAAa,IAAI,KAAwB;CAUjD,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: Application","params: any[]","args: any[]","providers: ProviderCtor[]","pkg: any","app: Application","path","nodepath","port: number","tries: number","hostname: string","e: any","path","app: Application","kernel: ConsoleKernel","app: Application","context: (event: H3Event) => HttpContext","middleware: IMiddleware[]"],"sources":["../src/Container.ts","../src/Di/ContainerResolver.ts","../src/ProviderRegistry.ts","../src/Registerer.ts","../src/Application.ts","../src/Console/ConsoleCommand.ts","../src/Console/ConsoleKernel.ts","../src/Controller.ts","../src/Di/Inject.ts","../src/Exceptions/ConfigException.ts","../src/Http/Kernel.ts","../src/ServiceProvider.ts","../src/Providers/CoreServiceProvider.ts"],"sourcesContent":["import type { Bindings, IContainer, UseKey } from '@h3ravel/shared'\n\ntype IBinding = UseKey | (new (..._args: any[]) => unknown)\n\nexport class Container implements IContainer {\n private bindings = new Map<IBinding, () => unknown>()\n private singletons = new Map<IBinding, unknown>()\n\n /**\n * Check if the target has any decorators\n * \n * @param target \n * @returns \n */\n static hasAnyDecorator<C extends abstract new (...args: any[]) => any> (target: C): boolean\n static hasAnyDecorator<F extends (...args: any[]) => any> (target: F): boolean\n static hasAnyDecorator (target: (...args: any[]) => any): boolean {\n if (Reflect.getMetadataKeys(target).length > 0) return true\n\n const paramLength = target.length\n\n for (let i = 0; i < paramLength; i++) {\n if (Reflect.getMetadataKeys(target, `__param_${i}`).length > 0) {\n return true\n }\n }\n\n return false\n }\n\n /**\n * Bind a transient service to the container\n */\n bind<T> (key: new (...args: any[]) => T, factory: () => T): void\n bind<T extends UseKey> (key: T, factory: () => Bindings[T]): void\n bind<T extends UseKey> (\n key: T,\n factory: () => Bindings[T] | T\n ) {\n this.bindings.set(key, factory)\n }\n\n /**\n * Bind a singleton service to the container\n */\n singleton<T extends UseKey> (\n key: T | (new (..._args: any[]) => Bindings[T]),\n factory: (app: this) => Bindings[T]\n ) {\n this.bindings.set(key, () => {\n if (!this.singletons.has(key)) {\n this.singletons.set(key, factory(this))\n }\n return this.singletons.get(key)!\n })\n }\n\n /**\n * Resolve a service from the container\n */\n make<T extends UseKey> (key: T): Bindings[T]\n make<C extends abstract new (...args: any[]) => any> (key: C): InstanceType<C>\n make<F extends (...args: any[]) => any> (key: F): ReturnType<F>\n make (key: any): any {\n /**\n * Direct factory binding\n */\n if (this.bindings.has(key)) {\n return this.bindings.get(key)!()\n }\n\n /**\n * If this is a class constructor, auto-resolve via reflection\n */\n if (typeof key === 'function') {\n return this.build(key)\n }\n\n throw new Error(\n `No binding found for key: ${typeof key === 'string' ? key : (key as any)?.name}`\n )\n }\n\n /**\n * Automatically build a class with constructor dependency injection\n */\n private build<T extends UseKey> (ClassType: new (..._args: any[]) => Bindings[T]): Bindings[T] {\n let dependencies: any[] = []\n\n if (Array.isArray((ClassType as any).__inject__)) {\n dependencies = (ClassType as any).__inject__.map((alias: any) => {\n return this.make(alias)\n })\n } else {\n const paramTypes: any[] = Reflect.getMetadata('design:paramtypes', ClassType) || []\n dependencies = paramTypes.map((dep) => this.make(dep))\n }\n\n return new ClassType(...dependencies)\n }\n\n /**\n * Check if a service is registered\n */\n has (key: UseKey): boolean {\n return this.bindings.has(key)\n }\n}\n","import 'reflect-metadata'\n\nimport { Application } from '..'\n\nexport class ContainerResolver {\n constructor(private app: Application) { }\n\n async resolveMethodParams<I extends Record<string, any>> (instance: I, method: keyof I, ..._default: any[]) {\n /**\n * Get param types for instance method\n */\n let params: any[] = Reflect.getMetadata('design:paramtypes', instance, String(method)) || []\n\n /**\n * Ensure that the Application class is always available\n */\n if (params.length < 1 && _default.length > 0) {\n params = _default\n }\n\n /**\n * Resolve the bound dependencies\n */\n const args: any[] = params.filter(e => ContainerResolver.isClass(e)).map((type: any) => {\n return this.app.make(type)\n })\n\n return new Promise<I>((resolve) => {\n resolve(instance[method](...args))\n })\n }\n\n static isClass (C: any) {\n return typeof C === 'function' &&\n C.prototype !== undefined &&\n Object.toString.call(C).substring(0, 5) === 'class'\n }\n}\n","import type { Application } from './Application'\nimport { ContainerResolver } from '../src/Di/ContainerResolver'\nimport { ServiceProvider } from './ServiceProvider'\nimport fg from 'fast-glob'\nimport path from 'node:path'\n\ntype ProviderCtor = (new (_app: Application) => ServiceProvider) & Partial<ServiceProvider>\n\nexport class ProviderRegistry {\n private static providers = new Map<string, ProviderCtor>()\n private static priorityMap = new Map<string, number>()\n private static filteredProviders: string[] = []\n private static sortable = true\n\n /**\n * Set wether providers should be sorted or not.\n * \n * @returns \n */\n static setSortable (sort: boolean = true): void {\n this.sortable = sort\n }\n\n /**\n * Get a unique identifier for the Provider.\n * \n * @param provider \n * @returns \n */\n private static getKey (provider: ProviderCtor): string {\n // If provider has a declared static uid/id → prefer that\n const anyProvider = provider as any\n if (typeof anyProvider.uid === 'string') {\n return anyProvider.uid\n }\n if (typeof anyProvider.id === 'string') {\n return anyProvider.id\n }\n\n // Otherwise fallback to class name + source file (if available)\n // Works for both Node.js (filename from stack) and bundlers\n return provider.name || 'AnonymousProvider'\n }\n\n /**\n * Register one or more providers.\n * Duplicate constructors will be ignored.\n * \n * @param providers \n * @returns \n */\n static register (...providers: ProviderCtor[]): void {\n const list = this.sortable\n ? this.sort(providers.concat(...this.providers.values()))\n : providers.concat(...this.providers.values())\n\n for (const provider of list) {\n const key = this.getKey(provider)\n this.providers.set(key, provider)\n }\n }\n\n /**\n * Bulk register providers from an array.\n * \n * @param providers \n * @returns \n */\n static registerMany (providers: ProviderCtor[]): void {\n const list = this.sortable\n ? this.sort(providers.concat(...this.providers.values()))\n : providers.concat(...this.providers.values())\n\n for (const provider of list) {\n const key = this.getKey(provider)\n this.providers.set(key, provider)\n }\n }\n\n /**\n * Get all registered providers as an array.\n * \n * @returns \n */\n static setFiltered (filtered: string[]): void {\n this.filteredProviders = filtered\n }\n\n /**\n * Resolve (instantiate) all providers with the given application or Service Container.\n * \n * @param app \n * @returns \n */\n static async resolve (app: Application, useServiceContainer: boolean = false): Promise<ServiceProvider[]> {\n\n // Remove all filtered service providers \n const providers = Array.from(this.providers.values()).filter(e => {\n return !!e && (this.filteredProviders.length < 1 || !this.filteredProviders.includes(e.name))\n })\n\n return await Promise.all(providers.map(async (ProviderClass) => {\n // Don't bind to the service container if we don't have to\n const provider = new ProviderClass(app)\n if (!useServiceContainer) return Promise.resolve(provider)\n\n // Bind to the service container\n await new ContainerResolver(app).resolveMethodParams(provider, 'register', app)\n return provider\n }))\n }\n\n /**\n * Sort the service providers\n * \n * @param providers \n * @returns \n */\n static sort (providers: ProviderCtor[]) {\n /**\n * Base priority (default 0)\n */\n providers.forEach((Provider) => {\n const key = this.getKey(Provider)\n this.priorityMap.set(`${Provider.name}::${key}`, (Provider as any).priority ?? 0)\n })\n\n /**\n * Handle before/after adjustments\n */\n providers.forEach((Provider) => {\n const order = (Provider as any).order\n if (!order) return\n\n const [direction, target] = order.split(':')\n const targetPriority = this.priorityMap.get(target) ?? 0\n const key = this.getKey(Provider)\n\n if (direction === 'before') {\n this.priorityMap.set(`${Provider.name}::${key}`, targetPriority - 1)\n } else if (direction === 'after') {\n this.priorityMap.set(`${Provider.name}::${key}`, targetPriority + 1)\n }\n })\n\n /**\n * Return service providers sorted based on thier name and priority\n */\n return providers.sort(\n (A, B) => {\n const keyA = this.getKey(A)\n const keyB = this.getKey(B)\n return (this.priorityMap.get(`${B.name}::${keyB}`) ?? 0) - (this.priorityMap.get(`${A.name}::${keyA}`) ?? 0)\n }\n )\n }\n\n /**\n * Sort service providers\n */\n static doSort () {\n const raw = this.sort(Array.from(this.providers.values()))\n const providers = new Map<string, ProviderCtor>()\n\n for (const provider of raw) {\n const key = this.getKey(provider)\n providers.set(key, provider)\n }\n\n this.providers = providers\n }\n\n /**\n * Log the service providers in a table\n * \n * @param priorityMap \n */\n static log<P extends ServiceProvider> (providers?: Array<P> | Map<string, P>) {\n const sorted = Array.from(((providers as unknown as P[]) ?? this.providers).values())\n\n console.table(\n sorted.map((P: any) => ({\n Name: P.constructor.name,\n Order: P.constructor.order ?? 'N/A',\n Priority: P.constructor.priority,\n }))\n )\n\n console.info('')\n }\n\n /**\n * Get all registered providers as an array.\n * \n * @returns \n */\n static all (): ProviderCtor[] {\n return Array.from(this.providers.values())\n }\n\n /**\n * Check if a provider is already registered.\n * \n * @param provider \n * @returns \n */\n static has (provider: ProviderCtor): boolean {\n return this.providers.has(this.getKey(provider))\n }\n\n /**\n * Automatically search for and discover service providers in packages.\n * \n * @param autoRegister \n * @returns \n */\n public static async discoverProviders (autoRegister = true) {\n const manifests = await fg([\n 'node_modules/@h3ravel/*/package.json',\n 'node_modules/@h3ravel-community/*/package.json',\n 'node_modules/h3ravel-*/package.json',\n ])\n\n const providers: ProviderCtor[] = []\n\n for (const manifestPath of manifests) {\n const pkg = await this.getManifest(path.resolve(manifestPath))\n if (pkg.h3ravel?.providers) {\n providers.push(...await Promise.all(\n pkg.h3ravel.providers.map(\n async (name: string) => (await import(path.resolve(path.dirname(manifestPath), 'dist/index.js')))[name]\n )))\n }\n }\n\n if (autoRegister) {\n for (const provider of providers) {\n const key = this.getKey(provider)\n this.providers.set(key, provider)\n }\n }\n\n return providers\n }\n\n /**\n * Get the content of the package.json file\n * \n * @param manifestPath \n * @returns \n */\n private static async getManifest (manifestPath: string) {\n let pkg: any\n try {\n pkg = (await import(manifestPath)).default\n } catch {\n const { createRequire } = await import('module')\n const require = createRequire(import.meta.url)\n pkg = require(manifestPath)\n }\n return pkg\n }\n}\n","import { dd, dump } from '@h3ravel/support'\n\nimport { Application } from '.'\nimport nodepath from 'node:path'\n\nexport class Registerer {\n constructor(private app: Application) { }\n\n static register (app: Application) {\n const reg = new Registerer(app)\n reg.bootRegister()\n }\n\n bootRegister () {\n globalThis.dd = dd\n globalThis.dump = dump\n globalThis.app_path = (path?: string) => this.appPath(path)\n globalThis.base_path = (path?: string) => this.basePath(path)\n globalThis.public_path = (path?: string) => this.publicPath(path)\n globalThis.storage_path = (path?: string) => this.storagePath(path)\n globalThis.database_path = (path?: string) => this.databasePath(path)\n }\n\n private appPath (path?: string) {\n return this.app.getPath(\n 'base', nodepath.join(`/${process.env.DIST_DIR ?? 'src'}/`.replace(/([^:]\\/)\\/+/g, '$1'), 'app', path ?? '')\n )\n }\n\n private basePath (path?: string) {\n return this.app.getPath('base', path)\n }\n\n private publicPath (path?: string) {\n return this.app.getPath('public', path)\n }\n\n private storagePath (path?: string) {\n return this.app.getPath('base', nodepath.join('storage', path ?? ''))\n }\n\n private databasePath (path?: string) {\n return this.app.getPath('database', path)\n }\n}\n","import 'reflect-metadata'\n\nimport { FileSystem, IApplication, IPathName, Logger } from '@h3ravel/shared'\n\nimport { Container } from './Container'\nimport { ContainerResolver } from './Di/ContainerResolver'\nimport type { H3 } from 'h3'\nimport { PathLoader } from '@h3ravel/shared'\nimport { ProviderRegistry } from './ProviderRegistry'\nimport { Registerer } from './Registerer'\nimport { ServiceProvider } from './ServiceProvider'\nimport { Str } from '@h3ravel/support'\nimport { detect } from 'detect-port'\nimport dotenv from 'dotenv'\nimport dotenvExpand from 'dotenv-expand'\nimport path from 'node:path'\nimport { readFile } from 'node:fs/promises'\nimport semver from 'semver'\n\ntype AServiceProvider = (new (_app: Application) => ServiceProvider) & Partial<ServiceProvider>\n\nexport class Application extends Container implements IApplication {\n public paths = new PathLoader()\n private tries: number = 0\n private booted = false\n private versions: { [key: string]: string, app: string, ts: string } = { app: '0.0.0', ts: '0.0.0' }\n private static versions: { [key: string]: string, app: string, ts: string } = { app: '0.0.0', ts: '0.0.0' }\n private basePath: string\n\n private providers: ServiceProvider[] = []\n protected externalProviders: Array<AServiceProvider> = []\n protected filteredProviders: Array<string> = []\n\n /**\n * List of registered console commands\n */\n public registeredCommands: (new (app: any, kernel: any) => any)[] = []\n\n constructor(basePath: string) {\n super()\n\n dotenvExpand.expand(dotenv.config({ quiet: true }))\n\n this.basePath = basePath\n this.setPath('base', basePath)\n this.loadOptions()\n this.registerBaseBindings()\n Registerer.register(this)\n }\n\n /**\n * Register core bindings into the container\n */\n protected registerBaseBindings () {\n this.bind(Application, () => this)\n this.bind('path.base', () => this.basePath)\n this.bind('load.paths', () => this.paths)\n }\n\n protected async loadOptions () {\n try {\n const corePath = FileSystem.findModulePkg('@h3ravel/core', process.cwd()) ?? ''\n const app = JSON.parse(await readFile(path.join(process.cwd(), '/package.json'), { encoding: 'utf8' }))\n const core = JSON.parse(await readFile(path.join(corePath, 'package.json'), { encoding: 'utf8' }))\n\n if (core) {\n this.versions.app = semver.minVersion(core.version)?.version ?? this.versions.app\n Application.versions.app = this.versions.app\n }\n if (app && app.devDependencies) {\n this.versions.ts = semver.minVersion(app.devDependencies.typescript)?.version ?? this.versions.ts\n Application.versions.ts = this.versions.ts\n }\n if (app && app.dependencies) {\n const versions = Object.fromEntries(Object.entries(app.dependencies)\n .filter(([e]) => e.includes('@h3ravel'))\n .map(([name, ver]: [string, any]) => [\n Str.afterLast(name, '/'),\n semver.minVersion(ver.includes('work') ? this.versions.app : ver)?.version\n ]))\n\n Object.assign(this.versions, versions)\n Object.assign(Application.versions, versions)\n }\n } catch { /** */ }\n }\n\n /**\n * Get all registered providers\n */\n public getRegisteredProviders () {\n return this.providers\n }\n\n /**\n * Load default and optional providers dynamically\n * \n * Auto-Registration Behavior\n * \n * Minimal App: Loads only core, config, http, router by default.\n * Full-Stack App: Installs database, mail, queue, cache → they self-register via their providers.\n */\n protected async getConfiguredProviders (): Promise<Array<AServiceProvider>> {\n return [\n (await import('@h3ravel/core')).CoreServiceProvider,\n ]\n }\n\n protected async getAllProviders (): Promise<Array<AServiceProvider>> {\n const coreProviders = await this.getConfiguredProviders()\n return [...coreProviders, ...this.externalProviders]\n }\n\n /**\n * Configure and Dynamically register all configured service providers, then boot the app.\n * \n * @param providers All regitererable service providers\n * @param filtered A list of service provider name strings we do not want to register at all cost\n * @param autoRegisterProviders If set to false, service providers will not be auto discovered and registered.\n * \n * @returns \n */\n public async quickStartup (providers: Array<AServiceProvider>, filtered: string[] = [], autoRegisterProviders = true) {\n this.registerProviders(providers, filtered)\n await this.registerConfiguredProviders(autoRegisterProviders)\n return this.boot()\n }\n\n /**\n * Dynamically register all configured providers\n * \n * @param autoRegister If set to false, service providers will not be auto discovered and registered.\n */\n public async registerConfiguredProviders (autoRegister = true) {\n const providers = await this.getAllProviders()\n\n ProviderRegistry.setSortable(false)\n ProviderRegistry.setFiltered(this.filteredProviders)\n ProviderRegistry.registerMany(providers)\n\n if (autoRegister) {\n await ProviderRegistry.discoverProviders()\n }\n\n ProviderRegistry.doSort()\n\n for (const ProviderClass of ProviderRegistry.all()) {\n if (!ProviderClass) continue\n const provider = new ProviderClass(this)\n await this.register(provider)\n }\n }\n\n /**\n * Register service providers\n * \n * @param providers \n * @param filtered \n */\n registerProviders (providers: Array<AServiceProvider>, filtered: string[] = []): void {\n this.externalProviders.push(...providers)\n this.filteredProviders = filtered\n }\n\n /**\n * Register a provider\n */\n public async register (provider: ServiceProvider) {\n await new ContainerResolver(this).resolveMethodParams(provider, 'register', this)\n if (provider.registeredCommands && provider.registeredCommands.length > 0) {\n this.registeredCommands.push(...provider.registeredCommands)\n }\n this.providers.push(provider)\n }\n\n /**\n * Register the listed service providers.\n * \n * @param commands An array of console commands to register.\n */\n public withCommands (commands: (new (app: any, kernel: any) => any)[]) {\n this.registeredCommands = commands\n\n return this\n }\n\n /**\n * checks if the application is running in CLI\n */\n public runningInConsole (): boolean {\n return typeof process !== 'undefined'\n && !!process.stdout\n && !!process.stdin\n\n }\n\n public getRuntimeEnv (): 'browser' | 'node' | 'unknown' {\n if (typeof window !== 'undefined' && typeof document !== 'undefined') {\n return 'browser'\n }\n if (typeof process !== 'undefined' && process.versions?.node) {\n return 'node'\n }\n return 'unknown'\n }\n\n /**\n * Boot all service providers after registration\n */\n public async boot () {\n\n if (this.booted) return this\n\n /**\n * If debug is enabled, let's show the loaded service provider info\n */\n if (\n process.env.APP_DEBUG === 'true' &&\n process.env.EXTENDED_DEBUG !== 'false' &&\n !this.providers.some(e => e.runsInConsole)\n ) {\n ProviderRegistry.log(this.providers)\n }\n\n for (const provider of this.providers) {\n if (provider.boot) {\n if (Container.hasAnyDecorator(provider.boot)) {\n /**\n * If the service provider is decorated use the IoC container\n */\n await this.make<any>(provider.boot)\n } else {\n /**\n * Otherwise instantiate manually so that we can at least\n * pass the app instance\n */\n await provider.boot(this)\n }\n }\n }\n\n this.booted = true\n return this\n }\n\n /**\n * Fire up the developement server using the user provided arguments\n * \n * Port will be auto assigned if provided one is not available\n * \n * @param h3App The current H3 app instance\n * @param preferedPort If provided, this will overide the port set in the evironment\n */\n public async fire (h3App: H3, preferedPort?: number) {\n const serve = this.make('http.serve')\n\n const port: number = preferedPort ?? env('PORT', 3000)\n const tries: number = env('RETRIES', 1)\n const hostname: string = env('HOSTNAME', 'localhost')\n\n try {\n const realPort = await detect(port)\n\n if (port == realPort) {\n const server = serve(h3App, {\n port,\n hostname,\n silent: true,\n })\n\n Logger.parse([\n ['🚀 H3ravel running at:', 'green'],\n [`${server.options.protocol ?? 'http'}://${server.options.hostname}:${server.options.port}`, 'cyan']]\n )\n } else if (this.tries <= tries) {\n await this.fire(h3App, realPort)\n this.tries++\n } else {\n Logger.parse([\n ['ERROR:', 'bgRed'],\n ['No free port available', 'red'],\n ])\n }\n } catch (e: any) {\n Logger.parse([\n ['An error occured', 'bgRed'],\n [e.message, 'red'],\n [e.stack, 'red']\n ], '\\n')\n }\n }\n\n /**\n * Get the base path of the app\n * \n * @returns \n */\n getBasePath (): string {\n return this.basePath\n }\n\n /**\n * Dynamically retrieves a path property from the class.\n * Any property ending with \"Path\" is accessible automatically.\n *\n * @param name - The base name of the path property\n * @returns \n */\n getPath (name: IPathName, suffix?: string) {\n return path.join(this.paths.getPath(name, this.basePath), suffix ?? '')\n }\n\n /**\n * Programatically set the paths.\n *\n * @param name - The base name of the path property\n * @param path - The new path\n * @returns \n */\n setPath (name: IPathName, path: string) {\n return this.paths.setPath(name, path, this.basePath)\n }\n\n /**\n * Returns the installed version of the system core and typescript.\n *\n * @returns \n */\n getVersion (key: string) {\n return this.versions[key]?.replaceAll(/\\^|~/g, '')\n }\n\n /**\n * Returns the installed version of the system core and typescript.\n *\n * @returns \n */\n static getVersion (key: string) {\n return this.versions[key]?.replaceAll(/\\^|~/g, '')\n }\n}\n","import type { Argument, Command } from 'commander'\n\nimport { Application } from '../Application'\nimport { ConsoleKernel } from './ConsoleKernel'\nimport { Logger } from '@h3ravel/shared'\nimport { XGeneric } from '@h3ravel/support'\n\nexport class ConsoleCommand {\n constructor(protected app: Application, protected kernel: ConsoleKernel) { }\n\n /**\n * The underlying commander instance.\n *\n * @var Command\n */\n public program!: Command\n\n /**\n * The name and signature of the console command.\n *\n * @var string\n */\n protected signature!: string\n\n /**\n * A dictionary of signatures or what not.\n *\n * @var object\n */\n protected dictionary: Record<string, any> = {}\n\n /**\n * The console command description.\n *\n * @var string\n */\n protected description?: string\n\n /**\n * The console command input.\n *\n * @var object\n */\n private input: XGeneric<{ options: Record<string, any>, arguments: Record<string, any> }> = {\n options: {},\n arguments: {},\n }\n\n /**\n * Execute the console command.\n */\n public async handle (..._args: any[]): Promise<void> { }\n\n setApplication (app: Application) {\n this.app = app\n }\n\n setInput (\n options: XGeneric,\n args: string[],\n regArgs: readonly Argument[],\n dictionary: Record<string, any>,\n program: Command,\n ) {\n this.program = program\n this.dictionary = dictionary\n this.input.options = options\n this.input.arguments = regArgs\n .map((e, i) => ({ [e.name()]: args[i] }))\n .reduce((e, x) => Object.assign(e, x), {})\n this.loadBaseFlags()\n\n Logger.configure({\n verbosity: this.option('verbose'),\n silent: this.option('silent'),\n quiet: this.option('quiet'),\n })\n\n return this\n }\n\n setOption (key: string, value: unknown) {\n this.program.setOptionValue(key, value)\n return this\n }\n\n setProgram (program: Command) {\n this.program = program\n return this\n }\n\n getSignature () {\n return this.signature\n }\n\n getDescription () {\n return this.description\n }\n\n option (key: string, def?: any) {\n const option = this.input.options[key] ?? def\n return option === 'null' || option === 'undefined' ? undefined : option\n }\n\n options (key?: string) {\n if (key) {\n return this.input.options[key]\n }\n return this.input.options\n }\n\n argument (key: string, def?: any) {\n return this.input.arguments[key] ?? def\n }\n\n arguments () {\n return this.input.arguments\n }\n\n public loadBaseFlags () {\n let verbose = 0\n if (this.program.getOptionValue('verbose') == 'v') verbose = 2\n else if (this.program.getOptionValue('verbose') == 'vv') verbose = 3\n else Number(this.program.getOptionValue('verbose') ?? 0)\n\n this.input.options.quiet = this.program.getOptionValue('quiet') ?? false\n this.input.options.silent = this.program.getOptionValue('silent') ?? false\n this.input.options.verbose = verbose\n this.input.options.interaction = this.program.getOptionValue('interaction') ?? false\n }\n\n /**\n * Check if the command is quiet\n * \n * @returns \n */\n isQuiet () {\n return this.option('quiet')\n }\n\n /**\n * Check if the command is silent\n * \n * @returns \n */\n isSilent () {\n return this.option('silent')\n }\n\n /**\n * Check if the command is non interactive\n * \n * @returns \n */\n isNonInteractive () {\n return this.option('interaction') === false\n }\n\n /**\n * Get the verbosity of the command\n * \n * @returns \n */\n getVerbosity () {\n return Number(this.option('verbose'))\n }\n\n /**\n * Log an info message\n */\n info (message: string) {\n Logger.info(message)\n return this\n }\n\n /**\n * Log a warning message\n */\n warn (message: string) {\n Logger.warn(message)\n return this\n }\n\n /**\n * Log a line message\n */\n line (message: string) {\n Logger.log(message, 'white')\n return this\n }\n\n /**\n * Log a new line\n */\n newLine (count: number = 1) {\n if (Number(this.getVerbosity()) >= 3 || (!this.isSilent() && !this.isQuiet()))\n for (let i = 0; i < count; i++)\n console.log('')\n return this\n }\n\n /**\n * Log a success message\n */\n success (message: string) {\n Logger.success(message)\n return this\n }\n\n /**\n * Log an error message\n */\n error (message: string) {\n Logger.error(message, false)\n return this\n }\n\n /**\n * Log an error message and terminate execution of the command\n * return an exit code of 1\n * \n * This method is not chainable\n */\n fail (message: string) {\n this.error(message)\n\n process.exit(1)\n }\n\n /**\n * Log a debug message\n */\n debug (message: string | string[]) {\n Logger.debug(message)\n return this\n }\n}\n","import { Application } from '../Application'\nimport { Logger } from '@h3ravel/shared'\nimport { XGeneric } from '@h3ravel/support'\nimport { mkdir } from 'node:fs/promises'\n\nexport class ConsoleKernel {\n public cwd!: string\n public output = typeof Logger\n public basePath: string = ''\n public modulePath!: string\n public consolePath!: string\n public modulePackage!: XGeneric<{ version: string }>\n public consolePackage!: XGeneric<{ version: string }>\n\n constructor(public app: Application) { }\n\n async ensureDirectoryExists (dir: string) {\n await mkdir(dir, { recursive: true })\n }\n}\n","import { Application } from '.'\nimport { IController } from '@h3ravel/shared'\n\n/**\n * Base controller class\n */\nexport abstract class Controller implements IController {\n protected app: Application\n\n constructor(app: Application) {\n this.app = app\n }\n\n public show?(..._ctx: any[]): any\n public index?(..._ctx: any[]): any\n public store?(..._ctx: any[]): any\n public update?(..._ctx: any[]): any\n public destroy?(..._ctx: any[]): any\n}\n","export function Inject (...dependencies: string[]) {\n return function (target: any) {\n target.__inject__ = dependencies\n }\n}\n\n/**\n * Allows binding dependencies to both class and class methods \n * \n * @returns \n */\nexport function Injectable (): ClassDecorator & MethodDecorator {\n return (...args: any[]) => {\n if (args.length === 1) {\n void args[0] // class target\n }\n if (args.length === 3) {\n void args[0] // target\n void args[1] // propertyKey\n void args[2] // descriptor\n }\n }\n}\n\n// export function Injectable (): MethodDecorator & ClassDecorator {\n// return ((_target: any, _propertyKey?: string, descriptor?: PropertyDescriptor) => {\n// if (descriptor) {\n// const original = descriptor.value;\n// descriptor.value = async function (...args: any[]) {\n// const resolvedArgs = await Promise.all(args);\n// return original.apply(this, resolvedArgs);\n// };\n// }\n// }) as any;\n// }\n","import { Logger } from '@h3ravel/shared'\n\nexport class ConfigException extends Error {\n key: string\n\n constructor(key: string, type: 'any' | 'config' | 'env' = 'config', cause?: unknown) {\n const info = {\n any: `${key} not configured`,\n env: `${key} environment variable not configured`,\n config: `${key} config not set`,\n }\n\n const message = Logger.log([['ERROR:', 'bgRed'], [info[type], 'white']], ' ', false)\n\n super(message, {\n cause\n })\n\n this.key = key\n }\n}\n","import { HttpContext, IMiddleware } from '@h3ravel/shared'\n\nimport type { H3Event } from 'h3'\n\n/**\n * Kernel class handles middleware execution and response transformations.\n * It acts as the core middleware pipeline for HTTP requests.\n */\nexport class Kernel {\n /**\n * @param context - A factory function that converts an H3Event into an HttpContext.\n * @param middleware - An array of middleware classes that will be executed in sequence.\n */\n constructor(\n protected context: (event: H3Event) => HttpContext,\n protected middleware: IMiddleware[] = [],\n ) { }\n\n /**\n * Handles an incoming request and passes it through middleware before invoking the next handler.\n * \n * @param event - The raw H3 event object.\n * @param next - A callback function that represents the next layer (usually the controller or final handler).\n * @returns A promise resolving to the result of the request pipeline.\n */\n async handle (\n event: H3Event,\n next: (ctx: HttpContext) => Promise<unknown>\n ): Promise<unknown> {\n /**\n * Convert the raw event into a standardized HttpContext\n */\n const ctx = this.context(event)\n\n const { app } = ctx.request\n\n /** \n * Bind HTTP Response instance to the service container\n */\n app.bind('http.response', () => {\n return ctx.response\n })\n\n /** \n * Bind HTTP Request instance to the service container\n */\n app.bind('http.request', () => {\n return ctx.request\n })\n\n /**\n * Run middleware stack and obtain result\n */\n const result = await this.runMiddleware(ctx, () => next(ctx))\n\n /**\n * If a plain object is returned from a controller or middleware,\n * automatically set the JSON Content-Type header for the response.\n */\n if (result !== undefined && this.isPlainObject(result)) {\n event.res.headers.set('Content-Type', 'application/json; charset=UTF-8')\n }\n\n return result\n }\n\n /**\n * Sequentially runs middleware in the order they were registered.\n * \n * @param context - The standardized HttpContext.\n * @param next - Callback to execute when middleware completes.\n * @returns A promise resolving to the final handler's result.\n */\n private async runMiddleware (\n context: HttpContext,\n next: (ctx: HttpContext) => Promise<unknown>\n ) {\n let index = -1\n\n const runner = async (i: number): Promise<unknown> => {\n if (i <= index) throw new Error('next() called multiple times')\n index = i\n const middleware = this.middleware[i]\n\n if (middleware) {\n /**\n * Execute the current middleware and proceed to the next one\n */\n return middleware.handle(context, () => runner(i + 1))\n } else {\n /**\n * If no more middleware, call the final handler\n */\n return next(context)\n }\n }\n\n return runner(0)\n }\n\n /**\n * Utility function to determine if a value is a plain object or array.\n * \n * @param value - The value to check.\n * @returns True if the value is a plain object or array, otherwise false.\n */\n private isPlainObject (value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' &&\n value !== null &&\n (value.constructor === Object || value.constructor === Array)\n }\n}\n","import { Application } from './Application'\nimport { IServiceProvider } from '@h3ravel/shared'\n\nconst Inference = class { } as { new(): IServiceProvider }\n\nexport abstract class ServiceProvider extends Inference {\n /**\n * The current app instance\n */\n protected app: Application\n\n /**\n * Unique Identifier for the service providers\n */\n public static uid?: number\n\n /**\n * Sort order\n */\n\n public static order?: `before:${string}` | `after:${string}` | string | undefined\n\n /**\n * Sort priority\n */\n public static priority = 0\n\n /**\n * Indicate that this service provider only runs in console\n */\n public static console = false\n\n /**\n * List of registered console commands\n */\n public registeredCommands?: (new (app: any, kernel: any) => any)[]\n\n constructor(app: Application) {\n super()\n this.app = app\n }\n\n /**\n * Register bindings to the container.\n * Runs before boot().\n */\n abstract register (...app: unknown[]): void | Promise<void>;\n\n /**\n * Perform post-registration booting of services.\n * Runs after all providers have been registered.\n */\n boot?(...app: unknown[]): void | Promise<void>;\n\n /**\n * Register the listed service providers.\n * \n * @param commands An array of console commands to register.\n * \n * @deprecated since version 1.16.0. Will be removed in future versions, use `registerCommands` instead\n */\n commands (commands: (new (app: any, kernel: any) => any)[]): void {\n this.registerCommands(commands)\n }\n\n /**\n * Register the listed service providers.\n * \n * @param commands An array of console commands to register.\n */\n registerCommands (commands: (new (app: any, kernel: any) => any)[]) {\n this.registeredCommands = commands\n }\n}\n","import 'reflect-metadata'\n\nimport { ServiceProvider } from '../ServiceProvider'\nimport { str } from '@h3ravel/support'\n\n/**\n * Bootstraps core services and bindings.\n * \n * Bind essential services to the container (logger, config repository).\n * Register app-level singletons.\n * Set up exception handling.\n * \n * Auto-Registered\n */\nexport class CoreServiceProvider extends ServiceProvider {\n public static priority = 999\n\n register () {\n Object.assign(globalThis, {\n str,\n })\n }\n\n boot (): void | Promise<void> {\n try {\n Object.assign(globalThis, {\n asset: this.app.make('asset'),\n })\n } catch {/** */ }\n }\n}\n"],"mappings":";;;;;;;;;;;;AAIA,IAAa,YA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