@arkyn/server 3.0.1-beta.99 → 3.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +184 -1
- package/README.md +277 -224
- package/dist/http/api/_deleteRequest.d.ts +17 -0
- package/dist/http/api/_deleteRequest.d.ts.map +1 -0
- package/dist/http/api/_getRequest.d.ts +16 -0
- package/dist/http/api/_getRequest.d.ts.map +1 -0
- package/dist/http/api/_logMapperService.d.ts +86 -0
- package/dist/http/api/_logMapperService.d.ts.map +1 -0
- package/dist/{api/arkynLogRequest.d.ts → http/api/_logRequest.d.ts} +22 -19
- package/dist/{api/arkynLogRequest.d.ts.map → http/api/_logRequest.d.ts.map} +1 -1
- package/dist/http/api/_makeRequest.d.ts +61 -0
- package/dist/http/api/_makeRequest.d.ts.map +1 -0
- package/dist/http/api/_patchRequest.d.ts +17 -0
- package/dist/http/api/_patchRequest.d.ts.map +1 -0
- package/dist/http/api/_postRequest.d.ts +17 -0
- package/dist/http/api/_postRequest.d.ts.map +1 -0
- package/dist/http/api/_putRequest.d.ts +17 -0
- package/dist/http/api/_putRequest.d.ts.map +1 -0
- package/dist/http/badResponses/_badResponse.d.ts +21 -7
- package/dist/http/badResponses/_badResponse.d.ts.map +1 -1
- package/dist/http/badResponses/badGateway.d.ts +12 -23
- package/dist/http/badResponses/badGateway.d.ts.map +1 -1
- package/dist/http/badResponses/badRequest.d.ts +10 -23
- package/dist/http/badResponses/badRequest.d.ts.map +1 -1
- package/dist/http/badResponses/conflict.d.ts +10 -23
- package/dist/http/badResponses/conflict.d.ts.map +1 -1
- package/dist/http/badResponses/forbidden.d.ts +10 -23
- package/dist/http/badResponses/forbidden.d.ts.map +1 -1
- package/dist/http/badResponses/notFound.d.ts +10 -23
- package/dist/http/badResponses/notFound.d.ts.map +1 -1
- package/dist/http/badResponses/notImplemented.d.ts +10 -23
- package/dist/http/badResponses/notImplemented.d.ts.map +1 -1
- package/dist/http/badResponses/serverError.d.ts +10 -23
- package/dist/http/badResponses/serverError.d.ts.map +1 -1
- package/dist/http/badResponses/unauthorized.d.ts +10 -23
- package/dist/http/badResponses/unauthorized.d.ts.map +1 -1
- package/dist/http/badResponses/unprocessableEntity.d.ts +23 -33
- package/dist/http/badResponses/unprocessableEntity.d.ts.map +1 -1
- package/dist/http/successResponses/_successResponse.d.ts +21 -7
- package/dist/http/successResponses/_successResponse.d.ts.map +1 -1
- package/dist/http/successResponses/created.d.ts +11 -29
- package/dist/http/successResponses/created.d.ts.map +1 -1
- package/dist/http/successResponses/found.d.ts +11 -32
- package/dist/http/successResponses/found.d.ts.map +1 -1
- package/dist/http/successResponses/noContent.d.ts +10 -16
- package/dist/http/successResponses/noContent.d.ts.map +1 -1
- package/dist/http/successResponses/success.d.ts +11 -29
- package/dist/http/successResponses/success.d.ts.map +1 -1
- package/dist/http/successResponses/updated.d.ts +12 -29
- package/dist/http/successResponses/updated.d.ts.map +1 -1
- package/dist/index.d.ts +9 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1069 -38
- package/dist/index.js.map +1 -0
- package/dist/modules/http/api/_deleteRequest.js +15 -0
- package/dist/modules/http/api/_deleteRequest.js.map +1 -0
- package/dist/modules/http/api/_getRequest.js +14 -0
- package/dist/modules/http/api/_getRequest.js.map +1 -0
- package/dist/modules/http/api/_logMapperService.js +33 -0
- package/dist/modules/http/api/_logMapperService.js.map +1 -0
- package/dist/modules/http/api/_logRequest.js +58 -0
- package/dist/modules/http/api/_logRequest.js.map +1 -0
- package/dist/modules/http/api/_makeRequest.js +72 -0
- package/dist/modules/http/api/_makeRequest.js.map +1 -0
- package/dist/modules/http/api/_patchRequest.js +15 -0
- package/dist/modules/http/api/_patchRequest.js.map +1 -0
- package/dist/modules/http/api/_postRequest.js +15 -0
- package/dist/modules/http/api/_postRequest.js.map +1 -0
- package/dist/modules/http/api/_putRequest.js +15 -0
- package/dist/modules/http/api/_putRequest.js.map +1 -0
- package/dist/modules/http/badResponses/_badResponse.js +65 -0
- package/dist/modules/http/badResponses/_badResponse.js.map +1 -0
- package/dist/modules/http/badResponses/badGateway.js +26 -0
- package/dist/modules/http/badResponses/badGateway.js.map +1 -0
- package/dist/modules/http/badResponses/badRequest.js +26 -0
- package/dist/modules/http/badResponses/badRequest.js.map +1 -0
- package/dist/modules/http/badResponses/conflict.js +26 -0
- package/dist/modules/http/badResponses/conflict.js.map +1 -0
- package/dist/modules/http/badResponses/forbidden.js +26 -0
- package/dist/modules/http/badResponses/forbidden.js.map +1 -0
- package/dist/modules/http/badResponses/notFound.js +26 -0
- package/dist/modules/http/badResponses/notFound.js.map +1 -0
- package/dist/modules/http/badResponses/notImplemented.js +26 -0
- package/dist/modules/http/badResponses/notImplemented.js.map +1 -0
- package/dist/modules/http/badResponses/serverError.js +26 -0
- package/dist/modules/http/badResponses/serverError.js.map +1 -0
- package/dist/modules/http/badResponses/unauthorized.js +26 -0
- package/dist/modules/http/badResponses/unauthorized.js.map +1 -0
- package/dist/modules/http/badResponses/unprocessableEntity.js +30 -0
- package/dist/modules/http/badResponses/unprocessableEntity.js.map +1 -0
- package/dist/modules/http/successResponses/_successResponse.js +64 -0
- package/dist/modules/http/successResponses/_successResponse.js.map +1 -0
- package/dist/modules/http/successResponses/created.js +26 -0
- package/dist/modules/http/successResponses/created.js.map +1 -0
- package/dist/modules/http/successResponses/found.js +26 -0
- package/dist/modules/http/successResponses/found.js.map +1 -0
- package/dist/modules/http/successResponses/noContent.js +19 -0
- package/dist/modules/http/successResponses/noContent.js.map +1 -0
- package/dist/modules/http/successResponses/success.js +26 -0
- package/dist/modules/http/successResponses/success.js.map +1 -0
- package/dist/modules/http/successResponses/updated.js +26 -0
- package/dist/modules/http/successResponses/updated.js.map +1 -0
- package/dist/modules/services/apiService.js +111 -0
- package/dist/modules/services/apiService.js.map +1 -0
- package/dist/modules/services/debugService.js +38 -0
- package/dist/modules/services/debugService.js.map +1 -0
- package/dist/modules/services/logService.js +23 -0
- package/dist/modules/services/logService.js.map +1 -0
- package/dist/modules/utilities/decodeRequestBody.js +22 -0
- package/dist/modules/utilities/decodeRequestBody.js.map +1 -0
- package/dist/modules/utilities/decodeRequestErrorMessage.js +8 -0
- package/dist/modules/utilities/decodeRequestErrorMessage.js.map +1 -0
- package/dist/modules/utilities/errorHandler.js +41 -0
- package/dist/modules/utilities/errorHandler.js.map +1 -0
- package/dist/modules/utilities/flushDebugLogs.js +18 -0
- package/dist/modules/utilities/flushDebugLogs.js.map +1 -0
- package/dist/modules/utilities/formAsyncParse.js +16 -0
- package/dist/modules/utilities/formAsyncParse.js.map +1 -0
- package/dist/modules/utilities/formParse.js +16 -0
- package/dist/modules/utilities/formParse.js.map +1 -0
- package/dist/modules/utilities/getScopedParams.js +11 -0
- package/dist/modules/utilities/getScopedParams.js.map +1 -0
- package/dist/modules/utilities/schemaValidator.js +57 -0
- package/dist/modules/utilities/schemaValidator.js.map +1 -0
- package/dist/modules/validations/validateCep.js +11 -0
- package/dist/modules/validations/validateCep.js.map +1 -0
- package/dist/modules/validations/validateCnpj.js +56 -0
- package/dist/modules/validations/validateCnpj.js.map +1 -0
- package/dist/modules/validations/validateCpf.js +29 -0
- package/dist/modules/validations/validateCpf.js.map +1 -0
- package/dist/modules/validations/validateDate.js +28 -0
- package/dist/modules/validations/validateDate.js.map +1 -0
- package/dist/modules/validations/validateEmail.js +56 -0
- package/dist/modules/validations/validateEmail.js.map +1 -0
- package/dist/modules/validations/validatePassword.js +14 -0
- package/dist/modules/validations/validatePassword.js.map +1 -0
- package/dist/modules/validations/validatePhone.js +12 -0
- package/dist/modules/validations/validatePhone.js.map +1 -0
- package/dist/modules/validations/validateRg.js +10 -0
- package/dist/modules/validations/validateRg.js.map +1 -0
- package/dist/services/apiService.d.ts +25 -26
- package/dist/services/apiService.d.ts.map +1 -1
- package/dist/services/debugService.d.ts +15 -32
- package/dist/services/debugService.d.ts.map +1 -1
- package/dist/services/logService.d.ts +33 -0
- package/dist/services/logService.d.ts.map +1 -0
- package/dist/utilities/decodeRequestBody.d.ts +18 -0
- package/dist/utilities/decodeRequestBody.d.ts.map +1 -0
- package/dist/utilities/decodeRequestErrorMessage.d.ts +19 -0
- package/dist/utilities/decodeRequestErrorMessage.d.ts.map +1 -0
- package/dist/utilities/errorHandler.d.ts +25 -0
- package/dist/utilities/errorHandler.d.ts.map +1 -0
- package/dist/utilities/flushDebugLogs.d.ts +24 -0
- package/dist/utilities/flushDebugLogs.d.ts.map +1 -0
- package/dist/utilities/formAsyncParse.d.ts +38 -0
- package/dist/utilities/formAsyncParse.d.ts.map +1 -0
- package/dist/utilities/formParse.d.ts +38 -0
- package/dist/utilities/formParse.d.ts.map +1 -0
- package/dist/utilities/getScopedParams.d.ts +19 -0
- package/dist/utilities/getScopedParams.d.ts.map +1 -0
- package/dist/utilities/schemaValidator.d.ts +75 -0
- package/dist/utilities/schemaValidator.d.ts.map +1 -0
- package/dist/validations/validateCep.d.ts +6 -11
- package/dist/validations/validateCep.d.ts.map +1 -1
- package/dist/validations/validateCnpj.d.ts +2 -3
- package/dist/validations/validateCnpj.d.ts.map +1 -1
- package/dist/validations/validateCpf.d.ts +4 -12
- package/dist/validations/validateCpf.d.ts.map +1 -1
- package/dist/validations/validateDate.d.ts +13 -24
- package/dist/validations/validateDate.d.ts.map +1 -1
- package/dist/validations/validateEmail.d.ts +3 -4
- package/dist/validations/validateEmail.d.ts.map +1 -1
- package/dist/validations/validatePassword.d.ts +3 -4
- package/dist/validations/validatePassword.d.ts.map +1 -1
- package/dist/validations/validatePhone.d.ts +7 -20
- package/dist/validations/validatePhone.d.ts.map +1 -1
- package/dist/validations/validateRg.d.ts +1 -2
- package/dist/validations/validateRg.d.ts.map +1 -1
- package/package.json +317 -15
- package/dist/api/arkynLogRequest.js +0 -88
- package/dist/api/deleteRequest.d.ts +0 -13
- package/dist/api/deleteRequest.d.ts.map +0 -1
- package/dist/api/deleteRequest.js +0 -14
- package/dist/api/getRequest.d.ts +0 -12
- package/dist/api/getRequest.d.ts.map +0 -1
- package/dist/api/getRequest.js +0 -13
- package/dist/api/makeRequest.d.ts +0 -38
- package/dist/api/makeRequest.d.ts.map +0 -1
- package/dist/api/makeRequest.js +0 -107
- package/dist/api/patchRequest.d.ts +0 -13
- package/dist/api/patchRequest.d.ts.map +0 -1
- package/dist/api/patchRequest.js +0 -14
- package/dist/api/postRequest.d.ts +0 -13
- package/dist/api/postRequest.d.ts.map +0 -1
- package/dist/api/postRequest.js +0 -14
- package/dist/api/putRequest.d.ts +0 -13
- package/dist/api/putRequest.d.ts.map +0 -1
- package/dist/api/putRequest.js +0 -14
- package/dist/bundle.js +0 -1507
- package/dist/bundle.umd.cjs +0 -10
- package/dist/http/badResponses/_badResponse.js +0 -20
- package/dist/http/badResponses/badGateway.js +0 -58
- package/dist/http/badResponses/badRequest.js +0 -58
- package/dist/http/badResponses/conflict.js +0 -58
- package/dist/http/badResponses/forbidden.js +0 -58
- package/dist/http/badResponses/notFound.js +0 -58
- package/dist/http/badResponses/notImplemented.js +0 -58
- package/dist/http/badResponses/serverError.js +0 -58
- package/dist/http/badResponses/unauthorized.js +0 -58
- package/dist/http/badResponses/unprocessableEntity.js +0 -65
- package/dist/http/successResponses/_successResponse.js +0 -37
- package/dist/http/successResponses/created.js +0 -57
- package/dist/http/successResponses/found.js +0 -60
- package/dist/http/successResponses/noContent.js +0 -38
- package/dist/http/successResponses/success.js +0 -57
- package/dist/http/successResponses/updated.js +0 -57
- package/dist/mapper/arkynLogRequestMapper.d.ts +0 -30
- package/dist/mapper/arkynLogRequestMapper.d.ts.map +0 -1
- package/dist/mapper/arkynLogRequestMapper.js +0 -44
- package/dist/services/apiService.js +0 -133
- package/dist/services/arkynLogService.d.ts +0 -44
- package/dist/services/arkynLogService.d.ts.map +0 -1
- package/dist/services/arkynLogService.js +0 -46
- package/dist/services/debugService.js +0 -57
- package/dist/services/decodeErrorMessageFromRequest.d.ts +0 -17
- package/dist/services/decodeErrorMessageFromRequest.d.ts.map +0 -1
- package/dist/services/decodeErrorMessageFromRequest.js +0 -30
- package/dist/services/decodeRequestBody.d.ts +0 -17
- package/dist/services/decodeRequestBody.d.ts.map +0 -1
- package/dist/services/decodeRequestBody.js +0 -38
- package/dist/services/errorHandler.d.ts +0 -44
- package/dist/services/errorHandler.d.ts.map +0 -1
- package/dist/services/errorHandler.js +0 -93
- package/dist/services/flushDebugLogs.d.ts +0 -8
- package/dist/services/flushDebugLogs.d.ts.map +0 -1
- package/dist/services/flushDebugLogs.js +0 -20
- package/dist/services/formAsyncParse.d.ts +0 -59
- package/dist/services/formAsyncParse.d.ts.map +0 -1
- package/dist/services/formAsyncParse.js +0 -58
- package/dist/services/formParse.d.ts +0 -59
- package/dist/services/formParse.d.ts.map +0 -1
- package/dist/services/formParse.js +0 -58
- package/dist/services/getCaller.d.ts +0 -17
- package/dist/services/getCaller.d.ts.map +0 -1
- package/dist/services/getCaller.js +0 -60
- package/dist/services/getScopedParams.d.ts +0 -28
- package/dist/services/getScopedParams.d.ts.map +0 -1
- package/dist/services/getScopedParams.js +0 -34
- package/dist/services/measureRouteExecution.d.ts +0 -3
- package/dist/services/measureRouteExecution.d.ts.map +0 -1
- package/dist/services/measureRouteExecution.js +0 -24
- package/dist/services/schemaValidator.d.ts +0 -158
- package/dist/services/schemaValidator.d.ts.map +0 -1
- package/dist/services/schemaValidator.js +0 -207
- package/dist/types/ApiResponseDTO.d.ts +0 -17
- package/dist/types/ApiResponseDTO.d.ts.map +0 -1
- package/dist/types/ApiResponseDTO.js +0 -1
- package/dist/validations/validateCep.js +0 -33
- package/dist/validations/validateCnpj.js +0 -52
- package/dist/validations/validateCpf.js +0 -54
- package/dist/validations/validateDate.js +0 -73
- package/dist/validations/validateEmail.js +0 -123
- package/dist/validations/validatePassword.js +0 -34
- package/dist/validations/validatePhone.js +0 -44
- package/dist/validations/validateRg.js +0 -31
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":[],"sources":["../src/services/debugService.ts","../src/utilities/flushDebugLogs.ts","../src/http/badResponses/_badResponse.ts","../src/http/badResponses/badGateway.ts","../src/http/badResponses/badRequest.ts","../src/http/badResponses/conflict.ts","../src/http/badResponses/forbidden.ts","../src/http/badResponses/notFound.ts","../src/http/badResponses/notImplemented.ts","../src/http/badResponses/serverError.ts","../src/http/badResponses/unauthorized.ts","../src/http/badResponses/unprocessableEntity.ts","../src/http/successResponses/_successResponse.ts","../src/http/successResponses/created.ts","../src/http/successResponses/found.ts","../src/http/successResponses/noContent.ts","../src/http/successResponses/success.ts","../src/http/successResponses/updated.ts","../src/http/api/_logMapperService.ts","../src/services/logService.ts","../src/http/api/_logRequest.ts","../src/http/api/_makeRequest.ts","../src/http/api/_deleteRequest.ts","../src/http/api/_getRequest.ts","../src/http/api/_patchRequest.ts","../src/http/api/_postRequest.ts","../src/http/api/_putRequest.ts","../src/services/apiService.ts","../src/utilities/decodeRequestBody.ts","../src/utilities/decodeRequestErrorMessage.ts","../src/utilities/errorHandler.ts","../src/utilities/formAsyncParse.ts","../src/utilities/formParse.ts","../src/utilities/getScopedParams.ts","../src/utilities/schemaValidator.ts","../src/validations/validateCep.ts","../src/validations/validateCnpj.ts","../src/validations/validateCpf.ts","../src/validations/validateDate.ts","../src/validations/validateEmail.ts","../src/validations/validatePassword.ts","../src/validations/validatePhone.ts","../src/validations/validateRg.ts"],"sourcesContent":["import path from \"node:path\";\n\n/**\n * Manages stack-trace configuration for debug output, allowing specific adapter/wrapper files\n * to be skipped so logs show the actual business-logic caller.\n *\n * @example\n * ```typescript\n * // Skip httpAdapter.ts so debug output shows the calling route instead\n * DebugService.setIgnoreFile(\"httpAdapter.ts\");\n * ```\n */\n\nclass DebugService {\n\t/**\n\t * The name of the file to ignore when analyzing the stack trace.\n\t * When set, the `getCaller` function will skip stack frames containing this file name.\n\t */\n\tstatic ignoreFiles: string[] = [];\n\n\t/**\n\t * Adds a file name to the ignore list so it is skipped when resolving the caller in stack traces.\n\t *\n\t * @param file - File name to ignore (e.g. `\"httpAdapter.ts\"`).\n\t */\n\tstatic setIgnoreFile(file: string): void {\n\t\tDebugService.ignoreFiles.push(file);\n\t}\n\n\t/** Resets the ignore list, restoring full stack trace analysis. */\n\tstatic clearIgnoreFiles(): void {\n\t\tDebugService.ignoreFiles = [];\n\t}\n\n\t/**\n\t * Resolves the file path and function name of the code that triggered the current debug call,\n\t * skipping internal node modules and any files registered with `setIgnoreFile`.\n\t *\n\t * @returns `{ functionName, callerInfo }` — caller function name and file path relative to `process.cwd()`.\n\t */\n\tstatic getCaller() {\n\t\tconst projectRoot = process.cwd();\n\n\t\tconst err = new Error();\n\t\tconst stack = err.stack || \"\";\n\t\tconst stackLines = stack.split(\"\\n\").map((line) => line.trim());\n\n\t\tlet callerIndex = 2;\n\n\t\twhile (\n\t\t\tcallerIndex < stackLines.length &&\n\t\t\t(stackLines[callerIndex].includes(\"node:internal\") ||\n\t\t\t\tstackLines[callerIndex].includes(\"/node_modules/\"))\n\t\t) {\n\t\t\tcallerIndex++;\n\t\t}\n\n\t\tif (DebugService.ignoreFiles.length > 0) {\n\t\t\twhile (\n\t\t\t\tcallerIndex < stackLines.length &&\n\t\t\t\tDebugService.ignoreFiles.some((ignoreFile) =>\n\t\t\t\t\tstackLines[callerIndex].includes(ignoreFile),\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\tcallerIndex++;\n\t\t\t}\n\t\t}\n\n\t\tconst callerLine = stackLines[callerIndex] || \"\";\n\n\t\tlet functionName = \"Unknown function\";\n\t\tlet callerInfo = \"Unknown caller\";\n\n\t\tconst namedFunctionMatch = callerLine.match(/at\\s+([^(\\s]+)\\s+\\(([^)]+)\\)/);\n\t\tif (namedFunctionMatch) {\n\t\t\tfunctionName = namedFunctionMatch[1];\n\t\t\tcallerInfo = namedFunctionMatch[2];\n\t\t} else {\n\t\t\tconst anonymousFunctionMatch = callerLine.match(/at\\s+(.+)/);\n\t\t\tif (anonymousFunctionMatch) {\n\t\t\t\tcallerInfo = anonymousFunctionMatch[1];\n\n\t\t\t\tconst objectMethodMatch = callerInfo.match(/at\\s+([^(\\s]+)\\s+/);\n\t\t\t\tif (objectMethodMatch && objectMethodMatch[1] !== \"new\") {\n\t\t\t\t\tfunctionName = objectMethodMatch[1];\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tif (callerInfo.includes(\"(\")) {\n\t\t\tcallerInfo = callerInfo.substring(\n\t\t\t\tcallerInfo.indexOf(\"(\") + 1,\n\t\t\t\tcallerInfo.lastIndexOf(\")\"),\n\t\t\t);\n\t\t}\n\n\t\tcallerInfo = callerInfo.split(\":\").slice(0, -2).join(\":\");\n\n\t\ttry {\n\t\t\tcallerInfo = path.relative(projectRoot, callerInfo);\n\t\t} catch (_e) {}\n\n\t\treturn { functionName, callerInfo };\n\t}\n}\n\nexport { DebugService };\n","/**\n * Writes colored `[name] message` lines to the console, but only when\n * `NODE_ENV === \"development\"` or `DEBUG_MODE === \"true\"`. No-op in production.\n *\n * @param props.name - Label shown before each line (e.g. `\"API\"`, `\"Auth\"`).\n * @param props.scheme - Color of the label tag: `\"cyan\"` info, `\"green\"` success, `\"yellow\"` warning, `\"red\"` error.\n * @param props.debugs - Lines of text to print, one per console entry.\n *\n * @example\n * ```typescript\n * flushDebugLogs({\n * name: \"API\",\n * scheme: \"cyan\",\n * debugs: [\"POST /api/users\", \"Status: 201\"],\n * });\n * ```\n */\n\nfunction flushDebugLogs(props: {\n\tscheme: \"yellow\" | \"cyan\" | \"red\" | \"green\";\n\tname: string;\n\tdebugs: string[];\n}): void {\n\tconst isDebugMode =\n\t\tprocess.env.NODE_ENV === \"development\" ||\n\t\tprocess.env?.DEBUG_MODE === \"true\";\n\n\tif (isDebugMode) {\n\t\tconst reset = \"\\x1b[0m\";\n\n\t\tconst colors = {\n\t\t\tyellow: \"\\x1b[33m\",\n\t\t\tcyan: \"\\x1b[36m\",\n\t\t\tred: \"\\x1b[31m\",\n\t\t\tgreen: \"\\x1b[32m\",\n\t\t};\n\n\t\tconst debugName = `${colors[props.scheme]}[${props.name}]${reset}`;\n\t\tlet consoleData = `\\n`;\n\n\t\tprops.debugs.forEach((debug, index) => {\n\t\t\tconsoleData += `${debugName} ${debug.trim()}`;\n\t\t\tif (index < props.debugs.length - 1) consoleData += `\\n`;\n\t\t});\n\n\t\tconsole.log(consoleData);\n\t}\n}\n\nexport { flushDebugLogs };\n","import { formatJsonString } from \"@arkyn/shared\";\n\nimport { DebugService } from \"../../services/debugService\";\nimport { flushDebugLogs } from \"../../utilities/flushDebugLogs\";\n\nclass BadResponse {\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tprivate _cause?: any;\n\tprivate _name: string = \"BadResponse\";\n\tprivate _status: number = 500;\n\tprivate _statusText: string = \"Unknown error\";\n\tprivate _debugColor: \"green\" | \"yellow\" | \"cyan\" | \"red\" = \"red\";\n\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tget cause(): any {\n\t\treturn this._cause;\n\t}\n\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tset cause(value: any) {\n\t\tthis._cause = value;\n\t}\n\n\tget name(): string {\n\t\treturn this._name;\n\t}\n\n\tset name(value: string) {\n\t\tthis._name = value;\n\t}\n\n\tget status(): number {\n\t\treturn this._status;\n\t}\n\n\tset status(value: number) {\n\t\tthis._status = value;\n\t}\n\n\tget statusText(): string {\n\t\treturn this._statusText;\n\t}\n\n\tset statusText(value: string) {\n\t\tthis._statusText = value;\n\t}\n\n\tget debugColor(): \"green\" | \"yellow\" | \"cyan\" | \"red\" {\n\t\treturn this._debugColor;\n\t}\n\n\tset debugColor(value: \"green\" | \"yellow\" | \"cyan\" | \"red\") {\n\t\tif (![\"green\", \"yellow\", \"cyan\", \"red\"].includes(value)) return;\n\t\tthis._debugColor = value;\n\t}\n\n\tonDebug() {\n\t\tconst debugs: string[] = [];\n\t\tconst { callerInfo, functionName } = DebugService.getCaller();\n\n\t\tdebugs.push(`Caller Function: ${functionName}`);\n\t\tdebugs.push(`Caller Location: ${callerInfo}`);\n\n\t\tif (this._statusText) debugs.push(`Message: ${this._statusText}`);\n\t\tif (this._cause) {\n\t\t\tdebugs.push(`Cause: ${formatJsonString(JSON.stringify(this._cause))}`);\n\t\t}\n\n\t\tflushDebugLogs({ scheme: \"red\", name: this._name, debugs });\n\t}\n\n\tmakeBody() {\n\t\treturn {\n\t\t\tname: this._name,\n\t\t\tmessage: this._statusText,\n\t\t\tcause: this._cause,\n\t\t};\n\t}\n}\n\nexport { BadResponse };\n","import { BadResponse } from \"./_badResponse\";\n\n/**\n * HTTP 502 Bad Gateway — the upstream server returned an invalid or unexpected response.\n *\n * Throw inside a server action/loader and catch with `errorHandler`, or call `.toJson()` directly.\n *\n * @example\n * ```typescript\n * throw new BadGateway(\"Payment gateway unavailable\");\n * ```\n */\nclass BadGateway extends BadResponse {\n\t/**\n\t * @param message - Error description sent in the response body and logged for debugging.\n\t * @param cause - Optional extra context (serialized to JSON in the response).\n\t */\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tconstructor(message: string, cause?: any) {\n\t\tsuper();\n\n\t\tthis.name = \"BadGateway\";\n\t\tthis.status = 502;\n\t\tthis.statusText = message;\n\t\tthis.cause = cause ? JSON.stringify(cause) : undefined;\n\n\t\tthis.onDebug();\n\t}\n\n\t/** Converts to a `Response` with `Content-Type: application/json` header. */\n\ttoResponse(): Response {\n\t\tconst responseInit: ResponseInit = {\n\t\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t};\n\n\t\treturn new Response(JSON.stringify(this.makeBody()), responseInit);\n\t}\n\n\t/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */\n\ttoJson(): Response {\n\t\tconst responseInit: ResponseInit = {\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t};\n\n\t\treturn Response.json(this.makeBody(), responseInit);\n\t}\n}\n\nexport { BadGateway };\n","import { BadResponse } from \"./_badResponse\";\n\n/**\n * HTTP 400 Bad Request — the request is malformed or contains invalid data.\n *\n * @example\n * ```typescript\n * throw new BadRequest(\"Invalid request body\");\n * ```\n */\nclass BadRequest extends BadResponse {\n\t/**\n\t * @param message - Error description.\n\t * @param cause - Optional extra context (serialized to JSON).\n\t */\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tconstructor(message: string, cause?: any) {\n\t\tsuper();\n\n\t\tthis.name = \"BadRequest\";\n\t\tthis.status = 400;\n\t\tthis.statusText = message;\n\t\tthis.cause = cause ? JSON.stringify(cause) : undefined;\n\n\t\tthis.onDebug();\n\t}\n\n\t/** Converts to a `Response` with `Content-Type: application/json` header. */\n\ttoResponse(): Response {\n\t\tconst responseInit: ResponseInit = {\n\t\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t};\n\n\t\treturn new Response(JSON.stringify(this.makeBody()), responseInit);\n\t}\n\n\t/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */\n\ttoJson(): Response {\n\t\tconst responseInit: ResponseInit = {\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t};\n\n\t\treturn Response.json(this.makeBody(), responseInit);\n\t}\n}\n\nexport { BadRequest };\n","import { BadResponse } from \"./_badResponse\";\n\n/**\n * HTTP 409 Conflict — the request conflicts with the current state of the server (e.g. duplicate record).\n *\n * @example\n * ```typescript\n * throw new Conflict(\"Email already in use\");\n * ```\n */\nclass Conflict extends BadResponse {\n\t/**\n\t * @param message - Error description.\n\t * @param cause - Optional extra context (serialized to JSON).\n\t */\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tconstructor(message: string, cause?: any) {\n\t\tsuper();\n\n\t\tthis.name = \"Conflict\";\n\t\tthis.status = 409;\n\t\tthis.statusText = message;\n\t\tthis.debugColor = \"yellow\";\n\t\tthis.cause = cause ? JSON.stringify(cause) : undefined;\n\n\t\tthis.onDebug();\n\t}\n\n\t/** Converts to a `Response` with `Content-Type: application/json` header. */\n\ttoResponse(): Response {\n\t\tconst responseInit: ResponseInit = {\n\t\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t};\n\n\t\treturn new Response(JSON.stringify(this.makeBody()), responseInit);\n\t}\n\n\t/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */\n\ttoJson(): Response {\n\t\tconst responseInit: ResponseInit = {\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t};\n\n\t\treturn Response.json(this.makeBody(), responseInit);\n\t}\n}\n\nexport { Conflict };\n","import { BadResponse } from \"./_badResponse\";\n\n/**\n * HTTP 403 Forbidden — authenticated but not authorized to access this resource.\n *\n * @example\n * ```typescript\n * throw new Forbidden(\"You don't have permission to delete this resource\");\n * ```\n */\nclass Forbidden extends BadResponse {\n\t/**\n\t * @param message - Error description.\n\t * @param cause - Optional extra context (serialized to JSON).\n\t */\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tconstructor(message: string, cause?: any) {\n\t\tsuper();\n\n\t\tthis.name = \"Forbidden\";\n\t\tthis.status = 403;\n\t\tthis.statusText = message;\n\t\tthis.cause = cause ? JSON.stringify(cause) : undefined;\n\n\t\tthis.onDebug();\n\t}\n\n\t/** Converts to a `Response` with `Content-Type: application/json` header. */\n\ttoResponse(): Response {\n\t\tconst responseInit: ResponseInit = {\n\t\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t};\n\n\t\treturn new Response(JSON.stringify(this.makeBody()), responseInit);\n\t}\n\n\t/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */\n\ttoJson(): Response {\n\t\tconst responseInit: ResponseInit = {\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t};\n\n\t\treturn Response.json(this.makeBody(), responseInit);\n\t}\n}\n\nexport { Forbidden };\n","import { BadResponse } from \"./_badResponse\";\n\n/**\n * HTTP 404 Not Found — the requested resource does not exist.\n *\n * @example\n * ```typescript\n * throw new NotFound(\"Product not found\");\n * ```\n */\nclass NotFound extends BadResponse {\n\t/**\n\t * @param message - Error description.\n\t * @param cause - Optional extra context (serialized to JSON).\n\t */\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tconstructor(message: string, cause?: any) {\n\t\tsuper();\n\n\t\tthis.name = \"NotFound\";\n\t\tthis.status = 404;\n\t\tthis.statusText = message;\n\t\tthis.cause = cause ? JSON.stringify(cause) : undefined;\n\n\t\tthis.onDebug();\n\t}\n\n\t/** Converts to a `Response` with `Content-Type: application/json` header. */\n\ttoResponse(): Response {\n\t\tconst responseInit: ResponseInit = {\n\t\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t};\n\n\t\treturn new Response(JSON.stringify(this.makeBody()), responseInit);\n\t}\n\n\t/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */\n\ttoJson(): Response {\n\t\tconst responseInit: ResponseInit = {\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t};\n\n\t\treturn Response.json(this.makeBody(), responseInit);\n\t}\n}\n\nexport { NotFound };\n","import { BadResponse } from \"./_badResponse\";\n\n/**\n * HTTP 501 Not Implemented — the server does not support the functionality required to fulfill the request.\n *\n * @example\n * ```typescript\n * throw new NotImplemented(\"Webhook delivery is not yet implemented\");\n * ```\n */\nclass NotImplemented extends BadResponse {\n\t/**\n\t * @param message - Error description.\n\t * @param cause - Optional extra context (serialized to JSON).\n\t */\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tconstructor(message: string, cause?: any) {\n\t\tsuper();\n\n\t\tthis.name = \"NotImplemented\";\n\t\tthis.status = 501;\n\t\tthis.statusText = message;\n\t\tthis.cause = cause ? JSON.stringify(cause) : undefined;\n\n\t\tthis.onDebug();\n\t}\n\n\t/** Converts to a `Response` with `Content-Type: application/json` header. */\n\ttoResponse(): Response {\n\t\tconst responseInit: ResponseInit = {\n\t\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t};\n\n\t\treturn new Response(JSON.stringify(this.makeBody()), responseInit);\n\t}\n\n\t/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */\n\ttoJson(): Response {\n\t\tconst responseInit: ResponseInit = {\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t};\n\n\t\treturn Response.json(this.makeBody(), responseInit);\n\t}\n}\n\nexport { NotImplemented };\n","import { BadResponse } from \"./_badResponse\";\n\n/**\n * HTTP 500 Internal Server Error — an unexpected condition prevented the server from fulfilling the request.\n *\n * @example\n * ```typescript\n * throw new ServerError(\"Failed to connect to the database\");\n * ```\n */\nclass ServerError extends BadResponse {\n\t/**\n\t * @param message - Error description.\n\t * @param cause - Optional extra context (serialized to JSON).\n\t */\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tconstructor(message: string, cause?: any) {\n\t\tsuper();\n\n\t\tthis.name = \"ServerError\";\n\t\tthis.status = 500;\n\t\tthis.statusText = message;\n\t\tthis.cause = cause ? JSON.stringify(cause) : undefined;\n\n\t\tthis.onDebug();\n\t}\n\n\t/** Converts to a `Response` with `Content-Type: application/json` header. */\n\ttoResponse(): Response {\n\t\tconst responseInit: ResponseInit = {\n\t\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t};\n\n\t\treturn new Response(JSON.stringify(this.makeBody()), responseInit);\n\t}\n\n\t/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */\n\ttoJson(): Response {\n\t\tconst responseInit: ResponseInit = {\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t};\n\n\t\treturn Response.json(this.makeBody(), responseInit);\n\t}\n}\n\nexport { ServerError };\n","import { BadResponse } from \"./_badResponse\";\n\n/**\n * HTTP 401 Unauthorized — the request lacks valid authentication credentials.\n *\n * @example\n * ```typescript\n * throw new Unauthorized(\"Invalid or expired token\");\n * ```\n */\nclass Unauthorized extends BadResponse {\n\t/**\n\t * @param message - Error description.\n\t * @param cause - Optional extra context (serialized to JSON).\n\t */\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tconstructor(message: string, cause?: any) {\n\t\tsuper();\n\n\t\tthis.name = \"Unauthorized\";\n\t\tthis.status = 401;\n\t\tthis.statusText = message;\n\t\tthis.debugColor = \"yellow\";\n\t\tthis.cause = cause ? JSON.stringify(cause) : undefined;\n\n\t\tthis.onDebug();\n\t}\n\n\t/** Converts to a `Response` with `Content-Type: application/json` header. */\n\ttoResponse(): Response {\n\t\tconst responseInit: ResponseInit = {\n\t\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t};\n\n\t\treturn new Response(JSON.stringify(this.makeBody()), responseInit);\n\t}\n\n\t/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */\n\ttoJson(): Response {\n\t\tconst responseInit: ResponseInit = {\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t};\n\n\t\treturn Response.json(this.makeBody(), responseInit);\n\t}\n}\n\nexport { Unauthorized };\n","import { BadResponse } from \"./_badResponse\";\n\n/**\n * HTTP 422 Unprocessable Entity — the request is well-formed but contains semantic validation errors.\n * Typically used for form field validation failures.\n *\n * @example\n * ```typescript\n * throw new UnprocessableEntity({\n * message: \"Validation failed\",\n * fieldErrors: { email: \"Invalid email format\", age: \"Must be 18 or older\" },\n * fields: { email: \"not-an-email\", age: \"15\" },\n * });\n * ```\n */\nclass UnprocessableEntity extends BadResponse {\n\t/**\n\t * @param props.message - Human-readable description of the error.\n\t * @param props.fieldErrors - Per-field validation messages keyed by field name.\n\t * @param props.fields - Original submitted field values (useful for repopulating forms).\n\t * @param props.data - Any extra data to include in the response body.\n\t */\n\tconstructor(props: {\n\t\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\t\tdata?: any;\n\t\tfieldErrors?: Record<string, string>;\n\t\tfields?: Record<string, string>;\n\t\tmessage?: string;\n\t}) {\n\t\tsuper();\n\n\t\tthis.name = \"UnprocessableEntity\";\n\t\tthis.status = 422;\n\t\tthis.statusText = props.message || \"Unprocessable entity\";\n\t\tthis.debugColor = \"yellow\";\n\t\tthis.cause = {\n\t\t\tdata: props.data,\n\t\t\tfieldErrors: props.fieldErrors,\n\t\t\tfields: props.fields,\n\t\t};\n\n\t\tthis.onDebug();\n\t}\n\n\t/** Converts to a `Response` with `Content-Type: application/json` header. */\n\ttoResponse(): Response {\n\t\tconst responseInit: ResponseInit = {\n\t\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t};\n\n\t\treturn new Response(JSON.stringify(this.makeBody()), responseInit);\n\t}\n\n\t/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */\n\ttoJson(): Response {\n\t\tconst responseInit: ResponseInit = {\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t};\n\n\t\treturn Response.json(this.makeBody(), responseInit);\n\t}\n}\n\nexport { UnprocessableEntity };\n","import { DebugService } from \"../../services/debugService\";\nimport { flushDebugLogs } from \"../../utilities/flushDebugLogs\";\n\n/**\n * Base class for handling successful HTTP responses with debugging capabilities.\n * Provides logging functionality to track response and their context.\n */\nclass SuccessResponse {\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tprivate _body: any = null;\n\tprivate _name: string = \"SuccessResponse\";\n\tprivate _status: number = 200;\n\tprivate _statusText: string = \"OK\";\n\tprivate _debugColor: \"green\" | \"yellow\" | \"cyan\" | \"red\" = \"green\";\n\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tget body(): any {\n\t\treturn this._body;\n\t}\n\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tset body(value: any) {\n\t\tthis._body = value ?? null;\n\t}\n\n\tget name(): string {\n\t\treturn this._name;\n\t}\n\n\tset name(value: string) {\n\t\tthis._name = value;\n\t}\n\n\tget status(): number {\n\t\treturn this._status;\n\t}\n\n\tset status(value: number) {\n\t\tthis._status = value;\n\t}\n\n\tget statusText(): string {\n\t\treturn this._statusText;\n\t}\n\n\tset statusText(value: string) {\n\t\tthis._statusText = value;\n\t}\n\n\tget debugColor(): \"green\" | \"yellow\" | \"cyan\" | \"red\" {\n\t\treturn this._debugColor;\n\t}\n\n\tset debugColor(value: \"green\" | \"yellow\" | \"cyan\" | \"red\") {\n\t\tif (![\"green\", \"yellow\", \"cyan\", \"red\"].includes(value)) return;\n\t\tthis._debugColor = value;\n\t}\n\n\t/**\n\t * Logs debug information for success responses including caller context and response details.\n\t *\n\t * @param {any} body - The response body or success data to be logged\n\t *\n\t * @example\n\t * ```typescript\n\t * const SuccessResponse = new SuccessResponse();\n\t * SuccessResponse.onDebug({ data: \"Operation completed successfully\" });\n\t * ```\n\t */\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tonDebug(body?: any): void {\n\t\tconst debugs: string[] = [];\n\t\tconst { callerInfo, functionName } = DebugService.getCaller();\n\n\t\tdebugs.push(`Caller Function: ${functionName}`);\n\t\tdebugs.push(`Caller Location: ${callerInfo}`);\n\n\t\tif (this.statusText) debugs.push(`Message: ${this.statusText}`);\n\t\tif (body) debugs.push(`Body: ${JSON.stringify(body)}`);\n\n\t\tflushDebugLogs({ scheme: this._debugColor, name: this.name, debugs });\n\t}\n\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tmakeBody(): any {\n\t\treturn {\n\t\t\tname: this.name,\n\t\t\tmessage: this.statusText,\n\t\t\tbody: this.body,\n\t\t};\n\t}\n}\n\nexport { SuccessResponse };\n","import { SuccessResponse } from \"./_successResponse\";\n\n/**\n * HTTP 201 Created — the request succeeded and a new resource was created.\n *\n * @example\n * ```typescript\n * return new Created(\"User created successfully\", { id: user.id }).toJson();\n * ```\n */\nclass Created extends SuccessResponse {\n\t/**\n\t * @param message - Description included in the response status text.\n\t * @param body - Data to include in the response body.\n\t */\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tconstructor(message: string, body?: any) {\n\t\tsuper();\n\n\t\tthis.name = \"Created\";\n\t\tthis.status = 201;\n\t\tthis.statusText = message;\n\t\tthis.body = body || undefined;\n\n\t\tthis.onDebug();\n\t}\n\n\t/** Converts to a `Response` with `Content-Type: application/json` header. */\n\ttoResponse(): Response {\n\t\tconst responseInit: ResponseInit = {\n\t\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t};\n\n\t\treturn new Response(JSON.stringify(this.body), responseInit);\n\t}\n\n\t/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */\n\ttoJson(): Response {\n\t\tconst responseInit: ResponseInit = {\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t};\n\n\t\treturn Response.json(this.body, responseInit);\n\t}\n}\n\nexport { Created };\n","import { SuccessResponse } from \"./_successResponse\";\n\n/**\n * HTTP 302 Found — the resource was located and the response includes it in the body.\n *\n * @example\n * ```typescript\n * return new Found(\"Products retrieved\", { products }).toJson();\n * ```\n */\nclass Found extends SuccessResponse {\n\t/**\n\t * @param message - Description included in the response status text.\n\t * @param body - Data to include in the response body.\n\t */\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tconstructor(message: string, body?: any) {\n\t\tsuper();\n\n\t\tthis.name = \"Found\";\n\t\tthis.status = 302;\n\t\tthis.statusText = message;\n\t\tthis.body = body || undefined;\n\n\t\tthis.onDebug();\n\t}\n\n\t/** Converts to a `Response` with `Content-Type: application/json` header. */\n\ttoResponse(): Response {\n\t\tconst responseInit: ResponseInit = {\n\t\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t};\n\n\t\treturn new Response(JSON.stringify(this.body), responseInit);\n\t}\n\n\t/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */\n\ttoJson(): Response {\n\t\tconst responseInit: ResponseInit = {\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t};\n\n\t\treturn Response.json(this.body, responseInit);\n\t}\n}\n\nexport { Found };\n","import { SuccessResponse } from \"./_successResponse\";\n\n/**\n * HTTP 204 No Content — the request succeeded but there is no content to return.\n * Typically used for delete or update operations where a body is not needed.\n *\n * @example\n * ```typescript\n * return new NoContent(\"Record deleted\").toResponse();\n * ```\n */\nclass NoContent extends SuccessResponse {\n\t/**\n\t * @param message - Description included in the response status text.\n\t */\n\tconstructor(message: string) {\n\t\tsuper();\n\n\t\tthis.name = \"NoContent\";\n\t\tthis.status = 204;\n\t\tthis.statusText = message;\n\n\t\tthis.onDebug();\n\t}\n\n\t/** Converts to a `Response` with `Content-Type: application/json` header and no body. */\n\ttoResponse(): Response {\n\t\tconst responseInit: ResponseInit = {\n\t\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t};\n\n\t\treturn new Response(null, responseInit);\n\t}\n}\n\nexport { NoContent };\n","import { SuccessResponse } from \"./_successResponse\";\n\n/**\n * HTTP 200 OK — the request succeeded and the response body contains the result.\n *\n * @example\n * ```typescript\n * return new Success(\"Order fetched\", { order }).toJson();\n * ```\n */\nclass Success extends SuccessResponse {\n\t/**\n\t * @param message - Description included in the response status text.\n\t * @param body - Data to include in the response body.\n\t */\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tconstructor(message: string, body?: any) {\n\t\tsuper();\n\n\t\tthis.name = \"Success\";\n\t\tthis.status = 200;\n\t\tthis.statusText = message;\n\t\tthis.body = body || undefined;\n\n\t\tthis.onDebug();\n\t}\n\n\t/** Converts to a `Response` with `Content-Type: application/json` header. */\n\ttoResponse(): Response {\n\t\tconst responseInit: ResponseInit = {\n\t\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t};\n\n\t\treturn new Response(JSON.stringify(this.body), responseInit);\n\t}\n\n\t/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */\n\ttoJson(): Response {\n\t\tconst responseInit: ResponseInit = {\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t};\n\n\t\treturn Response.json(this.body, responseInit);\n\t}\n}\n\nexport { Success };\n","import { SuccessResponse } from \"./_successResponse\";\n\n/**\n * HTTP 200 OK — the request succeeded and the resource was updated.\n * Semantically equivalent to `Success` but signals an update operation to consumers.\n *\n * @example\n * ```typescript\n * return new Updated(\"Profile updated\", { user }).toJson();\n * ```\n */\nclass Updated extends SuccessResponse {\n\t/**\n\t * @param message - Description included in the response status text.\n\t * @param body - Data to include in the response body.\n\t */\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tconstructor(message: string, body?: any) {\n\t\tsuper();\n\n\t\tthis.name = \"Updated\";\n\t\tthis.status = 200;\n\t\tthis.statusText = message;\n\t\tthis.body = body || undefined;\n\n\t\tthis.onDebug();\n\t}\n\n\t/** Converts to a `Response` with `Content-Type: application/json` header. */\n\ttoResponse(): Response {\n\t\tconst responseInit: ResponseInit = {\n\t\t\theaders: { \"Content-Type\": \"application/json\" },\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t};\n\n\t\treturn new Response(JSON.stringify(this.body), responseInit);\n\t}\n\n\t/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */\n\ttoJson(): Response {\n\t\tconst responseInit: ResponseInit = {\n\t\t\tstatus: this.status,\n\t\t\tstatusText: this.statusText,\n\t\t};\n\n\t\treturn Response.json(this.body, responseInit);\n\t}\n}\n\nexport { Updated };\n","/**\n * Input properties for log mapping.\n *\n * @typedef {object} InputProps\n * @property {number} status - HTTP response status code.\n * @property {string} url - The request URL.\n * @property {\"GET\" | \"POST\" | \"PUT\" | \"DELETE\" | \"PATCH\"} method - HTTP method used.\n * @property {HeadersInit} requestHeaders - Headers sent with the request.\n * @property {HeadersInit} responseHeaders - Headers received in the response.\n * @property {any} requestBody - Body of the request.\n * @property {number} elapsedTime - Time elapsed for the request in milliseconds.\n * @property {any} responseBody - Body of the response.\n * @property {URLSearchParams} queryParams - Query parameters from the URL.\n */\ntype InputProps = {\n\tstatus: number;\n\trawUrl: string;\n\turlParams?: Record<string, string>;\n\tmethod: \"GET\" | \"POST\" | \"PUT\" | \"DELETE\" | \"PATCH\";\n\trequestHeaders: HeadersInit;\n\tresponseHeaders: HeadersInit;\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\trequestBody: any;\n\telapsedTime: number;\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tresponseBody: any;\n\tqueryParams: URLSearchParams;\n};\n\n/**\n * Output properties after log mapping transformation.\n *\n * @typedef {object} OutputProps\n * @property {string} rawUrl - The original request URL.\n * @property {number} status - HTTP response status code.\n * @property {\"GET\" | \"POST\" | \"PUT\" | \"DELETE\" | \"PATCH\"} method - HTTP method used.\n * @property {string | null} token - Authentication token (if present).\n * @property {number} elapsedTime - Time elapsed for the request in milliseconds.\n * @property {Record<string, string>} requestHeaders - Mapped request headers.\n * @property {Record<string, string>} requestBody - Mapped request body.\n * @property {Record<string, string>} queryParams - Mapped query parameters.\n * @property {Record<string, string>} responseHeaders - Mapped response headers.\n * @property {any} responseBody - The response body.\n */\ntype OutputProps = {\n\trawUrl: string;\n\tstatus: number;\n\tmethod: \"GET\" | \"POST\" | \"PUT\" | \"DELETE\" | \"PATCH\";\n\ttoken: string | null;\n\telapsedTime: number;\n\trequestHeaders: Record<string, string>;\n\trequestBody: Record<string, string>;\n\tqueryParams: Record<string, string>;\n\tresponseHeaders: Record<string, string>;\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tresponseBody: any;\n};\n\n/**\n * Static service for mapping HTTP request/response data into a standardized log format.\n *\n * Provides utilities to transform headers and query parameters into plain objects,\n * and produces a unified output structure for logging purposes.\n */\nclass LogMapperService {\n\t/**\n\t * Converts various header formats into a plain key-value object.\n\t *\n\t * @param {HeadersInit} headers - The headers to map.\n\t * @returns {Record<string, string>} A plain object with header key-value pairs.\n\t * @private\n\t */\n\tprivate static mapHeaders(headers: HeadersInit): Record<string, string> {\n\t\tif (headers instanceof Headers) {\n\t\t\treturn Object.fromEntries(headers.entries());\n\t\t} else if (typeof headers === \"object\") {\n\t\t\treturn Object.entries(headers).reduce(\n\t\t\t\t(acc, [key, value]) => {\n\t\t\t\t\tif (typeof value === \"string\") acc[key] = value;\n\t\t\t\t\telse if (Array.isArray(value)) acc[key] = value.join(\", \");\n\t\t\t\t\telse acc[key] = JSON.stringify(value);\n\t\t\t\t\treturn acc;\n\t\t\t\t},\n\t\t\t\t{} as Record<string, string>,\n\t\t\t);\n\t\t}\n\t\treturn {};\n\t}\n\n\t/**\n\t * Converts URLSearchParams into a plain key-value object.\n\t *\n\t * @param {URLSearchParams} queryParams - The query parameters to map.\n\t * @returns {Record<string, string>} A plain object with query parameter key-value pairs.\n\t * @private\n\t */\n\tprivate static mapQueryParams(\n\t\tqueryParams: URLSearchParams,\n\t): Record<string, string> {\n\t\tconst params: Record<string, string> = {};\n\n\t\tqueryParams.forEach((value, key) => {\n\t\t\tparams[key] = value;\n\t\t});\n\n\t\treturn params;\n\t}\n\n\t/**\n\t * Transforms raw HTTP request/response data into a standardized log output format.\n\t *\n\t * @param {InputProps} props - The input properties containing request/response data.\n\t * @returns {OutputProps} The mapped output object ready for logging.\n\t */\n\tstatic handle(props: InputProps): OutputProps {\n\t\treturn {\n\t\t\trawUrl: props.rawUrl,\n\t\t\tstatus: props.status,\n\t\t\tmethod: props.method,\n\t\t\ttoken: null,\n\t\t\telapsedTime: props.elapsedTime,\n\t\t\trequestHeaders: LogMapperService.mapHeaders(props.requestHeaders),\n\t\t\trequestBody: props.requestBody || null,\n\t\t\tqueryParams: {\n\t\t\t\t...LogMapperService.mapQueryParams(props.queryParams),\n\t\t\t\t...props.urlParams,\n\t\t\t},\n\t\t\tresponseHeaders: LogMapperService.mapHeaders(props.responseHeaders),\n\t\t\tresponseBody: props.responseBody || null,\n\t\t};\n\t}\n}\n\nexport { LogMapperService };\n","/**\n * Static service for log endpoint configuration and access.\n *\n * Stores a singleton configuration containing the traffic source identifier,\n * user token, and log ingestion URL.\n */\nclass LogService {\n\tprivate static config?: {\n\t\ttrafficSourceId: string;\n\t\tuserToken: string;\n\t\tapiUrl: string;\n\t};\n\n\t/**\n\t * Sets the log service configuration once. Subsequent calls are ignored.\n\t *\n\t * @param config.trafficSourceId - Traffic source identifier.\n\t * @param config.userToken - User token for authentication.\n\t * @param config.logBaseApiUrl - Override the default log ingestion base URL.\n\t */\n\tstatic setConfig(config: {\n\t\ttrafficSourceId: string;\n\t\tuserToken: string;\n\t\tlogBaseApiUrl?: string;\n\t}): void {\n\t\tif (LogService.config) return;\n\n\t\tconst { trafficSourceId, userToken, logBaseApiUrl } = config;\n\t\tconst baseUrl = logBaseApiUrl || `http://62.238.8.44:8081`;\n\t\tconst apiUrl = `${baseUrl}/ingest-log`;\n\n\t\tLogService.config = { trafficSourceId, userToken, apiUrl };\n\t}\n\n\t/** Returns the stored configuration, or `undefined` if `setConfig` has not been called. */\n\tstatic getConfig():\n\t\t| { trafficSourceId: string; userToken: string; apiUrl: string }\n\t\t| undefined {\n\t\treturn LogService.config;\n\t}\n\n\t/**\n\t * Resets the stored configuration, allowing a new initialization.\n\t */\n\tstatic resetConfig() {\n\t\tLogService.config = undefined;\n\t}\n}\n\nexport { LogService };\n","import { formatJsonObject } from \"@arkyn/shared\";\nimport { flushDebugLogs } from \"../..\";\nimport { LogService } from \"../../services/logService\";\n\ntype ConfigProps = {\n\trawUrl: string;\n\tstatus: number;\n\tmethod: \"GET\" | \"POST\" | \"PUT\" | \"DELETE\" | \"PATCH\";\n\ttoken: string | null;\n\telapsedTime: number;\n\trequestHeaders: Record<string, string>;\n\trequestBody: Record<string, string>;\n\tqueryParams: Record<string, string>;\n\tresponseHeaders: Record<string, string>;\n\tresponseBody: Record<string, string>;\n};\n\n/**\n * Sends a request to the inbox flow API with the provided configuration.\n *\n * - This function retrieves the inbox flow configuration using `LogService.getConfig()`.\n * - If the configuration is not available, the function will return early without performing any action.\n * - In a development environment (`NODE_ENV === \"development\"`), the function will also return early.\n * - The request is sent as a POST request to the inbox API URL with the provided configuration details.\n * - If an error occurs during the request, it will be logged using the `httpDebug` service.\n *\n * @param {ConfigProps} config - The configuration object for the request.\n * @param {string} config.rawUrl - The raw URL of the request.\n * @param {number} config.status - The HTTP status code associated with the request.\n * @param {\"GET\" | \"POST\" | \"PUT\" | \"DELETE\" | \"PATCH\"} config.method - The HTTP method used for the request. Can be \"POST\", \"GET\", \"PUT\", \"DELETE\", or \"PATCH\".\n * @param {string | null} config.token - The authentication token for the request.\n * @param {number} config.elapsedTime - The elapsed time for the request in milliseconds.\n * @param {Record<string, string>} config.requestHeaders - The headers sent with the request.\n * @param {Record<string, string>} config.requestBody - The body of the request, if applicable.\n * @param {Record<string, string>} config.queryParams - The query parameters for the request.\n * @param {Record<string, string>} config.responseHeaders - The headers received in the response.\n * @param {Record<string, string>} config.responseBody - The body of the response received.\n *\n * @remarks\n *\n * @returns {Promise<void>} A promise that resolves when the request is complete.\n *\n * @example\n * ```typescript\n * const config = {\n * rawUrl: \"https://example.com/api/data\",\n * status: 200,\n * method: \"GET\",\n * token: \"auth-token-123\",\n * elapsedTime: 150,\n * requestHeaders: { \"Accept\": \"application/json\", \"Authorization\": \"Bearer token123\" },\n * requestBody: {},\n * queryParams: { \"page\": \"1\", \"limit\": \"10\" },\n * responseHeaders: { \"Content-Type\": \"application/json\" },\n * responseBody: { \"data\": \"example response\" }\n * };\n *\n * await logRequest(config);\n * ```\n */\n\nasync function logRequest(config: ConfigProps): Promise<void> {\n\tconst arkynService = LogService.getConfig();\n\tif (!arkynService) return;\n\n\tconst { userToken, apiUrl, trafficSourceId } = arkynService;\n\n\tconst {\n\t\telapsedTime,\n\t\tmethod,\n\t\tqueryParams,\n\t\trequestBody,\n\t\trequestHeaders,\n\t\tresponseBody,\n\t\tresponseHeaders,\n\t\tstatus,\n\t\trawUrl,\n\t} = config;\n\n\tif (process.env.NODE_ENV === \"development\") return;\n\n\ttry {\n\t\tconst url = new URL(rawUrl);\n\n\t\tlet protocol: \"http\" | \"https\" = \"https\";\n\t\tif (url.protocol === \"http:\") protocol = \"http\";\n\n\t\tconst body = JSON.stringify({\n\t\t\tdomainUrl: `${url.protocol}//${url.host}`,\n\t\t\tpathnameUrl: url.pathname,\n\t\t\ttrafficSourceId: trafficSourceId,\n\t\t\tstatus,\n\t\t\tprotocol,\n\t\t\tmethod: method.toLowerCase(),\n\t\t\ttrafficUserId: null,\n\t\t\telapsedTime,\n\t\t\trequestHeaders: JSON.stringify(requestHeaders),\n\t\t\trequestBody: JSON.stringify(requestBody),\n\t\t\tqueryParams: JSON.stringify(queryParams),\n\t\t\tresponseHeaders: JSON.stringify(responseHeaders),\n\t\t\tresponseBody: JSON.stringify(responseBody),\n\t\t});\n\n\t\tconst headers = {\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t\tAuthorization: `Bearer ${userToken}`,\n\t\t};\n\n\t\tconst fetchResponse = await fetch(apiUrl, {\n\t\t\tmethod: \"POST\",\n\t\t\tbody,\n\t\t\theaders,\n\t\t});\n\n\t\tif (!fetchResponse.ok) {\n\t\t\tconst errorText = await fetchResponse.text();\n\t\t\tconst errorStatus = fetchResponse.status;\n\t\t\tconst errorStatusText = fetchResponse.statusText;\n\t\t\tconst jsonResponse = await fetchResponse.json().catch(() => null);\n\n\t\t\tflushDebugLogs({\n\t\t\t\tname: \"LogError\",\n\t\t\t\tscheme: \"red\",\n\t\t\t\tdebugs: [\n\t\t\t\t\t`Failed to log request.`,\n\t\t\t\t\t`Status: ${errorStatus} ${errorStatusText}.`,\n\t\t\t\t\t`Status text: ${errorText}.`,\n\t\t\t\t\t`JSON Response: ${jsonResponse ? formatJsonObject(jsonResponse, 0) : \"No JSON response\"}`,\n\t\t\t\t],\n\t\t\t});\n\t\t}\n\t} catch (err) {\n\t\tflushDebugLogs({\n\t\t\tdebugs: [`Error sending request: ${err}`],\n\t\t\tname: \"LogError\",\n\t\t\tscheme: \"red\",\n\t\t});\n\t}\n}\n\nexport { logRequest };\n","import { flushDebugLogs } from \"../..\";\nimport { LogMapperService } from \"./_logMapperService\";\nimport { logRequest } from \"./_logRequest\";\n\ntype InputProps = {\n\turl: string;\n\tmethod: \"POST\" | \"PUT\" | \"DELETE\" | \"PATCH\" | \"GET\";\n\turlParams?: Record<string, string>;\n\theaders?: HeadersInit;\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tbody?: any;\n};\n\n// biome-ignore lint/suspicious/noExplicitAny: intentional\ntype ApiSuccessResponse<T = any> = {\n\tsuccess: true;\n\tstatus: number;\n\tmessage: string;\n\tresponse: T;\n\tcause: null;\n};\n\ntype ApiFailedResponse = {\n\tsuccess: false;\n\tstatus: number;\n\tmessage: string;\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tresponse: any;\n\tcause: string | Error | null;\n};\n\n// biome-ignore lint/suspicious/noExplicitAny: intentional\ntype ApiResponseDTO<T = any> = ApiSuccessResponse<T> | ApiFailedResponse;\n\n/**\n * Makes an HTTP request using the Fetch API and returns a standardized response.\n *\n * @template {any} T - The expected type of the response data.\n *\n * @param {\"POST\" | \"PUT\" | \"DELETE\" | \"PATCH\" | \"GET\"} method - The HTTP method to use for the request. Supported methods are:\n * - \"POST\": Create a new resource.\n * - \"PUT\": Update an existing resource.\n * - \"DELETE\": Remove a resource.\n * - \"PATCH\": Partially update a resource.\n * - \"GET\": Retrieve a resource.\n * @param {string} url - The URL to which the request is sent.\n * @param {HeadersInit} headers - Optional headers to include in the request. Defaults to an empty object.\n * @param {any} body - Optional body to include in the request. Should be serializable to JSON.\n *\n * @returns {ApiResponseDTO<T>} A promise that resolves to an `ApiResponseDTO<T>` object containing:\n * - `success`: A boolean indicating whether the request was successful.\n * - `status`: The HTTP status code of the response.\n * - `message`: A message describing the result of the request.\n * - `response`: The parsed JSON response data, or `null` if parsing fails.\n * - `cause`: Additional error information, if applicable.\n *\n * @example\n * ```typescript\n * import { makeRequest } from \"./makeRequest\";\n *\n * async function fetchData() {\n * const response = await makeRequest(\"GET\", \"https://api.example.com/data\");\n * if (response.success) {\n * console.log(\"Data:\", response.response);\n * } else {\n * console.error(\"Error:\", response.message);\n * }\n * }\n * ```\n */\n\n// biome-ignore lint/suspicious/noExplicitAny: intentional\nasync function makeRequest<T = any>(\n\tinput: InputProps,\n): Promise<ApiResponseDTO<T>> {\n\tlet url = input.url;\n\n\tif (input.urlParams) {\n\t\tObject.entries(input.urlParams).forEach(([key, value]) => {\n\t\t\turl = url.replaceAll(`:${key}`, value);\n\t\t});\n\t}\n\n\tconst successMessage = {\n\t\tPOST: \"Resource created successfully\",\n\t\tPUT: \"Resource updated successfully\",\n\t\tDELETE: \"Resource deleted successfully\",\n\t\tPATCH: \"Resource patched successfully\",\n\t\tGET: \"Request successful\",\n\t};\n\n\ttry {\n\t\tconst startTime = performance.now();\n\n\t\tconst headers = { ...input.headers, \"Content-Type\": \"application/json\" };\n\t\tconst response = await fetch(url, {\n\t\t\theaders,\n\t\t\tmethod: input.method,\n\t\t\tbody: input.body ? JSON.stringify(input.body) : undefined,\n\t\t});\n\n\t\tconst elapsedTime = performance.now() - startTime;\n\t\tconst status = response.status;\n\n\t\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\t\tlet data: any = null;\n\t\ttry {\n\t\t\tdata = await response.json();\n\t\t} catch {\n\t\t\tdata = null;\n\t\t}\n\n\t\tconst logData = LogMapperService.handle({\n\t\t\telapsedTime,\n\t\t\tmethod: input.method,\n\t\t\tqueryParams: new URL(url).searchParams,\n\t\t\trequestHeaders: headers,\n\t\t\trequestBody: input.body,\n\t\t\tresponseBody: data,\n\t\t\tresponseHeaders: response.headers,\n\t\t\tstatus,\n\t\t\trawUrl: input.url,\n\t\t\turlParams: input.urlParams,\n\t\t});\n\n\t\tlogRequest(logData);\n\n\t\tif (!response.ok) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\tstatus,\n\t\t\t\tmessage: data?.message || response.statusText || \"Request failed\",\n\t\t\t\tresponse: data,\n\t\t\t\tcause: null,\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tstatus,\n\t\t\tmessage: data?.message || successMessage[input.method],\n\t\t\tresponse: data,\n\t\t\tcause: null,\n\t\t};\n\t} catch (err) {\n\t\tflushDebugLogs({\n\t\t\tdebugs: [`Network error or request failed: ${err}`],\n\t\t\tname: \"MakeRequestError\",\n\t\t\tscheme: \"red\",\n\t\t});\n\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\tstatus: 0,\n\t\t\tmessage: \"Network error or request failed\",\n\t\t\tresponse: null,\n\t\t\tcause: err instanceof Error ? err.message : String(err),\n\t\t};\n\t}\n}\n\nexport { type ApiResponseDTO, makeRequest };\n","import { type ApiResponseDTO, makeRequest } from \"./_makeRequest\";\n\ntype InputProps = {\n\turl: string;\n\turlParams?: Record<string, string>;\n\theaders?: HeadersInit;\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tbody?: any;\n};\n\n/**\n * Sends a DELETE request to the specified URL with optional headers and body.\n *\n * @template T - The expected type of the response data.\n * @param {InputProps} input - The options for the DELETE request, including URL, URL parameters, headers, and body.\n * @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.\n */\n\n// biome-ignore lint/suspicious/noExplicitAny: intentional\nasync function deleteRequest<T = any>(\n\tinput: InputProps,\n): Promise<ApiResponseDTO<T>> {\n\treturn makeRequest({\n\t\tmethod: \"DELETE\",\n\t\turl: input.url,\n\t\turlParams: input.urlParams,\n\t\theaders: input.headers,\n\t\tbody: input.body,\n\t});\n}\n\nexport { deleteRequest };\n","import { type ApiResponseDTO, makeRequest } from \"./_makeRequest\";\n\ntype InputProps = {\n\turl: string;\n\turlParams?: Record<string, string>;\n\theaders?: HeadersInit;\n};\n\n/**\n * Sends a GET request to the specified URL with optional headers.\n *\n * @template T - The expected type of the response data.\n * @param {InputProps} input - The options for the GET request, including URL, URL parameters, and headers.\n * @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.\n */\n\n// biome-ignore lint/suspicious/noExplicitAny: intentional\nasync function getRequest<T = any>(\n\tinput: InputProps,\n): Promise<ApiResponseDTO<T>> {\n\treturn makeRequest({\n\t\tmethod: \"GET\",\n\t\turl: input.url,\n\t\turlParams: input.urlParams,\n\t\theaders: input.headers,\n\t});\n}\n\nexport { getRequest };\n","import { type ApiResponseDTO, makeRequest } from \"./_makeRequest\";\n\ntype InputProps = {\n\turl: string;\n\turlParams?: Record<string, string>;\n\theaders?: HeadersInit;\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tbody?: any;\n};\n\n/**\n * Sends a PATCH request to the specified URL with optional headers and body.\n *\n * @template T - The expected type of the response data.\n * @param {InputProps} input - The options for the PATCH request, including URL, URL parameters, headers, and body.\n * @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.\n */\n\n// biome-ignore lint/suspicious/noExplicitAny: intentional\nasync function patchRequest<T = any>(\n\tinput: InputProps,\n): Promise<ApiResponseDTO<T>> {\n\treturn makeRequest({\n\t\tmethod: \"PATCH\",\n\t\turl: input.url,\n\t\turlParams: input.urlParams,\n\t\theaders: input.headers,\n\t\tbody: input.body,\n\t});\n}\n\nexport { patchRequest };\n","import { type ApiResponseDTO, makeRequest } from \"./_makeRequest\";\n\ntype InputProps = {\n\turl: string;\n\turlParams?: Record<string, string>;\n\theaders?: HeadersInit;\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tbody?: any;\n};\n\n/**\n * Sends a POST request to the specified URL with optional headers and body.\n *\n * @template T - The expected type of the response data.\n * @param {InputProps} input - The options for the POST request, including URL, URL parameters, headers, and body.\n * @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.\n */\n\n// biome-ignore lint/suspicious/noExplicitAny: intentional\nasync function postRequest<T = any>(\n\tinput: InputProps,\n): Promise<ApiResponseDTO<T>> {\n\treturn makeRequest({\n\t\tmethod: \"POST\",\n\t\turl: input.url,\n\t\turlParams: input.urlParams,\n\t\theaders: input.headers,\n\t\tbody: input.body,\n\t});\n}\n\nexport { postRequest };\n","import { type ApiResponseDTO, makeRequest } from \"./_makeRequest\";\n\ntype InputProps = {\n\turl: string;\n\turlParams?: Record<string, string>;\n\theaders?: HeadersInit;\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tbody?: any;\n};\n\n/**\n * Sends a PUT request to the specified URL with optional headers and body.\n *\n * @template T - The expected type of the response data.\n * @param {InputProps} input - The options for the PUT request, including URL, URL parameters, headers, and body.\n * @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.\n */\n\n// biome-ignore lint/suspicious/noExplicitAny: intentional\nasync function putRequest<T = any>(\n\tinput: InputProps,\n): Promise<ApiResponseDTO<T>> {\n\treturn makeRequest({\n\t\tmethod: \"PUT\",\n\t\turl: input.url,\n\t\turlParams: input.urlParams,\n\t\theaders: input.headers,\n\t\tbody: input.body,\n\t});\n}\n\nexport { putRequest };\n","import { deleteRequest } from \"../http/api/_deleteRequest\";\nimport { getRequest } from \"../http/api/_getRequest\";\nimport { patchRequest } from \"../http/api/_patchRequest\";\nimport { postRequest } from \"../http/api/_postRequest\";\nimport { putRequest } from \"../http/api/_putRequest\";\nimport { flushDebugLogs } from \"../utilities/flushDebugLogs\";\n\ntype ApiServiceConstructorProps = {\n\t/** Base URL prepended to every request path (e.g. `\"https://api.example.com\"`). */\n\tbaseUrl: string;\n\t/** Default headers merged into every request. */\n\tbaseHeaders?: HeadersInit;\n\t/** Default Bearer token; can be overridden per request via `data.token`. */\n\tbaseToken?: string | null;\n\t/** When `true`, logs each request and response to the console in development. */\n\tenableDebug?: boolean;\n};\n\ntype ApiRequestDataWithoutBodyProps = {\n\theaders?: HeadersInit;\n\ttoken?: string;\n\turlParams?: Record<string, string>;\n};\n\ntype ApiRequestDataWithBodyProps = {\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tbody?: any;\n\theaders?: HeadersInit;\n\ttoken?: string;\n\turlParams?: Record<string, string>;\n};\n\ntype DebugConfig = {\n\theaders?: HeadersInit;\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tbody?: any;\n\tstatus: number;\n\tmessage: string;\n};\n\n/**\n * HTTP client for external API calls. Wraps fetch with base URL, default headers, optional auth token,\n * and per-request overrides for all standard HTTP methods.\n *\n * @example\n * ```typescript\n * const api = new ApiService({\n * baseUrl: \"https://api.example.com\",\n * baseToken: session.token,\n * enableDebug: true,\n * });\n *\n * const { data } = await api.get(\"/users/me\");\n * const { data: created } = await api.post(\"/orders\", { body: { productId: 1 } });\n * ```\n */\nclass ApiService {\n\tprivate baseUrl: string;\n\tprivate baseHeaders?: HeadersInit;\n\tprivate baseToken?: string;\n\tprivate enableDebug?: boolean;\n\n\tconstructor(props: ApiServiceConstructorProps) {\n\t\tthis.baseUrl = props.baseUrl;\n\t\tthis.baseHeaders = props.baseHeaders || undefined;\n\t\tthis.baseToken = props.baseToken || undefined;\n\t\tthis.enableDebug = props.enableDebug || false;\n\t}\n\n\tprivate onDebug(endpoint: string, method: string, data: DebugConfig) {\n\t\tif (this.enableDebug) {\n\t\t\tconst debugs: string[] = [];\n\t\t\tconst json = (data: unknown) => JSON.stringify(data, null, 2);\n\n\t\t\tdebugs.push(`Base URL: ${this.baseUrl}`);\n\t\t\tdebugs.push(`Endpoint: ${endpoint}`);\n\t\t\tdebugs.push(`Status/Method: ${method} => ${data.status}`);\n\t\t\tdebugs.push(`Message: ${data.message}`);\n\n\t\t\tif (data.headers) debugs.push(`Headers: ${json(data.headers)}`);\n\t\t\tif (data.body) debugs.push(`Body: ${json(data.body)}`);\n\n\t\t\tflushDebugLogs({ debugs, name: \"ApiDebug\", scheme: \"yellow\" });\n\t\t}\n\t}\n\n\tprivate generateHeaders(\n\t\tinitHeaders: HeadersInit,\n\t\ttoken?: string,\n\t): HeadersInit {\n\t\tlet headers: HeadersInit = {};\n\t\tif (this.baseToken) headers = { Authorization: `Bearer ${this.baseToken}` };\n\t\tif (this.baseHeaders) headers = { ...headers, ...this.baseHeaders };\n\n\t\tif (initHeaders) headers = { ...headers, ...initHeaders };\n\t\tif (token) headers = { ...headers, Authorization: `Bearer ${token}` };\n\n\t\treturn headers;\n\t}\n\n\t/**\n\t * Sends a get request to the specified endpoint.\n\t * @param endpoint - The API endpoint to send the get request to.\n\t * @param data - The request data, including optional headers and token.\n\t * @returns The API response data.\n\t */\n\n\tasync get(endpoint: string, data?: ApiRequestDataWithoutBodyProps) {\n\t\tconst headers = this.generateHeaders(data?.headers || {}, data?.token);\n\n\t\tconst response = await getRequest({\n\t\t\turl: this.baseUrl + endpoint,\n\t\t\turlParams: data?.urlParams || {},\n\t\t\theaders,\n\t\t});\n\n\t\tthis.onDebug(endpoint, \"get\", {\n\t\t\theaders,\n\t\t\tmessage: response.message,\n\t\t\tstatus: response.status,\n\t\t});\n\n\t\treturn response;\n\t}\n\n\t/**\n\t * Sends a post request to the specified endpoint.\n\t * @param endpoint - The API endpoint to send the post request to.\n\t * @param data - The request data, including body, optional headers, and token.\n\t * @returns The API response data.\n\t */\n\n\tasync post(endpoint: string, data?: ApiRequestDataWithBodyProps) {\n\t\tconst headers = this.generateHeaders(data?.headers || {}, data?.token);\n\t\tconst body = data?.body;\n\n\t\tconst response = await postRequest({\n\t\t\turl: this.baseUrl + endpoint,\n\t\t\turlParams: data?.urlParams || {},\n\t\t\theaders,\n\t\t\tbody,\n\t\t});\n\n\t\tthis.onDebug(endpoint, \"post\", {\n\t\t\theaders,\n\t\t\tbody,\n\t\t\tmessage: response.message,\n\t\t\tstatus: response.status,\n\t\t});\n\n\t\treturn response;\n\t}\n\n\t/**\n\t * Sends a put request to the specified endpoint.\n\t * @param endpoint - The API endpoint to send the put request to.\n\t * @param data - The request data, including body, optional headers, and token.\n\t * @returns The API response data.\n\t */\n\n\tasync put(endpoint: string, data?: ApiRequestDataWithBodyProps) {\n\t\tconst headers = this.generateHeaders(data?.headers || {}, data?.token);\n\t\tconst body = data?.body;\n\n\t\tconst response = await putRequest({\n\t\t\turl: this.baseUrl + endpoint,\n\t\t\turlParams: data?.urlParams || {},\n\t\t\theaders,\n\t\t\tbody,\n\t\t});\n\n\t\tthis.onDebug(endpoint, \"put\", {\n\t\t\theaders,\n\t\t\tbody,\n\t\t\tmessage: response.message,\n\t\t\tstatus: response.status,\n\t\t});\n\n\t\treturn response;\n\t}\n\n\t/**\n\t * Sends a patch request to the specified endpoint.\n\t * @param endpoint - The API endpoint to send the patch request to.\n\t * @param data - The request data, including body, optional headers, and token.\n\t * @returns The API response data.\n\t */\n\n\tasync patch(endpoint: string, data?: ApiRequestDataWithBodyProps) {\n\t\tconst headers = this.generateHeaders(data?.headers || {}, data?.token);\n\t\tconst body = data?.body;\n\n\t\tconst response = await patchRequest({\n\t\t\turl: this.baseUrl + endpoint,\n\t\t\turlParams: data?.urlParams || {},\n\t\t\theaders,\n\t\t\tbody,\n\t\t});\n\n\t\tthis.onDebug(endpoint, \"patch\", {\n\t\t\theaders,\n\t\t\tbody,\n\t\t\tmessage: response.message,\n\t\t\tstatus: response.status,\n\t\t});\n\n\t\treturn response;\n\t}\n\n\t/**\n\t * Sends a delete request to the specified endpoint.\n\t * @param endpoint - The API endpoint to send the delete request to.\n\t * @param data - The request data, including body, optional headers, and token.\n\t * @returns The API response data.\n\t */\n\n\tasync delete(endpoint: string, data?: ApiRequestDataWithBodyProps) {\n\t\tconst headers = this.generateHeaders(data?.headers || {}, data?.token);\n\t\tconst body = data?.body;\n\n\t\tconst response = await deleteRequest({\n\t\t\turl: this.baseUrl + endpoint,\n\t\t\turlParams: data?.urlParams || {},\n\t\t\theaders,\n\t\t\tbody,\n\t\t});\n\n\t\tthis.onDebug(endpoint, \"delete\", {\n\t\t\theaders,\n\t\t\tbody,\n\t\t\tmessage: response.message,\n\t\t\tstatus: response.status,\n\t\t});\n\n\t\treturn response;\n\t}\n}\n\nexport { ApiService };\n","import { BadRequest } from \"../http/badResponses/badRequest\";\n\n/**\n * Decodes a request body into a plain object, trying JSON first then URL-encoded form data.\n * Throws `BadRequest` if neither format can be parsed.\n *\n * @param request - The incoming request whose body will be decoded.\n * @returns The decoded body as a plain object.\n *\n * @example\n * ```typescript\n * export async function action({ request }: ActionFunctionArgs) {\n * const body = await decodeRequestBody(request);\n * // body is now a plain JS object\n * }\n * ```\n */\n\n// biome-ignore lint/suspicious/noExplicitAny: intentional\nasync function decodeRequestBody(request: Request): Promise<any> {\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tlet data: any;\n\n\tconst arrayBuffer = await request.arrayBuffer();\n\tconst text = new TextDecoder().decode(arrayBuffer);\n\n\ttry {\n\t\tdata = JSON.parse(text);\n\t} catch (_jsonError) {\n\t\ttry {\n\t\t\tif (text.includes(\"=\")) {\n\t\t\t\tconst formData = new URLSearchParams(text);\n\t\t\t\tdata = Object.fromEntries(formData.entries());\n\t\t\t} else {\n\t\t\t\tthrow new BadRequest(\"Invalid URLSearchParams format\");\n\t\t\t}\n\t\t} catch (_formDataError) {\n\t\t\tthrow new BadRequest(\"Failed to extract data from request\");\n\t\t}\n\t}\n\n\treturn data;\n}\n\nexport { decodeRequestBody };\n","/**\n * Extracts a human-readable error message from an API response body or a `Response` object.\n * Checks `data.message`, `data.operator_erro_message`, `data.error`, `data.error.message`,\n * and `response.statusText` in that order. Falls back to `\"Missing error message\"`.\n *\n * @param data - Parsed response body that may contain error info.\n * @param response - The raw `Response` object, used as a fallback for `statusText`.\n * @returns The first non-empty string error message found.\n *\n * @example\n * ```typescript\n * const res = await fetch(\"/api/orders\");\n * const data = await res.json().catch(() => null);\n * const message = decodeRequestErrorMessage(data, res);\n * ```\n */\n\n// biome-ignore lint/suspicious/noExplicitAny: intentional\nfunction decodeRequestErrorMessage(data: any, response: Response): string {\n\tif (data?.message && typeof data?.message === \"string\") {\n\t\treturn data?.message;\n\t}\n\n\tif (\n\t\tdata?.operator_erro_message &&\n\t\ttypeof data?.operator_erro_message === \"string\"\n\t) {\n\t\treturn data?.operator_erro_message;\n\t}\n\n\tif (data?.error && typeof data?.error === \"string\") {\n\t\treturn data?.error;\n\t}\n\n\tif (data?.error?.message && typeof data?.error?.message === \"string\") {\n\t\treturn data?.error?.message;\n\t}\n\n\tif (response?.statusText && typeof response?.statusText === \"string\") {\n\t\treturn response?.statusText;\n\t}\n\n\treturn \"Missing error message\";\n}\n\nexport { decodeRequestErrorMessage };\n","import { BadGateway } from \"../http/badResponses/badGateway\";\nimport { BadRequest } from \"../http/badResponses/badRequest\";\nimport { Conflict } from \"../http/badResponses/conflict\";\nimport { Forbidden } from \"../http/badResponses/forbidden\";\nimport { NotFound } from \"../http/badResponses/notFound\";\nimport { NotImplemented } from \"../http/badResponses/notImplemented\";\nimport { ServerError } from \"../http/badResponses/serverError\";\nimport { Unauthorized } from \"../http/badResponses/unauthorized\";\nimport { UnprocessableEntity } from \"../http/badResponses/unprocessableEntity\";\n\nimport { Created } from \"../http/successResponses/created\";\nimport { Found } from \"../http/successResponses/found\";\nimport { NoContent } from \"../http/successResponses/noContent\";\nimport { Success } from \"../http/successResponses/success\";\nimport { Updated } from \"../http/successResponses/updated\";\n\n/**\n * Converts any thrown value into a `Response`. Recognizes all `@arkyn/server` success and error\n * response classes, native `Response` objects, and falls back to a 500 `ServerError` for anything else.\n *\n * Intended to be used as the catch handler of a route action or loader:\n *\n * @param error - The thrown value to convert.\n * @returns A `Response` with the appropriate HTTP status, headers, and JSON body.\n *\n * @example\n * ```typescript\n * export async function action({ request }: ActionFunctionArgs) {\n * try {\n * const user = await findUser(id);\n * if (!user) throw new NotFound(\"User not found\");\n * return new Success(\"User retrieved\", { user }).toJson();\n * } catch (error) {\n * return errorHandler(error);\n * }\n * }\n * ```\n */\n// biome-ignore lint/suspicious/noExplicitAny: intentional\nfunction errorHandler(error: any): Response {\n\tswitch (true) {\n\t\tcase error instanceof Response:\n\t\t\treturn error;\n\t\tcase error instanceof Found:\n\t\t\treturn error.toResponse();\n\t\tcase error instanceof Created:\n\t\t\treturn error.toResponse();\n\t\tcase error instanceof Updated:\n\t\t\treturn error.toResponse();\n\t\tcase error instanceof Success:\n\t\t\treturn error.toResponse();\n\t\tcase error instanceof NoContent:\n\t\t\treturn error.toResponse();\n\t}\n\n\tswitch (true) {\n\t\tcase error instanceof BadGateway:\n\t\t\treturn error.toResponse();\n\t\tcase error instanceof BadRequest:\n\t\t\treturn error.toResponse();\n\t\tcase error instanceof Conflict:\n\t\t\treturn error.toResponse();\n\t\tcase error instanceof Forbidden:\n\t\t\treturn error.toResponse();\n\t\tcase error instanceof NotFound:\n\t\t\treturn error.toResponse();\n\t\tcase error instanceof NotImplemented:\n\t\t\treturn error.toResponse();\n\t\tcase error instanceof ServerError:\n\t\t\treturn error.toResponse();\n\t\tcase error instanceof Unauthorized:\n\t\t\treturn error.toResponse();\n\t\tcase error instanceof UnprocessableEntity:\n\t\t\treturn error.toResponse();\n\t}\n\n\treturn new ServerError(\"Server error\", error).toResponse();\n}\n\nexport { errorHandler };\n","import type { ZodType } from \"zod\";\n\ntype SuccessResponse<T extends FormParseProps> = {\n\tsuccess: true;\n\tdata: T[1] extends ZodType<infer U> ? U : never;\n};\n\ntype ErrorResponse = {\n\tsuccess: false;\n\tfields: { [x: string]: string };\n\tfieldErrors: { [x: string]: string };\n};\n\n// biome-ignore lint/suspicious/noExplicitAny: intentional\ntype FormParseProps = [formData: { [k: string]: any }, schema: ZodType];\n\ntype FormParseReturnType<T extends FormParseProps> =\n\t| SuccessResponse<T>\n\t| ErrorResponse;\n\n/**\n * Async variant of `formParse` — uses `safeParseAsync` to support Zod schemas with async refinements.\n * Returns `{ success: true, data }` on success or `{ success: false, fieldErrors, fields }` on failure.\n *\n * @param formData - The raw form data object to validate.\n * @param schema - The Zod schema to validate against.\n *\n * @example\n * ```typescript\n * const schema = z.object({ email: z.string().email() });\n * const result = await formAsyncParse([{ email: \"bad\" }, schema]);\n *\n * if (!result.success) {\n * console.log(result.fieldErrors); // { email: \"Invalid email\" }\n * }\n * ```\n */\n\nasync function formAsyncParse<T extends FormParseProps>([\n\tformData,\n\tschema,\n]: T): Promise<FormParseReturnType<T>> {\n\tconst zodResponse = await schema.safeParseAsync(formData);\n\n\tif (zodResponse.success === false) {\n\t\tconst errorsObject = Object.fromEntries(\n\t\t\tzodResponse.error.issues.map((item) => {\n\t\t\t\treturn [item.path.join(\".\"), item.message];\n\t\t\t}),\n\t\t);\n\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\tfieldErrors: errorsObject,\n\t\t\tfields: formData,\n\t\t};\n\t} else {\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: zodResponse.data as T[1] extends ZodType<infer U> ? U : never,\n\t\t};\n\t}\n}\n\nexport { formAsyncParse };\n","import type { ZodType } from \"zod\";\n\ntype SuccessResponse<T extends FormParseProps> = {\n\tsuccess: true;\n\tdata: T[1] extends ZodType<infer U> ? U : never;\n};\n\ntype ErrorResponse = {\n\tsuccess: false;\n\tfields: { [x: string]: string };\n\tfieldErrors: { [x: string]: string };\n};\n\n// biome-ignore lint/suspicious/noExplicitAny: intentional\ntype FormParseProps = [formData: { [k: string]: any }, schema: ZodType];\n\ntype FormParseReturnType<T extends FormParseProps> =\n\t| SuccessResponse<T>\n\t| ErrorResponse;\n\n/**\n * Validates form data against a Zod schema synchronously.\n * Returns `{ success: true, data }` on success or `{ success: false, fieldErrors, fields }` on failure.\n *\n * @param formData - The raw form data object to validate.\n * @param schema - The Zod schema to validate against.\n *\n * @example\n * ```typescript\n * const schema = z.object({ name: z.string().min(1, \"Required\"), age: z.number().min(18) });\n * const result = formParse([{ name: \"\", age: 15 }, schema]);\n *\n * if (!result.success) {\n * console.log(result.fieldErrors); // { name: \"Required\", age: \"...\" }\n * }\n * ```\n */\n\nfunction formParse<T extends FormParseProps>([\n\tformData,\n\tschema,\n]: T): FormParseReturnType<T> {\n\tconst zodResponse = schema.safeParse(formData);\n\n\tif (zodResponse.success === false) {\n\t\tconst errorsObject = Object.fromEntries(\n\t\t\tzodResponse.error.issues.map((item) => {\n\t\t\t\treturn [item.path.join(\".\"), item.message];\n\t\t\t}),\n\t\t);\n\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\tfieldErrors: errorsObject,\n\t\t\tfields: formData,\n\t\t};\n\t} else {\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tdata: zodResponse.data as T[1] extends ZodType<infer U> ? U : never,\n\t\t};\n\t}\n}\n\nexport { formParse };\n","/**\n * Extracts URL search parameters from a request, optionally filtered by a namespace prefix\n * (e.g. `scope:key` → `key`). Without a scope, returns all search params as-is.\n *\n * @param request - The incoming request whose URL will be parsed.\n * @param scope - Namespace prefix to filter by (e.g. `\"table\"` matches `table:page`, `table:sort`).\n * @returns A `URLSearchParams` object with the matching params, stripped of the scope prefix.\n *\n * @example\n * ```typescript\n * // URL: /products?table:page=2&table:sort=asc&other=1\n * const params = getScopedParams(request, \"table\");\n * params.get(\"page\"); // \"2\"\n * params.get(\"sort\"); // \"asc\"\n * ```\n */\n\nfunction getScopedParams(request: Request, scope: string = \"\") {\n\tconst url = new URL(request.url);\n\tif (scope === \"\") return url.searchParams;\n\n\tconst scopedSearchParams: [string, string][] = Array.from(\n\t\turl.searchParams.entries(),\n\t)\n\t\t.filter(([key]) => key.startsWith(`${scope}:`))\n\t\t.map(([key, value]) => [key.replace(`${scope}:`, \"\"), value]);\n\n\treturn new URLSearchParams(scopedSearchParams);\n}\n\nexport { getScopedParams };\n","import type { ZodType, z } from \"zod\";\n\nimport { ServerError } from \"../http/badResponses/serverError\";\nimport { UnprocessableEntity } from \"../http/badResponses/unprocessableEntity\";\nimport { formAsyncParse } from \"./formAsyncParse\";\nimport { formParse } from \"./formParse\";\n\nfunction formatErrorMessage(error: z.ZodError) {\n\tconst title = \"Error validating:\";\n\tconst lines = error.issues.map(\n\t\t({ path, message }) => `-> ${path.join(\".\")}: ${message}`,\n\t);\n\n\treturn [title, ...lines].join(\"\\n\");\n}\n\n/**\n * Wraps a Zod schema with convenience validation methods suited for server-side use:\n * - `isValid` — boolean check, no throws\n * - `safeValidate` — raw Zod result, no throws\n * - `validate` — throws `ServerError` on failure (for trusted/internal data)\n * - `formValidate` / `formAsyncValidate` — throws `UnprocessableEntity` on failure (for user-submitted forms)\n *\n * @example\n * ```typescript\n * const validator = new SchemaValidator(z.object({ email: z.string().email() }));\n *\n * // Inside a Remix action:\n * const body = validator.formValidate(await decodeRequestBody(request));\n * ```\n */\nclass SchemaValidator<T extends ZodType> {\n\t/**\n\t * @param schema - The Zod schema used for all validation methods on this instance.\n\t */\n\tconstructor(readonly schema: T) {}\n\n\t/**\n\t * Returns `true` if the data satisfies the schema, `false` otherwise. Never throws.\n\t *\n\t * @param data - The value to check.\n\t */\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tisValid(data: any): boolean {\n\t\treturn this.schema.safeParse(data).success;\n\t}\n\n\t/**\n\t * Validates data and returns the raw Zod `safeParseResult` without throwing.\n\t * Useful when you need access to the full error details.\n\t *\n\t * @param data - The value to validate.\n\t */\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tsafeValidate(data: any): z.ZodSafeParseResult<z.infer<T>> {\n\t\treturn this.schema.safeParse(data);\n\t}\n\n\t/**\n\t * Validates data and returns the typed result, throwing `ServerError` on failure.\n\t * Use for validating internal/trusted data (e.g. env vars, config objects).\n\t *\n\t * @param data - The value to validate.\n\t * @throws `ServerError` with a formatted field-by-field error message.\n\t */\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tvalidate(data: any): z.infer<T> {\n\t\ttry {\n\t\t\treturn this.schema.parse(data);\n\t\t} catch (error) {\n\t\t\tthrow new ServerError(formatErrorMessage(error as z.ZodError));\n\t\t}\n\t}\n\n\t/**\n\t * Validates form data and returns the typed result, throwing `UnprocessableEntity` on failure.\n\t * The error includes `fieldErrors`, `fields`, and `data.scrollTo` (first failing field name).\n\t *\n\t * @param data - The raw form data to validate.\n\t * @param message - Optional human-readable error message for the 422 response.\n\t * @throws `UnprocessableEntity` with structured field errors for client-side form handling.\n\t *\n\t * @example\n\t * ```typescript\n\t * const validator = new SchemaValidator(registerSchema);\n\t * const body = validator.formValidate(await decodeRequestBody(request));\n\t * ```\n\t */\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tformValidate(data: any, message?: string): z.infer<T> {\n\t\tconst formParsed = formParse([data, this.schema]);\n\n\t\tif (\"fieldErrors\" in formParsed) {\n\t\t\tconst firstErrorKey = Object.keys(formParsed.fieldErrors)[0];\n\n\t\t\tthrow new UnprocessableEntity({\n\t\t\t\tfields: formParsed.fields,\n\t\t\t\tfieldErrors: formParsed.fieldErrors,\n\t\t\t\tdata: { scrollTo: firstErrorKey },\n\t\t\t\tmessage,\n\t\t\t});\n\t\t}\n\n\t\treturn formParsed.data as z.infer<T>;\n\t}\n\n\t/**\n\t * Async version of `formValidate` for schemas with async refinements (e.g. uniqueness checks).\n\t *\n\t * @param data - The raw form data to validate.\n\t * @param message - Optional human-readable error message for the 422 response.\n\t * @throws `UnprocessableEntity` with structured field errors for client-side form handling.\n\t *\n\t * @example\n\t * ```typescript\n\t * const validator = new SchemaValidator(registerSchema);\n\t * const body = await validator.formAsyncValidate(await decodeRequestBody(request));\n\t * ```\n\t */\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tasync formAsyncValidate(data: any, message?: string): Promise<z.infer<T>> {\n\t\tconst formParsed = await formAsyncParse([data, this.schema]);\n\n\t\tif (\"fieldErrors\" in formParsed) {\n\t\t\tconst firstErrorKey = Object.keys(formParsed.fieldErrors)[0];\n\n\t\t\tthrow new UnprocessableEntity({\n\t\t\t\tfields: formParsed.fields,\n\t\t\t\tfieldErrors: formParsed.fieldErrors,\n\t\t\t\tdata: { scrollTo: firstErrorKey },\n\t\t\t\tmessage,\n\t\t\t});\n\t\t}\n\n\t\treturn formParsed.data as z.infer<T>;\n\t}\n}\n\nexport { SchemaValidator };\n","import { removeNonNumeric } from \"@arkyn/shared\";\n\n/**\n * Validates a Brazilian CEP (postal code).\n *\n * A valid CEP must contain exactly 8 numeric digits,\n * optionally formatted as \"12345-678\".\n *\n * @param rawCep - CEP value, with or without formatting.\n * @returns `true` if the CEP is valid, otherwise `false`.\n *\n * @example\n * ```typescript\n * validateCep(\"12345-678\"); // true\n * validateCep(\"12345678\"); // true\n * validateCep(\"ABCDE-123\"); // false\n * ```\n */\n\nfunction validateCep(rawCep: string): boolean {\n\tconst validFormat = /^\\d{5}-\\d{3}$/.test(rawCep) || /^\\d{8}$/.test(rawCep);\n\tif (!validFormat) return false;\n\n\tconst cep = removeNonNumeric(rawCep);\n\n\tconst CEP_LENGTH = 8;\n\tconst isOnlyDigits = /^\\d{8}$/.test(cep);\n\n\treturn cep.length === CEP_LENGTH && isOnlyDigits;\n}\n\nexport { validateCep };\n","import { removeNonNumeric } from \"@arkyn/shared\";\n\nfunction isInvalidLength(cnpj: string) {\n\tconst CNPJ_LENGTH = 14;\n\treturn cnpj.length !== CNPJ_LENGTH;\n}\n\nfunction hasAllDigitsEqual(cnpj: string) {\n\tconst [firstDigit] = cnpj;\n\treturn [...cnpj].every((digit) => digit === firstDigit);\n}\n\nfunction calculateDigit(cnpj: string, multipliers: number[]) {\n\tlet total = 0;\n\tfor (let i = 0; i < multipliers.length; i++) {\n\t\ttotal += parseInt(cnpj[i], 10) * multipliers[i];\n\t}\n\tconst rest = total % 11;\n\treturn rest < 2 ? 0 : 11 - rest;\n}\n\nfunction extractDigit(cnpj: string) {\n\treturn cnpj.slice(12);\n}\n\n/**\n * Validates a Brazilian CNPJ (Cadastro Nacional da Pessoa Jurídica) number.\n *\n * This function performs:\n * - Sanitization (removes non-digit characters).\n * - Length check (must be 14 digits).\n * - Repeating digits check (invalid if all digits are the same).\n * - Verifies the two check digits with the proper weights.\n *\n * @param rawCnpj - CNPJ string, possibly formatted.\n * @returns `true` if valid, otherwise `false`.\n *\n * @example\n * ```typescript\n * validateCnpj(\"12.345.678/0001-95\"); // false\n * validateCnpj(\"11.444.777/0001-61\"); // true\n * ```\n */\n\nfunction validateCnpj(rawCnpj: string): boolean {\n\tif (!rawCnpj) return false;\n\tif (rawCnpj.length > 18) return false;\n\tif (rawCnpj.length < 14) return false;\n\n\tconst hasSpaces = /\\s/.test(rawCnpj);\n\tif (hasSpaces) return false;\n\n\tconst cnpj = removeNonNumeric(rawCnpj);\n\n\tif (isInvalidLength(cnpj)) return false;\n\tif (hasAllDigitsEqual(cnpj)) return false;\n\n\tconst base = cnpj.slice(0, 12);\n\tconst digit1 = calculateDigit(base, [5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2]);\n\tconst digit2 = calculateDigit(\n\t\tbase + digit1,\n\t\t[6, 5, 4, 3, 2, 9, 8, 7, 6, 5, 4, 3, 2],\n\t);\n\n\treturn extractDigit(cnpj) === `${digit1}${digit2}`;\n}\n\nexport { validateCnpj };\n","import { removeNonNumeric } from \"@arkyn/shared\";\n\nfunction isInvalidLength(cpf: string) {\n\tconst CPF_LENGTH = 11;\n\treturn cpf.length !== CPF_LENGTH;\n}\n\nfunction hasAllDigitsEqual(cpf: string) {\n\tconst [firstCpfDigit] = cpf;\n\treturn [...cpf].every((digit) => digit === firstCpfDigit);\n}\n\nfunction calculateDigit(cpf: string, factor: number) {\n\tlet total = 0;\n\tfor (const digit of cpf) {\n\t\tif (factor > 1) total += parseInt(digit, 10) * factor--;\n\t}\n\tconst rest = total % 11;\n\treturn rest < 2 ? 0 : 11 - rest;\n}\n\nfunction extractDigit(cpf: string) {\n\treturn cpf.slice(9);\n}\n\n/**\n * Validates a Brazilian CPF number. Strips formatting, checks length, rejects\n * repeated-digit sequences, and verifies both check digits with the CPF algorithm.\n *\n * @param rawCpf - CPF string, with or without formatting (dots and dashes).\n * @returns `true` if the CPF is valid, otherwise `false`.\n *\n * @example\n * ```typescript\n * validateCpf(\"123.456.789-09\"); // false\n * validateCpf(\"111.444.777-35\"); // true\n * ```\n */\n\nfunction validateCpf(rawCpf: string): boolean {\n\tif (!rawCpf) return false;\n\tif (rawCpf.length > 14) return false;\n\tif (rawCpf.length < 11) return false;\n\n\tconst hasSpaces = /\\s/.test(rawCpf);\n\tif (hasSpaces) return false;\n\n\tconst cpf = removeNonNumeric(rawCpf);\n\n\tif (isInvalidLength(cpf)) return false;\n\tif (hasAllDigitsEqual(cpf)) return false;\n\n\tconst digit1 = calculateDigit(cpf, 10);\n\tconst digit2 = calculateDigit(cpf, 11);\n\n\treturn extractDigit(cpf) === `${digit1}${digit2}`;\n}\n\nexport { validateCpf };\n","import { ValidateDateService } from \"@arkyn/shared\";\n\n/**\n * Validates a date string against a format and optional year bounds.\n *\n * @param date - The date string to validate.\n * @param config.inputFormat - Parsing format: `\"brazilianDate\"` (DD/MM/YYYY, default), `\"isoDate\"` (MM-DD-YYYY), or `\"timestamp\"` (YYYY-MM-DD).\n * @param config.minYear - Minimum allowed year. Defaults to 1900.\n * @param config.maxYear - Maximum allowed year. Defaults to 3000.\n * @returns `true` if the date is valid according to the format and bounds, otherwise `false`.\n *\n * @example\n * ```typescript\n * validateDate(\"31/12/2023\"); // true\n * validateDate(\"2023-12-31\", { inputFormat: \"timestamp\", minYear: 2000, maxYear: 2100 }); // true\n * validateDate(\"29/02/2023\"); // false (not a leap year)\n * ```\n */\n\nfunction validateDate(\n\tdate: string,\n\tconfig?: {\n\t\tinputFormat?: \"brazilianDate\" | \"isoDate\" | \"timestamp\";\n\t\tminYear?: number;\n\t\tmaxYear?: number;\n\t},\n): boolean {\n\tconst inputFormat = config?.inputFormat || \"brazilianDate\";\n\tconst minYear = config?.minYear || 1900;\n\tconst maxYear = config?.maxYear || 3000;\n\n\tconst validateDateService = new ValidateDateService();\n\tvalidateDateService.validateInputFormat(inputFormat);\n\n\tlet day: number, month: number, year: number;\n\tconst dateParts = date.split(/[-/]/).map(Number);\n\n\tif (dateParts.length !== 3) return false;\n\n\ttry {\n\t\tswitch (inputFormat) {\n\t\t\tcase \"brazilianDate\":\n\t\t\t\t[day, month, year] = dateParts;\n\t\t\t\tvalidateDateService.validateDateParts(year, month, day);\n\t\t\t\tbreak;\n\t\t\tcase \"isoDate\":\n\t\t\t\t[month, day, year] = dateParts;\n\t\t\t\tvalidateDateService.validateDateParts(year, month, day);\n\t\t\t\tbreak;\n\t\t\tcase \"timestamp\":\n\t\t\t\t[year, month, day] = dateParts;\n\t\t\t\tvalidateDateService.validateDateParts(year, month, day);\n\t\t\t\tbreak;\n\t\t}\n\t\tif (year < minYear || year > maxYear) return false;\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport { validateDate };\n","import dns from \"node:dns\";\n\nfunction isValidBasicFormat(email: string): boolean {\n\tconst emailRegex =\n\t\t/^[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])?)*$/;\n\n\treturn emailRegex.test(email);\n}\n\nfunction isValidLocalPart(localPart: string): boolean {\n\tif (localPart.length === 0 || localPart.length > 64) return false;\n\tif (localPart.startsWith(\".\") || localPart.endsWith(\".\")) return false;\n\tif (localPart.includes(\"..\")) return false;\n\n\tconst validLocalRegex = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+$/;\n\tif (!validLocalRegex.test(localPart)) return false;\n\n\treturn true;\n}\n\nfunction isValidDomainLabel(label: string): boolean {\n\tif (label.length === 0 || label.length > 63) return false;\n\tif (label.startsWith(\"-\") || label.endsWith(\"-\")) return false;\n\tif (!/^[a-zA-Z0-9-]+$/.test(label)) return false;\n\treturn true;\n}\n\nfunction isValidDomainPart(domainPart: string): boolean {\n\tif (domainPart.length === 0 || domainPart.length > 253) return false;\n\n\tif (\n\t\tdomainPart.startsWith(\".\") ||\n\t\tdomainPart.endsWith(\".\") ||\n\t\tdomainPart.startsWith(\"-\") ||\n\t\tdomainPart.endsWith(\"-\")\n\t) {\n\t\treturn false;\n\t}\n\n\tconst labels = domainPart.split(\".\");\n\tif (labels.length < 2) return false;\n\n\tfor (const label of labels) if (!isValidDomainLabel(label)) return false;\n\n\tconst tld = labels[labels.length - 1];\n\tif (tld.length < 2 || !/^[a-zA-Z]+$/.test(tld)) return false;\n\n\treturn true;\n}\n\nfunction isValidAdvancedSyntax(email: string): boolean {\n\tconst parts = email.split(\"@\");\n\tif (parts.length !== 2) return false;\n\n\tconst [localPart, domainPart] = parts;\n\n\tif (!isValidLocalPart(localPart)) return false;\n\tif (!isValidDomainPart(domainPart)) return false;\n\treturn true;\n}\n\nfunction extractDomain(email: string): string | null {\n\tconst parts = email.split(\"@\");\n\treturn parts.length === 2 ? parts[1].toLowerCase() : null;\n}\n\nconst DNS_RECORD_TYPES = [\"MX\", \"A\", \"AAAA\"] as const;\n\nasync function tryResolveDnsRecord(\n\tdomain: string,\n\trecordType: string,\n): Promise<boolean> {\n\ttry {\n\t\tawait dns?.promises?.resolve(domain, recordType);\n\t\treturn true;\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nasync function isValidDns(domain: string): Promise<boolean> {\n\tfor (const recordType of DNS_RECORD_TYPES) {\n\t\tconst hasRecord = await tryResolveDnsRecord(domain, recordType);\n\t\tif (hasRecord) return true;\n\t}\n\treturn false;\n}\n\n/**\n * Validates if an email address is valid in all possible ways, including DNS validation.\n *\n * This function performs comprehensive email validation by:\n * - Checking basic email format and syntax\n * - Validating advanced RFC 5322 compliance rules\n * - Verifying that the domain has valid MX or A records in DNS\n *\n * @param rawEmail - The email address to validate.\n * @returns `true` if the email passes format checks and its domain resolves in DNS, otherwise `false`.\n *\n * @example\n * ```typescript\n * await validateEmail(\"user@gmail.com\"); // true\n * await validateEmail(\"user@gmil.com\"); // false (invalid domain)\n * await validateEmail(\"invalid-email\"); // false (invalid format)\n * ```\n */\n\nasync function validateEmail(rawEmail: string): Promise<boolean> {\n\tif (!rawEmail || typeof rawEmail !== \"string\") return false;\n\tconst email = rawEmail.trim();\n\n\tif (!isValidBasicFormat(email)) return false;\n\tif (!isValidAdvancedSyntax(email)) return false;\n\n\tconst domain = extractDomain(email);\n\tif (!domain) return false;\n\n\treturn await isValidDns(domain);\n}\n\nexport { validateEmail };\n","/**\n * Validates a password based on the following rules:\n * - At least 8 characters\n * - At least 1 uppercase letter\n * - At least 1 letter (any case)\n * - At least 1 number\n * - At least 1 special character\n *\n * @param rawPassword - The password string to validate.\n * @returns `true` if the password meets all rules, otherwise `false`.\n *\n * @example\n * ```ts\n * validatePassword(\"Senha@123\"); // true\n * validatePassword(\"senha123\"); // false (no uppercase, no special char)\n * ```\n */\n\nfunction validatePassword(rawPassword: string): boolean {\n\tif (!rawPassword) return false;\n\n\tconst hasMinLength = rawPassword.length >= 8;\n\tconst hasUppercase = /[A-Z]/.test(rawPassword);\n\tconst hasLetter = /[a-z]/.test(rawPassword);\n\tconst hasNumber = /\\d/.test(rawPassword);\n\tconst hasSpecialChar = /[!@#$%^&*(),.?\":;{}|<>_\\-+=~`[\\]\\\\/]/.test(\n\t\trawPassword,\n\t);\n\n\treturn [\n\t\thasMinLength,\n\t\thasUppercase,\n\t\thasLetter,\n\t\thasNumber,\n\t\thasSpecialChar,\n\t].every((condition) => condition);\n}\n\nexport { validatePassword };\n","import { countries } from \"@arkyn/templates\";\nimport {\n\tisValidPhoneNumber,\n\tparsePhoneNumberWithError,\n} from \"libphonenumber-js\";\n\n/**\n * Validates an international phone number using `libphonenumber-js`, then confirms\n * the parsed country code is present in the supported countries list.\n *\n * @param rawPhone - Phone number in E.164 format (e.g. `\"+5532912345678\"`).\n * @returns `true` if the number is valid and the country is supported, otherwise `false`.\n *\n * @example\n * ```typescript\n * validatePhone(\"+5532912345678\"); // true (Brazil)\n * validatePhone(\"+55329123456178\"); // false (invalid)\n * ```\n */\n\nfunction validatePhone(rawPhone: string): boolean {\n\tif (!isValidPhoneNumber(rawPhone)) return false;\n\n\tconst parsedPhone = parsePhoneNumberWithError(rawPhone);\n\n\tconst countryCode = parsedPhone?.country;\n\tif (!countryCode) return false;\n\n\tconst country = countries.find((c) => c.iso === countryCode);\n\tif (!country) return false;\n\n\treturn true;\n}\n\nexport { validatePhone };\n","/**\n * Validates a Brazilian RG (Registro Geral) in a generic way.\n *\n * This function does a basic structure validation:\n * - Removes non-alphanumeric characters.\n * - Ensures length is reasonable (7–9 digits).\n * - Optionally allows for a final letter (verifier).\n *\n * @param rawRg - RG string, possibly formatted.\n * @returns `true` if format seems valid, otherwise `false`.\n *\n * @example\n * ```ts\n * validateRg(\"12.345.678-9\"); // true\n * validateRg(\"MG-12.345.678\"); // false (not supported)\n * validateRg(\"12345678X\"); // true\n * ```\n */\n\nfunction validateRg(rawRg: string): boolean {\n\tif (!rawRg) return false;\n\n\tconst validFormat = /^[0-9a-zA-Z.-]+$/.test(rawRg);\n\tif (!validFormat) return false;\n\n\tconst rg = rawRg.replace(/[^a-zA-Z0-9]/g, \"\");\n\n\tif (rg.length < 7 || rg.length > 9) return false;\n\n\tconst isValidFormat = /^[0-9]{7,8}[0-9Xx]?$/.test(rg);\n\n\treturn isValidFormat;\n}\n\nexport { validateRg };\n"],"mappings":";;;;;;AAaA,IAAM,IAAN,MAAM,EAAa;CAKlB,OAAO,cAAwB,CAAC;CAOhC,OAAO,cAAc,GAAoB;EACxC,EAAa,YAAY,KAAK,CAAI;CACnC;CAGA,OAAO,mBAAyB;EAC/B,EAAa,cAAc,CAAC;CAC7B;CAQA,OAAO,YAAY;EAClB,IAAM,IAAc,QAAQ,IAAI,GAI1B,MADQ,gBADE,MACF,EAAA,CAAI,SAAS,GAAA,CACF,MAAM,IAAI,CAAC,CAAC,KAAK,MAAS,EAAK,KAAK,CAAC,GAE1D,IAAc;EAElB,OACC,IAAc,EAAW,WACxB,EAAW,EAAY,CAAC,SAAS,eAAe,KAChD,EAAW,EAAY,CAAC,SAAS,gBAAgB,KAElD;EAGD,IAAI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|
+
//#region src/http/api/_deleteRequest.ts
|
|
3
|
+
async function t(t) {
|
|
4
|
+
return e({
|
|
5
|
+
method: "DELETE",
|
|
6
|
+
url: t.url,
|
|
7
|
+
urlParams: t.urlParams,
|
|
8
|
+
headers: t.headers,
|
|
9
|
+
body: t.body
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { t as deleteRequest };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=_deleteRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_deleteRequest.js","names":[],"sources":["../../../../src/http/api/_deleteRequest.ts"],"sourcesContent":["import { type ApiResponseDTO, makeRequest } from \"./_makeRequest\";\n\ntype InputProps = {\n\turl: string;\n\turlParams?: Record<string, string>;\n\theaders?: HeadersInit;\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tbody?: any;\n};\n\n/**\n * Sends a DELETE request to the specified URL with optional headers and body.\n *\n * @template T - The expected type of the response data.\n * @param {InputProps} input - The options for the DELETE request, including URL, URL parameters, headers, and body.\n * @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.\n */\n\n// biome-ignore lint/suspicious/noExplicitAny: intentional\nasync function deleteRequest<T = any>(\n\tinput: InputProps,\n): Promise<ApiResponseDTO<T>> {\n\treturn makeRequest({\n\t\tmethod: \"DELETE\",\n\t\turl: input.url,\n\t\turlParams: input.urlParams,\n\t\theaders: input.headers,\n\t\tbody: input.body,\n\t});\n}\n\nexport { deleteRequest };\n"],"mappings":";;AAmBA,eAAe,EACd,GAC6B;CAC7B,OAAO,EAAY;EAClB,QAAQ;EACR,KAAK,EAAM;EACX,WAAW,EAAM;EACjB,SAAS,EAAM;EACf,MAAM,EAAM;CACb,CAAC;AACF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { makeRequest as e } from "./_makeRequest.js";
|
|
2
|
+
//#region src/http/api/_getRequest.ts
|
|
3
|
+
async function t(t) {
|
|
4
|
+
return e({
|
|
5
|
+
method: "GET",
|
|
6
|
+
url: t.url,
|
|
7
|
+
urlParams: t.urlParams,
|
|
8
|
+
headers: t.headers
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { t as getRequest };
|
|
13
|
+
|
|
14
|
+
//# sourceMappingURL=_getRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_getRequest.js","names":[],"sources":["../../../../src/http/api/_getRequest.ts"],"sourcesContent":["import { type ApiResponseDTO, makeRequest } from \"./_makeRequest\";\n\ntype InputProps = {\n\turl: string;\n\turlParams?: Record<string, string>;\n\theaders?: HeadersInit;\n};\n\n/**\n * Sends a GET request to the specified URL with optional headers.\n *\n * @template T - The expected type of the response data.\n * @param {InputProps} input - The options for the GET request, including URL, URL parameters, and headers.\n * @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.\n */\n\n// biome-ignore lint/suspicious/noExplicitAny: intentional\nasync function getRequest<T = any>(\n\tinput: InputProps,\n): Promise<ApiResponseDTO<T>> {\n\treturn makeRequest({\n\t\tmethod: \"GET\",\n\t\turl: input.url,\n\t\turlParams: input.urlParams,\n\t\theaders: input.headers,\n\t});\n}\n\nexport { getRequest };\n"],"mappings":";;AAiBA,eAAe,EACd,GAC6B;CAC7B,OAAO,EAAY;EAClB,QAAQ;EACR,KAAK,EAAM;EACX,WAAW,EAAM;EACjB,SAAS,EAAM;CAChB,CAAC;AACF"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
//#region src/http/api/_logMapperService.ts
|
|
2
|
+
var e = class e {
|
|
3
|
+
static mapHeaders(e) {
|
|
4
|
+
return e instanceof Headers ? Object.fromEntries(e.entries()) : typeof e == "object" ? Object.entries(e).reduce((e, [t, n]) => (typeof n == "string" ? e[t] = n : Array.isArray(n) ? e[t] = n.join(", ") : e[t] = JSON.stringify(n), e), {}) : {};
|
|
5
|
+
}
|
|
6
|
+
static mapQueryParams(e) {
|
|
7
|
+
let t = {};
|
|
8
|
+
return e.forEach((e, n) => {
|
|
9
|
+
t[n] = e;
|
|
10
|
+
}), t;
|
|
11
|
+
}
|
|
12
|
+
static handle(t) {
|
|
13
|
+
return {
|
|
14
|
+
rawUrl: t.rawUrl,
|
|
15
|
+
status: t.status,
|
|
16
|
+
method: t.method,
|
|
17
|
+
token: null,
|
|
18
|
+
elapsedTime: t.elapsedTime,
|
|
19
|
+
requestHeaders: e.mapHeaders(t.requestHeaders),
|
|
20
|
+
requestBody: t.requestBody || null,
|
|
21
|
+
queryParams: {
|
|
22
|
+
...e.mapQueryParams(t.queryParams),
|
|
23
|
+
...t.urlParams
|
|
24
|
+
},
|
|
25
|
+
responseHeaders: e.mapHeaders(t.responseHeaders),
|
|
26
|
+
responseBody: t.responseBody || null
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
export { e as LogMapperService };
|
|
32
|
+
|
|
33
|
+
//# sourceMappingURL=_logMapperService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_logMapperService.js","names":[],"sources":["../../../../src/http/api/_logMapperService.ts"],"sourcesContent":["/**\n * Input properties for log mapping.\n *\n * @typedef {object} InputProps\n * @property {number} status - HTTP response status code.\n * @property {string} url - The request URL.\n * @property {\"GET\" | \"POST\" | \"PUT\" | \"DELETE\" | \"PATCH\"} method - HTTP method used.\n * @property {HeadersInit} requestHeaders - Headers sent with the request.\n * @property {HeadersInit} responseHeaders - Headers received in the response.\n * @property {any} requestBody - Body of the request.\n * @property {number} elapsedTime - Time elapsed for the request in milliseconds.\n * @property {any} responseBody - Body of the response.\n * @property {URLSearchParams} queryParams - Query parameters from the URL.\n */\ntype InputProps = {\n\tstatus: number;\n\trawUrl: string;\n\turlParams?: Record<string, string>;\n\tmethod: \"GET\" | \"POST\" | \"PUT\" | \"DELETE\" | \"PATCH\";\n\trequestHeaders: HeadersInit;\n\tresponseHeaders: HeadersInit;\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\trequestBody: any;\n\telapsedTime: number;\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tresponseBody: any;\n\tqueryParams: URLSearchParams;\n};\n\n/**\n * Output properties after log mapping transformation.\n *\n * @typedef {object} OutputProps\n * @property {string} rawUrl - The original request URL.\n * @property {number} status - HTTP response status code.\n * @property {\"GET\" | \"POST\" | \"PUT\" | \"DELETE\" | \"PATCH\"} method - HTTP method used.\n * @property {string | null} token - Authentication token (if present).\n * @property {number} elapsedTime - Time elapsed for the request in milliseconds.\n * @property {Record<string, string>} requestHeaders - Mapped request headers.\n * @property {Record<string, string>} requestBody - Mapped request body.\n * @property {Record<string, string>} queryParams - Mapped query parameters.\n * @property {Record<string, string>} responseHeaders - Mapped response headers.\n * @property {any} responseBody - The response body.\n */\ntype OutputProps = {\n\trawUrl: string;\n\tstatus: number;\n\tmethod: \"GET\" | \"POST\" | \"PUT\" | \"DELETE\" | \"PATCH\";\n\ttoken: string | null;\n\telapsedTime: number;\n\trequestHeaders: Record<string, string>;\n\trequestBody: Record<string, string>;\n\tqueryParams: Record<string, string>;\n\tresponseHeaders: Record<string, string>;\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tresponseBody: any;\n};\n\n/**\n * Static service for mapping HTTP request/response data into a standardized log format.\n *\n * Provides utilities to transform headers and query parameters into plain objects,\n * and produces a unified output structure for logging purposes.\n */\nclass LogMapperService {\n\t/**\n\t * Converts various header formats into a plain key-value object.\n\t *\n\t * @param {HeadersInit} headers - The headers to map.\n\t * @returns {Record<string, string>} A plain object with header key-value pairs.\n\t * @private\n\t */\n\tprivate static mapHeaders(headers: HeadersInit): Record<string, string> {\n\t\tif (headers instanceof Headers) {\n\t\t\treturn Object.fromEntries(headers.entries());\n\t\t} else if (typeof headers === \"object\") {\n\t\t\treturn Object.entries(headers).reduce(\n\t\t\t\t(acc, [key, value]) => {\n\t\t\t\t\tif (typeof value === \"string\") acc[key] = value;\n\t\t\t\t\telse if (Array.isArray(value)) acc[key] = value.join(\", \");\n\t\t\t\t\telse acc[key] = JSON.stringify(value);\n\t\t\t\t\treturn acc;\n\t\t\t\t},\n\t\t\t\t{} as Record<string, string>,\n\t\t\t);\n\t\t}\n\t\treturn {};\n\t}\n\n\t/**\n\t * Converts URLSearchParams into a plain key-value object.\n\t *\n\t * @param {URLSearchParams} queryParams - The query parameters to map.\n\t * @returns {Record<string, string>} A plain object with query parameter key-value pairs.\n\t * @private\n\t */\n\tprivate static mapQueryParams(\n\t\tqueryParams: URLSearchParams,\n\t): Record<string, string> {\n\t\tconst params: Record<string, string> = {};\n\n\t\tqueryParams.forEach((value, key) => {\n\t\t\tparams[key] = value;\n\t\t});\n\n\t\treturn params;\n\t}\n\n\t/**\n\t * Transforms raw HTTP request/response data into a standardized log output format.\n\t *\n\t * @param {InputProps} props - The input properties containing request/response data.\n\t * @returns {OutputProps} The mapped output object ready for logging.\n\t */\n\tstatic handle(props: InputProps): OutputProps {\n\t\treturn {\n\t\t\trawUrl: props.rawUrl,\n\t\t\tstatus: props.status,\n\t\t\tmethod: props.method,\n\t\t\ttoken: null,\n\t\t\telapsedTime: props.elapsedTime,\n\t\t\trequestHeaders: LogMapperService.mapHeaders(props.requestHeaders),\n\t\t\trequestBody: props.requestBody || null,\n\t\t\tqueryParams: {\n\t\t\t\t...LogMapperService.mapQueryParams(props.queryParams),\n\t\t\t\t...props.urlParams,\n\t\t\t},\n\t\t\tresponseHeaders: LogMapperService.mapHeaders(props.responseHeaders),\n\t\t\tresponseBody: props.responseBody || null,\n\t\t};\n\t}\n}\n\nexport { LogMapperService };\n"],"mappings":";AAgEA,IAAM,IAAN,MAAM,EAAiB;CAQtB,OAAe,WAAW,GAA8C;EAcvE,OAbI,aAAmB,UACf,OAAO,YAAY,EAAQ,QAAQ,CAAC,IACjC,OAAO,KAAY,WACtB,OAAO,QAAQ,CAAO,CAAC,CAAC,QAC7B,GAAK,CAAC,GAAK,QACP,OAAO,KAAU,WAAU,EAAI,KAAO,IACjC,MAAM,QAAQ,CAAK,IAAG,EAAI,KAAO,EAAM,KAAK,IAAI,IACpD,EAAI,KAAO,KAAK,UAAU,CAAK,GAC7B,IAER,CAAC,CACF,IAEM,CAAC;CACT;CASA,OAAe,eACd,GACyB;EACzB,IAAM,IAAiC,CAAC;EAMxC,OAJA,EAAY,SAAS,GAAO,MAAQ;GACnC,EAAO,KAAO;EACf,CAAC,GAEM;CACR;CAQA,OAAO,OAAO,GAAgC;EAC7C,OAAO;GACN,QAAQ,EAAM;GACd,QAAQ,EAAM;GACd,QAAQ,EAAM;GACd,OAAO;GACP,aAAa,EAAM;GACnB,gBAAgB,EAAiB,WAAW,EAAM,cAAc;GAChE,aAAa,EAAM,eAAe;GAClC,aAAa;IACZ,GAAG,EAAiB,eAAe,EAAM,WAAW;IACpD,GAAG,EAAM;GACV;GACA,iBAAiB,EAAiB,WAAW,EAAM,eAAe;GAClE,cAAc,EAAM,gBAAgB;EACrC;CACD;AACD"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { flushDebugLogs as e } from "../../utilities/flushDebugLogs.js";
|
|
2
|
+
import { LogService as t } from "../../services/logService.js";
|
|
3
|
+
import { formatJsonObject as n } from "@arkyn/shared";
|
|
4
|
+
//#region src/http/api/_logRequest.ts
|
|
5
|
+
async function r(r) {
|
|
6
|
+
let i = t.getConfig();
|
|
7
|
+
if (!i) return;
|
|
8
|
+
let { userToken: a, apiUrl: o, trafficSourceId: s } = i, { elapsedTime: c, method: l, queryParams: u, requestBody: d, requestHeaders: f, responseBody: p, responseHeaders: m, status: h, rawUrl: g } = r;
|
|
9
|
+
if (process.env.NODE_ENV !== "development") try {
|
|
10
|
+
let t = new URL(g), r = "https";
|
|
11
|
+
t.protocol === "http:" && (r = "http");
|
|
12
|
+
let i = JSON.stringify({
|
|
13
|
+
domainUrl: `${t.protocol}//${t.host}`,
|
|
14
|
+
pathnameUrl: t.pathname,
|
|
15
|
+
trafficSourceId: s,
|
|
16
|
+
status: h,
|
|
17
|
+
protocol: r,
|
|
18
|
+
method: l.toLowerCase(),
|
|
19
|
+
trafficUserId: null,
|
|
20
|
+
elapsedTime: c,
|
|
21
|
+
requestHeaders: JSON.stringify(f),
|
|
22
|
+
requestBody: JSON.stringify(d),
|
|
23
|
+
queryParams: JSON.stringify(u),
|
|
24
|
+
responseHeaders: JSON.stringify(m),
|
|
25
|
+
responseBody: JSON.stringify(p)
|
|
26
|
+
}), _ = {
|
|
27
|
+
"Content-Type": "application/json",
|
|
28
|
+
Authorization: `Bearer ${a}`
|
|
29
|
+
}, v = await fetch(o, {
|
|
30
|
+
method: "POST",
|
|
31
|
+
body: i,
|
|
32
|
+
headers: _
|
|
33
|
+
});
|
|
34
|
+
if (!v.ok) {
|
|
35
|
+
let t = await v.text(), r = v.status, i = v.statusText, a = await v.json().catch(() => null);
|
|
36
|
+
e({
|
|
37
|
+
name: "LogError",
|
|
38
|
+
scheme: "red",
|
|
39
|
+
debugs: [
|
|
40
|
+
"Failed to log request.",
|
|
41
|
+
`Status: ${r} ${i}.`,
|
|
42
|
+
`Status text: ${t}.`,
|
|
43
|
+
`JSON Response: ${a ? n(a, 0) : "No JSON response"}`
|
|
44
|
+
]
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
} catch (t) {
|
|
48
|
+
e({
|
|
49
|
+
debugs: [`Error sending request: ${t}`],
|
|
50
|
+
name: "LogError",
|
|
51
|
+
scheme: "red"
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
export { r as logRequest };
|
|
57
|
+
|
|
58
|
+
//# sourceMappingURL=_logRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_logRequest.js","names":[],"sources":["../../../../src/http/api/_logRequest.ts"],"sourcesContent":["import { formatJsonObject } from \"@arkyn/shared\";\nimport { flushDebugLogs } from \"../..\";\nimport { LogService } from \"../../services/logService\";\n\ntype ConfigProps = {\n\trawUrl: string;\n\tstatus: number;\n\tmethod: \"GET\" | \"POST\" | \"PUT\" | \"DELETE\" | \"PATCH\";\n\ttoken: string | null;\n\telapsedTime: number;\n\trequestHeaders: Record<string, string>;\n\trequestBody: Record<string, string>;\n\tqueryParams: Record<string, string>;\n\tresponseHeaders: Record<string, string>;\n\tresponseBody: Record<string, string>;\n};\n\n/**\n * Sends a request to the inbox flow API with the provided configuration.\n *\n * - This function retrieves the inbox flow configuration using `LogService.getConfig()`.\n * - If the configuration is not available, the function will return early without performing any action.\n * - In a development environment (`NODE_ENV === \"development\"`), the function will also return early.\n * - The request is sent as a POST request to the inbox API URL with the provided configuration details.\n * - If an error occurs during the request, it will be logged using the `httpDebug` service.\n *\n * @param {ConfigProps} config - The configuration object for the request.\n * @param {string} config.rawUrl - The raw URL of the request.\n * @param {number} config.status - The HTTP status code associated with the request.\n * @param {\"GET\" | \"POST\" | \"PUT\" | \"DELETE\" | \"PATCH\"} config.method - The HTTP method used for the request. Can be \"POST\", \"GET\", \"PUT\", \"DELETE\", or \"PATCH\".\n * @param {string | null} config.token - The authentication token for the request.\n * @param {number} config.elapsedTime - The elapsed time for the request in milliseconds.\n * @param {Record<string, string>} config.requestHeaders - The headers sent with the request.\n * @param {Record<string, string>} config.requestBody - The body of the request, if applicable.\n * @param {Record<string, string>} config.queryParams - The query parameters for the request.\n * @param {Record<string, string>} config.responseHeaders - The headers received in the response.\n * @param {Record<string, string>} config.responseBody - The body of the response received.\n *\n * @remarks\n *\n * @returns {Promise<void>} A promise that resolves when the request is complete.\n *\n * @example\n * ```typescript\n * const config = {\n * rawUrl: \"https://example.com/api/data\",\n * status: 200,\n * method: \"GET\",\n * token: \"auth-token-123\",\n * elapsedTime: 150,\n * requestHeaders: { \"Accept\": \"application/json\", \"Authorization\": \"Bearer token123\" },\n * requestBody: {},\n * queryParams: { \"page\": \"1\", \"limit\": \"10\" },\n * responseHeaders: { \"Content-Type\": \"application/json\" },\n * responseBody: { \"data\": \"example response\" }\n * };\n *\n * await logRequest(config);\n * ```\n */\n\nasync function logRequest(config: ConfigProps): Promise<void> {\n\tconst arkynService = LogService.getConfig();\n\tif (!arkynService) return;\n\n\tconst { userToken, apiUrl, trafficSourceId } = arkynService;\n\n\tconst {\n\t\telapsedTime,\n\t\tmethod,\n\t\tqueryParams,\n\t\trequestBody,\n\t\trequestHeaders,\n\t\tresponseBody,\n\t\tresponseHeaders,\n\t\tstatus,\n\t\trawUrl,\n\t} = config;\n\n\tif (process.env.NODE_ENV === \"development\") return;\n\n\ttry {\n\t\tconst url = new URL(rawUrl);\n\n\t\tlet protocol: \"http\" | \"https\" = \"https\";\n\t\tif (url.protocol === \"http:\") protocol = \"http\";\n\n\t\tconst body = JSON.stringify({\n\t\t\tdomainUrl: `${url.protocol}//${url.host}`,\n\t\t\tpathnameUrl: url.pathname,\n\t\t\ttrafficSourceId: trafficSourceId,\n\t\t\tstatus,\n\t\t\tprotocol,\n\t\t\tmethod: method.toLowerCase(),\n\t\t\ttrafficUserId: null,\n\t\t\telapsedTime,\n\t\t\trequestHeaders: JSON.stringify(requestHeaders),\n\t\t\trequestBody: JSON.stringify(requestBody),\n\t\t\tqueryParams: JSON.stringify(queryParams),\n\t\t\tresponseHeaders: JSON.stringify(responseHeaders),\n\t\t\tresponseBody: JSON.stringify(responseBody),\n\t\t});\n\n\t\tconst headers = {\n\t\t\t\"Content-Type\": \"application/json\",\n\t\t\tAuthorization: `Bearer ${userToken}`,\n\t\t};\n\n\t\tconst fetchResponse = await fetch(apiUrl, {\n\t\t\tmethod: \"POST\",\n\t\t\tbody,\n\t\t\theaders,\n\t\t});\n\n\t\tif (!fetchResponse.ok) {\n\t\t\tconst errorText = await fetchResponse.text();\n\t\t\tconst errorStatus = fetchResponse.status;\n\t\t\tconst errorStatusText = fetchResponse.statusText;\n\t\t\tconst jsonResponse = await fetchResponse.json().catch(() => null);\n\n\t\t\tflushDebugLogs({\n\t\t\t\tname: \"LogError\",\n\t\t\t\tscheme: \"red\",\n\t\t\t\tdebugs: [\n\t\t\t\t\t`Failed to log request.`,\n\t\t\t\t\t`Status: ${errorStatus} ${errorStatusText}.`,\n\t\t\t\t\t`Status text: ${errorText}.`,\n\t\t\t\t\t`JSON Response: ${jsonResponse ? formatJsonObject(jsonResponse, 0) : \"No JSON response\"}`,\n\t\t\t\t],\n\t\t\t});\n\t\t}\n\t} catch (err) {\n\t\tflushDebugLogs({\n\t\t\tdebugs: [`Error sending request: ${err}`],\n\t\t\tname: \"LogError\",\n\t\t\tscheme: \"red\",\n\t\t});\n\t}\n}\n\nexport { logRequest };\n"],"mappings":";;;;AA6DA,eAAe,EAAW,GAAoC;CAC7D,IAAM,IAAe,EAAW,UAAU;CAC1C,IAAI,CAAC,GAAc;CAEnB,IAAM,EAAE,cAAW,WAAQ,uBAAoB,GAEzC,EACL,gBACA,WACA,gBACA,gBACA,mBACA,iBACA,oBACA,WACA,cACG;CAEJ,YAAA,IAAA,aAA6B,eAE7B,IAAI;EACH,IAAM,IAAM,IAAI,IAAI,CAAM,GAEtB,IAA6B;EACjC,AAAI,EAAI,aAAa,YAAS,IAAW;EAEzC,IAAM,IAAO,KAAK,UAAU;GAC3B,WAAW,GAAG,EAAI,SAAS,IAAI,EAAI;GACnC,aAAa,EAAI;GACA;GACjB;GACA;GACA,QAAQ,EAAO,YAAY;GAC3B,eAAe;GACf;GACA,gBAAgB,KAAK,UAAU,CAAc;GAC7C,aAAa,KAAK,UAAU,CAAW;GACvC,aAAa,KAAK,UAAU,CAAW;GACvC,iBAAiB,KAAK,UAAU,CAAe;GAC/C,cAAc,KAAK,UAAU,CAAY;EAC1C,CAAC,GAEK,IAAU;GACf,gBAAgB;GAChB,eAAe,UAAU;EAC1B,GAEM,IAAgB,MAAM,MAAM,GAAQ;GACzC,QAAQ;GACR;GACA;EACD,CAAC;EAED,IAAI,CAAC,EAAc,IAAI;GACtB,IAAM,IAAY,MAAM,EAAc,KAAK,GACrC,IAAc,EAAc,QAC5B,IAAkB,EAAc,YAChC,IAAe,MAAM,EAAc,KAAK,CAAC,CAAC,YAAY,IAAI;GAEhE,EAAe;IACd,MAAM;IACN,QAAQ;IACR,QAAQ;KACP;KACA,WAAW,EAAY,GAAG,EAAgB;KAC1C,gBAAgB,EAAU;KAC1B,kBAAkB,IAAe,EAAiB,GAAc,CAAC,IAAI;IACtE;GACD,CAAC;EACF;CACD,SAAS,GAAK;EACb,EAAe;GACd,QAAQ,CAAC,0BAA0B,GAAK;GACxC,MAAM;GACN,QAAQ;EACT,CAAC;CACF;AACD"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { flushDebugLogs as e } from "../../utilities/flushDebugLogs.js";
|
|
2
|
+
import { LogMapperService as t } from "./_logMapperService.js";
|
|
3
|
+
import { logRequest as n } from "./_logRequest.js";
|
|
4
|
+
//#region src/http/api/_makeRequest.ts
|
|
5
|
+
async function r(r) {
|
|
6
|
+
let i = r.url;
|
|
7
|
+
r.urlParams && Object.entries(r.urlParams).forEach(([e, t]) => {
|
|
8
|
+
i = i.replaceAll(`:${e}`, t);
|
|
9
|
+
});
|
|
10
|
+
let a = {
|
|
11
|
+
POST: "Resource created successfully",
|
|
12
|
+
PUT: "Resource updated successfully",
|
|
13
|
+
DELETE: "Resource deleted successfully",
|
|
14
|
+
PATCH: "Resource patched successfully",
|
|
15
|
+
GET: "Request successful"
|
|
16
|
+
};
|
|
17
|
+
try {
|
|
18
|
+
let e = performance.now(), o = {
|
|
19
|
+
...r.headers,
|
|
20
|
+
"Content-Type": "application/json"
|
|
21
|
+
}, s = await fetch(i, {
|
|
22
|
+
headers: o,
|
|
23
|
+
method: r.method,
|
|
24
|
+
body: r.body ? JSON.stringify(r.body) : void 0
|
|
25
|
+
}), c = performance.now() - e, l = s.status, u = null;
|
|
26
|
+
try {
|
|
27
|
+
u = await s.json();
|
|
28
|
+
} catch {
|
|
29
|
+
u = null;
|
|
30
|
+
}
|
|
31
|
+
return n(t.handle({
|
|
32
|
+
elapsedTime: c,
|
|
33
|
+
method: r.method,
|
|
34
|
+
queryParams: new URL(i).searchParams,
|
|
35
|
+
requestHeaders: o,
|
|
36
|
+
requestBody: r.body,
|
|
37
|
+
responseBody: u,
|
|
38
|
+
responseHeaders: s.headers,
|
|
39
|
+
status: l,
|
|
40
|
+
rawUrl: r.url,
|
|
41
|
+
urlParams: r.urlParams
|
|
42
|
+
})), s.ok ? {
|
|
43
|
+
success: !0,
|
|
44
|
+
status: l,
|
|
45
|
+
message: u?.message || a[r.method],
|
|
46
|
+
response: u,
|
|
47
|
+
cause: null
|
|
48
|
+
} : {
|
|
49
|
+
success: !1,
|
|
50
|
+
status: l,
|
|
51
|
+
message: u?.message || s.statusText || "Request failed",
|
|
52
|
+
response: u,
|
|
53
|
+
cause: null
|
|
54
|
+
};
|
|
55
|
+
} catch (t) {
|
|
56
|
+
return e({
|
|
57
|
+
debugs: [`Network error or request failed: ${t}`],
|
|
58
|
+
name: "MakeRequestError",
|
|
59
|
+
scheme: "red"
|
|
60
|
+
}), {
|
|
61
|
+
success: !1,
|
|
62
|
+
status: 0,
|
|
63
|
+
message: "Network error or request failed",
|
|
64
|
+
response: null,
|
|
65
|
+
cause: t instanceof Error ? t.message : String(t)
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
//#endregion
|
|
70
|
+
export { r as makeRequest };
|
|
71
|
+
|
|
72
|
+
//# sourceMappingURL=_makeRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_makeRequest.js","names":[],"sources":["../../../../src/http/api/_makeRequest.ts"],"sourcesContent":["import { flushDebugLogs } from \"../..\";\nimport { LogMapperService } from \"./_logMapperService\";\nimport { logRequest } from \"./_logRequest\";\n\ntype InputProps = {\n\turl: string;\n\tmethod: \"POST\" | \"PUT\" | \"DELETE\" | \"PATCH\" | \"GET\";\n\turlParams?: Record<string, string>;\n\theaders?: HeadersInit;\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tbody?: any;\n};\n\n// biome-ignore lint/suspicious/noExplicitAny: intentional\ntype ApiSuccessResponse<T = any> = {\n\tsuccess: true;\n\tstatus: number;\n\tmessage: string;\n\tresponse: T;\n\tcause: null;\n};\n\ntype ApiFailedResponse = {\n\tsuccess: false;\n\tstatus: number;\n\tmessage: string;\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tresponse: any;\n\tcause: string | Error | null;\n};\n\n// biome-ignore lint/suspicious/noExplicitAny: intentional\ntype ApiResponseDTO<T = any> = ApiSuccessResponse<T> | ApiFailedResponse;\n\n/**\n * Makes an HTTP request using the Fetch API and returns a standardized response.\n *\n * @template {any} T - The expected type of the response data.\n *\n * @param {\"POST\" | \"PUT\" | \"DELETE\" | \"PATCH\" | \"GET\"} method - The HTTP method to use for the request. Supported methods are:\n * - \"POST\": Create a new resource.\n * - \"PUT\": Update an existing resource.\n * - \"DELETE\": Remove a resource.\n * - \"PATCH\": Partially update a resource.\n * - \"GET\": Retrieve a resource.\n * @param {string} url - The URL to which the request is sent.\n * @param {HeadersInit} headers - Optional headers to include in the request. Defaults to an empty object.\n * @param {any} body - Optional body to include in the request. Should be serializable to JSON.\n *\n * @returns {ApiResponseDTO<T>} A promise that resolves to an `ApiResponseDTO<T>` object containing:\n * - `success`: A boolean indicating whether the request was successful.\n * - `status`: The HTTP status code of the response.\n * - `message`: A message describing the result of the request.\n * - `response`: The parsed JSON response data, or `null` if parsing fails.\n * - `cause`: Additional error information, if applicable.\n *\n * @example\n * ```typescript\n * import { makeRequest } from \"./makeRequest\";\n *\n * async function fetchData() {\n * const response = await makeRequest(\"GET\", \"https://api.example.com/data\");\n * if (response.success) {\n * console.log(\"Data:\", response.response);\n * } else {\n * console.error(\"Error:\", response.message);\n * }\n * }\n * ```\n */\n\n// biome-ignore lint/suspicious/noExplicitAny: intentional\nasync function makeRequest<T = any>(\n\tinput: InputProps,\n): Promise<ApiResponseDTO<T>> {\n\tlet url = input.url;\n\n\tif (input.urlParams) {\n\t\tObject.entries(input.urlParams).forEach(([key, value]) => {\n\t\t\turl = url.replaceAll(`:${key}`, value);\n\t\t});\n\t}\n\n\tconst successMessage = {\n\t\tPOST: \"Resource created successfully\",\n\t\tPUT: \"Resource updated successfully\",\n\t\tDELETE: \"Resource deleted successfully\",\n\t\tPATCH: \"Resource patched successfully\",\n\t\tGET: \"Request successful\",\n\t};\n\n\ttry {\n\t\tconst startTime = performance.now();\n\n\t\tconst headers = { ...input.headers, \"Content-Type\": \"application/json\" };\n\t\tconst response = await fetch(url, {\n\t\t\theaders,\n\t\t\tmethod: input.method,\n\t\t\tbody: input.body ? JSON.stringify(input.body) : undefined,\n\t\t});\n\n\t\tconst elapsedTime = performance.now() - startTime;\n\t\tconst status = response.status;\n\n\t\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\t\tlet data: any = null;\n\t\ttry {\n\t\t\tdata = await response.json();\n\t\t} catch {\n\t\t\tdata = null;\n\t\t}\n\n\t\tconst logData = LogMapperService.handle({\n\t\t\telapsedTime,\n\t\t\tmethod: input.method,\n\t\t\tqueryParams: new URL(url).searchParams,\n\t\t\trequestHeaders: headers,\n\t\t\trequestBody: input.body,\n\t\t\tresponseBody: data,\n\t\t\tresponseHeaders: response.headers,\n\t\t\tstatus,\n\t\t\trawUrl: input.url,\n\t\t\turlParams: input.urlParams,\n\t\t});\n\n\t\tlogRequest(logData);\n\n\t\tif (!response.ok) {\n\t\t\treturn {\n\t\t\t\tsuccess: false,\n\t\t\t\tstatus,\n\t\t\t\tmessage: data?.message || response.statusText || \"Request failed\",\n\t\t\t\tresponse: data,\n\t\t\t\tcause: null,\n\t\t\t};\n\t\t}\n\n\t\treturn {\n\t\t\tsuccess: true,\n\t\t\tstatus,\n\t\t\tmessage: data?.message || successMessage[input.method],\n\t\t\tresponse: data,\n\t\t\tcause: null,\n\t\t};\n\t} catch (err) {\n\t\tflushDebugLogs({\n\t\t\tdebugs: [`Network error or request failed: ${err}`],\n\t\t\tname: \"MakeRequestError\",\n\t\t\tscheme: \"red\",\n\t\t});\n\n\t\treturn {\n\t\t\tsuccess: false,\n\t\t\tstatus: 0,\n\t\t\tmessage: \"Network error or request failed\",\n\t\t\tresponse: null,\n\t\t\tcause: err instanceof Error ? err.message : String(err),\n\t\t};\n\t}\n}\n\nexport { type ApiResponseDTO, makeRequest };\n"],"mappings":";;;;AAwEA,eAAe,EACd,GAC6B;CAC7B,IAAI,IAAM,EAAM;CAEhB,AAAI,EAAM,aACT,OAAO,QAAQ,EAAM,SAAS,CAAC,CAAC,SAAS,CAAC,GAAK,OAAW;EACzD,IAAM,EAAI,WAAW,IAAI,KAAO,CAAK;CACtC,CAAC;CAGF,IAAM,IAAiB;EACtB,MAAM;EACN,KAAK;EACL,QAAQ;EACR,OAAO;EACP,KAAK;CACN;CAEA,IAAI;EACH,IAAM,IAAY,YAAY,IAAI,GAE5B,IAAU;GAAE,GAAG,EAAM;GAAS,gBAAgB;EAAmB,GACjE,IAAW,MAAM,MAAM,GAAK;GACjC;GACA,QAAQ,EAAM;GACd,MAAM,EAAM,OAAO,KAAK,UAAU,EAAM,IAAI,IAAI,KAAA;EACjD,CAAC,GAEK,IAAc,YAAY,IAAI,IAAI,GAClC,IAAS,EAAS,QAGpB,IAAY;EAChB,IAAI;GACH,IAAO,MAAM,EAAS,KAAK;EAC5B,QAAQ;GACP,IAAO;EACR;EA2BA,OAZA,EAbgB,EAAiB,OAAO;GACvC;GACA,QAAQ,EAAM;GACd,aAAa,IAAI,IAAI,CAAG,CAAC,CAAC;GAC1B,gBAAgB;GAChB,aAAa,EAAM;GACnB,cAAc;GACd,iBAAiB,EAAS;GAC1B;GACA,QAAQ,EAAM;GACd,WAAW,EAAM;EAClB,CAEW,CAAO,GAEb,EAAS,KAUP;GACN,SAAS;GACT;GACA,SAAS,GAAM,WAAW,EAAe,EAAM;GAC/C,UAAU;GACV,OAAO;EACR,IAfQ;GACN,SAAS;GACT;GACA,SAAS,GAAM,WAAW,EAAS,cAAc;GACjD,UAAU;GACV,OAAO;EACR;CAUF,SAAS,GAAK;EAOb,OANA,EAAe;GACd,QAAQ,CAAC,oCAAoC,GAAK;GAClD,MAAM;GACN,QAAQ;EACT,CAAC,GAEM;GACN,SAAS;GACT,QAAQ;GACR,SAAS;GACT,UAAU;GACV,OAAO,aAAe,QAAQ,EAAI,UAAU,OAAO,CAAG;EACvD;CACD;AACD"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { makeRequest as e } from "./_makeRequest.js";
|
|
2
|
+
//#region src/http/api/_patchRequest.ts
|
|
3
|
+
async function t(t) {
|
|
4
|
+
return e({
|
|
5
|
+
method: "PATCH",
|
|
6
|
+
url: t.url,
|
|
7
|
+
urlParams: t.urlParams,
|
|
8
|
+
headers: t.headers,
|
|
9
|
+
body: t.body
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { t as patchRequest };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=_patchRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_patchRequest.js","names":[],"sources":["../../../../src/http/api/_patchRequest.ts"],"sourcesContent":["import { type ApiResponseDTO, makeRequest } from \"./_makeRequest\";\n\ntype InputProps = {\n\turl: string;\n\turlParams?: Record<string, string>;\n\theaders?: HeadersInit;\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tbody?: any;\n};\n\n/**\n * Sends a PATCH request to the specified URL with optional headers and body.\n *\n * @template T - The expected type of the response data.\n * @param {InputProps} input - The options for the PATCH request, including URL, URL parameters, headers, and body.\n * @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.\n */\n\n// biome-ignore lint/suspicious/noExplicitAny: intentional\nasync function patchRequest<T = any>(\n\tinput: InputProps,\n): Promise<ApiResponseDTO<T>> {\n\treturn makeRequest({\n\t\tmethod: \"PATCH\",\n\t\turl: input.url,\n\t\turlParams: input.urlParams,\n\t\theaders: input.headers,\n\t\tbody: input.body,\n\t});\n}\n\nexport { patchRequest };\n"],"mappings":";;AAmBA,eAAe,EACd,GAC6B;CAC7B,OAAO,EAAY;EAClB,QAAQ;EACR,KAAK,EAAM;EACX,WAAW,EAAM;EACjB,SAAS,EAAM;EACf,MAAM,EAAM;CACb,CAAC;AACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { makeRequest as e } from "./_makeRequest.js";
|
|
2
|
+
//#region src/http/api/_postRequest.ts
|
|
3
|
+
async function t(t) {
|
|
4
|
+
return e({
|
|
5
|
+
method: "POST",
|
|
6
|
+
url: t.url,
|
|
7
|
+
urlParams: t.urlParams,
|
|
8
|
+
headers: t.headers,
|
|
9
|
+
body: t.body
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { t as postRequest };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=_postRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_postRequest.js","names":[],"sources":["../../../../src/http/api/_postRequest.ts"],"sourcesContent":["import { type ApiResponseDTO, makeRequest } from \"./_makeRequest\";\n\ntype InputProps = {\n\turl: string;\n\turlParams?: Record<string, string>;\n\theaders?: HeadersInit;\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tbody?: any;\n};\n\n/**\n * Sends a POST request to the specified URL with optional headers and body.\n *\n * @template T - The expected type of the response data.\n * @param {InputProps} input - The options for the POST request, including URL, URL parameters, headers, and body.\n * @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.\n */\n\n// biome-ignore lint/suspicious/noExplicitAny: intentional\nasync function postRequest<T = any>(\n\tinput: InputProps,\n): Promise<ApiResponseDTO<T>> {\n\treturn makeRequest({\n\t\tmethod: \"POST\",\n\t\turl: input.url,\n\t\turlParams: input.urlParams,\n\t\theaders: input.headers,\n\t\tbody: input.body,\n\t});\n}\n\nexport { postRequest };\n"],"mappings":";;AAmBA,eAAe,EACd,GAC6B;CAC7B,OAAO,EAAY;EAClB,QAAQ;EACR,KAAK,EAAM;EACX,WAAW,EAAM;EACjB,SAAS,EAAM;EACf,MAAM,EAAM;CACb,CAAC;AACF"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { makeRequest as e } from "./_makeRequest.js";
|
|
2
|
+
//#region src/http/api/_putRequest.ts
|
|
3
|
+
async function t(t) {
|
|
4
|
+
return e({
|
|
5
|
+
method: "PUT",
|
|
6
|
+
url: t.url,
|
|
7
|
+
urlParams: t.urlParams,
|
|
8
|
+
headers: t.headers,
|
|
9
|
+
body: t.body
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { t as putRequest };
|
|
14
|
+
|
|
15
|
+
//# sourceMappingURL=_putRequest.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_putRequest.js","names":[],"sources":["../../../../src/http/api/_putRequest.ts"],"sourcesContent":["import { type ApiResponseDTO, makeRequest } from \"./_makeRequest\";\n\ntype InputProps = {\n\turl: string;\n\turlParams?: Record<string, string>;\n\theaders?: HeadersInit;\n\t// biome-ignore lint/suspicious/noExplicitAny: intentional\n\tbody?: any;\n};\n\n/**\n * Sends a PUT request to the specified URL with optional headers and body.\n *\n * @template T - The expected type of the response data.\n * @param {InputProps} input - The options for the PUT request, including URL, URL parameters, headers, and body.\n * @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.\n */\n\n// biome-ignore lint/suspicious/noExplicitAny: intentional\nasync function putRequest<T = any>(\n\tinput: InputProps,\n): Promise<ApiResponseDTO<T>> {\n\treturn makeRequest({\n\t\tmethod: \"PUT\",\n\t\turl: input.url,\n\t\turlParams: input.urlParams,\n\t\theaders: input.headers,\n\t\tbody: input.body,\n\t});\n}\n\nexport { putRequest };\n"],"mappings":";;AAmBA,eAAe,EACd,GAC6B;CAC7B,OAAO,EAAY;EAClB,QAAQ;EACR,KAAK,EAAM;EACX,WAAW,EAAM;EACjB,SAAS,EAAM;EACf,MAAM,EAAM;CACb,CAAC;AACF"}
|