@arkyn/server 3.0.1-beta.13 → 3.0.1-beta.131

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 (221) hide show
  1. package/README.md +368 -65
  2. package/dist/bundle.js +3232 -0
  3. package/dist/bundle.umd.cjs +9 -0
  4. package/dist/{api/arkynLogRequest.d.ts → http/api/_logRequest.d.ts} +22 -19
  5. package/dist/{api/arkynLogRequest.d.ts.map → http/api/_logRequest.d.ts.map} +1 -1
  6. package/dist/http/api/_logRequest.js +88 -0
  7. package/dist/http/api/_makeRequest.d.ts +61 -0
  8. package/dist/http/api/_makeRequest.d.ts.map +1 -0
  9. package/dist/{api/makeRequest.js → http/api/_makeRequest.js} +33 -20
  10. package/dist/http/api/deleteRequest.d.ts +17 -0
  11. package/dist/http/api/deleteRequest.d.ts.map +1 -0
  12. package/dist/http/api/deleteRequest.js +18 -0
  13. package/dist/http/api/getRequest.d.ts +16 -0
  14. package/dist/http/api/getRequest.d.ts.map +1 -0
  15. package/dist/http/api/getRequest.js +17 -0
  16. package/dist/http/api/patchRequest.d.ts +17 -0
  17. package/dist/http/api/patchRequest.d.ts.map +1 -0
  18. package/dist/http/api/patchRequest.js +18 -0
  19. package/dist/http/api/postRequest.d.ts +17 -0
  20. package/dist/http/api/postRequest.d.ts.map +1 -0
  21. package/dist/http/api/postRequest.js +18 -0
  22. package/dist/http/api/putRequest.d.ts +17 -0
  23. package/dist/http/api/putRequest.d.ts.map +1 -0
  24. package/dist/http/api/putRequest.js +18 -0
  25. package/dist/http/badResponses/_badResponse.d.ts +25 -0
  26. package/dist/http/badResponses/_badResponse.d.ts.map +1 -0
  27. package/dist/http/badResponses/_badResponse.js +62 -0
  28. package/dist/http/badResponses/badGateway.d.ts +6 -9
  29. package/dist/http/badResponses/badGateway.d.ts.map +1 -1
  30. package/dist/http/badResponses/badGateway.js +12 -14
  31. package/dist/http/badResponses/badRequest.d.ts +6 -9
  32. package/dist/http/badResponses/badRequest.d.ts.map +1 -1
  33. package/dist/http/badResponses/badRequest.js +12 -14
  34. package/dist/http/badResponses/conflict.d.ts +6 -9
  35. package/dist/http/badResponses/conflict.d.ts.map +1 -1
  36. package/dist/http/badResponses/conflict.js +13 -14
  37. package/dist/http/badResponses/forbidden.d.ts +6 -9
  38. package/dist/http/badResponses/forbidden.d.ts.map +1 -1
  39. package/dist/http/badResponses/forbidden.js +12 -14
  40. package/dist/http/badResponses/notFound.d.ts +6 -9
  41. package/dist/http/badResponses/notFound.d.ts.map +1 -1
  42. package/dist/http/badResponses/notFound.js +12 -14
  43. package/dist/http/badResponses/notImplemented.d.ts +6 -9
  44. package/dist/http/badResponses/notImplemented.d.ts.map +1 -1
  45. package/dist/http/badResponses/notImplemented.js +12 -14
  46. package/dist/http/badResponses/serverError.d.ts +6 -9
  47. package/dist/http/badResponses/serverError.d.ts.map +1 -1
  48. package/dist/http/badResponses/serverError.js +12 -14
  49. package/dist/http/badResponses/unauthorized.d.ts +4 -7
  50. package/dist/http/badResponses/unauthorized.d.ts.map +1 -1
  51. package/dist/http/badResponses/unauthorized.js +11 -12
  52. package/dist/http/badResponses/unprocessableEntity.d.ts +15 -19
  53. package/dist/http/badResponses/unprocessableEntity.d.ts.map +1 -1
  54. package/dist/http/badResponses/unprocessableEntity.js +19 -21
  55. package/dist/http/successResponses/_successResponse.d.ts +36 -0
  56. package/dist/http/successResponses/_successResponse.d.ts.map +1 -0
  57. package/dist/http/successResponses/_successResponse.js +75 -0
  58. package/dist/http/successResponses/created.d.ts +9 -19
  59. package/dist/http/successResponses/created.d.ts.map +1 -1
  60. package/dist/http/successResponses/created.js +16 -25
  61. package/dist/http/successResponses/found.d.ts +10 -23
  62. package/dist/http/successResponses/found.d.ts.map +1 -1
  63. package/dist/http/successResponses/found.js +17 -29
  64. package/dist/http/successResponses/noContent.d.ts +6 -13
  65. package/dist/http/successResponses/noContent.d.ts.map +1 -1
  66. package/dist/http/successResponses/noContent.js +12 -17
  67. package/dist/http/successResponses/success.d.ts +9 -19
  68. package/dist/http/successResponses/success.d.ts.map +1 -1
  69. package/dist/http/successResponses/success.js +16 -25
  70. package/dist/http/successResponses/updated.d.ts +9 -19
  71. package/dist/http/successResponses/updated.d.ts.map +1 -1
  72. package/dist/http/successResponses/updated.js +16 -25
  73. package/dist/index.d.ts +19 -10
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/index.js +22 -13
  76. package/dist/services/apiService.d.ts +63 -0
  77. package/dist/services/apiService.d.ts.map +1 -0
  78. package/dist/services/apiService.js +158 -0
  79. package/dist/services/debugService.d.ts +69 -0
  80. package/dist/services/debugService.d.ts.map +1 -0
  81. package/dist/services/debugService.js +114 -0
  82. package/dist/services/logMapperService.d.ts +86 -0
  83. package/dist/services/logMapperService.d.ts.map +1 -0
  84. package/dist/services/logMapperService.js +68 -0
  85. package/dist/services/logService.d.ts +38 -0
  86. package/dist/services/logService.d.ts.map +1 -0
  87. package/dist/services/logService.js +40 -0
  88. package/dist/{services → utilities}/decodeRequestBody.d.ts +3 -4
  89. package/dist/utilities/decodeRequestBody.d.ts.map +1 -0
  90. package/dist/{services → utilities}/decodeRequestBody.js +5 -5
  91. package/dist/{services/decodeErrorMessageFromRequest.d.ts → utilities/decodeRequestErrorMessage.d.ts} +6 -6
  92. package/dist/utilities/decodeRequestErrorMessage.d.ts.map +1 -0
  93. package/dist/{services/decodeErrorMessageFromRequest.js → utilities/decodeRequestErrorMessage.js} +5 -5
  94. package/dist/utilities/errorHandler.d.ts +50 -0
  95. package/dist/utilities/errorHandler.d.ts.map +1 -0
  96. package/dist/{services → utilities}/errorHandler.js +34 -28
  97. package/dist/utilities/flushDebugLogs.d.ts +46 -0
  98. package/dist/utilities/flushDebugLogs.d.ts.map +1 -0
  99. package/dist/utilities/flushDebugLogs.js +61 -0
  100. package/dist/utilities/formAsyncParse.d.ts +59 -0
  101. package/dist/utilities/formAsyncParse.d.ts.map +1 -0
  102. package/dist/utilities/formAsyncParse.js +58 -0
  103. package/dist/{services → utilities}/formParse.d.ts +3 -3
  104. package/dist/utilities/formParse.d.ts.map +1 -0
  105. package/dist/{services → utilities}/formParse.js +3 -4
  106. package/dist/{services → utilities}/getScopedParams.d.ts +3 -4
  107. package/dist/utilities/getScopedParams.d.ts.map +1 -0
  108. package/dist/{services → utilities}/getScopedParams.js +4 -4
  109. package/dist/utilities/schemaValidator.d.ts +146 -0
  110. package/dist/utilities/schemaValidator.d.ts.map +1 -0
  111. package/dist/utilities/schemaValidator.js +191 -0
  112. package/dist/validations/validateCep.d.ts +19 -0
  113. package/dist/validations/validateCep.d.ts.map +1 -0
  114. package/dist/validations/validateCep.js +27 -0
  115. package/dist/validations/validateCnpj.d.ts +21 -0
  116. package/dist/validations/validateCnpj.d.ts.map +1 -0
  117. package/dist/validations/validateCnpj.js +59 -0
  118. package/dist/validations/validateCpf.d.ts +23 -0
  119. package/dist/validations/validateCpf.d.ts.map +1 -0
  120. package/dist/validations/validateCpf.js +61 -0
  121. package/dist/validations/validateDate.d.ts +27 -0
  122. package/dist/validations/validateDate.d.ts.map +1 -0
  123. package/dist/validations/validateDate.js +55 -0
  124. package/dist/validations/validateEmail.d.ts +21 -0
  125. package/dist/validations/validateEmail.d.ts.map +1 -0
  126. package/dist/validations/validateEmail.js +111 -0
  127. package/dist/validations/validatePassword.d.ts +20 -0
  128. package/dist/validations/validatePassword.d.ts.map +1 -0
  129. package/dist/validations/validatePassword.js +34 -0
  130. package/dist/validations/validatePhone.d.ts +28 -0
  131. package/dist/validations/validatePhone.d.ts.map +1 -0
  132. package/dist/validations/validatePhone.js +40 -0
  133. package/dist/validations/validateRg.d.ts +21 -0
  134. package/dist/validations/validateRg.d.ts.map +1 -0
  135. package/dist/validations/validateRg.js +31 -0
  136. package/package.json +26 -11
  137. package/dist/api/arkynLogRequest.js +0 -82
  138. package/dist/api/deleteRequest.d.ts +0 -13
  139. package/dist/api/deleteRequest.d.ts.map +0 -1
  140. package/dist/api/deleteRequest.js +0 -14
  141. package/dist/api/getRequest.d.ts +0 -12
  142. package/dist/api/getRequest.d.ts.map +0 -1
  143. package/dist/api/getRequest.js +0 -13
  144. package/dist/api/makeRequest.d.ts +0 -38
  145. package/dist/api/makeRequest.d.ts.map +0 -1
  146. package/dist/api/patchRequest.d.ts +0 -13
  147. package/dist/api/patchRequest.d.ts.map +0 -1
  148. package/dist/api/patchRequest.js +0 -14
  149. package/dist/api/postRequest.d.ts +0 -13
  150. package/dist/api/postRequest.d.ts.map +0 -1
  151. package/dist/api/postRequest.js +0 -14
  152. package/dist/api/putRequest.d.ts +0 -13
  153. package/dist/api/putRequest.d.ts.map +0 -1
  154. package/dist/api/putRequest.js +0 -14
  155. package/dist/config/apiInstance.d.ts +0 -80
  156. package/dist/config/apiInstance.d.ts.map +0 -1
  157. package/dist/config/apiInstance.js +0 -111
  158. package/dist/config/arkynLogInstance.d.ts +0 -44
  159. package/dist/config/arkynLogInstance.d.ts.map +0 -1
  160. package/dist/config/arkynLogInstance.js +0 -49
  161. package/dist/mapper/arkynLogRequestMapper.d.ts +0 -30
  162. package/dist/mapper/arkynLogRequestMapper.d.ts.map +0 -1
  163. package/dist/mapper/arkynLogRequestMapper.js +0 -44
  164. package/dist/services/decodeErrorMessageFromRequest.d.ts.map +0 -1
  165. package/dist/services/decodeRequestBody.d.ts.map +0 -1
  166. package/dist/services/errorHandler.d.ts +0 -44
  167. package/dist/services/errorHandler.d.ts.map +0 -1
  168. package/dist/services/formParse.d.ts.map +0 -1
  169. package/dist/services/getCaller.d.ts +0 -17
  170. package/dist/services/getCaller.d.ts.map +0 -1
  171. package/dist/services/getCaller.js +0 -65
  172. package/dist/services/getScopedParams.d.ts.map +0 -1
  173. package/dist/services/httpDebug.d.ts +0 -35
  174. package/dist/services/httpDebug.d.ts.map +0 -1
  175. package/dist/services/httpDebug.js +0 -52
  176. package/dist/services/measureRouteExecution.d.ts +0 -3
  177. package/dist/services/measureRouteExecution.d.ts.map +0 -1
  178. package/dist/services/measureRouteExecution.js +0 -24
  179. package/dist/services/schemaValidator.d.ts +0 -13
  180. package/dist/services/schemaValidator.d.ts.map +0 -1
  181. package/dist/services/schemaValidator.js +0 -51
  182. package/dist/types/ApiResponseDTO.d.ts +0 -17
  183. package/dist/types/ApiResponseDTO.d.ts.map +0 -1
  184. package/dist/types/ApiResponseDTO.js +0 -1
  185. package/src/api/arkynLogRequest.ts +0 -118
  186. package/src/api/deleteRequest.ts +0 -22
  187. package/src/api/getRequest.ts +0 -20
  188. package/src/api/makeRequest.ts +0 -118
  189. package/src/api/patchRequest.ts +0 -22
  190. package/src/api/postRequest.ts +0 -22
  191. package/src/api/putRequest.ts +0 -22
  192. package/src/config/apiInstance.ts +0 -148
  193. package/src/config/arkynLogInstance.ts +0 -70
  194. package/src/http/badResponses/badGateway.ts +0 -63
  195. package/src/http/badResponses/badRequest.ts +0 -63
  196. package/src/http/badResponses/conflict.ts +0 -63
  197. package/src/http/badResponses/forbidden.ts +0 -63
  198. package/src/http/badResponses/notFound.ts +0 -63
  199. package/src/http/badResponses/notImplemented.ts +0 -63
  200. package/src/http/badResponses/serverError.ts +0 -63
  201. package/src/http/badResponses/unauthorized.ts +0 -63
  202. package/src/http/badResponses/unprocessableEntity.ts +0 -79
  203. package/src/http/successResponses/created.ts +0 -64
  204. package/src/http/successResponses/found.ts +0 -67
  205. package/src/http/successResponses/noContent.ts +0 -42
  206. package/src/http/successResponses/success.ts +0 -64
  207. package/src/http/successResponses/updated.ts +0 -64
  208. package/src/index.ts +0 -31
  209. package/src/mapper/arkynLogRequestMapper.ts +0 -73
  210. package/src/services/decodeErrorMessageFromRequest.ts +0 -36
  211. package/src/services/decodeRequestBody.ts +0 -43
  212. package/src/services/errorHandler.ts +0 -99
  213. package/src/services/formParse.ts +0 -86
  214. package/src/services/getCaller.ts +0 -82
  215. package/src/services/getScopedParams.ts +0 -43
  216. package/src/services/httpDebug.ts +0 -61
  217. package/src/services/measureRouteExecution.ts +0 -31
  218. package/src/services/schemaValidator.ts +0 -66
  219. package/src/types/ApiResponseDTO.ts +0 -19
  220. package/tsconfig.json +0 -21
  221. package/vitest.config.ts +0 -5
