@liveblocks/core 2.23.1 → 2.24.0-sub1
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 +119 -35
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +224 -117
- package/dist/index.d.ts +224 -117
- package/dist/index.js +120 -36
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1299,6 +1299,17 @@ type UpdateYDocClientMsg = {
|
|
|
1299
1299
|
readonly v2?: boolean;
|
|
1300
1300
|
};
|
|
1301
1301
|
|
|
1302
|
+
type RoomThreadsSubscriptionSettings = "all" | "replies_and_mentions" | "none";
|
|
1303
|
+
type RoomTextMentionsSubscriptionSettings = "mine" | "none";
|
|
1304
|
+
type RoomSubscriptionSettings = {
|
|
1305
|
+
threads: RoomThreadsSubscriptionSettings;
|
|
1306
|
+
textMentions: RoomTextMentionsSubscriptionSettings;
|
|
1307
|
+
};
|
|
1308
|
+
/**
|
|
1309
|
+
* @deprecated Renamed to `RoomSubscriptionSettings`
|
|
1310
|
+
*/
|
|
1311
|
+
type RoomNotificationSettings = RoomSubscriptionSettings;
|
|
1312
|
+
|
|
1302
1313
|
declare enum ServerMsgCode {
|
|
1303
1314
|
UPDATE_PRESENCE = 100,
|
|
1304
1315
|
USER_JOINED = 101,
|
|
@@ -1537,6 +1548,118 @@ type RejectedStorageOpServerMsg = {
|
|
|
1537
1548
|
readonly reason: string;
|
|
1538
1549
|
};
|
|
1539
1550
|
|
|
1551
|
+
/**
|
|
1552
|
+
* Pre-defined notification channels support list.
|
|
1553
|
+
*/
|
|
1554
|
+
type NotificationChannel = "email" | "slack" | "teams" | "webPush";
|
|
1555
|
+
/**
|
|
1556
|
+
* `K` represents custom notification kinds
|
|
1557
|
+
* defined in the augmentation `ActivitiesData` (e.g `liveblocks.config.ts`).
|
|
1558
|
+
* It means the type `NotificationKind` will be shaped like:
|
|
1559
|
+
* thread | textMention | $customKind1 | $customKind2 | ...
|
|
1560
|
+
*/
|
|
1561
|
+
type NotificationKind<K extends keyof DAD = keyof DAD> = "thread" | "textMention" | K;
|
|
1562
|
+
/**
|
|
1563
|
+
* A notification channel settings is a set of notification kinds.
|
|
1564
|
+
* One setting can have multiple kinds (+ augmentation)
|
|
1565
|
+
*/
|
|
1566
|
+
type NotificationChannelSettings = {
|
|
1567
|
+
[K in NotificationKind]: boolean;
|
|
1568
|
+
};
|
|
1569
|
+
/**
|
|
1570
|
+
* @private
|
|
1571
|
+
*
|
|
1572
|
+
* Base definition of notification settings.
|
|
1573
|
+
* Plain means it's a simple object coming from the remote backend.
|
|
1574
|
+
*
|
|
1575
|
+
* It's the raw settings object where somme channels cannot exists
|
|
1576
|
+
* because there are no notification kinds enabled on the dashboard.
|
|
1577
|
+
* And this object isn't yet proxied by the creator factory `createNotificationSettings`.
|
|
1578
|
+
*/
|
|
1579
|
+
type NotificationSettingsPlain = {
|
|
1580
|
+
[C in NotificationChannel]?: NotificationChannelSettings;
|
|
1581
|
+
};
|
|
1582
|
+
/**
|
|
1583
|
+
* @deprecated Renamed to `NotificationSettings`
|
|
1584
|
+
*
|
|
1585
|
+
* Notification settings.
|
|
1586
|
+
* One channel for one set of settings.
|
|
1587
|
+
*/
|
|
1588
|
+
type UserNotificationSettings = NotificationSettings;
|
|
1589
|
+
/**
|
|
1590
|
+
* Notification settings.
|
|
1591
|
+
* One channel for one set of settings.
|
|
1592
|
+
*/
|
|
1593
|
+
type NotificationSettings = {
|
|
1594
|
+
[C in NotificationChannel]: NotificationChannelSettings | null;
|
|
1595
|
+
};
|
|
1596
|
+
/**
|
|
1597
|
+
* It creates a deep partial specific for `NotificationSettings`
|
|
1598
|
+
* to offer a nice DX when updating the settings (e.g not being forced to define every keys)
|
|
1599
|
+
* and at the same the some preserver the augmentation for custom kinds (e.g `liveblocks.config.ts`).
|
|
1600
|
+
*/
|
|
1601
|
+
type DeepPartialWithAugmentation<T> = T extends object ? {
|
|
1602
|
+
[P in keyof T]?: T[P] extends {
|
|
1603
|
+
[K in NotificationKind]: boolean;
|
|
1604
|
+
} ? Partial<T[P]> & {
|
|
1605
|
+
[K in keyof DAD]?: boolean;
|
|
1606
|
+
} : DeepPartialWithAugmentation<T[P]>;
|
|
1607
|
+
} : T;
|
|
1608
|
+
/**
|
|
1609
|
+
* Partial notification settings with augmentation preserved gracefully.
|
|
1610
|
+
* It means you can update the settings without being forced to define every keys.
|
|
1611
|
+
* Useful when implementing update functions.
|
|
1612
|
+
*/
|
|
1613
|
+
type PartialNotificationSettings = DeepPartialWithAugmentation<NotificationSettingsPlain>;
|
|
1614
|
+
/**
|
|
1615
|
+
* @private
|
|
1616
|
+
*
|
|
1617
|
+
* Creates a `NotificationSettings` object with the given initial plain settings.
|
|
1618
|
+
* It defines a getter for each channel to access the settings and returns `null` with an error log
|
|
1619
|
+
* in case the required channel isn't enabled in the dashboard.
|
|
1620
|
+
*
|
|
1621
|
+
* You can see this function as `Proxy` like around `NotificationSettingsPlain` type.
|
|
1622
|
+
* We can't predict what will be enabled on the dashboard or not, so it's important
|
|
1623
|
+
* provide a good DX to developers by returning `null` completed by an error log
|
|
1624
|
+
* when they try to access a channel that isn't enabled in the dashboard.
|
|
1625
|
+
*/
|
|
1626
|
+
declare function createNotificationSettings(plain: NotificationSettingsPlain): NotificationSettings;
|
|
1627
|
+
/**
|
|
1628
|
+
* @private
|
|
1629
|
+
*
|
|
1630
|
+
* Patch a `NotificationSettings` object by applying notification kind updates
|
|
1631
|
+
* coming from a `PartialNotificationSettings` object.
|
|
1632
|
+
*/
|
|
1633
|
+
declare function patchNotificationSettings(existing: NotificationSettings, patch: PartialNotificationSettings): NotificationSettings;
|
|
1634
|
+
/**
|
|
1635
|
+
*
|
|
1636
|
+
* Utility to check if a notification channel settings
|
|
1637
|
+
* is enabled for every notification kinds.
|
|
1638
|
+
*
|
|
1639
|
+
* Usage:
|
|
1640
|
+
* ```ts
|
|
1641
|
+
* const isEmailChannelEnabled = isNotificationChannelEnabled(settings.email);
|
|
1642
|
+
* ```
|
|
1643
|
+
*/
|
|
1644
|
+
declare function isNotificationChannelEnabled(settings: NotificationChannelSettings | null): boolean;
|
|
1645
|
+
|
|
1646
|
+
type SubscriptionData<K extends keyof DAD = keyof DAD> = {
|
|
1647
|
+
kind: NotificationKind<K>;
|
|
1648
|
+
subjectId: string;
|
|
1649
|
+
createdAt: Date;
|
|
1650
|
+
};
|
|
1651
|
+
type SubscriptionDataPlain = DateToString<SubscriptionData>;
|
|
1652
|
+
type SubscriptionDeleteInfo = {
|
|
1653
|
+
type: "deletedSubscription";
|
|
1654
|
+
kind: NotificationKind;
|
|
1655
|
+
subjectId: string;
|
|
1656
|
+
deletedAt: Date;
|
|
1657
|
+
};
|
|
1658
|
+
type SubscriptionDeleteInfoPlain = DateToString<SubscriptionDeleteInfo>;
|
|
1659
|
+
type SubscriptionKey = `${NotificationKind}:${string}`;
|
|
1660
|
+
declare function getSubscriptionKey(subscription: SubscriptionData | SubscriptionDeleteInfo): SubscriptionKey;
|
|
1661
|
+
declare function getSubscriptionKey(kind: NotificationKind, subjectId: string): SubscriptionKey;
|
|
1662
|
+
|
|
1540
1663
|
type HistoryVersion = {
|
|
1541
1664
|
type: "historyVersion";
|
|
1542
1665
|
kind: "yjs";
|
|
@@ -1621,7 +1744,7 @@ type CommentsOrNotificationsErrorContext = {
|
|
|
1621
1744
|
threadId: string;
|
|
1622
1745
|
metadata: Patchable<BaseMetadata>;
|
|
1623
1746
|
} | {
|
|
1624
|
-
type: "MARK_THREAD_AS_RESOLVED_ERROR" | "MARK_THREAD_AS_UNRESOLVED_ERROR";
|
|
1747
|
+
type: "MARK_THREAD_AS_RESOLVED_ERROR" | "MARK_THREAD_AS_UNRESOLVED_ERROR" | "SUBSCRIBE_TO_THREAD_ERROR" | "UNSUBSCRIBE_FROM_THREAD_ERROR";
|
|
1625
1748
|
roomId: string;
|
|
1626
1749
|
threadId: string;
|
|
1627
1750
|
} | {
|
|
@@ -1653,6 +1776,9 @@ type CommentsOrNotificationsErrorContext = {
|
|
|
1653
1776
|
} | {
|
|
1654
1777
|
type: "UPDATE_NOTIFICATION_SETTINGS_ERROR";
|
|
1655
1778
|
roomId: string;
|
|
1779
|
+
} | {
|
|
1780
|
+
type: "UPDATE_ROOM_SUBSCRIPTION_SETTINGS_ERROR";
|
|
1781
|
+
roomId: string;
|
|
1656
1782
|
} | {
|
|
1657
1783
|
type: "UPDATE_USER_NOTIFICATION_SETTINGS_ERROR";
|
|
1658
1784
|
};
|
|
@@ -1725,11 +1851,6 @@ declare enum TextEditorType {
|
|
|
1725
1851
|
BlockNote = "blocknote"
|
|
1726
1852
|
}
|
|
1727
1853
|
|
|
1728
|
-
type RoomThreadsNotificationSettings = "all" | "replies_and_mentions" | "none";
|
|
1729
|
-
type RoomNotificationSettings = {
|
|
1730
|
-
threads: RoomThreadsNotificationSettings;
|
|
1731
|
-
};
|
|
1732
|
-
|
|
1733
1854
|
type LegacyOthersEvent<P extends JsonObject, U extends BaseUserMeta> = {
|
|
1734
1855
|
type: "leave";
|
|
1735
1856
|
user: User<P, U>;
|
|
@@ -2000,7 +2121,7 @@ type ListTextVersionsSinceOptions = {
|
|
|
2000
2121
|
since: Date;
|
|
2001
2122
|
signal?: AbortSignal;
|
|
2002
2123
|
};
|
|
2003
|
-
type
|
|
2124
|
+
type GetSubscriptionSettingsOptions = {
|
|
2004
2125
|
signal?: AbortSignal;
|
|
2005
2126
|
};
|
|
2006
2127
|
/**
|
|
@@ -2224,18 +2345,20 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
|
|
|
2224
2345
|
* const {
|
|
2225
2346
|
* threads,
|
|
2226
2347
|
* inboxNotifications,
|
|
2348
|
+
* subscriptions,
|
|
2227
2349
|
* requestedAt
|
|
2228
2350
|
* } = await room.getThreads({ query: { resolved: false }});
|
|
2229
2351
|
*/
|
|
2230
2352
|
getThreads(options?: GetThreadsOptions<M>): Promise<{
|
|
2231
2353
|
threads: ThreadData<M>[];
|
|
2232
2354
|
inboxNotifications: InboxNotificationData[];
|
|
2355
|
+
subscriptions: SubscriptionData[];
|
|
2233
2356
|
requestedAt: Date;
|
|
2234
2357
|
nextCursor: string | null;
|
|
2235
2358
|
permissionHints: Record<string, Permission[]>;
|
|
2236
2359
|
}>;
|
|
2237
2360
|
/**
|
|
2238
|
-
* Returns the updated and deleted threads and their associated inbox notifications since the requested date.
|
|
2361
|
+
* Returns the updated and deleted threads and their associated inbox notifications and subscriptions since the requested date.
|
|
2239
2362
|
*
|
|
2240
2363
|
* @example
|
|
2241
2364
|
* const result = await room.getThreads();
|
|
@@ -2251,18 +2374,23 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
|
|
|
2251
2374
|
updated: InboxNotificationData[];
|
|
2252
2375
|
deleted: InboxNotificationDeleteInfo[];
|
|
2253
2376
|
};
|
|
2377
|
+
subscriptions: {
|
|
2378
|
+
updated: SubscriptionData[];
|
|
2379
|
+
deleted: SubscriptionDeleteInfo[];
|
|
2380
|
+
};
|
|
2254
2381
|
requestedAt: Date;
|
|
2255
2382
|
permissionHints: Record<string, Permission[]>;
|
|
2256
2383
|
}>;
|
|
2257
2384
|
/**
|
|
2258
|
-
* Returns a thread and the associated inbox notification if it exists.
|
|
2385
|
+
* Returns a thread and the associated inbox notification and subscription if it exists.
|
|
2259
2386
|
*
|
|
2260
2387
|
* @example
|
|
2261
|
-
* const { thread, inboxNotification } = await room.getThread("th_xxx");
|
|
2388
|
+
* const { thread, inboxNotification, subscription } = await room.getThread("th_xxx");
|
|
2262
2389
|
*/
|
|
2263
2390
|
getThread(threadId: string): Promise<{
|
|
2264
2391
|
thread?: ThreadData<M>;
|
|
2265
2392
|
inboxNotification?: InboxNotificationData;
|
|
2393
|
+
subscription?: SubscriptionData;
|
|
2266
2394
|
}>;
|
|
2267
2395
|
/**
|
|
2268
2396
|
* Creates a thread.
|
|
@@ -2314,6 +2442,20 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
|
|
|
2314
2442
|
* await room.markThreadAsUnresolved("th_xxx");
|
|
2315
2443
|
*/
|
|
2316
2444
|
markThreadAsUnresolved(threadId: string): Promise<void>;
|
|
2445
|
+
/**
|
|
2446
|
+
* Subscribes the user to a thread.
|
|
2447
|
+
*
|
|
2448
|
+
* @example
|
|
2449
|
+
* await room.subscribeToThread("th_xxx");
|
|
2450
|
+
*/
|
|
2451
|
+
subscribeToThread(threadId: string): Promise<SubscriptionData>;
|
|
2452
|
+
/**
|
|
2453
|
+
* Unsubscribes the user from a thread.
|
|
2454
|
+
*
|
|
2455
|
+
* @example
|
|
2456
|
+
* await room.unsubscribeFromThread("th_xxx");
|
|
2457
|
+
*/
|
|
2458
|
+
unsubscribeFromThread(threadId: string): Promise<void>;
|
|
2317
2459
|
/**
|
|
2318
2460
|
* Creates a comment.
|
|
2319
2461
|
*
|
|
@@ -2410,20 +2552,34 @@ type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extends BaseUs
|
|
|
2410
2552
|
*/
|
|
2411
2553
|
getAttachmentUrl(attachmentId: string): Promise<string>;
|
|
2412
2554
|
/**
|
|
2413
|
-
*
|
|
2555
|
+
* @deprecated Renamed to `getSubscriptionSettings`
|
|
2556
|
+
*
|
|
2557
|
+
* Gets the user's subscription settings for the current room.
|
|
2558
|
+
*/
|
|
2559
|
+
getNotificationSettings(options?: GetSubscriptionSettingsOptions): Promise<RoomSubscriptionSettings>;
|
|
2560
|
+
/**
|
|
2561
|
+
* Gets the user's subscription settings for the current room.
|
|
2414
2562
|
*
|
|
2415
2563
|
* @example
|
|
2416
|
-
* const settings = await room.
|
|
2564
|
+
* const settings = await room.getSubscriptionSettings();
|
|
2417
2565
|
*/
|
|
2418
|
-
|
|
2566
|
+
getSubscriptionSettings(options?: GetSubscriptionSettingsOptions): Promise<RoomSubscriptionSettings>;
|
|
2419
2567
|
/**
|
|
2420
|
-
*
|
|
2568
|
+
* @deprecated Renamed to `getSubscriptionSettings`
|
|
2569
|
+
*
|
|
2570
|
+
* Updates the user's subscription settings for the current room.
|
|
2571
|
+
*/
|
|
2572
|
+
updateNotificationSettings(settings: Partial<RoomSubscriptionSettings>): Promise<RoomSubscriptionSettings>;
|
|
2573
|
+
/**
|
|
2574
|
+
* Updates the user's subscription settings for the current room.
|
|
2421
2575
|
*
|
|
2422
2576
|
* @example
|
|
2423
|
-
* await room.
|
|
2577
|
+
* await room.updateSubscriptionSettings({ threads: "replies_and_mentions" });
|
|
2424
2578
|
*/
|
|
2425
|
-
|
|
2579
|
+
updateSubscriptionSettings(settings: Partial<RoomSubscriptionSettings>): Promise<RoomSubscriptionSettings>;
|
|
2426
2580
|
/**
|
|
2581
|
+
* @private
|
|
2582
|
+
*
|
|
2427
2583
|
* Internal use only. Signature might change in the future.
|
|
2428
2584
|
*/
|
|
2429
2585
|
markInboxNotificationAsRead(notificationId: string): Promise<void>;
|
|
@@ -2531,94 +2687,6 @@ type OptionalTupleUnless<C, T extends any[]> = Record<string, never> extends C ?
|
|
|
2531
2687
|
] extends [never] ? OptionalTuple<T> : T;
|
|
2532
2688
|
type LargeMessageStrategy = "default" | "split" | "experimental-fallback-to-http";
|
|
2533
2689
|
|
|
2534
|
-
/**
|
|
2535
|
-
* Pre-defined notification channels support list.
|
|
2536
|
-
*/
|
|
2537
|
-
type NotificationChannel = "email" | "slack" | "teams" | "webPush";
|
|
2538
|
-
/**
|
|
2539
|
-
* `K` represents custom notification kinds
|
|
2540
|
-
* defined in the augmentation `ActivitiesData` (e.g `liveblocks.config.ts`).
|
|
2541
|
-
* It means the type `NotificationKind` will be shaped like:
|
|
2542
|
-
* thread | textMention | $customKind1 | $customKind2 | ...
|
|
2543
|
-
*/
|
|
2544
|
-
type NotificationKind<K extends keyof DAD = keyof DAD> = "thread" | "textMention" | K;
|
|
2545
|
-
/**
|
|
2546
|
-
* A notification channel settings is a set of notification kinds.
|
|
2547
|
-
* One setting can have multiple kinds (+ augmentation)
|
|
2548
|
-
*/
|
|
2549
|
-
type NotificationChannelSettings = {
|
|
2550
|
-
[K in NotificationKind]: boolean;
|
|
2551
|
-
};
|
|
2552
|
-
/**
|
|
2553
|
-
* @private
|
|
2554
|
-
*
|
|
2555
|
-
* Base definition of user notification settings.
|
|
2556
|
-
* Plain means it's a simple object coming from the remote backend.
|
|
2557
|
-
*
|
|
2558
|
-
* It's the raw settings object where somme channels cannot exists
|
|
2559
|
-
* because there are no notification kinds enabled on the dashboard.
|
|
2560
|
-
* And this object isn't yet proxied by the creator factory `createUserNotificationSettings`.
|
|
2561
|
-
*/
|
|
2562
|
-
type UserNotificationSettingsPlain = {
|
|
2563
|
-
[C in NotificationChannel]?: NotificationChannelSettings;
|
|
2564
|
-
};
|
|
2565
|
-
/**
|
|
2566
|
-
* User notification settings.
|
|
2567
|
-
* One channel for one set of settings.
|
|
2568
|
-
*/
|
|
2569
|
-
type UserNotificationSettings = {
|
|
2570
|
-
[C in NotificationChannel]: NotificationChannelSettings | null;
|
|
2571
|
-
};
|
|
2572
|
-
/**
|
|
2573
|
-
* It creates a deep partial specific for `UserNotificationSettings`
|
|
2574
|
-
* to offer a nice DX when updating the settings (e.g not being forced to define every keys)
|
|
2575
|
-
* and at the same the some preserver the augmentation for custom kinds (e.g `liveblocks.config.ts`).
|
|
2576
|
-
*/
|
|
2577
|
-
type DeepPartialWithAugmentation<T> = T extends object ? {
|
|
2578
|
-
[P in keyof T]?: T[P] extends {
|
|
2579
|
-
[K in NotificationKind]: boolean;
|
|
2580
|
-
} ? Partial<T[P]> & {
|
|
2581
|
-
[K in keyof DAD]?: boolean;
|
|
2582
|
-
} : DeepPartialWithAugmentation<T[P]>;
|
|
2583
|
-
} : T;
|
|
2584
|
-
/**
|
|
2585
|
-
* Partial user notification settings with augmentation preserved gracefully.
|
|
2586
|
-
* It means you can update the settings without being forced to define every keys.
|
|
2587
|
-
* Useful when implementing update functions.
|
|
2588
|
-
*/
|
|
2589
|
-
type PartialUserNotificationSettings = DeepPartialWithAugmentation<UserNotificationSettingsPlain>;
|
|
2590
|
-
/**
|
|
2591
|
-
* @private
|
|
2592
|
-
*
|
|
2593
|
-
* Creates a `UserNotificationSettings` object with the given initial plain settings.
|
|
2594
|
-
* It defines a getter for each channel to access the settings and returns `null` with an error log
|
|
2595
|
-
* in case the required channel isn't enabled in the dashboard.
|
|
2596
|
-
*
|
|
2597
|
-
* You can see this function as `Proxy` like around `UserNotificationSettingsPlain` type.
|
|
2598
|
-
* We can't predict what will be enabled on the dashboard or not, so it's important
|
|
2599
|
-
* provide a good DX to developers by returning `null` completed by an error log
|
|
2600
|
-
* when they try to access a channel that isn't enabled in the dashboard.
|
|
2601
|
-
*/
|
|
2602
|
-
declare function createUserNotificationSettings(plain: UserNotificationSettingsPlain): UserNotificationSettings;
|
|
2603
|
-
/**
|
|
2604
|
-
* @private
|
|
2605
|
-
*
|
|
2606
|
-
* Patch a `UserNotificationSettings` object by applying notification kind updates
|
|
2607
|
-
* coming from a `PartialUserNotificationSettings` object.
|
|
2608
|
-
*/
|
|
2609
|
-
declare function patchUserNotificationSettings(existing: UserNotificationSettings, patch: PartialUserNotificationSettings): UserNotificationSettings;
|
|
2610
|
-
/**
|
|
2611
|
-
*
|
|
2612
|
-
* Utility to check if a notification channel settings
|
|
2613
|
-
* is enabled for every notification kinds.
|
|
2614
|
-
*
|
|
2615
|
-
* Usage:
|
|
2616
|
-
* ```ts
|
|
2617
|
-
* const isEmailChannelEnabled = isNotificationChannelEnabled(settings.email);
|
|
2618
|
-
* ```
|
|
2619
|
-
*/
|
|
2620
|
-
declare function isNotificationChannelEnabled(settings: NotificationChannelSettings | null): boolean;
|
|
2621
|
-
|
|
2622
2690
|
interface RoomHttpApi<M extends BaseMetadata> {
|
|
2623
2691
|
getThreads(options: {
|
|
2624
2692
|
roomId: string;
|
|
@@ -2630,6 +2698,7 @@ interface RoomHttpApi<M extends BaseMetadata> {
|
|
|
2630
2698
|
}): Promise<{
|
|
2631
2699
|
threads: ThreadData<M>[];
|
|
2632
2700
|
inboxNotifications: InboxNotificationData[];
|
|
2701
|
+
subscriptions: SubscriptionData[];
|
|
2633
2702
|
requestedAt: Date;
|
|
2634
2703
|
nextCursor: string | null;
|
|
2635
2704
|
permissionHints: Record<string, Permission[]>;
|
|
@@ -2647,6 +2716,10 @@ interface RoomHttpApi<M extends BaseMetadata> {
|
|
|
2647
2716
|
updated: InboxNotificationData[];
|
|
2648
2717
|
deleted: InboxNotificationDeleteInfo[];
|
|
2649
2718
|
};
|
|
2719
|
+
subscriptions: {
|
|
2720
|
+
updated: SubscriptionData[];
|
|
2721
|
+
deleted: SubscriptionDeleteInfo[];
|
|
2722
|
+
};
|
|
2650
2723
|
requestedAt: Date;
|
|
2651
2724
|
permissionHints: Record<string, Permission[]>;
|
|
2652
2725
|
}>;
|
|
@@ -2664,6 +2737,7 @@ interface RoomHttpApi<M extends BaseMetadata> {
|
|
|
2664
2737
|
}): Promise<{
|
|
2665
2738
|
thread?: ThreadData<M>;
|
|
2666
2739
|
inboxNotification?: InboxNotificationData;
|
|
2740
|
+
subscription?: SubscriptionData;
|
|
2667
2741
|
}>;
|
|
2668
2742
|
deleteThread({ roomId, threadId, }: {
|
|
2669
2743
|
roomId: string;
|
|
@@ -2713,18 +2787,26 @@ interface RoomHttpApi<M extends BaseMetadata> {
|
|
|
2713
2787
|
roomId: string;
|
|
2714
2788
|
threadId: string;
|
|
2715
2789
|
}): Promise<void>;
|
|
2790
|
+
subscribeToThread({ roomId, threadId, }: {
|
|
2791
|
+
roomId: string;
|
|
2792
|
+
threadId: string;
|
|
2793
|
+
}): Promise<SubscriptionData>;
|
|
2794
|
+
unsubscribeFromThread({ roomId, threadId, }: {
|
|
2795
|
+
roomId: string;
|
|
2796
|
+
threadId: string;
|
|
2797
|
+
}): Promise<void>;
|
|
2716
2798
|
markRoomInboxNotificationAsRead({ roomId, inboxNotificationId, }: {
|
|
2717
2799
|
roomId: string;
|
|
2718
2800
|
inboxNotificationId: string;
|
|
2719
2801
|
}): Promise<string>;
|
|
2720
|
-
|
|
2802
|
+
getSubscriptionSettings({ roomId, signal, }: {
|
|
2721
2803
|
roomId: string;
|
|
2722
2804
|
signal?: AbortSignal;
|
|
2723
|
-
}): Promise<
|
|
2724
|
-
|
|
2805
|
+
}): Promise<RoomSubscriptionSettings>;
|
|
2806
|
+
updateSubscriptionSettings({ roomId, settings, }: {
|
|
2725
2807
|
roomId: string;
|
|
2726
|
-
settings: Partial<
|
|
2727
|
-
}): Promise<
|
|
2808
|
+
settings: Partial<RoomSubscriptionSettings>;
|
|
2809
|
+
}): Promise<RoomSubscriptionSettings>;
|
|
2728
2810
|
getAttachmentUrl(options: {
|
|
2729
2811
|
roomId: string;
|
|
2730
2812
|
attachmentId: string;
|
|
@@ -2811,6 +2893,7 @@ interface NotificationHttpApi<M extends BaseMetadata> {
|
|
|
2811
2893
|
}): Promise<{
|
|
2812
2894
|
inboxNotifications: InboxNotificationData[];
|
|
2813
2895
|
threads: ThreadData<M>[];
|
|
2896
|
+
subscriptions: SubscriptionData[];
|
|
2814
2897
|
nextCursor: string | null;
|
|
2815
2898
|
requestedAt: Date;
|
|
2816
2899
|
}>;
|
|
@@ -2826,6 +2909,10 @@ interface NotificationHttpApi<M extends BaseMetadata> {
|
|
|
2826
2909
|
updated: ThreadData<M>[];
|
|
2827
2910
|
deleted: ThreadDeleteInfo[];
|
|
2828
2911
|
};
|
|
2912
|
+
subscriptions: {
|
|
2913
|
+
updated: SubscriptionData[];
|
|
2914
|
+
deleted: SubscriptionDeleteInfo[];
|
|
2915
|
+
};
|
|
2829
2916
|
requestedAt: Date;
|
|
2830
2917
|
}>;
|
|
2831
2918
|
getUnreadInboxNotificationsCount(): Promise<number>;
|
|
@@ -2833,10 +2920,10 @@ interface NotificationHttpApi<M extends BaseMetadata> {
|
|
|
2833
2920
|
markInboxNotificationAsRead(inboxNotificationId: string): Promise<void>;
|
|
2834
2921
|
deleteAllInboxNotifications(): Promise<void>;
|
|
2835
2922
|
deleteInboxNotification(inboxNotificationId: string): Promise<void>;
|
|
2836
|
-
|
|
2923
|
+
getNotificationSettings(options?: {
|
|
2837
2924
|
signal?: AbortSignal;
|
|
2838
|
-
}): Promise<
|
|
2839
|
-
|
|
2925
|
+
}): Promise<NotificationSettingsPlain>;
|
|
2926
|
+
updateNotificationSettings(settings: PartialNotificationSettings): Promise<NotificationSettingsPlain>;
|
|
2840
2927
|
}
|
|
2841
2928
|
interface LiveblocksHttpApi<M extends BaseMetadata> extends RoomHttpApi<M>, NotificationHttpApi<M> {
|
|
2842
2929
|
getUserThreads_experimental(options?: {
|
|
@@ -2848,6 +2935,7 @@ interface LiveblocksHttpApi<M extends BaseMetadata> extends RoomHttpApi<M>, Noti
|
|
|
2848
2935
|
}): Promise<{
|
|
2849
2936
|
threads: ThreadData<M>[];
|
|
2850
2937
|
inboxNotifications: InboxNotificationData[];
|
|
2938
|
+
subscriptions: SubscriptionData[];
|
|
2851
2939
|
nextCursor: string | null;
|
|
2852
2940
|
requestedAt: Date;
|
|
2853
2941
|
permissionHints: Record<string, Permission[]>;
|
|
@@ -2864,6 +2952,10 @@ interface LiveblocksHttpApi<M extends BaseMetadata> extends RoomHttpApi<M>, Noti
|
|
|
2864
2952
|
updated: ThreadData<M>[];
|
|
2865
2953
|
deleted: ThreadDeleteInfo[];
|
|
2866
2954
|
};
|
|
2955
|
+
subscriptions: {
|
|
2956
|
+
updated: SubscriptionData[];
|
|
2957
|
+
deleted: SubscriptionDeleteInfo[];
|
|
2958
|
+
};
|
|
2867
2959
|
requestedAt: Date;
|
|
2868
2960
|
permissionHints: Record<string, Permission[]>;
|
|
2869
2961
|
}>;
|
|
@@ -3035,7 +3127,7 @@ type PrivateClientApi<U extends BaseUserMeta, M extends BaseMetadata> = {
|
|
|
3035
3127
|
type NotificationsApi<M extends BaseMetadata> = {
|
|
3036
3128
|
/**
|
|
3037
3129
|
* Gets a page (or the initial page) for user inbox notifications and their
|
|
3038
|
-
* associated threads.
|
|
3130
|
+
* associated threads and thread subscriptions.
|
|
3039
3131
|
*
|
|
3040
3132
|
* This function should NOT be used for delta updates, only for pagination
|
|
3041
3133
|
* (including the first page fetch). For delta updates (done during the
|
|
@@ -3045,6 +3137,7 @@ type NotificationsApi<M extends BaseMetadata> = {
|
|
|
3045
3137
|
* const {
|
|
3046
3138
|
* inboxNotifications,
|
|
3047
3139
|
* threads,
|
|
3140
|
+
* subscriptions,
|
|
3048
3141
|
* nextCursor,
|
|
3049
3142
|
* } = await client.getInboxNotifications();
|
|
3050
3143
|
* const data = await client.getInboxNotifications(); // Fetch initial page (of 20 inbox notifications)
|
|
@@ -3055,6 +3148,7 @@ type NotificationsApi<M extends BaseMetadata> = {
|
|
|
3055
3148
|
}): Promise<{
|
|
3056
3149
|
inboxNotifications: InboxNotificationData[];
|
|
3057
3150
|
threads: ThreadData<M>[];
|
|
3151
|
+
subscriptions: SubscriptionData[];
|
|
3058
3152
|
nextCursor: string | null;
|
|
3059
3153
|
requestedAt: Date;
|
|
3060
3154
|
}>;
|
|
@@ -3073,7 +3167,11 @@ type NotificationsApi<M extends BaseMetadata> = {
|
|
|
3073
3167
|
* threads: {
|
|
3074
3168
|
* updated,
|
|
3075
3169
|
* deleted,
|
|
3076
|
-
*
|
|
3170
|
+
* },
|
|
3171
|
+
* subscriptions: {
|
|
3172
|
+
* updated,
|
|
3173
|
+
* deleted,
|
|
3174
|
+
* },
|
|
3077
3175
|
* requestedAt,
|
|
3078
3176
|
* } = await client.getInboxNotificationsSince({ since: result.requestedAt }});
|
|
3079
3177
|
*/
|
|
@@ -3089,6 +3187,10 @@ type NotificationsApi<M extends BaseMetadata> = {
|
|
|
3089
3187
|
updated: ThreadData<M>[];
|
|
3090
3188
|
deleted: ThreadDeleteInfo[];
|
|
3091
3189
|
};
|
|
3190
|
+
subscriptions: {
|
|
3191
|
+
updated: SubscriptionData[];
|
|
3192
|
+
deleted: SubscriptionDeleteInfo[];
|
|
3193
|
+
};
|
|
3092
3194
|
requestedAt: Date;
|
|
3093
3195
|
}>;
|
|
3094
3196
|
/**
|
|
@@ -3134,7 +3236,7 @@ type NotificationsApi<M extends BaseMetadata> = {
|
|
|
3134
3236
|
*/
|
|
3135
3237
|
getNotificationSettings(options?: {
|
|
3136
3238
|
signal?: AbortSignal;
|
|
3137
|
-
}): Promise<
|
|
3239
|
+
}): Promise<NotificationSettings>;
|
|
3138
3240
|
/**
|
|
3139
3241
|
* Update notifications settings for a user for a project.
|
|
3140
3242
|
*
|
|
@@ -3147,7 +3249,7 @@ type NotificationsApi<M extends BaseMetadata> = {
|
|
|
3147
3249
|
* }
|
|
3148
3250
|
* })
|
|
3149
3251
|
*/
|
|
3150
|
-
updateNotificationSettings(settings:
|
|
3252
|
+
updateNotificationSettings(settings: PartialNotificationSettings): Promise<NotificationSettings>;
|
|
3151
3253
|
};
|
|
3152
3254
|
/**
|
|
3153
3255
|
* @private Widest-possible Client type, matching _any_ Client instance. Note
|
|
@@ -3716,6 +3818,11 @@ type Poller = {
|
|
|
3716
3818
|
* the next poll at the regular interval.
|
|
3717
3819
|
*/
|
|
3718
3820
|
pollNowIfStale(): void;
|
|
3821
|
+
/**
|
|
3822
|
+
* Marks the poller as stale. This can be used to force the next call
|
|
3823
|
+
* to `.pollNowIfStale()` to poll immediately.
|
|
3824
|
+
*/
|
|
3825
|
+
markAsStale(): void;
|
|
3719
3826
|
};
|
|
3720
3827
|
/**
|
|
3721
3828
|
* Makes a poller that will call `await callback()` at the desired interval (in
|
|
@@ -4089,4 +4196,4 @@ declare const CommentsApiError: typeof HttpError;
|
|
|
4089
4196
|
/** @deprecated Use HttpError instead. */
|
|
4090
4197
|
declare const NotificationsApiError: typeof HttpError;
|
|
4091
4198
|
|
|
4092
|
-
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 CreateManagedPoolOptions, 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, type ManagedPool, 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
|
|
4199
|
+
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 CreateManagedPoolOptions, 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, type ManagedPool, MutableSignal, type NoInfr, type NodeMap, type NotificationChannel, type NotificationChannelSettings, type NotificationKind, type NotificationSettings, type NotificationSettingsPlain, NotificationsApiError, type Observable, type Op, OpCode, type OpaqueClient, type OpaqueRoom, type OptionalTupleUnless, type OthersEvent, type ParentToChildNodeMap, type PartialNotificationSettings, type PartialUnless, 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 RoomSubscriptionSettings, 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 SubscriptionData, type SubscriptionDataPlain, type SubscriptionDeleteInfo, type SubscriptionDeleteInfoPlain, type SubscriptionKey, 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, checkBounds, chunk, cloneLson, compactObject, fancyConsole as console, convertToCommentData, convertToCommentUserReaction, convertToInboxNotificationData, convertToThreadData, createClient, createCommentAttachmentId, createCommentId, createInboxNotificationId, createManagedPool, createNotificationSettings, createThreadId, deprecate, deprecateIf, detectDupes, entries, errorIf, freeze, generateCommentUrl, getMentionedIdsFromCommentBody, getSubscriptionKey, html, htmlSafe, isChildCrdt, isCommentBodyLink, isCommentBodyMention, isCommentBodyText, isJsonArray, isJsonObject, isJsonScalar, isLiveNode, isNotificationChannelEnabled, isPlainObject, isRootCrdt, isStartsWithOperator, kInternal, keys, legacy_patchImmutableObject, lsonToJson, makeAbortController, makeEventSource, makePoller, makePosition, mapValues, memoizeOnSuccess, nanoid, nn, objectToQuery, patchLiveObjectKey, patchNotificationSettings, raise, resolveUsersInCommentBody, shallow, stableStringify, stringifyCommentBody, throwUsageError, toAbsoluteUrl, toPlainLson, tryParseJson, url, urljoin, wait, withTimeout };
|