@liveblocks/core 2.18.4-uns1 → 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 -89
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -76
- package/dist/index.d.ts +9 -76
- package/dist/index.js +9 -88
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -2495,47 +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
|
-
type UserNotificationSettings =
|
|
2532
|
-
|
|
2533
|
-
* @private
|
|
2534
|
-
*
|
|
2535
|
-
* `UserNotificationSettings` with private internal properties
|
|
2536
|
-
* to store the plain settings and methods.
|
|
2537
|
-
*/
|
|
2538
|
-
[kPrivate]: PrivateUserNotificationSettingsApi;
|
|
2501
|
+
type UserNotificationSettings = {
|
|
2502
|
+
[C in NotificationChannel]: NotificationChannelSettings;
|
|
2539
2503
|
};
|
|
2540
2504
|
/**
|
|
2541
2505
|
* It creates a deep partial specific for `UserNotificationSettings`
|
|
@@ -2550,45 +2514,14 @@ type DeepPartialWithAugmentation<T> = T extends object ? {
|
|
|
2550
2514
|
} : DeepPartialWithAugmentation<T[P]>;
|
|
2551
2515
|
} : T;
|
|
2552
2516
|
/**
|
|
2553
|
-
* Partial user notification settings
|
|
2554
|
-
*
|
|
2555
|
-
* Useful when implementing update functions.
|
|
2556
|
-
*/
|
|
2557
|
-
type PartialUserNotificationSettings = DeepPartialWithAugmentation<UserNotificationSettingsPlain>;
|
|
2558
|
-
/**
|
|
2559
|
-
* @private
|
|
2560
|
-
*
|
|
2561
|
-
* Creates a `UserNotificationSettings` object with the given initial plain settings.
|
|
2562
|
-
* It defines a getter for each channel to access the settings and throws and error
|
|
2563
|
-
* in case the required channel isn't enabled in the dashboard.
|
|
2564
|
-
*
|
|
2565
|
-
* You can see this function as `Proxy` like around `UserNotificationSettingsPlain` type.
|
|
2566
|
-
* We can't predict what will be enabled on the dashboard or not, so it's important
|
|
2567
|
-
* provide a good DX to developers by throwing an error when they try to access a channel
|
|
2568
|
-
* that isn't enabled in the dashboard.
|
|
2569
|
-
*/
|
|
2570
|
-
declare function createUserNotificationSettings(plain: UserNotificationSettingsPlain): UserNotificationSettings;
|
|
2571
|
-
/**
|
|
2572
|
-
* @private
|
|
2573
|
-
*
|
|
2574
|
-
* Patch a `UserNotificationSettings` object by applying notification kind updates
|
|
2575
|
-
* coming from a `PartialUserNotificationSettings` object.
|
|
2517
|
+
* Partial user notification settings
|
|
2518
|
+
* with augmentation preserved gracefully
|
|
2576
2519
|
*/
|
|
2577
|
-
|
|
2520
|
+
type PartialUserNotificationSettings = DeepPartialWithAugmentation<UserNotificationSettings>;
|
|
2578
2521
|
/**
|
|
2579
2522
|
*
|
|
2580
2523
|
* Utility to check if a notification channel settings
|
|
2581
2524
|
* is enabled for every notification kinds.
|
|
2582
|
-
*
|
|
2583
|
-
* Usage:
|
|
2584
|
-
* ```ts
|
|
2585
|
-
* const isEmailChannelEnabled = isNotificationChannelEnabled(settings.email);
|
|
2586
|
-
* ```
|
|
2587
|
-
*
|
|
2588
|
-
* ⚠️ Warning: when using this function, you should be aware
|
|
2589
|
-
* you need to ensure you have notification kinds enabled in the dashboard
|
|
2590
|
-
* for the channel you're checking. Otherwise, it will raise an error at runtime because
|
|
2591
|
-
* the backend don't send the settings for a not enabled channel (e.g. no notification kinds enabled in a channel).
|
|
2592
2525
|
*/
|
|
2593
2526
|
declare function isNotificationChannelEnabled(settings: NotificationChannelSettings): boolean;
|
|
2594
2527
|
|
|
@@ -2808,8 +2741,8 @@ interface NotificationHttpApi<M extends BaseMetadata> {
|
|
|
2808
2741
|
deleteInboxNotification(inboxNotificationId: string): Promise<void>;
|
|
2809
2742
|
getUserNotificationSettings(options?: {
|
|
2810
2743
|
signal?: AbortSignal;
|
|
2811
|
-
}): Promise<
|
|
2812
|
-
updateUserNotificationSettings(settings: PartialUserNotificationSettings): Promise<
|
|
2744
|
+
}): Promise<UserNotificationSettings>;
|
|
2745
|
+
updateUserNotificationSettings(settings: PartialUserNotificationSettings): Promise<UserNotificationSettings>;
|
|
2813
2746
|
}
|
|
2814
2747
|
interface LiveblocksHttpApi<M extends BaseMetadata> extends RoomHttpApi<M>, NotificationHttpApi<M> {
|
|
2815
2748
|
getUserThreads_experimental(options?: {
|
|
@@ -4041,4 +3974,4 @@ declare const CommentsApiError: typeof HttpError;
|
|
|
4041
3974
|
/** @deprecated Use HttpError instead. */
|
|
4042
3975
|
declare const NotificationsApiError: typeof HttpError;
|
|
4043
3976
|
|
|
4044
|
-
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,47 +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
|
-
type UserNotificationSettings =
|
|
2532
|
-
|
|
2533
|
-
* @private
|
|
2534
|
-
*
|
|
2535
|
-
* `UserNotificationSettings` with private internal properties
|
|
2536
|
-
* to store the plain settings and methods.
|
|
2537
|
-
*/
|
|
2538
|
-
[kPrivate]: PrivateUserNotificationSettingsApi;
|
|
2501
|
+
type UserNotificationSettings = {
|
|
2502
|
+
[C in NotificationChannel]: NotificationChannelSettings;
|
|
2539
2503
|
};
|
|
2540
2504
|
/**
|
|
2541
2505
|
* It creates a deep partial specific for `UserNotificationSettings`
|
|
@@ -2550,45 +2514,14 @@ type DeepPartialWithAugmentation<T> = T extends object ? {
|
|
|
2550
2514
|
} : DeepPartialWithAugmentation<T[P]>;
|
|
2551
2515
|
} : T;
|
|
2552
2516
|
/**
|
|
2553
|
-
* Partial user notification settings
|
|
2554
|
-
*
|
|
2555
|
-
* Useful when implementing update functions.
|
|
2556
|
-
*/
|
|
2557
|
-
type PartialUserNotificationSettings = DeepPartialWithAugmentation<UserNotificationSettingsPlain>;
|
|
2558
|
-
/**
|
|
2559
|
-
* @private
|
|
2560
|
-
*
|
|
2561
|
-
* Creates a `UserNotificationSettings` object with the given initial plain settings.
|
|
2562
|
-
* It defines a getter for each channel to access the settings and throws and error
|
|
2563
|
-
* in case the required channel isn't enabled in the dashboard.
|
|
2564
|
-
*
|
|
2565
|
-
* You can see this function as `Proxy` like around `UserNotificationSettingsPlain` type.
|
|
2566
|
-
* We can't predict what will be enabled on the dashboard or not, so it's important
|
|
2567
|
-
* provide a good DX to developers by throwing an error when they try to access a channel
|
|
2568
|
-
* that isn't enabled in the dashboard.
|
|
2569
|
-
*/
|
|
2570
|
-
declare function createUserNotificationSettings(plain: UserNotificationSettingsPlain): UserNotificationSettings;
|
|
2571
|
-
/**
|
|
2572
|
-
* @private
|
|
2573
|
-
*
|
|
2574
|
-
* Patch a `UserNotificationSettings` object by applying notification kind updates
|
|
2575
|
-
* coming from a `PartialUserNotificationSettings` object.
|
|
2517
|
+
* Partial user notification settings
|
|
2518
|
+
* with augmentation preserved gracefully
|
|
2576
2519
|
*/
|
|
2577
|
-
|
|
2520
|
+
type PartialUserNotificationSettings = DeepPartialWithAugmentation<UserNotificationSettings>;
|
|
2578
2521
|
/**
|
|
2579
2522
|
*
|
|
2580
2523
|
* Utility to check if a notification channel settings
|
|
2581
2524
|
* is enabled for every notification kinds.
|
|
2582
|
-
*
|
|
2583
|
-
* Usage:
|
|
2584
|
-
* ```ts
|
|
2585
|
-
* const isEmailChannelEnabled = isNotificationChannelEnabled(settings.email);
|
|
2586
|
-
* ```
|
|
2587
|
-
*
|
|
2588
|
-
* ⚠️ Warning: when using this function, you should be aware
|
|
2589
|
-
* you need to ensure you have notification kinds enabled in the dashboard
|
|
2590
|
-
* for the channel you're checking. Otherwise, it will raise an error at runtime because
|
|
2591
|
-
* the backend don't send the settings for a not enabled channel (e.g. no notification kinds enabled in a channel).
|
|
2592
2525
|
*/
|
|
2593
2526
|
declare function isNotificationChannelEnabled(settings: NotificationChannelSettings): boolean;
|
|
2594
2527
|
|
|
@@ -2808,8 +2741,8 @@ interface NotificationHttpApi<M extends BaseMetadata> {
|
|
|
2808
2741
|
deleteInboxNotification(inboxNotificationId: string): Promise<void>;
|
|
2809
2742
|
getUserNotificationSettings(options?: {
|
|
2810
2743
|
signal?: AbortSignal;
|
|
2811
|
-
}): Promise<
|
|
2812
|
-
updateUserNotificationSettings(settings: PartialUserNotificationSettings): Promise<
|
|
2744
|
+
}): Promise<UserNotificationSettings>;
|
|
2745
|
+
updateUserNotificationSettings(settings: PartialUserNotificationSettings): Promise<UserNotificationSettings>;
|
|
2813
2746
|
}
|
|
2814
2747
|
interface LiveblocksHttpApi<M extends BaseMetadata> extends RoomHttpApi<M>, NotificationHttpApi<M> {
|
|
2815
2748
|
getUserThreads_experimental(options?: {
|
|
@@ -4041,4 +3974,4 @@ declare const CommentsApiError: typeof HttpError;
|
|
|
4041
3974
|
/** @deprecated Use HttpError instead. */
|
|
4042
3975
|
declare const NotificationsApiError: typeof HttpError;
|
|
4043
3976
|
|
|
4044
|
-
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,72 +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 (!value) {
|
|
3640
|
-
raise(
|
|
3641
|
-
`In order to use the '${channel}' channel, please set up your project first. See <link to docs>`
|
|
3642
|
-
);
|
|
3643
|
-
}
|
|
3644
|
-
return value;
|
|
3645
|
-
}
|
|
3646
|
-
};
|
|
3647
|
-
}
|
|
3648
|
-
return create(null, descriptors);
|
|
3649
|
-
}
|
|
3650
|
-
function patchUserNotificationSettings(existing, patch) {
|
|
3651
|
-
const outcoming = createUserNotificationSettings({
|
|
3652
|
-
...existing[kPrivate].__plain__
|
|
3653
|
-
});
|
|
3654
|
-
for (const channel of keys(patch)) {
|
|
3655
|
-
const updates = patch[channel];
|
|
3656
|
-
if (updates !== void 0) {
|
|
3657
|
-
const kindUpdates = Object.fromEntries(
|
|
3658
|
-
entries(updates).filter(([, value]) => value !== void 0)
|
|
3659
|
-
);
|
|
3660
|
-
outcoming[kPrivate].__plain__[channel] = {
|
|
3661
|
-
...outcoming[kPrivate].__plain__[channel],
|
|
3662
|
-
...kindUpdates
|
|
3663
|
-
};
|
|
3664
|
-
}
|
|
3665
|
-
}
|
|
3666
|
-
return outcoming;
|
|
3667
|
-
}
|
|
3668
|
-
function isNotificationChannelEnabled(settings) {
|
|
3669
|
-
return values(settings).every((enabled) => enabled === true);
|
|
3670
|
-
}
|
|
3671
|
-
|
|
3672
3600
|
// src/lib/position.ts
|
|
3673
3601
|
var MIN_CODE = 32;
|
|
3674
3602
|
var MAX_CODE = 126;
|
|
@@ -8261,16 +8189,6 @@ function createClient(options) {
|
|
|
8261
8189
|
const win = typeof window !== "undefined" ? window : void 0;
|
|
8262
8190
|
win?.addEventListener("beforeunload", maybePreventClose);
|
|
8263
8191
|
}
|
|
8264
|
-
async function getNotificationSettings(options2) {
|
|
8265
|
-
const plainSettings = await httpClient.getUserNotificationSettings(options2);
|
|
8266
|
-
const settings = createUserNotificationSettings(plainSettings);
|
|
8267
|
-
return settings;
|
|
8268
|
-
}
|
|
8269
|
-
async function updateNotificationSettings(settings) {
|
|
8270
|
-
const plainSettings = await httpClient.updateUserNotificationSettings(settings);
|
|
8271
|
-
const settingsObject = createUserNotificationSettings(plainSettings);
|
|
8272
|
-
return settingsObject;
|
|
8273
|
-
}
|
|
8274
8192
|
const client = Object.defineProperty(
|
|
8275
8193
|
{
|
|
8276
8194
|
enterRoom,
|
|
@@ -8284,9 +8202,9 @@ function createClient(options) {
|
|
|
8284
8202
|
markInboxNotificationAsRead: httpClient.markInboxNotificationAsRead,
|
|
8285
8203
|
deleteAllInboxNotifications: httpClient.deleteAllInboxNotifications,
|
|
8286
8204
|
deleteInboxNotification: httpClient.deleteInboxNotification,
|
|
8287
|
-
// Public
|
|
8288
|
-
getNotificationSettings,
|
|
8289
|
-
updateNotificationSettings,
|
|
8205
|
+
// Public channel notification settings API
|
|
8206
|
+
getNotificationSettings: httpClient.getUserNotificationSettings,
|
|
8207
|
+
updateNotificationSettings: httpClient.updateUserNotificationSettings,
|
|
8290
8208
|
// Advanced resolvers APIs
|
|
8291
8209
|
resolvers: {
|
|
8292
8210
|
invalidateUsers: invalidateResolvedUsers,
|
|
@@ -9276,6 +9194,11 @@ var SortedList = class _SortedList {
|
|
|
9276
9194
|
}
|
|
9277
9195
|
};
|
|
9278
9196
|
|
|
9197
|
+
// src/protocol/UserNotificationSettings.ts
|
|
9198
|
+
function isNotificationChannelEnabled(settings) {
|
|
9199
|
+
return values(settings).every((enabled) => enabled === true);
|
|
9200
|
+
}
|
|
9201
|
+
|
|
9279
9202
|
// src/types/Others.ts
|
|
9280
9203
|
var TextEditorType = /* @__PURE__ */ ((TextEditorType2) => {
|
|
9281
9204
|
TextEditorType2["Lexical"] = "lexical";
|
|
@@ -9328,7 +9251,6 @@ export {
|
|
|
9328
9251
|
createCommentId,
|
|
9329
9252
|
createInboxNotificationId,
|
|
9330
9253
|
createThreadId,
|
|
9331
|
-
createUserNotificationSettings,
|
|
9332
9254
|
deprecate,
|
|
9333
9255
|
deprecateIf,
|
|
9334
9256
|
detectDupes,
|
|
@@ -9364,7 +9286,6 @@ export {
|
|
|
9364
9286
|
nn,
|
|
9365
9287
|
objectToQuery,
|
|
9366
9288
|
patchLiveObjectKey,
|
|
9367
|
-
patchUserNotificationSettings,
|
|
9368
9289
|
raise,
|
|
9369
9290
|
resolveUsersInCommentBody,
|
|
9370
9291
|
shallow,
|