@@ -0,0 +1,61 @@
1
+ type InputProps = {
2
+ url: string;
3
+ method: "POST" | "PUT" | "DELETE" | "PATCH" | "GET";
4
+ urlParams?: Record<string, string>;
5
+ headers?: HeadersInit;
6
+ body?: any;
7
+ };
8
+ type ApiSuccessResponse<T = any> = {
9
+ success: true;
10
+ status: number;
11
+ message: string;
12
+ response: T;
13
+ cause: null;
14
+ };
15
+ type ApiFailedResponse = {
16
+ success: false;
17
+ status: number;
18
+ message: string;
19
+ response: any;
20
+ cause: string | Error | null;
21
+ };
22
+ type ApiResponseDTO<T = any> = ApiSuccessResponse<T> | ApiFailedResponse;
23
+ /**
24
+ * Makes an HTTP request using the Fetch API and returns a standardized response.
25
+ *
26
+ * @template {any} T - The expected type of the response data.
27
+ *
28
+ * @param {"POST" | "PUT" | "DELETE" | "PATCH" | "GET"} method - The HTTP method to use for the request. Supported methods are:
29
+ * - "POST": Create a new resource.
30
+ * - "PUT": Update an existing resource.
31
+ * - "DELETE": Remove a resource.
32
+ * - "PATCH": Partially update a resource.
33
+ * - "GET": Retrieve a resource.
34
+ * @param {string} url - The URL to which the request is sent.
35
+ * @param {HeadersInit} headers - Optional headers to include in the request. Defaults to an empty object.
36
+ * @param {any} body - Optional body to include in the request. Should be serializable to JSON.
37
+ *
38
+ * @returns {ApiResponseDTO<T>} A promise that resolves to an `ApiResponseDTO<T>` object containing:
39
+ * - `success`: A boolean indicating whether the request was successful.
40
+ * - `status`: The HTTP status code of the response.
41
+ * - `message`: A message describing the result of the request.
42
+ * - `response`: The parsed JSON response data, or `null` if parsing fails.
43
+ * - `cause`: Additional error information, if applicable.
44
+ *
45
+ * @example
46
+ * ```typescript
47
+ * import { makeRequest } from "./makeRequest";
48
+ *
49
+ * async function fetchData() {
50
+ * const response = await makeRequest("GET", "https://api.example.com/data");
51
+ * if (response.success) {
52
+ * console.log("Data:", response.response);
53
+ * } else {
54
+ * console.error("Error:", response.message);
55
+ * }
56
+ * }
57
+ * ```
58
+ */
59
+ declare function makeRequest<T = any>(input: InputProps): Promise<ApiResponseDTO<T>>;
60
+ export { makeRequest, type ApiResponseDTO };
61
+ //# sourceMappingURL=_makeRequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_makeRequest.d.ts","sourceRoot":"","sources":["../../../src/http/api/_makeRequest.ts"],"names":[],"mappings":"AAIA,KAAK,UAAU,GAAG;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ,CAAC;AAEF,KAAK,kBAAkB,CAAC,CAAC,GAAG,GAAG,IAAI;IACjC,OAAO,EAAE,IAAI,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,CAAC,CAAC;IACZ,KAAK,EAAE,IAAI,CAAC;CACb,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACvB,OAAO,EAAE,KAAK,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,GAAG,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC;CAC9B,CAAC;AAEF,KAAK,cAAc,CAAC,CAAC,GAAG,GAAG,IAAI,kBAAkB,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,iBAAe,WAAW,CAAC,CAAC,GAAG,GAAG,EAChC,KAAK,EAAE,UAAU,GAChB,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAoF5B;AAED,OAAO,EAAE,WAAW,EAAE,KAAK,cAAc,EAAE,CAAC"}
@@ -1,20 +1,22 @@
1
- import { ArkynLogRequestMapper } from "../mapper/arkynLogRequestMapper";
2
- import { httpDebug } from "../services/httpDebug";
3
- import { arkynLogRequest } from "./arkynLogRequest";
1
+ import { flushDebugLogs } from "../..";
2
+ import { LogMapperService } from "../../services/logMapperService";
3
+ import { logRequest } from "./_logRequest";
4
4
  /**
5
5
  * Makes an HTTP request using the Fetch API and returns a standardized response.
6
6
  *
7
- * @template T - The expected type of the response data.
8
- * @param method - The HTTP method to use for the request. Supported methods are:
7
+ * @template {any} T - The expected type of the response data.
8
+ *
9
+ * @param {"POST" | "PUT" | "DELETE" | "PATCH" | "GET"} method - The HTTP method to use for the request. Supported methods are:
9
10
  * - "POST": Create a new resource.
10
11
  * - "PUT": Update an existing resource.
11
12
  * - "DELETE": Remove a resource.
12
13
  * - "PATCH": Partially update a resource.
13
14
  * - "GET": Retrieve a resource.
14
- * @param url - The URL to which the request is sent.
15
- * @param headers - Optional headers to include in the request. Defaults to an empty object.
16
- * @param body - Optional body to include in the request. Should be serializable to JSON.
17
- * @returns A promise that resolves to an `ApiResponseDTO<T>` object containing:
15
+ * @param {string} url - The URL to which the request is sent.
16
+ * @param {HeadersInit} headers - Optional headers to include in the request. Defaults to an empty object.
17
+ * @param {any} body - Optional body to include in the request. Should be serializable to JSON.
18
+ *
19
+ * @returns {ApiResponseDTO<T>} A promise that resolves to an `ApiResponseDTO<T>` object containing:
18
20
  * - `success`: A boolean indicating whether the request was successful.
19
21
  * - `status`: The HTTP status code of the response.
20
22
  * - `message`: A message describing the result of the request.
@@ -35,7 +37,13 @@ import { arkynLogRequest } from "./arkynLogRequest";
35
37
  * }
36
38
  * ```
37
39
  */
