@arkyn/server 3.0.1-beta.99 → 3.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (265) hide show
  1. package/LICENSE.txt +184 -1
  2. package/README.md +277 -224
  3. package/dist/http/api/_deleteRequest.d.ts +17 -0
  4. package/dist/http/api/_deleteRequest.d.ts.map +1 -0
  5. package/dist/http/api/_getRequest.d.ts +16 -0
  6. package/dist/http/api/_getRequest.d.ts.map +1 -0
  7. package/dist/http/api/_logMapperService.d.ts +86 -0
  8. package/dist/http/api/_logMapperService.d.ts.map +1 -0
  9. package/dist/{api/arkynLogRequest.d.ts → http/api/_logRequest.d.ts} +22 -19
  10. package/dist/{api/arkynLogRequest.d.ts.map → http/api/_logRequest.d.ts.map} +1 -1
  11. package/dist/http/api/_makeRequest.d.ts +61 -0
  12. package/dist/http/api/_makeRequest.d.ts.map +1 -0
  13. package/dist/http/api/_patchRequest.d.ts +17 -0
  14. package/dist/http/api/_patchRequest.d.ts.map +1 -0
  15. package/dist/http/api/_postRequest.d.ts +17 -0
  16. package/dist/http/api/_postRequest.d.ts.map +1 -0
  17. package/dist/http/api/_putRequest.d.ts +17 -0
  18. package/dist/http/api/_putRequest.d.ts.map +1 -0
  19. package/dist/http/badResponses/_badResponse.d.ts +21 -7
  20. package/dist/http/badResponses/_badResponse.d.ts.map +1 -1
  21. package/dist/http/badResponses/badGateway.d.ts +12 -23
  22. package/dist/http/badResponses/badGateway.d.ts.map +1 -1
  23. package/dist/http/badResponses/badRequest.d.ts +10 -23
  24. package/dist/http/badResponses/badRequest.d.ts.map +1 -1
  25. package/dist/http/badResponses/conflict.d.ts +10 -23
  26. package/dist/http/badResponses/conflict.d.ts.map +1 -1
  27. package/dist/http/badResponses/forbidden.d.ts +10 -23
  28. package/dist/http/badResponses/forbidden.d.ts.map +1 -1
  29. package/dist/http/badResponses/notFound.d.ts +10 -23
  30. package/dist/http/badResponses/notFound.d.ts.map +1 -1
  31. package/dist/http/badResponses/notImplemented.d.ts +10 -23
  32. package/dist/http/badResponses/notImplemented.d.ts.map +1 -1
  33. package/dist/http/badResponses/serverError.d.ts +10 -23
  34. package/dist/http/badResponses/serverError.d.ts.map +1 -1
  35. package/dist/http/badResponses/unauthorized.d.ts +10 -23
  36. package/dist/http/badResponses/unauthorized.d.ts.map +1 -1
  37. package/dist/http/badResponses/unprocessableEntity.d.ts +23 -33
  38. package/dist/http/badResponses/unprocessableEntity.d.ts.map +1 -1
  39. package/dist/http/successResponses/_successResponse.d.ts +21 -7
  40. package/dist/http/successResponses/_successResponse.d.ts.map +1 -1
  41. package/dist/http/successResponses/created.d.ts +11 -29
  42. package/dist/http/successResponses/created.d.ts.map +1 -1
  43. package/dist/http/successResponses/found.d.ts +11 -32
  44. package/dist/http/successResponses/found.d.ts.map +1 -1
  45. package/dist/http/successResponses/noContent.d.ts +10 -16
  46. package/dist/http/successResponses/noContent.d.ts.map +1 -1
  47. package/dist/http/successResponses/success.d.ts +11 -29
  48. package/dist/http/successResponses/success.d.ts.map +1 -1
  49. package/dist/http/successResponses/updated.d.ts +12 -29
  50. package/dist/http/successResponses/updated.d.ts.map +1 -1
  51. package/dist/index.d.ts +9 -10
  52. package/dist/index.d.ts.map +1 -1
  53. package/dist/index.js +1069 -38
  54. package/dist/index.js.map +1 -0
  55. package/dist/modules/http/api/_deleteRequest.js +15 -0
  56. package/dist/modules/http/api/_deleteRequest.js.map +1 -0
  57. package/dist/modules/http/api/_getRequest.js +14 -0
  58. package/dist/modules/http/api/_getRequest.js.map +1 -0
  59. package/dist/modules/http/api/_logMapperService.js +33 -0
  60. package/dist/modules/http/api/_logMapperService.js.map +1 -0
  61. package/dist/modules/http/api/_logRequest.js +58 -0
  62. package/dist/modules/http/api/_logRequest.js.map +1 -0
  63. package/dist/modules/http/api/_makeRequest.js +72 -0
  64. package/dist/modules/http/api/_makeRequest.js.map +1 -0
  65. package/dist/modules/http/api/_patchRequest.js +15 -0
  66. package/dist/modules/http/api/_patchRequest.js.map +1 -0
  67. package/dist/modules/http/api/_postRequest.js +15 -0
  68. package/dist/modules/http/api/_postRequest.js.map +1 -0
  69. package/dist/modules/http/api/_putRequest.js +15 -0
  70. package/dist/modules/http/api/_putRequest.js.map +1 -0
  71. package/dist/modules/http/badResponses/_badResponse.js +65 -0
  72. package/dist/modules/http/badResponses/_badResponse.js.map +1 -0
  73. package/dist/modules/http/badResponses/badGateway.js +26 -0
  74. package/dist/modules/http/badResponses/badGateway.js.map +1 -0
  75. package/dist/modules/http/badResponses/badRequest.js +26 -0
  76. package/dist/modules/http/badResponses/badRequest.js.map +1 -0
  77. package/dist/modules/http/badResponses/conflict.js +26 -0
  78. package/dist/modules/http/badResponses/conflict.js.map +1 -0
  79. package/dist/modules/http/badResponses/forbidden.js +26 -0
  80. package/dist/modules/http/badResponses/forbidden.js.map +1 -0
  81. package/dist/modules/http/badResponses/notFound.js +26 -0
  82. package/dist/modules/http/badResponses/notFound.js.map +1 -0
  83. package/dist/modules/http/badResponses/notImplemented.js +26 -0
  84. package/dist/modules/http/badResponses/notImplemented.js.map +1 -0
  85. package/dist/modules/http/badResponses/serverError.js +26 -0
  86. package/dist/modules/http/badResponses/serverError.js.map +1 -0
  87. package/dist/modules/http/badResponses/unauthorized.js +26 -0
  88. package/dist/modules/http/badResponses/unauthorized.js.map +1 -0
  89. package/dist/modules/http/badResponses/unprocessableEntity.js +30 -0
  90. package/dist/modules/http/badResponses/unprocessableEntity.js.map +1 -0
  91. package/dist/modules/http/successResponses/_successResponse.js +64 -0
  92. package/dist/modules/http/successResponses/_successResponse.js.map +1 -0
  93. package/dist/modules/http/successResponses/created.js +26 -0
  94. package/dist/modules/http/successResponses/created.js.map +1 -0
  95. package/dist/modules/http/successResponses/found.js +26 -0
  96. package/dist/modules/http/successResponses/found.js.map +1 -0
  97. package/dist/modules/http/successResponses/noContent.js +19 -0
  98. package/dist/modules/http/successResponses/noContent.js.map +1 -0
  99. package/dist/modules/http/successResponses/success.js +26 -0
  100. package/dist/modules/http/successResponses/success.js.map +1 -0
  101. package/dist/modules/http/successResponses/updated.js +26 -0
  102. package/dist/modules/http/successResponses/updated.js.map +1 -0
  103. package/dist/modules/services/apiService.js +111 -0
  104. package/dist/modules/services/apiService.js.map +1 -0
  105. package/dist/modules/services/debugService.js +38 -0
  106. package/dist/modules/services/debugService.js.map +1 -0
  107. package/dist/modules/services/logService.js +23 -0
  108. package/dist/modules/services/logService.js.map +1 -0
  109. package/dist/modules/utilities/decodeRequestBody.js +22 -0
  110. package/dist/modules/utilities/decodeRequestBody.js.map +1 -0
  111. package/dist/modules/utilities/decodeRequestErrorMessage.js +8 -0
  112. package/dist/modules/utilities/decodeRequestErrorMessage.js.map +1 -0
  113. package/dist/modules/utilities/errorHandler.js +41 -0
  114. package/dist/modules/utilities/errorHandler.js.map +1 -0
  115. package/dist/modules/utilities/flushDebugLogs.js +18 -0
  116. package/dist/modules/utilities/flushDebugLogs.js.map +1 -0
  117. package/dist/modules/utilities/formAsyncParse.js +16 -0
  118. package/dist/modules/utilities/formAsyncParse.js.map +1 -0
  119. package/dist/modules/utilities/formParse.js +16 -0
  120. package/dist/modules/utilities/formParse.js.map +1 -0
  121. package/dist/modules/utilities/getScopedParams.js +11 -0
  122. package/dist/modules/utilities/getScopedParams.js.map +1 -0
  123. package/dist/modules/utilities/schemaValidator.js +57 -0
  124. package/dist/modules/utilities/schemaValidator.js.map +1 -0
  125. package/dist/modules/validations/validateCep.js +11 -0
  126. package/dist/modules/validations/validateCep.js.map +1 -0
  127. package/dist/modules/validations/validateCnpj.js +56 -0
  128. package/dist/modules/validations/validateCnpj.js.map +1 -0
  129. package/dist/modules/validations/validateCpf.js +29 -0
  130. package/dist/modules/validations/validateCpf.js.map +1 -0
  131. package/dist/modules/validations/validateDate.js +28 -0
  132. package/dist/modules/validations/validateDate.js.map +1 -0
  133. package/dist/modules/validations/validateEmail.js +56 -0
  134. package/dist/modules/validations/validateEmail.js.map +1 -0
  135. package/dist/modules/validations/validatePassword.js +14 -0
  136. package/dist/modules/validations/validatePassword.js.map +1 -0
  137. package/dist/modules/validations/validatePhone.js +12 -0
  138. package/dist/modules/validations/validatePhone.js.map +1 -0
  139. package/dist/modules/validations/validateRg.js +10 -0
  140. package/dist/modules/validations/validateRg.js.map +1 -0
  141. package/dist/services/apiService.d.ts +25 -26
  142. package/dist/services/apiService.d.ts.map +1 -1
  143. package/dist/services/debugService.d.ts +15 -32
  144. package/dist/services/debugService.d.ts.map +1 -1
  145. package/dist/services/logService.d.ts +33 -0
  146. package/dist/services/logService.d.ts.map +1 -0
  147. package/dist/utilities/decodeRequestBody.d.ts +18 -0
  148. package/dist/utilities/decodeRequestBody.d.ts.map +1 -0
  149. package/dist/utilities/decodeRequestErrorMessage.d.ts +19 -0
  150. package/dist/utilities/decodeRequestErrorMessage.d.ts.map +1 -0
  151. package/dist/utilities/errorHandler.d.ts +25 -0
  152. package/dist/utilities/errorHandler.d.ts.map +1 -0
  153. package/dist/utilities/flushDebugLogs.d.ts +24 -0
  154. package/dist/utilities/flushDebugLogs.d.ts.map +1 -0
  155. package/dist/utilities/formAsyncParse.d.ts +38 -0
  156. package/dist/utilities/formAsyncParse.d.ts.map +1 -0
  157. package/dist/utilities/formParse.d.ts +38 -0
  158. package/dist/utilities/formParse.d.ts.map +1 -0
  159. package/dist/utilities/getScopedParams.d.ts +19 -0
  160. package/dist/utilities/getScopedParams.d.ts.map +1 -0
  161. package/dist/utilities/schemaValidator.d.ts +75 -0
  162. package/dist/utilities/schemaValidator.d.ts.map +1 -0
  163. package/dist/validations/validateCep.d.ts +6 -11
  164. package/dist/validations/validateCep.d.ts.map +1 -1
  165. package/dist/validations/validateCnpj.d.ts +2 -3
  166. package/dist/validations/validateCnpj.d.ts.map +1 -1
  167. package/dist/validations/validateCpf.d.ts +4 -12
  168. package/dist/validations/validateCpf.d.ts.map +1 -1
  169. package/dist/validations/validateDate.d.ts +13 -24
  170. package/dist/validations/validateDate.d.ts.map +1 -1
  171. package/dist/validations/validateEmail.d.ts +3 -4
  172. package/dist/validations/validateEmail.d.ts.map +1 -1
  173. package/dist/validations/validatePassword.d.ts +3 -4
  174. package/dist/validations/validatePassword.d.ts.map +1 -1
  175. package/dist/validations/validatePhone.d.ts +7 -20
  176. package/dist/validations/validatePhone.d.ts.map +1 -1
  177. package/dist/validations/validateRg.d.ts +1 -2
  178. package/dist/validations/validateRg.d.ts.map +1 -1
  179. package/package.json +317 -15
  180. package/dist/api/arkynLogRequest.js +0 -88
  181. package/dist/api/deleteRequest.d.ts +0 -13
  182. package/dist/api/deleteRequest.d.ts.map +0 -1
  183. package/dist/api/deleteRequest.js +0 -14
  184. package/dist/api/getRequest.d.ts +0 -12
  185. package/dist/api/getRequest.d.ts.map +0 -1
  186. package/dist/api/getRequest.js +0 -13
  187. package/dist/api/makeRequest.d.ts +0 -38
  188. package/dist/api/makeRequest.d.ts.map +0 -1
  189. package/dist/api/makeRequest.js +0 -107
  190. package/dist/api/patchRequest.d.ts +0 -13
  191. package/dist/api/patchRequest.d.ts.map +0 -1
  192. package/dist/api/patchRequest.js +0 -14
  193. package/dist/api/postRequest.d.ts +0 -13
  194. package/dist/api/postRequest.d.ts.map +0 -1
  195. package/dist/api/postRequest.js +0 -14
  196. package/dist/api/putRequest.d.ts +0 -13
  197. package/dist/api/putRequest.d.ts.map +0 -1
  198. package/dist/api/putRequest.js +0 -14
  199. package/dist/bundle.js +0 -1507
  200. package/dist/bundle.umd.cjs +0 -10
  201. package/dist/http/badResponses/_badResponse.js +0 -20
  202. package/dist/http/badResponses/badGateway.js +0 -58
  203. package/dist/http/badResponses/badRequest.js +0 -58
  204. package/dist/http/badResponses/conflict.js +0 -58
  205. package/dist/http/badResponses/forbidden.js +0 -58
  206. package/dist/http/badResponses/notFound.js +0 -58
  207. package/dist/http/badResponses/notImplemented.js +0 -58
  208. package/dist/http/badResponses/serverError.js +0 -58
  209. package/dist/http/badResponses/unauthorized.js +0 -58
  210. package/dist/http/badResponses/unprocessableEntity.js +0 -65
  211. package/dist/http/successResponses/_successResponse.js +0 -37
  212. package/dist/http/successResponses/created.js +0 -57
  213. package/dist/http/successResponses/found.js +0 -60
  214. package/dist/http/successResponses/noContent.js +0 -38
  215. package/dist/http/successResponses/success.js +0 -57
  216. package/dist/http/successResponses/updated.js +0 -57
  217. package/dist/mapper/arkynLogRequestMapper.d.ts +0 -30
  218. package/dist/mapper/arkynLogRequestMapper.d.ts.map +0 -1
  219. package/dist/mapper/arkynLogRequestMapper.js +0 -44
  220. package/dist/services/apiService.js +0 -133
  221. package/dist/services/arkynLogService.d.ts +0 -44
  222. package/dist/services/arkynLogService.d.ts.map +0 -1
  223. package/dist/services/arkynLogService.js +0 -46
  224. package/dist/services/debugService.js +0 -57
  225. package/dist/services/decodeErrorMessageFromRequest.d.ts +0 -17
  226. package/dist/services/decodeErrorMessageFromRequest.d.ts.map +0 -1
  227. package/dist/services/decodeErrorMessageFromRequest.js +0 -30
  228. package/dist/services/decodeRequestBody.d.ts +0 -17
  229. package/dist/services/decodeRequestBody.d.ts.map +0 -1
  230. package/dist/services/decodeRequestBody.js +0 -38
  231. package/dist/services/errorHandler.d.ts +0 -44
  232. package/dist/services/errorHandler.d.ts.map +0 -1
  233. package/dist/services/errorHandler.js +0 -93
  234. package/dist/services/flushDebugLogs.d.ts +0 -8
  235. package/dist/services/flushDebugLogs.d.ts.map +0 -1
  236. package/dist/services/flushDebugLogs.js +0 -20
  237. package/dist/services/formAsyncParse.d.ts +0 -59
  238. package/dist/services/formAsyncParse.d.ts.map +0 -1
  239. package/dist/services/formAsyncParse.js +0 -58
  240. package/dist/services/formParse.d.ts +0 -59
  241. package/dist/services/formParse.d.ts.map +0 -1
  242. package/dist/services/formParse.js +0 -58
  243. package/dist/services/getCaller.d.ts +0 -17
  244. package/dist/services/getCaller.d.ts.map +0 -1
  245. package/dist/services/getCaller.js +0 -60
  246. package/dist/services/getScopedParams.d.ts +0 -28
  247. package/dist/services/getScopedParams.d.ts.map +0 -1
  248. package/dist/services/getScopedParams.js +0 -34
  249. package/dist/services/measureRouteExecution.d.ts +0 -3
  250. package/dist/services/measureRouteExecution.d.ts.map +0 -1
  251. package/dist/services/measureRouteExecution.js +0 -24
  252. package/dist/services/schemaValidator.d.ts +0 -158
  253. package/dist/services/schemaValidator.d.ts.map +0 -1
  254. package/dist/services/schemaValidator.js +0 -207
  255. package/dist/types/ApiResponseDTO.d.ts +0 -17
  256. package/dist/types/ApiResponseDTO.d.ts.map +0 -1
  257. package/dist/types/ApiResponseDTO.js +0 -1
  258. package/dist/validations/validateCep.js +0 -33
  259. package/dist/validations/validateCnpj.js +0 -52
  260. package/dist/validations/validateCpf.js +0 -54
  261. package/dist/validations/validateDate.js +0 -73
  262. package/dist/validations/validateEmail.js +0 -123
  263. package/dist/validations/validatePassword.js +0 -34
  264. package/dist/validations/validatePhone.js +0 -44
  265. package/dist/validations/validateRg.js +0 -31
