houdini 1.0.0-next.8 → 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 (56) hide show
  1. package/build/cmd-cjs/index.js +50 -22
  2. package/build/cmd-esm/index.js +50 -22
  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 +48 -20
  6. package/build/codegen-esm/index.js +48 -20
  7. package/build/runtime/client/index.d.ts +1 -1
  8. package/build/runtime/client/plugins/cache.d.ts +1 -1
  9. package/build/runtime/client/plugins/fetch.d.ts +1 -1
  10. package/build/runtime/client/plugins/fetchParams.d.ts +1 -1
  11. package/build/runtime/client/plugins/mutation.d.ts +1 -1
  12. package/build/runtime/client/plugins/query.d.ts +1 -1
  13. package/build/runtime/client/plugins/subscription.d.ts +1 -1
  14. package/build/runtime/client/plugins/throwOnError.d.ts +1 -1
  15. package/build/runtime/lib/types.d.ts +1 -0
  16. package/build/runtime-cjs/client/documentStore.js +1 -1
  17. package/build/runtime-cjs/client/index.d.ts +1 -1
  18. package/build/runtime-cjs/client/index.js +13 -13
  19. package/build/runtime-cjs/client/plugins/cache.d.ts +1 -1
  20. package/build/runtime-cjs/client/plugins/cache.js +3 -3
  21. package/build/runtime-cjs/client/plugins/fetch.d.ts +1 -1
  22. package/build/runtime-cjs/client/plugins/fetch.js +7 -7
  23. package/build/runtime-cjs/client/plugins/fetchParams.d.ts +1 -1
  24. package/build/runtime-cjs/client/plugins/fetchParams.js +3 -3
  25. package/build/runtime-cjs/client/plugins/mutation.d.ts +1 -1
  26. package/build/runtime-cjs/client/plugins/mutation.js +3 -3
  27. package/build/runtime-cjs/client/plugins/query.d.ts +1 -1
  28. package/build/runtime-cjs/client/plugins/query.js +3 -3
  29. package/build/runtime-cjs/client/plugins/subscription.d.ts +1 -1
  30. package/build/runtime-cjs/client/plugins/subscription.js +3 -3
  31. package/build/runtime-cjs/client/plugins/throwOnError.d.ts +1 -1
  32. package/build/runtime-cjs/client/plugins/throwOnError.js +3 -3
  33. package/build/runtime-cjs/lib/types.d.ts +1 -0
  34. package/build/runtime-esm/client/documentStore.js +2 -2
  35. package/build/runtime-esm/client/index.d.ts +1 -1
  36. package/build/runtime-esm/client/index.js +10 -10
  37. package/build/runtime-esm/client/plugins/cache.d.ts +1 -1
  38. package/build/runtime-esm/client/plugins/cache.js +2 -2
  39. package/build/runtime-esm/client/plugins/fetch.d.ts +1 -1
  40. package/build/runtime-esm/client/plugins/fetch.js +6 -6
  41. package/build/runtime-esm/client/plugins/fetchParams.d.ts +1 -1
  42. package/build/runtime-esm/client/plugins/fetchParams.js +2 -2
  43. package/build/runtime-esm/client/plugins/mutation.d.ts +1 -1
  44. package/build/runtime-esm/client/plugins/mutation.js +2 -2
  45. package/build/runtime-esm/client/plugins/query.d.ts +1 -1
  46. package/build/runtime-esm/client/plugins/query.js +2 -2
  47. package/build/runtime-esm/client/plugins/subscription.d.ts +1 -1
  48. package/build/runtime-esm/client/plugins/subscription.js +2 -2
  49. package/build/runtime-esm/client/plugins/throwOnError.d.ts +1 -1
  50. package/build/runtime-esm/client/plugins/throwOnError.js +2 -2
  51. package/build/runtime-esm/lib/types.d.ts +1 -0
  52. package/build/test-cjs/index.js +48 -20
  53. package/build/test-esm/index.js +48 -20
  54. package/build/vite-cjs/index.js +48 -20
  55. package/build/vite-esm/index.js +48 -20
  56. package/package.json +1 -1
