@liveblocks/core 2.4.0-test1 → 2.4.1-test1

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
@@ -1741,7 +1741,7 @@ declare type CommentsApi<M extends BaseMetadata> = {
1741
1741
  requestedAt: Date;
1742
1742
  }>;
1743
1743
  /**
1744
- * Returns the modified and deleted threads and their associated inbox notifications since the requested date.
1744
+ * Returns the updated and deleted threads and their associated inbox notifications since the requested date.
1745
1745
  *
1746
1746
  * @example
1747
1747
  * const result = await room.getThreads();
@@ -1752,11 +1752,11 @@ declare type CommentsApi<M extends BaseMetadata> = {
1752
1752
  since: Date;
1753
1753
  }): Promise<{
1754
1754
  threads: {
1755
- modified: ThreadData<M>[];
1755
+ updated: ThreadData<M>[];
1756
1756
  deleted: ThreadDeleteInfo[];
1757
1757
  };
1758
1758
  inboxNotifications: {
1759
- modified: InboxNotificationData[];
1759
+ updated: InboxNotificationData[];
1760
1760
  deleted: InboxNotificationDeleteInfo[];
1761
1761
  };
1762
1762
  requestedAt: Date;
@@ -2119,6 +2119,11 @@ declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extend
2119
2119
  */
2120
2120
  markInboxNotificationAsRead(notificationId: string): Promise<void>;
2121
2121
  } & CommentsApi<M>;
2122
+ declare type Provider = {
2123
+ synced: boolean;
2124
+ on(event: "sync", listener: (synced: boolean) => void): void;
2125
+ off(event: "sync", listener: (synced: boolean) => void): void;
2126
+ };
2122
2127
  /**
2123
2128
  * @private
2124
2129
  *
@@ -2131,6 +2136,9 @@ declare type PrivateRoomApi = {
2131
2136
  presenceBuffer: Json | undefined;
2132
2137
  undoStack: readonly (readonly Readonly<HistoryOp<JsonObject>>[])[];
2133
2138
  nodeCount: number;
2139
+ getProvider(): Provider | undefined;
2140
+ setProvider(provider: Provider | undefined): void;
2141
+ onProviderUpdate: Observable<void>;
2134
2142
  getSelf_forDevTools(): UserTreeNode | null;
2135
2143
  getOthers_forDevTools(): readonly UserTreeNode[];
2136
2144
  reportTextEditor(editor: "lexical", rootKey: string): void;
@@ -2435,7 +2443,7 @@ declare type NotificationsApi<M extends BaseMetadata> = {
2435
2443
  requestedAt: Date;
2436
2444
  }>;
2437
2445
  /**
2438
- * Gets the modified and deleted inbox notifications and their associated threads since the requested date.
2446
+ * Gets the updated and deleted inbox notifications and their associated threads since the requested date.
2439
2447
  *
2440
2448
  * @example
2441
2449
  * const result = await client.getInboxNotifications();
@@ -2446,11 +2454,11 @@ declare type NotificationsApi<M extends BaseMetadata> = {
2446
2454
  since: Date;
2447
2455
  }): Promise<{
2448
2456
  inboxNotifications: {
2449
- modified: InboxNotificationData[];
2457
+ updated: InboxNotificationData[];
2450
2458
  deleted: InboxNotificationDeleteInfo[];
2451
2459
  };
2452
2460
  threads: {
2453
- modified: ThreadData<M>[];
2461
+ updated: ThreadData<M>[];
2454
2462
  deleted: ThreadDeleteInfo[];
2455
2463
  };
2456
2464
  requestedAt: Date;
package/dist/index.d.ts CHANGED
@@ -1741,7 +1741,7 @@ declare type CommentsApi<M extends BaseMetadata> = {
1741
1741
  requestedAt: Date;
1742
1742
  }>;
1743
1743
  /**
1744
- * Returns the modified and deleted threads and their associated inbox notifications since the requested date.
1744
+ * Returns the updated and deleted threads and their associated inbox notifications since the requested date.
1745
1745
  *
1746
1746
  * @example
1747
1747
  * const result = await room.getThreads();
@@ -1752,11 +1752,11 @@ declare type CommentsApi<M extends BaseMetadata> = {
1752
1752
  since: Date;
1753
1753
  }): Promise<{
1754
1754
  threads: {
1755
- modified: ThreadData<M>[];
1755
+ updated: ThreadData<M>[];
1756
1756
  deleted: ThreadDeleteInfo[];
1757
1757
  };
1758
1758
  inboxNotifications: {
1759
- modified: InboxNotificationData[];
1759
+ updated: InboxNotificationData[];
1760
1760
  deleted: InboxNotificationDeleteInfo[];
1761
1761
  };
1762
1762
  requestedAt: Date;
@@ -2119,6 +2119,11 @@ declare type Room<P extends JsonObject = DP, S extends LsonObject = DS, U extend
2119
2119
  */
