@spinajs/http 2.0.265 → 2.0.266
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/lib/cjs/bootstrap.js +1 -1
- package/lib/cjs/bootstrap.js.map +1 -1
- package/lib/cjs/decorators.d.ts +2 -1
- package/lib/cjs/decorators.d.ts.map +1 -1
- package/lib/cjs/decorators.js +11 -1
- package/lib/cjs/decorators.js.map +1 -1
- package/lib/cjs/interfaces.d.ts +6 -3
- package/lib/cjs/interfaces.d.ts.map +1 -1
- package/lib/cjs/interfaces.js +10 -1
- package/lib/cjs/interfaces.js.map +1 -1
- package/lib/cjs/response-methods/badRequest.d.ts +4 -5
- package/lib/cjs/response-methods/badRequest.d.ts.map +1 -1
- package/lib/cjs/response-methods/badRequest.js +22 -22
- package/lib/cjs/response-methods/badRequest.js.map +1 -1
- package/lib/cjs/response-methods/conflict.d.ts +6 -7
- package/lib/cjs/response-methods/conflict.d.ts.map +1 -1
- package/lib/cjs/response-methods/conflict.js +23 -12
- package/lib/cjs/response-methods/conflict.js.map +1 -1
- package/lib/cjs/response-methods/created.d.ts +3 -4
- package/lib/cjs/response-methods/created.d.ts.map +1 -1
- package/lib/cjs/response-methods/created.js +3 -9
- package/lib/cjs/response-methods/created.js.map +1 -1
- package/lib/cjs/response-methods/entityTooLarge.d.ts +3 -4
- package/lib/cjs/response-methods/entityTooLarge.d.ts.map +1 -1
- package/lib/cjs/response-methods/entityTooLarge.js +22 -11
- package/lib/cjs/response-methods/entityTooLarge.js.map +1 -1
- package/lib/cjs/response-methods/forbidden.d.ts +6 -7
- package/lib/cjs/response-methods/forbidden.d.ts.map +1 -1
- package/lib/cjs/response-methods/forbidden.js +24 -13
- package/lib/cjs/response-methods/forbidden.js.map +1 -1
- package/lib/cjs/response-methods/noContent.d.ts +6 -7
- package/lib/cjs/response-methods/noContent.d.ts.map +1 -1
- package/lib/cjs/response-methods/noContent.js +4 -10
- package/lib/cjs/response-methods/noContent.js.map +1 -1
- package/lib/cjs/response-methods/notAcceptable.d.ts +6 -7
- package/lib/cjs/response-methods/notAcceptable.d.ts.map +1 -1
- package/lib/cjs/response-methods/notAcceptable.js +4 -10
- package/lib/cjs/response-methods/notAcceptable.js.map +1 -1
- package/lib/cjs/response-methods/notAllowed.d.ts +6 -7
- package/lib/cjs/response-methods/notAllowed.d.ts.map +1 -1
- package/lib/cjs/response-methods/notAllowed.js +4 -10
- package/lib/cjs/response-methods/notAllowed.js.map +1 -1
- package/lib/cjs/response-methods/notFound.d.ts +6 -7
- package/lib/cjs/response-methods/notFound.d.ts.map +1 -1
- package/lib/cjs/response-methods/notFound.js +22 -11
- package/lib/cjs/response-methods/notFound.js.map +1 -1
- package/lib/cjs/response-methods/ok.d.ts +3 -4
- package/lib/cjs/response-methods/ok.d.ts.map +1 -1
- package/lib/cjs/response-methods/ok.js +3 -9
- package/lib/cjs/response-methods/ok.js.map +1 -1
- package/lib/cjs/response-methods/serverError.d.ts +6 -7
- package/lib/cjs/response-methods/serverError.d.ts.map +1 -1
- package/lib/cjs/response-methods/serverError.js +22 -11
- package/lib/cjs/response-methods/serverError.js.map +1 -1
- package/lib/cjs/response-methods/unauthorized.d.ts +6 -7
- package/lib/cjs/response-methods/unauthorized.d.ts.map +1 -1
- package/lib/cjs/response-methods/unauthorized.js +22 -11
- package/lib/cjs/response-methods/unauthorized.js.map +1 -1
- package/lib/cjs/response-methods/validationError.d.ts +6 -7
- package/lib/cjs/response-methods/validationError.d.ts.map +1 -1
- package/lib/cjs/response-methods/validationError.js +22 -11
- package/lib/cjs/response-methods/validationError.js.map +1 -1
- package/lib/cjs/responses.d.ts.map +1 -1
- package/lib/cjs/responses.js +19 -12
- package/lib/cjs/responses.js.map +1 -1
- package/lib/cjs/route-args/FromParams.d.ts +9 -1
- package/lib/cjs/route-args/FromParams.d.ts.map +1 -1
- package/lib/cjs/route-args/FromParams.js +18 -2
- package/lib/cjs/route-args/FromParams.js.map +1 -1
- package/lib/cjs/route-args/FromQuery.d.ts +9 -1
- package/lib/cjs/route-args/FromQuery.d.ts.map +1 -1
- package/lib/cjs/route-args/FromQuery.js +17 -2
- package/lib/cjs/route-args/FromQuery.js.map +1 -1
- package/lib/cjs/server.d.ts +1 -0
- package/lib/cjs/server.d.ts.map +1 -1
- package/lib/cjs/server.js +22 -40
- package/lib/cjs/server.js.map +1 -1
- package/lib/cjs/transformers/DefaultErrorTransform.d.ts +17 -0
- package/lib/cjs/transformers/DefaultErrorTransform.d.ts.map +1 -0
- package/lib/cjs/transformers/DefaultErrorTransform.js +28 -0
- package/lib/cjs/transformers/DefaultErrorTransform.js.map +1 -0
- package/lib/cjs/transformers/index.d.ts +1 -0
- package/lib/cjs/transformers/index.d.ts.map +1 -1
- package/lib/cjs/transformers/index.js +1 -0
- package/lib/cjs/transformers/index.js.map +1 -1
- package/lib/mjs/bootstrap.js +1 -1
- package/lib/mjs/bootstrap.js.map +1 -1
- package/lib/mjs/decorators.d.ts +2 -1
- package/lib/mjs/decorators.d.ts.map +1 -1
- package/lib/mjs/decorators.js +9 -0
- package/lib/mjs/decorators.js.map +1 -1
- package/lib/mjs/interfaces.d.ts +6 -3
- package/lib/mjs/interfaces.d.ts.map +1 -1
- package/lib/mjs/interfaces.js +10 -1
- package/lib/mjs/interfaces.js.map +1 -1
- package/lib/mjs/response-methods/badRequest.d.ts +4 -5
- package/lib/mjs/response-methods/badRequest.d.ts.map +1 -1
- package/lib/mjs/response-methods/badRequest.js +23 -19
- package/lib/mjs/response-methods/badRequest.js.map +1 -1
- package/lib/mjs/response-methods/conflict.d.ts +6 -7
- package/lib/mjs/response-methods/conflict.d.ts.map +1 -1
- package/lib/mjs/response-methods/conflict.js +25 -13
- package/lib/mjs/response-methods/conflict.js.map +1 -1
- package/lib/mjs/response-methods/created.d.ts +3 -4
- package/lib/mjs/response-methods/created.d.ts.map +1 -1
- package/lib/mjs/response-methods/created.js +3 -9
- package/lib/mjs/response-methods/created.js.map +1 -1
- package/lib/mjs/response-methods/entityTooLarge.d.ts +3 -4
- package/lib/mjs/response-methods/entityTooLarge.d.ts.map +1 -1
- package/lib/mjs/response-methods/entityTooLarge.js +23 -11
- package/lib/mjs/response-methods/entityTooLarge.js.map +1 -1
- package/lib/mjs/response-methods/forbidden.d.ts +6 -7
- package/lib/mjs/response-methods/forbidden.d.ts.map +1 -1
- package/lib/mjs/response-methods/forbidden.js +24 -12
- package/lib/mjs/response-methods/forbidden.js.map +1 -1
- package/lib/mjs/response-methods/noContent.d.ts +6 -7
- package/lib/mjs/response-methods/noContent.d.ts.map +1 -1
- package/lib/mjs/response-methods/noContent.js +5 -11
- package/lib/mjs/response-methods/noContent.js.map +1 -1
- package/lib/mjs/response-methods/notAcceptable.d.ts +6 -7
- package/lib/mjs/response-methods/notAcceptable.d.ts.map +1 -1
- package/lib/mjs/response-methods/notAcceptable.js +5 -11
- package/lib/mjs/response-methods/notAcceptable.js.map +1 -1
- package/lib/mjs/response-methods/notAllowed.d.ts +6 -7
- package/lib/mjs/response-methods/notAllowed.d.ts.map +1 -1
- package/lib/mjs/response-methods/notAllowed.js +5 -11
- package/lib/mjs/response-methods/notAllowed.js.map +1 -1
- package/lib/mjs/response-methods/notFound.d.ts +6 -7
- package/lib/mjs/response-methods/notFound.d.ts.map +1 -1
- package/lib/mjs/response-methods/notFound.js +24 -12
- package/lib/mjs/response-methods/notFound.js.map +1 -1
- package/lib/mjs/response-methods/ok.d.ts +3 -4
- package/lib/mjs/response-methods/ok.d.ts.map +1 -1
- package/lib/mjs/response-methods/ok.js +3 -9
- package/lib/mjs/response-methods/ok.js.map +1 -1
- package/lib/mjs/response-methods/serverError.d.ts +6 -7
- package/lib/mjs/response-methods/serverError.d.ts.map +1 -1
- package/lib/mjs/response-methods/serverError.js +24 -12
- package/lib/mjs/response-methods/serverError.js.map +1 -1
- package/lib/mjs/response-methods/unauthorized.d.ts +6 -7
- package/lib/mjs/response-methods/unauthorized.d.ts.map +1 -1
- package/lib/mjs/response-methods/unauthorized.js +24 -12
- package/lib/mjs/response-methods/unauthorized.js.map +1 -1
- package/lib/mjs/response-methods/validationError.d.ts +6 -7
- package/lib/mjs/response-methods/validationError.d.ts.map +1 -1
- package/lib/mjs/response-methods/validationError.js +24 -12
- package/lib/mjs/response-methods/validationError.js.map +1 -1
- package/lib/mjs/responses.d.ts.map +1 -1
- package/lib/mjs/responses.js +19 -12
- package/lib/mjs/responses.js.map +1 -1
- package/lib/mjs/route-args/FromParams.d.ts +9 -1
- package/lib/mjs/route-args/FromParams.d.ts.map +1 -1
- package/lib/mjs/route-args/FromParams.js +18 -2
- package/lib/mjs/route-args/FromParams.js.map +1 -1
- package/lib/mjs/route-args/FromQuery.d.ts +9 -1
- package/lib/mjs/route-args/FromQuery.d.ts.map +1 -1
- package/lib/mjs/route-args/FromQuery.js +17 -2
- package/lib/mjs/route-args/FromQuery.js.map +1 -1
- package/lib/mjs/server.d.ts +1 -0
- package/lib/mjs/server.d.ts.map +1 -1
- package/lib/mjs/server.js +24 -42
- package/lib/mjs/server.js.map +1 -1
- package/lib/mjs/transformers/DefaultErrorTransform.d.ts +17 -0
- package/lib/mjs/transformers/DefaultErrorTransform.d.ts.map +1 -0
- package/lib/mjs/transformers/DefaultErrorTransform.js +25 -0
- package/lib/mjs/transformers/DefaultErrorTransform.js.map +1 -0
- package/lib/mjs/transformers/index.d.ts +1 -0
- package/lib/mjs/transformers/index.d.ts.map +1 -1
- package/lib/mjs/transformers/index.js +1 -0
- package/lib/mjs/transformers/index.js.map +1 -1
- package/lib/tsconfig.cjs.tsbuildinfo +1 -1
- package/lib/tsconfig.mjs.tsbuildinfo +1 -1
- package/package.json +11 -11
|
@@ -1,26 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
12
|
+
exports.ForbiddenResponse = void 0;
|
|
4
13
|
const interfaces_js_1 = require("../interfaces.js");
|
|
5
|
-
const responses_js_1 = require("../responses.js");
|
|
6
14
|
const badRequest_js_1 = require("./badRequest.js");
|
|
15
|
+
const decorators_js_1 = require("../decorators.js");
|
|
16
|
+
const exceptions_1 = require("@spinajs/exceptions");
|
|
17
|
+
const di_1 = require("@spinajs/di");
|
|
7
18
|
/**
|
|
8
19
|
* Internall response function.
|
|
9
20
|
* Returns HTTP 403 FORBIDDEN ERROR
|
|
10
21
|
* @param err - error to send
|
|
11
22
|
*/
|
|
12
|
-
class
|
|
23
|
+
let ForbiddenResponse = class ForbiddenResponse extends badRequest_js_1.BadRequestResponse {
|
|
13
24
|
constructor(data, options) {
|
|
14
|
-
super(data);
|
|
25
|
+
super(data, options);
|
|
15
26
|
this.options = options;
|
|
27
|
+
this._errorCode = interfaces_js_1.HTTP_STATUS_CODE.FORBIDDEN;
|
|
28
|
+
this._template = 'forbidden.pug';
|
|
16
29
|
}
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
exports.Forbidden = Forbidden;
|
|
30
|
+
};
|
|
31
|
+
exports.ForbiddenResponse = ForbiddenResponse;
|
|
32
|
+
exports.ForbiddenResponse = ForbiddenResponse = __decorate([
|
|
33
|
+
(0, decorators_js_1.HandleException)(exceptions_1.Forbidden),
|
|
34
|
+
(0, di_1.Injectable)(Response),
|
|
35
|
+
__metadata("design:paramtypes", [Object, Object])
|
|
36
|
+
], ForbiddenResponse);
|
|
26
37
|
//# sourceMappingURL=forbidden.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forbidden.js","sourceRoot":"","sources":["../../../src/response-methods/forbidden.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"forbidden.js","sourceRoot":"","sources":["../../../src/response-methods/forbidden.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAsE;AACtE,mDAAqD;AACrD,oDAAmD;AACnD,oDAAgD;AAChD,oCAAyC;AAEzC;;;;GAIG;AAII,IAAM,iBAAiB,GAAvB,MAAM,iBAAkB,SAAQ,kCAAkB;IAIvD,YAAY,IAAwC,EAAY,OAA0B;QACxF,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QADyC,YAAO,GAAP,OAAO,CAAmB;QAHhF,eAAU,GAAG,gCAAgB,CAAC,SAAS,CAAC;QACxC,cAAS,GAAG,eAAe,CAAC;IAItC,CAAC;CACF,CAAA;AAPY,8CAAiB;4BAAjB,iBAAiB;IAF7B,IAAA,+BAAe,EAAC,sBAAS,CAAC;IAC1B,IAAA,eAAU,EAAC,QAAQ,CAAC;;GACR,iBAAiB,CAO7B"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import { IResponseOptions } from '../interfaces.js';
|
|
4
|
-
import { BadRequest } from './badRequest.js';
|
|
1
|
+
import { HTTP_STATUS_CODE, IResponseOptions } from '../interfaces.js';
|
|
2
|
+
import { BadRequestResponse } from './badRequest.js';
|
|
5
3
|
/**
|
|
6
4
|
* Internall response function.
|
|
7
5
|
* Returns HTTP 204 NO CONTENT
|
|
8
6
|
* @param err - error to send
|
|
9
7
|
*/
|
|
10
|
-
export declare class NoContent extends
|
|
8
|
+
export declare class NoContent extends BadRequestResponse {
|
|
11
9
|
protected options?: IResponseOptions;
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
protected _errorCode: HTTP_STATUS_CODE;
|
|
11
|
+
protected _template: string;
|
|
12
|
+
constructor(data: string | object | Promise<unknown>, options?: IResponseOptions);
|
|
14
13
|
}
|
|
15
14
|
//# sourceMappingURL=noContent.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noContent.d.ts","sourceRoot":"","sources":["../../../src/response-methods/noContent.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"noContent.d.ts","sourceRoot":"","sources":["../../../src/response-methods/noContent.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;GAIG;AACH,qBAAa,SAAU,SAAQ,kBAAkB;IAIO,SAAS,CAAC,OAAO,CAAC,EAAE,gBAAgB;IAH1F,SAAS,CAAC,UAAU,mBAA+B;IACnD,SAAS,CAAC,SAAS,SAAmB;gBAE1B,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,EAAY,OAAO,CAAC,EAAE,gBAAgB;CAG3F"}
|
|
@@ -2,24 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NoContent = void 0;
|
|
4
4
|
const interfaces_js_1 = require("../interfaces.js");
|
|
5
|
-
const responses_js_1 = require("../responses.js");
|
|
6
5
|
const badRequest_js_1 = require("./badRequest.js");
|
|
7
6
|
/**
|
|
8
7
|
* Internall response function.
|
|
9
8
|
* Returns HTTP 204 NO CONTENT
|
|
10
9
|
* @param err - error to send
|
|
11
10
|
*/
|
|
12
|
-
class NoContent extends badRequest_js_1.
|
|
11
|
+
class NoContent extends badRequest_js_1.BadRequestResponse {
|
|
13
12
|
constructor(data, options) {
|
|
14
|
-
super(data);
|
|
13
|
+
super(data, options);
|
|
15
14
|
this.options = options;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const response = await this.prepareResponse();
|
|
19
|
-
return await (0, responses_js_1.httpResponse)(response, 'noContent.pug', {
|
|
20
|
-
...this.options,
|
|
21
|
-
StatusCode: interfaces_js_1.HTTP_STATUS_CODE.NO_CONTENT,
|
|
22
|
-
});
|
|
15
|
+
this._errorCode = interfaces_js_1.HTTP_STATUS_CODE.NO_CONTENT;
|
|
16
|
+
this._template = 'noContent.pug';
|
|
23
17
|
}
|
|
24
18
|
}
|
|
25
19
|
exports.NoContent = NoContent;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"noContent.js","sourceRoot":"","sources":["../../../src/response-methods/noContent.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"noContent.js","sourceRoot":"","sources":["../../../src/response-methods/noContent.ts"],"names":[],"mappings":";;;AAAA,oDAAsE;AACtE,mDAAqD;AAErD;;;;GAIG;AACH,MAAa,SAAU,SAAQ,kCAAkB;IAI/C,YAAY,IAAwC,EAAY,OAA0B;QACxF,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QADyC,YAAO,GAAP,OAAO,CAAmB;QAHhF,eAAU,GAAG,gCAAgB,CAAC,UAAU,CAAC;QACzC,cAAS,GAAG,eAAe,CAAC;IAItC,CAAC;CACF;AAPD,8BAOC"}
|
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import { IResponseOptions } from '../interfaces.js';
|
|
4
|
-
import { BadRequest } from './badRequest.js';
|
|
1
|
+
import { HTTP_STATUS_CODE, IResponseOptions } from '../interfaces.js';
|
|
2
|
+
import { BadRequestResponse } from './badRequest.js';
|
|
5
3
|
/**
|
|
6
4
|
* Internall response function.
|
|
7
5
|
* Returns HTTP 406 NOT ACCEPTABLE
|
|
8
6
|
* When content requested in accept header format cannot be returned.
|
|
9
7
|
* @param err - error to send
|
|
10
8
|
*/
|
|
11
|
-
export declare class NotAcceptable extends
|
|
9
|
+
export declare class NotAcceptable extends BadRequestResponse {
|
|
12
10
|
protected options?: IResponseOptions;
|
|
13
|
-
|
|
14
|
-
|
|
11
|
+
protected _errorCode: HTTP_STATUS_CODE;
|
|
12
|
+
protected _template: string;
|
|
13
|
+
constructor(data: string | object | Promise<unknown>, options?: IResponseOptions);
|
|
15
14
|
}
|
|
16
15
|
//# sourceMappingURL=notAcceptable.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notAcceptable.d.ts","sourceRoot":"","sources":["../../../src/response-methods/notAcceptable.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"notAcceptable.d.ts","sourceRoot":"","sources":["../../../src/response-methods/notAcceptable.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;;GAKG;AACH,qBAAa,aAAc,SAAQ,kBAAkB;IAIG,SAAS,CAAC,OAAO,CAAC,EAAE,gBAAgB;IAH1F,SAAS,CAAC,UAAU,mBAAmC;IACvD,SAAS,CAAC,SAAS,SAAuB;gBAE9B,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,EAAY,OAAO,CAAC,EAAE,gBAAgB;CAG3F"}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NotAcceptable = void 0;
|
|
4
4
|
const interfaces_js_1 = require("../interfaces.js");
|
|
5
|
-
const responses_js_1 = require("../responses.js");
|
|
6
5
|
const badRequest_js_1 = require("./badRequest.js");
|
|
7
6
|
/**
|
|
8
7
|
* Internall response function.
|
|
@@ -10,17 +9,12 @@ const badRequest_js_1 = require("./badRequest.js");
|
|
|
10
9
|
* When content requested in accept header format cannot be returned.
|
|
11
10
|
* @param err - error to send
|
|
12
11
|
*/
|
|
13
|
-
class NotAcceptable extends badRequest_js_1.
|
|
12
|
+
class NotAcceptable extends badRequest_js_1.BadRequestResponse {
|
|
14
13
|
constructor(data, options) {
|
|
15
|
-
super(data);
|
|
14
|
+
super(data, options);
|
|
16
15
|
this.options = options;
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
const response = await this.prepareResponse();
|
|
20
|
-
return await (0, responses_js_1.httpResponse)(response, 'notAcceptable.pug', {
|
|
21
|
-
...this.options,
|
|
22
|
-
StatusCode: interfaces_js_1.HTTP_STATUS_CODE.NOT_ACCEPTABLE
|
|
23
|
-
});
|
|
16
|
+
this._errorCode = interfaces_js_1.HTTP_STATUS_CODE.NOT_ACCEPTABLE;
|
|
17
|
+
this._template = 'notAcceptable.pug';
|
|
24
18
|
}
|
|
25
19
|
}
|
|
26
20
|
exports.NotAcceptable = NotAcceptable;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notAcceptable.js","sourceRoot":"","sources":["../../../src/response-methods/notAcceptable.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"notAcceptable.js","sourceRoot":"","sources":["../../../src/response-methods/notAcceptable.ts"],"names":[],"mappings":";;;AAAA,oDAAsE;AACtE,mDAAqD;AAErD;;;;;GAKG;AACH,MAAa,aAAc,SAAQ,kCAAkB;IAInD,YAAY,IAAwC,EAAY,OAA0B;QACxF,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QADyC,YAAO,GAAP,OAAO,CAAmB;QAHhF,eAAU,GAAG,gCAAgB,CAAC,cAAc,CAAC;QAC7C,cAAS,GAAG,mBAAmB,CAAC;IAI1C,CAAC;CACF;AAPD,sCAOC"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import { IResponseOptions } from '../interfaces.js';
|
|
4
|
-
import { BadRequest } from './badRequest.js';
|
|
1
|
+
import { HTTP_STATUS_CODE, IResponseOptions } from '../interfaces.js';
|
|
2
|
+
import { BadRequestResponse } from './badRequest.js';
|
|
5
3
|
/**
|
|
6
4
|
* Internall response function.
|
|
7
5
|
* Returns HTTP 403 FORBIDDEN ERROR
|
|
8
6
|
* @param err - error to send
|
|
9
7
|
*/
|
|
10
|
-
export declare class NotAllowed extends
|
|
8
|
+
export declare class NotAllowed extends BadRequestResponse {
|
|
11
9
|
protected options?: IResponseOptions;
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
protected _errorCode: HTTP_STATUS_CODE;
|
|
11
|
+
protected _template: string;
|
|
12
|
+
constructor(data: string | object | Promise<unknown>, options?: IResponseOptions);
|
|
14
13
|
}
|
|
15
14
|
//# sourceMappingURL=notAllowed.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notAllowed.d.ts","sourceRoot":"","sources":["../../../src/response-methods/notAllowed.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"notAllowed.d.ts","sourceRoot":"","sources":["../../../src/response-methods/notAllowed.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAErD;;;;GAIG;AAEH,qBAAa,UAAW,SAAQ,kBAAkB;IAIM,SAAS,CAAC,OAAO,CAAC,EAAE,gBAAgB;IAH1F,SAAS,CAAC,UAAU,mBAAgC;IACpD,SAAS,CAAC,SAAS,SAAqB;gBAE5B,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,EAAY,OAAO,CAAC,EAAE,gBAAgB;CAG3F"}
|
|
@@ -2,24 +2,18 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.NotAllowed = void 0;
|
|
4
4
|
const interfaces_js_1 = require("../interfaces.js");
|
|
5
|
-
const responses_js_1 = require("../responses.js");
|
|
6
5
|
const badRequest_js_1 = require("./badRequest.js");
|
|
7
6
|
/**
|
|
8
7
|
* Internall response function.
|
|
9
8
|
* Returns HTTP 403 FORBIDDEN ERROR
|
|
10
9
|
* @param err - error to send
|
|
11
10
|
*/
|
|
12
|
-
class NotAllowed extends badRequest_js_1.
|
|
11
|
+
class NotAllowed extends badRequest_js_1.BadRequestResponse {
|
|
13
12
|
constructor(data, options) {
|
|
14
|
-
super(data);
|
|
13
|
+
super(data, options);
|
|
15
14
|
this.options = options;
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const response = await this.prepareResponse();
|
|
19
|
-
return await (0, responses_js_1.httpResponse)(response, 'not-allowed.pug', {
|
|
20
|
-
...this.options,
|
|
21
|
-
StatusCode: interfaces_js_1.HTTP_STATUS_CODE.NOT_ALLOWED,
|
|
22
|
-
});
|
|
15
|
+
this._errorCode = interfaces_js_1.HTTP_STATUS_CODE.NOT_ALLOWED;
|
|
16
|
+
this._template = 'not-allowed.pug';
|
|
23
17
|
}
|
|
24
18
|
}
|
|
25
19
|
exports.NotAllowed = NotAllowed;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notAllowed.js","sourceRoot":"","sources":["../../../src/response-methods/notAllowed.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"notAllowed.js","sourceRoot":"","sources":["../../../src/response-methods/notAllowed.ts"],"names":[],"mappings":";;;AAAA,oDAAsE;AACtE,mDAAqD;AAErD;;;;GAIG;AAEH,MAAa,UAAW,SAAQ,kCAAkB;IAIhD,YAAY,IAAwC,EAAY,OAA0B;QACxF,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QADyC,YAAO,GAAP,OAAO,CAAmB;QAHhF,eAAU,GAAG,gCAAgB,CAAC,WAAW,CAAC;QAC1C,cAAS,GAAG,iBAAiB,CAAC;IAIxC,CAAC;CACF;AAPD,gCAOC"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import { IResponseOptions } from '../interfaces.js';
|
|
4
|
-
import { BadRequest } from './badRequest.js';
|
|
1
|
+
import { HTTP_STATUS_CODE, IResponseOptions } from '../interfaces.js';
|
|
2
|
+
import { BadRequestResponse } from './badRequest.js';
|
|
5
3
|
/**
|
|
6
4
|
* Internall response function.
|
|
7
5
|
* Returns HTTP 404 NOT FOUND ERROR
|
|
8
6
|
* @param err - error to send
|
|
9
7
|
*/
|
|
10
|
-
export declare class NotFound extends
|
|
8
|
+
export declare class NotFound extends BadRequestResponse {
|
|
11
9
|
protected options?: IResponseOptions;
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
protected _errorCode: HTTP_STATUS_CODE;
|
|
11
|
+
protected _template: string;
|
|
12
|
+
constructor(data: string | object | Promise<unknown>, options?: IResponseOptions);
|
|
14
13
|
}
|
|
15
14
|
//# sourceMappingURL=notFound.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notFound.d.ts","sourceRoot":"","sources":["../../../src/response-methods/notFound.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"notFound.d.ts","sourceRoot":"","sources":["../../../src/response-methods/notFound.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAKrD;;;;GAIG;AACH,qBAEa,QAAS,SAAQ,kBAAkB;IAIQ,SAAS,CAAC,OAAO,CAAC,EAAE,gBAAgB;IAH1F,SAAS,CAAC,UAAU,mBAA8B;IAClD,SAAS,CAAC,SAAS,SAAkB;gBAEzB,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,EAAY,OAAO,CAAC,EAAE,gBAAgB;CAG3F"}
|
|
@@ -1,26 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.NotFound = void 0;
|
|
4
13
|
const interfaces_js_1 = require("../interfaces.js");
|
|
5
|
-
const responses_js_1 = require("../responses.js");
|
|
6
14
|
const badRequest_js_1 = require("./badRequest.js");
|
|
15
|
+
const decorators_js_1 = require("../decorators.js");
|
|
16
|
+
const exceptions_1 = require("@spinajs/exceptions");
|
|
17
|
+
const di_1 = require("@spinajs/di");
|
|
7
18
|
/**
|
|
8
19
|
* Internall response function.
|
|
9
20
|
* Returns HTTP 404 NOT FOUND ERROR
|
|
10
21
|
* @param err - error to send
|
|
11
22
|
*/
|
|
12
|
-
class NotFound extends badRequest_js_1.
|
|
23
|
+
let NotFound = class NotFound extends badRequest_js_1.BadRequestResponse {
|
|
13
24
|
constructor(data, options) {
|
|
14
|
-
super(data);
|
|
25
|
+
super(data, options);
|
|
15
26
|
this.options = options;
|
|
27
|
+
this._errorCode = interfaces_js_1.HTTP_STATUS_CODE.NOT_FOUND;
|
|
28
|
+
this._template = 'notFound.pug';
|
|
16
29
|
}
|
|
17
|
-
|
|
18
|
-
const response = await this.prepareResponse();
|
|
19
|
-
return await (0, responses_js_1.httpResponse)(response, 'notFound.pug', {
|
|
20
|
-
...this.options,
|
|
21
|
-
StatusCode: interfaces_js_1.HTTP_STATUS_CODE.NOT_FOUND,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}
|
|
30
|
+
};
|
|
25
31
|
exports.NotFound = NotFound;
|
|
32
|
+
exports.NotFound = NotFound = __decorate([
|
|
33
|
+
(0, decorators_js_1.HandleException)(exceptions_1.ResourceNotFound),
|
|
34
|
+
(0, di_1.Injectable)(Response),
|
|
35
|
+
__metadata("design:paramtypes", [Object, Object])
|
|
36
|
+
], NotFound);
|
|
26
37
|
//# sourceMappingURL=notFound.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"notFound.js","sourceRoot":"","sources":["../../../src/response-methods/notFound.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"notFound.js","sourceRoot":"","sources":["../../../src/response-methods/notFound.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAsE;AACtE,mDAAqD;AACrD,oDAAmD;AACnD,oDAAuD;AACvD,oCAAyC;AAEzC;;;;GAIG;AAGI,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,kCAAkB;IAI9C,YAAY,IAAwC,EAAY,OAA0B;QACxF,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QADyC,YAAO,GAAP,OAAO,CAAmB;QAHhF,eAAU,GAAG,gCAAgB,CAAC,SAAS,CAAC;QACxC,cAAS,GAAG,cAAc,CAAC;IAIrC,CAAC;CACF,CAAA;AAPY,4BAAQ;mBAAR,QAAQ;IAFpB,IAAA,+BAAe,EAAC,6BAAgB,CAAC;IACjC,IAAA,eAAU,EAAC,QAAQ,CAAC;;GACR,QAAQ,CAOpB"}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
import * as express from 'express';
|
|
3
|
-
import { IResponseOptions, Response } from '../interfaces.js';
|
|
1
|
+
import { HTTP_STATUS_CODE, IResponseOptions, Response } from '../interfaces.js';
|
|
4
2
|
/**
|
|
5
3
|
* Internall response function.
|
|
6
4
|
* Returns HTTP 200 OK response with json content
|
|
@@ -8,7 +6,8 @@ import { IResponseOptions, Response } from '../interfaces.js';
|
|
|
8
6
|
*/
|
|
9
7
|
export declare class Ok extends Response {
|
|
10
8
|
protected options?: IResponseOptions;
|
|
9
|
+
protected _errorCode: HTTP_STATUS_CODE;
|
|
10
|
+
protected _template: string;
|
|
11
11
|
constructor(data?: string | object | Promise<unknown>, options?: IResponseOptions);
|
|
12
|
-
execute(_req: express.Request, _res: express.Response): Promise<(req: express.Request<import("express-serve-static-core").ParamsDictionary, any, any, import("qs").ParsedQs, Record<string, any>>, res: express.Response<any, Record<string, any>>) => void>;
|
|
13
12
|
}
|
|
14
13
|
//# sourceMappingURL=ok.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ok.d.ts","sourceRoot":"","sources":["../../../src/response-methods/ok.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ok.d.ts","sourceRoot":"","sources":["../../../src/response-methods/ok.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEhF;;;;GAIG;AACH,qBAAa,EAAG,SAAQ,QAAQ;IAIyB,SAAS,CAAC,OAAO,CAAC,EAAE,gBAAgB;IAH3F,SAAS,CAAC,UAAU,mBAAuB;IAC3C,SAAS,CAAC,SAAS,SAAY;gBAEnB,IAAI,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,EAAY,OAAO,CAAC,EAAE,gBAAgB;CAG5F"}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.Ok = void 0;
|
|
4
4
|
const interfaces_js_1 = require("../interfaces.js");
|
|
5
|
-
const responses_js_1 = require("../responses.js");
|
|
6
5
|
/**
|
|
7
6
|
* Internall response function.
|
|
8
7
|
* Returns HTTP 200 OK response with json content
|
|
@@ -10,15 +9,10 @@ const responses_js_1 = require("../responses.js");
|
|
|
10
9
|
*/
|
|
11
10
|
class Ok extends interfaces_js_1.Response {
|
|
12
11
|
constructor(data, options) {
|
|
13
|
-
super(data);
|
|
12
|
+
super(data, options);
|
|
14
13
|
this.options = options;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
const response = await this.prepareResponse();
|
|
18
|
-
return await (0, responses_js_1.httpResponse)(response, 'ok.pug', {
|
|
19
|
-
...this.options,
|
|
20
|
-
StatusCode: interfaces_js_1.HTTP_STATUS_CODE.OK,
|
|
21
|
-
});
|
|
14
|
+
this._errorCode = interfaces_js_1.HTTP_STATUS_CODE.OK;
|
|
15
|
+
this._template = 'ok.pug';
|
|
22
16
|
}
|
|
23
17
|
}
|
|
24
18
|
exports.Ok = Ok;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ok.js","sourceRoot":"","sources":["../../../src/response-methods/ok.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"ok.js","sourceRoot":"","sources":["../../../src/response-methods/ok.ts"],"names":[],"mappings":";;;AAAA,oDAAgF;AAEhF;;;;GAIG;AACH,MAAa,EAAG,SAAQ,wBAAQ;IAI9B,YAAY,IAAyC,EAAY,OAA0B;QACzF,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAD0C,YAAO,GAAP,OAAO,CAAmB;QAHjF,eAAU,GAAG,gCAAgB,CAAC,EAAE,CAAC;QACjC,cAAS,GAAG,QAAQ,CAAC;IAI/B,CAAC;CACF;AAPD,gBAOC"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import { IResponseOptions } from '../interfaces.js';
|
|
4
|
-
import { BadRequest } from './badRequest.js';
|
|
1
|
+
import { HTTP_STATUS_CODE, IResponseOptions } from '../interfaces.js';
|
|
2
|
+
import { BadRequestResponse } from './badRequest.js';
|
|
5
3
|
/**
|
|
6
4
|
* Internall response function.
|
|
7
5
|
* Returns HTTP 500 INTERNAL SERVER ERROR
|
|
8
6
|
* @param err - error to send
|
|
9
7
|
*/
|
|
10
|
-
export declare class ServerError extends
|
|
8
|
+
export declare class ServerError extends BadRequestResponse {
|
|
11
9
|
protected options?: IResponseOptions;
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
protected _errorCode: HTTP_STATUS_CODE;
|
|
11
|
+
protected _template: string;
|
|
12
|
+
constructor(data: string | object | Promise<unknown>, options?: IResponseOptions);
|
|
14
13
|
}
|
|
15
14
|
//# sourceMappingURL=serverError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serverError.d.ts","sourceRoot":"","sources":["../../../src/response-methods/serverError.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serverError.d.ts","sourceRoot":"","sources":["../../../src/response-methods/serverError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAKrD;;;;GAIG;AAEH,qBAEa,WAAY,SAAQ,kBAAkB;IAIK,SAAS,CAAC,OAAO,CAAC,EAAE,gBAAgB;IAH1F,SAAS,CAAC,UAAU,mBAAmC;IACvD,SAAS,CAAC,SAAS,SAAqB;gBAE5B,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,EAAY,OAAO,CAAC,EAAE,gBAAgB;CAG3F"}
|
|
@@ -1,26 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.ServerError = void 0;
|
|
4
13
|
const interfaces_js_1 = require("../interfaces.js");
|
|
5
|
-
const responses_js_1 = require("../responses.js");
|
|
6
14
|
const badRequest_js_1 = require("./badRequest.js");
|
|
15
|
+
const decorators_js_1 = require("../decorators.js");
|
|
16
|
+
const di_1 = require("@spinajs/di");
|
|
17
|
+
const exceptions_1 = require("@spinajs/exceptions");
|
|
7
18
|
/**
|
|
8
19
|
* Internall response function.
|
|
9
20
|
* Returns HTTP 500 INTERNAL SERVER ERROR
|
|
10
21
|
* @param err - error to send
|
|
11
22
|
*/
|
|
12
|
-
class ServerError extends badRequest_js_1.
|
|
23
|
+
let ServerError = class ServerError extends badRequest_js_1.BadRequestResponse {
|
|
13
24
|
constructor(data, options) {
|
|
14
|
-
super(data);
|
|
25
|
+
super(data, options);
|
|
15
26
|
this.options = options;
|
|
27
|
+
this._errorCode = interfaces_js_1.HTTP_STATUS_CODE.INTERNAL_ERROR;
|
|
28
|
+
this._template = 'serverError.pug';
|
|
16
29
|
}
|
|
17
|
-
|
|
18
|
-
const response = await this.prepareResponse();
|
|
19
|
-
return await (0, responses_js_1.httpResponse)({ error: response }, 'serverError.pug', {
|
|
20
|
-
...this.options,
|
|
21
|
-
StatusCode: interfaces_js_1.HTTP_STATUS_CODE.INTERNAL_ERROR,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}
|
|
30
|
+
};
|
|
25
31
|
exports.ServerError = ServerError;
|
|
32
|
+
exports.ServerError = ServerError = __decorate([
|
|
33
|
+
(0, decorators_js_1.HandleException)([exceptions_1.MethodNotImplemented, exceptions_1.IOFail, exceptions_1.UnexpectedServerError]),
|
|
34
|
+
(0, di_1.Injectable)(Response),
|
|
35
|
+
__metadata("design:paramtypes", [Object, Object])
|
|
36
|
+
], ServerError);
|
|
26
37
|
//# sourceMappingURL=serverError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"serverError.js","sourceRoot":"","sources":["../../../src/response-methods/serverError.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"serverError.js","sourceRoot":"","sources":["../../../src/response-methods/serverError.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAsE;AACtE,mDAAqD;AACrD,oDAAmD;AACnD,oCAAyC;AACzC,oDAA0F;AAE1F;;;;GAIG;AAII,IAAM,WAAW,GAAjB,MAAM,WAAY,SAAQ,kCAAkB;IAIjD,YAAY,IAAwC,EAAY,OAA0B;QACxF,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QADyC,YAAO,GAAP,OAAO,CAAmB;QAHhF,eAAU,GAAG,gCAAgB,CAAC,cAAc,CAAC;QAC7C,cAAS,GAAG,iBAAiB,CAAC;IAIxC,CAAC;CACF,CAAA;AAPY,kCAAW;sBAAX,WAAW;IAFvB,IAAA,+BAAe,EAAC,CAAC,iCAAoB,EAAE,mBAAM,EAAE,kCAAqB,CAAC,CAAC;IACtE,IAAA,eAAU,EAAC,QAAQ,CAAC;;GACR,WAAW,CAOvB"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import { IResponseOptions } from '../interfaces.js';
|
|
4
|
-
import { BadRequest } from './badRequest.js';
|
|
1
|
+
import { HTTP_STATUS_CODE, IResponseOptions } from '../interfaces.js';
|
|
2
|
+
import { BadRequestResponse } from './badRequest.js';
|
|
5
3
|
/**
|
|
6
4
|
* Internall response function.
|
|
7
5
|
* Returns HTTP 401 UNAHTORIZED response with json content
|
|
8
6
|
* @param data - data to send
|
|
9
7
|
*/
|
|
10
|
-
export declare class Unauthorized extends
|
|
8
|
+
export declare class Unauthorized extends BadRequestResponse {
|
|
11
9
|
protected options?: IResponseOptions;
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
protected _errorCode: HTTP_STATUS_CODE;
|
|
11
|
+
protected _template: string;
|
|
12
|
+
constructor(data: string | object | Promise<unknown>, options?: IResponseOptions);
|
|
14
13
|
}
|
|
15
14
|
//# sourceMappingURL=unauthorized.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unauthorized.d.ts","sourceRoot":"","sources":["../../../src/response-methods/unauthorized.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"unauthorized.d.ts","sourceRoot":"","sources":["../../../src/response-methods/unauthorized.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAKrD;;;;GAIG;AAEH,qBAEa,YAAa,SAAQ,kBAAkB;IAII,SAAS,CAAC,OAAO,CAAC,EAAE,gBAAgB;IAH1F,SAAS,CAAC,UAAU,mBAAiC;IACrD,SAAS,CAAC,SAAS,SAAsB;gBAE7B,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,EAAY,OAAO,CAAC,EAAE,gBAAgB;CAG3F"}
|
|
@@ -1,26 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
2
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
12
|
exports.Unauthorized = void 0;
|
|
4
13
|
const interfaces_js_1 = require("../interfaces.js");
|
|
5
|
-
const responses_js_1 = require("../responses.js");
|
|
6
14
|
const badRequest_js_1 = require("./badRequest.js");
|
|
15
|
+
const exceptions_1 = require("@spinajs/exceptions");
|
|
16
|
+
const decorators_js_1 = require("../decorators.js");
|
|
17
|
+
const di_1 = require("@spinajs/di");
|
|
7
18
|
/**
|
|
8
19
|
* Internall response function.
|
|
9
20
|
* Returns HTTP 401 UNAHTORIZED response with json content
|
|
10
21
|
* @param data - data to send
|
|
11
22
|
*/
|
|
12
|
-
class Unauthorized extends badRequest_js_1.
|
|
23
|
+
let Unauthorized = class Unauthorized extends badRequest_js_1.BadRequestResponse {
|
|
13
24
|
constructor(data, options) {
|
|
14
|
-
super(data);
|
|
25
|
+
super(data, options);
|
|
15
26
|
this.options = options;
|
|
27
|
+
this._errorCode = interfaces_js_1.HTTP_STATUS_CODE.UNAUTHORIZED;
|
|
28
|
+
this._template = 'unauthorized.pug';
|
|
16
29
|
}
|
|
17
|
-
|
|
18
|
-
const response = await this.prepareResponse();
|
|
19
|
-
return await (0, responses_js_1.httpResponse)(response, 'responses/unauthorized', {
|
|
20
|
-
...this.options,
|
|
21
|
-
StatusCode: interfaces_js_1.HTTP_STATUS_CODE.UNAUTHORIZED,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
}
|
|
30
|
+
};
|
|
25
31
|
exports.Unauthorized = Unauthorized;
|
|
32
|
+
exports.Unauthorized = Unauthorized = __decorate([
|
|
33
|
+
(0, decorators_js_1.HandleException)(exceptions_1.AuthenticationFailed),
|
|
34
|
+
(0, di_1.Injectable)(Response),
|
|
35
|
+
__metadata("design:paramtypes", [Object, Object])
|
|
36
|
+
], Unauthorized);
|
|
26
37
|
//# sourceMappingURL=unauthorized.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unauthorized.js","sourceRoot":"","sources":["../../../src/response-methods/unauthorized.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"unauthorized.js","sourceRoot":"","sources":["../../../src/response-methods/unauthorized.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,oDAAsE;AACtE,mDAAqD;AACrD,oDAA2D;AAC3D,oDAAmD;AACnD,oCAAyC;AAEzC;;;;GAIG;AAII,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,kCAAkB;IAIlD,YAAY,IAAwC,EAAY,OAA0B;QACxF,KAAK,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QADyC,YAAO,GAAP,OAAO,CAAmB;QAHhF,eAAU,GAAG,gCAAgB,CAAC,YAAY,CAAC;QAC3C,cAAS,GAAG,kBAAkB,CAAC;IAIzC,CAAC;CACF,CAAA;AAPY,oCAAY;uBAAZ,YAAY;IAFxB,IAAA,+BAAe,EAAC,iCAAoB,CAAC;IACrC,IAAA,eAAU,EAAC,QAAQ,CAAC;;GACR,YAAY,CAOxB"}
|
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import { IResponseOptions } from '../interfaces.js';
|
|
4
|
-
import { BadRequest } from './badRequest.js';
|
|
1
|
+
import { HTTP_STATUS_CODE, IResponseOptions } from '../interfaces.js';
|
|
2
|
+
import { BadRequestResponse } from './badRequest.js';
|
|
5
3
|
/**
|
|
6
4
|
* Internall response function.
|
|
7
5
|
* Returns HTTP 400 BAD REQUEST ERROR
|
|
8
6
|
* @param err - error to send
|
|
9
7
|
*/
|
|
10
|
-
export declare class ValidationError extends
|
|
8
|
+
export declare class ValidationError extends BadRequestResponse {
|
|
11
9
|
protected options?: IResponseOptions;
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
protected _errorCode: HTTP_STATUS_CODE;
|
|
11
|
+
protected _template: string;
|
|
12
|
+
constructor(data: string | object | Promise<unknown>, options?: IResponseOptions);
|
|
14
13
|
}
|
|
15
14
|
//# sourceMappingURL=validationError.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validationError.d.ts","sourceRoot":"","sources":["../../../src/response-methods/validationError.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"validationError.d.ts","sourceRoot":"","sources":["../../../src/response-methods/validationError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAKrD;;;;GAIG;AAEH,qBAEa,eAAgB,SAAQ,kBAAkB;IAIC,SAAS,CAAC,OAAO,CAAC,EAAE,gBAAgB;IAH1F,SAAS,CAAC,UAAU,mBAAgC;IACpD,SAAS,CAAC,SAAS,SAAyB;gBAEhC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,EAAY,OAAO,CAAC,EAAE,gBAAgB;CAG3F"}
|