houdini 1.0.4 → 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.
@@ -71407,9 +71407,7 @@ var CacheInternal = class {
71407
71407
  let targetSelection = getFieldsForType(selection2, data["__typename"]);
71408
71408
  for (const [field, value] of Object.entries(data)) {
71409
71409
  if (!selection2 || !targetSelection[field]) {
71410
- throw new Error(
71411
- "Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection2)
71412
- );
71410
+ continue;
71413
71411
  }
71414
71412
  let {
71415
71413
  type: linkedType,
@@ -77127,41 +77125,55 @@ async function addID(config2, documents) {
77127
77125
  );
77128
77126
  const field = type.getFields()[node.name.value];
77129
77127
  const fieldType = unwrapType(config2, field.type).type;
77130
- if (node.selectionSet?.selections.length > 0) {
77131
- if (!graphql24.isObjectType(fieldType) && !graphql24.isInterfaceType(fieldType)) {
77132
- return;
77133
- }
77134
- const keyFields = config2.keyFieldsForType(fieldType.name);
77135
- if (keyFields.find((key2) => !fieldType.getFields()[key2])) {
77136
- return;
77137
- }
77138
- const selections = [...node.selectionSet.selections];
77139
- for (const keyField of keyFields) {
77140
- if (node.selectionSet.selections.find(
77141
- (selection2) => selection2.kind === "Field" && !selection2.alias && selection2.name.value === keyField
77142
- )) {
77143
- continue;
77144
- }
77145
- selections.push({
77146
- kind: graphql24.Kind.FIELD,
77147
- name: {
77148
- kind: graphql24.Kind.NAME,
77149
- value: keyField
77150
- }
77151
- });
77152
- }
77153
- return {
77154
- ...node,
77155
- selectionSet: {
77156
- ...node.selectionSet,
77157
- selections
77158
- }
77159
- };
77128
+ return addKeysToSelection(config2, node, fieldType);
77129
+ },
77130
+ InlineFragment(node) {
77131
+ if (!node.selectionSet || !node.typeCondition) {
77132
+ return;
77160
77133
  }
77134
+ const fragmentType = config2.schema.getType(node.typeCondition.name.value);
77135
+ if (!fragmentType) {
77136
+ return;
77137
+ }
77138
+ return addKeysToSelection(config2, node, fragmentType);
77161
77139
  }
77162
77140
  });
77163
77141
  }
77164
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
+ }
77165
77177
 
77166
77178
  // src/codegen/validators/typeCheck.ts
77167
77179
  var graphql25 = __toESM(require_graphql2(), 1);
@@ -78723,8 +78735,8 @@ async function updatePackageJSON(targetPath) {
78723
78735
  }
78724
78736
  packageJSON.devDependencies = {
78725
78737
  ...packageJSON.devDependencies,
78726
- houdini: "^1.0.4",
78727
- "houdini-svelte": "^1.0.4"
78738
+ houdini: "^1.0.6",
78739
+ "houdini-svelte": "^1.0.6"
78728
78740
  };
78729
78741
  await fs_exports.writeFile(packagePath, JSON.stringify(packageJSON, null, 4));
78730
78742
  }
