@noxfly/noxus 3.0.0-dev.3 → 3.0.0-dev.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/README.md +114 -7
  2. package/dist/child.d.mts +7 -1
  3. package/dist/child.d.ts +7 -1
  4. package/dist/child.js +402 -862
  5. package/dist/child.js.map +1 -0
  6. package/dist/child.mjs +389 -850
  7. package/dist/child.mjs.map +1 -0
  8. package/dist/main.d.mts +171 -125
  9. package/dist/main.d.ts +171 -125
  10. package/dist/main.js +967 -886
  11. package/dist/main.js.map +1 -0
  12. package/dist/main.mjs +914 -834
  13. package/dist/main.mjs.map +1 -0
  14. package/dist/preload.js.map +1 -0
  15. package/dist/preload.mjs.map +1 -0
  16. package/dist/renderer.d.mts +17 -2
  17. package/dist/renderer.d.ts +17 -2
  18. package/dist/renderer.js +161 -118
  19. package/dist/renderer.js.map +1 -0
  20. package/dist/renderer.mjs +150 -106
  21. package/dist/renderer.mjs.map +1 -0
  22. package/package.json +10 -9
  23. package/.editorconfig +0 -16
  24. package/.github/copilot-instructions.md +0 -32
  25. package/.vscode/settings.json +0 -3
  26. package/eslint.config.js +0 -109
  27. package/scripts/postbuild.js +0 -31
  28. package/src/DI/app-injector.ts +0 -160
  29. package/src/DI/injector-explorer.ts +0 -143
  30. package/src/DI/token.ts +0 -53
  31. package/src/decorators/controller.decorator.ts +0 -58
  32. package/src/decorators/guards.decorator.ts +0 -15
  33. package/src/decorators/injectable.decorator.ts +0 -81
  34. package/src/decorators/method.decorator.ts +0 -66
  35. package/src/decorators/middleware.decorator.ts +0 -15
  36. package/src/index.ts +0 -10
  37. package/src/internal/app.ts +0 -217
  38. package/src/internal/bootstrap.ts +0 -109
  39. package/src/internal/exceptions.ts +0 -57
  40. package/src/internal/preload-bridge.ts +0 -75
  41. package/src/internal/renderer-client.ts +0 -338
  42. package/src/internal/renderer-events.ts +0 -110
  43. package/src/internal/request.ts +0 -97
  44. package/src/internal/router.ts +0 -353
  45. package/src/internal/routes.ts +0 -78
  46. package/src/internal/socket.ts +0 -73
  47. package/src/main.ts +0 -26
  48. package/src/non-electron-process.ts +0 -22
  49. package/src/preload.ts +0 -10
  50. package/src/renderer.ts +0 -13
  51. package/src/utils/forward-ref.ts +0 -31
  52. package/src/utils/logger.ts +0 -430
  53. package/src/utils/radix-tree.ts +0 -210
  54. package/src/utils/types.ts +0 -21
  55. package/src/window/window-manager.ts +0 -268
  56. package/tsconfig.json +0 -29
  57. 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;AAZ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+D,SAAyB,SAAS;AAAA;AAAK;AAAzC;AAA7D,IAAM,+BAAN;AACA,IAAM,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"]}
