1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.IncomingRequestDeserializer = void 0;
|
4 | const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
|
5 |
|
6 |
|
7 |
|
8 | class IncomingRequestDeserializer {
|
9 | deserialize(value, options) {
|
10 | return this.isExternal(value) ? this.mapToSchema(value, options) : value;
|
11 | }
|
12 | isExternal(value) {
|
13 | if (!value) {
|
14 | return true;
|
15 | }
|
16 | if (!(0, shared_utils_1.isUndefined)(value.pattern) ||
|
17 | !(0, shared_utils_1.isUndefined)(value.data)) {
|
18 | return false;
|
19 | }
|
20 | return true;
|
21 | }
|
22 | mapToSchema(value, options) {
|
23 | if (!options) {
|
24 | return {
|
25 | pattern: undefined,
|
26 | data: undefined,
|
27 | };
|
28 | }
|
29 | return {
|
30 | pattern: options.channel,
|
31 | data: value,
|
32 | };
|
33 | }
|
34 | }
|
35 | exports.IncomingRequestDeserializer = IncomingRequestDeserializer;
|