@credal/actions 0.2.129 → 0.2.130

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.
@@ -24,16 +24,16 @@ class SlackUserCache {
24
24
  }
25
25
  get(id) {
26
26
  return __awaiter(this, void 0, void 0, function* () {
27
- var _a, _b, _c, _d, _e, _f, _g, _h;
27
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k;
28
28
  const result = this.cache.get(id);
29
29
  if (result)
30
30
  return result;
31
31
  const res = yield this.client.users.info({ user: id });
32
32
  const u = {
33
- name: (_e = (_c = (_b = (_a = res.user) === null || _a === void 0 ? void 0 : _a.profile) === null || _b === void 0 ? void 0 : _b.display_name) !== null && _c !== void 0 ? _c : (_d = res.user) === null || _d === void 0 ? void 0 : _d.real_name) !== null && _e !== void 0 ? _e : "",
34
- email: (_h = (_g = (_f = res.user) === null || _f === void 0 ? void 0 : _f.profile) === null || _g === void 0 ? void 0 : _g.email) !== null && _h !== void 0 ? _h : "",
33
+ name: (_g = (_e = (_c = (_b = (_a = res.user) === null || _a === void 0 ? void 0 : _a.profile) === null || _b === void 0 ? void 0 : _b.display_name) !== null && _c !== void 0 ? _c : (_d = res.user) === null || _d === void 0 ? void 0 : _d.real_name) !== null && _e !== void 0 ? _e : (_f = res.user) === null || _f === void 0 ? void 0 : _f.name) !== null && _g !== void 0 ? _g : "",
34
+ email: (_k = (_j = (_h = res.user) === null || _h === void 0 ? void 0 : _h.profile) === null || _j === void 0 ? void 0 : _j.email) !== null && _k !== void 0 ? _k : "",
35
35
  };
36
- if (res.user && id && res.user.name) {
36
+ if (res.user && id) {
37
37
  this.cache.set(id, u);
38
38
  return u;
39
39
  }
@@ -74,14 +74,18 @@ function lookupUserIdsByEmail(client, emails, slackUserCache) {
74
74
  return __awaiter(this, void 0, void 0, function* () {
75
75
  const ids = [];
76
76
  const tasks = emails.map((raw) => __awaiter(this, void 0, void 0, function* () {
77
- var _a;
77
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
78
78
  const email = raw.trim();
79
79
  if (!email)
80
80
  return null;
81
81
  const res = yield client.users.lookupByEmail({ email });
82
82
  const id = (_a = res.user) === null || _a === void 0 ? void 0 : _a.id;
83
- if (res.user && id && res.user.name) {
84
- slackUserCache.set(id, { email, name: res.user.name });
83
+ const u = {
84
+ name: (_h = (_f = (_d = (_c = (_b = res.user) === null || _b === void 0 ? void 0 : _b.profile) === null || _c === void 0 ? void 0 : _c.display_name) !== null && _d !== void 0 ? _d : (_e = res.user) === null || _e === void 0 ? void 0 : _e.real_name) !== null && _f !== void 0 ? _f : (_g = res.user) === null || _g === void 0 ? void 0 : _g.name) !== null && _h !== void 0 ? _h : "",
85
+ email: (_l = (_k = (_j = res.user) === null || _j === void 0 ? void 0 : _j.profile) === null || _k === void 0 ? void 0 : _k.email) !== null && _l !== void 0 ? _l : "",
86
+ };
87
+ if (res.user && id) {
88
+ slackUserCache.set(id, u);
85
89
  }
86
90
  if (id)
87
91
  return id;
@@ -275,9 +279,10 @@ const searchSlack = (_a) => __awaiter(void 0, [_a], void 0, function* ({ params,
275
279
  .map((t) => __awaiter(void 0, void 0, void 0, function* () {
276
280
  var _a, _b;
277
281
  const user = t.user ? yield slackUserCache.get(t.user) : undefined;
282
+ const prettyText = t.text ? yield expandSlackEntities(client, slackUserCache, t.text) : undefined;
278
283
  return {
279
284
  ts: t.ts,
280
- text: t.text,
285
+ text: prettyText,
281
286
  userEmail: (_a = user === null || user === void 0 ? void 0 : user.email) !== null && _a !== void 0 ? _a : undefined,
282
287
  userName: (_b = user === null || user === void 0 ? void 0 : user.name) !== null && _b !== void 0 ? _b : undefined,
283
288
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@credal/actions",
3
- "version": "0.2.129",
3
+ "version": "0.2.130",
4
4
  "type": "module",
5
5
  "description": "AI Actions by Credal AI",
6
6
  "sideEffects": false,