@venturialstd/slack 0.1.17 → 0.1.19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -11,21 +11,31 @@ exports.SlackModule = void 0;
|
|
|
11
11
|
const common_1 = require("@nestjs/common");
|
|
12
12
|
const slack_client_1 = require("./clients/slack.client");
|
|
13
13
|
let SlackModule = SlackModule_1 = class SlackModule {
|
|
14
|
-
static
|
|
14
|
+
static forRootAsync(loggerClass) {
|
|
15
15
|
return {
|
|
16
16
|
module: SlackModule_1,
|
|
17
17
|
providers: [
|
|
18
|
-
|
|
18
|
+
{
|
|
19
|
+
provide: slack_client_1.SlackClient,
|
|
20
|
+
inject: ['SLACK_BOT_TOKEN', 'SLACK_LOGGER'],
|
|
21
|
+
useFactory: async (token, logger) => {
|
|
22
|
+
if (!token) {
|
|
23
|
+
throw new Error('SLACK_BOT_TOKEN no disponible');
|
|
24
|
+
}
|
|
25
|
+
const client = new slack_client_1.SlackClient(token, logger);
|
|
26
|
+
return client;
|
|
27
|
+
},
|
|
28
|
+
},
|
|
19
29
|
{
|
|
20
30
|
provide: 'SLACK_LOGGER',
|
|
21
31
|
useClass: loggerClass,
|
|
22
32
|
},
|
|
23
33
|
{
|
|
24
34
|
provide: 'SLACK_BOT_TOKEN',
|
|
25
|
-
useValue:
|
|
35
|
+
useValue: null,
|
|
26
36
|
},
|
|
27
37
|
],
|
|
28
|
-
exports: [slack_client_1.SlackClient
|
|
38
|
+
exports: [slack_client_1.SlackClient],
|
|
29
39
|
};
|
|
30
40
|
}
|
|
31
41
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slack.module.js","sourceRoot":"","sources":["../../slack.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAA6D;AAE7D,yDAAqD;AAG9C,IAAM,WAAW,mBAAjB,MAAM,WAAW;IACtB,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"slack.module.js","sourceRoot":"","sources":["../../slack.module.ts"],"names":[],"mappings":";;;;;;;;;;AAAA,2CAA6D;AAE7D,yDAAqD;AAG9C,IAAM,WAAW,mBAAjB,MAAM,WAAW;IACtB,MAAM,CAAC,YAAY,CAAC,WAAsB;QACxC,OAAO;YACL,MAAM,EAAE,aAAW;YACnB,SAAS,EAAE;gBACT;oBACE,OAAO,EAAE,0BAAW;oBACpB,MAAM,EAAE,CAAC,iBAAiB,EAAE,cAAc,CAAC;oBAC3C,UAAU,EAAE,KAAK,EAAE,KAAa,EAAE,MAAW,EAAE,EAAE;wBAC/C,IAAI,CAAC,KAAK,EAAE,CAAC;4BACX,MAAM,IAAI,KAAK,CAAC,+BAA+B,CAAC,CAAC;wBACnD,CAAC;wBACD,MAAM,MAAM,GAAG,IAAI,0BAAW,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;wBAC9C,OAAO,MAAM,CAAC;oBAChB,CAAC;iBACF;gBACD;oBACE,OAAO,EAAE,cAAc;oBACvB,QAAQ,EAAE,WAAW;iBACtB;gBACD;oBACE,OAAO,EAAE,iBAAiB;oBAC1B,QAAQ,EAAE,IAAI;iBACf;aACF;YACD,OAAO,EAAE,CAAC,0BAAW,CAAC;SACvB,CAAC;IACJ,CAAC;CACF,CAAA;AA5BY,kCAAW;sBAAX,WAAW;IADvB,IAAA,eAAM,EAAC,EAAE,CAAC;GACE,WAAW,CA4BvB","sourcesContent":["import { DynamicModule, Module, Type } from '@nestjs/common';\r\n\r\nimport { SlackClient } from './clients/slack.client';\r\n\r\n@Module({})\r\nexport class SlackModule {\r\n static forRootAsync(loggerClass: Type<any>): DynamicModule {\r\n return {\r\n module: SlackModule,\r\n providers: [\r\n {\r\n provide: SlackClient,\r\n inject: ['SLACK_BOT_TOKEN', 'SLACK_LOGGER'],\r\n useFactory: async (token: string, logger: any) => {\r\n if (!token) {\r\n throw new Error('SLACK_BOT_TOKEN no disponible');\r\n }\r\n const client = new SlackClient(token, logger);\r\n return client;\r\n },\r\n },\r\n {\r\n provide: 'SLACK_LOGGER',\r\n useClass: loggerClass,\r\n },\r\n {\r\n provide: 'SLACK_BOT_TOKEN',\r\n useValue: null,\r\n },\r\n ],\r\n exports: [SlackClient],\r\n };\r\n }\r\n}\r\n"]}
|