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