inceptum
Version:
hipages take on the foundational library for enterprise-grade apps written in NodeJS
28 lines • 1.13 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
// tslint:disable:prefer-function-over-method
const BaseSingletonDefinition_1 = require("../ioc/objectdefinition/BaseSingletonDefinition");
const SqsClient_1 = require("./SqsClient");
class SqsClientPlugin {
constructor() {
this.name = 'SqsClientPlugin';
}
getName() {
return this.name;
}
willStart(app) {
if (!app.hasConfig('SqsClient')) {
throw new Error('SqsClientPlugin has been registered but could not find config using key "SqsClient"');
}
const context = app.getContext();
const confs = context.getConfig('SqsClient');
Object.keys(confs).forEach((key) => {
const clientSingleton = new BaseSingletonDefinition_1.BaseSingletonDefinition(SqsClient_1.SqsClient, key);
clientSingleton.constructorParamByValue(confs[key]);
clientSingleton.constructorParamByValue(key);
context.registerSingletons(clientSingleton);
});
}
}
exports.default = SqsClientPlugin;
//# sourceMappingURL=SqsClientPlugin.js.map