38
- async function makeRequest(method, url, rawHeaders = {}, body) {
40
+ async function makeRequest(input) {
41
+ let url = input.url;
42
+ if (input.urlParams) {
43
+ Object.entries(input.urlParams).forEach(([key, value]) => {
44
+ url = url.replaceAll(`:${key}`, value);
45
+ });
46
+ }
39
47
  const successMessage = {
40
48
  POST: "Resource created successfully",
41
49
  PUT: "Resource updated successfully",
@@ -45,11 +53,11 @@ async function makeRequest(method, url, rawHeaders = {}, body) {
45
53
  };
46
54
  try {
47
55
  const startTime = performance.now();
48
- const headers = { ...rawHeaders, "Content-Type": "application/json" };
56
+ const headers = { ...input.headers, "Content-Type": "application/json" };
49
57
  const response = await fetch(url, {
50
- method,
51
58
  headers,
52
- body: body ? JSON.stringify(body) : undefined,
59
+ method: input.method,
60
+ body: input.body ? JSON.stringify(input.body) : undefined,
53
61
  });
54
62
  const elapsedTime = performance.now() - startTime;
55
63
  const status = response.status;
@@ -60,18 +68,19 @@ async function makeRequest(method, url, rawHeaders = {}, body) {
60
68
  catch {
61
69
  data = null;
62
70
  }
63
- const logData = ArkynLogRequestMapper.handle({
71
+ const logData = LogMapperService.handle({
64
72
  elapsedTime,
65
- method,
73
+ method: input.method,
66
74
  queryParams: new URL(url).searchParams,
67
75
  requestHeaders: headers,
68
- requestBody: body,
76
+ requestBody: input.body,
69
77
  responseBody: data,
70
78
  responseHeaders: response.headers,
71
79
  status,
72
- url,
80
+ rawUrl: input.url,
81
+ urlParams: input.urlParams,
73
82
  });
74
- arkynLogRequest(logData);
83
+ logRequest(logData);
75
84
  if (!response.ok) {
76
85
  return {
77
86
  success: false,
@@ -84,13 +93,17 @@ async function makeRequest(method, url, rawHeaders = {}, body) {
84
93
  return {
85
94
  success: true,
86
95
  status,
87
- message: data?.message || successMessage[method],
96
+ message: data?.message || successMessage[input.method],
88
97
  response: data,
89
98
  cause: null,
90
99
  };
91
100
  }
92
101
  catch (err) {
93
- httpDebug("Network error or request failed", null, err);
102
+ flushDebugLogs({
103
+ debugs: [`Network error or request failed: ${err}`],
104
+ name: "MakeRequestError",
105
+ scheme: "red",
106
+ });
94
107
  return {
95
108
  success: false,
96
109
  status: 0,
@@ -0,0 +1,17 @@
1
+ import { type ApiResponseDTO } from "./_makeRequest";
2
+ type InputProps = {
3
+ url: string;
4
+ urlParams?: Record<string, string>;
5
+ headers?: HeadersInit;
6
+ body?: any;
7
+ };
8
+ /**
9
+ * Sends a DELETE request to the specified URL with optional headers and body.
10
+ *
11
+ * @template T - The expected type of the response data.
12
+ * @param {InputProps} input - The options for the DELETE request, including URL, URL parameters, headers, and body.
13
+ * @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
14
+ */
15
+ declare function deleteRequest<T = any>(input: InputProps): Promise<ApiResponseDTO<T>>;
16
+ export { deleteRequest };
17
+ //# sourceMappingURL=deleteRequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"deleteRequest.d.ts","sourceRoot":"","sources":["../../../src/http/api/deleteRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAElE,KAAK,UAAU,GAAG;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ,CAAC;AAEF;;;;;;GAMG;AAEH,iBAAe,aAAa,CAAC,CAAC,GAAG,GAAG,EAClC,KAAK,EAAE,UAAU,GAChB,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAQ5B;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { makeRequest } from "./_makeRequest";
2
+ /**
3
+ * Sends a DELETE request to the specified URL with optional headers and body.
4
+ *
5
+ * @template T - The expected type of the response data.
6
+ * @param {InputProps} input - The options for the DELETE request, including URL, URL parameters, headers, and body.
7
+ * @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
8
+ */
9
+ async function deleteRequest(input) {
10
+ return makeRequest({
11
+ method: "DELETE",
12
+ url: input.url,
13
+ urlParams: input.urlParams,
14
+ headers: input.headers,
15
+ body: input.body,
16
+ });
17
+ }
18
+ export { deleteRequest };
@@ -0,0 +1,16 @@
1
+ import { type ApiResponseDTO } from "./_makeRequest";
2
+ type InputProps = {
3
+ url: string;
4
+ urlParams?: Record<string, string>;
5
+ headers?: HeadersInit;
6
+ };
7
+ /**
8
+ * Sends a GET request to the specified URL with optional headers.
9
+ *
10
+ * @template T - The expected type of the response data.
11
+ * @param {InputProps} input - The options for the GET request, including URL, URL parameters, and headers.
12
+ * @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
13
+ */
14
+ declare function getRequest<T = any>(input: InputProps): Promise<ApiResponseDTO<T>>;
15
+ export { getRequest };
16
+ //# sourceMappingURL=getRequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getRequest.d.ts","sourceRoot":"","sources":["../../../src/http/api/getRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAElE,KAAK,UAAU,GAAG;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,WAAW,CAAC;CACvB,CAAC;AAEF;;;;;;GAMG;AAEH,iBAAe,UAAU,CAAC,CAAC,GAAG,GAAG,EAC/B,KAAK,EAAE,UAAU,GAChB,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAO5B;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -0,0 +1,17 @@
1
+ import { makeRequest } from "./_makeRequest";
2
+ /**
3
+ * Sends a GET request to the specified URL with optional headers.
4
+ *
5
+ * @template T - The expected type of the response data.
6
+ * @param {InputProps} input - The options for the GET request, including URL, URL parameters, and headers.
7
+ * @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
8
+ */
9
+ async function getRequest(input) {
10
+ return makeRequest({
11
+ method: "GET",
12
+ url: input.url,
13
+ urlParams: input.urlParams,
14
+ headers: input.headers,
15
+ });
16
+ }
17
+ export { getRequest };
@@ -0,0 +1,17 @@
1
+ import { type ApiResponseDTO } from "./_makeRequest";
2
+ type InputProps = {
3
+ url: string;
4
+ urlParams?: Record<string, string>;
5
+ headers?: HeadersInit;
6
+ body?: any;
7
+ };
8
+ /**
9
+ * Sends a PATCH request to the specified URL with optional headers and body.
10
+ *
11
+ * @template T - The expected type of the response data.
12
+ * @param {InputProps} input - The options for the PATCH request, including URL, URL parameters, headers, and body.
13
+ * @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
14
+ */
15
+ declare function patchRequest<T = any>(input: InputProps): Promise<ApiResponseDTO<T>>;
16
+ export { patchRequest };
17
+ //# sourceMappingURL=patchRequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"patchRequest.d.ts","sourceRoot":"","sources":["../../../src/http/api/patchRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAElE,KAAK,UAAU,GAAG;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ,CAAC;AAEF;;;;;;GAMG;AAEH,iBAAe,YAAY,CAAC,CAAC,GAAG,GAAG,EACjC,KAAK,EAAE,UAAU,GAChB,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAQ5B;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { makeRequest } from "./_makeRequest";
2
+ /**
3
+ * Sends a PATCH request to the specified URL with optional headers and body.
4
+ *
5
+ * @template T - The expected type of the response data.
6
+ * @param {InputProps} input - The options for the PATCH request, including URL, URL parameters, headers, and body.
7
+ * @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
8
+ */
9
+ async function patchRequest(input) {
10
+ return makeRequest({
11
+ method: "PATCH",
12
+ url: input.url,
13
+ urlParams: input.urlParams,
14
+ headers: input.headers,
15
+ body: input.body,
16
+ });
17
+ }
18
+ export { patchRequest };
@@ -0,0 +1,17 @@
1
+ import { type ApiResponseDTO } from "./_makeRequest";
2
+ type InputProps = {
3
+ url: string;
4
+ urlParams?: Record<string, string>;
5
+ headers?: HeadersInit;
6
+ body?: any;
7
+ };
8
+ /**
9
+ * Sends a POST request to the specified URL with optional headers and body.
10
+ *
11
+ * @template T - The expected type of the response data.
12
+ * @param {InputProps} input - The options for the POST request, including URL, URL parameters, headers, and body.
13
+ * @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
14
+ */
15
+ declare function postRequest<T = any>(input: InputProps): Promise<ApiResponseDTO<T>>;
16
+ export { postRequest };
17
+ //# sourceMappingURL=postRequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"postRequest.d.ts","sourceRoot":"","sources":["../../../src/http/api/postRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAElE,KAAK,UAAU,GAAG;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ,CAAC;AAEF;;;;;;GAMG;AAEH,iBAAe,WAAW,CAAC,CAAC,GAAG,GAAG,EAChC,KAAK,EAAE,UAAU,GAChB,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAQ5B;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { makeRequest } from "./_makeRequest";
2
+ /**
3
+ * Sends a POST request to the specified URL with optional headers and body.
4
+ *
5
+ * @template T - The expected type of the response data.
6
+ * @param {InputProps} input - The options for the POST request, including URL, URL parameters, headers, and body.
7
+ * @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
8
+ */
9
+ async function postRequest(input) {
10
+ return makeRequest({
11
+ method: "POST",
12
+ url: input.url,
13
+ urlParams: input.urlParams,
14
+ headers: input.headers,
15
+ body: input.body,
16
+ });
17
+ }
18
+ export { postRequest };
@@ -0,0 +1,17 @@
1
+ import { type ApiResponseDTO } from "./_makeRequest";
2
+ type InputProps = {
3
+ url: string;
4
+ urlParams?: Record<string, string>;
5
+ headers?: HeadersInit;
6
+ body?: any;
7
+ };
8
+ /**
9
+ * Sends a PUT request to the specified URL with optional headers and body.
10
+ *
11
+ * @template T - The expected type of the response data.
12
+ * @param {InputProps} input - The options for the PUT request, including URL, URL parameters, headers, and body.
13
+ * @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
14
+ */
15
+ declare function putRequest<T = any>(input: InputProps): Promise<ApiResponseDTO<T>>;
16
+ export { putRequest };
17
+ //# sourceMappingURL=putRequest.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"putRequest.d.ts","sourceRoot":"","sources":["../../../src/http/api/putRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,KAAK,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAElE,KAAK,UAAU,GAAG;IAChB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,IAAI,CAAC,EAAE,GAAG,CAAC;CACZ,CAAC;AAEF;;;;;;GAMG;AAEH,iBAAe,UAAU,CAAC,CAAC,GAAG,GAAG,EAC/B,KAAK,EAAE,UAAU,GAChB,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAQ5B;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { makeRequest } from "./_makeRequest";
2
+ /**
3
+ * Sends a PUT request to the specified URL with optional headers and body.
4
+ *
5
+ * @template T - The expected type of the response data.
6
+ * @param {InputProps} input - The options for the PUT request, including URL, URL parameters, headers, and body.
7
+ * @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
8
+ */
9
+ async function putRequest(input) {
10
+ return makeRequest({
11
+ method: "PUT",
12
+ url: input.url,
13
+ urlParams: input.urlParams,
14
+ headers: input.headers,
15
+ body: input.body,
16
+ });
17
+ }
18
+ export { putRequest };
@@ -0,0 +1,25 @@
1
+ declare class BadResponse {
2
+ private _cause?;
3
+ private _name;
4
+ private _status;
5
+ private _statusText;
6
+ private _debugColor;
7
+ get cause(): any;
8
+ set cause(value: any);
9
+ get name(): string;
10
+ set name(value: string);
11
+ get status(): number;
12
+ set status(value: number);
13
+ get statusText(): string;
14
+ set statusText(value: string);
15
+ get debugColor(): "green" | "yellow" | "cyan" | "red";
16
+ set debugColor(value: "green" | "yellow" | "cyan" | "red");
17
+ onDebug(): void;
18
+ makeBody(): {
19
+ name: string;
20
+ message: string;
21
+ cause: any;
22
+ };
23
+ }
24
+ export { BadResponse };
25
+ //# sourceMappingURL=_badResponse.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"_badResponse.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/_badResponse.ts"],"names":[],"mappings":"AAKA,cAAM,WAAW;IACf,OAAO,CAAC,MAAM,CAAC,CAAM;IACrB,OAAO,CAAC,KAAK,CAAyB;IACtC,OAAO,CAAC,OAAO,CAAe;IAC9B,OAAO,CAAC,WAAW,CAA2B;IAC9C,OAAO,CAAC,WAAW,CAA8C;IAEjE,IAAI,KAAK,IAAI,GAAG,CAEf;IAED,IAAI,KAAK,CAAC,KAAK,EAAE,GAAG,EAEnB;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,OAAO;IAeP,QAAQ;;;;;CAOT;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
@@ -0,0 +1,62 @@
1
+ import { formatJsonString } from "@arkyn/shared";
2
+ import { DebugService } from "../../services/debugService";
3
+ import { flushDebugLogs } from "../../utilities/flushDebugLogs";
4
+ class BadResponse {
5
+ _cause;
6
+ _name = "BadResponse";
7
+ _status = 500;
8
+ _statusText = "Unknown error";
9
+ _debugColor = "red";
10
+ get cause() {
11
+ return this._cause;
12
+ }
13
+ set cause(value) {
14
+ this._cause = value;
15
+ }
16
+ get name() {
17
+ return this._name;
18
+ }
19
+ set name(value) {
20
+ this._name = value;
21
+ }
22
+ get status() {
23
+ return this._status;
24
+ }
25
+ set status(value) {
26
+ this._status = value;
27
+ }
28
+ get statusText() {
29
+ return this._statusText;
30
+ }
31
+ set statusText(value) {
32
+ this._statusText = value;
33
+ }
34
+ get debugColor() {
35
+ return this._debugColor;
36
+ }
37
+ set debugColor(value) {
38
+ if (!["green", "yellow", "cyan", "red"].includes(value))
39
+ return;
40
+ this._debugColor = value;
41
+ }
42
+ onDebug() {
43
+ const debugs = [];
44
+ const { callerInfo, functionName } = DebugService.getCaller();
45
+ debugs.push(`Caller Function: ${functionName}`);
46
+ debugs.push(`Caller Location: ${callerInfo}`);
47
+ if (this._statusText)
48
+ debugs.push(`Message: ${this._statusText}`);
49
+ if (this._cause) {
50
+ debugs.push(`Cause: ${formatJsonString(JSON.stringify(this._cause))}`);
51
+ }
52
+ flushDebugLogs({ scheme: "red", name: this._name, debugs });
53
+ }
54
+ makeBody() {
55
+ return {
56
+ name: this._name,
57
+ message: this._statusText,
58
+ cause: this._cause,
59
+ };
60
+ }
61
+ }
62
+ export { BadResponse };
@@ -1,32 +1,29 @@
1
+ import { BadResponse } from "./_badResponse";
1
2
  /**
2
3
  * Represents an HTTP error response with a status code of 502 (Bad Gateway).
3
4
  * This class is used to standardize the structure of a "Bad Gateway" error response,
4
5
  * including the response body, headers, status, and status text.
5
6
  */
6
- declare class BadGateway {
7
- body: any;
8
- cause?: any;
9
- status: number;
10
- statusText: string;
7
+ declare class BadGateway extends BadResponse {
11
8
  /**
12
9
  * Creates an instance of the `BadGateway` class.
13
10
  *
14
- * @param message - A descriptive message explaining the cause of the error.
15
- * @param cause - Optional additional information about the cause of the error.
11
+ * @param {string} message - A descriptive message explaining the cause of the error.
12
+ * @param {any} cause - Optional additional information about the cause of the error.
16
13
  */
17
14
  constructor(message: string, cause?: any);
18
15
  /**
19
16
  * Converts the `BadGateway` instance into a `Response` object with a JSON body.
20
17
  * This method ensures the response has the appropriate headers, status, and status text.
21
18
  *
22
- * @returns A `Response` object with the serialized JSON body and response metadata.
19
+ * @returns {Response} A `Response` object with the serialized JSON body and response metadata.
23
20
  */
24
21
  toResponse(): Response;
25
22
  /**
26
23
  * Converts the `BadGateway` instance into a `Response` object using the `Response.json` method.
27
24
  * This method is an alternative to `toResponse` for generating JSON error responses.
28
25
  *
29
- * @returns A `Response` object with the JSON body and response metadata.
26
+ * @returns {Response["json"]} A `Response` object with the JSON body and response metadata.
30
27
  */
31
28
  toJson(): Response;
32
29
  }
@@ -1 +1 @@
1
- {"version":3,"file":"badGateway.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/badGateway.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,cAAM,UAAU;IACd,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;IAOxC;;;;;OAKG;IAEH,UAAU,IAAI,QAAQ;IAUtB;;;;;OAKG;IAEH,MAAM,IAAI,QAAQ;CAQnB;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"badGateway.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/badGateway.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;GAIG;AAEH,cAAM,UAAW,SAAQ,WAAW;IAClC;;;;;OAKG;gBAES,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;IAWxC;;;;;OAKG;IAEH,UAAU,IAAI,QAAQ;IAUtB;;;;;OAKG;IAEH,MAAM,IAAI,QAAQ;CAQnB;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -1,31 +1,29 @@
1
- import { httpDebug } from "../../services/httpDebug";
1
+ import { BadResponse } from "./_badResponse";
2
2
  /**
3
3
  * Represents an HTTP error response with a status code of 502 (Bad Gateway).
4
4
  * This class is used to standardize the structure of a "Bad Gateway" error response,
5
5
  * including the response body, headers, status, and status text.
6
6
  */
7
- class BadGateway {
8
- body;
9
- cause;
10
- status = 502;
11
- statusText;
7
+ class BadGateway extends BadResponse {
12
8
  /**
13
9
  * Creates an instance of the `BadGateway` class.
14
10
  *
15
- * @param message - A descriptive message explaining the cause of the error.
16
- * @param cause - Optional additional information about the cause of the error.
11
+ * @param {string} message - A descriptive message explaining the cause of the error.
12
+ * @param {any} cause - Optional additional information about the cause of the error.
17
13
  */
18
14
  constructor(message, cause) {
19
- this.body = { name: "BadGateway", message: message };
15
+ super();
16
+ this.name = "BadGateway";
17
+ this.status = 502;
20
18
  this.statusText = message;
21
19
  this.cause = cause ? JSON.stringify(cause) : undefined;
22
- httpDebug("BadGateway", this.body, this.cause);
20
+ this.onDebug();
23
21
  }
24
22
  /**
25
23
  * Converts the `BadGateway` instance into a `Response` object with a JSON body.
26
24
  * This method ensures the response has the appropriate headers, status, and status text.
27
25
  *
28
- * @returns A `Response` object with the serialized JSON body and response metadata.
26
+ * @returns {Response} A `Response` object with the serialized JSON body and response metadata.
29
27
  */
30
28
  toResponse() {
31
29
  const responseInit = {
@@ -33,20 +31,20 @@ class BadGateway {
33
31
  status: this.status,
34
32
  statusText: this.statusText,
35
33
  };
36
- return new Response(JSON.stringify(this.body), responseInit);
34
+ return new Response(JSON.stringify(this.makeBody()), responseInit);
37
35
  }
38
36
  /**
39
37
  * Converts the `BadGateway` instance into a `Response` object using the `Response.json` method.
40
38
  * This method is an alternative to `toResponse` for generating JSON error responses.
41
39
  *
42
- * @returns A `Response` object with the JSON body and response metadata.
40
+ * @returns {Response["json"]} A `Response` object with the JSON body and response metadata.
43
41
  */
44
42
  toJson() {
45
43
  const responseInit = {
46
44
  status: this.status,
47
45
  statusText: this.statusText,
48
46
  };
49
- return Response.json(this.body, responseInit);
47
+ return Response.json(this.makeBody(), responseInit);
50
48
  }
51
49
  }
52
50
  export { BadGateway };
@@ -1,32 +1,29 @@
1
+ import { BadResponse } from "./_badResponse";
1
2
  /**
2
3
  * Represents an HTTP error response with a status code of 400 (Bad Request).
3
4
  * This class is used to standardize the structure of a "Bad Request" error response,
4
5
  * including the response body, headers, status, and status text.
5
6
  */
6
- declare class BadRequest {
7
- body: any;
8
- cause?: any;
9
- status: number;
10
- statusText: string;
7
+ declare class BadRequest extends BadResponse {
11
8
  /**
12
9
  * Creates an instance of the `BadRequest` class.
13
10
  *
14
- * @param message - A descriptive message explaining the cause of the error.
15
- * @param cause - Optional additional information about the cause of the error.
11
+ * @param {string} message - A descriptive message explaining the cause of the error.
12
+ * @param {any} cause - Optional additional information about the cause of the error.
16
13
  */
17
14
  constructor(message: string, cause?: any);
18
15
  /**
19
16
  * Converts the `BadRequest` instance into a `Response` object with a JSON body.
20
17
  * This method ensures the response has the appropriate headers, status, and status text.
21
18
  *
22
- * @returns A `Response` object with the serialized JSON body and response metadata.
19
+ * @returns {Response} A `Response` object with the serialized JSON body and response metadata.
23
20
  */
24
21
  toResponse(): Response;
25
22
  /**
26
23
  * Converts the `BadRequest` instance into a `Response` object using the `Response.json` method.
27
24
  * This method is an alternative to `toResponse` for generating JSON error responses.
28
25
  *
29
- * @returns A `Response` object with the JSON body and response metadata.
26
+ * @returns {Response["json"]} A `Response` object with the JSON body and response metadata.
30
27
  */
31
28
  toJson(): Response;
32
29
  }
@@ -1 +1 @@
1
- {"version":3,"file":"badRequest.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/badRequest.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,cAAM,UAAU;IACd,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;IAOxC;;;;;OAKG;IAEH,UAAU,IAAI,QAAQ;IAUtB;;;;;OAKG;IAEH,MAAM,IAAI,QAAQ;CAQnB;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
1
+ {"version":3,"file":"badRequest.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/badRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;GAIG;AAEH,cAAM,UAAW,SAAQ,WAAW;IAClC;;;;;OAKG;gBAES,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;IAWxC;;;;;OAKG;IAEH,UAAU,IAAI,QAAQ;IAUtB;;;;;OAKG;IAEH,MAAM,IAAI,QAAQ;CAQnB;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}