@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 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.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": "^5.0.0",
28
- "@pluv/types": "^5.0.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.3",
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
- [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.3 powered by rolldown v1.1.2
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.62 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.34 kB
14
- ✔ Build complete in 2777ms