@noxfly/noxus 3.0.0-dev.10 → 3.0.0-dev.12

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/child.mjs CHANGED
@@ -7,6 +7,7 @@ var __defProp = Object.defineProperty;
7
7
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
8
8
  var __getOwnPropNames = Object.getOwnPropertyNames;
9
9
  var __hasOwnProp = Object.prototype.hasOwnProperty;
10
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
11
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
11
12
  var __esm = (fn, res) => function __init() {
12
13
  return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
@@ -24,6 +25,7 @@ var __copyProps = (to, from, except, desc) => {
24
25
  return to;
25
26
  };
26
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
28
+ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
27
29
 
28
30
  // src/utils/forward-ref.ts
29
31
  function forwardRef(fn) {
@@ -52,6 +54,7 @@ var init_token = __esm({
52
54
  _Token = class _Token {
53
55
  constructor(target) {
54
56
  this.target = target;
57
+ __publicField(this, "description");
55
58
  this.description = typeof target === "string" ? target : target.name;
56
59
  }
57
60
  toString() {
@@ -443,11 +446,11 @@ var init_injector_explorer = __esm({
443
446
  }
444
447
  };
445
448
  __name(_InjectorExplorer, "InjectorExplorer");
446
- _InjectorExplorer.pending = [];
447
- _InjectorExplorer.processed = false;
448
- _InjectorExplorer.accumulating = false;
449
- _InjectorExplorer.loadingLock = Promise.resolve();
450
- _InjectorExplorer.controllerRegistrar = null;
449
+ __publicField(_InjectorExplorer, "pending", []);
450
+ __publicField(_InjectorExplorer, "processed", false);
451
+ __publicField(_InjectorExplorer, "accumulating", false);
452
+ __publicField(_InjectorExplorer, "loadingLock", Promise.resolve());
453
+ __publicField(_InjectorExplorer, "controllerRegistrar", null);
451
454
  InjectorExplorer = _InjectorExplorer;
452
455
  }
453
456
  });
@@ -476,9 +479,9 @@ var init_app_injector = __esm({
476
479
  _AppInjector = class _AppInjector {
477
480
  constructor(name = null) {
478
481
  this.name = name;
479
- this.bindings = /* @__PURE__ */ new Map();
480
- this.singletons = /* @__PURE__ */ new Map();
481
- this.scoped = /* @__PURE__ */ new Map();
482
+ __publicField(this, "bindings", /* @__PURE__ */ new Map());
483
+ __publicField(this, "singletons", /* @__PURE__ */ new Map());
484
+ __publicField(this, "scoped", /* @__PURE__ */ new Map());
482
485
  }
483
486
  /**
484
487
  * Creates a child scope for per-request lifetime resolution.
@@ -582,7 +585,7 @@ var _ResponseException = class _ResponseException extends Error {
582
585
  message = statusOrMessage;
583
586
  }
584
587
  super(message ?? "");
585
- this.status = 0;
588
+ __publicField(this, "status", 0);
586
589
  if (statusCode !== void 0) {
587
590
  this.status = statusCode;
588
591
  }
@@ -594,7 +597,7 @@ var ResponseException = _ResponseException;
594
597
  var _BadRequestException = class _BadRequestException extends ResponseException {
595
598
  constructor() {
596
599
  super(...arguments);
597
- this.status = 400;
600
+ __publicField(this, "status", 400);
598
601
  }
599
602
  };
600
603
  __name(_BadRequestException, "BadRequestException");
@@ -602,7 +605,7 @@ var BadRequestException = _BadRequestException;
602
605
  var _UnauthorizedException = class _UnauthorizedException extends ResponseException {
603
606
  constructor() {
604
607
  super(...arguments);
605
- this.status = 401;
608
+ __publicField(this, "status", 401);
606
609
  }
607
610
  };
608
611
  __name(_UnauthorizedException, "UnauthorizedException");
@@ -610,7 +613,7 @@ var UnauthorizedException = _UnauthorizedException;
610
613
  var _PaymentRequiredException = class _PaymentRequiredException extends ResponseException {
611
614
  constructor() {
612
615
  super(...arguments);
613
- this.status = 402;
616
+ __publicField(this, "status", 402);
614
617
  }
615
618
  };
616
619
  __name(_PaymentRequiredException, "PaymentRequiredException");
@@ -618,7 +621,7 @@ var PaymentRequiredException = _PaymentRequiredException;
618
621
  var _ForbiddenException = class _ForbiddenException extends ResponseException {
619
622
  constructor() {
620
623
  super(...arguments);
621
- this.status = 403;
624
+ __publicField(this, "status", 403);
622
625
  }
623
626
  };
624
627
  __name(_ForbiddenException, "ForbiddenException");
@@ -626,7 +629,7 @@ var ForbiddenException = _ForbiddenException;
626
629
  var _NotFoundException = class _NotFoundException extends ResponseException {
627
630
  constructor() {
628
631
  super(...arguments);
629
- this.status = 404;
632
+ __publicField(this, "status", 404);
630
633
  }
631
634
  };
632
635
  __name(_NotFoundException, "NotFoundException");
@@ -634,7 +637,7 @@ var NotFoundException = _NotFoundException;
634
637
  var _MethodNotAllowedException = class _MethodNotAllowedException extends ResponseException {
635
638
  constructor() {
636
639
  super(...arguments);
637
- this.status = 405;
640
+ __publicField(this, "status", 405);
638
641
  }
639
642
  };
640
643
  __name(_MethodNotAllowedException, "MethodNotAllowedException");
@@ -642,7 +645,7 @@ var MethodNotAllowedException = _MethodNotAllowedException;
642
645
  var _NotAcceptableException = class _NotAcceptableException extends ResponseException {
643
646
  constructor() {
644
647
  super(...arguments);
645
- this.status = 406;
648
+ __publicField(this, "status", 406);
646
649
  }
647
650
  };
648
651
  __name(_NotAcceptableException, "NotAcceptableException");
@@ -650,7 +653,7 @@ var NotAcceptableException = _NotAcceptableException;
650
653
  var _RequestTimeoutException = class _RequestTimeoutException extends ResponseException {
651
654
  constructor() {
652
655
  super(...arguments);
653
- this.status = 408;
656
+ __publicField(this, "status", 408);
654
657
  }
655
658
  };
656
659
  __name(_RequestTimeoutException, "RequestTimeoutException");
@@ -658,7 +661,7 @@ var RequestTimeoutException = _RequestTimeoutException;
658
661
  var _ConflictException = class _ConflictException extends ResponseException {
659
662
  constructor() {
660
663
  super(...arguments);
661
- this.status = 409;
664
+ __publicField(this, "status", 409);
662
665
  }
663
666
  };
664
667
  __name(_ConflictException, "ConflictException");
@@ -666,7 +669,7 @@ var ConflictException = _ConflictException;
666
669
  var _UpgradeRequiredException = class _UpgradeRequiredException extends ResponseException {
667
670
  constructor() {
668
671
  super(...arguments);
669
- this.status = 426;
672
+ __publicField(this, "status", 426);
670
673
  }
671
674
  };
672
675
  __name(_UpgradeRequiredException, "UpgradeRequiredException");
@@ -674,7 +677,7 @@ var UpgradeRequiredException = _UpgradeRequiredException;
674
677
  var _TooManyRequestsException = class _TooManyRequestsException extends ResponseException {
675
678
  constructor() {
676
679
  super(...arguments);
677
- this.status = 429;
680
+ __publicField(this, "status", 429);
678
681
  }
679
682
  };
680
683
  __name(_TooManyRequestsException, "TooManyRequestsException");
@@ -682,7 +685,7 @@ var TooManyRequestsException = _TooManyRequestsException;
682
685
  var _InternalServerException = class _InternalServerException extends ResponseException {
683
686
  constructor() {
684
687
  super(...arguments);
685
- this.status = 500;
688
+ __publicField(this, "status", 500);
686
689
  }
687
690
  };
688
691
  __name(_InternalServerException, "InternalServerException");
@@ -690,7 +693,7 @@ var InternalServerException = _InternalServerException;
690
693
  var _NotImplementedException = class _NotImplementedException extends ResponseException {
691
694
  constructor() {
692
695
  super(...arguments);
693
- this.status = 501;
696
+ __publicField(this, "status", 501);
694
697
  }
695
698
  };
696
699
  __name(_NotImplementedException, "NotImplementedException");
@@ -698,7 +701,7 @@ var NotImplementedException = _NotImplementedException;
698
701
  var _BadGatewayException = class _BadGatewayException extends ResponseException {
699
702
  constructor() {
700
703
  super(...arguments);
701
- this.status = 502;
704
+ __publicField(this, "status", 502);
702
705
  }
703
706
  };
704
707
  __name(_BadGatewayException, "BadGatewayException");
@@ -706,7 +709,7 @@ var BadGatewayException = _BadGatewayException;
706
709
  var _ServiceUnavailableException = class _ServiceUnavailableException extends ResponseException {
707
710
  constructor() {
708
711
  super(...arguments);
709
- this.status = 503;
712
+ __publicField(this, "status", 503);
710
713
  }
711
714
  };
712
715
  __name(_ServiceUnavailableException, "ServiceUnavailableException");
@@ -714,7 +717,7 @@ var ServiceUnavailableException = _ServiceUnavailableException;
714
717
  var _GatewayTimeoutException = class _GatewayTimeoutException extends ResponseException {
715
718
  constructor() {
716
719
  super(...arguments);
717
- this.status = 504;
720
+ __publicField(this, "status", 504);
718
721
  }
719
722
  };
720
723
  __name(_GatewayTimeoutException, "GatewayTimeoutException");
@@ -722,7 +725,7 @@ var GatewayTimeoutException = _GatewayTimeoutException;
722
725
  var _HttpVersionNotSupportedException = class _HttpVersionNotSupportedException extends ResponseException {
723
726
  constructor() {
724
727
  super(...arguments);
725
- this.status = 505;
728
+ __publicField(this, "status", 505);
726
729
  }
727
730
  };
728
731
  __name(_HttpVersionNotSupportedException, "HttpVersionNotSupportedException");
@@ -730,7 +733,7 @@ var HttpVersionNotSupportedException = _HttpVersionNotSupportedException;
730
733
  var _VariantAlsoNegotiatesException = class _VariantAlsoNegotiatesException extends ResponseException {
731
734
  constructor() {
732
735
  super(...arguments);
733
- this.status = 506;
736
+ __publicField(this, "status", 506);
734
737
  }
735
738
  };
736
739
  __name(_VariantAlsoNegotiatesException, "VariantAlsoNegotiatesException");
@@ -738,7 +741,7 @@ var VariantAlsoNegotiatesException = _VariantAlsoNegotiatesException;
738
741
  var _InsufficientStorageException = class _InsufficientStorageException extends ResponseException {
739
742
  constructor() {
740
743
  super(...arguments);
741
- this.status = 507;
744
+ __publicField(this, "status", 507);
742
745
  }
743
746
  };
744
747
  __name(_InsufficientStorageException, "InsufficientStorageException");
@@ -746,7 +749,7 @@ var InsufficientStorageException = _InsufficientStorageException;
746
749
  var _LoopDetectedException = class _LoopDetectedException extends ResponseException {
747
750
  constructor() {
748
751
  super(...arguments);
749
- this.status = 508;
752
+ __publicField(this, "status", 508);
750
753
  }
751
754
  };
752
755
  __name(_LoopDetectedException, "LoopDetectedException");
@@ -754,7 +757,7 @@ var LoopDetectedException = _LoopDetectedException;
754
757
  var _NotExtendedException = class _NotExtendedException extends ResponseException {
755
758
  constructor() {
756
759
  super(...arguments);
757
- this.status = 510;
760
+ __publicField(this, "status", 510);
758
761
  }
759
762
  };
760
763
  __name(_NotExtendedException, "NotExtendedException");
@@ -762,7 +765,7 @@ var NotExtendedException = _NotExtendedException;
762
765
  var _NetworkAuthenticationRequiredException = class _NetworkAuthenticationRequiredException extends ResponseException {
763
766
  constructor() {
764
767
  super(...arguments);
765
- this.status = 511;
768
+ __publicField(this, "status", 511);
766
769
  }
767
770
  };
768
771
  __name(_NetworkAuthenticationRequiredException, "NetworkAuthenticationRequiredException");
@@ -770,7 +773,7 @@ var NetworkAuthenticationRequiredException = _NetworkAuthenticationRequiredExcep
770
773
  var _NetworkConnectTimeoutException = class _NetworkConnectTimeoutException extends ResponseException {
771
774
  constructor() {
772
775
  super(...arguments);
773
- this.status = 599;
776
+ __publicField(this, "status", 599);
774
777
  }
775
778
  };
776
779
  __name(_NetworkConnectTimeoutException, "NetworkConnectTimeoutException");
@@ -781,10 +784,7 @@ init_injector_explorer();
781
784
  init_token();
782
785
  function Injectable(options = {}) {
783
786
  const { lifetime = "scope", deps = [] } = options;
784
- return (target) => {
785
- if (typeof target !== "function" || !target.prototype) {
786
- throw new Error(`@Injectable can only be applied to classes, not ${typeof target}`);
787
- }
787
+ return (target, _context) => {
788
788
  const key = target;
789
789
  InjectorExplorer.enqueue({
790
790
  key,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/utils/forward-ref.ts","../src/DI/token.ts","../src/utils/logger.ts","../src/DI/injector-explorer.ts","../src/DI/app-injector.ts","../src/non-electron-process.ts","../src/internal/exceptions.ts","../src/decorators/injectable.decorator.ts"],"sourcesContent":["/**\r\n * @copyright 2025 NoxFly\r\n * @license MIT\r\n * @author NoxFly\r\n */\r\n\r\nimport { Type } from \"./types\";\r\n\r\n/**\r\n * A function that returns a type.\r\n * Used for forward references to types that are not yet defined.\r\n */\r\nexport interface ForwardRefFn<T = any> {\r\n (): Type<T>;\r\n}\r\n\r\n/**\r\n * A wrapper class for forward referenced types.\r\n */\r\nexport class ForwardReference<T = any> {\r\n constructor(public readonly forwardRefFn: ForwardRefFn<T>) {}\r\n}\r\n\r\n/**\r\n * Creates a forward reference to a type.\r\n * @param fn A function that returns the type.\r\n * @returns A ForwardReference instance.\r\n */\r\nexport function forwardRef<T = any>(fn: ForwardRefFn<T>): ForwardReference<T> {\r\n return new ForwardReference(fn);\r\n}\r\n","/**\r\n * @copyright 2025 NoxFly\r\n * @license MIT\r\n * @author NoxFly\r\n */\r\n\r\nimport { Type } from '../utils/types';\r\n\r\n/**\r\n * A DI token uniquely identifies a dependency.\r\n * It can wrap a class (Type<T>) or be a named symbol token.\r\n *\r\n * Using tokens instead of reflect-metadata means dependencies are\r\n * declared explicitly — no magic type inference, no emitDecoratorMetadata.\r\n *\r\n * @example\r\n * // Class token (most common)\r\n * const MY_SERVICE = token(MyService);\r\n *\r\n * // Named symbol token (for interfaces or non-class values)\r\n * const DB_URL = token<string>('DB_URL');\r\n */\r\nexport class Token<T> {\r\n public readonly description: string;\r\n\r\n constructor(\r\n public readonly target: Type<T> | string,\r\n ) {\r\n this.description = typeof target === 'string' ? target : target.name;\r\n }\r\n\r\n public toString(): string {\r\n return `Token(${this.description})`;\r\n }\r\n}\r\n\r\n/**\r\n * Creates a DI token for a class type or a named value.\r\n *\r\n * @example\r\n * export const MY_SERVICE = token(MyService);\r\n * export const DB_URL = token<string>('DB_URL');\r\n */\r\nexport function token<T>(target: Type<T> | string): Token<T> {\r\n return new Token<T>(target);\r\n}\r\n\r\n/**\r\n * The key used to look up a class token in the registry.\r\n * For class tokens, the key is the class constructor itself.\r\n * For named tokens, the key is the Token instance.\r\n */\r\nexport type TokenKey<T = unknown> = Type<T> | Token<T>;\r\n","/**\r\n * @copyright 2025 NoxFly\r\n * @license MIT\r\n * @author NoxFly\r\n */\r\n\r\nimport * as fs from 'fs';\r\nimport * as path from 'path';\r\n\r\n/**\r\n * Logger is a utility class for logging messages to the console.\r\n */\r\nexport type LogLevel =\r\n | 'debug'\r\n | 'comment'\r\n | 'log'\r\n | 'info'\r\n | 'warn'\r\n | 'error'\r\n | 'critical'\r\n;\r\n\r\ninterface FileLogState {\r\n queue: string[];\r\n isWriting: boolean;\r\n}\r\n\r\n\r\n\r\n/**\r\n * Returns a formatted timestamp for logging.\r\n */\r\nfunction getPrettyTimestamp(): string {\r\n const now = new Date();\r\n return `${now.getDate().toString().padStart(2, '0')}/${(now.getMonth() + 1).toString().padStart(2, '0')}/${now.getFullYear()}`\r\n + ` ${now.getHours().toString().padStart(2, '0')}:${now.getMinutes().toString().padStart(2, '0')}:${now.getSeconds().toString().padStart(2, '0')}`;\r\n}\r\n\r\n/**\r\n * Generates a log prefix for the console output.\r\n * @param callee - The name of the function or class that is logging the message.\r\n * @param messageType - The type of message being logged (e.g., 'log', 'info', 'warn', 'error', 'debug').\r\n * @param color - The color to use for the log message.\r\n * @returns A formatted string that includes the timestamp, process ID, message type, and callee name.\r\n */\r\nfunction getLogPrefix(callee: string, messageType: string, color?: string): string {\r\n const timestamp = getPrettyTimestamp();\r\n\r\n const spaces = \" \".repeat(10 - messageType.length);\r\n\r\n let colReset = Logger.colors.initial;\r\n let colCallee = Logger.colors.yellow;\r\n\r\n if(color === undefined) {\r\n color = \"\";\r\n colReset = \"\";\r\n colCallee = \"\";\r\n }\r\n\r\n return `${color}[APP] ${process.pid} - ${colReset}`\r\n + `${timestamp}${spaces}`\r\n + `${color}${messageType.toUpperCase()}${colReset} `\r\n + `${colCallee}[${callee}]${colReset}`;\r\n}\r\n\r\n/**\r\n * Formats an object into a string representation for logging.\r\n * It converts the object to JSON and adds indentation for readability.\r\n * @param prefix - The prefix to use for the formatted object.\r\n * @param arg - The object to format.\r\n * @returns A formatted string representation of the object, with each line prefixed by the specified prefix.\r\n */\r\nfunction formatObject(prefix: string, arg: object, enableColor: boolean = true): string {\r\n const json = JSON.stringify(arg, null, 2);\r\n\r\n let colStart = \"\";\r\n let colLine = \"\";\r\n let colReset = \"\";\r\n\r\n if(enableColor) {\r\n colStart = Logger.colors.darkGrey;\r\n colLine = Logger.colors.grey;\r\n colReset = Logger.colors.initial;\r\n }\r\n\r\n const prefixedJson = json\r\n .split('\\n')\r\n .map((line, idx) => idx === 0 ? `${colStart}${line}` : `${prefix} ${colLine}${line}`)\r\n .join('\\n') + colReset;\r\n\r\n return prefixedJson;\r\n}\r\n\r\n/**\r\n * Formats the arguments for logging.\r\n * It colors strings and formats objects with indentation.\r\n * This function is used to prepare the arguments for console output.\r\n * @param prefix - The prefix to use for the formatted arguments.\r\n * @param args - The arguments to format.\r\n * @param color - The color to use for the formatted arguments.\r\n * @returns An array of formatted arguments, where strings are colored and objects are formatted with indentation.\r\n */\r\nfunction formattedArgs(prefix: string, args: any[], color?: string): any[] {\r\n let colReset = Logger.colors.initial;\r\n\r\n if(color === undefined) {\r\n color = \"\";\r\n colReset = \"\";\r\n }\r\n\r\n return args.map(arg => {\r\n if(typeof arg === \"string\") {\r\n return `${color}${arg}${colReset}`;\r\n }\r\n\r\n else if(typeof arg === \"object\") {\r\n return formatObject(prefix, arg, color !== \"\");\r\n }\r\n\r\n return arg;\r\n });\r\n}\r\n\r\n/**\r\n * Gets the name of the caller function or class from the stack trace.\r\n * This function is used to determine the context of the log message.\r\n * @returns The name of the caller function or class.\r\n */\r\nfunction getCallee(): string {\r\n const stack = new Error().stack?.split('\\n') ?? [];\r\n const caller = stack[3]\r\n ?.trim()\r\n .match(/at (.+?)(?:\\..+)? .+$/)\r\n ?.[1]\r\n ?.replace(\"Object\", \"\")\r\n .replace(/^_/, \"\")\r\n || \"App\";\r\n return caller;\r\n}\r\n\r\n/**\r\n * Checks if the current log level allows logging the specified level.\r\n * This function compares the current log level with the specified level to determine if logging should occur.\r\n * @param level - The log level to check.\r\n * @returns A boolean indicating whether the log level is enabled.\r\n */\r\nfunction canLog(level: LogLevel): boolean {\r\n return logLevels.has(level);\r\n}\r\n\r\n/**\r\n * Writes a log message to a file asynchronously to avoid blocking the event loop.\r\n * It batches messages if writing is already in progress.\r\n * @param filepath - The path to the log file.\r\n */\r\nfunction processLogQueue(filepath: string): void {\r\n const state = fileStates.get(filepath);\r\n\r\n if(!state || state.isWriting || state.queue.length === 0) {\r\n return;\r\n }\r\n\r\n state.isWriting = true;\r\n\r\n // Optimization: Grab all pending messages to write in one go\r\n const messagesToWrite = state.queue.join('\\n') + '\\n';\r\n state.queue = []; // Clear the queue immediately\r\n\r\n const dir = path.dirname(filepath);\r\n\r\n // Using async IO to allow other operations\r\n fs.mkdir(dir, { recursive: true }, (err) => {\r\n if(err) {\r\n console.error(`[Logger] Failed to create directory ${dir}`, err);\r\n state.isWriting = false;\r\n return;\r\n }\r\n\r\n fs.appendFile(filepath, messagesToWrite, { encoding: \"utf-8\" }, (err) => {\r\n state.isWriting = false;\r\n\r\n if(err) {\r\n console.error(`[Logger] Failed to write log to ${filepath}`, err);\r\n }\r\n\r\n // If new messages arrived while we were writing, process them now\r\n if(state.queue.length > 0) {\r\n processLogQueue(filepath);\r\n }\r\n });\r\n });\r\n}\r\n\r\n/**\r\n * Adds a message to the file queue and triggers processing.\r\n */\r\nfunction enqueue(filepath: string, message: string): void {\r\n if(!fileStates.has(filepath)) {\r\n fileStates.set(filepath, { queue: [], isWriting: false });\r\n }\r\n\r\n const state = fileStates.get(filepath)!;\r\n state.queue.push(message);\r\n\r\n processLogQueue(filepath);\r\n}\r\n\r\n/**\r\n *\r\n */\r\nfunction output(level: LogLevel, args: any[]): void {\r\n if(!canLog(level)) {\r\n return;\r\n }\r\n\r\n const callee = getCallee();\r\n\r\n {\r\n const prefix = getLogPrefix(callee, level, logLevelColors[level]);\r\n const data = formattedArgs(prefix, args, logLevelColors[level]);\r\n\r\n logLevelChannel[level](prefix, ...data);\r\n }\r\n\r\n {\r\n const prefix = getLogPrefix(callee, level);\r\n const data = formattedArgs(prefix, args);\r\n\r\n const filepath = fileSettings.get(level)?.filepath;\r\n\r\n if(filepath) {\r\n const message = prefix + \" \" + data.join(\" \").replace(/\\x1b\\[[0-9;]*m/g, ''); // Remove ANSI codes\r\n enqueue(filepath, message);\r\n }\r\n }\r\n}\r\n\r\n\r\n\r\nexport namespace Logger {\r\n\r\n /**\r\n * Sets the log level for the logger.\r\n * This function allows you to change the log level dynamically at runtime.\r\n * This won't affect the startup logs.\r\n *\r\n * If the parameter is a single LogLevel, all log levels with equal or higher severity will be enabled.\r\n\r\n * If the parameter is an array of LogLevels, only the specified levels will be enabled.\r\n *\r\n * @param level Sets the log level for the logger.\r\n */\r\n export function setLogLevel(level: LogLevel | LogLevel[]): void {\r\n logLevels.clear();\r\n\r\n if(Array.isArray(level)) {\r\n for(const lvl of level) {\r\n logLevels.add(lvl);\r\n }\r\n }\r\n else {\r\n const targetRank = logLevelRank[level];\r\n\r\n for(const [lvl, rank] of Object.entries(logLevelRank) as [LogLevel, number][]) {\r\n if(rank >= targetRank) {\r\n logLevels.add(lvl);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Logs a message to the console with log level LOG.\r\n * This function formats the message with a timestamp, process ID, and the name of the caller function or class.\r\n * It uses different colors for different log levels to enhance readability.\r\n * @param args The arguments to log.\r\n */\r\n export function log(...args: any[]): void {\r\n output(\"log\", args);\r\n }\r\n\r\n /**\r\n * Logs a message to the console with log level INFO.\r\n * This function formats the message with a timestamp, process ID, and the name of the caller function or class.\r\n * It uses different colors for different log levels to enhance readability.\r\n * @param args The arguments to log.\r\n */\r\n export function info(...args: any[]): void {\r\n output(\"info\", args);\r\n }\r\n\r\n /**\r\n * Logs a message to the console with log level WARN.\r\n * This function formats the message with a timestamp, process ID, and the name of the caller function or class.\r\n * It uses different colors for different log levels to enhance readability.\r\n * @param args The arguments to log.\r\n */\r\n export function warn(...args: any[]): void {\r\n output(\"warn\", args);\r\n }\r\n\r\n /**\r\n * Logs a message to the console with log level ERROR.\r\n * This function formats the message with a timestamp, process ID, and the name of the caller function or class.\r\n * It uses different colors for different log levels to enhance readability.\r\n * @param args The arguments to log.\r\n */\r\n export function error(...args: any[]): void {\r\n output(\"error\", args);\r\n }\r\n\r\n /**\r\n * Logs a message to the console with log level ERROR and a grey color scheme.\r\n */\r\n export function errorStack(...args: any[]): void {\r\n output(\"error\", args);\r\n }\r\n\r\n /**\r\n * Logs a message to the console with log level DEBUG.\r\n * This function formats the message with a timestamp, process ID, and the name of the caller function or class.\r\n * It uses different colors for different log levels to enhance readability.\r\n * @param args The arguments to log.\r\n */\r\n export function debug(...args: any[]): void {\r\n output(\"debug\", args);\r\n }\r\n\r\n /**\r\n * Logs a message to the console with log level COMMENT.\r\n * This function formats the message with a timestamp, process ID, and the name of the caller function or class.\r\n * It uses different colors for different log levels to enhance readability.\r\n * @param args The arguments to log.\r\n */\r\n export function comment(...args: any[]): void {\r\n output(\"comment\", args);\r\n }\r\n\r\n /**\r\n * Logs a message to the console with log level CRITICAL.\r\n * This function formats the message with a timestamp, process ID, and the name of the caller function or class.\r\n * It uses different colors for different log levels to enhance readability.\r\n * @param args The arguments to log.\r\n */\r\n export function critical(...args: any[]): void {\r\n output(\"critical\", args);\r\n }\r\n\r\n /**\r\n * Enables logging to a file output for the specified log levels.\r\n * @param filepath The path to the log file.\r\n * @param levels The log levels to enable file logging for. Defaults to all levels.\r\n */\r\n export function enableFileLogging(filepath: string, levels: LogLevel[] = [\"debug\", \"comment\", \"log\", \"info\", \"warn\", \"error\", \"critical\"]): void {\r\n for(const level of levels) {\r\n fileSettings.set(level, { filepath });\r\n }\r\n }\r\n\r\n /**\r\n * Disables logging to a file output for the specified log levels.\r\n * @param levels The log levels to disable file logging for. Defaults to all levels.\r\n */\r\n export function disableFileLogging(levels: LogLevel[] = [\"debug\", \"comment\", \"log\", \"info\", \"warn\", \"error\", \"critical\"]): void {\r\n for(const level of levels) {\r\n fileSettings.delete(level);\r\n }\r\n }\r\n\r\n\r\n export const colors = {\r\n black: \"\\x1b[0;30m\",\r\n grey: \"\\x1b[0;37m\",\r\n red: \"\\x1b[0;31m\",\r\n green: \"\\x1b[0;32m\",\r\n brown: \"\\x1b[0;33m\",\r\n blue: \"\\x1b[0;34m\",\r\n purple: \"\\x1b[0;35m\",\r\n\r\n darkGrey: \"\\x1b[1;30m\",\r\n lightRed: \"\\x1b[1;31m\",\r\n lightGreen: \"\\x1b[1;32m\",\r\n yellow: \"\\x1b[1;33m\",\r\n lightBlue: \"\\x1b[1;34m\",\r\n magenta: \"\\x1b[1;35m\",\r\n cyan: \"\\x1b[1;36m\",\r\n white: \"\\x1b[1;37m\",\r\n\r\n initial: \"\\x1b[0m\"\r\n };\r\n}\r\n\r\n\r\nconst fileSettings: Map<LogLevel, { filepath: string }> = new Map();\r\nconst fileStates: Map<string, FileLogState> = new Map(); // filepath -> state\r\n\r\nconst logLevels: Set<LogLevel> = new Set();\r\n\r\nconst logLevelRank: Record<LogLevel, number> = {\r\n debug: 0,\r\n comment: 1,\r\n log: 2,\r\n info: 3,\r\n warn: 4,\r\n error: 5,\r\n critical: 6,\r\n};\r\n\r\nconst logLevelColors: Record<LogLevel, string> = {\r\n debug: Logger.colors.purple,\r\n comment: Logger.colors.grey,\r\n log: Logger.colors.green,\r\n info: Logger.colors.blue,\r\n warn: Logger.colors.brown,\r\n error: Logger.colors.red,\r\n critical: Logger.colors.lightRed,\r\n};\r\n\r\nconst logLevelChannel: Record<LogLevel, (message?: any, ...optionalParams: any[]) => void> = {\r\n debug: console.debug,\r\n comment: console.debug,\r\n log: console.log,\r\n info: console.info,\r\n warn: console.warn,\r\n error: console.error,\r\n critical: console.error,\r\n};\r\n\r\n\r\nLogger.setLogLevel(\"debug\");\r\n","/**\r\n * @copyright 2025 NoxFly\r\n * @license MIT\r\n * @author NoxFly\r\n */\r\n\r\nimport { Lifetime, RootInjector } from './app-injector';\r\nimport { TokenKey } from './token';\r\nimport { Type } from '../utils/types';\r\nimport { Logger } from '../utils/logger';\r\nimport { Guard } from '../decorators/guards.decorator';\r\nimport { Middleware } from '../decorators/middleware.decorator';\r\n\r\nexport interface PendingRegistration {\r\n key: TokenKey;\r\n implementation: Type<unknown>;\r\n lifetime: Lifetime;\r\n deps: ReadonlyArray<TokenKey>;\r\n isController: boolean;\r\n pathPrefix?: string;\r\n}\r\n\r\n/**\r\n * Callback invoked for each controller registration discovered during flush.\r\n * Decouples InjectorExplorer from the Router to avoid circular imports.\r\n */\r\nexport type ControllerRegistrar = (\r\n controllerClass: Type<unknown>,\r\n pathPrefix: string,\r\n routeGuards: Guard[],\r\n routeMiddlewares: Middleware[],\r\n) => void;\r\n\r\n/**\r\n * InjectorExplorer accumulates registrations emitted by decorators\r\n * at import time, then flushes them in two phases (bind → resolve)\r\n * once bootstrapApplication triggers processing.\r\n *\r\n * Because deps are now explicit arrays (no reflect-metadata), this class\r\n * no longer needs to introspect constructor parameter types.\r\n */\r\nexport class InjectorExplorer {\r\n private static readonly pending: PendingRegistration[] = [];\r\n private static processed = false;\r\n private static accumulating = false;\r\n private static loadingLock: Promise<void> = Promise.resolve();\r\n private static controllerRegistrar: ControllerRegistrar | null = null;\r\n\r\n // -------------------------------------------------------------------------\r\n // Public API\r\n // -------------------------------------------------------------------------\r\n\r\n /**\r\n * Sets the callback used to register controllers.\r\n * Must be called once before processPending (typically by bootstrapApplication).\r\n */\r\n public static setControllerRegistrar(registrar: ControllerRegistrar): void {\r\n InjectorExplorer.controllerRegistrar = registrar;\r\n }\r\n\r\n public static enqueue(reg: PendingRegistration): void {\r\n if (InjectorExplorer.processed && !InjectorExplorer.accumulating) {\r\n InjectorExplorer._registerImmediate(reg);\r\n return;\r\n }\r\n InjectorExplorer.pending.push(reg);\r\n }\r\n\r\n /**\r\n * Two-phase flush of all pending registrations collected at startup.\r\n * Called by bootstrapApplication after app.whenReady().\r\n */\r\n public static processPending(singletonOverrides?: Map<TokenKey, unknown>): void {\r\n const queue = [...InjectorExplorer.pending];\r\n InjectorExplorer.pending.length = 0;\r\n\r\n InjectorExplorer._phaseOne(queue);\r\n InjectorExplorer._phaseTwo(queue, singletonOverrides);\r\n\r\n InjectorExplorer.processed = true;\r\n }\r\n\r\n /** Enters accumulation mode for lazy-loaded batches. */\r\n public static beginAccumulate(): void {\r\n InjectorExplorer.accumulating = true;\r\n }\r\n\r\n /**\r\n * Exits accumulation mode and flushes queued registrations\r\n * with the same two-phase guarantee as processPending.\r\n * Serialised through a lock to prevent concurrent lazy loads from corrupting the queue.\r\n */\r\n public static flushAccumulated(\r\n routeGuards: Guard[] = [],\r\n routeMiddlewares: Middleware[] = [],\r\n pathPrefix = '',\r\n ): Promise<void> {\r\n InjectorExplorer.loadingLock = InjectorExplorer.loadingLock.then(() => {\r\n InjectorExplorer.accumulating = false;\r\n const queue = [...InjectorExplorer.pending];\r\n InjectorExplorer.pending.length = 0;\r\n InjectorExplorer._phaseOne(queue);\r\n\r\n // Stamp the path prefix on controller registrations\r\n for (const reg of queue) {\r\n if (reg.isController) reg.pathPrefix = pathPrefix;\r\n }\r\n\r\n InjectorExplorer._phaseTwo(queue, undefined, routeGuards, routeMiddlewares);\r\n });\r\n\r\n return InjectorExplorer.loadingLock;\r\n }\r\n\r\n /**\r\n * Returns a Promise that resolves once all pending flushAccumulated calls\r\n * have completed. Useful for awaiting lazy-load serialisation.\r\n */\r\n public static waitForFlush(): Promise<void> {\r\n return InjectorExplorer.loadingLock;\r\n }\r\n\r\n /**\r\n * Resets the explorer state. Intended for tests only.\r\n */\r\n public static reset(): void {\r\n InjectorExplorer.pending.length = 0;\r\n InjectorExplorer.processed = false;\r\n InjectorExplorer.accumulating = false;\r\n InjectorExplorer.loadingLock = Promise.resolve();\r\n InjectorExplorer.controllerRegistrar = null;\r\n }\r\n\r\n // -------------------------------------------------------------------------\r\n // Private helpers\r\n // -------------------------------------------------------------------------\r\n\r\n /** Phase 1: register all bindings without instantiating anything. */\r\n private static _phaseOne(queue: PendingRegistration[]): void {\r\n for (const reg of queue) {\r\n RootInjector.register(reg.key, reg.implementation, reg.lifetime, reg.deps);\r\n }\r\n }\r\n\r\n /** Phase 2: validate deps, resolve singletons and register controllers via the registrar callback. */\r\n private static _phaseTwo(\r\n queue: PendingRegistration[],\r\n overrides?: Map<TokenKey, unknown>,\r\n routeGuards: Guard[] = [],\r\n routeMiddlewares: Middleware[] = [],\r\n ): void {\r\n // Early dependency validation: warn about deps that have no binding\r\n for (const reg of queue) {\r\n for (const dep of reg.deps) {\r\n if (!RootInjector.bindings.has(dep as any) && !RootInjector.singletons.has(dep as any)) {\r\n Logger.warn(`[Noxus DI] \"${reg.implementation.name}\" declares dep \"${(dep as any).name ?? dep}\" which has no binding`);\r\n }\r\n }\r\n }\r\n\r\n for (const reg of queue) {\r\n // Apply value overrides (e.g. singleton instances provided via bootstrapApplication config)\r\n if (overrides?.has(reg.key)) {\r\n const override = overrides.get(reg.key);\r\n RootInjector.singletons.set(reg.key as any, override);\r\n Logger.log(`Registered ${reg.implementation.name} as singleton (overridden)`);\r\n continue;\r\n }\r\n\r\n if (reg.lifetime === 'singleton') {\r\n RootInjector.resolve(reg.key);\r\n }\r\n\r\n if (reg.isController) {\r\n if (!InjectorExplorer.controllerRegistrar) {\r\n throw new Error('[Noxus DI] No controller registrar set. Call InjectorExplorer.setControllerRegistrar() before processing.');\r\n }\r\n InjectorExplorer.controllerRegistrar(\r\n reg.implementation,\r\n reg.pathPrefix ?? '',\r\n routeGuards,\r\n routeMiddlewares,\r\n );\r\n } else if (reg.lifetime !== 'singleton') {\r\n Logger.log(`Registered ${reg.implementation.name} as ${reg.lifetime}`);\r\n }\r\n }\r\n }\r\n\r\n private static _registerImmediate(reg: PendingRegistration): void {\r\n RootInjector.register(reg.key, reg.implementation, reg.lifetime, reg.deps);\r\n\r\n if (reg.lifetime === 'singleton') {\r\n RootInjector.resolve(reg.key);\r\n }\r\n\r\n if (reg.isController && InjectorExplorer.controllerRegistrar) {\r\n InjectorExplorer.controllerRegistrar(reg.implementation, '', [], []);\r\n }\r\n }\r\n}\r\n","/**\r\n * @copyright 2025 NoxFly\r\n * @license MIT\r\n * @author NoxFly\r\n */\r\n\r\nimport { ForwardReference } from '../utils/forward-ref';\r\nimport { Type } from '../utils/types';\r\nimport { Token, TokenKey } from './token';\r\n\r\n/**\r\n * Lifetime of a binding in the DI container.\r\n * - singleton: created once, shared for the lifetime of the app.\r\n * - scope: created once per request scope.\r\n * - transient: new instance every time it is resolved.\r\n */\r\nexport type Lifetime = 'singleton' | 'scope' | 'transient';\r\n\r\n/**\r\n * Internal representation of a registered binding.\r\n */\r\nexport interface IBinding<T = unknown> {\r\n lifetime: Lifetime;\r\n implementation: Type<T>;\r\n /** Explicit constructor dependencies, declared by the class itself. */\r\n deps: ReadonlyArray<TokenKey>;\r\n instance?: T;\r\n}\r\n\r\nfunction keyOf<T>(k: TokenKey<T>): Type<T> | Token<T> {\r\n return k;\r\n}\r\n\r\n/**\r\n * AppInjector is the core DI container.\r\n * It no longer uses reflect-metadata — all dependency information\r\n * comes from explicitly declared `deps` arrays on each binding.\r\n */\r\nexport class AppInjector {\r\n public readonly bindings = new Map<Type<unknown> | Token<unknown>, IBinding<unknown>>();\r\n public readonly singletons = new Map<Type<unknown> | Token<unknown>, unknown>();\r\n public readonly scoped = new Map<Type<unknown> | Token<unknown>, unknown>();\r\n\r\n constructor(public readonly name: string | null = null) {}\r\n\r\n /**\r\n * Creates a child scope for per-request lifetime resolution.\r\n */\r\n public createScope(): AppInjector {\r\n const scope = new AppInjector();\r\n (scope as any).bindings = this.bindings;\r\n (scope as any).singletons = this.singletons;\r\n return scope;\r\n }\r\n\r\n /**\r\n * Registers a binding explicitly.\r\n */\r\n public register<T>(\r\n key: TokenKey<T>,\r\n implementation: Type<T>,\r\n lifetime: Lifetime,\r\n deps: ReadonlyArray<TokenKey> = [],\r\n ): void {\r\n const k = keyOf(key) as TokenKey<unknown>;\r\n if (!this.bindings.has(k)) {\r\n this.bindings.set(k, { lifetime, implementation: implementation as Type<unknown>, deps });\r\n }\r\n }\r\n\r\n /**\r\n * Resolves a dependency by token or class reference.\r\n */\r\n public resolve<T>(target: TokenKey<T> | ForwardReference<T>): T {\r\n if (target instanceof ForwardReference) {\r\n return this._resolveForwardRef(target);\r\n }\r\n\r\n const k = keyOf(target) as TokenKey<unknown>;\r\n\r\n if (this.singletons.has(k)) {\r\n return this.singletons.get(k) as T;\r\n }\r\n\r\n const binding = this.bindings.get(k);\r\n\r\n if (!binding) {\r\n const name = target instanceof Token\r\n ? target.description\r\n : (target as Type<unknown>).name\r\n ?? 'unknown';\r\n\r\n throw new Error(\r\n `[Noxus DI] No binding found for \"${name}\".\\n`\r\n + `Did you forget to declare it in @Injectable({ deps }) or in bootstrapApplication({ singletons })?`,\r\n );\r\n }\r\n\r\n switch (binding.lifetime) {\r\n case 'transient':\r\n return this._instantiate(binding) as T;\r\n\r\n case 'scope': {\r\n if (this.scoped.has(k)) return this.scoped.get(k) as T;\r\n const inst = this._instantiate(binding);\r\n this.scoped.set(k, inst);\r\n return inst as T;\r\n }\r\n\r\n case 'singleton': {\r\n if (this.singletons.has(k)) return this.singletons.get(k) as T;\r\n const inst = this._instantiate(binding);\r\n this.singletons.set(k, inst);\r\n if (binding.instance === undefined) {\r\n (binding as IBinding<unknown>).instance = inst as unknown;\r\n }\r\n return inst as T;\r\n }\r\n }\r\n }\r\n\r\n // -------------------------------------------------------------------------\r\n\r\n private _resolveForwardRef<T>(ref: ForwardReference<T>): T {\r\n let resolved: T | undefined;\r\n return new Proxy({} as object, {\r\n get: (_obj, prop, receiver) => {\r\n resolved ??= this.resolve(ref.forwardRefFn()) as T;\r\n const value = Reflect.get(resolved as object, prop, receiver);\r\n return typeof value === 'function' ? (value as Function).bind(resolved) : value;\r\n },\r\n set: (_obj, prop, value, receiver) => {\r\n resolved ??= this.resolve(ref.forwardRefFn()) as T;\r\n return Reflect.set(resolved as object, prop, value, receiver);\r\n },\r\n getPrototypeOf: () => {\r\n resolved ??= this.resolve(ref.forwardRefFn()) as T;\r\n return Object.getPrototypeOf(resolved);\r\n },\r\n }) as T;\r\n }\r\n\r\n private _instantiate<T>(binding: IBinding<T>): T {\r\n const resolvedDeps = binding.deps.map((dep) => this.resolve(dep));\r\n return new binding.implementation(...resolvedDeps) as T;\r\n }\r\n}\r\n\r\n/**\r\n * The global root injector. All singletons live here.\r\n */\r\nexport const RootInjector = new AppInjector('root');\r\n\r\n/**\r\n * Resets the root injector to a clean state.\r\n * **Intended for testing only** — clears all bindings, singletons, and scoped instances\r\n * so that each test can start from a fresh DI container without restarting the process.\r\n */\r\nexport function resetRootInjector(): void {\r\n RootInjector.bindings.clear();\r\n RootInjector.singletons.clear();\r\n RootInjector.scoped.clear();\r\n // Lazy import to avoid circular dependency (InjectorExplorer → app-injector → InjectorExplorer)\r\n const { InjectorExplorer } = require('./injector-explorer') as typeof import('./injector-explorer');\r\n InjectorExplorer.reset();\r\n}\r\n\r\n/**\r\n * Convenience function: resolve a token from the root injector.\r\n */\r\nexport function inject<T>(t: TokenKey<T> | ForwardReference<T>): T {\r\n return RootInjector.resolve(t);\r\n}\r\n","/**\r\n * @copyright 2025 NoxFly\r\n * @license MIT\r\n * @author NoxFly\r\n */\r\n\r\n/**\r\n * Entry point for nodeJS non-electron process consumers.\r\n * For instance, if main process creates a child process that\r\n * wants to use Logger and DI.\r\n * Child processes must not try to communicate with the renderer\r\n * process.\r\n * order of exports here matters and can affect module resolution.\r\n * Please be cautious when modifying.\r\n */\r\n\r\nexport * from './DI/app-injector';\r\nexport * from './internal/exceptions';\r\nexport * from './decorators/injectable.decorator';\r\nexport * from './utils/logger';\r\nexport * from './utils/types';\r\nexport * from './utils/forward-ref';\r\n","/**\r\n * @copyright 2025 NoxFly\r\n * @license MIT\r\n * @author NoxFly\r\n */\r\n\r\nexport class ResponseException extends Error {\r\n public readonly status: number = 0;\r\n\r\n constructor(message?: string);\r\n constructor(statusCode?: number, message?: string);\r\n constructor(statusOrMessage?: number | string, message?: string) {\r\n let statusCode: number | undefined;\r\n \r\n if(typeof statusOrMessage === 'number') {\r\n statusCode = statusOrMessage;\r\n }\r\n else if(typeof statusOrMessage === 'string') {\r\n message = statusOrMessage;\r\n }\r\n\r\n super(message ?? \"\");\r\n\r\n if(statusCode !== undefined) {\r\n this.status = statusCode;\r\n }\r\n \r\n this.name = this.constructor.name\r\n .replace(/([A-Z])/g, ' $1');\r\n }\r\n}\r\n\r\n// 4XX\r\nexport class BadRequestException extends ResponseException { public override readonly status = 400; }\r\nexport class UnauthorizedException extends ResponseException { public override readonly status = 401; }\r\nexport class PaymentRequiredException extends ResponseException { public override readonly status = 402; }\r\nexport class ForbiddenException extends ResponseException { public override readonly status = 403; }\r\nexport class NotFoundException extends ResponseException { public override readonly status = 404; }\r\nexport class MethodNotAllowedException extends ResponseException { public override readonly status = 405; }\r\nexport class NotAcceptableException extends ResponseException { public override readonly status = 406; }\r\nexport class RequestTimeoutException extends ResponseException { public override readonly status = 408; }\r\nexport class ConflictException extends ResponseException { public override readonly status = 409; }\r\nexport class UpgradeRequiredException extends ResponseException { public override readonly status = 426; }\r\nexport class TooManyRequestsException extends ResponseException { public override readonly status = 429; }\r\n// 5XX\r\nexport class InternalServerException extends ResponseException { public override readonly status = 500; }\r\nexport class NotImplementedException extends ResponseException { public override readonly status = 501; }\r\nexport class BadGatewayException extends ResponseException { public override readonly status = 502; }\r\nexport class ServiceUnavailableException extends ResponseException { public override readonly status = 503; }\r\nexport class GatewayTimeoutException extends ResponseException { public override readonly status = 504; }\r\nexport class HttpVersionNotSupportedException extends ResponseException { public override readonly status = 505; }\r\nexport class VariantAlsoNegotiatesException extends ResponseException { public override readonly status = 506; }\r\nexport class InsufficientStorageException extends ResponseException { public override readonly status = 507; }\r\nexport class LoopDetectedException extends ResponseException { public override readonly status = 508; }\r\nexport class NotExtendedException extends ResponseException { public override readonly status = 510; }\r\nexport class NetworkAuthenticationRequiredException extends ResponseException { public override readonly status = 511; }\r\nexport class NetworkConnectTimeoutException extends ResponseException { public override readonly status = 599; }\r\n","/**\r\n * @copyright 2025 NoxFly\r\n * @license MIT\r\n * @author NoxFly\r\n */\r\n\r\nimport { Lifetime } from '../DI/app-injector';\r\nimport { InjectorExplorer } from '../DI/injector-explorer';\r\nimport { Token, TokenKey } from '../DI/token';\r\nimport { Type } from '../utils/types';\r\n\r\nexport interface InjectableOptions {\r\n /**\r\n * Lifetime of this injectable.\r\n * @default 'scope'\r\n */\r\n lifetime?: Lifetime;\r\n\r\n /**\r\n * Explicit list of constructor dependencies, in the same order as the constructor parameters.\r\n * Each entry is either a class constructor or a Token created with token().\r\n *\r\n * This replaces reflect-metadata / emitDecoratorMetadata entirely.\r\n *\r\n * @example\r\n * @Injectable({ lifetime: 'singleton', deps: [MyRepo, DB_URL] })\r\n * class MyService {\r\n * constructor(private repo: MyRepo, private dbUrl: string) {}\r\n * }\r\n */\r\n deps?: ReadonlyArray<TokenKey>;\r\n}\r\n\r\n/**\r\n * Marks a class as injectable into the Noxus DI container.\r\n *\r\n * Unlike the v2 @Injectable, this decorator:\r\n * - Does NOT require reflect-metadata or emitDecoratorMetadata.\r\n * - Requires you to declare deps explicitly when the class has constructor parameters.\r\n * - Supports standalone usage — no module declaration needed.\r\n *\r\n * @example\r\n * // No dependencies\r\n * @Injectable()\r\n * class Logger {}\r\n *\r\n * // With dependencies\r\n * @Injectable({ lifetime: 'singleton', deps: [Logger, MyRepo] })\r\n * class MyService {\r\n * constructor(private logger: Logger, private repo: MyRepo) {}\r\n * }\r\n *\r\n * // With a named token\r\n * const DB_URL = token<string>('DB_URL');\r\n *\r\n * @Injectable({ deps: [DB_URL] })\r\n * class DbService {\r\n * constructor(private url: string) {}\r\n * }\r\n */\r\nexport function Injectable(options: InjectableOptions = {}): ClassDecorator {\r\n const { lifetime = 'scope', deps = [] } = options;\r\n\r\n return (target) => {\r\n if (typeof target !== 'function' || !target.prototype) {\r\n throw new Error(`@Injectable can only be applied to classes, not ${typeof target}`);\r\n }\r\n\r\n const key = target as unknown as Type<unknown>;\r\n\r\n InjectorExplorer.enqueue({\r\n key,\r\n implementation: key,\r\n lifetime,\r\n deps,\r\n isController: false,\r\n });\r\n };\r\n}\r\n\r\nexport { Token, TokenKey };\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BO,SAAS,WAAoB,IAA0C;AAC1E,SAAO,IAAI,iBAAiB,EAAE;AAClC;AA9BA,IAm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AAA,MACA,gBAAgB;AAAA,MAChB;AAAA,MACA;AAAA,MACA,cAAc;AAAA,IAClB,CAAC;AAAA,EACL;AACJ;AAlBgB;;;AFzChB;AAEA;","names":["err","Logger","InjectorExplorer"]}
1
+ {"version":3,"sources":["../src/utils/forward-ref.ts","../src/DI/token.ts","../src/utils/logger.ts","../src/DI/injector-explorer.ts","../src/DI/app-injector.ts","../src/non-electron-process.ts","../src/internal/exceptions.ts","../src/decorators/injectable.decorator.ts"],"sourcesContent":["/**\r\n * @copyright 2025 NoxFly\r\n * @license MIT\r\n * @author NoxFly\r\n */\r\n\r\nimport { Type } from \"./types\";\r\n\r\n/**\r\n * A function that returns a type.\r\n * Used for forward references to types that are not yet defined.\r\n */\r\nexport interface ForwardRefFn<T = any> {\r\n (): Type<T>;\r\n}\r\n\r\n/**\r\n * A wrapper class for forward referenced types.\r\n */\r\nexport class ForwardReference<T = any> {\r\n constructor(public readonly forwardRefFn: ForwardRefFn<T>) {}\r\n}\r\n\r\n/**\r\n * Creates a forward reference to a type.\r\n * @param fn A function that returns the type.\r\n * @returns A ForwardReference instance.\r\n */\r\nexport function forwardRef<T = any>(fn: ForwardRefFn<T>): ForwardReference<T> {\r\n return new ForwardReference(fn);\r\n}\r\n","/**\r\n * @copyright 2025 NoxFly\r\n * @license MIT\r\n * @author NoxFly\r\n */\r\n\r\nimport { Type } from '../utils/types';\r\n\r\n/**\r\n * A DI token uniquely identifies a dependency.\r\n * It can wrap a class (Type<T>) or be a named symbol token.\r\n *\r\n * Using tokens instead of reflect-metadata means dependencies are\r\n * declared explicitly — no magic type inference, no emitDecoratorMetadata.\r\n *\r\n * @example\r\n * // Class token (most common)\r\n * const MY_SERVICE = token(MyService);\r\n *\r\n * // Named symbol token (for interfaces or non-class values)\r\n * const DB_URL = token<string>('DB_URL');\r\n */\r\nexport class Token<T> {\r\n public readonly description: string;\r\n\r\n constructor(\r\n public readonly target: Type<T> | string,\r\n ) {\r\n this.description = typeof target === 'string' ? target : target.name;\r\n }\r\n\r\n public toString(): string {\r\n return `Token(${this.description})`;\r\n }\r\n}\r\n\r\n/**\r\n * Creates a DI token for a class type or a named value.\r\n *\r\n * @example\r\n * export const MY_SERVICE = token(MyService);\r\n * export const DB_URL = token<string>('DB_URL');\r\n */\r\nexport function token<T>(target: Type<T> | string): Token<T> {\r\n return new Token<T>(target);\r\n}\r\n\r\n/**\r\n * The key used to look up a class token in the registry.\r\n * For class tokens, the key is the class constructor itself.\r\n * For named tokens, the key is the Token instance.\r\n */\r\nexport type TokenKey<T = unknown> = Type<T> | Token<T>;\r\n","/**\r\n * @copyright 2025 NoxFly\r\n * @license MIT\r\n * @author NoxFly\r\n */\r\n\r\nimport * as fs from 'fs';\r\nimport * as path from 'path';\r\n\r\n/**\r\n * Logger is a utility class for logging messages to the console.\r\n */\r\nexport type LogLevel =\r\n | 'debug'\r\n | 'comment'\r\n | 'log'\r\n | 'info'\r\n | 'warn'\r\n | 'error'\r\n | 'critical'\r\n;\r\n\r\ninterface FileLogState {\r\n queue: string[];\r\n isWriting: boolean;\r\n}\r\n\r\n\r\n\r\n/**\r\n * Returns a formatted timestamp for logging.\r\n */\r\nfunction getPrettyTimestamp(): string {\r\n const now = new Date();\r\n return `${now.getDate().toString().padStart(2, '0')}/${(now.getMonth() + 1).toString().padStart(2, '0')}/${now.getFullYear()}`\r\n + ` ${now.getHours().toString().padStart(2, '0')}:${now.getMinutes().toString().padStart(2, '0')}:${now.getSeconds().toString().padStart(2, '0')}`;\r\n}\r\n\r\n/**\r\n * Generates a log prefix for the console output.\r\n * @param callee - The name of the function or class that is logging the message.\r\n * @param messageType - The type of message being logged (e.g., 'log', 'info', 'warn', 'error', 'debug').\r\n * @param color - The color to use for the log message.\r\n * @returns A formatted string that includes the timestamp, process ID, message type, and callee name.\r\n */\r\nfunction getLogPrefix(callee: string, messageType: string, color?: string): string {\r\n const timestamp = getPrettyTimestamp();\r\n\r\n const spaces = \" \".repeat(10 - messageType.length);\r\n\r\n let colReset = Logger.colors.initial;\r\n let colCallee = Logger.colors.yellow;\r\n\r\n if(color === undefined) {\r\n color = \"\";\r\n colReset = \"\";\r\n colCallee = \"\";\r\n }\r\n\r\n return `${color}[APP] ${process.pid} - ${colReset}`\r\n + `${timestamp}${spaces}`\r\n + `${color}${messageType.toUpperCase()}${colReset} `\r\n + `${colCallee}[${callee}]${colReset}`;\r\n}\r\n\r\n/**\r\n * Formats an object into a string representation for logging.\r\n * It converts the object to JSON and adds indentation for readability.\r\n * @param prefix - The prefix to use for the formatted object.\r\n * @param arg - The object to format.\r\n * @returns A formatted string representation of the object, with each line prefixed by the specified prefix.\r\n */\r\nfunction formatObject(prefix: string, arg: object, enableColor: boolean = true): string {\r\n const json = JSON.stringify(arg, null, 2);\r\n\r\n let colStart = \"\";\r\n let colLine = \"\";\r\n let colReset = \"\";\r\n\r\n if(enableColor) {\r\n colStart = Logger.colors.darkGrey;\r\n colLine = Logger.colors.grey;\r\n colReset = Logger.colors.initial;\r\n }\r\n\r\n const prefixedJson = json\r\n .split('\\n')\r\n .map((line, idx) => idx === 0 ? `${colStart}${line}` : `${prefix} ${colLine}${line}`)\r\n .join('\\n') + colReset;\r\n\r\n return prefixedJson;\r\n}\r\n\r\n/**\r\n * Formats the arguments for logging.\r\n * It colors strings and formats objects with indentation.\r\n * This function is used to prepare the arguments for console output.\r\n * @param prefix - The prefix to use for the formatted arguments.\r\n * @param args - The arguments to format.\r\n * @param color - The color to use for the formatted arguments.\r\n * @returns An array of formatted arguments, where strings are colored and objects are formatted with indentation.\r\n */\r\nfunction formattedArgs(prefix: string, args: any[], color?: string): any[] {\r\n let colReset = Logger.colors.initial;\r\n\r\n if(color === undefined) {\r\n color = \"\";\r\n colReset = \"\";\r\n }\r\n\r\n return args.map(arg => {\r\n if(typeof arg === \"string\") {\r\n return `${color}${arg}${colReset}`;\r\n }\r\n\r\n else if(typeof arg === \"object\") {\r\n return formatObject(prefix, arg, color !== \"\");\r\n }\r\n\r\n return arg;\r\n });\r\n}\r\n\r\n/**\r\n * Gets the name of the caller function or class from the stack trace.\r\n * This function is used to determine the context of the log message.\r\n * @returns The name of the caller function or class.\r\n */\r\nfunction getCallee(): string {\r\n const stack = new Error().stack?.split('\\n') ?? [];\r\n const caller = stack[3]\r\n ?.trim()\r\n .match(/at (.+?)(?:\\..+)? .+$/)\r\n ?.[1]\r\n ?.replace(\"Object\", \"\")\r\n .replace(/^_/, \"\")\r\n || \"App\";\r\n return caller;\r\n}\r\n\r\n/**\r\n * Checks if the current log level allows logging the specified level.\r\n * This function compares the current log level with the specified level to determine if logging should occur.\r\n * @param level - The log level to check.\r\n * @returns A boolean indicating whether the log level is enabled.\r\n */\r\nfunction canLog(level: LogLevel): boolean {\r\n return logLevels.has(level);\r\n}\r\n\r\n/**\r\n * Writes a log message to a file asynchronously to avoid blocking the event loop.\r\n * It batches messages if writing is already in progress.\r\n * @param filepath - The path to the log file.\r\n */\r\nfunction processLogQueue(filepath: string): void {\r\n const state = fileStates.get(filepath);\r\n\r\n if(!state || state.isWriting || state.queue.length === 0) {\r\n return;\r\n }\r\n\r\n state.isWriting = true;\r\n\r\n // Optimization: Grab all pending messages to write in one go\r\n const messagesToWrite = state.queue.join('\\n') + '\\n';\r\n state.queue = []; // Clear the queue immediately\r\n\r\n const dir = path.dirname(filepath);\r\n\r\n // Using async IO to allow other operations\r\n fs.mkdir(dir, { recursive: true }, (err) => {\r\n if(err) {\r\n console.error(`[Logger] Failed to create directory ${dir}`, err);\r\n state.isWriting = false;\r\n return;\r\n }\r\n\r\n fs.appendFile(filepath, messagesToWrite, { encoding: \"utf-8\" }, (err) => {\r\n state.isWriting = false;\r\n\r\n if(err) {\r\n console.error(`[Logger] Failed to write log to ${filepath}`, err);\r\n }\r\n\r\n // If new messages arrived while we were writing, process them now\r\n if(state.queue.length > 0) {\r\n processLogQueue(filepath);\r\n }\r\n });\r\n });\r\n}\r\n\r\n/**\r\n * Adds a message to the file queue and triggers processing.\r\n */\r\nfunction enqueue(filepath: string, message: string): void {\r\n if(!fileStates.has(filepath)) {\r\n fileStates.set(filepath, { queue: [], isWriting: false });\r\n }\r\n\r\n const state = fileStates.get(filepath)!;\r\n state.queue.push(message);\r\n\r\n processLogQueue(filepath);\r\n}\r\n\r\n/**\r\n *\r\n */\r\nfunction output(level: LogLevel, args: any[]): void {\r\n if(!canLog(level)) {\r\n return;\r\n }\r\n\r\n const callee = getCallee();\r\n\r\n {\r\n const prefix = getLogPrefix(callee, level, logLevelColors[level]);\r\n const data = formattedArgs(prefix, args, logLevelColors[level]);\r\n\r\n logLevelChannel[level](prefix, ...data);\r\n }\r\n\r\n {\r\n const prefix = getLogPrefix(callee, level);\r\n const data = formattedArgs(prefix, args);\r\n\r\n const filepath = fileSettings.get(level)?.filepath;\r\n\r\n if(filepath) {\r\n const message = prefix + \" \" + data.join(\" \").replace(/\\x1b\\[[0-9;]*m/g, ''); // Remove ANSI codes\r\n enqueue(filepath, message);\r\n }\r\n }\r\n}\r\n\r\n\r\n\r\nexport namespace Logger {\r\n\r\n /**\r\n * Sets the log level for the logger.\r\n * This function allows you to change the log level dynamically at runtime.\r\n * This won't affect the startup logs.\r\n *\r\n * If the parameter is a single LogLevel, all log levels with equal or higher severity will be enabled.\r\n\r\n * If the parameter is an array of LogLevels, only the specified levels will be enabled.\r\n *\r\n * @param level Sets the log level for the logger.\r\n */\r\n export function setLogLevel(level: LogLevel | LogLevel[]): void {\r\n logLevels.clear();\r\n\r\n if(Array.isArray(level)) {\r\n for(const lvl of level) {\r\n logLevels.add(lvl);\r\n }\r\n }\r\n else {\r\n const targetRank = logLevelRank[level];\r\n\r\n for(const [lvl, rank] of Object.entries(logLevelRank) as [LogLevel, number][]) {\r\n if(rank >= targetRank) {\r\n logLevels.add(lvl);\r\n }\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Logs a message to the console with log level LOG.\r\n * This function formats the message with a timestamp, process ID, and the name of the caller function or class.\r\n * It uses different colors for different log levels to enhance readability.\r\n * @param args The arguments to log.\r\n */\r\n export function log(...args: any[]): void {\r\n output(\"log\", args);\r\n }\r\n\r\n /**\r\n * Logs a message to the console with log level INFO.\r\n * This function formats the message with a timestamp, process ID, and the name of the caller function or class.\r\n * It uses different colors for different log levels to enhance readability.\r\n * @param args The arguments to log.\r\n */\r\n export function info(...args: any[]): void {\r\n output(\"info\", args);\r\n }\r\n\r\n /**\r\n * Logs a message to the console with log level WARN.\r\n * This function formats the message with a timestamp, process ID, and the name of the caller function or class.\r\n * It uses different colors for different log levels to enhance readability.\r\n * @param args The arguments to log.\r\n */\r\n export function warn(...args: any[]): void {\r\n output(\"warn\", args);\r\n }\r\n\r\n /**\r\n * Logs a message to the console with log level ERROR.\r\n * This function formats the message with a timestamp, process ID, and the name of the caller function or class.\r\n * It uses different colors for different log levels to enhance readability.\r\n * @param args The arguments to log.\r\n */\r\n export function error(...args: any[]): void {\r\n output(\"error\", args);\r\n }\r\n\r\n /**\r\n * Logs a message to the console with log level ERROR and a grey color scheme.\r\n */\r\n export function errorStack(...args: any[]): void {\r\n output(\"error\", args);\r\n }\r\n\r\n /**\r\n * Logs a message to the console with log level DEBUG.\r\n * This function formats the message with a timestamp, process ID, and the name of the caller function or class.\r\n * It uses different colors for different log levels to enhance readability.\r\n * @param args The arguments to log.\r\n */\r\n export function debug(...args: any[]): void {\r\n output(\"debug\", args);\r\n }\r\n\r\n /**\r\n * Logs a message to the console with log level COMMENT.\r\n * This function formats the message with a timestamp, process ID, and the name of the caller function or class.\r\n * It uses different colors for different log levels to enhance readability.\r\n * @param args The arguments to log.\r\n */\r\n export function comment(...args: any[]): void {\r\n output(\"comment\", args);\r\n }\r\n\r\n /**\r\n * Logs a message to the console with log level CRITICAL.\r\n * This function formats the message with a timestamp, process ID, and the name of the caller function or class.\r\n * It uses different colors for different log levels to enhance readability.\r\n * @param args The arguments to log.\r\n */\r\n export function critical(...args: any[]): void {\r\n output(\"critical\", args);\r\n }\r\n\r\n /**\r\n * Enables logging to a file output for the specified log levels.\r\n * @param filepath The path to the log file.\r\n * @param levels The log levels to enable file logging for. Defaults to all levels.\r\n */\r\n export function enableFileLogging(filepath: string, levels: LogLevel[] = [\"debug\", \"comment\", \"log\", \"info\", \"warn\", \"error\", \"critical\"]): void {\r\n for(const level of levels) {\r\n fileSettings.set(level, { filepath });\r\n }\r\n }\r\n\r\n /**\r\n * Disables logging to a file output for the specified log levels.\r\n * @param levels The log levels to disable file logging for. Defaults to all levels.\r\n */\r\n export function disableFileLogging(levels: LogLevel[] = [\"debug\", \"comment\", \"log\", \"info\", \"warn\", \"error\", \"critical\"]): void {\r\n for(const level of levels) {\r\n fileSettings.delete(level);\r\n }\r\n }\r\n\r\n\r\n export const colors = {\r\n black: \"\\x1b[0;30m\",\r\n grey: \"\\x1b[0;37m\",\r\n red: \"\\x1b[0;31m\",\r\n green: \"\\x1b[0;32m\",\r\n brown: \"\\x1b[0;33m\",\r\n blue: \"\\x1b[0;34m\",\r\n purple: \"\\x1b[0;35m\",\r\n\r\n darkGrey: \"\\x1b[1;30m\",\r\n lightRed: \"\\x1b[1;31m\",\r\n lightGreen: \"\\x1b[1;32m\",\r\n yellow: \"\\x1b[1;33m\",\r\n lightBlue: \"\\x1b[1;34m\",\r\n magenta: \"\\x1b[1;35m\",\r\n cyan: \"\\x1b[1;36m\",\r\n white: \"\\x1b[1;37m\",\r\n\r\n initial: \"\\x1b[0m\"\r\n };\r\n}\r\n\r\n\r\nconst fileSettings: Map<LogLevel, { filepath: string }> = new Map();\r\nconst fileStates: Map<string, FileLogState> = new Map(); // filepath -> state\r\n\r\nconst logLevels: Set<LogLevel> = new Set();\r\n\r\nconst logLevelRank: Record<LogLevel, number> = {\r\n debug: 0,\r\n comment: 1,\r\n log: 2,\r\n info: 3,\r\n warn: 4,\r\n error: 5,\r\n critical: 6,\r\n};\r\n\r\nconst logLevelColors: Record<LogLevel, string> = {\r\n debug: Logger.colors.purple,\r\n comment: Logger.colors.grey,\r\n log: Logger.colors.green,\r\n info: Logger.colors.blue,\r\n warn: Logger.colors.brown,\r\n error: Logger.colors.red,\r\n critical: Logger.colors.lightRed,\r\n};\r\n\r\nconst logLevelChannel: Record<LogLevel, (message?: any, ...optionalParams: any[]) => void> = {\r\n debug: console.debug,\r\n comment: console.debug,\r\n log: console.log,\r\n info: console.info,\r\n warn: console.warn,\r\n error: console.error,\r\n critical: console.error,\r\n};\r\n\r\n\r\nLogger.setLogLevel(\"debug\");\r\n","/**\r\n * @copyright 2025 NoxFly\r\n * @license MIT\r\n * @author NoxFly\r\n */\r\n\r\nimport { Lifetime, RootInjector } from './app-injector';\r\nimport { TokenKey } from './token';\r\nimport { Type } from '../utils/types';\r\nimport { Logger } from '../utils/logger';\r\nimport { Guard } from '../decorators/guards.decorator';\r\nimport { Middleware } from '../decorators/middleware.decorator';\r\n\r\nexport interface PendingRegistration {\r\n key: TokenKey;\r\n implementation: Type<unknown>;\r\n lifetime: Lifetime;\r\n deps: ReadonlyArray<TokenKey>;\r\n isController: boolean;\r\n pathPrefix?: string;\r\n}\r\n\r\n/**\r\n * Callback invoked for each controller registration discovered during flush.\r\n * Decouples InjectorExplorer from the Router to avoid circular imports.\r\n */\r\nexport type ControllerRegistrar = (\r\n controllerClass: Type<unknown>,\r\n pathPrefix: string,\r\n routeGuards: Guard[],\r\n routeMiddlewares: Middleware[],\r\n) => void;\r\n\r\n/**\r\n * InjectorExplorer accumulates registrations emitted by decorators\r\n * at import time, then flushes them in two phases (bind → resolve)\r\n * once bootstrapApplication triggers processing.\r\n *\r\n * Because deps are now explicit arrays (no reflect-metadata), this class\r\n * no longer needs to introspect constructor parameter types.\r\n */\r\nexport class InjectorExplorer {\r\n private static readonly pending: PendingRegistration[] = [];\r\n private static processed = false;\r\n private static accumulating = false;\r\n private static loadingLock: Promise<void> = Promise.resolve();\r\n private static controllerRegistrar: ControllerRegistrar | null = null;\r\n\r\n // -------------------------------------------------------------------------\r\n // Public API\r\n // -------------------------------------------------------------------------\r\n\r\n /**\r\n * Sets the callback used to register controllers.\r\n * Must be called once before processPending (typically by bootstrapApplication).\r\n */\r\n public static setControllerRegistrar(registrar: ControllerRegistrar): void {\r\n InjectorExplorer.controllerRegistrar = registrar;\r\n }\r\n\r\n public static enqueue(reg: PendingRegistration): void {\r\n if (InjectorExplorer.processed && !InjectorExplorer.accumulating) {\r\n InjectorExplorer._registerImmediate(reg);\r\n return;\r\n }\r\n InjectorExplorer.pending.push(reg);\r\n }\r\n\r\n /**\r\n * Two-phase flush of all pending registrations collected at startup.\r\n * Called by bootstrapApplication after app.whenReady().\r\n */\r\n public static processPending(singletonOverrides?: Map<TokenKey, unknown>): void {\r\n const queue = [...InjectorExplorer.pending];\r\n InjectorExplorer.pending.length = 0;\r\n\r\n InjectorExplorer._phaseOne(queue);\r\n InjectorExplorer._phaseTwo(queue, singletonOverrides);\r\n\r\n InjectorExplorer.processed = true;\r\n }\r\n\r\n /** Enters accumulation mode for lazy-loaded batches. */\r\n public static beginAccumulate(): void {\r\n InjectorExplorer.accumulating = true;\r\n }\r\n\r\n /**\r\n * Exits accumulation mode and flushes queued registrations\r\n * with the same two-phase guarantee as processPending.\r\n * Serialised through a lock to prevent concurrent lazy loads from corrupting the queue.\r\n */\r\n public static flushAccumulated(\r\n routeGuards: Guard[] = [],\r\n routeMiddlewares: Middleware[] = [],\r\n pathPrefix = '',\r\n ): Promise<void> {\r\n InjectorExplorer.loadingLock = InjectorExplorer.loadingLock.then(() => {\r\n InjectorExplorer.accumulating = false;\r\n const queue = [...InjectorExplorer.pending];\r\n InjectorExplorer.pending.length = 0;\r\n InjectorExplorer._phaseOne(queue);\r\n\r\n // Stamp the path prefix on controller registrations\r\n for (const reg of queue) {\r\n if (reg.isController) reg.pathPrefix = pathPrefix;\r\n }\r\n\r\n InjectorExplorer._phaseTwo(queue, undefined, routeGuards, routeMiddlewares);\r\n });\r\n\r\n return InjectorExplorer.loadingLock;\r\n }\r\n\r\n /**\r\n * Returns a Promise that resolves once all pending flushAccumulated calls\r\n * have completed. Useful for awaiting lazy-load serialisation.\r\n */\r\n public static waitForFlush(): Promise<void> {\r\n return InjectorExplorer.loadingLock;\r\n }\r\n\r\n /**\r\n * Resets the explorer state. Intended for tests only.\r\n */\r\n public static reset(): void {\r\n InjectorExplorer.pending.length = 0;\r\n InjectorExplorer.processed = false;\r\n InjectorExplorer.accumulating = false;\r\n InjectorExplorer.loadingLock = Promise.resolve();\r\n InjectorExplorer.controllerRegistrar = null;\r\n }\r\n\r\n // -------------------------------------------------------------------------\r\n // Private helpers\r\n // -------------------------------------------------------------------------\r\n\r\n /** Phase 1: register all bindings without instantiating anything. */\r\n private static _phaseOne(queue: PendingRegistration[]): void {\r\n for (const reg of queue) {\r\n RootInjector.register(reg.key, reg.implementation, reg.lifetime, reg.deps);\r\n }\r\n }\r\n\r\n /** Phase 2: validate deps, resolve singletons and register controllers via the registrar callback. */\r\n private static _phaseTwo(\r\n queue: PendingRegistration[],\r\n overrides?: Map<TokenKey, unknown>,\r\n routeGuards: Guard[] = [],\r\n routeMiddlewares: Middleware[] = [],\r\n ): void {\r\n // Early dependency validation: warn about deps that have no binding\r\n for (const reg of queue) {\r\n for (const dep of reg.deps) {\r\n if (!RootInjector.bindings.has(dep as any) && !RootInjector.singletons.has(dep as any)) {\r\n Logger.warn(`[Noxus DI] \"${reg.implementation.name}\" declares dep \"${(dep as any).name ?? dep}\" which has no binding`);\r\n }\r\n }\r\n }\r\n\r\n for (const reg of queue) {\r\n // Apply value overrides (e.g. singleton instances provided via bootstrapApplication config)\r\n if (overrides?.has(reg.key)) {\r\n const override = overrides.get(reg.key);\r\n RootInjector.singletons.set(reg.key as any, override);\r\n Logger.log(`Registered ${reg.implementation.name} as singleton (overridden)`);\r\n continue;\r\n }\r\n\r\n if (reg.lifetime === 'singleton') {\r\n RootInjector.resolve(reg.key);\r\n }\r\n\r\n if (reg.isController) {\r\n if (!InjectorExplorer.controllerRegistrar) {\r\n throw new Error('[Noxus DI] No controller registrar set. Call InjectorExplorer.setControllerRegistrar() before processing.');\r\n }\r\n InjectorExplorer.controllerRegistrar(\r\n reg.implementation,\r\n reg.pathPrefix ?? '',\r\n routeGuards,\r\n routeMiddlewares,\r\n );\r\n } else if (reg.lifetime !== 'singleton') {\r\n Logger.log(`Registered ${reg.implementation.name} as ${reg.lifetime}`);\r\n }\r\n }\r\n }\r\n\r\n private static _registerImmediate(reg: PendingRegistration): void {\r\n RootInjector.register(reg.key, reg.implementation, reg.lifetime, reg.deps);\r\n\r\n if (reg.lifetime === 'singleton') {\r\n RootInjector.resolve(reg.key);\r\n }\r\n\r\n if (reg.isController && InjectorExplorer.controllerRegistrar) {\r\n InjectorExplorer.controllerRegistrar(reg.implementation, '', [], []);\r\n }\r\n }\r\n}\r\n","/**\r\n * @copyright 2025 NoxFly\r\n * @license MIT\r\n * @author NoxFly\r\n */\r\n\r\nimport { ForwardReference } from '../utils/forward-ref';\r\nimport { Type } from '../utils/types';\r\nimport { Token, TokenKey } from './token';\r\n\r\n/**\r\n * Lifetime of a binding in the DI container.\r\n * - singleton: created once, shared for the lifetime of the app.\r\n * - scope: created once per request scope.\r\n * - transient: new instance every time it is resolved.\r\n */\r\nexport type Lifetime = 'singleton' | 'scope' | 'transient';\r\n\r\n/**\r\n * Internal representation of a registered binding.\r\n */\r\nexport interface IBinding<T = unknown> {\r\n lifetime: Lifetime;\r\n implementation: Type<T>;\r\n /** Explicit constructor dependencies, declared by the class itself. */\r\n deps: ReadonlyArray<TokenKey>;\r\n instance?: T;\r\n}\r\n\r\nfunction keyOf<T>(k: TokenKey<T>): Type<T> | Token<T> {\r\n return k;\r\n}\r\n\r\n/**\r\n * AppInjector is the core DI container.\r\n * It no longer uses reflect-metadata — all dependency information\r\n * comes from explicitly declared `deps` arrays on each binding.\r\n */\r\nexport class AppInjector {\r\n public readonly bindings = new Map<Type<unknown> | Token<unknown>, IBinding<unknown>>();\r\n public readonly singletons = new Map<Type<unknown> | Token<unknown>, unknown>();\r\n public readonly scoped = new Map<Type<unknown> | Token<unknown>, unknown>();\r\n\r\n constructor(public readonly name: string | null = null) {}\r\n\r\n /**\r\n * Creates a child scope for per-request lifetime resolution.\r\n */\r\n public createScope(): AppInjector {\r\n const scope = new AppInjector();\r\n (scope as any).bindings = this.bindings;\r\n (scope as any).singletons = this.singletons;\r\n return scope;\r\n }\r\n\r\n /**\r\n * Registers a binding explicitly.\r\n */\r\n public register<T>(\r\n key: TokenKey<T>,\r\n implementation: Type<T>,\r\n lifetime: Lifetime,\r\n deps: ReadonlyArray<TokenKey> = [],\r\n ): void {\r\n const k = keyOf(key) as TokenKey<unknown>;\r\n if (!this.bindings.has(k)) {\r\n this.bindings.set(k, { lifetime, implementation: implementation as Type<unknown>, deps });\r\n }\r\n }\r\n\r\n /**\r\n * Resolves a dependency by token or class reference.\r\n */\r\n public resolve<T>(target: TokenKey<T> | ForwardReference<T>): T {\r\n if (target instanceof ForwardReference) {\r\n return this._resolveForwardRef(target);\r\n }\r\n\r\n const k = keyOf(target) as TokenKey<unknown>;\r\n\r\n if (this.singletons.has(k)) {\r\n return this.singletons.get(k) as T;\r\n }\r\n\r\n const binding = this.bindings.get(k);\r\n\r\n if (!binding) {\r\n const name = target instanceof Token\r\n ? target.description\r\n : (target as Type<unknown>).name\r\n ?? 'unknown';\r\n\r\n throw new Error(\r\n `[Noxus DI] No binding found for \"${name}\".\\n`\r\n + `Did you forget to declare it in @Injectable({ deps }) or in bootstrapApplication({ singletons })?`,\r\n );\r\n }\r\n\r\n switch (binding.lifetime) {\r\n case 'transient':\r\n return this._instantiate(binding) as T;\r\n\r\n case 'scope': {\r\n if (this.scoped.has(k)) return this.scoped.get(k) as T;\r\n const inst = this._instantiate(binding);\r\n this.scoped.set(k, inst);\r\n return inst as T;\r\n }\r\n\r\n case 'singleton': {\r\n if (this.singletons.has(k)) return this.singletons.get(k) as T;\r\n const inst = this._instantiate(binding);\r\n this.singletons.set(k, inst);\r\n if (binding.instance === undefined) {\r\n (binding as IBinding<unknown>).instance = inst as unknown;\r\n }\r\n return inst as T;\r\n }\r\n }\r\n }\r\n\r\n // -------------------------------------------------------------------------\r\n\r\n private _resolveForwardRef<T>(ref: ForwardReference<T>): T {\r\n let resolved: T | undefined;\r\n return new Proxy({} as object, {\r\n get: (_obj, prop, receiver) => {\r\n resolved ??= this.resolve(ref.forwardRefFn()) as T;\r\n const value = Reflect.get(resolved as object, prop, receiver);\r\n return typeof value === 'function' ? (value as Function).bind(resolved) : value;\r\n },\r\n set: (_obj, prop, value, receiver) => {\r\n resolved ??= this.resolve(ref.forwardRefFn()) as T;\r\n return Reflect.set(resolved as object, prop, value, receiver);\r\n },\r\n getPrototypeOf: () => {\r\n resolved ??= this.resolve(ref.forwardRefFn()) as T;\r\n return Object.getPrototypeOf(resolved);\r\n },\r\n }) as T;\r\n }\r\n\r\n private _instantiate<T>(binding: IBinding<T>): T {\r\n const resolvedDeps = binding.deps.map((dep) => this.resolve(dep));\r\n return new binding.implementation(...resolvedDeps) as T;\r\n }\r\n}\r\n\r\n/**\r\n * The global root injector. All singletons live here.\r\n */\r\nexport const RootInjector = new AppInjector('root');\r\n\r\n/**\r\n * Resets the root injector to a clean state.\r\n * **Intended for testing only** — clears all bindings, singletons, and scoped instances\r\n * so that each test can start from a fresh DI container without restarting the process.\r\n */\r\nexport function resetRootInjector(): void {\r\n RootInjector.bindings.clear();\r\n RootInjector.singletons.clear();\r\n RootInjector.scoped.clear();\r\n // Lazy import to avoid circular dependency (InjectorExplorer → app-injector → InjectorExplorer)\r\n const { InjectorExplorer } = require('./injector-explorer') as typeof import('./injector-explorer');\r\n InjectorExplorer.reset();\r\n}\r\n\r\n/**\r\n * Convenience function: resolve a token from the root injector.\r\n */\r\nexport function inject<T>(t: TokenKey<T> | ForwardReference<T>): T {\r\n return RootInjector.resolve(t);\r\n}\r\n","/**\r\n * @copyright 2025 NoxFly\r\n * @license MIT\r\n * @author NoxFly\r\n */\r\n\r\n/**\r\n * Entry point for nodeJS non-electron process consumers.\r\n * For instance, if main process creates a child process that\r\n * wants to use Logger and DI.\r\n * Child processes must not try to communicate with the renderer\r\n * process.\r\n * order of exports here matters and can affect module resolution.\r\n * Please be cautious when modifying.\r\n */\r\n\r\nexport * from './DI/app-injector';\r\nexport * from './internal/exceptions';\r\nexport * from './decorators/injectable.decorator';\r\nexport * from './utils/logger';\r\nexport * from './utils/types';\r\nexport * from './utils/forward-ref';\r\n","/**\r\n * @copyright 2025 NoxFly\r\n * @license MIT\r\n * @author NoxFly\r\n */\r\n\r\nexport class ResponseException extends Error {\r\n public readonly status: number = 0;\r\n\r\n constructor(message?: string);\r\n constructor(statusCode?: number, message?: string);\r\n constructor(statusOrMessage?: number | string, message?: string) {\r\n let statusCode: number | undefined;\r\n \r\n if(typeof statusOrMessage === 'number') {\r\n statusCode = statusOrMessage;\r\n }\r\n else if(typeof statusOrMessage === 'string') {\r\n message = statusOrMessage;\r\n }\r\n\r\n super(message ?? \"\");\r\n\r\n if(statusCode !== undefined) {\r\n this.status = statusCode;\r\n }\r\n \r\n this.name = this.constructor.name\r\n .replace(/([A-Z])/g, ' $1');\r\n }\r\n}\r\n\r\n// 4XX\r\nexport class BadRequestException extends ResponseException { public override readonly status = 400; }\r\nexport class UnauthorizedException extends ResponseException { public override readonly status = 401; }\r\nexport class PaymentRequiredException extends ResponseException { public override readonly status = 402; }\r\nexport class ForbiddenException extends ResponseException { public override readonly status = 403; }\r\nexport class NotFoundException extends ResponseException { public override readonly status = 404; }\r\nexport class MethodNotAllowedException extends ResponseException { public override readonly status = 405; }\r\nexport class NotAcceptableException extends ResponseException { public override readonly status = 406; }\r\nexport class RequestTimeoutException extends ResponseException { public override readonly status = 408; }\r\nexport class ConflictException extends ResponseException { public override readonly status = 409; }\r\nexport class UpgradeRequiredException extends ResponseException { public override readonly status = 426; }\r\nexport class TooManyRequestsException extends ResponseException { public override readonly status = 429; }\r\n// 5XX\r\nexport class InternalServerException extends ResponseException { public override readonly status = 500; }\r\nexport class NotImplementedException extends ResponseException { public override readonly status = 501; }\r\nexport class BadGatewayException extends ResponseException { public override readonly status = 502; }\r\nexport class ServiceUnavailableException extends ResponseException { public override readonly status = 503; }\r\nexport class GatewayTimeoutException extends ResponseException { public override readonly status = 504; }\r\nexport class HttpVersionNotSupportedException extends ResponseException { public override readonly status = 505; }\r\nexport class VariantAlsoNegotiatesException extends ResponseException { public override readonly status = 506; }\r\nexport class InsufficientStorageException extends ResponseException { public override readonly status = 507; }\r\nexport class LoopDetectedException extends ResponseException { public override readonly status = 508; }\r\nexport class NotExtendedException extends ResponseException { public override readonly status = 510; }\r\nexport class NetworkAuthenticationRequiredException extends ResponseException { public override readonly status = 511; }\r\nexport class NetworkConnectTimeoutException extends ResponseException { public override readonly status = 599; }\r\n","/**\r\n * @copyright 2025 NoxFly\r\n * @license MIT\r\n * @author NoxFly\r\n */\r\n\r\nimport { Lifetime } from '../DI/app-injector';\r\nimport { InjectorExplorer } from '../DI/injector-explorer';\r\nimport { Token, TokenKey } from '../DI/token';\r\nimport { Type } from '../utils/types';\r\n\r\nexport interface InjectableOptions {\r\n /**\r\n * Lifetime of this injectable.\r\n * @default 'scope'\r\n */\r\n lifetime?: Lifetime;\r\n\r\n /**\r\n * Explicit list of constructor dependencies, in the same order as the constructor parameters.\r\n * Each entry is either a class constructor or a Token created with token().\r\n *\r\n * This replaces reflect-metadata / emitDecoratorMetadata entirely.\r\n *\r\n * @example\r\n * @Injectable({ lifetime: 'singleton', deps: [MyRepo, DB_URL] })\r\n * class MyService {\r\n * constructor(private repo: MyRepo, private dbUrl: string) {}\r\n * }\r\n */\r\n deps?: ReadonlyArray<TokenKey>;\r\n}\r\n\r\n/**\r\n * Marks a class as injectable into the Noxus DI container.\r\n *\r\n * Unlike the v2 @Injectable, this decorator:\r\n * - Does NOT require reflect-metadata or emitDecoratorMetadata.\r\n * - Requires you to declare deps explicitly when the class has constructor parameters.\r\n * - Supports standalone usage — no module declaration needed.\r\n *\r\n * @example\r\n * // No dependencies\r\n * @Injectable()\r\n * class Logger {}\r\n *\r\n * // With dependencies\r\n * @Injectable({ lifetime: 'singleton', deps: [Logger, MyRepo] })\r\n * class MyService {\r\n * constructor(private logger: Logger, private repo: MyRepo) {}\r\n * }\r\n *\r\n * // With a named token\r\n * const DB_URL = token<string>('DB_URL');\r\n *\r\n * @Injectable({ deps: [DB_URL] })\r\n * class DbService {\r\n * constructor(private url: string) {}\r\n * }\r\n */\r\nexport function Injectable(options: InjectableOptions = {}) {\r\n const { lifetime = 'scope', deps = [] } = options;\r\n\r\n return <T extends new (...args: any[]) => unknown>(target: T, _context: ClassDecoratorContext): T | void => {\r\n const key = target as unknown as Type<unknown>;\r\n\r\n InjectorExplorer.enqueue({\r\n key,\r\n implementation: key,\r\n lifetime,\r\n deps,\r\n isController: false,\r\n });\r\n };\r\n}\r\n\r\nexport { Token, TokenKey };\r\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA4BO,SAAS,WAAoB,IAA0C;AAC1E,SAAO,IAAI,iBAAiB,EAAE;AAClC;AA9BA,IAmBa;AAnBb;AAAA;AAAA;AAmBO,IAAM,oBAAN,MAAM,kBAA0B;AAAA,MACnC,YAA4B,cAA+B;AAA/B;AAAA,MAAgC;AAAA,IAChE;AAFuC;AAAhC,IAAM,mBAAN;AASS;AAAA;AAAA;;;AC5BhB,IAsBa;AAtBb;AAAA;AAAA;AAsBO,IAAM,SAAN,MAAM,OAAS;AAAA,MAGlB,YACoB,QAClB;AADkB;AAHpB,4BAAgB;AAKZ,aAAK,cAAc,OAAO,WAAW,WAAW,SAAS,OAAO;AAAA,MACpE;AAAA,MAEO,WAAmB;AACtB,eAAO,SAAS,KAAK,WAAW;AAAA,MACpC;AAAA,IACJ;AAZsB;AAAf,IAAM,QAAN;AAAA;AAAA;;;AChBP,YAAY,QAAQ;AACpB,YAAY,UAAU;AAyBtB,SAAS,qBAA6B;AAClC,QAAM,MAAM,oBAAI,KAAK;AACrB,SAAO,GAAG,IAAI,QAAQ,EAAE,SAAS,EAAE,SAAS,GAAG,GAAG,CAAC,KAAK,IAAI,SAAS,IAAI,GAAG,SAAS,EAA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A6B,kBAAkB;AAAA,EAArD;AAAA;AAAuD,wBAAyB,UAAS;AAAA;AAAK;AAAzC;AAArD,IAAM,uBAAN;AACA,IAAM,0CAAN,MAAM,gDAA+C,kBAAkB;AAAA,EAAvE;AAAA;AAAyE,wBAAyB,UAAS;AAAA;AAAK;AAAzC;AAAvE,IAAM,yCAAN;AACA,IAAM,kCAAN,MAAM,wCAAuC,kBAAkB;AAAA,EAA/D;AAAA;AAAiE,wBAAyB,UAAS;AAAA;AAAK;AAAzC;AAA/D,IAAM,iCAAN;;;ACjDP;AACA;AAoDO,SAAS,WAAW,UAA6B,CAAC,GAAG;AACxD,QAAM,EAAE,WAAW,SAAS,OAAO,CAAC,EAAE,IAAI;AAE1C,SAAO,CAA4C,QAAW,aAA8C;AACxG,UAAM,MAAM;AAEZ,qBAAiB,QAAQ;AAAA,MACrB;AAAA,MACA,gBAAgB;AAAA,MAChB;AAAA,MACA;AAAA,MACA,cAAc;AAAA,IAClB,CAAC;AAAA,EACL;AACJ;AAdgB;;;AFzChB;AAEA;","names":["err","Logger","InjectorExplorer"]}
package/dist/main.d.mts CHANGED
@@ -160,11 +160,11 @@ interface IRouteMetadata {
160
160
  middlewares: Middleware[];
161
161
  }
162
162
  declare function getRouteMetadata(target: object): IRouteMetadata[];
163
- declare const Get: (path: string, options?: IRouteOptions) => MethodDecorator;
164
- declare const Post: (path: string, options?: IRouteOptions) => MethodDecorator;
165
- declare const Put: (path: string, options?: IRouteOptions) => MethodDecorator;
166
- declare const Patch: (path: string, options?: IRouteOptions) => MethodDecorator;
167
- declare const Delete: (path: string, options?: IRouteOptions) => MethodDecorator;
163
+ declare const Get: (path: string, options?: IRouteOptions) => (value: Function, context: ClassMethodDecoratorContext) => void;
164
+ declare const Post: (path: string, options?: IRouteOptions) => (value: Function, context: ClassMethodDecoratorContext) => void;
165
+ declare const Put: (path: string, options?: IRouteOptions) => (value: Function, context: ClassMethodDecoratorContext) => void;
166
+ declare const Patch: (path: string, options?: IRouteOptions) => (value: Function, context: ClassMethodDecoratorContext) => void;
167
+ declare const Delete: (path: string, options?: IRouteOptions) => (value: Function, context: ClassMethodDecoratorContext) => void;
168
168
 
169
169
 
170
170
  /**
@@ -276,6 +276,16 @@ declare class Router {
276
276
  private tryFindRoute;
277
277
  private findRoute;
278
278
  private tryLoadLazyRoute;
279
+ /**
280
+ * Returns true when `requestPath` starts with `prefix`, treating `:param`
281
+ * segments in the prefix as single-segment wildcards.
282
+ *
283
+ * @example
284
+ * pathHasPrefix('contact/123/notes', 'contact/:id/notes') // true
285
+ * pathHasPrefix('contact/123/notes/get', 'contact/:id/notes') // true
286
+ * pathHasPrefix('contact/123', 'contact/:id/notes') // false
287
+ */
288
+ private pathHasPrefix;
279
289
  private loadLazyModule;
280
290
  private resolveController;
281
291
  private runPipeline;
@@ -830,7 +840,7 @@ interface IControllerMetadata {
830
840
  * getUserById(req: Request) { ... }
831
841
  * }
832
842
  */
833
- declare function Controller(options?: ControllerOptions): ClassDecorator;
843
+ declare function Controller(options?: ControllerOptions): <T extends new (...args: any[]) => unknown>(target: T, _context: ClassDecoratorContext) => T | void;
834
844
  declare function getControllerMetadata(target: object): IControllerMetadata | undefined;
835
845
 
836
846
 
@@ -881,6 +891,6 @@ interface InjectableOptions {
881
891
  * constructor(private url: string) {}
882
892
  * }
883
893
  */
884
- declare function Injectable(options?: InjectableOptions): ClassDecorator;
894
+ declare function Injectable(options?: InjectableOptions): <T extends new (...args: any[]) => unknown>(target: T, _context: ClassDecoratorContext) => T | void;
885
895
 
886
896
  export { AppInjector, type AtomicHttpMethod, BadGatewayException, BadRequestException, type BootstrapConfig, ConflictException, Controller, type ControllerAction, type ControllerOptions, Delete, ForbiddenException, type ForwardRefFn, ForwardReference, GatewayTimeoutException, Get, type Guard, type HttpMethod, HttpVersionNotSupportedException, type IApp, type IBatchRequestItem, type IBatchRequestPayload, type IBatchResponsePayload, type IBinding, type IControllerMetadata, type ILazyRoute, type IRendererEventMessage, type IRequest, type IResponse, type IRouteDefinition, type IRouteMetadata, type IRouteOptions, Injectable, type InjectableOptions, InsufficientStorageException, InternalServerException, type Lifetime, type LogLevel, Logger, LoopDetectedException, type MaybeAsync, MethodNotAllowedException, type Middleware, NetworkAuthenticationRequiredException, NetworkConnectTimeoutException, type NextFunction, NotAcceptableException, NotExtendedException, NotFoundException, NotImplementedException, NoxApp, NoxSocket, Patch, PaymentRequiredException, Post, Put, RENDERER_EVENT_TYPE, Request, RequestTimeoutException, ResponseException, RootInjector, type RouteDefinition, Router, ServiceUnavailableException, type SingletonOverride, Token, type TokenKey, TooManyRequestsException, type Type, UnauthorizedException, UpgradeRequiredException, VariantAlsoNegotiatesException, type WindowConfig, type WindowEvent, WindowManager, type WindowRecord, bootstrapApplication, createRendererEventMessage, defineRoutes, forwardRef, getControllerMetadata, getRouteMetadata, inject, isAtomicHttpMethod, isRendererEventMessage, resetRootInjector, token };
package/dist/main.d.ts CHANGED
@@ -160,11 +160,11 @@ interface IRouteMetadata {
160
160
  middlewares: Middleware[];
161
161
  }
162
162
  declare function getRouteMetadata(target: object): IRouteMetadata[];
163
- declare const Get: (path: string, options?: IRouteOptions) => MethodDecorator;
164
- declare const Post: (path: string, options?: IRouteOptions) => MethodDecorator;
165
- declare const Put: (path: string, options?: IRouteOptions) => MethodDecorator;
166
- declare const Patch: (path: string, options?: IRouteOptions) => MethodDecorator;
167
- declare const Delete: (path: string, options?: IRouteOptions) => MethodDecorator;
163
+ declare const Get: (path: string, options?: IRouteOptions) => (value: Function, context: ClassMethodDecoratorContext) => void;
164
+ declare const Post: (path: string, options?: IRouteOptions) => (value: Function, context: ClassMethodDecoratorContext) => void;
165
+ declare const Put: (path: string, options?: IRouteOptions) => (value: Function, context: ClassMethodDecoratorContext) => void;
166
+ declare const Patch: (path: string, options?: IRouteOptions) => (value: Function, context: ClassMethodDecoratorContext) => void;
167
+ declare const Delete: (path: string, options?: IRouteOptions) => (value: Function, context: ClassMethodDecoratorContext) => void;
168
168
 
169
169
 
170
170
  /**
@@ -276,6 +276,16 @@ declare class Router {
276
276
  private tryFindRoute;
277
277
  private findRoute;
278
278
  private tryLoadLazyRoute;
279
+ /**
280
+ * Returns true when `requestPath` starts with `prefix`, treating `:param`
281
+ * segments in the prefix as single-segment wildcards.
282
+ *
283
+ * @example
284
+ * pathHasPrefix('contact/123/notes', 'contact/:id/notes') // true
285
+ * pathHasPrefix('contact/123/notes/get', 'contact/:id/notes') // true
286
+ * pathHasPrefix('contact/123', 'contact/:id/notes') // false
287
+ */
288
+ private pathHasPrefix;
279
289
  private loadLazyModule;
280
290
  private resolveController;
281
291
  private runPipeline;
@@ -830,7 +840,7 @@ interface IControllerMetadata {
830
840
  * getUserById(req: Request) { ... }
831
841
  * }
832
842
  */
833
- declare function Controller(options?: ControllerOptions): ClassDecorator;
843
+ declare function Controller(options?: ControllerOptions): <T extends new (...args: any[]) => unknown>(target: T, _context: ClassDecoratorContext) => T | void;
834
844
  declare function getControllerMetadata(target: object): IControllerMetadata | undefined;
835
845
 
836
846
 
@@ -881,6 +891,6 @@ interface InjectableOptions {
881
891
  * constructor(private url: string) {}
882
892
  * }
883
893
  */
884
- declare function Injectable(options?: InjectableOptions): ClassDecorator;
894
+ declare function Injectable(options?: InjectableOptions): <T extends new (...args: any[]) => unknown>(target: T, _context: ClassDecoratorContext) => T | void;
885
895
 
886
896
  export { AppInjector, type AtomicHttpMethod, BadGatewayException, BadRequestException, type BootstrapConfig, ConflictException, Controller, type ControllerAction, type ControllerOptions, Delete, ForbiddenException, type ForwardRefFn, ForwardReference, GatewayTimeoutException, Get, type Guard, type HttpMethod, HttpVersionNotSupportedException, type IApp, type IBatchRequestItem, type IBatchRequestPayload, type IBatchResponsePayload, type IBinding, type IControllerMetadata, type ILazyRoute, type IRendererEventMessage, type IRequest, type IResponse, type IRouteDefinition, type IRouteMetadata, type IRouteOptions, Injectable, type InjectableOptions, InsufficientStorageException, InternalServerException, type Lifetime, type LogLevel, Logger, LoopDetectedException, type MaybeAsync, MethodNotAllowedException, type Middleware, NetworkAuthenticationRequiredException, NetworkConnectTimeoutException, type NextFunction, NotAcceptableException, NotExtendedException, NotFoundException, NotImplementedException, NoxApp, NoxSocket, Patch, PaymentRequiredException, Post, Put, RENDERER_EVENT_TYPE, Request, RequestTimeoutException, ResponseException, RootInjector, type RouteDefinition, Router, ServiceUnavailableException, type SingletonOverride, Token, type TokenKey, TooManyRequestsException, type Type, UnauthorizedException, UpgradeRequiredException, VariantAlsoNegotiatesException, type WindowConfig, type WindowEvent, WindowManager, type WindowRecord, bootstrapApplication, createRendererEventMessage, defineRoutes, forwardRef, getControllerMetadata, getRouteMetadata, inject, isAtomicHttpMethod, isRendererEventMessage, resetRootInjector, token };