New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@liveblocks/node

Package Overview
Dependencies
Maintainers
5
Versions
363
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@liveblocks/node - npm Package Compare versions

Comparing version 2.0.0-alpha1 to 2.0.0-alpha2

126

dist/index.d.ts

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

import { IUserInfo, Json, PlainLsonObject, JsonObject, BaseMetadata, DM, QueryMetadata, ThreadData, CommentData, CommentBody, CommentUserReaction, InboxNotificationData, RoomNotificationSettings, ActivityData } from '@liveblocks/core';
import { BaseUserMeta, PlainLsonObject, JsonObject, QueryMetadata, ThreadData, CommentData, CommentBody, Patchable, CommentUserReaction, InboxNotificationData, RoomNotificationSettings, ActivityData, LsonObject, ToImmutable, DU, BaseMetadata, DE, DM, DS } from '@liveblocks/core';
export { CommentBody, CommentBodyBlockElement, CommentBodyElement, CommentBodyInlineElement, CommentBodyLink, CommentBodyLinkElementArgs, CommentBodyMention, CommentBodyMentionElementArgs, CommentBodyParagraph, CommentBodyParagraphElementArgs, CommentBodyText, CommentBodyTextElementArgs, CommentData, CommentUserReaction, IUserInfo, Json, JsonArray, JsonObject, JsonScalar, Lson, LsonObject, PlainLsonObject, ResolveUsersArgs, StringifyCommentBodyElements, StringifyCommentBodyOptions, ThreadData, User, getMentionedIdsFromCommentBody, stringifyCommentBody } from '@liveblocks/core';

@@ -60,2 +60,3 @@ import { IncomingHttpHeaders } from 'http';

