Socket
Socket
Sign inDemoInstall

@liveblocks/client

Package Overview
Dependencies
Maintainers
3
Versions
379
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.14.0-beta.1 to 0.14.0

2

lib/cjs/index.d.ts
export { LiveObject } from "./LiveObject";
export { LiveMap } from "./LiveMap";
export { LiveList } from "./LiveList";
export type { Others, Presence, Room, Client, User } from "./types";
export type { Others, Presence, Room, Client, User, BroadcastOptions, } from "./types";
export { createClient } from "./client";

@@ -71,2 +71,3 @@ import { AbstractCrdt, Doc, ApplyResult } from "./AbstractCrdt";

delete(index: number): void;
clear(): void;
/**

@@ -73,0 +74,0 @@ * Returns an Array of all the elements in the LiveList.

@@ -286,2 +286,24 @@ "use strict";

}
clear() {
if (this._doc) {
let ops = [];
let reverseOps = [];
for (const item of __classPrivateFieldGet(this, _LiveList_items, "f")) {
item[0]._detach();
const childId = item[0]._id;
if (childId) {
ops.push({ id: childId, type: live_1.OpType.DeleteCrdt });
reverseOps.push(...item[0]._serialize(this._id, item[1]));
}
}
__classPrivateFieldSet(this, _LiveList_items, [], "f");
this._doc.dispatch(ops, reverseOps, [this]);
}
else {
for (const item of __classPrivateFieldGet(this, _LiveList_items, "f")) {
item[0]._detach();
}
__classPrivateFieldSet(this, _LiveList_items, [], "f");
}
}
/**

@@ -288,0 +310,0 @@ * Returns an Array of all the elements in the LiveList.

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

import { Others, Presence, ClientOptions, Room, MyPresenceCallback, OthersEventCallback, AuthEndpoint, EventCallback, User, Connection, ErrorCallback, AuthenticationToken, ConnectionCallback, StorageCallback, StorageUpdate } from "./types";
import { Others, Presence, ClientOptions, Room, MyPresenceCallback, OthersEventCallback, AuthEndpoint, EventCallback, User, Connection, ErrorCallback, AuthenticationToken, ConnectionCallback, StorageCallback, StorageUpdate, BroadcastOptions } from "./types";
import { ClientMessage, Op } from "./live";

@@ -129,3 +129,3 @@ import { LiveMap } from "./LiveMap";

} | undefined) => void;
broadcastEvent: (event: any) => void;
broadcastEvent: (event: any, options?: BroadcastOptions) => void;
batch: (callback: () => void) => void;

@@ -132,0 +132,0 @@ undo: () => void;

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

},
[Symbol.iterator]() {
return array[Symbol.iterator]();
},
map(callback) {

@@ -479,3 +482,5 @@ return array.map(callback);

function authenticationFailure(error) {
console.error(error);
if (process.env.NODE_ENV !== "production") {
console.error("Call to authentication endpoint failed", error);
}
updateConnection({ state: "unavailable" });

@@ -647,3 +652,5 @@ state.numberOfRetry++;

for (const listener of state.listeners.error) {
console.error(`Liveblocks WebSocket connection closed. Reason: ${error.message} (code: ${error.code})`);
if (process.env.NODE_ENV !== "production") {
console.error(`Connection to Liveblocks websocket server closed. Reason: ${error.message} (code: ${error.code})`);
}
listener(error);

@@ -653,5 +660,9 @@ }

else if (event.wasClean === false) {
state.numberOfRetry++;
const delay = getRetryDelay();
if (process.env.NODE_ENV !== "production") {
console.warn(`Connection to Liveblocks websocket server closed (code: ${event.code}). Retrying in ${delay}ms.`);
}
updateConnection({ state: "unavailable" });
state.numberOfRetry++;
state.timeoutHandles.reconnect = effects.scheduleReconnect(getRetryDelay());
state.timeoutHandles.reconnect = effects.scheduleReconnect(delay);
}

@@ -820,4 +831,6 @@ else {

}
function broadcastEvent(event) {
if (state.socket == null) {
function broadcastEvent(event, options = {
shouldQueueEventIfNotReady: false,
}) {
if (state.socket == null && options.shouldQueueEventIfNotReady == false) {
return;

@@ -824,0 +837,0 @@ }

@@ -31,2 +31,10 @@ import type { LiveList } from "./LiveList";

};
export declare type BroadcastOptions = {
/**
* Whether or not event is queued if the connection is currently closed.
*
* ❗ We are not sure if we want to support this option in the future so it might be deprecated to be replaced by something else
*/
shouldQueueEventIfNotReady: boolean;
};
export declare type StorageUpdate = LiveMapUpdates | LiveObjectUpdates | LiveListUpdates;

@@ -70,2 +78,6 @@ export declare type StorageCallback = (updates: StorageUpdate[]) => void;

/**
* Returns a new Iterator object that contains the users.
*/
[Symbol.iterator](): IterableIterator<User<TPresence>>;
/**
* Returns the array of connected users in room.

@@ -428,3 +440,3 @@ */

