houdini 1.2.42 → 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.
@@ -31862,7 +31862,7 @@ var require_path_visitor = __commonJS({
31862
31862
  }
31863
31863
  return target;
31864
31864
  }
31865
- PathVisitor.visit = function visit19(node, methods) {
31865
+ PathVisitor.visit = function visit20(node, methods) {
31866
31866
  return PathVisitor.fromMethodsObject(methods).visit(node);
31867
31867
  };
31868
31868
  var PVp = PathVisitor.prototype;
@@ -32053,7 +32053,7 @@ var require_path_visitor = __commonJS({
32053
32053
  this.needToCallTraverse = false;
32054
32054
  return visitChildren(path3, PathVisitor.fromMethodsObject(newVisitor || this.visitor));
32055
32055
  };
32056
- sharedContextProtoMethods.visit = function visit19(path3, newVisitor) {
32056
+ sharedContextProtoMethods.visit = function visit20(path3, newVisitor) {
32057
32057
  if (!(this instanceof this.Context)) {
32058
32058
  throw new Error("");
32059
32059
  }
@@ -33446,7 +33446,7 @@ var require_main = __commonJS({
33446
33446
  var someField = _a.someField;
33447
33447
  var Type = _a.Type;
33448
33448
  var use = _a.use;
33449
- var visit19 = _a.visit;
33449
+ var visit20 = _a.visit;
33450
33450
  exports.astNodesAreEquivalent = astNodesAreEquivalent;
33451
33451
  exports.builders = builders;
33452
33452
  exports.builtInTypes = builtInTypes;
@@ -33463,7 +33463,7 @@ var require_main = __commonJS({
33463
33463
  exports.someField = someField;
33464
33464
  exports.Type = Type;
33465
33465
  exports.use = use;
33466
- exports.visit = visit19;
33466
+ exports.visit = visit20;
33467
33467
  Object.assign(namedTypes_1.namedTypes, n);
33468
33468
  }
33469
33469
  });
@@ -61321,7 +61321,7 @@ function watchAndRun(params) {
61321
61321
  }
61322
61322
 
61323
61323
  // src/codegen/index.ts
61324
- var graphql32 = __toESM(require("graphql"), 1);
61324
+ var graphql33 = __toESM(require("graphql"), 1);
61325
61325
 
61326
61326
  // src/lib/pipeline.ts
61327
61327
  async function runPipeline(config2, pipeline2, target) {
@@ -68462,8 +68462,22 @@ var query = documentPlugin(ArtifactKind.Query, function() {
68462
68462
  let lastVariables = null;
68463
68463
  return {
68464
68464
  start(ctx, { next }) {
68465
+ const runtimeScalarPayload = {
68466
+ session: ctx.session
68467
+ };
68465
68468
  ctx.variables = {
68466
68469
  ...lastVariables,
68470
+ ...Object.fromEntries(
68471
+ Object.entries(ctx.artifact.input?.runtimeScalars ?? {}).map(
68472
+ ([field, type]) => {
68473
+ const runtimeScalar = ctx.config.features?.runtimeScalars?.[type];
68474
+ if (!runtimeScalar) {
68475
+ return [field, type];
68476
+ }
68477
+ return [field, runtimeScalar.resolve(runtimeScalarPayload)];
68478
+ }
68479
+ )
68480
+ ),
68467
68481
  ...ctx.variables
68468
68482
  };
68469
68483
  next(ctx);
@@ -69044,6 +69058,9 @@ var Config = class {
69044
69058
  get loadingDirective() {
69045
69059
  return `loading`;
69046
69060
  }
69061
+ get runtimeScalarDirective() {
69062
+ return "__houdini__runtimeScalar";
69063
+ }
69047
69064
  get whenDirective() {
69048
69065
  return "when";
69049
69066
  }
@@ -69114,7 +69131,7 @@ var Config = class {
69114
69131
  const internalDirectives = this.#newSchemaInstance?.getDirectives().reduce((list, directive) => {
69115
69132
  return list.concat(directive.name);
69116
69133
  }, []) ?? [];
69117
- return !defaultDirectives.includes(name) && (internalDirectives.includes(name) || this.isDeleteDirective(name));
69134
+ return !defaultDirectives.includes(name) && (internalDirectives.includes(name) || this.isDeleteDirective(name) || name === this.runtimeScalarDirective);
69118
69135
  }
69119
69136
  get componentFieldDirective() {
69120
69137
  return "componentField";
@@ -69635,7 +69652,7 @@ function unwrapType(config2, type, wrappers = []) {
69635
69652
  }
69636
69653
  const namedType = config2.schema.getType(type.name.value || type.name);
69637
69654
  if (!namedType) {
69638
- throw new Error("Could not unwrap type: " + JSON.stringify(type));
69655
+ throw new Error("Unknown type: " + type.name.value || type.name);
69639
69656
  }
69640
69657
  return { type: namedType, wrappers };
69641
69658
  }
@@ -71445,7 +71462,7 @@ ${exportDefaultFrom(`./${doc.name}`, doc.name)}`,
71445
71462
 
71446
71463
  // src/codegen/generators/artifacts/inputs.ts
71447
71464
  var graphql8 = __toESM(require("graphql"), 1);
71448
- function inputObject(config2, inputs) {
71465
+ function inputObject(config2, inputs, runtimeScalars) {
71449
71466
  const visitedTypes = /* @__PURE__ */ new Set();
71450
71467
  const inputObj = {
71451
71468
  fields: inputs.reduce((fields, input) => {
@@ -71461,7 +71478,8 @@ function inputObject(config2, inputs) {
71461
71478
  ...fields,
71462
71479
  [input.variable.name.value]: input.defaultValue ? variableValue(input.defaultValue, {}) : void 0
71463
71480
  };
71464
- }, {})
71481
+ }, {}),
71482
+ runtimeScalars
71465
71483
  };
71466
71484
  for (const input of inputs) {
71467
71485
  walkInputs(config2, visitedTypes, inputObj, input.type);
@@ -73304,7 +73322,21 @@ function artifactGenerator(stats) {
73304
73322
  artifact.pluginData[plugin2.name] = plugin2.artifactData({ config: config2, document: doc }) ?? {};
73305
73323
  }
73306
73324
  if (inputs && inputs.length > 0) {
73307
- artifact.input = inputObject(config2, inputs);
73325
+ const runtimeScalars = inputs.reduce((prev, input) => {
73326
+ const runtimeScalarDirective = input.directives?.find(
73327
+ (directive2) => directive2.name.value === config2.runtimeScalarDirective
73328
+ );
73329
+ if (!runtimeScalarDirective) {
73330
+ return prev;
73331
+ }
73332
+ return {
73333
+ ...prev,
73334
+ [input.variable.name.value]: runtimeScalarDirective.arguments?.find(
73335
+ (arg) => arg.name.value === "type"
73336
+ )?.value?.value
73337
+ };
73338
+ }, {});
73339
+ artifact.input = inputObject(config2, inputs, runtimeScalars);
73308
73340
  }
73309
73341
  if (artifact.kind === "HoudiniQuery") {
73310
73342
  const cacheDirective = operations[0].directives?.find(
@@ -74396,17 +74428,20 @@ export * from "${module2}"
74396
74428
  }
74397
74429
  }
74398
74430
  await fs_exports.writeFile(config2.typeIndexPath, indexContent);
74399
- if (missingScalars.size > 0) {
74400
- console.warn(`\u26A0\uFE0F Missing definitions for the following scalars: ${[...missingScalars].join(
74401
- ", "
74402
- )}
74431
+ const missingScalarNames = [...missingScalars].filter(
74432
+ (scalar) => !config2.configFile.features?.runtimeScalars?.[scalar]
74433
+ );
74434
+ if (missingScalarNames.length > 0) {
74435
+ console.warn(`\u26A0\uFE0F Missing definitions for the following scalars: ${[
74436
+ ...missingScalarNames
74437
+ ].join(", ")}
74403
74438
  Generated types will contain an any type in place of these values. To fix this, provide an equivalent
74404
74439
  type in your config file:
74405
74440
 
74406
74441
  {
74407
74442
  scalars: {
74408
74443
  ${cyan3(`/* in your case, something like */`)}
74409
- ${[...missingScalars].map(
74444
+ ${[...missingScalarNames].map(
74410
74445
  (c) => ` ${c}: { ${green3(`// <- The GraphQL Scalar`)}
74411
74446
  type: "${cyan3(`YourType_${c}`)}" ${green3(`// <- The TypeScript type`)}
74412
74447
  }`
@@ -76988,7 +77023,7 @@ ${config2.configFile.features?.componentFields ? `
76988
77023
  """
76989
77024
  @${config2.componentFieldDirective} marks an inline fragment as the selection for a component field
76990
77025
  """
76991
- directive @${config2.componentFieldDirective}(field: String!, prop: String, export: String, raw: String) on FRAGMENT_DEFINITION | INLINE_FRAGMENT
77026
+ directive @${config2.componentFieldDirective}(field: String!, prop: String, export: String, raw: String) on FRAGMENT_DEFINITION | INLINE_FRAGMENT | FIELD_DEFINITION
76992
77027
 
76993
77028
  ` : ""}
76994
77029
 
@@ -76999,7 +77034,7 @@ directive @${config2.componentFieldDirective}(field: String!, prop: String, expo
76999
77034
  }
77000
77035
  internalSchema += plugin2.schema({ config: config2 });
77001
77036
  }
77002
- const extensions = Object.entries(config2.componentFields).map(([parent2, fields]) => {
77037
+ let extensions = Object.entries(config2.componentFields).map(([parent2, fields]) => {
77003
77038
  return `
77004
77039
  extend type ${parent2} {
77005
77040
  ${Object.entries(fields).map(([fieldName, field]) => {
@@ -77011,11 +77046,12 @@ directive @${config2.componentFieldDirective}(field: String!, prop: String, expo
77011
77046
  return `${arg.name}:${typeName}${arg.required ? "!" : ""}`;
77012
77047
  }).join("\n") + ")";
77013
77048
  }
77014
- return `${fieldName}${argString}: ${config2.componentScalar}!`;
77049
+ return `${fieldName}${argString}: ${config2.componentScalar}! @componentField(field: "${fieldName}")`;
77015
77050
  }).join("\n")}
77016
77051
  }
77017
77052
  `;
77018
77053
  }).join("\n");
77054
+ extensions += `${Object.keys(config2.configFile.features?.runtimeScalars ?? {}).map((scalar) => `scalar ${scalar}`).join("\n")}`;
77019
77055
  config2.newSchema = graphql25.print(mergeTypeDefs2([internalSchema, config2.newSchema]));
77020
77056
  config2.schemaString += extensions;
77021
77057
  config2.schema = graphql25.buildSchema(
@@ -77210,8 +77246,50 @@ async function componentFields(config2, documents) {
77210
77246
  }
77211
77247
  }
77212
77248
 
77213
- // src/codegen/validators/typeCheck.ts
77249
+ // src/codegen/transforms/runtimeScalars.ts
77214
77250
  var graphql29 = __toESM(require("graphql"), 1);
77251
+ async function addTypename2(config2, documents) {
77252
+ for (const doc of documents) {
77253
+ doc.document = graphql29.visit(doc.document, {
77254
+ VariableDefinition(node) {
77255
+ const { type, wrappers } = unwrapType(config2, node.type);
77256
+ const runtimeScalar = config2.configFile.features?.runtimeScalars?.[type.name];
77257
+ if (runtimeScalar) {
77258
+ return {
77259
+ ...node,
77260
+ type: wrapType({
77261
+ type: config2.schema.getType(runtimeScalar.type),
77262
+ wrappers
77263
+ }),
77264
+ directives: [
77265
+ ...node.directives ?? [],
77266
+ {
77267
+ kind: "Directive",
77268
+ name: {
77269
+ kind: "Name",
77270
+ value: config2.runtimeScalarDirective
77271
+ },
77272
+ arguments: [
77273
+ {
77274
+ kind: "Argument",
77275
+ name: { kind: "Name", value: "type" },
77276
+ value: {
77277
+ kind: "StringValue",
77278
+ value: type.name
77279
+ }
77280
+ }
77281
+ ]
77282
+ }
77283
+ ]
77284
+ };
77285
+ }
77286
+ }
77287
+ });
77288
+ }
77289
+ }
77290
+
77291
+ // src/codegen/validators/typeCheck.ts
77292
+ var graphql30 = __toESM(require("graphql"), 1);
77215
77293
  async function typeCheck(config2, docs) {
77216
77294
  const errors = [];
77217
77295
  const freeLists = [];
@@ -77219,7 +77297,7 @@ async function typeCheck(config2, docs) {
77219
77297
  const listTypes = [];
77220
77298
  const fragments = {};
77221
77299
  for (const { document: parsed, originalString, filename } of docs) {
77222
- graphql29.visit(parsed, {
77300
+ graphql30.visit(parsed, {
77223
77301
  FragmentDefinition(definition) {
77224
77302
  fragments[definition.name.value] = definition;
77225
77303
  },
@@ -77264,14 +77342,14 @@ async function typeCheck(config2, docs) {
77264
77342
  );
77265
77343
  return;
77266
77344
  }
77267
- if (graphql29.isListType(rootType) || graphql29.isNonNullType(rootType) && graphql29.isListType(rootType.ofType)) {
77345
+ if (graphql30.isListType(rootType) || graphql30.isNonNullType(rootType) && graphql30.isListType(rootType.ofType)) {
77268
77346
  needsParent = true;
77269
77347
  break;
77270
77348
  }
77271
- if (graphql29.isNonNullType(rootType) && "ofType" in rootType) {
77349
+ if (graphql30.isNonNullType(rootType) && "ofType" in rootType) {
77272
77350
  rootType = rootType.ofType;
77273
77351
  }
77274
- if (graphql29.isScalarType(rootType)) {
77352
+ if (graphql30.isScalarType(rootType)) {
77275
77353
  break;
77276
77354
  }
77277
77355
  rootType = rootType?.getFields()[parent3.name.value]?.type;
@@ -77347,9 +77425,9 @@ async function typeCheck(config2, docs) {
77347
77425
  );
77348
77426
  }
77349
77427
  let targetTypes = [type];
77350
- if (graphql29.isUnionType(type)) {
77428
+ if (graphql30.isUnionType(type)) {
77351
77429
  targetTypes = config2.schema.getPossibleTypes(type);
77352
- } else if (graphql29.isInterfaceType(type)) {
77430
+ } else if (graphql30.isInterfaceType(type)) {
77353
77431
  try {
77354
77432
  for (const key of config2.keyFieldsForType(type.name)) {
77355
77433
  if (!type.getFields()[key]) {
@@ -77385,13 +77463,13 @@ async function typeCheck(config2, docs) {
77385
77463
  if (errors.length > 0) {
77386
77464
  throw errors;
77387
77465
  }
77388
- const rules = (filepath) => [...graphql29.specifiedRules].filter(
77466
+ const rules = (filepath) => [...graphql30.specifiedRules].filter(
77389
77467
  (rule) => ![
77390
- graphql29.NoUnusedFragmentsRule,
77391
- graphql29.KnownFragmentNamesRule,
77392
- graphql29.ExecutableDefinitionsRule,
77393
- graphql29.KnownDirectivesRule,
77394
- graphql29.KnownArgumentNamesRule
77468
+ graphql30.NoUnusedFragmentsRule,
77469
+ graphql30.KnownFragmentNamesRule,
77470
+ graphql30.ExecutableDefinitionsRule,
77471
+ graphql30.KnownDirectivesRule,
77472
+ graphql30.KnownArgumentNamesRule
77395
77473
  ].includes(rule)
77396
77474
  ).concat(
77397
77475
  validateLists({
@@ -77412,7 +77490,7 @@ async function typeCheck(config2, docs) {
77412
77490
  validateLoadingDirective(config2)
77413
77491
  );
77414
77492
  for (const { filename, document: parsed, originalString } of docs) {
77415
- for (const error of graphql29.validate(config2.schema, parsed, rules(filename))) {
77493
+ for (const error of graphql30.validate(config2.schema, parsed, rules(filename))) {
77416
77494
  errors.push(
77417
77495
  new HoudiniError({
77418
77496
  filepath: filename,
@@ -77441,20 +77519,20 @@ function validateRequiredDirective(config2, filepath) {
77441
77519
  if (!node.directives?.some(({ name }) => name.value === config2.requiredDirective))
77442
77520
  return;
77443
77521
  const parentType = parentTypeFromAncestors(config2.schema, filepath, ancestors);
77444
- if (!graphql29.isObjectType(parentType)) {
77522
+ if (!graphql30.isObjectType(parentType)) {
77445
77523
  ctx.reportError(
77446
- new graphql29.GraphQLError(
77524
+ new graphql30.GraphQLError(
77447
77525
  `@${config2.requiredDirective} may only be used on objects, not arguments`
77448
77526
  )
77449
77527
  );
77450
77528
  return;
77451
77529
  }
77452
77530
  const type = parentType.getFields()[node.name.value].type;
77453
- const isServerNullable = !graphql29.isNonNullType(type);
77531
+ const isServerNullable = !graphql30.isNonNullType(type);
77454
77532
  const isAlreadyClientNullable = isClientNullable(node, true);
77455
77533
  if (!isServerNullable && !isAlreadyClientNullable) {
77456
77534
  ctx.reportError(
77457
- new graphql29.GraphQLError(
77535
+ new graphql30.GraphQLError(
77458
77536
  `@${config2.requiredDirective} may only be used on nullable fields`
77459
77537
  )
77460
77538
  );
@@ -77476,7 +77554,7 @@ var validateLists = ({
77476
77554
  if (!config2.isListFragment(node.name.value)) {
77477
77555
  if (!fragments[node.name.value]) {
77478
77556
  ctx.reportError(
77479
- new graphql29.GraphQLError(
77557
+ new graphql30.GraphQLError(
77480
77558
  "Encountered unknown fragment: " + node.name.value
77481
77559
  )
77482
77560
  );
@@ -77486,7 +77564,7 @@ var validateLists = ({
77486
77564
  const listName = config2.listNameFromFragment(node.name.value);
77487
77565
  if (!lists.includes(listName)) {
77488
77566
  ctx.reportError(
77489
- new graphql29.GraphQLError(
77567
+ new graphql30.GraphQLError(
77490
77568
  "Encountered fragment referencing unknown list: " + listName
77491
77569
  )
77492
77570
  );
@@ -77511,7 +77589,7 @@ var validateLists = ({
77511
77589
  );
77512
77590
  if (parentArg) {
77513
77591
  ctx.reportError(
77514
- new graphql29.GraphQLError(
77592
+ new graphql30.GraphQLError(
77515
77593
  `@${config2.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
77516
77594
  )
77517
77595
  );
@@ -77527,7 +77605,7 @@ var validateLists = ({
77527
77605
  return;
77528
77606
  }
77529
77607
  ctx.reportError(
77530
- new graphql29.GraphQLError(
77608
+ new graphql30.GraphQLError(
77531
77609
  `For this list fragment, you need to add or @${config2.listParentDirective} or @${config2.listAllListsDirective} directive to specify the behavior`
77532
77610
  )
77533
77611
  );
@@ -77537,7 +77615,7 @@ var validateLists = ({
77537
77615
  const directiveName = node.name.value;
77538
77616
  if (directiveName === "connection") {
77539
77617
  ctx.reportError(
77540
- new graphql29.GraphQLError(
77618
+ new graphql30.GraphQLError(
77541
77619
  "@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."
77542
77620
  )
77543
77621
  );
@@ -77546,7 +77624,7 @@ var validateLists = ({
77546
77624
  if (!config2.isInternalDirective(node.name.value)) {
77547
77625
  if (!config2.schema.getDirective(directiveName)) {
77548
77626
  ctx.reportError(
77549
- new graphql29.GraphQLError(
77627
+ new graphql30.GraphQLError(
77550
77628
  "Encountered unknown directive: " + directiveName
77551
77629
  )
77552
77630
  );
@@ -77555,7 +77633,7 @@ var validateLists = ({
77555
77633
  }
77556
77634
  if (config2.isListOperationDirective(directiveName) && !listTypes.includes(config2.listNameFromDirective(directiveName))) {
77557
77635
  ctx.reportError(
77558
- new graphql29.GraphQLError(
77636
+ new graphql30.GraphQLError(
77559
77637
  "Encountered directive referencing unknown list: " + directiveName
77560
77638
  )
77561
77639
  );
@@ -77566,7 +77644,7 @@ var validateLists = ({
77566
77644
  };
77567
77645
  function knownArguments(config2) {
77568
77646
  return function(ctx) {
77569
- const nativeValidator = graphql29.KnownArgumentNamesRule(ctx);
77647
+ const nativeValidator = graphql30.KnownArgumentNamesRule(ctx);
77570
77648
  return {
77571
77649
  ...nativeValidator,
77572
77650
  Directive(directiveNode) {
@@ -77601,7 +77679,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
77601
77679
  for (const arg of node.arguments || []) {
77602
77680
  if (arg.value.kind !== "ObjectValue") {
77603
77681
  ctx.reportError(
77604
- new graphql29.GraphQLError("values in @arguments must be an object")
77682
+ new graphql30.GraphQLError("values in @arguments must be an object")
77605
77683
  );
77606
77684
  return;
77607
77685
  }
@@ -77611,13 +77689,13 @@ function validateFragmentArguments(config2, filepath, fragments) {
77611
77689
  );
77612
77690
  if (!typeArg) {
77613
77691
  ctx.reportError(
77614
- new graphql29.GraphQLError("missing type field for @arguments directive")
77692
+ new graphql30.GraphQLError("missing type field for @arguments directive")
77615
77693
  );
77616
77694
  return;
77617
77695
  }
77618
- if (typeArg.value.kind !== graphql29.Kind.STRING) {
77696
+ if (typeArg.value.kind !== graphql30.Kind.STRING) {
77619
77697
  ctx.reportError(
77620
- new graphql29.GraphQLError("type field to @arguments must be a string")
77698
+ new graphql30.GraphQLError("type field to @arguments must be a string")
77621
77699
  );
77622
77700
  return;
77623
77701
  }
@@ -77630,7 +77708,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
77630
77708
  );
77631
77709
  if (typeArg.value.value !== defaultValueType) {
77632
77710
  ctx.reportError(
77633
- new graphql29.GraphQLError(
77711
+ new graphql30.GraphQLError(
77634
77712
  `Invalid default value provided for ${arg.name.value}. Expected ${typeArg.value.value}, found ${defaultValueType}`
77635
77713
  )
77636
77714
  );
@@ -77648,7 +77726,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
77648
77726
  try {
77649
77727
  args = fragmentArguments(config2, filepath, fragments[fragmentName]);
77650
77728
  } catch (e2) {
77651
- ctx.reportError(new graphql29.GraphQLError(e2.message));
77729
+ ctx.reportError(new graphql30.GraphQLError(e2.message));
77652
77730
  return;
77653
77731
  }
77654
77732
  fragmentArguments2[fragmentName] = args;
@@ -77671,7 +77749,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
77671
77749
  );
77672
77750
  if (missing.length > 0) {
77673
77751
  ctx.reportError(
77674
- new graphql29.GraphQLError(
77752
+ new graphql30.GraphQLError(
77675
77753
  `The following arguments are missing from the "${fragmentName}" fragment: ` + JSON.stringify(missing)
77676
77754
  )
77677
77755
  );
@@ -77682,7 +77760,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
77682
77760
  );
77683
77761
  if (unknown.length > 0) {
77684
77762
  ctx.reportError(
77685
- new graphql29.GraphQLError(
77763
+ new graphql30.GraphQLError(
77686
77764
  "Encountered unknown arguments: " + JSON.stringify(unknown)
77687
77765
  )
77688
77766
  );
@@ -77694,7 +77772,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
77694
77772
  for (const [applied, target] of zipped) {
77695
77773
  if (!valueIsType(config2, applied.value, target)) {
77696
77774
  ctx.reportError(
77697
- new graphql29.GraphQLError(
77775
+ new graphql30.GraphQLError(
77698
77776
  `Invalid argument type. Expected ${target}, found ${applied.value.kind}`
77699
77777
  )
77700
77778
  );
@@ -77736,7 +77814,7 @@ function valueIsType(config2, value, targetType) {
77736
77814
  }
77737
77815
  if (value.kind === "EnumValue" && targetType.kind === "NamedType") {
77738
77816
  const enumType = config2.schema.getType(targetType.name.value);
77739
- if (!graphql29.isEnumType(enumType)) {
77817
+ if (!graphql30.isEnumType(enumType)) {
77740
77818
  return false;
77741
77819
  }
77742
77820
  return enumType.getValues().some((enumValue) => enumValue.value === value.value);
@@ -77756,7 +77834,7 @@ function paginateArgs(config2, filepath) {
77756
77834
  }
77757
77835
  if (alreadyPaginated) {
77758
77836
  ctx.reportError(
77759
- new graphql29.GraphQLError(
77837
+ new graphql30.GraphQLError(
77760
77838
  `@${config2.paginateDirective} can only appear in a document once.`
77761
77839
  )
77762
77840
  );
@@ -77788,7 +77866,7 @@ function paginateArgs(config2, filepath) {
77788
77866
  const backwards = appliedArgs.has("last");
77789
77867
  if (!forward && !backwards) {
77790
77868
  ctx.reportError(
77791
- new graphql29.GraphQLError(
77869
+ new graphql30.GraphQLError(
77792
77870
  "A field with cursor-based pagination must have a first or last argument"
77793
77871
  )
77794
77872
  );
@@ -77802,7 +77880,7 @@ function paginateArgs(config2, filepath) {
77802
77880
  }
77803
77881
  if (forward && backwards && paginateMode === "Infinite") {
77804
77882
  ctx.reportError(
77805
- new graphql29.GraphQLError(
77883
+ new graphql30.GraphQLError(
77806
77884
  `A field with cursor pagination cannot go forwards an backwards simultaneously`
77807
77885
  )
77808
77886
  );
@@ -77816,7 +77894,7 @@ function paginateArgs(config2, filepath) {
77816
77894
  );
77817
77895
  if (!appliedLimitArg) {
77818
77896
  ctx.reportError(
77819
- new graphql29.GraphQLError(
77897
+ new graphql30.GraphQLError(
77820
77898
  "A field with offset-based pagination must have a limit argument"
77821
77899
  )
77822
77900
  );
@@ -77832,20 +77910,20 @@ function noUnusedFragmentArguments(config2) {
77832
77910
  const args = /* @__PURE__ */ new Set();
77833
77911
  return {
77834
77912
  enter(node) {
77835
- if (node.kind === graphql29.Kind.FRAGMENT_DEFINITION) {
77913
+ if (node.kind === graphql30.Kind.FRAGMENT_DEFINITION) {
77836
77914
  const definitionArguments = node.directives?.filter((directive) => directive.name.value === config2.argumentsDirective).flatMap((directive) => directive.arguments);
77837
77915
  for (const arg of definitionArguments?.map((arg2) => arg2?.name.value) || []) {
77838
77916
  args.add(arg);
77839
77917
  }
77840
- } else if (node.kind === graphql29.Kind.VARIABLE) {
77918
+ } else if (node.kind === graphql30.Kind.VARIABLE) {
77841
77919
  args.delete(node.name.value);
77842
77920
  }
77843
77921
  },
77844
77922
  leave(node) {
77845
- if (node.kind === graphql29.Kind.FRAGMENT_DEFINITION) {
77923
+ if (node.kind === graphql30.Kind.FRAGMENT_DEFINITION) {
77846
77924
  if (args.size > 0) {
77847
77925
  ctx.reportError(
77848
- new graphql29.GraphQLError(
77926
+ new graphql30.GraphQLError(
77849
77927
  "Encountered unused fragment arguments: " + [...args].join(",")
77850
77928
  )
77851
77929
  );
@@ -77881,7 +77959,7 @@ function nodeDirectives(config2, directives) {
77881
77959
  if (definition.kind === "OperationDefinition") {
77882
77960
  if (definition.operation !== "query") {
77883
77961
  ctx.reportError(
77884
- new graphql29.GraphQLError(
77962
+ new graphql30.GraphQLError(
77885
77963
  `@${node.name.value} must fall on a fragment or query document`
77886
77964
  )
77887
77965
  );
@@ -77893,7 +77971,7 @@ function nodeDirectives(config2, directives) {
77893
77971
  }
77894
77972
  if (!possibleNodes.includes(definitionType)) {
77895
77973
  ctx.reportError(
77896
- new graphql29.GraphQLError(paginateOnNonNodeMessage(node.name.value))
77974
+ new graphql30.GraphQLError(paginateOnNonNodeMessage(node.name.value))
77897
77975
  );
77898
77976
  }
77899
77977
  }
@@ -77912,7 +77990,7 @@ function checkMutationOperation(config2) {
77912
77990
  );
77913
77991
  if (append && prepend) {
77914
77992
  ctx.reportError(
77915
- new graphql29.GraphQLError(
77993
+ new graphql30.GraphQLError(
77916
77994
  `You can't apply both @${config2.listPrependDirective} and @${config2.listAppendDirective} at the same time`
77917
77995
  )
77918
77996
  );
@@ -77926,7 +78004,7 @@ function checkMutationOperation(config2) {
77926
78004
  );
77927
78005
  if (parentId && allLists) {
77928
78006
  ctx.reportError(
77929
- new graphql29.GraphQLError(
78007
+ new graphql30.GraphQLError(
77930
78008
  `You can't apply both @${config2.listParentDirective} and @${config2.listAllListsDirective} at the same time`
77931
78009
  )
77932
78010
  );
@@ -77948,7 +78026,7 @@ function checkMaskDirectives(config2) {
77948
78026
  );
77949
78027
  if (maskEnableDirective && maskDisableDirective) {
77950
78028
  ctx.reportError(
77951
- new graphql29.GraphQLError(
78029
+ new graphql30.GraphQLError(
77952
78030
  `You can't apply both @${config2.maskEnableDirective} and @${config2.maskDisableDirective} at the same time`
77953
78031
  )
77954
78032
  );
@@ -77990,7 +78068,7 @@ function validateLoadingDirective(config2) {
77990
78068
  );
77991
78069
  if (!parentLoading && !global2) {
77992
78070
  ctx.reportError(
77993
- new graphql29.GraphQLError(
78071
+ new graphql30.GraphQLError(
77994
78072
  `@${config2.loadingDirective} can only be applied on a field or fragment spread at the root of a document or on one whose parent also has @${config2.loadingDirective}`
77995
78073
  )
77996
78074
  );
@@ -78012,7 +78090,7 @@ function validateLoadingDirective(config2) {
78012
78090
  );
78013
78091
  if (!parentLoading && !global2) {
78014
78092
  ctx.reportError(
78015
- new graphql29.GraphQLError(
78093
+ new graphql30.GraphQLError(
78016
78094
  `@${config2.loadingDirective} can only be applied on a field or fragment spread at the root of a document or on one whose parent also has @${config2.loadingDirective}`
78017
78095
  )
78018
78096
  );
@@ -78027,7 +78105,7 @@ function getAndVerifyNodeInterface(config2) {
78027
78105
  if (!nodeInterface) {
78028
78106
  return null;
78029
78107
  }
78030
- if (!graphql29.isInterfaceType(nodeInterface)) {
78108
+ if (!graphql30.isInterfaceType(nodeInterface)) {
78031
78109
  displayInvalidNodeFieldMessage(config2);
78032
78110
  return null;
78033
78111
  }
@@ -78122,11 +78200,11 @@ async function uniqueDocumentNames(config2, docs) {
78122
78200
  }
78123
78201
 
78124
78202
  // src/codegen/validators/noIDAlias.ts
78125
- var graphql30 = __toESM(require("graphql"), 1);
78203
+ var graphql31 = __toESM(require("graphql"), 1);
78126
78204
  async function noIDAlias(config2, docs) {
78127
78205
  const errors = [];
78128
78206
  for (const { filename, document } of docs) {
78129
- graphql30.visit(document, {
78207
+ graphql31.visit(document, {
78130
78208
  Field(node, _, __, ___, ancestors) {
78131
78209
  const fieldType = parentTypeFromAncestors(config2.schema, filename, ancestors).name;
78132
78210
  if (config2.keyFieldsForType(fieldType).includes(node.alias?.value || "")) {
@@ -78165,11 +78243,11 @@ async function validatePlugins(config2, documents) {
78165
78243
  }
78166
78244
 
78167
78245
  // src/codegen/validators/componentFields.ts
78168
- var graphql31 = __toESM(require("graphql"), 1);
78246
+ var graphql32 = __toESM(require("graphql"), 1);
78169
78247
  async function componentFields2(config2, docs) {
78170
78248
  const errors = [];
78171
78249
  for (const { filename: filepath, document } of docs) {
78172
- graphql31.visit(document, {
78250
+ graphql32.visit(document, {
78173
78251
  FragmentDefinition(node, _, __, ___, ancestors) {
78174
78252
  const componentFieldDirective = node.directives?.find(
78175
78253
  (dir) => dir.name.value === config2.componentFieldDirective
@@ -78211,14 +78289,26 @@ async function componentFields2(config2, docs) {
78211
78289
  }
78212
78290
  const fieldValue = fieldArg.value?.kind === "StringValue" ? fieldArg.value.value : void 0;
78213
78291
  const propValue = propArg.value?.kind === "StringValue" ? propArg.value.value : void 0;
78292
+ const existingField = fieldValue && config2.componentFields[parent2]?.[fieldValue];
78214
78293
  const parentType = config2.schema.getType(parent2);
78215
- if (parentType && fieldValue && (graphql31.isObjectType(parentType) && parentType.getFields()[fieldValue] || config2.componentFields[parent2]?.[fieldValue])) {
78294
+ let conflict = false;
78295
+ if (existingField && existingField.filepath !== filepath) {
78296
+ conflict = true;
78297
+ } else if (parentType && fieldValue) {
78298
+ const fieldDef = graphql32.isObjectType(parentType) && parentType.getFields()[fieldValue];
78299
+ if (fieldDef && !fieldDef.astNode?.directives?.find(
78300
+ (dir) => dir.name.value === config2.componentFieldDirective
78301
+ )) {
78302
+ conflict = true;
78303
+ }
78304
+ }
78305
+ if (conflict) {
78216
78306
  errors.push({
78217
- message: `Duplicate component field definition for ${parent2}.${fieldValue}`,
78307
+ message: `Duplicate component field definition for ${parent2}.${fieldValue}.` + (existingField ? "The conflicting component field was defined in " + existingField.filepath : ""),
78218
78308
  filepath
78219
78309
  });
78220
78310
  }
78221
- if (parentType && graphql31.isAbstractType(parentType)) {
78311
+ if (parentType && graphql32.isAbstractType(parentType)) {
78222
78312
  errors.push({
78223
78313
  message: `Cannot add component field ${parent2}.${fieldValue} because ${parent2} is an abstract type`,
78224
78314
  filepath
@@ -78284,6 +78374,7 @@ async function runPipeline2(config2, docs) {
78284
78374
  [
78285
78375
  componentFields2,
78286
78376
  graphqlExtensions,
78377
+ addTypename2,
78287
78378
  ...wrapHook(beforeValidate),
78288
78379
  typeCheck,
78289
78380
  uniqueDocumentNames,
@@ -78438,12 +78529,12 @@ async function processJSFile(config2, contents) {
78438
78529
  return documents;
78439
78530
  }
78440
78531
  async function processGraphQLDocument(config2, filepath, document) {
78441
- const parsedDoc = graphql32.parse(document);
78532
+ const parsedDoc = graphql33.parse(document);
78442
78533
  const operations = parsedDoc.definitions.filter(
78443
- ({ kind: kind2 }) => kind2 === graphql32.Kind.OPERATION_DEFINITION
78534
+ ({ kind: kind2 }) => kind2 === graphql33.Kind.OPERATION_DEFINITION
78444
78535
  );
78445
78536
  const fragments = parsedDoc.definitions.filter(
78446
- ({ kind: kind2 }) => kind2 === graphql32.Kind.FRAGMENT_DEFINITION
78537
+ ({ kind: kind2 }) => kind2 === graphql33.Kind.FRAGMENT_DEFINITION
78447
78538
  );
78448
78539
  if (operations.length > 1) {
78449
78540
  throw new HoudiniError({