@pluv/platform-cloudflare 2.2.1 → 2.2.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/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @pluv/platform-cloudflare
2
2
 
3
+ ## 2.2.2
4
+
5
+ ### Patch Changes
6
+
7
+ - @pluv/io@2.2.2
8
+ - @pluv/persistence-cloudflare-transactional-storage@2.2.2
9
+ - @pluv/types@2.2.2
10
+
3
11
  ## 2.2.1
4
12
 
5
13
  ### Patch Changes
@@ -14,9 +22,9 @@
14
22
 
15
23
  - cb660cd: Fixed multiple Cloudflare Worker Durable Objects sharing references to the same I/O methods.
16
24
  - Updated dependencies [cb660cd]
17
- - @pluv/io@2.2.0
18
- - @pluv/persistence-cloudflare-transactional-storage@2.2.0
19
- - @pluv/types@2.2.0
25
+ - @pluv/io@2.2.0
26
+ - @pluv/persistence-cloudflare-transactional-storage@2.2.0
27
+ - @pluv/types@2.2.0
20
28
 
21
29
  ## 2.1.0
22
30
 
@@ -47,9 +55,9 @@
47
55
  ### Patch Changes
48
56
 
49
57
  - Updated dependencies [047a1d8]
50
- - @pluv/types@2.0.0
51
- - @pluv/io@2.0.0
52
- - @pluv/persistence-cloudflare-transactional-storage@2.0.0
58
+ - @pluv/types@2.0.0
59
+ - @pluv/io@2.0.0
60
+ - @pluv/persistence-cloudflare-transactional-storage@2.0.0
53
61
 
54
62
  ## 1.0.2
55
63
 
@@ -64,9 +72,9 @@
64
72
  ### Patch Changes
65
73
 
66
74
  - Updated dependencies [c583be9]
67
- - @pluv/io@1.0.1
68
- - @pluv/persistence-cloudflare-transactional-storage@1.0.1
69
- - @pluv/types@1.0.1
75
+ - @pluv/io@1.0.1
76
+ - @pluv/persistence-cloudflare-transactional-storage@1.0.1
77
+ - @pluv/types@1.0.1
70
78
 
71
79
  ## 1.0.0
72
80
 
@@ -74,16 +82,16 @@
74
82
 
75
83
  - af94706: pluv.io is now stable and production ready!
76
84
 
77
- 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.
85
+ 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.
78
86
 
