@pluv/io 5.0.1 → 5.0.2
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/dist/index.d.mts +542 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +1424 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +8 -5
- package/CHANGELOG.md +0 -2353
- package/eslint.config.mjs +0 -4
- package/src/AbstractPersistence.ts +0 -29
- package/src/AbstractPlatform.ts +0 -105
- package/src/AbstractPubSub.ts +0 -20
- package/src/AbstractWebSocket.ts +0 -134
- package/src/IORoom.ts +0 -1245
- package/src/Persistence.ts +0 -81
- package/src/PluvIO.ts +0 -239
- package/src/PluvProcedure.ts +0 -203
- package/src/PluvRouter.ts +0 -61
- package/src/PluvServer.ts +0 -487
- package/src/PubSub.ts +0 -70
- package/src/authorize.ts +0 -76
- package/src/constants.ts +0 -6
- package/src/createIO.ts +0 -55
- package/src/index.ts +0 -55
- package/src/types.ts +0 -287
- package/src/utils/index.ts +0 -2
- package/src/utils/oneLine.ts +0 -7
- package/src/utils/pickBy.ts +0 -16
- package/src/version.ts +0 -3
- package/tsconfig.json +0 -9
- package/tsdown.config.ts +0 -14
package/CHANGELOG.md
DELETED
|
@@ -1,2353 +0,0 @@
|
|
|
1
|
-
# @pluv/io
|
|
2
|
-
|
|
3
|
-
## 5.0.1
|
|
4
|
-
|
|
5
|
-
### Patch Changes
|
|
6
|
-
|
|
7
|
-
- @pluv/crdt@5.0.1
|
|
8
|
-
- @pluv/types@5.0.1
|
|
9
|
-
|
|
10
|
-
## 5.0.0
|
|
11
|
-
|
|
12
|
-
### Patch Changes
|
|
13
|
-
|
|
14
|
-
- @pluv/crdt@5.0.0
|
|
15
|
-
- @pluv/types@5.0.0
|
|
16
|
-
|
|
17
|
-
## 4.1.0
|
|
18
|
-
|
|
19
|
-
### Patch Changes
|
|
20
|
-
|
|
21
|
-
- @pluv/crdt@4.1.0
|
|
22
|
-
- @pluv/types@4.1.0
|
|
23
|
-
|
|
24
|
-
## 4.0.2
|
|
25
|
-
|
|
26
|
-
### Patch Changes
|
|
27
|
-
|
|
28
|
-
- e1913b3: Upgraded internal dependencies
|
|
29
|
-
- Updated dependencies [e1913b3]
|
|
30
|
-
- @pluv/types@4.0.2
|
|
31
|
-
- @pluv/crdt@4.0.2
|
|
32
|
-
|
|
33
|
-
## 4.0.1
|
|
34
|
-
|
|
35
|
-
### Patch Changes
|
|
36
|
-
|
|
37
|
-
- @pluv/crdt@4.0.1
|
|
38
|
-
- @pluv/types@4.0.1
|
|
39
|
-
|
|
40
|
-
## 4.0.0
|
|
41
|
-
|
|
42
|
-
### Major Changes
|
|
43
|
-
|
|
44
|
-
- df5c39c: Update all packages to be ESM only.
|
|
45
|
-
- c142910: ### Breaking Changes
|
|
46
|
-
|
|
47
|
-
Updated jose from jose@^5 to jose@^6.
|
|
48
|
-
|
|
49
|
-
- 07e2a1e: ### Breaking Changes
|
|
50
|
-
|
|
51
|
-
This release includes the following breaking changes:
|
|
52
|
-
1. **Removed `onDestroy` handler** (room-level only) - replaced with `onRoomDestroyed` and `onStorageDestroyed`
|
|
53
|
-
2. **Removed `onRoomDeleted` handler** (server-level) - replaced with `onRoomDestroyed` and `onStorageDestroyed`
|
|
54
|
-
3. **Listeners can no longer be configured at room-level** - all listeners must be configured at server-level via `io.server()`
|
|
55
|
-
4. **Event type changes** - `IORoomDestroyedEvent` no longer includes `encodedState`
|
|
56
|
-
|
|
57
|
-
#### Remove `onDestroy` and `onRoomDeleted` in favor of `onRoomDestroyed` and `onStorageDestroyed`
|
|
58
|
-
|
|
59
|
-
**BREAKING**: Two event handlers have been **removed** in favor of two separate handlers that provide better control over when storage is saved. This is a breaking change that requires code updates.
|
|
60
|
-
|
|
61
|
-
**New Handlers:**
|
|
62
|
-
- **`onRoomDestroyed`**: Fires whenever a room is destroyed. This event does NOT include `encodedState` to prevent accidentally saving empty or uninitialized storage data. **Available only at server-level** via `io.server()`.
|
|
63
|
-
- **`onStorageDestroyed`**: Only fires when the storage document is about to be destroyed after it has been initialized via `initializeSession`. This event includes `encodedState` and should be used for saving storage to your database. **Available only at server-level** via `io.server()`.
|
|
64
|
-
|
|
65
|
-
**Removed Handlers:**
|
|
66
|
-
- **`onDestroy`** (room-level only, via `createRoom`): **REMOVED**. Use `onRoomDestroyed` and `onStorageDestroyed` instead.
|
|
67
|
-
- **`onRoomDeleted`** (server-level): **REMOVED**. Use `onRoomDestroyed` and `onStorageDestroyed` instead.
|
|
68
|
-
|
|
69
|
-
**Migration Guide:**
|
|
70
|
-
|
|
71
|
-
**Old (no longer works):**
|
|
72
|
-
|
|
73
|
-
```typescript
|
|
74
|
-
// Room-level onDestroy (removed)
|
|
75
|
-
const room = io.createRoom("room-id", {
|
|
76
|
-
onDestroy: async ({ encodedState, room }) => {
|
|
77
|
-
// This no longer works
|
|
78
|
-
await saveToDatabase(room, encodedState);
|
|
79
|
-
},
|
|
80
|
-
});
|
|
81
|
-
|
|
82
|
-
// Server-level onRoomDeleted (removed)
|
|
83
|
-
io.server({
|
|
84
|
-
onRoomDeleted: async ({ encodedState, room }) => {
|
|
85
|
-
// This no longer works
|
|
86
|
-
await saveToDatabase(room, encodedState);
|
|
87
|
-
},
|
|
88
|
-
});
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
**New (recommended approach):**
|
|
92
|
-
|
|
93
|
-
```typescript
|
|
94
|
-
// Server-level handlers (recommended - all listeners are now server-level)
|
|
95
|
-
io.server({
|
|
96
|
-
onRoomDestroyed: async ({ room }) => {
|
|
97
|
-
// Room destroyed - use for cleanup if needed
|
|
98
|
-
await cleanupRoom(room);
|
|
99
|
-
},
|
|
100
|
-
onStorageDestroyed: async ({ encodedState, room }) => {
|
|
101
|
-
// Only fires when storage was initialized via initializeSession
|
|
102
|
-
// Safe to save to database
|
|
103
|
-
await saveToDatabase(room, encodedState);
|
|
104
|
-
},
|
|
105
|
-
});
|
|
106
|
-
|
|
107
|
-
// Rooms are created without listener options
|
|
108
|
-
const room = io.createRoom("room-id");
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
#### Type Changes
|
|
112
|
-
|
|
113
|
-
**BREAKING**: The following type changes may require TypeScript code updates:
|
|
114
|
-
- **`IORoomDestroyedEvent`** no longer includes `encodedState` (breaking change if you were accessing `encodedState` from this event)
|
|
115
|
-
- **`IORoomListenerEvent`** includes `encodedState: string | null` (used by `onStorageDestroyed`)
|
|
116
|
-
- **All listeners must be configured at the server level** via `io.server()`, not at the room level via `createRoom()` (breaking change - room-level listener configuration is no longer supported)
|
|
117
|
-
- **`CreateRoomOptions`** now correctly requires platform-specific room context properties (e.g., `env` and `state` for Cloudflare) when they are required by the platform, while properly handling optional properties like `meta` (breaking change - TypeScript will now correctly enforce required properties)
|
|
118
|
-
|
|
119
|
-
### Minor Changes
|
|
120
|
-
|
|
121
|
-
- 037074e: Migrated build process from tsup to tsdown.
|
|
122
|
-
|
|
123
|
-
### Patch Changes
|
|
124
|
-
|
|
125
|
-
- 2eb5def: Bumped dependencies.
|
|
126
|
-
- Updated dependencies [2eb5def]
|
|
127
|
-
- Updated dependencies [df5c39c]
|
|
128
|
-
- Updated dependencies [037074e]
|
|
129
|
-
- @pluv/types@4.0.0
|
|
130
|
-
- @pluv/crdt@4.0.0
|
|
131
|
-
|
|
132
|
-
## 3.2.2
|
|
133
|
-
|
|
134
|
-
### Patch Changes
|
|
135
|
-
|
|
136
|
-
- Updated dependencies [8665dbe]
|
|
137
|
-
- @pluv/types@3.2.2
|
|
138
|
-
- @pluv/crdt@3.2.2
|
|
139
|
-
|
|
140
|
-
## 3.2.1
|
|
141
|
-
|
|
142
|
-
### Patch Changes
|
|
143
|
-
|
|
144
|
-
- @pluv/crdt@3.2.1
|
|
145
|
-
- @pluv/types@3.2.1
|
|
146
|
-
|
|
147
|
-
## 3.2.0
|
|
148
|
-
|
|
149
|
-
### Minor Changes
|
|
150
|
-
|
|
151
|
-
- 6d2b257: Support async `context` parameter in `createIO`.
|
|
152
|
-
|
|
153
|
-
### Patch Changes
|
|
154
|
-
|
|
155
|
-
- @pluv/crdt@3.2.0
|
|
156
|
-
- @pluv/types@3.2.0
|
|
157
|
-
|
|
158
|
-
## 3.1.7
|
|
159
|
-
|
|
160
|
-
### Patch Changes
|
|
161
|
-
|
|
162
|
-
- f1d56d9: Fixed a case where in Cloudflare Durable Objects, the CRDT storage would clear upon hibernation.
|
|
163
|
-
- @pluv/crdt@3.1.7
|
|
164
|
-
- @pluv/types@3.1.7
|
|
165
|
-
|
|
166
|
-
## 3.1.6
|
|
167
|
-
|
|
168
|
-
### Patch Changes
|
|
169
|
-
|
|
170
|
-
- @pluv/crdt@3.1.6
|
|
171
|
-
- @pluv/types@3.1.6
|
|
172
|
-
|
|
173
|
-
## 3.1.5
|
|
174
|
-
|
|
175
|
-
### Patch Changes
|
|
176
|
-
|
|
177
|
-
- @pluv/crdt@3.1.5
|
|
178
|
-
- @pluv/types@3.1.5
|
|
179
|
-
|
|
180
|
-
## 3.1.4
|
|
181
|
-
|
|
182
|
-
### Patch Changes
|
|
183
|
-
|
|
184
|
-
- @pluv/crdt@3.1.4
|
|
185
|
-
- @pluv/types@3.1.4
|
|
186
|
-
|
|
187
|
-
## 3.1.3
|
|
188
|
-
|
|
189
|
-
### Patch Changes
|
|
190
|
-
|
|
191
|
-
- 651a9f8: Fixed applying `getInitialStorage` if the initial storage state is empty.
|
|
192
|
-
- @pluv/crdt@3.1.3
|
|
193
|
-
- @pluv/types@3.1.3
|
|
194
|
-
|
|
195
|
-
## 3.1.2
|
|
196
|
-
|
|
197
|
-
### Patch Changes
|
|
198
|
-
|
|
199
|
-
- 8f138aa: Fixed `getInitialStorage` not being applied.
|
|
200
|
-
- @pluv/crdt@3.1.2
|
|
201
|
-
- @pluv/types@3.1.2
|
|
202
|
-
|
|
203
|
-
## 3.1.1
|
|
204
|
-
|
|
205
|
-
### Patch Changes
|
|
206
|
-
|
|
207
|
-
- 7b719bf: Fixed `PluvIO.server` not requiring input parameters (i.e. was optional) when `createIO` specified `crdt`.
|
|
208
|
-
- @pluv/crdt@3.1.1
|
|
209
|
-
- @pluv/types@3.1.1
|
|
210
|
-
|
|
211
|
-
## 3.1.0
|
|
212
|
-
|
|
213
|
-
### Patch Changes
|
|
214
|
-
|
|
215
|
-
- a40f4dc: Fixed `getInitialStorage` not being required when `crdt` is provided.
|
|
216
|
-
- @pluv/crdt@3.1.0
|
|
217
|
-
- @pluv/types@3.1.0
|
|
218
|
-
|
|
219
|
-
## 3.0.0
|
|
220
|
-
|
|
221
|
-
### Patch Changes
|
|
222
|
-
|
|
223
|
-
- @pluv/crdt@3.0.0
|
|
224
|
-
- @pluv/types@3.0.0
|
|
225
|
-
|
|
226
|
-
## 2.3.1
|
|
227
|
-
|
|
228
|
-
### Patch Changes
|
|
229
|
-
|
|
230
|
-
- @pluv/crdt@2.3.1
|
|
231
|
-
- @pluv/types@2.3.1
|
|
232
|
-
|
|
233
|
-
## 2.3.0
|
|
234
|
-
|
|
235
|
-
### Patch Changes
|
|
236
|
-
|
|
237
|
-
- @pluv/crdt@2.3.0
|
|
238
|
-
- @pluv/types@2.3.0
|
|
239
|
-
|
|
240
|
-
## 2.2.8
|
|
241
|
-
|
|
242
|
-
### Patch Changes
|
|
243
|
-
|
|
244
|
-
- b60ccd8: Fix `PluvServer` fetch config validation.
|
|
245
|
-
- @pluv/crdt@2.2.8
|
|
246
|
-
- @pluv/types@2.2.8
|
|
247
|
-
|
|
248
|
-
## 2.2.7
|
|
249
|
-
|
|
250
|
-
### Patch Changes
|
|
251
|
-
|
|
252
|
-
- ec2717b: Fixed `ioServer.fetch` not receiving the `PluvServer` config.
|
|
253
|
-
- @pluv/crdt@2.2.7
|
|
254
|
-
- @pluv/types@2.2.7
|
|
255
|
-
|
|
256
|
-
## 2.2.6
|
|
257
|
-
|
|
258
|
-
### Patch Changes
|
|
259
|
-
|
|
260
|
-
- @pluv/crdt@2.2.6
|
|
261
|
-
- @pluv/types@2.2.6
|
|
262
|
-
|
|
263
|
-
## 2.2.5
|
|
264
|
-
|
|
265
|
-
### Patch Changes
|
|
266
|
-
|
|
267
|
-
- @pluv/crdt@2.2.5
|
|
268
|
-
- @pluv/types@2.2.5
|
|
269
|
-
|
|
270
|
-
## 2.2.4
|
|
271
|
-
|
|
272
|
-
### Patch Changes
|
|
273
|
-
|
|
274
|
-
- @pluv/crdt@2.2.4
|
|
275
|
-
- @pluv/types@2.2.4
|
|
276
|
-
|
|
277
|
-
## 2.2.3
|
|
278
|
-
|
|
279
|
-
### Patch Changes
|
|
280
|
-
|
|
281
|
-
- @pluv/crdt@2.2.3
|
|
282
|
-
- @pluv/types@2.2.3
|
|
283
|
-
|
|
284
|
-
## 2.2.2
|
|
285
|
-
|
|
286
|
-
### Patch Changes
|
|
287
|
-
|
|
288
|
-
- @pluv/crdt@2.2.2
|
|
289
|
-
- @pluv/types@2.2.2
|
|
290
|
-
|
|
291
|
-
## 2.2.1
|
|
292
|
-
|
|
293
|
-
### Patch Changes
|
|
294
|
-
|
|
295
|
-
- @pluv/crdt@2.2.1
|
|
296
|
-
- @pluv/types@2.2.1
|
|
297
|
-
|
|
298
|
-
## 2.2.0
|
|
299
|
-
|
|
300
|
-
### Patch Changes
|
|
301
|
-
|
|
302
|
-
- cb660cd: Fixed multiple Cloudflare Worker Durable Objects sharing references to the same I/O methods.
|
|
303
|
-
- @pluv/crdt@2.2.0
|
|
304
|
-
- @pluv/types@2.2.0
|
|
305
|
-
|
|
306
|
-
## 2.1.0
|
|
307
|
-
|
|
308
|
-
### Patch Changes
|
|
309
|
-
|
|
310
|
-
- @pluv/crdt@2.1.0
|
|
311
|
-
- @pluv/types@2.1.0
|
|
312
|
-
|
|
313
|
-
## 2.0.2
|
|
314
|
-
|
|
315
|
-
### Patch Changes
|
|
316
|
-
|
|
317
|
-
- @pluv/crdt@2.0.2
|
|
318
|
-
- @pluv/types@2.0.2
|
|
319
|
-
|
|
320
|
-
## 2.0.1
|
|
321
|
-
|
|
322
|
-
### Patch Changes
|
|
323
|
-
|
|
324
|
-
- @pluv/crdt@2.0.1
|
|
325
|
-
- @pluv/types@2.0.1
|
|
326
|
-
|
|
327
|
-
## 2.0.0
|
|
328
|
-
|
|
329
|
-
### Patch Changes
|
|
330
|
-
|
|
331
|
-
- 047a1d8: Moved several internal types to `@pluv/types`.
|
|
332
|
-
- Updated dependencies [047a1d8]
|
|
333
|
-
- @pluv/types@2.0.0
|
|
334
|
-
- @pluv/crdt@2.0.0
|
|
335
|
-
|
|
336
|
-
## 1.0.2
|
|
337
|
-
|
|
338
|
-
### Patch Changes
|
|
339
|
-
|
|
340
|
-
- @pluv/crdt@1.0.2
|
|
341
|
-
- @pluv/types@1.0.2
|
|
342
|
-
|
|
343
|
-
## 1.0.1
|
|
344
|
-
|
|
345
|
-
### Patch Changes
|
|
346
|
-
|
|
347
|
-
- c583be9: Fixed storage race condition that occurred when 2 users joined a room near simultaneously that would cause users to have mismatched storage states from the server (and thereby preventing updates from properly registering) until the user reconnected.
|
|
348
|
-
- @pluv/crdt@1.0.1
|
|
349
|
-
- @pluv/types@1.0.1
|
|
350
|
-
|
|
351
|
-
## 1.0.0
|
|
352
|
-
|
|
353
|
-
### Major Changes
|
|
354
|
-
|
|
355
|
-
- af94706: pluv.io is now stable and production ready!
|
|
356
|
-
|
|
357
|
-
With this v1 release, pluv.io will now follow [semantic versioning](https://semver.org/) with more comprehensive release notes for future changes to the library.
|
|
358
|
-
|
|
359
|
-
Checkout the [full documentation here](https://pluv.io/docs/introduction) to get started today!
|
|
360
|
-
|
|
361
|
-
### Patch Changes
|
|
362
|
-
|
|
363
|
-
- Updated dependencies [af94706]
|
|
364
|
-
- @pluv/crdt@1.0.0
|
|
365
|
-
- @pluv/types@1.0.0
|
|
366
|
-
|
|
367
|
-
## 0.44.2
|
|
368
|
-
|
|
369
|
-
### Patch Changes
|
|
370
|
-
|
|
371
|
-
- @pluv/crdt@0.44.2
|
|
372
|
-
- @pluv/types@0.44.2
|
|
373
|
-
|
|
374
|
-
## 0.44.1
|
|
375
|
-
|
|
376
|
-
### Patch Changes
|
|
377
|
-
|
|
378
|
-
- @pluv/crdt@0.44.1
|
|
379
|
-
- @pluv/types@0.44.1
|
|
380
|
-
|
|
381
|
-
## 0.44.0
|
|
382
|
-
|
|
383
|
-
### Patch Changes
|
|
384
|
-
|
|
385
|
-
- @pluv/crdt@0.44.0
|
|
386
|
-
- @pluv/types@0.44.0
|
|
387
|
-
|
|
388
|
-
## 0.43.0
|
|
389
|
-
|
|
390
|
-
### Minor Changes
|
|
391
|
-
|
|
392
|
-
- 0063e80: **BREAKING** Added a configurable limit for the max-size (in bytes) for storage (defaulting to 30MB). To unset this limit, you can set this limit to `0` or `null`.
|
|
393
|
-
|
|
394
|
-
```ts
|
|
395
|
-
createIO({
|
|
396
|
-
limits: {
|
|
397
|
-
storageMaxSize: null,
|
|
398
|
-
},
|
|
399
|
-
});
|
|
400
|
-
```
|
|
401
|
-
|
|
402
|
-
- 4b0fbb3: **BREAKING** Added the ability to configure the limits for user object size, presence size, and user id length. User id is now defaulted to be limited to 128 characters. To unset this limit, you can set this limit to `0` or `null`.
|
|
403
|
-
|
|
404
|
-
```ts
|
|
405
|
-
// defaults
|
|
406
|
-
createIO(
|
|
407
|
-
platformCloudflare({
|
|
408
|
-
limits: {
|
|
409
|
-
presenceMaxSize: 512,
|
|
410
|
-
storageMaxSize: 31_457_280,
|
|
411
|
-
userIdMaxLength: 128,
|
|
412
|
-
userMaxSize: 512,
|
|
413
|
-
},
|
|
414
|
-
}),
|
|
415
|
-
);
|
|
416
|
-
```
|
|
417
|
-
|
|
418
|
-
### Patch Changes
|
|
419
|
-
|
|
420
|
-
- e60a677: Fix 1 and 2 character long room names not being supported.
|
|
421
|
-
- 244a973: Fixed not applying user size limits when calling `PluvIO.authorize` and not allowing it to be overwritten for `platformPluv`.
|
|
422
|
-
- @pluv/crdt@0.43.0
|
|
423
|
-
- @pluv/types@0.43.0
|
|
424
|
-
|
|
425
|
-
## 0.42.0
|
|
426
|
-
|
|
427
|
-
### Patch Changes
|
|
428
|
-
|
|
429
|
-
- cf1529a: Each time garbage collection is run, a sync-state event will be emitted to connected sessions with info of currently connected users.
|
|
430
|
-
- @pluv/crdt@0.42.0
|
|
431
|
-
- @pluv/types@0.42.0
|
|
432
|
-
|
|
433
|
-
## 0.41.7
|
|
434
|
-
|
|
435
|
-
### Patch Changes
|
|
436
|
-
|
|
437
|
-
- @pluv/crdt@0.41.7
|
|
438
|
-
- @pluv/types@0.41.7
|
|
439
|
-
|
|
440
|
-
## 0.41.6
|
|
441
|
-
|
|
442
|
-
### Patch Changes
|
|
443
|
-
|
|
444
|
-
- @pluv/crdt@0.41.6
|
|
445
|
-
- @pluv/types@0.41.6
|
|
446
|
-
|
|
447
|
-
## 0.41.5
|
|
448
|
-
|
|
449
|
-
### Patch Changes
|
|
450
|
-
|
|
451
|
-
- @pluv/crdt@0.41.5
|
|
452
|
-
- @pluv/types@0.41.5
|
|
453
|
-
|
|
454
|
-
## 0.41.4
|
|
455
|
-
|
|
456
|
-
### Patch Changes
|
|
457
|
-
|
|
458
|
-
- @pluv/crdt@0.41.4
|
|
459
|
-
- @pluv/types@0.41.4
|
|
460
|
-
|
|
461
|
-
## 0.41.3
|
|
462
|
-
|
|
463
|
-
### Patch Changes
|
|
464
|
-
|
|
465
|
-
- 49051c0: Fix presence keys becoming lost, causing presence objects to be partial and failing schema validation.
|
|
466
|
-
- @pluv/crdt@0.41.3
|
|
467
|
-
- @pluv/types@0.41.3
|
|
468
|
-
|
|
469
|
-
## 0.41.2
|
|
470
|
-
|
|
471
|
-
### Patch Changes
|
|
472
|
-
|
|
473
|
-
- @pluv/crdt@0.41.2
|
|
474
|
-
- @pluv/types@0.41.2
|
|
475
|
-
|
|
476
|
-
## 0.41.1
|
|
477
|
-
|
|
478
|
-
### Patch Changes
|
|
479
|
-
|
|
480
|
-
- @pluv/crdt@0.41.1
|
|
481
|
-
- @pluv/types@0.41.1
|
|
482
|
-
|
|
483
|
-
## 0.41.0
|
|
484
|
-
|
|
485
|
-
### Minor Changes
|
|
486
|
-
|
|
487
|
-
- 73adf21: **BREAKING** The `user` that is provided to `PluvServer.createToken` is now limited to be at most 512 bytes. If the `user` is any larger, `PluvServer.createToken` will now throw an error.
|
|
488
|
-
- f02a430: **BREAKING** Updated the way `user` is stored and read from the websocket, so now `user` is persisted in-memory rather than from persistent storage (improves performance and lowers cost in some cases). This change primarily affects pluv platforms, which are intended for internal use only, and therefore should be mostly non-breaking.
|
|
489
|
-
- 0b908b3: **BREAKING** User's presence is now limited to be at most 512 bytes. If the presence is any larger, the `PluvServer` will now throw an error.
|
|
490
|
-
- 555b88d: Users can now have multiple simultaneous connections. Previously, if a user tried to open a connection to a room while already being connected to the room, the new connection would be blocked. Now, when the user opens another connection, the new connection will be opened and initialized with their latest presence.
|
|
491
|
-
|
|
492
|
-
Users can only have 1 identity and 1 presence, which means that all presence updates will sync across all of that user's connections. This means that even when a user opens multiple connections, they will only appear once in `others`.
|
|
493
|
-
|
|
494
|
-
### Patch Changes
|
|
495
|
-
|
|
496
|
-
- 6422f3b: In certain edge-cases, WebSocket connections can silently die in all runtimes, causing connected clients to see the presence of other connections that aren't connected anymore.
|
|
497
|
-
|
|
498
|
-
The `IORoom` now automatically garbage collects dead websockets that haven't been pinged in a long time. Garbage collection happens on WebSocket ping/pong messages every 60 seconds.
|
|
499
|
-
|
|
500
|
-
However, garbage collection does not automatically happen for Cloudflare Worker Durable Objects using websocket hiberation because ping/pong messages happen outside of the Durable Object's compute. Therefore `IORoom` now provides a method `garbageCollect` that can be called manually to clear any dead websockets whenever the user chooses.
|
|
501
|
-
|
|
502
|
-
For example, within a Cloudflare Worker Durable Object, an [alarm](https://developers.cloudflare.com/durable-objects/api/alarms/) can be set to periodically run garbage collection for you:
|
|
503
|
-
|
|
504
|
-
```ts
|
|
505
|
-
import { InferIORoom } from "@pluv/io";
|
|
506
|
-
|
|
507
|
-
class RoomDurableObject extends DurableObject {
|
|
508
|
-
private _room: InferIORoom<typeof ioServer>;
|
|
509
|
-
|
|
510
|
-
constructor(state: DurableObjectState, env: Env) {
|
|
511
|
-
super(state, env);
|
|
512
|
-
|
|
513
|
-
this._room = io.createRoom(state.id.toString(), { env, state });
|
|
514
|
-
}
|
|
515
|
-
|
|
516
|
-
// ... WebSocket handlers here
|
|
517
|
-
|
|
518
|
-
async fetch(request: Request): Promise<Response> {
|
|
519
|
-
// ... WebSocket validation and pair creation here
|
|
520
|
-
|
|
521
|
-
const alarm = await this.ctx.storage.getAlarm();
|
|
522
|
-
|
|
523
|
-
// Start running the garbage collection interval
|
|
524
|
-
if (alarm !== null) await this.ctx.storage.setAlarm(Date.now() + 60_000);
|
|
525
|
-
|
|
526
|
-
await this._room.register(server, { env: this.env, request });
|
|
527
|
-
|
|
528
|
-
// ... Return response
|
|
529
|
-
}
|
|
530
|
-
|
|
531
|
-
async alarm(): Promise<void> {
|
|
532
|
-
await this._room.garbageCollect();
|
|
533
|
-
|
|
534
|
-
// Garbage collect every 1 minute
|
|
535
|
-
await this.ctx.storage.setAlarm(Date.now() + 60_000);
|
|
536
|
-
}
|
|
537
|
-
}
|
|
538
|
-
```
|
|
539
|
-
|
|
540
|
-
- a663c65: Update websocket session connection ids to be deterministic based on the user's id if authorization is configured (i.e. connection id will now just be the user's id with a prefix).
|
|
541
|
-
- 555b88d: Added a new field `presence` to the server's event resolver context to view the message sender's currently known presence.
|
|
542
|
-
- @pluv/crdt@0.41.0
|
|
543
|
-
- @pluv/types@0.41.0
|
|
544
|
-
|
|
545
|
-
## 0.40.2
|
|
546
|
-
|
|
547
|
-
### Patch Changes
|
|
548
|
-
|
|
549
|
-
- @pluv/crdt@0.40.2
|
|
550
|
-
- @pluv/types@0.40.2
|
|
551
|
-
|
|
552
|
-
## 0.40.1
|
|
553
|
-
|
|
554
|
-
### Patch Changes
|
|
555
|
-
|
|
556
|
-
- @pluv/crdt@0.40.1
|
|
557
|
-
- @pluv/types@0.40.1
|
|
558
|
-
|
|
559
|
-
## 0.40.0
|
|
560
|
-
|
|
561
|
-
### Patch Changes
|
|
562
|
-
|
|
563
|
-
- @pluv/crdt@0.40.0
|
|
564
|
-
- @pluv/types@0.40.0
|
|
565
|
-
|
|
566
|
-
## 0.39.1
|
|
567
|
-
|
|
568
|
-
### Patch Changes
|
|
569
|
-
|
|
570
|
-
- @pluv/crdt@0.39.1
|
|
571
|
-
- @pluv/types@0.39.1
|
|
572
|
-
|
|
573
|
-
## 0.39.0
|
|
574
|
-
|
|
575
|
-
### Patch Changes
|
|
576
|
-
|
|
577
|
-
- fe6e239: Broadcast the quitting user when the server receives an abnormal message event from a session that was marked as having quit.
|
|
578
|
-
- 737d508: Fix not always fully running clean-up effects on the `IORoom` after websocket sessions are closed.
|
|
579
|
-
- @pluv/crdt@0.39.0
|
|
580
|
-
- @pluv/types@0.39.0
|
|
581
|
-
|
|
582
|
-
## 0.38.14
|
|
583
|
-
|
|
584
|
-
### Patch Changes
|
|
585
|
-
|
|
586
|
-
- @pluv/crdt@0.38.14
|
|
587
|
-
- @pluv/types@0.38.14
|
|
588
|
-
|
|
589
|
-
## 0.38.13
|
|
590
|
-
|
|
591
|
-
### Patch Changes
|
|
592
|
-
|
|
593
|
-
- 809afd3: Fix generic type default for router events.
|
|
594
|
-
- @pluv/crdt@0.38.13
|
|
595
|
-
- @pluv/types@0.38.13
|
|
596
|
-
|
|
597
|
-
## 0.38.12
|
|
598
|
-
|
|
599
|
-
### Patch Changes
|
|
600
|
-
|
|
601
|
-
- @pluv/crdt@0.38.12
|
|
602
|
-
- @pluv/types@0.38.12
|
|
603
|
-
|
|
604
|
-
## 0.38.11
|
|
605
|
-
|
|
606
|
-
### Patch Changes
|
|
607
|
-
|
|
608
|
-
- @pluv/crdt@0.38.11
|
|
609
|
-
- @pluv/types@0.38.11
|
|
610
|
-
|
|
611
|
-
## 0.38.10
|
|
612
|
-
|
|
613
|
-
### Patch Changes
|
|
614
|
-
|
|
615
|
-
- @pluv/crdt@0.38.10
|
|
616
|
-
- @pluv/types@0.38.10
|
|
617
|
-
|
|
618
|
-
## 0.38.9
|
|
619
|
-
|
|
620
|
-
### Patch Changes
|
|
621
|
-
|
|
622
|
-
- @pluv/crdt@0.38.9
|
|
623
|
-
- @pluv/types@0.38.9
|
|
624
|
-
|
|
625
|
-
## 0.38.8
|
|
626
|
-
|
|
627
|
-
### Patch Changes
|
|
628
|
-
|
|
629
|
-
- @pluv/crdt@0.38.8
|
|
630
|
-
- @pluv/types@0.38.8
|
|
631
|
-
|
|
632
|
-
## 0.38.7
|
|
633
|
-
|
|
634
|
-
### Patch Changes
|
|
635
|
-
|
|
636
|
-
- @pluv/crdt@0.38.7
|
|
637
|
-
- @pluv/types@0.38.7
|
|
638
|
-
|
|
639
|
-
## 0.38.6
|
|
640
|
-
|
|
641
|
-
### Patch Changes
|
|
642
|
-
|
|
643
|
-
- @pluv/crdt@0.38.6
|
|
644
|
-
- @pluv/types@0.38.6
|
|
645
|
-
|
|
646
|
-
## 0.38.5
|
|
647
|
-
|
|
648
|
-
### Patch Changes
|
|
649
|
-
|
|
650
|
-
- @pluv/crdt@0.38.5
|
|
651
|
-
- @pluv/types@0.38.5
|
|
652
|
-
|
|
653
|
-
## 0.38.4
|
|
654
|
-
|
|
655
|
-
### Patch Changes
|
|
656
|
-
|
|
657
|
-
- @pluv/crdt@0.38.4
|
|
658
|
-
- @pluv/types@0.38.4
|
|
659
|
-
|
|
660
|
-
## 0.38.3
|
|
661
|
-
|
|
662
|
-
### Patch Changes
|
|
663
|
-
|
|
664
|
-
- 8346273: Disallow the `# @pluv/io character in router event names.
|
|
665
|
-
- @pluv/crdt@0.38.3
|
|
666
|
-
- @pluv/types@0.38.3
|
|
667
|
-
|
|
668
|
-
## 0.38.2
|
|
669
|
-
|
|
670
|
-
### Patch Changes
|
|
671
|
-
|
|
672
|
-
- 039cd64: Require `PluvRouter` event names to be formatted as valid JavaScript variable names.
|
|
673
|
-
- @pluv/crdt@0.38.2
|
|
674
|
-
- @pluv/types@0.38.2
|
|
675
|
-
|
|
676
|
-
## 0.38.1
|
|
677
|
-
|
|
678
|
-
### Patch Changes
|
|
679
|
-
|
|
680
|
-
- @pluv/crdt@0.38.1
|
|
681
|
-
- @pluv/types@0.38.1
|
|
682
|
-
|
|
683
|
-
## 0.38.0
|
|
684
|
-
|
|
685
|
-
### Minor Changes
|
|
686
|
-
|
|
687
|
-
- f4ceca3: Updated internal event names to follow a new naming convention.
|
|
688
|
-
|
|
689
|
-
### Patch Changes
|
|
690
|
-
|
|
691
|
-
- Updated dependencies [f4ceca3]
|
|
692
|
-
- @pluv/types@0.38.0
|
|
693
|
-
- @pluv/crdt@0.38.0
|
|
694
|
-
|
|
695
|
-
## 0.37.7
|
|
696
|
-
|
|
697
|
-
### Patch Changes
|
|
698
|
-
|
|
699
|
-
- @pluv/crdt@0.37.7
|
|
700
|
-
- @pluv/types@0.37.7
|
|
701
|
-
|
|
702
|
-
## 0.37.6
|
|
703
|
-
|
|
704
|
-
### Patch Changes
|
|
705
|
-
|
|
706
|
-
- 3a874f1: Now logs errors to the console when errors on encountered on the `onUserConnected` and `onUserDisconnected` events.
|
|
707
|
-
- @pluv/crdt@0.37.6
|
|
708
|
-
- @pluv/types@0.37.6
|
|
709
|
-
|
|
710
|
-
## 0.37.5
|
|
711
|
-
|
|
712
|
-
### Patch Changes
|
|
713
|
-
|
|
714
|
-
- 9a9ecee: Fixed an issue where hibernated Cloudflare Worker websockets were not updating their last ping timer and causing them to be disconnected after some time.
|
|
715
|
-
- @pluv/crdt@0.37.5
|
|
716
|
-
- @pluv/types@0.37.5
|
|
717
|
-
|
|
718
|
-
## 0.37.4
|
|
719
|
-
|
|
720
|
-
### Patch Changes
|
|
721
|
-
|
|
722
|
-
- @pluv/crdt@0.37.4
|
|
723
|
-
- @pluv/types@0.37.4
|
|
724
|
-
|
|
725
|
-
## 0.37.3
|
|
726
|
-
|
|
727
|
-
### Patch Changes
|
|
728
|
-
|
|
729
|
-
- @pluv/crdt@0.37.3
|
|
730
|
-
- @pluv/types@0.37.3
|
|
731
|
-
|
|
732
|
-
## 0.37.2
|
|
733
|
-
|
|
734
|
-
### Patch Changes
|
|
735
|
-
|
|
736
|
-
- @pluv/crdt@0.37.2
|
|
737
|
-
- @pluv/types@0.37.2
|
|
738
|
-
|
|
739
|
-
## 0.37.1
|
|
740
|
-
|
|
741
|
-
### Patch Changes
|
|
742
|
-
|
|
743
|
-
- @pluv/crdt@0.37.1
|
|
744
|
-
- @pluv/types@0.37.1
|
|
745
|
-
|
|
746
|
-
## 0.37.0
|
|
747
|
-
|
|
748
|
-
### Patch Changes
|
|
749
|
-
|
|
750
|
-
- 9b74abb: Improved type inference when calling `PluvIO.server` to not include options that are always undefined (i.e. are not allowed by the specified platform).
|
|
751
|
-
- @pluv/crdt@0.37.0
|
|
752
|
-
- @pluv/types@0.37.0
|
|
753
|
-
|
|
754
|
-
## 0.36.0
|
|
755
|
-
|
|
756
|
-
### Patch Changes
|
|
757
|
-
|
|
758
|
-
- @pluv/crdt@0.36.0
|
|
759
|
-
- @pluv/types@0.36.0
|
|
760
|
-
|
|
761
|
-
## 0.35.4
|
|
762
|
-
|
|
763
|
-
### Patch Changes
|
|
764
|
-
|
|
765
|
-
- 5d3a56f: Fix error emitted about `platformCloudflare` not supporting `fetch` when deployed to Cloudflare Workers.
|
|
766
|
-
- @pluv/crdt@0.35.4
|
|
767
|
-
- @pluv/types@0.35.4
|
|
768
|
-
|
|
769
|
-
## 0.35.3
|
|
770
|
-
|
|
771
|
-
### Patch Changes
|
|
772
|
-
|
|
773
|
-
- @pluv/crdt@0.35.3
|
|
774
|
-
- @pluv/types@0.35.3
|
|
775
|
-
|
|
776
|
-
## 0.35.2
|
|
777
|
-
|
|
778
|
-
### Patch Changes
|
|
779
|
-
|
|
780
|
-
- 81cb692: Fixed type inference of the `authorize` option in `createIO` when used as a function.
|
|
781
|
-
- Updated dependencies [81cb692]
|
|
782
|
-
- @pluv/types@0.35.2
|
|
783
|
-
- @pluv/crdt@0.35.2
|
|
784
|
-
|
|
785
|
-
## 0.35.1
|
|
786
|
-
|
|
787
|
-
### Patch Changes
|
|
788
|
-
|
|
789
|
-
- @pluv/crdt@0.35.1
|
|
790
|
-
- @pluv/types@0.35.1
|
|
791
|
-
|
|
792
|
-
## 0.35.0
|
|
793
|
-
|
|
794
|
-
### Minor Changes
|
|
795
|
-
|
|
796
|
-
- c9073ad: **BREAKING**
|
|
797
|
-
|
|
798
|
-
Removed the `required` property on the `authorize` config when creating a `PluvIO` instance. When `authorize` is provided, the session will be required to be authorized.
|
|
799
|
-
|
|
800
|
-
```ts
|
|
801
|
-
// Before
|
|
802
|
-
import { z } from "zod";
|
|
803
|
-
|
|
804
|
-
const io = createIO({
|
|
805
|
-
// ...
|
|
806
|
-
authorize: {
|
|
807
|
-
// Previously required: true to force all users to authorize
|
|
808
|
-
required: true,
|
|
809
|
-
user: z.object({
|
|
810
|
-
id: z.string(),
|
|
811
|
-
name: z.string(),
|
|
812
|
-
}),
|
|
813
|
-
secret: "sk_...",
|
|
814
|
-
},
|
|
815
|
-
// ...
|
|
816
|
-
});
|
|
817
|
-
|
|
818
|
-
// After
|
|
819
|
-
|
|
820
|
-
const io = createIO({
|
|
821
|
-
// ...
|
|
822
|
-
authorize: {
|
|
823
|
-
// No more `required` property. Now automatically applied always if
|
|
824
|
-
// `authorize` prop is provided to `createIO`
|
|
825
|
-
user: z.object({
|
|
826
|
-
id: z.string(),
|
|
827
|
-
name: z.string(),
|
|
828
|
-
}),
|
|
829
|
-
secret: "sk_...",
|
|
830
|
-
},
|
|
831
|
-
// ...
|
|
832
|
-
});
|
|
833
|
-
```
|
|
834
|
-
|
|
835
|
-
### Patch Changes
|
|
836
|
-
|
|
837
|
-
- @pluv/crdt@0.35.0
|
|
838
|
-
- @pluv/types@0.35.0
|
|
839
|
-
|
|
840
|
-
## 0.34.1
|
|
841
|
-
|
|
842
|
-
### Patch Changes
|
|
843
|
-
|
|
844
|
-
- d639427: Narrow type `EventResolverContext` so that `session` is only null on `sync` event types.
|
|
845
|
-
- @pluv/crdt@0.34.1
|
|
846
|
-
- @pluv/types@0.34.1
|
|
847
|
-
|
|
848
|
-
## 0.34.0
|
|
849
|
-
|
|
850
|
-
### Minor Changes
|
|
851
|
-
|
|
852
|
-
- 70af3b2: Updated `@pluv/io` to have a `handleMode` internally that determines if connections are handled by the `PluvServer` or by the platform itself (i.e. outside of the `PluvServer`). The internals of `@pluv/platform-node` and `@pluv/platform-cloudflare` have been updated with the required changes for this.
|
|
853
|
-
|
|
854
|
-
### Patch Changes
|
|
855
|
-
|
|
856
|
-
- 0c920ea: Fix the `onUserDisconnected` event not triggering.
|
|
857
|
-
- @pluv/crdt@0.34.0
|
|
858
|
-
- @pluv/types@0.34.0
|
|
859
|
-
|
|
860
|
-
## 0.33.0
|
|
861
|
-
|
|
862
|
-
### Patch Changes
|
|
863
|
-
|
|
864
|
-
- @pluv/crdt@0.33.0
|
|
865
|
-
- @pluv/types@0.33.0
|
|
866
|
-
|
|
867
|
-
## 0.32.9
|
|
868
|
-
|
|
869
|
-
### Patch Changes
|
|
870
|
-
|
|
871
|
-
- @pluv/crdt@0.32.9
|
|
872
|
-
- @pluv/types@0.32.9
|
|
873
|
-
|
|
874
|
-
## 0.32.8
|
|
875
|
-
|
|
876
|
-
### Patch Changes
|
|
877
|
-
|
|
878
|
-
- e659f8a: Update `getInitialStorage` so that the context is made available on the `context` event property.
|
|
879
|
-
|
|
880
|
-
```ts
|
|
881
|
-
import { createIO } from "@pluv/io";
|
|
882
|
-
|
|
883
|
-
// Before
|
|
884
|
-
const io = createIO({
|
|
885
|
-
getInitialStorage: ({ room, ...context }) => {
|
|
886
|
-
// ...
|
|
887
|
-
},
|
|
888
|
-
});
|
|
889
|
-
|
|
890
|
-
// After
|
|
891
|
-
const io = createIO({
|
|
892
|
-
// Context is now an explicit property on the event
|
|
893
|
-
getInitialStorage: ({ room, context }) => {
|
|
894
|
-
// ...
|
|
895
|
-
},
|
|
896
|
-
});
|
|
897
|
-
```
|
|
898
|
-
|
|
899
|
-
- @pluv/crdt@0.32.8
|
|
900
|
-
- @pluv/types@0.32.8
|
|
901
|
-
|
|
902
|
-
## 0.32.7
|
|
903
|
-
|
|
904
|
-
### Patch Changes
|
|
905
|
-
|
|
906
|
-
- @pluv/crdt@0.32.7
|
|
907
|
-
- @pluv/types@0.32.7
|
|
908
|
-
|
|
909
|
-
## 0.32.6
|
|
910
|
-
|
|
911
|
-
### Patch Changes
|
|
912
|
-
|
|
913
|
-
- c0956e7: Add `onUserConnected` and `onUserDisconnected` events on `PluvServer`.
|
|
914
|
-
|
|
915
|
-
```ts
|
|
916
|
-
import { createIO } from "@pluv/io";
|
|
917
|
-
|
|
918
|
-
const io = createIO({/* ... */});
|
|
919
|
-
|
|
920
|
-
const ioServer = io.server({
|
|
921
|
-
// ...
|
|
922
|
-
onUserConnected: (event) => {
|
|
923
|
-
// ...
|
|
924
|
-
},
|
|
925
|
-
onUserDisconnected: (event) => {
|
|
926
|
-
// ...
|
|
927
|
-
},
|
|
928
|
-
});
|
|
929
|
-
```
|
|
930
|
-
|
|
931
|
-
- @pluv/crdt@0.32.6
|
|
932
|
-
- @pluv/types@0.32.6
|
|
933
|
-
|
|
934
|
-
## 0.32.5
|
|
935
|
-
|
|
936
|
-
### Patch Changes
|
|
937
|
-
|
|
938
|
-
- @pluv/crdt@0.32.5
|
|
939
|
-
- @pluv/types@0.32.5
|
|
940
|
-
|
|
941
|
-
## 0.32.4
|
|
942
|
-
|
|
943
|
-
### Patch Changes
|
|
944
|
-
|
|
945
|
-
- @pluv/crdt@0.32.4
|
|
946
|
-
- @pluv/types@0.32.4
|
|
947
|
-
|
|
948
|
-
## 0.32.3
|
|
949
|
-
|
|
950
|
-
### Patch Changes
|
|
951
|
-
|
|
952
|
-
- bb21274: Added the ability to evict (i.e. close) a connection to a room via `IORoom.evict` and `IORoom.evictAll`.
|
|
953
|
-
- @pluv/crdt@0.32.3
|
|
954
|
-
- @pluv/types@0.32.3
|
|
955
|
-
|
|
956
|
-
## 0.32.2
|
|
957
|
-
|
|
958
|
-
### Patch Changes
|
|
959
|
-
|
|
960
|
-
- 890d45b: Update `onRoomMessage` and `onStorageUpdated` events to include the WebSocket as part of the `event` parameter of those listeners.
|
|
961
|
-
- @pluv/crdt@0.32.2
|
|
962
|
-
- @pluv/types@0.32.2
|
|
963
|
-
|
|
964
|
-
## 0.32.1
|
|
965
|
-
|
|
966
|
-
### Patch Changes
|
|
967
|
-
|
|
968
|
-
- @pluv/crdt@0.32.1
|
|
969
|
-
- @pluv/types@0.32.1
|
|
970
|
-
|
|
971
|
-
## 0.32.0
|
|
972
|
-
|
|
973
|
-
### Minor Changes
|
|
974
|
-
|
|
975
|
-
- cde5305: **BREAKING**
|
|
976
|
-
|
|
977
|
-
Update `createIO`'s `context` property to allow lazy initialization as a function. The `context` also no-longer contains platform-specific values by default. See example below:
|
|
978
|
-
|
|
979
|
-
```ts
|
|
980
|
-
import { createIO } from "@pluv/io";
|
|
981
|
-
import { platformCloudflare } from "@pluv/platform-cloudflare";
|
|
982
|
-
import { Database } from "./database";
|
|
983
|
-
|
|
984
|
-
// Before
|
|
985
|
-
const io = createIO({
|
|
986
|
-
platform: platformCloudflare(),
|
|
987
|
-
context: {
|
|
988
|
-
// Maybe you need to access `env` for Cloudflare, but it's not accessible
|
|
989
|
-
// here
|
|
990
|
-
db: new Database(env.DATABASE_URL),
|
|
991
|
-
// ^ Does not exist
|
|
992
|
-
|
|
993
|
-
// Even though it's not specified in this `context`, Cloudflare's
|
|
994
|
-
// env and state values were previously available where context
|
|
995
|
-
// was referenced
|
|
996
|
-
},
|
|
997
|
-
});
|
|
998
|
-
|
|
999
|
-
// After
|
|
1000
|
-
const io = createIO({
|
|
1001
|
-
platform: platformCloudfare(),
|
|
1002
|
-
context: ({ env, state }) => ({
|
|
1003
|
-
db: new Database(env.DATABASE_URL),
|
|
1004
|
-
// ^ Now accessible
|
|
1005
|
-
|
|
1006
|
-
// Now these must be forwarded to use them
|
|
1007
|
-
env,
|
|
1008
|
-
state,
|
|
1009
|
-
}),
|
|
1010
|
-
});
|
|
1011
|
-
```
|
|
1012
|
-
|
|
1013
|
-
### Patch Changes
|
|
1014
|
-
|
|
1015
|
-
- @pluv/crdt@0.32.0
|
|
1016
|
-
- @pluv/types@0.32.0
|
|
1017
|
-
|
|
1018
|
-
## 0.31.0
|
|
1019
|
-
|
|
1020
|
-
### Minor Changes
|
|
1021
|
-
|
|
1022
|
-
- b3c31d7: **BREAKING**
|
|
1023
|
-
|
|
1024
|
-
Fixed platform context types. This will require additional properties when registering a websocket and creating authorization tokens. See example below:
|
|
1025
|
-
|
|
1026
|
-
```ts
|
|
1027
|
-
// @pluv/platform-node example
|
|
1028
|
-
|
|
1029
|
-
import { platformNode } from "@pluv/platform-node";
|
|
1030
|
-
import { createIO } from "@pluv/io";
|
|
1031
|
-
import type { IncomingMessage } from "node:http";
|
|
1032
|
-
import { z } from "zod";
|
|
1033
|
-
|
|
1034
|
-
const io = createIO({
|
|
1035
|
-
// If using a function authorize parameter, `req` is now available as a param
|
|
1036
|
-
authorize: ({ req }) => ({
|
|
1037
|
-
required: true,
|
|
1038
|
-
secret: "MY-CUSTOM-SECRET",
|
|
1039
|
-
user: z.object({
|
|
1040
|
-
id: z.string(),
|
|
1041
|
-
}),
|
|
1042
|
-
}),
|
|
1043
|
-
platformNode(),
|
|
1044
|
-
});
|
|
1045
|
-
|
|
1046
|
-
// Before
|
|
1047
|
-
io.createToken({
|
|
1048
|
-
room: "my-custom-room",
|
|
1049
|
-
user: { id: "abc123" },
|
|
1050
|
-
});
|
|
1051
|
-
|
|
1052
|
-
// After
|
|
1053
|
-
io.createToken({
|
|
1054
|
-
room: "my-custom-room",
|
|
1055
|
-
user: { id: "abc123" },
|
|
1056
|
-
|
|
1057
|
-
// Previously not required, but now required
|
|
1058
|
-
req: req as IncomingMessage,
|
|
1059
|
-
});
|
|
1060
|
-
```
|
|
1061
|
-
|
|
1062
|
-
```ts
|
|
1063
|
-
// @pluv/platform-cloudflare example
|
|
1064
|
-
|
|
1065
|
-
import { platformCloudflare } from "@pluv/platform-cloudflare";
|
|
1066
|
-
import { createIO } from "@pluv/io";
|
|
1067
|
-
import { z } from "zod";
|
|
1068
|
-
|
|
1069
|
-
const io = createIO({
|
|
1070
|
-
// If using a function authorize parameter, `env` and `request` are now available as params
|
|
1071
|
-
authorize: ({ env, request }) => ({
|
|
1072
|
-
required: true,
|
|
1073
|
-
secret: "MY-CUSTOM-SECRET",
|
|
1074
|
-
user: z.object({
|
|
1075
|
-
id: z.string(),
|
|
1076
|
-
}),
|
|
1077
|
-
}),
|
|
1078
|
-
platformCloudflare(),
|
|
1079
|
-
});
|
|
1080
|
-
|
|
1081
|
-
// Before
|
|
1082
|
-
io.createToken({
|
|
1083
|
-
room: "my-custom-room",
|
|
1084
|
-
user: { id: "abc123" },
|
|
1085
|
-
});
|
|
1086
|
-
|
|
1087
|
-
// After
|
|
1088
|
-
io.createToken({
|
|
1089
|
-
room: "my-custom-room",
|
|
1090
|
-
user: { id: "abc123" },
|
|
1091
|
-
|
|
1092
|
-
// Previously not required, but now required
|
|
1093
|
-
env: env as Env,
|
|
1094
|
-
request: request as Request,
|
|
1095
|
-
});
|
|
1096
|
-
```
|
|
1097
|
-
|
|
1098
|
-
### Patch Changes
|
|
1099
|
-
|
|
1100
|
-
- @pluv/crdt@0.31.0
|
|
1101
|
-
- @pluv/types@0.31.0
|
|
1102
|
-
|
|
1103
|
-
## 0.30.2
|
|
1104
|
-
|
|
1105
|
-
### Patch Changes
|
|
1106
|
-
|
|
1107
|
-
- @pluv/crdt@0.30.2
|
|
1108
|
-
- @pluv/types@0.30.2
|
|
1109
|
-
|
|
1110
|
-
## 0.30.1
|
|
1111
|
-
|
|
1112
|
-
### Patch Changes
|
|
1113
|
-
|
|
1114
|
-
- b9c3633: Export the `authorize` utility from `@pluv/io`.
|
|
1115
|
-
- @pluv/crdt@0.30.1
|
|
1116
|
-
- @pluv/types@0.30.1
|
|
1117
|
-
|
|
1118
|
-
## 0.30.0
|
|
1119
|
-
|
|
1120
|
-
### Patch Changes
|
|
1121
|
-
|
|
1122
|
-
- 7246a9e: Added `CrdtLibraryType` so that `@pluv/crdt-yjs` and `@pluv/crdt-loro` export a new property `kind` containing an identifier for the crdt.
|
|
1123
|
-
- @pluv/crdt@0.30.0
|
|
1124
|
-
- @pluv/types@0.30.0
|
|
1125
|
-
|
|
1126
|
-
## 0.29.0
|
|
1127
|
-
|
|
1128
|
-
### Patch Changes
|
|
1129
|
-
|
|
1130
|
-
- @pluv/crdt@0.29.0
|
|
1131
|
-
- @pluv/types@0.29.0
|
|
1132
|
-
|
|
1133
|
-
## 0.28.0
|
|
1134
|
-
|
|
1135
|
-
### Patch Changes
|
|
1136
|
-
|
|
1137
|
-
- @pluv/crdt@0.28.0
|
|
1138
|
-
- @pluv/types@0.28.0
|
|
1139
|
-
|
|
1140
|
-
## 0.27.0
|
|
1141
|
-
|
|
1142
|
-
### Patch Changes
|
|
1143
|
-
|
|
1144
|
-
- 19ed36c: Fixed custom events not properly registering on IORoom.
|
|
1145
|
-
- e309b0b: Events without a procedure will now automatically be passed-through to connected peers as-if they were broadcast.
|
|
1146
|
-
|
|
1147
|
-
```tsx
|
|
1148
|
-
// backend
|
|
1149
|
-
|
|
1150
|
-
const io = createIO({/* ... */});
|
|
1151
|
-
|
|
1152
|
-
const ioServer = io.server({
|
|
1153
|
-
router: io.router({
|
|
1154
|
-
sendGreeting: io.procedure
|
|
1155
|
-
.input(z.object({ name: z.string() }))
|
|
1156
|
-
.broadcast(({ name }) => ({
|
|
1157
|
-
receiveGreeting: { greeting: `Hi, I'm ${name}!` },
|
|
1158
|
-
})),
|
|
1159
|
-
}),
|
|
1160
|
-
});
|
|
1161
|
-
|
|
1162
|
-
// frontend
|
|
1163
|
-
|
|
1164
|
-
const broadcast = useBroadcast();
|
|
1165
|
-
|
|
1166
|
-
// This will be captured in the server procedure and emit receiveGreeting
|
|
1167
|
-
broadcast.sendGreeting({ name: "leedavidcs" });
|
|
1168
|
-
|
|
1169
|
-
event.receiveGreeting.useEvent(({ data }) => {
|
|
1170
|
-
console.log(data.greeting);
|
|
1171
|
-
});
|
|
1172
|
-
|
|
1173
|
-
// This is not captured by any server procedure and will be broadcast to peers as-is
|
|
1174
|
-
|
|
1175
|
-
broadcast.myCustomUncaughtEvent({ randomData: "Hello world!" });
|
|
1176
|
-
|
|
1177
|
-
// This will be be received by all connections, passed as-is from the server
|
|
1178
|
-
event.myCustomUncaughtEvent.useEvent(({ data }) => {
|
|
1179
|
-
console.log(data.randomData);
|
|
1180
|
-
});
|
|
1181
|
-
```
|
|
1182
|
-
|
|
1183
|
-
- @pluv/crdt@0.27.0
|
|
1184
|
-
- @pluv/types@0.27.0
|
|
1185
|
-
|
|
1186
|
-
## 0.26.0
|
|
1187
|
-
|
|
1188
|
-
### Patch Changes
|
|
1189
|
-
|
|
1190
|
-
- @pluv/crdt@0.26.0
|
|
1191
|
-
- @pluv/types@0.26.0
|
|
1192
|
-
|
|
1193
|
-
## 0.25.4
|
|
1194
|
-
|
|
1195
|
-
### Patch Changes
|
|
1196
|
-
|
|
1197
|
-
- 7a9080c: Fix not passing all properties to the platform initialization.
|
|
1198
|
-
- @pluv/crdt@0.25.4
|
|
1199
|
-
- @pluv/types@0.25.4
|
|
1200
|
-
|
|
1201
|
-
## 0.25.3
|
|
1202
|
-
|
|
1203
|
-
### Patch Changes
|
|
1204
|
-
|
|
1205
|
-
- 50d9b96: Export listener and event types.
|
|
1206
|
-
- @pluv/crdt@0.25.3
|
|
1207
|
-
- @pluv/types@0.25.3
|
|
1208
|
-
|
|
1209
|
-
## 0.25.2
|
|
1210
|
-
|
|
1211
|
-
### Patch Changes
|
|
1212
|
-
|
|
1213
|
-
- 60a0bf1: Update internal accessor.
|
|
1214
|
-
- @pluv/crdt@0.25.2
|
|
1215
|
-
- @pluv/types@0.25.2
|
|
1216
|
-
|
|
1217
|
-
## 0.25.1
|
|
1218
|
-
|
|
1219
|
-
### Patch Changes
|
|
1220
|
-
|
|
1221
|
-
- 3925f7c: Update internal accessor.
|
|
1222
|
-
- @pluv/crdt@0.25.1
|
|
1223
|
-
- @pluv/types@0.25.1
|
|
1224
|
-
|
|
1225
|
-
## 0.25.0
|
|
1226
|
-
|
|
1227
|
-
### Minor Changes
|
|
1228
|
-
|
|
1229
|
-
- 9db06ba: **BREAKING **
|
|
1230
|
-
|
|
1231
|
-
Fixed typos `persistance` to `persistence`.
|
|
1232
|
-
|
|
1233
|
-
This does mean that all properties referencing `persistance` will need to be fixed. Examples below:
|
|
1234
|
-
|
|
1235
|
-
```bash
|
|
1236
|
-
# Re-install @pluv/persistence-redis
|
|
1237
|
-
pnpm uninstall @pluv/persistance-redis
|
|
1238
|
-
pnpm install @pluv/persistence-redis
|
|
1239
|
-
```
|
|
1240
|
-
|
|
1241
|
-
```ts
|
|
1242
|
-
// Before
|
|
1243
|
-
createIO({
|
|
1244
|
-
platform: platformNode({
|
|
1245
|
-
persistance: new PersistanceRedis(/* ... */),
|
|
1246
|
-
}),
|
|
1247
|
-
});
|
|
1248
|
-
|
|
1249
|
-
// After
|
|
1250
|
-
createIO({
|
|
1251
|
-
platform: platformNode({
|
|
1252
|
-
persistence: new PersistenceRedis(/* ... */),
|
|
1253
|
-
}),
|
|
1254
|
-
});
|
|
1255
|
-
```
|
|
1256
|
-
|
|
1257
|
-
`@pluv/persistance-redis` has been deprecated for `@pluv/persistence-redis`.
|
|
1258
|
-
|
|
1259
|
-
### Patch Changes
|
|
1260
|
-
|
|
1261
|
-
- 4e078ca: Fix IORoom onRoomMessage event triggering on message sent instead of on message received.
|
|
1262
|
-
- f556d30: Refactored PluvServer and IORoom properties to consolidate internal properties.
|
|
1263
|
-
- @pluv/crdt@0.25.0
|
|
1264
|
-
- @pluv/types@0.25.0
|
|
1265
|
-
|
|
1266
|
-
## 0.24.1
|
|
1267
|
-
|
|
1268
|
-
### Patch Changes
|
|
1269
|
-
|
|
1270
|
-
- @pluv/crdt@0.24.1
|
|
1271
|
-
- @pluv/types@0.24.1
|
|
1272
|
-
|
|
1273
|
-
## 0.24.0
|
|
1274
|
-
|
|
1275
|
-
### Minor Changes
|
|
1276
|
-
|
|
1277
|
-
- 6ac8a46: \* Fixed errors thrown when using Cloudflare's websocket hibernation API caused by rooms being re-used between different instances of DurableObjects.
|
|
1278
|
-
- Add configurable `onDelete` and `onMessage` event listeners that can be set when rooms are created.
|
|
1279
|
-
|
|
1280
|
-
**BREAKING**
|
|
1281
|
-
- Changed `PluvServer.getRoom` to `PluvServer.createRoom`. This means `PluvServer` only handles room creation. Room management must now be handled manually. This mainly affects manually creating rooms with `@pluv/platform-node`, and will likely not affect you if you are either using `createPluvHandler` on any platform, or if you are using `@pluv/platform-cloudflare`.
|
|
1282
|
-
|
|
1283
|
-
```ts
|
|
1284
|
-
// For @pluv/platform-node
|
|
1285
|
-
|
|
1286
|
-
// Before
|
|
1287
|
-
|
|
1288
|
-
import { createIO } from "@pluv/io";
|
|
1289
|
-
|
|
1290
|
-
const io = createIO(/* ... */);
|
|
1291
|
-
const ioServer = io.server(/* ... */);
|
|
1292
|
-
|
|
1293
|
-
const roomId = "my-room-id";
|
|
1294
|
-
const room = ioServer.getRoom(roomId);
|
|
1295
|
-
|
|
1296
|
-
// After
|
|
1297
|
-
|
|
1298
|
-
import { createIO, type InferIORoom } from "@pluv/io";
|
|
1299
|
-
|
|
1300
|
-
const io = createIO(/* ... */);
|
|
1301
|
-
const ioServer = io.server(/* ... */);
|
|
1302
|
-
|
|
1303
|
-
const rooms = new Map<string, InferIORoom<typeof ioServer>>();
|
|
1304
|
-
|
|
1305
|
-
const roomId = "my-room-id";
|
|
1306
|
-
const room = ioServer.createRoom(roomId, {
|
|
1307
|
-
// Use new onDelete event listener
|
|
1308
|
-
onDelete: (event) => {
|
|
1309
|
-
rooms.delete(event.room);
|
|
1310
|
-
},
|
|
1311
|
-
});
|
|
1312
|
-
|
|
1313
|
-
rooms.set(roomId, room);
|
|
1314
|
-
```
|
|
1315
|
-
|
|
1316
|
-
- c26986d: Fixed websocket messages getting lost after the Cloudflare Worker Durable Object wakes up from hibernation.
|
|
1317
|
-
|
|
1318
|
-
**BREAKING**
|
|
1319
|
-
|
|
1320
|
-
Updated `onMessage`, `onClose` and `onError` to all return `Promise.void` instead of `void`.
|
|
1321
|
-
|
|
1322
|
-
```ts
|
|
1323
|
-
// Before
|
|
1324
|
-
|
|
1325
|
-
const io = createIO(/* ... */);
|
|
1326
|
-
const ioServer = io.server(/* ... */);
|
|
1327
|
-
|
|
1328
|
-
class RoomDurableObject implements DurableObject {
|
|
1329
|
-
public webSocketClose(ws: WebSocket, code: number, reason: string): void {
|
|
1330
|
-
const handler = this._room.onClose(ws);
|
|
1331
|
-
|
|
1332
|
-
// Previously returned `void`
|
|
1333
|
-
handler({ code, reason });
|
|
1334
|
-
}
|
|
1335
|
-
|
|
1336
|
-
public webSocketError(ws: WebSocket, error: unknown): void {
|
|
1337
|
-
const handler = this._room.onError(ws);
|
|
1338
|
-
const eventError = error instanceof Error ? error : new Error("Internal Error");
|
|
1339
|
-
|
|
1340
|
-
// Previously returned `void`
|
|
1341
|
-
handler({ error: eventError, message: eventError.message });
|
|
1342
|
-
}
|
|
1343
|
-
|
|
1344
|
-
public webSocketMessage(ws: WebSocket, message: string | ArrayBuffer): void {
|
|
1345
|
-
const handler = this._room.onMessage(ws);
|
|
1346
|
-
|
|
1347
|
-
// Previously returned `void`
|
|
1348
|
-
handler({ data: message });
|
|
1349
|
-
}
|
|
1350
|
-
}
|
|
1351
|
-
|
|
1352
|
-
// After
|
|
1353
|
-
|
|
1354
|
-
const io = createIO(/* ... */);
|
|
1355
|
-
const ioServer = io.server(/* ... */);
|
|
1356
|
-
|
|
1357
|
-
class RoomDurableObject implements DurableObject {
|
|
1358
|
-
public async webSocketClose(ws: WebSocket, code: number, reason: string): Promise<void> {
|
|
1359
|
-
const handler = this._room.onClose(ws);
|
|
1360
|
-
|
|
1361
|
-
// Handler must now be awaited
|
|
1362
|
-
await handler({ code, reason });
|
|
1363
|
-
}
|
|
1364
|
-
|
|
1365
|
-
public async webSocketError(ws: WebSocket, error: unknown): Promise<void> {
|
|
1366
|
-
const handler = this._room.onError(ws);
|
|
1367
|
-
const eventError = error instanceof Error ? error : new Error("Internal Error");
|
|
1368
|
-
|
|
1369
|
-
// Handler must now be awaited
|
|
1370
|
-
await handler({ error: eventError, message: eventError.message });
|
|
1371
|
-
}
|
|
1372
|
-
|
|
1373
|
-
public async webSocketMessage(ws: WebSocket, message: string | ArrayBuffer): Promise<void> {
|
|
1374
|
-
const handler = this._room.onMessage(ws);
|
|
1375
|
-
|
|
1376
|
-
// Handler must now be awaited
|
|
1377
|
-
await handler({ data: message });
|
|
1378
|
-
}
|
|
1379
|
-
}
|
|
1380
|
-
```
|
|
1381
|
-
|
|
1382
|
-
### Patch Changes
|
|
1383
|
-
|
|
1384
|
-
- @pluv/crdt@0.24.0
|
|
1385
|
-
- @pluv/types@0.24.0
|
|
1386
|
-
|
|
1387
|
-
## 0.23.0
|
|
1388
|
-
|
|
1389
|
-
### Minor Changes
|
|
1390
|
-
|
|
1391
|
-
- c01b16f: **BREAKING**
|
|
1392
|
-
|
|
1393
|
-
Moved `getInitialStorage`, `onRoomDeleted` and `onStorageUpdated` from `createIO` to `PluvIO.server`.
|
|
1394
|
-
|
|
1395
|
-
```ts
|
|
1396
|
-
import { createIO } from "@pluv/io";
|
|
1397
|
-
|
|
1398
|
-
// Before
|
|
1399
|
-
const io = createIO({
|
|
1400
|
-
// ...
|
|
1401
|
-
getInitialStorage: (event) => {
|
|
1402
|
-
// ...
|
|
1403
|
-
},
|
|
1404
|
-
onRoomDeleted: (event) => {
|
|
1405
|
-
// ...
|
|
1406
|
-
},
|
|
1407
|
-
onStorageUpdated: (event) => {
|
|
1408
|
-
// ...
|
|
1409
|
-
},
|
|
1410
|
-
// ...
|
|
1411
|
-
});
|
|
1412
|
-
|
|
1413
|
-
const ioServer = io.server({
|
|
1414
|
-
// ...
|
|
1415
|
-
});
|
|
1416
|
-
|
|
1417
|
-
// After
|
|
1418
|
-
const io = createIO({
|
|
1419
|
-
// ...
|
|
1420
|
-
});
|
|
1421
|
-
|
|
1422
|
-
const ioServer = io.server({
|
|
1423
|
-
// ...
|
|
1424
|
-
getInitialStorage: (event) => {
|
|
1425
|
-
// ...
|
|
1426
|
-
},
|
|
1427
|
-
onRoomDeleted: (event) => {
|
|
1428
|
-
// ...
|
|
1429
|
-
},
|
|
1430
|
-
onStorageUpdated: (event) => {
|
|
1431
|
-
// ...
|
|
1432
|
-
},
|
|
1433
|
-
// ...
|
|
1434
|
-
});
|
|
1435
|
-
```
|
|
1436
|
-
|
|
1437
|
-
Added a new listener `onRoomMessage` to `PluvIO.server` to listen to events that are sent within a room.
|
|
1438
|
-
|
|
1439
|
-
```ts
|
|
1440
|
-
const ioServer = io.server({
|
|
1441
|
-
// ...
|
|
1442
|
-
onRoomMessage: (event) => {
|
|
1443
|
-
console.log(event.message);
|
|
1444
|
-
console.log(event.user);
|
|
1445
|
-
},
|
|
1446
|
-
// ...
|
|
1447
|
-
});
|
|
1448
|
-
```
|
|
1449
|
-
|
|
1450
|
-
### Patch Changes
|
|
1451
|
-
|
|
1452
|
-
- @pluv/crdt@0.23.0
|
|
1453
|
-
- @pluv/types@0.23.0
|
|
1454
|
-
|
|
1455
|
-
## 0.22.0
|
|
1456
|
-
|
|
1457
|
-
### Minor Changes
|
|
1458
|
-
|
|
1459
|
-
- 650e577: \* Fix `@pluv/platform-cloudflare` causing frequent disconnects due to incorrect heartbeat handling.
|
|
1460
|
-
- Updated default `mode` of `@pluv/platform-cloudflare` back to `"detached"` (i.e. use Cloudflare Worker Hibernation API by default).
|
|
1461
|
-
|
|
1462
|
-
### Patch Changes
|
|
1463
|
-
|
|
1464
|
-
- @pluv/crdt@0.22.0
|
|
1465
|
-
- @pluv/types@0.22.0
|
|
1466
|
-
|
|
1467
|
-
## 0.21.1
|
|
1468
|
-
|
|
1469
|
-
### Patch Changes
|
|
1470
|
-
|
|
1471
|
-
- @pluv/crdt@0.21.1
|
|
1472
|
-
- @pluv/types@0.21.1
|
|
1473
|
-
|
|
1474
|
-
## 0.21.0
|
|
1475
|
-
|
|
1476
|
-
### Minor Changes
|
|
1477
|
-
|
|
1478
|
-
- 307bd44: `@pluv/platform-cloudflare` now supports Cloudflare Worker's WebSocket Hibernation API, and usees it by default.
|
|
1479
|
-
|
|
1480
|
-
To switch back to not using the WebSocket Hibernation API, specify a `mode` of `attached`.
|
|
1481
|
-
|
|
1482
|
-
```ts
|
|
1483
|
-
// With event-listeners directly attached to the websocket on registration (i.e. non-hibernation)
|
|
1484
|
-
createIO({
|
|
1485
|
-
platform: platformCloudflare({
|
|
1486
|
-
mode: "attached",
|
|
1487
|
-
}),
|
|
1488
|
-
});
|
|
1489
|
-
|
|
1490
|
-
// With event listeners unattached to the websocket during registration (i.e. hibernation)
|
|
1491
|
-
createIO({
|
|
1492
|
-
platform: platformCloudflare({
|
|
1493
|
-
mode: "detached",
|
|
1494
|
-
}),
|
|
1495
|
-
});
|
|
1496
|
-
```
|
|
1497
|
-
|
|
1498
|
-
- 41b15e4: **BREAKING** - Updated `sessions` type in the procedure context from `Map<string, WebSocketSession>` to `readonly WebSocketSession[]`.
|
|
1499
|
-
- f570c8a: **BREAKING**: The original request object is no longer available in the context of any event resolvers.
|
|
1500
|
-
|
|
1501
|
-
Previously, the request object that was passed into `PluvServer.getRoom` would be made available on the context object of each of the resolvers. This is no-longer a part of the event context, and therefore needs to be omitted from calls to `PluvServer.getRoom`.
|
|
1502
|
-
|
|
1503
|
-
```ts
|
|
1504
|
-
// Before
|
|
1505
|
-
|
|
1506
|
-
// With platform-node
|
|
1507
|
-
ioServer.getRoom(websocket, { req, token });
|
|
1508
|
-
|
|
1509
|
-
// With platform-cloudflare
|
|
1510
|
-
ioServer.getRoom(websocket, { env, req, token });
|
|
1511
|
-
```
|
|
1512
|
-
|
|
1513
|
-
```ts
|
|
1514
|
-
// Now
|
|
1515
|
-
|
|
1516
|
-
// With platform-node
|
|
1517
|
-
ioServer.getRoom(websocket, { req });
|
|
1518
|
-
|
|
1519
|
-
// With platform-cloudflare
|
|
1520
|
-
ioServer.getRoom(websocket, { env, req });
|
|
1521
|
-
```
|
|
1522
|
-
|
|
1523
|
-
- b98ab6b: Internal updates to platforms (i.e. `@pluv/platform-cloudflare` and `@pluv/platform-node`) to be able to support Cloudflare Worker Websocket Hibernation APIs.
|
|
1524
|
-
- 4c2228d: **BREAKING**: Require `DurableObjectState` in `ioServer.getRoom`.
|
|
1525
|
-
|
|
1526
|
-
```ts
|
|
1527
|
-
// Before
|
|
1528
|
-
|
|
1529
|
-
// With platform-cloudflare
|
|
1530
|
-
ioServer.getRoom(websocket, { env, req });
|
|
1531
|
-
```
|
|
1532
|
-
|
|
1533
|
-
```ts
|
|
1534
|
-
// Now
|
|
1535
|
-
|
|
1536
|
-
// With platform-cloudflare
|
|
1537
|
-
ioServer.getRoom(websocket, { env, req, state });
|
|
1538
|
-
```
|
|
1539
|
-
|
|
1540
|
-
### Patch Changes
|
|
1541
|
-
|
|
1542
|
-
- cc2613e: Moved `sessionId` from being derived in `IORoom` to being derived as a getter in `AbstractWebsocket`.
|
|
1543
|
-
- @pluv/crdt@0.21.0
|
|
1544
|
-
- @pluv/types@0.21.0
|
|
1545
|
-
|
|
1546
|
-
## 0.20.0
|
|
1547
|
-
|
|
1548
|
-
### Patch Changes
|
|
1549
|
-
|
|
1550
|
-
- Updated dependencies [9492085]
|
|
1551
|
-
- @pluv/crdt@0.20.0
|
|
1552
|
-
- @pluv/types@0.20.0
|
|
1553
|
-
|
|
1554
|
-
## 0.19.0
|
|
1555
|
-
|
|
1556
|
-
### Patch Changes
|
|
1557
|
-
|
|
1558
|
-
- @pluv/crdt@0.19.0
|
|
1559
|
-
- @pluv/types@0.19.0
|
|
1560
|
-
|
|
1561
|
-
## 0.18.0
|
|
1562
|
-
|
|
1563
|
-
### Minor Changes
|
|
1564
|
-
|
|
1565
|
-
- 428c21c: Added broadcast proxy as a new way to broadcast events to a room.
|
|
1566
|
-
|
|
1567
|
-
```tsx
|
|
1568
|
-
// backend
|
|
1569
|
-
|
|
1570
|
-
const io = createIO({/* ... */});
|
|
1571
|
-
|
|
1572
|
-
const router = io.router({
|
|
1573
|
-
SEND_MESSAGE: io.procedure
|
|
1574
|
-
.input(z.object({ message: z.string() }))
|
|
1575
|
-
.broadcast(({ message }) => ({ RECEIVE_MESSAGE: { message } })),
|
|
1576
|
-
});
|
|
1577
|
-
|
|
1578
|
-
const ioServer = io.server({ router });
|
|
1579
|
-
|
|
1580
|
-
const room = ioServer.getRoom("MY_EXAMPLE_ROOM");
|
|
1581
|
-
|
|
1582
|
-
// Both of the examples below are equivalent.
|
|
1583
|
-
|
|
1584
|
-
room.broadcast("SEND_MESSAGE", { message: "Hello world~!" });
|
|
1585
|
-
|
|
1586
|
-
room.broadcast.SEND_MESSAGE({ message: "Hello world~!" });
|
|
1587
|
-
```
|
|
1588
|
-
|
|
1589
|
-
- 329dbcd: Narrowed types for `user` within the session object of an event resolver.
|
|
1590
|
-
- 99b5ca9: ## Breaking Changes
|
|
1591
|
-
- `@pluv/io` has been updated to introduce `PluvProcedure`, `PluvRouter` and `PluvServer`. This change is intended to improve the ergonomics of declaring events and simplifying inferences of event types.
|
|
1592
|
-
|
|
1593
|
-
### Before:
|
|
1594
|
-
|
|
1595
|
-
```ts
|
|
1596
|
-
// backend/io.ts
|
|
1597
|
-
|
|
1598
|
-
import { createIO } from "@pluv/io";
|
|
1599
|
-
import { createPluvHandler, platformNode } from "@pluv/platform-node";
|
|
1600
|
-
import { z } from "zod";
|
|
1601
|
-
|
|
1602
|
-
export const io = createIO({
|
|
1603
|
-
platform: platformNode(),
|
|
1604
|
-
})
|
|
1605
|
-
.event("SEND_MESSAGE", {
|
|
1606
|
-
input: z.object({ message: z.string() }),
|
|
1607
|
-
resolver: ({ message }) => ({ RECEIVE_MESSAGE: { message } }),
|
|
1608
|
-
})
|
|
1609
|
-
.event("DOUBLE_VALUE", {
|
|
1610
|
-
input: z.object({ value: z.number() }),
|
|
1611
|
-
resolver: ({ value }) => ({ VALUE_DOUBLED: { value: value * 2 } }),
|
|
1612
|
-
});
|
|
1613
|
-
|
|
1614
|
-
const Pluv = createPluvHandler({
|
|
1615
|
-
io,
|
|
1616
|
-
/* ... */
|
|
1617
|
-
});
|
|
1618
|
-
```
|
|
1619
|
-
|
|
1620
|
-
```ts
|
|
1621
|
-
// frontend/pluv.ts
|
|
1622
|
-
|
|
1623
|
-
import { createClient } from "@pluv/react";
|
|
1624
|
-
import type { io } from "../backend/io";
|
|
1625
|
-
|
|
1626
|
-
const client = createClient<typeof io>({/* ... */});
|
|
1627
|
-
```
|
|
1628
|
-
|
|
1629
|
-
### Now:
|
|
1630
|
-
|
|
1631
|
-
```ts
|
|
1632
|
-
import { createIO } from "@pluv/io";
|
|
1633
|
-
import { createPluvHandler, platformNode } from "@pluv/platform-node";
|
|
1634
|
-
import { z } from "zod";
|
|
1635
|
-
|
|
1636
|
-
const io = createIO({
|
|
1637
|
-
platform: platformNode(),
|
|
1638
|
-
});
|
|
1639
|
-
|
|
1640
|
-
const router = io.router({
|
|
1641
|
-
SEND_MESSAGE: io.procedure
|
|
1642
|
-
.input(z.object({ message: z.string() }))
|
|
1643
|
-
.broadcast(({ message }) => ({
|
|
1644
|
-
RECEIVE_MESSAGE: { message },
|
|
1645
|
-
})),
|
|
1646
|
-
DOUBLE_VALUE: io.procedure
|
|
1647
|
-
.input(z.object({ value: z.number() }))
|
|
1648
|
-
.broadcast(({ value }) => ({
|
|
1649
|
-
VALUE_DOUBLED: { value: value * 2 },
|
|
1650
|
-
})),
|
|
1651
|
-
});
|
|
1652
|
-
|
|
1653
|
-
export const ioServer = io.server({ router });
|
|
1654
|
-
|
|
1655
|
-
const Pluv = createPluvHandler({
|
|
1656
|
-
io: ioServer, // <- This uses the PluvServer now
|
|
1657
|
-
/* ... */
|
|
1658
|
-
});
|
|
1659
|
-
```
|
|
1660
|
-
|
|
1661
|
-
```ts
|
|
1662
|
-
// frontend/pluv.ts
|
|
1663
|
-
|
|
1664
|
-
import { createClient } from "@pluv/react";
|
|
1665
|
-
import type { ioServer } from "../backend/io";
|
|
1666
|
-
|
|
1667
|
-
// This users the PluvServer type now
|
|
1668
|
-
const client = createClient<typeof ioServer>({/* ... */});
|
|
1669
|
-
```
|
|
1670
|
-
|
|
1671
|
-
- `PluvRouter` instances can also be merged via the `mergeRouters` method, which effectively performs an `Object.assign` of the events object and returns a new `PluvRouter` with the correct types:
|
|
1672
|
-
|
|
1673
|
-
```ts
|
|
1674
|
-
const router = io.mergeRouters(router1, router2);
|
|
1675
|
-
```
|
|
1676
|
-
|
|
1677
|
-
### Patch Changes
|
|
1678
|
-
|
|
1679
|
-
- Updated dependencies [99b5ca9]
|
|
1680
|
-
- @pluv/types@0.18.0
|
|
1681
|
-
- @pluv/crdt@0.18.0
|
|
1682
|
-
|
|
1683
|
-
## 0.17.3
|
|
1684
|
-
|
|
1685
|
-
### Patch Changes
|
|
1686
|
-
|
|
1687
|
-
- @pluv/crdt@0.17.3
|
|
1688
|
-
- @pluv/types@0.17.3
|
|
1689
|
-
|
|
1690
|
-
## 0.17.2
|
|
1691
|
-
|
|
1692
|
-
### Patch Changes
|
|
1693
|
-
|
|
1694
|
-
- @pluv/crdt@0.17.2
|
|
1695
|
-
- @pluv/types@0.17.2
|
|
1696
|
-
|
|
1697
|
-
## 0.17.1
|
|
1698
|
-
|
|
1699
|
-
### Patch Changes
|
|
1700
|
-
|
|
1701
|
-
- @pluv/crdt@0.17.1
|
|
1702
|
-
- @pluv/types@0.17.1
|
|
1703
|
-
|
|
1704
|
-
## 0.17.0
|
|
1705
|
-
|
|
1706
|
-
### Minor Changes
|
|
1707
|
-
|
|
1708
|
-
- 507bc00: _BREAKING_: The `authorize` config when calling `createIO` can now also be a function that exposes the platform context.
|
|
1709
|
-
This allows accessing the `env` in Cloudflare workers.
|
|
1710
|
-
|
|
1711
|
-
```ts
|
|
1712
|
-
import { createIO } from "@pluv/io";
|
|
1713
|
-
import { platformCloudflare } from "@pluv/platform-cloudflare";
|
|
1714
|
-
import { z } from "zod";
|
|
1715
|
-
|
|
1716
|
-
const io = createIO({
|
|
1717
|
-
authorize: ({ env }) => ({
|
|
1718
|
-
required: true,
|
|
1719
|
-
secret: env.PLUV_AUTHORIZE_SECRET,
|
|
1720
|
-
user: z.object({
|
|
1721
|
-
id: z.string(),
|
|
1722
|
-
name: z.string(),
|
|
1723
|
-
}),
|
|
1724
|
-
}),
|
|
1725
|
-
platform: platformCloudflare<{ PLUV_AUTHORIZE_SECRET: string }>(),
|
|
1726
|
-
// ...
|
|
1727
|
-
});
|
|
1728
|
-
```
|
|
1729
|
-
|
|
1730
|
-
This also requires that the platform contexts are passed to `io.createToken`.
|
|
1731
|
-
|
|
1732
|
-
```ts
|
|
1733
|
-
// If using `platformNode`
|
|
1734
|
-
await io.createToken({
|
|
1735
|
-
req, // This `IncomingMessage` is now required
|
|
1736
|
-
room,
|
|
1737
|
-
user: {
|
|
1738
|
-
id: "user_123",
|
|
1739
|
-
name: "john doe",
|
|
1740
|
-
},
|
|
1741
|
-
});
|
|
1742
|
-
|
|
1743
|
-
// If using `platformCloudflare`
|
|
1744
|
-
await io.createToken({
|
|
1745
|
-
env, // This env is now required from the handler's fetch function
|
|
1746
|
-
room,
|
|
1747
|
-
user: {
|
|
1748
|
-
id: "user_123",
|
|
1749
|
-
name: "john doe",
|
|
1750
|
-
},
|
|
1751
|
-
});
|
|
1752
|
-
```
|
|
1753
|
-
|
|
1754
|
-
### Patch Changes
|
|
1755
|
-
|
|
1756
|
-
- Updated dependencies [507bc00]
|
|
1757
|
-
- @pluv/types@0.17.0
|
|
1758
|
-
- @pluv/crdt@0.17.0
|
|
1759
|
-
|
|
1760
|
-
## 0.16.3
|
|
1761
|
-
|
|
1762
|
-
### Patch Changes
|
|
1763
|
-
|
|
1764
|
-
- 0bf0934: Moved exposed `@pluv/io` version on the `PluvIO` instance as a property.
|
|
1765
|
-
- @pluv/crdt@0.16.3
|
|
1766
|
-
- @pluv/types@0.16.3
|
|
1767
|
-
|
|
1768
|
-
## 0.16.2
|
|
1769
|
-
|
|
1770
|
-
### Patch Changes
|
|
1771
|
-
|
|
1772
|
-
- 06f572d: Export the downloaded version of `@pluv/io`.
|
|
1773
|
-
- @pluv/crdt@0.16.2
|
|
1774
|
-
- @pluv/types@0.16.2
|
|
1775
|
-
|
|
1776
|
-
## 0.16.1
|
|
1777
|
-
|
|
1778
|
-
### Patch Changes
|
|
1779
|
-
|
|
1780
|
-
- cd05d96: Updated outdated README
|
|
1781
|
-
- @pluv/crdt@0.16.1
|
|
1782
|
-
- @pluv/types@0.16.1
|
|
1783
|
-
|
|
1784
|
-
## 0.16.0
|
|
1785
|
-
|
|
1786
|
-
### Minor Changes
|
|
1787
|
-
|
|
1788
|
-
- 4280220: ## Breaking Changes
|
|
1789
|
-
- Storage types are now kept on the root of the document.
|
|
1790
|
-
- Previously, `@pluv/crdt-yjs` kept all shared-types on a hidden Yjs Map called `storage` on the root of the Yjs Doc. Now all shared-types are kept on the root of the Yjs Doc instead. This behavior should be more in-line with how shared-types are documented to be used from Yjs.
|
|
1791
|
-
- `@pluv/client` and `@pluv/react` no-longer re-export `@pluv/crdt-yjs`. This package will now need to be installed separately.
|
|
1792
|
-
|
|
1793
|
-
```bash
|
|
1794
|
-
# if installing @pluv/client
|
|
1795
|
-
npm install @pluv/client @pluv/crdt-yjs
|
|
1796
|
-
# if installing @pluv/react
|
|
1797
|
-
npm install @pluv/react @pluv/crdt-yjs
|
|
1798
|
-
```
|
|
1799
|
-
|
|
1800
|
-
```ts
|
|
1801
|
-
// Before:
|
|
1802
|
-
import { createClient, y } from "@pluv/client";
|
|
1803
|
-
// After:
|
|
1804
|
-
import { createClient } from "@pluv/client";
|
|
1805
|
-
import { yjs } from "@pluv/crdt-yjs"; // y renamed to yjs
|
|
1806
|
-
```
|
|
1807
|
-
|
|
1808
|
-
- The `y` import has been renamed to `yjs`.
|
|
1809
|
-
```ts
|
|
1810
|
-
// Before:
|
|
1811
|
-
import { y } from "@pluv/crdt-yjs";
|
|
1812
|
-
// After:
|
|
1813
|
-
import { yjs } from "@pluv/crdt-yjs";
|
|
1814
|
-
```
|
|
1815
|
-
- `@pluv/crdt-yjs` functions no-longer return Yjs shared-types directly, but instead return an `AbstractCrdtType` from `@pluv/crdt` (new package). This also affects methods that return storage shared types in both `@pluv/client` and `@pluv/react` from functions like `PluvRoom.getStorage` and `PluvRoom.useStorage`.
|
|
1816
|
-
|
|
1817
|
-
```ts
|
|
1818
|
-
// Before:
|
|
1819
|
-
import { y } from "@pluv/crdt-yjs";
|
|
1820
|
-
import type { Array as YArray, Map as YMap } from "yjs";
|
|
1821
|
-
|
|
1822
|
-
const array: YArray<YMap<{ message: string }>> = y.array([y.object({ message: "Hello" })]);
|
|
1823
|
-
|
|
1824
|
-
array.push([y.object({ message: "World!" })]);
|
|
1825
|
-
|
|
1826
|
-
// After:
|
|
1827
|
-
import type { CrdtYjsArray, CrdtYjsObject } from "@pluv/crdt-yjs";
|
|
1828
|
-
import { yjs } from "@pluv/crdt-yjs";
|
|
1829
|
-
import type { Array as YArray } from "yjs";
|
|
1830
|
-
|
|
1831
|
-
const array: CrdtYjsArray<CrdtYjsObject<{ message: string }>> = yjs.array([
|
|
1832
|
-
yjs.object({ message: "Hello" }),
|
|
1833
|
-
]);
|
|
1834
|
-
|
|
1835
|
-
array.push(yjs.object({ message: "World!" }));
|
|
1836
|
-
|
|
1837
|
-
// use .value to get the underlying yjs type
|
|
1838
|
-
const yarray: YArray<YMap<{ message: string }>> = array.value;
|
|
1839
|
-
```
|
|
1840
|
-
|
|
1841
|
-
- `initialStorage` must now use the `doc` function from `@pluv/crdt-yjs` to be defined. This also affects `@pluv/react`.
|
|
1842
|
-
|
|
1843
|
-
```ts
|
|
1844
|
-
// Before:
|
|
1845
|
-
import { createClient, y } from "@pluv/client";
|
|
1846
|
-
|
|
1847
|
-
const client = createClient({/* ... */});
|
|
1848
|
-
|
|
1849
|
-
client.createRoom({
|
|
1850
|
-
// ...
|
|
1851
|
-
initialStorage: () => ({
|
|
1852
|
-
messages: y.array([y.object({ message: "Hello world!" })]),
|
|
1853
|
-
}),
|
|
1854
|
-
});
|
|
1855
|
-
|
|
1856
|
-
// After:
|
|
1857
|
-
import { createClient } from "@pluv/client";
|
|
1858
|
-
// This is now imported separately
|
|
1859
|
-
import { yjs } from "@pluv/crdt-yjs";
|
|
1860
|
-
|
|
1861
|
-
const client = createClient({/* ... */});
|
|
1862
|
-
|
|
1863
|
-
client.createRoom({
|
|
1864
|
-
// ...
|
|
1865
|
-
initialStorage: yjs.doc(() => ({
|
|
1866
|
-
messages: yjs.array([yjs.object({ message: "Hello world!" })]),
|
|
1867
|
-
})),
|
|
1868
|
-
});
|
|
1869
|
-
```
|
|
1870
|
-
|
|
1871
|
-
- `@pluv/client` can now instead use [loro](https://github.com/loro-dev/loro) instead of [yjs](https://github.com/yjs/yjs).
|
|
1872
|
-
```bash
|
|
1873
|
-
npm install @pluv/client @pluv/crdt-loro loro-crdt
|
|
1874
|
-
```
|
|
1875
|
-
- If you are using storage features with pluv, `@pluv/io` must now specify which crdt library (i.e. `@pluv/crdt-yjs` or `@pluv/crdt-loro`) it is meant to use.
|
|
1876
|
-
|
|
1877
|
-
```ts
|
|
1878
|
-
import { loro } from "@pluv/crdt-loro";
|
|
1879
|
-
import { yjs } from "@pluv/crdt-yjs";
|
|
1880
|
-
import { createIO } from "@pluv/io";
|
|
1881
|
-
|
|
1882
|
-
const io = createIO({
|
|
1883
|
-
// ...
|
|
1884
|
-
// If using loro
|
|
1885
|
-
crdt: loro,
|
|
1886
|
-
// If using yjs
|
|
1887
|
-
crdt: yjs,
|
|
1888
|
-
});
|
|
1889
|
-
```
|
|
1890
|
-
|
|
1891
|
-
- `PluvRoom.getDoc()` from `@pluv/client` no-longer returns the Yjs Doc instance, but rather a `AbstractCrdtDoc` instance from `@pluv/crdt`. This also affects the hook from `@pluv/react`.
|
|
1892
|
-
|
|
1893
|
-
```ts
|
|
1894
|
-
// Before:
|
|
1895
|
-
import { Doc as YDoc } from "yjs";
|
|
1896
|
-
|
|
1897
|
-
const room: PluvRoom = client.createRoom({/* ... */});
|
|
1898
|
-
|
|
1899
|
-
const doc: YDoc = room.getDoc();
|
|
1900
|
-
|
|
1901
|
-
// After:
|
|
1902
|
-
import { CrdtYjsDoc } from "@pluv/crdt-yjs";
|
|
1903
|
-
import { Doc as YDoc } from "yjs";
|
|
1904
|
-
|
|
1905
|
-
const room: PluvRoom = client.createRoom({/* ... */});
|
|
1906
|
-
|
|
1907
|
-
const doc: CrdtYjsDoc<any> = room.getDoc();
|
|
1908
|
-
const ydoc: YDoc = doc.value;
|
|
1909
|
-
```
|
|
1910
|
-
|
|
1911
|
-
- `@pluv/client` and `@pluv/react` now may return `null` when retrieving storage while storage is being initialized.
|
|
1912
|
-
|
|
1913
|
-
```ts
|
|
1914
|
-
const sharedType = room.getStorage("messages"); // This may be null
|
|
1915
|
-
|
|
1916
|
-
const [data, sharedType] = useStorage("messages"); // data and sharedType may both be null
|
|
1917
|
-
```
|
|
1918
|
-
|
|
1919
|
-
### Patch Changes
|
|
1920
|
-
|
|
1921
|
-
- @pluv/crdt@0.16.0
|
|
1922
|
-
- @pluv/types@0.16.0
|
|
1923
|
-
|
|
1924
|
-
## 0.15.0
|
|
1925
|
-
|
|
1926
|
-
### Patch Changes
|
|
1927
|
-
|
|
1928
|
-
- @pluv/crdt-yjs@0.15.0
|
|
1929
|
-
- @pluv/types@0.15.0
|
|
1930
|
-
|
|
1931
|
-
## 0.14.1
|
|
1932
|
-
|
|
1933
|
-
### Patch Changes
|
|
1934
|
-
|
|
1935
|
-
- @pluv/crdt-yjs@0.14.1
|
|
1936
|
-
- @pluv/types@0.14.1
|
|
1937
|
-
|
|
1938
|
-
## 0.14.0
|
|
1939
|
-
|
|
1940
|
-
### Patch Changes
|
|
1941
|
-
|
|
1942
|
-
- @pluv/crdt-yjs@0.14.0
|
|
1943
|
-
- @pluv/types@0.14.0
|
|
1944
|
-
|
|
1945
|
-
## 0.13.0
|
|
1946
|
-
|
|
1947
|
-
### Patch Changes
|
|
1948
|
-
|
|
1949
|
-
- @pluv/crdt-yjs@0.13.0
|
|
1950
|
-
- @pluv/types@0.13.0
|
|
1951
|
-
|
|
1952
|
-
## 0.12.3
|
|
1953
|
-
|
|
1954
|
-
### Patch Changes
|
|
1955
|
-
|
|
1956
|
-
- da9f600: Upgraded dependencies
|
|
1957
|
-
- Updated dependencies [da9f600]
|
|
1958
|
-
- @pluv/crdt-yjs@0.12.3
|
|
1959
|
-
- @pluv/types@0.12.3
|
|
1960
|
-
|
|
1961
|
-
## 0.12.2
|
|
1962
|
-
|
|
1963
|
-
### Patch Changes
|
|
1964
|
-
|
|
1965
|
-
- 259a7da: Bumped dependencies
|
|
1966
|
-
|
|
1967
|
-
## 0.12.1
|
|
1968
|
-
|
|
1969
|
-
### Patch Changes
|
|
1970
|
-
|
|
1971
|
-
- @pluv/crdt-yjs@0.12.1
|
|
1972
|
-
- @pluv/types@0.12.1
|
|
1973
|
-
|
|
1974
|
-
## 0.12.0
|
|
1975
|
-
|
|
1976
|
-
### Patch Changes
|
|
1977
|
-
|
|
1978
|
-
- Updated dependencies [436040b]
|
|
1979
|
-
- @pluv/crdt-yjs@0.12.0
|
|
1980
|
-
- @pluv/types@0.12.0
|
|
1981
|
-
|
|
1982
|
-
## 0.11.1
|
|
1983
|
-
|
|
1984
|
-
### Patch Changes
|
|
1985
|
-
|
|
1986
|
-
- 74b3061: Bumped minor and patch dependencies.
|
|
1987
|
-
- Updated dependencies [74b3061]
|
|
1988
|
-
- @pluv/crdt-yjs@0.11.1
|
|
1989
|
-
- @pluv/types@0.11.1
|
|
1990
|
-
|
|
1991
|
-
## 0.11.0
|
|
1992
|
-
|
|
1993
|
-
### Minor Changes
|
|
1994
|
-
|
|
1995
|
-
- b538f5c: Exported class PluvIO from @pluv/io.
|
|
1996
|
-
|
|
1997
|
-
### Patch Changes
|
|
1998
|
-
|
|
1999
|
-
- @pluv/crdt-yjs@0.11.0
|
|
2000
|
-
- @pluv/types@0.11.0
|
|
2001
|
-
|
|
2002
|
-
## 0.10.3
|
|
2003
|
-
|
|
2004
|
-
### Patch Changes
|
|
2005
|
-
|
|
2006
|
-
- a7d3ad1: Exposed context and getInitialProps from @pluv/io.
|
|
2007
|
-
- @pluv/crdt-yjs@0.10.3
|
|
2008
|
-
- @pluv/types@0.10.3
|
|
2009
|
-
|
|
2010
|
-
## 0.10.2
|
|
2011
|
-
|
|
2012
|
-
### Patch Changes
|
|
2013
|
-
|
|
2014
|
-
- 3deee13: Expose type AbstractPlatformConfig from @pluv/io.
|
|
2015
|
-
- @pluv/crdt-yjs@0.10.2
|
|
2016
|
-
- @pluv/types@0.10.2
|
|
2017
|
-
|
|
2018
|
-
## 0.10.1
|
|
2019
|
-
|
|
2020
|
-
### Patch Changes
|
|
2021
|
-
|
|
2022
|
-
- 0eeb67c: Passed through sessionId and userId into platform websockets.
|
|
2023
|
-
- 885835d: remove unnecessary dependency
|
|
2024
|
-
- Updated dependencies [885835d]
|
|
2025
|
-
- @pluv/crdt-yjs@0.10.1
|
|
2026
|
-
- @pluv/types@0.10.1
|
|
2027
|
-
|
|
2028
|
-
## 0.10.0
|
|
2029
|
-
|
|
2030
|
-
### Minor Changes
|
|
2031
|
-
|
|
2032
|
-
- f43f1cc: Change packages to all be versioned together for consistency.
|
|
2033
|
-
|
|
2034
|
-
### Patch Changes
|
|
2035
|
-
|
|
2036
|
-
- Updated dependencies [f43f1cc]
|
|
2037
|
-
- @pluv/crdt-yjs@0.10.0
|
|
2038
|
-
- @pluv/types@0.10.0
|
|
2039
|
-
|
|
2040
|
-
## 0.7.2
|
|
2041
|
-
|
|
2042
|
-
### Patch Changes
|
|
2043
|
-
|
|
2044
|
-
- Updated dependencies [f4317ba]
|
|
2045
|
-
- @pluv/crdt-yjs@0.4.2
|
|
2046
|
-
|
|
2047
|
-
## 0.7.1
|
|
2048
|
-
|
|
2049
|
-
### Patch Changes
|
|
2050
|
-
|
|
2051
|
-
- 8fba48b: fix including incorrect dependency
|
|
2052
|
-
- 8997c65: bumped dependencies
|
|
2053
|
-
- Updated dependencies [8fba48b]
|
|
2054
|
-
- Updated dependencies [8997c65]
|
|
2055
|
-
- @pluv/crdt-yjs@0.4.1
|
|
2056
|
-
- @pluv/types@0.2.2
|
|
2057
|
-
|
|
2058
|
-
## 0.7.0
|
|
2059
|
-
|
|
2060
|
-
### Minor Changes
|
|
2061
|
-
|
|
2062
|
-
- 829d31b: Added support for defining persistant frontend storage for rooms via a new `addons` option on rooms.
|
|
2063
|
-
|
|
2064
|
-
This also introduces the first new addon `@pluv/addon-indexeddb`, which is more-or-less the equivalent to `y-indexeddb` which you can install like so:
|
|
2065
|
-
|
|
2066
|
-
```
|
|
2067
|
-
npm install @pluv/addon-indexeddb
|
|
2068
|
-
```
|
|
2069
|
-
|
|
2070
|
-
To use this new addon, simply pass it to options when creating a room:
|
|
2071
|
-
|
|
2072
|
-
```ts
|
|
2073
|
-
import { addonIndexedDB } from "@pluv/addon-indexeddb";
|
|
2074
|
-
import { createClient } from "@pluv/client";
|
|
2075
|
-
|
|
2076
|
-
const client = createClient({
|
|
2077
|
-
// ...
|
|
2078
|
-
});
|
|
2079
|
-
|
|
2080
|
-
const room = client.createRoom("my-new-room", {
|
|
2081
|
-
addons: [
|
|
2082
|
-
// Define your addons in an array like so
|
|
2083
|
-
addonIndexedDB(),
|
|
2084
|
-
],
|
|
2085
|
-
});
|
|
2086
|
-
```
|
|
2087
|
-
|
|
2088
|
-
Or when using `@pluv/react`:
|
|
2089
|
-
|
|
2090
|
-
```ts
|
|
2091
|
-
const PluvRoom = createRoomBundle({
|
|
2092
|
-
// ...
|
|
2093
|
-
addons: [
|
|
2094
|
-
// Define your addons in an array like so
|
|
2095
|
-
addonIndexedDB(),
|
|
2096
|
-
],
|
|
2097
|
-
});
|
|
2098
|
-
```
|
|
2099
|
-
|
|
2100
|
-
### Patch Changes
|
|
2101
|
-
|
|
2102
|
-
- 8d11672: bumped dependencies to latest
|
|
2103
|
-
- Updated dependencies [8d11672]
|
|
2104
|
-
- Updated dependencies [829d31b]
|
|
2105
|
-
- @pluv/crdt-yjs@0.4.0
|
|
2106
|
-
- @pluv/types@0.2.1
|
|
2107
|
-
|
|
2108
|
-
## 0.6.0
|
|
2109
|
-
|
|
2110
|
-
### Minor Changes
|
|
2111
|
-
|
|
2112
|
-
- 2e7cbfa: Updated createIO config option `initialStorage` to be renamed to `getInitialStorage` and updated the params to use an object that includes platform parameters.
|
|
2113
|
-
|
|
2114
|
-
Previously:
|
|
2115
|
-
|
|
2116
|
-
```ts
|
|
2117
|
-
createIO({
|
|
2118
|
-
initialStorage(room: string): Promise<string> => {
|
|
2119
|
-
// ...
|
|
2120
|
-
},
|
|
2121
|
-
});
|
|
2122
|
-
```
|
|
2123
|
-
|
|
2124
|
-
Now:
|
|
2125
|
-
|
|
2126
|
-
```ts
|
|
2127
|
-
createIO({
|
|
2128
|
-
platform: platformCloudflare<Env>(),
|
|
2129
|
-
getInitialStorage({
|
|
2130
|
-
// If you're using Cloudflare, this is the Cloudflare env parameter
|
|
2131
|
-
env,
|
|
2132
|
-
// The name of the room
|
|
2133
|
-
room,
|
|
2134
|
-
}): Promise<string> => {
|
|
2135
|
-
// ...
|
|
2136
|
-
},
|
|
2137
|
-
});
|
|
2138
|
-
```
|
|
2139
|
-
|
|
2140
|
-
## 0.5.0
|
|
2141
|
-
|
|
2142
|
-
### Minor Changes
|
|
2143
|
-
|
|
2144
|
-
- ae4e1f1: added platform-specific contexts to expose env in cloudflare and req in node.js
|
|
2145
|
-
|
|
2146
|
-
## 0.4.2
|
|
2147
|
-
|
|
2148
|
-
### Patch Changes
|
|
2149
|
-
|
|
2150
|
-
- 8917309: fixed PluvIO listeners onRoomDeleted and onStorageUpdated not working when additional events were added
|
|
2151
|
-
|
|
2152
|
-
## 0.4.1
|
|
2153
|
-
|
|
2154
|
-
### Patch Changes
|
|
2155
|
-
|
|
2156
|
-
- b85a232: bumped dependencies
|
|
2157
|
-
- Updated dependencies [b85a232]
|
|
2158
|
-
- @pluv/crdt-yjs@0.3.8
|
|
2159
|
-
- @pluv/types@0.2.0
|
|
2160
|
-
|
|
2161
|
-
## 0.4.0
|
|
2162
|
-
|
|
2163
|
-
### Minor Changes
|
|
2164
|
-
|
|
2165
|
-
- bb2886b: allow sending multiple output types (broadcast, self, sync) per event
|
|
2166
|
-
- ae679a8: updated offline presence to be set when reconnecting to a room
|
|
2167
|
-
|
|
2168
|
-
### Patch Changes
|
|
2169
|
-
|
|
2170
|
-
- 41943cf: bumped dependencies
|
|
2171
|
-
- 0dd847e: updated storage to be synced when reconnected to the room
|
|
2172
|
-
- 3518a83: bumped dependencies
|
|
2173
|
-
- Updated dependencies [0dd847e]
|
|
2174
|
-
- Updated dependencies [bb2886b]
|
|
2175
|
-
- Updated dependencies [ae679a8]
|
|
2176
|
-
- Updated dependencies [3518a83]
|
|
2177
|
-
- @pluv/crdt-yjs@0.3.7
|
|
2178
|
-
- @pluv/types@0.2.0
|
|
2179
|
-
|
|
2180
|
-
## 0.3.9
|
|
2181
|
-
|
|
2182
|
-
### Patch Changes
|
|
2183
|
-
|
|
2184
|
-
- abb3622: fixed @pluv/io yjs doc becoming unresponsive when the last user leaves on a cloudflare worker
|
|
2185
|
-
|
|
2186
|
-
## 0.3.8
|
|
2187
|
-
|
|
2188
|
-
### Patch Changes
|
|
2189
|
-
|
|
2190
|
-
- bcf1c3e: purge empty rooms before joining a new room
|
|
2191
|
-
|
|
2192
|
-
## 0.3.7
|
|
2193
|
-
|
|
2194
|
-
### Patch Changes
|
|
2195
|
-
|
|
2196
|
-
- ecc4040: added ability to set debug when room is created
|
|
2197
|
-
|
|
2198
|
-
## 0.3.6
|
|
2199
|
-
|
|
2200
|
-
### Patch Changes
|
|
2201
|
-
|
|
2202
|
-
- a7e2980: deleted links to docs that were removed
|
|
2203
|
-
|
|
2204
|
-
## 0.3.5
|
|
2205
|
-
|
|
2206
|
-
### Patch Changes
|
|
2207
|
-
|
|
2208
|
-
- 78fd644: updated readmes with links to the documentation website
|
|
2209
|
-
- Updated dependencies [78fd644]
|
|
2210
|
-
- @pluv/crdt-yjs@0.3.6
|
|
2211
|
-
|
|
2212
|
-
## 0.3.4
|
|
2213
|
-
|
|
2214
|
-
### Patch Changes
|
|
2215
|
-
|
|
2216
|
-
- 850626e: bumped dependencies
|
|
2217
|
-
- Updated dependencies [850626e]
|
|
2218
|
-
- @pluv/crdt-yjs@0.3.5
|
|
2219
|
-
- @pluv/types@0.1.6
|
|
2220
|
-
|
|
2221
|
-
## 0.3.3
|
|
2222
|
-
|
|
2223
|
-
### Patch Changes
|
|
2224
|
-
|
|
2225
|
-
- 77069a1: replaced chalk for kleur
|
|
2226
|
-
- @pluv/crdt-yjs@0.3.4
|
|
2227
|
-
- @pluv/types@0.1.5
|
|
2228
|
-
|
|
2229
|
-
## 0.3.2
|
|
2230
|
-
|
|
2231
|
-
### Patch Changes
|
|
2232
|
-
|
|
2233
|
-
- 9ae251d: bumped dependencies
|
|
2234
|
-
- Updated dependencies [9ae251d]
|
|
2235
|
-
- @pluv/crdt-yjs@0.3.4
|
|
2236
|
-
|
|
2237
|
-
## 0.3.1
|
|
2238
|
-
|
|
2239
|
-
### Patch Changes
|
|
2240
|
-
|
|
2241
|
-
- 74870ee: bumped dependencies
|
|
2242
|
-
- Updated dependencies [74870ee]
|
|
2243
|
-
- @pluv/crdt-yjs@0.3.3
|
|
2244
|
-
- @pluv/types@0.1.5
|
|
2245
|
-
|
|
2246
|
-
## 0.3.0
|
|
2247
|
-
|
|
2248
|
-
### Minor Changes
|
|
2249
|
-
|
|
2250
|
-
- c5567f1: renamed IORoom.room to IORoom.id
|
|
2251
|
-
- c5567f1: updated IORoom.broadcast to have the same function signature as PluvRoom.broadcast
|
|
2252
|
-
|
|
2253
|
-
### Patch Changes
|
|
2254
|
-
|
|
2255
|
-
- @pluv/crdt-yjs@0.3.2
|
|
2256
|
-
- @pluv/types@0.1.4
|
|
2257
|
-
|
|
2258
|
-
## 0.2.6
|
|
2259
|
-
|
|
2260
|
-
### Patch Changes
|
|
2261
|
-
|
|
2262
|
-
- 9516a4e: updated typescript to 5.0
|
|
2263
|
-
- 7b6da1c: bumped dependencies
|
|
2264
|
-
- e9c1514: bumped dependencies
|
|
2265
|
-
- 9d1829c: chore: bumped dependencies
|
|
2266
|
-
- Updated dependencies [9516a4e]
|
|
2267
|
-
- Updated dependencies [7b6da1c]
|
|
2268
|
-
- Updated dependencies [e9c1514]
|
|
2269
|
-
- Updated dependencies [9d1829c]
|
|
2270
|
-
- @pluv/crdt-yjs@0.3.2
|
|
2271
|
-
- @pluv/types@0.1.4
|
|
2272
|
-
|
|
2273
|
-
## 0.2.5
|
|
2274
|
-
|
|
2275
|
-
### Patch Changes
|
|
2276
|
-
|
|
2277
|
-
- 161e00e: fixed links to other pluv packages in readmes
|
|
2278
|
-
- f6c0e65: bumped dependencies
|
|
2279
|
-
- Updated dependencies [161e00e]
|
|
2280
|
-
- Updated dependencies [f6c0e65]
|
|
2281
|
-
- @pluv/crdt-yjs@0.3.1
|
|
2282
|
-
- @pluv/types@0.1.3
|
|
2283
|
-
|
|
2284
|
-
## 0.2.4
|
|
2285
|
-
|
|
2286
|
-
### Patch Changes
|
|
2287
|
-
|
|
2288
|
-
- 8bf62cb: bumped dependencies
|
|
2289
|
-
- 7e52685: Bumped dependencies
|
|
2290
|
-
- 3b7b17a: docs: corrected readme typos
|
|
2291
|
-
- b1cb325: Updated dependencies
|
|
2292
|
-
- 8e97fb2: Updated dependencies
|
|
2293
|
-
- Updated dependencies [8bf62cb]
|
|
2294
|
-
- Updated dependencies [7e52685]
|
|
2295
|
-
- Updated dependencies [b1cb325]
|
|
2296
|
-
- Updated dependencies [327a6ef]
|
|
2297
|
-
- Updated dependencies [8e97fb2]
|
|
2298
|
-
- @pluv/crdt-yjs@0.3.0
|
|
2299
|
-
- @pluv/types@0.1.3
|
|
2300
|
-
|
|
2301
|
-
## 0.2.3
|
|
2302
|
-
|
|
2303
|
-
### Patch Changes
|
|
2304
|
-
|
|
2305
|
-
- 95b5ef8: breaking: update PluvRoom.broadcast api
|
|
2306
|
-
- e23fbbe: update demo gif in README
|
|
2307
|
-
- Updated dependencies [6858682]
|
|
2308
|
-
- @pluv/crdt-yjs@0.2.0
|
|
2309
|
-
- @pluv/types@0.1.2
|
|
2310
|
-
|
|
2311
|
-
## 0.2.2
|
|
2312
|
-
|
|
2313
|
-
### Patch Changes
|
|
2314
|
-
|
|
2315
|
-
- fe80d7b: added preview disclaimer about breaking changes in the readme
|
|
2316
|
-
- Updated dependencies [fe80d7b]
|
|
2317
|
-
- @pluv/crdt-yjs@0.1.3
|
|
2318
|
-
- @pluv/types@0.1.2
|
|
2319
|
-
|
|
2320
|
-
## 0.2.1
|
|
2321
|
-
|
|
2322
|
-
### Patch Changes
|
|
2323
|
-
|
|
2324
|
-
- b45d642: Fixed links on README
|
|
2325
|
-
- 203dfee: Updated README
|
|
2326
|
-
- Updated dependencies [b45d642]
|
|
2327
|
-
- @pluv/crdt-yjs@0.1.2
|
|
2328
|
-
|
|
2329
|
-
## 0.2.0
|
|
2330
|
-
|
|
2331
|
-
### Minor Changes
|
|
2332
|
-
|
|
2333
|
-
- 23a7382: Added `initialStorage` param to `createIO` to set initialStorage state of room.
|
|
2334
|
-
- 39271d4: Added support for IORoom listeners to get current storage state.
|
|
2335
|
-
|
|
2336
|
-
### Patch Changes
|
|
2337
|
-
|
|
2338
|
-
- 24016e6: Updated dependencies
|
|
2339
|
-
- Updated dependencies [24016e6]
|
|
2340
|
-
- @pluv/crdt-yjs@0.1.1
|
|
2341
|
-
- @pluv/types@0.1.1
|
|
2342
|
-
|
|
2343
|
-
## 0.1.0
|
|
2344
|
-
|
|
2345
|
-
### Minor Changes
|
|
2346
|
-
|
|
2347
|
-
- a22f525: Added documentation
|
|
2348
|
-
|
|
2349
|
-
### Patch Changes
|
|
2350
|
-
|
|
2351
|
-
- Updated dependencies [a22f525]
|
|
2352
|
-
- @pluv/crdt-yjs@0.1.0
|
|
2353
|
-
- @pluv/types@0.1.0
|