@pluv/client 3.2.0 → 3.2.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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @pluv/client@3.2.0 build /home/runner/work/pluv/pluv/packages/client
2
+ > @pluv/client@3.2.1 build /home/runner/work/pluv/pluv/packages/client
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 63.39 KB
12
- ESM ⚡️ Build success in 133ms
13
- CJS dist/index.js 65.12 KB
14
- CJS ⚡️ Build success in 133ms
11
+ ESM dist/index.mjs 64.01 KB
12
+ ESM ⚡️ Build success in 121ms
13
+ CJS dist/index.js 65.75 KB
14
+ CJS ⚡️ Build success in 121ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 4612ms
17
- DTS dist/index.d.mts 19.16 KB
18
- DTS dist/index.d.ts 19.16 KB
16
+ DTS ⚡️ Build success in 4493ms
17
+ DTS dist/index.d.mts 19.14 KB
18
+ DTS dist/index.d.ts 19.14 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # @pluv/client
2
2
 
3
+ ## 3.2.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 1e0c886: Updated crdt internal private properties to use native [private elements](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/Private_elements).
8
+ - @pluv/crdt@3.2.1
9
+ - @pluv/types@3.2.1
10
+
3
11
  ## 3.2.0
4
12
 
5
13
  ### Patch Changes
@@ -1382,7 +1390,6 @@
1382
1390
  ### Minor Changes
1383
1391
 
1384
1392
  - 99b5ca9: ## Breaking Changes
1385
-
1386
1393
  - `@pluv/io` has been updated to introduce `PluvProcedure`, `PluvRouter` and `PluvServer`. This change is intended to improve the ergonomics of declaring events and simplifying inferences of event types.
1387
1394
 
1388
1395
  ### Before:
@@ -1584,7 +1591,6 @@
1584
1591
  ### Minor Changes
1585
1592
 
1586
1593
  - 4280220: ## Breaking Changes
1587
-
1588
1594
  - Storage types are now kept on the root of the document.
1589
1595
  - Previously, `@pluv/crdt-yjs` kept all shared-types on a hidden Yjs Map called `storage` on the root of the Yjs Doc. Now all shared-types are kept on the root of the Yjs Doc instead. This behavior should be more in-line with how shared-types are documented to be used from Yjs.
1590
1596
  - `@pluv/client` and `@pluv/react` no-longer re-export `@pluv/crdt-yjs`. This package will now need to be installed separately.
@@ -2088,7 +2094,6 @@
2088
2094
  ### Patch Changes
2089
2095
 
2090
2096
  - f4317ba: \* Renamed type `unstable_YObjectValue` to `YObjectValue`;
2091
-
2092
2097
  - Renamed type `unstable_YObject` to `YObject`.
2093
2098
  - Re-exported `xmlElement`, `xmlFragment` and `xmlText` from `@pluv/client`.
2094
2099
 
package/dist/index.d.mts CHANGED
@@ -142,6 +142,7 @@ type RoomConfig<TIO extends IOLike, TMetadata extends JsonObject, TPresence exte
142
142
  router?: PluvRouter<TIO, TPresence, InferStorage<TCrdt>, TEvents>;
143
143
  } & RoomEndpoints<TIO, TMetadata> & Pick<CrdtManagerOptions<TCrdt>, "initialStorage"> & UsersManagerConfig<TPresence>>;
144
144
  declare class PluvRoom<TIO extends IOLike<any, any, any>, TMetadata extends JsonObject = {}, TPresence extends Record<string, any> = {}, TCrdt extends AbstractCrdtDocFactory<any, any> = NoopCrdtDocFactory, TEvents extends PluvRouterEventConfig<TIO, TPresence, InferStorage<TCrdt>> = {}> implements RoomLike<TIO, InferDoc<TCrdt>, TPresence, InferStorage<TCrdt>> {
145
+ #private;
145
146
  readonly _endpoints: RoomEndpoints<TIO, TMetadata>;
146
147
  readonly id: string;
147
148
  readonly metadata?: InputZodLike<TMetadata>;
@@ -236,7 +237,6 @@ declare class PluvRoom<TIO extends IOLike<any, any, any>, TMetadata extends Json
236
237
  private _reconnect;
237
238
  private _sendMessage;
238
239
  private _setMetadata;
239
- private _storage;
240
240
  private _updateState;
241
241
  }
