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