1.01 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.NatsResponseJSONDeserializer = void 0;
4const load_package_util_1 = require("@nestjs/common/utils/load-package.util");
5const incoming_response_deserializer_1 = require("./incoming-response.deserializer");
6const nats_request_json_deserializer_1 = require("./nats-request-json.deserializer");
7let natsPackage = {};
8/**
9 * @publicApi
10 */
11class NatsResponseJSONDeserializer extends incoming_response_deserializer_1.IncomingResponseDeserializer {
12 constructor() {
13 super();
14 natsPackage = (0, load_package_util_1.loadPackage)('nats', nats_request_json_deserializer_1.NatsRequestJSONDeserializer.name, () => require('nats'));
15 this.jsonCodec = natsPackage.JSONCodec();
16 }
17 deserialize(value, options) {
18 const decodedRequest = this.jsonCodec.decode(value);
19 return super.deserialize(decodedRequest, options);
20 }
21}
22exports.NatsResponseJSONDeserializer = NatsResponseJSONDeserializer;