@noxfly/noxus 2.2.0 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/main.d.ts CHANGED
@@ -1,5 +1,8 @@
1
- import { R as Request, I as IResponse, M as MaybeAsync, T as Type, a as IGuard, L as Lifetime, b as IPortRequester } from './index-Dr-ifUJj.js';
2
- export { A as AppInjector, j as AtomicHttpMethod, e as Authorize, D as Delete, F as ForwardRefFn, o as ForwardReference, G as Get, H as HttpMethod, r as IBatchRequestItem, s as IBatchRequestPayload, t as IBatchResponsePayload, c as IBinding, v as IRendererEventMessage, q as IRequest, h as IRouteMetadata, N as NoxRendererClient, m as Patch, P as Post, l as Put, u as RENDERER_EVENT_TYPE, n as ROUTE_METADATA_KEY, C as RendererClientOptions, y as RendererEventHandler, B as RendererEventRegistry, z as RendererEventSubscription, d as RootInjector, w as createRendererEventMessage, p as forwardRef, g as getGuardForController, f as getGuardForControllerAction, k as getRouteMetadata, i as inject, x as isRendererEventMessage } from './index-Dr-ifUJj.js';
1
+ import { M as MaybeAsync, T as Type } from './app-injector-B3MvgV3k.js';
2
+ export { A as AppInjector, F as ForwardRefFn, a as ForwardReference, I as IBinding, L as Lifetime, R as RootInjector, f as forwardRef, i as inject } from './app-injector-B3MvgV3k.js';
3
+ import { R as Request, I as IResponse, a as IGuard, b as IPortRequester } from './index-BxWQVi6C.js';
4
+ export { e as AtomicHttpMethod, A as Authorize, D as Delete, G as Get, H as HttpMethod, l as IBatchRequestItem, m as IBatchRequestPayload, n as IBatchResponsePayload, p as IRendererEventMessage, k as IRequest, d as IRouteMetadata, N as NoxRendererClient, i as Patch, P as Post, h as Put, o as RENDERER_EVENT_TYPE, j as ROUTE_METADATA_KEY, v as RendererClientOptions, s as RendererEventHandler, u as RendererEventRegistry, t as RendererEventSubscription, q as createRendererEventMessage, g as getGuardForController, c as getGuardForControllerAction, f as getRouteMetadata, r as isRendererEventMessage } from './index-BxWQVi6C.js';
5
+ export { BadGatewayException, BadRequestException, ConflictException, ForbiddenException, GatewayTimeoutException, HttpVersionNotSupportedException, INJECTABLE_METADATA_KEY, INJECT_METADATA_KEY, Inject, Injectable, InsufficientStorageException, InternalServerException, LogLevel, Logger, LoopDetectedException, MethodNotAllowedException, NetworkAuthenticationRequiredException, NetworkConnectTimeoutException, NotAcceptableException, NotExtendedException, NotFoundException, NotImplementedException, PaymentRequiredException, RequestTimeoutException, ResponseException, ServiceUnavailableException, TooManyRequestsException, UnauthorizedException, UpgradeRequiredException, VariantAlsoNegotiatesException, getInjectableMetadata, hasInjectableMetadata } from './child.js';
3
6
 
4
7
  /**
5
8
  * @copyright 2025 NoxFly
@@ -260,81 +263,6 @@ declare class NoxApp {
260
263
  */
261
264
  declare function bootstrapApplication(rootModule: Type<any>): Promise<NoxApp>;
262
265
 
