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