@liveblocks/node 3.22.0-file1 → 3.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +86 -16
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +55 -10
- package/dist/index.d.ts +55 -10
- package/dist/index.js +86 -16
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Permission, Json, DFMD, FeedCreateMetadata, RoomPermissions, RoomAccesses, OptionalTupleUnless, BaseUserMeta, DU, PartialUnless, UpdateRoomAccesses, DE, JsonObject, PlainLsonObject, ToJson, DS, QueryMetadata, DTM, ThreadVisibility, ThreadData, DCM, UserSubscriptionData, CommentData, BaseMetadata, CommentBody, Patchable,
|
|
1
|
+
import { Permission, Json, DFMD, FeedCreateMetadata, RoomPermissions, RoomAccesses, OptionalTupleUnless, BaseUserMeta, DU, PartialUnless, UpdateRoomAccesses, DE, JsonObject, PlainLsonObject, ToJson, DS, QueryMetadata, DTM, ThreadVisibility, ThreadData, DCM, UserSubscriptionData, CommentData, BaseMetadata, CommentBody, Patchable, SubscriptionData, CommentUserReaction, InboxNotificationData, UserRoomSubscriptionSettings, RoomSubscriptionSettings, KDAD, DAD, NotificationSettings, PartialNotificationSettings, GroupScopes, GroupData, LiveObject, Awaitable, DFM, Feed, FeedUpdateMetadata, FeedMessage, NotificationChannel } from '@liveblocks/core';
|
|
2
2
|
export { CommentBody, CommentBodyBlockElement, CommentBodyElement, CommentBodyInlineElement, CommentBodyLink, CommentBodyLinkElementArgs, CommentBodyMention, CommentBodyMentionElementArgs, CommentBodyParagraph, CommentBodyParagraphElementArgs, CommentBodyText, CommentBodyTextElementArgs, CommentData, CommentUserReaction, IUserInfo, Json, JsonArray, JsonObject, JsonScalar, LiveList, LiveMap, LiveObject, LiveStructure, Lson, LsonObject, PlainLsonObject, ResolveUsersArgs, RoomAccesses, RoomPermissions, StringifyCommentBodyElements, StringifyCommentBodyOptions, ThreadData, User, getMentionsFromCommentBody, isNotificationChannelEnabled, stringifyCommentBody } from '@liveblocks/core';
|
|
3
3
|
import { IncomingHttpHeaders } from 'http';
|
|
4
4
|
|
|
@@ -102,10 +102,6 @@ type AttachmentWithUrl = {
|
|
|
102
102
|
url: string;
|
|
103
103
|
expiresAt: string;
|
|
104
104
|
};
|
|
105
|
-
type StorageFileWithUrl = LiveFileData & {
|
|
106
|
-
url: string;
|
|
107
|
-
expiresAt: string;
|
|
108
|
-
};
|
|
109
105
|
type CreateThreadOptions<TM extends BaseMetadata, CM extends BaseMetadata> = {
|
|
110
106
|
roomId: string;
|
|
111
107
|
data: {
|
|
@@ -315,6 +311,22 @@ type Page<T> = {
|
|
|
315
311
|
nextCursor: string | null;
|
|
316
312
|
data: T[];
|
|
317
313
|
};
|
|
314
|
+
type HistoryVersion = {
|
|
315
|
+
id: string;
|
|
316
|
+
createdAt: Date;
|
|
317
|
+
authors: {
|
|
318
|
+
id: string;
|
|
319
|
+
}[];
|
|
320
|
+
};
|
|
321
|
+
type GetVersionHistoryOptions = {
|
|
322
|
+
limit?: number;
|
|
323
|
+
cursor?: string;
|
|
324
|
+
};
|
|
325
|
+
type CreateVersionHistorySnapshotResponse = {
|
|
326
|
+
data: {
|
|
327
|
+
id: string;
|
|
328
|
+
};
|
|
329
|
+
};
|
|
318
330
|
type GetRoomsOptions = RoomsQueryCriteria & PaginationOptions;
|
|
319
331
|
type GetInboxNotificationsOptions = InboxNotificationsQueryCriteria & PaginationOptions;
|
|
320
332
|
type CreateRoomOptions = {
|
|
@@ -765,6 +777,43 @@ declare class Liveblocks {
|
|
|
765
777
|
getYjsDocumentAsBinaryUpdate(roomId: string, params?: {
|
|
766
778
|
guid?: string;
|
|
767
779
|
}, options?: RequestOptions): Promise<ArrayBuffer>;
|
|
780
|
+
/**
|
|
781
|
+
* Returns the version history snapshots for the room, sorted by creation date from newest to oldest.
|
|
782
|
+
* @param roomId The ID of the room to get the version history from.
|
|
783
|
+
* @param params.limit (optional) The number of versions to return. The limit can range between 1 and 100, and defaults to 20.
|
|
784
|
+
* @param params.cursor (optional) A cursor used for pagination. Get the value from the `nextCursor` response of the previous page.
|
|
785
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
786
|
+
* @returns A list of version history snapshots and the next page cursor.
|
|
787
|
+
*/
|
|
788
|
+
getVersionHistory(roomId: string, params?: GetVersionHistoryOptions, options?: RequestOptions): Promise<Page<HistoryVersion>>;
|
|
789
|
+
/**
|
|
790
|
+
* Creates a new version history snapshot of the room, capturing both its Storage and Yjs documents.
|
|
791
|
+
* @param roomId The ID of the room to create a version history snapshot for.
|
|
792
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
793
|
+
* @returns The created version ID.
|
|
794
|
+
*/
|
|
795
|
+
createVersionHistorySnapshot(roomId: string, options?: RequestOptions): Promise<CreateVersionHistorySnapshotResponse>;
|
|
796
|
+
/**
|
|
797
|
+
* Returns a specific version of the room's Yjs document encoded as a binary Yjs update.
|
|
798
|
+
* @param params.roomId The room ID to get the Yjs document version from.
|
|
799
|
+
* @param params.versionId The ID of the version to get.
|
|
800
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
801
|
+
* @returns The version's Yjs document encoded as a binary update.
|
|
802
|
+
*/
|
|
803
|
+
getYjsVersion(params: {
|
|
804
|
+
roomId: string;
|
|
805
|
+
versionId: string;
|
|
806
|
+
}, options?: RequestOptions): Promise<ArrayBuffer>;
|
|
807
|
+
/**
|
|
808
|
+
* Permanently deletes a version from the room's history.
|
|
809
|
+
* @param params.roomId The room ID to delete the version in.
|
|
810
|
+
* @param params.versionId The ID of the version to delete.
|
|
811
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
812
|
+
*/
|
|
813
|
+
deleteVersion(params: {
|
|
814
|
+
roomId: string;
|
|
815
|
+
versionId: string;
|
|
816
|
+
}, options?: RequestOptions): Promise<void>;
|
|
768
817
|
/**
|
|
769
818
|
* Gets all the threads in a room.
|
|
770
819
|
*
|
|
@@ -927,10 +976,6 @@ declare class Liveblocks {
|
|
|
927
976
|
roomId: string;
|
|
928
977
|
attachmentId: string;
|
|
929
978
|
}, options?: RequestOptions): Promise<AttachmentWithUrl>;
|
|
930
|
-
getStorageFile(params: {
|
|
931
|
-
roomId: string;
|
|
932
|
-
fileId: string;
|
|
933
|
-
}, options?: RequestOptions): Promise<StorageFileWithUrl>;
|
|
934
979
|
/**
|
|
935
980
|
* Creates a new thread. The thread will be created with the specified comment as its first comment.
|
|
936
981
|
* If the thread already exists, a `LiveblocksError` will be thrown with status code 409.
|
|
@@ -2003,4 +2048,4 @@ declare function isCustomNotificationEvent(event: WebhookEvent): event is Custom
|
|
|
2003
2048
|
*/
|
|
2004
2049
|
type RoomPermission = RoomPermissions;
|
|
2005
2050
|
|
|
2006
|
-
export { type AiCopilot, type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, type CreateAiCopilotOptions, type CreateFeedMessageOptions, type CreateFeedOptions, type CreateFileKnowledgeSourceOptions, type CreateRoomOptions, type CreateWebKnowledgeSourceOptions, type CustomNotificationEvent, type GetAiCopilotsOptions, type GetInboxNotificationsOptions, type GetKnowledgeSourcesOptions, type GetRoomsOptions, type GetWebKnowledgeSourceLinksOptions, type InboxNotificationsQueryCriteria, type KnowledgeSource, Liveblocks, LiveblocksError, type LiveblocksOptions, type MassMutateStorageCallback, type MassMutateStorageOptions, type MutateStorageCallback, type MutateStorageOptions, type NotificationEvent, type Page, type PaginationOptions, type RoomCreatedEvent, type RoomData, type RoomDeletedEvent, type RoomPermission, type RoomUser, type RoomsQueryCriteria, type SetPresenceOptions, type StorageUpdatedEvent, type TextMentionNotificationEvent, type ThreadCreatedEvent, type ThreadDeletedEvent, type ThreadMarkedAsResolvedEvent, type ThreadMarkedAsUnresolvedEvent, type ThreadMetadataUpdatedEvent, type ThreadNotificationEvent, type ThreadParticipants, type UpdateAiCopilotOptions, type UpdateFeedMessageOptions, type UpdateFeedOptions, type UpdateRoomOptions, type UpsertRoomOptions, type UserEnteredEvent, type UserLeftEvent, type WebKnowledgeSourceLink, type WebhookEvent, WebhookHandler, type WebhookRequest, type YDocUpdatedEvent, isCustomNotificationEvent, isTextMentionNotificationEvent, isThreadNotificationEvent, markdownToCommentBody };
|
|
2051
|
+
export { type AiCopilot, type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, type CreateAiCopilotOptions, type CreateFeedMessageOptions, type CreateFeedOptions, type CreateFileKnowledgeSourceOptions, type CreateRoomOptions, type CreateVersionHistorySnapshotResponse, type CreateWebKnowledgeSourceOptions, type CustomNotificationEvent, type GetAiCopilotsOptions, type GetInboxNotificationsOptions, type GetKnowledgeSourcesOptions, type GetRoomsOptions, type GetVersionHistoryOptions, type GetWebKnowledgeSourceLinksOptions, type HistoryVersion, type InboxNotificationsQueryCriteria, type KnowledgeSource, Liveblocks, LiveblocksError, type LiveblocksOptions, type MassMutateStorageCallback, type MassMutateStorageOptions, type MutateStorageCallback, type MutateStorageOptions, type NotificationEvent, type Page, type PaginationOptions, type RoomCreatedEvent, type RoomData, type RoomDeletedEvent, type RoomPermission, type RoomUser, type RoomsQueryCriteria, type SetPresenceOptions, type StorageUpdatedEvent, type TextMentionNotificationEvent, type ThreadCreatedEvent, type ThreadDeletedEvent, type ThreadMarkedAsResolvedEvent, type ThreadMarkedAsUnresolvedEvent, type ThreadMetadataUpdatedEvent, type ThreadNotificationEvent, type ThreadParticipants, type UpdateAiCopilotOptions, type UpdateFeedMessageOptions, type UpdateFeedOptions, type UpdateRoomOptions, type UpsertRoomOptions, type UserEnteredEvent, type UserLeftEvent, type WebKnowledgeSourceLink, type WebhookEvent, WebhookHandler, type WebhookRequest, type YDocUpdatedEvent, isCustomNotificationEvent, isTextMentionNotificationEvent, isThreadNotificationEvent, markdownToCommentBody };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Permission, Json, DFMD, FeedCreateMetadata, RoomPermissions, RoomAccesses, OptionalTupleUnless, BaseUserMeta, DU, PartialUnless, UpdateRoomAccesses, DE, JsonObject, PlainLsonObject, ToJson, DS, QueryMetadata, DTM, ThreadVisibility, ThreadData, DCM, UserSubscriptionData, CommentData, BaseMetadata, CommentBody, Patchable,
|
|
1
|
+
import { Permission, Json, DFMD, FeedCreateMetadata, RoomPermissions, RoomAccesses, OptionalTupleUnless, BaseUserMeta, DU, PartialUnless, UpdateRoomAccesses, DE, JsonObject, PlainLsonObject, ToJson, DS, QueryMetadata, DTM, ThreadVisibility, ThreadData, DCM, UserSubscriptionData, CommentData, BaseMetadata, CommentBody, Patchable, SubscriptionData, CommentUserReaction, InboxNotificationData, UserRoomSubscriptionSettings, RoomSubscriptionSettings, KDAD, DAD, NotificationSettings, PartialNotificationSettings, GroupScopes, GroupData, LiveObject, Awaitable, DFM, Feed, FeedUpdateMetadata, FeedMessage, NotificationChannel } from '@liveblocks/core';
|
|
2
2
|
export { CommentBody, CommentBodyBlockElement, CommentBodyElement, CommentBodyInlineElement, CommentBodyLink, CommentBodyLinkElementArgs, CommentBodyMention, CommentBodyMentionElementArgs, CommentBodyParagraph, CommentBodyParagraphElementArgs, CommentBodyText, CommentBodyTextElementArgs, CommentData, CommentUserReaction, IUserInfo, Json, JsonArray, JsonObject, JsonScalar, LiveList, LiveMap, LiveObject, LiveStructure, Lson, LsonObject, PlainLsonObject, ResolveUsersArgs, RoomAccesses, RoomPermissions, StringifyCommentBodyElements, StringifyCommentBodyOptions, ThreadData, User, getMentionsFromCommentBody, isNotificationChannelEnabled, stringifyCommentBody } from '@liveblocks/core';
|
|
3
3
|
import { IncomingHttpHeaders } from 'http';
|
|
4
4
|
|
|
@@ -102,10 +102,6 @@ type AttachmentWithUrl = {
|
|
|
102
102
|
url: string;
|
|
103
103
|
expiresAt: string;
|
|
104
104
|
};
|
|
105
|
-
type StorageFileWithUrl = LiveFileData & {
|
|
106
|
-
url: string;
|
|
107
|
-
expiresAt: string;
|
|
108
|
-
};
|
|
109
105
|
type CreateThreadOptions<TM extends BaseMetadata, CM extends BaseMetadata> = {
|
|
110
106
|
roomId: string;
|
|
111
107
|
data: {
|
|
@@ -315,6 +311,22 @@ type Page<T> = {
|
|
|
315
311
|
nextCursor: string | null;
|
|
316
312
|
data: T[];
|
|
317
313
|
};
|
|
314
|
+
type HistoryVersion = {
|
|
315
|
+
id: string;
|
|
316
|
+
createdAt: Date;
|
|
317
|
+
authors: {
|
|
318
|
+
id: string;
|
|
319
|
+
}[];
|
|
320
|
+
};
|
|
321
|
+
type GetVersionHistoryOptions = {
|
|
322
|
+
limit?: number;
|
|
323
|
+
cursor?: string;
|
|
324
|
+
};
|
|
325
|
+
type CreateVersionHistorySnapshotResponse = {
|
|
326
|
+
data: {
|
|
327
|
+
id: string;
|
|
328
|
+
};
|
|
329
|
+
};
|
|
318
330
|
type GetRoomsOptions = RoomsQueryCriteria & PaginationOptions;
|
|
319
331
|
type GetInboxNotificationsOptions = InboxNotificationsQueryCriteria & PaginationOptions;
|
|
320
332
|
type CreateRoomOptions = {
|
|
@@ -765,6 +777,43 @@ declare class Liveblocks {
|
|
|
765
777
|
getYjsDocumentAsBinaryUpdate(roomId: string, params?: {
|
|
766
778
|
guid?: string;
|
|
767
779
|
}, options?: RequestOptions): Promise<ArrayBuffer>;
|
|
780
|
+
/**
|
|
781
|
+
* Returns the version history snapshots for the room, sorted by creation date from newest to oldest.
|
|
782
|
+
* @param roomId The ID of the room to get the version history from.
|
|
783
|
+
* @param params.limit (optional) The number of versions to return. The limit can range between 1 and 100, and defaults to 20.
|
|
784
|
+
* @param params.cursor (optional) A cursor used for pagination. Get the value from the `nextCursor` response of the previous page.
|
|
785
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
786
|
+
* @returns A list of version history snapshots and the next page cursor.
|
|
787
|
+
*/
|
|
788
|
+
getVersionHistory(roomId: string, params?: GetVersionHistoryOptions, options?: RequestOptions): Promise<Page<HistoryVersion>>;
|
|
789
|
+
/**
|
|
790
|
+
* Creates a new version history snapshot of the room, capturing both its Storage and Yjs documents.
|
|
791
|
+
* @param roomId The ID of the room to create a version history snapshot for.
|
|
792
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
793
|
+
* @returns The created version ID.
|
|
794
|
+
*/
|
|
795
|
+
createVersionHistorySnapshot(roomId: string, options?: RequestOptions): Promise<CreateVersionHistorySnapshotResponse>;
|
|
796
|
+
/**
|
|
797
|
+
* Returns a specific version of the room's Yjs document encoded as a binary Yjs update.
|
|
798
|
+
* @param params.roomId The room ID to get the Yjs document version from.
|
|
799
|
+
* @param params.versionId The ID of the version to get.
|
|
800
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
801
|
+
* @returns The version's Yjs document encoded as a binary update.
|
|
802
|
+
*/
|
|
803
|
+
getYjsVersion(params: {
|
|
804
|
+
roomId: string;
|
|
805
|
+
versionId: string;
|
|
806
|
+
}, options?: RequestOptions): Promise<ArrayBuffer>;
|
|
807
|
+
/**
|
|
808
|
+
* Permanently deletes a version from the room's history.
|
|
809
|
+
* @param params.roomId The room ID to delete the version in.
|
|
810
|
+
* @param params.versionId The ID of the version to delete.
|
|
811
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
812
|
+
*/
|
|
813
|
+
deleteVersion(params: {
|
|
814
|
+
roomId: string;
|
|
815
|
+
versionId: string;
|
|
816
|
+
}, options?: RequestOptions): Promise<void>;
|
|
768
817
|
/**
|
|
769
818
|
* Gets all the threads in a room.
|
|
770
819
|
*
|
|
@@ -927,10 +976,6 @@ declare class Liveblocks {
|
|
|
927
976
|
roomId: string;
|
|
928
977
|
attachmentId: string;
|
|
929
978
|
}, options?: RequestOptions): Promise<AttachmentWithUrl>;
|
|
930
|
-
getStorageFile(params: {
|
|
931
|
-
roomId: string;
|
|
932
|
-
fileId: string;
|
|
933
|
-
}, options?: RequestOptions): Promise<StorageFileWithUrl>;
|
|
934
979
|
/**
|
|
935
980
|
* Creates a new thread. The thread will be created with the specified comment as its first comment.
|
|
936
981
|
* If the thread already exists, a `LiveblocksError` will be thrown with status code 409.
|
|
@@ -2003,4 +2048,4 @@ declare function isCustomNotificationEvent(event: WebhookEvent): event is Custom
|
|
|
2003
2048
|
*/
|
|
2004
2049
|
type RoomPermission = RoomPermissions;
|
|
2005
2050
|
|
|
2006
|
-
export { type AiCopilot, type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, type CreateAiCopilotOptions, type CreateFeedMessageOptions, type CreateFeedOptions, type CreateFileKnowledgeSourceOptions, type CreateRoomOptions, type CreateWebKnowledgeSourceOptions, type CustomNotificationEvent, type GetAiCopilotsOptions, type GetInboxNotificationsOptions, type GetKnowledgeSourcesOptions, type GetRoomsOptions, type GetWebKnowledgeSourceLinksOptions, type InboxNotificationsQueryCriteria, type KnowledgeSource, Liveblocks, LiveblocksError, type LiveblocksOptions, type MassMutateStorageCallback, type MassMutateStorageOptions, type MutateStorageCallback, type MutateStorageOptions, type NotificationEvent, type Page, type PaginationOptions, type RoomCreatedEvent, type RoomData, type RoomDeletedEvent, type RoomPermission, type RoomUser, type RoomsQueryCriteria, type SetPresenceOptions, type StorageUpdatedEvent, type TextMentionNotificationEvent, type ThreadCreatedEvent, type ThreadDeletedEvent, type ThreadMarkedAsResolvedEvent, type ThreadMarkedAsUnresolvedEvent, type ThreadMetadataUpdatedEvent, type ThreadNotificationEvent, type ThreadParticipants, type UpdateAiCopilotOptions, type UpdateFeedMessageOptions, type UpdateFeedOptions, type UpdateRoomOptions, type UpsertRoomOptions, type UserEnteredEvent, type UserLeftEvent, type WebKnowledgeSourceLink, type WebhookEvent, WebhookHandler, type WebhookRequest, type YDocUpdatedEvent, isCustomNotificationEvent, isTextMentionNotificationEvent, isThreadNotificationEvent, markdownToCommentBody };
|
|
2051
|
+
export { type AiCopilot, type CommentCreatedEvent, type CommentDeletedEvent, type CommentEditedEvent, type CommentReactionAdded, type CommentReactionRemoved, type CreateAiCopilotOptions, type CreateFeedMessageOptions, type CreateFeedOptions, type CreateFileKnowledgeSourceOptions, type CreateRoomOptions, type CreateVersionHistorySnapshotResponse, type CreateWebKnowledgeSourceOptions, type CustomNotificationEvent, type GetAiCopilotsOptions, type GetInboxNotificationsOptions, type GetKnowledgeSourcesOptions, type GetRoomsOptions, type GetVersionHistoryOptions, type GetWebKnowledgeSourceLinksOptions, type HistoryVersion, type InboxNotificationsQueryCriteria, type KnowledgeSource, Liveblocks, LiveblocksError, type LiveblocksOptions, type MassMutateStorageCallback, type MassMutateStorageOptions, type MutateStorageCallback, type MutateStorageOptions, type NotificationEvent, type Page, type PaginationOptions, type RoomCreatedEvent, type RoomData, type RoomDeletedEvent, type RoomPermission, type RoomUser, type RoomsQueryCriteria, type SetPresenceOptions, type StorageUpdatedEvent, type TextMentionNotificationEvent, type ThreadCreatedEvent, type ThreadDeletedEvent, type ThreadMarkedAsResolvedEvent, type ThreadMarkedAsUnresolvedEvent, type ThreadMetadataUpdatedEvent, type ThreadNotificationEvent, type ThreadParticipants, type UpdateAiCopilotOptions, type UpdateFeedMessageOptions, type UpdateFeedOptions, type UpdateRoomOptions, type UpsertRoomOptions, type UserEnteredEvent, type UserLeftEvent, type WebKnowledgeSourceLink, type WebhookEvent, WebhookHandler, type WebhookRequest, type YDocUpdatedEvent, isCustomNotificationEvent, isTextMentionNotificationEvent, isThreadNotificationEvent, markdownToCommentBody };
|
package/dist/index.js
CHANGED
|
@@ -3,7 +3,7 @@ import { detectDupes } from "@liveblocks/core";
|
|
|
3
3
|
|
|
4
4
|
// src/version.ts
|
|
5
5
|
var PKG_NAME = "@liveblocks/node";
|
|
6
|
-
var PKG_VERSION = "3.22.0
|
|
6
|
+
var PKG_VERSION = "3.22.0";
|
|
7
7
|
var PKG_FORMAT = "esm";
|
|
8
8
|
|
|
9
9
|
// src/client.ts
|
|
@@ -337,6 +337,12 @@ function inflateWebKnowledgeSourceLink(link) {
|
|
|
337
337
|
lastIndexedAt: new Date(link.lastIndexedAt)
|
|
338
338
|
};
|
|
339
339
|
}
|
|
340
|
+
function inflateHistoryVersion(version) {
|
|
341
|
+
return {
|
|
342
|
+
...version,
|
|
343
|
+
createdAt: new Date(version.createdAt)
|
|
344
|
+
};
|
|
345
|
+
}
|
|
340
346
|
var Liveblocks = class {
|
|
341
347
|
#secret;
|
|
342
348
|
#baseUrl;
|
|
@@ -777,7 +783,7 @@ var Liveblocks = class {
|
|
|
777
783
|
*/
|
|
778
784
|
async getActiveUsers(roomId, options) {
|
|
779
785
|
const res = await this.#get(
|
|
780
|
-
url2`/v2/rooms/${roomId}/
|
|
786
|
+
url2`/v2/rooms/${roomId}/active-users`,
|
|
781
787
|
void 0,
|
|
782
788
|
options
|
|
783
789
|
);
|
|
@@ -794,7 +800,7 @@ var Liveblocks = class {
|
|
|
794
800
|
*/
|
|
795
801
|
async broadcastEvent(roomId, message, options) {
|
|
796
802
|
const res = await this.#post(
|
|
797
|
-
url2`/v2/rooms/${roomId}/
|
|
803
|
+
url2`/v2/rooms/${roomId}/broadcast-event`,
|
|
798
804
|
message,
|
|
799
805
|
options
|
|
800
806
|
);
|
|
@@ -961,6 +967,82 @@ var Liveblocks = class {
|
|
|
961
967
|
}
|
|
962
968
|
return res.arrayBuffer();
|
|
963
969
|
}
|
|
970
|
+
/**
|
|
971
|
+
* Returns the version history snapshots for the room, sorted by creation date from newest to oldest.
|
|
972
|
+
* @param roomId The ID of the room to get the version history from.
|
|
973
|
+
* @param params.limit (optional) The number of versions to return. The limit can range between 1 and 100, and defaults to 20.
|
|
974
|
+
* @param params.cursor (optional) A cursor used for pagination. Get the value from the `nextCursor` response of the previous page.
|
|
975
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
976
|
+
* @returns A list of version history snapshots and the next page cursor.
|
|
977
|
+
*/
|
|
978
|
+
async getVersionHistory(roomId, params = {}, options) {
|
|
979
|
+
const res = await this.#get(
|
|
980
|
+
url2`/v2/rooms/${roomId}/versions`,
|
|
981
|
+
{ limit: params.limit, cursor: params.cursor },
|
|
982
|
+
options
|
|
983
|
+
);
|
|
984
|
+
if (!res.ok) {
|
|
985
|
+
throw await LiveblocksError.from(res);
|
|
986
|
+
}
|
|
987
|
+
const page = await res.json();
|
|
988
|
+
return {
|
|
989
|
+
nextCursor: page.nextCursor,
|
|
990
|
+
data: page.data.map(inflateHistoryVersion)
|
|
991
|
+
};
|
|
992
|
+
}
|
|
993
|
+
/**
|
|
994
|
+
* Creates a new version history snapshot of the room, capturing both its Storage and Yjs documents.
|
|
995
|
+
* @param roomId The ID of the room to create a version history snapshot for.
|
|
996
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
997
|
+
* @returns The created version ID.
|
|
998
|
+
*/
|
|
999
|
+
async createVersionHistorySnapshot(roomId, options) {
|
|
1000
|
+
const res = await this.#post(
|
|
1001
|
+
url2`/v2/rooms/${roomId}/versions`,
|
|
1002
|
+
{},
|
|
1003
|
+
options
|
|
1004
|
+
);
|
|
1005
|
+
if (!res.ok) {
|
|
1006
|
+
throw await LiveblocksError.from(res);
|
|
1007
|
+
}
|
|
1008
|
+
return await res.json();
|
|
1009
|
+
}
|
|
1010
|
+
/**
|
|
1011
|
+
* Returns a specific version of the room's Yjs document encoded as a binary Yjs update.
|
|
1012
|
+
* @param params.roomId The room ID to get the Yjs document version from.
|
|
1013
|
+
* @param params.versionId The ID of the version to get.
|
|
1014
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1015
|
+
* @returns The version's Yjs document encoded as a binary update.
|
|
1016
|
+
*/
|
|
1017
|
+
async getYjsVersion(params, options) {
|
|
1018
|
+
const { roomId, versionId } = params;
|
|
1019
|
+
const res = await this.#get(
|
|
1020
|
+
url2`/v2/rooms/${roomId}/versions/${versionId}/yjs`,
|
|
1021
|
+
void 0,
|
|
1022
|
+
options
|
|
1023
|
+
);
|
|
1024
|
+
if (!res.ok) {
|
|
1025
|
+
throw await LiveblocksError.from(res);
|
|
1026
|
+
}
|
|
1027
|
+
return res.arrayBuffer();
|
|
1028
|
+
}
|
|
1029
|
+
/**
|
|
1030
|
+
* Permanently deletes a version from the room's history.
|
|
1031
|
+
* @param params.roomId The room ID to delete the version in.
|
|
1032
|
+
* @param params.versionId The ID of the version to delete.
|
|
1033
|
+
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1034
|
+
*/
|
|
1035
|
+
async deleteVersion(params, options) {
|
|
1036
|
+
const { roomId, versionId } = params;
|
|
1037
|
+
const res = await this.#delete(
|
|
1038
|
+
url2`/v2/rooms/${roomId}/versions/${versionId}`,
|
|
1039
|
+
void 0,
|
|
1040
|
+
options
|
|
1041
|
+
);
|
|
1042
|
+
if (!res.ok) {
|
|
1043
|
+
throw await LiveblocksError.from(res);
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
964
1046
|
/* -------------------------------------------------------------------------------------------------
|
|
965
1047
|
* Comments
|
|
966
1048
|
* -----------------------------------------------------------------------------------------------*/
|
|
@@ -1176,18 +1258,6 @@ var Liveblocks = class {
|
|
|
1176
1258
|
}
|
|
1177
1259
|
return await res.json();
|
|
1178
1260
|
}
|
|
1179
|
-
async getStorageFile(params, options) {
|
|
1180
|
-
const { roomId, fileId } = params;
|
|
1181
|
-
const res = await this.#get(
|
|
1182
|
-
url2`/v2/rooms/${roomId}/storage-files/${fileId}`,
|
|
1183
|
-
void 0,
|
|
1184
|
-
options
|
|
1185
|
-
);
|
|
1186
|
-
if (!res.ok) {
|
|
1187
|
-
throw await LiveblocksError.from(res);
|
|
1188
|
-
}
|
|
1189
|
-
return await res.json();
|
|
1190
|
-
}
|
|
1191
1261
|
/**
|
|
1192
1262
|
* Creates a new thread. The thread will be created with the specified comment as its first comment.
|
|
1193
1263
|
* If the thread already exists, a `LiveblocksError` will be thrown with status code 409.
|
|
@@ -1945,7 +2015,7 @@ var Liveblocks = class {
|
|
|
1945
2015
|
try {
|
|
1946
2016
|
const resp = await this.#requestStorageMutation(roomId, { signal });
|
|
1947
2017
|
const { actor, nodes } = resp;
|
|
1948
|
-
const pool = createManagedPool(
|
|
2018
|
+
const pool = createManagedPool({
|
|
1949
2019
|
getCurrentConnectionId: () => actor,
|
|
1950
2020
|
onDispatch: (ops, _reverse, _storageUpdates) => {
|
|
1951
2021
|
if (ops.length === 0) return;
|