houdini 1.0.0-next.0 → 1.0.0-next.2

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 (213) hide show
  1. package/build/cmd/generate.d.ts +0 -1
  2. package/build/cmd-cjs/index.js +409 -2066
  3. package/build/cmd-esm/index.js +409 -2066
  4. package/build/codegen/generators/artifacts/fieldKey.d.ts +1 -1
  5. package/build/codegen/generators/artifacts/index.d.ts +1 -1
  6. package/build/codegen/generators/artifacts/indexFile.d.ts +1 -1
  7. package/build/codegen/generators/artifacts/inputs.d.ts +2 -2
  8. package/build/codegen/generators/artifacts/operations.d.ts +2 -2
  9. package/build/codegen/generators/artifacts/selection.d.ts +1 -1
  10. package/build/codegen/generators/artifacts/utils.d.ts +1 -1
  11. package/build/codegen/generators/definitions/enums.d.ts +1 -1
  12. package/build/codegen/generators/definitions/index.d.ts +1 -1
  13. package/build/codegen/generators/indexFile/index.d.ts +1 -1
  14. package/build/codegen/generators/persistedQueries/index.d.ts +1 -1
  15. package/build/codegen/generators/runtime/graphqlFunction.d.ts +2 -0
  16. package/build/codegen/generators/runtime/index.d.ts +1 -1
  17. package/build/codegen/generators/runtime/injectPlugins.d.ts +7 -0
  18. package/build/codegen/generators/runtime/pluginIndex.d.ts +5 -0
  19. package/build/codegen/generators/typescript/addReferencedInputTypes.d.ts +1 -1
  20. package/build/codegen/generators/typescript/imperativeCache.d.ts +1 -1
  21. package/build/codegen/generators/typescript/index.d.ts +1 -1
  22. package/build/codegen/generators/typescript/inlineType.d.ts +1 -1
  23. package/build/codegen/generators/typescript/typeReference.d.ts +1 -1
  24. package/build/codegen/generators/typescript/types.d.ts +1 -1
  25. package/build/codegen/index.d.ts +1 -1
  26. package/build/codegen/transforms/addID.d.ts +1 -1
  27. package/build/codegen/transforms/composeQueries.d.ts +2 -2
  28. package/build/codegen/transforms/fragmentVariables.d.ts +2 -2
  29. package/build/codegen/transforms/list.d.ts +1 -1
  30. package/build/codegen/transforms/paginate.d.ts +1 -1
  31. package/build/codegen/transforms/schema.d.ts +1 -1
  32. package/build/codegen/transforms/typename.d.ts +1 -1
  33. package/build/codegen/utils/commonjs.d.ts +2 -0
  34. package/build/codegen/utils/flattenSelections.d.ts +2 -2
  35. package/build/codegen/utils/moduleExport.d.ts +1 -1
  36. package/build/codegen/utils/objectIdentificationSelection.d.ts +1 -1
  37. package/build/codegen/validators/noIDAlias.d.ts +1 -1
  38. package/build/codegen/validators/typeCheck.d.ts +1 -1
  39. package/build/codegen-cjs/index.js +330 -1977
  40. package/build/codegen-esm/index.js +330 -1977
  41. package/build/lib/config.d.ts +8 -3
  42. package/build/lib/fs.d.ts +1 -1
  43. package/build/lib/graphql.d.ts +1 -1
  44. package/build/lib/imports.d.ts +1 -1
  45. package/build/lib/types.d.ts +3 -3
  46. package/build/lib/walk.d.ts +4 -4
  47. package/build/lib-cjs/index.js +145 -1846
  48. package/build/lib-esm/index.js +145 -1846
  49. package/build/runtime/cache/cache.d.ts +10 -8
  50. package/build/runtime/cache/gc.d.ts +1 -1
  51. package/build/runtime/cache/lists.d.ts +2 -2
  52. package/build/runtime/cache/schema.d.ts +2 -2
  53. package/build/runtime/cache/stuff.d.ts +2 -2
  54. package/build/runtime/cache/subscription.d.ts +19 -11
  55. package/build/runtime/client/documentStore.d.ts +87 -0
  56. package/build/runtime/client/index.d.ts +25 -0
  57. package/build/runtime/client/plugins/cache.d.ts +8 -0
  58. package/build/runtime/client/plugins/fetch.d.ts +37 -0
  59. package/build/runtime/client/plugins/fetchParams.d.ts +9 -0
  60. package/build/runtime/client/plugins/index.d.ts +7 -0
  61. package/build/runtime/client/plugins/injectedPlugins.d.ts +3 -0
  62. package/build/runtime/client/plugins/mutation.d.ts +1 -0
  63. package/build/runtime/client/plugins/query.d.ts +2 -0
  64. package/build/runtime/client/plugins/subscription.d.ts +18 -0
  65. package/build/runtime/client/plugins/throwOnError.d.ts +7 -0
  66. package/build/runtime/client/utils/documentPlugins.d.ts +3 -0
  67. package/build/runtime/client/utils/index.d.ts +1 -0
  68. package/build/runtime/imports/config.d.ts +3 -0
  69. package/build/runtime/index.d.ts +2 -1
  70. package/build/runtime/lib/config.d.ts +5 -3
  71. package/build/runtime/lib/index.d.ts +1 -2
  72. package/build/runtime/lib/scalars.d.ts +5 -4
  73. package/build/runtime/lib/selection.d.ts +1 -1
  74. package/build/runtime/lib/store.d.ts +19 -0
  75. package/build/runtime/lib/types.d.ts +22 -9
  76. package/build/runtime/public/cache.d.ts +2 -2
  77. package/build/runtime/public/list.d.ts +2 -2
  78. package/build/runtime/public/record.d.ts +1 -1
  79. package/build/runtime/public/tests/test.d.ts +1 -1
  80. package/build/runtime-cjs/cache/cache.d.ts +10 -8
  81. package/build/runtime-cjs/cache/cache.js +5 -11
  82. package/build/runtime-cjs/cache/gc.d.ts +1 -1
  83. package/build/runtime-cjs/cache/lists.d.ts +2 -2
  84. package/build/runtime-cjs/cache/lists.js +2 -2
  85. package/build/runtime-cjs/cache/schema.d.ts +2 -2
  86. package/build/runtime-cjs/cache/stuff.d.ts +2 -2
  87. package/build/runtime-cjs/cache/subscription.d.ts +19 -11
  88. package/build/runtime-cjs/cache/subscription.js +95 -56
  89. package/build/runtime-cjs/client/documentStore.d.ts +87 -0
  90. package/build/runtime-cjs/client/documentStore.js +360 -0
  91. package/build/runtime-cjs/client/index.d.ts +25 -0
  92. package/build/runtime-cjs/client/index.js +87 -0
  93. package/build/runtime-cjs/client/plugins/cache.d.ts +8 -0
  94. package/build/runtime-cjs/client/plugins/cache.js +99 -0
  95. package/build/runtime-cjs/client/plugins/fetch.d.ts +37 -0
  96. package/build/runtime-cjs/{lib/networkUtils.js → client/plugins/fetch.js} +95 -3
  97. package/build/runtime-cjs/client/plugins/fetchParams.d.ts +9 -0
  98. package/build/runtime-cjs/client/plugins/fetchParams.js +40 -0
  99. package/build/runtime-cjs/client/plugins/index.d.ts +7 -0
  100. package/build/runtime-cjs/client/plugins/index.js +24 -0
  101. package/build/runtime-cjs/client/plugins/injectedPlugins.d.ts +3 -0
  102. package/build/runtime-cjs/{lib/errors.js → client/plugins/injectedPlugins.js} +7 -15
  103. package/build/runtime-cjs/client/plugins/mutation.d.ts +1 -0
  104. package/build/runtime-cjs/client/plugins/mutation.js +86 -0
  105. package/build/runtime-cjs/client/plugins/query.d.ts +2 -0
  106. package/build/runtime-cjs/client/plugins/query.js +83 -0
  107. package/build/runtime-cjs/client/plugins/subscription.d.ts +18 -0
  108. package/build/runtime-cjs/client/plugins/subscription.js +98 -0
  109. package/build/runtime-cjs/client/plugins/throwOnError.d.ts +7 -0
  110. package/build/runtime-cjs/client/plugins/throwOnError.js +47 -0
  111. package/build/runtime-cjs/client/utils/documentPlugins.d.ts +3 -0
  112. package/build/runtime-cjs/client/utils/documentPlugins.js +56 -0
  113. package/build/runtime-cjs/client/utils/index.d.ts +1 -0
  114. package/build/runtime-cjs/client/utils/index.js +18 -0
  115. package/build/runtime-cjs/imports/config.d.ts +3 -0
  116. package/build/runtime-cjs/imports/config.js +26 -0
  117. package/build/runtime-cjs/index.d.ts +2 -1
  118. package/build/runtime-cjs/index.js +1 -0
  119. package/build/runtime-cjs/lib/config.d.ts +5 -3
  120. package/build/runtime-cjs/lib/config.js +5 -4
  121. package/build/runtime-cjs/lib/index.d.ts +1 -2
  122. package/build/runtime-cjs/lib/index.js +1 -2
  123. package/build/runtime-cjs/lib/scalars.d.ts +5 -4
  124. package/build/runtime-cjs/lib/scalars.js +20 -24
  125. package/build/runtime-cjs/lib/selection.d.ts +1 -1
  126. package/build/runtime-cjs/lib/store.d.ts +19 -0
  127. package/build/runtime-cjs/lib/store.js +81 -0
  128. package/build/runtime-cjs/lib/types.d.ts +22 -9
  129. package/build/runtime-cjs/public/cache.d.ts +2 -2
  130. package/build/runtime-cjs/public/list.d.ts +2 -2
  131. package/build/runtime-cjs/public/list.js +2 -2
  132. package/build/runtime-cjs/public/record.d.ts +1 -1
  133. package/build/runtime-cjs/public/record.js +4 -4
  134. package/build/runtime-cjs/public/tests/test.d.ts +1 -1
  135. package/build/runtime-esm/cache/cache.d.ts +10 -8
  136. package/build/runtime-esm/cache/cache.js +5 -11
  137. package/build/runtime-esm/cache/gc.d.ts +1 -1
  138. package/build/runtime-esm/cache/lists.d.ts +2 -2
  139. package/build/runtime-esm/cache/lists.js +2 -2
  140. package/build/runtime-esm/cache/schema.d.ts +2 -2
  141. package/build/runtime-esm/cache/stuff.d.ts +2 -2
  142. package/build/runtime-esm/cache/subscription.d.ts +19 -11
  143. package/build/runtime-esm/cache/subscription.js +95 -56
  144. package/build/runtime-esm/client/documentStore.d.ts +87 -0
  145. package/build/runtime-esm/client/documentStore.js +336 -0
  146. package/build/runtime-esm/client/index.d.ts +25 -0
  147. package/build/runtime-esm/client/index.js +58 -0
  148. package/build/runtime-esm/client/plugins/cache.d.ts +8 -0
  149. package/build/runtime-esm/client/plugins/cache.js +69 -0
  150. package/build/runtime-esm/client/plugins/fetch.d.ts +37 -0
  151. package/build/runtime-esm/client/plugins/fetch.js +151 -0
  152. package/build/runtime-esm/client/plugins/fetchParams.d.ts +9 -0
  153. package/build/runtime-esm/client/plugins/fetchParams.js +16 -0
  154. package/build/runtime-esm/client/plugins/index.d.ts +7 -0
  155. package/build/runtime-esm/client/plugins/index.js +7 -0
  156. package/build/runtime-esm/client/plugins/injectedPlugins.d.ts +3 -0
  157. package/build/runtime-esm/client/plugins/injectedPlugins.js +5 -0
  158. package/build/runtime-esm/client/plugins/mutation.d.ts +1 -0
  159. package/build/runtime-esm/client/plugins/mutation.js +56 -0
  160. package/build/runtime-esm/client/plugins/query.d.ts +2 -0
  161. package/build/runtime-esm/client/plugins/query.js +53 -0
  162. package/build/runtime-esm/client/plugins/subscription.d.ts +18 -0
  163. package/build/runtime-esm/client/plugins/subscription.js +74 -0
  164. package/build/runtime-esm/client/plugins/throwOnError.d.ts +7 -0
  165. package/build/runtime-esm/client/plugins/throwOnError.js +23 -0
  166. package/build/runtime-esm/client/utils/documentPlugins.d.ts +3 -0
  167. package/build/runtime-esm/client/utils/documentPlugins.js +32 -0
  168. package/build/runtime-esm/client/utils/index.d.ts +1 -0
  169. package/build/runtime-esm/client/utils/index.js +1 -0
  170. package/build/runtime-esm/imports/config.d.ts +3 -0
  171. package/build/runtime-esm/imports/config.js +4 -0
  172. package/build/runtime-esm/index.d.ts +2 -1
  173. package/build/runtime-esm/index.js +1 -0
  174. package/build/runtime-esm/lib/config.d.ts +5 -3
  175. package/build/runtime-esm/lib/config.js +5 -4
  176. package/build/runtime-esm/lib/index.d.ts +1 -2
  177. package/build/runtime-esm/lib/index.js +1 -2
  178. package/build/runtime-esm/lib/scalars.d.ts +5 -4
  179. package/build/runtime-esm/lib/scalars.js +20 -24
  180. package/build/runtime-esm/lib/selection.d.ts +1 -1
  181. package/build/runtime-esm/lib/store.d.ts +19 -0
  182. package/build/runtime-esm/lib/store.js +57 -0
  183. package/build/runtime-esm/lib/types.d.ts +22 -9
  184. package/build/runtime-esm/public/cache.d.ts +2 -2
  185. package/build/runtime-esm/public/list.d.ts +2 -2
  186. package/build/runtime-esm/public/list.js +1 -1
  187. package/build/runtime-esm/public/record.d.ts +1 -1
  188. package/build/runtime-esm/public/record.js +1 -1
  189. package/build/runtime-esm/public/tests/test.d.ts +1 -1
  190. package/build/test/index.d.ts +4 -3
  191. package/build/test-cjs/index.js +336 -1955
  192. package/build/test-esm/index.js +336 -1955
  193. package/build/vite/ast.d.ts +1 -1
  194. package/build/vite/houdini.d.ts +1 -1
  195. package/build/vite/imports.d.ts +3 -3
  196. package/build/vite/index.d.ts +1 -1
  197. package/build/vite/schema.d.ts +1 -1
  198. package/build/vite-cjs/index.js +396 -2010
  199. package/build/vite-esm/index.js +396 -2010
  200. package/package.json +1 -1
  201. package/build/runtime/lib/errors.d.ts +0 -3
  202. package/build/runtime/lib/network.d.ts +0 -79
  203. package/build/runtime/lib/networkUtils.d.ts +0 -8
  204. package/build/runtime-cjs/lib/errors.d.ts +0 -3
  205. package/build/runtime-cjs/lib/network.d.ts +0 -79
  206. package/build/runtime-cjs/lib/network.js +0 -200
  207. package/build/runtime-cjs/lib/networkUtils.d.ts +0 -8
  208. package/build/runtime-esm/lib/errors.d.ts +0 -3
  209. package/build/runtime-esm/lib/errors.js +0 -11
  210. package/build/runtime-esm/lib/network.d.ts +0 -79
  211. package/build/runtime-esm/lib/network.js +0 -170
  212. package/build/runtime-esm/lib/networkUtils.d.ts +0 -8
  213. package/build/runtime-esm/lib/networkUtils.js +0 -60
