houdini-svelte 1.0.5 → 1.0.6

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.
@@ -152681,41 +152681,55 @@ async function addID(config22, documents) {
152681
152681
  );
152682
152682
  const field = type.getFields()[node2.name.value];
152683
152683
  const fieldType = unwrapType2(config22, field.type).type;
152684
- if (node2.selectionSet?.selections.length > 0) {
152685
- if (!graphql23.isObjectType(fieldType) && !graphql23.isInterfaceType(fieldType)) {
152686
- return;
152687
- }
152688
- const keyFields = config22.keyFieldsForType(fieldType.name);
152689
- if (keyFields.find((key2) => !fieldType.getFields()[key2])) {
152690
- return;
152691
- }
152692
- const selections = [...node2.selectionSet.selections];
152693
- for (const keyField of keyFields) {
152694
- if (node2.selectionSet.selections.find(
152695
- (selection2) => selection2.kind === "Field" && !selection2.alias && selection2.name.value === keyField
152696
- )) {
152697
- continue;
152698
- }
152699
- selections.push({
152700
- kind: graphql23.Kind.FIELD,
152701
- name: {
152702
- kind: graphql23.Kind.NAME,
152703
- value: keyField
152704
- }
152705
- });
152706
- }
152707
- return {
152708
- ...node2,
152709
- selectionSet: {
152710
- ...node2.selectionSet,
152711
- selections
152712
- }
152713
- };
152684
+ return addKeysToSelection(config22, node2, fieldType);
152685
+ },
152686
+ InlineFragment(node2) {
152687
+ if (!node2.selectionSet || !node2.typeCondition) {
152688
+ return;
152689
+ }
152690
+ const fragmentType = config22.schema.getType(node2.typeCondition.name.value);
152691
+ if (!fragmentType) {
152692
+ return;
152714
152693
  }
152694
+ return addKeysToSelection(config22, node2, fragmentType);
152715
152695
  }
152716
152696
  });
152717
152697
  }
152718
152698
  }
152699
+ function addKeysToSelection(config22, node2, fieldType) {
152700
+ if (!node2.selectionSet || node2.selectionSet.selections.length == 0) {
152701
+ return;
152702
+ }
152703
+ if (!graphql23.isObjectType(fieldType) && !graphql23.isInterfaceType(fieldType)) {
152704
+ return;
152705
+ }
152706
+ const keyFields = config22.keyFieldsForType(fieldType.name);
152707
+ if (keyFields.find((key) => !fieldType.getFields()[key])) {
152708
+ return;
152709
+ }
152710
+ const selections = [...node2.selectionSet.selections];
152711
+ for (const keyField of keyFields) {
152712
+ if (node2.selectionSet.selections.find(
152713
+ (selection2) => selection2.kind === "Field" && !selection2.alias && selection2.name.value === keyField
152714
+ )) {
152715
+ continue;
152716
+ }
152717
+ selections.push({
152718
+ kind: graphql23.Kind.FIELD,
152719
+ name: {
152720
+ kind: graphql23.Kind.NAME,
152721
+ value: keyField
152722
+ }
152723
+ });
152724
+ }
152725
+ return {
152726
+ ...node2,
152727
+ selectionSet: {
152728
+ ...node2.selectionSet,
152729
+ selections
152730
+ }
152731
+ };
152732
+ }
152719
152733
  var graphql24 = __toESM3(require_graphql22(), 1);
152720
152734
  async function typeCheck(config22, docs) {
152721
152735
  const errors = [];
@@ -152672,41 +152672,55 @@ async function addID(config22, documents) {
152672
152672
  );
152673
152673
  const field = type.getFields()[node2.name.value];
152674
152674
  const fieldType = unwrapType2(config22, field.type).type;
152675
- if (node2.selectionSet?.selections.length > 0) {
152676
- if (!graphql23.isObjectType(fieldType) && !graphql23.isInterfaceType(fieldType)) {
152677
- return;
152678
- }
152679
- const keyFields = config22.keyFieldsForType(fieldType.name);
152680
- if (keyFields.find((key2) => !fieldType.getFields()[key2])) {
152681
- return;
152682
- }
152683
- const selections = [...node2.selectionSet.selections];
152684
- for (const keyField of keyFields) {
152685
- if (node2.selectionSet.selections.find(
152686
- (selection2) => selection2.kind === "Field" && !selection2.alias && selection2.name.value === keyField
152687
- )) {
152688
- continue;
152689
- }
152690
- selections.push({
152691
- kind: graphql23.Kind.FIELD,
152692
- name: {
152693
- kind: graphql23.Kind.NAME,
152694
- value: keyField
152695
- }
152696
- });
152697
- }
152698
- return {
152699
- ...node2,
152700
- selectionSet: {
152701
- ...node2.selectionSet,
152702
- selections
152703
- }
152704
- };
152675
+ return addKeysToSelection(config22, node2, fieldType);
152676
+ },
152677
+ InlineFragment(node2) {
152678
+ if (!node2.selectionSet || !node2.typeCondition) {
152679
+ return;
152680
+ }
152681
+ const fragmentType = config22.schema.getType(node2.typeCondition.name.value);
152682
+ if (!fragmentType) {
152683
+ return;
152705
152684
  }
152685
+ return addKeysToSelection(config22, node2, fragmentType);
152706
152686
  }
152707
152687
  });
152708
152688
  }
152709
152689
  }
152690
+ function addKeysToSelection(config22, node2, fieldType) {
152691
+ if (!node2.selectionSet || node2.selectionSet.selections.length == 0) {
152692
+ return;
152693
+ }
152694
+ if (!graphql23.isObjectType(fieldType) && !graphql23.isInterfaceType(fieldType)) {
152695
+ return;
152696
+ }
152697
+ const keyFields = config22.keyFieldsForType(fieldType.name);
152698
+ if (keyFields.find((key) => !fieldType.getFields()[key])) {
152699
+ return;
152700
+ }
152701
+ const selections = [...node2.selectionSet.selections];
152702
+ for (const keyField of keyFields) {
152703
+ if (node2.selectionSet.selections.find(
152704
+ (selection2) => selection2.kind === "Field" && !selection2.alias && selection2.name.value === keyField
152705
+ )) {
152706
+ continue;
152707
+ }
152708
+ selections.push({
152709
+ kind: graphql23.Kind.FIELD,
152710
+ name: {
152711
+ kind: graphql23.Kind.NAME,
152712
+ value: keyField
152713
+ }
152714
+ });
152715
+ }
152716
+ return {
152717
+ ...node2,
152718
+ selectionSet: {
152719
+ ...node2.selectionSet,
152720
+ selections
152721
+ }
152722
+ };
152723
+ }
152710
152724
  var graphql24 = __toESM3(require_graphql22(), 1);
152711
152725
  async function typeCheck(config22, docs) {
152712
152726
  const errors = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "houdini-svelte",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "The svelte plugin for houdini",
5
5
  "keywords": [
6
6
  "typescript",
@@ -32,7 +32,7 @@
32
32
  "rollup": "^3.7.4",
33
33
  "svelte": "^3.55.1",
34
34
  "vite": "^4.1.1",
35
- "houdini": "^1.0.5"
35
+ "houdini": "^1.0.6"
36
36
  },
37
37
  "files": [
38
38
  "build"