@liveblocks/core 3.15.4 → 3.16.0-feeds1
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 +449 -45
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +252 -15
- package/dist/index.d.ts +252 -15
- package/dist/index.js +407 -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.
|
|
9
|
+
var PKG_VERSION = "3.16.0-feeds1";
|
|
10
10
|
var PKG_FORMAT = "cjs";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -3219,10 +3219,26 @@ 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
|
+
FEED_DELETED: 503,
|
|
3227
|
+
FEED_MESSAGES_LIST: 504,
|
|
3228
|
+
FEED_MESSAGES_ADDED: 505,
|
|
3229
|
+
FEED_MESSAGES_UPDATED: 506,
|
|
3230
|
+
FEED_MESSAGES_DELETED: 507,
|
|
3231
|
+
FEED_REQUEST_FAILED: 508,
|
|
3222
3232
|
// Error codes
|
|
3223
3233
|
REJECT_STORAGE_OP: 299
|
|
3224
3234
|
// Sent if a mutation was not allowed on the server (i.e. due to permissions, limit exceeded, etc)
|
|
3225
3235
|
});
|
|
3236
|
+
var FeedRequestErrorCode = {
|
|
3237
|
+
INTERNAL: "INTERNAL",
|
|
3238
|
+
FEED_ALREADY_EXISTS: "FEED_ALREADY_EXISTS",
|
|
3239
|
+
FEED_NOT_FOUND: "FEED_NOT_FOUND",
|
|
3240
|
+
FEED_MESSAGE_NOT_FOUND: "FEED_MESSAGE_NOT_FOUND"
|
|
3241
|
+
};
|
|
3226
3242
|
|
|
3227
3243
|
// src/types/IWebSocket.ts
|
|
3228
3244
|
var WebsocketCloseCodes = /* @__PURE__ */ ((WebsocketCloseCodes2) => {
|
|
@@ -5186,6 +5202,7 @@ var Permission = /* @__PURE__ */ ((Permission2) => {
|
|
|
5186
5202
|
Permission2["PresenceWrite"] = "room:presence:write";
|
|
5187
5203
|
Permission2["CommentsWrite"] = "comments:write";
|
|
5188
5204
|
Permission2["CommentsRead"] = "comments:read";
|
|
5205
|
+
Permission2["FeedsWrite"] = "feeds:write";
|
|
5189
5206
|
return Permission2;
|
|
5190
5207
|
})(Permission || {});
|
|
5191
5208
|
function canWriteStorage(scopes) {
|
|
@@ -8774,7 +8791,16 @@ var ClientMsgCode = Object.freeze({
|
|
|
8774
8791
|
UPDATE_STORAGE: 201,
|
|
8775
8792
|
// For Yjs support
|
|
8776
8793
|
FETCH_YDOC: 300,
|
|
8777
|
-
UPDATE_YDOC: 301
|
|
8794
|
+
UPDATE_YDOC: 301,
|
|
8795
|
+
// For Feeds
|
|
8796
|
+
FETCH_FEEDS: 510,
|
|
8797
|
+
FETCH_FEED_MESSAGES: 511,
|
|
8798
|
+
ADD_FEED: 512,
|
|
8799
|
+
UPDATE_FEED: 513,
|
|
8800
|
+
DELETE_FEED: 514,
|
|
8801
|
+
ADD_FEED_MESSAGE: 515,
|
|
8802
|
+
UPDATE_FEED_MESSAGE: 516,
|
|
8803
|
+
DELETE_FEED_MESSAGE: 517
|
|
8778
8804
|
});
|
|
8779
8805
|
|
|
8780
8806
|
// src/refs/ManagedOthers.ts
|
|
@@ -9010,12 +9036,15 @@ function defaultMessageFromContext(context) {
|
|
|
9010
9036
|
return "Could not update notification settings";
|
|
9011
9037
|
case "LARGE_MESSAGE_ERROR":
|
|
9012
9038
|
return "Could not send large message";
|
|
9039
|
+
case "FEED_REQUEST_ERROR":
|
|
9040
|
+
return _nullishCoalesce(context.reason, () => ( "Feed request failed"));
|
|
9013
9041
|
default:
|
|
9014
9042
|
return assertNever(context, "Unhandled case");
|
|
9015
9043
|
}
|
|
9016
9044
|
}
|
|
9017
9045
|
|
|
9018
9046
|
// src/room.ts
|
|
9047
|
+
var FEEDS_TIMEOUT = 5e3;
|
|
9019
9048
|
function makeIdFactory(connectionId) {
|
|
9020
9049
|
let count = 0;
|
|
9021
9050
|
return () => `${connectionId}:${count++}`;
|
|
@@ -9250,6 +9279,7 @@ function createRoom(options, config) {
|
|
|
9250
9279
|
storageStatus: makeEventSource(),
|
|
9251
9280
|
ydoc: makeEventSource(),
|
|
9252
9281
|
comments: makeEventSource(),
|
|
9282
|
+
feeds: makeEventSource(),
|
|
9253
9283
|
roomWillDestroy: makeEventSource()
|
|
9254
9284
|
};
|
|
9255
9285
|
async function createTextMention(mentionId, mention) {
|
|
@@ -9670,6 +9700,9 @@ function createRoom(options, config) {
|
|
|
9670
9700
|
notify(result.updates);
|
|
9671
9701
|
sendMessages(messages);
|
|
9672
9702
|
}
|
|
9703
|
+
function isFeedRequestFailedMsg(msg) {
|
|
9704
|
+
return msg.type === ServerMsgCode.FEED_REQUEST_FAILED;
|
|
9705
|
+
}
|
|
9673
9706
|
function handleServerMessage(event) {
|
|
9674
9707
|
if (typeof event.data !== "string") {
|
|
9675
9708
|
return;
|
|
@@ -9783,6 +9816,94 @@ function createRoom(options, config) {
|
|
|
9783
9816
|
eventHub.comments.notify(message);
|
|
9784
9817
|
break;
|
|
9785
9818
|
}
|
|
9819
|
+
case ServerMsgCode.FEEDS_LIST: {
|
|
9820
|
+
const feedsListMsg = message;
|
|
9821
|
+
const pending = pendingFeedsRequests.get(feedsListMsg.requestId);
|
|
9822
|
+
if (pending) {
|
|
9823
|
+
pending.resolve({
|
|
9824
|
+
feeds: feedsListMsg.feeds,
|
|
9825
|
+
nextCursor: feedsListMsg.nextCursor
|
|
9826
|
+
});
|
|
9827
|
+
pendingFeedsRequests.delete(feedsListMsg.requestId);
|
|
9828
|
+
}
|
|
9829
|
+
eventHub.feeds.notify(feedsListMsg);
|
|
9830
|
+
break;
|
|
9831
|
+
}
|
|
9832
|
+
case ServerMsgCode.FEEDS_ADDED: {
|
|
9833
|
+
const feedsAddedMsg = message;
|
|
9834
|
+
eventHub.feeds.notify(feedsAddedMsg);
|
|
9835
|
+
tryResolvePendingFeedMutationsFromFeedsEvent(feedsAddedMsg);
|
|
9836
|
+
break;
|
|
9837
|
+
}
|
|
9838
|
+
case ServerMsgCode.FEEDS_UPDATED: {
|
|
9839
|
+
const feedsUpdatedMsg = message;
|
|
9840
|
+
eventHub.feeds.notify(feedsUpdatedMsg);
|
|
9841
|
+
tryResolvePendingFeedMutationsFromFeedsEvent(feedsUpdatedMsg);
|
|
9842
|
+
break;
|
|
9843
|
+
}
|
|
9844
|
+
case ServerMsgCode.FEED_DELETED: {
|
|
9845
|
+
eventHub.feeds.notify(message);
|
|
9846
|
+
tryResolvePendingFeedMutationsFromFeedsEvent(message);
|
|
9847
|
+
break;
|
|
9848
|
+
}
|
|
9849
|
+
case ServerMsgCode.FEED_MESSAGES_LIST: {
|
|
9850
|
+
const feedMsgsListMsg = message;
|
|
9851
|
+
const pending = pendingFeedMessagesRequests.get(
|
|
9852
|
+
feedMsgsListMsg.requestId
|
|
9853
|
+
);
|
|
9854
|
+
if (pending) {
|
|
9855
|
+
pending.resolve({
|
|
9856
|
+
messages: feedMsgsListMsg.messages,
|
|
9857
|
+
nextCursor: feedMsgsListMsg.nextCursor
|
|
9858
|
+
});
|
|
9859
|
+
pendingFeedMessagesRequests.delete(feedMsgsListMsg.requestId);
|
|
9860
|
+
}
|
|
9861
|
+
eventHub.feeds.notify(feedMsgsListMsg);
|
|
9862
|
+
break;
|
|
9863
|
+
}
|
|
9864
|
+
case ServerMsgCode.FEED_MESSAGES_ADDED: {
|
|
9865
|
+
const feedMsgsAddedMsg = message;
|
|
9866
|
+
eventHub.feeds.notify(feedMsgsAddedMsg);
|
|
9867
|
+
tryResolvePendingFeedMutationsFromFeedsEvent(feedMsgsAddedMsg);
|
|
9868
|
+
break;
|
|
9869
|
+
}
|
|
9870
|
+
case ServerMsgCode.FEED_MESSAGES_UPDATED: {
|
|
9871
|
+
const feedMsgsUpdatedMsg = message;
|
|
9872
|
+
eventHub.feeds.notify(feedMsgsUpdatedMsg);
|
|
9873
|
+
tryResolvePendingFeedMutationsFromFeedsEvent(feedMsgsUpdatedMsg);
|
|
9874
|
+
break;
|
|
9875
|
+
}
|
|
9876
|
+
case ServerMsgCode.FEED_MESSAGES_DELETED: {
|
|
9877
|
+
eventHub.feeds.notify(message);
|
|
9878
|
+
tryResolvePendingFeedMutationsFromFeedsEvent(message);
|
|
9879
|
+
break;
|
|
9880
|
+
}
|
|
9881
|
+
case ServerMsgCode.FEED_REQUEST_FAILED: {
|
|
9882
|
+
if (!isFeedRequestFailedMsg(message)) {
|
|
9883
|
+
break;
|
|
9884
|
+
}
|
|
9885
|
+
const { requestId, code, reason } = message;
|
|
9886
|
+
const err = new LiveblocksError(_nullishCoalesce(reason, () => ( "Feed request failed")), {
|
|
9887
|
+
type: "FEED_REQUEST_ERROR",
|
|
9888
|
+
roomId,
|
|
9889
|
+
requestId,
|
|
9890
|
+
code,
|
|
9891
|
+
reason
|
|
9892
|
+
});
|
|
9893
|
+
if (pendingFeedMutations.has(requestId)) {
|
|
9894
|
+
settleFeedMutation(requestId, "error", err);
|
|
9895
|
+
} else if (pendingFeedsRequests.has(requestId)) {
|
|
9896
|
+
const pending = pendingFeedsRequests.get(requestId);
|
|
9897
|
+
pendingFeedsRequests.delete(requestId);
|
|
9898
|
+
_optionalChain([pending, 'optionalAccess', _219 => _219.reject, 'call', _220 => _220(err)]);
|
|
9899
|
+
} else if (pendingFeedMessagesRequests.has(requestId)) {
|
|
9900
|
+
const pending = pendingFeedMessagesRequests.get(requestId);
|
|
9901
|
+
pendingFeedMessagesRequests.delete(requestId);
|
|
9902
|
+
_optionalChain([pending, 'optionalAccess', _221 => _221.reject, 'call', _222 => _222(err)]);
|
|
9903
|
+
}
|
|
9904
|
+
eventHub.feeds.notify(message);
|
|
9905
|
+
break;
|
|
9906
|
+
}
|
|
9786
9907
|
case ServerMsgCode.STORAGE_STATE_V7:
|
|
9787
9908
|
// No longer used in V8
|
|
9788
9909
|
default:
|
|
@@ -9886,11 +10007,146 @@ function createRoom(options, config) {
|
|
|
9886
10007
|
}
|
|
9887
10008
|
let _getStorage$ = null;
|
|
9888
10009
|
let _resolveStoragePromise = null;
|
|
10010
|
+
const pendingFeedsRequests = /* @__PURE__ */ new Map();
|
|
10011
|
+
const pendingFeedMessagesRequests = /* @__PURE__ */ new Map();
|
|
10012
|
+
const pendingFeedMutations = /* @__PURE__ */ new Map();
|
|
10013
|
+
const pendingAddMessageFifoByFeed = /* @__PURE__ */ new Map();
|
|
10014
|
+
function settleFeedMutation(requestId, outcome, error3) {
|
|
10015
|
+
const pending = pendingFeedMutations.get(requestId);
|
|
10016
|
+
if (pending === void 0) {
|
|
10017
|
+
return;
|
|
10018
|
+
}
|
|
10019
|
+
clearTimeout(pending.timeoutId);
|
|
10020
|
+
pendingFeedMutations.delete(requestId);
|
|
10021
|
+
if (pending.kind === "add-message" && !pending.expectedClientMessageId) {
|
|
10022
|
+
const q = pendingAddMessageFifoByFeed.get(pending.feedId);
|
|
10023
|
+
if (q !== void 0) {
|
|
10024
|
+
const idx = q.indexOf(requestId);
|
|
10025
|
+
if (idx >= 0) {
|
|
10026
|
+
q.splice(idx, 1);
|
|
10027
|
+
}
|
|
10028
|
+
if (q.length === 0) {
|
|
10029
|
+
pendingAddMessageFifoByFeed.delete(pending.feedId);
|
|
10030
|
+
}
|
|
10031
|
+
}
|
|
10032
|
+
}
|
|
10033
|
+
if (outcome === "ok") {
|
|
10034
|
+
pending.resolve();
|
|
10035
|
+
} else {
|
|
10036
|
+
pending.reject(_nullishCoalesce(error3, () => ( new Error("Feed mutation failed"))));
|
|
10037
|
+
}
|
|
10038
|
+
}
|
|
10039
|
+
function registerFeedMutation(requestId, kind, feedId, options2) {
|
|
10040
|
+
const { promise, resolve, reject } = Promise_withResolvers();
|
|
10041
|
+
const timeoutId = setTimeout(() => {
|
|
10042
|
+
if (pendingFeedMutations.has(requestId)) {
|
|
10043
|
+
settleFeedMutation(
|
|
10044
|
+
requestId,
|
|
10045
|
+
"error",
|
|
10046
|
+
new Error("Feed mutation timeout")
|
|
10047
|
+
);
|
|
10048
|
+
}
|
|
10049
|
+
}, FEEDS_TIMEOUT);
|
|
10050
|
+
pendingFeedMutations.set(requestId, {
|
|
10051
|
+
resolve,
|
|
10052
|
+
reject,
|
|
10053
|
+
timeoutId,
|
|
10054
|
+
kind,
|
|
10055
|
+
feedId,
|
|
10056
|
+
messageId: _optionalChain([options2, 'optionalAccess', _223 => _223.messageId]),
|
|
10057
|
+
expectedClientMessageId: _optionalChain([options2, 'optionalAccess', _224 => _224.expectedClientMessageId])
|
|
10058
|
+
});
|
|
10059
|
+
if (kind === "add-message" && _optionalChain([options2, 'optionalAccess', _225 => _225.expectedClientMessageId]) === void 0) {
|
|
10060
|
+
const q = _nullishCoalesce(pendingAddMessageFifoByFeed.get(feedId), () => ( []));
|
|
10061
|
+
q.push(requestId);
|
|
10062
|
+
pendingAddMessageFifoByFeed.set(feedId, q);
|
|
10063
|
+
}
|
|
10064
|
+
return promise;
|
|
10065
|
+
}
|
|
10066
|
+
function tryResolvePendingFeedMutationsFromFeedsEvent(message) {
|
|
10067
|
+
switch (message.type) {
|
|
10068
|
+
case ServerMsgCode.FEEDS_ADDED: {
|
|
10069
|
+
for (const feed of message.feeds) {
|
|
10070
|
+
for (const [requestId, pending] of [...pendingFeedMutations]) {
|
|
10071
|
+
if (pending.kind === "add-feed" && pending.feedId === feed.feedId) {
|
|
10072
|
+
settleFeedMutation(requestId, "ok");
|
|
10073
|
+
break;
|
|
10074
|
+
}
|
|
10075
|
+
}
|
|
10076
|
+
}
|
|
10077
|
+
break;
|
|
10078
|
+
}
|
|
10079
|
+
case ServerMsgCode.FEEDS_UPDATED: {
|
|
10080
|
+
for (const feed of message.feeds) {
|
|
10081
|
+
for (const [requestId, pending] of [...pendingFeedMutations]) {
|
|
10082
|
+
if (pending.kind === "update-feed" && pending.feedId === feed.feedId) {
|
|
10083
|
+
settleFeedMutation(requestId, "ok");
|
|
10084
|
+
}
|
|
10085
|
+
}
|
|
10086
|
+
}
|
|
10087
|
+
break;
|
|
10088
|
+
}
|
|
10089
|
+
case ServerMsgCode.FEED_DELETED: {
|
|
10090
|
+
for (const [requestId, pending] of [...pendingFeedMutations]) {
|
|
10091
|
+
if (pending.kind === "delete-feed" && pending.feedId === message.feedId) {
|
|
10092
|
+
settleFeedMutation(requestId, "ok");
|
|
10093
|
+
break;
|
|
10094
|
+
}
|
|
10095
|
+
}
|
|
10096
|
+
break;
|
|
10097
|
+
}
|
|
10098
|
+
case ServerMsgCode.FEED_MESSAGES_ADDED: {
|
|
10099
|
+
for (const m of message.messages) {
|
|
10100
|
+
let matched = false;
|
|
10101
|
+
for (const [requestId, pending] of [...pendingFeedMutations]) {
|
|
10102
|
+
if (pending.kind === "add-message" && pending.feedId === message.feedId && pending.expectedClientMessageId === m.id) {
|
|
10103
|
+
settleFeedMutation(requestId, "ok");
|
|
10104
|
+
matched = true;
|
|
10105
|
+
break;
|
|
10106
|
+
}
|
|
10107
|
+
}
|
|
10108
|
+
if (!matched) {
|
|
10109
|
+
const q = pendingAddMessageFifoByFeed.get(message.feedId);
|
|
10110
|
+
const headId = _optionalChain([q, 'optionalAccess', _226 => _226[0]]);
|
|
10111
|
+
if (headId !== void 0) {
|
|
10112
|
+
const pending = pendingFeedMutations.get(headId);
|
|
10113
|
+
if (_optionalChain([pending, 'optionalAccess', _227 => _227.kind]) === "add-message" && pending.expectedClientMessageId === void 0) {
|
|
10114
|
+
settleFeedMutation(headId, "ok");
|
|
10115
|
+
}
|
|
10116
|
+
}
|
|
10117
|
+
}
|
|
10118
|
+
}
|
|
10119
|
+
break;
|
|
10120
|
+
}
|
|
10121
|
+
case ServerMsgCode.FEED_MESSAGES_UPDATED: {
|
|
10122
|
+
for (const m of message.messages) {
|
|
10123
|
+
for (const [requestId, pending] of [...pendingFeedMutations]) {
|
|
10124
|
+
if (pending.kind === "update-message" && pending.feedId === message.feedId && pending.messageId === m.id) {
|
|
10125
|
+
settleFeedMutation(requestId, "ok");
|
|
10126
|
+
}
|
|
10127
|
+
}
|
|
10128
|
+
}
|
|
10129
|
+
break;
|
|
10130
|
+
}
|
|
10131
|
+
case ServerMsgCode.FEED_MESSAGES_DELETED: {
|
|
10132
|
+
for (const mid of message.messageIds) {
|
|
10133
|
+
for (const [requestId, pending] of [...pendingFeedMutations]) {
|
|
10134
|
+
if (pending.kind === "delete-message" && pending.feedId === message.feedId && pending.messageId === mid) {
|
|
10135
|
+
settleFeedMutation(requestId, "ok");
|
|
10136
|
+
}
|
|
10137
|
+
}
|
|
10138
|
+
}
|
|
10139
|
+
break;
|
|
10140
|
+
}
|
|
10141
|
+
default:
|
|
10142
|
+
break;
|
|
10143
|
+
}
|
|
10144
|
+
}
|
|
9889
10145
|
function processInitialStorage(nodes) {
|
|
9890
10146
|
const unacknowledgedOps = new Map(context.unacknowledgedOps);
|
|
9891
10147
|
createOrUpdateRootFromMessage(nodes);
|
|
9892
10148
|
applyAndSendOfflineOps(unacknowledgedOps);
|
|
9893
|
-
_optionalChain([_resolveStoragePromise, 'optionalCall',
|
|
10149
|
+
_optionalChain([_resolveStoragePromise, 'optionalCall', _228 => _228()]);
|
|
9894
10150
|
notifyStorageStatus();
|
|
9895
10151
|
eventHub.storageDidLoad.notify();
|
|
9896
10152
|
}
|
|
@@ -9908,7 +10164,7 @@ function createRoom(options, config) {
|
|
|
9908
10164
|
} else if (!messages.some((msg) => msg.type === ClientMsgCode.FETCH_STORAGE)) {
|
|
9909
10165
|
messages.push({ type: ClientMsgCode.FETCH_STORAGE });
|
|
9910
10166
|
nodeMapBuffer.take();
|
|
9911
|
-
_optionalChain([stopwatch, 'optionalAccess',
|
|
10167
|
+
_optionalChain([stopwatch, 'optionalAccess', _229 => _229.start, 'call', _230 => _230()]);
|
|
9912
10168
|
}
|
|
9913
10169
|
if (options2.flush) {
|
|
9914
10170
|
flushNowOrSoon();
|
|
@@ -9957,6 +10213,138 @@ function createRoom(options, config) {
|
|
|
9957
10213
|
}
|
|
9958
10214
|
flushNowOrSoon();
|
|
9959
10215
|
}
|
|
10216
|
+
async function fetchFeeds(options2) {
|
|
10217
|
+
const requestId = nanoid();
|
|
10218
|
+
const { promise, resolve, reject } = Promise_withResolvers();
|
|
10219
|
+
pendingFeedsRequests.set(requestId, { resolve, reject });
|
|
10220
|
+
const message = {
|
|
10221
|
+
type: ClientMsgCode.FETCH_FEEDS,
|
|
10222
|
+
requestId,
|
|
10223
|
+
cursor: _optionalChain([options2, 'optionalAccess', _231 => _231.cursor]),
|
|
10224
|
+
since: _optionalChain([options2, 'optionalAccess', _232 => _232.since]),
|
|
10225
|
+
limit: _optionalChain([options2, 'optionalAccess', _233 => _233.limit]),
|
|
10226
|
+
metadata: _optionalChain([options2, 'optionalAccess', _234 => _234.metadata])
|
|
10227
|
+
};
|
|
10228
|
+
context.buffer.messages.push(message);
|
|
10229
|
+
flushNowOrSoon();
|
|
10230
|
+
setTimeout(() => {
|
|
10231
|
+
if (pendingFeedsRequests.has(requestId)) {
|
|
10232
|
+
pendingFeedsRequests.delete(requestId);
|
|
10233
|
+
reject(new Error("Feeds fetch timeout"));
|
|
10234
|
+
}
|
|
10235
|
+
}, FEEDS_TIMEOUT);
|
|
10236
|
+
return promise;
|
|
10237
|
+
}
|
|
10238
|
+
async function fetchFeedMessages(feedId, options2) {
|
|
10239
|
+
const requestId = nanoid();
|
|
10240
|
+
const { promise, resolve, reject } = Promise_withResolvers();
|
|
10241
|
+
pendingFeedMessagesRequests.set(requestId, { resolve, reject });
|
|
10242
|
+
const message = {
|
|
10243
|
+
type: ClientMsgCode.FETCH_FEED_MESSAGES,
|
|
10244
|
+
requestId,
|
|
10245
|
+
feedId,
|
|
10246
|
+
cursor: _optionalChain([options2, 'optionalAccess', _235 => _235.cursor]),
|
|
10247
|
+
since: _optionalChain([options2, 'optionalAccess', _236 => _236.since]),
|
|
10248
|
+
limit: _optionalChain([options2, 'optionalAccess', _237 => _237.limit])
|
|
10249
|
+
};
|
|
10250
|
+
context.buffer.messages.push(message);
|
|
10251
|
+
flushNowOrSoon();
|
|
10252
|
+
setTimeout(() => {
|
|
10253
|
+
if (pendingFeedMessagesRequests.has(requestId)) {
|
|
10254
|
+
pendingFeedMessagesRequests.delete(requestId);
|
|
10255
|
+
reject(new Error("Feed messages fetch timeout"));
|
|
10256
|
+
}
|
|
10257
|
+
}, FEEDS_TIMEOUT);
|
|
10258
|
+
return promise;
|
|
10259
|
+
}
|
|
10260
|
+
function addFeed(feedId, options2) {
|
|
10261
|
+
const requestId = nanoid();
|
|
10262
|
+
const promise = registerFeedMutation(requestId, "add-feed", feedId);
|
|
10263
|
+
const message = {
|
|
10264
|
+
type: ClientMsgCode.ADD_FEED,
|
|
10265
|
+
requestId,
|
|
10266
|
+
feedId,
|
|
10267
|
+
metadata: _optionalChain([options2, 'optionalAccess', _238 => _238.metadata]),
|
|
10268
|
+
createdAt: _optionalChain([options2, 'optionalAccess', _239 => _239.createdAt])
|
|
10269
|
+
};
|
|
10270
|
+
context.buffer.messages.push(message);
|
|
10271
|
+
flushNowOrSoon();
|
|
10272
|
+
return promise;
|
|
10273
|
+
}
|
|
10274
|
+
function updateFeed(feedId, metadata) {
|
|
10275
|
+
const requestId = nanoid();
|
|
10276
|
+
const promise = registerFeedMutation(requestId, "update-feed", feedId);
|
|
10277
|
+
const message = {
|
|
10278
|
+
type: ClientMsgCode.UPDATE_FEED,
|
|
10279
|
+
requestId,
|
|
10280
|
+
feedId,
|
|
10281
|
+
metadata
|
|
10282
|
+
};
|
|
10283
|
+
context.buffer.messages.push(message);
|
|
10284
|
+
flushNowOrSoon();
|
|
10285
|
+
return promise;
|
|
10286
|
+
}
|
|
10287
|
+
function deleteFeed(feedId) {
|
|
10288
|
+
const requestId = nanoid();
|
|
10289
|
+
const promise = registerFeedMutation(requestId, "delete-feed", feedId);
|
|
10290
|
+
const message = {
|
|
10291
|
+
type: ClientMsgCode.DELETE_FEED,
|
|
10292
|
+
requestId,
|
|
10293
|
+
feedId
|
|
10294
|
+
};
|
|
10295
|
+
context.buffer.messages.push(message);
|
|
10296
|
+
flushNowOrSoon();
|
|
10297
|
+
return promise;
|
|
10298
|
+
}
|
|
10299
|
+
function addFeedMessage(feedId, data, options2) {
|
|
10300
|
+
const requestId = nanoid();
|
|
10301
|
+
const promise = registerFeedMutation(requestId, "add-message", feedId, {
|
|
10302
|
+
expectedClientMessageId: _optionalChain([options2, 'optionalAccess', _240 => _240.id])
|
|
10303
|
+
});
|
|
10304
|
+
const message = {
|
|
10305
|
+
type: ClientMsgCode.ADD_FEED_MESSAGE,
|
|
10306
|
+
requestId,
|
|
10307
|
+
feedId,
|
|
10308
|
+
data,
|
|
10309
|
+
id: _optionalChain([options2, 'optionalAccess', _241 => _241.id]),
|
|
10310
|
+
createdAt: _optionalChain([options2, 'optionalAccess', _242 => _242.createdAt])
|
|
10311
|
+
};
|
|
10312
|
+
context.buffer.messages.push(message);
|
|
10313
|
+
flushNowOrSoon();
|
|
10314
|
+
return promise;
|
|
10315
|
+
}
|
|
10316
|
+
function updateFeedMessage(feedId, messageId, data, options2) {
|
|
10317
|
+
const requestId = nanoid();
|
|
10318
|
+
const promise = registerFeedMutation(requestId, "update-message", feedId, {
|
|
10319
|
+
messageId
|
|
10320
|
+
});
|
|
10321
|
+
const message = {
|
|
10322
|
+
type: ClientMsgCode.UPDATE_FEED_MESSAGE,
|
|
10323
|
+
requestId,
|
|
10324
|
+
feedId,
|
|
10325
|
+
messageId,
|
|
10326
|
+
data,
|
|
10327
|
+
updatedAt: _optionalChain([options2, 'optionalAccess', _243 => _243.updatedAt])
|
|
10328
|
+
};
|
|
10329
|
+
context.buffer.messages.push(message);
|
|
10330
|
+
flushNowOrSoon();
|
|
10331
|
+
return promise;
|
|
10332
|
+
}
|
|
10333
|
+
function deleteFeedMessage(feedId, messageId) {
|
|
10334
|
+
const requestId = nanoid();
|
|
10335
|
+
const promise = registerFeedMutation(requestId, "delete-message", feedId, {
|
|
10336
|
+
messageId
|
|
10337
|
+
});
|
|
10338
|
+
const message = {
|
|
10339
|
+
type: ClientMsgCode.DELETE_FEED_MESSAGE,
|
|
10340
|
+
requestId,
|
|
10341
|
+
feedId,
|
|
10342
|
+
messageId
|
|
10343
|
+
};
|
|
10344
|
+
context.buffer.messages.push(message);
|
|
10345
|
+
flushNowOrSoon();
|
|
10346
|
+
return promise;
|
|
10347
|
+
}
|
|
9960
10348
|
function undo() {
|
|
9961
10349
|
if (context.activeBatch) {
|
|
9962
10350
|
throw new Error("undo is not allowed during a batch");
|
|
@@ -10099,6 +10487,7 @@ function createRoom(options, config) {
|
|
|
10099
10487
|
storageStatus: eventHub.storageStatus.observable,
|
|
10100
10488
|
ydoc: eventHub.ydoc.observable,
|
|
10101
10489
|
comments: eventHub.comments.observable,
|
|
10490
|
+
feeds: eventHub.feeds.observable,
|
|
10102
10491
|
roomWillDestroy: eventHub.roomWillDestroy.observable
|
|
10103
10492
|
};
|
|
10104
10493
|
async function getThreadsSince(options2) {
|
|
@@ -10111,8 +10500,8 @@ function createRoom(options, config) {
|
|
|
10111
10500
|
async function getThreads(options2) {
|
|
10112
10501
|
return httpClient.getThreads({
|
|
10113
10502
|
roomId,
|
|
10114
|
-
query: _optionalChain([options2, 'optionalAccess',
|
|
10115
|
-
cursor: _optionalChain([options2, 'optionalAccess',
|
|
10503
|
+
query: _optionalChain([options2, 'optionalAccess', _244 => _244.query]),
|
|
10504
|
+
cursor: _optionalChain([options2, 'optionalAccess', _245 => _245.cursor])
|
|
10116
10505
|
});
|
|
10117
10506
|
}
|
|
10118
10507
|
async function getThread(threadId) {
|
|
@@ -10234,7 +10623,7 @@ function createRoom(options, config) {
|
|
|
10234
10623
|
function getSubscriptionSettings(options2) {
|
|
10235
10624
|
return httpClient.getSubscriptionSettings({
|
|
10236
10625
|
roomId,
|
|
10237
|
-
signal: _optionalChain([options2, 'optionalAccess',
|
|
10626
|
+
signal: _optionalChain([options2, 'optionalAccess', _246 => _246.signal])
|
|
10238
10627
|
});
|
|
10239
10628
|
}
|
|
10240
10629
|
function updateSubscriptionSettings(settings) {
|
|
@@ -10256,7 +10645,7 @@ function createRoom(options, config) {
|
|
|
10256
10645
|
{
|
|
10257
10646
|
[kInternal]: {
|
|
10258
10647
|
get presenceBuffer() {
|
|
10259
|
-
return deepClone(_nullishCoalesce(_optionalChain([context, 'access',
|
|
10648
|
+
return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _247 => _247.buffer, 'access', _248 => _248.presenceUpdates, 'optionalAccess', _249 => _249.data]), () => ( null)));
|
|
10260
10649
|
},
|
|
10261
10650
|
// prettier-ignore
|
|
10262
10651
|
get undoStack() {
|
|
@@ -10271,9 +10660,9 @@ function createRoom(options, config) {
|
|
|
10271
10660
|
return context.yjsProvider;
|
|
10272
10661
|
},
|
|
10273
10662
|
setYjsProvider(newProvider) {
|
|
10274
|
-
_optionalChain([context, 'access',
|
|
10663
|
+
_optionalChain([context, 'access', _250 => _250.yjsProvider, 'optionalAccess', _251 => _251.off, 'call', _252 => _252("status", yjsStatusDidChange)]);
|
|
10275
10664
|
context.yjsProvider = newProvider;
|
|
10276
|
-
_optionalChain([newProvider, 'optionalAccess',
|
|
10665
|
+
_optionalChain([newProvider, 'optionalAccess', _253 => _253.on, 'call', _254 => _254("status", yjsStatusDidChange)]);
|
|
10277
10666
|
context.yjsProviderDidChange.notify();
|
|
10278
10667
|
},
|
|
10279
10668
|
yjsProviderDidChange: context.yjsProviderDidChange.observable,
|
|
@@ -10308,19 +10697,25 @@ function createRoom(options, config) {
|
|
|
10308
10697
|
id: roomId,
|
|
10309
10698
|
subscribe: makeClassicSubscribeFn(
|
|
10310
10699
|
roomId,
|
|
10311
|
-
|
|
10700
|
+
eventHub,
|
|
10312
10701
|
config.errorEventSource
|
|
10313
10702
|
),
|
|
10314
10703
|
connect: () => managedSocket.connect(),
|
|
10315
10704
|
reconnect: () => managedSocket.reconnect(),
|
|
10316
10705
|
disconnect: () => managedSocket.disconnect(),
|
|
10317
10706
|
destroy: () => {
|
|
10707
|
+
pendingFeedsRequests.forEach(
|
|
10708
|
+
(request) => request.reject(new Error("Room destroyed"))
|
|
10709
|
+
);
|
|
10710
|
+
pendingFeedMessagesRequests.forEach(
|
|
10711
|
+
(request) => request.reject(new Error("Room destroyed"))
|
|
10712
|
+
);
|
|
10318
10713
|
const { roomWillDestroy, ...eventsExceptDestroy } = eventHub;
|
|
10319
10714
|
for (const source of Object.values(eventsExceptDestroy)) {
|
|
10320
10715
|
source.dispose();
|
|
10321
10716
|
}
|
|
10322
10717
|
eventHub.roomWillDestroy.notify();
|
|
10323
|
-
_optionalChain([context, 'access',
|
|
10718
|
+
_optionalChain([context, 'access', _255 => _255.yjsProvider, 'optionalAccess', _256 => _256.off, 'call', _257 => _257("status", yjsStatusDidChange)]);
|
|
10324
10719
|
syncSourceForStorage.destroy();
|
|
10325
10720
|
syncSourceForYjs.destroy();
|
|
10326
10721
|
uninstallBgTabSpy();
|
|
@@ -10343,6 +10738,14 @@ function createRoom(options, config) {
|
|
|
10343
10738
|
resume: resumeHistory
|
|
10344
10739
|
},
|
|
10345
10740
|
fetchYDoc,
|
|
10741
|
+
fetchFeeds,
|
|
10742
|
+
fetchFeedMessages,
|
|
10743
|
+
addFeed,
|
|
10744
|
+
updateFeed,
|
|
10745
|
+
deleteFeed,
|
|
10746
|
+
addFeedMessage,
|
|
10747
|
+
updateFeedMessage,
|
|
10748
|
+
deleteFeedMessage,
|
|
10346
10749
|
getStorage,
|
|
10347
10750
|
getStorageSnapshot,
|
|
10348
10751
|
getStorageStatus,
|
|
@@ -10471,7 +10874,7 @@ function makeClassicSubscribeFn(roomId, events, errorEvents) {
|
|
|
10471
10874
|
}
|
|
10472
10875
|
if (isLiveNode(first)) {
|
|
10473
10876
|
const node = first;
|
|
10474
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
10877
|
+
if (_optionalChain([options, 'optionalAccess', _258 => _258.isDeep])) {
|
|
10475
10878
|
const storageCallback = second;
|
|
10476
10879
|
return subscribeToLiveStructureDeeply(node, storageCallback);
|
|
10477
10880
|
} else {
|
|
@@ -10557,8 +10960,8 @@ function createClient(options) {
|
|
|
10557
10960
|
const authManager = createAuthManager(options, (token) => {
|
|
10558
10961
|
currentUserId.set(() => token.uid);
|
|
10559
10962
|
});
|
|
10560
|
-
const fetchPolyfill = _optionalChain([clientOptions, 'access',
|
|
10561
|
-
_optionalChain([globalThis, 'access',
|
|
10963
|
+
const fetchPolyfill = _optionalChain([clientOptions, 'access', _259 => _259.polyfills, 'optionalAccess', _260 => _260.fetch]) || /* istanbul ignore next */
|
|
10964
|
+
_optionalChain([globalThis, 'access', _261 => _261.fetch, 'optionalAccess', _262 => _262.bind, 'call', _263 => _263(globalThis)]);
|
|
10562
10965
|
const httpClient = createApiClient({
|
|
10563
10966
|
baseUrl,
|
|
10564
10967
|
fetchPolyfill,
|
|
@@ -10576,7 +10979,7 @@ function createClient(options) {
|
|
|
10576
10979
|
delegates: {
|
|
10577
10980
|
createSocket: makeCreateSocketDelegateForAi(
|
|
10578
10981
|
baseUrl,
|
|
10579
|
-
_optionalChain([clientOptions, 'access',
|
|
10982
|
+
_optionalChain([clientOptions, 'access', _264 => _264.polyfills, 'optionalAccess', _265 => _265.WebSocket])
|
|
10580
10983
|
),
|
|
10581
10984
|
authenticate: async () => {
|
|
10582
10985
|
const resp = await authManager.getAuthValue({
|
|
@@ -10636,7 +11039,7 @@ function createClient(options) {
|
|
|
10636
11039
|
createSocket: makeCreateSocketDelegateForRoom(
|
|
10637
11040
|
roomId,
|
|
10638
11041
|
baseUrl,
|
|
10639
|
-
_optionalChain([clientOptions, 'access',
|
|
11042
|
+
_optionalChain([clientOptions, 'access', _266 => _266.polyfills, 'optionalAccess', _267 => _267.WebSocket])
|
|
10640
11043
|
),
|
|
10641
11044
|
authenticate: makeAuthDelegateForRoom(roomId, authManager)
|
|
10642
11045
|
})),
|
|
@@ -10659,7 +11062,7 @@ function createClient(options) {
|
|
|
10659
11062
|
const shouldConnect = _nullishCoalesce(options2.autoConnect, () => ( true));
|
|
10660
11063
|
if (shouldConnect) {
|
|
10661
11064
|
if (typeof atob === "undefined") {
|
|
10662
|
-
if (_optionalChain([clientOptions, 'access',
|
|
11065
|
+
if (_optionalChain([clientOptions, 'access', _268 => _268.polyfills, 'optionalAccess', _269 => _269.atob]) === void 0) {
|
|
10663
11066
|
throw new Error(
|
|
10664
11067
|
"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"
|
|
10665
11068
|
);
|
|
@@ -10671,7 +11074,7 @@ function createClient(options) {
|
|
|
10671
11074
|
return leaseRoom(newRoomDetails);
|
|
10672
11075
|
}
|
|
10673
11076
|
function getRoom(roomId) {
|
|
10674
|
-
const room = _optionalChain([roomsById, 'access',
|
|
11077
|
+
const room = _optionalChain([roomsById, 'access', _270 => _270.get, 'call', _271 => _271(roomId), 'optionalAccess', _272 => _272.room]);
|
|
10675
11078
|
return room ? room : null;
|
|
10676
11079
|
}
|
|
10677
11080
|
function logout() {
|
|
@@ -10687,7 +11090,7 @@ function createClient(options) {
|
|
|
10687
11090
|
const batchedResolveUsers = new Batch(
|
|
10688
11091
|
async (batchedUserIds) => {
|
|
10689
11092
|
const userIds = batchedUserIds.flat();
|
|
10690
|
-
const users = await _optionalChain([resolveUsers, 'optionalCall',
|
|
11093
|
+
const users = await _optionalChain([resolveUsers, 'optionalCall', _273 => _273({ userIds })]);
|
|
10691
11094
|
warnOnceIf(
|
|
10692
11095
|
!resolveUsers,
|
|
10693
11096
|
"Set the resolveUsers option in createClient to specify user info."
|
|
@@ -10704,7 +11107,7 @@ function createClient(options) {
|
|
|
10704
11107
|
const batchedResolveRoomsInfo = new Batch(
|
|
10705
11108
|
async (batchedRoomIds) => {
|
|
10706
11109
|
const roomIds = batchedRoomIds.flat();
|
|
10707
|
-
const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall',
|
|
11110
|
+
const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall', _274 => _274({ roomIds })]);
|
|
10708
11111
|
warnOnceIf(
|
|
10709
11112
|
!resolveRoomsInfo,
|
|
10710
11113
|
"Set the resolveRoomsInfo option in createClient to specify room info."
|
|
@@ -10721,7 +11124,7 @@ function createClient(options) {
|
|
|
10721
11124
|
const batchedResolveGroupsInfo = new Batch(
|
|
10722
11125
|
async (batchedGroupIds) => {
|
|
10723
11126
|
const groupIds = batchedGroupIds.flat();
|
|
10724
|
-
const groupsInfo = await _optionalChain([resolveGroupsInfo, 'optionalCall',
|
|
11127
|
+
const groupsInfo = await _optionalChain([resolveGroupsInfo, 'optionalCall', _275 => _275({ groupIds })]);
|
|
10725
11128
|
warnOnceIf(
|
|
10726
11129
|
!resolveGroupsInfo,
|
|
10727
11130
|
"Set the resolveGroupsInfo option in createClient to specify group info."
|
|
@@ -10777,7 +11180,7 @@ function createClient(options) {
|
|
|
10777
11180
|
}
|
|
10778
11181
|
};
|
|
10779
11182
|
const win = typeof window !== "undefined" ? window : void 0;
|
|
10780
|
-
_optionalChain([win, 'optionalAccess',
|
|
11183
|
+
_optionalChain([win, 'optionalAccess', _276 => _276.addEventListener, 'call', _277 => _277("beforeunload", maybePreventClose)]);
|
|
10781
11184
|
}
|
|
10782
11185
|
async function getNotificationSettings(options2) {
|
|
10783
11186
|
const plainSettings = await httpClient.getNotificationSettings(options2);
|
|
@@ -10904,7 +11307,7 @@ var commentBodyElementsTypes = {
|
|
|
10904
11307
|
mention: "inline"
|
|
10905
11308
|
};
|
|
10906
11309
|
function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
|
|
10907
|
-
if (!body || !_optionalChain([body, 'optionalAccess',
|
|
11310
|
+
if (!body || !_optionalChain([body, 'optionalAccess', _278 => _278.content])) {
|
|
10908
11311
|
return;
|
|
10909
11312
|
}
|
|
10910
11313
|
const element = typeof elementOrVisitor === "string" ? elementOrVisitor : void 0;
|
|
@@ -10914,13 +11317,13 @@ function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
|
|
|
10914
11317
|
for (const block of body.content) {
|
|
10915
11318
|
if (type === "all" || type === "block") {
|
|
10916
11319
|
if (guard(block)) {
|
|
10917
|
-
_optionalChain([visitor, 'optionalCall',
|
|
11320
|
+
_optionalChain([visitor, 'optionalCall', _279 => _279(block)]);
|
|
10918
11321
|
}
|
|
10919
11322
|
}
|
|
10920
11323
|
if (type === "all" || type === "inline") {
|
|
10921
11324
|
for (const inline of block.children) {
|
|
10922
11325
|
if (guard(inline)) {
|
|
10923
|
-
_optionalChain([visitor, 'optionalCall',
|
|
11326
|
+
_optionalChain([visitor, 'optionalCall', _280 => _280(inline)]);
|
|
10924
11327
|
}
|
|
10925
11328
|
}
|
|
10926
11329
|
}
|
|
@@ -11090,7 +11493,7 @@ var stringifyCommentBodyPlainElements = {
|
|
|
11090
11493
|
text: ({ element }) => element.text,
|
|
11091
11494
|
link: ({ element }) => _nullishCoalesce(element.text, () => ( element.url)),
|
|
11092
11495
|
mention: ({ element, user, group }) => {
|
|
11093
|
-
return `@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
11496
|
+
return `@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _281 => _281.name]), () => ( _optionalChain([group, 'optionalAccess', _282 => _282.name]))), () => ( element.id))}`;
|
|
11094
11497
|
}
|
|
11095
11498
|
};
|
|
11096
11499
|
var stringifyCommentBodyHtmlElements = {
|
|
@@ -11120,7 +11523,7 @@ var stringifyCommentBodyHtmlElements = {
|
|
|
11120
11523
|
return html`<a href="${href}" target="_blank" rel="noopener noreferrer">${element.text ? html`${element.text}` : element.url}</a>`;
|
|
11121
11524
|
},
|
|
11122
11525
|
mention: ({ element, user, group }) => {
|
|
11123
|
-
return html`<span data-mention>@${_optionalChain([user, 'optionalAccess',
|
|
11526
|
+
return html`<span data-mention>@${_optionalChain([user, 'optionalAccess', _283 => _283.name]) ? html`${_optionalChain([user, 'optionalAccess', _284 => _284.name])}` : _optionalChain([group, 'optionalAccess', _285 => _285.name]) ? html`${_optionalChain([group, 'optionalAccess', _286 => _286.name])}` : element.id}</span>`;
|
|
11124
11527
|
}
|
|
11125
11528
|
};
|
|
11126
11529
|
var stringifyCommentBodyMarkdownElements = {
|
|
@@ -11150,20 +11553,20 @@ var stringifyCommentBodyMarkdownElements = {
|
|
|
11150
11553
|
return markdown`[${_nullishCoalesce(element.text, () => ( element.url))}](${href})`;
|
|
11151
11554
|
},
|
|
11152
11555
|
mention: ({ element, user, group }) => {
|
|
11153
|
-
return markdown`@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
11556
|
+
return markdown`@${_nullishCoalesce(_nullishCoalesce(_optionalChain([user, 'optionalAccess', _287 => _287.name]), () => ( _optionalChain([group, 'optionalAccess', _288 => _288.name]))), () => ( element.id))}`;
|
|
11154
11557
|
}
|
|
11155
11558
|
};
|
|
11156
11559
|
async function stringifyCommentBody(body, options) {
|
|
11157
|
-
const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
11158
|
-
const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
11560
|
+
const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _289 => _289.format]), () => ( "plain"));
|
|
11561
|
+
const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _290 => _290.separator]), () => ( (format === "markdown" ? "\n\n" : "\n")));
|
|
11159
11562
|
const elements = {
|
|
11160
11563
|
...format === "html" ? stringifyCommentBodyHtmlElements : format === "markdown" ? stringifyCommentBodyMarkdownElements : stringifyCommentBodyPlainElements,
|
|
11161
|
-
..._optionalChain([options, 'optionalAccess',
|
|
11564
|
+
..._optionalChain([options, 'optionalAccess', _291 => _291.elements])
|
|
11162
11565
|
};
|
|
11163
11566
|
const { users: resolvedUsers, groups: resolvedGroupsInfo } = await resolveMentionsInCommentBody(
|
|
11164
11567
|
body,
|
|
11165
|
-
_optionalChain([options, 'optionalAccess',
|
|
11166
|
-
_optionalChain([options, 'optionalAccess',
|
|
11568
|
+
_optionalChain([options, 'optionalAccess', _292 => _292.resolveUsers]),
|
|
11569
|
+
_optionalChain([options, 'optionalAccess', _293 => _293.resolveGroupsInfo])
|
|
11167
11570
|
);
|
|
11168
11571
|
const blocks = body.content.flatMap((block, blockIndex) => {
|
|
11169
11572
|
switch (block.type) {
|
|
@@ -11450,12 +11853,12 @@ function legacy_patchImmutableNode(state, path, update) {
|
|
|
11450
11853
|
}
|
|
11451
11854
|
const newState = Object.assign({}, state);
|
|
11452
11855
|
for (const key in update.updates) {
|
|
11453
|
-
if (_optionalChain([update, 'access',
|
|
11856
|
+
if (_optionalChain([update, 'access', _294 => _294.updates, 'access', _295 => _295[key], 'optionalAccess', _296 => _296.type]) === "update") {
|
|
11454
11857
|
const val = update.node.get(key);
|
|
11455
11858
|
if (val !== void 0) {
|
|
11456
11859
|
newState[key] = lsonToJson(val);
|
|
11457
11860
|
}
|
|
11458
|
-
} else if (_optionalChain([update, 'access',
|
|
11861
|
+
} else if (_optionalChain([update, 'access', _297 => _297.updates, 'access', _298 => _298[key], 'optionalAccess', _299 => _299.type]) === "delete") {
|
|
11459
11862
|
delete newState[key];
|
|
11460
11863
|
}
|
|
11461
11864
|
}
|
|
@@ -11516,12 +11919,12 @@ function legacy_patchImmutableNode(state, path, update) {
|
|
|
11516
11919
|
}
|
|
11517
11920
|
const newState = Object.assign({}, state);
|
|
11518
11921
|
for (const key in update.updates) {
|
|
11519
|
-
if (_optionalChain([update, 'access',
|
|
11922
|
+
if (_optionalChain([update, 'access', _300 => _300.updates, 'access', _301 => _301[key], 'optionalAccess', _302 => _302.type]) === "update") {
|
|
11520
11923
|
const value = update.node.get(key);
|
|
11521
11924
|
if (value !== void 0) {
|
|
11522
11925
|
newState[key] = lsonToJson(value);
|
|
11523
11926
|
}
|
|
11524
|
-
} else if (_optionalChain([update, 'access',
|
|
11927
|
+
} else if (_optionalChain([update, 'access', _303 => _303.updates, 'access', _304 => _304[key], 'optionalAccess', _305 => _305.type]) === "delete") {
|
|
11525
11928
|
delete newState[key];
|
|
11526
11929
|
}
|
|
11527
11930
|
}
|
|
@@ -11601,9 +12004,9 @@ function makePoller(callback, intervalMs, options) {
|
|
|
11601
12004
|
const startTime = performance.now();
|
|
11602
12005
|
const doc = typeof document !== "undefined" ? document : void 0;
|
|
11603
12006
|
const win = typeof window !== "undefined" ? window : void 0;
|
|
11604
|
-
const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
12007
|
+
const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _306 => _306.maxStaleTimeMs]), () => ( Number.POSITIVE_INFINITY));
|
|
11605
12008
|
const context = {
|
|
11606
|
-
inForeground: _optionalChain([doc, 'optionalAccess',
|
|
12009
|
+
inForeground: _optionalChain([doc, 'optionalAccess', _307 => _307.visibilityState]) !== "hidden",
|
|
11607
12010
|
lastSuccessfulPollAt: startTime,
|
|
11608
12011
|
count: 0,
|
|
11609
12012
|
backoff: 0
|
|
@@ -11684,11 +12087,11 @@ function makePoller(callback, intervalMs, options) {
|
|
|
11684
12087
|
pollNowIfStale();
|
|
11685
12088
|
}
|
|
11686
12089
|
function onVisibilityChange() {
|
|
11687
|
-
setInForeground(_optionalChain([doc, 'optionalAccess',
|
|
12090
|
+
setInForeground(_optionalChain([doc, 'optionalAccess', _308 => _308.visibilityState]) !== "hidden");
|
|
11688
12091
|
}
|
|
11689
|
-
_optionalChain([doc, 'optionalAccess',
|
|
11690
|
-
_optionalChain([win, 'optionalAccess',
|
|
11691
|
-
_optionalChain([win, 'optionalAccess',
|
|
12092
|
+
_optionalChain([doc, 'optionalAccess', _309 => _309.addEventListener, 'call', _310 => _310("visibilitychange", onVisibilityChange)]);
|
|
12093
|
+
_optionalChain([win, 'optionalAccess', _311 => _311.addEventListener, 'call', _312 => _312("online", onVisibilityChange)]);
|
|
12094
|
+
_optionalChain([win, 'optionalAccess', _313 => _313.addEventListener, 'call', _314 => _314("focus", pollNowIfStale)]);
|
|
11692
12095
|
fsm.start();
|
|
11693
12096
|
return {
|
|
11694
12097
|
inc,
|
|
@@ -11827,5 +12230,6 @@ detectDupes(PKG_NAME, PKG_VERSION, PKG_FORMAT);
|
|
|
11827
12230
|
|
|
11828
12231
|
|
|
11829
12232
|
|
|
11830
|
-
|
|
12233
|
+
|
|
12234
|
+
exports.ClientMsgCode = ClientMsgCode; exports.CrdtType = CrdtType; exports.DefaultMap = DefaultMap; exports.Deque = Deque; exports.DerivedSignal = DerivedSignal; exports.FeedRequestErrorCode = FeedRequestErrorCode; exports.HttpError = HttpError; exports.LiveList = LiveList; exports.LiveMap = LiveMap; exports.LiveObject = LiveObject; exports.LiveblocksError = LiveblocksError; exports.MENTION_CHARACTER = MENTION_CHARACTER; exports.MutableSignal = MutableSignal; exports.OpCode = OpCode; exports.Permission = Permission; exports.Promise_withResolvers = Promise_withResolvers; exports.ServerMsgCode = ServerMsgCode; exports.Signal = Signal; exports.SortedList = SortedList; exports.TextEditorType = TextEditorType; exports.WebsocketCloseCodes = WebsocketCloseCodes; exports.asPos = asPos; exports.assert = assert; exports.assertNever = assertNever; exports.autoRetry = autoRetry; exports.b64decode = b64decode; exports.batch = batch; exports.checkBounds = checkBounds; exports.chunk = chunk; exports.cloneLson = cloneLson; exports.compactNodesToNodeStream = compactNodesToNodeStream; exports.compactObject = compactObject; exports.console = fancy_console_exports; exports.convertToCommentData = convertToCommentData; exports.convertToCommentUserReaction = convertToCommentUserReaction; exports.convertToGroupData = convertToGroupData; exports.convertToInboxNotificationData = convertToInboxNotificationData; exports.convertToSubscriptionData = convertToSubscriptionData; exports.convertToThreadData = convertToThreadData; exports.convertToUserSubscriptionData = convertToUserSubscriptionData; exports.createClient = createClient; exports.createCommentAttachmentId = createCommentAttachmentId; exports.createCommentId = createCommentId; exports.createInboxNotificationId = createInboxNotificationId; exports.createManagedPool = createManagedPool; exports.createNotificationSettings = createNotificationSettings; exports.createThreadId = createThreadId; exports.defineAiTool = defineAiTool; exports.deprecate = deprecate; exports.deprecateIf = deprecateIf; exports.detectDupes = detectDupes; exports.entries = entries; exports.errorIf = errorIf; exports.findLastIndex = findLastIndex; exports.freeze = freeze; exports.generateUrl = generateUrl; exports.getMentionsFromCommentBody = getMentionsFromCommentBody; exports.getSubscriptionKey = getSubscriptionKey; exports.html = html; exports.htmlSafe = htmlSafe; exports.isCommentBodyLink = isCommentBodyLink; exports.isCommentBodyMention = isCommentBodyMention; exports.isCommentBodyText = isCommentBodyText; exports.isJsonArray = isJsonArray; exports.isJsonObject = isJsonObject; exports.isJsonScalar = isJsonScalar; exports.isListStorageNode = isListStorageNode; exports.isLiveNode = isLiveNode; exports.isMapStorageNode = isMapStorageNode; exports.isNotificationChannelEnabled = isNotificationChannelEnabled; exports.isNumberOperator = isNumberOperator; exports.isObjectStorageNode = isObjectStorageNode; exports.isPlainObject = isPlainObject; exports.isRegisterStorageNode = isRegisterStorageNode; exports.isRootStorageNode = isRootStorageNode; exports.isStartsWithOperator = isStartsWithOperator; exports.isUrl = isUrl; exports.kInternal = kInternal; exports.keys = keys; exports.legacy_patchImmutableObject = legacy_patchImmutableObject; exports.lsonToJson = lsonToJson; exports.makeAbortController = makeAbortController; exports.makeEventSource = makeEventSource; exports.makePoller = makePoller; exports.makePosition = makePosition; exports.mapValues = mapValues; exports.memoizeOnSuccess = memoizeOnSuccess; exports.nanoid = nanoid; exports.nn = nn; exports.nodeStreamToCompactNodes = nodeStreamToCompactNodes; exports.objectToQuery = objectToQuery; exports.patchLiveObjectKey = patchLiveObjectKey; exports.patchNotificationSettings = patchNotificationSettings; exports.raise = raise; exports.resolveMentionsInCommentBody = resolveMentionsInCommentBody; exports.sanitizeUrl = sanitizeUrl; exports.shallow = shallow; exports.shallow2 = shallow2; exports.stableStringify = stableStringify; exports.stringifyCommentBody = stringifyCommentBody; exports.throwUsageError = throwUsageError; exports.toPlainLson = toPlainLson; exports.tryParseJson = tryParseJson; exports.url = url; exports.urljoin = urljoin; exports.wait = wait; exports.warnOnce = warnOnce; exports.warnOnceIf = warnOnceIf; exports.withTimeout = withTimeout;
|
|
11831
12235
|
//# sourceMappingURL=index.cjs.map
|