@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notFound.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/notFound.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C
|
|
1
|
+
{"version":3,"file":"notFound.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/notFound.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;IAWxC,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 501 Not Implemented — the server does not support the functionality required to fulfill the request.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* throw new NotImplemented("Webhook delivery is not yet implemented");
|
|
8
|
+
* ```
|
|
6
9
|
*/
|
|
7
10
|
declare class NotImplemented 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 the functionality is not implemented.
|
|
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 `NotImplemented` 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 `NotImplemented` 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 { NotImplemented };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notImplemented.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/notImplemented.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C
|
|
1
|
+
{"version":3,"file":"notImplemented.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/notImplemented.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;;;;GAOG;AACH,cAAM,cAAe,SAAQ,WAAW;IACvC;;;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,cAAc,EAAE,CAAC"}
|
|
@@ -1,34 +1,21 @@
|
|
|
1
1
|
import { BadResponse } from "./_badResponse";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* HTTP 500 Internal Server Error — an unexpected condition prevented the server from fulfilling the request.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* throw new ServerError("Failed to connect to the database");
|
|
8
|
+
* ```
|
|
6
9
|
*/
|
|
7
10
|
declare class ServerError 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 server 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 `ServerError` 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 `ServerError` 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 { ServerError };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serverError.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/serverError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C
|
|
1
|
+
{"version":3,"file":"serverError.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/serverError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;;;;GAOG;AACH,cAAM,WAAY,SAAQ,WAAW;IACpC;;;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,WAAW,EAAE,CAAC"}
|
|
@@ -1,34 +1,21 @@
|
|
|
1
1
|
import { BadResponse } from "./_badResponse";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* HTTP 401 Unauthorized — the request lacks valid authentication credentials.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* throw new Unauthorized("Invalid or expired token");
|
|
8
|
+
* ```
|
|
6
9
|
*/
|
|
7
10
|
declare class Unauthorized 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 the request is unauthorized.
|
|
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 `Unauthorized` 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 `Unauthorized` 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 { Unauthorized };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unauthorized.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/unauthorized.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C
|
|
1
|
+
{"version":3,"file":"unauthorized.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/unauthorized.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;;;;GAOG;AACH,cAAM,YAAa,SAAQ,WAAW;IACrC;;;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,YAAY,EAAE,CAAC"}
|
|
@@ -1,43 +1,33 @@
|
|
|
1
1
|
import { BadResponse } from "./_badResponse";
|
|
2
|
-
type UnprocessableEntityProps = {
|
|
3
|
-
data?: any;
|
|
4
|
-
fieldErrors?: Record<string, string>;
|
|
5
|
-
fields?: Record<string, string>;
|
|
6
|
-
message?: string;
|
|
7
|
-
};
|
|
8
2
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
3
|
+
* HTTP 422 Unprocessable Entity — the request is well-formed but contains semantic validation errors.
|
|
4
|
+
* Typically used for form field validation failures.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* throw new UnprocessableEntity({
|
|
9
|
+
* message: "Validation failed",
|
|
10
|
+
* fieldErrors: { email: "Invalid email format", age: "Must be 18 or older" },
|
|
11
|
+
* fields: { email: "not-an-email", age: "15" },
|
|
12
|
+
* });
|
|
13
|
+
* ```
|
|
12
14
|
*/
|
|
13
15
|
declare class UnprocessableEntity extends BadResponse {
|
|
14
|
-
body: any;
|
|
15
|
-
status: number;
|
|
16
|
-
statusText: string;
|
|
17
16
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* @param props -
|
|
21
|
-
*
|
|
22
|
-
* - `fieldErrors`: A record of field-specific error messages.
|
|
23
|
-
* - `fields`: A record of field values that caused the error.
|
|
24
|
-
* - `message`: A descriptive message explaining the error.
|
|
25
|
-
* @param enableDebug - A boolean indicating whether to enable debug logging for this error.
|
|
26
|
-
*/
|
|
27
|
-
constructor(props: UnprocessableEntityProps);
|
|
28
|
-
/**
|
|
29
|
-
* Converts the `UnprocessableEntity` instance into a `Response` object with a JSON body.
|
|
30
|
-
* This method ensures the response has the appropriate headers, status, and status text.
|
|
31
|
-
*
|
|
32
|
-
* @returns A `Response` object with the serialized JSON body and response metadata.
|
|
17
|
+
* @param props.message - Human-readable description of the error.
|
|
18
|
+
* @param props.fieldErrors - Per-field validation messages keyed by field name.
|
|
19
|
+
* @param props.fields - Original submitted field values (useful for repopulating forms).
|
|
20
|
+
* @param props.data - Any extra data to include in the response body.
|
|
33
21
|
*/
|
|
22
|
+
constructor(props: {
|
|
23
|
+
data?: any;
|
|
24
|
+
fieldErrors?: Record<string, string>;
|
|
25
|
+
fields?: Record<string, string>;
|
|
26
|
+
message?: string;
|
|
27
|
+
});
|
|
28
|
+
/** Converts to a `Response` with `Content-Type: application/json` header. */
|
|
34
29
|
toResponse(): Response;
|
|
35
|
-
/**
|
|
36
|
-
* Converts the `UnprocessableEntity` instance into a `Response` object using the `Response.json` method.
|
|
37
|
-
* This method is an alternative to `toResponse` for generating JSON error responses.
|
|
38
|
-
*
|
|
39
|
-
* @returns A `Response` object with the JSON body and response metadata.
|
|
40
|
-
*/
|
|
30
|
+
/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */
|
|
41
31
|
toJson(): Response;
|
|
42
32
|
}
|
|
43
33
|
export { UnprocessableEntity };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unprocessableEntity.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/unprocessableEntity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C,
|
|
1
|
+
{"version":3,"file":"unprocessableEntity.d.ts","sourceRoot":"","sources":["../../../src/http/badResponses/unprocessableEntity.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;;;;;;;;;;;GAYG;AACH,cAAM,mBAAoB,SAAQ,WAAW;IAC5C;;;;;OAKG;gBACS,KAAK,EAAE;QAElB,IAAI,CAAC,EAAE,GAAG,CAAC;QACX,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACrC,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAChC,OAAO,CAAC,EAAE,MAAM,CAAC;KACjB;IAgBD,6EAA6E;IAC7E,UAAU,IAAI,QAAQ;IAUtB,uFAAuF;IACvF,MAAM,IAAI,QAAQ;CAQlB;AAED,OAAO,EAAE,mBAAmB,EAAE,CAAC"}
|
|
@@ -1,22 +1,36 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Base class for handling
|
|
3
|
-
* Provides logging functionality to track response
|
|
2
|
+
* Base class for handling successful HTTP responses with debugging capabilities.
|
|
3
|
+
* Provides logging functionality to track response and their context.
|
|
4
4
|
*/
|
|
5
5
|
declare class SuccessResponse {
|
|
6
|
+
private _body;
|
|
7
|
+
private _name;
|
|
8
|
+
private _status;
|
|
9
|
+
private _statusText;
|
|
10
|
+
private _debugColor;
|
|
11
|
+
get body(): any;
|
|
12
|
+
set body(value: any);
|
|
13
|
+
get name(): string;
|
|
14
|
+
set name(value: string);
|
|
15
|
+
get status(): number;
|
|
16
|
+
set status(value: number);
|
|
17
|
+
get statusText(): string;
|
|
18
|
+
set statusText(value: string);
|
|
19
|
+
get debugColor(): "green" | "yellow" | "cyan" | "red";
|
|
20
|
+
set debugColor(value: "green" | "yellow" | "cyan" | "red");
|
|
6
21
|
/**
|
|
7
22
|
* Logs debug information for success responses including caller context and response details.
|
|
8
23
|
*
|
|
9
|
-
* @param
|
|
10
|
-
* @param body - The response body or success data to be logged
|
|
11
|
-
* @param cause - Optional additional cause information for the error
|
|
24
|
+
* @param {any} body - The response body or success data to be logged
|
|
12
25
|
*
|
|
13
26
|
* @example
|
|
14
27
|
* ```typescript
|
|
15
28
|
* const SuccessResponse = new SuccessResponse();
|
|
16
|
-
* SuccessResponse.onDebug(
|
|
29
|
+
* SuccessResponse.onDebug({ data: "Operation completed successfully" });
|
|
17
30
|
* ```
|
|
18
31
|
*/
|
|
19
|
-
onDebug(
|
|
32
|
+
onDebug(body?: any): void;
|
|
33
|
+
makeBody(): any;
|
|
20
34
|
}
|
|
21
35
|
export { SuccessResponse };
|
|
22
36
|
//# sourceMappingURL=_successResponse.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_successResponse.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/_successResponse.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,cAAM,eAAe;
|
|
1
|
+
{"version":3,"file":"_successResponse.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/_successResponse.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,cAAM,eAAe;IAEpB,OAAO,CAAC,KAAK,CAAa;IAC1B,OAAO,CAAC,KAAK,CAA6B;IAC1C,OAAO,CAAC,OAAO,CAAe;IAC9B,OAAO,CAAC,WAAW,CAAgB;IACnC,OAAO,CAAC,WAAW,CAAgD;IAGnE,IAAI,IAAI,IAAI,GAAG,CAEd;IAGD,IAAI,IAAI,CAAC,KAAK,EAAE,GAAG,EAElB;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;;;;;;;;;;OAUG;IAEH,OAAO,CAAC,IAAI,CAAC,EAAE,GAAG,GAAG,IAAI;IAczB,QAAQ,IAAI,GAAG;CAOf;AAED,OAAO,EAAE,eAAe,EAAE,CAAC"}
|
|
@@ -1,39 +1,21 @@
|
|
|
1
1
|
import { SuccessResponse } from "./_successResponse";
|
|
2
|
-
type InitProps = ResponseInit & {
|
|
3
|
-
message?: string;
|
|
4
|
-
};
|
|
5
2
|
/**
|
|
6
|
-
*
|
|
7
|
-
* This class is used to standardize the structure of a "Created" response,
|
|
8
|
-
* including the response body, headers, status, and status text.
|
|
3
|
+
* HTTP 201 Created — the request succeeded and a new resource was created.
|
|
9
4
|
*
|
|
10
|
-
* @
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* return new Created("User created successfully", { id: user.id }).toJson();
|
|
8
|
+
* ```
|
|
11
9
|
*/
|
|
12
|
-
declare class Created
|
|
13
|
-
body: T;
|
|
14
|
-
headers: ResponseInit["headers"];
|
|
15
|
-
status: number;
|
|
16
|
-
statusText: string;
|
|
10
|
+
declare class Created extends SuccessResponse {
|
|
17
11
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* @param body - The response body to be included in the HTTP response.
|
|
21
|
-
* @param init - Optional initialization object for customizing headers, status, and status text.
|
|
22
|
-
*/
|
|
23
|
-
constructor(body: T, init?: InitProps);
|
|
24
|
-
/**
|
|
25
|
-
* Converts the `Created` instance into a `Response` object with a JSON body.
|
|
26
|
-
* This method ensures the response has the appropriate headers, status, and status text.
|
|
27
|
-
*
|
|
28
|
-
* @returns A `Response` object with the serialized JSON body and response metadata.
|
|
12
|
+
* @param message - Description included in the response status text.
|
|
13
|
+
* @param body - Data to include in the response body.
|
|
29
14
|
*/
|
|
15
|
+
constructor(message: string, body?: any);
|
|
16
|
+
/** Converts to a `Response` with `Content-Type: application/json` header. */
|
|
30
17
|
toResponse(): Response;
|
|
31
|
-
/**
|
|
32
|
-
* Converts the `Created` instance into a `Response` object using the `Response.json` method.
|
|
33
|
-
* This method is an alternative to `toResponse` for generating JSON responses.
|
|
34
|
-
*
|
|
35
|
-
* @returns A `Response` object with the JSON body and response metadata.
|
|
36
|
-
*/
|
|
18
|
+
/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */
|
|
37
19
|
toJson(): Response;
|
|
38
20
|
}
|
|
39
21
|
export { Created };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"created.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/created.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD
|
|
1
|
+
{"version":3,"file":"created.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/created.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;;GAOG;AACH,cAAM,OAAQ,SAAQ,eAAe;IACpC;;;OAGG;gBAES,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG;IAWvC,6EAA6E;IAC7E,UAAU,IAAI,QAAQ;IAUtB,uFAAuF;IACvF,MAAM,IAAI,QAAQ;CAQlB;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -1,42 +1,21 @@
|
|
|
1
1
|
import { SuccessResponse } from "./_successResponse";
|
|
2
|
-
type InitProps = ResponseInit & {
|
|
3
|
-
message?: string;
|
|
4
|
-
};
|
|
5
2
|
/**
|
|
6
|
-
*
|
|
7
|
-
* This class is used to create a standardized HTTP response with a status of 302 (Found),
|
|
8
|
-
* including optional headers and a response body.
|
|
3
|
+
* HTTP 302 Found — the resource was located and the response includes it in the body.
|
|
9
4
|
*
|
|
10
|
-
* @
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* return new Found("Products retrieved", { products }).toJson();
|
|
8
|
+
* ```
|
|
11
9
|
*/
|
|
12
|
-
declare class Found
|
|
13
|
-
body: T;
|
|
14
|
-
headers: ResponseInit["headers"];
|
|
15
|
-
status: number;
|
|
16
|
-
statusText: string;
|
|
10
|
+
declare class Found extends SuccessResponse {
|
|
17
11
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* @param body - The body of the response.
|
|
21
|
-
* @param init - Optional initialization object to set headers, status, and statusText.
|
|
22
|
-
* - `headers`: Additional headers to include in the response.
|
|
23
|
-
* - `status`: HTTP status code (default is 302).
|
|
24
|
-
* - `statusText`: HTTP status text (default is "Found").
|
|
25
|
-
*/
|
|
26
|
-
constructor(body: T, init?: InitProps);
|
|
27
|
-
/**
|
|
28
|
-
* Converts the `Found` instance into a `Response` object.
|
|
29
|
-
* This method serializes the response body as JSON and includes the appropriate headers.
|
|
30
|
-
*
|
|
31
|
-
* @returns A `Response` object with the serialized JSON body and the specified headers, status, and statusText.
|
|
12
|
+
* @param message - Description included in the response status text.
|
|
13
|
+
* @param body - Data to include in the response body.
|
|
32
14
|
*/
|
|
15
|
+
constructor(message: string, body?: any);
|
|
16
|
+
/** Converts to a `Response` with `Content-Type: application/json` header. */
|
|
33
17
|
toResponse(): Response;
|
|
34
|
-
/**
|
|
35
|
-
* Converts the `Found` instance into a JSON response using `Response.json`.
|
|
36
|
-
* This method is an alternative to `toResponse` for creating JSON responses.
|
|
37
|
-
*
|
|
38
|
-
* @returns A `Response` object with the JSON body and the specified headers, status, and statusText.
|
|
39
|
-
*/
|
|
18
|
+
/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */
|
|
40
19
|
toJson(): Response;
|
|
41
20
|
}
|
|
42
21
|
export { Found };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"found.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/found.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD
|
|
1
|
+
{"version":3,"file":"found.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/found.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;;GAOG;AACH,cAAM,KAAM,SAAQ,eAAe;IAClC;;;OAGG;gBAES,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG;IAWvC,6EAA6E;IAC7E,UAAU,IAAI,QAAQ;IAUtB,uFAAuF;IACvF,MAAM,IAAI,QAAQ;CAQlB;AAED,OAAO,EAAE,KAAK,EAAE,CAAC"}
|
|
@@ -1,25 +1,19 @@
|
|
|
1
1
|
import { SuccessResponse } from "./_successResponse";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
3
|
+
* HTTP 204 No Content — the request succeeded but there is no content to return.
|
|
4
|
+
* Typically used for delete or update operations where a body is not needed.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* return new NoContent("Record deleted").toResponse();
|
|
9
|
+
* ```
|
|
6
10
|
*/
|
|
7
11
|
declare class NoContent extends SuccessResponse {
|
|
8
|
-
headers: ResponseInit["headers"];
|
|
9
|
-
status: number;
|
|
10
|
-
statusText: string;
|
|
11
12
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
* @param init - Optional initialization object for customizing headers, status, and status text.
|
|
15
|
-
*/
|
|
16
|
-
constructor(init?: ResponseInit);
|
|
17
|
-
/**
|
|
18
|
-
* Converts the `NoContent` instance into a `Response` object.
|
|
19
|
-
* This method ensures the response has the appropriate headers, status, and status text.
|
|
20
|
-
*
|
|
21
|
-
* @returns A `Response` object with no body and response metadata.
|
|
13
|
+
* @param message - Description included in the response status text.
|
|
22
14
|
*/
|
|
15
|
+
constructor(message: string);
|
|
16
|
+
/** Converts to a `Response` with `Content-Type: application/json` header and no body. */
|
|
23
17
|
toResponse(): Response;
|
|
24
18
|
}
|
|
25
19
|
export { NoContent };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noContent.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/noContent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD
|
|
1
|
+
{"version":3,"file":"noContent.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/noContent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;;;GAQG;AACH,cAAM,SAAU,SAAQ,eAAe;IACtC;;OAEG;gBACS,OAAO,EAAE,MAAM;IAU3B,yFAAyF;IACzF,UAAU,IAAI,QAAQ;CAStB;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -1,39 +1,21 @@
|
|
|
1
1
|
import { SuccessResponse } from "./_successResponse";
|
|
2
|
-
type InitProps = ResponseInit & {
|
|
3
|
-
message?: string;
|
|
4
|
-
};
|
|
5
2
|
/**
|
|
6
|
-
*
|
|
7
|
-
* This class is used to standardize the structure of a "Success" response,
|
|
8
|
-
* including the response body, headers, status, and status text.
|
|
3
|
+
* HTTP 200 OK — the request succeeded and the response body contains the result.
|
|
9
4
|
*
|
|
10
|
-
* @
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* return new Success("Order fetched", { order }).toJson();
|
|
8
|
+
* ```
|
|
11
9
|
*/
|
|
12
|
-
declare class Success
|
|
13
|
-
body: T;
|
|
14
|
-
headers: ResponseInit["headers"];
|
|
15
|
-
status: number;
|
|
16
|
-
statusText: string;
|
|
10
|
+
declare class Success extends SuccessResponse {
|
|
17
11
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* @param body - The response body to be included in the HTTP response.
|
|
21
|
-
* @param init - Optional initialization object for customizing headers, status, and status text.
|
|
22
|
-
*/
|
|
23
|
-
constructor(body: T, init?: InitProps);
|
|
24
|
-
/**
|
|
25
|
-
* Converts the `Success` instance into a `Response` object with a JSON body.
|
|
26
|
-
* This method ensures the response has the appropriate headers, status, and status text.
|
|
27
|
-
*
|
|
28
|
-
* @returns A `Response` object with the serialized JSON body and response metadata.
|
|
12
|
+
* @param message - Description included in the response status text.
|
|
13
|
+
* @param body - Data to include in the response body.
|
|
29
14
|
*/
|
|
15
|
+
constructor(message: string, body?: any);
|
|
16
|
+
/** Converts to a `Response` with `Content-Type: application/json` header. */
|
|
30
17
|
toResponse(): Response;
|
|
31
|
-
/**
|
|
32
|
-
* Converts the `Success` instance into a `Response` object using the `Response.json` method.
|
|
33
|
-
* This method is an alternative to `toResponse` for generating JSON responses.
|
|
34
|
-
*
|
|
35
|
-
* @returns A `Response` object with the JSON body and response metadata.
|
|
36
|
-
*/
|
|
18
|
+
/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */
|
|
37
19
|
toJson(): Response;
|
|
38
20
|
}
|
|
39
21
|
export { Success };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"success.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/success.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD
|
|
1
|
+
{"version":3,"file":"success.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/success.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;;GAOG;AACH,cAAM,OAAQ,SAAQ,eAAe;IACpC;;;OAGG;gBAES,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG;IAWvC,6EAA6E;IAC7E,UAAU,IAAI,QAAQ;IAUtB,uFAAuF;IACvF,MAAM,IAAI,QAAQ;CAQlB;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
|
@@ -1,39 +1,22 @@
|
|
|
1
1
|
import { SuccessResponse } from "./_successResponse";
|
|
2
|
-
type InitProps = ResponseInit & {
|
|
3
|
-
message?: string;
|
|
4
|
-
};
|
|
5
2
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* including the response body, headers, status, and status text.
|
|
3
|
+
* HTTP 200 OK — the request succeeded and the resource was updated.
|
|
4
|
+
* Semantically equivalent to `Success` but signals an update operation to consumers.
|
|
9
5
|
*
|
|
10
|
-
* @
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* return new Updated("Profile updated", { user }).toJson();
|
|
9
|
+
* ```
|
|
11
10
|
*/
|
|
12
|
-
declare class Updated
|
|
13
|
-
body: T;
|
|
14
|
-
headers: ResponseInit["headers"];
|
|
15
|
-
status: number;
|
|
16
|
-
statusText: string;
|
|
11
|
+
declare class Updated extends SuccessResponse {
|
|
17
12
|
/**
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* @param body - The response body to be included in the HTTP response.
|
|
21
|
-
* @param init - Optional initialization object for customizing headers, status, and status text.
|
|
22
|
-
*/
|
|
23
|
-
constructor(body: T, init?: InitProps);
|
|
24
|
-
/**
|
|
25
|
-
* Converts the `Updated` instance into a `Response` object with a JSON body.
|
|
26
|
-
* This method ensures the response has the appropriate headers, status, and status text.
|
|
27
|
-
*
|
|
28
|
-
* @returns A `Response` object with the serialized JSON body and response metadata.
|
|
13
|
+
* @param message - Description included in the response status text.
|
|
14
|
+
* @param body - Data to include in the response body.
|
|
29
15
|
*/
|
|
16
|
+
constructor(message: string, body?: any);
|
|
17
|
+
/** Converts to a `Response` with `Content-Type: application/json` header. */
|
|
30
18
|
toResponse(): Response;
|
|
31
|
-
/**
|
|
32
|
-
* Converts the `Updated` instance into a `Response` object using the `Response.json` method.
|
|
33
|
-
* This method is an alternative to `toResponse` for generating JSON responses.
|
|
34
|
-
*
|
|
35
|
-
* @returns A `Response` object with the JSON body and response metadata.
|
|
36
|
-
*/
|
|
19
|
+
/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */
|
|
37
20
|
toJson(): Response;
|
|
38
21
|
}
|
|
39
22
|
export { Updated };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"updated.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/updated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD
|
|
1
|
+
{"version":3,"file":"updated.d.ts","sourceRoot":"","sources":["../../../src/http/successResponses/updated.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAErD;;;;;;;;GAQG;AACH,cAAM,OAAQ,SAAQ,eAAe;IACpC;;;OAGG;gBAES,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG;IAWvC,6EAA6E;IAC7E,UAAU,IAAI,QAAQ;IAUtB,uFAAuF;IACvF,MAAM,IAAI,QAAQ;CAQlB;AAED,OAAO,EAAE,OAAO,EAAE,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -13,17 +13,16 @@ export { NoContent } from "./http/successResponses/noContent";
|
|
|
13
13
|
export { Success } from "./http/successResponses/success";
|
|
14
14
|
export { Updated } from "./http/successResponses/updated";
|
|
15
15
|
export { ApiService } from "./services/apiService";
|
|
16
|
-
export { ArkynLogService } from "./services/arkynLogService";
|
|
17
16
|
export { DebugService } from "./services/debugService";
|
|
18
|
-
export {
|
|
19
|
-
export { decodeRequestBody } from "./
|
|
20
|
-
export {
|
|
21
|
-
export {
|
|
22
|
-
export {
|
|
23
|
-
export {
|
|
24
|
-
export {
|
|
25
|
-
export { getScopedParams } from "./
|
|
26
|
-
export { SchemaValidator } from "./
|
|
17
|
+
export { LogService } from "./services/logService";
|
|
18
|
+
export { decodeRequestBody } from "./utilities/decodeRequestBody";
|
|
19
|
+
export { decodeRequestErrorMessage } from "./utilities/decodeRequestErrorMessage";
|
|
20
|
+
export { errorHandler } from "./utilities/errorHandler";
|
|
21
|
+
export { flushDebugLogs } from "./utilities/flushDebugLogs";
|
|
22
|
+
export { formAsyncParse } from "./utilities/formAsyncParse";
|
|
23
|
+
export { formParse } from "./utilities/formParse";
|
|
24
|
+
export { getScopedParams } from "./utilities/getScopedParams";
|
|
25
|
+
export { SchemaValidator } from "./utilities/schemaValidator";
|
|
27
26
|
export { validateCep } from "./validations/validateCep";
|
|
28
27
|
export { validateCnpj } from "./validations/validateCnpj";
|
|
29
28
|
export { validateCpf } from "./validations/validateCpf";
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC1D,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EAAE,WAAW,EAAE,MAAM,iCAAiC,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAC9E,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAC1D,OAAO,EAAE,KAAK,EAAE,MAAM,+BAA+B,CAAC;AACtD,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAC1D,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAG1D,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAGnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAClE,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AAClF,OAAO,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AACxD,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAC;AAG9D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,gBAAgB,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC"}
|