@@ -1 +1 @@
1
- {"version":3,"file":"notFound.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/notFound.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;GAIG;AAEH,cAAM,QAAS,SAAQ,WAAW;IAChC,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,MAAM,EAAE,MAAM,CAAO;IACrB,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;gBAES,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;IAexC;;;;;OAKG;IAEH,UAAU,IAAI,QAAQ;IAUtB;;;;;OAKG;IAEH,MAAM,IAAI,QAAQ;CAQnB;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
1
+ {"version":3,"file":"notFound.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/notFound.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;;;;GAOG;AACH,cAAM,QAAS,SAAQ,WAAW;IACjC;;;OAGG;gBAES,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;IAWxC,6EAA6E;IAC7E,UAAU,IAAI,QAAQ;IAUtB,uFAAuF;IACvF,MAAM,IAAI,QAAQ;CAQlB;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
@@ -1,34 +1,21 @@
1
1
  import { BadResponse } from "./_badResponse";
2
2
  /**
3
- * Represents an HTTP error response with a status code of 501 (Not Implemented).
4
- * This class is used to standardize the structure of a "Not Implemented" error response,
5
- * including the response body, headers, status, and status text.
3
+ * HTTP 501 Not Implemented the server does not support the functionality required to fulfill the request.
4
+ *
5
+ * @example
6
+ * ```typescript
7
+ * throw new NotImplemented("Webhook delivery is not yet implemented");
8
+ * ```
6
9
  */
7
10
  declare class NotImplemented extends BadResponse {
8
- body: any;
9
- cause?: any;
10
- status: number;
11
- statusText: string;
12
11
  /**
13
- * Creates an instance of the `NotImplemented` class.
14
- *
15
- * @param message - A descriptive message explaining why the functionality is not implemented.
16
- * @param cause - Optional additional information about the cause of the error.
12
+ * @param message - Error description.
13
+ * @param cause - Optional extra context (serialized to JSON).
17
14
  */
18
15
  constructor(message: string, cause?: any);
19
- /**
20
- * Converts the `NotImplemented` instance into a `Response` object with a JSON body.
21
- * This method ensures the response has the appropriate headers, status, and status text.
22
- *
23
- * @returns A `Response` object with the serialized JSON body and response metadata.
24
- */
16
+ /** Converts to a `Response` with `Content-Type: application/json` header. */
25
17
  toResponse(): Response;
26
- /**
27
- * Converts the `NotImplemented` instance into a `Response` object using the `Response.json` method.
28
- * This method is an alternative to `toResponse` for generating JSON error responses.
29
- *
30
- * @returns A `Response` object with the JSON body and response metadata.
31
- */
18
+ /** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */
32
19
  toJson(): Response;
33
20
  }
34
21
  export { NotImplemented };
@@ -1 +1 @@
1
- {"version":3,"file":"notImplemented.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/notImplemented.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;GAIG;AAEH,cAAM,cAAe,SAAQ,WAAW;IACtC,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,MAAM,EAAE,MAAM,CAAO;IACrB,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;gBAES,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;IAexC;;;;;OAKG;IAEH,UAAU,IAAI,QAAQ;IAUtB;;;;;OAKG;IAEH,MAAM,IAAI,QAAQ;CAQnB;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
1
+ {"version":3,"file":"notImplemented.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/notImplemented.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;;;;GAOG;AACH,cAAM,cAAe,SAAQ,WAAW;IACvC;;;OAGG;gBAES,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;IAWxC,6EAA6E;IAC7E,UAAU,IAAI,QAAQ;IAUtB,uFAAuF;IACvF,MAAM,IAAI,QAAQ;CAQlB;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
@@ -1,34 +1,21 @@
1
1
  import { BadResponse } from "./_badResponse";
2
2
  /**
3
- * Represents an HTTP error response with a status code of 500 (Internal Server Error).
4
- * This class is used to standardize the structure of a "Server Error" response,
5
- * including the response body, headers, status, and status text.
3
+ * HTTP 500 Internal Server Error an unexpected condition prevented the server from fulfilling the request.
4
+ *
5
+ * @example
6
+ * ```typescript
7
+ * throw new ServerError("Failed to connect to the database");
8
+ * ```
6
9
  */
7
10
  declare class ServerError extends BadResponse {
8
- body: any;
9
- cause?: any;
10
- status: number;
11
- statusText: string;
12
11
  /**
13
- * Creates an instance of the `ServerError` class.
14
- *
15
- * @param message - A descriptive message explaining the cause of the server error.
16
- * @param cause - Optional additional information about the cause of the error.
12
+ * @param message - Error description.
13
+ * @param cause - Optional extra context (serialized to JSON).
17
14
  */
18
15
  constructor(message: string, cause?: any);
19
- /**
20
- * Converts the `ServerError` instance into a `Response` object with a JSON body.
21
- * This method ensures the response has the appropriate headers, status, and status text.
22
- *
23
- * @returns A `Response` object with the serialized JSON body and response metadata.
24
- */
16
+ /** Converts to a `Response` with `Content-Type: application/json` header. */
25
17
  toResponse(): Response;
26
- /**
27
- * Converts the `ServerError` instance into a `Response` object using the `Response.json` method.
28
- * This method is an alternative to `toResponse` for generating JSON error responses.
29
- *
30
- * @returns A `Response` object with the JSON body and response metadata.
31
- */
18
+ /** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */
32
19
  toJson(): Response;
33
20
  }
34
21
  export { ServerError };
@@ -1 +1 @@
1
- {"version":3,"file":"serverError.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/serverError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;GAIG;AAEH,cAAM,WAAY,SAAQ,WAAW;IACnC,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,MAAM,EAAE,MAAM,CAAO;IACrB,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;gBAES,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;IAexC;;;;;OAKG;IAEH,UAAU,IAAI,QAAQ;IAUtB;;;;;OAKG;IAEH,MAAM,IAAI,QAAQ;CAQnB;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
1
+ {"version":3,"file":"serverError.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/serverError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;;;;GAOG;AACH,cAAM,WAAY,SAAQ,WAAW;IACpC;;;OAGG;gBAES,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;IAWxC,6EAA6E;IAC7E,UAAU,IAAI,QAAQ;IAUtB,uFAAuF;IACvF,MAAM,IAAI,QAAQ;CAQlB;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -1,34 +1,21 @@
1
1
  import { BadResponse } from "./_badResponse";
2
2
  /**
3
- * Represents an HTTP error response with a status code of 401 (Unauthorized).
4
- * This class is used to standardize the structure of an "Unauthorized" error response,
5
- * including the response body, headers, status, and status text.
3
+ * HTTP 401 Unauthorized the request lacks valid authentication credentials.
4
+ *
5
+ * @example
6
+ * ```typescript
7
+ * throw new Unauthorized("Invalid or expired token");
8
+ * ```
6
9
  */
7
10
  declare class Unauthorized extends BadResponse {
8
- body: any;
9
- cause?: any;
10
- status: number;
11
- statusText: string;
12
11
  /**
13
- * Creates an instance of the `Unauthorized` class.
14
- *
15
- * @param message - A descriptive message explaining why the request is unauthorized.
16
- * @param cause - Optional additional information about the cause of the error.
12
+ * @param message - Error description.
13
+ * @param cause - Optional extra context (serialized to JSON).
17
14
  */
18
15
  constructor(message: string, cause?: any);
19
- /**
20
- * Converts the `Unauthorized` instance into a `Response` object with a JSON body.
21
- * This method ensures the response has the appropriate headers, status, and status text.
22
- *
23
- * @returns A `Response` object with the serialized JSON body and response metadata.
24
- */
16
+ /** Converts to a `Response` with `Content-Type: application/json` header. */
25
17
  toResponse(): Response;
26
- /**
27
- * Converts the `Unauthorized` instance into a `Response` object using the `Response.json` method.
28
- * This method is an alternative to `toResponse` for generating JSON error responses.
29
- *
30
- * @returns A `Response` object with the JSON body and response metadata.
31
- */
18
+ /** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */
32
19
  toJson(): Response;
33
20
  }
34
21
  export { Unauthorized };
@@ -1 +1 @@
1
- {"version":3,"file":"unauthorized.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/unauthorized.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;GAIG;AAEH,cAAM,YAAa,SAAQ,WAAW;IACpC,IAAI,EAAE,GAAG,CAAC;IACV,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,MAAM,EAAE,MAAM,CAAO;IACrB,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;gBAES,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;IAexC;;;;;OAKG;IAEH,UAAU,IAAI,QAAQ;IAUtB;;;;;OAKG;IAEH,MAAM,IAAI,QAAQ;CAQnB;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
1
+ {"version":3,"file":"unauthorized.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/unauthorized.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;;;;GAOG;AACH,cAAM,YAAa,SAAQ,WAAW;IACrC;;;OAGG;gBAES,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;IAYxC,6EAA6E;IAC7E,UAAU,IAAI,QAAQ;IAUtB,uFAAuF;IACvF,MAAM,IAAI,QAAQ;CAQlB;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -1,43 +1,33 @@
1
1
  import { BadResponse } from "./_badResponse";
2
- type UnprocessableEntityProps = {
3
- data?: any;
4
- fieldErrors?: Record<string, string>;
5
- fields?: Record<string, string>;
6
- message?: string;
7
- };
8
2
  /**
9
- * Represents an HTTP error response with a status code of 422 (Unprocessable Entity).
10
- * This class is used to standardize the structure of an "Unprocessable Entity" error response,
11
- * including the response body, headers, status, and status text.
3
+ * HTTP 422 Unprocessable Entity the request is well-formed but contains semantic validation errors.
4
+ * Typically used for form field validation failures.
5
+ *
6
+ * @example
7
+ * ```typescript
8
+ * throw new UnprocessableEntity({
9
+ * message: "Validation failed",
10
+ * fieldErrors: { email: "Invalid email format", age: "Must be 18 or older" },
11
+ * fields: { email: "not-an-email", age: "15" },
12
+ * });
13
+ * ```
12
14
  */
13
15
  declare class UnprocessableEntity extends BadResponse {
14
- body: any;
15
- status: number;
16
- statusText: string;
17
16
  /**
18
- * Creates an instance of the `UnprocessableEntity` class.
19
- *
20
- * @param props - An object containing details about the error, such as:
21
- * - `data`: Additional data related to the error.
22
- * - `fieldErrors`: A record of field-specific error messages.
23
- * - `fields`: A record of field values that caused the error.
24
- * - `message`: A descriptive message explaining the error.
25
- * @param enableDebug - A boolean indicating whether to enable debug logging for this error.
26
- */
27
- constructor(props: UnprocessableEntityProps);
28
- /**
29
- * Converts the `UnprocessableEntity` instance into a `Response` object with a JSON body.
30
- * This method ensures the response has the appropriate headers, status, and status text.
31
- *
32
- * @returns A `Response` object with the serialized JSON body and response metadata.
17
+ * @param props.message - Human-readable description of the error.
18
+ * @param props.fieldErrors - Per-field validation messages keyed by field name.
19
+ * @param props.fields - Original submitted field values (useful for repopulating forms).
20
+ * @param props.data - Any extra data to include in the response body.
33
21
  */
22
+ constructor(props: {
23
+ data?: any;
24
+ fieldErrors?: Record<string, string>;
25
+ fields?: Record<string, string>;
26
+ message?: string;
27
+ });
28
+ /** Converts to a `Response` with `Content-Type: application/json` header. */
34
29
  toResponse(): Response;
35
- /**
36
- * Converts the `UnprocessableEntity` instance into a `Response` object using the `Response.json` method.
37
- * This method is an alternative to `toResponse` for generating JSON error responses.
38
- *
39
- * @returns A `Response` object with the JSON body and response metadata.
40
- */
30
+ /** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */
41
31
  toJson(): Response;
42
32
  }
43
33
  export { UnprocessableEntity };
@@ -1 +1 @@
1
- {"version":3,"file":"unprocessableEntity.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/unprocessableEntity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,KAAK,wBAAwB,GAAG;IAC9B,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACrC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;GAIG;AAEH,cAAM,mBAAoB,SAAQ,WAAW;IAC3C,IAAI,EAAE,GAAG,CAAC;IACV,MAAM,EAAE,MAAM,CAAO;IACrB,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;;;;;OASG;gBAES,KAAK,EAAE,wBAAwB;IAmB3C;;;;;OAKG;IAEH,UAAU,IAAI,QAAQ;IAUtB;;;;;OAKG;IAEH,MAAM,IAAI,QAAQ;CAQnB;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
1
+ {"version":3,"file":"unprocessableEntity.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/unprocessableEntity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;;;;;;;;;GAYG;AACH,cAAM,mBAAoB,SAAQ,WAAW;IAC5C;;;;;OAKG;gBACS,KAAK,EAAE;QAElB,IAAI,CAAC,EAAE,GAAG,CAAC;QACX,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACrC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAChC,OAAO,CAAC,EAAE,MAAM,CAAC;KACjB;IAgBD,6EAA6E;IAC7E,UAAU,IAAI,QAAQ;IAUtB,uFAAuF;IACvF,MAAM,IAAI,QAAQ;CAQlB;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
@@ -1,22 +1,36 @@
1
1
  /**
2
- * Base class for handling bad HTTP responses with debugging capabilities.
3
- * Provides logging functionality to track response errors and their context.
2
+ * Base class for handling successful HTTP responses with debugging capabilities.
3
+ * Provides logging functionality to track response and their context.
4
4
  */
5
5
  declare class SuccessResponse {
6
+ private _body;
7
+ private _name;
8
+ private _status;
9
+ private _statusText;
10
+ private _debugColor;
11
+ get body(): any;
12
+ set body(value: any);
13
+ get name(): string;
14
+ set name(value: string);
15
+ get status(): number;
16
+ set status(value: number);
17
+ get statusText(): string;
18
+ set statusText(value: string);
19
+ get debugColor(): "green" | "yellow" | "cyan" | "red";
20
+ set debugColor(value: "green" | "yellow" | "cyan" | "red");
6
21
  /**
7
22
  * Logs debug information for success responses including caller context and response details.
8
23
  *
9
- * @param name - The name/type of the success response being logged
10
- * @param body - The response body or success data to be logged
11
- * @param cause - Optional additional cause information for the error
24
+ * @param {any} body - The response body or success data to be logged
12
25
  *
13
26
  * @example
14
27
  * ```typescript
15
28
  * const SuccessResponse = new SuccessResponse();
16
- * SuccessResponse.onDebug("ValidationError", { field: "email", message: "Invalid format" });
29
+ * SuccessResponse.onDebug({ data: "Operation completed successfully" });
17
30
  * ```
18
31
  */
19
- onDebug(name: string, body: any, cause?: any): void;
32
+ onDebug(body?: any): void;
33
+ makeBody(): any;
20
34
  }
21
35
  export { SuccessResponse };
22
36
  //# sourceMappingURL=_successResponse.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"_successResponse.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/_successResponse.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,cAAM,eAAe;IACnB;;;;;;;;;;;;OAYG;IACH,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,GAAG;CAgB7C;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
1
+ {"version":3,"file":"_successResponse.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/_successResponse.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,cAAM,eAAe;IAEpB,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,KAAK,CAA6B;IAC1C,OAAO,CAAC,OAAO,CAAe;IAC9B,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,WAAW,CAAgD;IAGnE,IAAI,IAAI,IAAI,GAAG,CAEd;IAGD,IAAI,IAAI,CAAC,KAAK,EAAE,GAAG,EAElB;IAED,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,EAErB;IAED,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,MAAM,CAAC,KAAK,EAAE,MAAM,EAEvB;IAED,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,IAAI,UAAU,CAAC,KAAK,EAAE,MAAM,EAE3B;IAED,IAAI,UAAU,IAAI,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,CAEpD;IAED,IAAI,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,EAGxD;IAED;;;;;;;;;;OAUG;IAEH,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,GAAG,IAAI;IAczB,QAAQ,IAAI,GAAG;CAOf;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
@@ -1,39 +1,21 @@
1
1
  import { SuccessResponse } from "./_successResponse";
2
- type InitProps = ResponseInit & {
3
- message?: string;
4
- };
5
2
  /**
6
- * Represents a successful HTTP response with a status code of 201 (Created).
7
- * This class is used to standardize the structure of a "Created" response,
8
- * including the response body, headers, status, and status text.
3
+ * HTTP 201 Created the request succeeded and a new resource was created.
9
4
  *
10
- * @template T - The type of the response body.
5
+ * @example
6
+ * ```typescript
7
+ * return new Created("User created successfully", { id: user.id }).toJson();
8
+ * ```
11
9
  */
12
- declare class Created<T> extends SuccessResponse {
13
- body: T;
14
- headers: ResponseInit["headers"];
15
- status: number;
16
- statusText: string;
10
+ declare class Created extends SuccessResponse {
17
11
  /**
18
- * Creates an instance of the `Created` class.
19
- *
20
- * @param body - The response body to be included in the HTTP response.
21
- * @param init - Optional initialization object for customizing headers, status, and status text.
22
- */
23
- constructor(body: T, init?: InitProps);
24
- /**
25
- * Converts the `Created` instance into a `Response` object with a JSON body.
26
- * This method ensures the response has the appropriate headers, status, and status text.
27
- *
28
- * @returns A `Response` object with the serialized JSON body and response metadata.
12
+ * @param message - Description included in the response status text.
13
+ * @param body - Data to include in the response body.
29
14
  */
15
+ constructor(message: string, body?: any);
16
+ /** Converts to a `Response` with `Content-Type: application/json` header. */
30
17
  toResponse(): Response;
31
- /**
32
- * Converts the `Created` instance into a `Response` object using the `Response.json` method.
33
- * This method is an alternative to `toResponse` for generating JSON responses.
34
- *
35
- * @returns A `Response` object with the JSON body and response metadata.
36
- */
18
+ /** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */
37
19
  toJson(): Response;
38
20
  }
39
21
  export { Created };
@@ -1 +1 @@
1
- {"version":3,"file":"created.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/created.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,KAAK,SAAS,GAAG,YAAY,GAAG;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;;;GAMG;AAEH,cAAM,OAAO,CAAC,CAAC,CAAE,SAAQ,eAAe;IACtC,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;gBAES,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,SAAS;IAWrC;;;;;OAKG;IAEH,UAAU,IAAI,QAAQ;IAUtB;;;;;OAKG;IAEH,MAAM,IAAI,QAAQ;CASnB;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"created.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/created.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;;GAOG;AACH,cAAM,OAAQ,SAAQ,eAAe;IACpC;;;OAGG;gBAES,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG;IAWvC,6EAA6E;IAC7E,UAAU,IAAI,QAAQ;IAUtB,uFAAuF;IACvF,MAAM,IAAI,QAAQ;CAQlB;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
@@ -1,42 +1,21 @@
1
1
  import { SuccessResponse } from "./_successResponse";
2
- type InitProps = ResponseInit & {
3
- message?: string;
4
- };
5
2
  /**
6
- * Represents an HTTP 302 Found response.
7
- * This class is used to create a standardized HTTP response with a status of 302 (Found),
8
- * including optional headers and a response body.
3
+ * HTTP 302 Found — the resource was located and the response includes it in the body.
9
4
  *
10
- * @template T - The type of the response body.
5
+ * @example
6
+ * ```typescript
7
+ * return new Found("Products retrieved", { products }).toJson();
8
+ * ```
11
9
  */
12
- declare class Found<T> extends SuccessResponse {
13
- body: T;
14
- headers: ResponseInit["headers"];
15
- status: number;
16
- statusText: string;
10
+ declare class Found extends SuccessResponse {
17
11
  /**
18
- * Creates an instance of the `Found` class.
19
- *
20
- * @param body - The body of the response.
21
- * @param init - Optional initialization object to set headers, status, and statusText.
22
- * - `headers`: Additional headers to include in the response.
23
- * - `status`: HTTP status code (default is 302).
24
- * - `statusText`: HTTP status text (default is "Found").
25
- */
26
- constructor(body: T, init?: InitProps);
27
- /**
28
- * Converts the `Found` instance into a `Response` object.
29
- * This method serializes the response body as JSON and includes the appropriate headers.
30
- *
31
- * @returns A `Response` object with the serialized JSON body and the specified headers, status, and statusText.
12
+ * @param message - Description included in the response status text.
13
+ * @param body - Data to include in the response body.
32
14
  */
15
+ constructor(message: string, body?: any);
16
+ /** Converts to a `Response` with `Content-Type: application/json` header. */
33
17
  toResponse(): Response;
34
- /**
35
- * Converts the `Found` instance into a JSON response using `Response.json`.
36
- * This method is an alternative to `toResponse` for creating JSON responses.
37
- *
38
- * @returns A `Response` object with the JSON body and the specified headers, status, and statusText.
39
- */
18
+ /** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */
40
19
  toJson(): Response;
41
20
  }
42
21
  export { Found };
@@ -1 +1 @@
1
- {"version":3,"file":"found.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/found.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,KAAK,SAAS,GAAG,YAAY,GAAG;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;;;GAMG;AAEH,cAAM,KAAK,CAAC,CAAC,CAAE,SAAQ,eAAe;IACpC,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;;;;OAQG;gBAES,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,SAAS;IAWrC;;;;;OAKG;IAEH,UAAU;IAUV;;;;;OAKG;IAEH,MAAM;CASP;AAED,OAAO,EAAE,KAAK,EAAE,CAAC"}
1
+ {"version":3,"file":"found.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/found.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;;GAOG;AACH,cAAM,KAAM,SAAQ,eAAe;IAClC;;;OAGG;gBAES,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG;IAWvC,6EAA6E;IAC7E,UAAU,IAAI,QAAQ;IAUtB,uFAAuF;IACvF,MAAM,IAAI,QAAQ;CAQlB;AAED,OAAO,EAAE,KAAK,EAAE,CAAC"}
@@ -1,25 +1,19 @@
1
1
  import { SuccessResponse } from "./_successResponse";
2
2
  /**
3
- * Represents a successful HTTP response with a status code of 204 (No Content).
4
- * This class is used to standardize the structure of a "No Content" response,
5
- * including headers, status, and status text.
3
+ * HTTP 204 No Content the request succeeded but there is no content to return.
4
+ * Typically used for delete or update operations where a body is not needed.
5
+ *
6
+ * @example
7
+ * ```typescript
8
+ * return new NoContent("Record deleted").toResponse();
9
+ * ```
6
10
  */
7
11
  declare class NoContent extends SuccessResponse {
8
- headers: ResponseInit["headers"];
9
- status: number;
10
- statusText: string;
11
12
  /**
12
- * Creates an instance of the `NoContent` class.
13
- *
14
- * @param init - Optional initialization object for customizing headers, status, and status text.
15
- */
16
- constructor(init?: ResponseInit);
17
- /**
18
- * Converts the `NoContent` instance into a `Response` object.
19
- * This method ensures the response has the appropriate headers, status, and status text.
20
- *
21
- * @returns A `Response` object with no body and response metadata.
13
+ * @param message - Description included in the response status text.
22
14
  */
15
+ constructor(message: string);
16
+ /** Converts to a `Response` with `Content-Type: application/json` header and no body. */
23
17
  toResponse(): Response;
24
18
  }
25
19
  export { NoContent };
@@ -1 +1 @@
1
- {"version":3,"file":"noContent.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/noContent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;GAIG;AAEH,cAAM,SAAU,SAAQ,eAAe;IACrC,OAAO,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;gBAES,IAAI,CAAC,EAAE,YAAY;IAU/B;;;;;OAKG;IAEH,UAAU,IAAI,QAAQ;CASvB;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
1
+ {"version":3,"file":"noContent.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/noContent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;;;GAQG;AACH,cAAM,SAAU,SAAQ,eAAe;IACtC;;OAEG;gBACS,OAAO,EAAE,MAAM;IAU3B,yFAAyF;IACzF,UAAU,IAAI,QAAQ;CAStB;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -1,39 +1,21 @@
1
1
  import { SuccessResponse } from "./_successResponse";
2
- type InitProps = ResponseInit & {
3
- message?: string;
4
- };
5
2
  /**
6
- * Represents a successful HTTP response with a status code of 200 (OK).
7
- * This class is used to standardize the structure of a "Success" response,
8
- * including the response body, headers, status, and status text.
3
+ * HTTP 200 OK the request succeeded and the response body contains the result.
9
4
  *
10
- * @template T - The type of the response body.
5
+ * @example
6
+ * ```typescript
7
+ * return new Success("Order fetched", { order }).toJson();
8
+ * ```
11
9
  */
12
- declare class Success<T> extends SuccessResponse {
13
- body: T;
14
- headers: ResponseInit["headers"];
15
- status: number;
16
- statusText: string;
10
+ declare class Success extends SuccessResponse {
17
11
  /**
18
- * Creates an instance of the `Success` class.
19
- *
20
- * @param body - The response body to be included in the HTTP response.
21
- * @param init - Optional initialization object for customizing headers, status, and status text.
22
- */
23
- constructor(body: T, init?: InitProps);
24
- /**
25
- * Converts the `Success` instance into a `Response` object with a JSON body.
26
- * This method ensures the response has the appropriate headers, status, and status text.
27
- *
28
- * @returns A `Response` object with the serialized JSON body and response metadata.
12
+ * @param message - Description included in the response status text.
13
+ * @param body - Data to include in the response body.
29
14
  */
15
+ constructor(message: string, body?: any);
16
+ /** Converts to a `Response` with `Content-Type: application/json` header. */
30
17
  toResponse(): Response;
31
- /**
32
- * Converts the `Success` instance into a `Response` object using the `Response.json` method.
33
- * This method is an alternative to `toResponse` for generating JSON responses.
34
- *
35
- * @returns A `Response` object with the JSON body and response metadata.
36
- */
18
+ /** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */
37
19
  toJson(): Response;
38
20
  }
39
21
  export { Success };
@@ -1 +1 @@
1
- {"version":3,"file":"success.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/success.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,KAAK,SAAS,GAAG,YAAY,GAAG;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;;;GAMG;AAEH,cAAM,OAAO,CAAC,CAAC,CAAE,SAAQ,eAAe;IACtC,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;gBAES,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,SAAS;IAWrC;;;;;OAKG;IAEH,UAAU,IAAI,QAAQ;IAUtB;;;;;OAKG;IAEH,MAAM,IAAI,QAAQ;CASnB;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"success.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/success.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;;GAOG;AACH,cAAM,OAAQ,SAAQ,eAAe;IACpC;;;OAGG;gBAES,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG;IAWvC,6EAA6E;IAC7E,UAAU,IAAI,QAAQ;IAUtB,uFAAuF;IACvF,MAAM,IAAI,QAAQ;CAQlB;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
@@ -1,39 +1,22 @@
1
1
  import { SuccessResponse } from "./_successResponse";
2
- type InitProps = ResponseInit & {
3
- message?: string;
4
- };
5
2
  /**
6
- * Represents a successful HTTP response with a status code of 200 (OK) or other custom status codes.
7
- * This class is used to standardize the structure of an "Updated" response,
8
- * including the response body, headers, status, and status text.
3
+ * HTTP 200 OK the request succeeded and the resource was updated.
4
+ * Semantically equivalent to `Success` but signals an update operation to consumers.
9
5
  *
10
- * @template T - The type of the response body.
6
+ * @example
7
+ * ```typescript
8
+ * return new Updated("Profile updated", { user }).toJson();
9
+ * ```
11
10
  */
12
- declare class Updated<T> extends SuccessResponse {
13
- body: T;
14
- headers: ResponseInit["headers"];
15
- status: number;
16
- statusText: string;
11
+ declare class Updated extends SuccessResponse {
17
12
  /**
18
- * Creates an instance of the `Updated` class.
19
- *
20
- * @param body - The response body to be included in the HTTP response.
21
- * @param init - Optional initialization object for customizing headers, status, and status text.
22
- */
23
- constructor(body: T, init?: InitProps);
24
- /**
25
- * Converts the `Updated` instance into a `Response` object with a JSON body.
26
- * This method ensures the response has the appropriate headers, status, and status text.
27
- *
28
- * @returns A `Response` object with the serialized JSON body and response metadata.
13
+ * @param message - Description included in the response status text.
14
+ * @param body - Data to include in the response body.
29
15
  */
16
+ constructor(message: string, body?: any);
17
+ /** Converts to a `Response` with `Content-Type: application/json` header. */
30
18
  toResponse(): Response;
31
- /**
32
- * Converts the `Updated` instance into a `Response` object using the `Response.json` method.
33
- * This method is an alternative to `toResponse` for generating JSON responses.
34
- *
35
- * @returns A `Response` object with the JSON body and response metadata.
36
- */
19
+ /** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */
37
20
  toJson(): Response;
38
21
  }
39
22
  export { Updated };
@@ -1 +1 @@
1
- {"version":3,"file":"updated.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/updated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD,KAAK,SAAS,GAAG,YAAY,GAAG;IAC9B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;;;;;GAMG;AAEH,cAAM,OAAO,CAAC,CAAC,CAAE,SAAQ,eAAe;IACtC,IAAI,EAAE,CAAC,CAAC;IACR,OAAO,EAAE,YAAY,CAAC,SAAS,CAAC,CAAC;IACjC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;OAKG;gBAES,IAAI,EAAE,CAAC,EAAE,IAAI,CAAC,EAAE,SAAS;IAWrC;;;;;OAKG;IAEH,UAAU,IAAI,QAAQ;IAUtB;;;;;OAKG;IAEH,MAAM,IAAI,QAAQ;CASnB;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
1
+ {"version":3,"file":"updated.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/updated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;;;GAQG;AACH,cAAM,OAAQ,SAAQ,eAAe;IACpC;;;OAGG;gBAES,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG;IAWvC,6EAA6E;IAC7E,UAAU,IAAI,QAAQ;IAUtB,uFAAuF;IACvF,MAAM,IAAI,QAAQ;CAQlB;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -13,17 +13,16 @@ export { NoContent } from "./http/successResponses/noContent";
13
13
  export { Success } from "./http/successResponses/success";
14
14
  export { Updated } from "./http/successResponses/updated";
15
15
  export { ApiService } from "./services/apiService";
16
- export { ArkynLogService } from "./services/arkynLogService";
17
16
  export { DebugService } from "./services/debugService";
18
- export { decodeErrorMessageFromRequest } from "./services/decodeErrorMessageFromRequest";
19
- export { decodeRequestBody } from "./services/decodeRequestBody";
20
- export { errorHandler } from "./services/errorHandler";
21
- export { flushDebugLogs } from "./services/flushDebugLogs";
22
- export { formAsyncParse } from "./services/formAsyncParse";
23
- export { formParse } from "./services/formParse";
24
- export { getCaller } from "./services/getCaller";
25
- export { getScopedParams } from "./services/getScopedParams";
26
- export { SchemaValidator } from "./services/schemaValidator";
17
+ export { LogService } from "./services/logService";
18
+ export { decodeRequestBody } from "./utilities/decodeRequestBody";
19
+ export { decodeRequestErrorMessage } from "./utilities/decodeRequestErrorMessage";
20
+ export { errorHandler } from "./utilities/errorHandler";
21
+ export { flushDebugLogs } from "./utilities/flushDebugLogs";
22
+ export { formAsyncParse } from "./utilities/formAsyncParse";
23
+ export { formParse } from "./utilities/formParse";
24
+ export { getScopedParams } from "./utilities/getScopedParams";
25
+ export { SchemaValidator } from "./utilities/schemaValidator";
27
26
  export { validateCep } from "./validations/validateCep";
28
27
  export { validateCnpj } from "./validations/validateCnpj";
29
28
  export { validateCpf } from "./validations/validateCpf";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAG9E,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAG1D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,6BAA6B,EAAE,MAAM,0CAA0C,CAAC;AACzF,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAC3D,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAG7D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAG1D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC"}