Skip to content

Commit deb7c32

Browse files
kevin-dpclaude
andauthored
feat(typescript-client): add move-in event support (#4043)
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 6c5068a commit deb7c32

2 files changed

Lines changed: 13 additions & 4 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@electric-sql/client': patch
3+
---
4+
5+
Add move-in event support to the TypeScript client. Rename `MoveOutPattern` to `MovePattern` (with a deprecated alias for backwards compatibility), extend `EventMessage` to accept both `move-out` and `move-in` events, and add `active_conditions` field to `ChangeMessage` headers.

packages/typescript-client/src/types.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,16 @@ export type Operation = `insert` | `update` | `delete`
6060
export type MoveTag = string
6161

6262
/**
63-
* A move-out pattern is a position and a value. The position is the index of the column
64-
* that is being moved out. The value is the value of the column that is being moved out.
63+
* A move pattern is a position and a value. The position is the index of the column
64+
* involved in the move. The value is the value of that column.
6565
*
6666
* Tag width and value order is fixed for a given shape, so the client can determine
6767
* which tags match this pattern.
6868
*/
69-
export type MoveOutPattern = { pos: number; value: string }
69+
export type MovePattern = { pos: number; value: string }
70+
71+
/** @deprecated Use {@link MovePattern} instead */
72+
export type MoveOutPattern = MovePattern
7073

7174
/**
7275
* Serialized expression types for structured subset queries.
@@ -125,7 +128,7 @@ export type ControlMessage = {
125128
}
126129

127130
export type EventMessage = {
128-
headers: Header & { event: `move-out`; patterns: MoveOutPattern[] }
131+
headers: Header & { event: `move-out` | `move-in`; patterns: MovePattern[] }
129132
}
130133

131134
export type ChangeMessage<T extends Row<unknown> = Row> = {
@@ -138,6 +141,7 @@ export type ChangeMessage<T extends Row<unknown> = Row> = {
138141
/** Tags will always be present for changes if the shape has a subquery in its where clause, and are omitted otherwise.*/
139142
tags?: MoveTag[]
140143
removed_tags?: MoveTag[]
144+
active_conditions?: boolean[]
141145
}
142146
}
143147

0 commit comments

Comments
 (0)