242
242
 
@@ -301,6 +301,7 @@ type MockedRoomConfig<TIO extends IOLike, TPresence extends Record<string, any>,
301
301
  router?: PluvRouter<TIO, TPresence, InferStorage<TCrdt>, TEvents>;
302
302
  } & Pick<CrdtManagerOptions<TCrdt>, "initialStorage"> & Omit<UsersManagerConfig<TPresence>, "limits">;
303
303
  declare class MockedRoom<TIO extends IOLike, TPresence extends Record<string, any>, TCrdt extends AbstractCrdtDocFactory<any, any>, TEvents extends PluvRouterEventConfig<TIO, TPresence, InferStorage<TCrdt>>> implements RoomLike<TIO, InferDoc<TCrdt>, TPresence, InferStorage<TCrdt>> {
304
+ #private;
304
305
  readonly id: string;
305
306
  private readonly _crdtManager;
306
307
  private readonly _crdtNotifier;
@@ -338,7 +339,6 @@ declare class MockedRoom<TIO extends IOLike, TPresence extends Record<string, an
338
339
  private _observeCrdt;
339
340
  private _other;
340
341
  private _simulateEvent;
341
- private _storage;
342
342
  }
343
343
 
344
344
  interface RegisterParams<TMetadata extends JsonObject> {
package/dist/index.d.ts CHANGED
@@ -142,6 +142,7 @@ type RoomConfig<TIO extends IOLike, TMetadata extends JsonObject, TPresence exte
142
142
  router?: PluvRouter<TIO, TPresence, InferStorage<TCrdt>, TEvents>;
143
143
  } & RoomEndpoints<TIO, TMetadata> & Pick<CrdtManagerOptions<TCrdt>, "initialStorage"> & UsersManagerConfig<TPresence>>;
144
144
  declare class PluvRoom<TIO extends IOLike<any, any, any>, TMetadata extends JsonObject = {}, TPresence extends Record<string, any> = {}, TCrdt extends AbstractCrdtDocFactory<any, any> = NoopCrdtDocFactory, TEvents extends PluvRouterEventConfig<TIO, TPresence, InferStorage<TCrdt>> = {}> implements RoomLike<TIO, InferDoc<TCrdt>, TPresence, InferStorage<TCrdt>> {
145
+ #private;
145
146
  readonly _endpoints: RoomEndpoints<TIO, TMetadata>;
146
147
  readonly id: string;
147
148
  readonly metadata?: InputZodLike<TMetadata>;
@@ -236,7 +237,6 @@ declare class PluvRoom<TIO extends IOLike<any, any, any>, TMetadata extends Json
236
237
  private _reconnect;
237
238
  private _sendMessage;
238
239
  private _setMetadata;
239
- private _storage;
240
240
  private _updateState;
241
241
  }
242
242
 
@@ -301,6 +301,7 @@ type MockedRoomConfig<TIO extends IOLike, TPresence extends Record<string, any>,
301
301
  router?: PluvRouter<TIO, TPresence, InferStorage<TCrdt>, TEvents>;
302
302
  } & Pick<CrdtManagerOptions<TCrdt>, "initialStorage"> & Omit<UsersManagerConfig<TPresence>, "limits">;
303
303
  declare class MockedRoom<TIO extends IOLike, TPresence extends Record<string, any>, TCrdt extends AbstractCrdtDocFactory<any, any>, TEvents extends PluvRouterEventConfig<TIO, TPresence, InferStorage<TCrdt>>> implements RoomLike<TIO, InferDoc<TCrdt>, TPresence, InferStorage<TCrdt>> {
304
+ #private;
304
305
  readonly id: string;
305
306
  private readonly _crdtManager;
306
307
  private readonly _crdtNotifier;
@@ -338,7 +339,6 @@ declare class MockedRoom<TIO extends IOLike, TPresence extends Record<string, an
338
339
  private _observeCrdt;
339
340
  private _other;
340
341
  private _simulateEvent;
341
- private _storage;
342
342
  }
343
343
 