declare type ToSimplifiedJson<S extends LsonObject> = LsonObject extends S ? JsonObject : ToImmutable<S>;
declare type LiveblocksOptions = {

@@ -68,7 +69,7 @@ /**

};
declare type Nullable<T> = {
[P in keyof T]: T[P] | null;
declare type CreateSessionOptions<U extends BaseUserMeta = DU> = {
userInfo: U["info"];
};
declare type CreateSessionOptions = {
userInfo: IUserInfo;
declare type IdentifyUserOptions<U extends BaseUserMeta = DU> = {
userInfo: U["info"];
};

@@ -87,2 +88,16 @@ declare type AuthResponse = {

};
declare type CreateThreadOptions<M extends BaseMetadata> = {
roomId: string;
data: {
comment: {
userId: string;
createdAt?: Date;
body: CommentBody;
};
} & (Record<string, never> extends M ? {
metadata?: M;
} : {
metadata: M;
});
};
declare type RoomPermission = [] | ["room:write"] | ["room:read", "room:presence:write"];

@@ -94,3 +109,3 @@ declare type RoomAccesses = Record<string, [

declare type QueryRoomMetadata = Record<string, string>;
declare type RoomInfo = {
declare type RoomData = {
type: "room";

@@ -105,7 +120,7 @@ id: string;

};
declare type RoomUser<Info> = {
declare type RoomUser<U extends BaseUserMeta> = {
type: "user";
id: string | null;
connectionId: number;
info: Info;
info: U["info"];
};

@@ -120,2 +135,6 @@ declare type Schema = {

};
declare type E = DE;
declare type M = DM;
declare type S = DS;
declare type U = DU;
/**

@@ -145,3 +164,3 @@ * Interact with the Liveblocks API from your Node.js backend.

*/
prepareSession(userId: string, options?: CreateSessionOptions): Session;
prepareSession(userId: string, options?: CreateSessionOptions<U>): Session;
/**

@@ -179,5 +198,3 @@ * Call this to authenticate the user as an actor you want to allow to use

*/
identifyUser(identity: string | Identity, options?: {
userInfo: IUserInfo;
}): Promise<AuthResponse>;
identifyUser(identity: string | Identity, options?: IdentifyUserOptions<U>): Promise<AuthResponse>;
/**

@@ -234,3 +251,3 @@ * Returns a list of your rooms. The rooms are returned sorted by creation date, from newest to oldest. You can filter rooms by metadata, users accesses and groups accesses.

nextCursor: string | null;
data: RoomInfo[];
data: RoomData[];
}>;

@@ -251,3 +268,3 @@ /**

metadata?: RoomMetadata;
}): Promise<RoomInfo>;
}): Promise<RoomData>;
/**

@@ -258,3 +275,3 @@ * Returns a room with the given id.

*/
getRoom(roomId: string): Promise<RoomInfo>;
getRoom(roomId: string): Promise<RoomData>;
/**

@@ -279,3 +296,3 @@ * Updates specific properties of a room. It’s not necessary to provide the entire room’s information.

metadata?: Record<string, string | string[] | null>;
}): Promise<RoomInfo>;
}): Promise<RoomData>;
/**

@@ -291,4 +308,4 @@ * Deletes a room with the given id. A deleted room is no longer accessible from the API or the dashboard and it cannot be restored.

*/
getActiveUsers<T = unknown>(roomId: string): Promise<{
data: RoomUser<T>[];
getActiveUsers(roomId: string): Promise<{
data: RoomUser<U>[];
}>;

@@ -300,3 +317,3 @@ /**

*/
broadcastEvent(roomId: string, message: Json): Promise<void>;
broadcastEvent(roomId: string, message: E): Promise<void>;
/**

@@ -322,3 +339,3 @@ * Returns the contents of the room’s Storage tree.

getStorageDocument(roomId: string): Promise<PlainLsonObject>;
getStorageDocument(roomId: string, format: "json"): Promise<JsonObject>;
getStorageDocument(roomId: string, format: "json"): Promise<ToSimplifiedJson<S>>;
/**

@@ -423,3 +440,3 @@ * Initializes a room’s Storage. The room must already exist and have an empty Storage.

*/
getThreads<M extends BaseMetadata = DM>(params: {
getThreads(params: {
roomId: string;

@@ -464,3 +481,3 @@ /**

*/
getThread<M extends BaseMetadata = DM>(params: {
getThread(params: {
roomId: string;

@@ -554,13 +571,3 @@ threadId: string;

*/
createThread<M extends BaseMetadata = DM>(params: {
roomId: string;
data: {
metadata?: [M] extends [never] ? Record<string, never> : M;
comment: {
userId: string;
createdAt?: Date;
body: CommentBody;
};
};
}): Promise<ThreadData<M>>;
createThread(params: CreateThreadOptions<M>): Promise<ThreadData<M>>;
/**

@@ -575,7 +582,7 @@ * Updates the metadata of the specified thread in a room.

*/
editThreadMetadata<M extends BaseMetadata = DM>(params: {
editThreadMetadata(params: {
roomId: string;
threadId: string;
data: {
metadata: Nullable<BaseMetadata>;
metadata: Patchable<M>;
userId: string;

@@ -670,3 +677,3 @@ updatedAt?: Date;

newRoomId: string;
}): Promise<RoomInfo>;
}): Promise<RoomData>;
triggerInboxNotification(params: {

@@ -927,3 +934,3 @@ userId: string;

};
declare type NotificationEvent = {
declare type ThreadNotificationEvent = {
type: "notification";

@@ -945,3 +952,46 @@ data: {

};
declare type TextMentionNotificationEvent = {
type: "notification";
data: {
channel: "email";
kind: "textMention";
projectId: string;
roomId: string;
userId: string;
mentionId: string;
inboxNotificationId: string;
/**
* ISO 8601 datestring
* @example "2021-03-01T12:00:00.000Z"
*/
createdAt: string;
};
};
declare type CustomKind = `$${string}`;
declare type CustomNotificationEvent = {
type: "notification";
data: {
channel: "email";
kind: CustomKind;
projectId: string;
roomId: string | null;
userId: string;
subjectId: string;
inboxNotificationId: string;
/**
* ISO 8601 datestring
* @example "2021-03-01T12:00:00.000Z"
*/
createdAt: string;
};
};
declare type NotificationEvent = ThreadNotificationEvent | TextMentionNotificationEvent | CustomNotificationEvent;
export { type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, Liveblocks, LiveblocksError, type LiveblocksOptions, type NotificationEvent, type RoomAccesses, type RoomCreatedEvent, type RoomDeletedEvent, type RoomInfo, type RoomPermission, type RoomUser, type Schema, type StorageUpdatedEvent, type ThreadCreatedEvent, type ThreadMetadataUpdatedEvent, type ThreadParticipants, type UserEnteredEvent, type UserLeftEvent, type WebhookEvent, WebhookHandler, type WebhookRequest };
/**
* @deprecated RoomInfo was renamed to RoomData, to avoid
* confusion with the globally augmentable RoomInfo type. This
* alias will be removed in a future version.
*/
declare type RoomInfo = RoomData;
export { type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, Liveblocks, LiveblocksError, type LiveblocksOptions, type NotificationEvent, type RoomAccesses, type RoomCreatedEvent, type RoomData, type RoomDeletedEvent, type RoomInfo, type RoomPermission, type RoomUser, type Schema, type StorageUpdatedEvent, type ThreadCreatedEvent, type ThreadMetadataUpdatedEvent, type ThreadParticipants, type UserEnteredEvent, type UserLeftEvent, type WebhookEvent, WebhookHandler, type WebhookRequest };

@@ -6,3 +6,3 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/index.ts

var PKG_NAME = "@liveblocks/node";
var PKG_VERSION = "2.0.0-alpha1";
var PKG_VERSION = "2.0.0-alpha2";
var PKG_FORMAT = "cjs";

@@ -1117,6 +1117,4 @@

constructor(secret) {
if (!secret)
throw new Error("Secret is required");
if (typeof secret !== "string")
throw new Error("Secret must be a string");
if (!secret) throw new Error("Secret is required");
if (typeof secret !== "string") throw new Error("Secret must be a string");
if (secret.startsWith(_WebhookHandler.secretPrefix) === false)

@@ -1221,4 +1219,15 @@ throw new Error("Invalid secret, must start with whsec_");

"notification"
].includes(event.type))
].includes(event.type)) {
if (event.type === "notification") {
const notification = event;
if (notification.data.kind === "thread" || notification.data.kind === "textMention" || notification.data.kind.startsWith("$")) {
return;
} else {
throw new Error(
`Unknown notification kind: ${notification.data.kind}`
);
}
}
return;
}
throw new Error(

@@ -1225,0 +1234,0 @@ "Unknown event type, please upgrade to a higher version of @liveblocks/node"

{
"name": "@liveblocks/node",
"version": "2.0.0-alpha1",
"version": "2.0.0-alpha2",
"description": "A server-side utility that lets you set up a Liveblocks authentication endpoint. Liveblocks is the all-in-one toolkit to build collaborative products like Figma, Notion, and more.",

@@ -37,3 +37,3 @@ "license": "Apache-2.0",

"dependencies": {
"@liveblocks/core": "2.0.0-alpha1",
"@liveblocks/core": "2.0.0-alpha2",
"@stablelib/base64": "^1.0.1",

@@ -40,0 +40,0 @@ "fast-sha256": "^1.3.0",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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