@liveblocks/node 3.13.0-ack1 → 3.13.0-metadata2

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 CHANGED
@@ -3,7 +3,7 @@ var _core = require('@liveblocks/core');
3
3
 
4
4
  // src/version.ts
5
5
  var PKG_NAME = "@liveblocks/node";
6
- var PKG_VERSION = "3.13.0-ack1";
6
+ var PKG_VERSION = "3.13.0-metadata2";
7
7
  var PKG_FORMAT = "cjs";
8
8
 
9
9
  // src/client.ts
@@ -559,7 +559,8 @@ var Liveblocks = class {
559
559
  groupsAccesses,
560
560
  usersAccesses,
561
561
  metadata,
562
- tenantId
562
+ tenantId,
563
+ engine
563
564
  } = params;
564
565
  const res = await this.#post(
565
566
  _optionalChain([options, 'optionalAccess', _9 => _9.idempotent]) ? _core.url`/v2/rooms?idempotent` : _core.url`/v2/rooms`,
@@ -569,7 +570,8 @@ var Liveblocks = class {
569
570
  groupsAccesses,
570
571
  usersAccesses,
571
572
  tenantId,
572
- metadata
573
+ metadata,
574
+ engine
573
575
  },
574
576
  options
575
577
  );
@@ -988,6 +990,7 @@ var Liveblocks = class {
988
990
  * @param params.data.userId The user ID of the user who is set to create the comment.
989
991
  * @param params.data.createdAt (optional) The date the comment is set to be created.
990
992
  * @param params.data.body The body of the comment.
993
+ * @param params.data.metadata (optional) The metadata for the comment.
991
994
  * @param options.signal (optional) An abort signal to cancel the request.
992
995
  * @returns The created comment.
993
996
  */
@@ -1012,6 +1015,7 @@ var Liveblocks = class {
1012
1015
  * @param params.threadId The thread ID to edit the comment in.
1013
1016
  * @param params.commentId The comment ID to edit.
1014
1017
  * @param params.data.body The body of the comment.
1018
+ * @param params.data.metadata (optional) The metadata for the comment. Value must be a string, boolean or number. Use null to delete a key.
1015
1019
  * @param params.data.editedAt (optional) The date the comment was edited.
1016
1020
  * @param options.signal (optional) An abort signal to cancel the request.
1017
1021
  * @returns The edited comment.
@@ -1020,7 +1024,11 @@ var Liveblocks = class {
1020
1024
  const { roomId, threadId, commentId, data } = params;
1021
1025
  const res = await this.#post(
1022
1026
  _core.url`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}`,
1023
- { ...data, editedAt: _optionalChain([data, 'access', _13 => _13.editedAt, 'optionalAccess', _14 => _14.toISOString, 'call', _15 => _15()]) },
1027
+ {
1028
+ body: data.body,
1029
+ editedAt: _optionalChain([data, 'access', _13 => _13.editedAt, 'optionalAccess', _14 => _14.toISOString, 'call', _15 => _15()]),
1030
+ metadata: data.metadata
1031
+ },
1024
1032
  options
1025
1033
  );
1026
1034
  if (!res.ok) {
@@ -1054,6 +1062,7 @@ var Liveblocks = class {
1054
1062
  * @param params.thread.comment.userId The user ID of the user who created the comment.
1055
1063
  * @param params.thread.comment.createdAt (optional) The date the comment was created.
1056
1064
  * @param params.thread.comment.body The body of the comment.
1065
+ * @param params.thread.comment.metadata (optional) The metadata for the comment.
1057
1066
  * @param options.signal (optional) An abort signal to cancel the request.
1058
1067
  * @returns The created thread. The thread will be created with the specified comment as its first comment.
1059
1068
  */
@@ -1197,6 +1206,32 @@ var Liveblocks = class {
1197
1206
  }
1198
1207
  return await res.json();
1199
1208
  }
1209
+ /**
1210
+ * Updates the metadata of the specified comment in a room.
1211
+ * @param params.roomId The room ID to update the comment in.
1212
+ * @param params.threadId The thread ID to update the comment in.
1213
+ * @param params.commentId The comment ID to update.
1214
+ * @param params.data.metadata The metadata for the comment. Value must be a string, boolean or number. Use null to delete a key.
1215
+ * @param params.data.userId The user ID of the user who updated the comment.
1216
+ * @param params.data.updatedAt (optional) The date the comment metadata is set to be updated.
1217
+ * @param options.signal (optional) An abort signal to cancel the request.
1218
+ * @returns The updated comment metadata.
1219
+ */
1220
+ async editCommentMetadata(params, options) {
1221
+ const { roomId, threadId, commentId, data } = params;
1222
+ const res = await this.#post(
1223
+ _core.url`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}/metadata`,
1224
+ {
1225
+ ...data,
1226
+ updatedAt: _optionalChain([data, 'access', _23 => _23.updatedAt, 'optionalAccess', _24 => _24.toISOString, 'call', _25 => _25()])
1227
+ },
1228
+ options
1229
+ );
1230
+ if (!res.ok) {
1231
+ throw await LiveblocksError.from(res);
1232
+ }
1233
+ return await res.json();
1234
+ }
1200
1235
  /**
1201
1236
  * Adds a new comment reaction to a comment.
1202
1237
  * @param params.roomId The room ID to add the comment reaction in.
@@ -1214,7 +1249,7 @@ var Liveblocks = class {
1214
1249
  _core.url`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}/add-reaction`,
1215
1250
  {
1216
1251
  ...data,
1217
- createdAt: _optionalChain([data, 'access', _23 => _23.createdAt, 'optionalAccess', _24 => _24.toISOString, 'call', _25 => _25()])
1252
+ createdAt: _optionalChain([data, 'access', _26 => _26.createdAt, 'optionalAccess', _27 => _27.toISOString, 'call', _28 => _28()])
1218
1253
  },
1219
1254
  options
1220
1255
  );
@@ -1240,7 +1275,7 @@ var Liveblocks = class {
1240
1275
  _core.url`/v2/rooms/${roomId}/threads/${threadId}/comments/${params.commentId}/remove-reaction`,
1241
1276
  {
1242
1277
  ...data,
1243
- removedAt: _optionalChain([data, 'access', _26 => _26.removedAt, 'optionalAccess', _27 => _27.toISOString, 'call', _28 => _28()])
1278
+ removedAt: _optionalChain([data, 'access', _29 => _29.removedAt, 'optionalAccess', _30 => _30.toISOString, 'call', _31 => _31()])
1244
1279
  },
1245
1280
  options
1246
1281
  );
@@ -1316,7 +1351,7 @@ var Liveblocks = class {
1316
1351
  */
1317
1352
  async *iterInboxNotifications(criteria, options) {
1318
1353
  const { signal } = _nullishCoalesce(options, () => ( {}));
1319
- const pageSize = _core.checkBounds.call(void 0, "pageSize", _nullishCoalesce(_optionalChain([options, 'optionalAccess', _29 => _29.pageSize]), () => ( 50)), 10);
1354
+ const pageSize = _core.checkBounds.call(void 0, "pageSize", _nullishCoalesce(_optionalChain([options, 'optionalAccess', _32 => _32.pageSize]), () => ( 50)), 10);
1320
1355
  let cursor = void 0;
1321
1356
  while (true) {
1322
1357
  const { nextCursor, data } = await this.getInboxNotifications(
@@ -1640,7 +1675,7 @@ var Liveblocks = class {
1640
1675
  async getGroups(params, options) {
1641
1676
  const res = await this.#get(
1642
1677
  _core.url`/v2/groups`,
1643
- { startingAfter: _optionalChain([params, 'optionalAccess', _30 => _30.startingAfter]), limit: _optionalChain([params, 'optionalAccess', _31 => _31.limit]) },
1678
+ { startingAfter: _optionalChain([params, 'optionalAccess', _33 => _33.startingAfter]), limit: _optionalChain([params, 'optionalAccess', _34 => _34.limit]) },
1644
1679
  options
1645
1680
  );
1646
1681
  if (!res.ok) {
@@ -1702,7 +1737,7 @@ var Liveblocks = class {
1702
1737
  async massMutateStorage(criteria, callback, massOptions) {
1703
1738
  const concurrency = _core.checkBounds.call(void 0,
1704
1739
  "concurrency",
1705
- _nullishCoalesce(_optionalChain([massOptions, 'optionalAccess', _32 => _32.concurrency]), () => ( 8)),
1740
+ _nullishCoalesce(_optionalChain([massOptions, 'optionalAccess', _35 => _35.concurrency]), () => ( 8)),
1706
1741
  1,
1707
1742
  20
1708
1743
  );
@@ -1718,7 +1753,7 @@ var Liveblocks = class {
1718
1753
  }
1719
1754
  async #_mutateOneRoom(roomId, room, callback, options) {
1720
1755
  const debounceInterval = 200;
1721
- const { signal, abort } = _core.makeAbortController.call(void 0, _optionalChain([options, 'optionalAccess', _33 => _33.signal]));
1756
+ const { signal, abort } = _core.makeAbortController.call(void 0, _optionalChain([options, 'optionalAccess', _36 => _36.signal]));
1722
1757
  let opsBuffer = [];
1723
1758
  let outstandingFlush$ = void 0;
1724
1759
  let lastFlush = performance.now();
@@ -1784,7 +1819,7 @@ var Liveblocks = class {
1784
1819
  const res = await this.#post(
1785
1820
  _core.url`/v2/rooms/${roomId}/send-message`,
1786
1821
  { messages },
1787
- { signal: _optionalChain([options, 'optionalAccess', _34 => _34.signal]) }
1822
+ { signal: _optionalChain([options, 'optionalAccess', _37 => _37.signal]) }
1788
1823
  );
1789
1824
  if (!res.ok) {
1790
1825
  throw await LiveblocksError.from(res);
@@ -1921,7 +1956,7 @@ var Liveblocks = class {
1921
1956
  "Content-Type": params.file.type,
1922
1957
  "Content-Length": String(params.file.size)
1923
1958
  },
1924
- signal: _optionalChain([options, 'optionalAccess', _35 => _35.signal])
1959
+ signal: _optionalChain([options, 'optionalAccess', _38 => _38.signal])
1925
1960
  }
1926
1961
  );
1927
1962
  if (!res.ok) {
@@ -2197,6 +2232,7 @@ var WebhookHandler = class _WebhookHandler {
2197
2232
  "commentDeleted",
2198
2233
  "commentReactionAdded",
2199
2234
  "commentReactionRemoved",
2235
+ "commentMetadataUpdated",
2200
2236
  "threadMetadataUpdated",
2201
2237
  "threadCreated",
2202
2238
  "threadDeleted",