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
100
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.12.0 to 0.13.0

19

CHANGELOG.md
# Changelog
## 0.13.0
### Minor Changes
- BREAKING CHANGE: `detached` mode for Containers #300
Now creating sub-containers is much easier.
A container can be either attached to a document or detached. When it's detached, its history/state is not persisted. You can attach a container to a document by inserting it into an existing attached container. Once a container is attached, its state, along with all of its descendants's states, will be recreated in the document. After attaching, the container and its descendants will each have their corresponding "attached" version of themselves.
When a detached container x is attached to a document, you can use `x.getAttached()` to obtain the corresponding attached container.
When we use const text = new LoroList(), it's not attached to a doc. But we can insert it into a doc by map.insertContainer(”t”, text), where the map is attached. But if we want the operations on the text to be recorded to the doc, we now need to get its attached version. So we can use “let attachedText = text.getAttached()”
### Patch Changes
- Updated dependencies
- loro-wasm@0.13.0
## 0.12.0

@@ -4,0 +23,0 @@

15

dist/loro.d.ts

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

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

@@ -128,10 +128,7 @@ export { Loro } from 'loro-wasm';

interface LoroList<T extends any[] = any[]> {
insertContainer(pos: number, container: "Map"): LoroMap;
insertContainer(pos: number, container: "List"): LoroList;
insertContainer(pos: number, container: "Text"): LoroText;
insertContainer(pos: number, container: "Tree"): LoroTree;
insertContainer(pos: number, container: string): never;
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;

@@ -147,7 +144,3 @@ delete(pos: number, len: number): void;

getOrCreateContainer(key: string, container_type: string): never;
setContainer(key: string, container_type: "Map"): LoroMap;
setContainer(key: string, container_type: "List"): LoroList;
setContainer(key: string, container_type: "Text"): LoroText;
setContainer(key: string, container_type: "Tree"): LoroTree;
setContainer(key: string, container_type: string): never;
setContainer<C extends Container>(key: string, child: C): C;
get(key: string): undefined | Value | Container;

@@ -154,0 +147,0 @@ getTyped<Key extends keyof T & string>(txn: Loro, key: Key): T[Key];

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

@@ -36,3 +36,3 @@ "devDependencies": {

"vite-plugin-wasm": "^3.2.2",
"vitest": "^1.0.4"
"vitest": "^1.4.0"
},

@@ -39,0 +39,0 @@ "scripts": {

export * from "loro-wasm";
import {
Container,
ContainerID,
Delta,
Loro,
LoroList,
LoroMap,
LoroText,

@@ -9,8 +13,4 @@ LoroTree,

OpId,
TreeID,
Value,
ContainerID,
Loro,
LoroList,
LoroMap,
TreeID,
} from "loro-wasm";

@@ -183,10 +183,6 @@

value: T,
): T extends LoroText
? "Text"
: T extends LoroMap
? "Map"
: T extends LoroTree
? "Tree"
: T extends LoroList
? "List"
): T extends LoroText ? "Text"
: T extends LoroMap ? "Map"
: T extends LoroTree ? "Tree"
: T extends LoroList ? "List"
: "Json" {

@@ -215,7 +211,3 @@ if (isContainer(value)) {

interface LoroList<T extends any[] = any[]> {
insertContainer(pos: number, container: "Map"): LoroMap;
insertContainer(pos: number, container: "List"): LoroList;
insertContainer(pos: number, container: "Text"): LoroText;
insertContainer(pos: number, container: "Tree"): LoroTree;
insertContainer(pos: number, container: string): never;
insertContainer<C extends Container>(pos: number, child: C): C;

@@ -225,2 +217,3 @@ 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;

@@ -238,7 +231,3 @@ delete(pos: number, len: number): void;

setContainer(key: string, container_type: "Map"): LoroMap;
setContainer(key: string, container_type: "List"): LoroList;
setContainer(key: string, container_type: "Text"): LoroText;
setContainer(key: string, container_type: "Tree"): LoroTree;
setContainer(key: string, container_type: string): never;
setContainer<C extends Container>(key: string, child: C): C;

@@ -245,0 +234,0 @@ get(key: string): undefined | Value | Container;

{
"compilerOptions": {
/* Visit https://aka.ms/tsconfig to read more about this file */
/* Projects */

@@ -12,3 +11,2 @@ // "incremental": true, /* Save .tsbuildinfo files to allow for incremental compilation of projects. */

// "disableReferencedProjectLoad": true, /* Reduce the number of projects loaded automatically by TypeScript. */
/* Language and Environment */

@@ -27,3 +25,2 @@ "target": "ESNext" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,

// "moduleDetection": "auto", /* Control what method is used to detect module-format JS files. */
/* Modules */

@@ -47,3 +44,2 @@ "module": "commonjs" /* Specify what module code is generated. */,

// "noResolve": true, /* Disallow 'import's, 'require's or '<reference>'s from expanding the number of files TypeScript should add to a project. */
/* JavaScript Support */

@@ -53,3 +49,2 @@ // "allowJs": true, /* Allow JavaScript files to be a part of your program. Use the 'checkJS' option to get errors from these files. */

// "maxNodeModuleJsDepth": 1, /* Specify the maximum folder depth used for checking JavaScript files from 'node_modules'. Only applicable with 'allowJs'. */
/* Emit */

@@ -62,3 +57,3 @@ // "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */

// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
// "outDir": "./", /* Specify an output folder for all emitted files. */
"outDir": "./dist", /* Specify an output folder for all emitted files. */
// "removeComments": true, /* Disable emitting comments. */

@@ -80,3 +75,2 @@ // "noEmit": true, /* Disable emitting files from a compilation. */

// "preserveValueImports": true, /* Preserve unused imported values in the JavaScript output that would otherwise be removed. */
/* Interop Constraints */

@@ -89,3 +83,2 @@ // "isolatedModules": true, /* Ensure that each file can be safely transpiled without relying on other imports. */

"forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
/* Type Checking */

@@ -111,3 +104,2 @@ "strict": true /* Enable all strict type-checking options. */,

// "allowUnreachableCode": true, /* Disable error reporting for unreachable code. */
/* Completeness */

@@ -114,0 +106,0 @@ // "skipDefaultLibCheck": true, /* Skip type checking .d.ts files that are included with TypeScript. */

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