@noxfly/noxus 3.0.0-dev.4 → 3.0.0-dev.6
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.js.map +1 -0
- package/dist/child.mjs.map +1 -0
- package/dist/main.d.mts +4 -4
- package/dist/main.d.ts +4 -4
- package/dist/main.js.map +1 -0
- package/dist/main.mjs.map +1 -0
- package/dist/preload.js.map +1 -0
- package/dist/preload.mjs.map +1 -0
- package/dist/renderer.d.mts +4 -4
- package/dist/renderer.d.ts +4 -4
- package/dist/renderer.js.map +1 -0
- package/dist/renderer.mjs.map +1 -0
- package/package.json +10 -9
- package/.editorconfig +0 -16
- package/.github/copilot-instructions.md +0 -128
- package/.vscode/settings.json +0 -3
- package/AGENTS.md +0 -5
- package/eslint.config.js +0 -109
- package/scripts/postbuild.js +0 -31
- package/src/DI/app-injector.ts +0 -173
- package/src/DI/injector-explorer.ts +0 -201
- package/src/DI/token.ts +0 -53
- package/src/decorators/controller.decorator.ts +0 -58
- package/src/decorators/guards.decorator.ts +0 -15
- package/src/decorators/injectable.decorator.ts +0 -81
- package/src/decorators/method.decorator.ts +0 -66
- package/src/decorators/middleware.decorator.ts +0 -15
- package/src/index.ts +0 -10
- package/src/internal/app.ts +0 -219
- package/src/internal/bootstrap.ts +0 -141
- package/src/internal/exceptions.ts +0 -57
- package/src/internal/preload-bridge.ts +0 -75
- package/src/internal/renderer-client.ts +0 -374
- package/src/internal/renderer-events.ts +0 -110
- package/src/internal/request.ts +0 -102
- package/src/internal/router.ts +0 -365
- package/src/internal/routes.ts +0 -142
- package/src/internal/socket.ts +0 -75
- package/src/main.ts +0 -26
- package/src/non-electron-process.ts +0 -22
- package/src/preload.ts +0 -10
- package/src/renderer.ts +0 -13
- package/src/utils/forward-ref.ts +0 -31
- package/src/utils/logger.ts +0 -430
- package/src/utils/radix-tree.ts +0 -243
- package/src/utils/types.ts +0 -21
- package/src/window/window-manager.ts +0 -302
- package/tsconfig.json +0 -29
- package/tsup.config.ts +0 -50
|
@@ -0,0 +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,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;AAEhB,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;;;ACUP,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,EAAE,SAAS,GAAG,GAAG,CAAC,IAAI,IAAI,YAAY,CAAC,IAClH,IAAI,SAAS,EAAE,SAAS,EA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AAM,yBAAN,MAAM,+BAA8B,kBAAkB;AAAA,EAAtD;AAAA;AAAwD,SAAyB,SAAS;AAAA;AAAK;AAAzC;AAAtD,IAAM,wBAAN;AACA,IAAM,wBAAN,MAAM,8BAA6B,kBAAkB;AAAA,EAArD;AAAA;AAAuD,SAAyB,SAAS;AAAA;AAAK;AAAzC;AAArD,IAAM,uBAAN;AACA,IAAM,0CAAN,MAAM,gDAA+C,kBAAkB;AAAA,EAAvE;AAAA;AAAyE,SAAyB,SAAS;AAAA;AAAK;AAAzC;AAAvE,IAAM,yCAAN;AACA,IAAM,kCAAN,MAAM,wCAAuC,kBAAkB;AAAA,EAA/D;AAAA;AAAiE,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"]}
|
|
@@ -0,0 +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 lif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;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"]}
|
package/dist/main.d.mts
CHANGED
|
@@ -181,8 +181,8 @@ declare class Request {
|
|
|
181
181
|
readonly body: unknown;
|
|
182
182
|
readonly context: AppInjector;
|
|
183
183
|
readonly params: Record<string, string>;
|
|
184
|
-
readonly query: Record<string,
|
|
185
|
-
constructor(event: Electron.MessageEvent, senderId: number, id: string, method: HttpMethod, path: string, body: unknown, query?: Record<string,
|
|
184
|
+
readonly query: Record<string, unknown>;
|
|
185
|
+
constructor(event: Electron.MessageEvent, senderId: number, id: string, method: HttpMethod, path: string, body: unknown, query?: Record<string, unknown>);
|
|
186
186
|
}
|
|
187
187
|
/**
|
|
188
188
|
* The IRequest interface defines the structure of a request object.
|
|
@@ -195,14 +195,14 @@ interface IRequest<TBody = unknown> {
|
|
|
195
195
|
path: string;
|
|
196
196
|
method: HttpMethod;
|
|
197
197
|
body?: TBody;
|
|
198
|
-
query?: Record<string,
|
|
198
|
+
query?: Record<string, unknown>;
|
|
199
199
|
}
|
|
200
200
|
interface IBatchRequestItem<TBody = unknown> {
|
|
201
201
|
requestId?: string;
|
|
202
202
|
path: string;
|
|
203
203
|
method: AtomicHttpMethod;
|
|
204
204
|
body?: TBody;
|
|
205
|
-
query?: Record<string,
|
|
205
|
+
query?: Record<string, unknown>;
|
|
206
206
|
}
|
|
207
207
|
interface IBatchRequestPayload {
|
|
208
208
|
requests: IBatchRequestItem[];
|
package/dist/main.d.ts
CHANGED
|
@@ -181,8 +181,8 @@ declare class Request {
|
|
|
181
181
|
readonly body: unknown;
|
|
182
182
|
readonly context: AppInjector;
|
|
183
183
|
readonly params: Record<string, string>;
|
|
184
|
-
readonly query: Record<string,
|
|
185
|
-
constructor(event: Electron.MessageEvent, senderId: number, id: string, method: HttpMethod, path: string, body: unknown, query?: Record<string,
|
|
184
|
+
readonly query: Record<string, unknown>;
|
|
185
|
+
constructor(event: Electron.MessageEvent, senderId: number, id: string, method: HttpMethod, path: string, body: unknown, query?: Record<string, unknown>);
|
|
186
186
|
}
|
|
187
187
|
/**
|
|
188
188
|
* The IRequest interface defines the structure of a request object.
|
|
@@ -195,14 +195,14 @@ interface IRequest<TBody = unknown> {
|
|
|
195
195
|
path: string;
|
|
196
196
|
method: HttpMethod;
|
|
197
197
|
body?: TBody;
|
|
198
|
-
query?: Record<string,
|
|
198
|
+
query?: Record<string, unknown>;
|
|
199
199
|
}
|
|
200
200
|
interface IBatchRequestItem<TBody = unknown> {
|
|
201
201
|
requestId?: string;
|
|
202
202
|
path: string;
|
|
203
203
|
method: AtomicHttpMethod;
|
|
204
204
|
body?: TBody;
|
|
205
|
-
query?: Record<string,
|
|
205
|
+
query?: Record<string, unknown>;
|
|
206
206
|
}
|
|
207
207
|
interface IBatchRequestPayload {
|
|
208
208
|
requests: IBatchRequestItem[];
|