@liveblocks/node 3.23.0-file3 → 3.23.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 +169 -56
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -2
- package/dist/index.d.ts +22 -2
- package/dist/index.js +140 -27
- 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.23.0
|
|
6
|
+
var PKG_VERSION = "3.23.0";
|
|
7
7
|
var PKG_FORMAT = "cjs";
|
|
8
8
|
|
|
9
9
|
// src/client.ts
|
|
@@ -34,6 +34,7 @@ var PKG_FORMAT = "cjs";
|
|
|
34
34
|
|
|
35
35
|
|
|
36
36
|
|
|
37
|
+
|
|
37
38
|
|
|
38
39
|
|
|
39
40
|
// src/lib/itertools.ts
|
|
@@ -294,9 +295,9 @@ var Session = (_class = class {
|
|
|
294
295
|
}, _class);
|
|
295
296
|
|
|
296
297
|
// src/client.ts
|
|
297
|
-
var
|
|
298
|
-
var
|
|
299
|
-
var
|
|
298
|
+
var ROOM_FILE_PART_SIZE = 5 * 1024 * 1024;
|
|
299
|
+
var ROOM_FILE_RETRY_ATTEMPTS = 10;
|
|
300
|
+
var ROOM_FILE_RETRY_DELAYS = [
|
|
300
301
|
2e3,
|
|
301
302
|
2e3,
|
|
302
303
|
2e3,
|
|
@@ -308,10 +309,11 @@ var STORAGE_FILE_RETRY_DELAYS = [
|
|
|
308
309
|
2e3,
|
|
309
310
|
2e3
|
|
310
311
|
];
|
|
311
|
-
async function
|
|
312
|
+
async function uploadRoomFile({
|
|
312
313
|
file,
|
|
313
314
|
signal,
|
|
314
315
|
abortErrorMessage,
|
|
316
|
+
retryMultipartCompletion,
|
|
315
317
|
uploadSingle,
|
|
316
318
|
createMultipartUpload,
|
|
317
319
|
uploadMultipartPart,
|
|
@@ -328,49 +330,90 @@ async function uploadStorageFile({
|
|
|
328
330
|
}
|
|
329
331
|
return err instanceof LiveblocksError && err.status >= 400 && err.status < 500;
|
|
330
332
|
};
|
|
331
|
-
if (file.size <=
|
|
333
|
+
if (file.size <= ROOM_FILE_PART_SIZE) {
|
|
332
334
|
return _core.autoRetry.call(void 0,
|
|
333
335
|
uploadSingle,
|
|
334
|
-
|
|
335
|
-
|
|
336
|
+
ROOM_FILE_RETRY_ATTEMPTS,
|
|
337
|
+
ROOM_FILE_RETRY_DELAYS,
|
|
336
338
|
handleRetryError
|
|
337
339
|
);
|
|
338
340
|
}
|
|
339
341
|
let uploadId;
|
|
340
342
|
const uploadedParts = [];
|
|
341
|
-
const multipartUpload = await
|
|
343
|
+
const multipartUpload = await _core.autoRetry.call(void 0,
|
|
344
|
+
createMultipartUpload,
|
|
345
|
+
ROOM_FILE_RETRY_ATTEMPTS,
|
|
346
|
+
ROOM_FILE_RETRY_DELAYS,
|
|
347
|
+
handleRetryError
|
|
348
|
+
);
|
|
349
|
+
const partUploadController = new AbortController();
|
|
350
|
+
const partUploadSignal = partUploadController.signal;
|
|
351
|
+
const abortPartUploads = (reason) => {
|
|
352
|
+
partUploadController.abort(reason);
|
|
353
|
+
};
|
|
354
|
+
const handleExternalAbort = () => abortPartUploads();
|
|
355
|
+
if (_optionalChain([signal, 'optionalAccess', _4 => _4.aborted])) {
|
|
356
|
+
handleExternalAbort();
|
|
357
|
+
} else {
|
|
358
|
+
_optionalChain([signal, 'optionalAccess', _5 => _5.addEventListener, 'call', _6 => _6("abort", handleExternalAbort, { once: true })]);
|
|
359
|
+
}
|
|
342
360
|
try {
|
|
343
361
|
uploadId = multipartUpload.uploadId;
|
|
344
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
362
|
+
if (_optionalChain([signal, 'optionalAccess', _7 => _7.aborted])) {
|
|
345
363
|
throw abortError;
|
|
346
364
|
}
|
|
347
|
-
const batches = _core.chunk.call(void 0,
|
|
365
|
+
const batches = _core.chunk.call(void 0, splitRoomFileIntoParts(file), 5);
|
|
348
366
|
for (const parts of batches) {
|
|
349
|
-
const
|
|
367
|
+
const firstPartUploadFailure = {};
|
|
368
|
+
const partUploads$ = [];
|
|
350
369
|
for (const { part, partNumber } of parts) {
|
|
351
|
-
|
|
370
|
+
partUploads$.push(
|
|
352
371
|
_core.autoRetry.call(void 0,
|
|
353
|
-
() => uploadMultipartPart(
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
372
|
+
() => uploadMultipartPart(
|
|
373
|
+
multipartUpload.uploadId,
|
|
374
|
+
partNumber,
|
|
375
|
+
part,
|
|
376
|
+
partUploadSignal
|
|
377
|
+
),
|
|
378
|
+
ROOM_FILE_RETRY_ATTEMPTS,
|
|
379
|
+
ROOM_FILE_RETRY_DELAYS,
|
|
380
|
+
(error) => {
|
|
381
|
+
if (_optionalChain([signal, 'optionalAccess', _8 => _8.aborted])) {
|
|
382
|
+
throw abortError;
|
|
383
|
+
}
|
|
384
|
+
return partUploadSignal.aborted || handleRetryError(error);
|
|
385
|
+
}
|
|
386
|
+
).catch((error) => {
|
|
387
|
+
if (firstPartUploadFailure.value === void 0) {
|
|
388
|
+
firstPartUploadFailure.value = { error };
|
|
389
|
+
abortPartUploads(error);
|
|
390
|
+
}
|
|
391
|
+
throw error;
|
|
392
|
+
})
|
|
358
393
|
);
|
|
359
394
|
}
|
|
360
|
-
|
|
395
|
+
const settledPartUploads = await Promise.allSettled(partUploads$);
|
|
396
|
+
if (firstPartUploadFailure.value !== void 0) {
|
|
397
|
+
throw firstPartUploadFailure.value.error;
|
|
398
|
+
}
|
|
399
|
+
for (const settledPartUpload of settledPartUploads) {
|
|
400
|
+
if (settledPartUpload.status === "fulfilled") {
|
|
401
|
+
uploadedParts.push(settledPartUpload.value);
|
|
402
|
+
}
|
|
403
|
+
}
|
|
361
404
|
}
|
|
362
|
-
if (_optionalChain([signal, 'optionalAccess',
|
|
405
|
+
if (_optionalChain([signal, 'optionalAccess', _9 => _9.aborted])) {
|
|
363
406
|
throw abortError;
|
|
364
407
|
}
|
|
365
408
|
const sortedParts = uploadedParts.sort(
|
|
366
409
|
(a, b) => a.partNumber - b.partNumber
|
|
367
410
|
);
|
|
368
|
-
return _core.autoRetry.call(void 0,
|
|
411
|
+
return retryMultipartCompletion ? _core.autoRetry.call(void 0,
|
|
369
412
|
() => completeMultipartUpload(multipartUpload.uploadId, sortedParts),
|
|
370
|
-
|
|
371
|
-
|
|
413
|
+
ROOM_FILE_RETRY_ATTEMPTS,
|
|
414
|
+
ROOM_FILE_RETRY_DELAYS,
|
|
372
415
|
handleRetryError
|
|
373
|
-
);
|
|
416
|
+
) : completeMultipartUpload(uploadId, sortedParts);
|
|
374
417
|
} catch (err) {
|
|
375
418
|
if (uploadId) {
|
|
376
419
|
try {
|
|
@@ -379,13 +422,15 @@ async function uploadStorageFile({
|
|
|
379
422
|
}
|
|
380
423
|
}
|
|
381
424
|
throw err;
|
|
425
|
+
} finally {
|
|
426
|
+
_optionalChain([signal, 'optionalAccess', _10 => _10.removeEventListener, 'call', _11 => _11("abort", handleExternalAbort)]);
|
|
382
427
|
}
|
|
383
428
|
}
|
|
384
|
-
function
|
|
429
|
+
function splitRoomFileIntoParts(file) {
|
|
385
430
|
const parts = [];
|
|
386
431
|
let start = 0;
|
|
387
432
|
while (start < file.size) {
|
|
388
|
-
const end = Math.min(start +
|
|
433
|
+
const end = Math.min(start + ROOM_FILE_PART_SIZE, file.size);
|
|
389
434
|
parts.push({
|
|
390
435
|
partNumber: parts.length + 1,
|
|
391
436
|
part: file.slice(start, end)
|
|
@@ -483,7 +528,7 @@ var Liveblocks = class {
|
|
|
483
528
|
method: "POST",
|
|
484
529
|
headers,
|
|
485
530
|
body: JSON.stringify(json),
|
|
486
|
-
signal: _optionalChain([options, 'optionalAccess',
|
|
531
|
+
signal: _optionalChain([options, 'optionalAccess', _12 => _12.signal])
|
|
487
532
|
});
|
|
488
533
|
xwarn(res, "POST", path);
|
|
489
534
|
return res;
|
|
@@ -505,7 +550,7 @@ var Liveblocks = class {
|
|
|
505
550
|
method: "PATCH",
|
|
506
551
|
headers,
|
|
507
552
|
body: JSON.stringify(json),
|
|
508
|
-
signal: _optionalChain([options, 'optionalAccess',
|
|
553
|
+
signal: _optionalChain([options, 'optionalAccess', _13 => _13.signal])
|
|
509
554
|
});
|
|
510
555
|
xwarn(res, "PATCH", path);
|
|
511
556
|
return res;
|
|
@@ -521,7 +566,7 @@ var Liveblocks = class {
|
|
|
521
566
|
method: "PUT",
|
|
522
567
|
headers,
|
|
523
568
|
body,
|
|
524
|
-
signal: _optionalChain([options, 'optionalAccess',
|
|
569
|
+
signal: _optionalChain([options, 'optionalAccess', _14 => _14.signal])
|
|
525
570
|
});
|
|
526
571
|
xwarn(res, "PUT", path);
|
|
527
572
|
return res;
|
|
@@ -537,7 +582,7 @@ var Liveblocks = class {
|
|
|
537
582
|
method: "PUT",
|
|
538
583
|
headers,
|
|
539
584
|
body,
|
|
540
|
-
signal: _optionalChain([options, 'optionalAccess',
|
|
585
|
+
signal: _optionalChain([options, 'optionalAccess', _15 => _15.signal])
|
|
541
586
|
});
|
|
542
587
|
xwarn(res, "PUT", path);
|
|
543
588
|
return res;
|
|
@@ -551,7 +596,7 @@ var Liveblocks = class {
|
|
|
551
596
|
const res = await fetch(url3, {
|
|
552
597
|
method: "DELETE",
|
|
553
598
|
headers,
|
|
554
|
-
signal: _optionalChain([options, 'optionalAccess',
|
|
599
|
+
signal: _optionalChain([options, 'optionalAccess', _16 => _16.signal])
|
|
555
600
|
});
|
|
556
601
|
xwarn(res, "DELETE", path);
|
|
557
602
|
return res;
|
|
@@ -565,7 +610,7 @@ var Liveblocks = class {
|
|
|
565
610
|
const res = await fetch(url3, {
|
|
566
611
|
method: "GET",
|
|
567
612
|
headers,
|
|
568
|
-
signal: _optionalChain([options, 'optionalAccess',
|
|
613
|
+
signal: _optionalChain([options, 'optionalAccess', _17 => _17.signal])
|
|
569
614
|
});
|
|
570
615
|
xwarn(res, "GET", path);
|
|
571
616
|
return res;
|
|
@@ -596,8 +641,8 @@ var Liveblocks = class {
|
|
|
596
641
|
return new Session(
|
|
597
642
|
this.#post.bind(this),
|
|
598
643
|
userId,
|
|
599
|
-
_optionalChain([options, 'optionalAccess',
|
|
600
|
-
_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
644
|
+
_optionalChain([options, 'optionalAccess', _18 => _18.userInfo]),
|
|
645
|
+
_nullishCoalesce(_optionalChain([options, 'optionalAccess', _19 => _19.organizationId]), () => ( _optionalChain([options, 'optionalAccess', _20 => _20.tenantId]))),
|
|
601
646
|
this.#localDev
|
|
602
647
|
);
|
|
603
648
|
}
|
|
@@ -647,7 +692,7 @@ var Liveblocks = class {
|
|
|
647
692
|
const body = {
|
|
648
693
|
userId,
|
|
649
694
|
groupIds,
|
|
650
|
-
userInfo: _optionalChain([options, 'optionalAccess',
|
|
695
|
+
userInfo: _optionalChain([options, 'optionalAccess', _21 => _21.userInfo])
|
|
651
696
|
};
|
|
652
697
|
if (organizationId !== void 0) {
|
|
653
698
|
body.organizationId = organizationId;
|
|
@@ -733,7 +778,7 @@ var Liveblocks = class {
|
|
|
733
778
|
*/
|
|
734
779
|
async *iterRooms(criteria, options) {
|
|
735
780
|
const { signal } = _nullishCoalesce(options, () => ( {}));
|
|
736
|
-
const pageSize = _core.checkBounds.call(void 0, "pageSize", _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
781
|
+
const pageSize = _core.checkBounds.call(void 0, "pageSize", _nullishCoalesce(_optionalChain([options, 'optionalAccess', _22 => _22.pageSize]), () => ( 40)), 20);
|
|
737
782
|
let cursor = void 0;
|
|
738
783
|
while (true) {
|
|
739
784
|
const { nextCursor, data } = await this.getRooms(
|
|
@@ -783,7 +828,7 @@ var Liveblocks = class {
|
|
|
783
828
|
body.organizationId = tenantId;
|
|
784
829
|
}
|
|
785
830
|
const res = await this.#post(
|
|
786
|
-
_optionalChain([options, 'optionalAccess',
|
|
831
|
+
_optionalChain([options, 'optionalAccess', _23 => _23.idempotent]) ? _core.url`/v2/rooms?idempotent` : _core.url`/v2/rooms`,
|
|
787
832
|
body,
|
|
788
833
|
options
|
|
789
834
|
);
|
|
@@ -1309,6 +1354,7 @@ var Liveblocks = class {
|
|
|
1309
1354
|
* @param params.data.userId The user ID of the user who is set to create the comment.
|
|
1310
1355
|
* @param params.data.createdAt (optional) The date the comment is set to be created.
|
|
1311
1356
|
* @param params.data.body The body of the comment.
|
|
1357
|
+
* @param params.data.attachmentIds (optional) The attachment IDs to add to the comment.
|
|
1312
1358
|
* @param params.data.metadata (optional) The metadata for the comment.
|
|
1313
1359
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1314
1360
|
* @returns The created comment.
|
|
@@ -1319,7 +1365,7 @@ var Liveblocks = class {
|
|
|
1319
1365
|
_core.url`/v2/rooms/${roomId}/threads/${threadId}/comments`,
|
|
1320
1366
|
{
|
|
1321
1367
|
...data,
|
|
1322
|
-
createdAt: _optionalChain([data, 'access',
|
|
1368
|
+
createdAt: _optionalChain([data, 'access', _24 => _24.createdAt, 'optionalAccess', _25 => _25.toISOString, 'call', _26 => _26()])
|
|
1323
1369
|
},
|
|
1324
1370
|
options
|
|
1325
1371
|
);
|
|
@@ -1334,6 +1380,7 @@ var Liveblocks = class {
|
|
|
1334
1380
|
* @param params.threadId The thread ID to edit the comment in.
|
|
1335
1381
|
* @param params.commentId The comment ID to edit.
|
|
1336
1382
|
* @param params.data.body The body of the comment.
|
|
1383
|
+
* @param params.data.attachmentIds (optional) The IDs of every attachment that should remain on the comment.
|
|
1337
1384
|
* @param params.data.metadata (optional) The metadata for the comment. Value must be a string, boolean or number. Use null to delete a key.
|
|
1338
1385
|
* @param params.data.editedAt (optional) The date the comment was edited.
|
|
1339
1386
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
@@ -1345,7 +1392,8 @@ var Liveblocks = class {
|
|
|
1345
1392
|
_core.url`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}`,
|
|
1346
1393
|
{
|
|
1347
1394
|
body: data.body,
|
|
1348
|
-
editedAt: _optionalChain([data, 'access',
|
|
1395
|
+
editedAt: _optionalChain([data, 'access', _27 => _27.editedAt, 'optionalAccess', _28 => _28.toISOString, 'call', _29 => _29()]),
|
|
1396
|
+
attachmentIds: data.attachmentIds,
|
|
1349
1397
|
metadata: data.metadata
|
|
1350
1398
|
},
|
|
1351
1399
|
options
|
|
@@ -1393,13 +1441,77 @@ var Liveblocks = class {
|
|
|
1393
1441
|
}
|
|
1394
1442
|
return await res.json();
|
|
1395
1443
|
}
|
|
1444
|
+
/**
|
|
1445
|
+
* Uploads an attachment that can be added to a comment.
|
|
1446
|
+
*
|
|
1447
|
+
* @param params.roomId The room ID to upload the attachment to.
|
|
1448
|
+
* @param params.userId The user ID of the user uploading the attachment.
|
|
1449
|
+
* @param params.file The file to upload.
|
|
1450
|
+
* @param options.signal (optional) An abort signal to cancel the upload.
|
|
1451
|
+
* @returns The uploaded attachment.
|
|
1452
|
+
*/
|
|
1453
|
+
async uploadAttachment(params, options) {
|
|
1454
|
+
const { roomId, userId, file } = params;
|
|
1455
|
+
const attachmentId = _core.createCommentAttachmentId.call(void 0, );
|
|
1456
|
+
return await uploadRoomFile({
|
|
1457
|
+
file,
|
|
1458
|
+
signal: _optionalChain([options, 'optionalAccess', _30 => _30.signal]),
|
|
1459
|
+
abortErrorMessage: `Upload of attachment ${attachmentId} was aborted.`,
|
|
1460
|
+
retryMultipartCompletion: false,
|
|
1461
|
+
uploadSingle: async () => {
|
|
1462
|
+
const res = await this.#putBlob(
|
|
1463
|
+
_core.url`/v2/rooms/${roomId}/attachments/${attachmentId}/upload/${file.name}`,
|
|
1464
|
+
file,
|
|
1465
|
+
{ fileSize: file.size, userId },
|
|
1466
|
+
options
|
|
1467
|
+
);
|
|
1468
|
+
return await this.#readJsonResponse(res);
|
|
1469
|
+
},
|
|
1470
|
+
createMultipartUpload: async () => {
|
|
1471
|
+
const res = await this.#post(
|
|
1472
|
+
_core.url`/v2/rooms/${roomId}/attachments/${attachmentId}/multipart/${file.name}`,
|
|
1473
|
+
void 0,
|
|
1474
|
+
options,
|
|
1475
|
+
{ fileSize: file.size }
|
|
1476
|
+
);
|
|
1477
|
+
return await this.#readJsonResponse(res);
|
|
1478
|
+
},
|
|
1479
|
+
uploadMultipartPart: async (uploadId, partNumber, part, signal) => {
|
|
1480
|
+
const res = await this.#putBlob(
|
|
1481
|
+
_core.url`/v2/rooms/${roomId}/attachments/${attachmentId}/multipart/${uploadId}/${String(partNumber)}`,
|
|
1482
|
+
part,
|
|
1483
|
+
void 0,
|
|
1484
|
+
{ signal }
|
|
1485
|
+
);
|
|
1486
|
+
return await this.#readJsonResponse(res);
|
|
1487
|
+
},
|
|
1488
|
+
completeMultipartUpload: async (uploadId, parts) => {
|
|
1489
|
+
const res = await this.#post(
|
|
1490
|
+
_core.url`/v2/rooms/${roomId}/attachments/${attachmentId}/multipart/${uploadId}/complete`,
|
|
1491
|
+
{ parts },
|
|
1492
|
+
options,
|
|
1493
|
+
{ userId }
|
|
1494
|
+
);
|
|
1495
|
+
return await this.#readJsonResponse(res);
|
|
1496
|
+
},
|
|
1497
|
+
abortMultipartUpload: async (uploadId) => {
|
|
1498
|
+
const res = await this.#delete(
|
|
1499
|
+
_core.url`/v2/rooms/${roomId}/attachments/${attachmentId}/multipart/${uploadId}`
|
|
1500
|
+
);
|
|
1501
|
+
if (!res.ok) {
|
|
1502
|
+
throw await LiveblocksError.from(res);
|
|
1503
|
+
}
|
|
1504
|
+
}
|
|
1505
|
+
});
|
|
1506
|
+
}
|
|
1396
1507
|
async uploadFile(params, options) {
|
|
1397
1508
|
const { roomId, file } = params;
|
|
1398
1509
|
const fileId = _core.createStorageFileId.call(void 0, );
|
|
1399
|
-
const fileData = await
|
|
1510
|
+
const fileData = await uploadRoomFile({
|
|
1400
1511
|
file,
|
|
1401
|
-
signal: _optionalChain([options, 'optionalAccess',
|
|
1512
|
+
signal: _optionalChain([options, 'optionalAccess', _31 => _31.signal]),
|
|
1402
1513
|
abortErrorMessage: `Upload of file ${fileId} was aborted.`,
|
|
1514
|
+
retryMultipartCompletion: true,
|
|
1403
1515
|
uploadSingle: async () => {
|
|
1404
1516
|
const res = await this.#putBlob(
|
|
1405
1517
|
_core.url`/v2/rooms/${roomId}/storage/files/${fileId}/upload/${file.name}`,
|
|
@@ -1418,12 +1530,12 @@ var Liveblocks = class {
|
|
|
1418
1530
|
);
|
|
1419
1531
|
return await this.#readJsonResponse(res);
|
|
1420
1532
|
},
|
|
1421
|
-
uploadMultipartPart: async (uploadId, partNumber, part) => {
|
|
1533
|
+
uploadMultipartPart: async (uploadId, partNumber, part, signal) => {
|
|
1422
1534
|
const res = await this.#putBlob(
|
|
1423
1535
|
_core.url`/v2/rooms/${roomId}/storage/files/${fileId}/multipart/${uploadId}/${String(partNumber)}`,
|
|
1424
1536
|
part,
|
|
1425
1537
|
void 0,
|
|
1426
|
-
|
|
1538
|
+
{ signal }
|
|
1427
1539
|
);
|
|
1428
1540
|
return await this.#readJsonResponse(res);
|
|
1429
1541
|
},
|
|
@@ -1468,6 +1580,7 @@ var Liveblocks = class {
|
|
|
1468
1580
|
* @param params.thread.comment.userId The user ID of the user who created the comment.
|
|
1469
1581
|
* @param params.thread.comment.createdAt (optional) The date the comment was created.
|
|
1470
1582
|
* @param params.thread.comment.body The body of the comment.
|
|
1583
|
+
* @param params.thread.comment.attachmentIds (optional) The attachment IDs to add to the comment.
|
|
1471
1584
|
* @param params.thread.comment.metadata (optional) The metadata for the comment.
|
|
1472
1585
|
* @param options.signal (optional) An abort signal to cancel the request.
|
|
1473
1586
|
* @returns The created thread. The thread will be created with the specified comment as its first comment.
|
|
@@ -1480,7 +1593,7 @@ var Liveblocks = class {
|
|
|
1480
1593
|
...data,
|
|
1481
1594
|
comment: {
|
|
1482
1595
|
...data.comment,
|
|
1483
|
-
createdAt: _optionalChain([data, 'access',
|
|
1596
|
+
createdAt: _optionalChain([data, 'access', _32 => _32.comment, 'access', _33 => _33.createdAt, 'optionalAccess', _34 => _34.toISOString, 'call', _35 => _35()])
|
|
1484
1597
|
}
|
|
1485
1598
|
},
|
|
1486
1599
|
options
|
|
@@ -1603,7 +1716,7 @@ var Liveblocks = class {
|
|
|
1603
1716
|
_core.url`/v2/rooms/${roomId}/threads/${threadId}/metadata`,
|
|
1604
1717
|
{
|
|
1605
1718
|
...data,
|
|
1606
|
-
updatedAt: _optionalChain([data, 'access',
|
|
1719
|
+
updatedAt: _optionalChain([data, 'access', _36 => _36.updatedAt, 'optionalAccess', _37 => _37.toISOString, 'call', _38 => _38()])
|
|
1607
1720
|
},
|
|
1608
1721
|
options
|
|
1609
1722
|
);
|
|
@@ -1629,7 +1742,7 @@ var Liveblocks = class {
|
|
|
1629
1742
|
_core.url`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}/metadata`,
|
|
1630
1743
|
{
|
|
1631
1744
|
...data,
|
|
1632
|
-
updatedAt: _optionalChain([data, 'access',
|
|
1745
|
+
updatedAt: _optionalChain([data, 'access', _39 => _39.updatedAt, 'optionalAccess', _40 => _40.toISOString, 'call', _41 => _41()])
|
|
1633
1746
|
},
|
|
1634
1747
|
options
|
|
1635
1748
|
);
|
|
@@ -1655,7 +1768,7 @@ var Liveblocks = class {
|
|
|
1655
1768
|
_core.url`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}/add-reaction`,
|
|
1656
1769
|
{
|
|
1657
1770
|
...data,
|
|
1658
|
-
createdAt: _optionalChain([data, 'access',
|
|
1771
|
+
createdAt: _optionalChain([data, 'access', _42 => _42.createdAt, 'optionalAccess', _43 => _43.toISOString, 'call', _44 => _44()])
|
|
1659
1772
|
},
|
|
1660
1773
|
options
|
|
1661
1774
|
);
|
|
@@ -1681,7 +1794,7 @@ var Liveblocks = class {
|
|
|
1681
1794
|
_core.url`/v2/rooms/${roomId}/threads/${threadId}/comments/${params.commentId}/remove-reaction`,
|
|
1682
1795
|
{
|
|
1683
1796
|
...data,
|
|
1684
|
-
removedAt: _optionalChain([data, 'access',
|
|
1797
|
+
removedAt: _optionalChain([data, 'access', _45 => _45.removedAt, 'optionalAccess', _46 => _46.toISOString, 'call', _47 => _47()])
|
|
1685
1798
|
},
|
|
1686
1799
|
options
|
|
1687
1800
|
);
|
|
@@ -1762,7 +1875,7 @@ var Liveblocks = class {
|
|
|
1762
1875
|
*/
|
|
1763
1876
|
async *iterInboxNotifications(criteria, options) {
|
|
1764
1877
|
const { signal } = _nullishCoalesce(options, () => ( {}));
|
|
1765
|
-
const pageSize = _core.checkBounds.call(void 0, "pageSize", _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1878
|
+
const pageSize = _core.checkBounds.call(void 0, "pageSize", _nullishCoalesce(_optionalChain([options, 'optionalAccess', _48 => _48.pageSize]), () => ( 50)), 10);
|
|
1766
1879
|
let cursor = void 0;
|
|
1767
1880
|
while (true) {
|
|
1768
1881
|
const { nextCursor, data } = await this.getInboxNotifications(
|
|
@@ -2109,7 +2222,7 @@ var Liveblocks = class {
|
|
|
2109
2222
|
async getGroups(params, options) {
|
|
2110
2223
|
const res = await this.#get(
|
|
2111
2224
|
_core.url`/v2/groups`,
|
|
2112
|
-
{ startingAfter: _optionalChain([params, 'optionalAccess',
|
|
2225
|
+
{ startingAfter: _optionalChain([params, 'optionalAccess', _49 => _49.startingAfter]), limit: _optionalChain([params, 'optionalAccess', _50 => _50.limit]) },
|
|
2113
2226
|
options
|
|
2114
2227
|
);
|
|
2115
2228
|
if (!res.ok) {
|
|
@@ -2171,7 +2284,7 @@ var Liveblocks = class {
|
|
|
2171
2284
|
async massMutateStorage(criteria, callback, massOptions) {
|
|
2172
2285
|
const concurrency = _core.checkBounds.call(void 0,
|
|
2173
2286
|
"concurrency",
|
|
2174
|
-
_nullishCoalesce(_optionalChain([massOptions, 'optionalAccess',
|
|
2287
|
+
_nullishCoalesce(_optionalChain([massOptions, 'optionalAccess', _51 => _51.concurrency]), () => ( 8)),
|
|
2175
2288
|
1,
|
|
2176
2289
|
20
|
|
2177
2290
|
);
|
|
@@ -2187,7 +2300,7 @@ var Liveblocks = class {
|
|
|
2187
2300
|
}
|
|
2188
2301
|
async #_mutateOneRoom(roomId, room, callback, options) {
|
|
2189
2302
|
const debounceInterval = 200;
|
|
2190
|
-
const { signal, abort } = _core.makeAbortController.call(void 0, _optionalChain([options, 'optionalAccess',
|
|
2303
|
+
const { signal, abort } = _core.makeAbortController.call(void 0, _optionalChain([options, 'optionalAccess', _52 => _52.signal]));
|
|
2191
2304
|
let opsBuffer = [];
|
|
2192
2305
|
let outstandingFlush$ = void 0;
|
|
2193
2306
|
let lastFlush = performance.now();
|
|
@@ -2253,7 +2366,7 @@ var Liveblocks = class {
|
|
|
2253
2366
|
const res = await this.#post(
|
|
2254
2367
|
_core.url`/v2/rooms/${roomId}/send-message`,
|
|
2255
2368
|
{ messages },
|
|
2256
|
-
{ signal: _optionalChain([options, 'optionalAccess',
|
|
2369
|
+
{ signal: _optionalChain([options, 'optionalAccess', _53 => _53.signal]) }
|
|
2257
2370
|
);
|
|
2258
2371
|
if (!res.ok) {
|
|
2259
2372
|
throw await LiveblocksError.from(res);
|
|
@@ -2390,7 +2503,7 @@ var Liveblocks = class {
|
|
|
2390
2503
|
"Content-Type": params.file.type,
|
|
2391
2504
|
"Content-Length": String(params.file.size)
|
|
2392
2505
|
},
|
|
2393
|
-
signal: _optionalChain([options, 'optionalAccess',
|
|
2506
|
+
signal: _optionalChain([options, 'optionalAccess', _54 => _54.signal])
|
|
2394
2507
|
}
|
|
2395
2508
|
);
|
|
2396
2509
|
if (!res.ok) {
|
|
@@ -2766,7 +2879,7 @@ var WHITESPACE_REGEX = /\s/;
|
|
|
2766
2879
|
var MarkedCustomTokenizer = class extends _marked.Tokenizer {
|
|
2767
2880
|
url(src) {
|
|
2768
2881
|
const token = super.url(src);
|
|
2769
|
-
if (_optionalChain([token, 'optionalAccess',
|
|
2882
|
+
if (_optionalChain([token, 'optionalAccess', _55 => _55.href, 'access', _56 => _56.startsWith, 'call', _57 => _57("mailto:")])) {
|
|
2770
2883
|
return void 0;
|
|
2771
2884
|
}
|
|
2772
2885
|
return token;
|
|
@@ -2946,7 +3059,7 @@ function tokensToCommentBodyInlines(tokens, formatting = {}) {
|
|
|
2946
3059
|
case "escape":
|
|
2947
3060
|
case "html":
|
|
2948
3061
|
case "text": {
|
|
2949
|
-
if (token.type === "text" && _optionalChain([token, 'access',
|
|
3062
|
+
if (token.type === "text" && _optionalChain([token, 'access', _58 => _58.tokens, 'optionalAccess', _59 => _59.length])) {
|
|
2950
3063
|
appendFormattedInlinesFromTokens(inlines, token.tokens, formatting);
|
|
2951
3064
|
} else {
|
|
2952
3065
|
appendTextWithMentions(inlines, token.text, formatting);
|