@noxfly/noxus 2.5.0 → 3.0.0-dev.1

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 (58) hide show
  1. package/README.md +405 -340
  2. package/dist/app-injector-Bz3Upc0y.d.mts +125 -0
  3. package/dist/app-injector-Bz3Upc0y.d.ts +125 -0
  4. package/dist/child.d.mts +157 -23
  5. package/dist/child.d.ts +157 -23
  6. package/dist/child.js +1111 -1341
  7. package/dist/child.mjs +1086 -1294
  8. package/dist/main.d.mts +720 -284
  9. package/dist/main.d.ts +720 -284
  10. package/dist/main.js +1471 -1650
  11. package/dist/main.mjs +1409 -1559
  12. package/dist/preload.d.mts +28 -0
  13. package/dist/preload.d.ts +28 -0
  14. package/dist/preload.js +95 -0
  15. package/dist/preload.mjs +70 -0
  16. package/dist/renderer.d.mts +159 -22
  17. package/dist/renderer.d.ts +159 -22
  18. package/dist/renderer.js +104 -177
  19. package/dist/renderer.mjs +100 -172
  20. package/dist/request-BlTtiHbi.d.ts +112 -0
  21. package/dist/request-qJ9EiDZc.d.mts +112 -0
  22. package/package.json +24 -19
  23. package/src/DI/app-injector.ts +95 -106
  24. package/src/DI/injector-explorer.ts +93 -119
  25. package/src/DI/token.ts +53 -0
  26. package/src/decorators/controller.decorator.ts +38 -27
  27. package/src/decorators/guards.decorator.ts +5 -64
  28. package/src/decorators/injectable.decorator.ts +68 -15
  29. package/src/decorators/method.decorator.ts +40 -81
  30. package/src/decorators/middleware.decorator.ts +5 -72
  31. package/src/index.ts +4 -5
  32. package/src/internal/app.ts +217 -0
  33. package/src/internal/bootstrap.ts +108 -0
  34. package/src/{preload-bridge.ts → internal/preload-bridge.ts} +1 -1
  35. package/src/{renderer-client.ts → internal/renderer-client.ts} +2 -2
  36. package/src/{renderer-events.ts → internal/renderer-events.ts} +1 -1
  37. package/src/{request.ts → internal/request.ts} +3 -3
  38. package/src/internal/router.ts +353 -0
  39. package/src/internal/routes.ts +78 -0
  40. package/src/{socket.ts → internal/socket.ts} +4 -4
  41. package/src/main.ts +10 -14
  42. package/src/non-electron-process.ts +1 -2
  43. package/src/preload.ts +10 -0
  44. package/src/renderer.ts +13 -0
  45. package/src/window/window-manager.ts +255 -0
  46. package/tsconfig.json +5 -10
  47. package/tsup.config.ts +29 -13
  48. package/dist/app-injector-B3MvgV3k.d.mts +0 -95
  49. package/dist/app-injector-B3MvgV3k.d.ts +0 -95
  50. package/dist/request-CdpZ9qZL.d.ts +0 -167
  51. package/dist/request-Dx_5Prte.d.mts +0 -167
  52. package/src/app.ts +0 -244
  53. package/src/bootstrap.ts +0 -84
  54. package/src/decorators/inject.decorator.ts +0 -24
  55. package/src/decorators/injectable.metadata.ts +0 -15
  56. package/src/decorators/module.decorator.ts +0 -75
  57. package/src/router.ts +0 -594
  58. /package/src/{exceptions.ts → internal/exceptions.ts} +0 -0
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @copyright 2025 NoxFly
3
+ * @license MIT
4
+ * @author NoxFly
5
+ */
6
+
7
+ interface IPortRequester {
8
+ requestPort(): void;
9
+ }
10
+
11
+
12
+ interface NoxusPreloadAPI extends IPortRequester {
13
+ }
14
+ interface NoxusPreloadOptions {
15
+ exposeAs?: string;
16
+ initMessageType?: string;
17
+ requestChannel?: string;
18
+ responseChannel?: string;
19
+ targetWindow?: Window;
20
+ }
21
+ /**
22
+ * Exposes a minimal bridge in the isolated preload context so renderer processes
23
+ * can request the two MessagePorts required by Noxus. The bridge forwards both
24
+ * request/response and socket ports to the renderer via window.postMessage.
25
+ */
26
+ declare function exposeNoxusBridge(options?: NoxusPreloadOptions): NoxusPreloadAPI;
27
+
28
+ export { type NoxusPreloadAPI, type NoxusPreloadOptions, exposeNoxusBridge };
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @copyright 2025 NoxFly
3
+ * @license MIT
4
+ * @author NoxFly
5
+ */
6
+
7
+ interface IPortRequester {
8
+ requestPort(): void;
9
+ }
10
+
11
+
12
+ interface NoxusPreloadAPI extends IPortRequester {
13
+ }
14
+ interface NoxusPreloadOptions {
15
+ exposeAs?: string;
16
+ initMessageType?: string;
17
+ requestChannel?: string;
18
+ responseChannel?: string;
19
+ targetWindow?: Window;
20
+ }
21
+ /**
22
+ * Exposes a minimal bridge in the isolated preload context so renderer processes
23
+ * can request the two MessagePorts required by Noxus. The bridge forwards both
24
+ * request/response and socket ports to the renderer via window.postMessage.
25
+ */
26
+ declare function exposeNoxusBridge(options?: NoxusPreloadOptions): NoxusPreloadAPI;
27
+
28
+ export { type NoxusPreloadAPI, type NoxusPreloadOptions, exposeNoxusBridge };
@@ -0,0 +1,95 @@
1
+ /**
2
+ * @copyright 2025 NoxFly
3
+ * @license MIT
4
+ * @author NoxFly
5
+ */
6
+ "use strict";
7
+ var __defProp = Object.defineProperty;
8
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9
+ var __getOwnPropNames = Object.getOwnPropertyNames;
10
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
11
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
12
+ var __export = (target, all) => {
13
+ for (var name in all)
14
+ __defProp(target, name, { get: all[name], enumerable: true });
15
+ };
16
+ var __copyProps = (to, from, except, desc) => {
17
+ if (from && typeof from === "object" || typeof from === "function") {
18
+ for (let key of __getOwnPropNames(from))
19
+ if (!__hasOwnProp.call(to, key) && key !== except)
20
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
21
+ }
22
+ return to;
23
+ };
24
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
25
+
26
+ // src/preload.ts
27
+ var preload_exports = {};
28
+ __export(preload_exports, {
29
+ exposeNoxusBridge: () => exposeNoxusBridge
30
+ });
31
+ module.exports = __toCommonJS(preload_exports);
32
+
33
+ // src/internal/preload-bridge.ts
34
+ var import_renderer = require("electron/renderer");
35
+ var DEFAULT_EXPOSE_NAME = "noxus";
36
+ var DEFAULT_INIT_EVENT = "init-port";
37
+ var DEFAULT_REQUEST_CHANNEL = "gimme-my-port";
38
+ var DEFAULT_RESPONSE_CHANNEL = "port";
39
+ function exposeNoxusBridge(options = {}) {
40
+ const {
41
+ exposeAs = DEFAULT_EXPOSE_NAME,
42
+ initMessageType = DEFAULT_INIT_EVENT,
43
+ requestChannel = DEFAULT_REQUEST_CHANNEL,
44
+ responseChannel = DEFAULT_RESPONSE_CHANNEL,
45
+ targetWindow = window
46
+ } = options;
47
+ const api = {
48
+ requestPort: /* @__PURE__ */ __name(() => {
49
+ import_renderer.ipcRenderer.send(requestChannel);
50
+ import_renderer.ipcRenderer.once(responseChannel, (event, message) => {
51
+ const ports = (event.ports ?? []).filter((port) => port !== void 0);
52
+ if (ports.length === 0) {
53
+ console.error("[Noxus] No MessagePort received from main process.");
54
+ return;
55
+ }
56
+ for (const port of ports) {
57
+ try {
58
+ port.start();
59
+ } catch (error) {
60
+ console.error("[Noxus] Failed to start MessagePort.", error);
61
+ }
62
+ }
63
+ targetWindow.postMessage(
64
+ {
65
+ type: initMessageType,
66
+ senderId: message?.senderId
67
+ },
68
+ "*",
69
+ ports
70
+ );
71
+ });
72
+ }, "requestPort")
73
+ };
74
+ import_renderer.contextBridge.exposeInMainWorld(exposeAs, api);
75
+ return api;
76
+ }
77
+ __name(exposeNoxusBridge, "exposeNoxusBridge");
78
+ // Annotate the CommonJS export names for ESM import in node:
79
+ 0 && (module.exports = {
80
+ exposeNoxusBridge
81
+ });
82
+ /**
83
+ * @copyright 2025 NoxFly
84
+ * @license MIT
85
+ * @author NoxFly
86
+ */
87
+ /**
88
+ * @copyright 2025 NoxFly
89
+ * @license MIT
90
+ * @author NoxFly
91
+ *
92
+ * Entry point for Electron preload scripts.
93
+ * Imports electron/renderer — must NOT be bundled into renderer web code.
94
+ */
95
+ //# sourceMappingURL=preload.js.map
@@ -0,0 +1,70 @@
1
+ /**
2
+ * @copyright 2025 NoxFly
3
+ * @license MIT
4
+ * @author NoxFly
5
+ */
6
+ var __defProp = Object.defineProperty;
7
+ var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
+
9
+ // src/internal/preload-bridge.ts
10
+ import { contextBridge, ipcRenderer } from "electron/renderer";
11
+ var DEFAULT_EXPOSE_NAME = "noxus";
12
+ var DEFAULT_INIT_EVENT = "init-port";
13
+ var DEFAULT_REQUEST_CHANNEL = "gimme-my-port";
14
+ var DEFAULT_RESPONSE_CHANNEL = "port";
15
+ function exposeNoxusBridge(options = {}) {
16
+ const {
17
+ exposeAs = DEFAULT_EXPOSE_NAME,
18
+ initMessageType = DEFAULT_INIT_EVENT,
19
+ requestChannel = DEFAULT_REQUEST_CHANNEL,
20
+ responseChannel = DEFAULT_RESPONSE_CHANNEL,
21
+ targetWindow = window
22
+ } = options;
23
+ const api = {
24
+ requestPort: /* @__PURE__ */ __name(() => {
25
+ ipcRenderer.send(requestChannel);
26
+ ipcRenderer.once(responseChannel, (event, message) => {
27
+ const ports = (event.ports ?? []).filter((port) => port !== void 0);
28
+ if (ports.length === 0) {
29
+ console.error("[Noxus] No MessagePort received from main process.");
30
+ return;
31
+ }
32
+ for (const port of ports) {
33
+ try {
34
+ port.start();
35
+ } catch (error) {
36
+ console.error("[Noxus] Failed to start MessagePort.", error);
37
+ }
38
+ }
39
+ targetWindow.postMessage(
40
+ {
41
+ type: initMessageType,
42
+ senderId: message?.senderId
43
+ },
44
+ "*",
45
+ ports
46
+ );
47
+ });
48
+ }, "requestPort")
49
+ };
50
+ contextBridge.exposeInMainWorld(exposeAs, api);
51
+ return api;
52
+ }
53
+ __name(exposeNoxusBridge, "exposeNoxusBridge");
54
+ export {
55
+ exposeNoxusBridge
56
+ };
57
+ /**
58
+ * @copyright 2025 NoxFly
59
+ * @license MIT
60
+ * @author NoxFly
61
+ */
62
+ /**
63
+ * @copyright 2025 NoxFly
64
+ * @license MIT
65
+ * @author NoxFly
66
+ *
67
+ * Entry point for Electron preload scripts.
68
+ * Imports electron/renderer — must NOT be bundled into renderer web code.
69
+ */
70
+ //# sourceMappingURL=preload.mjs.map
@@ -1,12 +1,166 @@
1
- import { I as IRendererEventMessage, a as IResponse, b as IRequest, c as IBatchRequestItem, d as IBatchResponsePayload } from './request-Dx_5Prte.mjs';
2
- export { A as AtomicHttpMethod, H as HttpMethod, e as IBatchRequestPayload, f as RENDERER_EVENT_TYPE, R as Request, g as createRendererEventMessage, i as isRendererEventMessage } from './request-Dx_5Prte.mjs';
3
- import './app-injector-B3MvgV3k.mjs';
4
-
5
1
  /**
6
2
  * @copyright 2025 NoxFly
7
3
  * @license MIT
8
4
  * @author NoxFly
9
5
  */
