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