@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/README.md +8 -4
- package/e2e/endpoints/get.spec.mts +97 -0
- package/e2e/endpoints/post.spec.mts +113 -0
- package/examples/simple-test/api/index.mts +2 -2
- package/examples/simple-test/src/acl/public.attribute.mts +1 -1
- package/lib/_tsup-dts-rollup.d.mts +22 -54
- package/lib/_tsup-dts-rollup.d.ts +22 -54
- package/lib/index.js +21 -17
- package/lib/index.js.map +1 -1
- package/lib/index.mjs +13 -9
- package/lib/index.mjs.map +1 -1
- package/package.json +13 -11
- package/project.json +8 -3
- package/src/__tests__/config.service.spec.mts +1 -1
- package/src/__tests__/controller.spec.mts +2 -2
- package/src/adapters/endpoint-adapter.service.mts +1 -1
- package/src/adapters/multipart-adapter.service.mts +12 -8
- package/src/adapters/stream-adapter.service.mts +1 -1
- package/src/attribute.factory.mts +1 -1
- package/src/config/config.provider.mts +2 -2
- package/src/config/config.service.mts +3 -3
- package/src/decorators/endpoint.decorator.mts +9 -10
- package/src/decorators/multipart.decorator.mts +5 -5
- package/src/decorators/stream.decorator.mts +4 -4
- package/src/logger/logger.factory.mts +1 -1
- package/src/metadata/handler.metadata.mts +1 -1
- package/tsconfig.json +7 -2
- package/tsconfig.lib.json +8 -0
- package/tsconfig.spec.json +12 -0
- package/tsup.config.mts +1 -0
package/lib/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { InjectionToken, Injectable, InjectableType, getGlobalServiceLocator, inject, syncInject, InjectableScope } from '@navios/di';
|
|
2
2
|
export * from '@navios/di';
|
|
3
|
-
import { z, ZodOptional, ZodArray, ZodObject } from 'zod';
|
|
4
|
-
import { env } from '
|
|
5
|
-
import { NaviosException } from '@navios/
|
|
3
|
+
import { z, ZodOptional, ZodArray, ZodObject } from 'zod/v4';
|
|
4
|
+
import { env } from 'process';
|
|
5
|
+
import { NaviosException } from '@navios/builder';
|
|
6
6
|
import { inspect } from 'util';
|
|
7
7
|
import cors from '@fastify/cors';
|
|
8
8
|
import multipart from '@fastify/multipart';
|
|
@@ -178,7 +178,7 @@ var MultipartAdapterService = class extends (_a2 = EndpointAdapterService) {
|
|
|
178
178
|
});
|
|
179
179
|
}
|
|
180
180
|
const requestSchema = config.requestSchema;
|
|
181
|
-
const shape = requestSchema.
|
|
181
|
+
const shape = requestSchema._zod.def.shape;
|
|
182
182
|
const structure = this.analyzeSchema(shape);
|
|
183
183
|
getters.push(async (target, request) => {
|
|
184
184
|
const req = {};
|
|
@@ -196,9 +196,13 @@ var MultipartAdapterService = class extends (_a2 = EndpointAdapterService) {
|
|
|
196
196
|
}
|
|
197
197
|
let value;
|
|
198
198
|
if (part.type === "file") {
|
|
199
|
-
value = new File(
|
|
200
|
-
|
|
201
|
-
|
|
199
|
+
value = new File(
|
|
200
|
+
[await part.toBuffer()],
|
|
201
|
+
part.filename,
|
|
202
|
+
{
|
|
203
|
+
type: part.mimetype
|
|
204
|
+
}
|
|
205
|
+
);
|
|
202
206
|
} else {
|
|
203
207
|
value = part.value;
|
|
204
208
|
if (isObject2 && typeof value === "string") {
|
|
@@ -1365,7 +1369,7 @@ var PinoWrapper = class _PinoWrapper {
|
|
|
1365
1369
|
};
|
|
1366
1370
|
|
|
1367
1371
|
// src/config/config.service.mts
|
|
1368
|
-
var ConfigServiceOptionsSchema = z.record(z.unknown());
|
|
1372
|
+
var ConfigServiceOptionsSchema = z.record(z.string(), z.unknown());
|
|
1369
1373
|
var ConfigServiceToken = InjectionToken.create(Symbol.for("ConfigService"), ConfigServiceOptionsSchema);
|
|
1370
1374
|
var _ConfigService_decorators, _init10;
|
|
1371
1375
|
_ConfigService_decorators = [Injectable({
|
|
@@ -1421,7 +1425,7 @@ var ConfigService = _ConfigService;
|
|
|
1421
1425
|
|
|
1422
1426
|
// src/config/config.provider.mts
|
|
1423
1427
|
var ConfigProviderOptions = z.object({
|
|
1424
|
-
load: z.function(
|
|
1428
|
+
load: z.function({ output: ConfigServiceOptionsSchema })
|
|
1425
1429
|
});
|
|
1426
1430
|
function provideConfig(options) {
|
|
1427
1431
|
return InjectionToken.factory(ConfigServiceToken, async () => options.load());
|