6
+ interface Type<T> extends Function {
7
+ new (...args: any[]): T;
8
+ }
9
+
10
+
11
+ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'BATCH';
12
+ type AtomicHttpMethod = Exclude<HttpMethod, 'BATCH'>;
13
+
14
+
15
+ /**
16
+ * A function that returns a type.
17
+ * Used for forward references to types that are not yet defined.
18
+ */
19
+ interface ForwardRefFn<T = any> {
20
+ (): Type<T>;
21
+ }
22
+ /**
23
+ * A wrapper class for forward referenced types.
24
+ */
25
+ declare class ForwardReference<T = any> {
26
+ readonly forwardRefFn: ForwardRefFn<T>;
27
+ constructor(forwardRefFn: ForwardRefFn<T>);
28
+ }
29
+
30
+
31
+ /**
32
+ * A DI token uniquely identifies a dependency.
33
+ * It can wrap a class (Type<T>) or be a named symbol token.
34
+ *
35
+ * Using tokens instead of reflect-metadata means dependencies are
36
+ * declared explicitly — no magic type inference, no emitDecoratorMetadata.
37
+ *
38
+ * @example
39
+ * // Class token (most common)
40
+ * const MY_SERVICE = token(MyService);
41
+ *
42
+ * // Named symbol token (for interfaces or non-class values)
43
+ * const DB_URL = token<string>('DB_URL');
44
+ */
45
+ declare class Token<T> {
46
+ readonly target: Type<T> | string;
47
+ readonly description: string;
48
+ constructor(target: Type<T> | string);
49
+ toString(): string;
50
+ }
51
+ /**
52
+ * The key used to look up a class token in the registry.
53
+ * For class tokens, the key is the class constructor itself.
54
+ * For named tokens, the key is the Token instance.
55
+ */
56
+ type TokenKey<T = unknown> = Type<T> | Token<T>;
57
+
58
+
59
+ /**
60
+ * Lifetime of a binding in the DI container.
61
+ * - singleton: created once, shared for the lifetime of the app.
62
+ * - scope: created once per request scope.
63
+ * - transient: new instance every time it is resolved.
64
+ */
65
+ type Lifetime = 'singleton' | 'scope' | 'transient';
66
+ /**
67
+ * Internal representation of a registered binding.
68
+ */
69
+ interface IBinding<T = unknown> {
70
+ lifetime: Lifetime;
71
+ implementation: Type<T>;
72
+ /** Explicit constructor dependencies, declared by the class itself. */
73
+ deps: ReadonlyArray<TokenKey>;
74
+ instance?: T;
75
+ }
76
+ /**
77
+ * AppInjector is the core DI container.
78
+ * It no longer uses reflect-metadata — all dependency information
79
+ * comes from explicitly declared `deps` arrays on each binding.
80
+ */
81
+ declare class AppInjector {
82
+ readonly name: string | null;
83
+ readonly bindings: Map<Type<unknown> | Token<unknown>, IBinding<unknown>>;
84
+ readonly singletons: Map<Type<unknown> | Token<unknown>, unknown>;
85
+ readonly scoped: Map<Type<unknown> | Token<unknown>, unknown>;
86
+ constructor(name?: string | null);
87
+ /**
88
+ * Creates a child scope for per-request lifetime resolution.
89
+ */
90
+ createScope(): AppInjector;
91
+ /**
92
+ * Registers a binding explicitly.
93
+ */
94
+ register<T>(key: TokenKey<T>, implementation: Type<T>, lifetime: Lifetime, deps?: ReadonlyArray<TokenKey>): void;
95
+ /**
96
+ * Resolves a dependency by token or class reference.
97
+ */
98
+ resolve<T>(target: TokenKey<T> | ForwardReference<T>): T;
99
+ private _resolveForwardRef;
100
+ private _instantiate;
101
+ }
102
+
103
+
104
+ /**
105
+ * The Request class represents an HTTP request in the Noxus framework.
106
+ * It encapsulates the request data, including the event, ID, method, path, and body.
107
+ * It also provides a context for dependency injection through the AppInjector.
108
+ */
109
+ declare class Request {
110
+ readonly event: Electron.MessageEvent;
111
+ readonly senderId: number;
112
+ readonly id: string;
113
+ readonly method: HttpMethod;
114
+ readonly path: string;
115
+ readonly body: any;
116
+ readonly context: AppInjector;
117
+ readonly params: Record<string, string>;
118
+ constructor(event: Electron.MessageEvent, senderId: number, id: string, method: HttpMethod, path: string, body: any);
119
+ }
120
+ /**
121
+ * The IRequest interface defines the structure of a request object.
122
+ * It includes properties for the sender ID, request ID, path, method, and an optional body.
123
+ * This interface is used to standardize the request data across the application.
124
+ */
125
+ interface IRequest<TBody = unknown> {
126
+ senderId: number;
127
+ requestId: string;
128
+ path: string;
129
+ method: HttpMethod;
130
+ body?: TBody;
131
+ }
132
+ interface IBatchRequestItem<TBody = unknown> {
133
+ requestId?: string;
134
+ path: string;
135
+ method: AtomicHttpMethod;
136
+ body?: TBody;
137
+ }
138
+ interface IBatchRequestPayload {
139
+ requests: IBatchRequestItem[];
140
+ }
141
+ /**
142
+ * Creates a Request object from the IPC event data.
143
+ * This function extracts the necessary information from the IPC event and constructs a Request instance.
144
+ */
145
+ interface IResponse<TBody = unknown> {
146
+ requestId: string;
147
+ status: number;
148
+ body?: TBody;
149
+ error?: string;
150
+ stack?: string;
151
+ }
152
+ interface IBatchResponsePayload {
153
+ responses: IResponse[];
154
+ }
155
+ declare const RENDERER_EVENT_TYPE = "noxus:event";
156
+ interface IRendererEventMessage<TPayload = unknown> {
157
+ type: typeof RENDERER_EVENT_TYPE;
158
+ event: string;
159
+ payload?: TPayload;
160
+ }
161
+ declare function createRendererEventMessage<TPayload = unknown>(event: string, payload?: TPayload): IRendererEventMessage<TPayload>;
162
+ declare function isRendererEventMessage(value: unknown): value is IRendererEventMessage;
163
+
10
164
  /**
11
165
  * Lightweight event registry to help renderer processes subscribe to
12
166
  * push messages sent by the main process through Noxus.
@@ -93,21 +247,4 @@ declare class NoxRendererClient {
93
247
  isElectronEnvironment(): boolean;
94
248
  }
95
249
 
96
-
97
- interface NoxusPreloadAPI extends IPortRequester {
98
- }
99
- interface NoxusPreloadOptions {
100
- exposeAs?: string;
101
- initMessageType?: string;
102
- requestChannel?: string;
103
- responseChannel?: string;
104
- targetWindow?: Window;
105
- }
106
- /**
107
- * Exposes a minimal bridge in the isolated preload context so renderer processes
108
- * can request the two MessagePorts required by Noxus. The bridge forwards both
109
- * request/response and socket ports to the renderer via window.postMessage.
110
- */
111
- declare function exposeNoxusBridge(options?: NoxusPreloadOptions): NoxusPreloadAPI;
112
-
113
- export { IBatchRequestItem, IBatchResponsePayload, type IPortRequester, IRendererEventMessage, IRequest, IResponse, NoxRendererClient, type NoxusPreloadAPI, type NoxusPreloadOptions, type RendererClientOptions, type RendererEventHandler, RendererEventRegistry, type RendererEventSubscription, exposeNoxusBridge };
250
+ export { type AtomicHttpMethod, type HttpMethod, type IBatchRequestItem, type IBatchRequestPayload, type IBatchResponsePayload, type IPortRequester, type IRendererEventMessage, type IRequest, type IResponse, NoxRendererClient, RENDERER_EVENT_TYPE, type RendererClientOptions, type RendererEventHandler, RendererEventRegistry, type RendererEventSubscription, Request, createRendererEventMessage, isRendererEventMessage };
@@ -1,12 +1,166 @@
1
- import { I as IRendererEventMessage, a as IResponse, b as IRequest, c as IBatchRequestItem, d as IBatchResponsePayload } from './request-CdpZ9qZL.js';
2
- export { A as AtomicHttpMethod, H as HttpMethod, e as IBatchRequestPayload, f as RENDERER_EVENT_TYPE, R as Request, g as createRendererEventMessage, i as isRendererEventMessage } from './request-CdpZ9qZL.js';
3
- import './app-injector-B3MvgV3k.js';
4
-
5
1
  /**
6
2
  * @copyright 2025 NoxFly
7
3
  * @license MIT
8
4
  * @author NoxFly
9
5
  */
