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
@@ -24851,7 +24851,7 @@ var require_path_visitor = __commonJS({
24851
24851
  }
24852
24852
  return target;
24853
24853
  }
24854
- PathVisitor.visit = function visit18(node, methods) {
24854
+ PathVisitor.visit = function visit19(node, methods) {
24855
24855
  return PathVisitor.fromMethodsObject(methods).visit(node);
24856
24856
  };
24857
24857
  var PVp = PathVisitor.prototype;
@@ -25042,7 +25042,7 @@ var require_path_visitor = __commonJS({
25042
25042
  this.needToCallTraverse = false;
25043
25043
  return visitChildren(path2, PathVisitor.fromMethodsObject(newVisitor || this.visitor));
25044
25044
  };
25045
- sharedContextProtoMethods.visit = function visit18(path2, newVisitor) {
25045
+ sharedContextProtoMethods.visit = function visit19(path2, newVisitor) {
25046
25046
  if (!(this instanceof this.Context)) {
25047
25047
  throw new Error("");
25048
25048
  }
@@ -26435,7 +26435,7 @@ var require_main = __commonJS({
26435
26435
  var someField = _a.someField;
26436
26436
  var Type = _a.Type;
26437
26437
  var use = _a.use;
26438
- var visit18 = _a.visit;
26438
+ var visit19 = _a.visit;
26439
26439
  exports.astNodesAreEquivalent = astNodesAreEquivalent;
26440
26440
  exports.builders = builders;
26441
26441
  exports.builtInTypes = builtInTypes;
@@ -26452,7 +26452,7 @@ var require_main = __commonJS({
26452
26452
  exports.someField = someField;
26453
26453
  exports.Type = Type;
26454
26454
  exports.use = use;
26455
- exports.visit = visit18;
26455
+ exports.visit = visit19;
26456
26456
  Object.assign(namedTypes_1.namedTypes, n);
26457
26457
  }
26458
26458
  });
@@ -53965,47 +53965,6 @@ function deepMerge(...objects) {
53965
53965
  return mergedObj;
53966
53966
  }
53967
53967
 
53968
- // src/runtime/lib/scalars.ts
53969
- async function marshalSelection({
53970
- selection,
53971
- data
53972
- }) {
53973
- const config = getCurrentConfig();
53974
- if (data === null || typeof data === "undefined") {
53975
- return data;
53976
- }
53977
- if (Array.isArray(data)) {
53978
- return await Promise.all(data.map((val) => marshalSelection({ selection, data: val })));
53979
- }
53980
- const targetSelection = getFieldsForType(selection, data["__typename"], false);
53981
- return Object.fromEntries(
53982
- await Promise.all(
53983
- Object.entries(data).map(async ([fieldName, value]) => {
53984
- const { type, selection: selection2 } = targetSelection[fieldName];
53985
- if (!type) {
53986
- return [fieldName, value];
53987
- }
53988
- if (selection2) {
53989
- return [fieldName, await marshalSelection({ selection: selection2, data: value })];
53990
- }
53991
- if (config.scalars?.[type]) {
53992
- const marshalFn = config.scalars[type].marshal;
53993
- if (!marshalFn) {
53994
- throw new Error(
53995
- `scalar type ${type} is missing a \`marshal\` function. see https://github.com/AlecAivazis/houdini#%EF%B8%8Fcustom-scalars`
53996
- );
53997
- }
53998
- if (Array.isArray(value)) {
53999
- return [fieldName, value.map(marshalFn)];
54000
- }
54001
- return [fieldName, marshalFn(value)];
54002
- }
54003
- return [fieldName, value];
54004
- })
54005
- )
54006
- );
54007
- }
54008
-
54009
53968
  // src/runtime/lib/types.ts
54010
53969
  var CachePolicy = {
54011
53970
  CacheOrNetwork: "CacheOrNetwork",
@@ -54033,11 +53992,6 @@ var RefetchUpdateMode = {
54033
53992
  prepend: "prepend",
54034
53993
  replace: "replace"
54035
53994
  };
54036
- var DataSource = {
54037
- Cache: "cache",
54038
- Network: "network",
54039
- Ssr: "ssr"
54040
- };
54041
53995
  var fragmentKey = " $fragments";
54042
53996
  var PendingValue = Symbol("houdini_loading");
54043
53997
 
@@ -56659,188 +56613,6 @@ var cache_default = new Cache();
56659
56613
  // src/runtime/client/plugins/cache.ts
56660
56614
  var serverSide = typeof globalThis.window === "undefined";
56661
56615
 
56662
- // src/runtime/client/utils/documentPlugins.ts
56663
- var documentPlugin = (kind, source) => {
56664
- return () => {
56665
- const sourceHandlers = source();
56666
- const enterWrapper = (handler) => {
56667
- return !handler ? void 0 : (ctx, handlers) => {
56668
- if (ctx.artifact.kind !== kind) {
56669
- return handlers.next(ctx);
56670
- }
56671
- return handler(ctx, handlers);
56672
- };
56673
- };
56674
- const exitWrapper = (handler) => {
56675
- return !handler ? void 0 : (ctx, handlers) => {
56676
- if (ctx.artifact.kind !== kind) {
56677
- return handlers.resolve(ctx);
56678
- }
56679
- return handler(ctx, handlers);
56680
- };
56681
- };
56682
- return {
56683
- start: enterWrapper(sourceHandlers.start),
56684
- network: enterWrapper(sourceHandlers.network),
56685
- afterNetwork: exitWrapper(sourceHandlers.afterNetwork),
56686
- end: exitWrapper(sourceHandlers.end),
56687
- catch: sourceHandlers.catch ? (ctx, handlers) => sourceHandlers.catch(ctx, handlers) : void 0,
56688
- cleanup: (...args) => sourceHandlers.cleanup?.(...args)
56689
- };
56690
- };
56691
- };
56692
-
56693
- // src/runtime/client/plugins/query.ts
56694
- var query = documentPlugin(ArtifactKind.Query, function() {
56695
- let subscriptionSpec = null;
56696
- let lastVariables = null;
56697
- return {
56698
- start(ctx, { next }) {
56699
- ctx.variables = {
56700
- ...lastVariables,
56701
- ...ctx.variables
56702
- };
56703
- next(ctx);
56704
- },
56705
- end(ctx, { resolve: resolve2, marshalVariables, variablesChanged }) {
56706
- if (variablesChanged(ctx) && !ctx.cacheParams?.disableSubscriptions) {
56707
- if (subscriptionSpec) {
56708
- cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
56709
- }
56710
- lastVariables = { ...marshalVariables(ctx) };
56711
- const variables = lastVariables;
56712
- subscriptionSpec = {
56713
- rootType: ctx.artifact.rootType,
56714
- selection: ctx.artifact.selection,
56715
- variables: () => variables,
56716
- set: (newValue) => {
56717
- resolve2(ctx, {
56718
- data: newValue,
56719
- errors: null,
56720
- fetching: false,
56721
- partial: false,
56722
- stale: false,
56723
- source: DataSource.Cache,
56724
- variables: ctx.variables ?? {}
56725
- });
56726
- }
56727
- };
56728
- cache_default.subscribe(subscriptionSpec, lastVariables);
56729
- }
56730
- resolve2(ctx);
56731
- },
56732
- cleanup() {
56733
- if (subscriptionSpec) {
56734
- cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.());
56735
- lastVariables = null;
56736
- }
56737
- }
56738
- };
56739
- });
56740
-
56741
- // src/runtime/client/plugins/fragment.ts
56742
- var fragment = documentPlugin(ArtifactKind.Fragment, function() {
56743
- let subscriptionSpec = null;
56744
- let lastReference = null;
56745
- return {
56746
- start(ctx, { next, resolve: resolve2, variablesChanged, marshalVariables }) {
56747
- if (!ctx.stuff.parentID) {
56748
- return next(ctx);
56749
- }
56750
- const currentReference = {
56751
- parent: ctx.stuff.parentID,
56752
- variables: marshalVariables(ctx)
56753
- };
56754
- if (!ctx.cacheParams?.disableSubscriptions && (!deepEquals(lastReference, currentReference) || variablesChanged(ctx))) {
56755
- if (subscriptionSpec) {
56756
- cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.() || {});
56757
- }
56758
- const variables = marshalVariables(ctx);
56759
- subscriptionSpec = {
56760
- rootType: ctx.artifact.rootType,
56761
- selection: ctx.artifact.selection,
56762
- variables: () => variables,
56763
- parentID: ctx.stuff.parentID,
56764
- set: (newValue) => {
56765
- resolve2(ctx, {
56766
- data: newValue,
56767
- errors: null,
56768
- fetching: false,
56769
- partial: false,
56770
- stale: false,
56771
- source: DataSource.Cache,
56772
- variables
56773
- });
56774
- }
56775
- };
56776
- cache_default.subscribe(subscriptionSpec, variables);
56777
- lastReference = currentReference;
56778
- }
56779
- next(ctx);
56780
- },
56781
- cleanup() {
56782
- if (subscriptionSpec) {
56783
- cache_default.unsubscribe(subscriptionSpec, subscriptionSpec.variables?.());
56784
- }
56785
- }
56786
- };
56787
- });
56788
-
56789
- // src/runtime/client/plugins/mutation.ts
56790
- var mutation = documentPlugin(ArtifactKind.Mutation, () => {
56791
- return {
56792
- async start(ctx, { next, marshalVariables }) {
56793
- const layerOptimistic = cache_default._internal_unstable.storage.createLayer(true);
56794
- const optimisticResponse = ctx.stuff.optimisticResponse;
56795
- let toNotify = [];
56796
- if (optimisticResponse) {
56797
- toNotify = cache_default.write({
56798
- selection: ctx.artifact.selection,
56799
- data: await marshalSelection({
56800
- selection: ctx.artifact.selection,
56801
- data: optimisticResponse
56802
- }),
56803
- variables: marshalVariables(ctx),
56804
- layer: layerOptimistic.id
56805
- });
56806
- }
56807
- ctx.cacheParams = {
56808
- ...ctx.cacheParams,
56809
- layer: layerOptimistic,
56810
- notifySubscribers: toNotify,
56811
- forceNotify: true
56812
- };
56813
- next(ctx);
56814
- },
56815
- afterNetwork(ctx, { resolve: resolve2 }) {
56816
- if (ctx.cacheParams?.layer) {
56817
- cache_default.clearLayer(ctx.cacheParams.layer.id);
56818
- }
56819
- resolve2(ctx);
56820
- },
56821
- end(ctx, { resolve: resolve2, value }) {
56822
- const hasErrors = value.errors && value.errors.length > 0;
56823
- if (hasErrors) {
56824
- if (ctx.cacheParams?.layer) {
56825
- cache_default.clearLayer(ctx.cacheParams.layer.id);
56826
- }
56827
- }
56828
- if (ctx.cacheParams?.layer) {
56829
- cache_default._internal_unstable.storage.resolveLayer(ctx.cacheParams.layer.id);
56830
- }
56831
- resolve2(ctx);
56832
- },
56833
- catch(ctx, { error }) {
56834
- if (ctx.cacheParams?.layer) {
56835
- const { layer } = ctx.cacheParams;
56836
- cache_default.clearLayer(layer.id);
56837
- cache_default._internal_unstable.storage.resolveLayer(layer.id);
56838
- }
56839
- throw error;
56840
- }
56841
- };
56842
- });
56843
-
56844
56616
  // src/lib/types.ts
56845
56617
  var LogLevel = {
56846
56618
  Full: "full",
@@ -56958,7 +56730,7 @@ function definitionFromAncestors(ancestors) {
56958
56730
  }
56959
56731
  return { parents, definition };
56960
56732
  }
56961
- function unwrapType(config, type, wrappers = []) {
56733
+ function unwrapType(config, type, wrappers = [], convertRuntimeScalars) {
56962
56734
  if (type.kind === "NonNullType") {
56963
56735
  return unwrapType(config, type.type, [TypeWrapper.NonNull, ...wrappers]);
56964
56736
  }
@@ -56974,9 +56746,14 @@ function unwrapType(config, type, wrappers = []) {
56974
56746
  if (type instanceof graphql3.GraphQLList) {
56975
56747
  return unwrapType(config, type.ofType, [TypeWrapper.List, ...wrappers]);
56976
56748
  }
56749
+ if (convertRuntimeScalars && config.configFile.features?.runtimeScalars?.[type.name.value]) {
56750
+ type = config.schema.getType(
56751
+ config.configFile.features?.runtimeScalars?.[type.name.value].type
56752
+ );
56753
+ }
56977
56754
  const namedType = config.schema.getType(type.name.value || type.name);
56978
56755
  if (!namedType) {
56979
- throw new Error("Could not unwrap type: " + JSON.stringify(type));
56756
+ throw new Error("Unknown type: " + type.name.value || type.name);
56980
56757
  }
56981
56758
  return { type: namedType, wrappers };
56982
56759
  }
@@ -57113,6 +56890,152 @@ async function cleanupFiles(pathFolder, listOfObj) {
57113
56890
  return allFilesNotInList;
57114
56891
  }
57115
56892
 
56893
+ // src/lib/typescript.ts
56894
+ var recast2 = __toESM(require_main2(), 1);
56895
+ import * as graphql4 from "graphql";
56896
+ var AST2 = recast2.types.builders;
56897
+ function unwrappedTsTypeReference(config, filepath, missingScalars, {
56898
+ type,
56899
+ wrappers
56900
+ }, body) {
56901
+ let result;
56902
+ if (graphql4.isScalarType(type)) {
56903
+ result = scalarPropertyValue(config, filepath, missingScalars, type, body, null);
56904
+ } else if (graphql4.isEnumType(type)) {
56905
+ result = enumReference(config, body, type.name);
56906
+ } else {
56907
+ result = AST2.tsTypeReference(AST2.identifier(type.name));
56908
+ }
56909
+ for (const toWrap of wrappers) {
56910
+ if (toWrap === "NonNull" /* NonNull */) {
56911
+ continue;
56912
+ } else if (toWrap === "Nullable" /* Nullable */) {
56913
+ result = nullableField(result, true);
56914
+ } else if (toWrap === "List" /* List */) {
56915
+ result = AST2.tsArrayType(AST2.tsParenthesizedType(result));
56916
+ }
56917
+ }
56918
+ return result;
56919
+ }
56920
+ function tsTypeReference(config, filepath, missingScalars, definition, body) {
56921
+ const { type, wrappers } = unwrapType(config, definition.type);
56922
+ return unwrappedTsTypeReference(
56923
+ config,
56924
+ filepath,
56925
+ missingScalars,
56926
+ { type, wrappers },
56927
+ body
56928
+ );
56929
+ }
56930
+ function enumReference(config, body, name) {
56931
+ ensureImports({
56932
+ config,
56933
+ body,
56934
+ import: ["ValueOf"],
56935
+ importKind: "type",
56936
+ sourceModule: "$houdini/runtime/lib/types"
56937
+ });
56938
+ return AST2.tsTypeReference(
56939
+ AST2.identifier("ValueOf"),
56940
+ AST2.tsTypeParameterInstantiation([AST2.tsTypeQuery(AST2.identifier(name))])
56941
+ );
56942
+ }
56943
+ function readonlyProperty(prop, enable = true) {
56944
+ if (enable) {
56945
+ prop.readonly = true;
56946
+ }
56947
+ return prop;
56948
+ }
56949
+ function nullableField(inner, input = false) {
56950
+ const members = [inner, AST2.tsNullKeyword()];
56951
+ if (input) {
56952
+ members.push(AST2.tsUndefinedKeyword());
56953
+ }
56954
+ return AST2.tsUnionType(members);
56955
+ }
56956
+ function scalarPropertyValue(config, filepath, missingScalars, target, body, field) {
56957
+ if (config.configFile.features?.componentFields && target.name === config.componentScalar) {
56958
+ if (!field) {
56959
+ return AST2.tsNeverKeyword();
56960
+ }
56961
+ const component = config.componentFields[field.parent][field.field];
56962
+ const sourcePathRelative = path_exports.relative(
56963
+ path_exports.join(config.projectRoot, "src"),
56964
+ component.filepath
56965
+ );
56966
+ let sourcePathParsed = path_exports.parse(sourcePathRelative);
56967
+ let sourcePath = path_exports.join(sourcePathParsed.dir, sourcePathParsed.name);
56968
+ const localImport = ensureImports({
56969
+ config,
56970
+ body,
56971
+ import: "__component__" + component.fragment,
56972
+ sourceModule: path_exports.join(
56973
+ path_exports.relative(path_exports.dirname(filepath), config.projectRoot),
56974
+ "src",
56975
+ sourcePath
56976
+ )
56977
+ }) ?? "__component__" + component.fragment;
56978
+ const parameters = AST2.tsTypeReference(AST2.identifier("Parameters"));
56979
+ parameters.typeParameters = AST2.tsTypeParameterInstantiation([
56980
+ AST2.tsTypeQuery(AST2.identifier(localImport))
56981
+ ]);
56982
+ const indexed = AST2.tsIndexedAccessType(
56983
+ parameters,
56984
+ AST2.tsLiteralType(AST2.numericLiteral(0))
56985
+ );
56986
+ const omit = AST2.tsTypeReference(AST2.identifier("Omit"));
56987
+ omit.typeParameters = AST2.tsTypeParameterInstantiation([
56988
+ indexed,
56989
+ AST2.tsLiteralType(AST2.stringLiteral(component.prop))
56990
+ ]);
56991
+ const arg = AST2.identifier("props");
56992
+ arg.typeAnnotation = AST2.tsTypeAnnotation(omit);
56993
+ const returnType = AST2.tsTypeReference(AST2.identifier("ReturnType"));
56994
+ returnType.typeParameters = AST2.tsTypeParameterInstantiation([
56995
+ AST2.tsTypeQuery(AST2.identifier(localImport))
56996
+ ]);
56997
+ const fnType = AST2.tsFunctionType([arg]);
56998
+ fnType.typeAnnotation = AST2.tsTypeAnnotation(returnType);
56999
+ return fnType;
57000
+ }
57001
+ switch (target.name) {
57002
+ case "String": {
57003
+ return AST2.tsStringKeyword();
57004
+ }
57005
+ case "Int": {
57006
+ return AST2.tsNumberKeyword();
57007
+ }
57008
+ case "Float": {
57009
+ return AST2.tsNumberKeyword();
57010
+ }
57011
+ case "Boolean": {
57012
+ return AST2.tsBooleanKeyword();
57013
+ }
57014
+ case "ID": {
57015
+ return AST2.tsStringKeyword();
57016
+ }
57017
+ default: {
57018
+ if (graphql4.isNonNullType(target) && "ofType" in target) {
57019
+ return scalarPropertyValue(
57020
+ config,
57021
+ filepath,
57022
+ missingScalars,
57023
+ target.ofType,
57024
+ body,
57025
+ field
57026
+ );
57027
+ }
57028
+ if (config.scalars?.[target.name]) {
57029
+ return AST2.tsTypeReference(AST2.identifier(config.scalars?.[target.name].type));
57030
+ }
57031
+ if (target.name !== config.componentScalar) {
57032
+ missingScalars.add(target.name);
57033
+ }
57034
+ return AST2.tsAnyKeyword();
57035
+ }
57036
+ }
57037
+ }
57038
+
57116
57039
  // ../../node_modules/.pnpm/estree-walker@3.0.1/node_modules/estree-walker/src/walker.js
57117
57040
  var WalkerBase = class {
57118
57041
  constructor() {
@@ -57226,7 +57149,7 @@ async function asyncWalk(ast, { enter, leave }) {
57226
57149
  }
57227
57150
 
57228
57151
  // src/lib/walk.ts
57229
- import * as graphql4 from "graphql";
57152
+ import * as graphql5 from "graphql";
57230
57153
  async function find_graphql(config, parsedScript, walker) {
57231
57154
  await asyncWalk(parsedScript, {
57232
57155
  async enter(node, parent2) {
@@ -57281,7 +57204,7 @@ async function find_graphql(config, parsedScript, walker) {
57281
57204
  } else if (!documentString) {
57282
57205
  return;
57283
57206
  }
57284
- const parsedTag = graphql4.parse(documentString);
57207
+ const parsedTag = graphql5.parse(documentString);
57285
57208
  if (walker.where && !walker.where(parsedTag, { node, parent: parent2 })) {
57286
57209
  return;
57287
57210
  }
@@ -57413,7 +57336,7 @@ function extractAnonymousQuery(config, raw, expr, propName) {
57413
57336
  };
57414
57337
  return defs.concat([
57415
57338
  {
57416
- raw: graphql4.print(parsed),
57339
+ raw: graphql5.print(parsed),
57417
57340
  parsed
57418
57341
  }
57419
57342
  ]);
@@ -57428,11 +57351,11 @@ function extractAnonymousQuery(config, raw, expr, propName) {
57428
57351
 
57429
57352
  // src/lib/router/manifest.ts
57430
57353
  var t = __toESM(require_lib6(), 1);
57431
- import * as graphql5 from "graphql";
57354
+ import * as graphql6 from "graphql";
57432
57355
 
57433
57356
  // src/codegen/generators/artifacts/index.ts
57434
- var recast4 = __toESM(require_main2(), 1);
57435
- import * as graphql16 from "graphql";
57357
+ var recast5 = __toESM(require_main2(), 1);
57358
+ import * as graphql17 from "graphql";
57436
57359
 
57437
57360
  // src/codegen/utils/commonjs.ts
57438
57361
  var cjsIndexFilePreamble = `"use strict";
@@ -57674,19 +57597,19 @@ var FieldCollection = class {
57674
57597
  };
57675
57598
 
57676
57599
  // src/codegen/utils/moduleExport.ts
57677
- var recast2 = __toESM(require_main2(), 1);
57678
- var AST2 = recast2.types.builders;
57600
+ var recast3 = __toESM(require_main2(), 1);
57601
+ var AST3 = recast3.types.builders;
57679
57602
  function moduleExport(config, key, value) {
57680
57603
  if (config.module === "commonjs") {
57681
- let target = AST2.memberExpression(AST2.identifier("module"), AST2.identifier("exports"));
57604
+ let target = AST3.memberExpression(AST3.identifier("module"), AST3.identifier("exports"));
57682
57605
  if (key !== "default") {
57683
- target = AST2.memberExpression(target, AST2.identifier(key));
57606
+ target = AST3.memberExpression(target, AST3.identifier(key));
57684
57607
  }
57685
- return AST2.expressionStatement(AST2.assignmentExpression("=", target, value));
57608
+ return AST3.expressionStatement(AST3.assignmentExpression("=", target, value));
57686
57609
  }
57687
- return key === "default" ? AST2.exportDefaultDeclaration(value) : AST2.exportNamedDeclaration(
57688
- AST2.variableDeclaration("const", [
57689
- AST2.variableDeclarator(AST2.identifier(key), value)
57610
+ return key === "default" ? AST3.exportDefaultDeclaration(value) : AST3.exportNamedDeclaration(
57611
+ AST3.variableDeclaration("const", [
57612
+ AST3.variableDeclarator(AST3.identifier(key), value)
57690
57613
  ])
57691
57614
  );
57692
57615
  }
@@ -57943,7 +57866,7 @@ var serialize = (value, { json, lossy } = {}) => {
57943
57866
  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));
57944
57867
 
57945
57868
  // src/codegen/transforms/fragmentVariables.ts
57946
- import * as graphql7 from "graphql";
57869
+ import * as graphql8 from "graphql";
57947
57870
 
57948
57871
  // src/codegen/utils/stripLoc.ts
57949
57872
  function stripLoc(value) {
@@ -57964,7 +57887,7 @@ function stripLoc(value) {
57964
57887
  }
57965
57888
 
57966
57889
  // src/codegen/transforms/collectDefinitions.ts
57967
- import * as graphql6 from "graphql";
57890
+ import * as graphql7 from "graphql";
57968
57891
  import { Kind as GraphqlKinds } from "graphql";
57969
57892
  async function includeFragmentDefinitions(config, documents) {
57970
57893
  const fragments = collectDefinitions(config, documents);
@@ -58014,10 +57937,10 @@ function collectDefinitions(config, docs) {
58014
57937
  }
58015
57938
  function findRequiredFragments(config, definition) {
58016
57939
  const referencedFragments = [];
58017
- const typeInfo = new graphql6.TypeInfo(config.schema);
58018
- definition.selectionSet = graphql6.visit(
57940
+ const typeInfo = new graphql7.TypeInfo(config.schema);
57941
+ definition.selectionSet = graphql7.visit(
58019
57942
  definition,
58020
- graphql6.visitWithTypeInfo(typeInfo, {
57943
+ graphql7.visitWithTypeInfo(typeInfo, {
58021
57944
  FragmentSpread(node) {
58022
57945
  referencedFragments.push(node.name.value);
58023
57946
  }
@@ -58051,7 +57974,7 @@ function flattenFragments(filepath, operation, fragments) {
58051
57974
  }
58052
57975
 
58053
57976
  // src/codegen/transforms/fragmentVariables.ts
58054
- var GraphqlKinds2 = graphql7.Kind;
57977
+ var GraphqlKinds2 = graphql8.Kind;
58055
57978
  async function fragmentVariables(config, documents) {
58056
57979
  const fragments = collectDefinitions(config, documents);
58057
57980
  const generatedFragments = {};
@@ -58074,7 +57997,7 @@ async function fragmentVariables(config, documents) {
58074
57997
  });
58075
57998
  }
58076
57999
  const doc = {
58077
- kind: graphql7.Kind.DOCUMENT,
58000
+ kind: graphql8.Kind.DOCUMENT,
58078
58001
  definitions: Object.values(generatedFragments)
58079
58002
  };
58080
58003
  documents.push({
@@ -58145,7 +58068,7 @@ function inlineFragmentArgs({
58145
58068
  return null;
58146
58069
  };
58147
58070
  const result = esm_default(
58148
- graphql7.visit(document, {
58071
+ graphql8.visit(document, {
58149
58072
  FragmentSpread(node) {
58150
58073
  if (!fragmentDefinitions[node.name.value]) {
58151
58074
  throw new Error("Could not find definition for fragment" + node.name.value);
@@ -58231,7 +58154,7 @@ function inlineFragmentArgs({
58231
58154
  );
58232
58155
  if (newName) {
58233
58156
  result.name = {
58234
- kind: graphql7.Kind.NAME,
58157
+ kind: graphql8.Kind.NAME,
58235
58158
  value: newName
58236
58159
  };
58237
58160
  }
@@ -58398,8 +58321,8 @@ ${exportDefaultFrom(`./${doc.name}`, doc.name)}`,
58398
58321
  }
58399
58322
 
58400
58323
  // src/codegen/generators/artifacts/inputs.ts
58401
- import * as graphql8 from "graphql";
58402
- function inputObject(config, inputs) {
58324
+ import * as graphql9 from "graphql";
58325
+ function inputObject(config, inputs, runtimeScalars) {
58403
58326
  const visitedTypes = /* @__PURE__ */ new Set();
58404
58327
  const inputObj = {
58405
58328
  fields: inputs.reduce((fields, input) => {
@@ -58415,7 +58338,8 @@ function inputObject(config, inputs) {
58415
58338
  ...fields,
58416
58339
  [input.variable.name.value]: input.defaultValue ? variableValue(input.defaultValue, {}) : void 0
58417
58340
  };
58418
- }, {})
58341
+ }, {}),
58342
+ runtimeScalars
58419
58343
  };
58420
58344
  for (const input of inputs) {
58421
58345
  walkInputs(config, visitedTypes, inputObj, input.type);
@@ -58427,10 +58351,10 @@ function walkInputs(config, visitedTypes, inputObj, rootType) {
58427
58351
  if (visitedTypes.has(type.name)) {
58428
58352
  return;
58429
58353
  }
58430
- if (graphql8.isEnumType(type) || graphql8.isScalarType(type)) {
58354
+ if (graphql9.isEnumType(type) || graphql9.isScalarType(type)) {
58431
58355
  return;
58432
58356
  }
58433
- if (graphql8.isUnionType(type)) {
58357
+ if (graphql9.isUnionType(type)) {
58434
58358
  return;
58435
58359
  }
58436
58360
  visitedTypes.add(type.name);
@@ -58448,50 +58372,50 @@ function walkInputs(config, visitedTypes, inputObj, rootType) {
58448
58372
  }
58449
58373
 
58450
58374
  // src/codegen/generators/artifacts/operations.ts
58451
- import * as graphql10 from "graphql";
58375
+ import * as graphql11 from "graphql";
58452
58376
 
58453
58377
  // src/codegen/generators/artifacts/utils.ts
58454
- var recast3 = __toESM(require_main2(), 1);
58455
- import * as graphql9 from "graphql";
58456
- var AST3 = recast3.types.builders;
58378
+ var recast4 = __toESM(require_main2(), 1);
58379
+ import * as graphql10 from "graphql";
58380
+ var AST4 = recast4.types.builders;
58457
58381
  function serializeValue(value) {
58458
58382
  if (Array.isArray(value)) {
58459
- return AST3.arrayExpression(value.map(serializeValue));
58383
+ return AST4.arrayExpression(value.map(serializeValue));
58460
58384
  }
58461
58385
  if (typeof value === "object" && value !== null) {
58462
- return AST3.objectExpression(
58386
+ return AST4.objectExpression(
58463
58387
  Object.entries(value).filter(([key, value2]) => typeof value2 !== "undefined").map(([key, val]) => {
58464
- return AST3.objectProperty(AST3.stringLiteral(key), serializeValue(val));
58388
+ return AST4.objectProperty(AST4.stringLiteral(key), serializeValue(val));
58465
58389
  })
58466
58390
  );
58467
58391
  }
58468
58392
  if (typeof value === "string") {
58469
58393
  if (value.indexOf("\n") !== -1) {
58470
- return AST3.templateLiteral(
58471
- [AST3.templateElement({ raw: value, cooked: value }, true)],
58394
+ return AST4.templateLiteral(
58395
+ [AST4.templateElement({ raw: value, cooked: value }, true)],
58472
58396
  []
58473
58397
  );
58474
58398
  }
58475
- return AST3.stringLiteral(value);
58399
+ return AST4.stringLiteral(value);
58476
58400
  }
58477
- return AST3.literal(value);
58401
+ return AST4.literal(value);
58478
58402
  }
58479
58403
  function convertValue(config, val) {
58480
58404
  let value;
58481
58405
  let kind;
58482
- if (val.kind === graphql9.Kind.INT) {
58406
+ if (val.kind === graphql10.Kind.INT) {
58483
58407
  value = parseInt(val.value, 10);
58484
58408
  kind = "Int";
58485
- } else if (val.kind === graphql9.Kind.FLOAT) {
58409
+ } else if (val.kind === graphql10.Kind.FLOAT) {
58486
58410
  value = parseFloat(val.value);
58487
58411
  kind = "Float";
58488
- } else if (val.kind === graphql9.Kind.BOOLEAN) {
58412
+ } else if (val.kind === graphql10.Kind.BOOLEAN) {
58489
58413
  value = val.value;
58490
58414
  kind = "Boolean";
58491
- } else if (val.kind === graphql9.Kind.VARIABLE) {
58415
+ } else if (val.kind === graphql10.Kind.VARIABLE) {
58492
58416
  value = val.name.value;
58493
58417
  kind = "Variable";
58494
- } else if (val.kind === graphql9.Kind.STRING) {
58418
+ } else if (val.kind === graphql10.Kind.STRING) {
58495
58419
  value = val.value;
58496
58420
  kind = "String";
58497
58421
  }
@@ -58504,7 +58428,7 @@ function operationsByPath(config, filepath, definition, filterTypes) {
58504
58428
  return {};
58505
58429
  }
58506
58430
  const pathOperations = {};
58507
- graphql10.visit(definition, {
58431
+ graphql11.visit(definition, {
58508
58432
  FragmentSpread(node, _, __, ___, ancestors) {
58509
58433
  if (!config.isListFragment(node.name.value)) {
58510
58434
  return;
@@ -58663,19 +58587,19 @@ function ancestorKey(ancestors) {
58663
58587
  }
58664
58588
 
58665
58589
  // src/codegen/generators/artifacts/selection.ts
58666
- import * as graphql15 from "graphql";
58590
+ import * as graphql16 from "graphql";
58667
58591
 
58668
58592
  // src/codegen/transforms/list.ts
58669
- import * as graphql13 from "graphql";
58593
+ import * as graphql14 from "graphql";
58670
58594
 
58671
58595
  // src/codegen/utils/objectIdentificationSelection.ts
58672
- import * as graphql11 from "graphql";
58596
+ import * as graphql12 from "graphql";
58673
58597
  var objectIdentificationSelection = (config, type) => {
58674
58598
  return config.keyFieldsForType(type.name).map((key) => {
58675
58599
  return {
58676
- kind: graphql11.Kind.FIELD,
58600
+ kind: graphql12.Kind.FIELD,
58677
58601
  name: {
58678
- kind: graphql11.Kind.NAME,
58602
+ kind: graphql12.Kind.NAME,
58679
58603
  value: key
58680
58604
  }
58681
58605
  };
@@ -58683,7 +58607,7 @@ var objectIdentificationSelection = (config, type) => {
58683
58607
  };
58684
58608
 
58685
58609
  // src/codegen/transforms/paginate.ts
58686
- import * as graphql12 from "graphql";
58610
+ import * as graphql13 from "graphql";
58687
58611
  async function paginate(config, documents) {
58688
58612
  const newDocs = [];
58689
58613
  for (const doc of documents) {
@@ -58716,7 +58640,7 @@ async function paginate(config, documents) {
58716
58640
  };
58717
58641
  let cursorType = "String";
58718
58642
  let paginationPath = [];
58719
- doc.document = graphql12.visit(doc.document, {
58643
+ doc.document = graphql13.visit(doc.document, {
58720
58644
  Field(node, _, __, ___, ancestors) {
58721
58645
  const paginateDirective = node.directives?.find(
58722
58646
  (directive) => directive.name.value === config.paginateDirective
@@ -58742,7 +58666,7 @@ async function paginate(config, documents) {
58742
58666
  flags.offset.enabled = offsetPagination;
58743
58667
  flags.limit.enabled = offsetPagination;
58744
58668
  paginationPath = ancestors.filter(
58745
- (ancestor) => !Array.isArray(ancestor) && ancestor.kind === graphql12.Kind.FIELD
58669
+ (ancestor) => !Array.isArray(ancestor) && ancestor.kind === graphql13.Kind.FIELD
58746
58670
  ).concat(node).map((field) => field.alias?.value || field.name.value);
58747
58671
  return {
58748
58672
  ...node,
@@ -58761,7 +58685,7 @@ async function paginate(config, documents) {
58761
58685
  let fragment2 = "";
58762
58686
  let paginateMode = config.defaultPaginateMode;
58763
58687
  const requiredArgs = [];
58764
- doc.document = graphql12.visit(doc.document, {
58688
+ doc.document = graphql13.visit(doc.document, {
58765
58689
  OperationDefinition(node) {
58766
58690
  if (node.operation !== "query") {
58767
58691
  throw new HoudiniError({
@@ -58820,9 +58744,9 @@ async function paginate(config, documents) {
58820
58744
  directives: [
58821
58745
  ...node.directives || [],
58822
58746
  {
58823
- kind: graphql12.Kind.DIRECTIVE,
58747
+ kind: graphql13.Kind.DIRECTIVE,
58824
58748
  name: {
58825
- kind: graphql12.Kind.NAME,
58749
+ kind: graphql13.Kind.NAME,
58826
58750
  value: config.argumentsDirective
58827
58751
  }
58828
58752
  }
@@ -58892,22 +58816,22 @@ async function paginate(config, documents) {
58892
58816
  const paginationArgs = Object.entries(flags).filter(([_, { enabled }]) => enabled).map(([key, value]) => ({ name: key, ...value }));
58893
58817
  const fragmentSpreadSelection = [
58894
58818
  {
58895
- kind: graphql12.Kind.FRAGMENT_SPREAD,
58819
+ kind: graphql13.Kind.FRAGMENT_SPREAD,
58896
58820
  name: {
58897
- kind: graphql12.Kind.NAME,
58821
+ kind: graphql13.Kind.NAME,
58898
58822
  value: fragmentName
58899
58823
  },
58900
58824
  directives: [
58901
58825
  {
58902
- kind: graphql12.Kind.DIRECTIVE,
58826
+ kind: graphql13.Kind.DIRECTIVE,
58903
58827
  name: {
58904
- kind: graphql12.Kind.NAME,
58828
+ kind: graphql13.Kind.NAME,
58905
58829
  value: config.withDirective
58906
58830
  },
58907
58831
  ["arguments"]: requiredArgs.map((arg) => variableAsArgument(arg.name)).concat(paginationArgs.map(({ name }) => variableAsArgument(name)))
58908
58832
  },
58909
58833
  {
58910
- kind: graphql12.Kind.DIRECTIVE,
58834
+ kind: graphql13.Kind.DIRECTIVE,
58911
58835
  name: {
58912
58836
  kind: "Name",
58913
58837
  value: config.maskDisableDirective
@@ -58934,23 +58858,23 @@ async function paginate(config, documents) {
58934
58858
  });
58935
58859
  const typeConfig = config.typeConfig?.[fragment2];
58936
58860
  const queryDoc = {
58937
- kind: graphql12.Kind.DOCUMENT,
58861
+ kind: graphql13.Kind.DOCUMENT,
58938
58862
  definitions: [
58939
58863
  {
58940
- kind: graphql12.Kind.OPERATION_DEFINITION,
58864
+ kind: graphql13.Kind.OPERATION_DEFINITION,
58941
58865
  name: {
58942
- kind: graphql12.Kind.NAME,
58866
+ kind: graphql13.Kind.NAME,
58943
58867
  value: refetchQueryName
58944
58868
  },
58945
58869
  operation: "query",
58946
58870
  variableDefinitions: requiredArgs.map(
58947
58871
  (arg) => ({
58948
- kind: graphql12.Kind.VARIABLE_DEFINITION,
58872
+ kind: graphql13.Kind.VARIABLE_DEFINITION,
58949
58873
  type: arg.type,
58950
58874
  variable: {
58951
- kind: graphql12.Kind.VARIABLE,
58875
+ kind: graphql13.Kind.VARIABLE,
58952
58876
  name: {
58953
- kind: graphql12.Kind.NAME,
58877
+ kind: graphql13.Kind.NAME,
58954
58878
  value: arg.name
58955
58879
  }
58956
58880
  }
@@ -58958,18 +58882,18 @@ async function paginate(config, documents) {
58958
58882
  ).concat(
58959
58883
  paginationArgs.map(
58960
58884
  (arg) => ({
58961
- kind: graphql12.Kind.VARIABLE_DEFINITION,
58885
+ kind: graphql13.Kind.VARIABLE_DEFINITION,
58962
58886
  type: {
58963
- kind: graphql12.Kind.NAMED_TYPE,
58887
+ kind: graphql13.Kind.NAMED_TYPE,
58964
58888
  name: {
58965
- kind: graphql12.Kind.NAME,
58889
+ kind: graphql13.Kind.NAME,
58966
58890
  value: arg.type
58967
58891
  }
58968
58892
  },
58969
58893
  variable: {
58970
- kind: graphql12.Kind.VARIABLE,
58894
+ kind: graphql13.Kind.VARIABLE,
58971
58895
  name: {
58972
- kind: graphql12.Kind.NAME,
58896
+ kind: graphql13.Kind.NAME,
58973
58897
  value: arg.name
58974
58898
  }
58975
58899
  },
@@ -58981,12 +58905,12 @@ async function paginate(config, documents) {
58981
58905
  ).concat(
58982
58906
  !nodeQuery ? [] : keys2.map(
58983
58907
  (key) => ({
58984
- kind: graphql12.Kind.VARIABLE_DEFINITION,
58908
+ kind: graphql13.Kind.VARIABLE_DEFINITION,
58985
58909
  type: key.type,
58986
58910
  variable: {
58987
- kind: graphql12.Kind.VARIABLE,
58911
+ kind: graphql13.Kind.VARIABLE,
58988
58912
  name: {
58989
- kind: graphql12.Kind.NAME,
58913
+ kind: graphql13.Kind.NAME,
58990
58914
  value: key.name
58991
58915
  }
58992
58916
  }
@@ -58995,42 +58919,42 @@ async function paginate(config, documents) {
58995
58919
  )
58996
58920
  ),
58997
58921
  selectionSet: {
58998
- kind: graphql12.Kind.SELECTION_SET,
58922
+ kind: graphql13.Kind.SELECTION_SET,
58999
58923
  selections: !nodeQuery ? fragmentSpreadSelection : [
59000
58924
  {
59001
- kind: graphql12.Kind.FIELD,
58925
+ kind: graphql13.Kind.FIELD,
59002
58926
  name: {
59003
- kind: graphql12.Kind.NAME,
58927
+ kind: graphql13.Kind.NAME,
59004
58928
  value: typeConfig?.resolve?.queryField || "node"
59005
58929
  },
59006
58930
  ["arguments"]: keys2.map((key) => ({
59007
- kind: graphql12.Kind.ARGUMENT,
58931
+ kind: graphql13.Kind.ARGUMENT,
59008
58932
  name: {
59009
- kind: graphql12.Kind.NAME,
58933
+ kind: graphql13.Kind.NAME,
59010
58934
  value: key.name
59011
58935
  },
59012
58936
  value: {
59013
- kind: graphql12.Kind.VARIABLE,
58937
+ kind: graphql13.Kind.VARIABLE,
59014
58938
  name: {
59015
- kind: graphql12.Kind.NAME,
58939
+ kind: graphql13.Kind.NAME,
59016
58940
  value: key.name
59017
58941
  }
59018
58942
  }
59019
58943
  })),
59020
58944
  selectionSet: {
59021
- kind: graphql12.Kind.SELECTION_SET,
58945
+ kind: graphql13.Kind.SELECTION_SET,
59022
58946
  selections: [
59023
58947
  {
59024
- kind: graphql12.Kind.FIELD,
58948
+ kind: graphql13.Kind.FIELD,
59025
58949
  name: {
59026
- kind: graphql12.Kind.NAME,
58950
+ kind: graphql13.Kind.NAME,
59027
58951
  value: "__typename"
59028
58952
  }
59029
58953
  },
59030
58954
  ...(typeConfig?.keys || [config.defaultKeys[0]]).map((key) => ({
59031
- kind: graphql12.Kind.FIELD,
58955
+ kind: graphql13.Kind.FIELD,
59032
58956
  name: {
59033
- kind: graphql12.Kind.NAME,
58957
+ kind: graphql13.Kind.NAME,
59034
58958
  value: key
59035
58959
  }
59036
58960
  })),
@@ -59087,15 +59011,15 @@ function replaceArgumentsWithVariables(args, flags) {
59087
59011
  }
59088
59012
  function variableAsArgument(name, variable) {
59089
59013
  return {
59090
- kind: graphql12.Kind.ARGUMENT,
59014
+ kind: graphql13.Kind.ARGUMENT,
59091
59015
  name: {
59092
- kind: graphql12.Kind.NAME,
59016
+ kind: graphql13.Kind.NAME,
59093
59017
  value: name
59094
59018
  },
59095
59019
  value: {
59096
- kind: graphql12.Kind.VARIABLE,
59020
+ kind: graphql13.Kind.VARIABLE,
59097
59021
  name: {
59098
- kind: graphql12.Kind.NAME,
59022
+ kind: graphql13.Kind.NAME,
59099
59023
  value: variable ?? name
59100
59024
  }
59101
59025
  }
@@ -59103,18 +59027,18 @@ function variableAsArgument(name, variable) {
59103
59027
  }
59104
59028
  function staticVariableDefinition(name, type, defaultValue, variableName) {
59105
59029
  return {
59106
- kind: graphql12.Kind.VARIABLE_DEFINITION,
59030
+ kind: graphql13.Kind.VARIABLE_DEFINITION,
59107
59031
  type: {
59108
- kind: graphql12.Kind.NAMED_TYPE,
59032
+ kind: graphql13.Kind.NAMED_TYPE,
59109
59033
  name: {
59110
- kind: graphql12.Kind.NAME,
59034
+ kind: graphql13.Kind.NAME,
59111
59035
  value: type
59112
59036
  }
59113
59037
  },
59114
59038
  variable: {
59115
- kind: graphql12.Kind.VARIABLE,
59039
+ kind: graphql13.Kind.VARIABLE,
59116
59040
  name: {
59117
- kind: graphql12.Kind.NAME,
59041
+ kind: graphql13.Kind.NAME,
59118
59042
  value: variableName ?? name
59119
59043
  }
59120
59044
  },
@@ -59126,9 +59050,9 @@ function staticVariableDefinition(name, type, defaultValue, variableName) {
59126
59050
  }
59127
59051
  function argumentNode(name, value) {
59128
59052
  return {
59129
- kind: graphql12.Kind.ARGUMENT,
59053
+ kind: graphql13.Kind.ARGUMENT,
59130
59054
  name: {
59131
- kind: graphql12.Kind.NAME,
59055
+ kind: graphql13.Kind.NAME,
59132
59056
  value: name
59133
59057
  },
59134
59058
  value: objectNode(value)
@@ -59136,16 +59060,16 @@ function argumentNode(name, value) {
59136
59060
  }
59137
59061
  function objectNode([type, defaultValue]) {
59138
59062
  const node = {
59139
- kind: graphql12.Kind.OBJECT,
59063
+ kind: graphql13.Kind.OBJECT,
59140
59064
  fields: [
59141
59065
  {
59142
- kind: graphql12.Kind.OBJECT_FIELD,
59066
+ kind: graphql13.Kind.OBJECT_FIELD,
59143
59067
  name: {
59144
- kind: graphql12.Kind.NAME,
59068
+ kind: graphql13.Kind.NAME,
59145
59069
  value: "type"
59146
59070
  },
59147
59071
  value: {
59148
- kind: graphql12.Kind.STRING,
59072
+ kind: graphql13.Kind.STRING,
59149
59073
  value: type
59150
59074
  }
59151
59075
  }
@@ -59153,8 +59077,8 @@ function objectNode([type, defaultValue]) {
59153
59077
  };
59154
59078
  if (defaultValue) {
59155
59079
  node.fields.push({
59156
- kind: graphql12.Kind.OBJECT_FIELD,
59157
- name: { kind: graphql12.Kind.NAME, value: "default" },
59080
+ kind: graphql13.Kind.OBJECT_FIELD,
59081
+ name: { kind: graphql13.Kind.NAME, value: "default" },
59158
59082
  value: {
59159
59083
  kind: typeof defaultValue === "number" ? "IntValue" : "StringValue",
59160
59084
  value: defaultValue.toString()
@@ -59165,34 +59089,34 @@ function objectNode([type, defaultValue]) {
59165
59089
  }
59166
59090
  var pageInfoSelection = [
59167
59091
  {
59168
- kind: graphql12.Kind.FIELD,
59092
+ kind: graphql13.Kind.FIELD,
59169
59093
  name: {
59170
- kind: graphql12.Kind.NAME,
59094
+ kind: graphql13.Kind.NAME,
59171
59095
  value: "edges"
59172
59096
  },
59173
59097
  selectionSet: {
59174
- kind: graphql12.Kind.SELECTION_SET,
59098
+ kind: graphql13.Kind.SELECTION_SET,
59175
59099
  selections: [
59176
59100
  {
59177
- kind: graphql12.Kind.FIELD,
59101
+ kind: graphql13.Kind.FIELD,
59178
59102
  name: {
59179
- kind: graphql12.Kind.NAME,
59103
+ kind: graphql13.Kind.NAME,
59180
59104
  value: "cursor"
59181
59105
  }
59182
59106
  },
59183
59107
  {
59184
- kind: graphql12.Kind.FIELD,
59108
+ kind: graphql13.Kind.FIELD,
59185
59109
  name: {
59186
- kind: graphql12.Kind.NAME,
59110
+ kind: graphql13.Kind.NAME,
59187
59111
  value: "node"
59188
59112
  },
59189
59113
  selectionSet: {
59190
- kind: graphql12.Kind.SELECTION_SET,
59114
+ kind: graphql13.Kind.SELECTION_SET,
59191
59115
  selections: [
59192
59116
  {
59193
- kind: graphql12.Kind.FIELD,
59117
+ kind: graphql13.Kind.FIELD,
59194
59118
  name: {
59195
- kind: graphql12.Kind.NAME,
59119
+ kind: graphql13.Kind.NAME,
59196
59120
  value: "__typename"
59197
59121
  }
59198
59122
  }
@@ -59203,39 +59127,39 @@ var pageInfoSelection = [
59203
59127
  }
59204
59128
  },
59205
59129
  {
59206
- kind: graphql12.Kind.FIELD,
59130
+ kind: graphql13.Kind.FIELD,
59207
59131
  name: {
59208
- kind: graphql12.Kind.NAME,
59132
+ kind: graphql13.Kind.NAME,
59209
59133
  value: "pageInfo"
59210
59134
  },
59211
59135
  selectionSet: {
59212
- kind: graphql12.Kind.SELECTION_SET,
59136
+ kind: graphql13.Kind.SELECTION_SET,
59213
59137
  selections: [
59214
59138
  {
59215
- kind: graphql12.Kind.FIELD,
59139
+ kind: graphql13.Kind.FIELD,
59216
59140
  name: {
59217
- kind: graphql12.Kind.NAME,
59141
+ kind: graphql13.Kind.NAME,
59218
59142
  value: "hasPreviousPage"
59219
59143
  }
59220
59144
  },
59221
59145
  {
59222
- kind: graphql12.Kind.FIELD,
59146
+ kind: graphql13.Kind.FIELD,
59223
59147
  name: {
59224
- kind: graphql12.Kind.NAME,
59148
+ kind: graphql13.Kind.NAME,
59225
59149
  value: "hasNextPage"
59226
59150
  }
59227
59151
  },
59228
59152
  {
59229
- kind: graphql12.Kind.FIELD,
59153
+ kind: graphql13.Kind.FIELD,
59230
59154
  name: {
59231
- kind: graphql12.Kind.NAME,
59155
+ kind: graphql13.Kind.NAME,
59232
59156
  value: "startCursor"
59233
59157
  }
59234
59158
  },
59235
59159
  {
59236
- kind: graphql12.Kind.FIELD,
59160
+ kind: graphql13.Kind.FIELD,
59237
59161
  name: {
59238
- kind: graphql12.Kind.NAME,
59162
+ kind: graphql13.Kind.NAME,
59239
59163
  value: "endCursor"
59240
59164
  }
59241
59165
  }
@@ -59249,17 +59173,17 @@ async function addListFragments(config, documents) {
59249
59173
  const lists = {};
59250
59174
  const errors = [];
59251
59175
  for (const doc of documents) {
59252
- doc.document = graphql13.visit(doc.document, {
59176
+ doc.document = graphql14.visit(doc.document, {
59253
59177
  Directive(node, key, parent2, path2, ancestors) {
59254
59178
  if ([config.listDirective, config.paginateDirective].includes(node.name.value)) {
59255
59179
  const nameArg = node.arguments?.find(
59256
59180
  (arg) => arg.name.value === config.listOrPaginateNameArg
59257
59181
  );
59258
59182
  let error = {
59259
- ...new graphql13.GraphQLError(
59183
+ ...new graphql14.GraphQLError(
59260
59184
  "",
59261
59185
  node,
59262
- new graphql13.Source(""),
59186
+ new graphql14.Source(""),
59263
59187
  node.loc ? [node.loc.start, node.loc.end] : null,
59264
59188
  path2
59265
59189
  ),
@@ -59311,7 +59235,7 @@ async function addListFragments(config, documents) {
59311
59235
  {
59312
59236
  kind: "Argument",
59313
59237
  name: {
59314
- kind: graphql13.Kind.NAME,
59238
+ kind: graphql14.Kind.NAME,
59315
59239
  value: "connection"
59316
59240
  },
59317
59241
  value: {
@@ -59361,7 +59285,7 @@ async function addListFragments(config, documents) {
59361
59285
  const validDeletes = [
59362
59286
  ...new Set(
59363
59287
  Object.values(lists).map(({ type }) => {
59364
- if (!(type instanceof graphql13.GraphQLObjectType)) {
59288
+ if (!(type instanceof graphql14.GraphQLObjectType)) {
59365
59289
  return "";
59366
59290
  }
59367
59291
  if (config.keyFieldsForType(type.name).length !== 1) {
@@ -59375,7 +59299,7 @@ async function addListFragments(config, documents) {
59375
59299
  return;
59376
59300
  }
59377
59301
  const generatedDoc = {
59378
- kind: graphql13.Kind.DOCUMENT,
59302
+ kind: graphql14.Kind.DOCUMENT,
59379
59303
  definitions: Object.entries(lists).flatMap(
59380
59304
  ([name, { selection, type }]) => {
59381
59305
  const schemaType = config.schema.getType(type.name);
@@ -59383,7 +59307,7 @@ async function addListFragments(config, documents) {
59383
59307
  throw new HoudiniError({ message: "Lists must have a selection" });
59384
59308
  }
59385
59309
  const fragmentSelection = {
59386
- kind: graphql13.Kind.SELECTION_SET,
59310
+ kind: graphql14.Kind.SELECTION_SET,
59387
59311
  selections: [...selection.selections]
59388
59312
  };
59389
59313
  if (schemaType && fragmentSelection && !fragmentSelection?.selections.find(
@@ -59398,14 +59322,14 @@ async function addListFragments(config, documents) {
59398
59322
  {
59399
59323
  name: {
59400
59324
  value: config.listInsertFragment(name),
59401
- kind: graphql13.Kind.NAME
59325
+ kind: graphql14.Kind.NAME
59402
59326
  },
59403
- kind: graphql13.Kind.FRAGMENT_DEFINITION,
59327
+ kind: graphql14.Kind.FRAGMENT_DEFINITION,
59404
59328
  selectionSet: fragmentSelection,
59405
59329
  typeCondition: {
59406
- kind: graphql13.Kind.NAMED_TYPE,
59330
+ kind: graphql14.Kind.NAMED_TYPE,
59407
59331
  name: {
59408
- kind: graphql13.Kind.NAME,
59332
+ kind: graphql14.Kind.NAME,
59409
59333
  value: type.name
59410
59334
  }
59411
59335
  }
@@ -59413,32 +59337,32 @@ async function addListFragments(config, documents) {
59413
59337
  {
59414
59338
  name: {
59415
59339
  value: config.listToggleFragment(name),
59416
- kind: graphql13.Kind.NAME
59340
+ kind: graphql14.Kind.NAME
59417
59341
  },
59418
- kind: graphql13.Kind.FRAGMENT_DEFINITION,
59342
+ kind: graphql14.Kind.FRAGMENT_DEFINITION,
59419
59343
  selectionSet: fragmentSelection,
59420
59344
  typeCondition: {
59421
- kind: graphql13.Kind.NAMED_TYPE,
59345
+ kind: graphql14.Kind.NAMED_TYPE,
59422
59346
  name: {
59423
- kind: graphql13.Kind.NAME,
59347
+ kind: graphql14.Kind.NAME,
59424
59348
  value: type.name
59425
59349
  }
59426
59350
  }
59427
59351
  },
59428
59352
  {
59429
- kind: graphql13.Kind.FRAGMENT_DEFINITION,
59353
+ kind: graphql14.Kind.FRAGMENT_DEFINITION,
59430
59354
  name: {
59431
59355
  value: config.listRemoveFragment(name),
59432
- kind: graphql13.Kind.NAME
59356
+ kind: graphql14.Kind.NAME
59433
59357
  },
59434
59358
  selectionSet: {
59435
- kind: graphql13.Kind.SELECTION_SET,
59359
+ kind: graphql14.Kind.SELECTION_SET,
59436
59360
  selections: [...objectIdentificationSelection(config, type)]
59437
59361
  },
59438
59362
  typeCondition: {
59439
- kind: graphql13.Kind.NAMED_TYPE,
59363
+ kind: graphql14.Kind.NAMED_TYPE,
59440
59364
  name: {
59441
- kind: graphql13.Kind.NAME,
59365
+ kind: graphql14.Kind.NAME,
59442
59366
  value: type.name
59443
59367
  }
59444
59368
  }
@@ -59447,14 +59371,14 @@ async function addListFragments(config, documents) {
59447
59371
  }
59448
59372
  ).concat(
59449
59373
  ...validDeletes.map((typeName) => ({
59450
- kind: graphql13.Kind.DIRECTIVE_DEFINITION,
59374
+ kind: graphql14.Kind.DIRECTIVE_DEFINITION,
59451
59375
  name: {
59452
- kind: graphql13.Kind.NAME,
59376
+ kind: graphql14.Kind.NAME,
59453
59377
  value: config.listDeleteDirective(typeName)
59454
59378
  },
59455
59379
  locations: [
59456
59380
  {
59457
- kind: graphql13.Kind.NAME,
59381
+ kind: graphql14.Kind.NAME,
59458
59382
  value: "FIELD"
59459
59383
  }
59460
59384
  ],
@@ -59462,8 +59386,8 @@ async function addListFragments(config, documents) {
59462
59386
  }))
59463
59387
  )
59464
59388
  };
59465
- config.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(graphql13.print).join("\n\n");
59466
- config.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(graphql13.print).join("\n\n");
59389
+ config.newSchema += "\n" + generatedDoc.definitions.filter((c) => c.kind !== "FragmentDefinition").map(graphql14.print).join("\n\n");
59390
+ config.newDocuments += "\n" + generatedDoc.definitions.filter((c) => c.kind === "FragmentDefinition").map(graphql14.print).join("\n\n");
59467
59391
  documents.push({
59468
59392
  name: "generated::lists",
59469
59393
  kind: ArtifactKind.Fragment,
@@ -59549,11 +59473,11 @@ var nodeNotDefinedMessage = (config) => `Looks like you are trying to use the ${
59549
59473
  For more information, visit this link: ${siteURL}/guides/pagination`;
59550
59474
 
59551
59475
  // src/codegen/generators/artifacts/fieldKey.ts
59552
- import * as graphql14 from "graphql";
59476
+ import * as graphql15 from "graphql";
59553
59477
  function fieldKey(config, field) {
59554
59478
  const attributeName = field.alias?.value || field.name.value;
59555
- const printed = graphql14.print(field);
59556
- const secondParse = graphql14.parse(`{${printed}}`).definitions[0].selectionSet.selections[0];
59479
+ const printed = graphql15.print(field);
59480
+ const secondParse = graphql15.parse(`{${printed}}`).definitions[0].selectionSet.selections[0];
59557
59481
  let paginateMode = config.defaultPaginateMode;
59558
59482
  const paginatedDirective = field.directives?.find(
59559
59483
  (directive) => directive.name.value === config.paginateDirective
@@ -59676,13 +59600,13 @@ function prepareSelection({
59676
59600
  } else if ("getFields" in type) {
59677
59601
  let typeRef = type.getFields()[field.name.value].type;
59678
59602
  fieldType = getRootType(typeRef);
59679
- nullable = !graphql15.isNonNullType(typeRef);
59680
- } else if (graphql15.isAbstractType(type)) {
59603
+ nullable = !graphql16.isNonNullType(typeRef);
59604
+ } else if (graphql16.isAbstractType(type)) {
59681
59605
  for (const possible of config.schema.getPossibleTypes(type)) {
59682
- if (graphql15.isObjectType(possible)) {
59606
+ if (graphql16.isObjectType(possible)) {
59683
59607
  if (possible.getFields()[field.name.value]) {
59684
59608
  fieldType = possible.getFields()[field.name.value].type;
59685
- nullable = !graphql15.isNonNullType(fieldType);
59609
+ nullable = !graphql16.isNonNullType(fieldType);
59686
59610
  break;
59687
59611
  }
59688
59612
  }
@@ -59819,7 +59743,7 @@ function prepareSelection({
59819
59743
  kind: "value"
59820
59744
  } : { kind: "continue" };
59821
59745
  const parentType = config.schema.getType(rootType);
59822
- if (graphql15.isObjectType(parentType) || graphql15.isInterfaceType(parentType)) {
59746
+ if (graphql16.isObjectType(parentType) || graphql16.isInterfaceType(parentType)) {
59823
59747
  const fieldType2 = parentType.getFields()[field.name.value]?.type;
59824
59748
  if (fieldType2) {
59825
59749
  const listCount = unwrapType(config, fieldType2).wrappers.filter(
@@ -59842,7 +59766,7 @@ function prepareSelection({
59842
59766
  }
59843
59767
  fieldObj.loading = loadingValue;
59844
59768
  }
59845
- if (graphql15.isInterfaceType(fieldType) || graphql15.isUnionType(fieldType)) {
59769
+ if (graphql16.isInterfaceType(fieldType) || graphql16.isUnionType(fieldType)) {
59846
59770
  fieldObj.abstract = true;
59847
59771
  if (Object.values(fieldObj.selection?.abstractFields?.fields ?? {}).some(
59848
59772
  (fields) => Object.values(fields ?? {}).some((field2) => field2.required)
@@ -59924,7 +59848,7 @@ function mergeSelection({
59924
59848
  typeSelection,
59925
59849
  abstractSelection.fields[typeName] ?? {}
59926
59850
  );
59927
- if (graphql15.isAbstractType(gqlType)) {
59851
+ if (graphql16.isAbstractType(gqlType)) {
59928
59852
  for (const possible of config.schema.getPossibleTypes(gqlType)) {
59929
59853
  if (!possibleSelectionTypes[typeName]) {
59930
59854
  possibleSelectionTypes[typeName] = [];
@@ -59959,7 +59883,7 @@ function mergeSelection({
59959
59883
  }
59960
59884
  }
59961
59885
  const parentType = config.schema.getType(rootType);
59962
- const possibleParents = graphql15.isAbstractType(parentType) ? config.schema.getPossibleTypes(parentType)?.map((t2) => t2.name) : [parentType.name];
59886
+ const possibleParents = graphql16.isAbstractType(parentType) ? config.schema.getPossibleTypes(parentType)?.map((t2) => t2.name) : [parentType.name];
59963
59887
  for (const key of Object.keys(abstractSelection.typeMap)) {
59964
59888
  if (!possibleParents.includes(key) && rootType !== key || abstractSelection.fields[key]) {
59965
59889
  delete abstractSelection.typeMap[key];
@@ -60016,12 +59940,12 @@ function mergeSelection({
60016
59940
  }
60017
59941
 
60018
59942
  // src/codegen/generators/artifacts/index.ts
60019
- var AST4 = recast4.types.builders;
59943
+ var AST5 = recast5.types.builders;
60020
59944
  function artifactGenerator(stats) {
60021
59945
  return async function(config, docs) {
60022
59946
  const filterTypes = {};
60023
59947
  for (const doc of docs) {
60024
- graphql16.visit(doc.document, {
59948
+ graphql17.visit(doc.document, {
60025
59949
  Directive(node, _, __, ___, ancestors) {
60026
59950
  if (node.name.value !== config.listDirective) {
60027
59951
  return;
@@ -60081,7 +60005,7 @@ function artifactGenerator(stats) {
60081
60005
  return;
60082
60006
  }
60083
60007
  const usedVariableNames = /* @__PURE__ */ new Set();
60084
- let documentWithoutInternalDirectives = graphql16.visit(document, {
60008
+ let documentWithoutInternalDirectives = graphql17.visit(document, {
60085
60009
  Directive(node) {
60086
60010
  if (config.isInternalDirective(node.name.value)) {
60087
60011
  return null;
@@ -60094,7 +60018,7 @@ function artifactGenerator(stats) {
60094
60018
  }
60095
60019
  }
60096
60020
  });
60097
- let documentWithoutExtraVariables = graphql16.visit(
60021
+ let documentWithoutExtraVariables = graphql17.visit(
60098
60022
  documentWithoutInternalDirectives,
60099
60023
  {
60100
60024
  VariableDefinition(variableDefinitionNode) {
@@ -60105,13 +60029,13 @@ function artifactGenerator(stats) {
60105
60029
  }
60106
60030
  }
60107
60031
  );
60108
- let rawString = graphql16.print(documentWithoutExtraVariables);
60032
+ let rawString = graphql17.print(documentWithoutExtraVariables);
60109
60033
  let docKind = doc.kind;
60110
60034
  const operations = document.definitions.filter(
60111
- ({ kind }) => kind === graphql16.Kind.OPERATION_DEFINITION
60035
+ ({ kind }) => kind === graphql17.Kind.OPERATION_DEFINITION
60112
60036
  );
60113
60037
  const fragments = document.definitions.filter(
60114
- ({ kind }) => kind === graphql16.Kind.FRAGMENT_DEFINITION
60038
+ ({ kind }) => kind === graphql17.Kind.FRAGMENT_DEFINITION
60115
60039
  );
60116
60040
  let rootType = "";
60117
60041
  let selectionSet;
@@ -60258,7 +60182,21 @@ function artifactGenerator(stats) {
60258
60182
  artifact.pluginData[plugin2.name] = plugin2.artifactData({ config, document: doc }) ?? {};
60259
60183
  }
60260
60184
  if (inputs && inputs.length > 0) {
60261
- artifact.input = inputObject(config, inputs);
60185
+ const runtimeScalars = inputs.reduce((prev, input) => {
60186
+ const runtimeScalarDirective = input.directives?.find(
60187
+ (directive2) => directive2.name.value === config.runtimeScalarDirective
60188
+ );
60189
+ if (!runtimeScalarDirective) {
60190
+ return prev;
60191
+ }
60192
+ return {
60193
+ ...prev,
60194
+ [input.variable.name.value]: runtimeScalarDirective.arguments?.find(
60195
+ (arg) => arg.name.value === "type"
60196
+ )?.value?.value
60197
+ };
60198
+ }, {});
60199
+ artifact.input = inputObject(config, inputs, runtimeScalars);
60262
60200
  }
60263
60201
  if (artifact.kind === "HoudiniQuery") {
60264
60202
  const cacheDirective = operations[0].directives?.find(
@@ -60297,9 +60235,9 @@ function artifactGenerator(stats) {
60297
60235
  plugin2.artifactEnd({ config, document: doc });
60298
60236
  }
60299
60237
  const _houdiniHash = hashOriginal({ document: doc });
60300
- const file = AST4.program([
60238
+ const file = AST5.program([
60301
60239
  moduleExport(config, "default", serializeValue(artifact)),
60302
- AST4.expressionStatement(AST4.stringLiteral(`HoudiniHash=${_houdiniHash}`))
60240
+ AST5.expressionStatement(AST5.stringLiteral(`HoudiniHash=${_houdiniHash}`))
60303
60241
  ]);
60304
60242
  const artifactPath = config.artifactPath(document);
60305
60243
  const countDocument = doc.generateStore;
@@ -60357,7 +60295,7 @@ function applyMask(config, target, mask) {
60357
60295
  if (!targetType) {
60358
60296
  continue;
60359
60297
  }
60360
- if (graphql16.isAbstractType(targetType)) {
60298
+ if (graphql17.isAbstractType(targetType)) {
60361
60299
  for (const possible of config.schema.getPossibleTypes(targetType)) {
60362
60300
  if (target.abstractFields?.fields[possible.name]) {
60363
60301
  applyMask(
@@ -60380,8 +60318,8 @@ function applyMask(config, target, mask) {
60380
60318
  }
60381
60319
 
60382
60320
  // src/codegen/generators/runtime/graphqlFunction.ts
60383
- var recast5 = __toESM(require_main2(), 1);
60384
- var AST5 = recast5.types.builders;
60321
+ var recast6 = __toESM(require_main2(), 1);
60322
+ var AST6 = recast6.types.builders;
60385
60323
  async function generateGraphqlReturnTypes(config, docs) {
60386
60324
  const indexPath = path_exports.join(config.runtimeDirectory, "index.d.ts");
60387
60325
  const fileContent = await fs_exports.readFile(indexPath) || "";
@@ -60416,18 +60354,18 @@ async function generateGraphqlReturnTypes(config, docs) {
60416
60354
  continue;
60417
60355
  }
60418
60356
  for (const [queryString, returnValue] of Object.entries(overloaded_returns)) {
60419
- const input = AST5.identifier("str");
60420
- input.typeAnnotation = AST5.tsTypeAnnotation(
60421
- AST5.tsLiteralType(AST5.stringLiteral(queryString))
60357
+ const input = AST6.identifier("str");
60358
+ input.typeAnnotation = AST6.tsTypeAnnotation(
60359
+ AST6.tsLiteralType(AST6.stringLiteral(queryString))
60422
60360
  );
60423
60361
  script.body.splice(
60424
60362
  i,
60425
60363
  0,
60426
- AST5.exportNamedDeclaration(
60427
- AST5.tsDeclareFunction(
60428
- AST5.identifier("graphql"),
60364
+ AST6.exportNamedDeclaration(
60365
+ AST6.tsDeclareFunction(
60366
+ AST6.identifier("graphql"),
60429
60367
  [input],
60430
- AST5.tsTypeAnnotation(AST5.tsTypeReference(AST5.identifier(returnValue)))
60368
+ AST6.tsTypeAnnotation(AST6.tsTypeReference(AST6.identifier(returnValue)))
60431
60369
  )
60432
60370
  )
60433
60371
  );
@@ -60602,165 +60540,22 @@ function moduleStatments(config) {
60602
60540
  var recast11 = __toESM(require_main2(), 1);
60603
60541
 
60604
60542
  // src/codegen/generators/typescript/addReferencedInputTypes.ts
60605
- var recast8 = __toESM(require_main2(), 1);
60606
- import * as graphql19 from "graphql";
60607
-
60608
- // src/codegen/generators/typescript/typeReference.ts
60609
60543
  var recast7 = __toESM(require_main2(), 1);
60610
60544
  import * as graphql18 from "graphql";
60611
-
60612
- // src/codegen/generators/typescript/types.ts
60613
- var recast6 = __toESM(require_main2(), 1);
60614
- import * as graphql17 from "graphql";
60615
- var AST6 = recast6.types.builders;
60616
- function readonlyProperty(prop, enable = true) {
60617
- if (enable) {
60618
- prop.readonly = true;
60619
- }
60620
- return prop;
60621
- }
60622
- function nullableField(inner, input = false) {
60623
- const members = [inner, AST6.tsNullKeyword()];
60624
- if (input) {
60625
- members.push(AST6.tsUndefinedKeyword());
60626
- }
60627
- return AST6.tsUnionType(members);
60628
- }
60629
- function scalarPropertyValue(config, filepath, missingScalars, target, body, field) {
60630
- if (config.configFile.features?.componentFields && target.name === config.componentScalar) {
60631
- if (!field) {
60632
- return AST6.tsNeverKeyword();
60633
- }
60634
- const component = config.componentFields[field.parent][field.field];
60635
- const sourcePathRelative = path_exports.relative(
60636
- path_exports.join(config.projectRoot, "src"),
60637
- component.filepath
60638
- );
60639
- let sourcePathParsed = path_exports.parse(sourcePathRelative);
60640
- let sourcePath = path_exports.join(sourcePathParsed.dir, sourcePathParsed.name);
60641
- const localImport = ensureImports({
60642
- config,
60643
- body,
60644
- import: "__component__" + component.fragment,
60645
- sourceModule: path_exports.join(
60646
- path_exports.relative(path_exports.dirname(filepath), config.projectRoot),
60647
- "src",
60648
- sourcePath
60649
- )
60650
- });
60651
- const parameters = AST6.tsTypeReference(AST6.identifier("Parameters"));
60652
- parameters.typeParameters = AST6.tsTypeParameterInstantiation([
60653
- AST6.tsTypeQuery(AST6.identifier(localImport))
60654
- ]);
60655
- const indexed = AST6.tsIndexedAccessType(
60656
- parameters,
60657
- AST6.tsLiteralType(AST6.numericLiteral(0))
60658
- );
60659
- const omit = AST6.tsTypeReference(AST6.identifier("Omit"));
60660
- omit.typeParameters = AST6.tsTypeParameterInstantiation([
60661
- indexed,
60662
- AST6.tsLiteralType(AST6.stringLiteral(component.prop))
60663
- ]);
60664
- const arg = AST6.identifier("props");
60665
- arg.typeAnnotation = AST6.tsTypeAnnotation(omit);
60666
- const returnType = AST6.tsTypeReference(AST6.identifier("ReturnType"));
60667
- returnType.typeParameters = AST6.tsTypeParameterInstantiation([
60668
- AST6.tsTypeQuery(AST6.identifier(localImport))
60669
- ]);
60670
- const fnType = AST6.tsFunctionType([arg]);
60671
- fnType.typeAnnotation = AST6.tsTypeAnnotation(returnType);
60672
- return fnType;
60673
- }
60674
- switch (target.name) {
60675
- case "String": {
60676
- return AST6.tsStringKeyword();
60677
- }
60678
- case "Int": {
60679
- return AST6.tsNumberKeyword();
60680
- }
60681
- case "Float": {
60682
- return AST6.tsNumberKeyword();
60683
- }
60684
- case "Boolean": {
60685
- return AST6.tsBooleanKeyword();
60686
- }
60687
- case "ID": {
60688
- return AST6.tsStringKeyword();
60689
- }
60690
- default: {
60691
- if (graphql17.isNonNullType(target) && "ofType" in target) {
60692
- return scalarPropertyValue(
60693
- config,
60694
- filepath,
60695
- missingScalars,
60696
- target.ofType,
60697
- body,
60698
- field
60699
- );
60700
- }
60701
- if (config.scalars?.[target.name]) {
60702
- return AST6.tsTypeReference(AST6.identifier(config.scalars?.[target.name].type));
60703
- }
60704
- if (target.name !== config.componentScalar) {
60705
- missingScalars.add(target.name);
60706
- }
60707
- return AST6.tsAnyKeyword();
60708
- }
60709
- }
60710
- }
60711
-
60712
- // src/codegen/generators/typescript/typeReference.ts
60713
60545
  var AST7 = recast7.types.builders;
60714
- function tsTypeReference(config, filepath, missingScalars, definition, body) {
60715
- const { type, wrappers } = unwrapType(config, definition.type);
60716
- let result;
60717
- if (graphql18.isScalarType(type)) {
60718
- result = scalarPropertyValue(config, filepath, missingScalars, type, body, null);
60719
- } else if (graphql18.isEnumType(type)) {
60720
- result = enumReference(config, body, type.name);
60721
- } else {
60722
- result = AST7.tsTypeReference(AST7.identifier(type.name));
60723
- }
60724
- for (const toWrap of wrappers) {
60725
- if (toWrap === "NonNull" /* NonNull */) {
60726
- continue;
60727
- } else if (toWrap === "Nullable" /* Nullable */) {
60728
- result = nullableField(result, true);
60729
- } else if (toWrap === "List" /* List */) {
60730
- result = AST7.tsArrayType(AST7.tsParenthesizedType(result));
60731
- }
60732
- }
60733
- return result;
60734
- }
60735
- function enumReference(config, body, name) {
60736
- ensureImports({
60737
- config,
60738
- body,
60739
- import: ["ValueOf"],
60740
- importKind: "type",
60741
- sourceModule: "$houdini/runtime/lib/types"
60742
- });
60743
- return AST7.tsTypeReference(
60744
- AST7.identifier("ValueOf"),
60745
- AST7.tsTypeParameterInstantiation([AST7.tsTypeQuery(AST7.identifier(name))])
60746
- );
60747
- }
60748
-
60749
- // src/codegen/generators/typescript/addReferencedInputTypes.ts
60750
- var AST8 = recast8.types.builders;
60751
60546
  function addReferencedInputTypes(config, filepath, body, visitedTypes, missingScalars, rootType) {
60752
60547
  const { type } = unwrapType(config, rootType);
60753
- if (graphql19.isScalarType(type)) {
60548
+ if (graphql18.isScalarType(type)) {
60754
60549
  return;
60755
60550
  }
60756
60551
  if (visitedTypes.has(type.name)) {
60757
60552
  return;
60758
60553
  }
60759
- if (graphql19.isUnionType(type)) {
60554
+ if (graphql18.isUnionType(type)) {
60760
60555
  throw new HoudiniError({ filepath, message: "Input Unions are not supported yet. Sorry!" });
60761
60556
  }
60762
60557
  visitedTypes.add(type.name);
60763
- if (graphql19.isEnumType(type)) {
60558
+ if (graphql18.isEnumType(type)) {
60764
60559
  ensureImports({
60765
60560
  config,
60766
60561
  body,
@@ -60774,21 +60569,37 @@ function addReferencedInputTypes(config, filepath, body, visitedTypes, missingSc
60774
60569
  for (const field of Object.values(type.getFields())) {
60775
60570
  addReferencedInputTypes(config, filepath, body, visitedTypes, missingScalars, field.type);
60776
60571
  members.push(
60777
- AST8.tsPropertySignature(
60778
- AST8.identifier(field.name),
60779
- AST8.tsTypeAnnotation(
60572
+ AST7.tsPropertySignature(
60573
+ AST7.identifier(field.name),
60574
+ AST7.tsTypeAnnotation(
60780
60575
  tsTypeReference(config, filepath, missingScalars, field, body)
60781
60576
  ),
60782
- graphql19.isNullableType(field.type)
60577
+ graphql18.isNullableType(field.type)
60783
60578
  )
60784
60579
  );
60785
60580
  }
60786
- body.push(AST8.tsTypeAliasDeclaration(AST8.identifier(type.name), AST8.tsTypeLiteral(members)));
60581
+ body.push(AST7.tsTypeAliasDeclaration(AST7.identifier(type.name), AST7.tsTypeLiteral(members)));
60787
60582
  }
60788
60583
 
60789
60584
  // src/codegen/generators/typescript/inlineType.ts
60790
60585
  var recast9 = __toESM(require_main2(), 1);
60791
- import * as graphql20 from "graphql";
60586
+ import * as graphql19 from "graphql";
60587
+
60588
+ // src/codegen/generators/comments/jsdoc.ts
60589
+ var recast8 = __toESM(require_main2(), 1);
60590
+ var AST8 = recast8.types.builders;
60591
+ function jsdocComment(text, deprecated) {
60592
+ let commentContent = `*
60593
+ * ${text}
60594
+ `;
60595
+ if (deprecated) {
60596
+ commentContent = `${commentContent} * @deprecated ${deprecated}
60597
+ `;
60598
+ }
60599
+ return AST8.commentBlock(commentContent, true);
60600
+ }
60601
+
60602
+ // src/codegen/generators/typescript/inlineType.ts
60792
60603
  var AST9 = recast9.types.builders;
60793
60604
  var fragmentKey2 = " $fragments";
60794
60605
  function inlineType({
@@ -60809,7 +60620,7 @@ function inlineType({
60809
60620
  const { type, wrappers } = unwrapType(config, rootType);
60810
60621
  let result;
60811
60622
  let forceNullable = false;
60812
- if (graphql20.isScalarType(type)) {
60623
+ if (graphql19.isScalarType(type)) {
60813
60624
  result = scalarPropertyValue(
60814
60625
  config,
60815
60626
  filepath,
@@ -60818,7 +60629,7 @@ function inlineType({
60818
60629
  body,
60819
60630
  field
60820
60631
  );
60821
- } else if (graphql20.isEnumType(type)) {
60632
+ } else if (graphql19.isEnumType(type)) {
60822
60633
  ensureImports({
60823
60634
  config,
60824
60635
  body,
@@ -60843,11 +60654,11 @@ function inlineType({
60843
60654
  for (const selection of selections) {
60844
60655
  if (selection.kind === "InlineFragment" && selection.typeCondition) {
60845
60656
  const fragmentType = config.schema.getType(selection.typeCondition.name.value);
60846
- if (!graphql20.isInterfaceType(type) && !graphql20.isUnionType(type)) {
60657
+ if (!graphql19.isInterfaceType(type) && !graphql19.isUnionType(type)) {
60847
60658
  selectedFields.push(...selection.selectionSet.selections);
60848
60659
  continue;
60849
60660
  }
60850
- if (!graphql20.isInterfaceType(fragmentType) && !graphql20.isUnionType(fragmentType)) {
60661
+ if (!graphql19.isInterfaceType(fragmentType) && !graphql19.isUnionType(fragmentType)) {
60851
60662
  if (!inlineFragments[fragmentType.name]) {
60852
60663
  inlineFragments[fragmentType.name] = [];
60853
60664
  }
@@ -60939,6 +60750,11 @@ function inlineType({
60939
60750
  if (allOptional) {
60940
60751
  prop.optional = true;
60941
60752
  }
60753
+ if (field2.description || field2.deprecationReason) {
60754
+ prop.comments = [
60755
+ jsdocComment(field2.description ?? "", field2.deprecationReason ?? void 0)
60756
+ ];
60757
+ }
60942
60758
  return prop;
60943
60759
  })
60944
60760
  ]);
@@ -60990,7 +60806,7 @@ function inlineType({
60990
60806
  }
60991
60807
  }
60992
60808
  }
60993
- if (objectType.type === "TSTypeLiteral" && !graphql20.isInterfaceType(fragmentRootType) && !graphql20.isUnionType(fragmentRootType)) {
60809
+ if (objectType.type === "TSTypeLiteral" && !graphql19.isInterfaceType(fragmentRootType) && !graphql19.isUnionType(fragmentRootType)) {
60994
60810
  const existingTypenameIndex = objectType.members.findIndex(
60995
60811
  (member) => member.type === "TSPropertySignature" && member.key.type === "Identifier" && member.key.name === "__typename"
60996
60812
  );
@@ -61015,11 +60831,11 @@ function inlineType({
61015
60831
  ];
61016
60832
  }
61017
60833
  let coveredTypenames;
61018
- if (graphql20.isInterfaceType(fragmentRootType)) {
60834
+ if (graphql19.isInterfaceType(fragmentRootType)) {
61019
60835
  coveredTypenames = interfaceCoveredTypenames(fragmentRootType);
61020
- } else if (graphql20.isUnionType(fragmentRootType)) {
60836
+ } else if (graphql19.isUnionType(fragmentRootType)) {
61021
60837
  coveredTypenames = fragmentRootType.getTypes().map((type2) => type2.name);
61022
- } else if (graphql20.isObjectType(fragmentRootType)) {
60838
+ } else if (graphql19.isObjectType(fragmentRootType)) {
61023
60839
  coveredTypenames = [fragmentRootType.name];
61024
60840
  } else {
61025
60841
  throw Error("unreachable code");
@@ -61055,7 +60871,7 @@ function inlineType({
61055
60871
  );
61056
60872
  }
61057
60873
  );
61058
- const parentIsUnionOrInterface = !graphql20.isInterfaceType(type) && !graphql20.isUnionType(type);
60874
+ const parentIsUnionOrInterface = !graphql19.isInterfaceType(type) && !graphql19.isUnionType(type);
61059
60875
  const possibleTypenames = parentIsUnionOrInterface ? [parent.name] : config.schema.getPossibleTypes(type).map((type2) => type2.name);
61060
60876
  const coveredTypenames = new Set(
61061
60877
  Object.values(inlineFragmentSelections).flatMap((sel) => sel.coveredTypenames)
@@ -61122,7 +60938,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection) {
61122
60938
  },
61123
60939
  type: schema.getType("String")
61124
60940
  };
61125
- } else if (graphql20.isNonNullType(rootType) && "getFields" in rootType.ofType) {
60941
+ } else if (graphql19.isNonNullType(rootType) && "getFields" in rootType.ofType) {
61126
60942
  fields = rootType.ofType.getFields();
61127
60943
  } else {
61128
60944
  fields = rootType.getFields();
@@ -61134,7 +60950,7 @@ function selectionTypeInfo(schema, filepath, rootType, selection) {
61134
60950
  message: `Could not find type information for field ${rootType.toString()}.${selectionName} ${field}`
61135
60951
  });
61136
60952
  }
61137
- const fieldType = graphql20.getNamedType(field.type);
60953
+ const fieldType = graphql19.getNamedType(field.type);
61138
60954
  if (!fieldType) {
61139
60955
  throw new HoudiniError({
61140
60956
  filepath,
@@ -61350,17 +61166,20 @@ export * from "${module}"
61350
61166
  }
61351
61167
  }
61352
61168
  await fs_exports.writeFile(config.typeIndexPath, indexContent);
61353
- if (missingScalars.size > 0) {
61354
- console.warn(`\u26A0\uFE0F Missing definitions for the following scalars: ${[...missingScalars].join(
61355
- ", "
61356
- )}
61169
+ const missingScalarNames = [...missingScalars].filter(
61170
+ (scalar) => !config.configFile.features?.runtimeScalars?.[scalar]
61171
+ );
61172
+ if (missingScalarNames.length > 0) {
61173
+ console.warn(`\u26A0\uFE0F Missing definitions for the following scalars: ${[
61174
+ ...missingScalarNames
61175
+ ].join(", ")}
61357
61176
  Generated types will contain an any type in place of these values. To fix this, provide an equivalent
61358
61177
  type in your config file:
61359
61178
 
61360
61179
  {
61361
61180
  scalars: {
61362
61181
  ${cyan2(`/* in your case, something like */`)}
61363
- ${[...missingScalars].map(
61182
+ ${[...missingScalarNames].map(
61364
61183
  (c) => ` ${c}: { ${green2(`// <- The GraphQL Scalar`)}
61365
61184
  type: "${cyan2(`YourType_${c}`)}" ${green2(`// <- The TypeScript type`)}
61366
61185
  }`
@@ -61640,7 +61459,7 @@ async function generateFragmentTypeDefs(config, filepath, body, selections, defi
61640
61459
 
61641
61460
  // src/codegen/generators/typescript/imperativeTypeDef.ts
61642
61461
  var recast12 = __toESM(require_main2(), 1);
61643
- import * as graphql21 from "graphql";
61462
+ import * as graphql20 from "graphql";
61644
61463
  var AST12 = recast12.types.builders;
61645
61464
  async function imperativeCacheTypef(config, docs) {
61646
61465
  const returnType = (doc) => config.plugins.find((plugin2) => plugin2.graphqlTagReturn)?.graphqlTagReturn?.({
@@ -61691,7 +61510,7 @@ function typeDefinitions(config, filepath, body, docs, returnType) {
61691
61510
  const operationTypes = [config.schema.getMutationType(), config.schema.getSubscriptionType()].filter(Boolean).map((type) => type?.name);
61692
61511
  const visitedTypes = /* @__PURE__ */ new Set();
61693
61512
  const types14 = Object.values(config.schema.getTypeMap()).filter(
61694
- (type) => !graphql21.isAbstractType(type) && !graphql21.isScalarType(type) && !graphql21.isEnumType(type) && !graphql21.isInputObjectType(type) && !type.name.startsWith("__") && !operationTypes.includes(type.name)
61513
+ (type) => !graphql20.isAbstractType(type) && !graphql20.isScalarType(type) && !graphql20.isEnumType(type) && !graphql20.isInputObjectType(type) && !type.name.startsWith("__") && !operationTypes.includes(type.name)
61695
61514
  );
61696
61515
  const fragmentMap = fragmentListMap(
61697
61516
  config,
@@ -61708,7 +61527,7 @@ function typeDefinitions(config, filepath, body, docs, returnType) {
61708
61527
  }
61709
61528
  let idFields = AST12.tsNeverKeyword();
61710
61529
  const keys2 = keyFieldsForType(config.configFile, type.name);
61711
- if (graphql21.isObjectType(type) && keys2.length > 0 && keys2.every((key) => type.getFields()[key])) {
61530
+ if (graphql20.isObjectType(type) && keys2.length > 0 && keys2.every((key) => type.getFields()[key])) {
61712
61531
  idFields = AST12.tsTypeLiteral(
61713
61532
  keys2.map((key) => {
61714
61533
  const fieldType = type.getFields()[key];
@@ -61735,13 +61554,13 @@ function typeDefinitions(config, filepath, body, docs, returnType) {
61735
61554
  idFields = AST12.tsTypeLiteral([]);
61736
61555
  }
61737
61556
  let fields = AST12.tsTypeLiteral([]);
61738
- if (graphql21.isObjectType(type)) {
61557
+ if (graphql20.isObjectType(type)) {
61739
61558
  fields = AST12.tsTypeLiteral(
61740
61559
  Object.entries(type.getFields()).map(
61741
61560
  ([key, fieldType]) => {
61742
61561
  const unwrapped = unwrapType(config, fieldType.type);
61743
61562
  let typeOptions = AST12.tsUnionType([]);
61744
- if (graphql21.isScalarType(unwrapped.type)) {
61563
+ if (graphql20.isScalarType(unwrapped.type)) {
61745
61564
  typeOptions.types.push(
61746
61565
  scalarPropertyValue(
61747
61566
  config,
@@ -61755,11 +61574,11 @@ function typeDefinitions(config, filepath, body, docs, returnType) {
61755
61574
  }
61756
61575
  )
61757
61576
  );
61758
- } else if (graphql21.isEnumType(unwrapped.type)) {
61577
+ } else if (graphql20.isEnumType(unwrapped.type)) {
61759
61578
  typeOptions.types.push(
61760
61579
  AST12.tsTypeReference(AST12.identifier(unwrapped.type.name))
61761
61580
  );
61762
- } else if (!graphql21.isAbstractType(unwrapped.type)) {
61581
+ } else if (!graphql20.isAbstractType(unwrapped.type)) {
61763
61582
  typeOptions.types.push(record(unwrapped.type.name));
61764
61583
  } else {
61765
61584
  typeOptions.types.push(
@@ -61855,7 +61674,7 @@ function listDefinitions(config, filepath, body, docs) {
61855
61674
  const lists = [];
61856
61675
  const visitedLists = /* @__PURE__ */ new Set();
61857
61676
  for (const doc of docs) {
61858
- graphql21.visit(doc.document, {
61677
+ graphql20.visit(doc.document, {
61859
61678
  Directive(node, key, parent2, path2, ancestors) {
61860
61679
  if (![config.listDirective, config.paginateDirective].includes(node.name.value)) {
61861
61680
  return;
@@ -61877,7 +61696,7 @@ function listDefinitions(config, filepath, body, docs) {
61877
61696
  const targetFieldDefinition = parentType.getFields()[targetField.name.value];
61878
61697
  const { type: listType } = unwrapType(config, targetFieldDefinition.type);
61879
61698
  const possibleTypes = [];
61880
- if (graphql21.isAbstractType(listType)) {
61699
+ if (graphql20.isAbstractType(listType)) {
61881
61700
  possibleTypes.push(
61882
61701
  ...config.schema.getPossibleTypes(listType).map((possible) => possible.name)
61883
61702
  );
@@ -62039,7 +61858,7 @@ async function typescriptGenerator(config, docs) {
62039
61858
  }
62040
61859
 
62041
61860
  // src/codegen/generators/persistedQueries/index.ts
62042
- import * as graphql22 from "graphql";
61861
+ import * as graphql21 from "graphql";
62043
61862
  async function persistOutputGenerator(config, docs) {
62044
61863
  if (!config.persistedQueriesPath.endsWith(".json")) {
62045
61864
  throw new Error('Can write Persisted Queries only in a ".json" file.');
@@ -62049,8 +61868,8 @@ async function persistOutputGenerator(config, docs) {
62049
61868
  if (!generateArtifact) {
62050
61869
  return acc;
62051
61870
  }
62052
- let rawString = graphql22.print(
62053
- graphql22.visit(document, {
61871
+ let rawString = graphql21.print(
61872
+ graphql21.visit(document, {
62054
61873
  Directive(node) {
62055
61874
  if (config.isInternalDirective(node.name.value)) {
62056
61875
  return null;
@@ -62059,7 +61878,7 @@ async function persistOutputGenerator(config, docs) {
62059
61878
  })
62060
61879
  );
62061
61880
  const operations = document.definitions.filter(
62062
- ({ kind }) => kind === graphql22.Kind.OPERATION_DEFINITION
61881
+ ({ kind }) => kind === graphql21.Kind.OPERATION_DEFINITION
62063
61882
  );
62064
61883
  if (operations.length > 0 && operations[0].kind === "OperationDefinition") {
62065
61884
  if (artifact) {
@@ -62074,33 +61893,45 @@ async function persistOutputGenerator(config, docs) {
62074
61893
  }
62075
61894
 
62076
61895
  // src/codegen/generators/definitions/index.ts
62077
- import * as graphql24 from "graphql";
61896
+ import * as graphql23 from "graphql";
62078
61897
 
62079
61898
  // src/codegen/generators/definitions/enums.ts
62080
61899
  var recast13 = __toESM(require_main2(), 1);
62081
- import * as graphql23 from "graphql";
61900
+ import * as graphql22 from "graphql";
62082
61901
  var AST13 = recast13.types.builders;
62083
61902
  async function definitionsGenerator(config) {
62084
- const enums = graphql23.parse(graphql23.printSchema(config.schema)).definitions.filter(
61903
+ const enums = graphql22.parse(graphql22.printSchema(config.schema)).definitions.filter(
62085
61904
  (definition) => definition.kind === "EnumTypeDefinition"
62086
61905
  ).filter((def) => !config.isInternalEnum(def));
62087
61906
  const { code: runtimeDefinitions } = await printJS(
62088
61907
  AST13.program(
62089
61908
  enums.map((defn) => {
62090
61909
  const name = defn.name.value;
62091
- return moduleExport(
61910
+ const declaration = moduleExport(
62092
61911
  config,
62093
61912
  name,
62094
61913
  AST13.objectExpression(
62095
61914
  defn.values?.map((value) => {
62096
61915
  const str = value.name.value;
62097
- return AST13.objectProperty(
61916
+ const prop = AST13.objectProperty(
62098
61917
  AST13.stringLiteral(str),
62099
61918
  AST13.stringLiteral(str)
62100
61919
  );
61920
+ const deprecationReason = value.directives?.find((d) => d.name.value === "deprecated")?.arguments?.find((a) => a.name.value === "reason")?.value?.value;
61921
+ if (value.description || deprecationReason)
61922
+ prop.comments = [
61923
+ jsdocComment(value.description?.value ?? "", deprecationReason)
61924
+ ];
61925
+ return prop;
62101
61926
  }) || []
62102
61927
  )
62103
61928
  );
61929
+ if (defn.description) {
61930
+ declaration.comments = [
61931
+ AST13.commentBlock(`* ${defn.description.value} `, true, false)
61932
+ ];
61933
+ }
61934
+ return declaration;
62104
61935
  })
62105
61936
  )
62106
61937
  );
@@ -62109,11 +61940,19 @@ type ValuesOf<T> = T[keyof T]
62109
61940
  ` + enums.sort((a, b) => a.name.value.localeCompare(b.name.value)).map((definition) => {
62110
61941
  const name = definition.name.value;
62111
61942
  const values = definition.values;
62112
- return `
61943
+ let jsdoc = "";
61944
+ if (definition.description) {
61945
+ jsdoc = `
61946
+ /** ${definition.description.value} */`;
61947
+ }
61948
+ return `${jsdoc}
62113
61949
  export declare const ${name}: {
62114
- ${values?.map((value) => ` readonly ${value.name.value}: "${value.name.value}";`).join("\n")}
61950
+ ${values?.map(
61951
+ (value) => (value.description ? ` /** ${value.description.value} */
61952
+ ` : "") + ` readonly ${value.name.value}: "${value.name.value}";`
61953
+ ).join("\n")}
62115
61954
  }
62116
-
61955
+ ${jsdoc}
62117
61956
  export type ${name}$options = ValuesOf<typeof ${name}>
62118
61957
  `;
62119
61958
  }).join("");
@@ -62133,7 +61972,7 @@ async function schemaGenerator(config) {
62133
61972
  await Promise.all([
62134
61973
  fs_exports.writeFile(
62135
61974
  config.definitionsSchemaPath,
62136
- config.localSchema ? graphql24.printSchema(config.schema) : config.newSchema
61975
+ config.localSchema ? graphql23.printSchema(config.schema) : config.newSchema
62137
61976
  ),
62138
61977
  fs_exports.writeFile(config.definitionsDocumentsPath, config.newDocuments),
62139
61978
  definitionsGenerator(config)
@@ -63838,7 +63677,7 @@ function mergeGraphQLTypes(typeSource, config) {
63838
63677
  }
63839
63678
 
63840
63679
  // src/codegen/transforms/schema.ts
63841
- import * as graphql25 from "graphql";
63680
+ import * as graphql24 from "graphql";
63842
63681
  async function graphqlExtensions(config, documents) {
63843
63682
  let internalSchema = `
63844
63683
  enum CachePolicy {
@@ -63942,7 +63781,7 @@ ${config.configFile.features?.componentFields ? `
63942
63781
  """
63943
63782
  @${config.componentFieldDirective} marks an inline fragment as the selection for a component field
63944
63783
  """
63945
- directive @${config.componentFieldDirective}(field: String!, prop: String, export: String, raw: String) on FRAGMENT_DEFINITION | INLINE_FRAGMENT
63784
+ directive @${config.componentFieldDirective}(field: String!, prop: String, export: String, raw: String) on FRAGMENT_DEFINITION | INLINE_FRAGMENT | FIELD_DEFINITION
63946
63785
 
63947
63786
  ` : ""}
63948
63787
 
@@ -63953,7 +63792,7 @@ directive @${config.componentFieldDirective}(field: String!, prop: String, expor
63953
63792
  }
63954
63793
  internalSchema += plugin2.schema({ config });
63955
63794
  }
63956
- const extensions = Object.entries(config.componentFields).map(([parent2, fields]) => {
63795
+ let extensions = Object.entries(config.componentFields).map(([parent2, fields]) => {
63957
63796
  return `
63958
63797
  extend type ${parent2} {
63959
63798
  ${Object.entries(fields).map(([fieldName, field]) => {
@@ -63961,29 +63800,30 @@ directive @${config.componentFieldDirective}(field: String!, prop: String, expor
63961
63800
  const args = fragmentArguments(config, "", field.parent);
63962
63801
  if (args.length > 0) {
63963
63802
  argString = "(" + args.map((arg) => {
63964
- const typeName = graphql25.print(arg.type);
63803
+ const typeName = graphql24.print(arg.type);
63965
63804
  return `${arg.name}:${typeName}${arg.required ? "!" : ""}`;
63966
63805
  }).join("\n") + ")";
63967
63806
  }
63968
- return `${fieldName}${argString}: ${config.componentScalar}!`;
63807
+ return `${fieldName}${argString}: ${config.componentScalar}! @componentField(field: "${fieldName}")`;
63969
63808
  }).join("\n")}
63970
63809
  }
63971
63810
  `;
63972
63811
  }).join("\n");
63973
- config.newSchema = graphql25.print(mergeTypeDefs([internalSchema, config.newSchema]));
63812
+ extensions += `${Object.keys(config.configFile.features?.runtimeScalars ?? {}).map((scalar) => `scalar ${scalar}`).join("\n")}`;
63813
+ config.newSchema = graphql24.print(mergeTypeDefs([internalSchema, config.newSchema]));
63974
63814
  config.schemaString += extensions;
63975
- config.schema = graphql25.buildSchema(
63976
- graphql25.print(
63977
- mergeTypeDefs([graphql25.printSchema(config.schema), internalSchema, extensions])
63815
+ config.schema = graphql24.buildSchema(
63816
+ graphql24.print(
63817
+ mergeTypeDefs([graphql24.printSchema(config.schema), internalSchema, extensions])
63978
63818
  )
63979
63819
  );
63980
63820
  }
63981
63821
 
63982
63822
  // src/codegen/transforms/typename.ts
63983
- import * as graphql26 from "graphql";
63823
+ import * as graphql25 from "graphql";
63984
63824
  async function addTypename(config, documents) {
63985
63825
  for (const doc of documents) {
63986
- doc.document = graphql26.visit(doc.document, {
63826
+ doc.document = graphql25.visit(doc.document, {
63987
63827
  Field(node, key, parent2, path2, ancestors) {
63988
63828
  if (!node.selectionSet) {
63989
63829
  return;
@@ -63995,7 +63835,7 @@ async function addTypename(config, documents) {
63995
63835
  );
63996
63836
  const field = type.getFields()[node.name.value];
63997
63837
  const fieldType = unwrapType(config, field.type).type;
63998
- if (graphql26.isInterfaceType(fieldType) || graphql26.isUnionType(fieldType)) {
63838
+ if (graphql25.isInterfaceType(fieldType) || graphql25.isUnionType(fieldType)) {
63999
63839
  return {
64000
63840
  ...node,
64001
63841
  selectionSet: {
@@ -64003,9 +63843,9 @@ async function addTypename(config, documents) {
64003
63843
  selections: [
64004
63844
  ...node.selectionSet.selections,
64005
63845
  {
64006
- kind: graphql26.Kind.FIELD,
63846
+ kind: graphql25.Kind.FIELD,
64007
63847
  name: {
64008
- kind: graphql26.Kind.NAME,
63848
+ kind: graphql25.Kind.NAME,
64009
63849
  value: "__typename"
64010
63850
  }
64011
63851
  }
@@ -64022,9 +63862,9 @@ async function addTypename(config, documents) {
64022
63862
  selections: [
64023
63863
  ...node.selectionSet.selections,
64024
63864
  {
64025
- kind: graphql26.Kind.FIELD,
63865
+ kind: graphql25.Kind.FIELD,
64026
63866
  name: {
64027
- kind: graphql26.Kind.NAME,
63867
+ kind: graphql25.Kind.NAME,
64028
63868
  value: "__typename"
64029
63869
  }
64030
63870
  }
@@ -64037,10 +63877,10 @@ async function addTypename(config, documents) {
64037
63877
  }
64038
63878
 
64039
63879
  // src/codegen/transforms/addID.ts
64040
- import * as graphql27 from "graphql";
63880
+ import * as graphql26 from "graphql";
64041
63881
  async function addID(config, documents) {
64042
63882
  for (const doc of documents) {
64043
- doc.document = graphql27.visit(doc.document, {
63883
+ doc.document = graphql26.visit(doc.document, {
64044
63884
  Field(node, key, parent2, path2, ancestors) {
64045
63885
  if (!node.selectionSet) {
64046
63886
  return;
@@ -64078,7 +63918,7 @@ function addKeysToSelection(config, node, fieldType) {
64078
63918
  if (!node.selectionSet || node.selectionSet.selections.length == 0) {
64079
63919
  return;
64080
63920
  }
64081
- if (!graphql27.isObjectType(fieldType) && !graphql27.isInterfaceType(fieldType)) {
63921
+ if (!graphql26.isObjectType(fieldType) && !graphql26.isInterfaceType(fieldType)) {
64082
63922
  return;
64083
63923
  }
64084
63924
  const keyFields = config.keyFieldsForType(fieldType.name);
@@ -64093,9 +63933,9 @@ function addKeysToSelection(config, node, fieldType) {
64093
63933
  continue;
64094
63934
  }
64095
63935
  selections.push({
64096
- kind: graphql27.Kind.FIELD,
63936
+ kind: graphql26.Kind.FIELD,
64097
63937
  name: {
64098
- kind: graphql27.Kind.NAME,
63938
+ kind: graphql26.Kind.NAME,
64099
63939
  value: keyField
64100
63940
  }
64101
63941
  });
@@ -64110,13 +63950,13 @@ function addKeysToSelection(config, node, fieldType) {
64110
63950
  }
64111
63951
 
64112
63952
  // src/codegen/transforms/componentFields.ts
64113
- import * as graphql28 from "graphql";
63953
+ import * as graphql27 from "graphql";
64114
63954
  async function componentFields(config, documents) {
64115
63955
  for (const document of documents) {
64116
- const typeInfo = new graphql28.TypeInfo(config.schema);
64117
- document.document = graphql28.visit(
63956
+ const typeInfo = new graphql27.TypeInfo(config.schema);
63957
+ document.document = graphql27.visit(
64118
63958
  document.document,
64119
- graphql28.visitWithTypeInfo(typeInfo, {
63959
+ graphql27.visitWithTypeInfo(typeInfo, {
64120
63960
  Field(node) {
64121
63961
  const parentType = typeInfo.getParentType();
64122
63962
  if (!parentType) {
@@ -64164,6 +64004,48 @@ async function componentFields(config, documents) {
64164
64004
  }
64165
64005
  }
64166
64006
 
64007
+ // src/codegen/transforms/runtimeScalars.ts
64008
+ import * as graphql28 from "graphql";
64009
+ async function addTypename2(config, documents) {
64010
+ for (const doc of documents) {
64011
+ doc.document = graphql28.visit(doc.document, {
64012
+ VariableDefinition(node) {
64013
+ const { type, wrappers } = unwrapType(config, node.type);
64014
+ const runtimeScalar = config.configFile.features?.runtimeScalars?.[type.name];
64015
+ if (runtimeScalar) {
64016
+ return {
64017
+ ...node,
64018
+ type: wrapType({
64019
+ type: config.schema.getType(runtimeScalar.type),
64020
+ wrappers
64021
+ }),
64022
+ directives: [
64023
+ ...node.directives ?? [],
64024
+ {
64025
+ kind: "Directive",
64026
+ name: {
64027
+ kind: "Name",
64028
+ value: config.runtimeScalarDirective
64029
+ },
64030
+ arguments: [
64031
+ {
64032
+ kind: "Argument",
64033
+ name: { kind: "Name", value: "type" },
64034
+ value: {
64035
+ kind: "StringValue",
64036
+ value: type.name
64037
+ }
64038
+ }
64039
+ ]
64040
+ }
64041
+ ]
64042
+ };
64043
+ }
64044
+ }
64045
+ });
64046
+ }
64047
+ }
64048
+
64167
64049
  // src/codegen/validators/typeCheck.ts
64168
64050
  import * as graphql29 from "graphql";
64169
64051
  async function typeCheck(config, docs) {
@@ -65165,10 +65047,22 @@ async function componentFields2(config, docs) {
65165
65047
  }
65166
65048
  const fieldValue = fieldArg.value?.kind === "StringValue" ? fieldArg.value.value : void 0;
65167
65049
  const propValue = propArg.value?.kind === "StringValue" ? propArg.value.value : void 0;
65050
+ const existingField = fieldValue && config.componentFields[parent2]?.[fieldValue];
65168
65051
  const parentType = config.schema.getType(parent2);
65169
- if (parentType && fieldValue && (graphql31.isObjectType(parentType) && parentType.getFields()[fieldValue] || config.componentFields[parent2]?.[fieldValue])) {
65052
+ let conflict = false;
65053
+ if (existingField && existingField.filepath !== filepath) {
65054
+ conflict = true;
65055
+ } else if (parentType && fieldValue) {
65056
+ const fieldDef = graphql31.isObjectType(parentType) && parentType.getFields()[fieldValue];
65057
+ if (fieldDef && !fieldDef.astNode?.directives?.find(
65058
+ (dir) => dir.name.value === config.componentFieldDirective
65059
+ )) {
65060
+ conflict = true;
65061
+ }
65062
+ }
65063
+ if (conflict) {
65170
65064
  errors.push({
65171
- message: `Duplicate component field definition for ${parent2}.${fieldValue}`,
65065
+ message: `Duplicate component field definition for ${parent2}.${fieldValue}.` + (existingField ? "The conflicting component field was defined in " + existingField.filepath : ""),
65172
65066
  filepath
65173
65067
  });
65174
65068
  }
@@ -65238,6 +65132,7 @@ async function runPipeline2(config, docs) {
65238
65132
  [
65239
65133
  componentFields2,
65240
65134
  graphqlExtensions,
65135
+ addTypename2,
65241
65136
  ...wrapHook(beforeValidate),
65242
65137
  typeCheck,
65243
65138
  uniqueDocumentNames,