@@ -71413,9 +71413,7 @@ var CacheInternal = class {
71413
71413
  let targetSelection = getFieldsForType(selection2, data["__typename"]);
71414
71414
  for (const [field, value] of Object.entries(data)) {
71415
71415
  if (!selection2 || !targetSelection[field]) {
71416
- throw new Error(
71417
- "Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection2)
71418
- );
71416
+ continue;
71419
71417
  }
71420
71418
  let {
71421
71419
  type: linkedType,
@@ -77132,41 +77130,55 @@ async function addID(config2, documents) {
77132
77130
  );
77133
77131
  const field = type.getFields()[node.name.value];
77134
77132
  const fieldType = unwrapType(config2, field.type).type;
77135
- if (node.selectionSet?.selections.length > 0) {
77136
- if (!graphql24.isObjectType(fieldType) && !graphql24.isInterfaceType(fieldType)) {
77137
- return;
77138
- }
77139
- const keyFields = config2.keyFieldsForType(fieldType.name);
77140
- if (keyFields.find((key2) => !fieldType.getFields()[key2])) {
77141
- return;
77142
- }
77143
- const selections = [...node.selectionSet.selections];
77144
- for (const keyField of keyFields) {
77145
- if (node.selectionSet.selections.find(
77146
- (selection2) => selection2.kind === "Field" && !selection2.alias && selection2.name.value === keyField
77147
- )) {
77148
- continue;
77149
- }
77150
- selections.push({
77151
- kind: graphql24.Kind.FIELD,
77152
- name: {
77153
- kind: graphql24.Kind.NAME,
77154
- value: keyField
77155
- }
77156
- });
77157
- }
77158
- return {
77159
- ...node,
77160
- selectionSet: {
77161
- ...node.selectionSet,
77162
- selections
77163
- }
77164
- };
77133
+ return addKeysToSelection(config2, node, fieldType);
77134
+ },
77135
+ InlineFragment(node) {
77136
+ if (!node.selectionSet || !node.typeCondition) {
77137
+ return;
77165
77138
  }
77139
+ const fragmentType = config2.schema.getType(node.typeCondition.name.value);
77140
+ if (!fragmentType) {
77141
+ return;
77142
+ }
77143
+ return addKeysToSelection(config2, node, fragmentType);
77166
77144
  }
77167
77145
  });
77168
77146
  }
77169
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
+ }
77170
77182
 
77171
77183
  // src/codegen/validators/typeCheck.ts
77172
77184
  var graphql25 = __toESM(require_graphql2(), 1);
@@ -78728,8 +78740,8 @@ async function updatePackageJSON(targetPath) {
78728
78740
  }
78729
78741
  packageJSON.devDependencies = {
78730
78742
  ...packageJSON.devDependencies,
78731
- houdini: "^1.0.4",
78732
- "houdini-svelte": "^1.0.4"
78743
+ houdini: "^1.0.6",
78744
+ "houdini-svelte": "^1.0.6"
78733
78745
  };
78734
78746
  await fs_exports.writeFile(packagePath, JSON.stringify(packageJSON, null, 4));
78735
78747
  }
@@ -55885,9 +55885,7 @@ var CacheInternal = class {
55885
55885
  let targetSelection = getFieldsForType(selection2, data["__typename"]);
55886
55886
  for (const [field, value] of Object.entries(data)) {
55887
55887
  if (!selection2 || !targetSelection[field]) {
55888
- throw new Error(
55889
- "Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection2)
55890
- );
55888
+ continue;
55891
55889
  }
55892
55890
  let {
55893
55891
  type: linkedType,
@@ -60880,40 +60878,54 @@ async function addID(config2, documents) {
60880
60878
  );
60881
60879
  const field = type.getFields()[node.name.value];
60882
60880
  const fieldType = unwrapType(config2, field.type).type;
60883
- if (node.selectionSet?.selections.length > 0) {
60884
- if (!graphql23.isObjectType(fieldType) && !graphql23.isInterfaceType(fieldType)) {
60885
- return;
60886
- }
60887
- const keyFields = config2.keyFieldsForType(fieldType.name);
60888
- if (keyFields.find((key2) => !fieldType.getFields()[key2])) {
60889
- return;
60890
- }
60891
- const selections = [...node.selectionSet.selections];
60892
- for (const keyField of keyFields) {
60893
- if (node.selectionSet.selections.find(
60894
- (selection2) => selection2.kind === "Field" && !selection2.alias && selection2.name.value === keyField
60895
- )) {
60896
- continue;
60897
- }
60898
- selections.push({
60899
- kind: graphql23.Kind.FIELD,
60900
- name: {
60901
- kind: graphql23.Kind.NAME,
60902
- value: keyField
60903
- }
60904
- });
60905
- }
60906
- return {
60907
- ...node,
60908
- selectionSet: {
60909
- ...node.selectionSet,
60910
- selections
60911
- }
60912
- };
60881
+ return addKeysToSelection(config2, node, fieldType);
60882
+ },
60883
+ InlineFragment(node) {
60884
+ if (!node.selectionSet || !node.typeCondition) {
60885
+ return;
60913
60886
  }
60887
+ const fragmentType = config2.schema.getType(node.typeCondition.name.value);
60888
+ if (!fragmentType) {
60889
+ return;
60890
+ }
60891
+ return addKeysToSelection(config2, node, fragmentType);
60892
+ }
60893
+ });
60894
+ }
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
60914
60919
  }
