@pluv/platform-node 0.24.1 → 0.25.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/.turbo/turbo-build.log +6 -6
- package/CHANGELOG.md +50 -0
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +5 -5
- package/dist/index.mjs +5 -5
- package/package.json +5 -5
- package/src/NodePlatform.ts +7 -7
- package/src/createPluvHandler.ts +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @pluv/platform-node@0.
|
|
2
|
+
> @pluv/platform-node@0.25.1 build /home/runner/work/pluv/pluv/packages/platform-node
|
|
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
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
11
|
+
[32mCJS[39m [1mdist/index.js [22m[32m9.84 KB[39m
|
|
12
|
+
[32mCJS[39m ⚡️ Build success in 95ms
|
|
13
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m8.07 KB[39m
|
|
14
|
+
[32mESM[39m ⚡️ Build success in 95ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 3838ms
|
|
17
17
|
[32mDTS[39m [1mdist/index.d.mts [22m[32m3.60 KB[39m
|
|
18
18
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m3.60 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,55 @@
|
|
|
1
1
|
# @pluv/platform-node
|
|
2
2
|
|
|
3
|
+
## 0.25.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [3925f7c]
|
|
8
|
+
- @pluv/io@0.25.1
|
|
9
|
+
- @pluv/types@0.25.1
|
|
10
|
+
|
|
11
|
+
## 0.25.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- 9db06ba: **BREAKING **
|
|
16
|
+
|
|
17
|
+
Fixed typos `persistance` to `persistence`.
|
|
18
|
+
|
|
19
|
+
This does mean that all properties referencing `persistance` will need to be fixed. Examples below:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Re-install @pluv/persistence-redis
|
|
23
|
+
pnpm uninstall @pluv/persistance-redis
|
|
24
|
+
pnpm install @pluv/persistence-redis
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
```ts
|
|
28
|
+
// Before
|
|
29
|
+
createIO({
|
|
30
|
+
platform: platformNode({
|
|
31
|
+
persistance: new PersistanceRedis(/* ... */),
|
|
32
|
+
}),
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// After
|
|
36
|
+
createIO({
|
|
37
|
+
platform: platformNode({
|
|
38
|
+
persistence: new PersistenceRedis(/* ... */),
|
|
39
|
+
}),
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`@pluv/persistance-redis` has been deprecated for `@pluv/persistence-redis`.
|
|
44
|
+
|
|
45
|
+
### Patch Changes
|
|
46
|
+
|
|
47
|
+
- Updated dependencies [4e078ca]
|
|
48
|
+
- Updated dependencies [f556d30]
|
|
49
|
+
- Updated dependencies [9db06ba]
|
|
50
|
+
- @pluv/io@0.25.0
|
|
51
|
+
- @pluv/types@0.25.0
|
|
52
|
+
|
|
3
53
|
## 0.24.1
|
|
4
54
|
|
|
5
55
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AbstractWebSocket, WebSocketSerializedState, AbstractEventMap, AbstractListener, AbstractWebSocketConfig, WebSocketRegistrationMode,
|
|
1
|
+
import { AbstractWebSocket, WebSocketSerializedState, AbstractEventMap, AbstractListener, AbstractWebSocketConfig, WebSocketRegistrationMode, AbstractPersistence, AbstractPubSub, AbstractPlatform, ConvertWebSocketConfig, AbstractPlatformConfig, PluvServer } from '@pluv/io';
|
|
2
2
|
import { JsonObject, MaybePromise, Maybe, InferIOAuthorizeUser, InferIOAuthorize, InferIOAuthorizeRequired } from '@pluv/types';
|
|
3
3
|
import { IncomingMessage, ServerResponse, Server } from 'node:http';
|
|
4
4
|
import { WebSocket, Server as Server$1 } from 'ws';
|
|
@@ -23,10 +23,10 @@ declare class NodeWebSocket extends AbstractWebSocket<WebSocket> {
|
|
|
23
23
|
type NodePlatformConfig = {
|
|
24
24
|
mode?: WebSocketRegistrationMode;
|
|
25
25
|
} & ({
|
|
26
|
-
|
|
26
|
+
persistence?: undefined;
|
|
27
27
|
pubSub?: undefined;
|
|
28
28
|
} | {
|
|
29
|
-
|
|
29
|
+
persistence: AbstractPersistence;
|
|
30
30
|
pubSub: AbstractPubSub;
|
|
31
31
|
});
|
|
32
32
|
declare class NodePlatform extends AbstractPlatform<NodeWebSocket> {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AbstractWebSocket, WebSocketSerializedState, AbstractEventMap, AbstractListener, AbstractWebSocketConfig, WebSocketRegistrationMode,
|
|
1
|
+
import { AbstractWebSocket, WebSocketSerializedState, AbstractEventMap, AbstractListener, AbstractWebSocketConfig, WebSocketRegistrationMode, AbstractPersistence, AbstractPubSub, AbstractPlatform, ConvertWebSocketConfig, AbstractPlatformConfig, PluvServer } from '@pluv/io';
|
|
2
2
|
import { JsonObject, MaybePromise, Maybe, InferIOAuthorizeUser, InferIOAuthorize, InferIOAuthorizeRequired } from '@pluv/types';
|
|
3
3
|
import { IncomingMessage, ServerResponse, Server } from 'node:http';
|
|
4
4
|
import { WebSocket, Server as Server$1 } from 'ws';
|
|
@@ -23,10 +23,10 @@ declare class NodeWebSocket extends AbstractWebSocket<WebSocket> {
|
|
|
23
23
|
type NodePlatformConfig = {
|
|
24
24
|
mode?: WebSocketRegistrationMode;
|
|
25
25
|
} & ({
|
|
26
|
-
|
|
26
|
+
persistence?: undefined;
|
|
27
27
|
pubSub?: undefined;
|
|
28
28
|
} | {
|
|
29
|
-
|
|
29
|
+
persistence: AbstractPersistence;
|
|
30
30
|
pubSub: AbstractPubSub;
|
|
31
31
|
});
|
|
32
32
|
declare class NodePlatform extends AbstractPlatform<NodeWebSocket> {
|
package/dist/index.js
CHANGED
|
@@ -89,7 +89,7 @@ var handle = (ws) => ({
|
|
|
89
89
|
});
|
|
90
90
|
var createPluvHandler = (config) => {
|
|
91
91
|
const { authorize, endpoint = "/api/pluv", io, server } = config;
|
|
92
|
-
if (io._registrationMode === "detached") {
|
|
92
|
+
if (io._defs.platform._registrationMode === "detached") {
|
|
93
93
|
throw new Error("Cannot use createPluvHandler in detached mode for Node.js");
|
|
94
94
|
}
|
|
95
95
|
const wsServer = new import_ws.Server({ server });
|
|
@@ -246,8 +246,8 @@ var NodeWebSocket = class extends import_io.AbstractWebSocket {
|
|
|
246
246
|
// src/NodePlatform.ts
|
|
247
247
|
var NodePlatform = class _NodePlatform extends import_io2.AbstractPlatform {
|
|
248
248
|
constructor(config = {}) {
|
|
249
|
-
const { mode = "attached",
|
|
250
|
-
super(
|
|
249
|
+
const { mode = "attached", persistence, pubSub } = config;
|
|
250
|
+
super(persistence && pubSub ? { persistence, pubSub } : {});
|
|
251
251
|
this._registrationMode = mode;
|
|
252
252
|
}
|
|
253
253
|
acceptWebSocket(webSocket) {
|
|
@@ -255,7 +255,7 @@ var NodePlatform = class _NodePlatform extends import_io2.AbstractPlatform {
|
|
|
255
255
|
}
|
|
256
256
|
convertWebSocket(webSocket, config) {
|
|
257
257
|
const { room } = config;
|
|
258
|
-
return new NodeWebSocket(webSocket, {
|
|
258
|
+
return new NodeWebSocket(webSocket, { persistence: this.persistence, room });
|
|
259
259
|
}
|
|
260
260
|
getLastPing(webSocket) {
|
|
261
261
|
return null;
|
|
@@ -272,7 +272,7 @@ var NodePlatform = class _NodePlatform extends import_io2.AbstractPlatform {
|
|
|
272
272
|
initialize(config) {
|
|
273
273
|
return new _NodePlatform(__spreadValues({
|
|
274
274
|
mode: this._registrationMode,
|
|
275
|
-
|
|
275
|
+
persistence: this.persistence,
|
|
276
276
|
pubSub: this.pubSub
|
|
277
277
|
}, config))._initialize();
|
|
278
278
|
}
|
package/dist/index.mjs
CHANGED
|
@@ -55,7 +55,7 @@ var handle = (ws) => ({
|
|
|
55
55
|
});
|
|
56
56
|
var createPluvHandler = (config) => {
|
|
57
57
|
const { authorize, endpoint = "/api/pluv", io, server } = config;
|
|
58
|
-
if (io._registrationMode === "detached") {
|
|
58
|
+
if (io._defs.platform._registrationMode === "detached") {
|
|
59
59
|
throw new Error("Cannot use createPluvHandler in detached mode for Node.js");
|
|
60
60
|
}
|
|
61
61
|
const wsServer = new WsServer({ server });
|
|
@@ -212,8 +212,8 @@ var NodeWebSocket = class extends AbstractWebSocket {
|
|
|
212
212
|
// src/NodePlatform.ts
|
|
213
213
|
var NodePlatform = class _NodePlatform extends AbstractPlatform {
|
|
214
214
|
constructor(config = {}) {
|
|
215
|
-
const { mode = "attached",
|
|
216
|
-
super(
|
|
215
|
+
const { mode = "attached", persistence, pubSub } = config;
|
|
216
|
+
super(persistence && pubSub ? { persistence, pubSub } : {});
|
|
217
217
|
this._registrationMode = mode;
|
|
218
218
|
}
|
|
219
219
|
acceptWebSocket(webSocket) {
|
|
@@ -221,7 +221,7 @@ var NodePlatform = class _NodePlatform extends AbstractPlatform {
|
|
|
221
221
|
}
|
|
222
222
|
convertWebSocket(webSocket, config) {
|
|
223
223
|
const { room } = config;
|
|
224
|
-
return new NodeWebSocket(webSocket, {
|
|
224
|
+
return new NodeWebSocket(webSocket, { persistence: this.persistence, room });
|
|
225
225
|
}
|
|
226
226
|
getLastPing(webSocket) {
|
|
227
227
|
return null;
|
|
@@ -238,7 +238,7 @@ var NodePlatform = class _NodePlatform extends AbstractPlatform {
|
|
|
238
238
|
initialize(config) {
|
|
239
239
|
return new _NodePlatform(__spreadValues({
|
|
240
240
|
mode: this._registrationMode,
|
|
241
|
-
|
|
241
|
+
persistence: this.persistence,
|
|
242
242
|
pubSub: this.pubSub
|
|
243
243
|
}, config))._initialize();
|
|
244
244
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/platform-node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.25.1",
|
|
4
4
|
"description": "@pluv/io adapter for node.js",
|
|
5
5
|
"author": "leedavidcs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,16 +20,16 @@
|
|
|
20
20
|
"@types/node": "^22.5.0",
|
|
21
21
|
"@types/ws": "^8.5.12",
|
|
22
22
|
"path-to-regexp": "^7.1.0",
|
|
23
|
-
"@pluv/io": "^0.
|
|
24
|
-
"@pluv/types": "^0.
|
|
23
|
+
"@pluv/io": "^0.25.1",
|
|
24
|
+
"@pluv/types": "^0.25.1"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
27
|
"eslint": "^8.57.0",
|
|
28
28
|
"tsup": "^8.2.4",
|
|
29
29
|
"typescript": "^5.5.4",
|
|
30
30
|
"ws": "^8.18.0",
|
|
31
|
-
"@pluv/tsconfig": "^0.
|
|
32
|
-
"eslint-config-pluv": "^0.
|
|
31
|
+
"@pluv/tsconfig": "^0.25.1",
|
|
32
|
+
"eslint-config-pluv": "^0.25.1"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"ws": "^8.0.0"
|
package/src/NodePlatform.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type {
|
|
2
|
-
|
|
2
|
+
AbstractPersistence,
|
|
3
3
|
AbstractPlatformConfig,
|
|
4
4
|
AbstractPubSub,
|
|
5
5
|
ConvertWebSocketConfig,
|
|
@@ -13,17 +13,17 @@ import type { WebSocket } from "ws";
|
|
|
13
13
|
import { NodeWebSocket } from "./NodeWebSocket";
|
|
14
14
|
|
|
15
15
|
export type NodePlatformConfig = { mode?: WebSocketRegistrationMode } & (
|
|
16
|
-
| {
|
|
17
|
-
| {
|
|
16
|
+
| { persistence?: undefined; pubSub?: undefined }
|
|
17
|
+
| { persistence: AbstractPersistence; pubSub: AbstractPubSub }
|
|
18
18
|
);
|
|
19
19
|
|
|
20
20
|
export class NodePlatform extends AbstractPlatform<NodeWebSocket> {
|
|
21
21
|
readonly _registrationMode: WebSocketRegistrationMode;
|
|
22
22
|
|
|
23
23
|
constructor(config: NodePlatformConfig = {}) {
|
|
24
|
-
const { mode = "attached",
|
|
24
|
+
const { mode = "attached", persistence, pubSub } = config;
|
|
25
25
|
|
|
26
|
-
super(
|
|
26
|
+
super(persistence && pubSub ? { persistence, pubSub } : {});
|
|
27
27
|
|
|
28
28
|
this._registrationMode = mode;
|
|
29
29
|
}
|
|
@@ -35,7 +35,7 @@ export class NodePlatform extends AbstractPlatform<NodeWebSocket> {
|
|
|
35
35
|
public convertWebSocket(webSocket: WebSocket, config: ConvertWebSocketConfig): NodeWebSocket {
|
|
36
36
|
const { room } = config;
|
|
37
37
|
|
|
38
|
-
return new NodeWebSocket(webSocket, {
|
|
38
|
+
return new NodeWebSocket(webSocket, { persistence: this.persistence, room });
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
public getLastPing(webSocket: NodeWebSocket): number | null {
|
|
@@ -57,7 +57,7 @@ export class NodePlatform extends AbstractPlatform<NodeWebSocket> {
|
|
|
57
57
|
public initialize(config: AbstractPlatformConfig<{}, {}>): this {
|
|
58
58
|
return new NodePlatform({
|
|
59
59
|
mode: this._registrationMode,
|
|
60
|
-
|
|
60
|
+
persistence: this.persistence,
|
|
61
61
|
pubSub: this.pubSub,
|
|
62
62
|
...config,
|
|
63
63
|
} as NodePlatformConfig)._initialize() as this;
|
package/src/createPluvHandler.ts
CHANGED
|
@@ -67,7 +67,7 @@ export const createPluvHandler = <TPluvServer extends PluvServer<NodePlatform, a
|
|
|
67
67
|
): CreatePluvHandlerResult => {
|
|
68
68
|
const { authorize, endpoint = "/api/pluv", io, server } = config;
|
|
69
69
|
|
|
70
|
-
if (io._registrationMode === "detached") {
|
|
70
|
+
if (io._defs.platform._registrationMode === "detached") {
|
|
71
71
|
throw new Error("Cannot use createPluvHandler in detached mode for Node.js");
|
|
72
72
|
}
|
|
73
73
|
|