package/dist/main.d.mts CHANGED
@@ -119,6 +119,12 @@ declare class AppInjector {
119
119
  * The global root injector. All singletons live here.
120
120
  */
121
121
  declare const RootInjector: AppInjector;
122
+ /**
123
+ * Resets the root injector to a clean state.
124
+ * **Intended for testing only** — clears all bindings, singletons, and scoped instances
125
+ * so that each test can start from a fresh DI container without restarting the process.
126
+ */
127
+ declare function resetRootInjector(): void;
122
128
  /**
123
129
  * Convenience function: resolve a token from the root injector.
124
130
  */
@@ -172,10 +178,11 @@ declare class Request {
172
178
  readonly id: string;
173
179
  readonly method: HttpMethod;
174
180
  readonly path: string;
175
- readonly body: any;
181
+ readonly body: unknown;
176
182
  readonly context: AppInjector;
177
183
  readonly params: Record<string, string>;
178
- constructor(event: Electron.MessageEvent, senderId: number, id: string, method: HttpMethod, path: string, body: any);
184
+ readonly query: Record<string, string>;
185
+ constructor(event: Electron.MessageEvent, senderId: number, id: string, method: HttpMethod, path: string, body: unknown, query?: Record<string, string>);
179
186
  }
180
187
  /**
181
188
  * The IRequest interface defines the structure of a request object.
@@ -188,12 +195,14 @@ interface IRequest<TBody = unknown> {
188
195
  path: string;
189
196
  method: HttpMethod;
190
197
  body?: TBody;
198
+ query?: Record<string, string>;
191
199
  }
192
200
  interface IBatchRequestItem<TBody = unknown> {
193
201
  requestId?: string;
194
202
  path: string;
195
203
  method: AtomicHttpMethod;
196
204
  body?: TBody;
205
+ query?: Record<string, string>;
197
206
  }
198
207
  interface IBatchRequestPayload {
199
208
  requests: IBatchRequestItem[];
@@ -252,6 +261,14 @@ declare class Router {
252
261
  registerController(controllerClass: Type<unknown>, pathPrefix: string, routeGuards?: Guard[], routeMiddlewares?: Middleware[]): this;
253
262
  registerLazyRoute(pathPrefix: string, load: () => Promise<unknown>, guards?: Guard[], middlewares?: Middleware[]): this;
254
263
  defineRootMiddleware(middleware: Middleware): this;
264
+ getRegisteredRoutes(): Array<{
265
+ method: string;
266
+ path: string;
267
+ }>;
268
+ getLazyRoutes(): Array<{
269
+ prefix: string;
270
+ loaded: boolean;
271
+ }>;
255
272
  handle(request: Request): Promise<IResponse>;
256
273
  private handleAtomic;
257
274
  private handleBatch;
@@ -290,6 +307,11 @@ interface WindowRecord {
290
307
  window: BrowserWindow;
291
308
  id: number;
292
309
  }
310
+ /**
311
+ * @description
312
+ * The events emitted by WindowManager when windows are created, closed, focused, or blurred.
313
+ */
314
+ type WindowEvent = 'created' | 'closed' | 'focused' | 'blurred';
293
315
  /**
294
316
  * WindowManager is a singleton service that centralizes BrowserWindow lifecycle.
295
317
  *
@@ -314,6 +336,7 @@ interface WindowRecord {
314
336
  */
315
337
  declare class WindowManager {
316
338
  private readonly _windows;
339
+ private readonly listeners;
317
340
  private _mainWindowId;
318
341
  /**
319
342
  * Creates a BrowserWindow, optionally performs an animated expand to the
@@ -372,6 +395,8 @@ declare class WindowManager {
372
395
  * Broadcasts a message to all open windows.
373
396
  */
374
397
  broadcast(channel: string, ...args: unknown[]): void;
398
+ on(event: WindowEvent, handler: (win: BrowserWindow) => void): () => void;
399
+ private _emit;
375
400
  private _register;
376
401
  /**
377
402
  * Animates the window to the full work area of the primary display.
@@ -381,6 +406,20 @@ declare class WindowManager {
381
406
  private _expandToWorkArea;
382
407
  }
383
408
 
409
+ interface RendererChannels {
410
+ request: Electron.MessageChannelMain;
411
+ socket: Electron.MessageChannelMain;
412
+ }
413
+ declare class NoxSocket {
414
+ private readonly channels;
415
+ register(senderId: number, requestChannel: Electron.MessageChannelMain, socketChannel: Electron.MessageChannelMain): void;
416
+ get(senderId: number): RendererChannels | undefined;
417
+ unregister(senderId: number): void;
418
+ getSenderIds(): number[];
419
+ emit<TPayload = unknown>(eventName: string, payload?: TPayload, targetSenderIds?: number[]): void;
420
+ emitToRenderer<TPayload = unknown>(senderId: number, eventName: string, payload?: TPayload): boolean;
421
+ }
422
+
384
423
 
385
424
  /**
386
425
  * Your application service should implement IApp.
@@ -410,10 +449,11 @@ interface IApp {
410
449
  onActivated(): Promise<void>;
411
450
  }
412
451
  declare class NoxApp {
413
- private appService;
414
452
  private readonly router;
415
453
  private readonly socket;
416
454
  readonly windowManager: WindowManager;
455
+ private appService;
456
+ constructor(router: Router, socket: NoxSocket, windowManager: WindowManager);
417
457
  init(): Promise<this>;
418
458
  /**
419
459
  * Registers a lazy route. The file behind this prefix is dynamically
@@ -455,6 +495,107 @@ declare class NoxApp {
455
495
  private shutdownChannel;
456
496
  }
457
497
 
498
+ /**
499
+ * Logger is a utility class for logging messages to the console.
500
+ */
501
+ type LogLevel = 'debug' | 'comment' | 'log' | 'info' | 'warn' | 'error' | 'critical';
502
+ declare namespace Logger {
503
+ /**
504
+ * Sets the log level for the logger.
505
+ * This function allows you to change the log level dynamically at runtime.
506
+ * This won't affect the startup logs.
507
+ *
508
+ * If the parameter is a single LogLevel, all log levels with equal or higher severity will be enabled.
509
+
510
+ * If the parameter is an array of LogLevels, only the specified levels will be enabled.
511
+ *
512
+ * @param level Sets the log level for the logger.
513
+ */
514
+ function setLogLevel(level: LogLevel | LogLevel[]): void;
515
+ /**
516
+ * Logs a message to the console with log level LOG.
517
+ * This function formats the message with a timestamp, process ID, and the name of the caller function or class.
518
+ * It uses different colors for different log levels to enhance readability.
519
+ * @param args The arguments to log.
520
+ */
521
+ function log(...args: any[]): void;
522
+ /**
523
+ * Logs a message to the console with log level INFO.
524
+ * This function formats the message with a timestamp, process ID, and the name of the caller function or class.
525
+ * It uses different colors for different log levels to enhance readability.
526
+ * @param args The arguments to log.
527
+ */
528
+ function info(...args: any[]): void;
529
+ /**
530
+ * Logs a message to the console with log level WARN.
531
+ * This function formats the message with a timestamp, process ID, and the name of the caller function or class.
532
+ * It uses different colors for different log levels to enhance readability.
533
+ * @param args The arguments to log.
534
+ */
535
+ function warn(...args: any[]): void;
536
+ /**
537
+ * Logs a message to the console with log level ERROR.
538
+ * This function formats the message with a timestamp, process ID, and the name of the caller function or class.
539
+ * It uses different colors for different log levels to enhance readability.
540
+ * @param args The arguments to log.
541
+ */
542
+ function error(...args: any[]): void;
543
+ /**
544
+ * Logs a message to the console with log level ERROR and a grey color scheme.
545
+ */
546
+ function errorStack(...args: any[]): void;
547
+ /**
548
+ * Logs a message to the console with log level DEBUG.
549
+ * This function formats the message with a timestamp, process ID, and the name of the caller function or class.
550
+ * It uses different colors for different log levels to enhance readability.
551
+ * @param args The arguments to log.
552
+ */
553
+ function debug(...args: any[]): void;
554
+ /**
555
+ * Logs a message to the console with log level COMMENT.
556
+ * This function formats the message with a timestamp, process ID, and the name of the caller function or class.
557
+ * It uses different colors for different log levels to enhance readability.
558
+ * @param args The arguments to log.
559
+ */
560
+ function comment(...args: any[]): void;
561
+ /**
562
+ * Logs a message to the console with log level CRITICAL.
563
+ * This function formats the message with a timestamp, process ID, and the name of the caller function or class.
564
+ * It uses different colors for different log levels to enhance readability.
565
+ * @param args The arguments to log.
566
+ */
567
+ function critical(...args: any[]): void;
568
+ /**
569
+ * Enables logging to a file output for the specified log levels.
570
+ * @param filepath The path to the log file.
571
+ * @param levels The log levels to enable file logging for. Defaults to all levels.
572
+ */
573
+ function enableFileLogging(filepath: string, levels?: LogLevel[]): void;
574
+ /**
575
+ * Disables logging to a file output for the specified log levels.
576
+ * @param levels The log levels to disable file logging for. Defaults to all levels.
577
+ */
578
+ function disableFileLogging(levels?: LogLevel[]): void;
579
+ const colors: {
580
+ black: string;
581
+ grey: string;
582
+ red: string;
583
+ green: string;
584
+ brown: string;
585
+ blue: string;
586
+ purple: string;
587
+ darkGrey: string;
588
+ lightRed: string;
589
+ lightGreen: string;
590
+ yellow: string;
591
+ lightBlue: string;
592
+ magenta: string;
593
+ cyan: string;
594
+ white: string;
595
+ initial: string;
596
+ };
597
+ }
598
+
458
599
 
459
600
  /**
460
601
  * A single route entry in the application routing table.
@@ -469,10 +610,12 @@ interface RouteDefinition {
469
610
  * Dynamic import function returning the controller file.
470
611
  * The controller is loaded lazily on the first IPC request targeting this prefix.
471
612
  *
613
+ * Optional when the route only serves as a parent for `children`.
614
+ *
472
615
  * @example
473
616
  * load: () => import('./modules/users/users.controller')
474
617
  */
475
- load: () => Promise<unknown>;
618
+ load?: () => Promise<unknown>;
476
619
  /**
477
620
  * Guards applied to every action in this controller.
478
621
  * Merged with action-level guards.
@@ -483,6 +626,11 @@ interface RouteDefinition {
483
626
  * Merged with action-level middlewares.
484
627
  */
485
628
  middlewares?: Middleware[];
629
+ /**
630
+ * Nested child routes. Guards and middlewares declared here are
631
+ * inherited (merged) by all children.
632
+ */
633
+ children?: RouteDefinition[];
486
634
  }
487
635
  /**
488
636
  * Defines the application routing table.
@@ -491,6 +639,9 @@ interface RouteDefinition {
491
639
  * This is the single source of truth for routing — no path is declared
492
640
  * in @Controller(), preventing duplicate route prefixes across controllers.
493
641
  *
642
+ * Supports nested routes via the `children` property. Guards and middlewares
643
+ * from parent entries are inherited (merged) into each child.
644
+ *
494
645
  * @example
495
646
  * export const routes = defineRoutes([
496
647
  * {
@@ -499,16 +650,17 @@ interface RouteDefinition {
499
650
  * guards: [authGuard],
500
651
  * },
501
652
  * {
502
- * path: 'orders',
503
- * load: () => import('./modules/orders/orders.controller'),
504
- * guards: [authGuard],
505
- * middlewares: [logMiddleware],
653
+ * path: 'admin',
654
+ * guards: [authGuard, adminGuard],
655
+ * children: [
656
+ * { path: 'users', load: () => import('./admin/users.controller') },
657
+ * { path: 'products', load: () => import('./admin/products.controller') },
658
+ * ],
506
659
  * },
507
660
  * ]);
508
661
  */
509
662
  declare function defineRoutes(routes: RouteDefinition[]): RouteDefinition[];
510
663
 
511
-
512
664
  /**
513
665
  * A singleton value override: provides an already-constructed instance
514
666
  * for a given token, bypassing the DI factory.
@@ -563,6 +715,15 @@ interface BootstrapConfig {
563
715
  * ]
564
716
  */
565
717
  eagerLoad?: Array<() => Promise<unknown>>;
718
+ /**
719
+ * Controls framework log verbosity.
720
+ * - `'debug'`: all messages (default during development).
721
+ * - `'info'`: info, warn, error, critical only.
722
+ * - `'none'`: completely silent — no framework logs.
723
+ *
724
+ * You can also pass an array of specific log levels to enable.
725
+ */
726
+ logLevel?: 'debug' | 'info' | 'none' | LogLevel[];
566
727
  }
