houdini 1.0.0-next.7 → 1.0.0-next.9

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 (100) hide show
  1. package/build/cmd-cjs/index.js +93 -66
  2. package/build/cmd-esm/index.js +66 -39
  3. package/build/codegen/generators/typescript/typeReference.d.ts +4 -2
  4. package/build/codegen/generators/typescript/types.d.ts +0 -1
  5. package/build/codegen-cjs/index.js +67 -39
  6. package/build/codegen-esm/index.js +54 -26
  7. package/build/lib/config.d.ts +2 -1
  8. package/build/lib/path.d.ts +1 -1
  9. package/build/lib-cjs/index.js +40 -37
  10. package/build/lib-esm/index.js +14 -11
  11. package/build/runtime/cache/cache.d.ts +6 -6
  12. package/build/runtime/cache/storage.d.ts +5 -5
  13. package/build/runtime/cache/stuff.d.ts +0 -2
  14. package/build/runtime/client/documentStore.d.ts +4 -3
  15. package/build/runtime/client/index.d.ts +6 -5
  16. package/build/runtime/client/plugins/cache.d.ts +1 -1
  17. package/build/runtime/client/plugins/fetch.d.ts +1 -1
  18. package/build/runtime/client/plugins/fetchParams.d.ts +1 -1
  19. package/build/runtime/client/plugins/injectedPlugins.d.ts +2 -1
  20. package/build/runtime/client/plugins/mutation.d.ts +1 -1
  21. package/build/runtime/client/plugins/query.d.ts +1 -1
  22. package/build/runtime/client/plugins/subscription.d.ts +1 -1
  23. package/build/runtime/client/plugins/throwOnError.d.ts +1 -1
  24. package/build/runtime/client/utils/documentPlugins.d.ts +2 -2
  25. package/build/runtime/lib/flatten.d.ts +2 -0
  26. package/build/runtime/lib/types.d.ts +2 -0
  27. package/build/runtime/public/record.d.ts +1 -2
  28. package/build/runtime-cjs/cache/cache.d.ts +6 -6
  29. package/build/runtime-cjs/cache/cache.js +6 -5
  30. package/build/runtime-cjs/cache/lists.js +3 -3
  31. package/build/runtime-cjs/cache/storage.d.ts +5 -5
  32. package/build/runtime-cjs/cache/storage.js +2 -2
  33. package/build/runtime-cjs/cache/stuff.d.ts +0 -2
  34. package/build/runtime-cjs/cache/stuff.js +2 -19
  35. package/build/runtime-cjs/cache/subscription.js +5 -4
  36. package/build/runtime-cjs/client/documentStore.d.ts +4 -3
  37. package/build/runtime-cjs/client/documentStore.js +4 -4
  38. package/build/runtime-cjs/client/index.d.ts +6 -5
  39. package/build/runtime-cjs/client/index.js +45 -19
  40. package/build/runtime-cjs/client/plugins/cache.d.ts +1 -1
  41. package/build/runtime-cjs/client/plugins/cache.js +3 -3
  42. package/build/runtime-cjs/client/plugins/fetch.d.ts +1 -1
  43. package/build/runtime-cjs/client/plugins/fetch.js +7 -7
  44. package/build/runtime-cjs/client/plugins/fetchParams.d.ts +1 -1
  45. package/build/runtime-cjs/client/plugins/fetchParams.js +3 -3
  46. package/build/runtime-cjs/client/plugins/injectedPlugins.d.ts +2 -1
  47. package/build/runtime-cjs/client/plugins/mutation.d.ts +1 -1
  48. package/build/runtime-cjs/client/plugins/mutation.js +3 -3
  49. package/build/runtime-cjs/client/plugins/query.d.ts +1 -1
  50. package/build/runtime-cjs/client/plugins/query.js +3 -3
  51. package/build/runtime-cjs/client/plugins/subscription.d.ts +1 -1
  52. package/build/runtime-cjs/client/plugins/subscription.js +3 -3
  53. package/build/runtime-cjs/client/plugins/throwOnError.d.ts +1 -1
  54. package/build/runtime-cjs/client/plugins/throwOnError.js +3 -3
  55. package/build/runtime-cjs/client/utils/documentPlugins.d.ts +2 -2
  56. package/build/runtime-cjs/lib/flatten.d.ts +2 -0
  57. package/build/runtime-cjs/lib/flatten.js +41 -0
  58. package/build/runtime-cjs/lib/types.d.ts +2 -0
  59. package/build/runtime-cjs/public/cache.js +2 -2
  60. package/build/runtime-cjs/public/record.d.ts +1 -2
  61. package/build/runtime-cjs/public/record.js +1 -2
  62. package/build/runtime-esm/cache/cache.d.ts +6 -6
  63. package/build/runtime-esm/cache/cache.js +7 -6
  64. package/build/runtime-esm/cache/lists.js +3 -3
  65. package/build/runtime-esm/cache/storage.d.ts +5 -5
  66. package/build/runtime-esm/cache/storage.js +2 -2
  67. package/build/runtime-esm/cache/stuff.d.ts +0 -2
  68. package/build/runtime-esm/cache/stuff.js +1 -17
  69. package/build/runtime-esm/cache/subscription.js +6 -5
  70. package/build/runtime-esm/client/documentStore.d.ts +4 -3
  71. package/build/runtime-esm/client/documentStore.js +5 -5
  72. package/build/runtime-esm/client/index.d.ts +6 -5
  73. package/build/runtime-esm/client/index.js +46 -21
  74. package/build/runtime-esm/client/plugins/cache.d.ts +1 -1
  75. package/build/runtime-esm/client/plugins/cache.js +2 -2
  76. package/build/runtime-esm/client/plugins/fetch.d.ts +1 -1
  77. package/build/runtime-esm/client/plugins/fetch.js +6 -6
  78. package/build/runtime-esm/client/plugins/fetchParams.d.ts +1 -1
  79. package/build/runtime-esm/client/plugins/fetchParams.js +2 -2
  80. package/build/runtime-esm/client/plugins/injectedPlugins.d.ts +2 -1
  81. package/build/runtime-esm/client/plugins/mutation.d.ts +1 -1
  82. package/build/runtime-esm/client/plugins/mutation.js +2 -2
  83. package/build/runtime-esm/client/plugins/query.d.ts +1 -1
  84. package/build/runtime-esm/client/plugins/query.js +2 -2
  85. package/build/runtime-esm/client/plugins/subscription.d.ts +1 -1
  86. package/build/runtime-esm/client/plugins/subscription.js +2 -2
  87. package/build/runtime-esm/client/plugins/throwOnError.d.ts +1 -1
  88. package/build/runtime-esm/client/plugins/throwOnError.js +2 -2
  89. package/build/runtime-esm/client/utils/documentPlugins.d.ts +2 -2
  90. package/build/runtime-esm/lib/flatten.d.ts +2 -0
  91. package/build/runtime-esm/lib/flatten.js +17 -0
  92. package/build/runtime-esm/lib/types.d.ts +2 -0
  93. package/build/runtime-esm/public/cache.js +2 -2
  94. package/build/runtime-esm/public/record.d.ts +1 -2
  95. package/build/runtime-esm/public/record.js +1 -2
  96. package/build/test-cjs/index.js +67 -39
  97. package/build/test-esm/index.js +54 -26
  98. package/build/vite-cjs/index.js +90 -58
  99. package/build/vite-esm/index.js +64 -32
  100. package/package.json +4 -4
