houdini 1.0.7 → 1.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -37667,14 +37667,18 @@ var require_lib3 = __commonJS({
37667
37667
  }
37668
37668
  });
37669
37669
 
37670
- // ../../node_modules/.pnpm/tslib@2.4.1/node_modules/tslib/tslib.js
37670
+ // ../../node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.js
37671
37671
  var require_tslib = __commonJS({
37672
- "../../node_modules/.pnpm/tslib@2.4.1/node_modules/tslib/tslib.js"(exports, module2) {
37672
+ "../../node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.js"(exports, module2) {
37673
37673
  var __extends;
37674
37674
  var __assign;
37675
37675
  var __rest;
37676
37676
  var __decorate;
37677
37677
  var __param;
37678
+ var __esDecorate;
37679
+ var __runInitializers;
37680
+ var __propKey;
37681
+ var __setFunctionName;
37678
37682
  var __metadata;
37679
37683
  var __awaiter;
37680
37684
  var __generator;
@@ -37771,6 +37775,65 @@ var require_tslib = __commonJS({
37771
37775
  decorator(target, key, paramIndex);
37772
37776
  };
37773
37777
  };
37778
+ __esDecorate = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
37779
+ function accept(f) {
37780
+ if (f !== void 0 && typeof f !== "function")
37781
+ throw new TypeError("Function expected");
37782
+ return f;
37783
+ }
37784
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
37785
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
37786
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
37787
+ var _, done = false;
37788
+ for (var i = decorators.length - 1; i >= 0; i--) {
37789
+ var context = {};
37790
+ for (var p in contextIn)
37791
+ context[p] = p === "access" ? {} : contextIn[p];
37792
+ for (var p in contextIn.access)
37793
+ context.access[p] = contextIn.access[p];
37794
+ context.addInitializer = function(f) {
37795
+ if (done)
37796
+ throw new TypeError("Cannot add initializers after decoration has completed");
37797
+ extraInitializers.push(accept(f || null));
37798
+ };
37799
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
37800
+ if (kind === "accessor") {
37801
+ if (result === void 0)
37802
+ continue;
37803
+ if (result === null || typeof result !== "object")
37804
+ throw new TypeError("Object expected");
37805
+ if (_ = accept(result.get))
37806
+ descriptor.get = _;
37807
+ if (_ = accept(result.set))
37808
+ descriptor.set = _;
37809
+ if (_ = accept(result.init))
37810
+ initializers.push(_);
37811
+ } else if (_ = accept(result)) {
37812
+ if (kind === "field")
37813
+ initializers.push(_);
37814
+ else
37815
+ descriptor[key] = _;
37816
+ }
37817
+ }
37818
+ if (target)
37819
+ Object.defineProperty(target, contextIn.name, descriptor);
37820
+ done = true;
37821
+ };
37822
+ __runInitializers = function(thisArg, initializers, value) {
37823
+ var useValue = arguments.length > 2;
37824
+ for (var i = 0; i < initializers.length; i++) {
37825
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
37826
+ }
37827
+ return useValue ? value : void 0;
37828
+ };
37829
+ __propKey = function(x) {
37830
+ return typeof x === "symbol" ? x : "".concat(x);
37831
+ };
37832
+ __setFunctionName = function(f, name, prefix) {
37833
+ if (typeof name === "symbol")
37834
+ name = name.description ? "[".concat(name.description, "]") : "";
37835
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
37836
+ };
37774
37837
  __metadata = function(metadataKey, metadataValue) {
37775
37838
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
37776
37839
  return Reflect.metadata(metadataKey, metadataValue);
@@ -38005,7 +38068,7 @@ var require_tslib = __commonJS({
38005
38068
  }, i;
38006
38069
  function verb(n, f) {
38007
38070
  i[n] = o[n] ? function(v) {
38008
- return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v;
38071
+ return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v;
38009
38072
  } : f;
38010
38073
  }
38011
38074
  };
@@ -38083,6 +38146,10 @@ var require_tslib = __commonJS({
38083
38146
  exporter("__rest", __rest);
38084
38147
  exporter("__decorate", __decorate);
38085
38148
  exporter("__param", __param);
38149
+ exporter("__esDecorate", __esDecorate);
38150
+ exporter("__runInitializers", __runInitializers);
38151
+ exporter("__propKey", __propKey);
38152
+ exporter("__setFunctionName", __setFunctionName);
38086
38153
  exporter("__metadata", __metadata);
38087
38154
  exporter("__awaiter", __awaiter);
38088
38155
  exporter("__generator", __generator);
@@ -54203,6 +54270,10 @@ var CachePolicy = {
54203
54270
  NetworkOnly: "NetworkOnly",
54204
54271
  CacheAndNetwork: "CacheAndNetwork"
54205
54272
  };
54273
+ var PaginateMode = {
54274
+ Infinite: "Infinite",
54275
+ SinglePage: "SinglePage"
54276
+ };
54206
54277
  var ArtifactKind = {
54207
54278
  Query: "HoudiniQuery",
54208
54279
  Subscription: "HoudiniSubscription",
@@ -58008,6 +58079,7 @@ async function paginate(config2, documents) {
58008
58079
  let refetchQueryName = "";
58009
58080
  let nodeQuery = false;
58010
58081
  let fragment = "";
58082
+ let paginateMode = config2.defaultPaginateMode;
58011
58083
  doc.document = graphql9.visit(doc.document, {
58012
58084
  OperationDefinition(node) {
58013
58085
  if (node.operation !== "query") {
@@ -58073,6 +58145,14 @@ async function paginate(config2, documents) {
58073
58145
  }
58074
58146
  },
58075
58147
  Directive(node) {
58148
+ if (node.name.value === config2.paginateDirective) {
58149
+ const paginateModeArg = node?.arguments?.find(
58150
+ (arg) => arg.name.value === config2.paginateModeArg
58151
+ );
58152
+ if (paginateModeArg && paginateModeArg.value.kind === "EnumValue") {
58153
+ paginateMode = paginateModeArg.value.value;
58154
+ }
58155
+ }
58076
58156
  if (node.name.value !== config2.argumentsDirective) {
58077
58157
  return;
58078
58158
  }
@@ -58117,7 +58197,8 @@ async function paginate(config2, documents) {
58117
58197
  targetType,
58118
58198
  paginated: true,
58119
58199
  direction,
58120
- start
58200
+ start,
58201
+ mode: paginateMode
58121
58202
  };
58122
58203
  if (!fragment) {
58123
58204
  continue;
@@ -58466,7 +58547,9 @@ async function addListFragments(config2, documents) {
58466
58547
  doc.document = graphql10.visit(doc.document, {
58467
58548
  Directive(node, key, parent, path2, ancestors) {
58468
58549
  if ([config2.listDirective, config2.paginateDirective].includes(node.name.value)) {
58469
- const nameArg = node.arguments?.find((arg) => arg.name.value === "name");
58550
+ const nameArg = node.arguments?.find(
58551
+ (arg) => arg.name.value === config2.listOrPaginateNameArg
58552
+ );
58470
58553
  let error = {
58471
58554
  ...new graphql10.GraphQLError(
58472
58555
  "",
@@ -58766,14 +58849,23 @@ function fieldKey(config2, field) {
58766
58849
  const attributeName = field.alias?.value || field.name.value;
58767
58850
  const printed = graphql11.print(field);
58768
58851
  const secondParse = graphql11.parse(`{${printed}}`).definitions[0].selectionSet.selections[0];
58769
- const paginated = !!field.directives?.find(
58852
+ let paginateMode = config2.defaultPaginateMode;
58853
+ const paginatedDirective = field.directives?.find(
58770
58854
  (directive) => directive.name.value === config2.paginateDirective
58771
58855
  );
58772
- const paginationArgs = ["first", "after", "last", "before", "limit", "offset"];
58856
+ if (paginatedDirective) {
58857
+ const paginateModeArg = paginatedDirective?.arguments?.find(
58858
+ (arg) => arg.name.value === config2.paginateModeArg
58859
+ );
58860
+ if (paginateModeArg && paginateModeArg.value.kind === "EnumValue") {
58861
+ paginateMode = paginateModeArg.value.value;
58862
+ }
58863
+ }
58864
+ const paginationArgs = paginateMode === "SinglePage" ? [] : ["first", "after", "last", "before", "limit", "offset"];
58773
58865
  const argObj = (secondParse.arguments || []).reduce((acc, arg) => {
58774
58866
  const start = arg.value.loc?.start;
58775
58867
  const end = arg.value.loc?.end;
58776
- if (paginated && paginationArgs.includes(arg.name.value)) {
58868
+ if (paginatedDirective && paginationArgs.includes(arg.name.value)) {
58777
58869
  return acc;
58778
58870
  }
58779
58871
  if (!start || !end) {
@@ -58787,7 +58879,7 @@ function fieldKey(config2, field) {
58787
58879
  const args = Object.keys(argObj);
58788
58880
  args.sort();
58789
58881
  let key = Object.values(argObj).length > 0 ? `${attributeName}(${args.map((key2) => `${key2}: ${argObj[key2]}`).join(", ")})` : attributeName;
58790
- if (paginated) {
58882
+ if (paginatedDirective) {
58791
58883
  key = key + "::paginated";
58792
58884
  }
58793
58885
  return key;
@@ -58927,7 +59019,9 @@ function selection({
58927
59019
  const listDirective = field.directives?.find(
58928
59020
  (directive) => [config2.listDirective, config2.paginateDirective].includes(directive.name.value)
58929
59021
  );
58930
- const nameArg = listDirective?.arguments?.find((arg) => arg.name.value === "name");
59022
+ const nameArg = listDirective?.arguments?.find(
59023
+ (arg) => arg.name.value === config2.listOrPaginateNameArg
59024
+ );
58931
59025
  if (nameArg && nameArg.value.kind === "StringValue") {
58932
59026
  const { connection, type: connectionType } = connectionSelection(
58933
59027
  config2,
@@ -59046,7 +59140,7 @@ function artifactGenerator(stats) {
59046
59140
  return;
59047
59141
  }
59048
59142
  const nameArg = node.arguments?.find(
59049
- (arg) => arg.name.value === config2.listNameArg
59143
+ (arg) => arg.name.value === config2.listOrPaginateNameArg
59050
59144
  );
59051
59145
  if (!nameArg || nameArg.value.kind !== "StringValue") {
59052
59146
  throw new HoudiniError({
@@ -60416,7 +60510,9 @@ function listDefinitions(config2, body, docs) {
60416
60510
  if (![config2.listDirective, config2.paginateDirective].includes(node.name.value)) {
60417
60511
  return;
60418
60512
  }
60419
- const nameArg = node.arguments?.find((arg) => arg.name.value === "name");
60513
+ const nameArg = node.arguments?.find(
60514
+ (arg) => arg.name.value === config2.listOrPaginateNameArg
60515
+ );
60420
60516
  const nameValue = nameArg?.value?.value || "";
60421
60517
  if (!nameValue || visitedLists.has(nameValue)) {
60422
60518
  return;
@@ -60741,17 +60837,22 @@ enum CachePolicy {
60741
60837
  ${CachePolicy.NetworkOnly}
60742
60838
  }
60743
60839
 
60840
+ enum PaginateMode {
60841
+ ${PaginateMode.Infinite}
60842
+ ${PaginateMode.SinglePage}
60843
+ }
60844
+
60744
60845
  """
60745
60846
  @${config2.listDirective} is used to mark a field for the runtime as a place to add or remove
60746
60847
  entities in mutations
60747
60848
  """
60748
- directive @${config2.listDirective}(${config2.listNameArg}: String!, connection: Boolean) on FIELD
60849
+ directive @${config2.listDirective}(${config2.listOrPaginateNameArg}: String!, connection: Boolean) on FIELD
60749
60850
 
60750
60851
  """
60751
60852
  @${config2.paginateDirective} is used to to mark a field for pagination.
60752
60853
  More info in the [doc](${siteURL}/guides/pagination).
60753
60854
  """
60754
- directive @${config2.paginateDirective}(${config2.paginateNameArg}: String) on FIELD
60855
+ directive @${config2.paginateDirective}(${config2.listOrPaginateNameArg}: String, ${config2.paginateModeArg}: PaginateMode) on FIELD
60755
60856
 
60756
60857
  """
60757
60858
  @${config2.listPrependDirective} is used to tell the runtime to add the result to the end of the list
@@ -61017,7 +61118,7 @@ async function typeCheck(config2, docs) {
61017
61118
  }
61018
61119
  needsParent = needsParent || definition.kind === "FragmentDefinition";
61019
61120
  const nameArg = directive.arguments?.find(
61020
- ({ name }) => name.value === config2.listNameArg
61121
+ ({ name }) => name.value === config2.listOrPaginateNameArg
61021
61122
  );
61022
61123
  if (!nameArg) {
61023
61124
  if (directive.name.value === config2.listDirective) {
@@ -61497,7 +61598,14 @@ function paginateArgs(config2, filepath) {
61497
61598
  )
61498
61599
  );
61499
61600
  }
61500
- if (forward && backwards) {
61601
+ const paginateModeArg = node?.arguments?.find(
61602
+ (arg) => arg.name.value === config2.paginateModeArg
61603
+ );
61604
+ let paginateMode = config2.defaultPaginateMode;
61605
+ if (paginateModeArg && paginateModeArg.value.kind === "EnumValue") {
61606
+ paginateMode = paginateModeArg.value.value;
61607
+ }
61608
+ if (forward && backwards && paginateMode === "Infinite") {
61501
61609
  ctx.reportError(
61502
61610
  new graphql24.GraphQLError(
61503
61611
  `A field with cursor pagination cannot go forwards an backwards simultaneously`
@@ -37672,14 +37672,18 @@ var require_lib3 = __commonJS({
37672
37672
  }
37673
37673
  });
37674
37674
 
37675
- // ../../node_modules/.pnpm/tslib@2.4.1/node_modules/tslib/tslib.js
37675
+ // ../../node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.js
37676
37676
  var require_tslib = __commonJS({
37677
- "../../node_modules/.pnpm/tslib@2.4.1/node_modules/tslib/tslib.js"(exports, module) {
37677
+ "../../node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.js"(exports, module) {
37678
37678
  var __extends;
37679
37679
  var __assign;
37680
37680
  var __rest;
37681
37681
  var __decorate;
37682
37682
  var __param;
37683
+ var __esDecorate;
37684
+ var __runInitializers;
37685
+ var __propKey;
37686
+ var __setFunctionName;
37683
37687
  var __metadata;
37684
37688
  var __awaiter;
37685
37689
  var __generator;
@@ -37776,6 +37780,65 @@ var require_tslib = __commonJS({
37776
37780
  decorator(target, key, paramIndex);
37777
37781
  };
37778
37782
  };
37783
+ __esDecorate = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
37784
+ function accept(f) {
37785
+ if (f !== void 0 && typeof f !== "function")
37786
+ throw new TypeError("Function expected");
37787
+ return f;
37788
+ }
37789
+ var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
37790
+ var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
37791
+ var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
37792
+ var _, done = false;
37793
+ for (var i = decorators.length - 1; i >= 0; i--) {
37794
+ var context = {};
37795
+ for (var p in contextIn)
37796
+ context[p] = p === "access" ? {} : contextIn[p];
37797
+ for (var p in contextIn.access)
37798
+ context.access[p] = contextIn.access[p];
37799
+ context.addInitializer = function(f) {
37800
+ if (done)
37801
+ throw new TypeError("Cannot add initializers after decoration has completed");
37802
+ extraInitializers.push(accept(f || null));
37803
+ };
37804
+ var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
37805
+ if (kind === "accessor") {
37806
+ if (result === void 0)
37807
+ continue;
37808
+ if (result === null || typeof result !== "object")
37809
+ throw new TypeError("Object expected");
37810
+ if (_ = accept(result.get))
37811
+ descriptor.get = _;
37812
+ if (_ = accept(result.set))
37813
+ descriptor.set = _;
37814
+ if (_ = accept(result.init))
37815
+ initializers.push(_);
37816
+ } else if (_ = accept(result)) {
37817
+ if (kind === "field")
37818
+ initializers.push(_);
37819
+ else
37820
+ descriptor[key] = _;
37821
+ }
37822
+ }
37823
+ if (target)
37824
+ Object.defineProperty(target, contextIn.name, descriptor);
37825
+ done = true;
37826
+ };
37827
+ __runInitializers = function(thisArg, initializers, value) {
37828
+ var useValue = arguments.length > 2;
37829
+ for (var i = 0; i < initializers.length; i++) {
37830
+ value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg);
37831
+ }
37832
+ return useValue ? value : void 0;
37833
+ };
37834
+ __propKey = function(x) {
37835
+ return typeof x === "symbol" ? x : "".concat(x);
37836
+ };
37837
+ __setFunctionName = function(f, name, prefix) {
37838
+ if (typeof name === "symbol")
37839
+ name = name.description ? "[".concat(name.description, "]") : "";
37840
+ return Object.defineProperty(f, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
37841
+ };
37779
37842
  __metadata = function(metadataKey, metadataValue) {
37780
37843
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
37781
37844
  return Reflect.metadata(metadataKey, metadataValue);
@@ -38010,7 +38073,7 @@ var require_tslib = __commonJS({
38010
38073
  }, i;
38011
38074
  function verb(n, f) {
38012
38075
  i[n] = o[n] ? function(v) {
38013
- return (p = !p) ? { value: __await(o[n](v)), done: n === "return" } : f ? f(v) : v;
38076
+ return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v;
38014
38077
  } : f;
38015
38078
  }
38016
38079
  };
@@ -38088,6 +38151,10 @@ var require_tslib = __commonJS({
38088
38151
  exporter("__rest", __rest);
38089
38152
  exporter("__decorate", __decorate);
38090
38153
  exporter("__param", __param);
38154
+ exporter("__esDecorate", __esDecorate);
38155
+ exporter("__runInitializers", __runInitializers);
38156
+ exporter("__propKey", __propKey);
38157
+ exporter("__setFunctionName", __setFunctionName);
38091
38158
  exporter("__metadata", __metadata);
38092
38159
  exporter("__awaiter", __awaiter);
38093
38160
  exporter("__generator", __generator);
@@ -54202,6 +54269,10 @@ var CachePolicy = {
54202
54269
  NetworkOnly: "NetworkOnly",
54203
54270
  CacheAndNetwork: "CacheAndNetwork"
54204
54271
  };
54272
+ var PaginateMode = {
54273
+ Infinite: "Infinite",
54274
+ SinglePage: "SinglePage"
54275
+ };
54205
54276
  var ArtifactKind = {
54206
54277
  Query: "HoudiniQuery",
54207
54278
  Subscription: "HoudiniSubscription",
@@ -58006,6 +58077,7 @@ async function paginate(config2, documents) {
58006
58077
  let refetchQueryName = "";
58007
58078
  let nodeQuery = false;
58008
58079
  let fragment = "";
58080
+ let paginateMode = config2.defaultPaginateMode;
58009
58081
  doc.document = graphql9.visit(doc.document, {
58010
58082
  OperationDefinition(node) {
58011
58083
  if (node.operation !== "query") {
@@ -58071,6 +58143,14 @@ async function paginate(config2, documents) {
58071
58143
  }
58072
58144
  },
58073
58145
  Directive(node) {
58146
+ if (node.name.value === config2.paginateDirective) {
58147
+ const paginateModeArg = node?.arguments?.find(
58148
+ (arg) => arg.name.value === config2.paginateModeArg
58149
+ );
58150
+ if (paginateModeArg && paginateModeArg.value.kind === "EnumValue") {
58151
+ paginateMode = paginateModeArg.value.value;
58152
+ }
58153
+ }
58074
58154
  if (node.name.value !== config2.argumentsDirective) {
58075
58155
  return;
58076
58156
  }
@@ -58115,7 +58195,8 @@ async function paginate(config2, documents) {
58115
58195
  targetType,
58116
58196
  paginated: true,
58117
58197
  direction,
58118
- start
58198
+ start,
58199
+ mode: paginateMode
58119
58200
  };
58120
58201
  if (!fragment) {
58121
58202
  continue;
@@ -58464,7 +58545,9 @@ async function addListFragments(config2, documents) {
58464
58545
  doc.document = graphql10.visit(doc.document, {
58465
58546
  Directive(node, key, parent, path2, ancestors) {
58466
58547
  if ([config2.listDirective, config2.paginateDirective].includes(node.name.value)) {
58467
- const nameArg = node.arguments?.find((arg) => arg.name.value === "name");
58548
+ const nameArg = node.arguments?.find(
58549
+ (arg) => arg.name.value === config2.listOrPaginateNameArg
58550
+ );
58468
58551
  let error = {
58469
58552
  ...new graphql10.GraphQLError(
58470
58553
  "",
@@ -58764,14 +58847,23 @@ function fieldKey(config2, field) {
58764
58847
  const attributeName = field.alias?.value || field.name.value;
58765
58848
  const printed = graphql11.print(field);
58766
58849
  const secondParse = graphql11.parse(`{${printed}}`).definitions[0].selectionSet.selections[0];
58767
- const paginated = !!field.directives?.find(
58850
+ let paginateMode = config2.defaultPaginateMode;
58851
+ const paginatedDirective = field.directives?.find(
58768
58852
  (directive) => directive.name.value === config2.paginateDirective
58769
58853
  );
58770
- const paginationArgs = ["first", "after", "last", "before", "limit", "offset"];
58854
+ if (paginatedDirective) {
58855
+ const paginateModeArg = paginatedDirective?.arguments?.find(
58856
+ (arg) => arg.name.value === config2.paginateModeArg
58857
+ );
58858
+ if (paginateModeArg && paginateModeArg.value.kind === "EnumValue") {
58859
+ paginateMode = paginateModeArg.value.value;
58860
+ }
58861
+ }
58862
+ const paginationArgs = paginateMode === "SinglePage" ? [] : ["first", "after", "last", "before", "limit", "offset"];
58771
58863
  const argObj = (secondParse.arguments || []).reduce((acc, arg) => {
58772
58864
  const start = arg.value.loc?.start;
58773
58865
  const end = arg.value.loc?.end;
58774
- if (paginated && paginationArgs.includes(arg.name.value)) {
58866
+ if (paginatedDirective && paginationArgs.includes(arg.name.value)) {
58775
58867
  return acc;
58776
58868
  }
58777
58869
  if (!start || !end) {
@@ -58785,7 +58877,7 @@ function fieldKey(config2, field) {
58785
58877
  const args = Object.keys(argObj);
58786
58878
  args.sort();
58787
58879
  let key = Object.values(argObj).length > 0 ? `${attributeName}(${args.map((key2) => `${key2}: ${argObj[key2]}`).join(", ")})` : attributeName;
58788
- if (paginated) {
58880
+ if (paginatedDirective) {
58789
58881
  key = key + "::paginated";
58790
58882
  }
58791
58883
  return key;
@@ -58925,7 +59017,9 @@ function selection({
58925
59017
  const listDirective = field.directives?.find(
58926
59018
  (directive) => [config2.listDirective, config2.paginateDirective].includes(directive.name.value)
58927
59019
  );
58928
- const nameArg = listDirective?.arguments?.find((arg) => arg.name.value === "name");
59020
+ const nameArg = listDirective?.arguments?.find(
59021
+ (arg) => arg.name.value === config2.listOrPaginateNameArg
59022
+ );
58929
59023
  if (nameArg && nameArg.value.kind === "StringValue") {
58930
59024
  const { connection, type: connectionType } = connectionSelection(
58931
59025
  config2,
@@ -59044,7 +59138,7 @@ function artifactGenerator(stats) {
59044
59138
  return;
59045
59139
  }
59046
59140
  const nameArg = node.arguments?.find(
59047
- (arg) => arg.name.value === config2.listNameArg
59141
+ (arg) => arg.name.value === config2.listOrPaginateNameArg
59048
59142
  );
59049
59143
  if (!nameArg || nameArg.value.kind !== "StringValue") {
59050
59144
  throw new HoudiniError({
@@ -60414,7 +60508,9 @@ function listDefinitions(config2, body, docs) {
60414
60508
  if (![config2.listDirective, config2.paginateDirective].includes(node.name.value)) {
60415
60509
  return;
60416
60510
  }
60417
- const nameArg = node.arguments?.find((arg) => arg.name.value === "name");
60511
+ const nameArg = node.arguments?.find(
60512
+ (arg) => arg.name.value === config2.listOrPaginateNameArg
60513
+ );
60418
60514
  const nameValue = nameArg?.value?.value || "";
60419
60515
  if (!nameValue || visitedLists.has(nameValue)) {
60420
60516
  return;
@@ -60739,17 +60835,22 @@ enum CachePolicy {
60739
60835
  ${CachePolicy.NetworkOnly}
60740
60836
  }
60741
60837
 
60838
+ enum PaginateMode {
60839
+ ${PaginateMode.Infinite}
60840
+ ${PaginateMode.SinglePage}
60841
+ }
60842
+
60742
60843
  """
60743
60844
  @${config2.listDirective} is used to mark a field for the runtime as a place to add or remove
60744
60845
  entities in mutations
60745
60846
  """
60746
- directive @${config2.listDirective}(${config2.listNameArg}: String!, connection: Boolean) on FIELD
60847
+ directive @${config2.listDirective}(${config2.listOrPaginateNameArg}: String!, connection: Boolean) on FIELD
60747
60848
 
60748
60849
  """
60749
60850
  @${config2.paginateDirective} is used to to mark a field for pagination.
60750
60851
  More info in the [doc](${siteURL}/guides/pagination).
60751
60852
  """
60752
- directive @${config2.paginateDirective}(${config2.paginateNameArg}: String) on FIELD
60853
+ directive @${config2.paginateDirective}(${config2.listOrPaginateNameArg}: String, ${config2.paginateModeArg}: PaginateMode) on FIELD
60753
60854
 
60754
60855
  """
60755
60856
  @${config2.listPrependDirective} is used to tell the runtime to add the result to the end of the list
@@ -61015,7 +61116,7 @@ async function typeCheck(config2, docs) {
61015
61116
  }
61016
61117
  needsParent = needsParent || definition.kind === "FragmentDefinition";
61017
61118
  const nameArg = directive.arguments?.find(
61018
- ({ name }) => name.value === config2.listNameArg
61119
+ ({ name }) => name.value === config2.listOrPaginateNameArg
61019
61120
  );
61020
61121
  if (!nameArg) {
61021
61122
  if (directive.name.value === config2.listDirective) {
@@ -61495,7 +61596,14 @@ function paginateArgs(config2, filepath) {
61495
61596
  )
61496
61597
  );
61497
61598
  }
61498
- if (forward && backwards) {
61599
+ const paginateModeArg = node?.arguments?.find(
61600
+ (arg) => arg.name.value === config2.paginateModeArg
61601
+ );
61602
+ let paginateMode = config2.defaultPaginateMode;
61603
+ if (paginateModeArg && paginateModeArg.value.kind === "EnumValue") {
61604
+ paginateMode = paginateModeArg.value.value;
61605
+ }
61606
+ if (forward && backwards && paginateMode === "Infinite") {
61499
61607
  ctx.reportError(
61500
61608
  new graphql24.GraphQLError(
61501
61609
  `A field with cursor pagination cannot go forwards an backwards simultaneously`
@@ -1,5 +1,5 @@
1
1
  import * as graphql from 'graphql';
2
- import type { CachePolicies, ConfigFile } from '../runtime/lib';
2
+ import type { CachePolicies, ConfigFile, PaginateModes } from '../runtime/lib';
3
3
  import type { LogLevels, PluginConfig, PluginHooks } from './types';
4
4
  export type PluginMeta = PluginHooks & {
5
5
  name: string;
@@ -21,6 +21,7 @@ export declare class Config {
21
21
  defaultPartial: boolean;
22
22
  internalListPosition: 'first' | 'last';
23
23
  defaultListTarget: 'all' | null;
24
+ defaultPaginateMode: PaginateModes;
24
25
  definitionsFolder?: string;
25
26
  newDocuments: string;
26
27
  defaultKeys: string[];
@@ -90,7 +91,7 @@ export declare class Config {
90
91
  */
91
92
  get deprecatedlistDirectiveParentIDArg(): string;
92
93
  get listAllListsDirective(): string;
93
- get listNameArg(): string;
94
+ get listOrPaginateNameArg(): string;
94
95
  get insertFragmentSuffix(): string;
95
96
  get removeFragmentSuffix(): string;
96
97
  get toggleFragmentSuffix(): string;
@@ -101,7 +102,7 @@ export declare class Config {
101
102
  get argumentsDirective(): string;
102
103
  get withDirective(): string;
103
104
  get paginateDirective(): string;
104
- get paginateNameArg(): string;
105
+ get paginateModeArg(): string;
105
106
  get cacheDirective(): string;
106
107
  get cachePartialArg(): string;
107
108
  get cachePolicyArg(): string;
@@ -0,0 +1,11 @@
1
+ type DetectedFromPackageTools = {
2
+ framework: 'kit' | 'sapper' | 'svelte';
3
+ module: 'esm' | 'commonjs';
4
+ };
5
+ export type DetectedTools = {
6
+ typescript: boolean;
7
+ package_manager: 'npm' | 'yarn' | 'pnpm';
8
+ } & DetectedFromPackageTools;
9
+ export declare function detectFromPackageJSON(cwd: string): Promise<DetectedFromPackageTools>;
10
+ export declare function detectTools(cwd: string): Promise<DetectedTools>;
11
+ export {};
@@ -11,6 +11,7 @@ export * from './introspection';
11
11
  export * from './cleanupFiles';
12
12
  export * from './deepMerge';
13
13
  export * from './plugin';
14
+ export * from './detectTools';
14
15
  export * from './walk';
15
16
  export type { EmbeddedGraphqlDocument } from './walk';
16
17
  export * as fs from './fs';