houdini 1.2.0 → 1.2.2
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 +83 -68
- package/build/cmd-esm/index.js +83 -68
- package/build/codegen/generators/artifacts/selection.d.ts +2 -1
- package/build/codegen/utils/flattenSelections.d.ts +2 -3
- package/build/codegen-cjs/index.js +81 -66
- package/build/codegen-esm/index.js +81 -66
- package/build/lib-cjs/index.js +1 -1
- package/build/lib-esm/index.js +1 -1
- package/build/test-cjs/index.js +83 -66
- package/build/test-esm/index.js +83 -66
- package/build/vite-cjs/index.js +81 -66
- package/build/vite-esm/index.js +81 -66
- package/package.json +1 -1
package/build/cmd-cjs/index.js
CHANGED
|
@@ -73332,7 +73332,7 @@ function deepMerge2(filepath, ...targets) {
|
|
|
73332
73332
|
// src/lib/parse.ts
|
|
73333
73333
|
async function parseJS(str, config2) {
|
|
73334
73334
|
const defaultConfig = {
|
|
73335
|
-
plugins: ["typescript", "importAssertions"
|
|
73335
|
+
plugins: ["typescript", "importAssertions"],
|
|
73336
73336
|
sourceType: "module"
|
|
73337
73337
|
};
|
|
73338
73338
|
return (0, import_parser.parse)(str || "", config2 ? deepMerge2("", defaultConfig, config2) : defaultConfig).program;
|
|
@@ -73672,16 +73672,14 @@ function flattenSelections({
|
|
|
73672
73672
|
filepath,
|
|
73673
73673
|
selections,
|
|
73674
73674
|
fragmentDefinitions,
|
|
73675
|
-
|
|
73676
|
-
keepFragmentSpreadNodes
|
|
73675
|
+
applyFragments
|
|
73677
73676
|
}) {
|
|
73678
73677
|
const fields = new FieldCollection({
|
|
73679
73678
|
config: config2,
|
|
73680
73679
|
filepath,
|
|
73681
73680
|
selections,
|
|
73682
73681
|
fragmentDefinitions,
|
|
73683
|
-
|
|
73684
|
-
keepFragmentSpreadNodes: !!keepFragmentSpreadNodes
|
|
73682
|
+
applyFragments: !!applyFragments
|
|
73685
73683
|
});
|
|
73686
73684
|
return fields.toSelectionSet();
|
|
73687
73685
|
}
|
|
@@ -73692,25 +73690,36 @@ var FieldCollection = class {
|
|
|
73692
73690
|
fields;
|
|
73693
73691
|
inlineFragments;
|
|
73694
73692
|
fragmentSpreads;
|
|
73695
|
-
|
|
73696
|
-
keepFragmentSpreadNodes;
|
|
73693
|
+
applyFragments;
|
|
73697
73694
|
constructor(args) {
|
|
73698
73695
|
this.config = args.config;
|
|
73699
73696
|
this.fragmentDefinitions = args.fragmentDefinitions;
|
|
73700
|
-
this.
|
|
73701
|
-
this.keepFragmentSpreadNodes = args.keepFragmentSpreadNodes;
|
|
73697
|
+
this.applyFragments = args.applyFragments;
|
|
73702
73698
|
this.fields = {};
|
|
73703
73699
|
this.inlineFragments = {};
|
|
73704
73700
|
this.fragmentSpreads = {};
|
|
73705
73701
|
this.filepath = args.filepath;
|
|
73706
73702
|
for (const selection of args.selections) {
|
|
73707
|
-
this.add(selection);
|
|
73703
|
+
this.add({ selection });
|
|
73708
73704
|
}
|
|
73709
73705
|
}
|
|
73710
73706
|
get size() {
|
|
73711
73707
|
return Object.keys(this.fields).length + Object.keys(this.inlineFragments).length + Object.keys(this.fragmentSpreads).length;
|
|
73712
73708
|
}
|
|
73713
|
-
add(selection) {
|
|
73709
|
+
add({ selection, external }) {
|
|
73710
|
+
let include = this.config.defaultFragmentMasking === "disable";
|
|
73711
|
+
const maskEnableDirective = selection.directives?.find(
|
|
73712
|
+
({ name }) => name.value === this.config.maskEnableDirective
|
|
73713
|
+
);
|
|
73714
|
+
if (maskEnableDirective) {
|
|
73715
|
+
include = false;
|
|
73716
|
+
}
|
|
73717
|
+
const maskDisableDirective = selection.directives?.find(
|
|
73718
|
+
({ name }) => name.value === this.config.maskDisableDirective
|
|
73719
|
+
);
|
|
73720
|
+
if (maskDisableDirective) {
|
|
73721
|
+
include = true;
|
|
73722
|
+
}
|
|
73714
73723
|
if (selection.kind === "Field") {
|
|
73715
73724
|
const key = selection.alias?.value || selection.name.value;
|
|
73716
73725
|
if (!this.fields[key]) {
|
|
@@ -73720,46 +73729,32 @@ var FieldCollection = class {
|
|
|
73720
73729
|
};
|
|
73721
73730
|
}
|
|
73722
73731
|
for (const subselect of selection.selectionSet?.selections || []) {
|
|
73723
|
-
this.fields[key].selection.add(
|
|
73732
|
+
this.fields[key].selection.add({
|
|
73733
|
+
selection: subselect,
|
|
73734
|
+
external
|
|
73735
|
+
});
|
|
73736
|
+
}
|
|
73737
|
+
if (this.applyFragments && !external) {
|
|
73738
|
+
this.fields[key].selection.fragmentSpreads = {
|
|
73739
|
+
...this.collectFragmentSpreads(selection.selectionSet?.selections ?? []),
|
|
73740
|
+
...this.fields[key].selection.fragmentSpreads
|
|
73741
|
+
};
|
|
73724
73742
|
}
|
|
73725
|
-
this.fields[key].selection.fragmentSpreads = {
|
|
73726
|
-
...this.collectFragmentSpreads(selection.selectionSet?.selections ?? []),
|
|
73727
|
-
...this.fields[key].selection.fragmentSpreads
|
|
73728
|
-
};
|
|
73729
73743
|
return;
|
|
73730
73744
|
}
|
|
73731
73745
|
if (selection.kind === "InlineFragment" && !selection.typeCondition) {
|
|
73732
73746
|
for (const subselect of selection.selectionSet.selections) {
|
|
73733
|
-
this.add(subselect);
|
|
73747
|
+
this.add({ selection: subselect, external });
|
|
73734
73748
|
}
|
|
73735
73749
|
}
|
|
73736
73750
|
if (selection.kind === "InlineFragment" && selection.typeCondition) {
|
|
73737
|
-
this.walkInlineFragment(selection);
|
|
73751
|
+
this.walkInlineFragment({ selection, external });
|
|
73738
73752
|
return;
|
|
73739
73753
|
}
|
|
73740
73754
|
if (selection.kind === "FragmentSpread") {
|
|
73741
|
-
|
|
73742
|
-
const maskEnableDirective = selection.directives?.find(
|
|
73743
|
-
({ name }) => name.value === this.config.maskEnableDirective
|
|
73744
|
-
);
|
|
73745
|
-
if (maskEnableDirective) {
|
|
73746
|
-
includeFragments = false;
|
|
73747
|
-
}
|
|
73748
|
-
const maskDisableDirective = selection.directives?.find(
|
|
73749
|
-
({ name }) => name.value === this.config.maskDisableDirective
|
|
73750
|
-
);
|
|
73751
|
-
if (maskDisableDirective) {
|
|
73752
|
-
includeFragments = true;
|
|
73753
|
-
}
|
|
73754
|
-
if (this.ignoreMaskDisable) {
|
|
73755
|
-
includeFragments = true;
|
|
73756
|
-
}
|
|
73757
|
-
if (this.keepFragmentSpreadNodes) {
|
|
73755
|
+
if (!external || include) {
|
|
73758
73756
|
this.fragmentSpreads[selection.name.value] = selection;
|
|
73759
73757
|
}
|
|
73760
|
-
if (!includeFragments) {
|
|
73761
|
-
return;
|
|
73762
|
-
}
|
|
73763
73758
|
const definition = this.fragmentDefinitions[selection.name.value];
|
|
73764
73759
|
if (!definition) {
|
|
73765
73760
|
throw new HoudiniError({
|
|
@@ -73767,20 +73762,25 @@ var FieldCollection = class {
|
|
|
73767
73762
|
message: "Could not find referenced fragment definition: " + selection.name.value + "\n" + JSON.stringify(Object.keys(this.fragmentDefinitions), null, 4)
|
|
73768
73763
|
});
|
|
73769
73764
|
}
|
|
73770
|
-
this.
|
|
73771
|
-
|
|
73772
|
-
|
|
73773
|
-
|
|
73774
|
-
|
|
73775
|
-
|
|
73776
|
-
|
|
73777
|
-
|
|
73778
|
-
|
|
73779
|
-
|
|
73780
|
-
|
|
73781
|
-
|
|
73782
|
-
|
|
73783
|
-
|
|
73765
|
+
if (this.applyFragments || include) {
|
|
73766
|
+
this.add({
|
|
73767
|
+
selection: {
|
|
73768
|
+
kind: "InlineFragment",
|
|
73769
|
+
typeCondition: {
|
|
73770
|
+
kind: "NamedType",
|
|
73771
|
+
name: {
|
|
73772
|
+
kind: "Name",
|
|
73773
|
+
value: definition.typeCondition.name.value
|
|
73774
|
+
}
|
|
73775
|
+
},
|
|
73776
|
+
selectionSet: {
|
|
73777
|
+
kind: "SelectionSet",
|
|
73778
|
+
selections: [...definition.selectionSet.selections]
|
|
73779
|
+
}
|
|
73780
|
+
},
|
|
73781
|
+
external: !include
|
|
73782
|
+
});
|
|
73783
|
+
}
|
|
73784
73784
|
}
|
|
73785
73785
|
}
|
|
73786
73786
|
collectFragmentSpreads(selections, result = {}) {
|
|
@@ -73835,7 +73835,10 @@ var FieldCollection = class {
|
|
|
73835
73835
|
})
|
|
73836
73836
|
);
|
|
73837
73837
|
}
|
|
73838
|
-
walkInlineFragment(
|
|
73838
|
+
walkInlineFragment({
|
|
73839
|
+
selection,
|
|
73840
|
+
external
|
|
73841
|
+
}) {
|
|
73839
73842
|
const key = selection.typeCondition.name.value;
|
|
73840
73843
|
if (!this.inlineFragments[key]) {
|
|
73841
73844
|
this.inlineFragments[key] = {
|
|
@@ -73844,11 +73847,21 @@ var FieldCollection = class {
|
|
|
73844
73847
|
};
|
|
73845
73848
|
}
|
|
73846
73849
|
for (const subselect of selection.selectionSet.selections || []) {
|
|
73847
|
-
if (subselect.kind
|
|
73848
|
-
this.inlineFragments[key].selection.add(
|
|
73850
|
+
if (subselect.kind === "Field" || subselect.kind === "InlineFragment" && !subselect.typeCondition) {
|
|
73851
|
+
this.inlineFragments[key].selection.add({
|
|
73852
|
+
selection: subselect,
|
|
73853
|
+
external
|
|
73854
|
+
});
|
|
73855
|
+
continue;
|
|
73856
|
+
} else if (subselect.kind === "FragmentSpread") {
|
|
73857
|
+
this.add({
|
|
73858
|
+
selection: subselect,
|
|
73859
|
+
external
|
|
73860
|
+
});
|
|
73849
73861
|
continue;
|
|
73862
|
+
} else {
|
|
73863
|
+
this.walkInlineFragment({ selection: subselect, external });
|
|
73850
73864
|
}
|
|
73851
|
-
this.walkInlineFragment(subselect);
|
|
73852
73865
|
}
|
|
73853
73866
|
}
|
|
73854
73867
|
empty() {
|
|
@@ -73857,8 +73870,7 @@ var FieldCollection = class {
|
|
|
73857
73870
|
fragmentDefinitions: this.fragmentDefinitions,
|
|
73858
73871
|
selections: [],
|
|
73859
73872
|
filepath: this.filepath,
|
|
73860
|
-
|
|
73861
|
-
keepFragmentSpreadNodes: this.keepFragmentSpreadNodes
|
|
73873
|
+
applyFragments: this.applyFragments
|
|
73862
73874
|
});
|
|
73863
73875
|
}
|
|
73864
73876
|
};
|
|
@@ -75778,7 +75790,8 @@ function prepareSelection({
|
|
|
75778
75790
|
inConnection,
|
|
75779
75791
|
typeMap,
|
|
75780
75792
|
abstractTypes,
|
|
75781
|
-
globalLoading
|
|
75793
|
+
globalLoading,
|
|
75794
|
+
includeFragments
|
|
75782
75795
|
}) {
|
|
75783
75796
|
let object = {};
|
|
75784
75797
|
const loadingTypes = [];
|
|
@@ -75798,7 +75811,8 @@ function prepareSelection({
|
|
|
75798
75811
|
document,
|
|
75799
75812
|
typeMap,
|
|
75800
75813
|
abstractTypes,
|
|
75801
|
-
globalLoading
|
|
75814
|
+
globalLoading,
|
|
75815
|
+
includeFragments
|
|
75802
75816
|
}).fields || {}
|
|
75803
75817
|
);
|
|
75804
75818
|
} else {
|
|
@@ -75846,7 +75860,8 @@ function prepareSelection({
|
|
|
75846
75860
|
document,
|
|
75847
75861
|
typeMap,
|
|
75848
75862
|
abstractTypes,
|
|
75849
|
-
globalLoading
|
|
75863
|
+
globalLoading,
|
|
75864
|
+
includeFragments
|
|
75850
75865
|
}).fields
|
|
75851
75866
|
};
|
|
75852
75867
|
if (field.directives?.find((d) => d.name.value === config2.loadingDirective)) {
|
|
@@ -75964,7 +75979,8 @@ function prepareSelection({
|
|
|
75964
75979
|
inConnection: connectionState,
|
|
75965
75980
|
typeMap,
|
|
75966
75981
|
abstractTypes,
|
|
75967
|
-
globalLoading: forceLoading
|
|
75982
|
+
globalLoading: forceLoading,
|
|
75983
|
+
includeFragments
|
|
75968
75984
|
});
|
|
75969
75985
|
if (Object.values(fieldObj.selection.fields ?? {}).some((field2) => field2.required)) {
|
|
75970
75986
|
fieldObj.nullable = true;
|
|
@@ -76297,13 +76313,13 @@ function artifactGenerator(stats) {
|
|
|
76297
76313
|
document: doc,
|
|
76298
76314
|
rootType,
|
|
76299
76315
|
globalLoading,
|
|
76316
|
+
includeFragments: doc.kind !== ArtifactKind.Fragment,
|
|
76300
76317
|
selections: flattenSelections({
|
|
76301
76318
|
config: config2,
|
|
76302
76319
|
filepath: doc.filename,
|
|
76303
76320
|
selections: selectionSet.selections,
|
|
76304
76321
|
fragmentDefinitions,
|
|
76305
|
-
|
|
76306
|
-
keepFragmentSpreadNodes: true
|
|
76322
|
+
applyFragments: doc.kind !== ArtifactKind.Fragment
|
|
76307
76323
|
}),
|
|
76308
76324
|
operations: operationsByPath(
|
|
76309
76325
|
config2,
|
|
@@ -77268,8 +77284,7 @@ async function generateDocumentTypes(config2, docs) {
|
|
|
77268
77284
|
config: config2,
|
|
77269
77285
|
filepath: filename,
|
|
77270
77286
|
selections: definition.selectionSet.selections,
|
|
77271
|
-
fragmentDefinitions
|
|
77272
|
-
keepFragmentSpreadNodes: true
|
|
77287
|
+
fragmentDefinitions
|
|
77273
77288
|
});
|
|
77274
77289
|
if (definition?.kind === "OperationDefinition") {
|
|
77275
77290
|
await generateOperationTypeDefs(
|
|
@@ -80039,8 +80054,8 @@ async function updatePackageJSON(targetPath) {
|
|
|
80039
80054
|
}
|
|
80040
80055
|
packageJSON.devDependencies = {
|
|
80041
80056
|
...packageJSON.devDependencies,
|
|
80042
|
-
houdini: "^1.2.
|
|
80043
|
-
"houdini-svelte": "^1.2.
|
|
80057
|
+
houdini: "^1.2.2",
|
|
80058
|
+
"houdini-svelte": "^1.2.2"
|
|
80044
80059
|
};
|
|
80045
80060
|
await fs_exports.writeFile(packagePath, JSON.stringify(packageJSON, null, 4));
|
|
80046
80061
|
}
|
package/build/cmd-esm/index.js
CHANGED
|
@@ -73337,7 +73337,7 @@ function deepMerge2(filepath, ...targets) {
|
|
|
73337
73337
|
// src/lib/parse.ts
|
|
73338
73338
|
async function parseJS(str, config2) {
|
|
73339
73339
|
const defaultConfig = {
|
|
73340
|
-
plugins: ["typescript", "importAssertions"
|
|
73340
|
+
plugins: ["typescript", "importAssertions"],
|
|
73341
73341
|
sourceType: "module"
|
|
73342
73342
|
};
|
|
73343
73343
|
return (0, import_parser.parse)(str || "", config2 ? deepMerge2("", defaultConfig, config2) : defaultConfig).program;
|
|
@@ -73677,16 +73677,14 @@ function flattenSelections({
|
|
|
73677
73677
|
filepath,
|
|
73678
73678
|
selections,
|
|
73679
73679
|
fragmentDefinitions,
|
|
73680
|
-
|
|
73681
|
-
keepFragmentSpreadNodes
|
|
73680
|
+
applyFragments
|
|
73682
73681
|
}) {
|
|
73683
73682
|
const fields = new FieldCollection({
|
|
73684
73683
|
config: config2,
|
|
73685
73684
|
filepath,
|
|
73686
73685
|
selections,
|
|
73687
73686
|
fragmentDefinitions,
|
|
73688
|
-
|
|
73689
|
-
keepFragmentSpreadNodes: !!keepFragmentSpreadNodes
|
|
73687
|
+
applyFragments: !!applyFragments
|
|
73690
73688
|
});
|
|
73691
73689
|
return fields.toSelectionSet();
|
|
73692
73690
|
}
|
|
@@ -73697,25 +73695,36 @@ var FieldCollection = class {
|
|
|
73697
73695
|
fields;
|
|
73698
73696
|
inlineFragments;
|
|
73699
73697
|
fragmentSpreads;
|
|
73700
|
-
|
|
73701
|
-
keepFragmentSpreadNodes;
|
|
73698
|
+
applyFragments;
|
|
73702
73699
|
constructor(args) {
|
|
73703
73700
|
this.config = args.config;
|
|
73704
73701
|
this.fragmentDefinitions = args.fragmentDefinitions;
|
|
73705
|
-
this.
|
|
73706
|
-
this.keepFragmentSpreadNodes = args.keepFragmentSpreadNodes;
|
|
73702
|
+
this.applyFragments = args.applyFragments;
|
|
73707
73703
|
this.fields = {};
|
|
73708
73704
|
this.inlineFragments = {};
|
|
73709
73705
|
this.fragmentSpreads = {};
|
|
73710
73706
|
this.filepath = args.filepath;
|
|
73711
73707
|
for (const selection of args.selections) {
|
|
73712
|
-
this.add(selection);
|
|
73708
|
+
this.add({ selection });
|
|
73713
73709
|
}
|
|
73714
73710
|
}
|
|
73715
73711
|
get size() {
|
|
73716
73712
|
return Object.keys(this.fields).length + Object.keys(this.inlineFragments).length + Object.keys(this.fragmentSpreads).length;
|
|
73717
73713
|
}
|
|
73718
|
-
add(selection) {
|
|
73714
|
+
add({ selection, external }) {
|
|
73715
|
+
let include = this.config.defaultFragmentMasking === "disable";
|
|
73716
|
+
const maskEnableDirective = selection.directives?.find(
|
|
73717
|
+
({ name }) => name.value === this.config.maskEnableDirective
|
|
73718
|
+
);
|
|
73719
|
+
if (maskEnableDirective) {
|
|
73720
|
+
include = false;
|
|
73721
|
+
}
|
|
73722
|
+
const maskDisableDirective = selection.directives?.find(
|
|
73723
|
+
({ name }) => name.value === this.config.maskDisableDirective
|
|
73724
|
+
);
|
|
73725
|
+
if (maskDisableDirective) {
|
|
73726
|
+
include = true;
|
|
73727
|
+
}
|
|
73719
73728
|
if (selection.kind === "Field") {
|
|
73720
73729
|
const key = selection.alias?.value || selection.name.value;
|
|
73721
73730
|
if (!this.fields[key]) {
|
|
@@ -73725,46 +73734,32 @@ var FieldCollection = class {
|
|
|
73725
73734
|
};
|
|
73726
73735
|
}
|
|
73727
73736
|
for (const subselect of selection.selectionSet?.selections || []) {
|
|
73728
|
-
this.fields[key].selection.add(
|
|
73737
|
+
this.fields[key].selection.add({
|
|
73738
|
+
selection: subselect,
|
|
73739
|
+
external
|
|
73740
|
+
});
|
|
73741
|
+
}
|
|
73742
|
+
if (this.applyFragments && !external) {
|
|
73743
|
+
this.fields[key].selection.fragmentSpreads = {
|
|
73744
|
+
...this.collectFragmentSpreads(selection.selectionSet?.selections ?? []),
|
|
73745
|
+
...this.fields[key].selection.fragmentSpreads
|
|
73746
|
+
};
|
|
73729
73747
|
}
|
|
73730
|
-
this.fields[key].selection.fragmentSpreads = {
|
|
73731
|
-
...this.collectFragmentSpreads(selection.selectionSet?.selections ?? []),
|
|
73732
|
-
...this.fields[key].selection.fragmentSpreads
|
|
73733
|
-
};
|
|
73734
73748
|
return;
|
|
73735
73749
|
}
|
|
73736
73750
|
if (selection.kind === "InlineFragment" && !selection.typeCondition) {
|
|
73737
73751
|
for (const subselect of selection.selectionSet.selections) {
|
|
73738
|
-
this.add(subselect);
|
|
73752
|
+
this.add({ selection: subselect, external });
|
|
73739
73753
|
}
|
|
73740
73754
|
}
|
|
73741
73755
|
if (selection.kind === "InlineFragment" && selection.typeCondition) {
|
|
73742
|
-
this.walkInlineFragment(selection);
|
|
73756
|
+
this.walkInlineFragment({ selection, external });
|
|
73743
73757
|
return;
|
|
73744
73758
|
}
|
|
73745
73759
|
if (selection.kind === "FragmentSpread") {
|
|
73746
|
-
|
|
73747
|
-
const maskEnableDirective = selection.directives?.find(
|
|
73748
|
-
({ name }) => name.value === this.config.maskEnableDirective
|
|
73749
|
-
);
|
|
73750
|
-
if (maskEnableDirective) {
|
|
73751
|
-
includeFragments = false;
|
|
73752
|
-
}
|
|
73753
|
-
const maskDisableDirective = selection.directives?.find(
|
|
73754
|
-
({ name }) => name.value === this.config.maskDisableDirective
|
|
73755
|
-
);
|
|
73756
|
-
if (maskDisableDirective) {
|
|
73757
|
-
includeFragments = true;
|
|
73758
|
-
}
|
|
73759
|
-
if (this.ignoreMaskDisable) {
|
|
73760
|
-
includeFragments = true;
|
|
73761
|
-
}
|
|
73762
|
-
if (this.keepFragmentSpreadNodes) {
|
|
73760
|
+
if (!external || include) {
|
|
73763
73761
|
this.fragmentSpreads[selection.name.value] = selection;
|
|
73764
73762
|
}
|
|
73765
|
-
if (!includeFragments) {
|
|
73766
|
-
return;
|
|
73767
|
-
}
|
|
73768
73763
|
const definition = this.fragmentDefinitions[selection.name.value];
|
|
73769
73764
|
if (!definition) {
|
|
73770
73765
|
throw new HoudiniError({
|
|
@@ -73772,20 +73767,25 @@ var FieldCollection = class {
|
|
|
73772
73767
|
message: "Could not find referenced fragment definition: " + selection.name.value + "\n" + JSON.stringify(Object.keys(this.fragmentDefinitions), null, 4)
|
|
73773
73768
|
});
|
|
73774
73769
|
}
|
|
73775
|
-
this.
|
|
73776
|
-
|
|
73777
|
-
|
|
73778
|
-
|
|
73779
|
-
|
|
73780
|
-
|
|
73781
|
-
|
|
73782
|
-
|
|
73783
|
-
|
|
73784
|
-
|
|
73785
|
-
|
|
73786
|
-
|
|
73787
|
-
|
|
73788
|
-
|
|
73770
|
+
if (this.applyFragments || include) {
|
|
73771
|
+
this.add({
|
|
73772
|
+
selection: {
|
|
73773
|
+
kind: "InlineFragment",
|
|
73774
|
+
typeCondition: {
|
|
73775
|
+
kind: "NamedType",
|
|
73776
|
+
name: {
|
|
73777
|
+
kind: "Name",
|
|
73778
|
+
value: definition.typeCondition.name.value
|
|
73779
|
+
}
|
|
73780
|
+
},
|
|
73781
|
+
selectionSet: {
|
|
73782
|
+
kind: "SelectionSet",
|
|
73783
|
+
selections: [...definition.selectionSet.selections]
|
|
73784
|
+
}
|
|
73785
|
+
},
|
|
73786
|
+
external: !include
|
|
73787
|
+
});
|
|
73788
|
+
}
|
|
73789
73789
|
}
|
|
73790
73790
|
}
|
|
73791
73791
|
collectFragmentSpreads(selections, result = {}) {
|
|
@@ -73840,7 +73840,10 @@ var FieldCollection = class {
|
|
|
73840
73840
|
})
|
|
73841
73841
|
);
|
|
73842
73842
|
}
|
|
73843
|
-
walkInlineFragment(
|
|
73843
|
+
walkInlineFragment({
|
|
73844
|
+
selection,
|
|
73845
|
+
external
|
|
73846
|
+
}) {
|
|
73844
73847
|
const key = selection.typeCondition.name.value;
|
|
73845
73848
|
if (!this.inlineFragments[key]) {
|
|
73846
73849
|
this.inlineFragments[key] = {
|
|
@@ -73849,11 +73852,21 @@ var FieldCollection = class {
|
|
|
73849
73852
|
};
|
|
73850
73853
|
}
|
|
73851
73854
|
for (const subselect of selection.selectionSet.selections || []) {
|
|
73852
|
-
if (subselect.kind
|
|
73853
|
-
this.inlineFragments[key].selection.add(
|
|
73855
|
+
if (subselect.kind === "Field" || subselect.kind === "InlineFragment" && !subselect.typeCondition) {
|
|
73856
|
+
this.inlineFragments[key].selection.add({
|
|
73857
|
+
selection: subselect,
|
|
73858
|
+
external
|
|
73859
|
+
});
|
|
73860
|
+
continue;
|
|
73861
|
+
} else if (subselect.kind === "FragmentSpread") {
|
|
73862
|
+
this.add({
|
|
73863
|
+
selection: subselect,
|
|
73864
|
+
external
|
|
73865
|
+
});
|
|
73854
73866
|
continue;
|
|
73867
|
+
} else {
|
|
73868
|
+
this.walkInlineFragment({ selection: subselect, external });
|
|
73855
73869
|
}
|
|
73856
|
-
this.walkInlineFragment(subselect);
|
|
73857
73870
|
}
|
|
73858
73871
|
}
|
|
73859
73872
|
empty() {
|
|
@@ -73862,8 +73875,7 @@ var FieldCollection = class {
|
|
|
73862
73875
|
fragmentDefinitions: this.fragmentDefinitions,
|
|
73863
73876
|
selections: [],
|
|
73864
73877
|
filepath: this.filepath,
|
|
73865
|
-
|
|
73866
|
-
keepFragmentSpreadNodes: this.keepFragmentSpreadNodes
|
|
73878
|
+
applyFragments: this.applyFragments
|
|
73867
73879
|
});
|
|
73868
73880
|
}
|
|
73869
73881
|
};
|
|
@@ -75783,7 +75795,8 @@ function prepareSelection({
|
|
|
75783
75795
|
inConnection,
|
|
75784
75796
|
typeMap,
|
|
75785
75797
|
abstractTypes,
|
|
75786
|
-
globalLoading
|
|
75798
|
+
globalLoading,
|
|
75799
|
+
includeFragments
|
|
75787
75800
|
}) {
|
|
75788
75801
|
let object = {};
|
|
75789
75802
|
const loadingTypes = [];
|
|
@@ -75803,7 +75816,8 @@ function prepareSelection({
|
|
|
75803
75816
|
document,
|
|
75804
75817
|
typeMap,
|
|
75805
75818
|
abstractTypes,
|
|
75806
|
-
globalLoading
|
|
75819
|
+
globalLoading,
|
|
75820
|
+
includeFragments
|
|
75807
75821
|
}).fields || {}
|
|
75808
75822
|
);
|
|
75809
75823
|
} else {
|
|
@@ -75851,7 +75865,8 @@ function prepareSelection({
|
|
|
75851
75865
|
document,
|
|
75852
75866
|
typeMap,
|
|
75853
75867
|
abstractTypes,
|
|
75854
|
-
globalLoading
|
|
75868
|
+
globalLoading,
|
|
75869
|
+
includeFragments
|
|
75855
75870
|
}).fields
|
|
75856
75871
|
};
|
|
75857
75872
|
if (field.directives?.find((d) => d.name.value === config2.loadingDirective)) {
|
|
@@ -75969,7 +75984,8 @@ function prepareSelection({
|
|
|
75969
75984
|
inConnection: connectionState,
|
|
75970
75985
|
typeMap,
|
|
75971
75986
|
abstractTypes,
|
|
75972
|
-
globalLoading: forceLoading
|
|
75987
|
+
globalLoading: forceLoading,
|
|
75988
|
+
includeFragments
|
|
75973
75989
|
});
|
|
75974
75990
|
if (Object.values(fieldObj.selection.fields ?? {}).some((field2) => field2.required)) {
|
|
75975
75991
|
fieldObj.nullable = true;
|
|
@@ -76302,13 +76318,13 @@ function artifactGenerator(stats) {
|
|
|
76302
76318
|
document: doc,
|
|
76303
76319
|
rootType,
|
|
76304
76320
|
globalLoading,
|
|
76321
|
+
includeFragments: doc.kind !== ArtifactKind.Fragment,
|
|
76305
76322
|
selections: flattenSelections({
|
|
76306
76323
|
config: config2,
|
|
76307
76324
|
filepath: doc.filename,
|
|
76308
76325
|
selections: selectionSet.selections,
|
|
76309
76326
|
fragmentDefinitions,
|
|
76310
|
-
|
|
76311
|
-
keepFragmentSpreadNodes: true
|
|
76327
|
+
applyFragments: doc.kind !== ArtifactKind.Fragment
|
|
76312
76328
|
}),
|
|
76313
76329
|
operations: operationsByPath(
|
|
76314
76330
|
config2,
|
|
@@ -77273,8 +77289,7 @@ async function generateDocumentTypes(config2, docs) {
|
|
|
77273
77289
|
config: config2,
|
|
77274
77290
|
filepath: filename,
|
|
77275
77291
|
selections: definition.selectionSet.selections,
|
|
77276
|
-
fragmentDefinitions
|
|
77277
|
-
keepFragmentSpreadNodes: true
|
|
77292
|
+
fragmentDefinitions
|
|
77278
77293
|
});
|
|
77279
77294
|
if (definition?.kind === "OperationDefinition") {
|
|
77280
77295
|
await generateOperationTypeDefs(
|
|
@@ -80044,8 +80059,8 @@ async function updatePackageJSON(targetPath) {
|
|
|
80044
80059
|
}
|
|
80045
80060
|
packageJSON.devDependencies = {
|
|
80046
80061
|
...packageJSON.devDependencies,
|
|
80047
|
-
houdini: "^1.2.
|
|
80048
|
-
"houdini-svelte": "^1.2.
|
|
80062
|
+
houdini: "^1.2.2",
|
|
80063
|
+
"houdini-svelte": "^1.2.2"
|
|
80049
80064
|
};
|
|
80050
80065
|
await fs_exports.writeFile(packagePath, JSON.stringify(packageJSON, null, 4));
|
|
80051
80066
|
}
|
|
@@ -2,7 +2,7 @@ import * as graphql from 'graphql';
|
|
|
2
2
|
import type { Config, Document } from '../../../lib';
|
|
3
3
|
import { type MutationOperation, type SubscriptionSelection } from '../../../runtime/lib/types';
|
|
4
4
|
export default function (args: Omit<Parameters<typeof prepareSelection>[0], 'typeMap' | 'abstractTypes'>): SubscriptionSelection;
|
|
5
|
-
declare function prepareSelection({ config, filepath, rootType, selections, operations, path, document, inConnection, typeMap, abstractTypes, globalLoading, }: {
|
|
5
|
+
declare function prepareSelection({ config, filepath, rootType, selections, operations, path, document, inConnection, typeMap, abstractTypes, globalLoading, includeFragments, }: {
|
|
6
6
|
config: Config;
|
|
7
7
|
filepath: string;
|
|
8
8
|
rootType: string;
|
|
@@ -16,5 +16,6 @@ declare function prepareSelection({ config, filepath, rootType, selections, oper
|
|
|
16
16
|
typeMap: Record<string, string[]>;
|
|
17
17
|
abstractTypes: string[];
|
|
18
18
|
globalLoading?: boolean;
|
|
19
|
+
includeFragments?: boolean;
|
|
19
20
|
}): SubscriptionSelection;
|
|
20
21
|
export {};
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
import type graphql from 'graphql';
|
|
2
2
|
import type { Config } from '../../lib';
|
|
3
|
-
export declare function flattenSelections({ config, filepath, selections, fragmentDefinitions,
|
|
3
|
+
export declare function flattenSelections({ config, filepath, selections, fragmentDefinitions, applyFragments, }: {
|
|
4
4
|
config: Config;
|
|
5
5
|
filepath: string;
|
|
6
6
|
selections: readonly graphql.SelectionNode[];
|
|
7
7
|
fragmentDefinitions: {
|
|
8
8
|
[name: string]: graphql.FragmentDefinitionNode;
|
|
9
9
|
};
|
|
10
|
-
|
|
11
|
-
keepFragmentSpreadNodes?: boolean;
|
|
10
|
+
applyFragments?: boolean;
|
|
12
11
|
}): readonly graphql.SelectionNode[];
|