@liveblocks/core 2.0.0-alpha1 → 2.0.0-alpha3
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 +88 -57
- package/dist/index.d.ts +88 -57
- package/dist/index.js +105 -68
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +87 -50
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
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.0.0-
|
|
9
|
+
var PKG_VERSION = "2.0.0-alpha3";
|
|
10
10
|
var PKG_FORMAT = "cjs";
|
|
11
11
|
|
|
12
12
|
// src/dupe-detection.ts
|
|
@@ -2591,7 +2591,7 @@ function compareNodePosition(itemA, itemB) {
|
|
|
2591
2591
|
return posA === posB ? 0 : posA < posB ? -1 : 1;
|
|
2592
2592
|
}
|
|
2593
2593
|
var LiveList = class _LiveList extends AbstractCrdt {
|
|
2594
|
-
constructor(items
|
|
2594
|
+
constructor(items) {
|
|
2595
2595
|
super();
|
|
2596
2596
|
this._items = [];
|
|
2597
2597
|
this._implicitlyDeletedItems = /* @__PURE__ */ new WeakSet();
|
|
@@ -2607,7 +2607,7 @@ var LiveList = class _LiveList extends AbstractCrdt {
|
|
|
2607
2607
|
}
|
|
2608
2608
|
/** @internal */
|
|
2609
2609
|
static _deserialize([id], parentToChildren, pool) {
|
|
2610
|
-
const list = new _LiveList();
|
|
2610
|
+
const list = new _LiveList([]);
|
|
2611
2611
|
list._attach(id, pool);
|
|
2612
2612
|
const children = parentToChildren.get(id);
|
|
2613
2613
|
if (children === void 0) {
|
|
@@ -3954,18 +3954,6 @@ var LiveMap = class _LiveMap extends AbstractCrdt {
|
|
|
3954
3954
|
|
|
3955
3955
|
// src/crdts/LiveObject.ts
|
|
3956
3956
|
var LiveObject = class _LiveObject extends AbstractCrdt {
|
|
3957
|
-
constructor(obj = {}) {
|
|
3958
|
-
super();
|
|
3959
|
-
this._propToLastUpdate = /* @__PURE__ */ new Map();
|
|
3960
|
-
const o = compactObject(obj);
|
|
3961
|
-
for (const key of Object.keys(o)) {
|
|
3962
|
-
const value = o[key];
|
|
3963
|
-
if (isLiveNode(value)) {
|
|
3964
|
-
value._setParentLink(this, key);
|
|
3965
|
-
}
|
|
3966
|
-
}
|
|
3967
|
-
this._map = new Map(Object.entries(o));
|
|
3968
|
-
}
|
|
3969
3957
|
/** @internal */
|
|
3970
3958
|
static _buildRootAndParentToChildren(items) {
|
|
3971
3959
|
const parentToChildren = /* @__PURE__ */ new Map();
|
|
@@ -3997,6 +3985,18 @@ var LiveObject = class _LiveObject extends AbstractCrdt {
|
|
|
3997
3985
|
pool
|
|
3998
3986
|
);
|
|
3999
3987
|
}
|
|
3988
|
+
constructor(obj = {}) {
|
|
3989
|
+
super();
|
|
3990
|
+
this._propToLastUpdate = /* @__PURE__ */ new Map();
|
|
3991
|
+
const o = compactObject(obj);
|
|
3992
|
+
for (const key of Object.keys(o)) {
|
|
3993
|
+
const value = o[key];
|
|
3994
|
+
if (isLiveNode(value)) {
|
|
3995
|
+
value._setParentLink(this, key);
|
|
3996
|
+
}
|
|
3997
|
+
}
|
|
3998
|
+
this._map = new Map(Object.entries(o));
|
|
3999
|
+
}
|
|
4000
4000
|
/** @internal */
|
|
4001
4001
|
_toOps(parentId, parentKey, pool) {
|
|
4002
4002
|
if (this._id === void 0) {
|
|
@@ -4481,7 +4481,7 @@ function creationOpToLson(op) {
|
|
|
4481
4481
|
case 7 /* CREATE_MAP */:
|
|
4482
4482
|
return new LiveMap();
|
|
4483
4483
|
case 2 /* CREATE_LIST */:
|
|
4484
|
-
return new LiveList();
|
|
4484
|
+
return new LiveList([]);
|
|
4485
4485
|
default:
|
|
4486
4486
|
return assertNever(op, "Unknown creation Op");
|
|
4487
4487
|
}
|
|
@@ -5610,6 +5610,52 @@ function createRoom(options, config) {
|
|
|
5610
5610
|
body: JSON.stringify(body)
|
|
5611
5611
|
});
|
|
5612
5612
|
}
|
|
5613
|
+
async function createTextMention(userId, mentionId) {
|
|
5614
|
+
if (!managedSocket.authValue) {
|
|
5615
|
+
throw new Error("Not authorized");
|
|
5616
|
+
}
|
|
5617
|
+
return fetchClientApi(
|
|
5618
|
+
config.roomId,
|
|
5619
|
+
"/text-mentions",
|
|
5620
|
+
managedSocket.authValue,
|
|
5621
|
+
{
|
|
5622
|
+
method: "POST",
|
|
5623
|
+
headers: {
|
|
5624
|
+
"Content-Type": "application/json"
|
|
5625
|
+
},
|
|
5626
|
+
body: JSON.stringify({
|
|
5627
|
+
userId,
|
|
5628
|
+
mentionId
|
|
5629
|
+
})
|
|
5630
|
+
}
|
|
5631
|
+
);
|
|
5632
|
+
}
|
|
5633
|
+
async function deleteTextMention(mentionId) {
|
|
5634
|
+
if (!managedSocket.authValue) {
|
|
5635
|
+
throw new Error("Not authorized");
|
|
5636
|
+
}
|
|
5637
|
+
return fetchClientApi(
|
|
5638
|
+
config.roomId,
|
|
5639
|
+
`/text-mentions/${mentionId}`,
|
|
5640
|
+
managedSocket.authValue,
|
|
5641
|
+
{
|
|
5642
|
+
method: "DELETE"
|
|
5643
|
+
}
|
|
5644
|
+
);
|
|
5645
|
+
}
|
|
5646
|
+
async function reportTextEditor(type, rootKey) {
|
|
5647
|
+
const authValue = await delegates.authenticate();
|
|
5648
|
+
return fetchClientApi(config.roomId, "/text-metadata", authValue, {
|
|
5649
|
+
method: "POST",
|
|
5650
|
+
headers: {
|
|
5651
|
+
"Content-Type": "application/json"
|
|
5652
|
+
},
|
|
5653
|
+
body: JSON.stringify({
|
|
5654
|
+
type,
|
|
5655
|
+
rootKey
|
|
5656
|
+
})
|
|
5657
|
+
});
|
|
5658
|
+
}
|
|
5613
5659
|
function sendMessages(messages) {
|
|
5614
5660
|
const serializedPayload = JSON.stringify(messages);
|
|
5615
5661
|
const nonce = _optionalChain([context, 'access', _135 => _135.dynamicSessionInfo, 'access', _136 => _136.current, 'optionalAccess', _137 => _137.nonce]);
|
|
@@ -6498,6 +6544,12 @@ ${Array.from(traces).join("\n\n")}`
|
|
|
6498
6544
|
return context.nodes.size;
|
|
6499
6545
|
},
|
|
6500
6546
|
// prettier-ignore
|
|
6547
|
+
// send metadata when using a text editor
|
|
6548
|
+
reportTextEditor,
|
|
6549
|
+
// create a text mention when using a text editor
|
|
6550
|
+
createTextMention,
|
|
6551
|
+
// delete a text mention when using a text editor
|
|
6552
|
+
deleteTextMention,
|
|
6501
6553
|
// Support for the Liveblocks browser extension
|
|
6502
6554
|
getSelf_forDevTools: () => selfAsTreeNode.current,
|
|
6503
6555
|
getOthers_forDevTools: () => others_forDevTools.current,
|
|
@@ -6684,6 +6736,7 @@ function createClientStore() {
|
|
|
6684
6736
|
inboxNotifications: {},
|
|
6685
6737
|
notificationSettings: {}
|
|
6686
6738
|
});
|
|
6739
|
+
const optimisticUpdatesEventSource = makeEventSource();
|
|
6687
6740
|
return {
|
|
6688
6741
|
...store,
|
|
6689
6742
|
deleteThread(threadId) {
|
|
@@ -6750,6 +6803,7 @@ function createClientStore() {
|
|
|
6750
6803
|
}));
|
|
6751
6804
|
},
|
|
6752
6805
|
pushOptimisticUpdate(optimisticUpdate) {
|
|
6806
|
+
optimisticUpdatesEventSource.notify(optimisticUpdate);
|
|
6753
6807
|
store.set((state) => ({
|
|
6754
6808
|
...state,
|
|
6755
6809
|
optimisticUpdates: [...state.optimisticUpdates, optimisticUpdate]
|
|
@@ -6763,7 +6817,8 @@ function createClientStore() {
|
|
|
6763
6817
|
[queryKey]: queryState
|
|
6764
6818
|
}
|
|
6765
6819
|
}));
|
|
6766
|
-
}
|
|
6820
|
+
},
|
|
6821
|
+
optimisticUpdatesEventSource
|
|
6767
6822
|
};
|
|
6768
6823
|
}
|
|
6769
6824
|
function deleteKeyImmutable(record, key) {
|
|
@@ -6928,15 +6983,13 @@ function applyThreadUpdates(existingThreads, updates) {
|
|
|
6928
6983
|
const existingThread = updatedThreads[thread.id];
|
|
6929
6984
|
if (existingThread) {
|
|
6930
6985
|
const result = compareThreads(existingThread, thread);
|
|
6931
|
-
if (result === 1)
|
|
6932
|
-
return;
|
|
6986
|
+
if (result === 1) return;
|
|
6933
6987
|
}
|
|
6934
6988
|
updatedThreads[thread.id] = thread;
|
|
6935
6989
|
});
|
|
6936
6990
|
updates.deletedThreads.forEach(({ id, deletedAt }) => {
|
|
6937
6991
|
const existingThread = updatedThreads[id];
|
|
6938
|
-
if (existingThread === void 0)
|
|
6939
|
-
return;
|
|
6992
|
+
if (existingThread === void 0) return;
|
|
6940
6993
|
existingThread.deletedAt = deletedAt;
|
|
6941
6994
|
existingThread.updatedAt = deletedAt;
|
|
6942
6995
|
existingThread.comments = [];
|
|
@@ -6952,8 +7005,7 @@ function applyNotificationsUpdates(existingInboxNotifications, updates) {
|
|
|
6952
7005
|
existingNotification,
|
|
6953
7006
|
notification
|
|
6954
7007
|
);
|
|
6955
|
-
if (result === 1)
|
|
6956
|
-
return;
|
|
7008
|
+
if (result === 1) return;
|
|
6957
7009
|
}
|
|
6958
7010
|
updatedInboxNotifications[notification.id] = notification;
|
|
6959
7011
|
});
|
|
@@ -7181,22 +7233,22 @@ function createClient(options) {
|
|
|
7181
7233
|
roomsById.delete(room.id);
|
|
7182
7234
|
room.destroy();
|
|
7183
7235
|
}
|
|
7184
|
-
function leaseRoom(
|
|
7236
|
+
function leaseRoom(details) {
|
|
7185
7237
|
const leave = () => {
|
|
7186
7238
|
const self = leave;
|
|
7187
|
-
if (!
|
|
7239
|
+
if (!details.unsubs.delete(self)) {
|
|
7188
7240
|
warn(
|
|
7189
7241
|
"This leave function was already called. Calling it more than once has no effect."
|
|
7190
7242
|
);
|
|
7191
7243
|
} else {
|
|
7192
|
-
if (
|
|
7193
|
-
teardownRoom(
|
|
7244
|
+
if (details.unsubs.size === 0) {
|
|
7245
|
+
teardownRoom(details.room);
|
|
7194
7246
|
}
|
|
7195
7247
|
}
|
|
7196
7248
|
};
|
|
7197
|
-
|
|
7249
|
+
details.unsubs.add(leave);
|
|
7198
7250
|
return {
|
|
7199
|
-
room:
|
|
7251
|
+
room: details.room,
|
|
7200
7252
|
leave
|
|
7201
7253
|
};
|
|
7202
7254
|
}
|
|
@@ -7235,11 +7287,11 @@ function createClient(options) {
|
|
|
7235
7287
|
unstable_streamData: !!clientOptions.unstable_streamData
|
|
7236
7288
|
}
|
|
7237
7289
|
);
|
|
7238
|
-
const
|
|
7290
|
+
const newRoomDetails = {
|
|
7239
7291
|
room: newRoom,
|
|
7240
7292
|
unsubs: /* @__PURE__ */ new Set()
|
|
7241
7293
|
};
|
|
7242
|
-
roomsById.set(roomId,
|
|
7294
|
+
roomsById.set(roomId, newRoomDetails);
|
|
7243
7295
|
setupDevTools(() => Array.from(roomsById.keys()));
|
|
7244
7296
|
linkDevTools(roomId, newRoom);
|
|
7245
7297
|
const shouldConnect = _nullishCoalesce(options2.autoConnect, () => ( true));
|
|
@@ -7254,22 +7306,12 @@ function createClient(options) {
|
|
|
7254
7306
|
}
|
|
7255
7307
|
newRoom.connect();
|
|
7256
7308
|
}
|
|
7257
|
-
return leaseRoom(
|
|
7258
|
-
}
|
|
7259
|
-
function enter(roomId, options2) {
|
|
7260
|
-
const { room, leave: _ } = enterRoom(roomId, options2);
|
|
7261
|
-
return room;
|
|
7309
|
+
return leaseRoom(newRoomDetails);
|
|
7262
7310
|
}
|
|
7263
7311
|
function getRoom(roomId) {
|
|
7264
7312
|
const room = _optionalChain([roomsById, 'access', _168 => _168.get, 'call', _169 => _169(roomId), 'optionalAccess', _170 => _170.room]);
|
|
7265
7313
|
return room ? room : null;
|
|
7266
7314
|
}
|
|
7267
|
-
function forceLeave(roomId) {
|
|
7268
|
-
const unsubs = _nullishCoalesce(_optionalChain([roomsById, 'access', _171 => _171.get, 'call', _172 => _172(roomId), 'optionalAccess', _173 => _173.unsubs]), () => ( /* @__PURE__ */ new Set()));
|
|
7269
|
-
for (const unsub of unsubs) {
|
|
7270
|
-
unsub();
|
|
7271
|
-
}
|
|
7272
|
-
}
|
|
7273
7315
|
function logout() {
|
|
7274
7316
|
authManager.reset();
|
|
7275
7317
|
for (const { room } of roomsById.values()) {
|
|
@@ -7286,7 +7328,7 @@ function createClient(options) {
|
|
|
7286
7328
|
markInboxNotificationAsRead
|
|
7287
7329
|
} = createNotificationsApi({
|
|
7288
7330
|
baseUrl,
|
|
7289
|
-
fetcher: _optionalChain([clientOptions, 'access',
|
|
7331
|
+
fetcher: _optionalChain([clientOptions, 'access', _171 => _171.polyfills, 'optionalAccess', _172 => _172.fetch]) || /* istanbul ignore next */
|
|
7290
7332
|
fetch,
|
|
7291
7333
|
authManager,
|
|
7292
7334
|
currentUserIdStore
|
|
@@ -7300,7 +7342,7 @@ function createClient(options) {
|
|
|
7300
7342
|
const usersStore = createBatchStore(
|
|
7301
7343
|
async (batchedUserIds) => {
|
|
7302
7344
|
const userIds = batchedUserIds.flat();
|
|
7303
|
-
const users = await _optionalChain([resolveUsers, 'optionalCall',
|
|
7345
|
+
const users = await _optionalChain([resolveUsers, 'optionalCall', _173 => _173({ userIds })]);
|
|
7304
7346
|
warnIfNoResolveUsers();
|
|
7305
7347
|
return _nullishCoalesce(users, () => ( userIds.map(() => void 0)));
|
|
7306
7348
|
},
|
|
@@ -7314,7 +7356,7 @@ function createClient(options) {
|
|
|
7314
7356
|
const roomsInfoStore = createBatchStore(
|
|
7315
7357
|
async (batchedRoomIds) => {
|
|
7316
7358
|
const roomIds = batchedRoomIds.flat();
|
|
7317
|
-
const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall',
|
|
7359
|
+
const roomsInfo = await _optionalChain([resolveRoomsInfo, 'optionalCall', _174 => _174({ roomIds })]);
|
|
7318
7360
|
warnIfNoResolveRoomsInfo();
|
|
7319
7361
|
return _nullishCoalesce(roomsInfo, () => ( roomIds.map(() => void 0)));
|
|
7320
7362
|
},
|
|
@@ -7322,13 +7364,9 @@ function createClient(options) {
|
|
|
7322
7364
|
);
|
|
7323
7365
|
return Object.defineProperty(
|
|
7324
7366
|
{
|
|
7325
|
-
logout,
|
|
7326
|
-
// Old, deprecated APIs
|
|
7327
|
-
enter,
|
|
7328
|
-
getRoom,
|
|
7329
|
-
leave: forceLeave,
|
|
7330
|
-
// New, preferred API
|
|
7331
7367
|
enterRoom,
|
|
7368
|
+
getRoom,
|
|
7369
|
+
logout,
|
|
7332
7370
|
// Internal
|
|
7333
7371
|
[kInternal]: {
|
|
7334
7372
|
notifications: {
|
|
@@ -7370,8 +7408,7 @@ function checkBounds(option, value, min, max, recommendedMin) {
|
|
|
7370
7408
|
return value;
|
|
7371
7409
|
}
|
|
7372
7410
|
function getBackgroundKeepAliveTimeout(value) {
|
|
7373
|
-
if (value === void 0)
|
|
7374
|
-
return void 0;
|
|
7411
|
+
if (value === void 0) return void 0;
|
|
7375
7412
|
return checkBounds(
|
|
7376
7413
|
"backgroundKeepAliveTimeout",
|
|
7377
7414
|
value,
|
|
@@ -7431,7 +7468,7 @@ var commentBodyElementsTypes = {
|
|
|
7431
7468
|
mention: "inline"
|
|
7432
7469
|
};
|
|
7433
7470
|
function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
|
|
7434
|
-
if (!body || !_optionalChain([body, 'optionalAccess',
|
|
7471
|
+
if (!body || !_optionalChain([body, 'optionalAccess', _175 => _175.content])) {
|
|
7435
7472
|
return;
|
|
7436
7473
|
}
|
|
7437
7474
|
const element = typeof elementOrVisitor === "string" ? elementOrVisitor : void 0;
|
|
@@ -7441,13 +7478,13 @@ function traverseCommentBody(body, elementOrVisitor, possiblyVisitor) {
|
|
|
7441
7478
|
for (const block of body.content) {
|
|
7442
7479
|
if (type === "all" || type === "block") {
|
|
7443
7480
|
if (guard(block)) {
|
|
7444
|
-
_optionalChain([visitor, 'optionalCall',
|
|
7481
|
+
_optionalChain([visitor, 'optionalCall', _176 => _176(block)]);
|
|
7445
7482
|
}
|
|
7446
7483
|
}
|
|
7447
7484
|
if (type === "all" || type === "inline") {
|
|
7448
7485
|
for (const inline of block.children) {
|
|
7449
7486
|
if (guard(inline)) {
|
|
7450
|
-
_optionalChain([visitor, 'optionalCall',
|
|
7487
|
+
_optionalChain([visitor, 'optionalCall', _177 => _177(inline)]);
|
|
7451
7488
|
}
|
|
7452
7489
|
}
|
|
7453
7490
|
}
|
|
@@ -7472,7 +7509,7 @@ async function resolveUsersInCommentBody(body, resolveUsers) {
|
|
|
7472
7509
|
userIds
|
|
7473
7510
|
});
|
|
7474
7511
|
for (const [index, userId] of userIds.entries()) {
|
|
7475
|
-
const user = _optionalChain([users, 'optionalAccess',
|
|
7512
|
+
const user = _optionalChain([users, 'optionalAccess', _178 => _178[index]]);
|
|
7476
7513
|
if (user) {
|
|
7477
7514
|
resolvedUsers.set(userId, user);
|
|
7478
7515
|
}
|
|
@@ -7595,7 +7632,7 @@ var stringifyCommentBodyPlainElements = {
|
|
|
7595
7632
|
text: ({ element }) => element.text,
|
|
7596
7633
|
link: ({ element }) => element.url,
|
|
7597
7634
|
mention: ({ element, user }) => {
|
|
7598
|
-
return `@${_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
7635
|
+
return `@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _179 => _179.name]), () => ( element.id))}`;
|
|
7599
7636
|
}
|
|
7600
7637
|
};
|
|
7601
7638
|
var stringifyCommentBodyHtmlElements = {
|
|
@@ -7625,7 +7662,7 @@ var stringifyCommentBodyHtmlElements = {
|
|
|
7625
7662
|
return html`<a href="${href}" target="_blank" rel="noopener noreferrer">${element.url}</a>`;
|
|
7626
7663
|
},
|
|
7627
7664
|
mention: ({ element, user }) => {
|
|
7628
|
-
return html`<span data-mention>@${_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
7665
|
+
return html`<span data-mention>@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _180 => _180.name]), () => ( element.id))}</span>`;
|
|
7629
7666
|
}
|
|
7630
7667
|
};
|
|
7631
7668
|
var stringifyCommentBodyMarkdownElements = {
|
|
@@ -7655,19 +7692,19 @@ var stringifyCommentBodyMarkdownElements = {
|
|
|
7655
7692
|
return markdown`[${element.url}](${href})`;
|
|
7656
7693
|
},
|
|
7657
7694
|
mention: ({ element, user }) => {
|
|
7658
|
-
return markdown`@${_nullishCoalesce(_optionalChain([user, 'optionalAccess',
|
|
7695
|
+
return markdown`@${_nullishCoalesce(_optionalChain([user, 'optionalAccess', _181 => _181.name]), () => ( element.id))}`;
|
|
7659
7696
|
}
|
|
7660
7697
|
};
|
|
7661
7698
|
async function stringifyCommentBody(body, options) {
|
|
7662
|
-
const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
7663
|
-
const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess',
|
|
7699
|
+
const format = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _182 => _182.format]), () => ( "plain"));
|
|
7700
|
+
const separator = _nullishCoalesce(_optionalChain([options, 'optionalAccess', _183 => _183.separator]), () => ( (format === "markdown" ? "\n\n" : "\n")));
|
|
7664
7701
|
const elements = {
|
|
7665
7702
|
...format === "html" ? stringifyCommentBodyHtmlElements : format === "markdown" ? stringifyCommentBodyMarkdownElements : stringifyCommentBodyPlainElements,
|
|
7666
|
-
..._optionalChain([options, 'optionalAccess',
|
|
7703
|
+
..._optionalChain([options, 'optionalAccess', _184 => _184.elements])
|
|
7667
7704
|
};
|
|
7668
7705
|
const resolvedUsers = await resolveUsersInCommentBody(
|
|
7669
7706
|
body,
|
|
7670
|
-
_optionalChain([options, 'optionalAccess',
|
|
7707
|
+
_optionalChain([options, 'optionalAccess', _185 => _185.resolveUsers])
|
|
7671
7708
|
);
|
|
7672
7709
|
const blocks = body.content.flatMap((block, blockIndex) => {
|
|
7673
7710
|
switch (block.type) {
|
|
@@ -7942,12 +7979,12 @@ function legacy_patchImmutableNode(state, path, update) {
|
|
|
7942
7979
|
}
|
|
7943
7980
|
const newState = Object.assign({}, state);
|
|
7944
7981
|
for (const key in update.updates) {
|
|
7945
|
-
if (_optionalChain([update, 'access',
|
|
7982
|
+
if (_optionalChain([update, 'access', _186 => _186.updates, 'access', _187 => _187[key], 'optionalAccess', _188 => _188.type]) === "update") {
|
|
7946
7983
|
const val = update.node.get(key);
|
|
7947
7984
|
if (val !== void 0) {
|
|
7948
7985
|
newState[key] = lsonToJson(val);
|
|
7949
7986
|
}
|
|
7950
|
-
} else if (_optionalChain([update, 'access',
|
|
7987
|
+
} else if (_optionalChain([update, 'access', _189 => _189.updates, 'access', _190 => _190[key], 'optionalAccess', _191 => _191.type]) === "delete") {
|
|
7951
7988
|
delete newState[key];
|
|
7952
7989
|
}
|
|
7953
7990
|
}
|
|
@@ -8008,12 +8045,12 @@ function legacy_patchImmutableNode(state, path, update) {
|
|
|
8008
8045
|
}
|
|
8009
8046
|
const newState = Object.assign({}, state);
|
|
8010
8047
|
for (const key in update.updates) {
|
|
8011
|
-
if (_optionalChain([update, 'access',
|
|
8048
|
+
if (_optionalChain([update, 'access', _192 => _192.updates, 'access', _193 => _193[key], 'optionalAccess', _194 => _194.type]) === "update") {
|
|
8012
8049
|
const value = update.node.get(key);
|
|
8013
8050
|
if (value !== void 0) {
|
|
8014
8051
|
newState[key] = lsonToJson(value);
|
|
8015
8052
|
}
|
|
8016
|
-
} else if (_optionalChain([update, 'access',
|
|
8053
|
+
} else if (_optionalChain([update, 'access', _195 => _195.updates, 'access', _196 => _196[key], 'optionalAccess', _197 => _197.type]) === "delete") {
|
|
8017
8054
|
delete newState[key];
|
|
8018
8055
|
}
|
|
8019
8056
|
}
|