79
- Checkout the [full documentation here](https://pluv.io/docs/introduction) to get started today!
87
+ Checkout the [full documentation here](https://pluv.io/docs/introduction) to get started today!
80
88
 
81
89
  ### Patch Changes
82
90
 
83
91
  - Updated dependencies [af94706]
84
- - @pluv/io@1.0.0
85
- - @pluv/persistence-cloudflare-transactional-storage@1.0.0
86
- - @pluv/types@1.0.0
92
+ - @pluv/io@1.0.0
93
+ - @pluv/persistence-cloudflare-transactional-storage@1.0.0
94
+ - @pluv/types@1.0.0
87
95
 
88
96
  ## 0.44.2
89
97
 
@@ -118,9 +126,9 @@
118
126
  - Updated dependencies [0063e80]
119
127
  - Updated dependencies [244a973]
120
128
  - Updated dependencies [4b0fbb3]
121
- - @pluv/io@0.43.0
122
- - @pluv/persistence-cloudflare-transactional-storage@0.43.0
123
- - @pluv/types@0.43.0
129
+ - @pluv/io@0.43.0
130
+ - @pluv/persistence-cloudflare-transactional-storage@0.43.0
131
+ - @pluv/types@0.43.0
124
132
 
125
133
  ## 0.42.0
126
134
 
@@ -128,15 +136,15 @@
128
136
 
129
137
  - 5c2c71d: **BREAKING** Updated the `PersistenceCloudflareTransactionalStorage` constructor so require a new property `mode` (either `kv` or `sqlite`). `sqlite` makes use of `DurableObject` SQLite storage, and `kv` makes use of their key-value storage. `platformCloudflare` now sets the underlying `PersistenceCloudflareTransactionalStorage` to use the `sqlite` mode by default (was previously using `kv`). For more information on the differences, please refer to [Cloudflare's documentation](https://developers.cloudflare.com/durable-objects/api/storage-api/#sql-api).
130
138
 
131
- To continue using the `kv` mode, you will need to install `@pluv/persistence-cloudflare-transactional-storage` and provide it manually to `platformCloudflare` with your desired mode.
139
+ To continue using the `kv` mode, you will need to install `@pluv/persistence-cloudflare-transactional-storage` and provide it manually to `platformCloudflare` with your desired mode.
132
140
 
133
- ```ts
134
- platformCloudflare({
135
- // ...
136
- persistence: new PersistenceCloudflareTransactionalStorage({ mode: "kv" }),
137
- // ...
138
- });
139
- ```
141
+ ```ts
142
+ platformCloudflare({
143
+ // ...
144
+ persistence: new PersistenceCloudflareTransactionalStorage({ mode: "kv" }),
145
+ // ...
146
+ });
147
+ ```
140
148
 
141
149
  ### Patch Changes
142
150
 
@@ -144,9 +152,9 @@
144
152
  - Updated dependencies [5c2c71d]
145
153
  - Updated dependencies [4ce32ee]
146
154
  - Updated dependencies [cf1529a]
147
- - @pluv/persistence-cloudflare-transactional-storage@0.42.0
148
- - @pluv/io@0.42.0
149
- - @pluv/types@0.42.0
155
+ - @pluv/persistence-cloudflare-transactional-storage@0.42.0
156
+ - @pluv/io@0.42.0
157
+ - @pluv/types@0.42.0
150
158
 
151
159
  ## 0.41.7
152
160
 
@@ -185,9 +193,9 @@
185
193
  ### Patch Changes
186
194
 
187
195
  - Updated dependencies [49051c0]
188
- - @pluv/io@0.41.3
189
- - @pluv/persistence-cloudflare-transactional-storage@0.41.3
190
- - @pluv/types@0.41.3
196
+ - @pluv/io@0.41.3
197
+ - @pluv/persistence-cloudflare-transactional-storage@0.41.3
198
+ - @pluv/types@0.41.3
191
199
 
192
200
  ## 0.41.2
193
201
 
@@ -202,9 +210,9 @@
202
210
  ### Patch Changes
203
211
 
204
212
  - 9e61e10: Fix inferred context type.
205
- - @pluv/io@0.41.1
206
- - @pluv/persistence-cloudflare-transactional-storage@0.41.1
207
- - @pluv/types@0.41.1
213
+ - @pluv/io@0.41.1
214
+ - @pluv/persistence-cloudflare-transactional-storage@0.41.1
215
+ - @pluv/types@0.41.1
208
216
 
209
217
  ## 0.41.0
210
218
 
@@ -218,9 +226,9 @@
218
226
  - Updated dependencies [555b88d]
219
227
  - Updated dependencies [a663c65]
220
228
  - Updated dependencies [555b88d]
221
- - @pluv/io@0.41.0
222
- - @pluv/persistence-cloudflare-transactional-storage@0.41.0
223
- - @pluv/types@0.41.0
229
+ - @pluv/io@0.41.0
230
+ - @pluv/persistence-cloudflare-transactional-storage@0.41.0
231
+ - @pluv/types@0.41.0
224
232
 
225
233
  ## 0.40.2
226
234
 
@@ -235,9 +243,9 @@
235
243
  ### Patch Changes
236
244
 
237
245
  - 99019a3: Fix return type to return the correct DurableObject type from `createPluvHandler`.
238
- - @pluv/io@0.40.1
239
- - @pluv/persistence-cloudflare-transactional-storage@0.40.1
240
- - @pluv/types@0.40.1
246
+ - @pluv/io@0.40.1
247
+ - @pluv/persistence-cloudflare-transactional-storage@0.40.1
248
+ - @pluv/types@0.40.1
241
249
 
242
250
  ## 0.40.0
243
251
 
@@ -266,9 +274,9 @@
266
274
  - 78a9c85: Update error codes for invalid websocket connection data to return a 1003 status code instead of 1011.
267
275
  - Updated dependencies [fe6e239]
268
276
  - Updated dependencies [737d508]
269
- - @pluv/io@0.39.0
270
- - @pluv/persistence-cloudflare-transactional-storage@0.39.0
271
- - @pluv/types@0.39.0
277
+ - @pluv/io@0.39.0
278
+ - @pluv/persistence-cloudflare-transactional-storage@0.39.0
279
+ - @pluv/types@0.39.0
272
280
 
273
281
  ## 0.38.14
274
282
 
@@ -283,9 +291,9 @@
283
291
  ### Patch Changes
284
292
 
285
293
  - Updated dependencies [809afd3]
286
- - @pluv/io@0.38.13
287
- - @pluv/persistence-cloudflare-transactional-storage@0.38.13
288
- - @pluv/types@0.38.13
294
+ - @pluv/io@0.38.13
295
+ - @pluv/persistence-cloudflare-transactional-storage@0.38.13
296
+ - @pluv/types@0.38.13
289
297
 
290
298
  ## 0.38.12
291
299
 
@@ -364,36 +372,36 @@
364
372
  ### Patch Changes
365
373
 
366
374
  - Updated dependencies [8346273]
367
- - @pluv/io@0.38.3
368
- - @pluv/persistence-cloudflare-transactional-storage@0.38.3
369
- - @pluv/types@0.38.3
375
+ - @pluv/io@0.38.3
376
+ - @pluv/persistence-cloudflare-transactional-storage@0.38.3
377
+ - @pluv/types@0.38.3
370
378
 
371
379
  ## 0.38.2
372
380
 
373
381
  ### Patch Changes
374
382
 
375
383
  - Updated dependencies [039cd64]
376
- - @pluv/io@0.38.2
377
- - @pluv/persistence-cloudflare-transactional-storage@0.38.2
378
- - @pluv/types@0.38.2
384
+ - @pluv/io@0.38.2
385
+ - @pluv/persistence-cloudflare-transactional-storage@0.38.2
386
+ - @pluv/types@0.38.2
379
387
 
380
388
  ## 0.38.1
381
389
 
382
390
  ### Patch Changes
383
391
 
384
392
  - 702fbd2: Fix sending and receiving the wrong heartbeat websocket events for Cloudflare websocket hibernation.
385
- - @pluv/io@0.38.1
386
- - @pluv/persistence-cloudflare-transactional-storage@0.38.1
387
- - @pluv/types@0.38.1
393
+ - @pluv/io@0.38.1
394
+ - @pluv/persistence-cloudflare-transactional-storage@0.38.1
395
+ - @pluv/types@0.38.1
388
396
 
389
397
  ## 0.38.0
390
398
 
391
399
  ### Patch Changes
392
400
 
393
401
  - Updated dependencies [f4ceca3]
394
- - @pluv/types@0.38.0
395
- - @pluv/io@0.38.0
396
- - @pluv/persistence-cloudflare-transactional-storage@0.38.0
402
+ - @pluv/types@0.38.0
403
+ - @pluv/io@0.38.0
404
+ - @pluv/persistence-cloudflare-transactional-storage@0.38.0
397
405
 
398
406
  ## 0.37.7
399
407
 
@@ -408,9 +416,9 @@
408
416
  ### Patch Changes
409
417
 
410
418
  - Updated dependencies [3a874f1]
411
- - @pluv/io@0.37.6
412
- - @pluv/persistence-cloudflare-transactional-storage@0.37.6
413
- - @pluv/types@0.37.6
419
+ - @pluv/io@0.37.6
420
+ - @pluv/persistence-cloudflare-transactional-storage@0.37.6
421
+ - @pluv/types@0.37.6
414
422
 
415
423
  ## 0.37.5
416
424
 
@@ -418,9 +426,9 @@
418
426
 
419
427
  - 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.
420
428
  - Updated dependencies [9a9ecee]
421
- - @pluv/io@0.37.5
422
- - @pluv/persistence-cloudflare-transactional-storage@0.37.5
423
- - @pluv/types@0.37.5
429
+ - @pluv/io@0.37.5
430
+ - @pluv/persistence-cloudflare-transactional-storage@0.37.5
431
+ - @pluv/types@0.37.5
424
432
 
425
433
  ## 0.37.4
426
434
 
@@ -460,60 +468,60 @@
460
468
 
461
469
  - 5165be0: **BREAKING**
462
470
 
463
- Updated the `platformCloudflare` function to return an entire `createIO` input object. Now `createIO` must be called with `platformCloudflare`'s return value as an input.
464
-
465
- ```ts
466
- // Before
467
-
468
- import { createIO } from "@pluv/io";
469
- import { platformCloudflare } from "@pluv/platform-cloudflare";
470
-
471
- export const io = createIO({
472
- authorize: {
473
- // ...
474
- },
475
- context: {
476
- // ...
477
- },
478
- platform: platformCloudflare<Env, Meta>({
479
- // ...
480
- }),
481
- // ...
482
- });
483
-
484
- // After
485
-
486
- import { createIO } from "@pluv/io";
487
- import { infer, platformCloudflare } from "@pluv/platform-cloudflare";
488
-
489
- // Types must now be inferred like so, due to TypeScript limitations around partial inferences
490
- // Note that this types variable is defined outside of the `createIO` function
491
- const types = infer((i) => ({
492
- env: i<Env>,
493
- meta: i<Meta>,
494
- }));
495
- export const io = createIO(
496
- platformCloudflare({
497
- authorize: {
498
- // ...
499
- },
500
- context: {
471
+ Updated the `platformCloudflare` function to return an entire `createIO` input object. Now `createIO` must be called with `platformCloudflare`'s return value as an input.
472
+
473
+ ```ts
474
+ // Before
475
+
476
+ import { createIO } from "@pluv/io";
477
+ import { platformCloudflare } from "@pluv/platform-cloudflare";
478
+
479
+ export const io = createIO({
480
+ authorize: {
481
+ // ...
482
+ },
483
+ context: {
484
+ // ...
485
+ },
486
+ platform: platformCloudflare<Env, Meta>({
487
+ // ...
488
+ }),
501
489
  // ...
502
- },
503
- // Optional: Pass inferred types here
504
- types,
505
- // ...
506
- }),
507
- );
508
- ```
490
+ });
491
+
492
+ // After
493
+
494
+ import { createIO } from "@pluv/io";
495
+ import { infer, platformCloudflare } from "@pluv/platform-cloudflare";
496
+
497
+ // Types must now be inferred like so, due to TypeScript limitations around partial inferences
498
+ // Note that this types variable is defined outside of the `createIO` function
499
+ const types = infer((i) => ({
500
+ env: i<Env>,
501
+ meta: i<Meta>,
502
+ }));
503
+ export const io = createIO(
504
+ platformCloudflare({
505
+ authorize: {
506
+ // ...
507
+ },
508
+ context: {
509
+ // ...
510
+ },
511
+ // Optional: Pass inferred types here
512
+ types,
513
+ // ...
514
+ }),
515
+ );
516
+ ```
509
517
 
510
518
  ### Patch Changes
511
519
 
512
520
  - 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).
513
521
  - Updated dependencies [9b74abb]
514
- - @pluv/io@0.37.0
515
- - @pluv/persistence-cloudflare-transactional-storage@0.37.0
516
- - @pluv/types@0.37.0
522
+ - @pluv/io@0.37.0
523
+ - @pluv/persistence-cloudflare-transactional-storage@0.37.0
524
+ - @pluv/types@0.37.0
517
525
 
518
526
  ## 0.36.0
519
527
 
@@ -529,9 +537,9 @@
529
537
 
530
538
  - 5d3a56f: Fix error emitted about `platformCloudflare` not supporting `fetch` when deployed to Cloudflare Workers.
531
539
  - Updated dependencies [5d3a56f]
532
- - @pluv/io@0.35.4
533
- - @pluv/persistence-cloudflare-transactional-storage@0.35.4
534
- - @pluv/types@0.35.4
540
+ - @pluv/io@0.35.4
541
+ - @pluv/persistence-cloudflare-transactional-storage@0.35.4
542
+ - @pluv/types@0.35.4
535
543
 
536
544
  ## 0.35.3
537
545
 
@@ -546,9 +554,9 @@
546
554
  ### Patch Changes
547
555
 
548
556
  - Updated dependencies [81cb692]
549
- - @pluv/types@0.35.2
550
- - @pluv/io@0.35.2
551
- - @pluv/persistence-cloudflare-transactional-storage@0.35.2
557
+ - @pluv/types@0.35.2
558
+ - @pluv/io@0.35.2
559
+ - @pluv/persistence-cloudflare-transactional-storage@0.35.2
552
560
 
553
561
  ## 0.35.1
554
562
 
@@ -563,18 +571,18 @@
563
571
  ### Patch Changes
564
572
 
565
573
  - Updated dependencies [c9073ad]
566
- - @pluv/io@0.35.0
567
- - @pluv/persistence-cloudflare-transactional-storage@0.35.0
568
- - @pluv/types@0.35.0
574
+ - @pluv/io@0.35.0
575
+ - @pluv/persistence-cloudflare-transactional-storage@0.35.0
576
+ - @pluv/types@0.35.0
569
577
 
570
578
  ## 0.34.1
571
579
 
572
580
  ### Patch Changes
573
581
 
574
582
  - Updated dependencies [d639427]
