UNPKG

1.13 kBJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3// tslint:disable:prefer-function-over-method
4const BaseSingletonDefinition_1 = require("../ioc/objectdefinition/BaseSingletonDefinition");
5const SqsClient_1 = require("./SqsClient");
6class SqsClientPlugin {
7 constructor() {
8 this.name = 'SqsClientPlugin';
9 }
10 getName() {
11 return this.name;
12 }
13 willStart(app) {
14 if (!app.hasConfig('SqsClient')) {
15 throw new Error('SqsClientPlugin has been registered but could not find config using key "SqsClient"');
16 }
17 const context = app.getContext();
18 const confs = context.getConfig('SqsClient');
19 Object.keys(confs).forEach((key) => {
20 const clientSingleton = new BaseSingletonDefinition_1.BaseSingletonDefinition(SqsClient_1.SqsClient, key);
21 clientSingleton.constructorParamByValue(confs[key]);
22 clientSingleton.constructorParamByValue(key);
23 context.registerSingletons(clientSingleton);
24 });
25 }
26}
27exports.default = SqsClientPlugin;
28//# sourceMappingURL=SqsClientPlugin.js.map
\No newline at end of file