1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 |
|
4 | const BaseSingletonDefinition_1 = require("../ioc/objectdefinition/BaseSingletonDefinition");
|
5 | const SqsClient_1 = require("./SqsClient");
|
6 | class 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 | }
|
27 | exports.default = SqsClientPlugin;
|
28 |
|
\ | No newline at end of file |