@liveblocks/node 3.22.0 → 3.23.0-file1
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 +242 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +15 -3
- package/dist/index.d.ts +15 -3
- package/dist/index.js +215 -5
- 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.
|
|
6
|
+
var PKG_VERSION = "3.23.0-file1";
|
|
7
7
|
var PKG_FORMAT = "cjs";
|
|
8
8
|
|
|
9
9
|
// src/client.ts
|
|
@@ -25,6 +25,11 @@ var PKG_FORMAT = "cjs";
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
|
|
28
33
|
|
|
29
34
|
|
|
30
35
|
|
|
@@ -64,8 +69,8 @@ var LineStream = class extends TransformStream {
|
|
|
64
69
|
constructor() {
|
|
65
70
|
let buffer = "";
|
|
66
71
|
super({
|
|
67
|
-
transform(
|
|
68
|
-
buffer +=
|
|
72
|
+
transform(chunk2, controller) {
|
|
73
|
+
buffer += chunk2;
|
|
69
74
|
if (buffer.includes("\n")) {
|
|
70
75
|
const lines = buffer.split("\n");
|
|
71
76
|
for (let i = 0; i < lines.length - 1; i++) {
|
|
@@ -289,6 +294,120 @@ var Session = (_class = class {
|
|
|
289
294
|
}, _class);
|
|
290
295
|
|
|
291
296
|
// src/client.ts
|
|
297
|
+
var STORAGE_FILE_PART_SIZE = 5 * 1024 * 1024;
|
|
298
|
+
var STORAGE_FILE_RETRY_ATTEMPTS = 10;
|
|
299
|
+
var STORAGE_FILE_RETRY_DELAYS = [
|
|
300
|
+
2e3,
|
|
301
|
+
2e3,
|
|
302
|
+
2e3,
|
|
303
|
+
2e3,
|
|
304
|
+
2e3,
|
|
305
|
+
2e3,
|
|
306
|
+
2e3,
|
|
307
|
+
2e3,
|
|
308
|
+
2e3,
|
|
309
|
+
2e3
|
|
310
|
+
];
|
|
311
|
+
async function uploadStorageFile({
|
|
312
|
+
file,
|
|
313
|
+
signal,
|
|
314
|
+
abortErrorMessage,
|
|
315
|
+
uploadSingle,
|
|
316
|
+
createMultipartUpload,
|
|
317
|
+
uploadMultipartPart,
|
|
318
|
+
completeMultipartUpload,
|
|
319
|
+
abortMultipartUpload
|
|
320
|
+
}) {
|
|
321
|
+
const abortError = createAbortError(abortErrorMessage);
|
|
322
|
+
if (_optionalChain([signal, 'optionalAccess', _2 => _2.aborted])) {
|
|
323
|
+
throw abortError;
|
|
324
|
+
}
|
|
325
|
+
const handleRetryError = (err) => {
|
|
326
|
+
if (_optionalChain([signal, 'optionalAccess', _3 => _3.aborted])) {
|
|
327
|
+
throw abortError;
|
|
328
|
+
}
|
|
329
|
+
if (err instanceof LiveblocksError && err.status === 413) {
|
|
330
|
+
throw err;
|
|
331
|
+
}
|
|
332
|
+
return false;
|
|
333
|
+
};
|
|
334
|
+
if (file.size <= STORAGE_FILE_PART_SIZE) {
|
|
335
|
+
return _core.autoRetry.call(void 0,
|
|
336
|
+
uploadSingle,
|
|
337
|
+
STORAGE_FILE_RETRY_ATTEMPTS,
|
|
338
|
+
STORAGE_FILE_RETRY_DELAYS,
|
|
339
|
+
handleRetryError
|
|
340
|
+
);
|
|
341
|
+
}
|
|
342
|
+
let uploadId;
|
|
343
|
+
const uploadedParts = [];
|
|
344
|
+
const multipartUpload = await _core.autoRetry.call(void 0,
|
|
345
|
+
createMultipartUpload,
|
|
346
|
+
STORAGE_FILE_RETRY_ATTEMPTS,
|
|
347
|
+
STORAGE_FILE_RETRY_DELAYS,
|
|
348
|
+
handleRetryError
|
|
349
|
+
);
|
|
350
|
+
try {
|
|
351
|
+
uploadId = multipartUpload.uploadId;
|
|
352
|
+
if (_optionalChain([signal, 'optionalAccess', _4 => _4.aborted])) {
|
|
353
|
+
throw abortError;
|
|
354
|
+
}
|
|
355
|
+
const batches = _core.chunk.call(void 0, splitStorageFileIntoParts(file), 5);
|
|
356
|
+
for (const parts of batches) {
|
|
357
|
+
const uploadedPartPromises = [];
|
|
358
|
+
for (const { part, partNumber } of parts) {
|
|
359
|
+
uploadedPartPromises.push(
|
|
360
|
+
_core.autoRetry.call(void 0,
|
|
361
|
+
() => uploadMultipartPart(multipartUpload.uploadId, partNumber, part),
|
|
362
|
+
STORAGE_FILE_RETRY_ATTEMPTS,
|
|
363
|
+
STORAGE_FILE_RETRY_DELAYS,
|
|
364
|
+
handleRetryError
|
|
365
|
+
)
|
|
366
|
+
);
|
|
367
|
+
}
|
|
368
|
+
uploadedParts.push(...await Promise.all(uploadedPartPromises));
|
|
369
|
+
}
|
|
370
|
+
if (_optionalChain([signal, 'optionalAccess', _5 => _5.aborted])) {
|
|
371
|
+
throw abortError;
|
|
372
|
+
}
|
|
373
|
+
return completeMultipartUpload(
|
|
374
|
+
multipartUpload.uploadId,
|
|
375
|
+
uploadedParts.sort((a, b) => a.partNumber - b.partNumber)
|
|
376
|
+
);
|
|
377
|
+
} catch (err) {
|
|
378
|
+
if (uploadId && isAbortOrTimeoutError(err)) {
|
|
379
|
+
try {
|
|
380
|
+
await abortMultipartUpload(uploadId);
|
|
381
|
+
} catch (e2) {
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
throw err;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
function splitStorageFileIntoParts(file) {
|
|
388
|
+
const parts = [];
|
|
389
|
+
let start = 0;
|
|
390
|
+
while (start < file.size) {
|
|
391
|
+
const end = Math.min(start + STORAGE_FILE_PART_SIZE, file.size);
|
|
392
|
+
parts.push({
|
|
393
|
+
partNumber: parts.length + 1,
|
|
394
|
+
part: file.slice(start, end)
|
|
395
|
+
});
|
|
396
|
+
start = end;
|
|
397
|
+
}
|
|
398
|
+
return parts;
|
|
399
|
+
}
|
|
400
|
+
function isAbortOrTimeoutError(err) {
|
|
401
|
+
return err instanceof Error && (err.name === "AbortError" || err.name === "TimeoutError");
|
|
402
|
+
}
|
|
403
|
+
function createAbortError(message) {
|
|
404
|
+
if (typeof DOMException === "function") {
|
|
405
|
+
return new DOMException(message, "AbortError");
|
|
406
|
+
}
|
|
407
|
+
const err = new Error(message);
|
|
408
|
+
err.name = "AbortError";
|
|
409
|
+
return err;
|
|
410
|
+
}
|
|
292
411
|
function inflateRoomData(room) {
|
|
293
412
|
const createdAt = new Date(room.createdAt);
|
|
294
413
|
const lastConnectionAt = room.lastConnectionAt ? new Date(room.lastConnectionAt) : void 0;
|
|
@@ -359,8 +478,8 @@ var Liveblocks = class {
|
|
|
359
478
|
this.#baseUrl = new URL(getBaseUrl(options.baseUrl));
|
|
360
479
|
this.#localDev = !!options.baseUrl && /^https?:\/\/localhost[:/]/.test(options.baseUrl);
|
|
361
480
|
}
|
|
362
|
-
async #post(path, json, options) {
|
|
363
|
-
const url3 = _core.urljoin.call(void 0, this.#baseUrl, path);
|
|
481
|
+
async #post(path, json, options, params) {
|
|
482
|
+
const url3 = _core.urljoin.call(void 0, this.#baseUrl, path, params);
|
|
364
483
|
const headers = {
|
|
365
484
|
Authorization: `Bearer ${this.#secret}`,
|
|
366
485
|
"Content-Type": "application/json"
|
|
@@ -370,11 +489,17 @@ var Liveblocks = class {
|
|
|
370
489
|
method: "POST",
|
|
371
490
|
headers,
|
|
372
491
|
body: JSON.stringify(json),
|
|
373
|
-
signal: _optionalChain([options, 'optionalAccess',
|
|
492
|
+
signal: _optionalChain([options, 'optionalAccess', _6 => _6.signal])
|
|
374
493
|
});
|
|
375
494
|
xwarn(res, "POST", path);
|
|
376
495
|
return res;
|
|
377
496
|
}
|
|
497
|
+
async #readJsonResponse(res) {
|
|
498
|
+
if (!res.ok) {
|
|
499
|
+
throw await LiveblocksError.from(res);
|
|
500
|
+
}
|
|
501
|
+
return await res.json();
|
|
502
|
+
}
|
|
378
503
|
async #patch(path, json, options) {
|
|
379
504
|
const url3 = _core.urljoin.call(void 0, this.#baseUrl, path);
|
|
380
505
|
const headers = {
|
|
@@ -386,7 +511,7 @@ var Liveblocks = class {
|
|
|
386
511
|
method: "PATCH",
|
|
387
512
|
headers,
|
|
388
513
|
body: JSON.stringify(json),
|
|
389
|
-
signal: _optionalChain([options, 'optionalAccess',
|
|
514
|
+
signal: _optionalChain([options, 'optionalAccess', _7 => _7.signal])
|
|
390
515
|
});
|
|
391
516
|
xwarn(res, "PATCH", path);
|
|
392
517
|
return res;
|
|
@@ -402,7 +527,23 @@ var Liveblocks = class {
|
|
|
402
527
|
method: "PUT",
|
|
403
528
|
headers,
|
|
404
529
|
body,
|
|
405
|
-
signal: _optionalChain([options, 'optionalAccess',
|
|
530
|
+
signal: _optionalChain([options, 'optionalAccess', _8 => _8.signal])
|
|
531
|
+
});
|
|
532
|
+
xwarn(res, "PUT", path);
|
|
533
|
+
return res;
|
|
534
|
+
}
|
|
535
|
+
async #putBlob(path, body, params, options) {
|
|
536
|
+
const url3 = _core.urljoin.call(void 0, this.#baseUrl, path, params);
|
|
537
|
+
const headers = {
|
|
538
|
+
Authorization: `Bearer ${this.#secret}`,
|
|
539
|
+
"Content-Type": "application/octet-stream"
|
|
540
|
+
};
|
|
541
|
+
const fetch = await fetchPolyfill();
|
|
542
|
+
const res = await fetch(url3, {
|
|
543
|
+
method: "PUT",
|
|
544
|
+
headers,
|
|
545
|
+
body,
|
|
546
|
+
signal: _optionalChain([options, 'optionalAccess', _9 => _9.signal])
|
|
406
547
|
});
|
|
407
548
|
xwarn(res, "PUT", path);
|
|
408
549
|
return res;
|
|
@@ -416,7 +557,7 @@ var Liveblocks = class {
|
|
|
416
557
|
const res = await fetch(url3, {
|
|
417
558
|
method: "DELETE",
|
|
418
559
|
headers,
|
|
419
|
-
signal: _optionalChain([options, 'optionalAccess',
|
|
560
|
+
signal: _optionalChain([options, 'optionalAccess', _10 => _10.signal])
|
|
420
561
|
});
|
|
421
562
|
xwarn(res, "DELETE", path);
|
|
422
563
|
return res;
|
|
@@ -430,7 +571,7 @@ var Liveblocks = class {
|
|
|
430
571
|
const res = await fetch(url3, {
|
|
431
572
|
method: "GET",
|
|
432
573
|
headers,
|
|
433
|
-
signal: _optionalChain([options, 'optionalAccess',
|
|
574
|
+
signal: _optionalChain([options, 'optionalAccess', _11 => _11.signal])
|
|
434
575
|
});
|
|
435
576
|
xwarn(res, "GET", path);
|
|
436
577
|
return res;
|
|
@@ -461,8 +602,8 @@ var Liveblocks = class {
|
|
|
461
602
|
return new Session(
|
|
462
603
|
this.#post.bind(this),
|
|
463
604
|
userId,
|
|
464
|
-
_optionalChain([options, 'optionalAccess',
|
|
465
|
-
_nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
605
|
+
_optionalChain([options, 'optionalAccess', _12 => _12.userInfo]),
|
|
606
|
+
_nullishCoalesce(_optionalChain([options, 'optionalAccess', _13 => _13.organizationId]), () => ( _optionalChain([options, 'optionalAccess', _14 => _14.tenantId]))),
|
|
466
607
|
this.#localDev
|
|
467
608
|
);
|
|
468
609
|
}
|
|
@@ -512,7 +653,7 @@ var Liveblocks = class {
|
|
|
512
653
|
const body = {
|
|
513
654
|
userId,
|
|
514
655
|
groupIds,
|
|
515
|
-
userInfo: _optionalChain([options, 'optionalAccess',
|
|
656
|
+
userInfo: _optionalChain([options, 'optionalAccess', _15 => _15.userInfo])
|
|
516
657
|
};
|
|
517
658
|
if (organizationId !== void 0) {
|
|
518
659
|
body.organizationId = organizationId;
|
|
@@ -598,7 +739,7 @@ var Liveblocks = class {
|
|
|
598
739
|
*/
|
|
599
740
|
async *iterRooms(criteria, options) {
|
|
600
741
|
const { signal } = _nullishCoalesce(options, () => ( {}));
|
|
601
|
-
const pageSize = _core.checkBounds.call(void 0, "pageSize", _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
742
|
+
const pageSize = _core.checkBounds.call(void 0, "pageSize", _nullishCoalesce(_optionalChain([options, 'optionalAccess', _16 => _16.pageSize]), () => ( 40)), 20);
|
|
602
743
|
let cursor = void 0;
|
|
603
744
|
while (true) {
|
|
604
745
|
const { nextCursor, data } = await this.getRooms(
|
|
@@ -648,7 +789,7 @@ var Liveblocks = class {
|
|
|
648
789
|
body.organizationId = tenantId;
|
|
649
790
|
}
|
|
650
791
|
const res = await this.#post(
|
|
651
|
-
_optionalChain([options, 'optionalAccess',
|
|
792
|
+
_optionalChain([options, 'optionalAccess', _17 => _17.idempotent]) ? _core.url`/v2/rooms?idempotent` : _core.url`/v2/rooms`,
|
|
652
793
|
body,
|
|
653
794
|
options
|
|
654
795
|
);
|
|
@@ -1184,7 +1325,7 @@ var Liveblocks = class {
|
|
|
1184
1325
|
_core.url`/v2/rooms/${roomId}/threads/${threadId}/comments`,
|
|
1185
1326
|
{
|
|
1186
1327
|
...data,
|
|
1187
|
-
createdAt: _optionalChain([data, 'access',
|
|
1328
|
+
createdAt: _optionalChain([data, 'access', _18 => _18.createdAt, 'optionalAccess', _19 => _19.toISOString, 'call', _20 => _20()])
|
|
1188
1329
|
},
|
|
1189
1330
|
options
|
|
1190
1331
|
);
|
|
@@ -1210,7 +1351,7 @@ var Liveblocks = class {
|
|
|
1210
1351
|
_core.url`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}`,
|
|
1211
1352
|
{
|
|
1212
1353
|
body: data.body,
|
|
1213
|
-
editedAt: _optionalChain([data, 'access',
|
|
1354
|
+
editedAt: _optionalChain([data, 'access', _21 => _21.editedAt, 'optionalAccess', _22 => _22.toISOString, 'call', _23 => _23()]),
|
|
1214
1355
|
metadata: data.metadata
|
|
1215
1356
|
},
|
|
1216
1357
|
options
|
|
@@ -1258,6 +1399,73 @@ var Liveblocks = class {
|
|
|
1258
1399
|
}
|
|
1259
1400
|
return await res.json();
|
|
1260
1401
|
}
|
|
1402
|
+
async uploadFile(params, options) {
|
|
1403
|
+
const { roomId, file } = params;
|
|
1404
|
+
const fileId = _core.createStorageFileId.call(void 0, );
|
|
1405
|
+
const fileData = await uploadStorageFile({
|
|
1406
|
+
file,
|
|
1407
|
+
signal: _optionalChain([options, 'optionalAccess', _24 => _24.signal]),
|
|
1408
|
+
abortErrorMessage: `Upload of file ${fileId} was aborted.`,
|
|
1409
|
+
uploadSingle: async () => {
|
|
1410
|
+
const res = await this.#putBlob(
|
|
1411
|
+
_core.url`/v2/rooms/${roomId}/storage/files/${fileId}/upload/${file.name}`,
|
|
1412
|
+
file,
|
|
1413
|
+
{ fileSize: file.size },
|
|
1414
|
+
options
|
|
1415
|
+
);
|
|
1416
|
+
return await this.#readJsonResponse(res);
|
|
1417
|
+
},
|
|
1418
|
+
createMultipartUpload: async () => {
|
|
1419
|
+
const res = await this.#post(
|
|
1420
|
+
_core.url`/v2/rooms/${roomId}/storage/files/${fileId}/multipart/${file.name}`,
|
|
1421
|
+
void 0,
|
|
1422
|
+
options,
|
|
1423
|
+
{ fileSize: file.size }
|
|
1424
|
+
);
|
|
1425
|
+
return await this.#readJsonResponse(res);
|
|
1426
|
+
},
|
|
1427
|
+
uploadMultipartPart: async (uploadId, partNumber, part) => {
|
|
1428
|
+
const res = await this.#putBlob(
|
|
1429
|
+
_core.url`/v2/rooms/${roomId}/storage/files/${fileId}/multipart/${uploadId}/${String(partNumber)}`,
|
|
1430
|
+
part,
|
|
1431
|
+
void 0,
|
|
1432
|
+
options
|
|
1433
|
+
);
|
|
1434
|
+
return await this.#readJsonResponse(res);
|
|
1435
|
+
},
|
|
1436
|
+
completeMultipartUpload: async (uploadId, parts) => {
|
|
1437
|
+
const res = await this.#post(
|
|
1438
|
+
_core.url`/v2/rooms/${roomId}/storage/files/${fileId}/multipart/${uploadId}/complete`,
|
|
1439
|
+
{ parts },
|
|
1440
|
+
options
|
|
1441
|
+
);
|
|
1442
|
+
return await this.#readJsonResponse(res);
|
|
1443
|
+
},
|
|
1444
|
+
abortMultipartUpload: async (uploadId) => {
|
|
1445
|
+
const res = await this.#delete(
|
|
1446
|
+
_core.url`/v2/rooms/${roomId}/storage/files/${fileId}/multipart/${uploadId}`
|
|
1447
|
+
);
|
|
1448
|
+
if (!res.ok) {
|
|
1449
|
+
throw await LiveblocksError.from(res);
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
});
|
|
1453
|
+
return new (0, _core.LiveFile)(fileData);
|
|
1454
|
+
}
|
|
1455
|
+
async getFileUrl(params, options) {
|
|
1456
|
+
const { roomId, file } = params;
|
|
1457
|
+
const fileId = _core.getLiveFileId.call(void 0, file);
|
|
1458
|
+
const res = await this.#get(
|
|
1459
|
+
_core.url`/v2/rooms/${roomId}/storage/files/${fileId}`,
|
|
1460
|
+
void 0,
|
|
1461
|
+
options
|
|
1462
|
+
);
|
|
1463
|
+
const storageFile = await this.#readJsonResponse(res);
|
|
1464
|
+
return {
|
|
1465
|
+
url: storageFile.url,
|
|
1466
|
+
expiresAt: storageFile.expiresAt
|
|
1467
|
+
};
|
|
1468
|
+
}
|
|
1261
1469
|
/**
|
|
1262
1470
|
* Creates a new thread. The thread will be created with the specified comment as its first comment.
|
|
1263
1471
|
* If the thread already exists, a `LiveblocksError` will be thrown with status code 409.
|
|
@@ -1278,7 +1486,7 @@ var Liveblocks = class {
|
|
|
1278
1486
|
...data,
|
|
1279
1487
|
comment: {
|
|
1280
1488
|
...data.comment,
|
|
1281
|
-
createdAt: _optionalChain([data, 'access',
|
|
1489
|
+
createdAt: _optionalChain([data, 'access', _25 => _25.comment, 'access', _26 => _26.createdAt, 'optionalAccess', _27 => _27.toISOString, 'call', _28 => _28()])
|
|
1282
1490
|
}
|
|
1283
1491
|
},
|
|
1284
1492
|
options
|
|
@@ -1401,7 +1609,7 @@ var Liveblocks = class {
|
|
|
1401
1609
|
_core.url`/v2/rooms/${roomId}/threads/${threadId}/metadata`,
|
|
1402
1610
|
{
|
|
1403
1611
|
...data,
|
|
1404
|
-
updatedAt: _optionalChain([data, 'access',
|
|
1612
|
+
updatedAt: _optionalChain([data, 'access', _29 => _29.updatedAt, 'optionalAccess', _30 => _30.toISOString, 'call', _31 => _31()])
|
|
1405
1613
|
},
|
|
1406
1614
|
options
|
|
1407
1615
|
);
|
|
@@ -1427,7 +1635,7 @@ var Liveblocks = class {
|
|
|
1427
1635
|
_core.url`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}/metadata`,
|
|
1428
1636
|
{
|
|
1429
1637
|
...data,
|
|
1430
|
-
updatedAt: _optionalChain([data, 'access',
|
|
1638
|
+
updatedAt: _optionalChain([data, 'access', _32 => _32.updatedAt, 'optionalAccess', _33 => _33.toISOString, 'call', _34 => _34()])
|
|
1431
1639
|
},
|
|
1432
1640
|
options
|
|
1433
1641
|
);
|
|
@@ -1453,7 +1661,7 @@ var Liveblocks = class {
|
|
|
1453
1661
|
_core.url`/v2/rooms/${roomId}/threads/${threadId}/comments/${commentId}/add-reaction`,
|
|
1454
1662
|
{
|
|
1455
1663
|
...data,
|
|
1456
|
-
createdAt: _optionalChain([data, 'access',
|
|
1664
|
+
createdAt: _optionalChain([data, 'access', _35 => _35.createdAt, 'optionalAccess', _36 => _36.toISOString, 'call', _37 => _37()])
|
|
1457
1665
|
},
|
|
1458
1666
|
options
|
|
1459
1667
|
);
|
|
@@ -1479,7 +1687,7 @@ var Liveblocks = class {
|
|
|
1479
1687
|
_core.url`/v2/rooms/${roomId}/threads/${threadId}/comments/${params.commentId}/remove-reaction`,
|
|
1480
1688
|
{
|
|
1481
1689
|
...data,
|
|
1482
|
-
removedAt: _optionalChain([data, 'access',
|
|
1690
|
+
removedAt: _optionalChain([data, 'access', _38 => _38.removedAt, 'optionalAccess', _39 => _39.toISOString, 'call', _40 => _40()])
|
|
1483
1691
|
},
|
|
1484
1692
|
options
|
|
1485
1693
|
);
|
|
@@ -1560,7 +1768,7 @@ var Liveblocks = class {
|
|
|
1560
1768
|
*/
|
|
1561
1769
|
async *iterInboxNotifications(criteria, options) {
|
|
1562
1770
|
const { signal } = _nullishCoalesce(options, () => ( {}));
|
|
1563
|
-
const pageSize = _core.checkBounds.call(void 0, "pageSize", _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
1771
|
+
const pageSize = _core.checkBounds.call(void 0, "pageSize", _nullishCoalesce(_optionalChain([options, 'optionalAccess', _41 => _41.pageSize]), () => ( 50)), 10);
|
|
1564
1772
|
let cursor = void 0;
|
|
1565
1773
|
while (true) {
|
|
1566
1774
|
const { nextCursor, data } = await this.getInboxNotifications(
|
|
@@ -1907,7 +2115,7 @@ var Liveblocks = class {
|
|
|
1907
2115
|
async getGroups(params, options) {
|
|
1908
2116
|
const res = await this.#get(
|
|
1909
2117
|
_core.url`/v2/groups`,
|
|
1910
|
-
{ startingAfter: _optionalChain([params, 'optionalAccess',
|
|
2118
|
+
{ startingAfter: _optionalChain([params, 'optionalAccess', _42 => _42.startingAfter]), limit: _optionalChain([params, 'optionalAccess', _43 => _43.limit]) },
|
|
1911
2119
|
options
|
|
1912
2120
|
);
|
|
1913
2121
|
if (!res.ok) {
|
|
@@ -1969,7 +2177,7 @@ var Liveblocks = class {
|
|
|
1969
2177
|
async massMutateStorage(criteria, callback, massOptions) {
|
|
1970
2178
|
const concurrency = _core.checkBounds.call(void 0,
|
|
1971
2179
|
"concurrency",
|
|
1972
|
-
_nullishCoalesce(_optionalChain([massOptions, 'optionalAccess',
|
|
2180
|
+
_nullishCoalesce(_optionalChain([massOptions, 'optionalAccess', _44 => _44.concurrency]), () => ( 8)),
|
|
1973
2181
|
1,
|
|
1974
2182
|
20
|
|
1975
2183
|
);
|
|
@@ -1985,7 +2193,7 @@ var Liveblocks = class {
|
|
|
1985
2193
|
}
|
|
1986
2194
|
async #_mutateOneRoom(roomId, room, callback, options) {
|
|
1987
2195
|
const debounceInterval = 200;
|
|
1988
|
-
const { signal, abort } = _core.makeAbortController.call(void 0, _optionalChain([options, 'optionalAccess',
|
|
2196
|
+
const { signal, abort } = _core.makeAbortController.call(void 0, _optionalChain([options, 'optionalAccess', _45 => _45.signal]));
|
|
1989
2197
|
let opsBuffer = [];
|
|
1990
2198
|
let outstandingFlush$ = void 0;
|
|
1991
2199
|
let lastFlush = performance.now();
|
|
@@ -2051,7 +2259,7 @@ var Liveblocks = class {
|
|
|
2051
2259
|
const res = await this.#post(
|
|
2052
2260
|
_core.url`/v2/rooms/${roomId}/send-message`,
|
|
2053
2261
|
{ messages },
|
|
2054
|
-
{ signal: _optionalChain([options, 'optionalAccess',
|
|
2262
|
+
{ signal: _optionalChain([options, 'optionalAccess', _46 => _46.signal]) }
|
|
2055
2263
|
);
|
|
2056
2264
|
if (!res.ok) {
|
|
2057
2265
|
throw await LiveblocksError.from(res);
|
|
@@ -2188,7 +2396,7 @@ var Liveblocks = class {
|
|
|
2188
2396
|
"Content-Type": params.file.type,
|
|
2189
2397
|
"Content-Length": String(params.file.size)
|
|
2190
2398
|
},
|
|
2191
|
-
signal: _optionalChain([options, 'optionalAccess',
|
|
2399
|
+
signal: _optionalChain([options, 'optionalAccess', _47 => _47.signal])
|
|
2192
2400
|
}
|
|
2193
2401
|
);
|
|
2194
2402
|
if (!res.ok) {
|
|
@@ -2535,7 +2743,7 @@ ${this.details}`;
|
|
|
2535
2743
|
let text;
|
|
2536
2744
|
try {
|
|
2537
2745
|
text = await res.text();
|
|
2538
|
-
} catch (
|
|
2746
|
+
} catch (e3) {
|
|
2539
2747
|
text = FALLBACK;
|
|
2540
2748
|
}
|
|
2541
2749
|
const obj = _nullishCoalesce(_core.tryParseJson.call(void 0, text), () => ( { message: text }));
|
|
@@ -2564,7 +2772,7 @@ var WHITESPACE_REGEX = /\s/;
|
|
|
2564
2772
|
var MarkedCustomTokenizer = class extends _marked.Tokenizer {
|
|
2565
2773
|
url(src) {
|
|
2566
2774
|
const token = super.url(src);
|
|
2567
|
-
if (_optionalChain([token, 'optionalAccess',
|
|
2775
|
+
if (_optionalChain([token, 'optionalAccess', _48 => _48.href, 'access', _49 => _49.startsWith, 'call', _50 => _50("mailto:")])) {
|
|
2568
2776
|
return void 0;
|
|
2569
2777
|
}
|
|
2570
2778
|
return token;
|
|
@@ -2744,7 +2952,7 @@ function tokensToCommentBodyInlines(tokens, formatting = {}) {
|
|
|
2744
2952
|
case "escape":
|
|
2745
2953
|
case "html":
|
|
2746
2954
|
case "text": {
|
|
2747
|
-
if (token.type === "text" && _optionalChain([token, 'access',
|
|
2955
|
+
if (token.type === "text" && _optionalChain([token, 'access', _51 => _51.tokens, 'optionalAccess', _52 => _52.length])) {
|
|
2748
2956
|
appendFormattedInlinesFromTokens(inlines, token.tokens, formatting);
|
|
2749
2957
|
} else {
|
|
2750
2958
|
appendTextWithMentions(inlines, token.text, formatting);
|
|
@@ -3083,6 +3291,7 @@ function isCustomNotificationEvent(event) {
|
|
|
3083
3291
|
|
|
3084
3292
|
|
|
3085
3293
|
|
|
3294
|
+
|
|
3086
3295
|
_core.detectDupes.call(void 0, PKG_NAME, PKG_VERSION, PKG_FORMAT);
|
|
3087
3296
|
|
|
3088
3297
|
|
|
@@ -3098,5 +3307,6 @@ _core.detectDupes.call(void 0, PKG_NAME, PKG_VERSION, PKG_FORMAT);
|
|
|
3098
3307
|
|
|
3099
3308
|
|
|
3100
3309
|
|
|
3101
|
-
|
|
3310
|
+
|
|
3311
|
+
exports.LiveFile = _core.LiveFile; exports.LiveList = _core.LiveList; exports.LiveMap = _core.LiveMap; exports.LiveObject = _core.LiveObject; exports.Liveblocks = Liveblocks; exports.LiveblocksError = LiveblocksError; exports.WebhookHandler = WebhookHandler; exports.getMentionsFromCommentBody = _core.getMentionsFromCommentBody; exports.isCustomNotificationEvent = isCustomNotificationEvent; exports.isNotificationChannelEnabled = _core.isNotificationChannelEnabled; exports.isTextMentionNotificationEvent = isTextMentionNotificationEvent; exports.isThreadNotificationEvent = isThreadNotificationEvent; exports.markdownToCommentBody = markdownToCommentBody; exports.stringifyCommentBody = _core.stringifyCommentBody;
|
|
3102
3312
|
//# sourceMappingURL=index.cjs.map
|