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.
@@ -24845,7 +24845,7 @@ var require_path_visitor = __commonJS({
24845
24845
  }
24846
24846
  return target;
24847
24847
  }
24848
- PathVisitor.visit = function visit18(node, methods) {
24848
+ PathVisitor.visit = function visit19(node, methods) {
24849
24849
  return PathVisitor.fromMethodsObject(methods).visit(node);
24850
24850
  };
24851
24851
  var PVp = PathVisitor.prototype;
@@ -25036,7 +25036,7 @@ var require_path_visitor = __commonJS({
25036
25036
  this.needToCallTraverse = false;
25037
25037
  return visitChildren(path2, PathVisitor.fromMethodsObject(newVisitor || this.visitor));
25038
25038
  };
25039
- sharedContextProtoMethods.visit = function visit18(path2, newVisitor) {
25039
+ sharedContextProtoMethods.visit = function visit19(path2, newVisitor) {
25040
25040
  if (!(this instanceof this.Context)) {
25041
25041
  throw new Error("");
25042
25042
  }
@@ -26429,7 +26429,7 @@ var require_main = __commonJS({
26429
26429
  var someField = _a.someField;
26430
26430
  var Type = _a.Type;
26431
26431
  var use = _a.use;
26432
- var visit18 = _a.visit;
26432
+ var visit19 = _a.visit;
26433
26433
  exports.astNodesAreEquivalent = astNodesAreEquivalent;
26434
26434
  exports.builders = builders;
26435
26435
  exports.builtInTypes = builtInTypes;
@@ -26446,7 +26446,7 @@ var require_main = __commonJS({
26446
26446
  exports.someField = someField;
26447
26447
  exports.Type = Type;
26448
26448
  exports.use = use;
26449
- exports.visit = visit18;
26449
+ exports.visit = visit19;
26450
26450
  Object.assign(namedTypes_1.namedTypes, n);
26451
26451
  }
26452
26452
  });
@@ -53824,7 +53824,7 @@ __export(codegen_exports, {
53824
53824
  runPipeline: () => runPipeline2
53825
53825
  });
53826
53826
  module.exports = __toCommonJS(codegen_exports);
53827
- var graphql32 = __toESM(require("graphql"), 1);
53827
+ var graphql33 = __toESM(require("graphql"), 1);
53828
53828
 
53829
53829
  // src/lib/pipeline.ts
53830
53830
  async function runPipeline(config, pipeline, target) {
@@ -56696,8 +56696,22 @@ var query = documentPlugin(ArtifactKind.Query, function() {
56696
56696
  let lastVariables = null;
56697
56697
  return {
56698
56698
  start(ctx, { next }) {
56699
+ const runtimeScalarPayload = {
56700
+ session: ctx.session
56701
+ };
56699
56702
  ctx.variables = {
56700
56703
  ...lastVariables,
56704
+ ...Object.fromEntries(
56705
+ Object.entries(ctx.artifact.input?.runtimeScalars ?? {}).map(
56706
+ ([field, type]) => {
56707
+ const runtimeScalar = ctx.config.features?.runtimeScalars?.[type];
56708
+ if (!runtimeScalar) {
56709
+ return [field, type];
56710
+ }
56711
+ return [field, runtimeScalar.resolve(runtimeScalarPayload)];
56712
+ }
56713
+ )
56714
+ ),
56701
56715
  ...ctx.variables
56702
56716
  };
56703
56717
  next(ctx);
@@ -56977,7 +56991,7 @@ function unwrapType(config, type, wrappers = []) {
56977
56991
  }
56978
56992
  const namedType = config.schema.getType(type.name.value || type.name);
56979
56993
  if (!namedType) {
56980
- throw new Error("Could not unwrap type: " + JSON.stringify(type));
56994
+ throw new Error("Unknown type: " + type.name.value || type.name);
56981
56995
  }
56982
56996
  return { type: namedType, wrappers };
56983
56997
  }
@@ -58400,7 +58414,7 @@ ${exportDefaultFrom(`./${doc.name}`, doc.name)}`,
58400
58414
 
58401
58415
  // src/codegen/generators/artifacts/inputs.ts
58402
58416
  var graphql8 = __toESM(require("graphql"), 1);
58403
- function inputObject(config, inputs) {
58417
+ function inputObject(config, inputs, runtimeScalars) {
58404
58418
  const visitedTypes = /* @__PURE__ */ new Set();
58405
58419
  const inputObj = {
58406
58420
  fields: inputs.reduce((fields, input) => {
@@ -58416,7 +58430,8 @@ function inputObject(config, inputs) {
58416
58430
  ...fields,
58417
58431
  [input.variable.name.value]: input.defaultValue ? variableValue(input.defaultValue, {}) : void 0
58418
58432
  };
58419
- }, {})
58433
+ }, {}),
58434
+ runtimeScalars
58420
58435
  };
58421
58436
  for (const input of inputs) {
58422
58437
  walkInputs(config, visitedTypes, inputObj, input.type);
@@ -60259,7 +60274,21 @@ function artifactGenerator(stats) {
60259
60274
  artifact.pluginData[plugin2.name] = plugin2.artifactData({ config, document: doc }) ?? {};
60260
60275
  }
60261
60276
  if (inputs && inputs.length > 0) {
60262
- artifact.input = inputObject(config, inputs);
60277
+ const runtimeScalars = inputs.reduce((prev, input) => {
60278
+ const runtimeScalarDirective = input.directives?.find(
60279
+ (directive2) => directive2.name.value === config.runtimeScalarDirective
60280
+ );
60281
+ if (!runtimeScalarDirective) {
60282
+ return prev;
60283
+ }
60284
+ return {
60285
+ ...prev,
60286
+ [input.variable.name.value]: runtimeScalarDirective.arguments?.find(
60287
+ (arg) => arg.name.value === "type"
60288
+ )?.value?.value
60289
+ };
60290
+ }, {});
60291
+ artifact.input = inputObject(config, inputs, runtimeScalars);
60263
60292
  }
60264
60293
  if (artifact.kind === "HoudiniQuery") {
60265
60294
  const cacheDirective = operations[0].directives?.find(
@@ -61351,17 +61380,20 @@ export * from "${module2}"
61351
61380
  }
61352
61381
  }
61353
61382
  await fs_exports.writeFile(config.typeIndexPath, indexContent);
61354
- if (missingScalars.size > 0) {
61355
- console.warn(`\u26A0\uFE0F Missing definitions for the following scalars: ${[...missingScalars].join(
61356
- ", "
61357
- )}
61383
+ const missingScalarNames = [...missingScalars].filter(
61384
+ (scalar) => !config.configFile.features?.runtimeScalars?.[scalar]
61385
+ );
61386
+ if (missingScalarNames.length > 0) {
61387
+ console.warn(`\u26A0\uFE0F Missing definitions for the following scalars: ${[
61388
+ ...missingScalarNames
61389
+ ].join(", ")}
61358
61390
  Generated types will contain an any type in place of these values. To fix this, provide an equivalent
61359
61391
  type in your config file:
61360
61392
 
61361
61393
  {
61362
61394
  scalars: {
61363
61395
  ${cyan2(`/* in your case, something like */`)}
61364
- ${[...missingScalars].map(
61396
+ ${[...missingScalarNames].map(
61365
61397
  (c) => ` ${c}: { ${green2(`// <- The GraphQL Scalar`)}
61366
61398
  type: "${cyan2(`YourType_${c}`)}" ${green2(`// <- The TypeScript type`)}
61367
61399
  }`
@@ -63943,7 +63975,7 @@ ${config.configFile.features?.componentFields ? `
63943
63975
  """
63944
63976
  @${config.componentFieldDirective} marks an inline fragment as the selection for a component field
63945
63977
  """
63946
- directive @${config.componentFieldDirective}(field: String!, prop: String, export: String, raw: String) on FRAGMENT_DEFINITION | INLINE_FRAGMENT
63978
+ directive @${config.componentFieldDirective}(field: String!, prop: String, export: String, raw: String) on FRAGMENT_DEFINITION | INLINE_FRAGMENT | FIELD_DEFINITION
63947
63979
 
63948
63980
  ` : ""}
63949
63981
 
@@ -63954,7 +63986,7 @@ directive @${config.componentFieldDirective}(field: String!, prop: String, expor
63954
63986
  }
63955
63987
  internalSchema += plugin2.schema({ config });
63956
63988
  }
63957
- const extensions = Object.entries(config.componentFields).map(([parent2, fields]) => {
63989
+ let extensions = Object.entries(config.componentFields).map(([parent2, fields]) => {
63958
63990
  return `
63959
63991
  extend type ${parent2} {
63960
63992
  ${Object.entries(fields).map(([fieldName, field]) => {
@@ -63966,11 +63998,12 @@ directive @${config.componentFieldDirective}(field: String!, prop: String, expor
63966
63998
  return `${arg.name}:${typeName}${arg.required ? "!" : ""}`;
63967
63999
  }).join("\n") + ")";
63968
64000
  }
63969
- return `${fieldName}${argString}: ${config.componentScalar}!`;
64001
+ return `${fieldName}${argString}: ${config.componentScalar}! @componentField(field: "${fieldName}")`;
63970
64002
  }).join("\n")}
63971
64003
  }
63972
64004
  `;
63973
64005
  }).join("\n");
64006
+ extensions += `${Object.keys(config.configFile.features?.runtimeScalars ?? {}).map((scalar) => `scalar ${scalar}`).join("\n")}`;
63974
64007
  config.newSchema = graphql25.print(mergeTypeDefs([internalSchema, config.newSchema]));
63975
64008
  config.schemaString += extensions;
63976
64009
  config.schema = graphql25.buildSchema(
@@ -64165,8 +64198,50 @@ async function componentFields(config, documents) {
64165
64198
  }
64166
64199
  }
64167
64200
 
64168
- // src/codegen/validators/typeCheck.ts
64201
+ // src/codegen/transforms/runtimeScalars.ts
64169
64202
  var graphql29 = __toESM(require("graphql"), 1);
64203
+ async function addTypename2(config, documents) {
64204
+ for (const doc of documents) {
64205
+ doc.document = graphql29.visit(doc.document, {
64206
+ VariableDefinition(node) {
64207
+ const { type, wrappers } = unwrapType(config, node.type);
64208
+ const runtimeScalar = config.configFile.features?.runtimeScalars?.[type.name];
64209
+ if (runtimeScalar) {
64210
+ return {
64211
+ ...node,
64212
+ type: wrapType({
64213
+ type: config.schema.getType(runtimeScalar.type),
64214
+ wrappers
64215
+ }),
64216
+ directives: [
64217
+ ...node.directives ?? [],
64218
+ {
64219
+ kind: "Directive",
64220
+ name: {
64221
+ kind: "Name",
64222
+ value: config.runtimeScalarDirective
64223
+ },
64224
+ arguments: [
64225
+ {
64226
+ kind: "Argument",
64227
+ name: { kind: "Name", value: "type" },
64228
+ value: {
64229
+ kind: "StringValue",
64230
+ value: type.name
64231
+ }
64232
+ }
64233
+ ]
64234
+ }
64235
+ ]
64236
+ };
64237
+ }
64238
+ }
64239
+ });
64240
+ }
64241
+ }
64242
+
64243
+ // src/codegen/validators/typeCheck.ts
64244
+ var graphql30 = __toESM(require("graphql"), 1);
64170
64245
  async function typeCheck(config, docs) {
64171
64246
  const errors = [];
64172
64247
  const freeLists = [];
@@ -64174,7 +64249,7 @@ async function typeCheck(config, docs) {
64174
64249
  const listTypes = [];
64175
64250
  const fragments = {};
64176
64251
  for (const { document: parsed, originalString, filename } of docs) {
64177
- graphql29.visit(parsed, {
64252
+ graphql30.visit(parsed, {
64178
64253
  FragmentDefinition(definition) {
64179
64254
  fragments[definition.name.value] = definition;
64180
64255
  },
@@ -64219,14 +64294,14 @@ async function typeCheck(config, docs) {
64219
64294
  );
64220
64295
  return;
64221
64296
  }
64222
- if (graphql29.isListType(rootType) || graphql29.isNonNullType(rootType) && graphql29.isListType(rootType.ofType)) {
64297
+ if (graphql30.isListType(rootType) || graphql30.isNonNullType(rootType) && graphql30.isListType(rootType.ofType)) {
64223
64298
  needsParent = true;
64224
64299
  break;
64225
64300
  }
64226
- if (graphql29.isNonNullType(rootType) && "ofType" in rootType) {
64301
+ if (graphql30.isNonNullType(rootType) && "ofType" in rootType) {
64227
64302
  rootType = rootType.ofType;
64228
64303
  }
64229
- if (graphql29.isScalarType(rootType)) {
64304
+ if (graphql30.isScalarType(rootType)) {
64230
64305
  break;
64231
64306
  }
64232
64307
  rootType = rootType?.getFields()[parent3.name.value]?.type;
@@ -64302,9 +64377,9 @@ async function typeCheck(config, docs) {
64302
64377
  );
64303
64378
  }
64304
64379
  let targetTypes = [type];
64305
- if (graphql29.isUnionType(type)) {
64380
+ if (graphql30.isUnionType(type)) {
64306
64381
  targetTypes = config.schema.getPossibleTypes(type);
64307
- } else if (graphql29.isInterfaceType(type)) {
64382
+ } else if (graphql30.isInterfaceType(type)) {
64308
64383
  try {
64309
64384
  for (const key of config.keyFieldsForType(type.name)) {
64310
64385
  if (!type.getFields()[key]) {
@@ -64340,13 +64415,13 @@ async function typeCheck(config, docs) {
64340
64415
  if (errors.length > 0) {
64341
64416
  throw errors;
64342
64417
  }
64343
- const rules = (filepath) => [...graphql29.specifiedRules].filter(
64418
+ const rules = (filepath) => [...graphql30.specifiedRules].filter(
64344
64419
  (rule) => ![
64345
- graphql29.NoUnusedFragmentsRule,
64346
- graphql29.KnownFragmentNamesRule,
64347
- graphql29.ExecutableDefinitionsRule,
64348
- graphql29.KnownDirectivesRule,
64349
- graphql29.KnownArgumentNamesRule
64420
+ graphql30.NoUnusedFragmentsRule,
64421
+ graphql30.KnownFragmentNamesRule,
64422
+ graphql30.ExecutableDefinitionsRule,
64423
+ graphql30.KnownDirectivesRule,
64424
+ graphql30.KnownArgumentNamesRule
64350
64425
  ].includes(rule)
64351
64426
  ).concat(
64352
64427
  validateLists({
@@ -64367,7 +64442,7 @@ async function typeCheck(config, docs) {
64367
64442
  validateLoadingDirective(config)
64368
64443
  );
64369
64444
  for (const { filename, document: parsed, originalString } of docs) {
64370
- for (const error of graphql29.validate(config.schema, parsed, rules(filename))) {
64445
+ for (const error of graphql30.validate(config.schema, parsed, rules(filename))) {
64371
64446
  errors.push(
64372
64447
  new HoudiniError({
64373
64448
  filepath: filename,
@@ -64396,20 +64471,20 @@ function validateRequiredDirective(config, filepath) {
64396
64471
  if (!node.directives?.some(({ name }) => name.value === config.requiredDirective))
64397
64472
  return;
64398
64473
  const parentType = parentTypeFromAncestors(config.schema, filepath, ancestors);
64399
- if (!graphql29.isObjectType(parentType)) {
64474
+ if (!graphql30.isObjectType(parentType)) {
64400
64475
  ctx.reportError(
64401
- new graphql29.GraphQLError(
64476
+ new graphql30.GraphQLError(
64402
64477
  `@${config.requiredDirective} may only be used on objects, not arguments`
64403
64478
  )
64404
64479
  );
64405
64480
  return;
64406
64481
  }
64407
64482
  const type = parentType.getFields()[node.name.value].type;
64408
- const isServerNullable = !graphql29.isNonNullType(type);
64483
+ const isServerNullable = !graphql30.isNonNullType(type);
64409
64484
  const isAlreadyClientNullable = isClientNullable(node, true);
64410
64485
  if (!isServerNullable && !isAlreadyClientNullable) {
64411
64486
  ctx.reportError(
64412
- new graphql29.GraphQLError(
64487
+ new graphql30.GraphQLError(
64413
64488
  `@${config.requiredDirective} may only be used on nullable fields`
64414
64489
  )
64415
64490
  );
@@ -64431,7 +64506,7 @@ var validateLists = ({
64431
64506
  if (!config.isListFragment(node.name.value)) {
64432
64507
  if (!fragments[node.name.value]) {
64433
64508
  ctx.reportError(
64434
- new graphql29.GraphQLError(
64509
+ new graphql30.GraphQLError(
64435
64510
  "Encountered unknown fragment: " + node.name.value
64436
64511
  )
64437
64512
  );
@@ -64441,7 +64516,7 @@ var validateLists = ({
64441
64516
  const listName = config.listNameFromFragment(node.name.value);
64442
64517
  if (!lists.includes(listName)) {
64443
64518
  ctx.reportError(
64444
- new graphql29.GraphQLError(
64519
+ new graphql30.GraphQLError(
64445
64520
  "Encountered fragment referencing unknown list: " + listName
64446
64521
  )
64447
64522
  );
@@ -64466,7 +64541,7 @@ var validateLists = ({
64466
64541
  );
64467
64542
  if (parentArg) {
64468
64543
  ctx.reportError(
64469
- new graphql29.GraphQLError(
64544
+ new graphql30.GraphQLError(
64470
64545
  `@${config.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
64471
64546
  )
64472
64547
  );
@@ -64482,7 +64557,7 @@ var validateLists = ({
64482
64557
  return;
64483
64558
  }
64484
64559
  ctx.reportError(
64485
- new graphql29.GraphQLError(
64560
+ new graphql30.GraphQLError(
64486
64561
  `For this list fragment, you need to add or @${config.listParentDirective} or @${config.listAllListsDirective} directive to specify the behavior`
64487
64562
  )
64488
64563
  );
@@ -64492,7 +64567,7 @@ var validateLists = ({
64492
64567
  const directiveName = node.name.value;
64493
64568
  if (directiveName === "connection") {
64494
64569
  ctx.reportError(
64495
- new graphql29.GraphQLError(
64570
+ new graphql30.GraphQLError(
64496
64571
  "@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."
64497
64572
  )
64498
64573
  );
@@ -64501,7 +64576,7 @@ var validateLists = ({
64501
64576
  if (!config.isInternalDirective(node.name.value)) {
64502
64577
  if (!config.schema.getDirective(directiveName)) {
64503
64578
  ctx.reportError(
64504
- new graphql29.GraphQLError(
64579
+ new graphql30.GraphQLError(
64505
64580
  "Encountered unknown directive: " + directiveName
64506
64581
  )
64507
64582
  );
@@ -64510,7 +64585,7 @@ var validateLists = ({
64510
64585
  }
64511
64586
  if (config.isListOperationDirective(directiveName) && !listTypes.includes(config.listNameFromDirective(directiveName))) {
64512
64587
  ctx.reportError(
64513
- new graphql29.GraphQLError(
64588
+ new graphql30.GraphQLError(
64514
64589
  "Encountered directive referencing unknown list: " + directiveName
64515
64590
  )
64516
64591
  );
@@ -64521,7 +64596,7 @@ var validateLists = ({
64521
64596
  };
64522
64597
  function knownArguments(config) {
64523
64598
  return function(ctx) {
64524
- const nativeValidator = graphql29.KnownArgumentNamesRule(ctx);
64599
+ const nativeValidator = graphql30.KnownArgumentNamesRule(ctx);
64525
64600
  return {
64526
64601
  ...nativeValidator,
64527
64602
  Directive(directiveNode) {
@@ -64556,7 +64631,7 @@ function validateFragmentArguments(config, filepath, fragments) {
64556
64631
  for (const arg of node.arguments || []) {
64557
64632
  if (arg.value.kind !== "ObjectValue") {
64558
64633
  ctx.reportError(
64559
- new graphql29.GraphQLError("values in @arguments must be an object")
64634
+ new graphql30.GraphQLError("values in @arguments must be an object")
64560
64635
  );
64561
64636
  return;
64562
64637
  }
@@ -64566,13 +64641,13 @@ function validateFragmentArguments(config, filepath, fragments) {
64566
64641
  );
64567
64642
  if (!typeArg) {
64568
64643
  ctx.reportError(
64569
- new graphql29.GraphQLError("missing type field for @arguments directive")
64644
+ new graphql30.GraphQLError("missing type field for @arguments directive")
64570
64645
  );
64571
64646
  return;
64572
64647
  }
64573
- if (typeArg.value.kind !== graphql29.Kind.STRING) {
64648
+ if (typeArg.value.kind !== graphql30.Kind.STRING) {
64574
64649
  ctx.reportError(
64575
- new graphql29.GraphQLError("type field to @arguments must be a string")
64650
+ new graphql30.GraphQLError("type field to @arguments must be a string")
64576
64651
  );
64577
64652
  return;
64578
64653
  }
@@ -64585,7 +64660,7 @@ function validateFragmentArguments(config, filepath, fragments) {
64585
64660
  );
64586
64661
  if (typeArg.value.value !== defaultValueType) {
64587
64662
  ctx.reportError(
64588
- new graphql29.GraphQLError(
64663
+ new graphql30.GraphQLError(
64589
64664
  `Invalid default value provided for ${arg.name.value}. Expected ${typeArg.value.value}, found ${defaultValueType}`
64590
64665
  )
64591
64666
  );
@@ -64603,7 +64678,7 @@ function validateFragmentArguments(config, filepath, fragments) {
64603
64678
  try {
64604
64679
  args = fragmentArguments(config, filepath, fragments[fragmentName]);
64605
64680
  } catch (e) {
64606
- ctx.reportError(new graphql29.GraphQLError(e.message));
64681
+ ctx.reportError(new graphql30.GraphQLError(e.message));
64607
64682
  return;
64608
64683
  }
64609
64684
  fragmentArguments2[fragmentName] = args;
@@ -64626,7 +64701,7 @@ function validateFragmentArguments(config, filepath, fragments) {
64626
64701
  );
64627
64702
  if (missing.length > 0) {
64628
64703
  ctx.reportError(
64629
- new graphql29.GraphQLError(
64704
+ new graphql30.GraphQLError(
64630
64705
  `The following arguments are missing from the "${fragmentName}" fragment: ` + JSON.stringify(missing)
64631
64706
  )
64632
64707
  );
@@ -64637,7 +64712,7 @@ function validateFragmentArguments(config, filepath, fragments) {
64637
64712
  );
64638
64713
  if (unknown.length > 0) {
64639
64714
  ctx.reportError(
64640
- new graphql29.GraphQLError(
64715
+ new graphql30.GraphQLError(
64641
64716
  "Encountered unknown arguments: " + JSON.stringify(unknown)
64642
64717
  )
64643
64718
  );
@@ -64649,7 +64724,7 @@ function validateFragmentArguments(config, filepath, fragments) {
64649
64724
  for (const [applied, target] of zipped) {
64650
64725
  if (!valueIsType(config, applied.value, target)) {
64651
64726
  ctx.reportError(
64652
- new graphql29.GraphQLError(
64727
+ new graphql30.GraphQLError(
64653
64728
  `Invalid argument type. Expected ${target}, found ${applied.value.kind}`
64654
64729
  )
64655
64730
  );
@@ -64691,7 +64766,7 @@ function valueIsType(config, value, targetType) {
64691
64766
  }
64692
64767
  if (value.kind === "EnumValue" && targetType.kind === "NamedType") {
64693
64768
  const enumType = config.schema.getType(targetType.name.value);
64694
- if (!graphql29.isEnumType(enumType)) {
64769
+ if (!graphql30.isEnumType(enumType)) {
64695
64770
  return false;
64696
64771
  }
64697
64772
  return enumType.getValues().some((enumValue) => enumValue.value === value.value);
@@ -64711,7 +64786,7 @@ function paginateArgs(config, filepath) {
64711
64786
  }
64712
64787
  if (alreadyPaginated) {
64713
64788
  ctx.reportError(
64714
- new graphql29.GraphQLError(
64789
+ new graphql30.GraphQLError(
64715
64790
  `@${config.paginateDirective} can only appear in a document once.`
64716
64791
  )
64717
64792
  );
@@ -64743,7 +64818,7 @@ function paginateArgs(config, filepath) {
64743
64818
  const backwards = appliedArgs.has("last");
64744
64819
  if (!forward && !backwards) {
64745
64820
  ctx.reportError(
64746
- new graphql29.GraphQLError(
64821
+ new graphql30.GraphQLError(
64747
64822
  "A field with cursor-based pagination must have a first or last argument"
64748
64823
  )
64749
64824
  );
@@ -64757,7 +64832,7 @@ function paginateArgs(config, filepath) {
64757
64832
  }
64758
64833
  if (forward && backwards && paginateMode === "Infinite") {
64759
64834
  ctx.reportError(
64760
- new graphql29.GraphQLError(
64835
+ new graphql30.GraphQLError(
64761
64836
  `A field with cursor pagination cannot go forwards an backwards simultaneously`
64762
64837
  )
64763
64838
  );
@@ -64771,7 +64846,7 @@ function paginateArgs(config, filepath) {
64771
64846
  );
64772
64847
  if (!appliedLimitArg) {
64773
64848
  ctx.reportError(
64774
- new graphql29.GraphQLError(
64849
+ new graphql30.GraphQLError(
64775
64850
  "A field with offset-based pagination must have a limit argument"
64776
64851
  )
64777
64852
  );
@@ -64787,20 +64862,20 @@ function noUnusedFragmentArguments(config) {
64787
64862
  const args = /* @__PURE__ */ new Set();
64788
64863
  return {
64789
64864
  enter(node) {
64790
- if (node.kind === graphql29.Kind.FRAGMENT_DEFINITION) {
64865
+ if (node.kind === graphql30.Kind.FRAGMENT_DEFINITION) {
64791
64866
  const definitionArguments = node.directives?.filter((directive) => directive.name.value === config.argumentsDirective).flatMap((directive) => directive.arguments);
64792
64867
  for (const arg of definitionArguments?.map((arg2) => arg2?.name.value) || []) {
64793
64868
  args.add(arg);
64794
64869
  }
64795
- } else if (node.kind === graphql29.Kind.VARIABLE) {
64870
+ } else if (node.kind === graphql30.Kind.VARIABLE) {
64796
64871
  args.delete(node.name.value);
64797
64872
  }
64798
64873
  },
64799
64874
  leave(node) {
64800
- if (node.kind === graphql29.Kind.FRAGMENT_DEFINITION) {
64875
+ if (node.kind === graphql30.Kind.FRAGMENT_DEFINITION) {
64801
64876
  if (args.size > 0) {
64802
64877
  ctx.reportError(
64803
- new graphql29.GraphQLError(
64878
+ new graphql30.GraphQLError(
64804
64879
  "Encountered unused fragment arguments: " + [...args].join(",")
64805
64880
  )
64806
64881
  );
@@ -64836,7 +64911,7 @@ function nodeDirectives(config, directives) {
64836
64911
  if (definition.kind === "OperationDefinition") {
64837
64912
  if (definition.operation !== "query") {
64838
64913
  ctx.reportError(
64839
- new graphql29.GraphQLError(
64914
+ new graphql30.GraphQLError(
64840
64915
  `@${node.name.value} must fall on a fragment or query document`
64841
64916
  )
64842
64917
  );
@@ -64848,7 +64923,7 @@ function nodeDirectives(config, directives) {
64848
64923
  }
64849
64924
  if (!possibleNodes.includes(definitionType)) {
64850
64925
  ctx.reportError(
64851
- new graphql29.GraphQLError(paginateOnNonNodeMessage(node.name.value))
64926
+ new graphql30.GraphQLError(paginateOnNonNodeMessage(node.name.value))
64852
64927
  );
64853
64928
  }
64854
64929
  }
@@ -64867,7 +64942,7 @@ function checkMutationOperation(config) {
64867
64942
  );
64868
64943
  if (append && prepend) {
64869
64944
  ctx.reportError(
64870
- new graphql29.GraphQLError(
64945
+ new graphql30.GraphQLError(
64871
64946
  `You can't apply both @${config.listPrependDirective} and @${config.listAppendDirective} at the same time`
64872
64947
  )
64873
64948
  );
@@ -64881,7 +64956,7 @@ function checkMutationOperation(config) {
64881
64956
  );
64882
64957
  if (parentId && allLists) {
64883
64958
  ctx.reportError(
64884
- new graphql29.GraphQLError(
64959
+ new graphql30.GraphQLError(
64885
64960
  `You can't apply both @${config.listParentDirective} and @${config.listAllListsDirective} at the same time`
64886
64961
  )
64887
64962
  );
@@ -64903,7 +64978,7 @@ function checkMaskDirectives(config) {
64903
64978
  );
64904
64979
  if (maskEnableDirective && maskDisableDirective) {
64905
64980
  ctx.reportError(
64906
- new graphql29.GraphQLError(
64981
+ new graphql30.GraphQLError(
64907
64982
  `You can't apply both @${config.maskEnableDirective} and @${config.maskDisableDirective} at the same time`
64908
64983
  )
64909
64984
  );
@@ -64945,7 +65020,7 @@ function validateLoadingDirective(config) {
64945
65020
  );
64946
65021
  if (!parentLoading && !global2) {
64947
65022
  ctx.reportError(
64948
- new graphql29.GraphQLError(
65023
+ new graphql30.GraphQLError(
64949
65024
  `@${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}`
64950
65025
  )
64951
65026
  );
@@ -64967,7 +65042,7 @@ function validateLoadingDirective(config) {
64967
65042
  );
64968
65043
  if (!parentLoading && !global2) {
64969
65044
  ctx.reportError(
64970
- new graphql29.GraphQLError(
65045
+ new graphql30.GraphQLError(
64971
65046
  `@${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}`
64972
65047
  )
64973
65048
  );
@@ -64982,7 +65057,7 @@ function getAndVerifyNodeInterface(config) {
64982
65057
  if (!nodeInterface) {
64983
65058
  return null;
64984
65059
  }
64985
- if (!graphql29.isInterfaceType(nodeInterface)) {
65060
+ if (!graphql30.isInterfaceType(nodeInterface)) {
64986
65061
  displayInvalidNodeFieldMessage(config);
64987
65062
  return null;
64988
65063
  }
@@ -65077,11 +65152,11 @@ async function uniqueDocumentNames(config, docs) {
65077
65152
  }
65078
65153
 
65079
65154
  // src/codegen/validators/noIDAlias.ts
65080
- var graphql30 = __toESM(require("graphql"), 1);
65155
+ var graphql31 = __toESM(require("graphql"), 1);
65081
65156
  async function noIDAlias(config, docs) {
65082
65157
  const errors = [];
65083
65158
  for (const { filename, document } of docs) {
65084
- graphql30.visit(document, {
65159
+ graphql31.visit(document, {
65085
65160
  Field(node, _, __, ___, ancestors) {
65086
65161
  const fieldType = parentTypeFromAncestors(config.schema, filename, ancestors).name;
65087
65162
  if (config.keyFieldsForType(fieldType).includes(node.alias?.value || "")) {
@@ -65120,11 +65195,11 @@ async function validatePlugins(config, documents) {
65120
65195
  }
65121
65196
 
65122
65197
  // src/codegen/validators/componentFields.ts
65123
- var graphql31 = __toESM(require("graphql"), 1);
65198
+ var graphql32 = __toESM(require("graphql"), 1);
65124
65199
  async function componentFields2(config, docs) {
65125
65200
  const errors = [];
65126
65201
  for (const { filename: filepath, document } of docs) {
65127
- graphql31.visit(document, {
65202
+ graphql32.visit(document, {
65128
65203
  FragmentDefinition(node, _, __, ___, ancestors) {
65129
65204
  const componentFieldDirective = node.directives?.find(
65130
65205
  (dir) => dir.name.value === config.componentFieldDirective
@@ -65166,14 +65241,26 @@ async function componentFields2(config, docs) {
65166
65241
  }
65167
65242
  const fieldValue = fieldArg.value?.kind === "StringValue" ? fieldArg.value.value : void 0;
65168
65243
  const propValue = propArg.value?.kind === "StringValue" ? propArg.value.value : void 0;
65244
+ const existingField = fieldValue && config.componentFields[parent2]?.[fieldValue];
65169
65245
  const parentType = config.schema.getType(parent2);
65170
- if (parentType && fieldValue && (graphql31.isObjectType(parentType) && parentType.getFields()[fieldValue] || config.componentFields[parent2]?.[fieldValue])) {
65246
+ let conflict = false;
65247
+ if (existingField && existingField.filepath !== filepath) {
65248
+ conflict = true;
65249
+ } else if (parentType && fieldValue) {
65250
+ const fieldDef = graphql32.isObjectType(parentType) && parentType.getFields()[fieldValue];
65251
+ if (fieldDef && !fieldDef.astNode?.directives?.find(
65252
+ (dir) => dir.name.value === config.componentFieldDirective
65253
+ )) {
65254
+ conflict = true;
65255
+ }
65256
+ }
65257
+ if (conflict) {
65171
65258
  errors.push({
65172
- message: `Duplicate component field definition for ${parent2}.${fieldValue}`,
65259
+ message: `Duplicate component field definition for ${parent2}.${fieldValue}.` + (existingField ? "The conflicting component field was defined in " + existingField.filepath : ""),
65173
65260
  filepath
65174
65261
  });
65175
65262
  }
65176
- if (parentType && graphql31.isAbstractType(parentType)) {
65263
+ if (parentType && graphql32.isAbstractType(parentType)) {
65177
65264
  errors.push({
65178
65265
  message: `Cannot add component field ${parent2}.${fieldValue} because ${parent2} is an abstract type`,
65179
65266
  filepath
@@ -65239,6 +65326,7 @@ async function runPipeline2(config, docs) {
65239
65326
  [
65240
65327
  componentFields2,
65241
65328
  graphqlExtensions,
65329
+ addTypename2,
65242
65330
  ...wrapHook(beforeValidate),
65243
65331
  typeCheck,
65244
65332
  uniqueDocumentNames,
@@ -65393,12 +65481,12 @@ async function processJSFile(config, contents) {
65393
65481
  return documents;
65394
65482
  }
65395
65483
  async function processGraphQLDocument(config, filepath, document) {
65396
- const parsedDoc = graphql32.parse(document);
65484
+ const parsedDoc = graphql33.parse(document);
65397
65485
  const operations = parsedDoc.definitions.filter(
65398
- ({ kind: kind2 }) => kind2 === graphql32.Kind.OPERATION_DEFINITION
65486
+ ({ kind: kind2 }) => kind2 === graphql33.Kind.OPERATION_DEFINITION
65399
65487
  );
65400
65488
  const fragments = parsedDoc.definitions.filter(
65401
- ({ kind: kind2 }) => kind2 === graphql32.Kind.FRAGMENT_DEFINITION
65489
+ ({ kind: kind2 }) => kind2 === graphql33.Kind.FRAGMENT_DEFINITION
65402
65490
  );
65403
65491
  if (operations.length > 1) {
65404
65492
  throw new HoudiniError({