@xpr/nestjs-slack 0.5.0 → 0.6.0
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.
- package/package.json +1 -1
- package/slack.d.ts +2 -2
- package/slack.js +3 -4
package/package.json
CHANGED
package/slack.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type CustomTransportStrategy, type MessageHandler, Server } from
|
|
2
|
-
import { App, type AppOptions } from
|
|
1
|
+
import { type CustomTransportStrategy, type MessageHandler, Server } from '@nestjs/microservices';
|
|
2
|
+
import { App, type AppOptions } from '@slack/bolt';
|
|
3
3
|
export type SlackOptions = {
|
|
4
4
|
/**
|
|
5
5
|
* Slack application options with required types
|
package/slack.js
CHANGED
|
@@ -14,8 +14,6 @@ class Slack extends microservices_1.Server {
|
|
|
14
14
|
async listen(callback) {
|
|
15
15
|
for (const handler of this.getHandlers().values()) {
|
|
16
16
|
this.register(handler);
|
|
17
|
-
const { type, event } = handler.extras;
|
|
18
|
-
this.logger.log(`Handler [${type}] registered with (${event})`);
|
|
19
17
|
}
|
|
20
18
|
await this.app().start();
|
|
21
19
|
callback();
|
|
@@ -24,7 +22,7 @@ class Slack extends microservices_1.Server {
|
|
|
24
22
|
this.#app && (await this.#app.stop());
|
|
25
23
|
}
|
|
26
24
|
on() {
|
|
27
|
-
throw new Error(
|
|
25
|
+
throw new Error('Use SlackEvent decorator to register events');
|
|
28
26
|
}
|
|
29
27
|
unwrap() {
|
|
30
28
|
return this.#app;
|
|
@@ -36,6 +34,7 @@ class Slack extends microservices_1.Server {
|
|
|
36
34
|
*/
|
|
37
35
|
register(handler) {
|
|
38
36
|
const { type, event } = handler.extras;
|
|
37
|
+
this.logger.log(`Registering handler of type [${type}] with (${event})`);
|
|
39
38
|
switch (type) {
|
|
40
39
|
case decorators_1.EventTypes.Shortcut:
|
|
41
40
|
return this.app().shortcut(event, handler);
|
|
@@ -61,7 +60,7 @@ class Slack extends microservices_1.Server {
|
|
|
61
60
|
this.options.slack.logger = (0, utils_1.adjustLogger)(this.logger);
|
|
62
61
|
}
|
|
63
62
|
this.#app = new bolt_1.App(this.options.slack);
|
|
64
|
-
this.logger.log(
|
|
63
|
+
this.logger.log('Bolt app created');
|
|
65
64
|
}
|
|
66
65
|
return this.#app;
|
|
67
66
|
}
|