@activepieces/piece-slack 0.6.0 → 0.6.1
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 +2 -2
- package/src/lib/common/props.js +20 -31
- package/src/lib/common/props.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@activepieces/piece-slack",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.1",
|
|
4
4
|
"dependencies": {
|
|
5
5
|
"@sinclair/typebox": "0.26.8",
|
|
6
6
|
"@slack/web-api": "7.0.4",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"semver": "7.6.0",
|
|
12
12
|
"@activepieces/pieces-common": "0.2.15",
|
|
13
13
|
"@activepieces/pieces-framework": "0.7.32",
|
|
14
|
-
"@activepieces/shared": "0.10.
|
|
14
|
+
"@activepieces/shared": "0.10.110",
|
|
15
15
|
"tslib": "1.14.1"
|
|
16
16
|
},
|
|
17
17
|
"main": "./src/index.js",
|
package/src/lib/common/props.js
CHANGED
|
@@ -9,16 +9,18 @@ exports.slackInfo = pieces_framework_1.Property.MarkDown({
|
|
|
9
9
|
Please make sure add the bot to the channel by following these steps:
|
|
10
10
|
1. Type /invite in the channel's chat.
|
|
11
11
|
2. Click on Add apps to this channel.
|
|
12
|
-
3. Search for and add the bot
|
|
12
|
+
3. Search for and add the bot.
|
|
13
|
+
|
|
14
|
+
**Note**: If you can't find the channel in the dropdown list (which fetches up to 2000 channels), please click on the **(X)** and type the name directly.
|
|
15
|
+
`
|
|
13
16
|
});
|
|
14
17
|
const slackChannel = (required) => pieces_framework_1.Property.Dropdown({
|
|
15
18
|
displayName: 'Channel',
|
|
16
|
-
description: 'Channel, private group, or IM channel to send message to.',
|
|
17
19
|
required,
|
|
18
20
|
refreshers: [],
|
|
19
21
|
options(_a) {
|
|
20
22
|
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth }) {
|
|
21
|
-
var _b
|
|
23
|
+
var _b;
|
|
22
24
|
if (!auth) {
|
|
23
25
|
return {
|
|
24
26
|
disabled: true,
|
|
@@ -30,33 +32,22 @@ const slackChannel = (required) => pieces_framework_1.Property.Dropdown({
|
|
|
30
32
|
const accessToken = authentication['access_token'];
|
|
31
33
|
const client = new web_api_1.WebClient(accessToken);
|
|
32
34
|
const channels = [];
|
|
33
|
-
|
|
34
|
-
|
|
35
|
+
const CHANNELS_LIMIT = 2000;
|
|
36
|
+
let cursor;
|
|
37
|
+
do {
|
|
38
|
+
const response = yield client.conversations.list({
|
|
35
39
|
types: 'public_channel,private_channel',
|
|
36
40
|
exclude_archived: true,
|
|
37
|
-
// Only limits page size, not total number of results.
|
|
38
|
-
// We use a high number to avoid rate limiting and because Slack filters archived channels AFTER computing each page
|
|
39
|
-
// i.e. you can get many pages with only 10-50 results even though you're asking for 1000 per page
|
|
40
41
|
limit: 1000,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
channels.push(...response.channels.map((channel) => {
|
|
48
|
-
return { label: channel.name || '', value: channel.id || '' };
|
|
49
|
-
}));
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
54
|
-
finally {
|
|
55
|
-
try {
|
|
56
|
-
if (!_e && !_b && (_c = _f.return)) yield _c.call(_f);
|
|
42
|
+
cursor,
|
|
43
|
+
});
|
|
44
|
+
if (response.channels) {
|
|
45
|
+
channels.push(...response.channels.map((channel) => {
|
|
46
|
+
return { label: channel.name || '', value: channel.id || '' };
|
|
47
|
+
}));
|
|
57
48
|
}
|
|
58
|
-
|
|
59
|
-
}
|
|
49
|
+
cursor = (_b = response.response_metadata) === null || _b === void 0 ? void 0 : _b.next_cursor;
|
|
50
|
+
} while (cursor && channels.length < CHANNELS_LIMIT);
|
|
60
51
|
return {
|
|
61
52
|
disabled: false,
|
|
62
53
|
placeholder: 'Select channel',
|
|
@@ -83,12 +74,11 @@ exports.blocks = pieces_framework_1.Property.Json({
|
|
|
83
74
|
});
|
|
84
75
|
exports.userId = pieces_framework_1.Property.Dropdown({
|
|
85
76
|
displayName: 'User',
|
|
86
|
-
description: 'Message receiver',
|
|
87
77
|
required: true,
|
|
88
78
|
refreshers: [],
|
|
89
79
|
options(_a) {
|
|
90
80
|
return tslib_1.__awaiter(this, arguments, void 0, function* ({ auth }) {
|
|
91
|
-
var _b,
|
|
81
|
+
var _b, e_1, _c, _d;
|
|
92
82
|
if (!auth) {
|
|
93
83
|
return {
|
|
94
84
|
disabled: true,
|
|
@@ -116,12 +106,12 @@ exports.userId = pieces_framework_1.Property.Dropdown({
|
|
|
116
106
|
}
|
|
117
107
|
}
|
|
118
108
|
}
|
|
119
|
-
catch (
|
|
109
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
120
110
|
finally {
|
|
121
111
|
try {
|
|
122
112
|
if (!_e && !_b && (_c = _f.return)) yield _c.call(_f);
|
|
123
113
|
}
|
|
124
|
-
finally { if (
|
|
114
|
+
finally { if (e_1) throw e_1.error; }
|
|
125
115
|
}
|
|
126
116
|
return {
|
|
127
117
|
disabled: false,
|
|
@@ -133,7 +123,6 @@ exports.userId = pieces_framework_1.Property.Dropdown({
|
|
|
133
123
|
});
|
|
134
124
|
exports.text = pieces_framework_1.Property.LongText({
|
|
135
125
|
displayName: 'Message',
|
|
136
|
-
description: 'The text of your message',
|
|
137
126
|
required: true,
|
|
138
127
|
});
|
|
139
128
|
exports.actions = pieces_framework_1.Property.Array({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/slack/src/lib/common/props.ts"],"names":[],"mappings":";;;;AAAA,qEAA+E;AAC/E,
|
|
1
|
+
{"version":3,"file":"props.js","sourceRoot":"","sources":["../../../../../../../../packages/pieces/community/slack/src/lib/common/props.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