@spinajs/http 2.0.46 → 2.0.49
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/README.md +11 -11
- package/lib/config/http.d.ts +1 -0
- package/lib/config/http.d.ts.map +1 -0
- package/lib/config/http.js +5 -7
- package/lib/config/http.js.map +1 -1
- package/lib/controllers.d.ts +4 -3
- package/lib/controllers.d.ts.map +1 -0
- package/lib/controllers.js +37 -65
- package/lib/controllers.js.map +1 -1
- package/lib/decorators.d.ts +3 -2
- package/lib/decorators.d.ts.map +1 -0
- package/lib/decorators.js +68 -100
- package/lib/decorators.js.map +1 -1
- package/lib/exceptions.d.ts +2 -0
- package/lib/exceptions.d.ts.map +1 -0
- package/lib/exceptions.js +1 -0
- package/lib/index.d.ts +9 -8
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +8 -24
- package/lib/index.js.map +1 -1
- package/lib/interfaces.d.ts +3 -2
- package/lib/interfaces.d.ts.map +1 -0
- package/lib/interfaces.js +16 -24
- package/lib/interfaces.js.map +1 -1
- package/lib/middlewares/RequestId.d.ts +2 -1
- package/lib/middlewares/RequestId.d.ts.map +1 -0
- package/lib/middlewares/RequestId.js +7 -10
- package/lib/middlewares/RequestId.js.map +1 -1
- package/lib/middlewares/ResponseTime.d.ts +2 -1
- package/lib/middlewares/ResponseTime.d.ts.map +1 -0
- package/lib/middlewares/ResponseTime.js +5 -8
- package/lib/middlewares/ResponseTime.js.map +1 -1
- package/lib/response-methods/badRequest.d.ts +3 -1
- package/lib/response-methods/badRequest.d.ts.map +1 -0
- package/lib/response-methods/badRequest.js +4 -8
- package/lib/response-methods/badRequest.js.map +1 -1
- package/lib/response-methods/conflict.d.ts +3 -1
- package/lib/response-methods/conflict.d.ts.map +1 -0
- package/lib/response-methods/conflict.js +4 -8
- package/lib/response-methods/conflict.js.map +1 -1
- package/lib/response-methods/cookieResponse.d.ts +3 -1
- package/lib/response-methods/cookieResponse.d.ts.map +1 -0
- package/lib/response-methods/cookieResponse.js +8 -35
- package/lib/response-methods/cookieResponse.js.map +1 -1
- package/lib/response-methods/created.d.ts +3 -1
- package/lib/response-methods/created.d.ts.map +1 -0
- package/lib/response-methods/created.js +4 -8
- package/lib/response-methods/created.js.map +1 -1
- package/lib/response-methods/file.d.ts +2 -1
- package/lib/response-methods/file.d.ts.map +1 -0
- package/lib/response-methods/file.js +15 -46
- package/lib/response-methods/file.js.map +1 -1
- package/lib/response-methods/forbidden.d.ts +3 -1
- package/lib/response-methods/forbidden.d.ts.map +1 -0
- package/lib/response-methods/forbidden.js +4 -8
- package/lib/response-methods/forbidden.js.map +1 -1
- package/lib/response-methods/index.d.ts +14 -13
- package/lib/response-methods/index.d.ts.map +1 -0
- package/lib/response-methods/index.js +13 -29
- package/lib/response-methods/index.js.map +1 -1
- package/lib/response-methods/noContent.d.ts +3 -1
- package/lib/response-methods/noContent.d.ts.map +1 -0
- package/lib/response-methods/noContent.js +4 -8
- package/lib/response-methods/noContent.js.map +1 -1
- package/lib/response-methods/notAllowed.d.ts +3 -1
- package/lib/response-methods/notAllowed.d.ts.map +1 -0
- package/lib/response-methods/notAllowed.js +4 -8
- package/lib/response-methods/notAllowed.js.map +1 -1
- package/lib/response-methods/notFound.d.ts +3 -1
- package/lib/response-methods/notFound.d.ts.map +1 -0
- package/lib/response-methods/notFound.js +4 -8
- package/lib/response-methods/notFound.js.map +1 -1
- package/lib/response-methods/ok.d.ts +3 -1
- package/lib/response-methods/ok.d.ts.map +1 -0
- package/lib/response-methods/ok.js +4 -8
- package/lib/response-methods/ok.js.map +1 -1
- package/lib/response-methods/pug.d.ts +3 -1
- package/lib/response-methods/pug.d.ts.map +1 -0
- package/lib/response-methods/pug.js +4 -8
- package/lib/response-methods/pug.js.map +1 -1
- package/lib/response-methods/redirect.d.ts +2 -1
- package/lib/response-methods/redirect.d.ts.map +1 -0
- package/lib/response-methods/redirect.js +2 -6
- package/lib/response-methods/redirect.js.map +1 -1
- package/lib/response-methods/serverError.d.ts +3 -1
- package/lib/response-methods/serverError.d.ts.map +1 -0
- package/lib/response-methods/serverError.js +4 -8
- package/lib/response-methods/serverError.js.map +1 -1
- package/lib/response-methods/unauthorized.d.ts +3 -1
- package/lib/response-methods/unauthorized.d.ts.map +1 -0
- package/lib/response-methods/unauthorized.js +4 -8
- package/lib/response-methods/unauthorized.js.map +1 -1
- package/lib/responses.d.ts +2 -1
- package/lib/responses.d.ts.map +1 -0
- package/lib/responses.js +25 -55
- package/lib/responses.js.map +1 -1
- package/lib/route-args/ArgAsRequest.d.ts +3 -2
- package/lib/route-args/ArgAsRequest.d.ts.map +1 -0
- package/lib/route-args/ArgAsRequest.js +7 -10
- package/lib/route-args/ArgAsRequest.js.map +1 -1
- package/lib/route-args/ArgAsResponse.d.ts +3 -2
- package/lib/route-args/ArgAsResponse.d.ts.map +1 -0
- package/lib/route-args/ArgAsResponse.js +7 -10
- package/lib/route-args/ArgAsResponse.js.map +1 -1
- package/lib/route-args/ArgHydrator.d.ts +2 -1
- package/lib/route-args/ArgHydrator.d.ts.map +1 -0
- package/lib/route-args/ArgHydrator.js +1 -5
- package/lib/route-args/ArgHydrator.js.map +1 -1
- package/lib/route-args/FromBody.d.ts +3 -2
- package/lib/route-args/FromBody.d.ts.map +1 -0
- package/lib/route-args/FromBody.js +8 -11
- package/lib/route-args/FromBody.js.map +1 -1
- package/lib/route-args/FromCookie.d.ts +3 -2
- package/lib/route-args/FromCookie.d.ts.map +1 -0
- package/lib/route-args/FromCookie.js +12 -39
- package/lib/route-args/FromCookie.js.map +1 -1
- package/lib/route-args/FromDi.d.ts +3 -2
- package/lib/route-args/FromDi.d.ts.map +1 -0
- package/lib/route-args/FromDi.js +7 -10
- package/lib/route-args/FromDi.js.map +1 -1
- package/lib/route-args/FromForm.d.ts +4 -3
- package/lib/route-args/FromForm.d.ts.map +1 -0
- package/lib/route-args/FromForm.js +64 -54
- package/lib/route-args/FromForm.js.map +1 -1
- package/lib/route-args/FromHeaderArg.d.ts +3 -2
- package/lib/route-args/FromHeaderArg.d.ts.map +1 -0
- package/lib/route-args/FromHeaderArg.js +9 -12
- package/lib/route-args/FromHeaderArg.js.map +1 -1
- package/lib/route-args/FromParams.d.ts +3 -2
- package/lib/route-args/FromParams.d.ts.map +1 -0
- package/lib/route-args/FromParams.js +7 -10
- package/lib/route-args/FromParams.js.map +1 -1
- package/lib/route-args/FromQuery.d.ts +3 -2
- package/lib/route-args/FromQuery.d.ts.map +1 -0
- package/lib/route-args/FromQuery.js +7 -10
- package/lib/route-args/FromQuery.js.map +1 -1
- package/lib/route-args/RouteArgs.d.ts +2 -1
- package/lib/route-args/RouteArgs.d.ts.map +1 -0
- package/lib/route-args/RouteArgs.js +20 -27
- package/lib/route-args/RouteArgs.js.map +1 -1
- package/lib/route-args/index.d.ts +12 -11
- package/lib/route-args/index.d.ts.map +1 -0
- package/lib/route-args/index.js +11 -27
- package/lib/route-args/index.js.map +1 -1
- package/lib/schemas/RouteArgsSchemas.d.ts +1 -0
- package/lib/schemas/RouteArgsSchemas.d.ts.map +1 -0
- package/lib/schemas/RouteArgsSchemas.js +1 -4
- package/lib/schemas/RouteArgsSchemas.js.map +1 -1
- package/lib/server.d.ts +4 -3
- package/lib/server.d.ts.map +1 -0
- package/lib/server.js +45 -68
- package/lib/server.js.map +1 -1
- package/lib/transformers/PureTransformer.d.ts +2 -1
- package/lib/transformers/PureTransformer.d.ts.map +1 -0
- package/lib/transformers/PureTransformer.js +6 -9
- package/lib/transformers/PureTransformer.js.map +1 -1
- package/lib/transformers/index.d.ts +2 -1
- package/lib/transformers/index.d.ts.map +1 -0
- package/lib/transformers/index.js +1 -17
- package/lib/transformers/index.js.map +1 -1
- package/package.json +80 -81
- package/lib/static/favicon.ico +0 -0
- package/lib/static/style.css +0 -15
- package/lib/views/responses/badRequest.pug +0 -13
- package/lib/views/responses/conflict.pug +0 -13
- package/lib/views/responses/forbidden.pug +0 -13
- package/lib/views/responses/noContent.pug +0 -13
- package/lib/views/responses/not-allowed.pug +0 -13
- package/lib/views/responses/notFound.pug +0 -13
- package/lib/views/responses/ok.pug +0 -12
- package/lib/views/responses/serverError.pug +0 -13
- package/lib/views/responses/unauthorized.pug +0 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../src/response-methods/file.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../src/response-methods/file.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
/// <reference types="qs" />
|
|
1
2
|
import * as express from 'express';
|
|
2
|
-
import { Response } from '../interfaces';
|
|
3
|
+
import { Response } from '../interfaces.js';
|
|
3
4
|
/**
|
|
4
5
|
* Internall response function.
|
|
5
6
|
* Returns HTTP 403 FORBIDDEN ERROR
|
|
@@ -9,3 +10,4 @@ export declare class Forbidden extends Response {
|
|
|
9
10
|
constructor(data: any);
|
|
10
11
|
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>;
|
|
11
12
|
}
|
|
13
|
+
//# sourceMappingURL=forbidden.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"forbidden.d.ts","sourceRoot":"","sources":["../../src/response-methods/forbidden.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAoB,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG9D;;;;GAIG;AAEH,qBAAa,SAAU,SAAQ,QAAQ;gBACzB,IAAI,EAAE,GAAG;IAIR,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ;CAGnE"}
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.Forbidden = void 0;
|
|
4
|
-
const interfaces_1 = require("../interfaces");
|
|
5
|
-
const responses_1 = require("../responses");
|
|
1
|
+
import { HTTP_STATUS_CODE, Response } from '../interfaces.js';
|
|
2
|
+
import { httpResponse } from '../responses.js';
|
|
6
3
|
/**
|
|
7
4
|
* Internall response function.
|
|
8
5
|
* Returns HTTP 403 FORBIDDEN ERROR
|
|
9
6
|
* @param err - error to send
|
|
10
7
|
*/
|
|
11
|
-
class Forbidden extends
|
|
8
|
+
export class Forbidden extends Response {
|
|
12
9
|
constructor(data) {
|
|
13
10
|
super(data);
|
|
14
11
|
}
|
|
15
12
|
async execute(_req, _res) {
|
|
16
|
-
return await
|
|
13
|
+
return await httpResponse(this.responseData, HTTP_STATUS_CODE.FORBIDDEN, 'responses/forbidden');
|
|
17
14
|
}
|
|
18
15
|
}
|
|
19
|
-
exports.Forbidden = Forbidden;
|
|
20
16
|
//# 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":"AACA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;GAIG;AAEH,MAAM,OAAO,SAAU,SAAQ,QAAQ;IACrC,YAAY,IAAS;QACnB,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAqB,EAAE,IAAsB;QAChE,OAAO,MAAM,YAAY,CAAC,IAAI,CAAC,YAAY,EAAE,gBAAgB,CAAC,SAAS,EAAE,qBAAqB,CAAC,CAAC;IAClG,CAAC;CACF"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
export * from './badRequest';
|
|
2
|
-
export * from './created';
|
|
3
|
-
export * from './file';
|
|
4
|
-
export * from './forbidden';
|
|
5
|
-
export * from './noContent';
|
|
6
|
-
export * from './notFound';
|
|
7
|
-
export * from './ok';
|
|
8
|
-
export * from './pug';
|
|
9
|
-
export * from './serverError';
|
|
10
|
-
export * from './unauthorized';
|
|
11
|
-
export * from './cookieResponse';
|
|
12
|
-
export * from './conflict';
|
|
13
|
-
export * from './notAllowed';
|
|
1
|
+
export * from './badRequest.js';
|
|
2
|
+
export * from './created.js';
|
|
3
|
+
export * from './file.js';
|
|
4
|
+
export * from './forbidden.js';
|
|
5
|
+
export * from './noContent.js';
|
|
6
|
+
export * from './notFound.js';
|
|
7
|
+
export * from './ok.js';
|
|
8
|
+
export * from './pug.js';
|
|
9
|
+
export * from './serverError.js';
|
|
10
|
+
export * from './unauthorized.js';
|
|
11
|
+
export * from './cookieResponse.js';
|
|
12
|
+
export * from './conflict.js';
|
|
13
|
+
export * from './notAllowed.js';
|
|
14
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/response-methods/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC"}
|
|
@@ -1,30 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./badRequest"), exports);
|
|
18
|
-
__exportStar(require("./created"), exports);
|
|
19
|
-
__exportStar(require("./file"), exports);
|
|
20
|
-
__exportStar(require("./forbidden"), exports);
|
|
21
|
-
__exportStar(require("./noContent"), exports);
|
|
22
|
-
__exportStar(require("./notFound"), exports);
|
|
23
|
-
__exportStar(require("./ok"), exports);
|
|
24
|
-
__exportStar(require("./pug"), exports);
|
|
25
|
-
__exportStar(require("./serverError"), exports);
|
|
26
|
-
__exportStar(require("./unauthorized"), exports);
|
|
27
|
-
__exportStar(require("./cookieResponse"), exports);
|
|
28
|
-
__exportStar(require("./conflict"), exports);
|
|
29
|
-
__exportStar(require("./notAllowed"), exports);
|
|
1
|
+
export * from './badRequest.js';
|
|
2
|
+
export * from './created.js';
|
|
3
|
+
export * from './file.js';
|
|
4
|
+
export * from './forbidden.js';
|
|
5
|
+
export * from './noContent.js';
|
|
6
|
+
export * from './notFound.js';
|
|
7
|
+
export * from './ok.js';
|
|
8
|
+
export * from './pug.js';
|
|
9
|
+
export * from './serverError.js';
|
|
10
|
+
export * from './unauthorized.js';
|
|
11
|
+
export * from './cookieResponse.js';
|
|
12
|
+
export * from './conflict.js';
|
|
13
|
+
export * from './notAllowed.js';
|
|
30
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/response-methods/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/response-methods/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,eAAe,CAAC;AAC9B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
/// <reference types="qs" />
|
|
1
2
|
import * as express from 'express';
|
|
2
|
-
import { Response } from '../interfaces';
|
|
3
|
+
import { Response } from '../interfaces.js';
|
|
3
4
|
/**
|
|
4
5
|
* Internall response function.
|
|
5
6
|
* Returns HTTP 204 NO CONTENT
|
|
@@ -9,3 +10,4 @@ export declare class NoContent extends Response {
|
|
|
9
10
|
constructor(data: any);
|
|
10
11
|
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>;
|
|
11
12
|
}
|
|
13
|
+
//# sourceMappingURL=noContent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"noContent.d.ts","sourceRoot":"","sources":["../../src/response-methods/noContent.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAoB,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG9D;;;;GAIG;AACH,qBAAa,SAAU,SAAQ,QAAQ;gBACzB,IAAI,EAAE,GAAG;IAIR,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ;CAGnE"}
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.NoContent = void 0;
|
|
4
|
-
const interfaces_1 = require("../interfaces");
|
|
5
|
-
const responses_1 = require("../responses");
|
|
1
|
+
import { HTTP_STATUS_CODE, Response } from '../interfaces.js';
|
|
2
|
+
import { httpResponse } from '../responses.js';
|
|
6
3
|
/**
|
|
7
4
|
* Internall response function.
|
|
8
5
|
* Returns HTTP 204 NO CONTENT
|
|
9
6
|
* @param err - error to send
|
|
10
7
|
*/
|
|
11
|
-
class NoContent extends
|
|
8
|
+
export class NoContent extends Response {
|
|
12
9
|
constructor(data) {
|
|
13
10
|
super(data);
|
|
14
11
|
}
|
|
15
12
|
async execute(_req, _res) {
|
|
16
|
-
return await
|
|
13
|
+
return await httpResponse(this.responseData, HTTP_STATUS_CODE.NO_CONTENT, 'responses/noContent');
|
|
17
14
|
}
|
|
18
15
|
}
|
|
19
|
-
exports.NoContent = NoContent;
|
|
20
16
|
//# sourceMappingURL=noContent.js.map
|
|
@@ -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":"AACA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;GAIG;AACH,MAAM,OAAO,SAAU,SAAQ,QAAQ;IACrC,YAAY,IAAS;QACnB,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAqB,EAAE,IAAsB;QAChE,OAAO,MAAM,YAAY,CAAC,IAAI,CAAC,YAAY,EAAE,gBAAgB,CAAC,UAAU,EAAE,qBAAqB,CAAC,CAAC;IACnG,CAAC;CACF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
/// <reference types="qs" />
|
|
1
2
|
import * as express from 'express';
|
|
2
|
-
import { Response } from '../interfaces';
|
|
3
|
+
import { Response } from '../interfaces.js';
|
|
3
4
|
/**
|
|
4
5
|
* Internall response function.
|
|
5
6
|
* Returns HTTP 403 FORBIDDEN ERROR
|
|
@@ -9,3 +10,4 @@ export declare class NotAllowed extends Response {
|
|
|
9
10
|
constructor(data: any);
|
|
10
11
|
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>;
|
|
11
12
|
}
|
|
13
|
+
//# sourceMappingURL=notAllowed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notAllowed.d.ts","sourceRoot":"","sources":["../../src/response-methods/notAllowed.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAoB,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG9D;;;;GAIG;AAEH,qBAAa,UAAW,SAAQ,QAAQ;gBAC1B,IAAI,EAAE,GAAG;IAIR,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ;CAGnE"}
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.NotAllowed = void 0;
|
|
4
|
-
const interfaces_1 = require("../interfaces");
|
|
5
|
-
const responses_1 = require("../responses");
|
|
1
|
+
import { HTTP_STATUS_CODE, Response } from '../interfaces.js';
|
|
2
|
+
import { httpResponse } from '../responses.js';
|
|
6
3
|
/**
|
|
7
4
|
* Internall response function.
|
|
8
5
|
* Returns HTTP 403 FORBIDDEN ERROR
|
|
9
6
|
* @param err - error to send
|
|
10
7
|
*/
|
|
11
|
-
class NotAllowed extends
|
|
8
|
+
export class NotAllowed extends Response {
|
|
12
9
|
constructor(data) {
|
|
13
10
|
super(data);
|
|
14
11
|
}
|
|
15
12
|
async execute(_req, _res) {
|
|
16
|
-
return await
|
|
13
|
+
return await httpResponse(this.responseData, HTTP_STATUS_CODE.NOT_ALLOWED, 'responses/not-allowed');
|
|
17
14
|
}
|
|
18
15
|
}
|
|
19
|
-
exports.NotAllowed = NotAllowed;
|
|
20
16
|
//# sourceMappingURL=notAllowed.js.map
|
|
@@ -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":"AACA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;GAIG;AAEH,MAAM,OAAO,UAAW,SAAQ,QAAQ;IACtC,YAAY,IAAS;QACnB,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAqB,EAAE,IAAsB;QAChE,OAAO,MAAM,YAAY,CAAC,IAAI,CAAC,YAAY,EAAE,gBAAgB,CAAC,WAAW,EAAE,uBAAuB,CAAC,CAAC;IACtG,CAAC;CACF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
/// <reference types="qs" />
|
|
1
2
|
import * as express from 'express';
|
|
2
|
-
import { Response } from '../interfaces';
|
|
3
|
+
import { Response } from '../interfaces.js';
|
|
3
4
|
/**
|
|
4
5
|
* Internall response function.
|
|
5
6
|
* Returns HTTP 404 NOT FOUND ERROR
|
|
@@ -9,3 +10,4 @@ export declare class NotFound extends Response {
|
|
|
9
10
|
constructor(data?: any);
|
|
10
11
|
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>;
|
|
11
12
|
}
|
|
13
|
+
//# sourceMappingURL=notFound.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"notFound.d.ts","sourceRoot":"","sources":["../../src/response-methods/notFound.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAoB,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG9D;;;;GAIG;AACH,qBAAa,QAAS,SAAQ,QAAQ;gBACxB,IAAI,CAAC,EAAE,GAAG;IAIT,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ;CAGnE"}
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.NotFound = void 0;
|
|
4
|
-
const interfaces_1 = require("../interfaces");
|
|
5
|
-
const responses_1 = require("../responses");
|
|
1
|
+
import { HTTP_STATUS_CODE, Response } from '../interfaces.js';
|
|
2
|
+
import { httpResponse } from '../responses.js';
|
|
6
3
|
/**
|
|
7
4
|
* Internall response function.
|
|
8
5
|
* Returns HTTP 404 NOT FOUND ERROR
|
|
9
6
|
* @param err - error to send
|
|
10
7
|
*/
|
|
11
|
-
class NotFound extends
|
|
8
|
+
export class NotFound extends Response {
|
|
12
9
|
constructor(data) {
|
|
13
10
|
super(data);
|
|
14
11
|
}
|
|
15
12
|
async execute(_req, _res) {
|
|
16
|
-
return await
|
|
13
|
+
return await httpResponse(this.responseData, HTTP_STATUS_CODE.NOT_FOUND, 'responses/notFound');
|
|
17
14
|
}
|
|
18
15
|
}
|
|
19
|
-
exports.NotFound = NotFound;
|
|
20
16
|
//# 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":"AACA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;GAIG;AACH,MAAM,OAAO,QAAS,SAAQ,QAAQ;IACpC,YAAY,IAAU;QACpB,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAqB,EAAE,IAAsB;QAChE,OAAO,MAAM,YAAY,CAAC,IAAI,CAAC,YAAY,EAAE,gBAAgB,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;IACjG,CAAC;CACF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
/// <reference types="qs" />
|
|
1
2
|
import * as express from 'express';
|
|
2
|
-
import { Response } from '../interfaces';
|
|
3
|
+
import { Response } from '../interfaces.js';
|
|
3
4
|
/**
|
|
4
5
|
* Internall response function.
|
|
5
6
|
* Returns HTTP 200 OK response with json content
|
|
@@ -9,3 +10,4 @@ export declare class Ok extends Response {
|
|
|
9
10
|
constructor(data?: any);
|
|
10
11
|
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>;
|
|
11
12
|
}
|
|
13
|
+
//# sourceMappingURL=ok.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ok.d.ts","sourceRoot":"","sources":["../../src/response-methods/ok.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAoB,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG9D;;;;GAIG;AACH,qBAAa,EAAG,SAAQ,QAAQ;gBAClB,IAAI,CAAC,EAAE,GAAG;IAIT,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ;CAGnE"}
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.Ok = void 0;
|
|
4
|
-
const interfaces_1 = require("../interfaces");
|
|
5
|
-
const responses_1 = require("../responses");
|
|
1
|
+
import { HTTP_STATUS_CODE, Response } from '../interfaces.js';
|
|
2
|
+
import { httpResponse } from '../responses.js';
|
|
6
3
|
/**
|
|
7
4
|
* Internall response function.
|
|
8
5
|
* Returns HTTP 200 OK response with json content
|
|
9
6
|
* @param data - data to send
|
|
10
7
|
*/
|
|
11
|
-
class Ok extends
|
|
8
|
+
export class Ok extends Response {
|
|
12
9
|
constructor(data) {
|
|
13
10
|
super(data);
|
|
14
11
|
}
|
|
15
12
|
async execute(_req, _res) {
|
|
16
|
-
return await
|
|
13
|
+
return await httpResponse(this.responseData, HTTP_STATUS_CODE.OK, 'responses/ok');
|
|
17
14
|
}
|
|
18
15
|
}
|
|
19
|
-
exports.Ok = Ok;
|
|
20
16
|
//# sourceMappingURL=ok.js.map
|
|
@@ -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":"AACA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;GAIG;AACH,MAAM,OAAO,EAAG,SAAQ,QAAQ;IAC9B,YAAY,IAAU;QACpB,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAqB,EAAE,IAAsB;QAChE,OAAO,MAAM,YAAY,CAAC,IAAI,CAAC,YAAY,EAAE,gBAAgB,CAAC,EAAE,EAAE,cAAc,CAAC,CAAC;IACpF,CAAC;CACF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
/// <reference types="qs" />
|
|
1
2
|
import * as express from 'express';
|
|
2
|
-
import { HTTP_STATUS_CODE, Response } from '../interfaces';
|
|
3
|
+
import { HTTP_STATUS_CODE, Response } from '../interfaces.js';
|
|
3
4
|
/**
|
|
4
5
|
* HTML resposne with HTML from pug file
|
|
5
6
|
*/
|
|
@@ -9,3 +10,4 @@ export declare class TemplateResponse extends Response {
|
|
|
9
10
|
constructor(file: string, model: any, status?: HTTP_STATUS_CODE);
|
|
10
11
|
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>;
|
|
11
12
|
}
|
|
13
|
+
//# sourceMappingURL=pug.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pug.d.ts","sourceRoot":"","sources":["../../src/response-methods/pug.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG9D;;GAEG;AACH,qBAAa,gBAAiB,SAAQ,QAAQ;IAC5C,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC;IACvB,SAAS,CAAC,MAAM,EAAE,gBAAgB,CAAQ;gBAE9B,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,gBAAgB;IAOlD,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ;CAGnE"}
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.TemplateResponse = void 0;
|
|
4
|
-
const interfaces_1 = require("../interfaces");
|
|
5
|
-
const responses_1 = require("../responses");
|
|
1
|
+
import { HTTP_STATUS_CODE, Response } from '../interfaces.js';
|
|
2
|
+
import { htmlResponse } from '../responses.js';
|
|
6
3
|
/**
|
|
7
4
|
* HTML resposne with HTML from pug file
|
|
8
5
|
*/
|
|
9
|
-
class TemplateResponse extends
|
|
6
|
+
export class TemplateResponse extends Response {
|
|
10
7
|
constructor(file, model, status) {
|
|
11
8
|
super(model);
|
|
12
9
|
this.status = null;
|
|
@@ -14,8 +11,7 @@ class TemplateResponse extends interfaces_1.Response {
|
|
|
14
11
|
this.status = status;
|
|
15
12
|
}
|
|
16
13
|
async execute(_req, _res) {
|
|
17
|
-
return await
|
|
14
|
+
return await htmlResponse(this.file, this.responseData, this.status ? this.status : HTTP_STATUS_CODE.OK);
|
|
18
15
|
}
|
|
19
16
|
}
|
|
20
|
-
exports.TemplateResponse = TemplateResponse;
|
|
21
17
|
//# sourceMappingURL=pug.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pug.js","sourceRoot":"","sources":["../../src/response-methods/pug.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"pug.js","sourceRoot":"","sources":["../../src/response-methods/pug.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;GAEG;AACH,MAAM,OAAO,gBAAiB,SAAQ,QAAQ;IAI5C,YAAY,IAAY,EAAE,KAAU,EAAE,MAAyB;QAC7D,KAAK,CAAC,KAAK,CAAC,CAAC;QAHL,WAAM,GAAqB,IAAI,CAAC;QAKxC,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACvB,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAqB,EAAE,IAAsB;QAChE,OAAO,MAAM,YAAY,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,YAAY,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,gBAAgB,CAAC,EAAE,CAAC,CAAC;IAC3G,CAAC;CACF"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as express from 'express';
|
|
2
|
-
import { Response } from '../interfaces';
|
|
2
|
+
import { Response } from '../interfaces.js';
|
|
3
3
|
/**
|
|
4
4
|
* Redirects to another route ( simple alias for request.redirect for api consistency)
|
|
5
5
|
*
|
|
@@ -10,3 +10,4 @@ export declare class Redirect extends Response {
|
|
|
10
10
|
constructor(url: any);
|
|
11
11
|
execute(_req: express.Request, res: express.Response): Promise<void>;
|
|
12
12
|
}
|
|
13
|
+
//# sourceMappingURL=redirect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redirect.d.ts","sourceRoot":"","sources":["../../src/response-methods/redirect.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;GAIG;AACH,qBAAa,QAAS,SAAQ,QAAQ;IACpC,SAAS,CAAC,GAAG,EAAE,MAAM,CAAC;gBAEV,GAAG,EAAE,GAAG;IAMP,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,QAAQ;CAGlE"}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Redirect = void 0;
|
|
4
|
-
const interfaces_1 = require("../interfaces");
|
|
1
|
+
import { Response } from '../interfaces.js';
|
|
5
2
|
/**
|
|
6
3
|
* Redirects to another route ( simple alias for request.redirect for api consistency)
|
|
7
4
|
*
|
|
8
5
|
* @param url - url path to another location
|
|
9
6
|
*/
|
|
10
|
-
class Redirect extends
|
|
7
|
+
export class Redirect extends Response {
|
|
11
8
|
constructor(url) {
|
|
12
9
|
super(null);
|
|
13
10
|
this.url = url;
|
|
@@ -16,5 +13,4 @@ class Redirect extends interfaces_1.Response {
|
|
|
16
13
|
res.redirect(this.url);
|
|
17
14
|
}
|
|
18
15
|
}
|
|
19
|
-
exports.Redirect = Redirect;
|
|
20
16
|
//# sourceMappingURL=redirect.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redirect.js","sourceRoot":"","sources":["../../src/response-methods/redirect.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"redirect.js","sourceRoot":"","sources":["../../src/response-methods/redirect.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C;;;;GAIG;AACH,MAAM,OAAO,QAAS,SAAQ,QAAQ;IAGpC,YAAY,GAAQ;QAClB,KAAK,CAAC,IAAI,CAAC,CAAC;QAEZ,IAAI,CAAC,GAAG,GAAG,GAAG,CAAC;IACjB,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAqB,EAAE,GAAqB;QAC/D,GAAG,CAAC,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
/// <reference types="qs" />
|
|
1
2
|
import * as express from 'express';
|
|
2
|
-
import { Response } from '../interfaces';
|
|
3
|
+
import { Response } from '../interfaces.js';
|
|
3
4
|
/**
|
|
4
5
|
* Internall response function.
|
|
5
6
|
* Returns HTTP 500 INTERNAL SERVER ERROR
|
|
@@ -9,3 +10,4 @@ export declare class ServerError extends Response {
|
|
|
9
10
|
constructor(data: any);
|
|
10
11
|
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>;
|
|
11
12
|
}
|
|
13
|
+
//# sourceMappingURL=serverError.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serverError.d.ts","sourceRoot":"","sources":["../../src/response-methods/serverError.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAoB,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG9D;;;;GAIG;AAEH,qBAAa,WAAY,SAAQ,QAAQ;gBAC3B,IAAI,EAAE,GAAG;IAIR,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ;CAGnE"}
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.ServerError = void 0;
|
|
4
|
-
const interfaces_1 = require("../interfaces");
|
|
5
|
-
const responses_1 = require("../responses");
|
|
1
|
+
import { HTTP_STATUS_CODE, Response } from '../interfaces.js';
|
|
2
|
+
import { httpResponse } from '../responses.js';
|
|
6
3
|
/**
|
|
7
4
|
* Internall response function.
|
|
8
5
|
* Returns HTTP 500 INTERNAL SERVER ERROR
|
|
9
6
|
* @param err - error to send
|
|
10
7
|
*/
|
|
11
|
-
class ServerError extends
|
|
8
|
+
export class ServerError extends Response {
|
|
12
9
|
constructor(data) {
|
|
13
10
|
super(data);
|
|
14
11
|
}
|
|
15
12
|
async execute(_req, _res) {
|
|
16
|
-
return await
|
|
13
|
+
return await httpResponse({ error: this.responseData }, HTTP_STATUS_CODE.INTERNAL_ERROR, 'responses/serverError');
|
|
17
14
|
}
|
|
18
15
|
}
|
|
19
|
-
exports.ServerError = ServerError;
|
|
20
16
|
//# 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":"AACA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;GAIG;AAEH,MAAM,OAAO,WAAY,SAAQ,QAAQ;IACvC,YAAY,IAAS;QACnB,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAqB,EAAE,IAAsB;QAChE,OAAO,MAAM,YAAY,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,YAAY,EAAE,EAAE,gBAAgB,CAAC,cAAc,EAAE,uBAAuB,CAAC,CAAC;IACpH,CAAC;CACF"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
/// <reference types="qs" />
|
|
1
2
|
import * as express from 'express';
|
|
2
|
-
import { Response } from '../interfaces';
|
|
3
|
+
import { Response } from '../interfaces.js';
|
|
3
4
|
/**
|
|
4
5
|
* Internall response function.
|
|
5
6
|
* Returns HTTP 401 UNAHTORIZED response with json content
|
|
@@ -9,3 +10,4 @@ export declare class Unauthorized extends Response {
|
|
|
9
10
|
constructor(data: any);
|
|
10
11
|
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>;
|
|
11
12
|
}
|
|
13
|
+
//# sourceMappingURL=unauthorized.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"unauthorized.d.ts","sourceRoot":"","sources":["../../src/response-methods/unauthorized.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAoB,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAG9D;;;;GAIG;AAEH,qBAAa,YAAa,SAAQ,QAAQ;gBAC5B,IAAI,EAAE,GAAG;IAIR,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,IAAI,EAAE,OAAO,CAAC,QAAQ;CAGnE"}
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.Unauthorized = void 0;
|
|
4
|
-
const interfaces_1 = require("../interfaces");
|
|
5
|
-
const responses_1 = require("../responses");
|
|
1
|
+
import { HTTP_STATUS_CODE, Response } from '../interfaces.js';
|
|
2
|
+
import { httpResponse } from '../responses.js';
|
|
6
3
|
/**
|
|
7
4
|
* Internall response function.
|
|
8
5
|
* Returns HTTP 401 UNAHTORIZED response with json content
|
|
9
6
|
* @param data - data to send
|
|
10
7
|
*/
|
|
11
|
-
class Unauthorized extends
|
|
8
|
+
export class Unauthorized extends Response {
|
|
12
9
|
constructor(data) {
|
|
13
10
|
super(data);
|
|
14
11
|
}
|
|
15
12
|
async execute(_req, _res) {
|
|
16
|
-
return await
|
|
13
|
+
return await httpResponse(this.responseData, HTTP_STATUS_CODE.UNAUTHORIZED, 'responses/unauthorized');
|
|
17
14
|
}
|
|
18
15
|
}
|
|
19
|
-
exports.Unauthorized = Unauthorized;
|
|
20
16
|
//# 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":"AACA,OAAO,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;;;GAIG;AAEH,MAAM,OAAO,YAAa,SAAQ,QAAQ;IACxC,YAAY,IAAS;QACnB,KAAK,CAAC,IAAI,CAAC,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAqB,EAAE,IAAsB;QAChE,OAAO,MAAM,YAAY,CAAC,IAAI,CAAC,YAAY,EAAE,gBAAgB,CAAC,YAAY,EAAE,wBAAwB,CAAC,CAAC;IACxG,CAAC;CACF"}
|
package/lib/responses.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as express from 'express';
|
|
2
|
-
import { HTTP_STATUS_CODE } from './interfaces';
|
|
2
|
+
import { HTTP_STATUS_CODE } from './interfaces.js';
|
|
3
3
|
/**
|
|
4
4
|
* Sends data & sets proper header as json
|
|
5
5
|
*
|
|
@@ -32,3 +32,4 @@ export declare function htmlResponse(file: string, model: any, status?: HTTP_STA
|
|
|
32
32
|
* to `Accept` header
|
|
33
33
|
*/
|
|
34
34
|
export declare function httpResponse(model: any, code: HTTP_STATUS_CODE, template: string): (req: express.Request, res: express.Response) => void;
|
|
35
|
+
//# sourceMappingURL=responses.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"responses.d.ts","sourceRoot":"","sources":["../src/responses.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,EAAE,gBAAgB,EAAsC,MAAM,iBAAiB,CAAC;AASvF;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,gBAAgB,UAClD,eAAe,OAAO,gBAAgB,UASrD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,gBAAgB,UAClD,eAAe,OAAO,gBAAgB,UAQrD;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,CAAC,EAAE,gBAAgB,SAGjE,eAAe,OAAO,gBAAgB,UA6CpD;AAED;;;;;;;;GAQG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,gBAAgB,EAAE,QAAQ,EAAE,MAAM,SAIlE,eAAe,OAAO,gBAAgB,UA0BpD"}
|