@noxfly/noxus 3.0.0-dev.10 → 3.0.0-dev.11
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.d.mts +1 -1
- package/dist/child.d.ts +1 -1
- package/dist/child.js +36 -36
- package/dist/child.js.map +1 -1
- package/dist/child.mjs +36 -36
- package/dist/child.mjs.map +1 -1
- package/dist/main.d.mts +7 -7
- package/dist/main.d.ts +7 -7
- package/dist/main.js +146 -85
- package/dist/main.js.map +1 -1
- package/dist/main.mjs +147 -85
- package/dist/main.mjs.map +1 -1
- package/dist/renderer.js +31 -15
- package/dist/renderer.js.map +1 -1
- package/dist/renderer.mjs +31 -15
- package/dist/renderer.mjs.map +1 -1
- package/package.json +1 -1
package/dist/child.d.mts
CHANGED
|
@@ -243,7 +243,7 @@ interface InjectableOptions {
|
|
|
243
243
|
* constructor(private url: string) {}
|
|
244
244
|
* }
|
|
245
245
|
*/
|
|
246
|
-
declare function Injectable(options?: InjectableOptions):
|
|
246
|
+
declare function Injectable(options?: InjectableOptions): <T extends new (...args: any[]) => unknown>(target: T, _context: ClassDecoratorContext) => T | void;
|
|
247
247
|
|
|
248
248
|
/**
|
|
249
249
|
* Logger is a utility class for logging messages to the console.
|
package/dist/child.d.ts
CHANGED
|
@@ -243,7 +243,7 @@ interface InjectableOptions {
|
|
|
243
243
|
* constructor(private url: string) {}
|
|
244
244
|
* }
|
|
245
245
|
*/
|
|
246
|
-
declare function Injectable(options?: InjectableOptions):
|
|
246
|
+
declare function Injectable(options?: InjectableOptions): <T extends new (...args: any[]) => unknown>(target: T, _context: ClassDecoratorContext) => T | void;
|
|
247
247
|
|
|
248
248
|
/**
|
|
249
249
|
* Logger is a utility class for logging messages to the console.
|
package/dist/child.js
CHANGED
|
@@ -10,6 +10,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
10
10
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
11
11
|
var __getProtoOf = Object.getPrototypeOf;
|
|
12
12
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
13
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
14
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
14
15
|
var __esm = (fn, res) => function __init() {
|
|
15
16
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
@@ -35,6 +36,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
35
36
|
mod
|
|
36
37
|
));
|
|
37
38
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
39
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
38
40
|
|
|
39
41
|
// src/utils/forward-ref.ts
|
|
40
42
|
function forwardRef(fn) {
|
|
@@ -63,6 +65,7 @@ var init_token = __esm({
|
|
|
63
65
|
_Token = class _Token {
|
|
64
66
|
constructor(target) {
|
|
65
67
|
this.target = target;
|
|
68
|
+
__publicField(this, "description");
|
|
66
69
|
this.description = typeof target === "string" ? target : target.name;
|
|
67
70
|
}
|
|
68
71
|
toString() {
|
|
@@ -454,11 +457,11 @@ var init_injector_explorer = __esm({
|
|
|
454
457
|
}
|
|
455
458
|
};
|
|
456
459
|
__name(_InjectorExplorer, "InjectorExplorer");
|
|
457
|
-
_InjectorExplorer
|
|
458
|
-
_InjectorExplorer
|
|
459
|
-
_InjectorExplorer
|
|
460
|
-
_InjectorExplorer
|
|
461
|
-
_InjectorExplorer
|
|
460
|
+
__publicField(_InjectorExplorer, "pending", []);
|
|
461
|
+
__publicField(_InjectorExplorer, "processed", false);
|
|
462
|
+
__publicField(_InjectorExplorer, "accumulating", false);
|
|
463
|
+
__publicField(_InjectorExplorer, "loadingLock", Promise.resolve());
|
|
464
|
+
__publicField(_InjectorExplorer, "controllerRegistrar", null);
|
|
462
465
|
InjectorExplorer = _InjectorExplorer;
|
|
463
466
|
}
|
|
464
467
|
});
|
|
@@ -487,9 +490,9 @@ var init_app_injector = __esm({
|
|
|
487
490
|
_AppInjector = class _AppInjector {
|
|
488
491
|
constructor(name = null) {
|
|
489
492
|
this.name = name;
|
|
490
|
-
this
|
|
491
|
-
this
|
|
492
|
-
this
|
|
493
|
+
__publicField(this, "bindings", /* @__PURE__ */ new Map());
|
|
494
|
+
__publicField(this, "singletons", /* @__PURE__ */ new Map());
|
|
495
|
+
__publicField(this, "scoped", /* @__PURE__ */ new Map());
|
|
493
496
|
}
|
|
494
497
|
/**
|
|
495
498
|
* Creates a child scope for per-request lifetime resolution.
|
|
@@ -630,7 +633,7 @@ var _ResponseException = class _ResponseException extends Error {
|
|
|
630
633
|
message = statusOrMessage;
|
|
631
634
|
}
|
|
632
635
|
super(message ?? "");
|
|
633
|
-
this
|
|
636
|
+
__publicField(this, "status", 0);
|
|
634
637
|
if (statusCode !== void 0) {
|
|
635
638
|
this.status = statusCode;
|
|
636
639
|
}
|
|
@@ -642,7 +645,7 @@ var ResponseException = _ResponseException;
|
|
|
642
645
|
var _BadRequestException = class _BadRequestException extends ResponseException {
|
|
643
646
|
constructor() {
|
|
644
647
|
super(...arguments);
|
|
645
|
-
this
|
|
648
|
+
__publicField(this, "status", 400);
|
|
646
649
|
}
|
|
647
650
|
};
|
|
648
651
|
__name(_BadRequestException, "BadRequestException");
|
|
@@ -650,7 +653,7 @@ var BadRequestException = _BadRequestException;
|
|
|
650
653
|
var _UnauthorizedException = class _UnauthorizedException extends ResponseException {
|
|
651
654
|
constructor() {
|
|
652
655
|
super(...arguments);
|
|
653
|
-
this
|
|
656
|
+
__publicField(this, "status", 401);
|
|
654
657
|
}
|
|
655
658
|
};
|
|
656
659
|
__name(_UnauthorizedException, "UnauthorizedException");
|
|
@@ -658,7 +661,7 @@ var UnauthorizedException = _UnauthorizedException;
|
|
|
658
661
|
var _PaymentRequiredException = class _PaymentRequiredException extends ResponseException {
|
|
659
662
|
constructor() {
|
|
660
663
|
super(...arguments);
|
|
661
|
-
this
|
|
664
|
+
__publicField(this, "status", 402);
|
|
662
665
|
}
|
|
663
666
|
};
|
|
664
667
|
__name(_PaymentRequiredException, "PaymentRequiredException");
|
|
@@ -666,7 +669,7 @@ var PaymentRequiredException = _PaymentRequiredException;
|
|
|
666
669
|
var _ForbiddenException = class _ForbiddenException extends ResponseException {
|
|
667
670
|
constructor() {
|
|
668
671
|
super(...arguments);
|
|
669
|
-
this
|
|
672
|
+
__publicField(this, "status", 403);
|
|
670
673
|
}
|
|
671
674
|
};
|
|
672
675
|
__name(_ForbiddenException, "ForbiddenException");
|
|
@@ -674,7 +677,7 @@ var ForbiddenException = _ForbiddenException;
|
|
|
674
677
|
var _NotFoundException = class _NotFoundException extends ResponseException {
|
|
675
678
|
constructor() {
|
|
676
679
|
super(...arguments);
|
|
677
|
-
this
|
|
680
|
+
__publicField(this, "status", 404);
|
|
678
681
|
}
|
|
679
682
|
};
|
|
680
683
|
__name(_NotFoundException, "NotFoundException");
|
|
@@ -682,7 +685,7 @@ var NotFoundException = _NotFoundException;
|
|
|
682
685
|
var _MethodNotAllowedException = class _MethodNotAllowedException extends ResponseException {
|
|
683
686
|
constructor() {
|
|
684
687
|
super(...arguments);
|
|
685
|
-
this
|
|
688
|
+
__publicField(this, "status", 405);
|
|
686
689
|
}
|
|
687
690
|
};
|
|
688
691
|
__name(_MethodNotAllowedException, "MethodNotAllowedException");
|
|
@@ -690,7 +693,7 @@ var MethodNotAllowedException = _MethodNotAllowedException;
|
|
|
690
693
|
var _NotAcceptableException = class _NotAcceptableException extends ResponseException {
|
|
691
694
|
constructor() {
|
|
692
695
|
super(...arguments);
|
|
693
|
-
this
|
|
696
|
+
__publicField(this, "status", 406);
|
|
694
697
|
}
|
|
695
698
|
};
|
|
696
699
|
__name(_NotAcceptableException, "NotAcceptableException");
|
|
@@ -698,7 +701,7 @@ var NotAcceptableException = _NotAcceptableException;
|
|
|
698
701
|
var _RequestTimeoutException = class _RequestTimeoutException extends ResponseException {
|
|
699
702
|
constructor() {
|
|
700
703
|
super(...arguments);
|
|
701
|
-
this
|
|
704
|
+
__publicField(this, "status", 408);
|
|
702
705
|
}
|
|
703
706
|
};
|
|
704
707
|
__name(_RequestTimeoutException, "RequestTimeoutException");
|
|
@@ -706,7 +709,7 @@ var RequestTimeoutException = _RequestTimeoutException;
|
|
|
706
709
|
var _ConflictException = class _ConflictException extends ResponseException {
|
|
707
710
|
constructor() {
|
|
708
711
|
super(...arguments);
|
|
709
|
-
this
|
|
712
|
+
__publicField(this, "status", 409);
|
|
710
713
|
}
|
|
711
714
|
};
|
|
712
715
|
__name(_ConflictException, "ConflictException");
|
|
@@ -714,7 +717,7 @@ var ConflictException = _ConflictException;
|
|
|
714
717
|
var _UpgradeRequiredException = class _UpgradeRequiredException extends ResponseException {
|
|
715
718
|
constructor() {
|
|
716
719
|
super(...arguments);
|
|
717
|
-
this
|
|
720
|
+
__publicField(this, "status", 426);
|
|
718
721
|
}
|
|
719
722
|
};
|
|
720
723
|
__name(_UpgradeRequiredException, "UpgradeRequiredException");
|
|
@@ -722,7 +725,7 @@ var UpgradeRequiredException = _UpgradeRequiredException;
|
|
|
722
725
|
var _TooManyRequestsException = class _TooManyRequestsException extends ResponseException {
|
|
723
726
|
constructor() {
|
|
724
727
|
super(...arguments);
|
|
725
|
-
this
|
|
728
|
+
__publicField(this, "status", 429);
|
|
726
729
|
}
|
|
727
730
|
};
|
|
728
731
|
__name(_TooManyRequestsException, "TooManyRequestsException");
|
|
@@ -730,7 +733,7 @@ var TooManyRequestsException = _TooManyRequestsException;
|
|
|
730
733
|
var _InternalServerException = class _InternalServerException extends ResponseException {
|
|
731
734
|
constructor() {
|
|
732
735
|
super(...arguments);
|
|
733
|
-
this
|
|
736
|
+
__publicField(this, "status", 500);
|
|
734
737
|
}
|
|
735
738
|
};
|
|
736
739
|
__name(_InternalServerException, "InternalServerException");
|
|
@@ -738,7 +741,7 @@ var InternalServerException = _InternalServerException;
|
|
|
738
741
|
var _NotImplementedException = class _NotImplementedException extends ResponseException {
|
|
739
742
|
constructor() {
|
|
740
743
|
super(...arguments);
|
|
741
|
-
this
|
|
744
|
+
__publicField(this, "status", 501);
|
|
742
745
|
}
|
|
743
746
|
};
|
|
744
747
|
__name(_NotImplementedException, "NotImplementedException");
|
|
@@ -746,7 +749,7 @@ var NotImplementedException = _NotImplementedException;
|
|
|
746
749
|
var _BadGatewayException = class _BadGatewayException extends ResponseException {
|
|
747
750
|
constructor() {
|
|
748
751
|
super(...arguments);
|
|
749
|
-
this
|
|
752
|
+
__publicField(this, "status", 502);
|
|
750
753
|
}
|
|
751
754
|
};
|
|
752
755
|
__name(_BadGatewayException, "BadGatewayException");
|
|
@@ -754,7 +757,7 @@ var BadGatewayException = _BadGatewayException;
|
|
|
754
757
|
var _ServiceUnavailableException = class _ServiceUnavailableException extends ResponseException {
|
|
755
758
|
constructor() {
|
|
756
759
|
super(...arguments);
|
|
757
|
-
this
|
|
760
|
+
__publicField(this, "status", 503);
|
|
758
761
|
}
|
|
759
762
|
};
|
|
760
763
|
__name(_ServiceUnavailableException, "ServiceUnavailableException");
|
|
@@ -762,7 +765,7 @@ var ServiceUnavailableException = _ServiceUnavailableException;
|
|
|
762
765
|
var _GatewayTimeoutException = class _GatewayTimeoutException extends ResponseException {
|
|
763
766
|
constructor() {
|
|
764
767
|
super(...arguments);
|
|
765
|
-
this
|
|
768
|
+
__publicField(this, "status", 504);
|
|
766
769
|
}
|
|
767
770
|
};
|
|
768
771
|
__name(_GatewayTimeoutException, "GatewayTimeoutException");
|
|
@@ -770,7 +773,7 @@ var GatewayTimeoutException = _GatewayTimeoutException;
|
|
|
770
773
|
var _HttpVersionNotSupportedException = class _HttpVersionNotSupportedException extends ResponseException {
|
|
771
774
|
constructor() {
|
|
772
775
|
super(...arguments);
|
|
773
|
-
this
|
|
776
|
+
__publicField(this, "status", 505);
|
|
774
777
|
}
|
|
775
778
|
};
|
|
776
779
|
__name(_HttpVersionNotSupportedException, "HttpVersionNotSupportedException");
|
|
@@ -778,7 +781,7 @@ var HttpVersionNotSupportedException = _HttpVersionNotSupportedException;
|
|
|
778
781
|
var _VariantAlsoNegotiatesException = class _VariantAlsoNegotiatesException extends ResponseException {
|
|
779
782
|
constructor() {
|
|
780
783
|
super(...arguments);
|
|
781
|
-
this
|
|
784
|
+
__publicField(this, "status", 506);
|
|
782
785
|
}
|
|
783
786
|
};
|
|
784
787
|
__name(_VariantAlsoNegotiatesException, "VariantAlsoNegotiatesException");
|
|
@@ -786,7 +789,7 @@ var VariantAlsoNegotiatesException = _VariantAlsoNegotiatesException;
|
|
|
786
789
|
var _InsufficientStorageException = class _InsufficientStorageException extends ResponseException {
|
|
787
790
|
constructor() {
|
|
788
791
|
super(...arguments);
|
|
789
|
-
this
|
|
792
|
+
__publicField(this, "status", 507);
|
|
790
793
|
}
|
|
791
794
|
};
|
|
792
795
|
__name(_InsufficientStorageException, "InsufficientStorageException");
|
|
@@ -794,7 +797,7 @@ var InsufficientStorageException = _InsufficientStorageException;
|
|
|
794
797
|
var _LoopDetectedException = class _LoopDetectedException extends ResponseException {
|
|
795
798
|
constructor() {
|
|
796
799
|
super(...arguments);
|
|
797
|
-
this
|
|
800
|
+
__publicField(this, "status", 508);
|
|
798
801
|
}
|
|
799
802
|
};
|
|
800
803
|
__name(_LoopDetectedException, "LoopDetectedException");
|
|
@@ -802,7 +805,7 @@ var LoopDetectedException = _LoopDetectedException;
|
|
|
802
805
|
var _NotExtendedException = class _NotExtendedException extends ResponseException {
|
|
803
806
|
constructor() {
|
|
804
807
|
super(...arguments);
|
|
805
|
-
this
|
|
808
|
+
__publicField(this, "status", 510);
|
|
806
809
|
}
|
|
807
810
|
};
|
|
808
811
|
__name(_NotExtendedException, "NotExtendedException");
|
|
@@ -810,7 +813,7 @@ var NotExtendedException = _NotExtendedException;
|
|
|
810
813
|
var _NetworkAuthenticationRequiredException = class _NetworkAuthenticationRequiredException extends ResponseException {
|
|
811
814
|
constructor() {
|
|
812
815
|
super(...arguments);
|
|
813
|
-
this
|
|
816
|
+
__publicField(this, "status", 511);
|
|
814
817
|
}
|
|
815
818
|
};
|
|
816
819
|
__name(_NetworkAuthenticationRequiredException, "NetworkAuthenticationRequiredException");
|
|
@@ -818,7 +821,7 @@ var NetworkAuthenticationRequiredException = _NetworkAuthenticationRequiredExcep
|
|
|
818
821
|
var _NetworkConnectTimeoutException = class _NetworkConnectTimeoutException extends ResponseException {
|
|
819
822
|
constructor() {
|
|
820
823
|
super(...arguments);
|
|
821
|
-
this
|
|
824
|
+
__publicField(this, "status", 599);
|
|
822
825
|
}
|
|
823
826
|
};
|
|
824
827
|
__name(_NetworkConnectTimeoutException, "NetworkConnectTimeoutException");
|
|
@@ -829,10 +832,7 @@ init_injector_explorer();
|
|
|
829
832
|
init_token();
|
|
830
833
|
function Injectable(options = {}) {
|
|
831
834
|
const { lifetime = "scope", deps = [] } = options;
|
|
832
|
-
return (target) => {
|
|
833
|
-
if (typeof target !== "function" || !target.prototype) {
|
|
834
|
-
throw new Error(`@Injectable can only be applied to classes, not ${typeof target}`);
|
|
835
|
-
}
|
|
835
|
+
return (target, _context) => {
|
|
836
836
|
const key = target;
|
|
837
837
|
InjectorExplorer.enqueue({
|
|
838
838
|
key,
|
package/dist/child.js.map
CHANGED
|
@@ -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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AiE,SAAyB,SAAS;AAAA;AAAK;AAAzC;AAA/D,IAAM,iCAAN;;;ACjDP;AACA;AAoDO,SAAS,WAAW,UAA6B,CAAC,GAAmB;AACxE,QAAM,EAAE,WAAW,SAAS,OAAO,CAAC,EAAE,IAAI;AAE1C,SAAO,CAAC,WAAW;AACf,QAAI,OAAO,WAAW,cAAc,CAAC,OAAO,WAAW;AACnD,YAAM,IAAI,MAAM,mDAAmD,OAAO,MAAM,EAAE;AAAA,IACtF;AAEA,UAAM,MAAM;AAEZ,qBAAiB,QAAQ;AAAA,MACrB;AAAA,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;AAK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