houdini-svelte 2.2.0-next.2 → 2.2.0-next.4
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/plugin-cjs/index.js +74 -62
- package/build/plugin-esm/index.js +74 -62
- package/build/preprocess-cjs/index.js +72 -58
- package/build/preprocess-esm/index.js +72 -58
- package/build/runtime/types.d.ts +1 -1
- package/build/runtime-cjs/types.d.ts +1 -1
- package/build/runtime-esm/types.d.ts +1 -1
- package/build/test-cjs/index.js +146 -120
- package/build/test-esm/index.js +146 -120
- package/package.json +2 -2
package/build/test-cjs/index.js
CHANGED
|
@@ -87148,20 +87148,21 @@ var CacheInternal = class {
|
|
|
87148
87148
|
} else if (Array.isArray(value) && // make typescript happy
|
|
87149
87149
|
(typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
|
|
87150
87150
|
let oldIDs = [...previousValue || []];
|
|
87151
|
-
|
|
87152
|
-
|
|
87153
|
-
|
|
87154
|
-
|
|
87155
|
-
|
|
87156
|
-
|
|
87157
|
-
|
|
87158
|
-
|
|
87159
|
-
|
|
87160
|
-
|
|
87161
|
-
|
|
87162
|
-
|
|
87163
|
-
|
|
87164
|
-
|
|
87151
|
+
if (updates?.includes("append") || updates?.includes("prepend")) {
|
|
87152
|
+
oldIDs = oldIDs.filter((id) => {
|
|
87153
|
+
for (const layer2 of this.storage.data) {
|
|
87154
|
+
for (const operation of Object.values(layer2.operations)) {
|
|
87155
|
+
if (operation.fields?.[key])
|
|
87156
|
+
for (const listOperation of operation.fields[key]) {
|
|
87157
|
+
if ("id" in listOperation && listOperation.id === id) {
|
|
87158
|
+
return false;
|
|
87159
|
+
}
|
|
87160
|
+
}
|
|
87161
|
+
}
|
|
87162
|
+
}
|
|
87163
|
+
return true;
|
|
87164
|
+
});
|
|
87165
|
+
}
|
|
87165
87166
|
let linkedIDs = [];
|
|
87166
87167
|
const { newIDs, nestedIDs } = this.extractNestedListIDs({
|
|
87167
87168
|
value,
|
|
@@ -87180,39 +87181,45 @@ var CacheInternal = class {
|
|
|
87180
87181
|
layer.writeLink(parent2, key, linkedIDs);
|
|
87181
87182
|
};
|
|
87182
87183
|
if (applyUpdates && updates) {
|
|
87183
|
-
|
|
87184
|
-
const
|
|
87185
|
-
for (const id of
|
|
87184
|
+
const filterIDs = (keep, insert) => {
|
|
87185
|
+
const existingIDs = /* @__PURE__ */ new Set();
|
|
87186
|
+
for (const id of keep) {
|
|
87186
87187
|
if (!id) {
|
|
87187
87188
|
continue;
|
|
87188
87189
|
}
|
|
87189
87190
|
const { value: node } = this.storage.get(id, "node");
|
|
87190
|
-
if (
|
|
87191
|
+
if (!node) {
|
|
87191
87192
|
continue;
|
|
87192
87193
|
}
|
|
87193
|
-
|
|
87194
|
+
const nodeID = this.storage.get(node, "id");
|
|
87195
|
+
if (!nodeID) {
|
|
87194
87196
|
continue;
|
|
87195
87197
|
}
|
|
87196
|
-
|
|
87198
|
+
existingIDs.add(nodeID.value);
|
|
87197
87199
|
}
|
|
87198
|
-
|
|
87200
|
+
return insert.filter((id) => {
|
|
87199
87201
|
if (!id) {
|
|
87200
87202
|
return true;
|
|
87201
87203
|
}
|
|
87202
|
-
const { value:
|
|
87203
|
-
|
|
87204
|
-
|
|
87205
|
-
return false;
|
|
87204
|
+
const { value: node } = this.storage.get(id, "node");
|
|
87205
|
+
if (!node) {
|
|
87206
|
+
return true;
|
|
87206
87207
|
}
|
|
87207
|
-
|
|
87208
|
+
const nodeID = this.storage.get(node, "id");
|
|
87209
|
+
if (!nodeID) {
|
|
87210
|
+
return true;
|
|
87211
|
+
}
|
|
87212
|
+
return !existingIDs.has(nodeID.value);
|
|
87208
87213
|
});
|
|
87209
|
-
}
|
|
87214
|
+
};
|
|
87210
87215
|
for (const update of applyUpdates) {
|
|
87211
87216
|
if (update !== "replace" && !updates.includes(update)) {
|
|
87212
87217
|
continue;
|
|
87213
87218
|
}
|
|
87214
87219
|
if (update === "prepend") {
|
|
87215
|
-
linkedIDs = newIDs.concat(
|
|
87220
|
+
linkedIDs = newIDs.concat(
|
|
87221
|
+
filterIDs(newIDs, oldIDs)
|
|
87222
|
+
);
|
|
87216
87223
|
if (layer?.optimistic) {
|
|
87217
87224
|
action = () => {
|
|
87218
87225
|
for (const id of newIDs) {
|
|
@@ -87223,7 +87230,7 @@ var CacheInternal = class {
|
|
|
87223
87230
|
};
|
|
87224
87231
|
}
|
|
87225
87232
|
} else if (update === "append") {
|
|
87226
|
-
linkedIDs = oldIDs.concat(newIDs);
|
|
87233
|
+
linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
|
|
87227
87234
|
if (layer?.optimistic) {
|
|
87228
87235
|
action = () => {
|
|
87229
87236
|
for (const id of newIDs) {
|
|
@@ -152669,20 +152676,21 @@ var CacheInternal2 = class {
|
|
|
152669
152676
|
} else if (Array.isArray(value) && // make typescript happy
|
|
152670
152677
|
(typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
|
|
152671
152678
|
let oldIDs = [...previousValue || []];
|
|
152672
|
-
|
|
152673
|
-
|
|
152674
|
-
|
|
152675
|
-
|
|
152676
|
-
|
|
152677
|
-
|
|
152678
|
-
|
|
152679
|
-
|
|
152680
|
-
|
|
152681
|
-
|
|
152682
|
-
|
|
152683
|
-
|
|
152684
|
-
|
|
152685
|
-
|
|
152679
|
+
if (updates?.includes("append") || updates?.includes("prepend")) {
|
|
152680
|
+
oldIDs = oldIDs.filter((id) => {
|
|
152681
|
+
for (const layer2 of this.storage.data) {
|
|
152682
|
+
for (const operation of Object.values(layer2.operations)) {
|
|
152683
|
+
if (operation.fields?.[key])
|
|
152684
|
+
for (const listOperation of operation.fields[key]) {
|
|
152685
|
+
if ("id" in listOperation && listOperation.id === id) {
|
|
152686
|
+
return false;
|
|
152687
|
+
}
|
|
152688
|
+
}
|
|
152689
|
+
}
|
|
152690
|
+
}
|
|
152691
|
+
return true;
|
|
152692
|
+
});
|
|
152693
|
+
}
|
|
152686
152694
|
let linkedIDs = [];
|
|
152687
152695
|
const { newIDs, nestedIDs } = this.extractNestedListIDs({
|
|
152688
152696
|
value,
|
|
@@ -152701,39 +152709,45 @@ var CacheInternal2 = class {
|
|
|
152701
152709
|
layer.writeLink(parent2, key, linkedIDs);
|
|
152702
152710
|
};
|
|
152703
152711
|
if (applyUpdates && updates) {
|
|
152704
|
-
|
|
152705
|
-
const
|
|
152706
|
-
for (const id of
|
|
152712
|
+
const filterIDs = (keep, insert) => {
|
|
152713
|
+
const existingIDs = /* @__PURE__ */ new Set();
|
|
152714
|
+
for (const id of keep) {
|
|
152707
152715
|
if (!id) {
|
|
152708
152716
|
continue;
|
|
152709
152717
|
}
|
|
152710
152718
|
const { value: node } = this.storage.get(id, "node");
|
|
152711
|
-
if (
|
|
152719
|
+
if (!node) {
|
|
152712
152720
|
continue;
|
|
152713
152721
|
}
|
|
152714
|
-
|
|
152722
|
+
const nodeID = this.storage.get(node, "id");
|
|
152723
|
+
if (!nodeID) {
|
|
152715
152724
|
continue;
|
|
152716
152725
|
}
|
|
152717
|
-
|
|
152726
|
+
existingIDs.add(nodeID.value);
|
|
152718
152727
|
}
|
|
152719
|
-
|
|
152728
|
+
return insert.filter((id) => {
|
|
152720
152729
|
if (!id) {
|
|
152721
152730
|
return true;
|
|
152722
152731
|
}
|
|
152723
|
-
const { value:
|
|
152724
|
-
|
|
152725
|
-
|
|
152726
|
-
return false;
|
|
152732
|
+
const { value: node } = this.storage.get(id, "node");
|
|
152733
|
+
if (!node) {
|
|
152734
|
+
return true;
|
|
152727
152735
|
}
|
|
152728
|
-
|
|
152736
|
+
const nodeID = this.storage.get(node, "id");
|
|
152737
|
+
if (!nodeID) {
|
|
152738
|
+
return true;
|
|
152739
|
+
}
|
|
152740
|
+
return !existingIDs.has(nodeID.value);
|
|
152729
152741
|
});
|
|
152730
|
-
}
|
|
152742
|
+
};
|
|
152731
152743
|
for (const update of applyUpdates) {
|
|
152732
152744
|
if (update !== "replace" && !updates.includes(update)) {
|
|
152733
152745
|
continue;
|
|
152734
152746
|
}
|
|
152735
152747
|
if (update === "prepend") {
|
|
152736
|
-
linkedIDs = newIDs.concat(
|
|
152748
|
+
linkedIDs = newIDs.concat(
|
|
152749
|
+
filterIDs(newIDs, oldIDs)
|
|
152750
|
+
);
|
|
152737
152751
|
if (layer?.optimistic) {
|
|
152738
152752
|
action = () => {
|
|
152739
152753
|
for (const id of newIDs) {
|
|
@@ -152744,7 +152758,7 @@ var CacheInternal2 = class {
|
|
|
152744
152758
|
};
|
|
152745
152759
|
}
|
|
152746
152760
|
} else if (update === "append") {
|
|
152747
|
-
linkedIDs = oldIDs.concat(newIDs);
|
|
152761
|
+
linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
|
|
152748
152762
|
if (layer?.optimistic) {
|
|
152749
152763
|
action = () => {
|
|
152750
152764
|
for (const id of newIDs) {
|
|
@@ -225789,20 +225803,21 @@ var CacheInternal3 = class {
|
|
|
225789
225803
|
} else if (Array.isArray(value) && // make typescript happy
|
|
225790
225804
|
(typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
|
|
225791
225805
|
let oldIDs = [...previousValue || []];
|
|
225792
|
-
|
|
225793
|
-
|
|
225794
|
-
|
|
225795
|
-
|
|
225796
|
-
|
|
225797
|
-
|
|
225798
|
-
|
|
225799
|
-
|
|
225800
|
-
|
|
225801
|
-
|
|
225802
|
-
|
|
225803
|
-
|
|
225804
|
-
|
|
225805
|
-
|
|
225806
|
+
if (updates?.includes("append") || updates?.includes("prepend")) {
|
|
225807
|
+
oldIDs = oldIDs.filter((id) => {
|
|
225808
|
+
for (const layer2 of this.storage.data) {
|
|
225809
|
+
for (const operation of Object.values(layer2.operations)) {
|
|
225810
|
+
if (operation.fields?.[key])
|
|
225811
|
+
for (const listOperation of operation.fields[key]) {
|
|
225812
|
+
if ("id" in listOperation && listOperation.id === id) {
|
|
225813
|
+
return false;
|
|
225814
|
+
}
|
|
225815
|
+
}
|
|
225816
|
+
}
|
|
225817
|
+
}
|
|
225818
|
+
return true;
|
|
225819
|
+
});
|
|
225820
|
+
}
|
|
225806
225821
|
let linkedIDs = [];
|
|
225807
225822
|
const { newIDs, nestedIDs } = this.extractNestedListIDs({
|
|
225808
225823
|
value,
|
|
@@ -225821,39 +225836,45 @@ var CacheInternal3 = class {
|
|
|
225821
225836
|
layer.writeLink(parent2, key, linkedIDs);
|
|
225822
225837
|
};
|
|
225823
225838
|
if (applyUpdates && updates) {
|
|
225824
|
-
|
|
225825
|
-
const
|
|
225826
|
-
for (const id of
|
|
225839
|
+
const filterIDs = (keep, insert) => {
|
|
225840
|
+
const existingIDs = /* @__PURE__ */ new Set();
|
|
225841
|
+
for (const id of keep) {
|
|
225827
225842
|
if (!id) {
|
|
225828
225843
|
continue;
|
|
225829
225844
|
}
|
|
225830
225845
|
const { value: node } = this.storage.get(id, "node");
|
|
225831
|
-
if (
|
|
225846
|
+
if (!node) {
|
|
225832
225847
|
continue;
|
|
225833
225848
|
}
|
|
225834
|
-
|
|
225849
|
+
const nodeID = this.storage.get(node, "id");
|
|
225850
|
+
if (!nodeID) {
|
|
225835
225851
|
continue;
|
|
225836
225852
|
}
|
|
225837
|
-
|
|
225853
|
+
existingIDs.add(nodeID.value);
|
|
225838
225854
|
}
|
|
225839
|
-
|
|
225855
|
+
return insert.filter((id) => {
|
|
225840
225856
|
if (!id) {
|
|
225841
225857
|
return true;
|
|
225842
225858
|
}
|
|
225843
|
-
const { value:
|
|
225844
|
-
|
|
225845
|
-
|
|
225846
|
-
return false;
|
|
225859
|
+
const { value: node } = this.storage.get(id, "node");
|
|
225860
|
+
if (!node) {
|
|
225861
|
+
return true;
|
|
225847
225862
|
}
|
|
225848
|
-
|
|
225863
|
+
const nodeID = this.storage.get(node, "id");
|
|
225864
|
+
if (!nodeID) {
|
|
225865
|
+
return true;
|
|
225866
|
+
}
|
|
225867
|
+
return !existingIDs.has(nodeID.value);
|
|
225849
225868
|
});
|
|
225850
|
-
}
|
|
225869
|
+
};
|
|
225851
225870
|
for (const update of applyUpdates) {
|
|
225852
225871
|
if (update !== "replace" && !updates.includes(update)) {
|
|
225853
225872
|
continue;
|
|
225854
225873
|
}
|
|
225855
225874
|
if (update === "prepend") {
|
|
225856
|
-
linkedIDs = newIDs.concat(
|
|
225875
|
+
linkedIDs = newIDs.concat(
|
|
225876
|
+
filterIDs(newIDs, oldIDs)
|
|
225877
|
+
);
|
|
225857
225878
|
if (layer?.optimistic) {
|
|
225858
225879
|
action = () => {
|
|
225859
225880
|
for (const id of newIDs) {
|
|
@@ -225864,7 +225885,7 @@ var CacheInternal3 = class {
|
|
|
225864
225885
|
};
|
|
225865
225886
|
}
|
|
225866
225887
|
} else if (update === "append") {
|
|
225867
|
-
linkedIDs = oldIDs.concat(newIDs);
|
|
225888
|
+
linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
|
|
225868
225889
|
if (layer?.optimistic) {
|
|
225869
225890
|
action = () => {
|
|
225870
225891
|
for (const id of newIDs) {
|
|
@@ -298587,20 +298608,21 @@ var CacheInternal4 = class {
|
|
|
298587
298608
|
} else if (Array.isArray(value) && // make typescript happy
|
|
298588
298609
|
(typeof previousValue === "undefined" || previousValue === null || Array.isArray(previousValue))) {
|
|
298589
298610
|
let oldIDs = [...previousValue || []];
|
|
298590
|
-
|
|
298591
|
-
|
|
298592
|
-
|
|
298593
|
-
|
|
298594
|
-
|
|
298595
|
-
|
|
298596
|
-
|
|
298597
|
-
|
|
298598
|
-
|
|
298599
|
-
|
|
298600
|
-
|
|
298601
|
-
|
|
298602
|
-
|
|
298603
|
-
|
|
298611
|
+
if (updates?.includes("append") || updates?.includes("prepend")) {
|
|
298612
|
+
oldIDs = oldIDs.filter((id) => {
|
|
298613
|
+
for (const layer2 of this.storage.data) {
|
|
298614
|
+
for (const operation of Object.values(layer2.operations)) {
|
|
298615
|
+
if (operation.fields?.[key])
|
|
298616
|
+
for (const listOperation of operation.fields[key]) {
|
|
298617
|
+
if ("id" in listOperation && listOperation.id === id) {
|
|
298618
|
+
return false;
|
|
298619
|
+
}
|
|
298620
|
+
}
|
|
298621
|
+
}
|
|
298622
|
+
}
|
|
298623
|
+
return true;
|
|
298624
|
+
});
|
|
298625
|
+
}
|
|
298604
298626
|
let linkedIDs = [];
|
|
298605
298627
|
const { newIDs, nestedIDs } = this.extractNestedListIDs({
|
|
298606
298628
|
value,
|
|
@@ -298619,39 +298641,45 @@ var CacheInternal4 = class {
|
|
|
298619
298641
|
layer.writeLink(parent2, key, linkedIDs);
|
|
298620
298642
|
};
|
|
298621
298643
|
if (applyUpdates && updates) {
|
|
298622
|
-
|
|
298623
|
-
const
|
|
298624
|
-
for (const id of
|
|
298644
|
+
const filterIDs = (keep, insert) => {
|
|
298645
|
+
const existingIDs = /* @__PURE__ */ new Set();
|
|
298646
|
+
for (const id of keep) {
|
|
298625
298647
|
if (!id) {
|
|
298626
298648
|
continue;
|
|
298627
298649
|
}
|
|
298628
298650
|
const { value: node } = this.storage.get(id, "node");
|
|
298629
|
-
if (
|
|
298651
|
+
if (!node) {
|
|
298630
298652
|
continue;
|
|
298631
298653
|
}
|
|
298632
|
-
|
|
298654
|
+
const nodeID = this.storage.get(node, "id");
|
|
298655
|
+
if (!nodeID) {
|
|
298633
298656
|
continue;
|
|
298634
298657
|
}
|
|
298635
|
-
|
|
298658
|
+
existingIDs.add(nodeID.value);
|
|
298636
298659
|
}
|
|
298637
|
-
|
|
298660
|
+
return insert.filter((id) => {
|
|
298638
298661
|
if (!id) {
|
|
298639
298662
|
return true;
|
|
298640
298663
|
}
|
|
298641
|
-
const { value:
|
|
298642
|
-
|
|
298643
|
-
|
|
298644
|
-
return false;
|
|
298664
|
+
const { value: node } = this.storage.get(id, "node");
|
|
298665
|
+
if (!node) {
|
|
298666
|
+
return true;
|
|
298645
298667
|
}
|
|
298646
|
-
|
|
298668
|
+
const nodeID = this.storage.get(node, "id");
|
|
298669
|
+
if (!nodeID) {
|
|
298670
|
+
return true;
|
|
298671
|
+
}
|
|
298672
|
+
return !existingIDs.has(nodeID.value);
|
|
298647
298673
|
});
|
|
298648
|
-
}
|
|
298674
|
+
};
|
|
298649
298675
|
for (const update of applyUpdates) {
|
|
298650
298676
|
if (update !== "replace" && !updates.includes(update)) {
|
|
298651
298677
|
continue;
|
|
298652
298678
|
}
|
|
298653
298679
|
if (update === "prepend") {
|
|
298654
|
-
linkedIDs = newIDs.concat(
|
|
298680
|
+
linkedIDs = newIDs.concat(
|
|
298681
|
+
filterIDs(newIDs, oldIDs)
|
|
298682
|
+
);
|
|
298655
298683
|
if (layer?.optimistic) {
|
|
298656
298684
|
action = () => {
|
|
298657
298685
|
for (const id of newIDs) {
|
|
@@ -298662,7 +298690,7 @@ var CacheInternal4 = class {
|
|
|
298662
298690
|
};
|
|
298663
298691
|
}
|
|
298664
298692
|
} else if (update === "append") {
|
|
298665
|
-
linkedIDs = oldIDs.concat(newIDs);
|
|
298693
|
+
linkedIDs = filterIDs(newIDs, oldIDs).concat(newIDs);
|
|
298666
298694
|
if (layer?.optimistic) {
|
|
298667
298695
|
action = () => {
|
|
298668
298696
|
for (const id of newIDs) {
|
|
@@ -300745,9 +300773,7 @@ import type { ${functionImportsToBring.join(
|
|
|
300745
300773
|
", "
|
|
300746
300774
|
)} } from '${houdiniRelative}/plugins/houdini-svelte/runtime/types';` : "";
|
|
300747
300775
|
typeImports = typeImports.concat(functionImports).concat(layoutTypeImports).concat(pageTypeImports).concat(componentQueryTypeImports);
|
|
300748
|
-
|
|
300749
|
-
const pageParams = `${pageQueries.length > 0 && !utilityTypes.includes("PageParams") ? "\ntype PageParams = PageLoadEvent['params'];" : ""}`;
|
|
300750
|
-
utilityTypes = utilityTypes.concat(layoutParams).concat(pageParams).replaceAll(/\$types\.js/gm, "$houdini");
|
|
300776
|
+
utilityTypes = utilityTypes.replaceAll(/\$types\.js/gm, "$houdini");
|
|
300751
300777
|
typeExports = typeExports.concat(append_loadInput([...layoutQueries, ...pageQueries])).concat(layout_append_beforeLoad).concat(page_append_beforeLoad).concat(layout_append_afterLoad).concat(page_append_afterLoad).concat(layout_append_onError).concat(page_append_onError).concat(layout_append_VariablesFunction).concat(page_append_VariablesFunction).concat(component_append_VariablesFunction).replace(
|
|
300752
300778
|
//regex to append our generated stores to the existing
|
|
300753
300779
|
//match all between 'LayoutData =' and ';' and combine additional types
|
|
@@ -300832,7 +300858,7 @@ function append_VariablesFunction(type, filepath, config, queries) {
|
|
|
300832
300858
|
return `
|
|
300833
300859
|
export type ${config.variableFunctionName(
|
|
300834
300860
|
name
|
|
300835
|
-
)} = VariableFunction<${type}
|
|
300861
|
+
)} = VariableFunction<${type}LoadEvent, ${input_type}>;`;
|
|
300836
300862
|
}).join("\n");
|
|
300837
300863
|
}
|
|
300838
300864
|
function append_ComponentVariablesFunction(filepath, config, queries) {
|