@arkyn/server 3.0.1-beta.12 → 3.0.1-beta.121

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 +1518 -0
  3. package/dist/bundle.umd.cjs +5 -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 +22 -0
  26. package/dist/http/badResponses/_badResponse.d.ts.map +1 -0
  27. package/dist/http/badResponses/_badResponse.js +51 -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 +12 -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 +10 -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 +18 -21
  55. package/dist/http/successResponses/_successResponse.d.ts +33 -0
  56. package/dist/http/successResponses/_successResponse.d.ts.map +1 -0
  57. package/dist/http/successResponses/_successResponse.js +66 -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 +59 -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 +6 -6
  104. package/dist/utilities/formParse.d.ts.map +1 -0
  105. package/dist/{services → utilities}/formParse.js +10 -8
  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 +44 -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 +34 -18
  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 -83
  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
@@ -1,111 +0,0 @@
1
- import { deleteRequest } from "../api/deleteRequest";
2
- import { getRequest } from "../api/getRequest";
3
- import { patchRequest } from "../api/patchRequest";
4
- import { postRequest } from "../api/postRequest";
5
- import { putRequest } from "../api/putRequest";
6
- /**
7
- * Class representing an API instance to handle HTTP requests with base configurations.
8
- */
9
- class ApiInstance {
10
- baseUrl;
11
- baseHeaders;
12
- baseToken;
13
- /**
14
- * Creates an instance of ApiInstance.
15
- * @param props - The configuration properties for the API instance.
16
- * @param props.baseUrl - The base URL for the API.
17
- * @param props.baseHeaders - Optional base headers to include in all requests.
18
- * @param props.baseToken - Optional base token for authorization.
19
- */
20
- constructor(props) {
21
- this.baseUrl = props.baseUrl;
22
- this.baseHeaders = props.baseHeaders || undefined;
23
- this.baseToken = props.baseToken || undefined;
24
- }
25
- /**
26
- * Generates the full URL by appending the route to the base URL.
27
- * @param route - The route to append to the base URL.
28
- * @returns The full URL as a string.
29
- */
30
- generateURL(route) {
31
- return this.baseUrl + route;
32
- }
33
- /**
34
- * Generates the headers for a request by merging base headers, provided headers, and tokens.
35
- * @param initHeaders - Initial headers to include in the request.
36
- * @param token - Optional token to override the base token.
37
- * @returns The merged headers as a HeadersInit object.
38
- */
39
- generateHeaders(initHeaders, token) {
40
- let headers = {};
41
- if (this.baseToken)
42
- headers = { Authorization: `Bearer ${this.baseToken}` };
43
- if (this.baseHeaders)
44
- headers = { ...headers, ...this.baseHeaders };
45
- if (initHeaders)
46
- headers = { ...headers, ...initHeaders };
47
- if (token)
48
- headers = { ...headers, Authorization: `Bearer ${token}` };
49
- return headers;
50
- }
51
- /**
52
- * Sends a get request to the specified route.
53
- * @param route - The API route to send the get request to.
54
- * @param data - The request data, including optional headers and token.
55
- * @returns The API response data.
56
- */
57
- async get(route, data) {
58
- const url = this.generateURL(route);
59
- const headers = this.generateHeaders(data?.headers || {}, data?.token);
60
- return await getRequest(url, headers);
61
- }
62
- /**
63
- * Sends a post request to the specified route.
64
- * @param route - The API route to send the post request to.
65
- * @param data - The request data, including body, optional headers, and token.
66
- * @returns The API response data.
67
- */
68
- async post(route, data) {
69
- const url = this.generateURL(route);
70
- const headers = this.generateHeaders(data?.headers || {}, data?.token);
71
- const body = data?.body;
72
- return await postRequest(url, headers, body);
73
- }
74
- /**
75
- * Sends a put request to the specified route.
76
- * @param route - The API route to send the put request to.
77
- * @param data - The request data, including body, optional headers, and token.
78
- * @returns The API response data.
79
- */
80
- async put(route, data) {
81
- const url = this.generateURL(route);
82
- const headers = this.generateHeaders(data?.headers || {}, data?.token);
83
- const body = data?.body;
84
- return await putRequest(url, headers, body);
85
- }
86
- /**
87
- * Sends a patch request to the specified route.
88
- * @param route - The API route to send the patch request to.
89
- * @param data - The request data, including body, optional headers, and token.
90
- * @returns The API response data.
91
- */
92
- async patch(route, data) {
93
- const url = this.generateURL(route);
94
- const headers = this.generateHeaders(data?.headers || {}, data?.token);
95
- const body = data?.body;
96
- return await patchRequest(url, headers, body);
97
- }
98
- /**
99
- * Sends a delete request to the specified route.
100
- * @param route - The API route to send the delete request to.
101
- * @param data - The request data, including body, optional headers, and token.
102
- * @returns The API response data.
103
- */
104
- async delete(route, data) {
105
- const url = this.generateURL(route);
106
- const headers = this.generateHeaders(data?.headers || {}, data?.token);
107
- const body = data?.body;
108
- return await deleteRequest(url, headers, body);
109
- }
110
- }
111
- export { ApiInstance };
@@ -1,44 +0,0 @@
1
- type ArkynConfigProps = {
2
- arkynTrafficSourceId: string;
3
- arkynUserToken: string;
4
- arkynApiUrl: string;
5
- };
6
- type SetArkynConfigProps = {
7
- arkynTrafficSourceId: string;
8
- arkynUserToken: string;
9
- arkynLogBaseApiUrl?: string;
10
- };
11
- /**
12
- * The `ArkynLogInstance` class manages the configuration for the arkyn flow.
13
- * It allows you to set and retrieve the arkyn configuration, including the traffic source ID,
14
- * user token, and API URL.
15
- */
16
- declare class ArkynLogInstance {
17
- private static arkynConfig?;
18
- /**
19
- * Sets the configuration for the arkyn. This method initializes the arkyn configuration
20
- * with the provided `arkynConfig` values. If the configuration has already been set,
21
- * the method will return early without making any changes.
22
- *
23
- * @param arkynConfig - An object containing the arkyn configuration properties.
24
- * @param arkynConfig.arkynTrafficSourceId - The key used to identify the arkyn.
25
- * @param arkynConfig.arkynUserToken - The user token for authenticating with the arkyn.
26
- * @param arkynConfig.arkynLogBaseApiUrl - (Optional) The API URL for the arkyn. If not provided,
27
- * a default URL will be used.
28
- */
29
- static setArkynConfig(arkynConfig: SetArkynConfigProps): void;
30
- /**
31
- * Retrieves the current arkyn configuration for the ArkynLogInstance.
32
- *
33
- * @returns {ArkynConfigProps | undefined} The current arkyn configuration if set,
34
- * or `undefined` if no configuration has been initialized.
35
- */
36
- static getArkynConfig(): ArkynConfigProps | undefined;
37
- /**
38
- * Resets the arkyn configuration to `undefined`.
39
- * This method can be used to clear the current configuration.
40
- */
41
- static resetArkynConfig(): void;
42
- }
43
- export { ArkynLogInstance };
44
- //# sourceMappingURL=arkynLogInstance.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"arkynLogInstance.d.ts","sourceRoot":"","sources":["../../src/config/arkynLogInstance.ts"],"names":[],"mappings":"AAAA,KAAK,gBAAgB,GAAG;IACtB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,WAAW,EAAE,MAAM,CAAC;CACrB,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACzB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,cAAc,EAAE,MAAM,CAAC;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,CAAC;AAEF;;;;GAIG;AAEH,cAAM,gBAAgB;IACpB,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAmB;IAE9C;;;;;;;;;;OAUG;IAEH,MAAM,CAAC,cAAc,CAAC,WAAW,EAAE,mBAAmB;IAgBtD;;;;;OAKG;IACH,MAAM,CAAC,cAAc,IAAI,gBAAgB,GAAG,SAAS;IAIrD;;;OAGG;IAEH,MAAM,CAAC,gBAAgB;CAGxB;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -1,49 +0,0 @@
1
- /**
2
- * The `ArkynLogInstance` class manages the configuration for the arkyn flow.
3
- * It allows you to set and retrieve the arkyn configuration, including the traffic source ID,
4
- * user token, and API URL.
5
- */
6
- class ArkynLogInstance {
7
- static arkynConfig;
8
- /**
9
- * Sets the configuration for the arkyn. This method initializes the arkyn configuration
10
- * with the provided `arkynConfig` values. If the configuration has already been set,
11
- * the method will return early without making any changes.
12
- *
13
- * @param arkynConfig - An object containing the arkyn configuration properties.
14
- * @param arkynConfig.arkynTrafficSourceId - The key used to identify the arkyn.
15
- * @param arkynConfig.arkynUserToken - The user token for authenticating with the arkyn.
16
- * @param arkynConfig.arkynLogBaseApiUrl - (Optional) The API URL for the arkyn. If not provided,
17
- * a default URL will be used.
18
- */
19
- static setArkynConfig(arkynConfig) {
20
- if (!!this.arkynConfig)
21
- return;
22
- let defaultArkynURL = `https://logs-arkyn-flow-logs.vw6wo7.easypanel.host`;
23
- let arkynLogBaseApiUrl = arkynConfig.arkynLogBaseApiUrl || defaultArkynURL;
24
- arkynLogBaseApiUrl =
25
- arkynLogBaseApiUrl + "/http-traffic-records/:trafficSourceId";
26
- this.arkynConfig = {
27
- arkynTrafficSourceId: arkynConfig.arkynTrafficSourceId,
28
- arkynUserToken: arkynConfig.arkynUserToken,
29
- arkynApiUrl: arkynLogBaseApiUrl,
30
- };
31
- }
32
- /**
33
- * Retrieves the current arkyn configuration for the ArkynLogInstance.
34
- *
35
- * @returns {ArkynConfigProps | undefined} The current arkyn configuration if set,
36
- * or `undefined` if no configuration has been initialized.
37
- */
38
- static getArkynConfig() {
39
- return this.arkynConfig;
40
- }
41
- /**
42
- * Resets the arkyn configuration to `undefined`.
43
- * This method can be used to clear the current configuration.
44
- */
45
- static resetArkynConfig() {
46
- this.arkynConfig = undefined;
47
- }
48
- }
49
- export { ArkynLogInstance };
@@ -1,30 +0,0 @@
1
- type InputProps = {
2
- status: number;
3
- url: string;
4
- method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
5
- requestHeaders: HeadersInit;
6
- responseHeaders: HeadersInit;
7
- requestBody: any;
8
- elapsedTime: number;
9
- responseBody: any;
10
- queryParams: URLSearchParams;
11
- };
12
- type OutputProps = {
13
- rawUrl: string;
14
- status: number;
15
- method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
16
- token: string | null;
17
- elapsedTime: number;
18
- requestHeaders: Record<string, string>;
19
- requestBody: Record<string, string>;
20
- queryParams: Record<string, string>;
21
- responseHeaders: Record<string, string>;
22
- responseBody: any;
23
- };
24
- declare class ArkynLogRequestMapper {
25
- private static mapHeaders;
26
- private static mapQueryParams;
27
- static handle(props: InputProps): OutputProps;
28
- }
29
- export { ArkynLogRequestMapper };
30
- //# sourceMappingURL=arkynLogRequestMapper.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"arkynLogRequestMapper.d.ts","sourceRoot":"","sources":["../../src/mapper/arkynLogRequestMapper.ts"],"names":[],"mappings":"AAAA,KAAK,UAAU,GAAG;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpD,cAAc,EAAE,WAAW,CAAC;IAC5B,eAAe,EAAE,WAAW,CAAC;IAC7B,WAAW,EAAE,GAAG,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,GAAG,CAAC;IAClB,WAAW,EAAE,eAAe,CAAC;CAC9B,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,YAAY,EAAE,GAAG,CAAC;CACnB,CAAC;AAEF,cAAM,qBAAqB;IACzB,OAAO,CAAC,MAAM,CAAC,UAAU;IAkBzB,OAAO,CAAC,MAAM,CAAC,cAAc;IAY7B,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,WAAW;CAc9C;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
@@ -1,44 +0,0 @@
1
- class ArkynLogRequestMapper {
2
- static mapHeaders(headers) {
3
- if (headers instanceof Headers) {
4
- return Object.fromEntries(headers.entries());
5
- }
6
- else if (typeof headers === "object") {
7
- return Object.entries(headers).reduce((acc, [key, value]) => {
8
- if (typeof value === "string") {
9
- acc[key] = value;
10
- }
11
- else if (Array.isArray(value)) {
12
- acc[key] = value.join(", ");
13
- }
14
- else {
15
- acc[key] = JSON.stringify(value);
16
- }
17
- return acc;
18
- }, {});
19
- }
20
- return {};
21
- }
22
- static mapQueryParams(queryParams) {
23
- const params = {};
24
- queryParams.forEach((value, key) => {
25
- params[key] = value;
26
- });
27
- return params;
28
- }
29
- static handle(props) {
30
- return {
31
- rawUrl: props.url,
32
- status: props.status,
33
- method: props.method,
34
- token: null,
35
- elapsedTime: props.elapsedTime,
36
- requestHeaders: this.mapHeaders(props.requestHeaders),
37
- requestBody: props.requestBody || null,
38
- queryParams: this.mapQueryParams(props.queryParams),
39
- responseHeaders: this.mapHeaders(props.responseHeaders),
40
- responseBody: props.responseBody || null,
41
- };
42
- }
43
- }
44
- export { ArkynLogRequestMapper };
@@ -1 +0,0 @@
1
- {"version":3,"file":"decodeErrorMessageFromRequest.d.ts","sourceRoot":"","sources":["../../src/services/decodeErrorMessageFromRequest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,iBAAS,6BAA6B,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAkB5E;AAED,OAAO,EAAE,6BAA6B,EAAE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"decodeRequestBody.d.ts","sourceRoot":"","sources":["../../src/services/decodeRequestBody.ts"],"names":[],"mappings":"AAEA,KAAK,yBAAyB,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AAEpE;;;;;;;;;;;;GAYG;AAEH,QAAA,MAAM,iBAAiB,EAAE,yBAsBxB,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
@@ -1,44 +0,0 @@
1
- /**
2
- * Handles errors and converts them into appropriate HTTP responses.
3
- *
4
- * This function takes an error object and determines its type to return
5
- * the corresponding HTTP response. It supports both success and error
6
- * response types, converting them into a standardized format using the
7
- * `toResponse` method when applicable.
8
- *
9
- * @param error - The error object to handle. It can be an instance of various
10
- * HTTP response classes or a generic error.
11
- *
12
- * @returns The corresponding HTTP response object if the error matches a known
13
- * type, or `undefined` if no match is found.
14
- *
15
- * ### Supported Success Responses:
16
- * - `Found`
17
- * - `Created`
18
- * - `Updated`
19
- * - `Success`
20
- * - `NoContent`
21
- *
22
- * ### Supported Error Responses:
23
- * - `BadGateway`
24
- * - `BadRequest`
25
- * - `Conflict`
26
- * - `Forbidden`
27
- * - `NotFound`
28
- * - `NotImplemented`
29
- * - `ServerError`
30
- * - `Unauthorized`
31
- * - `UnprocessableEntity`
32
- *
33
- * ### Example Usage:
34
- * ```typescript
35
- * try {
36
- * // Some operation that might throw an error
37
- * } catch (error) {
38
- * return errorHandler(error);
39
- * }
40
- * ```
41
- */
42
- declare function errorHandler(error: any): Response;
43
- export { errorHandler };
44
- //# sourceMappingURL=errorHandler.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"errorHandler.d.ts","sourceRoot":"","sources":["../../src/services/errorHandler.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,iBAAS,YAAY,CAAC,KAAK,EAAE,GAAG,GAAG,QAAQ,CAsC1C;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"formParse.d.ts","sourceRoot":"","sources":["../../src/services/formParse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,KAAK,CAAC;AAElC,KAAK,eAAe,CAAC,CAAC,SAAS,cAAc,IAAI;IAC/C,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;CAChD,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,OAAO,EAAE,KAAK,CAAC;IACf,MAAM,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAChC,WAAW,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CACtC,CAAC;AAEF,KAAK,cAAc,GAAG,CAAC,QAAQ,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AAEvE,KAAK,mBAAmB,CAAC,CAAC,SAAS,cAAc,IAC7C,eAAe,CAAC,CAAC,CAAC,GAClB,aAAa,CAAC;AAElB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,iBAAS,SAAS,CAAC,CAAC,SAAS,cAAc,EAAE,CAC3C,QAAQ,EACR,MAAM,EACP,EAAE,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAmB5B;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -1,17 +0,0 @@
1
- /**
2
- * Retrieves information about the caller of the current function.
3
- *
4
- * This function analyzes the stack trace to determine the file path and function name
5
- * of the caller. It excludes stack trace entries related to the `@arkyn/server` package
6
- * and attempts to resolve the file path relative to the project root directory.
7
- *
8
- * @returns An object containing:
9
- * - `functionName`: The name of the function that called the current function, or "Unknown function" if it cannot be determined.
10
- * - `callerInfo`: The file path of the caller relative to the project root, or "Unknown caller" if it cannot be determined.
11
- */
12
- declare function getCaller(): {
13
- functionName: string;
14
- callerInfo: string;
15
- };
16
- export { getCaller };
17
- //# sourceMappingURL=getCaller.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getCaller.d.ts","sourceRoot":"","sources":["../../src/services/getCaller.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;GAUG;AACH,iBAAS,SAAS;;;EAkEjB;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -1,65 +0,0 @@
1
- import path from "path";
2
- /**
3
- * Retrieves information about the caller of the current function.
4
- *
5
- * This function analyzes the stack trace to determine the file path and function name
6
- * of the caller. It excludes stack trace entries related to the `@arkyn/server` package
7
- * and attempts to resolve the file path relative to the project root directory.
8
- *
9
- * @returns An object containing:
10
- * - `functionName`: The name of the function that called the current function, or "Unknown function" if it cannot be determined.
11
- * - `callerInfo`: The file path of the caller relative to the project root, or "Unknown caller" if it cannot be determined.
12
- */
13
- function getCaller() {
14
- const projectRoot = process.cwd();
15
- const err = new Error();
16
- const stack = err.stack || "";
17
- const stackLines = stack.split("\n").map((line) => line.trim());
18
- // The first line is the error message
19
- // The second line is this function (getCaller)
20
- // The third line should be the direct caller
21
- // We start from 2 because indexes are zero-based
22
- let callerIndex = 2;
23
- // Ignore internal or infrastructure lines if necessary
24
- while (callerIndex < stackLines.length &&
25
- (stackLines[callerIndex].includes("node:internal") ||
26
- stackLines[callerIndex].includes("/node_modules/"))) {
27
- callerIndex++;
28
- }
29
- const callerLine = stackLines[callerIndex] || "";
30
- let functionName = "Unknown function";
31
- let callerInfo = "Unknown caller";
32
- // Default for named functions: "at functionName (file:line:column)"
33
- const namedFunctionMatch = callerLine.match(/at\s+([^(\s]+)\s+\(([^)]+)\)/);
34
- if (namedFunctionMatch) {
35
- functionName = namedFunctionMatch[1];
36
- callerInfo = namedFunctionMatch[2];
37
- }
38
- // Default for anonymous functions or methods: "at file:line:column"
39
- else {
40
- const anonymousFunctionMatch = callerLine.match(/at\s+(.+)/);
41
- if (anonymousFunctionMatch) {
42
- callerInfo = anonymousFunctionMatch[1];
43
- // Tenta extrair nome da função de padrões como Object.method ou Class.method
44
- const objectMethodMatch = callerInfo.match(/at\s+([^(\s]+)\s+/);
45
- if (objectMethodMatch && objectMethodMatch[1] !== "new") {
46
- functionName = objectMethodMatch[1];
47
- }
48
- }
49
- }
50
- // Handles file paths
51
- if (callerInfo.includes("(")) {
52
- callerInfo = callerInfo.substring(callerInfo.indexOf("(") + 1, callerInfo.lastIndexOf(")"));
53
- }
54
- // Remove the line:column part of the file path
55
- callerInfo = callerInfo.split(":").slice(0, -2).join(":");
56
- // Make the path relative to the project
57
- try {
58
- callerInfo = path.relative(projectRoot, callerInfo);
59
- }
60
- catch (e) {
61
- // If it fails to relativize, use the original path
62
- }
63
- return { functionName, callerInfo };
64
- }
65
- export { getCaller };
@@ -1 +0,0 @@
1
- {"version":3,"file":"getScopedParams.d.ts","sourceRoot":"","sources":["../../src/services/getScopedParams.ts"],"names":[],"mappings":"AAAA,KAAK,uBAAuB,GAAG,CAC7B,OAAO,EAAE,OAAO,EAChB,KAAK,CAAC,EAAE,MAAM,KACX,eAAe,CAAC;AACrB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,QAAA,MAAM,eAAe,EAAE,uBAWtB,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,CAAC"}
@@ -1,35 +0,0 @@
1
- /**
2
- * Logs debug information to the console when in development mode or when the
3
- * `SHOW_ERRORS_IN_CONSOLE` environment variable is set to "true".
4
- *
5
- * This function provides detailed information about the caller function,
6
- * its location, and the provided body and cause, if any.
7
- *
8
- * @param name - A string representing the name or context of the debug log.
9
- * @param body - The main content or data to be logged.
10
- * @param cause - (Optional) Additional information or error cause to be logged.
11
- *
12
- * @remarks
13
- * The debug logs are only displayed when the application is running in
14
- * development mode (`NODE_ENV === "development"`) or when the
15
- * `SHOW_ERRORS_IN_CONSOLE` environment variable is explicitly set to "true".
16
- *
17
- * The logs include:
18
- * - The name of the debug context.
19
- * - The caller function name and its location.
20
- * - The provided body content.
21
- * - The optional cause, if provided.
22
- *
23
- * @example
24
- * ```typescript
25
- * httpDebug("FetchUserData", { userId: 123 });
26
- * ```
27
- *
28
- * @example
29
- * ```typescript
30
- * httpDebug("FetchUserDataError", { userId: 123 }, new Error("User not found"));
31
- * ```
32
- */
33
- declare function httpDebug(name: string, body: any, cause?: any): void;
34
- export { httpDebug };
35
- //# sourceMappingURL=httpDebug.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"httpDebug.d.ts","sourceRoot":"","sources":["../../src/services/httpDebug.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAEH,iBAAS,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,EAAE,GAAG,QAuBtD;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
@@ -1,52 +0,0 @@
1
- import { getCaller } from "../services/getCaller";
2
- /**
3
- * Logs debug information to the console when in development mode or when the
4
- * `SHOW_ERRORS_IN_CONSOLE` environment variable is set to "true".
5
- *
6
- * This function provides detailed information about the caller function,
7
- * its location, and the provided body and cause, if any.
8
- *
9
- * @param name - A string representing the name or context of the debug log.
10
- * @param body - The main content or data to be logged.
11
- * @param cause - (Optional) Additional information or error cause to be logged.
12
- *
13
- * @remarks
14
- * The debug logs are only displayed when the application is running in
15
- * development mode (`NODE_ENV === "development"`) or when the
16
- * `SHOW_ERRORS_IN_CONSOLE` environment variable is explicitly set to "true".
17
- *
18
- * The logs include:
19
- * - The name of the debug context.
20
- * - The caller function name and its location.
21
- * - The provided body content.
22
- * - The optional cause, if provided.
23
- *
24
- * @example
25
- * ```typescript
26
- * httpDebug("FetchUserData", { userId: 123 });
27
- * ```
28
- *
29
- * @example
30
- * ```typescript
31
- * httpDebug("FetchUserDataError", { userId: 123 }, new Error("User not found"));
32
- * ```
33
- */
34
- function httpDebug(name, body, cause) {
35
- const isDebugMode = process.env.NODE_ENV === "development" ||
36
- process.env?.SHOW_ERRORS_IN_CONSOLE === "true";
37
- if (isDebugMode) {
38
- const reset = "\x1b[0m";
39
- const cyan = "\x1b[36m";
40
- const debugName = `${cyan}[ARKYN-DEBUG]${reset}`;
41
- const { callerInfo, functionName } = getCaller();
42
- let consoleData = `${debugName} ${name} initialized\n`;
43
- consoleData += `${debugName} Caller Function: ${functionName}\n`;
44
- consoleData += `${debugName} Caller Location: ${callerInfo}\n`;
45
- consoleData += `${debugName} Body: ${JSON.stringify(body, null, 2)}\n`;
46
- if (cause) {
47
- consoleData += `${debugName} Cause: ${JSON.stringify(cause, null, 2)}\n`;
48
- }
49
- console.log(consoleData);
50
- }
51
- }
52
- export { httpDebug };
@@ -1,3 +0,0 @@
1
- declare function measureRouteExecution<T = unknown>(handler: (props: any) => Promise<T>): (props: any) => Promise<T>;
2
- export { measureRouteExecution };
3
- //# sourceMappingURL=measureRouteExecution.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"measureRouteExecution.d.ts","sourceRoot":"","sources":["../../src/services/measureRouteExecution.ts"],"names":[],"mappings":"AAAA,iBAAS,qBAAqB,CAAC,CAAC,GAAG,OAAO,EACxC,OAAO,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC,CAAC,CAAC,IAEG,OAAO,GAAG,KAAG,OAAO,CAAC,CAAC,CAAC,CAyB9D;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
@@ -1,24 +0,0 @@
1
- function measureRouteExecution(handler) {
2
- return async function measuredHandler(props) {
3
- const startTime = performance.now();
4
- try {
5
- const result = await handler(props);
6
- const url = new URL(props.request.url);
7
- const endTime = performance.now();
8
- const duration = (endTime - startTime).toFixed(2);
9
- console.log({
10
- domain: url.hostname,
11
- pathname: url.pathname,
12
- method: props.request.method,
13
- duration,
14
- });
15
- return result;
16
- }
17
- catch (error) {
18
- const endTime = performance.now();
19
- console.error("");
20
- throw error;
21
- }
22
- };
23
- }
24
- export { measureRouteExecution };
@@ -1,13 +0,0 @@
1
- import { Schema, z } from "zod";
2
- declare class SchemaValidator<T extends Schema> {
3
- readonly schema: T;
4
- functionName: string;
5
- callerInfo: string;
6
- constructor(schema: T);
7
- isValid(data: any): boolean;
8
- safeValidate(data: any): z.SafeParseReturnType<z.infer<T>, z.infer<T>>;
9
- validate(data: any): z.infer<T>;
10
- formValidate(data: any, message?: string): z.infer<T>;
11
- }
12
- export { SchemaValidator };
13
- //# sourceMappingURL=schemaValidator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"schemaValidator.d.ts","sourceRoot":"","sources":["../../src/services/schemaValidator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAiBhC,cAAM,eAAe,CAAC,CAAC,SAAS,MAAM;IAIxB,QAAQ,CAAC,MAAM,EAAE,CAAC;IAH9B,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;gBAEE,MAAM,EAAE,CAAC;IAM9B,OAAO,CAAC,IAAI,EAAE,GAAG,GAAG,OAAO;IAI3B,YAAY,CAAC,IAAI,EAAE,GAAG,GAAG,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAItE,QAAQ,CAAC,IAAI,EAAE,GAAG,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;IAQ/B,YAAY,CAAC,IAAI,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC;CAoBtD;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
@@ -1,51 +0,0 @@
1
- import { Schema, z } from "zod";
2
- import { ServerError } from "../http/badResponses/serverError";
3
- import { UnprocessableEntity } from "../http/badResponses/unprocessableEntity";
4
- import { formParse } from "./formParse";
5
- import { getCaller } from "./getCaller";
6
- import { httpDebug } from "./httpDebug";
7
- function formatErrorMessage(error) {
8
- const title = "Error validating:";
9
- const lines = error.issues.map(({ path, message }) => `-> ${path.join(".")}: ${message}`);
10
- return [title, ...lines].join("\n");
11
- }
12
- class SchemaValidator {
13
- schema;
14
- functionName;
15
- callerInfo;
16
- constructor(schema) {
17
- this.schema = schema;
18
- const { callerInfo, functionName } = getCaller();
19
- this.callerInfo = callerInfo;
20
- this.functionName = functionName;
21
- }
22
- isValid(data) {
23
- return this.schema.safeParse(data).success;
24
- }
25
- safeValidate(data) {
26
- return this.schema.safeParse(data);
27
- }
28
- validate(data) {
29
- try {
30
- return this.schema.parse(data);
31
- }
32
- catch (error) {
33
- throw new ServerError(formatErrorMessage(error));
34
- }
35
- }
36
- formValidate(data, message) {
37
- const formParsed = formParse([data, this.schema]);
38
- if (!formParsed.success) {
39
- httpDebug("UnprocessableEntity", formParsed);
40
- const firstErrorKey = Object.keys(formParsed.fieldErrors)[0];
41
- throw new UnprocessableEntity({
42
- fields: formParsed.fields,
43
- fieldErrors: formParsed.fieldErrors,
44
- data: { scrollTo: firstErrorKey },
45
- message,
46
- }, false);
47
- }
48
- return formParsed.data;
49
- }
50
- }
51
- export { SchemaValidator };
@@ -1,17 +0,0 @@
1
- type ApiSuccessResponse<T = any> = {
2
- success: true;
3
- status: number;
4
- message: string;
5
- response: T;
6
- cause: null;
7
- };
8
- type ApiFailedResponse = {
9
- success: false;
10
- status: number;
11
- message: string;
12
- response: any;
13
- cause: string | Error | null;
14
- };
15
- type ApiResponseDTO<T = any> = ApiSuccessResponse<T> | ApiFailedResponse;
16
- export type { ApiResponseDTO };
17
- //# sourceMappingURL=ApiResponseDTO.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ApiResponseDTO.d.ts","sourceRoot":"","sources":["../../src/types/ApiResponseDTO.ts"],"names":[],"mappings":"AAAA,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,YAAY,EAAE,cAAc,EAAE,CAAC"}