azurajs 2.4.1-2 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/dist/{LoggingMiddleware-BchkPkH1.d.ts → LoggingMiddleware-BBmUUuyX.d.ts} +1 -1
  2. package/dist/{LoggingMiddleware-CKV1J-pk.d.cts → LoggingMiddleware-D8FkeXT4.d.cts} +1 -1
  3. package/dist/{ProxyPlugin-CBdhfKEk.d.ts → ProxyPlugin--9F0WYSD.d.ts} +2 -2
  4. package/dist/{ProxyPlugin-BOqrVi_Z.d.cts → ProxyPlugin-C9FSADp9.d.cts} +2 -2
  5. package/dist/{Server-ZBdAKUkW.d.cts → Server-CVyJAYne.d.cts} +2 -2
  6. package/dist/{Server-Cxt5ItIO.d.ts → Server-CbcNkm0I.d.ts} +2 -2
  7. package/dist/Swagger-BvqoEq-j.d.cts +56 -0
  8. package/dist/Swagger-VHIdi4fs.d.ts +56 -0
  9. package/dist/{common.type-ydMVG8sw.d.ts → common.type-BPo50rEF.d.ts} +2 -1
  10. package/dist/{common.type-DzWRjunB.d.cts → common.type-f0llB3mM.d.cts} +2 -1
  11. package/dist/config.cjs.map +1 -1
  12. package/dist/config.d.cts +1 -0
  13. package/dist/config.d.ts +1 -0
  14. package/dist/config.js.map +1 -1
  15. package/dist/cors.d.cts +1 -1
  16. package/dist/cors.d.ts +1 -1
  17. package/dist/decorators.cjs +137 -1
  18. package/dist/decorators.cjs.map +1 -1
  19. package/dist/decorators.d.cts +17 -5
  20. package/dist/decorators.d.ts +17 -5
  21. package/dist/decorators.js +129 -2
  22. package/dist/decorators.js.map +1 -1
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +5 -5
  25. package/dist/index.d.ts +5 -5
  26. package/dist/index.js.map +1 -1
  27. package/dist/infra.cjs.map +1 -1
  28. package/dist/infra.d.cts +3 -3
  29. package/dist/infra.d.ts +3 -3
  30. package/dist/infra.js.map +1 -1
  31. package/dist/middleware.d.cts +2 -2
  32. package/dist/middleware.d.ts +2 -2
  33. package/dist/plugins.d.cts +3 -3
  34. package/dist/plugins.d.ts +3 -3
  35. package/dist/{proxy.type-Ccn3auo8.d.ts → proxy.type-B2VypPGc.d.ts} +1 -1
  36. package/dist/{proxy.type-qt4XEHnf.d.cts → proxy.type-ByYzE_1y.d.cts} +1 -1
  37. package/dist/rate-limit.d.cts +1 -1
  38. package/dist/rate-limit.d.ts +1 -1
  39. package/dist/router.d.cts +1 -1
  40. package/dist/router.d.ts +1 -1
  41. package/dist/swagger.cjs +509 -0
  42. package/dist/swagger.cjs.map +1 -0
  43. package/dist/swagger.d.cts +111 -0
  44. package/dist/swagger.d.ts +111 -0
  45. package/dist/swagger.js +496 -0
  46. package/dist/swagger.js.map +1 -0
  47. package/dist/swagger.type-BWq5nhCX.d.cts +290 -0
  48. package/dist/swagger.type-BWq5nhCX.d.ts +290 -0
  49. package/dist/types.d.cts +3 -3
  50. package/dist/types.d.ts +3 -3
  51. package/package.json +7 -1
  52. package/src/decorators/Route.ts +29 -0
  53. package/src/decorators/Swagger.ts +192 -0
  54. package/src/decorators/index.ts +14 -1
  55. package/src/index.ts +1 -1
  56. package/src/infra/utils/RequestHandler.ts +1 -1
  57. package/src/shared/config/ConfigModule.ts +1 -0
  58. package/src/shared/swagger/SwaggerGenerator.ts +341 -0
  59. package/src/shared/swagger/SwaggerHelper.ts +52 -0
  60. package/src/shared/swagger/index.ts +65 -0
  61. package/src/shared/swagger/swagger-ui-modern.html +1200 -0
  62. package/src/swagger.ts +24 -0
  63. package/src/types/common.type.ts +1 -2
  64. package/src/types/index.ts +4 -1
  65. package/src/types/routes.type.ts +1 -0
  66. package/src/types/swagger.type.ts +317 -0
  67. package/dist/routes.type-VPROfhnL.d.cts +0 -14
  68. package/dist/routes.type-VPROfhnL.d.ts +0 -14
@@ -1,5 +1,5 @@
1
1
  import { ConfigTypes } from './config.js';
2
- import { R as RequestHandler } from './common.type-ydMVG8sw.js';
2
+ import { R as RequestHandler } from './common.type-BPo50rEF.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-DzWRjunB.cjs';
2
+ import { R as RequestHandler } from './common.type-f0llB3mM.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-ydMVG8sw.js';
1
+ import { a as RequestServer } from './common.type-BPo50rEF.js';
2
2
  import { R as ResponseServer } from './response.type-d6e6eU9D.js';
3
- import { P as ProxyOptions } from './proxy.type-Ccn3auo8.js';
3
+ import { P as ProxyOptions } from './proxy.type-B2VypPGc.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-DzWRjunB.cjs';
1
+ import { a as RequestServer } from './common.type-f0llB3mM.cjs';
2
2
  import { R as ResponseServer } from './response.type-d6e6eU9D.cjs';
