@noxfly/noxus 3.0.0-dev.0 → 3.0.0-dev.2
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/README.md +14 -11
- package/dist/child.d.mts +112 -4
- package/dist/child.d.ts +112 -4
- package/dist/child.js +33 -30
- package/dist/child.mjs +33 -30
- package/dist/main.d.mts +450 -6
- package/dist/main.d.ts +450 -6
- package/dist/main.js +232 -229
- package/dist/main.mjs +234 -231
- package/dist/preload.d.mts +28 -0
- package/dist/preload.d.ts +28 -0
- package/dist/preload.js +95 -0
- package/dist/preload.mjs +70 -0
- package/dist/renderer.d.mts +159 -22
- package/dist/renderer.d.ts +159 -22
- package/dist/renderer.js +14 -58
- package/dist/renderer.mjs +10 -53
- package/package.json +26 -13
- package/src/DI/app-injector.ts +10 -1
- package/src/DI/injector-explorer.ts +2 -2
- package/src/decorators/guards.decorator.ts +1 -1
- package/src/decorators/middleware.decorator.ts +1 -1
- package/src/index.ts +2 -5
- package/src/{app.ts → internal/app.ts} +8 -8
- package/src/{bootstrap.ts → internal/bootstrap.ts} +5 -4
- package/src/{request.ts → internal/request.ts} +2 -2
- package/src/{router.ts → internal/router.ts} +9 -9
- package/src/{routes.ts → internal/routes.ts} +2 -2
- package/src/{socket.ts → internal/socket.ts} +2 -2
- package/src/main.ts +7 -7
- package/src/non-electron-process.ts +1 -1
- package/src/preload.ts +10 -0
- package/src/renderer.ts +13 -0
- package/tsup.config.ts +27 -11
- /package/src/{exceptions.ts → internal/exceptions.ts} +0 -0
- /package/src/{preload-bridge.ts → internal/preload-bridge.ts} +0 -0
- /package/src/{renderer-client.ts → internal/renderer-client.ts} +0 -0
- /package/src/{renderer-events.ts → internal/renderer-events.ts} +0 -0
package/README.md
CHANGED
|
@@ -451,26 +451,26 @@ class UserRepository {
|
|
|
451
451
|
|
|
452
452
|
```ts
|
|
453
453
|
// preload.ts
|
|
454
|
-
import {
|
|
454
|
+
import { exposeNoxusBridge } from '@noxfly/noxus/renderer';
|
|
455
455
|
|
|
456
|
-
|
|
456
|
+
exposeNoxusBridge(); // exposes window.__noxus__ to the renderer
|
|
457
457
|
```
|
|
458
458
|
|
|
459
459
|
### IPC client
|
|
460
460
|
|
|
461
461
|
```ts
|
|
462
462
|
// In the renderer (Angular, React, Vue, Vanilla...)
|
|
463
|
-
import {
|
|
463
|
+
import { NoxRendererClient } from '@noxfly/noxus';
|
|
464
464
|
|
|
465
|
-
const client = new
|
|
466
|
-
await client.
|
|
465
|
+
const client = new NoxRendererClient();
|
|
466
|
+
await client.setup(); // requests the MessagePort from main
|
|
467
467
|
|
|
468
468
|
// Requests
|
|
469
|
-
const users
|
|
470
|
-
const user
|
|
471
|
-
await client.
|
|
472
|
-
await client.
|
|
473
|
-
await client.
|
|
469
|
+
const users = await client.request<User[]>({ method: 'GET', path: 'users/list' });
|
|
470
|
+
const user = await client.request<User> ({ method: 'GET', path: 'users/42' });
|
|
471
|
+
await client.request({ method: 'POST', path: 'users/create', body: { name: 'Bob' } });
|
|
472
|
+
await client.request({ method: 'PUT', path: 'users/42', body: { name: 'Bob Updated' } });
|
|
473
|
+
await client.request({ method: 'DELETE', path: 'users/42' });
|
|
474
474
|
```
|
|
475
475
|
|
|
476
476
|
### Push events (main → renderer)
|
|
@@ -495,9 +495,12 @@ class NotificationService {
|
|
|
495
495
|
On the renderer side:
|
|
496
496
|
|
|
497
497
|
```ts
|
|
498
|
-
client.
|
|
498
|
+
const sub = client.events.subscribe<INotification>('notification', (payload) => {
|
|
499
499
|
console.log(payload.message);
|
|
500
500
|
});
|
|
501
|
+
|
|
502
|
+
// Unsubscribe when done
|
|
503
|
+
sub.unsubscribe();
|
|
501
504
|
```
|
|
502
505
|
|
|
503
506
|
---
|
package/dist/child.d.mts
CHANGED
|
@@ -1,11 +1,119 @@
|
|
|
1
|
-
import { L as Lifetime, a as TokenKey } from './app-injector-Bz3Upc0y.mjs';
|
|
2
|
-
export { A as AppInjector, F as ForwardRefFn, b as ForwardReference, I as IBinding, M as MaybeAsync, R as RootInjector, c as Token, T as Type, f as forwardRef, i as inject } from './app-injector-Bz3Upc0y.mjs';
|
|
3
|
-
|
|
4
1
|
/**
|
|
5
2
|
* @copyright 2025 NoxFly
|
|
6
3
|
* @license MIT
|
|
7
4
|
* @author NoxFly
|
|
8
5
|
*/
|
|
6
|
+
interface Type<T> extends Function {
|
|
7
|
+
new (...args: any[]): T;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Represents a generic type that can be either a value or a promise resolving to that value.
|
|
11
|
+
*/
|
|
12
|
+
type MaybeAsync<T> = T | Promise<T>;
|
|
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
|
+
* Creates a forward reference to a type.
|
|
31
|
+
* @param fn A function that returns the type.
|
|
32
|
+
* @returns A ForwardReference instance.
|
|
33
|
+
*/
|
|
34
|
+
declare function forwardRef<T = any>(fn: ForwardRefFn<T>): ForwardReference<T>;
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A DI token uniquely identifies a dependency.
|
|
39
|
+
* It can wrap a class (Type<T>) or be a named symbol token.
|
|
40
|
+
*
|
|
41
|
+
* Using tokens instead of reflect-metadata means dependencies are
|
|
42
|
+
* declared explicitly — no magic type inference, no emitDecoratorMetadata.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* // Class token (most common)
|
|
46
|
+
* const MY_SERVICE = token(MyService);
|
|
47
|
+
*
|
|
48
|
+
* // Named symbol token (for interfaces or non-class values)
|
|
49
|
+
* const DB_URL = token<string>('DB_URL');
|
|
50
|
+
*/
|
|
51
|
+
declare class Token<T> {
|
|
52
|
+
readonly target: Type<T> | string;
|
|
53
|
+
readonly description: string;
|
|
54
|
+
constructor(target: Type<T> | string);
|
|
55
|
+
toString(): string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The key used to look up a class token in the registry.
|
|
59
|
+
* For class tokens, the key is the class constructor itself.
|
|
60
|
+
* For named tokens, the key is the Token instance.
|
|
61
|
+
*/
|
|
62
|
+
type TokenKey<T = unknown> = Type<T> | Token<T>;
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Lifetime of a binding in the DI container.
|
|
67
|
+
* - singleton: created once, shared for the lifetime of the app.
|
|
68
|
+
* - scope: created once per request scope.
|
|
69
|
+
* - transient: new instance every time it is resolved.
|
|
70
|
+
*/
|
|
71
|
+
type Lifetime = 'singleton' | 'scope' | 'transient';
|
|
72
|
+
/**
|
|
73
|
+
* Internal representation of a registered binding.
|
|
74
|
+
*/
|
|
75
|
+
interface IBinding<T = unknown> {
|
|
76
|
+
lifetime: Lifetime;
|
|
77
|
+
implementation: Type<T>;
|
|
78
|
+
/** Explicit constructor dependencies, declared by the class itself. */
|
|
79
|
+
deps: ReadonlyArray<TokenKey>;
|
|
80
|
+
instance?: T;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* AppInjector is the core DI container.
|
|
84
|
+
* It no longer uses reflect-metadata — all dependency information
|
|
85
|
+
* comes from explicitly declared `deps` arrays on each binding.
|
|
86
|
+
*/
|
|
87
|
+
declare class AppInjector {
|
|
88
|
+
readonly name: string | null;
|
|
89
|
+
readonly bindings: Map<Type<unknown> | Token<unknown>, IBinding<unknown>>;
|
|
90
|
+
readonly singletons: Map<Type<unknown> | Token<unknown>, unknown>;
|
|
91
|
+
readonly scoped: Map<Type<unknown> | Token<unknown>, unknown>;
|
|
92
|
+
constructor(name?: string | null);
|
|
93
|
+
/**
|
|
94
|
+
* Creates a child scope for per-request lifetime resolution.
|
|
95
|
+
*/
|
|
96
|
+
createScope(): AppInjector;
|
|
97
|
+
/**
|
|
98
|
+
* Registers a binding explicitly.
|
|
99
|
+
*/
|
|
100
|
+
register<T>(key: TokenKey<T>, implementation: Type<T>, lifetime: Lifetime, deps?: ReadonlyArray<TokenKey>): void;
|
|
101
|
+
/**
|
|
102
|
+
* Resolves a dependency by token or class reference.
|
|
103
|
+
*/
|
|
104
|
+
resolve<T>(target: TokenKey<T> | ForwardReference<T>): T;
|
|
105
|
+
private _resolveForwardRef;
|
|
106
|
+
private _instantiate;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The global root injector. All singletons live here.
|
|
110
|
+
*/
|
|
111
|
+
declare const RootInjector: AppInjector;
|
|
112
|
+
/**
|
|
113
|
+
* Convenience function: resolve a token from the root injector.
|
|
114
|
+
*/
|
|
115
|
+
declare function inject<T>(t: TokenKey<T> | ForwardReference<T>): T;
|
|
116
|
+
|
|
9
117
|
declare class ResponseException extends Error {
|
|
10
118
|
readonly status: number;
|
|
11
119
|
constructor(message?: string);
|
|
@@ -232,4 +340,4 @@ declare namespace Logger {
|
|
|
232
340
|
};
|
|
233
341
|
}
|
|
234
342
|
|
|
235
|
-
export { BadGatewayException, BadRequestException, ConflictException, ForbiddenException, GatewayTimeoutException, HttpVersionNotSupportedException, Injectable, type InjectableOptions, InsufficientStorageException, InternalServerException, Lifetime, type LogLevel, Logger, LoopDetectedException, MethodNotAllowedException, NetworkAuthenticationRequiredException, NetworkConnectTimeoutException, NotAcceptableException, NotExtendedException, NotFoundException, NotImplementedException, PaymentRequiredException, RequestTimeoutException, ResponseException, ServiceUnavailableException, TokenKey, TooManyRequestsException, UnauthorizedException, UpgradeRequiredException, VariantAlsoNegotiatesException };
|
|
343
|
+
export { AppInjector, BadGatewayException, BadRequestException, ConflictException, ForbiddenException, type ForwardRefFn, ForwardReference, GatewayTimeoutException, HttpVersionNotSupportedException, type IBinding, Injectable, type InjectableOptions, InsufficientStorageException, InternalServerException, type Lifetime, type LogLevel, Logger, LoopDetectedException, type MaybeAsync, MethodNotAllowedException, NetworkAuthenticationRequiredException, NetworkConnectTimeoutException, NotAcceptableException, NotExtendedException, NotFoundException, NotImplementedException, PaymentRequiredException, RequestTimeoutException, ResponseException, RootInjector, ServiceUnavailableException, Token, type TokenKey, TooManyRequestsException, type Type, UnauthorizedException, UpgradeRequiredException, VariantAlsoNegotiatesException, forwardRef, inject };
|
package/dist/child.d.ts
CHANGED
|
@@ -1,11 +1,119 @@
|
|
|
1
|
-
import { L as Lifetime, a as TokenKey } from './app-injector-Bz3Upc0y.js';
|
|
2
|
-
export { A as AppInjector, F as ForwardRefFn, b as ForwardReference, I as IBinding, M as MaybeAsync, R as RootInjector, c as Token, T as Type, f as forwardRef, i as inject } from './app-injector-Bz3Upc0y.js';
|
|
3
|
-
|
|
4
1
|
/**
|
|
5
2
|
* @copyright 2025 NoxFly
|
|
6
3
|
* @license MIT
|
|
7
4
|
* @author NoxFly
|
|
8
5
|
*/
|
|
6
|
+
interface Type<T> extends Function {
|
|
7
|
+
new (...args: any[]): T;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Represents a generic type that can be either a value or a promise resolving to that value.
|
|
11
|
+
*/
|
|
12
|
+
type MaybeAsync<T> = T | Promise<T>;
|
|
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
|
+
* Creates a forward reference to a type.
|
|
31
|
+
* @param fn A function that returns the type.
|
|
32
|
+
* @returns A ForwardReference instance.
|
|
33
|
+
*/
|
|
34
|
+
declare function forwardRef<T = any>(fn: ForwardRefFn<T>): ForwardReference<T>;
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* A DI token uniquely identifies a dependency.
|
|
39
|
+
* It can wrap a class (Type<T>) or be a named symbol token.
|
|
40
|
+
*
|
|
41
|
+
* Using tokens instead of reflect-metadata means dependencies are
|
|
42
|
+
* declared explicitly — no magic type inference, no emitDecoratorMetadata.
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* // Class token (most common)
|
|
46
|
+
* const MY_SERVICE = token(MyService);
|
|
47
|
+
*
|
|
48
|
+
* // Named symbol token (for interfaces or non-class values)
|
|
49
|
+
* const DB_URL = token<string>('DB_URL');
|
|
50
|
+
*/
|
|
51
|
+
declare class Token<T> {
|
|
52
|
+
readonly target: Type<T> | string;
|
|
53
|
+
readonly description: string;
|
|
54
|
+
constructor(target: Type<T> | string);
|
|
55
|
+
toString(): string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* The key used to look up a class token in the registry.
|
|
59
|
+
* For class tokens, the key is the class constructor itself.
|
|
60
|
+
* For named tokens, the key is the Token instance.
|
|
61
|
+
*/
|
|
62
|
+
type TokenKey<T = unknown> = Type<T> | Token<T>;
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Lifetime of a binding in the DI container.
|
|
67
|
+
* - singleton: created once, shared for the lifetime of the app.
|
|
68
|
+
* - scope: created once per request scope.
|
|
69
|
+
* - transient: new instance every time it is resolved.
|
|
70
|
+
*/
|
|
71
|
+
type Lifetime = 'singleton' | 'scope' | 'transient';
|
|
72
|
+
/**
|
|
73
|
+
* Internal representation of a registered binding.
|
|
74
|
+
*/
|
|
75
|
+
interface IBinding<T = unknown> {
|
|
76
|
+
lifetime: Lifetime;
|
|
77
|
+
implementation: Type<T>;
|
|
78
|
+
/** Explicit constructor dependencies, declared by the class itself. */
|
|
79
|
+
deps: ReadonlyArray<TokenKey>;
|
|
80
|
+
instance?: T;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* AppInjector is the core DI container.
|
|
84
|
+
* It no longer uses reflect-metadata — all dependency information
|
|
85
|
+
* comes from explicitly declared `deps` arrays on each binding.
|
|
86
|
+
*/
|
|
87
|
+
declare class AppInjector {
|
|
88
|
+
readonly name: string | null;
|
|
89
|
+
readonly bindings: Map<Type<unknown> | Token<unknown>, IBinding<unknown>>;
|
|
90
|
+
readonly singletons: Map<Type<unknown> | Token<unknown>, unknown>;
|
|
91
|
+
readonly scoped: Map<Type<unknown> | Token<unknown>, unknown>;
|
|
92
|
+
constructor(name?: string | null);
|
|
93
|
+
/**
|
|
94
|
+
* Creates a child scope for per-request lifetime resolution.
|
|
95
|
+
*/
|
|
96
|
+
createScope(): AppInjector;
|
|
97
|
+
/**
|
|
98
|
+
* Registers a binding explicitly.
|
|
99
|
+
*/
|
|
100
|
+
register<T>(key: TokenKey<T>, implementation: Type<T>, lifetime: Lifetime, deps?: ReadonlyArray<TokenKey>): void;
|
|
101
|
+
/**
|
|
102
|
+
* Resolves a dependency by token or class reference.
|
|
103
|
+
*/
|
|
104
|
+
resolve<T>(target: TokenKey<T> | ForwardReference<T>): T;
|
|
105
|
+
private _resolveForwardRef;
|
|
106
|
+
private _instantiate;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* The global root injector. All singletons live here.
|
|
110
|
+
*/
|
|
111
|
+
declare const RootInjector: AppInjector;
|
|
112
|
+
/**
|
|
113
|
+
* Convenience function: resolve a token from the root injector.
|
|
114
|
+
*/
|
|
115
|
+
declare function inject<T>(t: TokenKey<T> | ForwardReference<T>): T;
|
|
116
|
+
|
|
9
117
|
declare class ResponseException extends Error {
|
|
10
118
|
readonly status: number;
|
|
11
119
|
constructor(message?: string);
|
|
@@ -232,4 +340,4 @@ declare namespace Logger {
|
|
|
232
340
|
};
|
|
233
341
|
}
|
|
234
342
|
|
|
235
|
-
export { BadGatewayException, BadRequestException, ConflictException, ForbiddenException, GatewayTimeoutException, HttpVersionNotSupportedException, Injectable, type InjectableOptions, InsufficientStorageException, InternalServerException, Lifetime, type LogLevel, Logger, LoopDetectedException, MethodNotAllowedException, NetworkAuthenticationRequiredException, NetworkConnectTimeoutException, NotAcceptableException, NotExtendedException, NotFoundException, NotImplementedException, PaymentRequiredException, RequestTimeoutException, ResponseException, ServiceUnavailableException, TokenKey, TooManyRequestsException, UnauthorizedException, UpgradeRequiredException, VariantAlsoNegotiatesException };
|
|
343
|
+
export { AppInjector, BadGatewayException, BadRequestException, ConflictException, ForbiddenException, type ForwardRefFn, ForwardReference, GatewayTimeoutException, HttpVersionNotSupportedException, type IBinding, Injectable, type InjectableOptions, InsufficientStorageException, InternalServerException, type Lifetime, type LogLevel, Logger, LoopDetectedException, type MaybeAsync, MethodNotAllowedException, NetworkAuthenticationRequiredException, NetworkConnectTimeoutException, NotAcceptableException, NotExtendedException, NotFoundException, NotImplementedException, PaymentRequiredException, RequestTimeoutException, ResponseException, RootInjector, ServiceUnavailableException, Token, type TokenKey, TooManyRequestsException, type Type, UnauthorizedException, UpgradeRequiredException, VariantAlsoNegotiatesException, forwardRef, inject };
|
package/dist/child.js
CHANGED
|
@@ -129,6 +129,9 @@ var init_app_injector = __esm({
|
|
|
129
129
|
return this._resolveForwardRef(target);
|
|
130
130
|
}
|
|
131
131
|
const k = keyOf(target);
|
|
132
|
+
if (this.singletons.has(k)) {
|
|
133
|
+
return this.singletons.get(k);
|
|
134
|
+
}
|
|
132
135
|
const binding = this.bindings.get(k);
|
|
133
136
|
if (!binding) {
|
|
134
137
|
const name = target instanceof Token ? target.description : target.name ?? "unknown";
|
|
@@ -189,10 +192,10 @@ Did you forget to declare it in @Injectable({ deps }) or in bootstrapApplication
|
|
|
189
192
|
}
|
|
190
193
|
});
|
|
191
194
|
|
|
192
|
-
// src/exceptions.ts
|
|
195
|
+
// src/internal/exceptions.ts
|
|
193
196
|
var _ResponseException, ResponseException, _BadRequestException, BadRequestException, _UnauthorizedException, UnauthorizedException, _PaymentRequiredException, PaymentRequiredException, _ForbiddenException, ForbiddenException, _NotFoundException, NotFoundException, _MethodNotAllowedException, MethodNotAllowedException, _NotAcceptableException, NotAcceptableException, _RequestTimeoutException, RequestTimeoutException, _ConflictException, ConflictException, _UpgradeRequiredException, UpgradeRequiredException, _TooManyRequestsException, TooManyRequestsException, _InternalServerException, InternalServerException, _NotImplementedException, NotImplementedException, _BadGatewayException, BadGatewayException, _ServiceUnavailableException, ServiceUnavailableException, _GatewayTimeoutException, GatewayTimeoutException, _HttpVersionNotSupportedException, HttpVersionNotSupportedException, _VariantAlsoNegotiatesException, VariantAlsoNegotiatesException, _InsufficientStorageException, InsufficientStorageException, _LoopDetectedException, LoopDetectedException, _NotExtendedException, NotExtendedException, _NetworkAuthenticationRequiredException, NetworkAuthenticationRequiredException, _NetworkConnectTimeoutException, NetworkConnectTimeoutException;
|
|
194
197
|
var init_exceptions = __esm({
|
|
195
|
-
"src/exceptions.ts"() {
|
|
198
|
+
"src/internal/exceptions.ts"() {
|
|
196
199
|
"use strict";
|
|
197
200
|
_ResponseException = class _ResponseException extends Error {
|
|
198
201
|
constructor(statusOrMessage, message) {
|
|
@@ -700,30 +703,6 @@ var init_method_decorator = __esm({
|
|
|
700
703
|
}
|
|
701
704
|
});
|
|
702
705
|
|
|
703
|
-
// src/request.ts
|
|
704
|
-
var _Request, Request;
|
|
705
|
-
var init_request = __esm({
|
|
706
|
-
"src/request.ts"() {
|
|
707
|
-
"use strict";
|
|
708
|
-
init_app_injector();
|
|
709
|
-
_Request = class _Request {
|
|
710
|
-
constructor(event, senderId, id, method, path2, body) {
|
|
711
|
-
this.event = event;
|
|
712
|
-
this.senderId = senderId;
|
|
713
|
-
this.id = id;
|
|
714
|
-
this.method = method;
|
|
715
|
-
this.path = path2;
|
|
716
|
-
this.body = body;
|
|
717
|
-
this.context = RootInjector.createScope();
|
|
718
|
-
this.params = {};
|
|
719
|
-
this.path = path2.replace(/^\/|\/$/g, "");
|
|
720
|
-
}
|
|
721
|
-
};
|
|
722
|
-
__name(_Request, "Request");
|
|
723
|
-
Request = _Request;
|
|
724
|
-
}
|
|
725
|
-
});
|
|
726
|
-
|
|
727
706
|
// src/utils/radix-tree.ts
|
|
728
707
|
var _RadixNode, RadixNode, _RadixTree, RadixTree;
|
|
729
708
|
var init_radix_tree = __esm({
|
|
@@ -886,23 +865,47 @@ var init_radix_tree = __esm({
|
|
|
886
865
|
}
|
|
887
866
|
});
|
|
888
867
|
|
|
889
|
-
// src/
|
|
868
|
+
// src/internal/request.ts
|
|
869
|
+
var _Request, Request;
|
|
870
|
+
var init_request = __esm({
|
|
871
|
+
"src/internal/request.ts"() {
|
|
872
|
+
"use strict";
|
|
873
|
+
init_app_injector();
|
|
874
|
+
_Request = class _Request {
|
|
875
|
+
constructor(event, senderId, id, method, path2, body) {
|
|
876
|
+
this.event = event;
|
|
877
|
+
this.senderId = senderId;
|
|
878
|
+
this.id = id;
|
|
879
|
+
this.method = method;
|
|
880
|
+
this.path = path2;
|
|
881
|
+
this.body = body;
|
|
882
|
+
this.context = RootInjector.createScope();
|
|
883
|
+
this.params = {};
|
|
884
|
+
this.path = path2.replace(/^\/|\/$/g, "");
|
|
885
|
+
}
|
|
886
|
+
};
|
|
887
|
+
__name(_Request, "Request");
|
|
888
|
+
Request = _Request;
|
|
889
|
+
}
|
|
890
|
+
});
|
|
891
|
+
|
|
892
|
+
// src/internal/router.ts
|
|
890
893
|
var router_exports = {};
|
|
891
894
|
__export(router_exports, {
|
|
892
895
|
Router: () => Router
|
|
893
896
|
});
|
|
894
897
|
var Router;
|
|
895
898
|
var init_router = __esm({
|
|
896
|
-
"src/router.ts"() {
|
|
899
|
+
"src/internal/router.ts"() {
|
|
897
900
|
"use strict";
|
|
898
901
|
init_controller_decorator();
|
|
899
902
|
init_injectable_decorator();
|
|
900
903
|
init_method_decorator();
|
|
901
904
|
init_injector_explorer();
|
|
902
|
-
init_exceptions();
|
|
903
|
-
init_request();
|
|
904
905
|
init_logger();
|
|
905
906
|
init_radix_tree();
|
|
907
|
+
init_exceptions();
|
|
908
|
+
init_request();
|
|
906
909
|
Router = class {
|
|
907
910
|
constructor() {
|
|
908
911
|
this.routes = new RadixTree();
|
package/dist/child.mjs
CHANGED
|
@@ -118,6 +118,9 @@ var init_app_injector = __esm({
|
|
|
118
118
|
return this._resolveForwardRef(target);
|
|
119
119
|
}
|
|
120
120
|
const k = keyOf(target);
|
|
121
|
+
if (this.singletons.has(k)) {
|
|
122
|
+
return this.singletons.get(k);
|
|
123
|
+
}
|
|
121
124
|
const binding = this.bindings.get(k);
|
|
122
125
|
if (!binding) {
|
|
123
126
|
const name = target instanceof Token ? target.description : target.name ?? "unknown";
|
|
@@ -178,10 +181,10 @@ Did you forget to declare it in @Injectable({ deps }) or in bootstrapApplication
|
|
|
178
181
|
}
|
|
179
182
|
});
|
|
180
183
|
|
|
181
|
-
// src/exceptions.ts
|
|
184
|
+
// src/internal/exceptions.ts
|
|
182
185
|
var _ResponseException, ResponseException, _BadRequestException, BadRequestException, _UnauthorizedException, UnauthorizedException, _PaymentRequiredException, PaymentRequiredException, _ForbiddenException, ForbiddenException, _NotFoundException, NotFoundException, _MethodNotAllowedException, MethodNotAllowedException, _NotAcceptableException, NotAcceptableException, _RequestTimeoutException, RequestTimeoutException, _ConflictException, ConflictException, _UpgradeRequiredException, UpgradeRequiredException, _TooManyRequestsException, TooManyRequestsException, _InternalServerException, InternalServerException, _NotImplementedException, NotImplementedException, _BadGatewayException, BadGatewayException, _ServiceUnavailableException, ServiceUnavailableException, _GatewayTimeoutException, GatewayTimeoutException, _HttpVersionNotSupportedException, HttpVersionNotSupportedException, _VariantAlsoNegotiatesException, VariantAlsoNegotiatesException, _InsufficientStorageException, InsufficientStorageException, _LoopDetectedException, LoopDetectedException, _NotExtendedException, NotExtendedException, _NetworkAuthenticationRequiredException, NetworkAuthenticationRequiredException, _NetworkConnectTimeoutException, NetworkConnectTimeoutException;
|
|
183
186
|
var init_exceptions = __esm({
|
|
184
|
-
"src/exceptions.ts"() {
|
|
187
|
+
"src/internal/exceptions.ts"() {
|
|
185
188
|
"use strict";
|
|
186
189
|
_ResponseException = class _ResponseException extends Error {
|
|
187
190
|
constructor(statusOrMessage, message) {
|
|
@@ -689,30 +692,6 @@ var init_method_decorator = __esm({
|
|
|
689
692
|
}
|
|
690
693
|
});
|
|
691
694
|
|
|
692
|
-
// src/request.ts
|
|
693
|
-
var _Request, Request;
|
|
694
|
-
var init_request = __esm({
|
|
695
|
-
"src/request.ts"() {
|
|
696
|
-
"use strict";
|
|
697
|
-
init_app_injector();
|
|
698
|
-
_Request = class _Request {
|
|
699
|
-
constructor(event, senderId, id, method, path2, body) {
|
|
700
|
-
this.event = event;
|
|
701
|
-
this.senderId = senderId;
|
|
702
|
-
this.id = id;
|
|
703
|
-
this.method = method;
|
|
704
|
-
this.path = path2;
|
|
705
|
-
this.body = body;
|
|
706
|
-
this.context = RootInjector.createScope();
|
|
707
|
-
this.params = {};
|
|
708
|
-
this.path = path2.replace(/^\/|\/$/g, "");
|
|
709
|
-
}
|
|
710
|
-
};
|
|
711
|
-
__name(_Request, "Request");
|
|
712
|
-
Request = _Request;
|
|
713
|
-
}
|
|
714
|
-
});
|
|
715
|
-
|
|
716
695
|
// src/utils/radix-tree.ts
|
|
717
696
|
var _RadixNode, RadixNode, _RadixTree, RadixTree;
|
|
718
697
|
var init_radix_tree = __esm({
|
|
@@ -875,23 +854,47 @@ var init_radix_tree = __esm({
|
|
|
875
854
|
}
|
|
876
855
|
});
|
|
877
856
|
|
|
878
|
-
// src/
|
|
857
|
+
// src/internal/request.ts
|
|
858
|
+
var _Request, Request;
|
|
859
|
+
var init_request = __esm({
|
|
860
|
+
"src/internal/request.ts"() {
|
|
861
|
+
"use strict";
|
|
862
|
+
init_app_injector();
|
|
863
|
+
_Request = class _Request {
|
|
864
|
+
constructor(event, senderId, id, method, path2, body) {
|
|
865
|
+
this.event = event;
|
|
866
|
+
this.senderId = senderId;
|
|
867
|
+
this.id = id;
|
|
868
|
+
this.method = method;
|
|
869
|
+
this.path = path2;
|
|
870
|
+
this.body = body;
|
|
871
|
+
this.context = RootInjector.createScope();
|
|
872
|
+
this.params = {};
|
|
873
|
+
this.path = path2.replace(/^\/|\/$/g, "");
|
|
874
|
+
}
|
|
875
|
+
};
|
|
876
|
+
__name(_Request, "Request");
|
|
877
|
+
Request = _Request;
|
|
878
|
+
}
|
|
879
|
+
});
|
|
880
|
+
|
|
881
|
+
// src/internal/router.ts
|
|
879
882
|
var router_exports = {};
|
|
880
883
|
__export(router_exports, {
|
|
881
884
|
Router: () => Router
|
|
882
885
|
});
|
|
883
886
|
var Router;
|
|
884
887
|
var init_router = __esm({
|
|
885
|
-
"src/router.ts"() {
|
|
888
|
+
"src/internal/router.ts"() {
|
|
886
889
|
"use strict";
|
|
887
890
|
init_controller_decorator();
|
|
888
891
|
init_injectable_decorator();
|
|
889
892
|
init_method_decorator();
|
|
890
893
|
init_injector_explorer();
|
|
891
|
-
init_exceptions();
|
|
892
|
-
init_request();
|
|
893
894
|
init_logger();
|
|
894
895
|
init_radix_tree();
|
|
896
|
+
init_exceptions();
|
|
897
|
+
init_request();
|
|
895
898
|
Router = class {
|
|
896
899
|
constructor() {
|
|
897
900
|
this.routes = new RadixTree();
|