@pluv/crdt-loro 0.32.9 → 0.33.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 +12 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -3
- package/dist/index.mjs +4 -4
- package/package.json +9 -9
- package/src/doc/CrdtLoroDoc.ts +5 -5
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @pluv/crdt-loro@0.
|
|
2
|
+
> @pluv/crdt-loro@0.33.0 build /home/runner/work/pluv/pluv/packages/crdt-loro
|
|
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
|
-
[
|
|
12
|
-
[
|
|
13
|
-
[
|
|
14
|
-
[
|
|
11
|
+
[32mESM[39m [1mdist/index.mjs [22m[32m8.13 KB[39m
|
|
12
|
+
[32mESM[39m ⚡️ Build success in 46ms
|
|
13
|
+
[32mCJS[39m [1mdist/index.js [22m[32m9.19 KB[39m
|
|
14
|
+
[32mCJS[39m ⚡️ Build success in 49ms
|
|
15
15
|
[34mDTS[39m Build start
|
|
16
|
-
[32mDTS[39m ⚡️ Build success in
|
|
17
|
-
[32mDTS[39m [1mdist/index.d.mts [22m[32m3.
|
|
18
|
-
[32mDTS[39m [1mdist/index.d.ts [22m[32m3.
|
|
16
|
+
[32mDTS[39m ⚡️ Build success in 2009ms
|
|
17
|
+
[32mDTS[39m [1mdist/index.d.mts [22m[32m3.52 KB[39m
|
|
18
|
+
[32mDTS[39m [1mdist/index.d.ts [22m[32m3.52 KB[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
# @pluv/crdt-loro
|
|
2
2
|
|
|
3
|
+
## 0.33.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- d99ac96: Require peer dependency loro-crdt@^1.0.0.
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- f54d8ce: Update internal, deprecated `loro-crdt` methods.
|
|
12
|
+
- @pluv/crdt@0.33.0
|
|
13
|
+
- @pluv/types@0.33.0
|
|
14
|
+
|
|
3
15
|
## 0.32.9
|
|
4
16
|
|
|
5
17
|
### Patch Changes
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CrdtType, AbstractCrdtDoc, DocApplyEncodedStateParams, InferCrdtJson, DocSubscribeCallbackParams, AbstractCrdtDocFactory } from '@pluv/crdt';
|
|
2
|
-
import {
|
|
2
|
+
import { LoroDoc, LoroList, LoroMap, LoroText } from 'loro-crdt';
|
|
3
3
|
|
|
4
4
|
type LoroType<TValue extends unknown, TJson extends unknown = any> = TValue & CrdtType<TValue, TJson> & {
|
|
5
5
|
toJSON?: () => any;
|
|
@@ -7,7 +7,7 @@ type LoroType<TValue extends unknown, TJson extends unknown = any> = TValue & Cr
|
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
declare class CrdtLoroDoc<TStorage extends Record<string, LoroType<any, any>>> extends AbstractCrdtDoc<TStorage> {
|
|
10
|
-
value:
|
|
10
|
+
value: LoroDoc;
|
|
11
11
|
private _storage;
|
|
12
12
|
constructor(value?: TStorage);
|
|
13
13
|
applyEncodedState(params: DocApplyEncodedStateParams): this;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CrdtType, AbstractCrdtDoc, DocApplyEncodedStateParams, InferCrdtJson, DocSubscribeCallbackParams, AbstractCrdtDocFactory } from '@pluv/crdt';
|
|
2
|
-
import {
|
|
2
|
+
import { LoroDoc, LoroList, LoroMap, LoroText } from 'loro-crdt';
|
|
3
3
|
|
|
4
4
|
type LoroType<TValue extends unknown, TJson extends unknown = any> = TValue & CrdtType<TValue, TJson> & {
|
|
5
5
|
toJSON?: () => any;
|
|
@@ -7,7 +7,7 @@ type LoroType<TValue extends unknown, TJson extends unknown = any> = TValue & Cr
|
|
|
7
7
|
};
|
|
8
8
|
|
|
9
9
|
declare class CrdtLoroDoc<TStorage extends Record<string, LoroType<any, any>>> extends AbstractCrdtDoc<TStorage> {
|
|
10
|
-
value:
|
|
10
|
+
value: LoroDoc;
|
|
11
11
|
private _storage;
|
|
12
12
|
constructor(value?: TStorage);
|
|
13
13
|
applyEncodedState(params: DocApplyEncodedStateParams): this;
|
package/dist/index.js
CHANGED
|
@@ -60,7 +60,7 @@ var import_loro_crdt = require("loro-crdt");
|
|
|
60
60
|
var CrdtLoroDoc = class extends import_crdt.AbstractCrdtDoc {
|
|
61
61
|
constructor(value = {}) {
|
|
62
62
|
super();
|
|
63
|
-
this.value = new import_loro_crdt.
|
|
63
|
+
this.value = new import_loro_crdt.LoroDoc();
|
|
64
64
|
this._storage = Object.entries(value).reduce((acc, [key, node]) => {
|
|
65
65
|
if (node instanceof import_loro_crdt.LoroList) {
|
|
66
66
|
const container = this.value.getList(key);
|
|
@@ -137,7 +137,7 @@ var CrdtLoroDoc = class extends import_crdt.AbstractCrdtDoc {
|
|
|
137
137
|
return this._storage[key];
|
|
138
138
|
}
|
|
139
139
|
getEncodedState() {
|
|
140
|
-
return (0, import_js_base64.fromUint8Array)(this.value.
|
|
140
|
+
return (0, import_js_base64.fromUint8Array)(this.value.export({ mode: "snapshot" }));
|
|
141
141
|
}
|
|
142
142
|
toJson(type) {
|
|
143
143
|
if (typeof type === "string") {
|
|
@@ -164,7 +164,7 @@ var CrdtLoroDoc = class extends import_crdt.AbstractCrdtDoc {
|
|
|
164
164
|
}
|
|
165
165
|
subscribe(listener) {
|
|
166
166
|
const fn = (event) => {
|
|
167
|
-
const update = (0, import_js_base64.fromUint8Array)(this.value.
|
|
167
|
+
const update = (0, import_js_base64.fromUint8Array)(this.value.export({ mode: "update" }));
|
|
168
168
|
listener({
|
|
169
169
|
doc: this,
|
|
170
170
|
local: event.by === "local",
|
package/dist/index.mjs
CHANGED
|
@@ -37,11 +37,11 @@ __export(loro_exports, {
|
|
|
37
37
|
// src/doc/CrdtLoroDoc.ts
|
|
38
38
|
import { AbstractCrdtDoc } from "@pluv/crdt";
|
|
39
39
|
import { fromUint8Array, toUint8Array } from "js-base64";
|
|
40
|
-
import {
|
|
40
|
+
import { LoroDoc, LoroList, LoroMap, LoroText, isContainer } from "loro-crdt";
|
|
41
41
|
var CrdtLoroDoc = class extends AbstractCrdtDoc {
|
|
42
42
|
constructor(value = {}) {
|
|
43
43
|
super();
|
|
44
|
-
this.value = new
|
|
44
|
+
this.value = new LoroDoc();
|
|
45
45
|
this._storage = Object.entries(value).reduce((acc, [key, node]) => {
|
|
46
46
|
if (node instanceof LoroList) {
|
|
47
47
|
const container = this.value.getList(key);
|
|
@@ -118,7 +118,7 @@ var CrdtLoroDoc = class extends AbstractCrdtDoc {
|
|
|
118
118
|
return this._storage[key];
|
|
119
119
|
}
|
|
120
120
|
getEncodedState() {
|
|
121
|
-
return fromUint8Array(this.value.
|
|
121
|
+
return fromUint8Array(this.value.export({ mode: "snapshot" }));
|
|
122
122
|
}
|
|
123
123
|
toJson(type) {
|
|
124
124
|
if (typeof type === "string") {
|
|
@@ -145,7 +145,7 @@ var CrdtLoroDoc = class extends AbstractCrdtDoc {
|
|
|
145
145
|
}
|
|
146
146
|
subscribe(listener) {
|
|
147
147
|
const fn = (event) => {
|
|
148
|
-
const update = fromUint8Array(this.value.
|
|
148
|
+
const update = fromUint8Array(this.value.export({ mode: "update" }));
|
|
149
149
|
listener({
|
|
150
150
|
doc: this,
|
|
151
151
|
local: event.by === "local",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pluv/crdt-loro",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.33.0",
|
|
4
4
|
"description": "loro for @pluv/io",
|
|
5
5
|
"author": "leedavidcs",
|
|
6
6
|
"license": "MIT",
|
|
@@ -18,19 +18,19 @@
|
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
20
|
"js-base64": "^3.7.7",
|
|
21
|
-
"@pluv/crdt": "^0.
|
|
22
|
-
"@pluv/types": "^0.
|
|
21
|
+
"@pluv/crdt": "^0.33.0",
|
|
22
|
+
"@pluv/types": "^0.33.0"
|
|
23
23
|
},
|
|
24
24
|
"peerDependencies": {
|
|
25
|
-
"loro-crdt": "^0.
|
|
25
|
+
"loro-crdt": "^1.0.0"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
|
-
"eslint": "^8.57.
|
|
29
|
-
"loro-crdt": "^1.
|
|
28
|
+
"eslint": "^8.57.1",
|
|
29
|
+
"loro-crdt": "^1.1.4",
|
|
30
30
|
"tsup": "^8.3.5",
|
|
31
|
-
"typescript": "^5.
|
|
32
|
-
"@pluv/tsconfig": "^0.
|
|
33
|
-
"eslint-config-pluv": "^0.
|
|
31
|
+
"typescript": "^5.7.2",
|
|
32
|
+
"@pluv/tsconfig": "^0.33.0",
|
|
33
|
+
"eslint-config-pluv": "^0.33.0"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
36
|
"build": "tsup src/index.ts --format esm,cjs --dts",
|
package/src/doc/CrdtLoroDoc.ts
CHANGED
|
@@ -2,11 +2,11 @@ import type { DocApplyEncodedStateParams, DocSubscribeCallbackParams, InferCrdtJ
|
|
|
2
2
|
import { AbstractCrdtDoc } from "@pluv/crdt";
|
|
3
3
|
import { fromUint8Array, toUint8Array } from "js-base64";
|
|
4
4
|
import type { Container, LoroEventBatch } from "loro-crdt";
|
|
5
|
-
import {
|
|
6
|
-
import { LoroType } from "../types";
|
|
5
|
+
import { LoroDoc, LoroList, LoroMap, LoroText, isContainer } from "loro-crdt";
|
|
6
|
+
import type { LoroType } from "../types";
|
|
7
7
|
|
|
8
8
|
export class CrdtLoroDoc<TStorage extends Record<string, LoroType<any, any>>> extends AbstractCrdtDoc<TStorage> {
|
|
9
|
-
public value:
|
|
9
|
+
public value: LoroDoc = new LoroDoc();
|
|
10
10
|
|
|
11
11
|
private _storage: TStorage;
|
|
12
12
|
|
|
@@ -123,7 +123,7 @@ export class CrdtLoroDoc<TStorage extends Record<string, LoroType<any, any>>> ex
|
|
|
123
123
|
}
|
|
124
124
|
|
|
125
125
|
public getEncodedState(): string {
|
|
126
|
-
return fromUint8Array(this.value.
|
|
126
|
+
return fromUint8Array(this.value.export({ mode: "snapshot" }));
|
|
127
127
|
}
|
|
128
128
|
|
|
129
129
|
public toJson(): InferCrdtJson<TStorage>;
|
|
@@ -160,7 +160,7 @@ export class CrdtLoroDoc<TStorage extends Record<string, LoroType<any, any>>> ex
|
|
|
160
160
|
|
|
161
161
|
public subscribe(listener: (params: DocSubscribeCallbackParams<TStorage>) => void): () => void {
|
|
162
162
|
const fn = (event: LoroEventBatch) => {
|
|
163
|
-
const update = fromUint8Array(this.value.
|
|
163
|
+
const update = fromUint8Array(this.value.export({ mode: "update" }));
|
|
164
164
|
|
|
165
165
|
listener({
|
|
166
166
|
doc: this,
|