@liveblocks/core 3.20.0 → 3.20.1
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 +80 -66
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +17 -3
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
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 = "3.20.
|
|
9
|
+
var PKG_VERSION = "3.20.1";
|
|
10
10
|
var PKG_FORMAT = "cjs";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -8531,7 +8531,7 @@ var LiveObject = (_class2 = class _LiveObject extends AbstractCrdt {
|
|
|
8531
8531
|
const preciseSize = new TextEncoder().encode(jsonString).length;
|
|
8532
8532
|
if (preciseSize > MAX_LIVE_OBJECT_SIZE) {
|
|
8533
8533
|
throw new Error(
|
|
8534
|
-
`LiveObject size exceeded limit: ${preciseSize} bytes > ${MAX_LIVE_OBJECT_SIZE} bytes. See https://liveblocks.io/docs/
|
|
8534
|
+
`LiveObject size exceeded limit: ${preciseSize} bytes > ${MAX_LIVE_OBJECT_SIZE} bytes. See https://liveblocks.io/docs/pricing/limits#Other-limits`
|
|
8535
8535
|
);
|
|
8536
8536
|
}
|
|
8537
8537
|
}
|
|
@@ -9863,6 +9863,19 @@ function makeNodeMapBuffer() {
|
|
|
9863
9863
|
}
|
|
9864
9864
|
};
|
|
9865
9865
|
}
|
|
9866
|
+
function topLevelKeysOf(nodes) {
|
|
9867
|
+
const keys2 = /* @__PURE__ */ new Set();
|
|
9868
|
+
const root = nodes.get("root");
|
|
9869
|
+
for (const key in _optionalChain([root, 'optionalAccess', _225 => _225.data])) {
|
|
9870
|
+
keys2.add(key);
|
|
9871
|
+
}
|
|
9872
|
+
for (const node of nodes.values()) {
|
|
9873
|
+
if (node.parentId === "root") {
|
|
9874
|
+
keys2.add(node.parentKey);
|
|
9875
|
+
}
|
|
9876
|
+
}
|
|
9877
|
+
return keys2;
|
|
9878
|
+
}
|
|
9866
9879
|
function createRoom(options, config) {
|
|
9867
9880
|
const roomId = config.roomId;
|
|
9868
9881
|
const initialPresence = options.initialPresence;
|
|
@@ -10036,7 +10049,7 @@ function createRoom(options, config) {
|
|
|
10036
10049
|
}
|
|
10037
10050
|
}
|
|
10038
10051
|
function isStorageWritable() {
|
|
10039
|
-
const permissionMatrix = _optionalChain([context, 'access',
|
|
10052
|
+
const permissionMatrix = _optionalChain([context, 'access', _226 => _226.dynamicSessionInfoSig, 'access', _227 => _227.get, 'call', _228 => _228(), 'optionalAccess', _229 => _229.permissionMatrix]);
|
|
10040
10053
|
return permissionMatrix !== void 0 ? hasPermissionAccess(permissionMatrix, "storage", "write") : true;
|
|
10041
10054
|
}
|
|
10042
10055
|
const eventHub = {
|
|
@@ -10148,11 +10161,12 @@ function createRoom(options, config) {
|
|
|
10148
10161
|
context.pool
|
|
10149
10162
|
);
|
|
10150
10163
|
}
|
|
10151
|
-
const canWrite = _nullishCoalesce(_optionalChain([self, 'access',
|
|
10164
|
+
const canWrite = _nullishCoalesce(_optionalChain([self, 'access', _230 => _230.get, 'call', _231 => _231(), 'optionalAccess', _232 => _232.canWrite]), () => ( true));
|
|
10165
|
+
const serverTopLevelKeys = topLevelKeysOf(nodes);
|
|
10152
10166
|
const root = context.root;
|
|
10153
10167
|
disableHistory(() => {
|
|
10154
10168
|
for (const key in context.initialStorage) {
|
|
10155
|
-
if (
|
|
10169
|
+
if (!serverTopLevelKeys.has(key)) {
|
|
10156
10170
|
if (canWrite) {
|
|
10157
10171
|
root.set(key, cloneLson(context.initialStorage[key]));
|
|
10158
10172
|
} else {
|
|
@@ -10353,7 +10367,7 @@ function createRoom(options, config) {
|
|
|
10353
10367
|
}
|
|
10354
10368
|
context.myPresence.patch(patch);
|
|
10355
10369
|
if (context.activeBatch) {
|
|
10356
|
-
if (_optionalChain([options2, 'optionalAccess',
|
|
10370
|
+
if (_optionalChain([options2, 'optionalAccess', _233 => _233.addToHistory])) {
|
|
10357
10371
|
context.activeBatch.reverseOps.pushLeft({
|
|
10358
10372
|
type: "presence",
|
|
10359
10373
|
data: oldValues
|
|
@@ -10362,7 +10376,7 @@ function createRoom(options, config) {
|
|
|
10362
10376
|
context.activeBatch.updates.presence = true;
|
|
10363
10377
|
} else {
|
|
10364
10378
|
flushNowOrSoon();
|
|
10365
|
-
if (_optionalChain([options2, 'optionalAccess',
|
|
10379
|
+
if (_optionalChain([options2, 'optionalAccess', _234 => _234.addToHistory])) {
|
|
10366
10380
|
addToUndoStack([{ type: "presence", data: oldValues }]);
|
|
10367
10381
|
}
|
|
10368
10382
|
notify({ presence: true });
|
|
@@ -10541,11 +10555,11 @@ function createRoom(options, config) {
|
|
|
10541
10555
|
break;
|
|
10542
10556
|
}
|
|
10543
10557
|
case ServerMsgCode.STORAGE_CHUNK:
|
|
10544
|
-
_optionalChain([stopwatch, 'optionalAccess',
|
|
10558
|
+
_optionalChain([stopwatch, 'optionalAccess', _235 => _235.lap, 'call', _236 => _236()]);
|
|
10545
10559
|
nodeMapBuffer.append(compactNodesToNodeStream(message.nodes));
|
|
10546
10560
|
break;
|
|
10547
10561
|
case ServerMsgCode.STORAGE_STREAM_END: {
|
|
10548
|
-
const timing = _optionalChain([stopwatch, 'optionalAccess',
|
|
10562
|
+
const timing = _optionalChain([stopwatch, 'optionalAccess', _237 => _237.stop, 'call', _238 => _238()]);
|
|
10549
10563
|
if (timing) {
|
|
10550
10564
|
const ms = (v) => `${v.toFixed(1)}ms`;
|
|
10551
10565
|
const rest = timing.laps.slice(1);
|
|
@@ -10680,11 +10694,11 @@ function createRoom(options, config) {
|
|
|
10680
10694
|
} else if (pendingFeedsRequests.has(requestId)) {
|
|
10681
10695
|
const pending = pendingFeedsRequests.get(requestId);
|
|
10682
10696
|
pendingFeedsRequests.delete(requestId);
|
|
10683
|
-
_optionalChain([pending, 'optionalAccess',
|
|
10697
|
+
_optionalChain([pending, 'optionalAccess', _239 => _239.reject, 'call', _240 => _240(err)]);
|
|
10684
10698
|
} else if (pendingFeedMessagesRequests.has(requestId)) {
|
|
10685
10699
|
const pending = pendingFeedMessagesRequests.get(requestId);
|
|
10686
10700
|
pendingFeedMessagesRequests.delete(requestId);
|
|
10687
|
-
_optionalChain([pending, 'optionalAccess',
|
|
10701
|
+
_optionalChain([pending, 'optionalAccess', _241 => _241.reject, 'call', _242 => _242(err)]);
|
|
10688
10702
|
}
|
|
10689
10703
|
eventHub.feeds.notify(message);
|
|
10690
10704
|
break;
|
|
@@ -10838,10 +10852,10 @@ function createRoom(options, config) {
|
|
|
10838
10852
|
timeoutId,
|
|
10839
10853
|
kind,
|
|
10840
10854
|
feedId,
|
|
10841
|
-
messageId: _optionalChain([options2, 'optionalAccess',
|
|
10842
|
-
expectedClientMessageId: _optionalChain([options2, 'optionalAccess',
|
|
10855
|
+
messageId: _optionalChain([options2, 'optionalAccess', _243 => _243.messageId]),
|
|
10856
|
+
expectedClientMessageId: _optionalChain([options2, 'optionalAccess', _244 => _244.expectedClientMessageId])
|
|
10843
10857
|
});
|
|
10844
|
-
if (kind === "add-message" && _optionalChain([options2, 'optionalAccess',
|
|
10858
|
+
if (kind === "add-message" && _optionalChain([options2, 'optionalAccess', _245 => _245.expectedClientMessageId]) === void 0) {
|
|
10845
10859
|
const q = _nullishCoalesce(pendingAddMessageFifoByFeed.get(feedId), () => ( []));
|
|
10846
10860
|
q.push(requestId);
|
|
10847
10861
|
pendingAddMessageFifoByFeed.set(feedId, q);
|
|
@@ -10892,10 +10906,10 @@ function createRoom(options, config) {
|
|
|
10892
10906
|
}
|
|
10893
10907
|
if (!matched) {
|
|
10894
10908
|
const q = pendingAddMessageFifoByFeed.get(message.feedId);
|
|
10895
|
-
const headId = _optionalChain([q, 'optionalAccess',
|
|
10909
|
+
const headId = _optionalChain([q, 'optionalAccess', _246 => _246[0]]);
|
|
10896
10910
|
if (headId !== void 0) {
|
|
10897
10911
|
const pending = pendingFeedMutations.get(headId);
|
|
10898
|
-
if (_optionalChain([pending, 'optionalAccess',
|
|
10912
|
+
if (_optionalChain([pending, 'optionalAccess', _247 => _247.kind]) === "add-message" && pending.expectedClientMessageId === void 0) {
|
|
10899
10913
|
settleFeedMutation(headId, "ok");
|
|
10900
10914
|
}
|
|
10901
10915
|
}
|
|
@@ -10931,7 +10945,7 @@ function createRoom(options, config) {
|
|
|
10931
10945
|
const unacknowledgedOps2 = [...context.unacknowledgedOps.values()];
|
|
10932
10946
|
createOrUpdateRootFromMessage(nodes);
|
|
10933
10947
|
applyAndSendOfflineOps(unacknowledgedOps2);
|
|
10934
|
-
_optionalChain([_resolveStoragePromise, 'optionalCall',
|
|
10948
|
+
_optionalChain([_resolveStoragePromise, 'optionalCall', _248 => _248()]);
|
|
10935
10949
|
notifyStorageStatus();
|
|
10936
10950
|
eventHub.storageDidLoad.notify();
|
|
10937
10951
|
}
|
|
@@ -10940,7 +10954,7 @@ function createRoom(options, config) {
|
|
|
10940
10954
|
if (!messages.some((msg) => msg.type === ClientMsgCode.FETCH_STORAGE)) {
|
|
10941
10955
|
messages.push({ type: ClientMsgCode.FETCH_STORAGE });
|
|
10942
10956
|
nodeMapBuffer.take();
|
|
10943
|
-
_optionalChain([stopwatch, 'optionalAccess',
|
|
10957
|
+
_optionalChain([stopwatch, 'optionalAccess', _249 => _249.start, 'call', _250 => _250()]);
|
|
10944
10958
|
}
|
|
10945
10959
|
}
|
|
10946
10960
|
function startLoadingStorage() {
|
|
@@ -10994,10 +11008,10 @@ function createRoom(options, config) {
|
|
|
10994
11008
|
const message = {
|
|
10995
11009
|
type: ClientMsgCode.FETCH_FEEDS,
|
|
10996
11010
|
requestId,
|
|
10997
|
-
cursor: _optionalChain([options2, 'optionalAccess',
|
|
10998
|
-
since: _optionalChain([options2, 'optionalAccess',
|
|
10999
|
-
limit: _optionalChain([options2, 'optionalAccess',
|
|
11000
|
-
metadata: _optionalChain([options2, 'optionalAccess',
|
|
11011
|
+
cursor: _optionalChain([options2, 'optionalAccess', _251 => _251.cursor]),
|
|
11012
|
+
since: _optionalChain([options2, 'optionalAccess', _252 => _252.since]),
|
|
11013
|
+
limit: _optionalChain([options2, 'optionalAccess', _253 => _253.limit]),
|
|
11014
|
+
metadata: _optionalChain([options2, 'optionalAccess', _254 => _254.metadata])
|
|
11001
11015
|
};
|
|
11002
11016
|
context.buffer.messages.push(message);
|
|
11003
11017
|
flushNowOrSoon();
|
|
@@ -11017,9 +11031,9 @@ function createRoom(options, config) {
|
|
|
11017
11031
|
type: ClientMsgCode.FETCH_FEED_MESSAGES,
|
|
11018
11032
|
requestId,
|
|
11019
11033
|
feedId,
|
|
11020
|
-
cursor: _optionalChain([options2, 'optionalAccess',
|
|
11021
|
-
since: _optionalChain([options2, 'optionalAccess',
|
|
11022
|
-
limit: _optionalChain([options2, 'optionalAccess',
|
|
11034
|
+
cursor: _optionalChain([options2, 'optionalAccess', _255 => _255.cursor]),
|
|
11035
|
+
since: _optionalChain([options2, 'optionalAccess', _256 => _256.since]),
|
|
11036
|
+
limit: _optionalChain([options2, 'optionalAccess', _257 => _257.limit])
|
|
11023
11037
|
};
|
|
11024
11038
|
context.buffer.messages.push(message);
|
|
11025
11039
|
flushNowOrSoon();
|
|
@@ -11038,8 +11052,8 @@ function createRoom(options, config) {
|
|
|
11038
11052
|
type: ClientMsgCode.ADD_FEED,
|
|
11039
11053
|
requestId,
|
|
11040
11054
|
feedId,
|
|
11041
|
-
metadata: _optionalChain([options2, 'optionalAccess',
|
|
11042
|
-
createdAt: _optionalChain([options2, 'optionalAccess',
|
|
11055
|
+
metadata: _optionalChain([options2, 'optionalAccess', _258 => _258.metadata]),
|
|
11056
|
+
createdAt: _optionalChain([options2, 'optionalAccess', _259 => _259.createdAt])
|
|
11043
11057
|
};
|
|
11044
11058
|
context.buffer.messages.push(message);
|
|
11045
11059
|
flushNowOrSoon();
|
|
@@ -11073,15 +11087,15 @@ function createRoom(options, config) {
|
|
|
11073
11087
|
function addFeedMessage(feedId, data, options2) {
|
|
11074
11088
|
const requestId = nanoid();
|
|
11075
11089
|
const promise = registerFeedMutation(requestId, "add-message", feedId, {
|
|
11076
|
-
expectedClientMessageId: _optionalChain([options2, 'optionalAccess',
|
|
11090
|
+
expectedClientMessageId: _optionalChain([options2, 'optionalAccess', _260 => _260.id])
|
|
11077
11091
|
});
|
|
11078
11092
|
const message = {
|
|
11079
11093
|
type: ClientMsgCode.ADD_FEED_MESSAGE,
|
|
11080
11094
|
requestId,
|
|
11081
11095
|
feedId,
|
|
11082
11096
|
data,
|
|
11083
|
-
id: _optionalChain([options2, 'optionalAccess',
|
|
11084
|
-
createdAt: _optionalChain([options2, 'optionalAccess',
|
|
11097
|
+
id: _optionalChain([options2, 'optionalAccess', _261 => _261.id]),
|
|
11098
|
+
createdAt: _optionalChain([options2, 'optionalAccess', _262 => _262.createdAt])
|
|
11085
11099
|
};
|
|
11086
11100
|
context.buffer.messages.push(message);
|
|
11087
11101
|
flushNowOrSoon();
|
|
@@ -11098,7 +11112,7 @@ function createRoom(options, config) {
|
|
|
11098
11112
|
feedId,
|
|
11099
11113
|
messageId,
|
|
11100
11114
|
data,
|
|
11101
|
-
updatedAt: _optionalChain([options2, 'optionalAccess',
|
|
11115
|
+
updatedAt: _optionalChain([options2, 'optionalAccess', _263 => _263.updatedAt])
|
|
11102
11116
|
};
|
|
11103
11117
|
context.buffer.messages.push(message);
|
|
11104
11118
|
flushNowOrSoon();
|
|
@@ -11305,8 +11319,8 @@ function createRoom(options, config) {
|
|
|
11305
11319
|
async function getThreads(options2) {
|
|
11306
11320
|
return httpClient.getThreads({
|
|
11307
11321
|
roomId,
|
|
11308
|
-
query: _optionalChain([options2, 'optionalAccess',
|
|
11309
|
-
cursor: _optionalChain([options2, 'optionalAccess',
|
|
11322
|
+
query: _optionalChain([options2, 'optionalAccess', _264 => _264.query]),
|
|
11323
|
+
cursor: _optionalChain([options2, 'optionalAccess', _265 => _265.cursor])
|
|
11310
11324
|
});
|
|
11311
11325
|
}
|
|
11312
11326
|
async function getThread(threadId) {
|
|
@@ -11428,7 +11442,7 @@ function createRoom(options, config) {
|
|
|
11428
11442
|
function getSubscriptionSettings(options2) {
|
|
11429
11443
|
return httpClient.getSubscriptionSettings({
|
|
11430
11444
|
roomId,
|
|
11431
|
-
signal: _optionalChain([options2, 'optionalAccess',
|
|
11445
|
+
signal: _optionalChain([options2, 'optionalAccess', _266 => _266.signal])
|
|
11432
11446
|
});
|
|
11433
11447
|
}
|
|
11434
11448
|
function updateSubscriptionSettings(settings) {
|
|
@@ -11450,7 +11464,7 @@ function createRoom(options, config) {
|
|
|
11450
11464
|
{
|
|
11451
11465
|
[kInternal]: {
|
|
11452
11466
|
get presenceBuffer() {
|
|
11453
|
-
return deepClone(_nullishCoalesce(_optionalChain([context, 'access',
|
|
11467
|
+
return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _267 => _267.buffer, 'access', _268 => _268.presenceUpdates, 'optionalAccess', _269 => _269.data]), () => ( null)));
|
|
11454
11468
|
},
|
|
11455
11469
|
// prettier-ignore
|
|
11456
11470
|
get undoStack() {
|
|
@@ -11465,9 +11479,9 @@ function createRoom(options, config) {
|
|
|
11465
11479
|
return context.yjsProvider;
|
|
11466
11480
|
},
|
|
11467
11481
|
setYjsProvider(newProvider) {
|
|
11468
|
-
_optionalChain([context, 'access',
|
|
11482
|
+
_optionalChain([context, 'access', _270 => _270.yjsProvider, 'optionalAccess', _271 => _271.off, 'call', _272 => _272("status", yjsStatusDidChange)]);
|
|
11469
11483
|
context.yjsProvider = newProvider;
|
|
11470
|
-
_optionalChain([newProvider, 'optionalAccess',
|
|
11484
|
+
_optionalChain([newProvider, 'optionalAccess', _273 => _273.on, 'call', _274 => _274("status", yjsStatusDidChange)]);
|
|
11471
11485
|
context.yjsProviderDidChange.notify();
|
|
11472
11486
|
},
|
|
11473
11487
|
yjsProviderDidChange: context.yjsProviderDidChange.observable,
|
|
@@ -11527,7 +11541,7 @@ ${dumpPool(
|
|
|
11527
11541
|
source.dispose();
|
|
11528
11542
|
}
|
|
11529
11543
|
eventHub.roomWillDestroy.notify();
|
|
11530
|
-
_optionalChain([context, 'access',
|
|
11544
|
+
_optionalChain([context, 'access', _275 => _275.yjsProvider, 'optionalAccess', _276 => _276.off, 'call', _277 => _277("status", yjsStatusDidChange)]);
|
|
11531
11545
|
syncSourceForStorage.destroy();
|
|
11532
11546
|
syncSourceForYjs.destroy();
|
|
11533
11547
|
uninstallBgTabSpy();
|
|
@@ -11689,7 +11703,7 @@ function makeClassicSubscribeFn(roomId, events, errorEvents) {
|
|
|
11689
11703
|
}
|
|
11690
11704
|
if (isLiveNode(first)) {
|
|
11691
11705
|
const node = first;
|
|
11692
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
11706
|
+
if (_optionalChain([options, 'optionalAccess', _278 => _278.isDeep])) {
|
|
11693
11707
|
const storageCallback = second;
|
|
11694
11708
|
return subscribeToLiveStructureDeeply(node, storageCallback);
|
|
11695
11709
|
} else {
|
|
@@ -11779,8 +11793,8 @@ function createClient(options) {
|
|
|
11779
11793
|
const authManager = createAuthManager(options, (token) => {
|
|
11780
11794
|
currentUserId.set(() => token.uid);
|
|
11781
11795
|
});
|
|
11782
|
-
const fetchPolyfill = _optionalChain([clientOptions, 'access',
|
|
11783
|
-
_optionalChain([globalThis, 'access',
|
|
11796
|
+
const fetchPolyfill = _optionalChain([clientOptions, 'access', _279 => _279.polyfills, 'optionalAccess', _280 => _280.fetch]) || /* istanbul ignore next */
|
|
11797
|
+
_optionalChain([globalThis, 'access', _281 => _281.fetch, 'optionalAccess', _282 => _282.bind, 'call', _283 => _283(globalThis)]);
|
|
11784
11798
|
const httpClient = createApiClient({
|
|
11785
11799
|
baseUrl,
|
|
11786
11800
|
fetchPolyfill,
|
|
@@ -11797,7 +11811,7 @@ function createClient(options) {
|
|
|
11797
11811
|
delegates: {
|
|
11798
11812
|
createSocket: makeCreateSocketDelegateForAi(
|
|
11799
11813
|
baseUrl,
|
|
11800
|
-
_optionalChain([clientOptions, 'access',
|
|
11814
|
+
_optionalChain([clientOptions, 'access', _284 => _284.polyfills, 'optionalAccess', _285 => _285.WebSocket])
|
|
11801
11815
|
),
|
|
11802
11816
|
authenticate: async () => {
|
|
11803
11817
|
const resp = await authManager.getAuthValue({
|
|
@@ -11868,7 +11882,7 @@ function createClient(options) {
|
|
|
11868
11882
|
createSocket: makeCreateSocketDelegateForRoom(
|
|
11869
11883
|
roomId,
|
|
11870
11884
|
baseUrl,
|
|
11871
|
-
_optionalChain([clientOptions, 'access',
|
|
11885
|
+
_optionalChain([clientOptions, 'access', _286 => _286.polyfills, 'optionalAccess', _287 => _287.WebSocket])
|
|
11872
11886
|
),
|
|
11873
11887
|
authenticate: makeAuthDelegateForRoom(roomId, authManager)
|
|
11874
11888
|
})),
|
|
@@ -11890,7 +11904,7 @@ function createClient(options) {
|
|
|
11890
11904
|
const shouldConnect = _nullishCoalesce(options2.autoConnect, () => ( true));
|
|
11891
11905
|
if (shouldConnect) {
|
|
11892
11906
|
if (typeof atob === "undefined") {
|
|
11893
|
-
if (_optionalChain([clientOptions, 'access',
|
|
11907
|
+
if (_optionalChain([clientOptions, 'access', _288 => _288.polyfills, 'optionalAccess', _289 => _289.atob]) === void 0) {
|
|
11894
11908
|
throw new Error(
|
|
11895
11909
|
"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"
|
|
11896
11910
|
);
|
|
@@ -11902,7 +11916,7 @@ function createClient(options) {
|
|
|
11902
11916
|
return leaseRoom(newRoomDetails);
|
|
11903
11917
|
}
|
|
11904
11918
|
function getRoom(roomId) {
|
|
11905
|
-
const room = _optionalChain([roomsById, 'access',
|
|
11919
|
+
const room = _optionalChain([roomsById, 'access', _290 => _290.get, 'call', _291 => _291(roomId), 'optionalAccess', _292 => _292.room]);
|
|
11906
11920
|
return room ? room : null;
|
|
11907
11921
|
}
|
|
11908
11922
|
function logout() {
|
|
@@ -11918,7 +11932,7 @@ function createClient(options) {
|
|
|
11918
11932
|
const batchedResolveUsers = new Batch(
|
|
11919
11933
|
async (batchedUserIds) => {
|
|
11920
11934
|
const userIds = batchedUserIds.flat();
|
|
11921
|
-
const users = await _optionalChain([resolveUsers, 'optionalCall',
|
|
11935
|
+
const users = await _optionalChain([resolveUsers, 'optionalCall', _293 => _293({ userIds })]);
|
|
11922
11936
|
warnOnceIf(
|
|
11923
11937
|
!resolveUsers,
|
|
11924
11938
|
"Set the resolveUsers option in createClient to specify user info."
|
|
@@ -11935,7 +11949,7 @@ function createClient(options) {
|
|
|
11935
11949
|
const batchedResolveRoomsInfo = new Batch(
|
|
11936
11950
|
async (batchedRoomIds) => {
|
|
11937
11951
|
const roomIds = batchedRoomIds.flat();
|
|
11938
|
-
const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall',
|
|
11952
|
+
const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall', _294 => _294({ roomIds })]);
|
|
11939
11953
|
warnOnceIf(
|
|
11940
11954
|
!resolveRoomsInfo,
|
|
11941
11955
|
"Set the resolveRoomsInfo option in createClient to specify room info."
|
|
@@ -11952,7 +11966,7 @@ function createClient(options) {
|
|
|
11952
11966
|
const batchedResolveGroupsInfo = new Batch(
|
|
11953
11967
|
async (batchedGroupIds) => {
|
|
11954
11968
|
const groupIds = batchedGroupIds.flat();
|
|
11955
|
-
const groupsInfo = await _optionalChain([resolveGroupsInfo, 'optionalCall',
|
|
11969
|
+
const groupsInfo = await _optionalChain([resolveGroupsInfo, 'optionalCall', _295 => _295({ groupIds })]);
|
|
11956
11970
|
warnOnceIf(
|
|
11957
11971
|
!resolveGroupsInfo,
|
|
11958
11972
|
"Set the resolveGroupsInfo option in createClient to specify group info."
|
|
@@ -12011,7 +12025,7 @@ function createClient(options) {
|
|
|
12011
12025
|
}
|
|
12012
12026
|
};
|
|
12013
12027
|
const win = typeof window !== "undefined" ? window : void 0;
|
|
12014
|
-
_optionalChain([win, 'optionalAccess',
|
|
12028
|
+
_optionalChain([win, 'optionalAccess', _296 => _296.addEventListener, 'call', _297 => _297("beforeunload", maybePreventClose)]);
|
|
12015
12029
|
}
|
|
12016
12030
|
async function getNotificationSettings(options2) {
|
|
12017
12031
|
const plainSettings = await httpClient.getNotificationSettings(options2);
|
|
@@ -12139,7 +12153,7 @@ var commentBodyElementsTypes = {
|
|
|
12139
12153
|
mention: "inline"
|
|
12140
12154
|
};
|
|
12141
12155
|
function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
|
|
12142
|
-
if (!body || !_optionalChain([body, 'optionalAccess',
|
|
12156
|
+
if (!body || !_optionalChain([body, 'optionalAccess', _298 => _298.content])) {
|
|
12143
12157
|
return;
|
|
12144
12158
|
}
|
|
12145
12159
|
const element = typeof elementOrVisitor === "string" ? elementOrVisitor : void 0;
|
|
@@ -12149,13 +12163,13 @@ function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
|
|
|
12149
12163
|
for (const block of body.content) {
|
|
12150
12164
|
if (type === "all" || type === "block") {
|
|
12151
12165
|
if (guard(block)) {
|
|
12152
|
-
_optionalChain([visitor, 'optionalCall',
|
|
12166
|
+
_optionalChain([visitor, 'optionalCall', _299 => _299(block)]);
|
|
12153
12167
|
}
|
|
12154
12168
|
}
|
|
12155
12169
|
if (type === "all" || type === "inline") {
|
|
12156
12170
|
for (const inline of block.children) {
|
|
12157
12171
|
if (guard(inline)) {
|
|
12158
|
-
_optionalChain([visitor, 'optionalCall',
|
|
12172
|
+
_optionalChain([visitor, 'optionalCall', _300 => _300(inline)]);
|
|
12159
12173
|
}
|
|
12160
12174
|
}
|
|
12161
12175
|
}
|
|
@@ -12325,7 +12339,7 @@ var stringifyCommentBodyPlainElements = {
|
|
|
12325
12339
|
text: ({ element }) => element.text,
|
|
12326
12340
|
link: ({ element }) => _nullishCoalesce(element.text, () => ( element.url)),
|
|
12327
12341
|
mention: ({ element, user, group }) => {
|
|
12328
|
-
return `@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
12342
|
+
return `@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _301 => _301.name]), () => ( _optionalChain([group, 'optionalAccess', _302 => _302.name]))), () => ( element.id))}`;
|
|
12329
12343
|
}
|
|
12330
12344
|
};
|
|
12331
12345
|
var stringifyCommentBodyHtmlElements = {
|
|
@@ -12355,7 +12369,7 @@ var stringifyCommentBodyHtmlElements = {
|
|
|
12355
12369
|
return html`<a href="${href}" target="_blank" rel="noopener noreferrer">${element.text ? html`${element.text}` : element.url}</a>`;
|
|
12356
12370
|
},
|
|
12357
12371
|
mention: ({ element, user, group }) => {
|
|
12358
|
-
return html`<span data-mention>@${_optionalChain([user, 'optionalAccess',
|
|
12372
|
+
return html`<span data-mention>@${_optionalChain([user, 'optionalAccess', _303 => _303.name]) ? html`${_optionalChain([user, 'optionalAccess', _304 => _304.name])}` : _optionalChain([group, 'optionalAccess', _305 => _305.name]) ? html`${_optionalChain([group, 'optionalAccess', _306 => _306.name])}` : element.id}</span>`;
|
|
12359
12373
|
}
|
|
12360
12374
|
};
|
|
12361
12375
|
var stringifyCommentBodyMarkdownElements = {
|
|
@@ -12385,20 +12399,20 @@ var stringifyCommentBodyMarkdownElements = {
|
|
|
12385
12399
|
return markdown`[${_nullishCoalesce(element.text, () => ( element.url))}](${href})`;
|
|
12386
12400
|
},
|
|
12387
12401
|
mention: ({ element, user, group }) => {
|
|
12388
|
-
return markdown`@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
12402
|
+
return markdown`@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _307 => _307.name]), () => ( _optionalChain([group, 'optionalAccess', _308 => _308.name]))), () => ( element.id))}`;
|
|
12389
12403
|
}
|
|
12390
12404
|
};
|
|
12391
12405
|
async function stringifyCommentBody(body, options) {
|
|
12392
|
-
const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
12393
|
-
const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
12406
|
+
const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _309 => _309.format]), () => ( "plain"));
|
|
12407
|
+
const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _310 => _310.separator]), () => ( (format === "markdown" ? "\n\n" : "\n")));
|
|
12394
12408
|
const elements = {
|
|
12395
12409
|
...format === "html" ? stringifyCommentBodyHtmlElements : format === "markdown" ? stringifyCommentBodyMarkdownElements : stringifyCommentBodyPlainElements,
|
|
12396
|
-
..._optionalChain([options, 'optionalAccess',
|
|
12410
|
+
..._optionalChain([options, 'optionalAccess', _311 => _311.elements])
|
|
12397
12411
|
};
|
|
12398
12412
|
const { users: resolvedUsers, groups: resolvedGroupsInfo } = await resolveMentionsInCommentBody(
|
|
12399
12413
|
body,
|
|
12400
|
-
_optionalChain([options, 'optionalAccess',
|
|
12401
|
-
_optionalChain([options, 'optionalAccess',
|
|
12414
|
+
_optionalChain([options, 'optionalAccess', _312 => _312.resolveUsers]),
|
|
12415
|
+
_optionalChain([options, 'optionalAccess', _313 => _313.resolveGroupsInfo])
|
|
12402
12416
|
);
|
|
12403
12417
|
const blocks = body.content.flatMap((block, blockIndex) => {
|
|
12404
12418
|
switch (block.type) {
|
|
@@ -12533,9 +12547,9 @@ function makePoller(callback, intervalMs, options) {
|
|
|
12533
12547
|
const startTime = performance.now();
|
|
12534
12548
|
const doc = typeof document !== "undefined" ? document : void 0;
|
|
12535
12549
|
const win = typeof window !== "undefined" ? window : void 0;
|
|
12536
|
-
const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
12550
|
+
const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _314 => _314.maxStaleTimeMs]), () => ( Number.POSITIVE_INFINITY));
|
|
12537
12551
|
const context = {
|
|
12538
|
-
inForeground: _optionalChain([doc, 'optionalAccess',
|
|
12552
|
+
inForeground: _optionalChain([doc, 'optionalAccess', _315 => _315.visibilityState]) !== "hidden",
|
|
12539
12553
|
lastSuccessfulPollAt: startTime,
|
|
12540
12554
|
count: 0,
|
|
12541
12555
|
backoff: 0
|
|
@@ -12616,11 +12630,11 @@ function makePoller(callback, intervalMs, options) {
|
|
|
12616
12630
|
pollNowIfStale();
|
|
12617
12631
|
}
|
|
12618
12632
|
function onVisibilityChange() {
|
|
12619
|
-
setInForeground(_optionalChain([doc, 'optionalAccess',
|
|
12633
|
+
setInForeground(_optionalChain([doc, 'optionalAccess', _316 => _316.visibilityState]) !== "hidden");
|
|
12620
12634
|
}
|
|
12621
|
-
_optionalChain([doc, 'optionalAccess',
|
|
12622
|
-
_optionalChain([win, 'optionalAccess',
|
|
12623
|
-
_optionalChain([win, 'optionalAccess',
|
|
12635
|
+
_optionalChain([doc, 'optionalAccess', _317 => _317.addEventListener, 'call', _318 => _318("visibilitychange", onVisibilityChange)]);
|
|
12636
|
+
_optionalChain([win, 'optionalAccess', _319 => _319.addEventListener, 'call', _320 => _320("online", onVisibilityChange)]);
|
|
12637
|
+
_optionalChain([win, 'optionalAccess', _321 => _321.addEventListener, 'call', _322 => _322("focus", pollNowIfStale)]);
|
|
12624
12638
|
fsm.start();
|
|
12625
12639
|
return {
|
|
12626
12640
|
inc,
|