60915
60920
  });
60916
60921
  }
60922
+ return {
60923
+ ...node,
60924
+ selectionSet: {
60925
+ ...node.selectionSet,
60926
+ selections
60927
+ }
60928
+ };
60917
60929
  }
60918
60930
 
60919
60931
  // src/codegen/validators/typeCheck.ts
@@ -55884,9 +55884,7 @@ var CacheInternal = class {
55884
55884
  let targetSelection = getFieldsForType(selection2, data["__typename"]);
55885
55885
  for (const [field, value] of Object.entries(data)) {
55886
55886
  if (!selection2 || !targetSelection[field]) {
55887
- throw new Error(
55888
- "Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection2)
55889
- );
55887
+ continue;
55890
55888
  }
55891
55889
  let {
55892
55890
  type: linkedType,
@@ -60878,40 +60876,54 @@ async function addID(config2, documents) {
60878
60876
  );
60879
60877
  const field = type.getFields()[node.name.value];
60880
60878
  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
- };
60879
+ return addKeysToSelection(config2, node, fieldType);
60880
+ },
60881
+ InlineFragment(node) {
60882
+ if (!node.selectionSet || !node.typeCondition) {
60883
+ return;
60911
60884
  }
60885
+ const fragmentType = config2.schema.getType(node.typeCondition.name.value);
60886
+ if (!fragmentType) {
60887
+ return;
60888
+ }
60889
+ return addKeysToSelection(config2, node, fragmentType);
60890
+ }
60891
+ });
60892
+ }
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
60912
60917
  }
60913
60918
  });
60914
60919
  }
60920
+ return {
60921
+ ...node,
60922
+ selectionSet: {
60923
+ ...node.selectionSet,
60924
+ selections
60925
+ }
60926
+ };
60915
60927
  }
60916
60928
 
60917
60929
  // src/codegen/validators/typeCheck.ts
@@ -64941,9 +64941,7 @@ var CacheInternal = class {
64941
64941
  let targetSelection = getFieldsForType(selection, data["__typename"]);
64942
64942
  for (const [field, value] of Object.entries(data)) {
64943
64943
  if (!selection || !targetSelection[field]) {
64944
- throw new Error(
64945
- "Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection)
64946
- );
64944
+ continue;
64947
64945
  }
64948
64946
  let {
64949
64947
  type: linkedType,
@@ -65498,7 +65496,7 @@ var cachePolicy = ({
65498
65496
  stale: value.stale
65499
65497
  });
65500
65498
  }
65501
- if (useCache && !value.partial && !value.stale) {
65499
+ if (useCache && !value.partial && !value.stale && ctx.policy !== "CacheAndNetwork") {
65502
65500
  return;
65503
65501
  }
65504
65502
  }
@@ -65723,6 +65721,7 @@ function subscription(factory) {
65723
65721
  },
65724
65722
  cleanup() {
65725
65723
  clearSubscription?.();
65724
+ check = null;
65726
65725
  }
65727
65726
  };
65728
65727
  });
@@ -64890,9 +64890,7 @@ var CacheInternal = class {
64890
64890
  let targetSelection = getFieldsForType(selection, data["__typename"]);
64891
64891
  for (const [field, value] of Object.entries(data)) {
64892
64892
  if (!selection || !targetSelection[field]) {
64893
- throw new Error(
64894
- "Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection)
64895
- );
64893
+ continue;
64896
64894
  }
64897
64895
  let {
64898
64896
  type: linkedType,
@@ -65447,7 +65445,7 @@ var cachePolicy = ({
65447
65445
  stale: value.stale
65448
65446
  });
65449
65447
  }
65450
- if (useCache && !value.partial && !value.stale) {
65448
+ if (useCache && !value.partial && !value.stale && ctx.policy !== "CacheAndNetwork") {
65451
65449
  return;
65452
65450
  }
65453
65451
  }
@@ -65672,6 +65670,7 @@ function subscription(factory) {
65672
65670
  },
65673
65671
  cleanup() {
65674
65672
  clearSubscription?.();
65673
+ check = null;
65675
65674
  }
65676
65675
  };
65677
65676
  });
