houdini 1.2.1 → 1.2.3
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 +149 -104
- package/build/cmd-esm/index.js +149 -104
- package/build/codegen/generators/artifacts/selection.d.ts +2 -1
- package/build/codegen/utils/flattenSelections.d.ts +2 -4
- package/build/codegen-cjs/index.js +147 -102
- package/build/codegen-esm/index.js +147 -102
- package/build/lib-cjs/index.js +103 -45
- package/build/lib-esm/index.js +103 -45
- package/build/runtime/cache/cache.d.ts +3 -1
- package/build/runtime/cache/lists.d.ts +3 -3
- package/build/runtime/cache/storage.d.ts +2 -2
- package/build/runtime/cache/subscription.d.ts +1 -0
- package/build/runtime-cjs/cache/cache.d.ts +3 -1
- package/build/runtime-cjs/cache/cache.js +78 -27
- package/build/runtime-cjs/cache/lists.d.ts +3 -3
- package/build/runtime-cjs/cache/lists.js +7 -7
- package/build/runtime-cjs/cache/storage.d.ts +2 -2
- package/build/runtime-cjs/cache/storage.js +5 -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/plugins/mutation.js +10 -6
- package/build/runtime-esm/cache/cache.d.ts +3 -1
- package/build/runtime-esm/cache/cache.js +78 -27
- package/build/runtime-esm/cache/lists.d.ts +3 -3
- package/build/runtime-esm/cache/lists.js +7 -7
- package/build/runtime-esm/cache/storage.d.ts +2 -2
- package/build/runtime-esm/cache/storage.js +5 -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/plugins/mutation.js +10 -6
- package/build/test-cjs/index.js +147 -102
- package/build/test-esm/index.js +147 -102
- package/build/vite-cjs/index.js +147 -102
- package/build/vite-esm/index.js +147 -102
- package/package.json +1 -1
package/build/test-cjs/index.js
CHANGED
|
@@ -54775,10 +54775,10 @@ var ListManager = class {
|
|
|
54775
54775
|
this.lists.get(list.name).get(parentID).lists.push(handler);
|
|
54776
54776
|
this.listsByField.get(parentID).get(list.key).push(handler);
|
|
54777
54777
|
}
|
|
54778
|
-
removeIDFromAllLists(id) {
|
|
54778
|
+
removeIDFromAllLists(id, layer) {
|
|
54779
54779
|
for (const fieldMap of this.lists.values()) {
|
|
54780
54780
|
for (const list of fieldMap.values()) {
|
|
54781
|
-
list.removeID(id);
|
|
54781
|
+
list.removeID(id, void 0, layer);
|
|
54782
54782
|
}
|
|
54783
54783
|
}
|
|
54784
54784
|
}
|
|
@@ -54935,7 +54935,7 @@ var List = class {
|
|
|
54935
54935
|
layer: layer?.id
|
|
54936
54936
|
});
|
|
54937
54937
|
}
|
|
54938
|
-
removeID(id, variables = {}) {
|
|
54938
|
+
removeID(id, variables = {}, layer) {
|
|
54939
54939
|
if (!this.validateWhen()) {
|
|
54940
54940
|
return;
|
|
54941
54941
|
}
|
|
@@ -54982,7 +54982,7 @@ var List = class {
|
|
|
54982
54982
|
subscribers.map((sub) => sub[0]),
|
|
54983
54983
|
variables
|
|
54984
54984
|
);
|
|
54985
|
-
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID);
|
|
54985
|
+
this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID, layer);
|
|
54986
54986
|
for (const [spec] of subscribers) {
|
|
54987
54987
|
spec.set(
|
|
54988
54988
|
this.cache._internal_unstable.getSelection({
|
|
@@ -54995,12 +54995,12 @@ var List = class {
|
|
|
54995
54995
|
}
|
|
54996
54996
|
return true;
|
|
54997
54997
|
}
|
|
54998
|
-
remove(data, variables = {}) {
|
|
54998
|
+
remove(data, variables = {}, layer) {
|
|
54999
54999
|
const targetID = this.cache._internal_unstable.id(this.listType(data), data);
|
|
55000
55000
|
if (!targetID) {
|
|
55001
55001
|
return;
|
|
55002
55002
|
}
|
|
55003
|
-
return this.removeID(targetID, variables);
|
|
55003
|
+
return this.removeID(targetID, variables, layer);
|
|
55004
55004
|
}
|
|
55005
55005
|
listType(data) {
|
|
55006
55006
|
return data.__typename || this.type;
|
|
@@ -55032,7 +55032,7 @@ var List = class {
|
|
|
55032
55032
|
layer,
|
|
55033
55033
|
where
|
|
55034
55034
|
}) {
|
|
55035
|
-
if (!this.remove(data, variables)) {
|
|
55035
|
+
if (!this.remove(data, variables, layer)) {
|
|
55036
55036
|
this.addToList(selection, data, variables, where, layer);
|
|
55037
55037
|
}
|
|
55038
55038
|
}
|
|
@@ -55169,7 +55169,7 @@ var StaleManager = class {
|
|
|
55169
55169
|
// src/runtime/cache/storage.ts
|
|
55170
55170
|
var InMemoryStorage = class {
|
|
55171
55171
|
data;
|
|
55172
|
-
idCount =
|
|
55172
|
+
idCount = 1;
|
|
55173
55173
|
rank = 0;
|
|
55174
55174
|
constructor() {
|
|
55175
55175
|
this.data = [];
|
|
@@ -55189,11 +55189,11 @@ var InMemoryStorage = class {
|
|
|
55189
55189
|
insert(id, field, location, target) {
|
|
55190
55190
|
return this.topLayer.insert(id, field, location, target);
|
|
55191
55191
|
}
|
|
55192
|
-
remove(id, field, target) {
|
|
55193
|
-
return
|
|
55192
|
+
remove(id, field, target, layerToUser = this.topLayer) {
|
|
55193
|
+
return layerToUser.remove(id, field, target);
|
|
55194
55194
|
}
|
|
55195
|
-
delete(id) {
|
|
55196
|
-
return
|
|
55195
|
+
delete(id, layerToUser = this.topLayer) {
|
|
55196
|
+
return layerToUser.delete(id);
|
|
55197
55197
|
}
|
|
55198
55198
|
deleteField(id, field) {
|
|
55199
55199
|
return this.topLayer.deleteField(id, field);
|
|
@@ -55565,6 +55565,9 @@ var InMemorySubscriptions = class {
|
|
|
55565
55565
|
subscribers = {};
|
|
55566
55566
|
referenceCounts = {};
|
|
55567
55567
|
keyVersions = {};
|
|
55568
|
+
activeFields(parent2) {
|
|
55569
|
+
return Object.keys(this.subscribers[parent2] || {});
|
|
55570
|
+
}
|
|
55568
55571
|
add({
|
|
55569
55572
|
parent: parent2,
|
|
55570
55573
|
spec,
|
|
@@ -55833,20 +55836,7 @@ var Cache = class {
|
|
|
55833
55836
|
}) {
|
|
55834
55837
|
const layer = layerID ? this._internal_unstable.storage.getLayer(layerID) : this._internal_unstable.storage.topLayer;
|
|
55835
55838
|
const subscribers = this._internal_unstable.writeSelection({ ...args, layer }).map((sub) => sub[0]);
|
|
55836
|
-
|
|
55837
|
-
for (const spec of subscribers.concat(notifySubscribers)) {
|
|
55838
|
-
if (!notified.includes(spec.set)) {
|
|
55839
|
-
notified.push(spec.set);
|
|
55840
|
-
spec.set(
|
|
55841
|
-
this._internal_unstable.getSelection({
|
|
55842
|
-
parent: spec.parentID || rootID,
|
|
55843
|
-
selection: spec.selection,
|
|
55844
|
-
variables: spec.variables?.() || {},
|
|
55845
|
-
ignoreMasking: false
|
|
55846
|
-
}).data
|
|
55847
|
-
);
|
|
55848
|
-
}
|
|
55849
|
-
}
|
|
55839
|
+
this.#notifySubscribers(subscribers.concat(notifySubscribers));
|
|
55850
55840
|
return subscribers;
|
|
55851
55841
|
}
|
|
55852
55842
|
read(...args) {
|
|
@@ -55885,10 +55875,10 @@ var Cache = class {
|
|
|
55885
55875
|
}
|
|
55886
55876
|
return handler;
|
|
55887
55877
|
}
|
|
55888
|
-
delete(id) {
|
|
55878
|
+
delete(id, layer) {
|
|
55889
55879
|
this._internal_unstable.subscriptions.removeAllSubscribers(id);
|
|
55890
|
-
this._internal_unstable.lists.removeIDFromAllLists(id);
|
|
55891
|
-
this._internal_unstable.storage.delete(id);
|
|
55880
|
+
this._internal_unstable.lists.removeIDFromAllLists(id, layer);
|
|
55881
|
+
this._internal_unstable.storage.delete(id, layer);
|
|
55892
55882
|
}
|
|
55893
55883
|
setConfig(config2) {
|
|
55894
55884
|
this._internal_unstable.setConfig(config2);
|
|
@@ -55920,6 +55910,70 @@ var Cache = class {
|
|
|
55920
55910
|
config() {
|
|
55921
55911
|
return this._internal_unstable.config;
|
|
55922
55912
|
}
|
|
55913
|
+
clearLayer(layerID) {
|
|
55914
|
+
const layer = this._internal_unstable.storage.getLayer(layerID);
|
|
55915
|
+
if (!layer) {
|
|
55916
|
+
throw new Error("Cannot find layer with id: " + layerID);
|
|
55917
|
+
}
|
|
55918
|
+
const toNotify = [];
|
|
55919
|
+
const allFields = [];
|
|
55920
|
+
for (const target of [layer.fields, layer.links]) {
|
|
55921
|
+
for (const [id, fields] of Object.entries(target)) {
|
|
55922
|
+
allFields.push(
|
|
55923
|
+
...Object.entries(fields).map(([field, value]) => ({ id, field, value }))
|
|
55924
|
+
);
|
|
55925
|
+
}
|
|
55926
|
+
}
|
|
55927
|
+
const displayFields = [];
|
|
55928
|
+
for (const pair of allFields) {
|
|
55929
|
+
const { displayLayers } = this._internal_unstable.storage.get(pair.id, pair.field);
|
|
55930
|
+
if (!displayLayers.includes(layerID)) {
|
|
55931
|
+
continue;
|
|
55932
|
+
}
|
|
55933
|
+
displayFields.push(pair);
|
|
55934
|
+
}
|
|
55935
|
+
for (const [id, operation] of Object.entries(layer.operations)) {
|
|
55936
|
+
if (operation.deleted) {
|
|
55937
|
+
displayFields.push(
|
|
55938
|
+
...this._internal_unstable.subscriptions.activeFields(id).map((field) => ({ id, field }))
|
|
55939
|
+
);
|
|
55940
|
+
}
|
|
55941
|
+
const fields = Object.keys(operation.fields ?? {});
|
|
55942
|
+
if (fields.length > 0) {
|
|
55943
|
+
displayFields.push(...fields.map((field) => ({ id, field })));
|
|
55944
|
+
}
|
|
55945
|
+
}
|
|
55946
|
+
layer.clear();
|
|
55947
|
+
for (const display of displayFields) {
|
|
55948
|
+
const { field, id } = display;
|
|
55949
|
+
const notify = !("value" in display) || this._internal_unstable.storage.get(id, field).value !== display.value;
|
|
55950
|
+
if (notify) {
|
|
55951
|
+
toNotify.push(
|
|
55952
|
+
...this._internal_unstable.subscriptions.get(id, field).map((sub) => sub[0])
|
|
55953
|
+
);
|
|
55954
|
+
}
|
|
55955
|
+
}
|
|
55956
|
+
this.#notifySubscribers(toNotify);
|
|
55957
|
+
}
|
|
55958
|
+
#notifySubscribers(subs) {
|
|
55959
|
+
if (subs.length === 0) {
|
|
55960
|
+
return;
|
|
55961
|
+
}
|
|
55962
|
+
const notified = [];
|
|
55963
|
+
for (const spec of subs) {
|
|
55964
|
+
if (!notified.includes(spec.set)) {
|
|
55965
|
+
notified.push(spec.set);
|
|
55966
|
+
spec.set(
|
|
55967
|
+
this._internal_unstable.getSelection({
|
|
55968
|
+
parent: spec.parentID || rootID,
|
|
55969
|
+
selection: spec.selection,
|
|
55970
|
+
variables: spec.variables?.() || {},
|
|
55971
|
+
ignoreMasking: false
|
|
55972
|
+
}).data
|
|
55973
|
+
);
|
|
55974
|
+
}
|
|
55975
|
+
}
|
|
55976
|
+
}
|
|
55923
55977
|
};
|
|
55924
55978
|
var CacheInternal = class {
|
|
55925
55979
|
_disabled = false;
|
|
@@ -56207,8 +56261,16 @@ var CacheInternal = class {
|
|
|
56207
56261
|
operation.position || "last",
|
|
56208
56262
|
layer
|
|
56209
56263
|
);
|
|
56264
|
+
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
56265
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
|
|
56266
|
+
selection: fieldSelection,
|
|
56267
|
+
data: target,
|
|
56268
|
+
variables,
|
|
56269
|
+
where: operation.position || "last",
|
|
56270
|
+
layer
|
|
56271
|
+
});
|
|
56210
56272
|
} else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
|
|
56211
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables);
|
|
56273
|
+
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables, layer);
|
|
56212
56274
|
} else if (operation.action === "delete" && operation.type) {
|
|
56213
56275
|
if (typeof target !== "string") {
|
|
56214
56276
|
throw new Error("Cannot delete a record with a non-string ID");
|
|
@@ -56217,15 +56279,7 @@ var CacheInternal = class {
|
|
|
56217
56279
|
if (!targetID) {
|
|
56218
56280
|
continue;
|
|
56219
56281
|
}
|
|
56220
|
-
this.cache.delete(targetID);
|
|
56221
|
-
} else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
|
|
56222
|
-
this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement({
|
|
56223
|
-
selection: fieldSelection,
|
|
56224
|
-
data: target,
|
|
56225
|
-
variables,
|
|
56226
|
-
where: operation.position || "last",
|
|
56227
|
-
layer
|
|
56228
|
-
});
|
|
56282
|
+
this.cache.delete(targetID, layer);
|
|
56229
56283
|
}
|
|
56230
56284
|
}
|
|
56231
56285
|
}
|
|
@@ -56760,7 +56814,7 @@ var fragment = documentPlugin(ArtifactKind.Fragment, function() {
|
|
|
56760
56814
|
var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
56761
56815
|
return {
|
|
56762
56816
|
async start(ctx, { next, marshalVariables }) {
|
|
56763
|
-
const
|
|
56817
|
+
const layerOptimistic = cache_default._internal_unstable.storage.createLayer(true);
|
|
56764
56818
|
const optimisticResponse = ctx.stuff.optimisticResponse;
|
|
56765
56819
|
let toNotify = [];
|
|
56766
56820
|
if (optimisticResponse) {
|
|
@@ -56771,25 +56825,29 @@ var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
|
56771
56825
|
data: optimisticResponse
|
|
56772
56826
|
}),
|
|
56773
56827
|
variables: marshalVariables(ctx),
|
|
56774
|
-
layer:
|
|
56828
|
+
layer: layerOptimistic.id
|
|
56775
56829
|
});
|
|
56776
56830
|
}
|
|
56777
56831
|
ctx.cacheParams = {
|
|
56778
56832
|
...ctx.cacheParams,
|
|
56779
|
-
layer,
|
|
56833
|
+
layer: layerOptimistic,
|
|
56780
56834
|
notifySubscribers: toNotify,
|
|
56781
56835
|
forceNotify: true
|
|
56782
56836
|
};
|
|
56783
56837
|
next(ctx);
|
|
56784
56838
|
},
|
|
56785
56839
|
afterNetwork(ctx, { resolve: resolve2 }) {
|
|
56786
|
-
ctx.cacheParams?.layer
|
|
56840
|
+
if (ctx.cacheParams?.layer) {
|
|
56841
|
+
cache_default.clearLayer(ctx.cacheParams.layer.id);
|
|
56842
|
+
}
|
|
56787
56843
|
resolve2(ctx);
|
|
56788
56844
|
},
|
|
56789
56845
|
end(ctx, { resolve: resolve2, value }) {
|
|
56790
56846
|
const hasErrors = value.errors && value.errors.length > 0;
|
|
56791
56847
|
if (hasErrors) {
|
|
56792
|
-
ctx.cacheParams?.layer
|
|
56848
|
+
if (ctx.cacheParams?.layer) {
|
|
56849
|
+
cache_default.clearLayer(ctx.cacheParams.layer.id);
|
|
56850
|
+
}
|
|
56793
56851
|
}
|
|
56794
56852
|
if (ctx.cacheParams?.layer) {
|
|
56795
56853
|
cache_default._internal_unstable.storage.resolveLayer(ctx.cacheParams.layer.id);
|
|
@@ -56799,7 +56857,7 @@ var mutation = documentPlugin(ArtifactKind.Mutation, () => {
|
|
|
56799
56857
|
catch(ctx, { error }) {
|
|
56800
56858
|
if (ctx.cacheParams?.layer) {
|
|
56801
56859
|
const { layer } = ctx.cacheParams;
|
|
56802
|
-
layer.
|
|
56860
|
+
cache_default.clearLayer(layer.id);
|
|
56803
56861
|
cache_default._internal_unstable.storage.resolveLayer(layer.id);
|
|
56804
56862
|
}
|
|
56805
56863
|
throw error;
|
|
@@ -57690,18 +57748,14 @@ function flattenSelections({
|
|
|
57690
57748
|
filepath,
|
|
57691
57749
|
selections,
|
|
57692
57750
|
fragmentDefinitions,
|
|
57693
|
-
|
|
57694
|
-
keepFragmentSpreadNodes,
|
|
57695
|
-
hoistFragments
|
|
57751
|
+
applyFragments
|
|
57696
57752
|
}) {
|
|
57697
57753
|
const fields = new FieldCollection({
|
|
57698
57754
|
config: config2,
|
|
57699
57755
|
filepath,
|
|
57700
57756
|
selections,
|
|
57701
57757
|
fragmentDefinitions,
|
|
57702
|
-
|
|
57703
|
-
keepFragmentSpreadNodes: !!keepFragmentSpreadNodes,
|
|
57704
|
-
hoistFragments
|
|
57758
|
+
applyFragments: !!applyFragments
|
|
57705
57759
|
});
|
|
57706
57760
|
return fields.toSelectionSet();
|
|
57707
57761
|
}
|
|
@@ -57712,18 +57766,14 @@ var FieldCollection = class {
|
|
|
57712
57766
|
fields;
|
|
57713
57767
|
inlineFragments;
|
|
57714
57768
|
fragmentSpreads;
|
|
57715
|
-
|
|
57716
|
-
keepFragmentSpreadNodes;
|
|
57717
|
-
hoistFragments;
|
|
57769
|
+
applyFragments;
|
|
57718
57770
|
constructor(args) {
|
|
57719
57771
|
this.config = args.config;
|
|
57720
57772
|
this.fragmentDefinitions = args.fragmentDefinitions;
|
|
57721
|
-
this.
|
|
57722
|
-
this.keepFragmentSpreadNodes = args.keepFragmentSpreadNodes;
|
|
57773
|
+
this.applyFragments = args.applyFragments;
|
|
57723
57774
|
this.fields = {};
|
|
57724
57775
|
this.inlineFragments = {};
|
|
57725
57776
|
this.fragmentSpreads = {};
|
|
57726
|
-
this.hoistFragments = !!args.hoistFragments;
|
|
57727
57777
|
this.filepath = args.filepath;
|
|
57728
57778
|
for (const selection of args.selections) {
|
|
57729
57779
|
this.add({ selection });
|
|
@@ -57733,21 +57783,18 @@ var FieldCollection = class {
|
|
|
57733
57783
|
return Object.keys(this.fields).length + Object.keys(this.inlineFragments).length + Object.keys(this.fragmentSpreads).length;
|
|
57734
57784
|
}
|
|
57735
57785
|
add({ selection, external }) {
|
|
57736
|
-
let
|
|
57786
|
+
let include = this.config.defaultFragmentMasking === "disable";
|
|
57737
57787
|
const maskEnableDirective = selection.directives?.find(
|
|
57738
57788
|
({ name }) => name.value === this.config.maskEnableDirective
|
|
57739
57789
|
);
|
|
57740
57790
|
if (maskEnableDirective) {
|
|
57741
|
-
|
|
57791
|
+
include = false;
|
|
57742
57792
|
}
|
|
57743
57793
|
const maskDisableDirective = selection.directives?.find(
|
|
57744
57794
|
({ name }) => name.value === this.config.maskDisableDirective
|
|
57745
57795
|
);
|
|
57746
57796
|
if (maskDisableDirective) {
|
|
57747
|
-
|
|
57748
|
-
}
|
|
57749
|
-
if (this.ignoreMaskDisable) {
|
|
57750
|
-
includeFragments = true;
|
|
57797
|
+
include = true;
|
|
57751
57798
|
}
|
|
57752
57799
|
if (selection.kind === "Field") {
|
|
57753
57800
|
const key = selection.alias?.value || selection.name.value;
|
|
@@ -57763,7 +57810,7 @@ var FieldCollection = class {
|
|
|
57763
57810
|
external
|
|
57764
57811
|
});
|
|
57765
57812
|
}
|
|
57766
|
-
if (
|
|
57813
|
+
if (this.applyFragments && !external) {
|
|
57767
57814
|
this.fields[key].selection.fragmentSpreads = {
|
|
57768
57815
|
...this.collectFragmentSpreads(selection.selectionSet?.selections ?? []),
|
|
57769
57816
|
...this.fields[key].selection.fragmentSpreads
|
|
@@ -57777,16 +57824,13 @@ var FieldCollection = class {
|
|
|
57777
57824
|
}
|
|
57778
57825
|
}
|
|
57779
57826
|
if (selection.kind === "InlineFragment" && selection.typeCondition) {
|
|
57780
|
-
this.walkInlineFragment({ selection, external
|
|
57827
|
+
this.walkInlineFragment({ selection, external });
|
|
57781
57828
|
return;
|
|
57782
57829
|
}
|
|
57783
57830
|
if (selection.kind === "FragmentSpread") {
|
|
57784
|
-
if (
|
|
57831
|
+
if (!external || include) {
|
|
57785
57832
|
this.fragmentSpreads[selection.name.value] = selection;
|
|
57786
57833
|
}
|
|
57787
|
-
if (!includeFragments) {
|
|
57788
|
-
return;
|
|
57789
|
-
}
|
|
57790
57834
|
const definition = this.fragmentDefinitions[selection.name.value];
|
|
57791
57835
|
if (!definition) {
|
|
57792
57836
|
throw new HoudiniError({
|
|
@@ -57794,23 +57838,25 @@ var FieldCollection = class {
|
|
|
57794
57838
|
message: "Could not find referenced fragment definition: " + selection.name.value + "\n" + JSON.stringify(Object.keys(this.fragmentDefinitions), null, 4)
|
|
57795
57839
|
});
|
|
57796
57840
|
}
|
|
57797
|
-
this.
|
|
57798
|
-
|
|
57799
|
-
|
|
57800
|
-
|
|
57801
|
-
|
|
57802
|
-
|
|
57803
|
-
|
|
57804
|
-
|
|
57841
|
+
if (this.applyFragments || include) {
|
|
57842
|
+
this.add({
|
|
57843
|
+
selection: {
|
|
57844
|
+
kind: "InlineFragment",
|
|
57845
|
+
typeCondition: {
|
|
57846
|
+
kind: "NamedType",
|
|
57847
|
+
name: {
|
|
57848
|
+
kind: "Name",
|
|
57849
|
+
value: definition.typeCondition.name.value
|
|
57850
|
+
}
|
|
57851
|
+
},
|
|
57852
|
+
selectionSet: {
|
|
57853
|
+
kind: "SelectionSet",
|
|
57854
|
+
selections: [...definition.selectionSet.selections]
|
|
57805
57855
|
}
|
|
57806
57856
|
},
|
|
57807
|
-
|
|
57808
|
-
|
|
57809
|
-
|
|
57810
|
-
}
|
|
57811
|
-
},
|
|
57812
|
-
external
|
|
57813
|
-
});
|
|
57857
|
+
external: !include
|
|
57858
|
+
});
|
|
57859
|
+
}
|
|
57814
57860
|
}
|
|
57815
57861
|
}
|
|
57816
57862
|
collectFragmentSpreads(selections, result = {}) {
|
|
@@ -57867,8 +57913,7 @@ var FieldCollection = class {
|
|
|
57867
57913
|
}
|
|
57868
57914
|
walkInlineFragment({
|
|
57869
57915
|
selection,
|
|
57870
|
-
external
|
|
57871
|
-
hoistFragments
|
|
57916
|
+
external
|
|
57872
57917
|
}) {
|
|
57873
57918
|
const key = selection.typeCondition.name.value;
|
|
57874
57919
|
if (!this.inlineFragments[key]) {
|
|
@@ -57878,7 +57923,7 @@ var FieldCollection = class {
|
|
|
57878
57923
|
};
|
|
57879
57924
|
}
|
|
57880
57925
|
for (const subselect of selection.selectionSet.selections || []) {
|
|
57881
|
-
if (subselect.kind === "
|
|
57926
|
+
if (subselect.kind === "Field" || subselect.kind === "InlineFragment" && !subselect.typeCondition) {
|
|
57882
57927
|
this.inlineFragments[key].selection.add({
|
|
57883
57928
|
selection: subselect,
|
|
57884
57929
|
external
|
|
@@ -57887,11 +57932,11 @@ var FieldCollection = class {
|
|
|
57887
57932
|
} else if (subselect.kind === "FragmentSpread") {
|
|
57888
57933
|
this.add({
|
|
57889
57934
|
selection: subselect,
|
|
57890
|
-
external
|
|
57935
|
+
external
|
|
57891
57936
|
});
|
|
57892
57937
|
continue;
|
|
57893
57938
|
} else {
|
|
57894
|
-
this.walkInlineFragment({ selection: subselect, external
|
|
57939
|
+
this.walkInlineFragment({ selection: subselect, external });
|
|
57895
57940
|
}
|
|
57896
57941
|
}
|
|
57897
57942
|
}
|
|
@@ -57901,9 +57946,7 @@ var FieldCollection = class {
|
|
|
57901
57946
|
fragmentDefinitions: this.fragmentDefinitions,
|
|
57902
57947
|
selections: [],
|
|
57903
57948
|
filepath: this.filepath,
|
|
57904
|
-
|
|
57905
|
-
keepFragmentSpreadNodes: this.keepFragmentSpreadNodes,
|
|
57906
|
-
hoistFragments: this.hoistFragments
|
|
57949
|
+
applyFragments: this.applyFragments
|
|
57907
57950
|
});
|
|
57908
57951
|
}
|
|
57909
57952
|
};
|
|
@@ -58832,7 +58875,7 @@ function operationObject({
|
|
|
58832
58875
|
if (operationKind === "insert" || operationKind === "toggle") {
|
|
58833
58876
|
operation.position = position;
|
|
58834
58877
|
}
|
|
58835
|
-
if (operationKind
|
|
58878
|
+
if (allLists && operationKind !== "delete") {
|
|
58836
58879
|
operation.target = "all";
|
|
58837
58880
|
}
|
|
58838
58881
|
if (parentID) {
|
|
@@ -59823,7 +59866,8 @@ function prepareSelection({
|
|
|
59823
59866
|
inConnection,
|
|
59824
59867
|
typeMap,
|
|
59825
59868
|
abstractTypes,
|
|
59826
|
-
globalLoading
|
|
59869
|
+
globalLoading,
|
|
59870
|
+
includeFragments
|
|
59827
59871
|
}) {
|
|
59828
59872
|
let object = {};
|
|
59829
59873
|
const loadingTypes = [];
|
|
@@ -59843,7 +59887,8 @@ function prepareSelection({
|
|
|
59843
59887
|
document,
|
|
59844
59888
|
typeMap,
|
|
59845
59889
|
abstractTypes,
|
|
59846
|
-
globalLoading
|
|
59890
|
+
globalLoading,
|
|
59891
|
+
includeFragments
|
|
59847
59892
|
}).fields || {}
|
|
59848
59893
|
);
|
|
59849
59894
|
} else {
|
|
@@ -59891,7 +59936,8 @@ function prepareSelection({
|
|
|
59891
59936
|
document,
|
|
59892
59937
|
typeMap,
|
|
59893
59938
|
abstractTypes,
|
|
59894
|
-
globalLoading
|
|
59939
|
+
globalLoading,
|
|
59940
|
+
includeFragments
|
|
59895
59941
|
}).fields
|
|
59896
59942
|
};
|
|
59897
59943
|
if (field.directives?.find((d) => d.name.value === config2.loadingDirective)) {
|
|
@@ -60009,7 +60055,8 @@ function prepareSelection({
|
|
|
60009
60055
|
inConnection: connectionState,
|
|
60010
60056
|
typeMap,
|
|
60011
60057
|
abstractTypes,
|
|
60012
|
-
globalLoading: forceLoading
|
|
60058
|
+
globalLoading: forceLoading,
|
|
60059
|
+
includeFragments
|
|
60013
60060
|
});
|
|
60014
60061
|
if (Object.values(fieldObj.selection.fields ?? {}).some((field2) => field2.required)) {
|
|
60015
60062
|
fieldObj.nullable = true;
|
|
@@ -60342,14 +60389,13 @@ function artifactGenerator(stats) {
|
|
|
60342
60389
|
document: doc,
|
|
60343
60390
|
rootType,
|
|
60344
60391
|
globalLoading,
|
|
60392
|
+
includeFragments: doc.kind !== ArtifactKind.Fragment,
|
|
60345
60393
|
selections: flattenSelections({
|
|
60346
60394
|
config: config2,
|
|
60347
60395
|
filepath: doc.filename,
|
|
60348
60396
|
selections: selectionSet.selections,
|
|
60349
60397
|
fragmentDefinitions,
|
|
60350
|
-
|
|
60351
|
-
keepFragmentSpreadNodes: true,
|
|
60352
|
-
hoistFragments: true
|
|
60398
|
+
applyFragments: doc.kind !== ArtifactKind.Fragment
|
|
60353
60399
|
}),
|
|
60354
60400
|
operations: operationsByPath(
|
|
60355
60401
|
config2,
|
|
@@ -61314,8 +61360,7 @@ async function generateDocumentTypes(config2, docs) {
|
|
|
61314
61360
|
config: config2,
|
|
61315
61361
|
filepath: filename,
|
|
61316
61362
|
selections: definition.selectionSet.selections,
|
|
61317
|
-
fragmentDefinitions
|
|
61318
|
-
keepFragmentSpreadNodes: true
|
|
61363
|
+
fragmentDefinitions
|
|
61319
61364
|
});
|
|
61320
61365
|
if (definition?.kind === "OperationDefinition") {
|
|
61321
61366
|
await generateOperationTypeDefs(
|