@pluv/io 4.1.0 → 5.0.1
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 +23 -27
- package/package.json +10 -10
- package/src/PluvIO.ts +17 -9
- package/src/types.ts +15 -17
- package/.turbo/turbo-build.log +0 -14
- package/dist/index.d.mts +0 -543
- package/dist/index.d.mts.map +0 -1
- package/dist/index.mjs +0 -1421
- package/dist/index.mjs.map +0 -1
- package/src/version.generated.ts +0 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @pluv/io
|
|
2
2
|
|
|
3
|
+
## 5.0.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @pluv/crdt@5.0.1
|
|
8
|
+
- @pluv/types@5.0.1
|
|
9
|
+
|
|
10
|
+
## 5.0.0
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- @pluv/crdt@5.0.0
|
|
15
|
+
- @pluv/types@5.0.0
|
|
16
|
+
|
|
3
17
|
## 4.1.0
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
|
@@ -901,9 +915,7 @@
|
|
|
901
915
|
```ts
|
|
902
916
|
import { createIO } from "@pluv/io";
|
|
903
917
|
|
|
904
|
-
const io = createIO({
|
|
905
|
-
/* ... */
|
|
906
|
-
});
|
|
918
|
+
const io = createIO({/* ... */});
|
|
907
919
|
|
|
908
920
|
const ioServer = io.server({
|
|
909
921
|
// ...
|
|
@@ -1135,9 +1147,7 @@
|
|
|
1135
1147
|
```tsx
|
|
1136
1148
|
// backend
|
|
1137
1149
|
|
|
1138
|
-
const io = createIO({
|
|
1139
|
-
/* ... */
|
|
1140
|
-
});
|
|
1150
|
+
const io = createIO({/* ... */});
|
|
1141
1151
|
|
|
1142
1152
|
const ioServer = io.server({
|
|
1143
1153
|
router: io.router({
|
|
@@ -1557,9 +1567,7 @@
|
|
|
1557
1567
|
```tsx
|
|
1558
1568
|
// backend
|
|
1559
1569
|
|
|
1560
|
-
const io = createIO({
|
|
1561
|
-
/* ... */
|
|
1562
|
-
});
|
|
1570
|
+
const io = createIO({/* ... */});
|
|
1563
1571
|
|
|
1564
1572
|
const router = io.router({
|
|
1565
1573
|
SEND_MESSAGE: io.procedure
|
|
@@ -1615,9 +1623,7 @@
|
|
|
1615
1623
|
import { createClient } from "@pluv/react";
|
|
1616
1624
|
import type { io } from "../backend/io";
|
|
1617
1625
|
|
|
1618
|
-
const client = createClient<typeof io>({
|
|
1619
|
-
/* ... */
|
|
1620
|
-
});
|
|
1626
|
+
const client = createClient<typeof io>({/* ... */});
|
|
1621
1627
|
```
|
|
1622
1628
|
|
|
1623
1629
|
### Now:
|
|
@@ -1659,9 +1665,7 @@
|
|
|
1659
1665
|
import type { ioServer } from "../backend/io";
|
|
1660
1666
|
|
|
1661
1667
|
// This users the PluvServer type now
|
|
1662
|
-
const client = createClient<typeof ioServer>({
|
|
1663
|
-
/* ... */
|
|
1664
|
-
});
|
|
1668
|
+
const client = createClient<typeof ioServer>({/* ... */});
|
|
1665
1669
|
```
|
|
1666
1670
|
|
|
1667
1671
|
- `PluvRouter` instances can also be merged via the `mergeRouters` method, which effectively performs an `Object.assign` of the events object and returns a new `PluvRouter` with the correct types:
|
|
@@ -1840,9 +1844,7 @@
|
|
|
1840
1844
|
// Before:
|
|
1841
1845
|
import { createClient, y } from "@pluv/client";
|
|
1842
1846
|
|
|
1843
|
-
const client = createClient({
|
|
1844
|
-
/* ... */
|
|
1845
|
-
});
|
|
1847
|
+
const client = createClient({/* ... */});
|
|
1846
1848
|
|
|
1847
1849
|
client.createRoom({
|
|
1848
1850
|
// ...
|
|
@@ -1856,9 +1858,7 @@
|
|
|
1856
1858
|
// This is now imported separately
|
|
1857
1859
|
import { yjs } from "@pluv/crdt-yjs";
|
|
1858
1860
|
|
|
1859
|
-
const client = createClient({
|
|
1860
|
-
/* ... */
|
|
1861
|
-
});
|
|
1861
|
+
const client = createClient({/* ... */});
|
|
1862
1862
|
|
|
1863
1863
|
client.createRoom({
|
|
1864
1864
|
// ...
|
|
@@ -1894,9 +1894,7 @@
|
|
|
1894
1894
|
// Before:
|
|
1895
1895
|
import { Doc as YDoc } from "yjs";
|
|
1896
1896
|
|
|
1897
|
-
const room: PluvRoom = client.createRoom({
|
|
1898
|
-
/* ... */
|
|
1899
|
-
});
|
|
1897
|
+
const room: PluvRoom = client.createRoom({/* ... */});
|
|
1900
1898
|
|
|
1901
1899
|
const doc: YDoc = room.getDoc();
|
|
1902
1900
|
|
|
@@ -1904,9 +1902,7 @@
|
|
|
1904
1902
|
import { CrdtYjsDoc } from "@pluv/crdt-yjs";
|
|
1905
1903
|
import { Doc as YDoc } from "yjs";
|
|
1906
1904
|
|
|
1907
|
-
const room: PluvRoom = client.createRoom({
|
|
1908
|
-
/* ... */
|
|
1909
|
-
});
|
|
1905
|
+
const room: PluvRoom = client.createRoom({/* ... */});
|
|
1910
1906
|
|
|
1911
1907
|
const doc: CrdtYjsDoc<any> = room.getDoc();
|
|
1912
1908
|
const ydoc: YDoc = doc.value;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/io",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.1",
|
|
4
4
|
"description": "@pluv/io server-side websocket manager",
|
|
5
5
|
"author": {
|
|
6
6
|
"email": "david@pluv.io",
|
|
@@ -21,19 +21,19 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@panva/hkdf": "^1.2.1",
|
|
24
|
-
"
|
|
24
|
+
"@pluv/crdt": "^5.0.1",
|
|
25
|
+
"@pluv/types": "^5.0.1",
|
|
26
|
+
"jose": "^6.2.10",
|
|
25
27
|
"kleur": "^4.1.5",
|
|
26
|
-
"wonka": "^6.3.6"
|
|
27
|
-
"@pluv/crdt": "^4.1.0",
|
|
28
|
-
"@pluv/types": "^4.1.0"
|
|
28
|
+
"wonka": "^6.3.6"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"
|
|
31
|
+
"@pluv/tsconfig": "^5.0.1",
|
|
32
|
+
"eslint": "^10.9.0",
|
|
33
|
+
"eslint-config-pluv": "^5.0.1",
|
|
32
34
|
"genversion": "^3.2.0",
|
|
33
|
-
"tsdown": "0.22.
|
|
34
|
-
"typescript": "^5.9.3"
|
|
35
|
-
"@pluv/tsconfig": "^4.1.0",
|
|
36
|
-
"eslint-config-pluv": "^4.1.0"
|
|
35
|
+
"tsdown": "0.22.14",
|
|
36
|
+
"typescript": "^5.9.3"
|
|
37
37
|
},
|
|
38
38
|
"exports": {
|
|
39
39
|
".": "./dist/index.mjs",
|
package/src/PluvIO.ts
CHANGED
|
@@ -62,15 +62,23 @@ export type BaseServerConfig<
|
|
|
62
62
|
TCrdt extends CrdtLibraryType<any> = CrdtLibraryType<NoopCrdtDocFactory>,
|
|
63
63
|
TEvents extends PluvRouterEventConfig<TPlatform, TAuthorize, TContext> = {},
|
|
64
64
|
> = {
|
|
65
|
-
[
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
65
|
+
[
|
|
66
|
+
P in keyof ResolvedServerConfig<
|
|
67
|
+
TPlatform,
|
|
68
|
+
TAuthorize,
|
|
69
|
+
TContext,
|
|
70
|
+
TCrdt,
|
|
71
|
+
TEvents
|
|
72
|
+
> as ResolvedServerConfig<
|
|
73
|
+
TPlatform,
|
|
74
|
+
TAuthorize,
|
|
75
|
+
TContext,
|
|
76
|
+
TCrdt,
|
|
77
|
+
TEvents
|
|
78
|
+
>[P] extends undefined
|
|
79
|
+
? never
|
|
80
|
+
: P
|
|
81
|
+
]: ResolvedServerConfig<TPlatform, TAuthorize, TContext, TCrdt, TEvents>[P];
|
|
74
82
|
};
|
|
75
83
|
|
|
76
84
|
export type ServerConfig<
|
package/src/types.ts
CHANGED
|
@@ -25,8 +25,7 @@ import type { AbstractWebSocket } from "./AbstractWebSocket";
|
|
|
25
25
|
import type { PluvRouter, PluvRouterEventConfig } from "./PluvRouter";
|
|
26
26
|
|
|
27
27
|
export type PluvContext<TPlatform extends AbstractPlatform, TContext extends Record<string, any>> =
|
|
28
|
-
| MaybePromise<TContext>
|
|
29
|
-
| ((params: InferRoomContextType<TPlatform>) => MaybePromise<TContext>);
|
|
28
|
+
MaybePromise<TContext> | ((params: InferRoomContextType<TPlatform>) => MaybePromise<TContext>);
|
|
30
29
|
|
|
31
30
|
export type EventResolverKind = "broadcast" | "self" | "sync";
|
|
32
31
|
|
|
@@ -62,9 +61,7 @@ export interface EventResolverContext<
|
|
|
62
61
|
}
|
|
63
62
|
|
|
64
63
|
export type SendMessageOptions =
|
|
65
|
-
|
|
66
|
-
| { type: "self" }
|
|
67
|
-
| { type: "sync" };
|
|
64
|
+
{ type?: "broadcast"; sessionIds?: readonly string[] } | { type: "self" } | { type: "sync" };
|
|
68
65
|
|
|
69
66
|
export interface WebSocketSessionTimers {
|
|
70
67
|
ping: number;
|
|
@@ -210,19 +207,21 @@ export type InferPlatformConfig<TPlatform extends AbstractPlatform<any, any, any
|
|
|
210
207
|
export type InferPlatformAuthorizeProperties<
|
|
211
208
|
TPlatform extends AbstractPlatform<any, any, any, any>,
|
|
212
209
|
> = keyof {
|
|
213
|
-
[
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
210
|
+
[
|
|
211
|
+
P in keyof PlatformConfig["authorize"] as InferPlatformConfig<TPlatform>["authorize"][P] extends
|
|
212
|
+
true | undefined
|
|
213
|
+
? P
|
|
214
|
+
: never
|
|
215
|
+
]: true;
|
|
218
216
|
};
|
|
219
217
|
|
|
220
218
|
export type InferPlatformListeners<TPlatform extends AbstractPlatform<any, any, any, any>> = keyof {
|
|
221
|
-
[
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
219
|
+
[
|
|
220
|
+
P in keyof PlatformConfig["listeners"] as InferPlatformConfig<TPlatform>["listeners"][P] extends
|
|
221
|
+
true | undefined
|
|
222
|
+
? P
|
|
223
|
+
: never
|
|
224
|
+
]: true;
|
|
226
225
|
};
|
|
227
226
|
|
|
228
227
|
export type InferPlatformRouter<TPlatform extends AbstractPlatform<any, any, any, any>> =
|
|
@@ -285,5 +284,4 @@ export type IOUserDisconnectedEvent<
|
|
|
285
284
|
};
|
|
286
285
|
|
|
287
286
|
export type WebSocketType<TPlatform extends AbstractPlatform> =
|
|
288
|
-
|
|
|
289
|
-
| InferPlatformWebSocketSource<TPlatform>;
|
|
287
|
+
InferPlatformWebSocketType<TPlatform> | InferPlatformWebSocketSource<TPlatform>;
|
package/.turbo/turbo-build.log
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
$ pnpm run version && tsdown
|
|
2
|
-
$ genversion ./src/version.generated.ts --esm
|
|
3
|
-
[34mℹ[39m [34mtsdown v0.22.2[39m powered by [38;2;255;126;23mrolldown v1.1.1[39m
|
|
4
|
-
[34mℹ[39m config file: [4m/home/runner/work/pluv/pluv/packages/io/tsdown.config.ts[24m
|
|
5
|
-
[34mℹ[39m entry: [34msrc/index.ts[39m
|
|
6
|
-
[34mℹ[39m target: [34mesnext[39m
|
|
7
|
-
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
8
|
-
[34mℹ[39m Build start
|
|
9
|
-
[34mℹ[39m [2mdist/[22m[1mindex.mjs[22m [2m 44.59 kB[22m [2m│ gzip: 10.51 kB[22m
|
|
10
|
-
[34mℹ[39m [2mdist/[22mindex.mjs.map [2m131.43 kB[22m [2m│ gzip: 26.44 kB[22m
|
|
11
|
-
[34mℹ[39m [2mdist/[22mindex.d.mts.map [2m 18.77 kB[22m [2m│ gzip: 4.08 kB[22m
|
|
12
|
-
[34mℹ[39m [2mdist/[22m[32m[1mindex.d.mts[22m[39m [2m 35.53 kB[22m [2m│ gzip: 5.97 kB[22m
|
|
13
|
-
[34mℹ[39m 4 files, total: 230.31 kB
|
|
14
|
-
[32m✔[39m Build complete in [32m2457ms[39m
|