@navios/core 0.2.1 → 0.2.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/docs/README.md +6 -0
  2. package/docs/recipes/prisma.md +60 -0
  3. package/examples/simple-test/api/index.mts +64 -0
  4. package/examples/simple-test/config/config.service.mts +14 -0
  5. package/examples/simple-test/config/configuration.mts +7 -0
  6. package/examples/simple-test/index.mts +16 -0
  7. package/examples/simple-test/src/acl/acl-modern.guard.mts +15 -0
  8. package/examples/simple-test/src/acl/acl.guard.mts +14 -0
  9. package/examples/simple-test/src/acl/app.guard.mts +27 -0
  10. package/examples/simple-test/src/acl/one-more.guard.mts +15 -0
  11. package/examples/simple-test/src/acl/public.attribute.mts +21 -0
  12. package/examples/simple-test/src/app.module.mts +9 -0
  13. package/examples/simple-test/src/user/user.controller.mts +72 -0
  14. package/examples/simple-test/src/user/user.module.mts +14 -0
  15. package/examples/simple-test/src/user/user.service.mts +14 -0
  16. package/{dist → lib}/_tsup-dts-rollup.d.mts +71 -50
  17. package/{dist → lib}/_tsup-dts-rollup.d.ts +71 -50
  18. package/{dist → lib}/index.d.mts +13 -4
  19. package/{dist → lib}/index.d.ts +13 -4
  20. package/{dist → lib}/index.js +270 -490
  21. package/lib/index.js.map +1 -0
  22. package/{dist → lib}/index.mjs +140 -353
  23. package/lib/index.mjs.map +1 -0
  24. package/package.json +10 -11
  25. package/project.json +53 -0
  26. package/src/__tests__/config.service.spec.mts +41 -0
  27. package/src/config/config-service.interface.mts +1 -1
  28. package/src/config/config.provider.mts +22 -50
  29. package/src/config/config.service.mts +25 -8
  30. package/src/decorators/endpoint.decorator.mts +0 -5
  31. package/tsconfig.json +16 -0
  32. package/tsup.config.mts +12 -0
  33. package/vitest.config.mts +9 -0
@@ -1,3 +1,14 @@
1
+ import { InjectionToken, Injectable, InjectableType, getGlobalServiceLocator, inject, syncInject, InjectableScope } from '@navios/di';
2
+ export * from '@navios/di';
3
+ import { z, ZodOptional, ZodArray, ZodObject } from 'zod';
4
+ import { env } from 'node:process';
5
+ import { NaviosException } from '@navios/common';
6
+ import { inspect } from 'util';
7
+ import cors from '@fastify/cors';
8
+ import multipart from '@fastify/multipart';
9
+ import { fastify } from 'fastify';
10
+ import { validatorCompiler, serializerCompiler } from 'fastify-type-provider-zod';
11
+
1
12
  var __create = Object.create;
2
13
  var __defProp = Object.defineProperty;
3
14
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -7,53 +18,28 @@ var __typeError = (msg) => {
7
18
  };
8
19
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9
20
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
10
- var __decoratorStart = (base) => [, , , __create((base == null ? void 0 : base[__knownSymbol("metadata")]) ?? null)];
21
+ var __decoratorStart = (base) => [, , , __create(base?.[__knownSymbol("metadata")] ?? null)];
11
22
  var __decoratorStrings = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
12
23
  var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError("Function expected") : fn;
13
24
  var __decoratorContext = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError("Already initialized") : fns.push(__expectFn(fn || null)) });
14
25
  var __decoratorMetadata = (array, target) => __defNormalProp(target, __knownSymbol("metadata"), array[3]);
15
26
  var __runInitializers = (array, flags, self, value) => {
16
- for (var i = 0, fns = array[flags >> 1], n = fns && fns.length; i < n; i++) flags & 1 ? fns[i].call(self) : value = fns[i].call(self, value);
27
+ for (var i = 0, fns = array[flags >> 1], n = fns && fns.length; i < n; i++) fns[i].call(self) ;
17
28
  return value;
18
29
  };