@@ -5106,7 +5106,7 @@ var require_definition = __commonJS({
5106
5106
  exports.assertInterfaceType = assertInterfaceType;
5107
5107
  exports.isUnionType = isUnionType13;
5108
5108
  exports.assertUnionType = assertUnionType;
5109
- exports.isEnumType = isEnumType10;
5109
+ exports.isEnumType = isEnumType11;
5110
5110
  exports.assertEnumType = assertEnumType;
5111
5111
  exports.isInputObjectType = isInputObjectType8;
5112
5112
  exports.assertInputObjectType = assertInputObjectType;
@@ -5177,7 +5177,7 @@ var require_definition = __commonJS({
5177
5177
  return Constructor;
5178
5178
  }
5179
5179
  function isType(type) {
5180
- return isScalarType13(type) || isObjectType12(type) || isInterfaceType12(type) || isUnionType13(type) || isEnumType10(type) || isInputObjectType8(type) || isListType8(type) || isNonNullType10(type);
5180
+ return isScalarType13(type) || isObjectType12(type) || isInterfaceType12(type) || isUnionType13(type) || isEnumType11(type) || isInputObjectType8(type) || isListType8(type) || isNonNullType10(type);
5181
5181
  }
5182
5182
  function assertType(type) {
5183
5183
  if (!isType(type)) {
@@ -5221,11 +5221,11 @@ var require_definition = __commonJS({
5221
5221
  }
5222
5222
  return type;
5223
5223
  }
5224
- function isEnumType10(type) {
5224
+ function isEnumType11(type) {
5225
5225
  return (0, _instanceOf.default)(type, GraphQLEnumType4);
5226
5226
  }
5227
5227
  function assertEnumType(type) {
5228
- if (!isEnumType10(type)) {
5228
+ if (!isEnumType11(type)) {
5229
5229
  throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Enum type."));
5230
5230
  }
5231
5231
  return type;
@@ -5258,7 +5258,7 @@ var require_definition = __commonJS({
5258
5258
  return type;
5259
5259
  }
5260
5260
  function isInputType(type) {
5261
- return isScalarType13(type) || isEnumType10(type) || isInputObjectType8(type) || isWrappingType(type) && isInputType(type.ofType);
5261
+ return isScalarType13(type) || isEnumType11(type) || isInputObjectType8(type) || isWrappingType(type) && isInputType(type.ofType);
5262
5262
  }
5263
5263
  function assertInputType(type) {
5264
5264
  if (!isInputType(type)) {
@@ -5267,7 +5267,7 @@ var require_definition = __commonJS({
5267
5267
  return type;
5268
5268
  }
5269
5269
  function isOutputType(type) {
5270
- return isScalarType13(type) || isObjectType12(type) || isInterfaceType12(type) || isUnionType13(type) || isEnumType10(type) || isWrappingType(type) && isOutputType(type.ofType);
5270
+ return isScalarType13(type) || isObjectType12(type) || isInterfaceType12(type) || isUnionType13(type) || isEnumType11(type) || isWrappingType(type) && isOutputType(type.ofType);
5271
5271
  }
5272
5272
  function assertOutputType(type) {
5273
5273
  if (!isOutputType(type)) {
@@ -5276,7 +5276,7 @@ var require_definition = __commonJS({
5276
5276
  return type;
5277
5277
  }
5278
5278
  function isLeafType4(type) {
5279
- return isScalarType13(type) || isEnumType10(type);
5279
+ return isScalarType13(type) || isEnumType11(type);
5280
5280
  }
5281
5281
  function assertLeafType(type) {
5282
5282
  if (!isLeafType4(type)) {
@@ -5364,7 +5364,7 @@ var require_definition = __commonJS({
5364
5364
  }
5365
5365
  }
5366
5366
  function isNamedType4(type) {
5367
- return isScalarType13(type) || isObjectType12(type) || isInterfaceType12(type) || isUnionType13(type) || isEnumType10(type) || isInputObjectType8(type);
5367
+ return isScalarType13(type) || isObjectType12(type) || isInterfaceType12(type) || isUnionType13(type) || isEnumType11(type) || isInputObjectType8(type);
5368
5368
  }
5369
5369
  function assertNamedType(type) {
5370
5370
  if (!isNamedType4(type)) {
@@ -68326,7 +68326,7 @@ function mergeSchemas(config2) {
68326
68326
  // src/lib/config.ts
68327
68327
  var graphql2 = __toESM(require_graphql2(), 1);
68328
68328
  var import_minimatch = __toESM(require_minimatch(), 1);
68329
- import { fileURLToPath, pathToFileURL } from "url";
68329
+ import { fileURLToPath, pathToFileURL } from "node:url";
68330
68330
 
68331
68331
  // src/runtime/lib/config.ts
68332
68332
  function defaultConfigValues(file) {
@@ -68431,8 +68431,8 @@ __export(fs_exports, {
68431
68431
  var import_fs_extra = __toESM(require_lib(), 1);
68432
68432
  var import_glob = __toESM(require_glob(), 1);
68433
68433
  var import_memfs = __toESM(require_lib2(), 1);
68434
- import fs from "fs/promises";
68435
- import { promisify } from "util";
68434
+ import fs from "node:fs/promises";
68435
+ import { promisify } from "node:util";
68436
68436
 
68437
68437
  // src/lib/path.ts
68438
68438
  var path_exports = {};
@@ -68449,8 +68449,8 @@ __export(path_exports, {
68449
68449
  resolve: () => resolve,
68450
68450
  sep: () => sep
68451
68451
  });
68452
- import os from "os";
68453
- import path from "path";
68452
+ import os from "node:os";
68453
+ import path from "node:path";
68454
68454
  var sep = "/";
68455
68455
  function resolve(...parts) {
68456
68456
  return posixify(path.resolve(...parts));
@@ -70441,13 +70441,16 @@ var pendingConfigPromise = null;
70441
70441
  async function getConfig({
70442
70442
  configPath = DEFAULT_CONFIG_PATH,
70443
70443
  noSchema,
70444
+ forceReload,
70444
70445
  ...extraConfig
70445
70446
  } = {}) {
70446
- if (_config) {
70447
- return _config;
70448
- }
70449
- if (pendingConfigPromise) {
70450
- return await pendingConfigPromise;
70447
+ if (!forceReload) {
70448
+ if (_config) {
70449
+ return _config;
70450
+ }
70451
+ if (pendingConfigPromise) {
70452
+ return await pendingConfigPromise;
70453
+ }
70451
70454
  }
70452
70455
  let resolve2 = () => {
70453
70456
  };
@@ -70643,7 +70646,7 @@ async function loadSchemaFile(schemaPath) {
70643
70646
 
70644
70647
  // src/lib/graphql.ts
70645
70648
  var graphql3 = __toESM(require_graphql2(), 1);
70646
- import crypto from "crypto";
70649
+ import crypto from "node:crypto";
70647
70650
  function getRootType(type) {
70648
70651
  if (graphql3.isNonNullType(type)) {
70649
70652
  return getRootType(type.ofType);
@@ -73605,11 +73608,13 @@ function scalarPropertyValue(config2, missingScalars, target) {
73605
73608
 
73606
73609
  // src/codegen/generators/typescript/typeReference.ts
73607
73610
  var AST8 = recast8.types.builders;
73608
- function tsTypeReference(config2, missingScalars, definition) {
73611
+ function tsTypeReference(config2, missingScalars, definition, body) {
73609
73612
  const { type, wrappers } = unwrapType(config2, definition.type);
73610
73613
  let result;
73611
73614
  if (graphql16.isScalarType(type)) {
73612
73615
  result = scalarPropertyValue(config2, missingScalars, type);
73616
+ } else if (graphql16.isEnumType(type)) {
73617
+ result = enumReference(config2, body, type.name);
73613
73618
  } else {
73614
73619
  result = AST8.tsTypeReference(AST8.identifier(type.name));
73615
73620
  }
@@ -73624,6 +73629,19 @@ function tsTypeReference(config2, missingScalars, definition) {
73624
73629
  }
73625
73630
  return result;
73626
73631
  }
73632
+ function enumReference(config2, body, name) {
73633
+ ensureImports({
73634
+ config: config2,
73635
+ body,
73636
+ import: ["ValueOf"],
73637
+ importKind: "type",
73638
+ sourceModule: "$houdini/runtime/lib/types"
73639
+ });
73640
+ return AST8.tsTypeReference(
73641
+ AST8.identifier("ValueOf"),
73642
+ AST8.tsTypeParameterInstantiation([AST8.tsTypeQuery(AST8.identifier(name))])
73643
+ );
73644
+ }
73627
73645
 
73628
73646
  // src/codegen/generators/typescript/addReferencedInputTypes.ts
73629
73647
  var AST9 = recast9.types.builders;
@@ -73655,7 +73673,7 @@ function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingS
73655
73673
  members.push(
73656
73674
  AST9.tsPropertySignature(
73657
73675
  AST9.identifier(field.name),
73658
- AST9.tsTypeAnnotation(tsTypeReference(config2, missingScalars, field)),
73676
+ AST9.tsTypeAnnotation(tsTypeReference(config2, missingScalars, field, body)),
73659
73677
  graphql17.isNullableType(field.type)
73660
73678
  )
73661
73679
  );
@@ -73686,6 +73704,13 @@ function inlineType({
73686
73704
  if (graphql18.isScalarType(type)) {
73687
73705
  result = scalarPropertyValue(config2, missingScalars, type);
73688
73706
  } else if (graphql18.isEnumType(type)) {
73707
+ ensureImports({
73708
+ config: config2,
73709
+ body,
73710
+ importKind: "type",
73711
+ import: ["ValueOf"],
73712
+ sourceModule: "$houdini/runtime/lib/types"
73713
+ });
73689
73714
  if (!visitedTypes.has(type.name)) {
73690
73715
  ensureImports({
73691
73716
  config: config2,
@@ -73695,7 +73720,7 @@ function inlineType({
73695
73720
  });
73696
73721
  visitedTypes.add(type.name);
73697
73722
  }
73698
- result = AST10.tsTypeReference(AST10.identifier(type.name));
73723
+ result = enumReference(config2, body, type.name);
73699
73724
  } else if (selections) {
73700
73725
  const rootObj = type;
73701
73726
  const inlineFragments = {};
@@ -74128,7 +74153,7 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
74128
74153
  return AST11.tsPropertySignature(
74129
74154
  AST11.identifier(definition2.variable.name.value),
74130
74155
  AST11.tsTypeAnnotation(
74131
- tsTypeReference(config2, missingScalars, definition2)
74156
+ tsTypeReference(config2, missingScalars, definition2, body)
74132
74157
  ),
74133
74158
  definition2.type.kind !== "NonNullType"
74134
74159
  );
@@ -74195,7 +74220,12 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
74195
74220
  return AST11.tsPropertySignature(
74196
74221
  AST11.identifier(definition2.variable.name.value),
74197
74222
  AST11.tsTypeAnnotation(
74198
- tsTypeReference(config2, missingScalars, definition2)
74223
+ tsTypeReference(
74224
+ config2,
74225
+ missingScalars,
74226
+ definition2,
74227
+ body
74228
+ )
74199
74229
  ),
74200
74230
  definition2.type.kind !== "NonNullType"
74201
74231
  );
@@ -74288,7 +74318,7 @@ async function imperativeCacheTypef(config2, docs) {
74288
74318
  ),
74289
74319
  AST12.tsPropertySignature(
74290
74320
  AST12.identifier("lists"),
74291
- AST12.tsTypeAnnotation(listDefinitions(config2, docs))
74321
+ AST12.tsTypeAnnotation(listDefinitions(config2, body, docs))
74292
74322
  ),
74293
74323
  AST12.tsPropertySignature(
74294
74324
  AST12.identifier("queries"),
@@ -74397,7 +74427,7 @@ function typeDefinitions(config2, body, docs, returnType) {
74397
74427
  const prop = AST12.tsPropertySignature(
74398
74428
  AST12.identifier(arg.name),
74399
74429
  AST12.tsTypeAnnotation(
74400
- tsTypeReference(config2, /* @__PURE__ */ new Set(), arg)
74430
+ tsTypeReference(config2, /* @__PURE__ */ new Set(), arg, body)
74401
74431
  )
74402
74432
  );
74403
74433
  const unwrapped2 = unwrapType(config2, arg.type);
@@ -74447,7 +74477,7 @@ function typeDefinitions(config2, body, docs, returnType) {
74447
74477
  })
74448
74478
  );
74449
74479
  }
74450
- function listDefinitions(config2, docs) {
74480
+ function listDefinitions(config2, body, docs) {
74451
74481
  const lists = [];
74452
74482
  const visitedLists = /* @__PURE__ */ new Set();
74453
74483
  for (const doc of docs) {
@@ -74504,7 +74534,8 @@ function listDefinitions(config2, docs) {
74504
74534
  tsTypeReference(
74505
74535
  config2,
74506
74536
  /* @__PURE__ */ new Set(),
74507
- arg
74537
+ arg,
74538
+ body
74508
74539
  )
74509
74540
  )
74510
74541
  );
@@ -74698,9 +74729,9 @@ async function definitionsGenerator(config2) {
74698
74729
  ).code;
74699
74730
  const typeDefinitions2 = enums.sort((a, b) => a.name.value.localeCompare(b.name.value)).map(
74700
74731
  (definition) => `
74701
- export declare enum ${definition.name.value} {
74702
- ${definition.values?.map((value) => ` ${value.name.value} = "${value.name.value}"`).join(",\n")}
74703
- }
74732
+ export const ${definition.name.value} = {
74733
+ ${definition.values?.map((value) => ` ${value.name.value}: "${value.name.value}"`).join(",\n")}
74734
+ } as const
74704
74735
  `
74705
74736
  ).join("");
74706
74737
  const definitionsIndex = `
@@ -76075,11 +76106,7 @@ async function pullSchema_default(args) {
76075
76106
  };
76076
76107
  }, headers);
76077
76108
  }
76078
- await pullSchema(
76079
- apiURL,
76080
- config2.schemaPath ? config2.schemaPath : path_exports.resolve(targetPath, "schema.json"),
76081
- headers
76082
- );
76109
+ await pullSchema(apiURL, config2.schemaPath ?? path_exports.resolve(targetPath, "schema.json"), headers);
76083
76110
  }
76084
76111
 
76085
76112
  // src/cmd/generate.ts
@@ -76113,8 +76140,8 @@ async function generate(args = {
76113
76140
 
76114
76141
  // src/cmd/init.ts
76115
76142
  var import_graphql31 = __toESM(require_graphql2(), 1);
76116
- import { execSync } from "child_process";
76117
76143
  var import_prompts = __toESM(require_prompts3(), 1);
76144
+ import { execSync } from "node:child_process";
76118
76145
  async function init(_path, args) {
76119
76146
  const force_remote_endpoint = args.force_remote_endpoint || false;
76120
76147
  try {
@@ -76485,8 +76512,8 @@ async function updatePackageJSON(targetPath) {
76485
76512
  }
76486
76513
  packageJSON.devDependencies = {
76487
76514
  ...packageJSON.devDependencies,
76488
- houdini: "^1.0.0-next.7",
76489
- "houdini-svelte": "^1.0.0-next.7"
76515
+ houdini: "^1.0.0-next.9",
76516
+ "houdini-svelte": "^1.0.0-next.9"
76490
76517
  };
76491
76518
  await fs_exports.writeFile(packagePath, JSON.stringify(packageJSON, null, 4));
76492
76519
  }
@@ -1,6 +1,8 @@
1
- import type { TSTypeKind } from 'ast-types/lib/gen/kinds';
1
+ import type { StatementKind, TSTypeKind } from 'ast-types/lib/gen/kinds';
2
2
  import * as graphql from 'graphql';
3
+ import * as recast from 'recast';
3
4
  import type { Config } from '../../../lib';
4
5
  export declare function tsTypeReference(config: Config, missingScalars: Set<string>, definition: {
5
6
  type: graphql.GraphQLScalarType | graphql.GraphQLInputType | graphql.GraphQLNamedType | graphql.TypeNode;
6
- }): TSTypeKind;
7
+ }, body: StatementKind[]): TSTypeKind;
8
+ export declare function enumReference(config: Config, body: StatementKind[], name: string): recast.types.namedTypes.TSTypeReference;
@@ -5,4 +5,3 @@ import type { Config } from '../../../lib';
5
5
  export declare function readonlyProperty(prop: recast.types.namedTypes.TSPropertySignature, enable?: boolean): recast.types.namedTypes.TSPropertySignature;
6
6
  export declare function nullableField(inner: TSTypeKind, input?: boolean): recast.types.namedTypes.TSUnionType;
7
7
  export declare function scalarPropertyValue(config: Config, missingScalars: Set<string>, target: graphql.GraphQLNamedType): TSTypeKind;
8
- export declare function enumDeclaration(type: graphql.GraphQLEnumType): recast.types.namedTypes.TSEnumDeclaration;
@@ -3347,7 +3347,7 @@ var require_definition = __commonJS({
3347
3347
  exports.assertInterfaceType = assertInterfaceType;
3348
3348
  exports.isUnionType = isUnionType7;
3349
3349
  exports.assertUnionType = assertUnionType;
3350
- exports.isEnumType = isEnumType5;
3350
+ exports.isEnumType = isEnumType6;
3351
3351
  exports.assertEnumType = assertEnumType;
3352
3352
  exports.isInputObjectType = isInputObjectType2;
3353
3353
  exports.assertInputObjectType = assertInputObjectType;
@@ -3418,7 +3418,7 @@ var require_definition = __commonJS({
3418
3418
  return Constructor;
3419
3419
  }
3420
3420
  function isType(type) {
3421
- return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType5(type) || isInputObjectType2(type) || isListType3(type) || isNonNullType6(type);
3421
+ return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType6(type) || isInputObjectType2(type) || isListType3(type) || isNonNullType6(type);
3422
3422
  }
3423
3423
  function assertType(type) {
3424
3424
  if (!isType(type)) {
@@ -3462,11 +3462,11 @@ var require_definition = __commonJS({
3462
3462
  }
3463
3463
  return type;
3464
3464
  }
3465
- function isEnumType5(type) {
3465
+ function isEnumType6(type) {
3466
3466
  return (0, _instanceOf.default)(type, GraphQLEnumType);
3467
3467
  }
3468
3468
  function assertEnumType(type) {
3469
- if (!isEnumType5(type)) {
3469
+ if (!isEnumType6(type)) {
3470
3470
  throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Enum type."));
3471
3471
  }
3472
3472
  return type;
@@ -3499,7 +3499,7 @@ var require_definition = __commonJS({
3499
3499
  return type;
3500
3500
  }
3501
3501
  function isInputType(type) {
3502
- return isScalarType7(type) || isEnumType5(type) || isInputObjectType2(type) || isWrappingType(type) && isInputType(type.ofType);
3502
+ return isScalarType7(type) || isEnumType6(type) || isInputObjectType2(type) || isWrappingType(type) && isInputType(type.ofType);
3503
3503
  }
3504
3504
  function assertInputType(type) {
3505
3505
  if (!isInputType(type)) {
@@ -3508,7 +3508,7 @@ var require_definition = __commonJS({
3508
3508
  return type;
3509
3509
  }
3510
3510
  function isOutputType(type) {
3511
- return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType5(type) || isWrappingType(type) && isOutputType(type.ofType);
3511
+ return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType6(type) || isWrappingType(type) && isOutputType(type.ofType);
3512
3512
  }
3513
3513
  function assertOutputType(type) {
3514
3514
  if (!isOutputType(type)) {
@@ -3517,7 +3517,7 @@ var require_definition = __commonJS({
3517
3517
  return type;
3518
3518
  }
3519
3519
  function isLeafType(type) {
3520
- return isScalarType7(type) || isEnumType5(type);
3520
+ return isScalarType7(type) || isEnumType6(type);
3521
3521
  }
3522
3522
  function assertLeafType(type) {
3523
3523
  if (!isLeafType(type)) {
@@ -3605,7 +3605,7 @@ var require_definition = __commonJS({
3605
3605
  }
3606
3606
  }
3607
3607
  function isNamedType(type) {
3608
- return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType5(type) || isInputObjectType2(type);
3608
+ return isScalarType7(type) || isObjectType3(type) || isInterfaceType6(type) || isUnionType7(type) || isEnumType6(type) || isInputObjectType2(type);
3609
3609
  }
3610
3610
  function assertNamedType(type) {
3611
3611
  if (!isNamedType(type)) {
@@ -54053,7 +54053,7 @@ async function runPipeline(config2, pipeline, target) {
54053
54053
 
54054
54054
  // src/lib/config.ts
54055
54055
  var import_minimatch = __toESM(require_minimatch(), 1);
54056
- var import_url = require("url");
54056
+ var import_node_url = require("node:url");
54057
54057
 
54058
54058
  // src/runtime/lib/config.ts
54059
54059
  function keyFieldsForType(configFile, type) {
@@ -54132,10 +54132,10 @@ __export(fs_exports, {
54132
54132
  writeFile: () => writeFile
54133
54133
  });
54134
54134
  var import_fs_extra = __toESM(require_lib(), 1);
54135
- var import_promises = __toESM(require("fs/promises"), 1);
54136
54135
  var import_glob = __toESM(require_glob(), 1);
54137
54136
  var import_memfs = __toESM(require_lib2(), 1);
54138
- var import_util = require("util");
54137
+ var import_promises = __toESM(require("node:fs/promises"), 1);
54138
+ var import_node_util = require("node:util");
54139
54139
 
54140
54140
  // src/lib/path.ts
54141
54141
  var path_exports = {};
@@ -54152,36 +54152,36 @@ __export(path_exports, {
54152
54152
  resolve: () => resolve,
54153
54153
  sep: () => sep
54154
54154
  });
54155
- var import_os = __toESM(require("os"), 1);
54156
- var import_path = __toESM(require("path"), 1);
54155
+ var import_node_os = __toESM(require("node:os"), 1);
54156
+ var import_node_path = __toESM(require("node:path"), 1);
54157
54157
  var sep = "/";
54158
54158
  function resolve(...parts) {
54159
- return posixify(import_path.default.resolve(...parts));
54159
+ return posixify(import_node_path.default.resolve(...parts));
54160
54160
  }
54161
54161
  function join(...parts) {
54162
- return posixify(import_path.default.join(...parts));
54162
+ return posixify(import_node_path.default.join(...parts));
54163
54163
  }
54164
54164
  function extname(target) {
54165
- return import_path.default.extname(target);
54165
+ return import_node_path.default.extname(target);
54166
54166
  }
54167
54167
  function relative(from, to) {
54168
- return posixify(import_path.default.relative(from, to));
54168
+ return posixify(import_node_path.default.relative(from, to));
54169
54169
  }
54170
54170
  function basename(target) {
54171
- return import_path.default.basename(target);
54171
+ return import_node_path.default.basename(target);
54172
54172
  }
54173
54173
  function dirname(target) {
54174
- return import_path.default.dirname(target);
54174
+ return import_node_path.default.dirname(target);
54175
54175
  }
54176
54176
  function isAbsolute(target) {
54177
- return import_path.default.isAbsolute(target);
54177
+ return import_node_path.default.isAbsolute(target);
54178
54178
  }
54179
54179
  function parse(target) {
54180
- return import_path.default.parse(target);
54180
+ return import_node_path.default.parse(target);
54181
54181
  }
54182
54182
  var posixify = (str) => str.replace(/\\/g, "/");
54183
54183
  function importPath(target) {
54184
- return ["win32", "win64"].includes(import_os.default.platform()) ? "file:///" + target : target;
54184
+ return ["win32", "win64"].includes(import_node_os.default.platform()) ? "file:///" + target : target;
54185
54185
  }
54186
54186
 
54187
54187
  // src/lib/fs.ts
@@ -54305,7 +54305,7 @@ async function rmdir(filepath) {
54305
54305
  recursive: true
54306
54306
  });
54307
54307
  }
54308
- return await (0, import_util.promisify)(import_memfs.fs.rmdir)(filepath);
54308
+ return await (0, import_node_util.promisify)(import_memfs.fs.rmdir)(filepath);
54309
54309
  }
54310
54310
  async function stat(filepath) {
54311
54311
  if (!houdini_mode.is_testing) {
@@ -54383,18 +54383,18 @@ async function recursiveCopy(source, target, transforms, notRoot) {
54383
54383
  }
54384
54384
  }
54385
54385
  async function glob(pattern) {
54386
- return await (0, import_util.promisify)(import_glob.glob)(posixify(pattern));
54386
+ return await (0, import_node_util.promisify)(import_glob.glob)(posixify(pattern));
54387
54387
  }
54388
54388
  glob.hasMagic = import_glob.glob.hasMagic;
54389
54389
 
54390
54390
  // src/lib/config.ts
54391
54391
  var import_meta = {};
54392
- var currentDir = global.__dirname || dirname((0, import_url.fileURLToPath)(import_meta.url));
54392
+ var currentDir = global.__dirname || dirname((0, import_node_url.fileURLToPath)(import_meta.url));
54393
54393
  var DEFAULT_CONFIG_PATH = join(process.cwd(), "houdini.config.js");
54394
54394
 
54395
54395
  // src/lib/graphql.ts
54396
- var import_crypto = __toESM(require("crypto"), 1);
54397
54396
  var graphql = __toESM(require_graphql2(), 1);
54397
+ var import_node_crypto = __toESM(require("node:crypto"), 1);
54398
54398
  function getRootType(type) {
54399
54399
  if (graphql.isNonNullType(type)) {
54400
54400
  return getRootType(type.ofType);
@@ -54408,7 +54408,7 @@ function hashDocument({
54408
54408
  document
54409
54409
  }) {
54410
54410
  const docString = typeof document === "string" ? document : document.artifact?.raw;
54411
- return import_crypto.default.createHash("sha256").update(docString ?? "").digest("hex");
54411
+ return import_node_crypto.default.createHash("sha256").update(docString ?? "").digest("hex");
54412
54412
  }
54413
54413
  function parentTypeFromAncestors(schema, filepath, ancestors) {
54414
54414
  const parents = [...ancestors];
@@ -57331,11 +57331,13 @@ function scalarPropertyValue(config2, missingScalars, target) {
57331
57331
 
57332
57332
  // src/codegen/generators/typescript/typeReference.ts
57333
57333
  var AST8 = recast8.types.builders;
57334
- function tsTypeReference(config2, missingScalars, definition) {
57334
+ function tsTypeReference(config2, missingScalars, definition, body) {
57335
57335
  const { type, wrappers } = unwrapType(config2, definition.type);
57336
57336
  let result;
57337
57337
  if (graphql14.isScalarType(type)) {
57338
57338
  result = scalarPropertyValue(config2, missingScalars, type);
57339
+ } else if (graphql14.isEnumType(type)) {
57340
+ result = enumReference(config2, body, type.name);
57339
57341
  } else {
57340
57342
  result = AST8.tsTypeReference(AST8.identifier(type.name));
57341
57343
  }
@@ -57350,6 +57352,19 @@ function tsTypeReference(config2, missingScalars, definition) {
57350
57352
  }
57351
57353
  return result;
57352
57354
  }
57355
+ function enumReference(config2, body, name) {
57356
+ ensureImports({
57357
+ config: config2,
57358
+ body,
57359
+ import: ["ValueOf"],
57360
+ importKind: "type",
57361
+ sourceModule: "$houdini/runtime/lib/types"
57362
+ });
57363
+ return AST8.tsTypeReference(
57364
+ AST8.identifier("ValueOf"),
57365
+ AST8.tsTypeParameterInstantiation([AST8.tsTypeQuery(AST8.identifier(name))])
57366
+ );
57367
+ }
57353
57368
 
57354
57369
  // src/codegen/generators/typescript/addReferencedInputTypes.ts
57355
57370
  var AST9 = recast9.types.builders;
@@ -57381,7 +57396,7 @@ function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingS
57381
57396
  members.push(
57382
57397
  AST9.tsPropertySignature(
57383
57398
  AST9.identifier(field.name),
57384
- AST9.tsTypeAnnotation(tsTypeReference(config2, missingScalars, field)),
57399
+ AST9.tsTypeAnnotation(tsTypeReference(config2, missingScalars, field, body)),
57385
57400
  graphql15.isNullableType(field.type)
57386
57401
  )
57387
57402
  );
@@ -57412,6 +57427,13 @@ function inlineType({
57412
57427
  if (graphql16.isScalarType(type)) {
57413
57428
  result = scalarPropertyValue(config2, missingScalars, type);
57414
57429
  } else if (graphql16.isEnumType(type)) {
57430
+ ensureImports({
57431
+ config: config2,
57432
+ body,
57433
+ importKind: "type",
57434
+ import: ["ValueOf"],
57435
+ sourceModule: "$houdini/runtime/lib/types"
57436
+ });
57415
57437
  if (!visitedTypes.has(type.name)) {
57416
57438
  ensureImports({
57417
57439
  config: config2,
@@ -57421,7 +57443,7 @@ function inlineType({
57421
57443
  });
57422
57444
  visitedTypes.add(type.name);
57423
57445
  }
57424
- result = AST10.tsTypeReference(AST10.identifier(type.name));
57446
+ result = enumReference(config2, body, type.name);
57425
57447
  } else if (selections) {
57426
57448
  const rootObj = type;
57427
57449
  const inlineFragments = {};
@@ -57854,7 +57876,7 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
57854
57876
  return AST11.tsPropertySignature(
57855
57877
  AST11.identifier(definition2.variable.name.value),
57856
57878
  AST11.tsTypeAnnotation(
57857
- tsTypeReference(config2, missingScalars, definition2)
57879
+ tsTypeReference(config2, missingScalars, definition2, body)
57858
57880
  ),
57859
57881
  definition2.type.kind !== "NonNullType"
57860
57882
  );
@@ -57921,7 +57943,12 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
57921
57943
  return AST11.tsPropertySignature(
57922
57944
  AST11.identifier(definition2.variable.name.value),
57923
57945
  AST11.tsTypeAnnotation(
57924
- tsTypeReference(config2, missingScalars, definition2)
57946
+ tsTypeReference(
57947
+ config2,
57948
+ missingScalars,
57949
+ definition2,
57950
+ body
57951
+ )
57925
57952
  ),
57926
57953
  definition2.type.kind !== "NonNullType"
57927
57954
  );
@@ -58014,7 +58041,7 @@ async function imperativeCacheTypef(config2, docs) {
58014
58041
  ),
58015
58042
  AST12.tsPropertySignature(
58016
58043
  AST12.identifier("lists"),
58017
- AST12.tsTypeAnnotation(listDefinitions(config2, docs))
58044
+ AST12.tsTypeAnnotation(listDefinitions(config2, body, docs))
58018
58045
  ),
58019
58046
  AST12.tsPropertySignature(
58020
58047
  AST12.identifier("queries"),
@@ -58123,7 +58150,7 @@ function typeDefinitions(config2, body, docs, returnType) {
58123
58150
  const prop = AST12.tsPropertySignature(
58124
58151
  AST12.identifier(arg.name),
58125
58152
  AST12.tsTypeAnnotation(
58126
- tsTypeReference(config2, /* @__PURE__ */ new Set(), arg)
58153
+ tsTypeReference(config2, /* @__PURE__ */ new Set(), arg, body)
58127
58154
  )
58128
58155
  );
58129
58156
  const unwrapped2 = unwrapType(config2, arg.type);
@@ -58173,7 +58200,7 @@ function typeDefinitions(config2, body, docs, returnType) {
58173
58200
  })
58174
58201
  );
58175
58202
  }
58176
- function listDefinitions(config2, docs) {
58203
+ function listDefinitions(config2, body, docs) {
58177
58204
  const lists = [];
58178
58205
  const visitedLists = /* @__PURE__ */ new Set();
58179
58206
  for (const doc of docs) {
@@ -58230,7 +58257,8 @@ function listDefinitions(config2, docs) {
58230
58257
  tsTypeReference(
58231
58258
  config2,
58232
58259
  /* @__PURE__ */ new Set(),
58233
- arg
58260
+ arg,
58261
+ body
58234
58262
  )
58235
58263
  )
58236
58264
  );
@@ -58424,9 +58452,9 @@ async function definitionsGenerator(config2) {
58424
58452
  ).code;
58425
58453
  const typeDefinitions2 = enums.sort((a, b) => a.name.value.localeCompare(b.name.value)).map(
58426
58454
  (definition) => `
58427
- export declare enum ${definition.name.value} {
58428
- ${definition.values?.map((value) => ` ${value.name.value} = "${value.name.value}"`).join(",\n")}
58429
- }
58455
+ export const ${definition.name.value} = {
58456
+ ${definition.values?.map((value) => ` ${value.name.value}: "${value.name.value}"`).join(",\n")}
58457
+ } as const
58430
58458
  `
58431
58459
  ).join("");
58432
58460
  const definitionsIndex = `