@@ -201,9 +201,7 @@ class CacheInternal {
201
201
  let targetSelection = (0, import_selection.getFieldsForType)(selection, data["__typename"]);
202
202
  for (const [field, value] of Object.entries(data)) {
203
203
  if (!selection || !targetSelection[field]) {
204
- throw new Error(
205
- "Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection)
206
- );
204
+ continue;
207
205
  }
208
206
  let {
209
207
  type: linkedType,
@@ -68,7 +68,7 @@ const cachePolicy = ({
68
68
  stale: value.stale
69
69
  });
70
70
  }
71
- if (useCache && !value.partial && !value.stale) {
71
+ if (useCache && !value.partial && !value.stale && ctx.policy !== "CacheAndNetwork") {
72
72
  return;
73
73
  }
74
74
  }
@@ -89,6 +89,7 @@ function subscription(factory) {
89
89
  },
90
90
  cleanup() {
91
91
  clearSubscription?.();
92
+ check = null;
92
93
  }
93
94
  };
94
95
  });
@@ -177,9 +177,7 @@ class CacheInternal {
177
177
  let targetSelection = getFieldsForType(selection, data["__typename"]);
178
178
  for (const [field, value] of Object.entries(data)) {
179
179
  if (!selection || !targetSelection[field]) {
180
- throw new Error(
181
- "Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection)
182
- );
180
+ continue;
183
181
  }
184
182
  let {
185
183
  type: linkedType,
@@ -39,7 +39,7 @@ const cachePolicy = ({
39
39
  stale: value.stale
40
40
  });
41
41
  }
42
- if (useCache && !value.partial && !value.stale) {
42
+ if (useCache && !value.partial && !value.stale && ctx.policy !== "CacheAndNetwork") {
43
43
  return;
44
44
  }
45
45
  }
@@ -66,6 +66,7 @@ function subscription(factory) {
66
66
  },
67
67
  cleanup() {
68
68
  clearSubscription?.();
69
+ check = null;
69
70
  }
70
71
  };
71
72
  });
@@ -55889,9 +55889,7 @@ var CacheInternal = class {
55889
55889
  let targetSelection = getFieldsForType(selection2, data["__typename"]);
55890
55890
  for (const [field, value] of Object.entries(data)) {
55891
55891
  if (!selection2 || !targetSelection[field]) {
55892
- throw new Error(
55893
- "Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection2)
55894
- );
55892
+ continue;
55895
55893
  }
55896
55894
  let {
55897
55895
  type: linkedType,
@@ -61201,40 +61199,54 @@ async function addID(config2, documents) {
61201
61199
  );
61202
61200
  const field = type.getFields()[node.name.value];
61203
61201
  const fieldType = unwrapType(config2, field.type).type;
61204
- if (node.selectionSet?.selections.length > 0) {
61205
- if (!graphql22.isObjectType(fieldType) && !graphql22.isInterfaceType(fieldType)) {
61206
- return;
61207
- }
61208
- const keyFields = config2.keyFieldsForType(fieldType.name);
61209
- if (keyFields.find((key2) => !fieldType.getFields()[key2])) {
61210
- return;
61211
- }
61212
- const selections = [...node.selectionSet.selections];
61213
- for (const keyField of keyFields) {
61214
- if (node.selectionSet.selections.find(
61215
- (selection2) => selection2.kind === "Field" && !selection2.alias && selection2.name.value === keyField
61216
- )) {
61217
- continue;
61218
- }
61219
- selections.push({
61220
- kind: graphql22.Kind.FIELD,
61221
- name: {
61222
- kind: graphql22.Kind.NAME,
61223
- value: keyField
61224
- }
61225
- });
61226
- }
61227
- return {
61228
- ...node,
61229
- selectionSet: {
61230
- ...node.selectionSet,
61231
- selections
61232
- }
61233
- };
61202
+ return addKeysToSelection(config2, node, fieldType);
61203
+ },
61204
+ InlineFragment(node) {
61205
+ if (!node.selectionSet || !node.typeCondition) {
61206
+ return;
61234
61207
  }
61208
+ const fragmentType = config2.schema.getType(node.typeCondition.name.value);
61209
+ if (!fragmentType) {
61210
+ return;
61211
+ }
61212
+ return addKeysToSelection(config2, node, fragmentType);
61213
+ }
61214
+ });
61215
+ }
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
61235
61240
  }
