@pluv/platform-pluv 2.1.0 → 2.2.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-pluv@2.1.0 build /home/runner/work/pluv/pluv/packages/platform-pluv
2
+ > @pluv/platform-pluv@2.2.0 build /home/runner/work/pluv/pluv/packages/platform-pluv
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
- CJS dist/index.js 14.15 KB
12
- CJS ⚡️ Build success in 111ms
13
- ESM dist/index.mjs 12.32 KB
14
- ESM ⚡️ Build success in 111ms
11
+ ESM dist/index.mjs 12.46 KB
12
+ ESM ⚡️ Build success in 83ms
13
+ CJS dist/index.js 14.29 KB
14
+ CJS ⚡️ Build success in 81ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 6386ms
16
+ DTS ⚡️ Build success in 7205ms
17
17
  DTS dist/index.d.mts 3.67 KB
18
18
  DTS dist/index.d.ts 3.67 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # @pluv/platform-pluv
2
2
 
3
+ ## 2.2.0
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [cb660cd]
8
+ - @pluv/io@2.2.0
9
+ - @pluv/crdt@2.2.0
10
+ - @pluv/types@2.2.0
11
+
3
12
  ## 2.1.0
4
13
 
5
14
  ### Patch Changes
package/dist/index.js CHANGED
@@ -302,7 +302,13 @@ var PluvPlatform = class extends import_io.AbstractPlatform {
302
302
  const encodedState = data.storage;
303
303
  const user = data.user;
304
304
  yield Promise.resolve(
305
- (_f = this._listeners) == null ? void 0 : _f.onUserConnected({ context, encodedState, room, user })
305
+ (_f = this._listeners) == null ? void 0 : _f.onUserConnected({
306
+ context,
307
+ encodedState,
308
+ platform: this,
309
+ room,
310
+ user
311
+ })
306
312
  );
307
313
  return createSuccessResponse(c, { event, room });
308
314
  }
@@ -314,6 +320,7 @@ var PluvPlatform = class extends import_io.AbstractPlatform {
314
320
  (_g = this._listeners) == null ? void 0 : _g.onUserDisconnected({
315
321
  context,
316
322
  encodedState,
323
+ platform: this,
317
324
  room,
318
325
  user
319
326
  })
@@ -406,7 +413,7 @@ var platformPluv = (config) => {
406
413
  context,
407
414
  crdt,
408
415
  debug,
409
- platform: new PluvPlatform(config)
416
+ platform: () => new PluvPlatform(config)
410
417
  };
411
418
  };
412
419
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.mjs CHANGED
@@ -272,7 +272,13 @@ var PluvPlatform = class extends AbstractPlatform {
272
272
  const encodedState = data.storage;
273
273
  const user = data.user;
274
274
  yield Promise.resolve(
275
- (_f = this._listeners) == null ? void 0 : _f.onUserConnected({ context, encodedState, room, user })
275
+ (_f = this._listeners) == null ? void 0 : _f.onUserConnected({
276
+ context,
277
+ encodedState,
278
+ platform: this,
279
+ room,
280
+ user
281
+ })
276
282
  );
277
283
  return createSuccessResponse(c, { event, room });
278
284
  }
@@ -284,6 +290,7 @@ var PluvPlatform = class extends AbstractPlatform {
284
290
  (_g = this._listeners) == null ? void 0 : _g.onUserDisconnected({
285
291
  context,
286
292
  encodedState,
293
+ platform: this,
287
294
  room,
288
295
  user
289
296
  })
@@ -376,7 +383,7 @@ var platformPluv = (config) => {
376
383
  context,
377
384
  crdt,
378
385
  debug,
379
- platform: new PluvPlatform(config)
386
+ platform: () => new PluvPlatform(config)
380
387
  };
381
388
  };
382
389
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/platform-pluv",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "@pluv/io adapter for pluv.io",
5
5
  "author": "leedavidcs",
6
6
  "license": "MIT",
@@ -17,20 +17,20 @@
17
17
  "access": "public"
18
18
  },
19
19
  "dependencies": {
20
- "@types/node": "^22.15.17",
20
+ "@types/node": "^22.15.18",
21
21
  "fast-json-stable-stringify": "^2.1.0",
22
22
  "hono": "^4.7.9",
23
23
  "zod": "^3.24.4",
24
- "@pluv/crdt": "^2.1.0",
25
- "@pluv/types": "^2.1.0",
26
- "@pluv/io": "^2.1.0"
24
+ "@pluv/crdt": "^2.2.0",
25
+ "@pluv/io": "^2.2.0",
26
+ "@pluv/types": "^2.2.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "eslint": "^9.26.0",
30
30
  "tsup": "^8.4.0",
31
31
  "typescript": "^5.8.3",
32
- "@pluv/tsconfig": "^2.1.0",
33
- "eslint-config-pluv": "^2.1.0"
32
+ "@pluv/tsconfig": "^2.2.0",
33
+ "eslint-config-pluv": "^2.2.0"
34
34
  },
35
35
  "scripts": {
36
36
  "build": "tsup src/index.ts --format esm,cjs --dts",
@@ -265,7 +265,13 @@ export class PluvPlatform<
265
265
  const user = data.user as any;
266
266
 
267
267
  await Promise.resolve(
268
- this._listeners?.onUserConnected({ context, encodedState, room, user }),
268
+ this._listeners?.onUserConnected({
269
+ context,
270
+ encodedState,
271
+ platform: this,
272
+ room,
273
+ user,
274
+ }),
269
275
  );
270
276
 
271
277
  return createSuccessResponse(c, { event, room });
@@ -279,6 +285,7 @@ export class PluvPlatform<
279
285
  this._listeners?.onUserDisconnected({
280
286
  context,
281
287
  encodedState,
288
+ platform: this,
282
289
  room,
283
290
  user,
284
291
  }),
@@ -30,6 +30,6 @@ export const platformPluv = <
30
30
  context,
31
31
  crdt,
32
32
  debug,
33
- platform: new PluvPlatform<TContext, TUser>(config),
33
+ platform: () => new PluvPlatform<TContext, TUser>(config),
34
34
  };
35
35
  };
package/src/types.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import type {
2
2
  BaseUser,
3
3
  GetInitialStorageFn,
4
- IORoomListenerEvent,
5
4
  IOUserConnectedEvent,
6
5
  IOUserDisconnectedEvent,
7
6
  } from "@pluv/io";
@@ -21,6 +20,12 @@ export interface PluvIOEndpoints {
21
20
  createToken: string;
22
21
  }
23
22
 
23
+ export type IORoomListenerEvent<TContext extends Record<string, any>> = {
24
+ context: TContext;
25
+ encodedState: string | null;
26
+ room: string;
27
+ };
28
+
24
29
  export type PluvIOListeners<
25
30
  TContext extends Record<string, any> = {},
26
31
  TUser extends BaseUser = BaseUser,