567
728
  /**
568
729
  * Bootstraps the Noxus application.
@@ -721,119 +882,4 @@ interface InjectableOptions {
721
882
  */
722
883
  declare function Injectable(options?: InjectableOptions): ClassDecorator;
723
884
 
724
- /**
725
- * Logger is a utility class for logging messages to the console.
726
- */
727
- type LogLevel = 'debug' | 'comment' | 'log' | 'info' | 'warn' | 'error' | 'critical';
728
- declare namespace Logger {
729
- /**
730
- * Sets the log level for the logger.
731
- * This function allows you to change the log level dynamically at runtime.
732
- * This won't affect the startup logs.
733
- *
734
- * If the parameter is a single LogLevel, all log levels with equal or higher severity will be enabled.
735
-
736
- * If the parameter is an array of LogLevels, only the specified levels will be enabled.
737
- *
738
- * @param level Sets the log level for the logger.
739
- */
740
- function setLogLevel(level: LogLevel | LogLevel[]): void;
741
- /**
742
- * Logs a message to the console with log level LOG.
743
- * This function formats the message with a timestamp, process ID, and the name of the caller function or class.
744
- * It uses different colors for different log levels to enhance readability.
745
- * @param args The arguments to log.
746
- */
747
- function log(...args: any[]): void;
748
- /**
749
- * Logs a message to the console with log level INFO.
750
- * This function formats the message with a timestamp, process ID, and the name of the caller function or class.
751
- * It uses different colors for different log levels to enhance readability.
752
- * @param args The arguments to log.
753
- */
754
- function info(...args: any[]): void;
755
- /**
756
- * Logs a message to the console with log level WARN.
757
- * This function formats the message with a timestamp, process ID, and the name of the caller function or class.
758
- * It uses different colors for different log levels to enhance readability.
759
- * @param args The arguments to log.
760
- */
761
- function warn(...args: any[]): void;
762
- /**
763
- * Logs a message to the console with log level ERROR.
764
- * This function formats the message with a timestamp, process ID, and the name of the caller function or class.
765
- * It uses different colors for different log levels to enhance readability.
766
- * @param args The arguments to log.
767
- */
768
- function error(...args: any[]): void;
769
- /**
770
- * Logs a message to the console with log level ERROR and a grey color scheme.
771
- */
772
- function errorStack(...args: any[]): void;
773
- /**
774
- * Logs a message to the console with log level DEBUG.
775
- * This function formats the message with a timestamp, process ID, and the name of the caller function or class.
776
- * It uses different colors for different log levels to enhance readability.
777
- * @param args The arguments to log.
778
- */
779
- function debug(...args: any[]): void;
780
- /**
781
- * Logs a message to the console with log level COMMENT.
782
- * This function formats the message with a timestamp, process ID, and the name of the caller function or class.
783
- * It uses different colors for different log levels to enhance readability.
784
- * @param args The arguments to log.
785
- */
786
- function comment(...args: any[]): void;
787
- /**
788
- * Logs a message to the console with log level CRITICAL.
789
- * This function formats the message with a timestamp, process ID, and the name of the caller function or class.
790
- * It uses different colors for different log levels to enhance readability.
791
- * @param args The arguments to log.
792
- */
793
- function critical(...args: any[]): void;
794
- /**
795
- * Enables logging to a file output for the specified log levels.
796
- * @param filepath The path to the log file.
797
- * @param levels The log levels to enable file logging for. Defaults to all levels.
798
- */
799
- function enableFileLogging(filepath: string, levels?: LogLevel[]): void;
800
- /**
801
- * Disables logging to a file output for the specified log levels.
802
- * @param levels The log levels to disable file logging for. Defaults to all levels.
803
- */
804
- function disableFileLogging(levels?: LogLevel[]): void;
805
- const colors: {
806
- black: string;
807
- grey: string;
808
- red: string;
809
- green: string;
810
- brown: string;
811
- blue: string;
812
- purple: string;
813
- darkGrey: string;
814
- lightRed: string;
815
- lightGreen: string;
816
- yellow: string;
817
- lightBlue: string;
818
- magenta: string;
819
- cyan: string;
820
- white: string;
821
- initial: string;
822
- };
823
- }
824
-
825
- interface RendererChannels {
826
- request: Electron.MessageChannelMain;
827
- socket: Electron.MessageChannelMain;
828
- }
829
- declare class NoxSocket {
830
- private readonly channels;
831
- register(senderId: number, requestChannel: Electron.MessageChannelMain, socketChannel: Electron.MessageChannelMain): void;
832
- get(senderId: number): RendererChannels | undefined;
833
- unregister(senderId: number): void;
834
- getSenderIds(): number[];
835
- emit<TPayload = unknown>(eventName: string, payload?: TPayload, targetSenderIds?: number[]): number;
836
- emitToRenderer<TPayload = unknown>(senderId: number, eventName: string, payload?: TPayload): boolean;
837
- }
838
-
839
- export { AppInjector, type AtomicHttpMethod, BadGatewayException, BadRequestException, type BootstrapConfig, ConflictException, Controller, type ControllerAction, type ControllerOptions, Delete, ForbiddenException, type ForwardRefFn, ForwardReference, GatewayTimeoutException, Get, type Guard, type HttpMethod, HttpVersionNotSupportedException, type IApp, type IBatchRequestItem, type IBatchRequestPayload, type IBatchResponsePayload, type IBinding, type IControllerMetadata, type ILazyRoute, type IRendererEventMessage, type IRequest, type IResponse, type IRouteDefinition, type IRouteMetadata, type IRouteOptions, Injectable, type InjectableOptions, InsufficientStorageException, InternalServerException, type Lifetime, type LogLevel, Logger, LoopDetectedException, type MaybeAsync, MethodNotAllowedException, type Middleware, NetworkAuthenticationRequiredException, NetworkConnectTimeoutException, type NextFunction, NotAcceptableException, NotExtendedException, NotFoundException, NotImplementedException, NoxApp, NoxSocket, Patch, PaymentRequiredException, Post, Put, RENDERER_EVENT_TYPE, Request, RequestTimeoutException, ResponseException, RootInjector, type RouteDefinition, Router, ServiceUnavailableException, type SingletonOverride, Token, type TokenKey, TooManyRequestsException, type Type, UnauthorizedException, UpgradeRequiredException, VariantAlsoNegotiatesException, type WindowConfig, WindowManager, type WindowRecord, bootstrapApplication, createRendererEventMessage, defineRoutes, forwardRef, getControllerMetadata, getRouteMetadata, inject, isAtomicHttpMethod, isRendererEventMessage, token };
885
+ export { AppInjector, type AtomicHttpMethod, BadGatewayException, BadRequestException, type BootstrapConfig, ConflictException, Controller, type ControllerAction, type ControllerOptions, Delete, ForbiddenException, type ForwardRefFn, ForwardReference, GatewayTimeoutException, Get, type Guard, type HttpMethod, HttpVersionNotSupportedException, type IApp, type IBatchRequestItem, type IBatchRequestPayload, type IBatchResponsePayload, type IBinding, type IControllerMetadata, type ILazyRoute, type IRendererEventMessage, type IRequest, type IResponse, type IRouteDefinition, type IRouteMetadata, type IRouteOptions, Injectable, type InjectableOptions, InsufficientStorageException, InternalServerException, type Lifetime, type LogLevel, Logger, LoopDetectedException, type MaybeAsync, MethodNotAllowedException, type Middleware, NetworkAuthenticationRequiredException, NetworkConnectTimeoutException, type NextFunction, NotAcceptableException, NotExtendedException, NotFoundException, NotImplementedException, NoxApp, NoxSocket, Patch, PaymentRequiredException, Post, Put, RENDERER_EVENT_TYPE, Request, RequestTimeoutException, ResponseException, RootInjector, type RouteDefinition, Router, ServiceUnavailableException, type SingletonOverride, Token, type TokenKey, TooManyRequestsException, type Type, UnauthorizedException, UpgradeRequiredException, VariantAlsoNegotiatesException, type WindowConfig, type WindowEvent, WindowManager, type WindowRecord, bootstrapApplication, createRendererEventMessage, defineRoutes, forwardRef, getControllerMetadata, getRouteMetadata, inject, isAtomicHttpMethod, isRendererEventMessage, resetRootInjector, token };