UNPKG

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