@pluv/crdt-yjs 0.3.6 → 0.3.7

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/crdt-yjs@0.3.6 build /home/runner/work/pluv/pluv/packages/crdt-yjs
2
+ > @pluv/crdt-yjs@0.3.7 build /home/runner/work/pluv/pluv/packages/crdt-yjs
3
3
  > tsup src/index.ts --format esm,cjs --dts
4
4
 
5
5
  CLI Building entry: src/index.ts
@@ -8,10 +8,10 @@
8
8
  CLI Target: es6
9
9
  ESM Build start
10
10
  CJS Build start
11
- CJS dist/index.js 4.69 KB
12
- CJS ⚡️ Build success in 73ms
13
- ESM dist/index.mjs 3.50 KB
14
- ESM ⚡️ Build success in 74ms
11
+ ESM dist/index.mjs 3.57 KB
12
+ ESM ⚡️ Build success in 88ms
13
+ CJS dist/index.js 4.77 KB
14
+ CJS ⚡️ Build success in 89ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 1759ms
17
- DTS dist/index.d.ts 3.09 KB
16
+ DTS ⚡️ Build success in 2047ms
17
+ DTS dist/index.d.ts 3.10 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,16 @@
1
1
  # @pluv/crdt-yjs
2
2
 
3
+ ## 0.3.7
4
+
5
+ ### Patch Changes
6
+
7
+ - 0dd847e: updated storage to be synced when reconnected to the room
8
+ - 3518a83: bumped dependencies
9
+ - Updated dependencies [0dd847e]
10
+ - Updated dependencies [bb2886b]
11
+ - Updated dependencies [ae679a8]
12
+ - @pluv/types@0.2.0
13
+
3
14
  ## 0.3.6
4
15
 
5
16
  ### Patch Changes
package/dist/index.d.ts CHANGED
@@ -24,7 +24,7 @@ declare class YjsDoc<T extends Record<string, AbstractType<any>> = {}> {
24
24
  value: Doc;
25
25
  private get _storage();
26
26
  constructor(value?: T);
27
- applyUpdate(update: string | Uint8Array, origin?: string): this;
27
+ applyUpdate(update?: string | Uint8Array | null, origin?: string): this;
28
28
  destroy(): void;
29
29
  encodeStateAsUpdate(): string;
30
30
  get<TKey extends keyof T>(key: TKey): T[TKey];
package/dist/index.js CHANGED
@@ -74,6 +74,8 @@ var YjsDoc = class {
74
74
  return this.value.getMap("storage");
75
75
  }
76
76
  applyUpdate(update, origin) {
77
+ if (update === null || typeof update === "undefined")
78
+ return this;
77
79
  const uint8Update = typeof update === "string" ? (0, import_js_base64.toUint8Array)(update) : update;
78
80
  (0, import_yjs2.applyUpdate)(this.value, uint8Update, origin);
79
81
  return this;
package/dist/index.mjs CHANGED
@@ -43,6 +43,8 @@ var YjsDoc = class {
43
43
  return this.value.getMap("storage");
44
44
  }
45
45
  applyUpdate(update, origin) {
46
+ if (update === null || typeof update === "undefined")
47
+ return this;
46
48
  const uint8Update = typeof update === "string" ? toUint8Array(update) : update;
47
49
  applyUpdate(this.value, uint8Update, origin);
48
50
  return this;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/crdt-yjs",
3
- "version": "0.3.6",
3
+ "version": "0.3.7",
4
4
  "description": "yjs for @pluv/io",
5
5
  "author": "leedavidcs",
6
6
  "license": "MIT",
@@ -18,7 +18,7 @@
18
18
  },
19
19
  "dependencies": {
20
20
  "js-base64": "^3.7.5",
21
- "@pluv/types": "^0.1.6"
21
+ "@pluv/types": "^0.2.0"
22
22
  },
23
23
  "peerDependencies": {
24
24
  "yjs": "^13.0.0"
@@ -26,9 +26,9 @@
26
26
  "devDependencies": {
27
27
  "tsup": "^6.7.0",
28
28
  "typescript": "^5.0.4",
29
- "yjs": "^13.5.52",
30
- "@pluv/tsconfig": "^0.1.5",
31
- "eslint-config-pluv": "^0.1.10"
29
+ "yjs": "^13.6.0",
30
+ "@pluv/tsconfig": "^0.1.6",
31
+ "eslint-config-pluv": "^0.1.11"
32
32
  },
33
33
  "scripts": {
34
34
  "build": "tsup src/index.ts --format esm,cjs --dts",
package/src/doc.ts CHANGED
@@ -20,7 +20,12 @@ export class YjsDoc<T extends Record<string, AbstractType<any>> = {}> {
20
20
  });
21
21
  }
22
22
 
23
- public applyUpdate(update: string | Uint8Array, origin?: string): this {
23
+ public applyUpdate(
24
+ update?: string | Uint8Array | null,
25
+ origin?: string
26
+ ): this {
27
+ if (update === null || typeof update === "undefined") return this;
28
+
24
29
  const uint8Update =
25
30
  typeof update === "string" ? toUint8Array(update) : update;
26
31