@spinajs/http 2.0.180 → 2.0.181
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.d.ts +4 -4
- package/lib/cjs/bootstrap.js +29 -29
- package/lib/cjs/bootstrap.js.map +1 -1
- package/lib/cjs/config/http.d.ts +58 -58
- package/lib/cjs/config/http.js +86 -86
- package/lib/cjs/controllers.d.ts +48 -48
- package/lib/cjs/controllers.d.ts.map +1 -1
- package/lib/cjs/controllers.js +307 -312
- package/lib/cjs/controllers.js.map +1 -1
- package/lib/cjs/decorators.d.ts +183 -183
- package/lib/cjs/decorators.js +441 -441
- package/lib/cjs/hydrators/DateTimeHydrator.d.ts +5 -5
- package/lib/cjs/hydrators/DateTimeHydrator.js +36 -36
- package/lib/cjs/hydrators/DateTimeHydrator.js.map +1 -1
- package/lib/cjs/index.d.ts +9 -9
- package/lib/cjs/index.js +25 -25
- package/lib/cjs/interfaces.d.ts +569 -550
- package/lib/cjs/interfaces.d.ts.map +1 -1
- package/lib/cjs/interfaces.js +266 -259
- package/lib/cjs/interfaces.js.map +1 -1
- package/lib/cjs/middlewares/RealIp.d.ts +8 -8
- package/lib/cjs/middlewares/RealIp.js +34 -34
- package/lib/cjs/middlewares/RealIp.js.map +1 -1
- package/lib/cjs/middlewares/RequestId.d.ts +8 -8
- package/lib/cjs/middlewares/RequestId.js +35 -35
- package/lib/cjs/middlewares/RequestId.js.map +1 -1
- package/lib/cjs/middlewares/ResponseTime.d.ts +10 -10
- package/lib/cjs/middlewares/ResponseTime.js +41 -41
- package/lib/cjs/middlewares/ResponseTime.js.map +1 -1
- package/lib/cjs/response-methods/badRequest.d.ts +12 -12
- package/lib/cjs/response-methods/badRequest.js +20 -20
- package/lib/cjs/response-methods/conflict.d.ts +12 -12
- package/lib/cjs/response-methods/conflict.js +20 -20
- package/lib/cjs/response-methods/cookieResponse.d.ts +19 -19
- package/lib/cjs/response-methods/cookieResponse.js +73 -73
- package/lib/cjs/response-methods/created.d.ts +12 -12
- package/lib/cjs/response-methods/created.js +19 -19
- package/lib/cjs/response-methods/errorResponse.d.ts +7 -7
- package/lib/cjs/response-methods/errorResponse.js +24 -24
- package/lib/cjs/response-methods/file.d.ts +26 -26
- package/lib/cjs/response-methods/file.d.ts.map +1 -1
- package/lib/cjs/response-methods/file.js +112 -133
- package/lib/cjs/response-methods/file.js.map +1 -1
- package/lib/cjs/response-methods/forbidden.d.ts +12 -12
- package/lib/cjs/response-methods/forbidden.js +20 -20
- package/lib/cjs/response-methods/index.d.ts +13 -13
- package/lib/cjs/response-methods/index.js +29 -29
- package/lib/cjs/response-methods/noContent.d.ts +12 -12
- package/lib/cjs/response-methods/noContent.js +20 -20
- package/lib/cjs/response-methods/notAcceptable.d.ts +13 -13
- package/lib/cjs/response-methods/notAcceptable.js +21 -21
- package/lib/cjs/response-methods/notAllowed.d.ts +12 -12
- package/lib/cjs/response-methods/notAllowed.js +20 -20
- package/lib/cjs/response-methods/notFound.d.ts +12 -12
- package/lib/cjs/response-methods/notFound.js +20 -20
- package/lib/cjs/response-methods/ok.d.ts +12 -12
- package/lib/cjs/response-methods/ok.js +19 -19
- package/lib/cjs/response-methods/redirect.d.ts +12 -12
- package/lib/cjs/response-methods/redirect.js +19 -19
- package/lib/cjs/response-methods/serverError.d.ts +12 -12
- package/lib/cjs/response-methods/serverError.js +20 -20
- package/lib/cjs/response-methods/template.d.ts +15 -15
- package/lib/cjs/response-methods/template.js +36 -36
- package/lib/cjs/response-methods/unauthorized.d.ts +12 -12
- package/lib/cjs/response-methods/unauthorized.js +20 -20
- package/lib/cjs/response-methods/validationError.d.ts +12 -12
- package/lib/cjs/response-methods/validationError.js +20 -20
- package/lib/cjs/responses.d.ts +34 -34
- package/lib/cjs/responses.js +173 -173
- package/lib/cjs/route-args/ArgAsRequest.d.ts +11 -11
- package/lib/cjs/route-args/ArgAsRequest.js +24 -24
- package/lib/cjs/route-args/ArgAsRequest.js.map +1 -1
- package/lib/cjs/route-args/ArgAsResponse.d.ts +10 -10
- package/lib/cjs/route-args/ArgAsResponse.js +24 -24
- package/lib/cjs/route-args/ArgAsResponse.js.map +1 -1
- package/lib/cjs/route-args/ArgHydrator.d.ts +4 -4
- package/lib/cjs/route-args/ArgHydrator.js +6 -6
- package/lib/cjs/route-args/FromBody.d.ts +10 -10
- package/lib/cjs/route-args/FromBody.js +26 -26
- package/lib/cjs/route-args/FromBody.js.map +1 -1
- package/lib/cjs/route-args/FromCookie.d.ts +13 -13
- package/lib/cjs/route-args/FromCookie.js +72 -72
- package/lib/cjs/route-args/FromCookie.js.map +1 -1
- package/lib/cjs/route-args/FromDi.d.ts +13 -13
- package/lib/cjs/route-args/FromDi.js +35 -35
- package/lib/cjs/route-args/FromDi.js.map +1 -1
- package/lib/cjs/route-args/FromForm.d.ts +66 -92
- package/lib/cjs/route-args/FromForm.d.ts.map +1 -1
- package/lib/cjs/route-args/FromForm.js +214 -291
- package/lib/cjs/route-args/FromForm.js.map +1 -1
- package/lib/cjs/route-args/FromHeaderArg.d.ts +10 -10
- package/lib/cjs/route-args/FromHeaderArg.js +25 -25
- package/lib/cjs/route-args/FromHeaderArg.js.map +1 -1
- package/lib/cjs/route-args/FromParams.d.ts +10 -10
- package/lib/cjs/route-args/FromParams.js +27 -27
- package/lib/cjs/route-args/FromParams.js.map +1 -1
- package/lib/cjs/route-args/FromQuery.d.ts +10 -10
- package/lib/cjs/route-args/FromQuery.js +27 -27
- package/lib/cjs/route-args/FromQuery.js.map +1 -1
- package/lib/cjs/route-args/RequestFields.d.ts +40 -40
- package/lib/cjs/route-args/RequestFields.js +110 -110
- package/lib/cjs/route-args/RequestFields.js.map +1 -1
- package/lib/cjs/route-args/RouteArgs.d.ts +22 -22
- package/lib/cjs/route-args/RouteArgs.js +114 -114
- package/lib/cjs/route-args/RouteArgs.js.map +1 -1
- package/lib/cjs/route-args/index.d.ts +12 -12
- package/lib/cjs/route-args/index.js +28 -28
- package/lib/cjs/schemas/RouteArgsSchemas.d.ts +36 -36
- package/lib/cjs/schemas/RouteArgsSchemas.js +26 -26
- package/lib/cjs/server.d.ts +50 -50
- package/lib/cjs/server.js +272 -272
- package/lib/cjs/server.js.map +1 -1
- package/lib/cjs/transformers/PureTransformer.d.ts +9 -9
- package/lib/cjs/transformers/PureTransformer.js +27 -27
- package/lib/cjs/transformers/PureTransformer.js.map +1 -1
- package/lib/cjs/transformers/index.d.ts +1 -1
- package/lib/cjs/transformers/index.js +17 -17
- package/lib/cjs/uploaders/ImmediateFileUploader.d.ts +19 -0
- package/lib/cjs/uploaders/ImmediateFileUploader.d.ts.map +1 -0
- package/lib/cjs/uploaders/ImmediateFileUploader.js +69 -0
- package/lib/cjs/uploaders/ImmediateFileUploader.js.map +1 -0
- package/lib/mjs/bootstrap.d.ts +4 -4
- package/lib/mjs/bootstrap.js +26 -26
- package/lib/mjs/bootstrap.js.map +1 -1
- package/lib/mjs/config/http.d.ts +58 -58
- package/lib/mjs/config/http.js +81 -81
- package/lib/mjs/controllers.d.ts +48 -48
- package/lib/mjs/controllers.d.ts.map +1 -1
- package/lib/mjs/controllers.js +276 -281
- package/lib/mjs/controllers.js.map +1 -1
- package/lib/mjs/decorators.d.ts +183 -183
- package/lib/mjs/decorators.js +404 -404
- package/lib/mjs/exceptions.d.ts +1 -1
- package/lib/mjs/exceptions.js +1 -1
- package/lib/mjs/hydrators/DateTimeHydrator.d.ts +5 -5
- package/lib/mjs/hydrators/DateTimeHydrator.js +30 -30
- package/lib/mjs/hydrators/DateTimeHydrator.js.map +1 -1
- package/lib/mjs/index.d.ts +9 -9
- package/lib/mjs/index.js +9 -9
- package/lib/mjs/interfaces.d.ts +569 -550
- package/lib/mjs/interfaces.d.ts.map +1 -1
- package/lib/mjs/interfaces.js +257 -251
- package/lib/mjs/interfaces.js.map +1 -1
- package/lib/mjs/middlewares/RealIp.d.ts +8 -8
- package/lib/mjs/middlewares/RealIp.js +31 -31
- package/lib/mjs/middlewares/RealIp.js.map +1 -1
- package/lib/mjs/middlewares/RequestId.d.ts +8 -8
- package/lib/mjs/middlewares/RequestId.js +32 -32
- package/lib/mjs/middlewares/RequestId.js.map +1 -1
- package/lib/mjs/middlewares/ResponseTime.d.ts +10 -10
- package/lib/mjs/middlewares/ResponseTime.js +38 -38
- package/lib/mjs/middlewares/ResponseTime.js.map +1 -1
- package/lib/mjs/response-methods/badRequest.d.ts +12 -12
- package/lib/mjs/response-methods/badRequest.js +16 -16
- package/lib/mjs/response-methods/conflict.d.ts +12 -12
- package/lib/mjs/response-methods/conflict.js +16 -16
- package/lib/mjs/response-methods/cookieResponse.d.ts +19 -19
- package/lib/mjs/response-methods/cookieResponse.js +46 -46
- package/lib/mjs/response-methods/created.d.ts +12 -12
- package/lib/mjs/response-methods/created.js +15 -15
- package/lib/mjs/response-methods/errorResponse.d.ts +7 -7
- package/lib/mjs/response-methods/errorResponse.js +17 -17
- package/lib/mjs/response-methods/file.d.ts +26 -26
- package/lib/mjs/response-methods/file.d.ts.map +1 -1
- package/lib/mjs/response-methods/file.js +103 -124
- package/lib/mjs/response-methods/file.js.map +1 -1
- package/lib/mjs/response-methods/forbidden.d.ts +12 -12
- package/lib/mjs/response-methods/forbidden.js +16 -16
- package/lib/mjs/response-methods/index.d.ts +13 -13
- package/lib/mjs/response-methods/index.js +13 -13
- package/lib/mjs/response-methods/noContent.d.ts +12 -12
- package/lib/mjs/response-methods/noContent.js +16 -16
- package/lib/mjs/response-methods/notAcceptable.d.ts +13 -13
- package/lib/mjs/response-methods/notAcceptable.js +17 -17
- package/lib/mjs/response-methods/notAllowed.d.ts +12 -12
- package/lib/mjs/response-methods/notAllowed.js +16 -16
- package/lib/mjs/response-methods/notFound.d.ts +12 -12
- package/lib/mjs/response-methods/notFound.js +16 -16
- package/lib/mjs/response-methods/ok.d.ts +12 -12
- package/lib/mjs/response-methods/ok.js +15 -15
- package/lib/mjs/response-methods/redirect.d.ts +12 -12
- package/lib/mjs/response-methods/redirect.js +15 -15
- package/lib/mjs/response-methods/serverError.d.ts +12 -12
- package/lib/mjs/response-methods/serverError.js +16 -16
- package/lib/mjs/response-methods/template.d.ts +15 -15
- package/lib/mjs/response-methods/template.js +29 -29
- package/lib/mjs/response-methods/unauthorized.d.ts +12 -12
- package/lib/mjs/response-methods/unauthorized.js +16 -16
- package/lib/mjs/response-methods/validationError.d.ts +12 -12
- package/lib/mjs/response-methods/validationError.js +16 -16
- package/lib/mjs/responses.d.ts +34 -34
- package/lib/mjs/responses.js +143 -143
- package/lib/mjs/route-args/ArgAsRequest.d.ts +11 -11
- package/lib/mjs/route-args/ArgAsRequest.js +21 -21
- package/lib/mjs/route-args/ArgAsRequest.js.map +1 -1
- package/lib/mjs/route-args/ArgAsResponse.d.ts +10 -10
- package/lib/mjs/route-args/ArgAsResponse.js +21 -21
- package/lib/mjs/route-args/ArgAsResponse.js.map +1 -1
- package/lib/mjs/route-args/ArgHydrator.d.ts +4 -4
- package/lib/mjs/route-args/ArgHydrator.js +2 -2
- package/lib/mjs/route-args/FromBody.d.ts +10 -10
- package/lib/mjs/route-args/FromBody.js +23 -23
- package/lib/mjs/route-args/FromBody.js.map +1 -1
- package/lib/mjs/route-args/FromCookie.d.ts +13 -13
- package/lib/mjs/route-args/FromCookie.js +46 -46
- package/lib/mjs/route-args/FromCookie.js.map +1 -1
- package/lib/mjs/route-args/FromDi.d.ts +13 -13
- package/lib/mjs/route-args/FromDi.js +32 -32
- package/lib/mjs/route-args/FromDi.js.map +1 -1
- package/lib/mjs/route-args/FromForm.d.ts +66 -92
- package/lib/mjs/route-args/FromForm.d.ts.map +1 -1
- package/lib/mjs/route-args/FromForm.js +210 -284
- package/lib/mjs/route-args/FromForm.js.map +1 -1
- package/lib/mjs/route-args/FromHeaderArg.d.ts +10 -10
- package/lib/mjs/route-args/FromHeaderArg.js +22 -22
- package/lib/mjs/route-args/FromHeaderArg.js.map +1 -1
- package/lib/mjs/route-args/FromParams.d.ts +10 -10
- package/lib/mjs/route-args/FromParams.js +24 -24
- package/lib/mjs/route-args/FromParams.js.map +1 -1
- package/lib/mjs/route-args/FromQuery.d.ts +10 -10
- package/lib/mjs/route-args/FromQuery.js +24 -24
- package/lib/mjs/route-args/FromQuery.js.map +1 -1
- package/lib/mjs/route-args/RequestFields.d.ts +40 -40
- package/lib/mjs/route-args/RequestFields.js +107 -107
- package/lib/mjs/route-args/RequestFields.js.map +1 -1
- package/lib/mjs/route-args/RouteArgs.d.ts +22 -22
- package/lib/mjs/route-args/RouteArgs.js +107 -107
- package/lib/mjs/route-args/RouteArgs.js.map +1 -1
- package/lib/mjs/route-args/index.d.ts +12 -12
- package/lib/mjs/route-args/index.js +12 -12
- package/lib/mjs/schemas/RouteArgsSchemas.d.ts +36 -36
- package/lib/mjs/schemas/RouteArgsSchemas.js +23 -23
- package/lib/mjs/server.d.ts +50 -50
- package/lib/mjs/server.js +266 -266
- package/lib/mjs/server.js.map +1 -1
- package/lib/mjs/transformers/PureTransformer.d.ts +9 -9
- package/lib/mjs/transformers/PureTransformer.js +24 -24
- package/lib/mjs/transformers/PureTransformer.js.map +1 -1
- package/lib/mjs/transformers/index.d.ts +1 -1
- package/lib/mjs/transformers/index.js +1 -1
- package/lib/mjs/uploaders/ImmediateFileUploader.d.ts +19 -0
- package/lib/mjs/uploaders/ImmediateFileUploader.d.ts.map +1 -0
- package/lib/mjs/uploaders/ImmediateFileUploader.js +66 -0
- package/lib/mjs/uploaders/ImmediateFileUploader.js.map +1 -0
- package/lib/tsconfig.cjs.tsbuildinfo +1 -1
- package/lib/tsconfig.mjs.tsbuildinfo +1 -1
- package/package.json +17 -17
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/// <reference types="qs" />
|
|
2
|
-
import * as express from 'express';
|
|
3
|
-
import { ErrorResponse } from './errorResponse.js';
|
|
4
|
-
/**
|
|
5
|
-
* Internall response function.
|
|
6
|
-
* Returns HTTP 204 NO CONTENT
|
|
7
|
-
* @param err - error to send
|
|
8
|
-
*/
|
|
9
|
-
export declare class NoContent extends ErrorResponse {
|
|
10
|
-
constructor(data: any);
|
|
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>;
|
|
12
|
-
}
|
|
1
|
+
/// <reference types="qs" />
|
|
2
|
+
import * as express from 'express';
|
|
3
|
+
import { ErrorResponse } from './errorResponse.js';
|
|
4
|
+
/**
|
|
5
|
+
* Internall response function.
|
|
6
|
+
* Returns HTTP 204 NO CONTENT
|
|
7
|
+
* @param err - error to send
|
|
8
|
+
*/
|
|
9
|
+
export declare class NoContent extends ErrorResponse {
|
|
10
|
+
constructor(data: any);
|
|
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>;
|
|
12
|
+
}
|
|
13
13
|
//# sourceMappingURL=noContent.d.ts.map
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NoContent = void 0;
|
|
4
|
-
const interfaces_js_1 = require("../interfaces.js");
|
|
5
|
-
const responses_js_1 = require("../responses.js");
|
|
6
|
-
const errorResponse_js_1 = require("./errorResponse.js");
|
|
7
|
-
/**
|
|
8
|
-
* Internall response function.
|
|
9
|
-
* Returns HTTP 204 NO CONTENT
|
|
10
|
-
* @param err - error to send
|
|
11
|
-
*/
|
|
12
|
-
class NoContent extends errorResponse_js_1.ErrorResponse {
|
|
13
|
-
constructor(data) {
|
|
14
|
-
super(data);
|
|
15
|
-
}
|
|
16
|
-
async execute(_req, _res) {
|
|
17
|
-
return await (0, responses_js_1.httpResponse)(this.responseData, interfaces_js_1.HTTP_STATUS_CODE.NO_CONTENT, 'noContent.pug');
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
exports.NoContent = NoContent;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NoContent = void 0;
|
|
4
|
+
const interfaces_js_1 = require("../interfaces.js");
|
|
5
|
+
const responses_js_1 = require("../responses.js");
|
|
6
|
+
const errorResponse_js_1 = require("./errorResponse.js");
|
|
7
|
+
/**
|
|
8
|
+
* Internall response function.
|
|
9
|
+
* Returns HTTP 204 NO CONTENT
|
|
10
|
+
* @param err - error to send
|
|
11
|
+
*/
|
|
12
|
+
class NoContent extends errorResponse_js_1.ErrorResponse {
|
|
13
|
+
constructor(data) {
|
|
14
|
+
super(data);
|
|
15
|
+
}
|
|
16
|
+
async execute(_req, _res) {
|
|
17
|
+
return await (0, responses_js_1.httpResponse)(this.responseData, interfaces_js_1.HTTP_STATUS_CODE.NO_CONTENT, 'noContent.pug');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.NoContent = NoContent;
|
|
21
21
|
//# sourceMappingURL=noContent.js.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
/// <reference types="qs" />
|
|
2
|
-
import * as express from 'express';
|
|
3
|
-
import { ErrorResponse } from './errorResponse.js';
|
|
4
|
-
/**
|
|
5
|
-
* Internall response function.
|
|
6
|
-
* Returns HTTP 406 NOT ACCEPTABLE
|
|
7
|
-
* When content requested in accept header format cannot be returned.
|
|
8
|
-
* @param err - error to send
|
|
9
|
-
*/
|
|
10
|
-
export declare class NotAcceptable extends ErrorResponse {
|
|
11
|
-
constructor(data: any);
|
|
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
|
-
}
|
|
1
|
+
/// <reference types="qs" />
|
|
2
|
+
import * as express from 'express';
|
|
3
|
+
import { ErrorResponse } from './errorResponse.js';
|
|
4
|
+
/**
|
|
5
|
+
* Internall response function.
|
|
6
|
+
* Returns HTTP 406 NOT ACCEPTABLE
|
|
7
|
+
* When content requested in accept header format cannot be returned.
|
|
8
|
+
* @param err - error to send
|
|
9
|
+
*/
|
|
10
|
+
export declare class NotAcceptable extends ErrorResponse {
|
|
11
|
+
constructor(data: any);
|
|
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
|
+
}
|
|
14
14
|
//# sourceMappingURL=notAcceptable.d.ts.map
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NotAcceptable = void 0;
|
|
4
|
-
const interfaces_js_1 = require("../interfaces.js");
|
|
5
|
-
const responses_js_1 = require("../responses.js");
|
|
6
|
-
const errorResponse_js_1 = require("./errorResponse.js");
|
|
7
|
-
/**
|
|
8
|
-
* Internall response function.
|
|
9
|
-
* Returns HTTP 406 NOT ACCEPTABLE
|
|
10
|
-
* When content requested in accept header format cannot be returned.
|
|
11
|
-
* @param err - error to send
|
|
12
|
-
*/
|
|
13
|
-
class NotAcceptable extends errorResponse_js_1.ErrorResponse {
|
|
14
|
-
constructor(data) {
|
|
15
|
-
super(data);
|
|
16
|
-
}
|
|
17
|
-
async execute(_req, _res) {
|
|
18
|
-
return await (0, responses_js_1.httpResponse)(this.responseData, interfaces_js_1.HTTP_STATUS_CODE.NOT_ACCEPTABLE, 'notAcceptable.pug');
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
exports.NotAcceptable = NotAcceptable;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotAcceptable = void 0;
|
|
4
|
+
const interfaces_js_1 = require("../interfaces.js");
|
|
5
|
+
const responses_js_1 = require("../responses.js");
|
|
6
|
+
const errorResponse_js_1 = require("./errorResponse.js");
|
|
7
|
+
/**
|
|
8
|
+
* Internall response function.
|
|
9
|
+
* Returns HTTP 406 NOT ACCEPTABLE
|
|
10
|
+
* When content requested in accept header format cannot be returned.
|
|
11
|
+
* @param err - error to send
|
|
12
|
+
*/
|
|
13
|
+
class NotAcceptable extends errorResponse_js_1.ErrorResponse {
|
|
14
|
+
constructor(data) {
|
|
15
|
+
super(data);
|
|
16
|
+
}
|
|
17
|
+
async execute(_req, _res) {
|
|
18
|
+
return await (0, responses_js_1.httpResponse)(this.responseData, interfaces_js_1.HTTP_STATUS_CODE.NOT_ACCEPTABLE, 'notAcceptable.pug');
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.NotAcceptable = NotAcceptable;
|
|
22
22
|
//# sourceMappingURL=notAcceptable.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/// <reference types="qs" />
|
|
2
|
-
import * as express from 'express';
|
|
3
|
-
import { ErrorResponse } from './errorResponse.js';
|
|
4
|
-
/**
|
|
5
|
-
* Internall response function.
|
|
6
|
-
* Returns HTTP 403 FORBIDDEN ERROR
|
|
7
|
-
* @param err - error to send
|
|
8
|
-
*/
|
|
9
|
-
export declare class NotAllowed extends ErrorResponse {
|
|
10
|
-
constructor(data: any);
|
|
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>;
|
|
12
|
-
}
|
|
1
|
+
/// <reference types="qs" />
|
|
2
|
+
import * as express from 'express';
|
|
3
|
+
import { ErrorResponse } from './errorResponse.js';
|
|
4
|
+
/**
|
|
5
|
+
* Internall response function.
|
|
6
|
+
* Returns HTTP 403 FORBIDDEN ERROR
|
|
7
|
+
* @param err - error to send
|
|
8
|
+
*/
|
|
9
|
+
export declare class NotAllowed extends ErrorResponse {
|
|
10
|
+
constructor(data: any);
|
|
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>;
|
|
12
|
+
}
|
|
13
13
|
//# sourceMappingURL=notAllowed.d.ts.map
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NotAllowed = void 0;
|
|
4
|
-
const interfaces_js_1 = require("../interfaces.js");
|
|
5
|
-
const responses_js_1 = require("../responses.js");
|
|
6
|
-
const errorResponse_js_1 = require("./errorResponse.js");
|
|
7
|
-
/**
|
|
8
|
-
* Internall response function.
|
|
9
|
-
* Returns HTTP 403 FORBIDDEN ERROR
|
|
10
|
-
* @param err - error to send
|
|
11
|
-
*/
|
|
12
|
-
class NotAllowed extends errorResponse_js_1.ErrorResponse {
|
|
13
|
-
constructor(data) {
|
|
14
|
-
super(data);
|
|
15
|
-
}
|
|
16
|
-
async execute(_req, _res) {
|
|
17
|
-
return await (0, responses_js_1.httpResponse)(this.responseData, interfaces_js_1.HTTP_STATUS_CODE.NOT_ALLOWED, 'not-allowed.pug');
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
exports.NotAllowed = NotAllowed;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotAllowed = void 0;
|
|
4
|
+
const interfaces_js_1 = require("../interfaces.js");
|
|
5
|
+
const responses_js_1 = require("../responses.js");
|
|
6
|
+
const errorResponse_js_1 = require("./errorResponse.js");
|
|
7
|
+
/**
|
|
8
|
+
* Internall response function.
|
|
9
|
+
* Returns HTTP 403 FORBIDDEN ERROR
|
|
10
|
+
* @param err - error to send
|
|
11
|
+
*/
|
|
12
|
+
class NotAllowed extends errorResponse_js_1.ErrorResponse {
|
|
13
|
+
constructor(data) {
|
|
14
|
+
super(data);
|
|
15
|
+
}
|
|
16
|
+
async execute(_req, _res) {
|
|
17
|
+
return await (0, responses_js_1.httpResponse)(this.responseData, interfaces_js_1.HTTP_STATUS_CODE.NOT_ALLOWED, 'not-allowed.pug');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.NotAllowed = NotAllowed;
|
|
21
21
|
//# sourceMappingURL=notAllowed.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/// <reference types="qs" />
|
|
2
|
-
import * as express from 'express';
|
|
3
|
-
import { ErrorResponse } from './errorResponse.js';
|
|
4
|
-
/**
|
|
5
|
-
* Internall response function.
|
|
6
|
-
* Returns HTTP 404 NOT FOUND ERROR
|
|
7
|
-
* @param err - error to send
|
|
8
|
-
*/
|
|
9
|
-
export declare class NotFound extends ErrorResponse {
|
|
10
|
-
constructor(data?: any);
|
|
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>;
|
|
12
|
-
}
|
|
1
|
+
/// <reference types="qs" />
|
|
2
|
+
import * as express from 'express';
|
|
3
|
+
import { ErrorResponse } from './errorResponse.js';
|
|
4
|
+
/**
|
|
5
|
+
* Internall response function.
|
|
6
|
+
* Returns HTTP 404 NOT FOUND ERROR
|
|
7
|
+
* @param err - error to send
|
|
8
|
+
*/
|
|
9
|
+
export declare class NotFound extends ErrorResponse {
|
|
10
|
+
constructor(data?: any);
|
|
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>;
|
|
12
|
+
}
|
|
13
13
|
//# sourceMappingURL=notFound.d.ts.map
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.NotFound = void 0;
|
|
4
|
-
const interfaces_js_1 = require("../interfaces.js");
|
|
5
|
-
const responses_js_1 = require("../responses.js");
|
|
6
|
-
const errorResponse_js_1 = require("./errorResponse.js");
|
|
7
|
-
/**
|
|
8
|
-
* Internall response function.
|
|
9
|
-
* Returns HTTP 404 NOT FOUND ERROR
|
|
10
|
-
* @param err - error to send
|
|
11
|
-
*/
|
|
12
|
-
class NotFound extends errorResponse_js_1.ErrorResponse {
|
|
13
|
-
constructor(data) {
|
|
14
|
-
super(data);
|
|
15
|
-
}
|
|
16
|
-
async execute(_req, _res) {
|
|
17
|
-
return await (0, responses_js_1.httpResponse)(this.responseData, interfaces_js_1.HTTP_STATUS_CODE.NOT_FOUND, 'notFound.pug');
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
exports.NotFound = NotFound;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NotFound = void 0;
|
|
4
|
+
const interfaces_js_1 = require("../interfaces.js");
|
|
5
|
+
const responses_js_1 = require("../responses.js");
|
|
6
|
+
const errorResponse_js_1 = require("./errorResponse.js");
|
|
7
|
+
/**
|
|
8
|
+
* Internall response function.
|
|
9
|
+
* Returns HTTP 404 NOT FOUND ERROR
|
|
10
|
+
* @param err - error to send
|
|
11
|
+
*/
|
|
12
|
+
class NotFound extends errorResponse_js_1.ErrorResponse {
|
|
13
|
+
constructor(data) {
|
|
14
|
+
super(data);
|
|
15
|
+
}
|
|
16
|
+
async execute(_req, _res) {
|
|
17
|
+
return await (0, responses_js_1.httpResponse)(this.responseData, interfaces_js_1.HTTP_STATUS_CODE.NOT_FOUND, 'notFound.pug');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.NotFound = NotFound;
|
|
21
21
|
//# sourceMappingURL=notFound.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/// <reference types="qs" />
|
|
2
|
-
import * as express from 'express';
|
|
3
|
-
import { Response } from '../interfaces.js';
|
|
4
|
-
/**
|
|
5
|
-
* Internall response function.
|
|
6
|
-
* Returns HTTP 200 OK response with json content
|
|
7
|
-
* @param data - data to send
|
|
8
|
-
*/
|
|
9
|
-
export declare class Ok extends Response {
|
|
10
|
-
constructor(data?: any);
|
|
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>;
|
|
12
|
-
}
|
|
1
|
+
/// <reference types="qs" />
|
|
2
|
+
import * as express from 'express';
|
|
3
|
+
import { Response } from '../interfaces.js';
|
|
4
|
+
/**
|
|
5
|
+
* Internall response function.
|
|
6
|
+
* Returns HTTP 200 OK response with json content
|
|
7
|
+
* @param data - data to send
|
|
8
|
+
*/
|
|
9
|
+
export declare class Ok extends Response {
|
|
10
|
+
constructor(data?: any);
|
|
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>;
|
|
12
|
+
}
|
|
13
13
|
//# sourceMappingURL=ok.d.ts.map
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Ok = void 0;
|
|
4
|
-
const interfaces_js_1 = require("../interfaces.js");
|
|
5
|
-
const responses_js_1 = require("../responses.js");
|
|
6
|
-
/**
|
|
7
|
-
* Internall response function.
|
|
8
|
-
* Returns HTTP 200 OK response with json content
|
|
9
|
-
* @param data - data to send
|
|
10
|
-
*/
|
|
11
|
-
class Ok extends interfaces_js_1.Response {
|
|
12
|
-
constructor(data) {
|
|
13
|
-
super(data);
|
|
14
|
-
}
|
|
15
|
-
async execute(_req, _res) {
|
|
16
|
-
return await (0, responses_js_1.httpResponse)(this.responseData, interfaces_js_1.HTTP_STATUS_CODE.OK, 'ok.pug');
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.Ok = Ok;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Ok = void 0;
|
|
4
|
+
const interfaces_js_1 = require("../interfaces.js");
|
|
5
|
+
const responses_js_1 = require("../responses.js");
|
|
6
|
+
/**
|
|
7
|
+
* Internall response function.
|
|
8
|
+
* Returns HTTP 200 OK response with json content
|
|
9
|
+
* @param data - data to send
|
|
10
|
+
*/
|
|
11
|
+
class Ok extends interfaces_js_1.Response {
|
|
12
|
+
constructor(data) {
|
|
13
|
+
super(data);
|
|
14
|
+
}
|
|
15
|
+
async execute(_req, _res) {
|
|
16
|
+
return await (0, responses_js_1.httpResponse)(this.responseData, interfaces_js_1.HTTP_STATUS_CODE.OK, 'ok.pug');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.Ok = Ok;
|
|
20
20
|
//# sourceMappingURL=ok.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import * as express from 'express';
|
|
2
|
-
import { Response } from '../interfaces.js';
|
|
3
|
-
/**
|
|
4
|
-
* Redirects to another route ( simple alias for request.redirect for api consistency)
|
|
5
|
-
*
|
|
6
|
-
* @param url - url path to another location
|
|
7
|
-
*/
|
|
8
|
-
export declare class Redirect extends Response {
|
|
9
|
-
protected url: string;
|
|
10
|
-
constructor(url: any);
|
|
11
|
-
execute(_req: express.Request, res: express.Response): Promise<void>;
|
|
12
|
-
}
|
|
1
|
+
import * as express from 'express';
|
|
2
|
+
import { Response } from '../interfaces.js';
|
|
3
|
+
/**
|
|
4
|
+
* Redirects to another route ( simple alias for request.redirect for api consistency)
|
|
5
|
+
*
|
|
6
|
+
* @param url - url path to another location
|
|
7
|
+
*/
|
|
8
|
+
export declare class Redirect extends Response {
|
|
9
|
+
protected url: string;
|
|
10
|
+
constructor(url: any);
|
|
11
|
+
execute(_req: express.Request, res: express.Response): Promise<void>;
|
|
12
|
+
}
|
|
13
13
|
//# sourceMappingURL=redirect.d.ts.map
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Redirect = void 0;
|
|
4
|
-
const interfaces_js_1 = require("../interfaces.js");
|
|
5
|
-
/**
|
|
6
|
-
* Redirects to another route ( simple alias for request.redirect for api consistency)
|
|
7
|
-
*
|
|
8
|
-
* @param url - url path to another location
|
|
9
|
-
*/
|
|
10
|
-
class Redirect extends interfaces_js_1.Response {
|
|
11
|
-
constructor(url) {
|
|
12
|
-
super(null);
|
|
13
|
-
this.url = url;
|
|
14
|
-
}
|
|
15
|
-
async execute(_req, res) {
|
|
16
|
-
res.redirect(this.url);
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.Redirect = Redirect;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Redirect = void 0;
|
|
4
|
+
const interfaces_js_1 = require("../interfaces.js");
|
|
5
|
+
/**
|
|
6
|
+
* Redirects to another route ( simple alias for request.redirect for api consistency)
|
|
7
|
+
*
|
|
8
|
+
* @param url - url path to another location
|
|
9
|
+
*/
|
|
10
|
+
class Redirect extends interfaces_js_1.Response {
|
|
11
|
+
constructor(url) {
|
|
12
|
+
super(null);
|
|
13
|
+
this.url = url;
|
|
14
|
+
}
|
|
15
|
+
async execute(_req, res) {
|
|
16
|
+
res.redirect(this.url);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.Redirect = Redirect;
|
|
20
20
|
//# sourceMappingURL=redirect.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/// <reference types="qs" />
|
|
2
|
-
import * as express from 'express';
|
|
3
|
-
import { ErrorResponse } from './errorResponse.js';
|
|
4
|
-
/**
|
|
5
|
-
* Internall response function.
|
|
6
|
-
* Returns HTTP 500 INTERNAL SERVER ERROR
|
|
7
|
-
* @param err - error to send
|
|
8
|
-
*/
|
|
9
|
-
export declare class ServerError extends ErrorResponse {
|
|
10
|
-
constructor(data: any);
|
|
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>;
|
|
12
|
-
}
|
|
1
|
+
/// <reference types="qs" />
|
|
2
|
+
import * as express from 'express';
|
|
3
|
+
import { ErrorResponse } from './errorResponse.js';
|
|
4
|
+
/**
|
|
5
|
+
* Internall response function.
|
|
6
|
+
* Returns HTTP 500 INTERNAL SERVER ERROR
|
|
7
|
+
* @param err - error to send
|
|
8
|
+
*/
|
|
9
|
+
export declare class ServerError extends ErrorResponse {
|
|
10
|
+
constructor(data: any);
|
|
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>;
|
|
12
|
+
}
|
|
13
13
|
//# sourceMappingURL=serverError.d.ts.map
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ServerError = void 0;
|
|
4
|
-
const interfaces_js_1 = require("../interfaces.js");
|
|
5
|
-
const responses_js_1 = require("../responses.js");
|
|
6
|
-
const errorResponse_js_1 = require("./errorResponse.js");
|
|
7
|
-
/**
|
|
8
|
-
* Internall response function.
|
|
9
|
-
* Returns HTTP 500 INTERNAL SERVER ERROR
|
|
10
|
-
* @param err - error to send
|
|
11
|
-
*/
|
|
12
|
-
class ServerError extends errorResponse_js_1.ErrorResponse {
|
|
13
|
-
constructor(data) {
|
|
14
|
-
super(data);
|
|
15
|
-
}
|
|
16
|
-
async execute(_req, _res) {
|
|
17
|
-
return await (0, responses_js_1.httpResponse)({ error: this.responseData }, interfaces_js_1.HTTP_STATUS_CODE.INTERNAL_ERROR, 'serverError.pug');
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
exports.ServerError = ServerError;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ServerError = void 0;
|
|
4
|
+
const interfaces_js_1 = require("../interfaces.js");
|
|
5
|
+
const responses_js_1 = require("../responses.js");
|
|
6
|
+
const errorResponse_js_1 = require("./errorResponse.js");
|
|
7
|
+
/**
|
|
8
|
+
* Internall response function.
|
|
9
|
+
* Returns HTTP 500 INTERNAL SERVER ERROR
|
|
10
|
+
* @param err - error to send
|
|
11
|
+
*/
|
|
12
|
+
class ServerError extends errorResponse_js_1.ErrorResponse {
|
|
13
|
+
constructor(data) {
|
|
14
|
+
super(data);
|
|
15
|
+
}
|
|
16
|
+
async execute(_req, _res) {
|
|
17
|
+
return await (0, responses_js_1.httpResponse)({ error: this.responseData }, interfaces_js_1.HTTP_STATUS_CODE.INTERNAL_ERROR, 'serverError.pug');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.ServerError = ServerError;
|
|
21
21
|
//# sourceMappingURL=serverError.js.map
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
/// <reference types="qs" />
|
|
2
|
-
import { fs } from '@spinajs/fs';
|
|
3
|
-
import * as express from 'express';
|
|
4
|
-
import { HTTP_STATUS_CODE, ITemplateResponseOptions, Response } from '../interfaces.js';
|
|
5
|
-
/**
|
|
6
|
-
* HTML resposne with HTML from pug file
|
|
7
|
-
*/
|
|
8
|
-
export declare class TemplateResponse extends Response {
|
|
9
|
-
protected file: string;
|
|
10
|
-
protected status: HTTP_STATUS_CODE;
|
|
11
|
-
protected fsTemplates: fs;
|
|
12
|
-
protected templateFile: string | ITemplateResponseOptions;
|
|
13
|
-
constructor(file: string | ITemplateResponseOptions, model: any, status?: HTTP_STATUS_CODE);
|
|
14
|
-
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>;
|
|
15
|
-
}
|
|
1
|
+
/// <reference types="qs" />
|
|
2
|
+
import { fs } from '@spinajs/fs';
|
|
3
|
+
import * as express from 'express';
|
|
4
|
+
import { HTTP_STATUS_CODE, ITemplateResponseOptions, Response } from '../interfaces.js';
|
|
5
|
+
/**
|
|
6
|
+
* HTML resposne with HTML from pug file
|
|
7
|
+
*/
|
|
8
|
+
export declare class TemplateResponse extends Response {
|
|
9
|
+
protected file: string;
|
|
10
|
+
protected status: HTTP_STATUS_CODE;
|
|
11
|
+
protected fsTemplates: fs;
|
|
12
|
+
protected templateFile: string | ITemplateResponseOptions;
|
|
13
|
+
constructor(file: string | ITemplateResponseOptions, model: any, status?: HTTP_STATUS_CODE);
|
|
14
|
+
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>;
|
|
15
|
+
}
|
|
16
16
|
//# sourceMappingURL=template.d.ts.map
|
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.TemplateResponse = void 0;
|
|
7
|
-
const di_1 = require("@spinajs/di");
|
|
8
|
-
const exceptions_1 = require("@spinajs/exceptions");
|
|
9
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
10
|
-
const interfaces_js_1 = require("../interfaces.js");
|
|
11
|
-
const responses_js_1 = require("../responses.js");
|
|
12
|
-
/**
|
|
13
|
-
* HTML resposne with HTML from pug file
|
|
14
|
-
*/
|
|
15
|
-
class TemplateResponse extends interfaces_js_1.Response {
|
|
16
|
-
constructor(file, model, status) {
|
|
17
|
-
super(model);
|
|
18
|
-
this.status = null;
|
|
19
|
-
this.fsTemplates = lodash_1.default.isString(file)
|
|
20
|
-
? di_1.DI.resolve('__file_provider__', ['__fs_http_templates__'])
|
|
21
|
-
: di_1.DI.resolve('__file_provider__', [file.provider]);
|
|
22
|
-
this.templateFile = file;
|
|
23
|
-
this.status = status;
|
|
24
|
-
}
|
|
25
|
-
async execute(_req, _res) {
|
|
26
|
-
if (!this.fsTemplates) {
|
|
27
|
-
const provider = lodash_1.default.isString(this.templateFile) ? '__fs_http_templates__' : this.templateFile.provider;
|
|
28
|
-
throw new exceptions_1.IOFail(`Cannot find template file provider ${provider}. Please check configuration for provider or make sure that __fs_http_templates__ is configured.`);
|
|
29
|
-
}
|
|
30
|
-
this.file = lodash_1.default.isString(this.templateFile)
|
|
31
|
-
? await this.fsTemplates.download(this.templateFile)
|
|
32
|
-
: await this.fsTemplates.download(this.templateFile.template);
|
|
33
|
-
return await (0, responses_js_1.htmlResponse)(this.file, this.responseData, this.status ? this.status : interfaces_js_1.HTTP_STATUS_CODE.OK);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
exports.TemplateResponse = TemplateResponse;
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.TemplateResponse = void 0;
|
|
7
|
+
const di_1 = require("@spinajs/di");
|
|
8
|
+
const exceptions_1 = require("@spinajs/exceptions");
|
|
9
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
10
|
+
const interfaces_js_1 = require("../interfaces.js");
|
|
11
|
+
const responses_js_1 = require("../responses.js");
|
|
12
|
+
/**
|
|
13
|
+
* HTML resposne with HTML from pug file
|
|
14
|
+
*/
|
|
15
|
+
class TemplateResponse extends interfaces_js_1.Response {
|
|
16
|
+
constructor(file, model, status) {
|
|
17
|
+
super(model);
|
|
18
|
+
this.status = null;
|
|
19
|
+
this.fsTemplates = lodash_1.default.isString(file)
|
|
20
|
+
? di_1.DI.resolve('__file_provider__', ['__fs_http_templates__'])
|
|
21
|
+
: di_1.DI.resolve('__file_provider__', [file.provider]);
|
|
22
|
+
this.templateFile = file;
|
|
23
|
+
this.status = status;
|
|
24
|
+
}
|
|
25
|
+
async execute(_req, _res) {
|
|
26
|
+
if (!this.fsTemplates) {
|
|
27
|
+
const provider = lodash_1.default.isString(this.templateFile) ? '__fs_http_templates__' : this.templateFile.provider;
|
|
28
|
+
throw new exceptions_1.IOFail(`Cannot find template file provider ${provider}. Please check configuration for provider or make sure that __fs_http_templates__ is configured.`);
|
|
29
|
+
}
|
|
30
|
+
this.file = lodash_1.default.isString(this.templateFile)
|
|
31
|
+
? await this.fsTemplates.download(this.templateFile)
|
|
32
|
+
: await this.fsTemplates.download(this.templateFile.template);
|
|
33
|
+
return await (0, responses_js_1.htmlResponse)(this.file, this.responseData, this.status ? this.status : interfaces_js_1.HTTP_STATUS_CODE.OK);
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
exports.TemplateResponse = TemplateResponse;
|
|
37
37
|
//# sourceMappingURL=template.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
/// <reference types="qs" />
|
|
2
|
-
import * as express from 'express';
|
|
3
|
-
import { ErrorResponse } from './errorResponse.js';
|
|
4
|
-
/**
|
|
5
|
-
* Internall response function.
|
|
6
|
-
* Returns HTTP 401 UNAHTORIZED response with json content
|
|
7
|
-
* @param data - data to send
|
|
8
|
-
*/
|
|
9
|
-
export declare class Unauthorized extends ErrorResponse {
|
|
10
|
-
constructor(data: any);
|
|
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>;
|
|
12
|
-
}
|
|
1
|
+
/// <reference types="qs" />
|
|
2
|
+
import * as express from 'express';
|
|
3
|
+
import { ErrorResponse } from './errorResponse.js';
|
|
4
|
+
/**
|
|
5
|
+
* Internall response function.
|
|
6
|
+
* Returns HTTP 401 UNAHTORIZED response with json content
|
|
7
|
+
* @param data - data to send
|
|
8
|
+
*/
|
|
9
|
+
export declare class Unauthorized extends ErrorResponse {
|
|
10
|
+
constructor(data: any);
|
|
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>;
|
|
12
|
+
}
|
|
13
13
|
//# sourceMappingURL=unauthorized.d.ts.map
|