UNPKG

@duongtrungnguyen/nestro

Version:
19 lines 745 B
import { DiscoveryService } from "../../discovery"; function CommunicateRequest(serviceName) { return function(_, __, descriptor) { const originalMethod = descriptor.value; descriptor.value = async function(...args) { if (!this._discoveryService && !(this._discoveryService instanceof DiscoveryService)) { throw new Error("Missing _discoveryService on class. Ensure it extends CommunicationTemplate."); } return this?._discoveryService.discover(serviceName || this.targetService, async (instance) => { return await originalMethod.apply(this, [instance, ...args]); }); }; return descriptor; }; } export { CommunicateRequest }; //# sourceMappingURL=communicate-request.decorator.js.map