@liveblocks/node 3.13.0-metadata1 → 3.13.0-rc1
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 +14 -46
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +32 -76
- package/dist/index.d.ts +32 -76
- package/dist/index.js +6 -38
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseUserMeta, DU, LiveObject, Awaitable, DS, OptionalTupleUnless, PlainLsonObject, JsonObject, QueryMetadata, ThreadData, UserSubscriptionData, CommentData, CommentBody,
|
|
1
|
+
import { BaseUserMeta, DU, LiveObject, Awaitable, DS, OptionalTupleUnless, PlainLsonObject, JsonObject, QueryMetadata, ThreadData, UserSubscriptionData, CommentData, CommentBody, SubscriptionData, Patchable, CommentUserReaction, InboxNotificationData, UserRoomSubscriptionSettings, RoomSubscriptionSettings, KDAD, DAD, NotificationSettings, PartialNotificationSettings, GroupScopes, GroupData, LsonObject, ToImmutable, PartialUnless, BaseMetadata, DE, DM, 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, StringifyCommentBodyElements, StringifyCommentBodyOptions, ThreadData, User, getMentionsFromCommentBody, isNotificationChannelEnabled, stringifyCommentBody } from '@liveblocks/core';
|
|
3
3
|
import { IncomingHttpHeaders } from 'http';
|
|
4
4
|
|
|
@@ -94,29 +94,16 @@ type Identity = {
|
|
|
94
94
|
type ThreadParticipants = {
|
|
95
95
|
participantIds: string[];
|
|
96
96
|
};
|
|
97
|
-
type CreateThreadOptions<
|
|
97
|
+
type CreateThreadOptions<M extends BaseMetadata> = {
|
|
98
98
|
roomId: string;
|
|
99
99
|
data: {
|
|
100
100
|
comment: {
|
|
101
101
|
userId: string;
|
|
102
102
|
createdAt?: Date;
|
|
103
103
|
body: CommentBody;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
} & PartialUnless<TM, {
|
|
108
|
-
metadata: TM;
|
|
109
|
-
}>;
|
|
110
|
-
};
|
|
111
|
-
type CreateCommentOptions<CM extends BaseMetadata> = {
|
|
112
|
-
roomId: string;
|
|
113
|
-
threadId: string;
|
|
114
|
-
data: {
|
|
115
|
-
userId: string;
|
|
116
|
-
createdAt?: Date;
|
|
117
|
-
body: CommentBody;
|
|
118
|
-
} & PartialUnless<CM, {
|
|
119
|
-
metadata: CM;
|
|
104
|
+
};
|
|
105
|
+
} & PartialUnless<M, {
|
|
106
|
+
metadata: M;
|
|
120
107
|
}>;
|
|
121
108
|
};
|
|
122
109
|
type RoomPermission = [] | ["room:write"] | ["room:read", "room:presence:write"] | ["room:read", "room:presence:write", "comments:write"];
|
|
@@ -222,8 +209,7 @@ type MassMutateStorageOptions = MutateStorageOptions & {
|
|
|
222
209
|
concurrency?: number;
|
|
223
210
|
};
|
|
224
211
|
type E = DE;
|
|
225
|
-
type
|
|
226
|
-
type CM = DCM;
|
|
212
|
+
type M = DM;
|
|
227
213
|
type S = DS;
|
|
228
214
|
type U = DU;
|
|
229
215
|
type RoomsQueryCriteria = {
|
|
@@ -302,6 +288,12 @@ type CreateRoomOptions = {
|
|
|
302
288
|
usersAccesses?: RoomAccesses;
|
|
303
289
|
metadata?: RoomMetadata;
|
|
304
290
|
tenantId?: string;
|
|
291
|
+
/**
|
|
292
|
+
* @private Preferred storage engine version to use when creating the
|
|
293
|
+
* room. Only takes effect if the room doesn't exist yet. Version
|
|
294
|
+
* 2 supports streaming and will become the default in the future.
|
|
295
|
+
*/
|
|
296
|
+
engine?: 1 | 2;
|
|
305
297
|
};
|
|
306
298
|
type UpdateRoomOptions = {
|
|
307
299
|
defaultAccesses?: RoomPermission | null;
|
|
@@ -735,11 +727,11 @@ declare class Liveblocks {
|
|
|
735
727
|
* ```
|
|
736
728
|
*/
|
|
737
729
|
query?: string | {
|
|
738
|
-
metadata?: Partial<QueryMetadata<
|
|
730
|
+
metadata?: Partial<QueryMetadata<M>>;
|
|
739
731
|
resolved?: boolean;
|
|
740
732
|
};
|
|
741
733
|
}, options?: RequestOptions): Promise<{
|
|
742
|
-
data: ThreadData<
|
|
734
|
+
data: ThreadData<M>[];
|
|
743
735
|
}>;
|
|
744
736
|
/**
|
|
745
737
|
* Gets a thread.
|
|
@@ -752,7 +744,7 @@ declare class Liveblocks {
|
|
|
752
744
|
getThread(params: {
|
|
753
745
|
roomId: string;
|
|
754
746
|
threadId: string;
|
|
755
|
-
}, options?: RequestOptions): Promise<ThreadData<
|
|
747
|
+
}, options?: RequestOptions): Promise<ThreadData<M>>;
|
|
756
748
|
/**
|
|
757
749
|
* @deprecated Prefer using `getMentionsFromCommentBody` to extract mentions
|
|
758
750
|
* from comments and threads, or `Liveblocks.getThreadSubscriptions` to get
|
|
@@ -799,7 +791,7 @@ declare class Liveblocks {
|
|
|
799
791
|
roomId: string;
|
|
800
792
|
threadId: string;
|
|
801
793
|
commentId: string;
|
|
802
|
-
}, options?: RequestOptions): Promise<CommentData
|
|
794
|
+
}, options?: RequestOptions): Promise<CommentData>;
|
|
803
795
|
/**
|
|
804
796
|
* Creates a comment.
|
|
805
797
|
*
|
|
@@ -808,18 +800,24 @@ declare class Liveblocks {
|
|
|
808
800
|
* @param params.data.userId The user ID of the user who is set to create the comment.
|
|
809
801
|
* @param params.data.createdAt (optional) The date the comment is set to be created.
|
|
810
802
|
* @param params.data.body The body of the comment.
|
|
811
|
-
* @param params.data.metadata (optional) The metadata for the comment.
|
|
812
803
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
813
804
|
* @returns The created comment.
|
|
814
805
|
*/
|
|
815
|
-
createComment(params:
|
|
806
|
+
createComment(params: {
|
|
807
|
+
roomId: string;
|
|
808
|
+
threadId: string;
|
|
809
|
+
data: {
|
|
810
|
+
userId: string;
|
|
811
|
+
createdAt?: Date;
|
|
812
|
+
body: CommentBody;
|
|
813
|
+
};
|
|
814
|
+
}, options?: RequestOptions): Promise<CommentData>;
|
|
816
815
|
/**
|
|
817
816
|
* Edits a comment.
|
|
818
817
|
* @param params.roomId The room ID to edit the comment in.
|
|
819
818
|
* @param params.threadId The thread ID to edit the comment in.
|
|
820
819
|
* @param params.commentId The comment ID to edit.
|
|
821
820
|
* @param params.data.body The body of the comment.
|
|
822
|
-
* @param params.data.metadata (optional) The metadata for the comment. Value must be a string, boolean or number. Use null to delete a key.
|
|
823
821
|
* @param params.data.editedAt (optional) The date the comment was edited.
|
|
824
822
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
825
823
|
* @returns The edited comment.
|
|
@@ -830,10 +828,9 @@ declare class Liveblocks {
|
|
|
830
828
|
commentId: string;
|
|
831
829
|
data: {
|
|
832
830
|
body: CommentBody;
|
|
833
|
-
metadata?: Patchable<CM>;
|
|
834
831
|
editedAt?: Date;
|
|
835
832
|
};
|
|
836
|
-
}, options?: RequestOptions): Promise<CommentData
|
|
833
|
+
}, options?: RequestOptions): Promise<CommentData>;
|
|
837
834
|
/**
|
|
838
835
|
* Deletes a comment. Deletes a comment. If there are no remaining comments in the thread, the thread is also deleted.
|
|
839
836
|
* @param params.roomId The room ID to delete the comment in.
|
|
@@ -854,11 +851,10 @@ declare class Liveblocks {
|
|
|
854
851
|
* @param params.thread.comment.userId The user ID of the user who created the comment.
|
|
855
852
|
* @param params.thread.comment.createdAt (optional) The date the comment was created.
|
|
856
853
|
* @param params.thread.comment.body The body of the comment.
|
|
857
|
-
* @param params.thread.comment.metadata (optional) The metadata for the comment.
|
|
858
854
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
859
855
|
* @returns The created thread. The thread will be created with the specified comment as its first comment.
|
|
860
856
|
*/
|
|
861
|
-
createThread(params: CreateThreadOptions<
|
|
857
|
+
createThread(params: CreateThreadOptions<M>, options?: RequestOptions): Promise<ThreadData<M>>;
|
|
862
858
|
/**
|
|
863
859
|
* Deletes a thread and all of its comments.
|
|
864
860
|
* @param params.roomId The room ID to delete the thread in.
|
|
@@ -883,7 +879,7 @@ declare class Liveblocks {
|
|
|
883
879
|
data: {
|
|
884
880
|
userId: string;
|
|
885
881
|
};
|
|
886
|
-
}, options?: RequestOptions): Promise<ThreadData<
|
|
882
|
+
}, options?: RequestOptions): Promise<ThreadData<M>>;
|
|
887
883
|
/**
|
|
888
884
|
* Mark a thread as unresolved.
|
|
889
885
|
* @param params.roomId The room ID of the thread.
|
|
@@ -898,7 +894,7 @@ declare class Liveblocks {
|
|
|
898
894
|
data: {
|
|
899
895
|
userId: string;
|
|
900
896
|
};
|
|
901
|
-
}, options?: RequestOptions): Promise<ThreadData<
|
|
897
|
+
}, options?: RequestOptions): Promise<ThreadData<M>>;
|
|
902
898
|
/**
|
|
903
899
|
* Subscribes a user to a thread.
|
|
904
900
|
* @param params.roomId The room ID of the thread.
|
|
@@ -942,32 +938,11 @@ declare class Liveblocks {
|
|
|
942
938
|
roomId: string;
|
|
943
939
|
threadId: string;
|
|
944
940
|
data: {
|
|
945
|
-
metadata: Patchable<
|
|
946
|
-
userId: string;
|
|
947
|
-
updatedAt?: Date;
|
|
948
|
-
};
|
|
949
|
-
}, options?: RequestOptions): Promise<TM>;
|
|
950
|
-
/**
|
|
951
|
-
* Updates the metadata of the specified comment in a room.
|
|
952
|
-
* @param params.roomId The room ID to update the comment in.
|
|
953
|
-
* @param params.threadId The thread ID to update the comment in.
|
|
954
|
-
* @param params.commentId The comment ID to update.
|
|
955
|
-
* @param params.data.metadata The metadata for the comment. Value must be a string, boolean or number. Use null to delete a key.
|
|
956
|
-
* @param params.data.userId The user ID of the user who updated the comment.
|
|
957
|
-
* @param params.data.updatedAt (optional) The date the comment metadata is set to be updated.
|
|
958
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
959
|
-
* @returns The updated comment metadata.
|
|
960
|
-
*/
|
|
961
|
-
editCommentMetadata(params: {
|
|
962
|
-
roomId: string;
|
|
963
|
-
threadId: string;
|
|
964
|
-
commentId: string;
|
|
965
|
-
data: {
|
|
966
|
-
metadata: Patchable<CM>;
|
|
941
|
+
metadata: Patchable<M>;
|
|
967
942
|
userId: string;
|
|
968
943
|
updatedAt?: Date;
|
|
969
944
|
};
|
|
970
|
-
}, options?: RequestOptions): Promise<
|
|
945
|
+
}, options?: RequestOptions): Promise<M>;
|
|
971
946
|
/**
|
|
972
947
|
* Adds a new comment reaction to a comment.
|
|
973
948
|
* @param params.roomId The room ID to add the comment reaction in.
|
|
@@ -1416,7 +1391,7 @@ type WebhookRequest = {
|
|
|
1416
1391
|
* as member of the augmentation
|
|
1417
1392
|
*/
|
|
1418
1393
|
type CustomKind = `$${string}`;
|
|
1419
|
-
type WebhookEvent = StorageUpdatedEvent | UserEnteredEvent | UserLeftEvent | RoomCreatedEvent | RoomDeletedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved |
|
|
1394
|
+
type WebhookEvent = StorageUpdatedEvent | UserEnteredEvent | UserLeftEvent | RoomCreatedEvent | RoomDeletedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved | ThreadMetadataUpdatedEvent | NotificationEvent | ThreadCreatedEvent | ThreadDeletedEvent | ThreadMarkedAsResolvedEvent | ThreadMarkedAsUnresolvedEvent | YDocUpdatedEvent;
|
|
1420
1395
|
type StorageUpdatedEvent = {
|
|
1421
1396
|
type: "storageUpdated";
|
|
1422
1397
|
data: {
|
|
@@ -1588,25 +1563,6 @@ type ThreadMetadataUpdatedEvent = {
|
|
|
1588
1563
|
updatedBy: string;
|
|
1589
1564
|
};
|
|
1590
1565
|
};
|
|
1591
|
-
type CommentMetadataUpdatedEvent = {
|
|
1592
|
-
type: "commentMetadataUpdated";
|
|
1593
|
-
data: {
|
|
1594
|
-
projectId: string;
|
|
1595
|
-
roomId: string;
|
|
1596
|
-
threadId: string;
|
|
1597
|
-
commentId: string;
|
|
1598
|
-
/**
|
|
1599
|
-
* ISO 8601 datestring
|
|
1600
|
-
* @example "2021-03-01T12:00:00.000Z"
|
|
1601
|
-
*/
|
|
1602
|
-
updatedAt: string;
|
|
1603
|
-
/**
|
|
1604
|
-
* ISO 8601 datestring
|
|
1605
|
-
* @example "2021-03-01T12:00:00.000Z"
|
|
1606
|
-
*/
|
|
1607
|
-
updatedBy: string;
|
|
1608
|
-
};
|
|
1609
|
-
};
|
|
1610
1566
|
type ThreadCreatedEvent = {
|
|
1611
1567
|
type: "threadCreated";
|
|
1612
1568
|
data: {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseUserMeta, DU, LiveObject, Awaitable, DS, OptionalTupleUnless, PlainLsonObject, JsonObject, QueryMetadata, ThreadData, UserSubscriptionData, CommentData, CommentBody,
|
|
1
|
+
import { BaseUserMeta, DU, LiveObject, Awaitable, DS, OptionalTupleUnless, PlainLsonObject, JsonObject, QueryMetadata, ThreadData, UserSubscriptionData, CommentData, CommentBody, SubscriptionData, Patchable, CommentUserReaction, InboxNotificationData, UserRoomSubscriptionSettings, RoomSubscriptionSettings, KDAD, DAD, NotificationSettings, PartialNotificationSettings, GroupScopes, GroupData, LsonObject, ToImmutable, PartialUnless, BaseMetadata, DE, DM, 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, StringifyCommentBodyElements, StringifyCommentBodyOptions, ThreadData, User, getMentionsFromCommentBody, isNotificationChannelEnabled, stringifyCommentBody } from '@liveblocks/core';
|
|
3
3
|
import { IncomingHttpHeaders } from 'http';
|
|
4
4
|
|
|
@@ -94,29 +94,16 @@ type Identity = {
|
|
|
94
94
|
type ThreadParticipants = {
|
|
95
95
|
participantIds: string[];
|
|
96
96
|
};
|
|
97
|
-
type CreateThreadOptions<
|
|
97
|
+
type CreateThreadOptions<M extends BaseMetadata> = {
|
|
98
98
|
roomId: string;
|
|
99
99
|
data: {
|
|
100
100
|
comment: {
|
|
101
101
|
userId: string;
|
|
102
102
|
createdAt?: Date;
|
|
103
103
|
body: CommentBody;
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
} & PartialUnless<TM, {
|
|
108
|
-
metadata: TM;
|
|
109
|
-
}>;
|
|
110
|
-
};
|
|
111
|
-
type CreateCommentOptions<CM extends BaseMetadata> = {
|
|
112
|
-
roomId: string;
|
|
113
|
-
threadId: string;
|
|
114
|
-
data: {
|
|
115
|
-
userId: string;
|
|
116
|
-
createdAt?: Date;
|
|
117
|
-
body: CommentBody;
|
|
118
|
-
} & PartialUnless<CM, {
|
|
119
|
-
metadata: CM;
|
|
104
|
+
};
|
|
105
|
+
} & PartialUnless<M, {
|
|
106
|
+
metadata: M;
|
|
120
107
|
}>;
|
|
121
108
|
};
|
|
122
109
|
type RoomPermission = [] | ["room:write"] | ["room:read", "room:presence:write"] | ["room:read", "room:presence:write", "comments:write"];
|
|
@@ -222,8 +209,7 @@ type MassMutateStorageOptions = MutateStorageOptions & {
|
|
|
222
209
|
concurrency?: number;
|
|
223
210
|
};
|
|
224
211
|
type E = DE;
|
|
225
|
-
type
|
|
226
|
-
type CM = DCM;
|
|
212
|
+
type M = DM;
|
|
227
213
|
type S = DS;
|
|
228
214
|
type U = DU;
|
|
229
215
|
type RoomsQueryCriteria = {
|
|
@@ -302,6 +288,12 @@ type CreateRoomOptions = {
|
|
|
302
288
|
usersAccesses?: RoomAccesses;
|
|
303
289
|
metadata?: RoomMetadata;
|
|
304
290
|
tenantId?: string;
|
|
291
|
+
/**
|
|
292
|
+
* @private Preferred storage engine version to use when creating the
|
|
293
|
+
* room. Only takes effect if the room doesn't exist yet. Version
|
|
294
|
+
* 2 supports streaming and will become the default in the future.
|
|
295
|
+
*/
|
|
296
|
+
engine?: 1 | 2;
|
|
305
297
|
};
|
|
306
298
|
type UpdateRoomOptions = {
|
|
307
299
|
defaultAccesses?: RoomPermission | null;
|
|
@@ -735,11 +727,11 @@ declare class Liveblocks {
|
|
|
735
727
|
* ```
|
|
736
728
|
*/
|
|
737
729
|
query?: string | {
|
|
738
|
-
metadata?: Partial<QueryMetadata<
|
|
730
|
+
metadata?: Partial<QueryMetadata<M>>;
|
|
739
731
|
resolved?: boolean;
|
|
740
732
|
};
|
|
741
733
|
}, options?: RequestOptions): Promise<{
|
|
742
|
-
data: ThreadData<
|
|
734
|
+
data: ThreadData<M>[];
|
|
743
735
|
}>;
|
|
744
736
|
/**
|
|
745
737
|
* Gets a thread.
|
|
@@ -752,7 +744,7 @@ declare class Liveblocks {
|
|
|
752
744
|
getThread(params: {
|
|
753
745
|
roomId: string;
|
|
754
746
|
threadId: string;
|
|
755
|
-
}, options?: RequestOptions): Promise<ThreadData<
|
|
747
|
+
}, options?: RequestOptions): Promise<ThreadData<M>>;
|
|
756
748
|
/**
|
|
757
749
|
* @deprecated Prefer using `getMentionsFromCommentBody` to extract mentions
|
|
758
750
|
* from comments and threads, or `Liveblocks.getThreadSubscriptions` to get
|
|
@@ -799,7 +791,7 @@ declare class Liveblocks {
|
|
|
799
791
|
roomId: string;
|
|
800
792
|
threadId: string;
|
|
801
793
|
commentId: string;
|
|
802
|
-
}, options?: RequestOptions): Promise<CommentData
|
|
794
|
+
}, options?: RequestOptions): Promise<CommentData>;
|
|
803
795
|
/**
|
|
804
796
|
* Creates a comment.
|
|
805
797
|
*
|
|
@@ -808,18 +800,24 @@ declare class Liveblocks {
|
|
|
808
800
|
* @param params.data.userId The user ID of the user who is set to create the comment.
|
|
809
801
|
* @param params.data.createdAt (optional) The date the comment is set to be created.
|
|
810
802
|
* @param params.data.body The body of the comment.
|
|
811
|
-
* @param params.data.metadata (optional) The metadata for the comment.
|
|
812
803
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
813
804
|
* @returns The created comment.
|
|
814
805
|
*/
|
|
815
|
-
createComment(params:
|
|
806
|
+
createComment(params: {
|
|
807
|
+
roomId: string;
|
|
808
|
+
threadId: string;
|
|
809
|
+
data: {
|
|
810
|
+
userId: string;
|
|
811
|
+
createdAt?: Date;
|
|
812
|
+
body: CommentBody;
|
|
813
|
+
};
|
|
814
|
+
}, options?: RequestOptions): Promise<CommentData>;
|
|
816
815
|
/**
|
|
817
816
|
* Edits a comment.
|
|
818
817
|
* @param params.roomId The room ID to edit the comment in.
|
|
819
818
|
* @param params.threadId The thread ID to edit the comment in.
|
|
820
819
|
* @param params.commentId The comment ID to edit.
|
|
821
820
|
* @param params.data.body The body of the comment.
|
|
822
|
-
* @param params.data.metadata (optional) The metadata for the comment. Value must be a string, boolean or number. Use null to delete a key.
|
|
823
821
|
* @param params.data.editedAt (optional) The date the comment was edited.
|
|
824
822
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
825
823
|
* @returns The edited comment.
|
|
@@ -830,10 +828,9 @@ declare class Liveblocks {
|
|
|
830
828
|
commentId: string;
|
|
831
829
|
data: {
|
|
832
830
|
body: CommentBody;
|
|
833
|
-
metadata?: Patchable<CM>;
|
|
834
831
|
editedAt?: Date;
|
|
835
832
|
};
|
|
836
|
-
}, options?: RequestOptions): Promise<CommentData
|
|
833
|
+
}, options?: RequestOptions): Promise<CommentData>;
|
|
837
834
|
/**
|
|
838
835
|
* Deletes a comment. Deletes a comment. If there are no remaining comments in the thread, the thread is also deleted.
|
|
839
836
|
* @param params.roomId The room ID to delete the comment in.
|
|
@@ -854,11 +851,10 @@ declare class Liveblocks {
|
|
|
854
851
|
* @param params.thread.comment.userId The user ID of the user who created the comment.
|
|
855
852
|
* @param params.thread.comment.createdAt (optional) The date the comment was created.
|
|
856
853
|
* @param params.thread.comment.body The body of the comment.
|
|
857
|
-
* @param params.thread.comment.metadata (optional) The metadata for the comment.
|
|
858
854
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
859
855
|
* @returns The created thread. The thread will be created with the specified comment as its first comment.
|
|
860
856
|
*/
|
|
861
|
-
createThread(params: CreateThreadOptions<
|
|
857
|
+
createThread(params: CreateThreadOptions<M>, options?: RequestOptions): Promise<ThreadData<M>>;
|
|
862
858
|
/**
|
|
863
859
|
* Deletes a thread and all of its comments.
|
|
864
860
|
* @param params.roomId The room ID to delete the thread in.
|
|
@@ -883,7 +879,7 @@ declare class Liveblocks {
|
|
|
883
879
|
data: {
|
|
884
880
|
userId: string;
|
|
885
881
|
};
|
|
886
|
-
}, options?: RequestOptions): Promise<ThreadData<
|
|
882
|
+
}, options?: RequestOptions): Promise<ThreadData<M>>;
|
|
887
883
|
/**
|
|
888
884
|
* Mark a thread as unresolved.
|
|
889
885
|
* @param params.roomId The room ID of the thread.
|
|
@@ -898,7 +894,7 @@ declare class Liveblocks {
|
|
|
898
894
|
data: {
|
|
899
895
|
userId: string;
|
|
900
896
|
};
|
|
901
|
-
}, options?: RequestOptions): Promise<ThreadData<
|
|
897
|
+
}, options?: RequestOptions): Promise<ThreadData<M>>;
|
|
902
898
|
/**
|
|
903
899
|
* Subscribes a user to a thread.
|
|
904
900
|
* @param params.roomId The room ID of the thread.
|
|
@@ -942,32 +938,11 @@ declare class Liveblocks {
|
|
|
942
938
|
roomId: string;
|
|
943
939
|
threadId: string;
|
|
944
940
|
data: {
|
|
945
|
-
metadata: Patchable<
|
|
946
|
-
userId: string;
|
|
947
|
-
updatedAt?: Date;
|
|
948
|
-
};
|
|
949
|
-
}, options?: RequestOptions): Promise<TM>;
|
|
950
|
-
/**
|
|
951
|
-
* Updates the metadata of the specified comment in a room.
|
|
952
|
-
* @param params.roomId The room ID to update the comment in.
|
|
953
|
-
* @param params.threadId The thread ID to update the comment in.
|
|
954
|
-
* @param params.commentId The comment ID to update.
|
|
955
|
-
* @param params.data.metadata The metadata for the comment. Value must be a string, boolean or number. Use null to delete a key.
|
|
956
|
-
* @param params.data.userId The user ID of the user who updated the comment.
|
|
957
|
-
* @param params.data.updatedAt (optional) The date the comment metadata is set to be updated.
|
|
958
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
959
|
-
* @returns The updated comment metadata.
|
|
960
|
-
*/
|
|
961
|
-
editCommentMetadata(params: {
|
|
962
|
-
roomId: string;
|
|
963
|
-
threadId: string;
|
|
964
|
-
commentId: string;
|
|
965
|
-
data: {
|
|
966
|
-
metadata: Patchable<CM>;
|
|
941
|
+
metadata: Patchable<M>;
|
|
967
942
|
userId: string;
|
|
968
943
|
updatedAt?: Date;
|
|
969
944
|
};
|
|
970
|
-
}, options?: RequestOptions): Promise<
|
|
945
|
+
}, options?: RequestOptions): Promise<M>;
|
|
971
946
|
/**
|
|
972
947
|
* Adds a new comment reaction to a comment.
|
|
973
948
|
* @param params.roomId The room ID to add the comment reaction in.
|
|
@@ -1416,7 +1391,7 @@ type WebhookRequest = {
|
|
|
1416
1391
|
* as member of the augmentation
|
|
1417
1392
|
*/
|
|
1418
1393
|
type CustomKind = `$${string}`;
|
|
1419
|
-
type WebhookEvent = StorageUpdatedEvent | UserEnteredEvent | UserLeftEvent | RoomCreatedEvent | RoomDeletedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved |
|
|
1394
|
+
type WebhookEvent = StorageUpdatedEvent | UserEnteredEvent | UserLeftEvent | RoomCreatedEvent | RoomDeletedEvent | CommentCreatedEvent | CommentEditedEvent | CommentDeletedEvent | CommentReactionAdded | CommentReactionRemoved | ThreadMetadataUpdatedEvent | NotificationEvent | ThreadCreatedEvent | ThreadDeletedEvent | ThreadMarkedAsResolvedEvent | ThreadMarkedAsUnresolvedEvent | YDocUpdatedEvent;
|
|
1420
1395
|
type StorageUpdatedEvent = {
|
|
1421
1396
|
type: "storageUpdated";
|
|
1422
1397
|
data: {
|
|
@@ -1588,25 +1563,6 @@ type ThreadMetadataUpdatedEvent = {
|
|
|
1588
1563
|
updatedBy: string;
|
|
1589
1564
|
};
|
|
1590
1565
|
};
|
|
1591
|
-
type CommentMetadataUpdatedEvent = {
|
|
1592
|
-
type: "commentMetadataUpdated";
|
|
1593
|
-
data: {
|
|
1594
|
-
projectId: string;
|
|
1595
|
-
roomId: string;
|
|
1596
|
-
threadId: string;
|
|
1597
|
-
commentId: string;
|
|
1598
|
-
/**
|
|
1599
|
-
* ISO 8601 datestring
|
|
1600
|
-
* @example "2021-03-01T12:00:00.000Z"
|
|
1601
|
-
*/
|
|
1602
|
-
updatedAt: string;
|
|
1603
|
-
/**
|
|
1604
|
-
* ISO 8601 datestring
|
|
1605
|
-
* @example "2021-03-01T12:00:00.000Z"
|
|
1606
|
-
*/
|
|
1607
|
-
updatedBy: string;
|
|
1608
|
-
};
|
|
1609
|
-
};
|
|
1610
1566
|
type ThreadCreatedEvent = {
|
|
1611
1567
|
type: "threadCreated";
|
|
1612
1568
|
data: {
|
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.13.0-
|
|
6
|
+
var PKG_VERSION = "3.13.0-rc1";
|
|
7
7
|
var PKG_FORMAT = "esm";
|
|
8
8
|
|
|
9
9
|
// src/client.ts
|
|
@@ -559,7 +559,8 @@ var Liveblocks = class {
|
|
|
559
559
|
groupsAccesses,
|
|
560
560
|
usersAccesses,
|
|
561
561
|
metadata,
|
|
562
|
-
tenantId
|
|
562
|
+
tenantId,
|
|
563
|
+
engine
|
|
563
564
|
} = params;
|
|
564
565
|
const res = await this.#post(
|
|
565
566
|
options?.idempotent ? url2`/v2/rooms?idempotent` : url2`/v2/rooms`,
|
|
@@ -569,7 +570,8 @@ var Liveblocks = class {
|
|
|
569
570
|
groupsAccesses,
|
|
570
571
|
usersAccesses,
|
|
571
572
|
tenantId,
|
|
572
|
-
metadata
|
|
573
|
+
metadata,
|
|
574
|
+
engine
|
|
573
575
|
},
|
|
574
576
|
options
|
|
575
577
|
);
|
|
@@ -988,7 +990,6 @@ var Liveblocks = class {
|
|
|
988
990
|
* @param params.data.userId The user ID of the user who is set to create the comment.
|
|
989
991
|
* @param params.data.createdAt (optional) The date the comment is set to be created.
|
|
990
992
|
* @param params.data.body The body of the comment.
|
|
991
|
-
* @param params.data.metadata (optional) The metadata for the comment.
|
|
992
993
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
993
994
|
* @returns The created comment.
|
|
994
995
|
*/
|
|
@@ -1013,7 +1014,6 @@ var Liveblocks = class {
|
|
|
1013
1014
|
* @param params.threadId The thread ID to edit the comment in.
|
|
1014
1015
|
* @param params.commentId The comment ID to edit.
|
|
1015
1016
|
* @param params.data.body The body of the comment.
|
|
1016
|
-
* @param params.data.metadata (optional) The metadata for the comment. Value must be a string, boolean or number. Use null to delete a key.
|
|
1017
1017
|
* @param params.data.editedAt (optional) The date the comment was edited.
|
|
1018
1018
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1019
1019
|
* @returns The edited comment.
|
|
@@ -1022,11 +1022,7 @@ var Liveblocks = class {
|
|
|
1022
1022
|
const { roomId, threadId, commentId, data } = params;
|
|
1023
1023
|
const res = await this.#post(
|
|
1024
1024
|
url2`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}`,
|
|
1025
|
-
{
|
|
1026
|
-
body: data.body,
|
|
1027
|
-
editedAt: data.editedAt?.toISOString(),
|
|
1028
|
-
metadata: data.metadata
|
|
1029
|
-
},
|
|
1025
|
+
{ ...data, editedAt: data.editedAt?.toISOString() },
|
|
1030
1026
|
options
|
|
1031
1027
|
);
|
|
1032
1028
|
if (!res.ok) {
|
|
@@ -1060,7 +1056,6 @@ var Liveblocks = class {
|
|
|
1060
1056
|
* @param params.thread.comment.userId The user ID of the user who created the comment.
|
|
1061
1057
|
* @param params.thread.comment.createdAt (optional) The date the comment was created.
|
|
1062
1058
|
* @param params.thread.comment.body The body of the comment.
|
|
1063
|
-
* @param params.thread.comment.metadata (optional) The metadata for the comment.
|
|
1064
1059
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1065
1060
|
* @returns The created thread. The thread will be created with the specified comment as its first comment.
|
|
1066
1061
|
*/
|
|
@@ -1204,32 +1199,6 @@ var Liveblocks = class {
|
|
|
1204
1199
|
}
|
|
1205
1200
|
return await res.json();
|
|
1206
1201
|
}
|
|
1207
|
-
/**
|
|
1208
|
-
* Updates the metadata of the specified comment in a room.
|
|
1209
|
-
* @param params.roomId The room ID to update the comment in.
|
|
1210
|
-
* @param params.threadId The thread ID to update the comment in.
|
|
1211
|
-
* @param params.commentId The comment ID to update.
|
|
1212
|
-
* @param params.data.metadata The metadata for the comment. Value must be a string, boolean or number. Use null to delete a key.
|
|
1213
|
-
* @param params.data.userId The user ID of the user who updated the comment.
|
|
1214
|
-
* @param params.data.updatedAt (optional) The date the comment metadata is set to be updated.
|
|
1215
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1216
|
-
* @returns The updated comment metadata.
|
|
1217
|
-
*/
|
|
1218
|
-
async editCommentMetadata(params, options) {
|
|
1219
|
-
const { roomId, threadId, commentId, data } = params;
|
|
1220
|
-
const res = await this.#post(
|
|
1221
|
-
url2`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}/metadata`,
|
|
1222
|
-
{
|
|
1223
|
-
...data,
|
|
1224
|
-
updatedAt: data.updatedAt?.toISOString()
|
|
1225
|
-
},
|
|
1226
|
-
options
|
|
1227
|
-
);
|
|
1228
|
-
if (!res.ok) {
|
|
1229
|
-
throw await LiveblocksError.from(res);
|
|
1230
|
-
}
|
|
1231
|
-
return await res.json();
|
|
1232
|
-
}
|
|
1233
1202
|
/**
|
|
1234
1203
|
* Adds a new comment reaction to a comment.
|
|
1235
1204
|
* @param params.roomId The room ID to add the comment reaction in.
|
|
@@ -2230,7 +2199,6 @@ var WebhookHandler = class _WebhookHandler {
|
|
|
2230
2199
|
"commentDeleted",
|
|
2231
2200
|
"commentReactionAdded",
|
|
2232
2201
|
"commentReactionRemoved",
|
|
2233
|
-
"commentMetadataUpdated",
|
|
2234
2202
|
"threadMetadataUpdated",
|
|
2235
2203
|
"threadCreated",
|
|
2236
2204
|
"threadDeleted",
|