@pipedream/slack 0.9.2 → 0.9.4
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.
|
@@ -4,7 +4,7 @@ export default {
|
|
|
4
4
|
key: "slack-find-message",
|
|
5
5
|
name: "Find Message",
|
|
6
6
|
description: "Find a Slack message. [See the documentation](https://api.slack.com/methods/search.messages)",
|
|
7
|
-
version: "0.0.
|
|
7
|
+
version: "0.0.25",
|
|
8
8
|
type: "action",
|
|
9
9
|
props: {
|
|
10
10
|
slack,
|
|
@@ -21,12 +21,41 @@ export default {
|
|
|
21
21
|
],
|
|
22
22
|
optional: true,
|
|
23
23
|
},
|
|
24
|
+
maxResults: {
|
|
25
|
+
type: "integer",
|
|
26
|
+
label: "Max Results",
|
|
27
|
+
description: "The maximum number of messages to return",
|
|
28
|
+
default: 100,
|
|
29
|
+
optional: true,
|
|
30
|
+
},
|
|
31
|
+
sort: {
|
|
32
|
+
type: "string",
|
|
33
|
+
label: "Sort",
|
|
34
|
+
description: "Return matches sorted by either `score` or `timestamp`",
|
|
35
|
+
options: [
|
|
36
|
+
"score",
|
|
37
|
+
"timestamp",
|
|
38
|
+
],
|
|
39
|
+
optional: true,
|
|
40
|
+
},
|
|
41
|
+
sortDirection: {
|
|
42
|
+
type: "string",
|
|
43
|
+
label: "Sort Direction",
|
|
44
|
+
description: "Sort ascending (asc) or descending (desc)`",
|
|
45
|
+
options: [
|
|
46
|
+
"desc",
|
|
47
|
+
"asc",
|
|
48
|
+
],
|
|
49
|
+
optional: true,
|
|
50
|
+
},
|
|
24
51
|
},
|
|
25
52
|
async run({ $ }) {
|
|
26
53
|
const matches = [];
|
|
27
54
|
const params = {
|
|
28
55
|
query: this.query,
|
|
29
56
|
team_id: this.teamId,
|
|
57
|
+
sort: this.sort,
|
|
58
|
+
sort_dir: this.sortDirection,
|
|
30
59
|
page: 1,
|
|
31
60
|
};
|
|
32
61
|
let hasMore;
|
|
@@ -34,10 +63,17 @@ export default {
|
|
|
34
63
|
do {
|
|
35
64
|
const { messages } = await this.slack.searchMessages(params);
|
|
36
65
|
matches.push(...messages.matches);
|
|
37
|
-
|
|
66
|
+
if (matches.length >= this.maxResults) {
|
|
67
|
+
break;
|
|
68
|
+
}
|
|
69
|
+
hasMore = messages.matches?.length;
|
|
38
70
|
params.page++;
|
|
39
71
|
} while (hasMore);
|
|
40
72
|
|
|
73
|
+
if (matches.length > this.maxResults) {
|
|
74
|
+
matches.length = this.maxResults;
|
|
75
|
+
}
|
|
76
|
+
|
|
41
77
|
$.export("$summary", `Found ${matches.length} matching message${matches.length === 1
|
|
42
78
|
? ""
|
|
43
79
|
: "s"}`);
|