@pluv/platform-node 0.32.9 → 0.34.0
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 +20 -0
- package/dist/index.d.mts +33 -2
- package/dist/index.d.ts +33 -2
- package/dist/index.js +22 -6
- package/dist/index.mjs +19 -3
- package/package.json +9 -9
- package/src/NodePlatform.ts +36 -4
- 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.34.0 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
|
-
[32mESM[39m [1mdist/index.mjs [22m[32m8.
|
|
12
|
-
[32mESM[39m ⚡️ Build success in
|
|
13
|
-
[32mCJS[39m [1mdist/index.js [22m[
|
|
14
|
-
[32mCJS[39m ⚡️ Build success in
|
|
11
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m8.49 KB[39m
|
|
12
|
+
[32mESM[39m ⚡️ Build success in 65ms
|
|
13
|
+
[32mCJS[39m [1mdist/index.js [22m[32m10.26 KB[39m
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 101ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
17
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[32m4.
|
|
18
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m4.
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 5617ms
|
|
17
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m4.91 KB[39m
|
|
18
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m4.91 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @pluv/platform-node
|
|
2
2
|
|
|
3
|
+
## 0.34.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 70af3b2: Updated `@pluv/io` to have a `handleMode` internally that determines if connections are handled by the `PluvServer` or by the platform itself (i.e. outside of the `PluvServer`). The internals of `@pluv/platform-node` and `@pluv/platform-cloudflare` have been updated with the required changes for this.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- Updated dependencies [0c920ea]
|
|
12
|
+
- Updated dependencies [70af3b2]
|
|
13
|
+
- @pluv/io@0.34.0
|
|
14
|
+
- @pluv/types@0.34.0
|
|
15
|
+
|
|
16
|
+
## 0.33.0
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- @pluv/io@0.33.0
|
|
21
|
+
- @pluv/types@0.33.0
|
|
22
|
+
|
|
3
23
|
## 0.32.9
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -38,8 +38,39 @@ type NodePlatformConfig<TMeta extends Record<string, Json>> = {
|
|
|
38
38
|
};
|
|
39
39
|
declare class NodePlatform<TMeta extends Record<string, Json> = {}> extends AbstractPlatform<NodeWebSocket, {
|
|
40
40
|
req: IncomingMessage;
|
|
41
|
-
}, NodePlatformRoomContext<TMeta
|
|
42
|
-
|
|
41
|
+
}, NodePlatformRoomContext<TMeta>, {
|
|
42
|
+
authorize: {
|
|
43
|
+
required: true;
|
|
44
|
+
secret: true;
|
|
45
|
+
};
|
|
46
|
+
handleMode: "io";
|
|
47
|
+
requireAuth: false;
|
|
48
|
+
registrationMode: WebSocketRegistrationMode;
|
|
49
|
+
listeners: {
|
|
50
|
+
onRoomDeleted: true;
|
|
51
|
+
onRoomMessage: true;
|
|
52
|
+
onStorageUpdated: true;
|
|
53
|
+
onUserConnected: true;
|
|
54
|
+
onUserDisconnected: true;
|
|
55
|
+
};
|
|
56
|
+
}> {
|
|
57
|
+
readonly _config: {
|
|
58
|
+
authorize: {
|
|
59
|
+
required: true;
|
|
60
|
+
secret: true;
|
|
61
|
+
};
|
|
62
|
+
handleMode: "io";
|
|
63
|
+
registrationMode: WebSocketRegistrationMode;
|
|
64
|
+
requireAuth: false;
|
|
65
|
+
listeners: {
|
|
66
|
+
onRoomDeleted: true;
|
|
67
|
+
onRoomMessage: true;
|
|
68
|
+
onStorageUpdated: true;
|
|
69
|
+
onUserConnected: true;
|
|
70
|
+
onUserDisconnected: true;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
readonly _name = "platformNode";
|
|
43
74
|
constructor(config?: NodePlatformConfig<TMeta>);
|
|
44
75
|
acceptWebSocket(webSocket: NodeWebSocket): Promise<void>;
|
|
45
76
|
convertWebSocket(webSocket: WebSocket, config: ConvertWebSocketConfig): NodeWebSocket;
|
package/dist/index.d.ts
CHANGED
|
@@ -38,8 +38,39 @@ type NodePlatformConfig<TMeta extends Record<string, Json>> = {
|
|
|
38
38
|
};
|
|
39
39
|
declare class NodePlatform<TMeta extends Record<string, Json> = {}> extends AbstractPlatform<NodeWebSocket, {
|
|
40
40
|
req: IncomingMessage;
|
|
41
|
-
}, NodePlatformRoomContext<TMeta
|
|
42
|
-
|
|
41
|
+
}, NodePlatformRoomContext<TMeta>, {
|
|
42
|
+
authorize: {
|
|
43
|
+
required: true;
|
|
44
|
+
secret: true;
|
|
45
|
+
};
|
|
46
|
+
handleMode: "io";
|
|
47
|
+
requireAuth: false;
|
|
48
|
+
registrationMode: WebSocketRegistrationMode;
|
|
49
|
+
listeners: {
|
|
50
|
+
onRoomDeleted: true;
|
|
51
|
+
onRoomMessage: true;
|
|
52
|
+
onStorageUpdated: true;
|
|
53
|
+
onUserConnected: true;
|
|
54
|
+
onUserDisconnected: true;
|
|
55
|
+
};
|
|
56
|
+
}> {
|
|
57
|
+
readonly _config: {
|
|
58
|
+
authorize: {
|
|
59
|
+
required: true;
|
|
60
|
+
secret: true;
|
|
61
|
+
};
|
|
62
|
+
handleMode: "io";
|
|
63
|
+
registrationMode: WebSocketRegistrationMode;
|
|
64
|
+
requireAuth: false;
|
|
65
|
+
listeners: {
|
|
66
|
+
onRoomDeleted: true;
|
|
67
|
+
onRoomMessage: true;
|
|
68
|
+
onStorageUpdated: true;
|
|
69
|
+
onUserConnected: true;
|
|
70
|
+
onUserDisconnected: true;
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
readonly _name = "platformNode";
|
|
43
74
|
constructor(config?: NodePlatformConfig<TMeta>);
|
|
44
75
|
acceptWebSocket(webSocket: NodeWebSocket): Promise<void>;
|
|
45
76
|
convertWebSocket(webSocket: WebSocket, config: ConvertWebSocketConfig): NodeWebSocket;
|
package/dist/index.js
CHANGED
|
@@ -62,12 +62,12 @@ var __async = (__this, __arguments, generator) => {
|
|
|
62
62
|
};
|
|
63
63
|
|
|
64
64
|
// src/index.ts
|
|
65
|
-
var
|
|
66
|
-
__export(
|
|
65
|
+
var index_exports = {};
|
|
66
|
+
__export(index_exports, {
|
|
67
67
|
createPluvHandler: () => createPluvHandler,
|
|
68
68
|
platformNode: () => platformNode
|
|
69
69
|
});
|
|
70
|
-
module.exports = __toCommonJS(
|
|
70
|
+
module.exports = __toCommonJS(index_exports);
|
|
71
71
|
|
|
72
72
|
// src/createPluvHandler.ts
|
|
73
73
|
var import_node_url = __toESM(require("url"));
|
|
@@ -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._defs.platform.
|
|
92
|
+
if (io._defs.platform._config.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 });
|
|
@@ -250,7 +250,23 @@ var NodePlatform = class _NodePlatform extends import_io2.AbstractPlatform {
|
|
|
250
250
|
super(__spreadValues({
|
|
251
251
|
context
|
|
252
252
|
}, persistence && pubSub ? { persistence, pubSub } : {}));
|
|
253
|
-
this.
|
|
253
|
+
this._name = "platformNode";
|
|
254
|
+
this._config = {
|
|
255
|
+
authorize: {
|
|
256
|
+
required: true,
|
|
257
|
+
secret: true
|
|
258
|
+
},
|
|
259
|
+
handleMode: "io",
|
|
260
|
+
registrationMode: mode,
|
|
261
|
+
requireAuth: false,
|
|
262
|
+
listeners: {
|
|
263
|
+
onRoomDeleted: true,
|
|
264
|
+
onRoomMessage: true,
|
|
265
|
+
onStorageUpdated: true,
|
|
266
|
+
onUserConnected: true,
|
|
267
|
+
onUserDisconnected: true
|
|
268
|
+
}
|
|
269
|
+
};
|
|
254
270
|
}
|
|
255
271
|
acceptWebSocket(webSocket) {
|
|
256
272
|
return Promise.resolve(void 0);
|
|
@@ -274,7 +290,7 @@ var NodePlatform = class _NodePlatform extends import_io2.AbstractPlatform {
|
|
|
274
290
|
initialize(config) {
|
|
275
291
|
return new _NodePlatform({
|
|
276
292
|
context: config.context,
|
|
277
|
-
mode: this.
|
|
293
|
+
mode: this._config.registrationMode,
|
|
278
294
|
persistence: this.persistence,
|
|
279
295
|
pubSub: this.pubSub
|
|
280
296
|
})._initialize();
|
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._defs.platform.
|
|
58
|
+
if (io._defs.platform._config.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 });
|
|
@@ -216,7 +216,23 @@ var NodePlatform = class _NodePlatform extends AbstractPlatform {
|
|
|
216
216
|
super(__spreadValues({
|
|
217
217
|
context
|
|
218
218
|
}, persistence && pubSub ? { persistence, pubSub } : {}));
|
|
219
|
-
this.
|
|
219
|
+
this._name = "platformNode";
|
|
220
|
+
this._config = {
|
|
221
|
+
authorize: {
|
|
222
|
+
required: true,
|
|
223
|
+
secret: true
|
|
224
|
+
},
|
|
225
|
+
handleMode: "io",
|
|
226
|
+
registrationMode: mode,
|
|
227
|
+
requireAuth: false,
|
|
228
|
+
listeners: {
|
|
229
|
+
onRoomDeleted: true,
|
|
230
|
+
onRoomMessage: true,
|
|
231
|
+
onStorageUpdated: true,
|
|
232
|
+
onUserConnected: true,
|
|
233
|
+
onUserDisconnected: true
|
|
234
|
+
}
|
|
235
|
+
};
|
|
220
236
|
}
|
|
221
237
|
acceptWebSocket(webSocket) {
|
|
222
238
|
return Promise.resolve(void 0);
|
|
@@ -240,7 +256,7 @@ var NodePlatform = class _NodePlatform extends AbstractPlatform {
|
|
|
240
256
|
initialize(config) {
|
|
241
257
|
return new _NodePlatform({
|
|
242
258
|
context: config.context,
|
|
243
|
-
mode: this.
|
|
259
|
+
mode: this._config.registrationMode,
|
|
244
260
|
persistence: this.persistence,
|
|
245
261
|
pubSub: this.pubSub
|
|
246
262
|
})._initialize();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/platform-node",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.34.0",
|
|
4
4
|
"description": "@pluv/io adapter for node.js",
|
|
5
5
|
"author": "leedavidcs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -17,19 +17,19 @@
|
|
|
17
17
|
"access": "public"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@types/node": "^22.
|
|
21
|
-
"@types/ws": "^8.5.
|
|
20
|
+
"@types/node": "^22.10.2",
|
|
21
|
+
"@types/ws": "^8.5.13",
|
|
22
22
|
"path-to-regexp": "^8.2.0",
|
|
23
|
-
"@pluv/io": "^0.
|
|
24
|
-
"@pluv/types": "^0.
|
|
23
|
+
"@pluv/io": "^0.34.0",
|
|
24
|
+
"@pluv/types": "^0.34.0"
|
|
25
25
|
},
|
|
26
26
|
"devDependencies": {
|
|
27
|
-
"eslint": "^8.57.
|
|
27
|
+
"eslint": "^8.57.1",
|
|
28
28
|
"tsup": "^8.3.5",
|
|
29
|
-
"typescript": "^5.
|
|
29
|
+
"typescript": "^5.7.2",
|
|
30
30
|
"ws": "^8.18.0",
|
|
31
|
-
"@pluv/tsconfig": "^0.
|
|
32
|
-
"eslint-config-pluv": "^0.
|
|
31
|
+
"@pluv/tsconfig": "^0.34.0",
|
|
32
|
+
"eslint-config-pluv": "^0.34.0"
|
|
33
33
|
},
|
|
34
34
|
"peerDependencies": {
|
|
35
35
|
"ws": "^8.0.0"
|
package/src/NodePlatform.ts
CHANGED
|
@@ -26,9 +26,26 @@ export type NodePlatformConfig<TMeta extends Record<string, Json>> = { mode?: We
|
|
|
26
26
|
export class NodePlatform<TMeta extends Record<string, Json> = {}> extends AbstractPlatform<
|
|
27
27
|
NodeWebSocket,
|
|
28
28
|
{ req: IncomingMessage },
|
|
29
|
-
NodePlatformRoomContext<TMeta
|
|
29
|
+
NodePlatformRoomContext<TMeta>,
|
|
30
|
+
{
|
|
31
|
+
authorize: {
|
|
32
|
+
required: true;
|
|
33
|
+
secret: true;
|
|
34
|
+
};
|
|
35
|
+
handleMode: "io";
|
|
36
|
+
requireAuth: false;
|
|
37
|
+
registrationMode: WebSocketRegistrationMode;
|
|
38
|
+
listeners: {
|
|
39
|
+
onRoomDeleted: true;
|
|
40
|
+
onRoomMessage: true;
|
|
41
|
+
onStorageUpdated: true;
|
|
42
|
+
onUserConnected: true;
|
|
43
|
+
onUserDisconnected: true;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
30
46
|
> {
|
|
31
|
-
readonly
|
|
47
|
+
public readonly _config;
|
|
48
|
+
public readonly _name = "platformNode";
|
|
32
49
|
|
|
33
50
|
constructor(config: NodePlatformConfig<TMeta> = {}) {
|
|
34
51
|
const { context, mode = "attached", persistence, pubSub } = config;
|
|
@@ -38,7 +55,22 @@ export class NodePlatform<TMeta extends Record<string, Json> = {}> extends Abstr
|
|
|
38
55
|
...(persistence && pubSub ? { persistence, pubSub } : {}),
|
|
39
56
|
});
|
|
40
57
|
|
|
41
|
-
this.
|
|
58
|
+
this._config = {
|
|
59
|
+
authorize: {
|
|
60
|
+
required: true as const,
|
|
61
|
+
secret: true as const,
|
|
62
|
+
},
|
|
63
|
+
handleMode: "io" as const,
|
|
64
|
+
registrationMode: mode,
|
|
65
|
+
requireAuth: false as const,
|
|
66
|
+
listeners: {
|
|
67
|
+
onRoomDeleted: true as const,
|
|
68
|
+
onRoomMessage: true as const,
|
|
69
|
+
onStorageUpdated: true as const,
|
|
70
|
+
onUserConnected: true as const,
|
|
71
|
+
onUserDisconnected: true as const,
|
|
72
|
+
},
|
|
73
|
+
};
|
|
42
74
|
}
|
|
43
75
|
|
|
44
76
|
public acceptWebSocket(webSocket: NodeWebSocket): Promise<void> {
|
|
@@ -70,7 +102,7 @@ export class NodePlatform<TMeta extends Record<string, Json> = {}> extends Abstr
|
|
|
70
102
|
public initialize(config: AbstractPlatformConfig<NodePlatformRoomContext<TMeta>>): this {
|
|
71
103
|
return new NodePlatform({
|
|
72
104
|
context: config.context,
|
|
73
|
-
mode: this.
|
|
105
|
+
mode: this._config.registrationMode,
|
|
74
106
|
persistence: this.persistence,
|
|
75
107
|
pubSub: this.pubSub,
|
|
76
108
|
} as NodePlatformConfig<TMeta>)._initialize() as this;
|
package/src/createPluvHandler.ts
CHANGED
|
@@ -66,7 +66,7 @@ export const createPluvHandler = <TPluvServer extends PluvServer<NodePlatform, a
|
|
|
66
66
|
): CreatePluvHandlerResult => {
|
|
67
67
|
const { authorize, endpoint = "/api/pluv", io, server } = config;
|
|
68
68
|
|
|
69
|
-
if (io._defs.platform.
|
|
69
|
+
if (io._defs.platform._config.registrationMode === "detached") {
|
|
70
70
|
throw new Error("Cannot use createPluvHandler in detached mode for Node.js");
|
|
71
71
|
}
|
|
72
72
|
|