@arkyn/server 3.0.1-beta.142 → 3.0.1-beta.144
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 +90 -323
- package/dist/http/badResponses/badGateway.d.ts +12 -19
- package/dist/http/badResponses/badGateway.d.ts.map +1 -1
- package/dist/http/badResponses/badGateway.js +12 -19
- package/dist/http/badResponses/badRequest.d.ts +10 -19
- package/dist/http/badResponses/badRequest.d.ts.map +1 -1
- package/dist/http/badResponses/badRequest.js +10 -19
- package/dist/http/badResponses/conflict.d.ts +10 -19
- package/dist/http/badResponses/conflict.d.ts.map +1 -1
- package/dist/http/badResponses/conflict.js +10 -19
- package/dist/http/badResponses/forbidden.d.ts +10 -19
- package/dist/http/badResponses/forbidden.d.ts.map +1 -1
- package/dist/http/badResponses/forbidden.js +10 -19
- package/dist/http/badResponses/notFound.d.ts +10 -19
- package/dist/http/badResponses/notFound.d.ts.map +1 -1
- package/dist/http/badResponses/notFound.js +10 -19
- package/dist/http/badResponses/notImplemented.d.ts +10 -19
- package/dist/http/badResponses/notImplemented.d.ts.map +1 -1
- package/dist/http/badResponses/notImplemented.js +10 -19
- package/dist/http/badResponses/serverError.d.ts +10 -19
- package/dist/http/badResponses/serverError.d.ts.map +1 -1
- package/dist/http/badResponses/serverError.js +10 -19
- package/dist/http/badResponses/unauthorized.d.ts +10 -19
- package/dist/http/badResponses/unauthorized.d.ts.map +1 -1
- package/dist/http/badResponses/unauthorized.js +10 -19
- package/dist/http/badResponses/unprocessableEntity.d.ts +17 -22
- package/dist/http/badResponses/unprocessableEntity.d.ts.map +1 -1
- package/dist/http/badResponses/unprocessableEntity.js +17 -22
- package/dist/http/successResponses/created.d.ts +10 -14
- package/dist/http/successResponses/created.d.ts.map +1 -1
- package/dist/http/successResponses/created.js +10 -14
- package/dist/http/successResponses/found.d.ts +10 -14
- package/dist/http/successResponses/found.d.ts.map +1 -1
- package/dist/http/successResponses/found.js +10 -14
- package/dist/http/successResponses/noContent.d.ts +9 -7
- package/dist/http/successResponses/noContent.d.ts.map +1 -1
- package/dist/http/successResponses/noContent.js +9 -7
- package/dist/http/successResponses/success.d.ts +10 -14
- package/dist/http/successResponses/success.d.ts.map +1 -1
- package/dist/http/successResponses/success.js +10 -14
- package/dist/http/successResponses/updated.d.ts +11 -14
- package/dist/http/successResponses/updated.d.ts.map +1 -1
- package/dist/http/successResponses/updated.js +11 -14
- package/dist/services/apiService.d.ts +20 -0
- package/dist/services/apiService.d.ts.map +1 -1
- package/dist/services/apiService.js +16 -0
- package/dist/services/debugService.d.ts +10 -42
- package/dist/services/debugService.d.ts.map +1 -1
- package/dist/services/debugService.js +10 -42
- package/dist/services/logService.d.ts +5 -10
- package/dist/services/logService.d.ts.map +1 -1
- package/dist/services/logService.js +5 -10
- package/dist/utilities/decodeRequestBody.d.ts +11 -9
- package/dist/utilities/decodeRequestBody.d.ts.map +1 -1
- package/dist/utilities/decodeRequestBody.js +11 -9
- package/dist/utilities/decodeRequestErrorMessage.d.ts +12 -10
- package/dist/utilities/decodeRequestErrorMessage.d.ts.map +1 -1
- package/dist/utilities/decodeRequestErrorMessage.js +12 -10
- package/dist/utilities/errorHandler.d.ts +13 -38
- package/dist/utilities/errorHandler.d.ts.map +1 -1
- package/dist/utilities/errorHandler.js +13 -38
- package/dist/utilities/flushDebugLogs.d.ts +6 -28
- package/dist/utilities/flushDebugLogs.d.ts.map +1 -1
- package/dist/utilities/flushDebugLogs.js +6 -28
- package/dist/utilities/formAsyncParse.d.ts +7 -28
- package/dist/utilities/formAsyncParse.d.ts.map +1 -1
- package/dist/utilities/formAsyncParse.js +7 -28
- package/dist/utilities/formParse.d.ts +7 -28
- package/dist/utilities/formParse.d.ts.map +1 -1
- package/dist/utilities/formParse.js +7 -28
- package/dist/utilities/getScopedParams.d.ts +11 -19
- package/dist/utilities/getScopedParams.d.ts.map +1 -1
- package/dist/utilities/getScopedParams.js +11 -19
- package/dist/utilities/schemaValidator.d.ts +31 -102
- package/dist/utilities/schemaValidator.d.ts.map +1 -1
- package/dist/utilities/schemaValidator.js +31 -102
- package/dist/validations/validateCep.d.ts +2 -2
- package/dist/validations/validateCep.js +2 -2
- package/dist/validations/validateCnpj.d.ts +2 -2
- package/dist/validations/validateCnpj.js +2 -2
- package/dist/validations/validateCpf.d.ts +4 -11
- package/dist/validations/validateCpf.d.ts.map +1 -1
- package/dist/validations/validateCpf.js +4 -11
- package/dist/validations/validateDate.d.ts +7 -11
- package/dist/validations/validateDate.d.ts.map +1 -1
- package/dist/validations/validateDate.js +7 -11
- package/dist/validations/validateEmail.d.ts +2 -2
- package/dist/validations/validateEmail.js +2 -2
- package/dist/validations/validatePassword.d.ts +2 -2
- package/dist/validations/validatePassword.js +2 -2
- package/dist/validations/validatePhone.d.ts +6 -18
- package/dist/validations/validatePhone.d.ts.map +1 -1
- package/dist/validations/validatePhone.js +6 -18
- package/dist/validations/validateRg.d.ts +2 -2
- package/dist/validations/validateRg.js +2 -2
- package/package.json +1 -1
|
@@ -1,30 +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
13
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* @param {string} message - A descriptive message explaining the cause of the error.
|
|
12
|
-
* @param {any} 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).
|
|
13
16
|
*/
|
|
14
17
|
constructor(message: string, cause?: any);
|
|
15
|
-
/**
|
|
16
|
-
* Converts the `BadGateway` instance into a `Response` object with a JSON body.
|
|
17
|
-
* This method ensures the response has the appropriate headers, status, and status text.
|
|
18
|
-
*
|
|
19
|
-
* @returns {Response} A `Response` object with the serialized JSON body and response metadata.
|
|
20
|
-
*/
|
|
18
|
+
/** Converts to a `Response` with `Content-Type: application/json` header. */
|
|
21
19
|
toResponse(): Response;
|
|
22
|
-
/**
|
|
23
|
-
* Converts the `BadGateway` instance into a `Response` object using the `Response.json` method.
|
|
24
|
-
* This method is an alternative to `toResponse` for generating JSON error responses.
|
|
25
|
-
*
|
|
26
|
-
* @returns {Response["json"]} A `Response` object with the JSON body and response metadata.
|
|
27
|
-
*/
|
|
20
|
+
/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */
|
|
28
21
|
toJson(): Response;
|
|
29
22
|
}
|
|
30
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;IAClC;;;OAGG;gBACS,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;IAWxC,6EAA6E;IAC7E,UAAU,IAAI,QAAQ;IAUtB,uFAAuF;IACvF,MAAM,IAAI,QAAQ;CAQnB;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -1,15 +1,18 @@
|
|
|
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
|
class BadGateway extends BadResponse {
|
|
8
13
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* @param {string} message - A descriptive message explaining the cause of the error.
|
|
12
|
-
* @param {any} 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).
|
|
13
16
|
*/
|
|
14
17
|
constructor(message, cause) {
|
|
15
18
|
super();
|
|
@@ -19,12 +22,7 @@ class BadGateway extends BadResponse {
|
|
|
19
22
|
this.cause = cause ? JSON.stringify(cause) : undefined;
|
|
20
23
|
this.onDebug();
|
|
21
24
|
}
|
|
22
|
-
/**
|
|
23
|
-
* Converts the `BadGateway` instance into a `Response` object with a JSON body.
|
|
24
|
-
* This method ensures the response has the appropriate headers, status, and status text.
|
|
25
|
-
*
|
|
26
|
-
* @returns {Response} A `Response` object with the serialized JSON body and response metadata.
|
|
27
|
-
*/
|
|
25
|
+
/** Converts to a `Response` with `Content-Type: application/json` header. */
|
|
28
26
|
toResponse() {
|
|
29
27
|
const responseInit = {
|
|
30
28
|
headers: { "Content-Type": "application/json" },
|
|
@@ -33,12 +31,7 @@ class BadGateway extends BadResponse {
|
|
|
33
31
|
};
|
|
34
32
|
return new Response(JSON.stringify(this.makeBody()), responseInit);
|
|
35
33
|
}
|
|
36
|
-
/**
|
|
37
|
-
* Converts the `BadGateway` instance into a `Response` object using the `Response.json` method.
|
|
38
|
-
* This method is an alternative to `toResponse` for generating JSON error responses.
|
|
39
|
-
*
|
|
40
|
-
* @returns {Response["json"]} A `Response` object with the JSON body and response metadata.
|
|
41
|
-
*/
|
|
34
|
+
/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */
|
|
42
35
|
toJson() {
|
|
43
36
|
const responseInit = {
|
|
44
37
|
status: this.status,
|
|
@@ -1,30 +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
11
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* @param {string} message - A descriptive message explaining the cause of the error.
|
|
12
|
-
* @param {any} cause - Optional additional information about the cause of the error.
|
|
12
|
+
* @param message - Error description.
|
|
13
|
+
* @param cause - Optional extra context (serialized to JSON).
|
|
13
14
|
*/
|
|
14
15
|
constructor(message: string, cause?: any);
|
|
15
|
-
/**
|
|
16
|
-
* Converts the `BadRequest` instance into a `Response` object with a JSON body.
|
|
17
|
-
* This method ensures the response has the appropriate headers, status, and status text.
|
|
18
|
-
*
|
|
19
|
-
* @returns {Response} A `Response` object with the serialized JSON body and response metadata.
|
|
20
|
-
*/
|
|
16
|
+
/** Converts to a `Response` with `Content-Type: application/json` header. */
|
|
21
17
|
toResponse(): Response;
|
|
22
|
-
/**
|
|
23
|
-
* Converts the `BadRequest` instance into a `Response` object using the `Response.json` method.
|
|
24
|
-
* This method is an alternative to `toResponse` for generating JSON error responses.
|
|
25
|
-
*
|
|
26
|
-
* @returns {Response["json"]} A `Response` object with the JSON body and response metadata.
|
|
27
|
-
*/
|
|
18
|
+
/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */
|
|
28
19
|
toJson(): Response;
|
|
29
20
|
}
|
|
30
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;IAClC;;;OAGG;gBACS,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;IAWxC,6EAA6E;IAC7E,UAAU,IAAI,QAAQ;IAUtB,uFAAuF;IACvF,MAAM,IAAI,QAAQ;CAQnB;AAED,OAAO,EAAE,UAAU,EAAE,CAAC"}
|
|
@@ -1,15 +1,16 @@
|
|
|
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
|
class BadRequest extends BadResponse {
|
|
8
11
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* @param {string} message - A descriptive message explaining the cause of the error.
|
|
12
|
-
* @param {any} cause - Optional additional information about the cause of the error.
|
|
12
|
+
* @param message - Error description.
|
|
13
|
+
* @param cause - Optional extra context (serialized to JSON).
|
|
13
14
|
*/
|
|
14
15
|
constructor(message, cause) {
|
|
15
16
|
super();
|
|
@@ -19,12 +20,7 @@ class BadRequest extends BadResponse {
|
|
|
19
20
|
this.cause = cause ? JSON.stringify(cause) : undefined;
|
|
20
21
|
this.onDebug();
|
|
21
22
|
}
|
|
22
|
-
/**
|
|
23
|
-
* Converts the `BadRequest` instance into a `Response` object with a JSON body.
|
|
24
|
-
* This method ensures the response has the appropriate headers, status, and status text.
|
|
25
|
-
*
|
|
26
|
-
* @returns {Response} A `Response` object with the serialized JSON body and response metadata.
|
|
27
|
-
*/
|
|
23
|
+
/** Converts to a `Response` with `Content-Type: application/json` header. */
|
|
28
24
|
toResponse() {
|
|
29
25
|
const responseInit = {
|
|
30
26
|
headers: { "Content-Type": "application/json" },
|
|
@@ -33,12 +29,7 @@ class BadRequest extends BadResponse {
|
|
|
33
29
|
};
|
|
34
30
|
return new Response(JSON.stringify(this.makeBody()), responseInit);
|
|
35
31
|
}
|
|
36
|
-
/**
|
|
37
|
-
* Converts the `BadRequest` instance into a `Response` object using the `Response.json` method.
|
|
38
|
-
* This method is an alternative to `toResponse` for generating JSON error responses.
|
|
39
|
-
*
|
|
40
|
-
* @returns {Response["json"]} A `Response` object with the JSON body and response metadata.
|
|
41
|
-
*/
|
|
32
|
+
/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */
|
|
42
33
|
toJson() {
|
|
43
34
|
const responseInit = {
|
|
44
35
|
status: this.status,
|
|
@@ -1,30 +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
11
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* @param {string} message - A descriptive message explaining the cause of the conflict.
|
|
12
|
-
* @param {any} cause - Optional additional information about the cause of the conflict.
|
|
12
|
+
* @param message - Error description.
|
|
13
|
+
* @param cause - Optional extra context (serialized to JSON).
|
|
13
14
|
*/
|
|
14
15
|
constructor(message: string, cause?: any);
|
|
15
|
-
/**
|
|
16
|
-
* Converts the `Conflict` instance into a `Response` object with a JSON body.
|
|
17
|
-
* This method ensures the response has the appropriate headers, status, and status text.
|
|
18
|
-
*
|
|
19
|
-
* @returns {Response} A `Response` object with the serialized JSON body and response metadata.
|
|
20
|
-
*/
|
|
16
|
+
/** Converts to a `Response` with `Content-Type: application/json` header. */
|
|
21
17
|
toResponse(): Response;
|
|
22
|
-
/**
|
|
23
|
-
* Converts the `Conflict` instance into a `Response` object using the `Response.json` method.
|
|
24
|
-
* This method is an alternative to `toResponse` for generating JSON error responses.
|
|
25
|
-
*
|
|
26
|
-
* @returns {Response["json"]} A `Response` object with the JSON body and response metadata.
|
|
27
|
-
*/
|
|
18
|
+
/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */
|
|
28
19
|
toJson(): Response;
|
|
29
20
|
}
|
|
30
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;IAChC;;;OAGG;gBACS,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;IAYxC,6EAA6E;IAC7E,UAAU,IAAI,QAAQ;IAUtB,uFAAuF;IACvF,MAAM,IAAI,QAAQ;CAQnB;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -1,15 +1,16 @@
|
|
|
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
|
class Conflict extends BadResponse {
|
|
8
11
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* @param {string} message - A descriptive message explaining the cause of the conflict.
|
|
12
|
-
* @param {any} cause - Optional additional information about the cause of the conflict.
|
|
12
|
+
* @param message - Error description.
|
|
13
|
+
* @param cause - Optional extra context (serialized to JSON).
|
|
13
14
|
*/
|
|
14
15
|
constructor(message, cause) {
|
|
15
16
|
super();
|
|
@@ -20,12 +21,7 @@ class Conflict extends BadResponse {
|
|
|
20
21
|
this.cause = cause ? JSON.stringify(cause) : undefined;
|
|
21
22
|
this.onDebug();
|
|
22
23
|
}
|
|
23
|
-
/**
|
|
24
|
-
* Converts the `Conflict` instance into a `Response` object with a JSON body.
|
|
25
|
-
* This method ensures the response has the appropriate headers, status, and status text.
|
|
26
|
-
*
|
|
27
|
-
* @returns {Response} A `Response` object with the serialized JSON body and response metadata.
|
|
28
|
-
*/
|
|
24
|
+
/** Converts to a `Response` with `Content-Type: application/json` header. */
|
|
29
25
|
toResponse() {
|
|
30
26
|
const responseInit = {
|
|
31
27
|
headers: { "Content-Type": "application/json" },
|
|
@@ -34,12 +30,7 @@ class Conflict extends BadResponse {
|
|
|
34
30
|
};
|
|
35
31
|
return new Response(JSON.stringify(this.makeBody()), responseInit);
|
|
36
32
|
}
|
|
37
|
-
/**
|
|
38
|
-
* Converts the `Conflict` instance into a `Response` object using the `Response.json` method.
|
|
39
|
-
* This method is an alternative to `toResponse` for generating JSON error responses.
|
|
40
|
-
*
|
|
41
|
-
* @returns {Response["json"]} A `Response` object with the JSON body and response metadata.
|
|
42
|
-
*/
|
|
33
|
+
/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */
|
|
43
34
|
toJson() {
|
|
44
35
|
const responseInit = {
|
|
45
36
|
status: this.status,
|
|
@@ -1,30 +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
11
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* @param {string} message - A descriptive message explaining why access is forbidden.
|
|
12
|
-
* @param {any} cause - Optional additional information about the cause of the error.
|
|
12
|
+
* @param message - Error description.
|
|
13
|
+
* @param cause - Optional extra context (serialized to JSON).
|
|
13
14
|
*/
|
|
14
15
|
constructor(message: string, cause?: any);
|
|
15
|
-
/**
|
|
16
|
-
* Converts the `Forbidden` instance into a `Response` object with a JSON body.
|
|
17
|
-
* This method ensures the response has the appropriate headers, status, and status text.
|
|
18
|
-
*
|
|
19
|
-
* @returns {Response} A `Response` object with the serialized JSON body and response metadata.
|
|
20
|
-
*/
|
|
16
|
+
/** Converts to a `Response` with `Content-Type: application/json` header. */
|
|
21
17
|
toResponse(): Response;
|
|
22
|
-
/**
|
|
23
|
-
* Converts the `Forbidden` instance into a `Response` object using the `Response.json` method.
|
|
24
|
-
* This method is an alternative to `toResponse` for generating JSON error responses.
|
|
25
|
-
*
|
|
26
|
-
* @returns {Response["json"]} A `Response` object with the JSON body and response metadata.
|
|
27
|
-
*/
|
|
18
|
+
/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */
|
|
28
19
|
toJson(): Response;
|
|
29
20
|
}
|
|
30
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;IACjC;;;OAGG;gBACS,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;IAWxC,6EAA6E;IAC7E,UAAU,IAAI,QAAQ;IAUtB,uFAAuF;IACvF,MAAM,IAAI,QAAQ;CAQnB;AAED,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -1,15 +1,16 @@
|
|
|
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
|
class Forbidden extends BadResponse {
|
|
8
11
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* @param {string} message - A descriptive message explaining why access is forbidden.
|
|
12
|
-
* @param {any} cause - Optional additional information about the cause of the error.
|
|
12
|
+
* @param message - Error description.
|
|
13
|
+
* @param cause - Optional extra context (serialized to JSON).
|
|
13
14
|
*/
|
|
14
15
|
constructor(message, cause) {
|
|
15
16
|
super();
|
|
@@ -19,12 +20,7 @@ class Forbidden extends BadResponse {
|
|
|
19
20
|
this.cause = cause ? JSON.stringify(cause) : undefined;
|
|
20
21
|
this.onDebug();
|
|
21
22
|
}
|
|
22
|
-
/**
|
|
23
|
-
* Converts the `Forbidden` instance into a `Response` object with a JSON body.
|
|
24
|
-
* This method ensures the response has the appropriate headers, status, and status text.
|
|
25
|
-
*
|
|
26
|
-
* @returns {Response} A `Response` object with the serialized JSON body and response metadata.
|
|
27
|
-
*/
|
|
23
|
+
/** Converts to a `Response` with `Content-Type: application/json` header. */
|
|
28
24
|
toResponse() {
|
|
29
25
|
const responseInit = {
|
|
30
26
|
headers: { "Content-Type": "application/json" },
|
|
@@ -33,12 +29,7 @@ class Forbidden extends BadResponse {
|
|
|
33
29
|
};
|
|
34
30
|
return new Response(JSON.stringify(this.makeBody()), responseInit);
|
|
35
31
|
}
|
|
36
|
-
/**
|
|
37
|
-
* Converts the `Forbidden` instance into a `Response` object using the `Response.json` method.
|
|
38
|
-
* This method is an alternative to `toResponse` for generating JSON error responses.
|
|
39
|
-
*
|
|
40
|
-
* @returns {Response["json"]} A `Response` object with the JSON body and response metadata.
|
|
41
|
-
*/
|
|
32
|
+
/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */
|
|
42
33
|
toJson() {
|
|
43
34
|
const responseInit = {
|
|
44
35
|
status: this.status,
|
|
@@ -1,30 +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
11
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* @param {string} message - A descriptive message explaining the reason the resource was not found.
|
|
12
|
-
* @param {any} cause - Optional additional information about the cause of the error.
|
|
12
|
+
* @param message - Error description.
|
|
13
|
+
* @param cause - Optional extra context (serialized to JSON).
|
|
13
14
|
*/
|
|
14
15
|
constructor(message: string, cause?: any);
|
|
15
|
-
/**
|
|
16
|
-
* Converts the `NotFound` instance into a `Response` object with a JSON body.
|
|
17
|
-
* This method ensures the response has the appropriate headers, status, and status text.
|
|
18
|
-
*
|
|
19
|
-
* @returns {Response} A `Response` object with the serialized JSON body and response metadata.
|
|
20
|
-
*/
|
|
16
|
+
/** Converts to a `Response` with `Content-Type: application/json` header. */
|
|
21
17
|
toResponse(): Response;
|
|
22
|
-
/**
|
|
23
|
-
* Converts the `NotFound` instance into a `Response` object using the `Response.json` method.
|
|
24
|
-
* This method is an alternative to `toResponse` for generating JSON error responses.
|
|
25
|
-
*
|
|
26
|
-
* @returns {Response["json"]} A `Response` object with the JSON body and response metadata.
|
|
27
|
-
*/
|
|
18
|
+
/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */
|
|
28
19
|
toJson(): Response;
|
|
29
20
|
}
|
|
30
21
|
export { NotFound };
|
|
@@ -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;IAChC;;;OAGG;gBACS,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;IAWxC,6EAA6E;IAC7E,UAAU,IAAI,QAAQ;IAUtB,uFAAuF;IACvF,MAAM,IAAI,QAAQ;CAQnB;AAED,OAAO,EAAE,QAAQ,EAAE,CAAC"}
|
|
@@ -1,15 +1,16 @@
|
|
|
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
|
class NotFound extends BadResponse {
|
|
8
11
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* @param {string} message - A descriptive message explaining the reason the resource was not found.
|
|
12
|
-
* @param {any} cause - Optional additional information about the cause of the error.
|
|
12
|
+
* @param message - Error description.
|
|
13
|
+
* @param cause - Optional extra context (serialized to JSON).
|
|
13
14
|
*/
|
|
14
15
|
constructor(message, cause) {
|
|
15
16
|
super();
|
|
@@ -19,12 +20,7 @@ class NotFound extends BadResponse {
|
|
|
19
20
|
this.cause = cause ? JSON.stringify(cause) : undefined;
|
|
20
21
|
this.onDebug();
|
|
21
22
|
}
|
|
22
|
-
/**
|
|
23
|
-
* Converts the `NotFound` instance into a `Response` object with a JSON body.
|
|
24
|
-
* This method ensures the response has the appropriate headers, status, and status text.
|
|
25
|
-
*
|
|
26
|
-
* @returns {Response} A `Response` object with the serialized JSON body and response metadata.
|
|
27
|
-
*/
|
|
23
|
+
/** Converts to a `Response` with `Content-Type: application/json` header. */
|
|
28
24
|
toResponse() {
|
|
29
25
|
const responseInit = {
|
|
30
26
|
headers: { "Content-Type": "application/json" },
|
|
@@ -33,12 +29,7 @@ class NotFound extends BadResponse {
|
|
|
33
29
|
};
|
|
34
30
|
return new Response(JSON.stringify(this.makeBody()), responseInit);
|
|
35
31
|
}
|
|
36
|
-
/**
|
|
37
|
-
* Converts the `NotFound` instance into a `Response` object using the `Response.json` method.
|
|
38
|
-
* This method is an alternative to `toResponse` for generating JSON error responses.
|
|
39
|
-
*
|
|
40
|
-
* @returns {Response["json"]} A `Response` object with the JSON body and response metadata.
|
|
41
|
-
*/
|
|
32
|
+
/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */
|
|
42
33
|
toJson() {
|
|
43
34
|
const responseInit = {
|
|
44
35
|
status: this.status,
|
|
@@ -1,30 +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
11
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* @param {string} message - A descriptive message explaining why the functionality is not implemented.
|
|
12
|
-
* @param {any} cause - Optional additional information about the cause of the error.
|
|
12
|
+
* @param message - Error description.
|
|
13
|
+
* @param cause - Optional extra context (serialized to JSON).
|
|
13
14
|
*/
|
|
14
15
|
constructor(message: string, cause?: any);
|
|
15
|
-
/**
|
|
16
|
-
* Converts the `NotImplemented` instance into a `Response` object with a JSON body.
|
|
17
|
-
* This method ensures the response has the appropriate headers, status, and status text.
|
|
18
|
-
*
|
|
19
|
-
* @returns {Response} A `Response` object with the serialized JSON body and response metadata.
|
|
20
|
-
*/
|
|
16
|
+
/** Converts to a `Response` with `Content-Type: application/json` header. */
|
|
21
17
|
toResponse(): Response;
|
|
22
|
-
/**
|
|
23
|
-
* Converts the `NotImplemented` instance into a `Response` object using the `Response.json` method.
|
|
24
|
-
* This method is an alternative to `toResponse` for generating JSON error responses.
|
|
25
|
-
*
|
|
26
|
-
* @returns {Response["json"]} A `Response` object with the JSON body and response metadata.
|
|
27
|
-
*/
|
|
18
|
+
/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */
|
|
28
19
|
toJson(): Response;
|
|
29
20
|
}
|
|
30
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;IACtC;;;OAGG;gBACS,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG;IAWxC,6EAA6E;IAC7E,UAAU,IAAI,QAAQ;IAUtB,uFAAuF;IACvF,MAAM,IAAI,QAAQ;CAQnB;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1,15 +1,16 @@
|
|
|
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
|
class NotImplemented extends BadResponse {
|
|
8
11
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* @param {string} message - A descriptive message explaining why the functionality is not implemented.
|
|
12
|
-
* @param {any} cause - Optional additional information about the cause of the error.
|
|
12
|
+
* @param message - Error description.
|
|
13
|
+
* @param cause - Optional extra context (serialized to JSON).
|
|
13
14
|
*/
|
|
14
15
|
constructor(message, cause) {
|
|
15
16
|
super();
|
|
@@ -19,12 +20,7 @@ class NotImplemented extends BadResponse {
|
|
|
19
20
|
this.cause = cause ? JSON.stringify(cause) : undefined;
|
|
20
21
|
this.onDebug();
|
|
21
22
|
}
|
|
22
|
-
/**
|
|
23
|
-
* Converts the `NotImplemented` instance into a `Response` object with a JSON body.
|
|
24
|
-
* This method ensures the response has the appropriate headers, status, and status text.
|
|
25
|
-
*
|
|
26
|
-
* @returns {Response} A `Response` object with the serialized JSON body and response metadata.
|
|
27
|
-
*/
|
|
23
|
+
/** Converts to a `Response` with `Content-Type: application/json` header. */
|
|
28
24
|
toResponse() {
|
|
29
25
|
const responseInit = {
|
|
30
26
|
headers: { "Content-Type": "application/json" },
|
|
@@ -33,12 +29,7 @@ class NotImplemented extends BadResponse {
|
|
|
33
29
|
};
|
|
34
30
|
return new Response(JSON.stringify(this.makeBody()), responseInit);
|
|
35
31
|
}
|
|
36
|
-
/**
|
|
37
|
-
* Converts the `NotImplemented` instance into a `Response` object using the `Response.json` method.
|
|
38
|
-
* This method is an alternative to `toResponse` for generating JSON error responses.
|
|
39
|
-
*
|
|
40
|
-
* @returns {Response["json"]} A `Response` object with the JSON body and response metadata.
|
|
41
|
-
*/
|
|
32
|
+
/** Converts to a `Response` using `Response.json()`. Alternative to `toResponse()`. */
|
|
42
33
|
toJson() {
|
|
43
34
|
const responseInit = {
|
|
44
35
|
status: this.status,
|