@liveblocks/core 2.0.3 → 2.0.4
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 +29 -14
- package/dist/index.d.ts +29 -14
- package/dist/index.js +61 -35
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -797,13 +797,13 @@ declare type InboxNotificationTextMentionData = {
|
|
|
797
797
|
};
|
|
798
798
|
declare type InboxNotificationTextMentionDataPlain = DateToString<InboxNotificationTextMentionData>;
|
|
799
799
|
declare type ActivityData = Record<string, string | boolean | number | undefined>;
|
|
800
|
-
declare type InboxNotificationActivity<K extends
|
|
800
|
+
declare type InboxNotificationActivity<K extends keyof DAD = keyof DAD> = {
|
|
801
801
|
id: string;
|
|
802
802
|
createdAt: Date;
|
|
803
|
-
data:
|
|
803
|
+
data: DAD[K];
|
|
804
804
|
};
|
|
805
|
-
declare type InboxNotificationCustomData<K extends
|
|
806
|
-
kind:
|
|
805
|
+
declare type InboxNotificationCustomData<K extends keyof DAD = keyof DAD> = {
|
|
806
|
+
kind: K;
|
|
807
807
|
id: string;
|
|
808
808
|
roomId?: string;
|
|
809
809
|
subjectId: string;
|
|
@@ -957,14 +957,19 @@ declare global {
|
|
|
957
957
|
}
|
|
958
958
|
}
|
|
959
959
|
declare type ExtendableTypes = "Presence" | "Storage" | "UserMeta" | "RoomEvent" | "ThreadMetadata" | "RoomInfo" | "ActivitiesData";
|
|
960
|
-
declare type
|
|
961
|
-
declare type
|
|
962
|
-
declare type
|
|
963
|
-
declare type
|
|
964
|
-
declare type
|
|
965
|
-
declare type
|
|
966
|
-
declare type
|
|
967
|
-
declare type
|
|
960
|
+
declare type MakeErrorString<K extends ExtendableTypes, Reason extends string = "does not match its requirements"> = `The type you provided for '${K}' ${Reason}. To learn how to fix this, see https://liveblocks.io/docs/errors/${K}`;
|
|
961
|
+
declare type GetOverride<K extends ExtendableTypes, B, Reason extends string = "does not match its requirements"> = GetOverrideOrErrorValue<K, B, MakeErrorString<K, Reason>>;
|
|
962
|
+
declare type GetOverrideOrErrorValue<K extends ExtendableTypes, B, ErrorType> = unknown extends Liveblocks[K] ? B : Liveblocks[K] extends B ? Liveblocks[K] : ErrorType;
|
|
963
|
+
declare type DP = GetOverride<"Presence", JsonObject, "is not a valid JSON object">;
|
|
964
|
+
declare type DS = GetOverride<"Storage", LsonObject, "is not a valid LSON value">;
|
|
965
|
+
declare type DU = GetOverrideOrErrorValue<"UserMeta", BaseUserMeta, Record<"id" | "info", MakeErrorString<"UserMeta">>>;
|
|
966
|
+
declare type DE = GetOverride<"RoomEvent", Json, "is not a valid JSON value">;
|
|
967
|
+
declare type DM = GetOverride<"ThreadMetadata", BaseMetadata>;
|
|
968
|
+
declare type DRI = GetOverride<"RoomInfo", BaseRoomInfo>;
|
|
969
|
+
declare type DAD = GetOverrideOrErrorValue<"ActivitiesData", BaseActivitiesData, {
|
|
970
|
+
[K in keyof Liveblocks["ActivitiesData"]]: "At least one of the custom notification kinds you provided for 'ActivitiesData' does not match its requirements. To learn how to fix this, see https://liveblocks.io/docs/errors/ActivitiesData";
|
|
971
|
+
}>;
|
|
972
|
+
declare type KDAD = keyof DAD extends `$${string}` ? keyof DAD : "Custom notification kinds must start with '$' but your custom 'ActivitiesData' type contains at least one kind which doesn't. To learn how to fix this, see https://liveblocks.io/docs/errors/ActivitiesData";
|
|
968
973
|
|
|
969
974
|
/**
|
|
970
975
|
* Use this symbol to brand an object property as internal.
|
|
@@ -1730,6 +1735,9 @@ declare type CommentsApi<M extends BaseMetadata> = {
|
|
|
1730
1735
|
metadata: M | undefined;
|
|
1731
1736
|
body: CommentBody;
|
|
1732
1737
|
}): Promise<ThreadData<M>>;
|
|
1738
|
+
deleteThread(options: {
|
|
1739
|
+
threadId: string;
|
|
1740
|
+
}): Promise<void>;
|
|
1733
1741
|
editThreadMetadata(options: {
|
|
1734
1742
|
metadata: Patchable<M>;
|
|
1735
1743
|
threadId: string;
|
|
@@ -2043,13 +2051,20 @@ declare type GetInboxNotificationsOptions = {
|
|
|
2043
2051
|
since?: Date;
|
|
2044
2052
|
};
|
|
2045
2053
|
|
|
2046
|
-
declare type OptimisticUpdate<M extends BaseMetadata> = CreateThreadOptimisticUpdate<M> | EditThreadMetadataOptimisticUpdate<M> | CreateCommentOptimisticUpdate | EditCommentOptimisticUpdate | DeleteCommentOptimisticUpdate | AddReactionOptimisticUpdate | RemoveReactionOptimisticUpdate | MarkInboxNotificationAsReadOptimisticUpdate | MarkAllInboxNotificationsAsReadOptimisticUpdate | UpdateNotificationSettingsOptimisticUpdate;
|
|
2054
|
+
declare type OptimisticUpdate<M extends BaseMetadata> = CreateThreadOptimisticUpdate<M> | DeleteThreadOptimisticUpdate | EditThreadMetadataOptimisticUpdate<M> | CreateCommentOptimisticUpdate | EditCommentOptimisticUpdate | DeleteCommentOptimisticUpdate | AddReactionOptimisticUpdate | RemoveReactionOptimisticUpdate | MarkInboxNotificationAsReadOptimisticUpdate | MarkAllInboxNotificationsAsReadOptimisticUpdate | UpdateNotificationSettingsOptimisticUpdate;
|
|
2047
2055
|
declare type CreateThreadOptimisticUpdate<M extends BaseMetadata> = {
|
|
2048
2056
|
type: "create-thread";
|
|
2049
2057
|
id: string;
|
|
2050
2058
|
roomId: string;
|
|
2051
2059
|
thread: ThreadData<M>;
|
|
2052
2060
|
};
|
|
2061
|
+
declare type DeleteThreadOptimisticUpdate = {
|
|
2062
|
+
type: "delete-thread";
|
|
2063
|
+
id: string;
|
|
2064
|
+
roomId: string;
|
|
2065
|
+
threadId: string;
|
|
2066
|
+
deletedAt: Date;
|
|
2067
|
+
};
|
|
2053
2068
|
declare type EditThreadMetadataOptimisticUpdate<M extends BaseMetadata> = {
|
|
2054
2069
|
type: "edit-thread-metadata";
|
|
2055
2070
|
id: string;
|
|
@@ -2842,4 +2857,4 @@ declare type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (En
|
|
|
2842
2857
|
[K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
|
|
2843
2858
|
};
|
|
2844
2859
|
|
|
2845
|
-
export { type AckOp, type ActivityData, 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 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, 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, deleteComment, deprecate, deprecateIf, detectDupes, errorIf, freeze, getMentionedIdsFromCommentBody, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, kInternal, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, nn, objectToQuery, patchLiveObjectKey, raise, removeReaction, shallow, stringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, upsertComment, withTimeout };
|
|
2860
|
+
export { type AckOp, type ActivityData, 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 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, deleteComment, deprecate, deprecateIf, detectDupes, errorIf, freeze, getMentionedIdsFromCommentBody, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, kInternal, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, nn, objectToQuery, patchLiveObjectKey, raise, removeReaction, shallow, stringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, upsertComment, withTimeout };
|
package/dist/index.d.ts
CHANGED
|
@@ -797,13 +797,13 @@ declare type InboxNotificationTextMentionData = {
|
|
|
797
797
|
};
|
|
798
798
|
declare type InboxNotificationTextMentionDataPlain = DateToString<InboxNotificationTextMentionData>;
|
|
799
799
|
declare type ActivityData = Record<string, string | boolean | number | undefined>;
|
|
800
|
-
declare type InboxNotificationActivity<K extends
|
|
800
|
+
declare type InboxNotificationActivity<K extends keyof DAD = keyof DAD> = {
|
|
801
801
|
id: string;
|
|
802
802
|
createdAt: Date;
|
|
803
|
-
data:
|
|
803
|
+
data: DAD[K];
|
|
804
804
|
};
|
|
805
|
-
declare type InboxNotificationCustomData<K extends
|
|
806
|
-
kind:
|
|
805
|
+
declare type InboxNotificationCustomData<K extends keyof DAD = keyof DAD> = {
|
|
806
|
+
kind: K;
|
|
807
807
|
id: string;
|
|
808
808
|
roomId?: string;
|
|
809
809
|
subjectId: string;
|
|
@@ -957,14 +957,19 @@ declare global {
|
|
|
957
957
|
}
|
|
958
958
|
}
|
|
959
959
|
declare type ExtendableTypes = "Presence" | "Storage" | "UserMeta" | "RoomEvent" | "ThreadMetadata" | "RoomInfo" | "ActivitiesData";
|
|
960
|
-
declare type
|
|
961
|
-
declare type
|
|
962
|
-
declare type
|
|
963
|
-
declare type
|
|
964
|
-
declare type
|
|
965
|
-
declare type
|
|
966
|
-
declare type
|
|
967
|
-
declare type
|
|
960
|
+
declare type MakeErrorString<K extends ExtendableTypes, Reason extends string = "does not match its requirements"> = `The type you provided for '${K}' ${Reason}. To learn how to fix this, see https://liveblocks.io/docs/errors/${K}`;
|
|
961
|
+
declare type GetOverride<K extends ExtendableTypes, B, Reason extends string = "does not match its requirements"> = GetOverrideOrErrorValue<K, B, MakeErrorString<K, Reason>>;
|
|
962
|
+
declare type GetOverrideOrErrorValue<K extends ExtendableTypes, B, ErrorType> = unknown extends Liveblocks[K] ? B : Liveblocks[K] extends B ? Liveblocks[K] : ErrorType;
|
|
963
|
+
declare type DP = GetOverride<"Presence", JsonObject, "is not a valid JSON object">;
|
|
964
|
+
declare type DS = GetOverride<"Storage", LsonObject, "is not a valid LSON value">;
|
|
965
|
+
declare type DU = GetOverrideOrErrorValue<"UserMeta", BaseUserMeta, Record<"id" | "info", MakeErrorString<"UserMeta">>>;
|
|
966
|
+
declare type DE = GetOverride<"RoomEvent", Json, "is not a valid JSON value">;
|
|
967
|
+
declare type DM = GetOverride<"ThreadMetadata", BaseMetadata>;
|
|
968
|
+
declare type DRI = GetOverride<"RoomInfo", BaseRoomInfo>;
|
|
969
|
+
declare type DAD = GetOverrideOrErrorValue<"ActivitiesData", BaseActivitiesData, {
|
|
970
|
+
[K in keyof Liveblocks["ActivitiesData"]]: "At least one of the custom notification kinds you provided for 'ActivitiesData' does not match its requirements. To learn how to fix this, see https://liveblocks.io/docs/errors/ActivitiesData";
|
|
971
|
+
}>;
|
|
972
|
+
declare type KDAD = keyof DAD extends `$${string}` ? keyof DAD : "Custom notification kinds must start with '$' but your custom 'ActivitiesData' type contains at least one kind which doesn't. To learn how to fix this, see https://liveblocks.io/docs/errors/ActivitiesData";
|
|
968
973
|
|
|
969
974
|
/**
|
|
970
975
|
* Use this symbol to brand an object property as internal.
|
|
@@ -1730,6 +1735,9 @@ declare type CommentsApi<M extends BaseMetadata> = {
|
|
|
1730
1735
|
metadata: M | undefined;
|
|
1731
1736
|
body: CommentBody;
|
|
1732
1737
|
}): Promise<ThreadData<M>>;
|
|
1738
|
+
deleteThread(options: {
|
|
1739
|
+
threadId: string;
|
|
1740
|
+
}): Promise<void>;
|
|
1733
1741
|
editThreadMetadata(options: {
|
|
1734
1742
|
metadata: Patchable<M>;
|
|
1735
1743
|
threadId: string;
|
|
@@ -2043,13 +2051,20 @@ declare type GetInboxNotificationsOptions = {
|
|
|
2043
2051
|
since?: Date;
|
|
2044
2052
|
};
|
|
2045
2053
|
|
|
2046
|
-
declare type OptimisticUpdate<M extends BaseMetadata> = CreateThreadOptimisticUpdate<M> | EditThreadMetadataOptimisticUpdate<M> | CreateCommentOptimisticUpdate | EditCommentOptimisticUpdate | DeleteCommentOptimisticUpdate | AddReactionOptimisticUpdate | RemoveReactionOptimisticUpdate | MarkInboxNotificationAsReadOptimisticUpdate | MarkAllInboxNotificationsAsReadOptimisticUpdate | UpdateNotificationSettingsOptimisticUpdate;
|
|
2054
|
+
declare type OptimisticUpdate<M extends BaseMetadata> = CreateThreadOptimisticUpdate<M> | DeleteThreadOptimisticUpdate | EditThreadMetadataOptimisticUpdate<M> | CreateCommentOptimisticUpdate | EditCommentOptimisticUpdate | DeleteCommentOptimisticUpdate | AddReactionOptimisticUpdate | RemoveReactionOptimisticUpdate | MarkInboxNotificationAsReadOptimisticUpdate | MarkAllInboxNotificationsAsReadOptimisticUpdate | UpdateNotificationSettingsOptimisticUpdate;
|
|
2047
2055
|
declare type CreateThreadOptimisticUpdate<M extends BaseMetadata> = {
|
|
2048
2056
|
type: "create-thread";
|
|
2049
2057
|
id: string;
|
|
2050
2058
|
roomId: string;
|
|
2051
2059
|
thread: ThreadData<M>;
|
|
2052
2060
|
};
|
|
2061
|
+
declare type DeleteThreadOptimisticUpdate = {
|
|
2062
|
+
type: "delete-thread";
|
|
2063
|
+
id: string;
|
|
2064
|
+
roomId: string;
|
|
2065
|
+
threadId: string;
|
|
2066
|
+
deletedAt: Date;
|
|
2067
|
+
};
|
|
2053
2068
|
declare type EditThreadMetadataOptimisticUpdate<M extends BaseMetadata> = {
|
|
2054
2069
|
type: "edit-thread-metadata";
|
|
2055
2070
|
id: string;
|
|
@@ -2842,4 +2857,4 @@ declare type EnsureJson<T> = T extends Json ? T : T extends Array<infer I> ? (En
|
|
|
2842
2857
|
[K in keyof T as EnsureJson<T[K]> extends never ? never : K]: EnsureJson<T[K]>;
|
|
2843
2858
|
};
|
|
2844
2859
|
|
|
2845
|
-
export { type AckOp, type ActivityData, 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 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, 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, deleteComment, deprecate, deprecateIf, detectDupes, errorIf, freeze, getMentionedIdsFromCommentBody, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, kInternal, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, nn, objectToQuery, patchLiveObjectKey, raise, removeReaction, shallow, stringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, upsertComment, withTimeout };
|
|
2860
|
+
export { type AckOp, type ActivityData, 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 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, deleteComment, deprecate, deprecateIf, detectDupes, errorIf, freeze, getMentionedIdsFromCommentBody, isChildCrdt, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isPlainObject, isRootCrdt, kInternal, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, nn, objectToQuery, patchLiveObjectKey, raise, removeReaction, shallow, stringify, stringifyCommentBody, throwUsageError, toPlainLson, tryParseJson, upsertComment, withTimeout };
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ var __export = (target, all) => {
|
|
|
6
6
|
|
|
7
7
|
// src/version.ts
|
|
8
8
|
var PKG_NAME = "@liveblocks/core";
|
|
9
|
-
var PKG_VERSION = "2.0.
|
|
9
|
+
var PKG_VERSION = "2.0.4";
|
|
10
10
|
var PKG_FORMAT = "cjs";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -5212,6 +5212,11 @@ function createCommentsApi(roomId, getAuthValue, fetchClientApi) {
|
|
|
5212
5212
|
});
|
|
5213
5213
|
return convertToThreadData(thread);
|
|
5214
5214
|
}
|
|
5215
|
+
async function deleteThread({ threadId }) {
|
|
5216
|
+
await fetchJson(`/threads/${encodeURIComponent(threadId)}`, {
|
|
5217
|
+
method: "DELETE"
|
|
5218
|
+
});
|
|
5219
|
+
}
|
|
5215
5220
|
async function editThreadMetadata({
|
|
5216
5221
|
metadata,
|
|
5217
5222
|
threadId
|
|
@@ -5318,6 +5323,7 @@ function createCommentsApi(roomId, getAuthValue, fetchClientApi) {
|
|
|
5318
5323
|
getThreads,
|
|
5319
5324
|
getThread,
|
|
5320
5325
|
createThread,
|
|
5326
|
+
deleteThread,
|
|
5321
5327
|
editThreadMetadata,
|
|
5322
5328
|
createComment,
|
|
5323
5329
|
editComment,
|
|
@@ -5688,10 +5694,17 @@ function createRoom(options, config) {
|
|
|
5688
5694
|
} else {
|
|
5689
5695
|
context.root = LiveObject._fromItems(message.items, pool);
|
|
5690
5696
|
}
|
|
5697
|
+
const canWrite = _nullishCoalesce(_optionalChain([self, 'access', _138 => _138.current, 'optionalAccess', _139 => _139.canWrite]), () => ( true));
|
|
5691
5698
|
const stackSizeBefore = context.undoStack.length;
|
|
5692
5699
|
for (const key in context.initialStorage) {
|
|
5693
5700
|
if (context.root.get(key) === void 0) {
|
|
5694
|
-
|
|
5701
|
+
if (canWrite) {
|
|
5702
|
+
context.root.set(key, cloneLson(context.initialStorage[key]));
|
|
5703
|
+
} else {
|
|
5704
|
+
warn(
|
|
5705
|
+
`Attempted to populate missing storage key '${key}', but current user has no write access`
|
|
5706
|
+
);
|
|
5707
|
+
}
|
|
5695
5708
|
}
|
|
5696
5709
|
}
|
|
5697
5710
|
context.undoStack.length = stackSizeBefore;
|
|
@@ -5886,7 +5899,7 @@ function createRoom(options, config) {
|
|
|
5886
5899
|
}
|
|
5887
5900
|
context.myPresence.patch(patch);
|
|
5888
5901
|
if (context.activeBatch) {
|
|
5889
|
-
if (_optionalChain([options2, 'optionalAccess',
|
|
5902
|
+
if (_optionalChain([options2, 'optionalAccess', _140 => _140.addToHistory])) {
|
|
5890
5903
|
context.activeBatch.reverseOps.unshift({
|
|
5891
5904
|
type: "presence",
|
|
5892
5905
|
data: oldValues
|
|
@@ -5896,7 +5909,7 @@ function createRoom(options, config) {
|
|
|
5896
5909
|
} else {
|
|
5897
5910
|
flushNowOrSoon();
|
|
5898
5911
|
batchUpdates(() => {
|
|
5899
|
-
if (_optionalChain([options2, 'optionalAccess',
|
|
5912
|
+
if (_optionalChain([options2, 'optionalAccess', _141 => _141.addToHistory])) {
|
|
5900
5913
|
addToUndoStack(
|
|
5901
5914
|
[{ type: "presence", data: oldValues }],
|
|
5902
5915
|
doNotBatchUpdates
|
|
@@ -6094,7 +6107,7 @@ function createRoom(options, config) {
|
|
|
6094
6107
|
if (process.env.NODE_ENV !== "production") {
|
|
6095
6108
|
const traces = /* @__PURE__ */ new Set();
|
|
6096
6109
|
for (const opId of message.opIds) {
|
|
6097
|
-
const trace = _optionalChain([context, 'access',
|
|
6110
|
+
const trace = _optionalChain([context, 'access', _142 => _142.opStackTraces, 'optionalAccess', _143 => _143.get, 'call', _144 => _144(opId)]);
|
|
6098
6111
|
if (trace) {
|
|
6099
6112
|
traces.add(trace);
|
|
6100
6113
|
}
|
|
@@ -6227,7 +6240,7 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
6227
6240
|
const unacknowledgedOps = new Map(context.unacknowledgedOps);
|
|
6228
6241
|
createOrUpdateRootFromMessage(message, doNotBatchUpdates);
|
|
6229
6242
|
applyAndSendOps(unacknowledgedOps, doNotBatchUpdates);
|
|
6230
|
-
_optionalChain([_resolveStoragePromise, 'optionalCall',
|
|
6243
|
+
_optionalChain([_resolveStoragePromise, 'optionalCall', _145 => _145()]);
|
|
6231
6244
|
notifyStorageStatus();
|
|
6232
6245
|
eventHub.storageDidLoad.notify();
|
|
6233
6246
|
}
|
|
@@ -6502,7 +6515,7 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
6502
6515
|
{
|
|
6503
6516
|
[kInternal]: {
|
|
6504
6517
|
get presenceBuffer() {
|
|
6505
|
-
return deepClone(_nullishCoalesce(_optionalChain([context, 'access',
|
|
6518
|
+
return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _146 => _146.buffer, 'access', _147 => _147.presenceUpdates, 'optionalAccess', _148 => _148.data]), () => ( null)));
|
|
6506
6519
|
},
|
|
6507
6520
|
// prettier-ignore
|
|
6508
6521
|
get undoStack() {
|
|
@@ -6650,7 +6663,7 @@ function makeClassicSubscribeFn(events) {
|
|
|
6650
6663
|
}
|
|
6651
6664
|
if (isLiveNode(first)) {
|
|
6652
6665
|
const node = first;
|
|
6653
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
6666
|
+
if (_optionalChain([options, 'optionalAccess', _149 => _149.isDeep])) {
|
|
6654
6667
|
const storageCallback = second;
|
|
6655
6668
|
return subscribeToLiveStructureDeeply(node, storageCallback);
|
|
6656
6669
|
} else {
|
|
@@ -6894,6 +6907,19 @@ function applyOptimisticUpdates(state) {
|
|
|
6894
6907
|
);
|
|
6895
6908
|
break;
|
|
6896
6909
|
}
|
|
6910
|
+
case "delete-thread": {
|
|
6911
|
+
const thread = result.threads[optimisticUpdate.threadId];
|
|
6912
|
+
if (thread === void 0) {
|
|
6913
|
+
break;
|
|
6914
|
+
}
|
|
6915
|
+
result.threads[optimisticUpdate.threadId] = {
|
|
6916
|
+
...result.threads[optimisticUpdate.threadId],
|
|
6917
|
+
deletedAt: optimisticUpdate.deletedAt,
|
|
6918
|
+
updatedAt: optimisticUpdate.deletedAt,
|
|
6919
|
+
comments: []
|
|
6920
|
+
};
|
|
6921
|
+
break;
|
|
6922
|
+
}
|
|
6897
6923
|
case "add-reaction": {
|
|
6898
6924
|
const thread = result.threads[optimisticUpdate.threadId];
|
|
6899
6925
|
if (thread === void 0) {
|
|
@@ -7011,7 +7037,7 @@ function upsertComment(thread, comment) {
|
|
|
7011
7037
|
);
|
|
7012
7038
|
if (existingComment === void 0) {
|
|
7013
7039
|
const updatedAt = new Date(
|
|
7014
|
-
Math.max(_optionalChain([thread, 'access',
|
|
7040
|
+
Math.max(_optionalChain([thread, 'access', _150 => _150.updatedAt, 'optionalAccess', _151 => _151.getTime, 'call', _152 => _152()]) || 0, comment.createdAt.getTime())
|
|
7015
7041
|
);
|
|
7016
7042
|
const updatedThread = {
|
|
7017
7043
|
...thread,
|
|
@@ -7031,8 +7057,8 @@ function upsertComment(thread, comment) {
|
|
|
7031
7057
|
...thread,
|
|
7032
7058
|
updatedAt: new Date(
|
|
7033
7059
|
Math.max(
|
|
7034
|
-
_optionalChain([thread, 'access',
|
|
7035
|
-
_optionalChain([comment, 'access',
|
|
7060
|
+
_optionalChain([thread, 'access', _153 => _153.updatedAt, 'optionalAccess', _154 => _154.getTime, 'call', _155 => _155()]) || 0,
|
|
7061
|
+
_optionalChain([comment, 'access', _156 => _156.editedAt, 'optionalAccess', _157 => _157.getTime, 'call', _158 => _158()]) || comment.createdAt.getTime()
|
|
7036
7062
|
)
|
|
7037
7063
|
),
|
|
7038
7064
|
comments: updatedComments
|
|
@@ -7097,7 +7123,7 @@ function addReaction(thread, commentId, reaction) {
|
|
|
7097
7123
|
return {
|
|
7098
7124
|
...thread,
|
|
7099
7125
|
updatedAt: new Date(
|
|
7100
|
-
Math.max(reaction.createdAt.getTime(), _optionalChain([thread, 'access',
|
|
7126
|
+
Math.max(reaction.createdAt.getTime(), _optionalChain([thread, 'access', _159 => _159.updatedAt, 'optionalAccess', _160 => _160.getTime, 'call', _161 => _161()]) || 0)
|
|
7101
7127
|
),
|
|
7102
7128
|
comments: updatedComments
|
|
7103
7129
|
};
|
|
@@ -7130,7 +7156,7 @@ function removeReaction(thread, commentId, emoji, userId, removedAt) {
|
|
|
7130
7156
|
return {
|
|
7131
7157
|
...thread,
|
|
7132
7158
|
updatedAt: new Date(
|
|
7133
|
-
Math.max(removedAt.getTime(), _optionalChain([thread, 'access',
|
|
7159
|
+
Math.max(removedAt.getTime(), _optionalChain([thread, 'access', _162 => _162.updatedAt, 'optionalAccess', _163 => _163.getTime, 'call', _164 => _164()]) || 0)
|
|
7134
7160
|
),
|
|
7135
7161
|
comments: updatedComments
|
|
7136
7162
|
};
|
|
@@ -7241,12 +7267,12 @@ function createClient(options) {
|
|
|
7241
7267
|
createSocket: makeCreateSocketDelegateForRoom(
|
|
7242
7268
|
roomId,
|
|
7243
7269
|
baseUrl,
|
|
7244
|
-
_optionalChain([clientOptions, 'access',
|
|
7270
|
+
_optionalChain([clientOptions, 'access', _165 => _165.polyfills, 'optionalAccess', _166 => _166.WebSocket])
|
|
7245
7271
|
),
|
|
7246
7272
|
authenticate: makeAuthDelegateForRoom(roomId, authManager)
|
|
7247
7273
|
})),
|
|
7248
7274
|
enableDebugLogging: clientOptions.enableDebugLogging,
|
|
7249
|
-
unstable_batchedUpdates: _optionalChain([options2, 'optionalAccess',
|
|
7275
|
+
unstable_batchedUpdates: _optionalChain([options2, 'optionalAccess', _167 => _167.unstable_batchedUpdates]),
|
|
7250
7276
|
baseUrl,
|
|
7251
7277
|
unstable_fallbackToHTTP: !!clientOptions.unstable_fallbackToHTTP,
|
|
7252
7278
|
unstable_streamData: !!clientOptions.unstable_streamData
|
|
@@ -7262,7 +7288,7 @@ function createClient(options) {
|
|
|
7262
7288
|
const shouldConnect = _nullishCoalesce(options2.autoConnect, () => ( true));
|
|
7263
7289
|
if (shouldConnect) {
|
|
7264
7290
|
if (typeof atob === "undefined") {
|
|
7265
|
-
if (_optionalChain([clientOptions, 'access',
|
|
7291
|
+
if (_optionalChain([clientOptions, 'access', _168 => _168.polyfills, 'optionalAccess', _169 => _169.atob]) === void 0) {
|
|
7266
7292
|
throw new Error(
|
|
7267
7293
|
"You need to polyfill atob to use the client in your environment. Please follow the instructions at https://liveblocks.io/docs/errors/liveblocks-client/atob-polyfill"
|
|
7268
7294
|
);
|
|
@@ -7274,7 +7300,7 @@ function createClient(options) {
|
|
|
7274
7300
|
return leaseRoom(newRoomDetails);
|
|
7275
7301
|
}
|
|
7276
7302
|
function getRoom(roomId) {
|
|
7277
|
-
const room = _optionalChain([roomsById, 'access',
|
|
7303
|
+
const room = _optionalChain([roomsById, 'access', _170 => _170.get, 'call', _171 => _171(roomId), 'optionalAccess', _172 => _172.room]);
|
|
7278
7304
|
return room ? room : null;
|
|
7279
7305
|
}
|
|
7280
7306
|
function logout() {
|
|
@@ -7293,7 +7319,7 @@ function createClient(options) {
|
|
|
7293
7319
|
markInboxNotificationAsRead
|
|
7294
7320
|
} = createNotificationsApi({
|
|
7295
7321
|
baseUrl,
|
|
7296
|
-
fetcher: _optionalChain([clientOptions, 'access',
|
|
7322
|
+
fetcher: _optionalChain([clientOptions, 'access', _173 => _173.polyfills, 'optionalAccess', _174 => _174.fetch]) || /* istanbul ignore next */
|
|
7297
7323
|
fetch,
|
|
7298
7324
|
authManager,
|
|
7299
7325
|
currentUserIdStore
|
|
@@ -7307,7 +7333,7 @@ function createClient(options) {
|
|
|
7307
7333
|
const usersStore = createBatchStore(
|
|
7308
7334
|
async (batchedUserIds) => {
|
|
7309
7335
|
const userIds = batchedUserIds.flat();
|
|
7310
|
-
const users = await _optionalChain([resolveUsers, 'optionalCall',
|
|
7336
|
+
const users = await _optionalChain([resolveUsers, 'optionalCall', _175 => _175({ userIds })]);
|
|
7311
7337
|
warnIfNoResolveUsers();
|
|
7312
7338
|
return _nullishCoalesce(users, () => ( userIds.map(() => void 0)));
|
|
7313
7339
|
},
|
|
@@ -7321,7 +7347,7 @@ function createClient(options) {
|
|
|
7321
7347
|
const roomsInfoStore = createBatchStore(
|
|
7322
7348
|
async (batchedRoomIds) => {
|
|
7323
7349
|
const roomIds = batchedRoomIds.flat();
|
|
7324
|
-
const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall',
|
|
7350
|
+
const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall', _176 => _176({ roomIds })]);
|
|
7325
7351
|
warnIfNoResolveRoomsInfo();
|
|
7326
7352
|
return _nullishCoalesce(roomsInfo, () => ( roomIds.map(() => void 0)));
|
|
7327
7353
|
},
|
|
@@ -7433,7 +7459,7 @@ var commentBodyElementsTypes = {
|
|
|
7433
7459
|
mention: "inline"
|
|
7434
7460
|
};
|
|
7435
7461
|
function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
|
|
7436
|
-
if (!body || !_optionalChain([body, 'optionalAccess',
|
|
7462
|
+
if (!body || !_optionalChain([body, 'optionalAccess', _177 => _177.content])) {
|
|
7437
7463
|
return;
|
|
7438
7464
|
}
|
|
7439
7465
|
const element = typeof elementOrVisitor === "string" ? elementOrVisitor : void 0;
|
|
@@ -7443,13 +7469,13 @@ function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
|
|
|
7443
7469
|
for (const block of body.content) {
|
|
7444
7470
|
if (type === "all" || type === "block") {
|
|
7445
7471
|
if (guard(block)) {
|
|
7446
|
-
_optionalChain([visitor, 'optionalCall',
|
|
7472
|
+
_optionalChain([visitor, 'optionalCall', _178 => _178(block)]);
|
|
7447
7473
|
}
|
|
7448
7474
|
}
|
|
7449
7475
|
if (type === "all" || type === "inline") {
|
|
7450
7476
|
for (const inline of block.children) {
|
|
7451
7477
|
if (guard(inline)) {
|
|
7452
|
-
_optionalChain([visitor, 'optionalCall',
|
|
7478
|
+
_optionalChain([visitor, 'optionalCall', _179 => _179(inline)]);
|
|
7453
7479
|
}
|
|
7454
7480
|
}
|
|
7455
7481
|
}
|
|
@@ -7474,7 +7500,7 @@ async function resolveUsersInCommentBody(body, resolveUsers) {
|
|
|
7474
7500
|
userIds
|
|
7475
7501
|
});
|
|
7476
7502
|
for (const [index, userId] of userIds.entries()) {
|
|
7477
|
-
const user = _optionalChain([users, 'optionalAccess',
|
|
7503
|
+
const user = _optionalChain([users, 'optionalAccess', _180 => _180[index]]);
|
|
7478
7504
|
if (user) {
|
|
7479
7505
|
resolvedUsers.set(userId, user);
|
|
7480
7506
|
}
|
|
@@ -7597,7 +7623,7 @@ var stringifyCommentBodyPlainElements = {
|
|
|
7597
7623
|
text: ({ element }) => element.text,
|
|
7598
7624
|
link: ({ element }) => element.url,
|
|
7599
7625
|
mention: ({ element, user }) => {
|
|
7600
|
-
return `@${_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
7626
|
+
return `@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _181 => _181.name]), () => ( element.id))}`;
|
|
7601
7627
|
}
|
|
7602
7628
|
};
|
|
7603
7629
|
var stringifyCommentBodyHtmlElements = {
|
|
@@ -7627,7 +7653,7 @@ var stringifyCommentBodyHtmlElements = {
|
|
|
7627
7653
|
return html`<a href="${href}" target="_blank" rel="noopener noreferrer">${element.url}</a>`;
|
|
7628
7654
|
},
|
|
7629
7655
|
mention: ({ element, user }) => {
|
|
7630
|
-
return html`<span data-mention>@${_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
7656
|
+
return html`<span data-mention>@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _182 => _182.name]), () => ( element.id))}</span>`;
|
|
7631
7657
|
}
|
|
7632
7658
|
};
|
|
7633
7659
|
var stringifyCommentBodyMarkdownElements = {
|
|
@@ -7657,19 +7683,19 @@ var stringifyCommentBodyMarkdownElements = {
|
|
|
7657
7683
|
return markdown`[${element.url}](${href})`;
|
|
7658
7684
|
},
|
|
7659
7685
|
mention: ({ element, user }) => {
|
|
7660
|
-
return markdown`@${_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
7686
|
+
return markdown`@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _183 => _183.name]), () => ( element.id))}`;
|
|
7661
7687
|
}
|
|
7662
7688
|
};
|
|
7663
7689
|
async function stringifyCommentBody(body, options) {
|
|
7664
|
-
const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
7665
|
-
const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
7690
|
+
const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _184 => _184.format]), () => ( "plain"));
|
|
7691
|
+
const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _185 => _185.separator]), () => ( (format === "markdown" ? "\n\n" : "\n")));
|
|
7666
7692
|
const elements = {
|
|
7667
7693
|
...format === "html" ? stringifyCommentBodyHtmlElements : format === "markdown" ? stringifyCommentBodyMarkdownElements : stringifyCommentBodyPlainElements,
|
|
7668
|
-
..._optionalChain([options, 'optionalAccess',
|
|
7694
|
+
..._optionalChain([options, 'optionalAccess', _186 => _186.elements])
|
|
7669
7695
|
};
|
|
7670
7696
|
const resolvedUsers = await resolveUsersInCommentBody(
|
|
7671
7697
|
body,
|
|
7672
|
-
_optionalChain([options, 'optionalAccess',
|
|
7698
|
+
_optionalChain([options, 'optionalAccess', _187 => _187.resolveUsers])
|
|
7673
7699
|
);
|
|
7674
7700
|
const blocks = body.content.flatMap((block, blockIndex) => {
|
|
7675
7701
|
switch (block.type) {
|
|
@@ -7944,12 +7970,12 @@ function legacy_patchImmutableNode(state, path, update) {
|
|
|
7944
7970
|
}
|
|
7945
7971
|
const newState = Object.assign({}, state);
|
|
7946
7972
|
for (const key in update.updates) {
|
|
7947
|
-
if (_optionalChain([update, 'access',
|
|
7973
|
+
if (_optionalChain([update, 'access', _188 => _188.updates, 'access', _189 => _189[key], 'optionalAccess', _190 => _190.type]) === "update") {
|
|
7948
7974
|
const val = update.node.get(key);
|
|
7949
7975
|
if (val !== void 0) {
|
|
7950
7976
|
newState[key] = lsonToJson(val);
|
|
7951
7977
|
}
|
|
7952
|
-
} else if (_optionalChain([update, 'access',
|
|
7978
|
+
} else if (_optionalChain([update, 'access', _191 => _191.updates, 'access', _192 => _192[key], 'optionalAccess', _193 => _193.type]) === "delete") {
|
|
7953
7979
|
delete newState[key];
|
|
7954
7980
|
}
|
|
7955
7981
|
}
|
|
@@ -8010,12 +8036,12 @@ function legacy_patchImmutableNode(state, path, update) {
|
|
|
8010
8036
|
}
|
|
8011
8037
|
const newState = Object.assign({}, state);
|
|
8012
8038
|
for (const key in update.updates) {
|
|
8013
|
-
if (_optionalChain([update, 'access',
|
|
8039
|
+
if (_optionalChain([update, 'access', _194 => _194.updates, 'access', _195 => _195[key], 'optionalAccess', _196 => _196.type]) === "update") {
|
|
8014
8040
|
const value = update.node.get(key);
|
|
8015
8041
|
if (value !== void 0) {
|
|
8016
8042
|
newState[key] = lsonToJson(value);
|
|
8017
8043
|
}
|
|
8018
|
-
} else if (_optionalChain([update, 'access',
|
|
8044
|
+
} else if (_optionalChain([update, 'access', _197 => _197.updates, 'access', _198 => _198[key], 'optionalAccess', _199 => _199.type]) === "delete") {
|
|
8019
8045
|
delete newState[key];
|
|
8020
8046
|
}
|
|
8021
8047
|
}
|