@xpr/nestjs-slack 0.6.0 → 0.7.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/decorators.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { ActionConstraints, OptionsConstraints, ShortcutConstraints, ViewConstraints } from "@slack/bolt";
2
- import { type Pattern } from "./utils";
1
+ import { ActionConstraints, OptionsConstraints, ShortcutConstraints, ViewConstraints } from '@slack/bolt';
2
+ import { type Pattern } from './utils';
3
3
  export { Pattern };
4
4
  /**
5
5
  * @see https://tools.slack.dev/bolt-js/reference/
@@ -12,12 +12,15 @@ export declare const EventTypes: {
12
12
  View: string;
13
13
  Option: string;
14
14
  };
15
+ /**
16
+ * Decorator for Slack controller
17
+ */
18
+ export declare function SlackController(): ClassDecorator;
15
19
  /**
16
20
  * Decorator for event events
17
21
  * @see guide https://tools.slack.dev/bolt-js/concepts/event-listening
18
22
  * @see api https://api.slack.com/apis/events-api
19
23
  * @param event
20
- * @constructor
21
24
  */
22
25
  export declare function SlackEvent(event: string): MethodDecorator;
23
26
  export type ShortCutId = Pattern | ShortcutConstraints;
@@ -26,7 +29,6 @@ export type ShortCutId = Pattern | ShortcutConstraints;
26
29
  * @see guide https://tools.slack.dev/bolt-js/concepts/shortcuts
27
30
  * @see api https://api.slack.com/interactivity/shortcuts
28
31
  * @param shortcutId
29
- * @constructor
30
32
  */
31
33
  export declare function SlackShortcut(shortcutId: ShortCutId): MethodDecorator;
32
34
  /**
@@ -34,7 +36,6 @@ export declare function SlackShortcut(shortcutId: ShortCutId): MethodDecorator;
34
36
  * @see guide https://tools.slack.dev/bolt-js/concepts/commands
35
37
  * @see api https://api.slack.com/interactivity/slash-commands
36
38
  * @param commandId
37
- * @constructor
38
39
  */
39
40
  export declare function SlackCommand(commandId: Pattern): MethodDecorator;
40
41
  export type ActionId = Pattern | ActionConstraints;
@@ -42,7 +43,6 @@ export type ActionId = Pattern | ActionConstraints;
42
43
  * Decorator for action events
43
44
  * @see guide https://tools.slack.dev/bolt-js/concepts/actions
44
45
  * @param actionId
45
- * @constructor
46
46
  */
47
47
  export declare function SlackAction(actionId: ActionId): MethodDecorator;
48
48
  export type ViewId = Pattern | ViewConstraints;
@@ -50,7 +50,6 @@ export type ViewId = Pattern | ViewConstraints;
50
50
  * Decorator for view events
51
51
  * @see guide https://tools.slack.dev/bolt-js/concepts/view-submissions
52
52
  * @param viewId
53
- * @constructor
54
53
  */
55
54
  export declare function SlackView(viewId: ViewId): MethodDecorator;
56
55
  export type OptionId = OptionsConstraints;
@@ -58,7 +57,6 @@ export type OptionId = OptionsConstraints;
58
57
  * Decorator for options events
59
58
  * @see guide https://tools.slack.dev/bolt-js/concepts/options
60
59
  * @param optionId
61
- * @constructor
62
60
  */
63
61
  export declare function SlackOption(optionId: OptionId): MethodDecorator;
64
62
  /**
@@ -67,6 +65,5 @@ export declare function SlackOption(optionId: OptionId): MethodDecorator;
67
65
  * @see guide https://tools.slack.dev/bolt-js/concepts/message-listening
68
66
  * @see reference https://api.slack.com/events/message
69
67
  * @param pattern
70
- * @constructor
71
68
  */
72
69
  export declare function SlackMessage(pattern?: Pattern): MethodDecorator;
package/decorators.js CHANGED
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.EventTypes = void 0;
4
+ exports.SlackController = SlackController;
4
5
  exports.SlackEvent = SlackEvent;
5
6
  exports.SlackShortcut = SlackShortcut;
6
7
  exports.SlackCommand = SlackCommand;
@@ -8,24 +9,30 @@ exports.SlackAction = SlackAction;
8
9
  exports.SlackView = SlackView;
9
10
  exports.SlackOption = SlackOption;
10
11
  exports.SlackMessage = SlackMessage;
