@spinajs/http 2.0.185 → 2.0.186

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 (179) hide show
  1. package/lib/cjs/interfaces.d.ts +19 -0
  2. package/lib/cjs/interfaces.d.ts.map +1 -1
  3. package/lib/cjs/interfaces.js +4 -0
  4. package/lib/cjs/interfaces.js.map +1 -1
  5. package/lib/cjs/middlewares/RequestId.d.ts +1 -1
  6. package/lib/cjs/middlewares/RequestId.d.ts.map +1 -1
  7. package/lib/cjs/middlewares/RequestId.js +4 -1
  8. package/lib/cjs/middlewares/RequestId.js.map +1 -1
  9. package/lib/cjs/response-methods/badRequest.d.ts +4 -8
  10. package/lib/cjs/response-methods/badRequest.d.ts.map +1 -1
  11. package/lib/cjs/response-methods/badRequest.js +18 -10
  12. package/lib/cjs/response-methods/badRequest.js.map +1 -1
  13. package/lib/cjs/response-methods/conflict.d.ts +5 -3
  14. package/lib/cjs/response-methods/conflict.d.ts.map +1 -1
  15. package/lib/cjs/response-methods/conflict.js +8 -4
  16. package/lib/cjs/response-methods/conflict.js.map +1 -1
  17. package/lib/cjs/response-methods/created.d.ts +3 -2
  18. package/lib/cjs/response-methods/created.d.ts.map +1 -1
  19. package/lib/cjs/response-methods/created.js +6 -2
  20. package/lib/cjs/response-methods/created.js.map +1 -1
  21. package/lib/cjs/response-methods/entityTooLarge.d.ts +3 -2
  22. package/lib/cjs/response-methods/entityTooLarge.d.ts.map +1 -1
  23. package/lib/cjs/response-methods/entityTooLarge.js +6 -2
  24. package/lib/cjs/response-methods/entityTooLarge.js.map +1 -1
  25. package/lib/cjs/response-methods/file.d.ts +7 -4
  26. package/lib/cjs/response-methods/file.d.ts.map +1 -1
  27. package/lib/cjs/response-methods/file.js +13 -3
  28. package/lib/cjs/response-methods/file.js.map +1 -1
  29. package/lib/cjs/response-methods/forbidden.d.ts +5 -3
  30. package/lib/cjs/response-methods/forbidden.d.ts.map +1 -1
  31. package/lib/cjs/response-methods/forbidden.js +8 -4
  32. package/lib/cjs/response-methods/forbidden.js.map +1 -1
  33. package/lib/cjs/response-methods/index.d.ts +0 -1
  34. package/lib/cjs/response-methods/index.d.ts.map +1 -1
  35. package/lib/cjs/response-methods/index.js +0 -1
  36. package/lib/cjs/response-methods/index.js.map +1 -1
  37. package/lib/cjs/response-methods/noContent.d.ts +5 -3
  38. package/lib/cjs/response-methods/noContent.d.ts.map +1 -1
  39. package/lib/cjs/response-methods/noContent.js +8 -4
  40. package/lib/cjs/response-methods/noContent.js.map +1 -1
  41. package/lib/cjs/response-methods/notAcceptable.d.ts +5 -3
  42. package/lib/cjs/response-methods/notAcceptable.d.ts.map +1 -1
  43. package/lib/cjs/response-methods/notAcceptable.js +8 -4
  44. package/lib/cjs/response-methods/notAcceptable.js.map +1 -1
  45. package/lib/cjs/response-methods/notAllowed.d.ts +5 -3
  46. package/lib/cjs/response-methods/notAllowed.d.ts.map +1 -1
  47. package/lib/cjs/response-methods/notAllowed.js +8 -4
  48. package/lib/cjs/response-methods/notAllowed.js.map +1 -1
  49. package/lib/cjs/response-methods/notFound.d.ts +5 -3
  50. package/lib/cjs/response-methods/notFound.d.ts.map +1 -1
  51. package/lib/cjs/response-methods/notFound.js +8 -4
  52. package/lib/cjs/response-methods/notFound.js.map +1 -1
  53. package/lib/cjs/response-methods/ok.d.ts +3 -2
  54. package/lib/cjs/response-methods/ok.d.ts.map +1 -1
  55. package/lib/cjs/response-methods/ok.js +6 -2
  56. package/lib/cjs/response-methods/ok.js.map +1 -1
  57. package/lib/cjs/response-methods/serverError.d.ts +5 -3
  58. package/lib/cjs/response-methods/serverError.d.ts.map +1 -1
  59. package/lib/cjs/response-methods/serverError.js +8 -4
  60. package/lib/cjs/response-methods/serverError.js.map +1 -1
  61. package/lib/cjs/response-methods/template.d.ts +3 -3
  62. package/lib/cjs/response-methods/template.d.ts.map +1 -1
  63. package/lib/cjs/response-methods/template.js +6 -4
  64. package/lib/cjs/response-methods/template.js.map +1 -1
  65. package/lib/cjs/response-methods/unauthorized.d.ts +5 -3
  66. package/lib/cjs/response-methods/unauthorized.d.ts.map +1 -1
  67. package/lib/cjs/response-methods/unauthorized.js +8 -4
  68. package/lib/cjs/response-methods/unauthorized.js.map +1 -1
  69. package/lib/cjs/response-methods/validationError.d.ts +5 -3
  70. package/lib/cjs/response-methods/validationError.d.ts.map +1 -1
  71. package/lib/cjs/response-methods/validationError.js +8 -4
  72. package/lib/cjs/response-methods/validationError.js.map +1 -1
  73. package/lib/cjs/responses.d.ts +7 -5
  74. package/lib/cjs/responses.d.ts.map +1 -1
  75. package/lib/cjs/responses.js +54 -15
  76. package/lib/cjs/responses.js.map +1 -1
  77. package/lib/cjs/route-args/FromSession.d.ts +1 -0
  78. package/lib/cjs/route-args/FromSession.d.ts.map +1 -0
  79. package/lib/cjs/route-args/FromSession.js +1 -0
  80. package/lib/cjs/route-args/FromSession.js.map +1 -0
  81. package/lib/mjs/interfaces.d.ts +19 -0
  82. package/lib/mjs/interfaces.d.ts.map +1 -1
  83. package/lib/mjs/interfaces.js +4 -0
  84. package/lib/mjs/interfaces.js.map +1 -1
  85. package/lib/mjs/middlewares/RequestId.d.ts +1 -1
  86. package/lib/mjs/middlewares/RequestId.d.ts.map +1 -1
  87. package/lib/mjs/middlewares/RequestId.js +4 -1
  88. package/lib/mjs/middlewares/RequestId.js.map +1 -1
  89. package/lib/mjs/response-methods/badRequest.d.ts +4 -8
  90. package/lib/mjs/response-methods/badRequest.d.ts.map +1 -1
  91. package/lib/mjs/response-methods/badRequest.js +16 -11
  92. package/lib/mjs/response-methods/badRequest.js.map +1 -1
  93. package/lib/mjs/response-methods/conflict.d.ts +5 -3
  94. package/lib/mjs/response-methods/conflict.d.ts.map +1 -1
  95. package/lib/mjs/response-methods/conflict.js +8 -4
  96. package/lib/mjs/response-methods/conflict.js.map +1 -1
  97. package/lib/mjs/response-methods/created.d.ts +3 -2
  98. package/lib/mjs/response-methods/created.d.ts.map +1 -1
  99. package/lib/mjs/response-methods/created.js +6 -2
  100. package/lib/mjs/response-methods/created.js.map +1 -1
  101. package/lib/mjs/response-methods/entityTooLarge.d.ts +3 -2
  102. package/lib/mjs/response-methods/entityTooLarge.d.ts.map +1 -1
  103. package/lib/mjs/response-methods/entityTooLarge.js +6 -2
  104. package/lib/mjs/response-methods/entityTooLarge.js.map +1 -1
  105. package/lib/mjs/response-methods/file.d.ts +7 -4
  106. package/lib/mjs/response-methods/file.d.ts.map +1 -1
  107. package/lib/mjs/response-methods/file.js +13 -3
  108. package/lib/mjs/response-methods/file.js.map +1 -1
  109. package/lib/mjs/response-methods/forbidden.d.ts +5 -3
  110. package/lib/mjs/response-methods/forbidden.d.ts.map +1 -1
  111. package/lib/mjs/response-methods/forbidden.js +8 -4
  112. package/lib/mjs/response-methods/forbidden.js.map +1 -1
  113. package/lib/mjs/response-methods/index.d.ts +0 -1
  114. package/lib/mjs/response-methods/index.d.ts.map +1 -1
  115. package/lib/mjs/response-methods/index.js +0 -1
  116. package/lib/mjs/response-methods/index.js.map +1 -1
  117. package/lib/mjs/response-methods/noContent.d.ts +5 -3
  118. package/lib/mjs/response-methods/noContent.d.ts.map +1 -1
  119. package/lib/mjs/response-methods/noContent.js +8 -4
  120. package/lib/mjs/response-methods/noContent.js.map +1 -1
  121. package/lib/mjs/response-methods/notAcceptable.d.ts +5 -3
  122. package/lib/mjs/response-methods/notAcceptable.d.ts.map +1 -1
  123. package/lib/mjs/response-methods/notAcceptable.js +8 -4
  124. package/lib/mjs/response-methods/notAcceptable.js.map +1 -1
  125. package/lib/mjs/response-methods/notAllowed.d.ts +5 -3
  126. package/lib/mjs/response-methods/notAllowed.d.ts.map +1 -1
  127. package/lib/mjs/response-methods/notAllowed.js +8 -4
  128. package/lib/mjs/response-methods/notAllowed.js.map +1 -1
  129. package/lib/mjs/response-methods/notFound.d.ts +5 -3
  130. package/lib/mjs/response-methods/notFound.d.ts.map +1 -1
  131. package/lib/mjs/response-methods/notFound.js +8 -4
  132. package/lib/mjs/response-methods/notFound.js.map +1 -1
  133. package/lib/mjs/response-methods/ok.d.ts +3 -2
  134. package/lib/mjs/response-methods/ok.d.ts.map +1 -1
  135. package/lib/mjs/response-methods/ok.js +6 -2
  136. package/lib/mjs/response-methods/ok.js.map +1 -1
  137. package/lib/mjs/response-methods/serverError.d.ts +5 -3
  138. package/lib/mjs/response-methods/serverError.d.ts.map +1 -1
  139. package/lib/mjs/response-methods/serverError.js +8 -4
  140. package/lib/mjs/response-methods/serverError.js.map +1 -1
  141. package/lib/mjs/response-methods/template.d.ts +3 -3
  142. package/lib/mjs/response-methods/template.d.ts.map +1 -1
  143. package/lib/mjs/response-methods/template.js +6 -4
  144. package/lib/mjs/response-methods/template.js.map +1 -1
  145. package/lib/mjs/response-methods/unauthorized.d.ts +5 -3
  146. package/lib/mjs/response-methods/unauthorized.d.ts.map +1 -1
  147. package/lib/mjs/response-methods/unauthorized.js +8 -4
  148. package/lib/mjs/response-methods/unauthorized.js.map +1 -1
  149. package/lib/mjs/response-methods/validationError.d.ts +5 -3
  150. package/lib/mjs/response-methods/validationError.d.ts.map +1 -1
  151. package/lib/mjs/response-methods/validationError.js +8 -4
  152. package/lib/mjs/response-methods/validationError.js.map +1 -1
  153. package/lib/mjs/responses.d.ts +7 -5
  154. package/lib/mjs/responses.d.ts.map +1 -1
  155. package/lib/mjs/responses.js +51 -14
  156. package/lib/mjs/responses.js.map +1 -1
  157. package/lib/mjs/route-args/FromSession.d.ts +2 -0
  158. package/lib/mjs/route-args/FromSession.d.ts.map +1 -0
  159. package/lib/mjs/route-args/FromSession.js +2 -0
  160. package/lib/mjs/route-args/FromSession.js.map +1 -0
  161. package/lib/tsconfig.cjs.tsbuildinfo +1 -1
  162. package/lib/tsconfig.mjs.tsbuildinfo +1 -1
  163. package/package.json +11 -11
  164. package/lib/cjs/response-methods/cookieResponse.d.ts +0 -20
  165. package/lib/cjs/response-methods/cookieResponse.d.ts.map +0 -1
  166. package/lib/cjs/response-methods/cookieResponse.js +0 -74
  167. package/lib/cjs/response-methods/cookieResponse.js.map +0 -1
  168. package/lib/cjs/response-methods/errorResponse.d.ts +0 -8
  169. package/lib/cjs/response-methods/errorResponse.d.ts.map +0 -1
  170. package/lib/cjs/response-methods/errorResponse.js +0 -25
  171. package/lib/cjs/response-methods/errorResponse.js.map +0 -1
  172. package/lib/mjs/response-methods/cookieResponse.d.ts +0 -20
  173. package/lib/mjs/response-methods/cookieResponse.d.ts.map +0 -1
  174. package/lib/mjs/response-methods/cookieResponse.js +0 -47
  175. package/lib/mjs/response-methods/cookieResponse.js.map +0 -1
  176. package/lib/mjs/response-methods/errorResponse.d.ts +0 -8
  177. package/lib/mjs/response-methods/errorResponse.d.ts.map +0 -1
  178. package/lib/mjs/response-methods/errorResponse.js +0 -18
  179. package/lib/mjs/response-methods/errorResponse.js.map +0 -1
