@tsed/platform-response-filter 8.0.0-alpha.1 → 8.0.0-alpha.11
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/esm/decorators/responseFilter.js.map +1 -1
- package/lib/esm/domain/ResponseFiltersContainer.js.map +1 -1
- package/lib/esm/services/PlatformResponseFilter.js.map +1 -1
- package/lib/esm/utils/getContentType.js.map +1 -1
- package/lib/esm/utils/renderView.js.map +1 -1
- package/package.json +20 -21
- package/vitest.config.mts +1 -1
- package/lib/cjs/decorators/responseFilter.js +0 -23
- package/lib/cjs/decorators/responseFilter.js.map +0 -1
- package/lib/cjs/domain/ResponseFiltersContainer.js +0 -16
- package/lib/cjs/domain/ResponseFiltersContainer.js.map +0 -1
- package/lib/cjs/errors/TemplateRenderError.js +0 -23
- package/lib/cjs/errors/TemplateRenderError.js.map +0 -1
- package/lib/cjs/index.js +0 -14
- package/lib/cjs/index.js.map +0 -1
- package/lib/cjs/interfaces/ResponseFilterMethods.js +0 -3
- package/lib/cjs/interfaces/ResponseFilterMethods.js.map +0 -1
- package/lib/cjs/package.json +0 -3
- package/lib/cjs/services/PlatformResponseFilter.js +0 -105
- package/lib/cjs/services/PlatformResponseFilter.js.map +0 -1
- package/lib/cjs/utils/getContentType.js +0 -24
- package/lib/cjs/utils/getContentType.js.map +0 -1
- package/lib/cjs/utils/renderView.js +0 -17
- package/lib/cjs/utils/renderView.js.map +0 -1
- package/lib/esm/package.json +0 -3
- package/lib/types-esm/decorators/responseFilter.d.ts +0 -7
- package/lib/types-esm/domain/ResponseFiltersContainer.d.ts +0 -14
- package/lib/types-esm/errors/TemplateRenderError.d.ts +0 -14
- package/lib/types-esm/index.d.ts +0 -10
- package/lib/types-esm/interfaces/ResponseFilterMethods.d.ts +0 -15
- package/lib/types-esm/services/PlatformResponseFilter.d.ts +0 -29
- package/lib/types-esm/utils/getContentType.d.ts +0 -6
- package/lib/types-esm/utils/renderView.d.ts +0 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"responseFilter.js","sourceRoot":"","sources":["../../../src/decorators/responseFilter.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,gBAAgB,EAAC,MAAM,UAAU,CAAC;
|
|
1
|
+
{"version":3,"file":"responseFilter.js","sourceRoot":"","sources":["../../../src/decorators/responseFilter.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,gBAAgB,EAAC,MAAM,UAAU,CAAC;AAE1C,OAAO,EAAC,sBAAsB,EAAoB,MAAM,uCAAuC,CAAC;AAEhG;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,GAAG,YAAiC;IACjE,OAAO,CAAC,MAAW,EAAE,EAAE;QACrB,YAAY,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE;YACnC,sBAAsB,CAAC,WAAW,EAAE,MAAa,CAAC,CAAC;QACrD,CAAC,CAAC,CAAC;QACH,gBAAgB,CAAC;YACf,OAAO,EAAE,MAAM;YACf,QAAQ,EAAE,MAA8B;SACzC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ResponseFiltersContainer.js","sourceRoot":"","sources":["../../../src/domain/ResponseFiltersContainer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ResponseFiltersContainer.js","sourceRoot":"","sources":["../../../src/domain/ResponseFiltersContainer.ts"],"names":[],"mappings":"AAOA;;GAEG;AACH,yCAAyC;AACzC,MAAM,CAAC,MAAM,wBAAwB,GAAG,IAAI,GAAG,EAAkD,CAAC;AAClG;;GAEG;AACH,MAAM,UAAU,sBAAsB,CAAC,IAAuB,EAAE,KAAkC;IAChG,wBAAwB,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformResponseFilter.js","sourceRoot":"","sources":["../../../src/services/PlatformResponseFilter.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,cAAc,EAAO,MAAM,YAAY,CAAC;AAChD,OAAO,EAAc,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,EAAC,MAAM,UAAU,CAAC;AACpF,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"PlatformResponseFilter.js","sourceRoot":"","sources":["../../../src/services/PlatformResponseFilter.ts"],"names":[],"mappings":";AAAA,OAAO,EAAC,cAAc,EAAO,MAAM,YAAY,CAAC;AAChD,OAAO,EAAc,QAAQ,EAAE,MAAM,EAAE,UAAU,EAAE,eAAe,EAAC,MAAM,UAAU,CAAC;AACpF,OAAO,EAAC,SAAS,EAAC,MAAM,mBAAmB,CAAC;AAE5C,OAAO,EAAoB,wBAAwB,EAAC,MAAM,uCAAuC,CAAC;AAElG,OAAO,EAAC,gBAAgB,EAAE,cAAc,EAAC,MAAM,4BAA4B,CAAC;AAC5E,OAAO,EAAC,UAAU,EAAC,MAAM,wBAAwB,CAAC;AAElD;;GAEG;AAEI,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAA5B;QACK,UAAK,GAAkD,IAAI,GAAG,EAAE,CAAC;IAiG7E,CAAC;IAtFC,IAAI,YAAY;QACd,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IAChC,CAAC;IAED,OAAO;QACL,wBAAwB,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YAC/C,IAAI,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE,CAAC;gBACzC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAE,CAAC,CAAC;YAClD,CAAC;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,kBAAkB,CAAC,IAAS,EAAE,GAAgB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,CAAC;;oEACO;AAV7B,sBAAsB;IADlC,UAAU,EAAE;GACA,sBAAsB,CAkGlC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getContentType.js","sourceRoot":"","sources":["../../../src/utils/getContentType.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAGpC,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAEtC;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,IAAS,EAAE,GAAgB;IACxD,MAAM,EAAC,QAAQ,EAAE,QAAQ,EAAC,GAAG,GAAG,CAAC;IACjC,MAAM,EAAC,SAAS,EAAC,GAAG,QAAQ,CAAC;IAE7B,MAAM,WAAW,GAAG,QAAQ,CAAC,cAAc,EAAE,IAAI,SAAS,CAAC,gBAAgB,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;IAEvG,IAAI,WAAW,IAAI,WAAW,KAAK,gBAAgB,EAAE;
|
|
1
|
+
{"version":3,"file":"getContentType.js","sourceRoot":"","sources":["../../../src/utils/getContentType.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAGpC,MAAM,CAAC,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAEtC;;GAEG;AACH,MAAM,UAAU,cAAc,CAAC,IAAS,EAAE,GAAgB;IACxD,MAAM,EAAC,QAAQ,EAAE,QAAQ,EAAC,GAAG,GAAG,CAAC;IACjC,MAAM,EAAC,SAAS,EAAC,GAAG,QAAQ,CAAC;IAE7B,MAAM,WAAW,GAAG,QAAQ,CAAC,cAAc,EAAE,IAAI,SAAS,CAAC,gBAAgB,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;IAEvG,IAAI,WAAW,IAAI,WAAW,KAAK,gBAAgB,EAAE,CAAC;QACpD,IAAI,WAAW,KAAK,kBAAkB,IAAI,QAAQ,CAAC,IAAI,CAAC,EAAE,CAAC;YACzD,OAAO,kBAAkB,CAAC;QAC5B,CAAC;QAED,OAAO,WAAW,CAAC;IACrB,CAAC;IAED,IAAI,QAAQ,CAAC,IAAI,EAAE,CAAC;QAClB,OAAO,WAAW,CAAC;IACrB,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"renderView.js","sourceRoot":"","sources":["../../../src/utils/renderView.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"renderView.js","sourceRoot":"","sources":["../../../src/utils/renderView.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,mBAAmB,EAAC,MAAM,kCAAkC,CAAC;AAErE,MAAM,CAAC,KAAK,UAAU,UAAU,CAAC,IAAS,EAAE,IAAiB;IAC3D,MAAM,EAAC,QAAQ,EAAE,QAAQ,EAAC,GAAG,IAAI,CAAC;IAClC,IAAI,CAAC;QACH,MAAM,EAAC,IAAI,EAAC,GAAG,IAAI,CAAC;QACpB,MAAM,EAAC,IAAI,EAAE,OAAO,EAAC,GAAG,QAAQ,CAAC,IAAI,CAAC;QAEtC,OAAO,MAAM,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,EAAC,GAAG,OAAO,EAAE,GAAG,IAAI,EAAE,IAAI,EAAC,CAAC,CAAC;IAClE,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,mBAAmB,CAAC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;IAChF,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,18 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsed/platform-response-filter",
|
|
3
3
|
"description": "Platform response filter module for Ts.ED Framework",
|
|
4
|
-
"type": "
|
|
5
|
-
"version": "8.0.0-alpha.
|
|
4
|
+
"type": "module",
|
|
5
|
+
"version": "8.0.0-alpha.11",
|
|
6
6
|
"source": "./src/index.ts",
|
|
7
|
-
"main": "./lib/
|
|
7
|
+
"main": "./lib/esm/index.js",
|
|
8
8
|
"module": "./lib/esm/index.js",
|
|
9
9
|
"typings": "./lib/types/index.d.ts",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
12
|
"types": "./lib/types/index.d.ts",
|
|
13
13
|
"import": "./lib/esm/index.js",
|
|
14
|
-
"
|
|
15
|
-
"default": "./lib/cjs/index.js"
|
|
14
|
+
"default": "./lib/esm/index.js"
|
|
16
15
|
}
|
|
17
16
|
},
|
|
18
17
|
"scripts": {
|
|
@@ -23,26 +22,26 @@
|
|
|
23
22
|
"test:ci": "vitest run --coverage.thresholds.autoUpdate=true"
|
|
24
23
|
},
|
|
25
24
|
"dependencies": {
|
|
26
|
-
"tslib": "2.
|
|
25
|
+
"tslib": "2.7.0"
|
|
27
26
|
},
|
|
28
27
|
"devDependencies": {
|
|
29
|
-
"@tsed/barrels": "8.0.0-alpha.
|
|
30
|
-
"@tsed/core": "8.0.0-alpha.
|
|
31
|
-
"@tsed/di": "8.0.0-alpha.
|
|
32
|
-
"@tsed/exceptions": "8.0.0-alpha.
|
|
33
|
-
"@tsed/json-mapper": "8.0.0-alpha.
|
|
34
|
-
"@tsed/schema": "8.0.0-alpha.
|
|
35
|
-
"@tsed/typescript": "8.0.0-alpha.
|
|
36
|
-
"eslint": "
|
|
37
|
-
"typescript": "4.
|
|
38
|
-
"vitest": "2.
|
|
28
|
+
"@tsed/barrels": "8.0.0-alpha.11",
|
|
29
|
+
"@tsed/core": "8.0.0-alpha.11",
|
|
30
|
+
"@tsed/di": "8.0.0-alpha.11",
|
|
31
|
+
"@tsed/exceptions": "8.0.0-alpha.11",
|
|
32
|
+
"@tsed/json-mapper": "8.0.0-alpha.11",
|
|
33
|
+
"@tsed/schema": "8.0.0-alpha.11",
|
|
34
|
+
"@tsed/typescript": "8.0.0-alpha.11",
|
|
35
|
+
"eslint": "9.12.0",
|
|
36
|
+
"typescript": "5.4.5",
|
|
37
|
+
"vitest": "2.1.2"
|
|
39
38
|
},
|
|
40
39
|
"peerDependencies": {
|
|
41
|
-
"@tsed/core": "8.0.0-alpha.
|
|
42
|
-
"@tsed/di": "8.0.0-alpha.
|
|
43
|
-
"@tsed/exceptions": "8.0.0-alpha.
|
|
44
|
-
"@tsed/json-mapper": "8.0.0-alpha.
|
|
45
|
-
"@tsed/schema": "8.0.0-alpha.
|
|
40
|
+
"@tsed/core": "8.0.0-alpha.11",
|
|
41
|
+
"@tsed/di": "8.0.0-alpha.11",
|
|
42
|
+
"@tsed/exceptions": "8.0.0-alpha.11",
|
|
43
|
+
"@tsed/json-mapper": "8.0.0-alpha.11",
|
|
44
|
+
"@tsed/schema": "8.0.0-alpha.11"
|
|
46
45
|
},
|
|
47
46
|
"peerDependenciesMeta": {
|
|
48
47
|
"@tsed/core": {
|
package/vitest.config.mts
CHANGED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ResponseFilter = void 0;
|
|
4
|
-
const di_1 = require("@tsed/di");
|
|
5
|
-
const ResponseFiltersContainer_js_1 = require("../domain/ResponseFiltersContainer.js");
|
|
6
|
-
/**
|
|
7
|
-
* Register a response filter service.
|
|
8
|
-
* @param contentTypes
|
|
9
|
-
* @decorator
|
|
10
|
-
*/
|
|
11
|
-
function ResponseFilter(...contentTypes) {
|
|
12
|
-
return (target) => {
|
|
13
|
-
contentTypes.forEach((contentType) => {
|
|
14
|
-
(0, ResponseFiltersContainer_js_1.registerResponseFilter)(contentType, target);
|
|
15
|
-
});
|
|
16
|
-
(0, di_1.registerProvider)({
|
|
17
|
-
provide: target,
|
|
18
|
-
useClass: target
|
|
19
|
-
});
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
exports.ResponseFilter = ResponseFilter;
|
|
23
|
-
//# sourceMappingURL=responseFilter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"responseFilter.js","sourceRoot":"","sources":["../../../src/decorators/responseFilter.ts"],"names":[],"mappings":";;;AACA,iCAA0C;AAC1C,uFAAgG;AAEhG;;;;GAIG;AACH,SAAgB,cAAc,CAAC,GAAG,YAAiC;IACjE,OAAO,CAAC,MAAW,EAAE,EAAE;QACrB,YAAY,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,EAAE;YACnC,IAAA,oDAAsB,EAAC,WAAW,EAAE,MAAa,CAAC,CAAC;QACrD,CAAC,CAAC,CAAC;QACH,IAAA,qBAAgB,EAAC;YACf,OAAO,EAAE,MAAM;YACf,QAAQ,EAAE,MAA8B;SACzC,CAAC,CAAC;IACL,CAAC,CAAC;AACJ,CAAC;AAVD,wCAUC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.registerResponseFilter = exports.ResponseFiltersContainer = void 0;
|
|
4
|
-
/**
|
|
5
|
-
* @ignore
|
|
6
|
-
*/
|
|
7
|
-
// tslint:disable-next-line:variable-name
|
|
8
|
-
exports.ResponseFiltersContainer = new Map();
|
|
9
|
-
/**
|
|
10
|
-
* @ignore
|
|
11
|
-
*/
|
|
12
|
-
function registerResponseFilter(type, token) {
|
|
13
|
-
exports.ResponseFiltersContainer.set(type, token);
|
|
14
|
-
}
|
|
15
|
-
exports.registerResponseFilter = registerResponseFilter;
|
|
16
|
-
//# sourceMappingURL=ResponseFiltersContainer.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ResponseFiltersContainer.js","sourceRoot":"","sources":["../../../src/domain/ResponseFiltersContainer.ts"],"names":[],"mappings":";;;AAMA;;GAEG;AACH,yCAAyC;AAC5B,QAAA,wBAAwB,GAAG,IAAI,GAAG,EAAkD,CAAC;AAClG;;GAEG;AACH,SAAgB,sBAAsB,CAAC,IAAuB,EAAE,KAAkC;IAChG,gCAAwB,CAAC,GAAG,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAC5C,CAAC;AAFD,wDAEC"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TemplateRenderError = void 0;
|
|
4
|
-
const core_1 = require("@tsed/core");
|
|
5
|
-
const exceptions_1 = require("@tsed/exceptions");
|
|
6
|
-
/**
|
|
7
|
-
* @private
|
|
8
|
-
*/
|
|
9
|
-
class TemplateRenderError extends exceptions_1.InternalServerError {
|
|
10
|
-
constructor(target, method, err) {
|
|
11
|
-
super(TemplateRenderError.buildMessage(target, method, err));
|
|
12
|
-
this.name = "TEMPLATE_RENDER_ERROR";
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
*
|
|
16
|
-
* @returns {string}
|
|
17
|
-
*/
|
|
18
|
-
static buildMessage(target, method, err) {
|
|
19
|
-
return `Template rendering error: ${(0, core_1.nameOf)(target)}.${String(method)}()\n` + err;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
exports.TemplateRenderError = TemplateRenderError;
|
|
23
|
-
//# sourceMappingURL=TemplateRenderError.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateRenderError.js","sourceRoot":"","sources":["../../../src/errors/TemplateRenderError.ts"],"names":[],"mappings":";;;AAAA,qCAAwC;AACxC,iDAAqD;AAErD;;GAEG;AACH,MAAa,mBAAoB,SAAQ,gCAAmB;IAG1D,YAAY,MAA0B,EAAE,MAAuB,EAAE,GAAU;QACzE,KAAK,CAAC,mBAAmB,CAAC,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;QAH/D,SAAI,GAAG,uBAAuB,CAAC;IAI/B,CAAC;IAED;;;OAGG;IACH,MAAM,CAAC,YAAY,CAAC,MAA0B,EAAE,MAAuB,EAAE,GAAU;QACjF,OAAO,6BAA6B,IAAA,aAAM,EAAC,MAAM,CAAC,IAAI,MAAM,CAAC,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC;IACnF,CAAC;CACF;AAdD,kDAcC"}
|
package/lib/cjs/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
/**
|
|
5
|
-
* @file Automatically generated by @tsed/barrels.
|
|
6
|
-
*/
|
|
7
|
-
tslib_1.__exportStar(require("./decorators/responseFilter.js"), exports);
|
|
8
|
-
tslib_1.__exportStar(require("./domain/ResponseFiltersContainer.js"), exports);
|
|
9
|
-
tslib_1.__exportStar(require("./errors/TemplateRenderError.js"), exports);
|
|
10
|
-
tslib_1.__exportStar(require("./interfaces/ResponseFilterMethods.js"), exports);
|
|
11
|
-
tslib_1.__exportStar(require("./services/PlatformResponseFilter.js"), exports);
|
|
12
|
-
tslib_1.__exportStar(require("./utils/getContentType.js"), exports);
|
|
13
|
-
tslib_1.__exportStar(require("./utils/renderView.js"), exports);
|
|
14
|
-
//# sourceMappingURL=index.js.map
|
package/lib/cjs/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;AAAA;;GAEG;AACH,yEAA+C;AAC/C,+EAAqD;AACrD,0EAAgD;AAChD,gFAAsD;AACtD,+EAAqD;AACrD,oEAA0C;AAC1C,gEAAsC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ResponseFilterMethods.js","sourceRoot":"","sources":["../../../src/interfaces/ResponseFilterMethods.ts"],"names":[],"mappings":""}
|
package/lib/cjs/package.json
DELETED
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PlatformResponseFilter = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
const core_1 = require("@tsed/core");
|
|
6
|
-
const di_1 = require("@tsed/di");
|
|
7
|
-
const json_mapper_1 = require("@tsed/json-mapper");
|
|
8
|
-
const ResponseFiltersContainer_js_1 = require("../domain/ResponseFiltersContainer.js");
|
|
9
|
-
const getContentType_js_1 = require("../utils/getContentType.js");
|
|
10
|
-
const renderView_js_1 = require("../utils/renderView.js");
|
|
11
|
-
/**
|
|
12
|
-
* @platform
|
|
13
|
-
*/
|
|
14
|
-
let PlatformResponseFilter = class PlatformResponseFilter {
|
|
15
|
-
constructor() {
|
|
16
|
-
this.types = new Map();
|
|
17
|
-
}
|
|
18
|
-
get contentTypes() {
|
|
19
|
-
return [...this.types.keys()];
|
|
20
|
-
}
|
|
21
|
-
$onInit() {
|
|
22
|
-
ResponseFiltersContainer_js_1.ResponseFiltersContainer.forEach((token, type) => {
|
|
23
|
-
if (this.responseFilters.includes(token)) {
|
|
24
|
-
this.types.set(type, this.injector.get(token));
|
|
25
|
-
}
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
getBestContentType(data, ctx) {
|
|
29
|
-
const contentType = (0, getContentType_js_1.getContentType)(data, ctx);
|
|
30
|
-
if (ctx.request.get("Accept")) {
|
|
31
|
-
const bestContentType = ctx.request.accepts([contentType].concat(this.contentTypes).filter(Boolean));
|
|
32
|
-
if (bestContentType) {
|
|
33
|
-
return [].concat(bestContentType).filter((type) => type !== "*/*")[0];
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return contentType;
|
|
37
|
-
}
|
|
38
|
-
/**
|
|
39
|
-
* Call filters to transform data
|
|
40
|
-
* @param data
|
|
41
|
-
* @param ctx
|
|
42
|
-
*/
|
|
43
|
-
transform(data, ctx) {
|
|
44
|
-
const { response } = ctx;
|
|
45
|
-
if (ctx.endpoint?.operation) {
|
|
46
|
-
const bestContentType = this.getBestContentType(data, ctx);
|
|
47
|
-
bestContentType && response.contentType(bestContentType);
|
|
48
|
-
if (this.types.has(bestContentType)) {
|
|
49
|
-
return this.types.get(bestContentType).transform(data, ctx);
|
|
50
|
-
}
|
|
51
|
-
if (this.types.has(getContentType_js_1.ANY_CONTENT_TYPE)) {
|
|
52
|
-
return this.types.get(getContentType_js_1.ANY_CONTENT_TYPE).transform(data, ctx);
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return data;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* Serialize data before calling filters
|
|
59
|
-
* @param data
|
|
60
|
-
* @param ctx
|
|
61
|
-
*/
|
|
62
|
-
async serialize(data, ctx) {
|
|
63
|
-
const { response, endpoint } = ctx;
|
|
64
|
-
if (endpoint) {
|
|
65
|
-
if (endpoint.view) {
|
|
66
|
-
data = await (0, renderView_js_1.renderView)(data, ctx);
|
|
67
|
-
}
|
|
68
|
-
else if ((0, core_1.isSerializable)(data)) {
|
|
69
|
-
const responseOpts = endpoint.getResponseOptions(response.statusCode, {
|
|
70
|
-
includes: this.getIncludes(ctx)
|
|
71
|
-
});
|
|
72
|
-
data = (0, json_mapper_1.serialize)(data, {
|
|
73
|
-
useAlias: true,
|
|
74
|
-
additionalProperties: this.additionalProperties,
|
|
75
|
-
...responseOpts,
|
|
76
|
-
endpoint: true
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
return data;
|
|
81
|
-
}
|
|
82
|
-
getIncludes(ctx) {
|
|
83
|
-
if (ctx.request.query.includes) {
|
|
84
|
-
return [].concat(ctx.request.query.includes).flatMap((include) => include.split(","));
|
|
85
|
-
}
|
|
86
|
-
return undefined;
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
tslib_1.__decorate([
|
|
90
|
-
(0, di_1.Inject)(),
|
|
91
|
-
tslib_1.__metadata("design:type", di_1.InjectorService)
|
|
92
|
-
], PlatformResponseFilter.prototype, "injector", void 0);
|
|
93
|
-
tslib_1.__decorate([
|
|
94
|
-
(0, di_1.Constant)("responseFilters", []),
|
|
95
|
-
tslib_1.__metadata("design:type", Array)
|
|
96
|
-
], PlatformResponseFilter.prototype, "responseFilters", void 0);
|
|
97
|
-
tslib_1.__decorate([
|
|
98
|
-
(0, di_1.Constant)("additionalProperties"),
|
|
99
|
-
tslib_1.__metadata("design:type", Boolean)
|
|
100
|
-
], PlatformResponseFilter.prototype, "additionalProperties", void 0);
|
|
101
|
-
PlatformResponseFilter = tslib_1.__decorate([
|
|
102
|
-
(0, di_1.Injectable)()
|
|
103
|
-
], PlatformResponseFilter);
|
|
104
|
-
exports.PlatformResponseFilter = PlatformResponseFilter;
|
|
105
|
-
//# sourceMappingURL=PlatformResponseFilter.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PlatformResponseFilter.js","sourceRoot":"","sources":["../../../src/services/PlatformResponseFilter.ts"],"names":[],"mappings":";;;;AAAA,qCAAgD;AAChD,iCAAoF;AACpF,mDAA4C;AAC5C,uFAAkG;AAElG,kEAA4E;AAC5E,0DAAkD;AAElD;;GAEG;AAEI,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAA5B;QACK,UAAK,GAAkD,IAAI,GAAG,EAAE,CAAC;IAiG7E,CAAC;IAtFC,IAAI,YAAY;QACd,OAAO,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IAChC,CAAC;IAED,OAAO;QACL,sDAAwB,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE;YAC/C,IAAI,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;gBACxC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,KAAK,CAAE,CAAC,CAAC;aACjD;QACH,CAAC,CAAC,CAAC;IACL,CAAC;IAED,kBAAkB,CAAC,IAAS,EAAE,GAAgB;QAC5C,MAAM,WAAW,GAAG,IAAA,kCAAc,EAAC,IAAI,EAAE,GAAG,CAAC,CAAC;QAE9C,I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strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getContentType = exports.ANY_CONTENT_TYPE = void 0;
|
|
4
|
-
const core_1 = require("@tsed/core");
|
|
5
|
-
exports.ANY_CONTENT_TYPE = "*/*";
|
|
6
|
-
/**
|
|
7
|
-
* @ignore
|
|
8
|
-
*/
|
|
9
|
-
function getContentType(data, ctx) {
|
|
10
|
-
const { endpoint, response } = ctx;
|
|
11
|
-
const { operation } = endpoint;
|
|
12
|
-
const contentType = response.getContentType() || operation.getContentTypeOf(response.statusCode) || "";
|
|
13
|
-
if (contentType && contentType !== exports.ANY_CONTENT_TYPE) {
|
|
14
|
-
if (contentType === "application/json" && (0, core_1.isObject)(data)) {
|
|
15
|
-
return "application/json";
|
|
16
|
-
}
|
|
17
|
-
return contentType;
|
|
18
|
-
}
|
|
19
|
-
if (endpoint.view) {
|
|
20
|
-
return "text/html";
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
exports.getContentType = getContentType;
|
|
24
|
-
//# sourceMappingURL=getContentType.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getContentType.js","sourceRoot":"","sources":["../../../src/utils/getContentType.ts"],"names":[],"mappings":";;;AAAA,qCAAoC;AAGvB,QAAA,gBAAgB,GAAG,KAAK,CAAC;AAEtC;;GAEG;AACH,SAAgB,cAAc,CAAC,IAAS,EAAE,GAAgB;IACxD,MAAM,EAAC,QAAQ,EAAE,QAAQ,EAAC,GAAG,GAAG,CAAC;IACjC,MAAM,EAAC,SAAS,EAAC,GAAG,QAAQ,CAAC;IAE7B,MAAM,WAAW,GAAG,QAAQ,CAAC,cAAc,EAAE,IAAI,SAAS,CAAC,gBAAgB,CAAC,QAAQ,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;IAEvG,IAAI,WAAW,IAAI,WAAW,KAAK,wBAAgB,EAAE;QACnD,IAAI,WAAW,KAAK,kBAAkB,IAAI,IAAA,eAAQ,EAAC,IAAI,CAAC,EAAE;YACxD,OAAO,kBAAkB,CAAC;SAC3B;QAED,OAAO,WAAW,CAAC;KACpB;IAED,IAAI,QAAQ,CAAC,IAAI,EAAE;QACjB,OAAO,WAAW,CAAC;KACpB;AACH,CAAC;AAjBD,wCAiBC"}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.renderView = void 0;
|
|
4
|
-
const TemplateRenderError_js_1 = require("../errors/TemplateRenderError.js");
|
|
5
|
-
async function renderView(data, $ctx) {
|
|
6
|
-
const { response, endpoint } = $ctx;
|
|
7
|
-
try {
|
|
8
|
-
const { data } = $ctx;
|
|
9
|
-
const { path, options } = endpoint.view;
|
|
10
|
-
return await response.render(path, { ...options, ...data, $ctx });
|
|
11
|
-
}
|
|
12
|
-
catch (err) {
|
|
13
|
-
throw new TemplateRenderError_js_1.TemplateRenderError(endpoint.targetName, endpoint.propertyKey, err);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
exports.renderView = renderView;
|
|
17
|
-
//# sourceMappingURL=renderView.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"renderView.js","sourceRoot":"","sources":["../../../src/utils/renderView.ts"],"names":[],"mappings":";;;AACA,6EAAqE;AAE9D,KAAK,UAAU,UAAU,CAAC,IAAS,EAAE,IAAiB;IAC3D,MAAM,EAAC,QAAQ,EAAE,QAAQ,EAAC,GAAG,IAAI,CAAC;IAClC,IAAI;QACF,MAAM,EAAC,IAAI,EAAC,GAAG,IAAI,CAAC;QACpB,MAAM,EAAC,IAAI,EAAE,OAAO,EAAC,GAAG,QAAQ,CAAC,IAAI,CAAC;QAEtC,OAAO,MAAM,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,EAAC,GAAG,OAAO,EAAE,GAAG,IAAI,EAAE,IAAI,EAAC,CAAC,CAAC;KACjE;IAAC,OAAO,GAAG,EAAE;QACZ,MAAM,IAAI,4CAAmB,CAAC,QAAQ,CAAC,UAAU,EAAE,QAAQ,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;KAC/E;AACH,CAAC;AAVD,gCAUC"}
|
package/lib/esm/package.json
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Type } from "@tsed/core";
|
|
2
|
-
import { ResponseFilterMethods } from "../interfaces/ResponseFilterMethods.js";
|
|
3
|
-
/**
|
|
4
|
-
* @ignore
|
|
5
|
-
*/
|
|
6
|
-
export type ResponseFilterKey = "*/*" | "application/json" | "text/html" | "plain/text" | string;
|
|
7
|
-
/**
|
|
8
|
-
* @ignore
|
|
9
|
-
*/
|
|
10
|
-
export declare const ResponseFiltersContainer: Map<string, Type<ResponseFilterMethods<unknown>>>;
|
|
11
|
-
/**
|
|
12
|
-
* @ignore
|
|
13
|
-
*/
|
|
14
|
-
export declare function registerResponseFilter(type: ResponseFilterKey, token: Type<ResponseFilterMethods>): void;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { Type } from "@tsed/core";
|
|
2
|
-
import { InternalServerError } from "@tsed/exceptions";
|
|
3
|
-
/**
|
|
4
|
-
* @private
|
|
5
|
-
*/
|
|
6
|
-
export declare class TemplateRenderError extends InternalServerError {
|
|
7
|
-
name: string;
|
|
8
|
-
constructor(target: Type<any> | string, method: string | symbol, err: Error);
|
|
9
|
-
/**
|
|
10
|
-
*
|
|
11
|
-
* @returns {string}
|
|
12
|
-
*/
|
|
13
|
-
static buildMessage(target: Type<any> | string, method: string | symbol, err: Error): string;
|
|
14
|
-
}
|
package/lib/types-esm/index.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @file Automatically generated by @tsed/barrels.
|
|
3
|
-
*/
|
|
4
|
-
export * from "./decorators/responseFilter.js";
|
|
5
|
-
export * from "./domain/ResponseFiltersContainer.js";
|
|
6
|
-
export * from "./errors/TemplateRenderError.js";
|
|
7
|
-
export * from "./interfaces/ResponseFilterMethods.js";
|
|
8
|
-
export * from "./services/PlatformResponseFilter.js";
|
|
9
|
-
export * from "./utils/getContentType.js";
|
|
10
|
-
export * from "./utils/renderView.js";
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { Type } from "@tsed/core";
|
|
2
|
-
import type { BaseContext } from "@tsed/di";
|
|
3
|
-
declare global {
|
|
4
|
-
namespace TsED {
|
|
5
|
-
interface Configuration {
|
|
6
|
-
/**
|
|
7
|
-
* A list of response filters must be called before returning a response to the consumer. See more on [Response filters](/docs/response-filter.md).
|
|
8
|
-
*/
|
|
9
|
-
responseFilters: Type<ResponseFilterMethods>[];
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
export interface ResponseFilterMethods<T = unknown> {
|
|
14
|
-
transform(data: T, ctx: BaseContext): any;
|
|
15
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { Type } from "@tsed/core";
|
|
2
|
-
import { BaseContext, InjectorService } from "@tsed/di";
|
|
3
|
-
import { ResponseFilterKey } from "../domain/ResponseFiltersContainer.js";
|
|
4
|
-
import { ResponseFilterMethods } from "../interfaces/ResponseFilterMethods.js";
|
|
5
|
-
/**
|
|
6
|
-
* @platform
|
|
7
|
-
*/
|
|
8
|
-
export declare class PlatformResponseFilter {
|
|
9
|
-
protected types: Map<ResponseFilterKey, ResponseFilterMethods>;
|
|
10
|
-
protected injector: InjectorService;
|
|
11
|
-
protected responseFilters: Type<ResponseFilterMethods>[];
|
|
12
|
-
protected additionalProperties: boolean;
|
|
13
|
-
get contentTypes(): ResponseFilterKey[];
|
|
14
|
-
$onInit(): void;
|
|
15
|
-
getBestContentType(data: any, ctx: BaseContext): any;
|
|
16
|
-
/**
|
|
17
|
-
* Call filters to transform data
|
|
18
|
-
* @param data
|
|
19
|
-
* @param ctx
|
|
20
|
-
*/
|
|
21
|
-
transform(data: unknown, ctx: BaseContext): any;
|
|
22
|
-
/**
|
|
23
|
-
* Serialize data before calling filters
|
|
24
|
-
* @param data
|
|
25
|
-
* @param ctx
|
|
26
|
-
*/
|
|
27
|
-
serialize(data: unknown, ctx: BaseContext): Promise<unknown>;
|
|
28
|
-
private getIncludes;
|
|
29
|
-
}
|