19
30
  var __decorateElement = (array, flags, name, decorators, target, extra) => {
20
- var fn, it, done, ctx, access, k = flags & 7, s = !!(flags & 8), p = !!(flags & 16);
21
- var j = k > 3 ? array.length + 1 : k ? s ? 1 : 2 : 0, key = __decoratorStrings[k + 5];
22
- var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
23
- var desc = k && (!p && !s && (target = target.prototype), k < 5 && (k > 3 || !p) && __getOwnPropDesc(k < 4 ? target : { get [name]() {
24
- return __privateGet(this, extra);
25
- }, set [name](x) {
26
- return __privateSet(this, extra, x);
27
- } }, name));
28
- k ? p && k < 4 && __name(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name(target, name);
31
+ var it, done, ctx, k = flags & 7, p = false;
32
+ var j = 0;
33
+ var extraInitializers = array[j] || (array[j] = []);
34
+ var desc = k && ((target = target.prototype), k < 5 && (k > 3 || !p) && __getOwnPropDesc(target , name));
35
+ __name(target, name);
29
36
  for (var i = decorators.length - 1; i >= 0; i--) {
30
37
  ctx = __decoratorContext(k, name, done = {}, array[3], extraInitializers);
31
- if (k) {
32
- ctx.static = s, ctx.private = p, access = ctx.access = { has: p ? (x) => __privateIn(target, x) : (x) => name in x };
33
- if (k ^ 3) access.get = p ? (x) => (k ^ 1 ? __privateGet : __privateMethod)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
34
- if (k > 2) access.set = p ? (x, y) => __privateSet(x, target, y, k ^ 4 ? extra : desc.set) : (x, y) => x[name] = y;
35
- }
36
- it = (0, decorators[i])(k ? k < 4 ? p ? extra : desc[key] : k > 4 ? void 0 : { get: desc.get, set: desc.set } : target, ctx), done._ = 1;
37
- if (k ^ 4 || it === void 0) __expectFn(it) && (k > 4 ? initializers.unshift(it) : k ? p ? extra = it : desc[key] = it : target = it);
38
- else if (typeof it !== "object" || it === null) __typeError("Object expected");
39
- else __expectFn(fn = it.get) && (desc.get = fn), __expectFn(fn = it.set) && (desc.set = fn), __expectFn(fn = it.init) && initializers.unshift(fn);
38
+ it = (0, decorators[i])(target, ctx), done._ = 1;
39
+ __expectFn(it) && (target = it);
40
40
  }
41
- return k || __decoratorMetadata(array, target), desc && __defProp(target, name, desc), p ? k ^ 4 ? extra : desc : target;
41
+ return __decoratorMetadata(array, target), desc && __defProp(target, name, desc), p ? k ^ 4 ? extra : desc : target;
42
42
  };
43
- var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
44
- var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError('Cannot use the "in" operator on this value') : member.has(obj);
45
- var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
46
- var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
47
- var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
48
-
49
- // packages/core/src/index.mts
50
- export * from "@navios/di";
51
-
52
- // packages/core/src/adapters/endpoint-adapter.service.mts
53
- import { inject as inject2, Injectable as Injectable2, InjectionToken as InjectionToken2 } from "@navios/di";
54
-
55
- // packages/core/src/adapters/stream-adapter.service.mts
56
- import { inject, Injectable, InjectionToken } from "@navios/di";
57
43
  var StreamAdapterToken = InjectionToken.create(
58
44
  Symbol.for("StreamAdapterService")
59
45
  );
@@ -122,12 +108,12 @@ _init = __decoratorStart(null);
122
108
  StreamAdapterService = __decorateElement(_init, 0, "StreamAdapterService", _StreamAdapterService_decorators, StreamAdapterService);
123
109
  __runInitializers(_init, 1, StreamAdapterService);
124
110
 
125
- // packages/core/src/adapters/endpoint-adapter.service.mts
126
- var EndpointAdapterToken = InjectionToken2.create(
111
+ // src/adapters/endpoint-adapter.service.mts
112
+ var EndpointAdapterToken = InjectionToken.create(
127
113
  Symbol.for("EndpointAdapterService")
128
114
  );
129
115
  var _EndpointAdapterService_decorators, _init2, _a;
130
- _EndpointAdapterService_decorators = [Injectable2({
116
+ _EndpointAdapterService_decorators = [Injectable({
131
117
  token: EndpointAdapterToken
132
118
  })];
133
119
  var EndpointAdapterService = class extends (_a = StreamAdapterService) {
@@ -160,7 +146,7 @@ var EndpointAdapterService = class extends (_a = StreamAdapterService) {
160
146
  return argument;
161
147
  };
162
148
  return async function(request, reply) {
163
- const controllerInstance = await inject2(controller);
149
+ const controllerInstance = await inject(controller);
164
150
  const argument = await formatArguments(request);
165
151
  const result = await controllerInstance[handlerMetadata.classMethod](argument);
166
152
  reply.status(handlerMetadata.successStatusCode).headers(handlerMetadata.headers).send(result);
@@ -170,15 +156,11 @@ var EndpointAdapterService = class extends (_a = StreamAdapterService) {
170
156
  _init2 = __decoratorStart(_a);
171
157
  EndpointAdapterService = __decorateElement(_init2, 0, "EndpointAdapterService", _EndpointAdapterService_decorators, EndpointAdapterService);
172
158
  __runInitializers(_init2, 1, EndpointAdapterService);
173
-
174
- // packages/core/src/adapters/multipart-adapter.service.mts
175
- import { Injectable as Injectable3, InjectionToken as InjectionToken3 } from "@navios/di";
176
- import { ZodArray, ZodObject, ZodOptional } from "zod";
177
- var MultipartAdapterToken = InjectionToken3.create(
159
+ var MultipartAdapterToken = InjectionToken.create(
178
160
  Symbol.for("MultipartAdapterService")
179
161
  );
180
162
  var _MultipartAdapterService_decorators, _init3, _a2;
181
- _MultipartAdapterService_decorators = [Injectable3({
163
+ _MultipartAdapterService_decorators = [Injectable({
182
164
  token: MultipartAdapterToken
183
165
  })];
184
166
  var MultipartAdapterService = class extends (_a2 = EndpointAdapterService) {
@@ -271,9 +253,6 @@ var MultipartAdapterService = class extends (_a2 = EndpointAdapterService) {
271
253
  _init3 = __decoratorStart(_a2);
272
254
  MultipartAdapterService = __decorateElement(_init3, 0, "MultipartAdapterService", _MultipartAdapterService_decorators, MultipartAdapterService);
273
255
  __runInitializers(_init3, 1, MultipartAdapterService);
274
-
275
- // packages/core/src/config/utils/helpers.mts
276
- import { env } from "node:process";
277
256
  function envInt(key, defaultValue) {
278
257
  const envKey = env[key] || process.env[key];
279
258
  return envKey ? parseInt(envKey, 10) : defaultValue;
@@ -282,16 +261,7 @@ function envString(key, defaultValue) {
282
261
  return env[key] || process.env[key] || defaultValue || void 0;
283
262
  }
284
263
 
285
- // packages/core/src/config/config.provider.mts
286
- import {
287
- Injectable as Injectable10,
288
- InjectableType as InjectableType2,
289
- InjectionToken as InjectionToken11,
290
- syncInject as syncInject3
291
- } from "@navios/di";
292
- import { z as z2 } from "zod";
293
-
294
- // packages/core/src/logger/utils/cli-colors.util.mts
264
+ // src/logger/utils/cli-colors.util.mts
295
265
  var isColorAllowed = () => !process.env.NO_COLOR;
296
266
  var colorIfAllowed = (colorFn) => (text) => isColorAllowed() ? colorFn(text) : text;
297
267
  var clc = {
@@ -306,7 +276,7 @@ var yellow = colorIfAllowed(
306
276
  (text) => `\x1B[38;5;3m${text}\x1B[39m`
307
277
  );
308
278
 
309
- // packages/core/src/logger/log-levels.mts
279
+ // src/logger/log-levels.mts
310
280
  var LOG_LEVELS = [
311
281
  "verbose",
312
282
  "debug",
@@ -316,12 +286,12 @@ var LOG_LEVELS = [
316
286
  "fatal"
317
287
  ];
318
288
 
319
- // packages/core/src/logger/utils/is-log-level.util.mts
289
+ // src/logger/utils/is-log-level.util.mts
320
290
  function isLogLevel(maybeLogLevel) {
321
291
  return LOG_LEVELS.includes(maybeLogLevel);
322
292
  }
323
293
 
324
- // packages/core/src/logger/utils/filter-log-levelts.util.mts
294
+ // src/logger/utils/filter-log-levelts.util.mts
325
295
  function filterLogLevels(parseableString = "") {
326
296
  const sanitizedString = parseableString.replaceAll(" ", "").toLowerCase();
327
297
  if (sanitizedString[0] === ">") {
@@ -339,7 +309,7 @@ function filterLogLevels(parseableString = "") {
339
309
  return isLogLevel(sanitizedString) ? [sanitizedString] : LOG_LEVELS;
340
310
  }
341
311
 
342
- // packages/core/src/logger/utils/is-log-level-enabled.mts
312
+ // src/logger/utils/is-log-level-enabled.mts
343
313
  var LOG_LEVEL_VALUES = {
344
314
  verbose: 0,
345
315
  debug: 1,
@@ -349,19 +319,18 @@ var LOG_LEVEL_VALUES = {
349
319
  fatal: 5
350
320
  };
351
321
  function isLogLevelEnabled(targetLevel, logLevels) {
352
- var _a3;
353
- if (!logLevels || Array.isArray(logLevels) && (logLevels == null ? void 0 : logLevels.length) === 0) {
322
+ if (!logLevels || Array.isArray(logLevels) && logLevels?.length === 0) {
354
323
  return false;
355
324
  }
356
325
  if (logLevels.includes(targetLevel)) {
357
326
  return true;
358
327
  }
359
- const highestLogLevelValue = (_a3 = logLevels.map((level) => LOG_LEVEL_VALUES[level]).sort((a, b) => b - a)) == null ? void 0 : _a3[0];
328
+ const highestLogLevelValue = logLevels.map((level) => LOG_LEVEL_VALUES[level]).sort((a, b) => b - a)?.[0];
360
329
  const targetLevelValue = LOG_LEVEL_VALUES[targetLevel];
361
330
  return targetLevelValue >= highestLogLevelValue;
362
331
  }
363
332
 
364
- // packages/core/src/logger/utils/shared.utils.mts
333
+ // src/logger/utils/shared.utils.mts
365
334
  var isUndefined = (obj) => typeof obj === "undefined";
366
335
  var isObject = (fn) => !isNil(fn) && typeof fn === "object";
367
336
  var isPlainObject = (fn) => {
@@ -385,30 +354,12 @@ var isConstructor = (val) => val === "constructor";
385
354
  var isNil = (val) => isUndefined(val) || val === null;
386
355
  var isEmpty = (array) => !(array && array.length > 0);
387
356
  var isSymbol = (val) => typeof val === "symbol";
388
-
389
- // packages/core/src/logger/console-logger.service.mts
390
- import { inspect } from "util";
391
- import { getGlobalServiceLocator as getGlobalServiceLocator2, Injectable as Injectable7 } from "@navios/di";
392
-
393
- // packages/core/src/tokens/application.token.mts
394
- import { InjectionToken as InjectionToken4 } from "@navios/di";
395
357
  var ApplicationInjectionToken = "ApplicationInjectionToken";
396
- var Application = InjectionToken4.create(
358
+ var Application = InjectionToken.create(
397
359
  ApplicationInjectionToken
398
360
  );
399
361
 
400
- // packages/core/src/tokens/execution-context.token.mts
401
- import { InjectionToken as InjectionToken7 } from "@navios/di";
402
-
403
- // packages/core/src/services/controller-adapter.service.mts
404
- import {
405
- getGlobalServiceLocator,
406
- inject as inject4,
407
- Injectable as Injectable5,
408
- syncInject
409
- } from "@navios/di";
410
-
411
- // packages/core/src/metadata/handler.metadata.mts
362
+ // src/metadata/handler.metadata.mts
412
363
  var EndpointMetadataKey = Symbol("EndpointMetadataKey");
413
364
  function getAllEndpointMetadata(context) {
414
365
  if (context.metadata) {
@@ -452,7 +403,7 @@ function getEndpointMetadata(target, context) {
452
403
  throw new Error("[Navios] Wrong environment.");
453
404
  }
454
405
 
455
- // packages/core/src/metadata/controller.metadata.mts
406
+ // src/metadata/controller.metadata.mts
456
407
  var ControllerMetadataKey = Symbol("ControllerMetadataKey");
457
408
  function getControllerMetadata(target, context) {
458
409
  if (context.metadata) {
@@ -487,7 +438,7 @@ function hasControllerMetadata(target) {
487
438
  return !!metadata;
488
439
  }
489
440
 
490
- // packages/core/src/metadata/module.metadata.mts
441
+ // src/metadata/module.metadata.mts
491
442
  var ModuleMetadataKey = Symbol("ControllerMetadataKey");
492
443
  function getModuleMetadata(target, context) {
493
444
  if (context.metadata) {
@@ -521,7 +472,7 @@ function hasModuleMetadata(target) {
521
472
  return !!target[ModuleMetadataKey];
522
473
  }
523
474
 
524
- // packages/core/src/services/execution-context.mts
475
+ // src/services/execution-context.mts
525
476
  var ExecutionContext = class {
526
477
  constructor(module, controller, handler) {
527
478
  this.module = module;
@@ -563,10 +514,7 @@ var ExecutionContext = class {
563
514
  }
564
515
  };
565
516
 
566
- // packages/core/src/services/guard-runner.service.mts
567
- import { inject as inject3, Injectable as Injectable4 } from "@navios/di";
568
-
569
- // packages/core/src/exceptions/http.exception.mts
517
+ // src/exceptions/http.exception.mts
570
518
  var HttpException = class {
571
519
  constructor(statusCode, response, error) {
572
520
  this.statusCode = statusCode;
@@ -575,28 +523,28 @@ var HttpException = class {
575
523
  }
576
524
  };
577
525
 
578
- // packages/core/src/exceptions/bad-request.exception.mts
526
+ // src/exceptions/bad-request.exception.mts
579
527
  var BadRequestException = class extends HttpException {
580
528
  constructor(message) {
581
529
  super(400, message);
582
530
  }
583
531
  };
584
532
 
585
- // packages/core/src/exceptions/forbidden.exception.mts
533
+ // src/exceptions/forbidden.exception.mts
586
534
  var ForbiddenException = class extends HttpException {
587
535
  constructor(message) {
588
536
  super(403, message);
589
537
  }
590
538
  };
591
539
 
592
- // packages/core/src/exceptions/internal-server-error.exception.mts
540
+ // src/exceptions/internal-server-error.exception.mts
593
541
  var InternalServerErrorException = class extends HttpException {
594
542
  constructor(message, error) {
595
543
  super(500, message, error);
596
544
  }
597
545
  };
598
546
 
599
- // packages/core/src/exceptions/not-found.exception.mts
547
+ // src/exceptions/not-found.exception.mts
600
548
  var NotFoundException = class extends HttpException {
601
549
  constructor(response, error) {
602
550
  super(404, response, error);
@@ -605,28 +553,28 @@ var NotFoundException = class extends HttpException {
605
553
  }
606
554
  };
607
555
 
608
- // packages/core/src/exceptions/unauthorized.exception.mts
556
+ // src/exceptions/unauthorized.exception.mts
609
557
  var UnauthorizedException = class extends HttpException {
610
558
  constructor(message, error) {
611
559
  super(401, message, error);
612
560
  }
613
561
  };
614
562
 
615
- // packages/core/src/exceptions/conflict.exception.mts
563
+ // src/exceptions/conflict.exception.mts
616
564
  var ConflictException = class extends HttpException {
617
565
  constructor(message, error) {
618
566
  super(409, message, error);
619
567
  }
620
568
  };
621
569
 
622
- // packages/core/src/services/guard-runner.service.mts
570
+ // src/services/guard-runner.service.mts
623
571
  var _GuardRunnerService_decorators, _init4;
624
- _GuardRunnerService_decorators = [Injectable4()];
572
+ _GuardRunnerService_decorators = [Injectable()];
625
573
  var GuardRunnerService = class {
626
574
  async runGuards(allGuards, executionContext) {
627
575
  let canActivate = true;
628
576
  for (const guard of Array.from(allGuards).reverse()) {
629
- const guardInstance = await inject3(
577
+ const guardInstance = await inject(
630
578
  guard
631
579
  );
632
580
  if (!guardInstance.canActivate) {
@@ -687,16 +635,15 @@ _init4 = __decoratorStart(null);
687
635
  GuardRunnerService = __decorateElement(_init4, 0, "GuardRunnerService", _GuardRunnerService_decorators, GuardRunnerService);
688
636
  __runInitializers(_init4, 1, GuardRunnerService);
689
637
 
690
- // packages/core/src/services/controller-adapter.service.mts
638
+ // src/services/controller-adapter.service.mts
691
639
  var _ControllerAdapterService_decorators, _init5;
692
- _ControllerAdapterService_decorators = [Injectable5()];
640
+ _ControllerAdapterService_decorators = [Injectable()];
693
641
  var _ControllerAdapterService = class _ControllerAdapterService {
694
642
  guardRunner = syncInject(GuardRunnerService);
695
643
  logger = syncInject(Logger, {
696
644
  context: _ControllerAdapterService.name
697
645
  });
698
646
  async setupController(controller, instance, moduleMetadata) {
699
- var _a3, _b;
700
647
  const controllerMetadata = extractControllerMetadata(controller);
701
648
  for (const endpoint of controllerMetadata.endpoints) {
702
649
  const { classMethod, url, httpMethod, adapterToken } = endpoint;
@@ -705,7 +652,7 @@ var _ControllerAdapterService = class _ControllerAdapterService {
705
652
  `[Navios] Malformed Endpoint ${controller.name}:${classMethod}`
706
653
  );
707
654
  }
708
- const adapter = await inject4(
655
+ const adapter = await inject(
709
656
  adapterToken
710
657
  );
711
658
  const executionContext = new ExecutionContext(
@@ -713,12 +660,12 @@ var _ControllerAdapterService = class _ControllerAdapterService {
713
660
  controllerMetadata,
714
661
  endpoint
715
662
  );
716
- const hasSchema = ((_a3 = adapter.hasSchema) == null ? void 0 : _a3.call(adapter, endpoint)) ?? false;
663
+ const hasSchema = adapter.hasSchema?.(endpoint) ?? false;
717
664
  if (hasSchema) {
718
665
  instance.withTypeProvider().route({
719
666
  method: httpMethod,
720
667
  url: url.replaceAll("$", ":"),
721
- schema: ((_b = adapter.provideSchema) == null ? void 0 : _b.call(adapter, endpoint)) ?? {},
668
+ schema: adapter.provideSchema?.(endpoint) ?? {},
722
669
  preHandler: this.providePreHandler(executionContext),
723
670
  handler: this.wrapHandler(
724
671
  executionContext,
@@ -783,13 +730,10 @@ _init5 = __decoratorStart(null);
783
730
  _ControllerAdapterService = __decorateElement(_init5, 0, "ControllerAdapterService", _ControllerAdapterService_decorators, _ControllerAdapterService);
784
731
  __runInitializers(_init5, 1, _ControllerAdapterService);
785
732
  var ControllerAdapterService = _ControllerAdapterService;
786
-
787
- // packages/core/src/services/module-loader.service.mts
788
- import { inject as inject5, Injectable as Injectable6, syncInject as syncInject2 } from "@navios/di";
789
733
  var _ModuleLoaderService_decorators, _init6;
790
- _ModuleLoaderService_decorators = [Injectable6()];
734
+ _ModuleLoaderService_decorators = [Injectable()];
791
735
  var _ModuleLoaderService = class _ModuleLoaderService {
792
- logger = syncInject2(Logger, {
736
+ logger = syncInject(Logger, {
793
737
  context: _ModuleLoaderService.name
794
738
  });
795
739
  modulesMetadata = /* @__PURE__ */ new Map();
@@ -817,7 +761,7 @@ var _ModuleLoaderService = class _ModuleLoaderService {
817
761
  async (importedModule) => this.traverseModules(importedModule, metadata)
818
762
  );
819
763
  await Promise.all(loadingPromises);
820
- const instance = await inject5(module);
764
+ const instance = await inject(module);
821
765
  if (instance.onModuleInit) {
822
766
  await instance.onModuleInit();
823
767
  }
@@ -853,25 +797,19 @@ _ModuleLoaderService = __decorateElement(_init6, 0, "ModuleLoaderService", _Modu
853
797
  __runInitializers(_init6, 1, _ModuleLoaderService);
854
798
  var ModuleLoaderService = _ModuleLoaderService;
855
799
 
856
- // packages/core/src/tokens/execution-context.token.mts
800
+ // src/tokens/execution-context.token.mts
857
801
  var ExecutionContextInjectionToken = "ExecutionContextInjectionToken";
858
- var ExecutionContextToken = InjectionToken7.create(
802
+ var ExecutionContextToken = InjectionToken.create(
859
803
  ExecutionContextInjectionToken
860
804
  );
861
-
862
- // packages/core/src/tokens/reply.token.mts
863
- import { InjectionToken as InjectionToken8 } from "@navios/di";
864
805
  var ReplyInjectionToken = "ReplyInjectionToken";
865
- var Reply = InjectionToken8.create(ReplyInjectionToken);
866
-
867
- // packages/core/src/tokens/request.token.mts
868
- import { InjectionToken as InjectionToken9 } from "@navios/di";
806
+ var Reply = InjectionToken.create(ReplyInjectionToken);
869
807
  var RequestInjectionToken = "RequestInjectionToken";
870
- var Request = InjectionToken9.create(
808
+ var Request = InjectionToken.create(
871
809
  RequestInjectionToken
872
810
  );
873
811
 
874
- // packages/core/src/logger/console-logger.service.mts
812
+ // src/logger/console-logger.service.mts
875
813
  var DEFAULT_DEPTH = 5;
876
814
  var DEFAULT_LOG_LEVELS = [
877
815
  "log",
@@ -890,7 +828,7 @@ var dateTimeFormatter = new Intl.DateTimeFormat(void 0, {
890
828
  month: "2-digit"
891
829
  });
892
830
  var _ConsoleLogger_decorators, _init7;
893
- _ConsoleLogger_decorators = [Injectable7()];
831
+ _ConsoleLogger_decorators = [Injectable()];
894
832
  var _ConsoleLogger = class _ConsoleLogger {
895
833
  /**
896
834
  * The options of the logger.
@@ -917,7 +855,7 @@ var _ConsoleLogger = class _ConsoleLogger {
917
855
  */
918
856
  static lastTimestampAt;
919
857
  constructor(contextOrOptions, options) {
920
- let [context, opts] = isString(contextOrOptions) ? [contextOrOptions, options] : options ? [void 0, options] : [contextOrOptions == null ? void 0 : contextOrOptions.context, contextOrOptions];
858
+ let [context, opts] = isString(contextOrOptions) ? [contextOrOptions, options] : options ? [void 0, options] : [contextOrOptions?.context, contextOrOptions];
921
859
  opts = opts ?? {};
922
860
  opts.logLevels ??= DEFAULT_LOG_LEVELS;
923
861
  opts.colors ??= opts.colors ?? (opts.json ? false : true);
@@ -928,11 +866,11 @@ var _ConsoleLogger = class _ConsoleLogger {
928
866
  this.context = context;
929
867
  this.originalContext = context;
930
868
  }
931
- if (opts == null ? void 0 : opts.requestId) {
932
- const locator = getGlobalServiceLocator2();
869
+ if (opts?.requestId) {
870
+ const locator = getGlobalServiceLocator();
933
871
  locator.getEventBus().on(locator.getInstanceIdentifier(Request, void 0), "create", () => {
934
872
  const request = locator.getSyncInstance(Request, void 0);
935
- this.requestId = (request == null ? void 0 : request.id) ?? null;
873
+ this.requestId = request?.id ?? null;
936
874
  });
937
875
  locator.getEventBus().on(
938
876
  locator.getInstanceIdentifier(Request, void 0),
@@ -1025,8 +963,7 @@ var _ConsoleLogger = class _ConsoleLogger {
1025
963
  this.context = this.originalContext;
1026
964
  }
1027
965
  isLevelEnabled(level) {
1028
- var _a3;
1029
- const logLevels = (_a3 = this.options) == null ? void 0 : _a3.logLevels;
966
+ const logLevels = this.options?.logLevels;
1030
967
  return isLogLevelEnabled(level, logLevels);
1031
968
  }
1032
969
  getTimestamp() {
@@ -1137,8 +1074,7 @@ var _ConsoleLogger = class _ConsoleLogger {
1137
1074
  `);
1138
1075
  }
1139
1076
  updateAndGetTimestampDiff() {
1140
- var _a3;
1141
- const includeTimestamp = _ConsoleLogger.lastTimestampAt && ((_a3 = this.options) == null ? void 0 : _a3.timestamp);
1077
+ const includeTimestamp = _ConsoleLogger.lastTimestampAt && this.options?.timestamp;
1142
1078
  const result = includeTimestamp ? this.formatTimestampDiff(Date.now() - _ConsoleLogger.lastTimestampAt) : "";
1143
1079
  _ConsoleLogger.lastTimestampAt = Date.now();
1144
1080
  return result;
@@ -1181,7 +1117,7 @@ var _ConsoleLogger = class _ConsoleLogger {
1181
1117
  return value;
1182
1118
  }
1183
1119
  getContextAndMessagesToPrint(args) {
1184
- if ((args == null ? void 0 : args.length) <= 1) {
1120
+ if (args?.length <= 1) {
1185
1121
  return { messages: args, context: this.context };
1186
1122
  }
1187
1123
  const lastElement = args[args.length - 1];
@@ -1206,7 +1142,7 @@ var _ConsoleLogger = class _ConsoleLogger {
1206
1142
  };
1207
1143
  }
1208
1144
  const { messages, context } = this.getContextAndMessagesToPrint(args);
1209
- if ((messages == null ? void 0 : messages.length) <= 1) {
1145
+ if (messages?.length <= 1) {
1210
1146
  return { messages, context };
1211
1147
  }
1212
1148
  const lastElement = messages[messages.length - 1];
@@ -1247,13 +1183,6 @@ _init7 = __decoratorStart(null);
1247
1183
  _ConsoleLogger = __decorateElement(_init7, 0, "ConsoleLogger", _ConsoleLogger_decorators, _ConsoleLogger);
1248
1184
  __runInitializers(_init7, 1, _ConsoleLogger);
1249
1185
  var ConsoleLogger = _ConsoleLogger;
1250
-
1251
- // packages/core/src/logger/logger.factory.mts
1252
- import { Injectable as Injectable9, InjectableType, InjectionToken as InjectionToken10 } from "@navios/di";
1253
- import { z } from "zod";
1254
-
1255
- // packages/core/src/logger/logger.service.mts
1256
- import { Injectable as Injectable8 } from "@navios/di";
1257
1186
  var DEFAULT_LOGGER = new ConsoleLogger();
1258
1187
  var dateTimeFormatter2 = new Intl.DateTimeFormat(void 0, {
1259
1188
  year: "numeric",
@@ -1264,7 +1193,7 @@ var dateTimeFormatter2 = new Intl.DateTimeFormat(void 0, {
1264
1193
  month: "2-digit"
1265
1194
  });
1266
1195
  var _LoggerInstance_decorators, _init8;
1267
- _LoggerInstance_decorators = [Injectable8()];
1196
+ _LoggerInstance_decorators = [Injectable()];
1268
1197
  var _LoggerInstance = class _LoggerInstance {
1269
1198
  constructor(context, options = {}) {
1270
1199
  this.context = context;
@@ -1285,69 +1214,56 @@ var _LoggerInstance = class _LoggerInstance {
1285
1214
  return _LoggerInstance.staticInstanceRef;
1286
1215
  }
1287
1216
  error(message, ...optionalParams) {
1288
- var _a3;
1289
1217
  optionalParams = this.context ? (optionalParams.length ? optionalParams : [void 0]).concat(
1290
1218
  this.context
1291
1219
  ) : optionalParams;
1292
- (_a3 = this.localInstance) == null ? void 0 : _a3.error(message, ...optionalParams);
1220
+ this.localInstance?.error(message, ...optionalParams);
1293
1221
  }
1294
1222
  log(message, ...optionalParams) {
1295
- var _a3;
1296
1223
  optionalParams = this.context ? optionalParams.concat(this.context) : optionalParams;
1297
- (_a3 = this.localInstance) == null ? void 0 : _a3.log(message, ...optionalParams);
1224
+ this.localInstance?.log(message, ...optionalParams);
1298
1225
  }
1299
1226
  warn(message, ...optionalParams) {
1300
- var _a3;
1301
1227
  optionalParams = this.context ? optionalParams.concat(this.context) : optionalParams;
1302
- (_a3 = this.localInstance) == null ? void 0 : _a3.warn(message, ...optionalParams);
1228
+ this.localInstance?.warn(message, ...optionalParams);
1303
1229
  }
1304
1230
  debug(message, ...optionalParams) {
1305
- var _a3, _b;
1306
1231
  optionalParams = this.context ? optionalParams.concat(this.context) : optionalParams;
1307
- (_b = (_a3 = this.localInstance) == null ? void 0 : _a3.debug) == null ? void 0 : _b.call(_a3, message, ...optionalParams);
1232
+ this.localInstance?.debug?.(message, ...optionalParams);
1308
1233
  }
1309
1234
  verbose(message, ...optionalParams) {
1310
- var _a3, _b;
1311
1235
  optionalParams = this.context ? optionalParams.concat(this.context) : optionalParams;
1312
- (_b = (_a3 = this.localInstance) == null ? void 0 : _a3.verbose) == null ? void 0 : _b.call(_a3, message, ...optionalParams);
1236
+ this.localInstance?.verbose?.(message, ...optionalParams);
1313
1237
  }
1314
1238
  fatal(message, ...optionalParams) {
1315
- var _a3, _b;
1316
1239
  optionalParams = this.context ? optionalParams.concat(this.context) : optionalParams;
1317
- (_b = (_a3 = this.localInstance) == null ? void 0 : _a3.fatal) == null ? void 0 : _b.call(_a3, message, ...optionalParams);
1240
+ this.localInstance?.fatal?.(message, ...optionalParams);
1318
1241
  }
1319
1242
  static error(message, ...optionalParams) {
1320
- var _a3;
1321
- (_a3 = this.staticInstanceRef) == null ? void 0 : _a3.error(message, ...optionalParams);
1243
+ this.staticInstanceRef?.error(message, ...optionalParams);
1322
1244
  }
1323
1245
  static log(message, ...optionalParams) {
1324
- var _a3;
1325
- (_a3 = this.staticInstanceRef) == null ? void 0 : _a3.log(message, ...optionalParams);
1246
+ this.staticInstanceRef?.log(message, ...optionalParams);
1326
1247
  }
1327
1248
  static warn(message, ...optionalParams) {
1328
- var _a3;
1329
- (_a3 = this.staticInstanceRef) == null ? void 0 : _a3.warn(message, ...optionalParams);
1249
+ this.staticInstanceRef?.warn(message, ...optionalParams);
1330
1250
  }
1331
1251
  static debug(message, ...optionalParams) {
1332
- var _a3, _b;
1333
- (_b = (_a3 = this.staticInstanceRef) == null ? void 0 : _a3.debug) == null ? void 0 : _b.call(_a3, message, ...optionalParams);
1252
+ this.staticInstanceRef?.debug?.(message, ...optionalParams);
1334
1253
  }
1335
1254
  static verbose(message, ...optionalParams) {
1336
- var _a3, _b;
1337
- (_b = (_a3 = this.staticInstanceRef) == null ? void 0 : _a3.verbose) == null ? void 0 : _b.call(_a3, message, ...optionalParams);
1255
+ this.staticInstanceRef?.verbose?.(message, ...optionalParams);
1338
1256
  }
1339
1257
  static fatal(message, ...optionalParams) {
1340
- var _a3, _b;
1341
- (_b = (_a3 = this.staticInstanceRef) == null ? void 0 : _a3.fatal) == null ? void 0 : _b.call(_a3, message, ...optionalParams);
1258
+ this.staticInstanceRef?.fatal?.(message, ...optionalParams);
1342
1259
  }
1343
1260
  static getTimestamp() {
1344
1261
  return dateTimeFormatter2.format(Date.now());
1345
1262
  }
1346
1263
  static overrideLogger(logger) {
1347
- var _a3, _b;
1348
1264
  if (Array.isArray(logger)) {
1349
1265
  _LoggerInstance.logLevels = logger;
1350
- return (_b = (_a3 = this.staticInstanceRef) == null ? void 0 : _a3.setLogLevels) == null ? void 0 : _b.call(_a3, logger);
1266
+ return this.staticInstanceRef?.setLogLevels?.(logger);
1351
1267
  }
1352
1268
  if (isObject(logger)) {
1353
1269
  this.staticInstanceRef = logger;
@@ -1360,12 +1276,11 @@ var _LoggerInstance = class _LoggerInstance {
1360
1276
  return isLogLevelEnabled(level, logLevels);
1361
1277
  }
1362
1278
  registerLocalInstanceRef() {
1363
- var _a3;
1364
1279
  if (this.localInstanceRef) {
1365
1280
  return this.localInstanceRef;
1366
1281
  }
1367
1282
  this.localInstanceRef = new ConsoleLogger(this.context, {
1368
- timestamp: (_a3 = this.options) == null ? void 0 : _a3.timestamp,
1283
+ timestamp: this.options?.timestamp,
1369
1284
  logLevels: _LoggerInstance.logLevels
1370
1285
  });
1371
1286
  return this.localInstanceRef;
@@ -1376,7 +1291,7 @@ _LoggerInstance = __decorateElement(_init8, 0, "LoggerInstance", _LoggerInstance
1376
1291
  __runInitializers(_init8, 1, _LoggerInstance);
1377
1292
  var LoggerInstance = _LoggerInstance;
1378
1293
 
1379
- // packages/core/src/logger/logger.factory.mts
1294
+ // src/logger/logger.factory.mts
1380
1295
  var LoggerInjectionToken = "LoggerInjectionToken";
1381
1296
  var LoggerOptions = z.object({
1382
1297
  context: z.string().optional(),
@@ -1384,22 +1299,22 @@ var LoggerOptions = z.object({
1384
1299
  timestamp: z.boolean().optional()
1385
1300
  }).optional()
1386
1301
  }).optional();
1387
- var Logger = InjectionToken10.create(LoggerInjectionToken, LoggerOptions);
1302
+ var Logger = InjectionToken.create(LoggerInjectionToken, LoggerOptions);
1388
1303
  var _LoggerFactory_decorators, _init9;
1389
- _LoggerFactory_decorators = [Injectable9({
1304
+ _LoggerFactory_decorators = [Injectable({
1390
1305
  type: InjectableType.Factory,
1391
1306
  token: Logger
1392
1307
  })];
1393
1308
  var LoggerFactory = class {
1394
1309
  create(ctx, args) {
1395
- return new LoggerInstance(args == null ? void 0 : args.context, args == null ? void 0 : args.options);
1310
+ return new LoggerInstance(args?.context, args?.options);
1396
1311
  }
1397
1312
  };
1398
1313
  _init9 = __decoratorStart(null);
1399
1314
  LoggerFactory = __decorateElement(_init9, 0, "LoggerFactory", _LoggerFactory_decorators, LoggerFactory);
1400
1315
  __runInitializers(_init9, 1, LoggerFactory);
1401
1316
 
1402
- // packages/core/src/logger/pino-wrapper.mts
1317
+ // src/logger/pino-wrapper.mts
1403
1318
  var PinoWrapper = class _PinoWrapper {
1404
1319
  constructor(logger) {
1405
1320
  this.logger = logger;
@@ -1419,12 +1334,10 @@ var PinoWrapper = class _PinoWrapper {
1419
1334
  info() {
1420
1335
  }
1421
1336
  debug(message, ...optionalParams) {
1422
- var _a3, _b;
1423
- (_b = (_a3 = this.logger).debug) == null ? void 0 : _b.call(_a3, message, ...optionalParams);
1337
+ this.logger.debug?.(message, ...optionalParams);
1424
1338
  }
1425
1339
  trace(message, ...optionalParams) {
1426
- var _a3, _b;
1427
- (_b = (_a3 = this.logger).verbose) == null ? void 0 : _b.call(_a3, message, ...optionalParams);
1340
+ this.logger.verbose?.(message, ...optionalParams);
1428
1341
  }
1429
1342
  silent() {
1430
1343
  }
@@ -1451,18 +1364,24 @@ var PinoWrapper = class _PinoWrapper {
1451
1364
  }
1452
1365
  };
1453
1366
 
1454
- // packages/core/src/config/config.service.mts
1455
- import { NaviosException } from "@navios/common";
1456
- var ConfigServiceInstance = class {
1457
- constructor(config = {}, logger) {
1367
+ // src/config/config.service.mts
1368
+ var ConfigServiceOptionsSchema = z.record(z.unknown());
1369
+ var ConfigServiceToken = InjectionToken.create(Symbol.for("ConfigService"), ConfigServiceOptionsSchema);
1370
+ var _ConfigService_decorators, _init10;
1371
+ _ConfigService_decorators = [Injectable({
1372
+ token: ConfigServiceToken
1373
+ })];
1374
+ var _ConfigService = class _ConfigService {
1375
+ constructor(config = {}) {
1458
1376
  this.config = config;
1459
- this.logger = logger;
1460
1377
  }
1378
+ logger = syncInject(Logger, {
1379
+ context: _ConfigService.name
1380
+ });
1461
1381
  getConfig() {
1462
1382
  return this.config;
1463
1383
  }
1464
1384
  get(key) {
1465
- var _a3, _b;
1466
1385
  try {
1467
1386
  const parts = String(key).split(".");
1468
1387
  let value = this.config;
@@ -1474,8 +1393,7 @@ var ConfigServiceInstance = class {
1474
1393
  }
1475
1394
  return value ?? null;
1476
1395
  } catch (error) {
1477
- (_b = (_a3 = this.logger).debug) == null ? void 0 : _b.call(
1478
- _a3,
1396
+ this.logger.debug?.(
1479
1397
  `Failed to get config value for key ${String(key)}`,
1480
1398
  error
1481
1399
  );
@@ -1496,45 +1414,21 @@ var ConfigServiceInstance = class {
1496
1414
  return value;
1497
1415
  }
1498
1416
  };
1417
+ _init10 = __decoratorStart(null);
1418
+ _ConfigService = __decorateElement(_init10, 0, "ConfigService", _ConfigService_decorators, _ConfigService);
1419
+ __runInitializers(_init10, 1, _ConfigService);
1420
+ var ConfigService = _ConfigService;
1499
1421
 
1500
- // packages/core/src/config/config.provider.mts
1501
- var ConfigProviderOptions = z2.object({
1502
- load: z2.function()
1422
+ // src/config/config.provider.mts
1423
+ var ConfigProviderOptions = z.object({
1424
+ load: z.function().returns(ConfigServiceOptionsSchema)
1503
1425
  });
1504
- var ConfigProvider = InjectionToken11.create(ConfigServiceInstance, ConfigProviderOptions);
1505
- var _ConfigProviderFactory_decorators, _init10;
1506
- _ConfigProviderFactory_decorators = [Injectable10({
1507
- token: ConfigProvider,
1508
- type: InjectableType2.Factory
1509
- })];
1510
- var ConfigProviderFactory = class {
1511
- logger = syncInject3(Logger, {
1512
- context: "ConfigService"
1513
- });
1514
- async create(ctx, args) {
1515
- const { load } = args;
1516
- const logger = this.logger;
1517
- try {
1518
- const config = await load();
1519
- return new ConfigServiceInstance(
1520
- config,
1521
- logger
1522
- );
1523
- } catch (error) {
1524
- logger.error("Error loading config", error);
1525
- throw error;
1526
- }
1527
- }
1528
- };
1529
- _init10 = __decoratorStart(null);
1530
- ConfigProviderFactory = __decorateElement(_init10, 0, "ConfigProviderFactory", _ConfigProviderFactory_decorators, ConfigProviderFactory);
1531
- __runInitializers(_init10, 1, ConfigProviderFactory);
1532
1426
  function provideConfig(options) {
1533
- return InjectionToken11.bound(ConfigProvider, options);
1427
+ return InjectionToken.factory(ConfigServiceToken, async () => options.load());
1534
1428
  }
1535
-
1536
- // packages/core/src/decorators/controller.decorator.mts
1537
- import { Injectable as Injectable11, InjectableScope, InjectionToken as InjectionToken12 } from "@navios/di";
1429
+ var EnvConfigProvider = InjectionToken.bound(ConfigServiceToken, {
1430
+ ...env
1431
+ });
1538
1432
  function Controller({ guards } = {}) {
1539
1433
  return function(target, context) {
1540
1434
  if (context.kind !== "class") {
@@ -1542,7 +1436,7 @@ function Controller({ guards } = {}) {
1542
1436
  "[Navios] @Controller decorator can only be used on classes."
1543
1437
  );
1544
1438
  }
1545
- const token = InjectionToken12.create(target);
1439
+ const token = InjectionToken.create(target);
1546
1440
  if (context.metadata) {
1547
1441
  const controllerMetadata = getControllerMetadata(target, context);
1548
1442
  if (guards) {
@@ -1551,22 +1445,14 @@ function Controller({ guards } = {}) {
1551
1445
  }
1552
1446
  }
1553
1447
  }
1554
- return Injectable11({
1448
+ return Injectable({
1555
1449
  token,
1556
1450
  scope: InjectableScope.Instance
1557
1451
  })(target, context);
1558
1452
  };
1559
1453
  }
1560
-
1561
- // packages/core/src/decorators/endpoint.decorator.mts
1562
- import "zod";
1563
1454
  function Endpoint(endpoint) {
1564
1455
  return (target, context) => {
1565
- if (typeof target !== "function") {
1566
- throw new Error(
1567
- "[Navios] Endpoint decorator can only be used on functions."
1568
- );
1569
- }
1570
1456
  if (context.kind !== "method") {
1571
1457
  throw new Error(
1572
1458
  "[Navios] Endpoint decorator can only be used on methods."
@@ -1593,7 +1479,7 @@ function Endpoint(endpoint) {
1593
1479
  };
1594
1480
  }
1595
1481
 
1596
- // packages/core/src/decorators/header.decorator.mts
1482
+ // src/decorators/header.decorator.mts
1597
1483
  function Header(name, value) {
1598
1484
  return (target, context) => {
1599
1485
  if (context.kind !== "method") {
@@ -1605,7 +1491,7 @@ function Header(name, value) {
1605
1491
  };
1606
1492
  }
1607
1493
 
1608
- // packages/core/src/decorators/http-code.decorator.mts
1494
+ // src/decorators/http-code.decorator.mts
1609
1495
  function HttpCode(code) {
1610
1496
  return (target, context) => {
1611
1497
  if (context.kind !== "method") {
@@ -1618,9 +1504,6 @@ function HttpCode(code) {
1618
1504
  return target;
1619
1505
  };
1620
1506
  }
1621
-
1622
- // packages/core/src/decorators/module.decorator.mts
1623
- import { Injectable as Injectable12, InjectableScope as InjectableScope2, InjectionToken as InjectionToken13 } from "@navios/di";
1624
1507
  function Module({ controllers = [], imports = [], guards = [] } = {
1625
1508
  controllers: [],
1626
1509
  imports: [],
@@ -1630,7 +1513,7 @@ function Module({ controllers = [], imports = [], guards = [] } = {
1630
1513
  if (context.kind !== "class") {
1631
1514
  throw new Error("[Navios] @Module decorator can only be used on classes.");
1632
1515
  }
1633
- const token = InjectionToken13.create(target);
1516
+ const token = InjectionToken.create(target);
1634
1517
  const moduleMetadata = getModuleMetadata(target, context);
1635
1518
  for (const controller of controllers) {
1636
1519
  moduleMetadata.controllers.add(controller);
@@ -1641,15 +1524,12 @@ function Module({ controllers = [], imports = [], guards = [] } = {
1641
1524
  for (const guard of Array.from(guards).reverse()) {
1642
1525
  moduleMetadata.guards.add(guard);
1643
1526
  }
1644
- return Injectable12({
1527
+ return Injectable({
1645
1528
  token,
1646
- scope: InjectableScope2.Singleton
1529
+ scope: InjectableScope.Singleton
1647
1530
  })(target, context);
1648
1531
  };
1649
1532
  }
1650
-
1651
- // packages/core/src/decorators/multipart.decorator.mts
1652
- import "zod";
1653
1533
  function Multipart(endpoint) {
1654
1534
  return (target, context) => {
1655
1535
  if (typeof target !== "function") {
@@ -1683,7 +1563,7 @@ function Multipart(endpoint) {
1683
1563
  };
1684
1564
  }
1685
1565
 
1686
- // packages/core/src/decorators/stream.decorator.mts
1566
+ // src/decorators/stream.decorator.mts
1687
1567
  function Stream(endpoint) {
1688
1568
  return (target, context) => {
1689
1569
  if (typeof target !== "function") {
@@ -1717,7 +1597,7 @@ function Stream(endpoint) {
1717
1597
  };
1718
1598
  }
1719
1599
 
1720
- // packages/core/src/decorators/use-guards.decorator.mts
1600
+ // src/decorators/use-guards.decorator.mts
1721
1601
  function UseGuards(...guards) {
1722
1602
  return function(target, context) {
1723
1603
  if (context.kind === "class") {
@@ -1742,7 +1622,7 @@ function UseGuards(...guards) {
1742
1622
  };
1743
1623
  }
1744
1624
 
1745
- // packages/core/src/attribute.factory.mts
1625
+ // src/attribute.factory.mts
1746
1626
  var AttributeFactory = class {
1747
1627
  static createAttribute(token, schema) {
1748
1628
  const res = (value) => (target, context) => {
@@ -1798,27 +1678,12 @@ var AttributeFactory = class {
1798
1678
  return target.customAttributes.has(attribute.token);
1799
1679
  }
1800
1680
  };
1801
-
1802
- // packages/core/src/navios.application.mts
1803
- import {
1804
- getGlobalServiceLocator as getGlobalServiceLocator3,
1805
- inject as inject6,
1806
- Injectable as Injectable13,
1807
- syncInject as syncInject4
1808
- } from "@navios/di";
1809
- import cors from "@fastify/cors";
1810
- import multipart from "@fastify/multipart";
1811
- import { fastify } from "fastify";
1812
- import {
1813
- serializerCompiler,
1814
- validatorCompiler
1815
- } from "fastify-type-provider-zod";
1816
1681
  var _NaviosApplication_decorators, _init11;
1817
- _NaviosApplication_decorators = [Injectable13()];
1682
+ _NaviosApplication_decorators = [Injectable()];
1818
1683
  var _NaviosApplication = class _NaviosApplication {
1819
- moduleLoader = syncInject4(ModuleLoaderService);
1820
- controllerAdapter = syncInject4(ControllerAdapterService);
1821
- logger = syncInject4(Logger, {
1684
+ moduleLoader = syncInject(ModuleLoaderService);
1685
+ controllerAdapter = syncInject(ControllerAdapterService);
1686
+ logger = syncInject(Logger, {
1822
1687
  context: _NaviosApplication.name
1823
1688
  });
1824
1689
  server = null;
@@ -1839,7 +1704,7 @@ var _NaviosApplication = class _NaviosApplication {
1839
1704
  await this.moduleLoader.loadModules(this.appModule);
1840
1705
  this.server = await this.getFastifyInstance(this.options);
1841
1706
  this.configureFastifyInstance(this.server);
1842
- getGlobalServiceLocator3().storeInstance(this.server, Application);
1707
+ getGlobalServiceLocator().storeInstance(this.server, Application);
1843
1708
  this.server.setValidatorCompiler(validatorCompiler);
1844
1709
  this.server.setSerializerCompiler(serializerCompiler);
1845
1710
  if (this.corsOptions) {
@@ -1863,7 +1728,7 @@ var _NaviosApplication = class _NaviosApplication {
1863
1728
  }
1864
1729
  } else {
1865
1730
  fastifyOptions.loggerInstance = new PinoWrapper(
1866
- await inject6(Logger, {
1731
+ await inject(Logger, {
1867
1732
  context: "FastifyAdapter"
1868
1733
  })
1869
1734
  );
@@ -1873,7 +1738,7 @@ var _NaviosApplication = class _NaviosApplication {
1873
1738
  return fastify({
1874
1739
  ...options,
1875
1740
  loggerInstance: new PinoWrapper(
1876
- await inject6(Logger, {
1741
+ await inject(Logger, {
1877
1742
  context: "FastifyAdapter"
1878
1743
  })
1879
1744
  )
@@ -1982,12 +1847,9 @@ _init11 = __decoratorStart(null);
1982
1847
  _NaviosApplication = __decorateElement(_init11, 0, "NaviosApplication", _NaviosApplication_decorators, _NaviosApplication);
1983
1848
  __runInitializers(_init11, 1, _NaviosApplication);
1984
1849
  var NaviosApplication = _NaviosApplication;
1985
-
1986
- // packages/core/src/navios.factory.mts
1987
- import { inject as inject7 } from "@navios/di";
1988
1850
  var NaviosFactory = class {
1989
1851
  static async create(appModule, options = {}) {
1990
- const app = await inject7(NaviosApplication);
1852
+ const app = await inject(NaviosApplication);
1991
1853
  this.registerLoggerConfiguration(options);
1992
1854
  app.setup(appModule, options);
1993
1855
  return app;
@@ -2002,82 +1864,7 @@ var NaviosFactory = class {
2002
1864
  }
2003
1865
  }
2004
1866
  };
2005
- export {
2006
- Application,
2007
- AttributeFactory,
2008
- BadRequestException,
2009
- ConfigProvider,
2010
- ConfigProviderFactory,
2011
- ConfigProviderOptions,
2012
- ConfigServiceInstance,
2013
- ConflictException,
2014
- ConsoleLogger,
2015
- Controller,
2016
- ControllerAdapterService,
2017
- ControllerMetadataKey,
2018
- Endpoint,
2019
- EndpointAdapterService,
2020
- EndpointAdapterToken,
2021
- EndpointMetadataKey,
2022
- ExecutionContext,
2023
- ExecutionContextInjectionToken,
2024
- ExecutionContextToken,
2025
- ForbiddenException,
2026
- GuardRunnerService,
2027
- Header,
2028
- HttpCode,
2029
- HttpException,
2030
- InternalServerErrorException,
2031
- LOG_LEVELS,
2032
- Logger,
2033
- LoggerFactory,
2034
- LoggerInjectionToken,
2035
- LoggerInstance,
2036
- LoggerOptions,
2037
- Module,
2038
- ModuleLoaderService,
2039
- ModuleMetadataKey,
2040
- Multipart,
2041
- MultipartAdapterService,
2042
- MultipartAdapterToken,
2043
- NaviosApplication,
2044
- NaviosFactory,
2045
- NotFoundException,
2046
- PinoWrapper,
2047
- Reply,
2048
- Request,
2049
- Stream,
2050
- StreamAdapterService,
2051
- StreamAdapterToken,
2052
- UnauthorizedException,
2053
- UseGuards,
2054
- addLeadingSlash,
2055
- clc,
2056
- envInt,
2057
- envString,
2058
- extractControllerMetadata,
2059
- extractModuleMetadata,
2060
- filterLogLevels,
2061
- getAllEndpointMetadata,
2062
- getControllerMetadata,
2063
- getEndpointMetadata,
2064
- getModuleMetadata,
2065
- hasControllerMetadata,
2066
- hasModuleMetadata,
2067
- isConstructor,
2068
- isEmpty,
2069
- isFunction,
2070
- isLogLevel,
2071
- isLogLevelEnabled,
2072
- isNil,
2073
- isNumber,
2074
- isObject,
2075
- isPlainObject,
2076
- isString,
2077
- isSymbol,
2078
- isUndefined,
2079
- normalizePath,
2080
- provideConfig,
2081
- stripEndSlash,
2082
- yellow
2083
- };
1867
+
1868
+ export { Application, AttributeFactory, BadRequestException, ConfigProviderOptions, ConfigService, ConfigServiceOptionsSchema, ConfigServiceToken, ConflictException, ConsoleLogger, Controller, ControllerAdapterService, ControllerMetadataKey, Endpoint, EndpointAdapterService, EndpointAdapterToken, EndpointMetadataKey, EnvConfigProvider, ExecutionContext, ExecutionContextInjectionToken, ExecutionContextToken, ForbiddenException, GuardRunnerService, Header, HttpCode, HttpException, InternalServerErrorException, LOG_LEVELS, Logger, LoggerFactory, LoggerInjectionToken, LoggerInstance, LoggerOptions, Module, ModuleLoaderService, ModuleMetadataKey, Multipart, MultipartAdapterService, MultipartAdapterToken, NaviosApplication, NaviosFactory, NotFoundException, PinoWrapper, Reply, Request, Stream, StreamAdapterService, StreamAdapterToken, UnauthorizedException, UseGuards, addLeadingSlash, clc, envInt, envString, extractControllerMetadata, extractModuleMetadata, filterLogLevels, getAllEndpointMetadata, getControllerMetadata, getEndpointMetadata, getModuleMetadata, hasControllerMetadata, hasModuleMetadata, isConstructor, isEmpty, isFunction, isLogLevel, isLogLevelEnabled, isNil, isNumber, isObject, isPlainObject, isString, isSymbol, isUndefined, normalizePath, provideConfig, stripEndSlash, yellow };
1869
+ //# sourceMappingURL=index.mjs.map
1870
+ //# sourceMappingURL=index.mjs.map