@pluv/crdt 1.0.1 → 1.0.2

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@1.0.1 build /home/runner/work/pluv/pluv/packages/crdt
2
+ > @pluv/crdt@1.0.2 build /home/runner/work/pluv/pluv/packages/crdt
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 1.25 KB
12
- ESM ⚡️ Build success in 35ms
13
- CJS dist/index.js 2.42 KB
14
- CJS ⚡️ Build success in 35ms
11
+ ESM dist/index.mjs 1.46 KB
12
+ ESM ⚡️ Build success in 32ms
13
+ CJS dist/index.js 2.63 KB
14
+ CJS ⚡️ Build success in 32ms
15
15
  DTS Build start
16
- DTS ⚡️ Build success in 466ms
17
- DTS dist/index.d.mts 3.40 KB
18
- DTS dist/index.d.ts 3.40 KB
16
+ DTS ⚡️ Build success in 475ms
17
+ DTS dist/index.d.mts 3.48 KB
18
+ DTS dist/index.d.ts 3.48 KB
package/CHANGELOG.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # @pluv/crdt
2
2
 
3
+ ## 1.0.2
4
+
5
+ ### Patch Changes
6
+
7
+ - @pluv/types@1.0.2
8
+
3
9
  ## 1.0.1
4
10
 
5
11
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -45,6 +45,7 @@ declare abstract class AbstractCrdtDocFactory<TStorage extends Record<string, Cr
45
45
  abstract getEmpty(): AbstractCrdtDoc<TStorage>;
46
46
  abstract getFactory(initialStorage?: () => TStorage): AbstractCrdtDocFactory<TStorage>;
47
47
  abstract getInitialized(initialStorage?: () => TStorage): AbstractCrdtDoc<TStorage>;
48
+ resolveEncodedState(updates: string | string[] | readonly string[]): string | null;
48
49
  }
49
50
 
50
51
  declare class NoopCrdtDoc extends AbstractCrdtDoc<any> {
package/dist/index.d.ts CHANGED
@@ -45,6 +45,7 @@ declare abstract class AbstractCrdtDocFactory<TStorage extends Record<string, Cr
45
45
  abstract getEmpty(): AbstractCrdtDoc<TStorage>;
46
46
  abstract getFactory(initialStorage?: () => TStorage): AbstractCrdtDocFactory<TStorage>;
47
47
  abstract getInitialized(initialStorage?: () => TStorage): AbstractCrdtDoc<TStorage>;
48
+ resolveEncodedState(updates: string | string[] | readonly string[]): string | null;
48
49
  }
49
50
 
50
51
  declare class NoopCrdtDoc extends AbstractCrdtDoc<any> {
package/dist/index.js CHANGED
@@ -34,6 +34,11 @@ var AbstractCrdtDoc = class {
34
34
 
35
35
  // src/AbstractCrdtDocFactory.ts
36
36
  var AbstractCrdtDocFactory = class {
37
+ resolveEncodedState(updates) {
38
+ if (typeof updates === "string") return updates;
39
+ if (!updates.length) return null;
40
+ return this.getEmpty().batchApplyEncodedState({ updates }).getEncodedState();
41
+ }
37
42
  };
38
43
 
39
44
  // src/NoopCrdtDoc.ts
package/dist/index.mjs CHANGED
@@ -4,6 +4,11 @@ var AbstractCrdtDoc = class {
4
4
 
5
5
  // src/AbstractCrdtDocFactory.ts
6
6
  var AbstractCrdtDocFactory = class {
7
+ resolveEncodedState(updates) {
8
+ if (typeof updates === "string") return updates;
9
+ if (!updates.length) return null;
10
+ return this.getEmpty().batchApplyEncodedState({ updates }).getEncodedState();
11
+ }
7
12
  };
8
13
 
9
14
  // src/NoopCrdtDoc.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluv/crdt",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "crdt base for @pluv/io",
5
5
  "author": "leedavidcs",
6
6
  "license": "MIT",
@@ -17,14 +17,14 @@
17
17
  "access": "public"
18
18
  },
19
19
  "dependencies": {
20
- "@pluv/types": "^1.0.1"
20
+ "@pluv/types": "^1.0.2"
21
21
  },
22
22
  "devDependencies": {
23
23
  "eslint": "^9.25.1",
24
24
  "tsup": "^8.4.0",
25
25
  "typescript": "^5.8.3",
26
- "@pluv/tsconfig": "^1.0.1",
27
- "eslint-config-pluv": "^1.0.1"
26
+ "@pluv/tsconfig": "^1.0.2",
27
+ "eslint-config-pluv": "^1.0.2"
28
28
  },
29
29
  "scripts": {
30
30
  "build": "tsup src/index.ts --format esm,cjs --dts",
@@ -5,4 +5,11 @@ export abstract class AbstractCrdtDocFactory<TStorage extends Record<string, Crd
5
5
  public abstract getEmpty(): AbstractCrdtDoc<TStorage>;
6
6
  public abstract getFactory(initialStorage?: () => TStorage): AbstractCrdtDocFactory<TStorage>;
7
7
  public abstract getInitialized(initialStorage?: () => TStorage): AbstractCrdtDoc<TStorage>;
8
+
9
+ public resolveEncodedState(updates: string | string[] | readonly string[]): string | null {
10
+ if (typeof updates === "string") return updates;
11
+ if (!updates.length) return null;
12
+
13
+ return this.getEmpty().batchApplyEncodedState({ updates }).getEncodedState();
14
+ }
8
15
  }