@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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @pluv/platform-node@0.32.9 build /home/runner/work/pluv/pluv/packages/platform-node
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
  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 8.13 KB
12
- ESM ⚡️ Build success in 78ms
13
- CJS dist/index.js 9.89 KB
14
- CJS ⚡️ Build success in 79ms
11
+ ESM dist/index.mjs 8.49 KB
12
+ ESM ⚡️ Build success in 65ms
13
+ CJS dist/index.js 10.26 KB
14
+ CJS ⚡️ Build success in 101ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 5454ms
17
- DTS dist/index.d.mts 4.17 KB
18
- DTS dist/index.d.ts 4.17 KB
16
+ DTS ⚡️ Build success in 5617ms
17
+ DTS dist/index.d.mts 4.91 KB
18
+ DTS dist/index.d.ts 4.91 KB
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
- readonly _registrationMode: WebSocketRegistrationMode;
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
- readonly _registrationMode: WebSocketRegistrationMode;
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 src_exports = {};
66
- __export(src_exports, {
65
+ var index_exports = {};
66
+ __export(index_exports, {
67
67
  createPluvHandler: () => createPluvHandler,
68
68
  platformNode: () => platformNode
69
69
  });
70
- module.exports = __toCommonJS(src_exports);
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._registrationMode === "detached") {
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._registrationMode = mode;
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._registrationMode,
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._registrationMode === "detached") {
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._registrationMode = mode;
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._registrationMode,
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.32.9",
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.8.4",
21
- "@types/ws": "^8.5.12",
20
+ "@types/node": "^22.10.2",
21
+ "@types/ws": "^8.5.13",
22
22
  "path-to-regexp": "^8.2.0",
23
- "@pluv/io": "^0.32.9",
24
- "@pluv/types": "^0.32.9"
23
+ "@pluv/io": "^0.34.0",
24
+ "@pluv/types": "^0.34.0"
25
25
  },
26
26
  "devDependencies": {
27
- "eslint": "^8.57.0",
27
+ "eslint": "^8.57.1",
28
28
  "tsup": "^8.3.5",
29
- "typescript": "^5.6.3",
29
+ "typescript": "^5.7.2",
30
30
  "ws": "^8.18.0",
31
- "@pluv/tsconfig": "^0.32.9",
32
- "eslint-config-pluv": "^0.32.9"
31
+ "@pluv/tsconfig": "^0.34.0",
32
+ "eslint-config-pluv": "^0.34.0"
33
33
  },
34
34
  "peerDependencies": {
35
35
  "ws": "^8.0.0"
@@ -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 _registrationMode: WebSocketRegistrationMode;
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._registrationMode = mode;
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._registrationMode,
105
+ mode: this._config.registrationMode,
74
106
  persistence: this.persistence,
75
107
  pubSub: this.pubSub,
76
108
  } as NodePlatformConfig<TMeta>)._initialize() as this;
@@ -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._registrationMode === "detached") {
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