houdini 1.2.43 → 1.2.45

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.
Files changed (62) hide show
  1. package/build/cmd-cjs/index.js +684 -786
  2. package/build/cmd-esm/index.js +534 -636
  3. package/build/codegen/generators/artifacts/inputs.d.ts +1 -1
  4. package/build/codegen/generators/comments/jsdoc.d.ts +2 -0
  5. package/build/codegen/transforms/index.d.ts +1 -0
  6. package/build/codegen/transforms/runtimeScalars.d.ts +2 -0
  7. package/build/codegen-cjs/index.js +677 -782
  8. package/build/codegen-esm/index.js +527 -632
  9. package/build/lib/config.d.ts +1 -0
  10. package/build/lib/graphql.d.ts +1 -1
  11. package/build/lib/index.d.ts +1 -0
  12. package/build/lib/typescript.d.ts +19 -0
  13. package/build/lib-cjs/index.js +711 -477
  14. package/build/lib-esm/index.js +705 -477
  15. package/build/runtime/client/index.d.ts +7 -1
  16. package/build/runtime/client/plugins/fragment.d.ts +2 -2
  17. package/build/runtime/client/plugins/mutation.d.ts +2 -1
  18. package/build/runtime/client/plugins/query.d.ts +2 -2
  19. package/build/runtime/lib/config.d.ts +12 -2
  20. package/build/runtime/lib/scalars.d.ts +1 -1
  21. package/build/runtime/lib/types.d.ts +17 -2
  22. package/build/runtime/router/session.d.ts +1 -2
  23. package/build/runtime/router/types.d.ts +3 -1
  24. package/build/runtime-cjs/client/index.d.ts +7 -1
  25. package/build/runtime-cjs/client/index.js +26 -11
  26. package/build/runtime-cjs/client/plugins/fragment.d.ts +2 -2
  27. package/build/runtime-cjs/client/plugins/fragment.js +4 -11
  28. package/build/runtime-cjs/client/plugins/mutation.d.ts +2 -1
  29. package/build/runtime-cjs/client/plugins/mutation.js +8 -15
  30. package/build/runtime-cjs/client/plugins/query.d.ts +2 -2
  31. package/build/runtime-cjs/client/plugins/query.js +18 -11
  32. package/build/runtime-cjs/lib/config.d.ts +12 -2
  33. package/build/runtime-cjs/lib/scalars.d.ts +1 -1
  34. package/build/runtime-cjs/lib/scalars.js +4 -0
  35. package/build/runtime-cjs/lib/types.d.ts +17 -2
  36. package/build/runtime-cjs/router/server.js +2 -3
  37. package/build/runtime-cjs/router/session.d.ts +1 -2
  38. package/build/runtime-cjs/router/session.js +25 -11
  39. package/build/runtime-cjs/router/types.d.ts +3 -1
  40. package/build/runtime-esm/client/index.d.ts +7 -1
  41. package/build/runtime-esm/client/index.js +26 -11
  42. package/build/runtime-esm/client/plugins/fragment.d.ts +2 -2
  43. package/build/runtime-esm/client/plugins/fragment.js +1 -2
  44. package/build/runtime-esm/client/plugins/mutation.d.ts +2 -1
  45. package/build/runtime-esm/client/plugins/mutation.js +1 -2
  46. package/build/runtime-esm/client/plugins/query.d.ts +2 -2
  47. package/build/runtime-esm/client/plugins/query.js +15 -2
  48. package/build/runtime-esm/lib/config.d.ts +12 -2
  49. package/build/runtime-esm/lib/scalars.d.ts +1 -1
  50. package/build/runtime-esm/lib/scalars.js +6 -0
  51. package/build/runtime-esm/lib/types.d.ts +17 -2
  52. package/build/runtime-esm/router/server.js +2 -3
  53. package/build/runtime-esm/router/session.d.ts +1 -2
  54. package/build/runtime-esm/router/session.js +25 -11
  55. package/build/runtime-esm/router/types.d.ts +3 -1
  56. package/build/test-cjs/index.js +706 -785
  57. package/build/test-esm/index.js +556 -635
  58. package/build/vite-cjs/index.js +793 -793
  59. package/build/vite-esm/index.js +643 -643
  60. package/package.json +1 -1
  61. package/build/codegen/generators/typescript/typeReference.d.ts +0 -8
  62. package/build/codegen/generators/typescript/types.d.ts +0 -10
@@ -31868,7 +31868,7 @@ var require_path_visitor = __commonJS({
31868
31868
  }
31869
31869
  return target;
31870
31870
  }
