@lerianstudio/sindarian-server 1.0.0-beta.9 → 1.0.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 (88) hide show
  1. package/dist/constants/keys.d.ts +1 -0
  2. package/dist/constants/keys.d.ts.map +1 -1
  3. package/dist/constants/keys.js +2 -1
  4. package/dist/constants/keys.js.map +1 -1
  5. package/dist/controllers/decorators/body-decorator.d.ts +12 -16
  6. package/dist/controllers/decorators/body-decorator.d.ts.map +1 -1
  7. package/dist/controllers/decorators/body-decorator.js +52 -58
  8. package/dist/controllers/decorators/body-decorator.js.map +1 -1
  9. package/dist/controllers/decorators/controller-decorator.d.ts +5 -4
  10. package/dist/controllers/decorators/controller-decorator.d.ts.map +1 -1
  11. package/dist/controllers/decorators/controller-decorator.js +29 -22
  12. package/dist/controllers/decorators/controller-decorator.js.map +1 -1
  13. package/dist/controllers/decorators/param-decorator.d.ts +4 -9
  14. package/dist/controllers/decorators/param-decorator.d.ts.map +1 -1
  15. package/dist/controllers/decorators/param-decorator.js +33 -29
  16. package/dist/controllers/decorators/param-decorator.js.map +1 -1
  17. package/dist/controllers/decorators/query-decorator.d.ts +11 -15
  18. package/dist/controllers/decorators/query-decorator.d.ts.map +1 -1
  19. package/dist/controllers/decorators/query-decorator.js +24 -38
  20. package/dist/controllers/decorators/query-decorator.js.map +1 -1
  21. package/dist/controllers/decorators/request-decorator.d.ts +8 -12
  22. package/dist/controllers/decorators/request-decorator.d.ts.map +1 -1
  23. package/dist/controllers/decorators/request-decorator.js +21 -17
  24. package/dist/controllers/decorators/request-decorator.js.map +1 -1
  25. package/dist/controllers/decorators/route-decorator.d.ts +12 -1
  26. package/dist/controllers/decorators/route-decorator.d.ts.map +1 -1
  27. package/dist/controllers/decorators/route-decorator.js +24 -16
  28. package/dist/controllers/decorators/route-decorator.js.map +1 -1
  29. package/dist/exceptions/api-exception.d.ts +4 -7
  30. package/dist/exceptions/api-exception.d.ts.map +1 -1
  31. package/dist/exceptions/api-exception.js +8 -4
  32. package/dist/exceptions/api-exception.js.map +1 -1
  33. package/dist/exceptions/base-exception-filter.d.ts.map +1 -1
  34. package/dist/exceptions/base-exception-filter.js +10 -3
  35. package/dist/exceptions/base-exception-filter.js.map +1 -1
  36. package/dist/exceptions/decorators/use-filters-decorator.d.ts +12 -1
  37. package/dist/exceptions/decorators/use-filters-decorator.d.ts.map +1 -1
  38. package/dist/exceptions/decorators/use-filters-decorator.js +34 -3
  39. package/dist/exceptions/decorators/use-filters-decorator.js.map +1 -1
  40. package/dist/index.d.ts +3 -0
  41. package/dist/index.d.ts.map +1 -1
  42. package/dist/index.js +5 -1
  43. package/dist/index.js.map +1 -1
  44. package/dist/interceptor/decorators/use-interceptor-decorator.d.ts +10 -3
  45. package/dist/interceptor/decorators/use-interceptor-decorator.d.ts.map +1 -1
  46. package/dist/interceptor/decorators/use-interceptor-decorator.js +60 -22
  47. package/dist/interceptor/decorators/use-interceptor-decorator.js.map +1 -1
  48. package/dist/modules/module-decorator.d.ts +2 -2
  49. package/dist/modules/module-decorator.d.ts.map +1 -1
  50. package/dist/modules/module-decorator.js +7 -13
  51. package/dist/modules/module-decorator.js.map +1 -1
  52. package/dist/pipes/decorators/index.d.ts +2 -0
  53. package/dist/pipes/decorators/index.d.ts.map +1 -0
  54. package/dist/pipes/decorators/index.js +6 -0
  55. package/dist/pipes/decorators/index.js.map +1 -0
  56. package/dist/pipes/decorators/use-pipes.d.ts +19 -0
  57. package/dist/pipes/decorators/use-pipes.d.ts.map +1 -0
  58. package/dist/pipes/decorators/use-pipes.js +118 -0
  59. package/dist/pipes/decorators/use-pipes.js.map +1 -0
  60. package/dist/pipes/index.d.ts +3 -0
  61. package/dist/pipes/index.d.ts.map +1 -0
  62. package/dist/pipes/index.js +18 -0
  63. package/dist/pipes/index.js.map +1 -0
  64. package/dist/pipes/pipe-transform.d.ts +46 -0
  65. package/dist/pipes/pipe-transform.d.ts.map +1 -0
  66. package/dist/pipes/pipe-transform.js +3 -0
  67. package/dist/pipes/pipe-transform.js.map +1 -0
  68. package/dist/server/server-factory.d.ts +10 -0
  69. package/dist/server/server-factory.d.ts.map +1 -1
  70. package/dist/server/server-factory.js +43 -23
  71. package/dist/server/server-factory.js.map +1 -1
  72. package/dist/services/pipes.d.ts +2 -0
  73. package/dist/services/pipes.d.ts.map +1 -0
  74. package/dist/services/pipes.js +5 -0
  75. package/dist/services/pipes.js.map +1 -0
  76. package/dist/zod/create-zod-dto.d.ts +16 -0
  77. package/dist/zod/create-zod-dto.d.ts.map +1 -0
  78. package/dist/zod/create-zod-dto.js +14 -0
  79. package/dist/zod/create-zod-dto.js.map +1 -0
  80. package/dist/zod/index.d.ts +3 -0
  81. package/dist/zod/index.d.ts.map +1 -0
  82. package/dist/zod/index.js +8 -0
  83. package/dist/zod/index.js.map +1 -0
  84. package/dist/zod/zod-validation-pipe.d.ts +5 -0
  85. package/dist/zod/zod-validation-pipe.d.ts.map +1 -0
  86. package/dist/zod/zod-validation-pipe.js +35 -0
  87. package/dist/zod/zod-validation-pipe.js.map +1 -0
  88. package/package.json +5 -1
@@ -4,6 +4,7 @@ export declare const CONTROLLER_KEY: unique symbol;
4
4
  export declare const CATCH_KEY: unique symbol;
5
5
  export declare const FILTER_KEY: unique symbol;