344
344
  interface RegisterParams<TMetadata extends JsonObject> {
package/dist/index.js CHANGED
@@ -7,6 +7,9 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
7
7
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
8
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
9
9
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
+ var __typeError = (msg) => {
11
+ throw TypeError(msg);
12
+ };
10
13
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
14
  var __spreadValues = (a, b) => {
12
15
  for (var prop in b || (b = {}))
@@ -33,6 +36,9 @@ var __copyProps = (to, from, except, desc) => {
33
36
  return to;
34
37
  };
35
38
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
39
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
40
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
41
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
36
42
  var __async = (__this, __arguments, generator) => {
37
43
  return new Promise((resolve, reject) => {
38
44
  var fulfilled = (value) => {
@@ -589,6 +595,7 @@ var ORIGIN_STORAGE_UPDATED = "$storageUpdated";
589
595
  var DEFAULT_PLUV_CLIENT_ADDON = (input) => ({
590
596
  storage: new StorageStore(input.room.id)
591
597
  });
598
+ var __storage;
592
599
  var PluvRoom = class {
593
600
  constructor(room, options) {
594
601
  this._crdtNotifier = new CrdtNotifier();
@@ -723,7 +730,7 @@ var PluvRoom = class {
723
730
  }
724
731
  if (prop === "event") return this._event;
725
732
  if (prop === "other") return this._other;
726
- if (prop === "storage") return this._storage;
733
+ if (prop === "storage") return __privateGet(this, __storage);
727
734
  }
728
735
  }
729
736
  );
@@ -781,7 +788,7 @@ var PluvRoom = class {
781
788
  if (!clientId) return () => void 0;
782
789
  return this._usersNotifier.subscribeOther(clientId, callback);
783
790
  };
784
- this._storage = new Proxy(
791
+ __privateAdd(this, __storage, new Proxy(
785
792
  (key, callback) => this._crdtNotifier.subscribe(key, callback),
786
793
  {
787
794
  get: (fn, prop) => {
@@ -795,7 +802,7 @@ var PluvRoom = class {
795
802
  };
796
803
  }
797
804
  }
798
- );
805
+ ));
799
806
  const {
800
807
  addons = [],
801
808
  authEndpoint,
@@ -1562,6 +1569,7 @@ var PluvRoom = class {
1562
1569
  return newState;
1563
1570
  }
1564
1571
  };
1572
+ __storage = new WeakMap();
1565
1573
 
1566
1574
  // src/PluvClient.ts
1567
1575
  var PluvClient = class {
@@ -1667,6 +1675,7 @@ var infer = (callback) => callback;
1667
1675
 
1668
1676
  // src/MockedRoom.ts
1669
1677
  var import_types2 = require("@pluv/types");
1678
+ var __storage2;
1670
1679
  var MockedRoom = class {
1671
1680
  constructor(room, options) {
1672
1681
  this._crdtNotifier = new CrdtNotifier();
@@ -1788,7 +1797,7 @@ var MockedRoom = class {
1788
1797
  }
1789
1798
  if (prop === "event") return this._event;
1790
1799
  if (prop === "other") return this._other;
1791
- if (prop === "storage") return this._storage;
1800
+ if (prop === "storage") return __privateGet(this, __storage2);
1792
1801
  }
1793
1802
  }
1794
1803
  );
@@ -1827,7 +1836,7 @@ var MockedRoom = class {
1827
1836
  if (!clientId) return () => void 0;
1828
1837
  return this._usersNotifier.subscribeOther(clientId, callback);
1829
1838
  };
1830
- this._storage = new Proxy(
1839
+ __privateAdd(this, __storage2, new Proxy(
1831
1840
  (key, callback) => this._crdtNotifier.subscribe(key, callback),
1832
1841
  {
1833
1842
  get: (fn, prop) => {
@@ -1841,7 +1850,7 @@ var MockedRoom = class {
1841
1850
  };
1842
1851
  }
1843
1852
  }
1844
- );
1853
+ ));
1845
1854
  const { events, initialPresence, initialStorage, limits, presence, router } = options;
1846
1855
  this.id = room;
1847
1856
  this._events = events;
@@ -1910,6 +1919,7 @@ var MockedRoom = class {
1910
1919
  });
1911
1920
  }
1912
1921
  };
1922
+ __storage2 = new WeakMap();
1913
1923
 
1914
1924
  // src/register.ts
1915
1925
  var register = (params) => {
package/dist/index.mjs CHANGED
@@ -4,6 +4,9 @@ var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
4
4
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
6
  var __propIsEnum = Object.prototype.propertyIsEnumerable;
7
+ var __typeError = (msg) => {
8
+ throw TypeError(msg);
9
+ };
7
10
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
8
11
  var __spreadValues = (a, b) => {
9
12
  for (var prop in b || (b = {}))
@@ -17,6 +20,9 @@ var __spreadValues = (a, b) => {
17
20
  return a;
18
21
  };
19
22
  var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
23
+ var __accessCheck = (obj, member, msg) => member.has(obj) || __typeError("Cannot " + msg);
24
+ var __privateGet = (obj, member, getter) => (__accessCheck(obj, member, "read from private field"), getter ? getter.call(obj) : member.get(obj));
25
+ var __privateAdd = (obj, member, value) => member.has(obj) ? __typeError("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
20
26
  var __async = (__this, __arguments, generator) => {
21
27
  return new Promise((resolve, reject) => {
22
28
  var fulfilled = (value) => {
@@ -561,6 +567,7 @@ var ORIGIN_STORAGE_UPDATED = "$storageUpdated";
561
567
  var DEFAULT_PLUV_CLIENT_ADDON = (input) => ({
562
568
  storage: new StorageStore(input.room.id)
563
569
  });
570
+ var __storage;
564
571
  var PluvRoom = class {
565
572
  constructor(room, options) {
566
573
  this._crdtNotifier = new CrdtNotifier();
@@ -695,7 +702,7 @@ var PluvRoom = class {
695
702
  }
696
703
  if (prop === "event") return this._event;
697
704
  if (prop === "other") return this._other;
698
- if (prop === "storage") return this._storage;
705
+ if (prop === "storage") return __privateGet(this, __storage);
699
706
  }
700
707
  }
701
708
  );
@@ -753,7 +760,7 @@ var PluvRoom = class {
753
760
  if (!clientId) return () => void 0;
754
761
  return this._usersNotifier.subscribeOther(clientId, callback);
755
762
  };
756
- this._storage = new Proxy(
763
+ __privateAdd(this, __storage, new Proxy(
757
764
  (key, callback) => this._crdtNotifier.subscribe(key, callback),
758
765
  {
759
766
  get: (fn, prop) => {
@@ -767,7 +774,7 @@ var PluvRoom = class {
767
774
  };
768
775
  }
769
776
  }
770
- );
777
+ ));
771
778
  const {
772
779
  addons = [],
773
780
  authEndpoint,
@@ -1534,6 +1541,7 @@ var PluvRoom = class {
1534
1541
  return newState;
1535
1542
  }
1536
1543
  };
1544
+ __storage = new WeakMap();
1537
1545
 
1538
1546
  // src/PluvClient.ts
1539
1547
  var PluvClient = class {
@@ -1639,6 +1647,7 @@ var infer = (callback) => callback;
1639
1647
 
1640
1648
  // src/MockedRoom.ts
1641
1649
  import { ConnectionState as ConnectionState2, StorageState as StorageState2 } from "@pluv/types";
1650
+ var __storage2;
1642
1651
  var MockedRoom = class {
1643
1652
  constructor(room, options) {
1644
1653
  this._crdtNotifier = new CrdtNotifier();
@@ -1760,7 +1769,7 @@ var MockedRoom = class {
1760
1769
  }
1761
1770
  if (prop === "event") return this._event;
1762
1771
  if (prop === "other") return this._other;
1763
- if (prop === "storage") return this._storage;
1772
+ if (prop === "storage") return __privateGet(this, __storage2);
1764
1773
  }
1765
1774
  }
1766
1775
  );
@@ -1799,7 +1808,7 @@ var MockedRoom = class {
1799
1808
  if (!clientId) return () => void 0;
1800
1809
  return this._usersNotifier.subscribeOther(clientId, callback);
1801
1810
  };
1802
- this._storage = new Proxy(
1811
+ __privateAdd(this, __storage2, new Proxy(
1803
1812
  (key, callback) => this._crdtNotifier.subscribe(key, callback),
1804
1813
  {
1805
1814
  get: (fn, prop) => {
@@ -1813,7 +1822,7 @@ var MockedRoom = class {
1813
1822
  };
1814
1823
  }
1815
1824
  }
1816
- );
1825
+ ));
1817
1826
  const { events, initialPresence, initialStorage, limits, presence, router } = options;
1818
1827
  this.id = room;
1819
1828
  this._events = events;
@@ -1882,6 +1891,7 @@ var MockedRoom = class {
1882
1891
  });
1883
1892
  }
1884
1893
  };
1894
+ __storage2 = new WeakMap();
1885
1895
 
1886
1896
  // src/register.ts
1887
1897
  var register = (params) => {
package/package.json CHANGED
@@ -1,8 +1,12 @@
1
1
  {
2
2
  "name": "@pluv/client",
3
- "version": "3.2.0",
3
+ "version": "3.2.1",
4
4
  "description": "@pluv/io frontend client",
5
- "author": "leedavidcs",
5
+ "author": {
6
+ "email": "david@pluv.io",
7
+ "name": "i3dly",
8
+ "url": "https://github.com/i3dly"
9
+ },
6
10
  "license": "MIT",
7
11
  "homepage": "https://github.com/pluv-io/pluv",
8
12
  "repository": {
@@ -18,15 +22,15 @@
18
22
  },
19
23
  "dependencies": {
20
24
  "wonka": "^6.3.5",
21
- "@pluv/crdt": "^3.2.0",
22
- "@pluv/types": "^3.2.0"
25
+ "@pluv/crdt": "^3.2.1",
26
+ "@pluv/types": "^3.2.1"
23
27
  },
24
28
  "devDependencies": {
25
- "eslint": "^9.28.0",
29
+ "eslint": "^9.31.0",
26
30
  "tsup": "^8.5.0",
27
31
  "typescript": "^5.8.3",
28
- "@pluv/tsconfig": "^3.2.0",
29
- "eslint-config-pluv": "^3.2.0"
32
+ "@pluv/tsconfig": "^3.2.1",
33
+ "eslint-config-pluv": "^3.2.1"
30
34
  },
31
35
  "scripts": {
32
36
  "build": "tsup src/index.ts --format esm,cjs --dts",
package/src/MockedRoom.ts CHANGED
@@ -309,7 +309,7 @@ export class MockedRoom<
309
309
 
310
310
  if (prop === "event") return this._event;
311
311
  if (prop === "other") return this._other;
312
- if (prop === "storage") return this._storage;
312
+ if (prop === "storage") return this.#_storage;
313
313
  },
314
314
  },
315
315
  ) as SubscribeProxy<TIO, TPresence, InferStorage<TCrdt>, TEvents>;
@@ -434,7 +434,7 @@ export class MockedRoom<
434
434
  });
435
435
  }
436
436
 
437
- private _storage = new Proxy(
437
+ #_storage = new Proxy(
438
438
  <TKey extends keyof InferStorage<TCrdt>>(
439
439
  key: TKey,
440
440
  callback: StorageSubscriptionCallback<InferStorage<TCrdt>, TKey>,
package/src/PluvRoom.ts CHANGED
@@ -78,7 +78,6 @@ const ORIGIN_INITIALIZED = "$initialized";
78
78
  const ORIGIN_STORAGE_UPDATED = "$storageUpdated";
79
79
 
80
80
  declare global {
81
- // eslint-disable-next-line no-var
82
81
  var process: {
83
82
  env: {
84
83
  [key: string]: string | undefined;
@@ -586,7 +585,7 @@ export class PluvRoom<
586
585
 
587
586
  if (prop === "event") return this._event;
588
587
  if (prop === "other") return this._other;
589
- if (prop === "storage") return this._storage;
588
+ if (prop === "storage") return this.#_storage;
590
589
  },
591
590
  },
592
591
  ) as SubscribeProxy<TIO, TPresence, InferStorage<TCrdt>, TEvents>;
@@ -1561,7 +1560,7 @@ export class PluvRoom<
1561
1560
  return parsed;
1562
1561
  }
1563
1562
 
1564
- private _storage = new Proxy(
1563
+ #_storage = new Proxy(
1565
1564
  <TKey extends keyof InferStorage<TCrdt>>(
1566
1565
  key: TKey,
1567
1566
  callback: StorageSubscriptionCallback<InferStorage<TCrdt>, TKey>,