575
- - @pluv/io@0.34.1
576
- - @pluv/persistence-cloudflare-transactional-storage@0.34.1
577
- - @pluv/types@0.34.1
583
+ - @pluv/io@0.34.1
584
+ - @pluv/persistence-cloudflare-transactional-storage@0.34.1
585
+ - @pluv/types@0.34.1
578
586
 
579
587
  ## 0.34.0
580
588
 
@@ -586,9 +594,9 @@
586
594
 
587
595
  - Updated dependencies [0c920ea]
588
596
  - Updated dependencies [70af3b2]
589
- - @pluv/io@0.34.0
590
- - @pluv/persistence-cloudflare-transactional-storage@0.34.0
591
- - @pluv/types@0.34.0
597
+ - @pluv/io@0.34.0
598
+ - @pluv/persistence-cloudflare-transactional-storage@0.34.0
599
+ - @pluv/types@0.34.0
592
600
 
593
601
  ## 0.33.0
594
602
 
@@ -611,9 +619,9 @@
611
619
  ### Patch Changes
612
620
 
613
621
  - Updated dependencies [e659f8a]
614
- - @pluv/io@0.32.8
615
- - @pluv/persistence-cloudflare-transactional-storage@0.32.8
616
- - @pluv/types@0.32.8
622
+ - @pluv/io@0.32.8
623
+ - @pluv/persistence-cloudflare-transactional-storage@0.32.8
624
+ - @pluv/types@0.32.8
617
625
 
618
626
  ## 0.32.7
619
627
 
@@ -628,18 +636,18 @@
628
636
  ### Patch Changes
629
637
 
630
638
  - Updated dependencies [c0956e7]
631
- - @pluv/io@0.32.6
632
- - @pluv/persistence-cloudflare-transactional-storage@0.32.6
633
- - @pluv/types@0.32.6
639
+ - @pluv/io@0.32.6
640
+ - @pluv/persistence-cloudflare-transactional-storage@0.32.6
641
+ - @pluv/types@0.32.6
634
642
 
635
643
  ## 0.32.5
636
644
 
637
645
  ### Patch Changes
638
646
 
639
647
  - 98d7585: Update `meta` type on platform contexts to allow for nested json types.
640
- - @pluv/io@0.32.5
641
- - @pluv/persistence-cloudflare-transactional-storage@0.32.5
642
- - @pluv/types@0.32.5
648
+ - @pluv/io@0.32.5
649
+ - @pluv/persistence-cloudflare-transactional-storage@0.32.5
650
+ - @pluv/types@0.32.5
643
651
 
644
652
  ## 0.32.4
645
653
 
@@ -647,73 +655,73 @@
647
655
 
648
656
  - fd054db: Add support for adding metadata to context when creating a room.
649
657
 
650
- ```ts
651
- import { createIO } from "@pluv/io";
652
-
653
- // If using Cloudflare
654
- import { platformCloudflare } from "@pluv/platform-cloudflare";
655
-
656
- const io = createIO({
657
- // ...
658
- platform: platformCloudflare<CloudflareEnv, { myCustomData: string }>(),
659
- context: ({
660
- env,
661
- state,
662
- // This is now available on the context function
663
- meta,
664
- }) => ({ env, state, meta }),
665
- });
666
-
667
- const ioServer = io.server();
668
-
669
- ioServer.createRoom("my-room", {
670
- // ...
671
- // This will now be a required property when creating a room
672
- meta: { myCustomData: "hello world" },
673
- });
674
-
675
- // If using Node.js
676
- import { platformNode } from "@pluv/platform-node";
677
-
678
- const io = createIO({
679
- // ...
680
- platform: platformNode<{ myCustomData: string }>(),
681
- context: ({
682
- // This is now available on the context function
683
- meta,
684
- }) => ({ env, state, meta }),
685
- });
686
-
687
- const ioServer = io.server();
688
-
689
- ioServer.createRoom("my-room", {
690
- // ...
691
- // This will now be a required property when creating a room
692
- meta: { myCustomData: "hello world" },
693
- });
694
- ```
695
-
696
- - @pluv/io@0.32.4
697
- - @pluv/persistence-cloudflare-transactional-storage@0.32.4
698
- - @pluv/types@0.32.4
658
+ ```ts
659
+ import { createIO } from "@pluv/io";
660
+
661
+ // If using Cloudflare
662
+ import { platformCloudflare } from "@pluv/platform-cloudflare";
663
+
664
+ const io = createIO({
665
+ // ...
666
+ platform: platformCloudflare<CloudflareEnv, { myCustomData: string }>(),
667
+ context: ({
668
+ env,
669
+ state,
670
+ // This is now available on the context function
671
+ meta,
672
+ }) => ({ env, state, meta }),
673
+ });
674
+
675
+ const ioServer = io.server();
676
+
677
+ ioServer.createRoom("my-room", {
678
+ // ...
679
+ // This will now be a required property when creating a room
680
+ meta: { myCustomData: "hello world" },
681
+ });
682
+
683
+ // If using Node.js
684
+ import { platformNode } from "@pluv/platform-node";
685
+
686
+ const io = createIO({
687
+ // ...
688
+ platform: platformNode<{ myCustomData: string }>(),
689
+ context: ({
690
+ // This is now available on the context function
691
+ meta,
692
+ }) => ({ env, state, meta }),
693
+ });
694
+
695
+ const ioServer = io.server();
696
+
697
+ ioServer.createRoom("my-room", {
698
+ // ...
699
+ // This will now be a required property when creating a room
700
+ meta: { myCustomData: "hello world" },
701
+ });
702
+ ```
703
+
704
+ - @pluv/io@0.32.4
705
+ - @pluv/persistence-cloudflare-transactional-storage@0.32.4
706
+ - @pluv/types@0.32.4
699
707
 
700
708
  ## 0.32.3
701
709
 
702
710
  ### Patch Changes
703
711
 
704
712
  - Updated dependencies [bb21274]
705
- - @pluv/io@0.32.3
706
- - @pluv/persistence-cloudflare-transactional-storage@0.32.3
707
- - @pluv/types@0.32.3
713
+ - @pluv/io@0.32.3
714
+ - @pluv/persistence-cloudflare-transactional-storage@0.32.3
715
+ - @pluv/types@0.32.3
708
716
 
709
717
  ## 0.32.2
710
718
 
711
719
  ### Patch Changes
712
720
 
713
721
  - Updated dependencies [890d45b]
714
- - @pluv/io@0.32.2
715
- - @pluv/persistence-cloudflare-transactional-storage@0.32.2
716
- - @pluv/types@0.32.2
722
+ - @pluv/io@0.32.2
723
+ - @pluv/persistence-cloudflare-transactional-storage@0.32.2
724
+ - @pluv/types@0.32.2
717
725
 
718
726
  ## 0.32.1
719
727
 
@@ -728,9 +736,9 @@
728
736
  ### Patch Changes
729
737
 
730
738
  - Updated dependencies [cde5305]
731
- - @pluv/io@0.32.0
732
- - @pluv/persistence-cloudflare-transactional-storage@0.32.0
733
- - @pluv/types@0.32.0
739
+ - @pluv/io@0.32.0
740
+ - @pluv/persistence-cloudflare-transactional-storage@0.32.0
741
+ - @pluv/types@0.32.0
734
742
 
735
743
  ## 0.31.0
736
744
 
@@ -738,159 +746,159 @@
738
746
 
739
747
  - b3c31d7: **BREAKING**
740
748
 
