azurajs 2.5.4 → 2.5.5

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.
@@ -1,32 +1,17 @@
1
- import { A as ApiDocMetadata, H as Header, q as Schema, v as SecurityRequirement } from './swagger.type-BWq5nhCX.cjs';
1
+ import { A as ApiDocMetadata, v as SecurityRequirement, w as ApiResponseMetadata, x as ApiParameterMetadata, y as ApiBodyMetadata, q as Schema, H as Header } from './swagger.type-BWq5nhCX.cjs';
2
2
 
3
- declare function ApiDoc(metadata: Omit<ApiDocMetadata, "method" | "path">): MethodDecorator;
4
- declare function ApiResponse(statusCode: number, description: string, options?: {
5
- type?: any;
6
- examples?: Record<string, any>;
7
- headers?: Record<string, Header>;
8
- }): MethodDecorator;
9
- declare function ApiParameter(name: string, paramIn: "query" | "header" | "path" | "cookie", options?: {
10
- description?: string;
11
- required?: boolean;
12
- type?: any;
13
- example?: any;
14
- schema?: Schema;
15
- }): MethodDecorator;
16
- declare function ApiBody(description: string, options?: {
17
- type?: any;
18
- required?: boolean;
19
- examples?: Record<string, any>;
20
- }): MethodDecorator;
21
- declare function ApiTags(...tags: string[]): ClassDecorator;
22
- declare function ApiDeprecated(): MethodDecorator;
23
- declare function ApiSecurity(...requirements: SecurityRequirement[]): MethodDecorator;
24
- declare function getSwaggerMetadata(target: Function): {
25
- metadata: any;
26
- responses: any;
27
- parameters: any;
28
- body: any;
29
- tags: any;
3
+ declare function getSwaggerMetadata(target: any): {
4
+ metadata: Map<any, any>;
5
+ responses: Map<any, any>;
6
+ parameters: Map<any, any>;
7
+ body: Map<any, any>;
8
+ tags: never[];
9
+ } | {
10
+ metadata: Map<string, ApiDocMetadata>;
11
+ responses: Map<string, ApiResponseMetadata[]>;
12
+ parameters: Map<string, ApiParameterMetadata[]>;
13
+ body: Map<string, ApiBodyMetadata>;
14
+ tags: string[];
30
15
  };
31
16
  declare function Swagger(config: {
32
17
  summary?: string;
@@ -42,19 +27,29 @@ declare function Swagger(config: {
42
27
  required?: boolean;
43
28
  schema?: Schema;
44
29
  example?: any;
30
+ type?: any;
45
31
  }>;
46
32
  requestBody?: {
47
33
  description?: string;
48
34
  required?: boolean;
49
35
  content?: any;
50
36
  example?: any;
37
+ schema?: Schema;
51
38
  };
52
39
  responses?: Record<number, {
53
40
  description: string;
54
41
  example?: any;
55
42
  schema?: Schema;
56
43
  headers?: Record<string, Header>;
44
+ type?: any;
57
45
  }>;
58
46
  }): MethodDecorator;
47
+ declare function ApiTags(...tags: string[]): ClassDecorator;
48
+ declare function ApiDoc(metadata: Omit<ApiDocMetadata, "method" | "path">): MethodDecorator;
49
+ declare function ApiResponse(statusCode: number, description: string, options?: any): MethodDecorator;
50
+ declare function ApiParameter(name: string, paramIn: any, options?: any): MethodDecorator;
51
+ declare function ApiBody(description: string, options?: any): MethodDecorator;
52
+ declare function ApiDeprecated(): MethodDecorator;
53
+ declare function ApiSecurity(...requirements: SecurityRequirement[]): MethodDecorator;
59
54
 
60
55
  export { ApiDoc as A, Swagger as S, ApiResponse as a, ApiParameter as b, ApiBody as c, ApiTags as d, ApiDeprecated as e, ApiSecurity as f, getSwaggerMetadata as g };
@@ -1,32 +1,17 @@
1
- import { A as ApiDocMetadata, H as Header, q as Schema, v as SecurityRequirement } from './swagger.type-BWq5nhCX.js';
1
+ import { A as ApiDocMetadata, v as SecurityRequirement, w as ApiResponseMetadata, x as ApiParameterMetadata, y as ApiBodyMetadata, q as Schema, H as Header } from './swagger.type-BWq5nhCX.js';
2
2
 
3
- declare function ApiDoc(metadata: Omit<ApiDocMetadata, "method" | "path">): MethodDecorator;
4
- declare function ApiResponse(statusCode: number, description: string, options?: {
5
- type?: any;
6
- examples?: Record<string, any>;
7
- headers?: Record<string, Header>;
8
- }): MethodDecorator;
9
- declare function ApiParameter(name: string, paramIn: "query" | "header" | "path" | "cookie", options?: {
10
- description?: string;
11
- required?: boolean;
12
- type?: any;
13
- example?: any;
14
- schema?: Schema;
15
- }): MethodDecorator;
16
- declare function ApiBody(description: string, options?: {
17
- type?: any;
18
- required?: boolean;
19
- examples?: Record<string, any>;
20
- }): MethodDecorator;
21
- declare function ApiTags(...tags: string[]): ClassDecorator;
22
- declare function ApiDeprecated(): MethodDecorator;
23
- declare function ApiSecurity(...requirements: SecurityRequirement[]): MethodDecorator;
24
- declare function getSwaggerMetadata(target: Function): {
25
- metadata: any;
26
- responses: any;
27
- parameters: any;
28
- body: any;
29
- tags: any;
3
+ declare function getSwaggerMetadata(target: any): {
4
+ metadata: Map<any, any>;
5
+ responses: Map<any, any>;
6
+ parameters: Map<any, any>;
7
+ body: Map<any, any>;
8
+ tags: never[];
9
+ } | {
10
+ metadata: Map<string, ApiDocMetadata>;
11
+ responses: Map<string, ApiResponseMetadata[]>;
12
+ parameters: Map<string, ApiParameterMetadata[]>;
13
+ body: Map<string, ApiBodyMetadata>;
14
+ tags: string[];
30
15
  };
31
16
  declare function Swagger(config: {
32
17
  summary?: string;
@@ -42,19 +27,29 @@ declare function Swagger(config: {
42
27
  required?: boolean;
43
28
  schema?: Schema;
44
29
  example?: any;
30
+ type?: any;
45
31
  }>;
46
32
  requestBody?: {
47
33
  description?: string;
48
34
  required?: boolean;
49
35
  content?: any;
50
36
  example?: any;
37
+ schema?: Schema;
51
38
  };
52
39
  responses?: Record<number, {
53
40
  description: string;
54
41
  example?: any;
55
42
  schema?: Schema;
56
43
  headers?: Record<string, Header>;
44
+ type?: any;
57
45
  }>;
58
46
  }): MethodDecorator;
47
+ declare function ApiTags(...tags: string[]): ClassDecorator;
48
+ declare function ApiDoc(metadata: Omit<ApiDocMetadata, "method" | "path">): MethodDecorator;
49
+ declare function ApiResponse(statusCode: number, description: string, options?: any): MethodDecorator;
50
+ declare function ApiParameter(name: string, paramIn: any, options?: any): MethodDecorator;
51
+ declare function ApiBody(description: string, options?: any): MethodDecorator;
52
+ declare function ApiDeprecated(): MethodDecorator;
53
+ declare function ApiSecurity(...requirements: SecurityRequirement[]): MethodDecorator;
59
54
 
60
55
  export { ApiDoc as A, Swagger as S, ApiResponse as a, ApiParameter as b, ApiBody as c, ApiTags as d, ApiDeprecated as e, ApiSecurity as f, getSwaggerMetadata as g };
package/dist/config.cjs CHANGED
@@ -1,26 +1,23 @@
1
1
  'use strict';
2
2
 
3
3
  var fs = require('fs');
4
+ require('url');
4
5
  var path = require('path');
6
+ var module$1 = require('module');
5
7
 
8
+ var _documentCurrentScript = typeof document !== 'undefined' ? document.currentScript : null;
6
9
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
10
 
8
11
  var path__default = /*#__PURE__*/_interopDefault(path);
9
12
 
10
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
11
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
12
- }) : x)(function(x) {
13
- if (typeof require !== "undefined") return require.apply(this, arguments);
14
- throw Error('Dynamic require of "' + x + '" is not supported');
15
- });
13
+ // src/shared/config/ConfigModule.ts
16
14
  var ConfigModule = class {
17
15
  constructor() {
18
16
  this.config = {};
19
17
  }
20
18
  /**
21
19
  * Load config files first (azura.config.*)
22
- * Recivied error if config file not found or invalid format
23
- * @param configFiles
20
+ * Received error if config file not found or invalid format
24
21
  */
25
22
  initSync() {
26
23
  const cdw = process.cwd();
@@ -35,21 +32,25 @@ var ConfigModule = class {
35
32
  const filePath = path__default.default.join(cdw, fileName);
36
33
  if (!fs.existsSync(filePath)) continue;
37
34
  const extension = path__default.default.extname(fileName);
38
- const raw = fs.readFileSync(filePath, "utf8");
39
35
  try {
40
36
  let parsed;
41
37
  switch (extension) {
42
38
  case ".ts":
43
39
  case ".js":
44
- const mod = __require(filePath);
40
+ const require2 = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('config.cjs', document.baseURI).href)));
41
+ const mod = require2(filePath);
45
42
  parsed = mod.default || mod;
46
43
  break;
47
44
  case ".json":
45
+ const raw = fs.readFileSync(filePath, "utf8");
48
46
  parsed = JSON.parse(raw);
49
47
  break;
50
48
  case ".yaml":
51
49
  case ".yml":
52
- parsed = __require("js-yaml").load(raw);
50
+ const yamlRaw = fs.readFileSync(filePath, "utf8");
51
+ const requireYaml = module$1.createRequire((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('config.cjs', document.baseURI).href)));
52
+ const jsYaml = requireYaml("js-yaml");
53
+ parsed = jsYaml.load(yamlRaw);
53
54
  break;
54
55
  default:
55
56
  throw new Error(`Invalid config file extension: ${extension}`);
@@ -1 +1 @@
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,CAAK,IAAA,CAAK,GAAA,EAAK,QAAQ,CAAA;AACxC,MAAA,IAAI,CAACC,aAAA,CAAW,QAAQ,CAAA,EAAG;AAE3B,MAAA,MAAM,SAAA,GAAYD,qBAAA,CAAK,OAAA,CAAQ,QAAQ,CAAA;AACvC,MAAA,MAAM,GAAA,GAAME,eAAA,CAAa,QAAA,EAAU,MAAM,CAAA;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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"]}
1
+ {"version":3,"sources":["../src/shared/config/ConfigModule.ts"],"names":["path","existsSync","require","createRequire","readFileSync"],"mappings":";;;;;;;;;;;;;AAsDO,IAAM,eAAN,MAAmB;AAAA,EAAnB,WAAA,GAAA;AACL,IAAA,IAAA,CAAQ,SAAsB,EAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM/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;AAEb,IAAA,KAAA,MAAW,YAAY,WAAA,EAAa;AAClC,MAAA,MAAM,QAAA,GAAWA,qBAAA,CAAK,IAAA,CAAK,GAAA,EAAK,QAAQ,CAAA;AACxC,MAAA,IAAI,CAACC,aAAA,CAAW,QAAQ,CAAA,EAAG;AAE3B,MAAA,MAAM,SAAA,GAAYD,qBAAA,CAAK,OAAA,CAAQ,QAAQ,CAAA;AAEvC,MAAA,IAAI;AACF,QAAA,IAAI,MAAA;AAEJ,QAAA,QAAQ,SAAA;AAAW,UACjB,KAAK,KAAA;AAAA,UACL,KAAK,KAAA;AAEH,YAAA,MAAME,QAAAA,GAAUC,sBAAA,CAAc,4PAAe,CAAA;AAC7C,YAAA,MAAM,GAAA,GAAMD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AAA;AAAA,EACxB;AACF","file":"config.cjs","sourcesContent":["import { existsSync, readFileSync } from \"node:fs\";\nimport { pathToFileURL } from \"node:url\";\nimport path from \"node:path\";\nimport { createRequire } from \"node:module\";\n\n/**\n * Config Files Extensions Supported\n * ex: azura.config.*extension\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 * Received error if config file not found or invalid format\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\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\n try {\n let parsed: ConfigTypes;\n\n switch (extension) {\n case \".ts\":\n case \".js\":\n // Usa createRequire para manter compatibilidade com ESM\n const require = createRequire(import.meta.url);\n const mod = require(filePath);\n parsed = mod.default || mod;\n break;\n case \".json\":\n const raw = readFileSync(filePath, \"utf8\");\n parsed = JSON.parse(raw);\n break;\n case \".yaml\":\n case \".yml\":\n const yamlRaw = readFileSync(filePath, \"utf8\");\n const requireYaml = createRequire(import.meta.url);\n const jsYaml = requireYaml(\"js-yaml\");\n parsed = jsYaml.load(yamlRaw) as ConfigTypes;\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 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 get<T extends keyof ConfigTypes>(key: T): ConfigTypes[T] {\n return this.config[key];\n }\n}"]}
package/dist/config.d.cts CHANGED
@@ -44,8 +44,7 @@ declare class ConfigModule {
44
44
  private config;
45
45
  /**
46
46
  * Load config files first (azura.config.*)
47
- * Recivied error if config file not found or invalid format
48
- * @param configFiles
47
+ * Received error if config file not found or invalid format
49
48
  */
50
49
  initSync(): void;
51
50
  /**
package/dist/config.d.ts CHANGED
@@ -44,8 +44,7 @@ declare class ConfigModule {
44
44
  private config;
45
45
  /**
46
46
  * Load config files first (azura.config.*)
47
- * Recivied error if config file not found or invalid format
48
- * @param configFiles
47
+ * Received error if config file not found or invalid format
49
48
  */
50
49
  initSync(): void;
51
50
  /**
package/dist/config.js CHANGED
@@ -1,20 +1,16 @@
1
1
  import { existsSync, readFileSync } from 'fs';
2
+ import 'url';
2
3
  import path from 'path';
4
+ import { createRequire } from 'module';
3
5
 
4
- var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
5
- get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
6
- }) : x)(function(x) {
7
- if (typeof require !== "undefined") return require.apply(this, arguments);
8
- throw Error('Dynamic require of "' + x + '" is not supported');
9
- });
6
+ // src/shared/config/ConfigModule.ts
10
7
  var ConfigModule = class {
11
8
  constructor() {
12
9
  this.config = {};
13
10
  }
14
11
  /**
15
12
  * Load config files first (azura.config.*)
16
- * Recivied error if config file not found or invalid format
17
- * @param configFiles
13
+ * Received error if config file not found or invalid format
18
14
  */
19
15
  initSync() {
20
16
  const cdw = process.cwd();
@@ -29,21 +25,25 @@ var ConfigModule = class {
29
25
  const filePath = path.join(cdw, fileName);
30
26
  if (!existsSync(filePath)) continue;
31
27
  const extension = path.extname(fileName);
32
- const raw = readFileSync(filePath, "utf8");
33
28
  try {
34
29
  let parsed;
35
30
  switch (extension) {
36
31
  case ".ts":
37
32
  case ".js":
38
- const mod = __require(filePath);
33
+ const require2 = createRequire(import.meta.url);
34
+ const mod = require2(filePath);
39
35
  parsed = mod.default || mod;
40
36
  break;
41
37
  case ".json":
38
+ const raw = readFileSync(filePath, "utf8");
42
39
  parsed = JSON.parse(raw);
43
40
  break;
44
41
  case ".yaml":
45
42
  case ".yml":
46
- parsed = __require("js-yaml").load(raw);
43
+ const yamlRaw = readFileSync(filePath, "utf8");
44
+ const requireYaml = createRequire(import.meta.url);
45
+ const jsYaml = requireYaml("js-yaml");
46
+ parsed = jsYaml.load(yamlRaw);
47
47
  break;
48
48
  default:
49
49
  throw new Error(`Invalid config file extension: ${extension}`);
@@ -1 +1 @@
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,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ACF;AAEA,IAAA,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.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"]}
1
+ {"version":3,"sources":["../src/shared/config/ConfigModule.ts"],"names":["require"],"mappings":";;;;;;AAsDO,IAAM,eAAN,MAAmB;AAAA,EAAnB,WAAA,GAAA;AACL,IAAA,IAAA,CAAQ,SAAsB,EAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAM/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;AAEb,IAAA,KAAA,MAAW,YAAY,WAAA,EAAa;AAClC,MAAA,MAAM,QAAA,GAAW,IAAA,CAAK,IAAA,CAAK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B,QAAQ;AAAA,EAAK,KAAA,CAAM,OAAO,CAAA,CAAE,CAAA;AAAA,MAC5E;AAAA,IACF;AAEA,IAAA,IAAI,CAAC,MAAA,EAAQ;AACX,MAAA,MAAM,IAAI,MAAM,qDAAqD,CAAA;AAAA,IACvE;AAAA,EACF;AAAA;AAAA;AAAA;AAAA;AAAA,EAMA,MAAA,GAAsB;AACpB,IAAA,OAAO,IAAA,CAAK,MAAA;AAAA,EACd;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASA,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 { pathToFileURL } from \"node:url\";\nimport path from \"node:path\";\nimport { createRequire } from \"node:module\";\n\n/**\n * Config Files Extensions Supported\n * ex: azura.config.*extension\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 * Received error if config file not found or invalid format\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\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\n try {\n let parsed: ConfigTypes;\n\n switch (extension) {\n case \".ts\":\n case \".js\":\n // Usa createRequire para manter compatibilidade com ESM\n const require = createRequire(import.meta.url);\n const mod = require(filePath);\n parsed = mod.default || mod;\n break;\n case \".json\":\n const raw = readFileSync(filePath, \"utf8\");\n parsed = JSON.parse(raw);\n break;\n case \".yaml\":\n case \".yml\":\n const yamlRaw = readFileSync(filePath, \"utf8\");\n const requireYaml = createRequire(import.meta.url);\n const jsYaml = requireYaml(\"js-yaml\");\n parsed = jsYaml.load(yamlRaw) as ConfigTypes;\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 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 get<T extends keyof ConfigTypes>(key: T): ConfigTypes[T] {\n return this.config[key];\n }\n}"]}
@@ -153,99 +153,97 @@ function getControllerMetadata(ControllerClass) {
153
153
  }
154
154
 
155
155
  // src/decorators/Swagger.ts
156
- var AZURA_SWAGGER = {
157
- META: "__azura_api_metadata__",
158
- RESP: "__azura_api_responses__",
159
- PARAMS: "__azura_api_parameters__",
160
- BODY: "__azura_api_body__",
161
- TAGS: "__azura_api_tags__"
162
- };
156
+ var KEY_META = /* @__PURE__ */ Symbol.for("azura:swagger:meta");
157
+ var KEY_RESP = /* @__PURE__ */ Symbol.for("azura:swagger:resp");
158
+ var KEY_PARAMS = /* @__PURE__ */ Symbol.for("azura:swagger:params");
159
+ var KEY_BODY = /* @__PURE__ */ Symbol.for("azura:swagger:body");
160
+ var KEY_TAGS = /* @__PURE__ */ Symbol.for("azura:swagger:tags");
161
+ function getStorage(target, key) {
162
+ const source = typeof target === "function" && target.prototype ? target.prototype : target;
163
+ if (!source[key]) {
164
+ Object.defineProperty(source, key, {
165
+ value: /* @__PURE__ */ new Map(),
166
+ enumerable: false,
167
+ writable: true,
168
+ configurable: true
169
+ });
170
+ }
171
+ return source[key];
172
+ }
173
+ function getSwaggerMetadata(target) {
174
+ if (!target) {
175
+ return {
176
+ metadata: /* @__PURE__ */ new Map(),
177
+ responses: /* @__PURE__ */ new Map(),
178
+ parameters: /* @__PURE__ */ new Map(),
179
+ body: /* @__PURE__ */ new Map(),
180
+ tags: []
181
+ };
182
+ }
183
+ const source = typeof target === "function" && target.prototype ? target.prototype : target;
184
+ return {
185
+ metadata: source[KEY_META] ?? /* @__PURE__ */ new Map(),
186
+ responses: source[KEY_RESP] ?? /* @__PURE__ */ new Map(),
187
+ parameters: source[KEY_PARAMS] ?? /* @__PURE__ */ new Map(),
188
+ body: source[KEY_BODY] ?? /* @__PURE__ */ new Map(),
189
+ tags: source[KEY_TAGS] ?? []
190
+ };
191
+ }
192
+ function ApiTags(...tags) {
193
+ return (target) => {
194
+ const source = target.prototype || target;
195
+ Object.defineProperty(source, KEY_TAGS, {
196
+ value: tags,
197
+ enumerable: false,
198
+ writable: true,
199
+ configurable: true
200
+ });
201
+ };
202
+ }
163
203
  function ApiDoc(metadata) {
164
204
  return (target, propertyKey) => {
165
- const ctor = typeof target === "function" ? target : target.constructor;
166
- if (!ctor[AZURA_SWAGGER.META]) ctor[AZURA_SWAGGER.META] = /* @__PURE__ */ new Map();
167
- ctor[AZURA_SWAGGER.META].set(String(propertyKey), metadata);
205
+ const metaMap = getStorage(target, KEY_META);
206
+ metaMap.set(String(propertyKey), metadata);
168
207
  };
169
208
  }
170
209
  function ApiResponse(statusCode, description, options) {
171
210
  return (target, propertyKey) => {
172
- const ctor = typeof target === "function" ? target : target.constructor;
173
- if (!ctor[AZURA_SWAGGER.RESP])
174
- ctor[AZURA_SWAGGER.RESP] = /* @__PURE__ */ new Map();
211
+ const respMap = getStorage(target, KEY_RESP);
175
212
  const key = String(propertyKey);
176
- const responses = ctor[AZURA_SWAGGER.RESP].get(key) ?? [];
177
- responses.push({
178
- statusCode,
179
- description,
180
- type: options?.type,
181
- examples: options?.examples,
182
- headers: options?.headers
183
- });
184
- ctor[AZURA_SWAGGER.RESP].set(key, responses);
213
+ const responses = respMap.get(key) ?? [];
214
+ responses.push({ statusCode, description, ...options });
215
+ respMap.set(key, responses);
185
216
  };
186
217
  }
187
218
  function ApiParameter(name, paramIn, options) {
188
219
  return (target, propertyKey) => {
189
- const ctor = typeof target === "function" ? target : target.constructor;
190
- if (!ctor[AZURA_SWAGGER.PARAMS])
191
- ctor[AZURA_SWAGGER.PARAMS] = /* @__PURE__ */ new Map();
220
+ const paramMap = getStorage(target, KEY_PARAMS);
192
221
  const key = String(propertyKey);
193
- const params = ctor[AZURA_SWAGGER.PARAMS].get(key) ?? [];
194
- params.push({
195
- name,
196
- in: paramIn,
197
- description: options?.description,
198
- required: options?.required,
199
- type: options?.type,
200
- example: options?.example,
201
- schema: options?.schema
202
- });
203
- ctor[AZURA_SWAGGER.PARAMS].set(key, params);
222
+ const params = paramMap.get(key) ?? [];
223
+ params.push({ name, in: paramIn, ...options });
224
+ paramMap.set(key, params);
204
225
  };
205
226
  }
206
227
  function ApiBody(description, options) {
207
228
  return (target, propertyKey) => {
208
- const ctor = typeof target === "function" ? target : target.constructor;
209
- if (!ctor[AZURA_SWAGGER.BODY]) ctor[AZURA_SWAGGER.BODY] = /* @__PURE__ */ new Map();
210
- ctor[AZURA_SWAGGER.BODY].set(String(propertyKey), {
211
- description,
212
- type: options?.type,
213
- required: options?.required,
214
- examples: options?.examples
215
- });
216
- };
217
- }
218
- function ApiTags(...tags) {
219
- return (target) => {
220
- target[AZURA_SWAGGER.TAGS] = tags;
229
+ const bodyMap = getStorage(target, KEY_BODY);
230
+ bodyMap.set(String(propertyKey), { description, ...options });
221
231
  };
222
232
  }
223
233
  function ApiDeprecated() {
224
234
  return (target, propertyKey) => {
225
- const ctor = typeof target === "function" ? target : target.constructor;
226
- if (!ctor[AZURA_SWAGGER.META]) ctor[AZURA_SWAGGER.META] = /* @__PURE__ */ new Map();
235
+ const metaMap = getStorage(target, KEY_META);
227
236
  const key = String(propertyKey);
228
- const existing = ctor[AZURA_SWAGGER.META].get(key) ?? {};
229
- ctor[AZURA_SWAGGER.META].set(key, { ...existing, deprecated: true });
237
+ const existing = metaMap.get(key) ?? {};
238
+ metaMap.set(key, { ...existing, deprecated: true });
230
239
  };
231
240
  }
232
241
  function ApiSecurity(...requirements) {
233
242
  return (target, propertyKey) => {
234
- const ctor = typeof target === "function" ? target : target.constructor;
235
- if (!ctor[AZURA_SWAGGER.META]) ctor[AZURA_SWAGGER.META] = /* @__PURE__ */ new Map();
243
+ const metaMap = getStorage(target, KEY_META);
236
244
  const key = String(propertyKey);
237
- const existing = ctor[AZURA_SWAGGER.META].get(key) ?? {};
238
- ctor[AZURA_SWAGGER.META].set(key, { ...existing, security: requirements });
239
- };
240
- }
241
- function getSwaggerMetadata(target) {
242
- const ctor = target;
243
- return {
244
- metadata: ctor[AZURA_SWAGGER.META] ?? /* @__PURE__ */ new Map(),
245
- responses: ctor[AZURA_SWAGGER.RESP] ?? /* @__PURE__ */ new Map(),
246
- parameters: ctor[AZURA_SWAGGER.PARAMS] ?? /* @__PURE__ */ new Map(),
247
- body: ctor[AZURA_SWAGGER.BODY] ?? /* @__PURE__ */ new Map(),
248
- tags: ctor[AZURA_SWAGGER.TAGS] ?? []
245
+ const existing = metaMap.get(key) ?? {};
246
+ metaMap.set(key, { ...existing, security: requir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AAA,CAAc,IAAI,CAAA,wBAAS,GAAA,EAA6B;AAAA,IACnE,IAAA,EAAM,IAAA,CAAK,aAAA,CAAc,IAAI,KAAK;AAAC,GACrC;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 AZURA = {\n PREFIX: \"__azura_prefix__\",\n ROUTES: \"__azura_routes__\",\n PARAMS: \"__azura_params__\",\n DESCRIPTIONS: \"__azura_descriptions__\",\n};\n\nexport function Controller(prefix = \"\"): ClassDecorator {\n return (target) => {\n (target as any)[AZURA.PREFIX] = prefix;\n if (!(target as any)[AZURA.ROUTES]) (target as any)[AZURA.ROUTES] = [];\n if (!(target as any)[AZURA.PARAMS])\n (target as any)[AZURA.PARAMS] = new Map<string, ParamDefinition[]>();\n if (!(target as any)[AZURA.DESCRIPTIONS])\n (target as any)[AZURA.DESCRIPTIONS] = new Map<string, string>();\n };\n}\n\nexport function Description(description: string): MethodDecorator {\n return (target, propertyKey) => {\n const ctor = (typeof target === \"function\" ? target : (target as any).constructor) as any;\n if (!ctor[AZURA.DESCRIPTIONS]) ctor[AZURA.DESCRIPTIONS] = new Map<string, string>();\n ctor[AZURA.DESCRIPTIONS].set(String(propertyKey), description);\n };\n}\n\nfunction createMethodDecorator(method: string) {\n return function (path = \"\"): MethodDecorator {\n return (target, propertyKey) => {\n const ctor = (typeof target === \"function\" ? target : (target as any).constructor) as any;\n if (!ctor[AZURA.ROUTES]) ctor[AZURA.ROUTES] = [];\n if (!ctor[AZURA.PARAMS]) ctor[AZURA.PARAMS] = new Map<string, ParamDefinition[]>();\n if (!ctor[AZURA.DESCRIPTIONS]) ctor[AZURA.DESCRIPTIONS] = new Map<string, string>();\n const key = String(propertyKey);\n const params = ctor[AZURA.PARAMS].get(key) ?? [];\n const description = ctor[AZURA.DESCRIPTIONS].get(key);\n const exists = ctor[AZURA.ROUTES].some(\n (r: RouteDefinition) => r.method === method && r.path === path && r.propertyKey === key,\n );\n if (!exists) {\n ctor[AZURA.ROUTES].push({\n method,\n path,\n propertyKey: key,\n params,\n description,\n } as RouteDefinition);\n }\n };\n };\n}\n\nfunction createParamDecorator(type: ParamSource) {\n return function (name?: string): ParameterDecorator {\n return (target, propertyKey, parameterIndex) => {\n const ctor = (typeof target === \"function\" ? target : (target as any).constructor) as any;\n if (!ctor[AZURA.PARAMS]) ctor[AZURA.PARAMS] = new Map<string, ParamDefinition[]>();\n const key = String(propertyKey);\n const list = ctor[AZURA.PARAMS].get(key) ?? [];\n const exists = list.some(\n (p: ParamDefinition) => p.index === parameterIndex && p.type === type && p.name === name,\n );\n if (!exists) {\n list.push({\n index: parameterIndex,\n type,\n name,\n } as ParamDefinition);\n ctor[AZURA.PARAMS].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 = (ControllerClass as any)[AZURA.PREFIX] ?? \"\";\n const routes: RouteDefinition[] = (ControllerClass as any)[AZURA.ROUTES] ?? [];\n const instance = new ControllerClass();\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();\n const maxParamIndex = params.length > 0 ? Math.max(...params.map((p) => p.index)) : -1;\n const minArgs = 3;\n const argsLength = Math.max(maxParamIndex + 1, minArgs);\n const args: unknown[] = new Array(argsLength).fill(undefined);\n args[0] = req;\n args[1] = res;\n args[2] = next;\n for (const p of params) {\n let value: unknown = undefined;\n switch (p.type) {\n case \"req\":\n value = req;\n break;\n case \"res\":\n value = res;\n break;\n case \"next\":\n value = next;\n break;\n case \"param\":\n value = p.name ? (req.params as Record<string, any>)[p.name] : req.params;\n break;\n case \"query\":\n value = p.name ? (req.query as Record<string, any>)[p.name] : req.query;\n break;\n case \"body\": {\n const body = req.body as Record<string, unknown> | undefined;\n value = p.name ? body?.[p.name] : body;\n break;\n }\n case \"headers\":\n value = p.name ? req.headers[p.name.toLowerCase()] : req.headers;\n break;\n case \"ip\":\n value = req.ip;\n break;\n case \"useragent\":\n value = req.headers[\"user-agent\"];\n break;\n default:\n value = undefined;\n }\n args[p.index] = value;\n }\n const fn = (instance as Record<string, unknown>)[r.propertyKey] as (\n ...args: unknown[]\n ) => unknown;\n const result = fn.apply(instance, args);\n if (result instanceof Promise) await result;\n } catch (err) {\n if (next) next(err);\n }\n };\n app.addRoute(r.method, prefix + r.path, handler);\n });\n });\n}\n\nexport function getControllerMetadata(ControllerClass: Function) {\n return {\n prefix: (ControllerClass as any)[AZURA.PREFIX] || \"\",\n routes: (ControllerClass as any)[AZURA.ROUTES] || [],\n params: (ControllerClass as any)[AZURA.PARAMS] || new Map<string, ParamDefinition[]>(),\n descriptions: (ControllerClass as any)[AZURA.DESCRIPTIONS] || new Map<string, string>(),\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 AZURA_SWAGGER = {\n META: \"__azura_api_metadata__\",\n RESP: \"__azura_api_responses__\",\n PARAMS: \"__azura_api_parameters__\",\n BODY: \"__azura_api_body__\",\n TAGS: \"__azura_api_tags__\",\n};\n\nexport function ApiDoc(metadata: Omit<ApiDocMetadata, \"method\" | \"path\">): MethodDecorator {\n return (target, propertyKey) => {\n const ctor = (typeof target === \"function\" ? target : (target as any).constructor) as any;\n if (!ctor[AZURA_SWAGGER.META]) ctor[AZURA_SWAGGER.META] = new Map<string, ApiDocMetadata>();\n ctor[AZURA_SWAGGER.META].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 : (target as any).constructor) as any;\n if (!ctor[AZURA_SWAGGER.RESP])\n ctor[AZURA_SWAGGER.RESP] = new Map<string, ApiResponseMetadata[]>();\n const key = String(propertyKey);\n const responses = ctor[AZURA_SWAGGER.RESP].get(key) ?? [];\n responses.push({\n statusCode,\n description,\n type: options?.type,\n examples: options?.examples,\n headers: options?.headers,\n });\n ctor[AZURA_SWAGGER.RESP].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 : (target as any).constructor) as any;\n if (!ctor[AZURA_SWAGGER.PARAMS])\n ctor[AZURA_SWAGGER.PARAMS] = new Map<string, ApiParameterMetadata[]>();\n const key = String(propertyKey);\n const params = ctor[AZURA_SWAGGER.PARAMS].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 ctor[AZURA_SWAGGER.PARAMS].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 : (target as any).constructor) as any;\n if (!ctor[AZURA_SWAGGER.BODY]) ctor[AZURA_SWAGGER.BODY] = new Map<string, ApiBodyMetadata>();\n ctor[AZURA_SWAGGER.BODY].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 (target as any)[AZURA_SWAGGER.TAGS] = tags;\n };\n}\n\nexport function ApiDeprecated(): MethodDecorator {\n return (target, propertyKey) => {\n const ctor = (typeof target === \"function\" ? target : (target as any).constructor) as any;\n if (!ctor[AZURA_SWAGGER.META]) ctor[AZURA_SWAGGER.META] = new Map<string, ApiDocMetadata>();\n const key = String(propertyKey);\n const existing = ctor[AZURA_SWAGGER.META].get(key) ?? {};\n ctor[AZURA_SWAGGER.META].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 : (target as any).constructor) as any;\n if (!ctor[AZURA_SWAGGER.META]) ctor[AZURA_SWAGGER.META] = new Map<string, ApiDocMetadata>();\n const key = String(propertyKey);\n const existing = ctor[AZURA_SWAGGER.META].get(key) ?? {};\n ctor[AZURA_SWAGGER.META].set(key, { ...existing, security: requirements });\n };\n}\n\nexport function getSwaggerMetadata(target: Function) {\n const ctor = target as any;\n return {\n metadata: ctor[AZURA_SWAGGER.META] ?? new Map<string, ApiDocMetadata>(),\n responses: ctor[AZURA_SWAGGER.RESP] ?? new Map<string, ApiResponseMetadata[]>(),\n parameters: ctor[AZURA_SWAGGER.PARAMS] ?? new Map<string, ApiParameterMetadata[]>(),\n body: ctor[AZURA_SWAGGER.BODY] ?? new Map<string, ApiBodyMetadata>(),\n tags: ctor[AZURA_SWAGGER.TAGS] ?? [],\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 : (target as any).constructor) as any;\n if (!ctor[AZURA_SWAGGER.META]) ctor[AZURA_SWAGGER.META] = new Map<string, ApiDocMetadata>();\n const key = String(propertyKey);\n const existingMeta = ctor[AZURA_SWAGGER.META].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 ctor[AZURA_SWAGGER.META].set(key, newMeta);\n if (config.parameters && config.parameters.length > 0) {\n if (!ctor[AZURA_SWAGGER.PARAMS])\n ctor[AZURA_SWAGGER.PARAMS] = new Map<string, ApiParameterMetadata[]>();\n const existingParams = ctor[AZURA_SWAGGER.PARAMS].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 ctor[AZURA_SWAGGER.PARAMS].set(key, [...existingParams, ...newParams]);\n }\n if (config.requestBody) {\n if (!ctor[AZURA_SWAGGER.BODY]) ctor[AZURA_SWAGGER.BODY] = new Map<string, ApiBodyMetadata>();\n ctor[AZURA_SWAGGER.BODY].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 if (config.responses) {\n if (!ctor[AZURA_SWAGGER.RESP])\n ctor[AZURA_SWAGGER.RESP] = new Map<string, ApiResponseMetadata[]>();\n const existing = ctor[AZURA_SWAGGER.RESP].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 ctor[AZURA_SWAGGER.RESP].set(key, [...existing, ...responses]);\n }\n };\n}\n"]}
1
+ {"version":3,"sources":["../src/decorators/Route.ts","../src/decorators/Swagger.ts"],"names":[],"mappings":";;;AAKA,IAAM,KAAA,GAAQ;AAAA,EACZ,MAAA,EAAQ,kBAAA;AAAA,EACR,MAAA,EAAQ,kBAAA;AAAA,EACR,MAAA,EAAQ,kBAAA;AAAA,EACR,YAAA,EAAc;AAChB,CAAA;AAEO,SAAS,UAAA,CAAW,SAAS,EAAA,EAAoB;AACtD,EAAA,OAAO,CAAC,MAAA,KAAW;AACjB,IAAC,MAAA,CAAe,KAAA,CAAM,MAAM,CAAA,GAAI,MAAA;AAChC,IAAA,IAAI,CAAE,MAAA,CAAe,KAAA,CAAM,MAAM,CAAA,EAAI,MAAA,CAAe,KAAA,CAAM,MAAM,CAAA,GAAI,EAAC;AACrE,IAAA,IAAI,CAAE,MAAA,CAAe,KAAA,CAAM,MAAM,CAAA;AAC/B,MAAC,MAAA,CAAe,KAAA,CAAM,MAAM,CAAA,uBAAQ,GAAA,EAA+B;AACrE,IAAA,IAAI,CAAE,MAAA,CAAe,KAAA,CAAM,YAAY,CAAA;AACrC,MAAC,MAAA,CAAe,KAAA,CAAM,YAAY,CAAA,uBAAQ,GAAA,EAAoB;AAAA,EAClE,CAAA;AACF;AAUA,SAAS,sBAAsB,MAAA,EAAgB;AAC7C,EAAA,OAAO,SAAU,OAAO,EAAA,EAAqB;AAC3C,IAAA,OAAO,CAAC,QAAQ,WAAA,KAA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ators.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 AZURA = {\n PREFIX: \"__azura_prefix__\",\n ROUTES: \"__azura_routes__\",\n PARAMS: \"__azura_params__\",\n DESCRIPTIONS: \"__azura_descriptions__\",\n};\n\nexport function Controller(prefix = \"\"): ClassDecorator {\n return (target) => {\n (target as any)[AZURA.PREFIX] = prefix;\n if (!(target as any)[AZURA.ROUTES]) (target as any)[AZURA.ROUTES] = [];\n if (!(target as any)[AZURA.PARAMS])\n (target as any)[AZURA.PARAMS] = new Map<string, ParamDefinition[]>();\n if (!(target as any)[AZURA.DESCRIPTIONS])\n (target as any)[AZURA.DESCRIPTIONS] = new Map<string, string>();\n };\n}\n\nexport function Description(description: string): MethodDecorator {\n return (target, propertyKey) => {\n const ctor = (typeof target === \"function\" ? target : (target as any).constructor) as any;\n if (!ctor[AZURA.DESCRIPTIONS]) ctor[AZURA.DESCRIPTIONS] = new Map<string, string>();\n ctor[AZURA.DESCRIPTIONS].set(String(propertyKey), description);\n };\n}\n\nfunction createMethodDecorator(method: string) {\n return function (path = \"\"): MethodDecorator {\n return (target, propertyKey) => {\n const ctor = (typeof target === \"function\" ? target : (target as any).constructor) as any;\n if (!ctor[AZURA.ROUTES]) ctor[AZURA.ROUTES] = [];\n if (!ctor[AZURA.PARAMS]) ctor[AZURA.PARAMS] = new Map<string, ParamDefinition[]>();\n if (!ctor[AZURA.DESCRIPTIONS]) ctor[AZURA.DESCRIPTIONS] = new Map<string, string>();\n const key = String(propertyKey);\n const params = ctor[AZURA.PARAMS].get(key) ?? [];\n const description = ctor[AZURA.DESCRIPTIONS].get(key);\n const exists = ctor[AZURA.ROUTES].some(\n (r: RouteDefinition) => r.method === method && r.path === path && r.propertyKey === key,\n );\n if (!exists) {\n ctor[AZURA.ROUTES].push({\n method,\n path,\n propertyKey: key,\n params,\n description,\n } as RouteDefinition);\n }\n };\n };\n}\n\nfunction createParamDecorator(type: ParamSource) {\n return function (name?: string): ParameterDecorator {\n return (target, propertyKey, parameterIndex) => {\n const ctor = (typeof target === \"function\" ? target : (target as any).constructor) as any;\n if (!ctor[AZURA.PARAMS]) ctor[AZURA.PARAMS] = new Map<string, ParamDefinition[]>();\n const key = String(propertyKey);\n const list = ctor[AZURA.PARAMS].get(key) ?? [];\n const exists = list.some(\n (p: ParamDefinition) => p.index === parameterIndex && p.type === type && p.name === name,\n );\n if (!exists) {\n list.push({\n index: parameterIndex,\n type,\n name,\n } as ParamDefinition);\n ctor[AZURA.PARAMS].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 = (ControllerClass as any)[AZURA.PREFIX] ?? \"\";\n const routes: RouteDefinition[] = (ControllerClass as any)[AZURA.ROUTES] ?? [];\n const instance = new ControllerClass();\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();\n const maxParamIndex = params.length > 0 ? Math.max(...params.map((p) => p.index)) : -1;\n const minArgs = 3;\n const argsLength = Math.max(maxParamIndex + 1, minArgs);\n const args: unknown[] = new Array(argsLength).fill(undefined);\n args[0] = req;\n args[1] = res;\n args[2] = next;\n for (const p of params) {\n let value: unknown = undefined;\n switch (p.type) {\n case \"req\":\n value = req;\n break;\n case \"res\":\n value = res;\n break;\n case \"next\":\n value = next;\n break;\n case \"param\":\n value = p.name ? (req.params as Record<string, any>)[p.name] : req.params;\n break;\n case \"query\":\n value = p.name ? (req.query as Record<string, any>)[p.name] : req.query;\n break;\n case \"body\": {\n const body = req.body as Record<string, unknown> | undefined;\n value = p.name ? body?.[p.name] : body;\n break;\n }\n case \"headers\":\n value = p.name ? req.headers[p.name.toLowerCase()] : req.headers;\n break;\n case \"ip\":\n value = req.ip;\n break;\n case \"useragent\":\n value = req.headers[\"user-agent\"];\n break;\n default:\n value = undefined;\n }\n args[p.index] = value;\n }\n const fn = (instance as Record<string, unknown>)[r.propertyKey] as (\n ...args: unknown[]\n ) => unknown;\n const result = fn.apply(instance, args);\n if (result instanceof Promise) await result;\n } catch (err) {\n if (next) next(err);\n }\n };\n app.addRoute(r.method, prefix + r.path, handler);\n });\n });\n}\n\nexport function getControllerMetadata(ControllerClass: Function) {\n return {\n prefix: (ControllerClass as any)[AZURA.PREFIX] || \"\",\n routes: (ControllerClass as any)[AZURA.ROUTES] || [],\n params: (ControllerClass as any)[AZURA.PARAMS] || new Map<string, ParamDefinition[]>(),\n descriptions: (ControllerClass as any)[AZURA.DESCRIPTIONS] || new Map<string, string>(),\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 KEY_META = Symbol.for(\"azura:swagger:meta\");\nconst KEY_RESP = Symbol.for(\"azura:swagger:resp\");\nconst KEY_PARAMS = Symbol.for(\"azura:swagger:params\");\nconst KEY_BODY = Symbol.for(\"azura:swagger:body\");\nconst KEY_TAGS = Symbol.for(\"azura:swagger:tags\");\n\nfunction getStorage<T>(target: any, key: symbol): Map<string, T> {\n const source = typeof target === \"function\" && target.prototype ? target.prototype : target;\n\n if (!source[key]) {\n Object.defineProperty(source, key, {\n value: new Map<string, T>(),\n enumerable: false,\n writable: true,\n configurable: true,\n });\n }\n return source[key];\n}\n\nexport function getSwaggerMetadata(target: any) {\n if (!target) {\n return {\n metadata: new Map(),\n responses: new Map(),\n parameters: new Map(),\n body: new Map(),\n tags: [],\n };\n }\n\n const source = typeof target === \"function\" && target.prototype ? target.prototype : target;\n\n return {\n metadata: (source[KEY_META] as Map<string, ApiDocMetadata>) ?? new Map(),\n responses: (source[KEY_RESP] as Map<string, ApiResponseMetadata[]>) ?? new Map(),\n parameters: (source[KEY_PARAMS] as Map<string, ApiParameterMetadata[]>) ?? new Map(),\n body: (source[KEY_BODY] as Map<string, ApiBodyMetadata>) ?? new Map(),\n tags: (source[KEY_TAGS] as string[]) ?? [],\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 type?: any;\n }>;\n requestBody?: {\n description?: string;\n required?: boolean;\n content?: any;\n example?: any;\n schema?: Schema;\n };\n responses?: Record<\n number,\n {\n description: string;\n example?: any;\n schema?: Schema;\n headers?: Record<string, Header>;\n type?: any;\n }\n >;\n}): MethodDecorator {\n return (target, propertyKey) => {\n const key = String(propertyKey);\n\n const metaMap = getStorage<ApiDocMetadata>(target, KEY_META);\n const existingMeta = metaMap.get(key) ?? {};\n metaMap.set(key, {\n ...existingMeta,\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\n if (config.parameters) {\n const paramMap = getStorage<ApiParameterMetadata[]>(target, KEY_PARAMS);\n const currentParams = 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 type: p.type,\n }));\n paramMap.set(key, [...currentParams, ...newParams]);\n }\n\n if (config.requestBody) {\n const bodyMap = getStorage<ApiBodyMetadata>(target, KEY_BODY);\n bodyMap.set(key, {\n description: config.requestBody.description,\n required: config.requestBody.required,\n type: config.requestBody.content,\n examples: config.requestBody.example\n ? { default: { value: config.requestBody.example } }\n : undefined,\n });\n }\n\n if (config.responses) {\n const respMap = getStorage<ApiResponseMetadata[]>(target, KEY_RESP);\n const currentResponses = respMap.get(key) ?? [];\n const newResponses = Object.entries(config.responses).map(([code, resp]) => ({\n statusCode: Number(code),\n description: resp.description,\n type: resp.type ?? resp.schema,\n examples: resp.example ? { default: { value: resp.example } } : undefined,\n headers: resp.headers,\n }));\n respMap.set(key, [...currentResponses, ...newResponses]);\n }\n };\n}\n\nexport function ApiTags(...tags: string[]): ClassDecorator {\n return (target) => {\n const source = target.prototype || target;\n Object.defineProperty(source, KEY_TAGS, {\n value: tags,\n enumerable: false,\n writable: true,\n configurable: true,\n });\n };\n}\n\nexport function ApiDoc(metadata: Omit<ApiDocMetadata, \"method\" | \"path\">): MethodDecorator {\n return (target, propertyKey) => {\n const metaMap = getStorage<ApiDocMetadata>(target, KEY_META);\n metaMap.set(String(propertyKey), metadata);\n };\n}\n\nexport function ApiResponse(\n statusCode: number,\n description: string,\n options?: any,\n): MethodDecorator {\n return (target, propertyKey) => {\n const respMap = getStorage<ApiResponseMetadata[]>(target, KEY_RESP);\n const key = String(propertyKey);\n const responses = respMap.get(key) ?? [];\n responses.push({ statusCode, description, ...options });\n respMap.set(key, responses);\n };\n}\n\nexport function ApiParameter(name: string, paramIn: any, options?: any): MethodDecorator {\n return (target, propertyKey) => {\n const paramMap = getStorage<ApiParameterMetadata[]>(target, KEY_PARAMS);\n const key = String(propertyKey);\n const params = paramMap.get(key) ?? [];\n params.push({ name, in: paramIn, ...options });\n paramMap.set(key, params);\n };\n}\n\nexport function ApiBody(description: string, options?: any): MethodDecorator {\n return (target, propertyKey) => {\n const bodyMap = getStorage<ApiBodyMetadata>(target, KEY_BODY);\n bodyMap.set(String(propertyKey), { description, ...options });\n };\n}\n\nexport function ApiDeprecated(): MethodDecorator {\n return (target, propertyKey) => {\n const metaMap = getStorage<ApiDocMetadata>(target, KEY_META);\n const key = String(propertyKey);\n const existing = metaMap.get(key) ?? {};\n metaMap.set(key, { ...existing, deprecated: true });\n };\n}\n\nexport function ApiSecurity(...requirements: SecurityRequirement[]): MethodDecorator {\n return (target, propertyKey) => {\n const metaMap = getStorage<ApiDocMetadata>(target, KEY_META);\n const key = String(propertyKey);\n const existing = metaMap.get(key) ?? {};\n metaMap.set(key, { ...existing, security: requirements });\n };\n}\n"]}