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.10.1 to 0.11.0

29

bundler/loro_wasm_bg.wasm.d.ts

@@ -78,7 +78,15 @@ /* tslint:disable */

export function lorolist_length(a: number): number;
export function __wbg_lorotreenode_free(a: number): void;
export function lorotreenode_id(a: number): number;
export function lorotreenode_createNode(a: number, b: number): void;
export function lorotreenode_setAsRoot(a: number, b: number): void;
export function lorotreenode_moveTo(a: number, b: number, c: number): void;
export function lorotreenode_data(a: number, b: number): void;
export function lorotreenode_parent(a: number): number;
export function lorotreenode_children(a: number): number;
export function lorotree_kind(a: number): number;
export function lorotree_create(a: number, b: number, c: number): void;
export function lorotree_mov(a: number, b: number, c: number, d: number): void;
export function lorotree_createNode(a: number, b: number, c: number): void;
export function lorotree_move(a: number, b: number, c: number, d: number): void;
export function lorotree_delete(a: number, b: number, c: number): void;
export function lorotree_getMeta(a: number, b: number, c: number): void;
export function lorotree_getNodeByID(a: number, b: number): number;
export function lorotree_id(a: number): number;

@@ -89,3 +97,2 @@ export function lorotree_has(a: number, b: number): number;

export function lorotree_nodes(a: number, b: number): void;
export function lorotree_parent(a: number, b: number, c: number): void;
export function lorotree_subscribe(a: number, b: number, c: number, d: number): void;

@@ -100,15 +107,15 @@ export function __wbg_versionvector_free(a: number): void;

export function versionvector_compare(a: number, b: number, c: number): void;
export function lorotext_unsubscribe(a: number, b: number, c: number, d: number): void;
export function loromap_unsubscribe(a: number, b: number, c: number, d: number): void;
export function lorotree_unsubscribe(a: number, b: number, c: number, d: number): void;
export function __wbg_lorotext_free(a: number): void;
export function __wbg_loromap_free(a: number): void;
export function __wbg_lorotree_free(a: number): void;
export function lorotext_unsubscribe(a: number, b: number, c: number, d: number): void;
export function loromap_unsubscribe(a: number, b: number, c: number, d: number): void;
export function lorotree_unsubscribe(a: number, b: number, c: number, d: number): void;
export function __wbindgen_malloc(a: number): number;
export function __wbindgen_realloc(a: number, b: number, c: number): number;
export function __wbindgen_malloc(a: number, b: number): number;
export function __wbindgen_realloc(a: number, b: number, c: number, d: number): number;
export const __wbindgen_export_2: WebAssembly.Table;
export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h639be45697dfb576(a: number, b: number, c: number): void;
export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hfae29c8323349971(a: number, b: number, c: number): void;
export function __wbindgen_add_to_stack_pointer(a: number): number;
export function __wbindgen_free(a: number, b: number): void;
export function __wbindgen_free(a: number, b: number, c: number): void;
export function __wbindgen_exn_store(a: number): void;
export function __wbindgen_start(): void;

@@ -320,3 +320,3 @@ /* tslint:disable */

* Commit the cumulative auto committed transaction.
* @param {string | undefined} origin
* @param {string | undefined} [origin]
*/

@@ -1226,4 +1226,5 @@ commit(origin?: string): void;

