Socket
Socket
Sign inDemoInstall

@liveblocks/client

Package Overview
Dependencies
Maintainers
2
Versions
376
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@liveblocks/client - npm Package Compare versions

Comparing version 0.7.2 to 0.7.3

1

lib/cjs/doc.d.ts

@@ -49,3 +49,4 @@ import { Op, SerializedRecord } from "./live";

deleteItem(id: string, index: number): Doc<T>;
deleteItemById(id: string, itemId: string): Doc<T>;
}
export {};

@@ -131,3 +131,3 @@ "use strict";

if (targetIndex < 0) {
throw new Error("targetIndex cannont be less than 0");
throw new Error("targetIndex cannot be less than 0");
}

@@ -138,3 +138,3 @@ if (targetIndex >= items.length) {

if (index < 0) {
throw new Error("index cannont be less than 0");
throw new Error("index cannot be less than 0");
}

@@ -179,3 +179,3 @@ if (index >= items.length) {

const items = sortedListItems(getListItems(this._cache, id));
const [position, item] = items[index];
const [, item] = items[index];
return this.dispatch({

@@ -187,2 +187,27 @@ type: live_1.OpType.ListRemove,

}
deleteItemById(id, itemId) {
const list = this.getChild(id);
if (list == null) {
throw new Error(`List with id "${id}" does not exist`);
}
if (list.$$type !== LIST) {
throw new Error(`Node with id "${id}" is not a list`);
}
const itemsMap = getListItems(this._cache, id);
let item = null;
for (const [, crdt] of itemsMap) {
if (crdt.id === itemId) {
item = crdt;
break;
}
}
if (item == null) {
throw new Error(`List with id "${id}" does not have an item with id "${itemId}"`);
}
return this.dispatch({
type: live_1.OpType.ListRemove,
id: list.id,
itemId: item.id,
}, true);
}
}

@@ -189,0 +214,0 @@ exports.Doc = Doc;

7

lib/cjs/room.d.ts

@@ -91,7 +91,8 @@ import { RecordData, List } from ".";

deleteItem: <T_11 extends RecordData>(list: List<Record<T_11>>, index: number) => void;
moveItem: <T_12 extends RecordData>(list: List<Record<T_12>>, index: number, targetIndex: number) => void;
deleteItemById: <T_12 extends RecordData>(list: List<Record<T_12>>, itemId: string) => void;
moveItem: <T_13 extends RecordData>(list: List<Record<T_13>>, index: number, targetIndex: number) => void;
selectors: {
getConnectionState: () => Connection;
getPresence: <T_13 extends Serializable>() => T_13;
getOthers: <T_14 extends Serializable>() => Others<T_14>;
getPresence: <T_14 extends Serializable>() => T_14;
getOthers: <T_15 extends Serializable>() => Others<T_15>;
getStorage: () => LiveStorage;

@@ -98,0 +99,0 @@ };

@@ -532,2 +532,5 @@ "use strict";

}
function deleteItemById(list, itemId) {
updateDoc(state.doc.deleteItemById(list.id, itemId));
}
function moveItem(list, index, targetIndex) {

@@ -561,2 +564,3 @@ updateDoc(state.doc.moveItem(list.id, index, targetIndex));

deleteItem,
deleteItemById,
moveItem,

@@ -641,2 +645,3 @@ selectors: {

deleteItem: machine.deleteItem,
deleteItemById: machine.deleteItemById,
moveItem: machine.moveItem,

@@ -643,0 +648,0 @@ //////////////

@@ -118,2 +118,3 @@ import { RecordData, Record, List } from "./doc";

deleteItem<T extends RecordData>(list: List<Record<T>>, index: number): void;
deleteItemById<T extends RecordData>(list: List<Record<T>>, itemId: string): void;
moveItem<T extends RecordData>(list: List<Record<T>>, index: number, targetIndex: number): void;

@@ -120,0 +121,0 @@ };

@@ -49,3 +49,4 @@ import { Op, SerializedRecord } from "./live";

deleteItem(id: string, index: number): Doc<T>;
deleteItemById(id: string, itemId: string): Doc<T>;
}
export {};

@@ -126,3 +126,3 @@ import { OpType, CrdtType, } from "./live";

if (targetIndex < 0) {
throw new Error("targetIndex cannont be less than 0");
throw new Error("targetIndex cannot be less than 0");
}

@@ -133,3 +133,3 @@ if (targetIndex >= items.length) {

if (index < 0) {
throw new Error("index cannont be less than 0");
throw new Error("index cannot be less than 0");
}

@@ -174,3 +174,3 @@ if (index >= items.length) {

const items = sortedListItems(getListItems(this._cache, id));
const [position, item] = items[index];
const [, item] = items[index];
return this.dispatch({

@@ -182,2 +182,27 @@ type: OpType.ListRemove,

}
deleteItemById(id, itemId) {
const list = this.getChild(id);
if (list == null) {
throw new Error(`List with id "${id}" does not exist`);
}
if (list.$$type !== LIST) {
throw new Error(`Node with id "${id}" is not a list`);
}
const itemsMap = getListItems(this._cache, id);
let item = null;
for (const [, crdt] of itemsMap) {
if (crdt.id === itemId) {
item = crdt;
break;
}
}
if (item == null) {
throw new Error(`List with id "${id}" does not have an item with id "${itemId}"`);
}
return this.dispatch({
type: OpType.ListRemove,
id: list.id,
itemId: item.id,
}, true);
}
}

@@ -184,0 +209,0 @@ function getAllLinks(id, rootId, links) {

@@ -91,7 +91,8 @@ import { RecordData, List } from ".";

deleteItem: <T_11 extends RecordData>(list: List<Record<T_11>>, index: number) => void;
moveItem: <T_12 extends RecordData>(list: List<Record<T_12>>, index: number, targetIndex: number) => void;
deleteItemById: <T_12 extends RecordData>(list: List<Record<T_12>>, itemId: string) => void;
moveItem: <T_13 extends RecordData>(list: List<Record<T_13>>, index: number, targetIndex: number) => void;
selectors: {
getConnectionState: () => Connection;
getPresence: <T_13 extends Serializable>() => T_13;
getOthers: <T_14 extends Serializable>() => Others<T_14>;
getPresence: <T_14 extends Serializable>() => T_14;
getOthers: <T_15 extends Serializable>() => Others<T_15>;
getStorage: () => LiveStorage;

@@ -98,0 +99,0 @@ };

@@ -510,2 +510,5 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

}
function deleteItemById(list, itemId) {
updateDoc(state.doc.deleteItemById(list.id, itemId));
}
function moveItem(list, index, targetIndex) {

@@ -539,2 +542,3 @@ updateDoc(state.doc.moveItem(list.id, index, targetIndex));

deleteItem,
deleteItemById,
moveItem,

@@ -617,2 +621,3 @@ selectors: {

deleteItem: machine.deleteItem,
deleteItemById: machine.deleteItemById,
moveItem: machine.moveItem,

@@ -619,0 +624,0 @@ //////////////

@@ -118,2 +118,3 @@ import { RecordData, Record, List } from "./doc";

deleteItem<T extends RecordData>(list: List<Record<T>>, index: number): void;
deleteItemById<T extends RecordData>(list: List<Record<T>>, itemId: string): void;
moveItem<T extends RecordData>(list: List<Record<T>>, index: number, targetIndex: number): void;

@@ -120,0 +121,0 @@ };

{
"name": "@liveblocks/client",
"version": "0.7.2",
"version": "0.7.3",
"description": "",

@@ -5,0 +5,0 @@ "main": "./lib/cjs/index.js",

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