@navios/core 0.1.1 → 0.1.3

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/dist/index.mjs CHANGED
@@ -46,115 +46,117 @@ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read fr
46
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
47
  var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
48
48
 
49
- // packages/core/src/metadata/endpoint.metadata.mts
50
- var EndpointMetadataKey = Symbol("EndpointMetadataKey");
51
- function getAllEndpointMetadata(context) {
52
- if (context.metadata) {
53
- const metadata = context.metadata[EndpointMetadataKey];
54
- if (metadata) {
55
- return metadata;
56
- } else {
57
- context.metadata[EndpointMetadataKey] = /* @__PURE__ */ new Set();
58
- return context.metadata[EndpointMetadataKey];
59
- }
60
- }
61
- throw new Error("[Navios] Wrong environment.");
49
+ // packages/core/src/config/utils/helpers.mts
50
+ import { env } from "node:process";
51
+ function envInt(key, defaultValue) {
52
+ const envKey = env[key] || process.env[key];
53
+ return envKey ? parseInt(envKey, 10) : defaultValue;
62
54
  }
63
- function getEndpointMetadata(target, context) {
64
- if (context.metadata) {
65
- const metadata = getAllEndpointMetadata(context);
66
- if (metadata) {
67
- const endpointMetadata = Array.from(metadata).find(
68
- (item) => item.classMethod === target.name
69
- );
70
- if (endpointMetadata) {
71
- return endpointMetadata;
72
- } else {
73
- const newMetadata = {
74
- classMethod: target.name,
75
- url: "",
76
- httpMethod: "GET",
77
- config: null,
78
- guards: /* @__PURE__ */ new Set(),
79
- customAttributes: /* @__PURE__ */ new Map()
80
- };
81
- metadata.add(newMetadata);
82
- return newMetadata;
83
- }
84
- }
85
- }
86
- throw new Error("[Navios] Wrong environment.");
55
+ function envString(key, defaultValue) {
56
+ return env[key] || process.env[key] || defaultValue || void 0;
87
57
  }
88
58
 
89
- // packages/core/src/metadata/controller.metadata.mts
90
- var ControllerMetadataKey = Symbol("ControllerMetadataKey");
91
- function getControllerMetadata(target, context) {
92
- if (context.metadata) {
93
- const metadata = context.metadata[ControllerMetadataKey];
94
- if (metadata) {
95
- return metadata;
96
- } else {
97
- const endpointsMetadata = getAllEndpointMetadata(context);
98
- const newMetadata = {
99
- endpoints: endpointsMetadata,
100
- guards: /* @__PURE__ */ new Set(),
101
- customAttributes: /* @__PURE__ */ new Map()
102
- };
103
- context.metadata[ControllerMetadataKey] = newMetadata;
104
- target[ControllerMetadataKey] = newMetadata;
105
- return newMetadata;
106
- }
107
- }
108
- throw new Error("[Navios] Wrong environment.");
59
+ // packages/core/src/config/config.provider.mts
60
+ import { z as z2 } from "zod";
61
+
62
+ // packages/core/src/logger/utils/cli-colors.util.mts
63
+ var isColorAllowed = () => !process.env.NO_COLOR;
64
+ var colorIfAllowed = (colorFn) => (text) => isColorAllowed() ? colorFn(text) : text;
65
+ var clc = {
66
+ bold: colorIfAllowed((text) => `\x1B[1m${text}\x1B[0m`),
67
+ green: colorIfAllowed((text) => `\x1B[32m${text}\x1B[39m`),
68
+ yellow: colorIfAllowed((text) => `\x1B[33m${text}\x1B[39m`),
69
+ red: colorIfAllowed((text) => `\x1B[31m${text}\x1B[39m`),
70
+ magentaBright: colorIfAllowed((text) => `\x1B[95m${text}\x1B[39m`),
71
+ cyanBright: colorIfAllowed((text) => `\x1B[96m${text}\x1B[39m`)
72
+ };
73
+ var yellow = colorIfAllowed(
74
+ (text) => `\x1B[38;5;3m${text}\x1B[39m`
75
+ );
76
+
77
+ // packages/core/src/logger/log-levels.mts
78
+ var LOG_LEVELS = [
79
+ "verbose",
80
+ "debug",
81
+ "log",
82
+ "warn",
83
+ "error",
84
+ "fatal"
85
+ ];
86
+
87
+ // packages/core/src/logger/utils/is-log-level.util.mts
88
+ function isLogLevel(maybeLogLevel) {
89
+ return LOG_LEVELS.includes(maybeLogLevel);
109
90
  }
110
- function extractControllerMetadata(target) {
111
- const metadata = target[ControllerMetadataKey];
112
- if (!metadata) {
113
- throw new Error(
114
- "[Navios] Controller metadata not found. Make sure to use @Controller decorator."
91
+
92
+ // packages/core/src/logger/utils/filter-log-levelts.util.mts
93
+ function filterLogLevels(parseableString = "") {
94
+ const sanitizedString = parseableString.replaceAll(" ", "").toLowerCase();
95
+ if (sanitizedString[0] === ">") {
96
+ const orEqual = sanitizedString[1] === "=";
97
+ const logLevelIndex = LOG_LEVELS.indexOf(
98
+ sanitizedString.substring(orEqual ? 2 : 1)
115
99
  );
100
+ if (logLevelIndex === -1) {
101
+ throw new Error(`parse error (unknown log level): ${sanitizedString}`);
102
+ }
103
+ return LOG_LEVELS.slice(orEqual ? logLevelIndex : logLevelIndex + 1);
104
+ } else if (sanitizedString.includes(",")) {
105
+ return sanitizedString.split(",").filter(isLogLevel);
116
106
  }
117
- return metadata;
118
- }
119
- function hasControllerMetadata(target) {
120
- const metadata = target[ControllerMetadataKey];
121
- return !!metadata;
107
+ return isLogLevel(sanitizedString) ? [sanitizedString] : LOG_LEVELS;
122
108
  }
123
109
 
124
- // packages/core/src/metadata/module.metadata.mts
125
- var ModuleMetadataKey = Symbol("ControllerMetadataKey");
126
- function getModuleMetadata(target, context) {
127
- if (context.metadata) {
128
- const metadata = context.metadata[ModuleMetadataKey];
129
- if (metadata) {
130
- return metadata;
131
- } else {
132
- const newMetadata = {
133
- controllers: /* @__PURE__ */ new Set(),
134
- imports: /* @__PURE__ */ new Set(),
135
- guards: /* @__PURE__ */ new Set(),
136
- customAttributes: /* @__PURE__ */ new Map()
137
- };
138
- context.metadata[ModuleMetadataKey] = newMetadata;
139
- target[ModuleMetadataKey] = newMetadata;
140
- return newMetadata;
141
- }
110
+ // packages/core/src/logger/utils/is-log-level-enabled.mts
111
+ var LOG_LEVEL_VALUES = {
112
+ verbose: 0,
113
+ debug: 1,
114
+ log: 2,
115
+ warn: 3,
116
+ error: 4,
117
+ fatal: 5
118
+ };
119
+ function isLogLevelEnabled(targetLevel, logLevels) {
120
+ var _a;
121
+ if (!logLevels || Array.isArray(logLevels) && (logLevels == null ? void 0 : logLevels.length) === 0) {
122
+ return false;
142
123
  }
143
- throw new Error("[Navios] Wrong environment.");
144
- }
145
- function extractModuleMetadata(target) {
146
- const metadata = target[ModuleMetadataKey];
147
- if (!metadata) {
148
- throw new Error(
149
- "[Navios] Module metadata not found. Make sure to use @Module decorator."
150
- );
124
+ if (logLevels.includes(targetLevel)) {
125
+ return true;
151
126
  }
152
- return metadata;
153
- }
154
- function hasModuleMetadata(target) {
155
- return !!target[ModuleMetadataKey];
127
+ const highestLogLevelValue = (_a = logLevels.map((level) => LOG_LEVEL_VALUES[level]).sort((a, b) => b - a)) == null ? void 0 : _a[0];
128
+ const targetLevelValue = LOG_LEVEL_VALUES[targetLevel];
129
+ return targetLevelValue >= highestLogLevelValue;
156
130
  }
157
131
 
132
+ // packages/core/src/logger/utils/shared.utils.mts
133
+ var isUndefined = (obj) => typeof obj === "undefined";
134
+ var isObject = (fn) => !isNil(fn) && typeof fn === "object";
135
+ var isPlainObject = (fn) => {
136
+ if (!isObject(fn)) {
137
+ return false;
138
+ }
139
+ const proto = Object.getPrototypeOf(fn);
140
+ if (proto === null) {
141
+ return true;
142
+ }
143
+ const ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor;
144
+ return typeof ctor === "function" && ctor instanceof ctor && Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object);
145
+ };
146
+ var addLeadingSlash = (path) => path && typeof path === "string" ? path.charAt(0) !== "/" && path.substring(0, 2) !== "{/" ? "/" + path : path : "";
147
+ var normalizePath = (path) => path ? path.startsWith("/") ? ("/" + path.replace(/\/+$/, "")).replace(/\/+/g, "/") : "/" + path.replace(/\/+$/, "") : "/";
148
+ var stripEndSlash = (path) => path[path.length - 1] === "/" ? path.slice(0, path.length - 1) : path;
149
+ var isFunction = (val) => typeof val === "function";
150
+ var isString = (val) => typeof val === "string";
151
+ var isNumber = (val) => typeof val === "number";
152
+ var isConstructor = (val) => val === "constructor";
153
+ var isNil = (val) => isUndefined(val) || val === null;
154
+ var isEmpty = (array) => !(array && array.length > 0);
155
+ var isSymbol = (val) => typeof val === "symbol";
156
+
157
+ // packages/core/src/logger/console-logger.service.mts
158
+ import { inspect } from "util";
159
+
158
160
  // packages/core/src/service-locator/enums/injectable-scope.enum.mts
159
161
  var InjectableScope = /* @__PURE__ */ ((InjectableScope2) => {
160
162
  InjectableScope2["Singleton"] = "Singleton";
@@ -713,7 +715,15 @@ var ServiceLocator = class {
713
715
  ).then(() => null);
714
716
  }
715
717
  makeInstanceName(token, args) {
716
- let stringifiedArgs = args ? ":" + JSON.stringify(args).replaceAll(/"/g, "").replaceAll(/:/g, "=").replaceAll(/,/g, "|") : "";
718
+ let stringifiedArgs = args ? ":" + JSON.stringify(args, (_, value) => {
719
+ if (typeof value === "function") {
720
+ return `function:${value.name}(${value.length})`;
721
+ }
722
+ if (typeof value === "symbol") {
723
+ return value.toString();
724
+ }
725
+ return value;
726
+ }).replaceAll(/"/g, "").replaceAll(/:/g, "=").replaceAll(/,/g, "|") : "";
717
727
  const { name: name2 } = token;
718
728
  if (typeof name2 === "function") {
719
729
  const className = name2.name;
@@ -989,318 +999,58 @@ function override(token, target) {
989
999
  };
990
1000
  }
991
1001
 
992
- // packages/core/src/decorators/controller.decorator.mts
993
- function Controller({ guards } = {}) {
994
- return function(target, context) {
995
- if (context.kind !== "class") {
996
- throw new Error(
997
- "[Navios] @Controller decorator can only be used on classes."
998
- );
999
- }
1000
- const token = InjectionToken.create(target);
1001
- if (context.metadata) {
1002
- const controllerMetadata = getControllerMetadata(target, context);
1003
- if (guards) {
1004
- for (const guard of Array.from(guards).reverse()) {
1005
- controllerMetadata.guards.add(guard);
1006
- }
1007
- }
1008
- }
1009
- return Injectable({
1010
- token,
1011
- type: "Class" /* Class */,
1012
- scope: "Instance" /* Instance */
1013
- })(target, context);
1014
- };
1015
- }
1016
-
1017
- // packages/core/src/decorators/endpoint.decorator.mts
1018
- function Endpoint(endpoint) {
1019
- return (target, context) => {
1020
- if (typeof target !== "function") {
1021
- throw new Error(
1022
- "[Navios] Endpoint decorator can only be used on functions."
1023
- );
1024
- }
1025
- if (context.kind !== "method") {
1026
- throw new Error(
1027
- "[Navios] Endpoint decorator can only be used on methods."
1028
- );
1029
- }
1030
- const config = endpoint.config;
1031
- if (context.metadata) {
1032
- let endpointMetadata = getEndpointMetadata(target, context);
1033
- if (endpointMetadata.config && endpointMetadata.config.url) {
1034
- throw new Error(
1035
- `[Navios] Endpoint ${config.method} ${config.url} already exists. Please use a different method or url.`
1036
- );
1037
- }
1038
- endpointMetadata.config = config;
1039
- endpointMetadata.classMethod = target.name;
1040
- endpointMetadata.httpMethod = config.method;
1041
- endpointMetadata.url = config.url;
1042
- }
1043
- return target;
1044
- };
1045
- }
1046
-
1047
- // packages/core/src/decorators/module.decorator.mts
1048
- function Module(metadata) {
1049
- return (target, context) => {
1050
- if (context.kind !== "class") {
1051
- throw new Error("[Navios] @Module decorator can only be used on classes.");
1052
- }
1053
- const token = InjectionToken.create(target);
1054
- const moduleMetadata = getModuleMetadata(target, context);
1055
- if (metadata.controllers) {
1056
- for (const controller of metadata.controllers) {
1057
- moduleMetadata.controllers.add(controller);
1058
- }
1059
- }
1060
- if (metadata.imports) {
1061
- for (const importedModule of metadata.imports) {
1062
- moduleMetadata.imports.add(importedModule);
1063
- }
1064
- }
1065
- if (metadata.guards) {
1066
- for (const guard of Array.from(metadata.guards).reverse()) {
1067
- moduleMetadata.guards.add(guard);
1068
- }
1069
- }
1070
- return Injectable({
1071
- token,
1072
- type: "Class" /* Class */,
1073
- scope: "Singleton" /* Singleton */
1074
- })(target, context);
1075
- };
1076
- }
1077
-
1078
- // packages/core/src/decorators/use-guards.decorator.mts
1079
- function UseGuards(...guards) {
1080
- return function(target, context) {
1081
- if (context.kind === "class") {
1082
- const controllerMetadata = getControllerMetadata(
1083
- target,
1084
- context
1085
- );
1086
- for (const guard of guards.reverse()) {
1087
- controllerMetadata.guards.add(guard);
1088
- }
1089
- } else if (context.kind === "method") {
1090
- const endpointMetadata = getEndpointMetadata(target, context);
1091
- for (const guard of guards.reverse()) {
1092
- endpointMetadata.guards.add(guard);
1093
- }
1094
- } else {
1095
- throw new Error(
1096
- "[Navios] @UseGuards decorator can only be used on classes or methods."
1097
- );
1098
- }
1099
- return target;
1100
- };
1101
- }
1102
-
1103
- // packages/core/src/exceptions/http.exception.mts
1104
- var HttpException = class {
1105
- constructor(statusCode, response, error) {
1106
- this.statusCode = statusCode;
1107
- this.response = response;
1108
- this.error = error;
1109
- }
1110
- };
1111
-
1112
- // packages/core/src/exceptions/bad-request.exception.mts
1113
- var BadRequestException = class extends HttpException {
1114
- constructor(message) {
1115
- super(400, message);
1116
- }
1117
- };
1118
-
1119
- // packages/core/src/exceptions/forbidden.exception.mts
1120
- var ForbiddenException = class extends HttpException {
1121
- constructor(message) {
1122
- super(403, message);
1123
- }
1124
- };
1125
-
1126
- // packages/core/src/exceptions/internal-server-error.exception.mts
1127
- var InternalServerErrorException = class extends HttpException {
1128
- constructor(message, error) {
1129
- super(500, message, error);
1130
- }
1131
- };
1132
-
1133
- // packages/core/src/exceptions/not-found.exception.mts
1134
- var NotFoundException = class extends HttpException {
1135
- constructor(response, error) {
1136
- super(404, response, error);
1137
- this.response = response;
1138
- this.error = error;
1139
- }
1140
- };
1141
-
1142
- // packages/core/src/exceptions/unauthorized.exception.mts
1143
- var UnauthorizedException = class extends HttpException {
1144
- constructor(message, error) {
1145
- super(401, message, error);
1146
- }
1147
- };
1148
-
1149
- // packages/core/src/exceptions/conflict.exception.mts
1150
- var ConflictException = class extends HttpException {
1151
- constructor(message, error) {
1152
- super(409, message, error);
1153
- }
1154
- };
1155
-
1156
- // packages/core/src/logger/utils/cli-colors.util.mts
1157
- var isColorAllowed = () => !process.env.NO_COLOR;
1158
- var colorIfAllowed = (colorFn) => (text) => isColorAllowed() ? colorFn(text) : text;
1159
- var clc = {
1160
- bold: colorIfAllowed((text) => `\x1B[1m${text}\x1B[0m`),
1161
- green: colorIfAllowed((text) => `\x1B[32m${text}\x1B[39m`),
1162
- yellow: colorIfAllowed((text) => `\x1B[33m${text}\x1B[39m`),
1163
- red: colorIfAllowed((text) => `\x1B[31m${text}\x1B[39m`),
1164
- magentaBright: colorIfAllowed((text) => `\x1B[95m${text}\x1B[39m`),
1165
- cyanBright: colorIfAllowed((text) => `\x1B[96m${text}\x1B[39m`)
1166
- };
1167
- var yellow = colorIfAllowed(
1168
- (text) => `\x1B[38;5;3m${text}\x1B[39m`
1169
- );
1170
-
1171
- // packages/core/src/logger/log-levels.mts
1172
- var LOG_LEVELS = [
1173
- "verbose",
1174
- "debug",
1175
- "log",
1176
- "warn",
1177
- "error",
1178
- "fatal"
1179
- ];
1180
-
1181
- // packages/core/src/logger/utils/is-log-level.util.mts
1182
- function isLogLevel(maybeLogLevel) {
1183
- return LOG_LEVELS.includes(maybeLogLevel);
1184
- }
1185
-
1186
- // packages/core/src/logger/utils/filter-log-levelts.util.mts
1187
- function filterLogLevels(parseableString = "") {
1188
- const sanitizedString = parseableString.replaceAll(" ", "").toLowerCase();
1189
- if (sanitizedString[0] === ">") {
1190
- const orEqual = sanitizedString[1] === "=";
1191
- const logLevelIndex = LOG_LEVELS.indexOf(
1192
- sanitizedString.substring(orEqual ? 2 : 1)
1193
- );
1194
- if (logLevelIndex === -1) {
1195
- throw new Error(`parse error (unknown log level): ${sanitizedString}`);
1196
- }
1197
- return LOG_LEVELS.slice(orEqual ? logLevelIndex : logLevelIndex + 1);
1198
- } else if (sanitizedString.includes(",")) {
1199
- return sanitizedString.split(",").filter(isLogLevel);
1200
- }
1201
- return isLogLevel(sanitizedString) ? [sanitizedString] : LOG_LEVELS;
1202
- }
1203
-
1204
- // packages/core/src/logger/utils/is-log-level-enabled.mts
1205
- var LOG_LEVEL_VALUES = {
1206
- verbose: 0,
1207
- debug: 1,
1208
- log: 2,
1209
- warn: 3,
1210
- error: 4,
1211
- fatal: 5
1212
- };
1213
- function isLogLevelEnabled(targetLevel, logLevels) {
1214
- var _a;
1215
- if (!logLevels || Array.isArray(logLevels) && (logLevels == null ? void 0 : logLevels.length) === 0) {
1216
- return false;
1217
- }
1218
- if (logLevels.includes(targetLevel)) {
1219
- return true;
1220
- }
1221
- const highestLogLevelValue = (_a = logLevels.map((level) => LOG_LEVEL_VALUES[level]).sort((a, b) => b - a)) == null ? void 0 : _a[0];
1222
- const targetLevelValue = LOG_LEVEL_VALUES[targetLevel];
1223
- return targetLevelValue >= highestLogLevelValue;
1224
- }
1225
-
1226
- // packages/core/src/logger/utils/shared.utils.mts
1227
- var isUndefined = (obj) => typeof obj === "undefined";
1228
- var isObject = (fn) => !isNil(fn) && typeof fn === "object";
1229
- var isPlainObject = (fn) => {
1230
- if (!isObject(fn)) {
1231
- return false;
1232
- }
1233
- const proto = Object.getPrototypeOf(fn);
1234
- if (proto === null) {
1235
- return true;
1236
- }
1237
- const ctor = Object.prototype.hasOwnProperty.call(proto, "constructor") && proto.constructor;
1238
- return typeof ctor === "function" && ctor instanceof ctor && Function.prototype.toString.call(ctor) === Function.prototype.toString.call(Object);
1239
- };
1240
- var addLeadingSlash = (path) => path && typeof path === "string" ? path.charAt(0) !== "/" && path.substring(0, 2) !== "{/" ? "/" + path : path : "";
1241
- var normalizePath = (path) => path ? path.startsWith("/") ? ("/" + path.replace(/\/+$/, "")).replace(/\/+/g, "/") : "/" + path.replace(/\/+$/, "") : "/";
1242
- var stripEndSlash = (path) => path[path.length - 1] === "/" ? path.slice(0, path.length - 1) : path;
1243
- var isFunction = (val) => typeof val === "function";
1244
- var isString = (val) => typeof val === "string";
1245
- var isNumber = (val) => typeof val === "number";
1246
- var isConstructor = (val) => val === "constructor";
1247
- var isNil = (val) => isUndefined(val) || val === null;
1248
- var isEmpty = (array) => !(array && array.length > 0);
1249
- var isSymbol = (val) => typeof val === "symbol";
1250
-
1251
- // packages/core/src/logger/console-logger.service.mts
1252
- import { inspect } from "util";
1253
- var DEFAULT_DEPTH = 5;
1254
- var DEFAULT_LOG_LEVELS = [
1255
- "log",
1256
- "error",
1257
- "warn",
1258
- "debug",
1259
- "verbose",
1260
- "fatal"
1261
- ];
1262
- var dateTimeFormatter = new Intl.DateTimeFormat(void 0, {
1263
- year: "numeric",
1264
- hour: "numeric",
1265
- minute: "numeric",
1266
- second: "numeric",
1267
- day: "2-digit",
1268
- month: "2-digit"
1269
- });
1270
- var _ConsoleLogger_decorators, _init;
1271
- _ConsoleLogger_decorators = [Injectable()];
1272
- var _ConsoleLogger = class _ConsoleLogger {
1273
- /**
1274
- * The options of the logger.
1275
- */
1276
- options;
1277
- /**
1278
- * The context of the logger (can be set manually or automatically inferred).
1279
- */
1280
- context;
1281
- /**
1282
- * The original context of the logger (set in the constructor).
1283
- */
1284
- originalContext;
1285
- /**
1286
- * The options used for the "inspect" method.
1287
- */
1288
- inspectOptions;
1289
- /**
1290
- * The last timestamp at which the log message was printed.
1291
- */
1292
- static lastTimestampAt;
1293
- constructor(contextOrOptions, options) {
1294
- let [context, opts] = isString(contextOrOptions) ? [contextOrOptions, options] : options ? [void 0, options] : [contextOrOptions == null ? void 0 : contextOrOptions.context, contextOrOptions];
1295
- opts = opts ?? {};
1296
- opts.logLevels ??= DEFAULT_LOG_LEVELS;
1297
- opts.colors ??= opts.colors ?? (opts.json ? false : true);
1298
- opts.prefix ??= "Navios";
1299
- this.options = opts;
1300
- this.inspectOptions = this.getInspectOptions();
1301
- if (context) {
1302
- this.context = context;
1303
- this.originalContext = context;
1002
+ // packages/core/src/logger/console-logger.service.mts
1003
+ var DEFAULT_DEPTH = 5;
1004
+ var DEFAULT_LOG_LEVELS = [
1005
+ "log",
1006
+ "error",
1007
+ "warn",
1008
+ "debug",
1009
+ "verbose",
1010
+ "fatal"
1011
+ ];
1012
+ var dateTimeFormatter = new Intl.DateTimeFormat(void 0, {
1013
+ year: "numeric",
1014
+ hour: "numeric",
1015
+ minute: "numeric",
1016
+ second: "numeric",
1017
+ day: "2-digit",
1018
+ month: "2-digit"
1019
+ });
1020
+ var _ConsoleLogger_decorators, _init;
1021
+ _ConsoleLogger_decorators = [Injectable()];
1022
+ var _ConsoleLogger = class _ConsoleLogger {
1023
+ /**
1024
+ * The options of the logger.
1025
+ */
1026
+ options;
1027
+ /**
1028
+ * The context of the logger (can be set manually or automatically inferred).
1029
+ */
1030
+ context;
1031
+ /**
1032
+ * The original context of the logger (set in the constructor).
1033
+ */
1034
+ originalContext;
1035
+ /**
1036
+ * The options used for the "inspect" method.
1037
+ */
1038
+ inspectOptions;
1039
+ /**
1040
+ * The last timestamp at which the log message was printed.
1041
+ */
1042
+ static lastTimestampAt;
1043
+ constructor(contextOrOptions, options) {
1044
+ let [context, opts] = isString(contextOrOptions) ? [contextOrOptions, options] : options ? [void 0, options] : [contextOrOptions == null ? void 0 : contextOrOptions.context, contextOrOptions];
1045
+ opts = opts ?? {};
1046
+ opts.logLevels ??= DEFAULT_LOG_LEVELS;
1047
+ opts.colors ??= opts.colors ?? (opts.json ? false : true);
1048
+ opts.prefix ??= "Navios";
1049
+ this.options = opts;
1050
+ this.inspectOptions = this.getInspectOptions();
1051
+ if (context) {
1052
+ this.context = context;
1053
+ this.originalContext = context;
1304
1054
  }
1305
1055
  }
1306
1056
  log(message, ...optionalParams) {
@@ -1631,177 +1381,580 @@ var _LoggerInstance = class _LoggerInstance {
1631
1381
  return this.registerLocalInstanceRef();
1632
1382
  }
1633
1383
  }
1634
- return _LoggerInstance.staticInstanceRef;
1384
+ return _LoggerInstance.staticInstanceRef;
1385
+ }
1386
+ error(message, ...optionalParams) {
1387
+ var _a;
1388
+ optionalParams = this.context ? (optionalParams.length ? optionalParams : [void 0]).concat(
1389
+ this.context
1390
+ ) : optionalParams;
1391
+ (_a = this.localInstance) == null ? void 0 : _a.error(message, ...optionalParams);
1392
+ }
1393
+ log(message, ...optionalParams) {
1394
+ var _a;
1395
+ optionalParams = this.context ? optionalParams.concat(this.context) : optionalParams;
1396
+ (_a = this.localInstance) == null ? void 0 : _a.log(message, ...optionalParams);
1397
+ }
1398
+ warn(message, ...optionalParams) {
1399
+ var _a;
1400
+ optionalParams = this.context ? optionalParams.concat(this.context) : optionalParams;
1401
+ (_a = this.localInstance) == null ? void 0 : _a.warn(message, ...optionalParams);
1402
+ }
1403
+ debug(message, ...optionalParams) {
1404
+ var _a, _b;
1405
+ optionalParams = this.context ? optionalParams.concat(this.context) : optionalParams;
1406
+ (_b = (_a = this.localInstance) == null ? void 0 : _a.debug) == null ? void 0 : _b.call(_a, message, ...optionalParams);
1407
+ }
1408
+ verbose(message, ...optionalParams) {
1409
+ var _a, _b;
1410
+ optionalParams = this.context ? optionalParams.concat(this.context) : optionalParams;
1411
+ (_b = (_a = this.localInstance) == null ? void 0 : _a.verbose) == null ? void 0 : _b.call(_a, message, ...optionalParams);
1412
+ }
1413
+ fatal(message, ...optionalParams) {
1414
+ var _a, _b;
1415
+ optionalParams = this.context ? optionalParams.concat(this.context) : optionalParams;
1416
+ (_b = (_a = this.localInstance) == null ? void 0 : _a.fatal) == null ? void 0 : _b.call(_a, message, ...optionalParams);
1417
+ }
1418
+ static error(message, ...optionalParams) {
1419
+ var _a;
1420
+ (_a = this.staticInstanceRef) == null ? void 0 : _a.error(message, ...optionalParams);
1421
+ }
1422
+ static log(message, ...optionalParams) {
1423
+ var _a;
1424
+ (_a = this.staticInstanceRef) == null ? void 0 : _a.log(message, ...optionalParams);
1425
+ }
1426
+ static warn(message, ...optionalParams) {
1427
+ var _a;
1428
+ (_a = this.staticInstanceRef) == null ? void 0 : _a.warn(message, ...optionalParams);
1429
+ }
1430
+ static debug(message, ...optionalParams) {
1431
+ var _a, _b;
1432
+ (_b = (_a = this.staticInstanceRef) == null ? void 0 : _a.debug) == null ? void 0 : _b.call(_a, message, ...optionalParams);
1433
+ }
1434
+ static verbose(message, ...optionalParams) {
1435
+ var _a, _b;
1436
+ (_b = (_a = this.staticInstanceRef) == null ? void 0 : _a.verbose) == null ? void 0 : _b.call(_a, message, ...optionalParams);
1437
+ }
1438
+ static fatal(message, ...optionalParams) {
1439
+ var _a, _b;
1440
+ (_b = (_a = this.staticInstanceRef) == null ? void 0 : _a.fatal) == null ? void 0 : _b.call(_a, message, ...optionalParams);
1441
+ }
1442
+ static getTimestamp() {
1443
+ return dateTimeFormatter2.format(Date.now());
1444
+ }
1445
+ static overrideLogger(logger) {
1446
+ var _a, _b;
1447
+ if (Array.isArray(logger)) {
1448
+ _LoggerInstance.logLevels = logger;
1449
+ return (_b = (_a = this.staticInstanceRef) == null ? void 0 : _a.setLogLevels) == null ? void 0 : _b.call(_a, logger);
1450
+ }
1451
+ if (isObject(logger)) {
1452
+ this.staticInstanceRef = logger;
1453
+ } else {
1454
+ this.staticInstanceRef = void 0;
1455
+ }
1456
+ }
1457
+ static isLevelEnabled(level) {
1458
+ const logLevels = _LoggerInstance.logLevels;
1459
+ return isLogLevelEnabled(level, logLevels);
1460
+ }
1461
+ registerLocalInstanceRef() {
1462
+ var _a;
1463
+ if (this.localInstanceRef) {
1464
+ return this.localInstanceRef;
1465
+ }
1466
+ this.localInstanceRef = new ConsoleLogger(this.context, {
1467
+ timestamp: (_a = this.options) == null ? void 0 : _a.timestamp,
1468
+ logLevels: _LoggerInstance.logLevels
1469
+ });
1470
+ return this.localInstanceRef;
1471
+ }
1472
+ };
1473
+ _init2 = __decoratorStart(null);
1474
+ _LoggerInstance = __decorateElement(_init2, 0, "LoggerInstance", _LoggerInstance_decorators, _LoggerInstance);
1475
+ __runInitializers(_init2, 1, _LoggerInstance);
1476
+ var LoggerInstance = _LoggerInstance;
1477
+
1478
+ // packages/core/src/logger/logger.factory.mts
1479
+ var LoggerInjectionToken = "LoggerInjectionToken";
1480
+ var LoggerOptions = z.object({
1481
+ context: z.string().optional(),
1482
+ options: z.object({
1483
+ timestamp: z.boolean().optional()
1484
+ }).optional()
1485
+ }).optional();
1486
+ var Logger = InjectionToken.create(LoggerInjectionToken, LoggerOptions);
1487
+ var _LoggerFactory_decorators, _init3;
1488
+ _LoggerFactory_decorators = [Injectable({
1489
+ type: "Factory" /* Factory */,
1490
+ token: Logger
1491
+ })];
1492
+ var LoggerFactory = class {
1493
+ create(ctx, args) {
1494
+ return new LoggerInstance(args == null ? void 0 : args.context, args == null ? void 0 : args.options);
1495
+ }
1496
+ };
1497
+ _init3 = __decoratorStart(null);
1498
+ LoggerFactory = __decorateElement(_init3, 0, "LoggerFactory", _LoggerFactory_decorators, LoggerFactory);
1499
+ __runInitializers(_init3, 1, LoggerFactory);
1500
+
1501
+ // packages/core/src/logger/pino-wrapper.mts
1502
+ var PinoWrapper = class _PinoWrapper {
1503
+ constructor(logger) {
1504
+ this.logger = logger;
1505
+ }
1506
+ fatal(message, ...optionalParams) {
1507
+ if (this.logger.fatal === void 0) {
1508
+ return this.error(message, ...optionalParams);
1509
+ }
1510
+ this.logger.fatal(message, ...optionalParams);
1635
1511
  }
1636
1512
  error(message, ...optionalParams) {
1637
- var _a;
1638
- optionalParams = this.context ? (optionalParams.length ? optionalParams : [void 0]).concat(
1639
- this.context
1640
- ) : optionalParams;
1641
- (_a = this.localInstance) == null ? void 0 : _a.error(message, ...optionalParams);
1642
- }
1643
- log(message, ...optionalParams) {
1644
- var _a;
1645
- optionalParams = this.context ? optionalParams.concat(this.context) : optionalParams;
1646
- (_a = this.localInstance) == null ? void 0 : _a.log(message, ...optionalParams);
1513
+ this.logger.error(message, ...optionalParams);
1647
1514
  }
1648
1515
  warn(message, ...optionalParams) {
1649
- var _a;
1650
- optionalParams = this.context ? optionalParams.concat(this.context) : optionalParams;
1651
- (_a = this.localInstance) == null ? void 0 : _a.warn(message, ...optionalParams);
1516
+ this.logger.warn(message, ...optionalParams);
1517
+ }
1518
+ info() {
1652
1519
  }
1653
1520
  debug(message, ...optionalParams) {
1654
1521
  var _a, _b;
1655
- optionalParams = this.context ? optionalParams.concat(this.context) : optionalParams;
1656
- (_b = (_a = this.localInstance) == null ? void 0 : _a.debug) == null ? void 0 : _b.call(_a, message, ...optionalParams);
1522
+ (_b = (_a = this.logger).debug) == null ? void 0 : _b.call(_a, message, ...optionalParams);
1657
1523
  }
1658
- verbose(message, ...optionalParams) {
1524
+ trace(message, ...optionalParams) {
1659
1525
  var _a, _b;
1660
- optionalParams = this.context ? optionalParams.concat(this.context) : optionalParams;
1661
- (_b = (_a = this.localInstance) == null ? void 0 : _a.verbose) == null ? void 0 : _b.call(_a, message, ...optionalParams);
1526
+ (_b = (_a = this.logger).verbose) == null ? void 0 : _b.call(_a, message, ...optionalParams);
1662
1527
  }
1663
- fatal(message, ...optionalParams) {
1664
- var _a, _b;
1665
- optionalParams = this.context ? optionalParams.concat(this.context) : optionalParams;
1666
- (_b = (_a = this.localInstance) == null ? void 0 : _a.fatal) == null ? void 0 : _b.call(_a, message, ...optionalParams);
1528
+ silent() {
1667
1529
  }
1668
- static error(message, ...optionalParams) {
1669
- var _a;
1670
- (_a = this.staticInstanceRef) == null ? void 0 : _a.error(message, ...optionalParams);
1530
+ child(options) {
1531
+ const keys = Object.keys(options);
1532
+ let newContext = this.logger["context"] ?? "";
1533
+ if (keys.length > 1) {
1534
+ newContext = `${this.logger["context"] ?? ""}:${JSON.stringify(options)}`;
1535
+ }
1536
+ return new _PinoWrapper(
1537
+ // @ts-expect-error We don't need to support this in the current version
1538
+ new LoggerInstance(newContext, this.logger["options"])
1539
+ );
1671
1540
  }
1672
- static log(message, ...optionalParams) {
1673
- var _a;
1674
- (_a = this.staticInstanceRef) == null ? void 0 : _a.log(message, ...optionalParams);
1541
+ get level() {
1542
+ if ("level" in this.logger && this.logger.level) {
1543
+ return this.logger.level;
1544
+ }
1545
+ const levels = LoggerInstance["logLevels"];
1546
+ if (levels) {
1547
+ return levels.find((level) => level !== "verbose");
1548
+ }
1549
+ return "warn";
1675
1550
  }
1676
- static warn(message, ...optionalParams) {
1677
- var _a;
1678
- (_a = this.staticInstanceRef) == null ? void 0 : _a.warn(message, ...optionalParams);
1551
+ };
1552
+
1553
+ // packages/core/src/config/config.service.mts
1554
+ import { NaviosException } from "@navios/common";
1555
+ var ConfigServiceInstance = class {
1556
+ constructor(config = {}, logger) {
1557
+ this.config = config;
1558
+ this.logger = logger;
1679
1559
  }
1680
- static debug(message, ...optionalParams) {
1681
- var _a, _b;
1682
- (_b = (_a = this.staticInstanceRef) == null ? void 0 : _a.debug) == null ? void 0 : _b.call(_a, message, ...optionalParams);
1560
+ getConfig() {
1561
+ return this.config;
1683
1562
  }
1684
- static verbose(message, ...optionalParams) {
1563
+ get(key) {
1685
1564
  var _a, _b;
1686
- (_b = (_a = this.staticInstanceRef) == null ? void 0 : _a.verbose) == null ? void 0 : _b.call(_a, message, ...optionalParams);
1565
+ try {
1566
+ const parts = String(key).split(".");
1567
+ let value = this.config;
1568
+ for (const part of parts) {
1569
+ if (value === null || value === void 0 || typeof value !== "object") {
1570
+ return null;
1571
+ }
1572
+ value = value[part];
1573
+ }
1574
+ return value ?? null;
1575
+ } catch (error) {
1576
+ (_b = (_a = this.logger).debug) == null ? void 0 : _b.call(
1577
+ _a,
1578
+ `Failed to get config value for key ${String(key)}`,
1579
+ error
1580
+ );
1581
+ return null;
1582
+ }
1687
1583
  }
1688
- static fatal(message, ...optionalParams) {
1689
- var _a, _b;
1690
- (_b = (_a = this.staticInstanceRef) == null ? void 0 : _a.fatal) == null ? void 0 : _b.call(_a, message, ...optionalParams);
1584
+ getOrDefault(key, defaultValue) {
1585
+ const value = this.get(key);
1586
+ return value !== null ? value : defaultValue;
1691
1587
  }
1692
- static getTimestamp() {
1693
- return dateTimeFormatter2.format(Date.now());
1588
+ getOrThrow(key, errorMessage) {
1589
+ const value = this.get(key);
1590
+ if (value === null) {
1591
+ const message = errorMessage || `Configuration value for key "${String(key)}" is not defined`;
1592
+ this.logger.error(message);
1593
+ throw new NaviosException(message);
1594
+ }
1595
+ return value;
1694
1596
  }
1695
- static overrideLogger(logger) {
1696
- var _a, _b;
1697
- console.log(logger);
1698
- if (Array.isArray(logger)) {
1699
- _LoggerInstance.logLevels = logger;
1700
- return (_b = (_a = this.staticInstanceRef) == null ? void 0 : _a.setLogLevels) == null ? void 0 : _b.call(_a, logger);
1597
+ };
1598
+
1599
+ // packages/core/src/config/config.provider.mts
1600
+ var ConfigProviderInjectionToken = "ConfigProvider";
1601
+ var ConfigProviderOptions = z2.object({
1602
+ load: z2.function()
1603
+ });
1604
+ var ConfigProvider = InjectionToken.create(ConfigProviderInjectionToken, ConfigProviderOptions);
1605
+ var _ConfigProviderFactory_decorators, _init4;
1606
+ _ConfigProviderFactory_decorators = [Injectable({
1607
+ token: ConfigProvider,
1608
+ type: "Factory" /* Factory */
1609
+ })];
1610
+ var ConfigProviderFactory = class {
1611
+ logger = inject(Logger, {
1612
+ context: "ConfigService"
1613
+ });
1614
+ async create(ctx, args) {
1615
+ const { load } = args;
1616
+ const logger = await this.logger;
1617
+ try {
1618
+ const config = await load();
1619
+ return new ConfigServiceInstance(config, logger);
1620
+ } catch (error) {
1621
+ logger.error("Error loading config", error);
1622
+ throw error;
1623
+ }
1624
+ }
1625
+ };
1626
+ _init4 = __decoratorStart(null);
1627
+ ConfigProviderFactory = __decorateElement(_init4, 0, "ConfigProviderFactory", _ConfigProviderFactory_decorators, ConfigProviderFactory);
1628
+ __runInitializers(_init4, 1, ConfigProviderFactory);
1629
+ function makeConfigToken(options) {
1630
+ var _ConfigServiceImpl_decorators, _init9;
1631
+ _ConfigServiceImpl_decorators = [Injectable({
1632
+ type: "Factory" /* Factory */
1633
+ })];
1634
+ class ConfigServiceImpl {
1635
+ configService = inject(ConfigProvider, options);
1636
+ create() {
1637
+ return this.configService;
1638
+ }
1639
+ }
1640
+ _init9 = __decoratorStart(null);
1641
+ ConfigServiceImpl = __decorateElement(_init9, 0, "ConfigServiceImpl", _ConfigServiceImpl_decorators, ConfigServiceImpl);
1642
+ __runInitializers(_init9, 1, ConfigServiceImpl);
1643
+ return getInjectableToken(ConfigServiceImpl);
1644
+ }
1645
+
1646
+ // packages/core/src/metadata/endpoint.metadata.mts
1647
+ var EndpointMetadataKey = Symbol("EndpointMetadataKey");
1648
+ var EndpointType = /* @__PURE__ */ ((EndpointType2) => {
1649
+ EndpointType2["Unknown"] = "unknown";
1650
+ EndpointType2["Config"] = "config";
1651
+ EndpointType2["Handler"] = "handler";
1652
+ return EndpointType2;
1653
+ })(EndpointType || {});
1654
+ function getAllEndpointMetadata(context) {
1655
+ if (context.metadata) {
1656
+ const metadata = context.metadata[EndpointMetadataKey];
1657
+ if (metadata) {
1658
+ return metadata;
1659
+ } else {
1660
+ context.metadata[EndpointMetadataKey] = /* @__PURE__ */ new Set();
1661
+ return context.metadata[EndpointMetadataKey];
1662
+ }
1663
+ }
1664
+ throw new Error("[Navios] Wrong environment.");
1665
+ }
1666
+ function getEndpointMetadata(target, context) {
1667
+ if (context.metadata) {
1668
+ const metadata = getAllEndpointMetadata(context);
1669
+ if (metadata) {
1670
+ const endpointMetadata = Array.from(metadata).find(
1671
+ (item) => item.classMethod === target.name
1672
+ );
1673
+ if (endpointMetadata) {
1674
+ return endpointMetadata;
1675
+ } else {
1676
+ const newMetadata = {
1677
+ classMethod: target.name,
1678
+ url: "",
1679
+ successStatusCode: 200,
1680
+ headers: {},
1681
+ type: "unknown" /* Unknown */,
1682
+ httpMethod: "GET",
1683
+ config: null,
1684
+ guards: /* @__PURE__ */ new Set(),
1685
+ customAttributes: /* @__PURE__ */ new Map()
1686
+ };
1687
+ metadata.add(newMetadata);
1688
+ return newMetadata;
1689
+ }
1690
+ }
1691
+ }
1692
+ throw new Error("[Navios] Wrong environment.");
1693
+ }
1694
+
1695
+ // packages/core/src/metadata/controller.metadata.mts
1696
+ var ControllerMetadataKey = Symbol("ControllerMetadataKey");
1697
+ function getControllerMetadata(target, context) {
1698
+ if (context.metadata) {
1699
+ const metadata = context.metadata[ControllerMetadataKey];
1700
+ if (metadata) {
1701
+ return metadata;
1702
+ } else {
1703
+ const endpointsMetadata = getAllEndpointMetadata(context);
1704
+ const newMetadata = {
1705
+ endpoints: endpointsMetadata,
1706
+ guards: /* @__PURE__ */ new Set(),
1707
+ customAttributes: /* @__PURE__ */ new Map()
1708
+ };
1709
+ context.metadata[ControllerMetadataKey] = newMetadata;
1710
+ target[ControllerMetadataKey] = newMetadata;
1711
+ return newMetadata;
1712
+ }
1713
+ }
1714
+ throw new Error("[Navios] Wrong environment.");
1715
+ }
1716
+ function extractControllerMetadata(target) {
1717
+ const metadata = target[ControllerMetadataKey];
1718
+ if (!metadata) {
1719
+ throw new Error(
1720
+ "[Navios] Controller metadata not found. Make sure to use @Controller decorator."
1721
+ );
1722
+ }
1723
+ return metadata;
1724
+ }
1725
+ function hasControllerMetadata(target) {
1726
+ const metadata = target[ControllerMetadataKey];
1727
+ return !!metadata;
1728
+ }
1729
+
1730
+ // packages/core/src/metadata/module.metadata.mts
1731
+ var ModuleMetadataKey = Symbol("ControllerMetadataKey");
1732
+ function getModuleMetadata(target, context) {
1733
+ if (context.metadata) {
1734
+ const metadata = context.metadata[ModuleMetadataKey];
1735
+ if (metadata) {
1736
+ return metadata;
1737
+ } else {
1738
+ const newMetadata = {
1739
+ controllers: /* @__PURE__ */ new Set(),
1740
+ imports: /* @__PURE__ */ new Set(),
1741
+ guards: /* @__PURE__ */ new Set(),
1742
+ customAttributes: /* @__PURE__ */ new Map()
1743
+ };
1744
+ context.metadata[ModuleMetadataKey] = newMetadata;
1745
+ target[ModuleMetadataKey] = newMetadata;
1746
+ return newMetadata;
1747
+ }
1748
+ }
1749
+ throw new Error("[Navios] Wrong environment.");
1750
+ }
1751
+ function extractModuleMetadata(target) {
1752
+ const metadata = target[ModuleMetadataKey];
1753
+ if (!metadata) {
1754
+ throw new Error(
1755
+ "[Navios] Module metadata not found. Make sure to use @Module decorator."
1756
+ );
1757
+ }
1758
+ return metadata;
1759
+ }
1760
+ function hasModuleMetadata(target) {
1761
+ return !!target[ModuleMetadataKey];
1762
+ }
1763
+
1764
+ // packages/core/src/decorators/controller.decorator.mts
1765
+ function Controller({ guards } = {}) {
1766
+ return function(target, context) {
1767
+ if (context.kind !== "class") {
1768
+ throw new Error(
1769
+ "[Navios] @Controller decorator can only be used on classes."
1770
+ );
1771
+ }
1772
+ const token = InjectionToken.create(target);
1773
+ if (context.metadata) {
1774
+ const controllerMetadata = getControllerMetadata(target, context);
1775
+ if (guards) {
1776
+ for (const guard of Array.from(guards).reverse()) {
1777
+ controllerMetadata.guards.add(guard);
1778
+ }
1779
+ }
1780
+ }
1781
+ return Injectable({
1782
+ token,
1783
+ type: "Class" /* Class */,
1784
+ scope: "Instance" /* Instance */
1785
+ })(target, context);
1786
+ };
1787
+ }
1788
+
1789
+ // packages/core/src/decorators/endpoint.decorator.mts
1790
+ function Endpoint(endpoint) {
1791
+ return (target, context) => {
1792
+ if (typeof target !== "function") {
1793
+ throw new Error(
1794
+ "[Navios] Endpoint decorator can only be used on functions."
1795
+ );
1796
+ }
1797
+ if (context.kind !== "method") {
1798
+ throw new Error(
1799
+ "[Navios] Endpoint decorator can only be used on methods."
1800
+ );
1801
+ }
1802
+ const config = endpoint.config;
1803
+ if (context.metadata) {
1804
+ let endpointMetadata = getEndpointMetadata(target, context);
1805
+ if (endpointMetadata.config && endpointMetadata.config.url) {
1806
+ throw new Error(
1807
+ `[Navios] Endpoint ${config.method} ${config.url} already exists. Please use a different method or url.`
1808
+ );
1809
+ }
1810
+ endpointMetadata.config = config;
1811
+ endpointMetadata.type = "config" /* Config */;
1812
+ endpointMetadata.classMethod = target.name;
1813
+ endpointMetadata.httpMethod = config.method;
1814
+ endpointMetadata.url = config.url;
1701
1815
  }
1702
- if (isObject(logger)) {
1703
- this.staticInstanceRef = logger;
1704
- } else {
1705
- this.staticInstanceRef = void 0;
1816
+ return target;
1817
+ };
1818
+ }
1819
+
1820
+ // packages/core/src/decorators/header.decorator.mts
1821
+ function Header(name2, value) {
1822
+ return (target, context) => {
1823
+ if (context.kind !== "method") {
1824
+ throw new Error("[Navios] Header decorator can only be used on methods.");
1706
1825
  }
1707
- }
1708
- static isLevelEnabled(level) {
1709
- const logLevels = _LoggerInstance.logLevels;
1710
- return isLogLevelEnabled(level, logLevels);
1711
- }
1712
- registerLocalInstanceRef() {
1713
- var _a;
1714
- if (this.localInstanceRef) {
1715
- return this.localInstanceRef;
1826
+ const metadata = getEndpointMetadata(target, context);
1827
+ metadata.headers[name2] = value;
1828
+ return target;
1829
+ };
1830
+ }
1831
+
1832
+ // packages/core/src/decorators/http-code.decorator.mts
1833
+ function HttpCode(code) {
1834
+ return (target, context) => {
1835
+ if (context.kind !== "method") {
1836
+ throw new Error(
1837
+ "[Navios] HttpCode decorator can only be used on methods."
1838
+ );
1716
1839
  }
1717
- this.localInstanceRef = new ConsoleLogger(this.context, {
1718
- timestamp: (_a = this.options) == null ? void 0 : _a.timestamp,
1719
- logLevels: _LoggerInstance.logLevels
1720
- });
1721
- return this.localInstanceRef;
1840
+ const metadata = getEndpointMetadata(target, context);
1841
+ metadata.successStatusCode = code;
1842
+ return target;
1843
+ };
1844
+ }
1845
+
1846
+ // packages/core/src/decorators/module.decorator.mts
1847
+ function Module(metadata) {
1848
+ return (target, context) => {
1849
+ if (context.kind !== "class") {
1850
+ throw new Error("[Navios] @Module decorator can only be used on classes.");
1851
+ }
1852
+ const token = InjectionToken.create(target);
1853
+ const moduleMetadata = getModuleMetadata(target, context);
1854
+ if (metadata.controllers) {
1855
+ for (const controller of metadata.controllers) {
1856
+ moduleMetadata.controllers.add(controller);
1857
+ }
1858
+ }
1859
+ if (metadata.imports) {
1860
+ for (const importedModule of metadata.imports) {
1861
+ moduleMetadata.imports.add(importedModule);
1862
+ }
1863
+ }
1864
+ if (metadata.guards) {
1865
+ for (const guard of Array.from(metadata.guards).reverse()) {
1866
+ moduleMetadata.guards.add(guard);
1867
+ }
1868
+ }
1869
+ return Injectable({
1870
+ token,
1871
+ type: "Class" /* Class */,
1872
+ scope: "Singleton" /* Singleton */
1873
+ })(target, context);
1874
+ };
1875
+ }
1876
+
1877
+ // packages/core/src/decorators/use-guards.decorator.mts
1878
+ function UseGuards(...guards) {
1879
+ return function(target, context) {
1880
+ if (context.kind === "class") {
1881
+ const controllerMetadata = getControllerMetadata(
1882
+ target,
1883
+ context
1884
+ );
1885
+ for (const guard of guards.reverse()) {
1886
+ controllerMetadata.guards.add(guard);
1887
+ }
1888
+ } else if (context.kind === "method") {
1889
+ const endpointMetadata = getEndpointMetadata(target, context);
1890
+ for (const guard of guards.reverse()) {
1891
+ endpointMetadata.guards.add(guard);
1892
+ }
1893
+ } else {
1894
+ throw new Error(
1895
+ "[Navios] @UseGuards decorator can only be used on classes or methods."
1896
+ );
1897
+ }
1898
+ return target;
1899
+ };
1900
+ }
1901
+
1902
+ // packages/core/src/exceptions/http.exception.mts
1903
+ var HttpException = class {
1904
+ constructor(statusCode, response, error) {
1905
+ this.statusCode = statusCode;
1906
+ this.response = response;
1907
+ this.error = error;
1722
1908
  }
1723
1909
  };
1724
- _init2 = __decoratorStart(null);
1725
- _LoggerInstance = __decorateElement(_init2, 0, "LoggerInstance", _LoggerInstance_decorators, _LoggerInstance);
1726
- __runInitializers(_init2, 1, _LoggerInstance);
1727
- var LoggerInstance = _LoggerInstance;
1728
1910
 
1729
- // packages/core/src/logger/logger.factory.mts
1730
- var LoggerInjectionToken = "LoggerInjectionToken";
1731
- var LoggerOptions = z.object({
1732
- context: z.string().optional(),
1733
- options: z.object({
1734
- timestamp: z.boolean().optional()
1735
- }).optional()
1736
- }).optional();
1737
- var Logger = InjectionToken.create(LoggerInjectionToken, LoggerOptions);
1738
- var _LoggerFactory_decorators, _init3;
1739
- _LoggerFactory_decorators = [Injectable({
1740
- type: "Factory" /* Factory */,
1741
- token: Logger
1742
- })];
1743
- var LoggerFactory = class {
1744
- create(ctx, args) {
1745
- return new LoggerInstance(args == null ? void 0 : args.context, args == null ? void 0 : args.options);
1911
+ // packages/core/src/exceptions/bad-request.exception.mts
1912
+ var BadRequestException = class extends HttpException {
1913
+ constructor(message) {
1914
+ super(400, message);
1746
1915
  }
1747
1916
  };
1748
- _init3 = __decoratorStart(null);
1749
- LoggerFactory = __decorateElement(_init3, 0, "LoggerFactory", _LoggerFactory_decorators, LoggerFactory);
1750
- __runInitializers(_init3, 1, LoggerFactory);
1751
1917
 
1752
- // packages/core/src/logger/pino-wrapper.mts
1753
- var PinoWrapper = class _PinoWrapper {
1754
- constructor(logger) {
1755
- this.logger = logger;
1756
- }
1757
- fatal(message, ...optionalParams) {
1758
- if (this.logger.fatal === void 0) {
1759
- return this.error(message, ...optionalParams);
1760
- }
1761
- this.logger.fatal(message, ...optionalParams);
1762
- }
1763
- error(message, ...optionalParams) {
1764
- this.logger.error(message, ...optionalParams);
1765
- }
1766
- warn(message, ...optionalParams) {
1767
- this.logger.warn(message, ...optionalParams);
1768
- }
1769
- info(message, ...optionalParams) {
1770
- this.logger.log(message, ...optionalParams);
1771
- }
1772
- debug(message, ...optionalParams) {
1773
- var _a, _b;
1774
- (_b = (_a = this.logger).debug) == null ? void 0 : _b.call(_a, message, ...optionalParams);
1918
+ // packages/core/src/exceptions/forbidden.exception.mts
1919
+ var ForbiddenException = class extends HttpException {
1920
+ constructor(message) {
1921
+ super(403, message);
1775
1922
  }
1776
- trace(message, ...optionalParams) {
1777
- var _a, _b;
1778
- (_b = (_a = this.logger).verbose) == null ? void 0 : _b.call(_a, message, ...optionalParams);
1923
+ };
1924
+
1925
+ // packages/core/src/exceptions/internal-server-error.exception.mts
1926
+ var InternalServerErrorException = class extends HttpException {
1927
+ constructor(message, error) {
1928
+ super(500, message, error);
1779
1929
  }
1780
- silent(message, ...optionalParams) {
1930
+ };
1931
+
1932
+ // packages/core/src/exceptions/not-found.exception.mts
1933
+ var NotFoundException = class extends HttpException {
1934
+ constructor(response, error) {
1935
+ super(404, response, error);
1936
+ this.response = response;
1937
+ this.error = error;
1781
1938
  }
1782
- child(options) {
1783
- const keys = Object.keys(options);
1784
- let newContext = this.logger["context"] ?? "";
1785
- if (keys.length > 1) {
1786
- newContext = `${this.logger["context"] ?? ""}:${JSON.stringify(options)}`;
1787
- }
1788
- return new _PinoWrapper(
1789
- // @ts-expect-error We don't need to support this in the current version
1790
- new LoggerInstance(newContext, this.logger["options"])
1791
- );
1939
+ };
1940
+
1941
+ // packages/core/src/exceptions/unauthorized.exception.mts
1942
+ var UnauthorizedException = class extends HttpException {
1943
+ constructor(message, error) {
1944
+ super(401, message, error);
1792
1945
  }
1793
- get level() {
1794
- if ("level" in this.logger && this.logger.level) {
1795
- return this.logger.level;
1796
- }
1797
- const levels = LoggerInstance["logLevels"];
1798
- if (levels) {
1799
- return levels[0];
1800
- }
1801
- return "info";
1946
+ };
1947
+
1948
+ // packages/core/src/exceptions/conflict.exception.mts
1949
+ var ConflictException = class extends HttpException {
1950
+ constructor(message, error) {
1951
+ super(409, message, error);
1802
1952
  }
1803
1953
  };
1804
1954
 
1955
+ // packages/core/src/services/controller-adapter.service.mts
1956
+ import { NaviosException as NaviosException2 } from "@navios/common";
1957
+
1805
1958
  // packages/core/src/tokens/application.token.mts
1806
1959
  var ApplicationInjectionToken = "ApplicationInjectionToken";
1807
1960
  var Application = InjectionToken.create(
@@ -1867,7 +2020,7 @@ var ExecutionContext2 = class {
1867
2020
  };
1868
2021
 
1869
2022
  // packages/core/src/services/guard-runner.service.mts
1870
- var _GuardRunnerService_decorators, _init4;
2023
+ var _GuardRunnerService_decorators, _init5;
1871
2024
  _GuardRunnerService_decorators = [Injectable()];
1872
2025
  var GuardRunnerService = class {
1873
2026
  async runGuards(allGuards, executionContext) {
@@ -1930,12 +2083,12 @@ var GuardRunnerService = class {
1930
2083
  return guards;
1931
2084
  }
1932
2085
  };
1933
- _init4 = __decoratorStart(null);
1934
- GuardRunnerService = __decorateElement(_init4, 0, "GuardRunnerService", _GuardRunnerService_decorators, GuardRunnerService);
1935
- __runInitializers(_init4, 1, GuardRunnerService);
2086
+ _init5 = __decoratorStart(null);
2087
+ GuardRunnerService = __decorateElement(_init5, 0, "GuardRunnerService", _GuardRunnerService_decorators, GuardRunnerService);
2088
+ __runInitializers(_init5, 1, GuardRunnerService);
1936
2089
 
1937
2090
  // packages/core/src/services/controller-adapter.service.mts
1938
- var _ControllerAdapterService_decorators, _init5;
2091
+ var _ControllerAdapterService_decorators, _init6;
1939
2092
  _ControllerAdapterService_decorators = [Injectable()];
1940
2093
  var _ControllerAdapterService = class _ControllerAdapterService {
1941
2094
  guardRunner = syncInject(GuardRunnerService);
@@ -1945,8 +2098,8 @@ var _ControllerAdapterService = class _ControllerAdapterService {
1945
2098
  setupController(controller, instance, moduleMetadata) {
1946
2099
  const controllerMetadata = extractControllerMetadata(controller);
1947
2100
  for (const endpoint of controllerMetadata.endpoints) {
1948
- const { classMethod, url, httpMethod, config } = endpoint;
1949
- if (!url || !config) {
2101
+ const { classMethod, url, httpMethod } = endpoint;
2102
+ if (!url) {
1950
2103
  throw new Error(
1951
2104
  `[Navios] Malformed Endpoint ${controller.name}:${classMethod}`
1952
2105
  );
@@ -1956,99 +2109,123 @@ var _ControllerAdapterService = class _ControllerAdapterService {
1956
2109
  controllerMetadata,
1957
2110
  endpoint
1958
2111
  );
1959
- const guards = this.guardRunner.makeContext(executionContext);
1960
- const { querySchema, requestSchema, responseSchema } = config;
1961
- const schema = {};
1962
- if (querySchema) {
1963
- schema.querystring = querySchema;
1964
- }
1965
- if (requestSchema) {
1966
- schema.body = requestSchema;
1967
- }
1968
- if (responseSchema) {
1969
- schema.response = {
1970
- 200: responseSchema
1971
- };
1972
- }
1973
2112
  instance.withTypeProvider().route({
1974
2113
  method: httpMethod,
1975
2114
  url: url.replaceAll("$", ":"),
1976
- schema,
1977
- preHandler: async (request, reply) => {
1978
- if (guards.size > 0) {
1979
- getServiceLocator().registerInstance(Request, request);
1980
- getServiceLocator().registerInstance(Reply, reply);
1981
- getServiceLocator().registerInstance(
1982
- ExecutionContextToken,
1983
- executionContext
1984
- );
1985
- executionContext.provideRequest(request);
1986
- executionContext.provideReply(reply);
1987
- const canActivate = await this.guardRunner.runGuards(
1988
- guards,
1989
- executionContext
1990
- );
1991
- getServiceLocator().removeInstance(Request);
1992
- getServiceLocator().removeInstance(Reply);
1993
- getServiceLocator().removeInstance(ExecutionContextToken);
1994
- if (!canActivate) {
1995
- return reply;
1996
- }
1997
- }
1998
- },
1999
- handler: async (request, reply) => {
2000
- getServiceLocator().registerInstance(Request, request);
2001
- getServiceLocator().registerInstance(Reply, reply);
2002
- getServiceLocator().registerInstance(
2003
- ExecutionContextToken,
2004
- executionContext
2005
- );
2006
- executionContext.provideRequest(request);
2007
- executionContext.provideReply(reply);
2008
- const controllerInstance = await inject(controller);
2009
- try {
2010
- const { query, params, body } = request;
2011
- const argument = {};
2012
- if (query && Object.keys(query).length > 0) {
2013
- argument.params = query;
2014
- }
2015
- if (params && Object.keys(params).length > 0) {
2016
- argument.urlParams = params;
2017
- }
2018
- if (body) {
2019
- argument.data = body;
2020
- }
2021
- const result = await controllerInstance[classMethod](argument);
2022
- reply.status(200).send(result);
2023
- } catch (error) {
2024
- if (error instanceof HttpException) {
2025
- reply.status(error.statusCode).send(error.response);
2026
- } else {
2027
- reply.status(500).send({
2028
- message: "Internal server error",
2029
- error: error.message
2030
- });
2031
- }
2032
- } finally {
2033
- getServiceLocator().removeInstance(Request);
2034
- getServiceLocator().removeInstance(Reply);
2035
- getServiceLocator().removeInstance(ExecutionContextToken);
2036
- }
2037
- }
2115
+ schema: this.provideSchemaForConfig(endpoint),
2116
+ preHandler: this.providePreHandler(executionContext),
2117
+ handler: this.provideHandler(controller, executionContext, endpoint)
2038
2118
  });
2039
2119
  this.logger.debug(
2040
2120
  `Registered ${httpMethod} ${url} for ${controller.name}:${classMethod}`
2041
2121
  );
2042
2122
  }
2043
2123
  }
2124
+ providePreHandler(executionContext) {
2125
+ const guards = this.guardRunner.makeContext(executionContext);
2126
+ return guards.size > 0 ? async (request, reply) => {
2127
+ getServiceLocator().registerInstance(Request, request);
2128
+ getServiceLocator().registerInstance(Reply, reply);
2129
+ getServiceLocator().registerInstance(
2130
+ ExecutionContextToken,
2131
+ executionContext
2132
+ );
2133
+ executionContext.provideRequest(request);
2134
+ executionContext.provideReply(reply);
2135
+ let canActivate = true;
2136
+ try {
2137
+ canActivate = await this.guardRunner.runGuards(
2138
+ guards,
2139
+ executionContext
2140
+ );
2141
+ } finally {
2142
+ getServiceLocator().removeInstance(Request);
2143
+ getServiceLocator().removeInstance(Reply);
2144
+ getServiceLocator().removeInstance(ExecutionContextToken);
2145
+ }
2146
+ if (!canActivate) {
2147
+ return reply;
2148
+ }
2149
+ } : void 0;
2150
+ }
2151
+ provideSchemaForConfig(endpointMetadata) {
2152
+ if (!endpointMetadata.config) {
2153
+ this.logger.warn(`No config found for endpoint ${endpointMetadata.url}`);
2154
+ return {};
2155
+ }
2156
+ const { querySchema, requestSchema, responseSchema } = endpointMetadata.config;
2157
+ const schema = {};
2158
+ if (querySchema) {
2159
+ schema.querystring = querySchema;
2160
+ }
2161
+ if (requestSchema) {
2162
+ schema.body = requestSchema;
2163
+ }
2164
+ if (responseSchema) {
2165
+ schema.response = {
2166
+ 200: responseSchema
2167
+ };
2168
+ }
2169
+ return schema;
2170
+ }
2171
+ provideHandler(controller, executionContext, endpointMetadata) {
2172
+ switch (endpointMetadata.type) {
2173
+ case "unknown" /* Unknown */:
2174
+ this.logger.error(
2175
+ `Unknown endpoint type ${endpointMetadata.type} for ${controller.name}:${endpointMetadata.classMethod}`
2176
+ );
2177
+ throw new NaviosException2("Unknown endpoint type");
2178
+ case "config" /* Config */:
2179
+ return this.provideHandlerForConfig(
2180
+ controller,
2181
+ executionContext,
2182
+ endpointMetadata
2183
+ );
2184
+ case "handler" /* Handler */:
2185
+ this.logger.error("Not implemented yet");
2186
+ throw new NaviosException2("Not implemented yet");
2187
+ }
2188
+ }
2189
+ provideHandlerForConfig(controller, executionContext, endpointMetadata) {
2190
+ return async (request, reply) => {
2191
+ getServiceLocator().registerInstance(Request, request);
2192
+ getServiceLocator().registerInstance(Reply, reply);
2193
+ getServiceLocator().registerInstance(
2194
+ ExecutionContextToken,
2195
+ executionContext
2196
+ );
2197
+ executionContext.provideRequest(request);
2198
+ executionContext.provideReply(reply);
2199
+ const controllerInstance = await inject(controller);
2200
+ try {
2201
+ const { query, params, body } = request;
2202
+ const argument = {};
2203
+ if (query && Object.keys(query).length > 0) {
2204
+ argument.params = query;
2205
+ }
2206
+ if (params && Object.keys(params).length > 0) {
2207
+ argument.urlParams = params;
2208
+ }
2209
+ if (body) {
2210
+ argument.data = body;
2211
+ }
2212
+ const result = await controllerInstance[endpointMetadata.classMethod](argument);
2213
+ reply.status(endpointMetadata.successStatusCode).headers(endpointMetadata.headers).send(result);
2214
+ } finally {
2215
+ getServiceLocator().removeInstance(Request);
2216
+ getServiceLocator().removeInstance(Reply);
2217
+ getServiceLocator().removeInstance(ExecutionContextToken);
2218
+ }
2219
+ };
2220
+ }
2044
2221
  };
2045
- _init5 = __decoratorStart(null);
2046
- _ControllerAdapterService = __decorateElement(_init5, 0, "ControllerAdapterService", _ControllerAdapterService_decorators, _ControllerAdapterService);
2047
- __runInitializers(_init5, 1, _ControllerAdapterService);
2222
+ _init6 = __decoratorStart(null);
2223
+ _ControllerAdapterService = __decorateElement(_init6, 0, "ControllerAdapterService", _ControllerAdapterService_decorators, _ControllerAdapterService);
2224
+ __runInitializers(_init6, 1, _ControllerAdapterService);
2048
2225
  var ControllerAdapterService = _ControllerAdapterService;
2049
2226
 
2050
2227
  // packages/core/src/services/module-loader.service.mts
2051
- var _ModuleLoaderService_decorators, _init6;
2228
+ var _ModuleLoaderService_decorators, _init7;
2052
2229
  _ModuleLoaderService_decorators = [Injectable()];
2053
2230
  var _ModuleLoaderService = class _ModuleLoaderService {
2054
2231
  logger = syncInject(Logger, {
@@ -2105,9 +2282,9 @@ var _ModuleLoaderService = class _ModuleLoaderService {
2105
2282
  return this.modulesMetadata;
2106
2283
  }
2107
2284
  };
2108
- _init6 = __decoratorStart(null);
2109
- _ModuleLoaderService = __decorateElement(_init6, 0, "ModuleLoaderService", _ModuleLoaderService_decorators, _ModuleLoaderService);
2110
- __runInitializers(_init6, 1, _ModuleLoaderService);
2285
+ _init7 = __decoratorStart(null);
2286
+ _ModuleLoaderService = __decorateElement(_init7, 0, "ModuleLoaderService", _ModuleLoaderService_decorators, _ModuleLoaderService);
2287
+ __runInitializers(_init7, 1, _ModuleLoaderService);
2111
2288
  var ModuleLoaderService = _ModuleLoaderService;
2112
2289
 
2113
2290
  // packages/core/src/attribute.factory.mts
@@ -2174,7 +2351,7 @@ import {
2174
2351
  serializerCompiler,
2175
2352
  validatorCompiler
2176
2353
  } from "fastify-type-provider-zod";
2177
- var _NaviosApplication_decorators, _init7;
2354
+ var _NaviosApplication_decorators, _init8;
2178
2355
  _NaviosApplication_decorators = [Injectable()];
2179
2356
  var _NaviosApplication = class _NaviosApplication {
2180
2357
  moduleLoader = syncInject(ModuleLoaderService);
@@ -2197,6 +2374,7 @@ var _NaviosApplication = class _NaviosApplication {
2197
2374
  }
2198
2375
  await this.moduleLoader.loadModules(this.appModule);
2199
2376
  this.server = await this.getFastifyInstance(this.options);
2377
+ this.configureFastifyInstance(this.server);
2200
2378
  getServiceLocator().registerInstance(Application, this.server);
2201
2379
  this.server.setValidatorCompiler(validatorCompiler);
2202
2380
  this.server.setSerializerCompiler(serializerCompiler);
@@ -2204,6 +2382,7 @@ var _NaviosApplication = class _NaviosApplication {
2204
2382
  await this.server.register(cors, this.corsOptions);
2205
2383
  }
2206
2384
  await this.initModules();
2385
+ await this.server.ready();
2207
2386
  this.logger.debug("Navios application initialized");
2208
2387
  }
2209
2388
  async getFastifyInstance(rawOptions) {
@@ -2233,6 +2412,35 @@ var _NaviosApplication = class _NaviosApplication {
2233
2412
  });
2234
2413
  }
2235
2414
  }
2415
+ configureFastifyInstance(fastifyInstance) {
2416
+ fastifyInstance.setErrorHandler((error, request, reply) => {
2417
+ if (error instanceof HttpException) {
2418
+ return reply.status(error.statusCode).send(error.response);
2419
+ } else {
2420
+ const statusCode = error.statusCode || 500;
2421
+ const message = error.message || "Internal Server Error";
2422
+ const response = {
2423
+ statusCode,
2424
+ message,
2425
+ error: error.name || "InternalServerError"
2426
+ };
2427
+ this.logger.error(
2428
+ `Error occurred: ${error.message} on ${request.url}`,
2429
+ error
2430
+ );
2431
+ return reply.status(statusCode).send(response);
2432
+ }
2433
+ });
2434
+ fastifyInstance.setNotFoundHandler((req, reply) => {
2435
+ const response = {
2436
+ statusCode: 404,
2437
+ message: "Not Found",
2438
+ error: "NotFound"
2439
+ };
2440
+ this.logger.error(`Route not found: ${req.url}`);
2441
+ return reply.status(404).send(response);
2442
+ });
2443
+ }
2236
2444
  async initModules() {
2237
2445
  const modules = this.moduleLoader.getAllModules();
2238
2446
  const promises = [];
@@ -2276,12 +2484,13 @@ var _NaviosApplication = class _NaviosApplication {
2276
2484
  if (!this.server) {
2277
2485
  throw new Error("Server is not initialized. Call init() first.");
2278
2486
  }
2279
- await this.server.listen(options);
2487
+ const res = await this.server.listen(options);
2488
+ this.logger.debug(`Navios is listening on ${res}`);
2280
2489
  }
2281
2490
  };
2282
- _init7 = __decoratorStart(null);
2283
- _NaviosApplication = __decorateElement(_init7, 0, "NaviosApplication", _NaviosApplication_decorators, _NaviosApplication);
2284
- __runInitializers(_init7, 1, _NaviosApplication);
2491
+ _init8 = __decoratorStart(null);
2492
+ _NaviosApplication = __decorateElement(_init8, 0, "NaviosApplication", _NaviosApplication_decorators, _NaviosApplication);
2493
+ __runInitializers(_init8, 1, _NaviosApplication);
2285
2494
  var NaviosApplication = _NaviosApplication;
2286
2495
 
2287
2496
  // packages/core/src/navios.factory.mts
@@ -2306,6 +2515,11 @@ export {
2306
2515
  Application,
2307
2516
  AttributeFactory,
2308
2517
  BadRequestException,
2518
+ ConfigProvider,
2519
+ ConfigProviderFactory,
2520
+ ConfigProviderInjectionToken,
2521
+ ConfigProviderOptions,
2522
+ ConfigServiceInstance,
2309
2523
  ConflictException,
2310
2524
  ConsoleLogger,
2311
2525
  Controller,
@@ -2313,6 +2527,7 @@ export {
2313
2527
  ControllerMetadataKey,
2314
2528
  Endpoint,
2315
2529
  EndpointMetadataKey,
2530
+ EndpointType,
2316
2531
  ErrorsEnum,
2317
2532
  EventEmitter,
2318
2533
  ExecutionContext2 as ExecutionContext,
@@ -2321,6 +2536,8 @@ export {
2321
2536
  FactoryNotFound,
2322
2537
  ForbiddenException,
2323
2538
  GuardRunnerService,
2539
+ Header,
2540
+ HttpCode,
2324
2541
  HttpException,
2325
2542
  Injectable,
2326
2543
  InjectableScope,
@@ -2356,6 +2573,8 @@ export {
2356
2573
  UseGuards,
2357
2574
  addLeadingSlash,
2358
2575
  clc,
2576
+ envInt,
2577
+ envString,
2359
2578
  extractControllerMetadata,
2360
2579
  extractModuleMetadata,
2361
2580
  filterLogLevels,
@@ -2380,6 +2599,7 @@ export {
2380
2599
  isString,
2381
2600
  isSymbol,
2382
2601
  isUndefined,
2602
+ makeConfigToken,
2383
2603
  normalizePath,
2384
2604
  override,
2385
2605
  provideServiceLocator,