741
- Fixed platform context types. This will require additional properties when registering a websocket and creating authorization tokens. See example below:
742
-
743
- ```ts
744
- // @pluv/platform-node example
745
-
746
- import { platformNode } from "@pluv/platform-node";
747
- import { createIO } from "@pluv/io";
748
- import type { IncomingMessage } from "node:http";
749
- import { z } from "zod";
750
-
751
- const io = createIO({
752
- // If using a function authorize parameter, `req` is now available as a param
753
- authorize: ({ req }) => ({
754
- required: true,
755
- secret: "MY-CUSTOM-SECRET",
756
- user: z.object({
757
- id: z.string(),
758
- }),
759
- }),
760
- platformNode(),
761
- });
762
-
763
- // Before
764
- io.createToken({
765
- room: "my-custom-room",
766
- user: { id: "abc123" },
767
- });
768
-
769
- // After
770
- io.createToken({
771
- room: "my-custom-room",
772
- user: { id: "abc123" },
773
-
774
- // Previously not required, but now required
775
- req: req as IncomingMessage,
776
- });
777
- ```
778
-
779
- ```ts
780
- // @pluv/platform-cloudflare example
781
-
782
- import { platformCloudflare } from "@pluv/platform-cloudflare";
783
- import { createIO } from "@pluv/io";
784
- import { z } from "zod";
785
-
786
- const io = createIO({
787
- // If using a function authorize parameter, `env` and `request` are now available as params
788
- authorize: ({ env, request }) => ({
789
- required: true,
790
- secret: "MY-CUSTOM-SECRET",
791
- user: z.object({
792
- id: z.string(),
793
- }),
794
- }),
795
- platformCloudflare(),
796
- });
797
-
798
- // Before
799
- io.createToken({
800
- room: "my-custom-room",
801
- user: { id: "abc123" },
802
- });
803
-
804
- // After
805
- io.createToken({
806
- room: "my-custom-room",
807
- user: { id: "abc123" },
808
-
809
- // Previously not required, but now required
810
- env: env as Env,
811
- request: request as Request,
812
- });
813
- ```
749
+ Fixed platform context types. This will require additional properties when registering a websocket and creating authorization tokens. See example below:
750
+
751
+ ```ts
752
+ // @pluv/platform-node example
753
+
754
+ import { platformNode } from "@pluv/platform-node";
755
+ import { createIO } from "@pluv/io";
756
+ import type { IncomingMessage } from "node:http";
757
+ import { z } from "zod";
758
+
759
+ const io = createIO({
760
+ // If using a function authorize parameter, `req` is now available as a param
761
+ authorize: ({ req }) => ({
762
+ required: true,
763
+ secret: "MY-CUSTOM-SECRET",
764
+ user: z.object({
765
+ id: z.string(),
766
+ }),
767
+ }),
768
+ platformNode(),
769
+ });
770
+
771
+ // Before
772
+ io.createToken({
773
+ room: "my-custom-room",
774
+ user: { id: "abc123" },
775
+ });
776
+
777
+ // After
778
+ io.createToken({
779
+ room: "my-custom-room",
780
+ user: { id: "abc123" },
781
+
782
+ // Previously not required, but now required
783
+ req: req as IncomingMessage,
784
+ });
785
+ ```
786
+
787
+ ```ts
788
+ // @pluv/platform-cloudflare example
789
+
790
+ import { platformCloudflare } from "@pluv/platform-cloudflare";
791
+ import { createIO } from "@pluv/io";
792
+ import { z } from "zod";
793
+
794
+ const io = createIO({
795
+ // If using a function authorize parameter, `env` and `request` are now available as params
796
+ authorize: ({ env, request }) => ({
797
+ required: true,
798
+ secret: "MY-CUSTOM-SECRET",
799
+ user: z.object({
800
+ id: z.string(),
801
+ }),
802
+ }),
803
+ platformCloudflare(),
804
+ });
805
+
806
+ // Before
807
+ io.createToken({
808
+ room: "my-custom-room",
809
+ user: { id: "abc123" },
810
+ });
811
+
812
+ // After
813
+ io.createToken({
814
+ room: "my-custom-room",
815
+ user: { id: "abc123" },
816
+
817
+ // Previously not required, but now required
818
+ env: env as Env,
819
+ request: request as Request,
820
+ });
821
+ ```
814
822
 
815
823
  - 0f98064: **BREAKING**
816
824
 
817
- Update `authorize` params so that `roomId` is renamed to `room` and more platform-specific parameters are exposed. See example below:
818
-
819
- ```ts
820
- // @pluv/platform-cloudflare example
821
- import { createPluvHandler } from "@pluv/platform-cloudflare";
822
-
823
- // Before
824
- createPluvHandler({
825
- // ...
826
- authorize: ({ roomId }) => {
827
- // ...
828
- },
829
- });
830
-
831
- // After
832
- createPluvHandler({
833
- // ...
834
- authorize: ({ env, request, room }) => {
835
- // ...
836
- },
837
- });
838
- ```
839
-
840
- ```ts
841
- // @pluv/platform-node example
842
- import { createPluvHandler } from "@pluv/platform-node";
843
-
844
- // Before
845
- createPluvHandler({
846
- // ...
847
- authorize: ({ roomId }) => {
848
- // ...
849
- },
850
- });
851
-
852
- // After
853
- createPluvHandler({
854
- // ...
855
- authorize: ({ req, room }) => {
856
- // ...
857
- },
858
- });
859
- ```
825
+ Update `authorize` params so that `roomId` is renamed to `room` and more platform-specific parameters are exposed. See example below:
826
+
827
+ ```ts
828
+ // @pluv/platform-cloudflare example
829
+ import { createPluvHandler } from "@pluv/platform-cloudflare";
830
+
831
+ // Before
832
+ createPluvHandler({
833
+ // ...
834
+ authorize: ({ roomId }) => {
835
+ // ...
836
+ },
837
+ });
838
+
839
+ // After
840
+ createPluvHandler({
841
+ // ...
842
+ authorize: ({ env, request, room }) => {
843
+ // ...
844
+ },
845
+ });
846
+ ```
847
+
848
+ ```ts
849
+ // @pluv/platform-node example
850
+ import { createPluvHandler } from "@pluv/platform-node";
851
+
852
+ // Before
853
+ createPluvHandler({
854
+ // ...
855
+ authorize: ({ roomId }) => {
856
+ // ...
857
+ },
858
+ });
859
+
860
+ // After
861
+ createPluvHandler({
862
+ // ...
863
+ authorize: ({ req, room }) => {
864
+ // ...
865
+ },
866
+ });
867
+ ```
860
868
 
861
869
  ### Patch Changes
862
870
 
863
871
  - Updated dependencies [b3c31d7]
864
- - @pluv/io@0.31.0
865
- - @pluv/persistence-cloudflare-transactional-storage@0.31.0
866
- - @pluv/types@0.31.0
872
+ - @pluv/io@0.31.0
873
+ - @pluv/persistence-cloudflare-transactional-storage@0.31.0
874
+ - @pluv/types@0.31.0
867
875
 
868
876
  ## 0.30.2
869
877
 
870
878
  ### Patch Changes
871
879
 
872
880
  - 6521b05: Export the types of `NodePlatform` and `CloudflarePlatform`.
873
- - @pluv/io@0.30.2
874
- - @pluv/persistence-cloudflare-transactional-storage@0.30.2
875
- - @pluv/types@0.30.2
881
+ - @pluv/io@0.30.2
882
+ - @pluv/persistence-cloudflare-transactional-storage@0.30.2
883
+ - @pluv/types@0.30.2
876
884
 
877
885
  ## 0.30.1
878
886
 
879
887
  ### Patch Changes
880
888
 
881
889
  - Updated dependencies [b9c3633]
882
- - @pluv/io@0.30.1
883
- - @pluv/persistence-cloudflare-transactional-storage@0.30.1
884
- - @pluv/types@0.30.1
890
+ - @pluv/io@0.30.1
891
+ - @pluv/persistence-cloudflare-transactional-storage@0.30.1
892
+ - @pluv/types@0.30.1
885
893
 
886
894
  ## 0.30.0
887
895
 
888
896
  ### Patch Changes
889
897
 
890
898
  - Updated dependencies [7246a9e]
891
- - @pluv/io@0.30.0
892
- - @pluv/persistence-cloudflare-transactional-storage@0.30.0
893
- - @pluv/types@0.30.0
899
+ - @pluv/io@0.30.0
900
+ - @pluv/persistence-cloudflare-transactional-storage@0.30.0
901
+ - @pluv/types@0.30.0
894
902
 
895
903
  ## 0.29.0
896
904
 
@@ -914,54 +922,54 @@
914
922
 
915
923
  - Updated dependencies [19ed36c]
916
924
  - Updated dependencies [e309b0b]
917
- - @pluv/io@0.27.0
918
- - @pluv/persistence-cloudflare-transactional-storage@0.27.0
919
- - @pluv/types@0.27.0
925
+ - @pluv/io@0.27.0
926
+ - @pluv/persistence-cloudflare-transactional-storage@0.27.0
927
+ - @pluv/types@0.27.0
920
928
 
921
929
  ## 0.26.0
922
930
 
923
931
  ### Patch Changes
924
932
 
925
933
  - 2a6e078: Updated `@pluv/platform-cloudflare` and `@pluv/platform-node` so that exact properties are used in its initialization.
926
- - @pluv/io@0.26.0
927
- - @pluv/persistence-cloudflare-transactional-storage@0.26.0
928
- - @pluv/types@0.26.0
934
+ - @pluv/io@0.26.0
935
+ - @pluv/persistence-cloudflare-transactional-storage@0.26.0
936
+ - @pluv/types@0.26.0
929
937
 
930
938
  ## 0.25.4
931
939
 
932
940
  ### Patch Changes
933
941
 
934
942
  - Updated dependencies [7a9080c]