61236
61241
  });
61237
61242
  }
61243
+ return {
61244
+ ...node,
61245
+ selectionSet: {
61246
+ ...node.selectionSet,
61247
+ selections
61248
+ }
61249
+ };
61238
61250
  }
61239
61251
 
61240
61252
  // src/codegen/validators/typeCheck.ts
@@ -55885,9 +55885,7 @@ var CacheInternal = class {
55885
55885
  let targetSelection = getFieldsForType(selection2, data["__typename"]);
55886
55886
  for (const [field, value] of Object.entries(data)) {
55887
55887
  if (!selection2 || !targetSelection[field]) {
55888
- throw new Error(
55889
- "Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection2)
55890
- );
55888
+ continue;
55891
55889
  }
55892
55890
  let {
55893
55891
  type: linkedType,
@@ -61196,40 +61194,54 @@ async function addID(config2, documents) {
61196
61194
  );
61197
61195
  const field = type.getFields()[node.name.value];
61198
61196
  const fieldType = unwrapType(config2, field.type).type;
61199
- if (node.selectionSet?.selections.length > 0) {
61200
- if (!graphql22.isObjectType(fieldType) && !graphql22.isInterfaceType(fieldType)) {
61201
- return;
61202
- }
61203
- const keyFields = config2.keyFieldsForType(fieldType.name);
61204
- if (keyFields.find((key2) => !fieldType.getFields()[key2])) {
61205
- return;
61206
- }
61207
- const selections = [...node.selectionSet.selections];
61208
- for (const keyField of keyFields) {
61209
- if (node.selectionSet.selections.find(
61210
- (selection2) => selection2.kind === "Field" && !selection2.alias && selection2.name.value === keyField
61211
- )) {
61212
- continue;
61213
- }
61214
- selections.push({
61215
- kind: graphql22.Kind.FIELD,
61216
- name: {
61217
- kind: graphql22.Kind.NAME,
61218
- value: keyField
61219
- }
61220
- });
61221
- }
61222
- return {
61223
- ...node,
61224
- selectionSet: {
61225
- ...node.selectionSet,
61226
- selections
61227
- }
61228
- };
61197
+ return addKeysToSelection(config2, node, fieldType);
61198
+ },
61199
+ InlineFragment(node) {
61200
+ if (!node.selectionSet || !node.typeCondition) {
61201
+ return;
61229
61202
  }
61203
+ const fragmentType = config2.schema.getType(node.typeCondition.name.value);
61204
+ if (!fragmentType) {
61205
+ return;
61206
+ }
61207
+ return addKeysToSelection(config2, node, fragmentType);
61208
+ }
61209
+ });
61210
+ }
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
61230
61235
  }
61231
61236
  });
61232
61237
  }
61238
+ return {
61239
+ ...node,
61240
+ selectionSet: {
61241
+ ...node.selectionSet,
61242
+ selections
61243
+ }
61244
+ };
61233
61245
  }
61234
61246
 
61235
61247
  // src/codegen/validators/typeCheck.ts