@@ -9520,18 +9520,18 @@ var require_execute = __commonJS({
9520
9520
  }
9521
9521
  var returnType = fieldDef.type;
9522
9522
  var resolveFn = (_fieldDef$resolve = fieldDef.resolve) !== null && _fieldDef$resolve !== void 0 ? _fieldDef$resolve : exeContext.fieldResolver;
9523
- var info2 = buildResolveInfo(exeContext, fieldDef, fieldNodes, parentType, path2);
9523
+ var info = buildResolveInfo(exeContext, fieldDef, fieldNodes, parentType, path2);
9524
9524
  try {
9525
9525
  var args = (0, _values.getArgumentValues)(fieldDef, fieldNodes[0], exeContext.variableValues);
9526
9526
  var _contextValue = exeContext.contextValue;
9527
- var result = resolveFn(source, args, _contextValue, info2);
9527
+ var result = resolveFn(source, args, _contextValue, info);
9528
9528
  var completed;
9529
9529
  if ((0, _isPromise.default)(result)) {
9530
9530
  completed = result.then(function(resolved) {
9531
- return completeValue(exeContext, returnType, fieldNodes, info2, path2, resolved);
9531
+ return completeValue(exeContext, returnType, fieldNodes, info, path2, resolved);
9532
9532
  });
9533
9533
  } else {
9534
- completed = completeValue(exeContext, returnType, fieldNodes, info2, path2, result);
9534
+ completed = completeValue(exeContext, returnType, fieldNodes, info, path2, result);
9535
9535
  }
9536
9536
  if ((0, _isPromise.default)(completed)) {
9537
9537
  return completed.then(void 0, function(rawError) {
@@ -9566,14 +9566,14 @@ var require_execute = __commonJS({
9566
9566
  exeContext.errors.push(error);
9567
9567
  return null;
9568
9568
  }
9569
- function completeValue(exeContext, returnType, fieldNodes, info2, path2, result) {
9569
+ function completeValue(exeContext, returnType, fieldNodes, info, path2, result) {
9570
9570
  if (result instanceof Error) {
9571
9571
  throw result;
9572
9572
  }
9573
9573
  if ((0, _definition.isNonNullType)(returnType)) {
9574
- var completed = completeValue(exeContext, returnType.ofType, fieldNodes, info2, path2, result);
9574
+ var completed = completeValue(exeContext, returnType.ofType, fieldNodes, info, path2, result);
9575
9575
  if (completed === null) {
9576
- throw new Error("Cannot return null for non-nullable field ".concat(info2.parentType.name, ".").concat(info2.fieldName, "."));
9576
+ throw new Error("Cannot return null for non-nullable field ".concat(info.parentType.name, ".").concat(info.fieldName, "."));
9577
9577
  }
9578
9578
  return completed;
9579
9579
  }
@@ -9581,20 +9581,20 @@ var require_execute = __commonJS({
9581
9581
  return null;
9582
9582
  }
9583
9583
  if ((0, _definition.isListType)(returnType)) {
9584
- return completeListValue(exeContext, returnType, fieldNodes, info2, path2, result);
9584
+ return completeListValue(exeContext, returnType, fieldNodes, info, path2, result);
9585
9585
  }
9586
9586
  if ((0, _definition.isLeafType)(returnType)) {
9587
9587
  return completeLeafValue(returnType, result);
9588
9588
  }
9589
9589
  if ((0, _definition.isAbstractType)(returnType)) {
9590
- return completeAbstractValue(exeContext, returnType, fieldNodes, info2, path2, result);
9590
+ return completeAbstractValue(exeContext, returnType, fieldNodes, info, path2, result);
9591
9591
  }
9592
9592
  if ((0, _definition.isObjectType)(returnType)) {
9593
- return completeObjectValue(exeContext, returnType, fieldNodes, info2, path2, result);
9593
+ return completeObjectValue(exeContext, returnType, fieldNodes, info, path2, result);
9594
9594
  }
9595
9595
  (0, _invariant.default)(0, "Cannot complete value of unexpected output type: " + (0, _inspect.default)(returnType));
9596
9596
  }
9597
- function completeListValue(exeContext, returnType, fieldNodes, info2, path2, result) {
9597
+ function completeListValue(exeContext, returnType, fieldNodes, info, path2, result) {
9598
9598
  var itemType = returnType.ofType;
9599
9599
  var containsPromise = false;
9600
9600
  var completedResults = (0, _safeArrayFrom.default)(result, function(item, index) {
@@ -9603,10 +9603,10 @@ var require_execute = __commonJS({
9603
9603
  var completedItem;
9604
9604
  if ((0, _isPromise.default)(item)) {
9605
9605
  completedItem = item.then(function(resolved) {
9606
- return completeValue(exeContext, itemType, fieldNodes, info2, itemPath, resolved);
9606
+ return completeValue(exeContext, itemType, fieldNodes, info, itemPath, resolved);
9607
9607
  });
9608
9608
  } else {
9609
- completedItem = completeValue(exeContext, itemType, fieldNodes, info2, itemPath, item);
9609
+ completedItem = completeValue(exeContext, itemType, fieldNodes, info, itemPath, item);
9610
9610
  }
9611
9611
  if ((0, _isPromise.default)(completedItem)) {
9612
9612
  containsPromise = true;
@@ -9622,7 +9622,7 @@ var require_execute = __commonJS({
9622
9622
  }
9623
9623
  });
9624
9624
  if (completedResults == null) {
9625
- throw new _GraphQLError.GraphQLError('Expected Iterable, but did not find one for field "'.concat(info2.parentType.name, ".").concat(info2.fieldName, '".'));
9625
+ throw new _GraphQLError.GraphQLError('Expected Iterable, but did not find one for field "'.concat(info.parentType.name, ".").concat(info.fieldName, '".'));
9626
9626
  }
9627
9627
  return containsPromise ? Promise.all(completedResults) : completedResults;
9628
9628
  }
@@ -9633,25 +9633,25 @@ var require_execute = __commonJS({
9633
9633
  }
9634
9634
  return serializedResult;
9635
9635
  }
9636
- function completeAbstractValue(exeContext, returnType, fieldNodes, info2, path2, result) {
9636
+ function completeAbstractValue(exeContext, returnType, fieldNodes, info, path2, result) {
9637
9637
  var _returnType$resolveTy;
9638
9638
  var resolveTypeFn = (_returnType$resolveTy = returnType.resolveType) !== null && _returnType$resolveTy !== void 0 ? _returnType$resolveTy : exeContext.typeResolver;
9639
9639
  var contextValue = exeContext.contextValue;
9640
- var runtimeType = resolveTypeFn(result, contextValue, info2, returnType);
9640
+ var runtimeType = resolveTypeFn(result, contextValue, info, returnType);
9641
9641
  if ((0, _isPromise.default)(runtimeType)) {
9642
9642
  return runtimeType.then(function(resolvedRuntimeType) {
9643
- return completeObjectValue(exeContext, ensureValidRuntimeType(resolvedRuntimeType, exeContext, returnType, fieldNodes, info2, result), fieldNodes, info2, path2, result);
9643
+ return completeObjectValue(exeContext, ensureValidRuntimeType(resolvedRuntimeType, exeContext, returnType, fieldNodes, info, result), fieldNodes, info, path2, result);
9644
9644
  });
9645
9645
  }
9646
- return completeObjectValue(exeContext, ensureValidRuntimeType(runtimeType, exeContext, returnType, fieldNodes, info2, result), fieldNodes, info2, path2, result);
9646
+ return completeObjectValue(exeContext, ensureValidRuntimeType(runtimeType, exeContext, returnType, fieldNodes, info, result), fieldNodes, info, path2, result);
9647
9647
  }
9648
- function ensureValidRuntimeType(runtimeTypeOrName, exeContext, returnType, fieldNodes, info2, result) {
9648
+ function ensureValidRuntimeType(runtimeTypeOrName, exeContext, returnType, fieldNodes, info, result) {
9649
9649
  if (runtimeTypeOrName == null) {
9650
- throw new _GraphQLError.GraphQLError('Abstract type "'.concat(returnType.name, '" must resolve to an Object type at runtime for field "').concat(info2.parentType.name, ".").concat(info2.fieldName, '". Either the "').concat(returnType.name, '" type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.'), fieldNodes);
9650
+ throw new _GraphQLError.GraphQLError('Abstract type "'.concat(returnType.name, '" must resolve to an Object type at runtime for field "').concat(info.parentType.name, ".").concat(info.fieldName, '". Either the "').concat(returnType.name, '" type should provide a "resolveType" function or each possible type should provide an "isTypeOf" function.'), fieldNodes);
9651
9651
  }
9652
9652
  var runtimeTypeName = (0, _definition.isNamedType)(runtimeTypeOrName) ? runtimeTypeOrName.name : runtimeTypeOrName;
9653
9653
  if (typeof runtimeTypeName !== "string") {
9654
- throw new _GraphQLError.GraphQLError('Abstract type "'.concat(returnType.name, '" must resolve to an Object type at runtime for field "').concat(info2.parentType.name, ".").concat(info2.fieldName, '" with ') + "value ".concat((0, _inspect.default)(result), ', received "').concat((0, _inspect.default)(runtimeTypeOrName), '".'));
9654
+ throw new _GraphQLError.GraphQLError('Abstract type "'.concat(returnType.name, '" must resolve to an Object type at runtime for field "').concat(info.parentType.name, ".").concat(info.fieldName, '" with ') + "value ".concat((0, _inspect.default)(result), ', received "').concat((0, _inspect.default)(runtimeTypeOrName), '".'));
9655
9655
  }
9656
9656
  var runtimeType = exeContext.schema.getType(runtimeTypeName);
9657
9657
  if (runtimeType == null) {
@@ -9665,9 +9665,9 @@ var require_execute = __commonJS({
9665
9665
  }
9666
9666
  return runtimeType;
9667
9667
  }
9668
- function completeObjectValue(exeContext, returnType, fieldNodes, info2, path2, result) {
9668
+ function completeObjectValue(exeContext, returnType, fieldNodes, info, path2, result) {
9669
9669
  if (returnType.isTypeOf) {
9670
- var isTypeOf = returnType.isTypeOf(result, exeContext.contextValue, info2);
9670
+ var isTypeOf = returnType.isTypeOf(result, exeContext.contextValue, info);
9671
9671
  if ((0, _isPromise.default)(isTypeOf)) {
9672
9672
  return isTypeOf.then(function(resolvedIsTypeOf) {
9673
9673
  if (!resolvedIsTypeOf) {
@@ -9701,16 +9701,16 @@ var require_execute = __commonJS({
9701
9701
  }
9702
9702
  return subFieldNodes;
9703
9703
  }
9704
- var defaultTypeResolver = function defaultTypeResolver2(value, contextValue, info2, abstractType) {
9704
+ var defaultTypeResolver = function defaultTypeResolver2(value, contextValue, info, abstractType) {
9705
9705
  if ((0, _isObjectLike.default)(value) && typeof value.__typename === "string") {
9706
9706
  return value.__typename;
9707
9707
  }
9708
- var possibleTypes = info2.schema.getPossibleTypes(abstractType);
9708
+ var possibleTypes = info.schema.getPossibleTypes(abstractType);
9709
9709
  var promisedIsTypeOfResults = [];
9710
9710
  for (var i = 0; i < possibleTypes.length; i++) {
9711
9711
  var type = possibleTypes[i];
9712
9712
  if (type.isTypeOf) {
9713
- var isTypeOfResult = type.isTypeOf(value, contextValue, info2);
9713
+ var isTypeOfResult = type.isTypeOf(value, contextValue, info);
9714
9714
  if ((0, _isPromise.default)(isTypeOfResult)) {
9715
9715
  promisedIsTypeOfResults[i] = isTypeOfResult;
9716
9716
  } else if (isTypeOfResult) {
@@ -9729,11 +9729,11 @@ var require_execute = __commonJS({
9729
9729
  }
9730
9730
  };
9731
9731
  exports.defaultTypeResolver = defaultTypeResolver;
9732
- var defaultFieldResolver = function defaultFieldResolver2(source, args, contextValue, info2) {
9732
+ var defaultFieldResolver = function defaultFieldResolver2(source, args, contextValue, info) {
9733
9733
  if ((0, _isObjectLike.default)(source) || typeof source === "function") {
9734
- var property = source[info2.fieldName];
9734
+ var property = source[info.fieldName];
9735
9735
  if (typeof property === "function") {
9736
- return source[info2.fieldName](args, contextValue, info2);
9736
+ return source[info.fieldName](args, contextValue, info);
9737
9737
  }
9738
9738
  return property;
9739
9739
  }
@@ -9759,7 +9759,7 @@ var require_graphql = __commonJS({
9759
9759
  Object.defineProperty(exports, "__esModule", {
9760
9760
  value: true
9761
9761
  });
9762
- exports.graphql = graphql27;
9762
+ exports.graphql = graphql26;
9763
9763
  exports.graphqlSync = graphqlSync;
9764
9764
  var _isPromise = _interopRequireDefault(require_isPromise());
9765
9765
  var _parser = require_parser();
@@ -9769,7 +9769,7 @@ var require_graphql = __commonJS({
9769
9769
  function _interopRequireDefault(obj) {
9770
9770
  return obj && obj.__esModule ? obj : { default: obj };
9771
9771
  }
9772
- function graphql27(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) {
9772
+ function graphql26(argsOrSchema, source, rootValue, contextValue, variableValues, operationName, fieldResolver, typeResolver) {
9773
9773
  var _arguments = arguments;
9774
9774
  return new Promise(function(resolve2) {
9775
9775
  return resolve2(
@@ -10753,13 +10753,13 @@ var require_subscribe = __commonJS({
10753
10753
  throw new _GraphQLError.GraphQLError('The subscription field "'.concat(fieldName, '" is not defined.'), fieldNodes);
10754
10754
  }
10755
10755
  var path2 = (0, _Path.addPath)(void 0, responseName, type.name);
10756
- var info2 = (0, _execute.buildResolveInfo)(exeContext, fieldDef, fieldNodes, type, path2);
10756
+ var info = (0, _execute.buildResolveInfo)(exeContext, fieldDef, fieldNodes, type, path2);
10757
10757
  return new Promise(function(resolveResult) {
10758
10758
  var _fieldDef$subscribe;
10759
10759
  var args = (0, _values.getArgumentValues)(fieldDef, fieldNodes[0], variableValues);
10760
10760
  var contextValue = exeContext.contextValue;
10761
10761
  var resolveFn = (_fieldDef$subscribe = fieldDef.subscribe) !== null && _fieldDef$subscribe !== void 0 ? _fieldDef$subscribe : exeContext.fieldResolver;
10762
- resolveResult(resolveFn(rootValue, args, contextValue, info2));
10762
+ resolveResult(resolveFn(rootValue, args, contextValue, info));
10763
10763
  }).then(function(eventStream) {
10764
10764
  if (eventStream instanceof Error) {
10765
10765
  throw (0, _locatedError.locatedError)(eventStream, fieldNodes, (0, _Path.pathToArray)(path2));
@@ -20567,42 +20567,42 @@ var require_node = __commonJS({
20567
20567
  return Link2;
20568
20568
  }(events_1.EventEmitter);
20569
20569
  exports.Link = Link;
20570
- var File2 = function() {
20571
- function File3(link, node, flags, fd) {
20570
+ var File = function() {
20571
+ function File2(link, node, flags, fd) {
20572
20572
  this.position = 0;
20573
20573
  this.link = link;
20574
20574
  this.node = node;
20575
20575
  this.flags = flags;
20576
20576
  this.fd = fd;
20577
20577
  }
20578
- File3.prototype.getString = function(encoding) {
20578
+ File2.prototype.getString = function(encoding) {
20579
20579
  if (encoding === void 0) {
20580
20580
  encoding = "utf8";
20581
20581
  }
20582
20582
  return this.node.getString();
20583
20583
  };
20584
- File3.prototype.setString = function(str) {
20584
+ File2.prototype.setString = function(str) {
20585
20585
  this.node.setString(str);
20586
20586
  };
20587
- File3.prototype.getBuffer = function() {
20587
+ File2.prototype.getBuffer = function() {
20588
20588
  return this.node.getBuffer();
20589
20589
  };
20590
- File3.prototype.setBuffer = function(buf) {
20590
+ File2.prototype.setBuffer = function(buf) {
20591
20591
  this.node.setBuffer(buf);
20592
20592
  };
20593
- File3.prototype.getSize = function() {
20593
+ File2.prototype.getSize = function() {
20594
20594
  return this.node.getSize();
20595
20595
  };
20596
- File3.prototype.truncate = function(len) {
20596
+ File2.prototype.truncate = function(len) {
20597
20597
  this.node.truncate(len);
20598
20598
  };
20599
- File3.prototype.seekTo = function(position) {
20599
+ File2.prototype.seekTo = function(position) {
20600
20600
  this.position = position;
20601
20601
  };
20602
- File3.prototype.stats = function() {
20602
+ File2.prototype.stats = function() {
20603
20603
  return Stats_1.default.build(this.node);
20604
20604
  };
20605
- File3.prototype.write = function(buf, offset, length, position) {
20605
+ File2.prototype.write = function(buf, offset, length, position) {
20606
20606
  if (offset === void 0) {
20607
20607
  offset = 0;
20608
20608
  }
@@ -20617,7 +20617,7 @@ var require_node = __commonJS({
20617
20617
  this.position = position + bytes;
20618
20618
  return bytes;
20619
20619
  };
20620
- File3.prototype.read = function(buf, offset, length, position) {
20620
+ File2.prototype.read = function(buf, offset, length, position) {
20621
20621
  if (offset === void 0) {
20622
20622
  offset = 0;
20623
20623
  }
@@ -20630,15 +20630,15 @@ var require_node = __commonJS({
20630
20630
  this.position = position + bytes;
20631
20631
  return bytes;
20632
20632
  };
20633
- File3.prototype.chmod = function(perm) {
20633
+ File2.prototype.chmod = function(perm) {
20634
20634
  this.node.chmod(perm);
20635
20635
  };
20636
- File3.prototype.chown = function(uid, gid) {
20636
+ File2.prototype.chown = function(uid, gid) {
20637
20637
  this.node.chown(uid, gid);
20638
20638
  };
20639
- return File3;
20639
+ return File2;
20640
20640
  }();
20641
- exports.File = File2;
20641
+ exports.File = File;
20642
20642
  }
20643
20643
  });
20644
20644
 
@@ -50026,18 +50026,18 @@ var require_lines = __commonJS({
50026
50026
  assert_1.default.strictEqual(typeof pos, "object");
50027
50027
  assert_1.default.strictEqual(typeof pos.line, "number");
50028
50028
  assert_1.default.strictEqual(typeof pos.column, "number");
50029
- var line = pos.line, column = pos.column, secret = this, infos = secret.infos, info2 = infos[line - 1], c = column;
50030
- if (typeof info2 === "undefined" || c < 0)
50029
+ var line = pos.line, column = pos.column, secret = this, infos = secret.infos, info = infos[line - 1], c = column;
50030
+ if (typeof info === "undefined" || c < 0)
50031
50031
  return "";
50032
50032
  var indent = this.getIndentAt(line);
50033
50033
  if (c < indent)
50034
50034
  return " ";
50035
- c += info2.sliceStart - indent;
50036
- if (c === info2.sliceEnd && line < this.length)
50035
+ c += info.sliceStart - indent;
50036
+ if (c === info.sliceEnd && line < this.length)
50037
50037
  return "\n";
50038
- if (c >= info2.sliceEnd)
50038
+ if (c >= info.sliceEnd)
50039
50039
  return "";
50040
- return info2.line.charAt(c);
50040
+ return info.line.charAt(c);
50041
50041
  };
50042
50042
  Lines2.prototype.stripMargin = function(width, skipFirstLine) {
50043
50043
  if (width === 0)
@@ -50045,11 +50045,11 @@ var require_lines = __commonJS({
50045
50045
  assert_1.default.ok(width > 0, "negative margin: " + width);
50046
50046
  if (skipFirstLine && this.length === 1)
50047
50047
  return this;
50048
- var lines = new Lines2(this.infos.map(function(info2, i) {
50049
- if (info2.line && (i > 0 || !skipFirstLine)) {
50050
- info2 = tslib_1.__assign(tslib_1.__assign({}, info2), { indent: Math.max(0, info2.indent - width) });
50048
+ var lines = new Lines2(this.infos.map(function(info, i) {
50049
+ if (info.line && (i > 0 || !skipFirstLine)) {
50050
+ info = tslib_1.__assign(tslib_1.__assign({}, info), { indent: Math.max(0, info.indent - width) });
50051
50051
  }
50052
- return info2;
50052
+ return info;
50053
50053
  }));
50054
50054
  if (this.mappings.length > 0) {
50055
50055
  var newMappings_1 = lines.mappings;
@@ -50064,11 +50064,11 @@ var require_lines = __commonJS({
50064
50064
  if (by === 0) {
50065
50065
  return this;
50066
50066
  }
50067
- var lines = new Lines2(this.infos.map(function(info2) {
50068
- if (info2.line && !info2.locked) {
50069
- info2 = tslib_1.__assign(tslib_1.__assign({}, info2), { indent: info2.indent + by });
50067
+ var lines = new Lines2(this.infos.map(function(info) {
50068
+ if (info.line && !info.locked) {
50069
+ info = tslib_1.__assign(tslib_1.__assign({}, info), { indent: info.indent + by });
50070
50070
  }
50071
- return info2;
50071
+ return info;
50072
50072
  }));
50073
50073
  if (this.mappings.length > 0) {
50074
50074
  var newMappings_2 = lines.mappings;
@@ -50086,11 +50086,11 @@ var require_lines = __commonJS({
50086
50086
  if (this.length < 2) {
50087
50087
  return this;
50088
50088
  }
50089
- var lines = new Lines2(this.infos.map(function(info2, i) {
50090
- if (i > 0 && info2.line && !info2.locked) {
50091
- info2 = tslib_1.__assign(tslib_1.__assign({}, info2), { indent: info2.indent + by });
50089
+ var lines = new Lines2(this.infos.map(function(info, i) {
50090
+ if (i > 0 && info.line && !info.locked) {
50091
+ info = tslib_1.__assign(tslib_1.__assign({}, info), { indent: info.indent + by });
50092
50092
  }
50093
- return info2;
50093
+ return info;
50094
50094
  }));
50095
50095
  if (this.mappings.length > 0) {
50096
50096
  var newMappings_3 = lines.mappings;
@@ -50105,8 +50105,8 @@ var require_lines = __commonJS({
50105
50105
  if (this.length < 2) {
50106
50106
  return this;
50107
50107
  }
50108
- return new Lines2(this.infos.map(function(info2, i) {
50109
- return tslib_1.__assign(tslib_1.__assign({}, info2), { locked: i > 0 });
50108
+ return new Lines2(this.infos.map(function(info, i) {
50109
+ return tslib_1.__assign(tslib_1.__assign({}, info), { locked: i > 0 });
50110
50110
  }));
50111
50111
  };
50112
50112
  Lines2.prototype.getIndentAt = function(line) {
@@ -50120,14 +50120,14 @@ var require_lines = __commonJS({
50120
50120
  var counts = [];
50121
50121
  var lastIndent = 0;
50122
50122
  for (var line = 1, last = this.length; line <= last; ++line) {
50123
- var info2 = this.infos[line - 1];
50124
- var sliced = info2.line.slice(info2.sliceStart, info2.sliceEnd);
50123
+ var info = this.infos[line - 1];
50124
+ var sliced = info.line.slice(info.sliceStart, info.sliceEnd);
50125
50125
  if (isOnlyWhitespace(sliced)) {
50126
50126
  continue;
50127
50127
  }
50128
- var diff = Math.abs(info2.indent - lastIndent);
50128
+ var diff = Math.abs(info.indent - lastIndent);
50129
50129
  counts[diff] = ~~counts[diff] + 1;
50130
- lastIndent = info2.indent;
50130
+ lastIndent = info.indent;
50131
50131
  }
50132
50132
  var maxCount = -1;
50133
50133
  var result = 2;
@@ -50150,20 +50150,20 @@ var require_lines = __commonJS({
50150
50150
  return isOnlyWhitespace(this.toString());
50151
50151
  };
50152
50152
  Lines2.prototype.isPrecededOnlyByWhitespace = function(pos) {
50153
- var info2 = this.infos[pos.line - 1];
50154
- var indent = Math.max(info2.indent, 0);
50153
+ var info = this.infos[pos.line - 1];
50154
+ var indent = Math.max(info.indent, 0);
50155
50155
  var diff = pos.column - indent;
50156
50156
  if (diff <= 0) {
50157
50157
  return true;
50158
50158
  }
50159
- var start = info2.sliceStart;
50160
- var end = Math.min(start + diff, info2.sliceEnd);
50161
- var prefix = info2.line.slice(start, end);
50159
+ var start = info.sliceStart;
50160
+ var end = Math.min(start + diff, info.sliceEnd);
50161
+ var prefix = info.line.slice(start, end);
50162
50162
  return isOnlyWhitespace(prefix);
50163
50163
  };
50164
50164
  Lines2.prototype.getLineLength = function(line) {
50165
- var info2 = this.infos[line - 1];
50166
- return this.getIndentAt(line) + info2.sliceEnd - info2.sliceStart;
50165
+ var info = this.infos[line - 1];
50166
+ return this.getIndentAt(line) + info.sliceEnd - info.sliceStart;
50167
50167
  };
50168
50168
  Lines2.prototype.nextPos = function(pos, skipSpaces) {
50169
50169
  if (skipSpaces === void 0) {
@@ -50329,20 +50329,20 @@ var require_lines = __commonJS({
50329
50329
  var _a = (0, options_1.normalize)(options), tabWidth = _a.tabWidth, useTabs = _a.useTabs, reuseWhitespace = _a.reuseWhitespace, lineTerminator = _a.lineTerminator;
50330
50330
  var parts = [];
50331
50331
  for (var line = start.line; line <= end.line; ++line) {
50332
- var info2 = this.infos[line - 1];
50332
+ var info = this.infos[line - 1];
50333
50333
  if (line === start.line) {
50334
50334
  if (line === end.line) {
50335
- info2 = sliceInfo(info2, start.column, end.column);
50335
+ info = sliceInfo(info, start.column, end.column);
50336
50336
  } else {
50337
- info2 = sliceInfo(info2, start.column);
50337
+ info = sliceInfo(info, start.column);
50338
50338
  }
50339
50339
  } else if (line === end.line) {
50340
- info2 = sliceInfo(info2, 0, end.column);
50340
+ info = sliceInfo(info, 0, end.column);
50341
50341
  }
50342
- var indent = Math.max(info2.indent, 0);
50343
- var before_1 = info2.line.slice(0, info2.sliceStart);
50342
+ var indent = Math.max(info.indent, 0);
50343
+ var before_1 = info.line.slice(0, info.sliceStart);
50344
50344
  if (reuseWhitespace && isOnlyWhitespace(before_1) && countSpaces(before_1, tabWidth) === indent) {
50345
- parts.push(info2.line.slice(0, info2.sliceEnd));
50345
+ parts.push(info.line.slice(0, info.sliceEnd));
50346
50346
  continue;
50347
50347
  }
50348
50348
  var tabs = 0;
@@ -50358,7 +50358,7 @@ var require_lines = __commonJS({
50358
50358
  if (spaces > 0) {
50359
50359
  result += new Array(spaces + 1).join(" ");
50360
50360
  }
50361
- result += info2.line.slice(info2.sliceStart, info2.sliceEnd);
50361
+ result += info.line.slice(info.sliceStart, info.sliceEnd);
50362
50362
  parts.push(result);
50363
50363
  }
50364
50364
  return parts.join(lineTerminator);
@@ -50376,12 +50376,12 @@ var require_lines = __commonJS({
50376
50376
  return;
50377
50377
  }
50378
50378
  if (prevInfo) {
50379
- var info2 = linesOrNull.infos[0];
50380
- var indent = new Array(info2.indent + 1).join(" ");
50379
+ var info = linesOrNull.infos[0];
50380
+ var indent = new Array(info.indent + 1).join(" ");
50381
50381
  var prevLine_1 = infos.length;
50382
50382
  var prevColumn_1 = Math.max(prevInfo.indent, 0) + prevInfo.sliceEnd - prevInfo.sliceStart;
50383
- prevInfo.line = prevInfo.line.slice(0, prevInfo.sliceEnd) + indent + info2.line.slice(info2.sliceStart, info2.sliceEnd);
50384
- prevInfo.locked = prevInfo.locked || info2.locked;
50383
+ prevInfo.line = prevInfo.line.slice(0, prevInfo.sliceEnd) + indent + info.line.slice(info.sliceStart, info.sliceEnd);
50384
+ prevInfo.locked = prevInfo.locked || info.locked;
50385
50385
  prevInfo.sliceEnd = prevInfo.line.length;
50386
50386
  if (linesOrNull.mappings.length > 0) {
50387
50387
  linesOrNull.mappings.forEach(function(mapping) {
@@ -50391,9 +50391,9 @@ var require_lines = __commonJS({
50391
50391
  } else if (linesOrNull.mappings.length > 0) {
50392
50392
  mappings.push.apply(mappings, linesOrNull.mappings);
50393
50393
  }
50394
- linesOrNull.infos.forEach(function(info3, i) {
50394
+ linesOrNull.infos.forEach(function(info2, i) {
50395
50395
  if (!prevInfo || i > 0) {
50396
- prevInfo = tslib_1.__assign({}, info3);
50396
+ prevInfo = tslib_1.__assign({}, info2);
50397
50397
  infos.push(prevInfo);
50398
50398
  }
50399
50399
  });
@@ -50497,10 +50497,10 @@ var require_lines = __commonJS({
50497
50497
  function isOnlyWhitespace(string) {
50498
50498
  return !/\S/.test(string);
50499
50499
  }
50500
- function sliceInfo(info2, startCol, endCol) {
50501
- var sliceStart = info2.sliceStart;
50502
- var sliceEnd = info2.sliceEnd;
50503
- var indent = Math.max(info2.indent, 0);
50500
+ function sliceInfo(info, startCol, endCol) {
50501
+ var sliceStart = info.sliceStart;
50502
+ var sliceEnd = info.sliceEnd;
50503
+ var indent = Math.max(info.indent, 0);
50504
50504
  var lineLength = indent + sliceEnd - sliceStart;
50505
50505
  if (typeof endCol === "undefined") {
50506
50506
  endCol = lineLength;
@@ -50526,11 +50526,11 @@ var require_lines = __commonJS({
50526
50526
  assert_1.default.ok(indent >= 0);
50527
50527
  assert_1.default.ok(sliceStart <= sliceEnd);
50528
50528
  assert_1.default.strictEqual(lineLength, indent + sliceEnd - sliceStart);
50529
- if (info2.indent === indent && info2.sliceStart === sliceStart && info2.sliceEnd === sliceEnd) {
50530
- return info2;
50529
+ if (info.indent === indent && info.sliceStart === sliceStart && info.sliceEnd === sliceEnd) {
50530
+ return info;
50531
50531
  }
50532
50532
  return {
50533
- line: info2.line,
50533
+ line: info.line,
50534
50534
  indent,
50535
50535
  locked: false,
50536
50536
  sliceStart,
@@ -53537,9 +53537,9 @@ var require_printer2 = __commonJS({
53537
53537
  var prevTrailingSpace = null;
53538
53538
  var len = filtered.length;
53539
53539
  var parts = [];
53540
- filtered.forEach(function(info2, i) {
53541
- var printed = info2.printed;
53542
- var stmt = info2.node;
53540
+ filtered.forEach(function(info, i) {
53541
+ var printed = info.printed;
53542
+ var stmt = info.node;
53543
53543
  var multiLine = printed.length > 1;
53544
53544
  var notFirst = i > 0;
53545
53545
  var notLast = i < len - 1;
@@ -53938,7 +53938,7 @@ var require_main2 = __commonJS({
53938
53938
  });
53939
53939
 
53940
53940
  // src/codegen/index.ts
53941
- var graphql26 = __toESM(require_graphql2(), 1);
53941
+ var graphql25 = __toESM(require_graphql2(), 1);
53942
53942
 
53943
53943
  // src/lib/pipeline.ts
53944
53944
  async function runPipeline(config2, pipeline, target) {
@@ -53952,1746 +53952,9 @@ var import_minimatch = __toESM(require_minimatch(), 1);
53952
53952
  import { fileURLToPath, pathToFileURL } from "url";
53953
53953
 
53954
53954
  // src/runtime/lib/config.ts
53955
- function defaultConfigValues(file) {
53956
- return {
53957
- defaultKeys: ["id"],
53958
- ...file,
53959
- types: {
53960
- Node: {
53961
- keys: ["id"],
53962
- resolve: {
53963
- queryField: "node",
53964
- arguments: (node) => ({ id: node.id })
53965
- }
53966
- },
53967
- ...file.types
53968
- }
53969
- };
53970
- }
53971
53955
  function keyFieldsForType(configFile, type) {
53972
53956
  return configFile.types?.[type]?.keys || configFile.defaultKeys;
53973
53957
  }
53974
- function computeID(configFile, type, data) {
53975
- const fields = keyFieldsForType(configFile, type);
53976
- let id = "";
53977
- for (const field of fields) {
53978
- id += data[field] + "__";
53979
- }
53980
- return id.slice(0, -2);
53981
- }
53982
-
53983
- // src/runtime/lib/deepEquals.ts
53984
- function deepEquals(objA, objB, map = /* @__PURE__ */ new WeakMap()) {
53985
- if (Object.is(objA, objB))
53986
- return true;
53987
- if (objA instanceof Date && objB instanceof Date) {
53988
- return objA.getTime() === objB.getTime();
53989
- }
53990
- if (objA instanceof RegExp && objB instanceof RegExp) {
53991
- return objA.toString() === objB.toString();
53992
- }
53993
- if (typeof objA !== "object" || objA === null || typeof objB !== "object" || objB === null) {
53994
- return false;
53995
- }
53996
- if (map.get(objA) === objB)
53997
- return true;
53998
- map.set(objA, objB);
53999
- const keysA = Reflect.ownKeys(objA);
54000
- const keysB = Reflect.ownKeys(objB);
54001
- if (keysA.length !== keysB.length) {
54002
- return false;
54003
- }
54004
- for (let i = 0; i < keysA.length; i++) {
54005
- if (!Reflect.has(objB, keysA[i]) || !deepEquals(objA[keysA[i]], objB[keysA[i]], map)) {
54006
- return false;
54007
- }
54008
- }
54009
- return true;
54010
- }
54011
-
54012
- // src/runtime/lib/selection.ts
54013
- function getFieldsForType(selection2, __typename) {
54014
- let targetSelection = selection2.fields || {};
54015
- if (selection2.abstractFields && __typename) {
54016
- const mappedType = selection2.abstractFields.typeMap[__typename];
54017
- if (mappedType) {
54018
- targetSelection = selection2.abstractFields.fields[mappedType];
54019
- } else if (selection2.abstractFields.fields[__typename]) {
54020
- targetSelection = selection2.abstractFields.fields[__typename];
54021
- }
54022
- }
54023
- return targetSelection;
54024
- }
54025
-
54026
- // src/runtime/cache/gc.ts
54027
- var GarbageCollector = class {
54028
- cache;
54029
- lifetimes = /* @__PURE__ */ new Map();
54030
- get cacheBufferSize() {
54031
- return this.cache._internal_unstable.config.cacheBufferSize ?? 10;
54032
- }
54033
- constructor(cache) {
54034
- this.cache = cache;
54035
- }
54036
- resetLifetime(id, field) {
54037
- if (!this.lifetimes.get(id)) {
54038
- this.lifetimes.set(id, /* @__PURE__ */ new Map());
54039
- }
54040
- this.lifetimes.get(id).set(field, 0);
54041
- }
54042
- tick() {
54043
- for (const [id, fieldMap] of this.lifetimes.entries()) {
54044
- for (const [field, lifetime] of fieldMap.entries()) {
54045
- if (this.cache._internal_unstable.subscriptions.get(id, field).length > 0) {
54046
- continue;
54047
- }
54048
- fieldMap.set(field, lifetime + 1);
54049
- if (fieldMap.get(field) > this.cacheBufferSize) {
54050
- this.cache._internal_unstable.storage.deleteField(id, field);
54051
- this.cache._internal_unstable.lists.deleteField(id, field);
54052
- fieldMap.delete(field);
54053
- if ([...fieldMap.keys()].length === 0) {
54054
- this.lifetimes.delete(id);
54055
- }
54056
- }
54057
- }
54058
- }
54059
- }
54060
- };
54061
-
54062
- // src/runtime/cache/stuff.ts
54063
- function flattenList(source) {
54064
- const flat = [];
54065
- const unvisited = [source || []];
54066
- while (unvisited.length > 0) {
54067
- const target = unvisited.shift();
54068
- for (const id of target) {
54069
- if (Array.isArray(id)) {
54070
- unvisited.push(id);
54071
- continue;
54072
- }
54073
- flat.push(id);
54074
- }
54075
- }
54076
- return flat;
54077
- }
54078
- function evaluateKey(key, variables = {}) {
54079
- let evaluated = "";
54080
- let varName = "";
54081
- let inString = false;
54082
- for (const char of key) {
54083
- if (varName) {
54084
- if (varChars.includes(char)) {
54085
- varName += char;
54086
- continue;
54087
- }
54088
- const value = variables[varName.slice(1)];
54089
- evaluated += typeof value !== "undefined" ? JSON.stringify(value) : "undefined";
54090
- varName = "";
54091
- }
54092
- if (char === "$" && !inString) {
54093
- varName = "$";
54094
- continue;
54095
- }
54096
- if (char === '"') {
54097
- inString = !inString;
54098
- }
54099
- evaluated += char;
54100
- }
54101
- return evaluated;
54102
- }
54103
- var varChars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ_0123456789";
54104
-
54105
- // src/runtime/cache/lists.ts
54106
- var ListManager = class {
54107
- rootID;
54108
- cache;
54109
- constructor(cache, rootID2) {
54110
- this.rootID = rootID2;
54111
- this.cache = cache;
54112
- }
54113
- lists = /* @__PURE__ */ new Map();
54114
- listsByField = /* @__PURE__ */ new Map();
54115
- get(listName, id, allLists) {
54116
- const matches = this.lists.get(listName);
54117
- if (!matches || matches.size === 0) {
54118
- return null;
54119
- }
54120
- if (allLists) {
54121
- return new ListCollection(
54122
- Array.from(matches, ([key, value]) => [...value.lists]).flat()
54123
- );
54124
- }
54125
- const head = [...matches.values()][0];
54126
- const { recordType } = head.lists[0];
54127
- const parentID = id ? this.cache._internal_unstable.id(recordType || "", id) : this.rootID;
54128
- if (matches?.size === 1) {
54129
- if (!id) {
54130
- return head;
54131
- }
54132
- return parentID === Array.from(matches.keys())[0] ? head : null;
54133
- }
54134
- if (!id) {
54135
- console.error(
54136
- `Found multiple instances of "${listName}". Please provide one of @parentID or @allLists directives to help identify which list you want modify. For more information, visit this guide: https://www.houdinigraphql.com/api/graphql#parentidvalue-string `
54137
- );
54138
- return null;
54139
- }
54140
- return this.lists.get(listName)?.get(parentID);
54141
- }
54142
- remove(listName, id) {
54143
- this.lists.get(listName)?.delete(id || this.rootID);
54144
- }
54145
- add(list) {
54146
- if (!this.lists.has(list.name)) {
54147
- this.lists.set(list.name, /* @__PURE__ */ new Map());
54148
- }
54149
- const name2 = list.name;
54150
- const parentID = list.recordID || this.rootID;
54151
- if (this.lists.get(name2)?.get(parentID)?.includes(list.key)) {
54152
- return;
54153
- }
54154
- if (!this.lists.has(name2)) {
54155
- this.lists.set(name2, /* @__PURE__ */ new Map());
54156
- }
54157
- if (!this.lists.get(name2).has(parentID)) {
54158
- this.lists.get(name2).set(parentID, new ListCollection([]));
54159
- }
54160
- if (!this.listsByField.has(parentID)) {
54161
- this.listsByField.set(parentID, /* @__PURE__ */ new Map());
54162
- }
54163
- if (!this.listsByField.get(parentID).has(list.key)) {
54164
- this.listsByField.get(parentID)?.set(list.key, []);
54165
- }
54166
- const handler = new List({ ...list, manager: this });
54167
- this.lists.get(list.name).get(parentID).lists.push(handler);
54168
- this.listsByField.get(parentID).get(list.key).push(handler);
54169
- }
54170
- removeIDFromAllLists(id) {
54171
- for (const fieldMap of this.lists.values()) {
54172
- for (const list of fieldMap.values()) {
54173
- list.removeID(id);
54174
- }
54175
- }
54176
- }
54177
- deleteField(parentID, field) {
54178
- if (!this.listsByField.get(parentID)?.has(field)) {
54179
- return;
54180
- }
54181
- for (const list of this.listsByField.get(parentID).get(field)) {
54182
- this.lists.get(list.name)?.get(list.recordID)?.deleteListWithKey(field);
54183
- if (this.lists.get(list.name)?.get(list.recordID)?.lists.length === 0) {
54184
- this.lists.get(list.name)?.delete(list.recordID);
54185
- }
54186
- }
54187
- this.listsByField.get(parentID).delete(field);
54188
- }
54189
- };
54190
- var List = class {
54191
- recordID;
54192
- recordType;
54193
- key;
54194
- type;
54195
- cache;
54196
- selection;
54197
- _when;
54198
- filters;
54199
- name;
54200
- connection;
54201
- manager;
54202
- abstract;
54203
- constructor({
54204
- name: name2,
54205
- recordID,
54206
- recordType,
54207
- key,
54208
- listType,
54209
- selection: selection2,
54210
- when,
54211
- filters,
54212
- connection,
54213
- manager,
54214
- abstract
54215
- }) {
54216
- this.recordID = recordID || rootID;
54217
- this.recordType = recordType;
54218
- this.key = key;
54219
- this.type = listType;
54220
- this.cache = manager.cache;
54221
- this.selection = selection2;
54222
- this._when = when;
54223
- this.filters = filters;
54224
- this.name = name2;
54225
- this.connection = connection;
54226
- this.manager = manager;
54227
- this.abstract = abstract;
54228
- }
54229
- when(when) {
54230
- return this.manager.lists.get(this.name).get(this.recordID).when(when);
54231
- }
54232
- append(selection2, data, variables = {}) {
54233
- return this.addToList(selection2, data, variables, "last");
54234
- }
54235
- prepend(selection2, data, variables = {}) {
54236
- return this.addToList(selection2, data, variables, "first");
54237
- }
54238
- addToList(selection2, data, variables = {}, where) {
54239
- const listType = this.listType(data);
54240
- const dataID = this.cache._internal_unstable.id(listType, data);
54241
- if (!this.validateWhen() || !dataID) {
54242
- return;
54243
- }
54244
- let insertSelection = selection2;
54245
- let insertData = data;
54246
- if (this.connection) {
54247
- insertSelection = {
54248
- fields: {
54249
- newEntry: {
54250
- keyRaw: this.key,
54251
- type: "Connection",
54252
- selection: {
54253
- fields: {
54254
- edges: {
54255
- keyRaw: "edges",
54256
- type: "ConnectionEdge",
54257
- update: where === "first" ? "prepend" : "append",
54258
- selection: {
54259
- fields: {
54260
- node: {
54261
- type: listType,
54262
- keyRaw: "node",
54263
- selection: {
54264
- ...selection2,
54265
- fields: {
54266
- ...selection2.fields,
54267
- __typename: {
54268
- keyRaw: "__typename",
54269
- type: "String"
54270
- }
54271
- }
54272
- }
54273
- }
54274
- }
54275
- }
54276
- }
54277
- }
54278
- }
54279
- }
54280
- }
54281
- };
54282
- insertData = {
54283
- newEntry: {
54284
- edges: [{ node: { ...data, __typename: listType } }]
54285
- }
54286
- };
54287
- } else {
54288
- insertSelection = {
54289
- fields: {
54290
- newEntries: {
54291
- keyRaw: this.key,
54292
- type: listType,
54293
- update: where === "first" ? "prepend" : "append",
54294
- selection: {
54295
- ...selection2,
54296
- fields: {
54297
- ...selection2.fields,
54298
- __typename: {
54299
- keyRaw: "__typename",
54300
- type: "String"
54301
- }
54302
- }
54303
- }
54304
- }
54305
- }
54306
- };
54307
- insertData = {
54308
- newEntries: [{ ...data, __typename: listType }]
54309
- };
54310
- }
54311
- this.cache.write({
54312
- selection: insertSelection,
54313
- data: insertData,
54314
- variables,
54315
- parent: this.recordID,
54316
- applyUpdates: true
54317
- });
54318
- }
54319
- removeID(id, variables = {}) {
54320
- if (!this.validateWhen()) {
54321
- return;
54322
- }
54323
- let parentID = this.recordID;
54324
- let targetID = id;
54325
- let targetKey = this.key;
54326
- if (this.connection) {
54327
- const { value: embeddedConnection } = this.cache._internal_unstable.storage.get(
54328
- this.recordID,
54329
- this.key
54330
- );
54331
- if (!embeddedConnection) {
54332
- return;
54333
- }
54334
- const embeddedConnectionID = embeddedConnection;
54335
- const { value: edges } = this.cache._internal_unstable.storage.get(
54336
- embeddedConnectionID,
54337
- "edges"
54338
- );
54339
- for (const edge of flattenList(edges) || []) {
54340
- if (!edge) {
54341
- continue;
54342
- }
54343
- const edgeID = edge;
54344
- const { value: nodeID } = this.cache._internal_unstable.storage.get(edgeID, "node");
54345
- if (!nodeID) {
54346
- continue;
54347
- }
54348
- if (nodeID === id) {
54349
- targetID = edgeID;
54350
- }
54351
- }
54352
- parentID = embeddedConnectionID;
54353
- targetKey = "edges";
54354
- }
54355
- let value = this.cache._internal_unstable.storage.get(parentID, targetKey).value;
54356
- if (!value || !value.includes(targetID)) {
54357
- return;
54358
- }
54359
- const subscribers = this.cache._internal_unstable.subscriptions.get(this.recordID, this.key);
54360
- this.cache._internal_unstable.subscriptions.remove(
54361
- targetID,
54362
- this.connection ? this.selection.fields.edges.selection : this.selection,
54363
- subscribers,
54364
- variables
54365
- );
54366
- this.cache._internal_unstable.storage.remove(parentID, targetKey, targetID);
54367
- for (const spec of subscribers) {
54368
- spec.set(
54369
- this.cache._internal_unstable.getSelection({
54370
- parent: spec.parentID || this.manager.rootID,
54371
- selection: spec.selection,
54372
- variables: spec.variables?.() || {}
54373
- }).data
54374
- );
54375
- }
54376
- return true;
54377
- }
54378
- remove(data, variables = {}) {
54379
- const targetID = this.cache._internal_unstable.id(this.listType(data), data);
54380
- if (!targetID) {
54381
- return;
54382
- }
54383
- return this.removeID(targetID, variables);
54384
- }
54385
- listType(data) {
54386
- return data.__typename || this.type;
54387
- }
54388
- validateWhen(when) {
54389
- let filters = when || this._when;
54390
- let ok = true;
54391
- if (filters) {
54392
- const targets = this.filters;
54393
- if (filters.must && targets) {
54394
- ok = Object.entries(filters.must).reduce(
54395
- (prev, [key, value]) => Boolean(prev && targets[key] == value),
54396
- ok
54397
- );
54398
- }
54399
- if (filters.must_not) {
54400
- ok = !targets || Object.entries(filters.must_not).reduce(
54401
- (prev, [key, value]) => Boolean(prev && targets[key] != value),
54402
- ok
54403
- );
54404
- }
54405
- }
54406
- return ok;
54407
- }
54408
- toggleElement(selection2, data, variables = {}, where) {
54409
- if (!this.remove(data, variables)) {
54410
- this.addToList(selection2, data, variables, where);
54411
- }
54412
- }
54413
- *[Symbol.iterator]() {
54414
- let entries = [];
54415
- let value = this.cache._internal_unstable.storage.get(this.recordID, this.key).value;
54416
- if (!this.connection) {
54417
- entries = flattenList(value);
54418
- } else {
54419
- entries = this.cache._internal_unstable.storage.get(value, "edges").value;
54420
- }
54421
- for (let record2 of entries) {
54422
- yield record2;
54423
- }
54424
- }
54425
- };
54426
- var ListCollection = class {
54427
- lists = [];
54428
- constructor(lists) {
54429
- this.lists = lists;
54430
- }
54431
- append(...args) {
54432
- this.lists.forEach((list) => list.append(...args));
54433
- }
54434
- prepend(...args) {
54435
- this.lists.forEach((list) => list.prepend(...args));
54436
- }
54437
- addToList(...args) {
54438
- this.lists.forEach((list) => list.addToList(...args));
54439
- }
54440
- removeID(...args) {
54441
- this.lists.forEach((list) => list.removeID(...args));
54442
- }
54443
- remove(...args) {
54444
- this.lists.forEach((list) => list.remove(...args));
54445
- }
54446
- toggleElement(...args) {
54447
- this.lists.forEach((list) => list.toggleElement(...args));
54448
- }
54449
- when(when) {
54450
- return new ListCollection(
54451
- this.lists.filter((list) => {
54452
- return list.validateWhen(when);
54453
- })
54454
- );
54455
- }
54456
- includes(key) {
54457
- return !!this.lists.find((list) => list.key === key);
54458
- }
54459
- deleteListWithKey(key) {
54460
- return this.lists = this.lists.filter((list) => list.key !== key);
54461
- }
54462
- *[Symbol.iterator]() {
54463
- for (let list of this.lists) {
54464
- for (const entry of list) {
54465
- yield entry;
54466
- }
54467
- }
54468
- }
54469
- };
54470
-
54471
- // src/runtime/cache/schema.ts
54472
- var SchemaManager = class {
54473
- cache;
54474
- fieldTypes = {};
54475
- constructor(cache) {
54476
- this.cache = cache;
54477
- }
54478
- setFieldType({
54479
- parent,
54480
- key,
54481
- type,
54482
- nullable = false,
54483
- link
54484
- }) {
54485
- let parensIndex = key.indexOf("(");
54486
- if (parensIndex !== -1) {
54487
- key = key.substring(0, parensIndex);
54488
- }
54489
- if (parent === rootID) {
54490
- parent = "Query";
54491
- } else if (parent.includes(":")) {
54492
- parent = parent.substring(0, parent.indexOf(":"));
54493
- }
54494
- if (!this.fieldTypes[parent]) {
54495
- this.fieldTypes[parent] = {};
54496
- }
54497
- this.fieldTypes[parent][key] = {
54498
- type,
54499
- nullable,
54500
- link: !!link
54501
- };
54502
- }
54503
- fieldType(type, field) {
54504
- return this.fieldTypes[type]?.[field] || null;
54505
- }
54506
- get config() {
54507
- return this.cache._internal_unstable.config;
54508
- }
54509
- };
54510
-
54511
- // src/runtime/cache/storage.ts
54512
- var InMemoryStorage = class {
54513
- data;
54514
- idCount = 0;
54515
- rank = 0;
54516
- constructor() {
54517
- this.data = [];
54518
- }
54519
- get layerCount() {
54520
- return this.data.length;
54521
- }
54522
- get nextRank() {
54523
- return this.rank++;
54524
- }
54525
- createLayer(optimistic = false) {
54526
- const layer = new Layer(this.idCount++);
54527
- layer.optimistic = optimistic;
54528
- this.data.push(layer);
54529
- return layer;
54530
- }
54531
- insert(id, field, location, target) {
54532
- return this.topLayer.insert(id, field, location, target);
54533
- }
54534
- remove(id, field, target) {
54535
- return this.topLayer.remove(id, field, target);
54536
- }
54537
- delete(id) {
54538
- return this.topLayer.delete(id);
54539
- }
54540
- deleteField(id, field) {
54541
- return this.topLayer.deleteField(id, field);
54542
- }
54543
- getLayer(id) {
54544
- for (const layer of this.data) {
54545
- if (layer.id === id) {
54546
- return layer;
54547
- }
54548
- }
54549
- throw new Error("Could not find layer with id: " + id);
54550
- }
54551
- replaceID(replacement) {
54552
- for (const layer of this.data) {
54553
- layer.replaceID(replacement);
54554
- }
54555
- }
54556
- get(id, field) {
54557
- const operations = {
54558
- [OperationKind.insert]: {
54559
- [OperationLocation.start]: [],
54560
- [OperationLocation.end]: []
54561
- },
54562
- [OperationKind.remove]: /* @__PURE__ */ new Set()
54563
- };
54564
- const layerIDs = [];
54565
- for (let i = this.data.length - 1; i >= 0; i--) {
54566
- const layer = this.data[i];
54567
- const [layerValue, kind] = layer.get(id, field);
54568
- const layerOperations = layer.getOperations(id, field) || [];
54569
- layer.deletedIDs.forEach((v) => {
54570
- if (layer.operations[v]?.undoDeletesInList?.includes(field)) {
54571
- return;
54572
- }
54573
- operations.remove.add(v);
54574
- });
54575
- if (typeof layerValue === "undefined" && layerOperations.length === 0) {
54576
- if (layer.deletedIDs.size > 0) {
54577
- layerIDs.push(layer.id);
54578
- }
54579
- continue;
54580
- }
54581
- if (typeof layerValue !== "undefined" && !Array.isArray(layerValue)) {
54582
- return {
54583
- value: layerValue,
54584
- kind,
54585
- displayLayers: [layer.id]
54586
- };
54587
- }
54588
- layerIDs.push(layer.id);
54589
- if (layerOperations.length > 0) {
54590
- for (const op of layerOperations) {
54591
- if (isRemoveOperation(op)) {
54592
- operations.remove.add(op.id);
54593
- }
54594
- if (isInsertOperation(op)) {
54595
- operations.insert[op.location].unshift(op.id);
54596
- }
54597
- if (isDeleteOperation(op)) {
54598
- return {
54599
- value: void 0,
54600
- kind: "unknown",
54601
- displayLayers: []
54602
- };
54603
- }
54604
- }
54605
- }
54606
- if (typeof layerValue === "undefined") {
54607
- continue;
54608
- }
54609
- if (!operations.remove.size && !operations.insert.start.length && !operations.insert.end.length) {
54610
- return { value: layerValue, displayLayers: layerIDs, kind: "link" };
54611
- }
54612
- return {
54613
- value: [...operations.insert.start, ...layerValue, ...operations.insert.end].filter(
54614
- (value) => !operations.remove.has(value)
54615
- ),
54616
- displayLayers: layerIDs,
54617
- kind
54618
- };
54619
- }
54620
- return {
54621
- value: void 0,
54622
- kind: "unknown",
54623
- displayLayers: []
54624
- };
54625
- }
54626
- writeLink(id, field, value) {
54627
- return this.topLayer.writeLink(id, field, value);
54628
- }
54629
- writeField(id, field, value) {
54630
- return this.topLayer.writeField(id, field, value);
54631
- }
54632
- resolveLayer(id) {
54633
- let startingIndex = null;
54634
- for (const [index, layer] of this.data.entries()) {
54635
- if (layer.id !== id) {
54636
- continue;
54637
- }
54638
- startingIndex = index - 1;
54639
- this.data[index].optimistic = false;
54640
- break;
54641
- }
54642
- if (startingIndex === null) {
54643
- throw new Error("could not find layer with id: " + id);
54644
- }
54645
- if (startingIndex === -1) {
54646
- startingIndex = 0;
54647
- }
54648
- if (this.data[startingIndex].optimistic) {
54649
- startingIndex++;
54650
- }
54651
- const baseLayer = this.data[startingIndex];
54652
- let layerIndex = startingIndex;
54653
- while (layerIndex < this.data.length) {
54654
- const layer = this.data[layerIndex++];
54655
- if (layer.optimistic) {
54656
- layerIndex--;
54657
- break;
54658
- }
54659
- baseLayer.writeLayer(layer);
54660
- }
54661
- this.data.splice(startingIndex + 1, layerIndex - startingIndex - 1);
54662
- }
54663
- get topLayer() {
54664
- if (this.data.length === 0) {
54665
- this.createLayer();
54666
- }
54667
- if (this.data[this.data.length - 1]?.optimistic) {
54668
- this.createLayer();
54669
- }
54670
- return this.data[this.data.length - 1];
54671
- }
54672
- };
54673
- var Layer = class {
54674
- id;
54675
- optimistic = false;
54676
- fields = {};
54677
- links = {};
54678
- operations = {};
54679
- deletedIDs = /* @__PURE__ */ new Set();
54680
- constructor(id) {
54681
- this.id = id;
54682
- }
54683
- get(id, field) {
54684
- if (typeof this.links[id]?.[field] !== "undefined") {
54685
- return [this.links[id][field], "link"];
54686
- }
54687
- return [this.fields[id]?.[field], "scalar"];
54688
- }
54689
- getOperations(id, field) {
54690
- if (this.operations[id]?.deleted) {
54691
- return [
54692
- {
54693
- kind: OperationKind.delete,
54694
- target: id
54695
- }
54696
- ];
54697
- }
54698
- if (this.operations[id]?.fields?.[field]) {
54699
- return this.operations[id].fields[field];
54700
- }
54701
- }
54702
- writeField(id, field, value) {
54703
- this.fields[id] = {
54704
- ...this.fields[id],
54705
- [field]: value
54706
- };
54707
- return this.id;
54708
- }
54709
- writeLink(id, field, value) {
54710
- const valueList = Array.isArray(value) ? value : [value];
54711
- for (const value2 of flattenList(valueList)) {
54712
- if (!value2) {
54713
- continue;
54714
- }
54715
- const fieldOperations = this.operations[id]?.fields[field];
54716
- if (this.operations[value2]?.deleted || this.deletedIDs.has(value2)) {
54717
- this.operations[value2] = {
54718
- ...this.operations[value2],
54719
- undoDeletesInList: [...this.operations[id]?.undoDeletesInList || [], field]
54720
- };
54721
- } else if (value2 && fieldOperations?.length > 0) {
54722
- this.operations[id].fields[field] = fieldOperations.filter(
54723
- (op) => op.kind !== "remove" || op.id !== value2
54724
- );
54725
- }
54726
- }
54727
- this.links[id] = {
54728
- ...this.links[id],
54729
- [field]: value
54730
- };
54731
- return this.id;
54732
- }
54733
- isDisplayLayer(displayLayers) {
54734
- return displayLayers.length === 0 || displayLayers.includes(this.id) || Math.max(...displayLayers) < this.id;
54735
- }
54736
- clear() {
54737
- this.links = {};
54738
- this.fields = {};
54739
- this.operations = {};
54740
- this.deletedIDs = /* @__PURE__ */ new Set();
54741
- }
54742
- replaceID({ from, to }) {
54743
- this.fields[to] = this.fields[from];
54744
- this.links[to] = this.links[from];
54745
- this.operations[to] = this.operations[from] || { fields: {} };
54746
- if (this.deletedIDs.has(from)) {
54747
- this.deletedIDs.add(to);
54748
- }
54749
- }
54750
- removeUndefinedFields() {
54751
- for (const [id, fields] of Object.entries(this.fields)) {
54752
- for (const [field, value] of Object.entries(fields)) {
54753
- if (typeof value === "undefined") {
54754
- try {
54755
- delete this.fields[id][field];
54756
- } catch {
54757
- }
54758
- try {
54759
- delete this.links[id][field];
54760
- } catch {
54761
- }
54762
- }
54763
- }
54764
- if (Object.keys(fields || {}).length === 0) {
54765
- delete this.fields[id];
54766
- }
54767
- if (Object.keys(this.links[id] || {}).length === 0) {
54768
- delete this.links[id];
54769
- }
54770
- }
54771
- }
54772
- delete(id) {
54773
- this.operations = {
54774
- ...this.operations,
54775
- [id]: {
54776
- ...this.operations[id],
54777
- deleted: true,
54778
- undoDeletesInList: []
54779
- }
54780
- };
54781
- this.deletedIDs.add(id);
54782
- }
54783
- deleteField(id, field) {
54784
- this.fields[id] = {
54785
- ...this.fields[id],
54786
- [field]: void 0
54787
- };
54788
- }
54789
- insert(id, field, where, target) {
54790
- this.addFieldOperation(id, field, {
54791
- kind: OperationKind.insert,
54792
- id: target,
54793
- location: where
54794
- });
54795
- }
54796
- remove(id, field, target) {
54797
- this.addFieldOperation(id, field, {
54798
- kind: OperationKind.remove,
54799
- id: target
54800
- });
54801
- }
54802
- writeLayer(layer) {
54803
- if (layer.id === this.id) {
54804
- return;
54805
- }
54806
- for (const [id, ops] of Object.entries(layer.operations)) {
54807
- const fields = {};
54808
- for (const opMap of [this.operations[id], layer.operations[id]].filter(Boolean)) {
54809
- for (const [fieldName, operations] of Object.entries(opMap.fields || {})) {
54810
- fields[fieldName] = [...fields[fieldName] || [], ...operations];
54811
- }
54812
- }
54813
- if (Object.keys(fields).length > 0) {
54814
- this.operations[id] = {
54815
- ...this.operations[id],
54816
- fields
54817
- };
54818
- }
54819
- if (ops?.deleted) {
54820
- delete this.fields[id];
54821
- delete this.links[id];
54822
- }
54823
- }
54824
- for (const [id, values] of Object.entries(layer.fields)) {
54825
- if (!values) {
54826
- continue;
54827
- }
54828
- for (const [field, value] of Object.entries(values)) {
54829
- this.writeField(id, field, value);
54830
- }
54831
- }
54832
- for (const [id, values] of Object.entries(layer.links)) {
54833
- if (!values) {
54834
- continue;
54835
- }
54836
- for (const [field, value] of Object.entries(values)) {
54837
- this.writeLink(id, field, value);
54838
- }
54839
- }
54840
- layer.deletedIDs.forEach((v) => this.deletedIDs.add(v));
54841
- }
54842
- addFieldOperation(id, field, operation) {
54843
- this.operations = {
54844
- ...this.operations,
54845
- [id]: {
54846
- ...this.operations[id],
54847
- fields: {
54848
- [field]: [...this.operations[id]?.fields[field] || [], operation]
54849
- }
54850
- }
54851
- };
54852
- }
54853
- };
54854
- function isDeleteOperation(value) {
54855
- return !!value && value.kind === OperationKind.delete;
54856
- }
54857
- function isInsertOperation(value) {
54858
- return !!value && value.kind === OperationKind.insert;
54859
- }
54860
- function isRemoveOperation(value) {
54861
- return !!value && value.kind === OperationKind.remove;
54862
- }
54863
- var OperationLocation = /* @__PURE__ */ ((OperationLocation2) => {
54864
- OperationLocation2["start"] = "start";
54865
- OperationLocation2["end"] = "end";
54866
- return OperationLocation2;
54867
- })(OperationLocation || {});
54868
- var OperationKind = /* @__PURE__ */ ((OperationKind2) => {
54869
- OperationKind2["delete"] = "delete";
54870
- OperationKind2["insert"] = "insert";
54871
- OperationKind2["remove"] = "remove";
54872
- return OperationKind2;
54873
- })(OperationKind || {});
54874
-
54875
- // src/runtime/cache/subscription.ts
54876
- var InMemorySubscriptions = class {
54877
- cache;
54878
- constructor(cache) {
54879
- this.cache = cache;
54880
- }
54881
- subscribers = {};
54882
- referenceCounts = {};
54883
- keyVersions = {};
54884
- add({
54885
- parent,
54886
- spec,
54887
- selection: selection2,
54888
- variables,
54889
- parentType
54890
- }) {
54891
- const __typename = this.cache._internal_unstable.storage.get(parent, "__typename").value;
54892
- let targetSelection = getFieldsForType(selection2, __typename);
54893
- for (const fieldSelection of Object.values(targetSelection || {})) {
54894
- const { keyRaw, selection: innerSelection, type } = fieldSelection;
54895
- const key = evaluateKey(keyRaw, variables);
54896
- this.addFieldSubscription({
54897
- id: parent,
54898
- key,
54899
- field: fieldSelection,
54900
- spec,
54901
- parentType: parentType || spec.rootType,
54902
- variables
54903
- });
54904
- if (innerSelection) {
54905
- const { value: linkedRecord } = this.cache._internal_unstable.storage.get(
54906
- parent,
54907
- key
54908
- );
54909
- let children = !Array.isArray(linkedRecord) ? [linkedRecord] : flattenList(linkedRecord) || [];
54910
- for (const child of children) {
54911
- if (!child) {
54912
- continue;
54913
- }
54914
- this.add({
54915
- parent: child,
54916
- spec,
54917
- selection: innerSelection,
54918
- variables,
54919
- parentType: type
54920
- });
54921
- }
54922
- }
54923
- }
54924
- }
54925
- addFieldSubscription({
54926
- id,
54927
- key,
54928
- field,
54929
- spec,
54930
- parentType,
54931
- variables
54932
- }) {
54933
- if (!this.subscribers[id]) {
54934
- this.subscribers[id] = {};
54935
- }
54936
- if (!this.subscribers[id][key]) {
54937
- this.subscribers[id][key] = [];
54938
- }
54939
- if (!this.keyVersions[key]) {
54940
- this.keyVersions[key] = /* @__PURE__ */ new Set();
54941
- }
54942
- this.keyVersions[key].add(key);
54943
- if (!this.subscribers[id][key].map(({ set }) => set).includes(spec.set)) {
54944
- this.subscribers[id][key].push(spec);
54945
- }
54946
- if (!this.referenceCounts[id]) {
54947
- this.referenceCounts[id] = {};
54948
- }
54949
- if (!this.referenceCounts[id][key]) {
54950
- this.referenceCounts[id][key] = /* @__PURE__ */ new Map();
54951
- }
54952
- const counts = this.referenceCounts[id][key];
54953
- counts.set(spec.set, (counts.get(spec.set) || 0) + 1);
54954
- this.cache._internal_unstable.lifetimes.resetLifetime(id, key);
54955
- const { selection: selection2, list, filters } = field;
54956
- if (selection2 && list) {
54957
- this.cache._internal_unstable.lists.add({
54958
- name: list.name,
54959
- connection: list.connection,
54960
- recordID: id,
54961
- recordType: this.cache._internal_unstable.storage.get(id, "__typename")?.value || parentType,
54962
- listType: list.type,
54963
- key,
54964
- selection: selection2,
54965
- filters: Object.entries(filters || {}).reduce((acc, [key2, { kind, value }]) => {
54966
- return {
54967
- ...acc,
54968
- [key2]: kind !== "Variable" ? value : variables[value]
54969
- };
54970
- }, {})
54971
- });
54972
- }
54973
- }
54974
- addMany({
54975
- parent,
54976
- selection: selection2,
54977
- variables,
54978
- subscribers,
54979
- parentType
54980
- }) {
54981
- let targetSelection = getFieldsForType(selection2, parentType);
54982
- for (const fieldSelection of Object.values(targetSelection)) {
54983
- const { type: linkedType, keyRaw, selection: innerSelection } = fieldSelection;
54984
- const key = evaluateKey(keyRaw, variables);
54985
- for (const spec of subscribers) {
54986
- this.addFieldSubscription({
54987
- id: parent,
54988
- key,
54989
- field: fieldSelection,
54990
- spec,
54991
- parentType,
54992
- variables
54993
- });
54994
- }
54995
- if (innerSelection) {
54996
- const { value: link } = this.cache._internal_unstable.storage.get(parent, key);
54997
- const children = !Array.isArray(link) ? [link] : flattenList(link);
54998
- for (const linkedRecord of children) {
54999
- if (!linkedRecord) {
55000
- continue;
55001
- }
55002
- this.addMany({
55003
- parent: linkedRecord,
55004
- selection: innerSelection,
55005
- variables,
55006
- subscribers,
55007
- parentType: linkedType
55008
- });
55009
- }
55010
- }
55011
- }
55012
- }
55013
- get(id, field) {
55014
- return this.subscribers[id]?.[field] || [];
55015
- }
55016
- remove(id, selection2, targets, variables, visited = []) {
55017
- visited.push(id);
55018
- const linkedIDs = [];
55019
- for (const fieldSelection of Object.values(selection2.fields || {})) {
55020
- const key = evaluateKey(fieldSelection.keyRaw, variables);
55021
- this.removeSubscribers(id, key, targets);
55022
- if (!fieldSelection.selection?.fields) {
55023
- continue;
55024
- }
55025
- const { value: previousValue } = this.cache._internal_unstable.storage.get(id, key);
55026
- const links = !Array.isArray(previousValue) ? [previousValue] : flattenList(previousValue);
55027
- for (const link of links) {
55028
- if (link !== null) {
55029
- linkedIDs.push([link, fieldSelection.selection || {}]);
55030
- }
55031
- }
55032
- }
55033
- for (const [linkedRecordID, linkFields] of linkedIDs) {
55034
- this.remove(linkedRecordID, linkFields, targets, visited);
55035
- }
55036
- }
55037
- removeSubscribers(id, fieldName, specs) {
55038
- let targets = [];
55039
- for (const spec of specs) {
55040
- if (!this.referenceCounts[id]?.[fieldName]?.has(spec.set)) {
55041
- continue;
55042
- }
55043
- const counts = this.referenceCounts[id][fieldName];
55044
- const newVal = (counts.get(spec.set) || 0) - 1;
55045
- counts.set(spec.set, newVal);
55046
- if (newVal <= 0) {
55047
- targets.push(spec.set);
55048
- counts.delete(spec.set);
55049
- }
55050
- }
55051
- if (this.subscribers[id]) {
55052
- this.subscribers[id][fieldName] = this.get(id, fieldName).filter(
55053
- ({ set }) => !targets.includes(set)
55054
- );
55055
- }
55056
- }
55057
- removeAllSubscribers(id, targets, visited = []) {
55058
- visited.push(id);
55059
- for (const field of Object.keys(this.subscribers[id] || [])) {
55060
- const subscribers = targets || this.subscribers[id][field];
55061
- this.removeSubscribers(id, field, subscribers);
55062
- const { value, kind } = this.cache._internal_unstable.storage.get(id, field);
55063
- if (kind === "scalar") {
55064
- continue;
55065
- }
55066
- const nextTargets = Array.isArray(value) ? flattenList(value) : [value];
55067
- for (const id2 of nextTargets) {
55068
- if (visited.includes(id2)) {
55069
- continue;
55070
- }
55071
- this.removeAllSubscribers(id2, subscribers, visited);
55072
- }
55073
- }
55074
- }
55075
- };
55076
-
55077
- // src/runtime/cache/cache.ts
55078
- var Cache3 = class {
55079
- _internal_unstable;
55080
- constructor(config2) {
55081
- this._internal_unstable = new CacheInternal({
55082
- cache: this,
55083
- storage: new InMemoryStorage(),
55084
- subscriptions: new InMemorySubscriptions(this),
55085
- lists: new ListManager(this, rootID),
55086
- lifetimes: new GarbageCollector(this),
55087
- schema: new SchemaManager(this)
55088
- });
55089
- if (config2) {
55090
- this.setConfig(defaultConfigValues(config2));
55091
- }
55092
- }
55093
- write({
55094
- layer: layerID,
55095
- notifySubscribers = [],
55096
- ...args
55097
- }) {
55098
- const layer = layerID ? this._internal_unstable.storage.getLayer(layerID) : this._internal_unstable.storage.topLayer;
55099
- const subscribers = this._internal_unstable.writeSelection({ ...args, layer });
55100
- const notified = [];
55101
- for (const spec of subscribers.concat(notifySubscribers)) {
55102
- if (!notified.includes(spec.set)) {
55103
- notified.push(spec.set);
55104
- spec.set(
55105
- this._internal_unstable.getSelection({
55106
- parent: spec.parentID || rootID,
55107
- selection: spec.selection,
55108
- variables: spec.variables?.() || {}
55109
- }).data
55110
- );
55111
- }
55112
- }
55113
- return subscribers;
55114
- }
55115
- read(...args) {
55116
- const { data, partial, hasData } = this._internal_unstable.getSelection(...args);
55117
- if (!hasData) {
55118
- return { data: null, partial: false };
55119
- }
55120
- return {
55121
- data,
55122
- partial
55123
- };
55124
- }
55125
- subscribe(spec, variables = {}) {
55126
- return this._internal_unstable.subscriptions.add({
55127
- parent: spec.parentID || rootID,
55128
- spec,
55129
- selection: spec.selection,
55130
- variables
55131
- });
55132
- }
55133
- unsubscribe(spec, variables = {}) {
55134
- return this._internal_unstable.subscriptions.remove(
55135
- spec.parentID || rootID,
55136
- spec.selection,
55137
- [spec],
55138
- variables
55139
- );
55140
- }
55141
- list(name2, parentID, allLists) {
55142
- const handler = this._internal_unstable.lists.get(name2, parentID, allLists);
55143
- if (!handler) {
55144
- throw new Error(
55145
- `Cannot find list with name: ${name2}${parentID ? " under parent " + parentID : ""}. Is it possible that the query is not mounted?`
55146
- );
55147
- }
55148
- return handler;
55149
- }
55150
- delete(id) {
55151
- this._internal_unstable.subscriptions.removeAllSubscribers(id);
55152
- this._internal_unstable.lists.removeIDFromAllLists(id);
55153
- this._internal_unstable.storage.delete(id);
55154
- }
55155
- setConfig(config2) {
55156
- this._internal_unstable.setConfig(config2);
55157
- }
55158
- };
55159
- var CacheInternal = class {
55160
- _disabled = false;
55161
- config = defaultConfigValues({
55162
- plugins: {
55163
- "houdini-svelte": {
55164
- client: ""
55165
- }
55166
- }
55167
- });
55168
- storage;
55169
- subscriptions;
55170
- lists;
55171
- cache;
55172
- lifetimes;
55173
- schema;
55174
- constructor({
55175
- storage,
55176
- subscriptions,
55177
- lists,
55178
- cache,
55179
- lifetimes,
55180
- schema
55181
- }) {
55182
- this.storage = storage;
55183
- this.subscriptions = subscriptions;
55184
- this.lists = lists;
55185
- this.cache = cache;
55186
- this.lifetimes = lifetimes;
55187
- this.schema = schema;
55188
- this._disabled = typeof globalThis.window === "undefined";
55189
- try {
55190
- if (process.env.HOUDINI_TEST === "true") {
55191
- this._disabled = false;
55192
- }
55193
- } catch {
55194
- }
55195
- }
55196
- setConfig(config2) {
55197
- this.config = config2;
55198
- }
55199
- writeSelection({
55200
- data,
55201
- selection: selection2,
55202
- variables = {},
55203
- parent = rootID,
55204
- applyUpdates = false,
55205
- layer,
55206
- toNotify = [],
55207
- forceNotify
55208
- }) {
55209
- if (this._disabled) {
55210
- return [];
55211
- }
55212
- let targetSelection = getFieldsForType(selection2, data["__typename"]);
55213
- for (const [field, value] of Object.entries(data)) {
55214
- if (!selection2 || !targetSelection[field]) {
55215
- throw new Error(
55216
- "Could not find field listing in selection for " + field + " @ " + JSON.stringify(selection2)
55217
- );
55218
- }
55219
- let {
55220
- type: linkedType,
55221
- keyRaw,
55222
- selection: fieldSelection,
55223
- operations,
55224
- abstract: isAbstract,
55225
- update,
55226
- nullable
55227
- } = targetSelection[field];
55228
- const key = evaluateKey(keyRaw, variables);
55229
- this.schema.setFieldType({
55230
- parent,
55231
- key: keyRaw,
55232
- type: linkedType,
55233
- nullable,
55234
- link: !!fieldSelection
55235
- });
55236
- const currentSubscribers = this.subscriptions.get(parent, key);
55237
- const { value: previousValue, displayLayers } = this.storage.get(parent, key);
55238
- const displayLayer = layer.isDisplayLayer(displayLayers);
55239
- if (displayLayer) {
55240
- this.lifetimes.resetLifetime(parent, key);
55241
- }
55242
- if (!fieldSelection) {
55243
- let newValue = value;
55244
- if (Array.isArray(value) && applyUpdates && update) {
55245
- if (update === "append") {
55246
- newValue = (previousValue || []).concat(value);
55247
- } else if (update === "prepend") {
55248
- newValue = value.concat(previousValue || []);
55249
- }
55250
- }
55251
- const valueChanged = !deepEquals(newValue, previousValue);
55252
- if (displayLayer && (valueChanged || forceNotify)) {
55253
- toNotify.push(...currentSubscribers);
55254
- }
55255
- layer.writeField(parent, key, newValue);
55256
- } else if (value === null) {
55257
- if (previousValue === null) {
55258
- continue;
55259
- }
55260
- const previousLinks = flattenList([previousValue]);
55261
- for (const link of previousLinks) {
55262
- this.subscriptions.remove(link, fieldSelection, currentSubscribers, variables);
55263
- }
55264
- layer.writeLink(parent, key, null);
55265
- toNotify.push(...currentSubscribers);
55266
- } else if (value instanceof Object && !Array.isArray(value)) {
55267
- if (isAbstract) {
55268
- if (!value.__typename) {
55269
- throw new Error(
55270
- "Encountered interface type without __typename in the payload"
55271
- );
55272
- }
55273
- linkedType = value.__typename;
55274
- }
55275
- const embedded = this.idFields(linkedType)?.filter(
55276
- (field2) => typeof value[field2] === "undefined"
55277
- ).length > 0;
55278
- let linkedID = null;
55279
- if (value !== null) {
55280
- linkedID = !embedded ? this.id(linkedType, value) : `${parent}.${key}`;
55281
- }
55282
- let linkChange = linkedID !== previousValue;
55283
- layer.writeLink(parent, key, linkedID);
55284
- if (linkedID && displayLayer && (linkChange || forceNotify)) {
55285
- if (previousValue && typeof previousValue === "string") {
55286
- this.subscriptions.remove(
55287
- previousValue,
55288
- fieldSelection,
55289
- currentSubscribers,
55290
- variables
55291
- );
55292
- }
55293
- this.subscriptions.addMany({
55294
- parent: linkedID,
55295
- selection: fieldSelection,
55296
- subscribers: currentSubscribers,
55297
- variables,
55298
- parentType: linkedType
55299
- });
55300
- toNotify.push(...currentSubscribers);
55301
- }
55302
- if (linkedID) {
55303
- this.writeSelection({
55304
- selection: fieldSelection,
55305
- parent: linkedID,
55306
- data: value,
55307
- variables,
55308
- toNotify,
55309
- applyUpdates,
55310
- layer,
55311
- forceNotify
55312
- });
55313
- }
55314
- } else if (Array.isArray(value) && (typeof previousValue === "undefined" || Array.isArray(previousValue))) {
55315
- let oldIDs = [...previousValue || []];
55316
- const emptyEdges = !update ? [] : oldIDs.map((id) => {
55317
- if (!id) {
55318
- return "";
55319
- }
55320
- const { value: cursorField } = this.storage.get(id, "cursor");
55321
- if (cursorField) {
55322
- return "";
55323
- }
55324
- const { value: node } = this.storage.get(id, "node");
55325
- if (!node) {
55326
- return "";
55327
- }
55328
- return node;
55329
- });
55330
- let linkedIDs = [];
55331
- const { newIDs, nestedIDs } = this.extractNestedListIDs({
55332
- value,
55333
- abstract: Boolean(isAbstract),
55334
- specs: toNotify,
55335
- applyUpdates,
55336
- recordID: parent,
55337
- key,
55338
- linkedType,
55339
- variables,
55340
- fields: fieldSelection,
55341
- layer,
55342
- forceNotify
55343
- });
55344
- if (applyUpdates && update) {
55345
- if (key === "edges") {
55346
- const newNodeIDs = [];
55347
- for (const id of newIDs) {
55348
- if (!id) {
55349
- continue;
55350
- }
55351
- const { value: node } = this.storage.get(id, "node");
55352
- if (typeof node !== "string") {
55353
- continue;
55354
- }
55355
- if (!node || !this.storage.get(node, "__typename")) {
55356
- continue;
55357
- }
55358
- newNodeIDs.push(node);
55359
- }
55360
- oldIDs = oldIDs.filter((id) => {
55361
- if (!id) {
55362
- return true;
55363
- }
55364
- const { value: value2 } = this.storage.get(id, "node");
55365
- const node = value2;
55366
- if (newNodeIDs.includes(node) && emptyEdges.includes(node)) {
55367
- return false;
55368
- }
55369
- return true;
55370
- });
55371
- }
55372
- if (update === "prepend") {
55373
- linkedIDs = newIDs.concat(oldIDs);
55374
- } else if (update === "append") {
55375
- linkedIDs = oldIDs.concat(newIDs);
55376
- } else if (update === "replace") {
55377
- linkedIDs = newIDs;
55378
- }
55379
- } else {
55380
- linkedIDs = nestedIDs;
55381
- }
55382
- const contentChanged = !deepEquals(linkedIDs, oldIDs);
55383
- if (contentChanged || forceNotify) {
55384
- toNotify.push(...currentSubscribers);
55385
- }
55386
- for (const lostID of oldIDs) {
55387
- if (linkedIDs.includes(lostID) || !lostID) {
55388
- continue;
55389
- }
55390
- this.subscriptions.remove(lostID, fieldSelection, currentSubscribers, variables);
55391
- }
55392
- if (contentChanged || oldIDs.length === 0 && newIDs.length === 0) {
55393
- layer.writeLink(parent, key, linkedIDs);
55394
- }
55395
- for (const id of newIDs.filter((id2) => !oldIDs.includes(id2))) {
55396
- if (id == null) {
55397
- continue;
55398
- }
55399
- this.subscriptions.addMany({
55400
- parent: id,
55401
- selection: fieldSelection,
55402
- subscribers: currentSubscribers,
55403
- variables,
55404
- parentType: linkedType
55405
- });
55406
- }
55407
- }
55408
- for (const operation of operations || []) {
55409
- let parentID;
55410
- if (operation.parentID) {
55411
- if (operation.parentID.kind !== "Variable") {
55412
- parentID = operation.parentID.value;
55413
- } else {
55414
- const id = variables[operation.parentID.value];
55415
- if (typeof id !== "string") {
55416
- throw new Error("parentID value must be a string");
55417
- }
55418
- parentID = id;
55419
- }
55420
- }
55421
- if (operation.list && !this.lists.get(operation.list, parentID, operation.target === "all")) {
55422
- continue;
55423
- }
55424
- const targets = Array.isArray(value) ? value : [value];
55425
- for (const target of targets) {
55426
- if (operation.action === "insert" && target instanceof Object && fieldSelection && operation.list) {
55427
- this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).addToList(
55428
- fieldSelection,
55429
- target,
55430
- variables,
55431
- operation.position || "last"
55432
- );
55433
- } else if (operation.action === "remove" && target instanceof Object && fieldSelection && operation.list) {
55434
- this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).remove(target, variables);
55435
- } else if (operation.action === "delete" && operation.type) {
55436
- if (typeof target !== "string") {
55437
- throw new Error("Cannot delete a record with a non-string ID");
55438
- }
55439
- const targetID = this.id(operation.type, target);
55440
- if (!targetID) {
55441
- continue;
55442
- }
55443
- this.cache.delete(targetID);
55444
- } else if (operation.action === "toggle" && target instanceof Object && fieldSelection && operation.list) {
55445
- this.cache.list(operation.list, parentID, operation.target === "all").when(operation.when).toggleElement(
55446
- fieldSelection,
55447
- target,
55448
- variables,
55449
- operation.position || "last"
55450
- );
55451
- }
55452
- }
55453
- }
55454
- }
55455
- return toNotify;
55456
- }
55457
- getSelection({
55458
- selection: selection2,
55459
- parent = rootID,
55460
- variables,
55461
- stepsFromConnection = null
55462
- }) {
55463
- if (parent === null) {
55464
- return { data: null, partial: false, hasData: true };
55465
- }
55466
- const target = {};
55467
- let hasData = false;
55468
- let partial = false;
55469
- let cascadeNull = false;
55470
- const typename = this.storage.get(parent, "__typename").value;
55471
- let targetSelection = getFieldsForType(selection2, typename);
55472
- for (const [
55473
- attributeName,
55474
- { type, keyRaw, selection: fieldSelection, nullable, list }
55475
- ] of Object.entries(targetSelection)) {
55476
- const key = evaluateKey(keyRaw, variables);
55477
- const { value } = this.storage.get(parent, key);
55478
- let nextStep = stepsFromConnection;
55479
- if (nextStep !== null) {
55480
- if (nextStep >= 2) {
55481
- nextStep = null;
55482
- } else {
55483
- nextStep += 1;
55484
- }
55485
- }
55486
- if (list?.connection) {
55487
- nextStep = 0;
55488
- }
55489
- const embeddedCursor = key === "cursor" && stepsFromConnection === 1;
55490
- if (typeof value === "undefined" && !embeddedCursor) {
55491
- partial = true;
55492
- }
55493
- if (typeof value === "undefined" || value === null) {
55494
- target[attributeName] = null;
55495
- if (typeof value !== "undefined") {
55496
- hasData = true;
55497
- }
55498
- } else if (!fieldSelection) {
55499
- const fnUnmarshal = this.config?.scalars?.[type]?.unmarshal;
55500
- if (fnUnmarshal) {
55501
- target[attributeName] = fnUnmarshal(value);
55502
- } else {
55503
- target[attributeName] = value;
55504
- }
55505
- hasData = true;
55506
- } else if (Array.isArray(value)) {
55507
- const listValue = this.hydrateNestedList({
55508
- fields: fieldSelection,
55509
- variables,
55510
- linkedList: value,
55511
- stepsFromConnection: nextStep
55512
- });
55513
- target[attributeName] = listValue.data;
55514
- if (listValue.partial) {
55515
- partial = true;
55516
- }
55517
- if (listValue.hasData || value.length === 0) {
55518
- hasData = true;
55519
- }
55520
- } else {
55521
- const objectFields = this.getSelection({
55522
- parent: value,
55523
- selection: fieldSelection,
55524
- variables,
55525
- stepsFromConnection: nextStep
55526
- });
55527
- target[attributeName] = objectFields.data;
55528
- if (objectFields.partial) {
55529
- partial = true;
55530
- }
55531
- if (objectFields.hasData) {
55532
- hasData = true;
55533
- }
55534
- }
55535
- if (target[attributeName] === null && !nullable && !embeddedCursor) {
55536
- cascadeNull = true;
55537
- }
55538
- }
55539
- return {
55540
- data: cascadeNull ? null : target,
55541
- partial: hasData && partial,
55542
- hasData
55543
- };
55544
- }
55545
- id(type, data) {
55546
- const id = typeof data === "string" ? data : this.computeID(type, data);
55547
- if (!id) {
55548
- return null;
55549
- }
55550
- if (!type) {
55551
- return id;
55552
- }
55553
- return type + ":" + id;
55554
- }
55555
- idFields(type) {
55556
- return keyFieldsForType(this.config, type);
55557
- }
55558
- computeID(type, data) {
55559
- return computeID(this.config, type, data);
55560
- }
55561
- hydrateNestedList({
55562
- fields,
55563
- variables,
55564
- linkedList,
55565
- stepsFromConnection
55566
- }) {
55567
- const result = [];
55568
- let partialData = false;
55569
- let hasValues = false;
55570
- for (const entry of linkedList) {
55571
- if (Array.isArray(entry)) {
55572
- const nestedValue = this.hydrateNestedList({
55573
- fields,
55574
- variables,
55575
- linkedList: entry,
55576
- stepsFromConnection
55577
- });
55578
- result.push(nestedValue.data);
55579
- if (nestedValue.partial) {
55580
- partialData = true;
55581
- }
55582
- continue;
55583
- }
55584
- if (entry === null) {
55585
- result.push(entry);
55586
- continue;
55587
- }
55588
- const { data, partial, hasData } = this.getSelection({
55589
- parent: entry,
55590
- selection: fields,
55591
- variables,
55592
- stepsFromConnection
55593
- });
55594
- result.push(data);
55595
- if (partial) {
55596
- partialData = true;
55597
- }
55598
- if (hasData) {
55599
- hasValues = true;
55600
- }
55601
- }
55602
- return {
55603
- data: result,
55604
- partial: partialData,
55605
- hasData: hasValues
55606
- };
55607
- }
55608
- extractNestedListIDs({
55609
- value,
55610
- abstract,
55611
- recordID,
55612
- key,
55613
- linkedType,
55614
- fields,
55615
- variables,
55616
- applyUpdates,
55617
- specs,
55618
- layer,
55619
- forceNotify
55620
- }) {
55621
- const nestedIDs = [];
55622
- const newIDs = [];
55623
- for (const [i, entry] of value.entries()) {
55624
- if (Array.isArray(entry)) {
55625
- const inner = this.extractNestedListIDs({
55626
- value: entry,
55627
- abstract,
55628
- recordID,
55629
- key,
55630
- linkedType,
55631
- fields,
55632
- variables,
55633
- applyUpdates,
55634
- specs,
55635
- layer,
55636
- forceNotify
55637
- });
55638
- newIDs.push(...inner.newIDs);
55639
- nestedIDs[i] = inner.nestedIDs;
55640
- continue;
55641
- }
55642
- if (entry === null || typeof entry === "undefined") {
55643
- newIDs.push(null);
55644
- nestedIDs[i] = null;
55645
- continue;
55646
- }
55647
- const entryObj = entry;
55648
- let linkedID = `${recordID}.${key}[${this.storage.nextRank}]`;
55649
- const embedded = this.idFields(linkedType)?.filter(
55650
- (field) => typeof entry[field] === "undefined"
55651
- ).length > 0;
55652
- const typename = entryObj.__typename;
55653
- let innerType = linkedType;
55654
- if (abstract) {
55655
- if (!typename) {
55656
- throw new Error("Encountered interface type without __typename in the payload");
55657
- }
55658
- innerType = typename;
55659
- }
55660
- if (!embedded) {
55661
- const id = this.id(innerType, entry);
55662
- if (id) {
55663
- linkedID = id;
55664
- } else {
55665
- continue;
55666
- }
55667
- }
55668
- this.writeSelection({
55669
- root: rootID,
55670
- selection: fields,
55671
- parent: linkedID,
55672
- data: entryObj,
55673
- variables,
55674
- toNotify: specs,
55675
- applyUpdates,
55676
- layer,
55677
- forceNotify
55678
- });
55679
- newIDs.push(linkedID);
55680
- nestedIDs[i] = linkedID;
55681
- }
55682
- return { newIDs, nestedIDs };
55683
- }
55684
- collectGarbage() {
55685
- this.lifetimes.tick();
55686
- if (this.storage.layerCount === 1) {
55687
- this.storage.topLayer.removeUndefinedFields();
55688
- }
55689
- }
55690
- };
55691
- var rootID = "_ROOT_";
55692
-
55693
- // src/runtime/cache/index.ts
55694
- var cache_default = new Cache3();
55695
53958
 
55696
53959
  // src/runtime/lib/types.ts
55697
53960
  var CompiledFragmentKind = "HoudiniFragment" /* Fragment */;
@@ -55990,7 +54253,7 @@ async function recursiveCopy(source, target, transforms, notRoot) {
55990
54253
  const targetPath = join(parentDir, child);
55991
54254
  let original = await readFile(childPath) || "";
55992
54255
  if (transforms?.[childPath]) {
55993
- original = transforms[childPath](original);
54256
+ original = await transforms[childPath](original, childPath);
55994
54257
  }
55995
54258
  await writeFile(targetPath, original);
55996
54259
  }
@@ -56417,7 +54680,13 @@ function exportStarFrom(where) {
56417
54680
  }
56418
54681
  function exportDefaultFrom(where, as) {
56419
54682
  return `var ${as} = require("${where}");
56420
- Object.defineProperty(exports, "${as}", { enumerable: true, get: function () { return __importDefault(${as}).default; } });`;
54683
+ ${exportDefault(as)}`;
54684
+ }
54685
+ function exportDefault(as) {
54686
+ return `Object.defineProperty(exports, "${as}", { enumerable: true, get: function () { return __importDefault(${as}).default; } });`;
54687
+ }
54688
+ function importDefaultFrom(where, as) {
54689
+ return `var ${as} = require("${where}")`;
56421
54690
  }
56422
54691
 
56423
54692
  // src/codegen/utils/flattenSelections.ts
@@ -56461,6 +54730,9 @@ var FieldCollection = class {
56461
54730
  this.add(selection2);
56462
54731
  }
56463
54732
  }
54733
+ get size() {
54734
+ return Object.keys(this.fields).length + Object.keys(this.inlineFragments).length + Object.keys(this.fragmentSpreads).length;
54735
+ }
56464
54736
  add(selection2) {
56465
54737
  if (selection2.kind === "Field") {
56466
54738
  const key = selection2.alias?.value || selection2.name.value;
@@ -56529,9 +54801,12 @@ var FieldCollection = class {
56529
54801
  }
56530
54802
  }
56531
54803
  toSelectionSet() {
56532
- return Object.values(this.inlineFragments).map((fragment) => {
54804
+ return Object.values(this.inlineFragments).flatMap((fragment) => {
54805
+ if (fragment.selection.size === 0) {
54806
+ return [];
54807
+ }
56533
54808
  fragment.astNode.selectionSet.selections = fragment.selection.toSelectionSet();
56534
- return fragment.astNode;
54809
+ return [fragment.astNode];
56535
54810
  }).concat(
56536
54811
  Object.values(this.fields).map((field) => {
56537
54812
  if (field.astNode.selectionSet) {
@@ -56714,7 +54989,7 @@ function serializeValue(value) {
56714
54989
  if (typeof value === "object" && value !== null) {
56715
54990
  return AST4.objectExpression(
56716
54991
  Object.entries(value).filter(([, value2]) => typeof value2 !== "undefined").map(
56717
- ([key, value2]) => AST4.objectProperty(AST4.identifier(key), serializeValue(value2))
54992
+ ([key, value2]) => AST4.objectProperty(AST4.stringLiteral(key), serializeValue(value2))
56718
54993
  )
56719
54994
  );
56720
54995
  }
@@ -58268,6 +56543,23 @@ function artifactGenerator(stats) {
58268
56543
  document: doc
58269
56544
  })
58270
56545
  };
56546
+ const pluginsData = config2.plugins.reduce(
56547
+ (prev, plugin) => {
56548
+ if (!plugin.artifact_data) {
56549
+ return prev;
56550
+ }
56551
+ const result = { ...prev };
56552
+ const dataToAdd = plugin.artifact_data(config2, doc) ?? {};
56553
+ if (Object.keys(dataToAdd).length > 0) {
56554
+ result[plugin.name] = dataToAdd;
56555
+ }
56556
+ return result;
56557
+ },
56558
+ {}
56559
+ );
56560
+ if (Object.keys(pluginsData).length > 0) {
56561
+ artifact.pluginsData = pluginsData;
56562
+ }
58271
56563
  if (inputs && inputs.length > 0) {
58272
56564
  artifact.input = inputObject(config2, inputs);
58273
56565
  }
@@ -58331,77 +56623,132 @@ function artifactGenerator(stats) {
58331
56623
  };
58332
56624
  }
58333
56625
 
58334
- // src/codegen/generators/runtime/index.ts
56626
+ // src/codegen/generators/runtime/graphqlFunction.ts
58335
56627
  var recast6 = __toESM(require_main2(), 1);
58336
56628
  var AST6 = recast6.types.builders;
58337
- async function runtimeGenerator(config2, docs) {
58338
- await Promise.all([
58339
- fs_exports.recursiveCopy(config2.runtimeSource, config2.runtimeDirectory, {
58340
- [path_exports.join(config2.runtimeSource, "lib", "config.js")]: (content) => {
58341
- const configFilePath = path_exports.join(config2.runtimeDirectory, "lib", "config.js");
58342
- const relativePath = path_exports.relative(path_exports.dirname(configFilePath), config2.filepath);
58343
- return content.replace("HOUDINI_CONFIG_PATH", relativePath);
58344
- },
58345
- [path_exports.join(config2.runtimeSource, "lib", "constants.js")]: (content) => {
58346
- return content.replace("SITE_URL", siteURL);
58347
- }
58348
- }),
58349
- ...config2.plugins.filter((plugin) => plugin.include_runtime).map((plugin) => generatePluginRuntime(config2, plugin))
58350
- ]);
56629
+ async function generateGraphqlReturnTypes(config2, docs) {
58351
56630
  const indexPath = path_exports.join(config2.runtimeDirectory, "index.d.ts");
58352
- const contents = await parseJS(await fs_exports.readFile(indexPath) || "");
56631
+ const fileContent = await fs_exports.readFile(indexPath) || "";
56632
+ const contents = await parseJS(fileContent);
58353
56633
  const graphql_tag_return = config2.plugins.find(
58354
56634
  (plugin) => plugin.graphql_tag_return
58355
56635
  )?.graphql_tag_return;
58356
- if (graphql_tag_return && contents) {
58357
- const overloaded_returns = {};
58358
- for (const doc of docs) {
58359
- const return_value = graphql_tag_return({
58360
- config: config2,
58361
- doc,
58362
- ensure_import({ identifier, module }) {
58363
- ensureImports({
58364
- config: config2,
58365
- body: contents.script.body,
58366
- sourceModule: module,
58367
- import: [identifier]
58368
- });
58369
- }
58370
- });
58371
- if (return_value) {
58372
- overloaded_returns[doc.originalString] = return_value;
56636
+ if (!graphql_tag_return || !contents) {
56637
+ return fileContent;
56638
+ }
56639
+ const overloaded_returns = {};
56640
+ for (const doc of docs) {
56641
+ const return_value = graphql_tag_return({
56642
+ config: config2,
56643
+ doc,
56644
+ ensure_import({ identifier, module }) {
56645
+ ensureImports({
56646
+ config: config2,
56647
+ body: contents.script.body,
56648
+ sourceModule: module,
56649
+ import: [identifier]
56650
+ });
58373
56651
  }
56652
+ });
56653
+ if (return_value) {
56654
+ overloaded_returns[doc.originalString] = return_value;
58374
56655
  }
58375
- if (Object.keys(overloaded_returns).length > 0) {
58376
- for (const [i, expression] of (contents?.script.body ?? []).entries()) {
58377
- if (expression.type !== "ExportNamedDeclaration" || expression.declaration?.type !== "TSDeclareFunction" || expression.declaration.id?.name !== "graphql") {
58378
- continue;
58379
- }
58380
- for (const [queryString, returnValue] of Object.entries(overloaded_returns)) {
58381
- const input = AST6.identifier("str");
58382
- input.typeAnnotation = AST6.tsTypeAnnotation(
58383
- AST6.tsLiteralType(AST6.stringLiteral(queryString))
58384
- );
58385
- contents?.script.body.splice(
58386
- i,
58387
- 0,
58388
- AST6.exportNamedDeclaration(
58389
- AST6.tsDeclareFunction(
58390
- AST6.identifier("graphql"),
58391
- [input],
58392
- AST6.tsTypeAnnotation(
58393
- AST6.tsTypeReference(AST6.identifier(returnValue))
58394
- )
58395
- )
56656
+ }
56657
+ if (Object.keys(overloaded_returns).length > 0) {
56658
+ for (const [i, expression] of (contents?.script.body ?? []).entries()) {
56659
+ if (expression.type !== "ExportNamedDeclaration" || expression.declaration?.type !== "TSDeclareFunction" || expression.declaration.id?.name !== "graphql") {
56660
+ continue;
56661
+ }
56662
+ for (const [queryString, returnValue] of Object.entries(overloaded_returns)) {
56663
+ const input = AST6.identifier("str");
56664
+ input.typeAnnotation = AST6.tsTypeAnnotation(
56665
+ AST6.tsLiteralType(AST6.stringLiteral(queryString))
56666
+ );
56667
+ contents?.script.body.splice(
56668
+ i,
56669
+ 0,
56670
+ AST6.exportNamedDeclaration(
56671
+ AST6.tsDeclareFunction(
56672
+ AST6.identifier("graphql"),
56673
+ [input],
56674
+ AST6.tsTypeAnnotation(AST6.tsTypeReference(AST6.identifier(returnValue)))
58396
56675
  )
58397
- );
58398
- }
58399
- break;
56676
+ )
56677
+ );
58400
56678
  }
58401
- await fs_exports.writeFile(indexPath, recast6.prettyPrint(contents.script).code);
56679
+ break;
58402
56680
  }
56681
+ await fs_exports.writeFile(indexPath, recast6.prettyPrint(contents.script).code);
58403
56682
  }
58404
56683
  }
56684
+
56685
+ // src/codegen/generators/runtime/injectPlugins.ts
56686
+ async function injectPlugins({
56687
+ config: config2,
56688
+ content,
56689
+ importStatement,
56690
+ exportStatement
56691
+ }) {
56692
+ const client_plugins = config2.plugins.filter((plugin) => plugin.client_plugins).reduce((acc, plugin) => {
56693
+ let plugins = plugin.client_plugins;
56694
+ if (typeof plugins === "function") {
56695
+ plugins = plugins(config2, config2.pluginConfig(plugin.name));
56696
+ }
56697
+ return [...acc, ...Object.entries(plugins)];
56698
+ }, []);
56699
+ return client_plugins.length > 0 ? `
56700
+ ${client_plugins.map((plugin, i) => importStatement(plugin[0], `plugin${i}`))}
56701
+
56702
+ const plugins = [
56703
+ ${client_plugins.map((plugin, i) => {
56704
+ const suffix = plugin[1] !== null ? `(${JSON.stringify(plugin[1])})` : "";
56705
+ return `plugin${i}${suffix}`;
56706
+ }).join(",\n")}
56707
+ ]
56708
+
56709
+ ${exportStatement("plugins")}
56710
+ ` : content;
56711
+ }
56712
+
56713
+ // src/codegen/generators/runtime/pluginIndex.ts
56714
+ async function generatePluginIndex({
56715
+ config: config2,
56716
+ exportStatement
56717
+ }) {
56718
+ const indexFile = `${exportStatement("../runtime/client/plugins/index.js")}
56719
+ `;
56720
+ const typedefs = `export * from '../runtime/client/plugins'`;
56721
+ await fs_exports.mkdirp(config2.pluginRootDirectory);
56722
+ await Promise.all([
56723
+ fs_exports.writeFile(path_exports.join(config2.pluginRootDirectory, "index.js"), indexFile),
56724
+ fs_exports.writeFile(path_exports.join(config2.pluginRootDirectory, "index.d.ts"), typedefs)
56725
+ ]);
56726
+ }
56727
+
56728
+ // src/codegen/generators/runtime/index.ts
56729
+ async function runtimeGenerator(config2, docs) {
56730
+ const importStatement = config2.module === "commonjs" ? importDefaultFrom : (where, as) => `import ${as} from '${where}'`;
56731
+ const exportStatement = config2.module === "commonjs" ? exportDefault : (as) => `export default ${as}`;
56732
+ const exportStar = config2.module === "commonjs" ? exportStarFrom : (where) => `export * from '${where}'`;
56733
+ await Promise.all([
56734
+ fs_exports.recursiveCopy(config2.runtimeSource, config2.runtimeDirectory, {
56735
+ [path_exports.join(config2.runtimeSource, "lib", "constants.js")]: (content) => {
56736
+ return content.replace("SITE_URL", siteURL);
56737
+ },
56738
+ [path_exports.join(config2.runtimeSource, "imports", "config.js")]: (content) => {
56739
+ const configFilePath = path_exports.join(config2.runtimeDirectory, "imports", "config.js");
56740
+ const relativePath = path_exports.relative(path_exports.dirname(configFilePath), config2.filepath);
56741
+ return `${importStatement(relativePath, "config")}
56742
+ ${exportStatement("config")}
56743
+ `;
56744
+ },
56745
+ [path_exports.join(config2.runtimeSource, "client", "plugins", "injectedPlugins.js")]: (content) => injectPlugins({ config: config2, content, importStatement, exportStatement })
56746
+ }),
56747
+ ...config2.plugins.filter((plugin) => plugin.include_runtime).map((plugin) => generatePluginRuntime(config2, plugin)),
56748
+ generatePluginIndex({ config: config2, exportStatement: exportStar })
56749
+ ]);
56750
+ await generateGraphqlReturnTypes(config2, docs);
56751
+ }
58405
56752
  async function generatePluginRuntime(config2, plugin) {
58406
56753
  if (houdini_mode.is_testing) {
58407
56754
  return;
@@ -59467,6 +57814,7 @@ async function writeIndexFile2(config2, docs) {
59467
57814
  const export_star_from = ({ module }) => "\n" + (cjs ? exportStarFrom(module) : `export * from "${module}"`) + "\n";
59468
57815
  const export_default_as = ({ module, as }) => "\n" + (cjs ? exportDefaultFrom(module, as) : `export { default as ${as} } from "${module}"`) + "\n";
59469
57816
  body += [
57817
+ export_star_from({ module: "./" + path_exports.join(runtimeDir, "client") }),
59470
57818
  export_star_from({ module: runtimeDir }),
59471
57819
  export_star_from({ module: artifactDir }),
59472
57820
  export_star_from({ module: definitionsDir })
@@ -59579,7 +57927,7 @@ function flattenFragments(filepath, operation, fragments) {
59579
57927
  }
59580
57928
 
59581
57929
  // src/codegen/transforms/schema.ts
59582
- var graphql20 = __toESM(require_graphql2(), 1);
57930
+ var graphql19 = __toESM(require_graphql2(), 1);
59583
57931
  async function graphqlExtensions(config2, documents) {
59584
57932
  const internalSchema = `
59585
57933
  enum CachePolicy {
@@ -59657,19 +58005,19 @@ directive @${config2.maskEnableDirective} on FRAGMENT_SPREAD
59657
58005
  """
59658
58006
  directive @${config2.maskDisableDirective} on FRAGMENT_SPREAD
59659
58007
  `;
59660
- let currentSchema = graphql20.printSchema(config2.schema);
58008
+ let currentSchema = graphql19.printSchema(config2.schema);
59661
58009
  if (!currentSchema.includes(`directive @${config2.listDirective}`)) {
59662
58010
  currentSchema += internalSchema;
59663
58011
  }
59664
58012
  config2.newSchema += internalSchema;
59665
- config2.schema = graphql20.buildSchema(currentSchema);
58013
+ config2.schema = graphql19.buildSchema(currentSchema);
59666
58014
  }
59667
58015
 
59668
58016
  // src/codegen/transforms/typename.ts
59669
- var graphql21 = __toESM(require_graphql2(), 1);
58017
+ var graphql20 = __toESM(require_graphql2(), 1);
59670
58018
  async function addTypename(config2, documents) {
59671
58019
  for (const doc of documents) {
59672
- doc.document = graphql21.visit(doc.document, {
58020
+ doc.document = graphql20.visit(doc.document, {
59673
58021
  Field(node, key, parent, path2, ancestors) {
59674
58022
  if (!node.selectionSet) {
59675
58023
  return;
@@ -59681,7 +58029,7 @@ async function addTypename(config2, documents) {
59681
58029
  );
59682
58030
  const field = type.getFields()[node.name.value];
59683
58031
  const fieldType = unwrapType(config2, field.type).type;
59684
- if (graphql21.isInterfaceType(fieldType) || graphql21.isUnionType(fieldType)) {
58032
+ if (graphql20.isInterfaceType(fieldType) || graphql20.isUnionType(fieldType)) {
59685
58033
  return {
59686
58034
  ...node,
59687
58035
  selectionSet: {
@@ -59689,9 +58037,9 @@ async function addTypename(config2, documents) {
59689
58037
  selections: [
59690
58038
  ...node.selectionSet.selections,
59691
58039
  {
59692
- kind: graphql21.Kind.FIELD,
58040
+ kind: graphql20.Kind.FIELD,
59693
58041
  name: {
59694
- kind: graphql21.Kind.NAME,
58042
+ kind: graphql20.Kind.NAME,
59695
58043
  value: "__typename"
59696
58044
  }
59697
58045
  }
@@ -59705,10 +58053,10 @@ async function addTypename(config2, documents) {
59705
58053
  }
59706
58054
 
59707
58055
  // src/codegen/transforms/addID.ts
59708
- var graphql22 = __toESM(require_graphql2(), 1);
58056
+ var graphql21 = __toESM(require_graphql2(), 1);
59709
58057
  async function addID(config2, documents) {
59710
58058
  for (const doc of documents) {
59711
- doc.document = graphql22.visit(doc.document, {
58059
+ doc.document = graphql21.visit(doc.document, {
59712
58060
  Field(node, key, parent, path2, ancestors) {
59713
58061
  if (!node.selectionSet) {
59714
58062
  return;
@@ -59721,7 +58069,7 @@ async function addID(config2, documents) {
59721
58069
  const field = type.getFields()[node.name.value];
59722
58070
  const fieldType = unwrapType(config2, field.type).type;
59723
58071
  if (node.selectionSet?.selections.length > 0) {
59724
- if (!graphql22.isObjectType(fieldType) && !graphql22.isInterfaceType(fieldType)) {
58072
+ if (!graphql21.isObjectType(fieldType) && !graphql21.isInterfaceType(fieldType)) {
59725
58073
  return;
59726
58074
  }
59727
58075
  const keyFields = config2.keyFieldsForType(fieldType.name);
@@ -59736,9 +58084,9 @@ async function addID(config2, documents) {
59736
58084
  continue;
59737
58085
  }
59738
58086
  selections.push({
59739
- kind: graphql22.Kind.FIELD,
58087
+ kind: graphql21.Kind.FIELD,
59740
58088
  name: {
59741
- kind: graphql22.Kind.NAME,
58089
+ kind: graphql21.Kind.NAME,
59742
58090
  value: keyField
59743
58091
  }
59744
58092
  });
@@ -59757,8 +58105,8 @@ async function addID(config2, documents) {
59757
58105
  }
59758
58106
 
59759
58107
  // src/codegen/transforms/fragmentVariables.ts
59760
- var graphql23 = __toESM(require_graphql2(), 1);
59761
- var GraphqlKinds2 = graphql23.Kind;
58108
+ var graphql22 = __toESM(require_graphql2(), 1);
58109
+ var GraphqlKinds2 = graphql22.Kind;
59762
58110
  async function fragmentVariables(config2, documents) {
59763
58111
  const fragments = collectFragments(config2, documents);
59764
58112
  const generatedFragments = {};
@@ -59781,7 +58129,7 @@ async function fragmentVariables(config2, documents) {
59781
58129
  });
59782
58130
  }
59783
58131
  const doc = {
59784
- kind: graphql23.Kind.DOCUMENT,
58132
+ kind: graphql22.Kind.DOCUMENT,
59785
58133
  definitions: Object.values(generatedFragments)
59786
58134
  };
59787
58135
  documents.push({
@@ -59817,7 +58165,7 @@ function inlineFragmentArgs({
59817
58165
  filepath,
59818
58166
  document
59819
58167
  ).reduce((acc, arg) => ({ ...acc, [arg.name]: arg }), {});
59820
- const result = graphql23.visit(document, {
58168
+ const result = graphql22.visit(document, {
59821
58169
  FragmentSpread(node) {
59822
58170
  const { definition } = fragmentDefinitions[node.name.value];
59823
58171
  let { args, hash } = collectWithArguments(config2, filepath, node, scope);
@@ -59905,7 +58253,7 @@ function inlineFragmentArgs({
59905
58253
  });
59906
58254
  if (newName) {
59907
58255
  result.name = {
59908
- kind: graphql23.Kind.NAME,
58256
+ kind: graphql22.Kind.NAME,
59909
58257
  value: newName
59910
58258
  };
59911
58259
  }
@@ -60017,7 +58365,7 @@ function operationScope(operation) {
60017
58365
  }
60018
58366
 
60019
58367
  // src/codegen/validators/typeCheck.ts
60020
- var graphql24 = __toESM(require_graphql2(), 1);
58368
+ var graphql23 = __toESM(require_graphql2(), 1);
60021
58369
  async function typeCheck(config2, docs) {
60022
58370
  const errors = [];
60023
58371
  const freeLists = [];
@@ -60025,11 +58373,11 @@ async function typeCheck(config2, docs) {
60025
58373
  const listTypes = [];
60026
58374
  const fragments = {};
60027
58375
  for (const { document: parsed, filename } of docs) {
60028
- graphql24.visit(parsed, {
60029
- [graphql24.Kind.FRAGMENT_DEFINITION](definition) {
58376
+ graphql23.visit(parsed, {
58377
+ [graphql23.Kind.FRAGMENT_DEFINITION](definition) {
60030
58378
  fragments[definition.name.value] = definition;
60031
58379
  },
60032
- [graphql24.Kind.DIRECTIVE](directive, _, parent, __, ancestors) {
58380
+ [graphql23.Kind.DIRECTIVE](directive, _, parent, __, ancestors) {
60033
58381
  if (![config2.listDirective, config2.paginateDirective].includes(directive.name.value)) {
60034
58382
  return;
60035
58383
  }
@@ -60075,14 +58423,14 @@ async function typeCheck(config2, docs) {
60075
58423
  );
60076
58424
  return;
60077
58425
  }
60078
- if (graphql24.isListType(rootType) || graphql24.isNonNullType(rootType) && graphql24.isListType(rootType.ofType)) {
58426
+ if (graphql23.isListType(rootType) || graphql23.isNonNullType(rootType) && graphql23.isListType(rootType.ofType)) {
60079
58427
  needsParent = true;
60080
58428
  break;
60081
58429
  }
60082
- if (graphql24.isNonNullType(rootType) && "ofType" in rootType) {
58430
+ if (graphql23.isNonNullType(rootType) && "ofType" in rootType) {
60083
58431
  rootType = rootType.ofType;
60084
58432
  }
60085
- if (graphql24.isScalarType(rootType)) {
58433
+ if (graphql23.isScalarType(rootType)) {
60086
58434
  break;
60087
58435
  }
60088
58436
  rootType = rootType?.getFields()[parent2.name.value]?.type;
@@ -60158,9 +58506,9 @@ async function typeCheck(config2, docs) {
60158
58506
  );
60159
58507
  }
60160
58508
  let targetTypes = [type];
60161
- if (graphql24.isUnionType(type)) {
58509
+ if (graphql23.isUnionType(type)) {
60162
58510
  targetTypes = config2.schema.getPossibleTypes(type);
60163
- } else if (graphql24.isInterfaceType(type)) {
58511
+ } else if (graphql23.isInterfaceType(type)) {
60164
58512
  try {
60165
58513
  for (const key of config2.keyFieldsForType(type.name)) {
60166
58514
  if (!type.getFields()[key]) {
@@ -60198,13 +58546,13 @@ async function typeCheck(config2, docs) {
60198
58546
  if (errors.length > 0) {
60199
58547
  throw errors;
60200
58548
  }
60201
- const rules = (filepath) => [...graphql24.specifiedRules].filter(
58549
+ const rules = (filepath) => [...graphql23.specifiedRules].filter(
60202
58550
  (rule) => ![
60203
- graphql24.NoUnusedFragmentsRule,
60204
- graphql24.KnownFragmentNamesRule,
60205
- graphql24.ExecutableDefinitionsRule,
60206
- graphql24.KnownDirectivesRule,
60207
- graphql24.KnownArgumentNamesRule
58551
+ graphql23.NoUnusedFragmentsRule,
58552
+ graphql23.KnownFragmentNamesRule,
58553
+ graphql23.ExecutableDefinitionsRule,
58554
+ graphql23.KnownDirectivesRule,
58555
+ graphql23.KnownArgumentNamesRule
60208
58556
  ].includes(rule)
60209
58557
  ).concat(
60210
58558
  validateLists({
@@ -60223,7 +58571,7 @@ async function typeCheck(config2, docs) {
60223
58571
  noUnusedFragmentArguments(config2)
60224
58572
  );
60225
58573
  for (const { filename, document: parsed } of docs) {
60226
- for (const error of graphql24.validate(config2.schema, parsed, rules(filename))) {
58574
+ for (const error of graphql23.validate(config2.schema, parsed, rules(filename))) {
60227
58575
  errors.push(
60228
58576
  new HoudiniError({
60229
58577
  filepath: filename,
@@ -60249,7 +58597,7 @@ var validateLists = ({
60249
58597
  if (!config2.isListFragment(node.name.value)) {
60250
58598
  if (!fragments[node.name.value]) {
60251
58599
  ctx.reportError(
60252
- new graphql24.GraphQLError(
58600
+ new graphql23.GraphQLError(
60253
58601
  "Encountered unknown fragment: " + node.name.value
60254
58602
  )
60255
58603
  );
@@ -60259,7 +58607,7 @@ var validateLists = ({
60259
58607
  const listName = config2.listNameFromFragment(node.name.value);
60260
58608
  if (!lists.includes(listName)) {
60261
58609
  ctx.reportError(
60262
- new graphql24.GraphQLError(
58610
+ new graphql23.GraphQLError(
60263
58611
  "Encountered fragment referencing unknown list: " + listName
60264
58612
  )
60265
58613
  );
@@ -60284,7 +58632,7 @@ var validateLists = ({
60284
58632
  );
60285
58633
  if (parentArg) {
60286
58634
  ctx.reportError(
60287
- new graphql24.GraphQLError(
58635
+ new graphql23.GraphQLError(
60288
58636
  `@${config2.deprecatedlistDirectiveParentIDArg} should be defined only in it's own directive now`
60289
58637
  )
60290
58638
  );
@@ -60300,7 +58648,7 @@ var validateLists = ({
60300
58648
  return;
60301
58649
  }
60302
58650
  ctx.reportError(
60303
- new graphql24.GraphQLError(
58651
+ new graphql23.GraphQLError(
60304
58652
  `For this list fragment, you need to add or @${config2.listParentDirective} or @${config2.listAllListsDirective} directive to specify the behavior`
60305
58653
  )
60306
58654
  );
@@ -60310,7 +58658,7 @@ var validateLists = ({
60310
58658
  const directiveName = node.name.value;
60311
58659
  if (directiveName === "connection") {
60312
58660
  ctx.reportError(
60313
- new graphql24.GraphQLError(
58661
+ new graphql23.GraphQLError(
60314
58662
  "@connection was renamed to @list. Please change your components. If you were using `cache.connection` in your components, you will need to update that to `cache.list` too."
60315
58663
  )
60316
58664
  );
@@ -60319,7 +58667,7 @@ var validateLists = ({
60319
58667
  if (!config2.isInternalDirective(node)) {
60320
58668
  if (!config2.schema.getDirective(directiveName)) {
60321
58669
  ctx.reportError(
60322
- new graphql24.GraphQLError(
58670
+ new graphql23.GraphQLError(
60323
58671
  "Encountered unknown directive: " + directiveName
60324
58672
  )
60325
58673
  );
@@ -60328,7 +58676,7 @@ var validateLists = ({
60328
58676
  }
60329
58677
  if (config2.isListOperationDirective(directiveName) && !listTypes.includes(config2.listNameFromDirective(directiveName))) {
60330
58678
  ctx.reportError(
60331
- new graphql24.GraphQLError(
58679
+ new graphql23.GraphQLError(
60332
58680
  "Encountered directive referencing unknown list: " + directiveName
60333
58681
  )
60334
58682
  );
@@ -60339,7 +58687,7 @@ var validateLists = ({
60339
58687
  };
60340
58688
  function knownArguments(config2) {
60341
58689
  return function(ctx) {
60342
- const nativeValidator = graphql24.KnownArgumentNamesRule(ctx);
58690
+ const nativeValidator = graphql23.KnownArgumentNamesRule(ctx);
60343
58691
  return {
60344
58692
  ...nativeValidator,
60345
58693
  Directive(directiveNode) {
@@ -60372,7 +58720,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
60372
58720
  for (const arg of node.arguments || []) {
60373
58721
  if (arg.value.kind !== "ObjectValue") {
60374
58722
  ctx.reportError(
60375
- new graphql24.GraphQLError("values in @arguments must be an object")
58723
+ new graphql23.GraphQLError("values in @arguments must be an object")
60376
58724
  );
60377
58725
  return;
60378
58726
  }
@@ -60382,13 +58730,13 @@ function validateFragmentArguments(config2, filepath, fragments) {
60382
58730
  );
60383
58731
  if (!typeArg) {
60384
58732
  ctx.reportError(
60385
- new graphql24.GraphQLError("missing type field for @arguments directive")
58733
+ new graphql23.GraphQLError("missing type field for @arguments directive")
60386
58734
  );
60387
58735
  return;
60388
58736
  }
60389
- if (typeArg.value.kind !== graphql24.Kind.STRING) {
58737
+ if (typeArg.value.kind !== graphql23.Kind.STRING) {
60390
58738
  ctx.reportError(
60391
- new graphql24.GraphQLError("type field to @arguments must be a string")
58739
+ new graphql23.GraphQLError("type field to @arguments must be a string")
60392
58740
  );
60393
58741
  return;
60394
58742
  }
@@ -60401,7 +58749,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
60401
58749
  );
60402
58750
  if (typeArg.value.value !== defaultValueType) {
60403
58751
  ctx.reportError(
60404
- new graphql24.GraphQLError(
58752
+ new graphql23.GraphQLError(
60405
58753
  `Invalid default value provided for ${arg.name.value}. Expected ${typeArg.value.value}, found ${defaultValueType}`
60406
58754
  )
60407
58755
  );
@@ -60419,7 +58767,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
60419
58767
  try {
60420
58768
  args = fragmentArguments(config2, filepath, fragments[fragmentName]);
60421
58769
  } catch (e) {
60422
- ctx.reportError(new graphql24.GraphQLError(e.message));
58770
+ ctx.reportError(new graphql23.GraphQLError(e.message));
60423
58771
  return;
60424
58772
  }
60425
58773
  fragmentArguments2[fragmentName] = args;
@@ -60442,7 +58790,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
60442
58790
  );
60443
58791
  if (missing.length > 0) {
60444
58792
  ctx.reportError(
60445
- new graphql24.GraphQLError(
58793
+ new graphql23.GraphQLError(
60446
58794
  "The following arguments are missing from this fragment: " + JSON.stringify(missing)
60447
58795
  )
60448
58796
  );
@@ -60453,7 +58801,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
60453
58801
  );
60454
58802
  if (unknown.length > 0) {
60455
58803
  ctx.reportError(
60456
- new graphql24.GraphQLError(
58804
+ new graphql23.GraphQLError(
60457
58805
  "Encountered unknown arguments: " + JSON.stringify(unknown)
60458
58806
  )
60459
58807
  );
@@ -60465,7 +58813,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
60465
58813
  ]
60466
58814
  );
60467
58815
  for (const [applied, target] of zipped) {
60468
- if (applied.value.kind === graphql24.Kind.VARIABLE || applied.value.kind === graphql24.Kind.LIST || applied.value.kind === graphql24.Kind.OBJECT) {
58816
+ if (applied.value.kind === graphql23.Kind.VARIABLE || applied.value.kind === graphql23.Kind.LIST || applied.value.kind === graphql23.Kind.OBJECT) {
60469
58817
  continue;
60470
58818
  }
60471
58819
  const appliedType = applied.value.kind.substring(
@@ -60474,7 +58822,7 @@ function validateFragmentArguments(config2, filepath, fragments) {
60474
58822
  );
60475
58823
  if (appliedType !== target) {
60476
58824
  ctx.reportError(
60477
- new graphql24.GraphQLError(
58825
+ new graphql23.GraphQLError(
60478
58826
  `Invalid argument type. Expected ${target}, found ${appliedType}`
60479
58827
  )
60480
58828
  );
@@ -60495,7 +58843,7 @@ function paginateArgs(config2, filepath) {
60495
58843
  }
60496
58844
  if (alreadyPaginated) {
60497
58845
  ctx.reportError(
60498
- new graphql24.GraphQLError(
58846
+ new graphql23.GraphQLError(
60499
58847
  `@${config2.paginateDirective} can only appear in a document once.`
60500
58848
  )
60501
58849
  );
@@ -60510,7 +58858,7 @@ function paginateArgs(config2, filepath) {
60510
58858
  const hasRequiredArgs = definitionArgs.find((arg) => arg.required);
60511
58859
  if (hasRequiredArgs) {
60512
58860
  ctx.reportError(
60513
- new graphql24.GraphQLError(
58861
+ new graphql23.GraphQLError(
60514
58862
  "@paginate cannot appear on a document with required args"
60515
58863
  )
60516
58864
  );
@@ -60542,14 +58890,14 @@ function paginateArgs(config2, filepath) {
60542
58890
  const backwards = appliedArgs.has("last");
60543
58891
  if (!forward && !backwards) {
60544
58892
  ctx.reportError(
60545
- new graphql24.GraphQLError(
58893
+ new graphql23.GraphQLError(
60546
58894
  "A field with cursor-based pagination must have a first or last argument"
60547
58895
  )
60548
58896
  );
60549
58897
  }
60550
58898
  if (forward && backwards) {
60551
58899
  ctx.reportError(
60552
- new graphql24.GraphQLError(
58900
+ new graphql23.GraphQLError(
60553
58901
  `A field with cursor pagination cannot go forwards an backwards simultaneously`
60554
58902
  )
60555
58903
  );
@@ -60563,7 +58911,7 @@ function paginateArgs(config2, filepath) {
60563
58911
  );
60564
58912
  if (!appliedLimitArg) {
60565
58913
  ctx.reportError(
60566
- new graphql24.GraphQLError(
58914
+ new graphql23.GraphQLError(
60567
58915
  "A field with offset-based pagination must have a limit argument"
60568
58916
  )
60569
58917
  );
@@ -60579,20 +58927,20 @@ function noUnusedFragmentArguments(config2) {
60579
58927
  const args = /* @__PURE__ */ new Set();
60580
58928
  return {
60581
58929
  enter(node) {
60582
- if (node.kind === graphql24.Kind.FRAGMENT_DEFINITION) {
58930
+ if (node.kind === graphql23.Kind.FRAGMENT_DEFINITION) {
60583
58931
  const definitionArguments = node.directives?.filter((directive) => directive.name.value === config2.argumentsDirective).flatMap((directive) => directive.arguments);
60584
58932
  for (const arg of definitionArguments?.map((arg2) => arg2?.name.value) || []) {
60585
58933
  args.add(arg);
60586
58934
  }
60587
- } else if (node.kind === graphql24.Kind.VARIABLE) {
58935
+ } else if (node.kind === graphql23.Kind.VARIABLE) {
60588
58936
  args.delete(node.name.value);
60589
58937
  }
60590
58938
  },
60591
58939
  leave(node) {
60592
- if (node.kind === graphql24.Kind.FRAGMENT_DEFINITION) {
58940
+ if (node.kind === graphql23.Kind.FRAGMENT_DEFINITION) {
60593
58941
  if (args.size > 0) {
60594
58942
  ctx.reportError(
60595
- new graphql24.GraphQLError(
58943
+ new graphql23.GraphQLError(
60596
58944
  "Encountered unused fragment arguments: " + [...args].join(",")
60597
58945
  )
60598
58946
  );
@@ -60628,7 +58976,7 @@ function nodeDirectives(config2, directives) {
60628
58976
  if (definition.kind === "OperationDefinition") {
60629
58977
  if (definition.operation !== "query") {
60630
58978
  ctx.reportError(
60631
- new graphql24.GraphQLError(
58979
+ new graphql23.GraphQLError(
60632
58980
  `@${node.name.value} must fall on a fragment or query document`
60633
58981
  )
60634
58982
  );
@@ -60640,7 +58988,7 @@ function nodeDirectives(config2, directives) {
60640
58988
  }
60641
58989
  if (!possibleNodes.includes(definitionType)) {
60642
58990
  ctx.reportError(
60643
- new graphql24.GraphQLError(paginateOnNonNodeMessage(config2, node.name.value))
58991
+ new graphql23.GraphQLError(paginateOnNonNodeMessage(config2, node.name.value))
60644
58992
  );
60645
58993
  }
60646
58994
  }
@@ -60659,7 +59007,7 @@ function checkMutationOperation(config2) {
60659
59007
  );
60660
59008
  if (append && prepend) {
60661
59009
  ctx.reportError(
60662
- new graphql24.GraphQLError(
59010
+ new graphql23.GraphQLError(
60663
59011
  `You can't apply both @${config2.listPrependDirective} and @${config2.listAppendDirective} at the same time`
60664
59012
  )
60665
59013
  );
@@ -60673,7 +59021,7 @@ function checkMutationOperation(config2) {
60673
59021
  );
60674
59022
  if (parentId && allLists) {
60675
59023
  ctx.reportError(
60676
- new graphql24.GraphQLError(
59024
+ new graphql23.GraphQLError(
60677
59025
  `You can't apply both @${config2.listParentDirective} and @${config2.listAllListsDirective} at the same time`
60678
59026
  )
60679
59027
  );
@@ -60695,7 +59043,7 @@ function checkMaskDirective(config2) {
60695
59043
  );
60696
59044
  if (maskEnableDirective && maskDisableDirective) {
60697
59045
  ctx.reportError(
60698
- new graphql24.GraphQLError(
59046
+ new graphql23.GraphQLError(
60699
59047
  `You can't apply both @${config2.maskEnableDirective} and @${config2.maskDisableDirective} at the same time`
60700
59048
  )
60701
59049
  );
@@ -60711,7 +59059,7 @@ function getAndVerifyNodeInterface(config2) {
60711
59059
  if (!nodeInterface) {
60712
59060
  return null;
60713
59061
  }
60714
- if (!graphql24.isInterfaceType(nodeInterface)) {
59062
+ if (!graphql23.isInterfaceType(nodeInterface)) {
60715
59063
  displayInvalidNodeFieldMessage(config2.logLevel);
60716
59064
  return null;
60717
59065
  }
@@ -60809,11 +59157,11 @@ async function uniqueDocumentNames(config2, docs) {
60809
59157
  }
60810
59158
 
60811
59159
  // src/codegen/validators/noIDAlias.ts
60812
- var graphql25 = __toESM(require_graphql2(), 1);
59160
+ var graphql24 = __toESM(require_graphql2(), 1);
60813
59161
  async function noIDAlias(config2, docs) {
60814
59162
  const errors = [];
60815
59163
  for (const { filename, document } of docs) {
60816
- graphql25.visit(document, {
59164
+ graphql24.visit(document, {
60817
59165
  Field(node, _, __, ___, ancestors) {
60818
59166
  const fieldType = parentTypeFromAncestors(config2.schema, filename, ancestors).name;
60819
59167
  if (config2.keyFieldsForType(fieldType).includes(node.alias?.value || "")) {
@@ -61011,12 +59359,17 @@ async function processJSFile(config2, contents) {
61011
59359
  return documents;
61012
59360
  }
61013
59361
  async function processGraphQLDocument(config2, filepath, document) {
61014
- const parsedDoc = graphql26.parse(document);
59362
+ try {
59363
+ var parsedDoc = graphql25.parse(document);
59364
+ } catch (e) {
59365
+ console.log("error parsing!!");
59366
+ throw e;
59367
+ }
61015
59368
  const operations = parsedDoc.definitions.filter(
61016
- ({ kind: kind2 }) => kind2 === graphql26.Kind.OPERATION_DEFINITION
59369
+ ({ kind: kind2 }) => kind2 === graphql25.Kind.OPERATION_DEFINITION
61017
59370
  );
61018
59371
  const fragments = parsedDoc.definitions.filter(
61019
- ({ kind: kind2 }) => kind2 === graphql26.Kind.FRAGMENT_DEFINITION
59372
+ ({ kind: kind2 }) => kind2 === graphql25.Kind.FRAGMENT_DEFINITION
61020
59373
  );
61021
59374
  if (operations.length > 1) {
61022
59375
  throw new HoudiniError({