@@ -1,13 +1,15 @@
1
1
  /// <reference types="qs" />
2
2
  import * as express from 'express';
3
- import { ErrorResponse } from './errorResponse.js';
3
+ import { IResponseOptions } from '../interfaces.js';
4
+ import { BadRequest } from './badRequest.js';
4
5
  /**
5
6
  * Internall response function.
6
7
  * Returns HTTP 204 NO CONTENT
7
8
  * @param err - error to send
8
9
  */
9
- export declare class NoContent extends ErrorResponse {
10
- constructor(data: any);
10
+ export declare class NoContent extends BadRequest {
11
+ protected options?: IResponseOptions;
12
+ constructor(data?: any, options?: IResponseOptions);
11
13
  execute(_req: express.Request, _res: express.Response): Promise<(req: express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: express.Response<any, Record<string, any>>) => void>;
12
14
  }
13
15
  //# sourceMappingURL=noContent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"noContent.d.ts","sourceRoot":"","sources":["../../../src/response-methods/noContent.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAGnC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;GAIG;AACH,qBAAa,SAAU,SAAQ,aAAa;gBAC9B,IAAI,EAAE,GAAG;IAIR,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ;CAGnE"}
1
+ {"version":3,"file":"noContent.d.ts","sourceRoot":"","sources":["../../../src/response-methods/noContent.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAoB,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;;GAIG;AACH,qBAAa,SAAU,SAAQ,UAAU;IACf,SAAS,CAAC,OAAO,CAAC,EAAE,gBAAgB;gBAAhD,IAAI,CAAC,EAAE,GAAG,EAAY,OAAO,CAAC,EAAE,gBAAgB;IAI/C,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ;CAMnE"}
@@ -3,18 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NoContent = void 0;
4
4
  const interfaces_js_1 = require("../interfaces.js");
5
5
  const responses_js_1 = require("../responses.js");
6
- const errorResponse_js_1 = require("./errorResponse.js");
6
+ const badRequest_js_1 = require("./badRequest.js");
7
7
  /**
8
8
  * Internall response function.
9
9
  * Returns HTTP 204 NO CONTENT
10
10
  * @param err - error to send
11
11
  */
12
- class NoContent extends errorResponse_js_1.ErrorResponse {
13
- constructor(data) {
12
+ class NoContent extends badRequest_js_1.BadRequest {
13
+ constructor(data, options) {
14
14
  super(data);
15
+ this.options = options;
15
16
  }
16
17
  async execute(_req, _res) {
17
- return await (0, responses_js_1.httpResponse)(this.responseData, interfaces_js_1.HTTP_STATUS_CODE.NO_CONTENT, 'noContent.pug');
18
+ return await (0, responses_js_1.httpResponse)(this.responseData, 'noContent.pug', {
19
+ ...this.options,
20
+ StatusCode: interfaces_js_1.HTTP_STATUS_CODE.NO_CONTENT,
21
+ });
18
22
  }
19
23
  }
20
24
  exports.NoContent = NoContent;
@@ -1 +1 @@
1
- {"version":3,"file":"noContent.js","sourceRoot":"","sources":["../../../src/response-methods/noContent.ts"],"names":[],"mappings":";;;AACA,oDAAoD;AACpD,kDAA+C;AAC/C,yDAAmD;AAEnD;;;;GAIG;AACH,MAAa,SAAU,SAAQ,gCAAa;IAC1C,YAAY,IAAS;QACnB,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAqB,EAAE,IAAsB;QAChE,OAAO,MAAM,IAAA,2BAAY,EAAC,IAAI,CAAC,YAAY,EAAE,gCAAgB,CAAC,UAAU,EAAE,eAAe,CAAC,CAAC;IAC7F,CAAC;CACF;AARD,8BAQC"}
1
+ {"version":3,"file":"noContent.js","sourceRoot":"","sources":["../../../src/response-methods/noContent.ts"],"names":[],"mappings":";;;AACA,oDAAsE;AACtE,kDAA+C;AAC/C,mDAA6C;AAE7C;;;;GAIG;AACH,MAAa,SAAU,SAAQ,0BAAU;IACvC,YAAY,IAAU,EAAY,OAA0B;QAC1D,KAAK,CAAC,IAAI,CAAC,CAAC;QADoB,YAAO,GAAP,OAAO,CAAmB;IAE5D,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAqB,EAAE,IAAsB;QAChE,OAAO,MAAM,IAAA,2BAAY,EAAC,IAAI,CAAC,YAAY,EAAE,eAAe,EAAE;YAC5D,GAAG,IAAI,CAAC,OAAO;YACf,UAAU,EAAE,gCAAgB,CAAC,UAAU;SACxC,CAAC,CAAC;IACL,CAAC;CACF;AAXD,8BAWC"}
@@ -1,14 +1,16 @@
1
1
  /// <reference types="qs" />
2
2
  import * as express from 'express';
3
- import { ErrorResponse } from './errorResponse.js';
3
+ import { IResponseOptions } from '../interfaces.js';
4
+ import { BadRequest } from './badRequest.js';
4
5
  /**
5
6
  * Internall response function.
6
7
  * Returns HTTP 406 NOT ACCEPTABLE
7
8
  * When content requested in accept header format cannot be returned.
8
9
  * @param err - error to send
9
10
  */
10
- export declare class NotAcceptable extends ErrorResponse {
11
- constructor(data: any);
11
+ export declare class NotAcceptable extends BadRequest {
12
+ protected options?: IResponseOptions;
13
+ constructor(data?: any, options?: IResponseOptions);
12
14
  execute(_req: express.Request, _res: express.Response): Promise<(req: express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: express.Response<any, Record<string, any>>) => void>;
13
15
  }
14
16
  //# sourceMappingURL=notAcceptable.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"notAcceptable.d.ts","sourceRoot":"","sources":["../../../src/response-methods/notAcceptable.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAGnC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,aAAa;gBAClC,IAAI,EAAE,GAAG;IAIR,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ;CAGnE"}
1
+ {"version":3,"file":"notAcceptable.d.ts","sourceRoot":"","sources":["../../../src/response-methods/notAcceptable.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAoB,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,UAAU;IACnB,SAAS,CAAC,OAAO,CAAC,EAAG,gBAAgB;gBAAjD,IAAI,CAAC,EAAE,GAAG,EAAY,OAAO,CAAC,EAAG,gBAAgB;IAIhD,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ;CAMnE"}
@@ -3,19 +3,23 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NotAcceptable = void 0;
4
4
  const interfaces_js_1 = require("../interfaces.js");
5
5
  const responses_js_1 = require("../responses.js");
6
- const errorResponse_js_1 = require("./errorResponse.js");
6
+ const badRequest_js_1 = require("./badRequest.js");
7
7
  /**
8
8
  * Internall response function.
9
9
  * Returns HTTP 406 NOT ACCEPTABLE
10
10
  * When content requested in accept header format cannot be returned.
11
11
  * @param err - error to send
12
12
  */
13
- class NotAcceptable extends errorResponse_js_1.ErrorResponse {
14
- constructor(data) {
13
+ class NotAcceptable extends badRequest_js_1.BadRequest {
14
+ constructor(data, options) {
15
15
  super(data);
16
+ this.options = options;
16
17
  }
17
18
  async execute(_req, _res) {
18
- return await (0, responses_js_1.httpResponse)(this.responseData, interfaces_js_1.HTTP_STATUS_CODE.NOT_ACCEPTABLE, 'notAcceptable.pug');
19
+ return await (0, responses_js_1.httpResponse)(this.responseData, 'notAcceptable.pug', {
20
+ ...this.options,
21
+ StatusCode: interfaces_js_1.HTTP_STATUS_CODE.NOT_ACCEPTABLE
22
+ });
19
23
  }
20
24
  }
21
25
  exports.NotAcceptable = NotAcceptable;
@@ -1 +1 @@
1
- {"version":3,"file":"notAcceptable.js","sourceRoot":"","sources":["../../../src/response-methods/notAcceptable.ts"],"names":[],"mappings":";;;AACA,oDAAoD;AACpD,kDAA+C;AAC/C,yDAAmD;AAEnD;;;;;GAKG;AACH,MAAa,aAAc,SAAQ,gCAAa;IAC9C,YAAY,IAAS;QACnB,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAqB,EAAE,IAAsB;QAChE,OAAO,MAAM,IAAA,2BAAY,EAAC,IAAI,CAAC,YAAY,EAAE,gCAAgB,CAAC,cAAc,EAAE,mBAAmB,CAAC,CAAC;IACrG,CAAC;CACF;AARD,sCAQC"}
1
+ {"version":3,"file":"notAcceptable.js","sourceRoot":"","sources":["../../../src/response-methods/notAcceptable.ts"],"names":[],"mappings":";;;AACA,oDAAsE;AACtE,kDAA+C;AAC/C,mDAA6C;AAE7C;;;;;GAKG;AACH,MAAa,aAAc,SAAQ,0BAAU;IAC3C,YAAY,IAAU,EAAY,OAA2B;QAC3D,KAAK,CAAC,IAAI,CAAC,CAAC;QADoB,YAAO,GAAP,OAAO,CAAoB;IAE7D,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAqB,EAAE,IAAsB;QAChE,OAAO,MAAM,IAAA,2BAAY,EAAC,IAAI,CAAC,YAAY,EAAE,mBAAmB,EAAE;YAChE,GAAG,IAAI,CAAC,OAAO;YACf,UAAU,EAAE,gCAAgB,CAAC,cAAc;SAC5C,CAAC,CAAC;IACL,CAAC;CACF;AAXD,sCAWC"}
@@ -1,13 +1,15 @@
1
1
  /// <reference types="qs" />
2
2
  import * as express from 'express';
3
- import { ErrorResponse } from './errorResponse.js';
3
+ import { IResponseOptions } from '../interfaces.js';
4
+ import { BadRequest } from './badRequest.js';
4
5
  /**
5
6
  * Internall response function.
6
7
  * Returns HTTP 403 FORBIDDEN ERROR
7
8
  * @param err - error to send
8
9
  */
9
- export declare class NotAllowed extends ErrorResponse {
10
- constructor(data: any);
10
+ export declare class NotAllowed extends BadRequest {
11
+ protected options?: IResponseOptions;
12
+ constructor(data?: any, options?: IResponseOptions);
11
13
  execute(_req: express.Request, _res: express.Response): Promise<(req: express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: express.Response<any, Record<string, any>>) => void>;
12
14
  }
13
15
  //# sourceMappingURL=notAllowed.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"notAllowed.d.ts","sourceRoot":"","sources":["../../../src/response-methods/notAllowed.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAGnC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;GAIG;AAEH,qBAAa,UAAW,SAAQ,aAAa;gBAC/B,IAAI,EAAE,GAAG;IAIR,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ;CAGnE"}
1
+ {"version":3,"file":"notAllowed.d.ts","sourceRoot":"","sources":["../../../src/response-methods/notAllowed.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAoB,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;;GAIG;AAEH,qBAAa,UAAW,SAAQ,UAAU;IAChB,SAAS,CAAC,OAAO,CAAC,EAAE,gBAAgB;gBAAhD,IAAI,CAAC,EAAE,GAAG,EAAY,OAAO,CAAC,EAAE,gBAAgB;IAI/C,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ;CAMnE"}
@@ -3,18 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NotAllowed = void 0;
4
4
  const interfaces_js_1 = require("../interfaces.js");
5
5
  const responses_js_1 = require("../responses.js");
6
- const errorResponse_js_1 = require("./errorResponse.js");
6
+ const badRequest_js_1 = require("./badRequest.js");
7
7
  /**
8
8
  * Internall response function.
9
9
  * Returns HTTP 403 FORBIDDEN ERROR
10
10
  * @param err - error to send
11
11
  */
12
- class NotAllowed extends errorResponse_js_1.ErrorResponse {
13
- constructor(data) {
12
+ class NotAllowed extends badRequest_js_1.BadRequest {
13
+ constructor(data, options) {
14
14
  super(data);
15
+ this.options = options;
15
16
  }
16
17
  async execute(_req, _res) {
17
- return await (0, responses_js_1.httpResponse)(this.responseData, interfaces_js_1.HTTP_STATUS_CODE.NOT_ALLOWED, 'not-allowed.pug');
18
+ return await (0, responses_js_1.httpResponse)(this.responseData, 'not-allowed.pug', {
19
+ ...this.options,
20
+ StatusCode: interfaces_js_1.HTTP_STATUS_CODE.NOT_ALLOWED,
21
+ });
18
22
  }
19
23
  }
20
24
  exports.NotAllowed = NotAllowed;
@@ -1 +1 @@
1
- {"version":3,"file":"notAllowed.js","sourceRoot":"","sources":["../../../src/response-methods/notAllowed.ts"],"names":[],"mappings":";;;AACA,oDAAoD;AACpD,kDAA+C;AAC/C,yDAAmD;AAEnD;;;;GAIG;AAEH,MAAa,UAAW,SAAQ,gCAAa;IAC3C,YAAY,IAAS;QACnB,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAqB,EAAE,IAAsB;QAChE,OAAO,MAAM,IAAA,2BAAY,EAAC,IAAI,CAAC,YAAY,EAAE,gCAAgB,CAAC,WAAW,EAAE,iBAAiB,CAAC,CAAC;IAChG,CAAC;CACF;AARD,gCAQC"}
1
+ {"version":3,"file":"notAllowed.js","sourceRoot":"","sources":["../../../src/response-methods/notAllowed.ts"],"names":[],"mappings":";;;AACA,oDAAsE;AACtE,kDAA+C;AAC/C,mDAA6C;AAE7C;;;;GAIG;AAEH,MAAa,UAAW,SAAQ,0BAAU;IACxC,YAAY,IAAU,EAAY,OAA0B;QAC1D,KAAK,CAAC,IAAI,CAAC,CAAC;QADoB,YAAO,GAAP,OAAO,CAAmB;IAE5D,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAqB,EAAE,IAAsB;QAChE,OAAO,MAAM,IAAA,2BAAY,EAAC,IAAI,CAAC,YAAY,EAAE,iBAAiB,EAAE;YAC9D,GAAG,IAAI,CAAC,OAAO;YACf,UAAU,EAAE,gCAAgB,CAAC,WAAW;SACzC,CAAC,CAAC;IACL,CAAC;CACF;AAXD,gCAWC"}
@@ -1,13 +1,15 @@
1
1
  /// <reference types="qs" />
2
2
  import * as express from 'express';
3
- import { ErrorResponse } from './errorResponse.js';
3
+ import { IResponseOptions } from '../interfaces.js';
4
+ import { BadRequest } from './badRequest.js';
4
5
  /**
5
6
  * Internall response function.
6
7
  * Returns HTTP 404 NOT FOUND ERROR
7
8
  * @param err - error to send
8
9
  */
9
- export declare class NotFound extends ErrorResponse {
10
- constructor(data?: any);
10
+ export declare class NotFound extends BadRequest {
11
+ protected options?: IResponseOptions;
12
+ constructor(data?: any, options?: IResponseOptions);
11
13
  execute(_req: express.Request, _res: express.Response): Promise<(req: express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: express.Response<any, Record<string, any>>) => void>;
12
14
  }
13
15
  //# sourceMappingURL=notFound.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"notFound.d.ts","sourceRoot":"","sources":["../../../src/response-methods/notFound.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAGnC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;GAIG;AACH,qBAAa,QAAS,SAAQ,aAAa;gBAC7B,IAAI,CAAC,EAAE,GAAG;IAIT,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ;CAGnE"}
1
+ {"version":3,"file":"notFound.d.ts","sourceRoot":"","sources":["../../../src/response-methods/notFound.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAoB,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;;GAIG;AACH,qBAAa,QAAS,SAAQ,UAAU;IACd,SAAS,CAAC,OAAO,CAAC,EAAE,gBAAgB;gBAAhD,IAAI,CAAC,EAAE,GAAG,EAAY,OAAO,CAAC,EAAE,gBAAgB;IAI/C,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ;CAMnE"}
@@ -3,18 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.NotFound = void 0;
4
4
  const interfaces_js_1 = require("../interfaces.js");
5
5
  const responses_js_1 = require("../responses.js");
6
- const errorResponse_js_1 = require("./errorResponse.js");
6
+ const badRequest_js_1 = require("./badRequest.js");
7
7
  /**
8
8
  * Internall response function.
9
9
  * Returns HTTP 404 NOT FOUND ERROR
10
10
  * @param err - error to send
11
11
  */
12
- class NotFound extends errorResponse_js_1.ErrorResponse {
13
- constructor(data) {
12
+ class NotFound extends badRequest_js_1.BadRequest {
13
+ constructor(data, options) {
14
14
  super(data);
15
+ this.options = options;
15
16
  }
16
17
  async execute(_req, _res) {
17
- return await (0, responses_js_1.httpResponse)(this.responseData, interfaces_js_1.HTTP_STATUS_CODE.NOT_FOUND, 'notFound.pug');
18
+ return await (0, responses_js_1.httpResponse)(this.responseData, 'notFound.pug', {
19
+ ...this.options,
20
+ StatusCode: interfaces_js_1.HTTP_STATUS_CODE.NOT_FOUND,
21
+ });
18
22
  }
19
23
  }
20
24
  exports.NotFound = NotFound;
@@ -1 +1 @@
1
- {"version":3,"file":"notFound.js","sourceRoot":"","sources":["../../../src/response-methods/notFound.ts"],"names":[],"mappings":";;;AACA,oDAAoD;AACpD,kDAA+C;AAC/C,yDAAmD;AAEnD;;;;GAIG;AACH,MAAa,QAAS,SAAQ,gCAAa;IACzC,YAAY,IAAU;QACpB,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAqB,EAAE,IAAsB;QAChE,OAAO,MAAM,IAAA,2BAAY,EAAC,IAAI,CAAC,YAAY,EAAE,gCAAgB,CAAC,SAAS,EAAE,cAAc,CAAC,CAAC;IAC3F,CAAC;CACF;AARD,4BAQC"}
1
+ {"version":3,"file":"notFound.js","sourceRoot":"","sources":["../../../src/response-methods/notFound.ts"],"names":[],"mappings":";;;AACA,oDAAsE;AACtE,kDAA+C;AAC/C,mDAA6C;AAE7C;;;;GAIG;AACH,MAAa,QAAS,SAAQ,0BAAU;IACtC,YAAY,IAAU,EAAY,OAA0B;QAC1D,KAAK,CAAC,IAAI,CAAC,CAAC;QADoB,YAAO,GAAP,OAAO,CAAmB;IAE5D,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAqB,EAAE,IAAsB;QAChE,OAAO,MAAM,IAAA,2BAAY,EAAC,IAAI,CAAC,YAAY,EAAE,cAAc,EAAE;YAC3D,GAAG,IAAI,CAAC,OAAO;YACf,UAAU,EAAE,gCAAgB,CAAC,SAAS;SACvC,CAAC,CAAC;IACL,CAAC;CACF;AAXD,4BAWC"}
@@ -1,13 +1,14 @@
1
1
  /// <reference types="qs" />
2
2
  import * as express from 'express';
3
- import { Response } from '../interfaces.js';
3
+ import { IResponseOptions, Response } from '../interfaces.js';
4
4
  /**
5
5
  * Internall response function.
6
6
  * Returns HTTP 200 OK response with json content
7
7
  * @param data - data to send
8
8
  */
9
9
  export declare class Ok extends Response {
10
- constructor(data?: any);
10
+ protected options?: IResponseOptions;
11
+ constructor(data?: any, options?: IResponseOptions);
11
12
  execute(_req: express.Request, _res: express.Response): Promise<(req: express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: express.Response<any, Record<string, any>>) => void>;
12
13
  }
13
14
  //# sourceMappingURL=ok.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ok.d.ts","sourceRoot":"","sources":["../../../src/response-methods/ok.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAoB,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG9D;;;;GAIG;AACH,qBAAa,EAAG,SAAQ,QAAQ;gBAClB,IAAI,CAAC,EAAE,GAAG;IAIT,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ;CAGnE"}
1
+ {"version":3,"file":"ok.d.ts","sourceRoot":"","sources":["../../../src/response-methods/ok.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAoB,gBAAgB,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGhF;;;;GAIG;AACH,qBAAa,EAAG,SAAQ,QAAQ;IACN,SAAS,CAAC,OAAO,CAAC,EAAE,gBAAgB;gBAAhD,IAAI,CAAC,EAAE,GAAG,EAAY,OAAO,CAAC,EAAE,gBAAgB;IAI/C,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ;CAMnE"}
@@ -9,11 +9,15 @@ const responses_js_1 = require("../responses.js");
9
9
  * @param data - data to send
10
10
  */
11
11
  class Ok extends interfaces_js_1.Response {
12
- constructor(data) {
12
+ constructor(data, options) {
13
13
  super(data);
14
+ this.options = options;
14
15
  }
15
16
  async execute(_req, _res) {
16
- return await (0, responses_js_1.httpResponse)(this.responseData, interfaces_js_1.HTTP_STATUS_CODE.OK, 'ok.pug');
17
+ return await (0, responses_js_1.httpResponse)(this.responseData, 'ok.pug', {
18
+ ...this.options,
19
+ StatusCode: interfaces_js_1.HTTP_STATUS_CODE.OK,
20
+ });
17
21
  }
18
22
  }
19
23
  exports.Ok = Ok;
@@ -1 +1 @@
1
- {"version":3,"file":"ok.js","sourceRoot":"","sources":["../../../src/response-methods/ok.ts"],"names":[],"mappings":";;;AACA,oDAA8D;AAC9D,kDAA+C;AAE/C;;;;GAIG;AACH,MAAa,EAAG,SAAQ,wBAAQ;IAC9B,YAAY,IAAU;QACpB,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAqB,EAAE,IAAsB;QAChE,OAAO,MAAM,IAAA,2BAAY,EAAC,IAAI,CAAC,YAAY,EAAE,gCAAgB,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;IAC9E,CAAC;CACF;AARD,gBAQC"}
1
+ {"version":3,"file":"ok.js","sourceRoot":"","sources":["../../../src/response-methods/ok.ts"],"names":[],"mappings":";;;AACA,oDAAgF;AAChF,kDAA+C;AAE/C;;;;GAIG;AACH,MAAa,EAAG,SAAQ,wBAAQ;IAC9B,YAAY,IAAU,EAAY,OAA0B;QAC1D,KAAK,CAAC,IAAI,CAAC,CAAC;QADoB,YAAO,GAAP,OAAO,CAAmB;IAE5D,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAqB,EAAE,IAAsB;QAChE,OAAO,MAAM,IAAA,2BAAY,EAAC,IAAI,CAAC,YAAY,EAAE,QAAQ,EAAE;YACrD,GAAG,IAAI,CAAC,OAAO;YACf,UAAU,EAAE,gCAAgB,CAAC,EAAE;SAChC,CAAC,CAAC;IACL,CAAC;CACF;AAXD,gBAWC"}
@@ -1,13 +1,15 @@
1
1
  /// <reference types="qs" />
2
2
  import * as express from 'express';
3
- import { ErrorResponse } from './errorResponse.js';
3
+ import { IResponseOptions } from '../interfaces.js';
4
+ import { BadRequest } from './badRequest.js';
4
5
  /**
5
6
  * Internall response function.
6
7
  * Returns HTTP 500 INTERNAL SERVER ERROR
7
8
  * @param err - error to send
8
9
  */
9
- export declare class ServerError extends ErrorResponse {
10
- constructor(data: any);
10
+ export declare class ServerError extends BadRequest {
11
+ protected options?: IResponseOptions;
12
+ constructor(data?: any, options?: IResponseOptions);
11
13
  execute(_req: express.Request, _res: express.Response): Promise<(req: express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: express.Response<any, Record<string, any>>) => void>;
12
14
  }
13
15
  //# sourceMappingURL=serverError.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"serverError.d.ts","sourceRoot":"","sources":["../../../src/response-methods/serverError.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAGnC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;GAIG;AAEH,qBAAa,WAAY,SAAQ,aAAa;gBAChC,IAAI,EAAE,GAAG;IAKR,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ;CAGnE"}
1
+ {"version":3,"file":"serverError.d.ts","sourceRoot":"","sources":["../../../src/response-methods/serverError.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAoB,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;;GAIG;AAEH,qBAAa,WAAY,SAAQ,UAAU;IACjB,SAAS,CAAC,OAAO,CAAC,EAAE,gBAAgB;gBAAhD,IAAI,CAAC,EAAE,GAAG,EAAY,OAAO,CAAC,EAAE,gBAAgB;IAI/C,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ;CAMnE"}
@@ -3,18 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ServerError = void 0;
4
4
  const interfaces_js_1 = require("../interfaces.js");
5
5
  const responses_js_1 = require("../responses.js");
6
- const errorResponse_js_1 = require("./errorResponse.js");
6
+ const badRequest_js_1 = require("./badRequest.js");
7
7
  /**
8
8
  * Internall response function.
9
9
  * Returns HTTP 500 INTERNAL SERVER ERROR
10
10
  * @param err - error to send
11
11
  */
12
- class ServerError extends errorResponse_js_1.ErrorResponse {
13
- constructor(data) {
12
+ class ServerError extends badRequest_js_1.BadRequest {
13
+ constructor(data, options) {
14
14
  super(data);
15
+ this.options = options;
15
16
  }
16
17
  async execute(_req, _res) {
17
- return await (0, responses_js_1.httpResponse)({ error: this.responseData }, interfaces_js_1.HTTP_STATUS_CODE.INTERNAL_ERROR, 'serverError.pug');
18
+ return await (0, responses_js_1.httpResponse)({ error: this.responseData }, 'serverError.pug', {
19
+ ...this.options,
20
+ StatusCode: interfaces_js_1.HTTP_STATUS_CODE.INTERNAL_ERROR,
21
+ });
18
22
  }
19
23
  }
20
24
  exports.ServerError = ServerError;
@@ -1 +1 @@
1
- {"version":3,"file":"serverError.js","sourceRoot":"","sources":["../../../src/response-methods/serverError.ts"],"names":[],"mappings":";;;AACA,oDAAoD;AACpD,kDAA+C;AAC/C,yDAAmD;AAEnD;;;;GAIG;AAEH,MAAa,WAAY,SAAQ,gCAAa;IAC5C,YAAY,IAAS;QACnB,KAAK,CAAC,IAAI,CAAC,CAAC;IAEd,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAqB,EAAE,IAAsB;QAChE,OAAO,MAAM,IAAA,2BAAY,EAAC,EAAE,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,EAAE,gCAAgB,CAAC,cAAc,EAAE,iBAAiB,CAAC,CAAC;IAC9G,CAAC;CACF;AATD,kCASC"}
1
+ {"version":3,"file":"serverError.js","sourceRoot":"","sources":["../../../src/response-methods/serverError.ts"],"names":[],"mappings":";;;AACA,oDAAsE;AACtE,kDAA+C;AAC/C,mDAA6C;AAE7C;;;;GAIG;AAEH,MAAa,WAAY,SAAQ,0BAAU;IACzC,YAAY,IAAU,EAAY,OAA0B;QAC1D,KAAK,CAAC,IAAI,CAAC,CAAC;QADoB,YAAO,GAAP,OAAO,CAAmB;IAE5D,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAqB,EAAE,IAAsB;QAChE,OAAO,MAAM,IAAA,2BAAY,EAAC,EAAE,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,EAAE,iBAAiB,EAAE;YACzE,GAAG,IAAI,CAAC,OAAO;YACf,UAAU,EAAE,gCAAgB,CAAC,cAAc;SAC5C,CAAC,CAAC;IACL,CAAC;CACF;AAXD,kCAWC"}
@@ -1,16 +1,16 @@
1
1
  /// <reference types="qs" />
2
2
  import { fs } from '@spinajs/fs';
3
3
  import * as express from 'express';
4
- import { HTTP_STATUS_CODE, ITemplateResponseOptions, Response } from '../interfaces.js';
4
+ import { IResponseOptions, ITemplateResponseOptions, Response } from '../interfaces.js';
5
5
  /**
6
6
  * HTML resposne with HTML from pug file
7
7
  */
8
8
  export declare class TemplateResponse extends Response {
9
+ protected options?: IResponseOptions;
9
10
  protected file: string;
10
- protected status: HTTP_STATUS_CODE;
11
11
  protected fsTemplates: fs;
12
12
  protected templateFile: string | ITemplateResponseOptions;
13
- constructor(file: string | ITemplateResponseOptions, model: any, status?: HTTP_STATUS_CODE);
13
+ constructor(file: string | ITemplateResponseOptions, model: any, options?: IResponseOptions);
14
14
  execute(_req: express.Request, _res: express.Response): Promise<(req: express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: express.Response<any, Record<string, any>>) => void>;
15
15
  }
16
16
  //# sourceMappingURL=template.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../src/response-methods/template.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAGxF;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,QAAQ;IAC5C,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,MAAM,EAAE,gBAAgB,CAAQ;IAE1C,SAAS,CAAC,WAAW,EAAE,EAAE,CAAC;IAC1B,SAAS,CAAC,YAAY,EAAE,MAAM,GAAG,wBAAwB,CAAC;gBAE9C,IAAI,EAAE,MAAM,GAAG,wBAAwB,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,gBAAgB;IAW7E,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ;CAanE"}
1
+ {"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../../src/response-methods/template.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAEnC,OAAO,EAAoB,gBAAgB,EAAE,wBAAwB,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG1G;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,QAAQ;IAMqB,SAAS,CAAC,OAAO,CAAC,EAAG,gBAAgB;IALtG,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC;IAEvB,SAAS,CAAC,WAAW,EAAE,EAAE,CAAC;IAC1B,SAAS,CAAC,YAAY,EAAE,MAAM,GAAG,wBAAwB,CAAC;gBAE9C,IAAI,EAAE,MAAM,GAAG,wBAAwB,EAAE,KAAK,EAAE,GAAG,EAAY,OAAO,CAAC,EAAG,gBAAgB;IAUzF,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ;CAgBnE"}
@@ -13,14 +13,13 @@ const responses_js_1 = require("../responses.js");
13
13
  * HTML resposne with HTML from pug file
14
14
  */
15
15
  class TemplateResponse extends interfaces_js_1.Response {
16
- constructor(file, model, status) {
16
+ constructor(file, model, options) {
17
17
  super(model);
18
- this.status = null;
18
+ this.options = options;
19
19
  this.fsTemplates = lodash_1.default.isString(file)
20
20
  ? di_1.DI.resolve('__file_provider__', ['__fs_http_templates__'])
21
21
  : di_1.DI.resolve('__file_provider__', [file.provider]);
22
22
  this.templateFile = file;
23
- this.status = status;
24
23
  }
25
24
  async execute(_req, _res) {
26
25
  if (!this.fsTemplates) {
@@ -30,7 +29,10 @@ class TemplateResponse extends interfaces_js_1.Response {
30
29
  this.file = lodash_1.default.isString(this.templateFile)
31
30
  ? await this.fsTemplates.download(this.templateFile)
32
31
  : await this.fsTemplates.download(this.templateFile.template);
33
- return await (0, responses_js_1.htmlResponse)(this.file, this.responseData, this.status ? this.status : interfaces_js_1.HTTP_STATUS_CODE.OK);
32
+ return await (0, responses_js_1.htmlResponse)(this.file, this.responseData, {
33
+ ...this.options,
34
+ StatusCode: this.options.StatusCode ? this.options.StatusCode : interfaces_js_1.HTTP_STATUS_CODE.OK
35
+ });
34
36
  }
35
37
  }
36
38
  exports.TemplateResponse = TemplateResponse;
@@ -1 +1 @@
1
- {"version":3,"file":"template.js","sourceRoot":"","sources":["../../../src/response-methods/template.ts"],"names":[],"mappings":";;;;;;AAAA,oCAAiC;AACjC,oDAA6C;AAG7C,oDAAuB;AACvB,oDAAwF;AACxF,kDAA+C;AAE/C;;GAEG;AACH,MAAa,gBAAiB,SAAQ,wBAAQ;IAO5C,YAAY,IAAuC,EAAE,KAAU,EAAE,MAAyB;QACxF,KAAK,CAAC,KAAK,CAAC,CAAC;QANL,WAAM,GAAqB,IAAI,CAAC;QAQxC,IAAI,CAAC,WAAW,GAAG,gBAAC,CAAC,QAAQ,CAAC,IAAI,CAAC;YACjC,CAAC,CAAC,OAAE,CAAC,OAAO,CAAK,mBAAmB,EAAE,CAAC,uBAAuB,CAAC,CAAC;YAChE,CAAC,CAAC,OAAE,CAAC,OAAO,CAAK,mBAAmB,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;QAEzD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAqB,EAAE,IAAsB;QAEhE,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACrB,MAAM,QAAQ,GAAG,gBAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC;YACtG,MAAM,IAAI,mBAAM,CAAC,sCAAsC,QAAQ,kGAAkG,CAAC,CAAA;SACnK;QAED,IAAI,CAAC,IAAI,GAAG,gBAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC;YACvC,CAAC,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC;YACpD,CAAC,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QAEhE,OAAO,MAAM,IAAA,2BAAY,EAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,gCAAgB,CAAC,EAAE,CAAC,CAAC;IAC3G,CAAC;CACF;AA/BD,4CA+BC"}
1
+ {"version":3,"file":"template.js","sourceRoot":"","sources":["../../../src/response-methods/template.ts"],"names":[],"mappings":";;;;;;AAAA,oCAAiC;AACjC,oDAA6C;AAG7C,oDAAuB;AACvB,oDAA0G;AAC1G,kDAA+C;AAE/C;;GAEG;AACH,MAAa,gBAAiB,SAAQ,wBAAQ;IAM5C,YAAY,IAAuC,EAAE,KAAU,EAAY,OAA2B;QACpG,KAAK,CAAC,KAAK,CAAC,CAAC;QAD4D,YAAO,GAAP,OAAO,CAAoB;QAGpG,IAAI,CAAC,WAAW,GAAG,gBAAC,CAAC,QAAQ,CAAC,IAAI,CAAC;YACjC,CAAC,CAAC,OAAE,CAAC,OAAO,CAAK,mBAAmB,EAAE,CAAC,uBAAuB,CAAC,CAAC;YAChE,CAAC,CAAC,OAAE,CAAC,OAAO,CAAK,mBAAmB,EAAE,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC;QAEzD,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;IAC3B,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAqB,EAAE,IAAsB;QAEhE,IAAI,CAAC,IAAI,CAAC,WAAW,EAAE;YACrB,MAAM,QAAQ,GAAG,gBAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC;YACtG,MAAM,IAAI,mBAAM,CAAC,sCAAsC,QAAQ,kGAAkG,CAAC,CAAA;SACnK;QAED,IAAI,CAAC,IAAI,GAAG,gBAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC;YACvC,CAAC,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC;YACpD,CAAC,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC;QAEhE,OAAO,MAAM,IAAA,2BAAY,EAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE;YACtD,GAAG,IAAI,CAAC,OAAO;YACf,UAAU,EAAE,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,gCAAgB,CAAC,EAAE;SACpF,CAAC,CAAC;IACL,CAAC;CACF;AAhCD,4CAgCC"}
@@ -1,13 +1,15 @@
1
1
  /// <reference types="qs" />
2
2
  import * as express from 'express';
3
- import { ErrorResponse } from './errorResponse.js';
3
+ import { IResponseOptions } from '../interfaces.js';
4
+ import { BadRequest } from './badRequest.js';
4
5
  /**
5
6
  * Internall response function.
6
7
  * Returns HTTP 401 UNAHTORIZED response with json content
7
8
  * @param data - data to send
8
9
  */
9
- export declare class Unauthorized extends ErrorResponse {
10
- constructor(data: any);
10
+ export declare class Unauthorized extends BadRequest {
11
+ protected options?: IResponseOptions;
12
+ constructor(data?: any, options?: IResponseOptions);
11
13
  execute(_req: express.Request, _res: express.Response): Promise<(req: express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: express.Response<any, Record<string, any>>) => void>;
12
14
  }
13
15
  //# sourceMappingURL=unauthorized.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"unauthorized.d.ts","sourceRoot":"","sources":["../../../src/response-methods/unauthorized.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAGnC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;GAIG;AAEH,qBAAa,YAAa,SAAQ,aAAa;gBACjC,IAAI,EAAE,GAAG;IAIR,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ;CAGnE"}
1
+ {"version":3,"file":"unauthorized.d.ts","sourceRoot":"","sources":["../../../src/response-methods/unauthorized.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAoB,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;;GAIG;AAEH,qBAAa,YAAa,SAAQ,UAAU;IAClB,SAAS,CAAC,OAAO,CAAC,EAAE,gBAAgB;gBAAhD,IAAI,CAAC,EAAE,GAAG,EAAY,OAAO,CAAC,EAAE,gBAAgB;IAI/C,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ;CAMnE"}
@@ -3,18 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Unauthorized = void 0;
4
4
  const interfaces_js_1 = require("../interfaces.js");
5
5
  const responses_js_1 = require("../responses.js");
6
- const errorResponse_js_1 = require("./errorResponse.js");
6
+ const badRequest_js_1 = require("./badRequest.js");
7
7
  /**
8
8
  * Internall response function.
9
9
  * Returns HTTP 401 UNAHTORIZED response with json content
10
10
  * @param data - data to send
11
11
  */
12
- class Unauthorized extends errorResponse_js_1.ErrorResponse {
13
- constructor(data) {
12
+ class Unauthorized extends badRequest_js_1.BadRequest {
13
+ constructor(data, options) {
14
14
  super(data);
15
+ this.options = options;
15
16
  }
16
17
  async execute(_req, _res) {
17
- return await (0, responses_js_1.httpResponse)(this.responseData, interfaces_js_1.HTTP_STATUS_CODE.UNAUTHORIZED, 'responses/unauthorized');
18
+ return await (0, responses_js_1.httpResponse)(this.responseData, 'responses/unauthorized', {
19
+ ...this.options,
20
+ StatusCode: interfaces_js_1.HTTP_STATUS_CODE.UNAUTHORIZED,
21
+ });
18
22
  }
19
23
  }
20
24
  exports.Unauthorized = Unauthorized;
@@ -1 +1 @@
1
- {"version":3,"file":"unauthorized.js","sourceRoot":"","sources":["../../../src/response-methods/unauthorized.ts"],"names":[],"mappings":";;;AACA,oDAAoD;AACpD,kDAA+C;AAC/C,yDAAmD;AAEnD;;;;GAIG;AAEH,MAAa,YAAa,SAAQ,gCAAa;IAC7C,YAAY,IAAS;QACnB,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAqB,EAAE,IAAsB;QAChE,OAAO,MAAM,IAAA,2BAAY,EAAC,IAAI,CAAC,YAAY,EAAE,gCAAgB,CAAC,YAAY,EAAE,wBAAwB,CAAC,CAAC;IACxG,CAAC;CACF;AARD,oCAQC"}
1
+ {"version":3,"file":"unauthorized.js","sourceRoot":"","sources":["../../../src/response-methods/unauthorized.ts"],"names":[],"mappings":";;;AACA,oDAAsE;AACtE,kDAA+C;AAC/C,mDAA6C;AAE7C;;;;GAIG;AAEH,MAAa,YAAa,SAAQ,0BAAU;IAC1C,YAAY,IAAU,EAAY,OAA0B;QAC1D,KAAK,CAAC,IAAI,CAAC,CAAC;QADoB,YAAO,GAAP,OAAO,CAAmB;IAE5D,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAqB,EAAE,IAAsB;QAChE,OAAO,MAAM,IAAA,2BAAY,EAAC,IAAI,CAAC,YAAY,EAAE,wBAAwB,EAAE;YACrE,GAAG,IAAI,CAAC,OAAO;YACf,UAAU,EAAE,gCAAgB,CAAC,YAAY;SAC1C,CAAC,CAAC;IACL,CAAC;CACF;AAXD,oCAWC"}
@@ -1,13 +1,15 @@
1
1
  /// <reference types="qs" />
2
2
  import * as express from 'express';
3
- import { ErrorResponse } from './errorResponse.js';
3
+ import { IResponseOptions } from '../interfaces.js';
4
+ import { BadRequest } from './badRequest.js';
4
5
  /**
5
6
  * Internall response function.
6
7
  * Returns HTTP 400 BAD REQUEST ERROR
7
8
  * @param err - error to send
8
9
  */
9
- export declare class ValidationError extends ErrorResponse {
10
- constructor(data: any);
10
+ export declare class ValidationError extends BadRequest {
11
+ protected options?: IResponseOptions;
12
+ constructor(data?: any, options?: IResponseOptions);
11
13
  execute(_req: express.Request, _res: express.Response): Promise<(req: express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: express.Response<any, Record<string, any>>) => void>;
12
14
  }
13
15
  //# sourceMappingURL=validationError.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"validationError.d.ts","sourceRoot":"","sources":["../../../src/response-methods/validationError.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAGnC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAEnD;;;;GAIG;AAEH,qBAAa,eAAgB,SAAQ,aAAa;gBACpC,IAAI,EAAE,GAAG;IAIR,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ;CAGnE"}
1
+ {"version":3,"file":"validationError.d.ts","sourceRoot":"","sources":["../../../src/response-methods/validationError.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAoB,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEtE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAE7C;;;;GAIG;AAEH,qBAAa,eAAgB,SAAQ,UAAU;IACrB,SAAS,CAAC,OAAO,CAAC,EAAE,gBAAgB;gBAAhD,IAAI,CAAC,EAAE,GAAG,EAAY,OAAO,CAAC,EAAE,gBAAgB;IAI/C,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ;CAMnE"}
@@ -3,18 +3,22 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ValidationError = void 0;
4
4
  const interfaces_js_1 = require("../interfaces.js");
5
5
  const responses_js_1 = require("../responses.js");
6
- const errorResponse_js_1 = require("./errorResponse.js");
6
+ const badRequest_js_1 = require("./badRequest.js");
7
7
  /**
8
8
  * Internall response function.
9
9
  * Returns HTTP 400 BAD REQUEST ERROR
10
10
  * @param err - error to send
11
11
  */
12
- class ValidationError extends errorResponse_js_1.ErrorResponse {
13
- constructor(data) {
12
+ class ValidationError extends badRequest_js_1.BadRequest {
13
+ constructor(data, options) {
14
14
  super(data);
15
+ this.options = options;
15
16
  }
16
17
  async execute(_req, _res) {
17
- return await (0, responses_js_1.httpResponse)(this.responseData, interfaces_js_1.HTTP_STATUS_CODE.BAD_REQUEST, 'validationError.pug');
18
+ return await (0, responses_js_1.httpResponse)(this.responseData, 'validationError.pug', {
19
+ ...this.options,
20
+ StatusCode: interfaces_js_1.HTTP_STATUS_CODE.BAD_REQUEST,
21
+ });
18
22
  }
19
23
  }
20
24
  exports.ValidationError = ValidationError;
@@ -1 +1 @@
1
- {"version":3,"file":"validationError.js","sourceRoot":"","sources":["../../../src/response-methods/validationError.ts"],"names":[],"mappings":";;;AACA,oDAAoD;AACpD,kDAA+C;AAC/C,yDAAmD;AAEnD;;;;GAIG;AAEH,MAAa,eAAgB,SAAQ,gCAAa;IAChD,YAAY,IAAS;QACnB,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAqB,EAAE,IAAsB;QAChE,OAAO,MAAM,IAAA,2BAAY,EAAC,IAAI,CAAC,YAAY,EAAE,gCAAgB,CAAC,WAAW,EAAE,qBAAqB,CAAC,CAAC;IACpG,CAAC;CACF;AARD,0CAQC"}
1
+ {"version":3,"file":"validationError.js","sourceRoot":"","sources":["../../../src/response-methods/validationError.ts"],"names":[],"mappings":";;;AACA,oDAAsE;AACtE,kDAA+C;AAC/C,mDAA6C;AAE7C;;;;GAIG;AAEH,MAAa,eAAgB,SAAQ,0BAAU;IAC7C,YAAY,IAAU,EAAY,OAA0B;QAC1D,KAAK,CAAC,IAAI,CAAC,CAAC;QADoB,YAAO,GAAP,OAAO,CAAmB;IAE5D,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAqB,EAAE,IAAsB;QAChE,OAAO,MAAM,IAAA,2BAAY,EAAC,IAAI,CAAC,YAAY,EAAE,qBAAqB,EAAE;YAClE,GAAG,IAAI,CAAC,OAAO;YACf,UAAU,EAAE,gCAAgB,CAAC,WAAW;SACzC,CAAC,CAAC;IACL,CAAC;CACF;AAXD,0CAWC"}
@@ -1,19 +1,21 @@
1
1
  import * as express from 'express';
2
- import { HTTP_STATUS_CODE } from './interfaces.js';
2
+ import { IResponseOptions } from './interfaces.js';
3
+ export declare function _setCoockies(res: express.Response, options?: IResponseOptions): void;
4
+ export declare function _setHeaders(res: express.Response, options?: IResponseOptions): void;
3
5
  /**
4
6
  * Sends data & sets proper header as json
5
7
  *
6
8
  * @param model - data to send
7
9
  * @param status - status code
8
10
  */
9
- export declare function jsonResponse(model: any, status?: HTTP_STATUS_CODE): (_req: express.Request, res: express.Response) => void;
11
+ export declare function jsonResponse(model: any, options?: IResponseOptions): (_req: express.Request, res: express.Response) => void;
10
12
  /**
11
13
  * Sends data & sets proper header as json
12
14
  *
13
15
  * @param model - data to send
14
16
  * @param status - status code
15
17
  */
16
- export declare function textResponse(model: any, status?: HTTP_STATUS_CODE): (_req: express.Request, res: express.Response) => void;
18
+ export declare function textResponse(model: any, options?: IResponseOptions): (_req: express.Request, res: express.Response) => void;
17
19
  /**
18
20
  * Sends html response & sets proper header. If template is not avaible, handles proper error rendering.
19
21
  *
@@ -21,7 +23,7 @@ export declare function textResponse(model: any, status?: HTTP_STATUS_CODE): (_r
21
23
  * @param model - data passed to template
22
24
  * @param status - optional status code
23
25
  */
24
- export declare function htmlResponse(file: string, model: any, status?: HTTP_STATUS_CODE): (req: express.Request, res: express.Response) => void;
26
+ export declare function htmlResponse(file: string, model: any, options?: IResponseOptions): (req: express.Request, res: express.Response) => void;
25
27
  /**
26
28
  * Default response handling. Checks `Accept` header & matches proper response
27
29
  * For now its supports html & json responses
@@ -31,5 +33,5 @@ export declare function htmlResponse(file: string, model: any, status?: HTTP_STA
31
33
  * @param template - template to render without extension eg. `views/responses/ok`. It will try to match .pug, .xml or whatever to match response
32
34
  * to `Accept` header
33
35
  */
34
- export declare function httpResponse(model: any, code: HTTP_STATUS_CODE, template: string): (req: express.Request, res: express.Response) => void;
36
+ export declare function httpResponse(model: any, template: string, options?: IResponseOptions): (req: express.Request, res: express.Response) => void;
35
37
  //# sourceMappingURL=responses.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../src/responses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAsC,MAAM,iBAAiB,CAAC;AAWvF;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,gBAAgB,UAClD,eAAe,OAAO,gBAAgB,UASrD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,gBAAgB,UAClD,eAAe,OAAO,gBAAgB,UAQrD;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,gBAAgB,SAGjE,eAAe,OAAO,gBAAgB,UAoDpD;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,SAKlE,eAAe,OAAO,gBAAgB,UA4CpD"}
1
+ {"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../../src/responses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAwD,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAYzG,wBAAgB,YAAY,CAAC,GAAG,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,gBAAgB,QAmB7E;AAED,wBAAgB,WAAW,CAAC,GAAG,EAAE,OAAO,CAAC,QAAQ,EAAE,OAAO,CAAC,EAAE,gBAAgB,QAI5E;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,gBAAgB,UACnD,eAAe,OAAO,gBAAgB,UAYrD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,gBAAgB,UACnD,eAAe,OAAO,gBAAgB,UAWrD;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,gBAAgB,SAGlE,eAAe,OAAO,gBAAgB,UA0DpD;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,gBAAgB,SAKtE,eAAe,OAAO,gBAAgB,UAsDpD"}