Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@liveblocks/node

Package Overview
Dependencies
Maintainers
5
Versions
326
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.8.0-beta3 to 2.8.0-beta4

140

dist/index.js

@@ -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.8.0-beta3";
var PKG_VERSION = "2.8.0-beta4";
var PKG_FORMAT = "cjs";

@@ -19,2 +19,7 @@

// src/Session.ts
// src/utils.ts

@@ -58,23 +63,2 @@ var DEFAULT_BASE_URL = "https://api.liveblocks.io";

}
function toURLSearchParams(params) {
const result = new URLSearchParams();
for (const [key, value] of Object.entries(params)) {
if (value !== void 0 && value !== null) {
result.set(key, value.toString());
}
}
return result;
}
function urljoin(baseUrl, path, params) {
const url2 = new URL(path, baseUrl);
if (params !== void 0) {
url2.search = (params instanceof URLSearchParams ? params : toURLSearchParams(params)).toString();
}
return url2.toString();
}
function url(strings, ...values) {
return strings.reduce(
(result, str, i) => result + encodeURIComponent(_nullishCoalesce(values[i - 1], () => ( ""))) + str
);
}

@@ -187,3 +171,3 @@ // src/Session.ts

try {
const resp = await this._postFn(url`/v2/authorize-user`, {
const resp = await this._postFn(_core.url`/v2/authorize-user`, {
// Required

@@ -223,3 +207,3 @@ userId: this._userId,

async post(path, json) {
const url2 = urljoin(this._baseUrl, path);
const url3 = _core.urljoin.call(void 0, this._baseUrl, path);
const headers = {

@@ -230,3 +214,3 @@ Authorization: `Bearer ${this._secret}`,

const fetch = await fetchPolyfill();
const res = await fetch(url2, {
const res = await fetch(url3, {
method: "POST",

@@ -240,3 +224,3 @@ headers,

async put(path, json) {
const url2 = urljoin(this._baseUrl, path);
const url3 = _core.urljoin.call(void 0, this._baseUrl, path);
const headers = {

@@ -247,3 +231,3 @@ Authorization: `Bearer ${this._secret}`,

const fetch = await fetchPolyfill();
return await fetch(url2, {
return await fetch(url3, {
method: "PUT",

@@ -256,3 +240,3 @@ headers,

async putBinary(path, body, params) {
const url2 = urljoin(this._baseUrl, path, params);
const url3 = _core.urljoin.call(void 0, this._baseUrl, path, params);
const headers = {

@@ -263,7 +247,7 @@ Authorization: `Bearer ${this._secret}`,

const fetch = await fetchPolyfill();
return await fetch(url2, { method: "PUT", headers, body });
return await fetch(url3, { method: "PUT", headers, body });
}
/** @internal */
async delete(path) {
const url2 = urljoin(this._baseUrl, path);
const url3 = _core.urljoin.call(void 0, this._baseUrl, path);
const headers = {

@@ -273,3 +257,3 @@ Authorization: `Bearer ${this._secret}`

const fetch = await fetchPolyfill();
const res = await fetch(url2, { method: "DELETE", headers });
const res = await fetch(url3, { method: "DELETE", headers });
return res;

@@ -279,3 +263,3 @@ }

async get(path, params) {
const url2 = urljoin(this._baseUrl, path, params);
const url3 = _core.urljoin.call(void 0, this._baseUrl, path, params);
const headers = {

@@ -285,3 +269,3 @@ Authorization: `Bearer ${this._secret}`

const fetch = await fetchPolyfill();
const res = await fetch(url2, { method: "GET", headers });
const res = await fetch(url3, { method: "GET", headers });
return res;

@@ -347,3 +331,3 @@ }

const options = rest[0];
const path = url`/v2/identify-user`;
const path = _core.url`/v2/identify-user`;
const userId = typeof identity === "string" ? identity : identity.userId;

@@ -366,3 +350,3 @@ const groupIds = typeof identity === "string" ? void 0 : identity.groupIds;

status: 503,
body: `Call to ${urljoin(
body: `Call to ${_core.urljoin.call(void 0,
this._baseUrl,

@@ -389,3 +373,3 @@ path

async getRooms(params = {}) {
const path = url`/v2/rooms`;
const path = _core.url`/v2/rooms`;
let query;

@@ -442,3 +426,3 @@ if (typeof params.query === "string") {

const { defaultAccesses, groupsAccesses, usersAccesses, metadata } = params;
const res = await this.post(url`/v2/rooms`, {
const res = await this.post(_core.url`/v2/rooms`, {
id: roomId,

@@ -469,3 +453,3 @@ defaultAccesses,

async getRoom(roomId) {
const res = await this.get(url`/v2/rooms/${roomId}`);
const res = await this.get(_core.url`/v2/rooms/${roomId}`);
if (!res.ok) {

@@ -496,3 +480,3 @@ const text = await res.text();

const { defaultAccesses, groupsAccesses, usersAccesses, metadata } = params;
const res = await this.post(url`/v2/rooms/${roomId}`, {
const res = await this.post(_core.url`/v2/rooms/${roomId}`, {
defaultAccesses,

@@ -521,3 +505,3 @@ groupsAccesses,

async deleteRoom(roomId) {
const res = await this.delete(url`/v2/rooms/${roomId}`);
const res = await this.delete(_core.url`/v2/rooms/${roomId}`);
if (!res.ok) {

@@ -534,3 +518,3 @@ const text = await res.text();

async getActiveUsers(roomId) {
const res = await this.get(url`/v2/rooms/${roomId}/active_users`);
const res = await this.get(_core.url`/v2/rooms/${roomId}/active_users`);
if (!res.ok) {

@@ -549,3 +533,3 @@ const text = await res.text();

const res = await this.post(
url`/v2/rooms/${roomId}/broadcast_event`,
_core.url`/v2/rooms/${roomId}/broadcast_event`,
message

@@ -559,3 +543,3 @@ );

async getStorageDocument(roomId, format = "plain-lson") {
const res = await this.get(url`/v2/rooms/${roomId}/storage`, { format });
const res = await this.get(_core.url`/v2/rooms/${roomId}/storage`, { format });
if (!res.ok) {

@@ -576,3 +560,3 @@ const text = await res.text();

async initializeStorageDocument(roomId, document) {
const res = await this.post(url`/v2/rooms/${roomId}/storage`, document);
const res = await this.post(_core.url`/v2/rooms/${roomId}/storage`, document);
if (!res.ok) {

@@ -589,3 +573,3 @@ const text = await res.text();

async deleteStorageDocument(roomId) {
const res = await this.delete(url`/v2/rooms/${roomId}/storage`);
const res = await this.delete(_core.url`/v2/rooms/${roomId}/storage`);
if (!res.ok) {

@@ -609,3 +593,3 @@ const text = await res.text();

const { format, key, type } = params;
const path = url`v2/rooms/${roomId}/ydoc`;
const path = _core.url`v2/rooms/${roomId}/ydoc`;
const res = await this.get(path, {

@@ -629,3 +613,3 @@ formatting: format ? "true" : void 0,

async sendYjsBinaryUpdate(roomId, update, params = {}) {
const res = await this.putBinary(url`/v2/rooms/${roomId}/ydoc`, update, {
const res = await this.putBinary(_core.url`/v2/rooms/${roomId}/ydoc`, update, {
guid: params.guid

@@ -646,3 +630,3 @@ });

async getYjsDocumentAsBinaryUpdate(roomId, params = {}) {
const res = await this.get(url`/v2/rooms/${roomId}/ydoc-binary`, {
const res = await this.get(_core.url`/v2/rooms/${roomId}/ydoc-binary`, {
guid: params.guid

@@ -666,3 +650,3 @@ });

async createSchema(name, body) {
const res = await this.post(url`/v2/schemas`, {
const res = await this.post(_core.url`/v2/schemas`, {
name,

@@ -690,3 +674,3 @@ body

async getSchema(schemaId) {
const res = await this.get(url`/v2/schemas/${schemaId}`);
const res = await this.get(_core.url`/v2/schemas/${schemaId}`);
if (!res.ok) {

@@ -712,3 +696,3 @@ const text = await res.text();

async updateSchema(schemaId, body) {
const res = await this.put(url`/v2/schemas/${schemaId}`, {
const res = await this.put(_core.url`/v2/schemas/${schemaId}`, {
body

@@ -734,3 +718,3 @@ });

async deleteSchema(schemaId) {
const res = await this.delete(url`/v2/schemas/${schemaId}`);
const res = await this.delete(_core.url`/v2/schemas/${schemaId}`);
if (!res.ok) {

@@ -747,3 +731,3 @@ const text = await res.text();

async getSchemaByRoomId(roomId) {
const res = await this.get(url`/v2/rooms/${roomId}/schema`);
const res = await this.get(_core.url`/v2/rooms/${roomId}/schema`);
if (!res.ok) {

@@ -770,3 +754,3 @@ const text = await res.text();

async attachSchemaToRoom(roomId, schemaId) {
const res = await this.post(url`/v2/rooms/${roomId}/schema`, {
const res = await this.post(_core.url`/v2/rooms/${roomId}/schema`, {
schema: schemaId

@@ -785,3 +769,3 @@ });

async detachSchemaFromRoom(roomId) {
const res = await this.delete(url`/v2/rooms/${roomId}/schema`);
const res = await this.delete(_core.url`/v2/rooms/${roomId}/schema`);
if (!res.ok) {

@@ -810,3 +794,3 @@ const text = await res.text();

}
const res = await this.get(url`/v2/rooms/${roomId}/threads`, {
const res = await this.get(_core.url`/v2/rooms/${roomId}/threads`, {
query

@@ -832,3 +816,3 @@ });

const { roomId, threadId } = params;
const res = await this.get(url`/v2/rooms/${roomId}/threads/${threadId}`);
const res = await this.get(_core.url`/v2/rooms/${roomId}/threads/${threadId}`);
if (!res.ok) {

@@ -853,3 +837,3 @@ const text = await res.text();

const res = await this.get(
url`/v2/rooms/${roomId}/threads/${threadId}/participants`
_core.url`/v2/rooms/${roomId}/threads/${threadId}/participants`
);

@@ -873,3 +857,3 @@ if (!res.ok) {

const res = await this.get(
url`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}`
_core.url`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}`
);

@@ -895,3 +879,3 @@ if (!res.ok) {

const res = await this.post(
url`/v2/rooms/${roomId}/threads/${threadId}/comments`,
_core.url`/v2/rooms/${roomId}/threads/${threadId}/comments`,
{

@@ -920,3 +904,3 @@ ...data,

const res = await this.post(
url`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}`,
_core.url`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}`,
{

@@ -942,3 +926,3 @@ ...data,

const res = await this.delete(
url`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}`
_core.url`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}`
);

@@ -962,3 +946,3 @@ if (!res.ok) {

const { roomId, data } = params;
const res = await this.post(url`/v2/rooms/${roomId}/threads`, {
const res = await this.post(_core.url`/v2/rooms/${roomId}/threads`, {
...data,

@@ -983,3 +967,3 @@ comment: {

const { roomId, threadId } = params;
const res = await this.delete(url`/v2/rooms/${roomId}/threads/${threadId}`);
const res = await this.delete(_core.url`/v2/rooms/${roomId}/threads/${threadId}`);
if (!res.ok) {

@@ -1000,3 +984,3 @@ const text = await res.text();

const res = await this.post(
url`/v2/rooms/${roomId}/threads/${threadId}/mark-as-resolved`,
_core.url`/v2/rooms/${roomId}/threads/${threadId}/mark-as-resolved`,
{}

@@ -1020,3 +1004,3 @@ );

const res = await this.post(
url`/v2/rooms/${roomId}/threads/${threadId}/mark-as-unresolved`,
_core.url`/v2/rooms/${roomId}/threads/${threadId}/mark-as-unresolved`,
{}

@@ -1042,3 +1026,3 @@ );

const res = await this.post(
url`/v2/rooms/${roomId}/threads/${threadId}/metadata`,
_core.url`/v2/rooms/${roomId}/threads/${threadId}/metadata`,
{

@@ -1068,3 +1052,3 @@ ...data,

const res = await this.post(
url`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}/add-reaction`,
_core.url`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}/add-reaction`,
{

@@ -1094,3 +1078,3 @@ ...data,

const res = await this.post(
url`/v2/rooms/${roomId}/threads/${threadId}/comments/${params.commentId}/remove-reaction`,
_core.url`/v2/rooms/${roomId}/threads/${threadId}/comments/${params.commentId}/remove-reaction`,
{

@@ -1114,3 +1098,3 @@ ...data,

const res = await this.get(
url`/v2/users/${userId}/inbox-notifications/${inboxNotificationId}`
_core.url`/v2/users/${userId}/inbox-notifications/${inboxNotificationId}`
);

@@ -1138,3 +1122,3 @@ if (!res.ok) {

}
const res = await this.get(url`/v2/users/${userId}/inbox-notifications`, {
const res = await this.get(_core.url`/v2/users/${userId}/inbox-notifications`, {
query

@@ -1159,3 +1143,3 @@ });

const res = await this.get(
url`/v2/rooms/${roomId}/users/${userId}/notification-settings`
_core.url`/v2/rooms/${roomId}/users/${userId}/notification-settings`
);

@@ -1177,3 +1161,3 @@ if (!res.ok) {

const res = await this.post(
url`/v2/rooms/${roomId}/users/${userId}/notification-settings`,
_core.url`/v2/rooms/${roomId}/users/${userId}/notification-settings`,
data

@@ -1195,3 +1179,3 @@ );

const res = await this.delete(
url`/v2/rooms/${roomId}/users/${userId}/notification-settings`
_core.url`/v2/rooms/${roomId}/users/${userId}/notification-settings`
);

@@ -1211,3 +1195,3 @@ if (!res.ok) {

const res = await this.post(
url`/v2/rooms/${currentRoomId}/update-room-id`,
_core.url`/v2/rooms/${currentRoomId}/update-room-id`,
{

@@ -1229,3 +1213,3 @@ newRoomId

async triggerInboxNotification(params) {
const res = await this.post(url`/v2/inbox-notifications/trigger`, params);
const res = await this.post(_core.url`/v2/inbox-notifications/trigger`, params);
if (!res.ok) {

@@ -1244,3 +1228,3 @@ const text = await res.text();

const res = await this.delete(
url`/v2/users/${userId}/inbox-notifications/${inboxNotificationId}`
_core.url`/v2/users/${userId}/inbox-notifications/${inboxNotificationId}`
);

@@ -1258,3 +1242,3 @@ if (!res.ok) {

const { userId } = params;
const res = await this.delete(url`/v2/users/${userId}/inbox-notifications`);
const res = await this.delete(_core.url`/v2/users/${userId}/inbox-notifications`);
if (!res.ok) {

@@ -1261,0 +1245,0 @@ const text = await res.text();

{
"name": "@liveblocks/node",
"version": "2.8.0-beta3",
"version": "2.8.0-beta4",
"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.8.0-beta3",
"@liveblocks/core": "2.8.0-beta4",
"@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

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