6
6
  export declare const INTERCEPTOR_KEY: unique symbol;
7
+ export declare const PIPE_KEY: unique symbol;
7
8
  export declare const ROUTE_KEY: unique symbol;
8
9
  export declare const GET_KEY: unique symbol;
9
10
  export declare const POST_KEY: unique symbol;
@@ -1 +1 @@
1
- {"version":3,"file":"keys.d.ts","sourceRoot":"","sources":["../../src/constants/keys.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc,eAAuB,CAAA;AAElD,eAAO,MAAM,UAAU,eAAmB,CAAA;AAC1C,eAAO,MAAM,cAAc,eAAuB,CAAA;AAClD,eAAO,MAAM,SAAS,eAAkB,CAAA;AACxC,eAAO,MAAM,UAAU,eAAmB,CAAA;AAC1C,eAA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AS,eAAkB,CAAA;AACxC,eAAO,MAAM,SAAS,eAAkB,CAAA;AAExC,eAAO,MAAM,gBAAgB,gBAAgB,CAAA;AAC7C,eAAO,MAAM,eAAe,eAAe,CAAA;AAC3C,eAAO,MAAM,kBAAkB,kBAAkB,CAAA;AACjD,eAAO,MAAM,oBAAoB,oBAAoB,CAAA"}
@@ -1,12 +1,13 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CONTROLLERS_PROPERTY = exports.PROVIDERS_PROPERTY = exports.MODULE_PROPERTY = exports.IMPORTS_PROPERTY = exports.QUERY_KEY = exports.PARAM_KEY = exports.REQUEST_KEY = exports.BODY_KEY = exports.DELETE_KEY = exports.PATCH_KEY = exports.PUT_KEY = exports.POST_KEY = exports.GET_KEY = exports.ROUTE_KEY = exports.INTERCEPTOR_KEY = exports.FILTER_KEY = exports.CATCH_KEY = exports.CONTROLLER_KEY = exports.MODULE_KEY = exports.INJECTABLE_KEY = void 0;
3
+ exports.CONTROLLERS_PROPERTY = exports.PROVIDERS_PROPERTY = exports.MODULE_PROPERTY = exports.IMPORTS_PROPERTY = exports.QUERY_KEY = exports.PARAM_KEY = exports.REQUEST_KEY = exports.BODY_KEY = exports.DELETE_KEY = exports.PATCH_KEY = exports.PUT_KEY = exports.POST_KEY = exports.GET_KEY = exports.ROUTE_KEY = exports.PIPE_KEY = exports.INTERCEPTOR_KEY = exports.FILTER_KEY = exports.CATCH_KEY = exports.CONTROLLER_KEY = exports.MODULE_KEY = exports.INJECTABLE_KEY = void 0;
4
4
  exports.INJECTABLE_KEY = Symbol('injectable');
5
5
  exports.MODULE_KEY = Symbol('module');
6
6
  exports.CONTROLLER_KEY = Symbol('controller');
7
7
  exports.CATCH_KEY = Symbol('catch');
8
8
  exports.FILTER_KEY = Symbol('filter');
9
9
  exports.INTERCEPTOR_KEY = Symbol('interceptor');
10
+ exports.PIPE_KEY = Symbol('pipe');
10
11
  exports.ROUTE_KEY = Symbol('route');
11
12
  exports.GET_KEY = Symbol('get');
12
13
  exports.POST_KEY = Symbol('post');
@@ -1 +1 @@
1
- {"version":3,"file":"keys.js","sourceRoot":"","sources":["../../src/constants/keys.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG,MAAM,CAAC,YAAY,CAAC,CAAA;AAErC,QAAA,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;AAC7B,QAAA,cAAc,GAAG,MAAM,CAAC,YAAY,CAAC,CAAA;AACrC,QAAA,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;AAC3B,QAAA,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;AAC7B,QAAA,eAAe,GAAG,MAAM,CAAC,aAAa,CAAC,CAAA;AAEvC,QAAA,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;AAC3B,QAAA,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;AACvB,QAAA,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;AACzB,QAAA,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;AACvB,QAAA,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;AAC3B,QAAA,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;AAE7B,QAAA,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;AACzB,QAAA,WAAW,GAAG,MAAM,CAAC,SAAS,CAAC,CAAA;AAC/B,QAAA,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;AAC3B,QAAA,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;AAE3B,QAAA,gBAAgB,GAAG,aAAa,CAAA;AAChC,QAAA,eAAe,GAAG,YAAY,CAAA;AAC9B,QAAA,kBAAkB,GAAG,eAAe,CAAA;AACpC,QAAA,oBAAoB,GAAG,iBAAiB,CAAA"}
1
+ {"version":3,"file":"keys.js","sourceRoot":"","sources":["../../src/constants/keys.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG,MAAM,CAAC,YAAY,CAAC,CAAA;AAErC,QAAA,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;AAC7B,QAAA,cAAc,GAAG,MAAM,CAAC,YAAY,CAAC,CAAA;AACrC,QAAA,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;AAC3B,QAAA,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;AAC7B,QAAA,eAAe,GAAG,MAAM,CAAC,aAAa,CAAC,CAAA;AACvC,QAAA,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;AAEzB,QAAA,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;AAC3B,QAAA,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;AACvB,QAAA,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;AACzB,QAAA,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;AACvB,QAAA,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;AAC3B,QAAA,UAAU,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAA;AAE7B,QAAA,QAAQ,GAAG,MAAM,CAAC,MAAM,CAAC,CAAA;AACzB,QAAA,WAAW,GAAG,MAAM,CAAC,SAAS,CAAC,CAAA;AAC/B,QAAA,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;AAC3B,QAAA,SAAS,GAAG,MAAM,CAAC,OAAO,CAAC,CAAA;AAE3B,QAAA,gBAAgB,GAAG,aAAa,CAAA;AAChC,QAAA,eAAe,GAAG,YAAY,CAAA;AAC9B,QAAA,kBAAkB,GAAG,eAAe,CAAA;AACpC,QAAA,oBAAoB,GAAG,iBAAiB,CAAA"}
@@ -1,24 +1,20 @@
1
1
  export type BodyMetadata = {
2
- propertyIndex: number;
3
- schema?: () => any;
4
- };
5
- /**
6
- * Handler to validate the body of the request.
7
- *
8
- * @param target - The target object.
9
- * @param propertyKey - The property key.
10
- * @param args - The arguments.
11
- * @returns The parameter and parameter index.
12
- */
13
- export declare function bodyDecoratorHandler(target: object, propertyKey: string | symbol, args: any[]): Promise<{
14
- parameter: any;
15
2
  parameterIndex: number;
16
- } | null>;
3
+ };
4
+ export declare class BodyHandler {
5
+ private static bodyCache;
6
+ static getMetadata(target: object, propertyKey: string | symbol): BodyMetadata | undefined;
7
+ static handle(target: object, propertyKey: string | symbol, args: any[]): Promise<{
8
+ type: string;
9
+ parameter: any;
10
+ parameterIndex: number;
11
+ paramType: any;
12
+ } | null>;
13
+ }
17
14
  /**
18
15
  * Decorator to validate the body of the request.
19
16
  *
20
- * @param schema - The Zod schema to validate the body against.
21
17
  * @returns A decorator function that can be used to decorate a controller method.
22
18
  */
23
- export declare function Body(schema?: any): (target: object, propertyKey: string | symbol, propertyIndex: number) => void;
19
+ export declare function Body(): (target: object, propertyKey: string | symbol, propertyIndex: number) => void;
24
20
  //# sourceMappingURL=body-decorator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"body-decorator.d.ts","sourceRoot":"","sources":["../../../src/controllers/decorators/body-decorator.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,YAAY,GAAG;IACzB,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,CAAC,EAAE,MAAM,GAAG,CAAA;CACnB,CAAA;AAKD;;;;;;;GAOG;AACH,wBAAsB,oBAAoB,CACxC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GAAG,MAAM,EAC5B,IAAI,EAAE,GAAG,EAAE;;;UA6DZ;AAED;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,MAAM,CAAC,EAAE,GAAG,IAE7B,QAAQ,MAAM,EACd,aAAa,MAAM,GAAG,MAAM,EAC5B,eAAe,MAAM,UAQxB"}
1
+ {"version":3,"file":"body-decorator.d.ts","sourceRoot":"","sources":["../../../src/controllers/decorators/body-decorator.ts"],"names":[],"mappings":"AAMA,MAAM,MAAM,YAAY,GAAG;IACzB,cAAc,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,qBAAa,WAAW;IAEtB,OAAO,CAAC,MAAM,CAAC,SAAS,CAAkC;IAE1D,MAAM,CAAC,WAAW,CAChB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GAAG,MAAM,GAC3B,YAAY,GAAG,SAAS;WAmBd,MAAM,CACjB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GAAG,MAAM,EAC5B,IAAI,EAAE,GAAG,EAAE;;;;;;CAqDd;AAED;;;;GAIG;AACH,wBAAgB,IAAI,KAEhB,QAAQ,MAAM,EACd,aAAa,MAAM,GAAG,MAAM,EAC5B,eAAe,MAAM,UAWxB"}
@@ -1,83 +1,77 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.bodyDecoratorHandler = bodyDecoratorHandler;
3
+ exports.BodyHandler = void 0;
4
4
  exports.Body = Body;
5
5
  const keys_1 = require("../../constants/keys");
6
6
  const get_next_arguments_1 = require("../../utils/nextjs/get-next-arguments");
7
7
  const api_exception_1 = require("../../exceptions/api-exception");
8
8
  const get_form_data_1 = require("../../utils/form-data/get-form-data");
9
- // Cache to store parsed body to avoid reading it multiple times
10
- const bodyCache = new WeakMap();
11
- /**
12
- * Handler to validate the body of the request.
13
- *
14
- * @param target - The target object.
15
- * @param propertyKey - The property key.
16
- * @param args - The arguments.
17
- * @returns The parameter and parameter index.
18
- */
19
- async function bodyDecoratorHandler(target, propertyKey, args) {
20
- const metadata = Reflect.getOwnMetadata(keys_1.BODY_KEY, target, propertyKey);
21
- // If the metadata is not found, return null.
22
- if (metadata) {
23
- const request = (0, get_next_arguments_1.getNextRequestArgument)(args);
24
- // Check if body is already cached
25
- let body = bodyCache.get(request);
26
- if (!body) {
27
- const contentType = request.headers.get('Content-Type');
28
- try {
29
- if (contentType?.includes('multipart/form-data')) {
30
- body = (0, get_form_data_1.getFormData)(await request.formData());
31
- }
32
- else if (contentType?.includes('application/json')) {
33
- body = await request.json();
9
+ class BodyHandler {
10
+ static getMetadata(target, propertyKey) {
11
+ let metadata = Reflect.getOwnMetadata(keys_1.BODY_KEY, target, propertyKey);
12
+ // If not found on instance, try constructor prototype
13
+ if (!metadata && target.constructor) {
14
+ metadata = Reflect.getOwnMetadata(keys_1.BODY_KEY, target.constructor.prototype, propertyKey);
15
+ }
16
+ return metadata;
17
+ }
18
+ static async handle(target, propertyKey, args) {
19
+ const metadata = this.getMetadata(target, propertyKey);
20
+ // If the metadata is not found, return null.
21
+ if (metadata) {
22
+ // Get the route metadata to access paramTypes (check both target and prototype)
23
+ let routeMetadata = Reflect.getOwnMetadata(keys_1.ROUTE_KEY, target, propertyKey);
24
+ if (!routeMetadata && target.constructor) {
25
+ routeMetadata = Reflect.getOwnMetadata(keys_1.ROUTE_KEY, target.constructor.prototype, propertyKey);
26
+ }
27
+ const paramTypes = routeMetadata?.paramTypes || [];
28
+ const request = (0, get_next_arguments_1.getNextRequestArgument)(args);
29
+ // Check if body is already cached
30
+ let body = this.bodyCache.get(request);
31
+ if (!body) {
32
+ const contentType = request.headers.get('Content-Type');
33
+ try {
34
+ if (contentType?.includes('multipart/form-data')) {
35
+ body = (0, get_form_data_1.getFormData)(await request.formData());
36
+ }
37
+ else if (contentType?.includes('application/json')) {
38
+ body = await request.json();
39
+ }
40
+ else {
41
+ body = await request.text();
42
+ }
43
+ // Cache the parsed body
44
+ this.bodyCache.set(request, body);
45
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
34
46
  }
35
- else {
36
- body = await request.text();
47
+ catch (error) {
48
+ // Handle missing or invalid body
49
+ throw new api_exception_1.ValidationApiException('Missing or invalid request body');
37
50
  }
38
- // Cache the parsed body
39
- bodyCache.set(request, body);
40
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
41
- }
42
- catch (error) {
43
- // Handle missing or invalid body
44
- throw new api_exception_1.ValidationApiException('Missing or invalid request body');
45
51
  }
46
- }
47
- // If the schema is not provided, return the body.
48
- if (!metadata.schema) {
49
52
  return {
53
+ type: 'body',
50
54
  parameter: body,
51
- parameterIndex: metadata.propertyIndex
55
+ parameterIndex: metadata.parameterIndex,
56
+ paramType: paramTypes[metadata.parameterIndex]
52
57
  };
53
58
  }
54
- // Parse the body using the schema.
55
- const resolvedSchema = metadata.schema?.();
56
- const parsedBody = resolvedSchema?.safeParse(body);
57
- // If the body is not valid, throw a validation error.
58
- if (parsedBody && !parsedBody.success) {
59
- throw new api_exception_1.ValidationApiException(`Invalid body: ${JSON.stringify(parsedBody.error.flatten().fieldErrors)}`);
60
- }
61
- return {
62
- parameter: body,
63
- parameterIndex: metadata.propertyIndex
64
- };
59
+ return null;
65
60
  }
66
- return null;
67
61
  }
62
+ exports.BodyHandler = BodyHandler;
63
+ // Cache to store parsed body to avoid reading it multiple times
64
+ BodyHandler.bodyCache = new WeakMap();
68
65
  /**
69
66
  * Decorator to validate the body of the request.
70
67
  *
71
- * @param schema - The Zod schema to validate the body against.
72
68
  * @returns A decorator function that can be used to decorate a controller method.
73
69
  */
74
- function Body(schema) {
70
+ function Body() {
75
71
  return function (target, propertyKey, propertyIndex) {
76
- const metadata = {
77
- propertyIndex,
78
- schema: schema ? () => schema : undefined
79
- };
80
- Reflect.defineMetadata(keys_1.BODY_KEY, metadata, target, propertyKey);
72
+ Reflect.defineMetadata(keys_1.BODY_KEY, {
73
+ parameterIndex: propertyIndex
74
+ }, target, propertyKey);
81
75
  };
82
76
  }
83
77
  //# sourceMappingURL=body-decorator.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"body-decorator.js","sourceRoot":"","sources":["../../../src/controllers/decorators/body-decorator.ts"],"names":[],"mappings":";;AAsBA,oDAgEC;AAQD,oBAYC;AA1GD,2CAA2C;AAC3C,0EAA0E;AAC1E,8DAAmE;AAEnE,mEAA6D;AAO7D,gEAAgE;AAChE,MAAM,SAAS,GAAG,IAAI,OAAO,EAAoB,CAAA;AAEjD;;;;;;;GAOG;AACI,KAAK,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ED,mCAAmC;QACnC,MAAM,cAAc,GAAG,QAAQ,CAAC,MAAM,EAAE,EAAE,CAAA;QAC1C,MAAM,UAAU,GAAG,cAAc,EAAE,SAAS,CAAC,IAAI,CAAC,CAAA;QAElD,sDAAsD;QACtD,IAAI,UAAU,IAAI,CAAC,UAAU,CAAC,OAAO,EAAE,CAAC;YACtC,MAAM,IAAI,sCAAsB,CAC9B,iBAAiB,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,WAAW,CAAC,EAAE,CAC1E,CAAA;QACH,CAAC;QAED,OAAO;YACL,SAAS,EAAE,IAAI;YACf,cAAc,EAAE,QAAQ,CAAC,aAAa;SACvC,CAAA;IACH,CAAC;IAED,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;;;GAKG;AACH,SAAgB,IAAI,CAAC,MAAY;IAC/B,OAAO,UACL,MAAc,EACd,WAA4B,EAC5B,aAAqB;QAErB,MAAM,QAAQ,GAAiB;YAC7B,aAAa;YACb,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS;SAC1C,CAAA;QACD,OAAO,CAAC,cAAc,CAAC,eAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,CAAC,CAAA;IACjE,CAAC,CAAA;AACH,CAAC"}
1
+ {"version":3,"file":"body-decorator.js","sourceRoot":"","sources":["../../../src/controllers/decorators/body-decorator.ts"],"names":[],"mappings":";;;AAmGA,oBAeC;AAlHD,2CAAsD;AACtD,0EAA0E;AAC1E,8DAAmE;AAEnE,mEAA6D;AAM7D,MAAa,WAAW;IAItB,MAAM,CAAC,WAAW,CAChB,MAAc,EACd,WAA4B;QAE5B,IAAI,QAAQ,GAAiB,OAAO,CAAC,cAAc,CACjD,eAAQ,EACR,MAAM,EACN,WAAW,CACZ,CAAA;QAED,sDAAsD;QACtD,IAAI,CAAC,QAAQ,IAAI,MAAM,CAAC,WAAW,EA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wBACrD,IAAI,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,CAAA;oBAC7B,CAAC;yBAAM,CAAC;wBACN,IAAI,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,CAAA;oBAC7B,CAAC;oBAED,wBAAwB;oBACxB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;oBACjC,6DAA6D;gBAC/D,CAAC;gBAAC,OAAO,KAAU,EAAE,CAAC;oBACpB,iCAAiC;oBACjC,MAAM,IAAI,sCAAsB,CAAC,iCAAiC,CAAC,CAAA;gBACrE,CAAC;YACH,CAAC;YAED,OAAO;gBACL,IAAI,EAAE,MAAM;gBACZ,SAAS,EAAE,IAAI;gBACf,cAAc,EAAE,QAAQ,CAAC,cAAc;gBACvC,SAAS,EAAE,UAAU,CAAC,QAAQ,CAAC,cAAc,CAAC;aAC/C,CAAA;QACH,CAAC;QAED,OAAO,IAAI,CAAA;IACb,CAAC;;AAjFH,kCAkFC;AAjFC,gEAAgE;AACjD,qBAAS,GAAG,IAAI,OAAO,EAAoB,CAAA;AAkF5D;;;;GAIG;AACH,SAAgB,IAAI;IAClB,OAAO,UACL,MAAc,EACd,WAA4B,EAC5B,aAAqB;QAErB,OAAO,CAAC,cAAc,CACpB,eAAQ,EACR;YACE,cAAc,EAAE,aAAa;SAC9B,EACD,MAAM,EACN,WAAW,CACZ,CAAA;IACH,CAAC,CAAA;AACH,CAAC"}
@@ -1,10 +1,11 @@
1
- import { HttpMethods } from '../../constants/http-methods';
1
+ import { RouteMetadata } from './route-decorator';
2
2
  export type ControllerMetadata = {
3
- methodName: string;
4
- method: HttpMethods;
5
3
  path: string;
6
4
  };
7
- export declare function controllerHandler(target: Function): ControllerMetadata[];
5
+ export declare class ControllerHandler {
6
+ static getMetadata(target: object): ControllerMetadata | undefined;
7
+ static getRoutes(target: Function): RouteMetadata[];
8
+ }
8
9
  /**
9
10
  * A class decorator that wraps all methods in the class with error handling.
10
11
  *
@@ -1 +1 @@
1
- {"version":3,"file":"controller-decorator.d.ts","sourceRoot":"","sources":["../../../src/controllers/decorators/controller-decorator.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAA;AAOtD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,WAAW,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,QAAQ,wBA+BjD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAIvD"}
1
+ {"version":3,"file":"controller-decorator.d.ts","sourceRoot":"","sources":["../../../src/controllers/decorators/controller-decorator.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,aAAa,EAAE,MAAM,mBAAmB,CAAA;AAK/D,MAAM,MAAM,kBAAkB,GAAG;IAC/B,IAAI,EAAE,MAAM,CAAA;CACb,CAAA;AAED,qBAAa,iBAAiB;IAC5B,MAAM,CAAC,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,kBAAkB,GAAG,SAAS;IAIlE,MAAM,CAAC,SAAS,CAAC,MAAM,EAAE,QAAQ,GAAG,aAAa,EAAE;CAiCpD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,cAAc,CAIvD"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.controllerHandler = controllerHandler;
3
+ exports.ControllerHandler = void 0;
4
4
  exports.Controller = Controller;
5
5
  const inversify_1 = require("inversify");
6
6
  const keys_1 = require("../../constants/keys");
@@ -8,31 +8,38 @@ const route_decorator_1 = require("./route-decorator");
8
8
  const apply_decorators_1 = require("../../utils/apply-decorators");
9
9
  const get_class_methods_1 = require("../../utils/class/get-class-methods");
10
10
  const url_join_1 = require("../../utils/url/url-join");
11
- function controllerHandler(target) {
12
- const routes = [];
13
- const prototype = target.prototype;
14
- const metadata = Reflect.getOwnMetadata(keys_1.CONTROLLER_KEY, target);
15
- if (!metadata) {
16
- console.warn(`Class ${target.name} does not have a Controller decorator`);
17
- return [];
11
+ class ControllerHandler {
12
+ static getMetadata(target) {
13
+ return Reflect.getOwnMetadata(keys_1.CONTROLLER_KEY, target);
18
14
  }
19
- const methodNames = (0, get_class_methods_1.getClassMethods)(target);
20
- // Compile all routes from the controller
21
- for (const methodName of methodNames) {
22
- const routeMetadata = (0, route_decorator_1.routeHandler)(prototype, methodName);
23
- if (routeMetadata) {
24
- // Join the controller path with the route path
25
- const url = (0, url_join_1.urlJoin)(metadata.path, routeMetadata.path);
26
- // Add the route to the routes array
27
- routes.push({
28
- methodName: methodName,
29
- method: routeMetadata.method,
30
- path: url
31
- });
15
+ static getRoutes(target) {
16
+ const routes = [];
17
+ const prototype = target.prototype;
18
+ const metadata = Reflect.getOwnMetadata(keys_1.CONTROLLER_KEY, target);
19
+ if (!metadata) {
20
+ console.warn(`Class ${target.name} does not have a Controller decorator`);
21
+ return [];
32
22
  }
23
+ const methodNames = (0, get_class_methods_1.getClassMethods)(target);
24
+ // Compile all routes from the controller
25
+ for (const methodName of methodNames) {
26
+ const routeMetadata = route_decorator_1.RouteHandler.getMetadata(prototype, methodName);
27
+ if (routeMetadata) {
28
+ // Join the controller path with the route path
29
+ const url = (0, url_join_1.urlJoin)(metadata.path, routeMetadata.path);
30
+ // Add the route to the routes array
31
+ routes.push({
32
+ methodName: methodName,
33
+ method: routeMetadata.method,
34
+ path: url,
35
+ paramTypes: routeMetadata.paramTypes
36
+ });
37
+ }
38
+ }
39
+ return routes;
33
40
  }
34
- return routes;
35
41
  }
42
+ exports.ControllerHandler = ControllerHandler;
36
43
  /**
37
44
  * A class decorator that wraps all methods in the class with error handling.
38
45
  *
@@ -1 +1 @@
1
- {"version":3,"file":"controller-decorator.js","sourceRoot":"","sources":["../../../src/controllers/decorators/contro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,CAAC,CAAA;IAC1D,CAAC,CAAC,CAAA;AACJ,CAAC"}
1
+ {"version":3,"file":"controller-decorator.js","sourceRoot":"","sources":["../../../src/controllers/decorators/controller-decorator.ts"],"names":[],"mappings":";;;AAwDA,gCAIC;AA5DD,yCAAsC;AACtC,2CAAiD;AACjD,uDAA+D;AAC/D,+DAA0D;AAC1D,uEAAiE;AACjE,mDAA8C;AAM9C,MAAa,iBAAiB;IAC5B,MAAM,CAAC,WAAW,CAAC,MAAc;QAC/B,OAAO,OAAO,CAAC,cAAc,CAAC,qBAAc,EAAE,MAAM,CAAC,CAAA;IACvD,CAAC;IAED,MAAM,CAAC,SAAS,CAAC,MAAgB;QAC/B,MAAM,MAAM,GAAoB,EAAE,CAAA;QAClC,MAAM,SAAS,GAAG,MAAM,CAAC,SAAS,CAAA;QAElC,MAAM,QAAQ,GAAG,OAAO,CAAC,cAAc,CAAC,qBAAc,EAAE,MAAM,CAAC,CAAA;QAE/D,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,OAAO,CAAC,IAAI,CAAC,SAAS,MAAM,CAAC,IAAI,uCAAuC,CAAC,CAAA;YACzE,OAAO,EAAE,CAAA;QACX,CAAC;QAED,MAAM,WAAW,GAAG,IAAA,mCAAe,EAAC,MAAM,CAAC,CAAA;QAE3C,yCAAyC;QACzC,KAAK,MAAM,UAAU,IAAI,WAAW,EAAE,CAAC;YACrC,MAAM,aAAa,GAAG,8BAAY,CAAC,WAAW,CAAC,SAAS,EAAE,UAAU,CAAC,CAAA;YAErE,IAAI,aAAa,EAAE,CAAC;gBAClB,+CAA+C;gBAC/C,MAAM,GAAG,GAAG,IAAA,kBAAO,EAAC,QAAQ,CAAC,IAAI,EAAE,aAAa,CAAC,IAAI,CAAC,CAAA;gBAEtD,oCAAoC;gBACpC,MAAM,CAAC,IAAI,CAAC;oBACV,UAAU,EAAE,UAAU;oBACtB,MAAM,EAAE,aAAa,CAAC,MAAM;oBAC5B,IAAI,EAAE,GAAG;oBACT,UAAU,EAAE,aAAa,CAAC,UAAU;iBACrC,CAAC,CAAA;YACJ,CAAC;QACH,CAAC;QAED,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAtCD,8CAsCC;AAED;;;;GAIG;AACH,SAAgB,UAAU,CAAC,IAAY;IACrC,OAAO,IAAA,kCAAe,EAAC,IAAA,sBAAU,GAAE,EAAE,UAAU,MAAgB;QAC7D,OAAO,CAAC,cAAc,CAAC,qBAAc,EAAE,EAAE,IAAI,EAAE,EAAE,MAAM,CAAC,CAAA;IAC1D,CAAC,CAAC,CAAA;AACJ,CAAC"}
@@ -2,15 +2,10 @@ export type ParamMetadata = {
2
2
  name: string;
3
3
  parameterIndex: number;
4
4
  };
5
- /**
6
- * Handler to validate the param of the request.
7
- *
8
- * @param target - The target object.
9
- * @param propertyKey - The property key.
10
- * @param args - The arguments.
11
- * @returns The parameter and parameter index.
12
- */
13
- export declare function paramDecoratorHandler(target: object, propertyKey: string | symbol, args: any[]): Promise<any>;
5
+ export declare class ParamHandler {
6
+ static getMetadata(target: object, propertyKey: string | symbol): ParamMetadata[] | undefined;
7
+ static handle(target: object, propertyKey: string | symbol, args: any[]): Promise<any>;
8
+ }
14
9
  /**
15
10
  * Decorator to validate the param of the request.
16
11
  *
@@ -1 +1 @@
1
- {"version":3,"file":"param-decorator.d.ts","sourceRoot":"","sources":["../../../src/controllers/decorators/param-decorator.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,cAAc,EAAE,MAAM,CAAA;CACvB,CAAA;AAED;;;;;;;GAOG;AACH,wBAAsB,qBAAqB,CACzC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GAAG,MAAM,EAC5B,IAAI,EAAE,GAAG,EAAE,GACV,OAAO,CAAC,GAAG,CAAC,CAqCd;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,IAE9B,QAAQ,MAAM,EACd,aAAa,MAAM,GAAG,MAAM,EAC5B,gBAAgB,MAAM,UAYzB"}
1
+ {"version":3,"file":"param-decorator.d.ts","sourceRoot":"","sources":["../../../src/controllers/decorators/param-decorator.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,cAAc,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,qBAAa,YAAY;IACvB,MAAM,CAAC,WAAW,CAChB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GAAG,MAAM,GAC3B,aAAa,EAAE,GAAG,SAAS;WAmBjB,MAAM,CACjB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GAAG,MAAM,EAC5B,IAAI,EAAE,GAAG,EAAE,GACV,OAAO,CAAC,GAAG,CAAC;CAmChB;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,IAAI,EAAE,MAAM,IAE9B,QAAQ,MAAM,EACd,aAAa,MAAM,GAAG,MAAM,EAC5B,gBAAgB,MAAM,UAYzB"}
@@ -1,42 +1,46 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.paramDecoratorHandler = paramDecoratorHandler;
3
+ exports.ParamHandler = void 0;
4
4
  exports.Param = Param;
5
5
  const keys_1 = require("../../constants/keys");
6
6
  const api_exception_1 = require("../../exceptions/api-exception");
7
7
  const get_next_arguments_1 = require("../../utils/nextjs/get-next-arguments");
8
- /**
9
- * Handler to validate the param of the request.
10
- *
11
- * @param target - The target object.
12
- * @param propertyKey - The property key.
13
- * @param args - The arguments.
14
- * @returns The parameter and parameter index.
15
- */
16
- async function paramDecoratorHandler(target, propertyKey, args) {
17
- const metadatas = Reflect.getOwnMetadata(keys_1.PARAM_KEY, target, propertyKey);
18
- // If the metadata is found, validate the param.
19
- if (metadatas && metadatas.length > 0) {
20
- const params = await (0, get_next_arguments_1.getNextParamArgument)(args);
21
- // If params is undefined or null, all required params are missing
22
- if (!params) {
23
- throw new api_exception_1.ValidationApiException(`Invalid param: ${metadatas[0].name} is required`);
8
+ class ParamHandler {
9
+ static getMetadata(target, propertyKey) {
10
+ let metadatas = Reflect.getOwnMetadata(keys_1.PARAM_KEY, target, propertyKey);
11
+ // If not found on instance, try constructor prototype
12
+ if (!metadatas && target.constructor) {
13
+ metadatas = Reflect.getOwnMetadata(keys_1.PARAM_KEY, target.constructor.prototype, propertyKey);
24
14
  }
25
- // Validate the param.
26
- return metadatas.map((metadata) => {
27
- const value = params[metadata.name];
28
- // If the param is not found, throw a validation error.
29
- if (!value) {
30
- throw new api_exception_1.ValidationApiException(`Invalid param: ${metadata.name} is required`);
15
+ return metadatas;
16
+ }
17
+ static async handle(target, propertyKey, args) {
18
+ const metadatas = this.getMetadata(target, propertyKey);
19
+ // If the metadata is found, validate the param.
20
+ if (metadatas && metadatas.length > 0) {
21
+ const params = await (0, get_next_arguments_1.getNextParamArgument)(args);
22
+ // If params is undefined or null, all required params are missing
23
+ if (!params) {
24
+ throw new api_exception_1.ValidationApiException(`Invalid param: ${metadatas[0].name} is required`);
31
25
  }
32
- return {
33
- parameter: value,
34
- parameterIndex: metadata.parameterIndex
35
- };
36
- });
26
+ // Validate the param.
27
+ return metadatas.map((metadata) => {
28
+ const value = params[metadata.name];
29
+ // If the param is not found, throw a validation error.
30
+ if (!value) {
31
+ throw new api_exception_1.ValidationApiException(`Invalid param: ${metadata.name} is required`);
32
+ }
33
+ return {
34
+ type: 'param',
35
+ parameter: value,
36
+ parameterIndex: metadata.parameterIndex
37
+ };
38
+ });
39
+ }
40
+ return null;
37
41
  }
38
- return null;
39
42
  }
43
+ exports.ParamHandler = ParamHandler;
40
44
  /**
41
45
  * Decorator to validate the param of the request.
42
46
  *
@@ -1 +1 @@
1
- {"version":3,"file":"param-decorator.js","sourceRoot":"","sources":["../../../src/controllers/decorators/param-decorator.ts"],"names":[],"mappings":";;AAiBA,sDAyCC;AAQD,sBAgBC;AAlFD,2CAA4C;AAC5C,8DAAmE;A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AC,gBAAS,EAAE,cAAc,EAAE,MAAM,EAAE,WAAW,CAAC,CAAA;IACxE,CAAC,CAAA;AACH,CAAC"}
1
+ {"version":3,"file":"param-decorator.js","sourceRoot":"","sources":["../../../src/controllers/decorators/param-decorator.ts"],"names":[],"mappings":";;;AA+EA,sBAgBC;AA/FD,2CAA4C;AAC5C,8DAAmE;AACnE,0EAAwE;AAOxE,MAAa,YAAY;IACvB,MAAM,CAAC,WAAW,CAChB,MAAc,EACd,WAA4B;QAE5B,IAAI,SAAS,GAAgC,OAAO,CAAC,cAAc,CACjE,gBAAS,EACT,MAAM,EACN,WAAW,CACZ,CAAA;QAED,sDAAsD;QACtD,IAAI,CAAC,SAAS,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;YACrC,SAAS,GAAG,OAAO,CAAC,cAAc,CAChC,gBAAS,EACT,MAAM,CAAC,WAAW,CAAC,SAAS,EAC5B,WAAW,CACZ,CAAA;QACH,CAAC;QAED,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,MAAM,CACjB,MAAc,EACd,WAA4B,EAC5B,IAAW;QAEX,MAAM,SAAS,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;QAEvD,gDAAgD;QAChD,IAAI,SAAS,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACtC,MAAM,MAAM,GAA2B,MAAM,IAAA,yCAAoB,EAAC,IAAI,CAAC,CAAA;YAEvE,kEAAkE;YAClE,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,MAAM,IAAI,sCAAsB,CAC9B,kBAAkB,SAAS,CAAC,CAAC,CAAC,CAAC,IAAI,cAAc,CAClD,CAAA;YACH,CAAC;YAED,sBAAsB;YACtB,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;gBAChC,MAAM,KAAK,GAAG,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAA;gBAEnC,uDAAuD;gBACvD,IAAI,CAAC,KAAK,EAAE,CAAC;oBACX,MAAM,IAAI,sCAAsB,CAC9B,kBAAkB,QAAQ,CAAC,IAAI,cAAc,CAC9C,CAAA;gBACH,CAAC;gBAED,OAAO;oBACL,IAAI,EAAE,OAAO;oBACb,SAAS,EAAE,KAAK;oBAChB,cAAc,EAAE,QAAQ,CAAC,cAAc;iBACxC,CAAA;YACH,CAAC,CAAC,CAAA;QACJ,CAAC;QAED,OAAO,IAAI,CAAA;IACb,CAAC;CACF;AA9DD,oCA8DC;AAED;;;;;GAKG;AACH,SAAgB,KAAK,CAAC,IAAY;IAChC,OAAO,UACL,MAAc,EACd,WAA4B,EAC5B,cAAsB;QAEtB,MAAM,cAAc,GAClB,OAAO,CAAC,cAAc,CAAC,gBAAS,EAAE,MAAM,EAAE,WAAW,CAAC,IAAI,EAAE,CAAA;QAE9D,cAAc,CAAC,IAAI,CAAC;YAClB,IAAI;YACJ,cAAc;SACf,CAAC,CAAA;QAEF,OAAO,CAAC,cAAc,CAAC,gBAAS,EAAE,cAAc,EAAE,MAAM,EAAE,WAAW,CAAC,CAAA;IACxE,CAAC,CAAA;AACH,CAAC"}
@@ -1,26 +1,22 @@
1
- import z from 'zod';
2
1
  export type QueryMetadata = {
3
2
  propertyKey: string | symbol;
4
3
  parameterIndex: number;
5
- schema?: () => z.ZodSchema;
6
4
  };
7
- /**
8
- * Handler to validate the query of the request.
9
- *
10
- * @param target - The target object.
11
- * @param propertyKey - The property key.
12
- * @param args - The arguments.
13
- * @returns The parameter and parameter index.
14
- */
15
- export declare function queryDecoratorHandler(target: object, propertyKey: string | symbol, args: any[]): {
16
- parameter: {};
17
- parameterIndex: number;
18
- } | null;
5
+ export declare class QueryHandler {
6
+ static getMetadata(target: object, propertyKey: string | symbol): QueryMetadata | undefined;
7
+ static handle(target: object, propertyKey: string | symbol, args: any[]): {
8
+ type: string;
9
+ parameter: {
10
+ [k: string]: string;
11
+ };
12
+ parameterIndex: number;
13
+ } | null;
14
+ }
19
15
  /**
20
16
  * Decorator to validate the query of the request.
21
17
  *
22
18
  * @param schema - The Zod schema to validate the query against.
23
19
  * @returns A decorator function that can be used to decorate a controller method.
24
20
  */
25
- export declare function Query(schema?: z.ZodSchema | (() => z.ZodSchema)): (target: object, propertyKey: string | symbol, parameterIndex: number) => void;
21
+ export declare function Query(): (target: object, propertyKey: string | symbol, propertyIndex: number) => void;
26
22
  //# sourceMappingURL=query-decorator.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"query-decorator.d.ts","sourceRoot":"","sources":["../../../src/controllers/decorators/query-decorator.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAA;AAKnB,MAAM,MAAM,aAAa,GAAG;IAC1B,WAAW,EAAE,MAAM,GAAG,MAAM,CAAA;IAC5B,cAAc,EAAE,MAAM,CAAA;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC,CAAC,SAAS,CAAA;CAC3B,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,qBAAqB,CACnC,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GAAG,MAAM,EAC5B,IAAI,EAAE,GAAG,EAAE;;;SA0CZ;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,SAAS,GAAG,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,IAE5D,QAAQ,MAAM,EACd,aAAa,MAAM,GAAG,MAAM,EAC5B,gBAAgB,MAAM,UAkBzB"}
1
+ {"version":3,"file":"query-decorator.d.ts","sourceRoot":"","sources":["../../../src/controllers/decorators/query-decorator.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,aAAa,GAAG;IAC1B,WAAW,EAAE,MAAM,GAAG,MAAM,CAAA;IAC5B,cAAc,EAAE,MAAM,CAAA;CACvB,CAAA;AAED,qBAAa,YAAY;IACvB,MAAM,CAAC,WAAW,CAChB,MAAM,EAAE,MAAM,EACd,WAAW,EAAE,MAAM,GAAG,MAAM,GAC3B,aAAa,GAAG,SAAS;IAmB5B,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE;;;;;;;CAmBxE;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,KAEjB,QAAQ,MAAM,EACd,aAAa,MAAM,GAAG,MAAM,EAC5B,eAAe,MAAM,UAaxB"}
@@ -1,61 +1,47 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.queryDecoratorHandler = queryDecoratorHandler;
3
+ exports.QueryHandler = void 0;
4
4
  exports.Query = Query;
5
5
  const keys_1 = require("../../constants/keys");
6
- const api_exception_1 = require("../../exceptions/api-exception");
7
6
  const get_next_arguments_1 = require("../../utils/nextjs/get-next-arguments");
8
- /**
9
- * Handler to validate the query of the request.
10
- *
11
- * @param target - The target object.
12
- * @param propertyKey - The property key.
13
- * @param args - The arguments.
14
- * @returns The parameter and parameter index.
15
- */
16
- function queryDecoratorHandler(target, propertyKey, args) {
17
- const metadata = Reflect.getOwnMetadata(keys_1.QUERY_KEY, target, propertyKey);
18
- // If the metadata is found, validate the query.
19
- if (metadata) {
20
- const request = (0, get_next_arguments_1.getNextRequestArgument)(args);
21
- const { searchParams } = new URL(request.url);
22
- const query = Object.fromEntries(searchParams.entries());
23
- // If the schema is not provided, return the query.
24
- if (!metadata.schema) {
7
+ class QueryHandler {
8
+ static getMetadata(target, propertyKey) {
9
+ let metadata = Reflect.getOwnMetadata(keys_1.QUERY_KEY, target, propertyKey);
10
+ // If not found on instance, try constructor prototype
11
+ if (!metadata && target.constructor) {
12
+ metadata = Reflect.getOwnMetadata(keys_1.QUERY_KEY, target.constructor.prototype, propertyKey);
13
+ }
14
+ return metadata;
15
+ }
16
+ static handle(target, propertyKey, args) {
17
+ const metadata = this.getMetadata(target, propertyKey);
18
+ // If the metadata is found, validate the query.
19
+ if (metadata) {
20
+ const request = (0, get_next_arguments_1.getNextRequestArgument)(args);
21
+ const { searchParams } = new URL(request.url);
22
+ const query = Object.fromEntries(searchParams.entries());
25
23
  return {
24
+ type: 'query',
26
25
  parameter: query,
27
26
  parameterIndex: metadata.parameterIndex
28
27
  };
29
28
  }
30
- const resolvedSchema = metadata.schema?.();
31
- const parsedQuery = resolvedSchema?.safeParse(query);
32
- // If the query is not valid, throw a validation error.
33
- if (parsedQuery && !parsedQuery.success) {
34
- throw new api_exception_1.ValidationApiException(`Invalid query parameters: ${JSON.stringify(parsedQuery.error.flatten().fieldErrors)}`);
35
- }
36
- return {
37
- parameter: parsedQuery?.data || query,
38
- parameterIndex: metadata.parameterIndex
39
- };
29
+ return null;
40
30
  }
41
- return null;
42
31
  }
32
+ exports.QueryHandler = QueryHandler;
43
33
  /**
44
34
  * Decorator to validate the query of the request.
45
35
  *
46
36
  * @param schema - The Zod schema to validate the query against.
47
37
  * @returns A decorator function that can be used to decorate a controller method.
48
38
  */
49
- function Query(schema) {
50
- return function (target, propertyKey, parameterIndex) {
51
- // Wrap the schema in a function to prevent TypeScript from analyzing it during compilation
52
- const lazySchema = schema
53
- ? () => (typeof schema === 'function' ? schema() : schema)
54
- : undefined;
39
+ function Query() {
40
+ return function (target, propertyKey, propertyIndex) {
41
+ // Get the parameter type from design:paramtypes
55
42
  Reflect.defineMetadata(keys_1.QUERY_KEY, {
56
43
  propertyKey,
57
- parameterIndex,
58
- schema: lazySchema
44
+ parameterIndex: propertyIndex
59
45
  }, target, propertyKey);
60
46
  };
61
47
  }
@@ -1 +1 @@
1
- {"version":3,"file":"query-decorator.js","sourceRoot":"","sources":["../../../src/controllers/decorators/query-decorator.ts"],"names":[],"mappings":";;AAmBA,sDA6CC;AAQD,sBAsBC;AA7FD,2CAA4C;AAC5C,8DAAmE;AACnE,0EAA0E;AAQ1E;;;;;;;GAOG;AACH,SAAgB,qBAAqB,CACnC,MAAc,EACd,WAA4B,EAC5B,IAAW;IAEX,MAAM,QAAQ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,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;YAC1D,CAAC,CAAC,SAAS,CAAA;QAEb,OAAO,CAAC,cAAc,CACpB,gBAAS,EACT;YACE,WAAW;YACX,cAAc;YACd,MAAM,EAAE,UAAU;SACnB,EACD,MAAM,EACN,WAAW,CACZ,CAAA;IACH,CAAC,CAAA;AACH,CAAC"}
1
+ {"version":3,"file":"query-decorator.js","sourceRoot":"","sources":["../../../src/controllers/decorators/query-decorator.ts"],"names":[],"mappings":";;;AA0DA,sBAiBC;AA3ED,2CAA4C;AAC5C,0EAA0E;AAO1E,MAAa,YAAY;IACvB,MAAM,CAAC,WAAW,CAChB,MAAc,EACd,WAA4B;QAE5B,IAAI,QAAQ,GAAkB,OAAO,CAAC,cAAc,CAClD,gBAAS,EACT,MAAM,EACN,WAAW,CACZ,CAAA;QAED,sDAAsD;QACtD,IAAI,CAAC,QAAQ,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;YACpC,QAAQ,GAAG,OAAO,CAAC,cAAc,CAC/B,gBAAS,EACT,MAAM,CAAC,WAAW,CAAC,SAAS,EAC5B,WAAW,CACZ,CAAA;QACH,CAAC;QAED,OAAO,QAAQ,CAAA;IACjB,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,MAAc,EAAE,WAA4B,EAAE,IAAW;QACrE,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,WAAW,CAAC,CAAA;QAEtD,gDAAgD;QAChD,IAAI,QAAQ,EAAE,CAAC;YACb,MAAM,OAAO,GAAG,IAAA,2CAAsB,EAAC,IAAI,CAAC,CAAA;YAC5C,MAAM,EAAE,YAAY,EAAE,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,CAAA;YAE7C,MAAM,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC,YAAY,CAAC,OAAO,EAAE,CAAC,CAAA;YAExD,OAAO;gBACL,IAAI,EAAE,OAAO;gBACb,SA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