Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

loro-wasm

Package Overview
Dependencies
Maintainers
1
Versions
81
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

loro-wasm - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

nodejs/loro_wasm_bg.wasm

364

bundler/loro_wasm_bg.js

@@ -200,2 +200,33 @@ let wasm;

*/
export function setPanicHook() {
wasm.setPanicHook();
}
function getArrayU8FromWasm0(ptr, len) {
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
}
function passArray8ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 1);
getUint8Memory0().set(arg, ptr / 1);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
let stack_pointer = 128;
function addBorrowedObject(obj) {
if (stack_pointer == 1) throw new Error('out of js stack');
heap[--stack_pointer] = obj;
return stack_pointer;
}
function _assertClass(instance, klass) {
if (!(instance instanceof klass)) {
throw new Error(`expected instance of ${klass.name}`);
}
return instance.ptr;
}
/**
*/
export function enableDebug() {

@@ -233,44 +264,58 @@ wasm.enableDebug();

}
/**
*/
export function setPanicHook() {
wasm.setPanicHook();
}
function getArrayU8FromWasm0(ptr, len) {
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
function handleError(f, args) {
try {
return f.apply(this, args);
} catch (e) {
wasm.__wbindgen_exn_store(addHeapObject(e));
}
}
function passArray8ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 1);
getUint8Memory0().set(arg, ptr / 1);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
function notDefined(what) { return () => { throw new Error(`${what} is not defined`); }; }
let stack_pointer = 128;
const EventFinalization = new FinalizationRegistry(ptr => wasm.__wbg_event_free(ptr));
/**
*/
export class Event {
function addBorrowedObject(obj) {
if (stack_pointer == 1) throw new Error('out of js stack');
heap[--stack_pointer] = obj;
return stack_pointer;
}
static __wrap(ptr) {
const obj = Object.create(Event.prototype);
obj.ptr = ptr;
EventFinalization.register(obj, obj.ptr, obj);
return obj;
}
function _assertClass(instance, klass) {
if (!(instance instanceof klass)) {
throw new Error(`expected instance of ${klass.name}`);
__destroy_into_raw() {
const ptr = this.ptr;
this.ptr = 0;
EventFinalization.unregister(this);
return ptr;
}
return instance.ptr;
}
function handleError(f, args) {
try {
return f.apply(this, args);
} catch (e) {
wasm.__wbindgen_exn_store(addHeapObject(e));
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_event_free(ptr);
}
/**
* @returns {boolean}
*/
get local() {
const ret = wasm.__wbg_get_event_local(this.ptr);
return ret !== 0;
}
/**
* @param {boolean} arg0
*/
set local(arg0) {
wasm.__wbg_set_event_local(this.ptr, arg0);
}
/**
* @returns {String | undefined}
*/
get origin() {
const ret = wasm.event_origin(this.ptr);
return takeObject(ret);
}
}
function notDefined(what) { return () => { throw new Error(`${what} is not defined`); }; }
const LoroFinalization = new FinalizationRegistry(ptr => wasm.__wbg_loro_free(ptr));

@@ -538,2 +583,36 @@ /**

}
/**
* @param {Function} f
*/
transaction(f) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.loro_transaction(retptr, this.ptr, addHeapObject(f));
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
if (r1) {
throw takeObject(r0);
}
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* @param {String} origin
* @param {Function} f
*/
transactionWithOrigin(origin, f) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.loro_transactionWithOrigin(retptr, this.ptr, addBorrowedObject(origin), addHeapObject(f));
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
if (r1) {
throw takeObject(r0);
}
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
heap[stack_pointer++] = undefined;
}
}
}

@@ -565,11 +644,10 @@

/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {number} index
* @param {any} value
*/
insert(ctx, index, value) {
insert(txn, index, value) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(ctx, Loro);
wasm.lorolist_insert(retptr, this.ptr, ctx.ptr, index, addHeapObject(value));
wasm.lorolist_insert(retptr, this.ptr, addBorrowedObject(txn), index, addHeapObject(value));
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -582,14 +660,14 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

wasm.__wbindgen_add_to_stack_pointer(16);
heap[stack_pointer++] = undefined;
}
}
/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {number} index
* @param {number} len
*/
delete(ctx, index, len) {
delete(txn, index, len) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(ctx, Loro);
wasm.lorolist_delete(retptr, this.ptr, ctx.ptr, index, len);
wasm.lorolist_delete(retptr, this.ptr, addBorrowedObject(txn), index, len);
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -602,2 +680,3 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

wasm.__wbindgen_add_to_stack_pointer(16);
heap[stack_pointer++] = undefined;
}

@@ -639,3 +718,3 @@ }

* it may cause memory leak
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {number} pos

@@ -645,9 +724,8 @@ * @param {string} container

*/
insertContainer(ctx, pos, container) {
insertContainer(txn, pos, container) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(ctx, Loro);
const ptr0 = passStringToWasm0(container, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.lorolist_insertContainer(retptr, this.ptr, ctx.ptr, pos, ptr0, len0);
wasm.lorolist_insertContainer(retptr, this.ptr, addBorrowedObject(txn), pos, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -662,2 +740,3 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

wasm.__wbindgen_add_to_stack_pointer(16);
heap[stack_pointer++] = undefined;
}

@@ -691,13 +770,12 @@ }

/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {string} key
* @param {any} value
*/
set(ctx, key, value) {
set(txn, key, value) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(ctx, Loro);
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.loromap_set(retptr, this.ptr, ctx.ptr, ptr0, len0, addHeapObject(value));
wasm.loromap_set(retptr, this.ptr, addBorrowedObject(txn), ptr0, len0, addHeapObject(value));
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -710,15 +788,15 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

wasm.__wbindgen_add_to_stack_pointer(16);
heap[stack_pointer++] = undefined;
}
}
/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {string} key
*/
delete(ctx, key) {
delete(txn, key) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(ctx, Loro);
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.loromap_delete(retptr, this.ptr, ctx.ptr, ptr0, len0);
wasm.loromap_delete(retptr, this.ptr, addBorrowedObject(txn), ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -731,2 +809,3 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

wasm.__wbindgen_add_to_stack_pointer(16);
heap[stack_pointer++] = undefined;
}

@@ -768,3 +847,3 @@ }

/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {string} key

@@ -774,6 +853,5 @@ * @param {string} container_type

*/
insertContainer(ctx, key, container_type) {
insertContainer(txn, key, container_type) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(ctx, Loro);
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);

@@ -783,3 +861,3 @@ const len0 = WASM_VECTOR_LEN;

const len1 = WASM_VECTOR_LEN;
wasm.loromap_insertContainer(retptr, this.ptr, ctx.ptr, ptr0, len0, ptr1, len1);
wasm.loromap_insertContainer(retptr, this.ptr, addBorrowedObject(txn), ptr0, len0, ptr1, len1);
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -794,2 +872,3 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

wasm.__wbindgen_add_to_stack_pointer(16);
heap[stack_pointer++] = undefined;
}

@@ -823,13 +902,12 @@ }

/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {number} index
* @param {string} content
*/
insert(ctx, index, content) {
insert(txn, index, content) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(ctx, Loro);
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.lorotext_insert(retptr, this.ptr, ctx.ptr, index, ptr0, len0);
wasm.lorotext_insert(retptr, this.ptr, addBorrowedObject(txn), index, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -842,14 +920,14 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

wasm.__wbindgen_add_to_stack_pointer(16);
heap[stack_pointer++] = undefined;
}
}
/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {number} index
* @param {number} len
*/
delete(ctx, index, len) {
delete(txn, index, len) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(ctx, Loro);
wasm.lorotext_delete(retptr, this.ptr, ctx.ptr, index, len);
wasm.lorotext_delete(retptr, this.ptr, addBorrowedObject(txn), index, len);
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -862,2 +940,3 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

wasm.__wbindgen_add_to_stack_pointer(16);
heap[stack_pointer++] = undefined;
}

@@ -1095,2 +1174,27 @@ }

