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

loro-crdt

Package Overview
Dependencies
Maintainers
1
Versions
105
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

loro-crdt - npm Package Compare versions

Comparing version 0.13.0 to 0.13.1

8

CHANGELOG.md
# Changelog
## 0.13.1
### Patch Changes
- Fix type errors and conversion from js->rust error
- Updated dependencies
- loro-wasm@0.13.1
## 0.13.0

@@ -4,0 +12,0 @@

34

dist/loro.d.ts

@@ -1,2 +0,2 @@

import { Container, Value, TreeID, OpId, ContainerID, Delta, LoroText, LoroMap, LoroTree, LoroList } from 'loro-wasm';
import { ContainerID, Container, Value, TreeID, OpId, Delta, LoroText, LoroMap, LoroTree, LoroList } from 'loro-wasm';
export * from 'loro-wasm';

@@ -118,3 +118,3 @@ export { Loro } from 'loro-wasm';

*/
declare function getType<T>(value: T): T extends LoroText ? "Text" : T extends LoroMap ? "Map" : T extends LoroTree ? "Tree" : T extends LoroList ? "List" : "Json";
declare function getType<T>(value: T): T extends LoroText ? "Text" : T extends LoroMap<any> ? "Map" : T extends LoroTree<any> ? "Tree" : T extends LoroList<any> ? "List" : "Json";
declare module "loro-wasm" {

@@ -127,4 +127,9 @@ interface Loro {

getTypedList<Key extends keyof T & string>(name: Key): T[Key] extends LoroList ? T[Key] : never;
getMap(key: string | ContainerID): LoroMap<T[string]>;
getList(key: string | ContainerID): LoroList<T[string]>;
getTree(key: string | ContainerID): LoroTree<T[string]>;
getText(key: string | ContainerID): LoroText;
}
interface LoroList<T extends any[] = any[]> {
new (): LoroList<T>;
insertContainer<C extends Container>(pos: number, child: C): C;

@@ -134,13 +139,10 @@ get(index: number): undefined | Value | Container;

insertTyped<Key extends keyof T & number>(pos: Key, value: T[Key]): void;
insert(pos: number, value: Container): never;
insert(pos: number, value: Value): void;
delete(pos: number, len: number): void;
subscribe(txn: Loro, listener: Listener): number;
getAttached(): undefined | LoroList<T>;
}
interface LoroMap<T extends Record<string, any> = Record<string, any>> {
getOrCreateContainer(key: string, container_type: "Map"): LoroMap;
getOrCreateContainer(key: string, container_type: "List"): LoroList;
getOrCreateContainer(key: string, container_type: "Text"): LoroText;
getOrCreateContainer(key: string, container_type: "Tree"): LoroTree;
getOrCreateContainer(key: string, container_type: string): never;
new (): LoroMap<T>;
getOrCreateContainer<C extends Container>(key: string, child: C): C;
setContainer<C extends Container>(key: string, child: C): C;

@@ -155,2 +157,3 @@ get(key: string): undefined | Value | Container;

interface LoroText {
new (): LoroText;
insert(pos: number, text: string): void;

@@ -160,4 +163,5 @@ delete(pos: number, len: number): void;

}
interface LoroTree {
createNode(parent: TreeID | undefined): LoroTreeNode;
interface LoroTree<T extends Record<string, any> = Record<string, any>> {
new (): LoroTree<T>;
createNode(parent: TreeID | undefined): LoroTreeNode<T>;
move(target: TreeID, parent: TreeID | undefined): void;

@@ -169,9 +173,9 @@ delete(target: TreeID): void;

}
interface LoroTreeNode {
readonly data: LoroMap;
createNode(): LoroTreeNode;
interface LoroTreeNode<T extends Record<string, any> = Record<string, any>> {
readonly data: LoroMap<T>;
createNode(): LoroTreeNode<T>;
setAsRoot(): void;
moveTo(parent: LoroTreeNode): void;
moveTo(parent: LoroTreeNode<T>): void;
parent(): LoroTreeNode | undefined;
children(): Array<LoroTreeNode>;
children(): Array<LoroTreeNode<T>>;
}

@@ -178,0 +182,0 @@ }

{
"name": "loro-crdt",
"version": "0.13.0",
"version": "0.13.1",
"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.13.0"
"loro-wasm": "0.13.1"
},

@@ -41,5 +41,5 @@ "devDependencies": {

"watch": "rollup -c -w",
"test": "vitest run",
"test": "vitest run --typecheck",
"prepublish": "pnpm run build"
}
}

@@ -183,8 +183,8 @@ export * from "loro-wasm";

): T extends LoroText ? "Text"
: T extends LoroMap ? "Map"
: T extends LoroTree ? "Tree"
: T extends LoroList ? "List"
: T extends LoroMap<any> ? "Map"
: T extends LoroTree<any> ? "Tree"
: T extends LoroList<any> ? "List"
: "Json" {
if (isContainer(value)) {
return value.kind();
return value.kind() as unknown as any;
}

@@ -207,25 +207,37 @@

): T[Key] extends LoroList ? T[Key] : never;
getMap(key: string | ContainerID): LoroMap<T[string]>;
getList(key: string | ContainerID): LoroList<T[string]>;
getTree(key: string | ContainerID): LoroTree<T[string]>;
getText(key: string | ContainerID): LoroText;
}
interface LoroList<T extends any[] = any[]> {
insertContainer<C extends Container>(pos: number, child: C): C;
interface LoroList<
T extends any[] = any[],
> {
new (): LoroList<T>;
insertContainer<C extends Container>(
pos: number,
child: C,
): C;
get(index: number): undefined | Value | Container;
getTyped<Key extends keyof T & number>(loro: Loro, index: Key): T[Key];
insertTyped<Key extends keyof T & number>(pos: Key, value: T[Key]): void;
insert(pos: number, value: Container): never;
insert(pos: number, value: Value): void;
delete(pos: number, len: number): void;
subscribe(txn: Loro, listener: Listener): number;
getAttached(): undefined | LoroList<T>;
}
interface LoroMap<T extends Record<string, any> = Record<string, any>> {
getOrCreateContainer(key: string, container_type: "Map"): LoroMap;
getOrCreateContainer(key: string, container_type: "List"): LoroList;
getOrCreateContainer(key: string, container_type: "Text"): LoroText;
getOrCreateContainer(key: string, container_type: "Tree"): LoroTree;
getOrCreateContainer(key: string, container_type: string): never;
setContainer<C extends Container>(key: string, child: C): C;
interface LoroMap<
T extends Record<string, any> = Record<string, any>,
> {
new (): LoroMap<T>;
getOrCreateContainer<C extends Container>(
key: string,
child: C,
): C;
setContainer<C extends Container>(
key: string,
child: C,
): C;
get(key: string): undefined | Value | Container;

@@ -240,2 +252,3 @@ getTyped<Key extends keyof T & string>(txn: Loro, key: Key): T[Key];

interface LoroText {
new (): LoroText;
insert(pos: number, text: string): void;

@@ -246,4 +259,7 @@ delete(pos: number, len: number): void;

interface LoroTree {
createNode(parent: TreeID | undefined): LoroTreeNode;
interface LoroTree<
T extends Record<string, any> = Record<string, any>,
> {
new (): LoroTree<T>;
createNode(parent: TreeID | undefined): LoroTreeNode<T>;
move(target: TreeID, parent: TreeID | undefined): void;

@@ -256,10 +272,12 @@ delete(target: TreeID): void;

interface LoroTreeNode {
readonly data: LoroMap;
createNode(): LoroTreeNode;
interface LoroTreeNode<
T extends Record<string, any> = Record<string, any>,
> {
readonly data: LoroMap<T>;
createNode(): LoroTreeNode<T>;
setAsRoot(): void;
moveTo(parent: LoroTreeNode): void;
moveTo(parent: LoroTreeNode<T>): void;
parent(): LoroTreeNode | undefined;
children(): Array<LoroTreeNode>;
children(): Array<LoroTreeNode<T>>;
}
}

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