@noxfly/noxus 3.0.0-dev.1 → 3.0.0-dev.11
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 +121 -8
- package/dist/child.d.mts +8 -2
- package/dist/child.d.ts +8 -2
- package/dist/child.js +405 -862
- package/dist/child.js.map +1 -0
- package/dist/child.mjs +396 -854
- package/dist/child.mjs.map +1 -0
- package/dist/main.d.mts +180 -132
- package/dist/main.d.ts +180 -132
- package/dist/main.js +1087 -926
- package/dist/main.js.map +1 -0
- package/dist/main.mjs +1038 -877
- package/dist/main.mjs.map +1 -0
- package/dist/preload.js.map +1 -0
- package/dist/preload.mjs.map +1 -0
- package/dist/renderer.d.mts +30 -4
- package/dist/renderer.d.ts +30 -4
- package/dist/renderer.js +191 -128
- package/dist/renderer.js.map +1 -0
- package/dist/renderer.mjs +180 -116
- package/dist/renderer.mjs.map +1 -0
- package/package.json +18 -9
- package/.editorconfig +0 -16
- package/.github/copilot-instructions.md +0 -32
- package/.vscode/settings.json +0 -3
- package/eslint.config.js +0 -109
- package/scripts/postbuild.js +0 -31
- package/src/DI/app-injector.ts +0 -151
- package/src/DI/injector-explorer.ts +0 -143
- package/src/DI/token.ts +0 -53
- package/src/decorators/controller.decorator.ts +0 -58
- package/src/decorators/guards.decorator.ts +0 -15
- package/src/decorators/injectable.decorator.ts +0 -81
- package/src/decorators/method.decorator.ts +0 -66
- package/src/decorators/middleware.decorator.ts +0 -15
- package/src/index.ts +0 -10
- package/src/internal/app.ts +0 -217
- package/src/internal/bootstrap.ts +0 -108
- package/src/internal/exceptions.ts +0 -57
- package/src/internal/preload-bridge.ts +0 -75
- package/src/internal/renderer-client.ts +0 -338
- package/src/internal/renderer-events.ts +0 -110
- package/src/internal/request.ts +0 -97
- package/src/internal/router.ts +0 -353
- package/src/internal/routes.ts +0 -78
- package/src/internal/socket.ts +0 -73
- package/src/main.ts +0 -26
- package/src/non-electron-process.ts +0 -22
- package/src/preload.ts +0 -10
- package/src/renderer.ts +0 -13
- package/src/utils/forward-ref.ts +0 -31
- package/src/utils/logger.ts +0 -430
- package/src/utils/radix-tree.ts +0 -210
- package/src/utils/types.ts +0 -21
- package/src/window/window-manager.ts +0 -255
- package/tsconfig.json +0 -29
- package/tsup.config.ts +0 -50
package/dist/child.js
CHANGED
|
@@ -10,6 +10,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
10
10
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
11
11
|
var __getProtoOf = Object.getPrototypeOf;
|
|
12
12
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
13
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
13
14
|
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
14
15
|
var __esm = (fn, res) => function __init() {
|
|
15
16
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
@@ -35,14 +36,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
35
36
|
mod
|
|
36
37
|
));
|
|
37
38
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
38
|
-
var
|
|
39
|
-
var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target;
|
|
40
|
-
for (var i = decorators.length - 1, decorator; i >= 0; i--)
|
|
41
|
-
if (decorator = decorators[i])
|
|
42
|
-
result = (kind ? decorator(target, key, result) : decorator(result)) || result;
|
|
43
|
-
if (kind && result) __defProp(target, key, result);
|
|
44
|
-
return result;
|
|
45
|
-
};
|
|
39
|
+
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
46
40
|
|
|
47
41
|
// src/utils/forward-ref.ts
|
|
48
42
|
function forwardRef(fn) {
|
|
@@ -71,6 +65,7 @@ var init_token = __esm({
|
|
|
71
65
|
_Token = class _Token {
|
|
72
66
|
constructor(target) {
|
|
73
67
|
this.target = target;
|
|
68
|
+
__publicField(this, "description");
|
|
74
69
|
this.description = typeof target === "string" ? target : target.name;
|
|
75
70
|
}
|
|
76
71
|
toString() {
|
|
@@ -82,323 +77,6 @@ var init_token = __esm({
|
|
|
82
77
|
}
|
|
83
78
|
});
|
|
84
79
|
|
|
85
|
-
// src/DI/app-injector.ts
|
|
86
|
-
function keyOf(k) {
|
|
87
|
-
return k;
|
|
88
|
-
}
|
|
89
|
-
function inject(t) {
|
|
90
|
-
return RootInjector.resolve(t);
|
|
91
|
-
}
|
|
92
|
-
var _AppInjector, AppInjector, RootInjector;
|
|
93
|
-
var init_app_injector = __esm({
|
|
94
|
-
"src/DI/app-injector.ts"() {
|
|
95
|
-
"use strict";
|
|
96
|
-
init_forward_ref();
|
|
97
|
-
init_token();
|
|
98
|
-
__name(keyOf, "keyOf");
|
|
99
|
-
_AppInjector = class _AppInjector {
|
|
100
|
-
constructor(name = null) {
|
|
101
|
-
this.name = name;
|
|
102
|
-
this.bindings = /* @__PURE__ */ new Map();
|
|
103
|
-
this.singletons = /* @__PURE__ */ new Map();
|
|
104
|
-
this.scoped = /* @__PURE__ */ new Map();
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Creates a child scope for per-request lifetime resolution.
|
|
108
|
-
*/
|
|
109
|
-
createScope() {
|
|
110
|
-
const scope = new _AppInjector();
|
|
111
|
-
scope.bindings = this.bindings;
|
|
112
|
-
scope.singletons = this.singletons;
|
|
113
|
-
return scope;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* Registers a binding explicitly.
|
|
117
|
-
*/
|
|
118
|
-
register(key, implementation, lifetime, deps = []) {
|
|
119
|
-
const k = keyOf(key);
|
|
120
|
-
if (!this.bindings.has(k)) {
|
|
121
|
-
this.bindings.set(k, { lifetime, implementation, deps });
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
/**
|
|
125
|
-
* Resolves a dependency by token or class reference.
|
|
126
|
-
*/
|
|
127
|
-
resolve(target) {
|
|
128
|
-
if (target instanceof ForwardReference) {
|
|
129
|
-
return this._resolveForwardRef(target);
|
|
130
|
-
}
|
|
131
|
-
const k = keyOf(target);
|
|
132
|
-
const binding = this.bindings.get(k);
|
|
133
|
-
if (!binding) {
|
|
134
|
-
const name = target instanceof Token ? target.description : target.name ?? "unknown";
|
|
135
|
-
throw new Error(
|
|
136
|
-
`[Noxus DI] No binding found for "${name}".
|
|
137
|
-
Did you forget to declare it in @Injectable({ deps }) or in bootstrapApplication({ singletons })?`
|
|
138
|
-
);
|
|
139
|
-
}
|
|
140
|
-
switch (binding.lifetime) {
|
|
141
|
-
case "transient":
|
|
142
|
-
return this._instantiate(binding);
|
|
143
|
-
case "scope": {
|
|
144
|
-
if (this.scoped.has(k)) return this.scoped.get(k);
|
|
145
|
-
const inst = this._instantiate(binding);
|
|
146
|
-
this.scoped.set(k, inst);
|
|
147
|
-
return inst;
|
|
148
|
-
}
|
|
149
|
-
case "singleton": {
|
|
150
|
-
if (this.singletons.has(k)) return this.singletons.get(k);
|
|
151
|
-
const inst = this._instantiate(binding);
|
|
152
|
-
this.singletons.set(k, inst);
|
|
153
|
-
if (binding.instance === void 0) {
|
|
154
|
-
binding.instance = inst;
|
|
155
|
-
}
|
|
156
|
-
return inst;
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
// -------------------------------------------------------------------------
|
|
161
|
-
_resolveForwardRef(ref) {
|
|
162
|
-
return new Proxy({}, {
|
|
163
|
-
get: /* @__PURE__ */ __name((_obj, prop, receiver) => {
|
|
164
|
-
const realType = ref.forwardRefFn();
|
|
165
|
-
const instance = this.resolve(realType);
|
|
166
|
-
const value = Reflect.get(instance, prop, receiver);
|
|
167
|
-
return typeof value === "function" ? value.bind(instance) : value;
|
|
168
|
-
}, "get"),
|
|
169
|
-
set: /* @__PURE__ */ __name((_obj, prop, value, receiver) => {
|
|
170
|
-
const realType = ref.forwardRefFn();
|
|
171
|
-
const instance = this.resolve(realType);
|
|
172
|
-
return Reflect.set(instance, prop, value, receiver);
|
|
173
|
-
}, "set"),
|
|
174
|
-
getPrototypeOf: /* @__PURE__ */ __name(() => {
|
|
175
|
-
const realType = ref.forwardRefFn();
|
|
176
|
-
return realType.prototype;
|
|
177
|
-
}, "getPrototypeOf")
|
|
178
|
-
});
|
|
179
|
-
}
|
|
180
|
-
_instantiate(binding) {
|
|
181
|
-
const resolvedDeps = binding.deps.map((dep) => this.resolve(dep));
|
|
182
|
-
return new binding.implementation(...resolvedDeps);
|
|
183
|
-
}
|
|
184
|
-
};
|
|
185
|
-
__name(_AppInjector, "AppInjector");
|
|
186
|
-
AppInjector = _AppInjector;
|
|
187
|
-
RootInjector = new AppInjector("root");
|
|
188
|
-
__name(inject, "inject");
|
|
189
|
-
}
|
|
190
|
-
});
|
|
191
|
-
|
|
192
|
-
// src/internal/exceptions.ts
|
|
193
|
-
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
|
-
var init_exceptions = __esm({
|
|
195
|
-
"src/internal/exceptions.ts"() {
|
|
196
|
-
"use strict";
|
|
197
|
-
_ResponseException = class _ResponseException extends Error {
|
|
198
|
-
constructor(statusOrMessage, message) {
|
|
199
|
-
let statusCode;
|
|
200
|
-
if (typeof statusOrMessage === "number") {
|
|
201
|
-
statusCode = statusOrMessage;
|
|
202
|
-
} else if (typeof statusOrMessage === "string") {
|
|
203
|
-
message = statusOrMessage;
|
|
204
|
-
}
|
|
205
|
-
super(message ?? "");
|
|
206
|
-
this.status = 0;
|
|
207
|
-
if (statusCode !== void 0) {
|
|
208
|
-
this.status = statusCode;
|
|
209
|
-
}
|
|
210
|
-
this.name = this.constructor.name.replace(/([A-Z])/g, " $1");
|
|
211
|
-
}
|
|
212
|
-
};
|
|
213
|
-
__name(_ResponseException, "ResponseException");
|
|
214
|
-
ResponseException = _ResponseException;
|
|
215
|
-
_BadRequestException = class _BadRequestException extends ResponseException {
|
|
216
|
-
constructor() {
|
|
217
|
-
super(...arguments);
|
|
218
|
-
this.status = 400;
|
|
219
|
-
}
|
|
220
|
-
};
|
|
221
|
-
__name(_BadRequestException, "BadRequestException");
|
|
222
|
-
BadRequestException = _BadRequestException;
|
|
223
|
-
_UnauthorizedException = class _UnauthorizedException extends ResponseException {
|
|
224
|
-
constructor() {
|
|
225
|
-
super(...arguments);
|
|
226
|
-
this.status = 401;
|
|
227
|
-
}
|
|
228
|
-
};
|
|
229
|
-
__name(_UnauthorizedException, "UnauthorizedException");
|
|
230
|
-
UnauthorizedException = _UnauthorizedException;
|
|
231
|
-
_PaymentRequiredException = class _PaymentRequiredException extends ResponseException {
|
|
232
|
-
constructor() {
|
|
233
|
-
super(...arguments);
|
|
234
|
-
this.status = 402;
|
|
235
|
-
}
|
|
236
|
-
};
|
|
237
|
-
__name(_PaymentRequiredException, "PaymentRequiredException");
|
|
238
|
-
PaymentRequiredException = _PaymentRequiredException;
|
|
239
|
-
_ForbiddenException = class _ForbiddenException extends ResponseException {
|
|
240
|
-
constructor() {
|
|
241
|
-
super(...arguments);
|
|
242
|
-
this.status = 403;
|
|
243
|
-
}
|
|
244
|
-
};
|
|
245
|
-
__name(_ForbiddenException, "ForbiddenException");
|
|
246
|
-
ForbiddenException = _ForbiddenException;
|
|
247
|
-
_NotFoundException = class _NotFoundException extends ResponseException {
|
|
248
|
-
constructor() {
|
|
249
|
-
super(...arguments);
|
|
250
|
-
this.status = 404;
|
|
251
|
-
}
|
|
252
|
-
};
|
|
253
|
-
__name(_NotFoundException, "NotFoundException");
|
|
254
|
-
NotFoundException = _NotFoundException;
|
|
255
|
-
_MethodNotAllowedException = class _MethodNotAllowedException extends ResponseException {
|
|
256
|
-
constructor() {
|
|
257
|
-
super(...arguments);
|
|
258
|
-
this.status = 405;
|
|
259
|
-
}
|
|
260
|
-
};
|
|
261
|
-
__name(_MethodNotAllowedException, "MethodNotAllowedException");
|
|
262
|
-
MethodNotAllowedException = _MethodNotAllowedException;
|
|
263
|
-
_NotAcceptableException = class _NotAcceptableException extends ResponseException {
|
|
264
|
-
constructor() {
|
|
265
|
-
super(...arguments);
|
|
266
|
-
this.status = 406;
|
|
267
|
-
}
|
|
268
|
-
};
|
|
269
|
-
__name(_NotAcceptableException, "NotAcceptableException");
|
|
270
|
-
NotAcceptableException = _NotAcceptableException;
|
|
271
|
-
_RequestTimeoutException = class _RequestTimeoutException extends ResponseException {
|
|
272
|
-
constructor() {
|
|
273
|
-
super(...arguments);
|
|
274
|
-
this.status = 408;
|
|
275
|
-
}
|
|
276
|
-
};
|
|
277
|
-
__name(_RequestTimeoutException, "RequestTimeoutException");
|
|
278
|
-
RequestTimeoutException = _RequestTimeoutException;
|
|
279
|
-
_ConflictException = class _ConflictException extends ResponseException {
|
|
280
|
-
constructor() {
|
|
281
|
-
super(...arguments);
|
|
282
|
-
this.status = 409;
|
|
283
|
-
}
|
|
284
|
-
};
|
|
285
|
-
__name(_ConflictException, "ConflictException");
|
|
286
|
-
ConflictException = _ConflictException;
|
|
287
|
-
_UpgradeRequiredException = class _UpgradeRequiredException extends ResponseException {
|
|
288
|
-
constructor() {
|
|
289
|
-
super(...arguments);
|
|
290
|
-
this.status = 426;
|
|
291
|
-
}
|
|
292
|
-
};
|
|
293
|
-
__name(_UpgradeRequiredException, "UpgradeRequiredException");
|
|
294
|
-
UpgradeRequiredException = _UpgradeRequiredException;
|
|
295
|
-
_TooManyRequestsException = class _TooManyRequestsException extends ResponseException {
|
|
296
|
-
constructor() {
|
|
297
|
-
super(...arguments);
|
|
298
|
-
this.status = 429;
|
|
299
|
-
}
|
|
300
|
-
};
|
|
301
|
-
__name(_TooManyRequestsException, "TooManyRequestsException");
|
|
302
|
-
TooManyRequestsException = _TooManyRequestsException;
|
|
303
|
-
_InternalServerException = class _InternalServerException extends ResponseException {
|
|
304
|
-
constructor() {
|
|
305
|
-
super(...arguments);
|
|
306
|
-
this.status = 500;
|
|
307
|
-
}
|
|
308
|
-
};
|
|
309
|
-
__name(_InternalServerException, "InternalServerException");
|
|
310
|
-
InternalServerException = _InternalServerException;
|
|
311
|
-
_NotImplementedException = class _NotImplementedException extends ResponseException {
|
|
312
|
-
constructor() {
|
|
313
|
-
super(...arguments);
|
|
314
|
-
this.status = 501;
|
|
315
|
-
}
|
|
316
|
-
};
|
|
317
|
-
__name(_NotImplementedException, "NotImplementedException");
|
|
318
|
-
NotImplementedException = _NotImplementedException;
|
|
319
|
-
_BadGatewayException = class _BadGatewayException extends ResponseException {
|
|
320
|
-
constructor() {
|
|
321
|
-
super(...arguments);
|
|
322
|
-
this.status = 502;
|
|
323
|
-
}
|
|
324
|
-
};
|
|
325
|
-
__name(_BadGatewayException, "BadGatewayException");
|
|
326
|
-
BadGatewayException = _BadGatewayException;
|
|
327
|
-
_ServiceUnavailableException = class _ServiceUnavailableException extends ResponseException {
|
|
328
|
-
constructor() {
|
|
329
|
-
super(...arguments);
|
|
330
|
-
this.status = 503;
|
|
331
|
-
}
|
|
332
|
-
};
|
|
333
|
-
__name(_ServiceUnavailableException, "ServiceUnavailableException");
|
|
334
|
-
ServiceUnavailableException = _ServiceUnavailableException;
|
|
335
|
-
_GatewayTimeoutException = class _GatewayTimeoutException extends ResponseException {
|
|
336
|
-
constructor() {
|
|
337
|
-
super(...arguments);
|
|
338
|
-
this.status = 504;
|
|
339
|
-
}
|
|
340
|
-
};
|
|
341
|
-
__name(_GatewayTimeoutException, "GatewayTimeoutException");
|
|
342
|
-
GatewayTimeoutException = _GatewayTimeoutException;
|
|
343
|
-
_HttpVersionNotSupportedException = class _HttpVersionNotSupportedException extends ResponseException {
|
|
344
|
-
constructor() {
|
|
345
|
-
super(...arguments);
|
|
346
|
-
this.status = 505;
|
|
347
|
-
}
|
|
348
|
-
};
|
|
349
|
-
__name(_HttpVersionNotSupportedException, "HttpVersionNotSupportedException");
|
|
350
|
-
HttpVersionNotSupportedException = _HttpVersionNotSupportedException;
|
|
351
|
-
_VariantAlsoNegotiatesException = class _VariantAlsoNegotiatesException extends ResponseException {
|
|
352
|
-
constructor() {
|
|
353
|
-
super(...arguments);
|
|
354
|
-
this.status = 506;
|
|
355
|
-
}
|
|
356
|
-
};
|
|
357
|
-
__name(_VariantAlsoNegotiatesException, "VariantAlsoNegotiatesException");
|
|
358
|
-
VariantAlsoNegotiatesException = _VariantAlsoNegotiatesException;
|
|
359
|
-
_InsufficientStorageException = class _InsufficientStorageException extends ResponseException {
|
|
360
|
-
constructor() {
|
|
361
|
-
super(...arguments);
|
|
362
|
-
this.status = 507;
|
|
363
|
-
}
|
|
364
|
-
};
|
|
365
|
-
__name(_InsufficientStorageException, "InsufficientStorageException");
|
|
366
|
-
InsufficientStorageException = _InsufficientStorageException;
|
|
367
|
-
_LoopDetectedException = class _LoopDetectedException extends ResponseException {
|
|
368
|
-
constructor() {
|
|
369
|
-
super(...arguments);
|
|
370
|
-
this.status = 508;
|
|
371
|
-
}
|
|
372
|
-
};
|
|
373
|
-
__name(_LoopDetectedException, "LoopDetectedException");
|
|
374
|
-
LoopDetectedException = _LoopDetectedException;
|
|
375
|
-
_NotExtendedException = class _NotExtendedException extends ResponseException {
|
|
376
|
-
constructor() {
|
|
377
|
-
super(...arguments);
|
|
378
|
-
this.status = 510;
|
|
379
|
-
}
|
|
380
|
-
};
|
|
381
|
-
__name(_NotExtendedException, "NotExtendedException");
|
|
382
|
-
NotExtendedException = _NotExtendedException;
|
|
383
|
-
_NetworkAuthenticationRequiredException = class _NetworkAuthenticationRequiredException extends ResponseException {
|
|
384
|
-
constructor() {
|
|
385
|
-
super(...arguments);
|
|
386
|
-
this.status = 511;
|
|
387
|
-
}
|
|
388
|
-
};
|
|
389
|
-
__name(_NetworkAuthenticationRequiredException, "NetworkAuthenticationRequiredException");
|
|
390
|
-
NetworkAuthenticationRequiredException = _NetworkAuthenticationRequiredException;
|
|
391
|
-
_NetworkConnectTimeoutException = class _NetworkConnectTimeoutException extends ResponseException {
|
|
392
|
-
constructor() {
|
|
393
|
-
super(...arguments);
|
|
394
|
-
this.status = 599;
|
|
395
|
-
}
|
|
396
|
-
};
|
|
397
|
-
__name(_NetworkConnectTimeoutException, "NetworkConnectTimeoutException");
|
|
398
|
-
NetworkConnectTimeoutException = _NetworkConnectTimeoutException;
|
|
399
|
-
}
|
|
400
|
-
});
|
|
401
|
-
|
|
402
80
|
// src/utils/logger.ts
|
|
403
81
|
function getPrettyTimestamp() {
|
|
404
82
|
const now = /* @__PURE__ */ new Date();
|
|
@@ -646,502 +324,11 @@ var init_logger = __esm({
|
|
|
646
324
|
}
|
|
647
325
|
});
|
|
648
326
|
|
|
649
|
-
// src/decorators/controller.decorator.ts
|
|
650
|
-
function getControllerMetadata(target) {
|
|
651
|
-
return controllerMetaMap.get(target);
|
|
652
|
-
}
|
|
653
|
-
var controllerMetaMap;
|
|
654
|
-
var init_controller_decorator = __esm({
|
|
655
|
-
"src/decorators/controller.decorator.ts"() {
|
|
656
|
-
"use strict";
|
|
657
|
-
init_injector_explorer();
|
|
658
|
-
controllerMetaMap = /* @__PURE__ */ new WeakMap();
|
|
659
|
-
__name(getControllerMetadata, "getControllerMetadata");
|
|
660
|
-
}
|
|
661
|
-
});
|
|
662
|
-
|
|
663
|
-
// src/decorators/method.decorator.ts
|
|
664
|
-
function isAtomicHttpMethod(m) {
|
|
665
|
-
return typeof m === "string" && ATOMIC_METHODS.has(m);
|
|
666
|
-
}
|
|
667
|
-
function createRouteDecorator(verb) {
|
|
668
|
-
return (path2, options = {}) => {
|
|
669
|
-
return (target, propertyKey) => {
|
|
670
|
-
const ctor = target.constructor;
|
|
671
|
-
const existing = routeMetaMap.get(ctor) ?? [];
|
|
672
|
-
existing.push({
|
|
673
|
-
method: verb,
|
|
674
|
-
path: (path2 ?? "").trim().replace(/^\/|\/$/g, ""),
|
|
675
|
-
handler: propertyKey,
|
|
676
|
-
guards: options.guards ?? [],
|
|
677
|
-
middlewares: options.middlewares ?? []
|
|
678
|
-
});
|
|
679
|
-
routeMetaMap.set(ctor, existing);
|
|
680
|
-
};
|
|
681
|
-
};
|
|
682
|
-
}
|
|
683
|
-
function getRouteMetadata(target) {
|
|
684
|
-
return routeMetaMap.get(target) ?? [];
|
|
685
|
-
}
|
|
686
|
-
var ATOMIC_METHODS, routeMetaMap, Get, Post, Put, Patch, Delete;
|
|
687
|
-
var init_method_decorator = __esm({
|
|
688
|
-
"src/decorators/method.decorator.ts"() {
|
|
689
|
-
"use strict";
|
|
690
|
-
ATOMIC_METHODS = /* @__PURE__ */ new Set(["GET", "POST", "PUT", "PATCH", "DELETE"]);
|
|
691
|
-
__name(isAtomicHttpMethod, "isAtomicHttpMethod");
|
|
692
|
-
routeMetaMap = /* @__PURE__ */ new WeakMap();
|
|
693
|
-
__name(createRouteDecorator, "createRouteDecorator");
|
|
694
|
-
__name(getRouteMetadata, "getRouteMetadata");
|
|
695
|
-
Get = createRouteDecorator("GET");
|
|
696
|
-
Post = createRouteDecorator("POST");
|
|
697
|
-
Put = createRouteDecorator("PUT");
|
|
698
|
-
Patch = createRouteDecorator("PATCH");
|
|
699
|
-
Delete = createRouteDecorator("DELETE");
|
|
700
|
-
}
|
|
701
|
-
});
|
|
702
|
-
|
|
703
|
-
// src/utils/radix-tree.ts
|
|
704
|
-
var _RadixNode, RadixNode, _RadixTree, RadixTree;
|
|
705
|
-
var init_radix_tree = __esm({
|
|
706
|
-
"src/utils/radix-tree.ts"() {
|
|
707
|
-
"use strict";
|
|
708
|
-
_RadixNode = class _RadixNode {
|
|
709
|
-
/**
|
|
710
|
-
* Creates a new RadixNode.
|
|
711
|
-
* @param segment - The segment of the path this node represents.
|
|
712
|
-
*/
|
|
713
|
-
constructor(segment) {
|
|
714
|
-
this.children = [];
|
|
715
|
-
this.segment = segment;
|
|
716
|
-
this.isParam = segment.startsWith(":");
|
|
717
|
-
if (this.isParam) {
|
|
718
|
-
this.paramName = segment.slice(1);
|
|
719
|
-
}
|
|
720
|
-
}
|
|
721
|
-
/**
|
|
722
|
-
* Matches a child node against a given segment.
|
|
723
|
-
* This method checks if the segment matches any of the children nodes.
|
|
724
|
-
* @param segment - The segment to match against the children of this node.
|
|
725
|
-
* @returns A child node that matches the segment, or undefined if no match is found.
|
|
726
|
-
*/
|
|
727
|
-
matchChild(segment) {
|
|
728
|
-
for (const child of this.children) {
|
|
729
|
-
if (child.isParam || segment.startsWith(child.segment))
|
|
730
|
-
return child;
|
|
731
|
-
}
|
|
732
|
-
return void 0;
|
|
733
|
-
}
|
|
734
|
-
/**
|
|
735
|
-
* Finds a child node that matches the segment exactly.
|
|
736
|
-
* This method checks if there is a child node that matches the segment exactly.
|
|
737
|
-
* @param segment - The segment to find an exact match for among the children of this node.
|
|
738
|
-
* @returns A child node that matches the segment exactly, or undefined if no match is found.
|
|
739
|
-
*/
|
|
740
|
-
findExactChild(segment) {
|
|
741
|
-
return this.children.find((c) => c.segment === segment);
|
|
742
|
-
}
|
|
743
|
-
/**
|
|
744
|
-
* Adds a child node to this node's children.
|
|
745
|
-
* This method adds a new child node to the list of children for this node.
|
|
746
|
-
* @param node - The child node to add to this node's children.
|
|
747
|
-
*/
|
|
748
|
-
addChild(node) {
|
|
749
|
-
this.children.push(node);
|
|
750
|
-
}
|
|
751
|
-
};
|
|
752
|
-
__name(_RadixNode, "RadixNode");
|
|
753
|
-
RadixNode = _RadixNode;
|
|
754
|
-
_RadixTree = class _RadixTree {
|
|
755
|
-
constructor() {
|
|
756
|
-
this.root = new RadixNode("");
|
|
757
|
-
}
|
|
758
|
-
/**
|
|
759
|
-
* Inserts a path and its associated value into the Radix Tree.
|
|
760
|
-
* This method normalizes the path and inserts it into the tree, associating it with
|
|
761
|
-
* @param path - The path to insert into the tree.
|
|
762
|
-
* @param value - The value to associate with the path.
|
|
763
|
-
*/
|
|
764
|
-
insert(path2, value) {
|
|
765
|
-
const segments = this.normalize(path2);
|
|
766
|
-
this.insertRecursive(this.root, segments, value);
|
|
767
|
-
}
|
|
768
|
-
/**
|
|
769
|
-
* Recursively inserts a path into the Radix Tree.
|
|
770
|
-
* This method traverses the tree and inserts the segments of the path, creating new nodes
|
|
771
|
-
* @param node - The node to start inserting from.
|
|
772
|
-
* @param segments - The segments of the path to insert.
|
|
773
|
-
* @param value - The value to associate with the path.
|
|
774
|
-
*/
|
|
775
|
-
insertRecursive(node, segments, value) {
|
|
776
|
-
if (segments.length === 0) {
|
|
777
|
-
node.value = value;
|
|
778
|
-
return;
|
|
779
|
-
}
|
|
780
|
-
const segment = segments[0] ?? "";
|
|
781
|
-
let child = node.children.find(
|
|
782
|
-
(c) => c.isParam === segment.startsWith(":") && (c.isParam || c.segment === segment)
|
|
783
|
-
);
|
|
784
|
-
if (!child) {
|
|
785
|
-
child = new RadixNode(segment);
|
|
786
|
-
node.addChild(child);
|
|
787
|
-
}
|
|
788
|
-
this.insertRecursive(child, segments.slice(1), value);
|
|
789
|
-
}
|
|
790
|
-
/**
|
|
791
|
-
* Searches for a path in the Radix Tree.
|
|
792
|
-
* This method normalizes the path and searches for it in the tree, returning the node
|
|
793
|
-
* @param path - The path to search for in the Radix Tree.
|
|
794
|
-
* @returns An ISearchResult containing the node and parameters if a match is found, otherwise undefined.
|
|
795
|
-
*/
|
|
796
|
-
search(path2) {
|
|
797
|
-
const segments = this.normalize(path2);
|
|
798
|
-
return this.searchRecursive(this.root, segments, {});
|
|
799
|
-
}
|
|
800
|
-
/**
|
|
801
|
-
* Recursively searches for a path in the Radix Tree.
|
|
802
|
-
* This method traverses the tree and searches for the segments of the path, collecting parameters
|
|
803
|
-
* @param node - The node to start searching from.
|
|
804
|
-
* @param segments - The segments of the path to search for.
|
|
805
|
-
* @param params - The parameters collected during the search.
|
|
806
|
-
* @returns An ISearchResult containing the node and parameters if a match is found, otherwise undefined.
|
|
807
|
-
*/
|
|
808
|
-
searchRecursive(node, segments, params) {
|
|
809
|
-
if (segments.length === 0) {
|
|
810
|
-
if (node.value !== void 0) {
|
|
811
|
-
return {
|
|
812
|
-
node,
|
|
813
|
-
params
|
|
814
|
-
};
|
|
815
|
-
}
|
|
816
|
-
return void 0;
|
|
817
|
-
}
|
|
818
|
-
const [segment, ...rest] = segments;
|
|
819
|
-
for (const child of node.children) {
|
|
820
|
-
if (child.isParam) {
|
|
821
|
-
const paramName = child.paramName;
|
|
822
|
-
const childParams = {
|
|
823
|
-
...params,
|
|
824
|
-
[paramName]: segment ?? ""
|
|
825
|
-
};
|
|
826
|
-
if (rest.length === 0) {
|
|
827
|
-
return {
|
|
828
|
-
node: child,
|
|
829
|
-
params: childParams
|
|
830
|
-
};
|
|
831
|
-
}
|
|
832
|
-
const result = this.searchRecursive(child, rest, childParams);
|
|
833
|
-
if (result)
|
|
834
|
-
return result;
|
|
835
|
-
} else if (segment === child.segment) {
|
|
836
|
-
if (rest.length === 0) {
|
|
837
|
-
return {
|
|
838
|
-
node: child,
|
|
839
|
-
params
|
|
840
|
-
};
|
|
841
|
-
}
|
|
842
|
-
const result = this.searchRecursive(child, rest, params);
|
|
843
|
-
if (result)
|
|
844
|
-
return result;
|
|
845
|
-
}
|
|
846
|
-
}
|
|
847
|
-
return void 0;
|
|
848
|
-
}
|
|
849
|
-
/**
|
|
850
|
-
* Normalizes a path into an array of segments.
|
|
851
|
-
* This method removes leading and trailing slashes, splits the path by slashes, and
|
|
852
|
-
* @param path - The path to normalize.
|
|
853
|
-
* @returns An array of normalized path segments.
|
|
854
|
-
*/
|
|
855
|
-
normalize(path2) {
|
|
856
|
-
const segments = path2.replace(/^\/+|\/+$/g, "").split("/").filter(Boolean);
|
|
857
|
-
return ["", ...segments];
|
|
858
|
-
}
|
|
859
|
-
};
|
|
860
|
-
__name(_RadixTree, "RadixTree");
|
|
861
|
-
RadixTree = _RadixTree;
|
|
862
|
-
}
|
|
863
|
-
});
|
|
864
|
-
|
|
865
|
-
// src/internal/request.ts
|
|
866
|
-
var _Request, Request;
|
|
867
|
-
var init_request = __esm({
|
|
868
|
-
"src/internal/request.ts"() {
|
|
869
|
-
"use strict";
|
|
870
|
-
init_app_injector();
|
|
871
|
-
_Request = class _Request {
|
|
872
|
-
constructor(event, senderId, id, method, path2, body) {
|
|
873
|
-
this.event = event;
|
|
874
|
-
this.senderId = senderId;
|
|
875
|
-
this.id = id;
|
|
876
|
-
this.method = method;
|
|
877
|
-
this.path = path2;
|
|
878
|
-
this.body = body;
|
|
879
|
-
this.context = RootInjector.createScope();
|
|
880
|
-
this.params = {};
|
|
881
|
-
this.path = path2.replace(/^\/|\/$/g, "");
|
|
882
|
-
}
|
|
883
|
-
};
|
|
884
|
-
__name(_Request, "Request");
|
|
885
|
-
Request = _Request;
|
|
886
|
-
}
|
|
887
|
-
});
|
|
888
|
-
|
|
889
|
-
// src/internal/router.ts
|
|
890
|
-
var router_exports = {};
|
|
891
|
-
__export(router_exports, {
|
|
892
|
-
Router: () => Router
|
|
893
|
-
});
|
|
894
|
-
var Router;
|
|
895
|
-
var init_router = __esm({
|
|
896
|
-
"src/internal/router.ts"() {
|
|
897
|
-
"use strict";
|
|
898
|
-
init_controller_decorator();
|
|
899
|
-
init_injectable_decorator();
|
|
900
|
-
init_method_decorator();
|
|
901
|
-
init_injector_explorer();
|
|
902
|
-
init_logger();
|
|
903
|
-
init_radix_tree();
|
|
904
|
-
init_exceptions();
|
|
905
|
-
init_request();
|
|
906
|
-
Router = class {
|
|
907
|
-
constructor() {
|
|
908
|
-
this.routes = new RadixTree();
|
|
909
|
-
this.rootMiddlewares = [];
|
|
910
|
-
this.lazyRoutes = /* @__PURE__ */ new Map();
|
|
911
|
-
}
|
|
912
|
-
// -------------------------------------------------------------------------
|
|
913
|
-
// Registration
|
|
914
|
-
// -------------------------------------------------------------------------
|
|
915
|
-
registerController(controllerClass, pathPrefix, routeGuards = [], routeMiddlewares = []) {
|
|
916
|
-
const meta = getControllerMetadata(controllerClass);
|
|
917
|
-
if (!meta) {
|
|
918
|
-
throw new Error(`[Noxus] Missing @Controller decorator on ${controllerClass.name}`);
|
|
919
|
-
}
|
|
920
|
-
const routeMeta = getRouteMetadata(controllerClass);
|
|
921
|
-
for (const def of routeMeta) {
|
|
922
|
-
const fullPath = `${pathPrefix}/${def.path}`.replace(/\/+/g, "/").replace(/\/$/, "") || "/";
|
|
923
|
-
const guards = [.../* @__PURE__ */ new Set([...routeGuards, ...def.guards])];
|
|
924
|
-
const middlewares = [.../* @__PURE__ */ new Set([...routeMiddlewares, ...def.middlewares])];
|
|
925
|
-
const routeDef = {
|
|
926
|
-
method: def.method,
|
|
927
|
-
path: fullPath,
|
|
928
|
-
controller: controllerClass,
|
|
929
|
-
handler: def.handler,
|
|
930
|
-
guards,
|
|
931
|
-
middlewares
|
|
932
|
-
};
|
|
933
|
-
this.routes.insert(fullPath + "/" + def.method, routeDef);
|
|
934
|
-
const guardInfo = guards.length ? `<${guards.map((g) => g.name).join("|")}>` : "";
|
|
935
|
-
Logger.log(`Mapped {${def.method} /${fullPath}}${guardInfo} route`);
|
|
936
|
-
}
|
|
937
|
-
const ctrlGuardInfo = routeGuards.length ? `<${routeGuards.map((g) => g.name).join("|")}>` : "";
|
|
938
|
-
Logger.log(`Mapped ${controllerClass.name}${ctrlGuardInfo} controller's routes`);
|
|
939
|
-
return this;
|
|
940
|
-
}
|
|
941
|
-
registerLazyRoute(pathPrefix, load, guards = [], middlewares = []) {
|
|
942
|
-
const normalized = pathPrefix.replace(/^\/+|\/+$/g, "");
|
|
943
|
-
this.lazyRoutes.set(normalized, { load, guards, middlewares, loading: null, loaded: false });
|
|
944
|
-
Logger.log(`Registered lazy route prefix {${normalized}}`);
|
|
945
|
-
return this;
|
|
946
|
-
}
|
|
947
|
-
defineRootMiddleware(middleware) {
|
|
948
|
-
this.rootMiddlewares.push(middleware);
|
|
949
|
-
return this;
|
|
950
|
-
}
|
|
951
|
-
// -------------------------------------------------------------------------
|
|
952
|
-
// Request handling
|
|
953
|
-
// -------------------------------------------------------------------------
|
|
954
|
-
async handle(request) {
|
|
955
|
-
return request.method === "BATCH" ? this.handleBatch(request) : this.handleAtomic(request);
|
|
956
|
-
}
|
|
957
|
-
async handleAtomic(request) {
|
|
958
|
-
Logger.comment(`> ${request.method} /${request.path}`);
|
|
959
|
-
const t0 = performance.now();
|
|
960
|
-
const response = { requestId: request.id, status: 200, body: null };
|
|
961
|
-
let isCritical = false;
|
|
962
|
-
try {
|
|
963
|
-
const routeDef = await this.findRoute(request);
|
|
964
|
-
await this.resolveController(request, response, routeDef);
|
|
965
|
-
if (response.status >= 400) throw new ResponseException(response.status, response.error);
|
|
966
|
-
} catch (error) {
|
|
967
|
-
this.fillErrorResponse(response, error, (c) => {
|
|
968
|
-
isCritical = c;
|
|
969
|
-
});
|
|
970
|
-
} finally {
|
|
971
|
-
this.logResponse(request, response, performance.now() - t0, isCritical);
|
|
972
|
-
return response;
|
|
973
|
-
}
|
|
974
|
-
}
|
|
975
|
-
async handleBatch(request) {
|
|
976
|
-
Logger.comment(`> ${request.method} /${request.path}`);
|
|
977
|
-
const t0 = performance.now();
|
|
978
|
-
const response = {
|
|
979
|
-
requestId: request.id,
|
|
980
|
-
status: 200,
|
|
981
|
-
body: { responses: [] }
|
|
982
|
-
};
|
|
983
|
-
let isCritical = false;
|
|
984
|
-
try {
|
|
985
|
-
const payload = this.normalizeBatchPayload(request.body);
|
|
986
|
-
response.body.responses = await Promise.all(
|
|
987
|
-
payload.requests.map((item, i) => {
|
|
988
|
-
const id = item.requestId ?? `${request.id}:${i}`;
|
|
989
|
-
return this.handleAtomic(new Request(request.event, request.senderId, id, item.method, item.path, item.body));
|
|
990
|
-
})
|
|
991
|
-
);
|
|
992
|
-
} catch (error) {
|
|
993
|
-
this.fillErrorResponse(response, error, (c) => {
|
|
994
|
-
isCritical = c;
|
|
995
|
-
});
|
|
996
|
-
} finally {
|
|
997
|
-
this.logResponse(request, response, performance.now() - t0, isCritical);
|
|
998
|
-
return response;
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
// -------------------------------------------------------------------------
|
|
1002
|
-
// Route resolution
|
|
1003
|
-
// -------------------------------------------------------------------------
|
|
1004
|
-
tryFindRoute(request) {
|
|
1005
|
-
const matched = this.routes.search(request.path);
|
|
1006
|
-
if (!matched?.node || matched.node.children.length === 0) return void 0;
|
|
1007
|
-
return matched.node.findExactChild(request.method)?.value;
|
|
1008
|
-
}
|
|
1009
|
-
async findRoute(request) {
|
|
1010
|
-
const direct = this.tryFindRoute(request);
|
|
1011
|
-
if (direct) return direct;
|
|
1012
|
-
await this.tryLoadLazyRoute(request.path);
|
|
1013
|
-
const afterLazy = this.tryFindRoute(request);
|
|
1014
|
-
if (afterLazy) return afterLazy;
|
|
1015
|
-
throw new NotFoundException(`No route matches ${request.method} ${request.path}`);
|
|
1016
|
-
}
|
|
1017
|
-
async tryLoadLazyRoute(requestPath) {
|
|
1018
|
-
const firstSegment = requestPath.replace(/^\/+/, "").split("/")[0] ?? "";
|
|
1019
|
-
for (const [prefix, entry] of this.lazyRoutes) {
|
|
1020
|
-
if (entry.loaded) continue;
|
|
1021
|
-
const normalized = requestPath.replace(/^\/+/, "");
|
|
1022
|
-
if (normalized === prefix || normalized.startsWith(prefix + "/") || firstSegment === prefix) {
|
|
1023
|
-
if (!entry.loading) entry.loading = this.loadLazyModule(prefix, entry);
|
|
1024
|
-
await entry.loading;
|
|
1025
|
-
return;
|
|
1026
|
-
}
|
|
1027
|
-
}
|
|
1028
|
-
}
|
|
1029
|
-
async loadLazyModule(prefix, entry) {
|
|
1030
|
-
const t0 = performance.now();
|
|
1031
|
-
InjectorExplorer.beginAccumulate();
|
|
1032
|
-
await entry.load?.();
|
|
1033
|
-
entry.loading = null;
|
|
1034
|
-
entry.load = null;
|
|
1035
|
-
InjectorExplorer.flushAccumulated(entry.guards, entry.middlewares, prefix);
|
|
1036
|
-
entry.loaded = true;
|
|
1037
|
-
Logger.info(`Lazy-loaded module for prefix {${prefix}} in ${Math.round(performance.now() - t0)}ms`);
|
|
1038
|
-
}
|
|
1039
|
-
// -------------------------------------------------------------------------
|
|
1040
|
-
// Pipeline
|
|
1041
|
-
// -------------------------------------------------------------------------
|
|
1042
|
-
async resolveController(request, response, routeDef) {
|
|
1043
|
-
const instance = request.context.resolve(routeDef.controller);
|
|
1044
|
-
Object.assign(request.params, this.extractParams(request.path, routeDef.path));
|
|
1045
|
-
await this.runPipeline(request, response, routeDef, instance);
|
|
1046
|
-
}
|
|
1047
|
-
async runPipeline(request, response, routeDef, controllerInstance) {
|
|
1048
|
-
const middlewares = [.../* @__PURE__ */ new Set([...this.rootMiddlewares, ...routeDef.middlewares])];
|
|
1049
|
-
const mwMax = middlewares.length - 1;
|
|
1050
|
-
const guardMax = mwMax + routeDef.guards.length;
|
|
1051
|
-
let index = -1;
|
|
1052
|
-
const dispatch = /* @__PURE__ */ __name(async (i) => {
|
|
1053
|
-
if (i <= index) throw new Error("next() called multiple times");
|
|
1054
|
-
index = i;
|
|
1055
|
-
if (i <= mwMax) {
|
|
1056
|
-
await this.runMiddleware(request, response, dispatch.bind(null, i + 1), middlewares[i]);
|
|
1057
|
-
if (response.status >= 400) throw new ResponseException(response.status, response.error);
|
|
1058
|
-
return;
|
|
1059
|
-
}
|
|
1060
|
-
if (i <= guardMax) {
|
|
1061
|
-
await this.runGuard(request, routeDef.guards[i - middlewares.length]);
|
|
1062
|
-
await dispatch(i + 1);
|
|
1063
|
-
return;
|
|
1064
|
-
}
|
|
1065
|
-
const action = controllerInstance[routeDef.handler];
|
|
1066
|
-
response.body = await action.call(controllerInstance, request, response);
|
|
1067
|
-
if (response.body === void 0) response.body = {};
|
|
1068
|
-
}, "dispatch");
|
|
1069
|
-
await dispatch(0);
|
|
1070
|
-
}
|
|
1071
|
-
async runMiddleware(request, response, next, middleware) {
|
|
1072
|
-
await middleware(request, response, next);
|
|
1073
|
-
}
|
|
1074
|
-
async runGuard(request, guard) {
|
|
1075
|
-
if (!await guard(request)) {
|
|
1076
|
-
throw new UnauthorizedException(`Unauthorized for ${request.method} ${request.path}`);
|
|
1077
|
-
}
|
|
1078
|
-
}
|
|
1079
|
-
// -------------------------------------------------------------------------
|
|
1080
|
-
// Utilities
|
|
1081
|
-
// -------------------------------------------------------------------------
|
|
1082
|
-
extractParams(actual, template) {
|
|
1083
|
-
const aParts = actual.split("/");
|
|
1084
|
-
const tParts = template.split("/");
|
|
1085
|
-
const params = {};
|
|
1086
|
-
tParts.forEach((part, i) => {
|
|
1087
|
-
if (part.startsWith(":")) params[part.slice(1)] = aParts[i] ?? "";
|
|
1088
|
-
});
|
|
1089
|
-
return params;
|
|
1090
|
-
}
|
|
1091
|
-
normalizeBatchPayload(body) {
|
|
1092
|
-
if (body === null || typeof body !== "object") {
|
|
1093
|
-
throw new BadRequestException("Batch payload must be an object containing a requests array.");
|
|
1094
|
-
}
|
|
1095
|
-
const { requests } = body;
|
|
1096
|
-
if (!Array.isArray(requests)) throw new BadRequestException("Batch payload must define a requests array.");
|
|
1097
|
-
return { requests: requests.map((e, i) => this.normalizeBatchItem(e, i)) };
|
|
1098
|
-
}
|
|
1099
|
-
normalizeBatchItem(entry, index) {
|
|
1100
|
-
if (entry === null || typeof entry !== "object") throw new BadRequestException(`Batch request at index ${index} must be an object.`);
|
|
1101
|
-
const { requestId, path: path2, method, body } = entry;
|
|
1102
|
-
if (requestId !== void 0 && typeof requestId !== "string") throw new BadRequestException(`Batch request at index ${index} has an invalid requestId.`);
|
|
1103
|
-
if (typeof path2 !== "string" || !path2.length) throw new BadRequestException(`Batch request at index ${index} must define a non-empty path.`);
|
|
1104
|
-
if (typeof method !== "string") throw new BadRequestException(`Batch request at index ${index} must define an HTTP method.`);
|
|
1105
|
-
const normalized = method.toUpperCase();
|
|
1106
|
-
if (!isAtomicHttpMethod(normalized)) throw new BadRequestException(`Batch request at index ${index} uses unsupported method ${method}.`);
|
|
1107
|
-
return { requestId, path: path2, method: normalized, body };
|
|
1108
|
-
}
|
|
1109
|
-
fillErrorResponse(response, error, setCritical) {
|
|
1110
|
-
response.body = void 0;
|
|
1111
|
-
if (error instanceof ResponseException) {
|
|
1112
|
-
response.status = error.status;
|
|
1113
|
-
response.error = error.message;
|
|
1114
|
-
response.stack = error.stack;
|
|
1115
|
-
} else if (error instanceof Error) {
|
|
1116
|
-
setCritical(true);
|
|
1117
|
-
response.status = 500;
|
|
1118
|
-
response.error = error.message || "Internal Server Error";
|
|
1119
|
-
response.stack = error.stack;
|
|
1120
|
-
} else {
|
|
1121
|
-
setCritical(true);
|
|
1122
|
-
response.status = 500;
|
|
1123
|
-
response.error = "Unknown error occurred";
|
|
1124
|
-
}
|
|
1125
|
-
}
|
|
1126
|
-
logResponse(request, response, ms, isCritical) {
|
|
1127
|
-
const msg = `< ${response.status} ${request.method} /${request.path} ${Logger.colors.yellow}${Math.round(ms)}ms${Logger.colors.initial}`;
|
|
1128
|
-
if (response.status < 400) Logger.log(msg);
|
|
1129
|
-
else if (response.status < 500) Logger.warn(msg);
|
|
1130
|
-
else isCritical ? Logger.critical(msg) : Logger.error(msg);
|
|
1131
|
-
if (response.error) {
|
|
1132
|
-
isCritical ? Logger.critical(response.error) : Logger.error(response.error);
|
|
1133
|
-
if (response.stack) Logger.errorStack(response.stack);
|
|
1134
|
-
}
|
|
1135
|
-
}
|
|
1136
|
-
};
|
|
1137
|
-
__name(Router, "Router");
|
|
1138
|
-
Router = __decorateClass([
|
|
1139
|
-
Injectable({ lifetime: "singleton" })
|
|
1140
|
-
], Router);
|
|
1141
|
-
}
|
|
1142
|
-
});
|
|
1143
|
-
|
|
1144
327
|
// src/DI/injector-explorer.ts
|
|
328
|
+
var injector_explorer_exports = {};
|
|
329
|
+
__export(injector_explorer_exports, {
|
|
330
|
+
InjectorExplorer: () => InjectorExplorer
|
|
331
|
+
});
|
|
1145
332
|
var _InjectorExplorer, InjectorExplorer;
|
|
1146
333
|
var init_injector_explorer = __esm({
|
|
1147
334
|
"src/DI/injector-explorer.ts"() {
|
|
@@ -1152,6 +339,13 @@ var init_injector_explorer = __esm({
|
|
|
1152
339
|
// -------------------------------------------------------------------------
|
|
1153
340
|
// Public API
|
|
1154
341
|
// -------------------------------------------------------------------------
|
|
342
|
+
/**
|
|
343
|
+
* Sets the callback used to register controllers.
|
|
344
|
+
* Must be called once before processPending (typically by bootstrapApplication).
|
|
345
|
+
*/
|
|
346
|
+
static setControllerRegistrar(registrar) {
|
|
347
|
+
_InjectorExplorer.controllerRegistrar = registrar;
|
|
348
|
+
}
|
|
1155
349
|
static enqueue(reg) {
|
|
1156
350
|
if (_InjectorExplorer.processed && !_InjectorExplorer.accumulating) {
|
|
1157
351
|
_InjectorExplorer._registerImmediate(reg);
|
|
@@ -1177,16 +371,37 @@ var init_injector_explorer = __esm({
|
|
|
1177
371
|
/**
|
|
1178
372
|
* Exits accumulation mode and flushes queued registrations
|
|
1179
373
|
* with the same two-phase guarantee as processPending.
|
|
374
|
+
* Serialised through a lock to prevent concurrent lazy loads from corrupting the queue.
|
|
1180
375
|
*/
|
|
1181
376
|
static flushAccumulated(routeGuards = [], routeMiddlewares = [], pathPrefix = "") {
|
|
1182
|
-
_InjectorExplorer.
|
|
1183
|
-
|
|
377
|
+
_InjectorExplorer.loadingLock = _InjectorExplorer.loadingLock.then(() => {
|
|
378
|
+
_InjectorExplorer.accumulating = false;
|
|
379
|
+
const queue = [..._InjectorExplorer.pending];
|
|
380
|
+
_InjectorExplorer.pending.length = 0;
|
|
381
|
+
_InjectorExplorer._phaseOne(queue);
|
|
382
|
+
for (const reg of queue) {
|
|
383
|
+
if (reg.isController) reg.pathPrefix = pathPrefix;
|
|
384
|
+
}
|
|
385
|
+
_InjectorExplorer._phaseTwo(queue, void 0, routeGuards, routeMiddlewares);
|
|
386
|
+
});
|
|
387
|
+
return _InjectorExplorer.loadingLock;
|
|
388
|
+
}
|
|
389
|
+
/**
|
|
390
|
+
* Returns a Promise that resolves once all pending flushAccumulated calls
|
|
391
|
+
* have completed. Useful for awaiting lazy-load serialisation.
|
|
392
|
+
*/
|
|
393
|
+
static waitForFlush() {
|
|
394
|
+
return _InjectorExplorer.loadingLock;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Resets the explorer state. Intended for tests only.
|
|
398
|
+
*/
|
|
399
|
+
static reset() {
|
|
1184
400
|
_InjectorExplorer.pending.length = 0;
|
|
1185
|
-
_InjectorExplorer.
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
_InjectorExplorer._phaseTwo(queue, void 0, routeGuards, routeMiddlewares);
|
|
401
|
+
_InjectorExplorer.processed = false;
|
|
402
|
+
_InjectorExplorer.accumulating = false;
|
|
403
|
+
_InjectorExplorer.loadingLock = Promise.resolve();
|
|
404
|
+
_InjectorExplorer.controllerRegistrar = null;
|
|
1190
405
|
}
|
|
1191
406
|
// -------------------------------------------------------------------------
|
|
1192
407
|
// Private helpers
|
|
@@ -1197,8 +412,15 @@ var init_injector_explorer = __esm({
|
|
|
1197
412
|
RootInjector.register(reg.key, reg.implementation, reg.lifetime, reg.deps);
|
|
1198
413
|
}
|
|
1199
414
|
}
|
|
1200
|
-
/** Phase 2: resolve singletons and register controllers
|
|
415
|
+
/** Phase 2: validate deps, resolve singletons and register controllers via the registrar callback. */
|
|
1201
416
|
static _phaseTwo(queue, overrides, routeGuards = [], routeMiddlewares = []) {
|
|
417
|
+
for (const reg of queue) {
|
|
418
|
+
for (const dep of reg.deps) {
|
|
419
|
+
if (!RootInjector.bindings.has(dep) && !RootInjector.singletons.has(dep)) {
|
|
420
|
+
Logger.warn(`[Noxus DI] "${reg.implementation.name}" declares dep "${dep.name ?? dep}" which has no binding`);
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
}
|
|
1202
424
|
for (const reg of queue) {
|
|
1203
425
|
if (overrides?.has(reg.key)) {
|
|
1204
426
|
const override = overrides.get(reg.key);
|
|
@@ -1210,9 +432,15 @@ var init_injector_explorer = __esm({
|
|
|
1210
432
|
RootInjector.resolve(reg.key);
|
|
1211
433
|
}
|
|
1212
434
|
if (reg.isController) {
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
435
|
+
if (!_InjectorExplorer.controllerRegistrar) {
|
|
436
|
+
throw new Error("[Noxus DI] No controller registrar set. Call InjectorExplorer.setControllerRegistrar() before processing.");
|
|
437
|
+
}
|
|
438
|
+
_InjectorExplorer.controllerRegistrar(
|
|
439
|
+
reg.implementation,
|
|
440
|
+
reg.pathPrefix ?? "",
|
|
441
|
+
routeGuards,
|
|
442
|
+
routeMiddlewares
|
|
443
|
+
);
|
|
1216
444
|
} else if (reg.lifetime !== "singleton") {
|
|
1217
445
|
Logger.log(`Registered ${reg.implementation.name} as ${reg.lifetime}`);
|
|
1218
446
|
}
|
|
@@ -1223,44 +451,135 @@ var init_injector_explorer = __esm({
|
|
|
1223
451
|
if (reg.lifetime === "singleton") {
|
|
1224
452
|
RootInjector.resolve(reg.key);
|
|
1225
453
|
}
|
|
1226
|
-
if (reg.isController) {
|
|
1227
|
-
|
|
1228
|
-
const router = RootInjector.resolve(Router2);
|
|
1229
|
-
router.registerController(reg.implementation);
|
|
454
|
+
if (reg.isController && _InjectorExplorer.controllerRegistrar) {
|
|
455
|
+
_InjectorExplorer.controllerRegistrar(reg.implementation, "", [], []);
|
|
1230
456
|
}
|
|
1231
457
|
}
|
|
1232
458
|
};
|
|
1233
459
|
__name(_InjectorExplorer, "InjectorExplorer");
|
|
1234
|
-
_InjectorExplorer
|
|
1235
|
-
_InjectorExplorer
|
|
1236
|
-
_InjectorExplorer
|
|
460
|
+
__publicField(_InjectorExplorer, "pending", []);
|
|
461
|
+
__publicField(_InjectorExplorer, "processed", false);
|
|
462
|
+
__publicField(_InjectorExplorer, "accumulating", false);
|
|
463
|
+
__publicField(_InjectorExplorer, "loadingLock", Promise.resolve());
|
|
464
|
+
__publicField(_InjectorExplorer, "controllerRegistrar", null);
|
|
1237
465
|
InjectorExplorer = _InjectorExplorer;
|
|
1238
466
|
}
|
|
1239
467
|
});
|
|
1240
468
|
|
|
1241
|
-
// src/
|
|
1242
|
-
function
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
isController: false
|
|
1255
|
-
});
|
|
1256
|
-
};
|
|
469
|
+
// src/DI/app-injector.ts
|
|
470
|
+
function keyOf(k) {
|
|
471
|
+
return k;
|
|
472
|
+
}
|
|
473
|
+
function resetRootInjector() {
|
|
474
|
+
RootInjector.bindings.clear();
|
|
475
|
+
RootInjector.singletons.clear();
|
|
476
|
+
RootInjector.scoped.clear();
|
|
477
|
+
const { InjectorExplorer: InjectorExplorer2 } = (init_injector_explorer(), __toCommonJS(injector_explorer_exports));
|
|
478
|
+
InjectorExplorer2.reset();
|
|
479
|
+
}
|
|
480
|
+
function inject(t) {
|
|
481
|
+
return RootInjector.resolve(t);
|
|
1257
482
|
}
|
|
1258
|
-
var
|
|
1259
|
-
|
|
483
|
+
var _AppInjector, AppInjector, RootInjector;
|
|
484
|
+
var init_app_injector = __esm({
|
|
485
|
+
"src/DI/app-injector.ts"() {
|
|
1260
486
|
"use strict";
|
|
1261
|
-
|
|
487
|
+
init_forward_ref();
|
|
1262
488
|
init_token();
|
|
1263
|
-
__name(
|
|
489
|
+
__name(keyOf, "keyOf");
|
|
490
|
+
_AppInjector = class _AppInjector {
|
|
491
|
+
constructor(name = null) {
|
|
492
|
+
this.name = name;
|
|
493
|
+
__publicField(this, "bindings", /* @__PURE__ */ new Map());
|
|
494
|
+
__publicField(this, "singletons", /* @__PURE__ */ new Map());
|
|
495
|
+
__publicField(this, "scoped", /* @__PURE__ */ new Map());
|
|
496
|
+
}
|
|
497
|
+
/**
|
|
498
|
+
* Creates a child scope for per-request lifetime resolution.
|
|
499
|
+
*/
|
|
500
|
+
createScope() {
|
|
501
|
+
const scope = new _AppInjector();
|
|
502
|
+
scope.bindings = this.bindings;
|
|
503
|
+
scope.singletons = this.singletons;
|
|
504
|
+
return scope;
|
|
505
|
+
}
|
|
506
|
+
/**
|
|
507
|
+
* Registers a binding explicitly.
|
|
508
|
+
*/
|
|
509
|
+
register(key, implementation, lifetime, deps = []) {
|
|
510
|
+
const k = keyOf(key);
|
|
511
|
+
if (!this.bindings.has(k)) {
|
|
512
|
+
this.bindings.set(k, { lifetime, implementation, deps });
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
/**
|
|
516
|
+
* Resolves a dependency by token or class reference.
|
|
517
|
+
*/
|
|
518
|
+
resolve(target) {
|
|
519
|
+
if (target instanceof ForwardReference) {
|
|
520
|
+
return this._resolveForwardRef(target);
|
|
521
|
+
}
|
|
522
|
+
const k = keyOf(target);
|
|
523
|
+
if (this.singletons.has(k)) {
|
|
524
|
+
return this.singletons.get(k);
|
|
525
|
+
}
|
|
526
|
+
const binding = this.bindings.get(k);
|
|
527
|
+
if (!binding) {
|
|
528
|
+
const name = target instanceof Token ? target.description : target.name ?? "unknown";
|
|
529
|
+
throw new Error(
|
|
530
|
+
`[Noxus DI] No binding found for "${name}".
|
|
531
|
+
Did you forget to declare it in @Injectable({ deps }) or in bootstrapApplication({ singletons })?`
|
|
532
|
+
);
|
|
533
|
+
}
|
|
534
|
+
switch (binding.lifetime) {
|
|
535
|
+
case "transient":
|
|
536
|
+
return this._instantiate(binding);
|
|
537
|
+
case "scope": {
|
|
538
|
+
if (this.scoped.has(k)) return this.scoped.get(k);
|
|
539
|
+
const inst = this._instantiate(binding);
|
|
540
|
+
this.scoped.set(k, inst);
|
|
541
|
+
return inst;
|
|
542
|
+
}
|
|
543
|
+
case "singleton": {
|
|
544
|
+
if (this.singletons.has(k)) return this.singletons.get(k);
|
|
545
|
+
const inst = this._instantiate(binding);
|
|
546
|
+
this.singletons.set(k, inst);
|
|
547
|
+
if (binding.instance === void 0) {
|
|
548
|
+
binding.instance = inst;
|
|
549
|
+
}
|
|
550
|
+
return inst;
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
}
|
|
554
|
+
// -------------------------------------------------------------------------
|
|
555
|
+
_resolveForwardRef(ref) {
|
|
556
|
+
let resolved;
|
|
557
|
+
return new Proxy({}, {
|
|
558
|
+
get: /* @__PURE__ */ __name((_obj, prop, receiver) => {
|
|
559
|
+
resolved ?? (resolved = this.resolve(ref.forwardRefFn()));
|
|
560
|
+
const value = Reflect.get(resolved, prop, receiver);
|
|
561
|
+
return typeof value === "function" ? value.bind(resolved) : value;
|
|
562
|
+
}, "get"),
|
|
563
|
+
set: /* @__PURE__ */ __name((_obj, prop, value, receiver) => {
|
|
564
|
+
resolved ?? (resolved = this.resolve(ref.forwardRefFn()));
|
|
565
|
+
return Reflect.set(resolved, prop, value, receiver);
|
|
566
|
+
}, "set"),
|
|
567
|
+
getPrototypeOf: /* @__PURE__ */ __name(() => {
|
|
568
|
+
resolved ?? (resolved = this.resolve(ref.forwardRefFn()));
|
|
569
|
+
return Object.getPrototypeOf(resolved);
|
|
570
|
+
}, "getPrototypeOf")
|
|
571
|
+
});
|
|
572
|
+
}
|
|
573
|
+
_instantiate(binding) {
|
|
574
|
+
const resolvedDeps = binding.deps.map((dep) => this.resolve(dep));
|
|
575
|
+
return new binding.implementation(...resolvedDeps);
|
|
576
|
+
}
|
|
577
|
+
};
|
|
578
|
+
__name(_AppInjector, "AppInjector");
|
|
579
|
+
AppInjector = _AppInjector;
|
|
580
|
+
RootInjector = new AppInjector("root");
|
|
581
|
+
__name(resetRootInjector, "resetRootInjector");
|
|
582
|
+
__name(inject, "inject");
|
|
1264
583
|
}
|
|
1265
584
|
});
|
|
1266
585
|
|
|
@@ -1298,12 +617,235 @@ __export(non_electron_process_exports, {
|
|
|
1298
617
|
UpgradeRequiredException: () => UpgradeRequiredException,
|
|
1299
618
|
VariantAlsoNegotiatesException: () => VariantAlsoNegotiatesException,
|
|
1300
619
|
forwardRef: () => forwardRef,
|
|
1301
|
-
inject: () => inject
|
|
620
|
+
inject: () => inject,
|
|
621
|
+
resetRootInjector: () => resetRootInjector
|
|
1302
622
|
});
|
|
1303
623
|
module.exports = __toCommonJS(non_electron_process_exports);
|
|
1304
624
|
init_app_injector();
|
|
1305
|
-
|
|
1306
|
-
|
|
625
|
+
|
|
626
|
+
// src/internal/exceptions.ts
|
|
627
|
+
var _ResponseException = class _ResponseException extends Error {
|
|
628
|
+
constructor(statusOrMessage, message) {
|
|
629
|
+
let statusCode;
|
|
630
|
+
if (typeof statusOrMessage === "number") {
|
|
631
|
+
statusCode = statusOrMessage;
|
|
632
|
+
} else if (typeof statusOrMessage === "string") {
|
|
633
|
+
message = statusOrMessage;
|
|
634
|
+
}
|
|
635
|
+
super(message ?? "");
|
|
636
|
+
__publicField(this, "status", 0);
|
|
637
|
+
if (statusCode !== void 0) {
|
|
638
|
+
this.status = statusCode;
|
|
639
|
+
}
|
|
640
|
+
this.name = this.constructor.name.replace(/([A-Z])/g, " $1");
|
|
641
|
+
}
|
|
642
|
+
};
|
|
643
|
+
__name(_ResponseException, "ResponseException");
|
|
644
|
+
var ResponseException = _ResponseException;
|
|
645
|
+
var _BadRequestException = class _BadRequestException extends ResponseException {
|
|
646
|
+
constructor() {
|
|
647
|
+
super(...arguments);
|
|
648
|
+
__publicField(this, "status", 400);
|
|
649
|
+
}
|
|
650
|
+
};
|
|
651
|
+
__name(_BadRequestException, "BadRequestException");
|
|
652
|
+
var BadRequestException = _BadRequestException;
|
|
653
|
+
var _UnauthorizedException = class _UnauthorizedException extends ResponseException {
|
|
654
|
+
constructor() {
|
|
655
|
+
super(...arguments);
|
|
656
|
+
__publicField(this, "status", 401);
|
|
657
|
+
}
|
|
658
|
+
};
|
|
659
|
+
__name(_UnauthorizedException, "UnauthorizedException");
|
|
660
|
+
var UnauthorizedException = _UnauthorizedException;
|
|
661
|
+
var _PaymentRequiredException = class _PaymentRequiredException extends ResponseException {
|
|
662
|
+
constructor() {
|
|
663
|
+
super(...arguments);
|
|
664
|
+
__publicField(this, "status", 402);
|
|
665
|
+
}
|
|
666
|
+
};
|
|
667
|
+
__name(_PaymentRequiredException, "PaymentRequiredException");
|
|
668
|
+
var PaymentRequiredException = _PaymentRequiredException;
|
|
669
|
+
var _ForbiddenException = class _ForbiddenException extends ResponseException {
|
|
670
|
+
constructor() {
|
|
671
|
+
super(...arguments);
|
|
672
|
+
__publicField(this, "status", 403);
|
|
673
|
+
}
|
|
674
|
+
};
|
|
675
|
+
__name(_ForbiddenException, "ForbiddenException");
|
|
676
|
+
var ForbiddenException = _ForbiddenException;
|
|
677
|
+
var _NotFoundException = class _NotFoundException extends ResponseException {
|
|
678
|
+
constructor() {
|
|
679
|
+
super(...arguments);
|
|
680
|
+
__publicField(this, "status", 404);
|
|
681
|
+
}
|
|
682
|
+
};
|
|
683
|
+
__name(_NotFoundException, "NotFoundException");
|
|
684
|
+
var NotFoundException = _NotFoundException;
|
|
685
|
+
var _MethodNotAllowedException = class _MethodNotAllowedException extends ResponseException {
|
|
686
|
+
constructor() {
|
|
687
|
+
super(...arguments);
|
|
688
|
+
__publicField(this, "status", 405);
|
|
689
|
+
}
|
|
690
|
+
};
|
|
691
|
+
__name(_MethodNotAllowedException, "MethodNotAllowedException");
|
|
692
|
+
var MethodNotAllowedException = _MethodNotAllowedException;
|
|
693
|
+
var _NotAcceptableException = class _NotAcceptableException extends ResponseException {
|
|
694
|
+
constructor() {
|
|
695
|
+
super(...arguments);
|
|
696
|
+
__publicField(this, "status", 406);
|
|
697
|
+
}
|
|
698
|
+
};
|
|
699
|
+
__name(_NotAcceptableException, "NotAcceptableException");
|
|
700
|
+
var NotAcceptableException = _NotAcceptableException;
|
|
701
|
+
var _RequestTimeoutException = class _RequestTimeoutException extends ResponseException {
|
|
702
|
+
constructor() {
|
|
703
|
+
super(...arguments);
|
|
704
|
+
__publicField(this, "status", 408);
|
|
705
|
+
}
|
|
706
|
+
};
|
|
707
|
+
__name(_RequestTimeoutException, "RequestTimeoutException");
|
|
708
|
+
var RequestTimeoutException = _RequestTimeoutException;
|
|
709
|
+
var _ConflictException = class _ConflictException extends ResponseException {
|
|
710
|
+
constructor() {
|
|
711
|
+
super(...arguments);
|
|
712
|
+
__publicField(this, "status", 409);
|
|
713
|
+
}
|
|
714
|
+
};
|
|
715
|
+
__name(_ConflictException, "ConflictException");
|
|
716
|
+
var ConflictException = _ConflictException;
|
|
717
|
+
var _UpgradeRequiredException = class _UpgradeRequiredException extends ResponseException {
|
|
718
|
+
constructor() {
|
|
719
|
+
super(...arguments);
|
|
720
|
+
__publicField(this, "status", 426);
|
|
721
|
+
}
|
|
722
|
+
};
|
|
723
|
+
__name(_UpgradeRequiredException, "UpgradeRequiredException");
|
|
724
|
+
var UpgradeRequiredException = _UpgradeRequiredException;
|
|
725
|
+
var _TooManyRequestsException = class _TooManyRequestsException extends ResponseException {
|
|
726
|
+
constructor() {
|
|
727
|
+
super(...arguments);
|
|
728
|
+
__publicField(this, "status", 429);
|
|
729
|
+
}
|
|
730
|
+
};
|
|
731
|
+
__name(_TooManyRequestsException, "TooManyRequestsException");
|
|
732
|
+
var TooManyRequestsException = _TooManyRequestsException;
|
|
733
|
+
var _InternalServerException = class _InternalServerException extends ResponseException {
|
|
734
|
+
constructor() {
|
|
735
|
+
super(...arguments);
|
|
736
|
+
__publicField(this, "status", 500);
|
|
737
|
+
}
|
|
738
|
+
};
|
|
739
|
+
__name(_InternalServerException, "InternalServerException");
|
|
740
|
+
var InternalServerException = _InternalServerException;
|
|
741
|
+
var _NotImplementedException = class _NotImplementedException extends ResponseException {
|
|
742
|
+
constructor() {
|
|
743
|
+
super(...arguments);
|
|
744
|
+
__publicField(this, "status", 501);
|
|
745
|
+
}
|
|
746
|
+
};
|
|
747
|
+
__name(_NotImplementedException, "NotImplementedException");
|
|
748
|
+
var NotImplementedException = _NotImplementedException;
|
|
749
|
+
var _BadGatewayException = class _BadGatewayException extends ResponseException {
|
|
750
|
+
constructor() {
|
|
751
|
+
super(...arguments);
|
|
752
|
+
__publicField(this, "status", 502);
|
|
753
|
+
}
|
|
754
|
+
};
|
|
755
|
+
__name(_BadGatewayException, "BadGatewayException");
|
|
756
|
+
var BadGatewayException = _BadGatewayException;
|
|
757
|
+
var _ServiceUnavailableException = class _ServiceUnavailableException extends ResponseException {
|
|
758
|
+
constructor() {
|
|
759
|
+
super(...arguments);
|
|
760
|
+
__publicField(this, "status", 503);
|
|
761
|
+
}
|
|
762
|
+
};
|
|
763
|
+
__name(_ServiceUnavailableException, "ServiceUnavailableException");
|
|
764
|
+
var ServiceUnavailableException = _ServiceUnavailableException;
|
|
765
|
+
var _GatewayTimeoutException = class _GatewayTimeoutException extends ResponseException {
|
|
766
|
+
constructor() {
|
|
767
|
+
super(...arguments);
|
|
768
|
+
__publicField(this, "status", 504);
|
|
769
|
+
}
|
|
770
|
+
};
|
|
771
|
+
__name(_GatewayTimeoutException, "GatewayTimeoutException");
|
|
772
|
+
var GatewayTimeoutException = _GatewayTimeoutException;
|
|
773
|
+
var _HttpVersionNotSupportedException = class _HttpVersionNotSupportedException extends ResponseException {
|
|
774
|
+
constructor() {
|
|
775
|
+
super(...arguments);
|
|
776
|
+
__publicField(this, "status", 505);
|
|
777
|
+
}
|
|
778
|
+
};
|
|
779
|
+
__name(_HttpVersionNotSupportedException, "HttpVersionNotSupportedException");
|
|
780
|
+
var HttpVersionNotSupportedException = _HttpVersionNotSupportedException;
|
|
781
|
+
var _VariantAlsoNegotiatesException = class _VariantAlsoNegotiatesException extends ResponseException {
|
|
782
|
+
constructor() {
|
|
783
|
+
super(...arguments);
|
|
784
|
+
__publicField(this, "status", 506);
|
|
785
|
+
}
|
|
786
|
+
};
|
|
787
|
+
__name(_VariantAlsoNegotiatesException, "VariantAlsoNegotiatesException");
|
|
788
|
+
var VariantAlsoNegotiatesException = _VariantAlsoNegotiatesException;
|
|
789
|
+
var _InsufficientStorageException = class _InsufficientStorageException extends ResponseException {
|
|
790
|
+
constructor() {
|
|
791
|
+
super(...arguments);
|
|
792
|
+
__publicField(this, "status", 507);
|
|
793
|
+
}
|
|
794
|
+
};
|
|
795
|
+
__name(_InsufficientStorageException, "InsufficientStorageException");
|
|
796
|
+
var InsufficientStorageException = _InsufficientStorageException;
|
|
797
|
+
var _LoopDetectedException = class _LoopDetectedException extends ResponseException {
|
|
798
|
+
constructor() {
|
|
799
|
+
super(...arguments);
|
|
800
|
+
__publicField(this, "status", 508);
|
|
801
|
+
}
|
|
802
|
+
};
|
|
803
|
+
__name(_LoopDetectedException, "LoopDetectedException");
|
|
804
|
+
var LoopDetectedException = _LoopDetectedException;
|
|
805
|
+
var _NotExtendedException = class _NotExtendedException extends ResponseException {
|
|
806
|
+
constructor() {
|
|
807
|
+
super(...arguments);
|
|
808
|
+
__publicField(this, "status", 510);
|
|
809
|
+
}
|
|
810
|
+
};
|
|
811
|
+
__name(_NotExtendedException, "NotExtendedException");
|
|
812
|
+
var NotExtendedException = _NotExtendedException;
|
|
813
|
+
var _NetworkAuthenticationRequiredException = class _NetworkAuthenticationRequiredException extends ResponseException {
|
|
814
|
+
constructor() {
|
|
815
|
+
super(...arguments);
|
|
816
|
+
__publicField(this, "status", 511);
|
|
817
|
+
}
|
|
818
|
+
};
|
|
819
|
+
__name(_NetworkAuthenticationRequiredException, "NetworkAuthenticationRequiredException");
|
|
820
|
+
var NetworkAuthenticationRequiredException = _NetworkAuthenticationRequiredException;
|
|
821
|
+
var _NetworkConnectTimeoutException = class _NetworkConnectTimeoutException extends ResponseException {
|
|
822
|
+
constructor() {
|
|
823
|
+
super(...arguments);
|
|
824
|
+
__publicField(this, "status", 599);
|
|
825
|
+
}
|
|
826
|
+
};
|
|
827
|
+
__name(_NetworkConnectTimeoutException, "NetworkConnectTimeoutException");
|
|
828
|
+
var NetworkConnectTimeoutException = _NetworkConnectTimeoutException;
|
|
829
|
+
|
|
830
|
+
// src/decorators/injectable.decorator.ts
|
|
831
|
+
init_injector_explorer();
|
|
832
|
+
init_token();
|
|
833
|
+
function Injectable(options = {}) {
|
|
834
|
+
const { lifetime = "scope", deps = [] } = options;
|
|
835
|
+
return (target, _context) => {
|
|
836
|
+
const key = target;
|
|
837
|
+
InjectorExplorer.enqueue({
|
|
838
|
+
key,
|
|
839
|
+
implementation: key,
|
|
840
|
+
lifetime,
|
|
841
|
+
deps,
|
|
842
|
+
isController: false
|
|
843
|
+
});
|
|
844
|
+
};
|
|
845
|
+
}
|
|
846
|
+
__name(Injectable, "Injectable");
|
|
847
|
+
|
|
848
|
+
// src/non-electron-process.ts
|
|
1307
849
|
init_logger();
|
|
1308
850
|
init_forward_ref();
|
|
1309
851
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1339,7 +881,8 @@ init_forward_ref();
|
|
|
1339
881
|
UpgradeRequiredException,
|
|
1340
882
|
VariantAlsoNegotiatesException,
|
|
1341
883
|
forwardRef,
|
|
1342
|
-
inject
|
|
884
|
+
inject,
|
|
885
|
+
resetRootInjector
|
|
1343
886
|
});
|
|
1344
887
|
/**
|
|
1345
888
|
* @copyright 2025 NoxFly
|