@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 { Response } from '../interfaces.js';
|
|
4
|
-
/**
|
|
5
|
-
* Internall response function.
|
|
6
|
-
* Returns HTTP 201 CREATED
|
|
7
|
-
* @param data - additional data eg. model pk
|
|
8
|
-
*/
|
|
9
|
-
export declare class Created 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 201 CREATED
|
|
7
|
+
* @param data - additional data eg. model pk
|
|
8
|
+
*/
|
|
9
|
+
export declare class Created 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=created.d.ts.map
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Created = 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 201 CREATED
|
|
9
|
-
* @param data - additional data eg. model pk
|
|
10
|
-
*/
|
|
11
|
-
class Created 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.CREATED, 'created.pug');
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
exports.Created = Created;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Created = 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 201 CREATED
|
|
9
|
+
* @param data - additional data eg. model pk
|
|
10
|
+
*/
|
|
11
|
+
class Created 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.CREATED, 'created.pug');
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
exports.Created = Created;
|
|
20
20
|
//# sourceMappingURL=created.js.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
/// <reference types="qs" />
|
|
2
|
-
import * as express from 'express';
|
|
3
|
-
import { Response } from '../interfaces.js';
|
|
4
|
-
export declare class ErrorResponse extends Response {
|
|
5
|
-
constructor(error: any);
|
|
6
|
-
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>;
|
|
7
|
-
}
|
|
1
|
+
/// <reference types="qs" />
|
|
2
|
+
import * as express from 'express';
|
|
3
|
+
import { Response } from '../interfaces.js';
|
|
4
|
+
export declare class ErrorResponse extends Response {
|
|
5
|
+
constructor(error: any);
|
|
6
|
+
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>;
|
|
7
|
+
}
|
|
8
8
|
//# sourceMappingURL=errorResponse.d.ts.map
|
|
@@ -1,25 +1,25 @@
|
|
|
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.ErrorResponse = void 0;
|
|
7
|
-
const interfaces_js_1 = require("../interfaces.js");
|
|
8
|
-
const responses_js_1 = require("../responses.js");
|
|
9
|
-
const lodash_1 = __importDefault(require("lodash"));
|
|
10
|
-
const di_1 = require("@spinajs/di");
|
|
11
|
-
const configuration_1 = require("@spinajs/configuration");
|
|
12
|
-
class ErrorResponse extends interfaces_js_1.Response {
|
|
13
|
-
constructor(error) {
|
|
14
|
-
super(error);
|
|
15
|
-
const isDev = di_1.DI.get(configuration_1.Configuration).get('configuration.isDevelopment');
|
|
16
|
-
if (!isDev) {
|
|
17
|
-
this.responseData = lodash_1.default.omit(this.responseData, ['stack']);
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
async execute(_req, _res) {
|
|
21
|
-
return await (0, responses_js_1.httpResponse)(this.responseData, interfaces_js_1.HTTP_STATUS_CODE.BAD_REQUEST, 'badRequest.pug');
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.ErrorResponse = ErrorResponse;
|
|
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.ErrorResponse = void 0;
|
|
7
|
+
const interfaces_js_1 = require("../interfaces.js");
|
|
8
|
+
const responses_js_1 = require("../responses.js");
|
|
9
|
+
const lodash_1 = __importDefault(require("lodash"));
|
|
10
|
+
const di_1 = require("@spinajs/di");
|
|
11
|
+
const configuration_1 = require("@spinajs/configuration");
|
|
12
|
+
class ErrorResponse extends interfaces_js_1.Response {
|
|
13
|
+
constructor(error) {
|
|
14
|
+
super(error);
|
|
15
|
+
const isDev = di_1.DI.get(configuration_1.Configuration).get('configuration.isDevelopment');
|
|
16
|
+
if (!isDev) {
|
|
17
|
+
this.responseData = lodash_1.default.omit(this.responseData, ['stack']);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
async execute(_req, _res) {
|
|
21
|
+
return await (0, responses_js_1.httpResponse)(this.responseData, interfaces_js_1.HTTP_STATUS_CODE.BAD_REQUEST, 'badRequest.pug');
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.ErrorResponse = ErrorResponse;
|
|
25
25
|
//# 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,134 +1,113 @@
|
|
|
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.JsonFileResponse = exports.FileResponse = exports.ZipResponse = 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 mime_1 = __importDefault(require("mime"));
|
|
11
|
-
const interfaces_js_1 = require("./../interfaces.js");
|
|
12
|
-
class ZipResponse extends interfaces_js_1.Response {
|
|
13
|
-
/**
|
|
14
|
-
* Sends zipped to client at given path & filename. If file exists
|
|
15
|
-
* it will send file with 200 OK, if not exists 404 NOT FOUND
|
|
16
|
-
*/
|
|
17
|
-
constructor(Options) {
|
|
18
|
-
super(null);
|
|
19
|
-
this.Options = Options;
|
|
20
|
-
this.Options.mimeType = Options.mimeType ?? mime_1.default.getType(Options.filename);
|
|
21
|
-
this.Options.provider = Options.provider ?? 'local';
|
|
22
|
-
}
|
|
23
|
-
async execute(_req, res) {
|
|
24
|
-
const provider = await di_1.DI.resolve('__file_provider__', [this.Options.provider]);
|
|
25
|
-
const exists = await provider.exists(this.Options.path);
|
|
26
|
-
if (!exists) {
|
|
27
|
-
throw new exceptions_1.ResourceNotFound(`File ${this.Options.path} not exists`);
|
|
28
|
-
}
|
|
29
|
-
const
|
|
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
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
provider.write(tmpPath, JSON.stringify(this.data));
|
|
114
|
-
return new Promise((resolve, reject) => {
|
|
115
|
-
res.download(tmpPath, this.filename, (err) => {
|
|
116
|
-
provider
|
|
117
|
-
.unlink(tmpPath)
|
|
118
|
-
.then(() => {
|
|
119
|
-
if (err) {
|
|
120
|
-
reject(err);
|
|
121
|
-
}
|
|
122
|
-
else {
|
|
123
|
-
resolve();
|
|
124
|
-
}
|
|
125
|
-
})
|
|
126
|
-
.catch((err) => {
|
|
127
|
-
reject(err);
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
exports.JsonFileResponse = JsonFileResponse;
|
|
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.JsonFileResponse = exports.FileResponse = exports.ZipResponse = 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 mime_1 = __importDefault(require("mime"));
|
|
11
|
+
const interfaces_js_1 = require("./../interfaces.js");
|
|
12
|
+
class ZipResponse extends interfaces_js_1.Response {
|
|
13
|
+
/**
|
|
14
|
+
* Sends zipped file to client at given path & filename. If file exists
|
|
15
|
+
* it will send file with 200 OK, if not exists 404 NOT FOUND
|
|
16
|
+
*/
|
|
17
|
+
constructor(Options) {
|
|
18
|
+
super(null);
|
|
19
|
+
this.Options = Options;
|
|
20
|
+
this.Options.mimeType = Options.mimeType ?? mime_1.default.getType(Options.filename);
|
|
21
|
+
this.Options.provider = Options.provider ?? 'local';
|
|
22
|
+
}
|
|
23
|
+
async execute(_req, res) {
|
|
24
|
+
const provider = await di_1.DI.resolve('__file_provider__', [this.Options.provider]);
|
|
25
|
+
const exists = await provider.exists(this.Options.path);
|
|
26
|
+
if (!exists) {
|
|
27
|
+
throw new exceptions_1.ResourceNotFound(`File ${this.Options.path} not exists`);
|
|
28
|
+
}
|
|
29
|
+
const zippedFile = await provider.zip(this.Options.path);
|
|
30
|
+
const fPath = zippedFile.asFilePath();
|
|
31
|
+
return new Promise((resolve, reject) => {
|
|
32
|
+
res.download(fPath, this.Options.filename, (err) => {
|
|
33
|
+
provider.rm(fPath).finally(() => {
|
|
34
|
+
if (!lodash_1.default.isNil(err)) {
|
|
35
|
+
reject(err);
|
|
36
|
+
}
|
|
37
|
+
else {
|
|
38
|
+
resolve();
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.ZipResponse = ZipResponse;
|
|
46
|
+
class FileResponse extends interfaces_js_1.Response {
|
|
47
|
+
/**
|
|
48
|
+
* Sends file to client at given path & filename. If file exists
|
|
49
|
+
* it will send file with 200 OK, if not exists 404 NOT FOUND
|
|
50
|
+
*/
|
|
51
|
+
constructor(Options) {
|
|
52
|
+
super(null);
|
|
53
|
+
this.Options = Options;
|
|
54
|
+
this.Options.mimeType = Options.mimeType ?? mime_1.default.getType(Options.filename);
|
|
55
|
+
this.Options.provider = Options.provider ?? 'local';
|
|
56
|
+
}
|
|
57
|
+
async execute(_req, res) {
|
|
58
|
+
const provider = await di_1.DI.resolve('__file_provider__', [this.Options.provider]);
|
|
59
|
+
if (!provider) {
|
|
60
|
+
throw new exceptions_1.IOFail(`Provider ${this.Options.provider} not registered in configuration. Use default or check configuration.`);
|
|
61
|
+
}
|
|
62
|
+
const exists = await provider.exists(this.Options.path);
|
|
63
|
+
if (!exists) {
|
|
64
|
+
throw new exceptions_1.ResourceNotFound(`File ${this.Options.path} not exists`);
|
|
65
|
+
}
|
|
66
|
+
const file = await provider.download(this.Options.path);
|
|
67
|
+
return new Promise((resolve, reject) => {
|
|
68
|
+
res.download(file, this.Options.filename, (err) => {
|
|
69
|
+
const r = () => {
|
|
70
|
+
if (!lodash_1.default.isNil(err)) {
|
|
71
|
+
reject(err);
|
|
72
|
+
}
|
|
73
|
+
else {
|
|
74
|
+
resolve();
|
|
75
|
+
}
|
|
76
|
+
};
|
|
77
|
+
if (this.Options.deleteAfterDownload) {
|
|
78
|
+
provider.rm(this.Options.path).finally(r);
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
r();
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
exports.FileResponse = FileResponse;
|
|
88
|
+
class JsonFileResponse extends interfaces_js_1.Response {
|
|
89
|
+
constructor(data, filename) {
|
|
90
|
+
super(null);
|
|
91
|
+
this.data = data;
|
|
92
|
+
this.filename = filename;
|
|
93
|
+
}
|
|
94
|
+
async execute(_req, res) {
|
|
95
|
+
const provider = await di_1.DI.resolve('__file_provider__', ['fs-temp']);
|
|
96
|
+
const tmpPath = provider.tmppath();
|
|
97
|
+
provider.write(tmpPath, JSON.stringify(this.data));
|
|
98
|
+
return new Promise((resolve, reject) => {
|
|
99
|
+
res.download(tmpPath, this.filename, (err) => {
|
|
100
|
+
provider.rm(tmpPath).finally(() => {
|
|
101
|
+
if (err) {
|
|
102
|
+
reject(err);
|
|
103
|
+
}
|
|
104
|
+
else {
|
|
105
|
+
resolve();
|
|
106
|
+
}
|
|
107
|
+
});
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
exports.JsonFileResponse = JsonFileResponse;
|
|
134
113
|
//# sourceMappingURL=file.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../../src/response-methods/file.ts"],"names":[],"mappings":";;;;;;AAAA,oCAAiC;AACjC,oDAA+D;AAE/D,oDAAuB;AACvB,gDAAwB;AACxB,sDAAoE;AAGpE,MAAa,WAAY,SAAQ,wBAAQ;IACvC;;;OAGG;IACH,YAAsB,OAA6B;QACjD,KAAK,CAAC,IAAI,CAAC,CAAC;QADQ,YAAO,GAAP,OAAO,CAAsB;QAGjD,IAAI,CAAC,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC3E,IAAI,CAAC,OAAO,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC;IACtD,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,IAAqB,EAAE,GAAqB;QAC/D,MAAM,QAAQ,GAAG,MAAM,OAAE,CAAC,OAAO,CAAK,mBAAmB,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,CAAC;QACpF,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;QAExD,IAAI,CAAC,MAAM,EAAE;YACX,MAAM,IAAI,6BAAgB,CAAC,QAAQ,IAAI,CAAC,OAAO,CAAC,IAAI,aAAa,CAAC,CAAC;SACpE;QAED,MAAM,
|
|
1
|
+
{"version":3,"file":"file.js","sourceRoot":"","sources":["../../../src/response-methods/file.ts"],"names":[],"mappings":";;;;;;AAAA,oCAAiC;AACjC,oDAA+D;AAE/D,oDAAuB;AACvB,gDAAwB;A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AAC,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;AAtBD,4CAsBC"}
|
|
@@ -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,21 +1,21 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Forbidden = 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 Forbidden 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.FORBIDDEN, 'forbidden.pug');
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
exports.Forbidden = Forbidden;
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Forbidden = 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 Forbidden 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.FORBIDDEN, 'forbidden.pug');
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.Forbidden = Forbidden;
|
|
21
21
|
//# 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,30 +1,30 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
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.js"), exports);
|
|
18
|
-
__exportStar(require("./created.js"), exports);
|
|
19
|
-
__exportStar(require("./file.js"), exports);
|
|
20
|
-
__exportStar(require("./forbidden.js"), exports);
|
|
21
|
-
__exportStar(require("./noContent.js"), exports);
|
|
22
|
-
__exportStar(require("./notFound.js"), exports);
|
|
23
|
-
__exportStar(require("./ok.js"), exports);
|
|
24
|
-
__exportStar(require("./template.js"), exports);
|
|
25
|
-
__exportStar(require("./serverError.js"), exports);
|
|
26
|
-
__exportStar(require("./unauthorized.js"), exports);
|
|
27
|
-
__exportStar(require("./cookieResponse.js"), exports);
|
|
28
|
-
__exportStar(require("./conflict.js"), exports);
|
|
29
|
-
__exportStar(require("./notAllowed.js"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
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.js"), exports);
|
|
18
|
+
__exportStar(require("./created.js"), exports);
|
|
19
|
+
__exportStar(require("./file.js"), exports);
|
|
20
|
+
__exportStar(require("./forbidden.js"), exports);
|
|
21
|
+
__exportStar(require("./noContent.js"), exports);
|
|
22
|
+
__exportStar(require("./notFound.js"), exports);
|
|
23
|
+
__exportStar(require("./ok.js"), exports);
|
|
24
|
+
__exportStar(require("./template.js"), exports);
|
|
25
|
+
__exportStar(require("./serverError.js"), exports);
|
|
26
|
+
__exportStar(require("./unauthorized.js"), exports);
|
|
27
|
+
__exportStar(require("./cookieResponse.js"), exports);
|
|
28
|
+
__exportStar(require("./conflict.js"), exports);
|
|
29
|
+
__exportStar(require("./notAllowed.js"), exports);
|
|
30
30
|
//# sourceMappingURL=index.js.map
|