houdini 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.
@@ -77125,41 +77125,55 @@ async function addID(config2, documents) {
77125
77125
  );
77126
77126
  const field = type.getFields()[node.name.value];
77127
77127
  const fieldType = unwrapType(config2, field.type).type;
77128
- if (node.selectionSet?.selections.length > 0) {
77129
- if (!graphql24.isObjectType(fieldType) && !graphql24.isInterfaceType(fieldType)) {
77130
- return;
77131
- }
77132
- const keyFields = config2.keyFieldsForType(fieldType.name);
77133
- if (keyFields.find((key2) => !fieldType.getFields()[key2])) {
77134
- return;
77135
- }
77136
- const selections = [...node.selectionSet.selections];
77137
- for (const keyField of keyFields) {
77138
- if (node.selectionSet.selections.find(
77139
- (selection2) => selection2.kind === "Field" && !selection2.alias && selection2.name.value === keyField
77140
- )) {
77141
- continue;
77142
- }
77143
- selections.push({
77144
- kind: graphql24.Kind.FIELD,
77145
- name: {
77146
- kind: graphql24.Kind.NAME,
77147
- value: keyField
77148
- }
77149
- });
77150
- }
77151
- return {
77152
- ...node,
77153
- selectionSet: {
77154
- ...node.selectionSet,
77155
- selections
77156
- }
77157
- };
77128
+ return addKeysToSelection(config2, node, fieldType);
77129
+ },
77130
+ InlineFragment(node) {
77131
+ if (!node.selectionSet || !node.typeCondition) {
77132
+ return;
77133
+ }
77134
+ const fragmentType = config2.schema.getType(node.typeCondition.name.value);
77135
+ if (!fragmentType) {
77136
+ return;
77158
77137
  }
77138
+ return addKeysToSelection(config2, node, fragmentType);
77159
77139
  }
77160
77140
  });
77161
77141
  }
77162
77142
  }
77143
+ function addKeysToSelection(config2, node, fieldType) {
77144
+ if (!node.selectionSet || node.selectionSet.selections.length == 0) {
77145
+ return;
77146
+ }
77147
+ if (!graphql24.isObjectType(fieldType) && !graphql24.isInterfaceType(fieldType)) {
77148
+ return;
77149
+ }
77150
+ const keyFields = config2.keyFieldsForType(fieldType.name);
77151
+ if (keyFields.find((key) => !fieldType.getFields()[key])) {
77152
+ return;
77153
+ }
77154
+ const selections = [...node.selectionSet.selections];
77155
+ for (const keyField of keyFields) {
77156
+ if (node.selectionSet.selections.find(
77157
+ (selection2) => selection2.kind === "Field" && !selection2.alias && selection2.name.value === keyField
77158
+ )) {
77159
+ continue;
77160
+ }
77161
+ selections.push({
77162
+ kind: graphql24.Kind.FIELD,
77163
+ name: {
77164
+ kind: graphql24.Kind.NAME,
77165
+ value: keyField
77166
+ }
77167
+ });
77168
+ }
77169
+ return {
77170
+ ...node,
77171
+ selectionSet: {
77172
+ ...node.selectionSet,
77173
+ selections
77174
+ }
77175
+ };
77176
+ }
77163
77177
 
77164
77178
  // src/codegen/validators/typeCheck.ts
77165
77179
  var graphql25 = __toESM(require_graphql2(), 1);
@@ -78721,8 +78735,8 @@ async function updatePackageJSON(targetPath) {
78721
78735
  }
78722
78736
  packageJSON.devDependencies = {
78723
78737
  ...packageJSON.devDependencies,
78724
- houdini: "^1.0.5",
78725
- "houdini-svelte": "^1.0.5"
78738
+ houdini: "^1.0.6",
78739
+ "houdini-svelte": "^1.0.6"
78726
78740
  };
78727
78741
  await fs_exports.writeFile(packagePath, JSON.stringify(packageJSON, null, 4));
78728
78742
  }
@@ -77130,41 +77130,55 @@ async function addID(config2, documents) {
77130
77130
  );