12
+ const common_1 = require("@nestjs/common");
11
13
  const utils_1 = require("./utils");
12
14
  /**
13
15
  * @see https://tools.slack.dev/bolt-js/reference/
14
16
  */
15
17
  exports.EventTypes = {
16
- Event: "event",
17
- Shortcut: "shortcut",
18
- Command: "command",
19
- Action: "action",
20
- View: "view",
21
- Option: "option",
18
+ Event: 'event',
19
+ Shortcut: 'shortcut',
20
+ Command: 'command',
21
+ Action: 'action',
22
+ View: 'view',
23
+ Option: 'option',
22
24
  };
25
+ /**
26
+ * Decorator for Slack controller
27
+ */
28
+ function SlackController() {
29
+ return (target) => (0, common_1.Controller)()(target);
30
+ }
23
31
  /**
24
32
  * Decorator for event events
25
33
  * @see guide https://tools.slack.dev/bolt-js/concepts/event-listening
26
34
  * @see api https://api.slack.com/apis/events-api
27
35
  * @param event
28
- * @constructor
29
36
  */
30
37
  function SlackEvent(event) {
31
38
  // todo input validation (types for event)
@@ -36,7 +43,6 @@ function SlackEvent(event) {
36
43
  * @see guide https://tools.slack.dev/bolt-js/concepts/shortcuts
37
44
  * @see api https://api.slack.com/interactivity/shortcuts
38
45
  * @param shortcutId
39
- * @constructor
40
46
  */
41
47
  function SlackShortcut(shortcutId) {
42
48
  return (0, utils_1.eventDecorator)(exports.EventTypes.Shortcut, shortcutId);
@@ -46,7 +52,6 @@ function SlackShortcut(shortcutId) {
46
52
  * @see guide https://tools.slack.dev/bolt-js/concepts/commands
47
53
  * @see api https://api.slack.com/interactivity/slash-commands
48
54
  * @param commandId
49
- * @constructor
50
55
  */
51
56
  function SlackCommand(commandId) {
52
57
  // todo input validation command must start with / etc.
@@ -56,7 +61,6 @@ function SlackCommand(commandId) {
56
61
  * Decorator for action events
57
62
  * @see guide https://tools.slack.dev/bolt-js/concepts/actions
58
63
  * @param actionId
59
- * @constructor
60
64
  */
61
65
  function SlackAction(actionId) {
62
66
  return (0, utils_1.eventDecorator)(exports.EventTypes.Action, actionId);
@@ -65,7 +69,6 @@ function SlackAction(actionId) {
65
69
  * Decorator for view events
66
70
  * @see guide https://tools.slack.dev/bolt-js/concepts/view-submissions
67
71
  * @param viewId
68
- * @constructor
69
72
  */
70
73
  function SlackView(viewId) {
71
74
  return (0, utils_1.eventDecorator)(exports.EventTypes.View, viewId);
@@ -74,7 +77,6 @@ function SlackView(viewId) {
74
77
  * Decorator for options events
75
78
  * @see guide https://tools.slack.dev/bolt-js/concepts/options
76
79
  * @param optionId
77
- * @constructor
78
80
  */
79
81
  function SlackOption(optionId) {
80
82
  return (0, utils_1.eventDecorator)(exports.EventTypes.Option, optionId);
@@ -85,8 +87,7 @@ function SlackOption(optionId) {
85
87
  * @see guide https://tools.slack.dev/bolt-js/concepts/message-listening
86
88
  * @see reference https://api.slack.com/events/message
87
89
  * @param pattern
88
- * @constructor
89
90
  */
90
- function SlackMessage(pattern = "*") {
91
- return (0, utils_1.messageDecorator)("message", pattern);
91
+ function SlackMessage(pattern = '*') {
92
+ return (0, utils_1.messageDecorator)('message', pattern);
92
93
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xpr/nestjs-slack",
3
- "version": "0.6.0",
3
+ "version": "0.7.0",
4
4
  "description": "NestJS server implementation of the Slack Assistant",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -28,6 +28,7 @@
28
28
  "@types/node": "^22.10.6"
29
29
  },
30
30
  "peerDependencies": {
31
+ "@nestjs/common": "^11.0.1",
31
32
  "@nestjs/microservices": ">=11.0.13",
32
33
  "@slack/bolt": ">=4.2.1",
33
34
  "reflect-metadata": ">=0.2.2"