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
|
@@ -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(config4) {
|
|
91671
91697
|
this._internal_unstable.setConfig(config4);
|
|
@@ -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, config4) {
|
|
92663
92763
|
const defaultConfig = {
|
|
92664
92764
|
plugins: ["typescript", "importAssertions"],
|
|
92665
92765
|
sourceType: "module"
|
|
@@ -154920,6 +155020,7 @@ __export2(fs_exports2, {
|
|
|
154920
155020
|
recursiveCopy: () => recursiveCopy2,
|
|
154921
155021
|
remove: () => remove2,
|
|
154922
155022
|
rmdir: () => rmdir2,
|
|
155023
|
+
snapshot: () => snapshot2,
|
|
154923
155024
|
stat: () => stat3,
|
|
154924
155025
|
writeFile: () => writeFile2
|
|
154925
155026
|
});
|
|
@@ -155106,16 +155207,17 @@ function existsSync2(dirPath) {
|
|
|
155106
155207
|
}
|
|
155107
155208
|
return import_memfs2.fs.existsSync(dirPath);
|
|
155108
155209
|
}
|
|
155109
|
-
async function readdir2(filepath) {
|
|
155210
|
+
async function readdir2(filepath, opts) {
|
|
155110
155211
|
if (!houdini_mode2.is_testing) {
|
|
155111
|
-
return await fs3.readdir(filepath);
|
|
155212
|
+
return await fs3.readdir(filepath, opts);
|
|
155112
155213
|
}
|
|
155113
155214
|
if (filepath.includes("build/runtime")) {
|
|
155114
|
-
return await fs3.readdir(filepath);
|
|
155215
|
+
return await fs3.readdir(filepath, opts);
|
|
155115
155216
|
}
|
|
155116
155217
|
try {
|
|
155117
|
-
return import_memfs2.fs.readdirSync(filepath);
|
|
155118
|
-
} catch {
|
|
155218
|
+
return import_memfs2.fs.readdirSync(filepath, opts);
|
|
155219
|
+
} catch (e22) {
|
|
155220
|
+
console.log(e22);
|
|
155119
155221
|
return [];
|
|
155120
155222
|
}
|
|
155121
155223
|
}
|
|
@@ -155166,6 +155268,11 @@ async function recursiveCopy2(source, target, transforms, notRoot) {
|
|
|
155166
155268
|
);
|
|
155167
155269
|
}
|
|
155168
155270
|
}
|
|
155271
|
+
function snapshot2(base) {
|
|
155272
|
+
return Object.fromEntries(
|
|
155273
|
+
Object.entries(import_memfs2.vol.toJSON()).filter(([key]) => !base || key.startsWith(base)).map(([key, value2]) => [!base ? key : key.substring(base.length), value2])
|
|
155274
|
+
);
|
|
155275
|
+
}
|
|
155169
155276
|
async function glob2(pattern) {
|
|
155170
155277
|
return await promisify3(import_glob2.glob)(posixify2(pattern));
|
|
155171
155278
|
}
|
|
@@ -155919,10 +156026,10 @@ var ListManager2 = class {
|
|
|
155919
156026
|
this.lists.get(list.name).get(parentID).lists.push(handler);
|
|
155920
156027
|
this.listsByField.get(parentID).get(list.key).push(handler);
|
|
155921
156028
|
}
|
|
155922
|
-
removeIDFromAllLists(id2) {
|
|
156029
|
+
removeIDFromAllLists(id2, layer) {
|
|
155923
156030
|
for (const fieldMap of this.lists.values()) {
|
|
155924
156031
|
for (const list of fieldMap.values()) {
|
|
155925
|
-
list.removeID(id2);
|
|
156032
|
+
list.removeID(id2, void 0, layer);
|
|
155926
156033
|
}
|
|
155927
156034
|
}
|
|
155928
156035
|
}
|
|
@@ -156019,6 +156126,10 @@ var List2 = class {
|
|
|
156019
156126
|
updates: ["append", "prepend"],
|
|
156020
156127
|
selection: {
|
|
156021
156128
|
fields: {
|
|
156129
|
+
__typename: {
|
|
156130
|
+
keyRaw: "__typename",
|
|
156131
|
+
type: "String"
|
|
156132
|
+
},
|
|
156022
156133
|
node: {
|
|
156023
156134
|
type: listType,
|
|
156024
156135
|
keyRaw: "node",
|
|
@@ -156043,7 +156154,15 @@ var List2 = class {
|
|
|
156043
156154
|
};
|
|
156044
156155
|
insertData = {
|
|
156045
156156
|
newEntry: {
|
|
156046
|
-
edges: [
|
|
156157
|
+
edges: [
|
|
156158
|
+
{
|
|
156159
|
+
__typename: listType + "Edge",
|
|
156160
|
+
node: {
|
|
156161
|
+
...data2,
|
|
156162
|
+
__typename: listType
|
|
156163
|
+
}
|
|
156164
|
+
}
|
|
156165
|
+
]
|
|
156047
156166
|
}
|
|
156048
156167
|
};
|
|
156049
156168
|
} else {
|
|
@@ -156079,7 +156198,7 @@ var List2 = class {
|
|
|
156079
156198
|
layer: layer?.id
|
|
156080
156199
|
});
|
|
156081
156200
|
}
|
|
156082
|
-
removeID(id2, variables = {}) {
|
|
156201
|
+
removeID(id2, variables = {}, layer) {
|
|
156083
156202
|
if (!this.validateWhen()) {
|
|
156084
156203
|
return;
|
|
156085
156204
|
}
|
|
@@ -156126,7 +156245,7 @@ var List2 = class {
|
|
|
156126
156245
|
subscribers.map((sub) => sub[0]),
|
|
156127
156246
|
variables
|
|
156128
156247
|
);
|
|
156129
|
-
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID);
|
|
156248
|
+
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID, layer);
|
|
156130
156249
|
for (const [spec] of subscribers) {
|
|
156131
156250
|
spec.set(
|
|
156132
156251
|
this.cache._internal_unstable.getSelection({
|
|
@@ -156139,12 +156258,12 @@ var List2 = class {
|
|
|
156139
156258
|
}
|
|
156140
156259
|
return true;
|
|
156141
156260
|
}
|
|
156142
|
-
remove(data2, variables = {}) {
|
|
156261
|
+
remove(data2, variables = {}, layer) {
|
|
156143
156262
|
const targetID = this.cache._internal_unstable.id(this.listType(data2), data2);
|
|
156144
156263
|
if (!targetID) {
|
|
156145
156264
|
return;
|
|
156146
156265
|
}
|
|
156147
|
-
return this.removeID(targetID, variables);
|
|
156266
|
+
return this.removeID(targetID, variables, layer);
|
|
156148
156267
|
}
|
|
156149
156268
|
listType(data2) {
|
|
156150
156269
|
return data2.__typename || this.type;
|
|
@@ -156176,7 +156295,7 @@ var List2 = class {
|
|
|
156176
156295
|
layer,
|
|
156177
156296
|
where
|
|
156178
156297
|
}) {
|
|
156179
|
-
if (!this.remove(data2, variables)) {
|
|
156298
|
+
if (!this.remove(data2, variables, layer)) {
|
|
156180
156299
|
this.addToList(selection, data2, variables, where, layer);
|
|
156181
156300
|
}
|
|
156182
156301
|
}
|
|
@@ -156309,7 +156428,7 @@ var StaleManager2 = class {
|
|
|
156309
156428
|
};
|
|
156310
156429
|
var InMemoryStorage2 = class {
|
|
156311
156430
|
data;
|
|
156312
|
-
idCount =
|
|
156431
|
+
idCount = 1;
|
|
156313
156432
|
rank = 0;
|
|
156314
156433
|
constructor() {
|
|
156315
156434
|
this.data = [];
|
|
@@ -156329,11 +156448,11 @@ var InMemoryStorage2 = class {
|
|
|
156329
156448
|
insert(id2, field, location, target) {
|
|
156330
156449
|
return this.topLayer.insert(id2, field, location, target);
|
|
156331
156450
|
}
|
|
156332
|
-
remove(id2, field, target) {
|
|
156333
|
-
return
|
|
156451
|
+
remove(id2, field, target, layerToUser = this.topLayer) {
|
|
156452
|
+
return layerToUser.remove(id2, field, target);
|
|
156334
156453
|
}
|
|
156335
|
-
delete(id2) {
|
|
156336
|
-
return
|
|
156454
|
+
delete(id2, layerToUser = this.topLayer) {
|
|
156455
|
+
return layerToUser.delete(id2);
|
|
156337
156456
|
}
|
|
156338
156457
|
deleteField(id2, field) {
|
|
156339
156458
|
return this.topLayer.deleteField(id2, field);
|
|
@@ -156467,6 +156586,23 @@ var InMemoryStorage2 = class {
|
|
|
156467
156586
|
}
|
|
156468
156587
|
return this.data[this.data.length - 1];
|
|
156469
156588
|
}
|
|
156589
|
+
serialize() {
|
|
156590
|
+
return JSON.stringify({
|
|
156591
|
+
rank: this.rank,
|
|
156592
|
+
fields: this.topLayer.fields,
|
|
156593
|
+
links: this.topLayer.links
|
|
156594
|
+
});
|
|
156595
|
+
}
|
|
156596
|
+
hydrate(args, layer) {
|
|
156597
|
+
if (!args) {
|
|
156598
|
+
return;
|
|
156599
|
+
}
|
|
156600
|
+
const { rank, fields, links } = args;
|
|
156601
|
+
this.rank = rank;
|
|
156602
|
+
layer ??= this.createLayer(true);
|
|
156603
|
+
layer.fields = fields;
|
|
156604
|
+
layer.links = links;
|
|
156605
|
+
}
|
|
156470
156606
|
};
|
|
156471
156607
|
var Layer2 = class {
|
|
156472
156608
|
id;
|
|
@@ -156701,6 +156837,9 @@ var InMemorySubscriptions2 = class {
|
|
|
156701
156837
|
subscribers = {};
|
|
156702
156838
|
referenceCounts = {};
|
|
156703
156839
|
keyVersions = {};
|
|
156840
|
+
activeFields(parent2) {
|
|
156841
|
+
return Object.keys(this.subscribers[parent2] || {});
|
|
156842
|
+
}
|
|
156704
156843
|
add({
|
|
156705
156844
|
parent: parent2,
|
|
156706
156845
|
spec,
|
|
@@ -156967,20 +157106,7 @@ var Cache2 = class {
|
|
|
156967
157106
|
}) {
|
|
156968
157107
|
const layer = layerID ? this._internal_unstable.storage.getLayer(layerID) : this._internal_unstable.storage.topLayer;
|
|
156969
157108
|
const subscribers = this._internal_unstable.writeSelection({ ...args, layer }).map((sub) => sub[0]);
|
|
156970
|
-
|
|
156971
|
-
for (const spec of subscribers.concat(notifySubscribers)) {
|
|
156972
|
-
if (!notified.includes(spec.set)) {
|
|
156973
|
-
notified.push(spec.set);
|
|
156974
|
-
spec.set(
|
|
156975
|
-
this._internal_unstable.getSelection({
|
|
156976
|
-
parent: spec.parentID || rootID2,
|
|
156977
|
-
selection: spec.selection,
|
|
156978
|
-
variables: spec.variables?.() || {},
|
|
156979
|
-
ignoreMasking: false
|
|
156980
|
-
}).data
|
|
156981
|
-
);
|
|
156982
|
-
}
|
|
156983
|
-
}
|
|
157109
|
+
this.#notifySubscribers(subscribers.concat(notifySubscribers));
|
|
156984
157110
|
return subscribers;
|
|
156985
157111
|
}
|
|
156986
157112
|
read(...args) {
|
|
@@ -157019,10 +157145,10 @@ var Cache2 = class {
|
|
|
157019
157145
|
}
|
|
157020
157146
|
return handler;
|
|
157021
157147
|
}
|
|
157022
|
-
delete(id2) {
|
|
157148
|
+
delete(id2, layer) {
|
|
157023
157149
|
this._internal_unstable.subscriptions.removeAllSubscribers(id2);
|
|
157024
|
-
this._internal_unstable.lists.removeIDFromAllLists(id2);
|
|
157025
|
-
this._internal_unstable.storage.delete(id2);
|
|
157150
|
+
this._internal_unstable.lists.removeIDFromAllLists(id2, layer);
|
|
157151
|
+
this._internal_unstable.storage.delete(id2, layer);
|
|
157026
157152
|
}
|
|
157027
157153
|
setConfig(config4) {
|
|
157028
157154
|
this._internal_unstable.setConfig(config4);
|
|
@@ -157054,6 +157180,76 @@ var Cache2 = class {
|
|
|
157054
157180
|
config() {
|
|
157055
157181
|
return this._internal_unstable.config;
|
|
157056
157182
|
}
|
|
157183
|
+
serialize() {
|
|
157184
|
+
return this._internal_unstable.storage.serialize();
|
|
157185
|
+
}
|
|
157186
|
+
hydrate(...args) {
|
|
157187
|
+
return this._internal_unstable.storage.hydrate(...args);
|
|
157188
|
+
}
|
|
157189
|
+
clearLayer(layerID) {
|
|
157190
|
+
const layer = this._internal_unstable.storage.getLayer(layerID);
|
|
157191
|
+
if (!layer) {
|
|
157192
|
+
throw new Error("Cannot find layer with id: " + layerID);
|
|
157193
|
+
}
|
|
157194
|
+
const toNotify = [];
|
|
157195
|
+
const allFields = [];
|
|
157196
|
+
for (const target of [layer.fields, layer.links]) {
|
|
157197
|
+
for (const [id2, fields] of Object.entries(target)) {
|
|
157198
|
+
allFields.push(
|
|
157199
|
+
...Object.entries(fields).map(([field, value2]) => ({ id: id2, field, value: value2 }))
|
|
157200
|
+
);
|
|
157201
|
+
}
|
|
157202
|
+
}
|
|
157203
|
+
const displayFields = [];
|
|
157204
|
+
for (const pair of allFields) {
|
|
157205
|
+
const { displayLayers } = this._internal_unstable.storage.get(pair.id, pair.field);
|
|
157206
|
+
if (!displayLayers.includes(layerID)) {
|
|
157207
|
+
continue;
|
|
157208
|
+
}
|
|
157209
|
+
displayFields.push(pair);
|
|
157210
|
+
}
|
|
157211
|
+
for (const [id2, operation] of Object.entries(layer.operations)) {
|
|
157212
|
+
if (operation.deleted) {
|
|
157213
|
+
displayFields.push(
|
|
157214
|
+
...this._internal_unstable.subscriptions.activeFields(id2).map((field) => ({ id: id2, field }))
|
|
157215
|
+
);
|
|
157216
|
+
}
|
|
157217
|
+
const fields = Object.keys(operation.fields ?? {});
|
|
157218
|
+
if (fields.length > 0) {
|
|
157219
|
+
displayFields.push(...fields.map((field) => ({ id: id2, field })));
|
|
157220
|
+
}
|
|
157221
|
+
}
|
|
157222
|
+
layer.clear();
|
|
157223
|
+
for (const display of displayFields) {
|
|
157224
|
+
const { field, id: id2 } = display;
|
|
157225
|
+
const notify = !("value" in display) || this._internal_unstable.storage.get(id2, field).value !== display.value;
|
|
157226
|
+
if (notify) {
|
|
157227
|
+
toNotify.push(
|
|
157228
|
+
...this._internal_unstable.subscriptions.get(id2, field).map((sub) => sub[0])
|
|
157229
|
+
);
|
|
157230
|
+
}
|
|
157231
|
+
}
|
|
157232
|
+
this.#notifySubscribers(toNotify);
|
|
157233
|
+
}
|
|
157234
|
+
#notifySubscribers(subs) {
|
|
157235
|
+
if (subs.length === 0) {
|
|
157236
|
+
return;
|
|
157237
|
+
}
|
|
157238
|
+
const notified = [];
|
|
157239
|
+
for (const spec of subs) {
|
|
157240
|
+
if (!notified.includes(spec.set)) {
|
|
157241
|
+
notified.push(spec.set);
|
|
157242
|
+
spec.set(
|
|
157243
|
+
this._internal_unstable.getSelection({
|
|
157244
|
+
parent: spec.parentID || rootID2,
|
|
157245
|
+
selection: spec.selection,
|
|
157246
|
+
variables: spec.variables?.() || {},
|
|
157247
|
+
ignoreMasking: false
|
|
157248
|
+
}).data
|
|
157249
|
+
);
|
|
157250
|
+
}
|
|
157251
|
+
}
|
|
157252
|
+
}
|
|
157057
157253
|
};
|
|
157058
157254
|
var CacheInternal2 = class {
|
|
157059
157255
|
_disabled = false;
|
|
@@ -157341,8 +157537,16 @@ var CacheInternal2 = class {
|
|
|
157341
157537
|
operation.position || "last",
|
|
157342
157538
|
layer
|
|
157343
157539
|
);
|
|
157540
|
+
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
157541
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
|
|
157542
|
+
selection: fieldSelection,
|
|
157543
|
+
data: target,
|
|
157544
|
+
variables,
|
|
157545
|
+
where: operation.position || "last",
|
|
157546
|
+
layer
|
|
157547
|
+
});
|
|
157344
157548
|
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
157345
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables);
|
|
157549
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
|
|
157346
157550
|
} else if (operation.action === "delete" && operation.type) {
|
|
157347
157551
|
if (typeof target !== "string") {
|
|
157348
157552
|
throw new Error("Cannot delete a record with a non-string ID");
|
|
@@ -157351,15 +157555,7 @@ var CacheInternal2 = class {
|
|
|
157351
157555
|
if (!targetID) {
|
|
157352
157556
|
continue;
|
|
157353
157557
|
}
|
|
157354
|
-
this.cache.delete(targetID);
|
|
157355
|
-
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
157356
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
|
|
157357
|
-
selection: fieldSelection,
|
|
157358
|
-
data: target,
|
|
157359
|
-
variables,
|
|
157360
|
-
where: operation.position || "last",
|
|
157361
|
-
layer
|
|
157362
|
-
});
|
|
157558
|
+
this.cache.delete(targetID, layer);
|
|
157363
157559
|
}
|
|
157364
157560
|
}
|
|
157365
157561
|
}
|
|
@@ -157882,7 +158078,7 @@ var fragment2 = documentPlugin2(ArtifactKind2.Fragment, function() {
|
|
|
157882
158078
|
var mutation2 = documentPlugin2(ArtifactKind2.Mutation, () => {
|
|
157883
158079
|
return {
|
|
157884
158080
|
async start(ctx, { next, marshalVariables }) {
|
|
157885
|
-
const
|
|
158081
|
+
const layerOptimistic = cache_default2._internal_unstable.storage.createLayer(true);
|
|
157886
158082
|
const optimisticResponse = ctx.stuff.optimisticResponse;
|
|
157887
158083
|
let toNotify = [];
|
|
157888
158084
|
if (optimisticResponse) {
|
|
@@ -157893,25 +158089,29 @@ var mutation2 = documentPlugin2(ArtifactKind2.Mutation, () => {
|
|
|
157893
158089
|
data: optimisticResponse
|
|
157894
158090
|
}),
|
|
157895
158091
|
variables: marshalVariables(ctx),
|
|
157896
|
-
layer:
|
|
158092
|
+
layer: layerOptimistic.id
|
|
157897
158093
|
});
|
|
157898
158094
|
}
|
|
157899
158095
|
ctx.cacheParams = {
|
|
157900
158096
|
...ctx.cacheParams,
|
|
157901
|
-
layer,
|
|
158097
|
+
layer: layerOptimistic,
|
|
157902
158098
|
notifySubscribers: toNotify,
|
|
157903
158099
|
forceNotify: true
|
|
157904
158100
|
};
|
|
157905
158101
|
next(ctx);
|
|
157906
158102
|
},
|
|
157907
158103
|
afterNetwork(ctx, { resolve: resolve22 }) {
|
|
157908
|
-
ctx.cacheParams?.layer
|
|
158104
|
+
if (ctx.cacheParams?.layer) {
|
|
158105
|
+
cache_default2.clearLayer(ctx.cacheParams.layer.id);
|
|
158106
|
+
}
|
|
157909
158107
|
resolve22(ctx);
|
|
157910
158108
|
},
|
|
157911
158109
|
end(ctx, { resolve: resolve22, value: value2 }) {
|
|
157912
158110
|
const hasErrors = value2.errors && value2.errors.length > 0;
|
|
157913
158111
|
if (hasErrors) {
|
|
157914
|
-
ctx.cacheParams?.layer
|
|
158112
|
+
if (ctx.cacheParams?.layer) {
|
|
158113
|
+
cache_default2.clearLayer(ctx.cacheParams.layer.id);
|
|
158114
|
+
}
|
|
157915
158115
|
}
|
|
157916
158116
|
if (ctx.cacheParams?.layer) {
|
|
157917
158117
|
cache_default2._internal_unstable.storage.resolveLayer(ctx.cacheParams.layer.id);
|
|
@@ -157921,7 +158121,7 @@ var mutation2 = documentPlugin2(ArtifactKind2.Mutation, () => {
|
|
|
157921
158121
|
catch(ctx, { error: error2 }) {
|
|
157922
158122
|
if (ctx.cacheParams?.layer) {
|
|
157923
158123
|
const { layer } = ctx.cacheParams;
|
|
157924
|
-
layer.
|
|
158124
|
+
cache_default2.clearLayer(layer.id);
|
|
157925
158125
|
cache_default2._internal_unstable.storage.resolveLayer(layer.id);
|
|
157926
158126
|
}
|
|
157927
158127
|
throw error2;
|