935
- - @pluv/io@0.25.4
936
- - @pluv/persistence-cloudflare-transactional-storage@0.25.4
937
- - @pluv/types@0.25.4
943
+ - @pluv/io@0.25.4
944
+ - @pluv/persistence-cloudflare-transactional-storage@0.25.4
945
+ - @pluv/types@0.25.4
938
946
 
939
947
  ## 0.25.3
940
948
 
941
949
  ### Patch Changes
942
950
 
943
951
  - Updated dependencies [50d9b96]
944
- - @pluv/io@0.25.3
945
- - @pluv/persistence-cloudflare-transactional-storage@0.25.3
946
- - @pluv/types@0.25.3
952
+ - @pluv/io@0.25.3
953
+ - @pluv/persistence-cloudflare-transactional-storage@0.25.3
954
+ - @pluv/types@0.25.3
947
955
 
948
956
  ## 0.25.2
949
957
 
950
958
  ### Patch Changes
951
959
 
952
960
  - Updated dependencies [60a0bf1]
953
- - @pluv/io@0.25.2
954
- - @pluv/persistence-cloudflare-transactional-storage@0.25.2
955
- - @pluv/types@0.25.2
961
+ - @pluv/io@0.25.2
962
+ - @pluv/persistence-cloudflare-transactional-storage@0.25.2
963
+ - @pluv/types@0.25.2
956
964
 
957
965
  ## 0.25.1
958
966
 
959
967
  ### Patch Changes
960
968
 
961
969
  - Updated dependencies [3925f7c]
962
- - @pluv/io@0.25.1
963
- - @pluv/persistence-cloudflare-transactional-storage@0.25.1
964
- - @pluv/types@0.25.1
970
+ - @pluv/io@0.25.1
971
+ - @pluv/persistence-cloudflare-transactional-storage@0.25.1
972
+ - @pluv/types@0.25.1
965
973
 
966
974
  ## 0.25.0
967
975
 
@@ -969,33 +977,33 @@
969
977
 
970
978
  - 9db06ba: **BREAKING **
971
979
 
972
- Fixed typos `persistance` to `persistence`.
980
+ Fixed typos `persistance` to `persistence`.
973
981
 
974
- This does mean that all properties referencing `persistance` will need to be fixed. Examples below:
982
+ This does mean that all properties referencing `persistance` will need to be fixed. Examples below:
975
983
 
976
- ```bash
977
- # Re-install @pluv/persistence-redis
978
- pnpm uninstall @pluv/persistance-redis
979
- pnpm install @pluv/persistence-redis
980
- ```
984
+ ```bash
985
+ # Re-install @pluv/persistence-redis
986
+ pnpm uninstall @pluv/persistance-redis
987
+ pnpm install @pluv/persistence-redis
988
+ ```
981
989
 
982
- ```ts
983
- // Before
984
- createIO({
985
- platform: platformNode({
986
- persistance: new PersistanceRedis(/* ... */),
987
- }),
988
- });
990
+ ```ts
991
+ // Before
992
+ createIO({
993
+ platform: platformNode({
994
+ persistance: new PersistanceRedis(/* ... */),
995
+ }),
996
+ });
989
997
 
990
- // After
991
- createIO({
992
- platform: platformNode({
993
- persistence: new PersistenceRedis(/* ... */),
994
- }),
995
- });
996
- ```
998
+ // After
999
+ createIO({
1000
+ platform: platformNode({
1001
+ persistence: new PersistenceRedis(/* ... */),
1002
+ }),
1003
+ });
1004
+ ```
997
1005
 
998
- `@pluv/persistance-redis` has been deprecated for `@pluv/persistence-redis`.
1006
+ `@pluv/persistance-redis` has been deprecated for `@pluv/persistence-redis`.
999
1007
 
1000
1008
  ### Patch Changes
1001
1009
 
@@ -1003,9 +1011,9 @@
1003
1011
  - Updated dependencies [4e078ca]
1004
1012
  - Updated dependencies [f556d30]
1005
1013
  - Updated dependencies [9db06ba]
1006
- - @pluv/persistence-cloudflare-transactional-storage@0.25.0
1007
- - @pluv/io@0.25.0
1008
- - @pluv/types@0.25.0
1014
+ - @pluv/persistence-cloudflare-transactional-storage@0.25.0
1015
+ - @pluv/io@0.25.0
1016
+ - @pluv/types@0.25.0
1009
1017
 
1010
1018
  ## 0.24.1
1011
1019
 
@@ -1020,37 +1028,37 @@
1020
1028
 
1021
1029
  - Updated dependencies [6ac8a46]
1022
1030
  - Updated dependencies [c26986d]
1023
- - @pluv/io@0.24.0
1024
- - @pluv/types@0.24.0
1031
+ - @pluv/io@0.24.0
1032
+ - @pluv/types@0.24.0
1025
1033
 
1026
1034
  ## 0.23.0
1027
1035
 
1028
1036
  ### Patch Changes
1029
1037
 
1030
1038
  - Updated dependencies [c01b16f]
1031
- - @pluv/io@0.23.0
1032
- - @pluv/types@0.23.0
1039
+ - @pluv/io@0.23.0
1040
+ - @pluv/types@0.23.0
1033
1041
 
1034
1042
  ## 0.22.0
1035
1043
 
1036
1044
  ### Minor Changes
1037
1045
 
1038
1046
  - 650e577: \* Fix `@pluv/platform-cloudflare` causing frequent disconnects due to incorrect heartbeat handling.
1039
- - Updated default `mode` of `@pluv/platform-cloudflare` back to `"detached"` (i.e. use Cloudflare Worker Hibernation API by default).
1047
+ - Updated default `mode` of `@pluv/platform-cloudflare` back to `"detached"` (i.e. use Cloudflare Worker Hibernation API by default).
1040
1048
 
1041
1049
  ### Patch Changes
1042
1050
 
1043
1051
  - Updated dependencies [650e577]
1044
- - @pluv/io@0.22.0
1045
- - @pluv/types@0.22.0
1052
+ - @pluv/io@0.22.0
1053
+ - @pluv/types@0.22.0
1046
1054
 
1047
1055
  ## 0.21.1
1048
1056
 
1049
1057
  ### Patch Changes
1050
1058
 
1051
1059
  - ba53e7a: Revert `@platform/cloudflare` mode to `attached` from `detached` temporarily.
1052
- - @pluv/io@0.21.1
1053
- - @pluv/types@0.21.1
1060
+ - @pluv/io@0.21.1
1061
+ - @pluv/types@0.21.1
1054
1062
 
1055
1063
  ## 0.21.0
1056
1064
 
@@ -1058,65 +1066,65 @@
1058
1066
 
1059
1067
  - 307bd44: `@pluv/platform-cloudflare` now supports Cloudflare Worker's WebSocket Hibernation API, and usees it by default.
1060
1068
 
1061
- To switch back to not using the WebSocket Hibernation API, specify a `mode` of `attached`.
1069
+ To switch back to not using the WebSocket Hibernation API, specify a `mode` of `attached`.
1062
1070
 
1063
- ```ts
1064
- // With event-listeners directly attached to the websocket on registration (i.e. non-hibernation)
1065
- createIO({
1066
- platform: platformCloudflare({
1067
- mode: "attached",
1068
- }),
1069
- });
1071
+ ```ts
1072
+ // With event-listeners directly attached to the websocket on registration (i.e. non-hibernation)
1073
+ createIO({
1074
+ platform: platformCloudflare({
1075
+ mode: "attached",
1076
+ }),
1077
+ });
1070
1078
 
1071
- // With event listeners unattached to the websocket during registration (i.e. hibernation)
1072
- createIO({
1073
- platform: platformCloudflare({
1074
- mode: "detached",
1075
- }),
1076
- });
1077
- ```
1079
+ // With event listeners unattached to the websocket during registration (i.e. hibernation)
1080
+ createIO({
1081
+ platform: platformCloudflare({
1082
+ mode: "detached",
1083
+ }),
1084
+ });
1085
+ ```
1078
1086
 
1079
1087
  - 41b15e4: **BREAKING** - Updated `sessions` type in the procedure context from `Map<string, WebSocketSession>` to `readonly WebSocketSession[]`.
1080
1088
  - f570c8a: **BREAKING**: The original request object is no longer available in the context of any event resolvers.
1081
1089
 
1082
- 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`.
1090
+ 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`.
1083
1091
 
1084
- ```ts
1085
- // Before
1092
+ ```ts
1093
+ // Before
1086
1094
 
1087
- // With platform-node
1088
- ioServer.getRoom(websocket, { req, token });
1095
+ // With platform-node
1096
+ ioServer.getRoom(websocket, { req, token });
1089
1097
 
1090
- // With platform-cloudflare
1091
- ioServer.getRoom(websocket, { env, req, token });
1092
- ```
1098
+ // With platform-cloudflare
1099
+ ioServer.getRoom(websocket, { env, req, token });
1100
+ ```
1093
1101
 
