@pluv/client 0.12.2 → 0.13.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/client@0.12.2 build /home/runner/work/pluv/pluv/packages/client
2
+ > @pluv/client@0.13.0 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 42.81 KB
12
- ESM ⚡️ Build success in 96ms
13
- CJS dist/index.js 44.05 KB
14
- CJS ⚡️ Build success in 96ms
11
+ ESM dist/index.mjs 42.92 KB
12
+ ESM ⚡️ Build success in 84ms
13
+ CJS dist/index.js 44.17 KB
14
+ CJS ⚡️ Build success in 85ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 2895ms
17
- DTS dist/index.d.mts 14.24 KB
18
- DTS dist/index.d.ts 14.24 KB
16
+ DTS ⚡️ Build success in 2881ms
17
+ DTS dist/index.d.mts 14.31 KB
18
+ DTS dist/index.d.ts 14.31 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,35 @@
1
1
  # @pluv/client
2
2
 
3
+ ## 0.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 1126215: Added `getDoc` on `PluvRoom` to access the root Yjs doc.
8
+
9
+ ```ts
10
+ import { createClient } from "@pluv/client";
11
+ import type { Doc } from "yjs";
12
+
13
+ const client = createClient(/* ... */);
14
+ const room = client.createRoom(/* ... */);
15
+
16
+ const doc: Doc = room.getDoc();
17
+ ```
18
+
19
+ ### Patch Changes
20
+
21
+ - @pluv/crdt-yjs@0.13.0
22
+ - @pluv/types@0.13.0
23
+
24
+ ## 0.12.3
25
+
26
+ ### Patch Changes
27
+
28
+ - da9f600: Upgraded dependencies
29
+ - Updated dependencies [da9f600]
30
+ - @pluv/crdt-yjs@0.12.3
31
+ - @pluv/types@0.12.3
32
+
3
33
  ## 0.12.2
4
34
 
5
35
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -3,7 +3,7 @@ export { InferYjsSharedTypeJson, TrackOriginOptions } from '@pluv/crdt-yjs';
3
3
  import * as _pluv_types from '@pluv/types';
4
4
  import { IOLike, InferIOOutput, Id, IOEventMessage, JsonObject, InferIOAuthorizeUser, InferIOAuthorize, InferIOInput, InputZodLike, InferIOAuthorizeRequired } from '@pluv/types';
5
5
  export { BaseUser, EventMessage, EventRecord, IOEventMessage } from '@pluv/types';
6
- import { AbstractType } from 'yjs';
6
+ import { AbstractType, Doc } from 'yjs';
7
7
  export { AbstractType } from 'yjs';
8
8
  import { Subject } from 'wonka';
9
9
 
@@ -53,6 +53,7 @@ declare abstract class AbstractRoom<TIO extends IOLike, TPresence extends JsonOb
53
53
  abstract broadcast<TEvent extends keyof InferIOInput<TIO>>(event: TEvent, data: Id<InferIOInput<TIO>[TEvent]>): void;
54
54
  abstract canRedo(): boolean;
55
55
  abstract canUndo(): boolean;
56
+ abstract getDoc(): Doc;
56
57
  abstract event<TEvent extends keyof InferIOOutput<TIO>>(event: TEvent, callback: EventNotifierSubscriptionCallback<TIO, TEvent>): () => void;
57
58
  abstract getConnection(): WebSocketConnection;
58
59
  abstract getMyPresence(): TPresence;
@@ -158,6 +159,7 @@ declare class PluvRoom<TIO extends IOLike, TPresence extends JsonObject = {}, TS
158
159
  disconnect(): Promise<void>;
159
160
  event: <TEvent extends keyof InferIOOutput<TIO>>(event: TEvent, callback: EventNotifierSubscriptionCallback<TIO, TEvent>) => (() => void);
160
161
  getConnection(): WebSocketConnection;
162
+ getDoc(): Doc;
161
163
  getMyPresence: () => TPresence;
162
164
  getMyself: () => Id<UserInfo<TIO, TPresence>> | null;
163
165
  getOther: (connectionId: string) => Id<UserInfo<TIO, TPresence>> | null;
@@ -264,6 +266,7 @@ declare class MockedRoom<TIO extends IOLike, TPresence extends JsonObject = {},
264
266
  canUndo: () => boolean;
265
267
  event: <TEvent extends keyof InferIOOutput<TIO>>(event: TEvent, callback: EventNotifierSubscriptionCallback<TIO, TEvent>) => (() => void);
266
268
  getConnection(): WebSocketConnection;
