@liveblocks/node 3.13.0-vincent2 → 3.13.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 +44 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +76 -26
- package/dist/index.d.ts +76 -26
- package/dist/index.js +36 -2
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
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
|
|
6
|
+
var PKG_VERSION = "3.13.0";
|
|
7
7
|
var PKG_FORMAT = "cjs";
|
|
8
8
|
|
|
9
9
|
// src/client.ts
|
|
@@ -990,6 +990,7 @@ var Liveblocks = class {
|
|
|
990
990
|
* @param params.data.userId The user ID of the user who is set to create the comment.
|
|
991
991
|
* @param params.data.createdAt (optional) The date the comment is set to be created.
|
|
992
992
|
* @param params.data.body The body of the comment.
|
|
993
|
+
* @param params.data.metadata (optional) The metadata for the comment.
|
|
993
994
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
994
995
|
* @returns The created comment.
|
|
995
996
|
*/
|
|
@@ -1014,6 +1015,7 @@ var Liveblocks = class {
|
|
|
1014
1015
|
* @param params.threadId The thread ID to edit the comment in.
|
|
1015
1016
|
* @param params.commentId The comment ID to edit.
|
|
1016
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.
|
|
1017
1019
|
* @param params.data.editedAt (optional) The date the comment was edited.
|
|
1018
1020
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1019
1021
|
* @returns The edited comment.
|
|
@@ -1022,7 +1024,11 @@ var Liveblocks = class {
|
|
|
1022
1024
|
const { roomId, threadId, commentId, data } = params;
|
|
1023
1025
|
const res = await this.#post(
|
|
1024
1026
|
_core.url`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}`,
|
|
1025
|
-
{
|
|
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
|
+
},
|
|
1026
1032
|
options
|
|
1027
1033
|
);
|
|
1028
1034
|
if (!res.ok) {
|
|
@@ -1056,6 +1062,7 @@ var Liveblocks = class {
|
|
|
1056
1062
|
* @param params.thread.comment.userId The user ID of the user who created the comment.
|
|
1057
1063
|
* @param params.thread.comment.createdAt (optional) The date the comment was created.
|
|
1058
1064
|
* @param params.thread.comment.body The body of the comment.
|
|
1065
|
+
* @param params.thread.comment.metadata (optional) The metadata for the comment.
|
|
1059
1066
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1060
1067
|
* @returns The created thread. The thread will be created with the specified comment as its first comment.
|
|
1061
1068
|
*/
|
|
@@ -1199,6 +1206,32 @@ var Liveblocks = class {
|
|
|
1199
1206
|
}
|
|
1200
1207
|
return await res.json();
|
|
1201
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
|
+
}
|
|
1202
1235
|
/**
|
|
1203
1236
|
* Adds a new comment reaction to a comment.
|
|
1204
1237
|
* @param params.roomId The room ID to add the comment reaction in.
|
|
@@ -1216,7 +1249,7 @@ var Liveblocks = class {
|
|
|
1216
1249
|
_core.url`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}/add-reaction`,
|
|
1217
1250
|
{
|
|
1218
1251
|
...data,
|
|
1219
|
-
createdAt: _optionalChain([data, 'access',
|
|
1252
|
+
createdAt: _optionalChain([data, 'access', _26 => _26.createdAt, 'optionalAccess', _27 => _27.toISOString, 'call', _28 => _28()])
|
|
1220
1253
|
},
|
|
1221
1254
|
options
|
|
1222
1255
|
);
|
|
@@ -1242,7 +1275,7 @@ var Liveblocks = class {
|
|
|
1242
1275
|
_core.url`/v2/rooms/${roomId}/threads/${threadId}/comments/${params.commentId}/remove-reaction`,
|
|
1243
1276
|
{
|
|
1244
1277
|
...data,
|
|
1245
|
-
removedAt: _optionalChain([data, 'access',
|
|
1278
|
+
removedAt: _optionalChain([data, 'access', _29 => _29.removedAt, 'optionalAccess', _30 => _30.toISOString, 'call', _31 => _31()])
|
|
1246
1279
|
},
|
|
1247
1280
|
options
|
|
1248
1281
|
);
|
|
@@ -1318,7 +1351,7 @@ var Liveblocks = class {
|
|
|
1318
1351
|
*/
|
|
1319
1352
|
async *iterInboxNotifications(criteria, options) {
|
|
1320
1353
|
const { signal } = _nullishCoalesce(options, () => ( {}));
|
|
1321
|
-
const pageSize = _core.checkBounds.call(void 0, "pageSize", _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1354
|
+
const pageSize = _core.checkBounds.call(void 0, "pageSize", _nullishCoalesce(_optionalChain([options, 'optionalAccess', _32 => _32.pageSize]), () => ( 50)), 10);
|
|
1322
1355
|
let cursor = void 0;
|
|
1323
1356
|
while (true) {
|
|
1324
1357
|
const { nextCursor, data } = await this.getInboxNotifications(
|
|
@@ -1642,7 +1675,7 @@ var Liveblocks = class {
|
|
|
1642
1675
|
async getGroups(params, options) {
|
|
1643
1676
|
const res = await this.#get(
|
|
1644
1677
|
_core.url`/v2/groups`,
|
|
1645
|
-
{ startingAfter: _optionalChain([params, 'optionalAccess',
|
|
1678
|
+
{ startingAfter: _optionalChain([params, 'optionalAccess', _33 => _33.startingAfter]), limit: _optionalChain([params, 'optionalAccess', _34 => _34.limit]) },
|
|
1646
1679
|
options
|
|
1647
1680
|
);
|
|
1648
1681
|
if (!res.ok) {
|
|
@@ -1704,7 +1737,7 @@ var Liveblocks = class {
|
|
|
1704
1737
|
async massMutateStorage(criteria, callback, massOptions) {
|
|
1705
1738
|
const concurrency = _core.checkBounds.call(void 0,
|
|
1706
1739
|
"concurrency",
|
|
1707
|
-
_nullishCoalesce(_optionalChain([massOptions, 'optionalAccess',
|
|
1740
|
+
_nullishCoalesce(_optionalChain([massOptions, 'optionalAccess', _35 => _35.concurrency]), () => ( 8)),
|
|
1708
1741
|
1,
|
|
1709
1742
|
20
|
|
1710
1743
|
);
|
|
@@ -1720,7 +1753,7 @@ var Liveblocks = class {
|
|
|
1720
1753
|
}
|
|
1721
1754
|
async #_mutateOneRoom(roomId, room, callback, options) {
|
|
1722
1755
|
const debounceInterval = 200;
|
|
1723
|
-
const { signal, abort } = _core.makeAbortController.call(void 0, _optionalChain([options, 'optionalAccess',
|
|
1756
|
+
const { signal, abort } = _core.makeAbortController.call(void 0, _optionalChain([options, 'optionalAccess', _36 => _36.signal]));
|
|
1724
1757
|
let opsBuffer = [];
|
|
1725
1758
|
let outstandingFlush$ = void 0;
|
|
1726
1759
|
let lastFlush = performance.now();
|
|
@@ -1786,7 +1819,7 @@ var Liveblocks = class {
|
|
|
1786
1819
|
const res = await this.#post(
|
|
1787
1820
|
_core.url`/v2/rooms/${roomId}/send-message`,
|
|
1788
1821
|
{ messages },
|
|
1789
|
-
{ signal: _optionalChain([options, 'optionalAccess',
|
|
1822
|
+
{ signal: _optionalChain([options, 'optionalAccess', _37 => _37.signal]) }
|
|
1790
1823
|
);
|
|
1791
1824
|
if (!res.ok) {
|
|
1792
1825
|
throw await LiveblocksError.from(res);
|
|
@@ -1923,7 +1956,7 @@ var Liveblocks = class {
|
|
|
1923
1956
|
"Content-Type": params.file.type,
|
|
1924
1957
|
"Content-Length": String(params.file.size)
|
|
1925
1958
|
},
|
|
1926
|
-
signal: _optionalChain([options, 'optionalAccess',
|
|
1959
|
+
signal: _optionalChain([options, 'optionalAccess', _38 => _38.signal])
|
|
1927
1960
|
}
|
|
1928
1961
|
);
|
|
1929
1962
|
if (!res.ok) {
|
|
@@ -2199,6 +2232,7 @@ var WebhookHandler = class _WebhookHandler {
|
|
|
2199
2232
|
"commentDeleted",
|
|
2200
2233
|
"commentReactionAdded",
|
|
2201
2234
|
"commentReactionRemoved",
|
|
2235
|
+
"commentMetadataUpdated",
|
|
2202
2236
|
"threadMetadataUpdated",
|
|
2203
2237
|
"threadCreated",
|
|
2204
2238
|
"threadDeleted",
|