@wirecat/cli-core 0.356.0 → 0.357.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 +9 -0
- package/dist/domain/models.d.ts +3 -2
- package/dist/store/sqlite/chats.js +9 -2
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,15 @@ shape of this file.
|
|
|
7
7
|
|
|
8
8
|
## Unreleased
|
|
9
9
|
|
|
10
|
+
## 0.357.0 — 19.10.2026
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- **An adapter can say "member again" without clearing other states.** `ChatUpdate.membershipState` (in `saveChats`
|
|
15
|
+
and a pushed `HistoryBatch.chats`) now also takes `"member"`: it takes off a "left" mark, as `rejoinChats` does,
|
|
16
|
+
and keeps any other stored state, such as "archived"; a new chat stores none. It is never stored or read back.
|
|
17
|
+
`null` still clears every state. Send `"member"` when the owner is added back to a group. Additive.
|
|
18
|
+
|
|
10
19
|
## 0.356.0 — 19.10.2026
|
|
11
20
|
|
|
12
21
|
### Fixed
|
package/dist/domain/models.d.ts
CHANGED
|
@@ -49,10 +49,11 @@ export interface Chat {
|
|
|
49
49
|
/**
|
|
50
50
|
* A chat as an adapter saves it. A `title`, `unreadCount`, `lastMessageAt`, `participantsCount` or `membershipState`
|
|
51
51
|
* left out keeps the stored value; `null` stores none. So a push that knows only some of them, such as a notice that
|
|
52
|
-
* a group left its community, leaves the rest out.
|
|
52
|
+
* a group left its community, leaves the rest out. `membershipState: "member"` says the owner is in the chat again: it
|
|
53
|
+
* takes off a "left" mark and keeps any other state, such as "archived". It is never stored.
|
|
53
54
|
*/
|
|
54
55
|
export type ChatUpdate = Omit<Chat, KeptFields | "membershipState"> & Partial<Pick<Chat, KeptFields>> & {
|
|
55
|
-
membershipState?: MembershipState | null;
|
|
56
|
+
membershipState?: MembershipState | "member" | null;
|
|
56
57
|
};
|
|
57
58
|
type KeptFields = "title" | "unreadCount" | "lastMessageAt" | "participantsCount";
|
|
58
59
|
/** A group's switches; `null` where the messenger does not say, or has no such switch. */
|
|
@@ -104,7 +104,7 @@ export const upsertChat = (context, accountKey, chat) => {
|
|
|
104
104
|
lastMessageAt: toMs(chat.lastMessageAt),
|
|
105
105
|
participantsCount: chat.participantsCount ?? null,
|
|
106
106
|
metadata: mergedMetadata(stored?.metadata ?? null, chat.providerMetadata),
|
|
107
|
-
membershipState: chat.membershipState ?? null,
|
|
107
|
+
membershipState: chat.membershipState === "member" ? null : (chat.membershipState ?? null),
|
|
108
108
|
createdAt: now(),
|
|
109
109
|
updatedAt: now(),
|
|
110
110
|
})
|
|
@@ -119,12 +119,19 @@ export const upsertChat = (context, accountKey, chat) => {
|
|
|
119
119
|
...(chat.lastMessageAt === undefined ? {} : { lastMessageAt: sql `excluded.last_message_at` }),
|
|
120
120
|
...(chat.participantsCount === undefined ? {} : { participantsCount: sql `excluded.participants_count` }),
|
|
121
121
|
metadata: sql `excluded.metadata`,
|
|
122
|
-
...(chat.membershipState
|
|
122
|
+
...membershipSet(chat.membershipState),
|
|
123
123
|
updatedAt: sql `excluded.updated_at`,
|
|
124
124
|
},
|
|
125
125
|
})
|
|
126
126
|
.run();
|
|
127
127
|
};
|
|
128
|
+
const membershipSet = (state) => {
|
|
129
|
+
if (state === undefined)
|
|
130
|
+
return {};
|
|
131
|
+
if (state === "member")
|
|
132
|
+
return { membershipState: sql `nullif(${chats.membershipState}, 'left')` };
|
|
133
|
+
return { membershipState: sql `excluded.membership_state` };
|
|
134
|
+
};
|
|
128
135
|
const mergedMetadata = (stored, incoming) => {
|
|
129
136
|
if (incoming === undefined)
|
|
130
137
|
return stored;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wirecat/cli-core",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.357.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",
|