import { BaseUserMeta, DU, OptionalTupleUnless, PlainLsonObject, JsonObject, QueryMetadata, ThreadData, CommentData, CommentBody, Patchable, CommentUserReaction, InboxNotificationData, RoomNotificationSettings, KDAD, DAD, LsonObject, ToImmutable, PartialUnless, 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'; import { IncomingHttpHeaders } from 'http'; declare const ALL_PERMISSIONS: readonly ["room:write", "room:read", "room:presence:write", "comments:write", "comments:read"]; declare type Permission = (typeof ALL_PERMISSIONS)[number]; /** * Class to help you construct the exact permission set to grant a user, used * when making `.authorizeUser()` calls. * * Usage: * * const session = liveblocks.prepareSession(); * session.allow(roomId, permissions) // or... * * For the `permissions` argument, you can pass a list of specific permissions, * or use one of our presets: * * session.allow('my-room', session.FULL_ACCESS) // Read + write access to room storage and comments * session.allow('my-room', session.READ_ACCESS) // Read-only access to room storage and comments * * Rooms can be specified with a prefix match, if the name ends in an asterisk. * In that case, access is granted to *all* rooms that start with that prefix: * * // Read + write access to *all* rooms that start with "abc:" * session.allow('abc:*', session.FULL_ACCESS) * * You can define at most 10 room IDs (or patterns) in a single token, * otherwise the token would become too large and unwieldy. * * All permissions granted are additive. You cannot "remove" permissions once * you grant them. For example: * * session * .allow('abc:*', session.FULL_ACCESS) * .allow('abc:123', session.READ_ACCESS) * * Here, room `abc:123` would have full access. The second .allow() call only * _adds_ read permissions, but that has no effect since full access * permissions were already added to the set. */ declare class Session { readonly FULL_ACCESS: readonly ["room:write", "comments:write"]; readonly READ_ACCESS: readonly ["room:read", "room:presence:write", "comments:read"]; allow(roomIdOrPattern: string, newPerms: readonly Permission[]): this; /** * Call this to authorize the session to access Liveblocks. Note that this * will return a Liveblocks "access token". Anyone that obtains such access * token will have access to the allowed resources. */ authorize(): Promise; } /** * NOTE: only types should be imported from @liveblocks/core. * This is because this package is made to be used in Node.js, and * @liveblocks/core has browser-specific code. */ declare type ToSimplifiedJson = LsonObject extends S ? JsonObject : ToImmutable; declare type LiveblocksOptions = { /** * The Liveblocks secret key. Must start with "sk_". * Get it from https://liveblocks.io/dashboard/apikeys */ secret: string; }; declare type CreateSessionOptions = PartialUnless; declare type IdentifyUserOptions = PartialUnless; declare type AuthResponse = { status: number; body: string; error?: Error; }; declare type Identity = { userId: string; groupIds: string[]; }; declare type ThreadParticipants = { participantIds: string[]; }; declare type CreateThreadOptions = { roomId: string; data: { comment: { userId: string; createdAt?: Date; body: CommentBody; }; } & PartialUnless; }; declare type RoomPermission = [] | ["room:write"] | ["room:read", "room:presence:write"]; declare type RoomAccesses = Record; declare type RoomMetadata = Record; declare type QueryRoomMetadata = Record; declare type RoomData = { type: "room"; id: string; createdAt: Date; lastConnectionAt?: Date; defaultAccesses: RoomPermission; usersAccesses: RoomAccesses; groupsAccesses: RoomAccesses; metadata: RoomMetadata; }; declare type RoomUser = { type: "user"; id: string | null; connectionId: number; info: U["info"]; }; declare type Schema = { id: string; name: string; version: number; body: string; createdAt: Date; updatedAt: Date; }; declare type E = DE; declare type M = DM; declare type S = DS; declare type U = DU; /** * Interact with the Liveblocks API from your Node.js backend. */ declare class Liveblocks { /** * Interact with the Liveblocks API from your Node.js backend. */ constructor(options: LiveblocksOptions); /** * Prepares a new session to authorize a user to access Liveblocks. * * IMPORTANT: * Always make sure that you trust the user making the request to your * backend before calling .prepareSession()! * * @param userId Tell Liveblocks the user ID of the user to authorize. Must * uniquely identify the user account in your system. The uniqueness of this * value will determine how many MAUs will be counted/billed. * * @param options.userInfo Custom metadata to attach to this user. Data you * add here will be visible to all other clients in the room, through the * `other.info` property. * */ prepareSession(userId: string, ...rest: OptionalTupleUnless, [ options: CreateSessionOptions ]>): Session; /** * Call this to authenticate the user as an actor you want to allow to use * Liveblocks. * * You should use this method only if you want to manage your permissions * through the Liveblocks Permissions API. This method is more complicated to * set up, but allows for finer-grained specification of permissions. * * Calling `.identifyUser()` only lets you securely identify a user (and what * groups they belong to). What permissions this user will end up having is * determined by whatever permissions you assign the user/group in your * Liveblocks account, through the Permissions API: * https://liveblocks.io/docs/rooms/permissions * * IMPORTANT: * Always verify that you trust the user making the request before calling * .identifyUser()! * * @param identity Tell Liveblocks the user ID of the user to authenticate. * Must uniquely identify the user account in your system. The uniqueness of * this value will determine how many MAUs will be counted/billed. * * If you also want to assign which groups this user belongs to, use the * object form and specify the `groupIds` property. Those `groupIds` should * match the groupIds you assigned permissions to via the Liveblocks * Permissions API, see * https://liveblocks.io/docs/rooms/permissions#permissions-levels-groups-accesses-example * * @param options.userInfo Custom metadata to attach to this user. Data you * add here will be visible to all other clients in the room, through the * `other.info` property. */ identifyUser(identity: string | Identity, ...rest: OptionalTupleUnless, [ options: IdentifyUserOptions ]>): Promise; /** * 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. * @param params.limit (optional) A limit on the number of rooms to be returned. The limit can range between 1 and 100, and defaults to 20. * @param params.startingAfter (optional) A cursor used for pagination. You get the value from the response of the previous page. * @param params.userId (optional) A filter on users accesses. * @param params.metadata (optional) A filter on metadata. Multiple metadata keys can be used to filter rooms. * @param params.groupIds (optional) A filter on groups accesses. Multiple groups can be used. * @param params.query (optional) A query to filter rooms by. It is based on our query language. You can filter by metadata and room ID. * @returns A list of rooms. */ getRooms(params?: { limit?: number; startingAfter?: string; /** * @deprecated Use `query` property instead. Support for the `metadata` * field will be removed in a future version. */ metadata?: QueryRoomMetadata; userId?: string; groupIds?: string[]; /** * The query to filter rooms by. It is based on our query language. * @example * ``` * { * query: 'metadata["status"]:"open" AND roomId^"liveblocks:"' * } * ``` * @example * ``` * { * query: { * metadata: { * status: "open", * }, * roomId: { * startsWith: "liveblocks:" * } * } * } * ``` */ query?: string | { metadata?: QueryRoomMetadata; roomId?: { startsWith: string; }; }; }): Promise<{ nextPage: string | null; nextCursor: string | null; data: RoomData[]; }>; /** * Creates a new room with the given id. * @param roomId The id of the room to create. * @param params.defaultAccesses The default accesses for the room. * @param params.groupsAccesses (optional) The group accesses for the room. Can contain a maximum of 100 entries. Key length has a limit of 40 characters. * @param params.usersAccesses (optional) The user accesses for the room. Can contain a maximum of 100 entries. Key length has a limit of 40 characters. * @param params.metadata (optional) The metadata for the room. Supports upto a maximum of 50 entries. Key length has a limit of 40 characters. Value length has a limit of 256 characters. * @returns The created room. */ createRoom(roomId: string, params: { defaultAccesses: RoomPermission; groupsAccesses?: RoomAccesses; usersAccesses?: RoomAccesses; metadata?: RoomMetadata; }): Promise; /** * Returns a room with the given id. * @param roomId The id of the room to return. * @returns The room with the given id. */ getRoom(roomId: string): Promise; /** * Updates specific properties of a room. It’s not necessary to provide the entire room’s information. * Setting a property to `null` means to delete this property. * @param roomId The id of the room to update. * @param params.defaultAccesses (optional) The default accesses for the room. * @param params.groupsAccesses (optional) The group accesses for the room. Can contain a maximum of 100 entries. Key length has a limit of 40 characters. * @param params.usersAccesses (optional) The user accesses for the room. Can contain a maximum of 100 entries. Key length has a limit of 40 characters. * @param params.metadata (optional) The metadata for the room. Supports upto a maximum of 50 entries. Key length has a limit of 40 characters. Value length has a limit of 256 characters. * @returns The updated room. */ updateRoom(roomId: string, params: { defaultAccesses?: RoomPermission | null; groupsAccesses?: Record; usersAccesses?: Record; metadata?: Record; }): Promise; /** * 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. * @param roomId The id of the room to delete. */ deleteRoom(roomId: string): Promise; /** * Returns a list of users currently present in the requested room. For better performance, we recommand to call this endpoint every 10 seconds maximum. Duplicates can happen if a user is in the requested room with multiple browser tabs opened. * @param roomId The id of the room to get the users from. * @returns A list of users currently present in the requested room. */ getActiveUsers(roomId: string): Promise<{ data: RoomUser[]; }>; /** * Boadcasts an event to a room without having to connect to it via the client from @liveblocks/client. The connectionId passed to event listeners is -1 when using this API. * @param roomId The id of the room to broadcast the event to. * @param message The message to broadcast. It can be any JSON serializable value. */ broadcastEvent(roomId: string, message: E): Promise; /** * Returns the contents of the room’s Storage tree. * The default outputted format is called “plain LSON”, which includes information on the Live data structures in the tree. * These nodes show up in the output as objects with two properties: * * ```json * { * "liveblocksType": "LiveObject", * "data": ... * } * ``` * * If you’re not interested in this information, you can use the `format` parameter to get a more compact output. * * @param roomId The id of the room to get the storage from. * @param format (optional) Set to return `plan-lson` representation by default. If set to `json`, the output will be formatted as a simplified JSON representation of the Storage tree. * In that format, each LiveObject and LiveMap will be formatted as a simple JSON object, and each LiveList will be formatted as a simple JSON array. This is a lossy format because information about the original data structures is not retained, but it may be easier to work with. */ getStorageDocument(roomId: string, format: "plain-lson"): Promise; getStorageDocument(roomId: string): Promise; getStorageDocument(roomId: string, format: "json"): Promise>; /** * Initializes a room’s Storage. The room must already exist and have an empty Storage. * Calling this endpoint will disconnect all users from the room if there are any. * * @param roomId The id of the room to initialize the storage from. * @param document The document to initialize the storage with. * @returns The initialized storage document. It is of the same format as the one passed in. */ initializeStorageDocument(roomId: string, document: PlainLsonObject): Promise; /** * Deletes all of the room’s Storage data and disconnect all users from the room if there are any. Note that this does not delete the Yjs document in the room if one exists. * @param roomId The id of the room to delete the storage from. */ deleteStorageDocument(roomId: string): Promise; /** * Returns a JSON representation of the room’s Yjs document. * @param roomId The id of the room to get the Yjs document from. * @param params.format (optional) If true, YText will return formatting. * @param params.key (optional) If provided, returns only a single key’s value, e.g. doc.get(key).toJSON(). * @param params.type (optional) Used with key to override the inferred type, i.e. "ymap" will return doc.get(key, Y.Map). * @returns A JSON representation of the room’s Yjs document. */ getYjsDocument(roomId: string, params?: { format?: boolean; key?: string; type?: string; }): Promise; /** * Send a Yjs binary update to the room’s Yjs document. You can use this endpoint to initialize Yjs data for the room or to update the room’s Yjs document. * @param roomId The id of the room to send the Yjs binary update to. * @param update The Yjs update to send. Typically the result of calling `Yjs.encodeStateAsUpdate(doc)`. Read the [Yjs documentation](https://docs.yjs.dev/api/document-updates) to learn how to create a binary update. * @param params.guid (optional) If provided, the binary update will be applied to the Yjs subdocument with the given guid. If not provided, the binary update will be applied to the root Yjs document. */ sendYjsBinaryUpdate(roomId: string, update: Uint8Array, params?: { guid?: string; }): Promise; /** * Returns the room’s Yjs document encoded as a single binary update. This can be used by Y.applyUpdate(responseBody) to get a copy of the document in your backend. * See [Yjs documentation](https://docs.yjs.dev/api/document-updates) for more information on working with updates. * @param roomId The id of the room to get the Yjs document from. * @param params.guid (optional) If provided, returns the binary update of the Yjs subdocument with the given guid. If not provided, returns the binary update of the root Yjs document. * @returns The room’s Yjs document encoded as a single binary update. */ getYjsDocumentAsBinaryUpdate(roomId: string, params?: { guid?: string; }): Promise; /** * Creates a new schema which can be referenced later to enforce a room’s Storage data structure. * @param name The name used to reference the schema. Must be a non-empty string with less than 65 characters and only contain lowercase letters, numbers and dashes * @param body The exact allowed shape of data in the room. It is a multi-line string written in the [Liveblocks schema syntax](https://liveblocks.io/docs/platform/schema-validation/syntax). * @returns The created schema. */ createSchema(name: string, body: string): Promise; /** * Returns a schema by its id. * @param schemaId Id of the schema - this is the combination of the schema name and version of the schema to update. For example, `my-schema@1`. * @returns The schema with the given id. */ getSchema(schemaId: string): Promise; /** * Updates the body for the schema. A schema can only be updated if it is not used by any room. * @param schemaId Id of the schema - this is the combination of the schema name and version of the schema to update. For example, `my-schema@1`. * @param body The exact allowed shape of data in the room. It is a multi-line string written in the [Liveblocks schema syntax](https://liveblocks.io/docs/platform/schema-validation/syntax). * @returns The updated schema. The version of the schema will be incremented. */ updateSchema(schemaId: string, body: string): Promise; /** * Deletes a schema by its id. A schema can only be deleted if it is not used by any room. * @param schemaId Id of the schema - this is the combination of the schema name and version of the schema to update. For example, `my-schema@1`. */ deleteSchema(schemaId: string): Promise; /** * Returns the schema attached to a room. * @param roomId The id of the room to get the schema from. * @returns */ getSchemaByRoomId(roomId: string): Promise; /** * Attaches a schema to a room, and instantly enables runtime schema validation for the room. * If the current contents of the room’s Storage do not match the schema, attaching will fail and the error message will give details on why the schema failed to attach. * @param roomId The id of the room to attach the schema to. * @param schemaId Id of the schema - this is the combination of the schema name and version of the schema to update. For example, `my-schema@1`. * @returns The schema id as JSON. */ attachSchemaToRoom(roomId: string, schemaId: string): Promise<{ schema: string; }>; /** * Detaches a schema from a room, and disables runtime schema validation for the room. * @param roomId The id of the room to detach the schema from. */ detachSchemaFromRoom(roomId: string): Promise; /** * Gets all the threads in a room. * * @param params.roomId The room ID to get the threads from. * @param params.query The query to filter threads by. It is based on our query language and can filter by metadata. * @returns A list of threads. */ getThreads(params: { roomId: string; /** * The query to filter threads by. It is based on our query language. * * @example * ``` * { * query: "metadata['organization']^'liveblocks:' AND metadata['status']:'open' AND metadata['pinned']:false AND metadata['priority']:3 AND resolved:true" * } * ``` * @example * ``` * { * query: { * metadata: { * status: "open", * pinned: false, * priority: 3, * organization: { * startsWith: "liveblocks:" * } * }, * resolved: true * } * } * ``` */ query?: string | { metadata?: Partial>; resolved?: boolean; }; }): Promise<{ data: ThreadData[]; }>; /** * Gets a thread. * * @param params.roomId The room ID to get the thread from. * @param params.threadId The thread ID. * @returns A thread. */ getThread(params: { roomId: string; threadId: string; }): Promise>; /** * Gets a thread's participants. * * Participants are users who have commented on the thread * or users and groups that have been mentioned in a comment. * * @param params.roomId The room ID to get the thread participants from. * @param params.threadId The thread ID to get the participants from. * @returns An object containing an array of participant IDs. */ getThreadParticipants(params: { roomId: string; threadId: string; }): Promise; /** * Gets a thread's comment. * * @param params.roomId The room ID to get the comment from. * @param params.threadId The thread ID to get the comment from. * @param params.commentId The comment ID. * @returns A comment. */ getComment(params: { roomId: string; threadId: string; commentId: string; }): Promise; /** * Creates a comment. * * @param params.roomId The room ID to create the comment in. * @param params.threadId The thread ID to create the comment in. * @param params.data.userId The user ID of the user who is set to create the comment. * @param params.data.createdAt (optional) The date the comment is set to be created. * @param params.data.body The body of the comment. * @returns The created comment. */ createComment(params: { roomId: string; threadId: string; data: { userId: string; createdAt?: Date; body: CommentBody; }; }): Promise; /** * Edits a comment. * @param params.roomId The room ID to edit the comment in. * @param params.threadId The thread ID to edit the comment in. * @param params.commentId The comment ID to edit. * @param params.data.body The body of the comment. * @param params.data.editedAt (optional) The date the comment was edited. * @returns The edited comment. */ editComment(params: { roomId: string; threadId: string; commentId: string; data: { body: CommentBody; editedAt?: Date; }; }): Promise; /** * Deletes a comment. Deletes a comment. If there are no remaining comments in the thread, the thread is also deleted. * @param params.roomId The room ID to delete the comment in. * @param params.threadId The thread ID to delete the comment in. * @param params.commentId The comment ID to delete. */ deleteComment(params: { roomId: string; threadId: string; commentId: string; }): Promise; /** * Creates a new thread. The thread will be created with the specified comment as its first comment. * If the thread already exists, a `LiveblocksError` will be thrown with status code 409. * @param params.roomId The room ID to create the thread in. * @param params.thread.metadata (optional) The metadata for the thread. Supports upto a maximum of 10 entries. Value must be a string, boolean or number * @param params.thread.comment.userId The user ID of the user who created the comment. * @param params.thread.comment.createdAt (optional) The date the comment was created. * @param params.thread.comment.body The body of the comment. * @returns The created thread. The thread will be created with the specified comment as its first comment. */ createThread(params: CreateThreadOptions): Promise>; /** * 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; /** * Mark a thread as resolved. * @param params.roomId The room ID of the thread. * @param params.threadId The thread ID to mark as resolved. * @param params.data.userId The user ID of the user who marked the thread as resolved. * @returns The thread marked as resolved. */ markThreadAsResolved(params: { roomId: string; threadId: string; data: { userId: string; }; }): Promise>; /** * Mark a thread as unresolved. * @param params.roomId The room ID of the thread. * @param params.threadId The thread ID to mark as unresolved. * @param params.data.userId The user ID of the user who marked the thread as unresolved. * @returns The thread marked as unresolved. */ markThreadAsUnresolved(params: { roomId: string; threadId: string; data: { userId: string; }; }): Promise>; /** * Updates the metadata of the specified thread in a room. * @param params.roomId The room ID to update the thread in. * @param params.threadId The thread ID to update. * @param params.data.metadata The metadata for the thread. Value must be a string, boolean or number * @param params.data.userId The user ID of the user who updated the thread. * @param params.data.updatedAt (optional) The date the thread is set to be updated. * @returns The updated thread metadata. */ editThreadMetadata(params: { roomId: string; threadId: string; data: { metadata: Patchable; userId: string; updatedAt?: Date; }; }): Promise; /** * Adds a new comment reaction to a comment. * @param params.roomId The room ID to add the comment reaction in. * @param params.threadId The thread ID to add the comment reaction in. * @param params.commentId The comment ID to add the reaction in. * @param params.data.emoji The (emoji) reaction to add. * @param params.data.userId The user ID of the user associated with the reaction. * @param params.data.createdAt (optional) The date the reaction is set to be created. * @returns The created comment reaction. */ addCommentReaction(params: { roomId: string; threadId: string; commentId: string; data: { emoji: string; userId: string; createdAt?: Date; }; }): Promise; /** * Removes a reaction from a comment. * @param params.roomId The room ID to remove the comment reaction from. * @param params.threadId The thread ID to remove the comment reaction from. * @param params.commentId The comment ID to remove the reaction from. * @param params.data.emoji The (emoji) reaction to remove. * @param params.data.userId The user ID of the user associated with the reaction. * @param params.data.removedAt (optional) The date the reaction is set to be removed. */ removeCommentReaction(params: { roomId: string; threadId: string; commentId: string; data: { emoji: string; userId: string; removedAt?: Date; }; }): Promise; /** * Returns the inbox notifications for a user. * @param params.userId The user ID to get the inbox notifications from. * @param params.inboxNotificationId The ID of the inbox notification to get. */ getInboxNotification(params: { userId: string; inboxNotificationId: string; }): Promise; /** * Returns the inbox notifications for a user. * @param params.userId The user ID to get the inbox notifications from. * @param params.query The query to filter inbox notifications by. It is based on our query language and can filter by unread. */ getInboxNotifications(params: { userId: string; /** * The query to filter inbox notifications by. It is based on our query language. * * @example * ``` * { * query: "unread:true" * } * ``` * * @example * ``` * { * query: { * unread: true * } * } * ``` * */ query?: string | { unread: boolean; }; }): Promise<{ data: InboxNotificationData[]; }>; /** * Gets the user's room notification settings. * @param params.userId The user ID to get the room notifications from. * @param params.roomId The room ID to get the room notification settings from. */ getRoomNotificationSettings(params: { userId: string; roomId: string; }): Promise; /** * Updates the user's room notification settings. * @param params.userId The user ID to update the room notification settings for. * @param params.roomId The room ID to update the room notification settings for. * @param params.data The new room notification settings for the user. */ updateRoomNotificationSettings(params: { userId: string; roomId: string; data: RoomNotificationSettings; }): Promise; /** * Delete the user's room notification settings. * @param params.userId The user ID to delete the room notification settings from. * @param params.roomId The room ID to delete the room notification settings from. */ deleteRoomNotificationSettings(params: { userId: string; roomId: string; }): Promise; /** * Update a room ID. * @param params.roomId The current ID of the room. * @param params.newRoomId The new room ID. */ updateRoomId(params: { currentRoomId: string; newRoomId: string; }): Promise; triggerInboxNotification(params: { userId: string; kind: K; roomId?: string; subjectId: string; activityData: DAD[K]; }): Promise; /** * Deletes an inbox notification for a user. * @param params.userId The user ID for which to delete the inbox notification. * @param params.inboxNotificationId The ID of the inbox notification to delete. */ deleteInboxNotification(params: { userId: string; inboxNotificationId: string; }): Promise; /** * Deletes all inbox notifications for a user. * @param params.userId The user ID for which to delete all the inbox notifications. */ deleteAllInboxNotifications(params: { userId: string; }): Promise; } declare class LiveblocksError extends Error { status: number; constructor(status: number, message?: string); } declare class WebhookHandler { private secretBuffer; private static secretPrefix; constructor( /** * The signing secret provided on the dashboard's webhooks page * @example "whsec_wPbvQ+u3VtN2e2tRPDKchQ1tBZ3svaHLm" */ secret: string); /** * Verifies a webhook request and returns the event */ verifyRequest(request: WebhookRequest): WebhookEvent; /** * Verifies the headers and returns the webhookId, timestamp and rawSignatures */ private verifyHeaders; /** * Signs the content with the secret * @param content * @returns `string` */ private sign; /** * Verifies that the timestamp is not too old or in the future */ private verifyTimestamp; /** * Ensures that the event is a known event type * or throws and prompts the user to upgrade to a higher version of @liveblocks/node */ private verifyWebhookEventType; } declare type WebhookRequest = { /** * Headers of the request, can be a regular object or a Headers object * @example * { * "webhook-id": "123", * "webhook-timestamp": "1614588800000", * "webhook-signature": "v1,bm9ldHUjKzFob2VudXRob2VodWUzMjRvdWVvdW9ldQo= v2,MzJsNDk4MzI0K2VvdSMjMTEjQEBAQDEyMzMzMzEyMwo=" * } * * new Headers({ * "webhook-id": "123", * "webhook-timestamp": "1614588800000", * "webhook-signature": "v1,bm9ldHUjKzFob2VudXRob2VodWUzMjRvdWVvdW9ldQo= v2,MzJsNDk4MzI0K2VvdSMjMTEjQEBAQDEyMzMzMzEyMwo=" * }} */ headers: IncomingHttpHeaders | Headers; /** * Raw body of the request, do not parse it * @example '{"type":"storageUpdated","data":{"roomId":"my-room-id","appId":"my-app-id","updatedAt":"2021-03-01T12:00:00.000Z"}}' */ rawBody: string; }; declare type WebhookEvent = StorageUpdatedEvent | UserEnteredEvent | UserLeftEvent | RoomCreatedEvent | RoomDeletedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved | ThreadMetadataUpdatedEvent | NotificationEvent | ThreadCreatedEvent | ThreadDeletedEvent | ThreadMarkedAsResolvedEvent | ThreadMarkedAsUnresolvedEvent | YDocUpdatedEvent; declare type StorageUpdatedEvent = { type: "storageUpdated"; data: { roomId: string; projectId: string; /** * ISO 8601 datestring * @example "2021-03-01T12:00:00.000Z" */ updatedAt: string; }; }; declare type UserEnteredEvent = { type: "userEntered"; data: { projectId: string; roomId: string; connectionId: number; userId: string | null; userInfo: Record | null; /** * ISO 8601 datestring * @example "2021-03-01T12:00:00.000Z" * @description The time when the user entered the room. */ enteredAt: string; numActiveUsers: number; }; }; declare type UserLeftEvent = { type: "userLeft"; data: { projectId: string; roomId: string; connectionId: number; userId: string | null; userInfo: Record | null; /** * ISO 8601 datestring * @example "2021-03-01T12:00:00.000Z" * @description The time when the user left the room. */ leftAt: string; numActiveUsers: number; }; }; declare type RoomCreatedEvent = { type: "roomCreated"; data: { projectId: string; roomId: string; /** * ISO 8601 datestring * @example "2021-03-01T12:00:00.000Z" */ createdAt: string; }; }; declare type RoomDeletedEvent = { type: "roomDeleted"; data: { projectId: string; roomId: string; /** * ISO 8601 datestring * @example "2021-03-01T12:00:00.000Z" */ deletedAt: string; }; }; declare type CommentCreatedEvent = { type: "commentCreated"; data: { projectId: string; roomId: string; threadId: string; commentId: string; /** * ISO 8601 datestring * @example "2021-03-01T12:00:00.000Z" */ createdAt: string; createdBy: string; }; }; declare type CommentEditedEvent = { type: "commentEdited"; data: { projectId: string; roomId: string; threadId: string; commentId: string; /** * ISO 8601 datestring * @example "2021-03-01T12:00:00.000Z" */ editedAt: string; }; }; declare type CommentDeletedEvent = { type: "commentDeleted"; data: { projectId: string; roomId: string; threadId: string; commentId: string; /** * ISO 8601 datestring * @example "2021-03-01T12:00:00.000Z" */ deletedAt: string; }; }; declare type CommentReactionAdded = { type: "commentReactionAdded"; data: { projectId: string; roomId: string; threadId: string; commentId: string; emoji: string; /** * ISO 8601 datestring * @example "2021-03-01T12:00:00.000Z" */ addedAt: string; addedBy: string; }; }; declare type CommentReactionRemoved = { type: "commentReactionRemoved"; data: { projectId: string; roomId: string; threadId: string; commentId: string; emoji: string; /** * ISO 8601 datestring * @example "2021-03-01T12:00:00.000Z" */ removedAt: string; removedBy: string; }; }; declare type YDocUpdatedEvent = { type: "ydocUpdated"; data: { projectId: string; roomId: string; /** * ISO 8601 datestring * @example "2021-03-01T12:00:00.000Z" */ updatedAt: string; }; }; declare type ThreadMetadataUpdatedEvent = { type: "threadMetadataUpdated"; data: { projectId: string; roomId: string; threadId: string; updatedAt: string; /** * ISO 8601 datestring * @example "2021-03-01T12:00:00.000Z" */ updatedBy: string; }; }; declare type ThreadCreatedEvent = { type: "threadCreated"; data: { projectId: string; roomId: string; threadId: string; /** * ISO 8601 datestring * @example "2021-03-01T12:00:00.000Z" */ createdAt: string; createdBy: string; }; }; 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 ThreadMarkedAsResolvedEvent = { type: "threadMarkedAsResolved"; data: { projectId: string; roomId: string; threadId: string; updatedAt: string; /** * ISO 8601 datestring * @example "2021-03-01T12:00:00.000Z" */ updatedBy: string; }; }; declare type ThreadMarkedAsUnresolvedEvent = { type: "threadMarkedAsUnresolved"; data: { projectId: string; roomId: string; threadId: string; updatedAt: string; /** * ISO 8601 datestring * @example "2021-03-01T12:00:00.000Z" */ updatedBy: string; }; }; declare type ThreadNotificationEvent = { type: "notification"; data: { channel: "email"; kind: "thread"; projectId: string; roomId: string; userId: string; threadId: string; inboxNotificationId: string; /** * ISO 8601 datestring * @example "2021-03-01T12:00:00.000Z" */ createdAt: string; }; }; 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; /** * Type guard to check if a webhook event is a `ThreadNotificationEvent` * * The check is made against the event type and event data kind. * You should use this guard to safely check the webhook event you received * when you're expecting a `ThreadNotificationEvent`. * * @param event The webhook event received after calling `webhookHandler.verifyRequest()`. * @returns A boolean type predicate. */ declare function isThreadNotificationEvent(event: WebhookEvent): event is ThreadNotificationEvent; /** * Type guard to check if a webhook event is a `TextMentionNotificationEvent` * * The check is made against the event type and event data kind. * You should use this guard to safely check the webhook event you received * when you're expecting a `TextMentionNotificationEvent`. * * @param event The webhook event received after calling `webhookHandler.verifyRequest()`. * @returns A boolean type predicate. */ declare function isTextMentionNotificationEvent(event: WebhookEvent): event is TextMentionNotificationEvent; /** * @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, type CustomNotificationEvent, 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 TextMentionNotificationEvent, type ThreadCreatedEvent, type ThreadDeletedEvent, type ThreadMarkedAsResolvedEvent, type ThreadMarkedAsUnresolvedEvent, type ThreadMetadataUpdatedEvent, type ThreadNotificationEvent, type ThreadParticipants, type UserEnteredEvent, type UserLeftEvent, type WebhookEvent, WebhookHandler, type WebhookRequest, type YDocUpdatedEvent, isTextMentionNotificationEvent, isThreadNotificationEvent };