@navios/core 0.2.2 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  'use strict';
2
2
 
3
3
  var di = require('@navios/di');
4
- var zod = require('zod');
4
+ var v4 = require('zod/v4');
5
5
  var process$1 = require('process');
6
- var common = require('@navios/common');
6
+ var builder = require('@navios/builder');
7
7
  var util = require('util');
8
8
  var cors = require('@fastify/cors');
9
9
  var multipart = require('@fastify/multipart');
@@ -184,7 +184,7 @@ exports.MultipartAdapterService = class MultipartAdapterService extends (_a2 = e
184
184
  });
185
185
  }
186
186
  const requestSchema = config.requestSchema;
187
- const shape = requestSchema._def.shape();
187
+ const shape = requestSchema._zod.def.shape;
188
188
  const structure = this.analyzeSchema(shape);
189
189
  getters.push(async (target, request) => {
190
190
  const req = {};
@@ -202,9 +202,13 @@ exports.MultipartAdapterService = class MultipartAdapterService extends (_a2 = e
202
202
  }
203
203
  let value;
204
204
  if (part.type === "file") {
205
- value = new File([await part.toBuffer()], part.filename, {
206
- type: part.mimetype
207
- });
205
+ value = new File(
206
+ [await part.toBuffer()],
207
+ part.filename,
208
+ {
209
+ type: part.mimetype
210
+ }
211
+ );
208
212
  } else {
209
213
  value = part.value;
210
214
  if (isObject2 && typeof value === "string") {
@@ -221,15 +225,15 @@ exports.MultipartAdapterService = class MultipartAdapterService extends (_a2 = e
221
225
  return Object.keys(shape).reduce(
222
226
  (target, key) => {
223
227
  let schema = shape[key];
224
- const isOptional = schema instanceof zod.ZodOptional;
228
+ const isOptional = schema instanceof v4.ZodOptional;
225
229
  if (isOptional) {
226
230
  schema = schema.unwrap();
227
231
  }
228
- const isArray = schema instanceof zod.ZodArray;
232
+ const isArray = schema instanceof v4.ZodArray;
229
233
  if (isArray) {
230
234
  schema = schema.element;
231
235
  }
232
- const isObject2 = schema instanceof zod.ZodObject;
236
+ const isObject2 = schema instanceof v4.ZodObject;
233
237
  return {
234
238
  ...target,
235
239
  [key]: {
@@ -1299,10 +1303,10 @@ var LoggerInstance = _LoggerInstance;
1299
1303
 
1300
1304
  // src/logger/logger.factory.mts
1301
1305
  var LoggerInjectionToken = "LoggerInjectionToken";
1302
- var LoggerOptions = zod.z.object({
1303
- context: zod.z.string().optional(),
1304
- options: zod.z.object({
1305
- timestamp: zod.z.boolean().optional()
1306
+ var LoggerOptions = v4.z.object({
1307
+ context: v4.z.string().optional(),
1308
+ options: v4.z.object({
1309
+ timestamp: v4.z.boolean().optional()
1306
1310
  }).optional()
1307
1311
  }).optional();
1308
1312
  var Logger = di.InjectionToken.create(LoggerInjectionToken, LoggerOptions);
@@ -1371,7 +1375,7 @@ var PinoWrapper = class _PinoWrapper {
1371
1375
  };
1372
1376
 
1373
1377
  // src/config/config.service.mts
1374
- var ConfigServiceOptionsSchema = zod.z.record(zod.z.unknown());
1378
+ var ConfigServiceOptionsSchema = v4.z.record(v4.z.string(), v4.z.unknown());
1375
1379
  var ConfigServiceToken = di.InjectionToken.create(Symbol.for("ConfigService"), ConfigServiceOptionsSchema);
1376
1380
  var _ConfigService_decorators, _init10;
1377
1381
  _ConfigService_decorators = [di.Injectable({
@@ -1415,7 +1419,7 @@ var _ConfigService = class _ConfigService {
1415
1419
  if (value === null) {
1416
1420
  const message = errorMessage || `Configuration value for key "${String(key)}" is not defined`;
1417
1421
  this.logger.error(message);
1418
- throw new common.NaviosException(message);
1422
+ throw new builder.NaviosException(message);
1419
1423
  }
1420
1424
  return value;
1421
1425
  }
@@ -1426,8 +1430,8 @@ __runInitializers(_init10, 1, _ConfigService);
1426
1430
  var ConfigService = _ConfigService;
1427
1431
 
1428
1432
  // src/config/config.provider.mts
1429
- var ConfigProviderOptions = zod.z.object({
1430
- load: zod.z.function().returns(ConfigServiceOptionsSchema)
1433
+ var ConfigProviderOptions = v4.z.object({
1434
+ load: v4.z.function({ output: ConfigServiceOptionsSchema })
1431
1435
  });
1432
1436
  function provideConfig(options) {
1433
1437
  return di.InjectionToken.factory(ConfigServiceToken, async () => options.load());