@navios/core 0.8.0 → 0.9.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/CHANGELOG.md +47 -0
- package/lib/{index-BDNl7j1G.d.cts → index-D9MNh6Tx.d.mts} +36 -13
- package/lib/index-D9MNh6Tx.d.mts.map +1 -0
- package/lib/{index-BoP0cWT6.d.mts → index-Db1d3cwD.d.cts} +36 -13
- package/lib/index-Db1d3cwD.d.cts.map +1 -0
- package/lib/index.cjs +2 -2
- package/lib/index.d.cts +2 -2
- package/lib/index.d.mts +2 -2
- package/lib/index.mjs +2 -2
- package/lib/legacy-compat/index.cjs +1 -1
- package/lib/legacy-compat/index.cjs.map +1 -1
- package/lib/legacy-compat/index.d.cts +3 -3
- package/lib/legacy-compat/index.d.cts.map +1 -1
- package/lib/legacy-compat/index.d.mts +3 -3
- package/lib/legacy-compat/index.d.mts.map +1 -1
- package/lib/legacy-compat/index.mjs +1 -1
- package/lib/legacy-compat/index.mjs.map +1 -1
- package/lib/{src-B6eISODM.cjs → src-BRPtJ9fG.cjs} +12 -9
- package/lib/src-BRPtJ9fG.cjs.map +1 -0
- package/lib/{src-gBAChVRL.mjs → src-Bo23RIo-.mjs} +13 -10
- package/lib/src-Bo23RIo-.mjs.map +1 -0
- package/lib/testing/index.cjs +346 -29
- package/lib/testing/index.cjs.map +1 -1
- package/lib/testing/index.d.cts +299 -63
- package/lib/testing/index.d.cts.map +1 -1
- package/lib/testing/index.d.mts +299 -63
- package/lib/testing/index.d.mts.map +1 -1
- package/lib/testing/index.mjs +347 -31
- package/lib/testing/index.mjs.map +1 -1
- package/lib/{use-guards.decorator-COR-9mZY.cjs → use-guards.decorator-Bs8oDHOi.cjs} +13 -9
- package/lib/use-guards.decorator-Bs8oDHOi.cjs.map +1 -0
- package/lib/{use-guards.decorator-CUww54Nt.mjs → use-guards.decorator-CzVXuLkz.mjs} +12 -8
- package/lib/use-guards.decorator-CzVXuLkz.mjs.map +1 -0
- package/package.json +2 -2
- package/src/__tests__/controller-resolver.spec.mts +19 -13
- package/src/__tests__/testing-module.spec.mts +459 -0
- package/src/__tests__/unit-testing-module.spec.mts +424 -0
- package/src/decorators/controller.decorator.mts +19 -2
- package/src/decorators/module.decorator.mts +23 -5
- package/src/legacy-compat/__type-tests__/legacy-decorators.spec-d.mts +2 -6
- package/src/legacy-compat/decorators/multipart.decorator.mts +4 -4
- package/src/legacy-compat/decorators/stream.decorator.mts +4 -4
- package/src/navios.application.mts +9 -9
- package/src/navios.environment.mts +3 -1
- package/src/navios.factory.mts +9 -27
- package/src/services/instance-resolver.service.mts +8 -7
- package/src/services/module-loader.service.mts +3 -2
- package/src/testing/index.mts +1 -0
- package/src/testing/testing-module.mts +255 -93
- package/src/testing/unit-testing-module.mts +298 -0
- package/lib/index-BDNl7j1G.d.cts.map +0 -1
- package/lib/index-BoP0cWT6.d.mts.map +0 -1
- package/lib/src-B6eISODM.cjs.map +0 -1
- package/lib/src-gBAChVRL.mjs.map +0 -1
- package/lib/use-guards.decorator-COR-9mZY.cjs.map +0 -1
- package/lib/use-guards.decorator-CUww54Nt.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["classMetadataMap","WeakMap","getConstructor","prototype","constructor","createClassContext","target","has","set","metadata","get","kind","name","addInitializer","createMethodContext","propertyKey","descriptor","Error","static","private","access","value","Module","OriginalModule","createClassContext","options","controllers","imports","guards","target","context","originalDecorator","Controller","OriginalController","createClassContext","options","target","context","originalDecorator","Endpoint","OriginalEndpoint","createMethodContext","endpoint","target","propertyKey","descriptor","Error","typedDescriptor","context","originalDecorator","result","value","UseGuards","OriginalUseGuards","createClassContext","createMethodContext","guards","decoratorImpl","target","propertyKey","descriptor","undefined","context","originalDecorator","result","value","Header","OriginalHeader","createMethodContext","name","value","target","propertyKey","descriptor","context","originalDecorator","result","HttpCode","OriginalHttpCode","createMethodContext","code","target","propertyKey","descriptor","context","originalDecorator","result","value","Multipart","OriginalMultipart","createMethodContext","endpoint","target","propertyKey","descriptor","Error","context","originalDecorator","result","value","Stream","OriginalStream","createMethodContext","endpoint","target","propertyKey","descriptor","context","originalDecorator","result","value"],"sources":["../../src/legacy-compat/context-compat.mts","../../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"],"sourcesContent":["/**\n * Compatibility layer for converting legacy decorator signatures to Stage 3 format.\n *\n * This module provides utilities to create mock Stage 3 decorator contexts\n * from legacy decorator arguments, and manages metadata storage using WeakMap.\n */\n\nimport type { ClassType } from '@navios/di'\n\n// WeakMap to store metadata for legacy decorators\n// Keyed by class constructor for class decorators\n// For method decorators, we use the class constructor (extracted from the prototype)\nconst classMetadataMap = new WeakMap<ClassType, Record<string | symbol, any>>()\n\n/**\n * Gets the constructor from a prototype (for method decorators).\n */\nfunction getConstructor(prototype: any): ClassType | null {\n if (!prototype || typeof prototype !== 'object') {\n return null\n }\n // In legacy decorators, target is the prototype\n // The constructor is typically available via prototype.constructor\n const constructor = prototype.constructor\n if (constructor && typeof constructor === 'function') {\n return constructor as ClassType\n }\n return null\n}\n\n/**\n * Creates a mock ClassDecoratorContext for legacy class decorators.\n */\nexport function createClassContext(target: ClassType): ClassDecoratorContext {\n // Get or create metadata storage for this class\n if (!classMetadataMap.has(target)) {\n classMetadataMap.set(target, {})\n }\n const metadata = classMetadataMap.get(target)!\n\n return {\n kind: 'class',\n name: target.name,\n metadata,\n addInitializer() {\n // Legacy decorators don't support initializers\n },\n } as ClassDecoratorContext\n}\n\n/**\n * Creates a mock ClassMethodDecoratorContext for legacy method decorators.\n *\n * Note: Method decorators need to share metadata with the class context\n * because endpoint metadata is stored at the class level.\n */\nexport function createMethodContext(\n target: any,\n propertyKey: string | symbol,\n descriptor: PropertyDescriptor,\n): ClassMethodDecoratorContext {\n // For method decorators, target is the prototype\n // We need to get the class constructor to access class-level metadata\n const constructor = getConstructor(target)\n if (!constructor) {\n throw new Error(\n '[Navios] Could not determine class constructor from method decorator target.',\n )\n }\n\n // Get or create metadata storage for the class\n // Method decorators share metadata with the class\n if (!classMetadataMap.has(constructor)) {\n classMetadataMap.set(constructor, {})\n }\n const metadata = classMetadataMap.get(constructor)!\n\n return {\n kind: 'method',\n name: propertyKey,\n metadata,\n static: false, // We can't determine this from legacy decorators\n private: false, // We can't determine this from legacy decorators\n access: {\n has: () => true,\n get: () => descriptor.value,\n set: () => {},\n },\n addInitializer() {\n // Legacy decorators don't support initializers\n },\n } as ClassMethodDecoratorContext\n}\n","import type { ClassType } from '@navios/di'\n\nimport { Module as OriginalModule, type ModuleOptions } from '../../decorators/module.decorator.mjs'\nimport { createClassContext } from '../context-compat.mjs'\n\n/**\n * Legacy-compatible Module decorator.\n * \n * Works with TypeScript experimental decorators (legacy API).\n * \n * @param options - Module configuration options\n * @returns A class decorator compatible with legacy decorator API\n * \n * @example\n * ```typescript\n * @Module({\n * controllers: [UserController, AuthController],\n * imports: [DatabaseModule],\n * guards: [AuthGuard],\n * })\n * export class AppModule {}\n * ```\n */\nexport function Module(\n options: ModuleOptions = {\n controllers: [],\n imports: [],\n guards: [],\n },\n) {\n return function (target: ClassType) {\n const context = createClassContext(target)\n const originalDecorator = OriginalModule(options)\n return originalDecorator(target, context)\n }\n}\n\n","import type { ClassType } from '@navios/di'\n\nimport type { ControllerOptions } from '../../decorators/controller.decorator.mjs'\n\nimport { Controller as OriginalController } from '../../decorators/controller.decorator.mjs'\nimport { createClassContext } from '../context-compat.mjs'\n\n/**\n * Legacy-compatible Controller decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n *\n * @param options - Controller configuration options\n * @returns A class decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Controller({ guards: [AuthGuard] })\n * export class UserController {\n * @Endpoint(getUserEndpoint)\n * async getUser() { }\n * }\n * ```\n */\nexport function Controller(options: ControllerOptions = {}) {\n return function (target: ClassType) {\n const context = createClassContext(target)\n const originalDecorator = OriginalController(options)\n return originalDecorator(target, context)\n }\n}\n","import type {\n BaseEndpointConfig,\n EndpointFunctionArgs,\n HttpMethod,\n} from '@navios/builder'\nimport type { z, ZodType } from 'zod/v4'\n\nimport { Endpoint as OriginalEndpoint } from '../../decorators/endpoint.decorator.mjs'\nimport { createMethodContext } from '../context-compat.mjs'\n\n/**\n * Type helper to constrain a PropertyDescriptor's value to match an endpoint signature.\n * Note: In legacy decorators, type constraints are checked when the decorator is applied,\n * but may not be preserved perfectly when decorators are stacked.\n */\ntype EndpointMethodDescriptor<\n Url extends string,\n QuerySchema,\n RequestSchema,\n ResponseSchema extends ZodType,\n> = TypedPropertyDescriptor<\n (\n params: QuerySchema extends ZodType\n ? RequestSchema extends ZodType\n ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema, true>\n : EndpointFunctionArgs<Url, QuerySchema, undefined, true>\n : RequestSchema extends ZodType\n ? EndpointFunctionArgs<Url, undefined, RequestSchema, true>\n : EndpointFunctionArgs<Url, undefined, undefined, true>,\n ) => Promise<z.input<ResponseSchema>>\n>\n\n/**\n * Legacy-compatible Endpoint decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n * Provides type safety by ensuring method signatures match the endpoint configuration.\n *\n * @param endpoint - The endpoint declaration from @navios/builder\n * @returns A method decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Controller()\n * export class UserController {\n * @Endpoint(getUserEndpoint)\n * async getUser(request: EndpointParams<typeof getUserEndpoint>): EndpointResult<typeof getUserEndpoint> {\n * return { id: '1', name: 'John' }\n * }\n * }\n * ```\n */\nexport function Endpoint<\n Method extends HttpMethod = HttpMethod,\n Url extends string = string,\n QuerySchema = undefined,\n ResponseSchema extends ZodType = ZodType,\n RequestSchema = ZodType,\n>(endpoint: {\n config: BaseEndpointConfig<\n Method,\n Url,\n QuerySchema,\n ResponseSchema,\n RequestSchema\n >\n}) {\n return function (\n target: any,\n propertyKey: string | symbol,\n descriptor: EndpointMethodDescriptor<\n Url,\n QuerySchema,\n RequestSchema,\n ResponseSchema\n >,\n ): PropertyDescriptor | void {\n if (!descriptor) {\n throw new Error(\n '[Navios] @Endpoint decorator requires a method descriptor. Make sure experimentalDecorators is enabled.',\n )\n }\n // Type check the descriptor value matches expected signature\n const typedDescriptor = descriptor as EndpointMethodDescriptor<\n Url,\n QuerySchema,\n RequestSchema,\n ResponseSchema\n >\n const context = createMethodContext(target, propertyKey, typedDescriptor)\n const originalDecorator = OriginalEndpoint(endpoint)\n // @ts-expect-error - we don't need to type the value\n const result = originalDecorator(typedDescriptor.value, context)\n if (result !== typedDescriptor.value) {\n typedDescriptor.value = result as any\n }\n return typedDescriptor\n }\n}\n","import type {\n ClassType,\n ClassTypeWithInstance,\n InjectionToken,\n} from '@navios/di'\n\nimport type { CanActivate } from '../../interfaces/index.mjs'\n\nimport { UseGuards as OriginalUseGuards } from '../../decorators/use-guards.decorator.mjs'\nimport { createClassContext, createMethodContext } from '../context-compat.mjs'\n\n/**\n * Legacy-compatible UseGuards decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n * Can be applied to classes or methods.\n *\n * @param guards - Guard classes or injection tokens to apply\n * @returns A class or method decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * // Apply to a controller\n * @Controller()\n * @UseGuards(AuthGuard, RoleGuard)\n * export class UserController { }\n *\n * // Apply to a specific endpoint\n * @Controller()\n * export class UserController {\n * @Endpoint(getUserEndpoint)\n * @UseGuards(AuthGuard)\n * async getUser() { }\n * }\n * ```\n */\nexport function UseGuards(\n ...guards: (\n | ClassTypeWithInstance<CanActivate>\n | InjectionToken<CanActivate, undefined>\n )[]\n) {\n // Create the decorator function\n // Note: TypeScript's legacy decorator system has strict type checking for decorators\n // We use a flexible implementation that works for both class and method decorators\n function decoratorImpl(\n target: ClassType | Function,\n propertyKey?: string | symbol,\n descriptor?: PropertyDescriptor,\n ): any {\n // Determine if this is a class or method decorator\n if (propertyKey !== undefined && descriptor !== undefined) {\n // Method decorator\n const context = createMethodContext(\n target as Function,\n propertyKey,\n descriptor,\n )\n const originalDecorator = OriginalUseGuards(...guards)\n const result = originalDecorator(descriptor.value, context)\n if (result !== descriptor.value) {\n descriptor.value = result\n }\n return descriptor\n } else {\n // Class decorator\n const context = createClassContext(target as ClassType)\n const originalDecorator = OriginalUseGuards(...guards)\n return originalDecorator(target as ClassType, context)\n }\n }\n\n // Return with 'any' type to work around TypeScript's strict decorator checking\n // TypeScript's legacy decorator system cannot properly type-check decorators\n // that work as both class and method decorators. The runtime behavior is correct.\n // When used as a class decorator, it returns the class (preserving type at runtime)\n // When used as a method decorator, it returns the PropertyDescriptor\n // @ts-ignore - TypeScript limitation with dual-purpose legacy decorators\n return decoratorImpl as any\n}\n","import type { HttpHeader } from '../../interfaces/index.mjs'\n\nimport { Header as OriginalHeader } from '../../decorators/header.decorator.mjs'\nimport { createMethodContext } from '../context-compat.mjs'\n\n/**\n * Legacy-compatible Header decorator.\n * \n * Works with TypeScript experimental decorators (legacy API).\n * \n * @param name - The header name (e.g., 'Content-Type', 'Cache-Control')\n * @param value - The header value (string, number, or array of strings)\n * @returns A method decorator compatible with legacy decorator API\n * \n * @example\n * ```typescript\n * @Controller()\n * export class UserController {\n * @Endpoint(getUserEndpoint)\n * @Header('Cache-Control', 'max-age=3600')\n * async getUser() {\n * return { id: '1', name: 'John' }\n * }\n * }\n * ```\n */\nexport function Header(name: HttpHeader, value: string | number | string[]) {\n return function <T extends object>(\n target: T,\n propertyKey: string | symbol,\n descriptor: PropertyDescriptor,\n ) {\n const context = createMethodContext(target, propertyKey, descriptor)\n const originalDecorator = OriginalHeader(name, value)\n const result = originalDecorator(descriptor.value, context)\n if (result !== descriptor.value) {\n descriptor.value = result\n }\n return descriptor\n }\n}\n\n","import { HttpCode as OriginalHttpCode } from '../../decorators/http-code.decorator.mjs'\nimport { createMethodContext } from '../context-compat.mjs'\n\n/**\n * Legacy-compatible HttpCode decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n *\n * @param code - The HTTP status code to return (e.g., 201, 204, 202)\n * @returns A method decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Controller()\n * export class UserController {\n * @Endpoint(createUserEndpoint)\n * @HttpCode(201)\n * async createUser() {\n * return { id: '1', name: 'John' }\n * }\n * }\n * ```\n */\nexport function HttpCode(code: number) {\n return function <T extends object>(\n target: T,\n propertyKey: string | symbol,\n descriptor: PropertyDescriptor,\n ) {\n const context = createMethodContext(target, propertyKey, descriptor)\n const originalDecorator = OriginalHttpCode(code)\n const result = originalDecorator(descriptor.value, context)\n if (result !== descriptor.value) {\n descriptor.value = result\n }\n return descriptor\n }\n}\n","import type {\n BaseEndpointConfig,\n EndpointFunctionArgs,\n HttpMethod,\n} from '@navios/builder'\nimport type { z, ZodObject, ZodType } from 'zod/v4'\n\nimport { Multipart as OriginalMultipart } from '../../decorators/multipart.decorator.mjs'\nimport { createMethodContext } from '../context-compat.mjs'\n\n/**\n * Type helper to constrain a PropertyDescriptor's value to match a multipart endpoint signature.\n * Note: In legacy decorators, type constraints are checked when the decorator is applied,\n * but may not be preserved perfectly when decorators are stacked.\n */\ntype MultipartMethodDescriptor<\n Url extends string,\n QuerySchema,\n RequestSchema,\n ResponseSchema extends ZodType,\n> = TypedPropertyDescriptor<\n (\n params: QuerySchema extends ZodObject\n ? RequestSchema extends ZodType\n ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema>\n : EndpointFunctionArgs<Url, QuerySchema, undefined>\n : RequestSchema extends ZodType\n ? EndpointFunctionArgs<Url, undefined, RequestSchema>\n : EndpointFunctionArgs<Url, undefined, undefined>,\n ) => Promise<z.input<ResponseSchema>>\n>\n\n/**\n * Legacy-compatible Multipart decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n * Provides type safety by ensuring method signatures match the endpoint configuration.\n *\n * @param endpoint - The multipart endpoint declaration from @navios/builder\n * @returns A method decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Controller()\n * export class FileController {\n * @Multipart(uploadFileEndpoint)\n * async uploadFile(request: MultipartParams<typeof uploadFileEndpoint>): MultipartResult<typeof uploadFileEndpoint> {\n * const { file } = request.data\n * return { url: 'https://example.com/file.jpg' }\n * }\n * }\n * ```\n */\nexport function Multipart<\n Method extends HttpMethod = HttpMethod,\n Url extends string = string,\n QuerySchema = undefined,\n ResponseSchema extends ZodType = ZodType,\n RequestSchema = ZodType,\n>(endpoint: {\n config: BaseEndpointConfig<\n Method,\n Url,\n QuerySchema,\n ResponseSchema,\n RequestSchema\n >\n}) {\n return function <T extends object>(\n target: T,\n propertyKey: string | symbol,\n descriptor: MultipartMethodDescriptor<\n Url,\n QuerySchema,\n RequestSchema,\n ResponseSchema\n >,\n ): PropertyDescriptor | void {\n if (!descriptor) {\n throw new Error(\n '[Navios] @Multipart decorator requires a method descriptor. Make sure experimentalDecorators is enabled.',\n )\n }\n const context = createMethodContext(target, propertyKey, descriptor)\n const originalDecorator = OriginalMultipart(endpoint)\n // @ts-expect-error - we don't need to type the value\n const result = originalDecorator(descriptor.value, context)\n if (result !== descriptor.value) {\n descriptor.value = result as any\n }\n return descriptor\n }\n}\n","import type {\n BaseStreamConfig,\n EndpointFunctionArgs,\n HttpMethod,\n} from '@navios/builder'\nimport type { ZodObject, ZodType } from 'zod/v4'\n\nimport { Stream as OriginalStream } from '../../decorators/stream.decorator.mjs'\nimport { createMethodContext } from '../context-compat.mjs'\n\n/**\n * Type helper to constrain a PropertyDescriptor's value to match a stream endpoint signature.\n * Note: In legacy decorators, type constraints are checked when the decorator is applied,\n * but may not be preserved perfectly when decorators are stacked.\n */\ntype StreamMethodDescriptor<\n Url extends string,\n QuerySchema,\n RequestSchema,\n> = TypedPropertyDescriptor<\n (\n params: QuerySchema extends ZodObject\n ? RequestSchema extends ZodType\n ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema>\n : EndpointFunctionArgs<Url, QuerySchema, undefined>\n : RequestSchema extends ZodType\n ? EndpointFunctionArgs<Url, undefined, RequestSchema>\n : EndpointFunctionArgs<Url, undefined, undefined>,\n reply: any,\n ) => Promise<void>\n>\n\n/**\n * Legacy-compatible Stream decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n * Provides type safety by ensuring method signatures match the endpoint configuration.\n *\n * @param endpoint - The stream endpoint declaration from @navios/builder\n * @returns A method decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Controller()\n * export class FileController {\n * @Stream(downloadFileEndpoint)\n * async downloadFile(request: StreamParams<typeof downloadFileEndpoint>, reply: any) {\n * const { fileId } = request.urlParams\n * // Stream file data to reply\n * }\n * }\n * ```\n */\nexport function Stream<\n Method extends HttpMethod = HttpMethod,\n Url extends string = string,\n QuerySchema = undefined,\n RequestSchema = ZodType,\n>(endpoint: {\n config: BaseStreamConfig<Method, Url, QuerySchema, RequestSchema>\n}) {\n return function <T extends object>(\n target: T,\n propertyKey: string | symbol,\n descriptor: StreamMethodDescriptor<Url, QuerySchema, RequestSchema>,\n ) {\n const context = createMethodContext(target, propertyKey, descriptor)\n const originalDecorator = OriginalStream(endpoint)\n // @ts-expect-error - we don't need to type the value\n const result = originalDecorator(descriptor.value, context)\n if (result !== descriptor.value) {\n descriptor.value = result as any\n }\n return descriptor\n }\n}\n"],"mappings":";;;;;;;;GAYA,MAAMA,mCAAmB,IAAIC,SAAAA;;;GAK7B,SAASC,eAAeC,WAAc;AACpC,KAAI,CAACA,aAAa,OAAOA,cAAc,SACrC,QAAO;CAIT,MAAMC,cAAcD,UAAU;AAC9B,KAAIC,eAAe,OAAOA,gBAAgB,WACxC,QAAOA;AAET,QAAO;;;;GAMT,SAAgBC,mBAAmBC,QAAiB;AAElD,KAAI,CAACN,iBAAiBO,IAAID,OAAAA,CACxBN,kBAAiBQ,IAAIF,QAAQ,EAAC,CAA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,MACR,2GAAA;EAGJ,MAAMC,UAAUN,oBAAoBE,QAAQC,aAAaC,WAAAA;EAGzD,MAAMI,SAFoBT,uCAAkBE,SAAAA,CAEXG,WAAWK,OAAOH,QAAAA;AACnD,MAAIE,WAAWJ,WAAWK,MACxBL,YAAWK,QAAQD;AAErB,SAAOJ;;;;;;;;;;;;;;;;;;;;;;;;;;GCrCX,SAAgBM,OAKdG,UAED;AACC,QAAO,SACLC,QACAC,aACAC,YAAmE;EAEnE,MAAMC,UAAUL,oBAAoBE,QAAQC,aAAaC,WAAAA;EAGzD,MAAMG,SAFoBR,oCAAeE,SAAAA,CAERG,WAAWI,OAAOH,QAAAA;AACnD,MAAIE,WAAWH,WAAWI,MACxBJ,YAAWI,QAAQD;AAErB,SAAOH"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["classMetadataMap","WeakMap","getConstructor","prototype","constructor","createClassContext","target","has","set","metadata","get","kind","name","addInitializer","createMethodContext","propertyKey","descriptor","Error","static","private","access","value","Module","OriginalModule","createClassContext","options","controllers","imports","guards","target","context","originalDecorator","Controller","OriginalController","createClassContext","options","target","context","originalDecorator","Endpoint","OriginalEndpoint","createMethodContext","endpoint","target","propertyKey","descriptor","Error","typedDescriptor","context","originalDecorator","result","value","UseGuards","OriginalUseGuards","createClassContext","createMethodContext","guards","decoratorImpl","target","propertyKey","descriptor","undefined","context","originalDecorator","result","value","Header","OriginalHeader","createMethodContext","name","value","target","propertyKey","descriptor","context","originalDecorator","result","HttpCode","OriginalHttpCode","createMethodContext","code","target","propertyKey","descriptor","context","originalDecorator","result","value","Multipart","OriginalMultipart","createMethodContext","endpoint","target","propertyKey","descriptor","Error","context","originalDecorator","result","value","Stream","OriginalStream","createMethodContext","endpoint","target","propertyKey","descriptor","context","originalDecorator","result","value"],"sources":["../../src/legacy-compat/context-compat.mts","../../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"],"sourcesContent":["/**\n * Compatibility layer for converting legacy decorator signatures to Stage 3 format.\n *\n * This module provides utilities to create mock Stage 3 decorator contexts\n * from legacy decorator arguments, and manages metadata storage using WeakMap.\n */\n\nimport type { ClassType } from '@navios/di'\n\n// WeakMap to store metadata for legacy decorators\n// Keyed by class constructor for class decorators\n// For method decorators, we use the class constructor (extracted from the prototype)\nconst classMetadataMap = new WeakMap<ClassType, Record<string | symbol, any>>()\n\n/**\n * Gets the constructor from a prototype (for method decorators).\n */\nfunction getConstructor(prototype: any): ClassType | null {\n if (!prototype || typeof prototype !== 'object') {\n return null\n }\n // In legacy decorators, target is the prototype\n // The constructor is typically available via prototype.constructor\n const constructor = prototype.constructor\n if (constructor && typeof constructor === 'function') {\n return constructor as ClassType\n }\n return null\n}\n\n/**\n * Creates a mock ClassDecoratorContext for legacy class decorators.\n */\nexport function createClassContext(target: ClassType): ClassDecoratorContext {\n // Get or create metadata storage for this class\n if (!classMetadataMap.has(target)) {\n classMetadataMap.set(target, {})\n }\n const metadata = classMetadataMap.get(target)!\n\n return {\n kind: 'class',\n name: target.name,\n metadata,\n addInitializer() {\n // Legacy decorators don't support initializers\n },\n } as ClassDecoratorContext\n}\n\n/**\n * Creates a mock ClassMethodDecoratorContext for legacy method decorators.\n *\n * Note: Method decorators need to share metadata with the class context\n * because endpoint metadata is stored at the class level.\n */\nexport function createMethodContext(\n target: any,\n propertyKey: string | symbol,\n descriptor: PropertyDescriptor,\n): ClassMethodDecoratorContext {\n // For method decorators, target is the prototype\n // We need to get the class constructor to access class-level metadata\n const constructor = getConstructor(target)\n if (!constructor) {\n throw new Error(\n '[Navios] Could not determine class constructor from method decorator target.',\n )\n }\n\n // Get or create metadata storage for the class\n // Method decorators share metadata with the class\n if (!classMetadataMap.has(constructor)) {\n classMetadataMap.set(constructor, {})\n }\n const metadata = classMetadataMap.get(constructor)!\n\n return {\n kind: 'method',\n name: propertyKey,\n metadata,\n static: false, // We can't determine this from legacy decorators\n private: false, // We can't determine this from legacy decorators\n access: {\n has: () => true,\n get: () => descriptor.value,\n set: () => {},\n },\n addInitializer() {\n // Legacy decorators don't support initializers\n },\n } as ClassMethodDecoratorContext\n}\n","import type { ClassType } from '@navios/di'\n\nimport { Module as OriginalModule, type ModuleOptions } from '../../decorators/module.decorator.mjs'\nimport { createClassContext } from '../context-compat.mjs'\n\n/**\n * Legacy-compatible Module decorator.\n * \n * Works with TypeScript experimental decorators (legacy API).\n * \n * @param options - Module configuration options\n * @returns A class decorator compatible with legacy decorator API\n * \n * @example\n * ```typescript\n * @Module({\n * controllers: [UserController, AuthController],\n * imports: [DatabaseModule],\n * guards: [AuthGuard],\n * })\n * export class AppModule {}\n * ```\n */\nexport function Module(\n options: ModuleOptions = {\n controllers: [],\n imports: [],\n guards: [],\n },\n) {\n return function (target: ClassType) {\n const context = createClassContext(target)\n const originalDecorator = OriginalModule(options)\n return originalDecorator(target, context)\n }\n}\n\n","import type { ClassType } from '@navios/di'\n\nimport type { ControllerOptions } from '../../decorators/controller.decorator.mjs'\n\nimport { Controller as OriginalController } from '../../decorators/controller.decorator.mjs'\nimport { createClassContext } from '../context-compat.mjs'\n\n/**\n * Legacy-compatible Controller decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n *\n * @param options - Controller configuration options\n * @returns A class decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Controller({ guards: [AuthGuard] })\n * export class UserController {\n * @Endpoint(getUserEndpoint)\n * async getUser() { }\n * }\n * ```\n */\nexport function Controller(options: ControllerOptions = {}) {\n return function (target: ClassType) {\n const context = createClassContext(target)\n const originalDecorator = OriginalController(options)\n return originalDecorator(target, context)\n }\n}\n","import type {\n BaseEndpointConfig,\n EndpointFunctionArgs,\n HttpMethod,\n} from '@navios/builder'\nimport type { z, ZodType } from 'zod/v4'\n\nimport { Endpoint as OriginalEndpoint } from '../../decorators/endpoint.decorator.mjs'\nimport { createMethodContext } from '../context-compat.mjs'\n\n/**\n * Type helper to constrain a PropertyDescriptor's value to match an endpoint signature.\n * Note: In legacy decorators, type constraints are checked when the decorator is applied,\n * but may not be preserved perfectly when decorators are stacked.\n */\ntype EndpointMethodDescriptor<\n Url extends string,\n QuerySchema,\n RequestSchema,\n ResponseSchema extends ZodType,\n> = TypedPropertyDescriptor<\n (\n params: QuerySchema extends ZodType\n ? RequestSchema extends ZodType\n ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema, true>\n : EndpointFunctionArgs<Url, QuerySchema, undefined, true>\n : RequestSchema extends ZodType\n ? EndpointFunctionArgs<Url, undefined, RequestSchema, true>\n : EndpointFunctionArgs<Url, undefined, undefined, true>,\n ) => Promise<z.input<ResponseSchema>>\n>\n\n/**\n * Legacy-compatible Endpoint decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n * Provides type safety by ensuring method signatures match the endpoint configuration.\n *\n * @param endpoint - The endpoint declaration from @navios/builder\n * @returns A method decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Controller()\n * export class UserController {\n * @Endpoint(getUserEndpoint)\n * async getUser(request: EndpointParams<typeof getUserEndpoint>): EndpointResult<typeof getUserEndpoint> {\n * return { id: '1', name: 'John' }\n * }\n * }\n * ```\n */\nexport function Endpoint<\n Method extends HttpMethod = HttpMethod,\n Url extends string = string,\n QuerySchema = undefined,\n ResponseSchema extends ZodType = ZodType,\n RequestSchema = ZodType,\n>(endpoint: {\n config: BaseEndpointConfig<\n Method,\n Url,\n QuerySchema,\n ResponseSchema,\n RequestSchema\n >\n}) {\n return function (\n target: any,\n propertyKey: string | symbol,\n descriptor: EndpointMethodDescriptor<\n Url,\n QuerySchema,\n RequestSchema,\n ResponseSchema\n >,\n ): PropertyDescriptor | void {\n if (!descriptor) {\n throw new Error(\n '[Navios] @Endpoint decorator requires a method descriptor. Make sure experimentalDecorators is enabled.',\n )\n }\n // Type check the descriptor value matches expected signature\n const typedDescriptor = descriptor as EndpointMethodDescriptor<\n Url,\n QuerySchema,\n RequestSchema,\n ResponseSchema\n >\n const context = createMethodContext(target, propertyKey, typedDescriptor)\n const originalDecorator = OriginalEndpoint(endpoint)\n // @ts-expect-error - we don't need to type the value\n const result = originalDecorator(typedDescriptor.value, context)\n if (result !== typedDescriptor.value) {\n typedDescriptor.value = result as any\n }\n return typedDescriptor\n }\n}\n","import type {\n ClassType,\n ClassTypeWithInstance,\n InjectionToken,\n} from '@navios/di'\n\nimport type { CanActivate } from '../../interfaces/index.mjs'\n\nimport { UseGuards as OriginalUseGuards } from '../../decorators/use-guards.decorator.mjs'\nimport { createClassContext, createMethodContext } from '../context-compat.mjs'\n\n/**\n * Legacy-compatible UseGuards decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n * Can be applied to classes or methods.\n *\n * @param guards - Guard classes or injection tokens to apply\n * @returns A class or method decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * // Apply to a controller\n * @Controller()\n * @UseGuards(AuthGuard, RoleGuard)\n * export class UserController { }\n *\n * // Apply to a specific endpoint\n * @Controller()\n * export class UserController {\n * @Endpoint(getUserEndpoint)\n * @UseGuards(AuthGuard)\n * async getUser() { }\n * }\n * ```\n */\nexport function UseGuards(\n ...guards: (\n | ClassTypeWithInstance<CanActivate>\n | InjectionToken<CanActivate, undefined>\n )[]\n) {\n // Create the decorator function\n // Note: TypeScript's legacy decorator system has strict type checking for decorators\n // We use a flexible implementation that works for both class and method decorators\n function decoratorImpl(\n target: ClassType | Function,\n propertyKey?: string | symbol,\n descriptor?: PropertyDescriptor,\n ): any {\n // Determine if this is a class or method decorator\n if (propertyKey !== undefined && descriptor !== undefined) {\n // Method decorator\n const context = createMethodContext(\n target as Function,\n propertyKey,\n descriptor,\n )\n const originalDecorator = OriginalUseGuards(...guards)\n const result = originalDecorator(descriptor.value, context)\n if (result !== descriptor.value) {\n descriptor.value = result\n }\n return descriptor\n } else {\n // Class decorator\n const context = createClassContext(target as ClassType)\n const originalDecorator = OriginalUseGuards(...guards)\n return originalDecorator(target as ClassType, context)\n }\n }\n\n // Return with 'any' type to work around TypeScript's strict decorator checking\n // TypeScript's legacy decorator system cannot properly type-check decorators\n // that work as both class and method decorators. The runtime behavior is correct.\n // When used as a class decorator, it returns the class (preserving type at runtime)\n // When used as a method decorator, it returns the PropertyDescriptor\n // @ts-ignore - TypeScript limitation with dual-purpose legacy decorators\n return decoratorImpl as any\n}\n","import type { HttpHeader } from '../../interfaces/index.mjs'\n\nimport { Header as OriginalHeader } from '../../decorators/header.decorator.mjs'\nimport { createMethodContext } from '../context-compat.mjs'\n\n/**\n * Legacy-compatible Header decorator.\n * \n * Works with TypeScript experimental decorators (legacy API).\n * \n * @param name - The header name (e.g., 'Content-Type', 'Cache-Control')\n * @param value - The header value (string, number, or array of strings)\n * @returns A method decorator compatible with legacy decorator API\n * \n * @example\n * ```typescript\n * @Controller()\n * export class UserController {\n * @Endpoint(getUserEndpoint)\n * @Header('Cache-Control', 'max-age=3600')\n * async getUser() {\n * return { id: '1', name: 'John' }\n * }\n * }\n * ```\n */\nexport function Header(name: HttpHeader, value: string | number | string[]) {\n return function <T extends object>(\n target: T,\n propertyKey: string | symbol,\n descriptor: PropertyDescriptor,\n ) {\n const context = createMethodContext(target, propertyKey, descriptor)\n const originalDecorator = OriginalHeader(name, value)\n const result = originalDecorator(descriptor.value, context)\n if (result !== descriptor.value) {\n descriptor.value = result\n }\n return descriptor\n }\n}\n\n","import { HttpCode as OriginalHttpCode } from '../../decorators/http-code.decorator.mjs'\nimport { createMethodContext } from '../context-compat.mjs'\n\n/**\n * Legacy-compatible HttpCode decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n *\n * @param code - The HTTP status code to return (e.g., 201, 204, 202)\n * @returns A method decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Controller()\n * export class UserController {\n * @Endpoint(createUserEndpoint)\n * @HttpCode(201)\n * async createUser() {\n * return { id: '1', name: 'John' }\n * }\n * }\n * ```\n */\nexport function HttpCode(code: number) {\n return function <T extends object>(\n target: T,\n propertyKey: string | symbol,\n descriptor: PropertyDescriptor,\n ) {\n const context = createMethodContext(target, propertyKey, descriptor)\n const originalDecorator = OriginalHttpCode(code)\n const result = originalDecorator(descriptor.value, context)\n if (result !== descriptor.value) {\n descriptor.value = result\n }\n return descriptor\n }\n}\n","import type {\n BaseEndpointConfig,\n EndpointFunctionArgs,\n HttpMethod,\n} from '@navios/builder'\nimport type { z, ZodObject, ZodType } from 'zod/v4'\n\nimport { Multipart as OriginalMultipart } from '../../decorators/multipart.decorator.mjs'\nimport { createMethodContext } from '../context-compat.mjs'\n\n/**\n * Type helper to constrain a PropertyDescriptor's value to match a multipart endpoint signature.\n * Note: In legacy decorators, type constraints are checked when the decorator is applied,\n * but may not be preserved perfectly when decorators are stacked.\n */\ntype MultipartMethodDescriptor<\n Url extends string,\n QuerySchema,\n RequestSchema,\n ResponseSchema extends ZodType,\n> = TypedPropertyDescriptor<\n (\n params: QuerySchema extends ZodObject\n ? RequestSchema extends ZodType\n ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema, true>\n : EndpointFunctionArgs<Url, QuerySchema, undefined, true>\n : RequestSchema extends ZodType\n ? EndpointFunctionArgs<Url, undefined, RequestSchema, true>\n : EndpointFunctionArgs<Url, undefined, undefined, true>,\n ) => Promise<z.input<ResponseSchema>>\n>\n\n/**\n * Legacy-compatible Multipart decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n * Provides type safety by ensuring method signatures match the endpoint configuration.\n *\n * @param endpoint - The multipart endpoint declaration from @navios/builder\n * @returns A method decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Controller()\n * export class FileController {\n * @Multipart(uploadFileEndpoint)\n * async uploadFile(request: MultipartParams<typeof uploadFileEndpoint>): MultipartResult<typeof uploadFileEndpoint> {\n * const { file } = request.data\n * return { url: 'https://example.com/file.jpg' }\n * }\n * }\n * ```\n */\nexport function Multipart<\n Method extends HttpMethod = HttpMethod,\n Url extends string = string,\n QuerySchema = undefined,\n ResponseSchema extends ZodType = ZodType,\n RequestSchema = ZodType,\n>(endpoint: {\n config: BaseEndpointConfig<\n Method,\n Url,\n QuerySchema,\n ResponseSchema,\n RequestSchema\n >\n}) {\n return function <T extends object>(\n target: T,\n propertyKey: string | symbol,\n descriptor: MultipartMethodDescriptor<\n Url,\n QuerySchema,\n RequestSchema,\n ResponseSchema\n >,\n ): PropertyDescriptor | void {\n if (!descriptor) {\n throw new Error(\n '[Navios] @Multipart decorator requires a method descriptor. Make sure experimentalDecorators is enabled.',\n )\n }\n const context = createMethodContext(target, propertyKey, descriptor)\n const originalDecorator = OriginalMultipart(endpoint)\n // @ts-expect-error - we don't need to type the value\n const result = originalDecorator(descriptor.value, context)\n if (result !== descriptor.value) {\n descriptor.value = result as any\n }\n return descriptor\n }\n}\n","import type {\n BaseStreamConfig,\n EndpointFunctionArgs,\n HttpMethod,\n} from '@navios/builder'\nimport type { ZodObject, ZodType } from 'zod/v4'\n\nimport { Stream as OriginalStream } from '../../decorators/stream.decorator.mjs'\nimport { createMethodContext } from '../context-compat.mjs'\n\n/**\n * Type helper to constrain a PropertyDescriptor's value to match a stream endpoint signature.\n * Note: In legacy decorators, type constraints are checked when the decorator is applied,\n * but may not be preserved perfectly when decorators are stacked.\n */\ntype StreamMethodDescriptor<\n Url extends string,\n QuerySchema,\n RequestSchema,\n> = TypedPropertyDescriptor<\n (\n params: QuerySchema extends ZodObject\n ? RequestSchema extends ZodType\n ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema, true>\n : EndpointFunctionArgs<Url, QuerySchema, undefined, true>\n : RequestSchema extends ZodType\n ? EndpointFunctionArgs<Url, undefined, RequestSchema, true>\n : EndpointFunctionArgs<Url, undefined, undefined, true>,\n reply: any,\n ) => Promise<void>\n>\n\n/**\n * Legacy-compatible Stream decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n * Provides type safety by ensuring method signatures match the endpoint configuration.\n *\n * @param endpoint - The stream endpoint declaration from @navios/builder\n * @returns A method decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Controller()\n * export class FileController {\n * @Stream(downloadFileEndpoint)\n * async downloadFile(request: StreamParams<typeof downloadFileEndpoint>, reply: any) {\n * const { fileId } = request.urlParams\n * // Stream file data to reply\n * }\n * }\n * ```\n */\nexport function Stream<\n Method extends HttpMethod = HttpMethod,\n Url extends string = string,\n QuerySchema = undefined,\n RequestSchema = ZodType,\n>(endpoint: {\n config: BaseStreamConfig<Method, Url, QuerySchema, RequestSchema>\n}) {\n return function <T extends object>(\n target: T,\n propertyKey: string | symbol,\n descriptor: StreamMethodDescriptor<Url, QuerySchema, RequestSchema>,\n ) {\n const context = createMethodContext(target, propertyKey, descriptor)\n const originalDecorator = OriginalStream(endpoint)\n // @ts-expect-error - we don't need to type the value\n const result = originalDecorator(descriptor.value, context)\n if (result !== descriptor.value) {\n descriptor.value = result as any\n }\n return descriptor\n }\n}\n"],"mappings":";;;;;;;;GAYA,MAAMA,mCAAmB,IAAIC,SAAAA;;;GAK7B,SAASC,eAAeC,WAAc;AACpC,KAAI,CAACA,aAAa,OAAOA,cAAc,SACrC,QAAO;CAIT,MAAMC,cAAcD,UAAU;AAC9B,KAAIC,eAAe,OAAOA,gBAAgB,WACxC,QAAOA;AAET,QAAO;;;;GAMT,SAAgBC,mBAAmBC,QAAiB;AAElD,KAAI,CAACN,iBAAiBO,IAAID,OAAAA,CACxBN,kBAAiBQ,IAAIF,QAAQ,EAAC,CAAA;CAEhC,MAAMG,WAAWT,iBAAiBU,IAAIJ,OAAAA;AAEtC,QAAO;EACLK,MAAM;EACNC,MAAMN,OAAOM;EACbH;EACAI,iBAAAA;EAGF;;;;;;;GASF,SAAgBC,oBACdR,QACAS,aACAC,YAA8B;CAI9B,MAAMZ,cAAcF,eAAeI,OAAAA;AACnC,KAAI,CAACF,YACH,OAAM,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X,SAAgBM,OAKdG,UAED;AACC,QAAO,SACLC,QACAC,aACAC,YAAmE;EAEnE,MAAMC,UAAUL,oBAAoBE,QAAQC,aAAaC,WAAAA;EAGzD,MAAMG,SAFoBR,oCAAeE,SAAAA,CAERG,WAAWI,OAAOH,QAAAA;AACnD,MAAIE,WAAWH,WAAWI,MACxBJ,YAAWI,QAAQD;AAErB,SAAOH"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { G as MultipartParams, J as ModuleOptions, K as MultipartResult, U as StreamParams, at as CanActivate, in as EndpointResult, on as ControllerOptions, rn as EndpointParams, rt as HttpHeader } from "../index-Db1d3cwD.cjs";
|
|
2
2
|
import { ClassType, ClassTypeWithInstance, InjectionToken } from "@navios/di";
|
|
3
3
|
import { ZodObject, ZodType, z as z$1 } from "zod/v4";
|
|
4
4
|
import { BaseEndpointConfig, BaseStreamConfig, EndpointFunctionArgs, HttpMethod } from "@navios/builder";
|
|
@@ -157,7 +157,7 @@ declare function HttpCode(code: number): <T extends object>(target: T, propertyK
|
|
|
157
157
|
* Note: In legacy decorators, type constraints are checked when the decorator is applied,
|
|
158
158
|
* but may not be preserved perfectly when decorators are stacked.
|
|
159
159
|
*/
|
|
160
|
-
type MultipartMethodDescriptor<Url extends string, QuerySchema, RequestSchema, ResponseSchema extends ZodType> = TypedPropertyDescriptor<(params: QuerySchema extends ZodObject ? RequestSchema extends ZodType ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema> : EndpointFunctionArgs<Url, QuerySchema, undefined> : RequestSchema extends ZodType ? EndpointFunctionArgs<Url, undefined, RequestSchema> : EndpointFunctionArgs<Url, undefined, undefined>) => Promise<z$1.input<ResponseSchema>>>;
|
|
160
|
+
type MultipartMethodDescriptor<Url extends string, QuerySchema, RequestSchema, ResponseSchema extends ZodType> = TypedPropertyDescriptor<(params: QuerySchema extends ZodObject ? RequestSchema extends ZodType ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema, true> : EndpointFunctionArgs<Url, QuerySchema, undefined, true> : RequestSchema extends ZodType ? EndpointFunctionArgs<Url, undefined, RequestSchema, true> : EndpointFunctionArgs<Url, undefined, undefined, true>) => Promise<z$1.input<ResponseSchema>>>;
|
|
161
161
|
/**
|
|
162
162
|
* Legacy-compatible Multipart decorator.
|
|
163
163
|
*
|
|
@@ -189,7 +189,7 @@ declare function Multipart<Method extends HttpMethod = HttpMethod, Url extends s
|
|
|
189
189
|
* Note: In legacy decorators, type constraints are checked when the decorator is applied,
|
|
190
190
|
* but may not be preserved perfectly when decorators are stacked.
|
|
191
191
|
*/
|
|
192
|
-
type StreamMethodDescriptor<Url extends string, QuerySchema, RequestSchema> = TypedPropertyDescriptor<(params: QuerySchema extends ZodObject ? RequestSchema extends ZodType ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema> : EndpointFunctionArgs<Url, QuerySchema, undefined> : RequestSchema extends ZodType ? EndpointFunctionArgs<Url, undefined, RequestSchema> : EndpointFunctionArgs<Url, undefined, undefined>, reply: any) => Promise<void>>;
|
|
192
|
+
type StreamMethodDescriptor<Url extends string, QuerySchema, RequestSchema> = TypedPropertyDescriptor<(params: QuerySchema extends ZodObject ? RequestSchema extends ZodType ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema, true> : EndpointFunctionArgs<Url, QuerySchema, undefined, true> : RequestSchema extends ZodType ? EndpointFunctionArgs<Url, undefined, RequestSchema, true> : EndpointFunctionArgs<Url, undefined, undefined, true>, reply: any) => Promise<void>>;
|
|
193
193
|
/**
|
|
194
194
|
* Legacy-compatible Stream decorator.
|
|
195
195
|
*
|
|
@@ -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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A,EKmCvC,gBLnCuC,CKmCtB,MLnCsB,EKmCd,GLnCc,EKmCT,WLnCS,EKmCI,aLnCJ,CAAA;CAAvC,CAAA,EAAA,CAAA,UAAA,MAAA,CAAA,CAAA,MAAA,EKsCE,CLtCF,EAAA,WAAA,EAAA,MAAA,GAAA,MAAA,EAAA,UAAA,EKwCM,sBLxCN,CKwC6B,GLxC7B,EKwCkC,WLxClC,EKwC+C,aLxC/C,CAAA,EAAA,GKwC6D,sBLxC7D,CKwC6D,GLxC7D,EKwC6D,WLxC7D,EKwC6D,aLxC7D,CAAA"}
|
|
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"],"sourcesContent":[],"mappings":";;;;;;;;;;;AAuBA;;;;;;;;ACCA;;;;;;iBDDgB,MAAA,WACL,yBAMgB,cAAS;;;;;;;AAPpC;;;;;;;;ACCA;;;;;iBAAgB,UAAA,WAAoB,6BACT,cAAS;;;;;;;ADFpC;KERK,wBFSM,CAAA,YAAA,MAAA,EAAA,WAAA,EAAA,aAAA,EAAA,uBELc,OFKd,CAAA,GEJP,uBFIO,CAAA,CAAA,MAAA,EEFC,WFED,SEFqB,OFErB,GEDH,aFCG,SEDmB,OFCnB,GEAD,oBFAC,CEAoB,GFApB,EEAyB,WFAzB,EEAsC,aFAtC,EAAA,IAAA,CAAA,GECD,oBFDC,CECoB,GFDpB,EECyB,WFDzB,EAAA,SAAA,EAAA,IAAA,CAAA,GEEH,aFFG,SEEmB,OFFnB,GEGD,oBFHC,CEGoB,GFHpB,EAAA,SAAA,EEGoC,aFHpC,EAAA,IAAA,CAAA,GEID,oB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A,EAAA,aAAA,CAAA,GOLP,uBPKO,CAAA,CAAA,MAAA,EOHC,WPGD,SOHqB,SPGrB,GOFH,aPEG,SOFmB,OPEnB,GODD,oBPCC,CODoB,GPCpB,EODyB,WPCzB,EODsC,aPCtC,EAAA,IAAA,CAAA,GOAD,oBPAC,COAoB,GPApB,EOAyB,WPAzB,EAAA,SAAA,EAAA,IAAA,CAAA,GOCH,aPDG,SOCmB,OPDnB,GOED,oBPFC,COEoB,GPFpB,EAAA,SAAA,EOEoC,aPFpC,EAAA,IAAA,CAAA,GOGD,oBPHC,COGoB,GPHpB,EAAA,SAAA,EAAA,SAAA,EAAA,IAAA,CAAA,EAAA,KAAA,EAAA,GAAA,EAAA,GOKJ,OPLI,CAAA,IAAA,CAAA,CAAA;;;;;;;ACAX;;;;;;;;ACnBwC;;;;;;;AAmBJ,iBK6BpB,ML7BoB,CAAA,eK8BnB,UL9BmB,GK8BN,UL9BM,EAAA,YAAA,MAAA,GAAA,MAAA,EAAA,cAAA,SAAA,EAAA,gBKiClB,OLjCkB,CAAA,CAAA,QAAA,EAAA;EAAa,MAAA,EKmCvC,gBLnCuC,CKmCtB,MLnCsB,EKmCd,GLnCc,EKmCT,WLnCS,EKmCI,aLnCJ,CAAA;CAAvC,CAAA,EAAA,CAAA,UAAA,MAAA,CAAA,CAAA,MAAA,EKsCE,CLtCF,EAAA,WAAA,EAAA,MAAA,GAAA,MAAA,EAAA,UAAA,EKwCM,sBLxCN,CKwC6B,GLxC7B,EKwCkC,WLxClC,EKwC+C,aLxC/C,CAAA,EAAA,GKwC6D,sBLxC7D,CKwC6D,GLxC7D,EKwC6D,WLxC7D,EKwC6D,aLxC7D,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { G as MultipartParams, J as ModuleOptions, K as MultipartResult, U as StreamParams, at as CanActivate, in as EndpointResult, on as ControllerOptions, rn as EndpointParams, rt as HttpHeader } from "../index-D9MNh6Tx.mjs";
|
|
2
2
|
import { ClassType, ClassTypeWithInstance, InjectionToken } from "@navios/di";
|
|
3
3
|
import { ZodObject, ZodType, z as z$1 } from "zod/v4";
|
|
4
4
|
import { BaseEndpointConfig, BaseStreamConfig, EndpointFunctionArgs, HttpMethod } from "@navios/builder";
|
|
@@ -157,7 +157,7 @@ declare function HttpCode(code: number): <T extends object>(target: T, propertyK
|
|
|
157
157
|
* Note: In legacy decorators, type constraints are checked when the decorator is applied,
|
|
158
158
|
* but may not be preserved perfectly when decorators are stacked.
|
|
159
159
|
*/
|
|
160
|
-
type MultipartMethodDescriptor<Url extends string, QuerySchema, RequestSchema, ResponseSchema extends ZodType> = TypedPropertyDescriptor<(params: QuerySchema extends ZodObject ? RequestSchema extends ZodType ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema> : EndpointFunctionArgs<Url, QuerySchema, undefined> : RequestSchema extends ZodType ? EndpointFunctionArgs<Url, undefined, RequestSchema> : EndpointFunctionArgs<Url, undefined, undefined>) => Promise<z$1.input<ResponseSchema>>>;
|
|
160
|
+
type MultipartMethodDescriptor<Url extends string, QuerySchema, RequestSchema, ResponseSchema extends ZodType> = TypedPropertyDescriptor<(params: QuerySchema extends ZodObject ? RequestSchema extends ZodType ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema, true> : EndpointFunctionArgs<Url, QuerySchema, undefined, true> : RequestSchema extends ZodType ? EndpointFunctionArgs<Url, undefined, RequestSchema, true> : EndpointFunctionArgs<Url, undefined, undefined, true>) => Promise<z$1.input<ResponseSchema>>>;
|
|
161
161
|
/**
|
|
162
162
|
* Legacy-compatible Multipart decorator.
|
|
163
163
|
*
|
|
@@ -189,7 +189,7 @@ declare function Multipart<Method extends HttpMethod = HttpMethod, Url extends s
|
|
|
189
189
|
* Note: In legacy decorators, type constraints are checked when the decorator is applied,
|
|
190
190
|
* but may not be preserved perfectly when decorators are stacked.
|
|
191
191
|
*/
|
|
192
|
-
type StreamMethodDescriptor<Url extends string, QuerySchema, RequestSchema> = TypedPropertyDescriptor<(params: QuerySchema extends ZodObject ? RequestSchema extends ZodType ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema> : EndpointFunctionArgs<Url, QuerySchema, undefined> : RequestSchema extends ZodType ? EndpointFunctionArgs<Url, undefined, RequestSchema> : EndpointFunctionArgs<Url, undefined, undefined>, reply: any) => Promise<void>>;
|
|
192
|
+
type StreamMethodDescriptor<Url extends string, QuerySchema, RequestSchema> = TypedPropertyDescriptor<(params: QuerySchema extends ZodObject ? RequestSchema extends ZodType ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema, true> : EndpointFunctionArgs<Url, QuerySchema, undefined, true> : RequestSchema extends ZodType ? EndpointFunctionArgs<Url, undefined, RequestSchema, true> : EndpointFunctionArgs<Url, undefined, undefined, true>, reply: any) => Promise<void>>;
|
|
193
193
|
/**
|
|
194
194
|
* Legacy-compatible Stream decorator.
|
|
195
195
|
*
|
|
@@ -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"],"sourcesContent":[],"mappings":";;;;;;;;;;;AAuBA;;;;;;;;ACCA;;;;;;iBDDgB,MAAA,WACL,yBAMgB,cAAS;;;;;;;AAPpC;;;;;;;;ACCA;;;;;iBAAgB,UAAA,WAAoB,6BACT,cAAS;;;;;;;ADFpC;KERK,wBFSM,CAAA,YAAA,MAAA,EAAA,WAAA,EAAA,aAAA,EAAA,uBELc,OFKd,CAAA,GEJP,uBFIO,CAAA,CAAA,MAAA,EEFC,WFED,SEFqB,OFErB,GEDH,aFCG,SEDmB,OFCnB,GEAD,oBFAC,CEAoB,GFApB,EEAyB,W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../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"],"sourcesContent":[],"mappings":";;;;;;;;;;;AAuBA;;;;;;;;ACCA;;;;;;iBDDgB,MAAA,WACL,yBAMgB,cAAS;;;;;;;AAPpC;;;;;;;;ACCA;;;;;iBAAgB,UAAA,WAAoB,6BACT,cAAS;;;;;;;ADFpC;KERK,wBFSM,CAAA,YAAA,MAAA,EAAA,WAAA,EAAA,aAAA,EAAA,uBELc,OFKd,CAAA,GEJP,uBFIO,CAAA,CAAA,MAAA,EEFC,WFED,SEFqB,OFErB,GEDH,aFCG,SEDmB,OFCnB,GEAD,oBFAC,CEAoB,GFApB,EEAyB,WFAzB,EEAsC,aFAtC,EAAA,IAAA,CAAA,GECD,oBFDC,CECoB,GFDpB,EECyB,WFDzB,EAAA,SAAA,EAAA,IAAA,CAAA,GEEH,aFFG,SEEmB,OFFnB,GEGD,oBFHC,CEGoB,GFHpB,EAAA,SAAA,EEGoC,aFHpC,EAAA,IAAA,CAAA,GEID,oBFJC,CEIoB,GFJpB,EAAA,SAAA,EAAA,SAAA,EAAA,IAAA,CAAA,EAAA,GEKJ,OFLI,CEKI,GAAA,CAAE,KFLN,CEKY,cFLZ,CAAA,CAAA,CAAA;;;;;;;ACAX;;;;;;;;ACnBwC;;;;;;AAmBT,iBA4Bf,QA5Be,CAAA,eA6Bd,UA7Bc,GA6BD,UA7BC,EAAA,YAAA,MAAA,GAAA,MAAA,EAAA,cAAA,SAAA,EAAA,uBAgCN,OAhCM,GAgCI,OAhCJ,EAAA,gBAiCb,OAjCa,CAAA,CAAA,QAAA,EAAA;EAAK,MAAA,EAmC1B,kBAnC0B,CAoChC,MApCgC,EAqChC,GArCgC,EAsChC,WA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EAAA,GOKJ,OPLI,CAAA,IAAA,CAAA,CAAA;;;;;;;ACAX;;;;;;;;ACnBwC;;;;;;;AAmBJ,iBK6BpB,ML7BoB,CAAA,eK8BnB,UL9BmB,GK8BN,UL9BM,EAAA,YAAA,MAAA,GAAA,MAAA,EAAA,cAAA,SAAA,EAAA,gBKiClB,OLjCkB,CAAA,CAAA,QAAA,EAAA;EAAa,MAAA,EKmCvC,gBLnCuC,CKmCtB,MLnCsB,EKmCd,GLnCc,EKmCT,WLnCS,EKmCI,aLnCJ,CAAA;CAAvC,CAAA,EAAA,CAAA,UAAA,MAAA,CAAA,CAAA,MAAA,EKsCE,CLtCF,EAAA,WAAA,EAAA,MAAA,GAAA,MAAA,EAAA,UAAA,EKwCM,sBLxCN,CKwC6B,GLxC7B,EKwCkC,WLxClC,EKwC+C,aLxC/C,CAAA,EAAA,GKwC6D,sBLxC7D,CKwC6D,GLxC7D,EKwC6D,WLxC7D,EKwC6D,aLxC7D,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as HttpCode$1, i as Module$1, n as Stream$1, o as Header$1, r as Multipart$1, s as Endpoint$1, t as UseGuards$1, v as Controller$1 } from "../use-guards.decorator-
|
|
1
|
+
import { a as HttpCode$1, i as Module$1, n as Stream$1, o as Header$1, r as Multipart$1, s as Endpoint$1, t as UseGuards$1, v as Controller$1 } from "../use-guards.decorator-CzVXuLkz.mjs";
|
|
2
2
|
|
|
3
3
|
//#region src/legacy-compat/context-compat.mts
|
|
4
4
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":["classMetadataMap","WeakMap","getConstructor","prototype","constructor","createClassContext","target","has","set","metadata","get","kind","name","addInitializer","createMethodContext","propertyKey","descriptor","Error","static","private","access","value","Module","OriginalModule","createClassContext","options","controllers","imports","guards","target","context","originalDecorator","Controller","OriginalController","createClassContext","options","target","context","originalDecorator","Endpoint","OriginalEndpoint","createMethodContext","endpoint","target","propertyKey","descriptor","Error","typedDescriptor","context","originalDecorator","result","value","UseGuards","OriginalUseGuards","createClassContext","createMethodContext","guards","decoratorImpl","target","propertyKey","descriptor","undefined","context","originalDecorator","result","value","Header","OriginalHeader","createMethodContext","name","value","target","propertyKey","descriptor","context","originalDecorator","result","HttpCode","OriginalHttpCode","createMethodContext","code","target","propertyKey","descriptor","context","originalDecorator","result","value","Multipart","OriginalMultipart","createMethodContext","endpoint","target","propertyKey","descriptor","Error","context","originalDecorator","result","value","Stream","OriginalStream","createMethodContext","endpoint","target","propertyKey","descriptor","context","originalDecorator","result","value"],"sources":["../../src/legacy-compat/context-compat.mts","../../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"],"sourcesContent":["/**\n * Compatibility layer for converting legacy decorator signatures to Stage 3 format.\n *\n * This module provides utilities to create mock Stage 3 decorator contexts\n * from legacy decorator arguments, and manages metadata storage using WeakMap.\n */\n\nimport type { ClassType } from '@navios/di'\n\n// WeakMap to store metadata for legacy decorators\n// Keyed by class constructor for class decorators\n// For method decorators, we use the class constructor (extracted from the prototype)\nconst classMetadataMap = new WeakMap<ClassType, Record<string | symbol, any>>()\n\n/**\n * Gets the constructor from a prototype (for method decorators).\n */\nfunction getConstructor(prototype: any): ClassType | null {\n if (!prototype || typeof prototype !== 'object') {\n return null\n }\n // In legacy decorators, target is the prototype\n // The constructor is typically available via prototype.constructor\n const constructor = prototype.constructor\n if (constructor && typeof constructor === 'function') {\n return constructor as ClassType\n }\n return null\n}\n\n/**\n * Creates a mock ClassDecoratorContext for legacy class decorators.\n */\nexport function createClassContext(target: ClassType): ClassDecoratorContext {\n // Get or create metadata storage for this class\n if (!classMetadataMap.has(target)) {\n classMetadataMap.set(target, {})\n }\n const metadata = classMetadataMap.get(target)!\n\n return {\n kind: 'class',\n name: target.name,\n metadata,\n addInitializer() {\n // Legacy decorators don't support initializers\n },\n } as ClassDecoratorContext\n}\n\n/**\n * Creates a mock ClassMethodDecoratorContext for legacy method decorators.\n *\n * Note: Method decorators need to share metadata with the class context\n * because endpoint metadata is stored at the class level.\n */\nexport function createMethodContext(\n target: any,\n propertyKey: string | symbol,\n descriptor: PropertyDescriptor,\n): ClassMethodDecoratorContext {\n // For method decorators, target is the prototype\n // We need to get the class constructor to access class-level metadata\n const constructor = getConstructor(target)\n if (!constructor) {\n throw new Error(\n '[Navios] Could not determine class constructor from method decorator target.',\n )\n }\n\n // Get or create metadata storage for the class\n // Method decorators share metadata with the class\n if (!classMetadataMap.has(constructor)) {\n classMetadataMap.set(constructor, {})\n }\n const metadata = classMetadataMap.get(constructor)!\n\n return {\n kind: 'method',\n name: propertyKey,\n metadata,\n static: false, // We can't determine this from legacy decorators\n private: false, // We can't determine this from legacy decorators\n access: {\n has: () => true,\n get: () => descriptor.value,\n set: () => {},\n },\n addInitializer() {\n // Legacy decorators don't support initializers\n },\n } as ClassMethodDecoratorContext\n}\n","import type { ClassType } from '@navios/di'\n\nimport { Module as OriginalModule, type ModuleOptions } from '../../decorators/module.decorator.mjs'\nimport { createClassContext } from '../context-compat.mjs'\n\n/**\n * Legacy-compatible Module decorator.\n * \n * Works with TypeScript experimental decorators (legacy API).\n * \n * @param options - Module configuration options\n * @returns A class decorator compatible with legacy decorator API\n * \n * @example\n * ```typescript\n * @Module({\n * controllers: [UserController, AuthController],\n * imports: [DatabaseModule],\n * guards: [AuthGuard],\n * })\n * export class AppModule {}\n * ```\n */\nexport function Module(\n options: ModuleOptions = {\n controllers: [],\n imports: [],\n guards: [],\n },\n) {\n return function (target: ClassType) {\n const context = createClassContext(target)\n const originalDecorator = OriginalModule(options)\n return originalDecorator(target, context)\n }\n}\n\n","import type { ClassType } from '@navios/di'\n\nimport type { ControllerOptions } from '../../decorators/controller.decorator.mjs'\n\nimport { Controller as OriginalController } from '../../decorators/controller.decorator.mjs'\nimport { createClassContext } from '../context-compat.mjs'\n\n/**\n * Legacy-compatible Controller decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n *\n * @param options - Controller configuration options\n * @returns A class decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Controller({ guards: [AuthGuard] })\n * export class UserController {\n * @Endpoint(getUserEndpoint)\n * async getUser() { }\n * }\n * ```\n */\nexport function Controller(options: ControllerOptions = {}) {\n return function (target: ClassType) {\n const context = createClassContext(target)\n const originalDecorator = OriginalController(options)\n return originalDecorator(target, context)\n }\n}\n","import type {\n BaseEndpointConfig,\n EndpointFunctionArgs,\n HttpMethod,\n} from '@navios/builder'\nimport type { z, ZodType } from 'zod/v4'\n\nimport { Endpoint as OriginalEndpoint } from '../../decorators/endpoint.decorator.mjs'\nimport { createMethodContext } from '../context-compat.mjs'\n\n/**\n * Type helper to constrain a PropertyDescriptor's value to match an endpoint signature.\n * Note: In legacy decorators, type constraints are checked when the decorator is applied,\n * but may not be preserved perfectly when decorators are stacked.\n */\ntype EndpointMethodDescriptor<\n Url extends string,\n QuerySchema,\n RequestSchema,\n ResponseSchema extends ZodType,\n> = TypedPropertyDescriptor<\n (\n params: QuerySchema extends ZodType\n ? RequestSchema extends ZodType\n ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema, true>\n : EndpointFunctionArgs<Url, QuerySchema, undefined, true>\n : RequestSchema extends ZodType\n ? EndpointFunctionArgs<Url, undefined, RequestSchema, true>\n : EndpointFunctionArgs<Url, undefined, undefined, true>,\n ) => Promise<z.input<ResponseSchema>>\n>\n\n/**\n * Legacy-compatible Endpoint decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n * Provides type safety by ensuring method signatures match the endpoint configuration.\n *\n * @param endpoint - The endpoint declaration from @navios/builder\n * @returns A method decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Controller()\n * export class UserController {\n * @Endpoint(getUserEndpoint)\n * async getUser(request: EndpointParams<typeof getUserEndpoint>): EndpointResult<typeof getUserEndpoint> {\n * return { id: '1', name: 'John' }\n * }\n * }\n * ```\n */\nexport function Endpoint<\n Method extends HttpMethod = HttpMethod,\n Url extends string = string,\n QuerySchema = undefined,\n ResponseSchema extends ZodType = ZodType,\n RequestSchema = ZodType,\n>(endpoint: {\n config: BaseEndpointConfig<\n Method,\n Url,\n QuerySchema,\n ResponseSchema,\n RequestSchema\n >\n}) {\n return function (\n target: any,\n propertyKey: string | symbol,\n descriptor: EndpointMethodDescriptor<\n Url,\n QuerySchema,\n RequestSchema,\n ResponseSchema\n >,\n ): PropertyDescriptor | void {\n if (!descriptor) {\n throw new Error(\n '[Navios] @Endpoint decorator requires a method descriptor. Make sure experimentalDecorators is enabled.',\n )\n }\n // Type check the descriptor value matches expected signature\n const typedDescriptor = descriptor as EndpointMethodDescriptor<\n Url,\n QuerySchema,\n RequestSchema,\n ResponseSchema\n >\n const context = createMethodContext(target, propertyKey, typedDescriptor)\n const originalDecorator = OriginalEndpoint(endpoint)\n // @ts-expect-error - we don't need to type the value\n const result = originalDecorator(typedDescriptor.value, context)\n if (result !== typedDescriptor.value) {\n typedDescriptor.value = result as any\n }\n return typedDescriptor\n }\n}\n","import type {\n ClassType,\n ClassTypeWithInstance,\n InjectionToken,\n} from '@navios/di'\n\nimport type { CanActivate } from '../../interfaces/index.mjs'\n\nimport { UseGuards as OriginalUseGuards } from '../../decorators/use-guards.decorator.mjs'\nimport { createClassContext, createMethodContext } from '../context-compat.mjs'\n\n/**\n * Legacy-compatible UseGuards decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n * Can be applied to classes or methods.\n *\n * @param guards - Guard classes or injection tokens to apply\n * @returns A class or method decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * // Apply to a controller\n * @Controller()\n * @UseGuards(AuthGuard, RoleGuard)\n * export class UserController { }\n *\n * // Apply to a specific endpoint\n * @Controller()\n * export class UserController {\n * @Endpoint(getUserEndpoint)\n * @UseGuards(AuthGuard)\n * async getUser() { }\n * }\n * ```\n */\nexport function UseGuards(\n ...guards: (\n | ClassTypeWithInstance<CanActivate>\n | InjectionToken<CanActivate, undefined>\n )[]\n) {\n // Create the decorator function\n // Note: TypeScript's legacy decorator system has strict type checking for decorators\n // We use a flexible implementation that works for both class and method decorators\n function decoratorImpl(\n target: ClassType | Function,\n propertyKey?: string | symbol,\n descriptor?: PropertyDescriptor,\n ): any {\n // Determine if this is a class or method decorator\n if (propertyKey !== undefined && descriptor !== undefined) {\n // Method decorator\n const context = createMethodContext(\n target as Function,\n propertyKey,\n descriptor,\n )\n const originalDecorator = OriginalUseGuards(...guards)\n const result = originalDecorator(descriptor.value, context)\n if (result !== descriptor.value) {\n descriptor.value = result\n }\n return descriptor\n } else {\n // Class decorator\n const context = createClassContext(target as ClassType)\n const originalDecorator = OriginalUseGuards(...guards)\n return originalDecorator(target as ClassType, context)\n }\n }\n\n // Return with 'any' type to work around TypeScript's strict decorator checking\n // TypeScript's legacy decorator system cannot properly type-check decorators\n // that work as both class and method decorators. The runtime behavior is correct.\n // When used as a class decorator, it returns the class (preserving type at runtime)\n // When used as a method decorator, it returns the PropertyDescriptor\n // @ts-ignore - TypeScript limitation with dual-purpose legacy decorators\n return decoratorImpl as any\n}\n","import type { HttpHeader } from '../../interfaces/index.mjs'\n\nimport { Header as OriginalHeader } from '../../decorators/header.decorator.mjs'\nimport { createMethodContext } from '../context-compat.mjs'\n\n/**\n * Legacy-compatible Header decorator.\n * \n * Works with TypeScript experimental decorators (legacy API).\n * \n * @param name - The header name (e.g., 'Content-Type', 'Cache-Control')\n * @param value - The header value (string, number, or array of strings)\n * @returns A method decorator compatible with legacy decorator API\n * \n * @example\n * ```typescript\n * @Controller()\n * export class UserController {\n * @Endpoint(getUserEndpoint)\n * @Header('Cache-Control', 'max-age=3600')\n * async getUser() {\n * return { id: '1', name: 'John' }\n * }\n * }\n * ```\n */\nexport function Header(name: HttpHeader, value: string | number | string[]) {\n return function <T extends object>(\n target: T,\n propertyKey: string | symbol,\n descriptor: PropertyDescriptor,\n ) {\n const context = createMethodContext(target, propertyKey, descriptor)\n const originalDecorator = OriginalHeader(name, value)\n const result = originalDecorator(descriptor.value, context)\n if (result !== descriptor.value) {\n descriptor.value = result\n }\n return descriptor\n }\n}\n\n","import { HttpCode as OriginalHttpCode } from '../../decorators/http-code.decorator.mjs'\nimport { createMethodContext } from '../context-compat.mjs'\n\n/**\n * Legacy-compatible HttpCode decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n *\n * @param code - The HTTP status code to return (e.g., 201, 204, 202)\n * @returns A method decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Controller()\n * export class UserController {\n * @Endpoint(createUserEndpoint)\n * @HttpCode(201)\n * async createUser() {\n * return { id: '1', name: 'John' }\n * }\n * }\n * ```\n */\nexport function HttpCode(code: number) {\n return function <T extends object>(\n target: T,\n propertyKey: string | symbol,\n descriptor: PropertyDescriptor,\n ) {\n const context = createMethodContext(target, propertyKey, descriptor)\n const originalDecorator = OriginalHttpCode(code)\n const result = originalDecorator(descriptor.value, context)\n if (result !== descriptor.value) {\n descriptor.value = result\n }\n return descriptor\n }\n}\n","import type {\n BaseEndpointConfig,\n EndpointFunctionArgs,\n HttpMethod,\n} from '@navios/builder'\nimport type { z, ZodObject, ZodType } from 'zod/v4'\n\nimport { Multipart as OriginalMultipart } from '../../decorators/multipart.decorator.mjs'\nimport { createMethodContext } from '../context-compat.mjs'\n\n/**\n * Type helper to constrain a PropertyDescriptor's value to match a multipart endpoint signature.\n * Note: In legacy decorators, type constraints are checked when the decorator is applied,\n * but may not be preserved perfectly when decorators are stacked.\n */\ntype MultipartMethodDescriptor<\n Url extends string,\n QuerySchema,\n RequestSchema,\n ResponseSchema extends ZodType,\n> = TypedPropertyDescriptor<\n (\n params: QuerySchema extends ZodObject\n ? RequestSchema extends ZodType\n ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema>\n : EndpointFunctionArgs<Url, QuerySchema, undefined>\n : RequestSchema extends ZodType\n ? EndpointFunctionArgs<Url, undefined, RequestSchema>\n : EndpointFunctionArgs<Url, undefined, undefined>,\n ) => Promise<z.input<ResponseSchema>>\n>\n\n/**\n * Legacy-compatible Multipart decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n * Provides type safety by ensuring method signatures match the endpoint configuration.\n *\n * @param endpoint - The multipart endpoint declaration from @navios/builder\n * @returns A method decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Controller()\n * export class FileController {\n * @Multipart(uploadFileEndpoint)\n * async uploadFile(request: MultipartParams<typeof uploadFileEndpoint>): MultipartResult<typeof uploadFileEndpoint> {\n * const { file } = request.data\n * return { url: 'https://example.com/file.jpg' }\n * }\n * }\n * ```\n */\nexport function Multipart<\n Method extends HttpMethod = HttpMethod,\n Url extends string = string,\n QuerySchema = undefined,\n ResponseSchema extends ZodType = ZodType,\n RequestSchema = ZodType,\n>(endpoint: {\n config: BaseEndpointConfig<\n Method,\n Url,\n QuerySchema,\n ResponseSchema,\n RequestSchema\n >\n}) {\n return function <T extends object>(\n target: T,\n propertyKey: string | symbol,\n descriptor: MultipartMethodDescriptor<\n Url,\n QuerySchema,\n RequestSchema,\n ResponseSchema\n >,\n ): PropertyDescriptor | void {\n if (!descriptor) {\n throw new Error(\n '[Navios] @Multipart decorator requires a method descriptor. Make sure experimentalDecorators is enabled.',\n )\n }\n const context = createMethodContext(target, propertyKey, descriptor)\n const originalDecorator = OriginalMultipart(endpoint)\n // @ts-expect-error - we don't need to type the value\n const result = originalDecorator(descriptor.value, context)\n if (result !== descriptor.value) {\n descriptor.value = result as any\n }\n return descriptor\n }\n}\n","import type {\n BaseStreamConfig,\n EndpointFunctionArgs,\n HttpMethod,\n} from '@navios/builder'\nimport type { ZodObject, ZodType } from 'zod/v4'\n\nimport { Stream as OriginalStream } from '../../decorators/stream.decorator.mjs'\nimport { createMethodContext } from '../context-compat.mjs'\n\n/**\n * Type helper to constrain a PropertyDescriptor's value to match a stream endpoint signature.\n * Note: In legacy decorators, type constraints are checked when the decorator is applied,\n * but may not be preserved perfectly when decorators are stacked.\n */\ntype StreamMethodDescriptor<\n Url extends string,\n QuerySchema,\n RequestSchema,\n> = TypedPropertyDescriptor<\n (\n params: QuerySchema extends ZodObject\n ? RequestSchema extends ZodType\n ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema>\n : EndpointFunctionArgs<Url, QuerySchema, undefined>\n : RequestSchema extends ZodType\n ? EndpointFunctionArgs<Url, undefined, RequestSchema>\n : EndpointFunctionArgs<Url, undefined, undefined>,\n reply: any,\n ) => Promise<void>\n>\n\n/**\n * Legacy-compatible Stream decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n * Provides type safety by ensuring method signatures match the endpoint configuration.\n *\n * @param endpoint - The stream endpoint declaration from @navios/builder\n * @returns A method decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Controller()\n * export class FileController {\n * @Stream(downloadFileEndpoint)\n * async downloadFile(request: StreamParams<typeof downloadFileEndpoint>, reply: any) {\n * const { fileId } = request.urlParams\n * // Stream file data to reply\n * }\n * }\n * ```\n */\nexport function Stream<\n Method extends HttpMethod = HttpMethod,\n Url extends string = string,\n QuerySchema = undefined,\n RequestSchema = ZodType,\n>(endpoint: {\n config: BaseStreamConfig<Method, Url, QuerySchema, RequestSchema>\n}) {\n return function <T extends object>(\n target: T,\n propertyKey: string | symbol,\n descriptor: StreamMethodDescriptor<Url, QuerySchema, RequestSchema>,\n ) {\n const context = createMethodContext(target, propertyKey, descriptor)\n const originalDecorator = OriginalStream(endpoint)\n // @ts-expect-error - we don't need to type the value\n const result = originalDecorator(descriptor.value, context)\n if (result !== descriptor.value) {\n descriptor.value = result as any\n }\n return descriptor\n }\n}\n"],"mappings":";;;;;;;;GAYA,MAAMA,mCAAmB,IAAIC,SAAAA;;;GAK7B,SAASC,eAAeC,WAAc;AACpC,KAAI,CAACA,aAA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AAA,CACVG,WAAWI,OAAOH,QAAAA;AACnD,MAAIE,WAAWH,WAAWI,MACxBJ,YAAWI,QAAQD;AAErB,SAAOH;;;;;;;;;;;;;;;;;;;;;;;;;;GCkBX,SAAgBK,UAMdG,UAQD;AACC,QAAO,SACLC,QACAC,aACAC,YAKC;AAED,MAAI,CAACA,WACH,OAAM,IAAIC,MACR,2GAAA;EAGJ,MAAMC,UAAUN,oBAAoBE,QAAQC,aAAaC,WAAAA;EAGzD,MAAMI,SAFoBT,YAAkBE,SAAAA,CAEXG,WAAWK,OAAOH,QAAAA;AACnD,MAAIE,WAAWJ,WAAWK,MACxBL,YAAWK,QAAQD;AAErB,SAAOJ;;;;;;;;;;;;;;;;;;;;;;;;;;GCrCX,SAAgBM,OAKdG,UAED;AACC,QAAO,SACLC,QACAC,aACAC,YAAmE;EAEnE,MAAMC,UAAUL,oBAAoBE,QAAQC,aAAaC,WAAAA;EAGzD,MAAMG,SAFoBR,SAAeE,SAAAA,CAERG,WAAWI,OAAOH,QAAAA;AACnD,MAAIE,WAAWH,WAAWI,MACxBJ,YAAWI,QAAQD;AAErB,SAAOH"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":["classMetadataMap","WeakMap","getConstructor","prototype","constructor","createClassContext","target","has","set","metadata","get","kind","name","addInitializer","createMethodContext","propertyKey","descriptor","Error","static","private","access","value","Module","OriginalModule","createClassContext","options","controllers","imports","guards","target","context","originalDecorator","Controller","OriginalController","createClassContext","options","target","context","originalDecorator","Endpoint","OriginalEndpoint","createMethodContext","endpoint","target","propertyKey","descriptor","Error","typedDescriptor","context","originalDecorator","result","value","UseGuards","OriginalUseGuards","createClassContext","createMethodContext","guards","decoratorImpl","target","propertyKey","descriptor","undefined","context","originalDecorator","result","value","Header","OriginalHeader","createMethodContext","name","value","target","propertyKey","descriptor","context","originalDecorator","result","HttpCode","OriginalHttpCode","createMethodContext","code","target","propertyKey","descriptor","context","originalDecorator","result","value","Multipart","OriginalMultipart","createMethodContext","endpoint","target","propertyKey","descriptor","Error","context","originalDecorator","result","value","Stream","OriginalStream","createMethodContext","endpoint","target","propertyKey","descriptor","context","originalDecorator","result","value"],"sources":["../../src/legacy-compat/context-compat.mts","../../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"],"sourcesContent":["/**\n * Compatibility layer for converting legacy decorator signatures to Stage 3 format.\n *\n * This module provides utilities to create mock Stage 3 decorator contexts\n * from legacy decorator arguments, and manages metadata storage using WeakMap.\n */\n\nimport type { ClassType } from '@navios/di'\n\n// WeakMap to store metadata for legacy decorators\n// Keyed by class constructor for class decorators\n// For method decorators, we use the class constructor (extracted from the prototype)\nconst classMetadataMap = new WeakMap<ClassType, Record<string | symbol, any>>()\n\n/**\n * Gets the constructor from a prototype (for method decorators).\n */\nfunction getConstructor(prototype: any): ClassType | null {\n if (!prototype || typeof prototype !== 'object') {\n return null\n }\n // In legacy decorators, target is the prototype\n // The constructor is typically available via prototype.constructor\n const constructor = prototype.constructor\n if (constructor && typeof constructor === 'function') {\n return constructor as ClassType\n }\n return null\n}\n\n/**\n * Creates a mock ClassDecoratorContext for legacy class decorators.\n */\nexport function createClassContext(target: ClassType): ClassDecoratorContext {\n // Get or create metadata storage for this class\n if (!classMetadataMap.has(target)) {\n classMetadataMap.set(target, {})\n }\n const metadata = classMetadataMap.get(target)!\n\n return {\n kind: 'class',\n name: target.name,\n metadata,\n addInitializer() {\n // Legacy decorators don't support initializers\n },\n } as ClassDecoratorContext\n}\n\n/**\n * Creates a mock ClassMethodDecoratorContext for legacy method decorators.\n *\n * Note: Method decorators need to share metadata with the class context\n * because endpoint metadata is stored at the class level.\n */\nexport function createMethodContext(\n target: any,\n propertyKey: string | symbol,\n descriptor: PropertyDescriptor,\n): ClassMethodDecoratorContext {\n // For method decorators, target is the prototype\n // We need to get the class constructor to access class-level metadata\n const constructor = getConstructor(target)\n if (!constructor) {\n throw new Error(\n '[Navios] Could not determine class constructor from method decorator target.',\n )\n }\n\n // Get or create metadata storage for the class\n // Method decorators share metadata with the class\n if (!classMetadataMap.has(constructor)) {\n classMetadataMap.set(constructor, {})\n }\n const metadata = classMetadataMap.get(constructor)!\n\n return {\n kind: 'method',\n name: propertyKey,\n metadata,\n static: false, // We can't determine this from legacy decorators\n private: false, // We can't determine this from legacy decorators\n access: {\n has: () => true,\n get: () => descriptor.value,\n set: () => {},\n },\n addInitializer() {\n // Legacy decorators don't support initializers\n },\n } as ClassMethodDecoratorContext\n}\n","import type { ClassType } from '@navios/di'\n\nimport { Module as OriginalModule, type ModuleOptions } from '../../decorators/module.decorator.mjs'\nimport { createClassContext } from '../context-compat.mjs'\n\n/**\n * Legacy-compatible Module decorator.\n * \n * Works with TypeScript experimental decorators (legacy API).\n * \n * @param options - Module configuration options\n * @returns A class decorator compatible with legacy decorator API\n * \n * @example\n * ```typescript\n * @Module({\n * controllers: [UserController, AuthController],\n * imports: [DatabaseModule],\n * guards: [AuthGuard],\n * })\n * export class AppModule {}\n * ```\n */\nexport function Module(\n options: ModuleOptions = {\n controllers: [],\n imports: [],\n guards: [],\n },\n) {\n return function (target: ClassType) {\n const context = createClassContext(target)\n const originalDecorator = OriginalModule(options)\n return originalDecorator(target, context)\n }\n}\n\n","import type { ClassType } from '@navios/di'\n\nimport type { ControllerOptions } from '../../decorators/controller.decorator.mjs'\n\nimport { Controller as OriginalController } from '../../decorators/controller.decorator.mjs'\nimport { createClassContext } from '../context-compat.mjs'\n\n/**\n * Legacy-compatible Controller decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n *\n * @param options - Controller configuration options\n * @returns A class decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Controller({ guards: [AuthGuard] })\n * export class UserController {\n * @Endpoint(getUserEndpoint)\n * async getUser() { }\n * }\n * ```\n */\nexport function Controller(options: ControllerOptions = {}) {\n return function (target: ClassType) {\n const context = createClassContext(target)\n const originalDecorator = OriginalController(options)\n return originalDecorator(target, context)\n }\n}\n","import type {\n BaseEndpointConfig,\n EndpointFunctionArgs,\n HttpMethod,\n} from '@navios/builder'\nimport type { z, ZodType } from 'zod/v4'\n\nimport { Endpoint as OriginalEndpoint } from '../../decorators/endpoint.decorator.mjs'\nimport { createMethodContext } from '../context-compat.mjs'\n\n/**\n * Type helper to constrain a PropertyDescriptor's value to match an endpoint signature.\n * Note: In legacy decorators, type constraints are checked when the decorator is applied,\n * but may not be preserved perfectly when decorators are stacked.\n */\ntype EndpointMethodDescriptor<\n Url extends string,\n QuerySchema,\n RequestSchema,\n ResponseSchema extends ZodType,\n> = TypedPropertyDescriptor<\n (\n params: QuerySchema extends ZodType\n ? RequestSchema extends ZodType\n ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema, true>\n : EndpointFunctionArgs<Url, QuerySchema, undefined, true>\n : RequestSchema extends ZodType\n ? EndpointFunctionArgs<Url, undefined, RequestSchema, true>\n : EndpointFunctionArgs<Url, undefined, undefined, true>,\n ) => Promise<z.input<ResponseSchema>>\n>\n\n/**\n * Legacy-compatible Endpoint decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n * Provides type safety by ensuring method signatures match the endpoint configuration.\n *\n * @param endpoint - The endpoint declaration from @navios/builder\n * @returns A method decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Controller()\n * export class UserController {\n * @Endpoint(getUserEndpoint)\n * async getUser(request: EndpointParams<typeof getUserEndpoint>): EndpointResult<typeof getUserEndpoint> {\n * return { id: '1', name: 'John' }\n * }\n * }\n * ```\n */\nexport function Endpoint<\n Method extends HttpMethod = HttpMethod,\n Url extends string = string,\n QuerySchema = undefined,\n ResponseSchema extends ZodType = ZodType,\n RequestSchema = ZodType,\n>(endpoint: {\n config: BaseEndpointConfig<\n Method,\n Url,\n QuerySchema,\n ResponseSchema,\n RequestSchema\n >\n}) {\n return function (\n target: any,\n propertyKey: string | symbol,\n descriptor: EndpointMethodDescriptor<\n Url,\n QuerySchema,\n RequestSchema,\n ResponseSchema\n >,\n ): PropertyDescriptor | void {\n if (!descriptor) {\n throw new Error(\n '[Navios] @Endpoint decorator requires a method descriptor. Make sure experimentalDecorators is enabled.',\n )\n }\n // Type check the descriptor value matches expected signature\n const typedDescriptor = descriptor as EndpointMethodDescriptor<\n Url,\n QuerySchema,\n RequestSchema,\n ResponseSchema\n >\n const context = createMethodContext(target, propertyKey, typedDescriptor)\n const originalDecorator = OriginalEndpoint(endpoint)\n // @ts-expect-error - we don't need to type the value\n const result = originalDecorator(typedDescriptor.value, context)\n if (result !== typedDescriptor.value) {\n typedDescriptor.value = result as any\n }\n return typedDescriptor\n }\n}\n","import type {\n ClassType,\n ClassTypeWithInstance,\n InjectionToken,\n} from '@navios/di'\n\nimport type { CanActivate } from '../../interfaces/index.mjs'\n\nimport { UseGuards as OriginalUseGuards } from '../../decorators/use-guards.decorator.mjs'\nimport { createClassContext, createMethodContext } from '../context-compat.mjs'\n\n/**\n * Legacy-compatible UseGuards decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n * Can be applied to classes or methods.\n *\n * @param guards - Guard classes or injection tokens to apply\n * @returns A class or method decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * // Apply to a controller\n * @Controller()\n * @UseGuards(AuthGuard, RoleGuard)\n * export class UserController { }\n *\n * // Apply to a specific endpoint\n * @Controller()\n * export class UserController {\n * @Endpoint(getUserEndpoint)\n * @UseGuards(AuthGuard)\n * async getUser() { }\n * }\n * ```\n */\nexport function UseGuards(\n ...guards: (\n | ClassTypeWithInstance<CanActivate>\n | InjectionToken<CanActivate, undefined>\n )[]\n) {\n // Create the decorator function\n // Note: TypeScript's legacy decorator system has strict type checking for decorators\n // We use a flexible implementation that works for both class and method decorators\n function decoratorImpl(\n target: ClassType | Function,\n propertyKey?: string | symbol,\n descriptor?: PropertyDescriptor,\n ): any {\n // Determine if this is a class or method decorator\n if (propertyKey !== undefined && descriptor !== undefined) {\n // Method decorator\n const context = createMethodContext(\n target as Function,\n propertyKey,\n descriptor,\n )\n const originalDecorator = OriginalUseGuards(...guards)\n const result = originalDecorator(descriptor.value, context)\n if (result !== descriptor.value) {\n descriptor.value = result\n }\n return descriptor\n } else {\n // Class decorator\n const context = createClassContext(target as ClassType)\n const originalDecorator = OriginalUseGuards(...guards)\n return originalDecorator(target as ClassType, context)\n }\n }\n\n // Return with 'any' type to work around TypeScript's strict decorator checking\n // TypeScript's legacy decorator system cannot properly type-check decorators\n // that work as both class and method decorators. The runtime behavior is correct.\n // When used as a class decorator, it returns the class (preserving type at runtime)\n // When used as a method decorator, it returns the PropertyDescriptor\n // @ts-ignore - TypeScript limitation with dual-purpose legacy decorators\n return decoratorImpl as any\n}\n","import type { HttpHeader } from '../../interfaces/index.mjs'\n\nimport { Header as OriginalHeader } from '../../decorators/header.decorator.mjs'\nimport { createMethodContext } from '../context-compat.mjs'\n\n/**\n * Legacy-compatible Header decorator.\n * \n * Works with TypeScript experimental decorators (legacy API).\n * \n * @param name - The header name (e.g., 'Content-Type', 'Cache-Control')\n * @param value - The header value (string, number, or array of strings)\n * @returns A method decorator compatible with legacy decorator API\n * \n * @example\n * ```typescript\n * @Controller()\n * export class UserController {\n * @Endpoint(getUserEndpoint)\n * @Header('Cache-Control', 'max-age=3600')\n * async getUser() {\n * return { id: '1', name: 'John' }\n * }\n * }\n * ```\n */\nexport function Header(name: HttpHeader, value: string | number | string[]) {\n return function <T extends object>(\n target: T,\n propertyKey: string | symbol,\n descriptor: PropertyDescriptor,\n ) {\n const context = createMethodContext(target, propertyKey, descriptor)\n const originalDecorator = OriginalHeader(name, value)\n const result = originalDecorator(descriptor.value, context)\n if (result !== descriptor.value) {\n descriptor.value = result\n }\n return descriptor\n }\n}\n\n","import { HttpCode as OriginalHttpCode } from '../../decorators/http-code.decorator.mjs'\nimport { createMethodContext } from '../context-compat.mjs'\n\n/**\n * Legacy-compatible HttpCode decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n *\n * @param code - The HTTP status code to return (e.g., 201, 204, 202)\n * @returns A method decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Controller()\n * export class UserController {\n * @Endpoint(createUserEndpoint)\n * @HttpCode(201)\n * async createUser() {\n * return { id: '1', name: 'John' }\n * }\n * }\n * ```\n */\nexport function HttpCode(code: number) {\n return function <T extends object>(\n target: T,\n propertyKey: string | symbol,\n descriptor: PropertyDescriptor,\n ) {\n const context = createMethodContext(target, propertyKey, descriptor)\n const originalDecorator = OriginalHttpCode(code)\n const result = originalDecorator(descriptor.value, context)\n if (result !== descriptor.value) {\n descriptor.value = result\n }\n return descriptor\n }\n}\n","import type {\n BaseEndpointConfig,\n EndpointFunctionArgs,\n HttpMethod,\n} from '@navios/builder'\nimport type { z, ZodObject, ZodType } from 'zod/v4'\n\nimport { Multipart as OriginalMultipart } from '../../decorators/multipart.decorator.mjs'\nimport { createMethodContext } from '../context-compat.mjs'\n\n/**\n * Type helper to constrain a PropertyDescriptor's value to match a multipart endpoint signature.\n * Note: In legacy decorators, type constraints are checked when the decorator is applied,\n * but may not be preserved perfectly when decorators are stacked.\n */\ntype MultipartMethodDescriptor<\n Url extends string,\n QuerySchema,\n RequestSchema,\n ResponseSchema extends ZodType,\n> = TypedPropertyDescriptor<\n (\n params: QuerySchema extends ZodObject\n ? RequestSchema extends ZodType\n ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema, true>\n : EndpointFunctionArgs<Url, QuerySchema, undefined, true>\n : RequestSchema extends ZodType\n ? EndpointFunctionArgs<Url, undefined, RequestSchema, true>\n : EndpointFunctionArgs<Url, undefined, undefined, true>,\n ) => Promise<z.input<ResponseSchema>>\n>\n\n/**\n * Legacy-compatible Multipart decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n * Provides type safety by ensuring method signatures match the endpoint configuration.\n *\n * @param endpoint - The multipart endpoint declaration from @navios/builder\n * @returns A method decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Controller()\n * export class FileController {\n * @Multipart(uploadFileEndpoint)\n * async uploadFile(request: MultipartParams<typeof uploadFileEndpoint>): MultipartResult<typeof uploadFileEndpoint> {\n * const { file } = request.data\n * return { url: 'https://example.com/file.jpg' }\n * }\n * }\n * ```\n */\nexport function Multipart<\n Method extends HttpMethod = HttpMethod,\n Url extends string = string,\n QuerySchema = undefined,\n ResponseSchema extends ZodType = ZodType,\n RequestSchema = ZodType,\n>(endpoint: {\n config: BaseEndpointConfig<\n Method,\n Url,\n QuerySchema,\n ResponseSchema,\n RequestSchema\n >\n}) {\n return function <T extends object>(\n target: T,\n propertyKey: string | symbol,\n descriptor: MultipartMethodDescriptor<\n Url,\n QuerySchema,\n RequestSchema,\n ResponseSchema\n >,\n ): PropertyDescriptor | void {\n if (!descriptor) {\n throw new Error(\n '[Navios] @Multipart decorator requires a method descriptor. Make sure experimentalDecorators is enabled.',\n )\n }\n const context = createMethodContext(target, propertyKey, descriptor)\n const originalDecorator = OriginalMultipart(endpoint)\n // @ts-expect-error - we don't need to type the value\n const result = originalDecorator(descriptor.value, context)\n if (result !== descriptor.value) {\n descriptor.value = result as any\n }\n return descriptor\n }\n}\n","import type {\n BaseStreamConfig,\n EndpointFunctionArgs,\n HttpMethod,\n} from '@navios/builder'\nimport type { ZodObject, ZodType } from 'zod/v4'\n\nimport { Stream as OriginalStream } from '../../decorators/stream.decorator.mjs'\nimport { createMethodContext } from '../context-compat.mjs'\n\n/**\n * Type helper to constrain a PropertyDescriptor's value to match a stream endpoint signature.\n * Note: In legacy decorators, type constraints are checked when the decorator is applied,\n * but may not be preserved perfectly when decorators are stacked.\n */\ntype StreamMethodDescriptor<\n Url extends string,\n QuerySchema,\n RequestSchema,\n> = TypedPropertyDescriptor<\n (\n params: QuerySchema extends ZodObject\n ? RequestSchema extends ZodType\n ? EndpointFunctionArgs<Url, QuerySchema, RequestSchema, true>\n : EndpointFunctionArgs<Url, QuerySchema, undefined, true>\n : RequestSchema extends ZodType\n ? EndpointFunctionArgs<Url, undefined, RequestSchema, true>\n : EndpointFunctionArgs<Url, undefined, undefined, true>,\n reply: any,\n ) => Promise<void>\n>\n\n/**\n * Legacy-compatible Stream decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n * Provides type safety by ensuring method signatures match the endpoint configuration.\n *\n * @param endpoint - The stream endpoint declaration from @navios/builder\n * @returns A method decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Controller()\n * export class FileController {\n * @Stream(downloadFileEndpoint)\n * async downloadFile(request: StreamParams<typeof downloadFileEndpoint>, reply: any) {\n * const { fileId } = request.urlParams\n * // Stream file data to reply\n * }\n * }\n * ```\n */\nexport function Stream<\n Method extends HttpMethod = HttpMethod,\n Url extends string = string,\n QuerySchema = undefined,\n RequestSchema = ZodType,\n>(endpoint: {\n config: BaseStreamConfig<Method, Url, QuerySchema, RequestSchema>\n}) {\n return function <T extends object>(\n target: T,\n propertyKey: string | symbol,\n descriptor: StreamMethodDescriptor<Url, QuerySchema, RequestSchema>,\n ) {\n const context = createMethodContext(target, propertyKey, descriptor)\n const originalDecorator = OriginalStream(endpoint)\n // @ts-expect-error - we don't need to type the value\n const result = originalDecorator(descriptor.value, context)\n if (result !== descriptor.value) {\n descriptor.value = result as any\n }\n return descriptor\n }\n}\n"],"mappings":";;;;;;;;GAYA,MAAMA,mCAAmB,IAAIC,SAAAA;;;GAK7B,SAASC,eAAeC,WAAc;AACpC,KAAI,CAACA,aAAa,OAAOA,cAAc,SACrC,QAAO;CAIT,MAAMC,cAAcD,UAAU;AAC9B,KAAIC,eAAe,OAAOA,gBAAgB,WACxC,QAAOA;AAET,QAAO;;;;GAMT,SAAgBC,mBAAmBC,QAAiB;AAElD,KAAI,CAACN,iBAAiBO,IAAID,OAAAA,CACxBN,kBAAiBQ,IAAIF,QAAQ,EAAC,CAAA;CAEhC,MAA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AAMC,UAAUN,oBAAoBE,QAAQC,aAAaC,WAAAA;EAGzD,MAAMI,SAFoBT,YAAkBE,SAAAA,CAEXG,WAAWK,OAAOH,QAAAA;AACnD,MAAIE,WAAWJ,WAAWK,MACxBL,YAAWK,QAAQD;AAErB,SAAOJ;;;;;;;;;;;;;;;;;;;;;;;;;;GCrCX,SAAgBM,OAKdG,UAED;AACC,QAAO,SACLC,QACAC,aACAC,YAAmE;EAEnE,MAAMC,UAAUL,oBAAoBE,QAAQC,aAAaC,WAAAA;EAGzD,MAAMG,SAFoBR,SAAeE,SAAAA,CAERG,WAAWI,OAAOH,QAAAA;AACnD,MAAIE,WAAWH,WAAWI,MACxBJ,YAAWI,QAAQD;AAErB,SAAOH"}
|
|
@@ -25,7 +25,7 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
25
25
|
}) : target, mod));
|
|
26
26
|
|
|
27
27
|
//#endregion
|
|
28
|
-
const require_use_guards_decorator = require('./use-guards.decorator-
|
|
28
|
+
const require_use_guards_decorator = require('./use-guards.decorator-Bs8oDHOi.cjs');
|
|
29
29
|
let _navios_di = require("@navios/di");
|
|
30
30
|
let node_process = require("node:process");
|
|
31
31
|
let zod_v4 = require("zod/v4");
|
|
@@ -2774,7 +2774,7 @@ var ModuleLoaderService = class {
|
|
|
2774
2774
|
async traverseModules(module$1, parentMetadata) {
|
|
2775
2775
|
const metadata = require_use_guards_decorator.extractModuleMetadata(module$1);
|
|
2776
2776
|
if (parentMetadata) this.mergeMetadata(metadata, parentMetadata);
|
|
2777
|
-
const moduleName = module$1.
|
|
2777
|
+
const moduleName = (0, _navios_di.getInjectableToken)(module$1).id;
|
|
2778
2778
|
if (this.modulesMetadata.has(moduleName)) return;
|
|
2779
2779
|
try {
|
|
2780
2780
|
this.modulesMetadata.set(moduleName, metadata);
|
|
@@ -3177,7 +3177,7 @@ var NaviosEnvironment = class {
|
|
|
3177
3177
|
}
|
|
3178
3178
|
httpTokens = /* @__PURE__ */ new Map();
|
|
3179
3179
|
setupHttpEnvironment(tokens) {
|
|
3180
|
-
this.httpTokens
|
|
3180
|
+
for (const [token, value] of tokens) this.httpTokens.set(token, value);
|
|
3181
3181
|
}
|
|
3182
3182
|
getHttpToken(token) {
|
|
3183
3183
|
return this.httpTokens.get(token);
|
|
@@ -5841,9 +5841,9 @@ var NaviosApplication = class {
|
|
|
5841
5841
|
* })
|
|
5842
5842
|
* ```
|
|
5843
5843
|
*/ static async create(appModule, options = { adapter: [] }) {
|
|
5844
|
-
const container = options.container ?? new _navios_di.Container();
|
|
5844
|
+
const container = options.container ?? new _navios_di.Container(options.registry);
|
|
5845
5845
|
if (options.enableRequestId === true) setRequestIdEnabled(true);
|
|
5846
|
-
container.
|
|
5846
|
+
container.addInstance(require_use_guards_decorator.NaviosOptionsToken, options);
|
|
5847
5847
|
await this.registerLoggerConfiguration(container, options);
|
|
5848
5848
|
const adapters = Array.isArray(options.adapter) ? options.adapter : [options.adapter];
|
|
5849
5849
|
for (const adapter of adapters) await this.registerEnvironment(container, adapter);
|
|
@@ -5858,11 +5858,14 @@ var NaviosApplication = class {
|
|
|
5858
5858
|
}
|
|
5859
5859
|
static async registerLoggerConfiguration(container, options) {
|
|
5860
5860
|
const { logger } = options;
|
|
5861
|
-
if (Array.isArray(logger) || isNil(logger)) {
|
|
5862
|
-
(await container.get(LoggerOutput))?.setup({
|
|
5861
|
+
if (Array.isArray(logger) || isNil(logger) || options.enableRequestId) {
|
|
5862
|
+
(await container.get(LoggerOutput))?.setup({
|
|
5863
|
+
logLevels: Array.isArray(logger) ? logger : void 0,
|
|
5864
|
+
requestId: options.enableRequestId ?? false
|
|
5865
|
+
});
|
|
5863
5866
|
return;
|
|
5864
5867
|
}
|
|
5865
|
-
if (logger !== true && !isNil(logger)) container.
|
|
5868
|
+
if (logger !== true && !isNil(logger)) container.addInstance(LoggerOutput, logger);
|
|
5866
5869
|
}
|
|
5867
5870
|
};
|
|
5868
5871
|
|
|
@@ -6215,4 +6218,4 @@ Object.defineProperty(exports, 'yellow', {
|
|
|
6215
6218
|
return yellow;
|
|
6216
6219
|
}
|
|
6217
6220
|
});
|
|
6218
|
-
//# sourceMappingURL=src-
|
|
6221
|
+
//# sourceMappingURL=src-BRPtJ9fG.cjs.map
|