azurajs 2.5.2 → 2.5.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.
Files changed (48) hide show
  1. package/dist/{LoggingMiddleware-BBmUUuyX.d.ts → LoggingMiddleware-BZfecAhg.d.ts} +1 -1
  2. package/dist/{LoggingMiddleware-D8FkeXT4.d.cts → LoggingMiddleware-BZvXPu-Q.d.cts} +1 -1
  3. package/dist/{ProxyPlugin--9F0WYSD.d.ts → ProxyPlugin-Cs7B9xzo.d.ts} +2 -2
  4. package/dist/{ProxyPlugin-C9FSADp9.d.cts → ProxyPlugin-rOa2o83O.d.cts} +2 -2
  5. package/dist/{Server-CVyJAYne.d.cts → Server-Cfz6d-2n.d.cts} +3 -2
  6. package/dist/{Server-CbcNkm0I.d.ts → Server-um_Vy8kC.d.ts} +3 -2
  7. package/dist/{Swagger-BuMxfyha.d.ts → Swagger-B-O5nGkf.d.ts} +0 -58
  8. package/dist/{Swagger-BWCRS_VR.d.cts → Swagger-Bfzc_QkC.d.cts} +0 -58
  9. package/dist/{common.type-BPo50rEF.d.ts → common.type-BAw801cA.d.ts} +1 -1
  10. package/dist/{common.type-f0llB3mM.d.cts → common.type-D02Uw2lN.d.cts} +1 -1
  11. package/dist/cors.d.cts +1 -1
  12. package/dist/cors.d.ts +1 -1
  13. package/dist/decorators.cjs.map +1 -1
  14. package/dist/decorators.d.cts +4 -4
  15. package/dist/decorators.d.ts +4 -4
  16. package/dist/decorators.js.map +1 -1
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +5 -5
  19. package/dist/index.d.ts +5 -5
  20. package/dist/index.js.map +1 -1
  21. package/dist/infra.cjs.map +1 -1
  22. package/dist/infra.d.cts +3 -3
  23. package/dist/infra.d.ts +3 -3
  24. package/dist/infra.js.map +1 -1
  25. package/dist/middleware.d.cts +2 -2
  26. package/dist/middleware.d.ts +2 -2
  27. package/dist/plugins.d.cts +3 -3
  28. package/dist/plugins.d.ts +3 -3
  29. package/dist/{proxy.type-B2VypPGc.d.ts → proxy.type-B9XYNOyP.d.ts} +1 -1
  30. package/dist/{proxy.type-ByYzE_1y.d.cts → proxy.type-h1wgeME0.d.cts} +1 -1
  31. package/dist/rate-limit.d.cts +1 -1
  32. package/dist/rate-limit.d.ts +1 -1
  33. package/dist/router.d.cts +1 -1
  34. package/dist/router.d.ts +1 -1
  35. package/dist/swagger.cjs +52 -43
  36. package/dist/swagger.cjs.map +1 -1
  37. package/dist/swagger.d.cts +4 -13
  38. package/dist/swagger.d.ts +4 -13
  39. package/dist/swagger.js +53 -44
  40. package/dist/swagger.js.map +1 -1
  41. package/dist/types.d.cts +2 -2
  42. package/dist/types.d.ts +2 -2
  43. package/package.json +1 -1
  44. package/src/decorators/Swagger.ts +40 -105
  45. package/src/infra/Server.ts +4 -3
  46. package/src/shared/swagger/SwaggerHelper.ts +8 -12
  47. package/src/shared/swagger/index.ts +36 -37
  48. package/src/types/index.ts +3 -1
@@ -1,5 +1,5 @@
1
1
  import { ConfigTypes } from './config.js';
2
- import { R as RequestHandler } from './common.type-BPo50rEF.js';
2
+ import { R as RequestHandler } from './common.type-BAw801cA.js';
3
3
 
4
4
  declare function createLoggingMiddleware(config: ConfigTypes): RequestHandler;
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { ConfigTypes } from './config.cjs';
2
- import { R as RequestHandler } from './common.type-f0llB3mM.cjs';
2
+ import { R as RequestHandler } from './common.type-D02Uw2lN.cjs';
3
3
 
4
4
  declare function createLoggingMiddleware(config: ConfigTypes): RequestHandler;
5
5
 
@@ -1,6 +1,6 @@
1
- import { a as RequestServer } from './common.type-BPo50rEF.js';
1
+ import { a as RequestServer } from './common.type-BAw801cA.js';
2
2
  import { R as ResponseServer } from './response.type-d6e6eU9D.js';
3
- import { P as ProxyOptions } from './proxy.type-B2VypPGc.js';
3
+ import { P as ProxyOptions } from './proxy.type-B9XYNOyP.js';
4
4
 
5
5
  declare function createProxyMiddleware(options: ProxyOptions): (req: RequestServer, res: ResponseServer, next?: Function) => Promise<void>;
6
6
  /**
@@ -1,6 +1,6 @@
1
- import { a as RequestServer } from './common.type-f0llB3mM.cjs';
1
+ import { a as RequestServer } from './common.type-D02Uw2lN.cjs';
2
2
  import { R as ResponseServer } from './response.type-d6e6eU9D.cjs';
3
- import { P as ProxyOptions } from './proxy.type-ByYzE_1y.cjs';
3
+ import { P as ProxyOptions } from './proxy.type-h1wgeME0.cjs';
4
4
 
5
5
  declare function createProxyMiddleware(options: ProxyOptions): (req: RequestServer, res: ResponseServer, next?: Function) => Promise<void>;
6
6
  /**
@@ -1,8 +1,8 @@
1
1
  import { ConfigTypes } from './config.cjs';
2
2
  import http from 'node:http';
3
3
  import { Router } from './router.cjs';
4
- import { R as RequestHandler } from './common.type-f0llB3mM.cjs';
5
- import { P as ProxyOptions } from './proxy.type-ByYzE_1y.cjs';
4
+ import { R as RequestHandler } from './common.type-D02Uw2lN.cjs';
5
+ import { P as ProxyOptions } from './proxy.type-h1wgeME0.cjs';
6
6
 
7
7
  declare class AzuraClient {
8
8
  private opts;
@@ -19,6 +19,7 @@ declare class AzuraClient {
19
19
  private setupDefaultRoutes;
20
20
  getConfig(): ConfigTypes;
21
21
  private init;
22
+ use(prefix: string, mw: RequestHandler): void;
22
23
  use(mw: RequestHandler): void;
23
24
  use(prefix: string, router: Router): void;
24
25
  addRoute(method: string, path: string, ...handlers: RequestHandler[]): void;
@@ -1,8 +1,8 @@
1
1
  import { ConfigTypes } from './config.js';
2
2
  import http from 'node:http';
3
3
  import { Router } from './router.js';
4
- import { R as RequestHandler } from './common.type-BPo50rEF.js';
5
- import { P as ProxyOptions } from './proxy.type-B2VypPGc.js';
4
+ import { R as RequestHandler } from './common.type-BAw801cA.js';
5
+ import { P as ProxyOptions } from './proxy.type-B9XYNOyP.js';
6
6
 
7
7
  declare class AzuraClient {
8
8
  private opts;
@@ -19,6 +19,7 @@ declare class AzuraClient {
19
19
  private setupDefaultRoutes;
20
20
  getConfig(): ConfigTypes;
21
21
  private init;
22
+ use(prefix: string, mw: RequestHandler): void;
22
23
  use(mw: RequestHandler): void;
23
24
  use(prefix: string, router: Router): void;
24
25
  addRoute(method: string, path: string, ...handlers: RequestHandler[]): void;
@@ -1,20 +1,11 @@
1
1
  import { A as ApiDocMetadata, H as Header, q as Schema, v as SecurityRequirement, w as ApiResponseMetadata, x as ApiParameterMetadata, y as ApiBodyMetadata } from './swagger.type-BWq5nhCX.js';
2
2
 
3
- /**
4
- * Decorator to document an endpoint
5
- */
6
3
  declare function ApiDoc(metadata: Omit<ApiDocMetadata, "method" | "path">): MethodDecorator;
7
- /**
8
- * Decorator to document a response
9
- */
10
4
  declare function ApiResponse(statusCode: number, description: string, options?: {
11
5
  type?: any;
12
6
  examples?: Record<string, any>;
13
7
  headers?: Record<string, Header>;
14
8
  }): MethodDecorator;
15
- /**
16
- * Decorator to document a parameter
17
- */
18
9
  declare function ApiParameter(name: string, paramIn: "query" | "header" | "path" | "cookie", options?: {
19
10
  description?: string;
20
11
  required?: boolean;
@@ -22,29 +13,14 @@ declare function ApiParameter(name: string, paramIn: "query" | "header" | "path"
22
13
  example?: any;
23
14
  schema?: Schema;
24
15
  }): MethodDecorator;
25
- /**
26
- * Decorator to document a request body
27
- */
28
16
  declare function ApiBody(description: string, options?: {
29
17
  type?: any;
30
18
  required?: boolean;
31
19
  examples?: Record<string, any>;
32
20
  }): MethodDecorator;
33
- /**
34
- * Decorator to add tags to a controller
35
- */
36
21
  declare function ApiTags(...tags: string[]): ClassDecorator;
37
- /**
38
- * Decorator to mark an endpoint as deprecated
39
- */
40
22
  declare function ApiDeprecated(): MethodDecorator;
41
- /**
42
- * Decorator to add security requirements
43
- */
44
23
  declare function ApiSecurity(...requirements: SecurityRequirement[]): MethodDecorator;
45
- /**
46
- * Helper to get all swagger metadata
47
- */
48
24
  declare function getSwaggerMetadata(target: Function): {
49
25
  metadata: Map<string, ApiDocMetadata> | undefined;
50
26
  responses: Map<string, ApiResponseMetadata[]> | undefined;
@@ -52,40 +28,6 @@ declare function getSwaggerMetadata(target: Function): {
52
28
  body: Map<string, ApiBodyMetadata> | undefined;
53
29
  tags: string[] | undefined;
54
30
  };
55
- /**
56
- * Unified Swagger decorator - Simple and easy to use!
57
- * Document everything in one place with a clean object structure.
58
- *
59
- * @example
60
- * ```typescript
61
- * @Swagger({
62
- * summary: "Get user by ID",
63
- * description: "Retrieve a single user",
64
- * tags: ["Users"],
65
- * parameters: [
66
- * {
67
- * name: "id",
68
- * in: "path",
69
- * description: "User ID",
70
- * required: true,
71
- * schema: { type: "string" },
72
- * example: "123"
73
- * }
74
- * ],
75
- * responses: {
76
- * 200: {
77
- * description: "User found",
78
- * example: { id: "123", name: "John" }
79
- * },
80
- * 404: {
81
- * description: "User not found",
82
- * example: { error: "Not found" }
83
- * }
84
- * }
85
- * })
86
- * getUser(req, res) { }
87
- * ```
88
- */
89
31
  declare function Swagger(config: {
90
32
  summary?: string;
91
33
  description?: string;
@@ -1,20 +1,11 @@
1
1
  import { A as ApiDocMetadata, H as Header, q as Schema, v as SecurityRequirement, w as ApiResponseMetadata, x as ApiParameterMetadata, y as ApiBodyMetadata } from './swagger.type-BWq5nhCX.cjs';
2
2
 
3
- /**
4
- * Decorator to document an endpoint
5
- */
6
3
  declare function ApiDoc(metadata: Omit<ApiDocMetadata, "method" | "path">): MethodDecorator;
7
- /**
8
- * Decorator to document a response
9
- */
10
4
  declare function ApiResponse(statusCode: number, description: string, options?: {
11
5
  type?: any;
12
6
  examples?: Record<string, any>;
13
7
  headers?: Record<string, Header>;
14
8
  }): MethodDecorator;
15
- /**
16
- * Decorator to document a parameter
17
- */
18
9
  declare function ApiParameter(name: string, paramIn: "query" | "header" | "path" | "cookie", options?: {
19
10
  description?: string;
20
11
  required?: boolean;
@@ -22,29 +13,14 @@ declare function ApiParameter(name: string, paramIn: "query" | "header" | "path"
22
13
  example?: any;
23
14
  schema?: Schema;
24
15
  }): MethodDecorator;
25
- /**
26
- * Decorator to document a request body
27
- */
28
16
  declare function ApiBody(description: string, options?: {
29
17
  type?: any;
30
18
  required?: boolean;
31
19
  examples?: Record<string, any>;
32
20
  }): MethodDecorator;
33
- /**
34
- * Decorator to add tags to a controller
35
- */
36
21
  declare function ApiTags(...tags: string[]): ClassDecorator;
37
- /**
38
- * Decorator to mark an endpoint as deprecated
39
- */
40
22
  declare function ApiDeprecated(): MethodDecorator;
41
- /**
42
- * Decorator to add security requirements
43
- */
44
23
  declare function ApiSecurity(...requirements: SecurityRequirement[]): MethodDecorator;
45
- /**
46
- * Helper to get all swagger metadata
47
- */
48
24
  declare function getSwaggerMetadata(target: Function): {
49
25
  metadata: Map<string, ApiDocMetadata> | undefined;
50
26
  responses: Map<string, ApiResponseMetadata[]> | undefined;
@@ -52,40 +28,6 @@ declare function getSwaggerMetadata(target: Function): {
52
28
  body: Map<string, ApiBodyMetadata> | undefined;
53
29
  tags: string[] | undefined;
54
30
  };
55
- /**
56
- * Unified Swagger decorator - Simple and easy to use!
57
- * Document everything in one place with a clean object structure.
58
- *
59
- * @example
60
- * ```typescript
61
- * @Swagger({
62
- * summary: "Get user by ID",
63
- * description: "Retrieve a single user",
64
- * tags: ["Users"],
65
- * parameters: [
66
- * {
67
- * name: "id",
68
- * in: "path",
69
- * description: "User ID",
70
- * required: true,
71
- * schema: { type: "string" },
72
- * example: "123"
73
- * }
74
- * ],
75
- * responses: {
76
- * 200: {
77
- * description: "User found",
78
- * example: { id: "123", name: "John" }
79
- * },
80
- * 404: {
81
- * description: "User not found",
82
- * example: { error: "Not found" }
83
- * }
84
- * }
85
- * })
86
- * getUser(req, res) { }
87
- * ```
88
- */
89
31
  declare function Swagger(config: {
90
32
  summary?: string;
91
33
  description?: string;
@@ -35,4 +35,4 @@ interface HttpContext {
35
35
  body?: Buffer | string | unknown;
36
36
  }
37
37
 
38
- export type { HttpContext as H, RequestHandler as R, RequestServer as a };
38
+ export type { HttpContext as H, NextFunction as N, RequestHandler as R, RequestServer as a };
@@ -35,4 +35,4 @@ interface HttpContext {
35
35
  body?: Buffer | string | unknown;
36
36
  }
37
37
 
38
- export type { HttpContext as H, RequestHandler as R, RequestServer as a };
38
+ export type { HttpContext as H, NextFunction as N, RequestHandler as R, RequestServer as a };
package/dist/cors.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { R as ResponseServer } from './response.type-d6e6eU9D.cjs';
2
- import { H as HttpContext } from './common.type-f0llB3mM.cjs';
2
+ import { H as HttpContext } from './common.type-D02Uw2lN.cjs';
3
3
  import 'node:http';
4
4
 
5
5
  interface CorsOptions {
package/dist/cors.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { R as ResponseServer } from './response.type-d6e6eU9D.js';
2
- import { H as HttpContext } from './common.type-BPo50rEF.js';
2
+ import { H as HttpContext } from './common.type-BAw801cA.js';
3
3
  import 'node:http';
4
4
 
5
5
  interface CorsOptions {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/decorators/Route.ts","../src/decorators/Swagger.ts"],"names":[],"mappings":";;;AAKA,IAAM,MAAA,uBAAa,OAAA,EAA0B;AAC7C,IAAM,MAAA,uBAAa,OAAA,EAAqC;AACxD,IAAM,MAAA,uBAAa,OAAA,EAAkD;AACrE,IAAM,YAAA,uBAAmB,OAAA,EAAuC;AAEzD,SAAS,UAAA,CAAW,SAAS,EAAA,EAAoB;AACtD,EAAA,OAAO,CAAC,MAAA,KAAW;AACjB,IAAA,MAAA,CAAO,GAAA,CAAI,QAAoB,MAAM,CAAA;AAAA,EACvC,CAAA;AACF;AAeA,SAAS,sBAAsB,MAAA,EAAgB;AAC7C,EAAA,OAAO,SAAU,OAAO,EAAA,EAAqB;AAC3C,IAAA,OAAO,CAAC,QAAQ,WAAA,KAAgB;AAC9B,MAAA,MAAM,IAAA,GACJ,OAAO,MAAA,KAAW,UAAA,GAAc,SAAuB,MAAA,CAAe,WAAA;AACxE,MAAA,MAAM,GAAA,GAAM,OAAO,WAAW,CAAA;AAC9B,MAAA,MAAM,MAAA,GAAS,MAAA,CAAO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AAA,CAAa,GAAA,CAAI,MAAM,GAAG,CAAA;AAAA,IAC5B;AAEA,IAAA,MAAM,GAAA,GAAM,OAAO,WAAW,CAAA;AAC9B,IAAA,MAAM,QAAA,GAAW,GAAA,CAAI,GAAA,CAAI,GAAG,KAAK,EAAC;AAClC,IAAA,GAAA,CAAI,IAAI,GAAA,EAAK,EAAE,GAAG,QAAA,EAAU,QAAA,EAAU,cAAc,CAAA;AAAA,EACtD,CAAA;AACF;AAKO,SAAS,mBAAmB,MAAA,EAAkB;AACnD,EAAA,OAAO;AAAA,IACL,QAAA,EAAU,YAAA,CAAa,GAAA,CAAI,MAAM,CAAA;AAAA,IACjC,SAAA,EAAW,aAAA,CAAc,GAAA,CAAI,MAAM,CAAA;AAAA,IACnC,UAAA,EAAY,cAAA,CAAe,GAAA,CAAI,MAAM,CAAA;AAAA,IACrC,IAAA,EAAM,QAAA,CAAS,GAAA,CAAI,MAAM,CAAA;AAAA,IACzB,IAAA,EAAM,QAAA,CAAS,GAAA,CAAI,MAAM;AAAA,GAC3B;AACF","file":"decorators.cjs","sourcesContent":["import type { AzuraClient } from \"../infra/Server\";\nimport type { RequestServer } from \"../types/http/request.type\";\nimport type { ResponseServer } from \"../types/http/response.type\";\nimport type { ParamDefinition, ParamSource, RouteDefinition } from \"../types/routes.type\";\n\nconst PREFIX = new WeakMap<Function, string>();\nconst ROUTES = new WeakMap<Function, RouteDefinition[]>();\nconst PARAMS = new WeakMap<Function, Map<string, ParamDefinition[]>>();\nconst DESCRIPTIONS = new WeakMap<Function, Map<string, string>>();\n\nexport function Controller(prefix = \"\"): ClassDecorator {\n return (target) => {\n PREFIX.set(target as Function, prefix);\n };\n}\n\nexport function Description(description: string): MethodDecorator {\n return (target, propertyKey) => {\n const ctor =\n typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n let map = DESCRIPTIONS.get(ctor);\n if (!map) {\n map = new Map<string, string>();\n DESCRIPTIONS.set(ctor, map);\n }\n map.set(String(propertyKey), description);\n };\n}\n\nfunction createMethodDecorator(method: string) {\n return function (path = \"\"): MethodDecorator {\n return (target, propertyKey) => {\n const ctor =\n typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n const key = String(propertyKey);\n const routes = ROUTES.get(ctor) ?? [];\n const params = PARAMS.get(ctor)?.get(key) ?? [];\n const description = DESCRIPTIONS.get(ctor)?.get(key);\n\n const exists = routes.some(\n (r) => r.method === method && r.path === path && r.propertyKey === key\n );\n if (!exists) {\n routes.push({\n method,\n path,\n propertyKey: key,\n params,\n description,\n });\n ROUTES.set(ctor, routes);\n }\n };\n };\n}\n\nfunction createParamDecorator(type: ParamSource) {\n return function (name?: string): ParameterDecorator {\n return (target, propertyKey, parameterIndex) => {\n const ctor =\n typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n let map = PARAMS.get(ctor);\n if (!map) {\n map = new Map<string, ParamDefinition[]>();\n PARAMS.set(ctor, map);\n }\n\n const key = String(propertyKey);\n const list = map.get(key) ?? [];\n const exists = list.some(\n (p) => p.index === parameterIndex && p.type === type && p.name === name\n );\n if (!exists) {\n list.push({\n index: parameterIndex,\n type,\n name,\n });\n map.set(key, list);\n }\n };\n };\n}\n\nexport const Get = createMethodDecorator(\"GET\");\nexport const Post = createMethodDecorator(\"POST\");\nexport const Put = createMethodDecorator(\"PUT\");\nexport const Delete = createMethodDecorator(\"DELETE\");\nexport const Patch = createMethodDecorator(\"PATCH\");\nexport const Head = createMethodDecorator(\"HEAD\");\nexport const Options = createMethodDecorator(\"OPTIONS\");\n\nexport const Req = createParamDecorator(\"req\");\nexport const Res = createParamDecorator(\"res\");\nexport const Next = createParamDecorator(\"next\");\nexport const Param = createParamDecorator(\"param\");\nexport const Query = createParamDecorator(\"query\");\nexport const Body = createParamDecorator(\"body\");\nexport const Headers = createParamDecorator(\"headers\");\nexport const Ip = createParamDecorator(\"ip\");\nexport const UserAgent = createParamDecorator(\"useragent\");\n\nexport function applyDecorators(app: AzuraClient, controllers: Array<new () => any>) {\n controllers.forEach((ControllerClass) => {\n const prefix = PREFIX.get(ControllerClass) ?? \"\";\n const instance = new ControllerClass();\n const routes = ROUTES.get(ControllerClass) ?? [];\n\n routes.forEach((r) => {\n const handler = async (\n req: RequestServer,\n res: ResponseServer,\n next?: (err?: unknown) => void\n ) => {\n try {\n const params = (r.params ?? []).slice().sort((a, b) => a.index - b.index);\n const args = params.map((p) => {\n switch (p.type) {\n case \"req\":\n return req;\n case \"res\":\n return res;\n case \"next\":\n return next;\n case \"param\":\n return p.name ? req.params[p.name] : req.params;\n case \"query\":\n return p.name ? req.query[p.name] : req.query;\n case \"body\": {\n const body = req.body as Record<string, unknown> | undefined;\n return p.name ? body?.[p.name] : body;\n }\n case \"headers\":\n return p.name ? req.headers[p.name.toLowerCase()] : req.headers;\n case \"ip\":\n return req.ip;\n case \"useragent\":\n return req.headers[\"user-agent\"];\n default:\n return undefined;\n }\n });\n\n const fn = (instance as Record<string, unknown>)[r.propertyKey] as (\n ...args: unknown[]\n ) => unknown;\n const result = fn(...args);\n if (result instanceof Promise) await result;\n } catch (err) {\n if (next) next(err);\n }\n };\n\n app.addRoute(r.method, prefix + r.path, handler);\n });\n });\n}\n\n/**\n * Get routes metadata from a controller class\n * @internal Used by Swagger integration\n */\nexport function getControllerMetadata(ControllerClass: Function) {\n return {\n prefix: PREFIX.get(ControllerClass) || \"\",\n routes: ROUTES.get(ControllerClass) || [],\n params: PARAMS.get(ControllerClass),\n descriptions: DESCRIPTIONS.get(ControllerClass),\n };\n}\n","import type {\n ApiDocMetadata,\n ApiResponseMetadata,\n ApiParameterMetadata,\n ApiBodyMetadata,\n Schema,\n SecurityRequirement,\n Header,\n} from \"../types/swagger.type\";\n\nconst API_METADATA = new WeakMap<Function, Map<string, ApiDocMetadata>>();\nconst API_RESPONSES = new WeakMap<Function, Map<string, ApiResponseMetadata[]>>();\nconst API_PARAMETERS = new WeakMap<Function, Map<string, ApiParameterMetadata[]>>();\nconst API_BODY = new WeakMap<Function, Map<string, ApiBodyMetadata>>();\nconst API_TAGS = new WeakMap<Function, string[]>();\n\n/**\n * Decorator to document an endpoint\n */\nexport function ApiDoc(metadata: Omit<ApiDocMetadata, \"method\" | \"path\">): MethodDecorator {\n return (target, propertyKey) => {\n const ctor =\n typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n let map = API_METADATA.get(ctor);\n if (!map) {\n map = new Map<string, ApiDocMetadata>();\n API_METADATA.set(ctor, map);\n }\n map.set(String(propertyKey), metadata);\n };\n}\n\n/**\n * Decorator to document a response\n */\nexport function ApiResponse(\n statusCode: number,\n description: string,\n options?: {\n type?: any;\n examples?: Record<string, any>;\n headers?: Record<string, Header>;\n }\n): MethodDecorator {\n return (target, propertyKey) => {\n const ctor =\n typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n let map = API_RESPONSES.get(ctor);\n if (!map) {\n map = new Map<string, ApiResponseMetadata[]>();\n API_RESPONSES.set(ctor, map);\n }\n\n const key = String(propertyKey);\n const responses = map.get(key) ?? [];\n responses.push({\n statusCode,\n description,\n type: options?.type,\n examples: options?.examples,\n headers: options?.headers,\n });\n map.set(key, responses);\n };\n}\n\n/**\n * Decorator to document a parameter\n */\nexport function ApiParameter(\n name: string,\n paramIn: \"query\" | \"header\" | \"path\" | \"cookie\",\n options?: {\n description?: string;\n required?: boolean;\n type?: any;\n example?: any;\n schema?: Schema;\n }\n): MethodDecorator {\n return (target, propertyKey) => {\n const ctor =\n typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n let map = API_PARAMETERS.get(ctor);\n if (!map) {\n map = new Map<string, ApiParameterMetadata[]>();\n API_PARAMETERS.set(ctor, map);\n }\n\n const key = String(propertyKey);\n const params = map.get(key) ?? [];\n params.push({\n name,\n in: paramIn,\n description: options?.description,\n required: options?.required,\n type: options?.type,\n example: options?.example,\n schema: options?.schema,\n });\n map.set(key, params);\n };\n}\n\n/**\n * Decorator to document a request body\n */\nexport function ApiBody(\n description: string,\n options?: {\n type?: any;\n required?: boolean;\n examples?: Record<string, any>;\n }\n): MethodDecorator {\n return (target, propertyKey) => {\n const ctor =\n typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n let map = API_BODY.get(ctor);\n if (!map) {\n map = new Map<string, ApiBodyMetadata>();\n API_BODY.set(ctor, map);\n }\n\n map.set(String(propertyKey), {\n description,\n type: options?.type,\n required: options?.required,\n examples: options?.examples,\n });\n };\n}\n\n/**\n * Decorator to add tags to a controller\n */\nexport function ApiTags(...tags: string[]): ClassDecorator {\n return (target) => {\n API_TAGS.set(target as Function, tags);\n };\n}\n\n/**\n * Decorator to mark an endpoint as deprecated\n */\nexport function ApiDeprecated(): MethodDecorator {\n return (target, propertyKey) => {\n const ctor =\n typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n let map = API_METADATA.get(ctor);\n if (!map) {\n map = new Map<string, ApiDocMetadata>();\n API_METADATA.set(ctor, map);\n }\n\n const key = String(propertyKey);\n const existing = map.get(key) ?? {};\n map.set(key, { ...existing, deprecated: true });\n };\n}\n\n/**\n * Decorator to add security requirements\n */\nexport function ApiSecurity(...requirements: SecurityRequirement[]): MethodDecorator {\n return (target, propertyKey) => {\n const ctor =\n typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n let map = API_METADATA.get(ctor);\n if (!map) {\n map = new Map<string, ApiDocMetadata>();\n API_METADATA.set(ctor, map);\n }\n\n const key = String(propertyKey);\n const existing = map.get(key) ?? {};\n map.set(key, { ...existing, security: requirements });\n };\n}\n\n/**\n * Helper to get all swagger metadata\n */\nexport function getSwaggerMetadata(target: Function) {\n return {\n metadata: API_METADATA.get(target),\n responses: API_RESPONSES.get(target),\n parameters: API_PARAMETERS.get(target),\n body: API_BODY.get(target),\n tags: API_TAGS.get(target),\n };\n}\n\n/**\n * Unified Swagger decorator - Simple and easy to use!\n * Document everything in one place with a clean object structure.\n * \n * @example\n * ```typescript\n * @Swagger({\n * summary: \"Get user by ID\",\n * description: \"Retrieve a single user\",\n * tags: [\"Users\"],\n * parameters: [\n * {\n * name: \"id\",\n * in: \"path\",\n * description: \"User ID\",\n * required: true,\n * schema: { type: \"string\" },\n * example: \"123\"\n * }\n * ],\n * responses: {\n * 200: {\n * description: \"User found\",\n * example: { id: \"123\", name: \"John\" }\n * },\n * 404: {\n * description: \"User not found\",\n * example: { error: \"Not found\" }\n * }\n * }\n * })\n * getUser(req, res) { }\n * ```\n */\nexport function Swagger(config: {\n summary?: string;\n description?: string;\n tags?: string[];\n operationId?: string;\n deprecated?: boolean;\n security?: SecurityRequirement[];\n parameters?: Array<{\n name: string;\n in: \"query\" | \"header\" | \"path\" | \"cookie\";\n description?: string;\n required?: boolean;\n schema?: Schema;\n example?: any;\n }>;\n requestBody?: {\n description?: string;\n required?: boolean;\n content?: any;\n example?: any;\n };\n responses?: Record<number, {\n description: string;\n example?: any;\n schema?: Schema;\n headers?: Record<string, Header>;\n }>;\n}): MethodDecorator {\n return (target, propertyKey) => {\n const ctor = typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n const key = String(propertyKey);\n\n // Set basic metadata\n if (config.summary || config.description || config.operationId || config.deprecated !== undefined || config.security) {\n let metaMap = API_METADATA.get(ctor);\n if (!metaMap) {\n metaMap = new Map<string, ApiDocMetadata>();\n API_METADATA.set(ctor, metaMap);\n }\n metaMap.set(key, {\n summary: config.summary,\n description: config.description,\n operationId: config.operationId,\n deprecated: config.deprecated,\n security: config.security,\n tags: config.tags,\n });\n }\n\n // Set parameters\n if (config.parameters && config.parameters.length > 0) {\n let paramMap = API_PARAMETERS.get(ctor);\n if (!paramMap) {\n paramMap = new Map<string, ApiParameterMetadata[]>();\n API_PARAMETERS.set(ctor, paramMap);\n }\n paramMap.set(key, config.parameters.map(p => ({\n name: p.name,\n in: p.in,\n description: p.description,\n required: p.required,\n schema: p.schema,\n example: p.example,\n })));\n }\n\n // Set request body\n if (config.requestBody) {\n let bodyMap = API_BODY.get(ctor);\n if (!bodyMap) {\n bodyMap = new Map<string, ApiBodyMetadata>();\n API_BODY.set(ctor, bodyMap);\n }\n bodyMap.set(key, {\n description: config.requestBody.description,\n required: config.requestBody.required,\n type: config.requestBody.content,\n examples: config.requestBody.example ? { default: config.requestBody.example } : undefined,\n });\n }\n\n // Set responses\n if (config.responses) {\n let respMap = API_RESPONSES.get(ctor);\n if (!respMap) {\n respMap = new Map<string, ApiResponseMetadata[]>();\n API_RESPONSES.set(ctor, respMap);\n }\n const responses = Object.entries(config.responses).map(([code, resp]) => ({\n statusCode: Number(code),\n description: resp.description,\n type: resp.schema,\n examples: resp.example ? { default: resp.example } : undefined,\n headers: resp.headers,\n }));\n respMap.set(key, responses);\n }\n };\n}\n"]}
1
+ {"version":3,"sources":["../src/decorators/Route.ts","../src/decorators/Swagger.ts"],"names":[],"mappings":";;;AAKA,IAAM,MAAA,uBAAa,OAAA,EAA0B;AAC7C,IAAM,MAAA,uBAAa,OAAA,EAAqC;AACxD,IAAM,MAAA,uBAAa,OAAA,EAAkD;AACrE,IAAM,YAAA,uBAAmB,OAAA,EAAuC;AAEzD,SAAS,UAAA,CAAW,SAAS,EAAA,EAAoB;AACtD,EAAA,OAAO,CAAC,MAAA,KAAW;AACjB,IAAA,MAAA,CAAO,GAAA,CAAI,QAAoB,MAAM,CAAA;AAAA,EACvC,CAAA;AACF;AAeA,SAAS,sBAAsB,MAAA,EAAgB;AAC7C,EAAA,OAAO,SAAU,OAAO,EAAA,EAAqB;AAC3C,IAAA,OAAO,CAAC,QAAQ,WAAA,KAAgB;AAC9B,MAAA,MAAM,IAAA,GACJ,OAAO,MAAA,KAAW,UAAA,GAAc,SAAuB,MAAA,CAAe,WAAA;AACxE,MAAA,MAAM,GAAA,GAAM,OAAO,WAAW,CAAA;AAC9B,MAAA,MAAM,MAAA,GAAS,MAAA,CAAO,GAAA,CAAI,IAAI,KAAK,EAAC;AACpC,MAAA,MAAM,MAAA,GAAS,OAAO,GAAA,CAAI,IAAI,GAAG,GAAA,CAAI,GAAG,KAAK,EAAC;AAC9C,MAAA,MAAM,cAAc,YAAA,CAAa,GAAA,CAAI,IAAI,CAAA,EAA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,CAAI,IAAI,GAAA,EAAK,EAAE,GAAG,QAAA,EAAU,QAAA,EAAU,cAAc,CAAA;AAAA,EACtD,CAAA;AACF;AAEO,SAAS,mBAAmB,MAAA,EAAkB;AACnD,EAAA,OAAO;AAAA,IACL,QAAA,EAAU,YAAA,CAAa,GAAA,CAAI,MAAM,CAAA;AAAA,IACjC,SAAA,EAAW,aAAA,CAAc,GAAA,CAAI,MAAM,CAAA;AAAA,IACnC,UAAA,EAAY,cAAA,CAAe,GAAA,CAAI,MAAM,CAAA;AAAA,IACrC,IAAA,EAAM,QAAA,CAAS,GAAA,CAAI,MAAM,CAAA;AAAA,IACzB,IAAA,EAAM,QAAA,CAAS,GAAA,CAAI,MAAM;AAAA,GAC3B;AACF","file":"decorators.cjs","sourcesContent":["import type { AzuraClient } from \"../infra/Server\";\nimport type { RequestServer } from \"../types/http/request.type\";\nimport type { ResponseServer } from \"../types/http/response.type\";\nimport type { ParamDefinition, ParamSource, RouteDefinition } from \"../types/routes.type\";\n\nconst PREFIX = new WeakMap<Function, string>();\nconst ROUTES = new WeakMap<Function, RouteDefinition[]>();\nconst PARAMS = new WeakMap<Function, Map<string, ParamDefinition[]>>();\nconst DESCRIPTIONS = new WeakMap<Function, Map<string, string>>();\n\nexport function Controller(prefix = \"\"): ClassDecorator {\n return (target) => {\n PREFIX.set(target as Function, prefix);\n };\n}\n\nexport function Description(description: string): MethodDecorator {\n return (target, propertyKey) => {\n const ctor =\n typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n let map = DESCRIPTIONS.get(ctor);\n if (!map) {\n map = new Map<string, string>();\n DESCRIPTIONS.set(ctor, map);\n }\n map.set(String(propertyKey), description);\n };\n}\n\nfunction createMethodDecorator(method: string) {\n return function (path = \"\"): MethodDecorator {\n return (target, propertyKey) => {\n const ctor =\n typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n const key = String(propertyKey);\n const routes = ROUTES.get(ctor) ?? [];\n const params = PARAMS.get(ctor)?.get(key) ?? [];\n const description = DESCRIPTIONS.get(ctor)?.get(key);\n\n const exists = routes.some(\n (r) => r.method === method && r.path === path && r.propertyKey === key\n );\n if (!exists) {\n routes.push({\n method,\n path,\n propertyKey: key,\n params,\n description,\n });\n ROUTES.set(ctor, routes);\n }\n };\n };\n}\n\nfunction createParamDecorator(type: ParamSource) {\n return function (name?: string): ParameterDecorator {\n return (target, propertyKey, parameterIndex) => {\n const ctor =\n typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n let map = PARAMS.get(ctor);\n if (!map) {\n map = new Map<string, ParamDefinition[]>();\n PARAMS.set(ctor, map);\n }\n\n const key = String(propertyKey);\n const list = map.get(key) ?? [];\n const exists = list.some(\n (p) => p.index === parameterIndex && p.type === type && p.name === name\n );\n if (!exists) {\n list.push({\n index: parameterIndex,\n type,\n name,\n });\n map.set(key, list);\n }\n };\n };\n}\n\nexport const Get = createMethodDecorator(\"GET\");\nexport const Post = createMethodDecorator(\"POST\");\nexport const Put = createMethodDecorator(\"PUT\");\nexport const Delete = createMethodDecorator(\"DELETE\");\nexport const Patch = createMethodDecorator(\"PATCH\");\nexport const Head = createMethodDecorator(\"HEAD\");\nexport const Options = createMethodDecorator(\"OPTIONS\");\n\nexport const Req = createParamDecorator(\"req\");\nexport const Res = createParamDecorator(\"res\");\nexport const Next = createParamDecorator(\"next\");\nexport const Param = createParamDecorator(\"param\");\nexport const Query = createParamDecorator(\"query\");\nexport const Body = createParamDecorator(\"body\");\nexport const Headers = createParamDecorator(\"headers\");\nexport const Ip = createParamDecorator(\"ip\");\nexport const UserAgent = createParamDecorator(\"useragent\");\n\nexport function applyDecorators(app: AzuraClient, controllers: Array<new () => any>) {\n controllers.forEach((ControllerClass) => {\n const prefix = PREFIX.get(ControllerClass) ?? \"\";\n const instance = new ControllerClass();\n const routes = ROUTES.get(ControllerClass) ?? [];\n\n routes.forEach((r) => {\n const handler = async (\n req: RequestServer,\n res: ResponseServer,\n next?: (err?: unknown) => void\n ) => {\n try {\n const params = (r.params ?? []).slice().sort((a, b) => a.index - b.index);\n const args = params.map((p) => {\n switch (p.type) {\n case \"req\":\n return req;\n case \"res\":\n return res;\n case \"next\":\n return next;\n case \"param\":\n return p.name ? req.params[p.name] : req.params;\n case \"query\":\n return p.name ? req.query[p.name] : req.query;\n case \"body\": {\n const body = req.body as Record<string, unknown> | undefined;\n return p.name ? body?.[p.name] : body;\n }\n case \"headers\":\n return p.name ? req.headers[p.name.toLowerCase()] : req.headers;\n case \"ip\":\n return req.ip;\n case \"useragent\":\n return req.headers[\"user-agent\"];\n default:\n return undefined;\n }\n });\n\n const fn = (instance as Record<string, unknown>)[r.propertyKey] as (\n ...args: unknown[]\n ) => unknown;\n const result = fn(...args);\n if (result instanceof Promise) await result;\n } catch (err) {\n if (next) next(err);\n }\n };\n\n app.addRoute(r.method, prefix + r.path, handler);\n });\n });\n}\n\n/**\n * Get routes metadata from a controller class\n * @internal Used by Swagger integration\n */\nexport function getControllerMetadata(ControllerClass: Function) {\n return {\n prefix: PREFIX.get(ControllerClass) || \"\",\n routes: ROUTES.get(ControllerClass) || [],\n params: PARAMS.get(ControllerClass),\n descriptions: DESCRIPTIONS.get(ControllerClass),\n };\n}\n","import type {\n ApiDocMetadata,\n ApiResponseMetadata,\n ApiParameterMetadata,\n ApiBodyMetadata,\n Schema,\n SecurityRequirement,\n Header,\n} from \"../types/swagger.type\";\n\nconst API_METADATA = new WeakMap<Function, Map<string, ApiDocMetadata>>();\nconst API_RESPONSES = new WeakMap<Function, Map<string, ApiResponseMetadata[]>>();\nconst API_PARAMETERS = new WeakMap<Function, Map<string, ApiParameterMetadata[]>>();\nconst API_BODY = new WeakMap<Function, Map<string, ApiBodyMetadata>>();\nconst API_TAGS = new WeakMap<Function, string[]>();\n\nexport function ApiDoc(metadata: Omit<ApiDocMetadata, \"method\" | \"path\">): MethodDecorator {\n return (target, propertyKey) => {\n const ctor = typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n let map = API_METADATA.get(ctor);\n if (!map) {\n map = new Map<string, ApiDocMetadata>();\n API_METADATA.set(ctor, map);\n }\n map.set(String(propertyKey), metadata);\n };\n}\n\nexport function ApiResponse(\n statusCode: number,\n description: string,\n options?: {\n type?: any;\n examples?: Record<string, any>;\n headers?: Record<string, Header>;\n },\n): MethodDecorator {\n return (target, propertyKey) => {\n const ctor = typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n let map = API_RESPONSES.get(ctor);\n if (!map) {\n map = new Map<string, ApiResponseMetadata[]>();\n API_RESPONSES.set(ctor, map);\n }\n const key = String(propertyKey);\n const responses = map.get(key) ?? [];\n responses.push({\n statusCode,\n description,\n type: options?.type,\n examples: options?.examples,\n headers: options?.headers,\n });\n map.set(key, responses);\n };\n}\n\nexport function ApiParameter(\n name: string,\n paramIn: \"query\" | \"header\" | \"path\" | \"cookie\",\n options?: {\n description?: string;\n required?: boolean;\n type?: any;\n example?: any;\n schema?: Schema;\n },\n): MethodDecorator {\n return (target, propertyKey) => {\n const ctor = typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n let map = API_PARAMETERS.get(ctor);\n if (!map) {\n map = new Map<string, ApiParameterMetadata[]>();\n API_PARAMETERS.set(ctor, map);\n }\n const key = String(propertyKey);\n const params = map.get(key) ?? [];\n params.push({\n name,\n in: paramIn,\n description: options?.description,\n required: options?.required,\n type: options?.type,\n example: options?.example,\n schema: options?.schema,\n });\n map.set(key, params);\n };\n}\n\nexport function ApiBody(\n description: string,\n options?: {\n type?: any;\n required?: boolean;\n examples?: Record<string, any>;\n },\n): MethodDecorator {\n return (target, propertyKey) => {\n const ctor = typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n let map = API_BODY.get(ctor);\n if (!map) {\n map = new Map<string, ApiBodyMetadata>();\n API_BODY.set(ctor, map);\n }\n map.set(String(propertyKey), {\n description,\n type: options?.type,\n required: options?.required,\n examples: options?.examples,\n });\n };\n}\n\nexport function ApiTags(...tags: string[]): ClassDecorator {\n return (target) => {\n API_TAGS.set(target as Function, tags);\n };\n}\n\nexport function ApiDeprecated(): MethodDecorator {\n return (target, propertyKey) => {\n const ctor = typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n let map = API_METADATA.get(ctor);\n if (!map) {\n map = new Map<string, ApiDocMetadata>();\n API_METADATA.set(ctor, map);\n }\n const key = String(propertyKey);\n const existing = map.get(key) ?? {};\n map.set(key, { ...existing, deprecated: true });\n };\n}\n\nexport function ApiSecurity(...requirements: SecurityRequirement[]): MethodDecorator {\n return (target, propertyKey) => {\n const ctor = typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n let map = API_METADATA.get(ctor);\n if (!map) {\n map = new Map<string, ApiDocMetadata>();\n API_METADATA.set(ctor, map);\n }\n const key = String(propertyKey);\n const existing = map.get(key) ?? {};\n map.set(key, { ...existing, security: requirements });\n };\n}\n\nexport function getSwaggerMetadata(target: Function) {\n return {\n metadata: API_METADATA.get(target),\n responses: API_RESPONSES.get(target),\n parameters: API_PARAMETERS.get(target),\n body: API_BODY.get(target),\n tags: API_TAGS.get(target),\n };\n}\n\nexport function Swagger(config: {\n summary?: string;\n description?: string;\n tags?: string[];\n operationId?: string;\n deprecated?: boolean;\n security?: SecurityRequirement[];\n parameters?: Array<{\n name: string;\n in: \"query\" | \"header\" | \"path\" | \"cookie\";\n description?: string;\n required?: boolean;\n schema?: Schema;\n example?: any;\n }>;\n requestBody?: {\n description?: string;\n required?: boolean;\n content?: any;\n example?: any;\n };\n responses?: Record<\n number,\n {\n description: string;\n example?: any;\n schema?: Schema;\n headers?: Record<string, Header>;\n }\n >;\n}): MethodDecorator {\n return (target, propertyKey) => {\n const ctor = typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n const key = String(propertyKey);\n\n // Ensure metadata map exists so other decorators/readers always find it\n let metaMap = API_METADATA.get(ctor);\n if (!metaMap) {\n metaMap = new Map<string, ApiDocMetadata>();\n API_METADATA.set(ctor, metaMap);\n }\n\n const existingMeta = metaMap.get(key) ?? {};\n const newMeta: ApiDocMetadata = {\n summary: config.summary ?? existingMeta.summary,\n description: config.description ?? existingMeta.description,\n operationId: config.operationId ?? existingMeta.operationId,\n deprecated: config.deprecated ?? existingMeta.deprecated,\n security: config.security ?? existingMeta.security,\n tags: config.tags ?? existingMeta.tags,\n };\n metaMap.set(key, newMeta);\n\n if (config.parameters && config.parameters.length > 0) {\n let paramMap = API_PARAMETERS.get(ctor);\n if (!paramMap) {\n paramMap = new Map<string, ApiParameterMetadata[]>();\n API_PARAMETERS.set(ctor, paramMap);\n }\n const existingParams = paramMap.get(key) ?? [];\n const newParams = config.parameters.map((p) => ({\n name: p.name,\n in: p.in,\n description: p.description,\n required: p.required,\n schema: p.schema,\n example: p.example,\n }));\n paramMap.set(key, [...existingParams, ...newParams]);\n }\n\n if (config.requestBody) {\n let bodyMap = API_BODY.get(ctor);\n if (!bodyMap) {\n bodyMap = new Map<string, ApiBodyMetadata>();\n API_BODY.set(ctor, bodyMap);\n }\n bodyMap.set(key, {\n description: config.requestBody.description,\n required: config.requestBody.required,\n type: config.requestBody.content,\n examples: config.requestBody.example ? { default: config.requestBody.example } : undefined,\n });\n }\n\n if (config.responses) {\n let respMap = API_RESPONSES.get(ctor);\n if (!respMap) {\n respMap = new Map<string, ApiResponseMetadata[]>();\n API_RESPONSES.set(ctor, respMap);\n }\n const existing = respMap.get(key) ?? [];\n const responses = Object.entries(config.responses).map(([code, resp]) => ({\n statusCode: Number(code),\n description: resp.description,\n type: resp.schema,\n examples: resp.example ? { default: resp.example } : undefined,\n headers: resp.headers,\n }));\n respMap.set(key, [...existing, ...responses]);\n }\n };\n}\n"]}
@@ -1,13 +1,13 @@
1
- import { A as AzuraClient } from './Server-CVyJAYne.cjs';
1
+ import { A as AzuraClient } from './Server-Cfz6d-2n.cjs';
2
2
  import { R as RouteDefinition, P as ParamDefinition } from './swagger.type-BWq5nhCX.cjs';
3
3
  export { a as ParamSource } from './swagger.type-BWq5nhCX.cjs';
4
- export { c as ApiBody, e as ApiDeprecated, A as ApiDoc, b as ApiParameter, a as ApiResponse, f as ApiSecurity, d as ApiTags, g as getSwaggerMetadata } from './Swagger-BWCRS_VR.cjs';
4
+ export { c as ApiBody, e as ApiDeprecated, A as ApiDoc, b as ApiParameter, a as ApiResponse, f as ApiSecurity, d as ApiTags, g as getSwaggerMetadata } from './Swagger-Bfzc_QkC.cjs';
5
5
  import './config.cjs';
6
6
  import 'node:http';
7
7
  import './router.cjs';
8
- import './common.type-f0llB3mM.cjs';
8
+ import './common.type-D02Uw2lN.cjs';
9
9
  import './response.type-d6e6eU9D.cjs';
10
- import './proxy.type-ByYzE_1y.cjs';
10
+ import './proxy.type-h1wgeME0.cjs';
11
11
 
12
12
  declare function Controller(prefix?: string): ClassDecorator;
13
13
  declare const Get: (path?: string) => MethodDecorator;
@@ -1,13 +1,13 @@
1
- import { A as AzuraClient } from './Server-CbcNkm0I.js';
1
+ import { A as AzuraClient } from './Server-um_Vy8kC.js';
2
2
  import { R as RouteDefinition, P as ParamDefinition } from './swagger.type-BWq5nhCX.js';
3
3
  export { a as ParamSource } from './swagger.type-BWq5nhCX.js';
4
- export { c as ApiBody, e as ApiDeprecated, A as ApiDoc, b as ApiParameter, a as ApiResponse, f as ApiSecurity, d as ApiTags, g as getSwaggerMetadata } from './Swagger-BuMxfyha.js';
4
+ export { c as ApiBody, e as ApiDeprecated, A as ApiDoc, b as ApiParameter, a as ApiResponse, f as ApiSecurity, d as ApiTags, g as getSwaggerMetadata } from './Swagger-B-O5nGkf.js';
5
5
  import './config.js';
6
6
  import 'node:http';
7
7
  import './router.js';
8
- import './common.type-BPo50rEF.js';
8
+ import './common.type-BAw801cA.js';
9
9
  import './response.type-d6e6eU9D.js';
10
- import './proxy.type-B2VypPGc.js';
10
+ import './proxy.type-B9XYNOyP.js';
11
11
 
12
12
  declare function Controller(prefix?: string): ClassDecorator;
13
13
  declare const Get: (path?: string) => MethodDecorator;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/decorators/Route.ts","../src/decorators/Swagger.ts"],"names":[],"mappings":";AAKA,IAAM,MAAA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;AAAA,GAC3B;AACF","file":"decorators.js","sourcesContent":["import type { AzuraClient } from \"../infra/Server\";\nimport type { RequestServer } from \"../types/http/request.type\";\nimport type { ResponseServer } from \"../types/http/response.type\";\nimport type { ParamDefinition, ParamSource, RouteDefinition } from \"../types/routes.type\";\n\nconst PREFIX = new WeakMap<Function, string>();\nconst ROUTES = new WeakMap<Function, RouteDefinition[]>();\nconst PARAMS = new WeakMap<Function, Map<string, ParamDefinition[]>>();\nconst DESCRIPTIONS = new WeakMap<Function, Map<string, string>>();\n\nexport function Controller(prefix = \"\"): ClassDecorator {\n return (target) => {\n PREFIX.set(target as Function, prefix);\n };\n}\n\nexport function Description(description: string): MethodDecorator {\n return (target, propertyKey) => {\n const ctor =\n typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n let map = DESCRIPTIONS.get(ctor);\n if (!map) {\n map = new Map<string, string>();\n DESCRIPTIONS.set(ctor, map);\n }\n map.set(String(propertyKey), description);\n };\n}\n\nfunction createMethodDecorator(method: string) {\n return function (path = \"\"): MethodDecorator {\n return (target, propertyKey) => {\n const ctor =\n typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n const key = String(propertyKey);\n const routes = ROUTES.get(ctor) ?? [];\n const params = PARAMS.get(ctor)?.get(key) ?? [];\n const description = DESCRIPTIONS.get(ctor)?.get(key);\n\n const exists = routes.some(\n (r) => r.method === method && r.path === path && r.propertyKey === key\n );\n if (!exists) {\n routes.push({\n method,\n path,\n propertyKey: key,\n params,\n description,\n });\n ROUTES.set(ctor, routes);\n }\n };\n };\n}\n\nfunction createParamDecorator(type: ParamSource) {\n return function (name?: string): ParameterDecorator {\n return (target, propertyKey, parameterIndex) => {\n const ctor =\n typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n let map = PARAMS.get(ctor);\n if (!map) {\n map = new Map<string, ParamDefinition[]>();\n PARAMS.set(ctor, map);\n }\n\n const key = String(propertyKey);\n const list = map.get(key) ?? [];\n const exists = list.some(\n (p) => p.index === parameterIndex && p.type === type && p.name === name\n );\n if (!exists) {\n list.push({\n index: parameterIndex,\n type,\n name,\n });\n map.set(key, list);\n }\n };\n };\n}\n\nexport const Get = createMethodDecorator(\"GET\");\nexport const Post = createMethodDecorator(\"POST\");\nexport const Put = createMethodDecorator(\"PUT\");\nexport const Delete = createMethodDecorator(\"DELETE\");\nexport const Patch = createMethodDecorator(\"PATCH\");\nexport const Head = createMethodDecorator(\"HEAD\");\nexport const Options = createMethodDecorator(\"OPTIONS\");\n\nexport const Req = createParamDecorator(\"req\");\nexport const Res = createParamDecorator(\"res\");\nexport const Next = createParamDecorator(\"next\");\nexport const Param = createParamDecorator(\"param\");\nexport const Query = createParamDecorator(\"query\");\nexport const Body = createParamDecorator(\"body\");\nexport const Headers = createParamDecorator(\"headers\");\nexport const Ip = createParamDecorator(\"ip\");\nexport const UserAgent = createParamDecorator(\"useragent\");\n\nexport function applyDecorators(app: AzuraClient, controllers: Array<new () => any>) {\n controllers.forEach((ControllerClass) => {\n const prefix = PREFIX.get(ControllerClass) ?? \"\";\n const instance = new ControllerClass();\n const routes = ROUTES.get(ControllerClass) ?? [];\n\n routes.forEach((r) => {\n const handler = async (\n req: RequestServer,\n res: ResponseServer,\n next?: (err?: unknown) => void\n ) => {\n try {\n const params = (r.params ?? []).slice().sort((a, b) => a.index - b.index);\n const args = params.map((p) => {\n switch (p.type) {\n case \"req\":\n return req;\n case \"res\":\n return res;\n case \"next\":\n return next;\n case \"param\":\n return p.name ? req.params[p.name] : req.params;\n case \"query\":\n return p.name ? req.query[p.name] : req.query;\n case \"body\": {\n const body = req.body as Record<string, unknown> | undefined;\n return p.name ? body?.[p.name] : body;\n }\n case \"headers\":\n return p.name ? req.headers[p.name.toLowerCase()] : req.headers;\n case \"ip\":\n return req.ip;\n case \"useragent\":\n return req.headers[\"user-agent\"];\n default:\n return undefined;\n }\n });\n\n const fn = (instance as Record<string, unknown>)[r.propertyKey] as (\n ...args: unknown[]\n ) => unknown;\n const result = fn(...args);\n if (result instanceof Promise) await result;\n } catch (err) {\n if (next) next(err);\n }\n };\n\n app.addRoute(r.method, prefix + r.path, handler);\n });\n });\n}\n\n/**\n * Get routes metadata from a controller class\n * @internal Used by Swagger integration\n */\nexport function getControllerMetadata(ControllerClass: Function) {\n return {\n prefix: PREFIX.get(ControllerClass) || \"\",\n routes: ROUTES.get(ControllerClass) || [],\n params: PARAMS.get(ControllerClass),\n descriptions: DESCRIPTIONS.get(ControllerClass),\n };\n}\n","import type {\n ApiDocMetadata,\n ApiResponseMetadata,\n ApiParameterMetadata,\n ApiBodyMetadata,\n Schema,\n SecurityRequirement,\n Header,\n} from \"../types/swagger.type\";\n\nconst API_METADATA = new WeakMap<Function, Map<string, ApiDocMetadata>>();\nconst API_RESPONSES = new WeakMap<Function, Map<string, ApiResponseMetadata[]>>();\nconst API_PARAMETERS = new WeakMap<Function, Map<string, ApiParameterMetadata[]>>();\nconst API_BODY = new WeakMap<Function, Map<string, ApiBodyMetadata>>();\nconst API_TAGS = new WeakMap<Function, string[]>();\n\n/**\n * Decorator to document an endpoint\n */\nexport function ApiDoc(metadata: Omit<ApiDocMetadata, \"method\" | \"path\">): MethodDecorator {\n return (target, propertyKey) => {\n const ctor =\n typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n let map = API_METADATA.get(ctor);\n if (!map) {\n map = new Map<string, ApiDocMetadata>();\n API_METADATA.set(ctor, map);\n }\n map.set(String(propertyKey), metadata);\n };\n}\n\n/**\n * Decorator to document a response\n */\nexport function ApiResponse(\n statusCode: number,\n description: string,\n options?: {\n type?: any;\n examples?: Record<string, any>;\n headers?: Record<string, Header>;\n }\n): MethodDecorator {\n return (target, propertyKey) => {\n const ctor =\n typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n let map = API_RESPONSES.get(ctor);\n if (!map) {\n map = new Map<string, ApiResponseMetadata[]>();\n API_RESPONSES.set(ctor, map);\n }\n\n const key = String(propertyKey);\n const responses = map.get(key) ?? [];\n responses.push({\n statusCode,\n description,\n type: options?.type,\n examples: options?.examples,\n headers: options?.headers,\n });\n map.set(key, responses);\n };\n}\n\n/**\n * Decorator to document a parameter\n */\nexport function ApiParameter(\n name: string,\n paramIn: \"query\" | \"header\" | \"path\" | \"cookie\",\n options?: {\n description?: string;\n required?: boolean;\n type?: any;\n example?: any;\n schema?: Schema;\n }\n): MethodDecorator {\n return (target, propertyKey) => {\n const ctor =\n typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n let map = API_PARAMETERS.get(ctor);\n if (!map) {\n map = new Map<string, ApiParameterMetadata[]>();\n API_PARAMETERS.set(ctor, map);\n }\n\n const key = String(propertyKey);\n const params = map.get(key) ?? [];\n params.push({\n name,\n in: paramIn,\n description: options?.description,\n required: options?.required,\n type: options?.type,\n example: options?.example,\n schema: options?.schema,\n });\n map.set(key, params);\n };\n}\n\n/**\n * Decorator to document a request body\n */\nexport function ApiBody(\n description: string,\n options?: {\n type?: any;\n required?: boolean;\n examples?: Record<string, any>;\n }\n): MethodDecorator {\n return (target, propertyKey) => {\n const ctor =\n typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n let map = API_BODY.get(ctor);\n if (!map) {\n map = new Map<string, ApiBodyMetadata>();\n API_BODY.set(ctor, map);\n }\n\n map.set(String(propertyKey), {\n description,\n type: options?.type,\n required: options?.required,\n examples: options?.examples,\n });\n };\n}\n\n/**\n * Decorator to add tags to a controller\n */\nexport function ApiTags(...tags: string[]): ClassDecorator {\n return (target) => {\n API_TAGS.set(target as Function, tags);\n };\n}\n\n/**\n * Decorator to mark an endpoint as deprecated\n */\nexport function ApiDeprecated(): MethodDecorator {\n return (target, propertyKey) => {\n const ctor =\n typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n let map = API_METADATA.get(ctor);\n if (!map) {\n map = new Map<string, ApiDocMetadata>();\n API_METADATA.set(ctor, map);\n }\n\n const key = String(propertyKey);\n const existing = map.get(key) ?? {};\n map.set(key, { ...existing, deprecated: true });\n };\n}\n\n/**\n * Decorator to add security requirements\n */\nexport function ApiSecurity(...requirements: SecurityRequirement[]): MethodDecorator {\n return (target, propertyKey) => {\n const ctor =\n typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n let map = API_METADATA.get(ctor);\n if (!map) {\n map = new Map<string, ApiDocMetadata>();\n API_METADATA.set(ctor, map);\n }\n\n const key = String(propertyKey);\n const existing = map.get(key) ?? {};\n map.set(key, { ...existing, security: requirements });\n };\n}\n\n/**\n * Helper to get all swagger metadata\n */\nexport function getSwaggerMetadata(target: Function) {\n return {\n metadata: API_METADATA.get(target),\n responses: API_RESPONSES.get(target),\n parameters: API_PARAMETERS.get(target),\n body: API_BODY.get(target),\n tags: API_TAGS.get(target),\n };\n}\n\n/**\n * Unified Swagger decorator - Simple and easy to use!\n * Document everything in one place with a clean object structure.\n * \n * @example\n * ```typescript\n * @Swagger({\n * summary: \"Get user by ID\",\n * description: \"Retrieve a single user\",\n * tags: [\"Users\"],\n * parameters: [\n * {\n * name: \"id\",\n * in: \"path\",\n * description: \"User ID\",\n * required: true,\n * schema: { type: \"string\" },\n * example: \"123\"\n * }\n * ],\n * responses: {\n * 200: {\n * description: \"User found\",\n * example: { id: \"123\", name: \"John\" }\n * },\n * 404: {\n * description: \"User not found\",\n * example: { error: \"Not found\" }\n * }\n * }\n * })\n * getUser(req, res) { }\n * ```\n */\nexport function Swagger(config: {\n summary?: string;\n description?: string;\n tags?: string[];\n operationId?: string;\n deprecated?: boolean;\n security?: SecurityRequirement[];\n parameters?: Array<{\n name: string;\n in: \"query\" | \"header\" | \"path\" | \"cookie\";\n description?: string;\n required?: boolean;\n schema?: Schema;\n example?: any;\n }>;\n requestBody?: {\n description?: string;\n required?: boolean;\n content?: any;\n example?: any;\n };\n responses?: Record<number, {\n description: string;\n example?: any;\n schema?: Schema;\n headers?: Record<string, Header>;\n }>;\n}): MethodDecorator {\n return (target, propertyKey) => {\n const ctor = typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n const key = String(propertyKey);\n\n // Set basic metadata\n if (config.summary || config.description || config.operationId || config.deprecated !== undefined || config.security) {\n let metaMap = API_METADATA.get(ctor);\n if (!metaMap) {\n metaMap = new Map<string, ApiDocMetadata>();\n API_METADATA.set(ctor, metaMap);\n }\n metaMap.set(key, {\n summary: config.summary,\n description: config.description,\n operationId: config.operationId,\n deprecated: config.deprecated,\n security: config.security,\n tags: config.tags,\n });\n }\n\n // Set parameters\n if (config.parameters && config.parameters.length > 0) {\n let paramMap = API_PARAMETERS.get(ctor);\n if (!paramMap) {\n paramMap = new Map<string, ApiParameterMetadata[]>();\n API_PARAMETERS.set(ctor, paramMap);\n }\n paramMap.set(key, config.parameters.map(p => ({\n name: p.name,\n in: p.in,\n description: p.description,\n required: p.required,\n schema: p.schema,\n example: p.example,\n })));\n }\n\n // Set request body\n if (config.requestBody) {\n let bodyMap = API_BODY.get(ctor);\n if (!bodyMap) {\n bodyMap = new Map<string, ApiBodyMetadata>();\n API_BODY.set(ctor, bodyMap);\n }\n bodyMap.set(key, {\n description: config.requestBody.description,\n required: config.requestBody.required,\n type: config.requestBody.content,\n examples: config.requestBody.example ? { default: config.requestBody.example } : undefined,\n });\n }\n\n // Set responses\n if (config.responses) {\n let respMap = API_RESPONSES.get(ctor);\n if (!respMap) {\n respMap = new Map<string, ApiResponseMetadata[]>();\n API_RESPONSES.set(ctor, respMap);\n }\n const responses = Object.entries(config.responses).map(([code, resp]) => ({\n statusCode: Number(code),\n description: resp.description,\n type: resp.schema,\n examples: resp.example ? { default: resp.example } : undefined,\n headers: resp.headers,\n }));\n respMap.set(key, responses);\n }\n };\n}\n"]}
1
+ {"version":3,"sources":["../src/decorators/Route.ts","../src/decorators/Swagger.ts"],"names":[],"mappings":";AAKA,IAAM,MAAA,uBAAa,OAAA,EAA0B;AAC7C,IAAM,MAAA,uBAAa,OAAA,EAAqC;AACxD,IAAM,MAAA,uBAAa,OAAA,EAAkD;AACrE,IAAM,YAAA,uBAAmB,OAAA,EAAuC;AAEzD,SAAS,UAAA,CAAW,SAAS,EAAA,EAAoB;AACtD,E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AI,GAAA,EAAK,EAAE,GAAG,QAAA,EAAU,UAAA,EAAY,MAAM,CAAA;AAAA,EAChD,CAAA;AACF;AAEO,SAAS,eAAe,YAAA,EAAsD;AACnF,EAAA,OAAO,CAAC,QAAQ,WAAA,KAAgB;AAC9B,IAAA,MAAM,IAAA,GAAO,OAAO,MAAA,KAAW,UAAA,GAAc,SAAuB,MAAA,CAAe,WAAA;AACnF,IAAA,IAAI,GAAA,GAAM,YAAA,CAAa,GAAA,CAAI,IAAI,CAAA;AAC/B,IAAA,IAAI,CAAC,GAAA,EAAK;AACR,MAAA,GAAA,uBAAU,GAAA,EAA4B;AACtC,MAAA,YAAA,CAAa,GAAA,CAAI,MAAM,GAAG,CAAA;AAAA,IAC5B;AACA,IAAA,MAAM,GAAA,GAAM,OAAO,WAAW,CAAA;AAC9B,IAAA,MAAM,QAAA,GAAW,GAAA,CAAI,GAAA,CAAI,GAAG,KAAK,EAAC;AAClC,IAAA,GAAA,CAAI,IAAI,GAAA,EAAK,EAAE,GAAG,QAAA,EAAU,QAAA,EAAU,cAAc,CAAA;AAAA,EACtD,CAAA;AACF;AAEO,SAAS,mBAAmB,MAAA,EAAkB;AACnD,EAAA,OAAO;AAAA,IACL,QAAA,EAAU,YAAA,CAAa,GAAA,CAAI,MAAM,CAAA;AAAA,IACjC,SAAA,EAAW,aAAA,CAAc,GAAA,CAAI,MAAM,CAAA;AAAA,IACnC,UAAA,EAAY,cAAA,CAAe,GAAA,CAAI,MAAM,CAAA;AAAA,IACrC,IAAA,EAAM,QAAA,CAAS,GAAA,CAAI,MAAM,CAAA;AAAA,IACzB,IAAA,EAAM,QAAA,CAAS,GAAA,CAAI,MAAM;AAAA,GAC3B;AACF","file":"decorators.js","sourcesContent":["import type { AzuraClient } from \"../infra/Server\";\nimport type { RequestServer } from \"../types/http/request.type\";\nimport type { ResponseServer } from \"../types/http/response.type\";\nimport type { ParamDefinition, ParamSource, RouteDefinition } from \"../types/routes.type\";\n\nconst PREFIX = new WeakMap<Function, string>();\nconst ROUTES = new WeakMap<Function, RouteDefinition[]>();\nconst PARAMS = new WeakMap<Function, Map<string, ParamDefinition[]>>();\nconst DESCRIPTIONS = new WeakMap<Function, Map<string, string>>();\n\nexport function Controller(prefix = \"\"): ClassDecorator {\n return (target) => {\n PREFIX.set(target as Function, prefix);\n };\n}\n\nexport function Description(description: string): MethodDecorator {\n return (target, propertyKey) => {\n const ctor =\n typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n let map = DESCRIPTIONS.get(ctor);\n if (!map) {\n map = new Map<string, string>();\n DESCRIPTIONS.set(ctor, map);\n }\n map.set(String(propertyKey), description);\n };\n}\n\nfunction createMethodDecorator(method: string) {\n return function (path = \"\"): MethodDecorator {\n return (target, propertyKey) => {\n const ctor =\n typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n const key = String(propertyKey);\n const routes = ROUTES.get(ctor) ?? [];\n const params = PARAMS.get(ctor)?.get(key) ?? [];\n const description = DESCRIPTIONS.get(ctor)?.get(key);\n\n const exists = routes.some(\n (r) => r.method === method && r.path === path && r.propertyKey === key\n );\n if (!exists) {\n routes.push({\n method,\n path,\n propertyKey: key,\n params,\n description,\n });\n ROUTES.set(ctor, routes);\n }\n };\n };\n}\n\nfunction createParamDecorator(type: ParamSource) {\n return function (name?: string): ParameterDecorator {\n return (target, propertyKey, parameterIndex) => {\n const ctor =\n typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n let map = PARAMS.get(ctor);\n if (!map) {\n map = new Map<string, ParamDefinition[]>();\n PARAMS.set(ctor, map);\n }\n\n const key = String(propertyKey);\n const list = map.get(key) ?? [];\n const exists = list.some(\n (p) => p.index === parameterIndex && p.type === type && p.name === name\n );\n if (!exists) {\n list.push({\n index: parameterIndex,\n type,\n name,\n });\n map.set(key, list);\n }\n };\n };\n}\n\nexport const Get = createMethodDecorator(\"GET\");\nexport const Post = createMethodDecorator(\"POST\");\nexport const Put = createMethodDecorator(\"PUT\");\nexport const Delete = createMethodDecorator(\"DELETE\");\nexport const Patch = createMethodDecorator(\"PATCH\");\nexport const Head = createMethodDecorator(\"HEAD\");\nexport const Options = createMethodDecorator(\"OPTIONS\");\n\nexport const Req = createParamDecorator(\"req\");\nexport const Res = createParamDecorator(\"res\");\nexport const Next = createParamDecorator(\"next\");\nexport const Param = createParamDecorator(\"param\");\nexport const Query = createParamDecorator(\"query\");\nexport const Body = createParamDecorator(\"body\");\nexport const Headers = createParamDecorator(\"headers\");\nexport const Ip = createParamDecorator(\"ip\");\nexport const UserAgent = createParamDecorator(\"useragent\");\n\nexport function applyDecorators(app: AzuraClient, controllers: Array<new () => any>) {\n controllers.forEach((ControllerClass) => {\n const prefix = PREFIX.get(ControllerClass) ?? \"\";\n const instance = new ControllerClass();\n const routes = ROUTES.get(ControllerClass) ?? [];\n\n routes.forEach((r) => {\n const handler = async (\n req: RequestServer,\n res: ResponseServer,\n next?: (err?: unknown) => void\n ) => {\n try {\n const params = (r.params ?? []).slice().sort((a, b) => a.index - b.index);\n const args = params.map((p) => {\n switch (p.type) {\n case \"req\":\n return req;\n case \"res\":\n return res;\n case \"next\":\n return next;\n case \"param\":\n return p.name ? req.params[p.name] : req.params;\n case \"query\":\n return p.name ? req.query[p.name] : req.query;\n case \"body\": {\n const body = req.body as Record<string, unknown> | undefined;\n return p.name ? body?.[p.name] : body;\n }\n case \"headers\":\n return p.name ? req.headers[p.name.toLowerCase()] : req.headers;\n case \"ip\":\n return req.ip;\n case \"useragent\":\n return req.headers[\"user-agent\"];\n default:\n return undefined;\n }\n });\n\n const fn = (instance as Record<string, unknown>)[r.propertyKey] as (\n ...args: unknown[]\n ) => unknown;\n const result = fn(...args);\n if (result instanceof Promise) await result;\n } catch (err) {\n if (next) next(err);\n }\n };\n\n app.addRoute(r.method, prefix + r.path, handler);\n });\n });\n}\n\n/**\n * Get routes metadata from a controller class\n * @internal Used by Swagger integration\n */\nexport function getControllerMetadata(ControllerClass: Function) {\n return {\n prefix: PREFIX.get(ControllerClass) || \"\",\n routes: ROUTES.get(ControllerClass) || [],\n params: PARAMS.get(ControllerClass),\n descriptions: DESCRIPTIONS.get(ControllerClass),\n };\n}\n","import type {\n ApiDocMetadata,\n ApiResponseMetadata,\n ApiParameterMetadata,\n ApiBodyMetadata,\n Schema,\n SecurityRequirement,\n Header,\n} from \"../types/swagger.type\";\n\nconst API_METADATA = new WeakMap<Function, Map<string, ApiDocMetadata>>();\nconst API_RESPONSES = new WeakMap<Function, Map<string, ApiResponseMetadata[]>>();\nconst API_PARAMETERS = new WeakMap<Function, Map<string, ApiParameterMetadata[]>>();\nconst API_BODY = new WeakMap<Function, Map<string, ApiBodyMetadata>>();\nconst API_TAGS = new WeakMap<Function, string[]>();\n\nexport function ApiDoc(metadata: Omit<ApiDocMetadata, \"method\" | \"path\">): MethodDecorator {\n return (target, propertyKey) => {\n const ctor = typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n let map = API_METADATA.get(ctor);\n if (!map) {\n map = new Map<string, ApiDocMetadata>();\n API_METADATA.set(ctor, map);\n }\n map.set(String(propertyKey), metadata);\n };\n}\n\nexport function ApiResponse(\n statusCode: number,\n description: string,\n options?: {\n type?: any;\n examples?: Record<string, any>;\n headers?: Record<string, Header>;\n },\n): MethodDecorator {\n return (target, propertyKey) => {\n const ctor = typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n let map = API_RESPONSES.get(ctor);\n if (!map) {\n map = new Map<string, ApiResponseMetadata[]>();\n API_RESPONSES.set(ctor, map);\n }\n const key = String(propertyKey);\n const responses = map.get(key) ?? [];\n responses.push({\n statusCode,\n description,\n type: options?.type,\n examples: options?.examples,\n headers: options?.headers,\n });\n map.set(key, responses);\n };\n}\n\nexport function ApiParameter(\n name: string,\n paramIn: \"query\" | \"header\" | \"path\" | \"cookie\",\n options?: {\n description?: string;\n required?: boolean;\n type?: any;\n example?: any;\n schema?: Schema;\n },\n): MethodDecorator {\n return (target, propertyKey) => {\n const ctor = typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n let map = API_PARAMETERS.get(ctor);\n if (!map) {\n map = new Map<string, ApiParameterMetadata[]>();\n API_PARAMETERS.set(ctor, map);\n }\n const key = String(propertyKey);\n const params = map.get(key) ?? [];\n params.push({\n name,\n in: paramIn,\n description: options?.description,\n required: options?.required,\n type: options?.type,\n example: options?.example,\n schema: options?.schema,\n });\n map.set(key, params);\n };\n}\n\nexport function ApiBody(\n description: string,\n options?: {\n type?: any;\n required?: boolean;\n examples?: Record<string, any>;\n },\n): MethodDecorator {\n return (target, propertyKey) => {\n const ctor = typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n let map = API_BODY.get(ctor);\n if (!map) {\n map = new Map<string, ApiBodyMetadata>();\n API_BODY.set(ctor, map);\n }\n map.set(String(propertyKey), {\n description,\n type: options?.type,\n required: options?.required,\n examples: options?.examples,\n });\n };\n}\n\nexport function ApiTags(...tags: string[]): ClassDecorator {\n return (target) => {\n API_TAGS.set(target as Function, tags);\n };\n}\n\nexport function ApiDeprecated(): MethodDecorator {\n return (target, propertyKey) => {\n const ctor = typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n let map = API_METADATA.get(ctor);\n if (!map) {\n map = new Map<string, ApiDocMetadata>();\n API_METADATA.set(ctor, map);\n }\n const key = String(propertyKey);\n const existing = map.get(key) ?? {};\n map.set(key, { ...existing, deprecated: true });\n };\n}\n\nexport function ApiSecurity(...requirements: SecurityRequirement[]): MethodDecorator {\n return (target, propertyKey) => {\n const ctor = typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n let map = API_METADATA.get(ctor);\n if (!map) {\n map = new Map<string, ApiDocMetadata>();\n API_METADATA.set(ctor, map);\n }\n const key = String(propertyKey);\n const existing = map.get(key) ?? {};\n map.set(key, { ...existing, security: requirements });\n };\n}\n\nexport function getSwaggerMetadata(target: Function) {\n return {\n metadata: API_METADATA.get(target),\n responses: API_RESPONSES.get(target),\n parameters: API_PARAMETERS.get(target),\n body: API_BODY.get(target),\n tags: API_TAGS.get(target),\n };\n}\n\nexport function Swagger(config: {\n summary?: string;\n description?: string;\n tags?: string[];\n operationId?: string;\n deprecated?: boolean;\n security?: SecurityRequirement[];\n parameters?: Array<{\n name: string;\n in: \"query\" | \"header\" | \"path\" | \"cookie\";\n description?: string;\n required?: boolean;\n schema?: Schema;\n example?: any;\n }>;\n requestBody?: {\n description?: string;\n required?: boolean;\n content?: any;\n example?: any;\n };\n responses?: Record<\n number,\n {\n description: string;\n example?: any;\n schema?: Schema;\n headers?: Record<string, Header>;\n }\n >;\n}): MethodDecorator {\n return (target, propertyKey) => {\n const ctor = typeof target === \"function\" ? (target as Function) : (target as any).constructor;\n const key = String(propertyKey);\n\n // Ensure metadata map exists so other decorators/readers always find it\n let metaMap = API_METADATA.get(ctor);\n if (!metaMap) {\n metaMap = new Map<string, ApiDocMetadata>();\n API_METADATA.set(ctor, metaMap);\n }\n\n const existingMeta = metaMap.get(key) ?? {};\n const newMeta: ApiDocMetadata = {\n summary: config.summary ?? existingMeta.summary,\n description: config.description ?? existingMeta.description,\n operationId: config.operationId ?? existingMeta.operationId,\n deprecated: config.deprecated ?? existingMeta.deprecated,\n security: config.security ?? existingMeta.security,\n tags: config.tags ?? existingMeta.tags,\n };\n metaMap.set(key, newMeta);\n\n if (config.parameters && config.parameters.length > 0) {\n let paramMap = API_PARAMETERS.get(ctor);\n if (!paramMap) {\n paramMap = new Map<string, ApiParameterMetadata[]>();\n API_PARAMETERS.set(ctor, paramMap);\n }\n const existingParams = paramMap.get(key) ?? [];\n const newParams = config.parameters.map((p) => ({\n name: p.name,\n in: p.in,\n description: p.description,\n required: p.required,\n schema: p.schema,\n example: p.example,\n }));\n paramMap.set(key, [...existingParams, ...newParams]);\n }\n\n if (config.requestBody) {\n let bodyMap = API_BODY.get(ctor);\n if (!bodyMap) {\n bodyMap = new Map<string, ApiBodyMetadata>();\n API_BODY.set(ctor, bodyMap);\n }\n bodyMap.set(key, {\n description: config.requestBody.description,\n required: config.requestBody.required,\n type: config.requestBody.content,\n examples: config.requestBody.example ? { default: config.requestBody.example } : undefined,\n });\n }\n\n if (config.responses) {\n let respMap = API_RESPONSES.get(ctor);\n if (!respMap) {\n respMap = new Map<string, ApiResponseMetadata[]>();\n API_RESPONSES.set(ctor, respMap);\n }\n const existing = respMap.get(key) ?? [];\n const responses = Object.entries(config.responses).map(([code, resp]) => ({\n statusCode: Number(code),\n description: resp.description,\n type: resp.schema,\n examples: resp.example ? { default: resp.example } : undefined,\n headers: resp.headers,\n }));\n respMap.set(key, [...existing, ...responses]);\n }\n };\n}\n"]}