houdini 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/cmd-cjs/index.js +183 -63
- package/build/cmd-esm/index.js +183 -63
- package/build/codegen-cjs/index.js +181 -61
- package/build/codegen-esm/index.js +181 -61
- package/build/lib/fs.d.ts +8 -1
- package/build/lib/index.d.ts +1 -0
- package/build/lib/parse.d.ts +1 -1
- package/build/lib/types.d.ts +11 -0
- package/build/lib-cjs/index.js +181 -69
- package/build/lib-esm/index.js +179 -69
- package/build/runtime/cache/cache.d.ts +5 -1
- package/build/runtime/cache/lists.d.ts +3 -3
- package/build/runtime/cache/storage.d.ts +8 -2
- package/build/runtime/cache/subscription.d.ts +1 -0
- package/build/runtime/client/documentStore.d.ts +9 -2
- package/build/runtime/client/index.d.ts +6 -3
- package/build/runtime/lib/index.d.ts +1 -0
- package/build/runtime/lib/lru.d.ts +52 -0
- package/build/runtime/lib/types.d.ts +1 -0
- package/build/runtime-cjs/cache/cache.d.ts +5 -1
- package/build/runtime-cjs/cache/cache.js +84 -27
- package/build/runtime-cjs/cache/lists.d.ts +3 -3
- package/build/runtime-cjs/cache/lists.js +20 -8
- package/build/runtime-cjs/cache/storage.d.ts +8 -2
- package/build/runtime-cjs/cache/storage.js +22 -5
- package/build/runtime-cjs/cache/subscription.d.ts +1 -0
- package/build/runtime-cjs/cache/subscription.js +3 -0
- package/build/runtime-cjs/client/documentStore.d.ts +9 -2
- package/build/runtime-cjs/client/documentStore.js +13 -9
- package/build/runtime-cjs/client/index.d.ts +6 -3
- package/build/runtime-cjs/client/index.js +6 -8
- package/build/runtime-cjs/client/plugins/cache.js +3 -0
- package/build/runtime-cjs/client/plugins/mutation.js +10 -6
- package/build/runtime-cjs/lib/index.d.ts +1 -0
- package/build/runtime-cjs/lib/index.js +1 -0
- package/build/runtime-cjs/lib/lru.d.ts +52 -0
- package/build/runtime-cjs/lib/lru.js +73 -0
- package/build/runtime-cjs/lib/types.d.ts +1 -0
- package/build/runtime-cjs/lib/types.js +7 -2
- package/build/runtime-esm/cache/cache.d.ts +5 -1
- package/build/runtime-esm/cache/cache.js +84 -27
- package/build/runtime-esm/cache/lists.d.ts +3 -3
- package/build/runtime-esm/cache/lists.js +20 -8
- package/build/runtime-esm/cache/storage.d.ts +8 -2
- package/build/runtime-esm/cache/storage.js +22 -5
- package/build/runtime-esm/cache/subscription.d.ts +1 -0
- package/build/runtime-esm/cache/subscription.js +3 -0
- package/build/runtime-esm/client/documentStore.d.ts +9 -2
- package/build/runtime-esm/client/documentStore.js +13 -9
- package/build/runtime-esm/client/index.d.ts +6 -3
- package/build/runtime-esm/client/index.js +6 -8
- package/build/runtime-esm/client/plugins/cache.js +3 -0
- package/build/runtime-esm/client/plugins/mutation.js +10 -6
- package/build/runtime-esm/lib/index.d.ts +1 -0
- package/build/runtime-esm/lib/index.js +1 -0
- package/build/runtime-esm/lib/lru.d.ts +52 -0
- package/build/runtime-esm/lib/lru.js +48 -0
- package/build/runtime-esm/lib/types.d.ts +1 -0
- package/build/runtime-esm/lib/types.js +5 -1
- package/build/test-cjs/index.js +181 -61
- package/build/test-esm/index.js +181 -61
- package/build/vite-cjs/index.js +200 -62
- package/build/vite-esm/index.js +200 -62
- package/package.json +1 -1
package/build/lib-cjs/index.js
CHANGED
|
@@ -58458,6 +58458,7 @@ var require_cjs = __commonJS({
|
|
|
58458
58458
|
var lib_exports = {};
|
|
58459
58459
|
__export(lib_exports, {
|
|
58460
58460
|
ArtifactKind: () => ArtifactKind,
|
|
58461
|
+
Cache: () => Cache,
|
|
58461
58462
|
CachePolicy: () => CachePolicy,
|
|
58462
58463
|
CompiledFragmentKind: () => CompiledFragmentKind,
|
|
58463
58464
|
CompiledMutationKind: () => CompiledMutationKind,
|
|
@@ -58494,6 +58495,7 @@ __export(lib_exports, {
|
|
|
58494
58495
|
getRootType: () => getRootType,
|
|
58495
58496
|
hashDocument: () => hashDocument,
|
|
58496
58497
|
houdini_mode: () => houdini_mode,
|
|
58498
|
+
isPending: () => isPending,
|
|
58497
58499
|
keyFieldsForType: () => keyFieldsForType,
|
|
58498
58500
|
mutation: () => mutation,
|
|
58499
58501
|
operation_requires_variables: () => operation_requires_variables,
|
|
@@ -61888,6 +61890,9 @@ var DataSource = {
|
|
|
61888
61890
|
};
|
|
61889
61891
|
var fragmentKey = " $fragments";
|
|
61890
61892
|
var PendingValue = Symbol("houdini_loading");
|
|
61893
|
+
function isPending(value) {
|
|
61894
|
+
return typeof value === "symbol";
|
|
61895
|
+
}
|
|
61891
61896
|
|
|
61892
61897
|
// src/runtime/lib/store.ts
|
|
61893
61898
|
var subscriber_queue = [];
|
|
@@ -62006,6 +62011,7 @@ __export(fs_exports, {
|
|
|
62006
62011
|
recursiveCopy: () => recursiveCopy,
|
|
62007
62012
|
remove: () => remove,
|
|
62008
62013
|
rmdir: () => rmdir,
|
|
62014
|
+
snapshot: () => snapshot,
|
|
62009
62015
|
stat: () => stat,
|
|
62010
62016
|
writeFile: () => writeFile
|
|
62011
62017
|
});
|
|
@@ -62200,16 +62206,17 @@ function existsSync(dirPath) {
|
|
|
62200
62206
|
}
|
|
62201
62207
|
return import_memfs.fs.existsSync(dirPath);
|
|
62202
62208
|
}
|
|
62203
|
-
async function readdir(filepath) {
|
|
62209
|
+
async function readdir(filepath, opts) {
|
|
62204
62210
|
if (!houdini_mode.is_testing) {
|
|
62205
|
-
return await import_promises.default.readdir(filepath);
|
|
62211
|
+
return await import_promises.default.readdir(filepath, opts);
|
|
62206
62212
|
}
|
|
62207
62213
|
if (filepath.includes("build/runtime")) {
|
|
62208
|
-
return await import_promises.default.readdir(filepath);
|
|
62214
|
+
return await import_promises.default.readdir(filepath, opts);
|
|
62209
62215
|
}
|
|
62210
62216
|
try {
|
|
62211
|
-
return import_memfs.fs.readdirSync(filepath);
|
|
62212
|
-
} catch {
|
|
62217
|
+
return import_memfs.fs.readdirSync(filepath, opts);
|
|
62218
|
+
} catch (e2) {
|
|
62219
|
+
console.log(e2);
|
|
62213
62220
|
return [];
|
|
62214
62221
|
}
|
|
62215
62222
|
}
|
|
@@ -62260,6 +62267,11 @@ async function recursiveCopy(source, target, transforms, notRoot) {
|
|
|
62260
62267
|
);
|
|
62261
62268
|
}
|
|
62262
62269
|
}
|
|
62270
|
+
function snapshot(base) {
|
|
62271
|
+
return Object.fromEntries(
|
|
62272
|
+
Object.entries(import_memfs.vol.toJSON()).filter(([key]) => !base || key.startsWith(base)).map(([key, value]) => [!base ? key : key.substring(base.length), value])
|
|
62273
|
+
);
|
|
62274
|
+
}
|
|
62263
62275
|
async function glob(pattern) {
|
|
62264
62276
|
return await (0, import_node_util.promisify)(import_glob.glob)(posixify(pattern));
|
|
62265
62277
|
}
|
|
@@ -63799,10 +63811,10 @@ var ListManager = class {
|
|
|
63799
63811
|
this.lists.get(list.name).get(parentID).lists.push(handler);
|
|
63800
63812
|
this.listsByField.get(parentID).get(list.key).push(handler);
|
|
63801
63813
|
}
|
|
63802
|
-
removeIDFromAllLists(id) {
|
|
63814
|
+
removeIDFromAllLists(id, layer) {
|
|
63803
63815
|
for (const fieldMap of this.lists.values()) {
|
|
63804
63816
|
for (const list of fieldMap.values()) {
|
|
63805
|
-
list.removeID(id);
|
|
63817
|
+
list.removeID(id, void 0, layer);
|
|
63806
63818
|
}
|
|
63807
63819
|
}
|
|
63808
63820
|
}
|
|
@@ -63899,6 +63911,10 @@ var List = class {
|
|
|
63899
63911
|
updates: ["append", "prepend"],
|
|
63900
63912
|
selection: {
|
|
63901
63913
|
fields: {
|
|
63914
|
+
__typename: {
|
|
63915
|
+
keyRaw: "__typename",
|
|
63916
|
+
type: "String"
|
|
63917
|
+
},
|
|
63902
63918
|
node: {
|
|
63903
63919
|
type: listType,
|
|
63904
63920
|
keyRaw: "node",
|
|
@@ -63923,7 +63939,15 @@ var List = class {
|
|
|
63923
63939
|
};
|
|
63924
63940
|
insertData = {
|
|
63925
63941
|
newEntry: {
|
|
63926
|
-
edges: [
|
|
63942
|
+
edges: [
|
|
63943
|
+
{
|
|
63944
|
+
__typename: listType + "Edge",
|
|
63945
|
+
node: {
|
|
63946
|
+
...data,
|
|
63947
|
+
__typename: listType
|
|
63948
|
+
}
|
|
63949
|
+
}
|
|
63950
|
+
]
|
|
63927
63951
|
}
|
|
63928
63952
|
};
|
|
63929
63953
|
} else {
|
|
@@ -63959,7 +63983,7 @@ var List = class {
|
|
|
63959
63983
|
layer: layer?.id
|
|
63960
63984
|
});
|
|
63961
63985
|
}
|
|
63962
|
-
removeID(id, variables = {}) {
|
|
63986
|
+
removeID(id, variables = {}, layer) {
|
|
63963
63987
|
if (!this.validateWhen()) {
|
|
63964
63988
|
return;
|
|
63965
63989
|
}
|
|
@@ -64006,7 +64030,7 @@ var List = class {
|
|
|
64006
64030
|
subscribers.map((sub) => sub[0]),
|
|
64007
64031
|
variables
|
|
64008
64032
|
);
|
|
64009
|
-
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID);
|
|
64033
|
+
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID, layer);
|
|
64010
64034
|
for (const [spec] of subscribers) {
|
|
64011
64035
|
spec.set(
|
|
64012
64036
|
this.cache._internal_unstable.getSelection({
|
|
@@ -64019,12 +64043,12 @@ var List = class {
|
|
|
64019
64043
|
}
|
|
64020
64044
|
return true;
|
|
64021
64045
|
}
|
|
64022
|
-
remove(data, variables = {}) {
|
|
64046
|
+
remove(data, variables = {}, layer) {
|
|
64023
64047
|
const targetID = this.cache._internal_unstable.id(this.listType(data), data);
|
|
64024
64048
|
if (!targetID) {
|
|
64025
64049
|
return;
|
|
64026
64050
|
}
|
|
64027
|
-
return this.removeID(targetID, variables);
|
|
64051
|
+
return this.removeID(targetID, variables, layer);
|
|
64028
64052
|
}
|
|
64029
64053
|
listType(data) {
|
|
64030
64054
|
return data.__typename || this.type;
|
|
@@ -64056,7 +64080,7 @@ var List = class {
|
|
|
64056
64080
|
layer,
|
|
64057
64081
|
where
|
|
64058
64082
|
}) {
|
|
64059
|
-
if (!this.remove(data, variables)) {
|
|
64083
|
+
if (!this.remove(data, variables, layer)) {
|
|
64060
64084
|
this.addToList(selection, data, variables, where, layer);
|
|
64061
64085
|
}
|
|
64062
64086
|
}
|
|
@@ -64193,7 +64217,7 @@ var StaleManager = class {
|
|
|
64193
64217
|
// src/runtime/cache/storage.ts
|
|
64194
64218
|
var InMemoryStorage = class {
|
|
64195
64219
|
data;
|
|
64196
|
-
idCount =
|
|
64220
|
+
idCount = 1;
|
|
64197
64221
|
rank = 0;
|
|
64198
64222
|
constructor() {
|
|
64199
64223
|
this.data = [];
|
|
@@ -64213,11 +64237,11 @@ var InMemoryStorage = class {
|
|
|
64213
64237
|
insert(id, field, location, target) {
|
|
64214
64238
|
return this.topLayer.insert(id, field, location, target);
|
|
64215
64239
|
}
|
|
64216
|
-
remove(id, field, target) {
|
|
64217
|
-
return
|
|
64240
|
+
remove(id, field, target, layerToUser = this.topLayer) {
|
|
64241
|
+
return layerToUser.remove(id, field, target);
|
|
64218
64242
|
}
|
|
64219
|
-
delete(id) {
|
|
64220
|
-
return
|
|
64243
|
+
delete(id, layerToUser = this.topLayer) {
|
|
64244
|
+
return layerToUser.delete(id);
|
|
64221
64245
|
}
|
|
64222
64246
|
deleteField(id, field) {
|
|
64223
64247
|
return this.topLayer.deleteField(id, field);
|
|
@@ -64351,6 +64375,23 @@ var InMemoryStorage = class {
|
|
|
64351
64375
|
}
|
|
64352
64376
|
return this.data[this.data.length - 1];
|
|
64353
64377
|
}
|
|
64378
|
+
serialize() {
|
|
64379
|
+
return JSON.stringify({
|
|
64380
|
+
rank: this.rank,
|
|
64381
|
+
fields: this.topLayer.fields,
|
|
64382
|
+
links: this.topLayer.links
|
|
64383
|
+
});
|
|
64384
|
+
}
|
|
64385
|
+
hydrate(args, layer) {
|
|
64386
|
+
if (!args) {
|
|
64387
|
+
return;
|
|
64388
|
+
}
|
|
64389
|
+
const { rank, fields, links } = args;
|
|
64390
|
+
this.rank = rank;
|
|
64391
|
+
layer ??= this.createLayer(true);
|
|
64392
|
+
layer.fields = fields;
|
|
64393
|
+
layer.links = links;
|
|
64394
|
+
}
|
|
64354
64395
|
};
|
|
64355
64396
|
var Layer = class {
|
|
64356
64397
|
id;
|
|
@@ -64589,6 +64630,9 @@ var InMemorySubscriptions = class {
|
|
|
64589
64630
|
subscribers = {};
|
|
64590
64631
|
referenceCounts = {};
|
|
64591
64632
|
keyVersions = {};
|
|
64633
|
+
activeFields(parent) {
|
|
64634
|
+
return Object.keys(this.subscribers[parent] || {});
|
|
64635
|
+
}
|
|
64592
64636
|
add({
|
|
64593
64637
|
parent,
|
|
64594
64638
|
spec,
|
|
@@ -64857,20 +64901,7 @@ var Cache = class {
|
|
|
64857
64901
|
}) {
|
|
64858
64902
|
const layer = layerID ? this._internal_unstable.storage.getLayer(layerID) : this._internal_unstable.storage.topLayer;
|
|
64859
64903
|
const subscribers = this._internal_unstable.writeSelection({ ...args, layer }).map((sub) => sub[0]);
|
|
64860
|
-
|
|
64861
|
-
for (const spec of subscribers.concat(notifySubscribers)) {
|
|
64862
|
-
if (!notified.includes(spec.set)) {
|
|
64863
|
-
notified.push(spec.set);
|
|
64864
|
-
spec.set(
|
|
64865
|
-
this._internal_unstable.getSelection({
|
|
64866
|
-
parent: spec.parentID || rootID,
|
|
64867
|
-
selection: spec.selection,
|
|
64868
|
-
variables: spec.variables?.() || {},
|
|
64869
|
-
ignoreMasking: false
|
|
64870
|
-
}).data
|
|
64871
|
-
);
|
|
64872
|
-
}
|
|
64873
|
-
}
|
|
64904
|
+
this.#notifySubscribers(subscribers.concat(notifySubscribers));
|
|
64874
64905
|
return subscribers;
|
|
64875
64906
|
}
|
|
64876
64907
|
read(...args) {
|
|
@@ -64909,10 +64940,10 @@ var Cache = class {
|
|
|
64909
64940
|
}
|
|
64910
64941
|
return handler;
|
|
64911
64942
|
}
|
|
64912
|
-
delete(id) {
|
|
64943
|
+
delete(id, layer) {
|
|
64913
64944
|
this._internal_unstable.subscriptions.removeAllSubscribers(id);
|
|
64914
|
-
this._internal_unstable.lists.removeIDFromAllLists(id);
|
|
64915
|
-
this._internal_unstable.storage.delete(id);
|
|
64945
|
+
this._internal_unstable.lists.removeIDFromAllLists(id, layer);
|
|
64946
|
+
this._internal_unstable.storage.delete(id, layer);
|
|
64916
64947
|
}
|
|
64917
64948
|
setConfig(config) {
|
|
64918
64949
|
this._internal_unstable.setConfig(config);
|
|
@@ -64944,6 +64975,76 @@ var Cache = class {
|
|
|
64944
64975
|
config() {
|
|
64945
64976
|
return this._internal_unstable.config;
|
|
64946
64977
|
}
|
|
64978
|
+
serialize() {
|
|
64979
|
+
return this._internal_unstable.storage.serialize();
|
|
64980
|
+
}
|
|
64981
|
+
hydrate(...args) {
|
|
64982
|
+
return this._internal_unstable.storage.hydrate(...args);
|
|
64983
|
+
}
|
|
64984
|
+
clearLayer(layerID) {
|
|
64985
|
+
const layer = this._internal_unstable.storage.getLayer(layerID);
|
|
64986
|
+
if (!layer) {
|
|
64987
|
+
throw new Error("Cannot find layer with id: " + layerID);
|
|
64988
|
+
}
|
|
64989
|
+
const toNotify = [];
|
|
64990
|
+
const allFields = [];
|
|
64991
|
+
for (const target of [layer.fields, layer.links]) {
|
|
64992
|
+
for (const [id, fields] of Object.entries(target)) {
|
|
64993
|
+
allFields.push(
|
|
64994
|
+
...Object.entries(fields).map(([field, value]) => ({ id, field, value }))
|
|
64995
|
+
);
|
|
64996
|
+
}
|
|
64997
|
+
}
|
|
64998
|
+
const displayFields = [];
|
|
64999
|
+
for (const pair of allFields) {
|
|
65000
|
+
const { displayLayers } = this._internal_unstable.storage.get(pair.id, pair.field);
|
|
65001
|
+
if (!displayLayers.includes(layerID)) {
|
|
65002
|
+
continue;
|
|
65003
|
+
}
|
|
65004
|
+
displayFields.push(pair);
|
|
65005
|
+
}
|
|
65006
|
+
for (const [id, operation] of Object.entries(layer.operations)) {
|
|
65007
|
+
if (operation.deleted) {
|
|
65008
|
+
displayFields.push(
|
|
65009
|
+
...this._internal_unstable.subscriptions.activeFields(id).map((field) => ({ id, field }))
|
|
65010
|
+
);
|
|
65011
|
+
}
|
|
65012
|
+
const fields = Object.keys(operation.fields ?? {});
|
|
65013
|
+
if (fields.length > 0) {
|
|
65014
|
+
displayFields.push(...fields.map((field) => ({ id, field })));
|
|
65015
|
+
}
|
|
65016
|
+
}
|
|
65017
|
+
layer.clear();
|
|
65018
|
+
for (const display of displayFields) {
|
|
65019
|
+
const { field, id } = display;
|
|
65020
|
+
const notify = !("value" in display) || this._internal_unstable.storage.get(id, field).value !== display.value;
|
|
65021
|
+
if (notify) {
|
|
65022
|
+
toNotify.push(
|
|
65023
|
+
...this._internal_unstable.subscriptions.get(id, field).map((sub) => sub[0])
|
|
65024
|
+
);
|
|
65025
|
+
}
|
|
65026
|
+
}
|
|
65027
|
+
this.#notifySubscribers(toNotify);
|
|
65028
|
+
}
|
|
65029
|
+
#notifySubscribers(subs) {
|
|
65030
|
+
if (subs.length === 0) {
|
|
65031
|
+
return;
|
|
65032
|
+
}
|
|
65033
|
+
const notified = [];
|
|
65034
|
+
for (const spec of subs) {
|
|
65035
|
+
if (!notified.includes(spec.set)) {
|
|
65036
|
+
notified.push(spec.set);
|
|
65037
|
+
spec.set(
|
|
65038
|
+
this._internal_unstable.getSelection({
|
|
65039
|
+
parent: spec.parentID || rootID,
|
|
65040
|
+
selection: spec.selection,
|
|
65041
|
+
variables: spec.variables?.() || {},
|
|
65042
|
+
ignoreMasking: false
|
|
65043
|
+
}).data
|
|
65044
|
+
);
|
|
65045
|
+
}
|
|
65046
|
+
}
|
|
65047
|
+
}
|
|
64947
65048
|
};
|
|
64948
65049
|
var CacheInternal = class {
|
|
64949
65050
|
_disabled = false;
|
|
@@ -65231,8 +65332,16 @@ var CacheInternal = class {
|
|
|
65231
65332
|
operation.position || "last",
|
|
65232
65333
|
layer
|
|
65233
65334
|
);
|
|
65335
|
+
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
65336
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
|
|
65337
|
+
selection: fieldSelection,
|
|
65338
|
+
data: target,
|
|
65339
|
+
variables,
|
|
65340
|
+
where: operation.position || "last",
|
|
65341
|
+
layer
|
|
65342
|
+
});
|
|
65234
65343
|
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
65235
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables);
|
|
65344
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
|
|
65236
65345
|
} else if (operation.action === "delete" && operation.type) {
|
|
65237
65346
|
if (typeof target !== "string") {
|
|
65238
65347
|
throw new Error("Cannot delete a record with a non-string ID");
|
|
@@ -65241,15 +65350,7 @@ var CacheInternal = class {
|
|
|
65241
65350
|
if (!targetID) {
|
|
65242
65351
|
continue;
|
|
65243
65352
|
}
|
|
65244
|
-
this.cache.delete(targetID);
|
|
65245
|
-
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
65246
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
|
|
65247
|
-
selection: fieldSelection,
|
|
65248
|
-
data: target,
|
|
65249
|
-
variables,
|
|
65250
|
-
where: operation.position || "last",
|
|
65251
|
-
layer
|
|
65252
|
-
});
|
|
65353
|
+
this.cache.delete(targetID, layer);
|
|
65253
65354
|
}
|
|
65254
65355
|
}
|
|
65255
65356
|
}
|
|
@@ -65718,6 +65819,9 @@ var cachePolicy = ({
|
|
|
65718
65819
|
},
|
|
65719
65820
|
afterNetwork(ctx, { resolve: resolve2, value, marshalVariables: marshalVariables2 }) {
|
|
65720
65821
|
if (value.source !== DataSource.Cache && enabled && value.data && !ctx.cacheParams?.disableWrite) {
|
|
65822
|
+
if (ctx.cacheParams && "serverSideFallback" in ctx.cacheParams) {
|
|
65823
|
+
serverSideFallback = ctx.cacheParams?.serverSideFallback ?? serverSideFallback;
|
|
65824
|
+
}
|
|
65721
65825
|
const targetCache = serverSide && serverSideFallback ? new Cache({ disabled: false }) : localCache;
|
|
65722
65826
|
let layer;
|
|
65723
65827
|
if (!serverSide && ctx.cacheParams?.layer) {
|
|
@@ -65875,7 +65979,7 @@ var fragment = documentPlugin(ArtifactKind.Fragment, function() {
|
|
|
65875
65979
|
var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
65876
65980
|
return {
|
|
65877
65981
|
async start(ctx, { next, marshalVariables: marshalVariables2 }) {
|
|
65878
|
-
const
|
|
65982
|
+
const layerOptimistic = cache_default._internal_unstable.storage.createLayer(true);
|
|
65879
65983
|
const optimisticResponse = ctx.stuff.optimisticResponse;
|
|
65880
65984
|
let toNotify = [];
|
|
65881
65985
|
if (optimisticResponse) {
|
|
@@ -65886,25 +65990,29 @@ var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
|
65886
65990
|
data: optimisticResponse
|
|
65887
65991
|
}),
|
|
65888
65992
|
variables: marshalVariables2(ctx),
|
|
65889
|
-
layer:
|
|
65993
|
+
layer: layerOptimistic.id
|
|
65890
65994
|
});
|
|
65891
65995
|
}
|
|
65892
65996
|
ctx.cacheParams = {
|
|
65893
65997
|
...ctx.cacheParams,
|
|
65894
|
-
layer,
|
|
65998
|
+
layer: layerOptimistic,
|
|
65895
65999
|
notifySubscribers: toNotify,
|
|
65896
66000
|
forceNotify: true
|
|
65897
66001
|
};
|
|
65898
66002
|
next(ctx);
|
|
65899
66003
|
},
|
|
65900
66004
|
afterNetwork(ctx, { resolve: resolve2 }) {
|
|
65901
|
-
ctx.cacheParams?.layer
|
|
66005
|
+
if (ctx.cacheParams?.layer) {
|
|
66006
|
+
cache_default.clearLayer(ctx.cacheParams.layer.id);
|
|
66007
|
+
}
|
|
65902
66008
|
resolve2(ctx);
|
|
65903
66009
|
},
|
|
65904
66010
|
end(ctx, { resolve: resolve2, value }) {
|
|
65905
66011
|
const hasErrors = value.errors && value.errors.length > 0;
|
|
65906
66012
|
if (hasErrors) {
|
|
65907
|
-
ctx.cacheParams?.layer
|
|
66013
|
+
if (ctx.cacheParams?.layer) {
|
|
66014
|
+
cache_default.clearLayer(ctx.cacheParams.layer.id);
|
|
66015
|
+
}
|
|
65908
66016
|
}
|
|
65909
66017
|
if (ctx.cacheParams?.layer) {
|
|
65910
66018
|
cache_default._internal_unstable.storage.resolveLayer(ctx.cacheParams.layer.id);
|
|
@@ -65914,7 +66022,7 @@ var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
|
65914
66022
|
catch(ctx, { error }) {
|
|
65915
66023
|
if (ctx.cacheParams?.layer) {
|
|
65916
66024
|
const { layer } = ctx.cacheParams;
|
|
65917
|
-
layer.
|
|
66025
|
+
cache_default.clearLayer(layer.id);
|
|
65918
66026
|
cache_default._internal_unstable.storage.resolveLayer(layer.id);
|
|
65919
66027
|
}
|
|
65920
66028
|
throw error;
|
|
@@ -66055,20 +66163,23 @@ var steps = {
|
|
|
66055
66163
|
backwards: ["end", "afterNetwork"]
|
|
66056
66164
|
};
|
|
66057
66165
|
var DocumentStore = class extends Writable {
|
|
66058
|
-
|
|
66166
|
+
artifact;
|
|
66059
66167
|
#client;
|
|
66060
66168
|
#configFile;
|
|
66061
66169
|
#plugins;
|
|
66062
66170
|
#lastVariables;
|
|
66063
66171
|
#lastContext = null;
|
|
66064
66172
|
pendingPromise = null;
|
|
66173
|
+
serverSideFallback;
|
|
66065
66174
|
constructor({
|
|
66066
66175
|
artifact,
|
|
66067
66176
|
plugins: plugins2,
|
|
66068
66177
|
pipeline: pipeline2,
|
|
66069
66178
|
client: client2,
|
|
66070
|
-
cache
|
|
66179
|
+
cache,
|
|
66180
|
+
enableCache = true,
|
|
66071
66181
|
initialValue,
|
|
66182
|
+
initialVariables,
|
|
66072
66183
|
fetching
|
|
66073
66184
|
}) {
|
|
66074
66185
|
fetching ??= artifact.kind === ArtifactKind.Query;
|
|
@@ -66079,7 +66190,7 @@ var DocumentStore = class extends Writable {
|
|
|
66079
66190
|
stale: false,
|
|
66080
66191
|
source: null,
|
|
66081
66192
|
fetching,
|
|
66082
|
-
variables: null
|
|
66193
|
+
variables: initialVariables ?? null
|
|
66083
66194
|
};
|
|
66084
66195
|
super(initialState, () => {
|
|
66085
66196
|
return () => {
|
|
@@ -66087,13 +66198,14 @@ var DocumentStore = class extends Writable {
|
|
|
66087
66198
|
this.cleanup();
|
|
66088
66199
|
};
|
|
66089
66200
|
});
|
|
66090
|
-
this
|
|
66201
|
+
this.artifact = artifact;
|
|
66091
66202
|
this.#client = client2;
|
|
66092
66203
|
this.#lastVariables = null;
|
|
66093
66204
|
this.#configFile = getCurrentConfig();
|
|
66094
66205
|
this.#plugins = pipeline2 ?? [
|
|
66095
66206
|
cachePolicy({
|
|
66096
|
-
|
|
66207
|
+
cache,
|
|
66208
|
+
enabled: enableCache,
|
|
66097
66209
|
setFetching: (fetching2, data) => {
|
|
66098
66210
|
this.update((state) => {
|
|
66099
66211
|
const newState = { ...state, fetching: fetching2 };
|
|
@@ -66120,9 +66232,9 @@ var DocumentStore = class extends Writable {
|
|
|
66120
66232
|
} = {}) {
|
|
66121
66233
|
let context = new ClientPluginContextWrapper({
|
|
66122
66234
|
config: this.#configFile,
|
|
66123
|
-
text: this
|
|
66124
|
-
hash: this
|
|
66125
|
-
policy: policy ?? this
|
|
66235
|
+
text: this.artifact.raw,
|
|
66236
|
+
hash: this.artifact.hash,
|
|
66237
|
+
policy: policy ?? this.artifact.policy,
|
|
66126
66238
|
variables: null,
|
|
66127
66239
|
metadata,
|
|
66128
66240
|
session,
|
|
@@ -66135,7 +66247,7 @@ var DocumentStore = class extends Writable {
|
|
|
66135
66247
|
},
|
|
66136
66248
|
...stuff
|
|
66137
66249
|
},
|
|
66138
|
-
artifact: this
|
|
66250
|
+
artifact: this.artifact,
|
|
66139
66251
|
lastVariables: this.#lastVariables,
|
|
66140
66252
|
cacheParams
|
|
66141
66253
|
});
|
|
@@ -66429,18 +66541,16 @@ var HoudiniClient = class {
|
|
|
66429
66541
|
this.url = url;
|
|
66430
66542
|
}
|
|
66431
66543
|
observe({
|
|
66432
|
-
|
|
66433
|
-
|
|
66434
|
-
|
|
66435
|
-
fetching = false
|
|
66544
|
+
enableCache = true,
|
|
66545
|
+
fetching = false,
|
|
66546
|
+
...rest
|
|
66436
66547
|
}) {
|
|
66437
66548
|
return new DocumentStore({
|
|
66438
66549
|
client: this,
|
|
66439
|
-
artifact,
|
|
66440
66550
|
plugins: createPluginHooks(this.plugins),
|
|
66441
|
-
|
|
66442
|
-
|
|
66443
|
-
|
|
66551
|
+
fetching,
|
|
66552
|
+
enableCache,
|
|
66553
|
+
...rest
|
|
66444
66554
|
});
|
|
66445
66555
|
}
|
|
66446
66556
|
};
|
|
@@ -67481,7 +67591,7 @@ function deepMerge2(filepath, ...targets) {
|
|
|
67481
67591
|
}
|
|
67482
67592
|
|
|
67483
67593
|
// src/lib/parse.ts
|
|
67484
|
-
|
|
67594
|
+
function parseJS(str, config) {
|
|
67485
67595
|
const defaultConfig = {
|
|
67486
67596
|
plugins: ["typescript", "importAssertions"],
|
|
67487
67597
|
sourceType: "module"
|
|
@@ -67796,6 +67906,7 @@ async function find_graphql(config, parsedScript, walker) {
|
|
|
67796
67906
|
// Annotate the CommonJS export names for ESM import in node:
|
|
67797
67907
|
0 && (module.exports = {
|
|
67798
67908
|
ArtifactKind,
|
|
67909
|
+
Cache,
|
|
67799
67910
|
CachePolicy,
|
|
67800
67911
|
CompiledFragmentKind,
|
|
67801
67912
|
CompiledMutationKind,
|
|
@@ -67832,6 +67943,7 @@ async function find_graphql(config, parsedScript, walker) {
|
|
|
67832
67943
|
getRootType,
|
|
67833
67944
|
hashDocument,
|
|
67834
67945
|
houdini_mode,
|
|
67946
|
+
isPending,
|
|
67835
67947
|
keyFieldsForType,
|
|
67836
67948
|
mutation,
|
|
67837
67949
|
operation_requires_variables,
|