1094
- ```ts
1095
- // Now
1102
+ ```ts
1103
+ // Now
1096
1104
 
1097
- // With platform-node
1098
- ioServer.getRoom(websocket, { req });
1105
+ // With platform-node
1106
+ ioServer.getRoom(websocket, { req });
1099
1107
 
1100
- // With platform-cloudflare
1101
- ioServer.getRoom(websocket, { env, req });
1102
- ```
1108
+ // With platform-cloudflare
1109
+ ioServer.getRoom(websocket, { env, req });
1110
+ ```
1103
1111
 
1104
1112
  - b98ab6b: Internal updates to platforms (i.e. `@pluv/platform-cloudflare` and `@pluv/platform-node`) to be able to support Cloudflare Worker Websocket Hibernation APIs.
1105
1113
  - 4c2228d: **BREAKING**: Require `DurableObjectState` in `ioServer.getRoom`.
1106
1114
 
1107
- ```ts
1108
- // Before
1115
+ ```ts
1116
+ // Before
1109
1117
 
1110
- // With platform-cloudflare
1111
- ioServer.getRoom(websocket, { env, req });
1112
- ```
1118
+ // With platform-cloudflare
1119
+ ioServer.getRoom(websocket, { env, req });
1120
+ ```
1113
1121
 
1114
- ```ts
1115
- // Now
1122
+ ```ts
1123
+ // Now
1116
1124
 
1117
- // With platform-cloudflare
1118
- ioServer.getRoom(websocket, { env, req, state });
1119
- ```
1125
+ // With platform-cloudflare
1126
+ ioServer.getRoom(websocket, { env, req, state });
1127
+ ```
1120
1128
 
1121
1129
  ### Patch Changes
1122
1130
 
@@ -1127,8 +1135,8 @@
1127
1135
  - Updated dependencies [b98ab6b]
1128
1136
  - Updated dependencies [4c2228d]
1129
1137
  - Updated dependencies [cc2613e]
1130
- - @pluv/io@0.21.0
1131
- - @pluv/types@0.21.0
1138
+ - @pluv/io@0.21.0
1139
+ - @pluv/types@0.21.0
1132
1140
 
1133
1141
  ## 0.20.0
1134
1142
 
@@ -1150,103 +1158,103 @@
1150
1158
 
1151
1159
  - 99b5ca9: ## Breaking Changes
1152
1160
 
1153
- - `@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.
1161
+ - `@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.
1154
1162
 
1155
- ### Before:
1163
+ ### Before:
1156
1164
 
1157
- ```ts
1158
- // backend/io.ts
1165
+ ```ts
1166
+ // backend/io.ts
1159
1167
 
1160
- import { createIO } from "@pluv/io";
1161
- import { createPluvHandler, platformNode } from "@pluv/platform-node";
1162
- import { z } from "zod";
1168
+ import { createIO } from "@pluv/io";
1169
+ import { createPluvHandler, platformNode } from "@pluv/platform-node";
1170
+ import { z } from "zod";
1163
1171
 