77131
77131
  const field = type.getFields()[node.name.value];
77132
77132
  const fieldType = unwrapType(config2, field.type).type;
77133
- if (node.selectionSet?.selections.length > 0) {
77134
- if (!graphql24.isObjectType(fieldType) && !graphql24.isInterfaceType(fieldType)) {
77135
- return;
77136
- }
77137
- const keyFields = config2.keyFieldsForType(fieldType.name);
77138
- if (keyFields.find((key2) => !fieldType.getFields()[key2])) {
77139
- return;
77140
- }
77141
- const selections = [...node.selectionSet.selections];
77142
- for (const keyField of keyFields) {
77143
- if (node.selectionSet.selections.find(
77144
- (selection2) => selection2.kind === "Field" && !selection2.alias && selection2.name.value === keyField
77145
- )) {
77146
- continue;
77147
- }
77148
- selections.push({
77149
- kind: graphql24.Kind.FIELD,
77150
- name: {
77151
- kind: graphql24.Kind.NAME,
77152
- value: keyField
77153
- }
77154
- });
77155
- }
77156
- return {
77157
- ...node,
77158
- selectionSet: {
77159
- ...node.selectionSet,
77160
- selections
77161
- }
77162
- };
77133
+ return addKeysToSelection(config2, node, fieldType);
77134
+ },
77135
+ InlineFragment(node) {
77136
+ if (!node.selectionSet || !node.typeCondition) {
77137
+ return;
77138
+ }
77139
+ const fragmentType = config2.schema.getType(node.typeCondition.name.value);
77140
+ if (!fragmentType) {
77141
+ return;
77163
77142
  }
77143
+ return addKeysToSelection(config2, node, fragmentType);
77164
77144
  }
77165
77145
  });
77166
77146
  }
77167
77147
  }
77148
+ function addKeysToSelection(config2, node, fieldType) {
77149
+ if (!node.selectionSet || node.selectionSet.selections.length == 0) {
77150
+ return;
77151
+ }
77152
+ if (!graphql24.isObjectType(fieldType) && !graphql24.isInterfaceType(fieldType)) {
77153
+ return;
77154
+ }
77155
+ const keyFields = config2.keyFieldsForType(fieldType.name);
77156
+ if (keyFields.find((key) => !fieldType.getFields()[key])) {
77157
+ return;
77158
+ }
77159
+ const selections = [...node.selectionSet.selections];
77160
+ for (const keyField of keyFields) {
77161
+ if (node.selectionSet.selections.find(
77162
+ (selection2) => selection2.kind === "Field" && !selection2.alias && selection2.name.value === keyField
77163
+ )) {
77164
+ continue;
77165
+ }
77166
+ selections.push({
77167
+ kind: graphql24.Kind.FIELD,
77168
+ name: {
77169
+ kind: graphql24.Kind.NAME,
77170
+ value: keyField
77171
+ }
77172
+ });
77173
+ }
77174
+ return {
77175
+ ...node,
77176
+ selectionSet: {
77177
+ ...node.selectionSet,
77178
+ selections
77179
+ }
77180
+ };
77181
+ }
77168
77182
 
77169
77183
  // src/codegen/validators/typeCheck.ts
77170
77184
  var graphql25 = __toESM(require_graphql2(), 1);
@@ -78726,8 +78740,8 @@ async function updatePackageJSON(targetPath) {
78726
78740
  }
78727
78741
  packageJSON.devDependencies = {
78728
78742
  ...packageJSON.devDependencies,
78729
- houdini: "^1.0.5",
78730
- "houdini-svelte": "^1.0.5"
78743
+ houdini: "^1.0.6",
78744
+ "houdini-svelte": "^1.0.6"
78731
78745
  };
78732
78746
  await fs_exports.writeFile(packagePath, JSON.stringify(packageJSON, null, 4));
78733
78747
  }
@@ -60878,41 +60878,55 @@ async function addID(config2, documents) {
60878
60878
  );
60879
60879
  const field = type.getFields()[node.name.value];
