@credal/actions 0.2.169 → 0.2.170
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.
|
@@ -18,6 +18,7 @@ const MENTION_USER_RE = /<@([UW][A-Z0-9]+)(?:\|[^>]+)?>/g;
|
|
|
18
18
|
const MENTION_CHANNEL_RE = /<#(C[A-Z0-9]+)(?:\|[^>]+)?>/g;
|
|
19
19
|
const SPECIAL_RE = /<!(channel|here|everyone)>/g;
|
|
20
20
|
const SUBTEAM_RE = /<!subteam\^([A-Z0-9]+)(?:\|[^>]+)?>/g;
|
|
21
|
+
const MAX_LIMIT_PER_PAGE = 100;
|
|
21
22
|
/* ===================== Cache ===================== */
|
|
22
23
|
class SlackUserCache {
|
|
23
24
|
constructor(client) {
|
|
@@ -208,7 +209,7 @@ function expandSlackEntities(cache, raw) {
|
|
|
208
209
|
function searchScoped(input) {
|
|
209
210
|
return __awaiter(this, void 0, void 0, function* () {
|
|
210
211
|
var _a, _b;
|
|
211
|
-
const { client, scope, topic, timeRange
|
|
212
|
+
const { client, scope, topic, timeRange } = input;
|
|
212
213
|
const parts = [];
|
|
213
214
|
if (scope)
|
|
214
215
|
parts.push(`in:${scope}`);
|
|
@@ -218,14 +219,14 @@ function searchScoped(input) {
|
|
|
218
219
|
if (tf)
|
|
219
220
|
parts.push(tf);
|
|
220
221
|
const query = parts.join(" ");
|
|
221
|
-
const searchRes = yield client.search.messages({ query, count:
|
|
222
|
+
const searchRes = yield client.search.messages({ query, count: MAX_LIMIT_PER_PAGE, highlight: true });
|
|
222
223
|
return (_b = (_a = searchRes.messages) === null || _a === void 0 ? void 0 : _a.matches) !== null && _b !== void 0 ? _b : [];
|
|
223
224
|
});
|
|
224
225
|
}
|
|
225
226
|
function searchByTopic(input) {
|
|
226
227
|
return __awaiter(this, void 0, void 0, function* () {
|
|
227
228
|
var _a, _b;
|
|
228
|
-
const { client, topic, timeRange
|
|
229
|
+
const { client, topic, timeRange } = input;
|
|
229
230
|
const parts = [];
|
|
230
231
|
if (topic === null || topic === void 0 ? void 0 : topic.trim())
|
|
231
232
|
parts.push(topic.trim());
|
|
@@ -233,7 +234,7 @@ function searchByTopic(input) {
|
|
|
233
234
|
if (tf)
|
|
234
235
|
parts.push(tf);
|
|
235
236
|
const query = parts.join(" ");
|
|
236
|
-
const searchRes = yield client.search.messages({ query, count:
|
|
237
|
+
const searchRes = yield client.search.messages({ query, count: MAX_LIMIT_PER_PAGE, highlight: true });
|
|
237
238
|
return (_b = (_a = searchRes.messages) === null || _a === void 0 ? void 0 : _a.matches) !== null && _b !== void 0 ? _b : [];
|
|
238
239
|
});
|
|
239
240
|
}
|
|
@@ -296,12 +297,12 @@ const searchSlack = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params,
|
|
|
296
297
|
const allMatches = [];
|
|
297
298
|
const searchPromises = [];
|
|
298
299
|
if (filteredTargetIds.length === 1) {
|
|
299
|
-
searchPromises.push(searchScoped({ client, scope: `<@${filteredTargetIds[0]}>`, topic, timeRange
|
|
300
|
+
searchPromises.push(searchScoped({ client, scope: `<@${filteredTargetIds[0]}>`, topic, timeRange }));
|
|
300
301
|
}
|
|
301
302
|
else if (filteredTargetIds.length >= 2) {
|
|
302
303
|
const searchMPIM = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
303
304
|
const mpimName = yield tryGetMPIMName(client, filteredTargetIds);
|
|
304
|
-
return mpimName ? searchScoped({ client, scope: mpimName, topic, timeRange
|
|
305
|
+
return mpimName ? searchScoped({ client, scope: mpimName, topic, timeRange }) : [];
|
|
305
306
|
});
|
|
306
307
|
searchPromises.push(searchMPIM());
|
|
307
308
|
searchPromises.push(...filteredTargetIds.map(id => searchScoped({
|
|
@@ -309,7 +310,6 @@ const searchSlack = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params,
|
|
|
309
310
|
scope: `<@${id}>`,
|
|
310
311
|
topic,
|
|
311
312
|
timeRange,
|
|
312
|
-
limit,
|
|
313
313
|
})));
|
|
314
314
|
}
|
|
315
315
|
else if (channel) {
|
|
@@ -318,7 +318,6 @@ const searchSlack = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params,
|
|
|
318
318
|
scope: normalizeChannelOperand(channel),
|
|
319
319
|
topic,
|
|
320
320
|
timeRange,
|
|
321
|
-
limit,
|
|
322
321
|
}));
|
|
323
322
|
}
|
|
324
323
|
else if (timeRange) {
|
|
@@ -326,7 +325,6 @@ const searchSlack = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params,
|
|
|
326
325
|
client,
|
|
327
326
|
topic,
|
|
328
327
|
timeRange,
|
|
329
|
-
limit,
|
|
330
328
|
}));
|
|
331
329
|
}
|
|
332
330
|
if (topic) {
|
|
@@ -334,7 +332,6 @@ const searchSlack = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params,
|
|
|
334
332
|
client,
|
|
335
333
|
topic,
|
|
336
334
|
timeRange,
|
|
337
|
-
limit,
|
|
338
335
|
}));
|
|
339
336
|
}
|
|
340
337
|
const searchResults = yield Promise.all(searchPromises);
|