houdini 2.0.0-next.1 → 2.0.0-next.2
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/build/cmd-cjs/index.js +38 -31
- package/build/cmd-esm/index.js +38 -31
- package/build/codegen-cjs/index.js +36 -29
- package/build/codegen-esm/index.js +36 -29
- package/build/lib-cjs/index.js +36 -29
- package/build/lib-esm/index.js +36 -29
- package/build/runtime-cjs/cache/cache.js +36 -29
- package/build/runtime-esm/cache/cache.js +36 -29
- package/build/test-cjs/index.js +36 -29
- package/build/test-esm/index.js +36 -29
- package/build/vite-cjs/index.js +36 -29
- package/build/vite-esm/index.js +36 -29
- package/package.json +1 -1
package/build/cmd-cjs/index.js
CHANGED
|
@@ -77346,20 +77346,21 @@ var CacheInternal = class {
|
|
|
77346
77346
|
} else if (Array.isArray(value) && // make typescript happy
|
|
77347
77347
|
(typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
|
|
77348
77348
|
let oldIDs = [...previousValue || []];
|
|
77349
|
-
|
|
77350
|
-
|
|
77351
|
-
|
|
77352
|
-
|
|
77353
|
-
|
|
77354
|
-
|
|
77355
|
-
|
|
77356
|
-
|
|
77357
|
-
|
|
77358
|
-
|
|
77359
|
-
|
|
77360
|
-
|
|
77361
|
-
|
|
77362
|
-
|
|
77349
|
+
if (updates?.includes("append") || updates?.includes("prepend")) {
|
|
77350
|
+
oldIDs = oldIDs.filter((id) => {
|
|
77351
|
+
for (const layer2 of this.storage.data) {
|
|
77352
|
+
for (const operation of Object.values(layer2.operations)) {
|
|
77353
|
+
if (operation.fields?.[key])
|
|
77354
|
+
for (const listOperation of operation.fields[key]) {
|
|
77355
|
+
if ("id" in listOperation && listOperation.id === id) {
|
|
77356
|
+
return false;
|
|
77357
|
+
}
|
|
77358
|
+
}
|
|
77359
|
+
}
|
|
77360
|
+
}
|
|
77361
|
+
return true;
|
|
77362
|
+
});
|
|
77363
|
+
}
|
|
77363
77364
|
let linkedIDs = [];
|
|
77364
77365
|
const { newIDs, nestedIDs } = this.extractNestedListIDs({
|
|
77365
77366
|
value,
|
|
@@ -77378,39 +77379,45 @@ var CacheInternal = class {
|
|
|
77378
77379
|
layer.writeLink(parent2, key, linkedIDs);
|
|
77379
77380
|
};
|
|
77380
77381
|
if (applyUpdates && updates) {
|
|
77381
|
-
|
|
77382
|
-
const
|
|
77383
|
-
for (const id of
|
|
77382
|
+
const filterIDs = (keep, insert) => {
|
|
77383
|
+
const existingIDs = /* @__PURE__ */ new Set();
|
|
77384
|
+
for (const id of keep) {
|
|
77384
77385
|
if (!id) {
|
|
77385
77386
|
continue;
|
|
77386
77387
|
}
|
|
77387
77388
|
const { value: node } = this.storage.get(id, "node");
|
|
77388
|
-
if (
|
|
77389
|
+
if (!node) {
|
|
77389
77390
|
continue;
|
|
77390
77391
|
}
|
|
77391
|
-
|
|
77392
|
+
const nodeID = this.storage.get(node, "id");
|
|
77393
|
+
if (!nodeID) {
|
|
77392
77394
|
continue;
|
|
77393
77395
|
}
|
|
77394
|
-
|
|
77396
|
+
existingIDs.add(nodeID.value);
|
|
77395
77397
|
}
|
|
77396
|
-
|
|
77398
|
+
return insert.filter((id) => {
|
|
77397
77399
|
if (!id) {
|
|
77398
77400
|
return true;
|
|
77399
77401
|
}
|
|
77400
|
-
const { value:
|
|
77401
|
-
|
|
77402
|
-
|
|
77403
|
-
return false;
|
|
77402
|
+
const { value: node } = this.storage.get(id, "node");
|
|
77403
|
+
if (!node) {
|
|
77404
|
+
return true;
|
|
77404
77405
|
}
|
|
77405
|
-
|
|
77406
|
+
const nodeID = this.storage.get(node, "id");
|
|
77407
|
+
if (!nodeID) {
|
|
77408
|
+
return true;
|
|
77409
|
+
}
|
|
77410
|
+
return !existingIDs.has(nodeID.value);
|
|
77406
77411
|
});
|
|
77407
|
-
}
|
|
77412
|
+
};
|
|
77408
77413
|
for (const update of applyUpdates) {
|
|
77409
77414
|
if (update !== "replace" && !updates.includes(update)) {
|
|
77410
77415
|
continue;
|
|
77411
77416
|
}
|
|
77412
77417
|
if (update === "prepend") {
|
|
77413
|
-
linkedIDs = newIDs.concat(
|
|
77418
|
+
linkedIDs = newIDs.concat(
|
|
77419
|
+
filterIDs(newIDs, oldIDs)
|
|
77420
|
+
);
|
|
77414
77421
|
if (layer?.optimistic) {
|
|
77415
77422
|
action = () => {
|
|
77416
77423
|
for (const id of newIDs) {
|
|
@@ -77421,7 +77428,7 @@ var CacheInternal = class {
|
|
|
77421
77428
|
};
|
|
77422
77429
|
}
|
|
77423
77430
|
} else if (update === "append") {
|
|
77424
|
-
linkedIDs = oldIDs.concat(newIDs);
|
|
77431
|
+
linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
|
|
77425
77432
|
if (layer?.optimistic) {
|
|
77426
77433
|
action = () => {
|
|
77427
77434
|
for (const id of newIDs) {
|
|
@@ -89177,12 +89184,12 @@ async function packageJSON(targetPath, frameworkInfo) {
|
|
|
89177
89184
|
}
|
|
89178
89185
|
packageJSON2.devDependencies = {
|
|
89179
89186
|
...packageJSON2.devDependencies,
|
|
89180
|
-
houdini: "^2.0.0-next.
|
|
89187
|
+
houdini: "^2.0.0-next.2"
|
|
89181
89188
|
};
|
|
89182
89189
|
if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
|
|
89183
89190
|
packageJSON2.devDependencies = {
|
|
89184
89191
|
...packageJSON2.devDependencies,
|
|
89185
|
-
"houdini-svelte": "^2.2.0-next.
|
|
89192
|
+
"houdini-svelte": "^2.2.0-next.4"
|
|
89186
89193
|
};
|
|
89187
89194
|
} else {
|
|
89188
89195
|
throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
|
package/build/cmd-esm/index.js
CHANGED
|
@@ -77351,20 +77351,21 @@ var CacheInternal = class {
|
|
|
77351
77351
|
} else if (Array.isArray(value) && // make typescript happy
|
|
77352
77352
|
(typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
|
|
77353
77353
|
let oldIDs = [...previousValue || []];
|
|
77354
|
-
|
|
77355
|
-
|
|
77356
|
-
|
|
77357
|
-
|
|
77358
|
-
|
|
77359
|
-
|
|
77360
|
-
|
|
77361
|
-
|
|
77362
|
-
|
|
77363
|
-
|
|
77364
|
-
|
|
77365
|
-
|
|
77366
|
-
|
|
77367
|
-
|
|
77354
|
+
if (updates?.includes("append") || updates?.includes("prepend")) {
|
|
77355
|
+
oldIDs = oldIDs.filter((id) => {
|
|
77356
|
+
for (const layer2 of this.storage.data) {
|
|
77357
|
+
for (const operation of Object.values(layer2.operations)) {
|
|
77358
|
+
if (operation.fields?.[key])
|
|
77359
|
+
for (const listOperation of operation.fields[key]) {
|
|
77360
|
+
if ("id" in listOperation && listOperation.id === id) {
|
|
77361
|
+
return false;
|
|
77362
|
+
}
|
|
77363
|
+
}
|
|
77364
|
+
}
|
|
77365
|
+
}
|
|
77366
|
+
return true;
|
|
77367
|
+
});
|
|
77368
|
+
}
|
|
77368
77369
|
let linkedIDs = [];
|
|
77369
77370
|
const { newIDs, nestedIDs } = this.extractNestedListIDs({
|
|
77370
77371
|
value,
|
|
@@ -77383,39 +77384,45 @@ var CacheInternal = class {
|
|
|
77383
77384
|
layer.writeLink(parent2, key, linkedIDs);
|
|
77384
77385
|
};
|
|
77385
77386
|
if (applyUpdates && updates) {
|
|
77386
|
-
|
|
77387
|
-
const
|
|
77388
|
-
for (const id of
|
|
77387
|
+
const filterIDs = (keep, insert) => {
|
|
77388
|
+
const existingIDs = /* @__PURE__ */ new Set();
|
|
77389
|
+
for (const id of keep) {
|
|
77389
77390
|
if (!id) {
|
|
77390
77391
|
continue;
|
|
77391
77392
|
}
|
|
77392
77393
|
const { value: node } = this.storage.get(id, "node");
|
|
77393
|
-
if (
|
|
77394
|
+
if (!node) {
|
|
77394
77395
|
continue;
|
|
77395
77396
|
}
|
|
77396
|
-
|
|
77397
|
+
const nodeID = this.storage.get(node, "id");
|
|
77398
|
+
if (!nodeID) {
|
|
77397
77399
|
continue;
|
|
77398
77400
|
}
|
|
77399
|
-
|
|
77401
|
+
existingIDs.add(nodeID.value);
|
|
77400
77402
|
}
|
|
77401
|
-
|
|
77403
|
+
return insert.filter((id) => {
|
|
77402
77404
|
if (!id) {
|
|
77403
77405
|
return true;
|
|
77404
77406
|
}
|
|
77405
|
-
const { value:
|
|
77406
|
-
|
|
77407
|
-
|
|
77408
|
-
return false;
|
|
77407
|
+
const { value: node } = this.storage.get(id, "node");
|
|
77408
|
+
if (!node) {
|
|
77409
|
+
return true;
|
|
77409
77410
|
}
|
|
77410
|
-
|
|
77411
|
+
const nodeID = this.storage.get(node, "id");
|
|
77412
|
+
if (!nodeID) {
|
|
77413
|
+
return true;
|
|
77414
|
+
}
|
|
77415
|
+
return !existingIDs.has(nodeID.value);
|
|
77411
77416
|
});
|
|
77412
|
-
}
|
|
77417
|
+
};
|
|
77413
77418
|
for (const update of applyUpdates) {
|
|
77414
77419
|
if (update !== "replace" && !updates.includes(update)) {
|
|
77415
77420
|
continue;
|
|
77416
77421
|
}
|
|
77417
77422
|
if (update === "prepend") {
|
|
77418
|
-
linkedIDs = newIDs.concat(
|
|
77423
|
+
linkedIDs = newIDs.concat(
|
|
77424
|
+
filterIDs(newIDs, oldIDs)
|
|
77425
|
+
);
|
|
77419
77426
|
if (layer?.optimistic) {
|
|
77420
77427
|
action = () => {
|
|
77421
77428
|
for (const id of newIDs) {
|
|
@@ -77426,7 +77433,7 @@ var CacheInternal = class {
|
|
|
77426
77433
|
};
|
|
77427
77434
|
}
|
|
77428
77435
|
} else if (update === "append") {
|
|
77429
|
-
linkedIDs = oldIDs.concat(newIDs);
|
|
77436
|
+
linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
|
|
77430
77437
|
if (layer?.optimistic) {
|
|
77431
77438
|
action = () => {
|
|
77432
77439
|
for (const id of newIDs) {
|
|
@@ -89181,12 +89188,12 @@ async function packageJSON(targetPath, frameworkInfo) {
|
|
|
89181
89188
|
}
|
|
89182
89189
|
packageJSON2.devDependencies = {
|
|
89183
89190
|
...packageJSON2.devDependencies,
|
|
89184
|
-
houdini: "^2.0.0-next.
|
|
89191
|
+
houdini: "^2.0.0-next.2"
|
|
89185
89192
|
};
|
|
89186
89193
|
if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
|
|
89187
89194
|
packageJSON2.devDependencies = {
|
|
89188
89195
|
...packageJSON2.devDependencies,
|
|
89189
|
-
"houdini-svelte": "^2.2.0-next.
|
|
89196
|
+
"houdini-svelte": "^2.2.0-next.4"
|
|
89190
89197
|
};
|
|
89191
89198
|
} else {
|
|
89192
89199
|
throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);
|
|
@@ -64940,20 +64940,21 @@ var CacheInternal = class {
|
|
|
64940
64940
|
} else if (Array.isArray(value) && // make typescript happy
|
|
64941
64941
|
(typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
|
|
64942
64942
|
let oldIDs = [...previousValue || []];
|
|
64943
|
-
|
|
64944
|
-
|
|
64945
|
-
|
|
64946
|
-
|
|
64947
|
-
|
|
64948
|
-
|
|
64949
|
-
|
|
64950
|
-
|
|
64951
|
-
|
|
64952
|
-
|
|
64953
|
-
|
|
64954
|
-
|
|
64955
|
-
|
|
64956
|
-
|
|
64943
|
+
if (updates?.includes("append") || updates?.includes("prepend")) {
|
|
64944
|
+
oldIDs = oldIDs.filter((id) => {
|
|
64945
|
+
for (const layer2 of this.storage.data) {
|
|
64946
|
+
for (const operation of Object.values(layer2.operations)) {
|
|
64947
|
+
if (operation.fields?.[key])
|
|
64948
|
+
for (const listOperation of operation.fields[key]) {
|
|
64949
|
+
if ("id" in listOperation && listOperation.id === id) {
|
|
64950
|
+
return false;
|
|
64951
|
+
}
|
|
64952
|
+
}
|
|
64953
|
+
}
|
|
64954
|
+
}
|
|
64955
|
+
return true;
|
|
64956
|
+
});
|
|
64957
|
+
}
|
|
64957
64958
|
let linkedIDs = [];
|
|
64958
64959
|
const { newIDs, nestedIDs } = this.extractNestedListIDs({
|
|
64959
64960
|
value,
|
|
@@ -64972,39 +64973,45 @@ var CacheInternal = class {
|
|
|
64972
64973
|
layer.writeLink(parent2, key, linkedIDs);
|
|
64973
64974
|
};
|
|
64974
64975
|
if (applyUpdates && updates) {
|
|
64975
|
-
|
|
64976
|
-
const
|
|
64977
|
-
for (const id of
|
|
64976
|
+
const filterIDs = (keep, insert) => {
|
|
64977
|
+
const existingIDs = /* @__PURE__ */ new Set();
|
|
64978
|
+
for (const id of keep) {
|
|
64978
64979
|
if (!id) {
|
|
64979
64980
|
continue;
|
|
64980
64981
|
}
|
|
64981
64982
|
const { value: node } = this.storage.get(id, "node");
|
|
64982
|
-
if (
|
|
64983
|
+
if (!node) {
|
|
64983
64984
|
continue;
|
|
64984
64985
|
}
|
|
64985
|
-
|
|
64986
|
+
const nodeID = this.storage.get(node, "id");
|
|
64987
|
+
if (!nodeID) {
|
|
64986
64988
|
continue;
|
|
64987
64989
|
}
|
|
64988
|
-
|
|
64990
|
+
existingIDs.add(nodeID.value);
|
|
64989
64991
|
}
|
|
64990
|
-
|
|
64992
|
+
return insert.filter((id) => {
|
|
64991
64993
|
if (!id) {
|
|
64992
64994
|
return true;
|
|
64993
64995
|
}
|
|
64994
|
-
const { value:
|
|
64995
|
-
|
|
64996
|
-
|
|
64997
|
-
return false;
|
|
64996
|
+
const { value: node } = this.storage.get(id, "node");
|
|
64997
|
+
if (!node) {
|
|
64998
|
+
return true;
|
|
64998
64999
|
}
|
|
64999
|
-
|
|
65000
|
+
const nodeID = this.storage.get(node, "id");
|
|
65001
|
+
if (!nodeID) {
|
|
65002
|
+
return true;
|
|
65003
|
+
}
|
|
65004
|
+
return !existingIDs.has(nodeID.value);
|
|
65000
65005
|
});
|
|
65001
|
-
}
|
|
65006
|
+
};
|
|
65002
65007
|
for (const update of applyUpdates) {
|
|
65003
65008
|
if (update !== "replace" && !updates.includes(update)) {
|
|
65004
65009
|
continue;
|
|
65005
65010
|
}
|
|
65006
65011
|
if (update === "prepend") {
|
|
65007
|
-
linkedIDs = newIDs.concat(
|
|
65012
|
+
linkedIDs = newIDs.concat(
|
|
65013
|
+
filterIDs(newIDs, oldIDs)
|
|
65014
|
+
);
|
|
65008
65015
|
if (layer?.optimistic) {
|
|
65009
65016
|
action = () => {
|
|
65010
65017
|
for (const id of newIDs) {
|
|
@@ -65015,7 +65022,7 @@ var CacheInternal = class {
|
|
|
65015
65022
|
};
|
|
65016
65023
|
}
|
|
65017
65024
|
} else if (update === "append") {
|
|
65018
|
-
linkedIDs = oldIDs.concat(newIDs);
|
|
65025
|
+
linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
|
|
65019
65026
|
if (layer?.optimistic) {
|
|
65020
65027
|
action = () => {
|
|
65021
65028
|
for (const id of newIDs) {
|
|
@@ -64940,20 +64940,21 @@ var CacheInternal = class {
|
|
|
64940
64940
|
} else if (Array.isArray(value) && // make typescript happy
|
|
64941
64941
|
(typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
|
|
64942
64942
|
let oldIDs = [...previousValue || []];
|
|
64943
|
-
|
|
64944
|
-
|
|
64945
|
-
|
|
64946
|
-
|
|
64947
|
-
|
|
64948
|
-
|
|
64949
|
-
|
|
64950
|
-
|
|
64951
|
-
|
|
64952
|
-
|
|
64953
|
-
|
|
64954
|
-
|
|
64955
|
-
|
|
64956
|
-
|
|
64943
|
+
if (updates?.includes("append") || updates?.includes("prepend")) {
|
|
64944
|
+
oldIDs = oldIDs.filter((id) => {
|
|
64945
|
+
for (const layer2 of this.storage.data) {
|
|
64946
|
+
for (const operation of Object.values(layer2.operations)) {
|
|
64947
|
+
if (operation.fields?.[key])
|
|
64948
|
+
for (const listOperation of operation.fields[key]) {
|
|
64949
|
+
if ("id" in listOperation && listOperation.id === id) {
|
|
64950
|
+
return false;
|
|
64951
|
+
}
|
|
64952
|
+
}
|
|
64953
|
+
}
|
|
64954
|
+
}
|
|
64955
|
+
return true;
|
|
64956
|
+
});
|
|
64957
|
+
}
|
|
64957
64958
|
let linkedIDs = [];
|
|
64958
64959
|
const { newIDs, nestedIDs } = this.extractNestedListIDs({
|
|
64959
64960
|
value,
|
|
@@ -64972,39 +64973,45 @@ var CacheInternal = class {
|
|
|
64972
64973
|
layer.writeLink(parent2, key, linkedIDs);
|
|
64973
64974
|
};
|
|
64974
64975
|
if (applyUpdates && updates) {
|
|
64975
|
-
|
|
64976
|
-
const
|
|
64977
|
-
for (const id of
|
|
64976
|
+
const filterIDs = (keep, insert) => {
|
|
64977
|
+
const existingIDs = /* @__PURE__ */ new Set();
|
|
64978
|
+
for (const id of keep) {
|
|
64978
64979
|
if (!id) {
|
|
64979
64980
|
continue;
|
|
64980
64981
|
}
|
|
64981
64982
|
const { value: node } = this.storage.get(id, "node");
|
|
64982
|
-
if (
|
|
64983
|
+
if (!node) {
|
|
64983
64984
|
continue;
|
|
64984
64985
|
}
|
|
64985
|
-
|
|
64986
|
+
const nodeID = this.storage.get(node, "id");
|
|
64987
|
+
if (!nodeID) {
|
|
64986
64988
|
continue;
|
|
64987
64989
|
}
|
|
64988
|
-
|
|
64990
|
+
existingIDs.add(nodeID.value);
|
|
64989
64991
|
}
|
|
64990
|
-
|
|
64992
|
+
return insert.filter((id) => {
|
|
64991
64993
|
if (!id) {
|
|
64992
64994
|
return true;
|
|
64993
64995
|
}
|
|
64994
|
-
const { value:
|
|
64995
|
-
|
|
64996
|
-
|
|
64997
|
-
return false;
|
|
64996
|
+
const { value: node } = this.storage.get(id, "node");
|
|
64997
|
+
if (!node) {
|
|
64998
|
+
return true;
|
|
64998
64999
|
}
|
|
64999
|
-
|
|
65000
|
+
const nodeID = this.storage.get(node, "id");
|
|
65001
|
+
if (!nodeID) {
|
|
65002
|
+
return true;
|
|
65003
|
+
}
|
|
65004
|
+
return !existingIDs.has(nodeID.value);
|
|
65000
65005
|
});
|
|
65001
|
-
}
|
|
65006
|
+
};
|
|
65002
65007
|
for (const update of applyUpdates) {
|
|
65003
65008
|
if (update !== "replace" && !updates.includes(update)) {
|
|
65004
65009
|
continue;
|
|
65005
65010
|
}
|
|
65006
65011
|
if (update === "prepend") {
|
|
65007
|
-
linkedIDs = newIDs.concat(
|
|
65012
|
+
linkedIDs = newIDs.concat(
|
|
65013
|
+
filterIDs(newIDs, oldIDs)
|
|
65014
|
+
);
|
|
65008
65015
|
if (layer?.optimistic) {
|
|
65009
65016
|
action = () => {
|
|
65010
65017
|
for (const id of newIDs) {
|
|
@@ -65015,7 +65022,7 @@ var CacheInternal = class {
|
|
|
65015
65022
|
};
|
|
65016
65023
|
}
|
|
65017
65024
|
} else if (update === "append") {
|
|
65018
|
-
linkedIDs = oldIDs.concat(newIDs);
|
|
65025
|
+
linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
|
|
65019
65026
|
if (layer?.optimistic) {
|
|
65020
65027
|
action = () => {
|
|
65021
65028
|
for (const id of newIDs) {
|
package/build/lib-cjs/index.js
CHANGED
|
@@ -75378,20 +75378,21 @@ var CacheInternal = class {
|
|
|
75378
75378
|
} else if (Array.isArray(value) && // make typescript happy
|
|
75379
75379
|
(typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
|
|
75380
75380
|
let oldIDs = [...previousValue || []];
|
|
75381
|
-
|
|
75382
|
-
|
|
75383
|
-
|
|
75384
|
-
|
|
75385
|
-
|
|
75386
|
-
|
|
75387
|
-
|
|
75388
|
-
|
|
75389
|
-
|
|
75390
|
-
|
|
75391
|
-
|
|
75392
|
-
|
|
75393
|
-
|
|
75394
|
-
|
|
75381
|
+
if (updates?.includes("append") || updates?.includes("prepend")) {
|
|
75382
|
+
oldIDs = oldIDs.filter((id) => {
|
|
75383
|
+
for (const layer2 of this.storage.data) {
|
|
75384
|
+
for (const operation of Object.values(layer2.operations)) {
|
|
75385
|
+
if (operation.fields?.[key])
|
|
75386
|
+
for (const listOperation of operation.fields[key]) {
|
|
75387
|
+
if ("id" in listOperation && listOperation.id === id) {
|
|
75388
|
+
return false;
|
|
75389
|
+
}
|
|
75390
|
+
}
|
|
75391
|
+
}
|
|
75392
|
+
}
|
|
75393
|
+
return true;
|
|
75394
|
+
});
|
|
75395
|
+
}
|
|
75395
75396
|
let linkedIDs = [];
|
|
75396
75397
|
const { newIDs, nestedIDs } = this.extractNestedListIDs({
|
|
75397
75398
|
value,
|
|
@@ -75410,39 +75411,45 @@ var CacheInternal = class {
|
|
|
75410
75411
|
layer.writeLink(parent, key, linkedIDs);
|
|
75411
75412
|
};
|
|
75412
75413
|
if (applyUpdates && updates) {
|
|
75413
|
-
|
|
75414
|
-
const
|
|
75415
|
-
for (const id of
|
|
75414
|
+
const filterIDs = (keep, insert) => {
|
|
75415
|
+
const existingIDs = /* @__PURE__ */ new Set();
|
|
75416
|
+
for (const id of keep) {
|
|
75416
75417
|
if (!id) {
|
|
75417
75418
|
continue;
|
|
75418
75419
|
}
|
|
75419
75420
|
const { value: node } = this.storage.get(id, "node");
|
|
75420
|
-
if (
|
|
75421
|
+
if (!node) {
|
|
75421
75422
|
continue;
|
|
75422
75423
|
}
|
|
75423
|
-
|
|
75424
|
+
const nodeID = this.storage.get(node, "id");
|
|
75425
|
+
if (!nodeID) {
|
|
75424
75426
|
continue;
|
|
75425
75427
|
}
|
|
75426
|
-
|
|
75428
|
+
existingIDs.add(nodeID.value);
|
|
75427
75429
|
}
|
|
75428
|
-
|
|
75430
|
+
return insert.filter((id) => {
|
|
75429
75431
|
if (!id) {
|
|
75430
75432
|
return true;
|
|
75431
75433
|
}
|
|
75432
|
-
const { value:
|
|
75433
|
-
|
|
75434
|
-
|
|
75435
|
-
return false;
|
|
75434
|
+
const { value: node } = this.storage.get(id, "node");
|
|
75435
|
+
if (!node) {
|
|
75436
|
+
return true;
|
|
75436
75437
|
}
|
|
75437
|
-
|
|
75438
|
+
const nodeID = this.storage.get(node, "id");
|
|
75439
|
+
if (!nodeID) {
|
|
75440
|
+
return true;
|
|
75441
|
+
}
|
|
75442
|
+
return !existingIDs.has(nodeID.value);
|
|
75438
75443
|
});
|
|
75439
|
-
}
|
|
75444
|
+
};
|
|
75440
75445
|
for (const update of applyUpdates) {
|
|
75441
75446
|
if (update !== "replace" && !updates.includes(update)) {
|
|
75442
75447
|
continue;
|
|
75443
75448
|
}
|
|
75444
75449
|
if (update === "prepend") {
|
|
75445
|
-
linkedIDs = newIDs.concat(
|
|
75450
|
+
linkedIDs = newIDs.concat(
|
|
75451
|
+
filterIDs(newIDs, oldIDs)
|
|
75452
|
+
);
|
|
75446
75453
|
if (layer?.optimistic) {
|
|
75447
75454
|
action = () => {
|
|
75448
75455
|
for (const id of newIDs) {
|
|
@@ -75453,7 +75460,7 @@ var CacheInternal = class {
|
|
|
75453
75460
|
};
|
|
75454
75461
|
}
|
|
75455
75462
|
} else if (update === "append") {
|
|
75456
|
-
linkedIDs = oldIDs.concat(newIDs);
|
|
75463
|
+
linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
|
|
75457
75464
|
if (layer?.optimistic) {
|
|
75458
75465
|
action = () => {
|
|
75459
75466
|
for (const id of newIDs) {
|