@liveblocks/node 3.16.0-feeds1 → 3.16.0-flow2
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 +25 -234
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -133
- package/dist/index.d.ts +5 -133
- package/dist/index.js +4 -213
- 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.16.0-
|
|
6
|
+
var PKG_VERSION = "3.16.0-flow2";
|
|
7
7
|
var PKG_FORMAT = "cjs";
|
|
8
8
|
|
|
9
9
|
// src/client.ts
|
|
@@ -165,9 +165,7 @@ var ALL_PERMISSIONS = Object.freeze([
|
|
|
165
165
|
"room:read",
|
|
166
166
|
"room:presence:write",
|
|
167
167
|
"comments:write",
|
|
168
|
-
"comments:read"
|
|
169
|
-
"feeds:write",
|
|
170
|
-
"feeds:read"
|
|
168
|
+
"comments:read"
|
|
171
169
|
]);
|
|
172
170
|
function isPermission(value) {
|
|
173
171
|
return ALL_PERMISSIONS.includes(value);
|
|
@@ -176,14 +174,9 @@ var MAX_PERMS_PER_SET = 10;
|
|
|
176
174
|
var READ_ACCESS = Object.freeze([
|
|
177
175
|
"room:read",
|
|
178
176
|
"room:presence:write",
|
|
179
|
-
"comments:read"
|
|
180
|
-
"feeds:read"
|
|
181
|
-
]);
|
|
182
|
-
var FULL_ACCESS = Object.freeze([
|
|
183
|
-
"room:write",
|
|
184
|
-
"comments:write",
|
|
185
|
-
"feeds:write"
|
|
177
|
+
"comments:read"
|
|
186
178
|
]);
|
|
179
|
+
var FULL_ACCESS = Object.freeze(["room:write", "comments:write"]);
|
|
187
180
|
var roomPatternRegex = /^([*]|[^*]{1,128}[*]?)$/;
|
|
188
181
|
var Session = (_class = class {
|
|
189
182
|
__init() {this.FULL_ACCESS = FULL_ACCESS}
|
|
@@ -367,22 +360,6 @@ var Liveblocks = class {
|
|
|
367
360
|
xwarn(res, "POST", path);
|
|
368
361
|
return res;
|
|
369
362
|
}
|
|
370
|
-
async #patch(path, json, options) {
|
|
371
|
-
const url3 = _core.urljoin.call(void 0, this.#baseUrl, path);
|
|
372
|
-
const headers = {
|
|
373
|
-
Authorization: `Bearer ${this.#secret}`,
|
|
374
|
-
"Content-Type": "application/json"
|
|
375
|
-
};
|
|
376
|
-
const fetch = await fetchPolyfill();
|
|
377
|
-
const res = await fetch(url3, {
|
|
378
|
-
method: "PATCH",
|
|
379
|
-
headers,
|
|
380
|
-
body: JSON.stringify(json),
|
|
381
|
-
signal: _optionalChain([options, 'optionalAccess', _2 => _2.signal])
|
|
382
|
-
});
|
|
383
|
-
xwarn(res, "PATCH", path);
|
|
384
|
-
return res;
|
|
385
|
-
}
|
|
386
363
|
async #putBinary(path, body, params, options) {
|
|
387
364
|
const url3 = _core.urljoin.call(void 0, this.#baseUrl, path, params);
|
|
388
365
|
const headers = {
|
|
@@ -394,7 +371,7 @@ var Liveblocks = class {
|
|
|
394
371
|
method: "PUT",
|
|
395
372
|
headers,
|
|
396
373
|
body,
|
|
397
|
-
signal: _optionalChain([options, 'optionalAccess',
|
|
374
|
+
signal: _optionalChain([options, 'optionalAccess', _2 => _2.signal])
|
|
398
375
|
});
|
|
399
376
|
xwarn(res, "PUT", path);
|
|
400
377
|
return res;
|
|
@@ -408,7 +385,7 @@ var Liveblocks = class {
|
|
|
408
385
|
const res = await fetch(url3, {
|
|
409
386
|
method: "DELETE",
|
|
410
387
|
headers,
|
|
411
|
-
signal: _optionalChain([options, 'optionalAccess',
|
|
388
|
+
signal: _optionalChain([options, 'optionalAccess', _3 => _3.signal])
|
|
412
389
|
});
|
|
413
390
|
xwarn(res, "DELETE", path);
|
|
414
391
|
return res;
|
|
@@ -422,7 +399,7 @@ var Liveblocks = class {
|
|
|
422
399
|
const res = await fetch(url3, {
|
|
423
400
|
method: "GET",
|
|
424
401
|
headers,
|
|
425
|
-
signal: _optionalChain([options, 'optionalAccess',
|
|
402
|
+
signal: _optionalChain([options, 'optionalAccess', _4 => _4.signal])
|
|
426
403
|
});
|
|
427
404
|
xwarn(res, "GET", path);
|
|
428
405
|
return res;
|
|
@@ -453,8 +430,8 @@ var Liveblocks = class {
|
|
|
453
430
|
return new Session(
|
|
454
431
|
this.#post.bind(this),
|
|
455
432
|
userId,
|
|
456
|
-
_optionalChain([options, 'optionalAccess',
|
|
457
|
-
_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
433
|
+
_optionalChain([options, 'optionalAccess', _5 => _5.userInfo]),
|
|
434
|
+
_nullishCoalesce(_optionalChain([options, 'optionalAccess', _6 => _6.organizationId]), () => ( _optionalChain([options, 'optionalAccess', _7 => _7.tenantId]))),
|
|
458
435
|
this.#localDev
|
|
459
436
|
);
|
|
460
437
|
}
|
|
@@ -504,7 +481,7 @@ var Liveblocks = class {
|
|
|
504
481
|
const body = {
|
|
505
482
|
userId,
|
|
506
483
|
groupIds,
|
|
507
|
-
userInfo: _optionalChain([options, 'optionalAccess',
|
|
484
|
+
userInfo: _optionalChain([options, 'optionalAccess', _8 => _8.userInfo])
|
|
508
485
|
};
|
|
509
486
|
if (organizationId !== void 0) {
|
|
510
487
|
body.organizationId = organizationId;
|
|
@@ -590,7 +567,7 @@ var Liveblocks = class {
|
|
|
590
567
|
*/
|
|
591
568
|
async *iterRooms(criteria, options) {
|
|
592
569
|
const { signal } = _nullishCoalesce(options, () => ( {}));
|
|
593
|
-
const pageSize = _core.checkBounds.call(void 0, "pageSize", _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
570
|
+
const pageSize = _core.checkBounds.call(void 0, "pageSize", _nullishCoalesce(_optionalChain([options, 'optionalAccess', _9 => _9.pageSize]), () => ( 40)), 20);
|
|
594
571
|
let cursor = void 0;
|
|
595
572
|
while (true) {
|
|
596
573
|
const { nextCursor, data } = await this.getRooms(
|
|
@@ -639,7 +616,7 @@ var Liveblocks = class {
|
|
|
639
616
|
body.organizationId = tenantId;
|
|
640
617
|
}
|
|
641
618
|
const res = await this.#post(
|
|
642
|
-
_optionalChain([options, 'optionalAccess',
|
|
619
|
+
_optionalChain([options, 'optionalAccess', _10 => _10.idempotent]) ? _core.url`/v2/rooms?idempotent` : _core.url`/v2/rooms`,
|
|
643
620
|
body,
|
|
644
621
|
options
|
|
645
622
|
);
|
|
@@ -1095,7 +1072,7 @@ var Liveblocks = class {
|
|
|
1095
1072
|
_core.url`/v2/rooms/${roomId}/threads/${threadId}/comments`,
|
|
1096
1073
|
{
|
|
1097
1074
|
...data,
|
|
1098
|
-
createdAt: _optionalChain([data, 'access',
|
|
1075
|
+
createdAt: _optionalChain([data, 'access', _11 => _11.createdAt, 'optionalAccess', _12 => _12.toISOString, 'call', _13 => _13()])
|
|
1099
1076
|
},
|
|
1100
1077
|
options
|
|
1101
1078
|
);
|
|
@@ -1121,7 +1098,7 @@ var Liveblocks = class {
|
|
|
1121
1098
|
_core.url`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}`,
|
|
1122
1099
|
{
|
|
1123
1100
|
body: data.body,
|
|
1124
|
-
editedAt: _optionalChain([data, 'access',
|
|
1101
|
+
editedAt: _optionalChain([data, 'access', _14 => _14.editedAt, 'optionalAccess', _15 => _15.toISOString, 'call', _16 => _16()]),
|
|
1125
1102
|
metadata: data.metadata
|
|
1126
1103
|
},
|
|
1127
1104
|
options
|
|
@@ -1189,7 +1166,7 @@ var Liveblocks = class {
|
|
|
1189
1166
|
...data,
|
|
1190
1167
|
comment: {
|
|
1191
1168
|
...data.comment,
|
|
1192
|
-
createdAt: _optionalChain([data, 'access',
|
|
1169
|
+
createdAt: _optionalChain([data, 'access', _17 => _17.comment, 'access', _18 => _18.createdAt, 'optionalAccess', _19 => _19.toISOString, 'call', _20 => _20()])
|
|
1193
1170
|
}
|
|
1194
1171
|
},
|
|
1195
1172
|
options
|
|
@@ -1312,7 +1289,7 @@ var Liveblocks = class {
|
|
|
1312
1289
|
_core.url`/v2/rooms/${roomId}/threads/${threadId}/metadata`,
|
|
1313
1290
|
{
|
|
1314
1291
|
...data,
|
|
1315
|
-
updatedAt: _optionalChain([data, 'access',
|
|
1292
|
+
updatedAt: _optionalChain([data, 'access', _21 => _21.updatedAt, 'optionalAccess', _22 => _22.toISOString, 'call', _23 => _23()])
|
|
1316
1293
|
},
|
|
1317
1294
|
options
|
|
1318
1295
|
);
|
|
@@ -1338,7 +1315,7 @@ var Liveblocks = class {
|
|
|
1338
1315
|
_core.url`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}/metadata`,
|
|
1339
1316
|
{
|
|
1340
1317
|
...data,
|
|
1341
|
-
updatedAt: _optionalChain([data, 'access',
|
|
1318
|
+
updatedAt: _optionalChain([data, 'access', _24 => _24.updatedAt, 'optionalAccess', _25 => _25.toISOString, 'call', _26 => _26()])
|
|
1342
1319
|
},
|
|
1343
1320
|
options
|
|
1344
1321
|
);
|
|
@@ -1364,7 +1341,7 @@ var Liveblocks = class {
|
|
|
1364
1341
|
_core.url`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}/add-reaction`,
|
|
1365
1342
|
{
|
|
1366
1343
|
...data,
|
|
1367
|
-
createdAt: _optionalChain([data, 'access',
|
|
1344
|
+
createdAt: _optionalChain([data, 'access', _27 => _27.createdAt, 'optionalAccess', _28 => _28.toISOString, 'call', _29 => _29()])
|
|
1368
1345
|
},
|
|
1369
1346
|
options
|
|
1370
1347
|
);
|
|
@@ -1390,7 +1367,7 @@ var Liveblocks = class {
|
|
|
1390
1367
|
_core.url`/v2/rooms/${roomId}/threads/${threadId}/comments/${params.commentId}/remove-reaction`,
|
|
1391
1368
|
{
|
|
1392
1369
|
...data,
|
|
1393
|
-
removedAt: _optionalChain([data, 'access',
|
|
1370
|
+
removedAt: _optionalChain([data, 'access', _30 => _30.removedAt, 'optionalAccess', _31 => _31.toISOString, 'call', _32 => _32()])
|
|
1394
1371
|
},
|
|
1395
1372
|
options
|
|
1396
1373
|
);
|
|
@@ -1471,7 +1448,7 @@ var Liveblocks = class {
|
|
|
1471
1448
|
*/
|
|
1472
1449
|
async *iterInboxNotifications(criteria, options) {
|
|
1473
1450
|
const { signal } = _nullishCoalesce(options, () => ( {}));
|
|
1474
|
-
const pageSize = _core.checkBounds.call(void 0, "pageSize", _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1451
|
+
const pageSize = _core.checkBounds.call(void 0, "pageSize", _nullishCoalesce(_optionalChain([options, 'optionalAccess', _33 => _33.pageSize]), () => ( 50)), 10);
|
|
1475
1452
|
let cursor = void 0;
|
|
1476
1453
|
while (true) {
|
|
1477
1454
|
const { nextCursor, data } = await this.getInboxNotifications(
|
|
@@ -1818,7 +1795,7 @@ var Liveblocks = class {
|
|
|
1818
1795
|
async getGroups(params, options) {
|
|
1819
1796
|
const res = await this.#get(
|
|
1820
1797
|
_core.url`/v2/groups`,
|
|
1821
|
-
{ startingAfter: _optionalChain([params, 'optionalAccess',
|
|
1798
|
+
{ startingAfter: _optionalChain([params, 'optionalAccess', _34 => _34.startingAfter]), limit: _optionalChain([params, 'optionalAccess', _35 => _35.limit]) },
|
|
1822
1799
|
options
|
|
1823
1800
|
);
|
|
1824
1801
|
if (!res.ok) {
|
|
@@ -1880,7 +1857,7 @@ var Liveblocks = class {
|
|
|
1880
1857
|
async massMutateStorage(criteria, callback, massOptions) {
|
|
1881
1858
|
const concurrency = _core.checkBounds.call(void 0,
|
|
1882
1859
|
"concurrency",
|
|
1883
|
-
_nullishCoalesce(_optionalChain([massOptions, 'optionalAccess',
|
|
1860
|
+
_nullishCoalesce(_optionalChain([massOptions, 'optionalAccess', _36 => _36.concurrency]), () => ( 8)),
|
|
1884
1861
|
1,
|
|
1885
1862
|
20
|
|
1886
1863
|
);
|
|
@@ -1896,7 +1873,7 @@ var Liveblocks = class {
|
|
|
1896
1873
|
}
|
|
1897
1874
|
async #_mutateOneRoom(roomId, room, callback, options) {
|
|
1898
1875
|
const debounceInterval = 200;
|
|
1899
|
-
const { signal, abort } = _core.makeAbortController.call(void 0, _optionalChain([options, 'optionalAccess',
|
|
1876
|
+
const { signal, abort } = _core.makeAbortController.call(void 0, _optionalChain([options, 'optionalAccess', _37 => _37.signal]));
|
|
1900
1877
|
let opsBuffer = [];
|
|
1901
1878
|
let outstandingFlush$ = void 0;
|
|
1902
1879
|
let lastFlush = performance.now();
|
|
@@ -1962,7 +1939,7 @@ var Liveblocks = class {
|
|
|
1962
1939
|
const res = await this.#post(
|
|
1963
1940
|
_core.url`/v2/rooms/${roomId}/send-message`,
|
|
1964
1941
|
{ messages },
|
|
1965
|
-
{ signal: _optionalChain([options, 'optionalAccess',
|
|
1942
|
+
{ signal: _optionalChain([options, 'optionalAccess', _38 => _38.signal]) }
|
|
1966
1943
|
);
|
|
1967
1944
|
if (!res.ok) {
|
|
1968
1945
|
throw await LiveblocksError.from(res);
|
|
@@ -2099,7 +2076,7 @@ var Liveblocks = class {
|
|
|
2099
2076
|
"Content-Type": params.file.type,
|
|
2100
2077
|
"Content-Length": String(params.file.size)
|
|
2101
2078
|
},
|
|
2102
|
-
signal: _optionalChain([options, 'optionalAccess',
|
|
2079
|
+
signal: _optionalChain([options, 'optionalAccess', _39 => _39.signal])
|
|
2103
2080
|
}
|
|
2104
2081
|
);
|
|
2105
2082
|
if (!res.ok) {
|
|
@@ -2231,192 +2208,6 @@ var Liveblocks = class {
|
|
|
2231
2208
|
data: page.data.map(inflateWebKnowledgeSourceLink)
|
|
2232
2209
|
};
|
|
2233
2210
|
}
|
|
2234
|
-
/* -------------------------------------------------------------------------------------------------
|
|
2235
|
-
* Feeds
|
|
2236
|
-
* -----------------------------------------------------------------------------------------------*/
|
|
2237
|
-
/**
|
|
2238
|
-
* Returns a list of feeds in a room.
|
|
2239
|
-
* @param params.roomId The room ID to get the feeds from.
|
|
2240
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
2241
|
-
* @returns A list of feeds.
|
|
2242
|
-
*/
|
|
2243
|
-
async getFeeds(params, options) {
|
|
2244
|
-
const { roomId } = params;
|
|
2245
|
-
const res = await this.#get(
|
|
2246
|
-
_core.url`/v2/rooms/${roomId}/feeds`,
|
|
2247
|
-
void 0,
|
|
2248
|
-
options
|
|
2249
|
-
);
|
|
2250
|
-
if (!res.ok) {
|
|
2251
|
-
throw await LiveblocksError.from(res);
|
|
2252
|
-
}
|
|
2253
|
-
return await res.json();
|
|
2254
|
-
}
|
|
2255
|
-
/**
|
|
2256
|
-
* Creates a new feed in a room.
|
|
2257
|
-
* @param params.roomId The room ID to create the feed in.
|
|
2258
|
-
* @param params.feedId The feed ID.
|
|
2259
|
-
* @param params.metadata (optional) The metadata for the feed.
|
|
2260
|
-
* @param params.createdAt (optional) Creation time in ms. Sent to the API as `timestamp`. If not provided, the server uses the current time.
|
|
2261
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
2262
|
-
* @returns The created feed.
|
|
2263
|
-
*/
|
|
2264
|
-
async createFeed(params, options) {
|
|
2265
|
-
const { roomId, feedId, metadata, createdAt } = params;
|
|
2266
|
-
const res = await this.#post(
|
|
2267
|
-
_core.url`/v2/rooms/${roomId}/feed`,
|
|
2268
|
-
{
|
|
2269
|
-
feedId,
|
|
2270
|
-
...metadata !== void 0 ? { metadata } : {},
|
|
2271
|
-
...createdAt !== void 0 ? { timestamp: createdAt } : {}
|
|
2272
|
-
},
|
|
2273
|
-
options
|
|
2274
|
-
);
|
|
2275
|
-
if (!res.ok) {
|
|
2276
|
-
throw await LiveblocksError.from(res);
|
|
2277
|
-
}
|
|
2278
|
-
return (await res.json()).data;
|
|
2279
|
-
}
|
|
2280
|
-
/**
|
|
2281
|
-
* Returns a feed with the given id.
|
|
2282
|
-
* @param params.roomId The room ID to get the feed from.
|
|
2283
|
-
* @param params.feedId The feed ID.
|
|
2284
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
2285
|
-
* @returns The feed.
|
|
2286
|
-
*/
|
|
2287
|
-
async getFeed(params, options) {
|
|
2288
|
-
const { roomId, feedId } = params;
|
|
2289
|
-
const res = await this.#get(
|
|
2290
|
-
_core.url`/v2/rooms/${roomId}/feeds/${feedId}`,
|
|
2291
|
-
void 0,
|
|
2292
|
-
options
|
|
2293
|
-
);
|
|
2294
|
-
if (!res.ok) {
|
|
2295
|
-
throw await LiveblocksError.from(res);
|
|
2296
|
-
}
|
|
2297
|
-
return (await res.json()).data;
|
|
2298
|
-
}
|
|
2299
|
-
/**
|
|
2300
|
-
* Updates the metadata of a feed.
|
|
2301
|
-
* @param params.roomId The room ID to update the feed in.
|
|
2302
|
-
* @param params.feedId The feed ID to update.
|
|
2303
|
-
* @param params.metadata The metadata for the feed.
|
|
2304
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
2305
|
-
*/
|
|
2306
|
-
async updateFeed(params, options) {
|
|
2307
|
-
const { roomId, feedId, metadata } = params;
|
|
2308
|
-
const res = await this.#patch(
|
|
2309
|
-
_core.url`/v2/rooms/${roomId}/feeds/${feedId}`,
|
|
2310
|
-
{ metadata },
|
|
2311
|
-
options
|
|
2312
|
-
);
|
|
2313
|
-
if (!res.ok) {
|
|
2314
|
-
throw await LiveblocksError.from(res);
|
|
2315
|
-
}
|
|
2316
|
-
}
|
|
2317
|
-
/**
|
|
2318
|
-
* Deletes a feed.
|
|
2319
|
-
* @param params.roomId The room ID to delete the feed from.
|
|
2320
|
-
* @param params.feedId The feed ID to delete.
|
|
2321
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
2322
|
-
*/
|
|
2323
|
-
async deleteFeed(params, options) {
|
|
2324
|
-
const { roomId, feedId } = params;
|
|
2325
|
-
const res = await this.#delete(
|
|
2326
|
-
_core.url`/v2/rooms/${roomId}/feeds/${feedId}`,
|
|
2327
|
-
void 0,
|
|
2328
|
-
options
|
|
2329
|
-
);
|
|
2330
|
-
if (!res.ok) {
|
|
2331
|
-
throw await LiveblocksError.from(res);
|
|
2332
|
-
}
|
|
2333
|
-
}
|
|
2334
|
-
/**
|
|
2335
|
-
* Returns a list of messages in a feed.
|
|
2336
|
-
* @param params.roomId The room ID to get the feed messages from.
|
|
2337
|
-
* @param params.feedId The feed ID to get the messages from.
|
|
2338
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
2339
|
-
* @returns A list of feed messages.
|
|
2340
|
-
*/
|
|
2341
|
-
async getFeedMessages(params, options) {
|
|
2342
|
-
const { roomId, feedId } = params;
|
|
2343
|
-
const res = await this.#get(
|
|
2344
|
-
_core.url`/v2/rooms/${roomId}/feeds/${feedId}/messages`,
|
|
2345
|
-
void 0,
|
|
2346
|
-
options
|
|
2347
|
-
);
|
|
2348
|
-
if (!res.ok) {
|
|
2349
|
-
throw await LiveblocksError.from(res);
|
|
2350
|
-
}
|
|
2351
|
-
return await res.json();
|
|
2352
|
-
}
|
|
2353
|
-
/**
|
|
2354
|
-
* Creates a new message in a feed.
|
|
2355
|
-
* @param params.roomId The room ID to create the feed message in.
|
|
2356
|
-
* @param params.feedId The feed ID to create the message in.
|
|
2357
|
-
* @param params.id (optional) The message ID. If not provided, one will be generated.
|
|
2358
|
-
* @param params.createdAt (optional) Creation time in ms. Sent to the API as `timestamp`. If not provided, the server uses the current time.
|
|
2359
|
-
* @param params.data The message data.
|
|
2360
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
2361
|
-
* @returns The created feed message.
|
|
2362
|
-
*/
|
|
2363
|
-
async createFeedMessage(params, options) {
|
|
2364
|
-
const { roomId, feedId, id, createdAt, data } = params;
|
|
2365
|
-
const res = await this.#post(
|
|
2366
|
-
_core.url`/v2/rooms/${roomId}/feeds/${feedId}/messages`,
|
|
2367
|
-
{
|
|
2368
|
-
data,
|
|
2369
|
-
...id !== void 0 ? { id } : {},
|
|
2370
|
-
...createdAt !== void 0 ? { timestamp: createdAt } : {}
|
|
2371
|
-
},
|
|
2372
|
-
options
|
|
2373
|
-
);
|
|
2374
|
-
if (!res.ok) {
|
|
2375
|
-
throw await LiveblocksError.from(res);
|
|
2376
|
-
}
|
|
2377
|
-
return (await res.json()).data;
|
|
2378
|
-
}
|
|
2379
|
-
/**
|
|
2380
|
-
* Updates a feed message.
|
|
2381
|
-
* @param params.roomId The room ID to update the feed message in.
|
|
2382
|
-
* @param params.feedId The feed ID to update the message in.
|
|
2383
|
-
* @param params.messageId The message ID to update.
|
|
2384
|
-
* @param params.data The message data.
|
|
2385
|
-
* @param params.updatedAt (optional) Update time in ms. Sent to the API as `timestamp`. If omitted, the server uses the current time.
|
|
2386
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
2387
|
-
*/
|
|
2388
|
-
async updateFeedMessage(params, options) {
|
|
2389
|
-
const { roomId, feedId, messageId, data, updatedAt } = params;
|
|
2390
|
-
const res = await this.#patch(
|
|
2391
|
-
_core.url`/v2/rooms/${roomId}/feeds/${feedId}/messages/${messageId}`,
|
|
2392
|
-
{
|
|
2393
|
-
data,
|
|
2394
|
-
...updatedAt !== void 0 ? { timestamp: updatedAt } : {}
|
|
2395
|
-
},
|
|
2396
|
-
options
|
|
2397
|
-
);
|
|
2398
|
-
if (!res.ok) {
|
|
2399
|
-
throw await LiveblocksError.from(res);
|
|
2400
|
-
}
|
|
2401
|
-
}
|
|
2402
|
-
/**
|
|
2403
|
-
* Deletes a feed message.
|
|
2404
|
-
* @param params.roomId The room ID to delete the feed message from.
|
|
2405
|
-
* @param params.feedId The feed ID to delete the message from.
|
|
2406
|
-
* @param params.messageId The message ID to delete.
|
|
2407
|
-
* @param options.signal (optional) An abort signal to cancel the request.
|
|
2408
|
-
*/
|
|
2409
|
-
async deleteFeedMessage(params, options) {
|
|
2410
|
-
const { roomId, feedId, messageId } = params;
|
|
2411
|
-
const res = await this.#delete(
|
|
2412
|
-
_core.url`/v2/rooms/${roomId}/feeds/${feedId}/messages/${messageId}`,
|
|
2413
|
-
void 0,
|
|
2414
|
-
options
|
|
2415
|
-
);
|
|
2416
|
-
if (!res.ok) {
|
|
2417
|
-
throw await LiveblocksError.from(res);
|
|
2418
|
-
}
|
|
2419
|
-
}
|
|
2420
2211
|
};
|
|
2421
2212
|
var LiveblocksError = class _LiveblocksError extends Error {
|
|
2422
2213
|
|