@@ -68272,9 +68272,7 @@ var CacheInternal = class {
68272
68272
  let targetSelection = getFieldsForType(selection2, data["__typename"]);
68273
68273
  for (const [field, value] of Object.entries(data)) {
68274
68274
  if (!selection2 || !targetSelection[field]) {
68275
- throw new Error(
68276
- "Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection2)
68277
- );
68275
+ continue;
68278
68276
  }
68279
68277
  let {
68280
68278
  type: linkedType,
@@ -73991,41 +73989,55 @@ async function addID(config4, documents) {
73991
73989
  );
73992
73990
  const field = type.getFields()[node.name.value];
73993
73991
  const fieldType = unwrapType(config4, field.type).type;
73994
- if (node.selectionSet?.selections.length > 0) {
73995
- if (!graphql24.isObjectType(fieldType) && !graphql24.isInterfaceType(fieldType)) {
73996
- return;
73997
- }
73998
- const keyFields = config4.keyFieldsForType(fieldType.name);
73999
- if (keyFields.find((key2) => !fieldType.getFields()[key2])) {
74000
- return;
74001
- }
74002
- const selections = [...node.selectionSet.selections];
74003
- for (const keyField of keyFields) {
74004
- if (node.selectionSet.selections.find(
74005
- (selection2) => selection2.kind === "Field" && !selection2.alias && selection2.name.value === keyField
74006
- )) {
74007
- continue;
74008
- }
74009
- selections.push({
74010
- kind: graphql24.Kind.FIELD,
74011
- name: {
74012
- kind: graphql24.Kind.NAME,
74013
- value: keyField
74014
- }
74015
- });
74016
- }
74017
- return {
74018
- ...node,
74019
- selectionSet: {
74020
- ...node.selectionSet,
74021
- selections
74022
- }
74023
- };
73992
+ return addKeysToSelection(config4, node, fieldType);
73993
+ },
73994
+ InlineFragment(node) {
73995
+ if (!node.selectionSet || !node.typeCondition) {
73996
+ return;
74024
73997
  }
73998
+ const fragmentType = config4.schema.getType(node.typeCondition.name.value);
73999
+ if (!fragmentType) {
74000
+ return;
74001
+ }
74002
+ return addKeysToSelection(config4, node, fragmentType);
74025
74003
  }
74026
74004
  });
74027
74005
  }
74028
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
+ }
74029
74041
 
74030
74042
  // src/codegen/validators/typeCheck.ts
74031
74043
  var graphql25 = __toESM(require_graphql2(), 1);
@@ -68267,9 +68267,7 @@ var CacheInternal = class {
68267
68267
  let targetSelection = getFieldsForType(selection2, data["__typename"]);
68268
68268
  for (const [field, value] of Object.entries(data)) {
68269
68269
  if (!selection2 || !targetSelection[field]) {
68270
- throw new Error(
68271
- "Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection2)
68272
- );
68270
+ continue;
68273
68271
  }
68274
68272
  let {
68275
68273
  type: linkedType,
@@ -73985,41 +73983,55 @@ async function addID(config4, documents) {
73985
73983
  );
73986
73984
  const field = type.getFields()[node.name.value];
73987
73985
  const fieldType = unwrapType(config4, field.type).type;
73988
- if (node.selectionSet?.selections.length > 0) {
73989
- if (!graphql24.isObjectType(fieldType) && !graphql24.isInterfaceType(fieldType)) {
73990
- return;
73991
- }
73992
- const keyFields = config4.keyFieldsForType(fieldType.name);
73993
- if (keyFields.find((key2) => !fieldType.getFields()[key2])) {
73994
- return;
73995
- }
73996
- const selections = [...node.selectionSet.selections];
73997
- for (const keyField of keyFields) {
73998
- if (node.selectionSet.selections.find(
73999
- (selection2) => selection2.kind === "Field" && !selection2.alias && selection2.name.value === keyField
74000
- )) {
74001
- continue;
74002
- }
74003
- selections.push({
74004
- kind: graphql24.Kind.FIELD,
74005
- name: {
74006
- kind: graphql24.Kind.NAME,
74007
- value: keyField
74008
- }
74009
- });
74010
- }
74011
- return {
74012
- ...node,
74013
- selectionSet: {
74014
- ...node.selectionSet,
74015
- selections
74016
- }
74017
- };
73986
+ return addKeysToSelection(config4, node, fieldType);
73987
+ },
73988
+ InlineFragment(node) {
73989
+ if (!node.selectionSet || !node.typeCondition) {
73990
+ return;
74018
73991
  }
73992
+ const fragmentType = config4.schema.getType(node.typeCondition.name.value);
73993
+ if (!fragmentType) {
73994
+ return;
73995
+ }
73996
+ return addKeysToSelection(config4, node, fragmentType);
74019
73997
  }
74020
73998
  });
74021
73999
  }
74022
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
+ }
74023
74035
 
74024
74036
  // src/codegen/validators/typeCheck.ts
74025
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.4",
3
+ "version": "1.0.6",
4
4
  "description": "The disappearing GraphQL clients",
5
5
  "keywords": [
6
6
  "typescript",