* const tree = doc.getTree("tree");
* const root = tree.create();
* const node = tree.create(root);
* const root = tree.createNode();
* const node = root.createNode();
* console.log(tree.value);
* /*

@@ -1243,8 +1244,7 @@ * [

* *\/
* console.log(tree.value);
* ```
* @param {TreeID | undefined} parent
* @returns {TreeID}
* @param {TreeID | undefined} [parent]
* @returns {LoroTreeNode}
*/
create(parent?: TreeID): TreeID;
createNode(parent?: TreeID): LoroTreeNode;
/**

@@ -1261,13 +1261,13 @@ * Move the target tree node to be a child of the parent.

* const tree = doc.getTree("tree");
* const root = tree.create();
* const node = tree.create(root);
* const node2 = tree.create(node);
* tree.mov(node2, root);
* const root = tree.createNode();
* const node = root.createNode();
* const node2 = node.createNode();
* tree.move(node2.id, root.id);
* // Error will be thrown if move operation creates a cycle
* tree.mov(root, node);
* tree.move(root.id, node.id);
* ```
* @param {TreeID} target
* @param {TreeID | undefined} parent
* @param {TreeID | undefined} [parent]
*/
mov(target: TreeID, parent?: TreeID): void;
move(target: TreeID, parent?: TreeID): void;
/**

@@ -1282,5 +1282,6 @@ * Delete a tree node from the forest.

* const tree = doc.getTree("tree");
* const root = tree.create();
* const node = tree.create(root);
* tree.delete(node);
* const root = tree.createNode();
* const node = root.createNode();
* tree.delete(node.id);
* console.log(tree.value);
* /*

@@ -1294,3 +1295,2 @@ * [

* *\/
* console.log(tree.value);
* ```

@@ -1301,20 +1301,7 @@ * @param {TreeID} target

/**
* Get the associated metadata map container of a tree node.
*
* @example
* ```ts
* import { Loro } from "loro-crdt";
*
* const doc = new Loro();
* const tree = doc.getTree("tree");
* const root = tree.create();
* const rootMeta = tree.getMeta(root);
* rootMeta.set("color", "red");
* // [ { id: '0@F2462C4159C4C8D1', parent: null, meta: { color: 'red' } } ]
* console.log(tree.getDeepValue());
* ```
* Get LoroTreeNode by the TreeID.
* @param {TreeID} target
* @returns {LoroMap}
* @returns {LoroTreeNode | undefined}
*/
getMeta(target: TreeID): LoroMap;
getNodeByID(target: TreeID): LoroTreeNode | undefined;
/**

@@ -1335,9 +1322,8 @@ * Return `true` if the tree contains the TreeID, `false` if the target is deleted or wrong.

* const tree = doc.getTree("tree");
* const root = tree.create();
* const rootMeta = tree.getMeta(root);
* rootMeta.set("color", "red");
* const root = tree.createNode();
* root.data.set("color", "red");
* // [ { id: '0@F2462C4159C4C8D1', parent: null, meta: 'cid:0@F2462C4159C4C8D1:Map' } ]
* console.log(tree.value);
* // [ { id: '0@F2462C4159C4C8D1', parent: null, meta: { color: 'red' } } ]
* console.log(tree.getDeepValue());
* console.log(tree.toJson());
* ```

@@ -1348,22 +1334,2 @@ * @returns {any}

/**
* Get the parent of the specific node.
* Return undefined if the target is a root node.
*
* @example
* ```ts
* import { Loro } from "loro-crdt";
*
* const doc = new Loro();
* const tree = doc.getTree("tree");
* const root = tree.create();
* const node = tree.create(root);
* const node2 = tree.create(node);
* console.log(tree.parent(node2)) // '1@B75DEC6222870A0'
* console.log(tree.parent(root)) // undefined
* ```
* @param {TreeID} target
* @returns {TreeID | undefined}
*/
parent(target: TreeID): TreeID | undefined;
/**
* Subscribe to the changes of the tree.

@@ -1373,2 +1339,15 @@ *

*
* Trees have three types of events: `create`, `delete`, and `move`.
* - `create`: Creates a new node with its `target` TreeID. If `parent` is undefined,
* a root node is created; otherwise, a child node of `parent` is created.
* If the node being created was previously deleted and has archived child nodes,
* create events for these child nodes will also be received.
* - `delete`: Deletes the target node. The structure and state of the target node and
* its child nodes are archived, and delete events for the child nodes will not be received.
* - `move`: Moves the target node. If `parent` is undefined, the target node becomes a root node;
* otherwise, it becomes a child node of `parent`.
*
* If a tree container is subscribed, the event of metadata changes will also be received as a MapDiff.
* And event's `path` will end with `TreeID`.
*
* @example

@@ -1381,6 +1360,6 @@ * ```ts

* tree.subscribe((event)=>{
* console.log(event);
* // event.type: "create" | "delete" | "move"
* });
* const root = tree.create();
* const node = tree.create(root);
* const root = tree.createNode();
* const node = root.createNode();
* doc.commit();

@@ -1405,4 +1384,4 @@ * ```

* });
* const root = tree.create();
* const node = tree.create(root);
* const root = tree.createNode();
* const node = root.createNode();
* doc.commit();

@@ -1428,5 +1407,5 @@ * tree.unsubscribe(doc, subscription);

* const tree = doc.getTree("tree");
* const root = tree.create();
* const node = tree.create(root);
* const node2 = tree.create(node);
* const root = tree.createNode();
* const node = root.createNode();
* const node2 = node.createNode();
* console.log(tree.nodes) // [ '1@A5024AE0E00529D2', '2@A5024AE0E00529D2', '0@A5024AE0E00529D2' ]

@@ -1446,2 +1425,59 @@ * ```

*/
export class LoroTreeNode {
free(): void;
/**
* Create a new tree node as the child of this node and return a LoroTreeNode instance.
*
* @example
* ```ts
* import { Loro } from "loro-crdt";
* const doc = new Loro();
* const tree = doc.getTree("tree");
* const root = tree.createNode();
* const node = root.createNode();
* ```
* @returns {LoroTreeNode}
*/
createNode(): LoroTreeNode;
/**
* Move the target tree node to be a root node.
*/
setAsRoot(): void;
/**
* Move the target tree node to be a child of the parent.
* If the parent is undefined, the target will be a root node.
*
* @example
* ```ts
* const doc = new Loro();
* const tree = doc.getTree("tree");
* const root = tree.createNode();
* const node = root.createNode();
* const node2 = node.createNode();
* node2.moveTo(root);
* ```
* @param {LoroTreeNode} parent
*/
moveTo(parent: LoroTreeNode): void;
/**
* Get the parent node of this node.
* @returns {LoroTreeNode | undefined}
*/
parent(): LoroTreeNode | undefined;
/**
* Get the children of this node.
* @returns {Array<any>}
*/
children(): Array<any>;
/**
* Get the associated metadata map container of a tree node.
*/
readonly data: LoroMap;
/**
* The TreeID of the node.
*/
readonly id: TreeID;
}
/**
*/
export class VersionVector {

@@ -1448,0 +1484,0 @@ free(): void;

# Changelog
## 0.11.0
### Minor Changes
- Fix a few bugs and include BREAKING CHANG refactors
- fix: should not reset the state when calling checkout to latest (#265)
- refactor: only send a event for one `import`/`transaction`/`checkout` (#263)
- perf: optimize snapshot encoding speed (#264)
- feat: remove deleted set in tree state and optimize api (#259)
## 0.10.1

@@ -4,0 +15,0 @@

@@ -78,7 +78,15 @@ /* tslint:disable */

export function lorolist_length(a: number): number;
export function __wbg_lorotreenode_free(a: number): void;
export function lorotreenode_id(a: number): number;
export function lorotreenode_createNode(a: number, b: number): void;
export function lorotreenode_setAsRoot(a: number, b: number): void;
export function lorotreenode_moveTo(a: number, b: number, c: number): void;
export function lorotreenode_data(a: number, b: number): void;
export function lorotreenode_parent(a: number): number;
export function lorotreenode_children(a: number): number;
export function lorotree_kind(a: number): number;
export function lorotree_create(a: number, b: number, c: number): void;
export function lorotree_mov(a: number, b: number, c: number, d: number): void;
export function lorotree_createNode(a: number, b: number, c: number): void;
export function lorotree_move(a: number, b: number, c: number, d: number): void;
export function lorotree_delete(a: number, b: number, c: number): void;
export function lorotree_getMeta(a: number, b: number, c: number): void;
export function lorotree_getNodeByID(a: number, b: number): number;
export function lorotree_id(a: number): number;

@@ -89,3 +97,2 @@ export function lorotree_has(a: number, b: number): number;

export function lorotree_nodes(a: number, b: number): void;
export function lorotree_parent(a: number, b: number, c: number): void;
export function lorotree_subscribe(a: number, b: number, c: number, d: number): void;

@@ -100,15 +107,15 @@ export function __wbg_versionvector_free(a: number): void;

export function versionvector_compare(a: number, b: number, c: number): void;
export function lorotext_unsubscribe(a: number, b: number, c: number, d: number): void;
export function loromap_unsubscribe(a: number, b: number, c: number, d: number): void;
export function lorotree_unsubscribe(a: number, b: number, c: number, d: number): void;
export function __wbg_lorotext_free(a: number): void;
export function __wbg_loromap_free(a: number): void;
export function __wbg_lorotree_free(a: number): void;
export function lorotext_unsubscribe(a: number, b: number, c: number, d: number): void;
export function loromap_unsubscribe(a: number, b: number, c: number, d: number): void;
export function lorotree_unsubscribe(a: number, b: number, c: number, d: number): void;
export function __wbindgen_malloc(a: number): number;
export function __wbindgen_realloc(a: number, b: number, c: number): number;
export function __wbindgen_malloc(a: number, b: number): number;
export function __wbindgen_realloc(a: number, b: number, c: number, d: number): number;
export const __wbindgen_export_2: WebAssembly.Table;
export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__h639be45697dfb576(a: number, b: number, c: number): void;
export function _dyn_core__ops__function__FnMut__A____Output___R_as_wasm_bindgen__closure__WasmClosure___describe__invoke__hfae29c8323349971(a: number, b: number, c: number): void;
export function __wbindgen_add_to_stack_pointer(a: number): number;
export function __wbindgen_free(a: number, b: number): void;
export function __wbindgen_free(a: number, b: number, c: number): void;
export function __wbindgen_exn_store(a: number): void;
export function __wbindgen_start(): void;

@@ -320,3 +320,3 @@ /* tslint:disable */

* Commit the cumulative auto committed transaction.
* @param {string | undefined} origin
* @param {string | undefined} [origin]
*/

@@ -1226,4 +1226,5 @@ commit(origin?: string): void;

* const tree = doc.getTree("tree");
* const root = tree.create();
* const node = tree.create(root);
* const root = tree.createNode();
* const node = root.createNode();
* console.log(tree.value);
* /*

@@ -1243,8 +1244,7 @@ * [

* *\/
* console.log(tree.value);
* ```
* @param {TreeID | undefined} parent
* @returns {TreeID}
* @param {TreeID | undefined} [parent]
* @returns {LoroTreeNode}
*/
create(parent?: TreeID): TreeID;
createNode(parent?: TreeID): LoroTreeNode;
/**

@@ -1261,13 +1261,13 @@ * Move the target tree node to be a child of the parent.

* const tree = doc.getTree("tree");
* const root = tree.create();
* const node = tree.create(root);
* const node2 = tree.create(node);
* tree.mov(node2, root);
* const root = tree.createNode();
* const node = root.createNode();
* const node2 = node.createNode();
* tree.move(node2.id, root.id);
* // Error will be thrown if move operation creates a cycle
* tree.mov(root, node);
* tree.move(root.id, node.id);
* ```
* @param {TreeID} target
* @param {TreeID | undefined} parent
* @param {TreeID | undefined} [parent]
*/
mov(target: TreeID, parent?: TreeID): void;
move(target: TreeID, parent?: TreeID): void;
/**

@@ -1282,5 +1282,6 @@ * Delete a tree node from the forest.

* const tree = doc.getTree("tree");
* const root = tree.create();
* const node = tree.create(root);
* tree.delete(node);
* const root = tree.createNode();
* const node = root.createNode();
* tree.delete(node.id);
* console.log(tree.value);
* /*

@@ -1294,3 +1295,2 @@ * [

* *\/
* console.log(tree.value);
* ```

@@ -1301,20 +1301,7 @@ * @param {TreeID} target

/**
* Get the associated metadata map container of a tree node.
*
* @example
* ```ts
* import { Loro } from "loro-crdt";
*
* const doc = new Loro();
* const tree = doc.getTree("tree");
* const root = tree.create();
* const rootMeta = tree.getMeta(root);
* rootMeta.set("color", "red");
* // [ { id: '0@F2462C4159C4C8D1', parent: null, meta: { color: 'red' } } ]
* console.log(tree.getDeepValue());
* ```
* Get LoroTreeNode by the TreeID.
* @param {TreeID} target
* @returns {LoroMap}
* @returns {LoroTreeNode | undefined}
*/
getMeta(target: TreeID): LoroMap;
getNodeByID(target: TreeID): LoroTreeNode | undefined;
/**

@@ -1335,9 +1322,8 @@ * Return `true` if the tree contains the TreeID, `false` if the target is deleted or wrong.

* const tree = doc.getTree("tree");
* const root = tree.create();
* const rootMeta = tree.getMeta(root);
* rootMeta.set("color", "red");
* const root = tree.createNode();
* root.data.set("color", "red");
* // [ { id: '0@F2462C4159C4C8D1', parent: null, meta: 'cid:0@F2462C4159C4C8D1:Map' } ]
* console.log(tree.value);
* // [ { id: '0@F2462C4159C4C8D1', parent: null, meta: { color: 'red' } } ]
* console.log(tree.getDeepValue());
* console.log(tree.toJson());
* ```

@@ -1348,22 +1334,2 @@ * @returns {any}

/**
* Get the parent of the specific node.
* Return undefined if the target is a root node.
*
* @example
* ```ts
* import { Loro } from "loro-crdt";
*
* const doc = new Loro();
* const tree = doc.getTree("tree");
* const root = tree.create();
* const node = tree.create(root);
* const node2 = tree.create(node);
* console.log(tree.parent(node2)) // '1@B75DEC6222870A0'
* console.log(tree.parent(root)) // undefined
* ```
* @param {TreeID} target
* @returns {TreeID | undefined}
*/
parent(target: TreeID): TreeID | undefined;
/**
* Subscribe to the changes of the tree.

@@ -1373,2 +1339,15 @@ *

*
* Trees have three types of events: `create`, `delete`, and `move`.
* - `create`: Creates a new node with its `target` TreeID. If `parent` is undefined,
* a root node is created; otherwise, a child node of `parent` is created.
* If the node being created was previously deleted and has archived child nodes,
* create events for these child nodes will also be received.
* - `delete`: Deletes the target node. The structure and state of the target node and
* its child nodes are archived, and delete events for the child nodes will not be received.
* - `move`: Moves the target node. If `parent` is undefined, the target node becomes a root node;
* otherwise, it becomes a child node of `parent`.
*
* If a tree container is subscribed, the event of metadata changes will also be received as a MapDiff.
* And event's `path` will end with `TreeID`.
*
* @example

@@ -1381,6 +1360,6 @@ * ```ts

* tree.subscribe((event)=>{
* console.log(event);
* // event.type: "create" | "delete" | "move"
* });
* const root = tree.create();
* const node = tree.create(root);
* const root = tree.createNode();
* const node = root.createNode();
* doc.commit();

@@ -1405,4 +1384,4 @@ * ```

* });
* const root = tree.create();
* const node = tree.create(root);
* const root = tree.createNode();
* const node = root.createNode();
* doc.commit();

@@ -1428,5 +1407,5 @@ * tree.unsubscribe(doc, subscription);

* const tree = doc.getTree("tree");
* const root = tree.create();
* const node = tree.create(root);
* const node2 = tree.create(node);
* const root = tree.createNode();
* const node = root.createNode();
* const node2 = node.createNode();
* console.log(tree.nodes) // [ '1@A5024AE0E00529D2', '2@A5024AE0E00529D2', '0@A5024AE0E00529D2' ]

@@ -1446,2 +1425,59 @@ * ```

*/
export class LoroTreeNode {
free(): void;
/**
* Create a new tree node as the child of this node and return a LoroTreeNode instance.
*
* @example
* ```ts
* import { Loro } from "loro-crdt";
* const doc = new Loro();
* const tree = doc.getTree("tree");
* const root = tree.createNode();
* const node = root.createNode();
* ```
* @returns {LoroTreeNode}
*/
createNode(): LoroTreeNode;
/**
* Move the target tree node to be a root node.
*/
setAsRoot(): void;
/**
* Move the target tree node to be a child of the parent.
* If the parent is undefined, the target will be a root node.
*
* @example
* ```ts
* const doc = new Loro();
* const tree = doc.getTree("tree");
* const root = tree.createNode();
* const node = root.createNode();
* const node2 = node.createNode();
* node2.moveTo(root);
* ```
* @param {LoroTreeNode} parent
*/
moveTo(parent: LoroTreeNode): void;
/**
* Get the parent node of this node.
* @returns {LoroTreeNode | undefined}
*/
parent(): LoroTreeNode | undefined;
/**
* Get the children of this node.
* @returns {Array<any>}
*/
children(): Array<any>;
/**
* Get the associated metadata map container of a tree node.
*/
readonly data: LoroMap;
/**
* The TreeID of the node.
*/
readonly id: TreeID;
}
/**
*/
export class VersionVector {

@@ -1448,0 +1484,0 @@ free(): void;

{
"name": "loro-wasm",
"version": "0.10.1",
"version": "0.11.0",
"description": "Loro CRDTs is a high-performance CRDT framework that makes your app state synchronized, collaborative and maintainable effortlessly.",

@@ -5,0 +5,0 @@ "keywords": [

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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