60880
60880
  const fieldType = unwrapType(config2, field.type).type;
60881
- if (node.selectionSet?.selections.length > 0) {
60882
- if (!graphql23.isObjectType(fieldType) && !graphql23.isInterfaceType(fieldType)) {
60883
- return;
60884
- }
60885
- const keyFields = config2.keyFieldsForType(fieldType.name);
60886
- if (keyFields.find((key2) => !fieldType.getFields()[key2])) {
60887
- return;
60888
- }
60889
- const selections = [...node.selectionSet.selections];
60890
- for (const keyField of keyFields) {
60891
- if (node.selectionSet.selections.find(
60892
- (selection2) => selection2.kind === "Field" && !selection2.alias && selection2.name.value === keyField
60893
- )) {
60894
- continue;
60895
- }
60896
- selections.push({
60897
- kind: graphql23.Kind.FIELD,
60898
- name: {
60899
- kind: graphql23.Kind.NAME,
60900
- value: keyField
60901
- }
60902
- });
60903
- }
60904
- return {
60905
- ...node,
60906
- selectionSet: {
60907
- ...node.selectionSet,
60908
- selections
60909
- }
60910
- };
60881
+ return addKeysToSelection(config2, node, fieldType);
60882
+ },
60883
+ InlineFragment(node) {
60884
+ if (!node.selectionSet || !node.typeCondition) {
60885
+ return;
60886
+ }
60887
+ const fragmentType = config2.schema.getType(node.typeCondition.name.value);
60888
+ if (!fragmentType) {
60889
+ return;
60911
60890
  }
60891
+ return addKeysToSelection(config2, node, fragmentType);
60912
60892
  }
60913
60893
  });
60914
60894
  }
60915
60895
  }
60896
+ function addKeysToSelection(config2, node, fieldType) {
60897
+ if (!node.selectionSet || node.selectionSet.selections.length == 0) {
60898
+ return;
60899
+ }
60900
+ if (!graphql23.isObjectType(fieldType) && !graphql23.isInterfaceType(fieldType)) {
60901
+ return;
60902
+ }
60903
+ const keyFields = config2.keyFieldsForType(fieldType.name);
60904
+ if (keyFields.find((key) => !fieldType.getFields()[key])) {
60905
+ return;
60906
+ }
60907
+ const selections = [...node.selectionSet.selections];
60908
+ for (const keyField of keyFields) {
60909
+ if (node.selectionSet.selections.find(
60910
+ (selection2) => selection2.kind === "Field" && !selection2.alias && selection2.name.value === keyField
60911
+ )) {
60912
+ continue;
60913
+ }
60914
+ selections.push({
60915
+ kind: graphql23.Kind.FIELD,
60916
+ name: {
60917
+ kind: graphql23.Kind.NAME,
60918
+ value: keyField
60919
+ }
60920
+ });
60921
+ }
60922
+ return {
60923
+ ...node,
60924
+ selectionSet: {
60925
+ ...node.selectionSet,
60926
+ selections
60927
+ }
60928
+ };
60929
+ }
60916
60930
 
60917
60931
  // src/codegen/validators/typeCheck.ts
60918
60932
  var graphql24 = __toESM(require_graphql2(), 1);
@@ -60876,41 +60876,55 @@ async function addID(config2, documents) {
60876
60876
  );
60877
60877
  const field = type.getFields()[node.name.value];
60878
60878
  const fieldType = unwrapType(config2, field.type).type;
60879
- if (node.selectionSet?.selections.length > 0) {
60880
- if (!graphql23.isObjectType(fieldType) && !graphql23.isInterfaceType(fieldType)) {
60881
- return;
60882
- }
60883
- const keyFields = config2.keyFieldsForType(fieldType.name);
60884
- if (keyFields.find((key2) => !fieldType.getFields()[key2])) {
60885
- return;
60886
- }
60887
- const selections = [...node.selectionSet.selections];
60888
- for (const keyField of keyFields) {
60889
- if (node.selectionSet.selections.find(
60890
- (selection2) => selection2.kind === "Field" && !selection2.alias && selection2.name.value === keyField
60891
- )) {
60892
- continue;
60893
- }
60894
- selections.push({
60895
- kind: graphql23.Kind.FIELD,
60896
- name: {
60897
- kind: graphql23.Kind.NAME,
60898
- value: keyField
60899
- }
60900
- });
60901
- }
60902
- return {
60903
- ...node,
60904
- selectionSet: {
60905
- ...node.selectionSet,
60906
- selections
60907
- }
60908
- };
60879
+ return addKeysToSelection(config2, node, fieldType);
60880
+ },
60881
+ InlineFragment(node) {
60882
+ if (!node.selectionSet || !node.typeCondition) {
60883
+ return;
60884
+ }
60885
+ const fragmentType = config2.schema.getType(node.typeCondition.name.value);
60886
+ if (!fragmentType) {
60887
+ return;
60909
60888
  }
60889
+ return addKeysToSelection(config2, node, fragmentType);
60910
60890
  }
60911
60891
  });
60912
60892
  }
60913
60893
  }
60894
+ function addKeysToSelection(config2, node, fieldType) {
60895
+ if (!node.selectionSet || node.selectionSet.selections.length == 0) {
60896
+ return;
60897
+ }
60898
+ if (!graphql23.isObjectType(fieldType) && !graphql23.isInterfaceType(fieldType)) {
60899
+ return;
60900
+ }
60901
+ const keyFields = config2.keyFieldsForType(fieldType.name);
60902
+ if (keyFields.find((key) => !fieldType.getFields()[key])) {
60903
+ return;
60904
+ }
60905
+ const selections = [...node.selectionSet.selections];
60906
+ for (const keyField of keyFields) {
60907
+ if (node.selectionSet.selections.find(
60908
+ (selection2) => selection2.kind === "Field" && !selection2.alias && selection2.name.value === keyField
60909
+ )) {
60910
+ continue;
60911
+ }
60912
+ selections.push({
60913
+ kind: graphql23.Kind.FIELD,
60914
+ name: {
60915
+ kind: graphql23.Kind.NAME,
60916
+ value: keyField
60917
+ }
60918
+ });
60919
+ }
60920
+ return {
60921
+ ...node,
60922
+ selectionSet: {
60923
+ ...node.selectionSet,
60924
+ selections
60925
+ }
60926
+ };
60927
+ }
60914
60928
 
60915
60929
  // src/codegen/validators/typeCheck.ts
60916
60930
  var graphql24 = __toESM(require_graphql2(), 1);
@@ -61199,41 +61199,55 @@ async function addID(config2, documents) {
61199
61199
  );
61200
61200
  const field = type.getFields()[node.name.value];
61201
61201
  const fieldType = unwrapType(config2, field.type).type;
61202
- if (node.selectionSet?.selections.length > 0) {
61203
- if (!graphql22.isObjectType(fieldType) && !graphql22.isInterfaceType(fieldType)) {
61204
- return;
61205
- }
61206
- const keyFields = config2.keyFieldsForType(fieldType.name);
61207
- if (keyFields.find((key2) => !fieldType.getFields()[key2])) {
61208
- return;
61209
- }
61210
- const selections = [...node.selectionSet.selections];
61211
- for (const keyField of keyFields) {
61212
- if (node.selectionSet.selections.find(
61213
- (selection2) => selection2.kind === "Field" && !selection2.alias && selection2.name.value === keyField
61214
- )) {
61215
- continue;
61216
- }
61217
- selections.push({
61218
- kind: graphql22.Kind.FIELD,
61219
- name: {
61220
- kind: graphql22.Kind.NAME,
61221
- value: keyField
61222
- }
61223
- });
61224
- }
61225
- return {
61226
- ...node,
61227
- selectionSet: {
61228
- ...node.selectionSet,
61229
- selections
61230
- }
61231
- };
61202
+ return addKeysToSelection(config2, node, fieldType);
61203
+ },
61204
+ InlineFragment(node) {
61205
+ if (!node.selectionSet || !node.typeCondition) {
61206
+ return;
61207
+ }
61208
+ const fragmentType = config2.schema.getType(node.typeCondition.name.value);
61209
+ if (!fragmentType) {
61210
+ return;
61232
61211
  }
61212
+ return addKeysToSelection(config2, node, fragmentType);
61233
61213
  }
61234
61214
  });
61235
61215
  }
61236
61216
  }
61217
+ function addKeysToSelection(config2, node, fieldType) {
61218
+ if (!node.selectionSet || node.selectionSet.selections.length == 0) {
61219
+ return;
61220
+ }
61221
+ if (!graphql22.isObjectType(fieldType) && !graphql22.isInterfaceType(fieldType)) {
61222
+ return;
61223
+ }
61224
+ const keyFields = config2.keyFieldsForType(fieldType.name);
61225
+ if (keyFields.find((key) => !fieldType.getFields()[key])) {
61226
+ return;
61227
+ }
61228
+ const selections = [...node.selectionSet.selections];
61229
+ for (const keyField of keyFields) {
61230
+ if (node.selectionSet.selections.find(
61231
+ (selection2) => selection2.kind === "Field" && !selection2.alias && selection2.name.value === keyField
61232
+ )) {
61233
+ continue;
61234
+ }
61235
+ selections.push({
61236
+ kind: graphql22.Kind.FIELD,
61237
+ name: {
61238
+ kind: graphql22.Kind.NAME,
61239
+ value: keyField
61240
+ }
61241
+ });
61242
+ }
61243
+ return {
61244
+ ...node,
61245
+ selectionSet: {
61246
+ ...node.selectionSet,
61247
+ selections
61248
+ }
61249
+ };
61250
+ }
61237
61251
 
61238
61252
  // src/codegen/validators/typeCheck.ts
61239
61253
  var graphql23 = __toESM(require_graphql2(), 1);
@@ -61194,41 +61194,55 @@ async function addID(config2, documents) {
61194
61194
  );
61195
61195
  const field = type.getFields()[node.name.value];
61196
61196
  const fieldType = unwrapType(config2, field.type).type;
61197
- if (node.selectionSet?.selections.length > 0) {
61198
- if (!graphql22.isObjectType(fieldType) && !graphql22.isInterfaceType(fieldType)) {
61199
- return;
61200
- }
61201
- const keyFields = config2.keyFieldsForType(fieldType.name);
61202
- if (keyFields.find((key2) => !fieldType.getFields()[key2])) {
61203
- return;
61204
- }
61205
- const selections = [...node.selectionSet.selections];
61206
- for (const keyField of keyFields) {
61207
- if (node.selectionSet.selections.find(
61208
- (selection2) => selection2.kind === "Field" && !selection2.alias && selection2.name.value === keyField
61209
- )) {
61210
- continue;
61211
- }
61212
- selections.push({
61213
- kind: graphql22.Kind.FIELD,
61214
- name: {
61215
- kind: graphql22.Kind.NAME,
61216
- value: keyField
61217
- }
61218
- });
61219
- }
61220
- return {
61221
- ...node,
61222
- selectionSet: {
61223
- ...node.selectionSet,
61224
- selections
61225
- }
61226
- };
61197
+ return addKeysToSelection(config2, node, fieldType);
61198
+ },
61199
+ InlineFragment(node) {
61200
+ if (!node.selectionSet || !node.typeCondition) {
61201
+ return;
61202
+ }
61203
+ const fragmentType = config2.schema.getType(node.typeCondition.name.value);
61204
+ if (!fragmentType) {
61205
+ return;
61227
61206
  }
61207
+ return addKeysToSelection(config2, node, fragmentType);
61228
61208
  }
61229
61209
  });
61230
61210
  }
61231
61211
  }
61212
+ function addKeysToSelection(config2, node, fieldType) {
61213
+ if (!node.selectionSet || node.selectionSet.selections.length == 0) {
61214
+ return;
61215
+ }
61216
+ if (!graphql22.isObjectType(fieldType) && !graphql22.isInterfaceType(fieldType)) {
61217
+ return;
61218
+ }
61219
+ const keyFields = config2.keyFieldsForType(fieldType.name);
61220
+ if (keyFields.find((key) => !fieldType.getFields()[key])) {
61221
+ return;
61222
+ }
61223
+ const selections = [...node.selectionSet.selections];
61224
+ for (const keyField of keyFields) {
61225
+ if (node.selectionSet.selections.find(
61226
+ (selection2) => selection2.kind === "Field" && !selection2.alias && selection2.name.value === keyField
61227
+ )) {
61228
+ continue;
61229
+ }
61230
+ selections.push({
61231
+ kind: graphql22.Kind.FIELD,
61232
+ name: {
61233
+ kind: graphql22.Kind.NAME,
61234
+ value: keyField
61235
+ }
61236
+ });
61237
+ }
61238
+ return {
61239
+ ...node,
61240
+ selectionSet: {
61241
+ ...node.selectionSet,
61242
+ selections
61243
+ }
61244
+ };
61245
+ }
61232
61246
 
61233
61247
  // src/codegen/validators/typeCheck.ts
61234
61248
  var graphql23 = __toESM(require_graphql2(), 1);
@@ -73989,41 +73989,55 @@ async function addID(config4, documents) {
73989
73989
  );
73990
73990
  const field = type.getFields()[node.name.value];
73991
73991
  const fieldType = unwrapType(config4, field.type).type;
73992
- if (node.selectionSet?.selections.length > 0) {
73993
- if (!graphql24.isObjectType(fieldType) && !graphql24.isInterfaceType(fieldType)) {
73994
- return;
73995
- }
73996
- const keyFields = config4.keyFieldsForType(fieldType.name);
73997
- if (keyFields.find((key2) => !fieldType.getFields()[key2])) {
73998
- return;
73999
- }
74000
- const selections = [...node.selectionSet.selections];
74001
- for (const keyField of keyFields) {
74002
- if (node.selectionSet.selections.find(
74003
- (selection2) => selection2.kind === "Field" && !selection2.alias && selection2.name.value === keyField
74004
- )) {
74005
- continue;
74006
- }
74007
- selections.push({
74008
- kind: graphql24.Kind.FIELD,
74009
- name: {
74010
- kind: graphql24.Kind.NAME,
74011
- value: keyField
74012
- }
74013
- });
74014
- }
74015
- return {
74016
- ...node,
74017
- selectionSet: {
74018
- ...node.selectionSet,
74019
- selections
74020
- }
74021
- };
73992
+ return addKeysToSelection(config4, node, fieldType);
73993
+ },
73994
+ InlineFragment(node) {
73995
+ if (!node.selectionSet || !node.typeCondition) {
73996
+ return;
73997
+ }
73998
+ const fragmentType = config4.schema.getType(node.typeCondition.name.value);
73999
+ if (!fragmentType) {
74000
+ return;
74022
74001
  }
74002
+ return addKeysToSelection(config4, node, fragmentType);
74023
74003
  }
74024
74004
  });
74025
74005
  }
74026
74006
  }
74007
+ function addKeysToSelection(config4, node, fieldType) {
74008
+ if (!node.selectionSet || node.selectionSet.selections.length == 0) {
74009
+ return;
74010
+ }
74011
+ if (!graphql24.isObjectType(fieldType) && !graphql24.isInterfaceType(fieldType)) {
74012
+ return;
74013
+ }
74014
+ const keyFields = config4.keyFieldsForType(fieldType.name);
74015
+ if (keyFields.find((key) => !fieldType.getFields()[key])) {
74016
+ return;
74017
+ }
74018
+ const selections = [...node.selectionSet.selections];
74019
+ for (const keyField of keyFields) {
74020
+ if (node.selectionSet.selections.find(
74021
+ (selection2) => selection2.kind === "Field" && !selection2.alias && selection2.name.value === keyField
74022
+ )) {
74023
+ continue;
74024
+ }
74025
+ selections.push({
74026
+ kind: graphql24.Kind.FIELD,
74027
+ name: {
74028
+ kind: graphql24.Kind.NAME,
74029
+ value: keyField
74030
+ }
74031
+ });
74032
+ }
74033
+ return {
74034
+ ...node,
74035
+ selectionSet: {
74036
+ ...node.selectionSet,
74037
+ selections
74038
+ }
74039
+ };
74040
+ }
74027
74041
 
74028
74042
  // src/codegen/validators/typeCheck.ts
74029
74043
  var graphql25 = __toESM(require_graphql2(), 1);
@@ -73983,41 +73983,55 @@ async function addID(config4, documents) {
73983
73983
  );
73984
73984
  const field = type.getFields()[node.name.value];
73985
73985
  const fieldType = unwrapType(config4, field.type).type;
73986
- if (node.selectionSet?.selections.length > 0) {
73987
- if (!graphql24.isObjectType(fieldType) && !graphql24.isInterfaceType(fieldType)) {
73988
- return;
73989
- }
73990
- const keyFields = config4.keyFieldsForType(fieldType.name);
73991
- if (keyFields.find((key2) => !fieldType.getFields()[key2])) {
73992
- return;
73993
- }
73994
- const selections = [...node.selectionSet.selections];
73995
- for (const keyField of keyFields) {
73996
- if (node.selectionSet.selections.find(
73997
- (selection2) => selection2.kind === "Field" && !selection2.alias && selection2.name.value === keyField
73998
- )) {
73999
- continue;
74000
- }
74001
- selections.push({
74002
- kind: graphql24.Kind.FIELD,
74003
- name: {
74004
- kind: graphql24.Kind.NAME,
74005
- value: keyField
74006
- }
74007
- });
74008
- }
74009
- return {
74010
- ...node,
74011
- selectionSet: {
74012
- ...node.selectionSet,
74013
- selections
74014
- }
74015
- };
73986
+ return addKeysToSelection(config4, node, fieldType);
73987
+ },
73988
+ InlineFragment(node) {
73989
+ if (!node.selectionSet || !node.typeCondition) {
73990
+ return;
73991
+ }
73992
+ const fragmentType = config4.schema.getType(node.typeCondition.name.value);
73993
+ if (!fragmentType) {
73994
+ return;
74016
73995
  }
73996
+ return addKeysToSelection(config4, node, fragmentType);
74017
73997
  }
74018
73998
  });
74019
73999
  }
74020
74000
  }
74001
+ function addKeysToSelection(config4, node, fieldType) {
74002
+ if (!node.selectionSet || node.selectionSet.selections.length == 0) {
74003
+ return;
74004
+ }
74005
+ if (!graphql24.isObjectType(fieldType) && !graphql24.isInterfaceType(fieldType)) {
74006
+ return;
74007
+ }
74008
+ const keyFields = config4.keyFieldsForType(fieldType.name);
74009
+ if (keyFields.find((key) => !fieldType.getFields()[key])) {
74010
+ return;
74011
+ }
74012
+ const selections = [...node.selectionSet.selections];
74013
+ for (const keyField of keyFields) {
74014
+ if (node.selectionSet.selections.find(
74015
+ (selection2) => selection2.kind === "Field" && !selection2.alias && selection2.name.value === keyField
74016
+ )) {
74017
+ continue;
74018
+ }
74019
+ selections.push({
74020
+ kind: graphql24.Kind.FIELD,
74021
+ name: {
74022
+ kind: graphql24.Kind.NAME,
74023
+ value: keyField
74024
+ }
74025
+ });
74026
+ }
74027
+ return {
74028
+ ...node,
74029
+ selectionSet: {
74030
+ ...node.selectionSet,
74031
+ selections
74032
+ }
74033
+ };
74034
+ }
74021
74035
 
74022
74036
  // src/codegen/validators/typeCheck.ts
74023
74037
  var graphql25 = __toESM(require_graphql2(), 1);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "houdini",
3
- "version": "1.0.5",
3
+ "version": "1.0.6",
4
4
  "description": "The disappearing GraphQL clients",
5
5
  "keywords": [
6
6
  "typescript",