2120
2120
  markInboxNotificationAsRead(notificationId: string): Promise<void>;
2121
2121
  } & CommentsApi<M>;
2122
+ declare type Provider = {
2123
+ synced: boolean;
2124
+ on(event: "sync", listener: (synced: boolean) => void): void;
2125
+ off(event: "sync", listener: (synced: boolean) => void): void;
2126
+ };
2122
2127
  /**
2123
2128
  * @private
2124
2129
  *
@@ -2131,6 +2136,9 @@ declare type PrivateRoomApi = {
2131
2136
  presenceBuffer: Json | undefined;
2132
2137
  undoStack: readonly (readonly Readonly<HistoryOp<JsonObject>>[])[];
2133
2138
  nodeCount: number;
2139
+ getProvider(): Provider | undefined;
2140
+ setProvider(provider: Provider | undefined): void;
2141
+ onProviderUpdate: Observable<void>;
2134
2142
  getSelf_forDevTools(): UserTreeNode | null;
2135
2143
  getOthers_forDevTools(): readonly UserTreeNode[];
2136
2144
  reportTextEditor(editor: "lexical", rootKey: string): void;
@@ -2435,7 +2443,7 @@ declare type NotificationsApi<M extends BaseMetadata> = {
2435
2443
  requestedAt: Date;
2436
2444
  }>;
2437
2445
  /**
2438
- * Gets the modified and deleted inbox notifications and their associated threads since the requested date.
2446
+ * Gets the updated and deleted inbox notifications and their associated threads since the requested date.
2439
2447
  *
2440
2448
  * @example
2441
2449
  * const result = await client.getInboxNotifications();
@@ -2446,11 +2454,11 @@ declare type NotificationsApi<M extends BaseMetadata> = {
2446
2454
  since: Date;
2447
2455
  }): Promise<{
2448
2456
  inboxNotifications: {
2449
- modified: InboxNotificationData[];
2457
+ updated: InboxNotificationData[];
2450
2458
  deleted: InboxNotificationDeleteInfo[];
2451
2459
  };
2452
2460
  threads: {
2453
- modified: ThreadData<M>[];
2461
+ updated: ThreadData<M>[];
2454
2462
  deleted: ThreadDeleteInfo[];
2455
2463
  };
2456
2464
  requestedAt: Date;
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.0-test1";
9
+ var PKG_VERSION = "2.4.1-test1";
10
10
  var PKG_FORMAT = "cjs";
11
11
 
12
12
  // src/dupe-detection.ts
@@ -2094,11 +2094,11 @@ function createNotificationsApi({
2094
2094
  });
2095
2095
  return {
2096
2096
  threads: {
2097
- modified: json.threads.map(convertToThreadData),
2097
+ updated: json.threads.map(convertToThreadData),
2098
2098
  deleted: json.deletedThreads.map(convertToThreadDeleteInfo)
2099
2099
  },
2100
2100
  inboxNotifications: {
2101
- modified: json.inboxNotifications.map(convertToInboxNotificationData),
2101
+ updated: json.inboxNotifications.map(convertToInboxNotificationData),
2102
2102
  deleted: json.deletedInboxNotifications.map(
2103
2103
  convertToInboxNotificationDeleteInfo
2104
2104
  )
@@ -2152,6 +2152,16 @@ function createNotificationsApi({
2152
2152
  }
2153
2153
  );
2154
2154
  }
2155
+ async function getThreads() {
2156
+ const json = await fetchJson("/threads", void 0, {});
2157
+ return {
2158
+ threads: json.threads.map(convertToThreadData)
2159
+ // inboxNotifications: json.inboxNotifications.map(
2160
+ // convertToInboxNotificationData
2161
+ // ),
2162
+ // requestedAt: new Date(json.meta.requestedAt),
2163
+ };
2164
+ }
2155
2165
  return {
2156
2166
  getInboxNotifications,
2157
2167
  getInboxNotificationsSince,
@@ -2159,7 +2169,8 @@ function createNotificationsApi({
2159
2169
  markAllInboxNotificationsAsRead,
2160
2170
  markInboxNotificationAsRead,
2161
2171
  deleteAllInboxNotifications,
2162
- deleteInboxNotification
2172
+ deleteInboxNotification,
2173
+ getThreads
2163
2174
  };
2164
2175
  }
2165
2176
 
@@ -5189,11 +5200,11 @@ function createCommentsApi(roomId, getAuthValue, fetchClientApi) {
5189
5200
  const json = await response.json();
5190
5201
  return {
5191
5202
  threads: {
5192
- modified: json.data.map(convertToThreadData),
5203
+ updated: json.data.map(convertToThreadData),
5193
5204
  deleted: json.deletedThreads.map(convertToThreadDeleteInfo)
5194
5205
  },
5195
5206
  inboxNotifications: {
5196
- modified: json.inboxNotifications.map(convertToInboxNotificationData),
5207
+ updated: json.inboxNotifications.map(convertToInboxNotificationData),
5197
5208
  deleted: json.deletedInboxNotifications.map(
5198
5209
  convertToInboxNotificationDeleteInfo
5199
5210
  )
@@ -5203,11 +5214,11 @@ function createCommentsApi(roomId, getAuthValue, fetchClientApi) {
5203
5214
  } else if (response.status === 404) {
5204
5215
  return {
5205
5216
  threads: {
5206
- modified: [],
5217
+ updated: [],
5207
5218
  deleted: []
5208
5219
  },
5209
5220
  inboxNotifications: {
5210
- modified: [],
5221
+ updated: [],
5211
5222
  deleted: []
5212
5223
  },
5213
5224
  requestedAt: /* @__PURE__ */ new Date()
