houdini-svelte 1.2.2 → 1.2.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/codegen/index.d.ts +2 -3
- package/build/plugin/fsPatch.d.ts +4 -0
- package/build/plugin-cjs/index.js +303 -103
- package/build/plugin-esm/index.js +303 -103
- package/build/preprocess-cjs/index.js +303 -103
- package/build/preprocess-esm/index.js +303 -103
- package/build/runtime/stores/base.d.ts +1 -1
- package/build/runtime-cjs/stores/base.d.ts +1 -1
- package/build/runtime-esm/stores/base.d.ts +1 -1
- package/build/test-cjs/index.js +635 -215
- package/build/test-esm/index.js +635 -215
- package/package.json +2 -2
package/build/test-esm/index.js
CHANGED
|
@@ -89549,6 +89549,7 @@ __export(fs_exports, {
|
|
|
89549
89549
|
recursiveCopy: () => recursiveCopy,
|
|
89550
89550
|
remove: () => remove,
|
|
89551
89551
|
rmdir: () => rmdir,
|
|
89552
|
+
snapshot: () => snapshot,
|
|
89552
89553
|
stat: () => stat,
|
|
89553
89554
|
writeFile: () => writeFile
|
|
89554
89555
|
});
|
|
@@ -89735,16 +89736,17 @@ function existsSync(dirPath) {
|
|
|
89735
89736
|
}
|
|
89736
89737
|
return import_memfs.fs.existsSync(dirPath);
|
|
89737
89738
|
}
|
|
89738
|
-
async function readdir(filepath) {
|
|
89739
|
+
async function readdir(filepath, opts) {
|
|
89739
89740
|
if (!houdini_mode.is_testing) {
|
|
89740
|
-
return await fs.readdir(filepath);
|
|
89741
|
+
return await fs.readdir(filepath, opts);
|
|
89741
89742
|
}
|
|
89742
89743
|
if (filepath.includes("build/runtime")) {
|
|
89743
|
-
return await fs.readdir(filepath);
|
|
89744
|
+
return await fs.readdir(filepath, opts);
|
|
89744
89745
|
}
|
|
89745
89746
|
try {
|
|
89746
|
-
return import_memfs.fs.readdirSync(filepath);
|
|
89747
|
-
} catch {
|
|
89747
|
+
return import_memfs.fs.readdirSync(filepath, opts);
|
|
89748
|
+
} catch (e22) {
|
|
89749
|
+
console.log(e22);
|
|
89748
89750
|
return [];
|
|
89749
89751
|
}
|
|
89750
89752
|
}
|
|
@@ -89795,6 +89797,11 @@ async function recursiveCopy(source, target, transforms, notRoot) {
|
|
|
89795
89797
|
);
|
|
89796
89798
|
}
|
|
89797
89799
|
}
|
|
89800
|
+
function snapshot(base) {
|
|
89801
|
+
return Object.fromEntries(
|
|
89802
|
+
Object.entries(import_memfs.vol.toJSON()).filter(([key]) => !base || key.startsWith(base)).map(([key, value2]) => [!base ? key : key.substring(base.length), value2])
|
|
89803
|
+
);
|
|
89804
|
+
}
|
|
89798
89805
|
async function glob(pattern) {
|
|
89799
89806
|
return await promisify(import_glob.glob)(posixify(pattern));
|
|
89800
89807
|
}
|
|
@@ -90562,10 +90569,10 @@ var ListManager = class {
|
|
|
90562
90569
|
this.lists.get(list.name).get(parentID).lists.push(handler);
|
|
90563
90570
|
this.listsByField.get(parentID).get(list.key).push(handler);
|
|
90564
90571
|
}
|
|
90565
|
-
removeIDFromAllLists(id2) {
|
|
90572
|
+
removeIDFromAllLists(id2, layer) {
|
|
90566
90573
|
for (const fieldMap of this.lists.values()) {
|
|
90567
90574
|
for (const list of fieldMap.values()) {
|
|
90568
|
-
list.removeID(id2);
|
|
90575
|
+
list.removeID(id2, void 0, layer);
|
|
90569
90576
|
}
|
|
90570
90577
|
}
|
|
90571
90578
|
}
|
|
@@ -90662,6 +90669,10 @@ var List = class {
|
|
|
90662
90669
|
updates: ["append", "prepend"],
|
|
90663
90670
|
selection: {
|
|
90664
90671
|
fields: {
|
|
90672
|
+
__typename: {
|
|
90673
|
+
keyRaw: "__typename",
|
|
90674
|
+
type: "String"
|
|
90675
|
+
},
|
|
90665
90676
|
node: {
|
|
90666
90677
|
type: listType,
|
|
90667
90678
|
keyRaw: "node",
|
|
@@ -90686,7 +90697,15 @@ var List = class {
|
|
|
90686
90697
|
};
|
|
90687
90698
|
insertData = {
|
|
90688
90699
|
newEntry: {
|
|
90689
|
-
edges: [
|
|
90700
|
+
edges: [
|
|
90701
|
+
{
|
|
90702
|
+
__typename: listType + "Edge",
|
|
90703
|
+
node: {
|
|
90704
|
+
...data2,
|
|
90705
|
+
__typename: listType
|
|
90706
|
+
}
|
|
90707
|
+
}
|
|
90708
|
+
]
|
|
90690
90709
|
}
|
|
90691
90710
|
};
|
|
90692
90711
|
} else {
|
|
@@ -90722,7 +90741,7 @@ var List = class {
|
|
|
90722
90741
|
layer: layer?.id
|
|
90723
90742
|
});
|
|
90724
90743
|
}
|
|
90725
|
-
removeID(id2, variables = {}) {
|
|
90744
|
+
removeID(id2, variables = {}, layer) {
|
|
90726
90745
|
if (!this.validateWhen()) {
|
|
90727
90746
|
return;
|
|
90728
90747
|
}
|
|
@@ -90769,7 +90788,7 @@ var List = class {
|
|
|
90769
90788
|
subscribers.map((sub) => sub[0]),
|
|
90770
90789
|
variables
|
|
90771
90790
|
);
|
|
90772
|
-
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID);
|
|
90791
|
+
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID, layer);
|
|
90773
90792
|
for (const [spec] of subscribers) {
|
|
90774
90793
|
spec.set(
|
|
90775
90794
|
this.cache._internal_unstable.getSelection({
|
|
@@ -90782,12 +90801,12 @@ var List = class {
|
|
|
90782
90801
|
}
|
|
90783
90802
|
return true;
|
|
90784
90803
|
}
|
|
90785
|
-
remove(data2, variables = {}) {
|
|
90804
|
+
remove(data2, variables = {}, layer) {
|
|
90786
90805
|
const targetID = this.cache._internal_unstable.id(this.listType(data2), data2);
|
|
90787
90806
|
if (!targetID) {
|
|
90788
90807
|
return;
|
|
90789
90808
|
}
|
|
90790
|
-
return this.removeID(targetID, variables);
|
|
90809
|
+
return this.removeID(targetID, variables, layer);
|
|
90791
90810
|
}
|
|
90792
90811
|
listType(data2) {
|
|
90793
90812
|
return data2.__typename || this.type;
|
|
@@ -90819,7 +90838,7 @@ var List = class {
|
|
|
90819
90838
|
layer,
|
|
90820
90839
|
where
|
|
90821
90840
|
}) {
|
|
90822
|
-
if (!this.remove(data2, variables)) {
|
|
90841
|
+
if (!this.remove(data2, variables, layer)) {
|
|
90823
90842
|
this.addToList(selection, data2, variables, where, layer);
|
|
90824
90843
|
}
|
|
90825
90844
|
}
|
|
@@ -90952,7 +90971,7 @@ var StaleManager = class {
|
|
|
90952
90971
|
};
|
|
90953
90972
|
var InMemoryStorage = class {
|
|
90954
90973
|
data;
|
|
90955
|
-
idCount =
|
|
90974
|
+
idCount = 1;
|
|
90956
90975
|
rank = 0;
|
|
90957
90976
|
constructor() {
|
|
90958
90977
|
this.data = [];
|
|
@@ -90972,11 +90991,11 @@ var InMemoryStorage = class {
|
|
|
90972
90991
|
insert(id2, field, location, target) {
|
|
90973
90992
|
return this.topLayer.insert(id2, field, location, target);
|
|
90974
90993
|
}
|
|
90975
|
-
remove(id2, field, target) {
|
|
90976
|
-
return
|
|
90994
|
+
remove(id2, field, target, layerToUser = this.topLayer) {
|
|
90995
|
+
return layerToUser.remove(id2, field, target);
|
|
90977
90996
|
}
|
|
90978
|
-
delete(id2) {
|
|
90979
|
-
return
|
|
90997
|
+
delete(id2, layerToUser = this.topLayer) {
|
|
90998
|
+
return layerToUser.delete(id2);
|
|
90980
90999
|
}
|
|
90981
91000
|
deleteField(id2, field) {
|
|
90982
91001
|
return this.topLayer.deleteField(id2, field);
|
|
@@ -91110,6 +91129,23 @@ var InMemoryStorage = class {
|
|
|
91110
91129
|
}
|
|
91111
91130
|
return this.data[this.data.length - 1];
|
|
91112
91131
|
}
|
|
91132
|
+
serialize() {
|
|
91133
|
+
return JSON.stringify({
|
|
91134
|
+
rank: this.rank,
|
|
91135
|
+
fields: this.topLayer.fields,
|
|
91136
|
+
links: this.topLayer.links
|
|
91137
|
+
});
|
|
91138
|
+
}
|
|
91139
|
+
hydrate(args, layer) {
|
|
91140
|
+
if (!args) {
|
|
91141
|
+
return;
|
|
91142
|
+
}
|
|
91143
|
+
const { rank, fields, links } = args;
|
|
91144
|
+
this.rank = rank;
|
|
91145
|
+
layer ??= this.createLayer(true);
|
|
91146
|
+
layer.fields = fields;
|
|
91147
|
+
layer.links = links;
|
|
91148
|
+
}
|
|
91113
91149
|
};
|
|
91114
91150
|
var Layer = class {
|
|
91115
91151
|
id;
|
|
@@ -91344,6 +91380,9 @@ var InMemorySubscriptions = class {
|
|
|
91344
91380
|
subscribers = {};
|
|
91345
91381
|
referenceCounts = {};
|
|
91346
91382
|
keyVersions = {};
|
|
91383
|
+
activeFields(parent2) {
|
|
91384
|
+
return Object.keys(this.subscribers[parent2] || {});
|
|
91385
|
+
}
|
|
91347
91386
|
add({
|
|
91348
91387
|
parent: parent2,
|
|
91349
91388
|
spec,
|
|
@@ -91610,20 +91649,7 @@ var Cache = class {
|
|
|
91610
91649
|
}) {
|
|
91611
91650
|
const layer = layerID ? this._internal_unstable.storage.getLayer(layerID) : this._internal_unstable.storage.topLayer;
|
|
91612
91651
|
const subscribers = this._internal_unstable.writeSelection({ ...args, layer }).map((sub) => sub[0]);
|
|
91613
|
-
|
|
91614
|
-
for (const spec of subscribers.concat(notifySubscribers)) {
|
|
91615
|
-
if (!notified.includes(spec.set)) {
|
|
91616
|
-
notified.push(spec.set);
|
|
91617
|
-
spec.set(
|
|
91618
|
-
this._internal_unstable.getSelection({
|
|
91619
|
-
parent: spec.parentID || rootID,
|
|
91620
|
-
selection: spec.selection,
|
|
91621
|
-
variables: spec.variables?.() || {},
|
|
91622
|
-
ignoreMasking: false
|
|
91623
|
-
}).data
|
|
91624
|
-
);
|
|
91625
|
-
}
|
|
91626
|
-
}
|
|
91652
|
+
this.#notifySubscribers(subscribers.concat(notifySubscribers));
|
|
91627
91653
|
return subscribers;
|
|
91628
91654
|
}
|
|
91629
91655
|
read(...args) {
|
|
@@ -91662,10 +91688,10 @@ var Cache = class {
|
|
|
91662
91688
|
}
|
|
91663
91689
|
return handler;
|
|
91664
91690
|
}
|
|
91665
|
-
delete(id2) {
|
|
91691
|
+
delete(id2, layer) {
|
|
91666
91692
|
this._internal_unstable.subscriptions.removeAllSubscribers(id2);
|
|
91667
|
-
this._internal_unstable.lists.removeIDFromAllLists(id2);
|
|
91668
|
-
this._internal_unstable.storage.delete(id2);
|
|
91693
|
+
this._internal_unstable.lists.removeIDFromAllLists(id2, layer);
|
|
91694
|
+
this._internal_unstable.storage.delete(id2, layer);
|
|
91669
91695
|
}
|
|
91670
91696
|
setConfig(config5) {
|
|
91671
91697
|
this._internal_unstable.setConfig(config5);
|
|
@@ -91697,6 +91723,76 @@ var Cache = class {
|
|
|
91697
91723
|
config() {
|
|
91698
91724
|
return this._internal_unstable.config;
|
|
91699
91725
|
}
|
|
91726
|
+
serialize() {
|
|
91727
|
+
return this._internal_unstable.storage.serialize();
|
|
91728
|
+
}
|
|
91729
|
+
hydrate(...args) {
|
|
91730
|
+
return this._internal_unstable.storage.hydrate(...args);
|
|
91731
|
+
}
|
|
91732
|
+
clearLayer(layerID) {
|
|
91733
|
+
const layer = this._internal_unstable.storage.getLayer(layerID);
|
|
91734
|
+
if (!layer) {
|
|
91735
|
+
throw new Error("Cannot find layer with id: " + layerID);
|
|
91736
|
+
}
|
|
91737
|
+
const toNotify = [];
|
|
91738
|
+
const allFields = [];
|
|
91739
|
+
for (const target of [layer.fields, layer.links]) {
|
|
91740
|
+
for (const [id2, fields] of Object.entries(target)) {
|
|
91741
|
+
allFields.push(
|
|
91742
|
+
...Object.entries(fields).map(([field, value2]) => ({ id: id2, field, value: value2 }))
|
|
91743
|
+
);
|
|
91744
|
+
}
|
|
91745
|
+
}
|
|
91746
|
+
const displayFields = [];
|
|
91747
|
+
for (const pair of allFields) {
|
|
91748
|
+
const { displayLayers } = this._internal_unstable.storage.get(pair.id, pair.field);
|
|
91749
|
+
if (!displayLayers.includes(layerID)) {
|
|
91750
|
+
continue;
|
|
91751
|
+
}
|
|
91752
|
+
displayFields.push(pair);
|
|
91753
|
+
}
|
|
91754
|
+
for (const [id2, operation] of Object.entries(layer.operations)) {
|
|
91755
|
+
if (operation.deleted) {
|
|
91756
|
+
displayFields.push(
|
|
91757
|
+
...this._internal_unstable.subscriptions.activeFields(id2).map((field) => ({ id: id2, field }))
|
|
91758
|
+
);
|
|
91759
|
+
}
|
|
91760
|
+
const fields = Object.keys(operation.fields ?? {});
|
|
91761
|
+
if (fields.length > 0) {
|
|
91762
|
+
displayFields.push(...fields.map((field) => ({ id: id2, field })));
|
|
91763
|
+
}
|
|
91764
|
+
}
|
|
91765
|
+
layer.clear();
|
|
91766
|
+
for (const display of displayFields) {
|
|
91767
|
+
const { field, id: id2 } = display;
|
|
91768
|
+
const notify = !("value" in display) || this._internal_unstable.storage.get(id2, field).value !== display.value;
|
|
91769
|
+
if (notify) {
|
|
91770
|
+
toNotify.push(
|
|
91771
|
+
...this._internal_unstable.subscriptions.get(id2, field).map((sub) => sub[0])
|
|
91772
|
+
);
|
|
91773
|
+
}
|
|
91774
|
+
}
|
|
91775
|
+
this.#notifySubscribers(toNotify);
|
|
91776
|
+
}
|
|
91777
|
+
#notifySubscribers(subs) {
|
|
91778
|
+
if (subs.length === 0) {
|
|
91779
|
+
return;
|
|
91780
|
+
}
|
|
91781
|
+
const notified = [];
|
|
91782
|
+
for (const spec of subs) {
|
|
91783
|
+
if (!notified.includes(spec.set)) {
|
|
91784
|
+
notified.push(spec.set);
|
|
91785
|
+
spec.set(
|
|
91786
|
+
this._internal_unstable.getSelection({
|
|
91787
|
+
parent: spec.parentID || rootID,
|
|
91788
|
+
selection: spec.selection,
|
|
91789
|
+
variables: spec.variables?.() || {},
|
|
91790
|
+
ignoreMasking: false
|
|
91791
|
+
}).data
|
|
91792
|
+
);
|
|
91793
|
+
}
|
|
91794
|
+
}
|
|
91795
|
+
}
|
|
91700
91796
|
};
|
|
91701
91797
|
var CacheInternal = class {
|
|
91702
91798
|
_disabled = false;
|
|
@@ -91984,8 +92080,16 @@ var CacheInternal = class {
|
|
|
91984
92080
|
operation.position || "last",
|
|
91985
92081
|
layer
|
|
91986
92082
|
);
|
|
92083
|
+
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
92084
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
|
|
92085
|
+
selection: fieldSelection,
|
|
92086
|
+
data: target,
|
|
92087
|
+
variables,
|
|
92088
|
+
where: operation.position || "last",
|
|
92089
|
+
layer
|
|
92090
|
+
});
|
|
91987
92091
|
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
91988
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables);
|
|
92092
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
|
|
91989
92093
|
} else if (operation.action === "delete" && operation.type) {
|
|
91990
92094
|
if (typeof target !== "string") {
|
|
91991
92095
|
throw new Error("Cannot delete a record with a non-string ID");
|
|
@@ -91994,15 +92098,7 @@ var CacheInternal = class {
|
|
|
91994
92098
|
if (!targetID) {
|
|
91995
92099
|
continue;
|
|
91996
92100
|
}
|
|
91997
|
-
this.cache.delete(targetID);
|
|
91998
|
-
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
91999
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
|
|
92000
|
-
selection: fieldSelection,
|
|
92001
|
-
data: target,
|
|
92002
|
-
variables,
|
|
92003
|
-
where: operation.position || "last",
|
|
92004
|
-
layer
|
|
92005
|
-
});
|
|
92101
|
+
this.cache.delete(targetID, layer);
|
|
92006
92102
|
}
|
|
92007
92103
|
}
|
|
92008
92104
|
}
|
|
@@ -92525,7 +92621,7 @@ var fragment = documentPlugin(ArtifactKind.Fragment, function() {
|
|
|
92525
92621
|
var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
92526
92622
|
return {
|
|
92527
92623
|
async start(ctx, { next, marshalVariables: marshalVariables2 }) {
|
|
92528
|
-
const
|
|
92624
|
+
const layerOptimistic = cache_default._internal_unstable.storage.createLayer(true);
|
|
92529
92625
|
const optimisticResponse = ctx.stuff.optimisticResponse;
|
|
92530
92626
|
let toNotify = [];
|
|
92531
92627
|
if (optimisticResponse) {
|
|
@@ -92536,25 +92632,29 @@ var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
|
92536
92632
|
data: optimisticResponse
|
|
92537
92633
|
}),
|
|
92538
92634
|
variables: marshalVariables2(ctx),
|
|
92539
|
-
layer:
|
|
92635
|
+
layer: layerOptimistic.id
|
|
92540
92636
|
});
|
|
92541
92637
|
}
|
|
92542
92638
|
ctx.cacheParams = {
|
|
92543
92639
|
...ctx.cacheParams,
|
|
92544
|
-
layer,
|
|
92640
|
+
layer: layerOptimistic,
|
|
92545
92641
|
notifySubscribers: toNotify,
|
|
92546
92642
|
forceNotify: true
|
|
92547
92643
|
};
|
|
92548
92644
|
next(ctx);
|
|
92549
92645
|
},
|
|
92550
92646
|
afterNetwork(ctx, { resolve: resolve22 }) {
|
|
92551
|
-
ctx.cacheParams?.layer
|
|
92647
|
+
if (ctx.cacheParams?.layer) {
|
|
92648
|
+
cache_default.clearLayer(ctx.cacheParams.layer.id);
|
|
92649
|
+
}
|
|
92552
92650
|
resolve22(ctx);
|
|
92553
92651
|
},
|
|
92554
92652
|
end(ctx, { resolve: resolve22, value: value2 }) {
|
|
92555
92653
|
const hasErrors = value2.errors && value2.errors.length > 0;
|
|
92556
92654
|
if (hasErrors) {
|
|
92557
|
-
ctx.cacheParams?.layer
|
|
92655
|
+
if (ctx.cacheParams?.layer) {
|
|
92656
|
+
cache_default.clearLayer(ctx.cacheParams.layer.id);
|
|
92657
|
+
}
|
|
92558
92658
|
}
|
|
92559
92659
|
if (ctx.cacheParams?.layer) {
|
|
92560
92660
|
cache_default._internal_unstable.storage.resolveLayer(ctx.cacheParams.layer.id);
|
|
@@ -92564,7 +92664,7 @@ var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
|
92564
92664
|
catch(ctx, { error: error2 }) {
|
|
92565
92665
|
if (ctx.cacheParams?.layer) {
|
|
92566
92666
|
const { layer } = ctx.cacheParams;
|
|
92567
|
-
layer.
|
|
92667
|
+
cache_default.clearLayer(layer.id);
|
|
92568
92668
|
cache_default._internal_unstable.storage.resolveLayer(layer.id);
|
|
92569
92669
|
}
|
|
92570
92670
|
throw error2;
|
|
@@ -92659,7 +92759,7 @@ function deepMerge2(filepath, ...targets) {
|
|
|
92659
92759
|
});
|
|
92660
92760
|
}
|
|
92661
92761
|
}
|
|
92662
|
-
|
|
92762
|
+
function parseJS(str, config5) {
|
|
92663
92763
|
const defaultConfig = {
|
|
92664
92764
|
plugins: ["typescript", "importAssertions"],
|
|
92665
92765
|
sourceType: "module"
|
|
@@ -146783,6 +146883,7 @@ __export2(fs_exports2, {
|
|
|
146783
146883
|
recursiveCopy: () => recursiveCopy2,
|
|
146784
146884
|
remove: () => remove2,
|
|
146785
146885
|
rmdir: () => rmdir2,
|
|
146886
|
+
snapshot: () => snapshot2,
|
|
146786
146887
|
stat: () => stat3,
|
|
146787
146888
|
writeFile: () => writeFile2
|
|
146788
146889
|
});
|
|
@@ -146969,16 +147070,17 @@ function existsSync2(dirPath) {
|
|
|
146969
147070
|
}
|
|
146970
147071
|
return import_memfs2.fs.existsSync(dirPath);
|
|
146971
147072
|
}
|
|
146972
|
-
async function readdir2(filepath) {
|
|
147073
|
+
async function readdir2(filepath, opts) {
|
|
146973
147074
|
if (!houdini_mode2.is_testing) {
|
|
146974
|
-
return await fs3.readdir(filepath);
|
|
147075
|
+
return await fs3.readdir(filepath, opts);
|
|
146975
147076
|
}
|
|
146976
147077
|
if (filepath.includes("build/runtime")) {
|
|
146977
|
-
return await fs3.readdir(filepath);
|
|
147078
|
+
return await fs3.readdir(filepath, opts);
|
|
146978
147079
|
}
|
|
146979
147080
|
try {
|
|
146980
|
-
return import_memfs2.fs.readdirSync(filepath);
|
|
146981
|
-
} catch {
|
|
147081
|
+
return import_memfs2.fs.readdirSync(filepath, opts);
|
|
147082
|
+
} catch (e3) {
|
|
147083
|
+
console.log(e3);
|
|
146982
147084
|
return [];
|
|
146983
147085
|
}
|
|
146984
147086
|
}
|
|
@@ -147029,6 +147131,11 @@ async function recursiveCopy2(source, target, transforms, notRoot) {
|
|
|
147029
147131
|
);
|
|
147030
147132
|
}
|
|
147031
147133
|
}
|
|
147134
|
+
function snapshot2(base) {
|
|
147135
|
+
return Object.fromEntries(
|
|
147136
|
+
Object.entries(import_memfs2.vol.toJSON()).filter(([key]) => !base || key.startsWith(base)).map(([key, value2]) => [!base ? key : key.substring(base.length), value2])
|
|
147137
|
+
);
|
|
147138
|
+
}
|
|
147032
147139
|
async function glob2(pattern) {
|
|
147033
147140
|
return await promisify3(import_glob2.glob)(posixify2(pattern));
|
|
147034
147141
|
}
|
|
@@ -147154,10 +147261,10 @@ var ListManager2 = class {
|
|
|
147154
147261
|
this.lists.get(list.name).get(parentID).lists.push(handler);
|
|
147155
147262
|
this.listsByField.get(parentID).get(list.key).push(handler);
|
|
147156
147263
|
}
|
|
147157
|
-
removeIDFromAllLists(id2) {
|
|
147264
|
+
removeIDFromAllLists(id2, layer) {
|
|
147158
147265
|
for (const fieldMap of this.lists.values()) {
|
|
147159
147266
|
for (const list of fieldMap.values()) {
|
|
147160
|
-
list.removeID(id2);
|
|
147267
|
+
list.removeID(id2, void 0, layer);
|
|
147161
147268
|
}
|
|
147162
147269
|
}
|
|
147163
147270
|
}
|
|
@@ -147254,6 +147361,10 @@ var List2 = class {
|
|
|
147254
147361
|
updates: ["append", "prepend"],
|
|
147255
147362
|
selection: {
|
|
147256
147363
|
fields: {
|
|
147364
|
+
__typename: {
|
|
147365
|
+
keyRaw: "__typename",
|
|
147366
|
+
type: "String"
|
|
147367
|
+
},
|
|
147257
147368
|
node: {
|
|
147258
147369
|
type: listType,
|
|
147259
147370
|
keyRaw: "node",
|
|
@@ -147278,7 +147389,15 @@ var List2 = class {
|
|
|
147278
147389
|
};
|
|
147279
147390
|
insertData = {
|
|
147280
147391
|
newEntry: {
|
|
147281
|
-
edges: [
|
|
147392
|
+
edges: [
|
|
147393
|
+
{
|
|
147394
|
+
__typename: listType + "Edge",
|
|
147395
|
+
node: {
|
|
147396
|
+
...data2,
|
|
147397
|
+
__typename: listType
|
|
147398
|
+
}
|
|
147399
|
+
}
|
|
147400
|
+
]
|
|
147282
147401
|
}
|
|
147283
147402
|
};
|
|
147284
147403
|
} else {
|
|
@@ -147314,7 +147433,7 @@ var List2 = class {
|
|
|
147314
147433
|
layer: layer?.id
|
|
147315
147434
|
});
|
|
147316
147435
|
}
|
|
147317
|
-
removeID(id2, variables = {}) {
|
|
147436
|
+
removeID(id2, variables = {}, layer) {
|
|
147318
147437
|
if (!this.validateWhen()) {
|
|
147319
147438
|
return;
|
|
147320
147439
|
}
|
|
@@ -147361,7 +147480,7 @@ var List2 = class {
|
|
|
147361
147480
|
subscribers.map((sub) => sub[0]),
|
|
147362
147481
|
variables
|
|
147363
147482
|
);
|
|
147364
|
-
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID);
|
|
147483
|
+
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID, layer);
|
|
147365
147484
|
for (const [spec] of subscribers) {
|
|
147366
147485
|
spec.set(
|
|
147367
147486
|
this.cache._internal_unstable.getSelection({
|
|
@@ -147374,12 +147493,12 @@ var List2 = class {
|
|
|
147374
147493
|
}
|
|
147375
147494
|
return true;
|
|
147376
147495
|
}
|
|
147377
|
-
remove(data2, variables = {}) {
|
|
147496
|
+
remove(data2, variables = {}, layer) {
|
|
147378
147497
|
const targetID = this.cache._internal_unstable.id(this.listType(data2), data2);
|
|
147379
147498
|
if (!targetID) {
|
|
147380
147499
|
return;
|
|
147381
147500
|
}
|
|
147382
|
-
return this.removeID(targetID, variables);
|
|
147501
|
+
return this.removeID(targetID, variables, layer);
|
|
147383
147502
|
}
|
|
147384
147503
|
listType(data2) {
|
|
147385
147504
|
return data2.__typename || this.type;
|
|
@@ -147411,7 +147530,7 @@ var List2 = class {
|
|
|
147411
147530
|
layer,
|
|
147412
147531
|
where
|
|
147413
147532
|
}) {
|
|
147414
|
-
if (!this.remove(data2, variables)) {
|
|
147533
|
+
if (!this.remove(data2, variables, layer)) {
|
|
147415
147534
|
this.addToList(selection, data2, variables, where, layer);
|
|
147416
147535
|
}
|
|
147417
147536
|
}
|
|
@@ -147544,7 +147663,7 @@ var StaleManager2 = class {
|
|
|
147544
147663
|
};
|
|
147545
147664
|
var InMemoryStorage2 = class {
|
|
147546
147665
|
data;
|
|
147547
|
-
idCount =
|
|
147666
|
+
idCount = 1;
|
|
147548
147667
|
rank = 0;
|
|
147549
147668
|
constructor() {
|
|
147550
147669
|
this.data = [];
|
|
@@ -147564,11 +147683,11 @@ var InMemoryStorage2 = class {
|
|
|
147564
147683
|
insert(id2, field, location, target) {
|
|
147565
147684
|
return this.topLayer.insert(id2, field, location, target);
|
|
147566
147685
|
}
|
|
147567
|
-
remove(id2, field, target) {
|
|
147568
|
-
return
|
|
147686
|
+
remove(id2, field, target, layerToUser = this.topLayer) {
|
|
147687
|
+
return layerToUser.remove(id2, field, target);
|
|
147569
147688
|
}
|
|
147570
|
-
delete(id2) {
|
|
147571
|
-
return
|
|
147689
|
+
delete(id2, layerToUser = this.topLayer) {
|
|
147690
|
+
return layerToUser.delete(id2);
|
|
147572
147691
|
}
|
|
147573
147692
|
deleteField(id2, field) {
|
|
147574
147693
|
return this.topLayer.deleteField(id2, field);
|
|
@@ -147702,6 +147821,23 @@ var InMemoryStorage2 = class {
|
|
|
147702
147821
|
}
|
|
147703
147822
|
return this.data[this.data.length - 1];
|
|
147704
147823
|
}
|
|
147824
|
+
serialize() {
|
|
147825
|
+
return JSON.stringify({
|
|
147826
|
+
rank: this.rank,
|
|
147827
|
+
fields: this.topLayer.fields,
|
|
147828
|
+
links: this.topLayer.links
|
|
147829
|
+
});
|
|
147830
|
+
}
|
|
147831
|
+
hydrate(args, layer) {
|
|
147832
|
+
if (!args) {
|
|
147833
|
+
return;
|
|
147834
|
+
}
|
|
147835
|
+
const { rank, fields, links } = args;
|
|
147836
|
+
this.rank = rank;
|
|
147837
|
+
layer ??= this.createLayer(true);
|
|
147838
|
+
layer.fields = fields;
|
|
147839
|
+
layer.links = links;
|
|
147840
|
+
}
|
|
147705
147841
|
};
|
|
147706
147842
|
var Layer2 = class {
|
|
147707
147843
|
id;
|
|
@@ -147936,6 +148072,9 @@ var InMemorySubscriptions2 = class {
|
|
|
147936
148072
|
subscribers = {};
|
|
147937
148073
|
referenceCounts = {};
|
|
147938
148074
|
keyVersions = {};
|
|
148075
|
+
activeFields(parent2) {
|
|
148076
|
+
return Object.keys(this.subscribers[parent2] || {});
|
|
148077
|
+
}
|
|
147939
148078
|
add({
|
|
147940
148079
|
parent: parent2,
|
|
147941
148080
|
spec,
|
|
@@ -148202,20 +148341,7 @@ var Cache2 = class {
|
|
|
148202
148341
|
}) {
|
|
148203
148342
|
const layer = layerID ? this._internal_unstable.storage.getLayer(layerID) : this._internal_unstable.storage.topLayer;
|
|
148204
148343
|
const subscribers = this._internal_unstable.writeSelection({ ...args, layer }).map((sub) => sub[0]);
|
|
148205
|
-
|
|
148206
|
-
for (const spec of subscribers.concat(notifySubscribers)) {
|
|
148207
|
-
if (!notified.includes(spec.set)) {
|
|
148208
|
-
notified.push(spec.set);
|
|
148209
|
-
spec.set(
|
|
148210
|
-
this._internal_unstable.getSelection({
|
|
148211
|
-
parent: spec.parentID || rootID2,
|
|
148212
|
-
selection: spec.selection,
|
|
148213
|
-
variables: spec.variables?.() || {},
|
|
148214
|
-
ignoreMasking: false
|
|
148215
|
-
}).data
|
|
148216
|
-
);
|
|
148217
|
-
}
|
|
148218
|
-
}
|
|
148344
|
+
this.#notifySubscribers(subscribers.concat(notifySubscribers));
|
|
148219
148345
|
return subscribers;
|
|
148220
148346
|
}
|
|
148221
148347
|
read(...args) {
|
|
@@ -148254,10 +148380,10 @@ var Cache2 = class {
|
|
|
148254
148380
|
}
|
|
148255
148381
|
return handler;
|
|
148256
148382
|
}
|
|
148257
|
-
delete(id2) {
|
|
148383
|
+
delete(id2, layer) {
|
|
148258
148384
|
this._internal_unstable.subscriptions.removeAllSubscribers(id2);
|
|
148259
|
-
this._internal_unstable.lists.removeIDFromAllLists(id2);
|
|
148260
|
-
this._internal_unstable.storage.delete(id2);
|
|
148385
|
+
this._internal_unstable.lists.removeIDFromAllLists(id2, layer);
|
|
148386
|
+
this._internal_unstable.storage.delete(id2, layer);
|
|
148261
148387
|
}
|
|
148262
148388
|
setConfig(config22) {
|
|
148263
148389
|
this._internal_unstable.setConfig(config22);
|
|
@@ -148289,6 +148415,76 @@ var Cache2 = class {
|
|
|
148289
148415
|
config() {
|
|
148290
148416
|
return this._internal_unstable.config;
|
|
148291
148417
|
}
|
|
148418
|
+
serialize() {
|
|
148419
|
+
return this._internal_unstable.storage.serialize();
|
|
148420
|
+
}
|
|
148421
|
+
hydrate(...args) {
|
|
148422
|
+
return this._internal_unstable.storage.hydrate(...args);
|
|
148423
|
+
}
|
|
148424
|
+
clearLayer(layerID) {
|
|
148425
|
+
const layer = this._internal_unstable.storage.getLayer(layerID);
|
|
148426
|
+
if (!layer) {
|
|
148427
|
+
throw new Error("Cannot find layer with id: " + layerID);
|
|
148428
|
+
}
|
|
148429
|
+
const toNotify = [];
|
|
148430
|
+
const allFields = [];
|
|
148431
|
+
for (const target of [layer.fields, layer.links]) {
|
|
148432
|
+
for (const [id2, fields] of Object.entries(target)) {
|
|
148433
|
+
allFields.push(
|
|
148434
|
+
...Object.entries(fields).map(([field, value2]) => ({ id: id2, field, value: value2 }))
|
|
148435
|
+
);
|
|
148436
|
+
}
|
|
148437
|
+
}
|
|
148438
|
+
const displayFields = [];
|
|
148439
|
+
for (const pair of allFields) {
|
|
148440
|
+
const { displayLayers } = this._internal_unstable.storage.get(pair.id, pair.field);
|
|
148441
|
+
if (!displayLayers.includes(layerID)) {
|
|
148442
|
+
continue;
|
|
148443
|
+
}
|
|
148444
|
+
displayFields.push(pair);
|
|
148445
|
+
}
|
|
148446
|
+
for (const [id2, operation] of Object.entries(layer.operations)) {
|
|
148447
|
+
if (operation.deleted) {
|
|
148448
|
+
displayFields.push(
|
|
148449
|
+
...this._internal_unstable.subscriptions.activeFields(id2).map((field) => ({ id: id2, field }))
|
|
148450
|
+
);
|
|
148451
|
+
}
|
|
148452
|
+
const fields = Object.keys(operation.fields ?? {});
|
|
148453
|
+
if (fields.length > 0) {
|
|
148454
|
+
displayFields.push(...fields.map((field) => ({ id: id2, field })));
|
|
148455
|
+
}
|
|
148456
|
+
}
|
|
148457
|
+
layer.clear();
|
|
148458
|
+
for (const display of displayFields) {
|
|
148459
|
+
const { field, id: id2 } = display;
|
|
148460
|
+
const notify = !("value" in display) || this._internal_unstable.storage.get(id2, field).value !== display.value;
|
|
148461
|
+
if (notify) {
|
|
148462
|
+
toNotify.push(
|
|
148463
|
+
...this._internal_unstable.subscriptions.get(id2, field).map((sub) => sub[0])
|
|
148464
|
+
);
|
|
148465
|
+
}
|
|
148466
|
+
}
|
|
148467
|
+
this.#notifySubscribers(toNotify);
|
|
148468
|
+
}
|
|
148469
|
+
#notifySubscribers(subs) {
|
|
148470
|
+
if (subs.length === 0) {
|
|
148471
|
+
return;
|
|
148472
|
+
}
|
|
148473
|
+
const notified = [];
|
|
148474
|
+
for (const spec of subs) {
|
|
148475
|
+
if (!notified.includes(spec.set)) {
|
|
148476
|
+
notified.push(spec.set);
|
|
148477
|
+
spec.set(
|
|
148478
|
+
this._internal_unstable.getSelection({
|
|
148479
|
+
parent: spec.parentID || rootID2,
|
|
148480
|
+
selection: spec.selection,
|
|
148481
|
+
variables: spec.variables?.() || {},
|
|
148482
|
+
ignoreMasking: false
|
|
148483
|
+
}).data
|
|
148484
|
+
);
|
|
148485
|
+
}
|
|
148486
|
+
}
|
|
148487
|
+
}
|
|
148292
148488
|
};
|
|
148293
148489
|
var CacheInternal2 = class {
|
|
148294
148490
|
_disabled = false;
|
|
@@ -148576,8 +148772,16 @@ var CacheInternal2 = class {
|
|
|
148576
148772
|
operation.position || "last",
|
|
148577
148773
|
layer
|
|
148578
148774
|
);
|
|
148775
|
+
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
148776
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
|
|
148777
|
+
selection: fieldSelection,
|
|
148778
|
+
data: target,
|
|
148779
|
+
variables,
|
|
148780
|
+
where: operation.position || "last",
|
|
148781
|
+
layer
|
|
148782
|
+
});
|
|
148579
148783
|
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
148580
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables);
|
|
148784
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
|
|
148581
148785
|
} else if (operation.action === "delete" && operation.type) {
|
|
148582
148786
|
if (typeof target !== "string") {
|
|
148583
148787
|
throw new Error("Cannot delete a record with a non-string ID");
|
|
@@ -148586,15 +148790,7 @@ var CacheInternal2 = class {
|
|
|
148586
148790
|
if (!targetID) {
|
|
148587
148791
|
continue;
|
|
148588
148792
|
}
|
|
148589
|
-
this.cache.delete(targetID);
|
|
148590
|
-
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
148591
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
|
|
148592
|
-
selection: fieldSelection,
|
|
148593
|
-
data: target,
|
|
148594
|
-
variables,
|
|
148595
|
-
where: operation.position || "last",
|
|
148596
|
-
layer
|
|
148597
|
-
});
|
|
148793
|
+
this.cache.delete(targetID, layer);
|
|
148598
148794
|
}
|
|
148599
148795
|
}
|
|
148600
148796
|
}
|
|
@@ -149117,7 +149313,7 @@ var fragment2 = documentPlugin2(ArtifactKind2.Fragment, function() {
|
|
|
149117
149313
|
var mutation2 = documentPlugin2(ArtifactKind2.Mutation, () => {
|
|
149118
149314
|
return {
|
|
149119
149315
|
async start(ctx, { next, marshalVariables }) {
|
|
149120
|
-
const
|
|
149316
|
+
const layerOptimistic = cache_default2._internal_unstable.storage.createLayer(true);
|
|
149121
149317
|
const optimisticResponse = ctx.stuff.optimisticResponse;
|
|
149122
149318
|
let toNotify = [];
|
|
149123
149319
|
if (optimisticResponse) {
|
|
@@ -149128,25 +149324,29 @@ var mutation2 = documentPlugin2(ArtifactKind2.Mutation, () => {
|
|
|
149128
149324
|
data: optimisticResponse
|
|
149129
149325
|
}),
|
|
149130
149326
|
variables: marshalVariables(ctx),
|
|
149131
|
-
layer:
|
|
149327
|
+
layer: layerOptimistic.id
|
|
149132
149328
|
});
|
|
149133
149329
|
}
|
|
149134
149330
|
ctx.cacheParams = {
|
|
149135
149331
|
...ctx.cacheParams,
|
|
149136
|
-
layer,
|
|
149332
|
+
layer: layerOptimistic,
|
|
149137
149333
|
notifySubscribers: toNotify,
|
|
149138
149334
|
forceNotify: true
|
|
149139
149335
|
};
|
|
149140
149336
|
next(ctx);
|
|
149141
149337
|
},
|
|
149142
149338
|
afterNetwork(ctx, { resolve: resolve22 }) {
|
|
149143
|
-
ctx.cacheParams?.layer
|
|
149339
|
+
if (ctx.cacheParams?.layer) {
|
|
149340
|
+
cache_default2.clearLayer(ctx.cacheParams.layer.id);
|
|
149341
|
+
}
|
|
149144
149342
|
resolve22(ctx);
|
|
149145
149343
|
},
|
|
149146
149344
|
end(ctx, { resolve: resolve22, value: value2 }) {
|
|
149147
149345
|
const hasErrors = value2.errors && value2.errors.length > 0;
|
|
149148
149346
|
if (hasErrors) {
|
|
149149
|
-
ctx.cacheParams?.layer
|
|
149347
|
+
if (ctx.cacheParams?.layer) {
|
|
149348
|
+
cache_default2.clearLayer(ctx.cacheParams.layer.id);
|
|
149349
|
+
}
|
|
149150
149350
|
}
|
|
149151
149351
|
if (ctx.cacheParams?.layer) {
|
|
149152
149352
|
cache_default2._internal_unstable.storage.resolveLayer(ctx.cacheParams.layer.id);
|
|
@@ -149156,7 +149356,7 @@ var mutation2 = documentPlugin2(ArtifactKind2.Mutation, () => {
|
|
|
149156
149356
|
catch(ctx, { error: error2 }) {
|
|
149157
149357
|
if (ctx.cacheParams?.layer) {
|
|
149158
149358
|
const { layer } = ctx.cacheParams;
|
|
149159
|
-
layer.
|
|
149359
|
+
cache_default2.clearLayer(layer.id);
|
|
149160
149360
|
cache_default2._internal_unstable.storage.resolveLayer(layer.id);
|
|
149161
149361
|
}
|
|
149162
149362
|
throw error2;
|
|
@@ -149346,7 +149546,7 @@ function deepMerge22(filepath, ...targets) {
|
|
|
149346
149546
|
});
|
|
149347
149547
|
}
|
|
149348
149548
|
}
|
|
149349
|
-
|
|
149549
|
+
function parseJS2(str, config22) {
|
|
149350
149550
|
const defaultConfig = {
|
|
149351
149551
|
plugins: ["typescript", "importAssertions"],
|
|
149352
149552
|
sourceType: "module"
|
|
@@ -150536,7 +150736,7 @@ function operationObject({
|
|
|
150536
150736
|
if (operationKind === "insert" || operationKind === "toggle") {
|
|
150537
150737
|
operation.position = position;
|
|
150538
150738
|
}
|
|
150539
|
-
if (operationKind
|
|
150739
|
+
if (allLists && operationKind !== "delete") {
|
|
150540
150740
|
operation.target = "all";
|
|
150541
150741
|
}
|
|
150542
150742
|
if (parentID) {
|
|
@@ -152344,12 +152544,28 @@ ${exportStatement("config")}
|
|
|
152344
152544
|
},
|
|
152345
152545
|
[path_exports2.join(config22.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config: config22, content, importStatement, exportStatement })
|
|
152346
152546
|
}),
|
|
152347
|
-
...config22.plugins.filter((plugin2) => plugin2.includeRuntime).map(
|
|
152547
|
+
...config22.plugins.filter((plugin2) => plugin2.includeRuntime).map(
|
|
152548
|
+
(plugin2) => generatePluginRuntime({
|
|
152549
|
+
config: config22,
|
|
152550
|
+
docs,
|
|
152551
|
+
plugin: plugin2,
|
|
152552
|
+
importStatement,
|
|
152553
|
+
exportDefaultStatement: exportStatement,
|
|
152554
|
+
exportStarStatement: exportStar
|
|
152555
|
+
})
|
|
152556
|
+
),
|
|
152348
152557
|
generatePluginIndex({ config: config22, exportStatement: exportStar })
|
|
152349
152558
|
]);
|
|
152350
152559
|
await generateGraphqlReturnTypes(config22, docs);
|
|
152351
152560
|
}
|
|
152352
|
-
async function generatePluginRuntime(
|
|
152561
|
+
async function generatePluginRuntime({
|
|
152562
|
+
config: config22,
|
|
152563
|
+
docs,
|
|
152564
|
+
plugin: plugin2,
|
|
152565
|
+
importStatement,
|
|
152566
|
+
exportDefaultStatement,
|
|
152567
|
+
exportStarStatement
|
|
152568
|
+
}) {
|
|
152353
152569
|
if (houdini_mode2.is_testing || !plugin2.includeRuntime) {
|
|
152354
152570
|
return;
|
|
152355
152571
|
}
|
|
@@ -152377,7 +152593,13 @@ async function generatePluginRuntime(config22, docs, plugin2) {
|
|
|
152377
152593
|
Object.fromEntries(
|
|
152378
152594
|
Object.entries(transformMap).map(([key, value2]) => [
|
|
152379
152595
|
path_exports2.join(runtime_path, key),
|
|
152380
|
-
(content) => value2({
|
|
152596
|
+
(content) => value2({
|
|
152597
|
+
config: config22,
|
|
152598
|
+
content,
|
|
152599
|
+
importStatement,
|
|
152600
|
+
exportDefaultStatement,
|
|
152601
|
+
exportStarStatement
|
|
152602
|
+
})
|
|
152381
152603
|
])
|
|
152382
152604
|
)
|
|
152383
152605
|
);
|
|
@@ -154207,14 +154429,12 @@ async function typeCheck(config22, docs) {
|
|
|
154207
154429
|
for (const targetType of targetTypes) {
|
|
154208
154430
|
const missingIDFields = config22.keyFieldsForType(targetType.name).filter((fieldName) => !targetType.getFields()[fieldName]);
|
|
154209
154431
|
if (missingIDFields.length > 0) {
|
|
154210
|
-
const message = `@${config22.listDirective} on ${logGreen(
|
|
154211
|
-
targetType.name
|
|
154212
|
-
)} as a configuration issue. Object identification missing: ${missingIDFields.map((c2) => `"${logYellow(c2)}"`).join(", ")}. Check 'Custom IDs' if needed.`;
|
|
154213
154432
|
errors.push(
|
|
154214
154433
|
new HoudiniError2({
|
|
154215
154434
|
filepath: filename,
|
|
154216
|
-
message
|
|
154217
|
-
|
|
154435
|
+
message: `@${config22.listDirective} on ${logGreen(
|
|
154436
|
+
targetType.name
|
|
154437
|
+
)} has a configuration issue: ${targetType} dos not have a valid key. Please check this link for more information: https://houdinigraphql.com/guides/caching-data#custom-ids`
|
|
154218
154438
|
})
|
|
154219
154439
|
);
|
|
154220
154440
|
return;
|
|
@@ -209013,6 +209233,7 @@ __export3(fs_exports3, {
|
|
|
209013
209233
|
recursiveCopy: () => recursiveCopy3,
|
|
209014
209234
|
remove: () => remove3,
|
|
209015
209235
|
rmdir: () => rmdir3,
|
|
209236
|
+
snapshot: () => snapshot3,
|
|
209016
209237
|
stat: () => stat4,
|
|
209017
209238
|
writeFile: () => writeFile3
|
|
209018
209239
|
});
|
|
@@ -209199,16 +209420,17 @@ function existsSync3(dirPath) {
|
|
|
209199
209420
|
}
|
|
209200
209421
|
return import_memfs3.fs.existsSync(dirPath);
|
|
209201
209422
|
}
|
|
209202
|
-
async function readdir3(filepath) {
|
|
209423
|
+
async function readdir3(filepath, opts) {
|
|
209203
209424
|
if (!houdini_mode3.is_testing) {
|
|
209204
|
-
return await fs4.readdir(filepath);
|
|
209425
|
+
return await fs4.readdir(filepath, opts);
|
|
209205
209426
|
}
|
|
209206
209427
|
if (filepath.includes("build/runtime")) {
|
|
209207
|
-
return await fs4.readdir(filepath);
|
|
209428
|
+
return await fs4.readdir(filepath, opts);
|
|
209208
209429
|
}
|
|
209209
209430
|
try {
|
|
209210
|
-
return import_memfs3.fs.readdirSync(filepath);
|
|
209211
|
-
} catch {
|
|
209431
|
+
return import_memfs3.fs.readdirSync(filepath, opts);
|
|
209432
|
+
} catch (e3) {
|
|
209433
|
+
console.log(e3);
|
|
209212
209434
|
return [];
|
|
209213
209435
|
}
|
|
209214
209436
|
}
|
|
@@ -209259,6 +209481,11 @@ async function recursiveCopy3(source, target, transforms, notRoot) {
|
|
|
209259
209481
|
);
|
|
209260
209482
|
}
|
|
209261
209483
|
}
|
|
209484
|
+
function snapshot3(base) {
|
|
209485
|
+
return Object.fromEntries(
|
|
209486
|
+
Object.entries(import_memfs3.vol.toJSON()).filter(([key]) => !base || key.startsWith(base)).map(([key, value2]) => [!base ? key : key.substring(base.length), value2])
|
|
209487
|
+
);
|
|
209488
|
+
}
|
|
209262
209489
|
async function glob3(pattern) {
|
|
209263
209490
|
return await promisify4(import_glob3.glob)(posixify3(pattern));
|
|
209264
209491
|
}
|
|
@@ -209384,10 +209611,10 @@ var ListManager3 = class {
|
|
|
209384
209611
|
this.lists.get(list.name).get(parentID).lists.push(handler);
|
|
209385
209612
|
this.listsByField.get(parentID).get(list.key).push(handler);
|
|
209386
209613
|
}
|
|
209387
|
-
removeIDFromAllLists(id2) {
|
|
209614
|
+
removeIDFromAllLists(id2, layer) {
|
|
209388
209615
|
for (const fieldMap of this.lists.values()) {
|
|
209389
209616
|
for (const list of fieldMap.values()) {
|
|
209390
|
-
list.removeID(id2);
|
|
209617
|
+
list.removeID(id2, void 0, layer);
|
|
209391
209618
|
}
|
|
209392
209619
|
}
|
|
209393
209620
|
}
|
|
@@ -209484,6 +209711,10 @@ var List3 = class {
|
|
|
209484
209711
|
updates: ["append", "prepend"],
|
|
209485
209712
|
selection: {
|
|
209486
209713
|
fields: {
|
|
209714
|
+
__typename: {
|
|
209715
|
+
keyRaw: "__typename",
|
|
209716
|
+
type: "String"
|
|
209717
|
+
},
|
|
209487
209718
|
node: {
|
|
209488
209719
|
type: listType,
|
|
209489
209720
|
keyRaw: "node",
|
|
@@ -209508,7 +209739,15 @@ var List3 = class {
|
|
|
209508
209739
|
};
|
|
209509
209740
|
insertData = {
|
|
209510
209741
|
newEntry: {
|
|
209511
|
-
edges: [
|
|
209742
|
+
edges: [
|
|
209743
|
+
{
|
|
209744
|
+
__typename: listType + "Edge",
|
|
209745
|
+
node: {
|
|
209746
|
+
...data2,
|
|
209747
|
+
__typename: listType
|
|
209748
|
+
}
|
|
209749
|
+
}
|
|
209750
|
+
]
|
|
209512
209751
|
}
|
|
209513
209752
|
};
|
|
209514
209753
|
} else {
|
|
@@ -209544,7 +209783,7 @@ var List3 = class {
|
|
|
209544
209783
|
layer: layer?.id
|
|
209545
209784
|
});
|
|
209546
209785
|
}
|
|
209547
|
-
removeID(id2, variables = {}) {
|
|
209786
|
+
removeID(id2, variables = {}, layer) {
|
|
209548
209787
|
if (!this.validateWhen()) {
|
|
209549
209788
|
return;
|
|
209550
209789
|
}
|
|
@@ -209591,7 +209830,7 @@ var List3 = class {
|
|
|
209591
209830
|
subscribers.map((sub) => sub[0]),
|
|
209592
209831
|
variables
|
|
209593
209832
|
);
|
|
209594
|
-
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID);
|
|
209833
|
+
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID, layer);
|
|
209595
209834
|
for (const [spec] of subscribers) {
|
|
209596
209835
|
spec.set(
|
|
209597
209836
|
this.cache._internal_unstable.getSelection({
|
|
@@ -209604,12 +209843,12 @@ var List3 = class {
|
|
|
209604
209843
|
}
|
|
209605
209844
|
return true;
|
|
209606
209845
|
}
|
|
209607
|
-
remove(data2, variables = {}) {
|
|
209846
|
+
remove(data2, variables = {}, layer) {
|
|
209608
209847
|
const targetID = this.cache._internal_unstable.id(this.listType(data2), data2);
|
|
209609
209848
|
if (!targetID) {
|
|
209610
209849
|
return;
|
|
209611
209850
|
}
|
|
209612
|
-
return this.removeID(targetID, variables);
|
|
209851
|
+
return this.removeID(targetID, variables, layer);
|
|
209613
209852
|
}
|
|
209614
209853
|
listType(data2) {
|
|
209615
209854
|
return data2.__typename || this.type;
|
|
@@ -209641,7 +209880,7 @@ var List3 = class {
|
|
|
209641
209880
|
layer,
|
|
209642
209881
|
where
|
|
209643
209882
|
}) {
|
|
209644
|
-
if (!this.remove(data2, variables)) {
|
|
209883
|
+
if (!this.remove(data2, variables, layer)) {
|
|
209645
209884
|
this.addToList(selection, data2, variables, where, layer);
|
|
209646
209885
|
}
|
|
209647
209886
|
}
|
|
@@ -209774,7 +210013,7 @@ var StaleManager3 = class {
|
|
|
209774
210013
|
};
|
|
209775
210014
|
var InMemoryStorage3 = class {
|
|
209776
210015
|
data;
|
|
209777
|
-
idCount =
|
|
210016
|
+
idCount = 1;
|
|
209778
210017
|
rank = 0;
|
|
209779
210018
|
constructor() {
|
|
209780
210019
|
this.data = [];
|
|
@@ -209794,11 +210033,11 @@ var InMemoryStorage3 = class {
|
|
|
209794
210033
|
insert(id2, field, location, target) {
|
|
209795
210034
|
return this.topLayer.insert(id2, field, location, target);
|
|
209796
210035
|
}
|
|
209797
|
-
remove(id2, field, target) {
|
|
209798
|
-
return
|
|
210036
|
+
remove(id2, field, target, layerToUser = this.topLayer) {
|
|
210037
|
+
return layerToUser.remove(id2, field, target);
|
|
209799
210038
|
}
|
|
209800
|
-
delete(id2) {
|
|
209801
|
-
return
|
|
210039
|
+
delete(id2, layerToUser = this.topLayer) {
|
|
210040
|
+
return layerToUser.delete(id2);
|
|
209802
210041
|
}
|
|
209803
210042
|
deleteField(id2, field) {
|
|
209804
210043
|
return this.topLayer.deleteField(id2, field);
|
|
@@ -209932,6 +210171,23 @@ var InMemoryStorage3 = class {
|
|
|
209932
210171
|
}
|
|
209933
210172
|
return this.data[this.data.length - 1];
|
|
209934
210173
|
}
|
|
210174
|
+
serialize() {
|
|
210175
|
+
return JSON.stringify({
|
|
210176
|
+
rank: this.rank,
|
|
210177
|
+
fields: this.topLayer.fields,
|
|
210178
|
+
links: this.topLayer.links
|
|
210179
|
+
});
|
|
210180
|
+
}
|
|
210181
|
+
hydrate(args, layer) {
|
|
210182
|
+
if (!args) {
|
|
210183
|
+
return;
|
|
210184
|
+
}
|
|
210185
|
+
const { rank, fields, links } = args;
|
|
210186
|
+
this.rank = rank;
|
|
210187
|
+
layer ??= this.createLayer(true);
|
|
210188
|
+
layer.fields = fields;
|
|
210189
|
+
layer.links = links;
|
|
210190
|
+
}
|
|
209935
210191
|
};
|
|
209936
210192
|
var Layer3 = class {
|
|
209937
210193
|
id;
|
|
@@ -210166,6 +210422,9 @@ var InMemorySubscriptions3 = class {
|
|
|
210166
210422
|
subscribers = {};
|
|
210167
210423
|
referenceCounts = {};
|
|
210168
210424
|
keyVersions = {};
|
|
210425
|
+
activeFields(parent2) {
|
|
210426
|
+
return Object.keys(this.subscribers[parent2] || {});
|
|
210427
|
+
}
|
|
210169
210428
|
add({
|
|
210170
210429
|
parent: parent2,
|
|
210171
210430
|
spec,
|
|
@@ -210432,20 +210691,7 @@ var Cache3 = class {
|
|
|
210432
210691
|
}) {
|
|
210433
210692
|
const layer = layerID ? this._internal_unstable.storage.getLayer(layerID) : this._internal_unstable.storage.topLayer;
|
|
210434
210693
|
const subscribers = this._internal_unstable.writeSelection({ ...args, layer }).map((sub) => sub[0]);
|
|
210435
|
-
|
|
210436
|
-
for (const spec of subscribers.concat(notifySubscribers)) {
|
|
210437
|
-
if (!notified.includes(spec.set)) {
|
|
210438
|
-
notified.push(spec.set);
|
|
210439
|
-
spec.set(
|
|
210440
|
-
this._internal_unstable.getSelection({
|
|
210441
|
-
parent: spec.parentID || rootID3,
|
|
210442
|
-
selection: spec.selection,
|
|
210443
|
-
variables: spec.variables?.() || {},
|
|
210444
|
-
ignoreMasking: false
|
|
210445
|
-
}).data
|
|
210446
|
-
);
|
|
210447
|
-
}
|
|
210448
|
-
}
|
|
210694
|
+
this.#notifySubscribers(subscribers.concat(notifySubscribers));
|
|
210449
210695
|
return subscribers;
|
|
210450
210696
|
}
|
|
210451
210697
|
read(...args) {
|
|
@@ -210484,10 +210730,10 @@ var Cache3 = class {
|
|
|
210484
210730
|
}
|
|
210485
210731
|
return handler;
|
|
210486
210732
|
}
|
|
210487
|
-
delete(id2) {
|
|
210733
|
+
delete(id2, layer) {
|
|
210488
210734
|
this._internal_unstable.subscriptions.removeAllSubscribers(id2);
|
|
210489
|
-
this._internal_unstable.lists.removeIDFromAllLists(id2);
|
|
210490
|
-
this._internal_unstable.storage.delete(id2);
|
|
210735
|
+
this._internal_unstable.lists.removeIDFromAllLists(id2, layer);
|
|
210736
|
+
this._internal_unstable.storage.delete(id2, layer);
|
|
210491
210737
|
}
|
|
210492
210738
|
setConfig(config22) {
|
|
210493
210739
|
this._internal_unstable.setConfig(config22);
|
|
@@ -210519,6 +210765,76 @@ var Cache3 = class {
|
|
|
210519
210765
|
config() {
|
|
210520
210766
|
return this._internal_unstable.config;
|
|
210521
210767
|
}
|
|
210768
|
+
serialize() {
|
|
210769
|
+
return this._internal_unstable.storage.serialize();
|
|
210770
|
+
}
|
|
210771
|
+
hydrate(...args) {
|
|
210772
|
+
return this._internal_unstable.storage.hydrate(...args);
|
|
210773
|
+
}
|
|
210774
|
+
clearLayer(layerID) {
|
|
210775
|
+
const layer = this._internal_unstable.storage.getLayer(layerID);
|
|
210776
|
+
if (!layer) {
|
|
210777
|
+
throw new Error("Cannot find layer with id: " + layerID);
|
|
210778
|
+
}
|
|
210779
|
+
const toNotify = [];
|
|
210780
|
+
const allFields = [];
|
|
210781
|
+
for (const target of [layer.fields, layer.links]) {
|
|
210782
|
+
for (const [id2, fields] of Object.entries(target)) {
|
|
210783
|
+
allFields.push(
|
|
210784
|
+
...Object.entries(fields).map(([field, value2]) => ({ id: id2, field, value: value2 }))
|
|
210785
|
+
);
|
|
210786
|
+
}
|
|
210787
|
+
}
|
|
210788
|
+
const displayFields = [];
|
|
210789
|
+
for (const pair of allFields) {
|
|
210790
|
+
const { displayLayers } = this._internal_unstable.storage.get(pair.id, pair.field);
|
|
210791
|
+
if (!displayLayers.includes(layerID)) {
|
|
210792
|
+
continue;
|
|
210793
|
+
}
|
|
210794
|
+
displayFields.push(pair);
|
|
210795
|
+
}
|
|
210796
|
+
for (const [id2, operation] of Object.entries(layer.operations)) {
|
|
210797
|
+
if (operation.deleted) {
|
|
210798
|
+
displayFields.push(
|
|
210799
|
+
...this._internal_unstable.subscriptions.activeFields(id2).map((field) => ({ id: id2, field }))
|
|
210800
|
+
);
|
|
210801
|
+
}
|
|
210802
|
+
const fields = Object.keys(operation.fields ?? {});
|
|
210803
|
+
if (fields.length > 0) {
|
|
210804
|
+
displayFields.push(...fields.map((field) => ({ id: id2, field })));
|
|
210805
|
+
}
|
|
210806
|
+
}
|
|
210807
|
+
layer.clear();
|
|
210808
|
+
for (const display of displayFields) {
|
|
210809
|
+
const { field, id: id2 } = display;
|
|
210810
|
+
const notify = !("value" in display) || this._internal_unstable.storage.get(id2, field).value !== display.value;
|
|
210811
|
+
if (notify) {
|
|
210812
|
+
toNotify.push(
|
|
210813
|
+
...this._internal_unstable.subscriptions.get(id2, field).map((sub) => sub[0])
|
|
210814
|
+
);
|
|
210815
|
+
}
|
|
210816
|
+
}
|
|
210817
|
+
this.#notifySubscribers(toNotify);
|
|
210818
|
+
}
|
|
210819
|
+
#notifySubscribers(subs) {
|
|
210820
|
+
if (subs.length === 0) {
|
|
210821
|
+
return;
|
|
210822
|
+
}
|
|
210823
|
+
const notified = [];
|
|
210824
|
+
for (const spec of subs) {
|
|
210825
|
+
if (!notified.includes(spec.set)) {
|
|
210826
|
+
notified.push(spec.set);
|
|
210827
|
+
spec.set(
|
|
210828
|
+
this._internal_unstable.getSelection({
|
|
210829
|
+
parent: spec.parentID || rootID3,
|
|
210830
|
+
selection: spec.selection,
|
|
210831
|
+
variables: spec.variables?.() || {},
|
|
210832
|
+
ignoreMasking: false
|
|
210833
|
+
}).data
|
|
210834
|
+
);
|
|
210835
|
+
}
|
|
210836
|
+
}
|
|
210837
|
+
}
|
|
210522
210838
|
};
|
|
210523
210839
|
var CacheInternal3 = class {
|
|
210524
210840
|
_disabled = false;
|
|
@@ -210806,8 +211122,16 @@ var CacheInternal3 = class {
|
|
|
210806
211122
|
operation.position || "last",
|
|
210807
211123
|
layer
|
|
210808
211124
|
);
|
|
211125
|
+
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
211126
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
|
|
211127
|
+
selection: fieldSelection,
|
|
211128
|
+
data: target,
|
|
211129
|
+
variables,
|
|
211130
|
+
where: operation.position || "last",
|
|
211131
|
+
layer
|
|
211132
|
+
});
|
|
210809
211133
|
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
210810
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables);
|
|
211134
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
|
|
210811
211135
|
} else if (operation.action === "delete" && operation.type) {
|
|
210812
211136
|
if (typeof target !== "string") {
|
|
210813
211137
|
throw new Error("Cannot delete a record with a non-string ID");
|
|
@@ -210816,15 +211140,7 @@ var CacheInternal3 = class {
|
|
|
210816
211140
|
if (!targetID) {
|
|
210817
211141
|
continue;
|
|
210818
211142
|
}
|
|
210819
|
-
this.cache.delete(targetID);
|
|
210820
|
-
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
210821
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
|
|
210822
|
-
selection: fieldSelection,
|
|
210823
|
-
data: target,
|
|
210824
|
-
variables,
|
|
210825
|
-
where: operation.position || "last",
|
|
210826
|
-
layer
|
|
210827
|
-
});
|
|
211143
|
+
this.cache.delete(targetID, layer);
|
|
210828
211144
|
}
|
|
210829
211145
|
}
|
|
210830
211146
|
}
|
|
@@ -211347,7 +211663,7 @@ var fragment3 = documentPlugin3(ArtifactKind3.Fragment, function() {
|
|
|
211347
211663
|
var mutation3 = documentPlugin3(ArtifactKind3.Mutation, () => {
|
|
211348
211664
|
return {
|
|
211349
211665
|
async start(ctx, { next, marshalVariables }) {
|
|
211350
|
-
const
|
|
211666
|
+
const layerOptimistic = cache_default3._internal_unstable.storage.createLayer(true);
|
|
211351
211667
|
const optimisticResponse = ctx.stuff.optimisticResponse;
|
|
211352
211668
|
let toNotify = [];
|
|
211353
211669
|
if (optimisticResponse) {
|
|
@@ -211358,25 +211674,29 @@ var mutation3 = documentPlugin3(ArtifactKind3.Mutation, () => {
|
|
|
211358
211674
|
data: optimisticResponse
|
|
211359
211675
|
}),
|
|
211360
211676
|
variables: marshalVariables(ctx),
|
|
211361
|
-
layer:
|
|
211677
|
+
layer: layerOptimistic.id
|
|
211362
211678
|
});
|
|
211363
211679
|
}
|
|
211364
211680
|
ctx.cacheParams = {
|
|
211365
211681
|
...ctx.cacheParams,
|
|
211366
|
-
layer,
|
|
211682
|
+
layer: layerOptimistic,
|
|
211367
211683
|
notifySubscribers: toNotify,
|
|
211368
211684
|
forceNotify: true
|
|
211369
211685
|
};
|
|
211370
211686
|
next(ctx);
|
|
211371
211687
|
},
|
|
211372
211688
|
afterNetwork(ctx, { resolve: resolve22 }) {
|
|
211373
|
-
ctx.cacheParams?.layer
|
|
211689
|
+
if (ctx.cacheParams?.layer) {
|
|
211690
|
+
cache_default3.clearLayer(ctx.cacheParams.layer.id);
|
|
211691
|
+
}
|
|
211374
211692
|
resolve22(ctx);
|
|
211375
211693
|
},
|
|
211376
211694
|
end(ctx, { resolve: resolve22, value: value2 }) {
|
|
211377
211695
|
const hasErrors = value2.errors && value2.errors.length > 0;
|
|
211378
211696
|
if (hasErrors) {
|
|
211379
|
-
ctx.cacheParams?.layer
|
|
211697
|
+
if (ctx.cacheParams?.layer) {
|
|
211698
|
+
cache_default3.clearLayer(ctx.cacheParams.layer.id);
|
|
211699
|
+
}
|
|
211380
211700
|
}
|
|
211381
211701
|
if (ctx.cacheParams?.layer) {
|
|
211382
211702
|
cache_default3._internal_unstable.storage.resolveLayer(ctx.cacheParams.layer.id);
|
|
@@ -211386,7 +211706,7 @@ var mutation3 = documentPlugin3(ArtifactKind3.Mutation, () => {
|
|
|
211386
211706
|
catch(ctx, { error: error2 }) {
|
|
211387
211707
|
if (ctx.cacheParams?.layer) {
|
|
211388
211708
|
const { layer } = ctx.cacheParams;
|
|
211389
|
-
layer.
|
|
211709
|
+
cache_default3.clearLayer(layer.id);
|
|
211390
211710
|
cache_default3._internal_unstable.storage.resolveLayer(layer.id);
|
|
211391
211711
|
}
|
|
211392
211712
|
throw error2;
|
|
@@ -274467,6 +274787,7 @@ __export4(fs_exports4, {
|
|
|
274467
274787
|
recursiveCopy: () => recursiveCopy4,
|
|
274468
274788
|
remove: () => remove4,
|
|
274469
274789
|
rmdir: () => rmdir4,
|
|
274790
|
+
snapshot: () => snapshot4,
|
|
274470
274791
|
stat: () => stat5,
|
|
274471
274792
|
writeFile: () => writeFile4
|
|
274472
274793
|
});
|
|
@@ -274653,16 +274974,17 @@ function existsSync4(dirPath) {
|
|
|
274653
274974
|
}
|
|
274654
274975
|
return import_memfs4.fs.existsSync(dirPath);
|
|
274655
274976
|
}
|
|
274656
|
-
async function readdir4(filepath) {
|
|
274977
|
+
async function readdir4(filepath, opts) {
|
|
274657
274978
|
if (!houdini_mode4.is_testing) {
|
|
274658
|
-
return await fs5.readdir(filepath);
|
|
274979
|
+
return await fs5.readdir(filepath, opts);
|
|
274659
274980
|
}
|
|
274660
274981
|
if (filepath.includes("build/runtime")) {
|
|
274661
|
-
return await fs5.readdir(filepath);
|
|
274982
|
+
return await fs5.readdir(filepath, opts);
|
|
274662
274983
|
}
|
|
274663
274984
|
try {
|
|
274664
|
-
return import_memfs4.fs.readdirSync(filepath);
|
|
274665
|
-
} catch {
|
|
274985
|
+
return import_memfs4.fs.readdirSync(filepath, opts);
|
|
274986
|
+
} catch (e22) {
|
|
274987
|
+
console.log(e22);
|
|
274666
274988
|
return [];
|
|
274667
274989
|
}
|
|
274668
274990
|
}
|
|
@@ -274713,6 +275035,11 @@ async function recursiveCopy4(source, target, transforms, notRoot) {
|
|
|
274713
275035
|
);
|
|
274714
275036
|
}
|
|
274715
275037
|
}
|
|
275038
|
+
function snapshot4(base) {
|
|
275039
|
+
return Object.fromEntries(
|
|
275040
|
+
Object.entries(import_memfs4.vol.toJSON()).filter(([key]) => !base || key.startsWith(base)).map(([key, value2]) => [!base ? key : key.substring(base.length), value2])
|
|
275041
|
+
);
|
|
275042
|
+
}
|
|
274716
275043
|
async function glob4(pattern) {
|
|
274717
275044
|
return await promisify5(import_glob4.glob)(posixify4(pattern));
|
|
274718
275045
|
}
|
|
@@ -275466,10 +275793,10 @@ var ListManager4 = class {
|
|
|
275466
275793
|
this.lists.get(list.name).get(parentID).lists.push(handler);
|
|
275467
275794
|
this.listsByField.get(parentID).get(list.key).push(handler);
|
|
275468
275795
|
}
|
|
275469
|
-
removeIDFromAllLists(id2) {
|
|
275796
|
+
removeIDFromAllLists(id2, layer) {
|
|
275470
275797
|
for (const fieldMap of this.lists.values()) {
|
|
275471
275798
|
for (const list of fieldMap.values()) {
|
|
275472
|
-
list.removeID(id2);
|
|
275799
|
+
list.removeID(id2, void 0, layer);
|
|
275473
275800
|
}
|
|
275474
275801
|
}
|
|
275475
275802
|
}
|
|
@@ -275566,6 +275893,10 @@ var List4 = class {
|
|
|
275566
275893
|
updates: ["append", "prepend"],
|
|
275567
275894
|
selection: {
|
|
275568
275895
|
fields: {
|
|
275896
|
+
__typename: {
|
|
275897
|
+
keyRaw: "__typename",
|
|
275898
|
+
type: "String"
|
|
275899
|
+
},
|
|
275569
275900
|
node: {
|
|
275570
275901
|
type: listType,
|
|
275571
275902
|
keyRaw: "node",
|
|
@@ -275590,7 +275921,15 @@ var List4 = class {
|
|
|
275590
275921
|
};
|
|
275591
275922
|
insertData = {
|
|
275592
275923
|
newEntry: {
|
|
275593
|
-
edges: [
|
|
275924
|
+
edges: [
|
|
275925
|
+
{
|
|
275926
|
+
__typename: listType + "Edge",
|
|
275927
|
+
node: {
|
|
275928
|
+
...data2,
|
|
275929
|
+
__typename: listType
|
|
275930
|
+
}
|
|
275931
|
+
}
|
|
275932
|
+
]
|
|
275594
275933
|
}
|
|
275595
275934
|
};
|
|
275596
275935
|
} else {
|
|
@@ -275626,7 +275965,7 @@ var List4 = class {
|
|
|
275626
275965
|
layer: layer?.id
|
|
275627
275966
|
});
|
|
275628
275967
|
}
|
|
275629
|
-
removeID(id2, variables = {}) {
|
|
275968
|
+
removeID(id2, variables = {}, layer) {
|
|
275630
275969
|
if (!this.validateWhen()) {
|
|
275631
275970
|
return;
|
|
275632
275971
|
}
|
|
@@ -275673,7 +276012,7 @@ var List4 = class {
|
|
|
275673
276012
|
subscribers.map((sub) => sub[0]),
|
|
275674
276013
|
variables
|
|
275675
276014
|
);
|
|
275676
|
-
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID);
|
|
276015
|
+
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID, layer);
|
|
275677
276016
|
for (const [spec] of subscribers) {
|
|
275678
276017
|
spec.set(
|
|
275679
276018
|
this.cache._internal_unstable.getSelection({
|
|
@@ -275686,12 +276025,12 @@ var List4 = class {
|
|
|
275686
276025
|
}
|
|
275687
276026
|
return true;
|
|
275688
276027
|
}
|
|
275689
|
-
remove(data2, variables = {}) {
|
|
276028
|
+
remove(data2, variables = {}, layer) {
|
|
275690
276029
|
const targetID = this.cache._internal_unstable.id(this.listType(data2), data2);
|
|
275691
276030
|
if (!targetID) {
|
|
275692
276031
|
return;
|
|
275693
276032
|
}
|
|
275694
|
-
return this.removeID(targetID, variables);
|
|
276033
|
+
return this.removeID(targetID, variables, layer);
|
|
275695
276034
|
}
|
|
275696
276035
|
listType(data2) {
|
|
275697
276036
|
return data2.__typename || this.type;
|
|
@@ -275723,7 +276062,7 @@ var List4 = class {
|
|
|
275723
276062
|
layer,
|
|
275724
276063
|
where
|
|
275725
276064
|
}) {
|
|
275726
|
-
if (!this.remove(data2, variables)) {
|
|
276065
|
+
if (!this.remove(data2, variables, layer)) {
|
|
275727
276066
|
this.addToList(selection, data2, variables, where, layer);
|
|
275728
276067
|
}
|
|
275729
276068
|
}
|
|
@@ -275856,7 +276195,7 @@ var StaleManager4 = class {
|
|
|
275856
276195
|
};
|
|
275857
276196
|
var InMemoryStorage4 = class {
|
|
275858
276197
|
data;
|
|
275859
|
-
idCount =
|
|
276198
|
+
idCount = 1;
|
|
275860
276199
|
rank = 0;
|
|
275861
276200
|
constructor() {
|
|
275862
276201
|
this.data = [];
|
|
@@ -275876,11 +276215,11 @@ var InMemoryStorage4 = class {
|
|
|
275876
276215
|
insert(id2, field, location, target) {
|
|
275877
276216
|
return this.topLayer.insert(id2, field, location, target);
|
|
275878
276217
|
}
|
|
275879
|
-
remove(id2, field, target) {
|
|
275880
|
-
return
|
|
276218
|
+
remove(id2, field, target, layerToUser = this.topLayer) {
|
|
276219
|
+
return layerToUser.remove(id2, field, target);
|
|
275881
276220
|
}
|
|
275882
|
-
delete(id2) {
|
|
275883
|
-
return
|
|
276221
|
+
delete(id2, layerToUser = this.topLayer) {
|
|
276222
|
+
return layerToUser.delete(id2);
|
|
275884
276223
|
}
|
|
275885
276224
|
deleteField(id2, field) {
|
|
275886
276225
|
return this.topLayer.deleteField(id2, field);
|
|
@@ -276014,6 +276353,23 @@ var InMemoryStorage4 = class {
|
|
|
276014
276353
|
}
|
|
276015
276354
|
return this.data[this.data.length - 1];
|
|
276016
276355
|
}
|
|
276356
|
+
serialize() {
|
|
276357
|
+
return JSON.stringify({
|
|
276358
|
+
rank: this.rank,
|
|
276359
|
+
fields: this.topLayer.fields,
|
|
276360
|
+
links: this.topLayer.links
|
|
276361
|
+
});
|
|
276362
|
+
}
|
|
276363
|
+
hydrate(args, layer) {
|
|
276364
|
+
if (!args) {
|
|
276365
|
+
return;
|
|
276366
|
+
}
|
|
276367
|
+
const { rank, fields, links } = args;
|
|
276368
|
+
this.rank = rank;
|
|
276369
|
+
layer ??= this.createLayer(true);
|
|
276370
|
+
layer.fields = fields;
|
|
276371
|
+
layer.links = links;
|
|
276372
|
+
}
|
|
276017
276373
|
};
|
|
276018
276374
|
var Layer4 = class {
|
|
276019
276375
|
id;
|
|
@@ -276248,6 +276604,9 @@ var InMemorySubscriptions4 = class {
|
|
|
276248
276604
|
subscribers = {};
|
|
276249
276605
|
referenceCounts = {};
|
|
276250
276606
|
keyVersions = {};
|
|
276607
|
+
activeFields(parent2) {
|
|
276608
|
+
return Object.keys(this.subscribers[parent2] || {});
|
|
276609
|
+
}
|
|
276251
276610
|
add({
|
|
276252
276611
|
parent: parent2,
|
|
276253
276612
|
spec,
|
|
@@ -276514,20 +276873,7 @@ var Cache4 = class {
|
|
|
276514
276873
|
}) {
|
|
276515
276874
|
const layer = layerID ? this._internal_unstable.storage.getLayer(layerID) : this._internal_unstable.storage.topLayer;
|
|
276516
276875
|
const subscribers = this._internal_unstable.writeSelection({ ...args, layer }).map((sub) => sub[0]);
|
|
276517
|
-
|
|
276518
|
-
for (const spec of subscribers.concat(notifySubscribers)) {
|
|
276519
|
-
if (!notified.includes(spec.set)) {
|
|
276520
|
-
notified.push(spec.set);
|
|
276521
|
-
spec.set(
|
|
276522
|
-
this._internal_unstable.getSelection({
|
|
276523
|
-
parent: spec.parentID || rootID4,
|
|
276524
|
-
selection: spec.selection,
|
|
276525
|
-
variables: spec.variables?.() || {},
|
|
276526
|
-
ignoreMasking: false
|
|
276527
|
-
}).data
|
|
276528
|
-
);
|
|
276529
|
-
}
|
|
276530
|
-
}
|
|
276876
|
+
this.#notifySubscribers(subscribers.concat(notifySubscribers));
|
|
276531
276877
|
return subscribers;
|
|
276532
276878
|
}
|
|
276533
276879
|
read(...args) {
|
|
@@ -276566,10 +276912,10 @@ var Cache4 = class {
|
|
|
276566
276912
|
}
|
|
276567
276913
|
return handler;
|
|
276568
276914
|
}
|
|
276569
|
-
delete(id2) {
|
|
276915
|
+
delete(id2, layer) {
|
|
276570
276916
|
this._internal_unstable.subscriptions.removeAllSubscribers(id2);
|
|
276571
|
-
this._internal_unstable.lists.removeIDFromAllLists(id2);
|
|
276572
|
-
this._internal_unstable.storage.delete(id2);
|
|
276917
|
+
this._internal_unstable.lists.removeIDFromAllLists(id2, layer);
|
|
276918
|
+
this._internal_unstable.storage.delete(id2, layer);
|
|
276573
276919
|
}
|
|
276574
276920
|
setConfig(config42) {
|
|
276575
276921
|
this._internal_unstable.setConfig(config42);
|
|
@@ -276601,6 +276947,76 @@ var Cache4 = class {
|
|
|
276601
276947
|
config() {
|
|
276602
276948
|
return this._internal_unstable.config;
|
|
276603
276949
|
}
|
|
276950
|
+
serialize() {
|
|
276951
|
+
return this._internal_unstable.storage.serialize();
|
|
276952
|
+
}
|
|
276953
|
+
hydrate(...args) {
|
|
276954
|
+
return this._internal_unstable.storage.hydrate(...args);
|
|
276955
|
+
}
|
|
276956
|
+
clearLayer(layerID) {
|
|
276957
|
+
const layer = this._internal_unstable.storage.getLayer(layerID);
|
|
276958
|
+
if (!layer) {
|
|
276959
|
+
throw new Error("Cannot find layer with id: " + layerID);
|
|
276960
|
+
}
|
|
276961
|
+
const toNotify = [];
|
|
276962
|
+
const allFields = [];
|
|
276963
|
+
for (const target of [layer.fields, layer.links]) {
|
|
276964
|
+
for (const [id2, fields] of Object.entries(target)) {
|
|
276965
|
+
allFields.push(
|
|
276966
|
+
...Object.entries(fields).map(([field, value2]) => ({ id: id2, field, value: value2 }))
|
|
276967
|
+
);
|
|
276968
|
+
}
|
|
276969
|
+
}
|
|
276970
|
+
const displayFields = [];
|
|
276971
|
+
for (const pair of allFields) {
|
|
276972
|
+
const { displayLayers } = this._internal_unstable.storage.get(pair.id, pair.field);
|
|
276973
|
+
if (!displayLayers.includes(layerID)) {
|
|
276974
|
+
continue;
|
|
276975
|
+
}
|
|
276976
|
+
displayFields.push(pair);
|
|
276977
|
+
}
|
|
276978
|
+
for (const [id2, operation] of Object.entries(layer.operations)) {
|
|
276979
|
+
if (operation.deleted) {
|
|
276980
|
+
displayFields.push(
|
|
276981
|
+
...this._internal_unstable.subscriptions.activeFields(id2).map((field) => ({ id: id2, field }))
|
|
276982
|
+
);
|
|
276983
|
+
}
|
|
276984
|
+
const fields = Object.keys(operation.fields ?? {});
|
|
276985
|
+
if (fields.length > 0) {
|
|
276986
|
+
displayFields.push(...fields.map((field) => ({ id: id2, field })));
|
|
276987
|
+
}
|
|
276988
|
+
}
|
|
276989
|
+
layer.clear();
|
|
276990
|
+
for (const display of displayFields) {
|
|
276991
|
+
const { field, id: id2 } = display;
|
|
276992
|
+
const notify = !("value" in display) || this._internal_unstable.storage.get(id2, field).value !== display.value;
|
|
276993
|
+
if (notify) {
|
|
276994
|
+
toNotify.push(
|
|
276995
|
+
...this._internal_unstable.subscriptions.get(id2, field).map((sub) => sub[0])
|
|
276996
|
+
);
|
|
276997
|
+
}
|
|
276998
|
+
}
|
|
276999
|
+
this.#notifySubscribers(toNotify);
|
|
277000
|
+
}
|
|
277001
|
+
#notifySubscribers(subs) {
|
|
277002
|
+
if (subs.length === 0) {
|
|
277003
|
+
return;
|
|
277004
|
+
}
|
|
277005
|
+
const notified = [];
|
|
277006
|
+
for (const spec of subs) {
|
|
277007
|
+
if (!notified.includes(spec.set)) {
|
|
277008
|
+
notified.push(spec.set);
|
|
277009
|
+
spec.set(
|
|
277010
|
+
this._internal_unstable.getSelection({
|
|
277011
|
+
parent: spec.parentID || rootID4,
|
|
277012
|
+
selection: spec.selection,
|
|
277013
|
+
variables: spec.variables?.() || {},
|
|
277014
|
+
ignoreMasking: false
|
|
277015
|
+
}).data
|
|
277016
|
+
);
|
|
277017
|
+
}
|
|
277018
|
+
}
|
|
277019
|
+
}
|
|
276604
277020
|
};
|
|
276605
277021
|
var CacheInternal4 = class {
|
|
276606
277022
|
_disabled = false;
|
|
@@ -276888,8 +277304,16 @@ var CacheInternal4 = class {
|
|
|
276888
277304
|
operation.position || "last",
|
|
276889
277305
|
layer
|
|
276890
277306
|
);
|
|
277307
|
+
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
277308
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
|
|
277309
|
+
selection: fieldSelection,
|
|
277310
|
+
data: target,
|
|
277311
|
+
variables,
|
|
277312
|
+
where: operation.position || "last",
|
|
277313
|
+
layer
|
|
277314
|
+
});
|
|
276891
277315
|
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
276892
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables);
|
|
277316
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
|
|
276893
277317
|
} else if (operation.action === "delete" && operation.type) {
|
|
276894
277318
|
if (typeof target !== "string") {
|
|
276895
277319
|
throw new Error("Cannot delete a record with a non-string ID");
|
|
@@ -276898,15 +277322,7 @@ var CacheInternal4 = class {
|
|
|
276898
277322
|
if (!targetID) {
|
|
276899
277323
|
continue;
|
|
276900
277324
|
}
|
|
276901
|
-
this.cache.delete(targetID);
|
|
276902
|
-
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
276903
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
|
|
276904
|
-
selection: fieldSelection,
|
|
276905
|
-
data: target,
|
|
276906
|
-
variables,
|
|
276907
|
-
where: operation.position || "last",
|
|
276908
|
-
layer
|
|
276909
|
-
});
|
|
277325
|
+
this.cache.delete(targetID, layer);
|
|
276910
277326
|
}
|
|
276911
277327
|
}
|
|
276912
277328
|
}
|
|
@@ -277429,7 +277845,7 @@ var fragment4 = documentPlugin4(ArtifactKind4.Fragment, function() {
|
|
|
277429
277845
|
var mutation4 = documentPlugin4(ArtifactKind4.Mutation, () => {
|
|
277430
277846
|
return {
|
|
277431
277847
|
async start(ctx, { next, marshalVariables }) {
|
|
277432
|
-
const
|
|
277848
|
+
const layerOptimistic = cache_default4._internal_unstable.storage.createLayer(true);
|
|
277433
277849
|
const optimisticResponse = ctx.stuff.optimisticResponse;
|
|
277434
277850
|
let toNotify = [];
|
|
277435
277851
|
if (optimisticResponse) {
|
|
@@ -277440,25 +277856,29 @@ var mutation4 = documentPlugin4(ArtifactKind4.Mutation, () => {
|
|
|
277440
277856
|
data: optimisticResponse
|
|
277441
277857
|
}),
|
|
277442
277858
|
variables: marshalVariables(ctx),
|
|
277443
|
-
layer:
|
|
277859
|
+
layer: layerOptimistic.id
|
|
277444
277860
|
});
|
|
277445
277861
|
}
|
|
277446
277862
|
ctx.cacheParams = {
|
|
277447
277863
|
...ctx.cacheParams,
|
|
277448
|
-
layer,
|
|
277864
|
+
layer: layerOptimistic,
|
|
277449
277865
|
notifySubscribers: toNotify,
|
|
277450
277866
|
forceNotify: true
|
|
277451
277867
|
};
|
|
277452
277868
|
next(ctx);
|
|
277453
277869
|
},
|
|
277454
277870
|
afterNetwork(ctx, { resolve: resolve22 }) {
|
|
277455
|
-
ctx.cacheParams?.layer
|
|
277871
|
+
if (ctx.cacheParams?.layer) {
|
|
277872
|
+
cache_default4.clearLayer(ctx.cacheParams.layer.id);
|
|
277873
|
+
}
|
|
277456
277874
|
resolve22(ctx);
|
|
277457
277875
|
},
|
|
277458
277876
|
end(ctx, { resolve: resolve22, value: value2 }) {
|
|
277459
277877
|
const hasErrors = value2.errors && value2.errors.length > 0;
|
|
277460
277878
|
if (hasErrors) {
|
|
277461
|
-
ctx.cacheParams?.layer
|
|
277879
|
+
if (ctx.cacheParams?.layer) {
|
|
277880
|
+
cache_default4.clearLayer(ctx.cacheParams.layer.id);
|
|
277881
|
+
}
|
|
277462
277882
|
}
|
|
277463
277883
|
if (ctx.cacheParams?.layer) {
|
|
277464
277884
|
cache_default4._internal_unstable.storage.resolveLayer(ctx.cacheParams.layer.id);
|
|
@@ -277468,7 +277888,7 @@ var mutation4 = documentPlugin4(ArtifactKind4.Mutation, () => {
|
|
|
277468
277888
|
catch(ctx, { error: error2 }) {
|
|
277469
277889
|
if (ctx.cacheParams?.layer) {
|
|
277470
277890
|
const { layer } = ctx.cacheParams;
|
|
277471
|
-
layer.
|
|
277891
|
+
cache_default4.clearLayer(layer.id);
|
|
277472
277892
|
cache_default4._internal_unstable.storage.resolveLayer(layer.id);
|
|
277473
277893
|
}
|
|
277474
277894
|
throw error2;
|