@navios/core 0.9.1 → 0.9.3

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 CHANGED
@@ -5,6 +5,18 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.9.3] - 2026-01-05
9
+
10
+ ### Fixed
11
+
12
+ - **LegacyAttributeFactory Type Fix**: Fixed type definitions for `LegacyClassAttribute` and `LegacyClassSchemaAttribute` to properly support method decorators. Changed from complex function intersection types to simpler `ClassDecorator & MethodDecorator` types that TypeScript can correctly resolve.
13
+
14
+ ## [0.9.2] - 2026-01-05
15
+
16
+ ### Added
17
+
18
+ - **Legacy-Compatible Factory Decorator**: Added `Factory` decorator to `@navios/core/legacy-compat` for use with TypeScript experimental decorators, following the same pattern as the `Injectable` decorator
19
+
8
20
  ## [0.9.1] - 2026-01-02
9
21
 
10
22
  ### Added
@@ -333,6 +333,32 @@ let _navios_di = require("@navios/di");
333
333
  };
334
334
  }
335
335
 
336
+ //#endregion
337
+ //#region src/legacy-compat/decorators/factory.decorator.mts
338
+ /**
339
+ * Legacy-compatible Factory decorator.
340
+ *
341
+ * Works with TypeScript experimental decorators (legacy API).
342
+ *
343
+ * @param options - Factory configuration options
344
+ * @returns A class decorator compatible with legacy decorator API
345
+ *
346
+ * @example
347
+ * ```typescript
348
+ * @Factory()
349
+ * export class DatabaseConnectionFactory {
350
+ * create() {
351
+ * return { host: 'localhost', port: 5432 }
352
+ * }
353
+ * }
354
+ * ```
355
+ */ function Factory(options = {}) {
356
+ return function(target) {
357
+ const context = createClassContext(target);
358
+ return (Object.keys(options).length === 0 ? (0, _navios_di.Factory)() : (0, _navios_di.Factory)(options))(target, context);
359
+ };
360
+ }
361
+
336
362
  //#endregion
337
363
  //#region src/legacy-compat/attribute.factory.mts
