loro-crdt 1.10.1 → 1.10.3
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/CHANGELOG.md +13 -0
- package/base64/index.js +121 -83
- package/base64/loro_wasm.d.ts +44 -14
- package/bundler/loro_wasm.d.ts +44 -14
- package/bundler/loro_wasm_bg.js +115 -77
- package/bundler/loro_wasm_bg.wasm +0 -0
- package/bundler/loro_wasm_bg.wasm.d.ts +4 -2
- package/nodejs/loro_wasm.d.ts +44 -14
- package/nodejs/loro_wasm.js +115 -77
- package/nodejs/loro_wasm_bg.wasm +0 -0
- package/nodejs/loro_wasm_bg.wasm.d.ts +4 -2
- package/package.json +1 -1
- package/web/loro_wasm.d.ts +48 -16
- package/web/loro_wasm.js +115 -77
- package/web/loro_wasm_bg.wasm +0 -0
- package/web/loro_wasm_bg.wasm.d.ts +4 -2
package/base64/loro_wasm.d.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Get the version of Loro
|
|
5
|
+
*/
|
|
6
|
+
export function LORO_VERSION(): string;
|
|
7
|
+
/**
|
|
8
|
+
* Enable debug info of Loro
|
|
9
|
+
*/
|
|
10
|
+
export function setDebug(): void;
|
|
11
|
+
export function encodeFrontiers(frontiers: ({ peer: PeerID, counter: number })[]): Uint8Array;
|
|
3
12
|
/**
|
|
4
13
|
* Redacts sensitive content in JSON updates within the specified version range.
|
|
5
14
|
*
|
|
@@ -20,6 +29,9 @@
|
|
|
20
29
|
* @returns {Object} The redacted JSON updates
|
|
21
30
|
*/
|
|
22
31
|
export function redactJsonUpdates(json_updates: string | JsonSchema, version_range: any): JsonSchema;
|
|
32
|
+
export function callPendingEvents(): void;
|
|
33
|
+
export function run(): void;
|
|
34
|
+
export function decodeFrontiers(bytes: Uint8Array): { peer: PeerID, counter: number }[];
|
|
23
35
|
/**
|
|
24
36
|
* Decode the metadata of the import blob.
|
|
25
37
|
*
|
|
@@ -33,18 +45,6 @@ export function redactJsonUpdates(json_updates: string | JsonSchema, version_ran
|
|
|
33
45
|
* - changeNum
|
|
34
46
|
*/
|
|
35
47
|
export function decodeImportBlobMeta(blob: Uint8Array, check_checksum: boolean): ImportBlobMetadata;
|
|
36
|
-
export function decodeFrontiers(bytes: Uint8Array): { peer: PeerID, counter: number }[];
|
|
37
|
-
export function run(): void;
|
|
38
|
-
export function encodeFrontiers(frontiers: ({ peer: PeerID, counter: number })[]): Uint8Array;
|
|
39
|
-
/**
|
|
40
|
-
* Enable debug info of Loro
|
|
41
|
-
*/
|
|
42
|
-
export function setDebug(): void;
|
|
43
|
-
export function callPendingEvents(): void;
|
|
44
|
-
/**
|
|
45
|
-
* Get the version of Loro
|
|
46
|
-
*/
|
|
47
|
-
export function LORO_VERSION(): string;
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* Container types supported by loro.
|
|
@@ -63,6 +63,7 @@ export function LORO_VERSION(): string;
|
|
|
63
63
|
export type ContainerType = "Text" | "Map" | "List"| "Tree" | "MovableList" | "Counter";
|
|
64
64
|
|
|
65
65
|
export type PeerID = `${number}`;
|
|
66
|
+
export type TextPosType = "unicode" | "utf16" | "utf8";
|
|
66
67
|
/**
|
|
67
68
|
* The unique id of each container.
|
|
68
69
|
*
|
|
@@ -338,7 +339,7 @@ interface LoroDoc {
|
|
|
338
339
|
export type Delta<T> =
|
|
339
340
|
| {
|
|
340
341
|
insert: T;
|
|
341
|
-
attributes?: { [key in string]:
|
|
342
|
+
attributes?: { [key in string]: Value };
|
|
342
343
|
retain?: undefined;
|
|
343
344
|
delete?: undefined;
|
|
344
345
|
}
|
|
@@ -350,7 +351,7 @@ export type Delta<T> =
|
|
|
350
351
|
}
|
|
351
352
|
| {
|
|
352
353
|
retain: number;
|
|
353
|
-
attributes?: { [key in string]:
|
|
354
|
+
attributes?: { [key in string]: Value };
|
|
354
355
|
delete?: undefined;
|
|
355
356
|
insert?: undefined;
|
|
356
357
|
};
|
|
@@ -450,6 +451,11 @@ export interface ImportBlobMetadata {
|
|
|
450
451
|
}
|
|
451
452
|
|
|
452
453
|
interface LoroText {
|
|
454
|
+
/**
|
|
455
|
+
* Convert a position between coordinate systems.
|
|
456
|
+
*/
|
|
457
|
+
convertPos(index: number, from: TextPosType, to: TextPosType): number | undefined;
|
|
458
|
+
|
|
453
459
|
/**
|
|
454
460
|
* Get the cursor position at the given pos.
|
|
455
461
|
*
|
|
@@ -868,6 +874,12 @@ interface Listener {
|
|
|
868
874
|
|
|
869
875
|
interface LoroDoc {
|
|
870
876
|
subscribe(listener: Listener): Subscription;
|
|
877
|
+
/**
|
|
878
|
+
* Subscribe to changes that may affect a JSONPath query.
|
|
879
|
+
* Callback may fire false positives and carries no query result.
|
|
880
|
+
* You can debounce/throttle the callback before running `JSONPath(...)` to optimize heavy reads.
|
|
881
|
+
*/
|
|
882
|
+
subscribeJsonpath(path: string, callback: () => void): Subscription;
|
|
871
883
|
}
|
|
872
884
|
|
|
873
885
|
interface UndoManager {
|
|
@@ -905,6 +917,12 @@ interface UndoManager {
|
|
|
905
917
|
groupEnd(): void;
|
|
906
918
|
}
|
|
907
919
|
interface LoroDoc<T extends Record<string, Container> = Record<string, Container>> {
|
|
920
|
+
/**
|
|
921
|
+
* Subscribe to changes that may affect a JSONPath query.
|
|
922
|
+
* Callback may fire false positives and carries no query result.
|
|
923
|
+
* You can debounce/throttle the callback before running `JSONPath(...)` to optimize heavy reads.
|
|
924
|
+
*/
|
|
925
|
+
subscribeJsonpath(path: string, callback: () => void): Subscription;
|
|
908
926
|
/**
|
|
909
927
|
* Get a LoroMap by container id
|
|
910
928
|
*
|
|
@@ -1264,6 +1282,10 @@ interface LoroText {
|
|
|
1264
1282
|
insert(pos: number, text: string): void;
|
|
1265
1283
|
delete(pos: number, len: number): void;
|
|
1266
1284
|
subscribe(listener: Listener): Subscription;
|
|
1285
|
+
/**
|
|
1286
|
+
* Convert a position between coordinate systems.
|
|
1287
|
+
*/
|
|
1288
|
+
convertPos(index: number, from: TextPosType, to: TextPosType): number | undefined;
|
|
1267
1289
|
/**
|
|
1268
1290
|
* Update the current text to the target text.
|
|
1269
1291
|
*
|
|
@@ -3035,6 +3057,14 @@ export class LoroText {
|
|
|
3035
3057
|
* ```
|
|
3036
3058
|
*/
|
|
3037
3059
|
applyDelta(delta: Delta<string>[]): void;
|
|
3060
|
+
/**
|
|
3061
|
+
* Convert a position between coordinate systems.
|
|
3062
|
+
*
|
|
3063
|
+
* Supported values: `"unicode"`, `"utf16"`, `"utf8"`.
|
|
3064
|
+
*
|
|
3065
|
+
* Returns `undefined` when out of bounds or unsupported.
|
|
3066
|
+
*/
|
|
3067
|
+
convertPos(index: number, from: string, to: string): any;
|
|
3038
3068
|
/**
|
|
3039
3069
|
* Delete elements from index to utf-8 index + len
|
|
3040
3070
|
*
|
package/bundler/loro_wasm.d.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Get the version of Loro
|
|
5
|
+
*/
|
|
6
|
+
export function LORO_VERSION(): string;
|
|
7
|
+
/**
|
|
8
|
+
* Enable debug info of Loro
|
|
9
|
+
*/
|
|
10
|
+
export function setDebug(): void;
|
|
11
|
+
export function encodeFrontiers(frontiers: ({ peer: PeerID, counter: number })[]): Uint8Array;
|
|
3
12
|
/**
|
|
4
13
|
* Redacts sensitive content in JSON updates within the specified version range.
|
|
5
14
|
*
|
|
@@ -20,6 +29,9 @@
|
|
|
20
29
|
* @returns {Object} The redacted JSON updates
|
|
21
30
|
*/
|
|
22
31
|
export function redactJsonUpdates(json_updates: string | JsonSchema, version_range: any): JsonSchema;
|
|
32
|
+
export function callPendingEvents(): void;
|
|
33
|
+
export function run(): void;
|
|
34
|
+
export function decodeFrontiers(bytes: Uint8Array): { peer: PeerID, counter: number }[];
|
|
23
35
|
/**
|
|
24
36
|
* Decode the metadata of the import blob.
|
|
25
37
|
*
|
|
@@ -33,18 +45,6 @@ export function redactJsonUpdates(json_updates: string | JsonSchema, version_ran
|
|
|
33
45
|
* - changeNum
|
|
34
46
|
*/
|
|
35
47
|
export function decodeImportBlobMeta(blob: Uint8Array, check_checksum: boolean): ImportBlobMetadata;
|
|
36
|
-
export function decodeFrontiers(bytes: Uint8Array): { peer: PeerID, counter: number }[];
|
|
37
|
-
export function run(): void;
|
|
38
|
-
export function encodeFrontiers(frontiers: ({ peer: PeerID, counter: number })[]): Uint8Array;
|
|
39
|
-
/**
|
|
40
|
-
* Enable debug info of Loro
|
|
41
|
-
*/
|
|
42
|
-
export function setDebug(): void;
|
|
43
|
-
export function callPendingEvents(): void;
|
|
44
|
-
/**
|
|
45
|
-
* Get the version of Loro
|
|
46
|
-
*/
|
|
47
|
-
export function LORO_VERSION(): string;
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* Container types supported by loro.
|
|
@@ -63,6 +63,7 @@ export function LORO_VERSION(): string;
|
|
|
63
63
|
export type ContainerType = "Text" | "Map" | "List"| "Tree" | "MovableList" | "Counter";
|
|
64
64
|
|
|
65
65
|
export type PeerID = `${number}`;
|
|
66
|
+
export type TextPosType = "unicode" | "utf16" | "utf8";
|
|
66
67
|
/**
|
|
67
68
|
* The unique id of each container.
|
|
68
69
|
*
|
|
@@ -338,7 +339,7 @@ interface LoroDoc {
|
|
|
338
339
|
export type Delta<T> =
|
|
339
340
|
| {
|
|
340
341
|
insert: T;
|
|
341
|
-
attributes?: { [key in string]:
|
|
342
|
+
attributes?: { [key in string]: Value };
|
|
342
343
|
retain?: undefined;
|
|
343
344
|
delete?: undefined;
|
|
344
345
|
}
|
|
@@ -350,7 +351,7 @@ export type Delta<T> =
|
|
|
350
351
|
}
|
|
351
352
|
| {
|
|
352
353
|
retain: number;
|
|
353
|
-
attributes?: { [key in string]:
|
|
354
|
+
attributes?: { [key in string]: Value };
|
|
354
355
|
delete?: undefined;
|
|
355
356
|
insert?: undefined;
|
|
356
357
|
};
|
|
@@ -450,6 +451,11 @@ export interface ImportBlobMetadata {
|
|
|
450
451
|
}
|
|
451
452
|
|
|
452
453
|
interface LoroText {
|
|
454
|
+
/**
|
|
455
|
+
* Convert a position between coordinate systems.
|
|
456
|
+
*/
|
|
457
|
+
convertPos(index: number, from: TextPosType, to: TextPosType): number | undefined;
|
|
458
|
+
|
|
453
459
|
/**
|
|
454
460
|
* Get the cursor position at the given pos.
|
|
455
461
|
*
|
|
@@ -868,6 +874,12 @@ interface Listener {
|
|
|
868
874
|
|
|
869
875
|
interface LoroDoc {
|
|
870
876
|
subscribe(listener: Listener): Subscription;
|
|
877
|
+
/**
|
|
878
|
+
* Subscribe to changes that may affect a JSONPath query.
|
|
879
|
+
* Callback may fire false positives and carries no query result.
|
|
880
|
+
* You can debounce/throttle the callback before running `JSONPath(...)` to optimize heavy reads.
|
|
881
|
+
*/
|
|
882
|
+
subscribeJsonpath(path: string, callback: () => void): Subscription;
|
|
871
883
|
}
|
|
872
884
|
|
|
873
885
|
interface UndoManager {
|
|
@@ -905,6 +917,12 @@ interface UndoManager {
|
|
|
905
917
|
groupEnd(): void;
|
|
906
918
|
}
|
|
907
919
|
interface LoroDoc<T extends Record<string, Container> = Record<string, Container>> {
|
|
920
|
+
/**
|
|
921
|
+
* Subscribe to changes that may affect a JSONPath query.
|
|
922
|
+
* Callback may fire false positives and carries no query result.
|
|
923
|
+
* You can debounce/throttle the callback before running `JSONPath(...)` to optimize heavy reads.
|
|
924
|
+
*/
|
|
925
|
+
subscribeJsonpath(path: string, callback: () => void): Subscription;
|
|
908
926
|
/**
|
|
909
927
|
* Get a LoroMap by container id
|
|
910
928
|
*
|
|
@@ -1264,6 +1282,10 @@ interface LoroText {
|
|
|
1264
1282
|
insert(pos: number, text: string): void;
|
|
1265
1283
|
delete(pos: number, len: number): void;
|
|
1266
1284
|
subscribe(listener: Listener): Subscription;
|
|
1285
|
+
/**
|
|
1286
|
+
* Convert a position between coordinate systems.
|
|
1287
|
+
*/
|
|
1288
|
+
convertPos(index: number, from: TextPosType, to: TextPosType): number | undefined;
|
|
1267
1289
|
/**
|
|
1268
1290
|
* Update the current text to the target text.
|
|
1269
1291
|
*
|
|
@@ -3035,6 +3057,14 @@ export class LoroText {
|
|
|
3035
3057
|
* ```
|
|
3036
3058
|
*/
|
|
3037
3059
|
applyDelta(delta: Delta<string>[]): void;
|
|
3060
|
+
/**
|
|
3061
|
+
* Convert a position between coordinate systems.
|
|
3062
|
+
*
|
|
3063
|
+
* Supported values: `"unicode"`, `"utf16"`, `"utf8"`.
|
|
3064
|
+
*
|
|
3065
|
+
* Returns `undefined` when out of bounds or unsupported.
|
|
3066
|
+
*/
|
|
3067
|
+
convertPos(index: number, from: string, to: string): any;
|
|
3038
3068
|
/**
|
|
3039
3069
|
* Delete elements from index to utf-8 index + len
|
|
3040
3070
|
*
|
package/bundler/loro_wasm_bg.js
CHANGED
|
@@ -240,6 +240,55 @@ function getArrayJsValueFromWasm0(ptr, len) {
|
|
|
240
240
|
wasm.__externref_drop_slice(ptr, len);
|
|
241
241
|
return result;
|
|
242
242
|
}
|
|
243
|
+
/**
|
|
244
|
+
* Get the version of Loro
|
|
245
|
+
* @returns {string}
|
|
246
|
+
*/
|
|
247
|
+
export function LORO_VERSION() {
|
|
248
|
+
let deferred1_0;
|
|
249
|
+
let deferred1_1;
|
|
250
|
+
try {
|
|
251
|
+
const ret = wasm.LORO_VERSION();
|
|
252
|
+
deferred1_0 = ret[0];
|
|
253
|
+
deferred1_1 = ret[1];
|
|
254
|
+
return getStringFromWasm0(ret[0], ret[1]);
|
|
255
|
+
} finally {
|
|
256
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
/**
|
|
261
|
+
* Enable debug info of Loro
|
|
262
|
+
*/
|
|
263
|
+
export function setDebug() {
|
|
264
|
+
wasm.setDebug();
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
268
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
269
|
+
for (let i = 0; i < array.length; i++) {
|
|
270
|
+
const add = addToExternrefTable0(array[i]);
|
|
271
|
+
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
272
|
+
}
|
|
273
|
+
WASM_VECTOR_LEN = array.length;
|
|
274
|
+
return ptr;
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* @param {({ peer: PeerID, counter: number })[]} frontiers
|
|
278
|
+
* @returns {Uint8Array}
|
|
279
|
+
*/
|
|
280
|
+
export function encodeFrontiers(frontiers) {
|
|
281
|
+
const ptr0 = passArrayJsValueToWasm0(frontiers, wasm.__wbindgen_malloc);
|
|
282
|
+
const len0 = WASM_VECTOR_LEN;
|
|
283
|
+
const ret = wasm.encodeFrontiers(ptr0, len0);
|
|
284
|
+
if (ret[3]) {
|
|
285
|
+
throw takeFromExternrefTable0(ret[2]);
|
|
286
|
+
}
|
|
287
|
+
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
288
|
+
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
289
|
+
return v2;
|
|
290
|
+
}
|
|
291
|
+
|
|
243
292
|
/**
|
|
244
293
|
* Redacts sensitive content in JSON updates within the specified version range.
|
|
245
294
|
*
|
|
@@ -270,6 +319,28 @@ export function redactJsonUpdates(json_updates, version_range) {
|
|
|
270
319
|
return takeFromExternrefTable0(ret[0]);
|
|
271
320
|
}
|
|
272
321
|
|
|
322
|
+
export function callPendingEvents() {
|
|
323
|
+
wasm.callPendingEvents();
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
export function run() {
|
|
327
|
+
wasm.run();
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
/**
|
|
331
|
+
* @param {Uint8Array} bytes
|
|
332
|
+
* @returns {{ peer: PeerID, counter: number }[]}
|
|
333
|
+
*/
|
|
334
|
+
export function decodeFrontiers(bytes) {
|
|
335
|
+
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
336
|
+
const len0 = WASM_VECTOR_LEN;
|
|
337
|
+
const ret = wasm.decodeFrontiers(ptr0, len0);
|
|
338
|
+
if (ret[2]) {
|
|
339
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
340
|
+
}
|
|
341
|
+
return takeFromExternrefTable0(ret[0]);
|
|
342
|
+
}
|
|
343
|
+
|
|
273
344
|
/**
|
|
274
345
|
* Decode the metadata of the import blob.
|
|
275
346
|
*
|
|
@@ -295,83 +366,12 @@ export function decodeImportBlobMeta(blob, check_checksum) {
|
|
|
295
366
|
return takeFromExternrefTable0(ret[0]);
|
|
296
367
|
}
|
|
297
368
|
|
|
298
|
-
/**
|
|
299
|
-
* @param {Uint8Array} bytes
|
|
300
|
-
* @returns {{ peer: PeerID, counter: number }[]}
|
|
301
|
-
*/
|
|
302
|
-
export function decodeFrontiers(bytes) {
|
|
303
|
-
const ptr0 = passArray8ToWasm0(bytes, wasm.__wbindgen_malloc);
|
|
304
|
-
const len0 = WASM_VECTOR_LEN;
|
|
305
|
-
const ret = wasm.decodeFrontiers(ptr0, len0);
|
|
306
|
-
if (ret[2]) {
|
|
307
|
-
throw takeFromExternrefTable0(ret[1]);
|
|
308
|
-
}
|
|
309
|
-
return takeFromExternrefTable0(ret[0]);
|
|
310
|
-
}
|
|
311
|
-
|
|
312
|
-
export function run() {
|
|
313
|
-
wasm.run();
|
|
314
|
-
}
|
|
315
|
-
|
|
316
|
-
function passArrayJsValueToWasm0(array, malloc) {
|
|
317
|
-
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
318
|
-
for (let i = 0; i < array.length; i++) {
|
|
319
|
-
const add = addToExternrefTable0(array[i]);
|
|
320
|
-
getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
|
|
321
|
-
}
|
|
322
|
-
WASM_VECTOR_LEN = array.length;
|
|
323
|
-
return ptr;
|
|
324
|
-
}
|
|
325
|
-
/**
|
|
326
|
-
* @param {({ peer: PeerID, counter: number })[]} frontiers
|
|
327
|
-
* @returns {Uint8Array}
|
|
328
|
-
*/
|
|
329
|
-
export function encodeFrontiers(frontiers) {
|
|
330
|
-
const ptr0 = passArrayJsValueToWasm0(frontiers, wasm.__wbindgen_malloc);
|
|
331
|
-
const len0 = WASM_VECTOR_LEN;
|
|
332
|
-
const ret = wasm.encodeFrontiers(ptr0, len0);
|
|
333
|
-
if (ret[3]) {
|
|
334
|
-
throw takeFromExternrefTable0(ret[2]);
|
|
335
|
-
}
|
|
336
|
-
var v2 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
|
|
337
|
-
wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
|
|
338
|
-
return v2;
|
|
339
|
-
}
|
|
340
|
-
|
|
341
|
-
/**
|
|
342
|
-
* Enable debug info of Loro
|
|
343
|
-
*/
|
|
344
|
-
export function setDebug() {
|
|
345
|
-
wasm.setDebug();
|
|
346
|
-
}
|
|
347
|
-
|
|
348
|
-
export function callPendingEvents() {
|
|
349
|
-
wasm.callPendingEvents();
|
|
350
|
-
}
|
|
351
|
-
|
|
352
|
-
/**
|
|
353
|
-
* Get the version of Loro
|
|
354
|
-
* @returns {string}
|
|
355
|
-
*/
|
|
356
|
-
export function LORO_VERSION() {
|
|
357
|
-
let deferred1_0;
|
|
358
|
-
let deferred1_1;
|
|
359
|
-
try {
|
|
360
|
-
const ret = wasm.LORO_VERSION();
|
|
361
|
-
deferred1_0 = ret[0];
|
|
362
|
-
deferred1_1 = ret[1];
|
|
363
|
-
return getStringFromWasm0(ret[0], ret[1]);
|
|
364
|
-
} finally {
|
|
365
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
|
|
369
369
|
function __wbg_adapter_62(arg0, arg1, arg2) {
|
|
370
|
-
wasm.
|
|
370
|
+
wasm.closure9_externref_shim(arg0, arg1, arg2);
|
|
371
371
|
}
|
|
372
372
|
|
|
373
373
|
function __wbg_adapter_65(arg0, arg1) {
|
|
374
|
-
wasm.
|
|
374
|
+
wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h2222385ed10d04df(arg0, arg1);
|
|
375
375
|
}
|
|
376
376
|
|
|
377
377
|
const AwarenessWasmFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
@@ -1655,6 +1655,25 @@ export class LoroDoc {
|
|
|
1655
1655
|
}
|
|
1656
1656
|
return takeFromExternrefTable0(ret[0]);
|
|
1657
1657
|
}
|
|
1658
|
+
/**
|
|
1659
|
+
* Subscribe to changes that may affect a JSONPath query.
|
|
1660
|
+
*
|
|
1661
|
+
* The callback receives no query result; it is a lightweight notifier and may
|
|
1662
|
+
* fire false positives so callers can debounce/throttle before running JSONPath
|
|
1663
|
+
* themselves.
|
|
1664
|
+
* @param {string} jsonpath
|
|
1665
|
+
* @param {Function} f
|
|
1666
|
+
* @returns {any}
|
|
1667
|
+
*/
|
|
1668
|
+
subscribeJsonpath(jsonpath, f) {
|
|
1669
|
+
const ptr0 = passStringToWasm0(jsonpath, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
1670
|
+
const len0 = WASM_VECTOR_LEN;
|
|
1671
|
+
const ret = wasm.lorodoc_subscribeJsonpath(this.__wbg_ptr, ptr0, len0, f);
|
|
1672
|
+
if (ret[2]) {
|
|
1673
|
+
throw takeFromExternrefTable0(ret[1]);
|
|
1674
|
+
}
|
|
1675
|
+
return takeFromExternrefTable0(ret[0]);
|
|
1676
|
+
}
|
|
1658
1677
|
/**
|
|
1659
1678
|
* Delete all content from a root container and hide it from the document.
|
|
1660
1679
|
*
|
|
@@ -3903,6 +3922,25 @@ export class LoroText {
|
|
|
3903
3922
|
throw takeFromExternrefTable0(ret[0]);
|
|
3904
3923
|
}
|
|
3905
3924
|
}
|
|
3925
|
+
/**
|
|
3926
|
+
* Convert a position between coordinate systems.
|
|
3927
|
+
*
|
|
3928
|
+
* Supported values: `"unicode"`, `"utf16"`, `"utf8"`.
|
|
3929
|
+
*
|
|
3930
|
+
* Returns `undefined` when out of bounds or unsupported.
|
|
3931
|
+
* @param {number} index
|
|
3932
|
+
* @param {string} from
|
|
3933
|
+
* @param {string} to
|
|
3934
|
+
* @returns {any}
|
|
3935
|
+
*/
|
|
3936
|
+
convertPos(index, from, to) {
|
|
3937
|
+
const ptr0 = passStringToWasm0(from, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3938
|
+
const len0 = WASM_VECTOR_LEN;
|
|
3939
|
+
const ptr1 = passStringToWasm0(to, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
|
|
3940
|
+
const len1 = WASM_VECTOR_LEN;
|
|
3941
|
+
const ret = wasm.lorotext_convertPos(this.__wbg_ptr, index, ptr0, len0, ptr1, len1);
|
|
3942
|
+
return ret;
|
|
3943
|
+
}
|
|
3906
3944
|
/**
|
|
3907
3945
|
* Delete elements from index to utf-8 index + len
|
|
3908
3946
|
*
|
|
@@ -5521,7 +5559,7 @@ export function __wbg_error_7534b8e9a36f1ab4(arg0, arg1) {
|
|
|
5521
5559
|
}
|
|
5522
5560
|
};
|
|
5523
5561
|
|
|
5524
|
-
export function
|
|
5562
|
+
export function __wbg_error_ec1c81ec21690870(arg0, arg1) {
|
|
5525
5563
|
console.error(getStringFromWasm0(arg0, arg1));
|
|
5526
5564
|
};
|
|
5527
5565
|
|
|
@@ -5640,7 +5678,7 @@ export function __wbg_log_0cc1b7768397bcfe(arg0, arg1, arg2, arg3, arg4, arg5, a
|
|
|
5640
5678
|
}
|
|
5641
5679
|
};
|
|
5642
5680
|
|
|
5643
|
-
export function
|
|
5681
|
+
export function __wbg_log_8c0006defd0ef388(arg0, arg1) {
|
|
5644
5682
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
5645
5683
|
};
|
|
5646
5684
|
|
|
@@ -5777,7 +5815,7 @@ export function __wbg_node_905d3e251edff8a2(arg0) {
|
|
|
5777
5815
|
return ret;
|
|
5778
5816
|
};
|
|
5779
5817
|
|
|
5780
|
-
export function
|
|
5818
|
+
export function __wbg_now_8a87c5466cc7d560() {
|
|
5781
5819
|
const ret = Date.now();
|
|
5782
5820
|
return ret;
|
|
5783
5821
|
};
|
|
@@ -5890,7 +5928,7 @@ export function __wbg_versionvector_new(arg0) {
|
|
|
5890
5928
|
return ret;
|
|
5891
5929
|
};
|
|
5892
5930
|
|
|
5893
|
-
export function
|
|
5931
|
+
export function __wbg_warn_6a7b1c2df711ad0a(arg0, arg1) {
|
|
5894
5932
|
console.warn(getStringFromWasm0(arg0, arg1));
|
|
5895
5933
|
};
|
|
5896
5934
|
|
|
Binary file
|
|
@@ -134,6 +134,7 @@ export const lorodoc_shallowSinceFrontiers: (a: number) => [number, number, numb
|
|
|
134
134
|
export const lorodoc_shallowSinceVV: (a: number) => number;
|
|
135
135
|
export const lorodoc_subscribe: (a: number, b: any) => any;
|
|
136
136
|
export const lorodoc_subscribeFirstCommitFromPeer: (a: number, b: any) => any;
|
|
137
|
+
export const lorodoc_subscribeJsonpath: (a: number, b: number, c: number, d: any) => [number, number, number];
|
|
137
138
|
export const lorodoc_subscribeLocalUpdates: (a: number, b: any) => any;
|
|
138
139
|
export const lorodoc_subscribePreCommit: (a: number, b: any) => any;
|
|
139
140
|
export const lorodoc_toJSON: (a: number) => [number, number, number];
|
|
@@ -212,6 +213,7 @@ export const loromovablelist_toArray: (a: number) => [number, number];
|
|
|
212
213
|
export const loromovablelist_toJSON: (a: number) => any;
|
|
213
214
|
export const lorotext_applyDelta: (a: number, b: any) => [number, number];
|
|
214
215
|
export const lorotext_charAt: (a: number, b: number) => [number, number, number];
|
|
216
|
+
export const lorotext_convertPos: (a: number, b: number, c: number, d: number, e: number, f: number) => any;
|
|
215
217
|
export const lorotext_delete: (a: number, b: number, c: number) => [number, number];
|
|
216
218
|
export const lorotext_deleteUtf8: (a: number, b: number, c: number) => [number, number];
|
|
217
219
|
export const lorotext_getAttached: (a: number) => any;
|
|
@@ -323,6 +325,6 @@ export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
|
323
325
|
export const __wbindgen_export_6: WebAssembly.Table;
|
|
324
326
|
export const __externref_table_dealloc: (a: number) => void;
|
|
325
327
|
export const __externref_drop_slice: (a: number, b: number) => void;
|
|
326
|
-
export const
|
|
327
|
-
export const
|
|
328
|
+
export const closure9_externref_shim: (a: number, b: number, c: any) => void;
|
|
329
|
+
export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h2222385ed10d04df: (a: number, b: number) => void;
|
|
328
330
|
export const __wbindgen_start: () => void;
|
package/nodejs/loro_wasm.d.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Get the version of Loro
|
|
5
|
+
*/
|
|
6
|
+
export function LORO_VERSION(): string;
|
|
7
|
+
/**
|
|
8
|
+
* Enable debug info of Loro
|
|
9
|
+
*/
|
|
10
|
+
export function setDebug(): void;
|
|
11
|
+
export function encodeFrontiers(frontiers: ({ peer: PeerID, counter: number })[]): Uint8Array;
|
|
3
12
|
/**
|
|
4
13
|
* Redacts sensitive content in JSON updates within the specified version range.
|
|
5
14
|
*
|
|
@@ -20,6 +29,9 @@
|
|
|
20
29
|
* @returns {Object} The redacted JSON updates
|
|
21
30
|
*/
|
|
22
31
|
export function redactJsonUpdates(json_updates: string | JsonSchema, version_range: any): JsonSchema;
|
|
32
|
+
export function callPendingEvents(): void;
|
|
33
|
+
export function run(): void;
|
|
34
|
+
export function decodeFrontiers(bytes: Uint8Array): { peer: PeerID, counter: number }[];
|
|
23
35
|
/**
|
|
24
36
|
* Decode the metadata of the import blob.
|
|
25
37
|
*
|
|
@@ -33,18 +45,6 @@ export function redactJsonUpdates(json_updates: string | JsonSchema, version_ran
|
|
|
33
45
|
* - changeNum
|
|
34
46
|
*/
|
|
35
47
|
export function decodeImportBlobMeta(blob: Uint8Array, check_checksum: boolean): ImportBlobMetadata;
|
|
36
|
-
export function decodeFrontiers(bytes: Uint8Array): { peer: PeerID, counter: number }[];
|
|
37
|
-
export function run(): void;
|
|
38
|
-
export function encodeFrontiers(frontiers: ({ peer: PeerID, counter: number })[]): Uint8Array;
|
|
39
|
-
/**
|
|
40
|
-
* Enable debug info of Loro
|
|
41
|
-
*/
|
|
42
|
-
export function setDebug(): void;
|
|
43
|
-
export function callPendingEvents(): void;
|
|
44
|
-
/**
|
|
45
|
-
* Get the version of Loro
|
|
46
|
-
*/
|
|
47
|
-
export function LORO_VERSION(): string;
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* Container types supported by loro.
|
|
@@ -63,6 +63,7 @@ export function LORO_VERSION(): string;
|
|
|
63
63
|
export type ContainerType = "Text" | "Map" | "List"| "Tree" | "MovableList" | "Counter";
|
|
64
64
|
|
|
65
65
|
export type PeerID = `${number}`;
|
|
66
|
+
export type TextPosType = "unicode" | "utf16" | "utf8";
|
|
66
67
|
/**
|
|
67
68
|
* The unique id of each container.
|
|
68
69
|
*
|
|
@@ -338,7 +339,7 @@ interface LoroDoc {
|
|
|
338
339
|
export type Delta<T> =
|
|
339
340
|
| {
|
|
340
341
|
insert: T;
|
|
341
|
-
attributes?: { [key in string]:
|
|
342
|
+
attributes?: { [key in string]: Value };
|
|
342
343
|
retain?: undefined;
|
|
343
344
|
delete?: undefined;
|
|
344
345
|
}
|
|
@@ -350,7 +351,7 @@ export type Delta<T> =
|
|
|
350
351
|
}
|
|
351
352
|
| {
|
|
352
353
|
retain: number;
|
|
353
|
-
attributes?: { [key in string]:
|
|
354
|
+
attributes?: { [key in string]: Value };
|
|
354
355
|
delete?: undefined;
|
|
355
356
|
insert?: undefined;
|
|
356
357
|
};
|
|
@@ -450,6 +451,11 @@ export interface ImportBlobMetadata {
|
|
|
450
451
|
}
|
|
451
452
|
|
|
452
453
|
interface LoroText {
|
|
454
|
+
/**
|
|
455
|
+
* Convert a position between coordinate systems.
|
|
456
|
+
*/
|
|
457
|
+
convertPos(index: number, from: TextPosType, to: TextPosType): number | undefined;
|
|
458
|
+
|
|
453
459
|
/**
|
|
454
460
|
* Get the cursor position at the given pos.
|
|
455
461
|
*
|
|
@@ -868,6 +874,12 @@ interface Listener {
|
|
|
868
874
|
|
|
869
875
|
interface LoroDoc {
|
|
870
876
|
subscribe(listener: Listener): Subscription;
|
|
877
|
+
/**
|
|
878
|
+
* Subscribe to changes that may affect a JSONPath query.
|
|
879
|
+
* Callback may fire false positives and carries no query result.
|
|
880
|
+
* You can debounce/throttle the callback before running `JSONPath(...)` to optimize heavy reads.
|
|
881
|
+
*/
|
|
882
|
+
subscribeJsonpath(path: string, callback: () => void): Subscription;
|
|
871
883
|
}
|
|
872
884
|
|
|
873
885
|
interface UndoManager {
|
|
@@ -905,6 +917,12 @@ interface UndoManager {
|
|
|
905
917
|
groupEnd(): void;
|
|
906
918
|
}
|
|
907
919
|
interface LoroDoc<T extends Record<string, Container> = Record<string, Container>> {
|
|
920
|
+
/**
|
|
921
|
+
* Subscribe to changes that may affect a JSONPath query.
|
|
922
|
+
* Callback may fire false positives and carries no query result.
|
|
923
|
+
* You can debounce/throttle the callback before running `JSONPath(...)` to optimize heavy reads.
|
|
924
|
+
*/
|
|
925
|
+
subscribeJsonpath(path: string, callback: () => void): Subscription;
|
|
908
926
|
/**
|
|
909
927
|
* Get a LoroMap by container id
|
|
910
928
|
*
|
|
@@ -1264,6 +1282,10 @@ interface LoroText {
|
|
|
1264
1282
|
insert(pos: number, text: string): void;
|
|
1265
1283
|
delete(pos: number, len: number): void;
|
|
1266
1284
|
subscribe(listener: Listener): Subscription;
|
|
1285
|
+
/**
|
|
1286
|
+
* Convert a position between coordinate systems.
|
|
1287
|
+
*/
|
|
1288
|
+
convertPos(index: number, from: TextPosType, to: TextPosType): number | undefined;
|
|
1267
1289
|
/**
|
|
1268
1290
|
* Update the current text to the target text.
|
|
1269
1291
|
*
|
|
@@ -3035,6 +3057,14 @@ export class LoroText {
|
|
|
3035
3057
|
* ```
|
|
3036
3058
|
*/
|
|
3037
3059
|
applyDelta(delta: Delta<string>[]): void;
|
|
3060
|
+
/**
|
|
3061
|
+
* Convert a position between coordinate systems.
|
|
3062
|
+
*
|
|
3063
|
+
* Supported values: `"unicode"`, `"utf16"`, `"utf8"`.
|
|
3064
|
+
*
|
|
3065
|
+
* Returns `undefined` when out of bounds or unsupported.
|
|
3066
|
+
*/
|
|
3067
|
+
convertPos(index: number, from: string, to: string): any;
|
|
3038
3068
|
/**
|
|
3039
3069
|
* Delete elements from index to utf-8 index + len
|
|
3040
3070
|
*
|