@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,17 @@
|
|
|
1
|
+
import { type ApiResponseDTO } from "./_makeRequest";
|
|
2
|
+
type InputProps = {
|
|
3
|
+
url: string;
|
|
4
|
+
urlParams?: Record<string, string>;
|
|
5
|
+
headers?: HeadersInit;
|
|
6
|
+
body?: any;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Sends a DELETE request to the specified URL with optional headers and body.
|
|
10
|
+
*
|
|
11
|
+
* @template T - The expected type of the response data.
|
|
12
|
+
* @param {InputProps} input - The options for the DELETE request, including URL, URL parameters, headers, and body.
|
|
13
|
+
* @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
|
|
14
|
+
*/
|
|
15
|
+
declare function deleteRequest<T = any>(input: InputProps): Promise<ApiResponseDTO<T>>;
|
|
16
|
+
export { deleteRequest };
|
|
17
|
+
//# sourceMappingURL=_deleteRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_deleteRequest.d.ts","sourceRoot":"","sources":["../../../src/http/api/_deleteRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAe,MAAM,gBAAgB,CAAC;AAElE,KAAK,UAAU,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,WAAW,CAAC;IAEtB,IAAI,CAAC,EAAE,GAAG,CAAC;CACX,CAAC;AAEF;;;;;;GAMG;AAGH,iBAAe,aAAa,CAAC,CAAC,GAAG,GAAG,EACnC,KAAK,EAAE,UAAU,GACf,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAQ5B;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type ApiResponseDTO } from "./_makeRequest";
|
|
2
|
+
type InputProps = {
|
|
3
|
+
url: string;
|
|
4
|
+
urlParams?: Record<string, string>;
|
|
5
|
+
headers?: HeadersInit;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Sends a GET request to the specified URL with optional headers.
|
|
9
|
+
*
|
|
10
|
+
* @template T - The expected type of the response data.
|
|
11
|
+
* @param {InputProps} input - The options for the GET request, including URL, URL parameters, and headers.
|
|
12
|
+
* @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
|
|
13
|
+
*/
|
|
14
|
+
declare function getRequest<T = any>(input: InputProps): Promise<ApiResponseDTO<T>>;
|
|
15
|
+
export { getRequest };
|
|
16
|
+
//# sourceMappingURL=_getRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_getRequest.d.ts","sourceRoot":"","sources":["../../../src/http/api/_getRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAe,MAAM,gBAAgB,CAAC;AAElE,KAAK,UAAU,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,WAAW,CAAC;CACtB,CAAC;AAEF;;;;;;GAMG;AAGH,iBAAe,UAAU,CAAC,CAAC,GAAG,GAAG,EAChC,KAAK,EAAE,UAAU,GACf,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAO5B;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Input properties for log mapping.
|
|
3
|
+
*
|
|
4
|
+
* @typedef {object} InputProps
|
|
5
|
+
* @property {number} status - HTTP response status code.
|
|
6
|
+
* @property {string} url - The request URL.
|
|
7
|
+
* @property {"GET" | "POST" | "PUT" | "DELETE" | "PATCH"} method - HTTP method used.
|
|
8
|
+
* @property {HeadersInit} requestHeaders - Headers sent with the request.
|
|
9
|
+
* @property {HeadersInit} responseHeaders - Headers received in the response.
|
|
10
|
+
* @property {any} requestBody - Body of the request.
|
|
11
|
+
* @property {number} elapsedTime - Time elapsed for the request in milliseconds.
|
|
12
|
+
* @property {any} responseBody - Body of the response.
|
|
13
|
+
* @property {URLSearchParams} queryParams - Query parameters from the URL.
|
|
14
|
+
*/
|
|
15
|
+
type InputProps = {
|
|
16
|
+
status: number;
|
|
17
|
+
rawUrl: string;
|
|
18
|
+
urlParams?: Record<string, string>;
|
|
19
|
+
method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
20
|
+
requestHeaders: HeadersInit;
|
|
21
|
+
responseHeaders: HeadersInit;
|
|
22
|
+
requestBody: any;
|
|
23
|
+
elapsedTime: number;
|
|
24
|
+
responseBody: any;
|
|
25
|
+
queryParams: URLSearchParams;
|
|
26
|
+
};
|
|
27
|
+
/**
|
|
28
|
+
* Output properties after log mapping transformation.
|
|
29
|
+
*
|
|
30
|
+
* @typedef {object} OutputProps
|
|
31
|
+
* @property {string} rawUrl - The original request URL.
|
|
32
|
+
* @property {number} status - HTTP response status code.
|
|
33
|
+
* @property {"GET" | "POST" | "PUT" | "DELETE" | "PATCH"} method - HTTP method used.
|
|
34
|
+
* @property {string | null} token - Authentication token (if present).
|
|
35
|
+
* @property {number} elapsedTime - Time elapsed for the request in milliseconds.
|
|
36
|
+
* @property {Record<string, string>} requestHeaders - Mapped request headers.
|
|
37
|
+
* @property {Record<string, string>} requestBody - Mapped request body.
|
|
38
|
+
* @property {Record<string, string>} queryParams - Mapped query parameters.
|
|
39
|
+
* @property {Record<string, string>} responseHeaders - Mapped response headers.
|
|
40
|
+
* @property {any} responseBody - The response body.
|
|
41
|
+
*/
|
|
42
|
+
type OutputProps = {
|
|
43
|
+
rawUrl: string;
|
|
44
|
+
status: number;
|
|
45
|
+
method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
46
|
+
token: string | null;
|
|
47
|
+
elapsedTime: number;
|
|
48
|
+
requestHeaders: Record<string, string>;
|
|
49
|
+
requestBody: Record<string, string>;
|
|
50
|
+
queryParams: Record<string, string>;
|
|
51
|
+
responseHeaders: Record<string, string>;
|
|
52
|
+
responseBody: any;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Static service for mapping HTTP request/response data into a standardized log format.
|
|
56
|
+
*
|
|
57
|
+
* Provides utilities to transform headers and query parameters into plain objects,
|
|
58
|
+
* and produces a unified output structure for logging purposes.
|
|
59
|
+
*/
|
|
60
|
+
declare class LogMapperService {
|
|
61
|
+
/**
|
|
62
|
+
* Converts various header formats into a plain key-value object.
|
|
63
|
+
*
|
|
64
|
+
* @param {HeadersInit} headers - The headers to map.
|
|
65
|
+
* @returns {Record<string, string>} A plain object with header key-value pairs.
|
|
66
|
+
* @private
|
|
67
|
+
*/
|
|
68
|
+
private static mapHeaders;
|
|
69
|
+
/**
|
|
70
|
+
* Converts URLSearchParams into a plain key-value object.
|
|
71
|
+
*
|
|
72
|
+
* @param {URLSearchParams} queryParams - The query parameters to map.
|
|
73
|
+
* @returns {Record<string, string>} A plain object with query parameter key-value pairs.
|
|
74
|
+
* @private
|
|
75
|
+
*/
|
|
76
|
+
private static mapQueryParams;
|
|
77
|
+
/**
|
|
78
|
+
* Transforms raw HTTP request/response data into a standardized log output format.
|
|
79
|
+
*
|
|
80
|
+
* @param {InputProps} props - The input properties containing request/response data.
|
|
81
|
+
* @returns {OutputProps} The mapped output object ready for logging.
|
|
82
|
+
*/
|
|
83
|
+
static handle(props: InputProps): OutputProps;
|
|
84
|
+
}
|
|
85
|
+
export { LogMapperService };
|
|
86
|
+
//# sourceMappingURL=_logMapperService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_logMapperService.d.ts","sourceRoot":"","sources":["../../../src/http/api/_logMapperService.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,KAAK,UAAU,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpD,cAAc,EAAE,WAAW,CAAC;IAC5B,eAAe,EAAE,WAAW,CAAC;IAE7B,WAAW,EAAE,GAAG,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IAEpB,YAAY,EAAE,GAAG,CAAC;IAClB,WAAW,EAAE,eAAe,CAAC;CAC7B,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,KAAK,WAAW,GAAG;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAExC,YAAY,EAAE,GAAG,CAAC;CAClB,CAAC;AAEF;;;;;GAKG;AACH,cAAM,gBAAgB;IACrB;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,UAAU;IAiBzB;;;;;;OAMG;IACH,OAAO,CAAC,MAAM,CAAC,cAAc;IAY7B;;;;;OAKG;IACH,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,WAAW;CAiB7C;AAED,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -13,25 +13,28 @@ type ConfigProps = {
|
|
|
13
13
|
/**
|
|
14
14
|
* Sends a request to the inbox flow API with the provided configuration.
|
|
15
15
|
*
|
|
16
|
-
*
|
|
17
|
-
* @param config.rawUrl - The raw URL of the request.
|
|
18
|
-
* @param config.status - The HTTP status code associated with the request.
|
|
19
|
-
* @param config.method - The HTTP method used for the request. Can be "POST", "GET", "PUT", "DELETE", or "PATCH".
|
|
20
|
-
* @param config.token - The authentication token for the request.
|
|
21
|
-
* @param config.elapsedTime - The elapsed time for the request in milliseconds.
|
|
22
|
-
* @param config.requestHeaders - The headers sent with the request.
|
|
23
|
-
* @param config.requestBody - The body of the request, if applicable.
|
|
24
|
-
* @param config.queryParams - The query parameters for the request.
|
|
25
|
-
* @param config.responseHeaders - The headers received in the response.
|
|
26
|
-
* @param config.responseBody - The body of the response received.
|
|
27
|
-
*
|
|
28
|
-
* @remarks
|
|
29
|
-
* - This function retrieves the inbox flow configuration using `InboxFlowService.getInboxConfig()`.
|
|
16
|
+
* - This function retrieves the inbox flow configuration using `LogService.getConfig()`.
|
|
30
17
|
* - If the configuration is not available, the function will return early without performing any action.
|
|
31
18
|
* - In a development environment (`NODE_ENV === "development"`), the function will also return early.
|
|
32
19
|
* - The request is sent as a POST request to the inbox API URL with the provided configuration details.
|
|
33
20
|
* - If an error occurs during the request, it will be logged using the `httpDebug` service.
|
|
34
21
|
*
|
|
22
|
+
* @param {ConfigProps} config - The configuration object for the request.
|
|
23
|
+
* @param {string} config.rawUrl - The raw URL of the request.
|
|
24
|
+
* @param {number} config.status - The HTTP status code associated with the request.
|
|
25
|
+
* @param {"GET" | "POST" | "PUT" | "DELETE" | "PATCH"} config.method - The HTTP method used for the request. Can be "POST", "GET", "PUT", "DELETE", or "PATCH".
|
|
26
|
+
* @param {string | null} config.token - The authentication token for the request.
|
|
27
|
+
* @param {number} config.elapsedTime - The elapsed time for the request in milliseconds.
|
|
28
|
+
* @param {Record<string, string>} config.requestHeaders - The headers sent with the request.
|
|
29
|
+
* @param {Record<string, string>} config.requestBody - The body of the request, if applicable.
|
|
30
|
+
* @param {Record<string, string>} config.queryParams - The query parameters for the request.
|
|
31
|
+
* @param {Record<string, string>} config.responseHeaders - The headers received in the response.
|
|
32
|
+
* @param {Record<string, string>} config.responseBody - The body of the response received.
|
|
33
|
+
*
|
|
34
|
+
* @remarks
|
|
35
|
+
*
|
|
36
|
+
* @returns {Promise<void>} A promise that resolves when the request is complete.
|
|
37
|
+
*
|
|
35
38
|
* @example
|
|
36
39
|
* ```typescript
|
|
37
40
|
* const config = {
|
|
@@ -39,7 +42,7 @@ type ConfigProps = {
|
|
|
39
42
|
* status: 200,
|
|
40
43
|
* method: "GET",
|
|
41
44
|
* token: "auth-token-123",
|
|
42
|
-
* elapsedTime:
|
|
45
|
+
* elapsedTime: 150,
|
|
43
46
|
* requestHeaders: { "Accept": "application/json", "Authorization": "Bearer token123" },
|
|
44
47
|
* requestBody: {},
|
|
45
48
|
* queryParams: { "page": "1", "limit": "10" },
|
|
@@ -47,9 +50,9 @@ type ConfigProps = {
|
|
|
47
50
|
* responseBody: { "data": "example response" }
|
|
48
51
|
* };
|
|
49
52
|
*
|
|
50
|
-
* await
|
|
53
|
+
* await logRequest(config);
|
|
51
54
|
* ```
|
|
52
55
|
*/
|
|
53
|
-
declare function
|
|
54
|
-
export {
|
|
55
|
-
//# sourceMappingURL=
|
|
56
|
+
declare function logRequest(config: ConfigProps): Promise<void>;
|
|
57
|
+
export { logRequest };
|
|
58
|
+
//# sourceMappingURL=_logRequest.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"
|
|
1
|
+
{"version":3,"file":"_logRequest.d.ts","sourceRoot":"","sources":["../../../src/http/api/_logRequest.ts"],"names":[],"mappings":"AAIA,KAAK,WAAW,GAAG;IAClB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACrC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0CG;AAEH,iBAAe,UAAU,CAAC,MAAM,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CA6E5D;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
type InputProps = {
|
|
2
|
+
url: string;
|
|
3
|
+
method: "POST" | "PUT" | "DELETE" | "PATCH" | "GET";
|
|
4
|
+
urlParams?: Record<string, string>;
|
|
5
|
+
headers?: HeadersInit;
|
|
6
|
+
body?: any;
|
|
7
|
+
};
|
|
8
|
+
type ApiSuccessResponse<T = any> = {
|
|
9
|
+
success: true;
|
|
10
|
+
status: number;
|
|
11
|
+
message: string;
|
|
12
|
+
response: T;
|
|
13
|
+
cause: null;
|
|
14
|
+
};
|
|
15
|
+
type ApiFailedResponse = {
|
|
16
|
+
success: false;
|
|
17
|
+
status: number;
|
|
18
|
+
message: string;
|
|
19
|
+
response: any;
|
|
20
|
+
cause: string | Error | null;
|
|
21
|
+
};
|
|
22
|
+
type ApiResponseDTO<T = any> = ApiSuccessResponse<T> | ApiFailedResponse;
|
|
23
|
+
/**
|
|
24
|
+
* Makes an HTTP request using the Fetch API and returns a standardized response.
|
|
25
|
+
*
|
|
26
|
+
* @template {any} T - The expected type of the response data.
|
|
27
|
+
*
|
|
28
|
+
* @param {"POST" | "PUT" | "DELETE" | "PATCH" | "GET"} method - The HTTP method to use for the request. Supported methods are:
|
|
29
|
+
* - "POST": Create a new resource.
|
|
30
|
+
* - "PUT": Update an existing resource.
|
|
31
|
+
* - "DELETE": Remove a resource.
|
|
32
|
+
* - "PATCH": Partially update a resource.
|
|
33
|
+
* - "GET": Retrieve a resource.
|
|
34
|
+
* @param {string} url - The URL to which the request is sent.
|
|
35
|
+
* @param {HeadersInit} headers - Optional headers to include in the request. Defaults to an empty object.
|
|
36
|
+
* @param {any} body - Optional body to include in the request. Should be serializable to JSON.
|
|
37
|
+
*
|
|
38
|
+
* @returns {ApiResponseDTO<T>} A promise that resolves to an `ApiResponseDTO<T>` object containing:
|
|
39
|
+
* - `success`: A boolean indicating whether the request was successful.
|
|
40
|
+
* - `status`: The HTTP status code of the response.
|
|
41
|
+
* - `message`: A message describing the result of the request.
|
|
42
|
+
* - `response`: The parsed JSON response data, or `null` if parsing fails.
|
|
43
|
+
* - `cause`: Additional error information, if applicable.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```typescript
|
|
47
|
+
* import { makeRequest } from "./makeRequest";
|
|
48
|
+
*
|
|
49
|
+
* async function fetchData() {
|
|
50
|
+
* const response = await makeRequest("GET", "https://api.example.com/data");
|
|
51
|
+
* if (response.success) {
|
|
52
|
+
* console.log("Data:", response.response);
|
|
53
|
+
* } else {
|
|
54
|
+
* console.error("Error:", response.message);
|
|
55
|
+
* }
|
|
56
|
+
* }
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
declare function makeRequest<T = any>(input: InputProps): Promise<ApiResponseDTO<T>>;
|
|
60
|
+
export { type ApiResponseDTO, makeRequest };
|
|
61
|
+
//# sourceMappingURL=_makeRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_makeRequest.d.ts","sourceRoot":"","sources":["../../../src/http/api/_makeRequest.ts"],"names":[],"mappings":"AAIA,KAAK,UAAU,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,CAAC;IACpD,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,WAAW,CAAC;IAEtB,IAAI,CAAC,EAAE,GAAG,CAAC;CACX,CAAC;AAGF,KAAK,kBAAkB,CAAC,CAAC,GAAG,GAAG,IAAI;IAClC,OAAO,EAAE,IAAI,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,CAAC,CAAC;IACZ,KAAK,EAAE,IAAI,CAAC;CACZ,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACxB,OAAO,EAAE,KAAK,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAEhB,QAAQ,EAAE,GAAG,CAAC;IACd,KAAK,EAAE,MAAM,GAAG,KAAK,GAAG,IAAI,CAAC;CAC7B,CAAC;AAGF,KAAK,cAAc,CAAC,CAAC,GAAG,GAAG,IAAI,kBAAkB,CAAC,CAAC,CAAC,GAAG,iBAAiB,CAAC;AAEzE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAGH,iBAAe,WAAW,CAAC,CAAC,GAAG,GAAG,EACjC,KAAK,EAAE,UAAU,GACf,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAqF5B;AAED,OAAO,EAAE,KAAK,cAAc,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ApiResponseDTO } from "./_makeRequest";
|
|
2
|
+
type InputProps = {
|
|
3
|
+
url: string;
|
|
4
|
+
urlParams?: Record<string, string>;
|
|
5
|
+
headers?: HeadersInit;
|
|
6
|
+
body?: any;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Sends a PATCH request to the specified URL with optional headers and body.
|
|
10
|
+
*
|
|
11
|
+
* @template T - The expected type of the response data.
|
|
12
|
+
* @param {InputProps} input - The options for the PATCH request, including URL, URL parameters, headers, and body.
|
|
13
|
+
* @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
|
|
14
|
+
*/
|
|
15
|
+
declare function patchRequest<T = any>(input: InputProps): Promise<ApiResponseDTO<T>>;
|
|
16
|
+
export { patchRequest };
|
|
17
|
+
//# sourceMappingURL=_patchRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_patchRequest.d.ts","sourceRoot":"","sources":["../../../src/http/api/_patchRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAe,MAAM,gBAAgB,CAAC;AAElE,KAAK,UAAU,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,WAAW,CAAC;IAEtB,IAAI,CAAC,EAAE,GAAG,CAAC;CACX,CAAC;AAEF;;;;;;GAMG;AAGH,iBAAe,YAAY,CAAC,CAAC,GAAG,GAAG,EAClC,KAAK,EAAE,UAAU,GACf,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAQ5B;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ApiResponseDTO } from "./_makeRequest";
|
|
2
|
+
type InputProps = {
|
|
3
|
+
url: string;
|
|
4
|
+
urlParams?: Record<string, string>;
|
|
5
|
+
headers?: HeadersInit;
|
|
6
|
+
body?: any;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Sends a POST request to the specified URL with optional headers and body.
|
|
10
|
+
*
|
|
11
|
+
* @template T - The expected type of the response data.
|
|
12
|
+
* @param {InputProps} input - The options for the POST request, including URL, URL parameters, headers, and body.
|
|
13
|
+
* @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
|
|
14
|
+
*/
|
|
15
|
+
declare function postRequest<T = any>(input: InputProps): Promise<ApiResponseDTO<T>>;
|
|
16
|
+
export { postRequest };
|
|
17
|
+
//# sourceMappingURL=_postRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_postRequest.d.ts","sourceRoot":"","sources":["../../../src/http/api/_postRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAe,MAAM,gBAAgB,CAAC;AAElE,KAAK,UAAU,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,WAAW,CAAC;IAEtB,IAAI,CAAC,EAAE,GAAG,CAAC;CACX,CAAC;AAEF;;;;;;GAMG;AAGH,iBAAe,WAAW,CAAC,CAAC,GAAG,GAAG,EACjC,KAAK,EAAE,UAAU,GACf,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAQ5B;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type ApiResponseDTO } from "./_makeRequest";
|
|
2
|
+
type InputProps = {
|
|
3
|
+
url: string;
|
|
4
|
+
urlParams?: Record<string, string>;
|
|
5
|
+
headers?: HeadersInit;
|
|
6
|
+
body?: any;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Sends a PUT request to the specified URL with optional headers and body.
|
|
10
|
+
*
|
|
11
|
+
* @template T - The expected type of the response data.
|
|
12
|
+
* @param {InputProps} input - The options for the PUT request, including URL, URL parameters, headers, and body.
|
|
13
|
+
* @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
|
|
14
|
+
*/
|
|
15
|
+
declare function putRequest<T = any>(input: InputProps): Promise<ApiResponseDTO<T>>;
|
|
16
|
+
export { putRequest };
|
|
17
|
+
//# sourceMappingURL=_putRequest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_putRequest.d.ts","sourceRoot":"","sources":["../../../src/http/api/_putRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,cAAc,EAAe,MAAM,gBAAgB,CAAC;AAElE,KAAK,UAAU,GAAG;IACjB,GAAG,EAAE,MAAM,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,WAAW,CAAC;IAEtB,IAAI,CAAC,EAAE,GAAG,CAAC;CACX,CAAC;AAEF;;;;;;GAMG;AAGH,iBAAe,UAAU,CAAC,CAAC,GAAG,GAAG,EAChC,KAAK,EAAE,UAAU,GACf,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAQ5B;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -1,11 +1,25 @@
|
|
|
1
|
-
type Input = {
|
|
2
|
-
name: string;
|
|
3
|
-
body?: any;
|
|
4
|
-
cause?: any;
|
|
5
|
-
message?: string;
|
|
6
|
-
};
|
|
7
1
|
declare class BadResponse {
|
|
8
|
-
|
|
2
|
+
private _cause?;
|
|
3
|
+
private _name;
|
|
4
|
+
private _status;
|
|
5
|
+
private _statusText;
|
|
6
|
+
private _debugColor;
|
|
7
|
+
get cause(): any;
|
|
8
|
+
set cause(value: any);
|
|
9
|
+
get name(): string;
|
|
10
|
+
set name(value: string);
|
|
11
|
+
get status(): number;
|
|
12
|
+
set status(value: number);
|
|
13
|
+
get statusText(): string;
|
|
14
|
+
set statusText(value: string);
|
|
15
|
+
get debugColor(): "green" | "yellow" | "cyan" | "red";
|
|
16
|
+
set debugColor(value: "green" | "yellow" | "cyan" | "red");
|
|
17
|
+
onDebug(): void;
|
|
18
|
+
makeBody(): {
|
|
19
|
+
name: string;
|
|
20
|
+
message: string;
|
|
21
|
+
cause: any;
|
|
22
|
+
};
|
|
9
23
|
}
|
|
10
24
|
export { BadResponse };
|
|
11
25
|
//# sourceMappingURL=_badResponse.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_badResponse.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/_badResponse.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"_badResponse.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/_badResponse.ts"],"names":[],"mappings":"AAKA,cAAM,WAAW;IAEhB,OAAO,CAAC,MAAM,CAAC,CAAM;IACrB,OAAO,CAAC,KAAK,CAAyB;IACtC,OAAO,CAAC,OAAO,CAAe;IAC9B,OAAO,CAAC,WAAW,CAA2B;IAC9C,OAAO,CAAC,WAAW,CAA8C;IAGjE,IAAI,KAAK,IAAI,GAAG,CAEf;IAGD,IAAI,KAAK,CAAC,KAAK,EAAE,GAAG,EAEnB;IAED,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED,IAAI,IAAI,CAAC,KAAK,EAAE,MAAM,EAErB;IAED,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED,IAAI,MAAM,CAAC,KAAK,EAAE,MAAM,EAEvB;IAED,IAAI,UAAU,IAAI,MAAM,CAEvB;IAED,IAAI,UAAU,CAAC,KAAK,EAAE,MAAM,EAE3B;IAED,IAAI,UAAU,IAAI,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,CAEpD;IAED,IAAI,UAAU,CAAC,KAAK,EAAE,OAAO,GAAG,QAAQ,GAAG,MAAM,GAAG,KAAK,EAGxD;IAED,OAAO;IAeP,QAAQ;;;;;CAOR;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -1,34 +1,23 @@
|
|
|
1
1
|
import { BadResponse } from "./_badResponse";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* HTTP 502 Bad Gateway — the upstream server returned an invalid or unexpected response.
|
|
4
|
+
*
|
|
5
|
+
* Throw inside a server action/loader and catch with `errorHandler`, or call `.toJson()` directly.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```typescript
|
|
9
|
+
* throw new BadGateway("Payment gateway unavailable");
|
|
10
|
+
* ```
|
|
6
11
|
*/
|
|
7
12
|
declare class BadGateway extends BadResponse {
|
|
8
|
-
body: any;
|
|
9
|
-
cause?: any;
|
|
10
|
-
status: number;
|
|
11
|
-
statusText: string;
|
|
12
13
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* @param message - A descriptive message explaining the cause of the error.
|
|
16
|
-
* @param cause - Optional additional information about the cause of the error.
|
|
14
|
+
* @param message - Error description sent in the response body and logged for debugging.
|
|
15
|
+
* @param cause - Optional extra context (serialized to JSON in the response).
|
|
17
16
|
*/
|
|
18
17
|
constructor(message: string, cause?: any);
|
|
19
|
-
/**
|
|
20
|
-
* Converts the `BadGateway` instance into a `Response` object with a JSON body.
|
|
21
|
-
* This method ensures the response has the appropriate headers, status, and status text.
|
|
22
|
-
*
|
|
23
|
-
* @returns A `Response` object with the serialized JSON body and response metadata.
|
|
24
|
-
*/
|
|
18
|
+
/** Converts to a `Response` with `Content-Type: application/json` header. */
|
|
25
19
|
toResponse(): Response;
|
|
26
|
-
/**
|
|
27
|
-
* Converts the `BadGateway` instance into a `Response` object using the `Response.json` method.
|
|
28
|
-
* This method is an alternative to `toResponse` for generating JSON error responses.
|
|
29
|
-
*
|
|
30
|
-
* @returns A `Response` object with the JSON body and response metadata.
|
|
31
|
-
*/
|
|
20
|
+
/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */
|
|
32
21
|
toJson(): Response;
|
|
33
22
|
}
|
|
34
23
|
export { BadGateway };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badGateway.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/badGateway.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C
|
|
1
|
+
{"version":3,"file":"badGateway.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/badGateway.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;;;;;;GASG;AACH,cAAM,UAAW,SAAQ,WAAW;IACnC;;;OAGG;gBAES,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;IAWxC,6EAA6E;IAC7E,UAAU,IAAI,QAAQ;IAUtB,uFAAuF;IACvF,MAAM,IAAI,QAAQ;CAQlB;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -1,34 +1,21 @@
|
|
|
1
1
|
import { BadResponse } from "./_badResponse";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* HTTP 400 Bad Request — the request is malformed or contains invalid data.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* throw new BadRequest("Invalid request body");
|
|
8
|
+
* ```
|
|
6
9
|
*/
|
|
7
10
|
declare class BadRequest extends BadResponse {
|
|
8
|
-
body: any;
|
|
9
|
-
cause?: any;
|
|
10
|
-
status: number;
|
|
11
|
-
statusText: string;
|
|
12
11
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* @param message - A descriptive message explaining the cause of the error.
|
|
16
|
-
* @param cause - Optional additional information about the cause of the error.
|
|
12
|
+
* @param message - Error description.
|
|
13
|
+
* @param cause - Optional extra context (serialized to JSON).
|
|
17
14
|
*/
|
|
18
15
|
constructor(message: string, cause?: any);
|
|
19
|
-
/**
|
|
20
|
-
* Converts the `BadRequest` instance into a `Response` object with a JSON body.
|
|
21
|
-
* This method ensures the response has the appropriate headers, status, and status text.
|
|
22
|
-
*
|
|
23
|
-
* @returns A `Response` object with the serialized JSON body and response metadata.
|
|
24
|
-
*/
|
|
16
|
+
/** Converts to a `Response` with `Content-Type: application/json` header. */
|
|
25
17
|
toResponse(): Response;
|
|
26
|
-
/**
|
|
27
|
-
* Converts the `BadRequest` instance into a `Response` object using the `Response.json` method.
|
|
28
|
-
* This method is an alternative to `toResponse` for generating JSON error responses.
|
|
29
|
-
*
|
|
30
|
-
* @returns A `Response` object with the JSON body and response metadata.
|
|
31
|
-
*/
|
|
18
|
+
/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */
|
|
32
19
|
toJson(): Response;
|
|
33
20
|
}
|
|
34
21
|
export { BadRequest };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badRequest.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/badRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C
|
|
1
|
+
{"version":3,"file":"badRequest.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/badRequest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;;;;GAOG;AACH,cAAM,UAAW,SAAQ,WAAW;IACnC;;;OAGG;gBAES,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;IAWxC,6EAA6E;IAC7E,UAAU,IAAI,QAAQ;IAUtB,uFAAuF;IACvF,MAAM,IAAI,QAAQ;CAQlB;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -1,34 +1,21 @@
|
|
|
1
1
|
import { BadResponse } from "./_badResponse";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* HTTP 409 Conflict — the request conflicts with the current state of the server (e.g. duplicate record).
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* throw new Conflict("Email already in use");
|
|
8
|
+
* ```
|
|
6
9
|
*/
|
|
7
10
|
declare class Conflict extends BadResponse {
|
|
8
|
-
body: any;
|
|
9
|
-
cause?: any;
|
|
10
|
-
status: number;
|
|
11
|
-
statusText: string;
|
|
12
11
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* @param message - A descriptive message explaining the cause of the conflict.
|
|
16
|
-
* @param cause - Optional additional information about the cause of the conflict.
|
|
12
|
+
* @param message - Error description.
|
|
13
|
+
* @param cause - Optional extra context (serialized to JSON).
|
|
17
14
|
*/
|
|
18
15
|
constructor(message: string, cause?: any);
|
|
19
|
-
/**
|
|
20
|
-
* Converts the `Conflict` instance into a `Response` object with a JSON body.
|
|
21
|
-
* This method ensures the response has the appropriate headers, status, and status text.
|
|
22
|
-
*
|
|
23
|
-
* @returns A `Response` object with the serialized JSON body and response metadata.
|
|
24
|
-
*/
|
|
16
|
+
/** Converts to a `Response` with `Content-Type: application/json` header. */
|
|
25
17
|
toResponse(): Response;
|
|
26
|
-
/**
|
|
27
|
-
* Converts the `Conflict` instance into a `Response` object using the `Response.json` method.
|
|
28
|
-
* This method is an alternative to `toResponse` for generating JSON error responses.
|
|
29
|
-
*
|
|
30
|
-
* @returns A `Response` object with the JSON body and response metadata.
|
|
31
|
-
*/
|
|
18
|
+
/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */
|
|
32
19
|
toJson(): Response;
|
|
33
20
|
}
|
|
34
21
|
export { Conflict };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conflict.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/conflict.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C
|
|
1
|
+
{"version":3,"file":"conflict.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/conflict.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;;;;GAOG;AACH,cAAM,QAAS,SAAQ,WAAW;IACjC;;;OAGG;gBAES,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;IAYxC,6EAA6E;IAC7E,UAAU,IAAI,QAAQ;IAUtB,uFAAuF;IACvF,MAAM,IAAI,QAAQ;CAQlB;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -1,34 +1,21 @@
|
|
|
1
1
|
import { BadResponse } from "./_badResponse";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* HTTP 403 Forbidden — authenticated but not authorized to access this resource.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* throw new Forbidden("You don't have permission to delete this resource");
|
|
8
|
+
* ```
|
|
6
9
|
*/
|
|
7
10
|
declare class Forbidden extends BadResponse {
|
|
8
|
-
body: any;
|
|
9
|
-
cause?: any;
|
|
10
|
-
status: number;
|
|
11
|
-
statusText: string;
|
|
12
11
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* @param message - A descriptive message explaining why access is forbidden.
|
|
16
|
-
* @param cause - Optional additional information about the cause of the error.
|
|
12
|
+
* @param message - Error description.
|
|
13
|
+
* @param cause - Optional extra context (serialized to JSON).
|
|
17
14
|
*/
|
|
18
15
|
constructor(message: string, cause?: any);
|
|
19
|
-
/**
|
|
20
|
-
* Converts the `Forbidden` instance into a `Response` object with a JSON body.
|
|
21
|
-
* This method ensures the response has the appropriate headers, status, and status text.
|
|
22
|
-
*
|
|
23
|
-
* @returns A `Response` object with the serialized JSON body and response metadata.
|
|
24
|
-
*/
|
|
16
|
+
/** Converts to a `Response` with `Content-Type: application/json` header. */
|
|
25
17
|
toResponse(): Response;
|
|
26
|
-
/**
|
|
27
|
-
* Converts the `Forbidden` instance into a `Response` object using the `Response.json` method.
|
|
28
|
-
* This method is an alternative to `toResponse` for generating JSON error responses.
|
|
29
|
-
*
|
|
30
|
-
* @returns A `Response` object with the JSON body and response metadata.
|
|
31
|
-
*/
|
|
18
|
+
/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */
|
|
32
19
|
toJson(): Response;
|
|
33
20
|
}
|
|
34
21
|
export { Forbidden };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forbidden.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/forbidden.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C
|
|
1
|
+
{"version":3,"file":"forbidden.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/forbidden.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;;;;GAOG;AACH,cAAM,SAAU,SAAQ,WAAW;IAClC;;;OAGG;gBAES,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;IAWxC,6EAA6E;IAC7E,UAAU,IAAI,QAAQ;IAUtB,uFAAuF;IACvF,MAAM,IAAI,QAAQ;CAQlB;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -1,34 +1,21 @@
|
|
|
1
1
|
import { BadResponse } from "./_badResponse";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* HTTP 404 Not Found — the requested resource does not exist.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* throw new NotFound("Product not found");
|
|
8
|
+
* ```
|
|
6
9
|
*/
|
|
7
10
|
declare class NotFound extends BadResponse {
|
|
8
|
-
body: any;
|
|
9
|
-
cause?: any;
|
|
10
|
-
status: number;
|
|
11
|
-
statusText: string;
|
|
12
11
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* @param message - A descriptive message explaining the reason the resource was not found.
|
|
16
|
-
* @param cause - Optional additional information about the cause of the error.
|
|
12
|
+
* @param message - Error description.
|
|
13
|
+
* @param cause - Optional extra context (serialized to JSON).
|
|
17
14
|
*/
|
|
18
15
|
constructor(message: string, cause?: any);
|
|
19
|
-
/**
|
|
20
|
-
* Converts the `NotFound` instance into a `Response` object with a JSON body.
|
|
21
|
-
* This method ensures the response has the appropriate headers, status, and status text.
|
|
22
|
-
*
|
|
23
|
-
* @returns A `Response` object with the serialized JSON body and response metadata.
|
|
24
|
-
*/
|
|
16
|
+
/** Converts to a `Response` with `Content-Type: application/json` header. */
|
|
25
17
|
toResponse(): Response;
|
|
26
|
-
/**
|
|
27
|
-
* Converts the `NotFound` instance into a `Response` object using the `Response.json` method.
|
|
28
|
-
* This method is an alternative to `toResponse` for generating JSON error responses.
|
|
29
|
-
*
|
|
30
|
-
* @returns A `Response` object with the JSON body and response metadata.
|
|
31
|
-
*/
|
|
18
|
+
/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */
|
|
32
19
|
toJson(): Response;
|
|
33
20
|
}
|
|
34
21
|
export { NotFound };
|