@liveblocks/node
Advanced tools
Comparing version 2.0.0 to 2.0.2
@@ -68,6 +68,10 @@ import { BaseUserMeta, DU, PlainLsonObject, JsonObject, QueryMetadata, ThreadData, CommentData, CommentBody, Patchable, CommentUserReaction, InboxNotificationData, RoomNotificationSettings, ActivityData, LsonObject, ToImmutable, BaseMetadata, DE, DM, DS } from '@liveblocks/core'; | ||
}; | ||
declare type CreateSessionOptions<U extends BaseUserMeta = DU> = { | ||
declare type CreateSessionOptions<U extends BaseUserMeta = DU> = Record<string, never> extends U["info"] ? { | ||
userInfo?: U["info"]; | ||
} : { | ||
userInfo: U["info"]; | ||
}; | ||
declare type IdentifyUserOptions<U extends BaseUserMeta = DU> = { | ||
declare type IdentifyUserOptions<U extends BaseUserMeta = DU> = Record<string, never> extends U["info"] ? { | ||
userInfo?: U["info"]; | ||
} : { | ||
userInfo: U["info"]; | ||
@@ -159,3 +163,3 @@ }; | ||
*/ | ||
prepareSession(userId: string, options?: CreateSessionOptions<U>): Session; | ||
prepareSession(userId: string, ...rest: Record<string, never> extends CreateSessionOptions<U> ? [options?: CreateSessionOptions<U>] : [options: CreateSessionOptions<U>]): Session; | ||
/** | ||
@@ -193,3 +197,3 @@ * Call this to authenticate the user as an actor you want to allow to use | ||
*/ | ||
identifyUser(identity: string | Identity, options?: IdentifyUserOptions<U>): Promise<AuthResponse>; | ||
identifyUser(identity: string | Identity, ...rest: Record<string, never> extends IdentifyUserOptions<U> ? [options?: IdentifyUserOptions<U>] : [options: IdentifyUserOptions<U>]): Promise<AuthResponse>; | ||
/** | ||
@@ -559,2 +563,11 @@ * 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. | ||
/** | ||
* Deletes a thread and all of its comments. | ||
* @param params.roomId The room ID to delete the thread in. | ||
* @param params.threadId The thread ID to delete. | ||
*/ | ||
deleteThread(params: { | ||
roomId: string; | ||
threadId: string; | ||
}): Promise<void>; | ||
/** | ||
* Updates the metadata of the specified thread in a room. | ||
@@ -732,3 +745,3 @@ * @param params.roomId The room ID to update the thread in. | ||
}; | ||
declare type WebhookEvent = StorageUpdatedEvent | UserEnteredEvent | UserLeftEvent | RoomCreatedEvent | RoomDeletedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved | ThreadMetadataUpdatedEvent | NotificationEvent | ThreadCreatedEvent | YDocUpdatedEvent; | ||
declare type WebhookEvent = StorageUpdatedEvent | UserEnteredEvent | UserLeftEvent | RoomCreatedEvent | RoomDeletedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved | ThreadMetadataUpdatedEvent | NotificationEvent | ThreadCreatedEvent | ThreadDeletedEvent | YDocUpdatedEvent; | ||
declare type StorageUpdatedEvent = { | ||
@@ -919,2 +932,15 @@ type: "storageUpdated"; | ||
}; | ||
declare type ThreadDeletedEvent = { | ||
type: "threadDeleted"; | ||
data: { | ||
projectId: string; | ||
roomId: string; | ||
threadId: string; | ||
/** | ||
* ISO 8601 datestring | ||
* @example "2021-03-01T12:00:00.000Z" | ||
*/ | ||
deletedAt: string; | ||
}; | ||
}; | ||
declare type ThreadNotificationEvent = { | ||
@@ -921,0 +947,0 @@ type: "notification"; |
@@ -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"; | ||
var PKG_VERSION = "2.0.2"; | ||
var PKG_FORMAT = "cjs"; | ||
@@ -296,3 +296,4 @@ | ||
*/ | ||
prepareSession(userId, options) { | ||
prepareSession(userId, ...rest) { | ||
const options = rest[0]; | ||
return new Session(this.post.bind(this), userId, _optionalChain([options, 'optionalAccess', _ => _.userInfo])); | ||
@@ -333,3 +334,4 @@ } | ||
// These fields define the security identity of the user. Whatever you pass in here will define which | ||
async identifyUser(identity, options) { | ||
async identifyUser(identity, ...rest) { | ||
const options = rest[0]; | ||
const path = url`/v2/identify-user`; | ||
@@ -935,2 +937,15 @@ const userId = typeof identity === "string" ? identity : identity.userId; | ||
/** | ||
* Deletes a thread and all of its comments. | ||
* @param params.roomId The room ID to delete the thread in. | ||
* @param params.threadId The thread ID to delete. | ||
*/ | ||
async deleteThread(params) { | ||
const { roomId, threadId } = params; | ||
const res = await this.delete(url`/v2/rooms/${roomId}/threads/${threadId}`); | ||
if (!res.ok) { | ||
const text = await res.text(); | ||
throw new LiveblocksError(res.status, text); | ||
} | ||
} | ||
/** | ||
* Updates the metadata of the specified thread in a room. | ||
@@ -1219,2 +1234,3 @@ * @param params.roomId The room ID to update the thread in. | ||
"threadCreated", | ||
"threadDeleted", | ||
"ydocUpdated", | ||
@@ -1221,0 +1237,0 @@ "notification" |
{ | ||
"name": "@liveblocks/node", | ||
"version": "2.0.0", | ||
"version": "2.0.2", | ||
"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", | ||
"@liveblocks/core": "2.0.2", | ||
"@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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
376400
3509
+ Added@liveblocks/core@2.0.2(transitive)
- Removed@liveblocks/core@2.0.0(transitive)
Updated@liveblocks/core@2.0.2