UNPKG

720 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.MqttRecordSerializer = void 0;
4const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
5const record_builders_1 = require("../record-builders");
6class MqttRecordSerializer {
7 serialize(packet) {
8 if (packet?.data &&
9 (0, shared_utils_1.isObject)(packet.data) &&
10 packet.data instanceof record_builders_1.MqttRecord) {
11 const record = packet.data;
12 return {
13 ...packet,
14 data: record.data,
15 options: record.options,
16 };
17 }
18 return packet;
19 }
20}
21exports.MqttRecordSerializer = MqttRecordSerializer;