@pluv/client 0.32.2 → 0.32.4

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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @pluv/client@0.32.2 build /home/runner/work/pluv/pluv/packages/client
2
+ > @pluv/client@0.32.4 build /home/runner/work/pluv/pluv/packages/client
3
3
  > tsup src/index.ts --format esm,cjs --dts
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -8,11 +8,11 @@
8
8
  CLI Target: es6
9
9
  ESM Build start
10
10
  CJS Build start
11
- ESM dist/index.mjs 46.91 KB
12
- ESM ⚡️ Build success in 128ms
13
- CJS dist/index.js 48.17 KB
11
+ CJS dist/index.js 48.45 KB
14
12
  CJS ⚡️ Build success in 128ms
13
+ ESM dist/index.mjs 47.16 KB
14
+ ESM ⚡️ Build success in 128ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 3563ms
17
- DTS dist/index.d.mts 22.35 KB
18
- DTS dist/index.d.ts 22.35 KB
16
+ DTS ⚡️ Build success in 3550ms
17
+ DTS dist/index.d.mts 22.72 KB
18
+ DTS dist/index.d.ts 22.72 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,37 @@
1
1
  # @pluv/client
2
2
 
3
+ ## 0.32.4
4
+
5
+ ### Patch Changes
6
+
7
+ - @pluv/crdt@0.32.4
8
+ - @pluv/types@0.32.4
9
+
10
+ ## 0.32.3
11
+
12
+ ### Patch Changes
13
+
14
+ - b18230f: Add `register` helper to improve client initialization when hosted on pluv.io.
15
+
16
+ ```ts
17
+ import { createClient, register } from "@pluv/client";
18
+ import type { ioServer } from "./server";
19
+
20
+ const client = createClient({
21
+ infer: (i) => ({ io: i<typeof ioServer> }),
22
+ // This includes `wsEndpoint` and therefore should no-longer be manually provided
23
+ ...register({
24
+ // `authEndpoint` and `publicKey` are now required
25
+ authEndpoint: ({ room }) =>
26
+ `${process.env.API_URL}/api/room?room=${room}`,
27
+ publicKey: "pk_...",
28
+ }),
29
+ });
30
+ ```
31
+
32
+ - @pluv/crdt@0.32.3
33
+ - @pluv/types@0.32.3
34
+
3
35
  ## 0.32.2
4
36
 
5
37
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -382,4 +382,14 @@ declare class MockedRoom<TIO extends IOLike, TPresence extends JsonObject = {},
382
382
  private _simulateEvent;
383
383
  }
384
384
 
385
- export { AbstractRoom, AbstractStorageStore, ConnectionState, type CreateRoomOptions, type MergeEvents, MockedRoom, type MockedRoomConfig, type MockedRoomEvents, PluvClient, type PluvClientOptions, type PluvProcedureConfig, PluvRoom, type PluvRoomAddon, type PluvRoomAddonInput, type PluvRoomAddonResult, type PluvRoomDebug, PluvRouter, type PluvRouterEventConfig, type UserInfo, type WebSocketConnection, type WebSocketState, createClient };
385
+ interface RegisterParams<TMetadata extends JsonObject> {
386
+ authEndpoint: AuthEndpoint<TMetadata>;
387
+ publicKey: string;
388
+ }
389
+ declare const register: <TMetadata extends JsonObject>(params: RegisterParams<TMetadata>) => {
390
+ authEndpoint: AuthEndpoint<TMetadata>;
391
+ publicKey: string;
392
+ wsEndpoint: (params: EndpointParams<TMetadata>) => string;
393
+ };
394
+
395
+ export { AbstractRoom, AbstractStorageStore, ConnectionState, type CreateRoomOptions, type MergeEvents, MockedRoom, type MockedRoomConfig, type MockedRoomEvents, PluvClient, type PluvClientOptions, type PluvProcedureConfig, PluvRoom, type PluvRoomAddon, type PluvRoomAddonInput, type PluvRoomAddonResult, type PluvRoomDebug, PluvRouter, type PluvRouterEventConfig, type RegisterParams, type UserInfo, type WebSocketConnection, type WebSocketState, createClient, register };
package/dist/index.d.ts CHANGED
@@ -382,4 +382,14 @@ declare class MockedRoom<TIO extends IOLike, TPresence extends JsonObject = {},
382
382
  private _simulateEvent;
383
383
  }
384
384
 
385
- export { AbstractRoom, AbstractStorageStore, ConnectionState, type CreateRoomOptions, type MergeEvents, MockedRoom, type MockedRoomConfig, type MockedRoomEvents, PluvClient, type PluvClientOptions, type PluvProcedureConfig, PluvRoom, type PluvRoomAddon, type PluvRoomAddonInput, type PluvRoomAddonResult, type PluvRoomDebug, PluvRouter, type PluvRouterEventConfig, type UserInfo, type WebSocketConnection, type WebSocketState, createClient };
385
+ interface RegisterParams<TMetadata extends JsonObject> {
386
+ authEndpoint: AuthEndpoint<TMetadata>;
387
+ publicKey: string;
388
+ }
389
+ declare const register: <TMetadata extends JsonObject>(params: RegisterParams<TMetadata>) => {
390
+ authEndpoint: AuthEndpoint<TMetadata>;
391
+ publicKey: string;
392
+ wsEndpoint: (params: EndpointParams<TMetadata>) => string;
393
+ };
394
+
395
+ export { AbstractRoom, AbstractStorageStore, ConnectionState, type CreateRoomOptions, type MergeEvents, MockedRoom, type MockedRoomConfig, type MockedRoomEvents, PluvClient, type PluvClientOptions, type PluvProcedureConfig, PluvRoom, type PluvRoomAddon, type PluvRoomAddonInput, type PluvRoomAddonResult, type PluvRoomDebug, PluvRouter, type PluvRouterEventConfig, type RegisterParams, type UserInfo, type WebSocketConnection, type WebSocketState, createClient, register };
package/dist/index.js CHANGED
@@ -63,7 +63,8 @@ __export(src_exports, {
63
63
  MockedRoom: () => MockedRoom,
64
64
  PluvClient: () => PluvClient,
65
65
  PluvRoom: () => PluvRoom,
66
- createClient: () => createClient
66
+ createClient: () => createClient,
67
+ register: () => register
67
68
  });
