@liveblocks/core 3.23.0-exp1 → 3.23.0-exp3
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 +70 -67
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +5 -2
- 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.23.0-
|
|
9
|
+
var PKG_VERSION = "3.23.0-exp3";
|
|
10
10
|
var PKG_FORMAT = "cjs";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -11316,11 +11316,14 @@ function createRoom(options, config) {
|
|
|
11316
11316
|
);
|
|
11317
11317
|
}
|
|
11318
11318
|
context.activeBatch.reverseOps.pushLeft(reverse);
|
|
11319
|
+
if (_optionalChain([options2, 'optionalAccess', _244 => _244.clearRedoStack])) {
|
|
11320
|
+
context.activeBatch.clearRedoStack = true;
|
|
11321
|
+
}
|
|
11319
11322
|
} else {
|
|
11320
11323
|
if (reverse.length > 0) {
|
|
11321
11324
|
addToUndoStack(reverse);
|
|
11322
11325
|
}
|
|
11323
|
-
if (_nullishCoalesce(_optionalChain([options2, 'optionalAccess',
|
|
11326
|
+
if (_nullishCoalesce(_optionalChain([options2, 'optionalAccess', _245 => _245.clearRedoStack]), () => ( ops.length > 0))) {
|
|
11324
11327
|
clearRedoStack();
|
|
11325
11328
|
}
|
|
11326
11329
|
if (ops.length > 0) {
|
|
@@ -11330,7 +11333,7 @@ function createRoom(options, config) {
|
|
|
11330
11333
|
}
|
|
11331
11334
|
}
|
|
11332
11335
|
function isStorageWritable() {
|
|
11333
|
-
const permissionMatrix = _optionalChain([context, 'access',
|
|
11336
|
+
const permissionMatrix = _optionalChain([context, 'access', _246 => _246.dynamicSessionInfoSig, 'access', _247 => _247.get, 'call', _248 => _248(), 'optionalAccess', _249 => _249.permissionMatrix]);
|
|
11334
11337
|
return permissionMatrix !== void 0 ? hasPermissionAccess(permissionMatrix, "storage", "write") : true;
|
|
11335
11338
|
}
|
|
11336
11339
|
const eventHub = {
|
|
@@ -11468,7 +11471,7 @@ function createRoom(options, config) {
|
|
|
11468
11471
|
context.pool
|
|
11469
11472
|
);
|
|
11470
11473
|
}
|
|
11471
|
-
const canWrite = _nullishCoalesce(_optionalChain([self, 'access',
|
|
11474
|
+
const canWrite = _nullishCoalesce(_optionalChain([self, 'access', _250 => _250.get, 'call', _251 => _251(), 'optionalAccess', _252 => _252.canWrite]), () => ( true));
|
|
11472
11475
|
const serverTopLevelKeys = topLevelKeysOf(nodes);
|
|
11473
11476
|
const root = context.root;
|
|
11474
11477
|
disableHistory(() => {
|
|
@@ -11719,7 +11722,7 @@ function createRoom(options, config) {
|
|
|
11719
11722
|
}
|
|
11720
11723
|
context.myPresence.patch(patch);
|
|
11721
11724
|
if (context.activeBatch) {
|
|
11722
|
-
if (_optionalChain([options2, 'optionalAccess',
|
|
11725
|
+
if (_optionalChain([options2, 'optionalAccess', _253 => _253.addToHistory])) {
|
|
11723
11726
|
context.activeBatch.reverseOps.pushLeft({
|
|
11724
11727
|
type: "presence",
|
|
11725
11728
|
data: oldValues
|
|
@@ -11728,7 +11731,7 @@ function createRoom(options, config) {
|
|
|
11728
11731
|
context.activeBatch.updates.presence = true;
|
|
11729
11732
|
} else {
|
|
11730
11733
|
flushNowOrSoon();
|
|
11731
|
-
if (_optionalChain([options2, 'optionalAccess',
|
|
11734
|
+
if (_optionalChain([options2, 'optionalAccess', _254 => _254.addToHistory])) {
|
|
11732
11735
|
addToUndoStack([{ type: "presence", data: oldValues }]);
|
|
11733
11736
|
}
|
|
11734
11737
|
notify({ presence: true });
|
|
@@ -11907,11 +11910,11 @@ function createRoom(options, config) {
|
|
|
11907
11910
|
break;
|
|
11908
11911
|
}
|
|
11909
11912
|
case ServerMsgCode.STORAGE_CHUNK:
|
|
11910
|
-
_optionalChain([stopwatch, 'optionalAccess',
|
|
11913
|
+
_optionalChain([stopwatch, 'optionalAccess', _255 => _255.lap, 'call', _256 => _256()]);
|
|
11911
11914
|
nodeMapBuffer.append(compactNodesToNodeStream(message.nodes));
|
|
11912
11915
|
break;
|
|
11913
11916
|
case ServerMsgCode.STORAGE_STREAM_END: {
|
|
11914
|
-
const timing = _optionalChain([stopwatch, 'optionalAccess',
|
|
11917
|
+
const timing = _optionalChain([stopwatch, 'optionalAccess', _257 => _257.stop, 'call', _258 => _258()]);
|
|
11915
11918
|
if (timing) {
|
|
11916
11919
|
const ms = (v) => `${v.toFixed(1)}ms`;
|
|
11917
11920
|
const rest = timing.laps.slice(1);
|
|
@@ -12067,11 +12070,11 @@ function createRoom(options, config) {
|
|
|
12067
12070
|
} else if (pendingFeedsRequests.has(requestId)) {
|
|
12068
12071
|
const pending = pendingFeedsRequests.get(requestId);
|
|
12069
12072
|
pendingFeedsRequests.delete(requestId);
|
|
12070
|
-
_optionalChain([pending, 'optionalAccess',
|
|
12073
|
+
_optionalChain([pending, 'optionalAccess', _259 => _259.reject, 'call', _260 => _260(err)]);
|
|
12071
12074
|
} else if (pendingFeedMessagesRequests.has(requestId)) {
|
|
12072
12075
|
const pending = pendingFeedMessagesRequests.get(requestId);
|
|
12073
12076
|
pendingFeedMessagesRequests.delete(requestId);
|
|
12074
|
-
_optionalChain([pending, 'optionalAccess',
|
|
12077
|
+
_optionalChain([pending, 'optionalAccess', _261 => _261.reject, 'call', _262 => _262(err)]);
|
|
12075
12078
|
}
|
|
12076
12079
|
eventHub.feeds.notify(message);
|
|
12077
12080
|
break;
|
|
@@ -12225,10 +12228,10 @@ function createRoom(options, config) {
|
|
|
12225
12228
|
timeoutId,
|
|
12226
12229
|
kind,
|
|
12227
12230
|
feedId,
|
|
12228
|
-
messageId: _optionalChain([options2, 'optionalAccess',
|
|
12229
|
-
expectedClientMessageId: _optionalChain([options2, 'optionalAccess',
|
|
12231
|
+
messageId: _optionalChain([options2, 'optionalAccess', _263 => _263.messageId]),
|
|
12232
|
+
expectedClientMessageId: _optionalChain([options2, 'optionalAccess', _264 => _264.expectedClientMessageId])
|
|
12230
12233
|
});
|
|
12231
|
-
if (kind === "add-message" && _optionalChain([options2, 'optionalAccess',
|
|
12234
|
+
if (kind === "add-message" && _optionalChain([options2, 'optionalAccess', _265 => _265.expectedClientMessageId]) === void 0) {
|
|
12232
12235
|
const q = _nullishCoalesce(pendingAddMessageFifoByFeed.get(feedId), () => ( []));
|
|
12233
12236
|
q.push(requestId);
|
|
12234
12237
|
pendingAddMessageFifoByFeed.set(feedId, q);
|
|
@@ -12279,10 +12282,10 @@ function createRoom(options, config) {
|
|
|
12279
12282
|
}
|
|
12280
12283
|
if (!matched) {
|
|
12281
12284
|
const q = pendingAddMessageFifoByFeed.get(message.feedId);
|
|
12282
|
-
const headId = _optionalChain([q, 'optionalAccess',
|
|
12285
|
+
const headId = _optionalChain([q, 'optionalAccess', _266 => _266[0]]);
|
|
12283
12286
|
if (headId !== void 0) {
|
|
12284
12287
|
const pending = pendingFeedMutations.get(headId);
|
|
12285
|
-
if (_optionalChain([pending, 'optionalAccess',
|
|
12288
|
+
if (_optionalChain([pending, 'optionalAccess', _267 => _267.kind]) === "add-message" && pending.expectedClientMessageId === void 0) {
|
|
12286
12289
|
settleFeedMutation(headId, "ok");
|
|
12287
12290
|
}
|
|
12288
12291
|
}
|
|
@@ -12318,7 +12321,7 @@ function createRoom(options, config) {
|
|
|
12318
12321
|
const unacknowledgedOps2 = [...context.unacknowledgedOps.values()];
|
|
12319
12322
|
createOrUpdateRootFromMessage(nodes);
|
|
12320
12323
|
applyAndSendOfflineOps(unacknowledgedOps2);
|
|
12321
|
-
_optionalChain([_resolveStoragePromise, 'optionalCall',
|
|
12324
|
+
_optionalChain([_resolveStoragePromise, 'optionalCall', _268 => _268()]);
|
|
12322
12325
|
notifyStorageStatus();
|
|
12323
12326
|
eventHub.storageDidLoad.notify();
|
|
12324
12327
|
}
|
|
@@ -12327,7 +12330,7 @@ function createRoom(options, config) {
|
|
|
12327
12330
|
if (!messages.some((msg) => msg.type === ClientMsgCode.FETCH_STORAGE)) {
|
|
12328
12331
|
messages.push({ type: ClientMsgCode.FETCH_STORAGE });
|
|
12329
12332
|
nodeMapBuffer.take();
|
|
12330
|
-
_optionalChain([stopwatch, 'optionalAccess',
|
|
12333
|
+
_optionalChain([stopwatch, 'optionalAccess', _269 => _269.start, 'call', _270 => _270()]);
|
|
12331
12334
|
}
|
|
12332
12335
|
}
|
|
12333
12336
|
function startLoadingStorage() {
|
|
@@ -12381,10 +12384,10 @@ function createRoom(options, config) {
|
|
|
12381
12384
|
const message = {
|
|
12382
12385
|
type: ClientMsgCode.FETCH_FEEDS,
|
|
12383
12386
|
requestId,
|
|
12384
|
-
cursor: _optionalChain([options2, 'optionalAccess',
|
|
12385
|
-
since: _optionalChain([options2, 'optionalAccess',
|
|
12386
|
-
limit: _optionalChain([options2, 'optionalAccess',
|
|
12387
|
-
metadata: _optionalChain([options2, 'optionalAccess',
|
|
12387
|
+
cursor: _optionalChain([options2, 'optionalAccess', _271 => _271.cursor]),
|
|
12388
|
+
since: _optionalChain([options2, 'optionalAccess', _272 => _272.since]),
|
|
12389
|
+
limit: _optionalChain([options2, 'optionalAccess', _273 => _273.limit]),
|
|
12390
|
+
metadata: _optionalChain([options2, 'optionalAccess', _274 => _274.metadata])
|
|
12388
12391
|
};
|
|
12389
12392
|
context.buffer.messages.push(message);
|
|
12390
12393
|
flushNowOrSoon();
|
|
@@ -12404,9 +12407,9 @@ function createRoom(options, config) {
|
|
|
12404
12407
|
type: ClientMsgCode.FETCH_FEED_MESSAGES,
|
|
12405
12408
|
requestId,
|
|
12406
12409
|
feedId,
|
|
12407
|
-
cursor: _optionalChain([options2, 'optionalAccess',
|
|
12408
|
-
since: _optionalChain([options2, 'optionalAccess',
|
|
12409
|
-
limit: _optionalChain([options2, 'optionalAccess',
|
|
12410
|
+
cursor: _optionalChain([options2, 'optionalAccess', _275 => _275.cursor]),
|
|
12411
|
+
since: _optionalChain([options2, 'optionalAccess', _276 => _276.since]),
|
|
12412
|
+
limit: _optionalChain([options2, 'optionalAccess', _277 => _277.limit])
|
|
12410
12413
|
};
|
|
12411
12414
|
context.buffer.messages.push(message);
|
|
12412
12415
|
flushNowOrSoon();
|
|
@@ -12425,8 +12428,8 @@ function createRoom(options, config) {
|
|
|
12425
12428
|
type: ClientMsgCode.ADD_FEED,
|
|
12426
12429
|
requestId,
|
|
12427
12430
|
feedId,
|
|
12428
|
-
metadata: _optionalChain([options2, 'optionalAccess',
|
|
12429
|
-
createdAt: _optionalChain([options2, 'optionalAccess',
|
|
12431
|
+
metadata: _optionalChain([options2, 'optionalAccess', _278 => _278.metadata]),
|
|
12432
|
+
createdAt: _optionalChain([options2, 'optionalAccess', _279 => _279.createdAt])
|
|
12430
12433
|
};
|
|
12431
12434
|
context.buffer.messages.push(message);
|
|
12432
12435
|
flushNowOrSoon();
|
|
@@ -12460,15 +12463,15 @@ function createRoom(options, config) {
|
|
|
12460
12463
|
function addFeedMessage(feedId, data, options2) {
|
|
12461
12464
|
const requestId = nanoid();
|
|
12462
12465
|
const promise = registerFeedMutation(requestId, "add-message", feedId, {
|
|
12463
|
-
expectedClientMessageId: _optionalChain([options2, 'optionalAccess',
|
|
12466
|
+
expectedClientMessageId: _optionalChain([options2, 'optionalAccess', _280 => _280.id])
|
|
12464
12467
|
});
|
|
12465
12468
|
const message = {
|
|
12466
12469
|
type: ClientMsgCode.ADD_FEED_MESSAGE,
|
|
12467
12470
|
requestId,
|
|
12468
12471
|
feedId,
|
|
12469
12472
|
data,
|
|
12470
|
-
id: _optionalChain([options2, 'optionalAccess',
|
|
12471
|
-
createdAt: _optionalChain([options2, 'optionalAccess',
|
|
12473
|
+
id: _optionalChain([options2, 'optionalAccess', _281 => _281.id]),
|
|
12474
|
+
createdAt: _optionalChain([options2, 'optionalAccess', _282 => _282.createdAt])
|
|
12472
12475
|
};
|
|
12473
12476
|
context.buffer.messages.push(message);
|
|
12474
12477
|
flushNowOrSoon();
|
|
@@ -12485,7 +12488,7 @@ function createRoom(options, config) {
|
|
|
12485
12488
|
feedId,
|
|
12486
12489
|
messageId,
|
|
12487
12490
|
data,
|
|
12488
|
-
updatedAt: _optionalChain([options2, 'optionalAccess',
|
|
12491
|
+
updatedAt: _optionalChain([options2, 'optionalAccess', _283 => _283.updatedAt])
|
|
12489
12492
|
};
|
|
12490
12493
|
context.buffer.messages.push(message);
|
|
12491
12494
|
flushNowOrSoon();
|
|
@@ -12584,7 +12587,7 @@ function createRoom(options, config) {
|
|
|
12584
12587
|
if (currentBatch.scheduleHistoryResume) {
|
|
12585
12588
|
commitPausedHistoryToUndoStack();
|
|
12586
12589
|
}
|
|
12587
|
-
if (currentBatch.ops.length > 0) {
|
|
12590
|
+
if (currentBatch.ops.length > 0 || currentBatch.clearRedoStack) {
|
|
12588
12591
|
clearRedoStack();
|
|
12589
12592
|
}
|
|
12590
12593
|
if (currentBatch.ops.length > 0) {
|
|
@@ -12703,8 +12706,8 @@ function createRoom(options, config) {
|
|
|
12703
12706
|
async function getThreads(options2) {
|
|
12704
12707
|
return httpClient.getThreads({
|
|
12705
12708
|
roomId,
|
|
12706
|
-
query: _optionalChain([options2, 'optionalAccess',
|
|
12707
|
-
cursor: _optionalChain([options2, 'optionalAccess',
|
|
12709
|
+
query: _optionalChain([options2, 'optionalAccess', _284 => _284.query]),
|
|
12710
|
+
cursor: _optionalChain([options2, 'optionalAccess', _285 => _285.cursor])
|
|
12708
12711
|
});
|
|
12709
12712
|
}
|
|
12710
12713
|
async function getThread(threadId) {
|
|
@@ -12827,7 +12830,7 @@ function createRoom(options, config) {
|
|
|
12827
12830
|
function getSubscriptionSettings(options2) {
|
|
12828
12831
|
return httpClient.getSubscriptionSettings({
|
|
12829
12832
|
roomId,
|
|
12830
|
-
signal: _optionalChain([options2, 'optionalAccess',
|
|
12833
|
+
signal: _optionalChain([options2, 'optionalAccess', _286 => _286.signal])
|
|
12831
12834
|
});
|
|
12832
12835
|
}
|
|
12833
12836
|
function updateSubscriptionSettings(settings) {
|
|
@@ -12849,7 +12852,7 @@ function createRoom(options, config) {
|
|
|
12849
12852
|
{
|
|
12850
12853
|
[kInternal]: {
|
|
12851
12854
|
get presenceBuffer() {
|
|
12852
|
-
return deepClone(_nullishCoalesce(_optionalChain([context, 'access',
|
|
12855
|
+
return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _287 => _287.buffer, 'access', _288 => _288.presenceUpdates, 'optionalAccess', _289 => _289.data]), () => ( null)));
|
|
12853
12856
|
},
|
|
12854
12857
|
// prettier-ignore
|
|
12855
12858
|
get undoStack() {
|
|
@@ -12879,15 +12882,15 @@ function createRoom(options, config) {
|
|
|
12879
12882
|
return context.yjsProvider;
|
|
12880
12883
|
},
|
|
12881
12884
|
setYjsProvider(newProvider) {
|
|
12882
|
-
_optionalChain([context, 'access',
|
|
12885
|
+
_optionalChain([context, 'access', _290 => _290.yjsProvider, 'optionalAccess', _291 => _291.off, 'call', _292 => _292("status", yjsStatusDidChange)]);
|
|
12883
12886
|
context.yjsProvider = newProvider;
|
|
12884
|
-
_optionalChain([newProvider, 'optionalAccess',
|
|
12887
|
+
_optionalChain([newProvider, 'optionalAccess', _293 => _293.on, 'call', _294 => _294("status", yjsStatusDidChange)]);
|
|
12885
12888
|
context.yjsProviderDidChange.notify();
|
|
12886
12889
|
},
|
|
12887
12890
|
yjsProviderDidChange: context.yjsProviderDidChange.observable,
|
|
12888
12891
|
// send metadata when using a text editor
|
|
12889
12892
|
reportTextEditor,
|
|
12890
|
-
getPermissionMatrix: () => _optionalChain([context, 'access',
|
|
12893
|
+
getPermissionMatrix: () => _optionalChain([context, 'access', _295 => _295.dynamicSessionInfoSig, 'access', _296 => _296.get, 'call', _297 => _297(), 'optionalAccess', _298 => _298.permissionMatrix]),
|
|
12891
12894
|
// create a text mention when using a text editor
|
|
12892
12895
|
createTextMention,
|
|
12893
12896
|
// delete a text mention when using a text editor
|
|
@@ -12949,7 +12952,7 @@ ${dumpPool(
|
|
|
12949
12952
|
source.dispose();
|
|
12950
12953
|
}
|
|
12951
12954
|
eventHub.roomWillDestroy.notify();
|
|
12952
|
-
_optionalChain([context, 'access',
|
|
12955
|
+
_optionalChain([context, 'access', _299 => _299.yjsProvider, 'optionalAccess', _300 => _300.off, 'call', _301 => _301("status", yjsStatusDidChange)]);
|
|
12953
12956
|
syncSourceForStorage.destroy();
|
|
12954
12957
|
syncSourceForYjs.destroy();
|
|
12955
12958
|
uninstallBgTabSpy();
|
|
@@ -13111,7 +13114,7 @@ function makeClassicSubscribeFn(roomId, events, errorEvents) {
|
|
|
13111
13114
|
}
|
|
13112
13115
|
if (isLiveNode(first)) {
|
|
13113
13116
|
const node = first;
|
|
13114
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
13117
|
+
if (_optionalChain([options, 'optionalAccess', _302 => _302.isDeep])) {
|
|
13115
13118
|
const storageCallback = second;
|
|
13116
13119
|
return subscribeToLiveStructureDeeply(node, storageCallback);
|
|
13117
13120
|
} else {
|
|
@@ -13201,8 +13204,8 @@ function createClient(options) {
|
|
|
13201
13204
|
const authManager = createAuthManager(options, (token) => {
|
|
13202
13205
|
currentUserId.set(() => token.uid);
|
|
13203
13206
|
});
|
|
13204
|
-
const fetchPolyfill = _optionalChain([clientOptions, 'access',
|
|
13205
|
-
_optionalChain([globalThis, 'access',
|
|
13207
|
+
const fetchPolyfill = _optionalChain([clientOptions, 'access', _303 => _303.polyfills, 'optionalAccess', _304 => _304.fetch]) || /* istanbul ignore next */
|
|
13208
|
+
_optionalChain([globalThis, 'access', _305 => _305.fetch, 'optionalAccess', _306 => _306.bind, 'call', _307 => _307(globalThis)]);
|
|
13206
13209
|
const httpClient = createApiClient({
|
|
13207
13210
|
baseUrl,
|
|
13208
13211
|
fetchPolyfill,
|
|
@@ -13219,7 +13222,7 @@ function createClient(options) {
|
|
|
13219
13222
|
delegates: {
|
|
13220
13223
|
createSocket: makeCreateSocketDelegateForAi(
|
|
13221
13224
|
baseUrl,
|
|
13222
|
-
_optionalChain([clientOptions, 'access',
|
|
13225
|
+
_optionalChain([clientOptions, 'access', _308 => _308.polyfills, 'optionalAccess', _309 => _309.WebSocket])
|
|
13223
13226
|
),
|
|
13224
13227
|
authenticate: async () => {
|
|
13225
13228
|
const resp = await authManager.getAuthValue({
|
|
@@ -13290,7 +13293,7 @@ function createClient(options) {
|
|
|
13290
13293
|
createSocket: makeCreateSocketDelegateForRoom(
|
|
13291
13294
|
roomId,
|
|
13292
13295
|
baseUrl,
|
|
13293
|
-
_optionalChain([clientOptions, 'access',
|
|
13296
|
+
_optionalChain([clientOptions, 'access', _310 => _310.polyfills, 'optionalAccess', _311 => _311.WebSocket])
|
|
13294
13297
|
),
|
|
13295
13298
|
authenticate: makeAuthDelegateForRoom(roomId, authManager)
|
|
13296
13299
|
})),
|
|
@@ -13312,7 +13315,7 @@ function createClient(options) {
|
|
|
13312
13315
|
const shouldConnect = _nullishCoalesce(options2.autoConnect, () => ( true));
|
|
13313
13316
|
if (shouldConnect) {
|
|
13314
13317
|
if (typeof atob === "undefined") {
|
|
13315
|
-
if (_optionalChain([clientOptions, 'access',
|
|
13318
|
+
if (_optionalChain([clientOptions, 'access', _312 => _312.polyfills, 'optionalAccess', _313 => _313.atob]) === void 0) {
|
|
13316
13319
|
throw new Error(
|
|
13317
13320
|
"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"
|
|
13318
13321
|
);
|
|
@@ -13324,7 +13327,7 @@ function createClient(options) {
|
|
|
13324
13327
|
return leaseRoom(newRoomDetails);
|
|
13325
13328
|
}
|
|
13326
13329
|
function getRoom(roomId) {
|
|
13327
|
-
const room = _optionalChain([roomsById, 'access',
|
|
13330
|
+
const room = _optionalChain([roomsById, 'access', _314 => _314.get, 'call', _315 => _315(roomId), 'optionalAccess', _316 => _316.room]);
|
|
13328
13331
|
return room ? room : null;
|
|
13329
13332
|
}
|
|
13330
13333
|
function logout() {
|
|
@@ -13340,7 +13343,7 @@ function createClient(options) {
|
|
|
13340
13343
|
const batchedResolveUsers = new Batch(
|
|
13341
13344
|
async (batchedUserIds) => {
|
|
13342
13345
|
const userIds = batchedUserIds.flat();
|
|
13343
|
-
const users = await _optionalChain([resolveUsers, 'optionalCall',
|
|
13346
|
+
const users = await _optionalChain([resolveUsers, 'optionalCall', _317 => _317({ userIds })]);
|
|
13344
13347
|
warnOnceIf(
|
|
13345
13348
|
!resolveUsers,
|
|
13346
13349
|
"Set the resolveUsers option in createClient to specify user info."
|
|
@@ -13357,7 +13360,7 @@ function createClient(options) {
|
|
|
13357
13360
|
const batchedResolveRoomsInfo = new Batch(
|
|
13358
13361
|
async (batchedRoomIds) => {
|
|
13359
13362
|
const roomIds = batchedRoomIds.flat();
|
|
13360
|
-
const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall',
|
|
13363
|
+
const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall', _318 => _318({ roomIds })]);
|
|
13361
13364
|
warnOnceIf(
|
|
13362
13365
|
!resolveRoomsInfo,
|
|
13363
13366
|
"Set the resolveRoomsInfo option in createClient to specify room info."
|
|
@@ -13374,7 +13377,7 @@ function createClient(options) {
|
|
|
13374
13377
|
const batchedResolveGroupsInfo = new Batch(
|
|
13375
13378
|
async (batchedGroupIds) => {
|
|
13376
13379
|
const groupIds = batchedGroupIds.flat();
|
|
13377
|
-
const groupsInfo = await _optionalChain([resolveGroupsInfo, 'optionalCall',
|
|
13380
|
+
const groupsInfo = await _optionalChain([resolveGroupsInfo, 'optionalCall', _319 => _319({ groupIds })]);
|
|
13378
13381
|
warnOnceIf(
|
|
13379
13382
|
!resolveGroupsInfo,
|
|
13380
13383
|
"Set the resolveGroupsInfo option in createClient to specify group info."
|
|
@@ -13433,7 +13436,7 @@ function createClient(options) {
|
|
|
13433
13436
|
}
|
|
13434
13437
|
};
|
|
13435
13438
|
const win = typeof window !== "undefined" ? window : void 0;
|
|
13436
|
-
_optionalChain([win, 'optionalAccess',
|
|
13439
|
+
_optionalChain([win, 'optionalAccess', _320 => _320.addEventListener, 'call', _321 => _321("beforeunload", maybePreventClose)]);
|
|
13437
13440
|
}
|
|
13438
13441
|
async function getNotificationSettings(options2) {
|
|
13439
13442
|
const plainSettings = await httpClient.getNotificationSettings(options2);
|
|
@@ -13561,7 +13564,7 @@ var commentBodyElementsTypes = {
|
|
|
13561
13564
|
mention: "inline"
|
|
13562
13565
|
};
|
|
13563
13566
|
function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
|
|
13564
|
-
if (!body || !_optionalChain([body, 'optionalAccess',
|
|
13567
|
+
if (!body || !_optionalChain([body, 'optionalAccess', _322 => _322.content])) {
|
|
13565
13568
|
return;
|
|
13566
13569
|
}
|
|
13567
13570
|
const element = typeof elementOrVisitor === "string" ? elementOrVisitor : void 0;
|
|
@@ -13571,13 +13574,13 @@ function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
|
|
|
13571
13574
|
for (const block of body.content) {
|
|
13572
13575
|
if (type === "all" || type === "block") {
|
|
13573
13576
|
if (guard(block)) {
|
|
13574
|
-
_optionalChain([visitor, 'optionalCall',
|
|
13577
|
+
_optionalChain([visitor, 'optionalCall', _323 => _323(block)]);
|
|
13575
13578
|
}
|
|
13576
13579
|
}
|
|
13577
13580
|
if (type === "all" || type === "inline") {
|
|
13578
13581
|
for (const inline of block.children) {
|
|
13579
13582
|
if (guard(inline)) {
|
|
13580
|
-
_optionalChain([visitor, 'optionalCall',
|
|
13583
|
+
_optionalChain([visitor, 'optionalCall', _324 => _324(inline)]);
|
|
13581
13584
|
}
|
|
13582
13585
|
}
|
|
13583
13586
|
}
|
|
@@ -13747,7 +13750,7 @@ var stringifyCommentBodyPlainElements = {
|
|
|
13747
13750
|
text: ({ element }) => element.text,
|
|
13748
13751
|
link: ({ element }) => _nullishCoalesce(element.text, () => ( element.url)),
|
|
13749
13752
|
mention: ({ element, user, group }) => {
|
|
13750
|
-
return `@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
13753
|
+
return `@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _325 => _325.name]), () => ( _optionalChain([group, 'optionalAccess', _326 => _326.name]))), () => ( element.id))}`;
|
|
13751
13754
|
}
|
|
13752
13755
|
};
|
|
13753
13756
|
var stringifyCommentBodyHtmlElements = {
|
|
@@ -13777,7 +13780,7 @@ var stringifyCommentBodyHtmlElements = {
|
|
|
13777
13780
|
return html`<a href="${href}" target="_blank" rel="noopener noreferrer">${element.text ? html`${element.text}` : element.url}</a>`;
|
|
13778
13781
|
},
|
|
13779
13782
|
mention: ({ element, user, group }) => {
|
|
13780
|
-
return html`<span data-mention>@${_optionalChain([user, 'optionalAccess',
|
|
13783
|
+
return html`<span data-mention>@${_optionalChain([user, 'optionalAccess', _327 => _327.name]) ? html`${_optionalChain([user, 'optionalAccess', _328 => _328.name])}` : _optionalChain([group, 'optionalAccess', _329 => _329.name]) ? html`${_optionalChain([group, 'optionalAccess', _330 => _330.name])}` : element.id}</span>`;
|
|
13781
13784
|
}
|
|
13782
13785
|
};
|
|
13783
13786
|
var stringifyCommentBodyMarkdownElements = {
|
|
@@ -13807,20 +13810,20 @@ var stringifyCommentBodyMarkdownElements = {
|
|
|
13807
13810
|
return markdown`[${_nullishCoalesce(element.text, () => ( element.url))}](${href})`;
|
|
13808
13811
|
},
|
|
13809
13812
|
mention: ({ element, user, group }) => {
|
|
13810
|
-
return markdown`@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
13813
|
+
return markdown`@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _331 => _331.name]), () => ( _optionalChain([group, 'optionalAccess', _332 => _332.name]))), () => ( element.id))}`;
|
|
13811
13814
|
}
|
|
13812
13815
|
};
|
|
13813
13816
|
async function stringifyCommentBody(body, options) {
|
|
13814
|
-
const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
13815
|
-
const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
13817
|
+
const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _333 => _333.format]), () => ( "plain"));
|
|
13818
|
+
const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _334 => _334.separator]), () => ( (format === "markdown" ? "\n\n" : "\n")));
|
|
13816
13819
|
const elements = {
|
|
13817
13820
|
...format === "html" ? stringifyCommentBodyHtmlElements : format === "markdown" ? stringifyCommentBodyMarkdownElements : stringifyCommentBodyPlainElements,
|
|
13818
|
-
..._optionalChain([options, 'optionalAccess',
|
|
13821
|
+
..._optionalChain([options, 'optionalAccess', _335 => _335.elements])
|
|
13819
13822
|
};
|
|
13820
13823
|
const { users: resolvedUsers, groups: resolvedGroupsInfo } = await resolveMentionsInCommentBody(
|
|
13821
13824
|
body,
|
|
13822
|
-
_optionalChain([options, 'optionalAccess',
|
|
13823
|
-
_optionalChain([options, 'optionalAccess',
|
|
13825
|
+
_optionalChain([options, 'optionalAccess', _336 => _336.resolveUsers]),
|
|
13826
|
+
_optionalChain([options, 'optionalAccess', _337 => _337.resolveGroupsInfo])
|
|
13824
13827
|
);
|
|
13825
13828
|
const blocks = body.content.flatMap((block, blockIndex) => {
|
|
13826
13829
|
switch (block.type) {
|
|
@@ -13961,9 +13964,9 @@ function makePoller(callback, intervalMs, options) {
|
|
|
13961
13964
|
const startTime = performance.now();
|
|
13962
13965
|
const doc = typeof document !== "undefined" ? document : void 0;
|
|
13963
13966
|
const win = typeof window !== "undefined" ? window : void 0;
|
|
13964
|
-
const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
13967
|
+
const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _338 => _338.maxStaleTimeMs]), () => ( Number.POSITIVE_INFINITY));
|
|
13965
13968
|
const context = {
|
|
13966
|
-
inForeground: _optionalChain([doc, 'optionalAccess',
|
|
13969
|
+
inForeground: _optionalChain([doc, 'optionalAccess', _339 => _339.visibilityState]) !== "hidden",
|
|
13967
13970
|
lastSuccessfulPollAt: startTime,
|
|
13968
13971
|
count: 0,
|
|
13969
13972
|
backoff: 0
|
|
@@ -14044,11 +14047,11 @@ function makePoller(callback, intervalMs, options) {
|
|
|
14044
14047
|
pollNowIfStale();
|
|
14045
14048
|
}
|
|
14046
14049
|
function onVisibilityChange() {
|
|
14047
|
-
setInForeground(_optionalChain([doc, 'optionalAccess',
|
|
14050
|
+
setInForeground(_optionalChain([doc, 'optionalAccess', _340 => _340.visibilityState]) !== "hidden");
|
|
14048
14051
|
}
|
|
14049
|
-
_optionalChain([doc, 'optionalAccess',
|
|
14050
|
-
_optionalChain([win, 'optionalAccess',
|
|
14051
|
-
_optionalChain([win, 'optionalAccess',
|
|
14052
|
+
_optionalChain([doc, 'optionalAccess', _341 => _341.addEventListener, 'call', _342 => _342("visibilitychange", onVisibilityChange)]);
|
|
14053
|
+
_optionalChain([win, 'optionalAccess', _343 => _343.addEventListener, 'call', _344 => _344("online", onVisibilityChange)]);
|
|
14054
|
+
_optionalChain([win, 'optionalAccess', _345 => _345.addEventListener, 'call', _346 => _346("focus", pollNowIfStale)]);
|
|
14052
14055
|
fsm.start();
|
|
14053
14056
|
return {
|
|
14054
14057
|
inc,
|