@pluv/crdt 3.1.7 → 3.2.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.
- package/.turbo/turbo-build.log +8 -8
- package/CHANGELOG.md +6 -0
- package/dist/index.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +6 -0
- package/dist/index.mjs +6 -0
- package/package.json +5 -5
- package/src/AbstractCrdtDocFactory.ts +9 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @pluv/crdt@3.
|
|
2
|
+
> @pluv/crdt@3.2.0 build /home/runner/work/pluv/pluv/packages/crdt
|
|
3
3
|
> tsup src/index.ts --format esm,cjs --dts
|
|
4
4
|
|
|
5
5
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
[34mCLI[39m Target: es6
|
|
9
9
|
[34mESM[39m Build start
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
|
-
[32mESM[39m [1mdist/index.mjs [22m[32m1.
|
|
12
|
-
[32mESM[39m ⚡️ Build success in
|
|
13
|
-
[32mCJS[39m [1mdist/index.js [22m[
|
|
14
|
-
[32mCJS[39m ⚡️ Build success in
|
|
11
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m1.92 KB[39m
|
|
12
|
+
[32mESM[39m ⚡️ Build success in 25ms
|
|
13
|
+
[32mCJS[39m [1mdist/index.js [22m[32m3.05 KB[39m
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 25ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
17
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[32m2.
|
|
18
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m2.
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 500ms
|
|
17
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m2.77 KB[39m
|
|
18
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m2.77 KB[39m
|
package/CHANGELOG.md
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CrdtType, CrdtDocFactory, CrdtDocLike, DocApplyEncodedStateParams, DocBatchApplyEncodedStateParams, DocSubscribeCallbackParams } from '@pluv/types';
|
|
1
|
+
import { CrdtType, CrdtDocFactory, CrdtDocLike, Maybe, DocApplyEncodedStateParams, DocBatchApplyEncodedStateParams, DocSubscribeCallbackParams } from '@pluv/types';
|
|
2
2
|
export { CrdtDocLike, CrdtLibraryType, CrdtType, DocApplyEncodedStateParams, DocBatchApplyEncodedStateParams, DocSubscribeCallbackParams, InferCrdtJson } from '@pluv/types';
|
|
3
3
|
|
|
4
4
|
declare abstract class AbstractCrdtDocFactory<TDoc extends any, TStorage extends Record<string, CrdtType<any, any>>> implements CrdtDocFactory<TDoc, TStorage> {
|
|
@@ -7,6 +7,7 @@ declare abstract class AbstractCrdtDocFactory<TDoc extends any, TStorage extends
|
|
|
7
7
|
abstract getEmpty(): CrdtDocLike<TDoc, TStorage>;
|
|
8
8
|
abstract getFactory(initialStorage?: (builder: any) => TStorage): AbstractCrdtDocFactory<TDoc, TStorage>;
|
|
9
9
|
abstract getInitialized(initialStorage?: (builder: any) => TStorage): CrdtDocLike<TDoc, TStorage>;
|
|
10
|
+
isEmpty(initialState: Maybe<string>): boolean;
|
|
10
11
|
resolveEncodedState(updates: string | string[] | readonly string[]): string | null;
|
|
11
12
|
}
|
|
12
13
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CrdtType, CrdtDocFactory, CrdtDocLike, DocApplyEncodedStateParams, DocBatchApplyEncodedStateParams, DocSubscribeCallbackParams } from '@pluv/types';
|
|
1
|
+
import { CrdtType, CrdtDocFactory, CrdtDocLike, Maybe, DocApplyEncodedStateParams, DocBatchApplyEncodedStateParams, DocSubscribeCallbackParams } from '@pluv/types';
|
|
2
2
|
export { CrdtDocLike, CrdtLibraryType, CrdtType, DocApplyEncodedStateParams, DocBatchApplyEncodedStateParams, DocSubscribeCallbackParams, InferCrdtJson } from '@pluv/types';
|
|
3
3
|
|
|
4
4
|
declare abstract class AbstractCrdtDocFactory<TDoc extends any, TStorage extends Record<string, CrdtType<any, any>>> implements CrdtDocFactory<TDoc, TStorage> {
|
|
@@ -7,6 +7,7 @@ declare abstract class AbstractCrdtDocFactory<TDoc extends any, TStorage extends
|
|
|
7
7
|
abstract getEmpty(): CrdtDocLike<TDoc, TStorage>;
|
|
8
8
|
abstract getFactory(initialStorage?: (builder: any) => TStorage): AbstractCrdtDocFactory<TDoc, TStorage>;
|
|
9
9
|
abstract getInitialized(initialStorage?: (builder: any) => TStorage): CrdtDocLike<TDoc, TStorage>;
|
|
10
|
+
isEmpty(initialState: Maybe<string>): boolean;
|
|
10
11
|
resolveEncodedState(updates: string | string[] | readonly string[]): string | null;
|
|
11
12
|
}
|
|
12
13
|
|
package/dist/index.js
CHANGED
|
@@ -32,6 +32,12 @@ var AbstractCrdtDocFactory = class {
|
|
|
32
32
|
constructor(initialStorage) {
|
|
33
33
|
this._initialStorage = initialStorage;
|
|
34
34
|
}
|
|
35
|
+
isEmpty(initialState) {
|
|
36
|
+
const doc = this.getEmpty().applyEncodedState({ update: initialState });
|
|
37
|
+
const isEmpty = doc.isEmpty();
|
|
38
|
+
doc.destroy();
|
|
39
|
+
return isEmpty;
|
|
40
|
+
}
|
|
35
41
|
resolveEncodedState(updates) {
|
|
36
42
|
if (typeof updates === "string") return updates;
|
|
37
43
|
if (Array.isArray(updates) && !updates.length) return null;
|
package/dist/index.mjs
CHANGED
|
@@ -3,6 +3,12 @@ var AbstractCrdtDocFactory = class {
|
|
|
3
3
|
constructor(initialStorage) {
|
|
4
4
|
this._initialStorage = initialStorage;
|
|
5
5
|
}
|
|
6
|
+
isEmpty(initialState) {
|
|
7
|
+
const doc = this.getEmpty().applyEncodedState({ update: initialState });
|
|
8
|
+
const isEmpty = doc.isEmpty();
|
|
9
|
+
doc.destroy();
|
|
10
|
+
return isEmpty;
|
|
11
|
+
}
|
|
6
12
|
resolveEncodedState(updates) {
|
|
7
13
|
if (typeof updates === "string") return updates;
|
|
8
14
|
if (Array.isArray(updates) && !updates.length) return null;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/crdt",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.2.0",
|
|
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": "^3.
|
|
20
|
+
"@pluv/types": "^3.2.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"eslint": "^9.
|
|
23
|
+
"eslint": "^9.28.0",
|
|
24
24
|
"tsup": "^8.5.0",
|
|
25
25
|
"typescript": "^5.8.3",
|
|
26
|
-
"@pluv/tsconfig": "^3.
|
|
27
|
-
"eslint-config-pluv": "^3.
|
|
26
|
+
"@pluv/tsconfig": "^3.2.0",
|
|
27
|
+
"eslint-config-pluv": "^3.2.0"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"build": "tsup src/index.ts --format esm,cjs --dts",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CrdtDocFactory, CrdtDocLike, CrdtType } from "@pluv/types";
|
|
1
|
+
import type { CrdtDocFactory, CrdtDocLike, CrdtType, Maybe } from "@pluv/types";
|
|
2
2
|
|
|
3
3
|
export abstract class AbstractCrdtDocFactory<
|
|
4
4
|
TDoc extends any,
|
|
@@ -19,6 +19,14 @@ export abstract class AbstractCrdtDocFactory<
|
|
|
19
19
|
initialStorage?: (builder: any) => TStorage,
|
|
20
20
|
): CrdtDocLike<TDoc, TStorage>;
|
|
21
21
|
|
|
22
|
+
public isEmpty(initialState: Maybe<string>): boolean {
|
|
23
|
+
const doc = this.getEmpty().applyEncodedState({ update: initialState });
|
|
24
|
+
const isEmpty = doc.isEmpty();
|
|
25
|
+
doc.destroy();
|
|
26
|
+
|
|
27
|
+
return isEmpty;
|
|
28
|
+
}
|
|
29
|
+
|
|
22
30
|
public resolveEncodedState(updates: string | string[] | readonly string[]): string | null {
|
|
23
31
|
if (typeof updates === "string") return updates;
|
|
24
32
|
if (Array.isArray(updates) && !updates.length) return null;
|