68
69
  module.exports = __toCommonJS(src_exports);
69
70
 
@@ -1449,6 +1450,17 @@ var MockedRoom = class extends AbstractRoom {
1449
1450
  });
1450
1451
  }
1451
1452
  };
1453
+
1454
+ // src/register.ts
1455
+ var register = (params) => {
1456
+ const { authEndpoint, publicKey } = params;
1457
+ const wsEndpoint = ({ room }) => `wss://connect.pluv.io/api/room?room=${room}`;
1458
+ return {
1459
+ authEndpoint,
1460
+ publicKey,
1461
+ wsEndpoint
1462
+ };
1463
+ };
1452
1464
  // Annotate the CommonJS export names for ESM import in node:
1453
1465
  0 && (module.exports = {
1454
1466
  AbstractRoom,
@@ -1457,5 +1469,6 @@ var MockedRoom = class extends AbstractRoom {
1457
1469
  MockedRoom,
1458
1470
  PluvClient,
1459
1471
  PluvRoom,
1460
- createClient
1472
+ createClient,
1473
+ register
1461
1474
  });
package/dist/index.mjs CHANGED
@@ -1420,6 +1420,17 @@ var MockedRoom = class extends AbstractRoom {
1420
1420
  });
1421
1421
  }
1422
1422
  };
1423
+
1424
+ // src/register.ts
1425
+ var register = (params) => {
1426
+ const { authEndpoint, publicKey } = params;
1427
+ const wsEndpoint = ({ room }) => `wss://connect.pluv.io/api/room?room=${room}`;
1428
+ return {
1429
+ authEndpoint,
1430
+ publicKey,
1431
+ wsEndpoint
1432
+ };
1433
+ };
1423
1434
  export {
1424
1435
  AbstractRoom,
1425
1436
  AbstractStorageStore,
@@ -1427,5 +1438,6 @@ export {
1427
1438
  MockedRoom,
1428
1439
  PluvClient,
1429
1440
  PluvRoom,
1430
- createClient
1441
+ createClient,
1442
+ register
1431
1443
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/client",
3
- "version": "0.32.2",
3
+ "version": "0.32.4",
4
4
  "description": "@pluv/io frontend client",
5
5
  "author": "leedavidcs",
6
6
  "license": "MIT",
@@ -18,15 +18,15 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "wonka": "^6.3.4",
21
- "@pluv/crdt": "^0.32.2",
22
- "@pluv/types": "^0.32.2"
21
+ "@pluv/crdt": "^0.32.4",
22
+ "@pluv/types": "^0.32.4"
23
23
  },
24
24
  "devDependencies": {
25
25
  "eslint": "^8.57.0",
26
26
  "tsup": "^8.3.0",
27
- "typescript": "^5.6.2",
28
- "@pluv/tsconfig": "^0.32.2",
29
- "eslint-config-pluv": "^0.32.2"
27
+ "typescript": "^5.6.3",
28
+ "@pluv/tsconfig": "^0.32.4",
29
+ "eslint-config-pluv": "^0.32.4"
30
30
  },
31
31
  "scripts": {
32
32
  "build": "tsup src/index.ts --format esm,cjs --dts",
package/src/index.ts CHANGED
@@ -12,4 +12,6 @@ export type { PluvProcedureConfig } from "./PluvProcedure";
12
12
  export { PluvRoom } from "./PluvRoom";
13
13
  export type { PluvRoomAddon, PluvRoomAddonInput, PluvRoomAddonResult, PluvRoomDebug } from "./PluvRoom";
14
14
  export type { MergeEvents, PluvRouter, PluvRouterEventConfig } from "./PluvRouter";
15
+ export { register } from "./register";
16
+ export type { RegisterParams } from "./register";
15
17
  export type { UserInfo, WebSocketConnection, WebSocketState } from "./types";
@@ -0,0 +1,19 @@
1
+ import type { JsonObject } from "@pluv/types";
2
+ import type { AuthEndpoint, WsEndpoint } from "./PluvRoom";
3
+
4
+ export interface RegisterParams<TMetadata extends JsonObject> {
5
+ authEndpoint: AuthEndpoint<TMetadata>;
6
+ publicKey: string;
7
+ }
8
+
9
+ export const register = <TMetadata extends JsonObject>(params: RegisterParams<TMetadata>) => {
10
+ const { authEndpoint, publicKey } = params;
11
+
12
+ const wsEndpoint: WsEndpoint<TMetadata> = ({ room }) => `wss://connect.pluv.io/api/room?room=${room}`;
13
+
14
+ return {
15
+ authEndpoint,
16
+ publicKey,
17
+ wsEndpoint,
18
+ };
19
+ };