Socket
Socket
Sign inDemoInstall

@liveblocks/client

Package Overview
Dependencies
Maintainers
3
Versions
368
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.12.0-beta.9 to 0.12.0-beta.10

3

lib/cjs/doc.d.ts

@@ -159,2 +159,3 @@ import { Op, SerializedCrdtWithId, SerializedList } from "./live";

_setChildKey(key: string, child: AbstractCrdt): void;
get length(): number;
push(item: T): void;

@@ -170,3 +171,3 @@ insert(item: T, index: number): void;

forEach(callbackfn: (value: T, index: number) => void): void;
get(index: number): T;
get(index: number): T | undefined;
indexOf(searchElement: T, fromIndex?: number): number;

@@ -173,0 +174,0 @@ lastIndexOf(searchElement: T, fromIndex?: number): number;

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

_Doc_clock = new WeakMap(), _Doc_items = new WeakMap(), _Doc_root = new WeakMap(), _Doc_actor = new WeakMap(), _Doc_dispatch = new WeakMap(), _Doc_instances = new WeakSet(), _Doc_applyCreateRegister = function _Doc_applyCreateRegister(op) {
if (__classPrivateFieldGet(this, _Doc_items, "f").has(op.id)) {
return;
}
const parent = __classPrivateFieldGet(this, _Doc_items, "f").get(op.parentId);

@@ -149,2 +152,5 @@ if (parent == null) {

}, _Doc_applyCreateMap = function _Doc_applyCreateMap(op) {
if (__classPrivateFieldGet(this, _Doc_items, "f").has(op.id)) {
return;
}
const parent = __classPrivateFieldGet(this, _Doc_items, "f").get(op.parentId);

@@ -157,2 +163,5 @@ if (parent == null) {

}, _Doc_applyCreateList = function _Doc_applyCreateList(op) {
if (__classPrivateFieldGet(this, _Doc_items, "f").has(op.id)) {
return;
}
const parent = __classPrivateFieldGet(this, _Doc_items, "f").get(op.parentId);

@@ -165,2 +174,5 @@ if (parent == null) {

}, _Doc_applyCreateObject = function _Doc_applyCreateObject(op) {
if (__classPrivateFieldGet(this, _Doc_items, "f").has(op.id)) {
return;
}
if (op.parentId && op.parentKey) {

@@ -306,3 +318,3 @@ const parent = __classPrivateFieldGet(this, _Doc_items, "f").get(op.parentId);

parentKey,
data: {}
data: {},
};

@@ -431,15 +443,2 @@ ops.push(op);

}
// delete<TKey extends keyof T>(key: TKey) {
// if (this.doc && this.id) {
// const item = this._map.get(key as string);
// if (isCrdt(item)) {
// item.detach();
// }
// this.doc.dispatch([
// { type: OpType.DeleteObjectKey, id: this.id, key: key as string },
// ]);
// }
// this._map.delete(key as string);
// this.notify();
// }
update(overrides) {

@@ -451,3 +450,3 @@ if (this._doc && this._id) {

type: live_1.OpType.UpdateObject,
data: {}
data: {},
};

@@ -725,3 +724,4 @@ ops.push(updateOp);

}
return [{
return [
{
type: live_1.OpType.CreateRegister,

@@ -731,4 +731,5 @@ id: this._id,

parentKey,
data: this.data
}];
data: this.data,
},
];
}

@@ -746,3 +747,3 @@ _attachChild(id, key, crdt) {

super();
// TODO: Naive array at first, find a better data structure
// TODO: Naive array at first, find a better data structure. Maybe an Order statistics tree?
_LiveList_items.set(this, []);

@@ -771,3 +772,3 @@ let position = undefined;

__classPrivateFieldGet(list, _LiveList_items, "f").push([child, entry[1].parentKey]);
__classPrivateFieldGet(list, _LiveList_items, "f").sort((itemA, itemB) => (0, position_1.compare)({ position: itemA[1] }, { position: itemB[1] }));
__classPrivateFieldGet(list, _LiveList_items, "f").sort((itemA, itemB) => (0, position_1.compare)(itemA[1], itemB[1]));
}

@@ -821,2 +822,3 @@ return list;

_attachChild(id, key, child) {
var _a;
if (this._doc == null) {

@@ -827,5 +829,9 @@ throw new Error("Can't attach child if doc is not present");

child._setParent(this);
// TODO: Handle list conflict
const index = __classPrivateFieldGet(this, _LiveList_items, "f").findIndex((entry) => entry[1] === key);
// Assign a temporary position until we get the fix from the backend
if (index !== -1) {
__classPrivateFieldGet(this, _LiveList_items, "f")[index][1] = (0, position_1.makePosition)(key, (_a = __classPrivateFieldGet(this, _LiveList_items, "f")[index + 1]) === null || _a === void 0 ? void 0 : _a[1]);
}
__classPrivateFieldGet(this, _LiveList_items, "f").push([child, key]);
__classPrivateFieldGet(this, _LiveList_items, "f").sort((itemA, itemB) => (0, position_1.compare)({ position: itemA[1] }, { position: itemB[1] }));
__classPrivateFieldGet(this, _LiveList_items, "f").sort((itemA, itemB) => (0, position_1.compare)(itemA[1], itemB[1]));
this.notify();

@@ -848,2 +854,8 @@ }

_setChildKey(key, child) {
var _a;
const index = __classPrivateFieldGet(this, _LiveList_items, "f").findIndex((entry) => entry[1] === key);
// Assign a temporary position until we get the fix from the backend
if (index !== -1) {
__classPrivateFieldGet(this, _LiveList_items, "f")[index][1] = (0, position_1.makePosition)(key, (_a = __classPrivateFieldGet(this, _LiveList_items, "f")[index + 1]) === null || _a === void 0 ? void 0 : _a[1]);
}
const item = __classPrivateFieldGet(this, _LiveList_items, "f").find((item) => item[0] === child);

@@ -853,5 +865,8 @@ if (item) {

}
__classPrivateFieldGet(this, _LiveList_items, "f").sort((itemA, itemB) => (0, position_1.compare)({ position: itemA[1] }, { position: itemB[1] }));
__classPrivateFieldGet(this, _LiveList_items, "f").sort((itemA, itemB) => (0, position_1.compare)(itemA[1], itemB[1]));
this.notify();
}
get length() {
return __classPrivateFieldGet(this, _LiveList_items, "f").length;
}
push(item) {

@@ -880,3 +895,3 @@ const position = __classPrivateFieldGet(this, _LiveList_items, "f").length === 0

__classPrivateFieldGet(this, _LiveList_items, "f").push([value, position]);
__classPrivateFieldGet(this, _LiveList_items, "f").sort((itemA, itemB) => (0, position_1.compare)({ position: itemA[1] }, { position: itemB[1] }));
__classPrivateFieldGet(this, _LiveList_items, "f").sort((itemA, itemB) => (0, position_1.compare)(itemA[1], itemB[1]));
this.notify();

@@ -918,10 +933,12 @@ if (this._doc && this._id) {

item[1] = position;
__classPrivateFieldGet(this, _LiveList_items, "f").sort((itemA, itemB) => (0, position_1.compare)({ position: itemA[1] }, { position: itemB[1] }));
__classPrivateFieldGet(this, _LiveList_items, "f").sort((itemA, itemB) => (0, position_1.compare)(itemA[1], itemB[1]));
this.notify();
if (this._doc && this._id) {
this._doc.dispatch([{
this._doc.dispatch([
{
type: live_1.OpType.SetParentKey,
id: item[0]._id,
parentKey: position,
},]);
},
]);
}

@@ -968,2 +985,5 @@ }

get(index) {
if (index < 0 || index >= __classPrivateFieldGet(this, _LiveList_items, "f").length) {
return undefined;
}
return selfOrRegisterValue(__classPrivateFieldGet(this, _LiveList_items, "f")[index][0]);

@@ -970,0 +990,0 @@ }

@@ -6,6 +6,2 @@ export declare const min = 32;

export declare function pos(codes: number[]): string;
export declare function compare(itemA: {
position: string;
}, itemB: {
position: string;
}): number;
export declare function compare(posA: string, posB: string): number;

@@ -97,5 +97,5 @@ "use strict";

exports.pos = pos;
function compare(itemA, itemB) {
const aCodes = posCodes(itemA.position);
const bCodes = posCodes(itemB.position);
function compare(posA, posB) {
const aCodes = posCodes(posA);
const bCodes = posCodes(posB);
const maxLength = Math.max(aCodes.length, bCodes.length);

@@ -112,4 +112,4 @@ for (let i = 0; i < maxLength; i++) {

}
throw new Error(`Impossible to compare similar position "${itemA.position}" and "${itemB.position}"`);
throw new Error(`Impossible to compare similar position "${posA}" and "${posB}"`);
}
exports.compare = compare;

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

const throttleDelay = options.throttle || 100;
const liveblocksServer = options.liveblocksServer || "wss://liveblocks.net/v2";
const liveblocksServer = options.liveblocksServer || "wss://liveblocks.net/v3";
let authEndpoint;

@@ -576,3 +576,4 @@ if (options.authEndpoint) {

else {
const publicAuthorizeEndpoint = options.publicAuthorizeEndpoint || "https://liveblocks.io/api/public/authorize";
const publicAuthorizeEndpoint = options.publicAuthorizeEndpoint ||
"https://liveblocks.io/api/public/authorize";
authEndpoint = publicAuthorizeEndpoint;

@@ -586,3 +587,3 @@ }

room: name,
publicApiKey: options.publicApiKey
publicApiKey: options.publicApiKey,
});

@@ -589,0 +590,0 @@ const room = {

@@ -159,2 +159,3 @@ import { Op, SerializedCrdtWithId, SerializedList } from "./live";

_setChildKey(key: string, child: AbstractCrdt): void;
get length(): number;
push(item: T): void;

@@ -170,3 +171,3 @@ insert(item: T, index: number): void;

forEach(callbackfn: (value: T, index: number) => void): void;
get(index: number): T;
get(index: number): T | undefined;
indexOf(searchElement: T, fromIndex?: number): number;

@@ -173,0 +174,0 @@ lastIndexOf(searchElement: T, fromIndex?: number): number;

@@ -124,2 +124,5 @@ var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {

_Doc_clock = new WeakMap(), _Doc_items = new WeakMap(), _Doc_root = new WeakMap(), _Doc_actor = new WeakMap(), _Doc_dispatch = new WeakMap(), _Doc_instances = new WeakSet(), _Doc_applyCreateRegister = function _Doc_applyCreateRegister(op) {
if (__classPrivateFieldGet(this, _Doc_items, "f").has(op.id)) {
return;
}
const parent = __classPrivateFieldGet(this, _Doc_items, "f").get(op.parentId);

@@ -145,2 +148,5 @@ if (parent == null) {

}, _Doc_applyCreateMap = function _Doc_applyCreateMap(op) {
if (__classPrivateFieldGet(this, _Doc_items, "f").has(op.id)) {
return;
}
const parent = __classPrivateFieldGet(this, _Doc_items, "f").get(op.parentId);

@@ -153,2 +159,5 @@ if (parent == null) {

}, _Doc_applyCreateList = function _Doc_applyCreateList(op) {
if (__classPrivateFieldGet(this, _Doc_items, "f").has(op.id)) {
return;
}
const parent = __classPrivateFieldGet(this, _Doc_items, "f").get(op.parentId);

@@ -161,2 +170,5 @@ if (parent == null) {

}, _Doc_applyCreateObject = function _Doc_applyCreateObject(op) {
if (__classPrivateFieldGet(this, _Doc_items, "f").has(op.id)) {
return;
}
if (op.parentId && op.parentKey) {

@@ -302,3 +314,3 @@ const parent = __classPrivateFieldGet(this, _Doc_items, "f").get(op.parentId);

parentKey,
data: {}
data: {},
};

@@ -427,15 +439,2 @@ ops.push(op);

}
// delete<TKey extends keyof T>(key: TKey) {
// if (this.doc && this.id) {
// const item = this._map.get(key as string);
// if (isCrdt(item)) {
// item.detach();
// }
// this.doc.dispatch([
// { type: OpType.DeleteObjectKey, id: this.id, key: key as string },
// ]);
// }
// this._map.delete(key as string);
// this.notify();
// }
update(overrides) {

@@ -447,3 +446,3 @@ if (this._doc && this._id) {

type: OpType.UpdateObject,
data: {}
data: {},
};

@@ -719,3 +718,4 @@ ops.push(updateOp);

}
return [{
return [
{
type: OpType.CreateRegister,

@@ -725,4 +725,5 @@ id: this._id,

parentKey,
data: this.data
}];
data: this.data,
},
];
}

@@ -740,3 +741,3 @@ _attachChild(id, key, crdt) {

super();
// TODO: Naive array at first, find a better data structure
// TODO: Naive array at first, find a better data structure. Maybe an Order statistics tree?
_LiveList_items.set(this, []);

@@ -765,3 +766,3 @@ let position = undefined;

__classPrivateFieldGet(list, _LiveList_items, "f").push([child, entry[1].parentKey]);
__classPrivateFieldGet(list, _LiveList_items, "f").sort((itemA, itemB) => compare({ position: itemA[1] }, { position: itemB[1] }));
__classPrivateFieldGet(list, _LiveList_items, "f").sort((itemA, itemB) => compare(itemA[1], itemB[1]));
}

@@ -815,2 +816,3 @@ return list;

_attachChild(id, key, child) {
var _a;
if (this._doc == null) {

@@ -821,5 +823,9 @@ throw new Error("Can't attach child if doc is not present");

child._setParent(this);
// TODO: Handle list conflict
const index = __classPrivateFieldGet(this, _LiveList_items, "f").findIndex((entry) => entry[1] === key);
// Assign a temporary position until we get the fix from the backend
if (index !== -1) {
__classPrivateFieldGet(this, _LiveList_items, "f")[index][1] = makePosition(key, (_a = __classPrivateFieldGet(this, _LiveList_items, "f")[index + 1]) === null || _a === void 0 ? void 0 : _a[1]);
}
__classPrivateFieldGet(this, _LiveList_items, "f").push([child, key]);
__classPrivateFieldGet(this, _LiveList_items, "f").sort((itemA, itemB) => compare({ position: itemA[1] }, { position: itemB[1] }));
__classPrivateFieldGet(this, _LiveList_items, "f").sort((itemA, itemB) => compare(itemA[1], itemB[1]));
this.notify();

@@ -842,2 +848,8 @@ }

_setChildKey(key, child) {
var _a;
const index = __classPrivateFieldGet(this, _LiveList_items, "f").findIndex((entry) => entry[1] === key);
// Assign a temporary position until we get the fix from the backend
if (index !== -1) {
__classPrivateFieldGet(this, _LiveList_items, "f")[index][1] = makePosition(key, (_a = __classPrivateFieldGet(this, _LiveList_items, "f")[index + 1]) === null || _a === void 0 ? void 0 : _a[1]);
}
const item = __classPrivateFieldGet(this, _LiveList_items, "f").find((item) => item[0] === child);

@@ -847,5 +859,8 @@ if (item) {

}
__classPrivateFieldGet(this, _LiveList_items, "f").sort((itemA, itemB) => compare({ position: itemA[1] }, { position: itemB[1] }));
__classPrivateFieldGet(this, _LiveList_items, "f").sort((itemA, itemB) => compare(itemA[1], itemB[1]));
this.notify();
}
get length() {
return __classPrivateFieldGet(this, _LiveList_items, "f").length;
}
push(item) {

@@ -874,3 +889,3 @@ const position = __classPrivateFieldGet(this, _LiveList_items, "f").length === 0

__classPrivateFieldGet(this, _LiveList_items, "f").push([value, position]);
__classPrivateFieldGet(this, _LiveList_items, "f").sort((itemA, itemB) => compare({ position: itemA[1] }, { position: itemB[1] }));
__classPrivateFieldGet(this, _LiveList_items, "f").sort((itemA, itemB) => compare(itemA[1], itemB[1]));
this.notify();

@@ -912,10 +927,12 @@ if (this._doc && this._id) {

item[1] = position;
__classPrivateFieldGet(this, _LiveList_items, "f").sort((itemA, itemB) => compare({ position: itemA[1] }, { position: itemB[1] }));
__classPrivateFieldGet(this, _LiveList_items, "f").sort((itemA, itemB) => compare(itemA[1], itemB[1]));
this.notify();
if (this._doc && this._id) {
this._doc.dispatch([{
this._doc.dispatch([
{
type: OpType.SetParentKey,
id: item[0]._id,
parentKey: position,
},]);
},
]);
}

@@ -962,2 +979,5 @@ }

get(index) {
if (index < 0 || index >= __classPrivateFieldGet(this, _LiveList_items, "f").length) {
return undefined;
}
return selfOrRegisterValue(__classPrivateFieldGet(this, _LiveList_items, "f")[index][0]);

@@ -964,0 +984,0 @@ }

@@ -6,6 +6,2 @@ export declare const min = 32;

export declare function pos(codes: number[]): string;
export declare function compare(itemA: {
position: string;
}, itemB: {
position: string;
}): number;
export declare function compare(posA: string, posB: string): number;

@@ -91,5 +91,5 @@ export const min = 32;

}
export function compare(itemA, itemB) {
const aCodes = posCodes(itemA.position);
const bCodes = posCodes(itemB.position);
export function compare(posA, posB) {
const aCodes = posCodes(posA);
const bCodes = posCodes(posB);
const maxLength = Math.max(aCodes.length, bCodes.length);

@@ -106,3 +106,3 @@ for (let i = 0; i < maxLength; i++) {

}
throw new Error(`Impossible to compare similar position "${itemA.position}" and "${itemB.position}"`);
throw new Error(`Impossible to compare similar position "${posA}" and "${posB}"`);
}

@@ -542,3 +542,3 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {

const throttleDelay = options.throttle || 100;
const liveblocksServer = options.liveblocksServer || "wss://liveblocks.net/v2";
const liveblocksServer = options.liveblocksServer || "wss://liveblocks.net/v3";
let authEndpoint;

@@ -549,3 +549,4 @@ if (options.authEndpoint) {

else {
const publicAuthorizeEndpoint = options.publicAuthorizeEndpoint || "https://liveblocks.io/api/public/authorize";
const publicAuthorizeEndpoint = options.publicAuthorizeEndpoint ||
"https://liveblocks.io/api/public/authorize";
authEndpoint = publicAuthorizeEndpoint;

@@ -559,3 +560,3 @@ }

room: name,
publicApiKey: options.publicApiKey
publicApiKey: options.publicApiKey,
});

@@ -562,0 +563,0 @@ const room = {

{
"name": "@liveblocks/client",
"version": "0.12.0-beta.9",
"version": "0.12.0-beta.10",
"description": "",

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc