@pluv/client 0.32.2 → 0.32.3
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/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +25 -0
- package/dist/index.d.mts +11 -1
- package/dist/index.d.ts +11 -1
- package/dist/index.js +15 -2
- package/dist/index.mjs +13 -1
- package/package.json +6 -6
- package/src/index.ts +2 -0
- package/src/register.ts +19 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @pluv/client@0.32.
|
|
2
|
+
> @pluv/client@0.32.3 build /home/runner/work/pluv/pluv/packages/client
|
|
3
3
|
> tsup src/index.ts --format esm,cjs --dts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
[34mCLI[39m Target: es6
|
|
9
9
|
[34mESM[39m Build start
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
|
-
[32mESM[39m [1mdist/index.mjs [22m[
|
|
12
|
-
[32mESM[39m ⚡️ Build success in
|
|
13
|
-
[32mCJS[39m [1mdist/index.js [22m[32m48.
|
|
14
|
-
[32mCJS[39m ⚡️ Build success in
|
|
11
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m47.16 KB[39m
|
|
12
|
+
[32mESM[39m ⚡️ Build success in 91ms
|
|
13
|
+
[32mCJS[39m [1mdist/index.js [22m[32m48.45 KB[39m
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 96ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
17
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[32m22.
|
|
18
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m22.
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 3545ms
|
|
17
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m22.72 KB[39m
|
|
18
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m22.72 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# @pluv/client
|
|
2
2
|
|
|
3
|
+
## 0.32.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- b18230f: Add `register` helper to improve client initialization when hosted on pluv.io.
|
|
8
|
+
|
|
9
|
+
```ts
|
|
10
|
+
import { createClient, register } from "@pluv/client";
|
|
11
|
+
import type { ioServer } from "./server";
|
|
12
|
+
|
|
13
|
+
const client = createClient({
|
|
14
|
+
infer: (i) => ({ io: i<typeof ioServer> }),
|
|
15
|
+
// This includes `wsEndpoint` and therefore should no-longer be manually provided
|
|
16
|
+
...register({
|
|
17
|
+
// `authEndpoint` and `publicKey` are now required
|
|
18
|
+
authEndpoint: ({ room }) =>
|
|
19
|
+
`${process.env.API_URL}/api/room?room=${room}`,
|
|
20
|
+
publicKey: "pk_...",
|
|
21
|
+
}),
|
|
22
|
+
});
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
- @pluv/crdt@0.32.3
|
|
26
|
+
- @pluv/types@0.32.3
|
|
27
|
+
|
|
3
28
|
## 0.32.2
|
|
4
29
|
|
|
5
30
|
### 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
|
-
|
|
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
|
-
|
|
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.
|
|
3
|
+
"version": "0.32.3",
|
|
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.
|
|
22
|
-
"@pluv/types": "^0.32.
|
|
21
|
+
"@pluv/crdt": "^0.32.3",
|
|
22
|
+
"@pluv/types": "^0.32.3"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"eslint": "^8.57.0",
|
|
26
26
|
"tsup": "^8.3.0",
|
|
27
|
-
"typescript": "^5.6.
|
|
28
|
-
"@pluv/tsconfig": "^0.32.
|
|
29
|
-
"eslint-config-pluv": "^0.32.
|
|
27
|
+
"typescript": "^5.6.3",
|
|
28
|
+
"@pluv/tsconfig": "^0.32.3",
|
|
29
|
+
"eslint-config-pluv": "^0.32.3"
|
|
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";
|
package/src/register.ts
ADDED
|
@@ -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
|
+
};
|