6
+ interface Type<T> extends Function {
7
+ new (...args: any[]): T;
8
+ }
9
+
10
+
11
+ type HttpMethod = 'GET' | 'POST' | 'PUT' | 'PATCH' | 'DELETE' | 'BATCH';
12
+ type AtomicHttpMethod = Exclude<HttpMethod, 'BATCH'>;
13
+
14
+
15
+ /**
16
+ * A function that returns a type.
17
+ * Used for forward references to types that are not yet defined.
18
+ */
19
+ interface ForwardRefFn<T = any> {
20
+ (): Type<T>;
21
+ }
22
+ /**
23
+ * A wrapper class for forward referenced types.
24
+ */
25
+ declare class ForwardReference<T = any> {
26
+ readonly forwardRefFn: ForwardRefFn<T>;
27
+ constructor(forwardRefFn: ForwardRefFn<T>);
28
+ }
29
+
30
+
31
+ /**
32
+ * A DI token uniquely identifies a dependency.
33
+ * It can wrap a class (Type<T>) or be a named symbol token.
34
+ *
35
+ * Using tokens instead of reflect-metadata means dependencies are
36
+ * declared explicitly — no magic type inference, no emitDecoratorMetadata.
37
+ *
38
+ * @example
39
+ * // Class token (most common)
40
+ * const MY_SERVICE = token(MyService);
41
+ *
42
+ * // Named symbol token (for interfaces or non-class values)
43
+ * const DB_URL = token<string>('DB_URL');
44
+ */
45
+ declare class Token<T> {
46
+ readonly target: Type<T> | string;
47
+ readonly description: string;
48
+ constructor(target: Type<T> | string);
49
+ toString(): string;
50
+ }
51
+ /**
52
+ * The key used to look up a class token in the registry.
53
+ * For class tokens, the key is the class constructor itself.
54
+ * For named tokens, the key is the Token instance.
55
+ */
56
+ type TokenKey<T = unknown> = Type<T> | Token<T>;
57
+
58
+
59
+ /**
60
+ * Lifetime of a binding in the DI container.
61
+ * - singleton: created once, shared for the lifetime of the app.
62
+ * - scope: created once per request scope.
63
+ * - transient: new instance every time it is resolved.
64
+ */
65
+ type Lifetime = 'singleton' | 'scope' | 'transient';
66
+ /**
67
+ * Internal representation of a registered binding.
68
+ */
69
+ interface IBinding<T = unknown> {
70
+ lifetime: Lifetime;
71
+ implementation: Type<T>;
72
+ /** Explicit constructor dependencies, declared by the class itself. */
73
+ deps: ReadonlyArray<TokenKey>;
74
+ instance?: T;
75
+ }
76
+ /**
77
+ * AppInjector is the core DI container.
78
+ * It no longer uses reflect-metadata — all dependency information
79
+ * comes from explicitly declared `deps` arrays on each binding.
80
+ */
81
+ declare class AppInjector {
82
+ readonly name: string | null;
83
+ readonly bindings: Map<Type<unknown> | Token<unknown>, IBinding<unknown>>;
84
+ readonly singletons: Map<Type<unknown> | Token<unknown>, unknown>;
85
+ readonly scoped: Map<Type<unknown> | Token<unknown>, unknown>;
86
+ constructor(name?: string | null);
87
+ /**
88
+ * Creates a child scope for per-request lifetime resolution.
89
+ */
90
+ createScope(): AppInjector;
91
+ /**
92
+ * Registers a binding explicitly.
93
+ */
94
+ register<T>(key: TokenKey<T>, implementation: Type<T>, lifetime: Lifetime, deps?: ReadonlyArray<TokenKey>): void;
95
+ /**
96
+ * Resolves a dependency by token or class reference.
97
+ */
98
+ resolve<T>(target: TokenKey<T> | ForwardReference<T>): T;
99
+ private _resolveForwardRef;
100
+ private _instantiate;
101
+ }
102
+
103
+
104
+ /**
105
+ * The Request class represents an HTTP request in the Noxus framework.
106
+ * It encapsulates the request data, including the event, ID, method, path, and body.
107
+ * It also provides a context for dependency injection through the AppInjector.
108
+ */
109
+ declare class Request {
110
+ readonly event: Electron.MessageEvent;
111
+ readonly senderId: number;
112
+ readonly id: string;
113
+ readonly method: HttpMethod;
114
+ readonly path: string;
115
+ readonly body: any;
116
+ readonly context: AppInjector;
117
+ readonly params: Record<string, string>;
118
+ constructor(event: Electron.MessageEvent, senderId: number, id: string, method: HttpMethod, path: string, body: any);
119
+ }
120
+ /**
121
+ * The IRequest interface defines the structure of a request object.
122
+ * It includes properties for the sender ID, request ID, path, method, and an optional body.
123
+ * This interface is used to standardize the request data across the application.
124
+ */
125
+ interface IRequest<TBody = unknown> {
126
+ senderId: number;
127
+ requestId: string;
128
+ path: string;
129
+ method: HttpMethod;
130
+ body?: TBody;
131
+ }
132
+ interface IBatchRequestItem<TBody = unknown> {
133
+ requestId?: string;
134
+ path: string;
135
+ method: AtomicHttpMethod;
136
+ body?: TBody;
137
+ }
138
+ interface IBatchRequestPayload {
139
+ requests: IBatchRequestItem[];
140
+ }
141
+ /**
142
+ * Creates a Request object from the IPC event data.
143
+ * This function extracts the necessary information from the IPC event and constructs a Request instance.
144
+ */
145
+ interface IResponse<TBody = unknown> {
146
+ requestId: string;
147
+ status: number;
148
+ body?: TBody;
149
+ error?: string;
150
+ stack?: string;
151
+ }
152
+ interface IBatchResponsePayload {
153
+ responses: IResponse[];
154
+ }
155
+ declare const RENDERER_EVENT_TYPE = "noxus:event";
156
+ interface IRendererEventMessage<TPayload = unknown> {
157
+ type: typeof RENDERER_EVENT_TYPE;
158
+ event: string;
159
+ payload?: TPayload;
160
+ }
161
+ declare function createRendererEventMessage<TPayload = unknown>(event: string, payload?: TPayload): IRendererEventMessage<TPayload>;
162
+ declare function isRendererEventMessage(value: unknown): value is IRendererEventMessage;
163
+
10
164
  /**
11
165
  * Lightweight event registry to help renderer processes subscribe to
12
166
  * push messages sent by the main process through Noxus.
@@ -93,21 +247,4 @@ declare class NoxRendererClient {
93
247
  isElectronEnvironment(): boolean;
94
248
  }
95
249
 
96
-
97
- interface NoxusPreloadAPI extends IPortRequester {
98
- }
99
- interface NoxusPreloadOptions {
100
- exposeAs?: string;
101
- initMessageType?: string;
102
- requestChannel?: string;
103
- responseChannel?: string;
104
- targetWindow?: Window;
105
- }
106
- /**
107
- * Exposes a minimal bridge in the isolated preload context so renderer processes
108
- * can request the two MessagePorts required by Noxus. The bridge forwards both
109
- * request/response and socket ports to the renderer via window.postMessage.
110
- */
111
- declare function exposeNoxusBridge(options?: NoxusPreloadOptions): NoxusPreloadAPI;
112
-
113
- export { IBatchRequestItem, IBatchResponsePayload, type IPortRequester, IRendererEventMessage, IRequest, IResponse, NoxRendererClient, type NoxusPreloadAPI, type NoxusPreloadOptions, type RendererClientOptions, type RendererEventHandler, RendererEventRegistry, type RendererEventSubscription, exposeNoxusBridge };
250
+ export { type AtomicHttpMethod, type HttpMethod, type IBatchRequestItem, type IBatchRequestPayload, type IBatchResponsePayload, type IPortRequester, type IRendererEventMessage, type IRequest, type IResponse, NoxRendererClient, RENDERER_EVENT_TYPE, type RendererClientOptions, type RendererEventHandler, RendererEventRegistry, type RendererEventSubscription, Request, createRendererEventMessage, isRendererEventMessage };