@@ -5100,7 +5100,7 @@ var require_definition = __commonJS({
5100
5100
  exports.assertInterfaceType = assertInterfaceType;
5101
5101
  exports.isUnionType = isUnionType13;
5102
5102
  exports.assertUnionType = assertUnionType;
5103
- exports.isEnumType = isEnumType10;
5103
+ exports.isEnumType = isEnumType11;
5104
5104
  exports.assertEnumType = assertEnumType;
5105
5105
  exports.isInputObjectType = isInputObjectType8;
5106
5106
  exports.assertInputObjectType = assertInputObjectType;
@@ -5171,7 +5171,7 @@ var require_definition = __commonJS({
5171
5171
  return Constructor;
5172
5172
  }
5173
5173
  function isType(type) {
5174
- return isScalarType13(type) || isObjectType12(type) || isInterfaceType12(type) || isUnionType13(type) || isEnumType10(type) || isInputObjectType8(type) || isListType8(type) || isNonNullType10(type);
5174
+ return isScalarType13(type) || isObjectType12(type) || isInterfaceType12(type) || isUnionType13(type) || isEnumType11(type) || isInputObjectType8(type) || isListType8(type) || isNonNullType10(type);
5175
5175
  }
5176
5176
  function assertType(type) {
5177
5177
  if (!isType(type)) {
@@ -5215,11 +5215,11 @@ var require_definition = __commonJS({
5215
5215
  }
5216
5216
  return type;
5217
5217
  }
5218
- function isEnumType10(type) {
5218
+ function isEnumType11(type) {
5219
5219
  return (0, _instanceOf.default)(type, GraphQLEnumType4);
5220
5220
  }
5221
5221
  function assertEnumType(type) {
5222
- if (!isEnumType10(type)) {
5222
+ if (!isEnumType11(type)) {
5223
5223
  throw new Error("Expected ".concat((0, _inspect.default)(type), " to be a GraphQL Enum type."));
5224
5224
  }
5225
5225
  return type;
@@ -5252,7 +5252,7 @@ var require_definition = __commonJS({
5252
5252
  return type;
5253
5253
  }
5254
5254
  function isInputType(type) {
5255
- return isScalarType13(type) || isEnumType10(type) || isInputObjectType8(type) || isWrappingType(type) && isInputType(type.ofType);
5255
+ return isScalarType13(type) || isEnumType11(type) || isInputObjectType8(type) || isWrappingType(type) && isInputType(type.ofType);
5256
5256
  }
5257
5257
  function assertInputType(type) {
5258
5258
  if (!isInputType(type)) {
@@ -5261,7 +5261,7 @@ var require_definition = __commonJS({
5261
5261
  return type;
5262
5262
  }
5263
5263
  function isOutputType(type) {
5264
- return isScalarType13(type) || isObjectType12(type) || isInterfaceType12(type) || isUnionType13(type) || isEnumType10(type) || isWrappingType(type) && isOutputType(type.ofType);
5264
+ return isScalarType13(type) || isObjectType12(type) || isInterfaceType12(type) || isUnionType13(type) || isEnumType11(type) || isWrappingType(type) && isOutputType(type.ofType);
5265
5265
  }
5266
5266
  function assertOutputType(type) {
5267
5267
  if (!isOutputType(type)) {
@@ -5270,7 +5270,7 @@ var require_definition = __commonJS({
5270
5270
  return type;
5271
5271
  }
5272
5272
  function isLeafType4(type) {
5273
- return isScalarType13(type) || isEnumType10(type);
5273
+ return isScalarType13(type) || isEnumType11(type);
5274
5274
  }
5275
5275
  function assertLeafType(type) {
5276
5276
  if (!isLeafType4(type)) {
@@ -5358,7 +5358,7 @@ var require_definition = __commonJS({
5358
5358
  }
5359
5359
  }
5360
5360
  function isNamedType4(type) {
5361
- return isScalarType13(type) || isObjectType12(type) || isInterfaceType12(type) || isUnionType13(type) || isEnumType10(type) || isInputObjectType8(type);
5361
+ return isScalarType13(type) || isObjectType12(type) || isInterfaceType12(type) || isUnionType13(type) || isEnumType11(type) || isInputObjectType8(type);
5362
5362
  }
5363
5363
  function assertNamedType(type) {
5364
5364
  if (!isNamedType4(type)) {
@@ -73603,11 +73603,13 @@ function scalarPropertyValue(config2, missingScalars, target) {
73603
73603
 
73604
73604
  // src/codegen/generators/typescript/typeReference.ts
73605
73605
  var AST8 = recast8.types.builders;
73606
- function tsTypeReference(config2, missingScalars, definition) {
73606
+ function tsTypeReference(config2, missingScalars, definition, body) {
73607
73607
  const { type, wrappers } = unwrapType(config2, definition.type);
73608
73608
  let result;
73609
73609
  if (graphql16.isScalarType(type)) {
73610
73610
  result = scalarPropertyValue(config2, missingScalars, type);
73611
+ } else if (graphql16.isEnumType(type)) {
73612
+ result = enumReference(config2, body, type.name);
73611
73613
  } else {
73612
73614
  result = AST8.tsTypeReference(AST8.identifier(type.name));
73613
73615
  }
@@ -73622,6 +73624,19 @@ function tsTypeReference(config2, missingScalars, definition) {
73622
73624
  }
73623
73625
  return result;
73624
73626
  }
73627
+ function enumReference(config2, body, name) {
73628
+ ensureImports({
73629
+ config: config2,
73630
+ body,
73631
+ import: ["ValueOf"],
73632
+ importKind: "type",
73633
+ sourceModule: "$houdini/runtime/lib/types"
73634
+ });
73635
+ return AST8.tsTypeReference(
73636
+ AST8.identifier("ValueOf"),
73637
+ AST8.tsTypeParameterInstantiation([AST8.tsTypeQuery(AST8.identifier(name))])
73638
+ );
73639
+ }
73625
73640
 
73626
73641
  // src/codegen/generators/typescript/addReferencedInputTypes.ts
73627
73642
  var AST9 = recast9.types.builders;
@@ -73653,7 +73668,7 @@ function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingS
73653
73668
  members.push(
73654
73669
  AST9.tsPropertySignature(
73655
73670
  AST9.identifier(field.name),
73656
- AST9.tsTypeAnnotation(tsTypeReference(config2, missingScalars, field)),
73671
+ AST9.tsTypeAnnotation(tsTypeReference(config2, missingScalars, field, body)),
73657
73672
  graphql17.isNullableType(field.type)
73658
73673
  )
73659
73674
  );
@@ -73684,6 +73699,13 @@ function inlineType({
73684
73699
  if (graphql18.isScalarType(type)) {
73685
73700
  result = scalarPropertyValue(config2, missingScalars, type);
73686
73701
  } else if (graphql18.isEnumType(type)) {
73702
+ ensureImports({
73703
+ config: config2,
73704
+ body,
73705
+ importKind: "type",
73706
+ import: ["ValueOf"],
73707
+ sourceModule: "$houdini/runtime/lib/types"
73708
+ });
73687
73709
  if (!visitedTypes.has(type.name)) {
73688
73710
  ensureImports({
73689
73711
  config: config2,
@@ -73693,7 +73715,7 @@ function inlineType({
73693
73715
  });
73694
73716
  visitedTypes.add(type.name);
73695
73717
  }
73696
- result = AST10.tsTypeReference(AST10.identifier(type.name));
73718
+ result = enumReference(config2, body, type.name);
73697
73719
  } else if (selections) {
73698
73720
  const rootObj = type;
73699
73721
  const inlineFragments = {};
@@ -74126,7 +74148,7 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
74126
74148
  return AST11.tsPropertySignature(
74127
74149
  AST11.identifier(definition2.variable.name.value),
74128
74150
  AST11.tsTypeAnnotation(
74129
- tsTypeReference(config2, missingScalars, definition2)
74151
+ tsTypeReference(config2, missingScalars, definition2, body)
74130
74152
  ),
74131
74153
  definition2.type.kind !== "NonNullType"
74132
74154
  );
@@ -74193,7 +74215,12 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
74193
74215
  return AST11.tsPropertySignature(
74194
74216
  AST11.identifier(definition2.variable.name.value),
74195
74217
  AST11.tsTypeAnnotation(
74196
- tsTypeReference(config2, missingScalars, definition2)
74218
+ tsTypeReference(
74219
+ config2,
74220
+ missingScalars,
74221
+ definition2,
74222
+ body
74223
+ )
74197
74224
  ),
74198
74225
  definition2.type.kind !== "NonNullType"
74199
74226
  );
@@ -74286,7 +74313,7 @@ async function imperativeCacheTypef(config2, docs) {
74286
74313
  ),
74287
74314
  AST12.tsPropertySignature(
74288
74315
  AST12.identifier("lists"),
74289
- AST12.tsTypeAnnotation(listDefinitions(config2, docs))
74316
+ AST12.tsTypeAnnotation(listDefinitions(config2, body, docs))
74290
74317
  ),
74291
74318
  AST12.tsPropertySignature(
74292
74319
  AST12.identifier("queries"),
@@ -74395,7 +74422,7 @@ function typeDefinitions(config2, body, docs, returnType) {
74395
74422
  const prop = AST12.tsPropertySignature(
74396
74423
  AST12.identifier(arg.name),
74397
74424
  AST12.tsTypeAnnotation(
74398
- tsTypeReference(config2, /* @__PURE__ */ new Set(), arg)
74425
+ tsTypeReference(config2, /* @__PURE__ */ new Set(), arg, body)
74399
74426
  )
74400
74427
  );
74401
74428
  const unwrapped2 = unwrapType(config2, arg.type);
@@ -74445,7 +74472,7 @@ function typeDefinitions(config2, body, docs, returnType) {
74445
74472
  })
74446
74473
  );
74447
74474
  }
74448
- function listDefinitions(config2, docs) {
74475
+ function listDefinitions(config2, body, docs) {
74449
74476
  const lists = [];
74450
74477
  const visitedLists = /* @__PURE__ */ new Set();
74451
74478
  for (const doc of docs) {
@@ -74502,7 +74529,8 @@ function listDefinitions(config2, docs) {
74502
74529
  tsTypeReference(
74503
74530
  config2,
74504
74531
  /* @__PURE__ */ new Set(),
74505
- arg
74532
+ arg,
74533
+ body
74506
74534
  )
74507
74535
  )
74508
74536
  );
@@ -74696,9 +74724,9 @@ async function definitionsGenerator(config2) {
74696
74724
  ).code;
74697
74725
  const typeDefinitions2 = enums.sort((a, b) => a.name.value.localeCompare(b.name.value)).map(
74698
74726
  (definition) => `
74699
- export declare enum ${definition.name.value} {
74700
- ${definition.values?.map((value) => ` ${value.name.value} = "${value.name.value}"`).join(",\n")}
74701
- }
74727
+ export const ${definition.name.value} = {
74728
+ ${definition.values?.map((value) => ` ${value.name.value}: "${value.name.value}"`).join(",\n")}
74729
+ } as const
74702
74730
  `
74703
74731
  ).join("");
74704
74732
  const definitionsIndex = `
@@ -76479,8 +76507,8 @@ async function updatePackageJSON(targetPath) {
76479
76507
  }
76480
76508
  packageJSON.devDependencies = {
76481
76509
  ...packageJSON.devDependencies,
76482
- houdini: "^1.0.0-next.8",
76483
- "houdini-svelte": "^1.0.0-next.8"
76510
+ houdini: "^1.0.0-next.9",
76511
+ "houdini-svelte": "^1.0.0-next.9"
76484
76512
  };
76485
76513
  await fs_exports.writeFile(packagePath, JSON.stringify(packageJSON, null, 4));
76486
76514
  }
@@ -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)) {
@@ -73608,11 +73608,13 @@ function scalarPropertyValue(config2, missingScalars, target) {
73608
73608
 
73609
73609
  // src/codegen/generators/typescript/typeReference.ts
73610
73610
  var AST8 = recast8.types.builders;
73611
- function tsTypeReference(config2, missingScalars, definition) {
73611
+ function tsTypeReference(config2, missingScalars, definition, body) {
73612
73612
  const { type, wrappers } = unwrapType(config2, definition.type);
73613
73613
  let result;
73614
73614
  if (graphql16.isScalarType(type)) {
73615
73615
  result = scalarPropertyValue(config2, missingScalars, type);
73616
+ } else if (graphql16.isEnumType(type)) {
73617
+ result = enumReference(config2, body, type.name);
73616
73618
  } else {
73617
73619
  result = AST8.tsTypeReference(AST8.identifier(type.name));
73618
73620
  }
@@ -73627,6 +73629,19 @@ function tsTypeReference(config2, missingScalars, definition) {
73627
73629
  }
73628
73630
  return result;
73629
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
+ }
73630
73645
 
73631
73646
  // src/codegen/generators/typescript/addReferencedInputTypes.ts
73632
73647
  var AST9 = recast9.types.builders;
@@ -73658,7 +73673,7 @@ function addReferencedInputTypes(config2, filepath, body, visitedTypes, missingS
73658
73673
  members.push(
73659
73674
  AST9.tsPropertySignature(
73660
73675
  AST9.identifier(field.name),
73661
- AST9.tsTypeAnnotation(tsTypeReference(config2, missingScalars, field)),
73676
+ AST9.tsTypeAnnotation(tsTypeReference(config2, missingScalars, field, body)),
73662
73677
  graphql17.isNullableType(field.type)
73663
73678
  )
73664
73679
  );
@@ -73689,6 +73704,13 @@ function inlineType({
73689
73704
  if (graphql18.isScalarType(type)) {
73690
73705
  result = scalarPropertyValue(config2, missingScalars, type);
73691
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
+ });
73692
73714
  if (!visitedTypes.has(type.name)) {
73693
73715
  ensureImports({
73694
73716
  config: config2,
@@ -73698,7 +73720,7 @@ function inlineType({
73698
73720
  });
73699
73721
  visitedTypes.add(type.name);
73700
73722
  }
73701
- result = AST10.tsTypeReference(AST10.identifier(type.name));
73723
+ result = enumReference(config2, body, type.name);
73702
73724
  } else if (selections) {
73703
73725
  const rootObj = type;
73704
73726
  const inlineFragments = {};
@@ -74131,7 +74153,7 @@ async function generateOperationTypeDefs(config2, filepath, body, definition, se
74131
74153
  return AST11.tsPropertySignature(
74132
74154
  AST11.identifier(definition2.variable.name.value),
74133
74155
  AST11.tsTypeAnnotation(
74134
- tsTypeReference(config2, missingScalars, definition2)
74156
+ tsTypeReference(config2, missingScalars, definition2, body)
74135
74157
  ),
74136
74158
  definition2.type.kind !== "NonNullType"
74137
74159
  );
@@ -74198,7 +74220,12 @@ async function generateFragmentTypeDefs(config2, filepath, body, selections, def
74198
74220
  return AST11.tsPropertySignature(
74199
74221
  AST11.identifier(definition2.variable.name.value),
74200
74222
  AST11.tsTypeAnnotation(
74201
- tsTypeReference(config2, missingScalars, definition2)
74223
+ tsTypeReference(
74224
+ config2,
74225
+ missingScalars,
74226
+ definition2,
74227
+ body
74228
+ )
74202
74229
  ),
74203
74230
  definition2.type.kind !== "NonNullType"
74204
74231
  );
@@ -74291,7 +74318,7 @@ async function imperativeCacheTypef(config2, docs) {
74291
74318
  ),
74292
74319
  AST12.tsPropertySignature(
74293
74320
  AST12.identifier("lists"),
74294
- AST12.tsTypeAnnotation(listDefinitions(config2, docs))
74321
+ AST12.tsTypeAnnotation(listDefinitions(config2, body, docs))
74295
74322
  ),
74296
74323
  AST12.tsPropertySignature(
74297
74324
  AST12.identifier("queries"),
@@ -74400,7 +74427,7 @@ function typeDefinitions(config2, body, docs, returnType) {
74400
74427
  const prop = AST12.tsPropertySignature(
74401
74428
  AST12.identifier(arg.name),
74402
74429
  AST12.tsTypeAnnotation(
74403
- tsTypeReference(config2, /* @__PURE__ */ new Set(), arg)
74430
+ tsTypeReference(config2, /* @__PURE__ */ new Set(), arg, body)
74404
74431
  )
74405
74432
  );
74406
74433
  const unwrapped2 = unwrapType(config2, arg.type);
@@ -74450,7 +74477,7 @@ function typeDefinitions(config2, body, docs, returnType) {
74450
74477
  })
74451
74478
  );
74452
74479
  }
74453
- function listDefinitions(config2, docs) {
74480
+ function listDefinitions(config2, body, docs) {
74454
74481
  const lists = [];
74455
74482
  const visitedLists = /* @__PURE__ */ new Set();
74456
74483
  for (const doc of docs) {
@@ -74507,7 +74534,8 @@ function listDefinitions(config2, docs) {
74507
74534
  tsTypeReference(
74508
74535
  config2,
74509
74536
  /* @__PURE__ */ new Set(),
74510
- arg
74537
+ arg,
74538
+ body
74511
74539
  )
74512
74540
  )
74513
74541
  );
@@ -74701,9 +74729,9 @@ async function definitionsGenerator(config2) {
74701
74729
  ).code;
74702
74730
  const typeDefinitions2 = enums.sort((a, b) => a.name.value.localeCompare(b.name.value)).map(
74703
74731
  (definition) => `
74704
- export declare enum ${definition.name.value} {
74705
- ${definition.values?.map((value) => ` ${value.name.value} = "${value.name.value}"`).join(",\n")}
74706
- }
74732
+ export const ${definition.name.value} = {
74733
+ ${definition.values?.map((value) => ` ${value.name.value}: "${value.name.value}"`).join(",\n")}
74734
+ } as const
74707
74735
  `
74708
74736
  ).join("");
74709
74737
  const definitionsIndex = `
@@ -76484,8 +76512,8 @@ async function updatePackageJSON(targetPath) {
76484
76512
  }
76485
76513
  packageJSON.devDependencies = {
76486
76514
  ...packageJSON.devDependencies,
76487
- houdini: "^1.0.0-next.8",
76488
- "houdini-svelte": "^1.0.0-next.8"
76515
+ houdini: "^1.0.0-next.9",
76516
+ "houdini-svelte": "^1.0.0-next.9"
76489
76517
  };
76490
76518
  await fs_exports.writeFile(packagePath, JSON.stringify(packageJSON, null, 4));
76491
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)) {
@@ -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 = `