loro-crdt
Advanced tools
Comparing version 0.15.4 to 0.16.0
@@ -100,2 +100,4 @@ import { Value, AwarenessWasm, PeerID as PeerID$1, Container, ContainerID, TreeID, OpId, Delta, LoroText, LoroMap, LoroTree, LoroList } from 'loro-wasm'; | ||
parent: TreeID | undefined; | ||
index: number; | ||
position: string; | ||
} | { | ||
@@ -108,2 +110,4 @@ target: TreeID; | ||
parent: TreeID | undefined; | ||
index: number; | ||
position: string; | ||
}; | ||
@@ -174,3 +178,3 @@ type TreeDiff = { | ||
*/ | ||
getMap<Key extends (keyof T) | ContainerID>(name: Key): T[Key] extends LoroMap ? T[Key] : LoroMap; | ||
getMap<Key extends keyof T | ContainerID>(name: Key): T[Key] extends LoroMap ? T[Key] : LoroMap; | ||
/** | ||
@@ -190,3 +194,3 @@ * Get a LoroList by container id | ||
*/ | ||
getList<Key extends (keyof T) | ContainerID>(name: Key): T[Key] extends LoroList ? T[Key] : LoroList; | ||
getList<Key extends keyof T | ContainerID>(name: Key): T[Key] extends LoroList ? T[Key] : LoroList; | ||
/** | ||
@@ -206,3 +210,3 @@ * Get a LoroMovableList by container id | ||
*/ | ||
getMovableList<Key extends (keyof T) | ContainerID>(name: Key): T[Key] extends LoroMovableList ? T[Key] : LoroMovableList; | ||
getMovableList<Key extends keyof T | ContainerID>(name: Key): T[Key] extends LoroMovableList ? T[Key] : LoroMovableList; | ||
/** | ||
@@ -222,3 +226,3 @@ * Get a LoroTree by container id | ||
*/ | ||
getTree<Key extends (keyof T) | ContainerID>(name: Key): T[Key] extends LoroTree ? T[Key] : LoroTree; | ||
getTree<Key extends keyof T | ContainerID>(name: Key): T[Key] extends LoroTree ? T[Key] : LoroTree; | ||
getText(key: string | ContainerID): LoroText; | ||
@@ -490,4 +494,4 @@ } | ||
new (): LoroTree<T>; | ||
createNode(parent: TreeID | undefined): LoroTreeNode<T>; | ||
move(target: TreeID, parent: TreeID | undefined): void; | ||
createNode(parent?: TreeID, index?: number): LoroTreeNode<T>; | ||
move(target: TreeID, parent?: TreeID, index?: number): void; | ||
delete(target: TreeID): void; | ||
@@ -503,5 +507,4 @@ has(target: TreeID): boolean; | ||
readonly data: LoroMap<T>; | ||
createNode(): LoroTreeNode<T>; | ||
setAsRoot(): void; | ||
moveTo(parent: LoroTreeNode<T>): void; | ||
createNode(index?: number): LoroTreeNode<T>; | ||
move(parent?: LoroTreeNode<T>, index?: number): void; | ||
parent(): LoroTreeNode<T> | undefined; | ||
@@ -508,0 +511,0 @@ children(): Array<LoroTreeNode<T>>; |
@@ -87,3 +87,3 @@ 'use strict'; | ||
const CONTAINER_TYPES = ["Map", "Text", "List", "Tree"]; | ||
const CONTAINER_TYPES = ["Map", "Text", "List", "Tree", "MovableList"]; | ||
function isContainerId(s) { | ||
@@ -118,3 +118,3 @@ return s.startsWith("cid:"); | ||
Object.keys(loroWasm).forEach(function (k) { | ||
if (k !== 'default' && !exports.hasOwnProperty(k)) Object.defineProperty(exports, k, { | ||
if (k !== 'default' && !Object.prototype.hasOwnProperty.call(exports, k)) Object.defineProperty(exports, k, { | ||
enumerable: true, | ||
@@ -121,0 +121,0 @@ get: function () { return loroWasm[k]; } |
{ | ||
"name": "loro-crdt", | ||
"version": "0.15.4", | ||
"version": "0.16.0", | ||
"description": "Loro CRDTs is a high-performance CRDT framework that makes your app state synchronized, collaborative and maintainable effortlessly.", | ||
@@ -20,3 +20,3 @@ "keywords": [ | ||
"dependencies": { | ||
"loro-wasm": "0.15.4" | ||
"loro-wasm": "0.16.0" | ||
}, | ||
@@ -29,2 +29,3 @@ "devDependencies": { | ||
"eslint": "^8.46.0", | ||
"loro-crdt-old": "npm:loro-crdt@0.15.4", | ||
"prettier": "^3.0.0", | ||
@@ -31,0 +32,0 @@ "rollup": "^3.20.1", |
@@ -85,5 +85,17 @@ export * from "loro-wasm"; | ||
export type TreeDiffItem = | ||
| { target: TreeID; action: "create"; parent: TreeID | undefined } | ||
| { | ||
target: TreeID; | ||
action: "create"; | ||
parent: TreeID | undefined; | ||
index: number; | ||
position: string; | ||
} | ||
| { target: TreeID; action: "delete" } | ||
| { target: TreeID; action: "move"; parent: TreeID | undefined }; | ||
| { | ||
target: TreeID; | ||
action: "move"; | ||
parent: TreeID | undefined; | ||
index: number; | ||
position: string; | ||
}; | ||
@@ -101,3 +113,3 @@ export type TreeDiff = { | ||
const CONTAINER_TYPES = ["Map", "Text", "List", "Tree"]; | ||
const CONTAINER_TYPES = ["Map", "Text", "List", "Tree", "MovableList"]; | ||
@@ -158,7 +170,11 @@ export function isContainerId(s: string): s is ContainerID { | ||
value: T, | ||
): T extends LoroText ? "Text" | ||
: T extends LoroMap<any> ? "Map" | ||
: T extends LoroTree<any> ? "Tree" | ||
: T extends LoroList<any> ? "List" | ||
: "Json" { | ||
): T extends LoroText | ||
? "Text" | ||
: T extends LoroMap<any> | ||
? "Map" | ||
: T extends LoroTree<any> | ||
? "Tree" | ||
: T extends LoroList<any> | ||
? "List" | ||
: "Json" { | ||
if (isContainer(value)) { | ||
@@ -193,3 +209,3 @@ return value.kind() as unknown as any; | ||
*/ | ||
getMap<Key extends (keyof T) | ContainerID>( | ||
getMap<Key extends keyof T | ContainerID>( | ||
name: Key, | ||
@@ -211,3 +227,3 @@ ): T[Key] extends LoroMap ? T[Key] : LoroMap; | ||
*/ | ||
getList<Key extends (keyof T) | ContainerID>( | ||
getList<Key extends keyof T | ContainerID>( | ||
name: Key, | ||
@@ -229,3 +245,3 @@ ): T[Key] extends LoroList ? T[Key] : LoroList; | ||
*/ | ||
getMovableList<Key extends (keyof T) | ContainerID>( | ||
getMovableList<Key extends keyof T | ContainerID>( | ||
name: Key, | ||
@@ -247,3 +263,3 @@ ): T[Key] extends LoroMovableList ? T[Key] : LoroMovableList; | ||
*/ | ||
getTree<Key extends (keyof T) | ContainerID>( | ||
getTree<Key extends keyof T | ContainerID>( | ||
name: Key, | ||
@@ -541,4 +557,4 @@ ): T[Key] extends LoroTree ? T[Key] : LoroTree; | ||
new (): LoroTree<T>; | ||
createNode(parent: TreeID | undefined): LoroTreeNode<T>; | ||
move(target: TreeID, parent: TreeID | undefined): void; | ||
createNode(parent?: TreeID, index?: number): LoroTreeNode<T>; | ||
move(target: TreeID, parent?: TreeID, index?: number): void; | ||
delete(target: TreeID): void; | ||
@@ -557,5 +573,4 @@ has(target: TreeID): boolean; | ||
readonly data: LoroMap<T>; | ||
createNode(): LoroTreeNode<T>; | ||
setAsRoot(): void; | ||
moveTo(parent: LoroTreeNode<T>): void; | ||
createNode(index?: number): LoroTreeNode<T>; | ||
move(parent?: LoroTreeNode<T>, index?: number): void; | ||
parent(): LoroTreeNode<T> | undefined; | ||
@@ -565,5 +580,3 @@ children(): Array<LoroTreeNode<T>>; | ||
interface AwarenessWasm< | ||
T extends Value = Value, | ||
> { | ||
interface AwarenessWasm<T extends Value = Value> { | ||
getState(peer: PeerID): T | undefined; | ||
@@ -570,0 +583,0 @@ getTimestamp(peer: PeerID): number | undefined; |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
174487
1550
14
+ Addedloro-wasm@0.16.0(transitive)
- Removedloro-wasm@0.15.4(transitive)
Updatedloro-wasm@0.16.0