@liveblocks/core 3.15.0-feeds2 → 3.15.0-rc1
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 +42 -231
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +13 -202
- package/dist/index.d.ts +13 -202
- package/dist/index.js +3 -192
- 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.15.0-
|
|
9
|
+
var PKG_VERSION = "3.15.0-rc1";
|
|
10
10
|
var PKG_FORMAT = "cjs";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -3219,15 +3219,6 @@ var ServerMsgCode = Object.freeze({
|
|
|
3219
3219
|
COMMENT_REACTION_ADDED: 405,
|
|
3220
3220
|
COMMENT_REACTION_REMOVED: 406,
|
|
3221
3221
|
COMMENT_METADATA_UPDATED: 409,
|
|
3222
|
-
// For Feeds
|
|
3223
|
-
FEEDS_LIST: 500,
|
|
3224
|
-
FEEDS_ADDED: 501,
|
|
3225
|
-
FEEDS_UPDATED: 502,
|
|
3226
|
-
FEEDS_DELETED: 503,
|
|
3227
|
-
FEED_MESSAGES_LIST: 504,
|
|
3228
|
-
FEED_MESSAGES_ADDED: 505,
|
|
3229
|
-
FEED_MESSAGES_UPDATED: 506,
|
|
3230
|
-
FEED_MESSAGES_DELETED: 507,
|
|
3231
3222
|
// Error codes
|
|
3232
3223
|
REJECT_STORAGE_OP: 299
|
|
3233
3224
|
// Sent if a mutation was not allowed on the server (i.e. due to permissions, limit exceeded, etc)
|
|
@@ -8783,16 +8774,7 @@ var ClientMsgCode = Object.freeze({
|
|
|
8783
8774
|
UPDATE_STORAGE: 201,
|
|
8784
8775
|
// For Yjs support
|
|
8785
8776
|
FETCH_YDOC: 300,
|
|
8786
|
-
UPDATE_YDOC: 301
|
|
8787
|
-
// For Feeds
|
|
8788
|
-
FETCH_FEEDS: 510,
|
|
8789
|
-
FETCH_FEED_MESSAGES: 511,
|
|
8790
|
-
ADD_FEED: 512,
|
|
8791
|
-
UPDATE_FEED: 513,
|
|
8792
|
-
DELETE_FEED: 514,
|
|
8793
|
-
ADD_FEED_MESSAGE: 515,
|
|
8794
|
-
UPDATE_FEED_MESSAGE: 516,
|
|
8795
|
-
DELETE_FEED_MESSAGE: 517
|
|
8777
|
+
UPDATE_YDOC: 301
|
|
8796
8778
|
});
|
|
8797
8779
|
|
|
8798
8780
|
// src/refs/ManagedOthers.ts
|
|
@@ -9268,7 +9250,6 @@ function createRoom(options, config) {
|
|
|
9268
9250
|
storageStatus: makeEventSource(),
|
|
9269
9251
|
ydoc: makeEventSource(),
|
|
9270
9252
|
comments: makeEventSource(),
|
|
9271
|
-
feeds: makeEventSource(),
|
|
9272
9253
|
roomWillDestroy: makeEventSource()
|
|
9273
9254
|
};
|
|
9274
9255
|
async function createTextMention(mentionId, mention) {
|
|
@@ -9802,64 +9783,6 @@ function createRoom(options, config) {
|
|
|
9802
9783
|
eventHub.comments.notify(message);
|
|
9803
9784
|
break;
|
|
9804
9785
|
}
|
|
9805
|
-
case ServerMsgCode.FEEDS_LIST: {
|
|
9806
|
-
const feedsListMsg = message;
|
|
9807
|
-
const pending = pendingFeedsRequests.get(feedsListMsg.requestId);
|
|
9808
|
-
if (pending) {
|
|
9809
|
-
pending.resolve({
|
|
9810
|
-
feeds: feedsListMsg.feeds,
|
|
9811
|
-
nextCursor: feedsListMsg.nextCursor
|
|
9812
|
-
});
|
|
9813
|
-
pendingFeedsRequests.delete(feedsListMsg.requestId);
|
|
9814
|
-
}
|
|
9815
|
-
eventHub.feeds.notify(feedsListMsg);
|
|
9816
|
-
break;
|
|
9817
|
-
}
|
|
9818
|
-
case ServerMsgCode.FEEDS_ADDED: {
|
|
9819
|
-
const feedsAddedMsg = message;
|
|
9820
|
-
eventHub.feeds.notify(feedsAddedMsg);
|
|
9821
|
-
break;
|
|
9822
|
-
}
|
|
9823
|
-
case ServerMsgCode.FEEDS_UPDATED: {
|
|
9824
|
-
const feedsUpdatedMsg = message;
|
|
9825
|
-
eventHub.feeds.notify(feedsUpdatedMsg);
|
|
9826
|
-
break;
|
|
9827
|
-
}
|
|
9828
|
-
case ServerMsgCode.FEEDS_DELETED: {
|
|
9829
|
-
const feedsDeletedMsg = message;
|
|
9830
|
-
eventHub.feeds.notify(feedsDeletedMsg);
|
|
9831
|
-
break;
|
|
9832
|
-
}
|
|
9833
|
-
case ServerMsgCode.FEED_MESSAGES_LIST: {
|
|
9834
|
-
const feedMsgsListMsg = message;
|
|
9835
|
-
const pending = pendingFeedMessagesRequests.get(
|
|
9836
|
-
feedMsgsListMsg.requestId
|
|
9837
|
-
);
|
|
9838
|
-
if (pending) {
|
|
9839
|
-
pending.resolve({
|
|
9840
|
-
messages: feedMsgsListMsg.messages,
|
|
9841
|
-
nextCursor: feedMsgsListMsg.nextCursor
|
|
9842
|
-
});
|
|
9843
|
-
pendingFeedMessagesRequests.delete(feedMsgsListMsg.requestId);
|
|
9844
|
-
}
|
|
9845
|
-
eventHub.feeds.notify(feedMsgsListMsg);
|
|
9846
|
-
break;
|
|
9847
|
-
}
|
|
9848
|
-
case ServerMsgCode.FEED_MESSAGES_ADDED: {
|
|
9849
|
-
const feedMsgsAddedMsg = message;
|
|
9850
|
-
eventHub.feeds.notify(feedMsgsAddedMsg);
|
|
9851
|
-
break;
|
|
9852
|
-
}
|
|
9853
|
-
case ServerMsgCode.FEED_MESSAGES_UPDATED: {
|
|
9854
|
-
const feedMsgsUpdatedMsg = message;
|
|
9855
|
-
eventHub.feeds.notify(feedMsgsUpdatedMsg);
|
|
9856
|
-
break;
|
|
9857
|
-
}
|
|
9858
|
-
case ServerMsgCode.FEED_MESSAGES_DELETED: {
|
|
9859
|
-
const feedMsgsDeletedMsg = message;
|
|
9860
|
-
eventHub.feeds.notify(feedMsgsDeletedMsg);
|
|
9861
|
-
break;
|
|
9862
|
-
}
|
|
9863
9786
|
case ServerMsgCode.STORAGE_STATE_V7:
|
|
9864
9787
|
// No longer used in V8
|
|
9865
9788
|
default:
|
|
@@ -9963,8 +9886,6 @@ function createRoom(options, config) {
|
|
|
9963
9886
|
}
|
|
9964
9887
|
let _getStorage$ = null;
|
|
9965
9888
|
let _resolveStoragePromise = null;
|
|
9966
|
-
const pendingFeedsRequests = /* @__PURE__ */ new Map();
|
|
9967
|
-
const pendingFeedMessagesRequests = /* @__PURE__ */ new Map();
|
|
9968
9889
|
function processInitialStorage(nodes) {
|
|
9969
9890
|
const unacknowledgedOps = new Map(context.unacknowledgedOps);
|
|
9970
9891
|
createOrUpdateRootFromMessage(nodes);
|
|
@@ -10036,107 +9957,6 @@ function createRoom(options, config) {
|
|
|
10036
9957
|
}
|
|
10037
9958
|
flushNowOrSoon();
|
|
10038
9959
|
}
|
|
10039
|
-
async function fetchFeeds(options2) {
|
|
10040
|
-
const requestId = nanoid();
|
|
10041
|
-
const { promise, resolve, reject } = Promise_withResolvers();
|
|
10042
|
-
pendingFeedsRequests.set(requestId, { resolve, reject });
|
|
10043
|
-
const message = {
|
|
10044
|
-
type: ClientMsgCode.FETCH_FEEDS,
|
|
10045
|
-
requestId,
|
|
10046
|
-
cursor: _optionalChain([options2, 'optionalAccess', _222 => _222.cursor]),
|
|
10047
|
-
since: _optionalChain([options2, 'optionalAccess', _223 => _223.since]),
|
|
10048
|
-
limit: _optionalChain([options2, 'optionalAccess', _224 => _224.limit]),
|
|
10049
|
-
metadata: _optionalChain([options2, 'optionalAccess', _225 => _225.metadata])
|
|
10050
|
-
};
|
|
10051
|
-
context.buffer.messages.push(message);
|
|
10052
|
-
flushNowOrSoon();
|
|
10053
|
-
setTimeout(() => {
|
|
10054
|
-
if (pendingFeedsRequests.has(requestId)) {
|
|
10055
|
-
pendingFeedsRequests.delete(requestId);
|
|
10056
|
-
reject(new Error("Feeds fetch timeout"));
|
|
10057
|
-
}
|
|
10058
|
-
}, 3e4);
|
|
10059
|
-
return promise;
|
|
10060
|
-
}
|
|
10061
|
-
async function fetchFeedMessages(feedId, options2) {
|
|
10062
|
-
const requestId = nanoid();
|
|
10063
|
-
const { promise, resolve, reject } = Promise_withResolvers();
|
|
10064
|
-
pendingFeedMessagesRequests.set(requestId, { resolve, reject });
|
|
10065
|
-
const message = {
|
|
10066
|
-
type: ClientMsgCode.FETCH_FEED_MESSAGES,
|
|
10067
|
-
requestId,
|
|
10068
|
-
feedId,
|
|
10069
|
-
cursor: _optionalChain([options2, 'optionalAccess', _226 => _226.cursor]),
|
|
10070
|
-
since: _optionalChain([options2, 'optionalAccess', _227 => _227.since]),
|
|
10071
|
-
limit: _optionalChain([options2, 'optionalAccess', _228 => _228.limit])
|
|
10072
|
-
};
|
|
10073
|
-
context.buffer.messages.push(message);
|
|
10074
|
-
flushNowOrSoon();
|
|
10075
|
-
setTimeout(() => {
|
|
10076
|
-
if (pendingFeedMessagesRequests.has(requestId)) {
|
|
10077
|
-
pendingFeedMessagesRequests.delete(requestId);
|
|
10078
|
-
reject(new Error("Feed messages fetch timeout"));
|
|
10079
|
-
}
|
|
10080
|
-
}, 3e4);
|
|
10081
|
-
return promise;
|
|
10082
|
-
}
|
|
10083
|
-
function addFeed(feedId, options2) {
|
|
10084
|
-
const message = {
|
|
10085
|
-
type: ClientMsgCode.ADD_FEED,
|
|
10086
|
-
feedId,
|
|
10087
|
-
metadata: _optionalChain([options2, 'optionalAccess', _229 => _229.metadata]),
|
|
10088
|
-
timestamp: _optionalChain([options2, 'optionalAccess', _230 => _230.timestamp])
|
|
10089
|
-
};
|
|
10090
|
-
context.buffer.messages.push(message);
|
|
10091
|
-
flushNowOrSoon();
|
|
10092
|
-
}
|
|
10093
|
-
function updateFeed(feedId, metadata) {
|
|
10094
|
-
const message = {
|
|
10095
|
-
type: ClientMsgCode.UPDATE_FEED,
|
|
10096
|
-
feedId,
|
|
10097
|
-
metadata
|
|
10098
|
-
};
|
|
10099
|
-
context.buffer.messages.push(message);
|
|
10100
|
-
flushNowOrSoon();
|
|
10101
|
-
}
|
|
10102
|
-
function deleteFeed(feedId) {
|
|
10103
|
-
const message = {
|
|
10104
|
-
type: ClientMsgCode.DELETE_FEED,
|
|
10105
|
-
feedId
|
|
10106
|
-
};
|
|
10107
|
-
context.buffer.messages.push(message);
|
|
10108
|
-
flushNowOrSoon();
|
|
10109
|
-
}
|
|
10110
|
-
function addFeedMessage(feedId, data, options2) {
|
|
10111
|
-
const message = {
|
|
10112
|
-
type: ClientMsgCode.ADD_FEED_MESSAGE,
|
|
10113
|
-
feedId,
|
|
10114
|
-
data,
|
|
10115
|
-
id: _optionalChain([options2, 'optionalAccess', _231 => _231.id]),
|
|
10116
|
-
timestamp: _optionalChain([options2, 'optionalAccess', _232 => _232.timestamp])
|
|
10117
|
-
};
|
|
10118
|
-
context.buffer.messages.push(message);
|
|
10119
|
-
flushNowOrSoon();
|
|
10120
|
-
}
|
|
10121
|
-
function updateFeedMessage(feedId, messageId, data) {
|
|
10122
|
-
const message = {
|
|
10123
|
-
type: ClientMsgCode.UPDATE_FEED_MESSAGE,
|
|
10124
|
-
feedId,
|
|
10125
|
-
messageId,
|
|
10126
|
-
data
|
|
10127
|
-
};
|
|
10128
|
-
context.buffer.messages.push(message);
|
|
10129
|
-
flushNowOrSoon();
|
|
10130
|
-
}
|
|
10131
|
-
function deleteFeedMessage(feedId, messageId) {
|
|
10132
|
-
const message = {
|
|
10133
|
-
type: ClientMsgCode.DELETE_FEED_MESSAGE,
|
|
10134
|
-
feedId,
|
|
10135
|
-
messageId
|
|
10136
|
-
};
|
|
10137
|
-
context.buffer.messages.push(message);
|
|
10138
|
-
flushNowOrSoon();
|
|
10139
|
-
}
|
|
10140
9960
|
function undo() {
|
|
10141
9961
|
if (context.activeBatch) {
|
|
10142
9962
|
throw new Error("undo is not allowed during a batch");
|
|
@@ -10279,7 +10099,6 @@ function createRoom(options, config) {
|
|
|
10279
10099
|
storageStatus: eventHub.storageStatus.observable,
|
|
10280
10100
|
ydoc: eventHub.ydoc.observable,
|
|
10281
10101
|
comments: eventHub.comments.observable,
|
|
10282
|
-
feeds: eventHub.feeds.observable,
|
|
10283
10102
|
roomWillDestroy: eventHub.roomWillDestroy.observable
|
|
10284
10103
|
};
|
|
10285
10104
|
async function getThreadsSince(options2) {
|
|
@@ -10292,8 +10111,8 @@ function createRoom(options, config) {
|
|
|
10292
10111
|
async function getThreads(options2) {
|
|
10293
10112
|
return httpClient.getThreads({
|
|
10294
10113
|
roomId,
|
|
10295
|
-
query: _optionalChain([options2, 'optionalAccess',
|
|
10296
|
-
cursor: _optionalChain([options2, 'optionalAccess',
|
|
10114
|
+
query: _optionalChain([options2, 'optionalAccess', _222 => _222.query]),
|
|
10115
|
+
cursor: _optionalChain([options2, 'optionalAccess', _223 => _223.cursor])
|
|
10297
10116
|
});
|
|
10298
10117
|
}
|
|
10299
10118
|
async function getThread(threadId) {
|
|
@@ -10415,7 +10234,7 @@ function createRoom(options, config) {
|
|
|
10415
10234
|
function getSubscriptionSettings(options2) {
|
|
10416
10235
|
return httpClient.getSubscriptionSettings({
|
|
10417
10236
|
roomId,
|
|
10418
|
-
signal: _optionalChain([options2, 'optionalAccess',
|
|
10237
|
+
signal: _optionalChain([options2, 'optionalAccess', _224 => _224.signal])
|
|
10419
10238
|
});
|
|
10420
10239
|
}
|
|
10421
10240
|
function updateSubscriptionSettings(settings) {
|
|
@@ -10437,7 +10256,7 @@ function createRoom(options, config) {
|
|
|
10437
10256
|
{
|
|
10438
10257
|
[kInternal]: {
|
|
10439
10258
|
get presenceBuffer() {
|
|
10440
|
-
return deepClone(_nullishCoalesce(_optionalChain([context, 'access',
|
|
10259
|
+
return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _225 => _225.buffer, 'access', _226 => _226.presenceUpdates, 'optionalAccess', _227 => _227.data]), () => ( null)));
|
|
10441
10260
|
},
|
|
10442
10261
|
// prettier-ignore
|
|
10443
10262
|
get undoStack() {
|
|
@@ -10452,9 +10271,9 @@ function createRoom(options, config) {
|
|
|
10452
10271
|
return context.yjsProvider;
|
|
10453
10272
|
},
|
|
10454
10273
|
setYjsProvider(newProvider) {
|
|
10455
|
-
_optionalChain([context, 'access',
|
|
10274
|
+
_optionalChain([context, 'access', _228 => _228.yjsProvider, 'optionalAccess', _229 => _229.off, 'call', _230 => _230("status", yjsStatusDidChange)]);
|
|
10456
10275
|
context.yjsProvider = newProvider;
|
|
10457
|
-
_optionalChain([newProvider, 'optionalAccess',
|
|
10276
|
+
_optionalChain([newProvider, 'optionalAccess', _231 => _231.on, 'call', _232 => _232("status", yjsStatusDidChange)]);
|
|
10458
10277
|
context.yjsProviderDidChange.notify();
|
|
10459
10278
|
},
|
|
10460
10279
|
yjsProviderDidChange: context.yjsProviderDidChange.observable,
|
|
@@ -10488,7 +10307,7 @@ function createRoom(options, config) {
|
|
|
10488
10307
|
id: roomId,
|
|
10489
10308
|
subscribe: makeClassicSubscribeFn(
|
|
10490
10309
|
roomId,
|
|
10491
|
-
|
|
10310
|
+
events,
|
|
10492
10311
|
config.errorEventSource
|
|
10493
10312
|
),
|
|
10494
10313
|
connect: () => managedSocket.connect(),
|
|
@@ -10500,7 +10319,7 @@ function createRoom(options, config) {
|
|
|
10500
10319
|
source.dispose();
|
|
10501
10320
|
}
|
|
10502
10321
|
eventHub.roomWillDestroy.notify();
|
|
10503
|
-
_optionalChain([context, 'access',
|
|
10322
|
+
_optionalChain([context, 'access', _233 => _233.yjsProvider, 'optionalAccess', _234 => _234.off, 'call', _235 => _235("status", yjsStatusDidChange)]);
|
|
10504
10323
|
syncSourceForStorage.destroy();
|
|
10505
10324
|
syncSourceForYjs.destroy();
|
|
10506
10325
|
uninstallBgTabSpy();
|
|
@@ -10523,14 +10342,6 @@ function createRoom(options, config) {
|
|
|
10523
10342
|
resume: resumeHistory
|
|
10524
10343
|
},
|
|
10525
10344
|
fetchYDoc,
|
|
10526
|
-
fetchFeeds,
|
|
10527
|
-
fetchFeedMessages,
|
|
10528
|
-
addFeed,
|
|
10529
|
-
updateFeed,
|
|
10530
|
-
deleteFeed,
|
|
10531
|
-
addFeedMessage,
|
|
10532
|
-
updateFeedMessage,
|
|
10533
|
-
deleteFeedMessage,
|
|
10534
10345
|
getStorage,
|
|
10535
10346
|
getStorageSnapshot,
|
|
10536
10347
|
getStorageStatus,
|
|
@@ -10659,7 +10470,7 @@ function makeClassicSubscribeFn(roomId, events, errorEvents) {
|
|
|
10659
10470
|
}
|
|
10660
10471
|
if (isLiveNode(first)) {
|
|
10661
10472
|
const node = first;
|
|
10662
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
10473
|
+
if (_optionalChain([options, 'optionalAccess', _236 => _236.isDeep])) {
|
|
10663
10474
|
const storageCallback = second;
|
|
10664
10475
|
return subscribeToLiveStructureDeeply(node, storageCallback);
|
|
10665
10476
|
} else {
|
|
@@ -10748,8 +10559,8 @@ function createClient(options) {
|
|
|
10748
10559
|
const authManager = createAuthManager(options, (token) => {
|
|
10749
10560
|
currentUserId.set(() => token.uid);
|
|
10750
10561
|
});
|
|
10751
|
-
const fetchPolyfill = _optionalChain([clientOptions, 'access',
|
|
10752
|
-
_optionalChain([globalThis, 'access',
|
|
10562
|
+
const fetchPolyfill = _optionalChain([clientOptions, 'access', _237 => _237.polyfills, 'optionalAccess', _238 => _238.fetch]) || /* istanbul ignore next */
|
|
10563
|
+
_optionalChain([globalThis, 'access', _239 => _239.fetch, 'optionalAccess', _240 => _240.bind, 'call', _241 => _241(globalThis)]);
|
|
10753
10564
|
const httpClient = createApiClient({
|
|
10754
10565
|
baseUrl,
|
|
10755
10566
|
fetchPolyfill,
|
|
@@ -10767,7 +10578,7 @@ function createClient(options) {
|
|
|
10767
10578
|
delegates: {
|
|
10768
10579
|
createSocket: makeCreateSocketDelegateForAi(
|
|
10769
10580
|
baseUrl,
|
|
10770
|
-
_optionalChain([clientOptions, 'access',
|
|
10581
|
+
_optionalChain([clientOptions, 'access', _242 => _242.polyfills, 'optionalAccess', _243 => _243.WebSocket])
|
|
10771
10582
|
),
|
|
10772
10583
|
authenticate: async () => {
|
|
10773
10584
|
const resp = await authManager.getAuthValue({
|
|
@@ -10827,7 +10638,7 @@ function createClient(options) {
|
|
|
10827
10638
|
createSocket: makeCreateSocketDelegateForRoom(
|
|
10828
10639
|
roomId,
|
|
10829
10640
|
baseUrl,
|
|
10830
|
-
_optionalChain([clientOptions, 'access',
|
|
10641
|
+
_optionalChain([clientOptions, 'access', _244 => _244.polyfills, 'optionalAccess', _245 => _245.WebSocket]),
|
|
10831
10642
|
options2.engine
|
|
10832
10643
|
),
|
|
10833
10644
|
authenticate: makeAuthDelegateForRoom(roomId, authManager)
|
|
@@ -10851,7 +10662,7 @@ function createClient(options) {
|
|
|
10851
10662
|
const shouldConnect = _nullishCoalesce(options2.autoConnect, () => ( true));
|
|
10852
10663
|
if (shouldConnect) {
|
|
10853
10664
|
if (typeof atob === "undefined") {
|
|
10854
|
-
if (_optionalChain([clientOptions, 'access',
|
|
10665
|
+
if (_optionalChain([clientOptions, 'access', _246 => _246.polyfills, 'optionalAccess', _247 => _247.atob]) === void 0) {
|
|
10855
10666
|
throw new Error(
|
|
10856
10667
|
"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"
|
|
10857
10668
|
);
|
|
@@ -10863,7 +10674,7 @@ function createClient(options) {
|
|
|
10863
10674
|
return leaseRoom(newRoomDetails);
|
|
10864
10675
|
}
|
|
10865
10676
|
function getRoom(roomId) {
|
|
10866
|
-
const room = _optionalChain([roomsById, 'access',
|
|
10677
|
+
const room = _optionalChain([roomsById, 'access', _248 => _248.get, 'call', _249 => _249(roomId), 'optionalAccess', _250 => _250.room]);
|
|
10867
10678
|
return room ? room : null;
|
|
10868
10679
|
}
|
|
10869
10680
|
function logout() {
|
|
@@ -10879,7 +10690,7 @@ function createClient(options) {
|
|
|
10879
10690
|
const batchedResolveUsers = new Batch(
|
|
10880
10691
|
async (batchedUserIds) => {
|
|
10881
10692
|
const userIds = batchedUserIds.flat();
|
|
10882
|
-
const users = await _optionalChain([resolveUsers, 'optionalCall',
|
|
10693
|
+
const users = await _optionalChain([resolveUsers, 'optionalCall', _251 => _251({ userIds })]);
|
|
10883
10694
|
warnOnceIf(
|
|
10884
10695
|
!resolveUsers,
|
|
10885
10696
|
"Set the resolveUsers option in createClient to specify user info."
|
|
@@ -10896,7 +10707,7 @@ function createClient(options) {
|
|
|
10896
10707
|
const batchedResolveRoomsInfo = new Batch(
|
|
10897
10708
|
async (batchedRoomIds) => {
|
|
10898
10709
|
const roomIds = batchedRoomIds.flat();
|
|
10899
|
-
const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall',
|
|
10710
|
+
const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall', _252 => _252({ roomIds })]);
|
|
10900
10711
|
warnOnceIf(
|
|
10901
10712
|
!resolveRoomsInfo,
|
|
10902
10713
|
"Set the resolveRoomsInfo option in createClient to specify room info."
|
|
@@ -10913,7 +10724,7 @@ function createClient(options) {
|
|
|
10913
10724
|
const batchedResolveGroupsInfo = new Batch(
|
|
10914
10725
|
async (batchedGroupIds) => {
|
|
10915
10726
|
const groupIds = batchedGroupIds.flat();
|
|
10916
|
-
const groupsInfo = await _optionalChain([resolveGroupsInfo, 'optionalCall',
|
|
10727
|
+
const groupsInfo = await _optionalChain([resolveGroupsInfo, 'optionalCall', _253 => _253({ groupIds })]);
|
|
10917
10728
|
warnOnceIf(
|
|
10918
10729
|
!resolveGroupsInfo,
|
|
10919
10730
|
"Set the resolveGroupsInfo option in createClient to specify group info."
|
|
@@ -10969,7 +10780,7 @@ function createClient(options) {
|
|
|
10969
10780
|
}
|
|
10970
10781
|
};
|
|
10971
10782
|
const win = typeof window !== "undefined" ? window : void 0;
|
|
10972
|
-
_optionalChain([win, 'optionalAccess',
|
|
10783
|
+
_optionalChain([win, 'optionalAccess', _254 => _254.addEventListener, 'call', _255 => _255("beforeunload", maybePreventClose)]);
|
|
10973
10784
|
}
|
|
10974
10785
|
async function getNotificationSettings(options2) {
|
|
10975
10786
|
const plainSettings = await httpClient.getNotificationSettings(options2);
|
|
@@ -11096,7 +10907,7 @@ var commentBodyElementsTypes = {
|
|
|
11096
10907
|
mention: "inline"
|
|
11097
10908
|
};
|
|
11098
10909
|
function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
|
|
11099
|
-
if (!body || !_optionalChain([body, 'optionalAccess',
|
|
10910
|
+
if (!body || !_optionalChain([body, 'optionalAccess', _256 => _256.content])) {
|
|
11100
10911
|
return;
|
|
11101
10912
|
}
|
|
11102
10913
|
const element = typeof elementOrVisitor === "string" ? elementOrVisitor : void 0;
|
|
@@ -11106,13 +10917,13 @@ function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
|
|
|
11106
10917
|
for (const block of body.content) {
|
|
11107
10918
|
if (type === "all" || type === "block") {
|
|
11108
10919
|
if (guard(block)) {
|
|
11109
|
-
_optionalChain([visitor, 'optionalCall',
|
|
10920
|
+
_optionalChain([visitor, 'optionalCall', _257 => _257(block)]);
|
|
11110
10921
|
}
|
|
11111
10922
|
}
|
|
11112
10923
|
if (type === "all" || type === "inline") {
|
|
11113
10924
|
for (const inline of block.children) {
|
|
11114
10925
|
if (guard(inline)) {
|
|
11115
|
-
_optionalChain([visitor, 'optionalCall',
|
|
10926
|
+
_optionalChain([visitor, 'optionalCall', _258 => _258(inline)]);
|
|
11116
10927
|
}
|
|
11117
10928
|
}
|
|
11118
10929
|
}
|
|
@@ -11282,7 +11093,7 @@ var stringifyCommentBodyPlainElements = {
|
|
|
11282
11093
|
text: ({ element }) => element.text,
|
|
11283
11094
|
link: ({ element }) => _nullishCoalesce(element.text, () => ( element.url)),
|
|
11284
11095
|
mention: ({ element, user, group }) => {
|
|
11285
|
-
return `@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
11096
|
+
return `@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _259 => _259.name]), () => ( _optionalChain([group, 'optionalAccess', _260 => _260.name]))), () => ( element.id))}`;
|
|
11286
11097
|
}
|
|
11287
11098
|
};
|
|
11288
11099
|
var stringifyCommentBodyHtmlElements = {
|
|
@@ -11312,7 +11123,7 @@ var stringifyCommentBodyHtmlElements = {
|
|
|
11312
11123
|
return html`<a href="${href}" target="_blank" rel="noopener noreferrer">${element.text ? html`${element.text}` : element.url}</a>`;
|
|
11313
11124
|
},
|
|
11314
11125
|
mention: ({ element, user, group }) => {
|
|
11315
|
-
return html`<span data-mention>@${_optionalChain([user, 'optionalAccess',
|
|
11126
|
+
return html`<span data-mention>@${_optionalChain([user, 'optionalAccess', _261 => _261.name]) ? html`${_optionalChain([user, 'optionalAccess', _262 => _262.name])}` : _optionalChain([group, 'optionalAccess', _263 => _263.name]) ? html`${_optionalChain([group, 'optionalAccess', _264 => _264.name])}` : element.id}</span>`;
|
|
11316
11127
|
}
|
|
11317
11128
|
};
|
|
11318
11129
|
var stringifyCommentBodyMarkdownElements = {
|
|
@@ -11342,20 +11153,20 @@ var stringifyCommentBodyMarkdownElements = {
|
|
|
11342
11153
|
return markdown`[${_nullishCoalesce(element.text, () => ( element.url))}](${href})`;
|
|
11343
11154
|
},
|
|
11344
11155
|
mention: ({ element, user, group }) => {
|
|
11345
|
-
return markdown`@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
11156
|
+
return markdown`@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _265 => _265.name]), () => ( _optionalChain([group, 'optionalAccess', _266 => _266.name]))), () => ( element.id))}`;
|
|
11346
11157
|
}
|
|
11347
11158
|
};
|
|
11348
11159
|
async function stringifyCommentBody(body, options) {
|
|
11349
|
-
const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
11350
|
-
const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
11160
|
+
const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _267 => _267.format]), () => ( "plain"));
|
|
11161
|
+
const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _268 => _268.separator]), () => ( (format === "markdown" ? "\n\n" : "\n")));
|
|
11351
11162
|
const elements = {
|
|
11352
11163
|
...format === "html" ? stringifyCommentBodyHtmlElements : format === "markdown" ? stringifyCommentBodyMarkdownElements : stringifyCommentBodyPlainElements,
|
|
11353
|
-
..._optionalChain([options, 'optionalAccess',
|
|
11164
|
+
..._optionalChain([options, 'optionalAccess', _269 => _269.elements])
|
|
11354
11165
|
};
|
|
11355
11166
|
const { users: resolvedUsers, groups: resolvedGroupsInfo } = await resolveMentionsInCommentBody(
|
|
11356
11167
|
body,
|
|
11357
|
-
_optionalChain([options, 'optionalAccess',
|
|
11358
|
-
_optionalChain([options, 'optionalAccess',
|
|
11168
|
+
_optionalChain([options, 'optionalAccess', _270 => _270.resolveUsers]),
|
|
11169
|
+
_optionalChain([options, 'optionalAccess', _271 => _271.resolveGroupsInfo])
|
|
11359
11170
|
);
|
|
11360
11171
|
const blocks = body.content.flatMap((block, blockIndex) => {
|
|
11361
11172
|
switch (block.type) {
|
|
@@ -11642,12 +11453,12 @@ function legacy_patchImmutableNode(state, path, update) {
|
|
|
11642
11453
|
}
|
|
11643
11454
|
const newState = Object.assign({}, state);
|
|
11644
11455
|
for (const key in update.updates) {
|
|
11645
|
-
if (_optionalChain([update, 'access',
|
|
11456
|
+
if (_optionalChain([update, 'access', _272 => _272.updates, 'access', _273 => _273[key], 'optionalAccess', _274 => _274.type]) === "update") {
|
|
11646
11457
|
const val = update.node.get(key);
|
|
11647
11458
|
if (val !== void 0) {
|
|
11648
11459
|
newState[key] = lsonToJson(val);
|
|
11649
11460
|
}
|
|
11650
|
-
} else if (_optionalChain([update, 'access',
|
|
11461
|
+
} else if (_optionalChain([update, 'access', _275 => _275.updates, 'access', _276 => _276[key], 'optionalAccess', _277 => _277.type]) === "delete") {
|
|
11651
11462
|
delete newState[key];
|
|
11652
11463
|
}
|
|
11653
11464
|
}
|
|
@@ -11708,12 +11519,12 @@ function legacy_patchImmutableNode(state, path, update) {
|
|
|
11708
11519
|
}
|
|
11709
11520
|
const newState = Object.assign({}, state);
|
|
11710
11521
|
for (const key in update.updates) {
|
|
11711
|
-
if (_optionalChain([update, 'access',
|
|
11522
|
+
if (_optionalChain([update, 'access', _278 => _278.updates, 'access', _279 => _279[key], 'optionalAccess', _280 => _280.type]) === "update") {
|
|
11712
11523
|
const value = update.node.get(key);
|
|
11713
11524
|
if (value !== void 0) {
|
|
11714
11525
|
newState[key] = lsonToJson(value);
|
|
11715
11526
|
}
|
|
11716
|
-
} else if (_optionalChain([update, 'access',
|
|
11527
|
+
} else if (_optionalChain([update, 'access', _281 => _281.updates, 'access', _282 => _282[key], 'optionalAccess', _283 => _283.type]) === "delete") {
|
|
11717
11528
|
delete newState[key];
|
|
11718
11529
|
}
|
|
11719
11530
|
}
|
|
@@ -11793,9 +11604,9 @@ function makePoller(callback, intervalMs, options) {
|
|
|
11793
11604
|
const startTime = performance.now();
|
|
11794
11605
|
const doc = typeof document !== "undefined" ? document : void 0;
|
|
11795
11606
|
const win = typeof window !== "undefined" ? window : void 0;
|
|
11796
|
-
const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
11607
|
+
const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _284 => _284.maxStaleTimeMs]), () => ( Number.POSITIVE_INFINITY));
|
|
11797
11608
|
const context = {
|
|
11798
|
-
inForeground: _optionalChain([doc, 'optionalAccess',
|
|
11609
|
+
inForeground: _optionalChain([doc, 'optionalAccess', _285 => _285.visibilityState]) !== "hidden",
|
|
11799
11610
|
lastSuccessfulPollAt: startTime,
|
|
11800
11611
|
count: 0,
|
|
11801
11612
|
backoff: 0
|
|
@@ -11876,11 +11687,11 @@ function makePoller(callback, intervalMs, options) {
|
|
|
11876
11687
|
pollNowIfStale();
|
|
11877
11688
|
}
|
|
11878
11689
|
function onVisibilityChange() {
|
|
11879
|
-
setInForeground(_optionalChain([doc, 'optionalAccess',
|
|
11690
|
+
setInForeground(_optionalChain([doc, 'optionalAccess', _286 => _286.visibilityState]) !== "hidden");
|
|
11880
11691
|
}
|
|
11881
|
-
_optionalChain([doc, 'optionalAccess',
|
|
11882
|
-
_optionalChain([win, 'optionalAccess',
|
|
11883
|
-
_optionalChain([win, 'optionalAccess',
|
|
11692
|
+
_optionalChain([doc, 'optionalAccess', _287 => _287.addEventListener, 'call', _288 => _288("visibilitychange", onVisibilityChange)]);
|
|
11693
|
+
_optionalChain([win, 'optionalAccess', _289 => _289.addEventListener, 'call', _290 => _290("online", onVisibilityChange)]);
|
|
11694
|
+
_optionalChain([win, 'optionalAccess', _291 => _291.addEventListener, 'call', _292 => _292("focus", pollNowIfStale)]);
|
|
11884
11695
|
fsm.start();
|
|
11885
11696
|
return {
|
|
11886
11697
|
inc,
|