@pluv/io 5.0.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 +16 -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,12 @@
|
|
|
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
|
+
|
|
3
10
|
## 5.0.0
|
|
4
11
|
|
|
5
12
|
### Patch Changes
|
|
@@ -908,9 +915,7 @@
|
|
|
908
915
|
```ts
|
|
909
916
|
import { createIO } from "@pluv/io";
|
|
910
917
|
|
|
911
|
-
const io = createIO({
|
|
912
|
-
/* ... */
|
|
913
|
-
});
|
|
918
|
+
const io = createIO({/* ... */});
|
|
914
919
|
|
|
915
920
|
const ioServer = io.server({
|
|
916
921
|
// ...
|
|
@@ -1142,9 +1147,7 @@
|
|
|
1142
1147
|
```tsx
|
|
1143
1148
|
// backend
|
|
1144
1149
|
|
|
1145
|
-
const io = createIO({
|
|
1146
|
-
/* ... */
|
|
1147
|
-
});
|
|
1150
|
+
const io = createIO({/* ... */});
|
|
1148
1151
|
|
|
1149
1152
|
const ioServer = io.server({
|
|
1150
1153
|
router: io.router({
|
|
@@ -1564,9 +1567,7 @@
|
|
|
1564
1567
|
```tsx
|
|
1565
1568
|
// backend
|
|
1566
1569
|
|
|
1567
|
-
const io = createIO({
|
|
1568
|
-
/* ... */
|
|
1569
|
-
});
|
|
1570
|
+
const io = createIO({/* ... */});
|
|
1570
1571
|
|
|
1571
1572
|
const router = io.router({
|
|
1572
1573
|
SEND_MESSAGE: io.procedure
|
|
@@ -1622,9 +1623,7 @@
|
|
|
1622
1623
|
import { createClient } from "@pluv/react";
|
|
1623
1624
|
import type { io } from "../backend/io";
|
|
1624
1625
|
|
|
1625
|
-
const client = createClient<typeof io>({
|
|
1626
|
-
/* ... */
|
|
1627
|
-
});
|
|
1626
|
+
const client = createClient<typeof io>({/* ... */});
|
|
1628
1627
|
```
|
|
1629
1628
|
|
|
1630
1629
|
### Now:
|
|
@@ -1666,9 +1665,7 @@
|
|
|
1666
1665
|
import type { ioServer } from "../backend/io";
|
|
1667
1666
|
|
|
1668
1667
|
// This users the PluvServer type now
|
|
1669
|
-
const client = createClient<typeof ioServer>({
|
|
1670
|
-
/* ... */
|
|
1671
|
-
});
|
|
1668
|
+
const client = createClient<typeof ioServer>({/* ... */});
|
|
1672
1669
|
```
|
|
1673
1670
|
|
|
1674
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:
|
|
@@ -1847,9 +1844,7 @@
|
|
|
1847
1844
|
// Before:
|
|
1848
1845
|
import { createClient, y } from "@pluv/client";
|
|
1849
1846
|
|
|
1850
|
-
const client = createClient({
|
|
1851
|
-
/* ... */
|
|
1852
|
-
});
|
|
1847
|
+
const client = createClient({/* ... */});
|
|
1853
1848
|
|
|
1854
1849
|
client.createRoom({
|
|
1855
1850
|
// ...
|
|
@@ -1863,9 +1858,7 @@
|
|
|
1863
1858
|
// This is now imported separately
|
|
1864
1859
|
import { yjs } from "@pluv/crdt-yjs";
|
|
1865
1860
|
|
|
1866
|
-
const client = createClient({
|
|
1867
|
-
/* ... */
|
|
1868
|
-
});
|
|
1861
|
+
const client = createClient({/* ... */});
|
|
1869
1862
|
|
|
1870
1863
|
client.createRoom({
|
|
1871
1864
|
// ...
|
|
@@ -1901,9 +1894,7 @@
|
|
|
1901
1894
|
// Before:
|
|
1902
1895
|
import { Doc as YDoc } from "yjs";
|
|
1903
1896
|
|
|
1904
|
-
const room: PluvRoom = client.createRoom({
|
|
1905
|
-
/* ... */
|
|
1906
|
-
});
|
|
1897
|
+
const room: PluvRoom = client.createRoom({/* ... */});
|
|
1907
1898
|
|
|
1908
1899
|
const doc: YDoc = room.getDoc();
|
|
1909
1900
|
|
|
@@ -1911,9 +1902,7 @@
|
|
|
1911
1902
|
import { CrdtYjsDoc } from "@pluv/crdt-yjs";
|
|
1912
1903
|
import { Doc as YDoc } from "yjs";
|
|
1913
1904
|
|
|
1914
|
-
const room: PluvRoom = client.createRoom({
|
|
1915
|
-
/* ... */
|
|
1916
|
-
});
|
|
1905
|
+
const room: PluvRoom = client.createRoom({/* ... */});
|
|
1917
1906
|
|
|
1918
1907
|
const doc: CrdtYjsDoc<any> = room.getDoc();
|
|
1919
1908
|
const ydoc: YDoc = doc.value;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/io",
|
|
3
|
-
"version": "5.0.
|
|
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": "^5.0.0",
|
|
28
|
-
"@pluv/types": "^5.0.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": "^5.0.0",
|
|
36
|
-
"eslint-config-pluv": "^5.0.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.3[39m powered by [38;2;255;126;23mrolldown v1.1.2[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.62 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.34 kB
|
|
14
|
-
[32m✔[39m Build complete in [32m2777ms[39m
|