@navios/commander 0.7.1 → 0.9.0
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/CHANGELOG.md +12 -0
- package/dist/src/decorators/cli-module.decorator.d.mts +12 -2
- package/dist/src/decorators/cli-module.decorator.d.mts.map +1 -1
- package/dist/src/decorators/command.decorator.d.mts +12 -2
- package/dist/src/decorators/command.decorator.d.mts.map +1 -1
- package/dist/src/services/module-loader.service.d.mts.map +1 -1
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/lib/index.cjs +581 -186
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +27 -3
- package/lib/index.d.cts.map +1 -1
- package/lib/index.d.mts +27 -3
- package/lib/index.d.mts.map +1 -1
- package/lib/index.mjs +573 -187
- package/lib/index.mjs.map +1 -1
- package/package.json +2 -2
- package/src/decorators/cli-module.decorator.mts +14 -2
- package/src/decorators/command.decorator.mts +19 -2
- package/src/services/module-loader.service.mts +3 -2
package/lib/index.cjs
CHANGED
|
@@ -46,7 +46,7 @@ zod_v4 = __toESM(zod_v4);
|
|
|
46
46
|
let util = require("util");
|
|
47
47
|
let node_async_hooks = require("node:async_hooks");
|
|
48
48
|
|
|
49
|
-
//#region ../core/lib/use-guards.decorator-
|
|
49
|
+
//#region ../core/lib/use-guards.decorator-CzVXuLkz.mjs
|
|
50
50
|
const EndpointMetadataKey = Symbol("EndpointMetadataKey");
|
|
51
51
|
function getAllEndpointMetadata(context) {
|
|
52
52
|
if (context.metadata) {
|
|
@@ -139,13 +139,13 @@ function hasModuleMetadata(target) {
|
|
|
139
139
|
}
|
|
140
140
|
/**
|
|
141
141
|
* Decorator that marks a class as a Navios controller.
|
|
142
|
-
*
|
|
142
|
+
*
|
|
143
143
|
* Controllers handle HTTP requests and define endpoints.
|
|
144
144
|
* They are request-scoped by default, meaning a new instance is created for each request.
|
|
145
|
-
*
|
|
145
|
+
*
|
|
146
146
|
* @param options - Controller configuration options
|
|
147
147
|
* @returns A class decorator
|
|
148
|
-
*
|
|
148
|
+
*
|
|
149
149
|
* @example
|
|
150
150
|
* ```typescript
|
|
151
151
|
* @Controller({ guards: [AuthGuard] })
|
|
@@ -156,7 +156,7 @@ function hasModuleMetadata(target) {
|
|
|
156
156
|
* }
|
|
157
157
|
* }
|
|
158
158
|
* ```
|
|
159
|
-
*/ function Controller({ guards } = {}) {
|
|
159
|
+
*/ function Controller({ guards, registry, priority, scope } = {}) {
|
|
160
160
|
return function(target, context) {
|
|
161
161
|
if (context.kind !== "class") throw new Error("[Navios] @Controller decorator can only be used on classes.");
|
|
162
162
|
const token = _navios_di.InjectionToken.create(target);
|
|
@@ -166,7 +166,9 @@ function hasModuleMetadata(target) {
|
|
|
166
166
|
}
|
|
167
167
|
return (0, _navios_di.Injectable)({
|
|
168
168
|
token,
|
|
169
|
-
|
|
169
|
+
registry,
|
|
170
|
+
priority,
|
|
171
|
+
scope
|
|
170
172
|
})(target, context);
|
|
171
173
|
};
|
|
172
174
|
}
|
|
@@ -175,40 +177,12 @@ const ExecutionContextInjectionToken = "ExecutionContextInjectionToken";
|
|
|
175
177
|
const ExecutionContext = _navios_di.InjectionToken.create(ExecutionContextInjectionToken);
|
|
176
178
|
const HttpAdapterToken = _navios_di.InjectionToken.create("HttpAdapterToken");
|
|
177
179
|
const MultipartAdapterToken = _navios_di.InjectionToken.create("MultipartAdapterToken");
|
|
180
|
+
const NaviosOptionsToken = _navios_di.InjectionToken.create("NaviosOptionsToken");
|
|
178
181
|
const Reply = _navios_di.InjectionToken.create("ReplyToken");
|
|
179
182
|
const Request = _navios_di.InjectionToken.create("RequestToken");
|
|
180
183
|
const StreamAdapterToken = _navios_di.InjectionToken.create("StreamAdapterToken");
|
|
181
184
|
const XmlStreamAdapterToken = _navios_di.InjectionToken.create("XmlStreamAdapterToken");
|
|
182
|
-
|
|
183
|
-
* Decorator that marks a method as an HTTP endpoint.
|
|
184
|
-
*
|
|
185
|
-
* The endpoint must be defined using @navios/builder's `declareEndpoint` method.
|
|
186
|
-
* This ensures type safety and consistency between client and server.
|
|
187
|
-
*
|
|
188
|
-
* @param endpoint - The endpoint declaration from @navios/builder
|
|
189
|
-
* @returns A method decorator
|
|
190
|
-
*
|
|
191
|
-
* @example
|
|
192
|
-
* ```typescript
|
|
193
|
-
* import { builder } from '@navios/builder'
|
|
194
|
-
*
|
|
195
|
-
* const api = builder()
|
|
196
|
-
* const getUserEndpoint = api.declareEndpoint({
|
|
197
|
-
* method: 'get',
|
|
198
|
-
* url: '/users/$userId',
|
|
199
|
-
* responseSchema: z.object({ id: z.string(), name: z.string() }),
|
|
200
|
-
* })
|
|
201
|
-
*
|
|
202
|
-
* @Controller()
|
|
203
|
-
* export class UserController {
|
|
204
|
-
* @Endpoint(getUserEndpoint)
|
|
205
|
-
* async getUser(request: EndpointParams<typeof getUserEndpoint>) {
|
|
206
|
-
* const { userId } = request.urlParams
|
|
207
|
-
* return { id: userId, name: 'John' }
|
|
208
|
-
* }
|
|
209
|
-
* }
|
|
210
|
-
* ```
|
|
211
|
-
*/ function Endpoint(endpoint) {
|
|
185
|
+
function Endpoint(endpoint) {
|
|
212
186
|
return (target, context) => {
|
|
213
187
|
if (context.kind !== "method") throw new Error("[Navios] Endpoint decorator can only be used on methods.");
|
|
214
188
|
const config = endpoint.config;
|
|
@@ -279,13 +253,13 @@ const XmlStreamAdapterToken = _navios_di.InjectionToken.create("XmlStreamAdapter
|
|
|
279
253
|
}
|
|
280
254
|
/**
|
|
281
255
|
* Decorator that marks a class as a Navios module.
|
|
282
|
-
*
|
|
256
|
+
*
|
|
283
257
|
* Modules are the basic building blocks of a Navios application.
|
|
284
258
|
* They organize controllers, services, and other modules into logical units.
|
|
285
|
-
*
|
|
259
|
+
*
|
|
286
260
|
* @param options - Module configuration options
|
|
287
261
|
* @returns A class decorator
|
|
288
|
-
*
|
|
262
|
+
*
|
|
289
263
|
* @example
|
|
290
264
|
* ```typescript
|
|
291
265
|
* @Module({
|
|
@@ -295,7 +269,7 @@ const XmlStreamAdapterToken = _navios_di.InjectionToken.create("XmlStreamAdapter
|
|
|
295
269
|
* })
|
|
296
270
|
* export class AppModule {}
|
|
297
271
|
* ```
|
|
298
|
-
*/ function Module({ controllers = [], imports = [], guards = [] } = {
|
|
272
|
+
*/ function Module({ controllers = [], imports = [], guards = [], priority, registry } = {
|
|
299
273
|
controllers: [],
|
|
300
274
|
imports: [],
|
|
301
275
|
guards: []
|
|
@@ -309,41 +283,14 @@ const XmlStreamAdapterToken = _navios_di.InjectionToken.create("XmlStreamAdapter
|
|
|
309
283
|
for (const guard of Array.from(guards).reverse()) moduleMetadata.guards.add(guard);
|
|
310
284
|
return (0, _navios_di.Injectable)({
|
|
311
285
|
token,
|
|
312
|
-
scope: _navios_di.InjectableScope.Singleton
|
|
286
|
+
scope: _navios_di.InjectableScope.Singleton,
|
|
287
|
+
priority,
|
|
288
|
+
registry
|
|
313
289
|
})(target, context);
|
|
314
290
|
};
|
|
315
291
|
}
|
|
316
|
-
|
|
317
|
-
* Decorator that marks a method as a multipart/form-data endpoint.
|
|
318
|
-
*
|
|
319
|
-
* Use this decorator for endpoints that handle file uploads or form data.
|
|
320
|
-
* The endpoint must be defined using @navios/builder's `declareMultipart` method.
|
|
321
|
-
*
|
|
322
|
-
* @param endpoint - The multipart endpoint declaration from @navios/builder
|
|
323
|
-
* @returns A method decorator
|
|
324
|
-
*
|
|
325
|
-
* @example
|
|
326
|
-
* ```typescript
|
|
327
|
-
* const uploadFileEndpoint = api.declareMultipart({
|
|
328
|
-
* method: 'post',
|
|
329
|
-
* url: '/upload',
|
|
330
|
-
* requestSchema: z.object({ file: z.instanceof(File) }),
|
|
331
|
-
* responseSchema: z.object({ url: z.string() }),
|
|
332
|
-
* })
|
|
333
|
-
*
|
|
334
|
-
* @Controller()
|
|
335
|
-
* export class FileController {
|
|
336
|
-
* @Multipart(uploadFileEndpoint)
|
|
337
|
-
* async uploadFile(request: MultipartParams<typeof uploadFileEndpoint>) {
|
|
338
|
-
* const { file } = request.data
|
|
339
|
-
* // Handle file upload
|
|
340
|
-
* return { url: 'https://example.com/file.jpg' }
|
|
341
|
-
* }
|
|
342
|
-
* }
|
|
343
|
-
* ```
|
|
344
|
-
*/ function Multipart(endpoint) {
|
|
292
|
+
function Multipart(endpoint) {
|
|
345
293
|
return (target, context) => {
|
|
346
|
-
if (typeof target !== "function") throw new Error("[Navios] Endpoint decorator can only be used on functions.");
|
|
347
294
|
if (context.kind !== "method") throw new Error("[Navios] Endpoint decorator can only be used on methods.");
|
|
348
295
|
const config = endpoint.config;
|
|
349
296
|
if (context.metadata) {
|
|
@@ -358,34 +305,8 @@ const XmlStreamAdapterToken = _navios_di.InjectionToken.create("XmlStreamAdapter
|
|
|
358
305
|
return target;
|
|
359
306
|
};
|
|
360
307
|
}
|
|
361
|
-
|
|
362
|
-
* Decorator that marks a method as a streaming endpoint.
|
|
363
|
-
*
|
|
364
|
-
* Use this decorator for endpoints that stream data (e.g., file downloads, SSE).
|
|
365
|
-
* The endpoint must be defined using @navios/builder's `declareStream` method.
|
|
366
|
-
*
|
|
367
|
-
* @param endpoint - The stream endpoint declaration from @navios/builder
|
|
368
|
-
* @returns A method decorator
|
|
369
|
-
*
|
|
370
|
-
* @example
|
|
371
|
-
* ```typescript
|
|
372
|
-
* const downloadFileEndpoint = api.declareStream({
|
|
373
|
-
* method: 'get',
|
|
374
|
-
* url: '/files/$fileId',
|
|
375
|
-
* })
|
|
376
|
-
*
|
|
377
|
-
* @Controller()
|
|
378
|
-
* export class FileController {
|
|
379
|
-
* @Stream(downloadFileEndpoint)
|
|
380
|
-
* async downloadFile(request: StreamParams<typeof downloadFileEndpoint>, reply: any) {
|
|
381
|
-
* const { fileId } = request.urlParams
|
|
382
|
-
* // Stream file data to reply
|
|
383
|
-
* }
|
|
384
|
-
* }
|
|
385
|
-
* ```
|
|
386
|
-
*/ function Stream(endpoint) {
|
|
308
|
+
function Stream(endpoint) {
|
|
387
309
|
return (target, context) => {
|
|
388
|
-
if (typeof target !== "function") throw new Error("[Navios] Endpoint decorator can only be used on functions.");
|
|
389
310
|
if (context.kind !== "method") throw new Error("[Navios] Endpoint decorator can only be used on methods.");
|
|
390
311
|
const config = endpoint.config;
|
|
391
312
|
if (context.metadata) {
|
|
@@ -468,7 +389,7 @@ const XmlStreamAdapterToken = _navios_di.InjectionToken.create("XmlStreamAdapter
|
|
|
468
389
|
};
|
|
469
390
|
|
|
470
391
|
//#endregion
|
|
471
|
-
//#region ../core/lib/src-
|
|
392
|
+
//#region ../core/lib/src-Bo23RIo-.mjs
|
|
472
393
|
function envInt(key, defaultValue) {
|
|
473
394
|
const envKey = node_process.env[key] || process.env[key];
|
|
474
395
|
return envKey ? parseInt(envKey, 10) : defaultValue;
|
|
@@ -551,6 +472,15 @@ const isConstructor = (val) => val === "constructor";
|
|
|
551
472
|
const isNil = (val) => isUndefined(val) || val === null;
|
|
552
473
|
const isEmpty = (array) => !(array && array.length > 0);
|
|
553
474
|
const isSymbol = (val) => typeof val === "symbol";
|
|
475
|
+
let requestCounter = 0;
|
|
476
|
+
/**
|
|
477
|
+
* Generates a simple incremental request ID.
|
|
478
|
+
* Much faster than crypto.randomUUID() and sufficient for request tracking.
|
|
479
|
+
*
|
|
480
|
+
* @returns A unique request ID string (e.g., "req-1", "req-2", ...)
|
|
481
|
+
*/ function generateRequestId() {
|
|
482
|
+
return `req-${++requestCounter}`;
|
|
483
|
+
}
|
|
554
484
|
/**
|
|
555
485
|
* AsyncLocalStorage store for the current request ID.
|
|
556
486
|
*
|
|
@@ -570,22 +500,42 @@ const isSymbol = (val) => typeof val === "symbol";
|
|
|
570
500
|
* // Get current request ID (returns undefined if not in a request context)
|
|
571
501
|
* const currentId = getRequestId()
|
|
572
502
|
* ```
|
|
573
|
-
*/
|
|
503
|
+
*/ let requestIdStore = null;
|
|
504
|
+
function getRequestIdStore() {
|
|
505
|
+
if (!requestIdStore) requestIdStore = new node_async_hooks.AsyncLocalStorage();
|
|
506
|
+
return requestIdStore;
|
|
507
|
+
}
|
|
508
|
+
/**
|
|
509
|
+
* Whether request ID propagation is enabled.
|
|
510
|
+
* When disabled, runWithRequestId is a pass-through for better performance.
|
|
511
|
+
*/ let requestIdEnabled = false;
|
|
512
|
+
/**
|
|
513
|
+
* Enables or disables request ID propagation.
|
|
514
|
+
* Called by NaviosFactory based on the enableRequestId option.
|
|
515
|
+
*
|
|
516
|
+
* @param enabled - Whether to enable request ID propagation
|
|
517
|
+
*/ function setRequestIdEnabled(enabled) {
|
|
518
|
+
requestIdEnabled = enabled;
|
|
519
|
+
}
|
|
574
520
|
/**
|
|
575
521
|
* Runs a function with a request ID in the async local storage context.
|
|
522
|
+
* If request ID propagation is disabled, the function is called directly
|
|
523
|
+
* without AsyncLocalStorage overhead.
|
|
576
524
|
*
|
|
577
525
|
* @param requestId - The request ID to set for this context
|
|
578
526
|
* @param fn - The function to run within this context
|
|
579
527
|
* @returns The return value of the function
|
|
580
528
|
*/ function runWithRequestId(requestId, fn) {
|
|
581
|
-
|
|
529
|
+
if (!requestIdEnabled) return fn();
|
|
530
|
+
return getRequestIdStore().run(requestId, fn);
|
|
582
531
|
}
|
|
583
532
|
/**
|
|
584
533
|
* Gets the current request ID from the async local storage context.
|
|
585
534
|
*
|
|
586
535
|
* @returns The current request ID, or undefined if not in a request context
|
|
587
536
|
*/ function getRequestId() {
|
|
588
|
-
|
|
537
|
+
if (!requestIdEnabled) return;
|
|
538
|
+
return getRequestIdStore().getStore();
|
|
589
539
|
}
|
|
590
540
|
/**
|
|
591
541
|
* Injection token for the logger output service.
|
|
@@ -607,7 +557,7 @@ const isSymbol = (val) => typeof val === "symbol";
|
|
|
607
557
|
* logger.log('Hello world') // Logs with context: [MyService]
|
|
608
558
|
* ```
|
|
609
559
|
*/ const Logger = _navios_di.InjectionToken.create("Logger", loggerOptionsSchema);
|
|
610
|
-
function applyDecs2203RFactory$
|
|
560
|
+
function applyDecs2203RFactory$14() {
|
|
611
561
|
function createAddInitializerMethod(initializers, decoratorFinishedRef) {
|
|
612
562
|
return function addInitializer(initializer) {
|
|
613
563
|
assertNotFinished(decoratorFinishedRef, "addInitializer");
|
|
@@ -881,10 +831,10 @@ function applyDecs2203RFactory$13() {
|
|
|
881
831
|
};
|
|
882
832
|
};
|
|
883
833
|
}
|
|
884
|
-
function _apply_decs_2203_r$
|
|
885
|
-
return (_apply_decs_2203_r$
|
|
834
|
+
function _apply_decs_2203_r$14(targetClass, memberDecs, classDecs, parentClass) {
|
|
835
|
+
return (_apply_decs_2203_r$14 = applyDecs2203RFactory$14())(targetClass, memberDecs, classDecs, parentClass);
|
|
886
836
|
}
|
|
887
|
-
var _dec$
|
|
837
|
+
var _dec$14, _initClass$14;
|
|
888
838
|
const DEFAULT_DEPTH = 5;
|
|
889
839
|
const DEFAULT_LOG_LEVELS = [
|
|
890
840
|
"log",
|
|
@@ -903,10 +853,10 @@ const dateTimeFormatter = new Intl.DateTimeFormat(void 0, {
|
|
|
903
853
|
month: "2-digit"
|
|
904
854
|
});
|
|
905
855
|
let _ConsoleLogger;
|
|
906
|
-
_dec$
|
|
856
|
+
_dec$14 = (0, _navios_di.Injectable)({ token: LoggerOutput });
|
|
907
857
|
(class {
|
|
908
858
|
static {
|
|
909
|
-
({c: [_ConsoleLogger, _initClass$
|
|
859
|
+
({c: [_ConsoleLogger, _initClass$14]} = _apply_decs_2203_r$14(this, [], [_dec$14]));
|
|
910
860
|
}
|
|
911
861
|
/**
|
|
912
862
|
* The options of the logger.
|
|
@@ -1155,10 +1105,10 @@ _dec$13 = (0, _navios_di.Injectable)({ token: LoggerOutput });
|
|
|
1155
1105
|
}
|
|
1156
1106
|
}
|
|
1157
1107
|
static {
|
|
1158
|
-
_initClass$
|
|
1108
|
+
_initClass$14();
|
|
1159
1109
|
}
|
|
1160
1110
|
});
|
|
1161
|
-
function applyDecs2203RFactory$
|
|
1111
|
+
function applyDecs2203RFactory$13() {
|
|
1162
1112
|
function createAddInitializerMethod(initializers, decoratorFinishedRef) {
|
|
1163
1113
|
return function addInitializer(initializer) {
|
|
1164
1114
|
assertNotFinished(decoratorFinishedRef, "addInitializer");
|
|
@@ -1432,15 +1382,15 @@ function applyDecs2203RFactory$12() {
|
|
|
1432
1382
|
};
|
|
1433
1383
|
};
|
|
1434
1384
|
}
|
|
1435
|
-
function _apply_decs_2203_r$
|
|
1436
|
-
return (_apply_decs_2203_r$
|
|
1385
|
+
function _apply_decs_2203_r$13(targetClass, memberDecs, classDecs, parentClass) {
|
|
1386
|
+
return (_apply_decs_2203_r$13 = applyDecs2203RFactory$13())(targetClass, memberDecs, classDecs, parentClass);
|
|
1437
1387
|
}
|
|
1438
|
-
var _dec$
|
|
1388
|
+
var _dec$13, _initClass$13;
|
|
1439
1389
|
let _LoggerInstance;
|
|
1440
|
-
_dec$
|
|
1390
|
+
_dec$13 = (0, _navios_di.Injectable)({ token: Logger });
|
|
1441
1391
|
(class {
|
|
1442
1392
|
static {
|
|
1443
|
-
({c: [_LoggerInstance, _initClass$
|
|
1393
|
+
({c: [_LoggerInstance, _initClass$13]} = _apply_decs_2203_r$13(this, [], [_dec$13]));
|
|
1444
1394
|
}
|
|
1445
1395
|
constructor(config = {}) {
|
|
1446
1396
|
this.context = config.context;
|
|
@@ -1472,10 +1422,10 @@ _dec$12 = (0, _navios_di.Injectable)({ token: Logger });
|
|
|
1472
1422
|
this.localInstance?.fatal?.(message, ...optionalParams);
|
|
1473
1423
|
}
|
|
1474
1424
|
static {
|
|
1475
|
-
_initClass$
|
|
1425
|
+
_initClass$13();
|
|
1476
1426
|
}
|
|
1477
1427
|
});
|
|
1478
|
-
function applyDecs2203RFactory$
|
|
1428
|
+
function applyDecs2203RFactory$12() {
|
|
1479
1429
|
function createAddInitializerMethod(initializers, decoratorFinishedRef) {
|
|
1480
1430
|
return function addInitializer(initializer) {
|
|
1481
1431
|
assertNotFinished(decoratorFinishedRef, "addInitializer");
|
|
@@ -1749,10 +1699,10 @@ function applyDecs2203RFactory$11() {
|
|
|
1749
1699
|
};
|
|
1750
1700
|
};
|
|
1751
1701
|
}
|
|
1752
|
-
function _apply_decs_2203_r$
|
|
1753
|
-
return (_apply_decs_2203_r$
|
|
1702
|
+
function _apply_decs_2203_r$12(targetClass, memberDecs, classDecs, parentClass) {
|
|
1703
|
+
return (_apply_decs_2203_r$12 = applyDecs2203RFactory$12())(targetClass, memberDecs, classDecs, parentClass);
|
|
1754
1704
|
}
|
|
1755
|
-
var _dec$
|
|
1705
|
+
var _dec$12, _initClass$12;
|
|
1756
1706
|
/**
|
|
1757
1707
|
* Schema for validating configuration service options.
|
|
1758
1708
|
*/ const ConfigServiceOptionsSchema = zod_v4.z.record(zod_v4.z.string(), zod_v4.z.unknown());
|
|
@@ -1760,11 +1710,11 @@ var _dec$11, _initClass$11;
|
|
|
1760
1710
|
* Injection token for ConfigService.
|
|
1761
1711
|
*/ const ConfigServiceToken = _navios_di.InjectionToken.create(Symbol.for("ConfigService"), ConfigServiceOptionsSchema);
|
|
1762
1712
|
let _ConfigService;
|
|
1763
|
-
_dec$
|
|
1713
|
+
_dec$12 = (0, _navios_di.Injectable)({ token: ConfigServiceToken });
|
|
1764
1714
|
(class {
|
|
1765
1715
|
config;
|
|
1766
1716
|
static {
|
|
1767
|
-
({c: [_ConfigService, _initClass$
|
|
1717
|
+
({c: [_ConfigService, _initClass$12]} = _apply_decs_2203_r$12(this, [], [_dec$12]));
|
|
1768
1718
|
}
|
|
1769
1719
|
/**
|
|
1770
1720
|
* Creates a new ConfigService instance.
|
|
@@ -1846,7 +1796,7 @@ _dec$11 = (0, _navios_di.Injectable)({ token: ConfigServiceToken });
|
|
|
1846
1796
|
return value;
|
|
1847
1797
|
}
|
|
1848
1798
|
static {
|
|
1849
|
-
_initClass$
|
|
1799
|
+
_initClass$12();
|
|
1850
1800
|
}
|
|
1851
1801
|
});
|
|
1852
1802
|
/**
|
|
@@ -2081,6 +2031,357 @@ _dec$11 = (0, _navios_di.Injectable)({ token: ConfigServiceToken });
|
|
|
2081
2031
|
super(409, message, error);
|
|
2082
2032
|
}
|
|
2083
2033
|
};
|
|
2034
|
+
function applyDecs2203RFactory$11() {
|
|
2035
|
+
function createAddInitializerMethod(initializers, decoratorFinishedRef) {
|
|
2036
|
+
return function addInitializer(initializer) {
|
|
2037
|
+
assertNotFinished(decoratorFinishedRef, "addInitializer");
|
|
2038
|
+
assertCallable(initializer, "An initializer");
|
|
2039
|
+
initializers.push(initializer);
|
|
2040
|
+
};
|
|
2041
|
+
}
|
|
2042
|
+
function memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value) {
|
|
2043
|
+
var kindStr;
|
|
2044
|
+
switch (kind) {
|
|
2045
|
+
case 1:
|
|
2046
|
+
kindStr = "accessor";
|
|
2047
|
+
break;
|
|
2048
|
+
case 2:
|
|
2049
|
+
kindStr = "method";
|
|
2050
|
+
break;
|
|
2051
|
+
case 3:
|
|
2052
|
+
kindStr = "getter";
|
|
2053
|
+
break;
|
|
2054
|
+
case 4:
|
|
2055
|
+
kindStr = "setter";
|
|
2056
|
+
break;
|
|
2057
|
+
default: kindStr = "field";
|
|
2058
|
+
}
|
|
2059
|
+
var ctx = {
|
|
2060
|
+
kind: kindStr,
|
|
2061
|
+
name: isPrivate ? "#" + name : name,
|
|
2062
|
+
static: isStatic,
|
|
2063
|
+
private: isPrivate,
|
|
2064
|
+
metadata
|
|
2065
|
+
};
|
|
2066
|
+
var decoratorFinishedRef = { v: false };
|
|
2067
|
+
ctx.addInitializer = createAddInitializerMethod(initializers, decoratorFinishedRef);
|
|
2068
|
+
var get, set;
|
|
2069
|
+
if (kind === 0) if (isPrivate) {
|
|
2070
|
+
get = desc.get;
|
|
2071
|
+
set = desc.set;
|
|
2072
|
+
} else {
|
|
2073
|
+
get = function() {
|
|
2074
|
+
return this[name];
|
|
2075
|
+
};
|
|
2076
|
+
set = function(v) {
|
|
2077
|
+
this[name] = v;
|
|
2078
|
+
};
|
|
2079
|
+
}
|
|
2080
|
+
else if (kind === 2) get = function() {
|
|
2081
|
+
return desc.value;
|
|
2082
|
+
};
|
|
2083
|
+
else {
|
|
2084
|
+
if (kind === 1 || kind === 3) get = function() {
|
|
2085
|
+
return desc.get.call(this);
|
|
2086
|
+
};
|
|
2087
|
+
if (kind === 1 || kind === 4) set = function(v) {
|
|
2088
|
+
desc.set.call(this, v);
|
|
2089
|
+
};
|
|
2090
|
+
}
|
|
2091
|
+
ctx.access = get && set ? {
|
|
2092
|
+
get,
|
|
2093
|
+
set
|
|
2094
|
+
} : get ? { get } : { set };
|
|
2095
|
+
try {
|
|
2096
|
+
return dec(value, ctx);
|
|
2097
|
+
} finally {
|
|
2098
|
+
decoratorFinishedRef.v = true;
|
|
2099
|
+
}
|
|
2100
|
+
}
|
|
2101
|
+
function assertNotFinished(decoratorFinishedRef, fnName) {
|
|
2102
|
+
if (decoratorFinishedRef.v) throw new Error("attempted to call " + fnName + " after decoration was finished");
|
|
2103
|
+
}
|
|
2104
|
+
function assertCallable(fn, hint) {
|
|
2105
|
+
if (typeof fn !== "function") throw new TypeError(hint + " must be a function");
|
|
2106
|
+
}
|
|
2107
|
+
function assertValidReturnValue(kind, value) {
|
|
2108
|
+
var type = typeof value;
|
|
2109
|
+
if (kind === 1) {
|
|
2110
|
+
if (type !== "object" || value === null) throw new TypeError("accessor decorators must return an object with get, set, or init properties or void 0");
|
|
2111
|
+
if (value.get !== void 0) assertCallable(value.get, "accessor.get");
|
|
2112
|
+
if (value.set !== void 0) assertCallable(value.set, "accessor.set");
|
|
2113
|
+
if (value.init !== void 0) assertCallable(value.init, "accessor.init");
|
|
2114
|
+
} else if (type !== "function") {
|
|
2115
|
+
var hint;
|
|
2116
|
+
if (kind === 0) hint = "field";
|
|
2117
|
+
else if (kind === 10) hint = "class";
|
|
2118
|
+
else hint = "method";
|
|
2119
|
+
throw new TypeError(hint + " decorators must return a function or void 0");
|
|
2120
|
+
}
|
|
2121
|
+
}
|
|
2122
|
+
function applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata) {
|
|
2123
|
+
var decs = decInfo[0];
|
|
2124
|
+
var desc, init, value;
|
|
2125
|
+
if (isPrivate) if (kind === 0 || kind === 1) desc = {
|
|
2126
|
+
get: decInfo[3],
|
|
2127
|
+
set: decInfo[4]
|
|
2128
|
+
};
|
|
2129
|
+
else if (kind === 3) desc = { get: decInfo[3] };
|
|
2130
|
+
else if (kind === 4) desc = { set: decInfo[3] };
|
|
2131
|
+
else desc = { value: decInfo[3] };
|
|
2132
|
+
else if (kind !== 0) desc = Object.getOwnPropertyDescriptor(base, name);
|
|
2133
|
+
if (kind === 1) value = {
|
|
2134
|
+
get: desc.get,
|
|
2135
|
+
set: desc.set
|
|
2136
|
+
};
|
|
2137
|
+
else if (kind === 2) value = desc.value;
|
|
2138
|
+
else if (kind === 3) value = desc.get;
|
|
2139
|
+
else if (kind === 4) value = desc.set;
|
|
2140
|
+
var newValue, get, set;
|
|
2141
|
+
if (typeof decs === "function") {
|
|
2142
|
+
newValue = memberDec(decs, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
|
|
2143
|
+
if (newValue !== void 0) {
|
|
2144
|
+
assertValidReturnValue(kind, newValue);
|
|
2145
|
+
if (kind === 0) init = newValue;
|
|
2146
|
+
else if (kind === 1) {
|
|
2147
|
+
init = newValue.init;
|
|
2148
|
+
get = newValue.get || value.get;
|
|
2149
|
+
set = newValue.set || value.set;
|
|
2150
|
+
value = {
|
|
2151
|
+
get,
|
|
2152
|
+
set
|
|
2153
|
+
};
|
|
2154
|
+
} else value = newValue;
|
|
2155
|
+
}
|
|
2156
|
+
} else for (var i = decs.length - 1; i >= 0; i--) {
|
|
2157
|
+
var dec = decs[i];
|
|
2158
|
+
newValue = memberDec(dec, name, desc, initializers, kind, isStatic, isPrivate, metadata, value);
|
|
2159
|
+
if (newValue !== void 0) {
|
|
2160
|
+
assertValidReturnValue(kind, newValue);
|
|
2161
|
+
var newInit;
|
|
2162
|
+
if (kind === 0) newInit = newValue;
|
|
2163
|
+
else if (kind === 1) {
|
|
2164
|
+
newInit = newValue.init;
|
|
2165
|
+
get = newValue.get || value.get;
|
|
2166
|
+
set = newValue.set || value.set;
|
|
2167
|
+
value = {
|
|
2168
|
+
get,
|
|
2169
|
+
set
|
|
2170
|
+
};
|
|
2171
|
+
} else value = newValue;
|
|
2172
|
+
if (newInit !== void 0) if (init === void 0) init = newInit;
|
|
2173
|
+
else if (typeof init === "function") init = [init, newInit];
|
|
2174
|
+
else init.push(newInit);
|
|
2175
|
+
}
|
|
2176
|
+
}
|
|
2177
|
+
if (kind === 0 || kind === 1) {
|
|
2178
|
+
if (init === void 0) init = function(instance, init$1) {
|
|
2179
|
+
return init$1;
|
|
2180
|
+
};
|
|
2181
|
+
else if (typeof init !== "function") {
|
|
2182
|
+
var ownInitializers = init;
|
|
2183
|
+
init = function(instance, init$1) {
|
|
2184
|
+
var value$1 = init$1;
|
|
2185
|
+
for (var i$1 = 0; i$1 < ownInitializers.length; i$1++) value$1 = ownInitializers[i$1].call(instance, value$1);
|
|
2186
|
+
return value$1;
|
|
2187
|
+
};
|
|
2188
|
+
} else {
|
|
2189
|
+
var originalInitializer = init;
|
|
2190
|
+
init = function(instance, init$1) {
|
|
2191
|
+
return originalInitializer.call(instance, init$1);
|
|
2192
|
+
};
|
|
2193
|
+
}
|
|
2194
|
+
ret.push(init);
|
|
2195
|
+
}
|
|
2196
|
+
if (kind !== 0) {
|
|
2197
|
+
if (kind === 1) {
|
|
2198
|
+
desc.get = value.get;
|
|
2199
|
+
desc.set = value.set;
|
|
2200
|
+
} else if (kind === 2) desc.value = value;
|
|
2201
|
+
else if (kind === 3) desc.get = value;
|
|
2202
|
+
else if (kind === 4) desc.set = value;
|
|
2203
|
+
if (isPrivate) if (kind === 1) {
|
|
2204
|
+
ret.push(function(instance, args) {
|
|
2205
|
+
return value.get.call(instance, args);
|
|
2206
|
+
});
|
|
2207
|
+
ret.push(function(instance, args) {
|
|
2208
|
+
return value.set.call(instance, args);
|
|
2209
|
+
});
|
|
2210
|
+
} else if (kind === 2) ret.push(value);
|
|
2211
|
+
else ret.push(function(instance, args) {
|
|
2212
|
+
return value.call(instance, args);
|
|
2213
|
+
});
|
|
2214
|
+
else Object.defineProperty(base, name, desc);
|
|
2215
|
+
}
|
|
2216
|
+
}
|
|
2217
|
+
function applyMemberDecs(Class, decInfos, metadata) {
|
|
2218
|
+
var ret = [];
|
|
2219
|
+
var protoInitializers;
|
|
2220
|
+
var staticInitializers;
|
|
2221
|
+
var existingProtoNonFields = /* @__PURE__ */ new Map();
|
|
2222
|
+
var existingStaticNonFields = /* @__PURE__ */ new Map();
|
|
2223
|
+
for (var i = 0; i < decInfos.length; i++) {
|
|
2224
|
+
var decInfo = decInfos[i];
|
|
2225
|
+
if (!Array.isArray(decInfo)) continue;
|
|
2226
|
+
var kind = decInfo[1];
|
|
2227
|
+
var name = decInfo[2];
|
|
2228
|
+
var isPrivate = decInfo.length > 3;
|
|
2229
|
+
var isStatic = kind >= 5;
|
|
2230
|
+
var base;
|
|
2231
|
+
var initializers;
|
|
2232
|
+
if (isStatic) {
|
|
2233
|
+
base = Class;
|
|
2234
|
+
kind = kind - 5;
|
|
2235
|
+
staticInitializers = staticInitializers || [];
|
|
2236
|
+
initializers = staticInitializers;
|
|
2237
|
+
} else {
|
|
2238
|
+
base = Class.prototype;
|
|
2239
|
+
protoInitializers = protoInitializers || [];
|
|
2240
|
+
initializers = protoInitializers;
|
|
2241
|
+
}
|
|
2242
|
+
if (kind !== 0 && !isPrivate) {
|
|
2243
|
+
var existingNonFields = isStatic ? existingStaticNonFields : existingProtoNonFields;
|
|
2244
|
+
var existingKind = existingNonFields.get(name) || 0;
|
|
2245
|
+
if (existingKind === true || existingKind === 3 && kind !== 4 || existingKind === 4 && kind !== 3) throw new Error("Attempted to decorate a public method/accessor that has the same name as a previously decorated public method/accessor. This is not currently supported by the decorators plugin. Property name was: " + name);
|
|
2246
|
+
else if (!existingKind && kind > 2) existingNonFields.set(name, kind);
|
|
2247
|
+
else existingNonFields.set(name, true);
|
|
2248
|
+
}
|
|
2249
|
+
applyMemberDec(ret, base, decInfo, name, kind, isStatic, isPrivate, initializers, metadata);
|
|
2250
|
+
}
|
|
2251
|
+
pushInitializers(ret, protoInitializers);
|
|
2252
|
+
pushInitializers(ret, staticInitializers);
|
|
2253
|
+
return ret;
|
|
2254
|
+
}
|
|
2255
|
+
function pushInitializers(ret, initializers) {
|
|
2256
|
+
if (initializers) ret.push(function(instance) {
|
|
2257
|
+
for (var i = 0; i < initializers.length; i++) initializers[i].call(instance);
|
|
2258
|
+
return instance;
|
|
2259
|
+
});
|
|
2260
|
+
}
|
|
2261
|
+
function applyClassDecs(targetClass, classDecs, metadata) {
|
|
2262
|
+
if (classDecs.length > 0) {
|
|
2263
|
+
var initializers = [];
|
|
2264
|
+
var newClass = targetClass;
|
|
2265
|
+
var name = targetClass.name;
|
|
2266
|
+
for (var i = classDecs.length - 1; i >= 0; i--) {
|
|
2267
|
+
var decoratorFinishedRef = { v: false };
|
|
2268
|
+
try {
|
|
2269
|
+
var nextNewClass = classDecs[i](newClass, {
|
|
2270
|
+
kind: "class",
|
|
2271
|
+
name,
|
|
2272
|
+
addInitializer: createAddInitializerMethod(initializers, decoratorFinishedRef),
|
|
2273
|
+
metadata
|
|
2274
|
+
});
|
|
2275
|
+
} finally {
|
|
2276
|
+
decoratorFinishedRef.v = true;
|
|
2277
|
+
}
|
|
2278
|
+
if (nextNewClass !== void 0) {
|
|
2279
|
+
assertValidReturnValue(10, nextNewClass);
|
|
2280
|
+
newClass = nextNewClass;
|
|
2281
|
+
}
|
|
2282
|
+
}
|
|
2283
|
+
return [defineMetadata(newClass, metadata), function() {
|
|
2284
|
+
for (var i$1 = 0; i$1 < initializers.length; i$1++) initializers[i$1].call(newClass);
|
|
2285
|
+
}];
|
|
2286
|
+
}
|
|
2287
|
+
}
|
|
2288
|
+
function defineMetadata(Class, metadata) {
|
|
2289
|
+
return Object.defineProperty(Class, Symbol.metadata || Symbol.for("Symbol.metadata"), {
|
|
2290
|
+
configurable: true,
|
|
2291
|
+
enumerable: true,
|
|
2292
|
+
value: metadata
|
|
2293
|
+
});
|
|
2294
|
+
}
|
|
2295
|
+
return function applyDecs2203R(targetClass, memberDecs, classDecs, parentClass) {
|
|
2296
|
+
if (parentClass !== void 0) var parentMetadata = parentClass[Symbol.metadata || Symbol.for("Symbol.metadata")];
|
|
2297
|
+
var metadata = Object.create(parentMetadata === void 0 ? null : parentMetadata);
|
|
2298
|
+
var e = applyMemberDecs(targetClass, memberDecs, metadata);
|
|
2299
|
+
if (!classDecs.length) defineMetadata(targetClass, metadata);
|
|
2300
|
+
return {
|
|
2301
|
+
e,
|
|
2302
|
+
get c() {
|
|
2303
|
+
return applyClassDecs(targetClass, classDecs, metadata);
|
|
2304
|
+
}
|
|
2305
|
+
};
|
|
2306
|
+
};
|
|
2307
|
+
}
|
|
2308
|
+
function _apply_decs_2203_r$11(targetClass, memberDecs, classDecs, parentClass) {
|
|
2309
|
+
return (_apply_decs_2203_r$11 = applyDecs2203RFactory$11())(targetClass, memberDecs, classDecs, parentClass);
|
|
2310
|
+
}
|
|
2311
|
+
var _dec$11, _initClass$11;
|
|
2312
|
+
let _InstanceResolverService;
|
|
2313
|
+
_dec$11 = (0, _navios_di.Injectable)();
|
|
2314
|
+
(class {
|
|
2315
|
+
static {
|
|
2316
|
+
({c: [_InstanceResolverService, _initClass$11]} = _apply_decs_2203_r$11(this, [], [_dec$11]));
|
|
2317
|
+
}
|
|
2318
|
+
container = (0, _navios_di.inject)(_navios_di.Container);
|
|
2319
|
+
/**
|
|
2320
|
+
* Attempts to resolve a class instance, automatically detecting if it needs
|
|
2321
|
+
* request scope based on its dependencies.
|
|
2322
|
+
*
|
|
2323
|
+
* @param classType - The class to resolve
|
|
2324
|
+
* @returns A resolution result containing either a cached instance or resolver function
|
|
2325
|
+
*/ async resolve(classType) {
|
|
2326
|
+
let cachedInstance = null;
|
|
2327
|
+
try {
|
|
2328
|
+
cachedInstance = await this.container.get(classType);
|
|
2329
|
+
} catch {
|
|
2330
|
+
const token = (0, _navios_di.getInjectableToken)(classType);
|
|
2331
|
+
this.container.getRegistry().updateScope(token, _navios_di.InjectableScope.Request);
|
|
2332
|
+
}
|
|
2333
|
+
return {
|
|
2334
|
+
cached: cachedInstance !== null,
|
|
2335
|
+
instance: cachedInstance,
|
|
2336
|
+
resolve: (scoped) => scoped.get(classType)
|
|
2337
|
+
};
|
|
2338
|
+
}
|
|
2339
|
+
/**
|
|
2340
|
+
* Attempts to resolve multiple class instances, automatically detecting if any need
|
|
2341
|
+
* request scope based on their dependencies.
|
|
2342
|
+
*
|
|
2343
|
+
* Returns `cached: true` only if ALL classes can be resolved as singletons.
|
|
2344
|
+
* If any class has request-scoped dependencies, returns `cached: false`.
|
|
2345
|
+
*
|
|
2346
|
+
* @param classTypes - The classes to resolve
|
|
2347
|
+
* @returns A resolution result containing either all cached instances or resolver function
|
|
2348
|
+
*/ async resolveMany(classTypes) {
|
|
2349
|
+
if (classTypes.length === 0) return {
|
|
2350
|
+
cached: true,
|
|
2351
|
+
instances: [],
|
|
2352
|
+
classTypes: [],
|
|
2353
|
+
resolve: async () => []
|
|
2354
|
+
};
|
|
2355
|
+
const results = await Promise.all(classTypes.map(async (classType) => {
|
|
2356
|
+
try {
|
|
2357
|
+
return {
|
|
2358
|
+
success: true,
|
|
2359
|
+
instance: await this.container.get(classType)
|
|
2360
|
+
};
|
|
2361
|
+
} catch {
|
|
2362
|
+
const token = (0, _navios_di.getInjectableToken)(classType);
|
|
2363
|
+
this.container.getRegistry().updateScope(token, _navios_di.InjectableScope.Request);
|
|
2364
|
+
return {
|
|
2365
|
+
success: false,
|
|
2366
|
+
instance: null
|
|
2367
|
+
};
|
|
2368
|
+
}
|
|
2369
|
+
}));
|
|
2370
|
+
const allCached = results.every((r) => r.success);
|
|
2371
|
+
return {
|
|
2372
|
+
cached: allCached,
|
|
2373
|
+
instances: allCached ? results.map((r) => r.instance) : null,
|
|
2374
|
+
classTypes,
|
|
2375
|
+
resolve: (scoped) => Promise.all(classTypes.map((classType) => scoped.get(classType)))
|
|
2376
|
+
};
|
|
2377
|
+
}
|
|
2378
|
+
static {
|
|
2379
|
+
_initClass$11();
|
|
2380
|
+
}
|
|
2381
|
+
});
|
|
2382
|
+
/**
|
|
2383
|
+
* @deprecated Use InstanceResolverService instead
|
|
2384
|
+
*/ const ControllerResolverService = _InstanceResolverService;
|
|
2084
2385
|
function applyDecs2203RFactory$10() {
|
|
2085
2386
|
function createAddInitializerMethod(initializers, decoratorFinishedRef) {
|
|
2086
2387
|
return function addInitializer(initializer) {
|
|
@@ -2366,23 +2667,40 @@ _dec$10 = (0, _navios_di.Injectable)();
|
|
|
2366
2667
|
({c: [_GuardRunnerService, _initClass$10]} = _apply_decs_2203_r$10(this, [], [_dec$10]));
|
|
2367
2668
|
}
|
|
2368
2669
|
logger = (0, _navios_di.inject)(Logger, { context: _GuardRunnerService.name });
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2670
|
+
/**
|
|
2671
|
+
* Runs guards that need to be resolved from a scoped container.
|
|
2672
|
+
* Use this when guards have request-scoped dependencies.
|
|
2673
|
+
*/ async runGuards(allGuards, executionContext, context) {
|
|
2674
|
+
const guardsArray = Array.from(allGuards).reverse();
|
|
2675
|
+
const guardInstances = await Promise.all(guardsArray.map(async (guard) => {
|
|
2372
2676
|
const guardInstance = await context.get(guard);
|
|
2373
2677
|
if (!guardInstance.canActivate) throw new Error(`[Navios] Guard ${guard.name} does not implement canActivate()`);
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
|
|
2384
|
-
|
|
2385
|
-
|
|
2678
|
+
return guardInstance;
|
|
2679
|
+
}));
|
|
2680
|
+
return this.executeGuards(guardInstances, executionContext);
|
|
2681
|
+
}
|
|
2682
|
+
/**
|
|
2683
|
+
* Runs pre-resolved guard instances.
|
|
2684
|
+
* Use this when all guards are singletons and have been pre-resolved at startup.
|
|
2685
|
+
*/ async runGuardsStatic(guardInstances, executionContext) {
|
|
2686
|
+
return this.executeGuards(guardInstances, executionContext);
|
|
2687
|
+
}
|
|
2688
|
+
/**
|
|
2689
|
+
* Shared guard execution logic.
|
|
2690
|
+
* Iterates through guard instances and calls canActivate on each.
|
|
2691
|
+
*/ async executeGuards(guardInstances, executionContext) {
|
|
2692
|
+
let canActivate = true;
|
|
2693
|
+
for (const guardInstance of guardInstances) try {
|
|
2694
|
+
canActivate = await guardInstance.canActivate(executionContext);
|
|
2695
|
+
if (!canActivate) break;
|
|
2696
|
+
} catch (error) {
|
|
2697
|
+
if (error instanceof HttpException) {
|
|
2698
|
+
executionContext.getReply().status(error.statusCode).send(error.response);
|
|
2699
|
+
return false;
|
|
2700
|
+
} else {
|
|
2701
|
+
this.logger.error("Error running guard", error);
|
|
2702
|
+
executionContext.getReply().status(500).send({ message: "Internal server error" });
|
|
2703
|
+
return false;
|
|
2386
2704
|
}
|
|
2387
2705
|
}
|
|
2388
2706
|
if (!canActivate) {
|
|
@@ -2699,10 +3017,53 @@ _dec$9 = (0, _navios_di.Injectable)();
|
|
|
2699
3017
|
await this.traverseModules(appModule);
|
|
2700
3018
|
this.initialized = true;
|
|
2701
3019
|
}
|
|
3020
|
+
/**
|
|
3021
|
+
* Extends the module tree with additional modules or controllers.
|
|
3022
|
+
*
|
|
3023
|
+
* This method is designed to be called by plugins during registration,
|
|
3024
|
+
* which happens after initial module loading but before route registration.
|
|
3025
|
+
*
|
|
3026
|
+
* @param extensions - Array of module extensions to add
|
|
3027
|
+
* @throws Error if not initialized (loadModules must be called first)
|
|
3028
|
+
*
|
|
3029
|
+
* @example
|
|
3030
|
+
* ```typescript
|
|
3031
|
+
* // In plugin registration
|
|
3032
|
+
* const moduleLoader = await context.container.get(ModuleLoaderService)
|
|
3033
|
+
* await moduleLoader.extendModules([{
|
|
3034
|
+
* controllers: [OpenApiJsonController, OpenApiYamlController],
|
|
3035
|
+
* moduleName: 'OpenApiBunModule',
|
|
3036
|
+
* }])
|
|
3037
|
+
* ```
|
|
3038
|
+
*/ async extendModules(extensions) {
|
|
3039
|
+
if (!this.initialized) throw new Error("ModuleLoaderService must be initialized before extending. Call loadModules() first.");
|
|
3040
|
+
for (const extension of extensions) if (extension.module) await this.traverseModules(extension.module);
|
|
3041
|
+
else if (extension.controllers && extension.moduleName) await this.registerControllers(extension.controllers, extension.moduleName);
|
|
3042
|
+
else if (extension.controllers) throw new Error("moduleName is required when providing controllers without a module");
|
|
3043
|
+
}
|
|
3044
|
+
/**
|
|
3045
|
+
* Registers controllers under a synthetic module.
|
|
3046
|
+
* Used when plugins want to add controllers without a full module class.
|
|
3047
|
+
*/ async registerControllers(controllers, moduleName) {
|
|
3048
|
+
if (this.modulesMetadata.has(moduleName)) {
|
|
3049
|
+
const existing = this.modulesMetadata.get(moduleName);
|
|
3050
|
+
for (const controller of controllers) existing.controllers.add(controller);
|
|
3051
|
+
this.logger.debug(`Extended module ${moduleName} with ${controllers.length} controllers`);
|
|
3052
|
+
} else {
|
|
3053
|
+
const metadata = {
|
|
3054
|
+
controllers: new Set(controllers),
|
|
3055
|
+
imports: /* @__PURE__ */ new Set(),
|
|
3056
|
+
guards: /* @__PURE__ */ new Set(),
|
|
3057
|
+
customAttributes: /* @__PURE__ */ new Map()
|
|
3058
|
+
};
|
|
3059
|
+
this.modulesMetadata.set(moduleName, metadata);
|
|
3060
|
+
this.logger.debug(`Created module ${moduleName} with ${controllers.length} controllers`);
|
|
3061
|
+
}
|
|
3062
|
+
}
|
|
2702
3063
|
async traverseModules(module$1, parentMetadata) {
|
|
2703
3064
|
const metadata = extractModuleMetadata(module$1);
|
|
2704
3065
|
if (parentMetadata) this.mergeMetadata(metadata, parentMetadata);
|
|
2705
|
-
const moduleName = module$1.
|
|
3066
|
+
const moduleName = (0, _navios_di.getInjectableToken)(module$1).id;
|
|
2706
3067
|
if (this.modulesMetadata.has(moduleName)) return;
|
|
2707
3068
|
try {
|
|
2708
3069
|
this.modulesMetadata.set(moduleName, metadata);
|
|
@@ -3099,7 +3460,7 @@ _dec$8 = (0, _navios_di.Injectable)();
|
|
|
3099
3460
|
}
|
|
3100
3461
|
httpTokens = /* @__PURE__ */ new Map();
|
|
3101
3462
|
setupHttpEnvironment(tokens) {
|
|
3102
|
-
this.httpTokens
|
|
3463
|
+
for (const [token, value] of tokens) this.httpTokens.set(token, value);
|
|
3103
3464
|
}
|
|
3104
3465
|
getHttpToken(token) {
|
|
3105
3466
|
return this.httpTokens.get(token);
|
|
@@ -5175,7 +5536,7 @@ _dec$1$1 = (0, _navios_di.Factory)({ token: XmlStreamAdapterToken });
|
|
|
5175
5536
|
_initClass$1$1();
|
|
5176
5537
|
}
|
|
5177
5538
|
});
|
|
5178
|
-
function applyDecs2203RFactory$
|
|
5539
|
+
function applyDecs2203RFactory$15() {
|
|
5179
5540
|
function createAddInitializerMethod(initializers, decoratorFinishedRef) {
|
|
5180
5541
|
return function addInitializer(initializer) {
|
|
5181
5542
|
assertNotFinished(decoratorFinishedRef, "addInitializer");
|
|
@@ -5449,15 +5810,15 @@ function applyDecs2203RFactory$14() {
|
|
|
5449
5810
|
};
|
|
5450
5811
|
};
|
|
5451
5812
|
}
|
|
5452
|
-
function _apply_decs_2203_r$
|
|
5453
|
-
return (_apply_decs_2203_r$
|
|
5813
|
+
function _apply_decs_2203_r$15(targetClass, memberDecs, classDecs, parentClass) {
|
|
5814
|
+
return (_apply_decs_2203_r$15 = applyDecs2203RFactory$15())(targetClass, memberDecs, classDecs, parentClass);
|
|
5454
5815
|
}
|
|
5455
|
-
var _dec$
|
|
5816
|
+
var _dec$15, _initClass$15;
|
|
5456
5817
|
let _NaviosApplication;
|
|
5457
|
-
_dec$
|
|
5818
|
+
_dec$15 = (0, _navios_di.Injectable)();
|
|
5458
5819
|
(class {
|
|
5459
5820
|
static {
|
|
5460
|
-
({c: [_NaviosApplication, _initClass$
|
|
5821
|
+
({c: [_NaviosApplication, _initClass$15]} = _apply_decs_2203_r$15(this, [], [_dec$15]));
|
|
5461
5822
|
}
|
|
5462
5823
|
environment = (0, _navios_di.inject)(_NaviosEnvironment);
|
|
5463
5824
|
moduleLoader = (0, _navios_di.inject)(_ModuleLoaderService);
|
|
@@ -5474,7 +5835,7 @@ _dec$14 = (0, _navios_di.Injectable)();
|
|
|
5474
5835
|
/**
|
|
5475
5836
|
* Sets up the application with the provided module and options.
|
|
5476
5837
|
* This is called automatically by NaviosFactory.create().
|
|
5477
|
-
*
|
|
5838
|
+
*
|
|
5478
5839
|
* @param appModule - The root application module
|
|
5479
5840
|
* @param options - Application configuration options
|
|
5480
5841
|
* @internal
|
|
@@ -5485,7 +5846,7 @@ _dec$14 = (0, _navios_di.Injectable)();
|
|
|
5485
5846
|
}
|
|
5486
5847
|
/**
|
|
5487
5848
|
* Gets the dependency injection container used by this application.
|
|
5488
|
-
*
|
|
5849
|
+
*
|
|
5489
5850
|
* @returns The Container instance
|
|
5490
5851
|
*/ getContainer() {
|
|
5491
5852
|
return this.container;
|
|
@@ -5537,8 +5898,8 @@ _dec$14 = (0, _navios_di.Injectable)();
|
|
|
5537
5898
|
if (!this.appModule) throw new Error("App module is not set. Call setAppModule() first.");
|
|
5538
5899
|
await this.moduleLoader.loadModules(this.appModule);
|
|
5539
5900
|
if (this.environment.hasHttpSetup()) await this.httpApplication?.setupHttpServer(this.options);
|
|
5540
|
-
await this.initModules();
|
|
5541
5901
|
await this.initPlugins();
|
|
5902
|
+
await this.initModules();
|
|
5542
5903
|
if (this.environment.hasHttpSetup()) await this.httpApplication?.ready();
|
|
5543
5904
|
this.isInitialized = true;
|
|
5544
5905
|
this.logger.debug("Navios application initialized");
|
|
@@ -5549,11 +5910,16 @@ _dec$14 = (0, _navios_di.Injectable)();
|
|
|
5549
5910
|
}
|
|
5550
5911
|
async initPlugins() {
|
|
5551
5912
|
if (this.plugins.length === 0) return;
|
|
5913
|
+
let server = null;
|
|
5914
|
+
try {
|
|
5915
|
+
server = this.httpApplication?.getServer() ?? null;
|
|
5916
|
+
} catch {}
|
|
5552
5917
|
const context = {
|
|
5553
5918
|
modules: this.moduleLoader.getAllModules(),
|
|
5554
|
-
server
|
|
5919
|
+
server,
|
|
5555
5920
|
container: this.container,
|
|
5556
|
-
globalPrefix: this.httpApplication?.getGlobalPrefix() ?? ""
|
|
5921
|
+
globalPrefix: this.httpApplication?.getGlobalPrefix() ?? "",
|
|
5922
|
+
moduleLoader: this.moduleLoader
|
|
5557
5923
|
};
|
|
5558
5924
|
for (const { plugin, options } of this.plugins) {
|
|
5559
5925
|
this.logger.debug(`Initializing plugin: ${plugin.name}`);
|
|
@@ -5562,10 +5928,10 @@ _dec$14 = (0, _navios_di.Injectable)();
|
|
|
5562
5928
|
}
|
|
5563
5929
|
/**
|
|
5564
5930
|
* Enables CORS (Cross-Origin Resource Sharing) for the application.
|
|
5565
|
-
*
|
|
5931
|
+
*
|
|
5566
5932
|
* @param options - CORS configuration options (adapter-specific)
|
|
5567
5933
|
* @throws Error if HTTP application is not set
|
|
5568
|
-
*
|
|
5934
|
+
*
|
|
5569
5935
|
* @example
|
|
5570
5936
|
* ```typescript
|
|
5571
5937
|
* app.enableCors({
|
|
@@ -5580,10 +5946,10 @@ _dec$14 = (0, _navios_di.Injectable)();
|
|
|
5580
5946
|
}
|
|
5581
5947
|
/**
|
|
5582
5948
|
* Enables multipart/form-data support for file uploads.
|
|
5583
|
-
*
|
|
5949
|
+
*
|
|
5584
5950
|
* @param options - Multipart configuration options (adapter-specific)
|
|
5585
5951
|
* @throws Error if HTTP application is not set
|
|
5586
|
-
*
|
|
5952
|
+
*
|
|
5587
5953
|
* @example
|
|
5588
5954
|
* ```typescript
|
|
5589
5955
|
* app.enableMultipart({
|
|
@@ -5598,10 +5964,10 @@ _dec$14 = (0, _navios_di.Injectable)();
|
|
|
5598
5964
|
}
|
|
5599
5965
|
/**
|
|
5600
5966
|
* Sets a global prefix for all routes.
|
|
5601
|
-
*
|
|
5967
|
+
*
|
|
5602
5968
|
* @param prefix - The prefix to prepend to all route URLs (e.g., '/api')
|
|
5603
5969
|
* @throws Error if HTTP application is not set
|
|
5604
|
-
*
|
|
5970
|
+
*
|
|
5605
5971
|
* @example
|
|
5606
5972
|
* ```typescript
|
|
5607
5973
|
* app.setGlobalPrefix('/api/v1')
|
|
@@ -5613,14 +5979,14 @@ _dec$14 = (0, _navios_di.Injectable)();
|
|
|
5613
5979
|
}
|
|
5614
5980
|
/**
|
|
5615
5981
|
* Gets the underlying HTTP server instance.
|
|
5616
|
-
*
|
|
5982
|
+
*
|
|
5617
5983
|
* The type of the returned server depends on the adapter used:
|
|
5618
5984
|
* - Fastify adapter: Returns FastifyInstance
|
|
5619
5985
|
* - Bun adapter: Returns Bun.Server
|
|
5620
|
-
*
|
|
5986
|
+
*
|
|
5621
5987
|
* @returns The HTTP server instance
|
|
5622
5988
|
* @throws Error if HTTP application is not set
|
|
5623
|
-
*
|
|
5989
|
+
*
|
|
5624
5990
|
* @example
|
|
5625
5991
|
* ```typescript
|
|
5626
5992
|
* const server = app.getServer()
|
|
@@ -5632,10 +5998,10 @@ _dec$14 = (0, _navios_di.Injectable)();
|
|
|
5632
5998
|
}
|
|
5633
5999
|
/**
|
|
5634
6000
|
* Starts the HTTP server and begins listening for requests.
|
|
5635
|
-
*
|
|
6001
|
+
*
|
|
5636
6002
|
* @param options - Listen options (port, host, etc.)
|
|
5637
6003
|
* @throws Error if HTTP application is not set
|
|
5638
|
-
*
|
|
6004
|
+
*
|
|
5639
6005
|
* @example
|
|
5640
6006
|
* ```typescript
|
|
5641
6007
|
* await app.listen({ port: 3000, host: '0.0.0.0' })
|
|
@@ -5646,7 +6012,7 @@ _dec$14 = (0, _navios_di.Injectable)();
|
|
|
5646
6012
|
}
|
|
5647
6013
|
/**
|
|
5648
6014
|
* Disposes of application resources.
|
|
5649
|
-
*
|
|
6015
|
+
*
|
|
5650
6016
|
* Cleans up the HTTP server and module loader.
|
|
5651
6017
|
* This method is called automatically by `close()`.
|
|
5652
6018
|
*/ async dispose() {
|
|
@@ -5655,9 +6021,9 @@ _dec$14 = (0, _navios_di.Injectable)();
|
|
|
5655
6021
|
}
|
|
5656
6022
|
/**
|
|
5657
6023
|
* Closes the application and cleans up all resources.
|
|
5658
|
-
*
|
|
6024
|
+
*
|
|
5659
6025
|
* This is an alias for `dispose()`.
|
|
5660
|
-
*
|
|
6026
|
+
*
|
|
5661
6027
|
* @example
|
|
5662
6028
|
* ```typescript
|
|
5663
6029
|
* // Graceful shutdown
|
|
@@ -5670,36 +6036,36 @@ _dec$14 = (0, _navios_di.Injectable)();
|
|
|
5670
6036
|
await this.dispose();
|
|
5671
6037
|
}
|
|
5672
6038
|
static {
|
|
5673
|
-
_initClass$
|
|
6039
|
+
_initClass$15();
|
|
5674
6040
|
}
|
|
5675
6041
|
});
|
|
5676
6042
|
/**
|
|
5677
6043
|
* Factory class for creating and configuring Navios applications.
|
|
5678
|
-
*
|
|
6044
|
+
*
|
|
5679
6045
|
* This is the main entry point for bootstrapping a Navios application.
|
|
5680
6046
|
* It handles dependency injection container setup, adapter registration,
|
|
5681
6047
|
* and logger configuration.
|
|
5682
|
-
*
|
|
6048
|
+
*
|
|
5683
6049
|
* @example
|
|
5684
6050
|
* ```typescript
|
|
5685
6051
|
* import { NaviosFactory } from '@navios/core'
|
|
5686
6052
|
* import { defineFastifyEnvironment } from '@navios/adapter-fastify'
|
|
5687
|
-
*
|
|
6053
|
+
*
|
|
5688
6054
|
* const app = await NaviosFactory.create(AppModule, {
|
|
5689
6055
|
* adapter: defineFastifyEnvironment(),
|
|
5690
6056
|
* logger: ['log', 'error', 'warn'],
|
|
5691
6057
|
* })
|
|
5692
|
-
*
|
|
6058
|
+
*
|
|
5693
6059
|
* await app.init()
|
|
5694
6060
|
* await app.listen({ port: 3000 })
|
|
5695
6061
|
* ```
|
|
5696
6062
|
*/ var NaviosFactory = class {
|
|
5697
6063
|
/**
|
|
5698
6064
|
* Creates a new Navios application instance.
|
|
5699
|
-
*
|
|
6065
|
+
*
|
|
5700
6066
|
* This method sets up the dependency injection container, registers the HTTP adapter,
|
|
5701
6067
|
* configures logging, and initializes the application with the provided module.
|
|
5702
|
-
*
|
|
6068
|
+
*
|
|
5703
6069
|
* @param appModule - The root application module class decorated with @Module()
|
|
5704
6070
|
* @param options - Configuration options for the application
|
|
5705
6071
|
* @param options.adapter - HTTP adapter environment (required for HTTP server functionality)
|
|
@@ -5709,20 +6075,20 @@ _dec$14 = (0, _navios_di.Injectable)();
|
|
|
5709
6075
|
* - `false` to disable logging
|
|
5710
6076
|
* @param options.container - Optional custom dependency injection container (useful for testing)
|
|
5711
6077
|
* @returns A configured NaviosApplication instance ready to be initialized
|
|
5712
|
-
*
|
|
6078
|
+
*
|
|
5713
6079
|
* @example
|
|
5714
6080
|
* ```typescript
|
|
5715
6081
|
* // Basic setup with Fastify adapter
|
|
5716
6082
|
* const app = await NaviosFactory.create(AppModule, {
|
|
5717
6083
|
* adapter: defineFastifyEnvironment(),
|
|
5718
6084
|
* })
|
|
5719
|
-
*
|
|
6085
|
+
*
|
|
5720
6086
|
* // With custom logger configuration
|
|
5721
6087
|
* const app = await NaviosFactory.create(AppModule, {
|
|
5722
6088
|
* adapter: defineFastifyEnvironment(),
|
|
5723
6089
|
* logger: ['error', 'warn', 'log'],
|
|
5724
6090
|
* })
|
|
5725
|
-
*
|
|
6091
|
+
*
|
|
5726
6092
|
* // With custom container for testing
|
|
5727
6093
|
* const container = new Container()
|
|
5728
6094
|
* const app = await NaviosFactory.create(AppModule, {
|
|
@@ -5731,7 +6097,9 @@ _dec$14 = (0, _navios_di.Injectable)();
|
|
|
5731
6097
|
* })
|
|
5732
6098
|
* ```
|
|
5733
6099
|
*/ static async create(appModule, options = { adapter: [] }) {
|
|
5734
|
-
const container = options.container ?? new _navios_di.Container();
|
|
6100
|
+
const container = options.container ?? new _navios_di.Container(options.registry);
|
|
6101
|
+
if (options.enableRequestId === true) setRequestIdEnabled(true);
|
|
6102
|
+
container.addInstance(NaviosOptionsToken, options);
|
|
5735
6103
|
await this.registerLoggerConfiguration(container, options);
|
|
5736
6104
|
const adapters = Array.isArray(options.adapter) ? options.adapter : [options.adapter];
|
|
5737
6105
|
for (const adapter of adapters) await this.registerEnvironment(container, adapter);
|
|
@@ -5746,8 +6114,14 @@ _dec$14 = (0, _navios_di.Injectable)();
|
|
|
5746
6114
|
}
|
|
5747
6115
|
static async registerLoggerConfiguration(container, options) {
|
|
5748
6116
|
const { logger } = options;
|
|
5749
|
-
if (Array.isArray(logger) || isNil(logger)
|
|
5750
|
-
|
|
6117
|
+
if (Array.isArray(logger) || isNil(logger) || options.enableRequestId) {
|
|
6118
|
+
(await container.get(LoggerOutput))?.setup({
|
|
6119
|
+
logLevels: Array.isArray(logger) ? logger : void 0,
|
|
6120
|
+
requestId: options.enableRequestId ?? false
|
|
6121
|
+
});
|
|
6122
|
+
return;
|
|
6123
|
+
}
|
|
6124
|
+
if (logger !== true && !isNil(logger)) container.addInstance(LoggerOutput, logger);
|
|
5751
6125
|
}
|
|
5752
6126
|
};
|
|
5753
6127
|
|
|
@@ -5764,6 +6138,7 @@ var lib_exports = /* @__PURE__ */ __export({
|
|
|
5764
6138
|
ConsoleLogger: () => _ConsoleLogger,
|
|
5765
6139
|
Controller: () => Controller,
|
|
5766
6140
|
ControllerMetadataKey: () => ControllerMetadataKey,
|
|
6141
|
+
ControllerResolverService: () => ControllerResolverService,
|
|
5767
6142
|
Endpoint: () => Endpoint,
|
|
5768
6143
|
EndpointAdapterFactory: () => _EndpointAdapterFactory,
|
|
5769
6144
|
EndpointAdapterToken: () => EndpointAdapterToken,
|
|
@@ -5778,6 +6153,7 @@ var lib_exports = /* @__PURE__ */ __export({
|
|
|
5778
6153
|
HttpAdapterToken: () => HttpAdapterToken,
|
|
5779
6154
|
HttpCode: () => HttpCode,
|
|
5780
6155
|
HttpException: () => HttpException,
|
|
6156
|
+
InstanceResolverService: () => _InstanceResolverService,
|
|
5781
6157
|
InternalServerErrorException: () => InternalServerErrorException,
|
|
5782
6158
|
LOG_LEVELS: () => LOG_LEVELS,
|
|
5783
6159
|
Logger: () => Logger,
|
|
@@ -5791,6 +6167,7 @@ var lib_exports = /* @__PURE__ */ __export({
|
|
|
5791
6167
|
MultipartAdapterToken: () => MultipartAdapterToken,
|
|
5792
6168
|
NaviosApplication: () => _NaviosApplication,
|
|
5793
6169
|
NaviosFactory: () => NaviosFactory,
|
|
6170
|
+
NaviosOptionsToken: () => NaviosOptionsToken,
|
|
5794
6171
|
NotFoundException: () => NotFoundException,
|
|
5795
6172
|
Reply: () => Reply,
|
|
5796
6173
|
ReplyFactory: () => _ReplyFactory,
|
|
@@ -5810,6 +6187,7 @@ var lib_exports = /* @__PURE__ */ __export({
|
|
|
5810
6187
|
extractControllerMetadata: () => extractControllerMetadata,
|
|
5811
6188
|
extractModuleMetadata: () => extractModuleMetadata,
|
|
5812
6189
|
filterLogLevels: () => filterLogLevels,
|
|
6190
|
+
generateRequestId: () => generateRequestId,
|
|
5813
6191
|
getAllEndpointMetadata: () => getAllEndpointMetadata,
|
|
5814
6192
|
getControllerMetadata: () => getControllerMetadata,
|
|
5815
6193
|
getEndpointMetadata: () => getEndpointMetadata,
|
|
@@ -5832,8 +6210,8 @@ var lib_exports = /* @__PURE__ */ __export({
|
|
|
5832
6210
|
loggerOptionsSchema: () => loggerOptionsSchema,
|
|
5833
6211
|
normalizePath: () => normalizePath,
|
|
5834
6212
|
provideConfig: () => provideConfig,
|
|
5835
|
-
requestIdStore: () => requestIdStore,
|
|
5836
6213
|
runWithRequestId: () => runWithRequestId,
|
|
6214
|
+
setRequestIdEnabled: () => setRequestIdEnabled,
|
|
5837
6215
|
stripEndSlash: () => stripEndSlash,
|
|
5838
6216
|
yellow: () => yellow
|
|
5839
6217
|
});
|
|
@@ -6318,7 +6696,7 @@ var CliModuleLoaderService = class {
|
|
|
6318
6696
|
async traverseModules(module$1, parentMetadata) {
|
|
6319
6697
|
const metadata = extractCliModuleMetadata(module$1);
|
|
6320
6698
|
if (parentMetadata) this.mergeMetadata(metadata, parentMetadata);
|
|
6321
|
-
const moduleName = module$1.
|
|
6699
|
+
const moduleName = (0, lib_exports.getInjectableToken)(module$1).id;
|
|
6322
6700
|
if (this.modulesMetadata.has(moduleName)) return;
|
|
6323
6701
|
this.modulesMetadata.set(moduleName, metadata);
|
|
6324
6702
|
for (const command of metadata.commands) {
|
|
@@ -7407,14 +7785,16 @@ var CommanderApplication = class {
|
|
|
7407
7785
|
* }
|
|
7408
7786
|
* }
|
|
7409
7787
|
* ```
|
|
7410
|
-
*/ function Command({ path, optionsSchema }) {
|
|
7788
|
+
*/ function Command({ path, optionsSchema, priority, registry }) {
|
|
7411
7789
|
return function(target, context) {
|
|
7412
7790
|
if (context.kind !== "class") throw new Error("[Navios Commander] @Command decorator can only be used on classes.");
|
|
7413
7791
|
const token = lib_exports.InjectionToken.create(target);
|
|
7414
7792
|
if (context.metadata) getCommandMetadata(target, context, path, optionsSchema);
|
|
7415
7793
|
return (0, lib_exports.Injectable)({
|
|
7416
7794
|
token,
|
|
7417
|
-
scope: lib_exports.InjectableScope.Singleton
|
|
7795
|
+
scope: lib_exports.InjectableScope.Singleton,
|
|
7796
|
+
priority,
|
|
7797
|
+
registry
|
|
7418
7798
|
})(target, context);
|
|
7419
7799
|
};
|
|
7420
7800
|
}
|
|
@@ -7442,7 +7822,7 @@ var CommanderApplication = class {
|
|
|
7442
7822
|
* })
|
|
7443
7823
|
* export class AppModule {}
|
|
7444
7824
|
* ```
|
|
7445
|
-
*/ function CliModule({ commands = [], imports = [] } = {
|
|
7825
|
+
*/ function CliModule({ commands = [], imports = [], priority, registry } = {
|
|
7446
7826
|
commands: [],
|
|
7447
7827
|
imports: []
|
|
7448
7828
|
}) {
|
|
@@ -7454,7 +7834,9 @@ var CommanderApplication = class {
|
|
|
7454
7834
|
for (const importedModule of imports) moduleMetadata.imports.add(importedModule);
|
|
7455
7835
|
return (0, lib_exports.Injectable)({
|
|
7456
7836
|
token,
|
|
7457
|
-
scope: lib_exports.InjectableScope.Singleton
|
|
7837
|
+
scope: lib_exports.InjectableScope.Singleton,
|
|
7838
|
+
priority,
|
|
7839
|
+
registry
|
|
7458
7840
|
})(target, context);
|
|
7459
7841
|
};
|
|
7460
7842
|
}
|
|
@@ -7482,6 +7864,7 @@ var src_exports = /* @__PURE__ */ __export({
|
|
|
7482
7864
|
ConsoleLogger: () => _ConsoleLogger,
|
|
7483
7865
|
Controller: () => Controller,
|
|
7484
7866
|
ControllerMetadataKey: () => ControllerMetadataKey,
|
|
7867
|
+
ControllerResolverService: () => ControllerResolverService,
|
|
7485
7868
|
Endpoint: () => Endpoint,
|
|
7486
7869
|
EndpointAdapterFactory: () => _EndpointAdapterFactory,
|
|
7487
7870
|
EndpointAdapterToken: () => EndpointAdapterToken,
|
|
@@ -7496,6 +7879,7 @@ var src_exports = /* @__PURE__ */ __export({
|
|
|
7496
7879
|
HttpAdapterToken: () => HttpAdapterToken,
|
|
7497
7880
|
HttpCode: () => HttpCode,
|
|
7498
7881
|
HttpException: () => HttpException,
|
|
7882
|
+
InstanceResolverService: () => _InstanceResolverService,
|
|
7499
7883
|
InternalServerErrorException: () => InternalServerErrorException,
|
|
7500
7884
|
LOG_LEVELS: () => LOG_LEVELS,
|
|
7501
7885
|
Logger: () => Logger,
|
|
@@ -7509,6 +7893,7 @@ var src_exports = /* @__PURE__ */ __export({
|
|
|
7509
7893
|
MultipartAdapterToken: () => MultipartAdapterToken,
|
|
7510
7894
|
NaviosApplication: () => _NaviosApplication,
|
|
7511
7895
|
NaviosFactory: () => NaviosFactory,
|
|
7896
|
+
NaviosOptionsToken: () => NaviosOptionsToken,
|
|
7512
7897
|
NotFoundException: () => NotFoundException,
|
|
7513
7898
|
Reply: () => Reply,
|
|
7514
7899
|
ReplyFactory: () => _ReplyFactory,
|
|
@@ -7530,6 +7915,7 @@ var src_exports = /* @__PURE__ */ __export({
|
|
|
7530
7915
|
extractControllerMetadata: () => extractControllerMetadata,
|
|
7531
7916
|
extractModuleMetadata: () => extractModuleMetadata,
|
|
7532
7917
|
filterLogLevels: () => filterLogLevels,
|
|
7918
|
+
generateRequestId: () => generateRequestId,
|
|
7533
7919
|
getAllEndpointMetadata: () => getAllEndpointMetadata,
|
|
7534
7920
|
getCliModuleMetadata: () => getCliModuleMetadata,
|
|
7535
7921
|
getCommandMetadata: () => getCommandMetadata,
|
|
@@ -7556,8 +7942,8 @@ var src_exports = /* @__PURE__ */ __export({
|
|
|
7556
7942
|
loggerOptionsSchema: () => loggerOptionsSchema,
|
|
7557
7943
|
normalizePath: () => normalizePath,
|
|
7558
7944
|
provideConfig: () => provideConfig,
|
|
7559
|
-
requestIdStore: () => requestIdStore,
|
|
7560
7945
|
runWithRequestId: () => runWithRequestId,
|
|
7946
|
+
setRequestIdEnabled: () => setRequestIdEnabled,
|
|
7561
7947
|
stripEndSlash: () => stripEndSlash,
|
|
7562
7948
|
yellow: () => yellow
|
|
7563
7949
|
});
|
|
@@ -7609,6 +7995,7 @@ Object.defineProperty(exports, 'ConsoleLogger', {
|
|
|
7609
7995
|
});
|
|
7610
7996
|
exports.Controller = Controller;
|
|
7611
7997
|
exports.ControllerMetadataKey = ControllerMetadataKey;
|
|
7998
|
+
exports.ControllerResolverService = ControllerResolverService;
|
|
7612
7999
|
exports.Endpoint = Endpoint;
|
|
7613
8000
|
Object.defineProperty(exports, 'EndpointAdapterFactory', {
|
|
7614
8001
|
enumerable: true,
|
|
@@ -7638,6 +8025,12 @@ Object.defineProperty(exports, 'HttpAdapterFactory', {
|
|
|
7638
8025
|
exports.HttpAdapterToken = HttpAdapterToken;
|
|
7639
8026
|
exports.HttpCode = HttpCode;
|
|
7640
8027
|
exports.HttpException = HttpException;
|
|
8028
|
+
Object.defineProperty(exports, 'InstanceResolverService', {
|
|
8029
|
+
enumerable: true,
|
|
8030
|
+
get: function () {
|
|
8031
|
+
return _InstanceResolverService;
|
|
8032
|
+
}
|
|
8033
|
+
});
|
|
7641
8034
|
exports.InternalServerErrorException = InternalServerErrorException;
|
|
7642
8035
|
exports.LOG_LEVELS = LOG_LEVELS;
|
|
7643
8036
|
exports.Logger = Logger;
|
|
@@ -7671,6 +8064,7 @@ Object.defineProperty(exports, 'NaviosApplication', {
|
|
|
7671
8064
|
}
|
|
7672
8065
|
});
|
|
7673
8066
|
exports.NaviosFactory = NaviosFactory;
|
|
8067
|
+
exports.NaviosOptionsToken = NaviosOptionsToken;
|
|
7674
8068
|
exports.NotFoundException = NotFoundException;
|
|
7675
8069
|
exports.Reply = Reply;
|
|
7676
8070
|
Object.defineProperty(exports, 'ReplyFactory', {
|
|
@@ -7712,6 +8106,7 @@ exports.extractCommandMetadata = extractCommandMetadata;
|
|
|
7712
8106
|
exports.extractControllerMetadata = extractControllerMetadata;
|
|
7713
8107
|
exports.extractModuleMetadata = extractModuleMetadata;
|
|
7714
8108
|
exports.filterLogLevels = filterLogLevels;
|
|
8109
|
+
exports.generateRequestId = generateRequestId;
|
|
7715
8110
|
exports.getAllEndpointMetadata = getAllEndpointMetadata;
|
|
7716
8111
|
exports.getCliModuleMetadata = getCliModuleMetadata;
|
|
7717
8112
|
exports.getCommandMetadata = getCommandMetadata;
|
|
@@ -7738,8 +8133,8 @@ exports.isUndefined = isUndefined;
|
|
|
7738
8133
|
exports.loggerOptionsSchema = loggerOptionsSchema;
|
|
7739
8134
|
exports.normalizePath = normalizePath;
|
|
7740
8135
|
exports.provideConfig = provideConfig;
|
|
7741
|
-
exports.requestIdStore = requestIdStore;
|
|
7742
8136
|
exports.runWithRequestId = runWithRequestId;
|
|
8137
|
+
exports.setRequestIdEnabled = setRequestIdEnabled;
|
|
7743
8138
|
exports.stripEndSlash = stripEndSlash;
|
|
7744
8139
|
exports.yellow = yellow;
|
|
7745
8140
|
Object.keys(_navios_di).forEach(function (k) {
|