1164
- export const io = createIO({
1165
- platform: platformNode(),
1166
- })
1167
- .event("SEND_MESSAGE", {
1168
- input: z.object({ message: z.string() }),
1169
- resolver: ({ message }) => ({ RECEIVE_MESSAGE: { message } }),
1172
+ export const io = createIO({
1173
+ platform: platformNode(),
1170
1174
  })
1171
- .event("DOUBLE_VALUE", {
1172
- input: z.object({ value: z.number() }),
1173
- resolver: ({ value }) => ({ VALUE_DOUBLED: { value: value * 2 } }),
1175
+ .event("SEND_MESSAGE", {
1176
+ input: z.object({ message: z.string() }),
1177
+ resolver: ({ message }) => ({ RECEIVE_MESSAGE: { message } }),
1178
+ })
1179
+ .event("DOUBLE_VALUE", {
1180
+ input: z.object({ value: z.number() }),
1181
+ resolver: ({ value }) => ({ VALUE_DOUBLED: { value: value * 2 } }),
1182
+ });
1183
+
1184
+ const Pluv = createPluvHandler({
1185
+ io,
1186
+ /* ... */
1174
1187
  });
1188
+ ```
1175
1189
 
1176
- const Pluv = createPluvHandler({
1177
- io,
1178
- /* ... */
1179
- });
1180
- ```
1190
+ ```ts
1191
+ // frontend/pluv.ts
1181
1192
 
1182
- ```ts
1183
- // frontend/pluv.ts
1193
+ import { createClient } from "@pluv/react";
1194
+ import type { io } from "../backend/io";
1184
1195
 
1185
- import { createClient } from "@pluv/react";
1186
- import type { io } from "../backend/io";
1187
-
1188
- const client = createClient<typeof io>({
1189
- /* ... */
1190
- });
1191
- ```
1196
+ const client = createClient<typeof io>({
1197
+ /* ... */
1198
+ });
1199
+ ```
1192
1200
 
1193
- ### Now:
1201
+ ### Now:
1194
1202
 
1195
- ```ts
1196
- import { createIO } from "@pluv/io";
1197
- import { createPluvHandler, platformNode } from "@pluv/platform-node";
1198
- import { z } from "zod";
1203
+ ```ts
1204
+ import { createIO } from "@pluv/io";
1205
+ import { createPluvHandler, platformNode } from "@pluv/platform-node";
1206
+ import { z } from "zod";
1199
1207
 
1200
- const io = createIO({
1201
- platform: platformNode(),
1202
- });
1208
+ const io = createIO({
1209
+ platform: platformNode(),
1210
+ });
1203
1211
 
1204
- const router = io.router({
1205
- SEND_MESSAGE: io.procedure
1206
- .input(z.object({ message: z.string() }))
1207
- .broadcast(({ message }) => ({
1208
- RECEIVE_MESSAGE: { message },
1209
- })),
1210
- DOUBLE_VALUE: io.procedure
1211
- .input(z.object({ value: z.number() }))
1212
- .broadcast(({ value }) => ({
1213
- VALUE_DOUBLED: { value: value * 2 },
1214
- })),
1215
- });
1212
+ const router = io.router({
1213
+ SEND_MESSAGE: io.procedure
1214
+ .input(z.object({ message: z.string() }))
1215
+ .broadcast(({ message }) => ({
1216
+ RECEIVE_MESSAGE: { message },
1217
+ })),
1218
+ DOUBLE_VALUE: io.procedure
1219
+ .input(z.object({ value: z.number() }))
1220
+ .broadcast(({ value }) => ({
1221
+ VALUE_DOUBLED: { value: value * 2 },
1222
+ })),
1223
+ });
1216
1224
 
1217
- export const ioServer = io.server({ router });
1225
+ export const ioServer = io.server({ router });
1218
1226
 
1219
- const Pluv = createPluvHandler({
1220
- io: ioServer, // <- This uses the PluvServer now
1221
- /* ... */
1222
- });
1223
- ```
1227
+ const Pluv = createPluvHandler({
1228
+ io: ioServer, // <- This uses the PluvServer now
1229
+ /* ... */
1230
+ });
1231
+ ```
1224
1232
 
1225
- ```ts
1226
- // frontend/pluv.ts
1233
+ ```ts
1234
+ // frontend/pluv.ts
1227
1235
 
1228
- import { createClient } from "@pluv/react";
1229
- import type { ioServer } from "../backend/io";
1236
+ import { createClient } from "@pluv/react";
1237
+ import type { ioServer } from "../backend/io";
1230
1238
 
1231
- // This users the PluvServer type now
1232
- const client = createClient<typeof ioServer>({
1233
- /* ... */
1234
- });
1235
- ```
1239
+ // This users the PluvServer type now
1240
+ const client = createClient<typeof ioServer>({
1241
+ /* ... */
1242
+ });
1243
+ ```
1236
1244
 
1237
- - `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:
1245
+ - `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:
1238
1246
 
1239
- ```ts
1240
- const router = io.mergeRouters(router1, router2);
1241
- ```
1247
+ ```ts
1248
+ const router = io.mergeRouters(router1, router2);
1249
+ ```
1242
1250
 
1243
1251
  ### Patch Changes
1244
1252
 
1245
1253
  - Updated dependencies [428c21c]
1246
1254
  - Updated dependencies [329dbcd]
1247
1255
  - Updated dependencies [99b5ca9]
1248
- - @pluv/io@0.18.0
1249
- - @pluv/types@0.18.0
1256
+ - @pluv/io@0.18.0
1257
+ - @pluv/types@0.18.0
1250
1258
 
1251
1259
  ## 0.17.3
1252
1260
 
@@ -1276,86 +1284,86 @@
1276
1284
  - 507bc00: _BREAKING_: The `authorize` config when calling `createIO` can now also be a function that exposes the platform context.
1277
1285
  This allows accessing the `env` in Cloudflare workers.
1278
1286
 
1279
- ```ts
1280
- import { createIO } from "@pluv/io";
1281
- import { platformCloudflare } from "@pluv/platform-cloudflare";
1282
- import { z } from "zod";
1283
-
1284
- const io = createIO({
1285
- authorize: ({ env }) => ({
1286
- required: true,
1287
- secret: env.PLUV_AUTHORIZE_SECRET,
1288
- user: z.object({
1289
- id: z.string(),
1290
- name: z.string(),
1291
- }),
1292
- }),
1293
- platform: platformCloudflare<{ PLUV_AUTHORIZE_SECRET: string }>(),
1294
- // ...
1295
- });
1296
- ```
1297
-
1298
- This also requires that the platform contexts are passed to `io.createToken`.
1299
-
1300
- ```ts
1301
- // If using `platformNode`
1302
- await io.createToken({
1303
- req, // This `IncomingMessage` is now required
1304
- room,
1305
- user: {
1306
- id: "user_123",
1307
- name: "john doe",
1308
- },
1309
- });
1310
-
1311
- // If using `platformCloudflare`
1312
- await io.createToken({
1313
- env, // This env is now required from the handler's fetch function
1314
- room,
1315
- user: {
1316
- id: "user_123",
1317
- name: "john doe",
1318
- },
1319
- });
1320
- ```
1287
+ ```ts
1288
+ import { createIO } from "@pluv/io";
1289
+ import { platformCloudflare } from "@pluv/platform-cloudflare";
1290
+ import { z } from "zod";
1291
+
1292
+ const io = createIO({
1293
+ authorize: ({ env }) => ({
1294
+ required: true,
1295
+ secret: env.PLUV_AUTHORIZE_SECRET,
1296
+ user: z.object({
1297
+ id: z.string(),
1298
+ name: z.string(),
1299
+ }),
1300
+ }),
1301
+ platform: platformCloudflare<{ PLUV_AUTHORIZE_SECRET: string }>(),
1302
+ // ...
1303
+ });
1304
+ ```
1305
+
1306
+ This also requires that the platform contexts are passed to `io.createToken`.
1307
+
1308
+ ```ts
1309
+ // If using `platformNode`
1310
+ await io.createToken({
1311
+ req, // This `IncomingMessage` is now required
1312
+ room,
1313
+ user: {
1314
+ id: "user_123",
1315
+ name: "john doe",
1316
+ },
1317
+ });
1318
+
1319
+ // If using `platformCloudflare`
1320
+ await io.createToken({
1321
+ env, // This env is now required from the handler's fetch function
1322
+ room,
1323
+ user: {
1324
+ id: "user_123",
1325
+ name: "john doe",
1326
+ },
1327
+ });
1328
+ ```
1321
1329
 
1322
1330
  ### Patch Changes
1323
1331
 
1324
1332
  - Updated dependencies [507bc00]
1325
- - @pluv/types@0.17.0
1326
- - @pluv/io@0.17.0
1333
+ - @pluv/types@0.17.0
1334
+ - @pluv/io@0.17.0
1327
1335
 
1328
1336
  ## 0.16.3
1329
1337
 
1330
1338
  ### Patch Changes
1331
1339
 
1332
1340
  - Updated dependencies [0bf0934]
1333
- - @pluv/io@0.16.3
1334
- - @pluv/types@0.16.3
1341
+ - @pluv/io@0.16.3
1342
+ - @pluv/types@0.16.3
1335
1343
 
1336
1344
  ## 0.16.2
1337
1345
 
1338
1346
  ### Patch Changes
1339
1347
 
1340
1348
  - Updated dependencies [06f572d]
1341
- - @pluv/io@0.16.2
1342
- - @pluv/types@0.16.2
1349
+ - @pluv/io@0.16.2
1350
+ - @pluv/types@0.16.2
1343
1351
 
1344
1352
  ## 0.16.1
1345
1353
 
1346
1354
  ### Patch Changes
1347
1355
 
1348
1356
  - Updated dependencies [cd05d96]
1349
- - @pluv/io@0.16.1
1350
- - @pluv/types@0.16.1
1357
+ - @pluv/io@0.16.1
1358
+ - @pluv/types@0.16.1
1351
1359
 
1352
1360
  ## 0.16.0
1353
1361
 
1354
1362
  ### Patch Changes
1355
1363
 
1356
1364
  - Updated dependencies [4280220]
1357
- - @pluv/io@0.16.0
1358
- - @pluv/types@0.16.0
1365
+ - @pluv/io@0.16.0
1366
+ - @pluv/types@0.16.0
1359
1367
 
1360
1368
  ## 0.15.0
1361
1369
 
@@ -1391,8 +1399,8 @@
1391
1399
 
1392
1400
  - da9f600: Upgraded dependencies
1393
1401
  - Updated dependencies [da9f600]
1394
- - @pluv/io@0.12.3
1395
- - @pluv/types@0.12.3
1402
+ - @pluv/io@0.12.3
1403
+ - @pluv/types@0.12.3
1396
1404
 
1397
1405
  ## 0.12.2
1398
1406
 
@@ -1420,32 +1428,32 @@
1420
1428
 
1421
1429
  - 74b3061: Bumped minor and patch dependencies.
1422
1430
  - Updated dependencies [74b3061]
1423
- - @pluv/io@0.11.1
1424
- - @pluv/types@0.11.1
1431
+ - @pluv/io@0.11.1
1432
+ - @pluv/types@0.11.1
1425
1433
 
1426
1434
  ## 0.11.0
1427
1435
 
1428
1436
  ### Patch Changes
1429
1437
 
1430
1438
  - Updated dependencies [b538f5c]
1431
- - @pluv/io@0.11.0
1432
- - @pluv/types@0.11.0
1439
+ - @pluv/io@0.11.0
1440
+ - @pluv/types@0.11.0
1433
1441
 
1434
1442
  ## 0.10.3
1435
1443
 
1436
1444
  ### Patch Changes
1437
1445
 
1438
1446
  - Updated dependencies [a7d3ad1]
1439
- - @pluv/io@0.10.3
1440
- - @pluv/types@0.10.3
1447
+ - @pluv/io@0.10.3
1448
+ - @pluv/types@0.10.3
1441
1449
 
1442
1450
  ## 0.10.2
1443
1451
 
1444
1452
  ### Patch Changes
1445
1453
 
1446
1454
  - Updated dependencies [3deee13]
1447
- - @pluv/io@0.10.2
1448
- - @pluv/types@0.10.2
1455
+ - @pluv/io@0.10.2
1456
+ - @pluv/types@0.10.2
1449
1457
 
1450
1458
  ## 0.10.1
1451
1459
 
@@ -1455,8 +1463,8 @@
1455
1463
  - 885835d: remove unnecessary dependency
1456
1464
  - Updated dependencies [0eeb67c]
1457
1465
  - Updated dependencies [885835d]
1458
- - @pluv/io@0.10.1
1459
- - @pluv/types@0.10.1
1466
+ - @pluv/io@0.10.1
1467
+ - @pluv/types@0.10.1
1460
1468
 
1461
1469
  ## 0.10.0
1462
1470
 
@@ -1467,8 +1475,8 @@
1467
1475
  ### Patch Changes
1468
1476
 
1469
1477
  - Updated dependencies [f43f1cc]
1470
- - @pluv/io@0.10.0
1471
- - @pluv/types@0.10.0
1478
+ - @pluv/io@0.10.0
1479
+ - @pluv/types@0.10.0
1472
1480
 
1473
1481
  ## 0.3.4
1474
1482
 
@@ -1484,8 +1492,8 @@
1484
1492
  - 8997c65: bumped dependencies
1485
1493
  - Updated dependencies [8fba48b]
1486
1494
  - Updated dependencies [8997c65]
1487
- - @pluv/types@0.2.2
1488
- - @pluv/io@0.7.1
1495
+ - @pluv/types@0.2.2
1496
+ - @pluv/io@0.7.1
1489
1497
 
1490
1498
  ## 0.3.2
1491
1499
 
@@ -1494,15 +1502,15 @@
1494
1502
  - 8d11672: bumped dependencies to latest
1495
1503
  - Updated dependencies [8d11672]
1496
1504
  - Updated dependencies [829d31b]
1497
- - @pluv/types@0.2.1
1498
- - @pluv/io@0.7.0
1505
+ - @pluv/types@0.2.1
1506
+ - @pluv/io@0.7.0
1499
1507
 
1500
1508
  ## 0.3.1
1501
1509
 
1502
1510
  ### Patch Changes
1503
1511
 
1504
1512
  - Updated dependencies [2e7cbfa]
1505
- - @pluv/io@0.6.0
1513
+ - @pluv/io@0.6.0
1506
1514
 
1507
1515
  ## 0.3.0
1508
1516
 
@@ -1513,14 +1521,14 @@
1513
1521
  ### Patch Changes
1514
1522
 
1515
1523
  - Updated dependencies [ae4e1f1]
1516
- - @pluv/io@0.5.0
1524
+ - @pluv/io@0.5.0
1517
1525
 
1518
1526
  ## 0.2.1
1519
1527
 
1520
1528
  ### Patch Changes
1521
1529
 
1522
1530
  - Updated dependencies [8917309]
1523
- - @pluv/io@0.4.2
1531
+ - @pluv/io@0.4.2
1524
1532
 
1525
1533
  ## 0.2.0
1526
1534
 
@@ -1533,8 +1541,8 @@
1533
1541
  - b85a232: bumped dependencies
1534
1542
  - fde89cf: added defaults to the client to align it with createPluvClient by default
1535
1543
  - Updated dependencies [b85a232]
1536
- - @pluv/io@0.4.1
1537
- - @pluv/types@0.2.0
1544
+ - @pluv/io@0.4.1
1545
+ - @pluv/types@0.2.0
1538
1546
 
1539
1547
  ## 0.1.18
1540
1548
 
@@ -1545,36 +1553,36 @@
1545
1553
  - Updated dependencies [bb2886b]
1546
1554
  - Updated dependencies [ae679a8]
1547
1555
  - Updated dependencies [3518a83]
1548
- - @pluv/io@0.4.0
1549
- - @pluv/types@0.2.0
1556
+ - @pluv/io@0.4.0
1557
+ - @pluv/types@0.2.0
1550
1558
 
1551
1559
  ## 0.1.17
1552
1560
 
1553
1561
  ### Patch Changes
1554
1562
 
1555
1563
  - Updated dependencies [abb3622]
1556
- - @pluv/io@0.3.9
1564
+ - @pluv/io@0.3.9
1557
1565
 
1558
1566
  ## 0.1.16
1559
1567
 
1560
1568
  ### Patch Changes
1561
1569
 
1562
1570
  - Updated dependencies [bcf1c3e]
1563
- - @pluv/io@0.3.8
1571
+ - @pluv/io@0.3.8
1564
1572
 
1565
1573
  ## 0.1.15
1566
1574
 
1567
1575
  ### Patch Changes
1568
1576
 
1569
1577
  - Updated dependencies [ecc4040]
1570
- - @pluv/io@0.3.7
1578
+ - @pluv/io@0.3.7
1571
1579
 
1572
1580
  ## 0.1.14
1573
1581
 
1574
1582
  ### Patch Changes
1575
1583
 
1576
1584
  - Updated dependencies [a7e2980]
1577
- - @pluv/io@0.3.6
1585
+ - @pluv/io@0.3.6
1578
1586
 
1579
1587
  ## 0.1.13
1580
1588
 
@@ -1582,7 +1590,7 @@
1582
1590
 
1583
1591
  - 78fd644: updated readmes with links to the documentation website
1584
1592
  - Updated dependencies [78fd644]
1585
- - @pluv/io@0.3.5
1593
+ - @pluv/io@0.3.5
1586
1594
 
1587
1595
  ## 0.1.12
1588
1596
 
@@ -1590,23 +1598,23 @@
1590
1598
 
1591
1599
  - 850626e: bumped dependencies
1592
1600
  - Updated dependencies [850626e]
1593
- - @pluv/types@0.1.6
1594
- - @pluv/io@0.3.4
1601
+ - @pluv/types@0.1.6
1602
+ - @pluv/io@0.3.4
1595
1603
 
1596
1604
  ## 0.1.11
1597
1605
 
1598
1606
  ### Patch Changes
1599
1607
 
1600
1608
  - Updated dependencies [77069a1]
1601
- - @pluv/io@0.3.3
1602
- - @pluv/types@0.1.5
1609
+ - @pluv/io@0.3.3
1610
+ - @pluv/types@0.1.5
1603
1611
 
1604
1612
  ## 0.1.10
1605
1613
 
1606
1614
  ### Patch Changes
1607
1615
 
1608
1616
  - Updated dependencies [9ae251d]
1609
- - @pluv/io@0.3.2
1617
+ - @pluv/io@0.3.2
1610
1618
 
1611
1619
  ## 0.1.9
1612
1620
 
@@ -1614,8 +1622,8 @@
1614
1622
 
1615
1623
  - 74870ee: bumped dependencies
1616
1624
  - Updated dependencies [74870ee]
1617
- - @pluv/types@0.1.5
1618
- - @pluv/io@0.3.1
1625
+ - @pluv/types@0.1.5
1626
+ - @pluv/io@0.3.1
1619
1627
 
1620
1628
  ## 0.1.8
1621
1629
 
@@ -1623,8 +1631,8 @@
1623
1631
 
1624
1632
  - Updated dependencies [c5567f1]
1625
1633
  - Updated dependencies [c5567f1]
1626
- - @pluv/io@0.3.0
1627
- - @pluv/types@0.1.4
1634
+ - @pluv/io@0.3.0
1635
+ - @pluv/types@0.1.4
1628
1636
 
1629
1637
  ## 0.1.7
1630
1638
 
@@ -1638,8 +1646,8 @@
1638
1646
  - Updated dependencies [7b6da1c]
1639
1647
  - Updated dependencies [e9c1514]
1640
1648
  - Updated dependencies [9d1829c]
1641
- - @pluv/types@0.1.4
1642
- - @pluv/io@0.2.6
1649
+ - @pluv/types@0.1.4
1650
+ - @pluv/io@0.2.6
1643
1651
 
1644
1652
  ## 0.1.6
1645
1653
 
@@ -1648,8 +1656,8 @@
1648
1656
  - 161e00e: fixed links to other pluv packages in readmes
1649
1657
  - Updated dependencies [161e00e]
1650
1658
  - Updated dependencies [f6c0e65]
1651
- - @pluv/io@0.2.5
1652
- - @pluv/types@0.1.3
1659
+ - @pluv/io@0.2.5
1660
+ - @pluv/types@0.1.3
1653
1661
 
1654
1662
  ## 0.1.5
1655
1663
 
@@ -1664,8 +1672,8 @@
1664
1672
  - Updated dependencies [3b7b17a]
1665
1673
  - Updated dependencies [b1cb325]
1666
1674
  - Updated dependencies [8e97fb2]
1667
- - @pluv/io@0.2.4
1668
- - @pluv/types@0.1.3
1675
+ - @pluv/io@0.2.4
1676
+ - @pluv/types@0.1.3
1669
1677
 
1670
1678
  ## 0.1.4
1671
1679
 
@@ -1673,8 +1681,8 @@
1673
1681
 
1674
1682
  - Updated dependencies [95b5ef8]
1675
1683
  - Updated dependencies [e23fbbe]
1676
- - @pluv/io@0.2.3
1677
- - @pluv/types@0.1.2
1684
+ - @pluv/io@0.2.3
1685
+ - @pluv/types@0.1.2
1678
1686
 
1679
1687
  ## 0.1.3
1680
1688
 
@@ -1682,8 +1690,8 @@
1682
1690
 
1683
1691
  - fe80d7b: added preview disclaimer about breaking changes in the readme
1684
1692
  - Updated dependencies [fe80d7b]
1685
- - @pluv/io@0.2.2
1686
- - @pluv/types@0.1.2
1693
+ - @pluv/io@0.2.2
1694
+ - @pluv/types@0.1.2
1687
1695
 
1688
1696
  ## 0.1.2
1689
1697
 
@@ -1691,7 +1699,7 @@
1691
1699
 
1692
1700
  - Updated dependencies [b45d642]
1693
1701
  - Updated dependencies [203dfee]
1694
- - @pluv/io@0.2.1
1702
+ - @pluv/io@0.2.1
1695
1703
 
1696
1704
  ## 0.1.1
1697
1705
 
@@ -1701,8 +1709,8 @@
1701
1709
  - Updated dependencies [23a7382]
1702
1710
  - Updated dependencies [39271d4]
1703
1711
  - Updated dependencies [24016e6]
1704
- - @pluv/io@0.2.0
1705
- - @pluv/types@0.1.1
1712
+ - @pluv/io@0.2.0
1713
+ - @pluv/types@0.1.1
1706
1714
 
1707
1715
  ## 0.1.0
1708
1716
 
@@ -1713,5 +1721,5 @@
1713
1721
  ### Patch Changes
1714
1722
 
1715
1723
  - Updated dependencies [a22f525]
1716
- - @pluv/io@0.1.0
1717
- - @pluv/types@0.1.0
1724
+ - @pluv/io@0.1.0
1725
+ - @pluv/types@0.1.0