@pipedream/slack_v2 1.1.5 → 1.2.5
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,11 +11,14 @@ export default {
|
|
|
11
11
|
+ " large enough to be truncated. Omit `fields` when you need the complete channel objects."
|
|
12
12
|
+ " Use `namePrefix` to filter results to channels whose names start with a given string"
|
|
13
13
|
+ " (e.g. `dev-`) without a client-side filter loop."
|
|
14
|
+
+ " Set `memberOnly: true` to return only channels the authenticated user is a member of —"
|
|
15
|
+
+ " on a large workspace this shrinks the result from thousands of channels to the"
|
|
16
|
+
+ " handful that matter, and it is usually what you want when acting on the user's behalf."
|
|
14
17
|
+ " Returns `has_more: true` and `next_cursor` when more channels exist than were"
|
|
15
18
|
+ " fetched — when you see that, raise `numPages` (or pass `cursor`) before answering"
|
|
16
19
|
+ " any 'how many' or 'list every' question, otherwise your answer is silently incomplete."
|
|
17
20
|
+ " [See the documentation](https://api.slack.com/methods/conversations.list)",
|
|
18
|
-
version: "0.
|
|
21
|
+
version: "0.4.0",
|
|
19
22
|
annotations: {
|
|
20
23
|
destructiveHint: false,
|
|
21
24
|
openWorldHint: true,
|
|
@@ -46,6 +49,13 @@ export default {
|
|
|
46
49
|
default: "public_channel",
|
|
47
50
|
optional: true,
|
|
48
51
|
},
|
|
52
|
+
memberOnly: {
|
|
53
|
+
type: "boolean",
|
|
54
|
+
label: "Member Channels Only",
|
|
55
|
+
description: "Return only channels the authenticated user is a member of (uses `users.conversations` instead of `conversations.list`). Recommended for large workspaces: the full channel list can run to thousands of entries, while the user's own channels are usually a small fraction of that. `Channel Types`, `Fields`, `Name Prefix`, and pagination all still apply.",
|
|
56
|
+
optional: true,
|
|
57
|
+
default: false,
|
|
58
|
+
},
|
|
49
59
|
fields: {
|
|
50
60
|
type: "string[]",
|
|
51
61
|
label: "Fields",
|
|
@@ -98,10 +108,17 @@ export default {
|
|
|
98
108
|
// count, not the workspace size, on large workspaces.
|
|
99
109
|
const prefix = this.namePrefix?.toLowerCase();
|
|
100
110
|
|
|
111
|
+
// users.conversations returns the same shape as conversations.list (channels +
|
|
112
|
+
// response_metadata.next_cursor) but scoped to the authed user's memberships, so
|
|
113
|
+
// the pagination / filter / projection logic below is shared between both modes.
|
|
114
|
+
const listChannels = this.memberOnly
|
|
115
|
+
? (args) => this.slack.usersConversations(args)
|
|
116
|
+
: (args) => this.slack.conversationsList(args);
|
|
117
|
+
|
|
101
118
|
do {
|
|
102
119
|
const {
|
|
103
120
|
channels, response_metadata: metadata,
|
|
104
|
-
} = await
|
|
121
|
+
} = await listChannels(params);
|
|
105
122
|
const pageChannels = prefix
|
|
106
123
|
? channels.filter((c) => c.name?.toLowerCase().startsWith(prefix))
|
|
107
124
|
: channels;
|