269
+ getDoc(): Doc;
267
270
  getMyPresence: () => TPresence;
268
271
  getMyself: () => Id<UserInfo<TIO, TPresence>> | null;
269
272
  getOther: (connectionId: string) => Id<UserInfo<TIO, TPresence>> | null;
package/dist/index.d.ts CHANGED
@@ -3,7 +3,7 @@ export { InferYjsSharedTypeJson, TrackOriginOptions } from '@pluv/crdt-yjs';
3
3
  import * as _pluv_types from '@pluv/types';
4
4
  import { IOLike, InferIOOutput, Id, IOEventMessage, JsonObject, InferIOAuthorizeUser, InferIOAuthorize, InferIOInput, InputZodLike, InferIOAuthorizeRequired } from '@pluv/types';
5
5
  export { BaseUser, EventMessage, EventRecord, IOEventMessage } from '@pluv/types';
6
- import { AbstractType } from 'yjs';
6
+ import { AbstractType, Doc } from 'yjs';
7
7
  export { AbstractType } from 'yjs';
8
8
  import { Subject } from 'wonka';
9
9
 
@@ -53,6 +53,7 @@ declare abstract class AbstractRoom<TIO extends IOLike, TPresence extends JsonOb
53
53
  abstract broadcast<TEvent extends keyof InferIOInput<TIO>>(event: TEvent, data: Id<InferIOInput<TIO>[TEvent]>): void;
54
54
  abstract canRedo(): boolean;
55
55
  abstract canUndo(): boolean;
56
+ abstract getDoc(): Doc;
56
57
  abstract event<TEvent extends keyof InferIOOutput<TIO>>(event: TEvent, callback: EventNotifierSubscriptionCallback<TIO, TEvent>): () => void;
57
58
  abstract getConnection(): WebSocketConnection;
58
59
  abstract getMyPresence(): TPresence;
@@ -158,6 +159,7 @@ declare class PluvRoom<TIO extends IOLike, TPresence extends JsonObject = {}, TS
158
159
  disconnect(): Promise<void>;
159
160
  event: <TEvent extends keyof InferIOOutput<TIO>>(event: TEvent, callback: EventNotifierSubscriptionCallback<TIO, TEvent>) => (() => void);
160
161
  getConnection(): WebSocketConnection;
162
+ getDoc(): Doc;
161
163
  getMyPresence: () => TPresence;
162
164
  getMyself: () => Id<UserInfo<TIO, TPresence>> | null;
163
165
  getOther: (connectionId: string) => Id<UserInfo<TIO, TPresence>> | null;
@@ -264,6 +266,7 @@ declare class MockedRoom<TIO extends IOLike, TPresence extends JsonObject = {},
264
266
  canUndo: () => boolean;
265
267
  event: <TEvent extends keyof InferIOOutput<TIO>>(event: TEvent, callback: EventNotifierSubscriptionCallback<TIO, TEvent>) => (() => void);
266
268
  getConnection(): WebSocketConnection;
269
+ getDoc(): Doc;
267
270
  getMyPresence: () => TPresence;
268
271
  getMyself: () => Id<UserInfo<TIO, TPresence>> | null;
269
272
  getOther: (connectionId: string) => Id<UserInfo<TIO, TPresence>> | null;
package/dist/index.js CHANGED
@@ -638,6 +638,9 @@ var PluvRoom = class extends AbstractRoom {
638
638
  JSON.parse(JSON.stringify(this._state.connection))
639
639
  );
640
640
  }
