@pluv/platform-cloudflare 2.2.1 → 2.2.3

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