31871
- PathVisitor.visit = function visit19(node, methods) {
31871
+ PathVisitor.visit = function visit20(node, methods) {
31872
31872
  return PathVisitor.fromMethodsObject(methods).visit(node);
31873
31873
  };
31874
31874
  var PVp = PathVisitor.prototype;
@@ -32059,7 +32059,7 @@ var require_path_visitor = __commonJS({
32059
32059
  this.needToCallTraverse = false;
32060
32060
  return visitChildren(path3, PathVisitor.fromMethodsObject(newVisitor || this.visitor));
32061
32061
  };
32062
- sharedContextProtoMethods.visit = function visit19(path3, newVisitor) {
32062
+ sharedContextProtoMethods.visit = function visit20(path3, newVisitor) {
32063
32063
  if (!(this instanceof this.Context)) {
32064
32064
  throw new Error("");
32065
32065
  }
@@ -33452,7 +33452,7 @@ var require_main = __commonJS({
33452
33452
  var someField = _a.someField;
33453
33453
  var Type = _a.Type;
33454
33454
  var use = _a.use;
33455
- var visit19 = _a.visit;
33455
+ var visit20 = _a.visit;
33456
33456
  exports.astNodesAreEquivalent = astNodesAreEquivalent;
33457
33457
  exports.builders = builders;
33458
33458
  exports.builtInTypes = builtInTypes;
@@ -33469,7 +33469,7 @@ var require_main = __commonJS({
33469
33469
  exports.someField = someField;
33470
33470
  exports.Type = Type;
33471
33471
  exports.use = use;
33472
- exports.visit = visit19;
33472
+ exports.visit = visit20;
33473
33473
  Object.assign(namedTypes_1.namedTypes, n);
33474
33474
  }
33475
33475
  });
@@ -64576,47 +64576,6 @@ function deepMerge(...objects) {
64576
64576
  return mergedObj;
64577
64577
  }
64578
64578
 
64579
- // src/runtime/lib/scalars.ts
64580
- async function marshalSelection({
64581
- selection,
64582
- data
64583
- }) {
64584
- const config2 = getCurrentConfig();
64585
- if (data === null || typeof data === "undefined") {
64586
- return data;
64587
- }
64588
- if (Array.isArray(data)) {
64589
- return await Promise.all(data.map((val) => marshalSelection({ selection, data: val })));
64590
- }
64591
- const targetSelection = getFieldsForType(selection, data["__typename"], false);
64592
- return Object.fromEntries(
64593
- await Promise.all(
64594
- Object.entries(data).map(async ([fieldName, value]) => {
64595
- const { type, selection: selection2 } = targetSelection[fieldName];
64596
- if (!type) {
64597
- return [fieldName, value];
64598
- }
64599
- if (selection2) {
64600
- return [fieldName, await marshalSelection({ selection: selection2, data: value })];
64601
- }
64602
- if (config2.scalars?.[type]) {
64603
- const marshalFn = config2.scalars[type].marshal;
64604
- if (!marshalFn) {
64605
- throw new Error(
64606
- `scalar type ${type} is missing a \`marshal\` function. see https://github.com/AlecAivazis/houdini#%EF%B8%8Fcustom-scalars`
64607
- );
64608
- }
64609
- if (Array.isArray(value)) {
64610
- return [fieldName, value.map(marshalFn)];
64611
- }
64612
- return [fieldName, marshalFn(value)];
64613
- }
64614
- return [fieldName, value];
64615
- })
64616
- )
64617
- );
64618
- }
64619
-
64620
64579
  // src/runtime/lib/types.ts
64621
64580
  var CachePolicy = {
64622
64581
  CacheOrNetwork: "CacheOrNetwork",
@@ -64644,11 +64603,6 @@ var RefetchUpdateMode = {
64644
64603
  prepend: "prepend",
64645
64604
  replace: "replace"
64646
64605
  };
64647
- var DataSource = {
64648
- Cache: "cache",
64649
- Network: "network",
64650
- Ssr: "ssr"
64651
- };
64652
64606
  var fragmentKey = " $fragments";
64653
64607
  var PendingValue = Symbol("houdini_loading");
64654
64608
 
@@ -68419,188 +68373,6 @@ var cache_default = new Cache();
68419
68373
  // src/runtime/client/plugins/cache.ts
68420
68374
  var serverSide = typeof globalThis.window === "undefined";
68421
68375
 
68422
- // src/runtime/client/utils/documentPlugins.ts
68423
- var documentPlugin = (kind, source) => {
68424
- return () => {
68425
- const sourceHandlers = source();
68426
- const enterWrapper = (handler) => {
68427
- return !handler ? void 0 : (ctx, handlers) => {
68428
- if (ctx.artifact.kind !== kind) {
68429
- return handlers.next(ctx);
68430
- }
68431
- return handler(ctx, handlers);
68432
- };
68433
- };
68434
- const exitWrapper = (handler) => {
68435
- return !handler ? void 0 : (ctx, handlers) => {
68436
- if (ctx.artifact.kind !== kind) {
68437
- return handlers.resolve(ctx);
68438
- }
68439
- return handler(ctx, handlers);
68440
- };
68441
- };
68442
- return {
68443
- start: enterWrapper(sourceHandlers.start),
68444
- network: enterWrapper(sourceHandlers.network),
68445
- afterNetwork: exitWrapper(sourceHandlers.afterNetwork),
68446
- end: exitWrapper(sourceHandlers.end),
68447
- catch: sourceHandlers.catch ? (ctx, handlers) => sourceHandlers.catch(ctx, handlers) : void 0,
68448
- cleanup: (...args) => sourceHandlers.cleanup?.(...args)
68449
- };
68450
- };
68451
- };
68452
-
68453
- // src/runtime/client/plugins/query.ts
68454
- var query = documentPlugin(ArtifactKind.Query, function() {
68455
- let subscriptionSpec = null;
68456
- let lastVariables = null;
68457
- return {
68458
- start(ctx, { next }) {
68459
- ctx.variables = {
68460
- ...lastVariables,
68461
- ...ctx.variables
68462
- };
68463
- next(ctx);
68464
- },
68465
- end(ctx, { resolve: resolve2, marshalVariables, variablesChanged }) {
68466
- if (variablesChanged(ctx) && !ctx.cacheParams?.disableSubscriptions) {
68467
- if (subscriptionSpec) {
68468
- cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
68469
- }
68470
- lastVariables = { ...marshalVariables(ctx) };
68471
- const variables = lastVariables;
68472
- subscriptionSpec = {
68473
- rootType: ctx.artifact.rootType,
68474
- selection: ctx.artifact.selection,
68475
- variables: () => variables,
68476
- set: (newValue) => {
68477
- resolve2(ctx, {
68478
- data: newValue,
68479
- errors: null,
68480
- fetching: false,
68481
- partial: false,
68482
- stale: false,
68483
- source: DataSource.Cache,
68484
- variables: ctx.variables ?? {}
68485
- });
68486
- }
68487
- };
68488
- cache_default.subscribe(subscriptionSpec, lastVariables);
68489
- }
68490
- resolve2(ctx);
68491
- },
68492
- cleanup() {
68493
- if (subscriptionSpec) {
68494
- cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.());
68495
- lastVariables = null;
68496
- }
68497
- }
68498
- };
68499
- });
68500
-
68501
- // src/runtime/client/plugins/fragment.ts
68502
- var fragment = documentPlugin(ArtifactKind.Fragment, function() {
68503
- let subscriptionSpec = null;
68504
- let lastReference = null;
68505
- return {
68506
- start(ctx, { next, resolve: resolve2, variablesChanged, marshalVariables }) {
68507
- if (!ctx.stuff.parentID) {
68508
- return next(ctx);
68509
- }
68510
- const currentReference = {
68511
- parent: ctx.stuff.parentID,
68512
- variables: marshalVariables(ctx)
68513
- };
68514
- if (!ctx.cacheParams?.disableSubscriptions && (!deepEquals(lastReference, currentReference) || variablesChanged(ctx))) {
68515
- if (subscriptionSpec) {
68516
- cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
68517
- }
68518
- const variables = marshalVariables(ctx);
68519
- subscriptionSpec = {
68520
- rootType: ctx.artifact.rootType,
68521
- selection: ctx.artifact.selection,
68522
- variables: () => variables,
68523
- parentID: ctx.stuff.parentID,
68524
- set: (newValue) => {
68525
- resolve2(ctx, {
68526
- data: newValue,
68527
- errors: null,
68528
- fetching: false,
68529
- partial: false,
68530
- stale: false,
68531
- source: DataSource.Cache,
68532
- variables
68533
- });
68534
- }
68535
- };
68536
- cache_default.subscribe(subscriptionSpec, variables);
68537
- lastReference = currentReference;
68538
- }
68539
- next(ctx);
68540
- },
68541
- cleanup() {
68542
- if (subscriptionSpec) {
68543
- cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.());
68544
- }
68545
- }
68546
- };
68547
- });
68548
-
68549
- // src/runtime/client/plugins/mutation.ts
68550
- var mutation = documentPlugin(ArtifactKind.Mutation, () => {
68551
- return {
68552
- async start(ctx, { next, marshalVariables }) {
68553
- const layerOptimistic = cache_default._internal_unstable.storage.createLayer(true);
68554
- const optimisticResponse = ctx.stuff.optimisticResponse;
68555
- let toNotify = [];
68556
- if (optimisticResponse) {
68557
- toNotify = cache_default.write({
68558
- selection: ctx.artifact.selection,
68559
- data: await marshalSelection({
68560
- selection: ctx.artifact.selection,
68561
- data: optimisticResponse
68562
- }),
68563
- variables: marshalVariables(ctx),
68564
- layer: layerOptimistic.id
68565
- });
68566
- }
68567
- ctx.cacheParams = {
68568
- ...ctx.cacheParams,
68569
- layer: layerOptimistic,
68570
- notifySubscribers: toNotify,
68571
- forceNotify: true
68572
- };
68573
- next(ctx);
68574
- },
68575
- afterNetwork(ctx, { resolve: resolve2 }) {
68576
- if (ctx.cacheParams?.layer) {
68577
- cache_default.clearLayer(ctx.cacheParams.layer.id);
68578
- }
68579
- resolve2(ctx);
68580
- },
68581
- end(ctx, { resolve: resolve2, value }) {
68582
- const hasErrors = value.errors && value.errors.length > 0;
68583
- if (hasErrors) {
68584
- if (ctx.cacheParams?.layer) {
68585
- cache_default.clearLayer(ctx.cacheParams.layer.id);
68586
- }
68587
- }
68588
- if (ctx.cacheParams?.layer) {
68589
- cache_default._internal_unstable.storage.resolveLayer(ctx.cacheParams.layer.id);
68590
- }
68591
- resolve2(ctx);
68592
- },
68593
- catch(ctx, { error }) {
68594
- if (ctx.cacheParams?.layer) {
68595
- const { layer } = ctx.cacheParams;
68596
- cache_default.clearLayer(layer.id);
68597
- cache_default._internal_unstable.storage.resolveLayer(layer.id);
68598
- }
68599
- throw error;
68600
- }
68601
- };
68602
- });
68603
-
68604
68376
  // src/lib/types.ts
68605
68377
  var LogLevel = {
68606
68378
  Full: "full",
@@ -69037,6 +68809,9 @@ var Config = class {
69037
68809
  get loadingDirective() {
69038
68810
  return `loading`;
69039
68811
  }
68812
+ get runtimeScalarDirective() {
68813
+ return "__houdini__runtimeScalar";
68814
+ }
69040
68815
  get whenDirective() {
69041
68816
  return "when";
69042
68817
  }
@@ -69107,7 +68882,7 @@ var Config = class {
69107
68882
  const internalDirectives = this.#newSchemaInstance?.getDirectives().reduce((list, directive) => {
69108
68883
  return list.concat(directive.name);
69109
68884
  }, []) ?? [];
69110
- return !defaultDirectives.includes(name) && (internalDirectives.includes(name) || this.isDeleteDirective(name));
68885
+ return !defaultDirectives.includes(name) && (internalDirectives.includes(name) || this.isDeleteDirective(name) || name === this.runtimeScalarDirective);
69111
68886
  }
69112
68887
  get componentFieldDirective() {
69113
68888
  return "componentField";
@@ -69610,7 +69385,7 @@ function formatErrors(e2, afterError) {
69610
69385
  afterError?.(e2);
69611
69386
  }
69612
69387
  }
69613
- function unwrapType(config2, type, wrappers = []) {
69388
+ function unwrapType(config2, type, wrappers = [], convertRuntimeScalars) {
69614
69389
  if (type.kind === "NonNullType") {
69615
69390
  return unwrapType(config2, type.type, [TypeWrapper.NonNull, ...wrappers]);
69616
69391
  }
@@ -69626,9 +69401,14 @@ function unwrapType(config2, type, wrappers = []) {
69626
69401
  if (type instanceof graphql3.GraphQLList) {
69627
69402
  return unwrapType(config2, type.ofType, [TypeWrapper.List, ...wrappers]);
69628
69403
  }
69404
+ if (convertRuntimeScalars && config2.configFile.features?.runtimeScalars?.[type.name.value]) {
69405
+ type = config2.schema.getType(
69406
+ config2.configFile.features?.runtimeScalars?.[type.name.value].type
69407
+ );
69408
+ }
69629
69409
  const namedType = config2.schema.getType(type.name.value || type.name);
69630
69410
  if (!namedType) {
69631
- throw new Error("Could not unwrap type: " + JSON.stringify(type));
69411
+ throw new Error("Unknown type: " + type.name.value || type.name);
69632
69412
  }
69633
69413
  return { type: namedType, wrappers };
69634
69414
  }
@@ -69765,6 +69545,231 @@ async function cleanupFiles(pathFolder, listOfObj) {
69765
69545
  return allFilesNotInList;
69766
69546
  }
69767
69547
 
69548
+ // src/runtime/router/match.ts
69549
+ var param_pattern = /^(\[)?(\.\.\.)?(\w+)(?:=(\w+))?(\])?$/;
69550
+ function parse_page_pattern(id) {
69551
+ const params = [];
69552
+ const pattern = id === "/" ? /^\/$/ : new RegExp(
69553
+ `^${get_route_segments(id).map((segment) => {
69554
+ const rest_match = /^\[\.\.\.(\w+)(?:=(\w+))?\]$/.exec(segment);
69555
+ if (rest_match) {
69556
+ params.push({
69557
+ name: rest_match[1],
69558
+ matcher: rest_match[2],
69559
+ optional: false,
69560
+ rest: true,
69561
+ chained: true
69562
+ });
69563
+ return "(?:/(.*))?";
69564
+ }
69565
+ const optional_match = /^\[\[(\w+)(?:=(\w+))?\]\]$/.exec(segment);
69566
+ if (optional_match) {
69567
+ params.push({
69568
+ name: optional_match[1],
69569
+ matcher: optional_match[2],
69570
+ optional: true,
69571
+ rest: false,
69572
+ chained: true
69573
+ });
69574
+ return "(?:/([^/]+))?";
69575
+ }
69576
+ if (!segment) {
69577
+ return;
69578
+ }
69579
+ const parts = segment.split(/\[(.+?)\](?!\])/);
69580
+ const result = parts.map((content, i2) => {
69581
+ if (i2 % 2) {
69582
+ if (content.startsWith("x+")) {
69583
+ return escape2(
69584
+ String.fromCharCode(parseInt(content.slice(2), 16))
69585
+ );
69586
+ }
69587
+ if (content.startsWith("u+")) {
69588
+ return escape2(
69589
+ String.fromCharCode(
69590
+ ...content.slice(2).split("-").map((code) => parseInt(code, 16))
69591
+ )
69592
+ );
69593
+ }
69594
+ const match = param_pattern.exec(content);
69595
+ if (!match) {
69596
+ throw new Error(
69597
+ `Invalid param: ${content}. Params and matcher names can only have underscores and alphanumeric characters.`
69598
+ );
69599
+ }
69600
+ const [, is_optional, is_rest, name, matcher] = match;
69601
+ params.push({
69602
+ name,
69603
+ matcher,
69604
+ optional: !!is_optional,
69605
+ rest: !!is_rest,
69606
+ chained: is_rest ? i2 === 1 && parts[0] === "" : false
69607
+ });
69608
+ return is_rest ? "(.*?)" : is_optional ? "([^/]*)?" : "([^/]+?)";
69609
+ }
69610
+ return escape2(content);
69611
+ }).join("");
69612
+ return "/" + result;
69613
+ }).join("")}/?$`
69614
+ );
69615
+ return { pattern, params, page_id: id };
69616
+ }
69617
+ function affects_path(segment) {
69618
+ return !/^\([^)]+\)$/.test(segment);
69619
+ }
69620
+ function get_route_segments(route) {
69621
+ return route.slice(1).split("/").filter(affects_path);
69622
+ }
69623
+ function escape2(str) {
69624
+ return str.normalize().replace(/[[\]]/g, "\\$&").replace(/%/g, "%25").replace(/\//g, "%2[Ff]").replace(/\?/g, "%3[Ff]").replace(/#/g, "%23").replace(/[.*+?^${}()|\\]/g, "\\$&");
69625
+ }
69626
+
69627
+ // src/lib/typescript.ts
69628
+ var recast2 = __toESM(require_main2(), 1);
69629
+ import * as graphql4 from "graphql";
69630
+ var AST2 = recast2.types.builders;
69631
+ function unwrappedTsTypeReference(config2, filepath, missingScalars, {
69632
+ type,
69633
+ wrappers
69634
+ }, body) {
69635
+ let result;
69636
+ if (graphql4.isScalarType(type)) {
69637
+ result = scalarPropertyValue(config2, filepath, missingScalars, type, body, null);
69638
+ } else if (graphql4.isEnumType(type)) {
69639
+ result = enumReference(config2, body, type.name);
69640
+ } else {
69641
+ result = AST2.tsTypeReference(AST2.identifier(type.name));
69642
+ }
69643
+ for (const toWrap of wrappers) {
69644
+ if (toWrap === "NonNull" /* NonNull */) {
69645
+ continue;
69646
+ } else if (toWrap === "Nullable" /* Nullable */) {
69647
+ result = nullableField(result, true);
69648
+ } else if (toWrap === "List" /* List */) {
69649
+ result = AST2.tsArrayType(AST2.tsParenthesizedType(result));
69650
+ }
69651
+ }
69652
+ return result;
69653
+ }
69654
+ function tsTypeReference(config2, filepath, missingScalars, definition, body) {
69655
+ const { type, wrappers } = unwrapType(config2, definition.type);
69656
+ return unwrappedTsTypeReference(
69657
+ config2,
69658
+ filepath,
69659
+ missingScalars,
69660
+ { type, wrappers },
69661
+ body
69662
+ );
69663
+ }
69664
+ function enumReference(config2, body, name) {
69665
+ ensureImports({
69666
+ config: config2,
69667
+ body,
69668
+ import: ["ValueOf"],
69669
+ importKind: "type",
69670
+ sourceModule: "$houdini/runtime/lib/types"
69671
+ });
69672
+ return AST2.tsTypeReference(
69673
+ AST2.identifier("ValueOf"),
69674
+ AST2.tsTypeParameterInstantiation([AST2.tsTypeQuery(AST2.identifier(name))])
69675
+ );
69676
+ }
69677
+ function readonlyProperty(prop, enable = true) {
69678
+ if (enable) {
69679
+ prop.readonly = true;
69680
+ }
69681
+ return prop;
69682
+ }
69683
+ function nullableField(inner, input = false) {
69684
+ const members = [inner, AST2.tsNullKeyword()];
69685
+ if (input) {
69686
+ members.push(AST2.tsUndefinedKeyword());
69687
+ }
69688
+ return AST2.tsUnionType(members);
69689
+ }
69690
+ function scalarPropertyValue(config2, filepath, missingScalars, target, body, field) {
69691
+ if (config2.configFile.features?.componentFields && target.name === config2.componentScalar) {
69692
+ if (!field) {
69693
+ return AST2.tsNeverKeyword();
69694
+ }
69695
+ const component = config2.componentFields[field.parent][field.field];
69696
+ const sourcePathRelative = path_exports.relative(
69697
+ path_exports.join(config2.projectRoot, "src"),
69698
+ component.filepath
69699
+ );
69700
+ let sourcePathParsed = path_exports.parse(sourcePathRelative);
69701
+ let sourcePath = path_exports.join(sourcePathParsed.dir, sourcePathParsed.name);
69702
+ const localImport = ensureImports({
69703
+ config: config2,
69704
+ body,
69705
+ import: "__component__" + component.fragment,
69706
+ sourceModule: path_exports.join(
69707
+ path_exports.relative(path_exports.dirname(filepath), config2.projectRoot),
69708
+ "src",
69709
+ sourcePath
69710
+ )
69711
+ }) ?? "__component__" + component.fragment;
69712
+ const parameters = AST2.tsTypeReference(AST2.identifier("Parameters"));
69713
+ parameters.typeParameters = AST2.tsTypeParameterInstantiation([
69714
+ AST2.tsTypeQuery(AST2.identifier(localImport))
69715
+ ]);
69716
+ const indexed = AST2.tsIndexedAccessType(
69717
+ parameters,
69718
+ AST2.tsLiteralType(AST2.numericLiteral(0))
69719
+ );
69720
+ const omit = AST2.tsTypeReference(AST2.identifier("Omit"));
69721
+ omit.typeParameters = AST2.tsTypeParameterInstantiation([
69722
+ indexed,
69723
+ AST2.tsLiteralType(AST2.stringLiteral(component.prop))
69724
+ ]);
69725
+ const arg = AST2.identifier("props");
69726
+ arg.typeAnnotation = AST2.tsTypeAnnotation(omit);
69727
+ const returnType = AST2.tsTypeReference(AST2.identifier("ReturnType"));
69728
+ returnType.typeParameters = AST2.tsTypeParameterInstantiation([
69729
+ AST2.tsTypeQuery(AST2.identifier(localImport))
69730
+ ]);
69731
+ const fnType = AST2.tsFunctionType([arg]);
69732
+ fnType.typeAnnotation = AST2.tsTypeAnnotation(returnType);
69733
+ return fnType;
69734
+ }
69735
+ switch (target.name) {
69736
+ case "String": {
69737
+ return AST2.tsStringKeyword();
69738
+ }
69739
+ case "Int": {
69740
+ return AST2.tsNumberKeyword();
69741
+ }
69742
+ case "Float": {
69743
+ return AST2.tsNumberKeyword();
69744
+ }
69745
+ case "Boolean": {
69746
+ return AST2.tsBooleanKeyword();
69747
+ }
69748
+ case "ID": {
69749
+ return AST2.tsStringKeyword();
69750
+ }
69751
+ default: {
69752
+ if (graphql4.isNonNullType(target) && "ofType" in target) {
69753
+ return scalarPropertyValue(
69754
+ config2,
69755
+ filepath,
69756
+ missingScalars,
69757
+ target.ofType,
69758
+ body,
69759
+ field
69760
+ );
69761
+ }
69762
+ if (config2.scalars?.[target.name]) {
69763
+ return AST2.tsTypeReference(AST2.identifier(config2.scalars?.[target.name].type));
69764
+ }
69765
+ if (target.name !== config2.componentScalar) {
69766
+ missingScalars.add(target.name);
69767
+ }
69768
+ return AST2.tsAnyKeyword();
69769
+ }
69770
+ }
69771
+ }
69772
+
69768
69773
  // ../../node_modules/.pnpm/estree-walker@3.0.1/node_modules/estree-walker/src/walker.js
69769
69774
  var WalkerBase = class {
69770
69775
  constructor() {
@@ -69878,7 +69883,7 @@ async function asyncWalk(ast, { enter, leave }) {
69878
69883
  }
69879
69884
 
69880
69885
  // src/lib/walk.ts
69881
- import * as graphql4 from "graphql";
69886
+ import * as graphql5 from "graphql";
69882
69887
  async function find_graphql(config2, parsedScript, walker) {
69883
69888
  await asyncWalk(parsedScript, {
69884
69889
  async enter(node, parent2) {
@@ -69933,7 +69938,7 @@ async function find_graphql(config2, parsedScript, walker) {
69933
69938
  } else if (!documentString) {
69934
69939
  return;
69935
69940
  }
69936
- const parsedTag = graphql4.parse(documentString);
69941
+ const parsedTag = graphql5.parse(documentString);
69937
69942
  if (walker.where && !walker.where(parsedTag, { node, parent: parent2 })) {
69938
69943
  return;
69939
69944
  }
@@ -70065,7 +70070,7 @@ function extractAnonymousQuery(config2, raw, expr, propName) {
70065
70070
  };
70066
70071
  return defs.concat([
70067
70072
  {
70068
- raw: graphql4.print(parsed),
70073
+ raw: graphql5.print(parsed),
70069
70074
  parsed
70070
70075
  }
70071
70076
  ]);
@@ -70206,7 +70211,7 @@ function serialized_manifest_path(config2, base = base_dir(config2)) {
70206
70211
 
70207
70212
  // src/lib/router/manifest.ts
70208
70213
  var t2 = __toESM(require_lib6(), 1);
70209
- import * as graphql5 from "graphql";
70214
+ import * as graphql6 from "graphql";
70210
70215
  async function load_manifest(args) {
70211
70216
  const manifest = await walk_routes({
70212
70217
  config: args.config,
@@ -70223,7 +70228,8 @@ async function load_manifest(args) {
70223
70228
  local_yoga: false
70224
70229
  },
70225
70230
  queries: [],
70226
- layouts: []
70231
+ layouts: [],
70232
+ variables: {}
70227
70233
  });
70228
70234
  if (args.includeArtifacts) {
70229
70235
  try {
@@ -70254,6 +70260,7 @@ async function walk_routes(args) {
70254
70260
  const directory_contents = await fs_exports.readdir(args.filepath, {
70255
70261
  withFileTypes: true
70256
70262
  });
70263
+ const variables = { ...args.variables };
70257
70264
  let newLayouts = args.layouts;
70258
70265
  let newLayoutQueries = args.queries;
70259
70266
  let layout = null;
@@ -70277,7 +70284,8 @@ async function walk_routes(args) {
70277
70284
  url: args.url,
70278
70285
  project: args.project,
70279
70286
  type: "layout",
70280
- contents: layoutQueryContents
70287
+ contents: layoutQueryContents,
70288
+ variables
70281
70289
  });
70282
70290
  newLayoutQueries = [...args.queries, layoutQuery.name];
70283
70291
  }
@@ -70290,7 +70298,8 @@ async function walk_routes(args) {
70290
70298
  contents: layoutViewContents,
70291
70299
  layouts: args.layouts,
70292
70300
  queries: newLayoutQueries,
70293
- config: args.config
70301
+ config: args.config,
70302
+ variables
70294
70303
  });
70295
70304
  newLayouts = [...args.layouts, page_id(layout.url)];
70296
70305
  }
@@ -70301,7 +70310,8 @@ async function walk_routes(args) {
70301
70310
  url: args.url,
70302
70311
  project: args.project,
70303
70312
  type: "page",
70304
- contents: pageQueryContents
70313
+ contents: pageQueryContents,
70314
+ variables
70305
70315
  });
70306
70316
  }
70307
70317
  if (pageViewContents) {
@@ -70313,7 +70323,8 @@ async function walk_routes(args) {
70313
70323
  contents: pageViewContents,
70314
70324
  layouts: newLayouts,
70315
70325
  queries: pageQuery ? [...newLayoutQueries, pageQuery.name] : newLayoutQueries,
70316
- config: args.config
70326
+ config: args.config,
70327
+ variables
70317
70328
  });
70318
70329
  }
70319
70330
  await Promise.all(
@@ -70326,7 +70337,8 @@ async function walk_routes(args) {
70326
70337
  filepath: path_exports.join(args.filepath, dir.name),
70327
70338
  url: `${args.url}${dir.name}/`,
70328
70339
  queries: newLayoutQueries,
70329
- layouts: newLayouts
70340
+ layouts: newLayouts,
70341
+ variables
70330
70342
  });
70331
70343
  })
70332
70344
  );
@@ -70348,12 +70360,18 @@ async function add_view(args) {
70348
70360
  url: args.url,
70349
70361
  layouts: args.layouts,
70350
70362
  path: path_exports.relative(args.config.projectRoot, args.path),
70351
- query_options: args.queries
70363
+ query_options: args.queries,
70364
+ params: Object.fromEntries(
70365
+ parse_page_pattern(args.url).params.map((param) => [
70366
+ param.name,
70367
+ args.variables[param.name] ?? null
70368
+ ])
70369
+ )
70352
70370
  };
70353
70371
  return target[id];
70354
70372
  }
70355
70373
  async function add_query(args) {
70356
- const parsed = graphql5.parse(args.contents);
70374
+ const parsed = graphql6.parse(args.contents);
70357
70375
  const query2 = parsed.definitions.find(
70358
70376
  (def) => def.kind === "OperationDefinition" && def.operation === "query"
70359
70377
  );
@@ -70361,20 +70379,30 @@ async function add_query(args) {
70361
70379
  throw new Error("No query found");
70362
70380
  }
70363
70381
  let loading = false;
70364
- await graphql5.visit(parsed, {
70382
+ await graphql6.visit(parsed, {
70365
70383
  Directive(node) {
70366
70384
  if (node.name.value === args.config.loadingDirective) {
70367
70385
  loading = true;
70368
70386
  }
70369
70387
  }
70370
70388
  });
70389
+ const queryVariables = Object.fromEntries(
70390
+ query2.variableDefinitions?.map((variable) => {
70391
+ const { type, wrappers } = unwrapType(args.config, variable.type, [], true);
70392
+ return [
70393
+ variable.variable.name.value,
70394
+ { wrappers, type: type.name }
70395
+ ];
70396
+ }) ?? []
70397
+ );
70398
+ Object.assign(args.variables, queryVariables);
70371
70399
  const target = args.type === "page" ? args.project.page_queries : args.project.layout_queries;
70372
70400
  target[page_id(args.url)] = {
70373
70401
  path: path_exports.relative(args.config.routesDir, args.path),
70374
70402
  name: query2.name.value,
70375
70403
  url: args.url,
70376
70404
  loading,
70377
- variables: query2.variableDefinitions?.map((variable) => variable.variable.name.value) ?? []
70405
+ variables: queryVariables
70378
70406
  };
70379
70407
  return target[page_id(args.url)];
70380
70408
  }
@@ -70470,8 +70498,8 @@ async function loadLocalSchema(config2) {
70470
70498
  }
70471
70499
 
70472
70500
  // src/codegen/generators/artifacts/index.ts
70473
- var recast4 = __toESM(require_main2(), 1);
70474
- import * as graphql16 from "graphql";
70501
+ var recast5 = __toESM(require_main2(), 1);
70502
+ import * as graphql17 from "graphql";
70475
70503
 
70476
70504
  // src/codegen/utils/commonjs.ts
70477
70505
  var cjsIndexFilePreamble = `"use strict";
@@ -70713,19 +70741,19 @@ var FieldCollection = class {
70713
70741
  };
70714
70742
 
70715
70743
  // src/codegen/utils/moduleExport.ts
70716
- var recast2 = __toESM(require_main2(), 1);
70717
- var AST2 = recast2.types.builders;
70744
+ var recast3 = __toESM(require_main2(), 1);
70745
+ var AST3 = recast3.types.builders;
70718
70746
  function moduleExport(config2, key, value) {
70719
70747
  if (config2.module === "commonjs") {
70720
- let target = AST2.memberExpression(AST2.identifier("module"), AST2.identifier("exports"));
70748
+ let target = AST3.memberExpression(AST3.identifier("module"), AST3.identifier("exports"));
70721
70749
  if (key !== "default") {
70722
- target = AST2.memberExpression(target, AST2.identifier(key));
70750
+ target = AST3.memberExpression(target, AST3.identifier(key));
70723
70751
  }
70724
- return AST2.expressionStatement(AST2.assignmentExpression("=", target, value));
70752
+ return AST3.expressionStatement(AST3.assignmentExpression("=", target, value));
70725
70753
  }
70726
- return key === "default" ? AST2.exportDefaultDeclaration(value) : AST2.exportNamedDeclaration(
70727
- AST2.variableDeclaration("const", [
70728
- AST2.variableDeclarator(AST2.identifier(key), value)
70754
+ return key === "default" ? AST3.exportDefaultDeclaration(value) : AST3.exportNamedDeclaration(
70755
+ AST3.variableDeclaration("const", [
70756
+ AST3.variableDeclarator(AST3.identifier(key), value)
70729
70757
  ])
70730
70758
  );
70731
70759
  }
@@ -70982,7 +71010,7 @@ var serialize = (value, { json, lossy } = {}) => {
70982
71010
  var esm_default = typeof structuredClone === "function" ? (any, options) => options && ("json" in options || "lossy" in options) ? deserialize(serialize(any, options)) : structuredClone(any) : (any, options) => deserialize(serialize(any, options));
70983
71011
 
70984
71012
  // src/codegen/transforms/fragmentVariables.ts
70985
- import * as graphql7 from "graphql";
71013
+ import * as graphql8 from "graphql";
70986
71014
 
70987
71015
  // src/codegen/utils/stripLoc.ts
70988
71016
  function stripLoc(value) {
@@ -71003,7 +71031,7 @@ function stripLoc(value) {
71003
71031
  }
71004
71032
 
71005
71033
  // src/codegen/transforms/collectDefinitions.ts
71006
- import * as graphql6 from "graphql";
71034
+ import * as graphql7 from "graphql";
71007
71035
  import { Kind as GraphqlKinds } from "graphql";
71008
71036
  async function includeFragmentDefinitions(config2, documents) {
71009
71037
  const fragments = collectDefinitions(config2, documents);
@@ -71053,10 +71081,10 @@ function collectDefinitions(config2, docs) {
71053
71081
  }
71054
71082
  function findRequiredFragments(config2, definition) {
71055
71083
  const referencedFragments = [];
71056
- const typeInfo = new graphql6.TypeInfo(config2.schema);
71057
- definition.selectionSet = graphql6.visit(
71084
+ const typeInfo = new graphql7.TypeInfo(config2.schema);
71085
+ definition.selectionSet = graphql7.visit(
71058
71086
  definition,
71059
- graphql6.visitWithTypeInfo(typeInfo, {
71087
+ graphql7.visitWithTypeInfo(typeInfo, {
71060
71088
  FragmentSpread(node) {
71061
71089
  referencedFragments.push(node.name.value);
71062
71090
  }
@@ -71090,7 +71118,7 @@ function flattenFragments(filepath, operation, fragments) {
71090
71118
  }
71091
71119
 
71092
71120
  // src/codegen/transforms/fragmentVariables.ts
71093
- var GraphqlKinds2 = graphql7.Kind;
71121
+ var GraphqlKinds2 = graphql8.Kind;
71094
71122
  async function fragmentVariables(config2, documents) {
71095
71123
  const fragments = collectDefinitions(config2, documents);
71096
71124
  const generatedFragments = {};
@@ -71113,7 +71141,7 @@ async function fragmentVariables(config2, documents) {
71113
71141
  });
71114
71142
  }
71115
71143
  const doc = {
71116
- kind: graphql7.Kind.DOCUMENT,
71144
+ kind: graphql8.Kind.DOCUMENT,
71117
71145
  definitions: Object.values(generatedFragments)
71118
71146
  };
71119
71147
  documents.push({
@@ -71184,7 +71212,7 @@ function inlineFragmentArgs({
71184
71212
  return null;
71185
71213
  };
71186
71214
  const result = esm_default(
71187
- graphql7.visit(document, {
71215
+ graphql8.visit(document, {
71188
71216
  FragmentSpread(node) {
71189
71217
  if (!fragmentDefinitions[node.name.value]) {
71190
71218
  throw new Error("Could not find definition for fragment" + node.name.value);
@@ -71270,7 +71298,7 @@ function inlineFragmentArgs({
71270
71298
  );
71271
71299
  if (newName) {
71272
71300
  result.name = {
71273
- kind: graphql7.Kind.NAME,
71301
+ kind: graphql8.Kind.NAME,
71274
71302
  value: newName
71275
71303
  };
71276
71304
  }
@@ -71437,8 +71465,8 @@ ${exportDefaultFrom(`./${doc.name}`, doc.name)}`,
71437
71465
  }
71438
71466
 
71439
71467
  // src/codegen/generators/artifacts/inputs.ts
71440
- import * as graphql8 from "graphql";
71441
- function inputObject(config2, inputs) {
71468
+ import * as graphql9 from "graphql";
71469
+ function inputObject(config2, inputs, runtimeScalars) {
71442
71470
  const visitedTypes = /* @__PURE__ */ new Set();
71443
71471
  const inputObj = {
71444
71472
  fields: inputs.reduce((fields, input) => {
@@ -71454,7 +71482,8 @@ function inputObject(config2, inputs) {
71454
71482
  ...fields,
71455
71483
  [input.variable.name.value]: input.defaultValue ? variableValue(input.defaultValue, {}) : void 0
71456
71484
  };
71457
- }, {})
71485
+ }, {}),
71486
+ runtimeScalars
71458
71487
  };
71459
71488
  for (const input of inputs) {
71460
71489
  walkInputs(config2, visitedTypes, inputObj, input.type);
@@ -71466,10 +71495,10 @@ function walkInputs(config2, visitedTypes, inputObj, rootType) {
71466
71495
  if (visitedTypes.has(type.name)) {
71467
71496
  return;
71468
71497
  }
71469
- if (graphql8.isEnumType(type) || graphql8.isScalarType(type)) {
71498
+ if (graphql9.isEnumType(type) || graphql9.isScalarType(type)) {
71470
71499
  return;
71471
71500
  }
71472
- if (graphql8.isUnionType(type)) {
71501
+ if (graphql9.isUnionType(type)) {
71473
71502
  return;
71474
71503
  }
71475
71504
  visitedTypes.add(type.name);
@@ -71487,50 +71516,50 @@ function walkInputs(config2, visitedTypes, inputObj, rootType) {
71487
71516
  }
71488
71517
 
71489
71518
  // src/codegen/generators/artifacts/operations.ts
71490
- import * as graphql10 from "graphql";
71519
+ import * as graphql11 from "graphql";
71491
71520
 
71492
71521
  // src/codegen/generators/artifacts/utils.ts
71493
- var recast3 = __toESM(require_main2(), 1);
71494
- import * as graphql9 from "graphql";
71495
- var AST3 = recast3.types.builders;
71522
+ var recast4 = __toESM(require_main2(), 1);
71523
+ import * as graphql10 from "graphql";
71524
+ var AST4 = recast4.types.builders;
71496
71525
  function serializeValue(value) {
71497
71526
  if (Array.isArray(value)) {
71498
- return AST3.arrayExpression(value.map(serializeValue));
71527
+ return AST4.arrayExpression(value.map(serializeValue));
71499
71528
  }
71500
71529
  if (typeof value === "object" && value !== null) {
71501
- return AST3.objectExpression(
71530
+ return AST4.objectExpression(
71502
71531
  Object.entries(value).filter(([key, value2]) => typeof value2 !== "undefined").map(([key, val]) => {
71503
- return AST3.objectProperty(AST3.stringLiteral(key), serializeValue(val));
71532
+ return AST4.objectProperty(AST4.stringLiteral(key), serializeValue(val));
71504
71533
  })
71505
71534
  );
71506
71535
  }
71507
71536
  if (typeof value === "string") {
71508
71537
  if (value.indexOf("\n") !== -1) {
71509
- return AST3.templateLiteral(
71510
- [AST3.templateElement({ raw: value, cooked: value }, true)],
71538
+ return AST4.templateLiteral(
71539
+ [AST4.templateElement({ raw: value, cooked: value }, true)],
71511
71540
  []
71512
71541
  );
71513
71542
  }
71514
- return AST3.stringLiteral(value);
71543
+ return AST4.stringLiteral(value);
71515
71544
  }
71516
- return AST3.literal(value);
71545
+ return AST4.literal(value);
71517
71546
  }
71518
71547
  function convertValue(config2, val) {
71519
71548
  let value;
71520
71549
  let kind;
71521
- if (val.kind === graphql9.Kind.INT) {
71550
+ if (val.kind === graphql10.Kind.INT) {
71522
71551
  value = parseInt(val.value, 10);
71523
71552
  kind = "Int";
71524
- } else if (val.kind === graphql9.Kind.FLOAT) {
71553
+ } else if (val.kind === graphql10.Kind.FLOAT) {
71525
71554
  value = parseFloat(val.value);
71526
71555
  kind = "Float";
71527
- } else if (val.kind === graphql9.Kind.BOOLEAN) {
71556
+ } else if (val.kind === graphql10.Kind.BOOLEAN) {
71528
71557
  value = val.value;
71529
71558
  kind = "Boolean";
71530
- } else if (val.kind === graphql9.Kind.VARIABLE) {
71559
+ } else if (val.kind === graphql10.Kind.VARIABLE) {
71531
71560
  value = val.name.value;
71532
71561
  kind = "Variable";
71533
- } else if (val.kind === graphql9.Kind.STRING) {
71562
+ } else if (val.kind === graphql10.Kind.STRING) {
71534
71563
  value = val.value;
71535
71564
  kind = "String";
71536
71565
  }
@@ -71543,7 +71572,7 @@ function operationsByPath(config2, filepath, definition, filterTypes) {
71543
71572
  return {};
71544
71573
  }
71545
71574
  const pathOperations = {};
71546
- graphql10.visit(definition, {
71575
+ graphql11.visit(definition, {
71547
71576
  FragmentSpread(node, _, __, ___, ancestors) {
71548
71577
  if (!config2.isListFragment(node.name.value)) {
71549
71578
  return;
@@ -71702,19 +71731,19 @@ function ancestorKey(ancestors) {
71702
71731
  }
71703
71732
 
71704
71733
  // src/codegen/generators/artifacts/selection.ts
71705
- import * as graphql15 from "graphql";
71734
+ import * as graphql16 from "graphql";
71706
71735
 
71707
71736
  // src/codegen/transforms/list.ts
71708
- import * as graphql13 from "graphql";
71737
+ import * as graphql14 from "graphql";
71709
71738
 
71710
71739
  // src/codegen/utils/objectIdentificationSelection.ts
71711
- import * as graphql11 from "graphql";
71740
+ import * as graphql12 from "graphql";
71712
71741
  var objectIdentificationSelection = (config2, type) => {
71713
71742
  return config2.keyFieldsForType(type.name).map((key) => {
71714
71743
  return {
71715
- kind: graphql11.Kind.FIELD,
71744
+ kind: graphql12.Kind.FIELD,
71716
71745
  name: {
71717
- kind: graphql11.Kind.NAME,
71746
+ kind: graphql12.Kind.NAME,
71718
71747
  value: key
71719
71748
  }
71720
71749
  };
@@ -71722,7 +71751,7 @@ var objectIdentificationSelection = (config2, type) => {
71722
71751
  };
71723
71752
 
71724
71753
  // src/codegen/transforms/paginate.ts
71725
- import * as graphql12 from "graphql";
71754
+ import * as graphql13 from "graphql";
71726
71755
  async function paginate(config2, documents) {
71727
71756
  const newDocs = [];
71728
71757
  for (const doc of documents) {
@@ -71755,7 +71784,7 @@ async function paginate(config2, documents) {
71755
71784
  };
71756
71785
  let cursorType = "String";
71757
71786
  let paginationPath = [];
71758
- doc.document = graphql12.visit(doc.document, {
71787
+ doc.document = graphql13.visit(doc.document, {
71759
71788
  Field(node, _, __, ___, ancestors) {
71760
71789
  const paginateDirective = node.directives?.find(
71761
71790
  (directive) => directive.name.value === config2.paginateDirective
@@ -71781,7 +71810,7 @@ async function paginate(config2, documents) {
71781
71810
  flags.offset.enabled = offsetPagination;
71782
71811
  flags.limit.enabled = offsetPagination;
71783
71812
  paginationPath = ancestors.filter(
71784
- (ancestor) => !Array.isArray(ancestor) && ancestor.kind === graphql12.Kind.FIELD
71813
+ (ancestor) => !Array.isArray(ancestor) && ancestor.kind === graphql13.Kind.FIELD
71785
71814
  ).concat(node).map((field) => field.alias?.value || field.name.value);
71786
71815
  return {
71787
71816
  ...node,
@@ -71800,7 +71829,7 @@ async function paginate(config2, documents) {
71800
71829
  let fragment2 = "";
71801
71830
  let paginateMode = config2.defaultPaginateMode;
71802
71831
  const requiredArgs = [];
71803
- doc.document = graphql12.visit(doc.document, {
71832
+ doc.document = graphql13.visit(doc.document, {
71804
71833
  OperationDefinition(node) {
71805
71834
  if (node.operation !== "query") {
71806
71835
  throw new HoudiniError({
@@ -71859,9 +71888,9 @@ async function paginate(config2, documents) {
71859
71888
  directives: [
71860
71889
  ...node.directives || [],
71861
71890
  {
71862
- kind: graphql12.Kind.DIRECTIVE,
71891
+ kind: graphql13.Kind.DIRECTIVE,
71863
71892
  name: {
71864
- kind: graphql12.Kind.NAME,
71893
+ kind: graphql13.Kind.NAME,
71865
71894
  value: config2.argumentsDirective
71866
71895
  }
71867
71896
  }
@@ -71931,22 +71960,22 @@ async function paginate(config2, documents) {
71931
71960
  const paginationArgs = Object.entries(flags).filter(([_, { enabled }]) => enabled).map(([key, value]) => ({ name: key, ...value }));
71932
71961
  const fragmentSpreadSelection = [
71933
71962
  {
71934
- kind: graphql12.Kind.FRAGMENT_SPREAD,
71963
+ kind: graphql13.Kind.FRAGMENT_SPREAD,
71935
71964
  name: {
71936
- kind: graphql12.Kind.NAME,
71965
+ kind: graphql13.Kind.NAME,
71937
71966
  value: fragmentName
71938
71967
  },
71939
71968
  directives: [
71940
71969
  {
71941
- kind: graphql12.Kind.DIRECTIVE,
71970
+ kind: graphql13.Kind.DIRECTIVE,
71942
71971
  name: {
71943
- kind: graphql12.Kind.NAME,
71972
+ kind: graphql13.Kind.NAME,
71944
71973
  value: config2.withDirective
71945
71974
  },
71946
71975
  ["arguments"]: requiredArgs.map((arg) => variableAsArgument(arg.name)).concat(paginationArgs.map(({ name }) => variableAsArgument(name)))
71947
71976
  },
71948
71977
  {
71949
- kind: graphql12.Kind.DIRECTIVE,
71978
+ kind: graphql13.Kind.DIRECTIVE,
71950
71979
  name: {
71951
71980
  kind: "Name",
71952
71981
  value: config2.maskDisableDirective
@@ -71973,23 +72002,23 @@ async function paginate(config2, documents) {
71973
72002
  });
71974
72003
  const typeConfig = config2.typeConfig?.[fragment2];
71975
72004
  const queryDoc = {
71976
- kind: graphql12.Kind.DOCUMENT,
72005
+ kind: graphql13.Kind.DOCUMENT,
71977
72006
  definitions: [
71978
72007
  {
71979
- kind: graphql12.Kind.OPERATION_DEFINITION,
72008
+ kind: graphql13.Kind.OPERATION_DEFINITION,
71980
72009
  name: {
71981
- kind: graphql12.Kind.NAME,
72010
+ kind: graphql13.Kind.NAME,
71982
72011
  value: refetchQueryName
71983
72012
  },
71984
72013
  operation: "query",
71985
72014
  variableDefinitions: requiredArgs.map(
71986
72015
  (arg) => ({
71987
- kind: graphql12.Kind.VARIABLE_DEFINITION,
72016
+ kind: graphql13.Kind.VARIABLE_DEFINITION,
71988
72017
  type: arg.type,
71989
72018
  variable: {
71990
- kind: graphql12.Kind.VARIABLE,
72019
+ kind: graphql13.Kind.VARIABLE,
71991
72020
  name: {
71992
- kind: graphql12.Kind.NAME,
72021
+ kind: graphql13.Kind.NAME,
71993
72022
  value: arg.name
71994
72023
  }
71995
72024
  }
@@ -71997,18 +72026,18 @@ async function paginate(config2, documents) {
71997
72026
  ).concat(
71998
72027
  paginationArgs.map(
71999
72028
  (arg) => ({
72000
- kind: graphql12.Kind.VARIABLE_DEFINITION,
72029
+ kind: graphql13.Kind.VARIABLE_DEFINITION,
72001
72030
  type: {
72002
- kind: graphql12.Kind.NAMED_TYPE,
72031
+ kind: graphql13.Kind.NAMED_TYPE,
72003
72032
  name: {
72004
- kind: graphql12.Kind.NAME,
72033
+ kind: graphql13.Kind.NAME,
72005
72034
  value: arg.type
72006
72035
  }
72007
72036
  },
72008
72037
  variable: {
72009
- kind: graphql12.Kind.VARIABLE,
72038
+ kind: graphql13.Kind.VARIABLE,
72010
72039
  name: {
72011
- kind: graphql12.Kind.NAME,
72040
+ kind: graphql13.Kind.NAME,
72012
72041
  value: arg.name
72013
72042
  }
72014
72043
  },
@@ -72020,12 +72049,12 @@ async function paginate(config2, documents) {
72020
72049
  ).concat(
72021
72050
  !nodeQuery ? [] : keys2.map(
72022
72051
  (key) => ({
72023
- kind: graphql12.Kind.VARIABLE_DEFINITION,
72052
+ kind: graphql13.Kind.VARIABLE_DEFINITION,
72024
72053
  type: key.type,
72025
72054
  variable: {
72026
- kind: graphql12.Kind.VARIABLE,
72055
+ kind: graphql13.Kind.VARIABLE,
72027
72056
  name: {
72028
- kind: graphql12.Kind.NAME,
72057
+ kind: graphql13.Kind.NAME,
72029
72058
  value: key.name
72030
72059
  }
72031
72060
  }
@@ -72034,42 +72063,42 @@ async function paginate(config2, documents) {
72034
72063
  )
72035
72064
  ),
72036
72065
  selectionSet: {
72037
- kind: graphql12.Kind.SELECTION_SET,
72066
+ kind: graphql13.Kind.SELECTION_SET,
72038
72067
  selections: !nodeQuery ? fragmentSpreadSelection : [
72039
72068
  {
72040
- kind: graphql12.Kind.FIELD,
72069
+ kind: graphql13.Kind.FIELD,
72041
72070
  name: {
72042
- kind: graphql12.Kind.NAME,
72071
+ kind: graphql13.Kind.NAME,
72043
72072
  value: typeConfig?.resolve?.queryField || "node"
72044
72073
  },
72045
72074
  ["arguments"]: keys2.map((key) => ({
72046
- kind: graphql12.Kind.ARGUMENT,
72075
+ kind: graphql13.Kind.ARGUMENT,
72047
72076
  name: {
72048
- kind: graphql12.Kind.NAME,
72077
+ kind: graphql13.Kind.NAME,
72049
72078
  value: key.name
72050
72079
  },
72051
72080
  value: {
72052
- kind: graphql12.Kind.VARIABLE,
72081
+ kind: graphql13.Kind.VARIABLE,
72053
72082
  name: {
72054
- kind: graphql12.Kind.NAME,
72083
+ kind: graphql13.Kind.NAME,
72055
72084
  value: key.name
72056
72085
  }
72057
72086
  }
72058
72087
  })),
72059
72088
  selectionSet: {
72060
- kind: graphql12.Kind.SELECTION_SET,
72089
+ kind: graphql13.Kind.SELECTION_SET,
72061
72090
  selections: [
72062
72091
  {
72063
- kind: graphql12.Kind.FIELD,
72092
+ kind: graphql13.Kind.FIELD,
72064
72093
  name: {
72065
- kind: graphql12.Kind.NAME,
72094
+ kind: graphql13.Kind.NAME,
72066
72095
  value: "__typename"
72067
72096
  }
72068
72097
  },
72069
72098
  ...(typeConfig?.keys || [config2.defaultKeys[0]]).map((key) => ({
72070
- kind: graphql12.Kind.FIELD,
72099
+ kind: graphql13.Kind.FIELD,
72071
72100
  name: {
72072
- kind: graphql12.Kind.NAME,
72101
+ kind: graphql13.Kind.NAME,
72073
72102
  value: key
72074
72103
  }
72075
72104
  })),
@@ -72126,15 +72155,15 @@ function replaceArgumentsWithVariables(args, flags) {
72126
72155
  }
72127
72156
  function variableAsArgument(name, variable) {
72128
72157
  return {
72129
- kind: graphql12.Kind.ARGUMENT,
72158
+ kind: graphql13.Kind.ARGUMENT,
72130
72159
  name: {
72131
- kind: graphql12.Kind.NAME,
72160
+ kind: graphql13.Kind.NAME,
72132
72161
  value: name
72133
72162
  },
72134
72163
  value: {
72135
- kind: graphql12.Kind.VARIABLE,
72164
+ kind: graphql13.Kind.VARIABLE,
72136
72165
  name: {
72137
- kind: graphql12.Kind.NAME,
72166
+ kind: graphql13.Kind.NAME,
72138
72167
  value: variable ?? name
72139
72168
  }
72140
72169
  }
@@ -72142,18 +72171,18 @@ function variableAsArgument(name, variable) {
72142
72171
  }
72143
72172
  function staticVariableDefinition(name, type, defaultValue, variableName) {
72144
72173
  return {
72145
- kind: graphql12.Kind.VARIABLE_DEFINITION,
72174
+ kind: graphql13.Kind.VARIABLE_DEFINITION,
72146
72175
  type: {
72147
- kind: graphql12.Kind.NAMED_TYPE,
72176
+ kind: graphql13.Kind.NAMED_TYPE,
72148
72177
  name: {
72149
- kind: graphql12.Kind.NAME,
72178
+ kind: graphql13.Kind.NAME,
72150
72179
  value: type
72151
72180
  }
72152
72181
  },
72153
72182
  variable: {
72154
- kind: graphql12.Kind.VARIABLE,
72183
+ kind: graphql13.Kind.VARIABLE,
72155
72184
  name: {
72156
- kind: graphql12.Kind.NAME,
72185
+ kind: graphql13.Kind.NAME,
72157
72186
  value: variableName ?? name
72158
72187
  }
72159
72188
  },
@@ -72165,9 +72194,9 @@ function staticVariableDefinition(name, type, defaultValue, variableName) {
72165
72194
  }
72166
72195
  function argumentNode(name, value) {
72167
72196
  return {
72168
- kind: graphql12.Kind.ARGUMENT,
72197
+ kind: graphql13.Kind.ARGUMENT,
72169
72198
  name: {
72170
- kind: graphql12.Kind.NAME,
72199
+ kind: graphql13.Kind.NAME,
72171
72200
  value: name
72172
72201
  },
72173
72202
  value: objectNode(value)
@@ -72175,16 +72204,16 @@ function argumentNode(name, value) {
72175
72204
  }
72176
72205
  function objectNode([type, defaultValue]) {
72177
72206
  const node = {
72178
- kind: graphql12.Kind.OBJECT,
72207
+ kind: graphql13.Kind.OBJECT,
72179
72208
  fields: [
72180
72209
  {
72181
- kind: graphql12.Kind.OBJECT_FIELD,
72210
+ kind: graphql13.Kind.OBJECT_FIELD,
72182
72211
  name: {
72183
- kind: graphql12.Kind.NAME,
72212
+ kind: graphql13.Kind.NAME,
72184
72213
  value: "type"
72185
72214
  },
72186
72215
  value: {
72187
- kind: graphql12.Kind.STRING,
72216
+ kind: graphql13.Kind.STRING,
72188
72217
  value: type
72189
72218
  }
72190
72219
  }
@@ -72192,8 +72221,8 @@ function objectNode([type, defaultValue]) {
72192
72221
  };
72193
72222
  if (defaultValue) {
72194
72223
  node.fields.push({
72195
- kind: graphql12.Kind.OBJECT_FIELD,
72196
- name: { kind: graphql12.Kind.NAME, value: "default" },
72224
+ kind: graphql13.Kind.OBJECT_FIELD,
72225
+ name: { kind: graphql13.Kind.NAME, value: "default" },
72197
72226
  value: {
72198
72227
  kind: typeof defaultValue === "number" ? "IntValue" : "StringValue",
72199
72228
  value: defaultValue.toString()
@@ -72204,34 +72233,34 @@ function objectNode([type, defaultValue]) {
72204
72233
  }
72205
72234
  var pageInfoSelection = [
72206
72235
  {
72207
- kind: graphql12.Kind.FIELD,
72236
+ kind: graphql13.Kind.FIELD,
72208
72237
  name: {
72209
- kind: graphql12.Kind.NAME,
72238
+ kind: graphql13.Kind.NAME,
72210
72239
  value: "edges"
72211
72240
  },
72212
72241
  selectionSet: {
72213
- kind: graphql12.Kind.SELECTION_SET,
72242
+ kind: graphql13.Kind.SELECTION_SET,
72214
72243
  selections: [
72215
72244
  {
72216
- kind: graphql12.Kind.FIELD,
72245
+ kind: graphql13.Kind.FIELD,
72217
72246
  name: {
72218
- kind: graphql12.Kind.NAME,
72247
+ kind: graphql13.Kind.NAME,
72219
72248
  value: "cursor"
72220
72249
  }
72221
72250
  },
72222
72251
  {
72223
- kind: graphql12.Kind.FIELD,
72252
+ kind: graphql13.Kind.FIELD,
72224
72253
  name: {
72225
- kind: graphql12.Kind.NAME,
72254
+ kind: graphql13.Kind.NAME,
72226
72255
  value: "node"
72227
72256
  },
72228
72257
  selectionSet: {
72229
- kind: graphql12.Kind.SELECTION_SET,
72258
+ kind: graphql13.Kind.SELECTION_SET,
72230
72259
  selections: [
72231
72260
  {
72232
- kind: graphql12.Kind.FIELD,
72261
+ kind: graphql13.Kind.FIELD,
72233
72262
  name: {
72234
- kind: graphql12.Kind.NAME,
72263
+ kind: graphql13.Kind.NAME,
72235
72264
  value: "__typename"
72236
72265
  }
72237
72266
  }
@@ -72242,39 +72271,39 @@ var pageInfoSelection = [
72242
72271
  }
72243
72272
  },
72244
72273
  {
72245
- kind: graphql12.Kind.FIELD,
72274
+ kind: graphql13.Kind.FIELD,
72246
72275
  name: {
72247
- kind: graphql12.Kind.NAME,
72276
+ kind: graphql13.Kind.NAME,
72248
72277
  value: "pageInfo"
72249
72278
  },
72250
72279
  selectionSet: {
72251
- kind: graphql12.Kind.SELECTION_SET,
72280
+ kind: graphql13.Kind.SELECTION_SET,
72252
72281
  selections: [
72253
72282
  {
72254
- kind: graphql12.Kind.FIELD,
72283
+ kind: graphql13.Kind.FIELD,
72255
72284
  name: {
72256
- kind: graphql12.Kind.NAME,
72285
+ kind: graphql13.Kind.NAME,
72257
72286
  value: "hasPreviousPage"
72258
72287
  }
72259
72288
  },
72260
72289
  {
72261
- kind: graphql12.Kind.FIELD,
72290
+ kind: graphql13.Kind.FIELD,
72262
72291
  name: {
72263
- kind: graphql12.Kind.NAME,
72292
+ kind: graphql13.Kind.NAME,
72264
72293
  value: "hasNextPage"
72265
72294
  }
72266
72295
  },
72267
72296
  {
72268
- kind: graphql12.Kind.FIELD,
72297
+ kind: graphql13.Kind.FIELD,
72269
72298
  name: {
72270
- kind: graphql12.Kind.NAME,
72299
+ kind: graphql13.Kind.NAME,
72271
72300
  value: "startCursor"
72272
72301
  }
72273
72302
  },
72274
72303
  {
72275
- kind: graphql12.Kind.FIELD,
72304
+ kind: graphql13.Kind.FIELD,
72276
72305
  name: {
72277
- kind: graphql12.Kind.NAME,
72306
+ kind: graphql13.Kind.NAME,
72278
72307
  value: "endCursor"
72279
72308
  }
72280
72309
  }
@@ -72288,17 +72317,17 @@ async function addListFragments(config2, documents) {
72288
72317
  const lists = {};
72289
72318
  const errors = [];
72290
72319
  for (const doc of documents) {
72291
- doc.document = graphql13.visit(doc.document, {
72320
+ doc.document = graphql14.visit(doc.document, {
72292
72321
  Directive(node, key, parent2, path3, ancestors) {
72293
72322
  if ([config2.listDirective, config2.paginateDirective].includes(node.name.value)) {
72294
72323
  const nameArg = node.arguments?.find(
72295
72324
  (arg) => arg.name.value === config2.listOrPaginateNameArg
72296
72325
  );
72297
72326
  let error = {
72298
- ...new graphql13.GraphQLError(
72327
+ ...new graphql14.GraphQLError(
72299
72328
  "",
72300
72329
  node,
72301
- new graphql13.Source(""),
72330
+ new graphql14.Source(""),
72302
72331
  node.loc ? [node.loc.start, node.loc.end] : null,
72303
72332
  path3
72304
72333
  ),
@@ -72350,7 +72379,7 @@ async function addListFragments(config2, documents) {
72350
72379
  {
72351
72380
  kind: "Argument",
72352
72381
  name: {
72353
- kind: graphql13.Kind.NAME,
72382
+ kind: graphql14.Kind.NAME,
72354
72383
  value: "connection"
72355
72384
  },
72356
72385
  value: {
@@ -72400,7 +72429,7 @@ async function addListFragments(config2, documents) {
72400
72429
  const validDeletes = [
72401
72430
  ...new Set(
72402
72431
  Object.values(lists).map(({ type }) => {
72403
- if (!(type instanceof graphql13.GraphQLObjectType)) {
72432
+ if (!(type instanceof graphql14.GraphQLObjectType)) {
72404
72433
  return "";
72405
72434
  }
72406
72435
  if (config2.keyFieldsForType(type.name).length !== 1) {
@@ -72414,7 +72443,7 @@ async function addListFragments(config2, documents) {
72414
72443
  return;
72415
72444
  }
72416
72445
  const generatedDoc = {
72417
- kind: graphql13.Kind.DOCUMENT,
72446
+ kind: graphql14.Kind.DOCUMENT,
72418
72447
  definitions: Object.entries(lists).flatMap(
72419
72448
  ([name, { selection, type }]) => {
72420
72449
  const schemaType = config2.schema.getType(type.name);
@@ -72422,7 +72451,7 @@ async function addListFragments(config2, documents) {
72422
72451
  throw new HoudiniError({ message: "Lists must have a selection" });
72423
72452
  }
72424
72453
  const fragmentSelection = {
72425
- kind: graphql13.Kind.SELECTION_SET,
72454
+ kind: graphql14.Kind.SELECTION_SET,
72426
72455
  selections: [...selection.selections]
72427
72456
  };
72428
72457
  if (schemaType && fragmentSelection && !fragmentSelection?.selections.find(
@@ -72437,14 +72466,14 @@ async function addListFragments(config2, documents) {
72437
72466
  {
72438
72467
  name: {
72439
72468
  value: config2.listInsertFragment(name),
72440
- kind: graphql13.Kind.NAME
72469
+ kind: graphql14.Kind.NAME
72441
72470
  },
72442
- kind: graphql13.Kind.FRAGMENT_DEFINITION,
72471
+ kind: graphql14.Kind.FRAGMENT_DEFINITION,
72443
72472
  selectionSet: fragmentSelection,
72444
72473
  typeCondition: {
72445
- kind: graphql13.Kind.NAMED_TYPE,
72474
+ kind: graphql14.Kind.NAMED_TYPE,
72446
72475
  name: {
72447
- kind: graphql13.Kind.NAME,
72476
+ kind: graphql14.Kind.NAME,
72448
72477
  value: type.name
72449
72478
  }
72450
72479
  }
@@ -72452,32 +72481,32 @@ async function addListFragments(config2, documents) {
72452
72481
  {
72453
72482
  name: {
72454
72483
  value: config2.listToggleFragment(name),
72455
- kind: graphql13.Kind.NAME
72484
+ kind: graphql14.Kind.NAME
72456
72485
  },
72457
- kind: graphql13.Kind.FRAGMENT_DEFINITION,
72486
+ kind: graphql14.Kind.FRAGMENT_DEFINITION,
72458
72487
  selectionSet: fragmentSelection,
72459
72488
  typeCondition: {
72460
- kind: graphql13.Kind.NAMED_TYPE,
72489
+ kind: graphql14.Kind.NAMED_TYPE,
72461
72490
  name: {
72462
- kind: graphql13.Kind.NAME,
72491
+ kind: graphql14.Kind.NAME,
72463
72492
  value: type.name
72464
72493
  }
72465
72494
  }
72466
72495
  },
72467
72496
  {
72468
- kind: graphql13.Kind.FRAGMENT_DEFINITION,
72497
+ kind: graphql14.Kind.FRAGMENT_DEFINITION,
72469
72498
  name: {
72470
72499
  value: config2.listRemoveFragment(name),
72471
- kind: graphql13.Kind.NAME
72500
+ kind: graphql14.Kind.NAME
72472
72501
  },
72473
72502
  selectionSet: {
72474
- kind: graphql13.Kind.SELECTION_SET,
72503
+ kind: graphql14.Kind.SELECTION_SET,
72475
72504
  selections: [...objectIdentificationSelection(config2, type)]
72476
72505
  },
72477
72506
  typeCondition: {
72478
- kind: graphql13.Kind.NAMED_TYPE,
72507
+ kind: graphql14.Kind.NAMED_TYPE,
72479
72508
  name: {
72480
- kind: graphql13.Kind.NAME,
72509
+ kind: graphql14.Kind.NAME,
72481
72510
  value: type.name
72482
72511
  }
72483
72512
  }
@@ -72486,14 +72515,14 @@ async function addListFragments(config2, documents) {
72486
72515
  }
72487
72516
  ).concat(
72488
72517
  ...validDeletes.map((typeName) => ({
72489
- kind: graphql13.Kind.DIRECTIVE_DEFINITION,
72518
+ kind: graphql14.Kind.DIRECTIVE_DEFINITION,
72490
72519
  name: {
72491
- kind: graphql13.Kind.NAME,
72520
+ kind: graphql14.Kind.NAME,
72492
72521
  value: config2.listDeleteDirective(typeName)
72493
72522
  },
72494
72523
  locations: [
72495
72524
  {
72496
- kind: graphql13.Kind.NAME,
72525
+ kind: graphql14.Kind.NAME,
72497
72526
  value: "FIELD"
72498
72527
  }
72499
72528
  ],
@@ -72501,8 +72530,8 @@ async function addListFragments(config2, documents) {
72501
72530
  }))
72502
72531
  )
72503
72532
  };
72504
- config2.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(graphql13.print).join("\n\n");
72505
- config2.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(graphql13.print).join("\n\n");
72533
+ config2.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(graphql14.print).join("\n\n");
72534
+ config2.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(graphql14.print).join("\n\n");
72506
72535
  documents.push({
72507
72536
  name: "generated::lists",
72508
72537
  kind: ArtifactKind.Fragment,
@@ -72588,11 +72617,11 @@ var nodeNotDefinedMessage = (config2) => `Looks like you are trying to use the $
72588
72617
  For more information, visit this link: ${siteURL}/guides/pagination`;
72589
72618
 
72590
72619
  // src/codegen/generators/artifacts/fieldKey.ts
72591
- import * as graphql14 from "graphql";
72620
+ import * as graphql15 from "graphql";
72592
72621
  function fieldKey(config2, field) {
72593
72622
  const attributeName = field.alias?.value || field.name.value;
72594
- const printed = graphql14.print(field);
72595
- const secondParse = graphql14.parse(`{${printed}}`).definitions[0].selectionSet.selections[0];
72623
+ const printed = graphql15.print(field);
72624
+ const secondParse = graphql15.parse(`{${printed}}`).definitions[0].selectionSet.selections[0];
72596
72625
  let paginateMode = config2.defaultPaginateMode;
72597
72626
  const paginatedDirective = field.directives?.find(
72598
72627
  (directive) => directive.name.value === config2.paginateDirective
@@ -72715,13 +72744,13 @@ function prepareSelection({
72715
72744
  } else if ("getFields" in type) {
72716
72745
  let typeRef = type.getFields()[field.name.value].type;
72717
72746
  fieldType = getRootType(typeRef);
72718
- nullable = !graphql15.isNonNullType(typeRef);
72719
- } else if (graphql15.isAbstractType(type)) {
72747
+ nullable = !graphql16.isNonNullType(typeRef);
72748
+ } else if (graphql16.isAbstractType(type)) {
72720
72749
  for (const possible of config2.schema.getPossibleTypes(type)) {
72721
- if (graphql15.isObjectType(possible)) {
72750
+ if (graphql16.isObjectType(possible)) {
72722
72751
  if (possible.getFields()[field.name.value]) {
72723
72752
  fieldType = possible.getFields()[field.name.value].type;
72724
- nullable = !graphql15.isNonNullType(fieldType);
72753
+ nullable = !graphql16.isNonNullType(fieldType);
72725
72754
  break;
72726
72755
  }
72727
72756
  }
@@ -72858,7 +72887,7 @@ function prepareSelection({
72858
72887
  kind: "value"
72859
72888
  } : { kind: "continue" };
72860
72889
  const parentType = config2.schema.getType(rootType);
72861
- if (graphql15.isObjectType(parentType) || graphql15.isInterfaceType(parentType)) {
72890
+ if (graphql16.isObjectType(parentType) || graphql16.isInterfaceType(parentType)) {
72862
72891
  const fieldType2 = parentType.getFields()[field.name.value]?.type;
72863
72892
  if (fieldType2) {
72864
72893
  const listCount = unwrapType(config2, fieldType2).wrappers.filter(
@@ -72881,7 +72910,7 @@ function prepareSelection({
72881
72910
  }
72882
72911
  fieldObj.loading = loadingValue;
72883
72912
  }
72884
- if (graphql15.isInterfaceType(fieldType) || graphql15.isUnionType(fieldType)) {
72913
+ if (graphql16.isInterfaceType(fieldType) || graphql16.isUnionType(fieldType)) {
72885
72914
  fieldObj.abstract = true;
72886
72915
  if (Object.values(fieldObj.selection?.abstractFields?.fields ?? {}).some(
72887
72916
  (fields) => Object.values(fields ?? {}).some((field2) => field2.required)
@@ -72963,7 +72992,7 @@ function mergeSelection({
72963
72992
  typeSelection,
72964
72993
  abstractSelection.fields[typeName] ?? {}
72965
72994
  );
72966
- if (graphql15.isAbstractType(gqlType)) {
72995
+ if (graphql16.isAbstractType(gqlType)) {
72967
72996
  for (const possible of config2.schema.getPossibleTypes(gqlType)) {
72968
72997
  if (!possibleSelectionTypes[typeName]) {
72969
72998
  possibleSelectionTypes[typeName] = [];
@@ -72998,7 +73027,7 @@ function mergeSelection({
72998
73027
  }
72999
73028
  }
73000
73029
  const parentType = config2.schema.getType(rootType);
73001
- const possibleParents = graphql15.isAbstractType(parentType) ? config2.schema.getPossibleTypes(parentType)?.map((t3) => t3.name) : [parentType.name];
73030
+ const possibleParents = graphql16.isAbstractType(parentType) ? config2.schema.getPossibleTypes(parentType)?.map((t3) => t3.name) : [parentType.name];
73002
73031
  for (const key of Object.keys(abstractSelection.typeMap)) {
73003
73032
  if (!possibleParents.includes(key) && rootType !== key || abstractSelection.fields[key]) {
73004
73033
  delete abstractSelection.typeMap[key];
@@ -73055,12 +73084,12 @@ function mergeSelection({
73055
73084
  }
73056
73085
 
73057
73086
  // src/codegen/generators/artifacts/index.ts
73058
- var AST4 = recast4.types.builders;
73087
+ var AST5 = recast5.types.builders;
73059
73088
  function artifactGenerator(stats) {
73060
73089
  return async function(config2, docs) {
73061
73090
  const filterTypes = {};
73062
73091
  for (const doc of docs) {
73063
- graphql16.visit(doc.document, {
73092
+ graphql17.visit(doc.document, {
73064
73093
  Directive(node, _, __, ___, ancestors) {
73065
73094
  if (node.name.value !== config2.listDirective) {
73066
73095
  return;
@@ -73120,7 +73149,7 @@ function artifactGenerator(stats) {
73120
73149
  return;
73121
73150
  }
73122
73151
  const usedVariableNames = /* @__PURE__ */ new Set();
73123
- let documentWithoutInternalDirectives = graphql16.visit(document, {
73152
+ let documentWithoutInternalDirectives = graphql17.visit(document, {
73124
73153
  Directive(node) {
73125
73154
  if (config2.isInternalDirective(node.name.value)) {
73126
73155
  return null;
@@ -73133,7 +73162,7 @@ function artifactGenerator(stats) {
73133
73162
  }
73134
73163
  }
73135
73164
  });
73136
- let documentWithoutExtraVariables = graphql16.visit(
73165
+ let documentWithoutExtraVariables = graphql17.visit(
73137
73166
  documentWithoutInternalDirectives,
73138
73167
  {
73139
73168
  VariableDefinition(variableDefinitionNode) {
@@ -73144,13 +73173,13 @@ function artifactGenerator(stats) {
73144
73173
  }
73145
73174
  }
73146
73175
  );
73147
- let rawString = graphql16.print(documentWithoutExtraVariables);
73176
+ let rawString = graphql17.print(documentWithoutExtraVariables);
73148
73177
  let docKind = doc.kind;
73149
73178
  const operations = document.definitions.filter(
73150
- ({ kind }) => kind === graphql16.Kind.OPERATION_DEFINITION
73179
+ ({ kind }) => kind === graphql17.Kind.OPERATION_DEFINITION
73151
73180
  );
73152
73181
  const fragments = document.definitions.filter(
73153
- ({ kind }) => kind === graphql16.Kind.FRAGMENT_DEFINITION
73182
+ ({ kind }) => kind === graphql17.Kind.FRAGMENT_DEFINITION
73154
73183
  );
73155
73184
  let rootType = "";
73156
73185
  let selectionSet;
@@ -73297,7 +73326,21 @@ function artifactGenerator(stats) {
73297
73326
  artifact.pluginData[plugin2.name] = plugin2.artifactData({ config: config2, document: doc }) ?? {};
73298
73327
  }
73299
73328
  if (inputs && inputs.length > 0) {
73300
- artifact.input = inputObject(config2, inputs);
73329
+ const runtimeScalars = inputs.reduce((prev, input) => {
73330
+ const runtimeScalarDirective = input.directives?.find(
73331
+ (directive2) => directive2.name.value === config2.runtimeScalarDirective
73332
+ );
73333
+ if (!runtimeScalarDirective) {
73334
+ return prev;
73335
+ }
73336
+ return {
73337
+ ...prev,
73338
+ [input.variable.name.value]: runtimeScalarDirective.arguments?.find(
73339
+ (arg) => arg.name.value === "type"
73340
+ )?.value?.value
73341
+ };
73342
+ }, {});
73343
+ artifact.input = inputObject(config2, inputs, runtimeScalars);
73301
73344
  }
73302
73345
  if (artifact.kind === "HoudiniQuery") {
73303
73346
  const cacheDirective = operations[0].directives?.find(
@@ -73336,9 +73379,9 @@ function artifactGenerator(stats) {
73336
73379
  plugin2.artifactEnd({ config: config2, document: doc });
73337
73380
  }
73338
73381
  const _houdiniHash = hashOriginal({ document: doc });
73339
- const file = AST4.program([
73382
+ const file = AST5.program([
73340
73383
  moduleExport(config2, "default", serializeValue(artifact)),
73341
- AST4.expressionStatement(AST4.stringLiteral(`HoudiniHash=${_houdiniHash}`))
73384
+ AST5.expressionStatement(AST5.stringLiteral(`HoudiniHash=${_houdiniHash}`))
73342
73385
  ]);
73343
73386
  const artifactPath = config2.artifactPath(document);
73344
73387
  const countDocument = doc.generateStore;
@@ -73396,7 +73439,7 @@ function applyMask(config2, target, mask) {
73396
73439
  if (!targetType) {
73397
73440
  continue;
73398
73441
  }
73399
- if (graphql16.isAbstractType(targetType)) {
73442
+ if (graphql17.isAbstractType(targetType)) {
73400
73443
  for (const possible of config2.schema.getPossibleTypes(targetType)) {
73401
73444
  if (target.abstractFields?.fields[possible.name]) {
73402
73445
  applyMask(
@@ -73419,8 +73462,8 @@ function applyMask(config2, target, mask) {
73419
73462
  }
73420
73463
 
73421
73464
  // src/codegen/generators/runtime/graphqlFunction.ts
73422
- var recast5 = __toESM(require_main2(), 1);
73423
- var AST5 = recast5.types.builders;
73465
+ var recast6 = __toESM(require_main2(), 1);
73466
+ var AST6 = recast6.types.builders;
73424
73467
  async function generateGraphqlReturnTypes(config2, docs) {
73425
73468
  const indexPath = path_exports.join(config2.runtimeDirectory, "index.d.ts");
73426
73469
  const fileContent = await fs_exports.readFile(indexPath) || "";
@@ -73455,18 +73498,18 @@ async function generateGraphqlReturnTypes(config2, docs) {
73455
73498
  continue;
73456
73499
  }
73457
73500
  for (const [queryString, returnValue] of Object.entries(overloaded_returns)) {
73458
- const input = AST5.identifier("str");
73459
- input.typeAnnotation = AST5.tsTypeAnnotation(
73460
- AST5.tsLiteralType(AST5.stringLiteral(queryString))
73501
+ const input = AST6.identifier("str");
73502
+ input.typeAnnotation = AST6.tsTypeAnnotation(
73503
+ AST6.tsLiteralType(AST6.stringLiteral(queryString))
73461
73504
  );
73462
73505
  script.body.splice(
73463
73506
  i2,
73464
73507
  0,
73465
- AST5.exportNamedDeclaration(
73466
- AST5.tsDeclareFunction(
73467
- AST5.identifier("graphql"),
73508
+ AST6.exportNamedDeclaration(
73509
+ AST6.tsDeclareFunction(
73510
+ AST6.identifier("graphql"),
73468
73511
  [input],
73469
- AST5.tsTypeAnnotation(AST5.tsTypeReference(AST5.identifier(returnValue)))
73512
+ AST6.tsTypeAnnotation(AST6.tsTypeReference(AST6.identifier(returnValue)))
73470
73513
  )
73471
73514
  )
73472
73515
  );
@@ -73641,165 +73684,22 @@ function moduleStatments(config2) {
73641
73684
  var recast11 = __toESM(require_main2(), 1);
73642
73685
 
73643
73686
  // src/codegen/generators/typescript/addReferencedInputTypes.ts
73644
- var recast8 = __toESM(require_main2(), 1);
73645
- import * as graphql19 from "graphql";
73646
-
73647
- // src/codegen/generators/typescript/typeReference.ts
73648
73687
  var recast7 = __toESM(require_main2(), 1);
73649
73688
  import * as graphql18 from "graphql";
73650
-
73651
- // src/codegen/generators/typescript/types.ts
73652
- var recast6 = __toESM(require_main2(), 1);
73653
- import * as graphql17 from "graphql";
73654
- var AST6 = recast6.types.builders;
73655
- function readonlyProperty(prop, enable = true) {
73656
- if (enable) {
73657
- prop.readonly = true;
73658
- }
73659
- return prop;
73660
- }
73661
- function nullableField(inner, input = false) {
73662
- const members = [inner, AST6.tsNullKeyword()];
73663
- if (input) {
73664
- members.push(AST6.tsUndefinedKeyword());
73665
- }
73666
- return AST6.tsUnionType(members);
73667
- }
73668
- function scalarPropertyValue(config2, filepath, missingScalars, target, body, field) {
73669
- if (config2.configFile.features?.componentFields && target.name === config2.componentScalar) {
73670
- if (!field) {
73671
- return AST6.tsNeverKeyword();
73672
- }
73673
- const component = config2.componentFields[field.parent][field.field];
73674
- const sourcePathRelative = path_exports.relative(
73675
- path_exports.join(config2.projectRoot, "src"),
73676
- component.filepath
73677
- );
73678
- let sourcePathParsed = path_exports.parse(sourcePathRelative);
73679
- let sourcePath = path_exports.join(sourcePathParsed.dir, sourcePathParsed.name);
73680
- const localImport = ensureImports({
73681
- config: config2,
73682
- body,
73683
- import: "__component__" + component.fragment,
73684
- sourceModule: path_exports.join(
73685
- path_exports.relative(path_exports.dirname(filepath), config2.projectRoot),
73686
- "src",
73687
- sourcePath
73688
- )
73689
- });
73690
- const parameters = AST6.tsTypeReference(AST6.identifier("Parameters"));
73691
- parameters.typeParameters = AST6.tsTypeParameterInstantiation([
73692
- AST6.tsTypeQuery(AST6.identifier(localImport))
73693
- ]);
73694
- const indexed = AST6.tsIndexedAccessType(
73695
- parameters,
73696
- AST6.tsLiteralType(AST6.numericLiteral(0))
73697
- );
73698
- const omit = AST6.tsTypeReference(AST6.identifier("Omit"));
73699
- omit.typeParameters = AST6.tsTypeParameterInstantiation([
73700
- indexed,
73701
- AST6.tsLiteralType(AST6.stringLiteral(component.prop))
73702
- ]);
73703
- const arg = AST6.identifier("props");
73704
- arg.typeAnnotation = AST6.tsTypeAnnotation(omit);
73705
- const returnType = AST6.tsTypeReference(AST6.identifier("ReturnType"));
73706
- returnType.typeParameters = AST6.tsTypeParameterInstantiation([
73707
- AST6.tsTypeQuery(AST6.identifier(localImport))
73708
- ]);
73709
- const fnType = AST6.tsFunctionType([arg]);
73710
- fnType.typeAnnotation = AST6.tsTypeAnnotation(returnType);
73711
- return fnType;
73712
- }
73713
- switch (target.name) {
73714
- case "String": {
73715
- return AST6.tsStringKeyword();
73716
- }
73717
- case "Int": {
73718
- return AST6.tsNumberKeyword();
73719
- }
73720
- case "Float": {
73721
- return AST6.tsNumberKeyword();
73722
- }
73723
- case "Boolean": {
73724
- return AST6.tsBooleanKeyword();
73725
- }
73726
- case "ID": {
73727
- return AST6.tsStringKeyword();
73728
- }
73729
- default: {
73730
- if (graphql17.isNonNullType(target) && "ofType" in target) {
73731
- return scalarPropertyValue(
73732
- config2,
73733
- filepath,
73734
- missingScalars,
73735
- target.ofType,
73736
- body,
73737
- field
73738
- );
73739
- }
73740
- if (config2.scalars?.[target.name]) {
73741
- return AST6.tsTypeReference(AST6.identifier(config2.scalars?.[target.name].type));
73742
- }
73743
- if (target.name !== config2.componentScalar) {
73744
- missingScalars.add(target.name);
73745
- }
73746
- return AST6.tsAnyKeyword();
73747
- }
73748
- }
73749
- }
73750
-
73751
- // src/codegen/generators/typescript/typeReference.ts
73752
73689
  var AST7 = recast7.types.builders;
73753
- function tsTypeReference(config2, filepath, missingScalars, definition, body) {
73754
- const { type, wrappers } = unwrapType(config2, definition.type);
73755
- let result;
73756
- if (graphql18.isScalarType(type)) {
73757
- result = scalarPropertyValue(config2, filepath, missingScalars, type, body, null);
73758
- } else if (graphql18.isEnumType(type)) {
73759
- result = enumReference(config2, body, type.name);
73760
- } else {
73761
- result = AST7.tsTypeReference(AST7.identifier(type.name));
73762
- }
73763
- for (const toWrap of wrappers) {
73764
- if (toWrap === "NonNull" /* NonNull */) {
73765
- continue;
73766
- } else if (toWrap === "Nullable" /* Nullable */) {
73767
- result = nullableField(result, true);
73768
- } else if (toWrap === "List" /* List */) {
73769
- result = AST7.tsArrayType(AST7.tsParenthesizedType(result));
73770
- }
73771
- }
73772
- return result;
73773
- }
73774
- function enumReference(config2, body, name) {
73775
- ensureImports({
73776
- config: config2,
73777
- body,
73778
- import: ["ValueOf"],
73779
- importKind: "type",
73780
- sourceModule: "$houdini/runtime/lib/types"
73781
- });
73782
- return AST7.tsTypeReference(
73783
- AST7.identifier("ValueOf"),
73784
- AST7.tsTypeParameterInstantiation([AST7.tsTypeQuery(AST7.identifier(name))])
73785
- );
73786
- }
73787
-
73788
- // src/codegen/generators/typescript/addReferencedInputTypes.ts
73789
- var AST8 = recast8.types.builders;
73790
73690
  function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingScalars, rootType) {
73791
73691
  const { type } = unwrapType(config2, rootType);
73792
- if (graphql19.isScalarType(type)) {
73692
+ if (graphql18.isScalarType(type)) {
73793
73693
  return;
73794
73694
  }
73795
73695
  if (visitedTypes.has(type.name)) {
73796
73696
  return;
73797
73697
  }
73798
- if (graphql19.isUnionType(type)) {
73698
+ if (graphql18.isUnionType(type)) {
73799
73699
  throw new HoudiniError({ filepath, message: "Input Unions are not supported yet. Sorry!" });
73800
73700
  }
73801
73701
  visitedTypes.add(type.name);
73802
- if (graphql19.isEnumType(type)) {
73702
+ if (graphql18.isEnumType(type)) {
73803
73703
  ensureImports({
73804
73704
  config: config2,
73805
73705
  body,
@@ -73813,21 +73713,37 @@ function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingS
73813
73713
  for (const field of Object.values(type.getFields())) {
73814
73714
  addReferencedInputTypes(config2, filepath, body, visitedTypes, missingScalars, field.type);
73815
73715
  members.push(
73816
- AST8.tsPropertySignature(
73817
- AST8.identifier(field.name),
73818
- AST8.tsTypeAnnotation(
73716
+ AST7.tsPropertySignature(
73717
+ AST7.identifier(field.name),
73718
+ AST7.tsTypeAnnotation(
73819
73719
  tsTypeReference(config2, filepath, missingScalars, field, body)
73820
73720
  ),
73821
- graphql19.isNullableType(field.type)
73721
+ graphql18.isNullableType(field.type)
73822
73722
  )
73823
73723
  );
73824
73724
  }
73825
- body.push(AST8.tsTypeAliasDeclaration(AST8.identifier(type.name), AST8.tsTypeLiteral(members)));
73725
+ body.push(AST7.tsTypeAliasDeclaration(AST7.identifier(type.name), AST7.tsTypeLiteral(members)));
73826
73726
  }
73827
73727
 
73828
73728
  // src/codegen/generators/typescript/inlineType.ts
73829
73729
  var recast9 = __toESM(require_main2(), 1);
73830
- import * as graphql20 from "graphql";
73730
+ import * as graphql19 from "graphql";
73731
+
73732
+ // src/codegen/generators/comments/jsdoc.ts
73733
+ var recast8 = __toESM(require_main2(), 1);
73734
+ var AST8 = recast8.types.builders;
73735
+ function jsdocComment(text, deprecated) {
73736
+ let commentContent = `*
73737
+ * ${text}
73738
+ `;
73739
+ if (deprecated) {
73740
+ commentContent = `${commentContent} * @deprecated ${deprecated}
73741
+ `;
73742
+ }
73743
+ return AST8.commentBlock(commentContent, true);
73744
+ }
73745
+
73746
+ // src/codegen/generators/typescript/inlineType.ts
73831
73747
  var AST9 = recast9.types.builders;
73832
73748
  var fragmentKey2 = " $fragments";
73833
73749
  function inlineType({
@@ -73848,7 +73764,7 @@ function inlineType({
73848
73764
  const { type, wrappers } = unwrapType(config2, rootType);
73849
73765
  let result;
73850
73766
  let forceNullable = false;
73851
- if (graphql20.isScalarType(type)) {
73767
+ if (graphql19.isScalarType(type)) {
73852
73768
  result = scalarPropertyValue(
73853
73769
  config2,
73854
73770
  filepath,
@@ -73857,7 +73773,7 @@ function inlineType({
73857
73773
  body,
73858
73774
  field
73859
73775
  );
73860
- } else if (graphql20.isEnumType(type)) {
73776
+ } else if (graphql19.isEnumType(type)) {
73861
73777
  ensureImports({
73862
73778
  config: config2,
73863
73779
  body,
@@ -73882,11 +73798,11 @@ function inlineType({
73882
73798
  for (const selection of selections) {
73883
73799
  if (selection.kind === "InlineFragment" && selection.typeCondition) {
73884
73800
  const fragmentType = config2.schema.getType(selection.typeCondition.name.value);
73885
- if (!graphql20.isInterfaceType(type) && !graphql20.isUnionType(type)) {
73801
+ if (!graphql19.isInterfaceType(type) && !graphql19.isUnionType(type)) {
73886
73802
  selectedFields.push(...selection.selectionSet.selections);
73887
73803
  continue;
73888
73804
  }
73889
- if (!graphql20.isInterfaceType(fragmentType) && !graphql20.isUnionType(fragmentType)) {
73805
+ if (!graphql19.isInterfaceType(fragmentType) && !graphql19.isUnionType(fragmentType)) {
73890
73806
  if (!inlineFragments[fragmentType.name]) {
73891
73807
  inlineFragments[fragmentType.name] = [];
73892
73808
  }
@@ -73978,6 +73894,11 @@ function inlineType({
73978
73894
  if (allOptional) {
73979
73895
  prop.optional = true;
73980
73896
  }
73897
+ if (field2.description || field2.deprecationReason) {
73898
+ prop.comments = [
73899
+ jsdocComment(field2.description ?? "", field2.deprecationReason ?? void 0)
73900
+ ];
73901
+ }
73981
73902
  return prop;
73982
73903
  })
73983
73904
  ]);
@@ -74029,7 +73950,7 @@ function inlineType({
74029
73950
  }
74030
73951
  }
74031
73952
  }
74032
- if (objectType.type === "TSTypeLiteral" && !graphql20.isInterfaceType(fragmentRootType) && !graphql20.isUnionType(fragmentRootType)) {
73953
+ if (objectType.type === "TSTypeLiteral" && !graphql19.isInterfaceType(fragmentRootType) && !graphql19.isUnionType(fragmentRootType)) {
74033
73954
  const existingTypenameIndex = objectType.members.findIndex(
74034
73955
  (member) => member.type === "TSPropertySignature" && member.key.type === "Identifier" && member.key.name === "__typename"
74035
73956
  );
@@ -74054,11 +73975,11 @@ function inlineType({
74054
73975
  ];
74055
73976
  }
74056
73977
  let coveredTypenames;
74057
- if (graphql20.isInterfaceType(fragmentRootType)) {
73978
+ if (graphql19.isInterfaceType(fragmentRootType)) {
74058
73979
  coveredTypenames = interfaceCoveredTypenames(fragmentRootType);
74059
- } else if (graphql20.isUnionType(fragmentRootType)) {
73980
+ } else if (graphql19.isUnionType(fragmentRootType)) {
74060
73981
  coveredTypenames = fragmentRootType.getTypes().map((type2) => type2.name);
74061
- } else if (graphql20.isObjectType(fragmentRootType)) {
73982
+ } else if (graphql19.isObjectType(fragmentRootType)) {
74062
73983
  coveredTypenames = [fragmentRootType.name];
74063
73984
  } else {
74064
73985
  throw Error("unreachable code");
@@ -74094,7 +74015,7 @@ function inlineType({
74094
74015
  );
74095
74016
  }
74096
74017
  );
74097
- const parentIsUnionOrInterface = !graphql20.isInterfaceType(type) && !graphql20.isUnionType(type);
74018
+ const parentIsUnionOrInterface = !graphql19.isInterfaceType(type) && !graphql19.isUnionType(type);
74098
74019
  const possibleTypenames = parentIsUnionOrInterface ? [parent.name] : config2.schema.getPossibleTypes(type).map((type2) => type2.name);
74099
74020
  const coveredTypenames = new Set(
74100
74021
  Object.values(inlineFragmentSelections).flatMap((sel) => sel.coveredTypenames)
@@ -74161,7 +74082,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection) {
74161
74082
  },
74162
74083
  type: schema.getType("String")
74163
74084
  };
74164
- } else if (graphql20.isNonNullType(rootType) && "getFields" in rootType.ofType) {
74085
+ } else if (graphql19.isNonNullType(rootType) && "getFields" in rootType.ofType) {
74165
74086
  fields = rootType.ofType.getFields();
74166
74087
  } else {
74167
74088
  fields = rootType.getFields();
@@ -74173,7 +74094,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection) {
74173
74094
  message: `Could not find type information for field ${rootType.toString()}.${selectionName} ${field}`
74174
74095
  });
74175
74096
  }
74176
- const fieldType = graphql20.getNamedType(field.type);
74097
+ const fieldType = graphql19.getNamedType(field.type);
74177
74098
  if (!fieldType) {
74178
74099
  throw new HoudiniError({
74179
74100
  filepath,
@@ -74389,17 +74310,20 @@ export * from "${module}"
74389
74310
  }
74390
74311
  }
74391
74312
  await fs_exports.writeFile(config2.typeIndexPath, indexContent);
74392
- if (missingScalars.size > 0) {
74393
- console.warn(`\u26A0\uFE0F Missing definitions for the following scalars: ${[...missingScalars].join(
74394
- ", "
74395
- )}
74313
+ const missingScalarNames = [...missingScalars].filter(
74314
+ (scalar) => !config2.configFile.features?.runtimeScalars?.[scalar]
74315
+ );
74316
+ if (missingScalarNames.length > 0) {
74317
+ console.warn(`\u26A0\uFE0F Missing definitions for the following scalars: ${[
74318
+ ...missingScalarNames
74319
+ ].join(", ")}
74396
74320
  Generated types will contain an any type in place of these values. To fix this, provide an equivalent
74397
74321
  type in your config file:
74398
74322
 
74399
74323
  {
74400
74324
  scalars: {
74401
74325
  ${cyan3(`/* in your case, something like */`)}
74402
- ${[...missingScalars].map(
74326
+ ${[...missingScalarNames].map(
74403
74327
  (c) => ` ${c}: { ${green3(`// <- The GraphQL Scalar`)}
74404
74328
  type: "${cyan3(`YourType_${c}`)}" ${green3(`// <- The TypeScript type`)}
74405
74329
  }`
@@ -74679,7 +74603,7 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
74679
74603
 
74680
74604
  // src/codegen/generators/typescript/imperativeTypeDef.ts
74681
74605
  var recast12 = __toESM(require_main2(), 1);
74682
- import * as graphql21 from "graphql";
74606
+ import * as graphql20 from "graphql";
74683
74607
  var AST12 = recast12.types.builders;
74684
74608
  async function imperativeCacheTypef(config2, docs) {
74685
74609
  const returnType = (doc) => config2.plugins.find((plugin2) => plugin2.graphqlTagReturn)?.graphqlTagReturn?.({
@@ -74730,7 +74654,7 @@ function typeDefinitions(config2, filepath, body, docs, returnType) {
74730
74654
  const operationTypes = [config2.schema.getMutationType(), config2.schema.getSubscriptionType()].filter(Boolean).map((type) => type?.name);
74731
74655
  const visitedTypes = /* @__PURE__ */ new Set();
74732
74656
  const types17 = Object.values(config2.schema.getTypeMap()).filter(
74733
- (type) => !graphql21.isAbstractType(type) && !graphql21.isScalarType(type) && !graphql21.isEnumType(type) && !graphql21.isInputObjectType(type) && !type.name.startsWith("__") && !operationTypes.includes(type.name)
74657
+ (type) => !graphql20.isAbstractType(type) && !graphql20.isScalarType(type) && !graphql20.isEnumType(type) && !graphql20.isInputObjectType(type) && !type.name.startsWith("__") && !operationTypes.includes(type.name)
74734
74658
  );
74735
74659
  const fragmentMap = fragmentListMap(
74736
74660
  config2,
@@ -74747,7 +74671,7 @@ function typeDefinitions(config2, filepath, body, docs, returnType) {
74747
74671
  }
74748
74672
  let idFields = AST12.tsNeverKeyword();
74749
74673
  const keys2 = keyFieldsForType(config2.configFile, type.name);
74750
- if (graphql21.isObjectType(type) && keys2.length > 0 && keys2.every((key) => type.getFields()[key])) {
74674
+ if (graphql20.isObjectType(type) && keys2.length > 0 && keys2.every((key) => type.getFields()[key])) {
74751
74675
  idFields = AST12.tsTypeLiteral(
74752
74676
  keys2.map((key) => {
74753
74677
  const fieldType = type.getFields()[key];
@@ -74774,13 +74698,13 @@ function typeDefinitions(config2, filepath, body, docs, returnType) {
74774
74698
  idFields = AST12.tsTypeLiteral([]);
74775
74699
  }
74776
74700
  let fields = AST12.tsTypeLiteral([]);
74777
- if (graphql21.isObjectType(type)) {
74701
+ if (graphql20.isObjectType(type)) {
74778
74702
  fields = AST12.tsTypeLiteral(
74779
74703
  Object.entries(type.getFields()).map(
74780
74704
  ([key, fieldType]) => {
74781
74705
  const unwrapped = unwrapType(config2, fieldType.type);
74782
74706
  let typeOptions = AST12.tsUnionType([]);
74783
- if (graphql21.isScalarType(unwrapped.type)) {
74707
+ if (graphql20.isScalarType(unwrapped.type)) {
74784
74708
  typeOptions.types.push(
74785
74709
  scalarPropertyValue(
74786
74710
  config2,
@@ -74794,11 +74718,11 @@ function typeDefinitions(config2, filepath, body, docs, returnType) {
74794
74718
  }
74795
74719
  )
74796
74720
  );
74797
- } else if (graphql21.isEnumType(unwrapped.type)) {
74721
+ } else if (graphql20.isEnumType(unwrapped.type)) {
74798
74722
  typeOptions.types.push(
74799
74723
  AST12.tsTypeReference(AST12.identifier(unwrapped.type.name))
74800
74724
  );
74801
- } else if (!graphql21.isAbstractType(unwrapped.type)) {
74725
+ } else if (!graphql20.isAbstractType(unwrapped.type)) {
74802
74726
  typeOptions.types.push(record(unwrapped.type.name));
74803
74727
  } else {
74804
74728
  typeOptions.types.push(
@@ -74894,7 +74818,7 @@ function listDefinitions(config2, filepath, body, docs) {
74894
74818
  const lists = [];
74895
74819
  const visitedLists = /* @__PURE__ */ new Set();
74896
74820
  for (const doc of docs) {
74897
- graphql21.visit(doc.document, {
74821
+ graphql20.visit(doc.document, {
74898
74822
  Directive(node, key, parent2, path3, ancestors) {
74899
74823
  if (![config2.listDirective, config2.paginateDirective].includes(node.name.value)) {
74900
74824
  return;
@@ -74916,7 +74840,7 @@ function listDefinitions(config2, filepath, body, docs) {
74916
74840
  const targetFieldDefinition = parentType.getFields()[targetField.name.value];
74917
74841
  const { type: listType } = unwrapType(config2, targetFieldDefinition.type);
74918
74842
  const possibleTypes = [];
74919
- if (graphql21.isAbstractType(listType)) {
74843
+ if (graphql20.isAbstractType(listType)) {
74920
74844
  possibleTypes.push(
74921
74845
  ...config2.schema.getPossibleTypes(listType).map((possible) => possible.name)
74922
74846
  );
@@ -75078,7 +75002,7 @@ async function typescriptGenerator(config2, docs) {
75078
75002
  }
75079
75003
 
75080
75004
  // src/codegen/generators/persistedQueries/index.ts
75081
- import * as graphql22 from "graphql";
75005
+ import * as graphql21 from "graphql";
75082
75006
  async function persistOutputGenerator(config2, docs) {
75083
75007
  if (!config2.persistedQueriesPath.endsWith(".json")) {
75084
75008
  throw new Error('Can write Persisted Queries only in a ".json" file.');
@@ -75088,8 +75012,8 @@ async function persistOutputGenerator(config2, docs) {
75088
75012
  if (!generateArtifact) {
75089
75013
  return acc;
75090
75014
  }
75091
- let rawString = graphql22.print(
75092
- graphql22.visit(document, {
75015
+ let rawString = graphql21.print(
75016
+ graphql21.visit(document, {
75093
75017
  Directive(node) {
75094
75018
  if (config2.isInternalDirective(node.name.value)) {
75095
75019
  return null;
@@ -75098,7 +75022,7 @@ async function persistOutputGenerator(config2, docs) {
75098
75022
  })
75099
75023
  );
75100
75024
  const operations = document.definitions.filter(
75101
- ({ kind }) => kind === graphql22.Kind.OPERATION_DEFINITION
75025
+ ({ kind }) => kind === graphql21.Kind.OPERATION_DEFINITION
75102
75026
  );
75103
75027
  if (operations.length > 0 && operations[0].kind === "OperationDefinition") {
75104
75028
  if (artifact) {
@@ -75113,33 +75037,45 @@ async function persistOutputGenerator(config2, docs) {
75113
75037
  }
75114
75038
 
75115
75039
  // src/codegen/generators/definitions/index.ts
75116
- import * as graphql24 from "graphql";
75040
+ import * as graphql23 from "graphql";
75117
75041
 
75118
75042
  // src/codegen/generators/definitions/enums.ts
75119
75043
  var recast13 = __toESM(require_main2(), 1);
75120
- import * as graphql23 from "graphql";
75044
+ import * as graphql22 from "graphql";
75121
75045
  var AST13 = recast13.types.builders;
75122
75046
  async function definitionsGenerator(config2) {
75123
- const enums = graphql23.parse(graphql23.printSchema(config2.schema)).definitions.filter(
75047
+ const enums = graphql22.parse(graphql22.printSchema(config2.schema)).definitions.filter(
75124
75048
  (definition) => definition.kind === "EnumTypeDefinition"
75125
75049
  ).filter((def) => !config2.isInternalEnum(def));
75126
75050
  const { code: runtimeDefinitions } = await printJS(
75127
75051
  AST13.program(
75128
75052
  enums.map((defn) => {
75129
75053
  const name = defn.name.value;
75130
- return moduleExport(
75054
+ const declaration = moduleExport(
75131
75055
  config2,
75132
75056
  name,
75133
75057
  AST13.objectExpression(
75134
75058
  defn.values?.map((value) => {
75135
75059
  const str = value.name.value;
75136
- return AST13.objectProperty(
75060
+ const prop = AST13.objectProperty(
75137
75061
  AST13.stringLiteral(str),
75138
75062
  AST13.stringLiteral(str)
75139
75063
  );
75064
+ const deprecationReason = value.directives?.find((d) => d.name.value === "deprecated")?.arguments?.find((a) => a.name.value === "reason")?.value?.value;
75065
+ if (value.description || deprecationReason)
75066
+ prop.comments = [
75067
+ jsdocComment(value.description?.value ?? "", deprecationReason)
75068
+ ];
75069
+ return prop;
75140
75070
  }) || []
75141
75071
  )
75142
75072
  );
75073
+ if (defn.description) {
75074
+ declaration.comments = [
75075
+ AST13.commentBlock(`* ${defn.description.value} `, true, false)
75076
+ ];
75077
+ }
75078
+ return declaration;
75143
75079
  })
75144
75080
  )
75145
75081
  );
@@ -75148,11 +75084,19 @@ type ValuesOf<T> = T[keyof T]
75148
75084
  ` + enums.sort((a, b) => a.name.value.localeCompare(b.name.value)).map((definition) => {
75149
75085
  const name = definition.name.value;
75150
75086
  const values = definition.values;
75151
- return `
75087
+ let jsdoc = "";
75088
+ if (definition.description) {
75089
+ jsdoc = `
75090
+ /** ${definition.description.value} */`;
75091
+ }
75092
+ return `${jsdoc}
75152
75093
  export declare const ${name}: {
75153
- ${values?.map((value) => ` readonly ${value.name.value}: "${value.name.value}";`).join("\n")}
75094
+ ${values?.map(
75095
+ (value) => (value.description ? ` /** ${value.description.value} */
75096
+ ` : "") + ` readonly ${value.name.value}: "${value.name.value}";`
75097
+ ).join("\n")}
75154
75098
  }
75155
-
75099
+ ${jsdoc}
75156
75100
  export type ${name}$options = ValuesOf<typeof ${name}>
75157
75101
  `;
75158
75102
  }).join("");
@@ -75172,7 +75116,7 @@ async function schemaGenerator(config2) {
75172
75116
  await Promise.all([
75173
75117
  fs_exports.writeFile(
75174
75118
  config2.definitionsSchemaPath,
75175
- config2.localSchema ? graphql24.printSchema(config2.schema) : config2.newSchema
75119
+ config2.localSchema ? graphql23.printSchema(config2.schema) : config2.newSchema
75176
75120
  ),
75177
75121
  fs_exports.writeFile(config2.definitionsDocumentsPath, config2.newDocuments),
75178
75122
  definitionsGenerator(config2)
@@ -76877,7 +76821,7 @@ function mergeGraphQLTypes2(typeSource, config2) {
76877
76821
  }
76878
76822
 
76879
76823
  // src/codegen/transforms/schema.ts
76880
- import * as graphql25 from "graphql";
76824
+ import * as graphql24 from "graphql";
76881
76825
  async function graphqlExtensions(config2, documents) {
76882
76826
  let internalSchema = `
76883
76827
  enum CachePolicy {
@@ -76981,7 +76925,7 @@ ${config2.configFile.features?.componentFields ? `
76981
76925
  """
76982
76926
  @${config2.componentFieldDirective} marks an inline fragment as the selection for a component field
76983
76927
  """
76984
- directive @${config2.componentFieldDirective}(field: String!, prop: String, export: String, raw: String) on FRAGMENT_DEFINITION | INLINE_FRAGMENT
76928
+ directive @${config2.componentFieldDirective}(field: String!, prop: String, export: String, raw: String) on FRAGMENT_DEFINITION | INLINE_FRAGMENT | FIELD_DEFINITION
76985
76929
 
76986
76930
  ` : ""}
76987
76931
 
@@ -76992,7 +76936,7 @@ directive @${config2.componentFieldDirective}(field: String!, prop: String, expo
76992
76936
  }
76993
76937
  internalSchema += plugin2.schema({ config: config2 });
76994
76938
  }
76995
- const extensions = Object.entries(config2.componentFields).map(([parent2, fields]) => {
76939
+ let extensions = Object.entries(config2.componentFields).map(([parent2, fields]) => {
76996
76940
  return `
76997
76941
  extend type ${parent2} {
76998
76942
  ${Object.entries(fields).map(([fieldName, field]) => {
@@ -77000,29 +76944,30 @@ directive @${config2.componentFieldDirective}(field: String!, prop: String, expo
77000
76944
  const args = fragmentArguments(config2, "", field.parent);
77001
76945
  if (args.length > 0) {
77002
76946
  argString = "(" + args.map((arg) => {
77003
- const typeName = graphql25.print(arg.type);
76947
+ const typeName = graphql24.print(arg.type);
77004
76948
  return `${arg.name}:${typeName}${arg.required ? "!" : ""}`;
77005
76949
  }).join("\n") + ")";
77006
76950
  }
77007
- return `${fieldName}${argString}: ${config2.componentScalar}!`;
76951
+ return `${fieldName}${argString}: ${config2.componentScalar}! @componentField(field: "${fieldName}")`;
77008
76952
  }).join("\n")}
77009
76953
  }
77010
76954
  `;
77011
76955
  }).join("\n");
77012
- config2.newSchema = graphql25.print(mergeTypeDefs2([internalSchema, config2.newSchema]));
76956
+ extensions += `${Object.keys(config2.configFile.features?.runtimeScalars ?? {}).map((scalar) => `scalar ${scalar}`).join("\n")}`;
76957
+ config2.newSchema = graphql24.print(mergeTypeDefs2([internalSchema, config2.newSchema]));
77013
76958
  config2.schemaString += extensions;
77014
- config2.schema = graphql25.buildSchema(
77015
- graphql25.print(
77016
- mergeTypeDefs2([graphql25.printSchema(config2.schema), internalSchema, extensions])
76959
+ config2.schema = graphql24.buildSchema(
76960
+ graphql24.print(
76961
+ mergeTypeDefs2([graphql24.printSchema(config2.schema), internalSchema, extensions])
77017
76962
  )
77018
76963
  );
77019
76964
  }
77020
76965
 
77021
76966
  // src/codegen/transforms/typename.ts
77022
- import * as graphql26 from "graphql";
76967
+ import * as graphql25 from "graphql";
77023
76968
  async function addTypename(config2, documents) {
77024
76969
  for (const doc of documents) {
77025
- doc.document = graphql26.visit(doc.document, {
76970
+ doc.document = graphql25.visit(doc.document, {
77026
76971
  Field(node, key, parent2, path3, ancestors) {
77027
76972
  if (!node.selectionSet) {
77028
76973
  return;
@@ -77034,7 +76979,7 @@ async function addTypename(config2, documents) {
77034
76979
  );
77035
76980
  const field = type.getFields()[node.name.value];
77036
76981
  const fieldType = unwrapType(config2, field.type).type;
77037
- if (graphql26.isInterfaceType(fieldType) || graphql26.isUnionType(fieldType)) {
76982
+ if (graphql25.isInterfaceType(fieldType) || graphql25.isUnionType(fieldType)) {
77038
76983
  return {
77039
76984
  ...node,
77040
76985
  selectionSet: {
@@ -77042,9 +76987,9 @@ async function addTypename(config2, documents) {
77042
76987
  selections: [
77043
76988
  ...node.selectionSet.selections,
77044
76989
  {
77045
- kind: graphql26.Kind.FIELD,
76990
+ kind: graphql25.Kind.FIELD,
77046
76991
  name: {
77047
- kind: graphql26.Kind.NAME,
76992
+ kind: graphql25.Kind.NAME,
77048
76993
  value: "__typename"
77049
76994
  }
77050
76995
  }
@@ -77061,9 +77006,9 @@ async function addTypename(config2, documents) {
77061
77006
  selections: [
77062
77007
  ...node.selectionSet.selections,
77063
77008
  {
77064
- kind: graphql26.Kind.FIELD,
77009
+ kind: graphql25.Kind.FIELD,
77065
77010
  name: {
77066
- kind: graphql26.Kind.NAME,
77011
+ kind: graphql25.Kind.NAME,
77067
77012
  value: "__typename"
77068
77013
  }
77069
77014
  }
@@ -77076,10 +77021,10 @@ async function addTypename(config2, documents) {
77076
77021
  }
77077
77022
 
77078
77023
  // src/codegen/transforms/addID.ts
77079
- import * as graphql27 from "graphql";
77024
+ import * as graphql26 from "graphql";
77080
77025
  async function addID(config2, documents) {
77081
77026
  for (const doc of documents) {
77082
- doc.document = graphql27.visit(doc.document, {
77027
+ doc.document = graphql26.visit(doc.document, {
77083
77028
  Field(node, key, parent2, path3, ancestors) {
77084
77029
  if (!node.selectionSet) {
77085
77030
  return;
@@ -77117,7 +77062,7 @@ function addKeysToSelection(config2, node, fieldType) {
77117
77062
  if (!node.selectionSet || node.selectionSet.selections.length == 0) {
77118
77063
  return;
77119
77064
  }
77120
- if (!graphql27.isObjectType(fieldType) && !graphql27.isInterfaceType(fieldType)) {
77065
+ if (!graphql26.isObjectType(fieldType) && !graphql26.isInterfaceType(fieldType)) {
77121
77066
  return;
77122
77067
  }
77123
77068
  const keyFields = config2.keyFieldsForType(fieldType.name);
@@ -77132,9 +77077,9 @@ function addKeysToSelection(config2, node, fieldType) {
77132
77077
  continue;
77133
77078
  }
77134
77079
  selections.push({
77135
- kind: graphql27.Kind.FIELD,
77080
+ kind: graphql26.Kind.FIELD,
77136
77081
  name: {
77137
- kind: graphql27.Kind.NAME,
77082
+ kind: graphql26.Kind.NAME,
77138
77083
  value: keyField
77139
77084
  }
77140
77085
  });
@@ -77149,13 +77094,13 @@ function addKeysToSelection(config2, node, fieldType) {
77149
77094
  }
77150
77095
 
77151
77096
  // src/codegen/transforms/componentFields.ts
77152
- import * as graphql28 from "graphql";
77097
+ import * as graphql27 from "graphql";
77153
77098
  async function componentFields(config2, documents) {
77154
77099
  for (const document of documents) {
77155
- const typeInfo = new graphql28.TypeInfo(config2.schema);
77156
- document.document = graphql28.visit(
77100
+ const typeInfo = new graphql27.TypeInfo(config2.schema);
77101
+ document.document = graphql27.visit(
77157
77102
  document.document,
77158
- graphql28.visitWithTypeInfo(typeInfo, {
77103
+ graphql27.visitWithTypeInfo(typeInfo, {
77159
77104
  Field(node) {
77160
77105
  const parentType = typeInfo.getParentType();
77161
77106
  if (!parentType) {
@@ -77203,6 +77148,48 @@ async function componentFields(config2, documents) {
77203
77148
  }
77204
77149
  }
77205
77150
 
77151
+ // src/codegen/transforms/runtimeScalars.ts
77152
+ import * as graphql28 from "graphql";
77153
+ async function addTypename2(config2, documents) {
77154
+ for (const doc of documents) {
77155
+ doc.document = graphql28.visit(doc.document, {
77156
+ VariableDefinition(node) {
77157
+ const { type, wrappers } = unwrapType(config2, node.type);
77158
+ const runtimeScalar = config2.configFile.features?.runtimeScalars?.[type.name];
77159
+ if (runtimeScalar) {
77160
+ return {
77161
+ ...node,
77162
+ type: wrapType({
77163
+ type: config2.schema.getType(runtimeScalar.type),
77164
+ wrappers
77165
+ }),
77166
+ directives: [
77167
+ ...node.directives ?? [],
77168
+ {
77169
+ kind: "Directive",
77170
+ name: {
77171
+ kind: "Name",
77172
+ value: config2.runtimeScalarDirective
77173
+ },
77174
+ arguments: [
77175
+ {
77176
+ kind: "Argument",
77177
+ name: { kind: "Name", value: "type" },
77178
+ value: {
77179
+ kind: "StringValue",
77180
+ value: type.name
77181
+ }
77182
+ }
77183
+ ]
77184
+ }
77185
+ ]
77186
+ };
77187
+ }
77188
+ }
77189
+ });
77190
+ }
77191
+ }
77192
+
77206
77193
  // src/codegen/validators/typeCheck.ts
77207
77194
  import * as graphql29 from "graphql";
77208
77195
  async function typeCheck(config2, docs) {
@@ -78204,10 +78191,22 @@ async function componentFields2(config2, docs) {
78204
78191
  }
78205
78192
  const fieldValue = fieldArg.value?.kind === "StringValue" ? fieldArg.value.value : void 0;
78206
78193
  const propValue = propArg.value?.kind === "StringValue" ? propArg.value.value : void 0;
78194
+ const existingField = fieldValue && config2.componentFields[parent2]?.[fieldValue];
78207
78195
  const parentType = config2.schema.getType(parent2);
78208
- if (parentType && fieldValue && (graphql31.isObjectType(parentType) && parentType.getFields()[fieldValue] || config2.componentFields[parent2]?.[fieldValue])) {
78196
+ let conflict = false;
78197
+ if (existingField && existingField.filepath !== filepath) {
78198
+ conflict = true;
78199
+ } else if (parentType && fieldValue) {
78200
+ const fieldDef = graphql31.isObjectType(parentType) && parentType.getFields()[fieldValue];
78201
+ if (fieldDef && !fieldDef.astNode?.directives?.find(
78202
+ (dir) => dir.name.value === config2.componentFieldDirective
78203
+ )) {
78204
+ conflict = true;
78205
+ }
78206
+ }
78207
+ if (conflict) {
78209
78208
  errors.push({
78210
- message: `Duplicate component field definition for ${parent2}.${fieldValue}`,
78209
+ message: `Duplicate component field definition for ${parent2}.${fieldValue}.` + (existingField ? "The conflicting component field was defined in " + existingField.filepath : ""),
78211
78210
  filepath
78212
78211
  });
78213
78212
  }
@@ -78277,6 +78276,7 @@ async function runPipeline2(config2, docs) {
78277
78276
  [
78278
78277
  componentFields2,
78279
78278
  graphqlExtensions,
78279
+ addTypename2,
78280
78280
  ...wrapHook(beforeValidate),
78281
78281
  typeCheck,
78282
78282
  uniqueDocumentNames,