641
+ getDoc() {
642
+ return this._crdtManager.doc.value;
643
+ }
641
644
  _addToStorageStore(update) {
642
645
  return __async(this, null, function* () {
643
646
  yield this._storageStore.addUpdate(update);
@@ -1411,6 +1414,9 @@ var MockedRoom = class extends AbstractRoom {
1411
1414
  JSON.parse(JSON.stringify(this._state.connection))
1412
1415
  );
1413
1416
  }
1417
+ getDoc() {
1418
+ return this._crdtManager.doc.value;
1419
+ }
1414
1420
  _observeCrdt() {
1415
1421
  var _a, _b;
1416
1422
  (_b = (_a = this._subscriptions).observeCrdt) == null ? void 0 : _b.call(_a);
package/dist/index.mjs CHANGED
@@ -612,6 +612,9 @@ var PluvRoom = class extends AbstractRoom {
612
612
  JSON.parse(JSON.stringify(this._state.connection))
613
613
  );
614
614
  }
615
+ getDoc() {
616
+ return this._crdtManager.doc.value;
617
+ }
615
618
  _addToStorageStore(update) {
616
619
  return __async(this, null, function* () {
617
620
  yield this._storageStore.addUpdate(update);
@@ -1385,6 +1388,9 @@ var MockedRoom = class extends AbstractRoom {
1385
1388
  JSON.parse(JSON.stringify(this._state.connection))
1386
1389
  );
1387
1390
  }
1391
+ getDoc() {
1392
+ return this._crdtManager.doc.value;
1393
+ }
1388
1394
  _observeCrdt() {
1389
1395
  var _a, _b;
1390
1396
  (_b = (_a = this._subscriptions).observeCrdt) == null ? void 0 : _b.call(_a);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/client",
3
- "version": "0.12.2",
3
+ "version": "0.13.0",
4
4
  "description": "@pluv/io frontend client",
5
5
  "author": "leedavidcs",
6
6
  "license": "MIT",
@@ -18,19 +18,19 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "wonka": "^6.3.4",
21
- "@pluv/crdt-yjs": "^0.12.2",
22
- "@pluv/types": "^0.12.2"
21
+ "@pluv/crdt-yjs": "^0.13.0",
22
+ "@pluv/types": "^0.13.0"
23
23
  },
24
24
  "peerDependencies": {
25
25
  "yjs": "^13.0.0"
26
26
  },
27
27
  "devDependencies": {
28
- "eslint": "^8.54.0",
28
+ "eslint": "^8.55.0",
29
29
  "tsup": "^8.0.1",
30
30
  "typescript": "^5.2.2",
31
31
  "yjs": "^13.6.10",
32
- "@pluv/tsconfig": "^0.12.2",
33
- "eslint-config-pluv": "^0.12.2"
32
+ "@pluv/tsconfig": "^0.13.0",
33
+ "eslint-config-pluv": "^0.13.0"
34
34
  },
35
35
  "scripts": {
36
36
  "build": "tsup src/index.ts --format esm,cjs --dts",
@@ -6,7 +6,7 @@ import type {
6
6
  IOLike,
7
7
  JsonObject,
8
8
  } from "@pluv/types";
9
- import type { AbstractType } from "yjs";
9
+ import type { AbstractType, Doc } from "yjs";
10
10
  import type { EventNotifierSubscriptionCallback } from "./EventNotifier";
11
11
  import type { OtherNotifierSubscriptionCallback } from "./OtherNotifier";
12
12
  import type {
@@ -35,6 +35,8 @@ export abstract class AbstractRoom<
35
35
 
36
36
  public abstract canUndo(): boolean;
37
37
 
38
+ public abstract getDoc(): Doc;
39
+
38
40
  public abstract event<TEvent extends keyof InferIOOutput<TIO>>(
39
41
  event: TEvent,
40
42
  callback: EventNotifierSubscriptionCallback<TIO, TEvent>,
package/src/MockedRoom.ts CHANGED
@@ -6,7 +6,7 @@ import type {
6
6
  IOLike,
7
7
  JsonObject,
8
8
  } from "@pluv/types";
9
- import type { AbstractType } from "yjs";
9
+ import type { AbstractType, Doc } from "yjs";
10
10
  import { AbstractRoom } from "./AbstractRoom";
11
11
  import { CrdtManager, CrdtManagerOptions } from "./CrdtManager";
12
12
  import { CrdtNotifier } from "./CrdtNotifier";
@@ -139,6 +139,10 @@ export class MockedRoom<
139
139
  );
140
140
  }
141
141
 
142
+ public getDoc(): Doc {
143
+ return this._crdtManager.doc.value;
144
+ }
145
+
142
146
  public getMyPresence = (): TPresence => {
143
147
  return this._usersManager.myPresence;
144
148
  };
package/src/PluvRoom.ts CHANGED
@@ -12,7 +12,7 @@ import type {
12
12
  IOLike,
13
13
  JsonObject,
14
14
  } from "@pluv/types";
15
- import type { AbstractType } from "yjs";
15
+ import type { AbstractType, Doc } from "yjs";
16
16
  import { AbstractRoom } from "./AbstractRoom";
17
17
  import { AbstractStorageStore } from "./AbstractStorageStore";
18
18
  import type { CrdtManagerOptions } from "./CrdtManager";
@@ -364,6 +364,10 @@ export class PluvRoom<
364
364
  );
365
365
  }
366
366
 
367
+ public getDoc(): Doc {
368
+ return this._crdtManager.doc.value;
369
+ }
370
+
367
371
  public getMyPresence = (): TPresence => {
368
372
  return this._usersManager.myPresence;
369
373
  };