263
- declare class ResponseException extends Error {
264
- readonly status: number;
265
- constructor(message?: string);
266
- constructor(statusCode?: number, message?: string);
267
- }
268
- declare class BadRequestException extends ResponseException {
269
- readonly status = 400;
270
- }
271
- declare class UnauthorizedException extends ResponseException {
272
- readonly status = 401;
273
- }
274
- declare class PaymentRequiredException extends ResponseException {
275
- readonly status = 402;
276
- }
277
- declare class ForbiddenException extends ResponseException {
278
- readonly status = 403;
279
- }
280
- declare class NotFoundException extends ResponseException {
281
- readonly status = 404;
282
- }
283
- declare class MethodNotAllowedException extends ResponseException {
284
- readonly status = 405;
285
- }
286
- declare class NotAcceptableException extends ResponseException {
287
- readonly status = 406;
288
- }
289
- declare class RequestTimeoutException extends ResponseException {
290
- readonly status = 408;
291
- }
292
- declare class ConflictException extends ResponseException {
293
- readonly status = 409;
294
- }
295
- declare class UpgradeRequiredException extends ResponseException {
296
- readonly status = 426;
297
- }
298
- declare class TooManyRequestsException extends ResponseException {
299
- readonly status = 429;
300
- }
301
- declare class InternalServerException extends ResponseException {
302
- readonly status = 500;
303
- }
304
- declare class NotImplementedException extends ResponseException {
305
- readonly status = 501;
306
- }
307
- declare class BadGatewayException extends ResponseException {
308
- readonly status = 502;
309
- }
310
- declare class ServiceUnavailableException extends ResponseException {
311
- readonly status = 503;
312
- }
313
- declare class GatewayTimeoutException extends ResponseException {
314
- readonly status = 504;
315
- }
316
- declare class HttpVersionNotSupportedException extends ResponseException {
317
- readonly status = 505;
318
- }
319
- declare class VariantAlsoNegotiatesException extends ResponseException {
320
- readonly status = 506;
321
- }
322
- declare class InsufficientStorageException extends ResponseException {
323
- readonly status = 507;
324
- }
325
- declare class LoopDetectedException extends ResponseException {
326
- readonly status = 508;
327
- }
328
- declare class NotExtendedException extends ResponseException {
329
- readonly status = 510;
330
- }
331
- declare class NetworkAuthenticationRequiredException extends ResponseException {
332
- readonly status = 511;
333
- }
334
- declare class NetworkConnectTimeoutException extends ResponseException {
335
- readonly status = 599;
336
- }
337
-
338
266
 
339
267
  /**
340
268
  * The configuration that waits a controller's decorator.
@@ -359,30 +287,6 @@ declare function Controller(path: string): ClassDecorator;
359
287
  declare function getControllerMetadata(target: Type<unknown>): IControllerMetadata | undefined;
360
288
  declare const CONTROLLER_METADATA_KEY: unique symbol;
361
289
 
362
- declare const INJECTABLE_METADATA_KEY: unique symbol;
363
- declare function getInjectableMetadata(target: Function): Lifetime | undefined;
364
- declare function hasInjectableMetadata(target: Function): boolean;
365
-
366
-
367
- /**
368
- * The Injectable decorator marks a class as injectable.
369
- * It allows the class to be registered in the dependency injection system.
370
- * A class decorated with @Injectable can be injected into other classes
371
- * either from the constructor of the class that needs it of from the `inject` function.
372
- * @param lifetime - The lifetime of the injectable. Can be 'singleton', 'scope', or 'transient'.
373
- */
374
- declare function Injectable(lifetime?: Lifetime): ClassDecorator;
375
-
376
-
377
- declare const INJECT_METADATA_KEY = "custom:inject";
378
- /**
379
- * Decorator to manually inject a dependency.
380
- * Useful for handling circular dependencies with `forwardRef` or injecting specific tokens.
381
- *
382
- * @param token The token or forward reference to inject.
383
- */
384
- declare function Inject(token: any): ParameterDecorator;
385
-
386
290
 
