@liveblocks/core 2.7.0-beta2 → 2.7.0-versions2
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.d.mts +42 -102
- package/dist/index.d.ts +42 -102
- package/dist/index.js +87 -206
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +57 -176
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -851,52 +851,6 @@ declare type CommentReaction = {
|
|
|
851
851
|
id: string;
|
|
852
852
|
}[];
|
|
853
853
|
};
|
|
854
|
-
declare type CommentAttachment = {
|
|
855
|
-
type: "attachment";
|
|
856
|
-
id: string;
|
|
857
|
-
name: string;
|
|
858
|
-
size: number;
|
|
859
|
-
mimeType: string;
|
|
860
|
-
};
|
|
861
|
-
declare type CommentLocalAttachmentIdle = {
|
|
862
|
-
type: "localAttachment";
|
|
863
|
-
status: "idle";
|
|
864
|
-
id: string;
|
|
865
|
-
name: string;
|
|
866
|
-
size: number;
|
|
867
|
-
mimeType: string;
|
|
868
|
-
file: File;
|
|
869
|
-
};
|
|
870
|
-
declare type CommentLocalAttachmentUploading = {
|
|
871
|
-
type: "localAttachment";
|
|
872
|
-
status: "uploading";
|
|
873
|
-
id: string;
|
|
874
|
-
name: string;
|
|
875
|
-
size: number;
|
|
876
|
-
mimeType: string;
|
|
877
|
-
file: File;
|
|
878
|
-
};
|
|
879
|
-
declare type CommentLocalAttachmentUploaded = {
|
|
880
|
-
type: "localAttachment";
|
|
881
|
-
status: "uploaded";
|
|
882
|
-
id: string;
|
|
883
|
-
name: string;
|
|
884
|
-
size: number;
|
|
885
|
-
mimeType: string;
|
|
886
|
-
file: File;
|
|
887
|
-
};
|
|
888
|
-
declare type CommentLocalAttachmentError = {
|
|
889
|
-
type: "localAttachment";
|
|
890
|
-
status: "error";
|
|
891
|
-
id: string;
|
|
892
|
-
name: string;
|
|
893
|
-
size: number;
|
|
894
|
-
mimeType: string;
|
|
895
|
-
file: File;
|
|
896
|
-
error: Error;
|
|
897
|
-
};
|
|
898
|
-
declare type CommentLocalAttachment = CommentLocalAttachmentIdle | CommentLocalAttachmentUploading | CommentLocalAttachmentUploaded | CommentLocalAttachmentError;
|
|
899
|
-
declare type CommentMixedAttachment = CommentAttachment | CommentLocalAttachment;
|
|
900
854
|
/**
|
|
901
855
|
* Represents a comment.
|
|
902
856
|
*/
|
|
@@ -909,7 +863,6 @@ declare type CommentData = {
|
|
|
909
863
|
createdAt: Date;
|
|
910
864
|
editedAt?: Date;
|
|
911
865
|
reactions: CommentReaction[];
|
|
912
|
-
attachments: CommentAttachment[];
|
|
913
866
|
} & ({
|
|
914
867
|
body: CommentBody;
|
|
915
868
|
deletedAt?: never;
|
|
@@ -1042,29 +995,6 @@ declare type KDAD = keyof DAD extends `$${string}` ? keyof DAD : "Custom notific
|
|
|
1042
995
|
*/
|
|
1043
996
|
declare const kInternal: unique symbol;
|
|
1044
997
|
|
|
1045
|
-
declare type RenameDataField<T, TFieldName extends string> = T extends any ? {
|
|
1046
|
-
[K in keyof T as K extends "data" ? TFieldName : K]: T[K];
|
|
1047
|
-
} : never;
|
|
1048
|
-
declare type AsyncResult<T> = {
|
|
1049
|
-
readonly isLoading: true;
|
|
1050
|
-
readonly data?: never;
|
|
1051
|
-
readonly error?: never;
|
|
1052
|
-
} | {
|
|
1053
|
-
readonly isLoading: false;
|
|
1054
|
-
readonly data: T;
|
|
1055
|
-
readonly error?: never;
|
|
1056
|
-
} | {
|
|
1057
|
-
readonly isLoading: false;
|
|
1058
|
-
readonly data?: never;
|
|
1059
|
-
readonly error: Error;
|
|
1060
|
-
};
|
|
1061
|
-
declare type AsyncResultWithDataField<T, TDataField extends string> = RenameDataField<AsyncResult<T>, TDataField>;
|
|
1062
|
-
|
|
1063
|
-
declare type BatchStore<O, I> = Observable<void> & {
|
|
1064
|
-
get: (input: I) => Promise<void>;
|
|
1065
|
-
getState: (input: I) => AsyncResult<O> | undefined;
|
|
1066
|
-
};
|
|
1067
|
-
|
|
1068
998
|
declare enum ClientMsgCode {
|
|
1069
999
|
UPDATE_PRESENCE = 100,
|
|
1070
1000
|
BROADCAST_EVENT = 103,
|
|
@@ -1793,9 +1723,6 @@ declare type GetThreadsOptions<M extends BaseMetadata> = {
|
|
|
1793
1723
|
metadata?: Partial<QueryMetadata<M>>;
|
|
1794
1724
|
};
|
|
1795
1725
|
};
|
|
1796
|
-
declare type UploadAttachmentOptions = {
|
|
1797
|
-
signal?: AbortSignal;
|
|
1798
|
-
};
|
|
1799
1726
|
/**
|
|
1800
1727
|
* @private Widest-possible Room type, matching _any_ Room instance. Note that
|
|
1801
1728
|
* this type is different from `Room`-without-type-arguments. That represents
|
|
@@ -2067,7 +1994,6 @@ declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extend
|
|
|
2067
1994
|
commentId?: string;
|
|
2068
1995
|
metadata: M | undefined;
|
|
2069
1996
|
body: CommentBody;
|
|
2070
|
-
attachmentIds?: string[];
|
|
2071
1997
|
}): Promise<ThreadData<M>>;
|
|
2072
1998
|
/**
|
|
2073
1999
|
* Deletes a thread.
|
|
@@ -2117,7 +2043,6 @@ declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extend
|
|
|
2117
2043
|
threadId: string;
|
|
2118
2044
|
commentId?: string;
|
|
2119
2045
|
body: CommentBody;
|
|
2120
|
-
attachmentIds?: string[];
|
|
2121
2046
|
}): Promise<CommentData>;
|
|
2122
2047
|
/**
|
|
2123
2048
|
* Edits a comment.
|
|
@@ -2136,7 +2061,6 @@ declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extend
|
|
|
2136
2061
|
threadId: string;
|
|
2137
2062
|
commentId: string;
|
|
2138
2063
|
body: CommentBody;
|
|
2139
|
-
attachmentIds?: string[];
|
|
2140
2064
|
}): Promise<CommentData>;
|
|
2141
2065
|
/**
|
|
2142
2066
|
* Deletes a comment.
|
|
@@ -2174,28 +2098,6 @@ declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extend
|
|
|
2174
2098
|
commentId: string;
|
|
2175
2099
|
emoji: string;
|
|
2176
2100
|
}): Promise<void>;
|
|
2177
|
-
/**
|
|
2178
|
-
* Creates a local attachment from a file.
|
|
2179
|
-
*
|
|
2180
|
-
* @example
|
|
2181
|
-
* room.prepareAttachment(file);
|
|
2182
|
-
*/
|
|
2183
|
-
prepareAttachment(file: File): CommentLocalAttachment;
|
|
2184
|
-
/**
|
|
2185
|
-
* Uploads a local attachment.
|
|
2186
|
-
*
|
|
2187
|
-
* @example
|
|
2188
|
-
* const attachment = room.prepareAttachment(file);
|
|
2189
|
-
* await room.uploadAttachment(attachment);
|
|
2190
|
-
*/
|
|
2191
|
-
uploadAttachment(attachment: CommentLocalAttachment, options?: UploadAttachmentOptions): Promise<CommentAttachment>;
|
|
2192
|
-
/**
|
|
2193
|
-
* Returns a presigned URL for an attachment by its ID.
|
|
2194
|
-
*
|
|
2195
|
-
* @example
|
|
2196
|
-
* await room.getAttachmentUrl("at_xxx");
|
|
2197
|
-
*/
|
|
2198
|
-
getAttachmentUrl(attachmentId: string): Promise<string>;
|
|
2199
2101
|
/**
|
|
2200
2102
|
* Gets the user's notification settings for the current room.
|
|
2201
2103
|
*
|
|
@@ -2241,11 +2143,13 @@ declare type PrivateRoomApi = {
|
|
|
2241
2143
|
reportTextEditor(editor: "lexical", rootKey: string): void;
|
|
2242
2144
|
createTextMention(userId: string, mentionId: string): Promise<Response>;
|
|
2243
2145
|
deleteTextMention(mentionId: string): Promise<Response>;
|
|
2146
|
+
listTextVersions(): Promise<Response>;
|
|
2147
|
+
getTextVersion(versionId: string): Promise<Response>;
|
|
2148
|
+
createTextVersion(): Promise<Response>;
|
|
2244
2149
|
simulate: {
|
|
2245
2150
|
explicitClose(event: IWebSocketCloseEvent): void;
|
|
2246
2151
|
rawSend(data: string): void;
|
|
2247
2152
|
};
|
|
2248
|
-
attachmentUrlsStore: BatchStore<string, string>;
|
|
2249
2153
|
};
|
|
2250
2154
|
declare type HistoryOp<P extends JsonObject> = Op | {
|
|
2251
2155
|
readonly type: "presence";
|
|
@@ -2285,6 +2189,29 @@ declare class CommentsApiError extends Error {
|
|
|
2285
2189
|
constructor(message: string, status: number, details?: JsonObject | undefined);
|
|
2286
2190
|
}
|
|
2287
2191
|
|
|
2192
|
+
declare type RenameDataField<T, TFieldName extends string> = T extends any ? {
|
|
2193
|
+
[K in keyof T as K extends "data" ? TFieldName : K]: T[K];
|
|
2194
|
+
} : never;
|
|
2195
|
+
declare type AsyncResult<T> = {
|
|
2196
|
+
readonly isLoading: true;
|
|
2197
|
+
readonly data?: never;
|
|
2198
|
+
readonly error?: never;
|
|
2199
|
+
} | {
|
|
2200
|
+
readonly isLoading: false;
|
|
2201
|
+
readonly data: T;
|
|
2202
|
+
readonly error?: never;
|
|
2203
|
+
} | {
|
|
2204
|
+
readonly isLoading: false;
|
|
2205
|
+
readonly data?: never;
|
|
2206
|
+
readonly error: Error;
|
|
2207
|
+
};
|
|
2208
|
+
declare type AsyncResultWithDataField<T, TDataField extends string> = RenameDataField<AsyncResult<T>, TDataField>;
|
|
2209
|
+
|
|
2210
|
+
declare type BatchStore<O, I> = Observable<void> & {
|
|
2211
|
+
get: (input: I) => Promise<void>;
|
|
2212
|
+
getState: (input: I) => AsyncResult<O> | undefined;
|
|
2213
|
+
};
|
|
2214
|
+
|
|
2288
2215
|
declare type Store<T> = {
|
|
2289
2216
|
get: () => T;
|
|
2290
2217
|
set: (callback: (currentState: T) => T) => void;
|
|
@@ -2297,6 +2224,16 @@ declare type Store<T> = {
|
|
|
2297
2224
|
*/
|
|
2298
2225
|
declare type NoInfr<A> = [A][A extends any ? 0 : never];
|
|
2299
2226
|
|
|
2227
|
+
declare type HistoryVersion = {
|
|
2228
|
+
type: "historyVersion";
|
|
2229
|
+
kind: "yjs";
|
|
2230
|
+
createdAt: Date;
|
|
2231
|
+
id: string;
|
|
2232
|
+
authors: {
|
|
2233
|
+
id: string;
|
|
2234
|
+
}[];
|
|
2235
|
+
};
|
|
2236
|
+
|
|
2300
2237
|
declare type OptimisticUpdate<M extends BaseMetadata> = CreateThreadOptimisticUpdate<M> | DeleteThreadOptimisticUpdate | EditThreadMetadataOptimisticUpdate<M> | MarkThreadAsResolvedOptimisticUpdate | MarkThreadAsUnresolvedOptimisticUpdate | CreateCommentOptimisticUpdate | EditCommentOptimisticUpdate | DeleteCommentOptimisticUpdate | AddReactionOptimisticUpdate | RemoveReactionOptimisticUpdate | MarkInboxNotificationAsReadOptimisticUpdate | MarkAllInboxNotificationsAsReadOptimisticUpdate | DeleteInboxNotificationOptimisticUpdate | DeleteAllInboxNotificationsOptimisticUpdate | UpdateNotificationSettingsOptimisticUpdate;
|
|
2301
2238
|
declare type CreateThreadOptimisticUpdate<M extends BaseMetadata> = {
|
|
2302
2239
|
type: "create-thread";
|
|
@@ -2415,12 +2352,17 @@ declare type CacheState<M extends BaseMetadata> = {
|
|
|
2415
2352
|
* Notification settings per room id
|
|
2416
2353
|
*/
|
|
2417
2354
|
notificationSettings: Record<string, RoomNotificationSettings>;
|
|
2355
|
+
/**
|
|
2356
|
+
* Versions per roomId
|
|
2357
|
+
*/
|
|
2358
|
+
versions: Record<string, HistoryVersion[]>;
|
|
2418
2359
|
};
|
|
2419
2360
|
interface CacheStore<M extends BaseMetadata> extends Store<CacheState<M>> {
|
|
2420
2361
|
deleteThread(threadId: string): void;
|
|
2421
2362
|
updateThreadAndNotification(thread: ThreadData<M>, inboxNotification?: InboxNotificationData): void;
|
|
2422
2363
|
updateThreadsAndNotifications(threads: ThreadData<M>[], inboxNotifications: InboxNotificationData[], deletedThreads: ThreadDeleteInfo[], deletedInboxNotifications: InboxNotificationDeleteInfo[], queryKey?: string): void;
|
|
2423
2364
|
updateRoomInboxNotificationSettings(roomId: string, settings: RoomNotificationSettings, queryKey: string): void;
|
|
2365
|
+
updateRoomVersions(roomId: string, versions: HistoryVersion[], queryKey: string): void;
|
|
2424
2366
|
pushOptimisticUpdate(optimisticUpdate: OptimisticUpdate<M>): void;
|
|
2425
2367
|
setQueryState(queryKey: string, queryState: QueryState): void;
|
|
2426
2368
|
optimisticUpdatesEventSource: ReturnType<typeof makeEventSource<OptimisticUpdate<M>>>;
|
|
@@ -2872,8 +2814,6 @@ declare function assert(condition: boolean, errmsg: string): asserts condition;
|
|
|
2872
2814
|
*/
|
|
2873
2815
|
declare function nn<T>(value: T, errmsg?: string): NonNullable<T>;
|
|
2874
2816
|
|
|
2875
|
-
declare function chunk<T>(array: T[], size: number): T[][];
|
|
2876
|
-
|
|
2877
2817
|
declare function createThreadId(): string;
|
|
2878
2818
|
declare function createCommentId(): string;
|
|
2879
2819
|
declare function createInboxNotificationId(): string;
|
|
@@ -3216,4 +3156,4 @@ declare type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (En
|
|
|
3216
3156
|
[K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
|
|
3217
3157
|
};
|
|
3218
3158
|
|
|
3219
|
-
export { type AckOp, type ActivityData, type AsyncResult, type AsyncResultWithDataField, type BaseActivitiesData, type BaseAuthResult, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type CacheState, type CacheStore, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type
|
|
3159
|
+
export { type AckOp, type ActivityData, type AsyncResult, type AsyncResultWithDataField, type BaseActivitiesData, type BaseAuthResult, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type CacheState, type CacheStore, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, CommentsApiError, type CommentsEventServerMsg, CrdtType, type CreateListOp, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CustomAuthenticationResult, type DAD, type DE, type DM, type DP, type DRI, type DS, type DU, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type History, type HistoryVersion, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IdTuple, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LostConnectionEvent, type Lson, type LsonObject, type NoInfr, type NodeMap, NotificationsApiError, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalPromise, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialUnless, type Patchable, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type PrivateClientApi, type PrivateRoomApi, type QueryMetadata, type RejectedStorageOpServerMsg, type Resolve, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomNotificationSettings, type RoomStateServerMsg, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type SetParentKeyOp, type Status, type StorageStatus, type StorageUpdate, type Store, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type ThreadData, type ThreadDataPlain, type ThreadDeleteInfo, type ToImmutable, type ToJson, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type User, type UserJoinServerMsg, type UserLeftServerMsg, WebsocketCloseCodes, type YDocUpdateServerMsg, ackOp, addReaction, applyOptimisticUpdates, asPos, assert, assertNever, b64decode, cloneLson, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToThreadData, createClient, createCommentId, createInboxNotificationId, createThreadId, deleteComment, deprecate, deprecateIf, detectDupes, errorIf, freeze, getMentionedIdsFromCommentBody, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, kInternal, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, raise, removeReaction, shallow, stringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, upsertComment, wait, withTimeout };
|
package/dist/index.d.ts
CHANGED
|
@@ -851,52 +851,6 @@ declare type CommentReaction = {
|
|
|
851
851
|
id: string;
|
|
852
852
|
}[];
|
|
853
853
|
};
|
|
854
|
-
declare type CommentAttachment = {
|
|
855
|
-
type: "attachment";
|
|
856
|
-
id: string;
|
|
857
|
-
name: string;
|
|
858
|
-
size: number;
|
|
859
|
-
mimeType: string;
|
|
860
|
-
};
|
|
861
|
-
declare type CommentLocalAttachmentIdle = {
|
|
862
|
-
type: "localAttachment";
|
|
863
|
-
status: "idle";
|
|
864
|
-
id: string;
|
|
865
|
-
name: string;
|
|
866
|
-
size: number;
|
|
867
|
-
mimeType: string;
|
|
868
|
-
file: File;
|
|
869
|
-
};
|
|
870
|
-
declare type CommentLocalAttachmentUploading = {
|
|
871
|
-
type: "localAttachment";
|
|
872
|
-
status: "uploading";
|
|
873
|
-
id: string;
|
|
874
|
-
name: string;
|
|
875
|
-
size: number;
|
|
876
|
-
mimeType: string;
|
|
877
|
-
file: File;
|
|
878
|
-
};
|
|
879
|
-
declare type CommentLocalAttachmentUploaded = {
|
|
880
|
-
type: "localAttachment";
|
|
881
|
-
status: "uploaded";
|
|
882
|
-
id: string;
|
|
883
|
-
name: string;
|
|
884
|
-
size: number;
|
|
885
|
-
mimeType: string;
|
|
886
|
-
file: File;
|
|
887
|
-
};
|
|
888
|
-
declare type CommentLocalAttachmentError = {
|
|
889
|
-
type: "localAttachment";
|
|
890
|
-
status: "error";
|
|
891
|
-
id: string;
|
|
892
|
-
name: string;
|
|
893
|
-
size: number;
|
|
894
|
-
mimeType: string;
|
|
895
|
-
file: File;
|
|
896
|
-
error: Error;
|
|
897
|
-
};
|
|
898
|
-
declare type CommentLocalAttachment = CommentLocalAttachmentIdle | CommentLocalAttachmentUploading | CommentLocalAttachmentUploaded | CommentLocalAttachmentError;
|
|
899
|
-
declare type CommentMixedAttachment = CommentAttachment | CommentLocalAttachment;
|
|
900
854
|
/**
|
|
901
855
|
* Represents a comment.
|
|
902
856
|
*/
|
|
@@ -909,7 +863,6 @@ declare type CommentData = {
|
|
|
909
863
|
createdAt: Date;
|
|
910
864
|
editedAt?: Date;
|
|
911
865
|
reactions: CommentReaction[];
|
|
912
|
-
attachments: CommentAttachment[];
|
|
913
866
|
} & ({
|
|
914
867
|
body: CommentBody;
|
|
915
868
|
deletedAt?: never;
|
|
@@ -1042,29 +995,6 @@ declare type KDAD = keyof DAD extends `$${string}` ? keyof DAD : "Custom notific
|
|
|
1042
995
|
*/
|
|
1043
996
|
declare const kInternal: unique symbol;
|
|
1044
997
|
|
|
1045
|
-
declare type RenameDataField<T, TFieldName extends string> = T extends any ? {
|
|
1046
|
-
[K in keyof T as K extends "data" ? TFieldName : K]: T[K];
|
|
1047
|
-
} : never;
|
|
1048
|
-
declare type AsyncResult<T> = {
|
|
1049
|
-
readonly isLoading: true;
|
|
1050
|
-
readonly data?: never;
|
|
1051
|
-
readonly error?: never;
|
|
1052
|
-
} | {
|
|
1053
|
-
readonly isLoading: false;
|
|
1054
|
-
readonly data: T;
|
|
1055
|
-
readonly error?: never;
|
|
1056
|
-
} | {
|
|
1057
|
-
readonly isLoading: false;
|
|
1058
|
-
readonly data?: never;
|
|
1059
|
-
readonly error: Error;
|
|
1060
|
-
};
|
|
1061
|
-
declare type AsyncResultWithDataField<T, TDataField extends string> = RenameDataField<AsyncResult<T>, TDataField>;
|
|
1062
|
-
|
|
1063
|
-
declare type BatchStore<O, I> = Observable<void> & {
|
|
1064
|
-
get: (input: I) => Promise<void>;
|
|
1065
|
-
getState: (input: I) => AsyncResult<O> | undefined;
|
|
1066
|
-
};
|
|
1067
|
-
|
|
1068
998
|
declare enum ClientMsgCode {
|
|
1069
999
|
UPDATE_PRESENCE = 100,
|
|
1070
1000
|
BROADCAST_EVENT = 103,
|
|
@@ -1793,9 +1723,6 @@ declare type GetThreadsOptions<M extends BaseMetadata> = {
|
|
|
1793
1723
|
metadata?: Partial<QueryMetadata<M>>;
|
|
1794
1724
|
};
|
|
1795
1725
|
};
|
|
1796
|
-
declare type UploadAttachmentOptions = {
|
|
1797
|
-
signal?: AbortSignal;
|
|
1798
|
-
};
|
|
1799
1726
|
/**
|
|
1800
1727
|
* @private Widest-possible Room type, matching _any_ Room instance. Note that
|
|
1801
1728
|
* this type is different from `Room`-without-type-arguments. That represents
|
|
@@ -2067,7 +1994,6 @@ declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extend
|
|
|
2067
1994
|
commentId?: string;
|
|
2068
1995
|
metadata: M | undefined;
|
|
2069
1996
|
body: CommentBody;
|
|
2070
|
-
attachmentIds?: string[];
|
|
2071
1997
|
}): Promise<ThreadData<M>>;
|
|
2072
1998
|
/**
|
|
2073
1999
|
* Deletes a thread.
|
|
@@ -2117,7 +2043,6 @@ declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extend
|
|
|
2117
2043
|
threadId: string;
|
|
2118
2044
|
commentId?: string;
|
|
2119
2045
|
body: CommentBody;
|
|
2120
|
-
attachmentIds?: string[];
|
|
2121
2046
|
}): Promise<CommentData>;
|
|
2122
2047
|
/**
|
|
2123
2048
|
* Edits a comment.
|
|
@@ -2136,7 +2061,6 @@ declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extend
|
|
|
2136
2061
|
threadId: string;
|
|
2137
2062
|
commentId: string;
|
|
2138
2063
|
body: CommentBody;
|
|
2139
|
-
attachmentIds?: string[];
|
|
2140
2064
|
}): Promise<CommentData>;
|
|
2141
2065
|
/**
|
|
2142
2066
|
* Deletes a comment.
|
|
@@ -2174,28 +2098,6 @@ declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extend
|
|
|
2174
2098
|
commentId: string;
|
|
2175
2099
|
emoji: string;
|
|
2176
2100
|
}): Promise<void>;
|
|
2177
|
-
/**
|
|
2178
|
-
* Creates a local attachment from a file.
|
|
2179
|
-
*
|
|
2180
|
-
* @example
|
|
2181
|
-
* room.prepareAttachment(file);
|
|
2182
|
-
*/
|
|
2183
|
-
prepareAttachment(file: File): CommentLocalAttachment;
|
|
2184
|
-
/**
|
|
2185
|
-
* Uploads a local attachment.
|
|
2186
|
-
*
|
|
2187
|
-
* @example
|
|
2188
|
-
* const attachment = room.prepareAttachment(file);
|
|
2189
|
-
* await room.uploadAttachment(attachment);
|
|
2190
|
-
*/
|
|
2191
|
-
uploadAttachment(attachment: CommentLocalAttachment, options?: UploadAttachmentOptions): Promise<CommentAttachment>;
|
|
2192
|
-
/**
|
|
2193
|
-
* Returns a presigned URL for an attachment by its ID.
|
|
2194
|
-
*
|
|
2195
|
-
* @example
|
|
2196
|
-
* await room.getAttachmentUrl("at_xxx");
|
|
2197
|
-
*/
|
|
2198
|
-
getAttachmentUrl(attachmentId: string): Promise<string>;
|
|
2199
2101
|
/**
|
|
2200
2102
|
* Gets the user's notification settings for the current room.
|
|
2201
2103
|
*
|
|
@@ -2241,11 +2143,13 @@ declare type PrivateRoomApi = {
|
|
|
2241
2143
|
reportTextEditor(editor: "lexical", rootKey: string): void;
|
|
2242
2144
|
createTextMention(userId: string, mentionId: string): Promise<Response>;
|
|
2243
2145
|
deleteTextMention(mentionId: string): Promise<Response>;
|
|
2146
|
+
listTextVersions(): Promise<Response>;
|
|
2147
|
+
getTextVersion(versionId: string): Promise<Response>;
|
|
2148
|
+
createTextVersion(): Promise<Response>;
|
|
2244
2149
|
simulate: {
|
|
2245
2150
|
explicitClose(event: IWebSocketCloseEvent): void;
|
|
2246
2151
|
rawSend(data: string): void;
|
|
2247
2152
|
};
|
|
2248
|
-
attachmentUrlsStore: BatchStore<string, string>;
|
|
2249
2153
|
};
|
|
2250
2154
|
declare type HistoryOp<P extends JsonObject> = Op | {
|
|
2251
2155
|
readonly type: "presence";
|
|
@@ -2285,6 +2189,29 @@ declare class CommentsApiError extends Error {
|
|
|
2285
2189
|
constructor(message: string, status: number, details?: JsonObject | undefined);
|
|
2286
2190
|
}
|
|
2287
2191
|
|
|
2192
|
+
declare type RenameDataField<T, TFieldName extends string> = T extends any ? {
|
|
2193
|
+
[K in keyof T as K extends "data" ? TFieldName : K]: T[K];
|
|
2194
|
+
} : never;
|
|
2195
|
+
declare type AsyncResult<T> = {
|
|
2196
|
+
readonly isLoading: true;
|
|
2197
|
+
readonly data?: never;
|
|
2198
|
+
readonly error?: never;
|
|
2199
|
+
} | {
|
|
2200
|
+
readonly isLoading: false;
|
|
2201
|
+
readonly data: T;
|
|
2202
|
+
readonly error?: never;
|
|
2203
|
+
} | {
|
|
2204
|
+
readonly isLoading: false;
|
|
2205
|
+
readonly data?: never;
|
|
2206
|
+
readonly error: Error;
|
|
2207
|
+
};
|
|
2208
|
+
declare type AsyncResultWithDataField<T, TDataField extends string> = RenameDataField<AsyncResult<T>, TDataField>;
|
|
2209
|
+
|
|
2210
|
+
declare type BatchStore<O, I> = Observable<void> & {
|
|
2211
|
+
get: (input: I) => Promise<void>;
|
|
2212
|
+
getState: (input: I) => AsyncResult<O> | undefined;
|
|
2213
|
+
};
|
|
2214
|
+
|
|
2288
2215
|
declare type Store<T> = {
|
|
2289
2216
|
get: () => T;
|
|
2290
2217
|
set: (callback: (currentState: T) => T) => void;
|
|
@@ -2297,6 +2224,16 @@ declare type Store<T> = {
|
|
|
2297
2224
|
*/
|
|
2298
2225
|
declare type NoInfr<A> = [A][A extends any ? 0 : never];
|
|
2299
2226
|
|
|
2227
|
+
declare type HistoryVersion = {
|
|
2228
|
+
type: "historyVersion";
|
|
2229
|
+
kind: "yjs";
|
|
2230
|
+
createdAt: Date;
|
|
2231
|
+
id: string;
|
|
2232
|
+
authors: {
|
|
2233
|
+
id: string;
|
|
2234
|
+
}[];
|
|
2235
|
+
};
|
|
2236
|
+
|
|
2300
2237
|
declare type OptimisticUpdate<M extends BaseMetadata> = CreateThreadOptimisticUpdate<M> | DeleteThreadOptimisticUpdate | EditThreadMetadataOptimisticUpdate<M> | MarkThreadAsResolvedOptimisticUpdate | MarkThreadAsUnresolvedOptimisticUpdate | CreateCommentOptimisticUpdate | EditCommentOptimisticUpdate | DeleteCommentOptimisticUpdate | AddReactionOptimisticUpdate | RemoveReactionOptimisticUpdate | MarkInboxNotificationAsReadOptimisticUpdate | MarkAllInboxNotificationsAsReadOptimisticUpdate | DeleteInboxNotificationOptimisticUpdate | DeleteAllInboxNotificationsOptimisticUpdate | UpdateNotificationSettingsOptimisticUpdate;
|
|
2301
2238
|
declare type CreateThreadOptimisticUpdate<M extends BaseMetadata> = {
|
|
2302
2239
|
type: "create-thread";
|
|
@@ -2415,12 +2352,17 @@ declare type CacheState<M extends BaseMetadata> = {
|
|
|
2415
2352
|
* Notification settings per room id
|
|
2416
2353
|
*/
|
|
2417
2354
|
notificationSettings: Record<string, RoomNotificationSettings>;
|
|
2355
|
+
/**
|
|
2356
|
+
* Versions per roomId
|
|
2357
|
+
*/
|
|
2358
|
+
versions: Record<string, HistoryVersion[]>;
|
|
2418
2359
|
};
|
|
2419
2360
|
interface CacheStore<M extends BaseMetadata> extends Store<CacheState<M>> {
|
|
2420
2361
|
deleteThread(threadId: string): void;
|
|
2421
2362
|
updateThreadAndNotification(thread: ThreadData<M>, inboxNotification?: InboxNotificationData): void;
|
|
2422
2363
|
updateThreadsAndNotifications(threads: ThreadData<M>[], inboxNotifications: InboxNotificationData[], deletedThreads: ThreadDeleteInfo[], deletedInboxNotifications: InboxNotificationDeleteInfo[], queryKey?: string): void;
|
|
2423
2364
|
updateRoomInboxNotificationSettings(roomId: string, settings: RoomNotificationSettings, queryKey: string): void;
|
|
2365
|
+
updateRoomVersions(roomId: string, versions: HistoryVersion[], queryKey: string): void;
|
|
2424
2366
|
pushOptimisticUpdate(optimisticUpdate: OptimisticUpdate<M>): void;
|
|
2425
2367
|
setQueryState(queryKey: string, queryState: QueryState): void;
|
|
2426
2368
|
optimisticUpdatesEventSource: ReturnType<typeof makeEventSource<OptimisticUpdate<M>>>;
|
|
@@ -2872,8 +2814,6 @@ declare function assert(condition: boolean, errmsg: string): asserts condition;
|
|
|
2872
2814
|
*/
|
|
2873
2815
|
declare function nn<T>(value: T, errmsg?: string): NonNullable<T>;
|
|
2874
2816
|
|
|
2875
|
-
declare function chunk<T>(array: T[], size: number): T[][];
|
|
2876
|
-
|
|
2877
2817
|
declare function createThreadId(): string;
|
|
2878
2818
|
declare function createCommentId(): string;
|
|
2879
2819
|
declare function createInboxNotificationId(): string;
|
|
@@ -3216,4 +3156,4 @@ declare type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (En
|
|
|
3216
3156
|
[K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
|
|
3217
3157
|
};
|
|
3218
3158
|
|
|
3219
|
-
export { type AckOp, type ActivityData, type AsyncResult, type AsyncResultWithDataField, type BaseActivitiesData, type BaseAuthResult, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type CacheState, type CacheStore, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type
|
|
3159
|
+
export { type AckOp, type ActivityData, type AsyncResult, type AsyncResultWithDataField, type BaseActivitiesData, type BaseAuthResult, type BaseMetadata, type BaseRoomInfo, type BaseUserMeta, type Brand, type BroadcastEventClientMsg, type BroadcastOptions, type BroadcastedEventServerMsg, type CacheState, type CacheStore, type Client, type ClientMsg, ClientMsgCode, type ClientOptions, type CommentBody, type CommentBodyBlockElement, type CommentBodyElement, type CommentBodyInlineElement, type CommentBodyLink, type CommentBodyLinkElementArgs, type CommentBodyMention, type CommentBodyMentionElementArgs, type CommentBodyParagraph, type CommentBodyParagraphElementArgs, type CommentBodyText, type CommentBodyTextElementArgs, type CommentData, type CommentDataPlain, type CommentReaction, type CommentUserReaction, type CommentUserReactionPlain, CommentsApiError, type CommentsEventServerMsg, CrdtType, type CreateListOp, type CreateMapOp, type CreateObjectOp, type CreateOp, type CreateRegisterOp, type CustomAuthenticationResult, type DAD, type DE, type DM, type DP, type DRI, type DS, type DU, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type History, type HistoryVersion, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IdTuple, type Immutable, type InboxNotificationCustomData, type InboxNotificationCustomDataPlain, type InboxNotificationData, type InboxNotificationDataPlain, type InboxNotificationDeleteInfo, type InboxNotificationTextMentionData, type InboxNotificationTextMentionDataPlain, type InboxNotificationThreadData, type InboxNotificationThreadDataPlain, type InitialDocumentStateServerMsg, type Json, type JsonArray, type JsonObject, type JsonScalar, type KDAD, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LostConnectionEvent, type Lson, type LsonObject, type NoInfr, type NodeMap, NotificationsApiError, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalPromise, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialUnless, type Patchable, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type PrivateClientApi, type PrivateRoomApi, type QueryMetadata, type RejectedStorageOpServerMsg, type Resolve, type ResolveMentionSuggestionsArgs, type ResolveRoomsInfoArgs, type ResolveUsersArgs, type Room, type RoomEventMessage, type RoomNotificationSettings, type RoomStateServerMsg, type SerializedChild, type SerializedCrdt, type SerializedList, type SerializedMap, type SerializedObject, type SerializedRegister, type SerializedRootObject, type ServerMsg, ServerMsgCode, type SetParentKeyOp, type Status, type StorageStatus, type StorageUpdate, type Store, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type ThreadData, type ThreadDataPlain, type ThreadDeleteInfo, type ToImmutable, type ToJson, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type User, type UserJoinServerMsg, type UserLeftServerMsg, WebsocketCloseCodes, type YDocUpdateServerMsg, ackOp, addReaction, applyOptimisticUpdates, asPos, assert, assertNever, b64decode, cloneLson, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToThreadData, createClient, createCommentId, createInboxNotificationId, createThreadId, deleteComment, deprecate, deprecateIf, detectDupes, errorIf, freeze, getMentionedIdsFromCommentBody, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, kInternal, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, raise, removeReaction, shallow, stringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, upsertComment, wait, withTimeout };
|