@liveblocks/core 2.4.1-test1 → 2.4.1-test2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -2417,13 +2417,31 @@ declare type EnterOptions<P extends JsonObject = DP, S extends LsonObject = DS>
2417
2417
  * of Liveblocks, NEVER USE ANY OF THESE DIRECTLY, because bad things
2418
2418
  * will probably happen if you do.
2419
2419
  */
2420
- declare type PrivateClientApi<U extends BaseUserMeta> = {
2420
+ declare type PrivateClientApi<U extends BaseUserMeta, M extends BaseMetadata> = {
2421
2421
  readonly currentUserIdStore: Store<string | null>;
2422
2422
  readonly resolveMentionSuggestions: ClientOptions<U>["resolveMentionSuggestions"];
2423
2423
  readonly cacheStore: CacheStore<BaseMetadata>;
2424
2424
  readonly usersStore: BatchStore<U["info"] | undefined, string>;
2425
2425
  readonly roomsInfoStore: BatchStore<DRI | undefined, string>;
2426
2426
  readonly getRoomIds: () => string[];
2427
+ readonly getThreads: () => Promise<{
2428
+ threads: ThreadData<M>[];
2429
+ inboxNotifications: InboxNotificationData[];
2430
+ requestedAt: Date;
2431
+ }>;
2432
+ readonly getThreadsSince: (options: {
2433
+ since: Date;
2434
+ }) => Promise<{
2435
+ inboxNotifications: {
2436
+ updated: InboxNotificationData[];
2437
+ deleted: InboxNotificationDeleteInfo[];
2438
+ };
2439
+ threads: {
2440
+ updated: ThreadData<M>[];
2441
+ deleted: ThreadDeleteInfo[];
2442
+ };
2443
+ requestedAt: Date;
2444
+ }>;
2427
2445
  };
2428
2446
  declare type NotificationsApi<M extends BaseMetadata> = {
2429
2447
  /**
@@ -2539,7 +2557,7 @@ declare type Client<U extends BaseUserMeta = DU, M extends BaseMetadata = DM> =
2539
2557
  * of Liveblocks, NEVER USE ANY OF THESE DIRECTLY, because bad things
2540
2558
  * will probably happen if you do.
2541
2559
  */
2542
- readonly [kInternal]: PrivateClientApi<U>;
2560
+ readonly [kInternal]: PrivateClientApi<U, M>;
2543
2561
  } & NotificationsApi<M>;
2544
2562
  declare type AuthEndpoint = string | ((room?: string) => Promise<CustomAuthenticationResult>);
2545
2563
  /**
package/dist/index.d.ts CHANGED
@@ -2417,13 +2417,31 @@ declare type EnterOptions<P extends JsonObject = DP, S extends LsonObject = DS>
2417
2417
  * of Liveblocks, NEVER USE ANY OF THESE DIRECTLY, because bad things
2418
2418
  * will probably happen if you do.
2419
2419
  */
2420
- declare type PrivateClientApi<U extends BaseUserMeta> = {
2420
+ declare type PrivateClientApi<U extends BaseUserMeta, M extends BaseMetadata> = {
2421
2421
  readonly currentUserIdStore: Store<string | null>;
2422
2422
  readonly resolveMentionSuggestions: ClientOptions<U>["resolveMentionSuggestions"];
2423
2423
  readonly cacheStore: CacheStore<BaseMetadata>;
2424
2424
  readonly usersStore: BatchStore<U["info"] | undefined, string>;
2425
2425
  readonly roomsInfoStore: BatchStore<DRI | undefined, string>;
2426
2426
  readonly getRoomIds: () => string[];
2427
+ readonly getThreads: () => Promise<{
2428
+ threads: ThreadData<M>[];
2429
+ inboxNotifications: InboxNotificationData[];
2430
+ requestedAt: Date;
2431
+ }>;
2432
+ readonly getThreadsSince: (options: {
2433
+ since: Date;
2434
+ }) => Promise<{
2435
+ inboxNotifications: {
2436
+ updated: InboxNotificationData[];
2437
+ deleted: InboxNotificationDeleteInfo[];
2438
+ };
2439
+ threads: {
2440
+ updated: ThreadData<M>[];
2441
+ deleted: ThreadDeleteInfo[];
2442
+ };
2443
+ requestedAt: Date;
2444
+ }>;
2427
2445
  };
2428
2446
  declare type NotificationsApi<M extends BaseMetadata> = {
2429
2447
  /**
@@ -2539,7 +2557,7 @@ declare type Client<U extends BaseUserMeta = DU, M extends BaseMetadata = DM> =
2539
2557
  * of Liveblocks, NEVER USE ANY OF THESE DIRECTLY, because bad things
2540
2558
  * will probably happen if you do.
2541
2559
  */
2542
- readonly [kInternal]: PrivateClientApi<U>;
2560
+ readonly [kInternal]: PrivateClientApi<U, M>;
2543
2561
  } & NotificationsApi<M>;
2544
2562
  declare type AuthEndpoint = string | ((room?: string) => Promise<CustomAuthenticationResult>);
2545
2563
  /**
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.4.1-test1";
9
+ var PKG_VERSION = "2.4.1-test2";
10
10
  var PKG_FORMAT = "cjs";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -2155,11 +2155,29 @@ function createNotificationsApi({
2155
2155
  async function getThreads() {
2156
2156
  const json = await fetchJson("/threads", void 0, {});
2157
2157
  return {
2158
- threads: json.threads.map(convertToThreadData)
2159
- // inboxNotifications: json.inboxNotifications.map(
2160
- // convertToInboxNotificationData
2161
- // ),
2162
- // requestedAt: new Date(json.meta.requestedAt),
2158
+ threads: json.threads.map(convertToThreadData),
2159
+ inboxNotifications: json.inboxNotifications.map(
2160
+ convertToInboxNotificationData
2161
+ ),
2162
+ requestedAt: new Date(json.meta.requestedAt)
2163
+ };
2164
+ }
2165
+ async function getThreadsSince(options) {
2166
+ const json = await fetchJson("/threads", void 0, {
2167
+ since: options.since.toISOString()
2168
+ });
2169
+ return {
2170
+ threads: {
2171
+ updated: json.threads.map(convertToThreadData),
2172
+ deleted: json.deletedThreads.map(convertToThreadDeleteInfo)
2173
+ },
2174
+ inboxNotifications: {
2175
+ updated: json.inboxNotifications.map(convertToInboxNotificationData),
2176
+ deleted: json.deletedInboxNotifications.map(
2177
+ convertToInboxNotificationDeleteInfo
2178
+ )
2179
+ },
2180
+ requestedAt: new Date(json.meta.requestedAt)
2163
2181
  };
2164
2182
  }
2165
2183
  return {
@@ -2170,7 +2188,8 @@ function createNotificationsApi({
2170
2188
  markInboxNotificationAsRead,
2171
2189
  deleteAllInboxNotifications,
2172
2190
  deleteInboxNotification,
2173
- getThreads
2191
+ getThreads,
2192
+ getThreadsSince
2174
2193
  };
2175
2194
  }
2176
2195
 
@@ -7507,7 +7526,8 @@ function createClient(options) {
7507
7526
  markInboxNotificationAsRead,
7508
7527
  deleteAllInboxNotifications,
7509
7528
  deleteInboxNotification,
7510
- getThreads
7529
+ getThreads,
7530
+ getThreadsSince
7511
7531
  } = createNotificationsApi({
7512
7532
  baseUrl,
7513
7533
  fetcher: _optionalChain([clientOptions, 'access', _167 => _167.polyfills, 'optionalAccess', _168 => _168.fetch]) || /* istanbul ignore next */
@@ -7566,7 +7586,9 @@ function createClient(options) {
7566
7586
  roomsInfoStore,
7567
7587
  getRoomIds() {
7568
7588
  return Array.from(roomsById.keys());
7569
- }
7589
+ },
7590
+ getThreads,
7591
+ getThreadsSince
7570
7592
  }
7571
7593
  },
7572
7594
  kInternal,