houdini 1.2.43 → 1.2.44

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.
@@ -30954,7 +30954,7 @@ var require_path_visitor = __commonJS({
30954
30954
  }
30955
30955
  return target;
30956
30956
  }
30957
- PathVisitor.visit = function visit19(node, methods) {
30957
+ PathVisitor.visit = function visit20(node, methods) {
30958
30958
  return PathVisitor.fromMethodsObject(methods).visit(node);
30959
30959
  };
30960
30960
  var PVp = PathVisitor.prototype;
@@ -31145,7 +31145,7 @@ var require_path_visitor = __commonJS({
31145
31145
  this.needToCallTraverse = false;
31146
31146
  return visitChildren(path3, PathVisitor.fromMethodsObject(newVisitor || this.visitor));
31147
31147
  };
31148
- sharedContextProtoMethods.visit = function visit19(path3, newVisitor) {
31148
+ sharedContextProtoMethods.visit = function visit20(path3, newVisitor) {
31149
31149
  if (!(this instanceof this.Context)) {
31150
31150
  throw new Error("");
31151
31151
  }
@@ -32538,7 +32538,7 @@ var require_main = __commonJS({
32538
32538
  var someField = _a.someField;
32539
32539
  var Type = _a.Type;
32540
32540
  var use = _a.use;
32541
- var visit19 = _a.visit;
32541
+ var visit20 = _a.visit;
32542
32542
  exports.astNodesAreEquivalent = astNodesAreEquivalent;
32543
32543
  exports.builders = builders;
32544
32544
  exports.builtInTypes = builtInTypes;
@@ -32555,7 +32555,7 @@ var require_main = __commonJS({
32555
32555
  exports.someField = someField;
32556
32556
  exports.Type = Type;
32557
32557
  exports.use = use;
32558
- exports.visit = visit19;
32558
+ exports.visit = visit20;
32559
32559
  Object.assign(namedTypes_1.namedTypes, n);
32560
32560
  }
32561
32561
  });
@@ -67328,8 +67328,22 @@ var query = documentPlugin(ArtifactKind.Query, function() {
67328
67328
  let lastVariables = null;
67329
67329
  return {
67330
67330
  start(ctx, { next }) {
67331
+ const runtimeScalarPayload = {
67332
+ session: ctx.session
67333
+ };
67331
67334
  ctx.variables = {
67332
67335
  ...lastVariables,
67336
+ ...Object.fromEntries(
67337
+ Object.entries(ctx.artifact.input?.runtimeScalars ?? {}).map(
67338
+ ([field, type]) => {
67339
+ const runtimeScalar = ctx.config.features?.runtimeScalars?.[type];
67340
+ if (!runtimeScalar) {
67341
+ return [field, type];
67342
+ }
67343
+ return [field, runtimeScalar.resolve(runtimeScalarPayload)];
67344
+ }
67345
+ )
67346
+ ),
67333
67347
  ...ctx.variables
67334
67348
  };
67335
67349
  next(ctx);
@@ -67909,6 +67923,9 @@ var Config = class {
67909
67923
  get loadingDirective() {
67910
67924
  return `loading`;
67911
67925
  }
67926
+ get runtimeScalarDirective() {
67927
+ return "__houdini__runtimeScalar";
67928
+ }
67912
67929
  get whenDirective() {
67913
67930
  return "when";
67914
67931
  }
@@ -67979,7 +67996,7 @@ var Config = class {
67979
67996
  const internalDirectives = this.#newSchemaInstance?.getDirectives().reduce((list, directive) => {
67980
67997
  return list.concat(directive.name);
67981
67998
  }, []) ?? [];
67982
- return !defaultDirectives.includes(name) && (internalDirectives.includes(name) || this.isDeleteDirective(name));
67999
+ return !defaultDirectives.includes(name) && (internalDirectives.includes(name) || this.isDeleteDirective(name) || name === this.runtimeScalarDirective);
67983
68000
  }
67984
68001
  get componentFieldDirective() {
67985
68002
  return "componentField";
@@ -68500,7 +68517,7 @@ function unwrapType(config, type, wrappers = []) {
68500
68517
  }
68501
68518
  const namedType = config.schema.getType(type.name.value || type.name);
68502
68519
  if (!namedType) {
68503
- throw new Error("Could not unwrap type: " + JSON.stringify(type));
68520
+ throw new Error("Unknown type: " + type.name.value || type.name);
68504
68521
  }
68505
68522
  return { type: namedType, wrappers };
68506
68523
  }
@@ -69045,7 +69062,7 @@ async function loadLocalSchema(config) {
69045
69062
  }
69046
69063
 
69047
69064
  // src/codegen/index.ts
69048
- import * as graphql32 from "graphql";
69065
+ import * as graphql33 from "graphql";
69049
69066
 
69050
69067
  // src/codegen/generators/artifacts/index.ts
69051
69068
  var recast4 = __toESM(require_main2(), 1);
@@ -70016,7 +70033,7 @@ ${exportDefaultFrom(`./${doc.name}`, doc.name)}`,
70016
70033
 
70017
70034
  // src/codegen/generators/artifacts/inputs.ts
70018
70035
  import * as graphql8 from "graphql";
70019
- function inputObject(config, inputs) {
70036
+ function inputObject(config, inputs, runtimeScalars) {
70020
70037
  const visitedTypes = /* @__PURE__ */ new Set();
70021
70038
  const inputObj = {
70022
70039
  fields: inputs.reduce((fields, input) => {
@@ -70032,7 +70049,8 @@ function inputObject(config, inputs) {
70032
70049
  ...fields,
70033
70050
  [input.variable.name.value]: input.defaultValue ? variableValue(input.defaultValue, {}) : void 0
70034
70051
  };
70035
- }, {})
70052
+ }, {}),
70053
+ runtimeScalars
70036
70054
  };
70037
70055
  for (const input of inputs) {
70038
70056
  walkInputs(config, visitedTypes, inputObj, input.type);
@@ -71875,7 +71893,21 @@ function artifactGenerator(stats) {
71875
71893
  artifact.pluginData[plugin2.name] = plugin2.artifactData({ config, document: doc }) ?? {};
71876
71894
  }
71877
71895
  if (inputs && inputs.length > 0) {
71878
- artifact.input = inputObject(config, inputs);
71896
+ const runtimeScalars = inputs.reduce((prev, input) => {
71897
+ const runtimeScalarDirective = input.directives?.find(
71898
+ (directive2) => directive2.name.value === config.runtimeScalarDirective
71899
+ );
71900
+ if (!runtimeScalarDirective) {
71901
+ return prev;
71902
+ }
71903
+ return {
71904
+ ...prev,
71905
+ [input.variable.name.value]: runtimeScalarDirective.arguments?.find(
71906
+ (arg) => arg.name.value === "type"
71907
+ )?.value?.value
71908
+ };
71909
+ }, {});
71910
+ artifact.input = inputObject(config, inputs, runtimeScalars);
71879
71911
  }
71880
71912
  if (artifact.kind === "HoudiniQuery") {
71881
71913
  const cacheDirective = operations[0].directives?.find(
@@ -72967,17 +72999,20 @@ export * from "${module}"
72967
72999
  }
72968
73000
  }
72969
73001
  await fs_exports.writeFile(config.typeIndexPath, indexContent);
72970
- if (missingScalars.size > 0) {
72971
- console.warn(`\u26A0\uFE0F Missing definitions for the following scalars: ${[...missingScalars].join(
72972
- ", "
72973
- )}
73002
+ const missingScalarNames = [...missingScalars].filter(
73003
+ (scalar) => !config.configFile.features?.runtimeScalars?.[scalar]
73004
+ );
73005
+ if (missingScalarNames.length > 0) {
73006
+ console.warn(`\u26A0\uFE0F Missing definitions for the following scalars: ${[
73007
+ ...missingScalarNames
73008
+ ].join(", ")}
72974
73009
  Generated types will contain an any type in place of these values. To fix this, provide an equivalent
72975
73010
  type in your config file:
72976
73011
 
72977
73012
  {
72978
73013
  scalars: {
72979
73014
  ${cyan2(`/* in your case, something like */`)}
72980
- ${[...missingScalars].map(
73015
+ ${[...missingScalarNames].map(
72981
73016
  (c2) => ` ${c2}: { ${green2(`// <- The GraphQL Scalar`)}
72982
73017
  type: "${cyan2(`YourType_${c2}`)}" ${green2(`// <- The TypeScript type`)}
72983
73018
  }`
@@ -75559,7 +75594,7 @@ ${config.configFile.features?.componentFields ? `
75559
75594
  """
75560
75595
  @${config.componentFieldDirective} marks an inline fragment as the selection for a component field
75561
75596
  """
75562
- directive @${config.componentFieldDirective}(field: String!, prop: String, export: String, raw: String) on FRAGMENT_DEFINITION | INLINE_FRAGMENT
75597
+ directive @${config.componentFieldDirective}(field: String!, prop: String, export: String, raw: String) on FRAGMENT_DEFINITION | INLINE_FRAGMENT | FIELD_DEFINITION
75563
75598
 
75564
75599
  ` : ""}
75565
75600
 
@@ -75570,7 +75605,7 @@ directive @${config.componentFieldDirective}(field: String!, prop: String, expor
75570
75605
  }
75571
75606
  internalSchema += plugin2.schema({ config });
75572
75607
  }
75573
- const extensions = Object.entries(config.componentFields).map(([parent2, fields]) => {
75608
+ let extensions = Object.entries(config.componentFields).map(([parent2, fields]) => {
75574
75609
  return `
75575
75610
  extend type ${parent2} {
75576
75611
  ${Object.entries(fields).map(([fieldName, field]) => {
@@ -75582,11 +75617,12 @@ directive @${config.componentFieldDirective}(field: String!, prop: String, expor
75582
75617
  return `${arg.name}:${typeName}${arg.required ? "!" : ""}`;
75583
75618
  }).join("\n") + ")";
75584
75619
  }
75585
- return `${fieldName}${argString}: ${config.componentScalar}!`;
75620
+ return `${fieldName}${argString}: ${config.componentScalar}! @componentField(field: "${fieldName}")`;
75586
75621
  }).join("\n")}
75587
75622
  }
75588
75623
  `;
75589
75624
  }).join("\n");
75625
+ extensions += `${Object.keys(config.configFile.features?.runtimeScalars ?? {}).map((scalar) => `scalar ${scalar}`).join("\n")}`;
75590
75626
  config.newSchema = graphql25.print(mergeTypeDefs2([internalSchema, config.newSchema]));
75591
75627
  config.schemaString += extensions;
75592
75628
  config.schema = graphql25.buildSchema(
@@ -75781,8 +75817,50 @@ async function componentFields(config, documents) {
75781
75817
  }
75782
75818
  }
75783
75819
 
75784
- // src/codegen/validators/typeCheck.ts
75820
+ // src/codegen/transforms/runtimeScalars.ts
75785
75821
  import * as graphql29 from "graphql";
75822
+ async function addTypename2(config, documents) {
75823
+ for (const doc of documents) {
75824
+ doc.document = graphql29.visit(doc.document, {
75825
+ VariableDefinition(node) {
75826
+ const { type, wrappers } = unwrapType(config, node.type);
75827
+ const runtimeScalar = config.configFile.features?.runtimeScalars?.[type.name];
75828
+ if (runtimeScalar) {
75829
+ return {
75830
+ ...node,
75831
+ type: wrapType({
75832
+ type: config.schema.getType(runtimeScalar.type),
75833
+ wrappers
75834
+ }),
75835
+ directives: [
75836
+ ...node.directives ?? [],
75837
+ {
75838
+ kind: "Directive",
75839
+ name: {
75840
+ kind: "Name",
75841
+ value: config.runtimeScalarDirective
75842
+ },
75843
+ arguments: [
75844
+ {
75845
+ kind: "Argument",
75846
+ name: { kind: "Name", value: "type" },
75847
+ value: {
75848
+ kind: "StringValue",
75849
+ value: type.name
75850
+ }
75851
+ }
75852
+ ]
75853
+ }
75854
+ ]
75855
+ };
75856
+ }
75857
+ }
75858
+ });
75859
+ }
75860
+ }
75861
+
75862
+ // src/codegen/validators/typeCheck.ts
75863
+ import * as graphql30 from "graphql";
75786
75864
  async function typeCheck(config, docs) {
75787
75865
  const errors = [];
75788
75866
  const freeLists = [];
@@ -75790,7 +75868,7 @@ async function typeCheck(config, docs) {
75790
75868
  const listTypes = [];
75791
75869
  const fragments = {};
75792
75870
  for (const { document: parsed, originalString, filename } of docs) {
75793
- graphql29.visit(parsed, {
75871
+ graphql30.visit(parsed, {
75794
75872
  FragmentDefinition(definition) {
75795
75873
  fragments[definition.name.value] = definition;
75796
75874
  },
@@ -75835,14 +75913,14 @@ async function typeCheck(config, docs) {
75835
75913
  );
75836
75914
  return;
75837
75915
  }
75838
- if (graphql29.isListType(rootType) || graphql29.isNonNullType(rootType) && graphql29.isListType(rootType.ofType)) {
75916
+ if (graphql30.isListType(rootType) || graphql30.isNonNullType(rootType) && graphql30.isListType(rootType.ofType)) {
75839
75917
  needsParent = true;
75840
75918
  break;
75841
75919
  }
75842
- if (graphql29.isNonNullType(rootType) && "ofType" in rootType) {
75920
+ if (graphql30.isNonNullType(rootType) && "ofType" in rootType) {
75843
75921
  rootType = rootType.ofType;
75844
75922
  }
75845
- if (graphql29.isScalarType(rootType)) {
75923
+ if (graphql30.isScalarType(rootType)) {
75846
75924
  break;
75847
75925
  }
75848
75926
  rootType = rootType?.getFields()[parent3.name.value]?.type;
@@ -75918,9 +75996,9 @@ async function typeCheck(config, docs) {
75918
75996
  );
75919
75997
  }
75920
75998
  let targetTypes = [type];
75921
- if (graphql29.isUnionType(type)) {
75999
+ if (graphql30.isUnionType(type)) {
75922
76000
  targetTypes = config.schema.getPossibleTypes(type);
75923
- } else if (graphql29.isInterfaceType(type)) {
76001
+ } else if (graphql30.isInterfaceType(type)) {
75924
76002
  try {
75925
76003
  for (const key of config.keyFieldsForType(type.name)) {
75926
76004
  if (!type.getFields()[key]) {
@@ -75956,13 +76034,13 @@ async function typeCheck(config, docs) {
75956
76034
  if (errors.length > 0) {
75957
76035
  throw errors;
75958
76036
  }
75959
- const rules = (filepath) => [...graphql29.specifiedRules].filter(
76037
+ const rules = (filepath) => [...graphql30.specifiedRules].filter(
75960
76038
  (rule) => ![
75961
- graphql29.NoUnusedFragmentsRule,
75962
- graphql29.KnownFragmentNamesRule,
75963
- graphql29.ExecutableDefinitionsRule,
75964
- graphql29.KnownDirectivesRule,
75965
- graphql29.KnownArgumentNamesRule
76039
+ graphql30.NoUnusedFragmentsRule,
76040
+ graphql30.KnownFragmentNamesRule,
76041
+ graphql30.ExecutableDefinitionsRule,
76042
+ graphql30.KnownDirectivesRule,
76043
+ graphql30.KnownArgumentNamesRule
75966
76044
  ].includes(rule)
75967
76045
  ).concat(
75968
76046
  validateLists({
@@ -75983,7 +76061,7 @@ async function typeCheck(config, docs) {
75983
76061
  validateLoadingDirective(config)
75984
76062
  );
75985
76063
  for (const { filename, document: parsed, originalString } of docs) {
75986
- for (const error of graphql29.validate(config.schema, parsed, rules(filename))) {
76064
+ for (const error of graphql30.validate(config.schema, parsed, rules(filename))) {
75987
76065
  errors.push(
75988
76066
  new HoudiniError({
75989
76067
  filepath: filename,
@@ -76012,20 +76090,20 @@ function validateRequiredDirective(config, filepath) {
76012
76090
  if (!node.directives?.some(({ name }) => name.value === config.requiredDirective))
76013
76091
  return;
76014
76092
  const parentType = parentTypeFromAncestors(config.schema, filepath, ancestors);
76015
- if (!graphql29.isObjectType(parentType)) {
76093
+ if (!graphql30.isObjectType(parentType)) {
76016
76094
  ctx.reportError(
76017
- new graphql29.GraphQLError(
76095
+ new graphql30.GraphQLError(
76018
76096
  `@${config.requiredDirective} may only be used on objects, not arguments`
76019
76097
  )
76020
76098
  );
76021
76099
  return;
76022
76100
  }
76023
76101
  const type = parentType.getFields()[node.name.value].type;
76024
- const isServerNullable = !graphql29.isNonNullType(type);
76102
+ const isServerNullable = !graphql30.isNonNullType(type);
76025
76103
  const isAlreadyClientNullable = isClientNullable(node, true);
76026
76104
  if (!isServerNullable && !isAlreadyClientNullable) {
76027
76105
  ctx.reportError(
76028
- new graphql29.GraphQLError(
76106
+ new graphql30.GraphQLError(
76029
76107
  `@${config.requiredDirective} may only be used on nullable fields`
76030
76108
  )
76031
76109
  );
@@ -76047,7 +76125,7 @@ var validateLists = ({
76047
76125
  if (!config.isListFragment(node.name.value)) {
76048
76126
  if (!fragments[node.name.value]) {
76049
76127
  ctx.reportError(
76050
- new graphql29.GraphQLError(
76128
+ new graphql30.GraphQLError(
76051
76129
  "Encountered unknown fragment: " + node.name.value
76052
76130
  )
76053
76131
  );
@@ -76057,7 +76135,7 @@ var validateLists = ({
76057
76135
  const listName = config.listNameFromFragment(node.name.value);
76058
76136
  if (!lists.includes(listName)) {
76059
76137
  ctx.reportError(
76060
- new graphql29.GraphQLError(
76138
+ new graphql30.GraphQLError(
76061
76139
  "Encountered fragment referencing unknown list: " + listName
76062
76140
  )
76063
76141
  );
@@ -76082,7 +76160,7 @@ var validateLists = ({
76082
76160
  );
76083
76161
  if (parentArg) {
76084
76162
  ctx.reportError(
76085
- new graphql29.GraphQLError(
76163
+ new graphql30.GraphQLError(
76086
76164
  `@${config.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
76087
76165
  )
76088
76166
  );
@@ -76098,7 +76176,7 @@ var validateLists = ({
76098
76176
  return;
76099
76177
  }
76100
76178
  ctx.reportError(
76101
- new graphql29.GraphQLError(
76179
+ new graphql30.GraphQLError(
76102
76180
  `For this list fragment, you need to add or @${config.listParentDirective} or @${config.listAllListsDirective} directive to specify the behavior`
76103
76181
  )
76104
76182
  );
@@ -76108,7 +76186,7 @@ var validateLists = ({
76108
76186
  const directiveName = node.name.value;
76109
76187
  if (directiveName === "connection") {
76110
76188
  ctx.reportError(
76111
- new graphql29.GraphQLError(
76189
+ new graphql30.GraphQLError(
76112
76190
  "@connection was renamed to @list. Please change your components. If you were using `cache.connection` in your components, you will need to update that to `cache.list` too."
76113
76191
  )
76114
76192
  );
@@ -76117,7 +76195,7 @@ var validateLists = ({
76117
76195
  if (!config.isInternalDirective(node.name.value)) {
76118
76196
  if (!config.schema.getDirective(directiveName)) {
76119
76197
  ctx.reportError(
76120
- new graphql29.GraphQLError(
76198
+ new graphql30.GraphQLError(
76121
76199
  "Encountered unknown directive: " + directiveName
76122
76200
  )
76123
76201
  );
@@ -76126,7 +76204,7 @@ var validateLists = ({
76126
76204
  }
76127
76205
  if (config.isListOperationDirective(directiveName) && !listTypes.includes(config.listNameFromDirective(directiveName))) {
76128
76206
  ctx.reportError(
76129
- new graphql29.GraphQLError(
76207
+ new graphql30.GraphQLError(
76130
76208
  "Encountered directive referencing unknown list: " + directiveName
76131
76209
  )
76132
76210
  );
@@ -76137,7 +76215,7 @@ var validateLists = ({
76137
76215
  };
76138
76216
  function knownArguments(config) {
76139
76217
  return function(ctx) {
76140
- const nativeValidator = graphql29.KnownArgumentNamesRule(ctx);
76218
+ const nativeValidator = graphql30.KnownArgumentNamesRule(ctx);
76141
76219
  return {
76142
76220
  ...nativeValidator,
76143
76221
  Directive(directiveNode) {
@@ -76172,7 +76250,7 @@ function validateFragmentArguments(config, filepath, fragments) {
76172
76250
  for (const arg of node.arguments || []) {
76173
76251
  if (arg.value.kind !== "ObjectValue") {
76174
76252
  ctx.reportError(
76175
- new graphql29.GraphQLError("values in @arguments must be an object")
76253
+ new graphql30.GraphQLError("values in @arguments must be an object")
76176
76254
  );
76177
76255
  return;
76178
76256
  }
@@ -76182,13 +76260,13 @@ function validateFragmentArguments(config, filepath, fragments) {
76182
76260
  );
76183
76261
  if (!typeArg) {
76184
76262
  ctx.reportError(
76185
- new graphql29.GraphQLError("missing type field for @arguments directive")
76263
+ new graphql30.GraphQLError("missing type field for @arguments directive")
76186
76264
  );
76187
76265
  return;
76188
76266
  }
76189
- if (typeArg.value.kind !== graphql29.Kind.STRING) {
76267
+ if (typeArg.value.kind !== graphql30.Kind.STRING) {
76190
76268
  ctx.reportError(
76191
- new graphql29.GraphQLError("type field to @arguments must be a string")
76269
+ new graphql30.GraphQLError("type field to @arguments must be a string")
76192
76270
  );
76193
76271
  return;
76194
76272
  }
@@ -76201,7 +76279,7 @@ function validateFragmentArguments(config, filepath, fragments) {
76201
76279
  );
76202
76280
  if (typeArg.value.value !== defaultValueType) {
76203
76281
  ctx.reportError(
76204
- new graphql29.GraphQLError(
76282
+ new graphql30.GraphQLError(
76205
76283
  `Invalid default value provided for ${arg.name.value}. Expected ${typeArg.value.value}, found ${defaultValueType}`
76206
76284
  )
76207
76285
  );
@@ -76219,7 +76297,7 @@ function validateFragmentArguments(config, filepath, fragments) {
76219
76297
  try {
76220
76298
  args = fragmentArguments(config, filepath, fragments[fragmentName]);
76221
76299
  } catch (e3) {
76222
- ctx.reportError(new graphql29.GraphQLError(e3.message));
76300
+ ctx.reportError(new graphql30.GraphQLError(e3.message));
76223
76301
  return;
76224
76302
  }
76225
76303
  fragmentArguments2[fragmentName] = args;
@@ -76242,7 +76320,7 @@ function validateFragmentArguments(config, filepath, fragments) {
76242
76320
  );
76243
76321
  if (missing.length > 0) {
76244
76322
  ctx.reportError(
76245
- new graphql29.GraphQLError(
76323
+ new graphql30.GraphQLError(
76246
76324
  `The following arguments are missing from the "${fragmentName}" fragment: ` + JSON.stringify(missing)
76247
76325
  )
76248
76326
  );
@@ -76253,7 +76331,7 @@ function validateFragmentArguments(config, filepath, fragments) {
76253
76331
  );
76254
76332
  if (unknown.length > 0) {
76255
76333
  ctx.reportError(
76256
- new graphql29.GraphQLError(
76334
+ new graphql30.GraphQLError(
76257
76335
  "Encountered unknown arguments: " + JSON.stringify(unknown)
76258
76336
  )
76259
76337
  );
@@ -76265,7 +76343,7 @@ function validateFragmentArguments(config, filepath, fragments) {
76265
76343
  for (const [applied, target] of zipped) {
76266
76344
  if (!valueIsType(config, applied.value, target)) {
76267
76345
  ctx.reportError(
76268
- new graphql29.GraphQLError(
76346
+ new graphql30.GraphQLError(
76269
76347
  `Invalid argument type. Expected ${target}, found ${applied.value.kind}`
76270
76348
  )
76271
76349
  );
@@ -76307,7 +76385,7 @@ function valueIsType(config, value, targetType) {
76307
76385
  }
76308
76386
  if (value.kind === "EnumValue" && targetType.kind === "NamedType") {
76309
76387
  const enumType = config.schema.getType(targetType.name.value);
76310
- if (!graphql29.isEnumType(enumType)) {
76388
+ if (!graphql30.isEnumType(enumType)) {
76311
76389
  return false;
76312
76390
  }
76313
76391
  return enumType.getValues().some((enumValue) => enumValue.value === value.value);
@@ -76327,7 +76405,7 @@ function paginateArgs(config, filepath) {
76327
76405
  }
76328
76406
  if (alreadyPaginated) {
76329
76407
  ctx.reportError(
76330
- new graphql29.GraphQLError(
76408
+ new graphql30.GraphQLError(
76331
76409
  `@${config.paginateDirective} can only appear in a document once.`
76332
76410
  )
76333
76411
  );
@@ -76359,7 +76437,7 @@ function paginateArgs(config, filepath) {
76359
76437
  const backwards = appliedArgs.has("last");
76360
76438
  if (!forward && !backwards) {
76361
76439
  ctx.reportError(
76362
- new graphql29.GraphQLError(
76440
+ new graphql30.GraphQLError(
76363
76441
  "A field with cursor-based pagination must have a first or last argument"
76364
76442
  )
76365
76443
  );
@@ -76373,7 +76451,7 @@ function paginateArgs(config, filepath) {
76373
76451
  }
76374
76452
  if (forward && backwards && paginateMode === "Infinite") {
76375
76453
  ctx.reportError(
76376
- new graphql29.GraphQLError(
76454
+ new graphql30.GraphQLError(
76377
76455
  `A field with cursor pagination cannot go forwards an backwards simultaneously`
76378
76456
  )
76379
76457
  );
@@ -76387,7 +76465,7 @@ function paginateArgs(config, filepath) {
76387
76465
  );
76388
76466
  if (!appliedLimitArg) {
76389
76467
  ctx.reportError(
76390
- new graphql29.GraphQLError(
76468
+ new graphql30.GraphQLError(
76391
76469
  "A field with offset-based pagination must have a limit argument"
76392
76470
  )
76393
76471
  );
@@ -76403,20 +76481,20 @@ function noUnusedFragmentArguments(config) {
76403
76481
  const args = /* @__PURE__ */ new Set();
76404
76482
  return {
76405
76483
  enter(node) {
76406
- if (node.kind === graphql29.Kind.FRAGMENT_DEFINITION) {
76484
+ if (node.kind === graphql30.Kind.FRAGMENT_DEFINITION) {
76407
76485
  const definitionArguments = node.directives?.filter((directive) => directive.name.value === config.argumentsDirective).flatMap((directive) => directive.arguments);
76408
76486
  for (const arg of definitionArguments?.map((arg2) => arg2?.name.value) || []) {
76409
76487
  args.add(arg);
76410
76488
  }
76411
- } else if (node.kind === graphql29.Kind.VARIABLE) {
76489
+ } else if (node.kind === graphql30.Kind.VARIABLE) {
76412
76490
  args.delete(node.name.value);
76413
76491
  }
76414
76492
  },
76415
76493
  leave(node) {
76416
- if (node.kind === graphql29.Kind.FRAGMENT_DEFINITION) {
76494
+ if (node.kind === graphql30.Kind.FRAGMENT_DEFINITION) {
76417
76495
  if (args.size > 0) {
76418
76496
  ctx.reportError(
76419
- new graphql29.GraphQLError(
76497
+ new graphql30.GraphQLError(
76420
76498
  "Encountered unused fragment arguments: " + [...args].join(",")
76421
76499
  )
76422
76500
  );
@@ -76452,7 +76530,7 @@ function nodeDirectives(config, directives) {
76452
76530
  if (definition.kind === "OperationDefinition") {
76453
76531
  if (definition.operation !== "query") {
76454
76532
  ctx.reportError(
76455
- new graphql29.GraphQLError(
76533
+ new graphql30.GraphQLError(
76456
76534
  `@${node.name.value} must fall on a fragment or query document`
76457
76535
  )
76458
76536
  );
@@ -76464,7 +76542,7 @@ function nodeDirectives(config, directives) {
76464
76542
  }
76465
76543
  if (!possibleNodes.includes(definitionType)) {
76466
76544
  ctx.reportError(
76467
- new graphql29.GraphQLError(paginateOnNonNodeMessage(node.name.value))
76545
+ new graphql30.GraphQLError(paginateOnNonNodeMessage(node.name.value))
76468
76546
  );
76469
76547
  }
76470
76548
  }
@@ -76483,7 +76561,7 @@ function checkMutationOperation(config) {
76483
76561
  );
76484
76562
  if (append && prepend) {
76485
76563
  ctx.reportError(
76486
- new graphql29.GraphQLError(
76564
+ new graphql30.GraphQLError(
76487
76565
  `You can't apply both @${config.listPrependDirective} and @${config.listAppendDirective} at the same time`
76488
76566
  )
76489
76567
  );
@@ -76497,7 +76575,7 @@ function checkMutationOperation(config) {
76497
76575
  );
76498
76576
  if (parentId && allLists) {
76499
76577
  ctx.reportError(
76500
- new graphql29.GraphQLError(
76578
+ new graphql30.GraphQLError(
76501
76579
  `You can't apply both @${config.listParentDirective} and @${config.listAllListsDirective} at the same time`
76502
76580
  )
76503
76581
  );
@@ -76519,7 +76597,7 @@ function checkMaskDirectives(config) {
76519
76597
  );
76520
76598
  if (maskEnableDirective && maskDisableDirective) {
76521
76599
  ctx.reportError(
76522
- new graphql29.GraphQLError(
76600
+ new graphql30.GraphQLError(
76523
76601
  `You can't apply both @${config.maskEnableDirective} and @${config.maskDisableDirective} at the same time`
76524
76602
  )
76525
76603
  );
@@ -76561,7 +76639,7 @@ function validateLoadingDirective(config) {
76561
76639
  );
76562
76640
  if (!parentLoading && !global2) {
76563
76641
  ctx.reportError(
76564
- new graphql29.GraphQLError(
76642
+ new graphql30.GraphQLError(
76565
76643
  `@${config.loadingDirective} can only be applied on a field or fragment spread at the root of a document or on one whose parent also has @${config.loadingDirective}`
76566
76644
  )
76567
76645
  );
@@ -76583,7 +76661,7 @@ function validateLoadingDirective(config) {
76583
76661
  );
76584
76662
  if (!parentLoading && !global2) {
76585
76663
  ctx.reportError(
76586
- new graphql29.GraphQLError(
76664
+ new graphql30.GraphQLError(
76587
76665
  `@${config.loadingDirective} can only be applied on a field or fragment spread at the root of a document or on one whose parent also has @${config.loadingDirective}`
76588
76666
  )
76589
76667
  );
@@ -76598,7 +76676,7 @@ function getAndVerifyNodeInterface(config) {
76598
76676
  if (!nodeInterface) {
76599
76677
  return null;
76600
76678
  }
76601
- if (!graphql29.isInterfaceType(nodeInterface)) {
76679
+ if (!graphql30.isInterfaceType(nodeInterface)) {
76602
76680
  displayInvalidNodeFieldMessage(config);
76603
76681
  return null;
76604
76682
  }
@@ -76693,11 +76771,11 @@ async function uniqueDocumentNames(config, docs) {
76693
76771
  }
76694
76772
 
76695
76773
  // src/codegen/validators/noIDAlias.ts
76696
- import * as graphql30 from "graphql";
76774
+ import * as graphql31 from "graphql";
76697
76775
  async function noIDAlias(config, docs) {
76698
76776
  const errors = [];
76699
76777
  for (const { filename, document } of docs) {
76700
- graphql30.visit(document, {
76778
+ graphql31.visit(document, {
76701
76779
  Field(node, _3, __, ___, ancestors) {
76702
76780
  const fieldType = parentTypeFromAncestors(config.schema, filename, ancestors).name;
76703
76781
  if (config.keyFieldsForType(fieldType).includes(node.alias?.value || "")) {
@@ -76736,11 +76814,11 @@ async function validatePlugins(config, documents) {
76736
76814
  }
76737
76815
 
76738
76816
  // src/codegen/validators/componentFields.ts
76739
- import * as graphql31 from "graphql";
76817
+ import * as graphql32 from "graphql";
76740
76818
  async function componentFields2(config, docs) {
76741
76819
  const errors = [];
76742
76820
  for (const { filename: filepath, document } of docs) {
76743
- graphql31.visit(document, {
76821
+ graphql32.visit(document, {
76744
76822
  FragmentDefinition(node, _3, __, ___, ancestors) {
76745
76823
  const componentFieldDirective = node.directives?.find(
76746
76824
  (dir) => dir.name.value === config.componentFieldDirective
@@ -76782,14 +76860,26 @@ async function componentFields2(config, docs) {
76782
76860
  }
76783
76861
  const fieldValue = fieldArg.value?.kind === "StringValue" ? fieldArg.value.value : void 0;
76784
76862
  const propValue = propArg.value?.kind === "StringValue" ? propArg.value.value : void 0;
76863
+ const existingField = fieldValue && config.componentFields[parent2]?.[fieldValue];
76785
76864
  const parentType = config.schema.getType(parent2);
76786
- if (parentType && fieldValue && (graphql31.isObjectType(parentType) && parentType.getFields()[fieldValue] || config.componentFields[parent2]?.[fieldValue])) {
76865
+ let conflict = false;
76866
+ if (existingField && existingField.filepath !== filepath) {
76867
+ conflict = true;
76868
+ } else if (parentType && fieldValue) {
76869
+ const fieldDef = graphql32.isObjectType(parentType) && parentType.getFields()[fieldValue];
76870
+ if (fieldDef && !fieldDef.astNode?.directives?.find(
76871
+ (dir) => dir.name.value === config.componentFieldDirective
76872
+ )) {
76873
+ conflict = true;
76874
+ }
76875
+ }
76876
+ if (conflict) {
76787
76877
  errors.push({
76788
- message: `Duplicate component field definition for ${parent2}.${fieldValue}`,
76878
+ message: `Duplicate component field definition for ${parent2}.${fieldValue}.` + (existingField ? "The conflicting component field was defined in " + existingField.filepath : ""),
76789
76879
  filepath
76790
76880
  });
76791
76881
  }
76792
- if (parentType && graphql31.isAbstractType(parentType)) {
76882
+ if (parentType && graphql32.isAbstractType(parentType)) {
76793
76883
  errors.push({
76794
76884
  message: `Cannot add component field ${parent2}.${fieldValue} because ${parent2} is an abstract type`,
76795
76885
  filepath
@@ -76855,6 +76945,7 @@ async function runPipeline2(config, docs) {
76855
76945
  [
76856
76946
  componentFields2,
76857
76947
  graphqlExtensions,
76948
+ addTypename2,
76858
76949
  ...wrapHook(beforeValidate),
76859
76950
  typeCheck,
76860
76951
  uniqueDocumentNames,
@@ -77009,12 +77100,12 @@ async function processJSFile(config, contents) {
77009
77100
  return documents;
77010
77101
  }
77011
77102
  async function processGraphQLDocument(config, filepath, document) {
77012
- const parsedDoc = graphql32.parse(document);
77103
+ const parsedDoc = graphql33.parse(document);
77013
77104
  const operations = parsedDoc.definitions.filter(
77014
- ({ kind: kind2 }) => kind2 === graphql32.Kind.OPERATION_DEFINITION
77105
+ ({ kind: kind2 }) => kind2 === graphql33.Kind.OPERATION_DEFINITION
77015
77106
  );
77016
77107
  const fragments = parsedDoc.definitions.filter(
77017
- ({ kind: kind2 }) => kind2 === graphql32.Kind.FRAGMENT_DEFINITION
77108
+ ({ kind: kind2 }) => kind2 === graphql33.Kind.FRAGMENT_DEFINITION
77018
77109
  );
77019
77110
  if (operations.length > 1) {
77020
77111
  throw new HoudiniError({
@@ -77999,7 +78090,7 @@ export default app
77999
78090
  async function svelteConfig(targetPath, typescript) {
78000
78091
  const svelteConfigPath = path_exports.join(targetPath, "svelte.config.js");
78001
78092
  const newContentTs = `import adapter from '@sveltejs/adapter-auto';
78002
- import { vitePreprocess } from '@sveltejs/kit/vite';
78093
+ import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
78003
78094
 
78004
78095
  /** @type {import('@sveltejs/kit').Config} */
78005
78096
  const config = {
@@ -78130,12 +78221,12 @@ async function packageJSON(targetPath, frameworkInfo) {
78130
78221
  }
78131
78222
  packageJSON2.devDependencies = {
78132
78223
  ...packageJSON2.devDependencies,
78133
- houdini: "^1.2.43"
78224
+ houdini: "^1.2.44"
78134
78225
  };
78135
78226
  if (frameworkInfo.framework === "svelte" || frameworkInfo.framework === "kit") {
78136
78227
  packageJSON2.devDependencies = {
78137
78228
  ...packageJSON2.devDependencies,
78138
- "houdini-svelte": "^1.2.43"
78229
+ "houdini-svelte": "^1.2.44"
78139
78230
  };
78140
78231
  } else {
78141
78232
  throw new Error(`Unmanaged framework: "${JSON.stringify(frameworkInfo)}"`);