@liveblocks/core 2.16.0-toolbars4 → 2.17.0-channels1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +157 -49
- package/dist/index.d.ts +157 -49
- package/dist/index.js +148 -111
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +53 -16
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ var __export = (target, all) => {
|
|
|
6
6
|
|
|
7
7
|
// src/version.ts
|
|
8
8
|
var PKG_NAME = "@liveblocks/core";
|
|
9
|
-
var PKG_VERSION = "2.
|
|
9
|
+
var PKG_VERSION = "2.17.0-channels1";
|
|
10
10
|
var PKG_FORMAT = "cjs";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -173,6 +173,12 @@ function raise(msg) {
|
|
|
173
173
|
function entries(obj) {
|
|
174
174
|
return Object.entries(obj);
|
|
175
175
|
}
|
|
176
|
+
function keys(obj) {
|
|
177
|
+
return Object.keys(obj);
|
|
178
|
+
}
|
|
179
|
+
function values(obj) {
|
|
180
|
+
return Object.values(obj);
|
|
181
|
+
}
|
|
176
182
|
function mapValues(obj, mapFn) {
|
|
177
183
|
const result = {};
|
|
178
184
|
for (const pair of Object.entries(obj)) {
|
|
@@ -1038,9 +1044,9 @@ function urljoin(baseUrl, path, params) {
|
|
|
1038
1044
|
}
|
|
1039
1045
|
return url2.toString();
|
|
1040
1046
|
}
|
|
1041
|
-
function url(strings, ...
|
|
1047
|
+
function url(strings, ...values2) {
|
|
1042
1048
|
return strings.reduce(
|
|
1043
|
-
(result, str, i) => result + encodeURIComponent(_nullishCoalesce(
|
|
1049
|
+
(result, str, i) => result + encodeURIComponent(_nullishCoalesce(values2[i - 1], () => ( ""))) + str
|
|
1044
1050
|
);
|
|
1045
1051
|
}
|
|
1046
1052
|
|
|
@@ -1685,9 +1691,24 @@ function createApiClient({
|
|
|
1685
1691
|
await authManager.getAuthValue({ requestedScope: "comments:read" })
|
|
1686
1692
|
);
|
|
1687
1693
|
}
|
|
1694
|
+
async function getChannelsNotificationSettings(options) {
|
|
1695
|
+
return httpClient.get(
|
|
1696
|
+
url`/v2/c/channels-notification-settings`,
|
|
1697
|
+
await authManager.getAuthValue({ requestedScope: "comments:read" }),
|
|
1698
|
+
void 0,
|
|
1699
|
+
{ signal: _optionalChain([options, 'optionalAccess', _16 => _16.signal]) }
|
|
1700
|
+
);
|
|
1701
|
+
}
|
|
1702
|
+
async function updateChannelsNotificationSettings(settings) {
|
|
1703
|
+
return httpClient.post(
|
|
1704
|
+
url`/v2/c/channels-notification-settings`,
|
|
1705
|
+
await authManager.getAuthValue({ requestedScope: "comments:read" }),
|
|
1706
|
+
settings
|
|
1707
|
+
);
|
|
1708
|
+
}
|
|
1688
1709
|
async function getUserThreads_experimental(options) {
|
|
1689
1710
|
let query;
|
|
1690
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
1711
|
+
if (_optionalChain([options, 'optionalAccess', _17 => _17.query])) {
|
|
1691
1712
|
query = objectToQuery(options.query);
|
|
1692
1713
|
}
|
|
1693
1714
|
const PAGE_SIZE = 50;
|
|
@@ -1695,7 +1716,7 @@ function createApiClient({
|
|
|
1695
1716
|
url`/v2/c/threads`,
|
|
1696
1717
|
await authManager.getAuthValue({ requestedScope: "comments:read" }),
|
|
1697
1718
|
{
|
|
1698
|
-
cursor: _optionalChain([options, 'optionalAccess',
|
|
1719
|
+
cursor: _optionalChain([options, 'optionalAccess', _18 => _18.cursor]),
|
|
1699
1720
|
query,
|
|
1700
1721
|
limit: PAGE_SIZE
|
|
1701
1722
|
}
|
|
@@ -1750,7 +1771,9 @@ function createApiClient({
|
|
|
1750
1771
|
// Room notifications
|
|
1751
1772
|
markRoomInboxNotificationAsRead,
|
|
1752
1773
|
updateNotificationSettings,
|
|
1774
|
+
// Channel notification settings
|
|
1753
1775
|
getNotificationSettings,
|
|
1776
|
+
updateChannelsNotificationSettings,
|
|
1754
1777
|
// Room text editor
|
|
1755
1778
|
createTextMention,
|
|
1756
1779
|
deleteTextMention,
|
|
@@ -1774,6 +1797,7 @@ function createApiClient({
|
|
|
1774
1797
|
markInboxNotificationAsRead,
|
|
1775
1798
|
deleteAllInboxNotifications,
|
|
1776
1799
|
deleteInboxNotification,
|
|
1800
|
+
getChannelsNotificationSettings,
|
|
1777
1801
|
// User threads
|
|
1778
1802
|
getUserThreads_experimental,
|
|
1779
1803
|
getUserThreadsSince_experimental
|
|
@@ -1820,7 +1844,7 @@ var HttpClient = class {
|
|
|
1820
1844
|
// These headers are default, but can be overriden by custom headers
|
|
1821
1845
|
"Content-Type": "application/json; charset=utf-8",
|
|
1822
1846
|
// Possible header overrides
|
|
1823
|
-
..._optionalChain([options, 'optionalAccess',
|
|
1847
|
+
..._optionalChain([options, 'optionalAccess', _19 => _19.headers]),
|
|
1824
1848
|
// Cannot be overriden by custom headers
|
|
1825
1849
|
Authorization: `Bearer ${getBearerTokenFromAuthValue(authValue)}`,
|
|
1826
1850
|
"X-LB-Client": PKG_VERSION || "dev"
|
|
@@ -2302,7 +2326,7 @@ var FSM = class {
|
|
|
2302
2326
|
});
|
|
2303
2327
|
}
|
|
2304
2328
|
#getTargetFn(eventName) {
|
|
2305
|
-
return _optionalChain([this, 'access',
|
|
2329
|
+
return _optionalChain([this, 'access', _20 => _20.#allowedTransitions, 'access', _21 => _21.get, 'call', _22 => _22(this.currentState), 'optionalAccess', _23 => _23.get, 'call', _24 => _24(eventName)]);
|
|
2306
2330
|
}
|
|
2307
2331
|
/**
|
|
2308
2332
|
* Exits the current state, and executes any necessary cleanup functions.
|
|
@@ -2319,7 +2343,7 @@ var FSM = class {
|
|
|
2319
2343
|
this.#currentContext.allowPatching((patchableContext) => {
|
|
2320
2344
|
levels = _nullishCoalesce(levels, () => ( this.#cleanupStack.length));
|
|
2321
2345
|
for (let i = 0; i < levels; i++) {
|
|
2322
|
-
_optionalChain([this, 'access',
|
|
2346
|
+
_optionalChain([this, 'access', _25 => _25.#cleanupStack, 'access', _26 => _26.pop, 'call', _27 => _27(), 'optionalCall', _28 => _28(patchableContext)]);
|
|
2323
2347
|
}
|
|
2324
2348
|
});
|
|
2325
2349
|
}
|
|
@@ -2335,7 +2359,7 @@ var FSM = class {
|
|
|
2335
2359
|
this.#currentContext.allowPatching((patchableContext) => {
|
|
2336
2360
|
for (const pattern of enterPatterns) {
|
|
2337
2361
|
const enterFn = this.#enterFns.get(pattern);
|
|
2338
|
-
const cleanupFn = _optionalChain([enterFn, 'optionalCall',
|
|
2362
|
+
const cleanupFn = _optionalChain([enterFn, 'optionalCall', _29 => _29(patchableContext)]);
|
|
2339
2363
|
if (typeof cleanupFn === "function") {
|
|
2340
2364
|
this.#cleanupStack.push(cleanupFn);
|
|
2341
2365
|
} else {
|
|
@@ -2737,7 +2761,7 @@ function createConnectionStateMachine(delegates, options) {
|
|
|
2737
2761
|
}
|
|
2738
2762
|
function waitForActorId(event) {
|
|
2739
2763
|
const serverMsg = tryParseJson(event.data);
|
|
2740
|
-
if (_optionalChain([serverMsg, 'optionalAccess',
|
|
2764
|
+
if (_optionalChain([serverMsg, 'optionalAccess', _30 => _30.type]) === 104 /* ROOM_STATE */) {
|
|
2741
2765
|
didReceiveActor();
|
|
2742
2766
|
}
|
|
2743
2767
|
}
|
|
@@ -2846,12 +2870,12 @@ function createConnectionStateMachine(delegates, options) {
|
|
|
2846
2870
|
const sendHeartbeat = {
|
|
2847
2871
|
target: "@ok.awaiting-pong",
|
|
2848
2872
|
effect: (ctx) => {
|
|
2849
|
-
_optionalChain([ctx, 'access',
|
|
2873
|
+
_optionalChain([ctx, 'access', _31 => _31.socket, 'optionalAccess', _32 => _32.send, 'call', _33 => _33("ping")]);
|
|
2850
2874
|
}
|
|
2851
2875
|
};
|
|
2852
2876
|
const maybeHeartbeat = () => {
|
|
2853
2877
|
const doc = typeof document !== "undefined" ? document : void 0;
|
|
2854
|
-
const canZombie = _optionalChain([doc, 'optionalAccess',
|
|
2878
|
+
const canZombie = _optionalChain([doc, 'optionalAccess', _34 => _34.visibilityState]) === "hidden" && delegates.canZombie();
|
|
2855
2879
|
return canZombie ? "@idle.zombie" : sendHeartbeat;
|
|
2856
2880
|
};
|
|
2857
2881
|
machine.addTimedTransition("@ok.connected", HEARTBEAT_INTERVAL, maybeHeartbeat).addTransitions("@ok.connected", {
|
|
@@ -2890,7 +2914,7 @@ function createConnectionStateMachine(delegates, options) {
|
|
|
2890
2914
|
// socket, or not. So always check to see if the socket is still OPEN or
|
|
2891
2915
|
// not. When still OPEN, don't transition.
|
|
2892
2916
|
EXPLICIT_SOCKET_ERROR: (_, context) => {
|
|
2893
|
-
if (_optionalChain([context, 'access',
|
|
2917
|
+
if (_optionalChain([context, 'access', _35 => _35.socket, 'optionalAccess', _36 => _36.readyState]) === 1) {
|
|
2894
2918
|
return null;
|
|
2895
2919
|
}
|
|
2896
2920
|
return {
|
|
@@ -2942,17 +2966,17 @@ function createConnectionStateMachine(delegates, options) {
|
|
|
2942
2966
|
machine.send({ type: "NAVIGATOR_ONLINE" });
|
|
2943
2967
|
}
|
|
2944
2968
|
function onVisibilityChange() {
|
|
2945
|
-
if (_optionalChain([doc, 'optionalAccess',
|
|
2969
|
+
if (_optionalChain([doc, 'optionalAccess', _37 => _37.visibilityState]) === "visible") {
|
|
2946
2970
|
machine.send({ type: "WINDOW_GOT_FOCUS" });
|
|
2947
2971
|
}
|
|
2948
2972
|
}
|
|
2949
|
-
_optionalChain([win, 'optionalAccess',
|
|
2950
|
-
_optionalChain([win, 'optionalAccess',
|
|
2951
|
-
_optionalChain([root, 'optionalAccess',
|
|
2973
|
+
_optionalChain([win, 'optionalAccess', _38 => _38.addEventListener, 'call', _39 => _39("online", onNetworkBackOnline)]);
|
|
2974
|
+
_optionalChain([win, 'optionalAccess', _40 => _40.addEventListener, 'call', _41 => _41("offline", onNetworkOffline)]);
|
|
2975
|
+
_optionalChain([root, 'optionalAccess', _42 => _42.addEventListener, 'call', _43 => _43("visibilitychange", onVisibilityChange)]);
|
|
2952
2976
|
return () => {
|
|
2953
|
-
_optionalChain([root, 'optionalAccess',
|
|
2954
|
-
_optionalChain([win, 'optionalAccess',
|
|
2955
|
-
_optionalChain([win, 'optionalAccess',
|
|
2977
|
+
_optionalChain([root, 'optionalAccess', _44 => _44.removeEventListener, 'call', _45 => _45("visibilitychange", onVisibilityChange)]);
|
|
2978
|
+
_optionalChain([win, 'optionalAccess', _46 => _46.removeEventListener, 'call', _47 => _47("online", onNetworkBackOnline)]);
|
|
2979
|
+
_optionalChain([win, 'optionalAccess', _48 => _48.removeEventListener, 'call', _49 => _49("offline", onNetworkOffline)]);
|
|
2956
2980
|
teardownSocket(ctx.socket);
|
|
2957
2981
|
};
|
|
2958
2982
|
});
|
|
@@ -3041,7 +3065,7 @@ var ManagedSocket = class {
|
|
|
3041
3065
|
* message if this is somehow impossible.
|
|
3042
3066
|
*/
|
|
3043
3067
|
send(data) {
|
|
3044
|
-
const socket = _optionalChain([this, 'access',
|
|
3068
|
+
const socket = _optionalChain([this, 'access', _50 => _50.#machine, 'access', _51 => _51.context, 'optionalAccess', _52 => _52.socket]);
|
|
3045
3069
|
if (socket === null) {
|
|
3046
3070
|
warn("Cannot send: not connected yet", data);
|
|
3047
3071
|
} else if (socket.readyState !== 1) {
|
|
@@ -3145,7 +3169,7 @@ function createAuthManager(authOptions, onAuthenticate) {
|
|
|
3145
3169
|
return void 0;
|
|
3146
3170
|
}
|
|
3147
3171
|
async function makeAuthRequest(options) {
|
|
3148
|
-
const fetcher = _nullishCoalesce(_optionalChain([authOptions, 'access',
|
|
3172
|
+
const fetcher = _nullishCoalesce(_optionalChain([authOptions, 'access', _53 => _53.polyfills, 'optionalAccess', _54 => _54.fetch]), () => ( (typeof window === "undefined" ? void 0 : window.fetch)));
|
|
3149
3173
|
if (authentication.type === "private") {
|
|
3150
3174
|
if (fetcher === void 0) {
|
|
3151
3175
|
throw new StopRetrying(
|
|
@@ -3161,7 +3185,7 @@ function createAuthManager(authOptions, onAuthenticate) {
|
|
|
3161
3185
|
"The same Liveblocks auth token was issued from the backend before. Caching Liveblocks tokens is not supported."
|
|
3162
3186
|
);
|
|
3163
3187
|
}
|
|
3164
|
-
_optionalChain([onAuthenticate, 'optionalCall',
|
|
3188
|
+
_optionalChain([onAuthenticate, 'optionalCall', _55 => _55(parsed.parsed)]);
|
|
3165
3189
|
return parsed;
|
|
3166
3190
|
}
|
|
3167
3191
|
if (authentication.type === "custom") {
|
|
@@ -3169,7 +3193,7 @@ function createAuthManager(authOptions, onAuthenticate) {
|
|
|
3169
3193
|
if (response && typeof response === "object") {
|
|
3170
3194
|
if (typeof response.token === "string") {
|
|
3171
3195
|
const parsed = parseAuthToken(response.token);
|
|
3172
|
-
_optionalChain([onAuthenticate, 'optionalCall',
|
|
3196
|
+
_optionalChain([onAuthenticate, 'optionalCall', _56 => _56(parsed.parsed)]);
|
|
3173
3197
|
return parsed;
|
|
3174
3198
|
} else if (typeof response.error === "string") {
|
|
3175
3199
|
const reason = `Authentication failed: ${"reason" in response && typeof response.reason === "string" ? response.reason : "Forbidden"}`;
|
|
@@ -3330,7 +3354,7 @@ function sendToPanel(message, options) {
|
|
|
3330
3354
|
...message,
|
|
3331
3355
|
source: "liveblocks-devtools-client"
|
|
3332
3356
|
};
|
|
3333
|
-
if (!(_optionalChain([options, 'optionalAccess',
|
|
3357
|
+
if (!(_optionalChain([options, 'optionalAccess', _57 => _57.force]) || _bridgeActive)) {
|
|
3334
3358
|
return;
|
|
3335
3359
|
}
|
|
3336
3360
|
window.postMessage(fullMsg, "*");
|
|
@@ -3338,7 +3362,7 @@ function sendToPanel(message, options) {
|
|
|
3338
3362
|
var eventSource = makeEventSource();
|
|
3339
3363
|
if (process.env.NODE_ENV !== "production" && typeof window !== "undefined") {
|
|
3340
3364
|
window.addEventListener("message", (event) => {
|
|
3341
|
-
if (event.source === window && _optionalChain([event, 'access',
|
|
3365
|
+
if (event.source === window && _optionalChain([event, 'access', _58 => _58.data, 'optionalAccess', _59 => _59.source]) === "liveblocks-devtools-panel") {
|
|
3342
3366
|
eventSource.notify(event.data);
|
|
3343
3367
|
} else {
|
|
3344
3368
|
}
|
|
@@ -3480,7 +3504,7 @@ function fullSync(room) {
|
|
|
3480
3504
|
msg: "room::sync::full",
|
|
3481
3505
|
roomId: room.id,
|
|
3482
3506
|
status: room.getStatus(),
|
|
3483
|
-
storage: _nullishCoalesce(_optionalChain([root, 'optionalAccess',
|
|
3507
|
+
storage: _nullishCoalesce(_optionalChain([root, 'optionalAccess', _60 => _60.toTreeNode, 'call', _61 => _61("root"), 'access', _62 => _62.payload]), () => ( null)),
|
|
3484
3508
|
me,
|
|
3485
3509
|
others
|
|
3486
3510
|
});
|
|
@@ -3904,7 +3928,7 @@ var LiveRegister = class _LiveRegister extends AbstractCrdt {
|
|
|
3904
3928
|
return [
|
|
3905
3929
|
{
|
|
3906
3930
|
type: 8 /* CREATE_REGISTER */,
|
|
3907
|
-
opId: _optionalChain([pool, 'optionalAccess',
|
|
3931
|
+
opId: _optionalChain([pool, 'optionalAccess', _63 => _63.generateOpId, 'call', _64 => _64()]),
|
|
3908
3932
|
id: this._id,
|
|
3909
3933
|
parentId,
|
|
3910
3934
|
parentKey,
|
|
@@ -4010,7 +4034,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
4010
4034
|
const ops = [];
|
|
4011
4035
|
const op = {
|
|
4012
4036
|
id: this._id,
|
|
4013
|
-
opId: _optionalChain([pool, 'optionalAccess',
|
|
4037
|
+
opId: _optionalChain([pool, 'optionalAccess', _65 => _65.generateOpId, 'call', _66 => _66()]),
|
|
4014
4038
|
type: 2 /* CREATE_LIST */,
|
|
4015
4039
|
parentId,
|
|
4016
4040
|
parentKey
|
|
@@ -4281,7 +4305,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
4281
4305
|
#applyInsertUndoRedo(op) {
|
|
4282
4306
|
const { id, parentKey: key } = op;
|
|
4283
4307
|
const child = creationOpToLiveNode(op);
|
|
4284
|
-
if (_optionalChain([this, 'access',
|
|
4308
|
+
if (_optionalChain([this, 'access', _67 => _67._pool, 'optionalAccess', _68 => _68.getNode, 'call', _69 => _69(id)]) !== void 0) {
|
|
4285
4309
|
return { modified: false };
|
|
4286
4310
|
}
|
|
4287
4311
|
child._attach(id, nn(this._pool));
|
|
@@ -4289,8 +4313,8 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
4289
4313
|
const existingItemIndex = this._indexOfPosition(key);
|
|
4290
4314
|
let newKey = key;
|
|
4291
4315
|
if (existingItemIndex !== -1) {
|
|
4292
|
-
const before2 = _optionalChain([this, 'access',
|
|
4293
|
-
const after2 = _optionalChain([this, 'access',
|
|
4316
|
+
const before2 = _optionalChain([this, 'access', _70 => _70.#items, 'access', _71 => _71[existingItemIndex], 'optionalAccess', _72 => _72._parentPos]);
|
|
4317
|
+
const after2 = _optionalChain([this, 'access', _73 => _73.#items, 'access', _74 => _74[existingItemIndex + 1], 'optionalAccess', _75 => _75._parentPos]);
|
|
4294
4318
|
newKey = makePosition(before2, after2);
|
|
4295
4319
|
child._setParentLink(this, newKey);
|
|
4296
4320
|
}
|
|
@@ -4304,7 +4328,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
4304
4328
|
#applySetUndoRedo(op) {
|
|
4305
4329
|
const { id, parentKey: key } = op;
|
|
4306
4330
|
const child = creationOpToLiveNode(op);
|
|
4307
|
-
if (_optionalChain([this, 'access',
|
|
4331
|
+
if (_optionalChain([this, 'access', _76 => _76._pool, 'optionalAccess', _77 => _77.getNode, 'call', _78 => _78(id)]) !== void 0) {
|
|
4308
4332
|
return { modified: false };
|
|
4309
4333
|
}
|
|
4310
4334
|
this.#unacknowledgedSets.set(key, nn(op.opId));
|
|
@@ -4425,7 +4449,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
4425
4449
|
} else {
|
|
4426
4450
|
this.#items[existingItemIndex]._setParentLink(
|
|
4427
4451
|
this,
|
|
4428
|
-
makePosition(newKey, _optionalChain([this, 'access',
|
|
4452
|
+
makePosition(newKey, _optionalChain([this, 'access', _79 => _79.#items, 'access', _80 => _80[existingItemIndex + 1], 'optionalAccess', _81 => _81._parentPos]))
|
|
4429
4453
|
);
|
|
4430
4454
|
const previousIndex = this.#items.indexOf(child);
|
|
4431
4455
|
child._setParentLink(this, newKey);
|
|
@@ -4450,7 +4474,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
4450
4474
|
if (existingItemIndex !== -1) {
|
|
4451
4475
|
this.#items[existingItemIndex]._setParentLink(
|
|
4452
4476
|
this,
|
|
4453
|
-
makePosition(newKey, _optionalChain([this, 'access',
|
|
4477
|
+
makePosition(newKey, _optionalChain([this, 'access', _82 => _82.#items, 'access', _83 => _83[existingItemIndex + 1], 'optionalAccess', _84 => _84._parentPos]))
|
|
4454
4478
|
);
|
|
4455
4479
|
}
|
|
4456
4480
|
child._setParentLink(this, newKey);
|
|
@@ -4469,7 +4493,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
4469
4493
|
if (existingItemIndex !== -1) {
|
|
4470
4494
|
this.#items[existingItemIndex]._setParentLink(
|
|
4471
4495
|
this,
|
|
4472
|
-
makePosition(newKey, _optionalChain([this, 'access',
|
|
4496
|
+
makePosition(newKey, _optionalChain([this, 'access', _85 => _85.#items, 'access', _86 => _86[existingItemIndex + 1], 'optionalAccess', _87 => _87._parentPos]))
|
|
4473
4497
|
);
|
|
4474
4498
|
}
|
|
4475
4499
|
child._setParentLink(this, newKey);
|
|
@@ -4496,7 +4520,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
4496
4520
|
if (existingItemIndex !== -1) {
|
|
4497
4521
|
this.#items[existingItemIndex]._setParentLink(
|
|
4498
4522
|
this,
|
|
4499
|
-
makePosition(newKey, _optionalChain([this, 'access',
|
|
4523
|
+
makePosition(newKey, _optionalChain([this, 'access', _88 => _88.#items, 'access', _89 => _89[existingItemIndex + 1], 'optionalAccess', _90 => _90._parentPos]))
|
|
4500
4524
|
);
|
|
4501
4525
|
}
|
|
4502
4526
|
child._setParentLink(this, newKey);
|
|
@@ -4554,7 +4578,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
4554
4578
|
* @param element The element to add to the end of the LiveList.
|
|
4555
4579
|
*/
|
|
4556
4580
|
push(element) {
|
|
4557
|
-
_optionalChain([this, 'access',
|
|
4581
|
+
_optionalChain([this, 'access', _91 => _91._pool, 'optionalAccess', _92 => _92.assertStorageIsWritable, 'call', _93 => _93()]);
|
|
4558
4582
|
return this.insert(element, this.length);
|
|
4559
4583
|
}
|
|
4560
4584
|
/**
|
|
@@ -4563,7 +4587,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
4563
4587
|
* @param index The index at which you want to insert the element.
|
|
4564
4588
|
*/
|
|
4565
4589
|
insert(element, index) {
|
|
4566
|
-
_optionalChain([this, 'access',
|
|
4590
|
+
_optionalChain([this, 'access', _94 => _94._pool, 'optionalAccess', _95 => _95.assertStorageIsWritable, 'call', _96 => _96()]);
|
|
4567
4591
|
if (index < 0 || index > this.#items.length) {
|
|
4568
4592
|
throw new Error(
|
|
4569
4593
|
`Cannot insert list item at index "${index}". index should be between 0 and ${this.#items.length}`
|
|
@@ -4593,7 +4617,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
4593
4617
|
* @param targetIndex The index where the element should be after moving.
|
|
4594
4618
|
*/
|
|
4595
4619
|
move(index, targetIndex) {
|
|
4596
|
-
_optionalChain([this, 'access',
|
|
4620
|
+
_optionalChain([this, 'access', _97 => _97._pool, 'optionalAccess', _98 => _98.assertStorageIsWritable, 'call', _99 => _99()]);
|
|
4597
4621
|
if (targetIndex < 0) {
|
|
4598
4622
|
throw new Error("targetIndex cannot be less than 0");
|
|
4599
4623
|
}
|
|
@@ -4651,7 +4675,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
4651
4675
|
* @param index The index of the element to delete
|
|
4652
4676
|
*/
|
|
4653
4677
|
delete(index) {
|
|
4654
|
-
_optionalChain([this, 'access',
|
|
4678
|
+
_optionalChain([this, 'access', _100 => _100._pool, 'optionalAccess', _101 => _101.assertStorageIsWritable, 'call', _102 => _102()]);
|
|
4655
4679
|
if (index < 0 || index >= this.#items.length) {
|
|
4656
4680
|
throw new Error(
|
|
4657
4681
|
`Cannot delete list item at index "${index}". index should be between 0 and ${this.#items.length - 1}`
|
|
@@ -4684,7 +4708,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
4684
4708
|
}
|
|
4685
4709
|
}
|
|
4686
4710
|
clear() {
|
|
4687
|
-
_optionalChain([this, 'access',
|
|
4711
|
+
_optionalChain([this, 'access', _103 => _103._pool, 'optionalAccess', _104 => _104.assertStorageIsWritable, 'call', _105 => _105()]);
|
|
4688
4712
|
if (this._pool) {
|
|
4689
4713
|
const ops = [];
|
|
4690
4714
|
const reverseOps = [];
|
|
@@ -4718,7 +4742,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
4718
4742
|
}
|
|
4719
4743
|
}
|
|
4720
4744
|
set(index, item) {
|
|
4721
|
-
_optionalChain([this, 'access',
|
|
4745
|
+
_optionalChain([this, 'access', _106 => _106._pool, 'optionalAccess', _107 => _107.assertStorageIsWritable, 'call', _108 => _108()]);
|
|
4722
4746
|
if (index < 0 || index >= this.#items.length) {
|
|
4723
4747
|
throw new Error(
|
|
4724
4748
|
`Cannot set list item at index "${index}". index should be between 0 and ${this.#items.length - 1}`
|
|
@@ -4864,7 +4888,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
4864
4888
|
#shiftItemPosition(index, key) {
|
|
4865
4889
|
const shiftedPosition = makePosition(
|
|
4866
4890
|
key,
|
|
4867
|
-
this.#items.length > index + 1 ? _optionalChain([this, 'access',
|
|
4891
|
+
this.#items.length > index + 1 ? _optionalChain([this, 'access', _109 => _109.#items, 'access', _110 => _110[index + 1], 'optionalAccess', _111 => _111._parentPos]) : void 0
|
|
4868
4892
|
);
|
|
4869
4893
|
this.#items[index]._setParentLink(this, shiftedPosition);
|
|
4870
4894
|
}
|
|
@@ -4989,7 +5013,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
|
|
|
4989
5013
|
const ops = [];
|
|
4990
5014
|
const op = {
|
|
4991
5015
|
id: this._id,
|
|
4992
|
-
opId: _optionalChain([pool, 'optionalAccess',
|
|
5016
|
+
opId: _optionalChain([pool, 'optionalAccess', _112 => _112.generateOpId, 'call', _113 => _113()]),
|
|
4993
5017
|
type: 7 /* CREATE_MAP */,
|
|
4994
5018
|
parentId,
|
|
4995
5019
|
parentKey
|
|
@@ -5124,7 +5148,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
|
|
|
5124
5148
|
* @param value The value of the element to add. Should be serializable to JSON.
|
|
5125
5149
|
*/
|
|
5126
5150
|
set(key, value) {
|
|
5127
|
-
_optionalChain([this, 'access',
|
|
5151
|
+
_optionalChain([this, 'access', _114 => _114._pool, 'optionalAccess', _115 => _115.assertStorageIsWritable, 'call', _116 => _116()]);
|
|
5128
5152
|
const oldValue = this.#map.get(key);
|
|
5129
5153
|
if (oldValue) {
|
|
5130
5154
|
oldValue._detach();
|
|
@@ -5170,7 +5194,7 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
|
|
|
5170
5194
|
* @returns true if an element existed and has been removed, or false if the element does not exist.
|
|
5171
5195
|
*/
|
|
5172
5196
|
delete(key) {
|
|
5173
|
-
_optionalChain([this, 'access',
|
|
5197
|
+
_optionalChain([this, 'access', _117 => _117._pool, 'optionalAccess', _118 => _118.assertStorageIsWritable, 'call', _119 => _119()]);
|
|
5174
5198
|
const item = this.#map.get(key);
|
|
5175
5199
|
if (item === void 0) {
|
|
5176
5200
|
return false;
|
|
@@ -5349,7 +5373,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
|
|
|
5349
5373
|
if (this._id === void 0) {
|
|
5350
5374
|
throw new Error("Cannot serialize item is not attached");
|
|
5351
5375
|
}
|
|
5352
|
-
const opId = _optionalChain([pool, 'optionalAccess',
|
|
5376
|
+
const opId = _optionalChain([pool, 'optionalAccess', _120 => _120.generateOpId, 'call', _121 => _121()]);
|
|
5353
5377
|
const ops = [];
|
|
5354
5378
|
const op = {
|
|
5355
5379
|
type: 4 /* CREATE_OBJECT */,
|
|
@@ -5621,7 +5645,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
|
|
|
5621
5645
|
* @param value The value of the property to add
|
|
5622
5646
|
*/
|
|
5623
5647
|
set(key, value) {
|
|
5624
|
-
_optionalChain([this, 'access',
|
|
5648
|
+
_optionalChain([this, 'access', _122 => _122._pool, 'optionalAccess', _123 => _123.assertStorageIsWritable, 'call', _124 => _124()]);
|
|
5625
5649
|
this.update({ [key]: value });
|
|
5626
5650
|
}
|
|
5627
5651
|
/**
|
|
@@ -5636,7 +5660,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
|
|
|
5636
5660
|
* @param key The key of the property to delete
|
|
5637
5661
|
*/
|
|
5638
5662
|
delete(key) {
|
|
5639
|
-
_optionalChain([this, 'access',
|
|
5663
|
+
_optionalChain([this, 'access', _125 => _125._pool, 'optionalAccess', _126 => _126.assertStorageIsWritable, 'call', _127 => _127()]);
|
|
5640
5664
|
const keyAsString = key;
|
|
5641
5665
|
const oldValue = this.#map.get(keyAsString);
|
|
5642
5666
|
if (oldValue === void 0) {
|
|
@@ -5689,7 +5713,7 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
|
|
|
5689
5713
|
* @param patch The object used to overrides properties
|
|
5690
5714
|
*/
|
|
5691
5715
|
update(patch) {
|
|
5692
|
-
_optionalChain([this, 'access',
|
|
5716
|
+
_optionalChain([this, 'access', _128 => _128._pool, 'optionalAccess', _129 => _129.assertStorageIsWritable, 'call', _130 => _130()]);
|
|
5693
5717
|
if (this._pool === void 0 || this._id === void 0) {
|
|
5694
5718
|
for (const key in patch) {
|
|
5695
5719
|
const newValue = patch[key];
|
|
@@ -6261,15 +6285,15 @@ function installBackgroundTabSpy() {
|
|
|
6261
6285
|
const doc = typeof document !== "undefined" ? document : void 0;
|
|
6262
6286
|
const inBackgroundSince = { current: null };
|
|
6263
6287
|
function onVisibilityChange() {
|
|
6264
|
-
if (_optionalChain([doc, 'optionalAccess',
|
|
6288
|
+
if (_optionalChain([doc, 'optionalAccess', _131 => _131.visibilityState]) === "hidden") {
|
|
6265
6289
|
inBackgroundSince.current = _nullishCoalesce(inBackgroundSince.current, () => ( Date.now()));
|
|
6266
6290
|
} else {
|
|
6267
6291
|
inBackgroundSince.current = null;
|
|
6268
6292
|
}
|
|
6269
6293
|
}
|
|
6270
|
-
_optionalChain([doc, 'optionalAccess',
|
|
6294
|
+
_optionalChain([doc, 'optionalAccess', _132 => _132.addEventListener, 'call', _133 => _133("visibilitychange", onVisibilityChange)]);
|
|
6271
6295
|
const unsub = () => {
|
|
6272
|
-
_optionalChain([doc, 'optionalAccess',
|
|
6296
|
+
_optionalChain([doc, 'optionalAccess', _134 => _134.removeEventListener, 'call', _135 => _135("visibilitychange", onVisibilityChange)]);
|
|
6273
6297
|
};
|
|
6274
6298
|
return [inBackgroundSince, unsub];
|
|
6275
6299
|
}
|
|
@@ -6450,7 +6474,7 @@ function createRoom(options, config) {
|
|
|
6450
6474
|
}
|
|
6451
6475
|
},
|
|
6452
6476
|
assertStorageIsWritable: () => {
|
|
6453
|
-
const scopes = _optionalChain([context, 'access',
|
|
6477
|
+
const scopes = _optionalChain([context, 'access', _136 => _136.dynamicSessionInfoSig, 'access', _137 => _137.get, 'call', _138 => _138(), 'optionalAccess', _139 => _139.scopes]);
|
|
6454
6478
|
if (scopes === void 0) {
|
|
6455
6479
|
return;
|
|
6456
6480
|
}
|
|
@@ -6506,7 +6530,7 @@ function createRoom(options, config) {
|
|
|
6506
6530
|
}
|
|
6507
6531
|
function sendMessages(messages) {
|
|
6508
6532
|
const serializedPayload = JSON.stringify(messages);
|
|
6509
|
-
const nonce = _optionalChain([context, 'access',
|
|
6533
|
+
const nonce = _optionalChain([context, 'access', _140 => _140.dynamicSessionInfoSig, 'access', _141 => _141.get, 'call', _142 => _142(), 'optionalAccess', _143 => _143.nonce]);
|
|
6510
6534
|
if (config.unstable_fallbackToHTTP && nonce) {
|
|
6511
6535
|
const size = new TextEncoder().encode(serializedPayload).length;
|
|
6512
6536
|
if (size > MAX_SOCKET_MESSAGE_SIZE) {
|
|
@@ -6564,7 +6588,7 @@ function createRoom(options, config) {
|
|
|
6564
6588
|
} else {
|
|
6565
6589
|
context.root = LiveObject._fromItems(message.items, pool);
|
|
6566
6590
|
}
|
|
6567
|
-
const canWrite = _nullishCoalesce(_optionalChain([self, 'access',
|
|
6591
|
+
const canWrite = _nullishCoalesce(_optionalChain([self, 'access', _144 => _144.get, 'call', _145 => _145(), 'optionalAccess', _146 => _146.canWrite]), () => ( true));
|
|
6568
6592
|
const stackSizeBefore = context.undoStack.length;
|
|
6569
6593
|
for (const key in context.initialStorage) {
|
|
6570
6594
|
if (context.root.get(key) === void 0) {
|
|
@@ -6767,7 +6791,7 @@ function createRoom(options, config) {
|
|
|
6767
6791
|
}
|
|
6768
6792
|
context.myPresence.patch(patch);
|
|
6769
6793
|
if (context.activeBatch) {
|
|
6770
|
-
if (_optionalChain([options2, 'optionalAccess',
|
|
6794
|
+
if (_optionalChain([options2, 'optionalAccess', _147 => _147.addToHistory])) {
|
|
6771
6795
|
context.activeBatch.reverseOps.unshift({
|
|
6772
6796
|
type: "presence",
|
|
6773
6797
|
data: oldValues
|
|
@@ -6776,7 +6800,7 @@ function createRoom(options, config) {
|
|
|
6776
6800
|
context.activeBatch.updates.presence = true;
|
|
6777
6801
|
} else {
|
|
6778
6802
|
flushNowOrSoon();
|
|
6779
|
-
if (_optionalChain([options2, 'optionalAccess',
|
|
6803
|
+
if (_optionalChain([options2, 'optionalAccess', _148 => _148.addToHistory])) {
|
|
6780
6804
|
addToUndoStack([{ type: "presence", data: oldValues }]);
|
|
6781
6805
|
}
|
|
6782
6806
|
notify({ presence: true });
|
|
@@ -6973,7 +6997,7 @@ function createRoom(options, config) {
|
|
|
6973
6997
|
if (process.env.NODE_ENV !== "production") {
|
|
6974
6998
|
const traces = /* @__PURE__ */ new Set();
|
|
6975
6999
|
for (const opId of message.opIds) {
|
|
6976
|
-
const trace = _optionalChain([context, 'access',
|
|
7000
|
+
const trace = _optionalChain([context, 'access', _149 => _149.opStackTraces, 'optionalAccess', _150 => _150.get, 'call', _151 => _151(opId)]);
|
|
6977
7001
|
if (trace) {
|
|
6978
7002
|
traces.add(trace);
|
|
6979
7003
|
}
|
|
@@ -7071,11 +7095,12 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
7071
7095
|
}
|
|
7072
7096
|
return messages;
|
|
7073
7097
|
}
|
|
7074
|
-
function updateYDoc(update, guid) {
|
|
7098
|
+
function updateYDoc(update, guid, isV2) {
|
|
7075
7099
|
const clientMsg = {
|
|
7076
7100
|
type: 301 /* UPDATE_YDOC */,
|
|
7077
7101
|
update,
|
|
7078
|
-
guid
|
|
7102
|
+
guid,
|
|
7103
|
+
v2: isV2
|
|
7079
7104
|
};
|
|
7080
7105
|
context.buffer.messages.push(clientMsg);
|
|
7081
7106
|
eventHub.ydoc.notify(clientMsg);
|
|
@@ -7106,7 +7131,7 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
7106
7131
|
const unacknowledgedOps = new Map(context.unacknowledgedOps);
|
|
7107
7132
|
createOrUpdateRootFromMessage(message);
|
|
7108
7133
|
applyAndSendOps(unacknowledgedOps);
|
|
7109
|
-
_optionalChain([_resolveStoragePromise, 'optionalCall',
|
|
7134
|
+
_optionalChain([_resolveStoragePromise, 'optionalCall', _152 => _152()]);
|
|
7110
7135
|
notifyStorageStatus();
|
|
7111
7136
|
eventHub.storageDidLoad.notify();
|
|
7112
7137
|
}
|
|
@@ -7156,14 +7181,15 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
7156
7181
|
root: nn(context.root)
|
|
7157
7182
|
};
|
|
7158
7183
|
}
|
|
7159
|
-
function fetchYDoc(vector, guid) {
|
|
7184
|
+
function fetchYDoc(vector, guid, isV2) {
|
|
7160
7185
|
if (!context.buffer.messages.find((m) => {
|
|
7161
|
-
return m.type === 300 /* FETCH_YDOC */ && m.vector === vector && m.guid === guid;
|
|
7186
|
+
return m.type === 300 /* FETCH_YDOC */ && m.vector === vector && m.guid === guid && m.v2 === isV2;
|
|
7162
7187
|
})) {
|
|
7163
7188
|
context.buffer.messages.push({
|
|
7164
7189
|
type: 300 /* FETCH_YDOC */,
|
|
7165
7190
|
vector,
|
|
7166
|
-
guid
|
|
7191
|
+
guid,
|
|
7192
|
+
v2: isV2
|
|
7167
7193
|
});
|
|
7168
7194
|
}
|
|
7169
7195
|
flushNowOrSoon();
|
|
@@ -7328,8 +7354,8 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
7328
7354
|
async function getThreads(options2) {
|
|
7329
7355
|
return httpClient.getThreads({
|
|
7330
7356
|
roomId,
|
|
7331
|
-
query: _optionalChain([options2, 'optionalAccess',
|
|
7332
|
-
cursor: _optionalChain([options2, 'optionalAccess',
|
|
7357
|
+
query: _optionalChain([options2, 'optionalAccess', _153 => _153.query]),
|
|
7358
|
+
cursor: _optionalChain([options2, 'optionalAccess', _154 => _154.cursor])
|
|
7333
7359
|
});
|
|
7334
7360
|
}
|
|
7335
7361
|
async function getThread(threadId) {
|
|
@@ -7430,7 +7456,7 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
7430
7456
|
function getNotificationSettings(options2) {
|
|
7431
7457
|
return httpClient.getNotificationSettings({
|
|
7432
7458
|
roomId,
|
|
7433
|
-
signal: _optionalChain([options2, 'optionalAccess',
|
|
7459
|
+
signal: _optionalChain([options2, 'optionalAccess', _155 => _155.signal])
|
|
7434
7460
|
});
|
|
7435
7461
|
}
|
|
7436
7462
|
function updateNotificationSettings(settings) {
|
|
@@ -7452,7 +7478,7 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
7452
7478
|
{
|
|
7453
7479
|
[kInternal]: {
|
|
7454
7480
|
get presenceBuffer() {
|
|
7455
|
-
return deepClone(_nullishCoalesce(_optionalChain([context, 'access',
|
|
7481
|
+
return deepClone(_nullishCoalesce(_optionalChain([context, 'access', _156 => _156.buffer, 'access', _157 => _157.presenceUpdates, 'optionalAccess', _158 => _158.data]), () => ( null)));
|
|
7456
7482
|
},
|
|
7457
7483
|
// prettier-ignore
|
|
7458
7484
|
get undoStack() {
|
|
@@ -7467,9 +7493,9 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
7467
7493
|
return context.yjsProvider;
|
|
7468
7494
|
},
|
|
7469
7495
|
setYjsProvider(newProvider) {
|
|
7470
|
-
_optionalChain([context, 'access',
|
|
7496
|
+
_optionalChain([context, 'access', _159 => _159.yjsProvider, 'optionalAccess', _160 => _160.off, 'call', _161 => _161("status", yjsStatusDidChange)]);
|
|
7471
7497
|
context.yjsProvider = newProvider;
|
|
7472
|
-
_optionalChain([newProvider, 'optionalAccess',
|
|
7498
|
+
_optionalChain([newProvider, 'optionalAccess', _162 => _162.on, 'call', _163 => _163("status", yjsStatusDidChange)]);
|
|
7473
7499
|
context.yjsProviderDidChange.notify();
|
|
7474
7500
|
},
|
|
7475
7501
|
yjsProviderDidChange: context.yjsProviderDidChange.observable,
|
|
@@ -7505,7 +7531,7 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
7505
7531
|
disconnect: () => managedSocket.disconnect(),
|
|
7506
7532
|
destroy: () => {
|
|
7507
7533
|
syncSourceForStorage.destroy();
|
|
7508
|
-
_optionalChain([context, 'access',
|
|
7534
|
+
_optionalChain([context, 'access', _164 => _164.yjsProvider, 'optionalAccess', _165 => _165.off, 'call', _166 => _166("status", yjsStatusDidChange)]);
|
|
7509
7535
|
syncSourceForYjs.destroy();
|
|
7510
7536
|
uninstallBgTabSpy();
|
|
7511
7537
|
managedSocket.destroy();
|
|
@@ -7644,7 +7670,7 @@ function makeClassicSubscribeFn(events) {
|
|
|
7644
7670
|
}
|
|
7645
7671
|
if (isLiveNode(first)) {
|
|
7646
7672
|
const node = first;
|
|
7647
|
-
if (_optionalChain([options, 'optionalAccess',
|
|
7673
|
+
if (_optionalChain([options, 'optionalAccess', _167 => _167.isDeep])) {
|
|
7648
7674
|
const storageCallback = second;
|
|
7649
7675
|
return subscribeToLiveStructureDeeply(node, storageCallback);
|
|
7650
7676
|
} else {
|
|
@@ -7723,8 +7749,8 @@ function createClient(options) {
|
|
|
7723
7749
|
const userId = token.k === "sec-legacy" /* SECRET_LEGACY */ ? token.id : token.uid;
|
|
7724
7750
|
currentUserId.set(() => userId);
|
|
7725
7751
|
});
|
|
7726
|
-
const fetchPolyfill = _optionalChain([clientOptions, 'access',
|
|
7727
|
-
_optionalChain([globalThis, 'access',
|
|
7752
|
+
const fetchPolyfill = _optionalChain([clientOptions, 'access', _168 => _168.polyfills, 'optionalAccess', _169 => _169.fetch]) || /* istanbul ignore next */
|
|
7753
|
+
_optionalChain([globalThis, 'access', _170 => _170.fetch, 'optionalAccess', _171 => _171.bind, 'call', _172 => _172(globalThis)]);
|
|
7728
7754
|
const httpClient = createApiClient({
|
|
7729
7755
|
baseUrl,
|
|
7730
7756
|
fetchPolyfill,
|
|
@@ -7775,7 +7801,7 @@ function createClient(options) {
|
|
|
7775
7801
|
createSocket: makeCreateSocketDelegateForRoom(
|
|
7776
7802
|
roomId,
|
|
7777
7803
|
baseUrl,
|
|
7778
|
-
_optionalChain([clientOptions, 'access',
|
|
7804
|
+
_optionalChain([clientOptions, 'access', _173 => _173.polyfills, 'optionalAccess', _174 => _174.WebSocket])
|
|
7779
7805
|
),
|
|
7780
7806
|
authenticate: makeAuthDelegateForRoom(roomId, authManager)
|
|
7781
7807
|
})),
|
|
@@ -7797,7 +7823,7 @@ function createClient(options) {
|
|
|
7797
7823
|
const shouldConnect = _nullishCoalesce(options2.autoConnect, () => ( true));
|
|
7798
7824
|
if (shouldConnect) {
|
|
7799
7825
|
if (typeof atob === "undefined") {
|
|
7800
|
-
if (_optionalChain([clientOptions, 'access',
|
|
7826
|
+
if (_optionalChain([clientOptions, 'access', _175 => _175.polyfills, 'optionalAccess', _176 => _176.atob]) === void 0) {
|
|
7801
7827
|
throw new Error(
|
|
7802
7828
|
"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"
|
|
7803
7829
|
);
|
|
@@ -7809,7 +7835,7 @@ function createClient(options) {
|
|
|
7809
7835
|
return leaseRoom(newRoomDetails);
|
|
7810
7836
|
}
|
|
7811
7837
|
function getRoom(roomId) {
|
|
7812
|
-
const room = _optionalChain([roomsById, 'access',
|
|
7838
|
+
const room = _optionalChain([roomsById, 'access', _177 => _177.get, 'call', _178 => _178(roomId), 'optionalAccess', _179 => _179.room]);
|
|
7813
7839
|
return room ? room : null;
|
|
7814
7840
|
}
|
|
7815
7841
|
function logout() {
|
|
@@ -7829,7 +7855,7 @@ function createClient(options) {
|
|
|
7829
7855
|
const batchedResolveUsers = new Batch(
|
|
7830
7856
|
async (batchedUserIds) => {
|
|
7831
7857
|
const userIds = batchedUserIds.flat();
|
|
7832
|
-
const users = await _optionalChain([resolveUsers, 'optionalCall',
|
|
7858
|
+
const users = await _optionalChain([resolveUsers, 'optionalCall', _180 => _180({ userIds })]);
|
|
7833
7859
|
warnIfNoResolveUsers();
|
|
7834
7860
|
return _nullishCoalesce(users, () => ( userIds.map(() => void 0)));
|
|
7835
7861
|
},
|
|
@@ -7847,7 +7873,7 @@ function createClient(options) {
|
|
|
7847
7873
|
const batchedResolveRoomsInfo = new Batch(
|
|
7848
7874
|
async (batchedRoomIds) => {
|
|
7849
7875
|
const roomIds = batchedRoomIds.flat();
|
|
7850
|
-
const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall',
|
|
7876
|
+
const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall', _181 => _181({ roomIds })]);
|
|
7851
7877
|
warnIfNoResolveRoomsInfo();
|
|
7852
7878
|
return _nullishCoalesce(roomsInfo, () => ( roomIds.map(() => void 0)));
|
|
7853
7879
|
},
|
|
@@ -7899,7 +7925,7 @@ function createClient(options) {
|
|
|
7899
7925
|
}
|
|
7900
7926
|
};
|
|
7901
7927
|
const win = typeof window !== "undefined" ? window : void 0;
|
|
7902
|
-
_optionalChain([win, 'optionalAccess',
|
|
7928
|
+
_optionalChain([win, 'optionalAccess', _182 => _182.addEventListener, 'call', _183 => _183("beforeunload", maybePreventClose)]);
|
|
7903
7929
|
}
|
|
7904
7930
|
const client = Object.defineProperty(
|
|
7905
7931
|
{
|
|
@@ -7914,6 +7940,9 @@ function createClient(options) {
|
|
|
7914
7940
|
markInboxNotificationAsRead: httpClient.markInboxNotificationAsRead,
|
|
7915
7941
|
deleteAllInboxNotifications: httpClient.deleteAllInboxNotifications,
|
|
7916
7942
|
deleteInboxNotification: httpClient.deleteInboxNotification,
|
|
7943
|
+
// Public channel notification settings API
|
|
7944
|
+
getChannelsNotificationSettings: httpClient.getChannelsNotificationSettings,
|
|
7945
|
+
updateChannelsNotificationSettings: httpClient.updateChannelsNotificationSettings,
|
|
7917
7946
|
// Advanced resolvers APIs
|
|
7918
7947
|
resolvers: {
|
|
7919
7948
|
invalidateUsers: invalidateResolvedUsers,
|
|
@@ -8016,7 +8045,7 @@ var commentBodyElementsTypes = {
|
|
|
8016
8045
|
mention: "inline"
|
|
8017
8046
|
};
|
|
8018
8047
|
function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
|
|
8019
|
-
if (!body || !_optionalChain([body, 'optionalAccess',
|
|
8048
|
+
if (!body || !_optionalChain([body, 'optionalAccess', _184 => _184.content])) {
|
|
8020
8049
|
return;
|
|
8021
8050
|
}
|
|
8022
8051
|
const element = typeof elementOrVisitor === "string" ? elementOrVisitor : void 0;
|
|
@@ -8026,13 +8055,13 @@ function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
|
|
|
8026
8055
|
for (const block of body.content) {
|
|
8027
8056
|
if (type === "all" || type === "block") {
|
|
8028
8057
|
if (guard(block)) {
|
|
8029
|
-
_optionalChain([visitor, 'optionalCall',
|
|
8058
|
+
_optionalChain([visitor, 'optionalCall', _185 => _185(block)]);
|
|
8030
8059
|
}
|
|
8031
8060
|
}
|
|
8032
8061
|
if (type === "all" || type === "inline") {
|
|
8033
8062
|
for (const inline of block.children) {
|
|
8034
8063
|
if (guard(inline)) {
|
|
8035
|
-
_optionalChain([visitor, 'optionalCall',
|
|
8064
|
+
_optionalChain([visitor, 'optionalCall', _186 => _186(inline)]);
|
|
8036
8065
|
}
|
|
8037
8066
|
}
|
|
8038
8067
|
}
|
|
@@ -8057,7 +8086,7 @@ async function resolveUsersInCommentBody(body, resolveUsers) {
|
|
|
8057
8086
|
userIds
|
|
8058
8087
|
});
|
|
8059
8088
|
for (const [index, userId] of userIds.entries()) {
|
|
8060
|
-
const user = _optionalChain([users, 'optionalAccess',
|
|
8089
|
+
const user = _optionalChain([users, 'optionalAccess', _187 => _187[index]]);
|
|
8061
8090
|
if (user) {
|
|
8062
8091
|
resolvedUsers.set(userId, user);
|
|
8063
8092
|
}
|
|
@@ -8102,9 +8131,9 @@ function escapeHtml(value) {
|
|
|
8102
8131
|
var HtmlSafeString = class {
|
|
8103
8132
|
#strings;
|
|
8104
8133
|
#values;
|
|
8105
|
-
constructor(strings,
|
|
8134
|
+
constructor(strings, values2) {
|
|
8106
8135
|
this.#strings = strings;
|
|
8107
|
-
this.#values =
|
|
8136
|
+
this.#values = values2;
|
|
8108
8137
|
}
|
|
8109
8138
|
toString() {
|
|
8110
8139
|
return this.#strings.reduce((result, str, i) => {
|
|
@@ -8112,8 +8141,8 @@ var HtmlSafeString = class {
|
|
|
8112
8141
|
});
|
|
8113
8142
|
}
|
|
8114
8143
|
};
|
|
8115
|
-
function html(strings, ...
|
|
8116
|
-
return new HtmlSafeString(strings,
|
|
8144
|
+
function html(strings, ...values2) {
|
|
8145
|
+
return new HtmlSafeString(strings, values2);
|
|
8117
8146
|
}
|
|
8118
8147
|
var markdownEscapables = {
|
|
8119
8148
|
_: "\\_",
|
|
@@ -8158,9 +8187,9 @@ function escapeMarkdown(value) {
|
|
|
8158
8187
|
var MarkdownSafeString = class {
|
|
8159
8188
|
#strings;
|
|
8160
8189
|
#values;
|
|
8161
|
-
constructor(strings,
|
|
8190
|
+
constructor(strings, values2) {
|
|
8162
8191
|
this.#strings = strings;
|
|
8163
|
-
this.#values =
|
|
8192
|
+
this.#values = values2;
|
|
8164
8193
|
}
|
|
8165
8194
|
toString() {
|
|
8166
8195
|
return this.#strings.reduce((result, str, i) => {
|
|
@@ -8168,8 +8197,8 @@ var MarkdownSafeString = class {
|
|
|
8168
8197
|
});
|
|
8169
8198
|
}
|
|
8170
8199
|
};
|
|
8171
|
-
function markdown(strings, ...
|
|
8172
|
-
return new MarkdownSafeString(strings,
|
|
8200
|
+
function markdown(strings, ...values2) {
|
|
8201
|
+
return new MarkdownSafeString(strings, values2);
|
|
8173
8202
|
}
|
|
8174
8203
|
function toAbsoluteUrl(url2) {
|
|
8175
8204
|
if (url2.startsWith("http://") || url2.startsWith("https://")) {
|
|
@@ -8184,7 +8213,7 @@ var stringifyCommentBodyPlainElements = {
|
|
|
8184
8213
|
text: ({ element }) => element.text,
|
|
8185
8214
|
link: ({ element }) => _nullishCoalesce(element.text, () => ( element.url)),
|
|
8186
8215
|
mention: ({ element, user }) => {
|
|
8187
|
-
return `@${_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
8216
|
+
return `@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _188 => _188.name]), () => ( element.id))}`;
|
|
8188
8217
|
}
|
|
8189
8218
|
};
|
|
8190
8219
|
var stringifyCommentBodyHtmlElements = {
|
|
@@ -8214,7 +8243,7 @@ var stringifyCommentBodyHtmlElements = {
|
|
|
8214
8243
|
return html`<a href="${href}" target="_blank" rel="noopener noreferrer">${_nullishCoalesce(element.text, () => ( element.url))}</a>`;
|
|
8215
8244
|
},
|
|
8216
8245
|
mention: ({ element, user }) => {
|
|
8217
|
-
return html`<span data-mention>@${_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
8246
|
+
return html`<span data-mention>@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _189 => _189.name]), () => ( element.id))}</span>`;
|
|
8218
8247
|
}
|
|
8219
8248
|
};
|
|
8220
8249
|
var stringifyCommentBodyMarkdownElements = {
|
|
@@ -8244,19 +8273,19 @@ var stringifyCommentBodyMarkdownElements = {
|
|
|
8244
8273
|
return markdown`[${_nullishCoalesce(element.text, () => ( element.url))}](${href})`;
|
|
8245
8274
|
},
|
|
8246
8275
|
mention: ({ element, user }) => {
|
|
8247
|
-
return markdown`@${_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
8276
|
+
return markdown`@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _190 => _190.name]), () => ( element.id))}`;
|
|
8248
8277
|
}
|
|
8249
8278
|
};
|
|
8250
8279
|
async function stringifyCommentBody(body, options) {
|
|
8251
|
-
const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
8252
|
-
const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
8280
|
+
const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _191 => _191.format]), () => ( "plain"));
|
|
8281
|
+
const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _192 => _192.separator]), () => ( (format === "markdown" ? "\n\n" : "\n")));
|
|
8253
8282
|
const elements = {
|
|
8254
8283
|
...format === "html" ? stringifyCommentBodyHtmlElements : format === "markdown" ? stringifyCommentBodyMarkdownElements : stringifyCommentBodyPlainElements,
|
|
8255
|
-
..._optionalChain([options, 'optionalAccess',
|
|
8284
|
+
..._optionalChain([options, 'optionalAccess', _193 => _193.elements])
|
|
8256
8285
|
};
|
|
8257
8286
|
const resolvedUsers = await resolveUsersInCommentBody(
|
|
8258
8287
|
body,
|
|
8259
|
-
_optionalChain([options, 'optionalAccess',
|
|
8288
|
+
_optionalChain([options, 'optionalAccess', _194 => _194.resolveUsers])
|
|
8260
8289
|
);
|
|
8261
8290
|
const blocks = body.content.flatMap((block, blockIndex) => {
|
|
8262
8291
|
switch (block.type) {
|
|
@@ -8547,12 +8576,12 @@ function legacy_patchImmutableNode(state, path, update) {
|
|
|
8547
8576
|
}
|
|
8548
8577
|
const newState = Object.assign({}, state);
|
|
8549
8578
|
for (const key in update.updates) {
|
|
8550
|
-
if (_optionalChain([update, 'access',
|
|
8579
|
+
if (_optionalChain([update, 'access', _195 => _195.updates, 'access', _196 => _196[key], 'optionalAccess', _197 => _197.type]) === "update") {
|
|
8551
8580
|
const val = update.node.get(key);
|
|
8552
8581
|
if (val !== void 0) {
|
|
8553
8582
|
newState[key] = lsonToJson(val);
|
|
8554
8583
|
}
|
|
8555
|
-
} else if (_optionalChain([update, 'access',
|
|
8584
|
+
} else if (_optionalChain([update, 'access', _198 => _198.updates, 'access', _199 => _199[key], 'optionalAccess', _200 => _200.type]) === "delete") {
|
|
8556
8585
|
delete newState[key];
|
|
8557
8586
|
}
|
|
8558
8587
|
}
|
|
@@ -8613,12 +8642,12 @@ function legacy_patchImmutableNode(state, path, update) {
|
|
|
8613
8642
|
}
|
|
8614
8643
|
const newState = Object.assign({}, state);
|
|
8615
8644
|
for (const key in update.updates) {
|
|
8616
|
-
if (_optionalChain([update, 'access',
|
|
8645
|
+
if (_optionalChain([update, 'access', _201 => _201.updates, 'access', _202 => _202[key], 'optionalAccess', _203 => _203.type]) === "update") {
|
|
8617
8646
|
const value = update.node.get(key);
|
|
8618
8647
|
if (value !== void 0) {
|
|
8619
8648
|
newState[key] = lsonToJson(value);
|
|
8620
8649
|
}
|
|
8621
|
-
} else if (_optionalChain([update, 'access',
|
|
8650
|
+
} else if (_optionalChain([update, 'access', _204 => _204.updates, 'access', _205 => _205[key], 'optionalAccess', _206 => _206.type]) === "delete") {
|
|
8622
8651
|
delete newState[key];
|
|
8623
8652
|
}
|
|
8624
8653
|
}
|
|
@@ -8689,9 +8718,9 @@ function makePoller(callback, intervalMs, options) {
|
|
|
8689
8718
|
const startTime = performance.now();
|
|
8690
8719
|
const doc = typeof document !== "undefined" ? document : void 0;
|
|
8691
8720
|
const win = typeof window !== "undefined" ? window : void 0;
|
|
8692
|
-
const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
8721
|
+
const maxStaleTimeMs = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _207 => _207.maxStaleTimeMs]), () => ( Number.POSITIVE_INFINITY));
|
|
8693
8722
|
const context = {
|
|
8694
|
-
inForeground: _optionalChain([doc, 'optionalAccess',
|
|
8723
|
+
inForeground: _optionalChain([doc, 'optionalAccess', _208 => _208.visibilityState]) !== "hidden",
|
|
8695
8724
|
lastSuccessfulPollAt: startTime,
|
|
8696
8725
|
count: 0,
|
|
8697
8726
|
backoff: 0
|
|
@@ -8769,10 +8798,10 @@ function makePoller(callback, intervalMs, options) {
|
|
|
8769
8798
|
pollNowIfStale();
|
|
8770
8799
|
}
|
|
8771
8800
|
function onVisibilityChange() {
|
|
8772
|
-
setInForeground(_optionalChain([doc, 'optionalAccess',
|
|
8801
|
+
setInForeground(_optionalChain([doc, 'optionalAccess', _209 => _209.visibilityState]) !== "hidden");
|
|
8773
8802
|
}
|
|
8774
|
-
_optionalChain([doc, 'optionalAccess',
|
|
8775
|
-
_optionalChain([win, 'optionalAccess',
|
|
8803
|
+
_optionalChain([doc, 'optionalAccess', _210 => _210.addEventListener, 'call', _211 => _211("visibilitychange", onVisibilityChange)]);
|
|
8804
|
+
_optionalChain([win, 'optionalAccess', _212 => _212.addEventListener, 'call', _213 => _213("online", onVisibilityChange)]);
|
|
8776
8805
|
fsm.start();
|
|
8777
8806
|
return {
|
|
8778
8807
|
inc,
|
|
@@ -8894,6 +8923,11 @@ var SortedList = class _SortedList {
|
|
|
8894
8923
|
}
|
|
8895
8924
|
};
|
|
8896
8925
|
|
|
8926
|
+
// src/protocol/ChannelsNotificationSettings.ts
|
|
8927
|
+
function isChannelNotificationSettingEnabled(setting) {
|
|
8928
|
+
return values(setting).every((enabled) => enabled === true);
|
|
8929
|
+
}
|
|
8930
|
+
|
|
8897
8931
|
// src/types/Others.ts
|
|
8898
8932
|
var TextEditorType = /* @__PURE__ */ ((TextEditorType2) => {
|
|
8899
8933
|
TextEditorType2["Lexical"] = "lexical";
|
|
@@ -8991,5 +9025,8 @@ var NotificationsApiError = HttpError;
|
|
|
8991
9025
|
|
|
8992
9026
|
|
|
8993
9027
|
|
|
8994
|
-
|
|
9028
|
+
|
|
9029
|
+
|
|
9030
|
+
|
|
9031
|
+
exports.ClientMsgCode = ClientMsgCode; exports.CommentsApiError = CommentsApiError; exports.CrdtType = CrdtType; exports.DefaultMap = DefaultMap; exports.DerivedSignal = DerivedSignal; exports.HttpError = HttpError; exports.LiveList = LiveList; exports.LiveMap = LiveMap; exports.LiveObject = LiveObject; exports.MutableSignal = MutableSignal; exports.NotificationsApiError = NotificationsApiError; 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.ackOp = ackOp; exports.asPos = asPos; exports.assert = assert; exports.assertNever = assertNever; exports.autoRetry = autoRetry; exports.b64decode = b64decode; exports.batch = batch; exports.chunk = chunk; exports.cloneLson = cloneLson; exports.compactObject = compactObject; exports.console = fancy_console_exports; exports.convertToCommentData = convertToCommentData; exports.convertToCommentUserReaction = convertToCommentUserReaction; exports.convertToInboxNotificationData = convertToInboxNotificationData; exports.convertToThreadData = convertToThreadData; exports.createClient = createClient; exports.createCommentAttachmentId = createCommentAttachmentId; exports.createCommentId = createCommentId; exports.createInboxNotificationId = createInboxNotificationId; exports.createThreadId = createThreadId; exports.deprecate = deprecate; exports.deprecateIf = deprecateIf; exports.detectDupes = detectDupes; exports.entries = entries; exports.errorIf = errorIf; exports.freeze = freeze; exports.generateCommentUrl = generateCommentUrl; exports.getMentionedIdsFromCommentBody = getMentionedIdsFromCommentBody; exports.html = html; exports.htmlSafe = htmlSafe; exports.isChannelNotificationSettingEnabled = isChannelNotificationSettingEnabled; exports.isChildCrdt = isChildCrdt; exports.isCommentBodyLink = isCommentBodyLink; exports.isCommentBodyMention = isCommentBodyMention; exports.isCommentBodyText = isCommentBodyText; exports.isJsonArray = isJsonArray; exports.isJsonObject = isJsonObject; exports.isJsonScalar = isJsonScalar; exports.isLiveNode = isLiveNode; exports.isPlainObject = isPlainObject; exports.isRootCrdt = isRootCrdt; exports.isStartsWithOperator = isStartsWithOperator; exports.kInternal = kInternal; exports.keys = keys; exports.legacy_patchImmutableObject = legacy_patchImmutableObject; exports.lsonToJson = lsonToJson; exports.makeEventSource = makeEventSource; exports.makePoller = makePoller; exports.makePosition = makePosition; exports.mapValues = mapValues; exports.memoizeOnSuccess = memoizeOnSuccess; exports.nanoid = nanoid; exports.nn = nn; exports.objectToQuery = objectToQuery; exports.patchLiveObjectKey = patchLiveObjectKey; exports.raise = raise; exports.resolveUsersInCommentBody = resolveUsersInCommentBody; exports.shallow = shallow; exports.stringify = stringify; exports.stringifyCommentBody = stringifyCommentBody; exports.throwUsageError = throwUsageError; exports.toAbsoluteUrl = toAbsoluteUrl; exports.toPlainLson = toPlainLson; exports.tryParseJson = tryParseJson; exports.unstringify = unstringify; exports.url = url; exports.urljoin = urljoin; exports.wait = wait; exports.withTimeout = withTimeout;
|
|
8995
9032
|
//# sourceMappingURL=index.js.map
|