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
|
@@ -54385,6 +54385,7 @@ __export(fs_exports, {
|
|
|
54385
54385
|
recursiveCopy: () => recursiveCopy,
|
|
54386
54386
|
remove: () => remove,
|
|
54387
54387
|
rmdir: () => rmdir,
|
|
54388
|
+
snapshot: () => snapshot,
|
|
54388
54389
|
stat: () => stat,
|
|
54389
54390
|
writeFile: () => writeFile
|
|
54390
54391
|
});
|
|
@@ -54579,16 +54580,17 @@ function existsSync(dirPath) {
|
|
|
54579
54580
|
}
|
|
54580
54581
|
return import_memfs.fs.existsSync(dirPath);
|
|
54581
54582
|
}
|
|
54582
|
-
async function readdir(filepath) {
|
|
54583
|
+
async function readdir(filepath, opts) {
|
|
54583
54584
|
if (!houdini_mode.is_testing) {
|
|
54584
|
-
return await fs.readdir(filepath);
|
|
54585
|
+
return await fs.readdir(filepath, opts);
|
|
54585
54586
|
}
|
|
54586
54587
|
if (filepath.includes("build/runtime")) {
|
|
54587
|
-
return await fs.readdir(filepath);
|
|
54588
|
+
return await fs.readdir(filepath, opts);
|
|
54588
54589
|
}
|
|
54589
54590
|
try {
|
|
54590
|
-
return import_memfs.fs.readdirSync(filepath);
|
|
54591
|
-
} catch {
|
|
54591
|
+
return import_memfs.fs.readdirSync(filepath, opts);
|
|
54592
|
+
} catch (e) {
|
|
54593
|
+
console.log(e);
|
|
54592
54594
|
return [];
|
|
54593
54595
|
}
|
|
54594
54596
|
}
|
|
@@ -54639,6 +54641,11 @@ async function recursiveCopy(source, target, transforms, notRoot) {
|
|
|
54639
54641
|
);
|
|
54640
54642
|
}
|
|
54641
54643
|
}
|
|
54644
|
+
function snapshot(base) {
|
|
54645
|
+
return Object.fromEntries(
|
|
54646
|
+
Object.entries(import_memfs.vol.toJSON()).filter(([key]) => !base || key.startsWith(base)).map(([key, value]) => [!base ? key : key.substring(base.length), value])
|
|
54647
|
+
);
|
|
54648
|
+
}
|
|
54642
54649
|
async function glob(pattern) {
|
|
54643
54650
|
return await promisify(import_glob.glob)(posixify(pattern));
|
|
54644
54651
|
}
|
|
@@ -54770,10 +54777,10 @@ var ListManager = class {
|
|
|
54770
54777
|
this.lists.get(list.name).get(parentID).lists.push(handler);
|
|
54771
54778
|
this.listsByField.get(parentID).get(list.key).push(handler);
|
|
54772
54779
|
}
|
|
54773
|
-
removeIDFromAllLists(id) {
|
|
54780
|
+
removeIDFromAllLists(id, layer) {
|
|
54774
54781
|
for (const fieldMap of this.lists.values()) {
|
|
54775
54782
|
for (const list of fieldMap.values()) {
|
|
54776
|
-
list.removeID(id);
|
|
54783
|
+
list.removeID(id, void 0, layer);
|
|
54777
54784
|
}
|
|
54778
54785
|
}
|
|
54779
54786
|
}
|
|
@@ -54870,6 +54877,10 @@ var List = class {
|
|
|
54870
54877
|
updates: ["append", "prepend"],
|
|
54871
54878
|
selection: {
|
|
54872
54879
|
fields: {
|
|
54880
|
+
__typename: {
|
|
54881
|
+
keyRaw: "__typename",
|
|
54882
|
+
type: "String"
|
|
54883
|
+
},
|
|
54873
54884
|
node: {
|
|
54874
54885
|
type: listType,
|
|
54875
54886
|
keyRaw: "node",
|
|
@@ -54894,7 +54905,15 @@ var List = class {
|
|
|
54894
54905
|
};
|
|
54895
54906
|
insertData = {
|
|
54896
54907
|
newEntry: {
|
|
54897
|
-
edges: [
|
|
54908
|
+
edges: [
|
|
54909
|
+
{
|
|
54910
|
+
__typename: listType + "Edge",
|
|
54911
|
+
node: {
|
|
54912
|
+
...data,
|
|
54913
|
+
__typename: listType
|
|
54914
|
+
}
|
|
54915
|
+
}
|
|
54916
|
+
]
|
|
54898
54917
|
}
|
|
54899
54918
|
};
|
|
54900
54919
|
} else {
|
|
@@ -54930,7 +54949,7 @@ var List = class {
|
|
|
54930
54949
|
layer: layer?.id
|
|
54931
54950
|
});
|
|
54932
54951
|
}
|
|
54933
|
-
removeID(id, variables = {}) {
|
|
54952
|
+
removeID(id, variables = {}, layer) {
|
|
54934
54953
|
if (!this.validateWhen()) {
|
|
54935
54954
|
return;
|
|
54936
54955
|
}
|
|
@@ -54977,7 +54996,7 @@ var List = class {
|
|
|
54977
54996
|
subscribers.map((sub) => sub[0]),
|
|
54978
54997
|
variables
|
|
54979
54998
|
);
|
|
54980
|
-
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID);
|
|
54999
|
+
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID, layer);
|
|
54981
55000
|
for (const [spec] of subscribers) {
|
|
54982
55001
|
spec.set(
|
|
54983
55002
|
this.cache._internal_unstable.getSelection({
|
|
@@ -54990,12 +55009,12 @@ var List = class {
|
|
|
54990
55009
|
}
|
|
54991
55010
|
return true;
|
|
54992
55011
|
}
|
|
54993
|
-
remove(data, variables = {}) {
|
|
55012
|
+
remove(data, variables = {}, layer) {
|
|
54994
55013
|
const targetID = this.cache._internal_unstable.id(this.listType(data), data);
|
|
54995
55014
|
if (!targetID) {
|
|
54996
55015
|
return;
|
|
54997
55016
|
}
|
|
54998
|
-
return this.removeID(targetID, variables);
|
|
55017
|
+
return this.removeID(targetID, variables, layer);
|
|
54999
55018
|
}
|
|
55000
55019
|
listType(data) {
|
|
55001
55020
|
return data.__typename || this.type;
|
|
@@ -55027,7 +55046,7 @@ var List = class {
|
|
|
55027
55046
|
layer,
|
|
55028
55047
|
where
|
|
55029
55048
|
}) {
|
|
55030
|
-
if (!this.remove(data, variables)) {
|
|
55049
|
+
if (!this.remove(data, variables, layer)) {
|
|
55031
55050
|
this.addToList(selection, data, variables, where, layer);
|
|
55032
55051
|
}
|
|
55033
55052
|
}
|
|
@@ -55164,7 +55183,7 @@ var StaleManager = class {
|
|
|
55164
55183
|
// src/runtime/cache/storage.ts
|
|
55165
55184
|
var InMemoryStorage = class {
|
|
55166
55185
|
data;
|
|
55167
|
-
idCount =
|
|
55186
|
+
idCount = 1;
|
|
55168
55187
|
rank = 0;
|
|
55169
55188
|
constructor() {
|
|
55170
55189
|
this.data = [];
|
|
@@ -55184,11 +55203,11 @@ var InMemoryStorage = class {
|
|
|
55184
55203
|
insert(id, field, location, target) {
|
|
55185
55204
|
return this.topLayer.insert(id, field, location, target);
|
|
55186
55205
|
}
|
|
55187
|
-
remove(id, field, target) {
|
|
55188
|
-
return
|
|
55206
|
+
remove(id, field, target, layerToUser = this.topLayer) {
|
|
55207
|
+
return layerToUser.remove(id, field, target);
|
|
55189
55208
|
}
|
|
55190
|
-
delete(id) {
|
|
55191
|
-
return
|
|
55209
|
+
delete(id, layerToUser = this.topLayer) {
|
|
55210
|
+
return layerToUser.delete(id);
|
|
55192
55211
|
}
|
|
55193
55212
|
deleteField(id, field) {
|
|
55194
55213
|
return this.topLayer.deleteField(id, field);
|
|
@@ -55322,6 +55341,23 @@ var InMemoryStorage = class {
|
|
|
55322
55341
|
}
|
|
55323
55342
|
return this.data[this.data.length - 1];
|
|
55324
55343
|
}
|
|
55344
|
+
serialize() {
|
|
55345
|
+
return JSON.stringify({
|
|
55346
|
+
rank: this.rank,
|
|
55347
|
+
fields: this.topLayer.fields,
|
|
55348
|
+
links: this.topLayer.links
|
|
55349
|
+
});
|
|
55350
|
+
}
|
|
55351
|
+
hydrate(args, layer) {
|
|
55352
|
+
if (!args) {
|
|
55353
|
+
return;
|
|
55354
|
+
}
|
|
55355
|
+
const { rank, fields, links } = args;
|
|
55356
|
+
this.rank = rank;
|
|
55357
|
+
layer ??= this.createLayer(true);
|
|
55358
|
+
layer.fields = fields;
|
|
55359
|
+
layer.links = links;
|
|
55360
|
+
}
|
|
55325
55361
|
};
|
|
55326
55362
|
var Layer = class {
|
|
55327
55363
|
id;
|
|
@@ -55560,6 +55596,9 @@ var InMemorySubscriptions = class {
|
|
|
55560
55596
|
subscribers = {};
|
|
55561
55597
|
referenceCounts = {};
|
|
55562
55598
|
keyVersions = {};
|
|
55599
|
+
activeFields(parent2) {
|
|
55600
|
+
return Object.keys(this.subscribers[parent2] || {});
|
|
55601
|
+
}
|
|
55563
55602
|
add({
|
|
55564
55603
|
parent: parent2,
|
|
55565
55604
|
spec,
|
|
@@ -55828,20 +55867,7 @@ var Cache = class {
|
|
|
55828
55867
|
}) {
|
|
55829
55868
|
const layer = layerID ? this._internal_unstable.storage.getLayer(layerID) : this._internal_unstable.storage.topLayer;
|
|
55830
55869
|
const subscribers = this._internal_unstable.writeSelection({ ...args, layer }).map((sub) => sub[0]);
|
|
55831
|
-
|
|
55832
|
-
for (const spec of subscribers.concat(notifySubscribers)) {
|
|
55833
|
-
if (!notified.includes(spec.set)) {
|
|
55834
|
-
notified.push(spec.set);
|
|
55835
|
-
spec.set(
|
|
55836
|
-
this._internal_unstable.getSelection({
|
|
55837
|
-
parent: spec.parentID || rootID,
|
|
55838
|
-
selection: spec.selection,
|
|
55839
|
-
variables: spec.variables?.() || {},
|
|
55840
|
-
ignoreMasking: false
|
|
55841
|
-
}).data
|
|
55842
|
-
);
|
|
55843
|
-
}
|
|
55844
|
-
}
|
|
55870
|
+
this.#notifySubscribers(subscribers.concat(notifySubscribers));
|
|
55845
55871
|
return subscribers;
|
|
55846
55872
|
}
|
|
55847
55873
|
read(...args) {
|
|
@@ -55880,10 +55906,10 @@ var Cache = class {
|
|
|
55880
55906
|
}
|
|
55881
55907
|
return handler;
|
|
55882
55908
|
}
|
|
55883
|
-
delete(id) {
|
|
55909
|
+
delete(id, layer) {
|
|
55884
55910
|
this._internal_unstable.subscriptions.removeAllSubscribers(id);
|
|
55885
|
-
this._internal_unstable.lists.removeIDFromAllLists(id);
|
|
55886
|
-
this._internal_unstable.storage.delete(id);
|
|
55911
|
+
this._internal_unstable.lists.removeIDFromAllLists(id, layer);
|
|
55912
|
+
this._internal_unstable.storage.delete(id, layer);
|
|
55887
55913
|
}
|
|
55888
55914
|
setConfig(config2) {
|
|
55889
55915
|
this._internal_unstable.setConfig(config2);
|
|
@@ -55915,6 +55941,76 @@ var Cache = class {
|
|
|
55915
55941
|
config() {
|
|
55916
55942
|
return this._internal_unstable.config;
|
|
55917
55943
|
}
|
|
55944
|
+
serialize() {
|
|
55945
|
+
return this._internal_unstable.storage.serialize();
|
|
55946
|
+
}
|
|
55947
|
+
hydrate(...args) {
|
|
55948
|
+
return this._internal_unstable.storage.hydrate(...args);
|
|
55949
|
+
}
|
|
55950
|
+
clearLayer(layerID) {
|
|
55951
|
+
const layer = this._internal_unstable.storage.getLayer(layerID);
|
|
55952
|
+
if (!layer) {
|
|
55953
|
+
throw new Error("Cannot find layer with id: " + layerID);
|
|
55954
|
+
}
|
|
55955
|
+
const toNotify = [];
|
|
55956
|
+
const allFields = [];
|
|
55957
|
+
for (const target of [layer.fields, layer.links]) {
|
|
55958
|
+
for (const [id, fields] of Object.entries(target)) {
|
|
55959
|
+
allFields.push(
|
|
55960
|
+
...Object.entries(fields).map(([field, value]) => ({ id, field, value }))
|
|
55961
|
+
);
|
|
55962
|
+
}
|
|
55963
|
+
}
|
|
55964
|
+
const displayFields = [];
|
|
55965
|
+
for (const pair of allFields) {
|
|
55966
|
+
const { displayLayers } = this._internal_unstable.storage.get(pair.id, pair.field);
|
|
55967
|
+
if (!displayLayers.includes(layerID)) {
|
|
55968
|
+
continue;
|
|
55969
|
+
}
|
|
55970
|
+
displayFields.push(pair);
|
|
55971
|
+
}
|
|
55972
|
+
for (const [id, operation] of Object.entries(layer.operations)) {
|
|
55973
|
+
if (operation.deleted) {
|
|
55974
|
+
displayFields.push(
|
|
55975
|
+
...this._internal_unstable.subscriptions.activeFields(id).map((field) => ({ id, field }))
|
|
55976
|
+
);
|
|
55977
|
+
}
|
|
55978
|
+
const fields = Object.keys(operation.fields ?? {});
|
|
55979
|
+
if (fields.length > 0) {
|
|
55980
|
+
displayFields.push(...fields.map((field) => ({ id, field })));
|
|
55981
|
+
}
|
|
55982
|
+
}
|
|
55983
|
+
layer.clear();
|
|
55984
|
+
for (const display of displayFields) {
|
|
55985
|
+
const { field, id } = display;
|
|
55986
|
+
const notify = !("value" in display) || this._internal_unstable.storage.get(id, field).value !== display.value;
|
|
55987
|
+
if (notify) {
|
|
55988
|
+
toNotify.push(
|
|
55989
|
+
...this._internal_unstable.subscriptions.get(id, field).map((sub) => sub[0])
|
|
55990
|
+
);
|
|
55991
|
+
}
|
|
55992
|
+
}
|
|
55993
|
+
this.#notifySubscribers(toNotify);
|
|
55994
|
+
}
|
|
55995
|
+
#notifySubscribers(subs) {
|
|
55996
|
+
if (subs.length === 0) {
|
|
55997
|
+
return;
|
|
55998
|
+
}
|
|
55999
|
+
const notified = [];
|
|
56000
|
+
for (const spec of subs) {
|
|
56001
|
+
if (!notified.includes(spec.set)) {
|
|
56002
|
+
notified.push(spec.set);
|
|
56003
|
+
spec.set(
|
|
56004
|
+
this._internal_unstable.getSelection({
|
|
56005
|
+
parent: spec.parentID || rootID,
|
|
56006
|
+
selection: spec.selection,
|
|
56007
|
+
variables: spec.variables?.() || {},
|
|
56008
|
+
ignoreMasking: false
|
|
56009
|
+
}).data
|
|
56010
|
+
);
|
|
56011
|
+
}
|
|
56012
|
+
}
|
|
56013
|
+
}
|
|
55918
56014
|
};
|
|
55919
56015
|
var CacheInternal = class {
|
|
55920
56016
|
_disabled = false;
|
|
@@ -56202,8 +56298,16 @@ var CacheInternal = class {
|
|
|
56202
56298
|
operation.position || "last",
|
|
56203
56299
|
layer
|
|
56204
56300
|
);
|
|
56301
|
+
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
56302
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
|
|
56303
|
+
selection: fieldSelection,
|
|
56304
|
+
data: target,
|
|
56305
|
+
variables,
|
|
56306
|
+
where: operation.position || "last",
|
|
56307
|
+
layer
|
|
56308
|
+
});
|
|
56205
56309
|
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
56206
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables);
|
|
56310
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
|
|
56207
56311
|
} else if (operation.action === "delete" && operation.type) {
|
|
56208
56312
|
if (typeof target !== "string") {
|
|
56209
56313
|
throw new Error("Cannot delete a record with a non-string ID");
|
|
@@ -56212,15 +56316,7 @@ var CacheInternal = class {
|
|
|
56212
56316
|
if (!targetID) {
|
|
56213
56317
|
continue;
|
|
56214
56318
|
}
|
|
56215
|
-
this.cache.delete(targetID);
|
|
56216
|
-
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
56217
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
|
|
56218
|
-
selection: fieldSelection,
|
|
56219
|
-
data: target,
|
|
56220
|
-
variables,
|
|
56221
|
-
where: operation.position || "last",
|
|
56222
|
-
layer
|
|
56223
|
-
});
|
|
56319
|
+
this.cache.delete(targetID, layer);
|
|
56224
56320
|
}
|
|
56225
56321
|
}
|
|
56226
56322
|
}
|
|
@@ -56755,7 +56851,7 @@ var fragment = documentPlugin(ArtifactKind.Fragment, function() {
|
|
|
56755
56851
|
var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
56756
56852
|
return {
|
|
56757
56853
|
async start(ctx, { next, marshalVariables }) {
|
|
56758
|
-
const
|
|
56854
|
+
const layerOptimistic = cache_default._internal_unstable.storage.createLayer(true);
|
|
56759
56855
|
const optimisticResponse = ctx.stuff.optimisticResponse;
|
|
56760
56856
|
let toNotify = [];
|
|
56761
56857
|
if (optimisticResponse) {
|
|
@@ -56766,25 +56862,29 @@ var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
|
56766
56862
|
data: optimisticResponse
|
|
56767
56863
|
}),
|
|
56768
56864
|
variables: marshalVariables(ctx),
|
|
56769
|
-
layer:
|
|
56865
|
+
layer: layerOptimistic.id
|
|
56770
56866
|
});
|
|
56771
56867
|
}
|
|
56772
56868
|
ctx.cacheParams = {
|
|
56773
56869
|
...ctx.cacheParams,
|
|
56774
|
-
layer,
|
|
56870
|
+
layer: layerOptimistic,
|
|
56775
56871
|
notifySubscribers: toNotify,
|
|
56776
56872
|
forceNotify: true
|
|
56777
56873
|
};
|
|
56778
56874
|
next(ctx);
|
|
56779
56875
|
},
|
|
56780
56876
|
afterNetwork(ctx, { resolve: resolve2 }) {
|
|
56781
|
-
ctx.cacheParams?.layer
|
|
56877
|
+
if (ctx.cacheParams?.layer) {
|
|
56878
|
+
cache_default.clearLayer(ctx.cacheParams.layer.id);
|
|
56879
|
+
}
|
|
56782
56880
|
resolve2(ctx);
|
|
56783
56881
|
},
|
|
56784
56882
|
end(ctx, { resolve: resolve2, value }) {
|
|
56785
56883
|
const hasErrors = value.errors && value.errors.length > 0;
|
|
56786
56884
|
if (hasErrors) {
|
|
56787
|
-
ctx.cacheParams?.layer
|
|
56885
|
+
if (ctx.cacheParams?.layer) {
|
|
56886
|
+
cache_default.clearLayer(ctx.cacheParams.layer.id);
|
|
56887
|
+
}
|
|
56788
56888
|
}
|
|
56789
56889
|
if (ctx.cacheParams?.layer) {
|
|
56790
56890
|
cache_default._internal_unstable.storage.resolveLayer(ctx.cacheParams.layer.id);
|
|
@@ -56794,7 +56894,7 @@ var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
|
56794
56894
|
catch(ctx, { error }) {
|
|
56795
56895
|
if (ctx.cacheParams?.layer) {
|
|
56796
56896
|
const { layer } = ctx.cacheParams;
|
|
56797
|
-
layer.
|
|
56897
|
+
cache_default.clearLayer(layer.id);
|
|
56798
56898
|
cache_default._internal_unstable.storage.resolveLayer(layer.id);
|
|
56799
56899
|
}
|
|
56800
56900
|
throw error;
|
|
@@ -56997,7 +57097,7 @@ function deepMerge2(filepath, ...targets) {
|
|
|
56997
57097
|
}
|
|
56998
57098
|
|
|
56999
57099
|
// src/lib/parse.ts
|
|
57000
|
-
|
|
57100
|
+
function parseJS(str, config2) {
|
|
57001
57101
|
const defaultConfig = {
|
|
57002
57102
|
plugins: ["typescript", "importAssertions"],
|
|
57003
57103
|
sourceType: "module"
|
|
@@ -58408,7 +58508,7 @@ function operationObject({
|
|
|
58408
58508
|
if (operationKind === "insert" || operationKind === "toggle") {
|
|
58409
58509
|
operation.position = position;
|
|
58410
58510
|
}
|
|
58411
|
-
if (operationKind
|
|
58511
|
+
if (allLists && operationKind !== "delete") {
|
|
58412
58512
|
operation.target = "all";
|
|
58413
58513
|
}
|
|
58414
58514
|
if (parentID) {
|
|
@@ -60244,12 +60344,28 @@ ${exportStatement("config")}
|
|
|
60244
60344
|
},
|
|
60245
60345
|
[path_exports.join(config2.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config: config2, content, importStatement, exportStatement })
|
|
60246
60346
|
}),
|
|
60247
|
-
...config2.plugins.filter((plugin2) => plugin2.includeRuntime).map(
|
|
60347
|
+
...config2.plugins.filter((plugin2) => plugin2.includeRuntime).map(
|
|
60348
|
+
(plugin2) => generatePluginRuntime({
|
|
60349
|
+
config: config2,
|
|
60350
|
+
docs,
|
|
60351
|
+
plugin: plugin2,
|
|
60352
|
+
importStatement,
|
|
60353
|
+
exportDefaultStatement: exportStatement,
|
|
60354
|
+
exportStarStatement: exportStar
|
|
60355
|
+
})
|
|
60356
|
+
),
|
|
60248
60357
|
generatePluginIndex({ config: config2, exportStatement: exportStar })
|
|
60249
60358
|
]);
|
|
60250
60359
|
await generateGraphqlReturnTypes(config2, docs);
|
|
60251
60360
|
}
|
|
60252
|
-
async function generatePluginRuntime(
|
|
60361
|
+
async function generatePluginRuntime({
|
|
60362
|
+
config: config2,
|
|
60363
|
+
docs,
|
|
60364
|
+
plugin: plugin2,
|
|
60365
|
+
importStatement,
|
|
60366
|
+
exportDefaultStatement,
|
|
60367
|
+
exportStarStatement
|
|
60368
|
+
}) {
|
|
60253
60369
|
if (houdini_mode.is_testing || !plugin2.includeRuntime) {
|
|
60254
60370
|
return;
|
|
60255
60371
|
}
|
|
@@ -60277,7 +60393,13 @@ async function generatePluginRuntime(config2, docs, plugin2) {
|
|
|
60277
60393
|
Object.fromEntries(
|
|
60278
60394
|
Object.entries(transformMap).map(([key, value]) => [
|
|
60279
60395
|
path_exports.join(runtime_path, key),
|
|
60280
|
-
(content) => value({
|
|
60396
|
+
(content) => value({
|
|
60397
|
+
config: config2,
|
|
60398
|
+
content,
|
|
60399
|
+
importStatement,
|
|
60400
|
+
exportDefaultStatement,
|
|
60401
|
+
exportStarStatement
|
|
60402
|
+
})
|
|
60281
60403
|
])
|
|
60282
60404
|
)
|
|
60283
60405
|
);
|
|
@@ -62145,14 +62267,12 @@ async function typeCheck(config2, docs) {
|
|
|
62145
62267
|
for (const targetType of targetTypes) {
|
|
62146
62268
|
const missingIDFields = config2.keyFieldsForType(targetType.name).filter((fieldName) => !targetType.getFields()[fieldName]);
|
|
62147
62269
|
if (missingIDFields.length > 0) {
|
|
62148
|
-
const message = `@${config2.listDirective} on ${logGreen(
|
|
62149
|
-
targetType.name
|
|
62150
|
-
)} as a configuration issue. Object identification missing: ${missingIDFields.map((c) => `"${logYellow(c)}"`).join(", ")}. Check 'Custom IDs' if needed.`;
|
|
62151
62270
|
errors.push(
|
|
62152
62271
|
new HoudiniError({
|
|
62153
62272
|
filepath: filename,
|
|
62154
|
-
message
|
|
62155
|
-
|
|
62273
|
+
message: `@${config2.listDirective} on ${logGreen(
|
|
62274
|
+
targetType.name
|
|
62275
|
+
)} 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`
|
|
62156
62276
|
})
|
|
62157
62277
|
);
|
|
62158
62278
|
return;
|
package/build/lib/fs.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
/// <reference types="glob" />
|
|
3
3
|
import fsExtra from 'fs-extra';
|
|
4
|
+
import type { Dirent } from 'node:fs';
|
|
4
5
|
export declare function copyFileSync(src: string, dest: string): void | null;
|
|
5
6
|
export declare function copyFile(src: string, dest: string): Promise<void | null>;
|
|
6
7
|
export declare function readFile(filepath: string): Promise<string | null>;
|
|
@@ -13,13 +14,19 @@ export declare function mkdir(filepath: string): Promise<void>;
|
|
|
13
14
|
export declare function rmdir(filepath: string): Promise<unknown>;
|
|
14
15
|
export declare function stat(filepath: string): Promise<import("memfs/lib/Stats").Stats<number> | fsExtra.Stats>;
|
|
15
16
|
export declare function existsSync(dirPath: string): boolean;
|
|
16
|
-
export declare function readdir(
|
|
17
|
+
export declare function readdir(path: string, options?: never): Promise<string[]>;
|
|
18
|
+
export declare function readdir(path: string, options?: fsExtra.ObjectEncodingOptions & {
|
|
19
|
+
withFileTypes: true;
|
|
20
|
+
}): Promise<Dirent[]>;
|
|
17
21
|
export declare function remove(filepath: string): Promise<void>;
|
|
18
22
|
type MockFilesystem = {
|
|
19
23
|
[key: string]: string | MockFilesystem;
|
|
20
24
|
};
|
|
21
25
|
export declare function mock(target: MockFilesystem[string], filepath?: string): Promise<void>;
|
|
22
26
|
export declare function recursiveCopy(source: string, target: string, transforms?: Record<string, (content: string, filepath: string) => string | Promise<string>>, notRoot?: boolean): Promise<void>;
|
|
27
|
+
export declare function snapshot(base?: string): {
|
|
28
|
+
[k: string]: string | null;
|
|
29
|
+
};
|
|
23
30
|
export declare function glob(pattern: string): Promise<string[]>;
|
|
24
31
|
export declare namespace glob {
|
|
25
32
|
var hasMagic: typeof import("glob").hasMagic;
|
package/build/lib/index.d.ts
CHANGED
package/build/lib/parse.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ export type ParsedFile = Maybe<{
|
|
|
6
6
|
start: number;
|
|
7
7
|
end: number;
|
|
8
8
|
}>;
|
|
9
|
-
export declare function parseJS(str: string, config?: Partial<ParserOptions>):
|
|
9
|
+
export declare function parseJS(str: string, config?: Partial<ParserOptions>): Script;
|
|
10
10
|
export declare function parseJSON(str: string): any;
|
|
11
11
|
type PrintOptions = Options & {
|
|
12
12
|
pretty?: boolean;
|
package/build/lib/types.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type graphql from 'graphql';
|
|
2
2
|
import type * as recast from 'recast';
|
|
3
3
|
import type { CustomPluginOptions, LoadResult, ObjectHook, PluginContext, ResolveIdResult, SourceMapInput } from 'rollup';
|
|
4
|
+
import type { UserConfig, ViteDevServer } from 'vite';
|
|
4
5
|
import type { ConfigFile } from '../runtime/lib/config';
|
|
5
6
|
import type { ArtifactKinds, BaseCompiledDocument, DocumentArtifact, ValueOf } from '../runtime/lib/types';
|
|
6
7
|
import type { TransformPage } from '../vite/houdini';
|
|
@@ -103,9 +104,15 @@ export type PluginHooks = {
|
|
|
103
104
|
transformRuntime?: Record<string, (args: {
|
|
104
105
|
config: Config;
|
|
105
106
|
content: string;
|
|
107
|
+
importStatement: (where: string, as: string) => string;
|
|
108
|
+
exportDefaultStatement: (val: string) => string;
|
|
109
|
+
exportStarStatement: (val: string) => string;
|
|
106
110
|
}) => string> | ((docs: Document[]) => Record<string, (args: {
|
|
107
111
|
config: Config;
|
|
108
112
|
content: string;
|
|
113
|
+
importStatement: (where: string, as: string) => string;
|
|
114
|
+
exportDefaultStatement: (val: string) => string;
|
|
115
|
+
exportStarStatement: (val: string) => string;
|
|
109
116
|
}) => string>);
|
|
110
117
|
/**
|
|
111
118
|
* An module with an default export that sets configuration values.
|
|
@@ -240,6 +247,7 @@ export type PluginHooks = {
|
|
|
240
247
|
map?: SourceMapInput | string;
|
|
241
248
|
};
|
|
242
249
|
vite?: {
|
|
250
|
+
config?: (config: Config) => UserConfig;
|
|
243
251
|
resolveId?: ObjectHook<(this: PluginContext, source: string, importer: string | undefined, options: {
|
|
244
252
|
config: Config;
|
|
245
253
|
custom?: CustomPluginOptions;
|
|
@@ -250,6 +258,9 @@ export type PluginHooks = {
|
|
|
250
258
|
config: Config;
|
|
251
259
|
ssr?: boolean;
|
|
252
260
|
}) => Promise<LoadResult> | LoadResult>;
|
|
261
|
+
configureServer?: ObjectHook<(this: void, server: ViteDevServer & {
|
|
262
|
+
houdiniConfig: Config;
|
|
263
|
+
}) => (() => void) | void | Promise<(() => void) | void>, {}> | undefined;
|
|
253
264
|
};
|
|
254
265
|
};
|
|
255
266
|
type ModuleIndexTransform = (arg: {
|