@liveblocks/core 2.7.1 → 2.8.0-beta1
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 +102 -24
- package/dist/index.d.ts +102 -24
- package/dist/index.js +198 -37
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +173 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -851,6 +851,52 @@ 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;
|
|
854
900
|
/**
|
|
855
901
|
* Represents a comment.
|
|
856
902
|
*/
|
|
@@ -863,6 +909,7 @@ declare type CommentData = {
|
|
|
863
909
|
createdAt: Date;
|
|
864
910
|
editedAt?: Date;
|
|
865
911
|
reactions: CommentReaction[];
|
|
912
|
+
attachments: CommentAttachment[];
|
|
866
913
|
} & ({
|
|
867
914
|
body: CommentBody;
|
|
868
915
|
deletedAt?: never;
|
|
@@ -995,6 +1042,29 @@ declare type KDAD = keyof DAD extends `$${string}` ? keyof DAD : "Custom notific
|
|
|
995
1042
|
*/
|
|
996
1043
|
declare const kInternal: unique symbol;
|
|
997
1044
|
|
|
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
|
+
|
|
998
1068
|
declare enum ClientMsgCode {
|
|
999
1069
|
UPDATE_PRESENCE = 100,
|
|
1000
1070
|
BROADCAST_EVENT = 103,
|
|
@@ -1723,6 +1793,9 @@ declare type GetThreadsOptions<M extends BaseMetadata> = {
|
|
|
1723
1793
|
metadata?: Partial<QueryMetadata<M>>;
|
|
1724
1794
|
};
|
|
1725
1795
|
};
|
|
1796
|
+
declare type UploadAttachmentOptions = {
|
|
1797
|
+
signal?: AbortSignal;
|
|
1798
|
+
};
|
|
1726
1799
|
/**
|
|
1727
1800
|
* @private Widest-possible Room type, matching _any_ Room instance. Note that
|
|
1728
1801
|
* this type is different from `Room`-without-type-arguments. That represents
|
|
@@ -1994,6 +2067,7 @@ declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extend
|
|
|
1994
2067
|
commentId?: string;
|
|
1995
2068
|
metadata: M | undefined;
|
|
1996
2069
|
body: CommentBody;
|
|
2070
|
+
attachmentIds?: string[];
|
|
1997
2071
|
}): Promise<ThreadData<M>>;
|
|
1998
2072
|
/**
|
|
1999
2073
|
* Deletes a thread.
|
|
@@ -2043,6 +2117,7 @@ declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extend
|
|
|
2043
2117
|
threadId: string;
|
|
2044
2118
|
commentId?: string;
|
|
2045
2119
|
body: CommentBody;
|
|
2120
|
+
attachmentIds?: string[];
|
|
2046
2121
|
}): Promise<CommentData>;
|
|
2047
2122
|
/**
|
|
2048
2123
|
* Edits a comment.
|
|
@@ -2061,6 +2136,7 @@ declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extend
|
|
|
2061
2136
|
threadId: string;
|
|
2062
2137
|
commentId: string;
|
|
2063
2138
|
body: CommentBody;
|
|
2139
|
+
attachmentIds?: string[];
|
|
2064
2140
|
}): Promise<CommentData>;
|
|
2065
2141
|
/**
|
|
2066
2142
|
* Deletes a comment.
|
|
@@ -2098,6 +2174,28 @@ declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extend
|
|
|
2098
2174
|
commentId: string;
|
|
2099
2175
|
emoji: string;
|
|
2100
2176
|
}): 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>;
|
|
2101
2199
|
/**
|
|
2102
2200
|
* Gets the user's notification settings for the current room.
|
|
2103
2201
|
*
|
|
@@ -2150,6 +2248,7 @@ declare type PrivateRoomApi = {
|
|
|
2150
2248
|
explicitClose(event: IWebSocketCloseEvent): void;
|
|
2151
2249
|
rawSend(data: string): void;
|
|
2152
2250
|
};
|
|
2251
|
+
attachmentUrlsStore: BatchStore<string, string>;
|
|
2153
2252
|
};
|
|
2154
2253
|
declare type HistoryOp<P extends JsonObject> = Op | {
|
|
2155
2254
|
readonly type: "presence";
|
|
@@ -2189,29 +2288,6 @@ declare class CommentsApiError extends Error {
|
|
|
2189
2288
|
constructor(message: string, status: number, details?: JsonObject | undefined);
|
|
2190
2289
|
}
|
|
2191
2290
|
|
|
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
|
-
|
|
2215
2291
|
/**
|
|
2216
2292
|
* A Store is just a mini Zustand store.
|
|
2217
2293
|
*/
|
|
@@ -2672,6 +2748,8 @@ declare function assert(condition: boolean, errmsg: string): asserts condition;
|
|
|
2672
2748
|
*/
|
|
2673
2749
|
declare function nn<T>(value: T, errmsg?: string): NonNullable<T>;
|
|
2674
2750
|
|
|
2751
|
+
declare function chunk<T>(array: T[], size: number): T[][];
|
|
2752
|
+
|
|
2675
2753
|
declare function createThreadId(): string;
|
|
2676
2754
|
declare function createCommentId(): string;
|
|
2677
2755
|
declare function createInboxNotificationId(): string;
|
|
@@ -3040,4 +3118,4 @@ declare type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (En
|
|
|
3040
3118
|
[K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
|
|
3041
3119
|
};
|
|
3042
3120
|
|
|
3043
|
-
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 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 DistributiveOmit, 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 ThreadDataWithDeleteInfo, 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, asPos, assert, assertNever, b64decode, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToThreadData, createClient, createCommentId, createInboxNotificationId, createStore, createThreadId, deprecate, deprecateIf, detectDupes, errorIf, freeze, getMentionedIdsFromCommentBody, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, kInternal, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, raise, shallow, stringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, wait, withTimeout };
|
|
3121
|
+
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 Client, type ClientMsg, ClientMsgCode, type ClientOptions, type CommentAttachment, 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 CommentLocalAttachment, type CommentMixedAttachment, 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 DistributiveOmit, 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 ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type User, type UserJoinServerMsg, type UserLeftServerMsg, WebsocketCloseCodes, type YDocUpdateServerMsg, ackOp, asPos, assert, assertNever, b64decode, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToThreadData, createClient, createCommentId, createInboxNotificationId, createStore, createThreadId, deprecate, deprecateIf, detectDupes, errorIf, freeze, getMentionedIdsFromCommentBody, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, kInternal, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, raise, shallow, stringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, wait, withTimeout };
|
package/dist/index.d.ts
CHANGED
|
@@ -851,6 +851,52 @@ 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;
|
|
854
900
|
/**
|
|
855
901
|
* Represents a comment.
|
|
856
902
|
*/
|
|
@@ -863,6 +909,7 @@ declare type CommentData = {
|
|
|
863
909
|
createdAt: Date;
|
|
864
910
|
editedAt?: Date;
|
|
865
911
|
reactions: CommentReaction[];
|
|
912
|
+
attachments: CommentAttachment[];
|
|
866
913
|
} & ({
|
|
867
914
|
body: CommentBody;
|
|
868
915
|
deletedAt?: never;
|
|
@@ -995,6 +1042,29 @@ declare type KDAD = keyof DAD extends `$${string}` ? keyof DAD : "Custom notific
|
|
|
995
1042
|
*/
|
|
996
1043
|
declare const kInternal: unique symbol;
|
|
997
1044
|
|
|
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
|
+
|
|
998
1068
|
declare enum ClientMsgCode {
|
|
999
1069
|
UPDATE_PRESENCE = 100,
|
|
1000
1070
|
BROADCAST_EVENT = 103,
|
|
@@ -1723,6 +1793,9 @@ declare type GetThreadsOptions<M extends BaseMetadata> = {
|
|
|
1723
1793
|
metadata?: Partial<QueryMetadata<M>>;
|
|
1724
1794
|
};
|
|
1725
1795
|
};
|
|
1796
|
+
declare type UploadAttachmentOptions = {
|
|
1797
|
+
signal?: AbortSignal;
|
|
1798
|
+
};
|
|
1726
1799
|
/**
|
|
1727
1800
|
* @private Widest-possible Room type, matching _any_ Room instance. Note that
|
|
1728
1801
|
* this type is different from `Room`-without-type-arguments. That represents
|
|
@@ -1994,6 +2067,7 @@ declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extend
|
|
|
1994
2067
|
commentId?: string;
|
|
1995
2068
|
metadata: M | undefined;
|
|
1996
2069
|
body: CommentBody;
|
|
2070
|
+
attachmentIds?: string[];
|
|
1997
2071
|
}): Promise<ThreadData<M>>;
|
|
1998
2072
|
/**
|
|
1999
2073
|
* Deletes a thread.
|
|
@@ -2043,6 +2117,7 @@ declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extend
|
|
|
2043
2117
|
threadId: string;
|
|
2044
2118
|
commentId?: string;
|
|
2045
2119
|
body: CommentBody;
|
|
2120
|
+
attachmentIds?: string[];
|
|
2046
2121
|
}): Promise<CommentData>;
|
|
2047
2122
|
/**
|
|
2048
2123
|
* Edits a comment.
|
|
@@ -2061,6 +2136,7 @@ declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extend
|
|
|
2061
2136
|
threadId: string;
|
|
2062
2137
|
commentId: string;
|
|
2063
2138
|
body: CommentBody;
|
|
2139
|
+
attachmentIds?: string[];
|
|
2064
2140
|
}): Promise<CommentData>;
|
|
2065
2141
|
/**
|
|
2066
2142
|
* Deletes a comment.
|
|
@@ -2098,6 +2174,28 @@ declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extend
|
|
|
2098
2174
|
commentId: string;
|
|
2099
2175
|
emoji: string;
|
|
2100
2176
|
}): 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>;
|
|
2101
2199
|
/**
|
|
2102
2200
|
* Gets the user's notification settings for the current room.
|
|
2103
2201
|
*
|
|
@@ -2150,6 +2248,7 @@ declare type PrivateRoomApi = {
|
|
|
2150
2248
|
explicitClose(event: IWebSocketCloseEvent): void;
|
|
2151
2249
|
rawSend(data: string): void;
|
|
2152
2250
|
};
|
|
2251
|
+
attachmentUrlsStore: BatchStore<string, string>;
|
|
2153
2252
|
};
|
|
2154
2253
|
declare type HistoryOp<P extends JsonObject> = Op | {
|
|
2155
2254
|
readonly type: "presence";
|
|
@@ -2189,29 +2288,6 @@ declare class CommentsApiError extends Error {
|
|
|
2189
2288
|
constructor(message: string, status: number, details?: JsonObject | undefined);
|
|
2190
2289
|
}
|
|
2191
2290
|
|
|
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
|
-
|
|
2215
2291
|
/**
|
|
2216
2292
|
* A Store is just a mini Zustand store.
|
|
2217
2293
|
*/
|
|
@@ -2672,6 +2748,8 @@ declare function assert(condition: boolean, errmsg: string): asserts condition;
|
|
|
2672
2748
|
*/
|
|
2673
2749
|
declare function nn<T>(value: T, errmsg?: string): NonNullable<T>;
|
|
2674
2750
|
|
|
2751
|
+
declare function chunk<T>(array: T[], size: number): T[][];
|
|
2752
|
+
|
|
2675
2753
|
declare function createThreadId(): string;
|
|
2676
2754
|
declare function createCommentId(): string;
|
|
2677
2755
|
declare function createInboxNotificationId(): string;
|
|
@@ -3040,4 +3118,4 @@ declare type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (En
|
|
|
3040
3118
|
[K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
|
|
3041
3119
|
};
|
|
3042
3120
|
|
|
3043
|
-
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 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 DistributiveOmit, 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 ThreadDataWithDeleteInfo, 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, asPos, assert, assertNever, b64decode, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToThreadData, createClient, createCommentId, createInboxNotificationId, createStore, createThreadId, deprecate, deprecateIf, detectDupes, errorIf, freeze, getMentionedIdsFromCommentBody, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, kInternal, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, raise, shallow, stringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, wait, withTimeout };
|
|
3121
|
+
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 Client, type ClientMsg, ClientMsgCode, type ClientOptions, type CommentAttachment, 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 CommentLocalAttachment, type CommentMixedAttachment, 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 DistributiveOmit, 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 ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type User, type UserJoinServerMsg, type UserLeftServerMsg, WebsocketCloseCodes, type YDocUpdateServerMsg, ackOp, asPos, assert, assertNever, b64decode, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToThreadData, createClient, createCommentId, createInboxNotificationId, createStore, createThreadId, deprecate, deprecateIf, detectDupes, errorIf, freeze, getMentionedIdsFromCommentBody, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, kInternal, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, raise, shallow, stringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, wait, withTimeout };
|