UNPKG

922 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.IncomingResponseDeserializer = void 0;
4const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
5/**
6 * @publicApi
7 */
8class 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}
31exports.IncomingResponseDeserializer = IncomingResponseDeserializer;