*/
broadcastEvent: (event: any) => void;
broadcastEvent: (event: any, options?: BroadcastOptions) => void;
/**

@@ -431,0 +443,0 @@ * Get the room's storage asynchronously.

export { LiveObject } from "./LiveObject";
export { LiveMap } from "./LiveMap";
export { LiveList } from "./LiveList";
export type { Others, Presence, Room, Client, User } from "./types";
export type { Others, Presence, Room, Client, User, BroadcastOptions, } from "./types";
export { createClient } from "./client";

@@ -71,2 +71,3 @@ import { AbstractCrdt, Doc, ApplyResult } from "./AbstractCrdt";

delete(index: number): void;
clear(): void;
/**

@@ -73,0 +74,0 @@ * Returns an Array of all the elements in the LiveList.

@@ -283,2 +283,24 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {

}
clear() {
if (this._doc) {
let ops = [];
let reverseOps = [];
for (const item of __classPrivateFieldGet(this, _LiveList_items, "f")) {
item[0]._detach();
const childId = item[0]._id;
if (childId) {
ops.push({ id: childId, type: OpType.DeleteCrdt });
reverseOps.push(...item[0]._serialize(this._id, item[1]));
}
}
__classPrivateFieldSet(this, _LiveList_items, [], "f");
this._doc.dispatch(ops, reverseOps, [this]);
}
else {
for (const item of __classPrivateFieldGet(this, _LiveList_items, "f")) {
item[0]._detach();
}
__classPrivateFieldSet(this, _LiveList_items, [], "f");
}
}
/**

@@ -285,0 +307,0 @@ * Returns an Array of all the elements in the LiveList.

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

import { Others, Presence, ClientOptions, Room, MyPresenceCallback, OthersEventCallback, AuthEndpoint, EventCallback, User, Connection, ErrorCallback, AuthenticationToken, ConnectionCallback, StorageCallback, StorageUpdate } from "./types";
import { Others, Presence, ClientOptions, Room, MyPresenceCallback, OthersEventCallback, AuthEndpoint, EventCallback, User, Connection, ErrorCallback, AuthenticationToken, ConnectionCallback, StorageCallback, StorageUpdate, BroadcastOptions } from "./types";
import { ClientMessage, Op } from "./live";

@@ -129,3 +129,3 @@ import { LiveMap } from "./LiveMap";

} | undefined) => void;
broadcastEvent: (event: any) => void;
broadcastEvent: (event: any, options?: BroadcastOptions) => void;
batch: (callback: () => void) => void;

@@ -132,0 +132,0 @@ undo: () => void;

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

},
[Symbol.iterator]() {
return array[Symbol.iterator]();
},
map(callback) {

@@ -457,3 +460,5 @@ return array.map(callback);

function authenticationFailure(error) {
console.error(error);
if (process.env.NODE_ENV !== "production") {
console.error("Call to authentication endpoint failed", error);
}
updateConnection({ state: "unavailable" });

@@ -625,3 +630,5 @@ state.numberOfRetry++;

for (const listener of state.listeners.error) {
console.error(`Liveblocks WebSocket connection closed. Reason: ${error.message} (code: ${error.code})`);
if (process.env.NODE_ENV !== "production") {
console.error(`Connection to Liveblocks websocket server closed. Reason: ${error.message} (code: ${error.code})`);
}
listener(error);

@@ -631,5 +638,9 @@ }

else if (event.wasClean === false) {
state.numberOfRetry++;
const delay = getRetryDelay();
if (process.env.NODE_ENV !== "production") {
console.warn(`Connection to Liveblocks websocket server closed (code: ${event.code}). Retrying in ${delay}ms.`);
}
updateConnection({ state: "unavailable" });
state.numberOfRetry++;
state.timeoutHandles.reconnect = effects.scheduleReconnect(getRetryDelay());
state.timeoutHandles.reconnect = effects.scheduleReconnect(delay);
}

@@ -798,4 +809,6 @@ else {

}
function broadcastEvent(event) {
if (state.socket == null) {
function broadcastEvent(event, options = {
shouldQueueEventIfNotReady: false,
}) {
if (state.socket == null && options.shouldQueueEventIfNotReady == false) {
return;

@@ -802,0 +815,0 @@ }

@@ -31,2 +31,10 @@ import type { LiveList } from "./LiveList";

};
export declare type BroadcastOptions = {
/**
* Whether or not event is queued if the connection is currently closed.
*
* ❗ We are not sure if we want to support this option in the future so it might be deprecated to be replaced by something else
*/
shouldQueueEventIfNotReady: boolean;
};
export declare type StorageUpdate = LiveMapUpdates | LiveObjectUpdates | LiveListUpdates;

@@ -70,2 +78,6 @@ export declare type StorageCallback = (updates: StorageUpdate[]) => void;

/**
* Returns a new Iterator object that contains the users.
*/
[Symbol.iterator](): IterableIterator<User<TPresence>>;
/**
* Returns the array of connected users in room.

@@ -428,3 +440,3 @@ */

*/
broadcastEvent: (event: any) => void;
broadcastEvent: (event: any, options?: BroadcastOptions) => void;
/**

@@ -431,0 +443,0 @@ * Get the room's storage asynchronously.

{
"name": "@liveblocks/client",
"version": "0.14.0-beta.1",
"version": "0.14.0",
"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