3
- import { P as ProxyOptions } from './proxy.type-qt4XEHnf.cjs';
3
+ import { P as ProxyOptions } from './proxy.type-ByYzE_1y.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-DzWRjunB.cjs';
5
- import { P as ProxyOptions } from './proxy.type-qt4XEHnf.cjs';
4
+ import { R as RequestHandler } from './common.type-f0llB3mM.cjs';
5
+ import { P as ProxyOptions } from './proxy.type-ByYzE_1y.cjs';
6
6
 
7
7
  declare class AzuraClient {
8
8
  private opts;
@@ -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-ydMVG8sw.js';
5
- import { P as ProxyOptions } from './proxy.type-Ccn3auo8.js';
4
+ import { R as RequestHandler } from './common.type-BPo50rEF.js';
5
+ import { P as ProxyOptions } from './proxy.type-B2VypPGc.js';
6
6
 
7
7
  declare class AzuraClient {
8
8
  private opts;
@@ -0,0 +1,56 @@
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
+
3
+ /**
4
+ * Decorator to document an endpoint
5
+ */
6
+ declare function ApiDoc(metadata: Omit<ApiDocMetadata, "method" | "path">): MethodDecorator;
7
+ /**
8
+ * Decorator to document a response
9
+ */
10
+ declare function ApiResponse(statusCode: number, description: string, options?: {
11
+ type?: any;
12
+ examples?: Record<string, any>;
13
+ headers?: Record<string, Header>;
14
+ }): MethodDecorator;
15
+ /**
16
+ * Decorator to document a parameter
17
+ */
18
+ declare function ApiParameter(name: string, paramIn: "query" | "header" | "path" | "cookie", options?: {
19
+ description?: string;
20
+ required?: boolean;
21
+ type?: any;
22
+ example?: any;
23
+ schema?: Schema;
24
+ }): MethodDecorator;
25
+ /**
26
+ * Decorator to document a request body
27
+ */
28
+ declare function ApiBody(description: string, options?: {
29
+ type?: any;
30
+ required?: boolean;
31
+ examples?: Record<string, any>;
32
+ }): MethodDecorator;
33
+ /**
34
+ * Decorator to add tags to a controller
35
+ */
36
+ declare function ApiTags(...tags: string[]): ClassDecorator;
37
+ /**
38
+ * Decorator to mark an endpoint as deprecated
39
+ */
40
+ declare function ApiDeprecated(): MethodDecorator;
41
+ /**
42
+ * Decorator to add security requirements
43
+ */
44
+ declare function ApiSecurity(...requirements: SecurityRequirement[]): MethodDecorator;
45
+ /**
46
+ * Helper to get all swagger metadata
47
+ */
48
+ declare function getSwaggerMetadata(target: Function): {
49
+ metadata: Map<string, ApiDocMetadata> | undefined;
50
+ responses: Map<string, ApiResponseMetadata[]> | undefined;
51
+ parameters: Map<string, ApiParameterMetadata[]> | undefined;
52
+ body: Map<string, ApiBodyMetadata> | undefined;
53
+ tags: string[] | undefined;
54
+ };
55
+
56
+ export { ApiDoc as A, ApiResponse as a, ApiParameter as b, ApiBody as c, ApiTags as d, ApiDeprecated as e, ApiSecurity as f, getSwaggerMetadata as g };
@@ -0,0 +1,56 @@
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
+
3
+ /**
4
+ * Decorator to document an endpoint
5
+ */
6
+ declare function ApiDoc(metadata: Omit<ApiDocMetadata, "method" | "path">): MethodDecorator;
7
+ /**
8
+ * Decorator to document a response
9
+ */
10
+ declare function ApiResponse(statusCode: number, description: string, options?: {
11
+ type?: any;
12
+ examples?: Record<string, any>;
13
+ headers?: Record<string, Header>;
14
+ }): MethodDecorator;
15
+ /**
16
+ * Decorator to document a parameter
17
+ */
18
+ declare function ApiParameter(name: string, paramIn: "query" | "header" | "path" | "cookie", options?: {
19
+ description?: string;
20
+ required?: boolean;
21
+ type?: any;
22
+ example?: any;
23
+ schema?: Schema;
24
+ }): MethodDecorator;
25
+ /**
26
+ * Decorator to document a request body
27
+ */
28
+ declare function ApiBody(description: string, options?: {
29
+ type?: any;
30
+ required?: boolean;
31
+ examples?: Record<string, any>;
32
+ }): MethodDecorator;
33
+ /**
34
+ * Decorator to add tags to a controller
35
+ */
36
+ declare function ApiTags(...tags: string[]): ClassDecorator;
37
+ /**
38
+ * Decorator to mark an endpoint as deprecated
39
+ */
40
+ declare function ApiDeprecated(): MethodDecorator;
41
+ /**
42
+ * Decorator to add security requirements
43
+ */
44
+ declare function ApiSecurity(...requirements: SecurityRequirement[]): MethodDecorator;
45
+ /**
46
+ * Helper to get all swagger metadata
47
+ */
48
+ declare function getSwaggerMetadata(target: Function): {
49
+ metadata: Map<string, ApiDocMetadata> | undefined;
50
+ responses: Map<string, ApiResponseMetadata[]> | undefined;
51
+ parameters: Map<string, ApiParameterMetadata[]> | undefined;
52
+ body: Map<string, ApiBodyMetadata> | undefined;
53
+ tags: string[] | undefined;
54
+ };
55
+
56
+ export { ApiDoc as A, ApiResponse as a, ApiParameter as b, ApiBody as c, ApiTags as d, ApiDeprecated as e, ApiSecurity as f, getSwaggerMetadata as g };
@@ -20,7 +20,8 @@ interface RequestServer extends IncomingMessage {
20
20
  header(name: string): string | undefined;
21
21
  }
22
22
 
23
- type NextFunction = (err?: Error | any) => void | Promise<void>;
23
+ type NextFunction = (err?: Error | unknown) => Promise<void>;
24
+
24
25
  type TraditionalHandler = (req: RequestServer, res: ResponseServer, next?: NextFunction) => void | Promise<void> | unknown;
25
26
  type DestructuredHandler = (ctx: {
26
27
  req: RequestServer;
@@ -20,7 +20,8 @@ interface RequestServer extends IncomingMessage {
20
20
  header(name: string): string | undefined;
21
21
  }
22
22
 
23
- type NextFunction = (err?: Error | any) => void | Promise<void>;
23
+ type NextFunction = (err?: Error | unknown) => Promise<void>;
24
+
24
25
  type TraditionalHandler = (req: RequestServer, res: ResponseServer, next?: NextFunction) => void | Promise<void> | unknown;
25
26
  type DestructuredHandler = (ctx: {
26
27
  req: RequestServer;
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/shared/config/ConfigModule.ts"],"names":["path","existsSync","readFileSync"],"mappings":";;;;;;;;;;;;;;;AAoDO,IAAM,eAAN,MAAmB;AAAA,EAAnB,WAAA,GAAA;AACL,IAAA,IAAA,CAAQ,SAAsB,EAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ/B,QAAA,GAAiB;AACf,IAAA,MAAM,GAAA,GAAM,QAAQ,GAAA,EAAI;AACxB,IAAA,MAAM,WAAA,GAAc;AAAA,MAClB,iBAAA;AAAA,MACA,mBAAA;AAAA,MACA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AA,IAAI,CAAC,MAAA,EAAQ;AACX,MAAA,MAAM,IAAI,MAAM,qDAAqD,CAAA;AAAA,IACvE;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAA,GAAsB;AACpB,IAAA,OAAO,IAAA,CAAK,MAAA;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,IAAiC,GAAA,EAAwB;AACvD,IAAA,OAAO,IAAA,CAAK,OAAO,GAAG,CAAA;AAAA,EACxB;AACF","file":"config.cjs","sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\nimport path from \"node:path\";\n\n/**\n * Config Files Extensions Supported\n * ex: azura.config.*extension\n */\n\ntype SupportedConfigFile = \".js\" | \".ts\" | \".json\" | \".yaml\" | \".yml\";\n\nexport type ConfigTypes = {\n environment?: \"development\" | \"production\";\n debug?: boolean;\n server?: {\n port?: number;\n cluster?: boolean;\n ipHost?: boolean;\n https?: boolean;\n /**\n * Configure trust proxy behavior for IP resolution\n * - true: trust all proxies\n * - false: don't trust any proxies (default)\n * - number: trust the nth hop from the front-facing proxy\n * - string: trust specific IP address or CIDR range\n * - string[]: trust multiple IPs or CIDR ranges\n */\n trustProxy?: boolean | number | string | string[];\n /**\n * Custom header name to read IP from\n * @default 'x-forwarded-for'\n */\n ipHeader?: string;\n };\n plugins?: {\n rateLimit?: {\n enabled: boolean;\n limit: number;\n timeframe: number;\n };\n cors?: {\n enabled: boolean;\n origins: string | string[];\n methods: string | string[];\n allowedHeaders: string | string[];\n };\n };\n logging?: {\n enabled?: boolean;\n showDetails?: boolean;\n };\n};\n\nexport class ConfigModule {\n private config: ConfigTypes = {};\n\n /**\n * Load config files first (azura.config.*)\n * Recivied error if config file not found or invalid format\n * @param configFiles\n */\n\n initSync(): void {\n const cdw = process.cwd();\n const configFiles = [\n \"azura.config.ts\",\n \"azura.config.json\",\n \"azura.config.yaml\",\n \"azura.config.yml\",\n ];\n\n let loaded = false;\n for (const fileName of configFiles) {\n const filePath = path.join(cdw, fileName);\n if (!existsSync(filePath)) continue;\n\n const extension = path.extname(fileName) as SupportedConfigFile;\n const raw = readFileSync(filePath, \"utf8\");\n\n try {\n let parsed: ConfigTypes;\n switch (extension) {\n case \".ts\":\n case \".js\":\n const mod = require(filePath);\n parsed = mod.default || mod;\n break;\n case \".json\":\n parsed = JSON.parse(raw);\n break;\n case \".yaml\":\n case \".yml\":\n parsed = require(\"js-yaml\").load(raw);\n break;\n default:\n throw new Error(`Invalid config file extension: ${extension}`);\n }\n\n this.config = { ...this.config, ...parsed };\n loaded = true;\n break;\n } catch (error: Error | any) {\n throw new Error(`Error loading config file: ${filePath}\\n${error.message}`);\n }\n }\n\n if (!loaded) {\n throw new Error(\"Nothing config file found in the current directory.\");\n }\n }\n\n /**\n * Get all configs from loaded config file\n * @returns ConfigTypes\n */\n\n getAll(): ConfigTypes {\n return this.config;\n }\n\n /**\n * Return a specific config from loaded config file\n *\n * @template T\n * @param {T} key - key of the config to retrieve\n * @returns {ConfigTypes[T]}\n */\n\n get<T extends keyof ConfigTypes>(key: T): ConfigTypes[T] {\n return this.config[key];\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/shared/config/ConfigModule.ts"],"names":["path","existsSync","readFileSync"],"mappings":";;;;;;;;;;;;;;;AAqDO,IAAM,eAAN,MAAmB;AAAA,EAAnB,WAAA,GAAA;AACL,IAAA,IAAA,CAAQ,SAAsB,EAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ/B,QAAA,GAAiB;AACf,IAAA,MAAM,GAAA,GAAM,QAAQ,GAAA,EAAI;AACxB,IAAA,MAAM,WAAA,GAAc;AAAA,MAClB,iBAAA;AAAA,MACA,mBAAA;AAAA,MACA,mBAAA;AAAA,MACA;AAAA,KACF;AAEA,IAAA,IAAI,MAAA,GAAS,KAAA;AACb,IAAA,KAAA,MAAW,YAAY,WAAA,EAAa;AAClC,MAAA,MAAM,QAAA,GAAWA,qBAAA,CA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B,IAAA,OAAO,IAAA,CAAK,MAAA;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,IAAiC,GAAA,EAAwB;AACvD,IAAA,OAAO,IAAA,CAAK,OAAO,GAAG,CAAA;AAAA,EACxB;AACF","file":"config.cjs","sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\nimport path from \"node:path\";\n\n/**\n * Config Files Extensions Supported\n * ex: azura.config.*extension\n */\n\ntype SupportedConfigFile = \".js\" | \".ts\" | \".json\" | \".yaml\" | \".yml\";\n\nexport type ConfigTypes = {\n name?: string;\n environment?: \"development\" | \"production\";\n debug?: boolean;\n server?: {\n port?: number;\n cluster?: boolean;\n ipHost?: boolean;\n https?: boolean;\n /**\n * Configure trust proxy behavior for IP resolution\n * - true: trust all proxies\n * - false: don't trust any proxies (default)\n * - number: trust the nth hop from the front-facing proxy\n * - string: trust specific IP address or CIDR range\n * - string[]: trust multiple IPs or CIDR ranges\n */\n trustProxy?: boolean | number | string | string[];\n /**\n * Custom header name to read IP from\n * @default 'x-forwarded-for'\n */\n ipHeader?: string;\n };\n plugins?: {\n rateLimit?: {\n enabled: boolean;\n limit: number;\n timeframe: number;\n };\n cors?: {\n enabled: boolean;\n origins: string | string[];\n methods: string | string[];\n allowedHeaders: string | string[];\n };\n };\n logging?: {\n enabled?: boolean;\n showDetails?: boolean;\n };\n};\n\nexport class ConfigModule {\n private config: ConfigTypes = {};\n\n /**\n * Load config files first (azura.config.*)\n * Recivied error if config file not found or invalid format\n * @param configFiles\n */\n\n initSync(): void {\n const cdw = process.cwd();\n const configFiles = [\n \"azura.config.ts\",\n \"azura.config.json\",\n \"azura.config.yaml\",\n \"azura.config.yml\",\n ];\n\n let loaded = false;\n for (const fileName of configFiles) {\n const filePath = path.join(cdw, fileName);\n if (!existsSync(filePath)) continue;\n\n const extension = path.extname(fileName) as SupportedConfigFile;\n const raw = readFileSync(filePath, \"utf8\");\n\n try {\n let parsed: ConfigTypes;\n switch (extension) {\n case \".ts\":\n case \".js\":\n const mod = require(filePath);\n parsed = mod.default || mod;\n break;\n case \".json\":\n parsed = JSON.parse(raw);\n break;\n case \".yaml\":\n case \".yml\":\n parsed = require(\"js-yaml\").load(raw);\n break;\n default:\n throw new Error(`Invalid config file extension: ${extension}`);\n }\n\n this.config = { ...this.config, ...parsed };\n loaded = true;\n break;\n } catch (error: Error | any) {\n throw new Error(`Error loading config file: ${filePath}\\n${error.message}`);\n }\n }\n\n if (!loaded) {\n throw new Error(\"Nothing config file found in the current directory.\");\n }\n }\n\n /**\n * Get all configs from loaded config file\n * @returns ConfigTypes\n */\n\n getAll(): ConfigTypes {\n return this.config;\n }\n\n /**\n * Return a specific config from loaded config file\n *\n * @template T\n * @param {T} key - key of the config to retrieve\n * @returns {ConfigTypes[T]}\n */\n\n get<T extends keyof ConfigTypes>(key: T): ConfigTypes[T] {\n return this.config[key];\n }\n}\n"]}
package/dist/config.d.cts CHANGED
@@ -1,4 +1,5 @@
1
1
  type ConfigTypes = {
2
+ name?: string;
2
3
  environment?: "development" | "production";
3
4
  debug?: boolean;
4
5
  server?: {
package/dist/config.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  type ConfigTypes = {
2
+ name?: string;
2
3
  environment?: "development" | "production";
3
4
  debug?: boolean;
4
5
  server?: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/shared/config/ConfigModule.ts"],"names":[],"mappings":";;;;;;;;;AAoDO,IAAM,eAAN,MAAmB;AAAA,EAAnB,WAAA,GAAA;AACL,IAAA,IAAA,CAAQ,SAAsB,EAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ/B,QAAA,GAAiB;AACf,IAAA,MAAM,GAAA,GAAM,QAAQ,GAAA,EAAI;AACxB,IAAA,MAAM,WAAA,GAAc;AAAA,MAClB,iBAAA;AAAA,MACA,mBAAA;AAAA,MACA,mBAAA;AAAA,MACA;AAAA,KACF;AAEA,IAAA,IAAI,MAAA,GA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AqD,CAAA;AAAA,IACvE;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAOA,MAAA,GAAsB;AACpB,IAAA,OAAO,IAAA,CAAK,MAAA;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUA,IAAiC,GAAA,EAAwB;AACvD,IAAA,OAAO,IAAA,CAAK,OAAO,GAAG,CAAA;AAAA,EACxB;AACF","file":"config.js","sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\nimport path from \"node:path\";\n\n/**\n * Config Files Extensions Supported\n * ex: azura.config.*extension\n */\n\ntype SupportedConfigFile = \".js\" | \".ts\" | \".json\" | \".yaml\" | \".yml\";\n\nexport type ConfigTypes = {\n environment?: \"development\" | \"production\";\n debug?: boolean;\n server?: {\n port?: number;\n cluster?: boolean;\n ipHost?: boolean;\n https?: boolean;\n /**\n * Configure trust proxy behavior for IP resolution\n * - true: trust all proxies\n * - false: don't trust any proxies (default)\n * - number: trust the nth hop from the front-facing proxy\n * - string: trust specific IP address or CIDR range\n * - string[]: trust multiple IPs or CIDR ranges\n */\n trustProxy?: boolean | number | string | string[];\n /**\n * Custom header name to read IP from\n * @default 'x-forwarded-for'\n */\n ipHeader?: string;\n };\n plugins?: {\n rateLimit?: {\n enabled: boolean;\n limit: number;\n timeframe: number;\n };\n cors?: {\n enabled: boolean;\n origins: string | string[];\n methods: string | string[];\n allowedHeaders: string | string[];\n };\n };\n logging?: {\n enabled?: boolean;\n showDetails?: boolean;\n };\n};\n\nexport class ConfigModule {\n private config: ConfigTypes = {};\n\n /**\n * Load config files first (azura.config.*)\n * Recivied error if config file not found or invalid format\n * @param configFiles\n */\n\n initSync(): void {\n const cdw = process.cwd();\n const configFiles = [\n \"azura.config.ts\",\n \"azura.config.json\",\n \"azura.config.yaml\",\n \"azura.config.yml\",\n ];\n\n let loaded = false;\n for (const fileName of configFiles) {\n const filePath = path.join(cdw, fileName);\n if (!existsSync(filePath)) continue;\n\n const extension = path.extname(fileName) as SupportedConfigFile;\n const raw = readFileSync(filePath, \"utf8\");\n\n try {\n let parsed: ConfigTypes;\n switch (extension) {\n case \".ts\":\n case \".js\":\n const mod = require(filePath);\n parsed = mod.default || mod;\n break;\n case \".json\":\n parsed = JSON.parse(raw);\n break;\n case \".yaml\":\n case \".yml\":\n parsed = require(\"js-yaml\").load(raw);\n break;\n default:\n throw new Error(`Invalid config file extension: ${extension}`);\n }\n\n this.config = { ...this.config, ...parsed };\n loaded = true;\n break;\n } catch (error: Error | any) {\n throw new Error(`Error loading config file: ${filePath}\\n${error.message}`);\n }\n }\n\n if (!loaded) {\n throw new Error(\"Nothing config file found in the current directory.\");\n }\n }\n\n /**\n * Get all configs from loaded config file\n * @returns ConfigTypes\n */\n\n getAll(): ConfigTypes {\n return this.config;\n }\n\n /**\n * Return a specific config from loaded config file\n *\n * @template T\n * @param {T} key - key of the config to retrieve\n * @returns {ConfigTypes[T]}\n */\n\n get<T extends keyof ConfigTypes>(key: T): ConfigTypes[T] {\n return this.config[key];\n }\n}\n"]}
1
+ {"version":3,"sources":["../src/shared/config/ConfigModule.ts"],"names":[],"mappings":";;;;;;;;;AAqDO,IAAM,eAAN,MAAmB;AAAA,EAAnB,WAAA,GAAA;AACL,IAAA,IAAA,CAAQ,SAAsB,EAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQ/B,QAAA,GAAiB;AACf,IAAA,MAAM,GAAA,GAAM,QAAQ,GAAA,EAAI;AACxB,IAAA,MAAM,WAAA,GAAc;AAAA,MAClB,iBAAA;AAAA,MACA,mBAAA;AAAA,MACA,mBAAA;AAAA,MACA;AAAA,KACF;AAEA,IAAA,IAAI,MAAA,GAAS,KAAA;AACb,IAAA,KAAA,MAAW,YAAY,WAAA,EAAa;AAClC,MAAA,MAAM,QAAA,GAAW,IAAA,CAAK,IAAA,CAAK,GAAA,EAAK,QAAQ,CAAA;AACxC,MAAA,IAAI,CAAC,UAAA,CAAW,QAAQ,CAAA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EAUA,IAAiC,GAAA,EAAwB;AACvD,IAAA,OAAO,IAAA,CAAK,OAAO,GAAG,CAAA;AAAA,EACxB;AACF","file":"config.js","sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\nimport path from \"node:path\";\n\n/**\n * Config Files Extensions Supported\n * ex: azura.config.*extension\n */\n\ntype SupportedConfigFile = \".js\" | \".ts\" | \".json\" | \".yaml\" | \".yml\";\n\nexport type ConfigTypes = {\n name?: string;\n environment?: \"development\" | \"production\";\n debug?: boolean;\n server?: {\n port?: number;\n cluster?: boolean;\n ipHost?: boolean;\n https?: boolean;\n /**\n * Configure trust proxy behavior for IP resolution\n * - true: trust all proxies\n * - false: don't trust any proxies (default)\n * - number: trust the nth hop from the front-facing proxy\n * - string: trust specific IP address or CIDR range\n * - string[]: trust multiple IPs or CIDR ranges\n */\n trustProxy?: boolean | number | string | string[];\n /**\n * Custom header name to read IP from\n * @default 'x-forwarded-for'\n */\n ipHeader?: string;\n };\n plugins?: {\n rateLimit?: {\n enabled: boolean;\n limit: number;\n timeframe: number;\n };\n cors?: {\n enabled: boolean;\n origins: string | string[];\n methods: string | string[];\n allowedHeaders: string | string[];\n };\n };\n logging?: {\n enabled?: boolean;\n showDetails?: boolean;\n };\n};\n\nexport class ConfigModule {\n private config: ConfigTypes = {};\n\n /**\n * Load config files first (azura.config.*)\n * Recivied error if config file not found or invalid format\n * @param configFiles\n */\n\n initSync(): void {\n const cdw = process.cwd();\n const configFiles = [\n \"azura.config.ts\",\n \"azura.config.json\",\n \"azura.config.yaml\",\n \"azura.config.yml\",\n ];\n\n let loaded = false;\n for (const fileName of configFiles) {\n const filePath = path.join(cdw, fileName);\n if (!existsSync(filePath)) continue;\n\n const extension = path.extname(fileName) as SupportedConfigFile;\n const raw = readFileSync(filePath, \"utf8\");\n\n try {\n let parsed: ConfigTypes;\n switch (extension) {\n case \".ts\":\n case \".js\":\n const mod = require(filePath);\n parsed = mod.default || mod;\n break;\n case \".json\":\n parsed = JSON.parse(raw);\n break;\n case \".yaml\":\n case \".yml\":\n parsed = require(\"js-yaml\").load(raw);\n break;\n default:\n throw new Error(`Invalid config file extension: ${extension}`);\n }\n\n this.config = { ...this.config, ...parsed };\n loaded = true;\n break;\n } catch (error: Error | any) {\n throw new Error(`Error loading config file: ${filePath}\\n${error.message}`);\n }\n }\n\n if (!loaded) {\n throw new Error(\"Nothing config file found in the current directory.\");\n }\n }\n\n /**\n * Get all configs from loaded config file\n * @returns ConfigTypes\n */\n\n getAll(): ConfigTypes {\n return this.config;\n }\n\n /**\n * Return a specific config from loaded config file\n *\n * @template T\n * @param {T} key - key of the config to retrieve\n * @returns {ConfigTypes[T]}\n */\n\n get<T extends keyof ConfigTypes>(key: T): ConfigTypes[T] {\n return this.config[key];\n }\n}\n"]}
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-DzWRjunB.cjs';
2
+ import { H as HttpContext } from './common.type-f0llB3mM.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-ydMVG8sw.js';
2
+ import { H as HttpContext } from './common.type-BPo50rEF.js';
3
3
  import 'node:http';
4
4
 
5
5
  interface CorsOptions {
@@ -4,6 +4,7 @@
4
4
  var PREFIX = /* @__PURE__ */ new WeakMap();
5
5
  var ROUTES = /* @__PURE__ */ new WeakMap();
6
6
  var PARAMS = /* @__PURE__ */ new WeakMap();
7
+ var DESCRIPTIONS = /* @__PURE__ */ new WeakMap();
7
8
  function Controller(prefix = "") {
8
9
  return (target) => {
9
10
  PREFIX.set(target, prefix);
@@ -16,6 +17,7 @@ function createMethodDecorator(method) {
16
17
  const key = String(propertyKey);
17
18
  const routes = ROUTES.get(ctor) ?? [];
18
19
  const params = PARAMS.get(ctor)?.get(key) ?? [];
20
+ const description = DESCRIPTIONS.get(ctor)?.get(key);
19
21
  const exists = routes.some(
20
22
  (r) => r.method === method && r.path === path && r.propertyKey === key
21
23
  );
@@ -24,7 +26,8 @@ function createMethodDecorator(method) {
24
26
  method,
25
27
  path,
26
28
  propertyKey: key,
27
- params
29
+ params,
30
+ description
28
31
  });
29
32
  ROUTES.set(ctor, routes);
30
33
  }
@@ -118,7 +121,138 @@ function applyDecorators(app, controllers) {
118
121
  });
119
122
  });
120
123
  }
124
+ function getControllerMetadata(ControllerClass) {
125
+ return {
126
+ prefix: PREFIX.get(ControllerClass) || "",
127
+ routes: ROUTES.get(ControllerClass) || [],
128
+ params: PARAMS.get(ControllerClass),
129
+ descriptions: DESCRIPTIONS.get(ControllerClass)
130
+ };
131
+ }
132
+
133
+ // src/decorators/Swagger.ts
134
+ var API_METADATA = /* @__PURE__ */ new WeakMap();
135
+ var API_RESPONSES = /* @__PURE__ */ new WeakMap();
136
+ var API_PARAMETERS = /* @__PURE__ */ new WeakMap();
137
+ var API_BODY = /* @__PURE__ */ new WeakMap();
138
+ var API_TAGS = /* @__PURE__ */ new WeakMap();
139
+ function ApiDoc(metadata) {
140
+ return (target, propertyKey) => {
141
+ const ctor = typeof target === "function" ? target : target.constructor;
142
+ let map = API_METADATA.get(ctor);
143
+ if (!map) {
144
+ map = /* @__PURE__ */ new Map();
145
+ API_METADATA.set(ctor, map);
146
+ }
147
+ map.set(String(propertyKey), metadata);
148
+ };
149
+ }
150
+ function ApiResponse(statusCode, description, options) {
151
+ return (target, propertyKey) => {
152
+ const ctor = typeof target === "function" ? target : target.constructor;
153
+ let map = API_RESPONSES.get(ctor);
154
+ if (!map) {
155
+ map = /* @__PURE__ */ new Map();
156
+ API_RESPONSES.set(ctor, map);
157
+ }
158
+ const key = String(propertyKey);
159
+ const responses = map.get(key) ?? [];
160
+ responses.push({
161
+ statusCode,
162
+ description,
163
+ type: options?.type,
164
+ examples: options?.examples,
165
+ headers: options?.headers
166
+ });
167
+ map.set(key, responses);
168
+ };
169
+ }
170
+ function ApiParameter(name, paramIn, options) {
171
+ return (target, propertyKey) => {
172
+ const ctor = typeof target === "function" ? target : target.constructor;
173
+ let map = API_PARAMETERS.get(ctor);
174
+ if (!map) {
175
+ map = /* @__PURE__ */ new Map();
176
+ API_PARAMETERS.set(ctor, map);
177
+ }
178
+ const key = String(propertyKey);
179
+ const params = map.get(key) ?? [];
180
+ params.push({
181
+ name,
182
+ in: paramIn,
183
+ description: options?.description,
184
+ required: options?.required,
185
+ type: options?.type,
186
+ example: options?.example,
187
+ schema: options?.schema
188
+ });
189
+ map.set(key, params);
190
+ };
191
+ }
192
+ function ApiBody(description, options) {
193
+ return (target, propertyKey) => {
194
+ const ctor = typeof target === "function" ? target : target.constructor;
195
+ let map = API_BODY.get(ctor);
196
+ if (!map) {
197
+ map = /* @__PURE__ */ new Map();
198
+ API_BODY.set(ctor, map);
199
+ }
200
+ map.set(String(propertyKey), {
201
+ description,
202
+ type: options?.type,
203
+ required: options?.required,
204
+ examples: options?.examples
205
+ });
206
+ };
207
+ }
208
+ function ApiTags(...tags) {
209
+ return (target) => {
210
+ API_TAGS.set(target, tags);
211
+ };
212
+ }
213
+ function ApiDeprecated() {
214
+ return (target, propertyKey) => {
215
+ const ctor = typeof target === "function" ? target : target.constructor;
216
+ let map = API_METADATA.get(ctor);
217
+ if (!map) {
218
+ map = /* @__PURE__ */ new Map();
219
+ API_METADATA.set(ctor, map);
220
+ }
221
+ const key = String(propertyKey);
222
+ const existing = map.get(key) ?? {};
223
+ map.set(key, { ...existing, deprecated: true });
224
+ };
225
+ }
226
+ function ApiSecurity(...requirements) {
227
+ return (target, propertyKey) => {
228
+ const ctor = typeof target === "function" ? target : target.constructor;
229
+ let map = API_METADATA.get(ctor);
230
+ if (!map) {
231
+ map = /* @__PURE__ */ new Map();
232
+ API_METADATA.set(ctor, map);
233
+ }
234
+ const key = String(propertyKey);
235
+ const existing = map.get(key) ?? {};
236
+ map.set(key, { ...existing, security: requirements });
237
+ };
238
+ }
239
+ function getSwaggerMetadata(target) {
240
+ return {
241
+ metadata: API_METADATA.get(target),
242
+ responses: API_RESPONSES.get(target),
243
+ parameters: API_PARAMETERS.get(target),
244
+ body: API_BODY.get(target),
245
+ tags: API_TAGS.get(target)
246
+ };
247
+ }
121
248
 
249
+ exports.ApiBody = ApiBody;
250
+ exports.ApiDeprecated = ApiDeprecated;
251
+ exports.ApiDoc = ApiDoc;
252
+ exports.ApiParameter = ApiParameter;
253
+ exports.ApiResponse = ApiResponse;
254
+ exports.ApiSecurity = ApiSecurity;
255
+ exports.ApiTags = ApiTags;
122
256
  exports.Body = Body;
123
257
  exports.Controller = Controller;
124
258
  exports.Delete = Delete;
@@ -137,5 +271,7 @@ exports.Req = Req;
137
271
  exports.Res = Res;
138
272
  exports.UserAgent = UserAgent;
139
273
  exports.applyDecorators = applyDecorators;
274
+ exports.getControllerMetadata = getControllerMetadata;
275
+ exports.getSwaggerMetadata = getSwaggerMetadata;
140
276
  //# sourceMappingURL=decorators.cjs.map
141
277
  //# sourceMappingURL=decorators.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/decorators/Route.ts"],"names":[],"mappings":";;;AAKA,IAAM,MAAA,uBAAa,OAAA,EAA0B;AAC7C,IAAM,MAAA,uBAAa,OAAA,EAAqC;AACxD,IAAM,MAAA,uBAAa,OAAA,EAAkD;AAE9D,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,M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,OAAO,GAAA,CAAI,EAAA;AAAA,cACb,KAAK,WAAA;AACH,gBAAA,OAAO,GAAA,CAAI,QAAQ,YAAY,CAAA;AAAA,cACjC;AACE,gBAAA,OAAO,KAAA,CAAA;AAAA;AACX,UACF,CAAC,CAAA;AAED,UAAA,MAAM,EAAA,GAAM,QAAA,CAAqC,CAAA,CAAE,WAAW,CAAA;AAG9D,UAAA,MAAM,MAAA,GAAS,EAAA,CAAG,GAAG,IAAI,CAAA;AACzB,UAAA,IAAI,MAAA,YAAkB,SAAS,MAAM,MAAA;AAAA,QACvC,SAAS,GAAA,EAAK;AACZ,UAAA,IAAI,IAAA,OAAW,GAAG,CAAA;AAAA,QACpB;AAAA,MACF,CAAA;AAEA,MAAA,GAAA,CAAI,SAAS,CAAA,CAAE,MAAA,EAAQ,MAAA,GAAS,CAAA,CAAE,MAAM,OAAO,CAAA;AAAA,IACjD,CAAC,CAAA;AAAA,EACH,CAAC,CAAA;AACH","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[]>>();\n\nexport function Controller(prefix = \"\"): ClassDecorator {\n return (target) => {\n PREFIX.set(target as Function, prefix);\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\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 });\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"]}
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,GA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G,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"]}
@@ -1,11 +1,13 @@
1
- import { A as AzuraClient } from './Server-ZBdAKUkW.cjs';
2
- export { P as ParamDefinition, a as ParamSource, R as RouteDefinition } from './routes.type-VPROfhnL.cjs';
1
+ import { A as AzuraClient } from './Server-CVyJAYne.cjs';
2
+ import { R as RouteDefinition, P as ParamDefinition } from './swagger.type-BWq5nhCX.cjs';
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-BvqoEq-j.cjs';
3
5
  import './config.cjs';
4
6
  import 'node:http';
5
7
  import './router.cjs';
6
- import './common.type-DzWRjunB.cjs';
8
+ import './common.type-f0llB3mM.cjs';
7
9
  import './response.type-d6e6eU9D.cjs';
8
- import './proxy.type-qt4XEHnf.cjs';
10
+ import './proxy.type-ByYzE_1y.cjs';
9
11
 
10
12
  declare function Controller(prefix?: string): ClassDecorator;
11
13
  declare const Get: (path?: string) => MethodDecorator;
@@ -25,5 +27,15 @@ declare const Headers: (name?: string) => ParameterDecorator;
25
27
  declare const Ip: (name?: string) => ParameterDecorator;
26
28
  declare const UserAgent: (name?: string) => ParameterDecorator;
27
29
  declare function applyDecorators(app: AzuraClient, controllers: Array<new () => any>): void;
30
+ /**
31
+ * Get routes metadata from a controller class
32
+ * @internal Used by Swagger integration
33
+ */
34
+ declare function getControllerMetadata(ControllerClass: Function): {
35
+ prefix: string;
36
+ routes: RouteDefinition[];
37
+ params: Map<string, ParamDefinition[]> | undefined;
38
+ descriptions: Map<string, string> | undefined;
39
+ };
28
40
 
29
- export { Body, Controller, Delete, Get, Head, Headers, Ip, Next, Options, Param, Patch, Post, Put, Query, Req, Res, UserAgent, applyDecorators };
41
+ export { Body, Controller, Delete, Get, Head, Headers, Ip, Next, Options, Param, ParamDefinition, Patch, Post, Put, Query, Req, Res, RouteDefinition, UserAgent, applyDecorators, getControllerMetadata };
@@ -1,11 +1,13 @@
1
- import { A as AzuraClient } from './Server-Cxt5ItIO.js';
2
- export { P as ParamDefinition, a as ParamSource, R as RouteDefinition } from './routes.type-VPROfhnL.js';
1
+ import { A as AzuraClient } from './Server-CbcNkm0I.js';
2
+ import { R as RouteDefinition, P as ParamDefinition } from './swagger.type-BWq5nhCX.js';
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-VHIdi4fs.js';
3
5
  import './config.js';
4
6
  import 'node:http';
5
7
  import './router.js';
6
- import './common.type-ydMVG8sw.js';
8
+ import './common.type-BPo50rEF.js';
7
9
  import './response.type-d6e6eU9D.js';
8
- import './proxy.type-Ccn3auo8.js';
10
+ import './proxy.type-B2VypPGc.js';
9
11
 
10
12
  declare function Controller(prefix?: string): ClassDecorator;
11
13
  declare const Get: (path?: string) => MethodDecorator;
@@ -25,5 +27,15 @@ declare const Headers: (name?: string) => ParameterDecorator;
25
27
  declare const Ip: (name?: string) => ParameterDecorator;
26
28
  declare const UserAgent: (name?: string) => ParameterDecorator;
27
29
  declare function applyDecorators(app: AzuraClient, controllers: Array<new () => any>): void;
30
+ /**
31
+ * Get routes metadata from a controller class
32
+ * @internal Used by Swagger integration
33
+ */
34
+ declare function getControllerMetadata(ControllerClass: Function): {
35
+ prefix: string;
36
+ routes: RouteDefinition[];
37
+ params: Map<string, ParamDefinition[]> | undefined;
38
+ descriptions: Map<string, string> | undefined;
39
+ };
28
40
 
29
- export { Body, Controller, Delete, Get, Head, Headers, Ip, Next, Options, Param, Patch, Post, Put, Query, Req, Res, UserAgent, applyDecorators };
41
+ export { Body, Controller, Delete, Get, Head, Headers, Ip, Next, Options, Param, ParamDefinition, Patch, Post, Put, Query, Req, Res, RouteDefinition, UserAgent, applyDecorators, getControllerMetadata };