@pluv/crdt-yjs 0.3.6 → 0.3.8

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.8 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 77ms
13
+ CJS dist/index.js 4.77 KB
14
+ CJS ⚡️ Build success in 79ms
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 1561ms
17
+ DTS dist/index.d.ts 3.10 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # @pluv/crdt-yjs
2
2
 
3
+ ## 0.3.8
4
+
5
+ ### Patch Changes
6
+
7
+ - b85a232: bumped dependencies
8
+ - @pluv/types@0.2.0
9
+
10
+ ## 0.3.7
11
+
12
+ ### Patch Changes
13
+
14
+ - 0dd847e: updated storage to be synced when reconnected to the room
15
+ - 3518a83: bumped dependencies
16
+ - Updated dependencies [0dd847e]
17
+ - Updated dependencies [bb2886b]
18
+ - Updated dependencies [ae679a8]
19
+ - @pluv/types@0.2.0
20
+
3
21
  ## 0.3.6
4
22
 
5
23
  ### 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.8",
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.1",
30
+ "@pluv/tsconfig": "^0.1.6",
31
+ "eslint-config-pluv": "^0.1.12"
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