@navios/core 0.1.9 → 0.1.10
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/_tsup-dts-rollup.d.mts +27 -0
- package/dist/_tsup-dts-rollup.d.ts +27 -0
- package/dist/chunk-Z2AVZ4BT.mjs +65 -0
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3297 -48
- package/dist/index.mjs +135 -48
- package/dist/multipart-23QO76VV.mjs +3120 -0
- package/package.json +4 -3
- package/src/decorators/index.mts +1 -0
- package/src/decorators/multipart.decorator.mts +100 -0
- package/src/metadata/endpoint.metadata.mts +1 -0
- package/src/navios.application.mts +30 -0
- package/src/services/controller-adapter.service.mts +84 -1
|
@@ -6,6 +6,7 @@ import { FastifyBaseLogger } from 'fastify';
|
|
|
6
6
|
import type { FastifyCorsOptions } from '@fastify/cors';
|
|
7
7
|
import type { FastifyInstance } from 'fastify';
|
|
8
8
|
import type { FastifyListenOptions } from 'fastify';
|
|
9
|
+
import type { FastifyMultipartOptions } from '@fastify/multipart';
|
|
9
10
|
import type { FastifyReply } from 'fastify';
|
|
10
11
|
import type { FastifyRequest } from 'fastify';
|
|
11
12
|
import { FastifySchema } from 'fastify';
|
|
@@ -381,6 +382,7 @@ declare class ControllerAdapterService {
|
|
|
381
382
|
private provideHandler;
|
|
382
383
|
private provideHandlerForConfig;
|
|
383
384
|
private provideHandlerForStream;
|
|
385
|
+
private provideHandlerForMultipart;
|
|
384
386
|
}
|
|
385
387
|
export { ControllerAdapterService }
|
|
386
388
|
export { ControllerAdapterService as ControllerAdapterService_alias_1 }
|
|
@@ -452,6 +454,7 @@ declare enum EndpointType {
|
|
|
452
454
|
Unknown = "unknown",
|
|
453
455
|
Endpoint = "endpoint",
|
|
454
456
|
Stream = "stream",
|
|
457
|
+
Multipart = "multipart",
|
|
455
458
|
Handler = "handler"
|
|
456
459
|
}
|
|
457
460
|
export { EndpointType }
|
|
@@ -1135,12 +1138,34 @@ export { ModuleOptions }
|
|
|
1135
1138
|
export { ModuleOptions as ModuleOptions_alias_1 }
|
|
1136
1139
|
export { ModuleOptions as ModuleOptions_alias_2 }
|
|
1137
1140
|
|
|
1141
|
+
declare function Multipart<Method extends HttpMethod = HttpMethod, Url extends string = string, QuerySchema = undefined, ResponseSchema extends ZodType = ZodType, RequestSchema = ZodType>(endpoint: {
|
|
1142
|
+
config: BaseEndpointConfig<Method, Url, QuerySchema, ResponseSchema, RequestSchema>;
|
|
1143
|
+
}): (target: (params: QuerySchema extends AnyZodObject ? RequestSchema extends ZodType ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema> : EndpointFunctionArgs<Url, QuerySchema, undefined> : RequestSchema extends ZodType ? EndpointFunctionArgs<Url, undefined, RequestSchema> : EndpointFunctionArgs<Url, undefined, undefined>) => Promise<z.input<ResponseSchema>>, context: ClassMethodDecoratorContext) => (params: QuerySchema extends AnyZodObject ? RequestSchema extends ZodType ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema> : EndpointFunctionArgs<Url, QuerySchema, undefined> : RequestSchema extends ZodType ? EndpointFunctionArgs<Url, undefined, RequestSchema> : EndpointFunctionArgs<Url, undefined, undefined>) => Promise<z.input<ResponseSchema>>;
|
|
1144
|
+
export { Multipart }
|
|
1145
|
+
export { Multipart as Multipart_alias_1 }
|
|
1146
|
+
export { Multipart as Multipart_alias_2 }
|
|
1147
|
+
|
|
1148
|
+
declare type MultipartParams<EndpointDeclaration extends {
|
|
1149
|
+
config: BaseEndpointConfig<any, any, any, any, any>;
|
|
1150
|
+
}, Url extends string = EndpointDeclaration['config']['url'], QuerySchema = EndpointDeclaration['config']['querySchema']> = QuerySchema extends AnyZodObject ? EndpointDeclaration['config']['requestSchema'] extends ZodType ? EndpointFunctionArgs<Url, QuerySchema, EndpointDeclaration['config']['requestSchema']> : EndpointFunctionArgs<Url, QuerySchema, undefined> : EndpointDeclaration['config']['requestSchema'] extends ZodType ? EndpointFunctionArgs<Url, undefined, EndpointDeclaration['config']['requestSchema']> : EndpointFunctionArgs<Url, undefined, undefined>;
|
|
1151
|
+
export { MultipartParams }
|
|
1152
|
+
export { MultipartParams as MultipartParams_alias_1 }
|
|
1153
|
+
export { MultipartParams as MultipartParams_alias_2 }
|
|
1154
|
+
|
|
1155
|
+
declare type MultipartResult<EndpointDeclaration extends {
|
|
1156
|
+
config: BaseEndpointConfig<any, any, any, any, any>;
|
|
1157
|
+
}> = EndpointDeclaration['config']['responseSchema'] extends ZodDiscriminatedUnion<any, infer Options> ? Promise<z.input<Options[number]>> : Promise<z.input<EndpointDeclaration['config']['responseSchema']>>;
|
|
1158
|
+
export { MultipartResult }
|
|
1159
|
+
export { MultipartResult as MultipartResult_alias_1 }
|
|
1160
|
+
export { MultipartResult as MultipartResult_alias_2 }
|
|
1161
|
+
|
|
1138
1162
|
declare class NaviosApplication {
|
|
1139
1163
|
private moduleLoader;
|
|
1140
1164
|
private controllerAdapter;
|
|
1141
1165
|
private logger;
|
|
1142
1166
|
private server;
|
|
1143
1167
|
private corsOptions;
|
|
1168
|
+
private multipartOptions;
|
|
1144
1169
|
private globalPrefix;
|
|
1145
1170
|
private appModule;
|
|
1146
1171
|
private options;
|
|
@@ -1149,8 +1174,10 @@ declare class NaviosApplication {
|
|
|
1149
1174
|
init(): Promise<void>;
|
|
1150
1175
|
private getFastifyInstance;
|
|
1151
1176
|
private configureFastifyInstance;
|
|
1177
|
+
configureMultipart(server: FastifyInstance, options: FastifyMultipartOptions | true): Promise<void>;
|
|
1152
1178
|
private initModules;
|
|
1153
1179
|
enableCors(options: FastifyCorsOptions): void;
|
|
1180
|
+
enableMultipart(options: FastifyMultipartOptions): void;
|
|
1154
1181
|
setGlobalPrefix(prefix: string): void;
|
|
1155
1182
|
getServer(): FastifyInstance;
|
|
1156
1183
|
listen(options: FastifyListenOptions): Promise<void>;
|
|
@@ -6,6 +6,7 @@ import { FastifyBaseLogger } from 'fastify';
|
|
|
6
6
|
import type { FastifyCorsOptions } from '@fastify/cors';
|
|
7
7
|
import type { FastifyInstance } from 'fastify';
|
|
8
8
|
import type { FastifyListenOptions } from 'fastify';
|
|
9
|
+
import type { FastifyMultipartOptions } from '@fastify/multipart';
|
|
9
10
|
import type { FastifyReply } from 'fastify';
|
|
10
11
|
import type { FastifyRequest } from 'fastify';
|
|
11
12
|
import { FastifySchema } from 'fastify';
|
|
@@ -381,6 +382,7 @@ declare class ControllerAdapterService {
|
|
|
381
382
|
private provideHandler;
|
|
382
383
|
private provideHandlerForConfig;
|
|
383
384
|
private provideHandlerForStream;
|
|
385
|
+
private provideHandlerForMultipart;
|
|
384
386
|
}
|
|
385
387
|
export { ControllerAdapterService }
|
|
386
388
|
export { ControllerAdapterService as ControllerAdapterService_alias_1 }
|
|
@@ -452,6 +454,7 @@ declare enum EndpointType {
|
|
|
452
454
|
Unknown = "unknown",
|
|
453
455
|
Endpoint = "endpoint",
|
|
454
456
|
Stream = "stream",
|
|
457
|
+
Multipart = "multipart",
|
|
455
458
|
Handler = "handler"
|
|
456
459
|
}
|
|
457
460
|
export { EndpointType }
|
|
@@ -1135,12 +1138,34 @@ export { ModuleOptions }
|
|
|
1135
1138
|
export { ModuleOptions as ModuleOptions_alias_1 }
|
|
1136
1139
|
export { ModuleOptions as ModuleOptions_alias_2 }
|
|
1137
1140
|
|
|
1141
|
+
declare function Multipart<Method extends HttpMethod = HttpMethod, Url extends string = string, QuerySchema = undefined, ResponseSchema extends ZodType = ZodType, RequestSchema = ZodType>(endpoint: {
|
|
1142
|
+
config: BaseEndpointConfig<Method, Url, QuerySchema, ResponseSchema, RequestSchema>;
|
|
1143
|
+
}): (target: (params: QuerySchema extends AnyZodObject ? RequestSchema extends ZodType ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema> : EndpointFunctionArgs<Url, QuerySchema, undefined> : RequestSchema extends ZodType ? EndpointFunctionArgs<Url, undefined, RequestSchema> : EndpointFunctionArgs<Url, undefined, undefined>) => Promise<z.input<ResponseSchema>>, context: ClassMethodDecoratorContext) => (params: QuerySchema extends AnyZodObject ? RequestSchema extends ZodType ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema> : EndpointFunctionArgs<Url, QuerySchema, undefined> : RequestSchema extends ZodType ? EndpointFunctionArgs<Url, undefined, RequestSchema> : EndpointFunctionArgs<Url, undefined, undefined>) => Promise<z.input<ResponseSchema>>;
|
|
1144
|
+
export { Multipart }
|
|
1145
|
+
export { Multipart as Multipart_alias_1 }
|
|
1146
|
+
export { Multipart as Multipart_alias_2 }
|
|
1147
|
+
|
|
1148
|
+
declare type MultipartParams<EndpointDeclaration extends {
|
|
1149
|
+
config: BaseEndpointConfig<any, any, any, any, any>;
|
|
1150
|
+
}, Url extends string = EndpointDeclaration['config']['url'], QuerySchema = EndpointDeclaration['config']['querySchema']> = QuerySchema extends AnyZodObject ? EndpointDeclaration['config']['requestSchema'] extends ZodType ? EndpointFunctionArgs<Url, QuerySchema, EndpointDeclaration['config']['requestSchema']> : EndpointFunctionArgs<Url, QuerySchema, undefined> : EndpointDeclaration['config']['requestSchema'] extends ZodType ? EndpointFunctionArgs<Url, undefined, EndpointDeclaration['config']['requestSchema']> : EndpointFunctionArgs<Url, undefined, undefined>;
|
|
1151
|
+
export { MultipartParams }
|
|
1152
|
+
export { MultipartParams as MultipartParams_alias_1 }
|
|
1153
|
+
export { MultipartParams as MultipartParams_alias_2 }
|
|
1154
|
+
|
|
1155
|
+
declare type MultipartResult<EndpointDeclaration extends {
|
|
1156
|
+
config: BaseEndpointConfig<any, any, any, any, any>;
|
|
1157
|
+
}> = EndpointDeclaration['config']['responseSchema'] extends ZodDiscriminatedUnion<any, infer Options> ? Promise<z.input<Options[number]>> : Promise<z.input<EndpointDeclaration['config']['responseSchema']>>;
|
|
1158
|
+
export { MultipartResult }
|
|
1159
|
+
export { MultipartResult as MultipartResult_alias_1 }
|
|
1160
|
+
export { MultipartResult as MultipartResult_alias_2 }
|
|
1161
|
+
|
|
1138
1162
|
declare class NaviosApplication {
|
|
1139
1163
|
private moduleLoader;
|
|
1140
1164
|
private controllerAdapter;
|
|
1141
1165
|
private logger;
|
|
1142
1166
|
private server;
|
|
1143
1167
|
private corsOptions;
|
|
1168
|
+
private multipartOptions;
|
|
1144
1169
|
private globalPrefix;
|
|
1145
1170
|
private appModule;
|
|
1146
1171
|
private options;
|
|
@@ -1149,8 +1174,10 @@ declare class NaviosApplication {
|
|
|
1149
1174
|
init(): Promise<void>;
|
|
1150
1175
|
private getFastifyInstance;
|
|
1151
1176
|
private configureFastifyInstance;
|
|
1177
|
+
configureMultipart(server: FastifyInstance, options: FastifyMultipartOptions | true): Promise<void>;
|
|
1152
1178
|
private initModules;
|
|
1153
1179
|
enableCors(options: FastifyCorsOptions): void;
|
|
1180
|
+
enableMultipart(options: FastifyMultipartOptions): void;
|
|
1154
1181
|
setGlobalPrefix(prefix: string): void;
|
|
1155
1182
|
getServer(): FastifyInstance;
|
|
1156
1183
|
listen(options: FastifyListenOptions): Promise<void>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __knownSymbol = (name, symbol) => (symbol = Symbol[name]) ? symbol : Symbol.for("Symbol." + name);
|
|
6
|
+
var __typeError = (msg) => {
|
|
7
|
+
throw TypeError(msg);
|
|
8
|
+
};
|
|
9
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
10
|
+
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
11
|
+
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
|
|
12
|
+
get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
|
|
13
|
+
}) : x)(function(x) {
|
|
14
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
15
|
+
throw Error('Dynamic require of "' + x + '" is not supported');
|
|
16
|
+
});
|
|
17
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
18
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
19
|
+
};
|
|
20
|
+
var __decoratorStart = (base) => [, , , __create((base == null ? void 0 : base[__knownSymbol("metadata")]) ?? null)];
|
|
21
|
+
var __decoratorStrings = ["class", "method", "getter", "setter", "accessor", "field", "value", "get", "set"];
|
|
22
|
+
var __expectFn = (fn) => fn !== void 0 && typeof fn !== "function" ? __typeError("Function expected") : fn;
|
|
23
|
+
var __decoratorContext = (kind, name, done, metadata, fns) => ({ kind: __decoratorStrings[kind], name, metadata, addInitializer: (fn) => done._ ? __typeError("Already initialized") : fns.push(__expectFn(fn || null)) });
|
|
24
|
+
var __decoratorMetadata = (array, target) => __defNormalProp(target, __knownSymbol("metadata"), array[3]);
|
|
25
|
+
var __runInitializers = (array, flags, self, value) => {
|
|
26
|
+
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
|
+
return value;
|
|
28
|
+
};
|
|
29
|
+
var __decorateElement = (array, flags, name, decorators, target, extra) => {
|
|
30
|
+
var fn, it, done, ctx, access, k = flags & 7, s = !!(flags & 8), p = !!(flags & 16);
|
|
31
|
+
var j = k > 3 ? array.length + 1 : k ? s ? 1 : 2 : 0, key = __decoratorStrings[k + 5];
|
|
32
|
+
var initializers = k > 3 && (array[j - 1] = []), extraInitializers = array[j] || (array[j] = []);
|
|
33
|
+
var desc = k && (!p && !s && (target = target.prototype), k < 5 && (k > 3 || !p) && __getOwnPropDesc(k < 4 ? target : { get [name]() {
|
|
34
|
+
return __privateGet(this, extra);
|
|
35
|
+
}, set [name](x) {
|
|
36
|
+
return __privateSet(this, extra, x);
|
|
37
|
+
} }, name));
|
|
38
|
+
k ? p && k < 4 && __name(extra, (k > 2 ? "set " : k > 1 ? "get " : "") + name) : __name(target, name);
|
|
39
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
40
|
+
ctx = __decoratorContext(k, name, done = {}, array[3], extraInitializers);
|
|
41
|
+
if (k) {
|
|
42
|
+
ctx.static = s, ctx.private = p, access = ctx.access = { has: p ? (x) => __privateIn(target, x) : (x) => name in x };
|
|
43
|
+
if (k ^ 3) access.get = p ? (x) => (k ^ 1 ? __privateGet : __privateMethod)(x, target, k ^ 4 ? extra : desc.get) : (x) => x[name];
|
|
44
|
+
if (k > 2) access.set = p ? (x, y) => __privateSet(x, target, y, k ^ 4 ? extra : desc.set) : (x, y) => x[name] = y;
|
|
45
|
+
}
|
|
46
|
+
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;
|
|
47
|
+
if (k ^ 4 || it === void 0) __expectFn(it) && (k > 4 ? initializers.unshift(it) : k ? p ? extra = it : desc[key] = it : target = it);
|
|
48
|
+
else if (typeof it !== "object" || it === null) __typeError("Object expected");
|
|
49
|
+
else __expectFn(fn = it.get) && (desc.get = fn), __expectFn(fn = it.set) && (desc.set = fn), __expectFn(fn = it.init) && initializers.unshift(fn);
|
|
50
|
+
}
|
|
51
|
+
return k || __decoratorMetadata(array, target), desc && __defProp(target, name, desc), p ? k ^ 4 ? extra : desc : target;
|
|
52
|
+
};
|
|
53
|
+
var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
|
|
54
|
+
var __privateIn = (member, obj) => Object(obj) !== obj ? __typeError('Cannot use the "in" operator on this value') : member.has(obj);
|
|
55
|
+
var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
|
|
56
|
+
var __privateSet = (obj, member, value, setter) => (__accessCheck(obj, member, "write to private field"), setter ? setter.call(obj, value) : member.set(obj, value), value);
|
|
57
|
+
var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "access private method"), method);
|
|
58
|
+
|
|
59
|
+
export {
|
|
60
|
+
__require,
|
|
61
|
+
__commonJS,
|
|
62
|
+
__decoratorStart,
|
|
63
|
+
__runInitializers,
|
|
64
|
+
__decorateElement
|
|
65
|
+
};
|
package/dist/index.d.mts
CHANGED
|
@@ -19,6 +19,9 @@ export { Header } from './_tsup-dts-rollup.mjs';
|
|
|
19
19
|
export { HttpCode } from './_tsup-dts-rollup.mjs';
|
|
20
20
|
export { Module } from './_tsup-dts-rollup.mjs';
|
|
21
21
|
export { ModuleOptions } from './_tsup-dts-rollup.mjs';
|
|
22
|
+
export { Multipart } from './_tsup-dts-rollup.mjs';
|
|
23
|
+
export { MultipartParams } from './_tsup-dts-rollup.mjs';
|
|
24
|
+
export { MultipartResult } from './_tsup-dts-rollup.mjs';
|
|
22
25
|
export { Stream } from './_tsup-dts-rollup.mjs';
|
|
23
26
|
export { StreamParams } from './_tsup-dts-rollup.mjs';
|
|
24
27
|
export { UseGuards } from './_tsup-dts-rollup.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -19,6 +19,9 @@ export { Header } from './_tsup-dts-rollup.js';
|
|
|
19
19
|
export { HttpCode } from './_tsup-dts-rollup.js';
|
|
20
20
|
export { Module } from './_tsup-dts-rollup.js';
|
|
21
21
|
export { ModuleOptions } from './_tsup-dts-rollup.js';
|
|
22
|
+
export { Multipart } from './_tsup-dts-rollup.js';
|
|
23
|
+
export { MultipartParams } from './_tsup-dts-rollup.js';
|
|
24
|
+
export { MultipartResult } from './_tsup-dts-rollup.js';
|
|
22
25
|
export { Stream } from './_tsup-dts-rollup.js';
|
|
23
26
|
export { StreamParams } from './_tsup-dts-rollup.js';
|
|
24
27
|
export { UseGuards } from './_tsup-dts-rollup.js';
|