const TransactionFinalization = new FinalizationRegistry(ptr => wasm.__wbg_transaction_free(ptr));
/**
*/
export class Transaction {
static __wrap(ptr) {
const obj = Object.create(Transaction.prototype);
obj.ptr = ptr;
TransactionFinalization.register(obj, obj.ptr, obj);
return obj;
}
__destroy_into_raw() {
const ptr = this.ptr;
this.ptr = 0;
TransactionFinalization.unregister(this);
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_transaction_free(ptr);
}
}
export function __wbindgen_object_drop_ref(arg0) {

@@ -1100,8 +1204,17 @@ takeObject(arg0);

export function __wbindgen_is_object(arg0) {
const val = getObject(arg0);
const ret = typeof(val) === 'object' && val !== null;
export function __wbg_event_new(arg0) {
const ret = Event.__wrap(arg0);
return addHeapObject(ret);
};
export function __wbindgen_is_undefined(arg0) {
const ret = getObject(arg0) === undefined;
return ret;
};
export function __wbindgen_is_null(arg0) {
const ret = getObject(arg0) === null;
return ret;
};
export function __wbindgen_string_new(arg0, arg1) {

@@ -1119,11 +1232,2 @@ const ret = getStringFromWasm0(arg0, arg1);

export function __wbindgen_string_get(arg0, arg1) {
const obj = getObject(arg1);
const ret = typeof(obj) === 'string' ? obj : undefined;
var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
};
export function __wbindgen_object_clone_ref(arg0) {

@@ -1149,9 +1253,19 @@ const ret = getObject(arg0);

export function __wbindgen_is_null(arg0) {
const ret = getObject(arg0) === null;
return ret;
export function __wbg_transaction_new(arg0) {
const ret = Transaction.__wrap(arg0);
return addHeapObject(ret);
};
export function __wbindgen_is_undefined(arg0) {
const ret = getObject(arg0) === undefined;
export function __wbindgen_string_get(arg0, arg1) {
const obj = getObject(arg1);
const ret = typeof(obj) === 'string' ? obj : undefined;
var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
};
export function __wbindgen_is_object(arg0) {
const val = getObject(arg0);
const ret = typeof(val) === 'object' && val !== null;
return ret;

@@ -1181,6 +1295,2 @@ };

export function __wbg_mark_40e050a77cc39fea(arg0, arg1) {
performance.mark(getStringFromWasm0(arg0, arg1));
};
export function __wbg_log_c9486ca5d8e2cbe8(arg0, arg1) {

@@ -1202,2 +1312,6 @@ try {

export function __wbg_mark_40e050a77cc39fea(arg0, arg1) {
performance.mark(getStringFromWasm0(arg0, arg1));
};
export function __wbg_measure_aa7a73f17813f708() { return handleError(function (arg0, arg1, arg2, arg3) {

@@ -1239,9 +1353,9 @@ try {

export function __wbg_getRandomValues_f134f772d240c51f() { return handleError(function (arg0, arg1, arg2) {
const ret = getObject(arg0).getRandomValues(getArrayU8FromWasm0(arg1, arg2));
export function __wbg_crypto_9f07beb1e97bfa1b() { return handleError(function (arg0) {
const ret = getObject(arg0).crypto;
return addHeapObject(ret);
}, arguments) };
export function __wbg_crypto_9f07beb1e97bfa1b() { return handleError(function (arg0) {
const ret = getObject(arg0).crypto;
export function __wbg_getRandomValues_f134f772d240c51f() { return handleError(function (arg0, arg1, arg2) {
const ret = getObject(arg0).getRandomValues(getArrayU8FromWasm0(arg1, arg2));
return addHeapObject(ret);

@@ -1280,2 +1394,22 @@ }, arguments) };

export function __wbg_self_6d479506f72c6a71() { return handleError(function () {
const ret = self.self;
return addHeapObject(ret);
}, arguments) };
export function __wbg_window_f2557cc78490aceb() { return handleError(function () {
const ret = window.window;
return addHeapObject(ret);
}, arguments) };
export function __wbg_globalThis_7f206bda628d5286() { return handleError(function () {
const ret = globalThis.globalThis;
return addHeapObject(ret);
}, arguments) };
export function __wbg_global_ba75c50d1cf384f4() { return handleError(function () {
const ret = global.global;
return addHeapObject(ret);
}, arguments) };
export function __wbg_newwithlength_7c42f7e738a9d5d3(arg0) {

@@ -1310,4 +1444,2 @@ const ret = new Array(arg0 >>> 0);

export const __wbg_random_656f2ae924b2540e = typeof Math.random == 'function' ? Math.random : notDefined('Math.random');
export function __wbg_now_58886682b7e790d7() {

@@ -1333,17 +1465,2 @@ const ret = Date.now();

export function __wbg_has_8359f114ce042f5a() { return handleError(function (arg0, arg1) {
const ret = Reflect.has(getObject(arg0), getObject(arg1));
return ret;
}, arguments) };
export function __wbg_ownKeys_bf24e1178641d9f0() { return handleError(function (arg0) {
const ret = Reflect.ownKeys(getObject(arg0));
return addHeapObject(ret);
}, arguments) };
export function __wbg_set_bf3f89b92d5a34bf() { return handleError(function (arg0, arg1, arg2) {
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
return ret;
}, arguments) };
export function __wbg_buffer_3f3d764d4747d564(arg0) {

@@ -1354,22 +1471,2 @@ const ret = getObject(arg0).buffer;

export function __wbg_self_6d479506f72c6a71() { return handleError(function () {
const ret = self.self;
return addHeapObject(ret);
}, arguments) };
export function __wbg_window_f2557cc78490aceb() { return handleError(function () {
const ret = window.window;
return addHeapObject(ret);
}, arguments) };
export function __wbg_globalThis_7f206bda628d5286() { return handleError(function () {
const ret = globalThis.globalThis;
return addHeapObject(ret);
}, arguments) };
export function __wbg_global_ba75c50d1cf384f4() { return handleError(function () {
const ret = global.global;
return addHeapObject(ret);
}, arguments) };
export function __wbg_new_8c3f0052272a457a(arg0) {

@@ -1389,2 +1486,19 @@ const ret = new Uint8Array(getObject(arg0));

export function __wbg_has_8359f114ce042f5a() { return handleError(function (arg0, arg1) {
const ret = Reflect.has(getObject(arg0), getObject(arg1));
return ret;
}, arguments) };
export function __wbg_ownKeys_bf24e1178641d9f0() { return handleError(function (arg0) {
const ret = Reflect.ownKeys(getObject(arg0));
return addHeapObject(ret);
}, arguments) };
export function __wbg_set_bf3f89b92d5a34bf() { return handleError(function (arg0, arg1, arg2) {
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
return ret;
}, arguments) };
export const __wbg_random_656f2ae924b2540e = typeof Math.random == 'function' ? Math.random : notDefined('Math.random');
export function __wbindgen_debug_string(arg0, arg1) {

@@ -1391,0 +1505,0 @@ const ret = debugString(getObject(arg1));

/* tslint:disable */
/* eslint-disable */
export const memory: WebAssembly.Memory;
export function enableDebug(): void;
export function __wbg_prelimtext_free(a: number): void;
export function prelimtext_new(a: number, b: number): number;
export function prelimtext_insert(a: number, b: number, c: number, d: number): void;
export function prelimtext_delete(a: number, b: number, c: number): void;
export function prelimtext_value(a: number, b: number): void;
export function __wbg_prelimlist_free(a: number): void;
export function prelimlist_new(a: number, b: number): number;
export function prelimlist_insert(a: number, b: number, c: number): void;
export function prelimlist_delete(a: number, b: number, c: number): void;
export function prelimlist_value(a: number, b: number): void;
export function __wbg_prelimmap_free(a: number): void;
export function prelimmap_new(a: number): number;
export function prelimmap_set(a: number, b: number, c: number, d: number): void;
export function prelimmap_delete(a: number, b: number, c: number): void;
export function prelimmap_get(a: number, b: number, c: number, d: number): void;
export function prelimmap_value(a: number): number;
export function __wbg_loro_free(a: number): void;

@@ -37,2 +20,9 @@ export function loro_new(): number;

export function loro_unsubscribe(a: number, b: number): void;
export function loro_transaction(a: number, b: number, c: number): void;
export function loro_transactionWithOrigin(a: number, b: number, c: number, d: number): void;
export function __wbg_event_free(a: number): void;
export function __wbg_get_event_local(a: number): number;
export function __wbg_set_event_local(a: number, b: number): void;
export function event_origin(a: number): number;
export function __wbg_transaction_free(a: number): void;
export function lorotext_insert(a: number, b: number, c: number, d: number, e: number, f: number): void;

@@ -60,2 +50,19 @@ export function lorotext_delete(a: number, b: number, c: number, d: number, e: number): void;

export function setPanicHook(): void;
export function enableDebug(): void;
export function __wbg_prelimtext_free(a: number): void;
export function prelimtext_new(a: number, b: number): number;
export function prelimtext_insert(a: number, b: number, c: number, d: number): void;
export function prelimtext_delete(a: number, b: number, c: number): void;
export function prelimtext_value(a: number, b: number): void;
export function __wbg_prelimlist_free(a: number): void;
export function prelimlist_new(a: number, b: number): number;
export function prelimlist_insert(a: number, b: number, c: number): void;
export function prelimlist_delete(a: number, b: number, c: number): void;
export function prelimlist_value(a: number, b: number): void;
export function __wbg_prelimmap_free(a: number): void;
export function prelimmap_new(a: number): number;
export function prelimmap_set(a: number, b: number, c: number, d: number): void;
export function prelimmap_delete(a: number, b: number, c: number): void;
export function prelimmap_get(a: number, b: number, c: number, d: number): void;
export function prelimmap_value(a: number): number;
export function __wbindgen_malloc(a: number): number;

@@ -62,0 +69,0 @@ export function __wbindgen_realloc(a: number, b: number, c: number): number;

@@ -5,6 +5,6 @@ /* tslint:disable */

*/
export function enableDebug(): void;
export function setPanicHook(): void;
/**
*/
export function setPanicHook(): void;
export function enableDebug(): void;

@@ -20,2 +20,4 @@ export type ContainerType = "Text" | "Map" | "List";

getContainerById(id: ContainerID): LoroText | LoroMap | LoroList;
transaction(callback: (txn: Transaction)=>void): void;
transactionWithOrigin(origin: string, callback: (txn: Transaction)=>void): void;
}

@@ -26,2 +28,13 @@

*/
export class Event {
free(): void;
/**
*/
local: boolean;
/**
*/
readonly origin: String | undefined;
}
/**
*/
export class Loro {

@@ -81,3 +94,12 @@ free(): void;

/**
* @param {Function} f
*/
transaction(f: Function): void;
/**
* @param {String} origin
* @param {Function} f
*/
transactionWithOrigin(origin: String, f: Function): void;
/**
*/
readonly clientId: bigint;

@@ -90,13 +112,13 @@ }

/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {number} index
* @param {any} value
*/
insert(ctx: Loro, index: number, value: any): void;
insert(txn: Transaction | Loro, index: number, value: any): void;
/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {number} index
* @param {number} len
*/
delete(ctx: Loro, index: number, len: number): void;
delete(txn: Transaction | Loro, index: number, len: number): void;
/**

@@ -115,3 +137,3 @@ * @param {number} index

* it may cause memory leak
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {number} pos

@@ -121,3 +143,3 @@ * @param {string} container

*/
insertContainer(ctx: Loro, pos: number, container: string): any;
insertContainer(txn: Transaction | Loro, pos: number, container: string): any;
/**

@@ -135,12 +157,12 @@ */

/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {string} key
* @param {any} value
*/
set(ctx: Loro, key: string, value: any): void;
set(txn: Transaction | Loro, key: string, value: any): void;
/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {string} key
*/
delete(ctx: Loro, key: string): void;
delete(txn: Transaction | Loro, key: string): void;
/**

@@ -157,3 +179,3 @@ * @param {string} key

/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {string} key

@@ -163,3 +185,3 @@ * @param {string} container_type

*/
insertContainer(ctx: Loro, key: string, container_type: string): any;
insertContainer(txn: Transaction | Loro, key: string, container_type: string): any;
/**

@@ -177,13 +199,13 @@ */

/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {number} index
* @param {string} content
*/
insert(ctx: Loro, index: number, content: string): void;
insert(txn: Transaction | Loro, index: number, content: string): void;
/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {number} index
* @param {number} len
*/
delete(ctx: Loro, index: number, len: number): void;
delete(txn: Transaction | Loro, index: number, len: number): void;
/**

@@ -267,1 +289,6 @@ * @returns {string}

}
/**
*/
export class Transaction {
free(): void;
}
/* tslint:disable */
/* eslint-disable */
export const memory: WebAssembly.Memory;
export function enableDebug(): void;
export function __wbg_prelimtext_free(a: number): void;
export function prelimtext_new(a: number, b: number): number;
export function prelimtext_insert(a: number, b: number, c: number, d: number): void;
export function prelimtext_delete(a: number, b: number, c: number): void;
export function prelimtext_value(a: number, b: number): void;
export function __wbg_prelimlist_free(a: number): void;
export function prelimlist_new(a: number, b: number): number;
export function prelimlist_insert(a: number, b: number, c: number): void;
export function prelimlist_delete(a: number, b: number, c: number): void;
export function prelimlist_value(a: number, b: number): void;
export function __wbg_prelimmap_free(a: number): void;
export function prelimmap_new(a: number): number;
export function prelimmap_set(a: number, b: number, c: number, d: number): void;
export function prelimmap_delete(a: number, b: number, c: number): void;
export function prelimmap_get(a: number, b: number, c: number, d: number): void;
export function prelimmap_value(a: number): number;
export function __wbg_loro_free(a: number): void;

@@ -37,2 +20,9 @@ export function loro_new(): number;

export function loro_unsubscribe(a: number, b: number): void;
export function loro_transaction(a: number, b: number, c: number): void;
export function loro_transactionWithOrigin(a: number, b: number, c: number, d: number): void;
export function __wbg_event_free(a: number): void;
export function __wbg_get_event_local(a: number): number;
export function __wbg_set_event_local(a: number, b: number): void;
export function event_origin(a: number): number;
export function __wbg_transaction_free(a: number): void;
export function lorotext_insert(a: number, b: number, c: number, d: number, e: number, f: number): void;

@@ -60,2 +50,19 @@ export function lorotext_delete(a: number, b: number, c: number, d: number, e: number): void;

export function setPanicHook(): void;
export function enableDebug(): void;
export function __wbg_prelimtext_free(a: number): void;
export function prelimtext_new(a: number, b: number): number;
export function prelimtext_insert(a: number, b: number, c: number, d: number): void;
export function prelimtext_delete(a: number, b: number, c: number): void;
export function prelimtext_value(a: number, b: number): void;
export function __wbg_prelimlist_free(a: number): void;
export function prelimlist_new(a: number, b: number): number;
export function prelimlist_insert(a: number, b: number, c: number): void;
export function prelimlist_delete(a: number, b: number, c: number): void;
export function prelimlist_value(a: number, b: number): void;
export function __wbg_prelimmap_free(a: number): void;
export function prelimmap_new(a: number): number;
export function prelimmap_set(a: number, b: number, c: number, d: number): void;
export function prelimmap_delete(a: number, b: number, c: number): void;
export function prelimmap_get(a: number, b: number, c: number, d: number): void;
export function prelimmap_value(a: number): number;
export function __wbindgen_malloc(a: number): number;

@@ -62,0 +69,0 @@ export function __wbindgen_realloc(a: number, b: number, c: number): number;

@@ -5,6 +5,6 @@ /* tslint:disable */

*/
export function enableDebug(): void;
export function setPanicHook(): void;
/**
*/
export function setPanicHook(): void;
export function enableDebug(): void;

@@ -20,2 +20,4 @@ export type ContainerType = "Text" | "Map" | "List";

getContainerById(id: ContainerID): LoroText | LoroMap | LoroList;
transaction(callback: (txn: Transaction)=>void): void;
transactionWithOrigin(origin: string, callback: (txn: Transaction)=>void): void;
}

@@ -26,2 +28,13 @@

*/
export class Event {
free(): void;
/**
*/
local: boolean;
/**
*/
readonly origin: String | undefined;
}
/**
*/
export class Loro {

@@ -81,3 +94,12 @@ free(): void;

/**
* @param {Function} f
*/
transaction(f: Function): void;
/**
* @param {String} origin
* @param {Function} f
*/
transactionWithOrigin(origin: String, f: Function): void;
/**
*/
readonly clientId: bigint;

@@ -90,13 +112,13 @@ }

/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {number} index
* @param {any} value
*/
insert(ctx: Loro, index: number, value: any): void;
insert(txn: Transaction | Loro, index: number, value: any): void;
/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {number} index
* @param {number} len
*/
delete(ctx: Loro, index: number, len: number): void;
delete(txn: Transaction | Loro, index: number, len: number): void;
/**

@@ -115,3 +137,3 @@ * @param {number} index

* it may cause memory leak
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {number} pos

@@ -121,3 +143,3 @@ * @param {string} container

*/
insertContainer(ctx: Loro, pos: number, container: string): any;
insertContainer(txn: Transaction | Loro, pos: number, container: string): any;
/**

@@ -135,12 +157,12 @@ */

/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {string} key
* @param {any} value
*/
set(ctx: Loro, key: string, value: any): void;
set(txn: Transaction | Loro, key: string, value: any): void;
/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {string} key
*/
delete(ctx: Loro, key: string): void;
delete(txn: Transaction | Loro, key: string): void;
/**

@@ -157,3 +179,3 @@ * @param {string} key

/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {string} key

@@ -163,3 +185,3 @@ * @param {string} container_type

*/
insertContainer(ctx: Loro, key: string, container_type: string): any;
insertContainer(txn: Transaction | Loro, key: string, container_type: string): any;
/**

@@ -177,13 +199,13 @@ */

/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {number} index
* @param {string} content
*/
insert(ctx: Loro, index: number, content: string): void;
insert(txn: Transaction | Loro, index: number, content: string): void;
/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {number} index
* @param {number} len
*/
delete(ctx: Loro, index: number, len: number): void;
delete(txn: Transaction | Loro, index: number, len: number): void;
/**

@@ -267,1 +289,6 @@ * @returns {string}

}
/**
*/
export class Transaction {
free(): void;
}

@@ -195,2 +195,33 @@ let imports = {};

*/
module.exports.setPanicHook = function() {
wasm.setPanicHook();
};
function getArrayU8FromWasm0(ptr, len) {
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
}
function passArray8ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 1);
getUint8Memory0().set(arg, ptr / 1);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
let stack_pointer = 128;
function addBorrowedObject(obj) {
if (stack_pointer == 1) throw new Error('out of js stack');
heap[--stack_pointer] = obj;
return stack_pointer;
}
function _assertClass(instance, klass) {
if (!(instance instanceof klass)) {
throw new Error(`expected instance of ${klass.name}`);
}
return instance.ptr;
}
/**
*/
module.exports.enableDebug = function() {

@@ -228,44 +259,59 @@ wasm.enableDebug();

}
/**
*/
module.exports.setPanicHook = function() {
wasm.setPanicHook();
};
function getArrayU8FromWasm0(ptr, len) {
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
function handleError(f, args) {
try {
return f.apply(this, args);
} catch (e) {
wasm.__wbindgen_exn_store(addHeapObject(e));
}
}
function passArray8ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 1);
getUint8Memory0().set(arg, ptr / 1);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
function notDefined(what) { return () => { throw new Error(`${what} is not defined`); }; }
let stack_pointer = 128;
const EventFinalization = new FinalizationRegistry(ptr => wasm.__wbg_event_free(ptr));
/**
*/
class Event {
function addBorrowedObject(obj) {
if (stack_pointer == 1) throw new Error('out of js stack');
heap[--stack_pointer] = obj;
return stack_pointer;
}
static __wrap(ptr) {
const obj = Object.create(Event.prototype);
obj.ptr = ptr;
EventFinalization.register(obj, obj.ptr, obj);
return obj;
}
function _assertClass(instance, klass) {
if (!(instance instanceof klass)) {
throw new Error(`expected instance of ${klass.name}`);
__destroy_into_raw() {
const ptr = this.ptr;
this.ptr = 0;
EventFinalization.unregister(this);
return ptr;
}
return instance.ptr;
}
function handleError(f, args) {
try {
return f.apply(this, args);
} catch (e) {
wasm.__wbindgen_exn_store(addHeapObject(e));
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_event_free(ptr);
}
/**
* @returns {boolean}
*/
get local() {
const ret = wasm.__wbg_get_event_local(this.ptr);
return ret !== 0;
}
/**
* @param {boolean} arg0
*/
set local(arg0) {
wasm.__wbg_set_event_local(this.ptr, arg0);
}
/**
* @returns {String | undefined}
*/
get origin() {
const ret = wasm.event_origin(this.ptr);
return takeObject(ret);
}
}
module.exports.Event = Event;
function notDefined(what) { return () => { throw new Error(`${what} is not defined`); }; }
const LoroFinalization = new FinalizationRegistry(ptr => wasm.__wbg_loro_free(ptr));

@@ -533,2 +579,36 @@ /**

}
/**
* @param {Function} f
*/
transaction(f) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.loro_transaction(retptr, this.ptr, addHeapObject(f));
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
if (r1) {
throw takeObject(r0);
}
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* @param {String} origin
* @param {Function} f
*/
transactionWithOrigin(origin, f) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.loro_transactionWithOrigin(retptr, this.ptr, addBorrowedObject(origin), addHeapObject(f));
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
if (r1) {
throw takeObject(r0);
}
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
heap[stack_pointer++] = undefined;
}
}
}

@@ -561,11 +641,10 @@ module.exports.Loro = Loro;

/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {number} index
* @param {any} value
*/
insert(ctx, index, value) {
insert(txn, index, value) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(ctx, Loro);
wasm.lorolist_insert(retptr, this.ptr, ctx.ptr, index, addHeapObject(value));
wasm.lorolist_insert(retptr, this.ptr, addBorrowedObject(txn), index, addHeapObject(value));
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -578,14 +657,14 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

wasm.__wbindgen_add_to_stack_pointer(16);
heap[stack_pointer++] = undefined;
}
}
/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {number} index
* @param {number} len
*/
delete(ctx, index, len) {
delete(txn, index, len) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(ctx, Loro);
wasm.lorolist_delete(retptr, this.ptr, ctx.ptr, index, len);
wasm.lorolist_delete(retptr, this.ptr, addBorrowedObject(txn), index, len);
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -598,2 +677,3 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

wasm.__wbindgen_add_to_stack_pointer(16);
heap[stack_pointer++] = undefined;
}

@@ -635,3 +715,3 @@ }

* it may cause memory leak
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {number} pos

@@ -641,9 +721,8 @@ * @param {string} container

*/
insertContainer(ctx, pos, container) {
insertContainer(txn, pos, container) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(ctx, Loro);
const ptr0 = passStringToWasm0(container, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.lorolist_insertContainer(retptr, this.ptr, ctx.ptr, pos, ptr0, len0);
wasm.lorolist_insertContainer(retptr, this.ptr, addBorrowedObject(txn), pos, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -658,2 +737,3 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

wasm.__wbindgen_add_to_stack_pointer(16);
heap[stack_pointer++] = undefined;
}

@@ -688,13 +768,12 @@ }

/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {string} key
* @param {any} value
*/
set(ctx, key, value) {
set(txn, key, value) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(ctx, Loro);
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.loromap_set(retptr, this.ptr, ctx.ptr, ptr0, len0, addHeapObject(value));
wasm.loromap_set(retptr, this.ptr, addBorrowedObject(txn), ptr0, len0, addHeapObject(value));
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -707,15 +786,15 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

wasm.__wbindgen_add_to_stack_pointer(16);
heap[stack_pointer++] = undefined;
}
}
/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {string} key
*/
delete(ctx, key) {
delete(txn, key) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(ctx, Loro);
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.loromap_delete(retptr, this.ptr, ctx.ptr, ptr0, len0);
wasm.loromap_delete(retptr, this.ptr, addBorrowedObject(txn), ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -728,2 +807,3 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

wasm.__wbindgen_add_to_stack_pointer(16);
heap[stack_pointer++] = undefined;
}

@@ -765,3 +845,3 @@ }

/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {string} key

@@ -771,6 +851,5 @@ * @param {string} container_type

*/
insertContainer(ctx, key, container_type) {
insertContainer(txn, key, container_type) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(ctx, Loro);
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);

@@ -780,3 +859,3 @@ const len0 = WASM_VECTOR_LEN;

const len1 = WASM_VECTOR_LEN;
wasm.loromap_insertContainer(retptr, this.ptr, ctx.ptr, ptr0, len0, ptr1, len1);
wasm.loromap_insertContainer(retptr, this.ptr, addBorrowedObject(txn), ptr0, len0, ptr1, len1);
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -791,2 +870,3 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

wasm.__wbindgen_add_to_stack_pointer(16);
heap[stack_pointer++] = undefined;
}

@@ -821,13 +901,12 @@ }

/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {number} index
* @param {string} content
*/
insert(ctx, index, content) {
insert(txn, index, content) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(ctx, Loro);
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.lorotext_insert(retptr, this.ptr, ctx.ptr, index, ptr0, len0);
wasm.lorotext_insert(retptr, this.ptr, addBorrowedObject(txn), index, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -840,14 +919,14 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

wasm.__wbindgen_add_to_stack_pointer(16);
heap[stack_pointer++] = undefined;
}
}
/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {number} index
* @param {number} len
*/
delete(ctx, index, len) {
delete(txn, index, len) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(ctx, Loro);
wasm.lorotext_delete(retptr, this.ptr, ctx.ptr, index, len);
wasm.lorotext_delete(retptr, this.ptr, addBorrowedObject(txn), index, len);
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -860,2 +939,3 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

wasm.__wbindgen_add_to_stack_pointer(16);
heap[stack_pointer++] = undefined;
}

@@ -1097,2 +1177,28 @@ }

const TransactionFinalization = new FinalizationRegistry(ptr => wasm.__wbg_transaction_free(ptr));
/**
*/
class Transaction {
static __wrap(ptr) {
const obj = Object.create(Transaction.prototype);
obj.ptr = ptr;
TransactionFinalization.register(obj, obj.ptr, obj);
return obj;
}
__destroy_into_raw() {
const ptr = this.ptr;
this.ptr = 0;
TransactionFinalization.unregister(this);
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_transaction_free(ptr);
}
}
module.exports.Transaction = Transaction;
module.exports.__wbindgen_object_drop_ref = function(arg0) {

@@ -1102,8 +1208,17 @@ takeObject(arg0);

module.exports.__wbindgen_is_object = function(arg0) {
const val = getObject(arg0);
const ret = typeof(val) === 'object' && val !== null;
module.exports.__wbg_event_new = function(arg0) {
const ret = Event.__wrap(arg0);
return addHeapObject(ret);
};
module.exports.__wbindgen_is_undefined = function(arg0) {
const ret = getObject(arg0) === undefined;
return ret;
};
module.exports.__wbindgen_is_null = function(arg0) {
const ret = getObject(arg0) === null;
return ret;
};
module.exports.__wbindgen_string_new = function(arg0, arg1) {

@@ -1121,11 +1236,2 @@ const ret = getStringFromWasm0(arg0, arg1);

module.exports.__wbindgen_string_get = function(arg0, arg1) {
const obj = getObject(arg1);
const ret = typeof(obj) === 'string' ? obj : undefined;
var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
};
module.exports.__wbindgen_object_clone_ref = function(arg0) {

@@ -1151,9 +1257,19 @@ const ret = getObject(arg0);

module.exports.__wbindgen_is_null = function(arg0) {
const ret = getObject(arg0) === null;
return ret;
module.exports.__wbg_transaction_new = function(arg0) {
const ret = Transaction.__wrap(arg0);
return addHeapObject(ret);
};
module.exports.__wbindgen_is_undefined = function(arg0) {
const ret = getObject(arg0) === undefined;
module.exports.__wbindgen_string_get = function(arg0, arg1) {
const obj = getObject(arg1);
const ret = typeof(obj) === 'string' ? obj : undefined;
var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
};
module.exports.__wbindgen_is_object = function(arg0) {
const val = getObject(arg0);
const ret = typeof(val) === 'object' && val !== null;
return ret;

@@ -1183,6 +1299,2 @@ };

module.exports.__wbg_mark_40e050a77cc39fea = function(arg0, arg1) {
performance.mark(getStringFromWasm0(arg0, arg1));
};
module.exports.__wbg_log_c9486ca5d8e2cbe8 = function(arg0, arg1) {

@@ -1204,2 +1316,6 @@ try {

module.exports.__wbg_mark_40e050a77cc39fea = function(arg0, arg1) {
performance.mark(getStringFromWasm0(arg0, arg1));
};
module.exports.__wbg_measure_aa7a73f17813f708 = function() { return handleError(function (arg0, arg1, arg2, arg3) {

@@ -1241,9 +1357,9 @@ try {

module.exports.__wbg_getRandomValues_f134f772d240c51f = function() { return handleError(function (arg0, arg1, arg2) {
const ret = getObject(arg0).getRandomValues(getArrayU8FromWasm0(arg1, arg2));
module.exports.__wbg_crypto_9f07beb1e97bfa1b = function() { return handleError(function (arg0) {
const ret = getObject(arg0).crypto;
return addHeapObject(ret);
}, arguments) };
module.exports.__wbg_crypto_9f07beb1e97bfa1b = function() { return handleError(function (arg0) {
const ret = getObject(arg0).crypto;
module.exports.__wbg_getRandomValues_f134f772d240c51f = function() { return handleError(function (arg0, arg1, arg2) {
const ret = getObject(arg0).getRandomValues(getArrayU8FromWasm0(arg1, arg2));
return addHeapObject(ret);

@@ -1282,2 +1398,22 @@ }, arguments) };

module.exports.__wbg_self_6d479506f72c6a71 = function() { return handleError(function () {
const ret = self.self;
return addHeapObject(ret);
}, arguments) };
module.exports.__wbg_window_f2557cc78490aceb = function() { return handleError(function () {
const ret = window.window;
return addHeapObject(ret);
}, arguments) };
module.exports.__wbg_globalThis_7f206bda628d5286 = function() { return handleError(function () {
const ret = globalThis.globalThis;
return addHeapObject(ret);
}, arguments) };
module.exports.__wbg_global_ba75c50d1cf384f4 = function() { return handleError(function () {
const ret = global.global;
return addHeapObject(ret);
}, arguments) };
module.exports.__wbg_newwithlength_7c42f7e738a9d5d3 = function(arg0) {

@@ -1312,4 +1448,2 @@ const ret = new Array(arg0 >>> 0);

module.exports.__wbg_random_656f2ae924b2540e = typeof Math.random == 'function' ? Math.random : notDefined('Math.random');
module.exports.__wbg_now_58886682b7e790d7 = function() {

@@ -1335,17 +1469,2 @@ const ret = Date.now();

module.exports.__wbg_has_8359f114ce042f5a = function() { return handleError(function (arg0, arg1) {
const ret = Reflect.has(getObject(arg0), getObject(arg1));
return ret;
}, arguments) };
module.exports.__wbg_ownKeys_bf24e1178641d9f0 = function() { return handleError(function (arg0) {
const ret = Reflect.ownKeys(getObject(arg0));
return addHeapObject(ret);
}, arguments) };
module.exports.__wbg_set_bf3f89b92d5a34bf = function() { return handleError(function (arg0, arg1, arg2) {
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
return ret;
}, arguments) };
module.exports.__wbg_buffer_3f3d764d4747d564 = function(arg0) {

@@ -1356,22 +1475,2 @@ const ret = getObject(arg0).buffer;

module.exports.__wbg_self_6d479506f72c6a71 = function() { return handleError(function () {
const ret = self.self;
return addHeapObject(ret);
}, arguments) };
module.exports.__wbg_window_f2557cc78490aceb = function() { return handleError(function () {
const ret = window.window;
return addHeapObject(ret);
}, arguments) };
module.exports.__wbg_globalThis_7f206bda628d5286 = function() { return handleError(function () {
const ret = globalThis.globalThis;
return addHeapObject(ret);
}, arguments) };
module.exports.__wbg_global_ba75c50d1cf384f4 = function() { return handleError(function () {
const ret = global.global;
return addHeapObject(ret);
}, arguments) };
module.exports.__wbg_new_8c3f0052272a457a = function(arg0) {

@@ -1391,2 +1490,19 @@ const ret = new Uint8Array(getObject(arg0));

module.exports.__wbg_has_8359f114ce042f5a = function() { return handleError(function (arg0, arg1) {
const ret = Reflect.has(getObject(arg0), getObject(arg1));
return ret;
}, arguments) };
module.exports.__wbg_ownKeys_bf24e1178641d9f0 = function() { return handleError(function (arg0) {
const ret = Reflect.ownKeys(getObject(arg0));
return addHeapObject(ret);
}, arguments) };
module.exports.__wbg_set_bf3f89b92d5a34bf = function() { return handleError(function (arg0, arg1, arg2) {
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
return ret;
}, arguments) };
module.exports.__wbg_random_656f2ae924b2540e = typeof Math.random == 'function' ? Math.random : notDefined('Math.random');
module.exports.__wbindgen_debug_string = function(arg0, arg1) {

@@ -1393,0 +1509,0 @@ const ret = debugString(getObject(arg1));

{
"name": "loro-wasm",
"version": "0.1.0",
"version": "0.1.1",
"description": "",

@@ -5,0 +5,0 @@ "main": "nodejs/loro_wasm.js",

/* tslint:disable */
/* eslint-disable */
export const memory: WebAssembly.Memory;
export function enableDebug(): void;
export function __wbg_prelimtext_free(a: number): void;
export function prelimtext_new(a: number, b: number): number;
export function prelimtext_insert(a: number, b: number, c: number, d: number): void;
export function prelimtext_delete(a: number, b: number, c: number): void;
export function prelimtext_value(a: number, b: number): void;
export function __wbg_prelimlist_free(a: number): void;
export function prelimlist_new(a: number, b: number): number;
export function prelimlist_insert(a: number, b: number, c: number): void;
export function prelimlist_delete(a: number, b: number, c: number): void;
export function prelimlist_value(a: number, b: number): void;
export function __wbg_prelimmap_free(a: number): void;
export function prelimmap_new(a: number): number;
export function prelimmap_set(a: number, b: number, c: number, d: number): void;
export function prelimmap_delete(a: number, b: number, c: number): void;
export function prelimmap_get(a: number, b: number, c: number, d: number): void;
export function prelimmap_value(a: number): number;
export function __wbg_loro_free(a: number): void;

@@ -37,2 +20,9 @@ export function loro_new(): number;

export function loro_unsubscribe(a: number, b: number): void;
export function loro_transaction(a: number, b: number, c: number): void;
export function loro_transactionWithOrigin(a: number, b: number, c: number, d: number): void;
export function __wbg_event_free(a: number): void;
export function __wbg_get_event_local(a: number): number;
export function __wbg_set_event_local(a: number, b: number): void;
export function event_origin(a: number): number;
export function __wbg_transaction_free(a: number): void;
export function lorotext_insert(a: number, b: number, c: number, d: number, e: number, f: number): void;

@@ -60,2 +50,19 @@ export function lorotext_delete(a: number, b: number, c: number, d: number, e: number): void;

export function setPanicHook(): void;
export function enableDebug(): void;
export function __wbg_prelimtext_free(a: number): void;
export function prelimtext_new(a: number, b: number): number;
export function prelimtext_insert(a: number, b: number, c: number, d: number): void;
export function prelimtext_delete(a: number, b: number, c: number): void;
export function prelimtext_value(a: number, b: number): void;
export function __wbg_prelimlist_free(a: number): void;
export function prelimlist_new(a: number, b: number): number;
export function prelimlist_insert(a: number, b: number, c: number): void;
export function prelimlist_delete(a: number, b: number, c: number): void;
export function prelimlist_value(a: number, b: number): void;
export function __wbg_prelimmap_free(a: number): void;
export function prelimmap_new(a: number): number;
export function prelimmap_set(a: number, b: number, c: number, d: number): void;
export function prelimmap_delete(a: number, b: number, c: number): void;
export function prelimmap_get(a: number, b: number, c: number, d: number): void;
export function prelimmap_value(a: number): number;
export function __wbindgen_malloc(a: number): number;

@@ -62,0 +69,0 @@ export function __wbindgen_realloc(a: number, b: number, c: number): number;

@@ -5,6 +5,6 @@ /* tslint:disable */

*/
export function enableDebug(): void;
export function setPanicHook(): void;
/**
*/
export function setPanicHook(): void;
export function enableDebug(): void;

@@ -20,2 +20,4 @@ export type ContainerType = "Text" | "Map" | "List";

getContainerById(id: ContainerID): LoroText | LoroMap | LoroList;
transaction(callback: (txn: Transaction)=>void): void;
transactionWithOrigin(origin: string, callback: (txn: Transaction)=>void): void;
}

@@ -26,2 +28,13 @@

*/
export class Event {
free(): void;
/**
*/
local: boolean;
/**
*/
readonly origin: String | undefined;
}
/**
*/
export class Loro {

@@ -81,3 +94,12 @@ free(): void;

/**
* @param {Function} f
*/
transaction(f: Function): void;
/**
* @param {String} origin
* @param {Function} f
*/
transactionWithOrigin(origin: String, f: Function): void;
/**
*/
readonly clientId: bigint;

@@ -90,13 +112,13 @@ }

/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {number} index
* @param {any} value
*/
insert(ctx: Loro, index: number, value: any): void;
insert(txn: Transaction | Loro, index: number, value: any): void;
/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {number} index
* @param {number} len
*/
delete(ctx: Loro, index: number, len: number): void;
delete(txn: Transaction | Loro, index: number, len: number): void;
/**

@@ -115,3 +137,3 @@ * @param {number} index

* it may cause memory leak
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {number} pos

@@ -121,3 +143,3 @@ * @param {string} container

*/
insertContainer(ctx: Loro, pos: number, container: string): any;
insertContainer(txn: Transaction | Loro, pos: number, container: string): any;
/**

@@ -135,12 +157,12 @@ */

/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {string} key
* @param {any} value
*/
set(ctx: Loro, key: string, value: any): void;
set(txn: Transaction | Loro, key: string, value: any): void;
/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {string} key
*/
delete(ctx: Loro, key: string): void;
delete(txn: Transaction | Loro, key: string): void;
/**

@@ -157,3 +179,3 @@ * @param {string} key

/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {string} key

@@ -163,3 +185,3 @@ * @param {string} container_type

*/
insertContainer(ctx: Loro, key: string, container_type: string): any;
insertContainer(txn: Transaction | Loro, key: string, container_type: string): any;
/**

@@ -177,13 +199,13 @@ */

/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {number} index
* @param {string} content
*/
insert(ctx: Loro, index: number, content: string): void;
insert(txn: Transaction | Loro, index: number, content: string): void;
/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {number} index
* @param {number} len
*/
delete(ctx: Loro, index: number, len: number): void;
delete(txn: Transaction | Loro, index: number, len: number): void;
/**

@@ -267,2 +289,7 @@ * @returns {string}

}
/**
*/
export class Transaction {
free(): void;
}

@@ -273,19 +300,2 @@ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;

readonly memory: WebAssembly.Memory;
readonly enableDebug: () => void;
readonly __wbg_prelimtext_free: (a: number) => void;
readonly prelimtext_new: (a: number, b: number) => number;
readonly prelimtext_insert: (a: number, b: number, c: number, d: number) => void;
readonly prelimtext_delete: (a: number, b: number, c: number) => void;
readonly prelimtext_value: (a: number, b: number) => void;
readonly __wbg_prelimlist_free: (a: number) => void;
readonly prelimlist_new: (a: number, b: number) => number;
readonly prelimlist_insert: (a: number, b: number, c: number) => void;
readonly prelimlist_delete: (a: number, b: number, c: number) => void;
readonly prelimlist_value: (a: number, b: number) => void;
readonly __wbg_prelimmap_free: (a: number) => void;
readonly prelimmap_new: (a: number) => number;
readonly prelimmap_set: (a: number, b: number, c: number, d: number) => void;
readonly prelimmap_delete: (a: number, b: number, c: number) => void;
readonly prelimmap_get: (a: number, b: number, c: number, d: number) => void;
readonly prelimmap_value: (a: number) => number;
readonly __wbg_loro_free: (a: number) => void;

@@ -307,2 +317,9 @@ readonly loro_new: () => number;

readonly loro_unsubscribe: (a: number, b: number) => void;
readonly loro_transaction: (a: number, b: number, c: number) => void;
readonly loro_transactionWithOrigin: (a: number, b: number, c: number, d: number) => void;
readonly __wbg_event_free: (a: number) => void;
readonly __wbg_get_event_local: (a: number) => number;
readonly __wbg_set_event_local: (a: number, b: number) => void;
readonly event_origin: (a: number) => number;
readonly __wbg_transaction_free: (a: number) => void;
readonly lorotext_insert: (a: number, b: number, c: number, d: number, e: number, f: number) => void;

@@ -330,2 +347,19 @@ readonly lorotext_delete: (a: number, b: number, c: number, d: number, e: number) => void;

readonly setPanicHook: () => void;
readonly enableDebug: () => void;
readonly __wbg_prelimtext_free: (a: number) => void;
readonly prelimtext_new: (a: number, b: number) => number;
readonly prelimtext_insert: (a: number, b: number, c: number, d: number) => void;
readonly prelimtext_delete: (a: number, b: number, c: number) => void;
readonly prelimtext_value: (a: number, b: number) => void;
readonly __wbg_prelimlist_free: (a: number) => void;
readonly prelimlist_new: (a: number, b: number) => number;
readonly prelimlist_insert: (a: number, b: number, c: number) => void;
readonly prelimlist_delete: (a: number, b: number, c: number) => void;
readonly prelimlist_value: (a: number, b: number) => void;
readonly __wbg_prelimmap_free: (a: number) => void;
readonly prelimmap_new: (a: number) => number;
readonly prelimmap_set: (a: number, b: number, c: number, d: number) => void;
readonly prelimmap_delete: (a: number, b: number, c: number) => void;
readonly prelimmap_get: (a: number, b: number, c: number, d: number) => void;
readonly prelimmap_value: (a: number) => number;
readonly __wbindgen_malloc: (a: number) => number;

@@ -332,0 +366,0 @@ readonly __wbindgen_realloc: (a: number, b: number, c: number) => number;

@@ -192,2 +192,33 @@ let wasm;

*/
export function setPanicHook() {
wasm.setPanicHook();
}
function getArrayU8FromWasm0(ptr, len) {
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
}
function passArray8ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 1);
getUint8Memory0().set(arg, ptr / 1);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
let stack_pointer = 128;
function addBorrowedObject(obj) {
if (stack_pointer == 1) throw new Error('out of js stack');
heap[--stack_pointer] = obj;
return stack_pointer;
}
function _assertClass(instance, klass) {
if (!(instance instanceof klass)) {
throw new Error(`expected instance of ${klass.name}`);
}
return instance.ptr;
}
/**
*/
export function enableDebug() {

@@ -225,44 +256,58 @@ wasm.enableDebug();

}
/**
*/
export function setPanicHook() {
wasm.setPanicHook();
}
function getArrayU8FromWasm0(ptr, len) {
return getUint8Memory0().subarray(ptr / 1, ptr / 1 + len);
function handleError(f, args) {
try {
return f.apply(this, args);
} catch (e) {
wasm.__wbindgen_exn_store(addHeapObject(e));
}
}
function passArray8ToWasm0(arg, malloc) {
const ptr = malloc(arg.length * 1);
getUint8Memory0().set(arg, ptr / 1);
WASM_VECTOR_LEN = arg.length;
return ptr;
}
function notDefined(what) { return () => { throw new Error(`${what} is not defined`); }; }
let stack_pointer = 128;
const EventFinalization = new FinalizationRegistry(ptr => wasm.__wbg_event_free(ptr));
/**
*/
export class Event {
function addBorrowedObject(obj) {
if (stack_pointer == 1) throw new Error('out of js stack');
heap[--stack_pointer] = obj;
return stack_pointer;
}
static __wrap(ptr) {
const obj = Object.create(Event.prototype);
obj.ptr = ptr;
EventFinalization.register(obj, obj.ptr, obj);
return obj;
}
function _assertClass(instance, klass) {
if (!(instance instanceof klass)) {
throw new Error(`expected instance of ${klass.name}`);
__destroy_into_raw() {
const ptr = this.ptr;
this.ptr = 0;
EventFinalization.unregister(this);
return ptr;
}
return instance.ptr;
}
function handleError(f, args) {
try {
return f.apply(this, args);
} catch (e) {
wasm.__wbindgen_exn_store(addHeapObject(e));
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_event_free(ptr);
}
/**
* @returns {boolean}
*/
get local() {
const ret = wasm.__wbg_get_event_local(this.ptr);
return ret !== 0;
}
/**
* @param {boolean} arg0
*/
set local(arg0) {
wasm.__wbg_set_event_local(this.ptr, arg0);
}
/**
* @returns {String | undefined}
*/
get origin() {
const ret = wasm.event_origin(this.ptr);
return takeObject(ret);
}
}
function notDefined(what) { return () => { throw new Error(`${what} is not defined`); }; }
const LoroFinalization = new FinalizationRegistry(ptr => wasm.__wbg_loro_free(ptr));

@@ -530,2 +575,36 @@ /**

}
/**
* @param {Function} f
*/
transaction(f) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.loro_transaction(retptr, this.ptr, addHeapObject(f));
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
if (r1) {
throw takeObject(r0);
}
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
}
}
/**
* @param {String} origin
* @param {Function} f
*/
transactionWithOrigin(origin, f) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
wasm.loro_transactionWithOrigin(retptr, this.ptr, addBorrowedObject(origin), addHeapObject(f));
var r0 = getInt32Memory0()[retptr / 4 + 0];
var r1 = getInt32Memory0()[retptr / 4 + 1];
if (r1) {
throw takeObject(r0);
}
} finally {
wasm.__wbindgen_add_to_stack_pointer(16);
heap[stack_pointer++] = undefined;
}
}
}

@@ -557,11 +636,10 @@

/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {number} index
* @param {any} value
*/
insert(ctx, index, value) {
insert(txn, index, value) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(ctx, Loro);
wasm.lorolist_insert(retptr, this.ptr, ctx.ptr, index, addHeapObject(value));
wasm.lorolist_insert(retptr, this.ptr, addBorrowedObject(txn), index, addHeapObject(value));
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -574,14 +652,14 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

wasm.__wbindgen_add_to_stack_pointer(16);
heap[stack_pointer++] = undefined;
}
}
/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {number} index
* @param {number} len
*/
delete(ctx, index, len) {
delete(txn, index, len) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(ctx, Loro);
wasm.lorolist_delete(retptr, this.ptr, ctx.ptr, index, len);
wasm.lorolist_delete(retptr, this.ptr, addBorrowedObject(txn), index, len);
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -594,2 +672,3 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

wasm.__wbindgen_add_to_stack_pointer(16);
heap[stack_pointer++] = undefined;
}

@@ -631,3 +710,3 @@ }

* it may cause memory leak
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {number} pos

@@ -637,9 +716,8 @@ * @param {string} container

*/
insertContainer(ctx, pos, container) {
insertContainer(txn, pos, container) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(ctx, Loro);
const ptr0 = passStringToWasm0(container, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.lorolist_insertContainer(retptr, this.ptr, ctx.ptr, pos, ptr0, len0);
wasm.lorolist_insertContainer(retptr, this.ptr, addBorrowedObject(txn), pos, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -654,2 +732,3 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

wasm.__wbindgen_add_to_stack_pointer(16);
heap[stack_pointer++] = undefined;
}

@@ -683,13 +762,12 @@ }

/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {string} key
* @param {any} value
*/
set(ctx, key, value) {
set(txn, key, value) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(ctx, Loro);
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.loromap_set(retptr, this.ptr, ctx.ptr, ptr0, len0, addHeapObject(value));
wasm.loromap_set(retptr, this.ptr, addBorrowedObject(txn), ptr0, len0, addHeapObject(value));
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -702,15 +780,15 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

wasm.__wbindgen_add_to_stack_pointer(16);
heap[stack_pointer++] = undefined;
}
}
/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {string} key
*/
delete(ctx, key) {
delete(txn, key) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(ctx, Loro);
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.loromap_delete(retptr, this.ptr, ctx.ptr, ptr0, len0);
wasm.loromap_delete(retptr, this.ptr, addBorrowedObject(txn), ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -723,2 +801,3 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

wasm.__wbindgen_add_to_stack_pointer(16);
heap[stack_pointer++] = undefined;
}

@@ -760,3 +839,3 @@ }

/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {string} key

@@ -766,6 +845,5 @@ * @param {string} container_type

*/
insertContainer(ctx, key, container_type) {
insertContainer(txn, key, container_type) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(ctx, Loro);
const ptr0 = passStringToWasm0(key, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);

@@ -775,3 +853,3 @@ const len0 = WASM_VECTOR_LEN;

const len1 = WASM_VECTOR_LEN;
wasm.loromap_insertContainer(retptr, this.ptr, ctx.ptr, ptr0, len0, ptr1, len1);
wasm.loromap_insertContainer(retptr, this.ptr, addBorrowedObject(txn), ptr0, len0, ptr1, len1);
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -786,2 +864,3 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

wasm.__wbindgen_add_to_stack_pointer(16);
heap[stack_pointer++] = undefined;
}

@@ -815,13 +894,12 @@ }

/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {number} index
* @param {string} content
*/
insert(ctx, index, content) {
insert(txn, index, content) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(ctx, Loro);
const ptr0 = passStringToWasm0(content, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
const len0 = WASM_VECTOR_LEN;
wasm.lorotext_insert(retptr, this.ptr, ctx.ptr, index, ptr0, len0);
wasm.lorotext_insert(retptr, this.ptr, addBorrowedObject(txn), index, ptr0, len0);
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -834,14 +912,14 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

wasm.__wbindgen_add_to_stack_pointer(16);
heap[stack_pointer++] = undefined;
}
}
/**
* @param {Loro} ctx
* @param {Transaction | Loro} txn
* @param {number} index
* @param {number} len
*/
delete(ctx, index, len) {
delete(txn, index, len) {
try {
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
_assertClass(ctx, Loro);
wasm.lorotext_delete(retptr, this.ptr, ctx.ptr, index, len);
wasm.lorotext_delete(retptr, this.ptr, addBorrowedObject(txn), index, len);
var r0 = getInt32Memory0()[retptr / 4 + 0];

@@ -854,2 +932,3 @@ var r1 = getInt32Memory0()[retptr / 4 + 1];

wasm.__wbindgen_add_to_stack_pointer(16);
heap[stack_pointer++] = undefined;
}

@@ -1087,2 +1166,27 @@ }

const TransactionFinalization = new FinalizationRegistry(ptr => wasm.__wbg_transaction_free(ptr));
/**
*/
export class Transaction {
static __wrap(ptr) {
const obj = Object.create(Transaction.prototype);
obj.ptr = ptr;
TransactionFinalization.register(obj, obj.ptr, obj);
return obj;
}
__destroy_into_raw() {
const ptr = this.ptr;
this.ptr = 0;
TransactionFinalization.unregister(this);
return ptr;
}
free() {
const ptr = this.__destroy_into_raw();
wasm.__wbg_transaction_free(ptr);
}
}
async function load(module, imports) {

@@ -1125,7 +1229,14 @@ if (typeof Response === 'function' && module instanceof Response) {

};
imports.wbg.__wbindgen_is_object = function(arg0) {
const val = getObject(arg0);
const ret = typeof(val) === 'object' && val !== null;
imports.wbg.__wbg_event_new = function(arg0) {
const ret = Event.__wrap(arg0);
return addHeapObject(ret);
};
imports.wbg.__wbindgen_is_undefined = function(arg0) {
const ret = getObject(arg0) === undefined;
return ret;
};
imports.wbg.__wbindgen_is_null = function(arg0) {
const ret = getObject(arg0) === null;
return ret;
};
imports.wbg.__wbindgen_string_new = function(arg0, arg1) {

@@ -1141,10 +1252,2 @@ const ret = getStringFromWasm0(arg0, arg1);

};
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
const obj = getObject(arg1);
const ret = typeof(obj) === 'string' ? obj : undefined;
var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
};
imports.wbg.__wbindgen_object_clone_ref = function(arg0) {

@@ -1166,8 +1269,17 @@ const ret = getObject(arg0);

};
imports.wbg.__wbindgen_is_null = function(arg0) {
const ret = getObject(arg0) === null;
return ret;
imports.wbg.__wbg_transaction_new = function(arg0) {
const ret = Transaction.__wrap(arg0);
return addHeapObject(ret);
};
imports.wbg.__wbindgen_is_undefined = function(arg0) {
const ret = getObject(arg0) === undefined;
imports.wbg.__wbindgen_string_get = function(arg0, arg1) {
const obj = getObject(arg1);
const ret = typeof(obj) === 'string' ? obj : undefined;
var ptr0 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
var len0 = WASM_VECTOR_LEN;
getInt32Memory0()[arg0 / 4 + 1] = len0;
getInt32Memory0()[arg0 / 4 + 0] = ptr0;
};
imports.wbg.__wbindgen_is_object = function(arg0) {
const val = getObject(arg0);
const ret = typeof(val) === 'object' && val !== null;
return ret;

@@ -1193,5 +1305,2 @@ };

};
imports.wbg.__wbg_mark_40e050a77cc39fea = function(arg0, arg1) {
performance.mark(getStringFromWasm0(arg0, arg1));
};
imports.wbg.__wbg_log_c9486ca5d8e2cbe8 = function(arg0, arg1) {

@@ -1211,2 +1320,5 @@ try {

};
imports.wbg.__wbg_mark_40e050a77cc39fea = function(arg0, arg1) {
performance.mark(getStringFromWasm0(arg0, arg1));
};
imports.wbg.__wbg_measure_aa7a73f17813f708 = function() { return handleError(function (arg0, arg1, arg2, arg3) {

@@ -1243,2 +1355,6 @@ try {

};
imports.wbg.__wbg_crypto_9f07beb1e97bfa1b = function() { return handleError(function (arg0) {
const ret = getObject(arg0).crypto;
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_getRandomValues_f134f772d240c51f = function() { return handleError(function (arg0, arg1, arg2) {

@@ -1248,6 +1364,2 @@ const ret = getObject(arg0).getRandomValues(getArrayU8FromWasm0(arg1, arg2));

}, arguments) };
imports.wbg.__wbg_crypto_9f07beb1e97bfa1b = function() { return handleError(function (arg0) {
const ret = getObject(arg0).crypto;
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_get_57245cc7d7c7619d = function(arg0, arg1) {

@@ -1277,2 +1389,18 @@ const ret = getObject(arg0)[arg1 >>> 0];

};
imports.wbg.__wbg_self_6d479506f72c6a71 = function() { return handleError(function () {
const ret = self.self;
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_window_f2557cc78490aceb = function() { return handleError(function () {
const ret = window.window;
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_globalThis_7f206bda628d5286 = function() { return handleError(function () {
const ret = globalThis.globalThis;
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_global_ba75c50d1cf384f4 = function() { return handleError(function () {
const ret = global.global;
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_newwithlength_7c42f7e738a9d5d3 = function(arg0) {

@@ -1301,3 +1429,2 @@ const ret = new Array(arg0 >>> 0);

};
imports.wbg.__wbg_random_656f2ae924b2540e = typeof Math.random == 'function' ? Math.random : notDefined('Math.random');
imports.wbg.__wbg_now_58886682b7e790d7 = function() {

@@ -1319,14 +1446,2 @@ const ret = Date.now();

};
imports.wbg.__wbg_has_8359f114ce042f5a = function() { return handleError(function (arg0, arg1) {
const ret = Reflect.has(getObject(arg0), getObject(arg1));
return ret;
}, arguments) };
imports.wbg.__wbg_ownKeys_bf24e1178641d9f0 = function() { return handleError(function (arg0) {
const ret = Reflect.ownKeys(getObject(arg0));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_set_bf3f89b92d5a34bf = function() { return handleError(function (arg0, arg1, arg2) {
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
return ret;
}, arguments) };
imports.wbg.__wbg_buffer_3f3d764d4747d564 = function(arg0) {

@@ -1336,18 +1451,2 @@ const ret = getObject(arg0).buffer;

};
imports.wbg.__wbg_self_6d479506f72c6a71 = function() { return handleError(function () {
const ret = self.self;
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_window_f2557cc78490aceb = function() { return handleError(function () {
const ret = window.window;
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_globalThis_7f206bda628d5286 = function() { return handleError(function () {
const ret = globalThis.globalThis;
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_global_ba75c50d1cf384f4 = function() { return handleError(function () {
const ret = global.global;
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_new_8c3f0052272a457a = function(arg0) {

@@ -1364,2 +1463,15 @@ const ret = new Uint8Array(getObject(arg0));

};
imports.wbg.__wbg_has_8359f114ce042f5a = function() { return handleError(function (arg0, arg1) {
const ret = Reflect.has(getObject(arg0), getObject(arg1));
return ret;
}, arguments) };
imports.wbg.__wbg_ownKeys_bf24e1178641d9f0 = function() { return handleError(function (arg0) {
const ret = Reflect.ownKeys(getObject(arg0));
return addHeapObject(ret);
}, arguments) };
imports.wbg.__wbg_set_bf3f89b92d5a34bf = function() { return handleError(function (arg0, arg1, arg2) {
const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
return ret;
}, arguments) };
imports.wbg.__wbg_random_656f2ae924b2540e = typeof Math.random == 'function' ? Math.random : notDefined('Math.random');
imports.wbg.__wbindgen_debug_string = function(arg0, arg1) {

@@ -1366,0 +1478,0 @@ const ret = debugString(getObject(arg1));

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc