@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
package/dist/bundle.js ADDED
@@ -0,0 +1,1518 @@
1
+ var k = Object.defineProperty;
2
+ var w = (e, s, t) => s in e ? k(e, s, { enumerable: !0, configurable: !0, writable: !0, value: t }) : e[s] = t;
3
+ var c = (e, s, t) => w(e, typeof s != "symbol" ? s + "" : s, t);
4
+ import "zod";
5
+ import { removeNonNumeric as R, ValidateDateService as j } from "@arkyn/shared";
6
+ import J from "node:dns";
7
+ import { countries as _ } from "@arkyn/templates";
8
+ const I = {};
9
+ class S {
10
+ /**
11
+ * Sets the file name to be ignored during stack trace analysis.
12
+ *
13
+ * This method configures the debug service to skip specific files when
14
+ * determining the actual caller of a function. This is useful when you have
15
+ * adapter or wrapper functions that you want to be transparent in the debug output.
16
+ *
17
+ * @param {string} file - The name of the file to ignore in stack traces (e.g., "httpAdapter.ts")
18
+ *
19
+ * @example
20
+ * ```typescript
21
+ * // Ignore the HTTP adapter file so debug shows the actual business logic caller
22
+ * DebugService.setIgnoreFile("httpAdapter.ts");
23
+ * ```
24
+ */
25
+ static setIgnoreFile(s) {
26
+ this.ignoreFiles.push(s);
27
+ }
28
+ /**
29
+ * Clears all configured ignore files.
30
+ *
31
+ * This method resets the ignore file configuration, allowing all files to be
32
+ * considered in stack trace analysis again.
33
+ *
34
+ * @example
35
+ * ```typescript
36
+ * // Clear all ignore file configurations
37
+ * DebugService.clearIgnoreFiles();
38
+ * ```
39
+ */
40
+ static clearIgnoreFiles() {
41
+ this.ignoreFiles = [];
42
+ }
43
+ /**
44
+ * Retrieves information about the caller of the current function.
45
+ *
46
+ * This function analyzes the stack trace to determine the file path and function name
47
+ * of the caller. It excludes stack trace entries related to the `@arkyn/server` package
48
+ * and attempts to resolve the file path relative to the project root directory.
49
+ *
50
+ * @returns An object containing:
51
+ * - `functionName`: The name of the function that called the current function, or "Unknown function" if it cannot be determined.
52
+ * - `callerInfo`: The file path of the caller relative to the project root, or "Unknown caller" if it cannot be determined.
53
+ */
54
+ static getCaller() {
55
+ const s = process.cwd(), r = (new Error().stack || "").split(`
56
+ `).map((l) => l.trim());
57
+ let o = 2;
58
+ for (; o < r.length && (r[o].includes("node:internal") || r[o].includes("/node_modules/")); )
59
+ o++;
60
+ if (this.ignoreFiles.length > 0)
61
+ for (; o < r.length && this.ignoreFiles.some(
62
+ (l) => r[o].includes(l)
63
+ ); )
64
+ o++;
65
+ const a = r[o] || "";
66
+ let u = "Unknown function", i = "Unknown caller";
67
+ const h = a.match(/at\s+([^(\s]+)\s+\(([^)]+)\)/);
68
+ if (h)
69
+ u = h[1], i = h[2];
70
+ else {
71
+ const l = a.match(/at\s+(.+)/);
72
+ if (l) {
73
+ i = l[1];
74
+ const d = i.match(/at\s+([^(\s]+)\s+/);
75
+ d && d[1] !== "new" && (u = d[1]);
76
+ }
77
+ }
78
+ i.includes("(") && (i = i.substring(
79
+ i.indexOf("(") + 1,
80
+ i.lastIndexOf(")")
81
+ )), i = i.split(":").slice(0, -2).join(":");
82
+ try {
83
+ i = I.relative(s, i);
84
+ } catch {
85
+ }
86
+ return { functionName: u, callerInfo: i };
87
+ }
88
+ }
89
+ /**
90
+ * The name of the file to ignore when analyzing the stack trace.
91
+ * When set, the `getCaller` function will skip stack frames containing this file name.
92
+ */
93
+ c(S, "ignoreFiles", []);
94
+ function p(e) {
95
+ var t;
96
+ if (process.env.NODE_ENV === "development" || ((t = process.env) == null ? void 0 : t.DEBUG_MODE) === "true") {
97
+ const o = `${{
98
+ yellow: "\x1B[33m",
99
+ cyan: "\x1B[36m",
100
+ red: "\x1B[31m",
101
+ green: "\x1B[32m"
102
+ }[e.scheme]}[${e.name}]\x1B[0m`;
103
+ let a = `
104
+ `;
105
+ e.debugs.forEach((u) => {
106
+ a += `${o} ${u.trim()}
107
+ `;
108
+ }), console.log(a);
109
+ }
110
+ }
111
+ class f {
112
+ constructor() {
113
+ c(this, "_cause");
114
+ c(this, "_name", "BadResponse");
115
+ c(this, "_status", 500);
116
+ c(this, "_statusText", "Unknown error");
117
+ }
118
+ get cause() {
119
+ return this._cause;
120
+ }
121
+ set cause(s) {
122
+ this._cause = s;
123
+ }
124
+ get name() {
125
+ return this._name;
126
+ }
127
+ set name(s) {
128
+ this._name = s;
129
+ }
130
+ get status() {
131
+ return this._status;
132
+ }
133
+ set status(s) {
134
+ this._status = s;
135
+ }
136
+ get statusText() {
137
+ return this._statusText;
138
+ }
139
+ set statusText(s) {
140
+ this._statusText = s;
141
+ }
142
+ onDebug() {
143
+ const s = [], { callerInfo: t, functionName: n } = S.getCaller();
144
+ s.push(`Caller Function: ${n}`), s.push(`Caller Location: ${t}`), this._statusText && s.push(`Message: ${this._statusText}`), this._cause && s.push(`Cause: ${JSON.stringify(this._cause)}`), p({ scheme: "red", name: this._name, debugs: s });
145
+ }
146
+ makeBody() {
147
+ return {
148
+ name: this._name,
149
+ message: this._statusText,
150
+ cause: this._cause
151
+ };
152
+ }
153
+ }
154
+ class U extends f {
155
+ /**
156
+ * Creates an instance of the `BadGateway` class.
157
+ *
158
+ * @param {string} message - A descriptive message explaining the cause of the error.
159
+ * @param {any} cause - Optional additional information about the cause of the error.
160
+ */
161
+ constructor(s, t) {
162
+ super(), this.name = "BadGateway", this.status = 502, this.statusText = s, this.cause = t ? JSON.stringify(t) : void 0, this.onDebug();
163
+ }
164
+ /**
165
+ * Converts the `BadGateway` instance into a `Response` object with a JSON body.
166
+ * This method ensures the response has the appropriate headers, status, and status text.
167
+ *
168
+ * @returns {Response} A `Response` object with the serialized JSON body and response metadata.
169
+ */
170
+ toResponse() {
171
+ const s = {
172
+ headers: { "Content-Type": "application/json" },
173
+ status: this.status,
174
+ statusText: this.statusText
175
+ };
176
+ return new Response(JSON.stringify(this.makeBody()), s);
177
+ }
178
+ /**
179
+ * Converts the `BadGateway` instance into a `Response` object using the `Response.json` method.
180
+ * This method is an alternative to `toResponse` for generating JSON error responses.
181
+ *
182
+ * @returns {Response["json"]} A `Response` object with the JSON body and response metadata.
183
+ */
184
+ toJson() {
185
+ const s = {
186
+ status: this.status,
187
+ statusText: this.statusText
188
+ };
189
+ return Response.json(this.makeBody(), s);
190
+ }
191
+ }
192
+ class T extends f {
193
+ /**
194
+ * Creates an instance of the `BadRequest` class.
195
+ *
196
+ * @param {string} message - A descriptive message explaining the cause of the error.
197
+ * @param {any} cause - Optional additional information about the cause of the error.
198
+ */
199
+ constructor(s, t) {
200
+ super(), this.name = "BadRequest", this.status = 400, this.statusText = s, this.cause = t ? JSON.stringify(t) : void 0, this.onDebug();
201
+ }
202
+ /**
203
+ * Converts the `BadRequest` instance into a `Response` object with a JSON body.
204
+ * This method ensures the response has the appropriate headers, status, and status text.
205
+ *
206
+ * @returns {Response} A `Response` object with the serialized JSON body and response metadata.
207
+ */
208
+ toResponse() {
209
+ const s = {
210
+ headers: { "Content-Type": "application/json" },
211
+ status: this.status,
212
+ statusText: this.statusText
213
+ };
214
+ return new Response(JSON.stringify(this.makeBody()), s);
215
+ }
216
+ /**
217
+ * Converts the `BadRequest` instance into a `Response` object using the `Response.json` method.
218
+ * This method is an alternative to `toResponse` for generating JSON error responses.
219
+ *
220
+ * @returns {Response["json"]} A `Response` object with the JSON body and response metadata.
221
+ */
222
+ toJson() {
223
+ const s = {
224
+ status: this.status,
225
+ statusText: this.statusText
226
+ };
227
+ return Response.json(this.makeBody(), s);
228
+ }
229
+ }
230
+ class C extends f {
231
+ /**
232
+ * Creates an instance of the `Conflict` class.
233
+ *
234
+ * @param {string} message - A descriptive message explaining the cause of the conflict.
235
+ * @param {any} cause - Optional additional information about the cause of the conflict.
236
+ */
237
+ constructor(s, t) {
238
+ super(), this.name = "Conflict", this.status = 409, this.statusText = s, this.cause = t ? JSON.stringify(t) : void 0, this.onDebug();
239
+ }
240
+ /**
241
+ * Converts the `Conflict` instance into a `Response` object with a JSON body.
242
+ * This method ensures the response has the appropriate headers, status, and status text.
243
+ *
244
+ * @returns {Response} A `Response` object with the serialized JSON body and response metadata.
245
+ */
246
+ toResponse() {
247
+ const s = {
248
+ headers: { "Content-Type": "application/json" },
249
+ status: this.status,
250
+ statusText: this.statusText
251
+ };
252
+ return new Response(JSON.stringify(this.makeBody()), s);
253
+ }
254
+ /**
255
+ * Converts the `Conflict` instance into a `Response` object using the `Response.json` method.
256
+ * This method is an alternative to `toResponse` for generating JSON error responses.
257
+ *
258
+ * @returns {Response["json"]} A `Response` object with the JSON body and response metadata.
259
+ */
260
+ toJson() {
261
+ const s = {
262
+ status: this.status,
263
+ statusText: this.statusText
264
+ };
265
+ return Response.json(this.makeBody(), s);
266
+ }
267
+ }
268
+ class A extends f {
269
+ /**
270
+ * Creates an instance of the `Forbidden` class.
271
+ *
272
+ * @param {string} message - A descriptive message explaining why access is forbidden.
273
+ * @param {any} cause - Optional additional information about the cause of the error.
274
+ */
275
+ constructor(s, t) {
276
+ super(), this.name = "Forbidden", this.status = 403, this.statusText = s, this.cause = t ? JSON.stringify(t) : void 0, this.onDebug();
277
+ }
278
+ /**
279
+ * Converts the `Forbidden` instance into a `Response` object with a JSON body.
280
+ * This method ensures the response has the appropriate headers, status, and status text.
281
+ *
282
+ * @returns {Response} A `Response` object with the serialized JSON body and response metadata.
283
+ */
284
+ toResponse() {
285
+ const s = {
286
+ headers: { "Content-Type": "application/json" },
287
+ status: this.status,
288
+ statusText: this.statusText
289
+ };
290
+ return new Response(JSON.stringify(this.makeBody()), s);
291
+ }
292
+ /**
293
+ * Converts the `Forbidden` instance into a `Response` object using the `Response.json` method.
294
+ * This method is an alternative to `toResponse` for generating JSON error responses.
295
+ *
296
+ * @returns {Response["json"]} A `Response` object with the JSON body and response metadata.
297
+ */
298
+ toJson() {
299
+ const s = {
300
+ status: this.status,
301
+ statusText: this.statusText
302
+ };
303
+ return Response.json(this.makeBody(), s);
304
+ }
305
+ }
306
+ class q extends f {
307
+ /**
308
+ * Creates an instance of the `NotFound` class.
309
+ *
310
+ * @param {string} message - A descriptive message explaining the reason the resource was not found.
311
+ * @param {any} cause - Optional additional information about the cause of the error.
312
+ */
313
+ constructor(s, t) {
314
+ super(), this.name = "NotFound", this.status = 404, this.statusText = s, this.cause = t ? JSON.stringify(t) : void 0, this.onDebug();
315
+ }
316
+ /**
317
+ * Converts the `NotFound` instance into a `Response` object with a JSON body.
318
+ * This method ensures the response has the appropriate headers, status, and status text.
319
+ *
320
+ * @returns {Response} A `Response` object with the serialized JSON body and response metadata.
321
+ */
322
+ toResponse() {
323
+ const s = {
324
+ headers: { "Content-Type": "application/json" },
325
+ status: this.status,
326
+ statusText: this.statusText
327
+ };
328
+ return new Response(JSON.stringify(this.makeBody()), s);
329
+ }
330
+ /**
331
+ * Converts the `NotFound` instance into a `Response` object using the `Response.json` method.
332
+ * This method is an alternative to `toResponse` for generating JSON error responses.
333
+ *
334
+ * @returns {Response["json"]} A `Response` object with the JSON body and response metadata.
335
+ */
336
+ toJson() {
337
+ const s = {
338
+ status: this.status,
339
+ statusText: this.statusText
340
+ };
341
+ return Response.json(this.makeBody(), s);
342
+ }
343
+ }
344
+ class H extends f {
345
+ /**
346
+ * Creates an instance of the `NotImplemented` class.
347
+ *
348
+ * @param {string} message - A descriptive message explaining why the functionality is not implemented.
349
+ * @param {any} cause - Optional additional information about the cause of the error.
350
+ */
351
+ constructor(s, t) {
352
+ super(), this.name = "NotImplemented", this.status = 501, this.statusText = s, this.cause = t ? JSON.stringify(t) : void 0, this.onDebug();
353
+ }
354
+ /**
355
+ * Converts the `NotImplemented` instance into a `Response` object with a JSON body.
356
+ * This method ensures the response has the appropriate headers, status, and status text.
357
+ *
358
+ * @returns {Response} A `Response` object with the serialized JSON body and response metadata.
359
+ */
360
+ toResponse() {
361
+ const s = {
362
+ headers: { "Content-Type": "application/json" },
363
+ status: this.status,
364
+ statusText: this.statusText
365
+ };
366
+ return new Response(JSON.stringify(this.makeBody()), s);
367
+ }
368
+ /**
369
+ * Converts the `NotImplemented` instance into a `Response` object using the `Response.json` method.
370
+ * This method is an alternative to `toResponse` for generating JSON error responses.
371
+ *
372
+ * @returns {Response["json"]} A `Response` object with the JSON body and response metadata.
373
+ */
374
+ toJson() {
375
+ const s = {
376
+ status: this.status,
377
+ statusText: this.statusText
378
+ };
379
+ return Response.json(this.makeBody(), s);
380
+ }
381
+ }
382
+ class x extends f {
383
+ /**
384
+ * Creates an instance of the `ServerError` class.
385
+ *
386
+ * @param {string} message - A descriptive message explaining the cause of the server error.
387
+ * @param {any} cause - Optional additional information about the cause of the error.
388
+ */
389
+ constructor(s, t) {
390
+ super(), this.name = "ServerError", this.status = 500, this.statusText = s, this.cause = t ? JSON.stringify(t) : void 0, this.onDebug();
391
+ }
392
+ /**
393
+ * Converts the `ServerError` instance into a `Response` object with a JSON body.
394
+ * This method ensures the response has the appropriate headers, status, and status text.
395
+ *
396
+ * @returns {Response} A `Response` object with the serialized JSON body and response metadata.
397
+ */
398
+ toResponse() {
399
+ const s = {
400
+ headers: { "Content-Type": "application/json" },
401
+ status: this.status,
402
+ statusText: this.statusText
403
+ };
404
+ return new Response(JSON.stringify(this.makeBody()), s);
405
+ }
406
+ /**
407
+ * Converts the `ServerError` instance into a `Response` object using the `Response.json` method.
408
+ * This method is an alternative to `toResponse` for generating JSON error responses.
409
+ *
410
+ * @returns {Response["json"]} A `Response` object with the JSON body and response metadata.
411
+ */
412
+ toJson() {
413
+ const s = {
414
+ status: this.status,
415
+ statusText: this.statusText
416
+ };
417
+ return Response.json(this.makeBody(), s);
418
+ }
419
+ }
420
+ class L extends f {
421
+ /**
422
+ * Creates an instance of the `Unauthorized` class.
423
+ *
424
+ * @param message - A descriptive message explaining why the request is unauthorized.
425
+ * @param cause - Optional additional information about the cause of the error.
426
+ */
427
+ constructor(s, t) {
428
+ super(), this.name = "Unauthorized", this.status = 401, this.statusText = s, this.cause = t ? JSON.stringify(t) : void 0, this.onDebug();
429
+ }
430
+ /**
431
+ * Converts the `Unauthorized` instance into a `Response` object with a JSON body.
432
+ * This method ensures the response has the appropriate headers, status, and status text.
433
+ *
434
+ * @returns {Response} A `Response` object with the serialized JSON body and response metadata.
435
+ */
436
+ toResponse() {
437
+ const s = {
438
+ headers: { "Content-Type": "application/json" },
439
+ status: this.status,
440
+ statusText: this.statusText
441
+ };
442
+ return new Response(JSON.stringify(this.makeBody()), s);
443
+ }
444
+ /**
445
+ * Converts the `Unauthorized` instance into a `Response` object using the `Response.json` method.
446
+ * This method is an alternative to `toResponse` for generating JSON error responses.
447
+ *
448
+ * @returns {Response["json"]} A `Response` object with the JSON body and response metadata.
449
+ */
450
+ toJson() {
451
+ const s = {
452
+ status: this.status,
453
+ statusText: this.statusText
454
+ };
455
+ return Response.json(this.makeBody(), s);
456
+ }
457
+ }
458
+ class b extends f {
459
+ /**
460
+ * Creates an instance of the `UnprocessableEntity` class.
461
+ *
462
+ * @param {object} props - An object containing details about the error, such as:
463
+ * @param {any} [props.data] - `data`: Additional data related to the error.
464
+ * @param {Record<string, string>} [props.fieldErrors] - `fieldErrors`: A record of field-specific error messages.
465
+ * @param {Record<string, string>} [props.fields] - `fields`: A record of field values that caused the error.
466
+ * @param {string} [props.message] - `message`: A descriptive message explaining the error.
467
+ */
468
+ constructor(s) {
469
+ super(), this.name = "UnprocessableEntity", this.status = 422, this.statusText = s.message || "Unprocessable entity", this.cause = {
470
+ data: s.data,
471
+ fieldErrors: s.fieldErrors,
472
+ fields: s.fields
473
+ }, this.onDebug();
474
+ }
475
+ /**
476
+ * Converts the `UnprocessableEntity` instance into a `Response` object with a JSON body.
477
+ * This method ensures the response has the appropriate headers, status, and status text.
478
+ *
479
+ * @returns {Response} A `Response` object with the serialized JSON body and response metadata.
480
+ */
481
+ toResponse() {
482
+ const s = {
483
+ headers: { "Content-Type": "application/json" },
484
+ status: this.status,
485
+ statusText: this.statusText
486
+ };
487
+ return new Response(JSON.stringify(this.makeBody()), s);
488
+ }
489
+ /**
490
+ * Converts the `UnprocessableEntity` instance into a `Response` object using the `Response.json` method.
491
+ * This method is an alternative to `toResponse` for generating JSON error responses.
492
+ *
493
+ * @returns {Response["json"]} A `Response` object with the JSON body and response metadata.
494
+ */
495
+ toJson() {
496
+ const s = {
497
+ status: this.status,
498
+ statusText: this.statusText
499
+ };
500
+ return Response.json(this.makeBody(), s);
501
+ }
502
+ }
503
+ class g {
504
+ constructor() {
505
+ c(this, "_body", null);
506
+ c(this, "_name", "SuccessResponse");
507
+ c(this, "_status", 200);
508
+ c(this, "_statusText", "OK");
509
+ }
510
+ get body() {
511
+ return this._body;
512
+ }
513
+ set body(s) {
514
+ this._body = s ?? null;
515
+ }
516
+ get name() {
517
+ return this._name;
518
+ }
519
+ set name(s) {
520
+ this._name = s;
521
+ }
522
+ get status() {
523
+ return this._status;
524
+ }
525
+ set status(s) {
526
+ this._status = s;
527
+ }
528
+ get statusText() {
529
+ return this._statusText;
530
+ }
531
+ set statusText(s) {
532
+ this._statusText = s;
533
+ }
534
+ /**
535
+ * Logs debug information for success responses including caller context and response details.
536
+ *
537
+ * @param {any} body - The response body or success data to be logged
538
+ *
539
+ * @example
540
+ * ```typescript
541
+ * const SuccessResponse = new SuccessResponse();
542
+ * SuccessResponse.onDebug({ data: "Operation completed successfully" });
543
+ * ```
544
+ */
545
+ onDebug(s) {
546
+ const t = [], { callerInfo: n, functionName: r } = S.getCaller();
547
+ t.push(`Caller Function: ${r}`), t.push(`Caller Location: ${n}`), this.statusText && t.push(`Message: ${this.statusText}`), s && t.push(`Body: ${JSON.stringify(s)}`), p({ scheme: "red", name: this.name, debugs: t });
548
+ }
549
+ makeBody() {
550
+ return {
551
+ name: this.name,
552
+ message: this.statusText,
553
+ body: this.body
554
+ };
555
+ }
556
+ }
557
+ class F extends g {
558
+ /**
559
+ * Creates an instance of the `Created` class.
560
+ *
561
+ * @param {string} message - A message describing the creation status.
562
+ * @param {any} body - The response body to be included in the HTTP response.
563
+ */
564
+ constructor(s, t) {
565
+ super(), this.name = "Created", this.status = 201, this.statusText = s, this.body = t || void 0, this.onDebug();
566
+ }
567
+ /**
568
+ * Converts the `Created` instance into a `Response` object.
569
+ * @returns {Response} A `Response` object with the body and response metadata.
570
+ */
571
+ toResponse() {
572
+ const s = {
573
+ headers: { "Content-Type": "application/json" },
574
+ status: this.status,
575
+ statusText: this.statusText
576
+ };
577
+ return new Response(JSON.stringify(this.body), s);
578
+ }
579
+ /**
580
+ * Converts the `Created` instance into a `Response` object using the `Response.json` method.
581
+ * This method is an alternative to `toResponse` for generating JSON responses.
582
+ * @returns {Response["json"]} A `Response` object with the JSON body and response metadata.
583
+ */
584
+ toJson() {
585
+ const s = {
586
+ status: this.status,
587
+ statusText: this.statusText
588
+ };
589
+ return Response.json(this.body, s);
590
+ }
591
+ }
592
+ class z extends g {
593
+ /**
594
+ * Creates an instance of the `Found` class.
595
+ *
596
+ * @param {string} message - A message describing the creation status.
597
+ * @param {any} body - The response body to be included in the HTTP response.
598
+ */
599
+ constructor(s, t) {
600
+ super(), this.name = "Found", this.status = 302, this.statusText = s, this.body = t || void 0, this.onDebug();
601
+ }
602
+ /**
603
+ * Converts the `Found` instance into a `Response` object.
604
+ * @returns {Response} A `Response` object with the body and response metadata.
605
+ */
606
+ toResponse() {
607
+ const s = {
608
+ headers: { "Content-Type": "application/json" },
609
+ status: this.status,
610
+ statusText: this.statusText
611
+ };
612
+ return new Response(JSON.stringify(this.body), s);
613
+ }
614
+ /**
615
+ * Converts the `Found` instance into a `Response` object using the `Response.json` method.
616
+ * This method is an alternative to `toResponse` for generating JSON responses.
617
+ * @returns {Response["json"]} A `Response` object with the JSON body and response metadata.
618
+ */
619
+ toJson() {
620
+ const s = {
621
+ status: this.status,
622
+ statusText: this.statusText
623
+ };
624
+ return Response.json(this.body, s);
625
+ }
626
+ }
627
+ class M extends g {
628
+ /**
629
+ * Creates an instance of the `NoContent` class.
630
+ * @param {string} message - A message describing the creation status.
631
+ */
632
+ constructor(s) {
633
+ super(), this.name = "NoContent", this.status = 204, this.statusText = s, this.onDebug();
634
+ }
635
+ /**
636
+ * Converts the `NoContent` instance into a `Response` object.
637
+ * @returns {Response} A `Response` object with the body and response metadata.
638
+ */
639
+ toResponse() {
640
+ const s = {
641
+ headers: { "Content-Type": "application/json" },
642
+ status: this.status,
643
+ statusText: this.statusText
644
+ };
645
+ return new Response(null, s);
646
+ }
647
+ }
648
+ class V extends g {
649
+ /**
650
+ * Creates an instance of the `Success` class.
651
+ *
652
+ * @param {string} message - A message describing the creation status.
653
+ * @param {any} body - The response body to be included in the HTTP response.
654
+ */
655
+ constructor(s, t) {
656
+ super(), this.name = "Success", this.status = 200, this.statusText = s, this.body = t || void 0, this.onDebug();
657
+ }
658
+ /**
659
+ * Converts the `Success` instance into a `Response` object.
660
+ * @returns {Response} A `Response` object with the body and response metadata.
661
+ */
662
+ toResponse() {
663
+ const s = {
664
+ headers: { "Content-Type": "application/json" },
665
+ status: this.status,
666
+ statusText: this.statusText
667
+ };
668
+ return new Response(JSON.stringify(this.body), s);
669
+ }
670
+ /**
671
+ * Converts the `Success` instance into a `Response` object using the `Response.json` method.
672
+ * This method is an alternative to `toResponse` for generating JSON responses.
673
+ * @returns {Response["json"]} A `Response` object with the JSON body and response metadata.
674
+ */
675
+ toJson() {
676
+ const s = {
677
+ status: this.status,
678
+ statusText: this.statusText
679
+ };
680
+ return Response.json(this.body, s);
681
+ }
682
+ }
683
+ class Z extends g {
684
+ /**
685
+ * Creates an instance of the `Updated` class.
686
+ *
687
+ * @param {string} message - A message describing the creation status.
688
+ * @param {any} body - The response body to be included in the HTTP response.
689
+ */
690
+ constructor(s, t) {
691
+ super(), this.name = "Updated", this.status = 200, this.statusText = s, this.body = t || void 0, this.onDebug();
692
+ }
693
+ /**
694
+ * Converts the `Updated` instance into a `Response` object.
695
+ * @returns {Response} A `Response` object with the body and response metadata.
696
+ */
697
+ toResponse() {
698
+ const s = {
699
+ headers: { "Content-Type": "application/json" },
700
+ status: this.status,
701
+ statusText: this.statusText
702
+ };
703
+ return new Response(JSON.stringify(this.body), s);
704
+ }
705
+ /**
706
+ * Converts the `Updated` instance into a `Response` object using the `Response.json` method.
707
+ * This method is an alternative to `toResponse` for generating JSON responses.
708
+ * @returns {Response["json"]} A `Response` object with the JSON body and response metadata.
709
+ */
710
+ toJson() {
711
+ const s = {
712
+ status: this.status,
713
+ statusText: this.statusText
714
+ };
715
+ return Response.json(this.body, s);
716
+ }
717
+ }
718
+ class G {
719
+ /**
720
+ * Converts various header formats into a plain key-value object.
721
+ *
722
+ * @param {HeadersInit} headers - The headers to map.
723
+ * @returns {Record<string, string>} A plain object with header key-value pairs.
724
+ * @private
725
+ */
726
+ static mapHeaders(s) {
727
+ return s instanceof Headers ? Object.fromEntries(s.entries()) : typeof s == "object" ? Object.entries(s).reduce(
728
+ (t, [n, r]) => (typeof r == "string" ? t[n] = r : Array.isArray(r) ? t[n] = r.join(", ") : t[n] = JSON.stringify(r), t),
729
+ {}
730
+ ) : {};
731
+ }
732
+ /**
733
+ * Converts URLSearchParams into a plain key-value object.
734
+ *
735
+ * @param {URLSearchParams} queryParams - The query parameters to map.
736
+ * @returns {Record<string, string>} A plain object with query parameter key-value pairs.
737
+ * @private
738
+ */
739
+ static mapQueryParams(s) {
740
+ const t = {};
741
+ return s.forEach((n, r) => t[r] = n), t;
742
+ }
743
+ /**
744
+ * Transforms raw HTTP request/response data into a standardized log output format.
745
+ *
746
+ * @param {InputProps} props - The input properties containing request/response data.
747
+ * @returns {OutputProps} The mapped output object ready for logging.
748
+ */
749
+ static handle(s) {
750
+ return {
751
+ rawUrl: s.rawUrl,
752
+ status: s.status,
753
+ method: s.method,
754
+ token: null,
755
+ elapsedTime: s.elapsedTime,
756
+ requestHeaders: this.mapHeaders(s.requestHeaders),
757
+ requestBody: s.requestBody || null,
758
+ queryParams: {
759
+ ...this.mapQueryParams(s.queryParams),
760
+ ...s.urlParams
761
+ },
762
+ responseHeaders: this.mapHeaders(s.responseHeaders),
763
+ responseBody: s.responseBody || null
764
+ };
765
+ }
766
+ }
767
+ class $ {
768
+ /**
769
+ * Sets the log service configuration only once.
770
+ * If the configuration is already set, the call is ignored.
771
+ *
772
+ * @param {object} config - Service configuration parameters.
773
+ * @param {string} config.trafficSourceId - Traffic source identifier.
774
+ * @param {string} config.userToken - User token for authentication.
775
+ * @param {string} [config.logBaseApiUrl] - Optional base URL for the log service.
776
+ */
777
+ static setConfig(s) {
778
+ if (this.config) return;
779
+ const { trafficSourceId: t, userToken: n, logBaseApiUrl: r } = s, a = `${r || "http://95.216.190.158:8081"}/ingest-log`;
780
+ this.config = { trafficSourceId: t, userToken: n, apiUrl: a };
781
+ }
782
+ /**
783
+ * Returns the current service configuration, if it exists.
784
+ * @returns {{ trafficSourceId: string; userToken: string; apiUrl: string } | undefined} The stored configuration or `undefined` if not set.
785
+ */
786
+ static getConfig() {
787
+ return this.config;
788
+ }
789
+ /**
790
+ * Resets the stored configuration, allowing a new initialization.
791
+ */
792
+ static resetConfig() {
793
+ this.config = void 0;
794
+ }
795
+ }
796
+ c($, "config");
797
+ async function W(e) {
798
+ const s = $.getConfig();
799
+ if (!s) return;
800
+ const { userToken: t, apiUrl: n, trafficSourceId: r } = s, {
801
+ elapsedTime: o,
802
+ method: a,
803
+ queryParams: u,
804
+ requestBody: i,
805
+ requestHeaders: h,
806
+ responseBody: l,
807
+ responseHeaders: d,
808
+ status: v,
809
+ token: xs,
810
+ rawUrl: B
811
+ } = e;
812
+ if (process.env.NODE_ENV !== "development")
813
+ try {
814
+ const m = new URL(B);
815
+ let D = "https";
816
+ m.protocol === "http:" && (D = "http");
817
+ const O = JSON.stringify({
818
+ domainUrl: m.protocol + "//" + m.host,
819
+ pathnameUrl: m.pathname,
820
+ trafficSourceId: r,
821
+ status: v,
822
+ protocol: D,
823
+ method: a.toLowerCase(),
824
+ trafficUserId: null,
825
+ elapsedTime: o,
826
+ requestHeaders: JSON.stringify(h),
827
+ requestBody: JSON.stringify(i),
828
+ queryParams: JSON.stringify(u),
829
+ responseHeaders: JSON.stringify(d),
830
+ responseBody: JSON.stringify(l)
831
+ }), P = {
832
+ "Content-Type": "application/json",
833
+ Authorization: `Bearer ${t}`
834
+ };
835
+ await fetch(n, { method: "POST", body: O, headers: P });
836
+ } catch (m) {
837
+ p({
838
+ debugs: [`Error sending request: ${m}`],
839
+ name: "LogError",
840
+ scheme: "red"
841
+ });
842
+ }
843
+ }
844
+ async function y(e) {
845
+ let s = e.url;
846
+ e.urlParams && Object.entries(e.urlParams).forEach(([n, r]) => {
847
+ s = s.replaceAll(`:${n}`, r);
848
+ });
849
+ const t = {
850
+ POST: "Resource created successfully",
851
+ PUT: "Resource updated successfully",
852
+ DELETE: "Resource deleted successfully",
853
+ PATCH: "Resource patched successfully",
854
+ GET: "Request successful"
855
+ };
856
+ try {
857
+ const n = performance.now(), r = { ...e.headers, "Content-Type": "application/json" }, o = await fetch(s, {
858
+ headers: r,
859
+ method: e.method,
860
+ body: e.body ? JSON.stringify(e.body) : void 0
861
+ }), a = performance.now() - n, u = o.status;
862
+ let i = null;
863
+ try {
864
+ i = await o.json();
865
+ } catch {
866
+ i = null;
867
+ }
868
+ const h = G.handle({
869
+ elapsedTime: a,
870
+ method: e.method,
871
+ queryParams: new URL(s).searchParams,
872
+ requestHeaders: r,
873
+ requestBody: e.body,
874
+ responseBody: i,
875
+ responseHeaders: o.headers,
876
+ status: u,
877
+ rawUrl: e.url,
878
+ urlParams: e.urlParams
879
+ });
880
+ return W(h), o.ok ? {
881
+ success: !0,
882
+ status: u,
883
+ message: (i == null ? void 0 : i.message) || t[e.method],
884
+ response: i,
885
+ cause: null
886
+ } : {
887
+ success: !1,
888
+ status: u,
889
+ message: (i == null ? void 0 : i.message) || o.statusText || "Request failed",
890
+ response: i,
891
+ cause: null
892
+ };
893
+ } catch (n) {
894
+ return p({
895
+ debugs: [`Network error or request failed: ${n}`],
896
+ name: "MakeRequestError",
897
+ scheme: "red"
898
+ }), {
899
+ success: !1,
900
+ status: 0,
901
+ message: "Network error or request failed",
902
+ response: null,
903
+ cause: n instanceof Error ? n.message : String(n)
904
+ };
905
+ }
906
+ }
907
+ async function Y(e) {
908
+ return y({
909
+ method: "DELETE",
910
+ url: e.url,
911
+ urlParams: e.urlParams,
912
+ headers: e.headers,
913
+ body: e.body
914
+ });
915
+ }
916
+ async function K(e) {
917
+ return y({
918
+ method: "GET",
919
+ url: e.url,
920
+ urlParams: e.urlParams,
921
+ headers: e.headers
922
+ });
923
+ }
924
+ async function Q(e) {
925
+ return y({
926
+ method: "PATCH",
927
+ url: e.url,
928
+ urlParams: e.urlParams,
929
+ headers: e.headers,
930
+ body: e.body
931
+ });
932
+ }
933
+ async function X(e) {
934
+ return y({
935
+ method: "POST",
936
+ url: e.url,
937
+ urlParams: e.urlParams,
938
+ headers: e.headers,
939
+ body: e.body
940
+ });
941
+ }
942
+ async function ss(e) {
943
+ return y({
944
+ method: "PUT",
945
+ url: e.url,
946
+ urlParams: e.urlParams,
947
+ headers: e.headers,
948
+ body: e.body
949
+ });
950
+ }
951
+ class Es {
952
+ constructor(s) {
953
+ c(this, "baseUrl");
954
+ c(this, "baseHeaders");
955
+ c(this, "baseToken");
956
+ c(this, "enableDebug");
957
+ this.baseUrl = s.baseUrl, this.baseHeaders = s.baseHeaders || void 0, this.baseToken = s.baseToken || void 0, this.enableDebug = s.enableDebug || !1;
958
+ }
959
+ onDebug(s, t, n) {
960
+ if (this.enableDebug) {
961
+ const r = [], o = (a) => JSON.stringify(a, null, 2);
962
+ r.push(`Base URL: ${this.baseUrl}`), r.push(`Endpoint: ${s}`), r.push(`Status/Method: ${t} => ${n.status}`), r.push(`Message: ${n.message}`), n.headers && r.push(`Headers: ${o(n.headers)}`), n.body && r.push(`Body: ${o(n.body)}`), p({ debugs: r, name: "ApiDebug", scheme: "yellow" });
963
+ }
964
+ }
965
+ generateHeaders(s, t) {
966
+ let n = {};
967
+ return this.baseToken && (n = { Authorization: `Bearer ${this.baseToken}` }), this.baseHeaders && (n = { ...n, ...this.baseHeaders }), s && (n = { ...n, ...s }), t && (n = { ...n, Authorization: `Bearer ${t}` }), n;
968
+ }
969
+ /**
970
+ * Sends a get request to the specified endpoint.
971
+ * @param endpoint - The API endpoint to send the get request to.
972
+ * @param data - The request data, including optional headers and token.
973
+ * @returns The API response data.
974
+ */
975
+ async get(s, t) {
976
+ const n = this.generateHeaders((t == null ? void 0 : t.headers) || {}, t == null ? void 0 : t.token), r = await K({
977
+ url: this.baseUrl + s,
978
+ urlParams: (t == null ? void 0 : t.urlParams) || {},
979
+ headers: n
980
+ });
981
+ return this.onDebug(s, "get", {
982
+ headers: n,
983
+ message: r.message,
984
+ status: r.status
985
+ }), r;
986
+ }
987
+ /**
988
+ * Sends a post request to the specified endpoint.
989
+ * @param endpoint - The API endpoint to send the post request to.
990
+ * @param data - The request data, including body, optional headers, and token.
991
+ * @returns The API response data.
992
+ */
993
+ async post(s, t) {
994
+ const n = this.generateHeaders((t == null ? void 0 : t.headers) || {}, t == null ? void 0 : t.token), r = t == null ? void 0 : t.body, o = await X({
995
+ url: this.baseUrl + s,
996
+ urlParams: (t == null ? void 0 : t.urlParams) || {},
997
+ headers: n,
998
+ body: r
999
+ });
1000
+ return this.onDebug(s, "post", {
1001
+ headers: n,
1002
+ body: r,
1003
+ message: o.message,
1004
+ status: o.status
1005
+ }), o;
1006
+ }
1007
+ /**
1008
+ * Sends a put request to the specified endpoint.
1009
+ * @param endpoint - The API endpoint to send the put request to.
1010
+ * @param data - The request data, including body, optional headers, and token.
1011
+ * @returns The API response data.
1012
+ */
1013
+ async put(s, t) {
1014
+ const n = this.generateHeaders((t == null ? void 0 : t.headers) || {}, t == null ? void 0 : t.token), r = t == null ? void 0 : t.body, o = await ss({
1015
+ url: this.baseUrl + s,
1016
+ urlParams: (t == null ? void 0 : t.urlParams) || {},
1017
+ headers: n,
1018
+ body: r
1019
+ });
1020
+ return this.onDebug(s, "put", {
1021
+ headers: n,
1022
+ body: r,
1023
+ message: o.message,
1024
+ status: o.status
1025
+ }), o;
1026
+ }
1027
+ /**
1028
+ * Sends a patch request to the specified endpoint.
1029
+ * @param endpoint - The API endpoint to send the patch request to.
1030
+ * @param data - The request data, including body, optional headers, and token.
1031
+ * @returns The API response data.
1032
+ */
1033
+ async patch(s, t) {
1034
+ const n = this.generateHeaders((t == null ? void 0 : t.headers) || {}, t == null ? void 0 : t.token), r = t == null ? void 0 : t.body, o = await Q({
1035
+ url: this.baseUrl + s,
1036
+ urlParams: (t == null ? void 0 : t.urlParams) || {},
1037
+ headers: n,
1038
+ body: r
1039
+ });
1040
+ return this.onDebug(s, "patch", {
1041
+ headers: n,
1042
+ body: r,
1043
+ message: o.message,
1044
+ status: o.status
1045
+ }), o;
1046
+ }
1047
+ /**
1048
+ * Sends a delete request to the specified endpoint.
1049
+ * @param endpoint - The API endpoint to send the delete request to.
1050
+ * @param data - The request data, including body, optional headers, and token.
1051
+ * @returns The API response data.
1052
+ */
1053
+ async delete(s, t) {
1054
+ const n = this.generateHeaders((t == null ? void 0 : t.headers) || {}, t == null ? void 0 : t.token), r = t == null ? void 0 : t.body, o = await Y({
1055
+ url: this.baseUrl + s,
1056
+ urlParams: (t == null ? void 0 : t.urlParams) || {},
1057
+ headers: n,
1058
+ body: r
1059
+ });
1060
+ return this.onDebug(s, "delete", {
1061
+ headers: n,
1062
+ body: r,
1063
+ message: o.message,
1064
+ status: o.status
1065
+ }), o;
1066
+ }
1067
+ }
1068
+ async function $s(e) {
1069
+ let s;
1070
+ const t = await e.arrayBuffer(), n = new TextDecoder().decode(t);
1071
+ try {
1072
+ s = JSON.parse(n);
1073
+ } catch {
1074
+ try {
1075
+ if (n.includes("=")) {
1076
+ const o = new URLSearchParams(n);
1077
+ s = Object.fromEntries(o.entries());
1078
+ } else
1079
+ throw new T("Invalid URLSearchParams format");
1080
+ } catch {
1081
+ throw new T("Failed to extract data from request");
1082
+ }
1083
+ }
1084
+ return s;
1085
+ }
1086
+ function vs(e, s) {
1087
+ var t, n, r;
1088
+ return e != null && e.message && typeof (e == null ? void 0 : e.message) == "string" ? e == null ? void 0 : e.message : e != null && e.error && typeof (e == null ? void 0 : e.error) == "string" ? e == null ? void 0 : e.error : (t = e == null ? void 0 : e.error) != null && t.message && typeof ((n = e == null ? void 0 : e.error) == null ? void 0 : n.message) == "string" ? (r = e == null ? void 0 : e.error) == null ? void 0 : r.message : s != null && s.statusText && typeof (s == null ? void 0 : s.statusText) == "string" ? s == null ? void 0 : s.statusText : "Missing error message";
1089
+ }
1090
+ function Bs(e) {
1091
+ switch (!0) {
1092
+ case e instanceof Response:
1093
+ return e;
1094
+ case e instanceof z:
1095
+ return e.toResponse();
1096
+ case e instanceof F:
1097
+ return e.toResponse();
1098
+ case e instanceof Z:
1099
+ return e.toResponse();
1100
+ case e instanceof V:
1101
+ return e.toResponse();
1102
+ case e instanceof M:
1103
+ return e.toResponse();
1104
+ }
1105
+ switch (!0) {
1106
+ case e instanceof U:
1107
+ return e.toResponse();
1108
+ case e instanceof T:
1109
+ return e.toResponse();
1110
+ case e instanceof C:
1111
+ return e.toResponse();
1112
+ case e instanceof A:
1113
+ return e.toResponse();
1114
+ case e instanceof q:
1115
+ return e.toResponse();
1116
+ case e instanceof H:
1117
+ return e.toResponse();
1118
+ case e instanceof x:
1119
+ return e.toResponse();
1120
+ case e instanceof L:
1121
+ return e.toResponse();
1122
+ case e instanceof b:
1123
+ return e.toResponse();
1124
+ }
1125
+ return new x("Server error", e).toResponse();
1126
+ }
1127
+ async function es([
1128
+ e,
1129
+ s
1130
+ ]) {
1131
+ const t = await s.safeParseAsync(e);
1132
+ if (t.success === !1) {
1133
+ const n = Object.fromEntries(
1134
+ t.error.issues.map((r) => [r.path.join("."), r.message])
1135
+ );
1136
+ return {
1137
+ success: t.success,
1138
+ fieldErrors: n,
1139
+ fields: e
1140
+ };
1141
+ } else
1142
+ return {
1143
+ success: t.success,
1144
+ data: t.data
1145
+ };
1146
+ }
1147
+ function ts([
1148
+ e,
1149
+ s
1150
+ ]) {
1151
+ const t = s.safeParse(e);
1152
+ if (t.success === !1) {
1153
+ const n = Object.fromEntries(
1154
+ t.error.issues.map((r) => [r.path.join("."), r.message])
1155
+ );
1156
+ return {
1157
+ success: t.success,
1158
+ fieldErrors: n,
1159
+ fields: e
1160
+ };
1161
+ } else
1162
+ return {
1163
+ success: t.success,
1164
+ data: t.data
1165
+ };
1166
+ }
1167
+ function Os(e, s = "") {
1168
+ const t = new URL(e.url);
1169
+ if (s === "") return t.searchParams;
1170
+ const n = Array.from(
1171
+ t.searchParams.entries()
1172
+ ).filter(([r]) => r.startsWith(`${s}:`)).map(([r, o]) => [r.replace(`${s}:`, ""), o]);
1173
+ return new URLSearchParams(n);
1174
+ }
1175
+ function ns(e) {
1176
+ const s = "Error validating:", t = e.issues.map(
1177
+ ({ path: n, message: r }) => `-> ${n.join(".")}: ${r}`
1178
+ );
1179
+ return [s, ...t].join(`
1180
+ `);
1181
+ }
1182
+ class Ps {
1183
+ /**
1184
+ * Creates a new SchemaValidator instance.
1185
+ * @param {T} schema - The Zod schema to use for validation.
1186
+ */
1187
+ constructor(s) {
1188
+ this.schema = s;
1189
+ }
1190
+ /**
1191
+ * Checks if the provided data is valid according to the schema without throwing errors.
1192
+ *
1193
+ * @param {any} data - The data to validate.
1194
+ *
1195
+ * @returns {boolean} True if the data is valid, false otherwise.
1196
+ *
1197
+ * @example
1198
+ * ```typescript
1199
+ * const validator = new SchemaValidator(userSchema);
1200
+ * const isValid = validator.isValid({ name: "John", email: "invalid-email" });
1201
+ * console.log(isValid); // false
1202
+ * ```
1203
+ */
1204
+ isValid(s) {
1205
+ return this.schema.safeParse(s).success;
1206
+ }
1207
+ /**
1208
+ * Safely validates data and returns the complete parse result without throwing errors.
1209
+ *
1210
+ * @param {any} data - The data to validate.
1211
+ * @returns {z.ZodSafeParseResult<z.infer<T>>} The Zod safe parse result containing success status and data or error.
1212
+ *
1213
+ * @example
1214
+ * ```typescript
1215
+ * const validator = new SchemaValidator(userSchema);
1216
+ * const result = validator.safeValidate({ name: "", email: "john@example.com" });
1217
+ *
1218
+ * if (result.success) {
1219
+ * console.log(result.data); // Validated data
1220
+ * } else {
1221
+ * console.log(result.error.issues); // Validation errors
1222
+ * }
1223
+ * ```
1224
+ */
1225
+ safeValidate(s) {
1226
+ return this.schema.safeParse(s);
1227
+ }
1228
+ /**
1229
+ * Validates data and returns the parsed result, throwing a ServerError on validation failure.
1230
+ *
1231
+ * @param {any} data - The data to validate.
1232
+ * @throws {ServerError} When validation fails, with a formatted error message.
1233
+ * @returns {z.infer<T>} The validated and parsed data.
1234
+ *
1235
+ * @example
1236
+ * ```typescript
1237
+ * const validator = new SchemaValidator(userSchema);
1238
+ *
1239
+ * try {
1240
+ * const validUser = validator.validate({ name: "John", email: "john@example.com", age: 25 });
1241
+ * console.log(validUser); // { name: "John", email: "john@example.com", age: 25 }
1242
+ * } catch (error) {
1243
+ * console.error(error.message); // "Error validating:\n-> name: String must contain at least 1 character(s)"
1244
+ * }
1245
+ * ```
1246
+ */
1247
+ validate(s) {
1248
+ try {
1249
+ return this.schema.parse(s);
1250
+ } catch (t) {
1251
+ throw new x(ns(t));
1252
+ }
1253
+ }
1254
+ /**
1255
+ * Validates form data and returns the parsed result, throwing an UnprocessableEntity error on validation failure.
1256
+ * This method is specifically designed for form validation in web applications.
1257
+ *
1258
+ * @param {any} data - The form data to validate.
1259
+ * @param {string} [message] - Optional custom error message.
1260
+ * @throws {UnprocessableEntity} When validation fails, with structured field errors for form handling.
1261
+ * @returns {z.infer<T>} The validated and parsed form data.
1262
+ *
1263
+ * @example
1264
+ * ```typescript
1265
+ * const validator = new SchemaValidator(userSchema);
1266
+ *
1267
+ * try {
1268
+ * const validFormData = validator.formValidate(requestBody, "User data is invalid");
1269
+ * console.log(validFormData);
1270
+ * } catch (error) {
1271
+ * // UnprocessableEntity with fieldErrors, fields, and scrollTo data
1272
+ * console.log(error.fieldErrors); // { name: "Name is required", email: "Invalid email" }
1273
+ * console.log(error.data.scrollTo); // "name" (first error field)
1274
+ * }
1275
+ * ```
1276
+ */
1277
+ formValidate(s, t) {
1278
+ const n = ts([s, this.schema]);
1279
+ if (!n.success) {
1280
+ const r = Object.keys(n.fieldErrors)[0];
1281
+ throw new b({
1282
+ fields: n.fields,
1283
+ fieldErrors: n.fieldErrors,
1284
+ data: { scrollTo: r },
1285
+ message: t
1286
+ });
1287
+ }
1288
+ return n.data;
1289
+ }
1290
+ /**
1291
+ * Asynchronously validates form data and returns the parsed result, throwing an UnprocessableEntity error on validation failure.
1292
+ * This method is the async version of formValidate, designed for form validation with async schemas.
1293
+ *
1294
+ * @param {any} data - The form data to validate.
1295
+ * @param {string} [message] - Optional custom error message.
1296
+ * @throws {UnprocessableEntity} When validation fails, with structured field errors for form handling.
1297
+ * @returns {Promise<z.infer<T>>} A promise that resolves to the validated and parsed form data.
1298
+ *
1299
+ * @example
1300
+ * ```typescript
1301
+ * const validator = new SchemaValidator(userSchemaWithAsyncValidation);
1302
+ *
1303
+ * try {
1304
+ * const validFormData = await validator.formAsyncValidate(requestBody, "User data is invalid");
1305
+ * console.log(validFormData);
1306
+ * } catch (error) {
1307
+ * // UnprocessableEntity with fieldErrors, fields, and scrollTo data
1308
+ * console.log(error.fieldErrors); // { name: "Name is required", email: "Invalid email" }
1309
+ * console.log(error.data.scrollTo); // "name" (first error field)
1310
+ * }
1311
+ * ```
1312
+ */
1313
+ async formAsyncValidate(s, t) {
1314
+ const n = await es([s, this.schema]);
1315
+ if (!n.success) {
1316
+ const r = Object.keys(n.fieldErrors)[0];
1317
+ throw new b({
1318
+ fields: n.fields,
1319
+ fieldErrors: n.fieldErrors,
1320
+ data: { scrollTo: r },
1321
+ message: t
1322
+ });
1323
+ }
1324
+ return n.data;
1325
+ }
1326
+ }
1327
+ function ks(e) {
1328
+ if (!(/^\d{5}-\d{3}$/.test(e) || /^\d{8}$/.test(e))) return !1;
1329
+ const t = R(e), n = 8, r = /^\d{8}$/.test(t);
1330
+ return t.length === n && r;
1331
+ }
1332
+ function rs(e) {
1333
+ return e.length !== 14;
1334
+ }
1335
+ function os(e) {
1336
+ const [s] = e;
1337
+ return [...e].every((t) => t === s);
1338
+ }
1339
+ function N(e, s) {
1340
+ let t = 0;
1341
+ for (let r = 0; r < s.length; r++)
1342
+ t += parseInt(e[r]) * s[r];
1343
+ const n = t % 11;
1344
+ return n < 2 ? 0 : 11 - n;
1345
+ }
1346
+ function is(e) {
1347
+ return e.slice(12);
1348
+ }
1349
+ function ws(e) {
1350
+ if (!e || e.length > 18 || e.length < 14 || /\s/.test(e)) return !1;
1351
+ const t = R(e);
1352
+ if (rs(t) || os(t)) return !1;
1353
+ const n = t.slice(0, 12), r = N(n, [5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2]), o = N(
1354
+ n + r,
1355
+ [6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2]
1356
+ );
1357
+ return is(t) === `${r}${o}`;
1358
+ }
1359
+ function as(e) {
1360
+ return e.length !== 11;
1361
+ }
1362
+ function us(e) {
1363
+ const [s] = e;
1364
+ return [...e].every((t) => t === s);
1365
+ }
1366
+ function E(e, s) {
1367
+ let t = 0;
1368
+ for (const r of e)
1369
+ s > 1 && (t += parseInt(r) * s--);
1370
+ const n = t % 11;
1371
+ return n < 2 ? 0 : 11 - n;
1372
+ }
1373
+ function cs(e) {
1374
+ return e.slice(9);
1375
+ }
1376
+ function js(e) {
1377
+ if (!e || e.length > 14 || e.length < 11 || /\s/.test(e)) return !1;
1378
+ const t = R(e);
1379
+ if (as(t) || us(t)) return !1;
1380
+ const n = E(t, 10), r = E(t, 11);
1381
+ return cs(t) === `${n}${r}`;
1382
+ }
1383
+ function Js(e, s) {
1384
+ const t = (s == null ? void 0 : s.inputFormat) || "brazilianDate", n = (s == null ? void 0 : s.minYear) || 1900, r = (s == null ? void 0 : s.maxYear) || 3e3, o = new j();
1385
+ o.validateInputFormat(t);
1386
+ let a, u, i;
1387
+ const h = e.split(/[-/]/).map(Number);
1388
+ if (h.length !== 3) return !1;
1389
+ try {
1390
+ switch (t) {
1391
+ case "brazilianDate":
1392
+ [a, u, i] = h, o.validateDateParts(i, u, a);
1393
+ break;
1394
+ case "isoDate":
1395
+ [u, a, i] = h, o.validateDateParts(i, u, a);
1396
+ break;
1397
+ case "timestamp":
1398
+ [i, u, a] = h, o.validateDateParts(i, u, a);
1399
+ break;
1400
+ }
1401
+ return !(i < n || i > r);
1402
+ } catch {
1403
+ return !1;
1404
+ }
1405
+ }
1406
+ function hs(e) {
1407
+ return /^[a-zA-Z0-9.!$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/.test(e);
1408
+ }
1409
+ function ls(e) {
1410
+ return !(e.length === 0 || e.length > 64 || e.startsWith(".") || e.endsWith(".") || e.includes("..") || !/^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+$/.test(e));
1411
+ }
1412
+ function fs(e) {
1413
+ return !(e.length === 0 || e.length > 63 || e.startsWith("-") || e.endsWith("-") || !/^[a-zA-Z0-9-]+$/.test(e));
1414
+ }
1415
+ function ms(e) {
1416
+ if (e.length === 0 || e.length > 253 || e.startsWith(".") || e.endsWith(".") || e.startsWith("-") || e.endsWith("-"))
1417
+ return !1;
1418
+ const s = e.split(".");
1419
+ if (s.length < 2) return !1;
1420
+ for (const n of s) if (!fs(n)) return !1;
1421
+ const t = s[s.length - 1];
1422
+ return !(t.length < 2 || !/^[a-zA-Z]+$/.test(t));
1423
+ }
1424
+ function ds(e) {
1425
+ const s = e.split("@");
1426
+ if (s.length !== 2) return !1;
1427
+ const [t, n] = s;
1428
+ return !(!ls(t) || !ms(n));
1429
+ }
1430
+ function ps(e) {
1431
+ const s = e.split("@");
1432
+ return s.length === 2 ? s[1].toLowerCase() : null;
1433
+ }
1434
+ const gs = ["MX", "A", "AAAA"];
1435
+ async function ys(e, s) {
1436
+ var t, n;
1437
+ try {
1438
+ return await ((n = (t = J) == null ? void 0 : t.promises) == null ? void 0 : n.resolve(e, s)), !0;
1439
+ } catch {
1440
+ return !1;
1441
+ }
1442
+ }
1443
+ async function Ts(e) {
1444
+ for (const s of gs)
1445
+ if (await ys(e, s)) return !0;
1446
+ return !1;
1447
+ }
1448
+ async function _s(e) {
1449
+ if (!e || typeof e != "string") return !1;
1450
+ const s = e.trim();
1451
+ if (!hs(s) || !ds(s)) return !1;
1452
+ const t = ps(s);
1453
+ return t ? await Ts(t) : !1;
1454
+ }
1455
+ function Is(e) {
1456
+ if (!e) return !1;
1457
+ const s = e.length >= 8, t = /[A-Z]/.test(e), n = /[a-z]/.test(e), r = /\d/.test(e), o = /[!@#$%^&*(),.?":;{}|<>_\-+=~`[\]\\\/]/.test(
1458
+ e
1459
+ );
1460
+ return [
1461
+ s,
1462
+ t,
1463
+ n,
1464
+ r,
1465
+ o
1466
+ ].every((a) => a);
1467
+ }
1468
+ function Us(e) {
1469
+ for (const s of _) {
1470
+ const t = s.code, n = s.prefix ? `-${s.prefix}` : "", r = s.mask.replace(/[^_]/g, "").length;
1471
+ if (s.iso === "BR") {
1472
+ if (new RegExp(`^\\${t} \\d{2}9?\\d{8}$`).test(e)) return !0;
1473
+ continue;
1474
+ }
1475
+ if (new RegExp(`^\\${t}${n} \\d{${r}}$`).test(e)) return !0;
1476
+ }
1477
+ return !1;
1478
+ }
1479
+ function Cs(e) {
1480
+ if (!e || !/^[0-9a-zA-Z.-]+$/.test(e)) return !1;
1481
+ const t = e.replace(/[^a-zA-Z0-9]/g, "");
1482
+ return t.length < 7 || t.length > 9 ? !1 : /^[0-9]{7,8}[0-9Xx]?$/.test(t);
1483
+ }
1484
+ export {
1485
+ Es as ApiService,
1486
+ U as BadGateway,
1487
+ T as BadRequest,
1488
+ C as Conflict,
1489
+ F as Created,
1490
+ S as DebugService,
1491
+ A as Forbidden,
1492
+ z as Found,
1493
+ $ as LogService,
1494
+ M as NoContent,
1495
+ q as NotFound,
1496
+ H as NotImplemented,
1497
+ Ps as SchemaValidator,
1498
+ x as ServerError,
1499
+ V as Success,
1500
+ L as Unauthorized,
1501
+ b as UnprocessableEntity,
1502
+ Z as Updated,
1503
+ $s as decodeRequestBody,
1504
+ vs as decodeRequestErrorMessage,
1505
+ Bs as errorHandler,
1506
+ p as flushDebugLogs,
1507
+ es as formAsyncParse,
1508
+ ts as formParse,
1509
+ Os as getScopedParams,
1510
+ ks as validateCep,
1511
+ ws as validateCnpj,
1512
+ js as validateCpf,
1513
+ Js as validateDate,
1514
+ _s as validateEmail,
1515
+ Is as validatePassword,
1516
+ Us as validatePhone,
1517
+ Cs as validateRg
1518
+ };