387
291
  interface IModuleMetadata {
388
292
  imports?: Type<unknown>[];
@@ -417,105 +321,4 @@ interface NoxusPreloadOptions {
417
321
  */
418
322
  declare function exposeNoxusBridge(options?: NoxusPreloadOptions): NoxusPreloadAPI;
419
323
 
420
- /**
421
- * Logger is a utility class for logging messages to the console.
422
- */
423
- type LogLevel = 'debug' | 'comment' | 'log' | 'info' | 'warn' | 'error' | 'critical';
424
- declare namespace Logger {
425
- /**
426
- * Sets the log level for the logger.
427
- * This function allows you to change the log level dynamically at runtime.
428
- * This won't affect the startup logs.
429
- *
430
- * If the parameter is a single LogLevel, all log levels with equal or higher severity will be enabled.
431
-
432
- * If the parameter is an array of LogLevels, only the specified levels will be enabled.
433
- *
434
- * @param level Sets the log level for the logger.
435
- */
436
- function setLogLevel(level: LogLevel | LogLevel[]): void;
437
- /**
438
- * Logs a message to the console with log level LOG.
439
- * This function formats the message with a timestamp, process ID, and the name of the caller function or class.
440
- * It uses different colors for different log levels to enhance readability.
441
- * @param args The arguments to log.
442
- */
443
- function log(...args: any[]): void;
444
- /**
445
- * Logs a message to the console with log level INFO.
446
- * This function formats the message with a timestamp, process ID, and the name of the caller function or class.
447
- * It uses different colors for different log levels to enhance readability.
448
- * @param args The arguments to log.
449
- */
450
- function info(...args: any[]): void;
451
- /**
452
- * Logs a message to the console with log level WARN.
453
- * This function formats the message with a timestamp, process ID, and the name of the caller function or class.
454
- * It uses different colors for different log levels to enhance readability.
455
- * @param args The arguments to log.
456
- */
457
- function warn(...args: any[]): void;
458
- /**
459
- * Logs a message to the console with log level ERROR.
460
- * This function formats the message with a timestamp, process ID, and the name of the caller function or class.
461
- * It uses different colors for different log levels to enhance readability.
462
- * @param args The arguments to log.
463
- */
464
- function error(...args: any[]): void;
465
- /**
466
- * Logs a message to the console with log level ERROR and a grey color scheme.
467
- */
468
- function errorStack(...args: any[]): void;
469
- /**
470
- * Logs a message to the console with log level DEBUG.
471
- * This function formats the message with a timestamp, process ID, and the name of the caller function or class.
472
- * It uses different colors for different log levels to enhance readability.
473
- * @param args The arguments to log.
474
- */
475
- function debug(...args: any[]): void;
476
- /**
477
- * Logs a message to the console with log level COMMENT.
478
- * This function formats the message with a timestamp, process ID, and the name of the caller function or class.
479
- * It uses different colors for different log levels to enhance readability.
480
- * @param args The arguments to log.
481
- */
482
- function comment(...args: any[]): void;
483
- /**
484
- * Logs a message to the console with log level CRITICAL.
485
- * This function formats the message with a timestamp, process ID, and the name of the caller function or class.
486
- * It uses different colors for different log levels to enhance readability.
487
- * @param args The arguments to log.
488
- */
489
- function critical(...args: any[]): void;
490
- /**
491
- * Enables logging to a file output for the specified log levels.
492
- * @param filepath The path to the log file.
493
- * @param levels The log levels to enable file logging for. Defaults to all levels.
494
- */
495
- function enableFileLogging(filepath: string, levels?: LogLevel[]): void;
496
- /**
497
- * Disables logging to a file output for the specified log levels.
498
- * @param levels The log levels to disable file logging for. Defaults to all levels.
499
- */
500
- function disableFileLogging(levels?: LogLevel[]): void;
501
- const colors: {
502
- black: string;
503
- grey: string;
504
- red: string;
505
- green: string;
506
- brown: string;
507
- blue: string;
508
- purple: string;
509
- darkGrey: string;
510
- lightRed: string;
511
- lightGreen: string;
512
- yellow: string;
513
- lightBlue: string;
514
- magenta: string;
515
- cyan: string;
516
- white: string;
517
- initial: string;
518
- };
519
- }
520
-
521
- export { BadGatewayException, BadRequestException, CONTROLLER_METADATA_KEY, ConflictException, Controller, type ControllerAction, ForbiddenException, GatewayTimeoutException, HttpVersionNotSupportedException, type IApp, type IControllerMetadata, IGuard, type IMiddleware, type IModuleMetadata, INJECTABLE_METADATA_KEY, INJECT_METADATA_KEY, IPortRequester, IResponse, type IRouteDefinition, Inject, Injectable, InsufficientStorageException, InternalServerException, Lifetime, type LogLevel, Logger, LoopDetectedException, MODULE_METADATA_KEY, MaybeAsync, MethodNotAllowedException, Module, NetworkAuthenticationRequiredException, NetworkConnectTimeoutException, type NextFunction, NotAcceptableException, NotExtendedException, NotFoundException, NotImplementedException, NoxApp, NoxSocket, type NoxusPreloadAPI, type NoxusPreloadOptions, PaymentRequiredException, Request, RequestTimeoutException, ResponseException, Router, ServiceUnavailableException, TooManyRequestsException, Type, UnauthorizedException, UpgradeRequiredException, UseMiddlewares, VariantAlsoNegotiatesException, bootstrapApplication, exposeNoxusBridge, getControllerMetadata, getInjectableMetadata, getMiddlewaresForController, getMiddlewaresForControllerAction, getModuleMetadata, hasInjectableMetadata };
324
+ export { CONTROLLER_METADATA_KEY, Controller, type ControllerAction, type IApp, type IControllerMetadata, IGuard, type IMiddleware, type IModuleMetadata, IPortRequester, IResponse, type IRouteDefinition, MODULE_METADATA_KEY, MaybeAsync, Module, type NextFunction, NoxApp, NoxSocket, type NoxusPreloadAPI, type NoxusPreloadOptions, Request, Router, Type, UseMiddlewares, bootstrapApplication, exposeNoxusBridge, getControllerMetadata, getMiddlewaresForController, getMiddlewaresForControllerAction, getModuleMetadata };
@@ -1 +1,2 @@
1
- export { r as IBatchRequestItem, s as IBatchRequestPayload, t as IBatchResponsePayload, b as IPortRequester, v as IRendererEventMessage, q as IRequest, I as IResponse, N as NoxRendererClient, u as RENDERER_EVENT_TYPE, C as RendererClientOptions, y as RendererEventHandler, B as RendererEventRegistry, z as RendererEventSubscription, R as Request, w as createRendererEventMessage, x as isRendererEventMessage } from './index-Dr-ifUJj.mjs';
1
+ export { l as IBatchRequestItem, m as IBatchRequestPayload, n as IBatchResponsePayload, b as IPortRequester, p as IRendererEventMessage, k as IRequest, I as IResponse, N as NoxRendererClient, o as RENDERER_EVENT_TYPE, v as RendererClientOptions, s as RendererEventHandler, u as RendererEventRegistry, t as RendererEventSubscription, R as Request, q as createRendererEventMessage, r as isRendererEventMessage } from './index-DQBQQfMw.mjs';
2
+ import './app-injector-B3MvgV3k.mjs';
@@ -1 +1,2 @@
1
- export { r as IBatchRequestItem, s as IBatchRequestPayload, t as IBatchResponsePayload, b as IPortRequester, v as IRendererEventMessage, q as IRequest, I as IResponse, N as NoxRendererClient, u as RENDERER_EVENT_TYPE, C as RendererClientOptions, y as RendererEventHandler, B as RendererEventRegistry, z as RendererEventSubscription, R as Request, w as createRendererEventMessage, x as isRendererEventMessage } from './index-Dr-ifUJj.js';
1
+ export { l as IBatchRequestItem, m as IBatchRequestPayload, n as IBatchResponsePayload, b as IPortRequester, p as IRendererEventMessage, k as IRequest, I as IResponse, N as NoxRendererClient, o as RENDERER_EVENT_TYPE, v as RendererClientOptions, s as RendererEventHandler, u as RendererEventRegistry, t as RendererEventSubscription, R as Request, q as createRendererEventMessage, r as isRendererEventMessage } from './index-BxWQVi6C.js';
2
+ import './app-injector-B3MvgV3k.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noxfly/noxus",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "main": "dist/main.js",
5
5
  "module": "dist/main.mjs",
6
6
  "types": "dist/main.d.ts",
@@ -26,6 +26,11 @@
26
26
  "types": "./dist/main.d.ts",
27
27
  "import": "./dist/main.mjs",
28
28
  "require": "./dist/main.js"
29
+ },
30
+ "./child": {
31
+ "types": "./dist/child.d.ts",
32
+ "import": "./dist/child.mjs",
33
+ "require": "./dist/child.js"
29
34
  }
30
35
  },
31
36
  "scripts": {
@@ -0,0 +1,23 @@
1
+ /**
2
+ * @copyright 2025 NoxFly
3
+ * @license MIT
4
+ * @author NoxFly
5
+ */
6
+
7
+ /**
8
+ * Entry point for nodeJS non-electron process consumers.
9
+ * For instance, if main process creates a child process that
10
+ * wants to use Logger and DI.
11
+ * Child processes must not try to communicate with the renderer
12
+ * process.
13
+ * order of exports here matters and can affect module resolution.
14
+ * Please be cautious when modifying.
15
+ */
16
+
17
+ export * from './DI/app-injector';
18
+ export * from './exceptions';
19
+ export * from './decorators/injectable.decorator';
20
+ export * from './decorators/inject.decorator';
21
+ export * from './utils/logger';
22
+ export * from './utils/types';
23
+ export * from './utils/forward-ref';
package/tsup.config.ts CHANGED
@@ -12,6 +12,7 @@ export default defineConfig({
12
12
  entry: {
13
13
  renderer: "src/index.ts",
14
14
  main: "src/main.ts",
15
+ child: "src/non-electron-process.ts",
15
16
  },
16
17
  keepNames: true,
17
18
  minifyIdentifiers: false,