@pluv/platform-pluv 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/.turbo/turbo-build.log +9 -9
- package/CHANGELOG.md +322 -305
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +15 -6
- package/dist/index.mjs +16 -7
- package/package.json +11 -11
- package/src/PluvPlatform.ts +17 -2
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
|
|
2
|
-
> @pluv/platform-pluv@2.2.
|
|
2
|
+
> @pluv/platform-pluv@2.2.3 build /home/runner/work/pluv/pluv/packages/platform-pluv
|
|
3
3
|
> tsup src/index.ts --format esm,cjs --dts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
6
6
|
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
7
|
-
[34mCLI[39m tsup v8.
|
|
7
|
+
[34mCLI[39m tsup v8.5.0
|
|
8
8
|
[34mCLI[39m Target: es6
|
|
9
9
|
[34mESM[39m Build start
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
|
-
[32mESM[39m [1mdist/index.mjs [22m[32m12.
|
|
12
|
-
[32mESM[39m ⚡️ Build success in
|
|
13
|
-
[32mCJS[39m [1mdist/index.js [22m[32m14.
|
|
14
|
-
[32mCJS[39m ⚡️ Build success in
|
|
11
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m12.70 KB[39m
|
|
12
|
+
[32mESM[39m ⚡️ Build success in 121ms
|
|
13
|
+
[32mCJS[39m [1mdist/index.js [22m[32m14.54 KB[39m
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 124ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
17
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[32m3.
|
|
18
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m3.
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 6328ms
|
|
17
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m3.72 KB[39m
|
|
18
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m3.72 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,22 +1,39 @@
|
|
|
1
1
|
# @pluv/platform-pluv
|
|
2
2
|
|
|
3
|
+
## 2.2.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- feeae21: Added debug logging.
|
|
8
|
+
- @pluv/crdt@2.2.3
|
|
9
|
+
- @pluv/io@2.2.3
|
|
10
|
+
- @pluv/types@2.2.3
|
|
11
|
+
|
|
12
|
+
## 2.2.2
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- @pluv/crdt@2.2.2
|
|
17
|
+
- @pluv/io@2.2.2
|
|
18
|
+
- @pluv/types@2.2.2
|
|
19
|
+
|
|
3
20
|
## 2.2.1
|
|
4
21
|
|
|
5
22
|
### Patch Changes
|
|
6
23
|
|
|
7
24
|
- 6563957: Fix `createToken` throwing a TypeError.
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
25
|
+
- @pluv/crdt@2.2.1
|
|
26
|
+
- @pluv/io@2.2.1
|
|
27
|
+
- @pluv/types@2.2.1
|
|
11
28
|
|
|
12
29
|
## 2.2.0
|
|
13
30
|
|
|
14
31
|
### Patch Changes
|
|
15
32
|
|
|
16
33
|
- Updated dependencies [cb660cd]
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
34
|
+
- @pluv/io@2.2.0
|
|
35
|
+
- @pluv/crdt@2.2.0
|
|
36
|
+
- @pluv/types@2.2.0
|
|
20
37
|
|
|
21
38
|
## 2.1.0
|
|
22
39
|
|
|
@@ -47,9 +64,9 @@
|
|
|
47
64
|
### Patch Changes
|
|
48
65
|
|
|
49
66
|
- Updated dependencies [047a1d8]
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
67
|
+
- @pluv/types@2.0.0
|
|
68
|
+
- @pluv/crdt@2.0.0
|
|
69
|
+
- @pluv/io@2.0.0
|
|
53
70
|
|
|
54
71
|
## 1.0.2
|
|
55
72
|
|
|
@@ -64,9 +81,9 @@
|
|
|
64
81
|
### Patch Changes
|
|
65
82
|
|
|
66
83
|
- Updated dependencies [c583be9]
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
84
|
+
- @pluv/io@1.0.1
|
|
85
|
+
- @pluv/crdt@1.0.1
|
|
86
|
+
- @pluv/types@1.0.1
|
|
70
87
|
|
|
71
88
|
## 1.0.0
|
|
72
89
|
|
|
@@ -74,16 +91,16 @@
|
|
|
74
91
|
|
|
75
92
|
- af94706: pluv.io is now stable and production ready!
|
|
76
93
|
|
|
77
|
-
|
|
94
|
+
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
95
|
|
|
79
|
-
|
|
96
|
+
Checkout the [full documentation here](https://pluv.io/docs/introduction) to get started today!
|
|
80
97
|
|
|
81
98
|
### Patch Changes
|
|
82
99
|
|
|
83
100
|
- Updated dependencies [af94706]
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
101
|
+
- @pluv/crdt@1.0.0
|
|
102
|
+
- @pluv/io@1.0.0
|
|
103
|
+
- @pluv/types@1.0.0
|
|
87
104
|
|
|
88
105
|
## 0.44.2
|
|
89
106
|
|
|
@@ -117,9 +134,9 @@
|
|
|
117
134
|
- Updated dependencies [0063e80]
|
|
118
135
|
- Updated dependencies [244a973]
|
|
119
136
|
- Updated dependencies [4b0fbb3]
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
137
|
+
- @pluv/io@0.43.0
|
|
138
|
+
- @pluv/crdt@0.43.0
|
|
139
|
+
- @pluv/types@0.43.0
|
|
123
140
|
|
|
124
141
|
## 0.42.0
|
|
125
142
|
|
|
@@ -127,18 +144,18 @@
|
|
|
127
144
|
|
|
128
145
|
- def08bc: Fix default endpoint for `createToken`.
|
|
129
146
|
- Updated dependencies [cf1529a]
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
147
|
+
- @pluv/io@0.42.0
|
|
148
|
+
- @pluv/crdt@0.42.0
|
|
149
|
+
- @pluv/types@0.42.0
|
|
133
150
|
|
|
134
151
|
## 0.41.7
|
|
135
152
|
|
|
136
153
|
### Patch Changes
|
|
137
154
|
|
|
138
155
|
- c698c24: Update hidden endpoints parameter to be provided as a function.
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
156
|
+
- @pluv/crdt@0.41.7
|
|
157
|
+
- @pluv/io@0.41.7
|
|
158
|
+
- @pluv/types@0.41.7
|
|
142
159
|
|
|
143
160
|
## 0.41.6
|
|
144
161
|
|
|
@@ -161,18 +178,18 @@
|
|
|
161
178
|
### Patch Changes
|
|
162
179
|
|
|
163
180
|
- 8857e8e: Added the ability to use functions to return public keys, secret keys and webhook secrets for `@pluv/platform-pluv`.
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
181
|
+
- @pluv/crdt@0.41.4
|
|
182
|
+
- @pluv/io@0.41.4
|
|
183
|
+
- @pluv/types@0.41.4
|
|
167
184
|
|
|
168
185
|
## 0.41.3
|
|
169
186
|
|
|
170
187
|
### Patch Changes
|
|
171
188
|
|
|
172
189
|
- Updated dependencies [49051c0]
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
190
|
+
- @pluv/io@0.41.3
|
|
191
|
+
- @pluv/crdt@0.41.3
|
|
192
|
+
- @pluv/types@0.41.3
|
|
176
193
|
|
|
177
194
|
## 0.41.2
|
|
178
195
|
|
|
@@ -201,9 +218,9 @@
|
|
|
201
218
|
- Updated dependencies [555b88d]
|
|
202
219
|
- Updated dependencies [a663c65]
|
|
203
220
|
- Updated dependencies [555b88d]
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
221
|
+
- @pluv/io@0.41.0
|
|
222
|
+
- @pluv/crdt@0.41.0
|
|
223
|
+
- @pluv/types@0.41.0
|
|
207
224
|
|
|
208
225
|
## 0.40.2
|
|
209
226
|
|
|
@@ -243,9 +260,9 @@
|
|
|
243
260
|
|
|
244
261
|
- Updated dependencies [fe6e239]
|
|
245
262
|
- Updated dependencies [737d508]
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
263
|
+
- @pluv/io@0.39.0
|
|
264
|
+
- @pluv/crdt@0.39.0
|
|
265
|
+
- @pluv/types@0.39.0
|
|
249
266
|
|
|
250
267
|
## 0.38.14
|
|
251
268
|
|
|
@@ -260,9 +277,9 @@
|
|
|
260
277
|
### Patch Changes
|
|
261
278
|
|
|
262
279
|
- Updated dependencies [809afd3]
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
280
|
+
- @pluv/io@0.38.13
|
|
281
|
+
- @pluv/crdt@0.38.13
|
|
282
|
+
- @pluv/types@0.38.13
|
|
266
283
|
|
|
267
284
|
## 0.38.12
|
|
268
285
|
|
|
@@ -293,72 +310,72 @@
|
|
|
293
310
|
### Patch Changes
|
|
294
311
|
|
|
295
312
|
- 9b3af07: Updated internal event handlers to return more meaningful status codes and room identifiers.
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
313
|
+
- @pluv/crdt@0.38.9
|
|
314
|
+
- @pluv/io@0.38.9
|
|
315
|
+
- @pluv/types@0.38.9
|
|
299
316
|
|
|
300
317
|
## 0.38.8
|
|
301
318
|
|
|
302
319
|
### Patch Changes
|
|
303
320
|
|
|
304
321
|
- a39343b: Fix the `onUserDisconnected` event triggering when `onUserConnected` event triggers.
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
322
|
+
- @pluv/crdt@0.38.8
|
|
323
|
+
- @pluv/io@0.38.8
|
|
324
|
+
- @pluv/types@0.38.8
|
|
308
325
|
|
|
309
326
|
## 0.38.7
|
|
310
327
|
|
|
311
328
|
### Patch Changes
|
|
312
329
|
|
|
313
330
|
- 05c6f1a: Fix `TypeError` on event handler invocations once again.
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
331
|
+
- @pluv/crdt@0.38.7
|
|
332
|
+
- @pluv/io@0.38.7
|
|
333
|
+
- @pluv/types@0.38.7
|
|
317
334
|
|
|
318
335
|
## 0.38.6
|
|
319
336
|
|
|
320
337
|
### Patch Changes
|
|
321
338
|
|
|
322
339
|
- 07fbeef: Fix `TypeError` on event handler invocations.
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
340
|
+
- @pluv/crdt@0.38.6
|
|
341
|
+
- @pluv/io@0.38.6
|
|
342
|
+
- @pluv/types@0.38.6
|
|
326
343
|
|
|
327
344
|
## 0.38.5
|
|
328
345
|
|
|
329
346
|
### Patch Changes
|
|
330
347
|
|
|
331
348
|
- 77df696: Fixed platform event contexts being undefined.
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
349
|
+
- @pluv/crdt@0.38.5
|
|
350
|
+
- @pluv/io@0.38.5
|
|
351
|
+
- @pluv/types@0.38.5
|
|
335
352
|
|
|
336
353
|
## 0.38.4
|
|
337
354
|
|
|
338
355
|
### Patch Changes
|
|
339
356
|
|
|
340
357
|
- 15399b7: Fix webhook signature validation.
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
358
|
+
- @pluv/crdt@0.38.4
|
|
359
|
+
- @pluv/io@0.38.4
|
|
360
|
+
- @pluv/types@0.38.4
|
|
344
361
|
|
|
345
362
|
## 0.38.3
|
|
346
363
|
|
|
347
364
|
### Patch Changes
|
|
348
365
|
|
|
349
366
|
- Updated dependencies [8346273]
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
367
|
+
- @pluv/io@0.38.3
|
|
368
|
+
- @pluv/crdt@0.38.3
|
|
369
|
+
- @pluv/types@0.38.3
|
|
353
370
|
|
|
354
371
|
## 0.38.2
|
|
355
372
|
|
|
356
373
|
### Patch Changes
|
|
357
374
|
|
|
358
375
|
- Updated dependencies [039cd64]
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
376
|
+
- @pluv/io@0.38.2
|
|
377
|
+
- @pluv/crdt@0.38.2
|
|
378
|
+
- @pluv/types@0.38.2
|
|
362
379
|
|
|
363
380
|
## 0.38.1
|
|
364
381
|
|
|
@@ -373,36 +390,36 @@
|
|
|
373
390
|
### Patch Changes
|
|
374
391
|
|
|
375
392
|
- Updated dependencies [f4ceca3]
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
393
|
+
- @pluv/types@0.38.0
|
|
394
|
+
- @pluv/io@0.38.0
|
|
395
|
+
- @pluv/crdt@0.38.0
|
|
379
396
|
|
|
380
397
|
## 0.37.7
|
|
381
398
|
|
|
382
399
|
### Patch Changes
|
|
383
400
|
|
|
384
401
|
- c874f25: Fixed webhook signature verification.
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
402
|
+
- @pluv/crdt@0.37.7
|
|
403
|
+
- @pluv/io@0.37.7
|
|
404
|
+
- @pluv/types@0.37.7
|
|
388
405
|
|
|
389
406
|
## 0.37.6
|
|
390
407
|
|
|
391
408
|
### Patch Changes
|
|
392
409
|
|
|
393
410
|
- Updated dependencies [3a874f1]
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
411
|
+
- @pluv/io@0.37.6
|
|
412
|
+
- @pluv/crdt@0.37.6
|
|
413
|
+
- @pluv/types@0.37.6
|
|
397
414
|
|
|
398
415
|
## 0.37.5
|
|
399
416
|
|
|
400
417
|
### Patch Changes
|
|
401
418
|
|
|
402
419
|
- Updated dependencies [9a9ecee]
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
420
|
+
- @pluv/io@0.37.5
|
|
421
|
+
- @pluv/crdt@0.37.5
|
|
422
|
+
- @pluv/types@0.37.5
|
|
406
423
|
|
|
407
424
|
## 0.37.4
|
|
408
425
|
|
|
@@ -442,51 +459,51 @@
|
|
|
442
459
|
|
|
443
460
|
- 5165be0: **BREAKING**
|
|
444
461
|
|
|
445
|
-
|
|
462
|
+
Updated the `platformPluv` function to return an entire `createIO` input object. Now `createIO` must be called with `platformPluv`'s return value as an input.
|
|
446
463
|
|
|
447
|
-
|
|
448
|
-
|
|
464
|
+
```ts
|
|
465
|
+
// Before
|
|
449
466
|
|
|
450
|
-
|
|
451
|
-
|
|
467
|
+
import { createIO } from "@pluv/io";
|
|
468
|
+
import { platformPluv } from "@pluv/platform-pluv";
|
|
452
469
|
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
470
|
+
export const io = createIO({
|
|
471
|
+
authorize: {
|
|
472
|
+
// ...
|
|
473
|
+
},
|
|
474
|
+
context: {
|
|
475
|
+
// ...
|
|
476
|
+
},
|
|
477
|
+
platform: platformPluv({
|
|
478
|
+
// ...
|
|
479
|
+
}),
|
|
480
|
+
// ...
|
|
481
|
+
});
|
|
465
482
|
|
|
466
|
-
|
|
483
|
+
// After
|
|
467
484
|
|
|
468
|
-
|
|
469
|
-
|
|
485
|
+
import { createIO } from "@pluv/io";
|
|
486
|
+
import { platformPluv } from "@pluv/platform-pluv";
|
|
470
487
|
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
488
|
+
export const io = createIO(
|
|
489
|
+
platformPluv({
|
|
490
|
+
authorize: {
|
|
491
|
+
// ...
|
|
492
|
+
},
|
|
493
|
+
context: {
|
|
494
|
+
// ...
|
|
495
|
+
},
|
|
496
|
+
}),
|
|
497
|
+
);
|
|
498
|
+
```
|
|
482
499
|
|
|
483
500
|
### Patch Changes
|
|
484
501
|
|
|
485
502
|
- 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).
|
|
486
503
|
- Updated dependencies [9b74abb]
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
504
|
+
- @pluv/io@0.37.0
|
|
505
|
+
- @pluv/crdt@0.37.0
|
|
506
|
+
- @pluv/types@0.37.0
|
|
490
507
|
|
|
491
508
|
## 0.36.0
|
|
492
509
|
|
|
@@ -501,9 +518,9 @@
|
|
|
501
518
|
### Patch Changes
|
|
502
519
|
|
|
503
520
|
- Updated dependencies [5d3a56f]
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
521
|
+
- @pluv/io@0.35.4
|
|
522
|
+
- @pluv/crdt@0.35.4
|
|
523
|
+
- @pluv/types@0.35.4
|
|
507
524
|
|
|
508
525
|
## 0.35.3
|
|
509
526
|
|
|
@@ -519,9 +536,9 @@
|
|
|
519
536
|
|
|
520
537
|
- 47ab053: Remove unused check for `authorize.required` for `@pluv/platform-pluv`.
|
|
521
538
|
- Updated dependencies [81cb692]
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
539
|
+
- @pluv/types@0.35.2
|
|
540
|
+
- @pluv/io@0.35.2
|
|
541
|
+
- @pluv/crdt@0.35.2
|
|
525
542
|
|
|
526
543
|
## 0.35.1
|
|
527
544
|
|
|
@@ -536,18 +553,18 @@
|
|
|
536
553
|
### Patch Changes
|
|
537
554
|
|
|
538
555
|
- Updated dependencies [c9073ad]
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
556
|
+
- @pluv/io@0.35.0
|
|
557
|
+
- @pluv/crdt@0.35.0
|
|
558
|
+
- @pluv/types@0.35.0
|
|
542
559
|
|
|
543
560
|
## 0.34.1
|
|
544
561
|
|
|
545
562
|
### Patch Changes
|
|
546
563
|
|
|
547
564
|
- Updated dependencies [d639427]
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
565
|
+
- @pluv/io@0.34.1
|
|
566
|
+
- @pluv/crdt@0.34.1
|
|
567
|
+
- @pluv/types@0.34.1
|
|
551
568
|
|
|
552
569
|
## 0.34.0
|
|
553
570
|
|
|
@@ -555,66 +572,66 @@
|
|
|
555
572
|
|
|
556
573
|
- 70af3b2: **BREAKING**: The API has been updated to now be called as function `platformPluv` into `createIO` from `@pluv/io`.
|
|
557
574
|
|
|
558
|
-
|
|
559
|
-
|
|
575
|
+
```ts
|
|
576
|
+
// Before
|
|
560
577
|
|
|
561
|
-
|
|
578
|
+
import { createIO } from "@pluv/platform-pluv";
|
|
562
579
|
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
580
|
+
export const io = createIO({
|
|
581
|
+
authorize: {
|
|
582
|
+
user: z.object({
|
|
583
|
+
id: z.string(),
|
|
584
|
+
}),
|
|
585
|
+
},
|
|
586
|
+
basePath: "/api/pluv",
|
|
587
|
+
publicKey: "pk_...",
|
|
588
|
+
secretKey: "sk_...",
|
|
589
|
+
webhookSecret: "whsec_...",
|
|
590
|
+
});
|
|
574
591
|
|
|
575
|
-
|
|
592
|
+
export const GET = pluv.handler;
|
|
576
593
|
|
|
577
|
-
|
|
594
|
+
// After
|
|
578
595
|
|
|
579
|
-
|
|
580
|
-
|
|
596
|
+
import { createIO } from "@pluv/io";
|
|
597
|
+
import { platformPluv } from "@pluv/platform-pluv";
|
|
581
598
|
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
599
|
+
export const io = createIO({
|
|
600
|
+
authorize: {
|
|
601
|
+
user: z.object({
|
|
602
|
+
id: z.string(),
|
|
603
|
+
}),
|
|
604
|
+
},
|
|
605
|
+
platform: platformPluv({
|
|
606
|
+
basePath: "/api/pluv",
|
|
607
|
+
publicKey: "pk_...",
|
|
608
|
+
secretKey: "sk_...",
|
|
609
|
+
webhookSecret: "whsec_...",
|
|
610
|
+
}),
|
|
611
|
+
});
|
|
595
612
|
|
|
596
|
-
|
|
613
|
+
export const ioServer = io.server();
|
|
597
614
|
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
615
|
+
// Example: If you're on Next.js
|
|
616
|
+
export const GET = ioServer.fetch;
|
|
617
|
+
```
|
|
601
618
|
|
|
602
619
|
### Patch Changes
|
|
603
620
|
|
|
604
621
|
- Updated dependencies [0c920ea]
|
|
605
622
|
- Updated dependencies [70af3b2]
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
623
|
+
- @pluv/io@0.34.0
|
|
624
|
+
- @pluv/crdt@0.34.0
|
|
625
|
+
- @pluv/types@0.34.0
|
|
609
626
|
|
|
610
627
|
## 0.33.0
|
|
611
628
|
|
|
612
629
|
### Patch Changes
|
|
613
630
|
|
|
614
631
|
- f14b3be: Updated webhooks path to base path.
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
632
|
+
- @pluv/crdt@0.33.0
|
|
633
|
+
- @pluv/io@0.33.0
|
|
634
|
+
- @pluv/types@0.33.0
|
|
618
635
|
|
|
619
636
|
## 0.32.9
|
|
620
637
|
|
|
@@ -629,18 +646,18 @@
|
|
|
629
646
|
### Patch Changes
|
|
630
647
|
|
|
631
648
|
- Updated dependencies [e659f8a]
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
649
|
+
- @pluv/io@0.32.8
|
|
650
|
+
- @pluv/crdt@0.32.8
|
|
651
|
+
- @pluv/types@0.32.8
|
|
635
652
|
|
|
636
653
|
## 0.32.7
|
|
637
654
|
|
|
638
655
|
### Patch Changes
|
|
639
656
|
|
|
640
657
|
- a9a1f7b: Export event schemas.
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
658
|
+
- @pluv/crdt@0.32.7
|
|
659
|
+
- @pluv/io@0.32.7
|
|
660
|
+
- @pluv/types@0.32.7
|
|
644
661
|
|
|
645
662
|
## 0.32.6
|
|
646
663
|
|
|
@@ -649,55 +666,55 @@
|
|
|
649
666
|
- 25292d4: Fix event payload types to only contain serializable fields.
|
|
650
667
|
- c0956e7: Add `onUserConnected` and `onUserDisconnected` events on `PluvServer`.
|
|
651
668
|
|
|
652
|
-
|
|
653
|
-
|
|
669
|
+
```ts
|
|
670
|
+
import { createIO } from "@pluv/io";
|
|
654
671
|
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
672
|
+
const io = createIO({
|
|
673
|
+
/* ... */
|
|
674
|
+
});
|
|
658
675
|
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
676
|
+
const ioServer = io.server({
|
|
677
|
+
// ...
|
|
678
|
+
onUserConnected: (event) => {
|
|
679
|
+
// ...
|
|
680
|
+
},
|
|
681
|
+
onUserDisconnected: (event) => {
|
|
682
|
+
// ...
|
|
683
|
+
},
|
|
684
|
+
});
|
|
685
|
+
```
|
|
669
686
|
|
|
670
687
|
- fc83a44: Enable `onUserConnected` and `onUserDisconnected` event listeners.
|
|
671
688
|
- be1488f: Validate webhook signatures via webhook secrets.
|
|
672
689
|
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
690
|
+
```ts
|
|
691
|
+
import { createIO } from "@pluv/platform-pluv";
|
|
692
|
+
|
|
693
|
+
const io = createIO({
|
|
694
|
+
// ...
|
|
695
|
+
// If you provide a webhookSecret
|
|
696
|
+
webhookSecret: "whsec_...",
|
|
697
|
+
|
|
698
|
+
// The following properties will be made available to configure
|
|
699
|
+
getInitialStorage: (event) => {
|
|
700
|
+
/* ... */
|
|
701
|
+
},
|
|
702
|
+
onRoomDeleted: (event) => {
|
|
703
|
+
/* ... */
|
|
704
|
+
},
|
|
705
|
+
onUserConnected: (event) => {
|
|
706
|
+
/* ... */
|
|
707
|
+
},
|
|
708
|
+
onUserDisconnected: (event) => {
|
|
709
|
+
/* ... */
|
|
710
|
+
},
|
|
711
|
+
});
|
|
712
|
+
```
|
|
696
713
|
|
|
697
714
|
- Updated dependencies [c0956e7]
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
715
|
+
- @pluv/io@0.32.6
|
|
716
|
+
- @pluv/crdt@0.32.6
|
|
717
|
+
- @pluv/types@0.32.6
|
|
701
718
|
|
|
702
719
|
## 0.32.5
|
|
703
720
|
|
|
@@ -722,36 +739,36 @@
|
|
|
722
739
|
- cce989d: Added properties for internal use only.
|
|
723
740
|
- 5a3114f: Fixed thrown error when calling `createToken`.
|
|
724
741
|
- Updated dependencies [bb21274]
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
742
|
+
- @pluv/io@0.32.3
|
|
743
|
+
- @pluv/crdt@0.32.3
|
|
744
|
+
- @pluv/types@0.32.3
|
|
728
745
|
|
|
729
746
|
## 0.32.2
|
|
730
747
|
|
|
731
748
|
### Patch Changes
|
|
732
749
|
|
|
733
750
|
- Updated dependencies [890d45b]
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
751
|
+
- @pluv/io@0.32.2
|
|
752
|
+
- @pluv/crdt@0.32.2
|
|
753
|
+
- @pluv/types@0.32.2
|
|
737
754
|
|
|
738
755
|
## 0.32.1
|
|
739
756
|
|
|
740
757
|
### Patch Changes
|
|
741
758
|
|
|
742
759
|
- 7ae3df3: Update endpoint to generate authorization tokens.
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
760
|
+
- @pluv/crdt@0.32.1
|
|
761
|
+
- @pluv/io@0.32.1
|
|
762
|
+
- @pluv/types@0.32.1
|
|
746
763
|
|
|
747
764
|
## 0.32.0
|
|
748
765
|
|
|
749
766
|
### Patch Changes
|
|
750
767
|
|
|
751
768
|
- Updated dependencies [cde5305]
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
769
|
+
- @pluv/io@0.32.0
|
|
770
|
+
- @pluv/crdt@0.32.0
|
|
771
|
+
- @pluv/types@0.32.0
|
|
755
772
|
|
|
756
773
|
## 0.31.0
|
|
757
774
|
|
|
@@ -759,86 +776,86 @@
|
|
|
759
776
|
|
|
760
777
|
- b3c31d7: **BREAKING**
|
|
761
778
|
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
779
|
+
Fixed platform context types. This will require additional properties when registering a websocket and creating authorization tokens. See example below:
|
|
780
|
+
|
|
781
|
+
```ts
|
|
782
|
+
// @pluv/platform-node example
|
|
783
|
+
|
|
784
|
+
import { platformNode } from "@pluv/platform-node";
|
|
785
|
+
import { createIO } from "@pluv/io";
|
|
786
|
+
import type { IncomingMessage } from "node:http";
|
|
787
|
+
import { z } from "zod";
|
|
788
|
+
|
|
789
|
+
const io = createIO({
|
|
790
|
+
// If using a function authorize parameter, `req` is now available as a param
|
|
791
|
+
authorize: ({ req }) => ({
|
|
792
|
+
required: true,
|
|
793
|
+
secret: "MY-CUSTOM-SECRET",
|
|
794
|
+
user: z.object({
|
|
795
|
+
id: z.string(),
|
|
796
|
+
}),
|
|
797
|
+
}),
|
|
798
|
+
platformNode(),
|
|
799
|
+
});
|
|
800
|
+
|
|
801
|
+
// Before
|
|
802
|
+
io.createToken({
|
|
803
|
+
room: "my-custom-room",
|
|
804
|
+
user: { id: "abc123" },
|
|
805
|
+
});
|
|
806
|
+
|
|
807
|
+
// After
|
|
808
|
+
io.createToken({
|
|
809
|
+
room: "my-custom-room",
|
|
810
|
+
user: { id: "abc123" },
|
|
811
|
+
|
|
812
|
+
// Previously not required, but now required
|
|
813
|
+
req: req as IncomingMessage,
|
|
814
|
+
});
|
|
815
|
+
```
|
|
816
|
+
|
|
817
|
+
```ts
|
|
818
|
+
// @pluv/platform-cloudflare example
|
|
819
|
+
|
|
820
|
+
import { platformCloudflare } from "@pluv/platform-cloudflare";
|
|
821
|
+
import { createIO } from "@pluv/io";
|
|
822
|
+
import { z } from "zod";
|
|
823
|
+
|
|
824
|
+
const io = createIO({
|
|
825
|
+
// If using a function authorize parameter, `env` and `request` are now available as params
|
|
826
|
+
authorize: ({ env, request }) => ({
|
|
827
|
+
required: true,
|
|
828
|
+
secret: "MY-CUSTOM-SECRET",
|
|
829
|
+
user: z.object({
|
|
830
|
+
id: z.string(),
|
|
831
|
+
}),
|
|
832
|
+
}),
|
|
833
|
+
platformCloudflare(),
|
|
834
|
+
});
|
|
835
|
+
|
|
836
|
+
// Before
|
|
837
|
+
io.createToken({
|
|
838
|
+
room: "my-custom-room",
|
|
839
|
+
user: { id: "abc123" },
|
|
840
|
+
});
|
|
841
|
+
|
|
842
|
+
// After
|
|
843
|
+
io.createToken({
|
|
844
|
+
room: "my-custom-room",
|
|
845
|
+
user: { id: "abc123" },
|
|
846
|
+
|
|
847
|
+
// Previously not required, but now required
|
|
848
|
+
env: env as Env,
|
|
849
|
+
request: request as Request,
|
|
850
|
+
});
|
|
851
|
+
```
|
|
835
852
|
|
|
836
853
|
### Patch Changes
|
|
837
854
|
|
|
838
855
|
- Updated dependencies [b3c31d7]
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
856
|
+
- @pluv/io@0.31.0
|
|
857
|
+
- @pluv/crdt@0.31.0
|
|
858
|
+
- @pluv/types@0.31.0
|
|
842
859
|
|
|
843
860
|
## 0.30.2
|
|
844
861
|
|
|
@@ -854,9 +871,9 @@
|
|
|
854
871
|
|
|
855
872
|
- 47784d5: Add missing `publicKey` param to `createIO`.
|
|
856
873
|
- Updated dependencies [b9c3633]
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
874
|
+
- @pluv/io@0.30.1
|
|
875
|
+
- @pluv/crdt@0.30.1
|
|
876
|
+
- @pluv/types@0.30.1
|
|
860
877
|
|
|
861
878
|
## 0.30.0
|
|
862
879
|
|
|
@@ -867,6 +884,6 @@
|
|
|
867
884
|
### Patch Changes
|
|
868
885
|
|
|
869
886
|
- Updated dependencies [7246a9e]
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
887
|
+
- @pluv/io@0.30.0
|
|
888
|
+
- @pluv/crdt@0.30.0
|
|
889
|
+
- @pluv/types@0.30.0
|
package/dist/index.d.mts
CHANGED
|
@@ -15,6 +15,7 @@ interface PluvPlatformConfig<TContext extends Record<string, any> = {}> {
|
|
|
15
15
|
* @deprecated Internal use only. Changes to this will never be marked as breaking.
|
|
16
16
|
*/
|
|
17
17
|
_defs?: {
|
|
18
|
+
debug?: boolean;
|
|
18
19
|
endpoints?: PluvIOEndpoints | (() => MaybePromise<PluvIOEndpoints>);
|
|
19
20
|
};
|
|
20
21
|
basePath: string;
|
|
@@ -59,6 +60,7 @@ declare class PluvPlatform<TContext extends Record<string, any> = {}, TUser exte
|
|
|
59
60
|
private readonly _app;
|
|
60
61
|
private readonly _basePath;
|
|
61
62
|
private readonly _context;
|
|
63
|
+
private readonly _debug;
|
|
62
64
|
private readonly _endpoints;
|
|
63
65
|
private _getInitialStorage?;
|
|
64
66
|
private _listeners?;
|
|
@@ -79,6 +81,7 @@ declare class PluvPlatform<TContext extends Record<string, any> = {}, TUser exte
|
|
|
79
81
|
setSerializedState(webSocket: AbstractWebSocket, state: WebSocketSerializedState): WebSocketSerializedState;
|
|
80
82
|
validateConfig(config: any): void;
|
|
81
83
|
private _webhooksRouter;
|
|
84
|
+
private _logDebug;
|
|
82
85
|
}
|
|
83
86
|
|
|
84
87
|
type PlatformPluvCreateIOParams<TContext extends Record<string, any> = {}, TUser extends BaseUser$1 = BaseUser$1> = Id<PluvPlatformConfig & Omit<CreateIOParams<PluvPlatform, TContext, TUser>, "authorize" | "context" | "limits" | "platform"> & {
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ interface PluvPlatformConfig<TContext extends Record<string, any> = {}> {
|
|
|
15
15
|
* @deprecated Internal use only. Changes to this will never be marked as breaking.
|
|
16
16
|
*/
|
|
17
17
|
_defs?: {
|
|
18
|
+
debug?: boolean;
|
|
18
19
|
endpoints?: PluvIOEndpoints | (() => MaybePromise<PluvIOEndpoints>);
|
|
19
20
|
};
|
|
20
21
|
basePath: string;
|
|
@@ -59,6 +60,7 @@ declare class PluvPlatform<TContext extends Record<string, any> = {}, TUser exte
|
|
|
59
60
|
private readonly _app;
|
|
60
61
|
private readonly _basePath;
|
|
61
62
|
private readonly _context;
|
|
63
|
+
private readonly _debug;
|
|
62
64
|
private readonly _endpoints;
|
|
63
65
|
private _getInitialStorage?;
|
|
64
66
|
private _listeners?;
|
|
@@ -79,6 +81,7 @@ declare class PluvPlatform<TContext extends Record<string, any> = {}, TUser exte
|
|
|
79
81
|
setSerializedState(webSocket: AbstractWebSocket, state: WebSocketSerializedState): WebSocketSerializedState;
|
|
80
82
|
validateConfig(config: any): void;
|
|
81
83
|
private _webhooksRouter;
|
|
84
|
+
private _logDebug;
|
|
82
85
|
}
|
|
83
86
|
|
|
84
87
|
type PlatformPluvCreateIOParams<TContext extends Record<string, any> = {}, TUser extends BaseUser$1 = BaseUser$1> = Id<PluvPlatformConfig & Omit<CreateIOParams<PluvPlatform, TContext, TUser>, "authorize" | "context" | "limits" | "platform"> & {
|
package/dist/index.js
CHANGED
|
@@ -152,7 +152,7 @@ var getCrypto = () => {
|
|
|
152
152
|
};
|
|
153
153
|
|
|
154
154
|
// src/shared/createHmac.ts
|
|
155
|
-
var createHmac = (params) => __async(
|
|
155
|
+
var createHmac = (params) => __async(null, null, function* () {
|
|
156
156
|
const { payload, secret } = params;
|
|
157
157
|
if (!payload || !secret) throw new Error("Secret and payload are required to sign payload");
|
|
158
158
|
const encoder = new TextEncoder();
|
|
@@ -200,7 +200,7 @@ var timingSafeEqual = (a, b) => {
|
|
|
200
200
|
};
|
|
201
201
|
|
|
202
202
|
// src/shared/verifyWebhook.ts
|
|
203
|
-
var verifyWebhook = (params) => __async(
|
|
203
|
+
var verifyWebhook = (params) => __async(null, null, function* () {
|
|
204
204
|
const { payload, secret, signature } = params;
|
|
205
205
|
if (!secret || !payload || !signature) {
|
|
206
206
|
throw new Error("Secret, payload and signature are required to verify payload");
|
|
@@ -217,7 +217,7 @@ var verifyWebhook = (params) => __async(void 0, null, function* () {
|
|
|
217
217
|
// src/PluvPlatform.ts
|
|
218
218
|
var PluvPlatform = class extends import_io.AbstractPlatform {
|
|
219
219
|
constructor(params) {
|
|
220
|
-
var _a;
|
|
220
|
+
var _a, _b;
|
|
221
221
|
super();
|
|
222
222
|
this._config = {
|
|
223
223
|
authorize: {
|
|
@@ -244,6 +244,7 @@ var PluvPlatform = class extends import_io.AbstractPlatform {
|
|
|
244
244
|
typeof this._publicKey === "string" ? this._publicKey : this._publicKey(),
|
|
245
245
|
typeof this._secretKey === "string" ? this._secretKey : this._secretKey()
|
|
246
246
|
]);
|
|
247
|
+
this._logDebug({ endpoints, publicKey, secretKey });
|
|
247
248
|
const res = yield fetch(endpoints.createToken, {
|
|
248
249
|
headers: { "content-type": "application/json" },
|
|
249
250
|
method: "post",
|
|
@@ -254,7 +255,10 @@ var PluvPlatform = class extends import_io.AbstractPlatform {
|
|
|
254
255
|
secretKey,
|
|
255
256
|
user: parsed
|
|
256
257
|
})
|
|
257
|
-
}).catch(() =>
|
|
258
|
+
}).catch((error) => {
|
|
259
|
+
this._logDebug(error);
|
|
260
|
+
return null;
|
|
261
|
+
});
|
|
258
262
|
if (!res || !res.ok || res.status !== 200) {
|
|
259
263
|
throw new Error("Authorization failed");
|
|
260
264
|
}
|
|
@@ -337,10 +341,11 @@ var PluvPlatform = class extends import_io.AbstractPlatform {
|
|
|
337
341
|
return createErrorResponse(c, { message }, status);
|
|
338
342
|
}
|
|
339
343
|
}));
|
|
340
|
-
const { _defs,
|
|
344
|
+
const { _defs, basePath, context, publicKey, secretKey, webhookSecret } = params;
|
|
341
345
|
this._basePath = basePath;
|
|
342
346
|
this._context = typeof context === "function" ? context(this._roomContext) : context;
|
|
343
|
-
this.
|
|
347
|
+
this._debug = (_a = _defs == null ? void 0 : _defs.debug) != null ? _a : false;
|
|
348
|
+
this._endpoints = (_b = _defs == null ? void 0 : _defs.endpoints) != null ? _b : {
|
|
344
349
|
createToken: "https://rooms.pluv.io/api/room/token"
|
|
345
350
|
};
|
|
346
351
|
this._publicKey = publicKey;
|
|
@@ -402,6 +407,10 @@ var PluvPlatform = class extends import_io.AbstractPlatform {
|
|
|
402
407
|
}
|
|
403
408
|
};
|
|
404
409
|
}
|
|
410
|
+
_logDebug(...args) {
|
|
411
|
+
if (!this._debug) return;
|
|
412
|
+
console.log(...args);
|
|
413
|
+
}
|
|
405
414
|
};
|
|
406
415
|
|
|
407
416
|
// src/platformPluv.ts
|
package/dist/index.mjs
CHANGED
|
@@ -116,13 +116,13 @@ var getCrypto = () => {
|
|
|
116
116
|
return crypto;
|
|
117
117
|
}
|
|
118
118
|
if (typeof __require === "function") {
|
|
119
|
-
return __require("
|
|
119
|
+
return __require("crypto").webcrypto;
|
|
120
120
|
}
|
|
121
121
|
throw new Error("Missing crypto module");
|
|
122
122
|
};
|
|
123
123
|
|
|
124
124
|
// src/shared/createHmac.ts
|
|
125
|
-
var createHmac = (params) => __async(
|
|
125
|
+
var createHmac = (params) => __async(null, null, function* () {
|
|
126
126
|
const { payload, secret } = params;
|
|
127
127
|
if (!payload || !secret) throw new Error("Secret and payload are required to sign payload");
|
|
128
128
|
const encoder = new TextEncoder();
|
|
@@ -170,7 +170,7 @@ var timingSafeEqual = (a, b) => {
|
|
|
170
170
|
};
|
|
171
171
|
|
|
172
172
|
// src/shared/verifyWebhook.ts
|
|
173
|
-
var verifyWebhook = (params) => __async(
|
|
173
|
+
var verifyWebhook = (params) => __async(null, null, function* () {
|
|
174
174
|
const { payload, secret, signature } = params;
|
|
175
175
|
if (!secret || !payload || !signature) {
|
|
176
176
|
throw new Error("Secret, payload and signature are required to verify payload");
|
|
@@ -187,7 +187,7 @@ var verifyWebhook = (params) => __async(void 0, null, function* () {
|
|
|
187
187
|
// src/PluvPlatform.ts
|
|
188
188
|
var PluvPlatform = class extends AbstractPlatform {
|
|
189
189
|
constructor(params) {
|
|
190
|
-
var _a;
|
|
190
|
+
var _a, _b;
|
|
191
191
|
super();
|
|
192
192
|
this._config = {
|
|
193
193
|
authorize: {
|
|
@@ -214,6 +214,7 @@ var PluvPlatform = class extends AbstractPlatform {
|
|
|
214
214
|
typeof this._publicKey === "string" ? this._publicKey : this._publicKey(),
|
|
215
215
|
typeof this._secretKey === "string" ? this._secretKey : this._secretKey()
|
|
216
216
|
]);
|
|
217
|
+
this._logDebug({ endpoints, publicKey, secretKey });
|
|
217
218
|
const res = yield fetch(endpoints.createToken, {
|
|
218
219
|
headers: { "content-type": "application/json" },
|
|
219
220
|
method: "post",
|
|
@@ -224,7 +225,10 @@ var PluvPlatform = class extends AbstractPlatform {
|
|
|
224
225
|
secretKey,
|
|
225
226
|
user: parsed
|
|
226
227
|
})
|
|
227
|
-
}).catch(() =>
|
|
228
|
+
}).catch((error) => {
|
|
229
|
+
this._logDebug(error);
|
|
230
|
+
return null;
|
|
231
|
+
});
|
|
228
232
|
if (!res || !res.ok || res.status !== 200) {
|
|
229
233
|
throw new Error("Authorization failed");
|
|
230
234
|
}
|
|
@@ -307,10 +311,11 @@ var PluvPlatform = class extends AbstractPlatform {
|
|
|
307
311
|
return createErrorResponse(c, { message }, status);
|
|
308
312
|
}
|
|
309
313
|
}));
|
|
310
|
-
const { _defs,
|
|
314
|
+
const { _defs, basePath, context, publicKey, secretKey, webhookSecret } = params;
|
|
311
315
|
this._basePath = basePath;
|
|
312
316
|
this._context = typeof context === "function" ? context(this._roomContext) : context;
|
|
313
|
-
this.
|
|
317
|
+
this._debug = (_a = _defs == null ? void 0 : _defs.debug) != null ? _a : false;
|
|
318
|
+
this._endpoints = (_b = _defs == null ? void 0 : _defs.endpoints) != null ? _b : {
|
|
314
319
|
createToken: "https://rooms.pluv.io/api/room/token"
|
|
315
320
|
};
|
|
316
321
|
this._publicKey = publicKey;
|
|
@@ -372,6 +377,10 @@ var PluvPlatform = class extends AbstractPlatform {
|
|
|
372
377
|
}
|
|
373
378
|
};
|
|
374
379
|
}
|
|
380
|
+
_logDebug(...args) {
|
|
381
|
+
if (!this._debug) return;
|
|
382
|
+
console.log(...args);
|
|
383
|
+
}
|
|
375
384
|
};
|
|
376
385
|
|
|
377
386
|
// src/platformPluv.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/platform-pluv",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.3",
|
|
4
4
|
"description": "@pluv/io adapter for pluv.io",
|
|
5
5
|
"author": "leedavidcs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,20 +17,20 @@
|
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@types/node": "^22.15.
|
|
20
|
+
"@types/node": "^22.15.21",
|
|
21
21
|
"fast-json-stable-stringify": "^2.1.0",
|
|
22
|
-
"hono": "^4.7.
|
|
23
|
-
"zod": "^3.
|
|
24
|
-
"@pluv/crdt": "^2.2.
|
|
25
|
-
"@pluv/io": "^2.2.
|
|
26
|
-
"@pluv/types": "^2.2.
|
|
22
|
+
"hono": "^4.7.10",
|
|
23
|
+
"zod": "^3.25.17",
|
|
24
|
+
"@pluv/crdt": "^2.2.3",
|
|
25
|
+
"@pluv/io": "^2.2.3",
|
|
26
|
+
"@pluv/types": "^2.2.3"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
|
-
"eslint": "^9.
|
|
30
|
-
"tsup": "^8.
|
|
29
|
+
"eslint": "^9.27.0",
|
|
30
|
+
"tsup": "^8.5.0",
|
|
31
31
|
"typescript": "^5.8.3",
|
|
32
|
-
"
|
|
33
|
-
"
|
|
32
|
+
"@pluv/tsconfig": "^2.2.3",
|
|
33
|
+
"eslint-config-pluv": "^2.2.3"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "tsup src/index.ts --format esm,cjs --dts",
|
package/src/PluvPlatform.ts
CHANGED
|
@@ -29,6 +29,7 @@ export interface PluvPlatformConfig<TContext extends Record<string, any> = {}> {
|
|
|
29
29
|
* @deprecated Internal use only. Changes to this will never be marked as breaking.
|
|
30
30
|
*/
|
|
31
31
|
_defs?: {
|
|
32
|
+
debug?: boolean;
|
|
32
33
|
endpoints?: PluvIOEndpoints | (() => MaybePromise<PluvIOEndpoints>);
|
|
33
34
|
};
|
|
34
35
|
basePath: string;
|
|
@@ -83,6 +84,7 @@ export class PluvPlatform<
|
|
|
83
84
|
private readonly _app: Hono;
|
|
84
85
|
private readonly _basePath: string;
|
|
85
86
|
private readonly _context: any;
|
|
87
|
+
private readonly _debug: boolean;
|
|
86
88
|
private readonly _endpoints: PluvIOEndpoints | (() => MaybePromise<PluvIOEndpoints>);
|
|
87
89
|
private _getInitialStorage?: GetInitialStorageFn<{}>;
|
|
88
90
|
private _listeners?: PluvIOListeners;
|
|
@@ -99,6 +101,8 @@ export class PluvPlatform<
|
|
|
99
101
|
typeof this._secretKey === "string" ? this._secretKey : this._secretKey(),
|
|
100
102
|
]);
|
|
101
103
|
|
|
104
|
+
this._logDebug({ endpoints, publicKey, secretKey });
|
|
105
|
+
|
|
102
106
|
const res = await fetch(endpoints.createToken, {
|
|
103
107
|
headers: { "content-type": "application/json" },
|
|
104
108
|
method: "post",
|
|
@@ -109,7 +113,11 @@ export class PluvPlatform<
|
|
|
109
113
|
secretKey,
|
|
110
114
|
user: parsed,
|
|
111
115
|
}),
|
|
112
|
-
}).catch(() =>
|
|
116
|
+
}).catch((error) => {
|
|
117
|
+
this._logDebug(error);
|
|
118
|
+
|
|
119
|
+
return null;
|
|
120
|
+
});
|
|
113
121
|
|
|
114
122
|
if (!res || !res.ok || res.status !== 200) {
|
|
115
123
|
throw new Error("Authorization failed");
|
|
@@ -125,10 +133,11 @@ export class PluvPlatform<
|
|
|
125
133
|
constructor(params: PluvPlatformConfig) {
|
|
126
134
|
super();
|
|
127
135
|
|
|
128
|
-
const { _defs,
|
|
136
|
+
const { _defs, basePath, context, publicKey, secretKey, webhookSecret } = params;
|
|
129
137
|
|
|
130
138
|
this._basePath = basePath;
|
|
131
139
|
this._context = typeof context === "function" ? context(this._roomContext) : context;
|
|
140
|
+
this._debug = _defs?.debug ?? false;
|
|
132
141
|
this._endpoints = _defs?.endpoints ?? {
|
|
133
142
|
createToken: "https://rooms.pluv.io/api/room/token",
|
|
134
143
|
};
|
|
@@ -296,4 +305,10 @@ export class PluvPlatform<
|
|
|
296
305
|
return createErrorResponse(c, { message }, status);
|
|
297
306
|
}
|
|
298
307
|
});
|
|
308
|
+
|
|
309
|
+
private _logDebug(...args: any[]): void {
|
|
310
|
+
if (!this._debug) return;
|
|
311
|
+
|
|
312
|
+
console.log(...args);
|
|
313
|
+
}
|
|
299
314
|
}
|