@spinajs/http 2.0.179 → 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,18 +1,18 @@
|
|
|
1
|
-
import { HTTP_STATUS_CODE, Response } from '../interfaces.js';
|
|
2
|
-
import { httpResponse } from '../responses.js';
|
|
3
|
-
import _ from 'lodash';
|
|
4
|
-
import { DI } from '@spinajs/di';
|
|
5
|
-
import { Configuration } from '@spinajs/configuration';
|
|
6
|
-
export class ErrorResponse extends Response {
|
|
7
|
-
constructor(error) {
|
|
8
|
-
super(error);
|
|
9
|
-
const isDev = DI.get(Configuration).get('configuration.isDevelopment');
|
|
10
|
-
if (!isDev) {
|
|
11
|
-
this.responseData = _.omit(this.responseData, ['stack']);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
async execute(_req, _res) {
|
|
15
|
-
return await httpResponse(this.responseData, HTTP_STATUS_CODE.BAD_REQUEST, 'badRequest.pug');
|
|
16
|
-
}
|
|
17
|
-
}
|
|
1
|
+
import { HTTP_STATUS_CODE, Response } from '../interfaces.js';
|
|
2
|
+
import { httpResponse } from '../responses.js';
|
|
3
|
+
import _ from 'lodash';
|
|
4
|
+
import { DI } from '@spinajs/di';
|
|
5
|
+
import { Configuration } from '@spinajs/configuration';
|
|
6
|
+
export class ErrorResponse extends Response {
|
|
7
|
+
constructor(error) {
|
|
8
|
+
super(error);
|
|
9
|
+
const isDev = DI.get(Configuration).get('configuration.isDevelopment');
|
|
10
|
+
if (!isDev) {
|
|
11
|
+
this.responseData = _.omit(this.responseData, ['stack']);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
async execute(_req, _res) {
|
|
15
|
+
return await httpResponse(this.responseData, HTTP_STATUS_CODE.BAD_REQUEST, 'badRequest.pug');
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
18
|
//# sourceMappingURL=errorResponse.js.map
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import * as express from 'express';
|
|
2
|
-
import { IFileResponseOptions, Response } from './../interfaces.js';
|
|
3
|
-
export declare class ZipResponse extends Response {
|
|
4
|
-
protected Options: IFileResponseOptions;
|
|
5
|
-
/**
|
|
6
|
-
* Sends zipped to client at given path & filename. If file exists
|
|
7
|
-
* it will send file with 200 OK, if not exists 404 NOT FOUND
|
|
8
|
-
*/
|
|
9
|
-
constructor(Options: IFileResponseOptions);
|
|
10
|
-
execute(_req: express.Request, res: express.Response): Promise<void>;
|
|
11
|
-
}
|
|
12
|
-
export declare class FileResponse extends Response {
|
|
13
|
-
protected Options: IFileResponseOptions;
|
|
14
|
-
/**
|
|
15
|
-
* Sends file to client at given path & filename. If file exists
|
|
16
|
-
* it will send file with 200 OK, if not exists 404 NOT FOUND
|
|
17
|
-
*/
|
|
18
|
-
constructor(Options: IFileResponseOptions);
|
|
19
|
-
execute(_req: express.Request, res: express.Response): Promise<void>;
|
|
20
|
-
}
|
|
21
|
-
export declare class JsonFileResponse extends Response {
|
|
22
|
-
protected data: any;
|
|
23
|
-
protected filename: string;
|
|
24
|
-
constructor(data: any, filename: string);
|
|
25
|
-
execute(_req: express.Request, res: express.Response): Promise<void>;
|
|
26
|
-
}
|
|
1
|
+
import * as express from 'express';
|
|
2
|
+
import { IFileResponseOptions, Response } from './../interfaces.js';
|
|
3
|
+
export declare class ZipResponse extends Response {
|
|
4
|
+
protected Options: IFileResponseOptions;
|
|
5
|
+
/**
|
|
6
|
+
* Sends zipped file to client at given path & filename. If file exists
|
|
7
|
+
* it will send file with 200 OK, if not exists 404 NOT FOUND
|
|
8
|
+
*/
|
|
9
|
+
constructor(Options: IFileResponseOptions);
|
|
10
|
+
execute(_req: express.Request, res: express.Response): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
export declare class FileResponse extends Response {
|
|
13
|
+
protected Options: IFileResponseOptions;
|
|
14
|
+
/**
|
|
15
|
+
* Sends file to client at given path & filename. If file exists
|
|
16
|
+
* it will send file with 200 OK, if not exists 404 NOT FOUND
|
|
17
|
+
*/
|
|
18
|
+
constructor(Options: IFileResponseOptions);
|
|
19
|
+
execute(_req: express.Request, res: express.Response): Promise<void>;
|
|
20
|
+
}
|
|
21
|
+
export declare class JsonFileResponse extends Response {
|
|
22
|
+
protected data: any;
|
|
23
|
+
protected filename: string;
|
|
24
|
+
constructor(data: any, filename: string);
|
|
25
|
+
execute(_req: express.Request, res: express.Response): Promise<void>;
|
|
26
|
+
}
|
|
27
27
|
//# sourceMappingURL=file.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../src/response-methods/file.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAGnC,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAGpE,qBAAa,WAAY,SAAQ,QAAQ;IAK3B,SAAS,CAAC,OAAO,EAAE,oBAAoB;IAJnD;;;OAGG;gBACmB,OAAO,EAAE,oBAAoB;IAOtC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"file.d.ts","sourceRoot":"","sources":["../../../src/response-methods/file.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAGnC,OAAO,EAAE,oBAAoB,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAGpE,qBAAa,WAAY,SAAQ,QAAQ;IAK3B,SAAS,CAAC,OAAO,EAAE,oBAAoB;IAJnD;;;OAGG;gBACmB,OAAO,EAAE,oBAAoB;IAOtC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAuBlF;AAED,qBAAa,YAAa,SAAQ,QAAQ;IAK5B,SAAS,CAAC,OAAO,EAAE,oBAAoB;IAJnD;;;OAGG;gBACmB,OAAO,EAAE,oBAAoB;IAOtC,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAgClF;AAED,qBAAa,gBAAiB,SAAQ,QAAQ;IAChC,SAAS,CAAC,IAAI,EAAE,GAAG;IAAE,SAAS,CAAC,QAAQ,EAAE,MAAM;gBAArC,IAAI,EAAE,GAAG,EAAY,QAAQ,EAAE,MAAM;IAI9C,OAAO,CAAC,IAAI,EAAE,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;CAiBlF"}
|
|
@@ -1,125 +1,104 @@
|
|
|
1
|
-
import { DI } from '@spinajs/di';
|
|
2
|
-
import { IOFail, ResourceNotFound } from '@spinajs/exceptions';
|
|
3
|
-
import _ from 'lodash';
|
|
4
|
-
import mime from 'mime';
|
|
5
|
-
import { Response } from './../interfaces.js';
|
|
6
|
-
export class ZipResponse extends Response {
|
|
7
|
-
/**
|
|
8
|
-
* Sends zipped to client at given path & filename. If file exists
|
|
9
|
-
* it will send file with 200 OK, if not exists 404 NOT FOUND
|
|
10
|
-
*/
|
|
11
|
-
constructor(Options) {
|
|
12
|
-
super(null);
|
|
13
|
-
this.Options = Options;
|
|
14
|
-
this.Options.mimeType = Options.mimeType ?? mime.getType(Options.filename);
|
|
15
|
-
this.Options.provider = Options.provider ?? 'local';
|
|
16
|
-
}
|
|
17
|
-
async execute(_req, res) {
|
|
18
|
-
const provider = await DI.resolve('__file_provider__', [this.Options.provider]);
|
|
19
|
-
const exists = await provider.exists(this.Options.path);
|
|
20
|
-
if (!exists) {
|
|
21
|
-
throw new ResourceNotFound(`File ${this.Options.path} not exists`);
|
|
22
|
-
}
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
const tmpPath = provider.tmppath();
|
|
105
|
-
provider.write(tmpPath, JSON.stringify(this.data));
|
|
106
|
-
return new Promise((resolve, reject) => {
|
|
107
|
-
res.download(tmpPath, this.filename, (err) => {
|
|
108
|
-
provider
|
|
109
|
-
.unlink(tmpPath)
|
|
110
|
-
.then(() => {
|
|
111
|
-
if (err) {
|
|
112
|
-
reject(err);
|
|
113
|
-
}
|
|
114
|
-
else {
|
|
115
|
-
resolve();
|
|
116
|
-
}
|
|
117
|
-
})
|
|
118
|
-
.catch((err) => {
|
|
119
|
-
reject(err);
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
}
|
|
124
|
-
}
|
|
1
|
+
import { DI } from '@spinajs/di';
|
|
2
|
+
import { IOFail, ResourceNotFound } from '@spinajs/exceptions';
|
|
3
|
+
import _ from 'lodash';
|
|
4
|
+
import mime from 'mime';
|
|
5
|
+
import { Response } from './../interfaces.js';
|
|
6
|
+
export class ZipResponse extends Response {
|
|
7
|
+
/**
|
|
8
|
+
* Sends zipped file to client at given path & filename. If file exists
|
|
9
|
+
* it will send file with 200 OK, if not exists 404 NOT FOUND
|
|
10
|
+
*/
|
|
11
|
+
constructor(Options) {
|
|
12
|
+
super(null);
|
|
13
|
+
this.Options = Options;
|
|
14
|
+
this.Options.mimeType = Options.mimeType ?? mime.getType(Options.filename);
|
|
15
|
+
this.Options.provider = Options.provider ?? 'local';
|
|
16
|
+
}
|
|
17
|
+
async execute(_req, res) {
|
|
18
|
+
const provider = await DI.resolve('__file_provider__', [this.Options.provider]);
|
|
19
|
+
const exists = await provider.exists(this.Options.path);
|
|
20
|
+
if (!exists) {
|
|
21
|
+
throw new ResourceNotFound(`File ${this.Options.path} not exists`);
|
|
22
|
+
}
|
|
23
|
+
const zippedFile = await provider.zip(this.Options.path);
|
|
24
|
+
const fPath = zippedFile.asFilePath();
|
|
25
|
+
return new Promise((resolve, reject) => {
|
|
26
|
+
res.download(fPath, this.Options.filename, (err) => {
|
|
27
|
+
provider.rm(fPath).finally(() => {
|
|
28
|
+
if (!_.isNil(err)) {
|
|
29
|
+
reject(err);
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
resolve();
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
export class FileResponse extends Response {
|
|
40
|
+
/**
|
|
41
|
+
* Sends file to client at given path & filename. If file exists
|
|
42
|
+
* it will send file with 200 OK, if not exists 404 NOT FOUND
|
|
43
|
+
*/
|
|
44
|
+
constructor(Options) {
|
|
45
|
+
super(null);
|
|
46
|
+
this.Options = Options;
|
|
47
|
+
this.Options.mimeType = Options.mimeType ?? mime.getType(Options.filename);
|
|
48
|
+
this.Options.provider = Options.provider ?? 'local';
|
|
49
|
+
}
|
|
50
|
+
async execute(_req, res) {
|
|
51
|
+
const provider = await DI.resolve('__file_provider__', [this.Options.provider]);
|
|
52
|
+
if (!provider) {
|
|
53
|
+
throw new IOFail(`Provider ${this.Options.provider} not registered in configuration. Use default or check configuration.`);
|
|
54
|
+
}
|
|
55
|
+
const exists = await provider.exists(this.Options.path);
|
|
56
|
+
if (!exists) {
|
|
57
|
+
throw new ResourceNotFound(`File ${this.Options.path} not exists`);
|
|
58
|
+
}
|
|
59
|
+
const file = await provider.download(this.Options.path);
|
|
60
|
+
return new Promise((resolve, reject) => {
|
|
61
|
+
res.download(file, this.Options.filename, (err) => {
|
|
62
|
+
const r = () => {
|
|
63
|
+
if (!_.isNil(err)) {
|
|
64
|
+
reject(err);
|
|
65
|
+
}
|
|
66
|
+
else {
|
|
67
|
+
resolve();
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
if (this.Options.deleteAfterDownload) {
|
|
71
|
+
provider.rm(this.Options.path).finally(r);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
r();
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
export class JsonFileResponse extends Response {
|
|
81
|
+
constructor(data, filename) {
|
|
82
|
+
super(null);
|
|
83
|
+
this.data = data;
|
|
84
|
+
this.filename = filename;
|
|
85
|
+
}
|
|
86
|
+
async execute(_req, res) {
|
|
87
|
+
const provider = await DI.resolve('__file_provider__', ['fs-temp']);
|
|
88
|
+
const tmpPath = provider.tmppath();
|
|
89
|
+
provider.write(tmpPath, JSON.stringify(this.data));
|
|
90
|
+
return new Promise((resolve, reject) => {
|
|
91
|
+
res.download(tmpPath, this.filename, (err) => {
|
|
92
|
+
provider.rm(tmpPath).finally(() => {
|
|
93
|
+
if (err) {
|
|
94
|
+
reject(err);
|
|
95
|
+
}
|
|
96
|
+
else {
|
|
97
|
+
resolve();
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
});
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
}
|
|
125
104
|
//# sourceMappingURL=file.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../../src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AAQ,CAAC,OAAO,EAAE,IAAI,CAAC,QAAQ,EAAE,CAAC,GAAU,EAAE,EAAE;gBAClD,QAAQ,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE;oBAChC,IAAI,GAAG,EAAE;wBACP,MAAM,CAAC,GAAG,CAAC,CAAC;qBACb;yBAAM;wBACL,OAAO,EAAE,CAAC;qBACX;gBACH,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;CACF"}
|
|
@@ -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 Forbidden 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 Forbidden 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=forbidden.d.ts.map
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { HTTP_STATUS_CODE } from '../interfaces.js';
|
|
2
|
-
import { httpResponse } from '../responses.js';
|
|
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 class Forbidden extends ErrorResponse {
|
|
10
|
-
constructor(data) {
|
|
11
|
-
super(data);
|
|
12
|
-
}
|
|
13
|
-
async execute(_req, _res) {
|
|
14
|
-
return await httpResponse(this.responseData, HTTP_STATUS_CODE.FORBIDDEN, 'forbidden.pug');
|
|
15
|
-
}
|
|
16
|
-
}
|
|
1
|
+
import { HTTP_STATUS_CODE } from '../interfaces.js';
|
|
2
|
+
import { httpResponse } from '../responses.js';
|
|
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 class Forbidden extends ErrorResponse {
|
|
10
|
+
constructor(data) {
|
|
11
|
+
super(data);
|
|
12
|
+
}
|
|
13
|
+
async execute(_req, _res) {
|
|
14
|
+
return await httpResponse(this.responseData, HTTP_STATUS_CODE.FORBIDDEN, 'forbidden.pug');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
17
|
//# sourceMappingURL=forbidden.js.map
|
|
@@ -1,14 +1,14 @@
|
|
|
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 './template.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';
|
|
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 './template.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
14
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,14 +1,14 @@
|
|
|
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 './template.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';
|
|
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 './template.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
14
|
//# sourceMappingURL=index.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 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,17 +1,17 @@
|
|
|
1
|
-
import { HTTP_STATUS_CODE } from '../interfaces.js';
|
|
2
|
-
import { httpResponse } from '../responses.js';
|
|
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 class NoContent extends ErrorResponse {
|
|
10
|
-
constructor(data) {
|
|
11
|
-
super(data);
|
|
12
|
-
}
|
|
13
|
-
async execute(_req, _res) {
|
|
14
|
-
return await httpResponse(this.responseData, HTTP_STATUS_CODE.NO_CONTENT, 'noContent.pug');
|
|
15
|
-
}
|
|
16
|
-
}
|
|
1
|
+
import { HTTP_STATUS_CODE } from '../interfaces.js';
|
|
2
|
+
import { httpResponse } from '../responses.js';
|
|
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 class NoContent extends ErrorResponse {
|
|
10
|
+
constructor(data) {
|
|
11
|
+
super(data);
|
|
12
|
+
}
|
|
13
|
+
async execute(_req, _res) {
|
|
14
|
+
return await httpResponse(this.responseData, HTTP_STATUS_CODE.NO_CONTENT, 'noContent.pug');
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
17
|
//# 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,18 +1,18 @@
|
|
|
1
|
-
import { HTTP_STATUS_CODE } from '../interfaces.js';
|
|
2
|
-
import { httpResponse } from '../responses.js';
|
|
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 class NotAcceptable extends ErrorResponse {
|
|
11
|
-
constructor(data) {
|
|
12
|
-
super(data);
|
|
13
|
-
}
|
|
14
|
-
async execute(_req, _res) {
|
|
15
|
-
return await httpResponse(this.responseData, HTTP_STATUS_CODE.NOT_ACCEPTABLE, 'notAcceptable.pug');
|
|
16
|
-
}
|
|
17
|
-
}
|
|
1
|
+
import { HTTP_STATUS_CODE } from '../interfaces.js';
|
|
2
|
+
import { httpResponse } from '../responses.js';
|
|
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 class NotAcceptable extends ErrorResponse {
|
|
11
|
+
constructor(data) {
|
|
12
|
+
super(data);
|
|
13
|
+
}
|
|
14
|
+
async execute(_req, _res) {
|
|
15
|
+
return await httpResponse(this.responseData, HTTP_STATUS_CODE.NOT_ACCEPTABLE, 'notAcceptable.pug');
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
18
|
//# 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
|