338
364
  /**
@@ -434,6 +460,7 @@ let _navios_di = require("@navios/di");
434
460
  exports.AttributeFactory = LegacyAttributeFactory;
435
461
  exports.Controller = Controller;
436
462
  exports.Endpoint = Endpoint;
463
+ exports.Factory = Factory;
437
464
  exports.Header = Header;
438
465
  exports.HttpCode = HttpCode;
439
466
  exports.Injectable = Injectable;
@@ -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","Injectable","OriginalInjectable","createClassContext","options","target","context","originalDecorator","Object","keys","length","getControllerMetadata","getEndpointMetadata","getModuleMetadata","hasControllerMetadata","hasModuleMetadata","getManagedMetadata","hasManagedMetadata","createClassContext","createMethodContext","LegacyAttributeFactory","createAttribute","token","schema","res","value","decorator","target","propertyKey","descriptor","isMethodDecorator","undefined","context","metadata","validatedValue","safeParse","success","Error","toString","error","customAttributes","set","data","isController","isModule","isManaged","get","attribute","getAll","values","Array","from","entries","filter","key","map","length","getLast","i","has","AttributeFactory"],"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","../../src/legacy-compat/decorators/injectable.decorator.mts","../../src/legacy-compat/attribute.factory.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 * @internal\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 * @internal\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\ntype StreamParams<\n Url extends string,\n QuerySchema,\n RequestSchema,\n> = 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\n/**\n * Type helper to constrain a PropertyDescriptor's value to match a stream endpoint signature.\n * Supports both with and without reply parameter (Bun doesn't use reply parameter).\n */\ntype StreamMethodDescriptor<\n Url extends string,\n QuerySchema,\n RequestSchema,\n> =\n | TypedPropertyDescriptor<\n (params: StreamParams<Url, QuerySchema, RequestSchema>, reply: any) => any\n >\n | TypedPropertyDescriptor<\n (params: StreamParams<Url, QuerySchema, RequestSchema>) => any\n >\n | TypedPropertyDescriptor<() => any>\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","import type { ClassType } from '@navios/di'\n\nimport {\n Injectable as OriginalInjectable,\n type InjectableOptions,\n} from '@navios/di'\n\nimport { createClassContext } from '../context-compat.mjs'\n\nexport type { InjectableOptions }\n\n/**\n * Legacy-compatible Injectable decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n *\n * @param options - Injectable configuration options\n * @returns A class decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Injectable()\n * export class UserService {\n * getUser(id: string) {\n * return { id, name: 'John' }\n * }\n * }\n * ```\n */\nexport function Injectable(options: InjectableOptions = {}) {\n return function (target: ClassType) {\n const context = createClassContext(target)\n // Use the no-args overload when options is empty, otherwise pass options\n const originalDecorator =\n Object.keys(options).length === 0\n ? OriginalInjectable()\n : // @ts-expect-error - InjectableOptions is a union type, we let runtime handle it\n OriginalInjectable(options)\n return originalDecorator(target, context)\n }\n}\n","import type { ClassType } from '@navios/di'\nimport type { z, ZodType } from 'zod/v4'\n\nimport type {\n ControllerMetadata,\n HandlerMetadata,\n ModuleMetadata,\n} from '../metadata/index.mjs'\n\nimport {\n getControllerMetadata,\n getEndpointMetadata,\n getModuleMetadata,\n hasControllerMetadata,\n hasModuleMetadata,\n} from '../metadata/index.mjs'\nimport {\n getManagedMetadata,\n hasManagedMetadata,\n} from '../metadata/navios-managed.metadata.mjs'\nimport { createClassContext, createMethodContext } from './context-compat.mjs'\n\n/**\n * Type for a legacy class attribute decorator without a value.\n *\n * Attributes are custom metadata decorators that can be applied to modules,\n * controllers, and endpoints.\n */\nexport type LegacyClassAttribute = (() => <T extends ClassType>(\n target: T,\n) => T) &\n (() => <T extends object>(\n target: T,\n propertyKey: string | symbol,\n descriptor: PropertyDescriptor,\n ) => PropertyDescriptor) & {\n token: symbol\n }\n\n/**\n * Type for a legacy class attribute decorator with a validated value.\n *\n * @typeParam S - The Zod schema type for validation\n */\nexport type LegacyClassSchemaAttribute<S extends ZodType> = ((\n value: z.input<S>,\n) => <T extends ClassType>(target: T) => T) &\n ((\n value: z.input<S>,\n ) => <T extends object>(\n target: T,\n propertyKey: string | symbol,\n descriptor: PropertyDescriptor,\n ) => PropertyDescriptor) & {\n token: symbol\n schema: ZodType\n }\n\n/**\n * Legacy-compatible factory for creating custom attribute decorators.\n *\n * Works with TypeScript experimental decorators (legacy API).\n *\n * Attributes allow you to add custom metadata to modules, controllers, and endpoints.\n * This is useful for cross-cutting concerns like rate limiting, caching, API versioning, etc.\n *\n * @example\n * ```typescript\n * // Create a simple boolean attribute\n * const Public = LegacyAttributeFactory.createAttribute(Symbol.for('Public'))\n *\n * // Use it as a decorator\n * @Controller()\n * @Public()\n * export class PublicController { }\n *\n * // Check if attribute exists\n * if (LegacyAttributeFactory.has(Public, controllerMetadata)) {\n * // Skip authentication\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Create an attribute with a validated value\n * const RateLimit = LegacyAttributeFactory.createAttribute(\n * Symbol.for('RateLimit'),\n * z.object({ requests: z.number(), window: z.number() })\n * )\n *\n * // Use it with a value\n * @Endpoint(apiEndpoint)\n * @RateLimit({ requests: 100, window: 60000 })\n * async handler() { }\n *\n * // Get the value\n * const limit = LegacyAttributeFactory.get(RateLimit, endpointMetadata)\n * // limit is typed as { requests: number, window: number } | null\n * ```\n */\nexport class LegacyAttributeFactory {\n /**\n * Creates a simple attribute decorator without a value.\n *\n * @param token - A unique symbol to identify this attribute\n * @returns A decorator function that can be applied to classes or methods\n *\n * @example\n * ```typescript\n * const Public = LegacyAttributeFactory.createAttribute(Symbol.for('Public'))\n *\n * @Public()\n * @Controller()\n * export class PublicController { }\n * ```\n */\n static createAttribute(token: symbol): LegacyClassAttribute\n /**\n * Creates an attribute decorator with a validated value.\n *\n * @param token - A unique symbol to identify this attribute\n * @param schema - A Zod schema to validate the attribute value\n * @returns A decorator function that accepts a value and can be applied to classes or methods\n *\n * @example\n * ```typescript\n * const RateLimit = LegacyAttributeFactory.createAttribute(\n * Symbol.for('RateLimit'),\n * z.object({ requests: z.number(), window: z.number() })\n * )\n *\n * @RateLimit({ requests: 100, window: 60000 })\n * @Endpoint(apiEndpoint)\n * async handler() { }\n * ```\n */\n static createAttribute<T extends ZodType>(\n token: symbol,\n schema: T,\n ): LegacyClassSchemaAttribute<T>\n\n static createAttribute(token: symbol, schema?: ZodType) {\n const res = (value?: unknown) => {\n // Return a decorator that can handle both class and method targets\n function decorator(target: any): any\n function decorator(\n target: any,\n propertyKey: string | symbol,\n descriptor: PropertyDescriptor,\n ): PropertyDescriptor\n function decorator(\n target: any,\n propertyKey?: string | symbol,\n descriptor?: PropertyDescriptor,\n ): any {\n const isMethodDecorator =\n propertyKey !== undefined && descriptor !== undefined\n\n if (isMethodDecorator) {\n // Method decorator - apply to endpoint\n const context = createMethodContext(target, propertyKey, descriptor)\n const metadata = getEndpointMetadata(descriptor.value, context)\n\n if (schema) {\n const validatedValue = schema.safeParse(value)\n if (!validatedValue.success) {\n throw new Error(\n `[Navios] Invalid value for attribute ${token.toString()}: ${validatedValue.error}`,\n )\n }\n metadata.customAttributes.set(token, validatedValue.data)\n } else {\n metadata.customAttributes.set(token, true)\n }\n return descriptor\n } else {\n // Class decorator\n const isController = hasControllerMetadata(target as ClassType)\n const isModule = hasModuleMetadata(target as ClassType)\n const isManaged = hasManagedMetadata(target as ClassType)\n\n if (!isController && !isModule && !isManaged) {\n throw new Error(\n '[Navios] Attribute can only be applied to classes with @Controller, @Module, or other Navios-managed decorators',\n )\n }\n\n const context = createClassContext(target)\n const metadata = isController\n ? getControllerMetadata(target, context)\n : isModule\n ? getModuleMetadata(target, context)\n : isManaged\n ? getManagedMetadata(target)!\n : null\n\n if (!metadata) {\n throw new Error(\n '[Navios] Could not determine metadata for attribute target',\n )\n }\n\n if (schema) {\n const validatedValue = schema.safeParse(value)\n if (!validatedValue.success) {\n throw new Error(\n `[Navios] Invalid value for attribute ${token.toString()}: ${validatedValue.error}`,\n )\n }\n metadata.customAttributes.set(token, validatedValue.data)\n } else {\n metadata.customAttributes.set(token, true)\n }\n return target\n }\n }\n return decorator\n }\n res.token = token\n if (schema) {\n res.schema = schema\n }\n return res\n }\n\n /**\n * Gets the value of an attribute from metadata.\n *\n * Returns `null` if the attribute is not present.\n * For simple attributes (without values), returns `true` if present.\n *\n * @param attribute - The attribute decorator\n * @param target - The metadata object (module, controller, or handler)\n * @returns The attribute value, `true` for simple attributes, or `null` if not found\n *\n * @example\n * ```typescript\n * const isPublic = LegacyAttributeFactory.get(Public, controllerMetadata)\n * // isPublic is true | null\n *\n * const rateLimit = LegacyAttributeFactory.get(RateLimit, endpointMetadata)\n * // rateLimit is { requests: number, window: number } | null\n * ```\n */\n static get(\n attribute: LegacyClassAttribute,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ): true | null\n static get<T extends ZodType>(\n attribute: LegacyClassSchemaAttribute<T>,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ): z.output<T> | null\n static get(\n attribute: LegacyClassAttribute | LegacyClassSchemaAttribute<any>,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ) {\n return target.customAttributes.get(attribute.token) ?? null\n }\n\n /**\n * Gets all values of an attribute from metadata (useful when an attribute can appear multiple times).\n *\n * Returns `null` if the attribute is not present.\n *\n * @param attribute - The attribute decorator\n * @param target - The metadata object (module, controller, or handler)\n * @returns An array of attribute values, or `null` if not found\n *\n * @example\n * ```typescript\n * const tags = LegacyAttributeFactory.getAll(Tag, endpointMetadata)\n * // tags is string[] | null\n * ```\n */\n static getAll(\n attribute: LegacyClassAttribute,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ): Array<true> | null\n static getAll<T extends ZodType>(\n attribute: LegacyClassSchemaAttribute<T>,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ): Array<z.output<T>> | null\n static getAll(\n attribute: LegacyClassAttribute | LegacyClassSchemaAttribute<any>,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ) {\n const values = Array.from(target.customAttributes.entries())\n .filter(([key]) => key === attribute.token)\n .map(([, value]) => value)\n return values.length > 0 ? values : null\n }\n\n /**\n * Gets the last value of an attribute from an array of metadata objects.\n *\n * Searches from the end of the array backwards, useful for finding the most\n * specific attribute value (e.g., endpoint-level overrides module-level).\n *\n * @param attribute - The attribute decorator\n * @param target - An array of metadata objects (typically [module, controller, handler])\n * @returns The last attribute value found, or `null` if not found\n *\n * @example\n * ```typescript\n * // Check attribute hierarchy: endpoint -> controller -> module\n * const rateLimit = LegacyAttributeFactory.getLast(RateLimit, [\n * moduleMetadata,\n * controllerMetadata,\n * endpointMetadata\n * ])\n * ```\n */\n static getLast(\n attribute: LegacyClassAttribute,\n target: (ModuleMetadata | ControllerMetadata | HandlerMetadata<any>)[],\n ): true | null\n static getLast<T extends ZodType>(\n attribute: LegacyClassSchemaAttribute<T>,\n target: (ModuleMetadata | ControllerMetadata | HandlerMetadata<any>)[],\n ): z.output<T> | null\n static getLast(\n attribute: LegacyClassAttribute | LegacyClassSchemaAttribute<any>,\n target: (ModuleMetadata | ControllerMetadata | HandlerMetadata<any>)[],\n ) {\n for (let i = target.length - 1; i >= 0; i--) {\n const value = target[i].customAttributes.get(attribute.token)\n if (value) {\n return value\n }\n }\n return null\n }\n\n /**\n * Checks if an attribute is present on the metadata object.\n *\n * @param attribute - The attribute decorator\n * @param target - The metadata object (module, controller, or handler)\n * @returns `true` if the attribute is present, `false` otherwise\n *\n * @example\n * ```typescript\n * if (LegacyAttributeFactory.has(Public, controllerMetadata)) {\n * // Skip authentication\n * }\n * ```\n */\n static has(\n attribute: LegacyClassAttribute,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ): boolean\n static has<T extends ZodType>(\n attribute: LegacyClassSchemaAttribute<T>,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ): boolean\n static has(\n attribute: LegacyClassAttribute | LegacyClassSchemaAttribute<any>,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ) {\n return target.customAttributes.has(attribute.token)\n }\n}\n\n// Re-export as AttributeFactory for convenience\nexport { LegacyAttributeFactory as AttributeFactory }\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;;;;;GAOT,SAAgBC,mBAAmBC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ACtB,SAAOwB,OAAOO,SAAS,IAAIP,SAAS;;CA+BtC,OAAOQ,QACLV,WACApB,QACA;AACA,OAAK,IAAI+B,IAAI/B,OAAO6B,SAAS,GAAGE,KAAK,GAAGA,KAAK;GAC3C,MAAMjC,QAAQE,OAAO+B,GAAGlB,iBAAiBM,IAAIC,UAAUzB,MAAK;AAC5D,OAAIG,MACF,QAAOA;;AAGX,SAAO;;CAyBT,OAAOkC,IACLZ,WACApB,QACA;AACA,SAAOA,OAAOa,iBAAiBmB,IAAIZ,UAAUzB,MAAK"}
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","Injectable","OriginalInjectable","createClassContext","options","target","context","originalDecorator","Object","keys","length","Factory","OriginalFactory","createClassContext","options","target","context","originalDecorator","Object","keys","length","getControllerMetadata","getEndpointMetadata","getModuleMetadata","hasControllerMetadata","hasModuleMetadata","getManagedMetadata","hasManagedMetadata","createClassContext","createMethodContext","LegacyAttributeFactory","createAttribute","token","schema","res","value","decorator","target","propertyKey","descriptor","isMethodDecorator","undefined","context","metadata","validatedValue","safeParse","success","Error","toString","error","customAttributes","set","data","isController","isModule","isManaged","get","attribute","getAll","values","Array","from","entries","filter","key","map","length","getLast","i","has","AttributeFactory"],"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","../../src/legacy-compat/decorators/injectable.decorator.mts","../../src/legacy-compat/decorators/factory.decorator.mts","../../src/legacy-compat/attribute.factory.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 * @internal\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 * @internal\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\ntype StreamParams<\n Url extends string,\n QuerySchema,\n RequestSchema,\n> = 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\n/**\n * Type helper to constrain a PropertyDescriptor's value to match a stream endpoint signature.\n * Supports both with and without reply parameter (Bun doesn't use reply parameter).\n */\ntype StreamMethodDescriptor<\n Url extends string,\n QuerySchema,\n RequestSchema,\n> =\n | TypedPropertyDescriptor<\n (params: StreamParams<Url, QuerySchema, RequestSchema>, reply: any) => any\n >\n | TypedPropertyDescriptor<\n (params: StreamParams<Url, QuerySchema, RequestSchema>) => any\n >\n | TypedPropertyDescriptor<() => any>\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","import type { ClassType } from '@navios/di'\n\nimport {\n Injectable as OriginalInjectable,\n type InjectableOptions,\n} from '@navios/di'\n\nimport { createClassContext } from '../context-compat.mjs'\n\nexport type { InjectableOptions }\n\n/**\n * Legacy-compatible Injectable decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n *\n * @param options - Injectable configuration options\n * @returns A class decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Injectable()\n * export class UserService {\n * getUser(id: string) {\n * return { id, name: 'John' }\n * }\n * }\n * ```\n */\nexport function Injectable(options: InjectableOptions = {}) {\n return function (target: ClassType) {\n const context = createClassContext(target)\n // Use the no-args overload when options is empty, otherwise pass options\n const originalDecorator =\n Object.keys(options).length === 0\n ? OriginalInjectable()\n : // @ts-expect-error - InjectableOptions is a union type, we let runtime handle it\n OriginalInjectable(options)\n return originalDecorator(target, context)\n }\n}\n","import type { ClassType, FactoryOptions } from '@navios/di'\n\nimport { Factory as OriginalFactory } from '@navios/di'\n\nimport { createClassContext } from '../context-compat.mjs'\n\nexport type { FactoryOptions }\n\n/**\n * Legacy-compatible Factory decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n *\n * @param options - Factory configuration options\n * @returns A class decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Factory()\n * export class DatabaseConnectionFactory {\n * create() {\n * return { host: 'localhost', port: 5432 }\n * }\n * }\n * ```\n */\nexport function Factory(options: FactoryOptions = {}) {\n return function (target: ClassType) {\n const context = createClassContext(target)\n // Use the no-args overload when options is empty, otherwise pass options\n const originalDecorator =\n Object.keys(options).length === 0\n ? OriginalFactory()\n : OriginalFactory(options)\n return originalDecorator(target, context)\n }\n}\n","import type { z, ZodType } from 'zod/v4'\nimport type { ClassType } from '@navios/di'\n\nimport type {\n ControllerMetadata,\n HandlerMetadata,\n ModuleMetadata,\n} from '../metadata/index.mjs'\n\nimport {\n getControllerMetadata,\n getEndpointMetadata,\n getModuleMetadata,\n hasControllerMetadata,\n hasModuleMetadata,\n} from '../metadata/index.mjs'\nimport {\n getManagedMetadata,\n hasManagedMetadata,\n} from '../metadata/navios-managed.metadata.mjs'\nimport { createClassContext, createMethodContext } from './context-compat.mjs'\n\n/**\n * Type for a legacy class/method attribute decorator without a value.\n *\n * Attributes are custom metadata decorators that can be applied to modules,\n * controllers, and endpoints.\n */\nexport type LegacyClassAttribute = {\n (): ClassDecorator & MethodDecorator\n token: symbol\n}\n\n/**\n * Type for a legacy class/method attribute decorator with a validated value.\n *\n * @typeParam S - The Zod schema type for validation\n */\nexport type LegacyClassSchemaAttribute<S extends ZodType> = {\n (value: z.input<S>): ClassDecorator & MethodDecorator\n token: symbol\n schema: ZodType\n}\n\n/**\n * Legacy-compatible factory for creating custom attribute decorators.\n *\n * Works with TypeScript experimental decorators (legacy API).\n *\n * Attributes allow you to add custom metadata to modules, controllers, and endpoints.\n * This is useful for cross-cutting concerns like rate limiting, caching, API versioning, etc.\n *\n * @example\n * ```typescript\n * // Create a simple boolean attribute\n * const Public = LegacyAttributeFactory.createAttribute(Symbol.for('Public'))\n *\n * // Use it as a decorator\n * @Controller()\n * @Public()\n * export class PublicController { }\n *\n * // Check if attribute exists\n * if (LegacyAttributeFactory.has(Public, controllerMetadata)) {\n * // Skip authentication\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Create an attribute with a validated value\n * const RateLimit = LegacyAttributeFactory.createAttribute(\n * Symbol.for('RateLimit'),\n * z.object({ requests: z.number(), window: z.number() })\n * )\n *\n * // Use it with a value\n * @Endpoint(apiEndpoint)\n * @RateLimit({ requests: 100, window: 60000 })\n * async handler() { }\n *\n * // Get the value\n * const limit = LegacyAttributeFactory.get(RateLimit, endpointMetadata)\n * // limit is typed as { requests: number, window: number } | null\n * ```\n */\nexport class LegacyAttributeFactory {\n /**\n * Creates a simple attribute decorator without a value.\n *\n * @param token - A unique symbol to identify this attribute\n * @returns A decorator function that can be applied to classes or methods\n *\n * @example\n * ```typescript\n * const Public = LegacyAttributeFactory.createAttribute(Symbol.for('Public'))\n *\n * @Public()\n * @Controller()\n * export class PublicController { }\n * ```\n */\n static createAttribute(token: symbol): LegacyClassAttribute\n /**\n * Creates an attribute decorator with a validated value.\n *\n * @param token - A unique symbol to identify this attribute\n * @param schema - A Zod schema to validate the attribute value\n * @returns A decorator function that accepts a value and can be applied to classes or methods\n *\n * @example\n * ```typescript\n * const RateLimit = LegacyAttributeFactory.createAttribute(\n * Symbol.for('RateLimit'),\n * z.object({ requests: z.number(), window: z.number() })\n * )\n *\n * @RateLimit({ requests: 100, window: 60000 })\n * @Endpoint(apiEndpoint)\n * async handler() { }\n * ```\n */\n static createAttribute<T extends ZodType>(\n token: symbol,\n schema: T,\n ): LegacyClassSchemaAttribute<T>\n\n static createAttribute(token: symbol, schema?: ZodType) {\n const res = (value?: unknown) => {\n // Return a decorator that can handle both class and method targets\n function decorator(target: any): any\n function decorator(\n target: any,\n propertyKey: string | symbol,\n descriptor: PropertyDescriptor,\n ): PropertyDescriptor\n function decorator(\n target: any,\n propertyKey?: string | symbol,\n descriptor?: PropertyDescriptor,\n ): any {\n const isMethodDecorator =\n propertyKey !== undefined && descriptor !== undefined\n\n if (isMethodDecorator) {\n // Method decorator - apply to endpoint\n const context = createMethodContext(target, propertyKey, descriptor)\n const metadata = getEndpointMetadata(descriptor.value, context)\n\n if (schema) {\n const validatedValue = schema.safeParse(value)\n if (!validatedValue.success) {\n throw new Error(\n `[Navios] Invalid value for attribute ${token.toString()}: ${validatedValue.error}`,\n )\n }\n metadata.customAttributes.set(token, validatedValue.data)\n } else {\n metadata.customAttributes.set(token, true)\n }\n return descriptor\n } else {\n // Class decorator\n const isController = hasControllerMetadata(target as ClassType)\n const isModule = hasModuleMetadata(target as ClassType)\n const isManaged = hasManagedMetadata(target as ClassType)\n\n if (!isController && !isModule && !isManaged) {\n throw new Error(\n '[Navios] Attribute can only be applied to classes with @Controller, @Module, or other Navios-managed decorators',\n )\n }\n\n const context = createClassContext(target)\n const metadata = isController\n ? getControllerMetadata(target, context)\n : isModule\n ? getModuleMetadata(target, context)\n : isManaged\n ? getManagedMetadata(target)!\n : null\n\n if (!metadata) {\n throw new Error(\n '[Navios] Could not determine metadata for attribute target',\n )\n }\n\n if (schema) {\n const validatedValue = schema.safeParse(value)\n if (!validatedValue.success) {\n throw new Error(\n `[Navios] Invalid value for attribute ${token.toString()}: ${validatedValue.error}`,\n )\n }\n metadata.customAttributes.set(token, validatedValue.data)\n } else {\n metadata.customAttributes.set(token, true)\n }\n return target\n }\n }\n return decorator\n }\n res.token = token\n if (schema) {\n res.schema = schema\n }\n return res\n }\n\n /**\n * Gets the value of an attribute from metadata.\n *\n * Returns `null` if the attribute is not present.\n * For simple attributes (without values), returns `true` if present.\n *\n * @param attribute - The attribute decorator\n * @param target - The metadata object (module, controller, or handler)\n * @returns The attribute value, `true` for simple attributes, or `null` if not found\n *\n * @example\n * ```typescript\n * const isPublic = LegacyAttributeFactory.get(Public, controllerMetadata)\n * // isPublic is true | null\n *\n * const rateLimit = LegacyAttributeFactory.get(RateLimit, endpointMetadata)\n * // rateLimit is { requests: number, window: number } | null\n * ```\n */\n static get(\n attribute: LegacyClassAttribute,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ): true | null\n static get<T extends ZodType>(\n attribute: LegacyClassSchemaAttribute<T>,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ): z.output<T> | null\n static get(\n attribute: LegacyClassAttribute | LegacyClassSchemaAttribute<any>,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ) {\n return target.customAttributes.get(attribute.token) ?? null\n }\n\n /**\n * Gets all values of an attribute from metadata (useful when an attribute can appear multiple times).\n *\n * Returns `null` if the attribute is not present.\n *\n * @param attribute - The attribute decorator\n * @param target - The metadata object (module, controller, or handler)\n * @returns An array of attribute values, or `null` if not found\n *\n * @example\n * ```typescript\n * const tags = LegacyAttributeFactory.getAll(Tag, endpointMetadata)\n * // tags is string[] | null\n * ```\n */\n static getAll(\n attribute: LegacyClassAttribute,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ): Array<true> | null\n static getAll<T extends ZodType>(\n attribute: LegacyClassSchemaAttribute<T>,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ): Array<z.output<T>> | null\n static getAll(\n attribute: LegacyClassAttribute | LegacyClassSchemaAttribute<any>,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ) {\n const values = Array.from(target.customAttributes.entries())\n .filter(([key]) => key === attribute.token)\n .map(([, value]) => value)\n return values.length > 0 ? values : null\n }\n\n /**\n * Gets the last value of an attribute from an array of metadata objects.\n *\n * Searches from the end of the array backwards, useful for finding the most\n * specific attribute value (e.g., endpoint-level overrides module-level).\n *\n * @param attribute - The attribute decorator\n * @param target - An array of metadata objects (typically [module, controller, handler])\n * @returns The last attribute value found, or `null` if not found\n *\n * @example\n * ```typescript\n * // Check attribute hierarchy: endpoint -> controller -> module\n * const rateLimit = LegacyAttributeFactory.getLast(RateLimit, [\n * moduleMetadata,\n * controllerMetadata,\n * endpointMetadata\n * ])\n * ```\n */\n static getLast(\n attribute: LegacyClassAttribute,\n target: (ModuleMetadata | ControllerMetadata | HandlerMetadata<any>)[],\n ): true | null\n static getLast<T extends ZodType>(\n attribute: LegacyClassSchemaAttribute<T>,\n target: (ModuleMetadata | ControllerMetadata | HandlerMetadata<any>)[],\n ): z.output<T> | null\n static getLast(\n attribute: LegacyClassAttribute | LegacyClassSchemaAttribute<any>,\n target: (ModuleMetadata | ControllerMetadata | HandlerMetadata<any>)[],\n ) {\n for (let i = target.length - 1; i >= 0; i--) {\n const value = target[i].customAttributes.get(attribute.token)\n if (value) {\n return value\n }\n }\n return null\n }\n\n /**\n * Checks if an attribute is present on the metadata object.\n *\n * @param attribute - The attribute decorator\n * @param target - The metadata object (module, controller, or handler)\n * @returns `true` if the attribute is present, `false` otherwise\n *\n * @example\n * ```typescript\n * if (LegacyAttributeFactory.has(Public, controllerMetadata)) {\n * // Skip authentication\n * }\n * ```\n */\n static has(\n attribute: LegacyClassAttribute,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ): boolean\n static has<T extends ZodType>(\n attribute: LegacyClassSchemaAttribute<T>,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ): boolean\n static has(\n attribute: LegacyClassAttribute | LegacyClassSchemaAttribute<any>,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ) {\n return target.customAttributes.has(attribute.token)\n }\n}\n\n// Re-export as AttributeFactory for convenience\nexport { LegacyAttributeFactory as AttributeFactory }\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;;;;;GAOT,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;;;;;;;;GAUF,SAAgBC,oBACdR,QACAS,aACAC,YAA8B;CAI9B,MAAMZ,cAAcF,eAAeI,OAAAA;AACnC,KAAI,CAACF,YACH,OAAM,IAAIa,MACR,+EAAA;AAMJ,KAAI,CAACjB,iBAAiBO,IAAIH,YAAAA,CACxBJ,kBAAiBQ,IAAIJ,aAAa,EAAC,CAAA;AAIrC,QAAO;EACLO,MAAM;EACNC,MAAMG;EACNN,UALeT,iBAAiBU,IAAIN,YAAAA;EAMpCc,QAAQ;EACRC,SAAS;EACTC,QAAQ;GACNb,WAAW;GACXG,WAAWM,WAAWK;GACtBb,WAAK;GACP;EACAK,iBAAAA;EAGF;;;;;;;;;;;;;;;;;;;;;;GCtEF,SAAgBS,OACdG,UAAyB;CACvBC,aAAa,EAAE;CACfC,SAAS,EAAE;CACXC,QAAQ,EAA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QAAAA,GAC1Ba,YACE7B,gDAAmBW,OAAAA,GACnB;AAER,SAAI,CAACM,SACH,OAAM,IAAII,MACR,6DAAA;AAIJ,SAAId,QAAQ;MACV,MAAMW,iBAAiBX,OAAOY,UAAUV,MAAAA;AACxC,UAAI,CAACS,eAAeE,QAClB,OAAM,IAAIC,MACR,wCAAwCf,MAAMgB,UAAQ,CAAG,IAAIJ,eAAeK,QAAO;AAGvFN,eAASO,iBAAiBC,IAAInB,OAAOY,eAAeQ,KAAI;WAExDT,UAASO,iBAAiBC,IAAInB,OAAO,KAAA;AAEvC,YAAOK;;;AAGX,UAAOD;;AAETF,MAAIF,QAAQA;AACZ,MAAIC,OACFC,KAAID,SAASA;AAEf,SAAOC;;CA8BT,OAAOsB,IACLC,WACApB,QACA;AACA,SAAOA,OAAOa,iBAAiBM,IAAIC,UAAUzB,MAAK,IAAK;;CA0BzD,OAAO0B,OACLD,WACApB,QACA;EACA,MAAMsB,SAASC,MAAMC,KAAKxB,OAAOa,iBAAiBY,SAAO,CAAA,CACtDC,QAAQ,CAACC,SAASA,QAAQP,UAAUzB,MAAK,CACzCiC,KAAK,GAAG9B,WAAWA,MAAAA;AACtB,SAAOwB,OAAOO,SAAS,IAAIP,SAAS;;CA+BtC,OAAOQ,QACLV,WACApB,QACA;AACA,OAAK,IAAI+B,IAAI/B,OAAO6B,SAAS,GAAGE,KAAK,GAAGA,KAAK;GAC3C,MAAMjC,QAAQE,OAAO+B,GAAGlB,iBAAiBM,IAAIC,UAAUzB,MAAK;AAC5D,OAAIG,MACF,QAAOA;;AAGX,SAAO;;CAyBT,OAAOkC,IACLZ,WACApB,QACA;AACA,SAAOA,OAAOa,iBAAiBmB,IAAIZ,UAAUzB,MAAK"}
@@ -1,5 +1,5 @@
1
1
  import { G as MultipartParams, J as ModuleOptions, K as MultipartResult, Kt as ModuleMetadata, U as StreamParams, Zt as ControllerMetadata, at as CanActivate, cn as EndpointResult, rn as HandlerMetadata, rt as HttpHeader, sn as EndpointParams, un as ControllerOptions } from "../index-B2ulzZIr.cjs";
2
- import { ClassType, ClassTypeWithInstance, InjectableOptions, InjectionToken } from "@navios/di";
2
+ import { ClassType, ClassTypeWithInstance, FactoryOptions, InjectableOptions, 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";
5
5
 
@@ -236,22 +236,45 @@ declare function Stream<Method extends HttpMethod = HttpMethod, Url extends stri
236
236
  */
237
237
  declare function Injectable(options?: InjectableOptions): (target: ClassType) => ClassType;
238
238
  //#endregion
239
+ //#region src/legacy-compat/decorators/factory.decorator.d.mts
240
+ /**
241
+ * Legacy-compatible Factory decorator.
242
+ *
243
+ * Works with TypeScript experimental decorators (legacy API).
244
+ *
245
+ * @param options - Factory configuration options
246
+ * @returns A class decorator compatible with legacy decorator API
247
+ *
248
+ * @example
249
+ * ```typescript
250
+ * @Factory()
251
+ * export class DatabaseConnectionFactory {
252
+ * create() {
253
+ * return { host: 'localhost', port: 5432 }
254
+ * }
255
+ * }
256
+ * ```
257
+ */
258
+ declare function Factory(options?: FactoryOptions): (target: ClassType) => ClassType;
259
+ //#endregion
239
260
  //#region src/legacy-compat/attribute.factory.d.mts
240
261
  /**
241
- * Type for a legacy class attribute decorator without a value.
262
+ * Type for a legacy class/method attribute decorator without a value.
242
263
  *
243
264
  * Attributes are custom metadata decorators that can be applied to modules,
244
265
  * controllers, and endpoints.
245
266
  */
246
- type LegacyClassAttribute = (() => <T extends ClassType>(target: T) => T) & (() => <T extends object>(target: T, propertyKey: string | symbol, descriptor: PropertyDescriptor) => PropertyDescriptor) & {
267
+ type LegacyClassAttribute = {
268
+ (): ClassDecorator & MethodDecorator;
247
269
  token: symbol;
248
270
  };
249
271
  /**
250
- * Type for a legacy class attribute decorator with a validated value.
272
+ * Type for a legacy class/method attribute decorator with a validated value.
251
273
  *
252
274
  * @typeParam S - The Zod schema type for validation
253
275
  */
254
- type LegacyClassSchemaAttribute<S extends ZodType> = ((value: z$1.input<S>) => <T extends ClassType>(target: T) => T) & ((value: z$1.input<S>) => <T extends object>(target: T, propertyKey: string | symbol, descriptor: PropertyDescriptor) => PropertyDescriptor) & {
276
+ type LegacyClassSchemaAttribute<S extends ZodType> = {
277
+ (value: z$1.input<S>): ClassDecorator & MethodDecorator;
255
278
  token: symbol;
256
279
  schema: ZodType;
257
280
  };
@@ -427,5 +450,5 @@ declare function createClassContext(target: ClassType): ClassDecoratorContext;
427
450
  */
428
451
  declare function createMethodContext(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): ClassMethodDecoratorContext;
429
452
  //#endregion
430
- export { LegacyAttributeFactory as AttributeFactory, LegacyAttributeFactory, Controller, type ControllerOptions, Endpoint, type EndpointParams, type EndpointResult, Header, HttpCode, Injectable, type LegacyClassAttribute, type LegacyClassSchemaAttribute, Module, type ModuleOptions, Multipart, type MultipartParams, type MultipartResult, Stream, type StreamParams, UseGuards, createClassContext, createMethodContext };
453
+ export { LegacyAttributeFactory as AttributeFactory, LegacyAttributeFactory, Controller, type ControllerOptions, Endpoint, type EndpointParams, type EndpointResult, Factory, Header, HttpCode, Injectable, type LegacyClassAttribute, type LegacyClassSchemaAttribute, Module, type ModuleOptions, Multipart, type MultipartParams, type MultipartResult, Stream, type StreamParams, UseGuards, createClassContext, createMethodContext };
431
454
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/legacy-compat/decorators/module.decorator.mts","../../src/legacy-compat/decorators/controller.decorator.mts","../../src/legacy-compat/decorators/endpoint.decorator.mts","../../src/legacy-compat/decorators/use-guards.decorator.mts","../../src/legacy-compat/decorators/header.decorator.mts","../../src/legacy-compat/decorators/http-code.decorator.mts","../../src/legacy-compat/decorators/multipart.decorator.mts","../../src/legacy-compat/decorators/stream.decorator.mts","../../src/legacy-compat/decorators/injectable.decorator.mts","../../src/legacy-compat/attrib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GGiNkC,eHjNlC,CAAA,GAAA,CAAA,CAAA,EGkNX,KHlNW,CGkNL,GAAA,CAAE,MHlNG,CGkNI,CHlNJ,CAAA,CAAA,GAAA,IAAA;EAMX;;;;;ACxE2C;;;;;;;;;;;;;;;EAcL,OAAA,OAAA,CAAA,SAAA,EEsS5B,oBFtS4B,EAAA,MAAA,EAAA,CEuS9B,cFvS8B,GEuSb,kBFvSa,GEuSQ,eFvSR,CAAA,GAAA,CAAA,CAAA,EAAA,CAAA,EAAA,IAAA,GAAA,IAAA;EAArC,OAAA,OAAA,CAAA,UEySqB,OFzSrB,CAAA,CAAA,SAAA,EE0SS,0BF1ST,CE0SoC,CF1SpC,CAAA,EAAA,MAAA,EAAA,CE2SO,cF3SP,GE2SwB,kBF3SxB,GE2S6C,eF3S7C,CAAA,GAAA,CAAA,CAAA,EAAA,CAAA,EE4SD,GAAA,CAAE,MF5SD,CE4SQ,CF5SR,CAAA,GAAA,IAAA;EACqB;;;AAAD;;;;;;;;;;;EAiBtB,OAAA,GAAA,CAAA,SAAA,EEuTW,oBFvTX,EAAA,MAAA,EEwTQ,cFxTR,GEwTyB,kBFxTzB,GEwT8C,eFxT9C,CAAA,GAAA,CAAA,CAAA,EAAA,OAAA;EAAuB,OAAA,GAAA,CAAA,UE0TJ,OF1TI,CAAA,CAAA,SAAA,EE2TZ,0BF3TY,CE2Te,CF3Tf,CAAA,EAAA,MAAA,EE4Tf,cF5Te,GE4TE,kBF5TF,GE4TuB,eF5TvB,CAAA,GAAA,CAAA,CAAA,EAAA,OAAA;AAuB3B;;;;;;;iBG1BgB,kBAAA,SAA2B,YAAY;;;ATVvD;;;;;iBSkCgB,mBAAA,wDAGF,qBACX"}
1
+ {"version":3,"file":"index.d.cts","names":[],"sources":["../../src/legacy-compat/decorators/module.decorator.mts","../../src/legacy-compat/decorators/controller.decorator.mts","../../src/legacy-compat/decorators/endpoint.decorator.mts","../../src/legacy-compat/decorators/use-guards.decorator.mts","../../src/legacy-compat/decorators/header.decorator.mts","../../src/legacy-compat/decorators/http-code.decorator.mts","../../src/legacy-compat/decorators/multipart.decorator.mts","../../src/legacy-compat/decorators/stream.decorator.mts","../../src/legacy-compat/decorators/injectable.decorator.mts","../../src/legacy-compat/decorators/factory.decorator.mts","../../src/legacy-compat/attribute.factory.mts","../../src/legacy-compat/context-compat.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,WAtCgC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A,GAAA,IAAA;EACqB,OAAA,OAAA,CAAA,UG0RA,OH1RA,CAAA,CAAA,SAAA,EG2RZ,0BH3RY,CG2Re,CH3Rf,CAAA,EAAA,MAAA,EAAA,CG4Rd,cH5Rc,GG4RG,kBH5RH,GG4RwB,eH5RxB,CAAA,GAAA,CAAA,CAAA,EAAA,CAAA,EG6RtB,GAAA,CAAE,MH7RoB,CG6Rb,CH7Ra,CAAA,GAAA,IAAA;EAArB;;AAAoB;;;;;;;;;;;;EAiBC,OAAA,GAAA,CAAA,SAAA,EGySZ,oBHzSY,EAAA,MAAA,EG0Sf,cH1Se,GG0SE,kBH1SF,GG0SuB,eH1SvB,CAAA,GAAA,CAAA,CAAA,EAAA,OAAA;EAuBX,OAAA,GAAM,CAAA,UGqRC,OHrRD,CAAA,CAAA,SAAA,EGsRP,0BHtRO,CGsRoB,CHtRpB,CAAA,EAAA,MAAA,EGuRV,cHvRU,GGuRO,kBHvRP,GGuR4B,eHvR5B,CAAA,GAAA,CAAA,CAAA,EAAA,OAAA;;;;;;;;iBI1BN,kBAAA,SAA2B,YAAY;;;AVVvD;;;;;iBUkCgB,mBAAA,wDAGF,qBACX"}
@@ -1,5 +1,5 @@
1
1
  import { G as MultipartParams, J as ModuleOptions, K as MultipartResult, Kt as ModuleMetadata, U as StreamParams, Zt as ControllerMetadata, at as CanActivate, cn as EndpointResult, rn as HandlerMetadata, rt as HttpHeader, sn as EndpointParams, un as ControllerOptions } from "../index-C8lUQePd.mjs";
2
- import { ClassType, ClassTypeWithInstance, InjectableOptions, InjectionToken } from "@navios/di";
2
+ import { ClassType, ClassTypeWithInstance, FactoryOptions, InjectableOptions, 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";
5
5
 
@@ -236,22 +236,45 @@ declare function Stream<Method extends HttpMethod = HttpMethod, Url extends stri
236
236
  */
237
237
  declare function Injectable(options?: InjectableOptions): (target: ClassType) => ClassType;
238
238
  //#endregion
239
+ //#region src/legacy-compat/decorators/factory.decorator.d.mts
240
+ /**
241
+ * Legacy-compatible Factory decorator.
242
+ *
243
+ * Works with TypeScript experimental decorators (legacy API).
244
+ *
245
+ * @param options - Factory configuration options
246
+ * @returns A class decorator compatible with legacy decorator API
247
+ *
248
+ * @example
249
+ * ```typescript
250
+ * @Factory()
251
+ * export class DatabaseConnectionFactory {
252
+ * create() {
253
+ * return { host: 'localhost', port: 5432 }
254
+ * }
255
+ * }
256
+ * ```
257
+ */
258
+ declare function Factory(options?: FactoryOptions): (target: ClassType) => ClassType;
259
+ //#endregion
239
260
  //#region src/legacy-compat/attribute.factory.d.mts
240
261
  /**
241
- * Type for a legacy class attribute decorator without a value.
262
+ * Type for a legacy class/method attribute decorator without a value.
242
263
  *
243
264
  * Attributes are custom metadata decorators that can be applied to modules,
244
265
  * controllers, and endpoints.
245
266
  */
246
- type LegacyClassAttribute = (() => <T extends ClassType>(target: T) => T) & (() => <T extends object>(target: T, propertyKey: string | symbol, descriptor: PropertyDescriptor) => PropertyDescriptor) & {
267
+ type LegacyClassAttribute = {
268
+ (): ClassDecorator & MethodDecorator;
247
269
  token: symbol;
248
270
  };
249
271
  /**
250
- * Type for a legacy class attribute decorator with a validated value.
272
+ * Type for a legacy class/method attribute decorator with a validated value.
251
273
  *
252
274
  * @typeParam S - The Zod schema type for validation
253
275
  */
254
- type LegacyClassSchemaAttribute<S extends ZodType> = ((value: z$1.input<S>) => <T extends ClassType>(target: T) => T) & ((value: z$1.input<S>) => <T extends object>(target: T, propertyKey: string | symbol, descriptor: PropertyDescriptor) => PropertyDescriptor) & {
276
+ type LegacyClassSchemaAttribute<S extends ZodType> = {
277
+ (value: z$1.input<S>): ClassDecorator & MethodDecorator;
255
278
  token: symbol;
256
279
  schema: ZodType;
257
280
  };
@@ -427,5 +450,5 @@ declare function createClassContext(target: ClassType): ClassDecoratorContext;
427
450
  */
428
451
  declare function createMethodContext(target: any, propertyKey: string | symbol, descriptor: PropertyDescriptor): ClassMethodDecoratorContext;
429
452
  //#endregion
430
- export { LegacyAttributeFactory as AttributeFactory, LegacyAttributeFactory, Controller, type ControllerOptions, Endpoint, type EndpointParams, type EndpointResult, Header, HttpCode, Injectable, type LegacyClassAttribute, type LegacyClassSchemaAttribute, Module, type ModuleOptions, Multipart, type MultipartParams, type MultipartResult, Stream, type StreamParams, UseGuards, createClassContext, createMethodContext };
453
+ export { LegacyAttributeFactory as AttributeFactory, LegacyAttributeFactory, Controller, type ControllerOptions, Endpoint, type EndpointParams, type EndpointResult, Factory, Header, HttpCode, Injectable, type LegacyClassAttribute, type LegacyClassSchemaAttribute, Module, type ModuleOptions, Multipart, type MultipartParams, type MultipartResult, Stream, type StreamParams, UseGuards, createClassContext, createMethodContext };
431
454
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/legacy-compat/decorators/module.decorator.mts","../../src/legacy-compat/decorators/controller.decorator.mts","../../src/legacy-compat/decorators/endpoint.decorator.mts","../../src/legacy-compat/decorators/use-guards.decorator.mts","../../src/legacy-compat/decorators/header.decorator.mts","../../src/legacy-compat/decorators/http-code.decorator.mts","../../src/legacy-compat/decorators/multipart.decorator.mts","../../src/legacy-compat/decorators/stream.decorator.mts","../../src/legacy-compat/decorators/injectable.decorator.mts","../../src/legacy-compat/attribute.factory.mts","../../src/legacy-compat/context-compat.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,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A,CAAA,UEySqB,OFzSrB,CAAA,CAAA,SAAA,EE0SS,0BF1ST,CE0SoC,CF1SpC,CAAA,EAAA,MAAA,EAAA,CE2SO,cF3SP,GE2SwB,kBF3SxB,GE2S6C,eF3S7C,CAAA,GAAA,CAAA,CAAA,EAAA,CAAA,EE4SD,GAAA,CAAE,MF5SD,CE4SQ,CF5SR,CAAA,GAAA,IAAA;EACqB;;;AAAD;;;;;;;;;;;EAiBtB,OAAA,GAAA,CAAA,SAAA,EEuTW,oBFvTX,EAAA,MAAA,EEwTQ,cFxTR,GEwTyB,kBFxTzB,GEwT8C,eFxT9C,CAAA,GAAA,CAAA,CAAA,EAAA,OAAA;EAAuB,OAAA,GAAA,CAAA,UE0TJ,OF1TI,CAAA,CAAA,SAAA,EE2TZ,0BF3TY,CE2Te,CF3Tf,CAAA,EAAA,MAAA,EE4Tf,cF5Te,GE4TE,kBF5TF,GE4TuB,eF5TvB,CAAA,GAAA,CAAA,CAAA,EAAA,OAAA;AAuB3B;;;;;;;iBG1BgB,kBAAA,SAA2B,YAAY;;;ATVvD;;;;;iBSkCgB,mBAAA,wDAGF,qBACX"}
1
+ {"version":3,"file":"index.d.mts","names":[],"sources":["../../src/legacy-compat/decorators/module.decorator.mts","../../src/legacy-compat/decorators/controller.decorator.mts","../../src/legacy-compat/decorators/endpoint.decorator.mts","../../src/legacy-compat/decorators/use-guards.decorator.mts","../../src/legacy-compat/decorators/header.decorator.mts","../../src/legacy-compat/decorators/http-code.decorator.mts","../../src/legacy-compat/decorators/multipart.decorator.mts","../../src/legacy-compat/decorators/stream.decorator.mts","../../src/legacy-compat/decorators/injectable.decorator.mts","../../src/legacy-compat/decorators/factory.decorator.mts","../../src/legacy-compat/attribute.factory.mts","../../src/legacy-compat/context-compat.mts"],"sourcesContent":[],"mappings":";;;;;;;;;;;AAuBA;;;;;;;;ACCA;;;;;;iBDDgB,MAAA,WACL,yBAMgB,cAAS;;;;;;;AAPpC;;;;;;;;ACCA;;;;;iBAAgB,U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SY,EAAA,MAAA,EG0Sf,cH1Se,GG0SE,kBH1SF,GG0SuB,eH1SvB,CAAA,GAAA,CAAA,CAAA,EAAA,OAAA;EAuBX,OAAA,GAAM,CAAA,UGqRC,OHrRD,CAAA,CAAA,SAAA,EGsRP,0BHtRO,CGsRoB,CHtRpB,CAAA,EAAA,MAAA,EGuRV,cHvRU,GGuRO,kBHvRP,GGuR4B,eHvR5B,CAAA,GAAA,CAAA,CAAA,EAAA,OAAA;;;;;;;;iBI1BN,kBAAA,SAA2B,YAAY;;;AVVvD;;;;;iBUkCgB,mBAAA,wDAGF,qBACX"}
@@ -1,5 +1,5 @@
1
1
  import { M as getEndpointMetadata, O as getControllerMetadata, T as hasModuleMetadata, a as HttpCode$1, b as getManagedMetadata, i as Module$1, k as hasControllerMetadata, n as Stream$1, o as Header$1, r as Multipart$1, s as Endpoint$1, t as UseGuards$1, v as Controller$1, w as getModuleMetadata, x as hasManagedMetadata } from "../use-guards.decorator-ChJVzYLW.mjs";
2
- import { Injectable as Injectable$1 } from "@navios/di";
2
+ import { Factory as Factory$1, Injectable as Injectable$1 } from "@navios/di";
3
3
 
4
4
  //#region src/legacy-compat/context-compat.mts
5
5
  /**
@@ -332,6 +332,32 @@ import { Injectable as Injectable$1 } from "@navios/di";
332
332
  };
333
333
  }
334
334
 
335
+ //#endregion
336
+ //#region src/legacy-compat/decorators/factory.decorator.mts
337
+ /**
338
+ * Legacy-compatible Factory decorator.
339
+ *
340
+ * Works with TypeScript experimental decorators (legacy API).
341
+ *
342
+ * @param options - Factory configuration options
343
+ * @returns A class decorator compatible with legacy decorator API
344
+ *
345
+ * @example
346
+ * ```typescript
347
+ * @Factory()
348
+ * export class DatabaseConnectionFactory {
349
+ * create() {
350
+ * return { host: 'localhost', port: 5432 }
351
+ * }
352
+ * }
353
+ * ```
354
+ */ function Factory(options = {}) {
355
+ return function(target) {
356
+ const context = createClassContext(target);
357
+ return (Object.keys(options).length === 0 ? Factory$1() : Factory$1(options))(target, context);
358
+ };
359
+ }
360
+
335
361
  //#endregion
336
362
  //#region src/legacy-compat/attribute.factory.mts
337
363
  /**
@@ -430,5 +456,5 @@ import { Injectable as Injectable$1 } from "@navios/di";
430
456
  };
431
457
 
432
458
  //#endregion
433
- export { LegacyAttributeFactory as AttributeFactory, LegacyAttributeFactory, Controller, Endpoint, Header, HttpCode, Injectable, Module, Multipart, Stream, UseGuards, createClassContext, createMethodContext };
459
+ export { LegacyAttributeFactory as AttributeFactory, LegacyAttributeFactory, Controller, Endpoint, Factory, Header, HttpCode, Injectable, Module, Multipart, Stream, UseGuards, createClassContext, createMethodContext };
434
460
  //# sourceMappingURL=index.mjs.map
@@ -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","Injectable","OriginalInjectable","createClassContext","options","target","context","originalDecorator","Object","keys","length","getControllerMetadata","getEndpointMetadata","getModuleMetadata","hasControllerMetadata","hasModuleMetadata","getManagedMetadata","hasManagedMetadata","createClassContext","createMethodContext","LegacyAttributeFactory","createAttribute","token","schema","res","value","decorator","target","propertyKey","descriptor","isMethodDecorator","undefined","context","metadata","validatedValue","safeParse","success","Error","toString","error","customAttributes","set","data","isController","isModule","isManaged","get","attribute","getAll","values","Array","from","entries","filter","key","map","length","getLast","i","has","AttributeFactory"],"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","../../src/legacy-compat/decorators/injectable.decorator.mts","../../src/legacy-compat/attribute.factory.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 * @internal\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 * @internal\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\ntype StreamParams<\n Url extends string,\n QuerySchema,\n RequestSchema,\n> = 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\n/**\n * Type helper to constrain a PropertyDescriptor's value to match a stream endpoint signature.\n * Supports both with and without reply parameter (Bun doesn't use reply parameter).\n */\ntype StreamMethodDescriptor<\n Url extends string,\n QuerySchema,\n RequestSchema,\n> =\n | TypedPropertyDescriptor<\n (params: StreamParams<Url, QuerySchema, RequestSchema>, reply: any) => any\n >\n | TypedPropertyDescriptor<\n (params: StreamParams<Url, QuerySchema, RequestSchema>) => any\n >\n | TypedPropertyDescriptor<() => any>\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","import type { ClassType } from '@navios/di'\n\nimport {\n Injectable as OriginalInjectable,\n type InjectableOptions,\n} from '@navios/di'\n\nimport { createClassContext } from '../context-compat.mjs'\n\nexport type { InjectableOptions }\n\n/**\n * Legacy-compatible Injectable decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n *\n * @param options - Injectable configuration options\n * @returns A class decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Injectable()\n * export class UserService {\n * getUser(id: string) {\n * return { id, name: 'John' }\n * }\n * }\n * ```\n */\nexport function Injectable(options: InjectableOptions = {}) {\n return function (target: ClassType) {\n const context = createClassContext(target)\n // Use the no-args overload when options is empty, otherwise pass options\n const originalDecorator =\n Object.keys(options).length === 0\n ? OriginalInjectable()\n : // @ts-expect-error - InjectableOptions is a union type, we let runtime handle it\n OriginalInjectable(options)\n return originalDecorator(target, context)\n }\n}\n","import type { ClassType } from '@navios/di'\nimport type { z, ZodType } from 'zod/v4'\n\nimport type {\n ControllerMetadata,\n HandlerMetadata,\n ModuleMetadata,\n} from '../metadata/index.mjs'\n\nimport {\n getControllerMetadata,\n getEndpointMetadata,\n getModuleMetadata,\n hasControllerMetadata,\n hasModuleMetadata,\n} from '../metadata/index.mjs'\nimport {\n getManagedMetadata,\n hasManagedMetadata,\n} from '../metadata/navios-managed.metadata.mjs'\nimport { createClassContext, createMethodContext } from './context-compat.mjs'\n\n/**\n * Type for a legacy class attribute decorator without a value.\n *\n * Attributes are custom metadata decorators that can be applied to modules,\n * controllers, and endpoints.\n */\nexport type LegacyClassAttribute = (() => <T extends ClassType>(\n target: T,\n) => T) &\n (() => <T extends object>(\n target: T,\n propertyKey: string | symbol,\n descriptor: PropertyDescriptor,\n ) => PropertyDescriptor) & {\n token: symbol\n }\n\n/**\n * Type for a legacy class attribute decorator with a validated value.\n *\n * @typeParam S - The Zod schema type for validation\n */\nexport type LegacyClassSchemaAttribute<S extends ZodType> = ((\n value: z.input<S>,\n) => <T extends ClassType>(target: T) => T) &\n ((\n value: z.input<S>,\n ) => <T extends object>(\n target: T,\n propertyKey: string | symbol,\n descriptor: PropertyDescriptor,\n ) => PropertyDescriptor) & {\n token: symbol\n schema: ZodType\n }\n\n/**\n * Legacy-compatible factory for creating custom attribute decorators.\n *\n * Works with TypeScript experimental decorators (legacy API).\n *\n * Attributes allow you to add custom metadata to modules, controllers, and endpoints.\n * This is useful for cross-cutting concerns like rate limiting, caching, API versioning, etc.\n *\n * @example\n * ```typescript\n * // Create a simple boolean attribute\n * const Public = LegacyAttributeFactory.createAttribute(Symbol.for('Public'))\n *\n * // Use it as a decorator\n * @Controller()\n * @Public()\n * export class PublicController { }\n *\n * // Check if attribute exists\n * if (LegacyAttributeFactory.has(Public, controllerMetadata)) {\n * // Skip authentication\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Create an attribute with a validated value\n * const RateLimit = LegacyAttributeFactory.createAttribute(\n * Symbol.for('RateLimit'),\n * z.object({ requests: z.number(), window: z.number() })\n * )\n *\n * // Use it with a value\n * @Endpoint(apiEndpoint)\n * @RateLimit({ requests: 100, window: 60000 })\n * async handler() { }\n *\n * // Get the value\n * const limit = LegacyAttributeFactory.get(RateLimit, endpointMetadata)\n * // limit is typed as { requests: number, window: number } | null\n * ```\n */\nexport class LegacyAttributeFactory {\n /**\n * Creates a simple attribute decorator without a value.\n *\n * @param token - A unique symbol to identify this attribute\n * @returns A decorator function that can be applied to classes or methods\n *\n * @example\n * ```typescript\n * const Public = LegacyAttributeFactory.createAttribute(Symbol.for('Public'))\n *\n * @Public()\n * @Controller()\n * export class PublicController { }\n * ```\n */\n static createAttribute(token: symbol): LegacyClassAttribute\n /**\n * Creates an attribute decorator with a validated value.\n *\n * @param token - A unique symbol to identify this attribute\n * @param schema - A Zod schema to validate the attribute value\n * @returns A decorator function that accepts a value and can be applied to classes or methods\n *\n * @example\n * ```typescript\n * const RateLimit = LegacyAttributeFactory.createAttribute(\n * Symbol.for('RateLimit'),\n * z.object({ requests: z.number(), window: z.number() })\n * )\n *\n * @RateLimit({ requests: 100, window: 60000 })\n * @Endpoint(apiEndpoint)\n * async handler() { }\n * ```\n */\n static createAttribute<T extends ZodType>(\n token: symbol,\n schema: T,\n ): LegacyClassSchemaAttribute<T>\n\n static createAttribute(token: symbol, schema?: ZodType) {\n const res = (value?: unknown) => {\n // Return a decorator that can handle both class and method targets\n function decorator(target: any): any\n function decorator(\n target: any,\n propertyKey: string | symbol,\n descriptor: PropertyDescriptor,\n ): PropertyDescriptor\n function decorator(\n target: any,\n propertyKey?: string | symbol,\n descriptor?: PropertyDescriptor,\n ): any {\n const isMethodDecorator =\n propertyKey !== undefined && descriptor !== undefined\n\n if (isMethodDecorator) {\n // Method decorator - apply to endpoint\n const context = createMethodContext(target, propertyKey, descriptor)\n const metadata = getEndpointMetadata(descriptor.value, context)\n\n if (schema) {\n const validatedValue = schema.safeParse(value)\n if (!validatedValue.success) {\n throw new Error(\n `[Navios] Invalid value for attribute ${token.toString()}: ${validatedValue.error}`,\n )\n }\n metadata.customAttributes.set(token, validatedValue.data)\n } else {\n metadata.customAttributes.set(token, true)\n }\n return descriptor\n } else {\n // Class decorator\n const isController = hasControllerMetadata(target as ClassType)\n const isModule = hasModuleMetadata(target as ClassType)\n const isManaged = hasManagedMetadata(target as ClassType)\n\n if (!isController && !isModule && !isManaged) {\n throw new Error(\n '[Navios] Attribute can only be applied to classes with @Controller, @Module, or other Navios-managed decorators',\n )\n }\n\n const context = createClassContext(target)\n const metadata = isController\n ? getControllerMetadata(target, context)\n : isModule\n ? getModuleMetadata(target, context)\n : isManaged\n ? getManagedMetadata(target)!\n : null\n\n if (!metadata) {\n throw new Error(\n '[Navios] Could not determine metadata for attribute target',\n )\n }\n\n if (schema) {\n const validatedValue = schema.safeParse(value)\n if (!validatedValue.success) {\n throw new Error(\n `[Navios] Invalid value for attribute ${token.toString()}: ${validatedValue.error}`,\n )\n }\n metadata.customAttributes.set(token, validatedValue.data)\n } else {\n metadata.customAttributes.set(token, true)\n }\n return target\n }\n }\n return decorator\n }\n res.token = token\n if (schema) {\n res.schema = schema\n }\n return res\n }\n\n /**\n * Gets the value of an attribute from metadata.\n *\n * Returns `null` if the attribute is not present.\n * For simple attributes (without values), returns `true` if present.\n *\n * @param attribute - The attribute decorator\n * @param target - The metadata object (module, controller, or handler)\n * @returns The attribute value, `true` for simple attributes, or `null` if not found\n *\n * @example\n * ```typescript\n * const isPublic = LegacyAttributeFactory.get(Public, controllerMetadata)\n * // isPublic is true | null\n *\n * const rateLimit = LegacyAttributeFactory.get(RateLimit, endpointMetadata)\n * // rateLimit is { requests: number, window: number } | null\n * ```\n */\n static get(\n attribute: LegacyClassAttribute,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ): true | null\n static get<T extends ZodType>(\n attribute: LegacyClassSchemaAttribute<T>,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ): z.output<T> | null\n static get(\n attribute: LegacyClassAttribute | LegacyClassSchemaAttribute<any>,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ) {\n return target.customAttributes.get(attribute.token) ?? null\n }\n\n /**\n * Gets all values of an attribute from metadata (useful when an attribute can appear multiple times).\n *\n * Returns `null` if the attribute is not present.\n *\n * @param attribute - The attribute decorator\n * @param target - The metadata object (module, controller, or handler)\n * @returns An array of attribute values, or `null` if not found\n *\n * @example\n * ```typescript\n * const tags = LegacyAttributeFactory.getAll(Tag, endpointMetadata)\n * // tags is string[] | null\n * ```\n */\n static getAll(\n attribute: LegacyClassAttribute,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ): Array<true> | null\n static getAll<T extends ZodType>(\n attribute: LegacyClassSchemaAttribute<T>,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ): Array<z.output<T>> | null\n static getAll(\n attribute: LegacyClassAttribute | LegacyClassSchemaAttribute<any>,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ) {\n const values = Array.from(target.customAttributes.entries())\n .filter(([key]) => key === attribute.token)\n .map(([, value]) => value)\n return values.length > 0 ? values : null\n }\n\n /**\n * Gets the last value of an attribute from an array of metadata objects.\n *\n * Searches from the end of the array backwards, useful for finding the most\n * specific attribute value (e.g., endpoint-level overrides module-level).\n *\n * @param attribute - The attribute decorator\n * @param target - An array of metadata objects (typically [module, controller, handler])\n * @returns The last attribute value found, or `null` if not found\n *\n * @example\n * ```typescript\n * // Check attribute hierarchy: endpoint -> controller -> module\n * const rateLimit = LegacyAttributeFactory.getLast(RateLimit, [\n * moduleMetadata,\n * controllerMetadata,\n * endpointMetadata\n * ])\n * ```\n */\n static getLast(\n attribute: LegacyClassAttribute,\n target: (ModuleMetadata | ControllerMetadata | HandlerMetadata<any>)[],\n ): true | null\n static getLast<T extends ZodType>(\n attribute: LegacyClassSchemaAttribute<T>,\n target: (ModuleMetadata | ControllerMetadata | HandlerMetadata<any>)[],\n ): z.output<T> | null\n static getLast(\n attribute: LegacyClassAttribute | LegacyClassSchemaAttribute<any>,\n target: (ModuleMetadata | ControllerMetadata | HandlerMetadata<any>)[],\n ) {\n for (let i = target.length - 1; i >= 0; i--) {\n const value = target[i].customAttributes.get(attribute.token)\n if (value) {\n return value\n }\n }\n return null\n }\n\n /**\n * Checks if an attribute is present on the metadata object.\n *\n * @param attribute - The attribute decorator\n * @param target - The metadata object (module, controller, or handler)\n * @returns `true` if the attribute is present, `false` otherwise\n *\n * @example\n * ```typescript\n * if (LegacyAttributeFactory.has(Public, controllerMetadata)) {\n * // Skip authentication\n * }\n * ```\n */\n static has(\n attribute: LegacyClassAttribute,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ): boolean\n static has<T extends ZodType>(\n attribute: LegacyClassSchemaAttribute<T>,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ): boolean\n static has(\n attribute: LegacyClassAttribute | LegacyClassSchemaAttribute<any>,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ) {\n return target.customAttributes.has(attribute.token)\n }\n}\n\n// Re-export as AttributeFactory for convenience\nexport { LegacyAttributeFactory as AttributeFactory }\n"],"mappings":";;;;;;;;;GAYA,MAAMA,mCAAmB,IAAIC,SAAAA;;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,IAAK;;CA0BzD,OAAO0B,OACLD,WACApB,QACA;EACA,MAAMsB,SAASC,MAAMC,KAAKxB,OAAOa,iBAAiBY,SAAO,CAAA,CACtDC,QAAQ,CAACC,SAASA,QAAQP,UAAUzB,MAAK,CACzCiC,KAAK,GAAG9B,WAAWA,MAAAA;AACtB,SAAOwB,OAAOO,SAAS,IAAIP,SAAS;;CA+BtC,OAAOQ,QACLV,WACApB,QACA;AACA,OAAK,IAAI+B,IAAI/B,OAAO6B,SAAS,GAAGE,KAAK,GAAGA,KAAK;GAC3C,MAAMjC,QAAQE,OAAO+B,GAAGlB,iBAAiBM,IAAIC,UAAUzB,MAAK;AAC5D,OAAIG,MACF,QAAOA;;AAGX,SAAO;;CAyBT,OAAOkC,IACLZ,WACApB,QACA;AACA,SAAOA,OAAOa,iBAAiBmB,IAAIZ,UAAUzB,MAAK"}
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","Injectable","OriginalInjectable","createClassContext","options","target","context","originalDecorator","Object","keys","length","Factory","OriginalFactory","createClassContext","options","target","context","originalDecorator","Object","keys","length","getControllerMetadata","getEndpointMetadata","getModuleMetadata","hasControllerMetadata","hasModuleMetadata","getManagedMetadata","hasManagedMetadata","createClassContext","createMethodContext","LegacyAttributeFactory","createAttribute","token","schema","res","value","decorator","target","propertyKey","descriptor","isMethodDecorator","undefined","context","metadata","validatedValue","safeParse","success","Error","toString","error","customAttributes","set","data","isController","isModule","isManaged","get","attribute","getAll","values","Array","from","entries","filter","key","map","length","getLast","i","has","AttributeFactory"],"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","../../src/legacy-compat/decorators/injectable.decorator.mts","../../src/legacy-compat/decorators/factory.decorator.mts","../../src/legacy-compat/attribute.factory.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 * @internal\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 * @internal\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\ntype StreamParams<\n Url extends string,\n QuerySchema,\n RequestSchema,\n> = 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\n/**\n * Type helper to constrain a PropertyDescriptor's value to match a stream endpoint signature.\n * Supports both with and without reply parameter (Bun doesn't use reply parameter).\n */\ntype StreamMethodDescriptor<\n Url extends string,\n QuerySchema,\n RequestSchema,\n> =\n | TypedPropertyDescriptor<\n (params: StreamParams<Url, QuerySchema, RequestSchema>, reply: any) => any\n >\n | TypedPropertyDescriptor<\n (params: StreamParams<Url, QuerySchema, RequestSchema>) => any\n >\n | TypedPropertyDescriptor<() => any>\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","import type { ClassType } from '@navios/di'\n\nimport {\n Injectable as OriginalInjectable,\n type InjectableOptions,\n} from '@navios/di'\n\nimport { createClassContext } from '../context-compat.mjs'\n\nexport type { InjectableOptions }\n\n/**\n * Legacy-compatible Injectable decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n *\n * @param options - Injectable configuration options\n * @returns A class decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Injectable()\n * export class UserService {\n * getUser(id: string) {\n * return { id, name: 'John' }\n * }\n * }\n * ```\n */\nexport function Injectable(options: InjectableOptions = {}) {\n return function (target: ClassType) {\n const context = createClassContext(target)\n // Use the no-args overload when options is empty, otherwise pass options\n const originalDecorator =\n Object.keys(options).length === 0\n ? OriginalInjectable()\n : // @ts-expect-error - InjectableOptions is a union type, we let runtime handle it\n OriginalInjectable(options)\n return originalDecorator(target, context)\n }\n}\n","import type { ClassType, FactoryOptions } from '@navios/di'\n\nimport { Factory as OriginalFactory } from '@navios/di'\n\nimport { createClassContext } from '../context-compat.mjs'\n\nexport type { FactoryOptions }\n\n/**\n * Legacy-compatible Factory decorator.\n *\n * Works with TypeScript experimental decorators (legacy API).\n *\n * @param options - Factory configuration options\n * @returns A class decorator compatible with legacy decorator API\n *\n * @example\n * ```typescript\n * @Factory()\n * export class DatabaseConnectionFactory {\n * create() {\n * return { host: 'localhost', port: 5432 }\n * }\n * }\n * ```\n */\nexport function Factory(options: FactoryOptions = {}) {\n return function (target: ClassType) {\n const context = createClassContext(target)\n // Use the no-args overload when options is empty, otherwise pass options\n const originalDecorator =\n Object.keys(options).length === 0\n ? OriginalFactory()\n : OriginalFactory(options)\n return originalDecorator(target, context)\n }\n}\n","import type { z, ZodType } from 'zod/v4'\nimport type { ClassType } from '@navios/di'\n\nimport type {\n ControllerMetadata,\n HandlerMetadata,\n ModuleMetadata,\n} from '../metadata/index.mjs'\n\nimport {\n getControllerMetadata,\n getEndpointMetadata,\n getModuleMetadata,\n hasControllerMetadata,\n hasModuleMetadata,\n} from '../metadata/index.mjs'\nimport {\n getManagedMetadata,\n hasManagedMetadata,\n} from '../metadata/navios-managed.metadata.mjs'\nimport { createClassContext, createMethodContext } from './context-compat.mjs'\n\n/**\n * Type for a legacy class/method attribute decorator without a value.\n *\n * Attributes are custom metadata decorators that can be applied to modules,\n * controllers, and endpoints.\n */\nexport type LegacyClassAttribute = {\n (): ClassDecorator & MethodDecorator\n token: symbol\n}\n\n/**\n * Type for a legacy class/method attribute decorator with a validated value.\n *\n * @typeParam S - The Zod schema type for validation\n */\nexport type LegacyClassSchemaAttribute<S extends ZodType> = {\n (value: z.input<S>): ClassDecorator & MethodDecorator\n token: symbol\n schema: ZodType\n}\n\n/**\n * Legacy-compatible factory for creating custom attribute decorators.\n *\n * Works with TypeScript experimental decorators (legacy API).\n *\n * Attributes allow you to add custom metadata to modules, controllers, and endpoints.\n * This is useful for cross-cutting concerns like rate limiting, caching, API versioning, etc.\n *\n * @example\n * ```typescript\n * // Create a simple boolean attribute\n * const Public = LegacyAttributeFactory.createAttribute(Symbol.for('Public'))\n *\n * // Use it as a decorator\n * @Controller()\n * @Public()\n * export class PublicController { }\n *\n * // Check if attribute exists\n * if (LegacyAttributeFactory.has(Public, controllerMetadata)) {\n * // Skip authentication\n * }\n * ```\n *\n * @example\n * ```typescript\n * // Create an attribute with a validated value\n * const RateLimit = LegacyAttributeFactory.createAttribute(\n * Symbol.for('RateLimit'),\n * z.object({ requests: z.number(), window: z.number() })\n * )\n *\n * // Use it with a value\n * @Endpoint(apiEndpoint)\n * @RateLimit({ requests: 100, window: 60000 })\n * async handler() { }\n *\n * // Get the value\n * const limit = LegacyAttributeFactory.get(RateLimit, endpointMetadata)\n * // limit is typed as { requests: number, window: number } | null\n * ```\n */\nexport class LegacyAttributeFactory {\n /**\n * Creates a simple attribute decorator without a value.\n *\n * @param token - A unique symbol to identify this attribute\n * @returns A decorator function that can be applied to classes or methods\n *\n * @example\n * ```typescript\n * const Public = LegacyAttributeFactory.createAttribute(Symbol.for('Public'))\n *\n * @Public()\n * @Controller()\n * export class PublicController { }\n * ```\n */\n static createAttribute(token: symbol): LegacyClassAttribute\n /**\n * Creates an attribute decorator with a validated value.\n *\n * @param token - A unique symbol to identify this attribute\n * @param schema - A Zod schema to validate the attribute value\n * @returns A decorator function that accepts a value and can be applied to classes or methods\n *\n * @example\n * ```typescript\n * const RateLimit = LegacyAttributeFactory.createAttribute(\n * Symbol.for('RateLimit'),\n * z.object({ requests: z.number(), window: z.number() })\n * )\n *\n * @RateLimit({ requests: 100, window: 60000 })\n * @Endpoint(apiEndpoint)\n * async handler() { }\n * ```\n */\n static createAttribute<T extends ZodType>(\n token: symbol,\n schema: T,\n ): LegacyClassSchemaAttribute<T>\n\n static createAttribute(token: symbol, schema?: ZodType) {\n const res = (value?: unknown) => {\n // Return a decorator that can handle both class and method targets\n function decorator(target: any): any\n function decorator(\n target: any,\n propertyKey: string | symbol,\n descriptor: PropertyDescriptor,\n ): PropertyDescriptor\n function decorator(\n target: any,\n propertyKey?: string | symbol,\n descriptor?: PropertyDescriptor,\n ): any {\n const isMethodDecorator =\n propertyKey !== undefined && descriptor !== undefined\n\n if (isMethodDecorator) {\n // Method decorator - apply to endpoint\n const context = createMethodContext(target, propertyKey, descriptor)\n const metadata = getEndpointMetadata(descriptor.value, context)\n\n if (schema) {\n const validatedValue = schema.safeParse(value)\n if (!validatedValue.success) {\n throw new Error(\n `[Navios] Invalid value for attribute ${token.toString()}: ${validatedValue.error}`,\n )\n }\n metadata.customAttributes.set(token, validatedValue.data)\n } else {\n metadata.customAttributes.set(token, true)\n }\n return descriptor\n } else {\n // Class decorator\n const isController = hasControllerMetadata(target as ClassType)\n const isModule = hasModuleMetadata(target as ClassType)\n const isManaged = hasManagedMetadata(target as ClassType)\n\n if (!isController && !isModule && !isManaged) {\n throw new Error(\n '[Navios] Attribute can only be applied to classes with @Controller, @Module, or other Navios-managed decorators',\n )\n }\n\n const context = createClassContext(target)\n const metadata = isController\n ? getControllerMetadata(target, context)\n : isModule\n ? getModuleMetadata(target, context)\n : isManaged\n ? getManagedMetadata(target)!\n : null\n\n if (!metadata) {\n throw new Error(\n '[Navios] Could not determine metadata for attribute target',\n )\n }\n\n if (schema) {\n const validatedValue = schema.safeParse(value)\n if (!validatedValue.success) {\n throw new Error(\n `[Navios] Invalid value for attribute ${token.toString()}: ${validatedValue.error}`,\n )\n }\n metadata.customAttributes.set(token, validatedValue.data)\n } else {\n metadata.customAttributes.set(token, true)\n }\n return target\n }\n }\n return decorator\n }\n res.token = token\n if (schema) {\n res.schema = schema\n }\n return res\n }\n\n /**\n * Gets the value of an attribute from metadata.\n *\n * Returns `null` if the attribute is not present.\n * For simple attributes (without values), returns `true` if present.\n *\n * @param attribute - The attribute decorator\n * @param target - The metadata object (module, controller, or handler)\n * @returns The attribute value, `true` for simple attributes, or `null` if not found\n *\n * @example\n * ```typescript\n * const isPublic = LegacyAttributeFactory.get(Public, controllerMetadata)\n * // isPublic is true | null\n *\n * const rateLimit = LegacyAttributeFactory.get(RateLimit, endpointMetadata)\n * // rateLimit is { requests: number, window: number } | null\n * ```\n */\n static get(\n attribute: LegacyClassAttribute,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ): true | null\n static get<T extends ZodType>(\n attribute: LegacyClassSchemaAttribute<T>,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ): z.output<T> | null\n static get(\n attribute: LegacyClassAttribute | LegacyClassSchemaAttribute<any>,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ) {\n return target.customAttributes.get(attribute.token) ?? null\n }\n\n /**\n * Gets all values of an attribute from metadata (useful when an attribute can appear multiple times).\n *\n * Returns `null` if the attribute is not present.\n *\n * @param attribute - The attribute decorator\n * @param target - The metadata object (module, controller, or handler)\n * @returns An array of attribute values, or `null` if not found\n *\n * @example\n * ```typescript\n * const tags = LegacyAttributeFactory.getAll(Tag, endpointMetadata)\n * // tags is string[] | null\n * ```\n */\n static getAll(\n attribute: LegacyClassAttribute,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ): Array<true> | null\n static getAll<T extends ZodType>(\n attribute: LegacyClassSchemaAttribute<T>,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ): Array<z.output<T>> | null\n static getAll(\n attribute: LegacyClassAttribute | LegacyClassSchemaAttribute<any>,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ) {\n const values = Array.from(target.customAttributes.entries())\n .filter(([key]) => key === attribute.token)\n .map(([, value]) => value)\n return values.length > 0 ? values : null\n }\n\n /**\n * Gets the last value of an attribute from an array of metadata objects.\n *\n * Searches from the end of the array backwards, useful for finding the most\n * specific attribute value (e.g., endpoint-level overrides module-level).\n *\n * @param attribute - The attribute decorator\n * @param target - An array of metadata objects (typically [module, controller, handler])\n * @returns The last attribute value found, or `null` if not found\n *\n * @example\n * ```typescript\n * // Check attribute hierarchy: endpoint -> controller -> module\n * const rateLimit = LegacyAttributeFactory.getLast(RateLimit, [\n * moduleMetadata,\n * controllerMetadata,\n * endpointMetadata\n * ])\n * ```\n */\n static getLast(\n attribute: LegacyClassAttribute,\n target: (ModuleMetadata | ControllerMetadata | HandlerMetadata<any>)[],\n ): true | null\n static getLast<T extends ZodType>(\n attribute: LegacyClassSchemaAttribute<T>,\n target: (ModuleMetadata | ControllerMetadata | HandlerMetadata<any>)[],\n ): z.output<T> | null\n static getLast(\n attribute: LegacyClassAttribute | LegacyClassSchemaAttribute<any>,\n target: (ModuleMetadata | ControllerMetadata | HandlerMetadata<any>)[],\n ) {\n for (let i = target.length - 1; i >= 0; i--) {\n const value = target[i].customAttributes.get(attribute.token)\n if (value) {\n return value\n }\n }\n return null\n }\n\n /**\n * Checks if an attribute is present on the metadata object.\n *\n * @param attribute - The attribute decorator\n * @param target - The metadata object (module, controller, or handler)\n * @returns `true` if the attribute is present, `false` otherwise\n *\n * @example\n * ```typescript\n * if (LegacyAttributeFactory.has(Public, controllerMetadata)) {\n * // Skip authentication\n * }\n * ```\n */\n static has(\n attribute: LegacyClassAttribute,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ): boolean\n static has<T extends ZodType>(\n attribute: LegacyClassSchemaAttribute<T>,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ): boolean\n static has(\n attribute: LegacyClassAttribute | LegacyClassSchemaAttribute<any>,\n target: ModuleMetadata | ControllerMetadata | HandlerMetadata<any>,\n ) {\n return target.customAttributes.has(attribute.token)\n }\n}\n\n// Re-export as AttributeFactory for convenience\nexport { LegacyAttributeFactory as AttributeFactory }\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;;;;;GAOT,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;;;;;;;;GAUF,SAAgBC,oBACdR,QACAS,aACAC,YAA8B;CAI9B,MAAMZ,cAAcF,eAAeI,OAAAA;AACnC,KAAI,CAACF,YACH,OAAM,IAAIa,MACR,+EAAA;AAMJ,KAAI,CAACjB,iBAAiBO,IAAIH,YAAAA,CACxBJ,kBAAiBQ,IAAIJ,aAAa,EAAC,CAAA;AAIrC,QAAO;EACLO,MAAM;EACNC,MAAMG;EACNN,UALeT,iBAAiBU,IAAIN,YAAAA;EAMpCc,QAAQ;EACRC,SAAS;E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AAOa,iBAAiBmB,IAAIZ,UAAUzB,MAAK"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@navios/core",
3
- "version": "0.9.1",
3
+ "version": "0.9.3",
4
4
  "author": {
5
5
  "name": "Oleksandr Hanzha",
6
6
  "email": "alex@granted.name"
@@ -59,6 +59,6 @@
59
59
  "zod": "^4.2.1"
60
60
  },
61
61
  "dependencies": {
62
- "@navios/di": "^0.9.0"
62
+ "@navios/di": "^0.9.2"
63
63
  }
64
64
  }
@@ -445,7 +445,6 @@ describe('Legacy Decorators Type Safety', () => {
445
445
  @Controller()
446
446
  class RateLimitedController {
447
447
  // Note: For method decorators, @Endpoint must be at the bottom
448
- // @ts-expect-error - legacy decorator is not typed correctly
449
448
  @RateLimit({ requests: 100, window: 60000 })
450
449
  @Endpoint(getUserEndpoint)
451
450
  async getUser(
@@ -1,5 +1,5 @@
1
- import type { ClassType } from '@navios/di'
2
1
  import type { z, ZodType } from 'zod/v4'
2
+ import type { ClassType } from '@navios/di'
3
3
 
4
4
  import type {
5
5
  ControllerMetadata,
@@ -21,40 +21,26 @@ import {
21
21
  import { createClassContext, createMethodContext } from './context-compat.mjs'
22
22
 
23
23
  /**
24
- * Type for a legacy class attribute decorator without a value.
24
+ * Type for a legacy class/method attribute decorator without a value.
25
25
  *
26
26
  * Attributes are custom metadata decorators that can be applied to modules,
27
27
  * controllers, and endpoints.
28
28
  */
29
- export type LegacyClassAttribute = (() => <T extends ClassType>(
30
- target: T,
31
- ) => T) &
32
- (() => <T extends object>(
33
- target: T,
34
- propertyKey: string | symbol,
35
- descriptor: PropertyDescriptor,
36
- ) => PropertyDescriptor) & {
37
- token: symbol
38
- }
29
+ export type LegacyClassAttribute = {
30
+ (): ClassDecorator & MethodDecorator
31
+ token: symbol
32
+ }
39
33
 
40
34
  /**
41
- * Type for a legacy class attribute decorator with a validated value.
35
+ * Type for a legacy class/method attribute decorator with a validated value.
42
36
  *
43
37
  * @typeParam S - The Zod schema type for validation
44
38
  */
45
- export type LegacyClassSchemaAttribute<S extends ZodType> = ((
46
- value: z.input<S>,
47
- ) => <T extends ClassType>(target: T) => T) &
48
- ((
49
- value: z.input<S>,
50
- ) => <T extends object>(
51
- target: T,
52
- propertyKey: string | symbol,
53
- descriptor: PropertyDescriptor,
54
- ) => PropertyDescriptor) & {
55
- token: symbol
56
- schema: ZodType
57
- }
39
+ export type LegacyClassSchemaAttribute<S extends ZodType> = {
40
+ (value: z.input<S>): ClassDecorator & MethodDecorator
41
+ token: symbol
42
+ schema: ZodType
43
+ }
58
44
 
59
45
  /**
60
46
  * Legacy-compatible factory for creating custom attribute decorators.
@@ -0,0 +1,37 @@
1
+ import type { ClassType, FactoryOptions } from '@navios/di'
2
+
3
+ import { Factory as OriginalFactory } from '@navios/di'
4
+
5
+ import { createClassContext } from '../context-compat.mjs'
6
+
7
+ export type { FactoryOptions }
8
+
9
+ /**
10
+ * Legacy-compatible Factory decorator.
11
+ *
12
+ * Works with TypeScript experimental decorators (legacy API).
13
+ *
14
+ * @param options - Factory configuration options
15
+ * @returns A class decorator compatible with legacy decorator API
16
+ *
17
+ * @example
18
+ * ```typescript
19
+ * @Factory()
20
+ * export class DatabaseConnectionFactory {
21
+ * create() {
22
+ * return { host: 'localhost', port: 5432 }
23
+ * }
24
+ * }
25
+ * ```
26
+ */
27
+ export function Factory(options: FactoryOptions = {}) {
28
+ return function (target: ClassType) {
29
+ const context = createClassContext(target)
30
+ // Use the no-args overload when options is empty, otherwise pass options
31
+ const originalDecorator =
32
+ Object.keys(options).length === 0
33
+ ? OriginalFactory()
34
+ : OriginalFactory(options)
35
+ return originalDecorator(target, context)
36
+ }
37
+ }
@@ -7,4 +7,5 @@ export * from './http-code.decorator.mjs'
7
7
  export * from './multipart.decorator.mjs'
8
8
  export * from './stream.decorator.mjs'
9
9
  export * from './injectable.decorator.mjs'
10
+ export * from './factory.decorator.mjs'
10
11
 
@@ -37,6 +37,7 @@ export {
37
37
  Multipart,
38
38
  Stream,
39
39
  Injectable,
40
+ Factory,
40
41
  } from './decorators/index.mjs'
41
42
 
42
43
  // Export legacy-compatible AttributeFactory