@wirecat/cli-core 0.636.0 → 0.637.0

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/CHANGELOG.md CHANGED
@@ -5,6 +5,12 @@ Notable changes to `@wirecat/cli-core` (`@wirecat/cli-messaging` up to 0.261.0,
5
5
  minor version may break callers, and says how under "Changed — may break callers". `pnpm docs:check` checks the
6
6
  shape of this file.
7
7
 
8
+ ## 0.637.0 — 11.11.2026
9
+
10
+ ### Fixed
11
+
12
+ - `relationships list` no longer crashes on a store holding a link whose message or document is gone. Such a link is left out of the list.
13
+
8
14
  ## 0.636.0 — 11.11.2026
9
15
 
10
16
  ### Added
@@ -100,15 +100,19 @@ export const relationListOver = (context) => {
100
100
  ) r${where.length ? ` WHERE ${where.join(" AND ")}` : ""}
101
101
  ORDER BY r.standing = 'ended', r.created_at, r.source, r.id LIMIT ? OFFSET ?`)
102
102
  .all(at, ...params, limit + 1, (page - 1) * limit);
103
- const items = rows.slice(0, limit).map((row) => {
103
+ const items = rows.slice(0, limit).flatMap((row) => {
104
104
  const item = row.source === "link" ? linkItem(Number(row.id), at) : proposalItem(String(row.id));
105
+ if (!item)
106
+ return [];
105
107
  if (!about)
106
- return item;
108
+ return [item];
107
109
  const from = thingOf(database, item.from);
108
110
  const outgoing = from?.type === about.type && aboutSame.has(from.id);
109
- return outgoing
110
- ? { ...item, direction: "outgoing" }
111
- : { ...item, direction: "incoming", inverse: inverseOf(item.kind) };
111
+ return [
112
+ outgoing
113
+ ? { ...item, direction: "outgoing" }
114
+ : { ...item, direction: "incoming", inverse: inverseOf(item.kind) },
115
+ ];
112
116
  });
113
117
  return { items, hasMore: rows.length > limit };
114
118
  },
@@ -124,8 +128,12 @@ export const relationListOver = (context) => {
124
128
  !ownerRolesOf(database, roleList).some(({ id }) => id === role);
125
129
  return { roleList, custom };
126
130
  }
131
+ /** Nothing for a link whose message or document is gone: the link outlives its end, and has no end to show. */
127
132
  function linkItem(id, at) {
128
- const relation = relationOf(linkOf(database, database.prepare("SELECT * FROM links WHERE id = ?").get(id)), at);
133
+ const link = linkOf(database, database.prepare("SELECT * FROM links WHERE id = ?").get(id));
134
+ if (!link.from || !link.to)
135
+ return undefined;
136
+ const relation = relationOf(link, at);
129
137
  return {
130
138
  ...relation,
131
139
  source: "link",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wirecat/cli-core",
3
- "version": "0.636.0",
3
+ "version": "0.637.0",
4
4
  "description": "The messenger-neutral half of a messaging CLI: domain model, message locators, rendering, name resolution, the SQLite seam, the command skeleton and shared read commands, the send guard, run records and the message store",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Viacheslav Ptsarev",