@arkyn/server 3.0.1-beta.116 → 3.0.1-beta.118
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/dist/bundle.js +721 -734
- package/dist/bundle.umd.cjs +5 -10
- 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/{api/arkynLogRequest.js → http/api/_logRequest.js} +30 -30
- package/dist/http/api/_makeRequest.d.ts +61 -0
- package/dist/http/api/_makeRequest.d.ts.map +1 -0
- package/dist/{api/makeRequest.js → http/api/_makeRequest.js} +29 -20
- package/dist/http/api/deleteRequest.d.ts +17 -0
- package/dist/http/api/deleteRequest.d.ts.map +1 -0
- package/dist/http/api/deleteRequest.js +18 -0
- package/dist/http/api/getRequest.d.ts +16 -0
- package/dist/http/api/getRequest.d.ts.map +1 -0
- package/dist/http/api/getRequest.js +17 -0
- package/dist/http/api/patchRequest.d.ts +17 -0
- package/dist/http/api/patchRequest.d.ts.map +1 -0
- package/dist/http/api/patchRequest.js +18 -0
- package/dist/http/api/postRequest.d.ts +17 -0
- package/dist/http/api/postRequest.d.ts.map +1 -0
- package/dist/http/api/postRequest.js +18 -0
- package/dist/http/api/putRequest.d.ts +17 -0
- package/dist/http/api/putRequest.d.ts.map +1 -0
- package/dist/http/api/putRequest.js +18 -0
- package/dist/http/badResponses/_badResponse.d.ts +18 -7
- package/dist/http/badResponses/_badResponse.d.ts.map +1 -1
- package/dist/http/badResponses/_badResponse.js +44 -13
- package/dist/http/badResponses/badGateway.d.ts +4 -8
- package/dist/http/badResponses/badGateway.d.ts.map +1 -1
- package/dist/http/badResponses/badGateway.js +9 -17
- package/dist/http/badResponses/badRequest.d.ts +4 -8
- package/dist/http/badResponses/badRequest.d.ts.map +1 -1
- package/dist/http/badResponses/badRequest.js +9 -17
- package/dist/http/badResponses/conflict.d.ts +4 -8
- package/dist/http/badResponses/conflict.d.ts.map +1 -1
- package/dist/http/badResponses/conflict.js +9 -17
- package/dist/http/badResponses/forbidden.d.ts +4 -8
- package/dist/http/badResponses/forbidden.d.ts.map +1 -1
- package/dist/http/badResponses/forbidden.js +9 -17
- package/dist/http/badResponses/notFound.d.ts +4 -8
- package/dist/http/badResponses/notFound.d.ts.map +1 -1
- package/dist/http/badResponses/notFound.js +9 -17
- package/dist/http/badResponses/notImplemented.d.ts +4 -8
- package/dist/http/badResponses/notImplemented.d.ts.map +1 -1
- package/dist/http/badResponses/notImplemented.js +9 -17
- package/dist/http/badResponses/serverError.d.ts +4 -8
- package/dist/http/badResponses/serverError.d.ts.map +1 -1
- package/dist/http/badResponses/serverError.js +9 -17
- package/dist/http/badResponses/unauthorized.d.ts +2 -6
- package/dist/http/badResponses/unauthorized.d.ts.map +1 -1
- package/dist/http/badResponses/unauthorized.js +7 -15
- package/dist/http/badResponses/unprocessableEntity.d.ts +13 -18
- package/dist/http/badResponses/unprocessableEntity.d.ts.map +1 -1
- package/dist/http/badResponses/unprocessableEntity.js +14 -22
- package/dist/http/successResponses/_successResponse.d.ts +18 -7
- package/dist/http/successResponses/_successResponse.d.ts.map +1 -1
- package/dist/http/successResponses/_successResponse.js +50 -21
- package/dist/http/successResponses/created.d.ts +8 -22
- package/dist/http/successResponses/created.d.ts.map +1 -1
- package/dist/http/successResponses/created.js +13 -25
- package/dist/http/successResponses/found.d.ts +9 -26
- package/dist/http/successResponses/found.d.ts.map +1 -1
- package/dist/http/successResponses/found.js +14 -29
- package/dist/http/successResponses/noContent.d.ts +4 -12
- package/dist/http/successResponses/noContent.d.ts.map +1 -1
- package/dist/http/successResponses/noContent.js +9 -17
- package/dist/http/successResponses/success.d.ts +8 -22
- package/dist/http/successResponses/success.d.ts.map +1 -1
- package/dist/http/successResponses/success.js +13 -25
- package/dist/http/successResponses/updated.d.ts +8 -22
- package/dist/http/successResponses/updated.d.ts.map +1 -1
- package/dist/http/successResponses/updated.js +13 -25
- package/dist/index.d.ts +9 -10
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +11 -12
- package/dist/services/apiService.d.ts +7 -28
- package/dist/services/apiService.d.ts.map +1 -1
- package/dist/services/apiService.js +35 -41
- package/dist/services/debugService.d.ts +16 -1
- package/dist/services/debugService.d.ts.map +1 -1
- package/dist/services/debugService.js +58 -1
- package/dist/services/logMapperService.d.ts +86 -0
- package/dist/services/logMapperService.d.ts.map +1 -0
- package/dist/services/logMapperService.js +68 -0
- package/dist/services/logService.d.ts +38 -0
- package/dist/services/logService.d.ts.map +1 -0
- package/dist/services/logService.js +40 -0
- package/dist/{services → utilities}/decodeRequestBody.d.ts +3 -4
- package/dist/utilities/decodeRequestBody.d.ts.map +1 -0
- package/dist/{services → utilities}/decodeRequestBody.js +5 -5
- package/dist/{services/decodeErrorMessageFromRequest.d.ts → utilities/decodeRequestErrorMessage.d.ts} +6 -6
- package/dist/utilities/decodeRequestErrorMessage.d.ts.map +1 -0
- package/dist/{services/decodeErrorMessageFromRequest.js → utilities/decodeRequestErrorMessage.js} +5 -5
- package/dist/utilities/errorHandler.d.ts +50 -0
- package/dist/utilities/errorHandler.d.ts.map +1 -0
- package/dist/{services → utilities}/errorHandler.js +34 -28
- package/dist/utilities/flushDebugLogs.d.ts +46 -0
- package/dist/utilities/flushDebugLogs.d.ts.map +1 -0
- package/dist/utilities/flushDebugLogs.js +59 -0
- package/dist/{services → utilities}/formAsyncParse.d.ts +3 -3
- package/dist/utilities/formAsyncParse.d.ts.map +1 -0
- package/dist/{services → utilities}/formAsyncParse.js +3 -3
- package/dist/{services → utilities}/formParse.d.ts +3 -3
- package/dist/utilities/formParse.d.ts.map +1 -0
- package/dist/{services → utilities}/formParse.js +3 -3
- package/dist/{services → utilities}/getScopedParams.d.ts +3 -4
- package/dist/utilities/getScopedParams.d.ts.map +1 -0
- package/dist/{services → utilities}/getScopedParams.js +4 -4
- package/dist/{services → utilities}/schemaValidator.d.ts +3 -15
- package/dist/utilities/schemaValidator.d.ts.map +1 -0
- package/dist/{services → utilities}/schemaValidator.js +3 -19
- package/dist/validations/validateCep.d.ts +7 -12
- package/dist/validations/validateCep.d.ts.map +1 -1
- package/dist/validations/validateCep.js +9 -15
- package/dist/validations/validateCnpj.d.ts +4 -5
- package/dist/validations/validateCnpj.d.ts.map +1 -1
- package/dist/validations/validateCnpj.js +12 -5
- package/dist/validations/validateCpf.d.ts +3 -4
- package/dist/validations/validateCpf.d.ts.map +1 -1
- package/dist/validations/validateCpf.js +11 -4
- package/dist/validations/validateDate.d.ts +16 -23
- package/dist/validations/validateDate.d.ts.map +1 -1
- package/dist/validations/validateDate.js +38 -56
- package/dist/validations/validateEmail.d.ts +3 -4
- package/dist/validations/validateEmail.d.ts.map +1 -1
- package/dist/validations/validateEmail.js +23 -35
- package/dist/validations/validatePassword.d.ts +3 -4
- package/dist/validations/validatePassword.d.ts.map +1 -1
- package/dist/validations/validatePassword.js +5 -5
- package/dist/validations/validatePhone.d.ts +3 -4
- package/dist/validations/validatePhone.d.ts.map +1 -1
- package/dist/validations/validatePhone.js +4 -4
- package/dist/validations/validateRg.d.ts +3 -4
- package/dist/validations/validateRg.d.ts.map +1 -1
- package/dist/validations/validateRg.js +4 -4
- package/package.json +1 -1
- 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/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/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/arkynLogService.d.ts +0 -44
- package/dist/services/arkynLogService.d.ts.map +0 -1
- package/dist/services/arkynLogService.js +0 -46
- package/dist/services/decodeErrorMessageFromRequest.d.ts.map +0 -1
- package/dist/services/decodeRequestBody.d.ts.map +0 -1
- package/dist/services/errorHandler.d.ts +0 -44
- package/dist/services/errorHandler.d.ts.map +0 -1
- 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.map +0 -1
- package/dist/services/formParse.d.ts.map +0 -1
- 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.map +0 -1
- 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.map +0 -1
- package/dist/types/ApiResponseDTO.d.ts +0 -17
- package/dist/types/ApiResponseDTO.d.ts.map +0 -1
- package/dist/types/ApiResponseDTO.js +0 -1
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* - Ensures length is reasonable (7–9 digits).
|
|
7
7
|
* - Optionally allows for a final letter (verifier).
|
|
8
8
|
*
|
|
9
|
-
* @param rawRg - RG string, possibly formatted.
|
|
10
|
-
* @returns `true` if format seems valid, otherwise `false`.
|
|
9
|
+
* @param {string} rawRg - RG string, possibly formatted.
|
|
10
|
+
* @returns {boolean} `true` if format seems valid, otherwise `false`.
|
|
11
11
|
*
|
|
12
12
|
* @example
|
|
13
13
|
* ```ts
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
* validateRg("12345678X"); // true
|
|
17
17
|
* ```
|
|
18
18
|
*/
|
|
19
|
-
|
|
19
|
+
function validateRg(rawRg) {
|
|
20
20
|
if (!rawRg)
|
|
21
21
|
return false;
|
|
22
22
|
const validFormat = /^[0-9a-zA-Z.-]+$/.test(rawRg);
|
|
@@ -27,5 +27,5 @@ const validateRg = (rawRg) => {
|
|
|
27
27
|
return false;
|
|
28
28
|
const isValidFormat = /^[0-9]{7,8}[0-9Xx]?$/.test(rg);
|
|
29
29
|
return isValidFormat;
|
|
30
|
-
}
|
|
30
|
+
}
|
|
31
31
|
export { validateRg };
|
package/package.json
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ApiResponseDTO } from "../types/ApiResponseDTO";
|
|
2
|
-
/**
|
|
3
|
-
* Sends a DELETE request to the specified URL with optional headers and body.
|
|
4
|
-
*
|
|
5
|
-
* @template T - The expected type of the response data.
|
|
6
|
-
* @param {string} url - The URL to send the DELETE request to.
|
|
7
|
-
* @param {HeadersInit} [headers={}] - Optional headers to include in the request.
|
|
8
|
-
* @param {any} [body] - Optional body to include in the request.
|
|
9
|
-
* @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
|
|
10
|
-
*/
|
|
11
|
-
declare function deleteRequest<T = any>(url: string, headers?: HeadersInit, body?: any): Promise<ApiResponseDTO<T>>;
|
|
12
|
-
export { deleteRequest };
|
|
13
|
-
//# sourceMappingURL=deleteRequest.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"deleteRequest.d.ts","sourceRoot":"","sources":["../../src/api/deleteRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D;;;;;;;;GAQG;AAEH,iBAAe,aAAa,CAAC,CAAC,GAAG,GAAG,EAClC,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,WAAgB,EACzB,IAAI,CAAC,EAAE,GAAG,GACT,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAE5B;AAED,OAAO,EAAE,aAAa,EAAE,CAAC"}
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { makeRequest } from "./makeRequest";
|
|
2
|
-
/**
|
|
3
|
-
* Sends a DELETE request to the specified URL with optional headers and body.
|
|
4
|
-
*
|
|
5
|
-
* @template T - The expected type of the response data.
|
|
6
|
-
* @param {string} url - The URL to send the DELETE request to.
|
|
7
|
-
* @param {HeadersInit} [headers={}] - Optional headers to include in the request.
|
|
8
|
-
* @param {any} [body] - Optional body to include in the request.
|
|
9
|
-
* @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
|
|
10
|
-
*/
|
|
11
|
-
async function deleteRequest(url, headers = {}, body) {
|
|
12
|
-
return makeRequest("DELETE", url, headers, body);
|
|
13
|
-
}
|
|
14
|
-
export { deleteRequest };
|
package/dist/api/getRequest.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { ApiResponseDTO } from "../types/ApiResponseDTO";
|
|
2
|
-
/**
|
|
3
|
-
* Sends a GET request to the specified URL with optional headers.
|
|
4
|
-
*
|
|
5
|
-
* @template T - The expected type of the response data.
|
|
6
|
-
* @param {string} url - The URL to send the GET request to.
|
|
7
|
-
* @param {HeadersInit} [headers={}] - Optional headers to include in the request.
|
|
8
|
-
* @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
|
|
9
|
-
*/
|
|
10
|
-
declare function getRequest<T = any>(url: string, headers?: HeadersInit): Promise<ApiResponseDTO<T>>;
|
|
11
|
-
export { getRequest };
|
|
12
|
-
//# sourceMappingURL=getRequest.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getRequest.d.ts","sourceRoot":"","sources":["../../src/api/getRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D;;;;;;;GAOG;AAEH,iBAAe,UAAU,CAAC,CAAC,GAAG,GAAG,EAC/B,GAAG,EAAE,MAAM,EACX,OAAO,GAAE,WAAgB,GACxB,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAE5B;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
package/dist/api/getRequest.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { makeRequest } from "./makeRequest";
|
|
2
|
-
/**
|
|
3
|
-
* Sends a GET request to the specified URL with optional headers.
|
|
4
|
-
*
|
|
5
|
-
* @template T - The expected type of the response data.
|
|
6
|
-
* @param {string} url - The URL to send the GET request to.
|
|
7
|
-
* @param {HeadersInit} [headers={}] - Optional headers to include in the request.
|
|
8
|
-
* @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
|
|
9
|
-
*/
|
|
10
|
-
async function getRequest(url, headers = {}) {
|
|
11
|
-
return makeRequest("GET", url, headers);
|
|
12
|
-
}
|
|
13
|
-
export { getRequest };
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import type { ApiResponseDTO } from "../types/ApiResponseDTO";
|
|
2
|
-
/**
|
|
3
|
-
* Makes an HTTP request using the Fetch API and returns a standardized response.
|
|
4
|
-
*
|
|
5
|
-
* @template T - The expected type of the response data.
|
|
6
|
-
* @param method - The HTTP method to use for the request. Supported methods are:
|
|
7
|
-
* - "POST": Create a new resource.
|
|
8
|
-
* - "PUT": Update an existing resource.
|
|
9
|
-
* - "DELETE": Remove a resource.
|
|
10
|
-
* - "PATCH": Partially update a resource.
|
|
11
|
-
* - "GET": Retrieve a resource.
|
|
12
|
-
* @param url - The URL to which the request is sent.
|
|
13
|
-
* @param headers - Optional headers to include in the request. Defaults to an empty object.
|
|
14
|
-
* @param body - Optional body to include in the request. Should be serializable to JSON.
|
|
15
|
-
* @returns A promise that resolves to an `ApiResponseDTO<T>` object containing:
|
|
16
|
-
* - `success`: A boolean indicating whether the request was successful.
|
|
17
|
-
* - `status`: The HTTP status code of the response.
|
|
18
|
-
* - `message`: A message describing the result of the request.
|
|
19
|
-
* - `response`: The parsed JSON response data, or `null` if parsing fails.
|
|
20
|
-
* - `cause`: Additional error information, if applicable.
|
|
21
|
-
*
|
|
22
|
-
* @example
|
|
23
|
-
* ```typescript
|
|
24
|
-
* import { makeRequest } from "./makeRequest";
|
|
25
|
-
*
|
|
26
|
-
* async function fetchData() {
|
|
27
|
-
* const response = await makeRequest("GET", "https://api.example.com/data");
|
|
28
|
-
* if (response.success) {
|
|
29
|
-
* console.log("Data:", response.response);
|
|
30
|
-
* } else {
|
|
31
|
-
* console.error("Error:", response.message);
|
|
32
|
-
* }
|
|
33
|
-
* }
|
|
34
|
-
* ```
|
|
35
|
-
*/
|
|
36
|
-
declare function makeRequest<T = any>(method: "POST" | "PUT" | "DELETE" | "PATCH" | "GET", url: string, rawHeaders?: HeadersInit, body?: any): Promise<ApiResponseDTO<T>>;
|
|
37
|
-
export { makeRequest };
|
|
38
|
-
//# sourceMappingURL=makeRequest.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"makeRequest.d.ts","sourceRoot":"","sources":["../../src/api/makeRequest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AAEH,iBAAe,WAAW,CAAC,CAAC,GAAG,GAAG,EAChC,MAAM,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,EACnD,GAAG,EAAE,MAAM,EACX,UAAU,GAAE,WAAgB,EAC5B,IAAI,CAAC,EAAE,GAAG,GACT,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CA2E5B;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ApiResponseDTO } from "../types/ApiResponseDTO";
|
|
2
|
-
/**
|
|
3
|
-
* Sends a PATCH request to the specified URL with optional headers and body.
|
|
4
|
-
*
|
|
5
|
-
* @template T - The expected type of the response data.
|
|
6
|
-
* @param {string} url - The URL to send the PATCH request to.
|
|
7
|
-
* @param {HeadersInit} [headers={}] - Optional headers to include in the request.
|
|
8
|
-
* @param {any} body - The body to include in the request.
|
|
9
|
-
* @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
|
|
10
|
-
*/
|
|
11
|
-
declare function patchRequest<T = any>(url: string, headers: HeadersInit | undefined, body: any): Promise<ApiResponseDTO<T>>;
|
|
12
|
-
export { patchRequest };
|
|
13
|
-
//# sourceMappingURL=patchRequest.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"patchRequest.d.ts","sourceRoot":"","sources":["../../src/api/patchRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D;;;;;;;;GAQG;AAEH,iBAAe,YAAY,CAAC,CAAC,GAAG,GAAG,EACjC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,WAAW,YAAK,EACzB,IAAI,EAAE,GAAG,GACR,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAE5B;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
package/dist/api/patchRequest.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { makeRequest } from "./makeRequest";
|
|
2
|
-
/**
|
|
3
|
-
* Sends a PATCH request to the specified URL with optional headers and body.
|
|
4
|
-
*
|
|
5
|
-
* @template T - The expected type of the response data.
|
|
6
|
-
* @param {string} url - The URL to send the PATCH request to.
|
|
7
|
-
* @param {HeadersInit} [headers={}] - Optional headers to include in the request.
|
|
8
|
-
* @param {any} body - The body to include in the request.
|
|
9
|
-
* @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
|
|
10
|
-
*/
|
|
11
|
-
async function patchRequest(url, headers = {}, body) {
|
|
12
|
-
return makeRequest("PATCH", url, headers, body);
|
|
13
|
-
}
|
|
14
|
-
export { patchRequest };
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ApiResponseDTO } from "../types/ApiResponseDTO";
|
|
2
|
-
/**
|
|
3
|
-
* Sends a PATCH request to the specified URL with optional headers and body.
|
|
4
|
-
*
|
|
5
|
-
* @template T - The expected type of the response data.
|
|
6
|
-
* @param {string} url - The URL to send the PATCH request to.
|
|
7
|
-
* @param {HeadersInit} [headers={}] - Optional headers to include in the request.
|
|
8
|
-
* @param {any} body - The body to include in the request.
|
|
9
|
-
* @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
|
|
10
|
-
*/
|
|
11
|
-
declare function postRequest<T = any>(url: string, headers: HeadersInit | undefined, body: any): Promise<ApiResponseDTO<T>>;
|
|
12
|
-
export { postRequest };
|
|
13
|
-
//# sourceMappingURL=postRequest.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"postRequest.d.ts","sourceRoot":"","sources":["../../src/api/postRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D;;;;;;;;GAQG;AAEH,iBAAe,WAAW,CAAC,CAAC,GAAG,GAAG,EAChC,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,WAAW,YAAK,EACzB,IAAI,EAAE,GAAG,GACR,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAE5B;AAED,OAAO,EAAE,WAAW,EAAE,CAAC"}
|
package/dist/api/postRequest.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { makeRequest } from "./makeRequest";
|
|
2
|
-
/**
|
|
3
|
-
* Sends a PATCH request to the specified URL with optional headers and body.
|
|
4
|
-
*
|
|
5
|
-
* @template T - The expected type of the response data.
|
|
6
|
-
* @param {string} url - The URL to send the PATCH request to.
|
|
7
|
-
* @param {HeadersInit} [headers={}] - Optional headers to include in the request.
|
|
8
|
-
* @param {any} body - The body to include in the request.
|
|
9
|
-
* @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
|
|
10
|
-
*/
|
|
11
|
-
async function postRequest(url, headers = {}, body) {
|
|
12
|
-
return makeRequest("POST", url, headers, body);
|
|
13
|
-
}
|
|
14
|
-
export { postRequest };
|
package/dist/api/putRequest.d.ts
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { ApiResponseDTO } from "../types/ApiResponseDTO";
|
|
2
|
-
/**
|
|
3
|
-
* Sends a PATCH request to the specified URL with optional headers and body.
|
|
4
|
-
*
|
|
5
|
-
* @template T - The expected type of the response data.
|
|
6
|
-
* @param {string} url - The URL to send the PATCH request to.
|
|
7
|
-
* @param {HeadersInit} [headers={}] - Optional headers to include in the request.
|
|
8
|
-
* @param {any} body - The body to include in the request.
|
|
9
|
-
* @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
|
|
10
|
-
*/
|
|
11
|
-
declare function putRequest<T = any>(url: string, headers: HeadersInit | undefined, body: any): Promise<ApiResponseDTO<T>>;
|
|
12
|
-
export { putRequest };
|
|
13
|
-
//# sourceMappingURL=putRequest.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"putRequest.d.ts","sourceRoot":"","sources":["../../src/api/putRequest.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAG9D;;;;;;;;GAQG;AAEH,iBAAe,UAAU,CAAC,CAAC,GAAG,GAAG,EAC/B,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,WAAW,YAAK,EACzB,IAAI,EAAE,GAAG,GACR,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAE5B;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
package/dist/api/putRequest.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { makeRequest } from "./makeRequest";
|
|
2
|
-
/**
|
|
3
|
-
* Sends a PATCH request to the specified URL with optional headers and body.
|
|
4
|
-
*
|
|
5
|
-
* @template T - The expected type of the response data.
|
|
6
|
-
* @param {string} url - The URL to send the PATCH request to.
|
|
7
|
-
* @param {HeadersInit} [headers={}] - Optional headers to include in the request.
|
|
8
|
-
* @param {any} body - The body to include in the request.
|
|
9
|
-
* @returns {Promise<ApiResponseDTO<T>>} A promise that resolves to the API response.
|
|
10
|
-
*/
|
|
11
|
-
async function putRequest(url, headers = {}, body) {
|
|
12
|
-
return makeRequest("PUT", url, headers, body);
|
|
13
|
-
}
|
|
14
|
-
export { putRequest };
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
type InputProps = {
|
|
2
|
-
status: number;
|
|
3
|
-
url: string;
|
|
4
|
-
method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
5
|
-
requestHeaders: HeadersInit;
|
|
6
|
-
responseHeaders: HeadersInit;
|
|
7
|
-
requestBody: any;
|
|
8
|
-
elapsedTime: number;
|
|
9
|
-
responseBody: any;
|
|
10
|
-
queryParams: URLSearchParams;
|
|
11
|
-
};
|
|
12
|
-
type OutputProps = {
|
|
13
|
-
rawUrl: string;
|
|
14
|
-
status: number;
|
|
15
|
-
method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
16
|
-
token: string | null;
|
|
17
|
-
elapsedTime: number;
|
|
18
|
-
requestHeaders: Record<string, string>;
|
|
19
|
-
requestBody: Record<string, string>;
|
|
20
|
-
queryParams: Record<string, string>;
|
|
21
|
-
responseHeaders: Record<string, string>;
|
|
22
|
-
responseBody: any;
|
|
23
|
-
};
|
|
24
|
-
declare class ArkynLogRequestMapper {
|
|
25
|
-
private static mapHeaders;
|
|
26
|
-
private static mapQueryParams;
|
|
27
|
-
static handle(props: InputProps): OutputProps;
|
|
28
|
-
}
|
|
29
|
-
export { ArkynLogRequestMapper };
|
|
30
|
-
//# sourceMappingURL=arkynLogRequestMapper.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"arkynLogRequestMapper.d.ts","sourceRoot":"","sources":["../../src/mapper/arkynLogRequestMapper.ts"],"names":[],"mappings":"AAAA,KAAK,UAAU,GAAG;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpD,cAAc,EAAE,WAAW,CAAC;IAC5B,eAAe,EAAE,WAAW,CAAC;IAC7B,WAAW,EAAE,GAAG,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,GAAG,CAAC;IAClB,WAAW,EAAE,eAAe,CAAC;CAC9B,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpD,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACxC,YAAY,EAAE,GAAG,CAAC;CACnB,CAAC;AAEF,cAAM,qBAAqB;IACzB,OAAO,CAAC,MAAM,CAAC,UAAU;IAkBzB,OAAO,CAAC,MAAM,CAAC,cAAc;IAY7B,MAAM,CAAC,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,WAAW;CAc9C;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
class ArkynLogRequestMapper {
|
|
2
|
-
static mapHeaders(headers) {
|
|
3
|
-
if (headers instanceof Headers) {
|
|
4
|
-
return Object.fromEntries(headers.entries());
|
|
5
|
-
}
|
|
6
|
-
else if (typeof headers === "object") {
|
|
7
|
-
return Object.entries(headers).reduce((acc, [key, value]) => {
|
|
8
|
-
if (typeof value === "string") {
|
|
9
|
-
acc[key] = value;
|
|
10
|
-
}
|
|
11
|
-
else if (Array.isArray(value)) {
|
|
12
|
-
acc[key] = value.join(", ");
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
acc[key] = JSON.stringify(value);
|
|
16
|
-
}
|
|
17
|
-
return acc;
|
|
18
|
-
}, {});
|
|
19
|
-
}
|
|
20
|
-
return {};
|
|
21
|
-
}
|
|
22
|
-
static mapQueryParams(queryParams) {
|
|
23
|
-
const params = {};
|
|
24
|
-
queryParams.forEach((value, key) => {
|
|
25
|
-
params[key] = value;
|
|
26
|
-
});
|
|
27
|
-
return params;
|
|
28
|
-
}
|
|
29
|
-
static handle(props) {
|
|
30
|
-
return {
|
|
31
|
-
rawUrl: props.url,
|
|
32
|
-
status: props.status,
|
|
33
|
-
method: props.method,
|
|
34
|
-
token: null,
|
|
35
|
-
elapsedTime: props.elapsedTime,
|
|
36
|
-
requestHeaders: this.mapHeaders(props.requestHeaders),
|
|
37
|
-
requestBody: props.requestBody || null,
|
|
38
|
-
queryParams: this.mapQueryParams(props.queryParams),
|
|
39
|
-
responseHeaders: this.mapHeaders(props.responseHeaders),
|
|
40
|
-
responseBody: props.responseBody || null,
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
export { ArkynLogRequestMapper };
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
type ArkynConfigProps = {
|
|
2
|
-
trafficSourceId: string;
|
|
3
|
-
userToken: string;
|
|
4
|
-
apiUrl: string;
|
|
5
|
-
};
|
|
6
|
-
type SetArkynConfigProps = {
|
|
7
|
-
trafficSourceId: string;
|
|
8
|
-
userToken: string;
|
|
9
|
-
logBaseApiUrl?: string;
|
|
10
|
-
};
|
|
11
|
-
/**
|
|
12
|
-
* The `ArkynLogService` class manages the configuration for the arkyn flow.
|
|
13
|
-
* It allows you to set and retrieve the arkyn configuration, including the traffic source ID,
|
|
14
|
-
* user token, and API URL.
|
|
15
|
-
*/
|
|
16
|
-
declare class ArkynLogService {
|
|
17
|
-
private static arkynConfig?;
|
|
18
|
-
/**
|
|
19
|
-
* Sets the configuration for the arkyn. This method initializes the arkyn configuration
|
|
20
|
-
* with the provided `arkynConfig` values. If the configuration has already been set,
|
|
21
|
-
* the method will return early without making any changes.
|
|
22
|
-
*
|
|
23
|
-
* @param arkynConfig - An object containing the arkyn configuration properties.
|
|
24
|
-
* @param arkynConfig.arkynTrafficSourceId - The key used to identify the arkyn.
|
|
25
|
-
* @param arkynConfig.arkynUserToken - The user token for authenticating with the arkyn.
|
|
26
|
-
* @param arkynConfig.arkynLogBaseApiUrl - (Optional) The API URL for the arkyn. If not provided,
|
|
27
|
-
* a default URL will be used.
|
|
28
|
-
*/
|
|
29
|
-
static setArkynConfig(arkynConfig: SetArkynConfigProps): void;
|
|
30
|
-
/**
|
|
31
|
-
* Retrieves the current arkyn configuration for the ArkynLogService.
|
|
32
|
-
*
|
|
33
|
-
* @returns {ArkynConfigProps | undefined} The current arkyn configuration if set,
|
|
34
|
-
* or `undefined` if no configuration has been initialized.
|
|
35
|
-
*/
|
|
36
|
-
static getArkynConfig(): ArkynConfigProps | undefined;
|
|
37
|
-
/**
|
|
38
|
-
* Resets the arkyn configuration to `undefined`.
|
|
39
|
-
* This method can be used to clear the current configuration.
|
|
40
|
-
*/
|
|
41
|
-
static resetArkynConfig(): void;
|
|
42
|
-
}
|
|
43
|
-
export { ArkynLogService };
|
|
44
|
-
//# sourceMappingURL=arkynLogService.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"arkynLogService.d.ts","sourceRoot":"","sources":["../../src/services/arkynLogService.ts"],"names":[],"mappings":"AAAA,KAAK,gBAAgB,GAAG;IACtB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,KAAK,mBAAmB,GAAG;IACzB,eAAe,EAAE,MAAM,CAAC;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEF;;;;GAIG;AAEH,cAAM,eAAe;IACnB,OAAO,CAAC,MAAM,CAAC,WAAW,CAAC,CAAmB;IAE9C;;;;;;;;;;OAUG;IAEH,MAAM,CAAC,cAAc,CAAC,WAAW,EAAE,mBAAmB;IAYtD;;;;;OAKG;IACH,MAAM,CAAC,cAAc,IAAI,gBAAgB,GAAG,SAAS;IAIrD;;;OAGG;IAEH,MAAM,CAAC,gBAAgB;CAGxB;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* The `ArkynLogService` class manages the configuration for the arkyn flow.
|
|
3
|
-
* It allows you to set and retrieve the arkyn configuration, including the traffic source ID,
|
|
4
|
-
* user token, and API URL.
|
|
5
|
-
*/
|
|
6
|
-
class ArkynLogService {
|
|
7
|
-
static arkynConfig;
|
|
8
|
-
/**
|
|
9
|
-
* Sets the configuration for the arkyn. This method initializes the arkyn configuration
|
|
10
|
-
* with the provided `arkynConfig` values. If the configuration has already been set,
|
|
11
|
-
* the method will return early without making any changes.
|
|
12
|
-
*
|
|
13
|
-
* @param arkynConfig - An object containing the arkyn configuration properties.
|
|
14
|
-
* @param arkynConfig.arkynTrafficSourceId - The key used to identify the arkyn.
|
|
15
|
-
* @param arkynConfig.arkynUserToken - The user token for authenticating with the arkyn.
|
|
16
|
-
* @param arkynConfig.arkynLogBaseApiUrl - (Optional) The API URL for the arkyn. If not provided,
|
|
17
|
-
* a default URL will be used.
|
|
18
|
-
*/
|
|
19
|
-
static setArkynConfig(arkynConfig) {
|
|
20
|
-
if (!!this.arkynConfig)
|
|
21
|
-
return;
|
|
22
|
-
const { trafficSourceId, userToken, logBaseApiUrl } = arkynConfig;
|
|
23
|
-
this.arkynConfig = {
|
|
24
|
-
trafficSourceId,
|
|
25
|
-
userToken,
|
|
26
|
-
apiUrl: logBaseApiUrl || `http://95.216.190.158:8081/ingest-log`,
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
/**
|
|
30
|
-
* Retrieves the current arkyn configuration for the ArkynLogService.
|
|
31
|
-
*
|
|
32
|
-
* @returns {ArkynConfigProps | undefined} The current arkyn configuration if set,
|
|
33
|
-
* or `undefined` if no configuration has been initialized.
|
|
34
|
-
*/
|
|
35
|
-
static getArkynConfig() {
|
|
36
|
-
return this.arkynConfig;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Resets the arkyn configuration to `undefined`.
|
|
40
|
-
* This method can be used to clear the current configuration.
|
|
41
|
-
*/
|
|
42
|
-
static resetArkynConfig() {
|
|
43
|
-
this.arkynConfig = undefined;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
export { ArkynLogService };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decodeErrorMessageFromRequest.d.ts","sourceRoot":"","sources":["../../src/services/decodeErrorMessageFromRequest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,iBAAS,6BAA6B,CAAC,IAAI,EAAE,GAAG,EAAE,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAkB5E;AAED,OAAO,EAAE,6BAA6B,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"decodeRequestBody.d.ts","sourceRoot":"","sources":["../../src/services/decodeRequestBody.ts"],"names":[],"mappings":"AAEA,KAAK,yBAAyB,GAAG,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AAEpE;;;;;;;;;;;;GAYG;AAEH,QAAA,MAAM,iBAAiB,EAAE,yBAsBxB,CAAC;AAEF,OAAO,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Handles errors and converts them into appropriate HTTP responses.
|
|
3
|
-
*
|
|
4
|
-
* This function takes an error object and determines its type to return
|
|
5
|
-
* the corresponding HTTP response. It supports both success and error
|
|
6
|
-
* response types, converting them into a standardized format using the
|
|
7
|
-
* `toResponse` method when applicable.
|
|
8
|
-
*
|
|
9
|
-
* @param error - The error object to handle. It can be an instance of various
|
|
10
|
-
* HTTP response classes or a generic error.
|
|
11
|
-
*
|
|
12
|
-
* @returns The corresponding HTTP response object if the error matches a known
|
|
13
|
-
* type, or `undefined` if no match is found.
|
|
14
|
-
*
|
|
15
|
-
* ### Supported Success Responses:
|
|
16
|
-
* - `Found`
|
|
17
|
-
* - `Created`
|
|
18
|
-
* - `Updated`
|
|
19
|
-
* - `Success`
|
|
20
|
-
* - `NoContent`
|
|
21
|
-
*
|
|
22
|
-
* ### Supported Error Responses:
|
|
23
|
-
* - `BadGateway`
|
|
24
|
-
* - `BadRequest`
|
|
25
|
-
* - `Conflict`
|
|
26
|
-
* - `Forbidden`
|
|
27
|
-
* - `NotFound`
|
|
28
|
-
* - `NotImplemented`
|
|
29
|
-
* - `ServerError`
|
|
30
|
-
* - `Unauthorized`
|
|
31
|
-
* - `UnprocessableEntity`
|
|
32
|
-
*
|
|
33
|
-
* ### Example Usage:
|
|
34
|
-
* ```typescript
|
|
35
|
-
* try {
|
|
36
|
-
* // Some operation that might throw an error
|
|
37
|
-
* } catch (error) {
|
|
38
|
-
* return errorHandler(error);
|
|
39
|
-
* }
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
declare function errorHandler(error: any): Response;
|
|
43
|
-
export { errorHandler };
|
|
44
|
-
//# sourceMappingURL=errorHandler.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"errorHandler.d.ts","sourceRoot":"","sources":["../../src/services/errorHandler.ts"],"names":[],"mappings":"AAgBA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AAEH,iBAAS,YAAY,CAAC,KAAK,EAAE,GAAG,GAAG,QAAQ,CAsC1C;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"flushDebugLogs.d.ts","sourceRoot":"","sources":["../../src/services/flushDebugLogs.ts"],"names":[],"mappings":"AAAA,KAAK,mBAAmB,GAAG;IACzB,MAAM,EAAE,QAAQ,GAAG,MAAM,GAAG,KAAK,GAAG,OAAO,CAAC;IAC5C,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,EAAE,CAAC;CAClB,CAAC;AAEF,iBAAS,cAAc,CAAC,KAAK,EAAE,mBAAmB,QAwBjD;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
function flushDebugLogs(props) {
|
|
2
|
-
const isDebugMode = process.env.NODE_ENV === "development" ||
|
|
3
|
-
process.env?.SHOW_ERRORS_IN_CONSOLE === "true";
|
|
4
|
-
if (isDebugMode) {
|
|
5
|
-
const reset = "\x1b[0m";
|
|
6
|
-
const colors = {
|
|
7
|
-
yellow: "\x1b[33m",
|
|
8
|
-
cyan: "\x1b[36m",
|
|
9
|
-
red: "\x1b[31m",
|
|
10
|
-
green: "\x1b[32m",
|
|
11
|
-
};
|
|
12
|
-
const debugName = `${colors[props.scheme]}[${props.name}]${reset}`;
|
|
13
|
-
let consoleData = `\n`;
|
|
14
|
-
props.debugs.forEach((debug) => {
|
|
15
|
-
consoleData += `${debugName} ${debug.trim()}\n`;
|
|
16
|
-
});
|
|
17
|
-
console.log(consoleData);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
export { flushDebugLogs };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formAsyncParse.d.ts","sourceRoot":"","sources":["../../src/services/formAsyncParse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAEnC,KAAK,eAAe,CAAC,CAAC,SAAS,cAAc,IAAI;IAC/C,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;CACjD,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,OAAO,EAAE,KAAK,CAAC;IACf,MAAM,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAChC,WAAW,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CACtC,CAAC;AAEF,KAAK,cAAc,GAAG,CAAC,QAAQ,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAExE,KAAK,mBAAmB,CAAC,CAAC,SAAS,cAAc,IAC7C,eAAe,CAAC,CAAC,CAAC,GAClB,aAAa,CAAC;AAElB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,iBAAe,cAAc,CAAC,CAAC,SAAS,cAAc,EAAE,CACtD,QAAQ,EACR,MAAM,EACP,EAAE,CAAC,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC,CAAC,CAAC,CAqBrC;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"formParse.d.ts","sourceRoot":"","sources":["../../src/services/formParse.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAEnC,KAAK,eAAe,CAAC,CAAC,SAAS,cAAc,IAAI;IAC/C,OAAO,EAAE,IAAI,CAAC;IACd,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC;CACjD,CAAC;AAEF,KAAK,aAAa,GAAG;IACnB,OAAO,EAAE,KAAK,CAAC;IACf,MAAM,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;IAChC,WAAW,EAAE;QAAE,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,CAAC;CACtC,CAAC;AAEF,KAAK,cAAc,GAAG,CAAC,QAAQ,EAAE;IAAE,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,EAAE,MAAM,EAAE,OAAO,CAAC,CAAC;AAExE,KAAK,mBAAmB,CAAC,CAAC,SAAS,cAAc,IAC7C,eAAe,CAAC,CAAC,CAAC,GAClB,aAAa,CAAC;AAElB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,iBAAS,SAAS,CAAC,CAAC,SAAS,cAAc,EAAE,CAC3C,QAAQ,EACR,MAAM,EACP,EAAE,CAAC,GAAG,mBAAmB,CAAC,CAAC,CAAC,CAqB5B;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Retrieves information about the caller of the current function.
|
|
3
|
-
*
|
|
4
|
-
* This function analyzes the stack trace to determine the file path and function name
|
|
5
|
-
* of the caller. It excludes stack trace entries related to the `@arkyn/server` package
|
|
6
|
-
* and attempts to resolve the file path relative to the project root directory.
|
|
7
|
-
*
|
|
8
|
-
* @returns An object containing:
|
|
9
|
-
* - `functionName`: The name of the function that called the current function, or "Unknown function" if it cannot be determined.
|
|
10
|
-
* - `callerInfo`: The file path of the caller relative to the project root, or "Unknown caller" if it cannot be determined.
|
|
11
|
-
*/
|
|
12
|
-
declare function getCaller(): {
|
|
13
|
-
functionName: string;
|
|
14
|
-
callerInfo: string;
|
|
15
|
-
};
|
|
16
|
-
export { getCaller };
|
|
17
|
-
//# sourceMappingURL=getCaller.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getCaller.d.ts","sourceRoot":"","sources":["../../src/services/getCaller.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AAEH,iBAAS,SAAS;;;EAiEjB;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import path from "path";
|
|
2
|
-
import { DebugService } from "./debugService";
|
|
3
|
-
/**
|
|
4
|
-
* Retrieves information about the caller of the current function.
|
|
5
|
-
*
|
|
6
|
-
* This function analyzes the stack trace to determine the file path and function name
|
|
7
|
-
* of the caller. It excludes stack trace entries related to the `@arkyn/server` package
|
|
8
|
-
* and attempts to resolve the file path relative to the project root directory.
|
|
9
|
-
*
|
|
10
|
-
* @returns An object containing:
|
|
11
|
-
* - `functionName`: The name of the function that called the current function, or "Unknown function" if it cannot be determined.
|
|
12
|
-
* - `callerInfo`: The file path of the caller relative to the project root, or "Unknown caller" if it cannot be determined.
|
|
13
|
-
*/
|
|
14
|
-
function getCaller() {
|
|
15
|
-
const projectRoot = process.cwd();
|
|
16
|
-
const err = new Error();
|
|
17
|
-
const stack = err.stack || "";
|
|
18
|
-
const stackLines = stack.split("\n").map((line) => line.trim());
|
|
19
|
-
const ignoreFiles = DebugService.ignoreFiles;
|
|
20
|
-
let callerIndex = 2;
|
|
21
|
-
while (callerIndex < stackLines.length &&
|
|
22
|
-
(stackLines[callerIndex].includes("node:internal") ||
|
|
23
|
-
stackLines[callerIndex].includes("/node_modules/"))) {
|
|
24
|
-
callerIndex++;
|
|
25
|
-
}
|
|
26
|
-
if (ignoreFiles.length > 0) {
|
|
27
|
-
while (callerIndex < stackLines.length &&
|
|
28
|
-
ignoreFiles.some((ignoreFile) => stackLines[callerIndex].includes(ignoreFile))) {
|
|
29
|
-
callerIndex++;
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
const callerLine = stackLines[callerIndex] || "";
|
|
33
|
-
let functionName = "Unknown function";
|
|
34
|
-
let callerInfo = "Unknown caller";
|
|
35
|
-
const namedFunctionMatch = callerLine.match(/at\s+([^(\s]+)\s+\(([^)]+)\)/);
|
|
36
|
-
if (namedFunctionMatch) {
|
|
37
|
-
functionName = namedFunctionMatch[1];
|
|
38
|
-
callerInfo = namedFunctionMatch[2];
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
const anonymousFunctionMatch = callerLine.match(/at\s+(.+)/);
|
|
42
|
-
if (anonymousFunctionMatch) {
|
|
43
|
-
callerInfo = anonymousFunctionMatch[1];
|
|
44
|
-
const objectMethodMatch = callerInfo.match(/at\s+([^(\s]+)\s+/);
|
|
45
|
-
if (objectMethodMatch && objectMethodMatch[1] !== "new") {
|
|
46
|
-
functionName = objectMethodMatch[1];
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
if (callerInfo.includes("(")) {
|
|
51
|
-
callerInfo = callerInfo.substring(callerInfo.indexOf("(") + 1, callerInfo.lastIndexOf(")"));
|
|
52
|
-
}
|
|
53
|
-
callerInfo = callerInfo.split(":").slice(0, -2).join(":");
|
|
54
|
-
try {
|
|
55
|
-
callerInfo = path.relative(projectRoot, callerInfo);
|
|
56
|
-
}
|
|
57
|
-
catch (e) { }
|
|
58
|
-
return { functionName, callerInfo };
|
|
59
|
-
}
|
|
60
|
-
export { getCaller };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getScopedParams.d.ts","sourceRoot":"","sources":["../../src/services/getScopedParams.ts"],"names":[],"mappings":"AAAA,KAAK,uBAAuB,GAAG,CAC7B,OAAO,EAAE,OAAO,EAChB,KAAK,CAAC,EAAE,MAAM,KACX,eAAe,CAAC;AACrB;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,QAAA,MAAM,eAAe,EAAE,uBAWtB,CAAC;AAEF,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"measureRouteExecution.d.ts","sourceRoot":"","sources":["../../src/services/measureRouteExecution.ts"],"names":[],"mappings":"AAAA,iBAAS,qBAAqB,CAAC,CAAC,GAAG,OAAO,EACxC,OAAO,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,OAAO,CAAC,CAAC,CAAC,IAEG,OAAO,GAAG,KAAG,OAAO,CAAC,CAAC,CAAC,CAyB9D;AAED,OAAO,EAAE,qBAAqB,EAAE,CAAC"}
|