@liveblocks/core 2.2.3-alpha1 → 2.3.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.d.mts +42 -32
- package/dist/index.d.ts +42 -32
- package/dist/index.js +133 -114
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +62 -43
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ var __export = (target, all) => {
|
|
|
6
6
|
|
|
7
7
|
// src/version.ts
|
|
8
8
|
var PKG_NAME = "@liveblocks/core";
|
|
9
|
-
var PKG_VERSION = "2.
|
|
9
|
+
var PKG_VERSION = "2.3.0";
|
|
10
10
|
var PKG_FORMAT = "cjs";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -645,7 +645,9 @@ function memoizeOnSuccess(factoryFn) {
|
|
|
645
645
|
return () => {
|
|
646
646
|
if (cached === null) {
|
|
647
647
|
cached = factoryFn().catch((err) => {
|
|
648
|
-
|
|
648
|
+
setTimeout(() => {
|
|
649
|
+
cached = null;
|
|
650
|
+
}, 5e3);
|
|
649
651
|
throw err;
|
|
650
652
|
});
|
|
651
653
|
}
|
|
@@ -1776,15 +1778,13 @@ function stringify(object, ...args) {
|
|
|
1776
1778
|
|
|
1777
1779
|
// src/lib/batch.ts
|
|
1778
1780
|
var DEFAULT_SIZE = 50;
|
|
1779
|
-
var DEFAULT_DELAY = 100;
|
|
1780
|
-
var noop = () => {
|
|
1781
|
-
};
|
|
1782
1781
|
var BatchCall = class {
|
|
1783
|
-
constructor(
|
|
1784
|
-
this.
|
|
1785
|
-
|
|
1786
|
-
this.promise =
|
|
1787
|
-
this.
|
|
1782
|
+
constructor(input) {
|
|
1783
|
+
this.input = input;
|
|
1784
|
+
const { promise, resolve, reject } = Promise_withResolvers();
|
|
1785
|
+
this.promise = promise;
|
|
1786
|
+
this.resolve = resolve;
|
|
1787
|
+
this.reject = reject;
|
|
1788
1788
|
}
|
|
1789
1789
|
};
|
|
1790
1790
|
var Batch = class {
|
|
@@ -1792,8 +1792,8 @@ var Batch = class {
|
|
|
1792
1792
|
this.queue = [];
|
|
1793
1793
|
this.error = false;
|
|
1794
1794
|
this.callback = callback;
|
|
1795
|
-
this.size = _nullishCoalesce(
|
|
1796
|
-
this.delay =
|
|
1795
|
+
this.size = _nullishCoalesce(options.size, () => ( DEFAULT_SIZE));
|
|
1796
|
+
this.delay = options.delay;
|
|
1797
1797
|
}
|
|
1798
1798
|
clearDelayTimeout() {
|
|
1799
1799
|
if (this.delayTimeoutId !== void 0) {
|
|
@@ -1814,12 +1814,12 @@ var Batch = class {
|
|
|
1814
1814
|
return;
|
|
1815
1815
|
}
|
|
1816
1816
|
const calls = this.queue.splice(0);
|
|
1817
|
-
const
|
|
1817
|
+
const inputs = calls.map((call) => call.input);
|
|
1818
1818
|
try {
|
|
1819
|
-
const results = await this.callback(
|
|
1819
|
+
const results = await this.callback(inputs);
|
|
1820
1820
|
this.error = false;
|
|
1821
1821
|
calls.forEach((call, index) => {
|
|
1822
|
-
const result = _optionalChain([results, 'optionalAccess',
|
|
1822
|
+
const result = _optionalChain([results, 'optionalAccess', _44 => _44[index]]);
|
|
1823
1823
|
if (!Array.isArray(results)) {
|
|
1824
1824
|
call.reject(new Error("Callback must return an array."));
|
|
1825
1825
|
} else if (calls.length !== results.length) {
|
|
@@ -1841,18 +1841,14 @@ var Batch = class {
|
|
|
1841
1841
|
});
|
|
1842
1842
|
}
|
|
1843
1843
|
}
|
|
1844
|
-
get(
|
|
1844
|
+
get(input) {
|
|
1845
1845
|
const existingCall = this.queue.find(
|
|
1846
|
-
(call2) => stringify(call2.
|
|
1846
|
+
(call2) => stringify(call2.input) === stringify(input)
|
|
1847
1847
|
);
|
|
1848
1848
|
if (existingCall) {
|
|
1849
1849
|
return existingCall.promise;
|
|
1850
1850
|
}
|
|
1851
|
-
const call = new BatchCall(
|
|
1852
|
-
call.promise = new Promise((resolve, reject) => {
|
|
1853
|
-
call.resolve = resolve;
|
|
1854
|
-
call.reject = reject;
|
|
1855
|
-
});
|
|
1851
|
+
const call = new BatchCall(input);
|
|
1856
1852
|
this.queue.push(call);
|
|
1857
1853
|
this.schedule();
|
|
1858
1854
|
return call.promise;
|
|
@@ -1871,21 +1867,17 @@ function createBatchStore(callback, options) {
|
|
|
1871
1867
|
return stringify(args);
|
|
1872
1868
|
}
|
|
1873
1869
|
function setStateAndNotify(cacheKey, state) {
|
|
1874
|
-
|
|
1875
|
-
|
|
1876
|
-
} else {
|
|
1877
|
-
cache.delete(cacheKey);
|
|
1878
|
-
}
|
|
1879
|
-
eventSource2.notify(state);
|
|
1870
|
+
cache.set(cacheKey, state);
|
|
1871
|
+
eventSource2.notify();
|
|
1880
1872
|
}
|
|
1881
|
-
async function get(
|
|
1882
|
-
const cacheKey = getCacheKey(
|
|
1873
|
+
async function get(input) {
|
|
1874
|
+
const cacheKey = getCacheKey(input);
|
|
1883
1875
|
if (cache.has(cacheKey)) {
|
|
1884
1876
|
return;
|
|
1885
1877
|
}
|
|
1886
1878
|
try {
|
|
1887
1879
|
setStateAndNotify(cacheKey, { isLoading: true });
|
|
1888
|
-
const result = await batch.get(
|
|
1880
|
+
const result = await batch.get(input);
|
|
1889
1881
|
setStateAndNotify(cacheKey, { isLoading: false, data: result });
|
|
1890
1882
|
} catch (error3) {
|
|
1891
1883
|
setStateAndNotify(cacheKey, {
|
|
@@ -1894,12 +1886,12 @@ function createBatchStore(callback, options) {
|
|
|
1894
1886
|
});
|
|
1895
1887
|
}
|
|
1896
1888
|
}
|
|
1897
|
-
function getState(
|
|
1898
|
-
const cacheKey = getCacheKey(
|
|
1889
|
+
function getState(input) {
|
|
1890
|
+
const cacheKey = getCacheKey(input);
|
|
1899
1891
|
return cache.get(cacheKey);
|
|
1900
1892
|
}
|
|
1901
1893
|
return {
|
|
1902
|
-
...eventSource2,
|
|
1894
|
+
...eventSource2.observable,
|
|
1903
1895
|
get,
|
|
1904
1896
|
getState
|
|
1905
1897
|
};
|
|
@@ -2055,7 +2047,7 @@ function createNotificationsApi({
|
|
|
2055
2047
|
const response = await fetcher(url.toString(), {
|
|
2056
2048
|
...options,
|
|
2057
2049
|
headers: {
|
|
2058
|
-
..._optionalChain([options, 'optionalAccess',
|
|
2050
|
+
..._optionalChain([options, 'optionalAccess', _45 => _45.headers]),
|
|
2059
2051
|
Authorization: `Bearer ${getAuthBearerHeaderFromAuthValue(authValue)}`
|
|
2060
2052
|
}
|
|
2061
2053
|
});
|
|
@@ -2088,8 +2080,8 @@ function createNotificationsApi({
|
|
|
2088
2080
|
}
|
|
2089
2081
|
async function getInboxNotifications(options) {
|
|
2090
2082
|
const json = await fetchJson("/inbox-notifications", void 0, {
|
|
2091
|
-
limit: _optionalChain([options, 'optionalAccess',
|
|
2092
|
-
since: _optionalChain([options, 'optionalAccess',
|
|
2083
|
+
limit: _optionalChain([options, 'optionalAccess', _46 => _46.limit]),
|
|
2084
|
+
since: _optionalChain([options, 'optionalAccess', _47 => _47.since, 'optionalAccess', _48 => _48.toISOString, 'call', _49 => _49()])
|
|
2093
2085
|
});
|
|
2094
2086
|
return {
|
|
2095
2087
|
threads: json.threads.map((thread) => convertToThreadData(thread)),
|
|
@@ -2140,11 +2132,26 @@ function createNotificationsApi({
|
|
|
2140
2132
|
async function markInboxNotificationAsRead(inboxNotificationId) {
|
|
2141
2133
|
await batchedMarkInboxNotificationsAsRead.get(inboxNotificationId);
|
|
2142
2134
|
}
|
|
2135
|
+
async function deleteAllInboxNotifications() {
|
|
2136
|
+
await fetchJson("/inbox-notifications", {
|
|
2137
|
+
method: "DELETE"
|
|
2138
|
+
});
|
|
2139
|
+
}
|
|
2140
|
+
async function deleteInboxNotification(inboxNotificationId) {
|
|
2141
|
+
await fetchJson(
|
|
2142
|
+
`/inbox-notifications/${encodeURIComponent(inboxNotificationId)}`,
|
|
2143
|
+
{
|
|
2144
|
+
method: "DELETE"
|
|
2145
|
+
}
|
|
2146
|
+
);
|
|
2147
|
+
}
|
|
2143
2148
|
return {
|
|
2144
2149
|
getInboxNotifications,
|
|
2145
2150
|
getUnreadInboxNotificationsCount,
|
|
2146
2151
|
markAllInboxNotificationsAsRead,
|
|
2147
|
-
markInboxNotificationAsRead
|
|
2152
|
+
markInboxNotificationAsRead,
|
|
2153
|
+
deleteAllInboxNotifications,
|
|
2154
|
+
deleteInboxNotification
|
|
2148
2155
|
};
|
|
2149
2156
|
}
|
|
2150
2157
|
|
|
@@ -2521,7 +2528,7 @@ var LiveRegister = class _LiveRegister extends AbstractCrdt {
|
|
|
2521
2528
|
return [
|
|
2522
2529
|
{
|
|
2523
2530
|
type: 8 /* CREATE_REGISTER */,
|
|
2524
|
-
opId: _optionalChain([pool, 'optionalAccess',
|
|
2531
|
+
opId: _optionalChain([pool, 'optionalAccess', _50 => _50.generateOpId, 'call', _51 => _51()]),
|
|
2525
2532
|
id: this._id,
|
|
2526
2533
|
parentId,
|
|
2527
2534
|
parentKey,
|
|
@@ -2623,7 +2630,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
2623
2630
|
const ops = [];
|
|
2624
2631
|
const op = {
|
|
2625
2632
|
id: this._id,
|
|
2626
|
-
opId: _optionalChain([pool, 'optionalAccess',
|
|
2633
|
+
opId: _optionalChain([pool, 'optionalAccess', _52 => _52.generateOpId, 'call', _53 => _53()]),
|
|
2627
2634
|
type: 2 /* CREATE_LIST */,
|
|
2628
2635
|
parentId,
|
|
2629
2636
|
parentKey
|
|
@@ -2900,7 +2907,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
2900
2907
|
_applyInsertUndoRedo(op) {
|
|
2901
2908
|
const { id, parentKey: key } = op;
|
|
2902
2909
|
const child = creationOpToLiveNode(op);
|
|
2903
|
-
if (_optionalChain([this, 'access',
|
|
2910
|
+
if (_optionalChain([this, 'access', _54 => _54._pool, 'optionalAccess', _55 => _55.getNode, 'call', _56 => _56(id)]) !== void 0) {
|
|
2904
2911
|
return { modified: false };
|
|
2905
2912
|
}
|
|
2906
2913
|
child._attach(id, nn(this._pool));
|
|
@@ -2908,8 +2915,8 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
2908
2915
|
const existingItemIndex = this._indexOfPosition(key);
|
|
2909
2916
|
let newKey = key;
|
|
2910
2917
|
if (existingItemIndex !== -1) {
|
|
2911
|
-
const before2 = _optionalChain([this, 'access',
|
|
2912
|
-
const after2 = _optionalChain([this, 'access',
|
|
2918
|
+
const before2 = _optionalChain([this, 'access', _57 => _57._items, 'access', _58 => _58[existingItemIndex], 'optionalAccess', _59 => _59._parentPos]);
|
|
2919
|
+
const after2 = _optionalChain([this, 'access', _60 => _60._items, 'access', _61 => _61[existingItemIndex + 1], 'optionalAccess', _62 => _62._parentPos]);
|
|
2913
2920
|
newKey = makePosition(before2, after2);
|
|
2914
2921
|
child._setParentLink(this, newKey);
|
|
2915
2922
|
}
|
|
@@ -2924,7 +2931,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
2924
2931
|
_applySetUndoRedo(op) {
|
|
2925
2932
|
const { id, parentKey: key } = op;
|
|
2926
2933
|
const child = creationOpToLiveNode(op);
|
|
2927
|
-
if (_optionalChain([this, 'access',
|
|
2934
|
+
if (_optionalChain([this, 'access', _63 => _63._pool, 'optionalAccess', _64 => _64.getNode, 'call', _65 => _65(id)]) !== void 0) {
|
|
2928
2935
|
return { modified: false };
|
|
2929
2936
|
}
|
|
2930
2937
|
this._unacknowledgedSets.set(key, nn(op.opId));
|
|
@@ -3046,7 +3053,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
3046
3053
|
} else {
|
|
3047
3054
|
this._items[existingItemIndex]._setParentLink(
|
|
3048
3055
|
this,
|
|
3049
|
-
makePosition(newKey, _optionalChain([this, 'access',
|
|
3056
|
+
makePosition(newKey, _optionalChain([this, 'access', _66 => _66._items, 'access', _67 => _67[existingItemIndex + 1], 'optionalAccess', _68 => _68._parentPos]))
|
|
3050
3057
|
);
|
|
3051
3058
|
const previousIndex = this._items.indexOf(child);
|
|
3052
3059
|
child._setParentLink(this, newKey);
|
|
@@ -3072,7 +3079,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
3072
3079
|
if (existingItemIndex !== -1) {
|
|
3073
3080
|
this._items[existingItemIndex]._setParentLink(
|
|
3074
3081
|
this,
|
|
3075
|
-
makePosition(newKey, _optionalChain([this, 'access',
|
|
3082
|
+
makePosition(newKey, _optionalChain([this, 'access', _69 => _69._items, 'access', _70 => _70[existingItemIndex + 1], 'optionalAccess', _71 => _71._parentPos]))
|
|
3076
3083
|
);
|
|
3077
3084
|
}
|
|
3078
3085
|
child._setParentLink(this, newKey);
|
|
@@ -3091,7 +3098,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
3091
3098
|
if (existingItemIndex !== -1) {
|
|
3092
3099
|
this._items[existingItemIndex]._setParentLink(
|
|
3093
3100
|
this,
|
|
3094
|
-
makePosition(newKey, _optionalChain([this, 'access',
|
|
3101
|
+
makePosition(newKey, _optionalChain([this, 'access', _72 => _72._items, 'access', _73 => _73[existingItemIndex + 1], 'optionalAccess', _74 => _74._parentPos]))
|
|
3095
3102
|
);
|
|
3096
3103
|
}
|
|
3097
3104
|
child._setParentLink(this, newKey);
|
|
@@ -3119,7 +3126,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
3119
3126
|
if (existingItemIndex !== -1) {
|
|
3120
3127
|
this._items[existingItemIndex]._setParentLink(
|
|
3121
3128
|
this,
|
|
3122
|
-
makePosition(newKey, _optionalChain([this, 'access',
|
|
3129
|
+
makePosition(newKey, _optionalChain([this, 'access', _75 => _75._items, 'access', _76 => _76[existingItemIndex + 1], 'optionalAccess', _77 => _77._parentPos]))
|
|
3123
3130
|
);
|
|
3124
3131
|
}
|
|
3125
3132
|
child._setParentLink(this, newKey);
|
|
@@ -3177,7 +3184,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
3177
3184
|
* @param element The element to add to the end of the LiveList.
|
|
3178
3185
|
*/
|
|
3179
3186
|
push(element) {
|
|
3180
|
-
_optionalChain([this, 'access',
|
|
3187
|
+
_optionalChain([this, 'access', _78 => _78._pool, 'optionalAccess', _79 => _79.assertStorageIsWritable, 'call', _80 => _80()]);
|
|
3181
3188
|
return this.insert(element, this.length);
|
|
3182
3189
|
}
|
|
3183
3190
|
/**
|
|
@@ -3186,7 +3193,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
3186
3193
|
* @param index The index at which you want to insert the element.
|
|
3187
3194
|
*/
|
|
3188
3195
|
insert(element, index) {
|
|
3189
|
-
_optionalChain([this, 'access',
|
|
3196
|
+
_optionalChain([this, 'access', _81 => _81._pool, 'optionalAccess', _82 => _82.assertStorageIsWritable, 'call', _83 => _83()]);
|
|
3190
3197
|
if (index < 0 || index > this._items.length) {
|
|
3191
3198
|
throw new Error(
|
|
3192
3199
|
`Cannot insert list item at index "${index}". index should be between 0 and ${this._items.length}`
|
|
@@ -3216,7 +3223,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
3216
3223
|
* @param targetIndex The index where the element should be after moving.
|
|
3217
3224
|
*/
|
|
3218
3225
|
move(index, targetIndex) {
|
|
3219
|
-
_optionalChain([this, 'access',
|
|
3226
|
+
_optionalChain([this, 'access', _84 => _84._pool, 'optionalAccess', _85 => _85.assertStorageIsWritable, 'call', _86 => _86()]);
|
|
3220
3227
|
if (targetIndex < 0) {
|
|
3221
3228
|
throw new Error("targetIndex cannot be less than 0");
|
|
3222
3229
|
}
|
|
@@ -3274,7 +3281,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
3274
3281
|
* @param index The index of the element to delete
|
|
3275
3282
|
*/
|
|
3276
3283
|
delete(index) {
|
|
3277
|
-
_optionalChain([this, 'access',
|
|
3284
|
+
_optionalChain([this, 'access', _87 => _87._pool, 'optionalAccess', _88 => _88.assertStorageIsWritable, 'call', _89 => _89()]);
|
|
3278
3285
|
if (index < 0 || index >= this._items.length) {
|
|
3279
3286
|
throw new Error(
|
|
3280
3287
|
`Cannot delete list item at index "${index}". index should be between 0 and ${this._items.length - 1}`
|
|
@@ -3307,7 +3314,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
3307
3314
|
}
|
|
3308
3315
|
}
|
|
3309
3316
|
clear() {
|
|
3310
|
-
_optionalChain([this, 'access',
|
|
3317
|
+
_optionalChain([this, 'access', _90 => _90._pool, 'optionalAccess', _91 => _91.assertStorageIsWritable, 'call', _92 => _92()]);
|
|
3311
3318
|
if (this._pool) {
|
|
3312
3319
|
const ops = [];
|
|
3313
3320
|
const reverseOps = [];
|
|
@@ -3341,7 +3348,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
3341
3348
|
}
|
|
3342
3349
|
}
|
|
3343
3350
|
set(index, item) {
|
|
3344
|
-
_optionalChain([this, 'access',
|
|
3351
|
+
_optionalChain([this, 'access', _93 => _93._pool, 'optionalAccess', _94 => _94.assertStorageIsWritable, 'call', _95 => _95()]);
|
|
3345
3352
|
if (index < 0 || index >= this._items.length) {
|
|
3346
3353
|
throw new Error(
|
|
3347
3354
|
`Cannot set list item at index "${index}". index should be between 0 and ${this._items.length - 1}`
|
|
@@ -3489,7 +3496,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
3489
3496
|
_shiftItemPosition(index, key) {
|
|
3490
3497
|
const shiftedPosition = makePosition(
|
|
3491
3498
|
key,
|
|
3492
|
-
this._items.length > index + 1 ? _optionalChain([this, 'access',
|
|
3499
|
+
this._items.length > index + 1 ? _optionalChain([this, 'access', _96 => _96._items, 'access', _97 => _97[index + 1], 'optionalAccess', _98 => _98._parentPos]) : void 0
|
|
3493
3500
|
);
|
|
3494
3501
|
this._items[index]._setParentLink(this, shiftedPosition);
|
|
3495
3502
|
}
|
|
@@ -3618,7 +3625,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
|
|
|
3618
3625
|
const ops = [];
|
|
3619
3626
|
const op = {
|
|
3620
3627
|
id: this._id,
|
|
3621
|
-
opId: _optionalChain([pool, 'optionalAccess',
|
|
3628
|
+
opId: _optionalChain([pool, 'optionalAccess', _99 => _99.generateOpId, 'call', _100 => _100()]),
|
|
3622
3629
|
type: 7 /* CREATE_MAP */,
|
|
3623
3630
|
parentId,
|
|
3624
3631
|
parentKey
|
|
@@ -3765,7 +3772,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
|
|
|
3765
3772
|
* @param value The value of the element to add. Should be serializable to JSON.
|
|
3766
3773
|
*/
|
|
3767
3774
|
set(key, value) {
|
|
3768
|
-
_optionalChain([this, 'access',
|
|
3775
|
+
_optionalChain([this, 'access', _101 => _101._pool, 'optionalAccess', _102 => _102.assertStorageIsWritable, 'call', _103 => _103()]);
|
|
3769
3776
|
const oldValue = this._map.get(key);
|
|
3770
3777
|
if (oldValue) {
|
|
3771
3778
|
oldValue._detach();
|
|
@@ -3811,7 +3818,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
|
|
|
3811
3818
|
* @returns true if an element existed and has been removed, or false if the element does not exist.
|
|
3812
3819
|
*/
|
|
3813
3820
|
delete(key) {
|
|
3814
|
-
_optionalChain([this, 'access',
|
|
3821
|
+
_optionalChain([this, 'access', _104 => _104._pool, 'optionalAccess', _105 => _105.assertStorageIsWritable, 'call', _106 => _106()]);
|
|
3815
3822
|
const item = this._map.get(key);
|
|
3816
3823
|
if (item === void 0) {
|
|
3817
3824
|
return false;
|
|
@@ -3989,7 +3996,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
|
|
|
3989
3996
|
if (this._id === void 0) {
|
|
3990
3997
|
throw new Error("Cannot serialize item is not attached");
|
|
3991
3998
|
}
|
|
3992
|
-
const opId = _optionalChain([pool, 'optionalAccess',
|
|
3999
|
+
const opId = _optionalChain([pool, 'optionalAccess', _107 => _107.generateOpId, 'call', _108 => _108()]);
|
|
3993
4000
|
const ops = [];
|
|
3994
4001
|
const op = {
|
|
3995
4002
|
type: 4 /* CREATE_OBJECT */,
|
|
@@ -4267,7 +4274,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
|
|
|
4267
4274
|
* @param value The value of the property to add
|
|
4268
4275
|
*/
|
|
4269
4276
|
set(key, value) {
|
|
4270
|
-
_optionalChain([this, 'access',
|
|
4277
|
+
_optionalChain([this, 'access', _109 => _109._pool, 'optionalAccess', _110 => _110.assertStorageIsWritable, 'call', _111 => _111()]);
|
|
4271
4278
|
this.update({ [key]: value });
|
|
4272
4279
|
}
|
|
4273
4280
|
/**
|
|
@@ -4282,7 +4289,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
|
|
|
4282
4289
|
* @param key The key of the property to delete
|
|
4283
4290
|
*/
|
|
4284
4291
|
delete(key) {
|
|
4285
|
-
_optionalChain([this, 'access',
|
|
4292
|
+
_optionalChain([this, 'access', _112 => _112._pool, 'optionalAccess', _113 => _113.assertStorageIsWritable, 'call', _114 => _114()]);
|
|
4286
4293
|
const keyAsString = key;
|
|
4287
4294
|
const oldValue = this._map.get(keyAsString);
|
|
4288
4295
|
if (oldValue === void 0) {
|
|
@@ -4335,7 +4342,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
|
|
|
4335
4342
|
* @param patch The object used to overrides properties
|
|
4336
4343
|
*/
|
|
4337
4344
|
update(patch) {
|
|
4338
|
-
_optionalChain([this, 'access',
|
|
4345
|
+
_optionalChain([this, 'access', _115 => _115._pool, 'optionalAccess', _116 => _116.assertStorageIsWritable, 'call', _117 => _117()]);
|
|
4339
4346
|
if (this._pool === void 0 || this._id === void 0) {
|
|
4340
4347
|
for (const key in patch) {
|
|
4341
4348
|
const newValue = patch[key];
|
|
@@ -5094,15 +5101,15 @@ function installBackgroundTabSpy() {
|
|
|
5094
5101
|
const doc = typeof document !== "undefined" ? document : void 0;
|
|
5095
5102
|
const inBackgroundSince = { current: null };
|
|
5096
5103
|
function onVisibilityChange() {
|
|
5097
|
-
if (_optionalChain([doc, 'optionalAccess',
|
|
5104
|
+
if (_optionalChain([doc, 'optionalAccess', _118 => _118.visibilityState]) === "hidden") {
|
|
5098
5105
|
inBackgroundSince.current = _nullishCoalesce(inBackgroundSince.current, () => ( Date.now()));
|
|
5099
5106
|
} else {
|
|
5100
5107
|
inBackgroundSince.current = null;
|
|
5101
5108
|
}
|
|
5102
5109
|
}
|
|
5103
|
-
_optionalChain([doc, 'optionalAccess',
|
|
5110
|
+
_optionalChain([doc, 'optionalAccess', _119 => _119.addEventListener, 'call', _120 => _120("visibilitychange", onVisibilityChange)]);
|
|
5104
5111
|
const unsub = () => {
|
|
5105
|
-
_optionalChain([doc, 'optionalAccess',
|
|
5112
|
+
_optionalChain([doc, 'optionalAccess', _121 => _121.removeEventListener, 'call', _122 => _122("visibilitychange", onVisibilityChange)]);
|
|
5106
5113
|
};
|
|
5107
5114
|
return [inBackgroundSince, unsub];
|
|
5108
5115
|
}
|
|
@@ -5147,13 +5154,13 @@ function createCommentsApi(roomId, getAuthValue, fetchClientApi) {
|
|
|
5147
5154
|
}
|
|
5148
5155
|
async function getThreads(options) {
|
|
5149
5156
|
let query;
|
|
5150
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
5157
|
+
if (_optionalChain([options, 'optionalAccess', _123 => _123.query])) {
|
|
5151
5158
|
query = objectToQuery(options.query);
|
|
5152
5159
|
}
|
|
5153
5160
|
const response = await fetchCommentsApi(
|
|
5154
5161
|
"/threads",
|
|
5155
5162
|
{
|
|
5156
|
-
since: _optionalChain([options, 'optionalAccess',
|
|
5163
|
+
since: _optionalChain([options, 'optionalAccess', _124 => _124.since, 'optionalAccess', _125 => _125.toISOString, 'call', _126 => _126()]),
|
|
5157
5164
|
query
|
|
5158
5165
|
},
|
|
5159
5166
|
{
|
|
@@ -5557,7 +5564,7 @@ function createRoom(options, config) {
|
|
|
5557
5564
|
}
|
|
5558
5565
|
},
|
|
5559
5566
|
assertStorageIsWritable: () => {
|
|
5560
|
-
const scopes = _optionalChain([context, 'access',
|
|
5567
|
+
const scopes = _optionalChain([context, 'access', _127 => _127.dynamicSessionInfo, 'access', _128 => _128.current, 'optionalAccess', _129 => _129.scopes]);
|
|
5561
5568
|
if (scopes === void 0) {
|
|
5562
5569
|
return;
|
|
5563
5570
|
}
|
|
@@ -5591,12 +5598,12 @@ function createRoom(options, config) {
|
|
|
5591
5598
|
`/v2/c/rooms/${encodeURIComponent(roomId)}${endpoint}`,
|
|
5592
5599
|
params
|
|
5593
5600
|
);
|
|
5594
|
-
const fetcher = _optionalChain([config, 'access',
|
|
5601
|
+
const fetcher = _optionalChain([config, 'access', _130 => _130.polyfills, 'optionalAccess', _131 => _131.fetch]) || /* istanbul ignore next */
|
|
5595
5602
|
fetch;
|
|
5596
5603
|
return await fetcher(url, {
|
|
5597
5604
|
...options2,
|
|
5598
5605
|
headers: {
|
|
5599
|
-
..._optionalChain([options2, 'optionalAccess',
|
|
5606
|
+
..._optionalChain([options2, 'optionalAccess', _132 => _132.headers]),
|
|
5600
5607
|
Authorization: `Bearer ${getAuthBearerHeaderFromAuthValue(authValue)}`
|
|
5601
5608
|
}
|
|
5602
5609
|
});
|
|
@@ -5669,7 +5676,7 @@ function createRoom(options, config) {
|
|
|
5669
5676
|
}
|
|
5670
5677
|
function sendMessages(messages) {
|
|
5671
5678
|
const serializedPayload = JSON.stringify(messages);
|
|
5672
|
-
const nonce = _optionalChain([context, 'access',
|
|
5679
|
+
const nonce = _optionalChain([context, 'access', _133 => _133.dynamicSessionInfo, 'access', _134 => _134.current, 'optionalAccess', _135 => _135.nonce]);
|
|
5673
5680
|
if (config.unstable_fallbackToHTTP && nonce) {
|
|
5674
5681
|
const size = new TextEncoder().encode(serializedPayload).length;
|
|
5675
5682
|
if (size > MAX_SOCKET_MESSAGE_SIZE) {
|
|
@@ -5731,7 +5738,7 @@ function createRoom(options, config) {
|
|
|
5731
5738
|
} else {
|
|
5732
5739
|
context.root = LiveObject._fromItems(message.items, pool);
|
|
5733
5740
|
}
|
|
5734
|
-
const canWrite = _nullishCoalesce(_optionalChain([self, 'access',
|
|
5741
|
+
const canWrite = _nullishCoalesce(_optionalChain([self, 'access', _136 => _136.current, 'optionalAccess', _137 => _137.canWrite]), () => ( true));
|
|
5735
5742
|
const stackSizeBefore = context.undoStack.length;
|
|
5736
5743
|
for (const key in context.initialStorage) {
|
|
5737
5744
|
if (context.root.get(key) === void 0) {
|
|
@@ -5936,7 +5943,7 @@ function createRoom(options, config) {
|
|
|
5936
5943
|
}
|
|
5937
5944
|
context.myPresence.patch(patch);
|
|
5938
5945
|
if (context.activeBatch) {
|
|
5939
|
-
if (_optionalChain([options2, 'optionalAccess',
|
|
5946
|
+
if (_optionalChain([options2, 'optionalAccess', _138 => _138.addToHistory])) {
|
|
5940
5947
|
context.activeBatch.reverseOps.unshift({
|
|
5941
5948
|
type: "presence",
|
|
5942
5949
|
data: oldValues
|
|
@@ -5946,7 +5953,7 @@ function createRoom(options, config) {
|
|
|
5946
5953
|
} else {
|
|
5947
5954
|
flushNowOrSoon();
|
|
5948
5955
|
batchUpdates(() => {
|
|
5949
|
-
if (_optionalChain([options2, 'optionalAccess',
|
|
5956
|
+
if (_optionalChain([options2, 'optionalAccess', _139 => _139.addToHistory])) {
|
|
5950
5957
|
addToUndoStack(
|
|
5951
5958
|
[{ type: "presence", data: oldValues }],
|
|
5952
5959
|
doNotBatchUpdates
|
|
@@ -6144,7 +6151,7 @@ function createRoom(options, config) {
|
|
|
6144
6151
|
if (process.env.NODE_ENV !== "production") {
|
|
6145
6152
|
const traces = /* @__PURE__ */ new Set();
|
|
6146
6153
|
for (const opId of message.opIds) {
|
|
6147
|
-
const trace = _optionalChain([context, 'access',
|
|
6154
|
+
const trace = _optionalChain([context, 'access', _140 => _140.opStackTraces, 'optionalAccess', _141 => _141.get, 'call', _142 => _142(opId)]);
|
|
6148
6155
|
if (trace) {
|
|
6149
6156
|
traces.add(trace);
|
|
6150
6157
|
}
|
|
@@ -6278,7 +6285,7 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
6278
6285
|
const unacknowledgedOps = new Map(context.unacknowledgedOps);
|
|
6279
6286
|
createOrUpdateRootFromMessage(message, doNotBatchUpdates);
|
|
6280
6287
|
applyAndSendOps(unacknowledgedOps, doNotBatchUpdates);
|
|
6281
|
-
_optionalChain([_resolveStoragePromise, 'optionalCall',
|
|
6288
|
+
_optionalChain([_resolveStoragePromise, 'optionalCall', _143 => _143()]);
|
|
6282
6289
|
notifyStorageStatus();
|
|
6283
6290
|
eventHub.storageDidLoad.notify();
|
|
6284
6291
|
}
|
|
@@ -6576,7 +6583,7 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
6576
6583
|
{
|
|
6577
6584
|
[kInternal]: {
|
|
6578
6585
|
get presenceBuffer() {
|
|
6579
|
-
return deepClone(_nullishCoalesce(_optionalChain([context, 'access',
|
|
6586
|
+
return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _144 => _144.buffer, 'access', _145 => _145.presenceUpdates, 'optionalAccess', _146 => _146.data]), () => ( null)));
|
|
6580
6587
|
},
|
|
6581
6588
|
// prettier-ignore
|
|
6582
6589
|
get undoStack() {
|
|
@@ -6728,7 +6735,7 @@ function makeClassicSubscribeFn(events) {
|
|
|
6728
6735
|
}
|
|
6729
6736
|
if (isLiveNode(first)) {
|
|
6730
6737
|
const node = first;
|
|
6731
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
6738
|
+
if (_optionalChain([options, 'optionalAccess', _147 => _147.isDeep])) {
|
|
6732
6739
|
const storageCallback = second;
|
|
6733
6740
|
return subscribeToLiveStructureDeeply(node, storageCallback);
|
|
6734
6741
|
} else {
|
|
@@ -6828,9 +6835,7 @@ function createClientStore() {
|
|
|
6828
6835
|
),
|
|
6829
6836
|
queries: queryKey !== void 0 ? {
|
|
6830
6837
|
...state.queries,
|
|
6831
|
-
[queryKey]: {
|
|
6832
|
-
isLoading: false
|
|
6833
|
-
}
|
|
6838
|
+
[queryKey]: { isLoading: false, data: void 0 }
|
|
6834
6839
|
} : state.queries
|
|
6835
6840
|
}));
|
|
6836
6841
|
},
|
|
@@ -6843,9 +6848,7 @@ function createClientStore() {
|
|
|
6843
6848
|
},
|
|
6844
6849
|
queries: {
|
|
6845
6850
|
...state.queries,
|
|
6846
|
-
[queryKey]: {
|
|
6847
|
-
isLoading: false
|
|
6848
|
-
}
|
|
6851
|
+
[queryKey]: { isLoading: false, data: void 0 }
|
|
6849
6852
|
}
|
|
6850
6853
|
}));
|
|
6851
6854
|
},
|
|
@@ -7046,7 +7049,7 @@ function applyOptimisticUpdates(state) {
|
|
|
7046
7049
|
};
|
|
7047
7050
|
break;
|
|
7048
7051
|
}
|
|
7049
|
-
case "mark-inbox-notifications-as-read": {
|
|
7052
|
+
case "mark-all-inbox-notifications-as-read": {
|
|
7050
7053
|
for (const id in result.inboxNotifications) {
|
|
7051
7054
|
result.inboxNotifications[id] = {
|
|
7052
7055
|
...result.inboxNotifications[id],
|
|
@@ -7055,6 +7058,18 @@ function applyOptimisticUpdates(state) {
|
|
|
7055
7058
|
}
|
|
7056
7059
|
break;
|
|
7057
7060
|
}
|
|
7061
|
+
case "delete-inbox-notification": {
|
|
7062
|
+
const {
|
|
7063
|
+
[optimisticUpdate.inboxNotificationId]: _,
|
|
7064
|
+
...inboxNotifications
|
|
7065
|
+
} = result.inboxNotifications;
|
|
7066
|
+
result.inboxNotifications = inboxNotifications;
|
|
7067
|
+
break;
|
|
7068
|
+
}
|
|
7069
|
+
case "delete-all-inbox-notifications": {
|
|
7070
|
+
result.inboxNotifications = {};
|
|
7071
|
+
break;
|
|
7072
|
+
}
|
|
7058
7073
|
case "update-notification-settings": {
|
|
7059
7074
|
result.notificationSettings[optimisticUpdate.roomId] = {
|
|
7060
7075
|
...result.notificationSettings[optimisticUpdate.roomId],
|
|
@@ -7130,7 +7145,7 @@ function upsertComment(thread, comment) {
|
|
|
7130
7145
|
);
|
|
7131
7146
|
if (existingComment === void 0) {
|
|
7132
7147
|
const updatedAt = new Date(
|
|
7133
|
-
Math.max(_optionalChain([thread, 'access',
|
|
7148
|
+
Math.max(_optionalChain([thread, 'access', _148 => _148.updatedAt, 'optionalAccess', _149 => _149.getTime, 'call', _150 => _150()]) || 0, comment.createdAt.getTime())
|
|
7134
7149
|
);
|
|
7135
7150
|
const updatedThread = {
|
|
7136
7151
|
...thread,
|
|
@@ -7150,8 +7165,8 @@ function upsertComment(thread, comment) {
|
|
|
7150
7165
|
...thread,
|
|
7151
7166
|
updatedAt: new Date(
|
|
7152
7167
|
Math.max(
|
|
7153
|
-
_optionalChain([thread, 'access',
|
|
7154
|
-
_optionalChain([comment, 'access',
|
|
7168
|
+
_optionalChain([thread, 'access', _151 => _151.updatedAt, 'optionalAccess', _152 => _152.getTime, 'call', _153 => _153()]) || 0,
|
|
7169
|
+
_optionalChain([comment, 'access', _154 => _154.editedAt, 'optionalAccess', _155 => _155.getTime, 'call', _156 => _156()]) || comment.createdAt.getTime()
|
|
7155
7170
|
)
|
|
7156
7171
|
),
|
|
7157
7172
|
comments: updatedComments
|
|
@@ -7216,7 +7231,7 @@ function addReaction(thread, commentId, reaction) {
|
|
|
7216
7231
|
return {
|
|
7217
7232
|
...thread,
|
|
7218
7233
|
updatedAt: new Date(
|
|
7219
|
-
Math.max(reaction.createdAt.getTime(), _optionalChain([thread, 'access',
|
|
7234
|
+
Math.max(reaction.createdAt.getTime(), _optionalChain([thread, 'access', _157 => _157.updatedAt, 'optionalAccess', _158 => _158.getTime, 'call', _159 => _159()]) || 0)
|
|
7220
7235
|
),
|
|
7221
7236
|
comments: updatedComments
|
|
7222
7237
|
};
|
|
@@ -7249,7 +7264,7 @@ function removeReaction(thread, commentId, emoji, userId, removedAt) {
|
|
|
7249
7264
|
return {
|
|
7250
7265
|
...thread,
|
|
7251
7266
|
updatedAt: new Date(
|
|
7252
|
-
Math.max(removedAt.getTime(), _optionalChain([thread, 'access',
|
|
7267
|
+
Math.max(removedAt.getTime(), _optionalChain([thread, 'access', _160 => _160.updatedAt, 'optionalAccess', _161 => _161.getTime, 'call', _162 => _162()]) || 0)
|
|
7253
7268
|
),
|
|
7254
7269
|
comments: updatedComments
|
|
7255
7270
|
};
|
|
@@ -7360,12 +7375,12 @@ function createClient(options) {
|
|
|
7360
7375
|
createSocket: makeCreateSocketDelegateForRoom(
|
|
7361
7376
|
roomId,
|
|
7362
7377
|
baseUrl,
|
|
7363
|
-
_optionalChain([clientOptions, 'access',
|
|
7378
|
+
_optionalChain([clientOptions, 'access', _163 => _163.polyfills, 'optionalAccess', _164 => _164.WebSocket])
|
|
7364
7379
|
),
|
|
7365
7380
|
authenticate: makeAuthDelegateForRoom(roomId, authManager)
|
|
7366
7381
|
})),
|
|
7367
7382
|
enableDebugLogging: clientOptions.enableDebugLogging,
|
|
7368
|
-
unstable_batchedUpdates: _optionalChain([options2, 'optionalAccess',
|
|
7383
|
+
unstable_batchedUpdates: _optionalChain([options2, 'optionalAccess', _165 => _165.unstable_batchedUpdates]),
|
|
7369
7384
|
baseUrl,
|
|
7370
7385
|
unstable_fallbackToHTTP: !!clientOptions.unstable_fallbackToHTTP,
|
|
7371
7386
|
unstable_streamData: !!clientOptions.unstable_streamData
|
|
@@ -7381,7 +7396,7 @@ function createClient(options) {
|
|
|
7381
7396
|
const shouldConnect = _nullishCoalesce(options2.autoConnect, () => ( true));
|
|
7382
7397
|
if (shouldConnect) {
|
|
7383
7398
|
if (typeof atob === "undefined") {
|
|
7384
|
-
if (_optionalChain([clientOptions, 'access',
|
|
7399
|
+
if (_optionalChain([clientOptions, 'access', _166 => _166.polyfills, 'optionalAccess', _167 => _167.atob]) === void 0) {
|
|
7385
7400
|
throw new Error(
|
|
7386
7401
|
"You need to polyfill atob to use the client in your environment. Please follow the instructions at https://liveblocks.io/docs/errors/liveblocks-client/atob-polyfill"
|
|
7387
7402
|
);
|
|
@@ -7393,7 +7408,7 @@ function createClient(options) {
|
|
|
7393
7408
|
return leaseRoom(newRoomDetails);
|
|
7394
7409
|
}
|
|
7395
7410
|
function getRoom(roomId) {
|
|
7396
|
-
const room = _optionalChain([roomsById, 'access',
|
|
7411
|
+
const room = _optionalChain([roomsById, 'access', _168 => _168.get, 'call', _169 => _169(roomId), 'optionalAccess', _170 => _170.room]);
|
|
7397
7412
|
return room ? room : null;
|
|
7398
7413
|
}
|
|
7399
7414
|
function logout() {
|
|
@@ -7409,10 +7424,12 @@ function createClient(options) {
|
|
|
7409
7424
|
getInboxNotifications,
|
|
7410
7425
|
getUnreadInboxNotificationsCount,
|
|
7411
7426
|
markAllInboxNotificationsAsRead,
|
|
7412
|
-
markInboxNotificationAsRead
|
|
7427
|
+
markInboxNotificationAsRead,
|
|
7428
|
+
deleteAllInboxNotifications,
|
|
7429
|
+
deleteInboxNotification
|
|
7413
7430
|
} = createNotificationsApi({
|
|
7414
7431
|
baseUrl,
|
|
7415
|
-
fetcher: _optionalChain([clientOptions, 'access',
|
|
7432
|
+
fetcher: _optionalChain([clientOptions, 'access', _171 => _171.polyfills, 'optionalAccess', _172 => _172.fetch]) || /* istanbul ignore next */
|
|
7416
7433
|
fetch,
|
|
7417
7434
|
authManager,
|
|
7418
7435
|
currentUserIdStore
|
|
@@ -7426,7 +7443,7 @@ function createClient(options) {
|
|
|
7426
7443
|
const usersStore = createBatchStore(
|
|
7427
7444
|
async (batchedUserIds) => {
|
|
7428
7445
|
const userIds = batchedUserIds.flat();
|
|
7429
|
-
const users = await _optionalChain([resolveUsers, 'optionalCall',
|
|
7446
|
+
const users = await _optionalChain([resolveUsers, 'optionalCall', _173 => _173({ userIds })]);
|
|
7430
7447
|
warnIfNoResolveUsers();
|
|
7431
7448
|
return _nullishCoalesce(users, () => ( userIds.map(() => void 0)));
|
|
7432
7449
|
},
|
|
@@ -7440,7 +7457,7 @@ function createClient(options) {
|
|
|
7440
7457
|
const roomsInfoStore = createBatchStore(
|
|
7441
7458
|
async (batchedRoomIds) => {
|
|
7442
7459
|
const roomIds = batchedRoomIds.flat();
|
|
7443
|
-
const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall',
|
|
7460
|
+
const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall', _174 => _174({ roomIds })]);
|
|
7444
7461
|
warnIfNoResolveRoomsInfo();
|
|
7445
7462
|
return _nullishCoalesce(roomsInfo, () => ( roomIds.map(() => void 0)));
|
|
7446
7463
|
},
|
|
@@ -7457,7 +7474,9 @@ function createClient(options) {
|
|
|
7457
7474
|
getInboxNotifications,
|
|
7458
7475
|
getUnreadInboxNotificationsCount,
|
|
7459
7476
|
markAllInboxNotificationsAsRead,
|
|
7460
|
-
markInboxNotificationAsRead
|
|
7477
|
+
markInboxNotificationAsRead,
|
|
7478
|
+
deleteAllInboxNotifications,
|
|
7479
|
+
deleteInboxNotification
|
|
7461
7480
|
},
|
|
7462
7481
|
currentUserIdStore,
|
|
7463
7482
|
resolveMentionSuggestions: clientOptions.resolveMentionSuggestions,
|
|
@@ -7552,7 +7571,7 @@ var commentBodyElementsTypes = {
|
|
|
7552
7571
|
mention: "inline"
|
|
7553
7572
|
};
|
|
7554
7573
|
function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
|
|
7555
|
-
if (!body || !_optionalChain([body, 'optionalAccess',
|
|
7574
|
+
if (!body || !_optionalChain([body, 'optionalAccess', _175 => _175.content])) {
|
|
7556
7575
|
return;
|
|
7557
7576
|
}
|
|
7558
7577
|
const element = typeof elementOrVisitor === "string" ? elementOrVisitor : void 0;
|
|
@@ -7562,13 +7581,13 @@ function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
|
|
|
7562
7581
|
for (const block of body.content) {
|
|
7563
7582
|
if (type === "all" || type === "block") {
|
|
7564
7583
|
if (guard(block)) {
|
|
7565
|
-
_optionalChain([visitor, 'optionalCall',
|
|
7584
|
+
_optionalChain([visitor, 'optionalCall', _176 => _176(block)]);
|
|
7566
7585
|
}
|
|
7567
7586
|
}
|
|
7568
7587
|
if (type === "all" || type === "inline") {
|
|
7569
7588
|
for (const inline of block.children) {
|
|
7570
7589
|
if (guard(inline)) {
|
|
7571
|
-
_optionalChain([visitor, 'optionalCall',
|
|
7590
|
+
_optionalChain([visitor, 'optionalCall', _177 => _177(inline)]);
|
|
7572
7591
|
}
|
|
7573
7592
|
}
|
|
7574
7593
|
}
|
|
@@ -7593,7 +7612,7 @@ async function resolveUsersInCommentBody(body, resolveUsers) {
|
|
|
7593
7612
|
userIds
|
|
7594
7613
|
});
|
|
7595
7614
|
for (const [index, userId] of userIds.entries()) {
|
|
7596
|
-
const user = _optionalChain([users, 'optionalAccess',
|
|
7615
|
+
const user = _optionalChain([users, 'optionalAccess', _178 => _178[index]]);
|
|
7597
7616
|
if (user) {
|
|
7598
7617
|
resolvedUsers.set(userId, user);
|
|
7599
7618
|
}
|
|
@@ -7716,7 +7735,7 @@ var stringifyCommentBodyPlainElements = {
|
|
|
7716
7735
|
text: ({ element }) => element.text,
|
|
7717
7736
|
link: ({ element }) => _nullishCoalesce(element.text, () => ( element.url)),
|
|
7718
7737
|
mention: ({ element, user }) => {
|
|
7719
|
-
return `@${_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
7738
|
+
return `@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _179 => _179.name]), () => ( element.id))}`;
|
|
7720
7739
|
}
|
|
7721
7740
|
};
|
|
7722
7741
|
var stringifyCommentBodyHtmlElements = {
|
|
@@ -7746,7 +7765,7 @@ var stringifyCommentBodyHtmlElements = {
|
|
|
7746
7765
|
return html`<a href="${href}" target="_blank" rel="noopener noreferrer">${_nullishCoalesce(element.text, () => ( element.url))}</a>`;
|
|
7747
7766
|
},
|
|
7748
7767
|
mention: ({ element, user }) => {
|
|
7749
|
-
return html`<span data-mention>@${_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
7768
|
+
return html`<span data-mention>@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _180 => _180.name]), () => ( element.id))}</span>`;
|
|
7750
7769
|
}
|
|
7751
7770
|
};
|
|
7752
7771
|
var stringifyCommentBodyMarkdownElements = {
|
|
@@ -7776,19 +7795,19 @@ var stringifyCommentBodyMarkdownElements = {
|
|
|
7776
7795
|
return markdown`[${_nullishCoalesce(element.text, () => ( element.url))}](${href})`;
|
|
7777
7796
|
},
|
|
7778
7797
|
mention: ({ element, user }) => {
|
|
7779
|
-
return markdown`@${_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
7798
|
+
return markdown`@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _181 => _181.name]), () => ( element.id))}`;
|
|
7780
7799
|
}
|
|
7781
7800
|
};
|
|
7782
7801
|
async function stringifyCommentBody(body, options) {
|
|
7783
|
-
const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
7784
|
-
const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
7802
|
+
const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _182 => _182.format]), () => ( "plain"));
|
|
7803
|
+
const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _183 => _183.separator]), () => ( (format === "markdown" ? "\n\n" : "\n")));
|
|
7785
7804
|
const elements = {
|
|
7786
7805
|
...format === "html" ? stringifyCommentBodyHtmlElements : format === "markdown" ? stringifyCommentBodyMarkdownElements : stringifyCommentBodyPlainElements,
|
|
7787
|
-
..._optionalChain([options, 'optionalAccess',
|
|
7806
|
+
..._optionalChain([options, 'optionalAccess', _184 => _184.elements])
|
|
7788
7807
|
};
|
|
7789
7808
|
const resolvedUsers = await resolveUsersInCommentBody(
|
|
7790
7809
|
body,
|
|
7791
|
-
_optionalChain([options, 'optionalAccess',
|
|
7810
|
+
_optionalChain([options, 'optionalAccess', _185 => _185.resolveUsers])
|
|
7792
7811
|
);
|
|
7793
7812
|
const blocks = body.content.flatMap((block, blockIndex) => {
|
|
7794
7813
|
switch (block.type) {
|
|
@@ -8063,12 +8082,12 @@ function legacy_patchImmutableNode(state, path, update) {
|
|
|
8063
8082
|
}
|
|
8064
8083
|
const newState = Object.assign({}, state);
|
|
8065
8084
|
for (const key in update.updates) {
|
|
8066
|
-
if (_optionalChain([update, 'access',
|
|
8085
|
+
if (_optionalChain([update, 'access', _186 => _186.updates, 'access', _187 => _187[key], 'optionalAccess', _188 => _188.type]) === "update") {
|
|
8067
8086
|
const val = update.node.get(key);
|
|
8068
8087
|
if (val !== void 0) {
|
|
8069
8088
|
newState[key] = lsonToJson(val);
|
|
8070
8089
|
}
|
|
8071
|
-
} else if (_optionalChain([update, 'access',
|
|
8090
|
+
} else if (_optionalChain([update, 'access', _189 => _189.updates, 'access', _190 => _190[key], 'optionalAccess', _191 => _191.type]) === "delete") {
|
|
8072
8091
|
delete newState[key];
|
|
8073
8092
|
}
|
|
8074
8093
|
}
|
|
@@ -8129,12 +8148,12 @@ function legacy_patchImmutableNode(state, path, update) {
|
|
|
8129
8148
|
}
|
|
8130
8149
|
const newState = Object.assign({}, state);
|
|
8131
8150
|
for (const key in update.updates) {
|
|
8132
|
-
if (_optionalChain([update, 'access',
|
|
8151
|
+
if (_optionalChain([update, 'access', _192 => _192.updates, 'access', _193 => _193[key], 'optionalAccess', _194 => _194.type]) === "update") {
|
|
8133
8152
|
const value = update.node.get(key);
|
|
8134
8153
|
if (value !== void 0) {
|
|
8135
8154
|
newState[key] = lsonToJson(value);
|
|
8136
8155
|
}
|
|
8137
|
-
} else if (_optionalChain([update, 'access',
|
|
8156
|
+
} else if (_optionalChain([update, 'access', _195 => _195.updates, 'access', _196 => _196[key], 'optionalAccess', _197 => _197.type]) === "delete") {
|
|
8138
8157
|
delete newState[key];
|
|
8139
8158
|
}
|
|
8140
8159
|
}
|