houdini 1.0.6 → 1.0.8
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.
- package/build/cmd-cjs/index.js +220 -94
- package/build/cmd-esm/index.js +220 -94
- package/build/codegen-cjs/index.js +130 -16
- package/build/codegen-esm/index.js +130 -16
- package/build/lib/config.d.ts +4 -3
- package/build/lib/detectTools.d.ts +11 -0
- package/build/lib/index.d.ts +1 -0
- package/build/lib-cjs/index.js +139 -8
- package/build/lib-esm/index.js +136 -8
- package/build/runtime/client/plugins/throwOnError.d.ts +2 -2
- package/build/runtime/lib/config.d.ts +5 -1
- package/build/runtime/lib/types.d.ts +7 -1
- package/build/runtime-cjs/client/plugins/throwOnError.d.ts +2 -2
- package/build/runtime-cjs/client/plugins/throwOnError.js +1 -1
- package/build/runtime-cjs/lib/config.d.ts +5 -1
- package/build/runtime-cjs/lib/types.d.ts +7 -1
- package/build/runtime-cjs/lib/types.js +6 -0
- package/build/runtime-esm/client/plugins/throwOnError.d.ts +2 -2
- package/build/runtime-esm/client/plugins/throwOnError.js +1 -1
- package/build/runtime-esm/lib/config.d.ts +5 -1
- package/build/runtime-esm/lib/types.d.ts +7 -1
- package/build/runtime-esm/lib/types.js +5 -0
- package/build/test-cjs/index.js +137 -20
- package/build/test-esm/index.js +137 -20
- package/build/vite-cjs/index.js +137 -20
- package/build/vite-esm/index.js +137 -20
- package/package.json +1 -2
package/build/test-esm/index.js
CHANGED
|
@@ -37672,14 +37672,18 @@ var require_lib3 = __commonJS({
|
|
|
37672
37672
|
}
|
|
37673
37673
|
});
|
|
37674
37674
|
|
|
37675
|
-
// ../../node_modules/.pnpm/tslib@2.
|
|
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.
|
|
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:
|
|
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);
|
|
@@ -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",
|
|
@@ -56556,6 +56627,7 @@ var Config = class {
|
|
|
56556
56627
|
defaultPartial;
|
|
56557
56628
|
internalListPosition;
|
|
56558
56629
|
defaultListTarget = null;
|
|
56630
|
+
defaultPaginateMode;
|
|
56559
56631
|
definitionsFolder;
|
|
56560
56632
|
newDocuments = "";
|
|
56561
56633
|
defaultKeys = ["id"];
|
|
@@ -56592,6 +56664,7 @@ var Config = class {
|
|
|
56592
56664
|
defaultPartial = false,
|
|
56593
56665
|
defaultListPosition = "append",
|
|
56594
56666
|
defaultListTarget = null,
|
|
56667
|
+
defaultPaginateMode = PaginateMode.Infinite,
|
|
56595
56668
|
defaultKeys,
|
|
56596
56669
|
types: types14 = {},
|
|
56597
56670
|
logLevel,
|
|
@@ -56625,6 +56698,7 @@ var Config = class {
|
|
|
56625
56698
|
this.defaultPartial = defaultPartial;
|
|
56626
56699
|
this.internalListPosition = defaultListPosition === "append" ? "last" : "first";
|
|
56627
56700
|
this.defaultListTarget = defaultListTarget;
|
|
56701
|
+
this.defaultPaginateMode = defaultPaginateMode;
|
|
56628
56702
|
this.definitionsFolder = definitionsPath;
|
|
56629
56703
|
this.logLevel = (logLevel || LogLevel.Summary).toLowerCase();
|
|
56630
56704
|
this.defaultFragmentMasking = defaultFragmentMasking;
|
|
@@ -56888,7 +56962,7 @@ var Config = class {
|
|
|
56888
56962
|
get listAllListsDirective() {
|
|
56889
56963
|
return "allLists";
|
|
56890
56964
|
}
|
|
56891
|
-
get
|
|
56965
|
+
get listOrPaginateNameArg() {
|
|
56892
56966
|
return "name";
|
|
56893
56967
|
}
|
|
56894
56968
|
get insertFragmentSuffix() {
|
|
@@ -56921,8 +56995,8 @@ var Config = class {
|
|
|
56921
56995
|
get paginateDirective() {
|
|
56922
56996
|
return "paginate";
|
|
56923
56997
|
}
|
|
56924
|
-
get
|
|
56925
|
-
return "
|
|
56998
|
+
get paginateModeArg() {
|
|
56999
|
+
return "mode";
|
|
56926
57000
|
}
|
|
56927
57001
|
get cacheDirective() {
|
|
56928
57002
|
return "cache";
|
|
@@ -56964,7 +57038,7 @@ var Config = class {
|
|
|
56964
57038
|
return name + this.removeFragmentSuffix;
|
|
56965
57039
|
}
|
|
56966
57040
|
isInternalEnum(node) {
|
|
56967
|
-
return node.name.value === "CachePolicy";
|
|
57041
|
+
return node.name.value === "CachePolicy" || node.name.value === "PaginateMode";
|
|
56968
57042
|
}
|
|
56969
57043
|
isInternalDirective(name) {
|
|
56970
57044
|
const internalDirectives = this.#newSchemaInstance?.getDirectives().reduce((list, directive) => {
|
|
@@ -58324,6 +58398,7 @@ async function paginate(config2, documents) {
|
|
|
58324
58398
|
let refetchQueryName = "";
|
|
58325
58399
|
let nodeQuery = false;
|
|
58326
58400
|
let fragment = "";
|
|
58401
|
+
let paginateMode = config2.defaultPaginateMode;
|
|
58327
58402
|
doc.document = graphql8.visit(doc.document, {
|
|
58328
58403
|
OperationDefinition(node) {
|
|
58329
58404
|
if (node.operation !== "query") {
|
|
@@ -58389,6 +58464,14 @@ async function paginate(config2, documents) {
|
|
|
58389
58464
|
}
|
|
58390
58465
|
},
|
|
58391
58466
|
Directive(node) {
|
|
58467
|
+
if (node.name.value === config2.paginateDirective) {
|
|
58468
|
+
const paginateModeArg = node?.arguments?.find(
|
|
58469
|
+
(arg) => arg.name.value === config2.paginateModeArg
|
|
58470
|
+
);
|
|
58471
|
+
if (paginateModeArg && paginateModeArg.value.kind === "EnumValue") {
|
|
58472
|
+
paginateMode = paginateModeArg.value.value;
|
|
58473
|
+
}
|
|
58474
|
+
}
|
|
58392
58475
|
if (node.name.value !== config2.argumentsDirective) {
|
|
58393
58476
|
return;
|
|
58394
58477
|
}
|
|
@@ -58433,7 +58516,8 @@ async function paginate(config2, documents) {
|
|
|
58433
58516
|
targetType,
|
|
58434
58517
|
paginated: true,
|
|
58435
58518
|
direction,
|
|
58436
|
-
start
|
|
58519
|
+
start,
|
|
58520
|
+
mode: paginateMode
|
|
58437
58521
|
};
|
|
58438
58522
|
if (!fragment) {
|
|
58439
58523
|
continue;
|
|
@@ -58782,7 +58866,9 @@ async function addListFragments(config2, documents) {
|
|
|
58782
58866
|
doc.document = graphql9.visit(doc.document, {
|
|
58783
58867
|
Directive(node, key, parent, path2, ancestors) {
|
|
58784
58868
|
if ([config2.listDirective, config2.paginateDirective].includes(node.name.value)) {
|
|
58785
|
-
const nameArg = node.arguments?.find(
|
|
58869
|
+
const nameArg = node.arguments?.find(
|
|
58870
|
+
(arg) => arg.name.value === config2.listOrPaginateNameArg
|
|
58871
|
+
);
|
|
58786
58872
|
let error = {
|
|
58787
58873
|
...new graphql9.GraphQLError(
|
|
58788
58874
|
"",
|
|
@@ -59082,14 +59168,23 @@ function fieldKey(config2, field) {
|
|
|
59082
59168
|
const attributeName = field.alias?.value || field.name.value;
|
|
59083
59169
|
const printed = graphql10.print(field);
|
|
59084
59170
|
const secondParse = graphql10.parse(`{${printed}}`).definitions[0].selectionSet.selections[0];
|
|
59085
|
-
|
|
59171
|
+
let paginateMode = config2.defaultPaginateMode;
|
|
59172
|
+
const paginatedDirective = field.directives?.find(
|
|
59086
59173
|
(directive) => directive.name.value === config2.paginateDirective
|
|
59087
59174
|
);
|
|
59088
|
-
|
|
59175
|
+
if (paginatedDirective) {
|
|
59176
|
+
const paginateModeArg = paginatedDirective?.arguments?.find(
|
|
59177
|
+
(arg) => arg.name.value === config2.paginateModeArg
|
|
59178
|
+
);
|
|
59179
|
+
if (paginateModeArg && paginateModeArg.value.kind === "EnumValue") {
|
|
59180
|
+
paginateMode = paginateModeArg.value.value;
|
|
59181
|
+
}
|
|
59182
|
+
}
|
|
59183
|
+
const paginationArgs = paginateMode === "SinglePage" ? [] : ["first", "after", "last", "before", "limit", "offset"];
|
|
59089
59184
|
const argObj = (secondParse.arguments || []).reduce((acc, arg) => {
|
|
59090
59185
|
const start = arg.value.loc?.start;
|
|
59091
59186
|
const end = arg.value.loc?.end;
|
|
59092
|
-
if (
|
|
59187
|
+
if (paginatedDirective && paginationArgs.includes(arg.name.value)) {
|
|
59093
59188
|
return acc;
|
|
59094
59189
|
}
|
|
59095
59190
|
if (!start || !end) {
|
|
@@ -59103,7 +59198,7 @@ function fieldKey(config2, field) {
|
|
|
59103
59198
|
const args = Object.keys(argObj);
|
|
59104
59199
|
args.sort();
|
|
59105
59200
|
let key = Object.values(argObj).length > 0 ? `${attributeName}(${args.map((key2) => `${key2}: ${argObj[key2]}`).join(", ")})` : attributeName;
|
|
59106
|
-
if (
|
|
59201
|
+
if (paginatedDirective) {
|
|
59107
59202
|
key = key + "::paginated";
|
|
59108
59203
|
}
|
|
59109
59204
|
return key;
|
|
@@ -59243,7 +59338,9 @@ function selection({
|
|
|
59243
59338
|
const listDirective = field.directives?.find(
|
|
59244
59339
|
(directive) => [config2.listDirective, config2.paginateDirective].includes(directive.name.value)
|
|
59245
59340
|
);
|
|
59246
|
-
const nameArg = listDirective?.arguments?.find(
|
|
59341
|
+
const nameArg = listDirective?.arguments?.find(
|
|
59342
|
+
(arg) => arg.name.value === config2.listOrPaginateNameArg
|
|
59343
|
+
);
|
|
59247
59344
|
if (nameArg && nameArg.value.kind === "StringValue") {
|
|
59248
59345
|
const { connection, type: connectionType } = connectionSelection(
|
|
59249
59346
|
config2,
|
|
@@ -59362,7 +59459,7 @@ function artifactGenerator(stats) {
|
|
|
59362
59459
|
return;
|
|
59363
59460
|
}
|
|
59364
59461
|
const nameArg = node.arguments?.find(
|
|
59365
|
-
(arg) => arg.name.value === config2.
|
|
59462
|
+
(arg) => arg.name.value === config2.listOrPaginateNameArg
|
|
59366
59463
|
);
|
|
59367
59464
|
if (!nameArg || nameArg.value.kind !== "StringValue") {
|
|
59368
59465
|
throw new HoudiniError({
|
|
@@ -60030,6 +60127,12 @@ function inlineType({
|
|
|
60030
60127
|
includeFragments,
|
|
60031
60128
|
allOptional
|
|
60032
60129
|
});
|
|
60130
|
+
const hasIncludeOrSkipDirective = selection2.directives && selection2.directives.filter(
|
|
60131
|
+
(directive) => directive.name.value === "include" || directive.name.value === "skip"
|
|
60132
|
+
).length > 0;
|
|
60133
|
+
if (hasIncludeOrSkipDirective) {
|
|
60134
|
+
attributeType = AST10.tsUnionType([attributeType, AST10.tsUndefinedKeyword()]);
|
|
60135
|
+
}
|
|
60033
60136
|
const prop = readonlyProperty(
|
|
60034
60137
|
AST10.tsPropertySignature(
|
|
60035
60138
|
AST10.identifier(attributeName),
|
|
@@ -60726,7 +60829,9 @@ function listDefinitions(config2, body, docs) {
|
|
|
60726
60829
|
if (![config2.listDirective, config2.paginateDirective].includes(node.name.value)) {
|
|
60727
60830
|
return;
|
|
60728
60831
|
}
|
|
60729
|
-
const nameArg = node.arguments?.find(
|
|
60832
|
+
const nameArg = node.arguments?.find(
|
|
60833
|
+
(arg) => arg.name.value === config2.listOrPaginateNameArg
|
|
60834
|
+
);
|
|
60730
60835
|
const nameValue = nameArg?.value?.value || "";
|
|
60731
60836
|
if (!nameValue || visitedLists.has(nameValue)) {
|
|
60732
60837
|
return;
|
|
@@ -61051,17 +61156,22 @@ enum CachePolicy {
|
|
|
61051
61156
|
${CachePolicy.NetworkOnly}
|
|
61052
61157
|
}
|
|
61053
61158
|
|
|
61159
|
+
enum PaginateMode {
|
|
61160
|
+
${PaginateMode.Infinite}
|
|
61161
|
+
${PaginateMode.SinglePage}
|
|
61162
|
+
}
|
|
61163
|
+
|
|
61054
61164
|
"""
|
|
61055
61165
|
@${config2.listDirective} is used to mark a field for the runtime as a place to add or remove
|
|
61056
61166
|
entities in mutations
|
|
61057
61167
|
"""
|
|
61058
|
-
directive @${config2.listDirective}(${config2.
|
|
61168
|
+
directive @${config2.listDirective}(${config2.listOrPaginateNameArg}: String!, connection: Boolean) on FIELD
|
|
61059
61169
|
|
|
61060
61170
|
"""
|
|
61061
61171
|
@${config2.paginateDirective} is used to to mark a field for pagination.
|
|
61062
61172
|
More info in the [doc](${siteURL}/guides/pagination).
|
|
61063
61173
|
"""
|
|
61064
|
-
directive @${config2.paginateDirective}(${config2.
|
|
61174
|
+
directive @${config2.paginateDirective}(${config2.listOrPaginateNameArg}: String, ${config2.paginateModeArg}: PaginateMode) on FIELD
|
|
61065
61175
|
|
|
61066
61176
|
"""
|
|
61067
61177
|
@${config2.listPrependDirective} is used to tell the runtime to add the result to the end of the list
|
|
@@ -61327,7 +61437,7 @@ async function typeCheck(config2, docs) {
|
|
|
61327
61437
|
}
|
|
61328
61438
|
needsParent = needsParent || definition.kind === "FragmentDefinition";
|
|
61329
61439
|
const nameArg = directive.arguments?.find(
|
|
61330
|
-
({ name }) => name.value === config2.
|
|
61440
|
+
({ name }) => name.value === config2.listOrPaginateNameArg
|
|
61331
61441
|
);
|
|
61332
61442
|
if (!nameArg) {
|
|
61333
61443
|
if (directive.name.value === config2.listDirective) {
|
|
@@ -61807,7 +61917,14 @@ function paginateArgs(config2, filepath) {
|
|
|
61807
61917
|
)
|
|
61808
61918
|
);
|
|
61809
61919
|
}
|
|
61810
|
-
|
|
61920
|
+
const paginateModeArg = node?.arguments?.find(
|
|
61921
|
+
(arg) => arg.name.value === config2.paginateModeArg
|
|
61922
|
+
);
|
|
61923
|
+
let paginateMode = config2.defaultPaginateMode;
|
|
61924
|
+
if (paginateModeArg && paginateModeArg.value.kind === "EnumValue") {
|
|
61925
|
+
paginateMode = paginateModeArg.value.value;
|
|
61926
|
+
}
|
|
61927
|
+
if (forward && backwards && paginateMode === "Infinite") {
|
|
61811
61928
|
ctx.reportError(
|
|
61812
61929
|
new graphql23.GraphQLError(
|
|
61813
61930
|
`A field with cursor pagination cannot go forwards an backwards simultaneously`
|
package/build/vite-cjs/index.js
CHANGED
|
@@ -45401,14 +45401,18 @@ var require_lib3 = __commonJS({
|
|
|
45401
45401
|
}
|
|
45402
45402
|
});
|
|
45403
45403
|
|
|
45404
|
-
// ../../node_modules/.pnpm/tslib@2.
|
|
45404
|
+
// ../../node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.js
|
|
45405
45405
|
var require_tslib = __commonJS({
|
|
45406
|
-
"../../node_modules/.pnpm/tslib@2.
|
|
45406
|
+
"../../node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.js"(exports, module2) {
|
|
45407
45407
|
var __extends;
|
|
45408
45408
|
var __assign;
|
|
45409
45409
|
var __rest;
|
|
45410
45410
|
var __decorate;
|
|
45411
45411
|
var __param;
|
|
45412
|
+
var __esDecorate;
|
|
45413
|
+
var __runInitializers;
|
|
45414
|
+
var __propKey;
|
|
45415
|
+
var __setFunctionName;
|
|
45412
45416
|
var __metadata;
|
|
45413
45417
|
var __awaiter;
|
|
45414
45418
|
var __generator;
|
|
@@ -45505,6 +45509,65 @@ var require_tslib = __commonJS({
|
|
|
45505
45509
|
decorator(target, key, paramIndex);
|
|
45506
45510
|
};
|
|
45507
45511
|
};
|
|
45512
|
+
__esDecorate = function(ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) {
|
|
45513
|
+
function accept(f3) {
|
|
45514
|
+
if (f3 !== void 0 && typeof f3 !== "function")
|
|
45515
|
+
throw new TypeError("Function expected");
|
|
45516
|
+
return f3;
|
|
45517
|
+
}
|
|
45518
|
+
var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value";
|
|
45519
|
+
var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null;
|
|
45520
|
+
var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {});
|
|
45521
|
+
var _, done = false;
|
|
45522
|
+
for (var i2 = decorators.length - 1; i2 >= 0; i2--) {
|
|
45523
|
+
var context = {};
|
|
45524
|
+
for (var p in contextIn)
|
|
45525
|
+
context[p] = p === "access" ? {} : contextIn[p];
|
|
45526
|
+
for (var p in contextIn.access)
|
|
45527
|
+
context.access[p] = contextIn.access[p];
|
|
45528
|
+
context.addInitializer = function(f3) {
|
|
45529
|
+
if (done)
|
|
45530
|
+
throw new TypeError("Cannot add initializers after decoration has completed");
|
|
45531
|
+
extraInitializers.push(accept(f3 || null));
|
|
45532
|
+
};
|
|
45533
|
+
var result = (0, decorators[i2])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context);
|
|
45534
|
+
if (kind === "accessor") {
|
|
45535
|
+
if (result === void 0)
|
|
45536
|
+
continue;
|
|
45537
|
+
if (result === null || typeof result !== "object")
|
|
45538
|
+
throw new TypeError("Object expected");
|
|
45539
|
+
if (_ = accept(result.get))
|
|
45540
|
+
descriptor.get = _;
|
|
45541
|
+
if (_ = accept(result.set))
|
|
45542
|
+
descriptor.set = _;
|
|
45543
|
+
if (_ = accept(result.init))
|
|
45544
|
+
initializers.push(_);
|
|
45545
|
+
} else if (_ = accept(result)) {
|
|
45546
|
+
if (kind === "field")
|
|
45547
|
+
initializers.push(_);
|
|
45548
|
+
else
|
|
45549
|
+
descriptor[key] = _;
|
|
45550
|
+
}
|
|
45551
|
+
}
|
|
45552
|
+
if (target)
|
|
45553
|
+
Object.defineProperty(target, contextIn.name, descriptor);
|
|
45554
|
+
done = true;
|
|
45555
|
+
};
|
|
45556
|
+
__runInitializers = function(thisArg, initializers, value) {
|
|
45557
|
+
var useValue = arguments.length > 2;
|
|
45558
|
+
for (var i2 = 0; i2 < initializers.length; i2++) {
|
|
45559
|
+
value = useValue ? initializers[i2].call(thisArg, value) : initializers[i2].call(thisArg);
|
|
45560
|
+
}
|
|
45561
|
+
return useValue ? value : void 0;
|
|
45562
|
+
};
|
|
45563
|
+
__propKey = function(x2) {
|
|
45564
|
+
return typeof x2 === "symbol" ? x2 : "".concat(x2);
|
|
45565
|
+
};
|
|
45566
|
+
__setFunctionName = function(f3, name, prefix) {
|
|
45567
|
+
if (typeof name === "symbol")
|
|
45568
|
+
name = name.description ? "[".concat(name.description, "]") : "";
|
|
45569
|
+
return Object.defineProperty(f3, "name", { configurable: true, value: prefix ? "".concat(prefix, " ", name) : name });
|
|
45570
|
+
};
|
|
45508
45571
|
__metadata = function(metadataKey, metadataValue) {
|
|
45509
45572
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
45510
45573
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
@@ -45739,7 +45802,7 @@ var require_tslib = __commonJS({
|
|
|
45739
45802
|
}, i2;
|
|
45740
45803
|
function verb(n, f3) {
|
|
45741
45804
|
i2[n] = o[n] ? function(v) {
|
|
45742
|
-
return (p = !p) ? { value: __await(o[n](v)), done:
|
|
45805
|
+
return (p = !p) ? { value: __await(o[n](v)), done: false } : f3 ? f3(v) : v;
|
|
45743
45806
|
} : f3;
|
|
45744
45807
|
}
|
|
45745
45808
|
};
|
|
@@ -45817,6 +45880,10 @@ var require_tslib = __commonJS({
|
|
|
45817
45880
|
exporter("__rest", __rest);
|
|
45818
45881
|
exporter("__decorate", __decorate);
|
|
45819
45882
|
exporter("__param", __param);
|
|
45883
|
+
exporter("__esDecorate", __esDecorate);
|
|
45884
|
+
exporter("__runInitializers", __runInitializers);
|
|
45885
|
+
exporter("__propKey", __propKey);
|
|
45886
|
+
exporter("__setFunctionName", __setFunctionName);
|
|
45820
45887
|
exporter("__metadata", __metadata);
|
|
45821
45888
|
exporter("__awaiter", __awaiter);
|
|
45822
45889
|
exporter("__generator", __generator);
|
|
@@ -65334,6 +65401,10 @@ var CachePolicy = {
|
|
|
65334
65401
|
NetworkOnly: "NetworkOnly",
|
|
65335
65402
|
CacheAndNetwork: "CacheAndNetwork"
|
|
65336
65403
|
};
|
|
65404
|
+
var PaginateMode = {
|
|
65405
|
+
Infinite: "Infinite",
|
|
65406
|
+
SinglePage: "SinglePage"
|
|
65407
|
+
};
|
|
65337
65408
|
var ArtifactKind = {
|
|
65338
65409
|
Query: "HoudiniQuery",
|
|
65339
65410
|
Subscription: "HoudiniSubscription",
|
|
@@ -68944,6 +69015,7 @@ var Config = class {
|
|
|
68944
69015
|
defaultPartial;
|
|
68945
69016
|
internalListPosition;
|
|
68946
69017
|
defaultListTarget = null;
|
|
69018
|
+
defaultPaginateMode;
|
|
68947
69019
|
definitionsFolder;
|
|
68948
69020
|
newDocuments = "";
|
|
68949
69021
|
defaultKeys = ["id"];
|
|
@@ -68980,6 +69052,7 @@ var Config = class {
|
|
|
68980
69052
|
defaultPartial = false,
|
|
68981
69053
|
defaultListPosition = "append",
|
|
68982
69054
|
defaultListTarget = null,
|
|
69055
|
+
defaultPaginateMode = PaginateMode.Infinite,
|
|
68983
69056
|
defaultKeys,
|
|
68984
69057
|
types: types17 = {},
|
|
68985
69058
|
logLevel,
|
|
@@ -69013,6 +69086,7 @@ var Config = class {
|
|
|
69013
69086
|
this.defaultPartial = defaultPartial;
|
|
69014
69087
|
this.internalListPosition = defaultListPosition === "append" ? "last" : "first";
|
|
69015
69088
|
this.defaultListTarget = defaultListTarget;
|
|
69089
|
+
this.defaultPaginateMode = defaultPaginateMode;
|
|
69016
69090
|
this.definitionsFolder = definitionsPath;
|
|
69017
69091
|
this.logLevel = (logLevel || LogLevel.Summary).toLowerCase();
|
|
69018
69092
|
this.defaultFragmentMasking = defaultFragmentMasking;
|
|
@@ -69276,7 +69350,7 @@ var Config = class {
|
|
|
69276
69350
|
get listAllListsDirective() {
|
|
69277
69351
|
return "allLists";
|
|
69278
69352
|
}
|
|
69279
|
-
get
|
|
69353
|
+
get listOrPaginateNameArg() {
|
|
69280
69354
|
return "name";
|
|
69281
69355
|
}
|
|
69282
69356
|
get insertFragmentSuffix() {
|
|
@@ -69309,8 +69383,8 @@ var Config = class {
|
|
|
69309
69383
|
get paginateDirective() {
|
|
69310
69384
|
return "paginate";
|
|
69311
69385
|
}
|
|
69312
|
-
get
|
|
69313
|
-
return "
|
|
69386
|
+
get paginateModeArg() {
|
|
69387
|
+
return "mode";
|
|
69314
69388
|
}
|
|
69315
69389
|
get cacheDirective() {
|
|
69316
69390
|
return "cache";
|
|
@@ -69352,7 +69426,7 @@ var Config = class {
|
|
|
69352
69426
|
return name + this.removeFragmentSuffix;
|
|
69353
69427
|
}
|
|
69354
69428
|
isInternalEnum(node) {
|
|
69355
|
-
return node.name.value === "CachePolicy";
|
|
69429
|
+
return node.name.value === "CachePolicy" || node.name.value === "PaginateMode";
|
|
69356
69430
|
}
|
|
69357
69431
|
isInternalDirective(name) {
|
|
69358
69432
|
const internalDirectives = this.#newSchemaInstance?.getDirectives().reduce((list, directive) => {
|
|
@@ -71119,6 +71193,7 @@ async function paginate(config4, documents) {
|
|
|
71119
71193
|
let refetchQueryName = "";
|
|
71120
71194
|
let nodeQuery = false;
|
|
71121
71195
|
let fragment = "";
|
|
71196
|
+
let paginateMode = config4.defaultPaginateMode;
|
|
71122
71197
|
doc.document = graphql10.visit(doc.document, {
|
|
71123
71198
|
OperationDefinition(node) {
|
|
71124
71199
|
if (node.operation !== "query") {
|
|
@@ -71184,6 +71259,14 @@ async function paginate(config4, documents) {
|
|
|
71184
71259
|
}
|
|
71185
71260
|
},
|
|
71186
71261
|
Directive(node) {
|
|
71262
|
+
if (node.name.value === config4.paginateDirective) {
|
|
71263
|
+
const paginateModeArg = node?.arguments?.find(
|
|
71264
|
+
(arg) => arg.name.value === config4.paginateModeArg
|
|
71265
|
+
);
|
|
71266
|
+
if (paginateModeArg && paginateModeArg.value.kind === "EnumValue") {
|
|
71267
|
+
paginateMode = paginateModeArg.value.value;
|
|
71268
|
+
}
|
|
71269
|
+
}
|
|
71187
71270
|
if (node.name.value !== config4.argumentsDirective) {
|
|
71188
71271
|
return;
|
|
71189
71272
|
}
|
|
@@ -71228,7 +71311,8 @@ async function paginate(config4, documents) {
|
|
|
71228
71311
|
targetType,
|
|
71229
71312
|
paginated: true,
|
|
71230
71313
|
direction,
|
|
71231
|
-
start
|
|
71314
|
+
start,
|
|
71315
|
+
mode: paginateMode
|
|
71232
71316
|
};
|
|
71233
71317
|
if (!fragment) {
|
|
71234
71318
|
continue;
|
|
@@ -71577,7 +71661,9 @@ async function addListFragments(config4, documents) {
|
|
|
71577
71661
|
doc.document = graphql11.visit(doc.document, {
|
|
71578
71662
|
Directive(node, key, parent, path2, ancestors) {
|
|
71579
71663
|
if ([config4.listDirective, config4.paginateDirective].includes(node.name.value)) {
|
|
71580
|
-
const nameArg = node.arguments?.find(
|
|
71664
|
+
const nameArg = node.arguments?.find(
|
|
71665
|
+
(arg) => arg.name.value === config4.listOrPaginateNameArg
|
|
71666
|
+
);
|
|
71581
71667
|
let error = {
|
|
71582
71668
|
...new graphql11.GraphQLError(
|
|
71583
71669
|
"",
|
|
@@ -71877,14 +71963,23 @@ function fieldKey(config4, field) {
|
|
|
71877
71963
|
const attributeName = field.alias?.value || field.name.value;
|
|
71878
71964
|
const printed = graphql12.print(field);
|
|
71879
71965
|
const secondParse = graphql12.parse(`{${printed}}`).definitions[0].selectionSet.selections[0];
|
|
71880
|
-
|
|
71966
|
+
let paginateMode = config4.defaultPaginateMode;
|
|
71967
|
+
const paginatedDirective = field.directives?.find(
|
|
71881
71968
|
(directive) => directive.name.value === config4.paginateDirective
|
|
71882
71969
|
);
|
|
71883
|
-
|
|
71970
|
+
if (paginatedDirective) {
|
|
71971
|
+
const paginateModeArg = paginatedDirective?.arguments?.find(
|
|
71972
|
+
(arg) => arg.name.value === config4.paginateModeArg
|
|
71973
|
+
);
|
|
71974
|
+
if (paginateModeArg && paginateModeArg.value.kind === "EnumValue") {
|
|
71975
|
+
paginateMode = paginateModeArg.value.value;
|
|
71976
|
+
}
|
|
71977
|
+
}
|
|
71978
|
+
const paginationArgs = paginateMode === "SinglePage" ? [] : ["first", "after", "last", "before", "limit", "offset"];
|
|
71884
71979
|
const argObj = (secondParse.arguments || []).reduce((acc, arg) => {
|
|
71885
71980
|
const start = arg.value.loc?.start;
|
|
71886
71981
|
const end = arg.value.loc?.end;
|
|
71887
|
-
if (
|
|
71982
|
+
if (paginatedDirective && paginationArgs.includes(arg.name.value)) {
|
|
71888
71983
|
return acc;
|
|
71889
71984
|
}
|
|
71890
71985
|
if (!start || !end) {
|
|
@@ -71898,7 +71993,7 @@ function fieldKey(config4, field) {
|
|
|
71898
71993
|
const args = Object.keys(argObj);
|
|
71899
71994
|
args.sort();
|
|
71900
71995
|
let key = Object.values(argObj).length > 0 ? `${attributeName}(${args.map((key2) => `${key2}: ${argObj[key2]}`).join(", ")})` : attributeName;
|
|
71901
|
-
if (
|
|
71996
|
+
if (paginatedDirective) {
|
|
71902
71997
|
key = key + "::paginated";
|
|
71903
71998
|
}
|
|
71904
71999
|
return key;
|
|
@@ -72038,7 +72133,9 @@ function selection({
|
|
|
72038
72133
|
const listDirective = field.directives?.find(
|
|
72039
72134
|
(directive) => [config4.listDirective, config4.paginateDirective].includes(directive.name.value)
|
|
72040
72135
|
);
|
|
72041
|
-
const nameArg = listDirective?.arguments?.find(
|
|
72136
|
+
const nameArg = listDirective?.arguments?.find(
|
|
72137
|
+
(arg) => arg.name.value === config4.listOrPaginateNameArg
|
|
72138
|
+
);
|
|
72042
72139
|
if (nameArg && nameArg.value.kind === "StringValue") {
|
|
72043
72140
|
const { connection, type: connectionType } = connectionSelection(
|
|
72044
72141
|
config4,
|
|
@@ -72157,7 +72254,7 @@ function artifactGenerator(stats) {
|
|
|
72157
72254
|
return;
|
|
72158
72255
|
}
|
|
72159
72256
|
const nameArg = node.arguments?.find(
|
|
72160
|
-
(arg) => arg.name.value === config4.
|
|
72257
|
+
(arg) => arg.name.value === config4.listOrPaginateNameArg
|
|
72161
72258
|
);
|
|
72162
72259
|
if (!nameArg || nameArg.value.kind !== "StringValue") {
|
|
72163
72260
|
throw new HoudiniError({
|
|
@@ -72825,6 +72922,12 @@ function inlineType({
|
|
|
72825
72922
|
includeFragments,
|
|
72826
72923
|
allOptional
|
|
72827
72924
|
});
|
|
72925
|
+
const hasIncludeOrSkipDirective = selection2.directives && selection2.directives.filter(
|
|
72926
|
+
(directive) => directive.name.value === "include" || directive.name.value === "skip"
|
|
72927
|
+
).length > 0;
|
|
72928
|
+
if (hasIncludeOrSkipDirective) {
|
|
72929
|
+
attributeType = AST10.tsUnionType([attributeType, AST10.tsUndefinedKeyword()]);
|
|
72930
|
+
}
|
|
72828
72931
|
const prop = readonlyProperty(
|
|
72829
72932
|
AST10.tsPropertySignature(
|
|
72830
72933
|
AST10.identifier(attributeName),
|
|
@@ -73521,7 +73624,9 @@ function listDefinitions(config4, body, docs) {
|
|
|
73521
73624
|
if (![config4.listDirective, config4.paginateDirective].includes(node.name.value)) {
|
|
73522
73625
|
return;
|
|
73523
73626
|
}
|
|
73524
|
-
const nameArg = node.arguments?.find(
|
|
73627
|
+
const nameArg = node.arguments?.find(
|
|
73628
|
+
(arg) => arg.name.value === config4.listOrPaginateNameArg
|
|
73629
|
+
);
|
|
73525
73630
|
const nameValue = nameArg?.value?.value || "";
|
|
73526
73631
|
if (!nameValue || visitedLists.has(nameValue)) {
|
|
73527
73632
|
return;
|
|
@@ -73846,17 +73951,22 @@ enum CachePolicy {
|
|
|
73846
73951
|
${CachePolicy.NetworkOnly}
|
|
73847
73952
|
}
|
|
73848
73953
|
|
|
73954
|
+
enum PaginateMode {
|
|
73955
|
+
${PaginateMode.Infinite}
|
|
73956
|
+
${PaginateMode.SinglePage}
|
|
73957
|
+
}
|
|
73958
|
+
|
|
73849
73959
|
"""
|
|
73850
73960
|
@${config4.listDirective} is used to mark a field for the runtime as a place to add or remove
|
|
73851
73961
|
entities in mutations
|
|
73852
73962
|
"""
|
|
73853
|
-
directive @${config4.listDirective}(${config4.
|
|
73963
|
+
directive @${config4.listDirective}(${config4.listOrPaginateNameArg}: String!, connection: Boolean) on FIELD
|
|
73854
73964
|
|
|
73855
73965
|
"""
|
|
73856
73966
|
@${config4.paginateDirective} is used to to mark a field for pagination.
|
|
73857
73967
|
More info in the [doc](${siteURL}/guides/pagination).
|
|
73858
73968
|
"""
|
|
73859
|
-
directive @${config4.paginateDirective}(${config4.
|
|
73969
|
+
directive @${config4.paginateDirective}(${config4.listOrPaginateNameArg}: String, ${config4.paginateModeArg}: PaginateMode) on FIELD
|
|
73860
73970
|
|
|
73861
73971
|
"""
|
|
73862
73972
|
@${config4.listPrependDirective} is used to tell the runtime to add the result to the end of the list
|
|
@@ -74122,7 +74232,7 @@ async function typeCheck(config4, docs) {
|
|
|
74122
74232
|
}
|
|
74123
74233
|
needsParent = needsParent || definition.kind === "FragmentDefinition";
|
|
74124
74234
|
const nameArg = directive.arguments?.find(
|
|
74125
|
-
({ name }) => name.value === config4.
|
|
74235
|
+
({ name }) => name.value === config4.listOrPaginateNameArg
|
|
74126
74236
|
);
|
|
74127
74237
|
if (!nameArg) {
|
|
74128
74238
|
if (directive.name.value === config4.listDirective) {
|
|
@@ -74602,7 +74712,14 @@ function paginateArgs(config4, filepath) {
|
|
|
74602
74712
|
)
|
|
74603
74713
|
);
|
|
74604
74714
|
}
|
|
74605
|
-
|
|
74715
|
+
const paginateModeArg = node?.arguments?.find(
|
|
74716
|
+
(arg) => arg.name.value === config4.paginateModeArg
|
|
74717
|
+
);
|
|
74718
|
+
let paginateMode = config4.defaultPaginateMode;
|
|
74719
|
+
if (paginateModeArg && paginateModeArg.value.kind === "EnumValue") {
|
|
74720
|
+
paginateMode = paginateModeArg.value.value;
|
|
74721
|
+
}
|
|
74722
|
+
if (forward && backwards && paginateMode === "Infinite") {
|
|
74606
74723
|
ctx.reportError(
|
|
74607
74724
|
new graphql25.GraphQLError(
|
|
74608
74725
|
`A field with cursor pagination cannot go forwards an backwards simultaneously`
|