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