@furystack/entity-sync 3.0.3 → 3.0.4
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 +219 -209
- package/LICENSE +339 -339
- package/README.md +83 -83
- package/package.json +2 -2
- package/src/client-sync-message.ts +28 -28
- package/src/index.ts +6 -6
- package/src/server-sync-message.ts +64 -64
- package/src/sync-change-entry.ts +9 -9
- package/src/sync-state.ts +20 -20
- package/src/sync-version.ts +18 -18
package/CHANGELOG.md
CHANGED
|
@@ -1,209 +1,219 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
|
|
3
|
-
## [3.0.
|
|
4
|
-
|
|
5
|
-
###
|
|
6
|
-
|
|
7
|
-
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
-
|
|
25
|
-
|
|
26
|
-
## [3.0.
|
|
27
|
-
|
|
28
|
-
###
|
|
29
|
-
|
|
30
|
-
-
|
|
31
|
-
|
|
32
|
-
###
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
//
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
### ⬆️ Dependencies
|
|
94
|
-
|
|
95
|
-
-
|
|
96
|
-
|
|
97
|
-
## [1.0.
|
|
98
|
-
|
|
99
|
-
###
|
|
100
|
-
|
|
101
|
-
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [3.0.4] - 2026-11-14
|
|
4
|
+
|
|
5
|
+
### Dependencies
|
|
6
|
+
|
|
7
|
+
- Patch release to include updated FuryStack dependency versions
|
|
8
|
+
|
|
9
|
+
### ⬆️ Dependencies
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
|
|
13
|
+
## [3.0.3] - 2026-09-18
|
|
14
|
+
|
|
15
|
+
### ⬆️ Dependencies
|
|
16
|
+
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
|
|
19
|
+
## [3.0.2] - 2026-08-26
|
|
20
|
+
|
|
21
|
+
### ⬆️ Dependencies
|
|
22
|
+
|
|
23
|
+
- Updated dependencies
|
|
24
|
+
- Raised dev `typescript` to `^7.0.2`. No source changes — dev-tooling bump only.
|
|
25
|
+
|
|
26
|
+
## [3.0.1] - 2026-06-05
|
|
27
|
+
|
|
28
|
+
### 👷 CI
|
|
29
|
+
|
|
30
|
+
- Raised the minimum supported Node.js to `>=24.0.0` (Node 24 LTS) in `engines`, dropping Node 22.
|
|
31
|
+
|
|
32
|
+
### 🔧 Chores
|
|
33
|
+
|
|
34
|
+
- Patch release to track the workspace `@furystack/core` bump. No source or direct dependency changes in this package.
|
|
35
|
+
|
|
36
|
+
## [3.0.0] - 2026-05-21
|
|
37
|
+
|
|
38
|
+
### 📚 Documentation
|
|
39
|
+
|
|
40
|
+
- Rewrote JSDoc on `SyncState` and the shared transport types to follow the new value-test guidance: dropped restate-the-type narration, kept intent / trade-offs / constraints.
|
|
41
|
+
|
|
42
|
+
### 💥 Breaking Changes
|
|
43
|
+
|
|
44
|
+
### `SyncVersion.seq` and `ClientSyncMessage.lastSeq` are now opaque strings
|
|
45
|
+
|
|
46
|
+
`seq` is no longer a numeric counter assigned by the server — it is now an **opaque, ordered token** assigned by the underlying `@furystack/cross-node-bus` adapter (integer counters in-process, `<ms>-<n>` Redis Stream ids, etc.). Clients **must not** compare seqs lexicographically or numerically; the only safe operations are equality and round-tripping the value back to the server via `lastSeq`.
|
|
47
|
+
|
|
48
|
+
**Affected types:**
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
type SyncVersion = {
|
|
52
|
+
// ❌ Before
|
|
53
|
+
seq: number
|
|
54
|
+
// ✅ After
|
|
55
|
+
seq: string
|
|
56
|
+
timestamp: string
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
type ClientSyncMessage =
|
|
60
|
+
| { type: 'subscribe-entity'; /* ... */ lastSeq?: string /* was: number */ }
|
|
61
|
+
| { type: 'subscribe-collection'; /* ... */ lastSeq?: string /* was: number */ }
|
|
62
|
+
// ...
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**Impact:** Any code that does arithmetic on `seq` (e.g. `seq + 1`, `seq > previous`) breaks. Any persisted client-side state holding `lastSeq: number` becomes incompatible.
|
|
66
|
+
|
|
67
|
+
**Migration:**
|
|
68
|
+
|
|
69
|
+
1. Replace numeric comparisons with equality checks. Adapter-specific ordering, when needed, lives behind the bus's `compareSeq(a, b)` — do not re-implement it.
|
|
70
|
+
2. Treat `seq` as a black-box token: store it, send it back, never inspect it.
|
|
71
|
+
3. Persisted client caches (e.g. `SyncCacheEntry` in `@furystack/entity-sync-client`) carry `lastSeq` typed as `number` from previous versions and will not load. Either drop the cache on upgrade or write a one-shot migration that converts numeric seqs to their string representation.
|
|
72
|
+
|
|
73
|
+
### ⬆️ Dependencies
|
|
74
|
+
|
|
75
|
+
- Re-released to pick up the bumped workspace dependency `@furystack/core`. No source changes — version bump only.
|
|
76
|
+
|
|
77
|
+
## [2.0.0] - 2026-04-25
|
|
78
|
+
|
|
79
|
+
### 💥 Breaking Changes
|
|
80
|
+
|
|
81
|
+
Version bumped to align with the monorepo-wide functional DI migration. See the [v7 migration guide](../../docs/migrations/v7-functional-di.md) for the full picture.
|
|
82
|
+
|
|
83
|
+
- No direct API changes — this package only exports shared protocol types. Downstream consumers in `@furystack/entity-sync-service` and `@furystack/entity-sync-client` have moved to DI tokens; any code that imported types for use with those packages should check their respective changelogs.
|
|
84
|
+
|
|
85
|
+
## [1.0.11] - 2026-04-17
|
|
86
|
+
|
|
87
|
+
### ⬆️ Dependencies
|
|
88
|
+
|
|
89
|
+
- Raised the `typescript` devDependency to ^6.0.3 so the package compiles with the same compiler revision as the rest of the monorepo.
|
|
90
|
+
|
|
91
|
+
## [1.0.10] - 2026-03-27
|
|
92
|
+
|
|
93
|
+
### ⬆️ Dependencies
|
|
94
|
+
|
|
95
|
+
- Updated `vitest` to ^4.1.2
|
|
96
|
+
|
|
97
|
+
## [1.0.9] - 2026-03-25
|
|
98
|
+
|
|
99
|
+
### 📦 Build
|
|
100
|
+
|
|
101
|
+
- Removed deprecated `baseUrl` from tsconfig.json for TypeScript 6 compatibility
|
|
102
|
+
|
|
103
|
+
### ⬆️ Dependencies
|
|
104
|
+
|
|
105
|
+
- Upgraded `typescript` from ^5.9.3 to ^6.0.2
|
|
106
|
+
|
|
107
|
+
## [1.0.8] - 2026-03-19
|
|
108
|
+
|
|
109
|
+
### ⬆️ Dependencies
|
|
110
|
+
|
|
111
|
+
- Upgraded `vite` from ^7.3.1 to ^8.0.0 for improved build performance and new features
|
|
112
|
+
- Upgraded `vitest` from ^4.0.18 to ^4.1.0
|
|
113
|
+
- Upgraded `@vitest/coverage-istanbul` from ^4.0.18 to ^4.1.0
|
|
114
|
+
- Updated `@furystack/core` dependency to the latest major version.
|
|
115
|
+
|
|
116
|
+
## [1.0.7] - 2026-03-10
|
|
117
|
+
|
|
118
|
+
### ⬆️ Dependencies
|
|
119
|
+
|
|
120
|
+
- Updated `@furystack/core` dependency to the new major version
|
|
121
|
+
|
|
122
|
+
## [1.0.6] - 2026-03-07
|
|
123
|
+
|
|
124
|
+
### ⬆️ Dependencies
|
|
125
|
+
|
|
126
|
+
- Updated internal FuryStack dependencies
|
|
127
|
+
|
|
128
|
+
## [1.0.5] - 2026-03-06
|
|
129
|
+
|
|
130
|
+
### ⬆️ Dependencies
|
|
131
|
+
|
|
132
|
+
- Updated internal FuryStack dependencies
|
|
133
|
+
|
|
134
|
+
## [1.0.4] - 2026-03-03
|
|
135
|
+
|
|
136
|
+
### ⬆️ Dependencies
|
|
137
|
+
|
|
138
|
+
- Updated `@furystack/utils` with EventHub listener error handling
|
|
139
|
+
|
|
140
|
+
## [1.0.3] - 2026-02-26
|
|
141
|
+
|
|
142
|
+
### ⬆️ Dependencies
|
|
143
|
+
|
|
144
|
+
- Updated internal `@furystack/*` dependencies
|
|
145
|
+
- Bumped due to updated workspace dependencies
|
|
146
|
+
|
|
147
|
+
## [1.0.2] - 2026-02-26
|
|
148
|
+
|
|
149
|
+
### ⬆️ Dependencies
|
|
150
|
+
|
|
151
|
+
- Updated `@furystack/rest-service` dependency
|
|
152
|
+
|
|
153
|
+
## [1.0.1] - 2026-02-22
|
|
154
|
+
|
|
155
|
+
### ⬆️ Dependencies
|
|
156
|
+
|
|
157
|
+
- Updated `@furystack/core` dependency
|
|
158
|
+
|
|
159
|
+
## [1.0.0] - 2026-02-22
|
|
160
|
+
|
|
161
|
+
### 💥 Breaking Changes
|
|
162
|
+
|
|
163
|
+
### Added `collection-snapshot` variant to `ServerSyncMessage`
|
|
164
|
+
|
|
165
|
+
A new `collection-snapshot` variant has been added to the `ServerSyncMessage` union type. The server now sends a full snapshot (entries + count) whenever a collection changes, instead of individual diff messages. This ensures entries and count are always delivered together as a consistent unit.
|
|
166
|
+
|
|
167
|
+
Consumers that exhaustively match on `ServerSyncMessage.type` (without a `default`) must add a `collection-snapshot` case.
|
|
168
|
+
|
|
169
|
+
**Examples:**
|
|
170
|
+
|
|
171
|
+
```typescript
|
|
172
|
+
// ✅ Handle the new collection-snapshot message
|
|
173
|
+
switch (message.type) {
|
|
174
|
+
case 'collection-snapshot':
|
|
175
|
+
console.log(message.data, message.totalCount)
|
|
176
|
+
break
|
|
177
|
+
// ... other cases
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
**Impact:** Consumers that exhaustively match on `ServerSyncMessage.type` (without a `default`) will get a compile error until the new case is handled.
|
|
182
|
+
|
|
183
|
+
### ✨ Features
|
|
184
|
+
|
|
185
|
+
### Total count support for collection sync messages
|
|
186
|
+
|
|
187
|
+
- Added optional `totalCount` field to `snapshot` and `delta` server messages, reporting the total number of matching entities (ignoring `top`/`skip` pagination)
|
|
188
|
+
- Added `collection-snapshot` message type that delivers a full re-sync (entries + count) when a collection changes
|
|
189
|
+
|
|
190
|
+
## [0.1.1] - 2026-02-19
|
|
191
|
+
|
|
192
|
+
### ⬆️ Dependencies
|
|
193
|
+
|
|
194
|
+
- Updated `@furystack/core`
|
|
195
|
+
|
|
196
|
+
## [0.1.0] - 2026-02-12
|
|
197
|
+
|
|
198
|
+
### ✨ Features
|
|
199
|
+
|
|
200
|
+
### New package: shared protocol types for entity synchronization
|
|
201
|
+
|
|
202
|
+
Initial release of `@furystack/entity-sync`, providing the TypeScript types for the WebSocket-based entity synchronization protocol used between `@furystack/entity-sync-client` and `@furystack/entity-sync-service`.
|
|
203
|
+
|
|
204
|
+
Key types:
|
|
205
|
+
|
|
206
|
+
- `SyncVersion` — sequence number and timestamp metadata for change ordering
|
|
207
|
+
- `SyncChangeEntry` — discriminated union for added/updated/removed entity changes
|
|
208
|
+
- `ClientSyncMessage` — messages from client to server (subscribe-entity, subscribe-collection, unsubscribe)
|
|
209
|
+
- `ServerSyncMessage` — messages from server to client (subscribed snapshot/delta, incremental changes, errors)
|
|
210
|
+
- `SyncState<T>` — client-side discriminated union for subscription state (connecting, cached, suspended, synced, error)
|
|
211
|
+
|
|
212
|
+
### ⬆️ Dependencies
|
|
213
|
+
|
|
214
|
+
- Added `@furystack/core` (workspace:^) as a dependency
|
|
215
|
+
|
|
216
|
+
All notable changes to the `@furystack/entity-sync` will be documented in this file.
|
|
217
|
+
|
|
218
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
219
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|