@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 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": "4.1.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
- "jose": "^6.2.3",
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
- "eslint": "^10.5.0",
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.2",
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
- [P in keyof ResolvedServerConfig<
66
- TPlatform,
67
- TAuthorize,
68
- TContext,
69
- TCrdt,
70
- TEvents
71
- > as ResolvedServerConfig<TPlatform, TAuthorize, TContext, TCrdt, TEvents>[P] extends undefined
72
- ? never
73
- : P]: ResolvedServerConfig<TPlatform, TAuthorize, TContext, TCrdt, TEvents>[P];
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
- | { type?: "broadcast"; sessionIds?: readonly string[] }
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
- [P in keyof PlatformConfig["authorize"] as InferPlatformConfig<TPlatform>["authorize"][P] extends
214
- | true
215
- | undefined
216
- ? P
217
- : never]: true;
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
- [P in keyof PlatformConfig["listeners"] as InferPlatformConfig<TPlatform>["listeners"][P] extends
222
- | true
223
- | undefined
224
- ? P
225
- : never]: true;
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
- | InferPlatformWebSocketType<TPlatform>
289
- | InferPlatformWebSocketSource<TPlatform>;
287
+ InferPlatformWebSocketType<TPlatform> | InferPlatformWebSocketSource<TPlatform>;
@@ -1,14 +0,0 @@
1
- $ pnpm run version && tsdown
2
- $ genversion ./src/version.generated.ts --esm
3
- ℹ tsdown v0.22.2 powered by rolldown v1.1.1
4
- ℹ config file: /home/runner/work/pluv/pluv/packages/io/tsdown.config.ts
5
- ℹ entry: src/index.ts
6
- ℹ target: esnext
7
- ℹ tsconfig: tsconfig.json
8
- ℹ Build start
9
- ℹ dist/index.mjs  44.59 kB │ gzip: 10.51 kB
10
- ℹ dist/index.mjs.map 131.43 kB │ gzip: 26.44 kB
11
- ℹ dist/index.d.mts.map  18.77 kB │ gzip: 4.08 kB
12
- ℹ dist/index.d.mts  35.53 kB │ gzip: 5.97 kB
13
- ℹ 4 files, total: 230.31 kB
14
- ✔ Build complete in 2457ms