@@ -5476,6 +5487,9 @@ function createRoom(options, config) {
5476
5487
  others: new OthersRef(),
5477
5488
  initialStorage,
5478
5489
  idFactory: null,
5490
+ // Y.js
5491
+ provider: void 0,
5492
+ onProviderUpdate: makeEventSource(),
5479
5493
  // Storage
5480
5494
  clock: 0,
5481
5495
  opClock: 0,
@@ -6651,6 +6665,14 @@ ${Array.from(traces).join("\n\n")}`
6651
6665
  return context.nodes.size;
6652
6666
  },
6653
6667
  // prettier-ignore
6668
+ getProvider() {
6669
+ return context.provider;
6670
+ },
6671
+ setProvider(provider) {
6672
+ context.provider = provider;
6673
+ context.onProviderUpdate.notify();
6674
+ },
6675
+ onProviderUpdate: context.onProviderUpdate.observable,
6654
6676
  // send metadata when using a text editor
6655
6677
  reportTextEditor,
6656
6678
  // create a text mention when using a text editor
@@ -7484,7 +7506,8 @@ function createClient(options) {
7484
7506
  markAllInboxNotificationsAsRead,
7485
7507
  markInboxNotificationAsRead,
7486
7508
  deleteAllInboxNotifications,
7487
- deleteInboxNotification
7509
+ deleteInboxNotification,
7510
+ getThreads
7488
7511
  } = createNotificationsApi({
7489
7512
  baseUrl,
7490
7513
  fetcher: _optionalChain([clientOptions, 'access', _167 => _167.polyfills, 'optionalAccess', _168 => _168.fetch]) || /* istanbul ignore next */
@@ -7533,6 +7556,7 @@ function createClient(options) {
7533
7556
  markInboxNotificationAsRead,
7534
7557
  deleteAllInboxNotifications,
7535
7558
  deleteInboxNotification,
7559
+ getThreads,
7536
7560
  // Internal
7537
7561
  [kInternal]: {
7538
7562
  currentUserIdStore,