@liveblocks/core 2.18.4-uns2 → 2.19.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +10 -90
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -73
- package/dist/index.d.ts +9 -73
- package/dist/index.js +9 -89
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -2495,49 +2495,11 @@ type NotificationChannelSettings = {
|
|
|
2495
2495
|
[K in NotificationKind]: boolean;
|
|
2496
2496
|
};
|
|
2497
2497
|
/**
|
|
2498
|
-
*
|
|
2499
|
-
*
|
|
2500
|
-
* Base definition of user notification settings.
|
|
2501
|
-
* Plain means it's a simple object coming from the remote backend.
|
|
2502
|
-
*
|
|
2503
|
-
* It's the raw settings object where somme channels cannot exists
|
|
2504
|
-
* because there are no notification kinds enabled on the dashboard.
|
|
2505
|
-
* And this object isn't yet proxied by the creator factory `createUserNotificationSettings`.
|
|
2506
|
-
*/
|
|
2507
|
-
type UserNotificationSettingsPlain = {
|
|
2508
|
-
[C in NotificationChannel]?: NotificationChannelSettings;
|
|
2509
|
-
};
|
|
2510
|
-
/**
|
|
2511
|
-
* @private
|
|
2512
|
-
*
|
|
2513
|
-
* Symbol to brand some properties and methods
|
|
2514
|
-
* as internal and private in `UserNotificationSettings`
|
|
2515
|
-
*/
|
|
2516
|
-
declare const kPrivate: unique symbol;
|
|
2517
|
-
/**
|
|
2518
|
-
* @private
|
|
2519
|
-
*
|
|
2520
|
-
* Private properties and methods internal to `UserNotificationSettings`.
|
|
2521
|
-
* As a user of Liveblocks, you should NEVER USE ANY OF THESE DIRECTLY,
|
|
2522
|
-
* because bad things will happen.
|
|
2523
|
-
*/
|
|
2524
|
-
type PrivateUserNotificationSettingsApi = {
|
|
2525
|
-
__plain__: UserNotificationSettingsPlain;
|
|
2526
|
-
};
|
|
2527
|
-
/**
|
|
2528
|
-
* User notification settings.
|
|
2498
|
+
* User notification settings are a set of notification channel setting.
|
|
2529
2499
|
* One channel for one set of settings.
|
|
2530
2500
|
*/
|
|
2531
2501
|
type UserNotificationSettings = {
|
|
2532
|
-
[C in NotificationChannel]: NotificationChannelSettings
|
|
2533
|
-
} & {
|
|
2534
|
-
/**
|
|
2535
|
-
* @private
|
|
2536
|
-
*
|
|
2537
|
-
* `UserNotificationSettings` with private internal properties
|
|
2538
|
-
* to store the plain settings and methods.
|
|
2539
|
-
*/
|
|
2540
|
-
[kPrivate]: PrivateUserNotificationSettingsApi;
|
|
2502
|
+
[C in NotificationChannel]: NotificationChannelSettings;
|
|
2541
2503
|
};
|
|
2542
2504
|
/**
|
|
2543
2505
|
* It creates a deep partial specific for `UserNotificationSettings`
|
|
@@ -2552,42 +2514,16 @@ type DeepPartialWithAugmentation<T> = T extends object ? {
|
|
|
2552
2514
|
} : DeepPartialWithAugmentation<T[P]>;
|
|
2553
2515
|
} : T;
|
|
2554
2516
|
/**
|
|
2555
|
-
* Partial user notification settings
|
|
2556
|
-
*
|
|
2557
|
-
* Useful when implementing update functions.
|
|
2558
|
-
*/
|
|
2559
|
-
type PartialUserNotificationSettings = DeepPartialWithAugmentation<UserNotificationSettingsPlain>;
|
|
2560
|
-
/**
|
|
2561
|
-
* @private
|
|
2562
|
-
*
|
|
2563
|
-
* Creates a `UserNotificationSettings` object with the given initial plain settings.
|
|
2564
|
-
* It defines a getter for each channel to access the settings and returns `null` with an error log
|
|
2565
|
-
* in case the required channel isn't enabled in the dashboard.
|
|
2566
|
-
*
|
|
2567
|
-
* You can see this function as `Proxy` like around `UserNotificationSettingsPlain` type.
|
|
2568
|
-
* We can't predict what will be enabled on the dashboard or not, so it's important
|
|
2569
|
-
* provide a good DX to developers by returning `null` completed by an error log
|
|
2570
|
-
* when they try to access a channel that isn't enabled in the dashboard.
|
|
2571
|
-
*/
|
|
2572
|
-
declare function createUserNotificationSettings(plain: UserNotificationSettingsPlain): UserNotificationSettings;
|
|
2573
|
-
/**
|
|
2574
|
-
* @private
|
|
2575
|
-
*
|
|
2576
|
-
* Patch a `UserNotificationSettings` object by applying notification kind updates
|
|
2577
|
-
* coming from a `PartialUserNotificationSettings` object.
|
|
2517
|
+
* Partial user notification settings
|
|
2518
|
+
* with augmentation preserved gracefully
|
|
2578
2519
|
*/
|
|
2579
|
-
|
|
2520
|
+
type PartialUserNotificationSettings = DeepPartialWithAugmentation<UserNotificationSettings>;
|
|
2580
2521
|
/**
|
|
2581
2522
|
*
|
|
2582
2523
|
* Utility to check if a notification channel settings
|
|
2583
2524
|
* is enabled for every notification kinds.
|
|
2584
|
-
*
|
|
2585
|
-
* Usage:
|
|
2586
|
-
* ```ts
|
|
2587
|
-
* const isEmailChannelEnabled = isNotificationChannelEnabled(settings.email);
|
|
2588
|
-
* ```
|
|
2589
2525
|
*/
|
|
2590
|
-
declare function isNotificationChannelEnabled(settings: NotificationChannelSettings
|
|
2526
|
+
declare function isNotificationChannelEnabled(settings: NotificationChannelSettings): boolean;
|
|
2591
2527
|
|
|
2592
2528
|
interface RoomHttpApi<M extends BaseMetadata> {
|
|
2593
2529
|
getThreads(options: {
|
|
@@ -2805,8 +2741,8 @@ interface NotificationHttpApi<M extends BaseMetadata> {
|
|
|
2805
2741
|
deleteInboxNotification(inboxNotificationId: string): Promise<void>;
|
|
2806
2742
|
getUserNotificationSettings(options?: {
|
|
2807
2743
|
signal?: AbortSignal;
|
|
2808
|
-
}): Promise<
|
|
2809
|
-
updateUserNotificationSettings(settings: PartialUserNotificationSettings): Promise<
|
|
2744
|
+
}): Promise<UserNotificationSettings>;
|
|
2745
|
+
updateUserNotificationSettings(settings: PartialUserNotificationSettings): Promise<UserNotificationSettings>;
|
|
2810
2746
|
}
|
|
2811
2747
|
interface LiveblocksHttpApi<M extends BaseMetadata> extends RoomHttpApi<M>, NotificationHttpApi<M> {
|
|
2812
2748
|
getUserThreads_experimental(options?: {
|
|
@@ -4038,4 +3974,4 @@ declare const CommentsApiError: typeof HttpError;
|
|
|
4038
3974
|
/** @deprecated Use HttpError instead. */
|
|
4039
3975
|
declare const NotificationsApiError: typeof HttpError;
|
|
4040
3976
|
|
|
4041
|
-
export { type AckOp, type ActivityData, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, 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, type ContextualPromptContext, type ContextualPromptResponse, 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, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type History, type HistoryVersion, HttpError, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, 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, type LargeMessageStrategy, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LiveblocksErrorContext, type LostConnectionEvent, type Lson, type LsonObject, MutableSignal, type NoInfr, type NodeMap, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, NotificationsApiError, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialUnless, type PartialUserNotificationSettings, type Patchable, Permission, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type Poller, type PrivateClientApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type RejectedStorageOpServerMsg, type Relax, 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, Signal, type SignalType, SortedList, type Status, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type URLSafeString, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type User, type UserJoinServerMsg, type UserLeftServerMsg, type UserNotificationSettings,
|
|
3977
|
+
export { type AckOp, type ActivityData, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, 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, type ContextualPromptContext, type ContextualPromptResponse, 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, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type History, type HistoryVersion, HttpError, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, 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, type LargeMessageStrategy, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LiveblocksErrorContext, type LostConnectionEvent, type Lson, type LsonObject, MutableSignal, type NoInfr, type NodeMap, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, NotificationsApiError, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialUnless, type PartialUserNotificationSettings, type Patchable, Permission, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type Poller, type PrivateClientApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type RejectedStorageOpServerMsg, type Relax, 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, Signal, type SignalType, SortedList, type Status, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type URLSafeString, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type User, type UserJoinServerMsg, type UserLeftServerMsg, type UserNotificationSettings, WebsocketCloseCodes, type YDocUpdateServerMsg, type YjsSyncStatus, ackOp, asPos, assert, assertNever, autoRetry, b64decode, batch, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToThreadData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createThreadId, deprecate, deprecateIf, detectDupes, entries, errorIf, freeze, generateCommentUrl, getMentionedIdsFromCommentBody, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isNotificationChannelEnabled, isPlainObject, isRootCrdt, isStartsWithOperator, kInternal, keys, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, raise, resolveUsersInCommentBody, shallow, stableStringify, stringifyCommentBody, throwUsageError, toAbsoluteUrl, toPlainLson, tryParseJson, url, urljoin, wait, withTimeout };
|
package/dist/index.d.ts
CHANGED
|
@@ -2495,49 +2495,11 @@ type NotificationChannelSettings = {
|
|
|
2495
2495
|
[K in NotificationKind]: boolean;
|
|
2496
2496
|
};
|
|
2497
2497
|
/**
|
|
2498
|
-
*
|
|
2499
|
-
*
|
|
2500
|
-
* Base definition of user notification settings.
|
|
2501
|
-
* Plain means it's a simple object coming from the remote backend.
|
|
2502
|
-
*
|
|
2503
|
-
* It's the raw settings object where somme channels cannot exists
|
|
2504
|
-
* because there are no notification kinds enabled on the dashboard.
|
|
2505
|
-
* And this object isn't yet proxied by the creator factory `createUserNotificationSettings`.
|
|
2506
|
-
*/
|
|
2507
|
-
type UserNotificationSettingsPlain = {
|
|
2508
|
-
[C in NotificationChannel]?: NotificationChannelSettings;
|
|
2509
|
-
};
|
|
2510
|
-
/**
|
|
2511
|
-
* @private
|
|
2512
|
-
*
|
|
2513
|
-
* Symbol to brand some properties and methods
|
|
2514
|
-
* as internal and private in `UserNotificationSettings`
|
|
2515
|
-
*/
|
|
2516
|
-
declare const kPrivate: unique symbol;
|
|
2517
|
-
/**
|
|
2518
|
-
* @private
|
|
2519
|
-
*
|
|
2520
|
-
* Private properties and methods internal to `UserNotificationSettings`.
|
|
2521
|
-
* As a user of Liveblocks, you should NEVER USE ANY OF THESE DIRECTLY,
|
|
2522
|
-
* because bad things will happen.
|
|
2523
|
-
*/
|
|
2524
|
-
type PrivateUserNotificationSettingsApi = {
|
|
2525
|
-
__plain__: UserNotificationSettingsPlain;
|
|
2526
|
-
};
|
|
2527
|
-
/**
|
|
2528
|
-
* User notification settings.
|
|
2498
|
+
* User notification settings are a set of notification channel setting.
|
|
2529
2499
|
* One channel for one set of settings.
|
|
2530
2500
|
*/
|
|
2531
2501
|
type UserNotificationSettings = {
|
|
2532
|
-
[C in NotificationChannel]: NotificationChannelSettings
|
|
2533
|
-
} & {
|
|
2534
|
-
/**
|
|
2535
|
-
* @private
|
|
2536
|
-
*
|
|
2537
|
-
* `UserNotificationSettings` with private internal properties
|
|
2538
|
-
* to store the plain settings and methods.
|
|
2539
|
-
*/
|
|
2540
|
-
[kPrivate]: PrivateUserNotificationSettingsApi;
|
|
2502
|
+
[C in NotificationChannel]: NotificationChannelSettings;
|
|
2541
2503
|
};
|
|
2542
2504
|
/**
|
|
2543
2505
|
* It creates a deep partial specific for `UserNotificationSettings`
|
|
@@ -2552,42 +2514,16 @@ type DeepPartialWithAugmentation<T> = T extends object ? {
|
|
|
2552
2514
|
} : DeepPartialWithAugmentation<T[P]>;
|
|
2553
2515
|
} : T;
|
|
2554
2516
|
/**
|
|
2555
|
-
* Partial user notification settings
|
|
2556
|
-
*
|
|
2557
|
-
* Useful when implementing update functions.
|
|
2558
|
-
*/
|
|
2559
|
-
type PartialUserNotificationSettings = DeepPartialWithAugmentation<UserNotificationSettingsPlain>;
|
|
2560
|
-
/**
|
|
2561
|
-
* @private
|
|
2562
|
-
*
|
|
2563
|
-
* Creates a `UserNotificationSettings` object with the given initial plain settings.
|
|
2564
|
-
* It defines a getter for each channel to access the settings and returns `null` with an error log
|
|
2565
|
-
* in case the required channel isn't enabled in the dashboard.
|
|
2566
|
-
*
|
|
2567
|
-
* You can see this function as `Proxy` like around `UserNotificationSettingsPlain` type.
|
|
2568
|
-
* We can't predict what will be enabled on the dashboard or not, so it's important
|
|
2569
|
-
* provide a good DX to developers by returning `null` completed by an error log
|
|
2570
|
-
* when they try to access a channel that isn't enabled in the dashboard.
|
|
2571
|
-
*/
|
|
2572
|
-
declare function createUserNotificationSettings(plain: UserNotificationSettingsPlain): UserNotificationSettings;
|
|
2573
|
-
/**
|
|
2574
|
-
* @private
|
|
2575
|
-
*
|
|
2576
|
-
* Patch a `UserNotificationSettings` object by applying notification kind updates
|
|
2577
|
-
* coming from a `PartialUserNotificationSettings` object.
|
|
2517
|
+
* Partial user notification settings
|
|
2518
|
+
* with augmentation preserved gracefully
|
|
2578
2519
|
*/
|
|
2579
|
-
|
|
2520
|
+
type PartialUserNotificationSettings = DeepPartialWithAugmentation<UserNotificationSettings>;
|
|
2580
2521
|
/**
|
|
2581
2522
|
*
|
|
2582
2523
|
* Utility to check if a notification channel settings
|
|
2583
2524
|
* is enabled for every notification kinds.
|
|
2584
|
-
*
|
|
2585
|
-
* Usage:
|
|
2586
|
-
* ```ts
|
|
2587
|
-
* const isEmailChannelEnabled = isNotificationChannelEnabled(settings.email);
|
|
2588
|
-
* ```
|
|
2589
2525
|
*/
|
|
2590
|
-
declare function isNotificationChannelEnabled(settings: NotificationChannelSettings
|
|
2526
|
+
declare function isNotificationChannelEnabled(settings: NotificationChannelSettings): boolean;
|
|
2591
2527
|
|
|
2592
2528
|
interface RoomHttpApi<M extends BaseMetadata> {
|
|
2593
2529
|
getThreads(options: {
|
|
@@ -2805,8 +2741,8 @@ interface NotificationHttpApi<M extends BaseMetadata> {
|
|
|
2805
2741
|
deleteInboxNotification(inboxNotificationId: string): Promise<void>;
|
|
2806
2742
|
getUserNotificationSettings(options?: {
|
|
2807
2743
|
signal?: AbortSignal;
|
|
2808
|
-
}): Promise<
|
|
2809
|
-
updateUserNotificationSettings(settings: PartialUserNotificationSettings): Promise<
|
|
2744
|
+
}): Promise<UserNotificationSettings>;
|
|
2745
|
+
updateUserNotificationSettings(settings: PartialUserNotificationSettings): Promise<UserNotificationSettings>;
|
|
2810
2746
|
}
|
|
2811
2747
|
interface LiveblocksHttpApi<M extends BaseMetadata> extends RoomHttpApi<M>, NotificationHttpApi<M> {
|
|
2812
2748
|
getUserThreads_experimental(options?: {
|
|
@@ -4038,4 +3974,4 @@ declare const CommentsApiError: typeof HttpError;
|
|
|
4038
3974
|
/** @deprecated Use HttpError instead. */
|
|
4039
3975
|
declare const NotificationsApiError: typeof HttpError;
|
|
4040
3976
|
|
|
4041
|
-
export { type AckOp, type ActivityData, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, 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, type ContextualPromptContext, type ContextualPromptResponse, 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, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type History, type HistoryVersion, HttpError, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, 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, type LargeMessageStrategy, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LiveblocksErrorContext, type LostConnectionEvent, type Lson, type LsonObject, MutableSignal, type NoInfr, type NodeMap, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, NotificationsApiError, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialUnless, type PartialUserNotificationSettings, type Patchable, Permission, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type Poller, type PrivateClientApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type RejectedStorageOpServerMsg, type Relax, 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, Signal, type SignalType, SortedList, type Status, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type URLSafeString, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type User, type UserJoinServerMsg, type UserLeftServerMsg, type UserNotificationSettings,
|
|
3977
|
+
export { type AckOp, type ActivityData, type AsyncError, type AsyncLoading, type AsyncResult, type AsyncSuccess, type Awaitable, 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, type ContextualPromptContext, type ContextualPromptResponse, 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, DefaultMap, type Delegates, type DeleteCrdtOp, type DeleteObjectKeyOp, DerivedSignal, DevToolsTreeNode as DevTools, protocol as DevToolsMsg, type DistributiveOmit, type EnsureJson, type EnterOptions, type EventSource, type FetchStorageClientMsg, type FetchYDocClientMsg, type GetThreadsOptions, type History, type HistoryVersion, HttpError, type ISignal, type IUserInfo, type IWebSocket, type IWebSocketCloseEvent, type IWebSocketEvent, type IWebSocketInstance, type IWebSocketMessageEvent, type IYjsProvider, 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, type LargeMessageStrategy, LiveList, type LiveListUpdate, LiveMap, type LiveMapUpdate, type LiveNode, LiveObject, type LiveObjectUpdate, type LiveStructure, LiveblocksError, type LiveblocksErrorContext, type LostConnectionEvent, type Lson, type LsonObject, MutableSignal, type NoInfr, type NodeMap, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, NotificationsApiError, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialUnless, type PartialUserNotificationSettings, type Patchable, Permission, type PlainLson, type PlainLsonFields, type PlainLsonList, type PlainLsonMap, type PlainLsonObject, type Poller, type PrivateClientApi, type PrivateRoomApi, Promise_withResolvers, type QueryMetadata, type QueryParams, type RejectedStorageOpServerMsg, type Relax, 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, Signal, type SignalType, SortedList, type Status, type StorageStatus, type StorageUpdate, type StringifyCommentBodyElements, type StringifyCommentBodyOptions, type SyncSource, type SyncStatus, TextEditorType, type ThreadData, type ThreadDataPlain, type ThreadDataWithDeleteInfo, type ThreadDeleteInfo, type ToImmutable, type ToJson, type URLSafeString, type UnsubscribeCallback, type UpdateObjectOp, type UpdatePresenceClientMsg, type UpdatePresenceServerMsg, type UpdateStorageClientMsg, type UpdateStorageServerMsg, type UpdateYDocClientMsg, type UploadAttachmentOptions, type User, type UserJoinServerMsg, type UserLeftServerMsg, type UserNotificationSettings, WebsocketCloseCodes, type YDocUpdateServerMsg, type YjsSyncStatus, ackOp, asPos, assert, assertNever, autoRetry, b64decode, batch, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToThreadData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createThreadId, deprecate, deprecateIf, detectDupes, entries, errorIf, freeze, generateCommentUrl, getMentionedIdsFromCommentBody, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isNotificationChannelEnabled, isPlainObject, isRootCrdt, isStartsWithOperator, kInternal, keys, legacy_patchImmutableObject, lsonToJson, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, raise, resolveUsersInCommentBody, shallow, stableStringify, stringifyCommentBody, throwUsageError, toAbsoluteUrl, toPlainLson, tryParseJson, url, urljoin, wait, 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.
|
|
9
|
+
var PKG_VERSION = "2.19.0";
|
|
10
10
|
var PKG_FORMAT = "esm";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -187,12 +187,6 @@ function keys(obj) {
|
|
|
187
187
|
function values(obj) {
|
|
188
188
|
return Object.values(obj);
|
|
189
189
|
}
|
|
190
|
-
function create(obj, descriptors) {
|
|
191
|
-
if (typeof descriptors !== "undefined") {
|
|
192
|
-
return Object.create(obj, descriptors);
|
|
193
|
-
}
|
|
194
|
-
return Object.create(obj);
|
|
195
|
-
}
|
|
196
190
|
function mapValues(obj, mapFn) {
|
|
197
191
|
const result = {};
|
|
198
192
|
for (const pair of Object.entries(obj)) {
|
|
@@ -3603,73 +3597,6 @@ function unlinkDevTools(roomId) {
|
|
|
3603
3597
|
});
|
|
3604
3598
|
}
|
|
3605
3599
|
|
|
3606
|
-
// src/protocol/UserNotificationSettings.ts
|
|
3607
|
-
var kPrivate = Symbol("user-notification-settings-private");
|
|
3608
|
-
function createUserNotificationSettings(plain) {
|
|
3609
|
-
const channels = [
|
|
3610
|
-
"email",
|
|
3611
|
-
"slack",
|
|
3612
|
-
"teams",
|
|
3613
|
-
"webPush"
|
|
3614
|
-
];
|
|
3615
|
-
const descriptors = {
|
|
3616
|
-
[kPrivate]: {
|
|
3617
|
-
value: {
|
|
3618
|
-
__plain__: plain
|
|
3619
|
-
},
|
|
3620
|
-
enumerable: false
|
|
3621
|
-
}
|
|
3622
|
-
};
|
|
3623
|
-
for (const channel of channels) {
|
|
3624
|
-
descriptors[channel] = {
|
|
3625
|
-
enumerable: true,
|
|
3626
|
-
/**
|
|
3627
|
-
* In the TypeScript standard library definitions, the built-in interface for a property descriptor
|
|
3628
|
-
* does not include a specialized type for the “this” context in the getter or setter functions.
|
|
3629
|
-
* As a result, both the get and set methods implicitly have this: any.
|
|
3630
|
-
* The reason is that property descriptors in JavaScript are used across various objects with
|
|
3631
|
-
* no enforced shape for this. And so the standard library definitions have to remain as broad as possible
|
|
3632
|
-
* to support any valid JavaScript usage (e.g `Object.defineProperty`).
|
|
3633
|
-
*
|
|
3634
|
-
* So we can safely tells that this getter is typed as `this: UserNotificationSettings` because we're
|
|
3635
|
-
* creating a well known shaped object → `UserNotificationSettings`.
|
|
3636
|
-
*/
|
|
3637
|
-
get() {
|
|
3638
|
-
const value = this[kPrivate].__plain__[channel];
|
|
3639
|
-
if (typeof value === "undefined") {
|
|
3640
|
-
error2(
|
|
3641
|
-
`In order to use the '${channel}' channel, please set up your project first. For more information https://liveblocks.io/docs/errors/enable-a-notification-channel`
|
|
3642
|
-
);
|
|
3643
|
-
return null;
|
|
3644
|
-
}
|
|
3645
|
-
return value;
|
|
3646
|
-
}
|
|
3647
|
-
};
|
|
3648
|
-
}
|
|
3649
|
-
return create(null, descriptors);
|
|
3650
|
-
}
|
|
3651
|
-
function patchUserNotificationSettings(existing, patch) {
|
|
3652
|
-
const outcoming = createUserNotificationSettings({
|
|
3653
|
-
...existing[kPrivate].__plain__
|
|
3654
|
-
});
|
|
3655
|
-
for (const channel of keys(patch)) {
|
|
3656
|
-
const updates = patch[channel];
|
|
3657
|
-
if (updates !== void 0) {
|
|
3658
|
-
const kindUpdates = Object.fromEntries(
|
|
3659
|
-
entries(updates).filter(([, value]) => value !== void 0)
|
|
3660
|
-
);
|
|
3661
|
-
outcoming[kPrivate].__plain__[channel] = {
|
|
3662
|
-
...outcoming[kPrivate].__plain__[channel],
|
|
3663
|
-
...kindUpdates
|
|
3664
|
-
};
|
|
3665
|
-
}
|
|
3666
|
-
}
|
|
3667
|
-
return outcoming;
|
|
3668
|
-
}
|
|
3669
|
-
function isNotificationChannelEnabled(settings) {
|
|
3670
|
-
return settings !== null ? values(settings).every((enabled) => enabled === true) : false;
|
|
3671
|
-
}
|
|
3672
|
-
|
|
3673
3600
|
// src/lib/position.ts
|
|
3674
3601
|
var MIN_CODE = 32;
|
|
3675
3602
|
var MAX_CODE = 126;
|
|
@@ -8262,16 +8189,6 @@ function createClient(options) {
|
|
|
8262
8189
|
const win = typeof window !== "undefined" ? window : void 0;
|
|
8263
8190
|
win?.addEventListener("beforeunload", maybePreventClose);
|
|
8264
8191
|
}
|
|
8265
|
-
async function getNotificationSettings(options2) {
|
|
8266
|
-
const plainSettings = await httpClient.getUserNotificationSettings(options2);
|
|
8267
|
-
const settings = createUserNotificationSettings(plainSettings);
|
|
8268
|
-
return settings;
|
|
8269
|
-
}
|
|
8270
|
-
async function updateNotificationSettings(settings) {
|
|
8271
|
-
const plainSettings = await httpClient.updateUserNotificationSettings(settings);
|
|
8272
|
-
const settingsObject = createUserNotificationSettings(plainSettings);
|
|
8273
|
-
return settingsObject;
|
|
8274
|
-
}
|
|
8275
8192
|
const client = Object.defineProperty(
|
|
8276
8193
|
{
|
|
8277
8194
|
enterRoom,
|
|
@@ -8285,9 +8202,9 @@ function createClient(options) {
|
|
|
8285
8202
|
markInboxNotificationAsRead: httpClient.markInboxNotificationAsRead,
|
|
8286
8203
|
deleteAllInboxNotifications: httpClient.deleteAllInboxNotifications,
|
|
8287
8204
|
deleteInboxNotification: httpClient.deleteInboxNotification,
|
|
8288
|
-
// Public
|
|
8289
|
-
getNotificationSettings,
|
|
8290
|
-
updateNotificationSettings,
|
|
8205
|
+
// Public channel notification settings API
|
|
8206
|
+
getNotificationSettings: httpClient.getUserNotificationSettings,
|
|
8207
|
+
updateNotificationSettings: httpClient.updateUserNotificationSettings,
|
|
8291
8208
|
// Advanced resolvers APIs
|
|
8292
8209
|
resolvers: {
|
|
8293
8210
|
invalidateUsers: invalidateResolvedUsers,
|
|
@@ -9277,6 +9194,11 @@ var SortedList = class _SortedList {
|
|
|
9277
9194
|
}
|
|
9278
9195
|
};
|
|
9279
9196
|
|
|
9197
|
+
// src/protocol/UserNotificationSettings.ts
|
|
9198
|
+
function isNotificationChannelEnabled(settings) {
|
|
9199
|
+
return values(settings).every((enabled) => enabled === true);
|
|
9200
|
+
}
|
|
9201
|
+
|
|
9280
9202
|
// src/types/Others.ts
|
|
9281
9203
|
var TextEditorType = /* @__PURE__ */ ((TextEditorType2) => {
|
|
9282
9204
|
TextEditorType2["Lexical"] = "lexical";
|
|
@@ -9329,7 +9251,6 @@ export {
|
|
|
9329
9251
|
createCommentId,
|
|
9330
9252
|
createInboxNotificationId,
|
|
9331
9253
|
createThreadId,
|
|
9332
|
-
createUserNotificationSettings,
|
|
9333
9254
|
deprecate,
|
|
9334
9255
|
deprecateIf,
|
|
9335
9256
|
detectDupes,
|
|
@@ -9365,7 +9286,6 @@ export {
|
|
|
9365
9286
|
nn,
|
|
9366
9287
|
objectToQuery,
|
|
9367
9288
|
patchLiveObjectKey,
|
|
9368
|
-
patchUserNotificationSettings,
|
|
9369
9289
|
raise,
|
|
9370
9290
|
resolveUsersInCommentBody,
|
|
9371
9291
|
shallow,
|