@tsed/platform-response-filter 6.87.2 → 6.90.0

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.
Files changed (60) hide show
  1. package/lib/{decorators → cjs/decorators}/responseFilter.d.ts +0 -0
  2. package/lib/cjs/decorators/responseFilter.js +23 -0
  3. package/lib/cjs/decorators/responseFilter.js.map +1 -0
  4. package/lib/{domain → cjs/domain}/ResponseFiltersContainer.d.ts +0 -0
  5. package/lib/cjs/domain/ResponseFiltersContainer.js +16 -0
  6. package/lib/cjs/domain/ResponseFiltersContainer.js.map +1 -0
  7. package/lib/cjs/errors/TemplateRenderError.d.ts +14 -0
  8. package/lib/cjs/errors/TemplateRenderError.js +23 -0
  9. package/lib/cjs/errors/TemplateRenderError.js.map +1 -0
  10. package/lib/{index.d.ts → cjs/index.d.ts} +2 -0
  11. package/lib/cjs/index.js +16 -0
  12. package/lib/cjs/index.js.map +1 -0
  13. package/lib/{interfaces → cjs/interfaces}/ResponseFilterMethods.d.ts +0 -0
  14. package/lib/cjs/interfaces/ResponseFilterMethods.js +3 -0
  15. package/lib/cjs/interfaces/ResponseFilterMethods.js.map +1 -0
  16. package/lib/{services → cjs/services}/ConverterService.d.ts +0 -0
  17. package/lib/cjs/services/ConverterService.js +54 -0
  18. package/lib/cjs/services/ConverterService.js.map +1 -0
  19. package/lib/{services → cjs/services}/PlatformResponseFilter.d.ts +0 -0
  20. package/lib/cjs/services/PlatformResponseFilter.js +88 -0
  21. package/lib/cjs/services/PlatformResponseFilter.js.map +1 -0
  22. package/lib/{utils → cjs/utils}/getContentType.d.ts +0 -0
  23. package/lib/cjs/utils/getContentType.js +28 -0
  24. package/lib/cjs/utils/getContentType.js.map +1 -0
  25. package/lib/cjs/utils/renderView.d.ts +2 -0
  26. package/lib/cjs/utils/renderView.js +17 -0
  27. package/lib/cjs/utils/renderView.js.map +1 -0
  28. package/lib/esm/decorators/responseFilter.js +19 -0
  29. package/lib/esm/decorators/responseFilter.js.map +1 -0
  30. package/lib/esm/domain/ResponseFiltersContainer.js +12 -0
  31. package/lib/esm/domain/ResponseFiltersContainer.js.map +1 -0
  32. package/lib/esm/errors/TemplateRenderError.js +19 -0
  33. package/lib/esm/errors/TemplateRenderError.js.map +1 -0
  34. package/lib/esm/index.js +13 -0
  35. package/lib/esm/index.js.map +1 -0
  36. package/lib/esm/interfaces/ResponseFilterMethods.js +2 -0
  37. package/lib/esm/interfaces/ResponseFilterMethods.js.map +1 -0
  38. package/lib/esm/services/ConverterService.js +51 -0
  39. package/lib/esm/services/ConverterService.js.map +1 -0
  40. package/lib/esm/services/PlatformResponseFilter.js +85 -0
  41. package/lib/esm/services/PlatformResponseFilter.js.map +1 -0
  42. package/lib/esm/utils/getContentType.js +24 -0
  43. package/lib/esm/utils/getContentType.js.map +1 -0
  44. package/lib/esm/utils/renderView.js +13 -0
  45. package/lib/esm/utils/renderView.js.map +1 -0
  46. package/lib/types/decorators/responseFilter.d.ts +7 -0
  47. package/lib/types/domain/ResponseFiltersContainer.d.ts +14 -0
  48. package/lib/types/errors/TemplateRenderError.d.ts +14 -0
  49. package/lib/types/index.d.ts +8 -0
  50. package/lib/types/interfaces/ResponseFilterMethods.d.ts +15 -0
  51. package/lib/types/services/ConverterService.d.ts +30 -0
  52. package/lib/types/services/PlatformResponseFilter.d.ts +27 -0
  53. package/lib/types/utils/getContentType.d.ts +6 -0
  54. package/lib/types/utils/renderView.d.ts +2 -0
  55. package/package.json +22 -18
  56. package/tsconfig.compile.esm.json +23 -0
  57. package/lib/index.js +0 -230
  58. package/lib/index.js.map +0 -1
  59. package/lib/index.modern.js +0 -226
  60. package/lib/index.modern.js.map +0 -1
@@ -1,226 +0,0 @@
1
- import { registerProvider, Injectable, Configuration, InjectorService, Inject, Constant } from '@tsed/di';
2
- import { __decorate, __param, __metadata } from 'tslib';
3
- import { isObject, isSerializable } from '@tsed/core';
4
- import { renderView } from '@tsed/platform-views';
5
- import { serialize, deserialize } from '@tsed/json-mapper';
6
-
7
- /**
8
- * @ignore
9
- */
10
- // tslint:disable-next-line:variable-name
11
- const ResponseFiltersContainer = new Map();
12
- /**
13
- * @ignore
14
- */
15
-
16
- function registerResponseFilter(type, token) {
17
- ResponseFiltersContainer.set(type, token);
18
- }
19
-
20
- /**
21
- * Register a response filter service.
22
- * @param contentTypes
23
- * @decorator
24
- */
25
-
26
- function ResponseFilter(...contentTypes) {
27
- return target => {
28
- contentTypes.forEach(contentType => {
29
- registerResponseFilter(contentType, target);
30
- });
31
- registerProvider({
32
- provide: target,
33
- useClass: target
34
- });
35
- };
36
- }
37
-
38
- function _extends() {
39
- _extends = Object.assign || function (target) {
40
- for (var i = 1; i < arguments.length; i++) {
41
- var source = arguments[i];
42
-
43
- for (var key in source) {
44
- if (Object.prototype.hasOwnProperty.call(source, key)) {
45
- target[key] = source[key];
46
- }
47
- }
48
- }
49
-
50
- return target;
51
- };
52
-
53
- return _extends.apply(this, arguments);
54
- }
55
-
56
- const ANY_CONTENT_TYPE = "*/*";
57
- /**
58
- * @ignore
59
- */
60
-
61
- function getContentType(data, ctx) {
62
- const {
63
- endpoint,
64
- response
65
- } = ctx;
66
- const {
67
- operation
68
- } = endpoint;
69
- const contentType = response.getContentType() || operation.getContentTypeOf(response.statusCode) || "";
70
-
71
- if (contentType && contentType !== ANY_CONTENT_TYPE) {
72
- if (contentType === "application/json") {
73
- if (isObject(data)) {
74
- return contentType;
75
- }
76
- } else {
77
- return contentType;
78
- }
79
- }
80
-
81
- if (typeof data === "string" && endpoint.view) {
82
- return "text/html";
83
- }
84
- }
85
-
86
- /**
87
- * @deprecated Since 2021-10-03. Use serialize/deserialize functions from @tsed/json-mapper instead
88
- */
89
-
90
- let ConverterService = class ConverterService {
91
- constructor(injectorService, configuration) {
92
- this.injectorService = injectorService;
93
- this._additionalProperties = configuration.get("converter.additionalProperties");
94
- }
95
- /**
96
- * Convert instance to plainObject.
97
- *
98
- * @param obj
99
- * @param options
100
- */
101
-
102
-
103
- serialize(obj, options = {}) {
104
- return serialize(obj, _extends({
105
- useAlias: true,
106
- additionalProperties: this._additionalProperties === "accept"
107
- }, options));
108
- }
109
- /**
110
- * Convert a plainObject to targetType.
111
- *
112
- * ### Options
113
- *
114
- * - `ignoreCallback`: callback called for each object which will be deserialized. The callback can return a boolean to avoid the default converter behavior.
115
- * - `checkRequiredValue`: Disable the required check condition.
116
- *
117
- * @param obj Object source that will be deserialized
118
- * @param options Mapping options
119
- * @returns {any}
120
- */
121
-
122
-
123
- deserialize(obj, options = {}) {
124
- return deserialize(obj, _extends({
125
- useAlias: true,
126
- additionalProperties: this._additionalProperties === "accept"
127
- }, options));
128
- }
129
-
130
- };
131
- ConverterService = __decorate([Injectable(), __param(1, Configuration()), __metadata("design:paramtypes", [InjectorService, Object])], ConverterService);
132
-
133
- /**
134
- * @platform
135
- */
136
-
137
- let PlatformResponseFilter = class PlatformResponseFilter {
138
- constructor() {
139
- this.types = new Map();
140
- }
141
-
142
- get contentTypes() {
143
- return [...this.types.keys()];
144
- }
145
-
146
- $onInit() {
147
- ResponseFiltersContainer.forEach((token, type) => {
148
- if (this.responseFilters.includes(token)) {
149
- this.types.set(type, this.injector.get(token));
150
- }
151
- });
152
- }
153
-
154
- getBestContentType(data, ctx) {
155
- const contentType = getContentType(data, ctx);
156
-
157
- if (ctx.request.get("Accept")) {
158
- const bestContentType = ctx.request.accepts([contentType].concat(this.contentTypes).filter(Boolean));
159
-
160
- if (bestContentType) {
161
- return [].concat(bestContentType).filter(type => type !== "*/*")[0];
162
- }
163
- }
164
-
165
- return contentType;
166
- }
167
- /**
168
- * Call filters to transform data
169
- * @param data
170
- * @param ctx
171
- */
172
-
173
-
174
- async transform(data, ctx) {
175
- const {
176
- response
177
- } = ctx;
178
- const bestContentType = this.getBestContentType(data, ctx);
179
- bestContentType && response.contentType(bestContentType);
180
-
181
- if (this.types.has(bestContentType)) {
182
- return this.types.get(bestContentType).transform(data, ctx);
183
- }
184
-
185
- if (this.types.has(ANY_CONTENT_TYPE)) {
186
- return this.types.get(ANY_CONTENT_TYPE).transform(data, ctx);
187
- }
188
-
189
- return data;
190
- }
191
- /**
192
- * Serialize data before calling filters
193
- * @param data
194
- * @param ctx
195
- */
196
-
197
-
198
- async serialize(data, ctx) {
199
- const {
200
- response,
201
- endpoint
202
- } = ctx;
203
-
204
- if (endpoint) {
205
- if (endpoint.view) {
206
- data = await renderView(data, ctx);
207
- } else if (isSerializable(data)) {
208
- data = this.injector.get(ConverterService).serialize(data, _extends({}, endpoint.getResponseOptions(response.statusCode), {
209
- endpoint: true
210
- }));
211
- }
212
- }
213
-
214
- return data;
215
- }
216
-
217
- };
218
-
219
- __decorate([Inject(), __metadata("design:type", InjectorService)], PlatformResponseFilter.prototype, "injector", void 0);
220
-
221
- __decorate([Constant("responseFilters", []), __metadata("design:type", Array)], PlatformResponseFilter.prototype, "responseFilters", void 0);
222
-
223
- PlatformResponseFilter = __decorate([Injectable()], PlatformResponseFilter);
224
-
225
- export { ANY_CONTENT_TYPE, ConverterService, PlatformResponseFilter, ResponseFilter, ResponseFiltersContainer, getContentType, registerResponseFilter };
226
- //# sourceMappingURL=index.modern.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.modern.js","sources":["../src/domain/ResponseFiltersContainer.ts","../src/decorators/responseFilter.ts","../src/utils/getContentType.ts","../src/services/ConverterService.ts","../src/services/PlatformResponseFilter.ts"],"sourcesContent":["import {Type} from \"@tsed/core\";\nimport {ResponseFilterMethods} from \"../interfaces/ResponseFilterMethods\";\n/**\n * @ignore\n */\nexport type ResponseFilterKey = \"*/*\" | \"application/json\" | \"text/html\" | \"plain/text\" | string;\n/**\n * @ignore\n */\n// tslint:disable-next-line:variable-name\nexport const ResponseFiltersContainer = new Map<ResponseFilterKey, Type<ResponseFilterMethods>>();\n/**\n * @ignore\n */\nexport function registerResponseFilter(type: ResponseFilterKey, token: Type<ResponseFilterMethods>) {\n ResponseFiltersContainer.set(type, token);\n}\n","import {Type} from \"@tsed/core\";\nimport {registerProvider} from \"@tsed/di\";\nimport {registerResponseFilter, ResponseFilterKey} from \"../domain/ResponseFiltersContainer\";\n\n/**\n * Register a response filter service.\n * @param contentTypes\n * @decorator\n */\nexport function ResponseFilter(...contentTypes: ResponseFilterKey[]): ClassDecorator {\n return <T = any>(target: T): void | T => {\n contentTypes.forEach((contentType) => {\n registerResponseFilter(contentType, target as any);\n });\n registerProvider({\n provide: target,\n useClass: (target as unknown) as Type<any>\n });\n };\n}\n","import {isObject} from \"@tsed/core\";\nimport type {BaseContext} from \"@tsed/di\";\nexport const ANY_CONTENT_TYPE = \"*/*\";\n/**\n * @ignore\n */\nexport function getContentType(data: any, ctx: BaseContext) {\n const {endpoint, response} = ctx;\n const {operation} = endpoint;\n\n const contentType = response.getContentType() || operation.getContentTypeOf(response.statusCode) || \"\";\n\n if (contentType && contentType !== ANY_CONTENT_TYPE) {\n if (contentType === \"application/json\") {\n if (isObject(data)) {\n return contentType;\n }\n } else {\n return contentType;\n }\n }\n\n if (typeof data === \"string\" && endpoint.view) {\n return \"text/html\";\n }\n}\n","import {Configuration, Injectable, InjectorService} from \"@tsed/di\";\nimport {deserialize, JsonDeserializerOptions, JsonSerializerOptions, serialize} from \"@tsed/json-mapper\";\n\n/**\n * @deprecated Since 2021-10-03. Use serialize/deserialize functions from @tsed/json-mapper instead\n */\n@Injectable()\nexport class ConverterService {\n private readonly _additionalProperties: string;\n\n constructor(private injectorService: InjectorService, @Configuration() configuration: Configuration) {\n this._additionalProperties = configuration.get<string>(\"converter.additionalProperties\");\n }\n\n /**\n * Convert instance to plainObject.\n *\n * @param obj\n * @param options\n */\n serialize(obj: any, options: JsonSerializerOptions = {}): any {\n return serialize(obj, {\n useAlias: true,\n additionalProperties: this._additionalProperties === \"accept\",\n ...options\n });\n }\n\n /**\n * Convert a plainObject to targetType.\n *\n * ### Options\n *\n * - `ignoreCallback`: callback called for each object which will be deserialized. The callback can return a boolean to avoid the default converter behavior.\n * - `checkRequiredValue`: Disable the required check condition.\n *\n * @param obj Object source that will be deserialized\n * @param options Mapping options\n * @returns {any}\n */\n deserialize(obj: any, options: JsonDeserializerOptions = {}): any {\n return deserialize(obj, {\n useAlias: true,\n additionalProperties: this._additionalProperties === \"accept\",\n ...options\n });\n }\n}\n","import {isSerializable, Type} from \"@tsed/core\";\nimport {BaseContext, Constant, Inject, Injectable, InjectorService} from \"@tsed/di\";\nimport {renderView} from \"@tsed/platform-views\";\nimport {ResponseFilterKey, ResponseFiltersContainer} from \"../domain/ResponseFiltersContainer\";\nimport {ResponseFilterMethods} from \"../interfaces/ResponseFilterMethods\";\nimport {ANY_CONTENT_TYPE, getContentType} from \"../utils/getContentType\";\nimport {ConverterService} from \"./ConverterService\";\n\n/**\n * @platform\n */\n@Injectable()\nexport class PlatformResponseFilter {\n types: Map<ResponseFilterKey, ResponseFilterMethods> = new Map();\n\n @Inject()\n injector: InjectorService;\n\n @Constant(\"responseFilters\", [])\n protected responseFilters: Type<ResponseFilterMethods>[];\n\n get contentTypes(): ResponseFilterKey[] {\n return [...this.types.keys()];\n }\n\n $onInit() {\n ResponseFiltersContainer.forEach((token, type) => {\n if (this.responseFilters.includes(token)) {\n this.types.set(type, this.injector.get(token)!);\n }\n });\n }\n\n getBestContentType(data: any, ctx: BaseContext) {\n const contentType = getContentType(data, ctx);\n\n if (ctx.request.get(\"Accept\")) {\n const bestContentType = ctx.request.accepts([contentType].concat(this.contentTypes).filter(Boolean));\n\n if (bestContentType) {\n return [].concat(bestContentType as any).filter((type) => type !== \"*/*\")[0];\n }\n }\n\n return contentType;\n }\n /**\n * Call filters to transform data\n * @param data\n * @param ctx\n */\n async transform(data: unknown, ctx: BaseContext) {\n const {response} = ctx;\n const bestContentType = this.getBestContentType(data, ctx);\n\n bestContentType && response.contentType(bestContentType);\n\n if (this.types.has(bestContentType)) {\n return this.types.get(bestContentType)!.transform(data, ctx);\n }\n\n if (this.types.has(ANY_CONTENT_TYPE)) {\n return this.types.get(ANY_CONTENT_TYPE)!.transform(data, ctx);\n }\n\n return data;\n }\n /**\n * Serialize data before calling filters\n * @param data\n * @param ctx\n */\n async serialize(data: unknown, ctx: BaseContext) {\n const {response, endpoint} = ctx;\n\n if (endpoint) {\n if (endpoint.view) {\n data = await renderView(data, ctx);\n } else if (isSerializable(data)) {\n data = this.injector.get<ConverterService>(ConverterService)!.serialize(data, {\n ...endpoint.getResponseOptions(response.statusCode),\n endpoint: true\n });\n }\n }\n\n return data;\n }\n}\n"],"names":["ResponseFiltersContainer","Map","registerResponseFilter","type","token","set","ResponseFilter","contentTypes","target","forEach","contentType","registerProvider","provide","useClass","ANY_CONTENT_TYPE","getContentType","data","ctx","endpoint","response","operation","getContentTypeOf","statusCode","isObject","view","ConverterService","constructor","injectorService","configuration","_additionalProperties","get","serialize","obj","options","useAlias","additionalProperties","deserialize","Injectable","__param","Configuration","InjectorService","PlatformResponseFilter","types","keys","$onInit","responseFilters","includes","injector","getBestContentType","request","bestContentType","accepts","concat","filter","Boolean","transform","has","renderView","isSerializable","getResponseOptions","__decorate","Inject","Constant"],"mappings":";;;;;;AAMA;;;AAGA;MACaA,wBAAwB,GAAG,IAAIC,GAAJ;AACxC;;;;SAGgBC,uBAAuBC,MAAyBC;AAC9DJ,EAAAA,wBAAwB,CAACK,GAAzB,CAA6BF,IAA7B,EAAmCC,KAAnC;AACD;;ACZD;;;;;;SAKgBE,eAAe,GAAGC;AAChC,SAAiBC,MAAV;AACLD,IAAAA,YAAY,CAACE,OAAb,CAAsBC,WAAD;AACnBR,MAAAA,sBAAsB,CAACQ,WAAD,EAAcF,MAAd,CAAtB;AACD,KAFD;AAGAG,IAAAA,gBAAgB,CAAC;AACfC,MAAAA,OAAO,EAAEJ,MADM;AAEfK,MAAAA,QAAQ,EAAGL;AAFI,KAAD,CAAhB;AAID,GARD;AASD;;;;;;;;;;;;;;;;;;;;MCjBYM,gBAAgB,GAAG;AAChC;;;;SAGgBC,eAAeC,MAAWC;AACxC,QAAM;AAACC,IAAAA,QAAD;AAAWC,IAAAA;AAAX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