loro-crdt 1.13.6 → 1.13.7
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 +17 -0
- package/base64/index.js +88 -87
- package/base64/loro_wasm.d.ts +8 -8
- package/browser/index.js +4 -4
- package/browser/loro_wasm.d.ts +8 -8
- package/browser/loro_wasm.js +12 -12
- package/browser/loro_wasm_bg.js +83 -82
- package/browser/loro_wasm_bg.wasm +0 -0
- package/browser/loro_wasm_bg.wasm.d.ts +2 -2
- package/bundler/index.js +4 -4
- package/bundler/loro_wasm.d.ts +8 -8
- package/bundler/loro_wasm_bg.js +83 -82
- package/bundler/loro_wasm_bg.wasm +0 -0
- package/bundler/loro_wasm_bg.wasm.d.ts +2 -2
- package/nodejs/loro_wasm.d.ts +8 -8
- package/nodejs/loro_wasm.js +83 -82
- package/nodejs/loro_wasm_bg.wasm +0 -0
- package/nodejs/loro_wasm_bg.wasm.d.ts +2 -2
- package/package.json +1 -1
- package/web/loro_wasm.d.ts +10 -10
- package/web/loro_wasm.js +82 -81
- package/web/loro_wasm_bg.wasm +0 -0
- package/web/loro_wasm_bg.wasm.d.ts +2 -2
package/bundler/loro_wasm_bg.js
CHANGED
|
@@ -263,6 +263,11 @@ function getArrayJsValueFromWasm0(ptr, len) {
|
|
|
263
263
|
}
|
|
264
264
|
return result;
|
|
265
265
|
}
|
|
266
|
+
|
|
267
|
+
export function run() {
|
|
268
|
+
wasm.run();
|
|
269
|
+
}
|
|
270
|
+
|
|
266
271
|
/**
|
|
267
272
|
* Enable debug info of Loro
|
|
268
273
|
*/
|
|
@@ -270,6 +275,27 @@ export function setDebug() {
|
|
|
270
275
|
wasm.setDebug();
|
|
271
276
|
}
|
|
272
277
|
|
|
278
|
+
/**
|
|
279
|
+
* Get the version of Loro
|
|
280
|
+
* @returns {string}
|
|
281
|
+
*/
|
|
282
|
+
export function LORO_VERSION() {
|
|
283
|
+
let deferred1_0;
|
|
284
|
+
let deferred1_1;
|
|
285
|
+
try {
|
|
286
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
287
|
+
wasm.LORO_VERSION(retptr);
|
|
288
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
289
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
290
|
+
deferred1_0 = r0;
|
|
291
|
+
deferred1_1 = r1;
|
|
292
|
+
return getStringFromWasm0(r0, r1);
|
|
293
|
+
} finally {
|
|
294
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
295
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
|
|
273
299
|
/**
|
|
274
300
|
* Decode the metadata of the import blob.
|
|
275
301
|
*
|
|
@@ -303,48 +329,44 @@ export function decodeImportBlobMeta(blob, check_checksum) {
|
|
|
303
329
|
}
|
|
304
330
|
}
|
|
305
331
|
|
|
306
|
-
export function callPendingEvents() {
|
|
307
|
-
wasm.callPendingEvents();
|
|
308
|
-
}
|
|
309
|
-
|
|
310
|
-
function passArrayJsValueToWasm0(array, malloc) {
|
|
311
|
-
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
312
|
-
const mem = getDataViewMemory0();
|
|
313
|
-
for (let i = 0; i < array.length; i++) {
|
|
314
|
-
mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
|
|
315
|
-
}
|
|
316
|
-
WASM_VECTOR_LEN = array.length;
|
|
317
|
-
return ptr;
|
|
318
|
-
}
|
|
319
332
|
/**
|
|
320
|
-
*
|
|
321
|
-
*
|
|
333
|
+
* Redacts sensitive content in JSON updates within the specified version range.
|
|
334
|
+
*
|
|
335
|
+
* This function allows you to share document history while removing potentially sensitive content.
|
|
336
|
+
* It preserves the document structure and collaboration capabilities while replacing content with
|
|
337
|
+
* placeholders according to these redaction rules:
|
|
338
|
+
*
|
|
339
|
+
* - Preserves delete and move operations
|
|
340
|
+
* - Replaces text insertion content with the Unicode replacement character
|
|
341
|
+
* - Substitutes list and map insert values with null
|
|
342
|
+
* - Maintains structure of child containers
|
|
343
|
+
* - Replaces text mark values with null
|
|
344
|
+
* - Preserves map keys and text annotation keys
|
|
345
|
+
*
|
|
346
|
+
* @param {Object|string} jsonUpdates - The JSON updates to redact (object or JSON string)
|
|
347
|
+
* @param {Object} versionRange - Version range defining what content to redact,
|
|
348
|
+
* format: { peerId: [startCounter, endCounter], ... }
|
|
349
|
+
* @returns {Object} The redacted JSON updates
|
|
350
|
+
* @param {string | JsonSchema} json_updates
|
|
351
|
+
* @param {any} version_range
|
|
352
|
+
* @returns {JsonSchema}
|
|
322
353
|
*/
|
|
323
|
-
export function
|
|
354
|
+
export function redactJsonUpdates(json_updates, version_range) {
|
|
324
355
|
try {
|
|
325
356
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
326
|
-
|
|
327
|
-
const len0 = WASM_VECTOR_LEN;
|
|
328
|
-
wasm.encodeFrontiers(retptr, ptr0, len0);
|
|
357
|
+
wasm.redactJsonUpdates(retptr, addHeapObject(json_updates), addHeapObject(version_range));
|
|
329
358
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
330
359
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
331
360
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
throw takeObject(r2);
|
|
361
|
+
if (r2) {
|
|
362
|
+
throw takeObject(r1);
|
|
335
363
|
}
|
|
336
|
-
|
|
337
|
-
wasm.__wbindgen_free(r0, r1 * 1, 1);
|
|
338
|
-
return v2;
|
|
364
|
+
return takeObject(r0);
|
|
339
365
|
} finally {
|
|
340
366
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
341
367
|
}
|
|
342
368
|
}
|
|
343
369
|
|
|
344
|
-
export function run() {
|
|
345
|
-
wasm.run();
|
|
346
|
-
}
|
|
347
|
-
|
|
348
370
|
/**
|
|
349
371
|
* @param {Uint8Array} bytes
|
|
350
372
|
* @returns {{ peer: PeerID, counter: number }[]}
|
|
@@ -367,71 +389,50 @@ export function decodeFrontiers(bytes) {
|
|
|
367
389
|
}
|
|
368
390
|
}
|
|
369
391
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
* @returns {string}
|
|
373
|
-
*/
|
|
374
|
-
export function LORO_VERSION() {
|
|
375
|
-
let deferred1_0;
|
|
376
|
-
let deferred1_1;
|
|
377
|
-
try {
|
|
378
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
379
|
-
wasm.LORO_VERSION(retptr);
|
|
380
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
381
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
382
|
-
deferred1_0 = r0;
|
|
383
|
-
deferred1_1 = r1;
|
|
384
|
-
return getStringFromWasm0(r0, r1);
|
|
385
|
-
} finally {
|
|
386
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
387
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
388
|
-
}
|
|
392
|
+
export function callPendingEvents() {
|
|
393
|
+
wasm.callPendingEvents();
|
|
389
394
|
}
|
|
390
395
|
|
|
396
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
397
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
398
|
+
const mem = getDataViewMemory0();
|
|
399
|
+
for (let i = 0; i < array.length; i++) {
|
|
400
|
+
mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
|
|
401
|
+
}
|
|
402
|
+
WASM_VECTOR_LEN = array.length;
|
|
403
|
+
return ptr;
|
|
404
|
+
}
|
|
391
405
|
/**
|
|
392
|
-
*
|
|
393
|
-
*
|
|
394
|
-
* This function allows you to share document history while removing potentially sensitive content.
|
|
395
|
-
* It preserves the document structure and collaboration capabilities while replacing content with
|
|
396
|
-
* placeholders according to these redaction rules:
|
|
397
|
-
*
|
|
398
|
-
* - Preserves delete and move operations
|
|
399
|
-
* - Replaces text insertion content with the Unicode replacement character
|
|
400
|
-
* - Substitutes list and map insert values with null
|
|
401
|
-
* - Maintains structure of child containers
|
|
402
|
-
* - Replaces text mark values with null
|
|
403
|
-
* - Preserves map keys and text annotation keys
|
|
404
|
-
*
|
|
405
|
-
* @param {Object|string} jsonUpdates - The JSON updates to redact (object or JSON string)
|
|
406
|
-
* @param {Object} versionRange - Version range defining what content to redact,
|
|
407
|
-
* format: { peerId: [startCounter, endCounter], ... }
|
|
408
|
-
* @returns {Object} The redacted JSON updates
|
|
409
|
-
* @param {string | JsonSchema} json_updates
|
|
410
|
-
* @param {any} version_range
|
|
411
|
-
* @returns {JsonSchema}
|
|
406
|
+
* @param {({ peer: PeerID, counter: number })[]} frontiers
|
|
407
|
+
* @returns {Uint8Array}
|
|
412
408
|
*/
|
|
413
|
-
export function
|
|
409
|
+
export function encodeFrontiers(frontiers) {
|
|
414
410
|
try {
|
|
415
411
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
416
|
-
|
|
412
|
+
const ptr0 = passArrayJsValueToWasm0(frontiers, wasm.__wbindgen_malloc);
|
|
413
|
+
const len0 = WASM_VECTOR_LEN;
|
|
414
|
+
wasm.encodeFrontiers(retptr, ptr0, len0);
|
|
417
415
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
418
416
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
419
417
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
420
|
-
|
|
421
|
-
|
|
418
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
419
|
+
if (r3) {
|
|
420
|
+
throw takeObject(r2);
|
|
422
421
|
}
|
|
423
|
-
|
|
422
|
+
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
|
423
|
+
wasm.__wbindgen_free(r0, r1 * 1, 1);
|
|
424
|
+
return v2;
|
|
424
425
|
} finally {
|
|
425
426
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
426
427
|
}
|
|
427
428
|
}
|
|
428
429
|
|
|
429
430
|
function __wbg_adapter_60(arg0, arg1, arg2) {
|
|
430
|
-
wasm.
|
|
431
|
+
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hbc243e3100319c48(arg0, arg1, addHeapObject(arg2));
|
|
431
432
|
}
|
|
432
433
|
|
|
433
434
|
function __wbg_adapter_63(arg0, arg1) {
|
|
434
|
-
wasm.
|
|
435
|
+
wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h09294ef44fc27173(arg0, arg1);
|
|
435
436
|
}
|
|
436
437
|
|
|
437
438
|
const AwarenessWasmFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
@@ -7009,6 +7010,10 @@ export function __wbg_entries_c8a90a7ed73e84ce(arg0) {
|
|
|
7009
7010
|
return addHeapObject(ret);
|
|
7010
7011
|
};
|
|
7011
7012
|
|
|
7013
|
+
export function __wbg_error_30083555868aa7a9(arg0, arg1) {
|
|
7014
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
7015
|
+
};
|
|
7016
|
+
|
|
7012
7017
|
export function __wbg_error_7534b8e9a36f1ab4(arg0, arg1) {
|
|
7013
7018
|
let deferred0_0;
|
|
7014
7019
|
let deferred0_1;
|
|
@@ -7021,10 +7026,6 @@ export function __wbg_error_7534b8e9a36f1ab4(arg0, arg1) {
|
|
|
7021
7026
|
}
|
|
7022
7027
|
};
|
|
7023
7028
|
|
|
7024
|
-
export function __wbg_error_ddc720e1a9bdab2e(arg0, arg1) {
|
|
7025
|
-
console.error(getStringFromWasm0(arg0, arg1));
|
|
7026
|
-
};
|
|
7027
|
-
|
|
7028
7029
|
export function __wbg_from_2a5d3e218e67aa85(arg0) {
|
|
7029
7030
|
const ret = Array.from(getObject(arg0));
|
|
7030
7031
|
return addHeapObject(ret);
|
|
@@ -7140,7 +7141,7 @@ export function __wbg_log_0cc1b7768397bcfe(arg0, arg1, arg2, arg3, arg4, arg5, a
|
|
|
7140
7141
|
}
|
|
7141
7142
|
};
|
|
7142
7143
|
|
|
7143
|
-
export function
|
|
7144
|
+
export function __wbg_log_c534a954ce262324(arg0, arg1) {
|
|
7144
7145
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
7145
7146
|
};
|
|
7146
7147
|
|
|
@@ -7277,7 +7278,7 @@ export function __wbg_node_905d3e251edff8a2(arg0) {
|
|
|
7277
7278
|
return addHeapObject(ret);
|
|
7278
7279
|
};
|
|
7279
7280
|
|
|
7280
|
-
export function
|
|
7281
|
+
export function __wbg_now_9a16e63446ca7697() {
|
|
7281
7282
|
const ret = Date.now();
|
|
7282
7283
|
return ret;
|
|
7283
7284
|
};
|
|
@@ -7390,7 +7391,7 @@ export function __wbg_versionvector_new(arg0) {
|
|
|
7390
7391
|
return addHeapObject(ret);
|
|
7391
7392
|
};
|
|
7392
7393
|
|
|
7393
|
-
export function
|
|
7394
|
+
export function __wbg_warn_994f3bd0367746f9(arg0, arg1) {
|
|
7394
7395
|
console.warn(getStringFromWasm0(arg0, arg1));
|
|
7395
7396
|
};
|
|
7396
7397
|
|
|
Binary file
|
|
@@ -330,6 +330,6 @@ export const __wbindgen_exn_store: (a: number) => void;
|
|
|
330
330
|
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
331
331
|
export const __wbindgen_export_4: WebAssembly.Table;
|
|
332
332
|
export const __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
333
|
-
export const
|
|
334
|
-
export const
|
|
333
|
+
export const _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hbc243e3100319c48: (a: number, b: number, c: number) => void;
|
|
334
|
+
export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h09294ef44fc27173: (a: number, b: number) => void;
|
|
335
335
|
export const __wbindgen_start: () => void;
|
package/nodejs/loro_wasm.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
export function run(): void;
|
|
3
4
|
/**
|
|
4
5
|
* Enable debug info of Loro
|
|
5
6
|
*/
|
|
6
7
|
export function setDebug(): void;
|
|
8
|
+
/**
|
|
9
|
+
* Get the version of Loro
|
|
10
|
+
*/
|
|
11
|
+
export function LORO_VERSION(): string;
|
|
7
12
|
/**
|
|
8
13
|
* Decode the metadata of the import blob.
|
|
9
14
|
*
|
|
@@ -17,14 +22,6 @@ export function setDebug(): void;
|
|
|
17
22
|
* - changeNum
|
|
18
23
|
*/
|
|
19
24
|
export function decodeImportBlobMeta(blob: Uint8Array, check_checksum: boolean): ImportBlobMetadata;
|
|
20
|
-
export function callPendingEvents(): void;
|
|
21
|
-
export function encodeFrontiers(frontiers: ({ peer: PeerID, counter: number })[]): Uint8Array;
|
|
22
|
-
export function run(): void;
|
|
23
|
-
export function decodeFrontiers(bytes: Uint8Array): { peer: PeerID, counter: number }[];
|
|
24
|
-
/**
|
|
25
|
-
* Get the version of Loro
|
|
26
|
-
*/
|
|
27
|
-
export function LORO_VERSION(): string;
|
|
28
25
|
/**
|
|
29
26
|
* Redacts sensitive content in JSON updates within the specified version range.
|
|
30
27
|
*
|
|
@@ -45,6 +42,9 @@ export function LORO_VERSION(): string;
|
|
|
45
42
|
* @returns {Object} The redacted JSON updates
|
|
46
43
|
*/
|
|
47
44
|
export function redactJsonUpdates(json_updates: string | JsonSchema, version_range: any): JsonSchema;
|
|
45
|
+
export function decodeFrontiers(bytes: Uint8Array): { peer: PeerID, counter: number }[];
|
|
46
|
+
export function callPendingEvents(): void;
|
|
47
|
+
export function encodeFrontiers(frontiers: ({ peer: PeerID, counter: number })[]): Uint8Array;
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* Container types supported by loro.
|
package/nodejs/loro_wasm.js
CHANGED
|
@@ -259,6 +259,11 @@ function getArrayJsValueFromWasm0(ptr, len) {
|
|
|
259
259
|
}
|
|
260
260
|
return result;
|
|
261
261
|
}
|
|
262
|
+
|
|
263
|
+
module.exports.run = function() {
|
|
264
|
+
wasm.run();
|
|
265
|
+
};
|
|
266
|
+
|
|
262
267
|
/**
|
|
263
268
|
* Enable debug info of Loro
|
|
264
269
|
*/
|
|
@@ -266,6 +271,27 @@ module.exports.setDebug = function() {
|
|
|
266
271
|
wasm.setDebug();
|
|
267
272
|
};
|
|
268
273
|
|
|
274
|
+
/**
|
|
275
|
+
* Get the version of Loro
|
|
276
|
+
* @returns {string}
|
|
277
|
+
*/
|
|
278
|
+
module.exports.LORO_VERSION = function() {
|
|
279
|
+
let deferred1_0;
|
|
280
|
+
let deferred1_1;
|
|
281
|
+
try {
|
|
282
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
283
|
+
wasm.LORO_VERSION(retptr);
|
|
284
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
285
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
286
|
+
deferred1_0 = r0;
|
|
287
|
+
deferred1_1 = r1;
|
|
288
|
+
return getStringFromWasm0(r0, r1);
|
|
289
|
+
} finally {
|
|
290
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
291
|
+
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
292
|
+
}
|
|
293
|
+
};
|
|
294
|
+
|
|
269
295
|
/**
|
|
270
296
|
* Decode the metadata of the import blob.
|
|
271
297
|
*
|
|
@@ -299,48 +325,44 @@ module.exports.decodeImportBlobMeta = function(blob, check_checksum) {
|
|
|
299
325
|
}
|
|
300
326
|
};
|
|
301
327
|
|
|
302
|
-
module.exports.callPendingEvents = function() {
|
|
303
|
-
wasm.callPendingEvents();
|
|
304
|
-
};
|
|
305
|
-
|
|
306
|
-
function passArrayJsValueToWasm0(array, malloc) {
|
|
307
|
-
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
308
|
-
const mem = getDataViewMemory0();
|
|
309
|
-
for (let i = 0; i < array.length; i++) {
|
|
310
|
-
mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
|
|
311
|
-
}
|
|
312
|
-
WASM_VECTOR_LEN = array.length;
|
|
313
|
-
return ptr;
|
|
314
|
-
}
|
|
315
328
|
/**
|
|
316
|
-
*
|
|
317
|
-
*
|
|
329
|
+
* Redacts sensitive content in JSON updates within the specified version range.
|
|
330
|
+
*
|
|
331
|
+
* This function allows you to share document history while removing potentially sensitive content.
|
|
332
|
+
* It preserves the document structure and collaboration capabilities while replacing content with
|
|
333
|
+
* placeholders according to these redaction rules:
|
|
334
|
+
*
|
|
335
|
+
* - Preserves delete and move operations
|
|
336
|
+
* - Replaces text insertion content with the Unicode replacement character
|
|
337
|
+
* - Substitutes list and map insert values with null
|
|
338
|
+
* - Maintains structure of child containers
|
|
339
|
+
* - Replaces text mark values with null
|
|
340
|
+
* - Preserves map keys and text annotation keys
|
|
341
|
+
*
|
|
342
|
+
* @param {Object|string} jsonUpdates - The JSON updates to redact (object or JSON string)
|
|
343
|
+
* @param {Object} versionRange - Version range defining what content to redact,
|
|
344
|
+
* format: { peerId: [startCounter, endCounter], ... }
|
|
345
|
+
* @returns {Object} The redacted JSON updates
|
|
346
|
+
* @param {string | JsonSchema} json_updates
|
|
347
|
+
* @param {any} version_range
|
|
348
|
+
* @returns {JsonSchema}
|
|
318
349
|
*/
|
|
319
|
-
module.exports.
|
|
350
|
+
module.exports.redactJsonUpdates = function(json_updates, version_range) {
|
|
320
351
|
try {
|
|
321
352
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
322
|
-
|
|
323
|
-
const len0 = WASM_VECTOR_LEN;
|
|
324
|
-
wasm.encodeFrontiers(retptr, ptr0, len0);
|
|
353
|
+
wasm.redactJsonUpdates(retptr, addHeapObject(json_updates), addHeapObject(version_range));
|
|
325
354
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
326
355
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
327
356
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
throw takeObject(r2);
|
|
357
|
+
if (r2) {
|
|
358
|
+
throw takeObject(r1);
|
|
331
359
|
}
|
|
332
|
-
|
|
333
|
-
wasm.__wbindgen_free(r0, r1 * 1, 1);
|
|
334
|
-
return v2;
|
|
360
|
+
return takeObject(r0);
|
|
335
361
|
} finally {
|
|
336
362
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
337
363
|
}
|
|
338
364
|
};
|
|
339
365
|
|
|
340
|
-
module.exports.run = function() {
|
|
341
|
-
wasm.run();
|
|
342
|
-
};
|
|
343
|
-
|
|
344
366
|
/**
|
|
345
367
|
* @param {Uint8Array} bytes
|
|
346
368
|
* @returns {{ peer: PeerID, counter: number }[]}
|
|
@@ -363,71 +385,50 @@ module.exports.decodeFrontiers = function(bytes) {
|
|
|
363
385
|
}
|
|
364
386
|
};
|
|
365
387
|
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
* @returns {string}
|
|
369
|
-
*/
|
|
370
|
-
module.exports.LORO_VERSION = function() {
|
|
371
|
-
let deferred1_0;
|
|
372
|
-
let deferred1_1;
|
|
373
|
-
try {
|
|
374
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
375
|
-
wasm.LORO_VERSION(retptr);
|
|
376
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
377
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
378
|
-
deferred1_0 = r0;
|
|
379
|
-
deferred1_1 = r1;
|
|
380
|
-
return getStringFromWasm0(r0, r1);
|
|
381
|
-
} finally {
|
|
382
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
383
|
-
wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
|
|
384
|
-
}
|
|
388
|
+
module.exports.callPendingEvents = function() {
|
|
389
|
+
wasm.callPendingEvents();
|
|
385
390
|
};
|
|
386
391
|
|
|
392
|
+
function passArrayJsValueToWasm0(array, malloc) {
|
|
393
|
+
const ptr = malloc(array.length * 4, 4) >>> 0;
|
|
394
|
+
const mem = getDataViewMemory0();
|
|
395
|
+
for (let i = 0; i < array.length; i++) {
|
|
396
|
+
mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
|
|
397
|
+
}
|
|
398
|
+
WASM_VECTOR_LEN = array.length;
|
|
399
|
+
return ptr;
|
|
400
|
+
}
|
|
387
401
|
/**
|
|
388
|
-
*
|
|
389
|
-
*
|
|
390
|
-
* This function allows you to share document history while removing potentially sensitive content.
|
|
391
|
-
* It preserves the document structure and collaboration capabilities while replacing content with
|
|
392
|
-
* placeholders according to these redaction rules:
|
|
393
|
-
*
|
|
394
|
-
* - Preserves delete and move operations
|
|
395
|
-
* - Replaces text insertion content with the Unicode replacement character
|
|
396
|
-
* - Substitutes list and map insert values with null
|
|
397
|
-
* - Maintains structure of child containers
|
|
398
|
-
* - Replaces text mark values with null
|
|
399
|
-
* - Preserves map keys and text annotation keys
|
|
400
|
-
*
|
|
401
|
-
* @param {Object|string} jsonUpdates - The JSON updates to redact (object or JSON string)
|
|
402
|
-
* @param {Object} versionRange - Version range defining what content to redact,
|
|
403
|
-
* format: { peerId: [startCounter, endCounter], ... }
|
|
404
|
-
* @returns {Object} The redacted JSON updates
|
|
405
|
-
* @param {string | JsonSchema} json_updates
|
|
406
|
-
* @param {any} version_range
|
|
407
|
-
* @returns {JsonSchema}
|
|
402
|
+
* @param {({ peer: PeerID, counter: number })[]} frontiers
|
|
403
|
+
* @returns {Uint8Array}
|
|
408
404
|
*/
|
|
409
|
-
module.exports.
|
|
405
|
+
module.exports.encodeFrontiers = function(frontiers) {
|
|
410
406
|
try {
|
|
411
407
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
412
|
-
|
|
408
|
+
const ptr0 = passArrayJsValueToWasm0(frontiers, wasm.__wbindgen_malloc);
|
|
409
|
+
const len0 = WASM_VECTOR_LEN;
|
|
410
|
+
wasm.encodeFrontiers(retptr, ptr0, len0);
|
|
413
411
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
414
412
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
415
413
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
416
|
-
|
|
417
|
-
|
|
414
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
415
|
+
if (r3) {
|
|
416
|
+
throw takeObject(r2);
|
|
418
417
|
}
|
|
419
|
-
|
|
418
|
+
var v2 = getArrayU8FromWasm0(r0, r1).slice();
|
|
419
|
+
wasm.__wbindgen_free(r0, r1 * 1, 1);
|
|
420
|
+
return v2;
|
|
420
421
|
} finally {
|
|
421
422
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
422
423
|
}
|
|
423
424
|
};
|
|
424
425
|
|
|
425
426
|
function __wbg_adapter_60(arg0, arg1, arg2) {
|
|
426
|
-
wasm.
|
|
427
|
+
wasm._dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hbc243e3100319c48(arg0, arg1, addHeapObject(arg2));
|
|
427
428
|
}
|
|
428
429
|
|
|
429
430
|
function __wbg_adapter_63(arg0, arg1) {
|
|
430
|
-
wasm.
|
|
431
|
+
wasm._dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h09294ef44fc27173(arg0, arg1);
|
|
431
432
|
}
|
|
432
433
|
|
|
433
434
|
const AwarenessWasmFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
@@ -7019,6 +7020,10 @@ module.exports.__wbg_entries_c8a90a7ed73e84ce = function(arg0) {
|
|
|
7019
7020
|
return addHeapObject(ret);
|
|
7020
7021
|
};
|
|
7021
7022
|
|
|
7023
|
+
module.exports.__wbg_error_30083555868aa7a9 = function(arg0, arg1) {
|
|
7024
|
+
console.error(getStringFromWasm0(arg0, arg1));
|
|
7025
|
+
};
|
|
7026
|
+
|
|
7022
7027
|
module.exports.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
|
|
7023
7028
|
let deferred0_0;
|
|
7024
7029
|
let deferred0_1;
|
|
@@ -7031,10 +7036,6 @@ module.exports.__wbg_error_7534b8e9a36f1ab4 = function(arg0, arg1) {
|
|
|
7031
7036
|
}
|
|
7032
7037
|
};
|
|
7033
7038
|
|
|
7034
|
-
module.exports.__wbg_error_ddc720e1a9bdab2e = function(arg0, arg1) {
|
|
7035
|
-
console.error(getStringFromWasm0(arg0, arg1));
|
|
7036
|
-
};
|
|
7037
|
-
|
|
7038
7039
|
module.exports.__wbg_from_2a5d3e218e67aa85 = function(arg0) {
|
|
7039
7040
|
const ret = Array.from(getObject(arg0));
|
|
7040
7041
|
return addHeapObject(ret);
|
|
@@ -7150,7 +7151,7 @@ module.exports.__wbg_log_0cc1b7768397bcfe = function(arg0, arg1, arg2, arg3, arg
|
|
|
7150
7151
|
}
|
|
7151
7152
|
};
|
|
7152
7153
|
|
|
7153
|
-
module.exports.
|
|
7154
|
+
module.exports.__wbg_log_c534a954ce262324 = function(arg0, arg1) {
|
|
7154
7155
|
console.log(getStringFromWasm0(arg0, arg1));
|
|
7155
7156
|
};
|
|
7156
7157
|
|
|
@@ -7287,7 +7288,7 @@ module.exports.__wbg_node_905d3e251edff8a2 = function(arg0) {
|
|
|
7287
7288
|
return addHeapObject(ret);
|
|
7288
7289
|
};
|
|
7289
7290
|
|
|
7290
|
-
module.exports.
|
|
7291
|
+
module.exports.__wbg_now_9a16e63446ca7697 = function() {
|
|
7291
7292
|
const ret = Date.now();
|
|
7292
7293
|
return ret;
|
|
7293
7294
|
};
|
|
@@ -7400,7 +7401,7 @@ module.exports.__wbg_versionvector_new = function(arg0) {
|
|
|
7400
7401
|
return addHeapObject(ret);
|
|
7401
7402
|
};
|
|
7402
7403
|
|
|
7403
|
-
module.exports.
|
|
7404
|
+
module.exports.__wbg_warn_994f3bd0367746f9 = function(arg0, arg1) {
|
|
7404
7405
|
console.warn(getStringFromWasm0(arg0, arg1));
|
|
7405
7406
|
};
|
|
7406
7407
|
|
package/nodejs/loro_wasm_bg.wasm
CHANGED
|
Binary file
|
|
@@ -330,6 +330,6 @@ export const __wbindgen_exn_store: (a: number) => void;
|
|
|
330
330
|
export const __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
331
331
|
export const __wbindgen_export_4: WebAssembly.Table;
|
|
332
332
|
export const __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
333
|
-
export const
|
|
334
|
-
export const
|
|
333
|
+
export const _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hbc243e3100319c48: (a: number, b: number, c: number) => void;
|
|
334
|
+
export const _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h09294ef44fc27173: (a: number, b: number) => void;
|
|
335
335
|
export const __wbindgen_start: () => void;
|
package/package.json
CHANGED
package/web/loro_wasm.d.ts
CHANGED
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
+
export function run(): void;
|
|
3
4
|
/**
|
|
4
5
|
* Enable debug info of Loro
|
|
5
6
|
*/
|
|
6
7
|
export function setDebug(): void;
|
|
8
|
+
/**
|
|
9
|
+
* Get the version of Loro
|
|
10
|
+
*/
|
|
11
|
+
export function LORO_VERSION(): string;
|
|
7
12
|
/**
|
|
8
13
|
* Decode the metadata of the import blob.
|
|
9
14
|
*
|
|
@@ -17,14 +22,6 @@ export function setDebug(): void;
|
|
|
17
22
|
* - changeNum
|
|
18
23
|
*/
|
|
19
24
|
export function decodeImportBlobMeta(blob: Uint8Array, check_checksum: boolean): ImportBlobMetadata;
|
|
20
|
-
export function callPendingEvents(): void;
|
|
21
|
-
export function encodeFrontiers(frontiers: ({ peer: PeerID, counter: number })[]): Uint8Array;
|
|
22
|
-
export function run(): void;
|
|
23
|
-
export function decodeFrontiers(bytes: Uint8Array): { peer: PeerID, counter: number }[];
|
|
24
|
-
/**
|
|
25
|
-
* Get the version of Loro
|
|
26
|
-
*/
|
|
27
|
-
export function LORO_VERSION(): string;
|
|
28
25
|
/**
|
|
29
26
|
* Redacts sensitive content in JSON updates within the specified version range.
|
|
30
27
|
*
|
|
@@ -45,6 +42,9 @@ export function LORO_VERSION(): string;
|
|
|
45
42
|
* @returns {Object} The redacted JSON updates
|
|
46
43
|
*/
|
|
47
44
|
export function redactJsonUpdates(json_updates: string | JsonSchema, version_range: any): JsonSchema;
|
|
45
|
+
export function decodeFrontiers(bytes: Uint8Array): { peer: PeerID, counter: number }[];
|
|
46
|
+
export function callPendingEvents(): void;
|
|
47
|
+
export function encodeFrontiers(frontiers: ({ peer: PeerID, counter: number })[]): Uint8Array;
|
|
48
48
|
|
|
49
49
|
/**
|
|
50
50
|
* Container types supported by loro.
|
|
@@ -4224,8 +4224,8 @@ export interface InitOutput {
|
|
|
4224
4224
|
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
4225
4225
|
readonly __wbindgen_export_4: WebAssembly.Table;
|
|
4226
4226
|
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
4227
|
-
readonly
|
|
4228
|
-
readonly
|
|
4227
|
+
readonly _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hbc243e3100319c48: (a: number, b: number, c: number) => void;
|
|
4228
|
+
readonly _dyn_core__ops__function__FnMut_____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h09294ef44fc27173: (a: number, b: number) => void;
|
|
4229
4229
|
readonly __wbindgen_start: () => void;
|
|
4230
4230
|
}
|
|
4231
4231
|
|