@navios/core 1.0.0-alpha.2 → 1.0.0-alpha.4
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/CHANGELOG.md +90 -0
- package/lib/{index-BJjk2X1S.d.mts → index-6S7veHKD.d.mts} +845 -294
- package/lib/index-6S7veHKD.d.mts.map +1 -0
- package/lib/{index-DZ6NU03y.d.cts → index-r0i2txmg.d.cts} +845 -294
- package/lib/index-r0i2txmg.d.cts.map +1 -0
- package/lib/index.cjs +4420 -84
- package/lib/index.cjs.map +1 -0
- package/lib/index.d.cts +2 -2
- package/lib/index.d.mts +2 -2
- package/lib/index.mjs +4328 -3
- package/lib/index.mjs.map +1 -0
- package/lib/legacy-compat/index.cjs +41 -126
- package/lib/legacy-compat/index.cjs.map +1 -1
- package/lib/legacy-compat/index.d.cts +4 -60
- package/lib/legacy-compat/index.d.cts.map +1 -1
- package/lib/legacy-compat/index.d.mts +4 -60
- package/lib/legacy-compat/index.d.mts.map +1 -1
- package/lib/legacy-compat/index.mjs +14 -119
- package/lib/legacy-compat/index.mjs.map +1 -1
- package/lib/navios.factory-BanZIvtR.cjs +4134 -0
- package/lib/navios.factory-BanZIvtR.cjs.map +1 -0
- package/lib/navios.factory-C75yZCoD.mjs +3831 -0
- package/lib/navios.factory-C75yZCoD.mjs.map +1 -0
- package/lib/testing/index.cjs +3 -3
- package/lib/testing/index.cjs.map +1 -1
- package/lib/testing/index.d.cts +1 -1
- package/lib/testing/index.d.mts +1 -1
- package/lib/testing/index.mjs +2 -2
- package/lib/tokens-4J9sredA.mjs +100 -0
- package/lib/tokens-4J9sredA.mjs.map +1 -0
- package/lib/tokens-BuXXB01L.cjs +196 -0
- package/lib/tokens-BuXXB01L.cjs.map +1 -0
- package/lib/{use-guards.decorator-Be_QUx6b.mjs → use-guards.decorator-BecoQSmE.mjs} +3 -70
- package/lib/use-guards.decorator-BecoQSmE.mjs.map +1 -0
- package/lib/{use-guards.decorator-B6tghdxM.cjs → use-guards.decorator-DgD-kxF5.cjs} +7 -158
- package/lib/use-guards.decorator-DgD-kxF5.cjs.map +1 -0
- package/package.json +4 -4
- package/src/__tests__/attribute.factory.spec.mts +300 -0
- package/src/__tests__/console-logger.service.spec.mts +312 -0
- package/src/__tests__/guard-runner.service.spec.mts +399 -0
- package/src/__tests__/logger.service.spec.mts +147 -0
- package/src/__tests__/responders.spec.mts +6 -5
- package/src/factories/adapter.factory.mts +20 -0
- package/src/factories/endpoint-adapter.factory.mts +1 -1
- package/src/factories/http-adapter.factory.mts +1 -1
- package/src/factories/index.mts +1 -0
- package/src/factories/multipart-adapter.factory.mts +1 -1
- package/src/factories/reply.factory.mts +1 -1
- package/src/factories/request.factory.mts +1 -1
- package/src/factories/stream-adapter.factory.mts +1 -1
- package/src/factories/xml-stream-adapter.factory.mts +1 -1
- package/src/index.mts +1 -0
- package/src/interfaces/abstract-adapter.interface.mts +32 -0
- package/src/interfaces/abstract-http-adapter.interface.mts +27 -20
- package/src/interfaces/abstract-http-handler-adapter.interface.mts +86 -2
- package/src/interfaces/adapter-environment.interface.mts +74 -0
- package/src/interfaces/index.mts +2 -0
- package/src/interfaces/plugin.interface.mts +50 -16
- package/src/legacy-compat/attribute.factory.mts +2 -2
- package/src/legacy-compat/decorators/controller.decorator.mts +1 -1
- package/src/legacy-compat/decorators/endpoint.decorator.mts +1 -1
- package/src/legacy-compat/decorators/header.decorator.mts +2 -1
- package/src/legacy-compat/decorators/http-code.decorator.mts +2 -1
- package/src/legacy-compat/decorators/index.mts +2 -2
- package/src/legacy-compat/decorators/module.decorator.mts +1 -1
- package/src/legacy-compat/decorators/multipart.decorator.mts +1 -1
- package/src/legacy-compat/decorators/stream.decorator.mts +1 -1
- package/src/legacy-compat/decorators/use-guards.decorator.mts +1 -1
- package/src/legacy-compat/index.mts +10 -5
- package/src/logger/console-logger.service.mts +97 -7
- package/src/metadata/module.metadata.mts +43 -0
- package/src/navios.application.mts +172 -60
- package/src/navios.environment.mts +22 -12
- package/src/navios.factory.mts +31 -10
- package/src/services/abstract-handler-adapter.service.mts +366 -0
- package/src/services/index.mts +1 -0
- package/src/services/module-loader.service.mts +1 -0
- package/src/tokens/adapter.token.mts +6 -0
- package/src/tokens/http-adapter.token.mts +1 -1
- package/src/tokens/index.mts +1 -0
- package/src/utils/adapter-supports.util.mts +47 -0
- package/src/utils/index.mts +1 -0
- package/lib/index-BJjk2X1S.d.mts.map +0 -1
- package/lib/index-DZ6NU03y.d.cts.map +0 -1
- package/lib/src-C46ePe3d.cjs +0 -8022
- package/lib/src-C46ePe3d.cjs.map +0 -1
- package/lib/src-K2k0riYJ.mjs +0 -7587
- package/lib/src-K2k0riYJ.mjs.map +0 -1
- package/lib/use-guards.decorator-B6tghdxM.cjs.map +0 -1
- package/lib/use-guards.decorator-Be_QUx6b.mjs.map +0 -1
- package/src/legacy-compat/context-compat.mts +0 -95
- package/src/legacy-compat/decorators/factory.decorator.mts +0 -37
- package/src/legacy-compat/decorators/injectable.decorator.mts +0 -41
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ClassType, ClassTypeWithInstance,
|
|
1
|
+
import { Bn as ControllerOptions, Dn as ControllerMetadata, Et as HttpHeader, Ln as EndpointParams, Nn as HandlerMetadata, Ot as CanActivate, Rn as EndpointResult, _t as ModuleOptions, ft as StreamParams, ht as MultipartResult, mt as MultipartParams, xn as ModuleMetadata } from "../index-r0i2txmg.cjs";
|
|
2
|
+
import { ClassType, ClassTypeWithInstance, InjectionToken } from "@navios/di";
|
|
3
3
|
import { ZodType, z as z$1 } from "zod/v4";
|
|
4
4
|
import { BaseEndpointOptions, EndpointHandler, EndpointOptions, RequestArgs, StreamHandler } from "@navios/builder";
|
|
5
|
+
import { Factory, FactoryOptions, Injectable, InjectableOptions, createClassContext, createMethodContext } from "@navios/di/legacy-compat";
|
|
5
6
|
|
|
6
7
|
//#region src/legacy-compat/decorators/module.decorator.d.mts
|
|
7
8
|
|
|
@@ -210,48 +211,6 @@ type StreamMethodDescriptor<Config extends BaseEndpointOptions> = TypedPropertyD
|
|
|
210
211
|
*/
|
|
211
212
|
declare function Stream<const Config extends BaseEndpointOptions>(endpoint: StreamHandler<Config, false>): (target: any, propertyKey: string | symbol, descriptor: StreamMethodDescriptor<Config>) => PropertyDescriptor | void;
|
|
212
213
|
//#endregion
|
|
213
|
-
//#region src/legacy-compat/decorators/injectable.decorator.d.mts
|
|
214
|
-
/**
|
|
215
|
-
* Legacy-compatible Injectable decorator.
|
|
216
|
-
*
|
|
217
|
-
* Works with TypeScript experimental decorators (legacy API).
|
|
218
|
-
*
|
|
219
|
-
* @param options - Injectable configuration options
|
|
220
|
-
* @returns A class decorator compatible with legacy decorator API
|
|
221
|
-
*
|
|
222
|
-
* @example
|
|
223
|
-
* ```typescript
|
|
224
|
-
* @Injectable()
|
|
225
|
-
* export class UserService {
|
|
226
|
-
* getUser(id: string) {
|
|
227
|
-
* return { id, name: 'John' }
|
|
228
|
-
* }
|
|
229
|
-
* }
|
|
230
|
-
* ```
|
|
231
|
-
*/
|
|
232
|
-
declare function Injectable(options?: InjectableOptions): (target: ClassType) => ClassType;
|
|
233
|
-
//#endregion
|
|
234
|
-
//#region src/legacy-compat/decorators/factory.decorator.d.mts
|
|
235
|
-
/**
|
|
236
|
-
* Legacy-compatible Factory decorator.
|
|
237
|
-
*
|
|
238
|
-
* Works with TypeScript experimental decorators (legacy API).
|
|
239
|
-
*
|
|
240
|
-
* @param options - Factory configuration options
|
|
241
|
-
* @returns A class decorator compatible with legacy decorator API
|
|
242
|
-
*
|
|
243
|
-
* @example
|
|
244
|
-
* ```typescript
|
|
245
|
-
* @Factory()
|
|
246
|
-
* export class DatabaseConnectionFactory {
|
|
247
|
-
* create() {
|
|
248
|
-
* return { host: 'localhost', port: 5432 }
|
|
249
|
-
* }
|
|
250
|
-
* }
|
|
251
|
-
* ```
|
|
252
|
-
*/
|
|
253
|
-
declare function Factory(options?: FactoryOptions): (target: ClassType) => ClassType;
|
|
254
|
-
//#endregion
|
|
255
214
|
//#region src/legacy-compat/attribute.factory.d.mts
|
|
256
215
|
/**
|
|
257
216
|
* Type for a legacy class/method attribute decorator without a value.
|
|
@@ -430,20 +389,5 @@ declare class LegacyAttributeFactory {
|
|
|
430
389
|
static has<T extends ZodType>(attribute: LegacyClassSchemaAttribute<T>, target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>): boolean;
|
|
431
390
|
}
|
|
432
391
|
//#endregion
|
|
433
|
-
|
|
434
|
-
/**
|
|
435
|
-
* Creates a mock ClassDecoratorContext for legacy class decorators.
|
|
436
|
-
* @internal
|
|
437
|
-
*/
|
|
438
|
-
declare function createClassContext(target: ClassType): ClassDecoratorContext;
|
|
439
|
-
/**
|
|
440
|
-
* Creates a mock ClassMethodDecoratorContext for legacy method decorators.
|
|
441
|
-
*
|
|
442
|
-
* Note: Method decorators need to share metadata with the class context
|
|
443
|
-
* because endpoint metadata is stored at the class level.
|
|
444
|
-
* @internal
|
|
445
|
-
*/
|
|
446
|
-
declare function createMethodContext(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): ClassMethodDecoratorContext;
|
|
447
|
-
//#endregion
|
|
448
|
-
export { LegacyAttributeFactory as AttributeFactory, LegacyAttributeFactory, Controller, type ControllerOptions, Endpoint, type EndpointParams, type EndpointResult, Factory, Header, HttpCode, Injectable, type LegacyClassAttribute, type LegacyClassSchemaAttribute, Module, type ModuleOptions, Multipart, type MultipartParams, type MultipartResult, Stream, type StreamParams, UseGuards, createClassContext, createMethodContext };
|
|
392
|
+
export { LegacyAttributeFactory as AttributeFactory, LegacyAttributeFactory, Controller, type ControllerOptions, Endpoint, type EndpointParams, type EndpointResult, Factory, type FactoryOptions, Header, HttpCode, Injectable, type InjectableOptions, type LegacyClassAttribute, type LegacyClassSchemaAttribute, Module, type ModuleOptions, Multipart, type MultipartParams, type MultipartResult, Stream, type StreamParams, UseGuards, createClassContext, createMethodContext };
|
|
449
393
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/legacy-compat/decorators/module.decorator.mts","../../src/legacy-compat/decorators/controller.decorator.mts","../../src/legacy-compat/decorators/endpoint.decorator.mts","../../src/legacy-compat/decorators/use-guards.decorator.mts","../../src/legacy-compat/decorators/header.decorator.mts","../../src/legacy-compat/decorators/http-code.decorator.mts","../../src/legacy-compat/decorators/multipart.decorator.mts","../../src/legacy-compat/decorators/stream.decorator.mts","../../src/legacy-compat/
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../../src/legacy-compat/decorators/module.decorator.mts","../../src/legacy-compat/decorators/controller.decorator.mts","../../src/legacy-compat/decorators/endpoint.decorator.mts","../../src/legacy-compat/decorators/use-guards.decorator.mts","../../src/legacy-compat/decorators/header.decorator.mts","../../src/legacy-compat/decorators/http-code.decorator.mts","../../src/legacy-compat/decorators/multipart.decorator.mts","../../src/legacy-compat/decorators/stream.decorator.mts","../../src/legacy-compat/attribute.factory.mts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;AAuBA;;;;;;;;ACCA;;;;;iBDDgB,MAAA,WACL,yBAMgB,cAAS;;;;;;;;AAPpC;;;;;;;;ACCA;;;;AACoC,iBADpB,UAAA,CACoB,OAAA,CAAA,EADA,iBACA,CAAA,EAAA,CAAA,MAAA,EAAT,SAAS,EAAA,GAAA,SAAA;;;;;;;;ADFpC,KERK,wBFQiB,CAAA,eERuB,eFQvB,CAAA,GEPpB,uBFOoB,CAAA,CAAA,MAAA,EELR,WFKQ,CEJd,MFIc,CAAA,KAAA,CAAA,EEHd,MFGc,CAAA,aAAA,CAAA,EEFd,MFEc,CAAA,eAAA,CAAA,EEDd,MFCc,CAAA,iBAAA,CAAA,EAAA,IAAA,CAAA,EAAA,GEEb,OFFa,CEEL,GAAA,CAAE,KFFG,CEEG,MFFH,CAAA,gBAAA,CAAA,CAAA,CAAA,CAAA;;;;;;;;ACCtB;;;;;;;;AClB+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0BApCK,CAoCsB,CApCtB,CAAA,EAAA,MAAA,EAAA,CAqCP,cArCO,GAqCU,kBArCV,GAqC+B,eArC/B,CAAA,GAAA,CAAA,CAAA,EAAA,CAAA,EAsCf,GAAA,CAAE,MAtCa,CAsCN,CAtCM,CAAA,GAAA,IAAA;EAAT;;;;;;;;;;;;;;EAmEI,OAAA,GAAA,CAAA,SAAA,EAAA,oBAAA,EAAA,MAAA,EACH,cADG,GACc,kBADd,GACmC,eADnC,CAAA,GAAA,CAAA,CAAA,EAAA,OAAA;EACH,OAAA,GAAA,CAAA,UAEW,OAFX,CAAA,CAAA,SAAA,EAGG,0BAHH,CAG8B,CAH9B,CAAA,EAAA,MAAA,EAIA,cAJA,GAIiB,kBAJjB,GAIsC,eAJtC,CAAA,GAAA,CAAA,CAAA,EAAA,OAAA"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { ClassType, ClassTypeWithInstance,
|
|
1
|
+
import { Bn as ControllerOptions, Dn as ControllerMetadata, Et as HttpHeader, Ln as EndpointParams, Nn as HandlerMetadata, Ot as CanActivate, Rn as EndpointResult, _t as ModuleOptions, ft as StreamParams, ht as MultipartResult, mt as MultipartParams, xn as ModuleMetadata } from "../index-6S7veHKD.mjs";
|
|
2
|
+
import { ClassType, ClassTypeWithInstance, InjectionToken } from "@navios/di";
|
|
3
3
|
import { ZodType, z as z$1 } from "zod/v4";
|
|
4
4
|
import { BaseEndpointOptions, EndpointHandler, EndpointOptions, RequestArgs, StreamHandler } from "@navios/builder";
|
|
5
|
+
import { Factory, FactoryOptions, Injectable, InjectableOptions, createClassContext, createMethodContext } from "@navios/di/legacy-compat";
|
|
5
6
|
|
|
6
7
|
//#region src/legacy-compat/decorators/module.decorator.d.mts
|
|
7
8
|
|
|
@@ -210,48 +211,6 @@ type StreamMethodDescriptor<Config extends BaseEndpointOptions> = TypedPropertyD
|
|
|
210
211
|
*/
|
|
211
212
|
declare function Stream<const Config extends BaseEndpointOptions>(endpoint: StreamHandler<Config, false>): (target: any, propertyKey: string | symbol, descriptor: StreamMethodDescriptor<Config>) => PropertyDescriptor | void;
|
|
212
213
|
//#endregion
|
|
213
|
-
//#region src/legacy-compat/decorators/injectable.decorator.d.mts
|
|
214
|
-
/**
|
|
215
|
-
* Legacy-compatible Injectable decorator.
|
|
216
|
-
*
|
|
217
|
-
* Works with TypeScript experimental decorators (legacy API).
|
|
218
|
-
*
|
|
219
|
-
* @param options - Injectable configuration options
|
|
220
|
-
* @returns A class decorator compatible with legacy decorator API
|
|
221
|
-
*
|
|
222
|
-
* @example
|
|
223
|
-
* ```typescript
|
|
224
|
-
* @Injectable()
|
|
225
|
-
* export class UserService {
|
|
226
|
-
* getUser(id: string) {
|
|
227
|
-
* return { id, name: 'John' }
|
|
228
|
-
* }
|
|
229
|
-
* }
|
|
230
|
-
* ```
|
|
231
|
-
*/
|
|
232
|
-
declare function Injectable(options?: InjectableOptions): (target: ClassType) => ClassType;
|
|
233
|
-
//#endregion
|
|
234
|
-
//#region src/legacy-compat/decorators/factory.decorator.d.mts
|
|
235
|
-
/**
|
|
236
|
-
* Legacy-compatible Factory decorator.
|
|
237
|
-
*
|
|
238
|
-
* Works with TypeScript experimental decorators (legacy API).
|
|
239
|
-
*
|
|
240
|
-
* @param options - Factory configuration options
|
|
241
|
-
* @returns A class decorator compatible with legacy decorator API
|
|
242
|
-
*
|
|
243
|
-
* @example
|
|
244
|
-
* ```typescript
|
|
245
|
-
* @Factory()
|
|
246
|
-
* export class DatabaseConnectionFactory {
|
|
247
|
-
* create() {
|
|
248
|
-
* return { host: 'localhost', port: 5432 }
|
|
249
|
-
* }
|
|
250
|
-
* }
|
|
251
|
-
* ```
|
|
252
|
-
*/
|
|
253
|
-
declare function Factory(options?: FactoryOptions): (target: ClassType) => ClassType;
|
|
254
|
-
//#endregion
|
|
255
214
|
//#region src/legacy-compat/attribute.factory.d.mts
|
|
256
215
|
/**
|
|
257
216
|
* Type for a legacy class/method attribute decorator without a value.
|
|
@@ -430,20 +389,5 @@ declare class LegacyAttributeFactory {
|
|
|
430
389
|
static has<T extends ZodType>(attribute: LegacyClassSchemaAttribute<T>, target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>): boolean;
|
|
431
390
|
}
|
|
432
391
|
//#endregion
|
|
433
|
-
|
|
434
|
-
/**
|
|
435
|
-
* Creates a mock ClassDecoratorContext for legacy class decorators.
|
|
436
|
-
* @internal
|
|
437
|
-
*/
|
|
438
|
-
declare function createClassContext(target: ClassType): ClassDecoratorContext;
|
|
439
|
-
/**
|
|
440
|
-
* Creates a mock ClassMethodDecoratorContext for legacy method decorators.
|
|
441
|
-
*
|
|
442
|
-
* Note: Method decorators need to share metadata with the class context
|
|
443
|
-
* because endpoint metadata is stored at the class level.
|
|
444
|
-
* @internal
|
|
445
|
-
*/
|
|
446
|
-
declare function createMethodContext(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): ClassMethodDecoratorContext;
|
|
447
|
-
//#endregion
|
|
448
|
-
export { LegacyAttributeFactory as AttributeFactory, LegacyAttributeFactory, Controller, type ControllerOptions, Endpoint, type EndpointParams, type EndpointResult, Factory, Header, HttpCode, Injectable, type LegacyClassAttribute, type LegacyClassSchemaAttribute, Module, type ModuleOptions, Multipart, type MultipartParams, type MultipartResult, Stream, type StreamParams, UseGuards, createClassContext, createMethodContext };
|
|
392
|
+
export { LegacyAttributeFactory as AttributeFactory, LegacyAttributeFactory, Controller, type ControllerOptions, Endpoint, type EndpointParams, type EndpointResult, Factory, type FactoryOptions, Header, HttpCode, Injectable, type InjectableOptions, type LegacyClassAttribute, type LegacyClassSchemaAttribute, Module, type ModuleOptions, Multipart, type MultipartParams, type MultipartResult, Stream, type StreamParams, UseGuards, createClassContext, createMethodContext };
|
|
449
393
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/legacy-compat/decorators/module.decorator.mts","../../src/legacy-compat/decorators/controller.decorator.mts","../../src/legacy-compat/decorators/endpoint.decorator.mts","../../src/legacy-compat/decorators/use-guards.decorator.mts","../../src/legacy-compat/decorators/header.decorator.mts","../../src/legacy-compat/decorators/http-code.decorator.mts","../../src/legacy-compat/decorators/multipart.decorator.mts","../../src/legacy-compat/decorators/stream.decorator.mts","../../src/legacy-compat/
|
|
1
|
+
{"version":3,"file":"index.d.mts","names":[],"sources":["../../src/legacy-compat/decorators/module.decorator.mts","../../src/legacy-compat/decorators/controller.decorator.mts","../../src/legacy-compat/decorators/endpoint.decorator.mts","../../src/legacy-compat/decorators/use-guards.decorator.mts","../../src/legacy-compat/decorators/header.decorator.mts","../../src/legacy-compat/decorators/http-code.decorator.mts","../../src/legacy-compat/decorators/multipart.decorator.mts","../../src/legacy-compat/decorators/stream.decorator.mts","../../src/legacy-compat/attribute.factory.mts"],"sourcesContent":[],"mappings":";;;;;;;;;;;;;AAuBA;;;;;;;;ACCA;;;;;iBDDgB,MAAA,WACL,yBAMgB,cAAS;;;;;;;;AAPpC;;;;;;;;ACCA;;;;AACoC,iBADpB,UAAA,CACoB,OAAA,CAAA,EADA,iBACA,CAAA,EAAA,CAAA,MAAA,EAAT,SAAS,EAAA,GAAA,SAAA;;;;;;;;ADFpC,KERK,wBFQiB,CAAA,eERuB,eFQvB,CAAA,GEPpB,uBFOoB,CAAA,CAAA,MAAA,EELR,WFKQ,CEJd,MFIc,CAAA,KAAA,CAAA,EEHd,MFGc,CAAA,aAAA,CAAA,EEFd,MFEc,CAAA,eAAA,CAAA,EEDd,MFCc,CAAA,iBAAA,CAAA,EAAA,IAAA,CAAA,EAAA,GEEb,OFFa,CEEL,GAAA,CAAE,KFFG,CEEG,MFFH,CAAA,gBAAA,CAAA,CAAA,CAAA,CAAA;;;;;;;;ACCtB;;;;;;;;AClB+B;;;;;AAgBvB,iBA0BQ,QA1BR,CAAA,qBA0BsC,eA1BtC,CAAA,CAAA,QAAA,EA2BI,eA3BJ,CA2BoB,MA3BpB,EAAA,KA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AAA,CAAA,EAsCf,GAAA,CAAE,MAtCa,CAsCN,CAtCM,CAAA,GAAA,IAAA;EAAT;;;;;;;;;;;;;;EAmEI,OAAA,GAAA,CAAA,SAAA,EAAA,oBAAA,EAAA,MAAA,EACH,cADG,GACc,kBADd,GACmC,eADnC,CAAA,GAAA,CAAA,CAAA,EAAA,OAAA;EACH,OAAA,GAAA,CAAA,UAEW,OAFX,CAAA,CAAA,SAAA,EAGG,0BAHH,CAG8B,CAH9B,CAAA,EAAA,MAAA,EAIA,cAJA,GAIiB,kBAJjB,GAIsC,eAJtC,CAAA,GAAA,CAAA,CAAA,EAAA,OAAA"}
|
|
@@ -1,60 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { a as HttpCode$1, c as Controller$1, d as hasManagedMetadata, h as hasControllerMetadata, i as Module$1, m as getControllerMetadata, n as Stream$1, o as Header$1, r as Multipart$1, s as Endpoint$1, t as UseGuards$1, u as getManagedMetadata, v as getEndpointMetadata } from "../use-guards.decorator-BecoQSmE.mjs";
|
|
2
|
+
import { g as hasModuleMetadata, h as getModuleMetadata } from "../tokens-4J9sredA.mjs";
|
|
3
|
+
import { Factory, Injectable, createClassContext, createClassContext as createClassContext$1, createMethodContext, createMethodContext as createMethodContext$1 } from "@navios/di/legacy-compat";
|
|
3
4
|
|
|
4
|
-
//#region src/legacy-compat/context-compat.mts
|
|
5
|
-
/**
|
|
6
|
-
* Compatibility layer for converting legacy decorator signatures to Stage 3 format.
|
|
7
|
-
*
|
|
8
|
-
* This module provides utilities to create mock Stage 3 decorator contexts
|
|
9
|
-
* from legacy decorator arguments, and manages metadata storage using WeakMap.
|
|
10
|
-
*/ const classMetadataMap = /* @__PURE__ */ new WeakMap();
|
|
11
|
-
/**
|
|
12
|
-
* Gets the constructor from a prototype (for method decorators).
|
|
13
|
-
*/ function getConstructor(prototype) {
|
|
14
|
-
if (!prototype || typeof prototype !== "object") return null;
|
|
15
|
-
const constructor = prototype.constructor;
|
|
16
|
-
if (constructor && typeof constructor === "function") return constructor;
|
|
17
|
-
return null;
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Creates a mock ClassDecoratorContext for legacy class decorators.
|
|
21
|
-
* @internal
|
|
22
|
-
*/ function createClassContext(target) {
|
|
23
|
-
if (!classMetadataMap.has(target)) classMetadataMap.set(target, {});
|
|
24
|
-
const metadata = classMetadataMap.get(target);
|
|
25
|
-
return {
|
|
26
|
-
kind: "class",
|
|
27
|
-
name: target.name,
|
|
28
|
-
metadata,
|
|
29
|
-
addInitializer() {}
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Creates a mock ClassMethodDecoratorContext for legacy method decorators.
|
|
34
|
-
*
|
|
35
|
-
* Note: Method decorators need to share metadata with the class context
|
|
36
|
-
* because endpoint metadata is stored at the class level.
|
|
37
|
-
* @internal
|
|
38
|
-
*/ function createMethodContext(target, propertyKey, descriptor) {
|
|
39
|
-
const constructor = getConstructor(target);
|
|
40
|
-
if (!constructor) throw new Error("[Navios] Could not determine class constructor from method decorator target.");
|
|
41
|
-
if (!classMetadataMap.has(constructor)) classMetadataMap.set(constructor, {});
|
|
42
|
-
return {
|
|
43
|
-
kind: "method",
|
|
44
|
-
name: propertyKey,
|
|
45
|
-
metadata: classMetadataMap.get(constructor),
|
|
46
|
-
static: false,
|
|
47
|
-
private: false,
|
|
48
|
-
access: {
|
|
49
|
-
has: () => true,
|
|
50
|
-
get: () => descriptor.value,
|
|
51
|
-
set: () => {}
|
|
52
|
-
},
|
|
53
|
-
addInitializer() {}
|
|
54
|
-
};
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
//#endregion
|
|
58
5
|
//#region src/legacy-compat/decorators/module.decorator.mts
|
|
59
6
|
/**
|
|
60
7
|
* Legacy-compatible Module decorator.
|
|
@@ -79,7 +26,7 @@ import { Factory as Factory$1, Injectable as Injectable$1 } from "@navios/di";
|
|
|
79
26
|
guards: []
|
|
80
27
|
}) {
|
|
81
28
|
return function(target) {
|
|
82
|
-
const context = createClassContext(target);
|
|
29
|
+
const context = createClassContext$1(target);
|
|
83
30
|
return Module$1(options)(target, context);
|
|
84
31
|
};
|
|
85
32
|
}
|
|
@@ -104,7 +51,7 @@ import { Factory as Factory$1, Injectable as Injectable$1 } from "@navios/di";
|
|
|
104
51
|
* ```
|
|
105
52
|
*/ function Controller(options = {}) {
|
|
106
53
|
return function(target) {
|
|
107
|
-
const context = createClassContext(target);
|
|
54
|
+
const context = createClassContext$1(target);
|
|
108
55
|
return Controller$1(options)(target, context);
|
|
109
56
|
};
|
|
110
57
|
}
|
|
@@ -134,7 +81,7 @@ import { Factory as Factory$1, Injectable as Injectable$1 } from "@navios/di";
|
|
|
134
81
|
return function(target, propertyKey, descriptor) {
|
|
135
82
|
if (!descriptor) throw new Error("[Navios] @Endpoint decorator requires a method descriptor. Make sure experimentalDecorators is enabled.");
|
|
136
83
|
const typedDescriptor = descriptor;
|
|
137
|
-
const context = createMethodContext(target, propertyKey, typedDescriptor);
|
|
84
|
+
const context = createMethodContext$1(target, propertyKey, typedDescriptor);
|
|
138
85
|
const result = Endpoint$1(endpoint)(typedDescriptor.value, context);
|
|
139
86
|
if (result !== typedDescriptor.value) typedDescriptor.value = result;
|
|
140
87
|
return typedDescriptor;
|
|
@@ -170,12 +117,12 @@ import { Factory as Factory$1, Injectable as Injectable$1 } from "@navios/di";
|
|
|
170
117
|
*/ function UseGuards(...guards) {
|
|
171
118
|
function decoratorImpl(target, propertyKey, descriptor) {
|
|
172
119
|
if (propertyKey !== void 0 && descriptor !== void 0) {
|
|
173
|
-
const context = createMethodContext(target, propertyKey, descriptor);
|
|
120
|
+
const context = createMethodContext$1(target, propertyKey, descriptor);
|
|
174
121
|
const result = UseGuards$1(...guards)(descriptor.value, context);
|
|
175
122
|
if (result !== descriptor.value) descriptor.value = result;
|
|
176
123
|
return descriptor;
|
|
177
124
|
} else {
|
|
178
|
-
const context = createClassContext(target);
|
|
125
|
+
const context = createClassContext$1(target);
|
|
179
126
|
return UseGuards$1(...guards)(target, context);
|
|
180
127
|
}
|
|
181
128
|
}
|
|
@@ -206,7 +153,7 @@ import { Factory as Factory$1, Injectable as Injectable$1 } from "@navios/di";
|
|
|
206
153
|
* ```
|
|
207
154
|
*/ function Header(name, value) {
|
|
208
155
|
return function(target, propertyKey, descriptor) {
|
|
209
|
-
const context = createMethodContext(target, propertyKey, descriptor);
|
|
156
|
+
const context = createMethodContext$1(target, propertyKey, descriptor);
|
|
210
157
|
const result = Header$1(name, value)(descriptor.value, context);
|
|
211
158
|
if (result !== descriptor.value) descriptor.value = result;
|
|
212
159
|
return descriptor;
|
|
@@ -236,7 +183,7 @@ import { Factory as Factory$1, Injectable as Injectable$1 } from "@navios/di";
|
|
|
236
183
|
* ```
|
|
237
184
|
*/ function HttpCode(code) {
|
|
238
185
|
return function(target, propertyKey, descriptor) {
|
|
239
|
-
const context = createMethodContext(target, propertyKey, descriptor);
|
|
186
|
+
const context = createMethodContext$1(target, propertyKey, descriptor);
|
|
240
187
|
const result = HttpCode$1(code)(descriptor.value, context);
|
|
241
188
|
if (result !== descriptor.value) descriptor.value = result;
|
|
242
189
|
return descriptor;
|
|
@@ -268,7 +215,7 @@ import { Factory as Factory$1, Injectable as Injectable$1 } from "@navios/di";
|
|
|
268
215
|
*/ function Multipart(endpoint) {
|
|
269
216
|
return function(target, propertyKey, descriptor) {
|
|
270
217
|
if (!descriptor) throw new Error("[Navios] @Multipart decorator requires a method descriptor. Make sure experimentalDecorators is enabled.");
|
|
271
|
-
const context = createMethodContext(target, propertyKey, descriptor);
|
|
218
|
+
const context = createMethodContext$1(target, propertyKey, descriptor);
|
|
272
219
|
const result = Multipart$1(endpoint)(descriptor.value, context);
|
|
273
220
|
if (result !== descriptor.value) descriptor.value = result;
|
|
274
221
|
return descriptor;
|
|
@@ -301,65 +248,13 @@ import { Factory as Factory$1, Injectable as Injectable$1 } from "@navios/di";
|
|
|
301
248
|
return function(target, propertyKey, descriptor) {
|
|
302
249
|
if (!descriptor || !descriptor.value) throw new Error("[Navios] @Stream decorator requires a method descriptor. Make sure experimentalDecorators is enabled.");
|
|
303
250
|
const typedDescriptor = descriptor;
|
|
304
|
-
const context = createMethodContext(target, propertyKey, typedDescriptor);
|
|
251
|
+
const context = createMethodContext$1(target, propertyKey, typedDescriptor);
|
|
305
252
|
const result = Stream$1(endpoint)(typedDescriptor.value, context);
|
|
306
253
|
if (result && result !== typedDescriptor.value) typedDescriptor.value = result;
|
|
307
254
|
return typedDescriptor;
|
|
308
255
|
};
|
|
309
256
|
}
|
|
310
257
|
|
|
311
|
-
//#endregion
|
|
312
|
-
//#region src/legacy-compat/decorators/injectable.decorator.mts
|
|
313
|
-
/**
|
|
314
|
-
* Legacy-compatible Injectable decorator.
|
|
315
|
-
*
|
|
316
|
-
* Works with TypeScript experimental decorators (legacy API).
|
|
317
|
-
*
|
|
318
|
-
* @param options - Injectable configuration options
|
|
319
|
-
* @returns A class decorator compatible with legacy decorator API
|
|
320
|
-
*
|
|
321
|
-
* @example
|
|
322
|
-
* ```typescript
|
|
323
|
-
* @Injectable()
|
|
324
|
-
* export class UserService {
|
|
325
|
-
* getUser(id: string) {
|
|
326
|
-
* return { id, name: 'John' }
|
|
327
|
-
* }
|
|
328
|
-
* }
|
|
329
|
-
* ```
|
|
330
|
-
*/ function Injectable(options = {}) {
|
|
331
|
-
return function(target) {
|
|
332
|
-
const context = createClassContext(target);
|
|
333
|
-
return (Object.keys(options).length === 0 ? Injectable$1() : Injectable$1(options))(target, context);
|
|
334
|
-
};
|
|
335
|
-
}
|
|
336
|
-
|
|
337
|
-
//#endregion
|
|
338
|
-
//#region src/legacy-compat/decorators/factory.decorator.mts
|
|
339
|
-
/**
|
|
340
|
-
* Legacy-compatible Factory decorator.
|
|
341
|
-
*
|
|
342
|
-
* Works with TypeScript experimental decorators (legacy API).
|
|
343
|
-
*
|
|
344
|
-
* @param options - Factory configuration options
|
|
345
|
-
* @returns A class decorator compatible with legacy decorator API
|
|
346
|
-
*
|
|
347
|
-
* @example
|
|
348
|
-
* ```typescript
|
|
349
|
-
* @Factory()
|
|
350
|
-
* export class DatabaseConnectionFactory {
|
|
351
|
-
* create() {
|
|
352
|
-
* return { host: 'localhost', port: 5432 }
|
|
353
|
-
* }
|
|
354
|
-
* }
|
|
355
|
-
* ```
|
|
356
|
-
*/ function Factory(options = {}) {
|
|
357
|
-
return function(target) {
|
|
358
|
-
const context = createClassContext(target);
|
|
359
|
-
return (Object.keys(options).length === 0 ? Factory$1() : Factory$1(options))(target, context);
|
|
360
|
-
};
|
|
361
|
-
}
|
|
362
|
-
|
|
363
258
|
//#endregion
|
|
364
259
|
//#region src/legacy-compat/attribute.factory.mts
|
|
365
260
|
/**
|
|
@@ -408,7 +303,7 @@ import { Factory as Factory$1, Injectable as Injectable$1 } from "@navios/di";
|
|
|
408
303
|
const res = (value) => {
|
|
409
304
|
function decorator(target, propertyKey, descriptor) {
|
|
410
305
|
if (propertyKey !== void 0 && descriptor !== void 0) {
|
|
411
|
-
const context = createMethodContext(target, propertyKey, descriptor);
|
|
306
|
+
const context = createMethodContext$1(target, propertyKey, descriptor);
|
|
412
307
|
const metadata = getEndpointMetadata(descriptor.value, context);
|
|
413
308
|
if (schema) {
|
|
414
309
|
const validatedValue = schema.safeParse(value);
|
|
@@ -421,7 +316,7 @@ import { Factory as Factory$1, Injectable as Injectable$1 } from "@navios/di";
|
|
|
421
316
|
const isModule = hasModuleMetadata(target);
|
|
422
317
|
const isManaged = hasManagedMetadata(target);
|
|
423
318
|
if (!isController && !isModule && !isManaged) throw new Error("[Navios] Attribute can only be applied to classes with @Controller, @Module, or other Navios-managed decorators");
|
|
424
|
-
const context = createClassContext(target);
|
|
319
|
+
const context = createClassContext$1(target);
|
|
425
320
|
const metadata = isController ? getControllerMetadata(target, context) : isModule ? getModuleMetadata(target, context) : isManaged ? getManagedMetadata(target) : null;
|
|
426
321
|
if (!metadata) throw new Error("[Navios] Could not determine metadata for attribute target");
|
|
427
322
|
if (schema) {
|