@pluv/crdt 0.17.2 → 0.18.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 +4 -4
- package/CHANGELOG.md +13 -0
- package/package.json +4 -4
- package/src/AbstractCrdtDoc.ts +4 -15
- package/src/AbstractCrdtDocFactory.ts +3 -9
- package/src/AbstractCrdtType.ts +1 -4
- package/src/NoopCrdtDoc.ts +3 -15
- package/src/NoopCrdtDocFactory.ts +2 -6
- package/src/index.ts +1 -4
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @pluv/crdt@0.
|
|
2
|
+
> @pluv/crdt@0.18.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
|
|
@@ -9,10 +9,10 @@
|
|
|
9
9
|
[34mESM[39m Build start
|
|
10
10
|
[34mCJS[39m Build start
|
|
11
11
|
[32mESM[39m [1mdist/index.mjs [22m[32m1.34 KB[39m
|
|
12
|
-
[32mESM[39m ⚡️ Build success in
|
|
12
|
+
[32mESM[39m ⚡️ Build success in 27ms
|
|
13
13
|
[32mCJS[39m [1mdist/index.js [22m[32m2.54 KB[39m
|
|
14
|
-
[32mCJS[39m ⚡️ Build success in
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 27ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 596ms
|
|
17
17
|
[32mDTS[39m [1mdist/index.d.mts [22m[32m3.31 KB[39m
|
|
18
18
|
[32mDTS[39m [1mdist/index.d.ts [22m[32m3.31 KB[39m
|
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/crdt",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.18.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": "^0.
|
|
20
|
+
"@pluv/types": "^0.18.0"
|
|
21
21
|
},
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"eslint": "^8.57.0",
|
|
24
24
|
"tsup": "^8.0.2",
|
|
25
25
|
"typescript": "^5.4.5",
|
|
26
|
-
"@pluv/tsconfig": "^0.
|
|
27
|
-
"eslint-config-pluv": "^0.
|
|
26
|
+
"@pluv/tsconfig": "^0.18.0",
|
|
27
|
+
"eslint-config-pluv": "^0.18.0"
|
|
28
28
|
},
|
|
29
29
|
"scripts": {
|
|
30
30
|
"build": "tsup src/index.ts --format esm,cjs --dts",
|
package/src/AbstractCrdtDoc.ts
CHANGED
|
@@ -6,26 +6,17 @@ export interface DocApplyEncodedStateParams {
|
|
|
6
6
|
update?: string | Uint8Array;
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
export interface DocSubscribeCallbackParams<
|
|
10
|
-
T extends Record<string, AbstractCrdtType<any, any>>,
|
|
11
|
-
> {
|
|
9
|
+
export interface DocSubscribeCallbackParams<T extends Record<string, AbstractCrdtType<any, any>>> {
|
|
12
10
|
doc: AbstractCrdtDoc<T>;
|
|
13
11
|
local: boolean;
|
|
14
12
|
origin?: string | null;
|
|
15
13
|
update: string;
|
|
16
14
|
}
|
|
17
15
|
|
|
18
|
-
export abstract class AbstractCrdtDoc<
|
|
19
|
-
T extends Record<string, AbstractCrdtType<any, any>>,
|
|
20
|
-
> {
|
|
16
|
+
export abstract class AbstractCrdtDoc<T extends Record<string, AbstractCrdtType<any, any>>> {
|
|
21
17
|
public abstract applyEncodedState(params: DocApplyEncodedStateParams): this;
|
|
22
18
|
public abstract batchApplyEncodedState(
|
|
23
|
-
updates: readonly (
|
|
24
|
-
| DocApplyEncodedStateParams
|
|
25
|
-
| string
|
|
26
|
-
| null
|
|
27
|
-
| undefined
|
|
28
|
-
)[],
|
|
19
|
+
updates: readonly (DocApplyEncodedStateParams | string | null | undefined)[],
|
|
29
20
|
): this;
|
|
30
21
|
public abstract canRedo(): boolean;
|
|
31
22
|
public abstract canUndo(): boolean;
|
|
@@ -35,9 +26,7 @@ export abstract class AbstractCrdtDoc<
|
|
|
35
26
|
public abstract getEncodedState(): string;
|
|
36
27
|
public abstract isEmpty(): boolean;
|
|
37
28
|
public abstract redo(): this;
|
|
38
|
-
public abstract subscribe(
|
|
39
|
-
listener: (params: DocSubscribeCallbackParams<T>) => void,
|
|
40
|
-
): () => void;
|
|
29
|
+
public abstract subscribe(listener: (params: DocSubscribeCallbackParams<T>) => void): () => void;
|
|
41
30
|
public abstract toJson(): InferCrdtStorageJson<T>;
|
|
42
31
|
public abstract track(): this;
|
|
43
32
|
public abstract transact(fn: () => void, origin?: string): this;
|
|
@@ -1,15 +1,9 @@
|
|
|
1
1
|
import { AbstractCrdtDoc } from "./AbstractCrdtDoc";
|
|
2
2
|
import type { AbstractCrdtType } from "./AbstractCrdtType";
|
|
3
3
|
|
|
4
|
-
export abstract class AbstractCrdtDocFactory<
|
|
5
|
-
TStorage extends Record<string, AbstractCrdtType<any, any>>,
|
|
6
|
-
> {
|
|
4
|
+
export abstract class AbstractCrdtDocFactory<TStorage extends Record<string, AbstractCrdtType<any, any>>> {
|
|
7
5
|
public abstract getEmpty(): AbstractCrdtDoc<TStorage>;
|
|
8
|
-
public abstract getFactory(
|
|
9
|
-
initialStorage?: () => TStorage,
|
|
10
|
-
): AbstractCrdtDocFactory<TStorage>;
|
|
6
|
+
public abstract getFactory(initialStorage?: () => TStorage): AbstractCrdtDocFactory<TStorage>;
|
|
11
7
|
public abstract getFresh(): AbstractCrdtDoc<TStorage>;
|
|
12
|
-
public abstract getInitialized(
|
|
13
|
-
initialStorage?: () => TStorage,
|
|
14
|
-
): AbstractCrdtDoc<TStorage>;
|
|
8
|
+
public abstract getInitialized(initialStorage?: () => TStorage): AbstractCrdtDoc<TStorage>;
|
|
15
9
|
}
|
package/src/AbstractCrdtType.ts
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import type { InferCrdtStorageJson } from "./types";
|
|
2
2
|
|
|
3
|
-
export abstract class AbstractCrdtType<
|
|
4
|
-
TValue extends unknown,
|
|
5
|
-
TJson extends unknown,
|
|
6
|
-
> {
|
|
3
|
+
export abstract class AbstractCrdtType<TValue extends unknown, TJson extends unknown> {
|
|
7
4
|
public abstract value: TValue;
|
|
8
5
|
|
|
9
6
|
public abstract toJson(): InferCrdtStorageJson<TJson>;
|
package/src/NoopCrdtDoc.ts
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
DocApplyEncodedStateParams,
|
|
3
|
-
DocSubscribeCallbackParams,
|
|
4
|
-
} from "./AbstractCrdtDoc";
|
|
1
|
+
import type { DocApplyEncodedStateParams, DocSubscribeCallbackParams } from "./AbstractCrdtDoc";
|
|
5
2
|
import { AbstractCrdtDoc } from "./AbstractCrdtDoc";
|
|
6
3
|
|
|
7
4
|
export class NoopCrdtDoc extends AbstractCrdtDoc<any> {
|
|
@@ -9,14 +6,7 @@ export class NoopCrdtDoc extends AbstractCrdtDoc<any> {
|
|
|
9
6
|
return this;
|
|
10
7
|
}
|
|
11
8
|
|
|
12
|
-
public batchApplyEncodedState(
|
|
13
|
-
updates: readonly (
|
|
14
|
-
| string
|
|
15
|
-
| DocApplyEncodedStateParams
|
|
16
|
-
| null
|
|
17
|
-
| undefined
|
|
18
|
-
)[],
|
|
19
|
-
): this {
|
|
9
|
+
public batchApplyEncodedState(updates: readonly (string | DocApplyEncodedStateParams | null | undefined)[]): this {
|
|
20
10
|
return this;
|
|
21
11
|
}
|
|
22
12
|
|
|
@@ -50,9 +40,7 @@ export class NoopCrdtDoc extends AbstractCrdtDoc<any> {
|
|
|
50
40
|
return this;
|
|
51
41
|
}
|
|
52
42
|
|
|
53
|
-
public subscribe(
|
|
54
|
-
listener: (params: DocSubscribeCallbackParams<{}>) => void,
|
|
55
|
-
): () => void {
|
|
43
|
+
public subscribe(listener: (params: DocSubscribeCallbackParams<{}>) => void): () => void {
|
|
56
44
|
return () => undefined;
|
|
57
45
|
}
|
|
58
46
|
|
|
@@ -6,9 +6,7 @@ export class NoopCrdtDocFactory extends AbstractCrdtDocFactory<any> {
|
|
|
6
6
|
return new NoopCrdtDoc();
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
public getFactory(
|
|
10
|
-
initialStorage?: (() => {}) | undefined,
|
|
11
|
-
): NoopCrdtDocFactory {
|
|
9
|
+
public getFactory(initialStorage?: (() => {}) | undefined): NoopCrdtDocFactory {
|
|
12
10
|
return this;
|
|
13
11
|
}
|
|
14
12
|
|
|
@@ -16,9 +14,7 @@ export class NoopCrdtDocFactory extends AbstractCrdtDocFactory<any> {
|
|
|
16
14
|
return new NoopCrdtDoc();
|
|
17
15
|
}
|
|
18
16
|
|
|
19
|
-
public getInitialized(
|
|
20
|
-
initialStorage?: (() => {}) | undefined,
|
|
21
|
-
): NoopCrdtDoc {
|
|
17
|
+
public getInitialized(initialStorage?: (() => {}) | undefined): NoopCrdtDoc {
|
|
22
18
|
return new NoopCrdtDoc();
|
|
23
19
|
}
|
|
24
20
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
export { AbstractCrdtDoc } from "./AbstractCrdtDoc";
|
|
2
|
-
export type {
|
|
3
|
-
DocApplyEncodedStateParams,
|
|
4
|
-
DocSubscribeCallbackParams,
|
|
5
|
-
} from "./AbstractCrdtDoc";
|
|
2
|
+
export type { DocApplyEncodedStateParams, DocSubscribeCallbackParams } from "./AbstractCrdtDoc";
|
|
6
3
|
export { AbstractCrdtDocFactory } from "./AbstractCrdtDocFactory";
|
|
7
4
|
export { AbstractCrdtType } from "./AbstractCrdtType";
|
|
8
5
|
export { NoopCrdtDoc } from "./NoopCrdtDoc";
|